From: Andrea Bianco Date: Fri, 19 Nov 2021 17:10:25 +0000 (+0100) Subject: Built motion from commit 14588770.|2.5.38 X-Git-Tag: 2.5.38 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=01b994ccefecbcf0783b039dab259e973f97957c;p=motion2.git Built motion from commit 14588770.|2.5.38 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 34c5b23..4e647a3 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1,6 +1,6 @@ define({ "name": "xCALLY Motion API", - "version": "2.5.37", + "version": "2.5.38", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-11-12T21:42:01.121Z", + "time": "2021-11-19T17:04:27.958Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 919c2ce..53d5c2b 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1,6 +1,6 @@ { "name": "xCALLY Motion API", - "version": "2.5.37", + "version": "2.5.38", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-11-12T21:42:01.121Z", + "time": "2021-11-19T17:04:27.958Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/package.json b/package.json index cc37218..8e477c5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.5.37", + "version": "2.5.38", "description": "xCALLY Motion is the new Realtime asynchronous solution for your multichannel contact center over Asterisk.", "main": "server/app.js", "engines": { diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 6ccd104..1ebcf76 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 _0x99c8=['contactManager','integration','motionbar','jscripty','urlForward','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','VIRTUAL','getDataValue','STRING'];(function(_0x32e258,_0x1d3f11){var _0x5588ac=function(_0x36fed3){while(--_0x36fed3){_0x32e258['push'](_0x32e258['shift']());}};_0x5588ac(++_0x1d3f11);}(_0x99c8,0x10d));var _0x899c=function(_0x2a7743,_0x29a512){_0x2a7743=_0x2a7743-0x0;var _0x394937=_0x99c8[_0x2a7743];return _0x394937;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x899c('0x0')],'get':function(_0x71dfc9){return this[_0x899c('0x1')]('action');}},'action':{'type':Sequelize[_0x899c('0x2')],'allowNull':![],'validate':{'isIn':{'args':[[_0x899c('0x3'),_0x899c('0x4'),_0x899c('0x5'),_0x899c('0x6'),_0x899c('0x7'),_0x899c('0x8'),'bot',_0x899c('0x9')]],'msg':_0x899c('0xa')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x899c('0x2')](0x1000),'comment':_0x899c('0xb')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x899c('0xc')},'data3':{'type':Sequelize[_0x899c('0x2')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x899c('0xd')},'data5':{'type':Sequelize[_0x899c('0x2')](0x1000),'comments':_0x899c('0xe')},'data6':{'type':Sequelize[_0x899c('0x2')],'comments':_0x899c('0xf')},'data7':{'type':Sequelize['TEXT'],'comments':_0x899c('0x10')}}; \ No newline at end of file +var _0x4b36=['exports','getDataValue','STRING','contactManager','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[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','TEXT','urlForward[body]','sequelize'];(function(_0x2545c1,_0x254716){var _0x9b57=function(_0xc52e2c){while(--_0xc52e2c){_0x2545c1['push'](_0x2545c1['shift']());}};_0x9b57(++_0x254716);}(_0x4b36,0x14f));var _0x64b3=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x4b36[_0x4b7895];return _0x264180;};'use strict';var Sequelize=require(_0x64b3('0x0'));module[_0x64b3('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x198c03){return this[_0x64b3('0x2')]('action');}},'action':{'type':Sequelize[_0x64b3('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x64b3('0x4'),'integration',_0x64b3('0x5'),_0x64b3('0x6'),'urlForward',_0x64b3('0x7'),_0x64b3('0x8'),_0x64b3('0x9')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x64b3('0xa')},'data1':{'type':Sequelize[_0x64b3('0x3')](0x1000),'comment':_0x64b3('0xb')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x64b3('0xc')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0x64b3('0x3')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x64b3('0xd')},'data6':{'type':Sequelize['STRING'],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x64b3('0xe')],'comments':_0x64b3('0xf')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index ff73626..aae9bc0 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 _0xee3e=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','body','find','params','Action','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','path'];(function(_0x1c2a50,_0x6395f9){var _0x1c0929=function(_0x5c1180){while(--_0x5c1180){_0x1c2a50['push'](_0x1c2a50['shift']());}};_0x1c0929(++_0x6395f9);}(_0xee3e,0x1aa));var _0xeee3=function(_0x4b0893,_0x22d275){_0x4b0893=_0x4b0893-0x0;var _0x1a1637=_0xee3e[_0x4b0893];return _0x1a1637;};'use strict';var emlformat=require(_0xeee3('0x0'));var rimraf=require(_0xeee3('0x1'));var zipdir=require(_0xeee3('0x2'));var jsonpatch=require(_0xeee3('0x3'));var rp=require('request-promise');var moment=require(_0xeee3('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xeee3('0x5'));var sox=require(_0xeee3('0x6'));var csv=require(_0xeee3('0x7'));var ejs=require(_0xeee3('0x8'));var fs=require('fs');var fs_extra=require(_0xeee3('0x9'));var _=require(_0xeee3('0xa'));var squel=require(_0xeee3('0xb'));var crypto=require(_0xeee3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xeee3('0xd'));var toCsv=require(_0xeee3('0x7'));var querystring=require(_0xeee3('0xe'));var Papa=require(_0xeee3('0xf'));var Redis=require(_0xeee3('0x10'));var authService=require(_0xeee3('0x11'));var qs=require(_0xeee3('0x12'));var as=require(_0xeee3('0x13'));var hardwareService=require(_0xeee3('0x14'));var logger=require(_0xeee3('0x15'))('api');var utils=require(_0xeee3('0x16'));var config=require(_0xeee3('0x17'));var licenseUtil=require(_0xeee3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e3ad9,_0x301fc7){_0x301fc7=_0x301fc7||0xcc;return function(_0x560b47){if(_0x560b47){return _0x5e3ad9[_0xeee3('0x19')](_0x301fc7);}return _0x5e3ad9['status'](_0x301fc7)[_0xeee3('0x1a')]();};}function respondWithResult(_0x276dd8,_0x5d2d8c){_0x5d2d8c=_0x5d2d8c||0xc8;return function(_0x49ae40){if(_0x49ae40){return _0x276dd8[_0xeee3('0x1b')](_0x5d2d8c)[_0xeee3('0x1c')](_0x49ae40);}};}function respondWithFilteredResult(_0x1a777d,_0x42cd15){return function(_0x2f9a3a){if(_0x2f9a3a){var _0x3260bf=typeof _0x42cd15['offset']===_0xeee3('0x1d')&&typeof _0x42cd15[_0xeee3('0x1e')]==='undefined';var _0x1da5a4=_0x2f9a3a[_0xeee3('0x1f')];var _0x2a6e06=_0x3260bf?0x0:_0x42cd15[_0xeee3('0x20')];var _0x129d14=_0x3260bf?_0x2f9a3a[_0xeee3('0x1f')]:_0x42cd15['offset']+_0x42cd15[_0xeee3('0x1e')];var _0x23169f;if(_0x129d14>=_0x1da5a4){_0x129d14=_0x1da5a4;_0x23169f=0xc8;}else{_0x23169f=0xce;}_0x1a777d[_0xeee3('0x1b')](_0x23169f);return _0x1a777d['set'](_0xeee3('0x21'),_0x2a6e06+'-'+_0x129d14+'/'+_0x1da5a4)[_0xeee3('0x1c')](_0x2f9a3a);}return null;};}function patchUpdates(_0x42c74e){return function(_0x4de8e3){try{jsonpatch[_0xeee3('0x22')](_0x4de8e3,_0x42c74e,!![]);}catch(_0x267bad){return BPromise[_0xeee3('0x23')](_0x267bad);}return _0x4de8e3[_0xeee3('0x24')]();};}function saveUpdates(_0xc25a4c,_0x48a3a5){return function(_0x3c3226){if(_0x3c3226){return _0x3c3226['update'](_0xc25a4c)[_0xeee3('0x25')](function(_0x32b82e){return _0x32b82e;});}return null;};}function removeEntity(_0x4f9d4a,_0x482e30){return function(_0xac72c0){if(_0xac72c0){return _0xac72c0[_0xeee3('0x26')]()['then'](function(){_0x4f9d4a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x161a39,_0x17a561){return function(_0x4a4079){if(!_0x4a4079){_0x161a39[_0xeee3('0x19')](0x194);}return _0x4a4079;};}function handleError(_0x5725b9,_0x33f4a8){_0x33f4a8=_0x33f4a8||0x1f4;return function(_0x13cad2){logger[_0xeee3('0x27')](_0x13cad2[_0xeee3('0x28')]);if(_0x13cad2[_0xeee3('0x29')]){delete _0x13cad2[_0xeee3('0x29')];}_0x5725b9['status'](_0x33f4a8)[_0xeee3('0x2a')](_0x13cad2);};}exports['update']=function(_0x4f3c62,_0xc925f6){if(_0x4f3c62[_0xeee3('0x2b')]['id']){delete _0x4f3c62['body']['id'];}return db['Action'][_0xeee3('0x2c')]({'where':{'id':_0x4f3c62[_0xeee3('0x2d')]['id']}})[_0xeee3('0x25')](handleEntityNotFound(_0xc925f6,null))[_0xeee3('0x25')](saveUpdates(_0x4f3c62[_0xeee3('0x2b')],null))[_0xeee3('0x25')](respondWithResult(_0xc925f6,null))['catch'](handleError(_0xc925f6,null));};exports['destroy']=function(_0x52d5e0,_0x3c6646){return db[_0xeee3('0x2e')][_0xeee3('0x2c')]({'where':{'id':_0x52d5e0['params']['id']}})[_0xeee3('0x25')](handleEntityNotFound(_0x3c6646,null))[_0xeee3('0x25')](removeEntity(_0x3c6646,null))[_0xeee3('0x2f')](handleError(_0x3c6646,null));}; \ No newline at end of file +var _0x282a=['apply','reject','save','update','then','destroy','end','stack','name','send','body','Action','find','catch','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x47a7eb,_0x196830){var _0x34efd5=function(_0x71df23){while(--_0x71df23){_0x47a7eb['push'](_0x47a7eb['shift']());}};_0x34efd5(++_0x196830);}(_0x282a,0xa2));var _0xa282=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x282a[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa282('0x0'));var zipdir=require(_0xa282('0x1'));var jsonpatch=require(_0xa282('0x2'));var rp=require(_0xa282('0x3'));var moment=require(_0xa282('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa282('0x5'));var util=require(_0xa282('0x6'));var path=require('path');var sox=require(_0xa282('0x7'));var csv=require('to-csv');var ejs=require(_0xa282('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa282('0x9'));var squel=require(_0xa282('0xa'));var crypto=require(_0xa282('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa282('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa282('0xd'));var Papa=require(_0xa282('0xe'));var Redis=require(_0xa282('0xf'));var authService=require(_0xa282('0x10'));var qs=require(_0xa282('0x11'));var as=require(_0xa282('0x12'));var hardwareService=require(_0xa282('0x13'));var logger=require(_0xa282('0x14'))(_0xa282('0x15'));var utils=require(_0xa282('0x16'));var config=require(_0xa282('0x17'));var licenseUtil=require(_0xa282('0x18'));var db=require(_0xa282('0x19'))['db'];function respondWithStatusCode(_0x3ebaf9,_0x17891c){_0x17891c=_0x17891c||0xcc;return function(_0x37eb53){if(_0x37eb53){return _0x3ebaf9[_0xa282('0x1a')](_0x17891c);}return _0x3ebaf9[_0xa282('0x1b')](_0x17891c)['end']();};}function respondWithResult(_0x3a85b1,_0x37564b){_0x37564b=_0x37564b||0xc8;return function(_0x697eea){if(_0x697eea){return _0x3a85b1[_0xa282('0x1b')](_0x37564b)[_0xa282('0x1c')](_0x697eea);}};}function respondWithFilteredResult(_0x591e4f,_0x4d1349){return function(_0xdd8260){if(_0xdd8260){var _0xc2307a=typeof _0x4d1349[_0xa282('0x1d')]===_0xa282('0x1e')&&typeof _0x4d1349[_0xa282('0x1f')]==='undefined';var _0x5eee35=_0xdd8260[_0xa282('0x20')];var _0x19aef2=_0xc2307a?0x0:_0x4d1349[_0xa282('0x1d')];var _0x3280b7=_0xc2307a?_0xdd8260[_0xa282('0x20')]:_0x4d1349[_0xa282('0x1d')]+_0x4d1349[_0xa282('0x1f')];var _0x151268;if(_0x3280b7>=_0x5eee35){_0x3280b7=_0x5eee35;_0x151268=0xc8;}else{_0x151268=0xce;}_0x591e4f[_0xa282('0x1b')](_0x151268);return _0x591e4f[_0xa282('0x21')]('Content-Range',_0x19aef2+'-'+_0x3280b7+'/'+_0x5eee35)[_0xa282('0x1c')](_0xdd8260);}return null;};}function patchUpdates(_0x1cfe6d){return function(_0x59c626){try{jsonpatch[_0xa282('0x22')](_0x59c626,_0x1cfe6d,!![]);}catch(_0x1c9712){return BPromise[_0xa282('0x23')](_0x1c9712);}return _0x59c626[_0xa282('0x24')]();};}function saveUpdates(_0x1d63b5,_0x18f42c){return function(_0x4079fd){if(_0x4079fd){return _0x4079fd[_0xa282('0x25')](_0x1d63b5)[_0xa282('0x26')](function(_0x2b5b00){return _0x2b5b00;});}return null;};}function removeEntity(_0x2c15f8,_0x400cf4){return function(_0x426eda){if(_0x426eda){return _0x426eda[_0xa282('0x27')]()['then'](function(){_0x2c15f8['status'](0xcc)[_0xa282('0x28')]();});}};}function handleEntityNotFound(_0x3c616f,_0x44944a){return function(_0x42b336){if(!_0x42b336){_0x3c616f[_0xa282('0x1a')](0x194);}return _0x42b336;};}function handleError(_0x263245,_0xda7775){_0xda7775=_0xda7775||0x1f4;return function(_0x472e60){logger['error'](_0x472e60[_0xa282('0x29')]);if(_0x472e60['name']){delete _0x472e60[_0xa282('0x2a')];}_0x263245[_0xa282('0x1b')](_0xda7775)[_0xa282('0x2b')](_0x472e60);};}exports['update']=function(_0x4f83cc,_0x5dfa4e){if(_0x4f83cc[_0xa282('0x2c')]['id']){delete _0x4f83cc['body']['id'];}return db[_0xa282('0x2d')][_0xa282('0x2e')]({'where':{'id':_0x4f83cc['params']['id']}})[_0xa282('0x26')](handleEntityNotFound(_0x5dfa4e,null))[_0xa282('0x26')](saveUpdates(_0x4f83cc[_0xa282('0x2c')],null))[_0xa282('0x26')](respondWithResult(_0x5dfa4e,null))[_0xa282('0x2f')](handleError(_0x5dfa4e,null));};exports[_0xa282('0x27')]=function(_0x97c148,_0x5dfc44){return db[_0xa282('0x2d')][_0xa282('0x2e')]({'where':{'id':_0x97c148[_0xa282('0x30')]['id']}})[_0xa282('0x26')](handleEntityNotFound(_0x5dfc44,null))[_0xa282('0x26')](removeEntity(_0x5dfc44,null))['catch'](handleError(_0x5dfc44,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 813fb45..c73ea04 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 _0x707b=['exports','Action','tools_actions','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./action.attributes'];(function(_0xa0e676,_0x5df7a5){var _0xc2e0d6=function(_0x6c7ac0){while(--_0x6c7ac0){_0xa0e676['push'](_0xa0e676['shift']());}};_0xc2e0d6(++_0x5df7a5);}(_0x707b,0xdf));var _0xb707=function(_0x219729,_0x19f07d){_0x219729=_0x219729-0x0;var _0x35c464=_0x707b[_0x219729];return _0x35c464;};'use strict';var _=require(_0xb707('0x0'));var util=require(_0xb707('0x1'));var logger=require(_0xb707('0x2'))('api');var moment=require(_0xb707('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb707('0x4'));var rimraf=require(_0xb707('0x5'));var config=require(_0xb707('0x6'));var attributes=require(_0xb707('0x7'));module[_0xb707('0x8')]=function(_0x5b6fc6,_0x4b8f73){return _0x5b6fc6['define'](_0xb707('0x9'),attributes,{'tableName':_0xb707('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7540=['../../config/environment','./action.attributes','define','Action','tools_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1bb15e,_0x3ed4fe){var _0x3d8841=function(_0x18b9e9){while(--_0x18b9e9){_0x1bb15e['push'](_0x1bb15e['shift']());}};_0x3d8841(++_0x3ed4fe);}(_0x7540,0x1d3));var _0x0754=function(_0x21481c,_0x1b51ba){_0x21481c=_0x21481c-0x0;var _0x5dd77a=_0x7540[_0x21481c];return _0x5dd77a;};'use strict';var _=require(_0x0754('0x0'));var util=require(_0x0754('0x1'));var logger=require(_0x0754('0x2'))(_0x0754('0x3'));var moment=require(_0x0754('0x4'));var BPromise=require(_0x0754('0x5'));var rp=require(_0x0754('0x6'));var fs=require('fs');var path=require(_0x0754('0x7'));var rimraf=require(_0x0754('0x8'));var config=require(_0x0754('0x9'));var attributes=require(_0x0754('0xa'));module['exports']=function(_0x38055b,_0x364482){return _0x38055b[_0x0754('0xb')](_0x0754('0xc'),attributes,{'tableName':_0x0754('0xd'),'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 3318590..ae6124f 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Action,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x2ae564,_0x38062f){_0x2ae564=_0x2ae564-0x0;var _0x51d751=_0x7a54[_0x2ae564];return _0x51d751;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Action,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x2ee5cf,_0x33206b){var _0x301ebe=function(_0x260e5d){while(--_0x260e5d){_0x2ee5cf['push'](_0x2ee5cf['shift']());}};_0x301ebe(++_0x33206b);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1cb0b4,_0x1fd48d){_0x1cb0b4=_0x1cb0b4-0x0;var _0x525b60=_0x5fc3[_0x1cb0b4];return _0x525b60;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Action,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Action,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Action,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index d2a317b..445d4b5 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 _0x5201=['./action.controller','/:id','isAuthenticated','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xa34a4b,_0x4cd900){var _0x934b77=function(_0x4a5fd3){while(--_0x4a5fd3){_0xa34a4b['push'](_0xa34a4b['shift']());}};_0x934b77(++_0x4cd900);}(_0x5201,0x8e));var _0x1520=function(_0x5e4459,_0x1d0436){_0x5e4459=_0x5e4459-0x0;var _0x457065=_0x5201[_0x5e4459];return _0x457065;};'use strict';var multer=require('multer');var util=require(_0x1520('0x0'));var path=require('path');var timeout=require(_0x1520('0x1'));var express=require(_0x1520('0x2'));var router=express[_0x1520('0x3')]();var fs_extra=require(_0x1520('0x4'));var auth=require(_0x1520('0x5'));var interaction=require(_0x1520('0x6'));var config=require(_0x1520('0x7'));var controller=require(_0x1520('0x8'));router['put'](_0x1520('0x9'),auth[_0x1520('0xa')](),controller[_0x1520('0xb')]);router[_0x1520('0xc')](_0x1520('0x9'),auth[_0x1520('0xa')](),controller[_0x1520('0xd')]);module[_0x1520('0xe')]=router; \ No newline at end of file +var _0xe1af=['fs-extra','../../components/interaction/service','./action.controller','put','isAuthenticated','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x5de44e,_0x2e7729){var _0x536c82=function(_0x5277e5){while(--_0x5277e5){_0x5de44e['push'](_0x5de44e['shift']());}};_0x536c82(++_0x2e7729);}(_0xe1af,0x120));var _0xfe1a=function(_0x13b088,_0x4d981b){_0x13b088=_0x13b088-0x0;var _0x1e9229=_0xe1af[_0x13b088];return _0x1e9229;};'use strict';var multer=require(_0xfe1a('0x0'));var util=require(_0xfe1a('0x1'));var path=require(_0xfe1a('0x2'));var timeout=require(_0xfe1a('0x3'));var express=require(_0xfe1a('0x4'));var router=express[_0xfe1a('0x5')]();var fs_extra=require(_0xfe1a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xfe1a('0x7'));var config=require('../../config/environment');var controller=require(_0xfe1a('0x8'));router[_0xfe1a('0x9')]('/:id',auth[_0xfe1a('0xa')](),controller['update']);router['delete'](_0xfe1a('0xb'),auth[_0xfe1a('0xa')](),controller[_0xfe1a('0xc')]);module[_0xfe1a('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index bce050b..fac6235 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 _0x31f0=['sequelize','STRING','TEXT'];(function(_0x471d8e,_0x1d9154){var _0x2cd13e=function(_0x3acda1){while(--_0x3acda1){_0x471d8e['push'](_0x471d8e['shift']());}};_0x2cd13e(++_0x1d9154);}(_0x31f0,0xb7));var _0x031f=function(_0x1923bd,_0x35264d){_0x1923bd=_0x1923bd-0x0;var _0x55761d=_0x31f0[_0x1923bd];return _0x55761d;};'use strict';var Sequelize=require(_0x031f('0x0'));module['exports']={'name':{'type':Sequelize[_0x031f('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x031f('0x1')]},'table':{'type':Sequelize[_0x031f('0x1')]},'conditions':{'type':Sequelize[_0x031f('0x2')]},'joins':{'type':Sequelize[_0x031f('0x2')]}}; \ No newline at end of file +var _0xf494=['STRING','TEXT','sequelize','exports'];(function(_0x31ec29,_0x58915c){var _0x3275fc=function(_0x435075){while(--_0x435075){_0x31ec29['push'](_0x31ec29['shift']());}};_0x3275fc(++_0x58915c);}(_0xf494,0x1c6));var _0x4f49=function(_0x30a583,_0x4bd710){_0x30a583=_0x30a583-0x0;var _0x535361=_0xf494[_0x30a583];return _0x535361;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'name':{'type':Sequelize[_0x4f49('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x4f49('0x2')]},'table':{'type':Sequelize[_0x4f49('0x2')]},'conditions':{'type':Sequelize[_0x4f49('0x3')]},'joins':{'type':Sequelize[_0x4f49('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 08628ba..be3d534 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 _0xe852=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','undefined','limit','count','set','apply','reject','update','then','CustomReports','UserProfileResource','destroy','end','stack','name','send','map','AnalyticCustomReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','length','include','find','create','user','get','Reports','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','table','MetricId','function','replace','format','groupBy','orderBy','DESC','field','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','Limited\x20Query:','toString','sequelize','left_join','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','value','AnalyticMetric','from','metric','alias','output','web','fullPath','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','SELECT','run','runReport','AVG(%s)','debug','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x2d6d88,_0x2ea070){var _0x1991b0=function(_0x13b3fe){while(--_0x13b3fe){_0x2d6d88['push'](_0x2d6d88['shift']());}};_0x1991b0(++_0x2ea070);}(_0xe852,0x99));var _0x2e85=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xe852[_0x5f1391];return _0x50ebe3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2e85('0x0'));var zipdir=require(_0x2e85('0x1'));var jsonpatch=require(_0x2e85('0x2'));var rp=require('request-promise');var moment=require(_0x2e85('0x3'));var BPromise=require(_0x2e85('0x4'));var Mustache=require(_0x2e85('0x5'));var util=require(_0x2e85('0x6'));var path=require(_0x2e85('0x7'));var sox=require(_0x2e85('0x8'));var csv=require(_0x2e85('0x9'));var ejs=require(_0x2e85('0xa'));var fs=require('fs');var fs_extra=require(_0x2e85('0xb'));var _=require(_0x2e85('0xc'));var squel=require(_0x2e85('0xd'));var crypto=require(_0x2e85('0xe'));var jsforce=require(_0x2e85('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2e85('0x10'));var Redis=require('ioredis');var authService=require(_0x2e85('0x11'));var qs=require(_0x2e85('0x12'));var as=require(_0x2e85('0x13'));var hardwareService=require(_0x2e85('0x14'));var logger=require(_0x2e85('0x15'))(_0x2e85('0x16'));var utils=require('../../config/utils');var config=require(_0x2e85('0x17'));var licenseUtil=require(_0x2e85('0x18'));var db=require('../../mysqldb')['db'];var dbH=require(_0x2e85('0x19'))[_0x2e85('0x1a')];function respondWithStatusCode(_0xc402f8,_0x140a2c){_0x140a2c=_0x140a2c||0xcc;return function(_0x22e021){if(_0x22e021){return _0xc402f8[_0x2e85('0x1b')](_0x140a2c);}return _0xc402f8[_0x2e85('0x1c')](_0x140a2c)['end']();};}function respondWithResult(_0x5211fd,_0x66b8a3){_0x66b8a3=_0x66b8a3||0xc8;return function(_0x26ef08){if(_0x26ef08){return _0x5211fd['status'](_0x66b8a3)['json'](_0x26ef08);}};}function respondWithFilteredResult(_0x5c2b7c,_0x33afe){return function(_0x1141e3){if(_0x1141e3){var _0x451ac3=typeof _0x33afe[_0x2e85('0x1d')]===_0x2e85('0x1e')&&typeof _0x33afe[_0x2e85('0x1f')]===_0x2e85('0x1e');var _0x4654ff=_0x1141e3[_0x2e85('0x20')];var _0x3282a4=_0x451ac3?0x0:_0x33afe[_0x2e85('0x1d')];var _0x56d36e=_0x451ac3?_0x1141e3[_0x2e85('0x20')]:_0x33afe[_0x2e85('0x1d')]+_0x33afe[_0x2e85('0x1f')];var _0xdd3208;if(_0x56d36e>=_0x4654ff){_0x56d36e=_0x4654ff;_0xdd3208=0xc8;}else{_0xdd3208=0xce;}_0x5c2b7c[_0x2e85('0x1c')](_0xdd3208);return _0x5c2b7c[_0x2e85('0x21')]('Content-Range',_0x3282a4+'-'+_0x56d36e+'/'+_0x4654ff)['json'](_0x1141e3);}return null;};}function patchUpdates(_0x1032a8){return function(_0x172933){try{jsonpatch[_0x2e85('0x22')](_0x172933,_0x1032a8,!![]);}catch(_0x4e0f6f){return BPromise[_0x2e85('0x23')](_0x4e0f6f);}return _0x172933['save']();};}function saveUpdates(_0x153db8,_0x31ecde){return function(_0x5c7c81){if(_0x5c7c81){return _0x5c7c81[_0x2e85('0x24')](_0x153db8)[_0x2e85('0x25')](function(_0x5ea39e){return _0x5ea39e;});}return null;};}function removeEntity(_0x1daa02,_0x60feac){return function(_0xf74959){if(_0xf74959){return _0xf74959['destroy']()['then'](function(){var _0x54edee=_0xf74959['get']({'plain':!![]});var _0x5325e5=_0x2e85('0x26');return db[_0x2e85('0x27')][_0x2e85('0x28')]({'where':{'type':_0x5325e5,'resourceId':_0x54edee['id']}})[_0x2e85('0x25')](function(){return _0xf74959;});})[_0x2e85('0x25')](function(){_0x1daa02[_0x2e85('0x1c')](0xcc)[_0x2e85('0x29')]();});}};}function handleEntityNotFound(_0x537567,_0x407ae9){return function(_0x160be7){if(!_0x160be7){_0x537567[_0x2e85('0x1b')](0x194);}return _0x160be7;};}function handleError(_0x4f4120,_0x5ba550){_0x5ba550=_0x5ba550||0x1f4;return function(_0x38c101){logger['error'](_0x38c101[_0x2e85('0x2a')]);if(_0x38c101[_0x2e85('0x2b')]){delete _0x38c101[_0x2e85('0x2b')];}_0x4f4120[_0x2e85('0x1c')](_0x5ba550)[_0x2e85('0x2c')](_0x38c101);};}exports['index']=function(_0x398473,_0x5b6cbf){var _0xd3d2c3={},_0x2d4029={},_0xd419a2={'count':0x0,'rows':[]};var _0x44c525=_[_0x2e85('0x2d')](db[_0x2e85('0x2e')][_0x2e85('0x2f')],function(_0x45fb0b){return{'name':_0x45fb0b[_0x2e85('0x30')],'type':_0x45fb0b['type'][_0x2e85('0x31')]};});_0x2d4029[_0x2e85('0x32')]=_[_0x2e85('0x2d')](_0x44c525,_0x2e85('0x2b'));_0x2d4029[_0x2e85('0x33')]=_['keys'](_0x398473[_0x2e85('0x33')]);_0x2d4029[_0x2e85('0x34')]=_[_0x2e85('0x35')](_0x2d4029[_0x2e85('0x32')],_0x2d4029['query']);_0xd3d2c3[_0x2e85('0x36')]=_[_0x2e85('0x35')](_0x2d4029[_0x2e85('0x32')],qs[_0x2e85('0x37')](_0x398473[_0x2e85('0x33')]['fields']));_0xd3d2c3['attributes']=_0xd3d2c3['attributes']['length']?_0xd3d2c3['attributes']:_0x2d4029[_0x2e85('0x32')];if(!_0x398473['query'][_0x2e85('0x38')]('nolimit')){_0xd3d2c3[_0x2e85('0x1f')]=qs[_0x2e85('0x1f')](_0x398473[_0x2e85('0x33')][_0x2e85('0x1f')]);_0xd3d2c3[_0x2e85('0x1d')]=qs['offset'](_0x398473[_0x2e85('0x33')][_0x2e85('0x1d')]);}_0xd3d2c3[_0x2e85('0x39')]=qs[_0x2e85('0x3a')](_0x398473['query'][_0x2e85('0x3a')]);_0xd3d2c3[_0x2e85('0x3b')]=qs[_0x2e85('0x34')](_[_0x2e85('0x3c')](_0x398473[_0x2e85('0x33')],_0x2d4029['filters']),_0x44c525);if(_0x398473[_0x2e85('0x33')][_0x2e85('0x3d')]){_0xd3d2c3[_0x2e85('0x3b')]=_[_0x2e85('0x3e')](_0xd3d2c3[_0x2e85('0x3b')],{'$or':_[_0x2e85('0x2d')](_0x44c525,function(_0x133eeb){if(_0x133eeb[_0x2e85('0x3f')]!==_0x2e85('0x40')){var _0xe033d={};_0xe033d[_0x133eeb[_0x2e85('0x2b')]]={'$like':'%'+_0x398473[_0x2e85('0x33')][_0x2e85('0x3d')]+'%'};return _0xe033d;}})});}_0xd3d2c3=_[_0x2e85('0x3e')]({},_0xd3d2c3,_0x398473[_0x2e85('0x41')]);var _0x409882={'where':_0xd3d2c3[_0x2e85('0x3b')]};return db[_0x2e85('0x2e')][_0x2e85('0x20')](_0x409882)['then'](function(_0x3cc3b0){_0xd419a2['count']=_0x3cc3b0;if(_0x398473[_0x2e85('0x33')][_0x2e85('0x42')]){_0xd3d2c3['include']=[{'all':!![]}];}return db[_0x2e85('0x2e')][_0x2e85('0x43')](_0xd3d2c3);})[_0x2e85('0x25')](function(_0x507fef){_0xd419a2[_0x2e85('0x44')]=_0x507fef;return _0xd419a2;})[_0x2e85('0x25')](respondWithFilteredResult(_0x5b6cbf,_0xd3d2c3))[_0x2e85('0x45')](handleError(_0x5b6cbf,null));};exports['show']=function(_0x1418b4,_0x59dd78){var _0x4a667={'raw':![],'where':{'id':_0x1418b4[_0x2e85('0x46')]['id']}},_0x360992={};_0x360992[_0x2e85('0x32')]=_[_0x2e85('0x47')](db['AnalyticCustomReport']['rawAttributes']);_0x360992[_0x2e85('0x33')]=_[_0x2e85('0x47')](_0x1418b4[_0x2e85('0x33')]);_0x360992[_0x2e85('0x34')]=_['intersection'](_0x360992[_0x2e85('0x32')],_0x360992[_0x2e85('0x33')]);_0x4a667[_0x2e85('0x36')]=_[_0x2e85('0x35')](_0x360992[_0x2e85('0x32')],qs[_0x2e85('0x37')](_0x1418b4[_0x2e85('0x33')]['fields']));_0x4a667[_0x2e85('0x36')]=_0x4a667['attributes'][_0x2e85('0x48')]?_0x4a667[_0x2e85('0x36')]:_0x360992[_0x2e85('0x32')];if(_0x1418b4['query'][_0x2e85('0x42')]){_0x4a667[_0x2e85('0x49')]=[{'all':!![]}];}_0x4a667=_['merge']({},_0x4a667,_0x1418b4['options']);return db[_0x2e85('0x2e')][_0x2e85('0x4a')](_0x4a667)[_0x2e85('0x25')](handleEntityNotFound(_0x59dd78,null))[_0x2e85('0x25')](respondWithResult(_0x59dd78,null))['catch'](handleError(_0x59dd78,null));};exports[_0x2e85('0x4b')]=function(_0x43238c,_0x3cdc52){return db[_0x2e85('0x2e')]['create'](_0x43238c['body'],{})[_0x2e85('0x25')](function(_0x10973e){var _0x53406b=_0x43238c['user']['get']({'plain':!![]});if(!_0x53406b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x53406b['role']===_0x2e85('0x4c')){var _0x317fe4=_0x10973e[_0x2e85('0x4d')]({'plain':!![]});var _0x4f5436=_0x2e85('0x4e');return db[_0x2e85('0x4f')]['find']({'where':{'name':_0x4f5436,'userProfileId':_0x53406b[_0x2e85('0x50')]},'raw':!![]})['then'](function(_0x3bfd2d){if(_0x3bfd2d&&_0x3bfd2d[_0x2e85('0x51')]===0x0){return db[_0x2e85('0x27')][_0x2e85('0x4b')]({'name':_0x317fe4[_0x2e85('0x2b')],'resourceId':_0x317fe4['id'],'type':_0x2e85('0x26'),'sectionId':_0x3bfd2d['id']},{})[_0x2e85('0x25')](function(){return _0x10973e;});}else{return _0x10973e;}})[_0x2e85('0x45')](function(_0x428ffc){logger[_0x2e85('0x52')](_0x2e85('0x53'),_0x428ffc);throw _0x428ffc;});}return _0x10973e;})[_0x2e85('0x25')](respondWithResult(_0x3cdc52,0xc9))[_0x2e85('0x45')](handleError(_0x3cdc52,null));};exports[_0x2e85('0x24')]=function(_0x23699a,_0x273e32){if(_0x23699a['body']['id']){delete _0x23699a[_0x2e85('0x54')]['id'];}return db['AnalyticCustomReport'][_0x2e85('0x4a')]({'where':{'id':_0x23699a[_0x2e85('0x46')]['id']}})[_0x2e85('0x25')](handleEntityNotFound(_0x273e32,null))[_0x2e85('0x25')](saveUpdates(_0x23699a[_0x2e85('0x54')],null))[_0x2e85('0x25')](respondWithResult(_0x273e32,null))[_0x2e85('0x45')](handleError(_0x273e32,null));};exports[_0x2e85('0x28')]=function(_0x22db59,_0x267a20){return db[_0x2e85('0x2e')][_0x2e85('0x4a')]({'where':{'id':_0x22db59[_0x2e85('0x46')]['id']}})[_0x2e85('0x25')](handleEntityNotFound(_0x267a20,null))[_0x2e85('0x25')](removeEntity(_0x267a20,null))[_0x2e85('0x45')](handleError(_0x267a20,null));};exports[_0x2e85('0x55')]=function(_0x46fef8,_0x3d46f0){var _0xda621e=0xa;var _0x45005e=[_0x2e85('0x56'),'left_join',_0x2e85('0x57'),_0x2e85('0x58')];var _0x16b11e={'SUM':_0x2e85('0x59'),'COUNT':_0x2e85('0x5a'),'COUNT DISTINCT':_0x2e85('0x5b'),'MAX':'MAX(%s)','MIN':_0x2e85('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x2e85('0x5d')};var _0x5ed1da={'SEC_TO_TIME':_0x2e85('0x5e'),'DATE':'DATE(%s)','HOUR':_0x2e85('0x5f'),'ROUND':_0x2e85('0x60'),'UNIX_TIMESTAMP':_0x2e85('0x61')};var _0x35a230=function(_0x2ba032){return!_[_0x2e85('0x62')]([_0x2e85('0x63'),_0x2e85('0x64'),_0x2e85('0x65'),_0x2e85('0x66')],_0x2ba032);};var _0x42dfbe=function(_0x2a1360){if(!_0x2a1360||!_0x2a1360['rules'][_0x2e85('0x48')]){return'';}for(var _0x1083d7='(',_0x1e71ac=0x0;_0x1e71ac<_0x2a1360[_0x2e85('0x67')][_0x2e85('0x48')];_0x1e71ac+=0x1){_0x1e71ac>0x0&&(_0x1083d7+='\x20'+_0x2a1360[_0x2e85('0x68')]+'\x20');_0x1083d7+=_0x2a1360[_0x2e85('0x67')][_0x1e71ac][_0x2e85('0x69')]?_0x42dfbe(_0x2a1360[_0x2e85('0x67')][_0x1e71ac][_0x2e85('0x69')]):_0x2a1360[_0x2e85('0x67')][_0x1e71ac]['field']+'\x20'+_0x2a1360['rules'][_0x1e71ac][_0x2e85('0x6a')]+(_0x35a230(_0x2a1360[_0x2e85('0x67')][_0x1e71ac][_0x2e85('0x6a')])?'\x20'+_0x2a1360[_0x2e85('0x67')][_0x1e71ac]['value']:'');}return _0x1083d7+')';};var _0x75f2a2={'where':{'id':_0x46fef8[_0x2e85('0x46')]['id']}},_0x37aef3,_0x4465f9,_0x59c943,_0x4f67f5,_0x1ec27d;_0x75f2a2=_['merge']({},_0x75f2a2,_0x46fef8[_0x2e85('0x41')]);return db[_0x2e85('0x2e')]['find'](_0x75f2a2)['then'](function(_0x3124fa){if(_0x3124fa){_0x37aef3=_0x3124fa;return _0x3124fa[_0x2e85('0x6b')]();}return null;})[_0x2e85('0x25')](function(_0xf356b){if(_0xf356b){if(!_0xf356b['length']){throw new db[(_0x2e85('0x6c'))][(_0x2e85('0x6d'))](_0x2e85('0x6e'),0x193);}_0x4465f9=_0xf356b;return db['AnalyticMetric'][_0x2e85('0x43')]({'raw':!![]});}return null;})['then'](function(_0x224bff){if(_0x224bff){_0x59c943=_[_0x2e85('0x6f')](_0x224bff,'id');var _0x401376;var _0x1e5963=squel[_0x2e85('0x70')]();_0x1e5963['from'](_0x37aef3[_0x2e85('0x71')]);for(var _0x356d4b=0x0;_0x356d4b<_0x4465f9[_0x2e85('0x48')];_0x356d4b+=0x1){_0x401376=_0x4465f9[_0x356d4b][_0x2e85('0x72')]?_0x59c943[_0x4465f9[_0x356d4b][_0x2e85('0x72')]]['metric']:_0x4465f9[_0x356d4b]['field'];_0x401376=_0x4465f9[_0x356d4b]['function']?_['replace'](_0x16b11e[_0x4465f9[_0x356d4b][_0x2e85('0x73')]],'%s',_0x401376):_0x401376;_0x401376=_0x4465f9[_0x356d4b]['format']?_[_0x2e85('0x74')](_0x5ed1da[_0x4465f9[_0x356d4b][_0x2e85('0x75')]],'%s',_0x401376):_0x401376;if(_0x4465f9[_0x356d4b][_0x2e85('0x76')]){_0x1e5963[_0x2e85('0x69')](_0x401376);}_0x4465f9[_0x356d4b][_0x2e85('0x77')]&&_0x1e5963['order'](_0x401376,_0x4465f9[_0x356d4b][_0x2e85('0x77')]===_0x2e85('0x78')?![]:!![]);_0x1e5963[_0x2e85('0x79')](_0x401376,_0x4465f9[_0x356d4b]['alias']||_0x401376);}if(_0x37aef3['joins']){_0x37aef3[_0x2e85('0x7a')]=JSON[_0x2e85('0x7b')](_0x37aef3[_0x2e85('0x7a')]);for(var _0x1c5e6d=0x0;_0x1c5e6d<_0x37aef3['joins']['length'];_0x1c5e6d+=0x1){if(_0x37aef3[_0x2e85('0x7a')][_0x1c5e6d]['type']&&_[_0x2e85('0x62')](_0x45005e,_0x37aef3['joins'][_0x1c5e6d][_0x2e85('0x3f')])&&_0x37aef3[_0x2e85('0x7a')][_0x1c5e6d][_0x2e85('0x7c')]&&_0x37aef3[_0x2e85('0x7a')][_0x1c5e6d]['foreignTable']&&_0x37aef3[_0x2e85('0x7a')][_0x1c5e6d][_0x2e85('0x7d')]){_0x1e5963[_0x37aef3[_0x2e85('0x7a')][_0x1c5e6d][_0x2e85('0x3f')]](_0x37aef3[_0x2e85('0x7a')][_0x1c5e6d][_0x2e85('0x7e')],null,util[_0x2e85('0x75')](_0x2e85('0x7f'),_0x37aef3[_0x2e85('0x71')],_0x37aef3[_0x2e85('0x7a')][_0x1c5e6d]['parentKey'],_0x37aef3[_0x2e85('0x7a')][_0x1c5e6d][_0x2e85('0x7e')],_0x37aef3[_0x2e85('0x7a')][_0x1c5e6d][_0x2e85('0x7d')]));}}}if(_0x37aef3['conditions']){_0x37aef3[_0x2e85('0x80')]=JSON[_0x2e85('0x7b')](_0x37aef3[_0x2e85('0x80')]);_0x1e5963[_0x2e85('0x3b')](_0x42dfbe(_0x37aef3[_0x2e85('0x80')]['group']));}_0x1ec27d=_0x1e5963[_0x2e85('0x81')]();_0x1e5963[_0x2e85('0x1f')](_0xda621e);_0x1e5963[_0x2e85('0x1d')](0x0);logger['debug'](_0x2e85('0x82'),_0x1e5963[_0x2e85('0x83')]());return dbH[_0x2e85('0x84')]['query'](_0x1e5963[_0x2e85('0x83')](),{'type':dbH[_0x2e85('0x84')]['QueryTypes']['SELECT']});}})['then'](respondWithResult(_0x3d46f0,null))['catch'](handleError(_0x3d46f0,null));};function runReport(_0x1f5ff4,_0x147dfc,_0x5384b9){var _0x591280=_0x147dfc['name'];var _0xdc834c=0xa;var _0x543a9c=['join',_0x2e85('0x85'),_0x2e85('0x57'),_0x2e85('0x58')];var _0x4b9bb6={'SUM':_0x2e85('0x59'),'COUNT':_0x2e85('0x5a'),'COUNT DISTINCT':_0x2e85('0x5b'),'MAX':_0x2e85('0x86'),'MIN':_0x2e85('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x2e85('0x87'),'GROUP_CONCAT ASC':_0x2e85('0x88'),'GROUP_CONCAT DESC':_0x2e85('0x5d')};var _0xd964db={'SEC_TO_TIME':_0x2e85('0x5e'),'DATE':_0x2e85('0x89'),'HOUR':_0x2e85('0x5f'),'ROUND':_0x2e85('0x60'),'UNIX_TIMESTAMP':_0x2e85('0x61')};var _0x5d2370=function(_0x1601ce){return!_[_0x2e85('0x62')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x2e85('0x65'),'IS\x20NOT\x20EMPTY'],_0x1601ce);};var _0x58ca80=function(_0x29a0a9){if(!_0x29a0a9||!_0x29a0a9[_0x2e85('0x67')][_0x2e85('0x48')]){return'';}for(var _0x5e0d25='(',_0x47d143=0x0;_0x47d143<_0x29a0a9[_0x2e85('0x67')]['length'];_0x47d143+=0x1){_0x47d143>0x0&&(_0x5e0d25+='\x20'+_0x29a0a9[_0x2e85('0x68')]+'\x20');_0x5e0d25+=_0x29a0a9[_0x2e85('0x67')][_0x47d143][_0x2e85('0x69')]?_0x58ca80(_0x29a0a9[_0x2e85('0x67')][_0x47d143][_0x2e85('0x69')]):_0x29a0a9[_0x2e85('0x67')][_0x47d143][_0x2e85('0x79')]+'\x20'+_0x29a0a9['rules'][_0x47d143]['condition']+(_0x5d2370(_0x29a0a9[_0x2e85('0x67')][_0x47d143][_0x2e85('0x6a')])?'\x20'+_0x29a0a9['rules'][_0x47d143][_0x2e85('0x8a')]:'');}return _0x5e0d25+')';};var _0xb70091={'where':{'id':_0x1f5ff4['id']}},_0x251810,_0x26cea0,_0xb5678f,_0x29c05c,_0x517922;_0xb70091=_['merge']({},_0xb70091,_0x5384b9);return db[_0x2e85('0x2e')]['find'](_0xb70091)[_0x2e85('0x25')](function(_0x57c25b){if(_0x57c25b){_0x251810=_0x57c25b;return _0x57c25b[_0x2e85('0x6b')]();}return null;})[_0x2e85('0x25')](function(_0x161a59){if(_0x161a59){if(!_0x161a59[_0x2e85('0x48')]){throw new db[(_0x2e85('0x6c'))][(_0x2e85('0x6d'))](_0x2e85('0x6e'),0x193);}_0x26cea0=_0x161a59;return db[_0x2e85('0x8b')][_0x2e85('0x43')]({'raw':!![]});}return null;})['then'](function(_0x2a1272){if(_0x2a1272){_0xb5678f=_[_0x2e85('0x6f')](_0x2a1272,'id');var _0x59c775;var _0x259235=squel[_0x2e85('0x70')]();_0x259235[_0x2e85('0x8c')](_0x251810[_0x2e85('0x71')]);for(var _0x5a3abc=0x0;_0x5a3abc<_0x26cea0[_0x2e85('0x48')];_0x5a3abc+=0x1){_0x59c775=_0x26cea0[_0x5a3abc][_0x2e85('0x72')]?_0xb5678f[_0x26cea0[_0x5a3abc][_0x2e85('0x72')]][_0x2e85('0x8d')]:_0x26cea0[_0x5a3abc][_0x2e85('0x79')];_0x59c775=_0x26cea0[_0x5a3abc][_0x2e85('0x73')]?_[_0x2e85('0x74')](_0x4b9bb6[_0x26cea0[_0x5a3abc][_0x2e85('0x73')]],'%s',_0x59c775):_0x59c775;_0x59c775=_0x26cea0[_0x5a3abc][_0x2e85('0x75')]?_[_0x2e85('0x74')](_0xd964db[_0x26cea0[_0x5a3abc]['format']],'%s',_0x59c775):_0x59c775;if(_0x26cea0[_0x5a3abc][_0x2e85('0x76')]){_0x259235[_0x2e85('0x69')](_0x59c775);}_0x26cea0[_0x5a3abc][_0x2e85('0x77')]&&_0x259235[_0x2e85('0x39')](_0x59c775,_0x26cea0[_0x5a3abc][_0x2e85('0x77')]===_0x2e85('0x78')?![]:!![]);_0x259235[_0x2e85('0x79')](_0x59c775,_0x26cea0[_0x5a3abc][_0x2e85('0x8e')]||_0x59c775);}if(_0x251810['joins']){_0x251810[_0x2e85('0x7a')]=JSON[_0x2e85('0x7b')](_0x251810[_0x2e85('0x7a')]);for(var _0x147480=0x0;_0x147480<_0x251810[_0x2e85('0x7a')]['length'];_0x147480+=0x1){if(_0x251810[_0x2e85('0x7a')][_0x147480][_0x2e85('0x3f')]&&_['includes'](_0x543a9c,_0x251810[_0x2e85('0x7a')][_0x147480]['type'])&&_0x251810[_0x2e85('0x7a')][_0x147480][_0x2e85('0x7c')]&&_0x251810[_0x2e85('0x7a')][_0x147480][_0x2e85('0x7e')]&&_0x251810[_0x2e85('0x7a')][_0x147480]['foreignKey']){_0x259235[_0x251810[_0x2e85('0x7a')][_0x147480][_0x2e85('0x3f')]](_0x251810[_0x2e85('0x7a')][_0x147480][_0x2e85('0x7e')],null,util[_0x2e85('0x75')](_0x2e85('0x7f'),_0x251810['table'],_0x251810[_0x2e85('0x7a')][_0x147480]['parentKey'],_0x251810['joins'][_0x147480][_0x2e85('0x7e')],_0x251810['joins'][_0x147480][_0x2e85('0x7d')]));}}}if(_0x251810[_0x2e85('0x80')]){_0x251810[_0x2e85('0x80')]=JSON[_0x2e85('0x7b')](_0x251810['conditions']);_0x259235[_0x2e85('0x3b')](_0x58ca80(_0x251810[_0x2e85('0x80')][_0x2e85('0x69')]));}_0x517922=_0x259235['clone']();_0x259235[_0x2e85('0x1f')](_0xdc834c);_0x259235[_0x2e85('0x1d')](0x0);return;}})[_0x2e85('0x25')](function(){if(_0x147dfc[_0x2e85('0x8f')]===_0x2e85('0x90')){return null;}var _0x3e75cc=_[_0x2e85('0x3e')](_0x147dfc,{'name':_0x147dfc[_0x2e85('0x91')]||_0x147dfc[_0x2e85('0x2b')]||_0x251810[_0x2e85('0x2b')],'basename':_0x591280,'savename':util[_0x2e85('0x75')]('%s-%s.%s',_0x147dfc[_0x2e85('0x2b')]||_0x251810[_0x2e85('0x2b')],require(_0x2e85('0x92'))[_0x2e85('0x93')](0x4),_0x147dfc[_0x2e85('0x8f')]||_0x2e85('0x94')),'reportId':_0x251810['id'],'reportType':_0x2e85('0x95')});return db[_0x2e85('0x96')]['create'](_0x3e75cc,{'raw':!![]});})[_0x2e85('0x25')](function(_0x164e6d){if(_0x251810['table']===_0x2e85('0x97')){_0x517922[_0x2e85('0x3b')](_0x251810[_0x2e85('0x71')]+_0x2e85('0x98'),_0x147dfc['startDate'],_0x147dfc[_0x2e85('0x99')]);}else{_0x517922[_0x2e85('0x3b')](_0x251810[_0x2e85('0x71')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x147dfc['startDate'],_0x147dfc['endDate']);}if(_0x164e6d){logger[_0x2e85('0x9a')](_0x2e85('0x9b'),_0x517922[_0x2e85('0x83')]());require(_0x2e85('0x9c'))[_0x2e85('0x9d')](path[_0x2e85('0x56')](__dirname,_0x2e85('0x9e'),_0x164e6d[_0x2e85('0x8f')]),[_0x164e6d['id'],_0x517922['toString'](),path[_0x2e85('0x56')](__dirname,_0x2e85('0x9f'),_0x164e6d[_0x2e85('0xa0')]),_0x591280]);return _0x164e6d;}else{var _0x527084=squel['select']();_0x527084[_0x2e85('0x8c')]('('+_0x517922['toString']()+')',_0x2e85('0xa1'));_0x527084[_0x2e85('0x79')](_0x2e85('0xa2'),_0x2e85('0x20'));_0x517922[_0x2e85('0x1f')](_0x147dfc[_0x2e85('0x1f')]||_0xdc834c);_0x517922[_0x2e85('0x1d')](_0x147dfc['offset']||0x0);return dbH[_0x2e85('0x84')][_0x2e85('0x33')](_0x527084[_0x2e85('0x83')](),{'type':dbH[_0x2e85('0x84')][_0x2e85('0xa3')][_0x2e85('0xa4')]})[_0x2e85('0x25')](function(_0x4e2840){if(!_0x4e2840[_0x2e85('0x48')]){_0x29c05c=0x0;}else{_0x29c05c=_0x4e2840[0x0]['count']||0x0;}return dbH[_0x2e85('0x84')]['query'](_0x517922[_0x2e85('0x83')](),{'type':dbH[_0x2e85('0x84')][_0x2e85('0xa3')]['SELECT']});})[_0x2e85('0x25')](function(_0x3d1b8a){return{'rows':_0x3d1b8a||[],'count':_0x29c05c};});}});}exports[_0x2e85('0xa5')]=function(_0x156f8b,_0x1adcba){return runReport(_0x156f8b[_0x2e85('0x46')],_0x156f8b[_0x2e85('0x33')],_0x156f8b[_0x2e85('0x41')])[_0x2e85('0x25')](respondWithResult(_0x1adcba,null))['catch'](handleError(_0x1adcba,null));};exports[_0x2e85('0xa6')]=runReport;exports[_0x2e85('0x33')]=function(_0x4d1ed5,_0x4273cd){var _0x3809aa=0xa;var _0x32bf92=[_0x2e85('0x56'),_0x2e85('0x85'),'right_join','cross_join'];var _0x287c71={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x2e85('0x5b'),'MAX':_0x2e85('0x86'),'MIN':'MIN(%s)','AVG':_0x2e85('0xa7'),'GROUP_CONCAT':_0x2e85('0x87'),'GROUP_CONCAT ASC':_0x2e85('0x88'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4db0fd={'SEC_TO_TIME':_0x2e85('0x5e'),'DATE':_0x2e85('0x89'),'HOUR':_0x2e85('0x5f'),'ROUND':_0x2e85('0x60'),'UNIX_TIMESTAMP':_0x2e85('0x61')};var _0x3cab36=function(_0xbd4238){return!_['includes']([_0x2e85('0x63'),'IS\x20NOT\x20NULL',_0x2e85('0x65'),'IS\x20NOT\x20EMPTY'],_0xbd4238);};var _0x14297f=function(_0x21e6a4){if(!_0x21e6a4||!_0x21e6a4['rules'][_0x2e85('0x48')]){return'';}for(var _0x2baee6='(',_0xe02dbf=0x0;_0xe02dbf<_0x21e6a4[_0x2e85('0x67')][_0x2e85('0x48')];_0xe02dbf+=0x1){_0xe02dbf>0x0&&(_0x2baee6+='\x20'+_0x21e6a4[_0x2e85('0x68')]+'\x20');_0x2baee6+=_0x21e6a4['rules'][_0xe02dbf]['group']?_0x14297f(_0x21e6a4['rules'][_0xe02dbf][_0x2e85('0x69')]):_0x21e6a4[_0x2e85('0x67')][_0xe02dbf][_0x2e85('0x79')]+'\x20'+_0x21e6a4['rules'][_0xe02dbf][_0x2e85('0x6a')]+(_0x3cab36(_0x21e6a4[_0x2e85('0x67')][_0xe02dbf][_0x2e85('0x6a')])?'\x20'+_0x21e6a4[_0x2e85('0x67')][_0xe02dbf][_0x2e85('0x8a')]:'');}return _0x2baee6+')';};var _0x1a115a={'where':{'id':_0x4d1ed5[_0x2e85('0x46')]['id']}},_0x2b8076,_0x512ed2,_0x4544d4,_0x49e65f,_0x172797;_0x1a115a=_[_0x2e85('0x3e')]({},_0x1a115a,_0x4d1ed5['options']);return db[_0x2e85('0x2e')][_0x2e85('0x4a')](_0x1a115a)['then'](function(_0x884077){if(_0x884077){_0x2b8076=_0x884077;return _0x884077['getFields']();}return null;})[_0x2e85('0x25')](function(_0x35b2ae){if(_0x35b2ae){if(!_0x35b2ae[_0x2e85('0x48')]){throw new db[(_0x2e85('0x6c'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x512ed2=_0x35b2ae;return db['AnalyticMetric'][_0x2e85('0x43')]({'raw':!![]});}return null;})[_0x2e85('0x25')](function(_0x5a9df1){if(_0x5a9df1){_0x4544d4=_[_0x2e85('0x6f')](_0x5a9df1,'id');var _0x2fa736;var _0x50d594=squel[_0x2e85('0x70')]();_0x50d594[_0x2e85('0x8c')](_0x2b8076['table']);for(var _0x4916a7=0x0;_0x4916a7<_0x512ed2[_0x2e85('0x48')];_0x4916a7+=0x1){_0x2fa736=_0x512ed2[_0x4916a7]['MetricId']?_0x4544d4[_0x512ed2[_0x4916a7]['MetricId']][_0x2e85('0x8d')]:_0x512ed2[_0x4916a7]['field'];_0x2fa736=_0x512ed2[_0x4916a7][_0x2e85('0x73')]?_[_0x2e85('0x74')](_0x287c71[_0x512ed2[_0x4916a7][_0x2e85('0x73')]],'%s',_0x2fa736):_0x2fa736;_0x2fa736=_0x512ed2[_0x4916a7][_0x2e85('0x75')]?_[_0x2e85('0x74')](_0x4db0fd[_0x512ed2[_0x4916a7][_0x2e85('0x75')]],'%s',_0x2fa736):_0x2fa736;if(_0x512ed2[_0x4916a7][_0x2e85('0x76')]){_0x50d594[_0x2e85('0x69')](_0x2fa736);}_0x512ed2[_0x4916a7][_0x2e85('0x77')]&&_0x50d594['order'](_0x2fa736,_0x512ed2[_0x4916a7][_0x2e85('0x77')]===_0x2e85('0x78')?![]:!![]);_0x50d594[_0x2e85('0x79')](_0x2fa736,_0x512ed2[_0x4916a7][_0x2e85('0x8e')]||_0x2fa736);}if(_0x2b8076['joins']){_0x2b8076['joins']=JSON['parse'](_0x2b8076[_0x2e85('0x7a')]);for(var _0x46d331=0x0;_0x46d331<_0x2b8076[_0x2e85('0x7a')]['length'];_0x46d331+=0x1){if(_0x2b8076['joins'][_0x46d331][_0x2e85('0x3f')]&&_[_0x2e85('0x62')](_0x32bf92,_0x2b8076['joins'][_0x46d331][_0x2e85('0x3f')])&&_0x2b8076['joins'][_0x46d331][_0x2e85('0x7c')]&&_0x2b8076[_0x2e85('0x7a')][_0x46d331][_0x2e85('0x7e')]&&_0x2b8076['joins'][_0x46d331]['foreignKey']){_0x50d594[_0x2b8076[_0x2e85('0x7a')][_0x46d331]['type']](_0x2b8076['joins'][_0x46d331][_0x2e85('0x7e')],null,util[_0x2e85('0x75')]('%s.%s\x20=\x20%s.%s',_0x2b8076[_0x2e85('0x71')],_0x2b8076[_0x2e85('0x7a')][_0x46d331][_0x2e85('0x7c')],_0x2b8076[_0x2e85('0x7a')][_0x46d331][_0x2e85('0x7e')],_0x2b8076[_0x2e85('0x7a')][_0x46d331][_0x2e85('0x7d')]));}}}if(_0x2b8076[_0x2e85('0x80')]){_0x2b8076[_0x2e85('0x80')]=JSON[_0x2e85('0x7b')](_0x2b8076['conditions']);_0x50d594[_0x2e85('0x3b')](_0x14297f(_0x2b8076[_0x2e85('0x80')][_0x2e85('0x69')]));}_0x172797=_0x50d594[_0x2e85('0x81')]();_0x50d594[_0x2e85('0x1f')](_0x3809aa);_0x50d594[_0x2e85('0x1d')](0x0);logger[_0x2e85('0xa8')](_0x2e85('0x82'),_0x50d594[_0x2e85('0x83')]());return dbH[_0x2e85('0x84')][_0x2e85('0x33')](_0x50d594[_0x2e85('0x83')](),{'type':dbH[_0x2e85('0x84')]['QueryTypes']['SELECT']});}})[_0x2e85('0x25')](function(){return{'sql':_0x172797[_0x2e85('0x83')]()};})['then'](respondWithResult(_0x4273cd,null))[_0x2e85('0x45')](handleError(_0x4273cd,null));}; \ No newline at end of file +var _0xb03e=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','status','stack','index','map','AnalyticCustomReport','rawAttributes','type','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','from','MetricId','metric','field','replace','format','orderBy','order','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','cross_join','AVG(%s)','HOUR(%s)','IS\x20NOT\x20EMPTY','getFields','table','function','clone','output','fullPath','%s-%s.%s','randomstring','generate','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','fork','../../components/export/','countTable','COUNT(*)','run','runReport','COUNT(DISTINCT\x20%s)','select','groupBy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis'];(function(_0x5afa73,_0x5413f3){var _0x398a08=function(_0x241d7d){while(--_0x241d7d){_0x5afa73['push'](_0x5afa73['shift']());}};_0x398a08(++_0x5413f3);}(_0xb03e,0x1eb));var _0xeb03=function(_0x54c347,_0x3cdd3c){_0x54c347=_0x54c347-0x0;var _0x1711e7=_0xb03e[_0x54c347];return _0x1711e7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeb03('0x0'));var zipdir=require(_0xeb03('0x1'));var jsonpatch=require(_0xeb03('0x2'));var rp=require(_0xeb03('0x3'));var moment=require(_0xeb03('0x4'));var BPromise=require(_0xeb03('0x5'));var Mustache=require(_0xeb03('0x6'));var util=require(_0xeb03('0x7'));var path=require(_0xeb03('0x8'));var sox=require(_0xeb03('0x9'));var csv=require(_0xeb03('0xa'));var ejs=require(_0xeb03('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeb03('0xc'));var squel=require(_0xeb03('0xd'));var crypto=require(_0xeb03('0xe'));var jsforce=require(_0xeb03('0xf'));var deskjs=require(_0xeb03('0x10'));var toCsv=require(_0xeb03('0xa'));var querystring=require('querystring');var Papa=require(_0xeb03('0x11'));var Redis=require(_0xeb03('0x12'));var authService=require(_0xeb03('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xeb03('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeb03('0x15'))(_0xeb03('0x16'));var utils=require(_0xeb03('0x17'));var config=require(_0xeb03('0x18'));var licenseUtil=require(_0xeb03('0x19'));var db=require(_0xeb03('0x1a'))['db'];var dbH=require(_0xeb03('0x1a'))[_0xeb03('0x1b')];function respondWithStatusCode(_0x97f46d,_0x2422fd){_0x2422fd=_0x2422fd||0xcc;return function(_0x39ab62){if(_0x39ab62){return _0x97f46d[_0xeb03('0x1c')](_0x2422fd);}return _0x97f46d['status'](_0x2422fd)[_0xeb03('0x1d')]();};}function respondWithResult(_0x100bef,_0x372c71){_0x372c71=_0x372c71||0xc8;return function(_0x33f9ba){if(_0x33f9ba){return _0x100bef['status'](_0x372c71)[_0xeb03('0x1e')](_0x33f9ba);}};}function respondWithFilteredResult(_0x36f5d8,_0x3f26ef){return function(_0x478989){if(_0x478989){var _0x7ce874=typeof _0x3f26ef[_0xeb03('0x1f')]===_0xeb03('0x20')&&typeof _0x3f26ef[_0xeb03('0x21')]===_0xeb03('0x20');var _0x1b4cbd=_0x478989[_0xeb03('0x22')];var _0x8d6725=_0x7ce874?0x0:_0x3f26ef[_0xeb03('0x1f')];var _0x469d25=_0x7ce874?_0x478989[_0xeb03('0x22')]:_0x3f26ef[_0xeb03('0x1f')]+_0x3f26ef[_0xeb03('0x21')];var _0x19bddf;if(_0x469d25>=_0x1b4cbd){_0x469d25=_0x1b4cbd;_0x19bddf=0xc8;}else{_0x19bddf=0xce;}_0x36f5d8['status'](_0x19bddf);return _0x36f5d8[_0xeb03('0x23')](_0xeb03('0x24'),_0x8d6725+'-'+_0x469d25+'/'+_0x1b4cbd)[_0xeb03('0x1e')](_0x478989);}return null;};}function patchUpdates(_0x391729){return function(_0xe5a1c2){try{jsonpatch[_0xeb03('0x25')](_0xe5a1c2,_0x391729,!![]);}catch(_0xb98dc1){return BPromise[_0xeb03('0x26')](_0xb98dc1);}return _0xe5a1c2[_0xeb03('0x27')]();};}function saveUpdates(_0x5a704b,_0x712ac2){return function(_0x1707ec){if(_0x1707ec){return _0x1707ec[_0xeb03('0x28')](_0x5a704b)[_0xeb03('0x29')](function(_0x2f99e6){return _0x2f99e6;});}return null;};}function removeEntity(_0x5dcda3,_0x638353){return function(_0x406864){if(_0x406864){return _0x406864[_0xeb03('0x2a')]()[_0xeb03('0x29')](function(){var _0x3f276a=_0x406864[_0xeb03('0x2b')]({'plain':!![]});var _0xb04f34=_0xeb03('0x2c');return db[_0xeb03('0x2d')]['destroy']({'where':{'type':_0xb04f34,'resourceId':_0x3f276a['id']}})[_0xeb03('0x29')](function(){return _0x406864;});})[_0xeb03('0x29')](function(){_0x5dcda3[_0xeb03('0x2e')](0xcc)[_0xeb03('0x1d')]();});}};}function handleEntityNotFound(_0x4cdea6,_0x581685){return function(_0x1064a5){if(!_0x1064a5){_0x4cdea6['sendStatus'](0x194);}return _0x1064a5;};}function handleError(_0x31a622,_0x8bd544){_0x8bd544=_0x8bd544||0x1f4;return function(_0x160a37){logger['error'](_0x160a37[_0xeb03('0x2f')]);if(_0x160a37['name']){delete _0x160a37['name'];}_0x31a622['status'](_0x8bd544)['send'](_0x160a37);};}exports[_0xeb03('0x30')]=function(_0x433ce8,_0x5d0cc1){var _0x528479={},_0x4d830a={},_0x47f7d8={'count':0x0,'rows':[]};var _0x1e8009=_[_0xeb03('0x31')](db[_0xeb03('0x32')][_0xeb03('0x33')],function(_0x19fa35){return{'name':_0x19fa35['fieldName'],'type':_0x19fa35[_0xeb03('0x34')]['key']};});_0x4d830a[_0xeb03('0x35')]=_[_0xeb03('0x31')](_0x1e8009,_0xeb03('0x36'));_0x4d830a[_0xeb03('0x37')]=_[_0xeb03('0x38')](_0x433ce8[_0xeb03('0x37')]);_0x4d830a[_0xeb03('0x39')]=_[_0xeb03('0x3a')](_0x4d830a['model'],_0x4d830a[_0xeb03('0x37')]);_0x528479['attributes']=_[_0xeb03('0x3a')](_0x4d830a[_0xeb03('0x35')],qs[_0xeb03('0x3b')](_0x433ce8[_0xeb03('0x37')][_0xeb03('0x3b')]));_0x528479[_0xeb03('0x3c')]=_0x528479['attributes'][_0xeb03('0x3d')]?_0x528479['attributes']:_0x4d830a['model'];if(!_0x433ce8['query'][_0xeb03('0x3e')](_0xeb03('0x3f'))){_0x528479[_0xeb03('0x21')]=qs[_0xeb03('0x21')](_0x433ce8[_0xeb03('0x37')]['limit']);_0x528479[_0xeb03('0x1f')]=qs[_0xeb03('0x1f')](_0x433ce8[_0xeb03('0x37')]['offset']);}_0x528479['order']=qs[_0xeb03('0x40')](_0x433ce8[_0xeb03('0x37')][_0xeb03('0x40')]);_0x528479['where']=qs[_0xeb03('0x39')](_[_0xeb03('0x41')](_0x433ce8['query'],_0x4d830a['filters']),_0x1e8009);if(_0x433ce8[_0xeb03('0x37')][_0xeb03('0x42')]){_0x528479['where']=_[_0xeb03('0x43')](_0x528479[_0xeb03('0x44')],{'$or':_[_0xeb03('0x31')](_0x1e8009,function(_0x1d28ec){if(_0x1d28ec[_0xeb03('0x34')]!==_0xeb03('0x45')){var _0x278529={};_0x278529[_0x1d28ec[_0xeb03('0x36')]]={'$like':'%'+_0x433ce8[_0xeb03('0x37')][_0xeb03('0x42')]+'%'};return _0x278529;}})});}_0x528479=_[_0xeb03('0x43')]({},_0x528479,_0x433ce8[_0xeb03('0x46')]);var _0x2a9348={'where':_0x528479[_0xeb03('0x44')]};return db[_0xeb03('0x32')][_0xeb03('0x22')](_0x2a9348)[_0xeb03('0x29')](function(_0x3f93ef){_0x47f7d8[_0xeb03('0x22')]=_0x3f93ef;if(_0x433ce8[_0xeb03('0x37')][_0xeb03('0x47')]){_0x528479[_0xeb03('0x48')]=[{'all':!![]}];}return db[_0xeb03('0x32')]['findAll'](_0x528479);})['then'](function(_0x44aa30){_0x47f7d8[_0xeb03('0x49')]=_0x44aa30;return _0x47f7d8;})[_0xeb03('0x29')](respondWithFilteredResult(_0x5d0cc1,_0x528479))[_0xeb03('0x4a')](handleError(_0x5d0cc1,null));};exports[_0xeb03('0x4b')]=function(_0x39ab97,_0x103c78){var _0xcd049b={'raw':![],'where':{'id':_0x39ab97[_0xeb03('0x4c')]['id']}},_0x5d91c1={};_0x5d91c1[_0xeb03('0x35')]=_[_0xeb03('0x38')](db[_0xeb03('0x32')][_0xeb03('0x33')]);_0x5d91c1['query']=_['keys'](_0x39ab97[_0xeb03('0x37')]);_0x5d91c1['filters']=_['intersection'](_0x5d91c1['model'],_0x5d91c1[_0xeb03('0x37')]);_0xcd049b[_0xeb03('0x3c')]=_[_0xeb03('0x3a')](_0x5d91c1[_0xeb03('0x35')],qs[_0xeb03('0x3b')](_0x39ab97[_0xeb03('0x37')]['fields']));_0xcd049b[_0xeb03('0x3c')]=_0xcd049b['attributes']['length']?_0xcd049b[_0xeb03('0x3c')]:_0x5d91c1[_0xeb03('0x35')];if(_0x39ab97[_0xeb03('0x37')]['includeAll']){_0xcd049b[_0xeb03('0x48')]=[{'all':!![]}];}_0xcd049b=_[_0xeb03('0x43')]({},_0xcd049b,_0x39ab97[_0xeb03('0x46')]);return db[_0xeb03('0x32')][_0xeb03('0x4d')](_0xcd049b)['then'](handleEntityNotFound(_0x103c78,null))[_0xeb03('0x29')](respondWithResult(_0x103c78,null))['catch'](handleError(_0x103c78,null));};exports[_0xeb03('0x4e')]=function(_0x2c99d0,_0x14f1d0){return db[_0xeb03('0x32')][_0xeb03('0x4e')](_0x2c99d0[_0xeb03('0x4f')],{})[_0xeb03('0x29')](function(_0x292319){var _0x38c993=_0x2c99d0[_0xeb03('0x50')][_0xeb03('0x2b')]({'plain':!![]});if(!_0x38c993)throw new Error(_0xeb03('0x51'));if(_0x38c993[_0xeb03('0x52')]===_0xeb03('0x50')){var _0x2a7eaf=_0x292319[_0xeb03('0x2b')]({'plain':!![]});var _0xf5c1ab=_0xeb03('0x53');return db[_0xeb03('0x54')][_0xeb03('0x4d')]({'where':{'name':_0xf5c1ab,'userProfileId':_0x38c993[_0xeb03('0x55')]},'raw':!![]})[_0xeb03('0x29')](function(_0x1761ab){if(_0x1761ab&&_0x1761ab[_0xeb03('0x56')]===0x0){return db['UserProfileResource'][_0xeb03('0x4e')]({'name':_0x2a7eaf[_0xeb03('0x36')],'resourceId':_0x2a7eaf['id'],'type':_0xeb03('0x2c'),'sectionId':_0x1761ab['id']},{})['then'](function(){return _0x292319;});}else{return _0x292319;}})[_0xeb03('0x4a')](function(_0x3604e8){logger[_0xeb03('0x57')](_0xeb03('0x58'),_0x3604e8);throw _0x3604e8;});}return _0x292319;})[_0xeb03('0x29')](respondWithResult(_0x14f1d0,0xc9))[_0xeb03('0x4a')](handleError(_0x14f1d0,null));};exports[_0xeb03('0x28')]=function(_0x36f18e,_0x1fe50a){if(_0x36f18e[_0xeb03('0x4f')]['id']){delete _0x36f18e[_0xeb03('0x4f')]['id'];}return db[_0xeb03('0x32')][_0xeb03('0x4d')]({'where':{'id':_0x36f18e[_0xeb03('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1fe50a,null))[_0xeb03('0x29')](saveUpdates(_0x36f18e[_0xeb03('0x4f')],null))[_0xeb03('0x29')](respondWithResult(_0x1fe50a,null))[_0xeb03('0x4a')](handleError(_0x1fe50a,null));};exports[_0xeb03('0x2a')]=function(_0x39e2c7,_0x4320f7){return db[_0xeb03('0x32')][_0xeb03('0x4d')]({'where':{'id':_0x39e2c7[_0xeb03('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4320f7,null))[_0xeb03('0x29')](removeEntity(_0x4320f7,null))[_0xeb03('0x4a')](handleError(_0x4320f7,null));};exports[_0xeb03('0x59')]=function(_0x62105a,_0x58c096){var _0x24a0c5=0xa;var _0x68e1b7=[_0xeb03('0x5a'),_0xeb03('0x5b'),_0xeb03('0x5c'),'cross_join'];var _0x43efc3={'SUM':_0xeb03('0x5d'),'COUNT':_0xeb03('0x5e'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xeb03('0x5f'),'MIN':_0xeb03('0x60'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xeb03('0x61'),'GROUP_CONCAT ASC':_0xeb03('0x62'),'GROUP_CONCAT DESC':_0xeb03('0x63')};var _0x5693cf={'SEC_TO_TIME':_0xeb03('0x64'),'DATE':_0xeb03('0x65'),'HOUR':'HOUR(%s)','ROUND':_0xeb03('0x66'),'UNIX_TIMESTAMP':_0xeb03('0x67')};var _0x1972fb=function(_0x3ac2de){return!_[_0xeb03('0x68')]([_0xeb03('0x69'),_0xeb03('0x6a'),_0xeb03('0x6b'),'IS\x20NOT\x20EMPTY'],_0x3ac2de);};var _0x4447b6=function(_0x50489b){if(!_0x50489b||!_0x50489b[_0xeb03('0x6c')][_0xeb03('0x3d')]){return'';}for(var _0x3a9518='(',_0x59d0c7=0x0;_0x59d0c7<_0x50489b[_0xeb03('0x6c')][_0xeb03('0x3d')];_0x59d0c7+=0x1){_0x59d0c7>0x0&&(_0x3a9518+='\x20'+_0x50489b[_0xeb03('0x6d')]+'\x20');_0x3a9518+=_0x50489b[_0xeb03('0x6c')][_0x59d0c7]['group']?_0x4447b6(_0x50489b[_0xeb03('0x6c')][_0x59d0c7][_0xeb03('0x6e')]):_0x50489b['rules'][_0x59d0c7]['field']+'\x20'+_0x50489b['rules'][_0x59d0c7][_0xeb03('0x6f')]+(_0x1972fb(_0x50489b[_0xeb03('0x6c')][_0x59d0c7][_0xeb03('0x6f')])?'\x20'+_0x50489b[_0xeb03('0x6c')][_0x59d0c7][_0xeb03('0x70')]:'');}return _0x3a9518+')';};var _0x461777={'where':{'id':_0x62105a[_0xeb03('0x4c')]['id']}},_0x443fc9,_0x240178,_0x2c78dd,_0x57c435,_0x484398;_0x461777=_[_0xeb03('0x43')]({},_0x461777,_0x62105a['options']);return db[_0xeb03('0x32')][_0xeb03('0x4d')](_0x461777)[_0xeb03('0x29')](function(_0x1890aa){if(_0x1890aa){_0x443fc9=_0x1890aa;return _0x1890aa['getFields']();}return null;})['then'](function(_0x21a182){if(_0x21a182){if(!_0x21a182[_0xeb03('0x3d')]){throw new db[(_0xeb03('0x71'))][(_0xeb03('0x72'))](_0xeb03('0x73'),0x193);}_0x240178=_0x21a182;return db[_0xeb03('0x74')][_0xeb03('0x75')]({'raw':!![]});}return null;})[_0xeb03('0x29')](function(_0x2e67a4){if(_0x2e67a4){_0x2c78dd=_[_0xeb03('0x76')](_0x2e67a4,'id');var _0x46fba8;var _0x53b7ac=squel['select']();_0x53b7ac[_0xeb03('0x77')](_0x443fc9['table']);for(var _0x1099ff=0x0;_0x1099ff<_0x240178['length'];_0x1099ff+=0x1){_0x46fba8=_0x240178[_0x1099ff][_0xeb03('0x78')]?_0x2c78dd[_0x240178[_0x1099ff]['MetricId']][_0xeb03('0x79')]:_0x240178[_0x1099ff][_0xeb03('0x7a')];_0x46fba8=_0x240178[_0x1099ff]['function']?_[_0xeb03('0x7b')](_0x43efc3[_0x240178[_0x1099ff]['function']],'%s',_0x46fba8):_0x46fba8;_0x46fba8=_0x240178[_0x1099ff][_0xeb03('0x7c')]?_['replace'](_0x5693cf[_0x240178[_0x1099ff][_0xeb03('0x7c')]],'%s',_0x46fba8):_0x46fba8;if(_0x240178[_0x1099ff]['groupBy']){_0x53b7ac['group'](_0x46fba8);}_0x240178[_0x1099ff][_0xeb03('0x7d')]&&_0x53b7ac[_0xeb03('0x7e')](_0x46fba8,_0x240178[_0x1099ff][_0xeb03('0x7d')]===_0xeb03('0x7f')?![]:!![]);_0x53b7ac[_0xeb03('0x7a')](_0x46fba8,_0x240178[_0x1099ff][_0xeb03('0x80')]||_0x46fba8);}if(_0x443fc9[_0xeb03('0x81')]){_0x443fc9['joins']=JSON[_0xeb03('0x82')](_0x443fc9[_0xeb03('0x81')]);for(var _0x1c0735=0x0;_0x1c0735<_0x443fc9[_0xeb03('0x81')][_0xeb03('0x3d')];_0x1c0735+=0x1){if(_0x443fc9[_0xeb03('0x81')][_0x1c0735][_0xeb03('0x34')]&&_['includes'](_0x68e1b7,_0x443fc9[_0xeb03('0x81')][_0x1c0735][_0xeb03('0x34')])&&_0x443fc9[_0xeb03('0x81')][_0x1c0735][_0xeb03('0x83')]&&_0x443fc9[_0xeb03('0x81')][_0x1c0735][_0xeb03('0x84')]&&_0x443fc9[_0xeb03('0x81')][_0x1c0735][_0xeb03('0x85')]){_0x53b7ac[_0x443fc9['joins'][_0x1c0735][_0xeb03('0x34')]](_0x443fc9[_0xeb03('0x81')][_0x1c0735][_0xeb03('0x84')],null,util[_0xeb03('0x7c')](_0xeb03('0x86'),_0x443fc9['table'],_0x443fc9[_0xeb03('0x81')][_0x1c0735][_0xeb03('0x83')],_0x443fc9[_0xeb03('0x81')][_0x1c0735][_0xeb03('0x84')],_0x443fc9[_0xeb03('0x81')][_0x1c0735][_0xeb03('0x85')]));}}}if(_0x443fc9[_0xeb03('0x87')]){_0x443fc9['conditions']=JSON[_0xeb03('0x82')](_0x443fc9[_0xeb03('0x87')]);_0x53b7ac[_0xeb03('0x44')](_0x4447b6(_0x443fc9[_0xeb03('0x87')][_0xeb03('0x6e')]));}_0x484398=_0x53b7ac['clone']();_0x53b7ac[_0xeb03('0x21')](_0x24a0c5);_0x53b7ac[_0xeb03('0x1f')](0x0);logger[_0xeb03('0x88')](_0xeb03('0x89'),_0x53b7ac[_0xeb03('0x8a')]());return dbH[_0xeb03('0x8b')][_0xeb03('0x37')](_0x53b7ac['toString'](),{'type':dbH[_0xeb03('0x8b')][_0xeb03('0x8c')][_0xeb03('0x8d')]});}})[_0xeb03('0x29')](respondWithResult(_0x58c096,null))[_0xeb03('0x4a')](handleError(_0x58c096,null));};function runReport(_0x388fbd,_0x5e3318,_0xf472a1){var _0x1a7bf0=_0x5e3318[_0xeb03('0x36')];var _0x48b6e9=0xa;var _0x349c15=[_0xeb03('0x5a'),_0xeb03('0x5b'),_0xeb03('0x5c'),_0xeb03('0x8e')];var _0x248468={'SUM':_0xeb03('0x5d'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xeb03('0x5f'),'MIN':_0xeb03('0x60'),'AVG':_0xeb03('0x8f'),'GROUP_CONCAT':_0xeb03('0x61'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xeb03('0x63')};var _0x42c477={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xeb03('0x65'),'HOUR':_0xeb03('0x90'),'ROUND':_0xeb03('0x66'),'UNIX_TIMESTAMP':_0xeb03('0x67')};var _0xda9cb6=function(_0x8b7fb){return!_['includes']([_0xeb03('0x69'),_0xeb03('0x6a'),_0xeb03('0x6b'),_0xeb03('0x91')],_0x8b7fb);};var _0xe2c7f7=function(_0x2f60b4){if(!_0x2f60b4||!_0x2f60b4[_0xeb03('0x6c')][_0xeb03('0x3d')]){return'';}for(var _0x1cec91='(',_0x3fd8c9=0x0;_0x3fd8c9<_0x2f60b4['rules'][_0xeb03('0x3d')];_0x3fd8c9+=0x1){_0x3fd8c9>0x0&&(_0x1cec91+='\x20'+_0x2f60b4[_0xeb03('0x6d')]+'\x20');_0x1cec91+=_0x2f60b4['rules'][_0x3fd8c9][_0xeb03('0x6e')]?_0xe2c7f7(_0x2f60b4[_0xeb03('0x6c')][_0x3fd8c9]['group']):_0x2f60b4[_0xeb03('0x6c')][_0x3fd8c9][_0xeb03('0x7a')]+'\x20'+_0x2f60b4[_0xeb03('0x6c')][_0x3fd8c9][_0xeb03('0x6f')]+(_0xda9cb6(_0x2f60b4[_0xeb03('0x6c')][_0x3fd8c9]['condition'])?'\x20'+_0x2f60b4['rules'][_0x3fd8c9]['value']:'');}return _0x1cec91+')';};var _0x3cead5={'where':{'id':_0x388fbd['id']}},_0x4d7e0f,_0x155d0a,_0x2c8705,_0x22d094,_0x37e510;_0x3cead5=_[_0xeb03('0x43')]({},_0x3cead5,_0xf472a1);return db[_0xeb03('0x32')][_0xeb03('0x4d')](_0x3cead5)[_0xeb03('0x29')](function(_0x25e79e){if(_0x25e79e){_0x4d7e0f=_0x25e79e;return _0x25e79e[_0xeb03('0x92')]();}return null;})[_0xeb03('0x29')](function(_0x27a388){if(_0x27a388){if(!_0x27a388['length']){throw new db['Sequelize'][(_0xeb03('0x72'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x155d0a=_0x27a388;return db['AnalyticMetric'][_0xeb03('0x75')]({'raw':!![]});}return null;})[_0xeb03('0x29')](function(_0x502b25){if(_0x502b25){_0x2c8705=_['keyBy'](_0x502b25,'id');var _0x41eadc;var _0xc53874=squel['select']();_0xc53874[_0xeb03('0x77')](_0x4d7e0f[_0xeb03('0x93')]);for(var _0x2efed6=0x0;_0x2efed6<_0x155d0a[_0xeb03('0x3d')];_0x2efed6+=0x1){_0x41eadc=_0x155d0a[_0x2efed6][_0xeb03('0x78')]?_0x2c8705[_0x155d0a[_0x2efed6]['MetricId']][_0xeb03('0x79')]:_0x155d0a[_0x2efed6]['field'];_0x41eadc=_0x155d0a[_0x2efed6]['function']?_[_0xeb03('0x7b')](_0x248468[_0x155d0a[_0x2efed6][_0xeb03('0x94')]],'%s',_0x41eadc):_0x41eadc;_0x41eadc=_0x155d0a[_0x2efed6][_0xeb03('0x7c')]?_[_0xeb03('0x7b')](_0x42c477[_0x155d0a[_0x2efed6]['format']],'%s',_0x41eadc):_0x41eadc;if(_0x155d0a[_0x2efed6]['groupBy']){_0xc53874[_0xeb03('0x6e')](_0x41eadc);}_0x155d0a[_0x2efed6][_0xeb03('0x7d')]&&_0xc53874[_0xeb03('0x7e')](_0x41eadc,_0x155d0a[_0x2efed6][_0xeb03('0x7d')]===_0xeb03('0x7f')?![]:!![]);_0xc53874[_0xeb03('0x7a')](_0x41eadc,_0x155d0a[_0x2efed6][_0xeb03('0x80')]||_0x41eadc);}if(_0x4d7e0f[_0xeb03('0x81')]){_0x4d7e0f['joins']=JSON['parse'](_0x4d7e0f[_0xeb03('0x81')]);for(var _0x5741d4=0x0;_0x5741d4<_0x4d7e0f[_0xeb03('0x81')]['length'];_0x5741d4+=0x1){if(_0x4d7e0f[_0xeb03('0x81')][_0x5741d4][_0xeb03('0x34')]&&_[_0xeb03('0x68')](_0x349c15,_0x4d7e0f[_0xeb03('0x81')][_0x5741d4][_0xeb03('0x34')])&&_0x4d7e0f[_0xeb03('0x81')][_0x5741d4][_0xeb03('0x83')]&&_0x4d7e0f[_0xeb03('0x81')][_0x5741d4]['foreignTable']&&_0x4d7e0f['joins'][_0x5741d4][_0xeb03('0x85')]){_0xc53874[_0x4d7e0f[_0xeb03('0x81')][_0x5741d4][_0xeb03('0x34')]](_0x4d7e0f[_0xeb03('0x81')][_0x5741d4][_0xeb03('0x84')],null,util['format'](_0xeb03('0x86'),_0x4d7e0f[_0xeb03('0x93')],_0x4d7e0f['joins'][_0x5741d4][_0xeb03('0x83')],_0x4d7e0f[_0xeb03('0x81')][_0x5741d4][_0xeb03('0x84')],_0x4d7e0f[_0xeb03('0x81')][_0x5741d4][_0xeb03('0x85')]));}}}if(_0x4d7e0f[_0xeb03('0x87')]){_0x4d7e0f[_0xeb03('0x87')]=JSON[_0xeb03('0x82')](_0x4d7e0f[_0xeb03('0x87')]);_0xc53874[_0xeb03('0x44')](_0xe2c7f7(_0x4d7e0f[_0xeb03('0x87')][_0xeb03('0x6e')]));}_0x37e510=_0xc53874[_0xeb03('0x95')]();_0xc53874[_0xeb03('0x21')](_0x48b6e9);_0xc53874['offset'](0x0);return;}})[_0xeb03('0x29')](function(){if(_0x5e3318[_0xeb03('0x96')]==='web'){return null;}var _0x1f3ee1=_['merge'](_0x5e3318,{'name':_0x5e3318[_0xeb03('0x97')]||_0x5e3318['name']||_0x4d7e0f[_0xeb03('0x36')],'basename':_0x1a7bf0,'savename':util[_0xeb03('0x7c')](_0xeb03('0x98'),_0x5e3318[_0xeb03('0x36')]||_0x4d7e0f[_0xeb03('0x36')],require(_0xeb03('0x99'))[_0xeb03('0x9a')](0x4),_0x5e3318[_0xeb03('0x96')]||'csv'),'reportId':_0x4d7e0f['id'],'reportType':_0xeb03('0x9b')});return db[_0xeb03('0x9c')][_0xeb03('0x4e')](_0x1f3ee1,{'raw':!![]});})[_0xeb03('0x29')](function(_0x5759fe){if(_0x4d7e0f[_0xeb03('0x93')]==='cdr'){_0x37e510[_0xeb03('0x44')](_0x4d7e0f[_0xeb03('0x93')]+_0xeb03('0x9d'),_0x5e3318[_0xeb03('0x9e')],_0x5e3318['endDate']);}else{_0x37e510[_0xeb03('0x44')](_0x4d7e0f[_0xeb03('0x93')]+_0xeb03('0x9f'),_0x5e3318[_0xeb03('0x9e')],_0x5e3318['endDate']);}if(_0x5759fe){logger[_0xeb03('0xa0')]('Run\x20Query:',_0x37e510[_0xeb03('0x8a')]());require('child_process')[_0xeb03('0xa1')](path['join'](__dirname,_0xeb03('0xa2'),_0x5759fe[_0xeb03('0x96')]),[_0x5759fe['id'],_0x37e510[_0xeb03('0x8a')](),path['join'](__dirname,'../../files/reports',_0x5759fe['savename']),_0x1a7bf0]);return _0x5759fe;}else{var _0x50b2c5=squel['select']();_0x50b2c5[_0xeb03('0x77')]('('+_0x37e510[_0xeb03('0x8a')]()+')',_0xeb03('0xa3'));_0x50b2c5[_0xeb03('0x7a')](_0xeb03('0xa4'),_0xeb03('0x22'));_0x37e510['limit'](_0x5e3318[_0xeb03('0x21')]||_0x48b6e9);_0x37e510[_0xeb03('0x1f')](_0x5e3318[_0xeb03('0x1f')]||0x0);return dbH[_0xeb03('0x8b')]['query'](_0x50b2c5['toString'](),{'type':dbH[_0xeb03('0x8b')][_0xeb03('0x8c')]['SELECT']})[_0xeb03('0x29')](function(_0x2ebd1a){if(!_0x2ebd1a[_0xeb03('0x3d')]){_0x22d094=0x0;}else{_0x22d094=_0x2ebd1a[0x0][_0xeb03('0x22')]||0x0;}return dbH[_0xeb03('0x8b')][_0xeb03('0x37')](_0x37e510[_0xeb03('0x8a')](),{'type':dbH['sequelize'][_0xeb03('0x8c')][_0xeb03('0x8d')]});})[_0xeb03('0x29')](function(_0x2fbeae){return{'rows':_0x2fbeae||[],'count':_0x22d094};});}});}exports[_0xeb03('0xa5')]=function(_0x16a366,_0x30f740){return runReport(_0x16a366[_0xeb03('0x4c')],_0x16a366['query'],_0x16a366[_0xeb03('0x46')])['then'](respondWithResult(_0x30f740,null))['catch'](handleError(_0x30f740,null));};exports[_0xeb03('0xa6')]=runReport;exports[_0xeb03('0x37')]=function(_0x4b92b8,_0x22a544){var _0x4cd18c=0xa;var _0xc3d089=['join',_0xeb03('0x5b'),_0xeb03('0x5c'),_0xeb03('0x8e')];var _0x1522d4={'SUM':_0xeb03('0x5d'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xeb03('0xa7'),'MAX':_0xeb03('0x5f'),'MIN':_0xeb03('0x60'),'AVG':_0xeb03('0x8f'),'GROUP_CONCAT':_0xeb03('0x61'),'GROUP_CONCAT ASC':_0xeb03('0x62'),'GROUP_CONCAT DESC':_0xeb03('0x63')};var _0x464a37={'SEC_TO_TIME':_0xeb03('0x64'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xeb03('0x67')};var _0x40a6ce=function(_0x400e5b){return!_[_0xeb03('0x68')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0xeb03('0x91')],_0x400e5b);};var _0x22e88d=function(_0x2c89c4){if(!_0x2c89c4||!_0x2c89c4[_0xeb03('0x6c')][_0xeb03('0x3d')]){return'';}for(var _0x47b6f2='(',_0x4057b8=0x0;_0x4057b8<_0x2c89c4[_0xeb03('0x6c')]['length'];_0x4057b8+=0x1){_0x4057b8>0x0&&(_0x47b6f2+='\x20'+_0x2c89c4[_0xeb03('0x6d')]+'\x20');_0x47b6f2+=_0x2c89c4['rules'][_0x4057b8]['group']?_0x22e88d(_0x2c89c4[_0xeb03('0x6c')][_0x4057b8][_0xeb03('0x6e')]):_0x2c89c4[_0xeb03('0x6c')][_0x4057b8]['field']+'\x20'+_0x2c89c4[_0xeb03('0x6c')][_0x4057b8][_0xeb03('0x6f')]+(_0x40a6ce(_0x2c89c4['rules'][_0x4057b8][_0xeb03('0x6f')])?'\x20'+_0x2c89c4['rules'][_0x4057b8]['value']:'');}return _0x47b6f2+')';};var _0x301b97={'where':{'id':_0x4b92b8['params']['id']}},_0x119356,_0x366054,_0x131815,_0x143350,_0x1d9efd;_0x301b97=_[_0xeb03('0x43')]({},_0x301b97,_0x4b92b8[_0xeb03('0x46')]);return db[_0xeb03('0x32')][_0xeb03('0x4d')](_0x301b97)[_0xeb03('0x29')](function(_0x3e438f){if(_0x3e438f){_0x119356=_0x3e438f;return _0x3e438f[_0xeb03('0x92')]();}return null;})[_0xeb03('0x29')](function(_0x164994){if(_0x164994){if(!_0x164994[_0xeb03('0x3d')]){throw new db[(_0xeb03('0x71'))][(_0xeb03('0x72'))](_0xeb03('0x73'),0x193);}_0x366054=_0x164994;return db[_0xeb03('0x74')][_0xeb03('0x75')]({'raw':!![]});}return null;})[_0xeb03('0x29')](function(_0x24e088){if(_0x24e088){_0x131815=_[_0xeb03('0x76')](_0x24e088,'id');var _0x1d68f1;var _0x42b815=squel[_0xeb03('0xa8')]();_0x42b815[_0xeb03('0x77')](_0x119356['table']);for(var _0x3417af=0x0;_0x3417af<_0x366054['length'];_0x3417af+=0x1){_0x1d68f1=_0x366054[_0x3417af][_0xeb03('0x78')]?_0x131815[_0x366054[_0x3417af][_0xeb03('0x78')]][_0xeb03('0x79')]:_0x366054[_0x3417af][_0xeb03('0x7a')];_0x1d68f1=_0x366054[_0x3417af][_0xeb03('0x94')]?_[_0xeb03('0x7b')](_0x1522d4[_0x366054[_0x3417af]['function']],'%s',_0x1d68f1):_0x1d68f1;_0x1d68f1=_0x366054[_0x3417af][_0xeb03('0x7c')]?_[_0xeb03('0x7b')](_0x464a37[_0x366054[_0x3417af]['format']],'%s',_0x1d68f1):_0x1d68f1;if(_0x366054[_0x3417af][_0xeb03('0xa9')]){_0x42b815['group'](_0x1d68f1);}_0x366054[_0x3417af][_0xeb03('0x7d')]&&_0x42b815[_0xeb03('0x7e')](_0x1d68f1,_0x366054[_0x3417af][_0xeb03('0x7d')]===_0xeb03('0x7f')?![]:!![]);_0x42b815[_0xeb03('0x7a')](_0x1d68f1,_0x366054[_0x3417af][_0xeb03('0x80')]||_0x1d68f1);}if(_0x119356[_0xeb03('0x81')]){_0x119356['joins']=JSON[_0xeb03('0x82')](_0x119356[_0xeb03('0x81')]);for(var _0xf30c4d=0x0;_0xf30c4d<_0x119356[_0xeb03('0x81')][_0xeb03('0x3d')];_0xf30c4d+=0x1){if(_0x119356[_0xeb03('0x81')][_0xf30c4d][_0xeb03('0x34')]&&_[_0xeb03('0x68')](_0xc3d089,_0x119356[_0xeb03('0x81')][_0xf30c4d][_0xeb03('0x34')])&&_0x119356[_0xeb03('0x81')][_0xf30c4d][_0xeb03('0x83')]&&_0x119356[_0xeb03('0x81')][_0xf30c4d][_0xeb03('0x84')]&&_0x119356['joins'][_0xf30c4d]['foreignKey']){_0x42b815[_0x119356[_0xeb03('0x81')][_0xf30c4d][_0xeb03('0x34')]](_0x119356[_0xeb03('0x81')][_0xf30c4d][_0xeb03('0x84')],null,util[_0xeb03('0x7c')]('%s.%s\x20=\x20%s.%s',_0x119356[_0xeb03('0x93')],_0x119356['joins'][_0xf30c4d][_0xeb03('0x83')],_0x119356[_0xeb03('0x81')][_0xf30c4d][_0xeb03('0x84')],_0x119356[_0xeb03('0x81')][_0xf30c4d][_0xeb03('0x85')]));}}}if(_0x119356[_0xeb03('0x87')]){_0x119356['conditions']=JSON[_0xeb03('0x82')](_0x119356[_0xeb03('0x87')]);_0x42b815[_0xeb03('0x44')](_0x22e88d(_0x119356[_0xeb03('0x87')][_0xeb03('0x6e')]));}_0x1d9efd=_0x42b815[_0xeb03('0x95')]();_0x42b815[_0xeb03('0x21')](_0x4cd18c);_0x42b815[_0xeb03('0x1f')](0x0);logger['debug'](_0xeb03('0x89'),_0x42b815[_0xeb03('0x8a')]());return dbH['sequelize'][_0xeb03('0x37')](_0x42b815['toString'](),{'type':dbH[_0xeb03('0x8b')][_0xeb03('0x8c')][_0xeb03('0x8d')]});}})[_0xeb03('0x29')](function(){return{'sql':_0x1d9efd[_0xeb03('0x8a')]()};})[_0xeb03('0x29')](respondWithResult(_0x22a544,null))[_0xeb03('0x4a')](handleError(_0x22a544,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index a217e57..12b9b9a 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 _0x545d=['util','../../config/logger','api','moment','exports','AnalyticCustomReport','analytics_custom_reports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x545d,0xbd));var _0xd545=function(_0x384131,_0x39f75f){_0x384131=_0x384131-0x0;var _0x1f2c9c=_0x545d[_0x384131];return _0x1f2c9c;};'use strict';var _=require('lodash');var util=require(_0xd545('0x0'));var logger=require(_0xd545('0x1'))(_0xd545('0x2'));var moment=require(_0xd545('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('../../config/environment');var attributes=require('./analyticCustomReport.attributes');module[_0xd545('0x4')]=function(_0x5165ab,_0x51671a){return _0x5165ab['define'](_0xd545('0x5'),attributes,{'tableName':_0xd545('0x6'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4499=['../../config/environment','./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports','api','request-promise','rimraf'];(function(_0x1e7345,_0x18bcce){var _0x33017c=function(_0x2b274f){while(--_0x2b274f){_0x1e7345['push'](_0x1e7345['shift']());}};_0x33017c(++_0x18bcce);}(_0x4499,0x145));var _0x9449=function(_0x49ca6b,_0x3ba842){_0x49ca6b=_0x49ca6b-0x0;var _0x1d957f=_0x4499[_0x49ca6b];return _0x1d957f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x9449('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9449('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9449('0x2'));var config=require(_0x9449('0x3'));var attributes=require(_0x9449('0x4'));module['exports']=function(_0x3f442d,_0xcc0f6f){return _0x3f442d[_0x9449('0x5')](_0x9449('0x6'),attributes,{'tableName':_0x9449('0x7'),'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 5d6c648..633997b 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 _0xe134=['rpc','../../config/environment','jayson/promise','http','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger'];(function(_0x13fa84,_0x1054c0){var _0x2b3f04=function(_0x5c895f){while(--_0x5c895f){_0x13fa84['push'](_0x13fa84['shift']());}};_0x2b3f04(++_0x1054c0);}(_0xe134,0x135));var _0x4e13=function(_0x5dedf5,_0x20c96e){_0x5dedf5=_0x5dedf5-0x0;var _0x4a30f0=_0xe134[_0x5dedf5];return _0x4a30f0;};'use strict';var _=require(_0x4e13('0x0'));var util=require(_0x4e13('0x1'));var moment=require(_0x4e13('0x2'));var BPromise=require(_0x4e13('0x3'));var rs=require(_0x4e13('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4e13('0x5'))(_0x4e13('0x6'));var config=require(_0x4e13('0x7'));var jayson=require(_0x4e13('0x8'));var client=jayson['client'][_0x4e13('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ca904,_0x5c26eb,_0x6a54a9){return new BPromise(function(_0x20b77a,_0x32415c){return client['request'](_0x4ca904,_0x6a54a9)['then'](function(_0x1bf3f9){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x5c26eb,_0x4e13('0xa'));logger[_0x4e13('0xb')](_0x4e13('0xc'),_0x5c26eb,_0x4e13('0xa'),JSON[_0x4e13('0xd')](_0x1bf3f9));if(_0x1bf3f9['error']){if(_0x1bf3f9[_0x4e13('0xe')][_0x4e13('0xf')]===0x1f4){logger[_0x4e13('0xe')](_0x4e13('0x10'),_0x5c26eb,_0x1bf3f9['error'][_0x4e13('0x11')]);return _0x32415c(_0x1bf3f9[_0x4e13('0xe')][_0x4e13('0x11')]);}logger['error'](_0x4e13('0x10'),_0x5c26eb,_0x1bf3f9['error'][_0x4e13('0x11')]);return _0x20b77a(_0x1bf3f9[_0x4e13('0xe')][_0x4e13('0x11')]);}else{logger[_0x4e13('0x12')](_0x4e13('0x10'),_0x5c26eb,_0x4e13('0xa'));_0x20b77a(_0x1bf3f9[_0x4e13('0x13')][_0x4e13('0x11')]);}})[_0x4e13('0x14')](function(_0x311895){logger[_0x4e13('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x5c26eb,_0x311895);_0x32415c(_0x311895);});});} \ No newline at end of file +var _0xbbaf=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch'];(function(_0x5d967b,_0x32b32b){var _0x319e03=function(_0x2d014e){while(--_0x2d014e){_0x5d967b['push'](_0x5d967b['shift']());}};_0x319e03(++_0x32b32b);}(_0xbbaf,0x165));var _0xfbba=function(_0xbb8fad,_0x1717ff){_0xbb8fad=_0xbb8fad-0x0;var _0x263e71=_0xbbaf[_0xbb8fad];return _0x263e71;};'use strict';var _=require(_0xfbba('0x0'));var util=require(_0xfbba('0x1'));var moment=require(_0xfbba('0x2'));var BPromise=require(_0xfbba('0x3'));var rs=require(_0xfbba('0x4'));var fs=require('fs');var Redis=require(_0xfbba('0x5'));var db=require(_0xfbba('0x6'))['db'];var utils=require(_0xfbba('0x7'));var logger=require('../../config/logger')(_0xfbba('0x8'));var config=require('../../config/environment');var jayson=require(_0xfbba('0x9'));var client=jayson[_0xfbba('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e990e,_0x485432,_0x3906e5){return new BPromise(function(_0x39ff6c,_0x2f2766){return client[_0xfbba('0xb')](_0x1e990e,_0x3906e5)[_0xfbba('0xc')](function(_0x1232d0){logger[_0xfbba('0xd')](_0xfbba('0xe'),_0x485432,_0xfbba('0xf'));logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x485432,_0xfbba('0xf'),JSON[_0xfbba('0x10')](_0x1232d0));if(_0x1232d0[_0xfbba('0x11')]){if(_0x1232d0['error']['code']===0x1f4){logger[_0xfbba('0x11')](_0xfbba('0xe'),_0x485432,_0x1232d0[_0xfbba('0x11')][_0xfbba('0x12')]);return _0x2f2766(_0x1232d0[_0xfbba('0x11')]['message']);}logger[_0xfbba('0x11')](_0xfbba('0xe'),_0x485432,_0x1232d0[_0xfbba('0x11')][_0xfbba('0x12')]);return _0x39ff6c(_0x1232d0[_0xfbba('0x11')]['message']);}else{logger[_0xfbba('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x485432,'request\x20sent');_0x39ff6c(_0x1232d0[_0xfbba('0x13')]['message']);}})[_0xfbba('0x14')](function(_0x11d24c){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x485432,_0x11d24c);_0x2f2766(_0x11d24c);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 6259d04..2036f40 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 _0xc2d5=['get','isAuthenticated','index','/:id','preview','run','query','post','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller'];(function(_0x2a253e,_0x18a7f0){var _0x318784=function(_0x334107){while(--_0x334107){_0x2a253e['push'](_0x2a253e['shift']());}};_0x318784(++_0x18a7f0);}(_0xc2d5,0x7a));var _0x5c2d=function(_0x1e6b59,_0x5eca5d){_0x1e6b59=_0x1e6b59-0x0;var _0x40d7c5=_0xc2d5[_0x1e6b59];return _0x40d7c5;};'use strict';var multer=require(_0x5c2d('0x0'));var util=require(_0x5c2d('0x1'));var path=require(_0x5c2d('0x2'));var timeout=require(_0x5c2d('0x3'));var express=require('express');var router=express[_0x5c2d('0x4')]();var fs_extra=require(_0x5c2d('0x5'));var auth=require(_0x5c2d('0x6'));var interaction=require(_0x5c2d('0x7'));var config=require(_0x5c2d('0x8'));var controller=require(_0x5c2d('0x9'));router[_0x5c2d('0xa')]('/',auth[_0x5c2d('0xb')](),controller[_0x5c2d('0xc')]);router[_0x5c2d('0xa')](_0x5c2d('0xd'),auth[_0x5c2d('0xb')](),controller['show']);router[_0x5c2d('0xa')]('/:id/preview',auth[_0x5c2d('0xb')](),controller[_0x5c2d('0xe')]);router['get']('/:id/run',auth[_0x5c2d('0xb')](),controller[_0x5c2d('0xf')]);router[_0x5c2d('0xa')]('/:id/query',auth['isAuthenticated'](),controller[_0x5c2d('0x10')]);router[_0x5c2d('0x11')]('/',auth[_0x5c2d('0xb')](),controller['create']);router[_0x5c2d('0x12')](_0x5c2d('0xd'),auth[_0x5c2d('0xb')](),controller[_0x5c2d('0x13')]);router[_0x5c2d('0x14')](_0x5c2d('0xd'),auth[_0x5c2d('0xb')](),controller['destroy']);module[_0x5c2d('0x15')]=router; \ No newline at end of file +var _0xa7bc=['create','update','destroy','exports','connect-timeout','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xa7bc,0xc2));var _0xca7b=function(_0x4a61ae,_0x9dc91d){_0x4a61ae=_0x4a61ae-0x0;var _0x429538=_0xa7bc[_0x4a61ae];return _0x429538;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xca7b('0x0'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xca7b('0x1'));var interaction=require('../../components/interaction/service');var config=require(_0xca7b('0x2'));var controller=require(_0xca7b('0x3'));router[_0xca7b('0x4')]('/',auth[_0xca7b('0x5')](),controller[_0xca7b('0x6')]);router['get'](_0xca7b('0x7'),auth['isAuthenticated'](),controller[_0xca7b('0x8')]);router['get'](_0xca7b('0x9'),auth[_0xca7b('0x5')](),controller[_0xca7b('0xa')]);router['get'](_0xca7b('0xb'),auth[_0xca7b('0x5')](),controller[_0xca7b('0xc')]);router[_0xca7b('0x4')](_0xca7b('0xd'),auth['isAuthenticated'](),controller[_0xca7b('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xca7b('0xf')]);router['put'](_0xca7b('0x7'),auth[_0xca7b('0x5')](),controller[_0xca7b('0x10')]);router['delete'](_0xca7b('0x7'),auth[_0xca7b('0x5')](),controller[_0xca7b('0x11')]);module[_0xca7b('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index be4f391..c2a68d9 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 _0x46ed=['sequelize','exports','STRING','TEXT'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x46ed,0x168));var _0xd46e=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x46ed[_0x4ae6ef];return _0x3cbb4e;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd46e('0x2')]},'parent':{'type':Sequelize[_0xd46e('0x2')]},'table':{'type':Sequelize[_0xd46e('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xd46e('0x3')]}}; \ No newline at end of file +var _0x5fd1=['STRING','TEXT','sequelize'];(function(_0xb8cfbe,_0x2e81b6){var _0x227d51=function(_0x5cb1ff){while(--_0x5cb1ff){_0xb8cfbe['push'](_0xb8cfbe['shift']());}};_0x227d51(++_0x2e81b6);}(_0x5fd1,0x155));var _0x15fd=function(_0x27089f,_0x52d6a6){_0x27089f=_0x27089f-0x0;var _0x167329=_0x5fd1[_0x27089f];return _0x167329;};'use strict';var Sequelize=require(_0x15fd('0x0'));module['exports']={'name':{'type':Sequelize[_0x15fd('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x15fd('0x1')]},'parent':{'type':Sequelize[_0x15fd('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x15fd('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index bd4008d..c6d57c2 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 _0xabce=['where','findAll','show','includeAll','options','find','catch','create','body','user','role','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','table','MetricId','field','function','replace','format','groupBy','orderBy','joins','parse','includes','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','SELECT','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','ValidationErrorItem','AnalyticMetric','keyBy','select','metric','DESC','foreignKey','output','web','%s-%s.%s','default','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','from','countTable','COUNT(*)','sequelize','QueryTypes','run','runReport','Sequelize','alias','clone','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','limit','undefined','count','set','json','apply','save','update','then','get','DefaultReports','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','filter','merge'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabce,0x103));var _0xeabc=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0xabce[_0x28d18d];return _0x470640;};'use strict';var emlformat=require(_0xeabc('0x0'));var rimraf=require(_0xeabc('0x1'));var zipdir=require(_0xeabc('0x2'));var jsonpatch=require(_0xeabc('0x3'));var rp=require(_0xeabc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeabc('0x5'));var util=require(_0xeabc('0x6'));var path=require(_0xeabc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeabc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];var dbH=require(_0xeabc('0x19'))[_0xeabc('0x1a')];function respondWithStatusCode(_0xcfbf06,_0x53df9c){_0x53df9c=_0x53df9c||0xcc;return function(_0x235c2d){if(_0x235c2d){return _0xcfbf06[_0xeabc('0x1b')](_0x53df9c);}return _0xcfbf06[_0xeabc('0x1c')](_0x53df9c)['end']();};}function respondWithResult(_0x5f4ee8,_0x3170ea){_0x3170ea=_0x3170ea||0xc8;return function(_0x3ae954){if(_0x3ae954){return _0x5f4ee8[_0xeabc('0x1c')](_0x3170ea)['json'](_0x3ae954);}};}function respondWithFilteredResult(_0xf913d7,_0x638976){return function(_0x49f2d8){if(_0x49f2d8){var _0x53fe28=typeof _0x638976[_0xeabc('0x1d')]==='undefined'&&typeof _0x638976[_0xeabc('0x1e')]===_0xeabc('0x1f');var _0x58a3c0=_0x49f2d8[_0xeabc('0x20')];var _0x31dd53=_0x53fe28?0x0:_0x638976[_0xeabc('0x1d')];var _0x384be5=_0x53fe28?_0x49f2d8[_0xeabc('0x20')]:_0x638976['offset']+_0x638976[_0xeabc('0x1e')];var _0x4d68ea;if(_0x384be5>=_0x58a3c0){_0x384be5=_0x58a3c0;_0x4d68ea=0xc8;}else{_0x4d68ea=0xce;}_0xf913d7[_0xeabc('0x1c')](_0x4d68ea);return _0xf913d7[_0xeabc('0x21')]('Content-Range',_0x31dd53+'-'+_0x384be5+'/'+_0x58a3c0)[_0xeabc('0x22')](_0x49f2d8);}return null;};}function patchUpdates(_0x41d67a){return function(_0x254590){try{jsonpatch[_0xeabc('0x23')](_0x254590,_0x41d67a,!![]);}catch(_0x3c9611){return BPromise['reject'](_0x3c9611);}return _0x254590[_0xeabc('0x24')]();};}function saveUpdates(_0x10c675,_0x91ab00){return function(_0x5bdd57){if(_0x5bdd57){return _0x5bdd57[_0xeabc('0x25')](_0x10c675)[_0xeabc('0x26')](function(_0x214953){return _0x214953;});}return null;};}function removeEntity(_0x319119,_0x5b8838){return function(_0x109e1d){if(_0x109e1d){return _0x109e1d['destroy']()[_0xeabc('0x26')](function(){var _0x4d4e29=_0x109e1d[_0xeabc('0x27')]({'plain':!![]});var _0x12acbd=_0xeabc('0x28');return db[_0xeabc('0x29')][_0xeabc('0x2a')]({'where':{'type':_0x12acbd,'resourceId':_0x4d4e29['id']}})[_0xeabc('0x26')](function(){return _0x109e1d;});})[_0xeabc('0x26')](function(){_0x319119['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x459c8a,_0x5bf8f2){return function(_0x3c1b5b){if(!_0x3c1b5b){_0x459c8a[_0xeabc('0x1b')](0x194);}return _0x3c1b5b;};}function handleError(_0x48fb52,_0x2163e6){_0x2163e6=_0x2163e6||0x1f4;return function(_0x38572d){logger[_0xeabc('0x2b')](_0x38572d[_0xeabc('0x2c')]);if(_0x38572d[_0xeabc('0x2d')]){delete _0x38572d[_0xeabc('0x2d')];}_0x48fb52[_0xeabc('0x1c')](_0x2163e6)[_0xeabc('0x2e')](_0x38572d);};}exports[_0xeabc('0x2f')]=function(_0x5ebb86,_0x5b34dd){var _0x5bb1f1={},_0x2f03e8={},_0x2d027e={'count':0x0,'rows':[]};var _0x98b445=_[_0xeabc('0x30')](db[_0xeabc('0x31')][_0xeabc('0x32')],function(_0x61c0af){return{'name':_0x61c0af['fieldName'],'type':_0x61c0af[_0xeabc('0x33')][_0xeabc('0x34')]};});_0x2f03e8[_0xeabc('0x35')]=_['map'](_0x98b445,_0xeabc('0x2d'));_0x2f03e8[_0xeabc('0x36')]=_[_0xeabc('0x37')](_0x5ebb86['query']);_0x2f03e8[_0xeabc('0x38')]=_[_0xeabc('0x39')](_0x2f03e8[_0xeabc('0x35')],_0x2f03e8['query']);_0x5bb1f1[_0xeabc('0x3a')]=_[_0xeabc('0x39')](_0x2f03e8['model'],qs['fields'](_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x3b')]));_0x5bb1f1['attributes']=_0x5bb1f1[_0xeabc('0x3a')][_0xeabc('0x3c')]?_0x5bb1f1[_0xeabc('0x3a')]:_0x2f03e8[_0xeabc('0x35')];if(!_0x5ebb86[_0xeabc('0x36')]['hasOwnProperty'](_0xeabc('0x3d'))){_0x5bb1f1['limit']=qs[_0xeabc('0x1e')](_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x1e')]);_0x5bb1f1['offset']=qs['offset'](_0x5ebb86[_0xeabc('0x36')]['offset']);}_0x5bb1f1[_0xeabc('0x3e')]=qs['sort'](_0x5ebb86['query']['sort']);_0x5bb1f1['where']=qs[_0xeabc('0x38')](_['pick'](_0x5ebb86[_0xeabc('0x36')],_0x2f03e8[_0xeabc('0x38')]),_0x98b445);if(_0x5ebb86['query'][_0xeabc('0x3f')]){_0x5bb1f1['where']=_[_0xeabc('0x40')](_0x5bb1f1['where'],{'$or':_[_0xeabc('0x30')](_0x98b445,function(_0xf1b7ef){if(_0xf1b7ef[_0xeabc('0x33')]!=='VIRTUAL'){var _0x5a00d0={};_0x5a00d0[_0xf1b7ef['name']]={'$like':'%'+_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x3f')]+'%'};return _0x5a00d0;}})});}_0x5bb1f1=_[_0xeabc('0x40')]({},_0x5bb1f1,_0x5ebb86['options']);var _0x4f1897={'where':_0x5bb1f1[_0xeabc('0x41')]};return db[_0xeabc('0x31')]['count'](_0x4f1897)[_0xeabc('0x26')](function(_0x5e0b78){_0x2d027e[_0xeabc('0x20')]=_0x5e0b78;if(_0x5ebb86['query']['includeAll']){_0x5bb1f1['include']=[{'all':!![]}];}return db[_0xeabc('0x31')][_0xeabc('0x42')](_0x5bb1f1);})[_0xeabc('0x26')](function(_0x3eeeb5){_0x2d027e['rows']=_0x3eeeb5;return _0x2d027e;})[_0xeabc('0x26')](respondWithFilteredResult(_0x5b34dd,_0x5bb1f1))['catch'](handleError(_0x5b34dd,null));};exports[_0xeabc('0x43')]=function(_0x1a4bbe,_0x3a7807){var _0x17a0df={'raw':!![],'where':{'id':_0x1a4bbe['params']['id']}},_0xc849c9={};_0xc849c9['model']=_[_0xeabc('0x37')](db['AnalyticDefaultReport'][_0xeabc('0x32')]);_0xc849c9[_0xeabc('0x36')]=_['keys'](_0x1a4bbe[_0xeabc('0x36')]);_0xc849c9[_0xeabc('0x38')]=_[_0xeabc('0x39')](_0xc849c9[_0xeabc('0x35')],_0xc849c9[_0xeabc('0x36')]);_0x17a0df[_0xeabc('0x3a')]=_[_0xeabc('0x39')](_0xc849c9['model'],qs[_0xeabc('0x3b')](_0x1a4bbe[_0xeabc('0x36')][_0xeabc('0x3b')]));_0x17a0df[_0xeabc('0x3a')]=_0x17a0df[_0xeabc('0x3a')][_0xeabc('0x3c')]?_0x17a0df[_0xeabc('0x3a')]:_0xc849c9[_0xeabc('0x35')];if(_0x1a4bbe[_0xeabc('0x36')][_0xeabc('0x44')]){_0x17a0df['include']=[{'all':!![]}];}_0x17a0df=_[_0xeabc('0x40')]({},_0x17a0df,_0x1a4bbe[_0xeabc('0x45')]);return db[_0xeabc('0x31')][_0xeabc('0x46')](_0x17a0df)[_0xeabc('0x26')](handleEntityNotFound(_0x3a7807,null))[_0xeabc('0x26')](respondWithResult(_0x3a7807,null))[_0xeabc('0x47')](handleError(_0x3a7807,null));};exports['create']=function(_0x766743,_0x32e09b){return db[_0xeabc('0x31')][_0xeabc('0x48')](_0x766743[_0xeabc('0x49')],{})['then'](function(_0x305946){var _0x2b2b9c=_0x766743[_0xeabc('0x4a')][_0xeabc('0x27')]({'plain':!![]});if(!_0x2b2b9c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b2b9c[_0xeabc('0x4b')]===_0xeabc('0x4a')){var _0x568847=_0x305946[_0xeabc('0x27')]({'plain':!![]});var _0x5a0d4d=_0xeabc('0x4c');return db['UserProfileSection'][_0xeabc('0x46')]({'where':{'name':_0x5a0d4d,'userProfileId':_0x2b2b9c[_0xeabc('0x4d')]},'raw':!![]})[_0xeabc('0x26')](function(_0x1524c3){if(_0x1524c3&&_0x1524c3[_0xeabc('0x4e')]===0x0){return db[_0xeabc('0x29')][_0xeabc('0x48')]({'name':_0x568847[_0xeabc('0x2d')],'resourceId':_0x568847['id'],'type':_0xeabc('0x28'),'sectionId':_0x1524c3['id']},{})[_0xeabc('0x26')](function(){return _0x305946;});}else{return _0x305946;}})['catch'](function(_0x180a14){logger[_0xeabc('0x2b')](_0xeabc('0x4f'),_0x180a14);throw _0x180a14;});}return _0x305946;})[_0xeabc('0x26')](respondWithResult(_0x32e09b,0xc9))['catch'](handleError(_0x32e09b,null));};exports[_0xeabc('0x25')]=function(_0x392913,_0x10d56f){if(_0x392913[_0xeabc('0x49')]['id']){delete _0x392913['body']['id'];}return db[_0xeabc('0x31')][_0xeabc('0x46')]({'where':{'id':_0x392913[_0xeabc('0x50')]['id']}})[_0xeabc('0x26')](handleEntityNotFound(_0x10d56f,null))[_0xeabc('0x26')](saveUpdates(_0x392913[_0xeabc('0x49')],null))[_0xeabc('0x26')](respondWithResult(_0x10d56f,null))[_0xeabc('0x47')](handleError(_0x10d56f,null));};exports[_0xeabc('0x2a')]=function(_0x58ab08,_0x4546c4){return db['AnalyticDefaultReport']['find']({'where':{'id':_0x58ab08['params']['id']}})[_0xeabc('0x26')](handleEntityNotFound(_0x4546c4,null))[_0xeabc('0x26')](removeEntity(_0x4546c4,null))[_0xeabc('0x47')](handleError(_0x4546c4,null));};exports[_0xeabc('0x51')]=function(_0xe89728,_0x2f78f3){var _0x4a2ad6=0xa;var _0x4358d7=[_0xeabc('0x52'),_0xeabc('0x53'),_0xeabc('0x54'),_0xeabc('0x55')];var _0x2c7b4e={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xeabc('0x58'),'AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x536f42={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':_0xeabc('0x5e'),'UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x26c784=function(_0xc2ef0c){return!_['includes']([_0xeabc('0x60'),_0xeabc('0x61'),_0xeabc('0x62'),_0xeabc('0x63')],_0xc2ef0c);};var _0x11cc1f=function(_0x514787){if(!_0x514787||!_0x514787['rules'][_0xeabc('0x3c')]){return'';}for(var _0x7b659f='(',_0x1b6675=0x0;_0x1b6675<_0x514787[_0xeabc('0x64')][_0xeabc('0x3c')];_0x1b6675+=0x1){_0x1b6675>0x0&&(_0x7b659f+='\x20'+_0x514787[_0xeabc('0x65')]+'\x20');_0x7b659f+=_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x66')]?_0x11cc1f(_0x514787[_0xeabc('0x64')][_0x1b6675]['group']):_0x514787[_0xeabc('0x64')][_0x1b6675]['field']+'\x20'+_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x67')]+(_0x26c784(_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x67')])?'\x20'+_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x68')]:'');}return _0x7b659f+')';};var _0xf48062={'where':{'id':_0xe89728[_0xeabc('0x50')]['id']}},_0xb59a2a,_0x5d4bc2,_0x24d0e5,_0x5702cb,_0x3fa31b;_0xf48062=_[_0xeabc('0x40')]({},_0xf48062,_0xe89728[_0xeabc('0x45')]);return db['AnalyticDefaultReport'][_0xeabc('0x46')](_0xf48062)['then'](function(_0x54e7d6){if(_0x54e7d6){_0xb59a2a=_0x54e7d6;return _0x54e7d6[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x23270a){if(_0x23270a){if(!_0x23270a[_0xeabc('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0xeabc('0x6a'),0x193);}_0x5d4bc2=_0x23270a;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xeabc('0x26')](function(_0x4f1a4f){if(_0x4f1a4f){_0x24d0e5=_['keyBy'](_0x4f1a4f,'id');var _0xa44f2d;var _0x1c84b5=squel['select']();_0x1c84b5['from'](_0xb59a2a[_0xeabc('0x6b')]);for(var _0x5d183a=0x0;_0x5d183a<_0x5d4bc2[_0xeabc('0x3c')];_0x5d183a+=0x1){_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x6c')]?_0x24d0e5[_0x5d4bc2[_0x5d183a]['MetricId']]['metric']:_0x5d4bc2[_0x5d183a][_0xeabc('0x6d')];_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x6e')]?_[_0xeabc('0x6f')](_0x2c7b4e[_0x5d4bc2[_0x5d183a][_0xeabc('0x6e')]],'%s',_0xa44f2d):_0xa44f2d;_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x70')]?_['replace'](_0x536f42[_0x5d4bc2[_0x5d183a]['format']],'%s',_0xa44f2d):_0xa44f2d;if(_0x5d4bc2[_0x5d183a][_0xeabc('0x71')]){_0x1c84b5['group'](_0xa44f2d);}_0x5d4bc2[_0x5d183a][_0xeabc('0x72')]&&_0x1c84b5['order'](_0xa44f2d,_0x5d4bc2[_0x5d183a][_0xeabc('0x72')]==='DESC'?![]:!![]);_0x1c84b5[_0xeabc('0x6d')](_0xa44f2d,_0x5d4bc2[_0x5d183a]['alias']||_0xa44f2d);}if(_0xb59a2a[_0xeabc('0x73')]){_0xb59a2a[_0xeabc('0x73')]=JSON[_0xeabc('0x74')](_0xb59a2a[_0xeabc('0x73')]);for(var _0x5e121c=0x0;_0x5e121c<_0xb59a2a[_0xeabc('0x73')]['length'];_0x5e121c+=0x1){if(_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')]&&_[_0xeabc('0x75')](_0x4358d7,_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')])&&_0xb59a2a['joins'][_0x5e121c][_0xeabc('0x76')]&&_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x77')]&&_0xb59a2a[_0xeabc('0x73')][_0x5e121c]['foreignKey']){_0x1c84b5[_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')]](_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x77')],null,util['format'](_0xeabc('0x78'),_0xb59a2a[_0xeabc('0x6b')],_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x76')],_0xb59a2a['joins'][_0x5e121c]['foreignTable'],_0xb59a2a[_0xeabc('0x73')][_0x5e121c]['foreignKey']));}}}if(_0xb59a2a['conditions']){_0xb59a2a[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0xb59a2a[_0xeabc('0x79')]);_0x1c84b5['where'](_0x11cc1f(_0xb59a2a[_0xeabc('0x79')][_0xeabc('0x66')]));}_0x3fa31b=_0x1c84b5['clone']();_0x1c84b5[_0xeabc('0x1e')](_0x4a2ad6);_0x1c84b5[_0xeabc('0x1d')](0x0);logger[_0xeabc('0x7a')](_0xeabc('0x7b'),_0x1c84b5[_0xeabc('0x7c')]());return dbH['sequelize'][_0xeabc('0x36')](_0x1c84b5['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0xeabc('0x7d')]});}})[_0xeabc('0x26')](respondWithResult(_0x2f78f3,null))[_0xeabc('0x47')](handleError(_0x2f78f3,null));};function runReport(_0x4424ce,_0x33fa74,_0x51368f){var _0x39f961=_0x33fa74['name'];var _0x1795fe=0xa;var _0x2f95c7=['join',_0xeabc('0x53'),'right_join','cross_join'];var _0x952dc7={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':_0xeabc('0x7e'),'MAX':_0xeabc('0x7f'),'MIN':'MIN(%s)','AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':_0xeabc('0x80'),'GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x348064={'SEC_TO_TIME':_0xeabc('0x81'),'DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':_0xeabc('0x5e'),'UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x522c6e=function(_0x436f8e){return!_[_0xeabc('0x75')]([_0xeabc('0x60'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0xeabc('0x63')],_0x436f8e);};var _0x273ca5=function(_0xe90200){if(!_0xe90200||!_0xe90200[_0xeabc('0x64')][_0xeabc('0x3c')]){return'';}for(var _0x5f5a47='(',_0x289f98=0x0;_0x289f98<_0xe90200['rules']['length'];_0x289f98+=0x1){_0x289f98>0x0&&(_0x5f5a47+='\x20'+_0xe90200[_0xeabc('0x65')]+'\x20');_0x5f5a47+=_0xe90200[_0xeabc('0x64')][_0x289f98]['group']?_0x273ca5(_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x66')]):_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x6d')]+'\x20'+_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x67')]+(_0x522c6e(_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x67')])?'\x20'+_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x68')]:'');}return _0x5f5a47+')';};var _0x1f8197={'where':{'id':_0x4424ce['id']}},_0x485c13,_0xb54c35,_0x5c9d6f,_0x1caaa7,_0x3e764a;_0x1f8197=_[_0xeabc('0x40')]({},_0x1f8197,_0x51368f);return db[_0xeabc('0x31')][_0xeabc('0x46')](_0x1f8197)[_0xeabc('0x26')](function(_0x40f51e){if(_0x40f51e){_0x485c13=_0x40f51e;return _0x40f51e[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x156e20){if(_0x156e20){if(!_0x156e20[_0xeabc('0x3c')]){throw new db['Sequelize'][(_0xeabc('0x82'))](_0xeabc('0x6a'),0x193);}_0xb54c35=_0x156e20;return db[_0xeabc('0x83')][_0xeabc('0x42')]({'raw':!![]});}return null;})['then'](function(_0x26c595){if(_0x26c595){_0x5c9d6f=_[_0xeabc('0x84')](_0x26c595,'id');var _0x580661;var _0x3de927=squel[_0xeabc('0x85')]();_0x3de927['from'](_0x485c13['table']);for(var _0x489b1d=0x0;_0x489b1d<_0xb54c35['length'];_0x489b1d+=0x1){_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x6c')]?_0x5c9d6f[_0xb54c35[_0x489b1d][_0xeabc('0x6c')]][_0xeabc('0x86')]:_0xb54c35[_0x489b1d][_0xeabc('0x6d')];_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x6e')]?_[_0xeabc('0x6f')](_0x952dc7[_0xb54c35[_0x489b1d][_0xeabc('0x6e')]],'%s',_0x580661):_0x580661;_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x70')]?_[_0xeabc('0x6f')](_0x348064[_0xb54c35[_0x489b1d][_0xeabc('0x70')]],'%s',_0x580661):_0x580661;if(_0xb54c35[_0x489b1d]['groupBy']){_0x3de927[_0xeabc('0x66')](_0x580661);}_0xb54c35[_0x489b1d][_0xeabc('0x72')]&&_0x3de927['order'](_0x580661,_0xb54c35[_0x489b1d][_0xeabc('0x72')]===_0xeabc('0x87')?![]:!![]);_0x3de927[_0xeabc('0x6d')](_0x580661,_0xb54c35[_0x489b1d]['alias']||_0x580661);}if(_0x485c13[_0xeabc('0x73')]){_0x485c13['joins']=JSON[_0xeabc('0x74')](_0x485c13[_0xeabc('0x73')]);for(var _0x1841f0=0x0;_0x1841f0<_0x485c13[_0xeabc('0x73')][_0xeabc('0x3c')];_0x1841f0+=0x1){if(_0x485c13['joins'][_0x1841f0]['type']&&_['includes'](_0x2f95c7,_0x485c13['joins'][_0x1841f0][_0xeabc('0x33')])&&_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x76')]&&_0x485c13['joins'][_0x1841f0][_0xeabc('0x77')]&&_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x88')]){_0x3de927[_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x33')]](_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x77')],null,util[_0xeabc('0x70')](_0xeabc('0x78'),_0x485c13[_0xeabc('0x6b')],_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x76')],_0x485c13['joins'][_0x1841f0]['foreignTable'],_0x485c13[_0xeabc('0x73')][_0x1841f0]['foreignKey']));}}}if(_0x485c13[_0xeabc('0x79')]){_0x485c13[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0x485c13['conditions']);_0x3de927[_0xeabc('0x41')](_0x273ca5(_0x485c13[_0xeabc('0x79')][_0xeabc('0x66')]));}_0x3e764a=_0x3de927['clone']();_0x3de927['limit'](_0x1795fe);_0x3de927[_0xeabc('0x1d')](0x0);return;}})[_0xeabc('0x26')](function(){if(_0x33fa74[_0xeabc('0x89')]===_0xeabc('0x8a')){return null;}var _0x2cc9b3=_[_0xeabc('0x40')](_0x33fa74,{'name':_0x33fa74['fullPath']||_0x33fa74['name']||_0x485c13[_0xeabc('0x2d')],'basename':_0x39f961,'savename':util[_0xeabc('0x70')](_0xeabc('0x8b'),_0x33fa74[_0xeabc('0x2d')]||_0x485c13['name'],require('randomstring')['generate'](0x4),_0x33fa74[_0xeabc('0x89')]||'csv'),'reportId':_0x485c13['id'],'reportType':_0xeabc('0x8c')});return db['AnalyticExtractedReport'][_0xeabc('0x48')](_0x2cc9b3,{'raw':!![]});})['then'](function(_0x6e6ab2){if(_0x485c13[_0xeabc('0x6b')]===_0xeabc('0x8d')){_0x3e764a[_0xeabc('0x41')](_0x485c13[_0xeabc('0x6b')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x33fa74[_0xeabc('0x8e')],_0x33fa74[_0xeabc('0x8f')]);}else{_0x3e764a[_0xeabc('0x41')](_0x485c13['table']+_0xeabc('0x90'),_0x33fa74[_0xeabc('0x8e')],_0x33fa74[_0xeabc('0x8f')]);}if(_0x6e6ab2){logger[_0xeabc('0x91')](_0xeabc('0x92'),_0x3e764a['toString']());require(_0xeabc('0x93'))[_0xeabc('0x94')](path['join'](__dirname,_0xeabc('0x95'),_0x6e6ab2[_0xeabc('0x89')]),[_0x6e6ab2['id'],_0x3e764a['toString'](),path[_0xeabc('0x52')](__dirname,_0xeabc('0x96'),_0x6e6ab2[_0xeabc('0x97')]),_0x39f961]);return _0x6e6ab2;}else{var _0x307d26=squel[_0xeabc('0x85')]();_0x307d26[_0xeabc('0x98')]('('+_0x3e764a[_0xeabc('0x7c')]()+')',_0xeabc('0x99'));_0x307d26[_0xeabc('0x6d')](_0xeabc('0x9a'),_0xeabc('0x20'));_0x3e764a[_0xeabc('0x1e')](_0x33fa74[_0xeabc('0x1e')]||_0x1795fe);_0x3e764a['offset'](_0x33fa74['offset']||0x0);return dbH[_0xeabc('0x9b')][_0xeabc('0x36')](_0x307d26[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')]['QueryTypes'][_0xeabc('0x7d')]})['then'](function(_0x49fba2){if(!_0x49fba2['length']){_0x1caaa7=0x0;}else{_0x1caaa7=_0x49fba2[0x0]['count']||0x0;}return dbH['sequelize']['query'](_0x3e764a[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')][_0xeabc('0x9c')][_0xeabc('0x7d')]});})[_0xeabc('0x26')](function(_0xe27492){return{'rows':_0xe27492||[],'count':_0x1caaa7};});}});}exports[_0xeabc('0x9d')]=function(_0x3eaedf,_0x44dc85){return runReport(_0x3eaedf['params'],_0x3eaedf[_0xeabc('0x36')],_0x3eaedf[_0xeabc('0x45')])[_0xeabc('0x26')](respondWithResult(_0x44dc85,null))[_0xeabc('0x47')](handleError(_0x44dc85,null));};exports[_0xeabc('0x9e')]=runReport;exports[_0xeabc('0x36')]=function(_0x2a29d7,_0x5bb5d6){var _0x3513ce=0xa;var _0x58cb5d=[_0xeabc('0x52'),_0xeabc('0x53'),'right_join',_0xeabc('0x55')];var _0x4c8bf3={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':_0xeabc('0x7e'),'MAX':_0xeabc('0x7f'),'MIN':_0xeabc('0x58'),'AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':_0xeabc('0x80'),'GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x484c75={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x580f72=function(_0x37907a){return!_[_0xeabc('0x75')]([_0xeabc('0x60'),_0xeabc('0x61'),_0xeabc('0x62'),_0xeabc('0x63')],_0x37907a);};var _0x57db6d=function(_0x13cc55){if(!_0x13cc55||!_0x13cc55['rules'][_0xeabc('0x3c')]){return'';}for(var _0x43b88e='(',_0x1fa464=0x0;_0x1fa464<_0x13cc55[_0xeabc('0x64')]['length'];_0x1fa464+=0x1){_0x1fa464>0x0&&(_0x43b88e+='\x20'+_0x13cc55[_0xeabc('0x65')]+'\x20');_0x43b88e+=_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x66')]?_0x57db6d(_0x13cc55['rules'][_0x1fa464][_0xeabc('0x66')]):_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x6d')]+'\x20'+_0x13cc55['rules'][_0x1fa464]['condition']+(_0x580f72(_0x13cc55['rules'][_0x1fa464]['condition'])?'\x20'+_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x68')]:'');}return _0x43b88e+')';};var _0x52e84f={'where':{'id':_0x2a29d7[_0xeabc('0x50')]['id']}},_0x12f024,_0x1d35da,_0x2695a4,_0x199251,_0x1899d6;_0x52e84f=_[_0xeabc('0x40')]({},_0x52e84f,_0x2a29d7[_0xeabc('0x45')]);return db[_0xeabc('0x31')]['find'](_0x52e84f)[_0xeabc('0x26')](function(_0x5bb015){if(_0x5bb015){_0x12f024=_0x5bb015;return _0x5bb015[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x438ce3){if(_0x438ce3){if(!_0x438ce3[_0xeabc('0x3c')]){throw new db[(_0xeabc('0x9f'))][(_0xeabc('0x82'))](_0xeabc('0x6a'),0x193);}_0x1d35da=_0x438ce3;return db['AnalyticMetric'][_0xeabc('0x42')]({'raw':!![]});}return null;})['then'](function(_0x475160){if(_0x475160){_0x2695a4=_['keyBy'](_0x475160,'id');var _0x10d66b;var _0x12a042=squel[_0xeabc('0x85')]();_0x12a042[_0xeabc('0x98')](_0x12f024[_0xeabc('0x6b')]);for(var _0x49bf0f=0x0;_0x49bf0f<_0x1d35da[_0xeabc('0x3c')];_0x49bf0f+=0x1){_0x10d66b=_0x1d35da[_0x49bf0f][_0xeabc('0x6c')]?_0x2695a4[_0x1d35da[_0x49bf0f][_0xeabc('0x6c')]][_0xeabc('0x86')]:_0x1d35da[_0x49bf0f][_0xeabc('0x6d')];_0x10d66b=_0x1d35da[_0x49bf0f]['function']?_[_0xeabc('0x6f')](_0x4c8bf3[_0x1d35da[_0x49bf0f][_0xeabc('0x6e')]],'%s',_0x10d66b):_0x10d66b;_0x10d66b=_0x1d35da[_0x49bf0f][_0xeabc('0x70')]?_[_0xeabc('0x6f')](_0x484c75[_0x1d35da[_0x49bf0f][_0xeabc('0x70')]],'%s',_0x10d66b):_0x10d66b;if(_0x1d35da[_0x49bf0f]['groupBy']){_0x12a042[_0xeabc('0x66')](_0x10d66b);}_0x1d35da[_0x49bf0f]['orderBy']&&_0x12a042[_0xeabc('0x3e')](_0x10d66b,_0x1d35da[_0x49bf0f][_0xeabc('0x72')]===_0xeabc('0x87')?![]:!![]);_0x12a042[_0xeabc('0x6d')](_0x10d66b,_0x1d35da[_0x49bf0f][_0xeabc('0xa0')]||_0x10d66b);}if(_0x12f024[_0xeabc('0x73')]){_0x12f024[_0xeabc('0x73')]=JSON[_0xeabc('0x74')](_0x12f024[_0xeabc('0x73')]);for(var _0x223a3=0x0;_0x223a3<_0x12f024['joins'][_0xeabc('0x3c')];_0x223a3+=0x1){if(_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x33')]&&_[_0xeabc('0x75')](_0x58cb5d,_0x12f024['joins'][_0x223a3][_0xeabc('0x33')])&&_0x12f024['joins'][_0x223a3]['parentKey']&&_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x77')]&&_0x12f024[_0xeabc('0x73')][_0x223a3]['foreignKey']){_0x12a042[_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x33')]](_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x77')],null,util[_0xeabc('0x70')]('%s.%s\x20=\x20%s.%s',_0x12f024[_0xeabc('0x6b')],_0x12f024[_0xeabc('0x73')][_0x223a3]['parentKey'],_0x12f024['joins'][_0x223a3][_0xeabc('0x77')],_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x88')]));}}}if(_0x12f024[_0xeabc('0x79')]){_0x12f024[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0x12f024[_0xeabc('0x79')]);_0x12a042[_0xeabc('0x41')](_0x57db6d(_0x12f024[_0xeabc('0x79')]['group']));}_0x1899d6=_0x12a042[_0xeabc('0xa1')]();_0x12a042['limit'](_0x3513ce);_0x12a042[_0xeabc('0x1d')](0x0);logger['debug'](_0xeabc('0x7b'),_0x12a042[_0xeabc('0x7c')]());return dbH[_0xeabc('0x9b')][_0xeabc('0x36')](_0x12a042[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')][_0xeabc('0x9c')][_0xeabc('0x7d')]});}})[_0xeabc('0x26')](function(){return{'sql':_0x1899d6[_0xeabc('0x7c')]()};})['then'](respondWithResult(_0x5bb5d6,null))['catch'](handleError(_0x5bb5d6,null));}; \ No newline at end of file +var _0xabce=['where','findAll','show','includeAll','options','find','catch','create','body','user','role','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','table','MetricId','field','function','replace','format','groupBy','orderBy','joins','parse','includes','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','SELECT','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','ValidationErrorItem','AnalyticMetric','keyBy','select','metric','DESC','foreignKey','output','web','%s-%s.%s','default','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','from','countTable','COUNT(*)','sequelize','QueryTypes','run','runReport','Sequelize','alias','clone','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','limit','undefined','count','set','json','apply','save','update','then','get','DefaultReports','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','filter','merge'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabce,0x103));var _0xeabc=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0xabce[_0x3826ad];return _0x17b900;};'use strict';var emlformat=require(_0xeabc('0x0'));var rimraf=require(_0xeabc('0x1'));var zipdir=require(_0xeabc('0x2'));var jsonpatch=require(_0xeabc('0x3'));var rp=require(_0xeabc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeabc('0x5'));var util=require(_0xeabc('0x6'));var path=require(_0xeabc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeabc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];var dbH=require(_0xeabc('0x19'))[_0xeabc('0x1a')];function respondWithStatusCode(_0xcfbf06,_0x53df9c){_0x53df9c=_0x53df9c||0xcc;return function(_0x235c2d){if(_0x235c2d){return _0xcfbf06[_0xeabc('0x1b')](_0x53df9c);}return _0xcfbf06[_0xeabc('0x1c')](_0x53df9c)['end']();};}function respondWithResult(_0x5f4ee8,_0x3170ea){_0x3170ea=_0x3170ea||0xc8;return function(_0x3ae954){if(_0x3ae954){return _0x5f4ee8[_0xeabc('0x1c')](_0x3170ea)['json'](_0x3ae954);}};}function respondWithFilteredResult(_0xf913d7,_0x638976){return function(_0x49f2d8){if(_0x49f2d8){var _0x53fe28=typeof _0x638976[_0xeabc('0x1d')]==='undefined'&&typeof _0x638976[_0xeabc('0x1e')]===_0xeabc('0x1f');var _0x58a3c0=_0x49f2d8[_0xeabc('0x20')];var _0x31dd53=_0x53fe28?0x0:_0x638976[_0xeabc('0x1d')];var _0x384be5=_0x53fe28?_0x49f2d8[_0xeabc('0x20')]:_0x638976['offset']+_0x638976[_0xeabc('0x1e')];var _0x4d68ea;if(_0x384be5>=_0x58a3c0){_0x384be5=_0x58a3c0;_0x4d68ea=0xc8;}else{_0x4d68ea=0xce;}_0xf913d7[_0xeabc('0x1c')](_0x4d68ea);return _0xf913d7[_0xeabc('0x21')]('Content-Range',_0x31dd53+'-'+_0x384be5+'/'+_0x58a3c0)[_0xeabc('0x22')](_0x49f2d8);}return null;};}function patchUpdates(_0x41d67a){return function(_0x254590){try{jsonpatch[_0xeabc('0x23')](_0x254590,_0x41d67a,!![]);}catch(_0x3c9611){return BPromise['reject'](_0x3c9611);}return _0x254590[_0xeabc('0x24')]();};}function saveUpdates(_0x10c675,_0x91ab00){return function(_0x5bdd57){if(_0x5bdd57){return _0x5bdd57[_0xeabc('0x25')](_0x10c675)[_0xeabc('0x26')](function(_0x214953){return _0x214953;});}return null;};}function removeEntity(_0x319119,_0x5b8838){return function(_0x109e1d){if(_0x109e1d){return _0x109e1d['destroy']()[_0xeabc('0x26')](function(){var _0x4d4e29=_0x109e1d[_0xeabc('0x27')]({'plain':!![]});var _0x12acbd=_0xeabc('0x28');return db[_0xeabc('0x29')][_0xeabc('0x2a')]({'where':{'type':_0x12acbd,'resourceId':_0x4d4e29['id']}})[_0xeabc('0x26')](function(){return _0x109e1d;});})[_0xeabc('0x26')](function(){_0x319119['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x459c8a,_0x5bf8f2){return function(_0x3c1b5b){if(!_0x3c1b5b){_0x459c8a[_0xeabc('0x1b')](0x194);}return _0x3c1b5b;};}function handleError(_0x48fb52,_0x2163e6){_0x2163e6=_0x2163e6||0x1f4;return function(_0x38572d){logger[_0xeabc('0x2b')](_0x38572d[_0xeabc('0x2c')]);if(_0x38572d[_0xeabc('0x2d')]){delete _0x38572d[_0xeabc('0x2d')];}_0x48fb52[_0xeabc('0x1c')](_0x2163e6)[_0xeabc('0x2e')](_0x38572d);};}exports[_0xeabc('0x2f')]=function(_0x5ebb86,_0x5b34dd){var _0x5bb1f1={},_0x2f03e8={},_0x2d027e={'count':0x0,'rows':[]};var _0x98b445=_[_0xeabc('0x30')](db[_0xeabc('0x31')][_0xeabc('0x32')],function(_0x61c0af){return{'name':_0x61c0af['fieldName'],'type':_0x61c0af[_0xeabc('0x33')][_0xeabc('0x34')]};});_0x2f03e8[_0xeabc('0x35')]=_['map'](_0x98b445,_0xeabc('0x2d'));_0x2f03e8[_0xeabc('0x36')]=_[_0xeabc('0x37')](_0x5ebb86['query']);_0x2f03e8[_0xeabc('0x38')]=_[_0xeabc('0x39')](_0x2f03e8[_0xeabc('0x35')],_0x2f03e8['query']);_0x5bb1f1[_0xeabc('0x3a')]=_[_0xeabc('0x39')](_0x2f03e8['model'],qs['fields'](_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x3b')]));_0x5bb1f1['attributes']=_0x5bb1f1[_0xeabc('0x3a')][_0xeabc('0x3c')]?_0x5bb1f1[_0xeabc('0x3a')]:_0x2f03e8[_0xeabc('0x35')];if(!_0x5ebb86[_0xeabc('0x36')]['hasOwnProperty'](_0xeabc('0x3d'))){_0x5bb1f1['limit']=qs[_0xeabc('0x1e')](_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x1e')]);_0x5bb1f1['offset']=qs['offset'](_0x5ebb86[_0xeabc('0x36')]['offset']);}_0x5bb1f1[_0xeabc('0x3e')]=qs['sort'](_0x5ebb86['query']['sort']);_0x5bb1f1['where']=qs[_0xeabc('0x38')](_['pick'](_0x5ebb86[_0xeabc('0x36')],_0x2f03e8[_0xeabc('0x38')]),_0x98b445);if(_0x5ebb86['query'][_0xeabc('0x3f')]){_0x5bb1f1['where']=_[_0xeabc('0x40')](_0x5bb1f1['where'],{'$or':_[_0xeabc('0x30')](_0x98b445,function(_0xf1b7ef){if(_0xf1b7ef[_0xeabc('0x33')]!=='VIRTUAL'){var _0x5a00d0={};_0x5a00d0[_0xf1b7ef['name']]={'$like':'%'+_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x3f')]+'%'};return _0x5a00d0;}})});}_0x5bb1f1=_[_0xeabc('0x40')]({},_0x5bb1f1,_0x5ebb86['options']);var _0x4f1897={'where':_0x5bb1f1[_0xeabc('0x41')]};return db[_0xeabc('0x31')]['count'](_0x4f1897)[_0xeabc('0x26')](function(_0x5e0b78){_0x2d027e[_0xeabc('0x20')]=_0x5e0b78;if(_0x5ebb86['query']['includeAll']){_0x5bb1f1['include']=[{'all':!![]}];}return db[_0xeabc('0x31')][_0xeabc('0x42')](_0x5bb1f1);})[_0xeabc('0x26')](function(_0x3eeeb5){_0x2d027e['rows']=_0x3eeeb5;return _0x2d027e;})[_0xeabc('0x26')](respondWithFilteredResult(_0x5b34dd,_0x5bb1f1))['catch'](handleError(_0x5b34dd,null));};exports[_0xeabc('0x43')]=function(_0x1a4bbe,_0x3a7807){var _0x17a0df={'raw':!![],'where':{'id':_0x1a4bbe['params']['id']}},_0xc849c9={};_0xc849c9['model']=_[_0xeabc('0x37')](db['AnalyticDefaultReport'][_0xeabc('0x32')]);_0xc849c9[_0xeabc('0x36')]=_['keys'](_0x1a4bbe[_0xeabc('0x36')]);_0xc849c9[_0xeabc('0x38')]=_[_0xeabc('0x39')](_0xc849c9[_0xeabc('0x35')],_0xc849c9[_0xeabc('0x36')]);_0x17a0df[_0xeabc('0x3a')]=_[_0xeabc('0x39')](_0xc849c9['model'],qs[_0xeabc('0x3b')](_0x1a4bbe[_0xeabc('0x36')][_0xeabc('0x3b')]));_0x17a0df[_0xeabc('0x3a')]=_0x17a0df[_0xeabc('0x3a')][_0xeabc('0x3c')]?_0x17a0df[_0xeabc('0x3a')]:_0xc849c9[_0xeabc('0x35')];if(_0x1a4bbe[_0xeabc('0x36')][_0xeabc('0x44')]){_0x17a0df['include']=[{'all':!![]}];}_0x17a0df=_[_0xeabc('0x40')]({},_0x17a0df,_0x1a4bbe[_0xeabc('0x45')]);return db[_0xeabc('0x31')][_0xeabc('0x46')](_0x17a0df)[_0xeabc('0x26')](handleEntityNotFound(_0x3a7807,null))[_0xeabc('0x26')](respondWithResult(_0x3a7807,null))[_0xeabc('0x47')](handleError(_0x3a7807,null));};exports['create']=function(_0x766743,_0x32e09b){return db[_0xeabc('0x31')][_0xeabc('0x48')](_0x766743[_0xeabc('0x49')],{})['then'](function(_0x305946){var _0x2b2b9c=_0x766743[_0xeabc('0x4a')][_0xeabc('0x27')]({'plain':!![]});if(!_0x2b2b9c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b2b9c[_0xeabc('0x4b')]===_0xeabc('0x4a')){var _0x568847=_0x305946[_0xeabc('0x27')]({'plain':!![]});var _0x5a0d4d=_0xeabc('0x4c');return db['UserProfileSection'][_0xeabc('0x46')]({'where':{'name':_0x5a0d4d,'userProfileId':_0x2b2b9c[_0xeabc('0x4d')]},'raw':!![]})[_0xeabc('0x26')](function(_0x1524c3){if(_0x1524c3&&_0x1524c3[_0xeabc('0x4e')]===0x0){return db[_0xeabc('0x29')][_0xeabc('0x48')]({'name':_0x568847[_0xeabc('0x2d')],'resourceId':_0x568847['id'],'type':_0xeabc('0x28'),'sectionId':_0x1524c3['id']},{})[_0xeabc('0x26')](function(){return _0x305946;});}else{return _0x305946;}})['catch'](function(_0x180a14){logger[_0xeabc('0x2b')](_0xeabc('0x4f'),_0x180a14);throw _0x180a14;});}return _0x305946;})[_0xeabc('0x26')](respondWithResult(_0x32e09b,0xc9))['catch'](handleError(_0x32e09b,null));};exports[_0xeabc('0x25')]=function(_0x392913,_0x10d56f){if(_0x392913[_0xeabc('0x49')]['id']){delete _0x392913['body']['id'];}return db[_0xeabc('0x31')][_0xeabc('0x46')]({'where':{'id':_0x392913[_0xeabc('0x50')]['id']}})[_0xeabc('0x26')](handleEntityNotFound(_0x10d56f,null))[_0xeabc('0x26')](saveUpdates(_0x392913[_0xeabc('0x49')],null))[_0xeabc('0x26')](respondWithResult(_0x10d56f,null))[_0xeabc('0x47')](handleError(_0x10d56f,null));};exports[_0xeabc('0x2a')]=function(_0x58ab08,_0x4546c4){return db['AnalyticDefaultReport']['find']({'where':{'id':_0x58ab08['params']['id']}})[_0xeabc('0x26')](handleEntityNotFound(_0x4546c4,null))[_0xeabc('0x26')](removeEntity(_0x4546c4,null))[_0xeabc('0x47')](handleError(_0x4546c4,null));};exports[_0xeabc('0x51')]=function(_0xe89728,_0x2f78f3){var _0x4a2ad6=0xa;var _0x4358d7=[_0xeabc('0x52'),_0xeabc('0x53'),_0xeabc('0x54'),_0xeabc('0x55')];var _0x2c7b4e={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xeabc('0x58'),'AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x536f42={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':_0xeabc('0x5e'),'UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x26c784=function(_0xc2ef0c){return!_['includes']([_0xeabc('0x60'),_0xeabc('0x61'),_0xeabc('0x62'),_0xeabc('0x63')],_0xc2ef0c);};var _0x11cc1f=function(_0x514787){if(!_0x514787||!_0x514787['rules'][_0xeabc('0x3c')]){return'';}for(var _0x7b659f='(',_0x1b6675=0x0;_0x1b6675<_0x514787[_0xeabc('0x64')][_0xeabc('0x3c')];_0x1b6675+=0x1){_0x1b6675>0x0&&(_0x7b659f+='\x20'+_0x514787[_0xeabc('0x65')]+'\x20');_0x7b659f+=_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x66')]?_0x11cc1f(_0x514787[_0xeabc('0x64')][_0x1b6675]['group']):_0x514787[_0xeabc('0x64')][_0x1b6675]['field']+'\x20'+_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x67')]+(_0x26c784(_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x67')])?'\x20'+_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x68')]:'');}return _0x7b659f+')';};var _0xf48062={'where':{'id':_0xe89728[_0xeabc('0x50')]['id']}},_0xb59a2a,_0x5d4bc2,_0x24d0e5,_0x5702cb,_0x3fa31b;_0xf48062=_[_0xeabc('0x40')]({},_0xf48062,_0xe89728[_0xeabc('0x45')]);return db['AnalyticDefaultReport'][_0xeabc('0x46')](_0xf48062)['then'](function(_0x54e7d6){if(_0x54e7d6){_0xb59a2a=_0x54e7d6;return _0x54e7d6[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x23270a){if(_0x23270a){if(!_0x23270a[_0xeabc('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0xeabc('0x6a'),0x193);}_0x5d4bc2=_0x23270a;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xeabc('0x26')](function(_0x4f1a4f){if(_0x4f1a4f){_0x24d0e5=_['keyBy'](_0x4f1a4f,'id');var _0xa44f2d;var _0x1c84b5=squel['select']();_0x1c84b5['from'](_0xb59a2a[_0xeabc('0x6b')]);for(var _0x5d183a=0x0;_0x5d183a<_0x5d4bc2[_0xeabc('0x3c')];_0x5d183a+=0x1){_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x6c')]?_0x24d0e5[_0x5d4bc2[_0x5d183a]['MetricId']]['metric']:_0x5d4bc2[_0x5d183a][_0xeabc('0x6d')];_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x6e')]?_[_0xeabc('0x6f')](_0x2c7b4e[_0x5d4bc2[_0x5d183a][_0xeabc('0x6e')]],'%s',_0xa44f2d):_0xa44f2d;_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x70')]?_['replace'](_0x536f42[_0x5d4bc2[_0x5d183a]['format']],'%s',_0xa44f2d):_0xa44f2d;if(_0x5d4bc2[_0x5d183a][_0xeabc('0x71')]){_0x1c84b5['group'](_0xa44f2d);}_0x5d4bc2[_0x5d183a][_0xeabc('0x72')]&&_0x1c84b5['order'](_0xa44f2d,_0x5d4bc2[_0x5d183a][_0xeabc('0x72')]==='DESC'?![]:!![]);_0x1c84b5[_0xeabc('0x6d')](_0xa44f2d,_0x5d4bc2[_0x5d183a]['alias']||_0xa44f2d);}if(_0xb59a2a[_0xeabc('0x73')]){_0xb59a2a[_0xeabc('0x73')]=JSON[_0xeabc('0x74')](_0xb59a2a[_0xeabc('0x73')]);for(var _0x5e121c=0x0;_0x5e121c<_0xb59a2a[_0xeabc('0x73')]['length'];_0x5e121c+=0x1){if(_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')]&&_[_0xeabc('0x75')](_0x4358d7,_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')])&&_0xb59a2a['joins'][_0x5e121c][_0xeabc('0x76')]&&_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x77')]&&_0xb59a2a[_0xeabc('0x73')][_0x5e121c]['foreignKey']){_0x1c84b5[_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')]](_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x77')],null,util['format'](_0xeabc('0x78'),_0xb59a2a[_0xeabc('0x6b')],_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x76')],_0xb59a2a['joins'][_0x5e121c]['foreignTable'],_0xb59a2a[_0xeabc('0x73')][_0x5e121c]['foreignKey']));}}}if(_0xb59a2a['conditions']){_0xb59a2a[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0xb59a2a[_0xeabc('0x79')]);_0x1c84b5['where'](_0x11cc1f(_0xb59a2a[_0xeabc('0x79')][_0xeabc('0x66')]));}_0x3fa31b=_0x1c84b5['clone']();_0x1c84b5[_0xeabc('0x1e')](_0x4a2ad6);_0x1c84b5[_0xeabc('0x1d')](0x0);logger[_0xeabc('0x7a')](_0xeabc('0x7b'),_0x1c84b5[_0xeabc('0x7c')]());return dbH['sequelize'][_0xeabc('0x36')](_0x1c84b5['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0xeabc('0x7d')]});}})[_0xeabc('0x26')](respondWithResult(_0x2f78f3,null))[_0xeabc('0x47')](handleError(_0x2f78f3,null));};function runReport(_0x4424ce,_0x33fa74,_0x51368f){var _0x39f961=_0x33fa74['name'];var _0x1795fe=0xa;var _0x2f95c7=['join',_0xeabc('0x53'),'right_join','cross_join'];var _0x952dc7={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':_0xeabc('0x7e'),'MAX':_0xeabc('0x7f'),'MIN':'MIN(%s)','AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':_0xeabc('0x80'),'GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x348064={'SEC_TO_TIME':_0xeabc('0x81'),'DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':_0xeabc('0x5e'),'UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x522c6e=function(_0x436f8e){return!_[_0xeabc('0x75')]([_0xeabc('0x60'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0xeabc('0x63')],_0x436f8e);};var _0x273ca5=function(_0xe90200){if(!_0xe90200||!_0xe90200[_0xeabc('0x64')][_0xeabc('0x3c')]){return'';}for(var _0x5f5a47='(',_0x289f98=0x0;_0x289f98<_0xe90200['rules']['length'];_0x289f98+=0x1){_0x289f98>0x0&&(_0x5f5a47+='\x20'+_0xe90200[_0xeabc('0x65')]+'\x20');_0x5f5a47+=_0xe90200[_0xeabc('0x64')][_0x289f98]['group']?_0x273ca5(_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x66')]):_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x6d')]+'\x20'+_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x67')]+(_0x522c6e(_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x67')])?'\x20'+_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x68')]:'');}return _0x5f5a47+')';};var _0x1f8197={'where':{'id':_0x4424ce['id']}},_0x485c13,_0xb54c35,_0x5c9d6f,_0x1caaa7,_0x3e764a;_0x1f8197=_[_0xeabc('0x40')]({},_0x1f8197,_0x51368f);return db[_0xeabc('0x31')][_0xeabc('0x46')](_0x1f8197)[_0xeabc('0x26')](function(_0x40f51e){if(_0x40f51e){_0x485c13=_0x40f51e;return _0x40f51e[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x156e20){if(_0x156e20){if(!_0x156e20[_0xeabc('0x3c')]){throw new db['Sequelize'][(_0xeabc('0x82'))](_0xeabc('0x6a'),0x193);}_0xb54c35=_0x156e20;return db[_0xeabc('0x83')][_0xeabc('0x42')]({'raw':!![]});}return null;})['then'](function(_0x26c595){if(_0x26c595){_0x5c9d6f=_[_0xeabc('0x84')](_0x26c595,'id');var _0x580661;var _0x3de927=squel[_0xeabc('0x85')]();_0x3de927['from'](_0x485c13['table']);for(var _0x489b1d=0x0;_0x489b1d<_0xb54c35['length'];_0x489b1d+=0x1){_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x6c')]?_0x5c9d6f[_0xb54c35[_0x489b1d][_0xeabc('0x6c')]][_0xeabc('0x86')]:_0xb54c35[_0x489b1d][_0xeabc('0x6d')];_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x6e')]?_[_0xeabc('0x6f')](_0x952dc7[_0xb54c35[_0x489b1d][_0xeabc('0x6e')]],'%s',_0x580661):_0x580661;_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x70')]?_[_0xeabc('0x6f')](_0x348064[_0xb54c35[_0x489b1d][_0xeabc('0x70')]],'%s',_0x580661):_0x580661;if(_0xb54c35[_0x489b1d]['groupBy']){_0x3de927[_0xeabc('0x66')](_0x580661);}_0xb54c35[_0x489b1d][_0xeabc('0x72')]&&_0x3de927['order'](_0x580661,_0xb54c35[_0x489b1d][_0xeabc('0x72')]===_0xeabc('0x87')?![]:!![]);_0x3de927[_0xeabc('0x6d')](_0x580661,_0xb54c35[_0x489b1d]['alias']||_0x580661);}if(_0x485c13[_0xeabc('0x73')]){_0x485c13['joins']=JSON[_0xeabc('0x74')](_0x485c13[_0xeabc('0x73')]);for(var _0x1841f0=0x0;_0x1841f0<_0x485c13[_0xeabc('0x73')][_0xeabc('0x3c')];_0x1841f0+=0x1){if(_0x485c13['joins'][_0x1841f0]['type']&&_['includes'](_0x2f95c7,_0x485c13['joins'][_0x1841f0][_0xeabc('0x33')])&&_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x76')]&&_0x485c13['joins'][_0x1841f0][_0xeabc('0x77')]&&_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x88')]){_0x3de927[_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x33')]](_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x77')],null,util[_0xeabc('0x70')](_0xeabc('0x78'),_0x485c13[_0xeabc('0x6b')],_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x76')],_0x485c13['joins'][_0x1841f0]['foreignTable'],_0x485c13[_0xeabc('0x73')][_0x1841f0]['foreignKey']));}}}if(_0x485c13[_0xeabc('0x79')]){_0x485c13[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0x485c13['conditions']);_0x3de927[_0xeabc('0x41')](_0x273ca5(_0x485c13[_0xeabc('0x79')][_0xeabc('0x66')]));}_0x3e764a=_0x3de927['clone']();_0x3de927['limit'](_0x1795fe);_0x3de927[_0xeabc('0x1d')](0x0);return;}})[_0xeabc('0x26')](function(){if(_0x33fa74[_0xeabc('0x89')]===_0xeabc('0x8a')){return null;}var _0x2cc9b3=_[_0xeabc('0x40')](_0x33fa74,{'name':_0x33fa74['fullPath']||_0x33fa74['name']||_0x485c13[_0xeabc('0x2d')],'basename':_0x39f961,'savename':util[_0xeabc('0x70')](_0xeabc('0x8b'),_0x33fa74[_0xeabc('0x2d')]||_0x485c13['name'],require('randomstring')['generate'](0x4),_0x33fa74[_0xeabc('0x89')]||'csv'),'reportId':_0x485c13['id'],'reportType':_0xeabc('0x8c')});return db['AnalyticExtractedReport'][_0xeabc('0x48')](_0x2cc9b3,{'raw':!![]});})['then'](function(_0x6e6ab2){if(_0x485c13[_0xeabc('0x6b')]===_0xeabc('0x8d')){_0x3e764a[_0xeabc('0x41')](_0x485c13[_0xeabc('0x6b')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x33fa74[_0xeabc('0x8e')],_0x33fa74[_0xeabc('0x8f')]);}else{_0x3e764a[_0xeabc('0x41')](_0x485c13['table']+_0xeabc('0x90'),_0x33fa74[_0xeabc('0x8e')],_0x33fa74[_0xeabc('0x8f')]);}if(_0x6e6ab2){logger[_0xeabc('0x91')](_0xeabc('0x92'),_0x3e764a['toString']());require(_0xeabc('0x93'))[_0xeabc('0x94')](path['join'](__dirname,_0xeabc('0x95'),_0x6e6ab2[_0xeabc('0x89')]),[_0x6e6ab2['id'],_0x3e764a['toString'](),path[_0xeabc('0x52')](__dirname,_0xeabc('0x96'),_0x6e6ab2[_0xeabc('0x97')]),_0x39f961]);return _0x6e6ab2;}else{var _0x307d26=squel[_0xeabc('0x85')]();_0x307d26[_0xeabc('0x98')]('('+_0x3e764a[_0xeabc('0x7c')]()+')',_0xeabc('0x99'));_0x307d26[_0xeabc('0x6d')](_0xeabc('0x9a'),_0xeabc('0x20'));_0x3e764a[_0xeabc('0x1e')](_0x33fa74[_0xeabc('0x1e')]||_0x1795fe);_0x3e764a['offset'](_0x33fa74['offset']||0x0);return dbH[_0xeabc('0x9b')][_0xeabc('0x36')](_0x307d26[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')]['QueryTypes'][_0xeabc('0x7d')]})['then'](function(_0x49fba2){if(!_0x49fba2['length']){_0x1caaa7=0x0;}else{_0x1caaa7=_0x49fba2[0x0]['count']||0x0;}return dbH['sequelize']['query'](_0x3e764a[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')][_0xeabc('0x9c')][_0xeabc('0x7d')]});})[_0xeabc('0x26')](function(_0xe27492){return{'rows':_0xe27492||[],'count':_0x1caaa7};});}});}exports[_0xeabc('0x9d')]=function(_0x3eaedf,_0x44dc85){return runReport(_0x3eaedf['params'],_0x3eaedf[_0xeabc('0x36')],_0x3eaedf[_0xeabc('0x45')])[_0xeabc('0x26')](respondWithResult(_0x44dc85,null))[_0xeabc('0x47')](handleError(_0x44dc85,null));};exports[_0xeabc('0x9e')]=runReport;exports[_0xeabc('0x36')]=function(_0x2a29d7,_0x5bb5d6){var _0x3513ce=0xa;var _0x58cb5d=[_0xeabc('0x52'),_0xeabc('0x53'),'right_join',_0xeabc('0x55')];var _0x4c8bf3={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':_0xeabc('0x7e'),'MAX':_0xeabc('0x7f'),'MIN':_0xeabc('0x58'),'AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':_0xeabc('0x80'),'GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x484c75={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x580f72=function(_0x37907a){return!_[_0xeabc('0x75')]([_0xeabc('0x60'),_0xeabc('0x61'),_0xeabc('0x62'),_0xeabc('0x63')],_0x37907a);};var _0x57db6d=function(_0x13cc55){if(!_0x13cc55||!_0x13cc55['rules'][_0xeabc('0x3c')]){return'';}for(var _0x43b88e='(',_0x1fa464=0x0;_0x1fa464<_0x13cc55[_0xeabc('0x64')]['length'];_0x1fa464+=0x1){_0x1fa464>0x0&&(_0x43b88e+='\x20'+_0x13cc55[_0xeabc('0x65')]+'\x20');_0x43b88e+=_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x66')]?_0x57db6d(_0x13cc55['rules'][_0x1fa464][_0xeabc('0x66')]):_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x6d')]+'\x20'+_0x13cc55['rules'][_0x1fa464]['condition']+(_0x580f72(_0x13cc55['rules'][_0x1fa464]['condition'])?'\x20'+_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x68')]:'');}return _0x43b88e+')';};var _0x52e84f={'where':{'id':_0x2a29d7[_0xeabc('0x50')]['id']}},_0x12f024,_0x1d35da,_0x2695a4,_0x199251,_0x1899d6;_0x52e84f=_[_0xeabc('0x40')]({},_0x52e84f,_0x2a29d7[_0xeabc('0x45')]);return db[_0xeabc('0x31')]['find'](_0x52e84f)[_0xeabc('0x26')](function(_0x5bb015){if(_0x5bb015){_0x12f024=_0x5bb015;return _0x5bb015[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x438ce3){if(_0x438ce3){if(!_0x438ce3[_0xeabc('0x3c')]){throw new db[(_0xeabc('0x9f'))][(_0xeabc('0x82'))](_0xeabc('0x6a'),0x193);}_0x1d35da=_0x438ce3;return db['AnalyticMetric'][_0xeabc('0x42')]({'raw':!![]});}return null;})['then'](function(_0x475160){if(_0x475160){_0x2695a4=_['keyBy'](_0x475160,'id');var _0x10d66b;var _0x12a042=squel[_0xeabc('0x85')]();_0x12a042[_0xeabc('0x98')](_0x12f024[_0xeabc('0x6b')]);for(var _0x49bf0f=0x0;_0x49bf0f<_0x1d35da[_0xeabc('0x3c')];_0x49bf0f+=0x1){_0x10d66b=_0x1d35da[_0x49bf0f][_0xeabc('0x6c')]?_0x2695a4[_0x1d35da[_0x49bf0f][_0xeabc('0x6c')]][_0xeabc('0x86')]:_0x1d35da[_0x49bf0f][_0xeabc('0x6d')];_0x10d66b=_0x1d35da[_0x49bf0f]['function']?_[_0xeabc('0x6f')](_0x4c8bf3[_0x1d35da[_0x49bf0f][_0xeabc('0x6e')]],'%s',_0x10d66b):_0x10d66b;_0x10d66b=_0x1d35da[_0x49bf0f][_0xeabc('0x70')]?_[_0xeabc('0x6f')](_0x484c75[_0x1d35da[_0x49bf0f][_0xeabc('0x70')]],'%s',_0x10d66b):_0x10d66b;if(_0x1d35da[_0x49bf0f]['groupBy']){_0x12a042[_0xeabc('0x66')](_0x10d66b);}_0x1d35da[_0x49bf0f]['orderBy']&&_0x12a042[_0xeabc('0x3e')](_0x10d66b,_0x1d35da[_0x49bf0f][_0xeabc('0x72')]===_0xeabc('0x87')?![]:!![]);_0x12a042[_0xeabc('0x6d')](_0x10d66b,_0x1d35da[_0x49bf0f][_0xeabc('0xa0')]||_0x10d66b);}if(_0x12f024[_0xeabc('0x73')]){_0x12f024[_0xeabc('0x73')]=JSON[_0xeabc('0x74')](_0x12f024[_0xeabc('0x73')]);for(var _0x223a3=0x0;_0x223a3<_0x12f024['joins'][_0xeabc('0x3c')];_0x223a3+=0x1){if(_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x33')]&&_[_0xeabc('0x75')](_0x58cb5d,_0x12f024['joins'][_0x223a3][_0xeabc('0x33')])&&_0x12f024['joins'][_0x223a3]['parentKey']&&_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x77')]&&_0x12f024[_0xeabc('0x73')][_0x223a3]['foreignKey']){_0x12a042[_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x33')]](_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x77')],null,util[_0xeabc('0x70')]('%s.%s\x20=\x20%s.%s',_0x12f024[_0xeabc('0x6b')],_0x12f024[_0xeabc('0x73')][_0x223a3]['parentKey'],_0x12f024['joins'][_0x223a3][_0xeabc('0x77')],_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x88')]));}}}if(_0x12f024[_0xeabc('0x79')]){_0x12f024[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0x12f024[_0xeabc('0x79')]);_0x12a042[_0xeabc('0x41')](_0x57db6d(_0x12f024[_0xeabc('0x79')]['group']));}_0x1899d6=_0x12a042[_0xeabc('0xa1')]();_0x12a042['limit'](_0x3513ce);_0x12a042[_0xeabc('0x1d')](0x0);logger['debug'](_0xeabc('0x7b'),_0x12a042[_0xeabc('0x7c')]());return dbH[_0xeabc('0x9b')][_0xeabc('0x36')](_0x12a042[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')][_0xeabc('0x9c')][_0xeabc('0x7d')]});}})[_0xeabc('0x26')](function(){return{'sql':_0x1899d6[_0xeabc('0x7c')]()};})['then'](respondWithResult(_0x5bb5d6,null))['catch'](handleError(_0x5bb5d6,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 27a9f01..ec8d53d 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 _0x5276=['define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes'];(function(_0x2ff9e6,_0x467a1a){var _0x2ae91d=function(_0x381eda){while(--_0x381eda){_0x2ff9e6['push'](_0x2ff9e6['shift']());}};_0x2ae91d(++_0x467a1a);}(_0x5276,0xac));var _0x6527=function(_0x365ca5,_0x6c950d){_0x365ca5=_0x365ca5-0x0;var _0x52df50=_0x5276[_0x365ca5];return _0x52df50;};'use strict';var _=require(_0x6527('0x0'));var util=require(_0x6527('0x1'));var logger=require(_0x6527('0x2'))(_0x6527('0x3'));var moment=require(_0x6527('0x4'));var BPromise=require('bluebird');var rp=require(_0x6527('0x5'));var fs=require('fs');var path=require(_0x6527('0x6'));var rimraf=require(_0x6527('0x7'));var config=require(_0x6527('0x8'));var attributes=require(_0x6527('0x9'));module['exports']=function(_0x4cd772,_0x4619f2){return _0x4cd772[_0x6527('0xa')](_0x6527('0xb'),attributes,{'tableName':_0x6527('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8fd6=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','analytics_default_reports','lodash','util'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x8fd6,0x9a));var _0x68fd=function(_0x27d958,_0x29ef87){_0x27d958=_0x27d958-0x0;var _0x53e63e=_0x8fd6[_0x27d958];return _0x53e63e;};'use strict';var _=require(_0x68fd('0x0'));var util=require(_0x68fd('0x1'));var logger=require('../../config/logger')(_0x68fd('0x2'));var moment=require(_0x68fd('0x3'));var BPromise=require(_0x68fd('0x4'));var rp=require(_0x68fd('0x5'));var fs=require('fs');var path=require(_0x68fd('0x6'));var rimraf=require(_0x68fd('0x7'));var config=require(_0x68fd('0x8'));var attributes=require(_0x68fd('0x9'));module['exports']=function(_0x1ce5ab,_0x766b49){return _0x1ce5ab[_0x68fd('0xa')](_0x68fd('0xb'),attributes,{'tableName':_0x68fd('0xc'),'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 b369961..704cf8f 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 _0xf529=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','AnalyticDefaultReport,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring'];(function(_0x7cd893,_0xfc77a7){var _0x42ebc4=function(_0x160c44){while(--_0x160c44){_0x7cd893['push'](_0x7cd893['shift']());}};_0x42ebc4(++_0xfc77a7);}(_0xf529,0x14c));var _0x9f52=function(_0x324a65,_0x3101bc){_0x324a65=_0x324a65-0x0;var _0x1b3d39=_0xf529[_0x324a65];return _0x1b3d39;};'use strict';var _=require('lodash');var util=require(_0x9f52('0x0'));var moment=require(_0x9f52('0x1'));var BPromise=require(_0x9f52('0x2'));var rs=require(_0x9f52('0x3'));var fs=require('fs');var Redis=require(_0x9f52('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9f52('0x5'));var logger=require(_0x9f52('0x6'))('rpc');var config=require(_0x9f52('0x7'));var jayson=require(_0x9f52('0x8'));var client=jayson[_0x9f52('0x9')][_0x9f52('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17b46e,_0x414e05,_0x69aa5f){return new BPromise(function(_0x52f764,_0x292d92){return client[_0x9f52('0xb')](_0x17b46e,_0x69aa5f)[_0x9f52('0xc')](function(_0xc27f3d){logger[_0x9f52('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x414e05,_0x9f52('0xe'));logger[_0x9f52('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x414e05,'request\x20sent',JSON[_0x9f52('0x10')](_0xc27f3d));if(_0xc27f3d[_0x9f52('0x11')]){if(_0xc27f3d['error']['code']===0x1f4){logger['error'](_0x9f52('0x12'),_0x414e05,_0xc27f3d[_0x9f52('0x11')][_0x9f52('0x13')]);return _0x292d92(_0xc27f3d['error']['message']);}logger[_0x9f52('0x11')](_0x9f52('0x12'),_0x414e05,_0xc27f3d[_0x9f52('0x11')][_0x9f52('0x13')]);return _0x52f764(_0xc27f3d[_0x9f52('0x11')][_0x9f52('0x13')]);}else{logger['info'](_0x9f52('0x12'),_0x414e05,_0x9f52('0xe'));_0x52f764(_0xc27f3d[_0x9f52('0x14')][_0x9f52('0x13')]);}})['catch'](function(_0x54964f){logger[_0x9f52('0x11')](_0x9f52('0x12'),_0x414e05,_0x54964f);_0x292d92(_0x54964f);});});} \ No newline at end of file +var _0x22ce=['moment','bluebird','../../config/logger','jayson/promise','client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x932ac4,_0x4c3e71){var _0xe3420e=function(_0x4cdd40){while(--_0x4cdd40){_0x932ac4['push'](_0x932ac4['shift']());}};_0xe3420e(++_0x4c3e71);}(_0x22ce,0xc6));var _0xe22c=function(_0x43f15e,_0x3fcdcd){_0x43f15e=_0x43f15e-0x0;var _0x155dd6=_0x22ce[_0x43f15e];return _0x155dd6;};'use strict';var _=require(_0xe22c('0x0'));var util=require(_0xe22c('0x1'));var moment=require(_0xe22c('0x2'));var BPromise=require(_0xe22c('0x3'));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(_0xe22c('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe22c('0x5'));var client=jayson[_0xe22c('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x361833,_0x13eb51,_0xc8c2a3){return new BPromise(function(_0x184be0,_0x241803){return client[_0xe22c('0x7')](_0x361833,_0xc8c2a3)[_0xe22c('0x8')](function(_0xcaa7bf){logger[_0xe22c('0x9')](_0xe22c('0xa'),_0x13eb51,'request\x20sent');logger[_0xe22c('0xb')](_0xe22c('0xc'),_0x13eb51,_0xe22c('0xd'),JSON[_0xe22c('0xe')](_0xcaa7bf));if(_0xcaa7bf[_0xe22c('0xf')]){if(_0xcaa7bf[_0xe22c('0xf')][_0xe22c('0x10')]===0x1f4){logger[_0xe22c('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x13eb51,_0xcaa7bf[_0xe22c('0xf')][_0xe22c('0x11')]);return _0x241803(_0xcaa7bf[_0xe22c('0xf')][_0xe22c('0x11')]);}logger[_0xe22c('0xf')](_0xe22c('0xa'),_0x13eb51,_0xcaa7bf[_0xe22c('0xf')]['message']);return _0x184be0(_0xcaa7bf[_0xe22c('0xf')]['message']);}else{logger[_0xe22c('0x9')](_0xe22c('0xa'),_0x13eb51,_0xe22c('0xd'));_0x184be0(_0xcaa7bf[_0xe22c('0x12')][_0xe22c('0x11')]);}})[_0xe22c('0x13')](function(_0x5890a7){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x13eb51,_0x5890a7);_0x241803(_0x5890a7);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 795d85e..6558824 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 _0xc85c=['index','get','/:id','isAuthenticated','/:id/preview','preview','/:id/run','run','/:id/query','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller'];(function(_0x4eddf5,_0x38e3dd){var _0x55bdc9=function(_0x260e0b){while(--_0x260e0b){_0x4eddf5['push'](_0x4eddf5['shift']());}};_0x55bdc9(++_0x38e3dd);}(_0xc85c,0x155));var _0xcc85=function(_0x192b7d,_0x3db1eb){_0x192b7d=_0x192b7d-0x0;var _0x57e19a=_0xc85c[_0x192b7d];return _0x57e19a;};'use strict';var multer=require(_0xcc85('0x0'));var util=require('util');var path=require(_0xcc85('0x1'));var timeout=require(_0xcc85('0x2'));var express=require(_0xcc85('0x3'));var router=express[_0xcc85('0x4')]();var fs_extra=require(_0xcc85('0x5'));var auth=require(_0xcc85('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcc85('0x7'));var controller=require(_0xcc85('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xcc85('0x9')]);router[_0xcc85('0xa')](_0xcc85('0xb'),auth[_0xcc85('0xc')](),controller['show']);router[_0xcc85('0xa')](_0xcc85('0xd'),auth[_0xcc85('0xc')](),controller[_0xcc85('0xe')]);router[_0xcc85('0xa')](_0xcc85('0xf'),auth[_0xcc85('0xc')](),controller[_0xcc85('0x10')]);router[_0xcc85('0xa')](_0xcc85('0x11'),auth[_0xcc85('0xc')](),controller['query']);router[_0xcc85('0x12')]('/',auth['isAuthenticated'](),controller[_0xcc85('0x13')]);router[_0xcc85('0x14')](_0xcc85('0xb'),auth[_0xcc85('0xc')](),controller[_0xcc85('0x15')]);router[_0xcc85('0x16')](_0xcc85('0xb'),auth[_0xcc85('0xc')](),controller[_0xcc85('0x17')]);module[_0xcc85('0x18')]=router; \ No newline at end of file +var _0x2d06=['preview','/:id/run','run','query','post','create','put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x250514,_0x389eda){var _0x59c25b=function(_0x3ad38b){while(--_0x3ad38b){_0x250514['push'](_0x250514['shift']());}};_0x59c25b(++_0x389eda);}(_0x2d06,0xab));var _0x62d0=function(_0x1ebd40,_0x5bf84d){_0x1ebd40=_0x1ebd40-0x0;var _0x2298ee=_0x2d06[_0x1ebd40];return _0x2298ee;};'use strict';var multer=require(_0x62d0('0x0'));var util=require(_0x62d0('0x1'));var path=require(_0x62d0('0x2'));var timeout=require('connect-timeout');var express=require(_0x62d0('0x3'));var router=express[_0x62d0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x62d0('0x5'));var interaction=require(_0x62d0('0x6'));var config=require(_0x62d0('0x7'));var controller=require('./analyticDefaultReport.controller');router[_0x62d0('0x8')]('/',auth[_0x62d0('0x9')](),controller[_0x62d0('0xa')]);router[_0x62d0('0x8')](_0x62d0('0xb'),auth[_0x62d0('0x9')](),controller[_0x62d0('0xc')]);router[_0x62d0('0x8')]('/:id/preview',auth['isAuthenticated'](),controller[_0x62d0('0xd')]);router[_0x62d0('0x8')](_0x62d0('0xe'),auth[_0x62d0('0x9')](),controller[_0x62d0('0xf')]);router[_0x62d0('0x8')]('/:id/query',auth[_0x62d0('0x9')](),controller[_0x62d0('0x10')]);router[_0x62d0('0x11')]('/',auth[_0x62d0('0x9')](),controller[_0x62d0('0x12')]);router[_0x62d0('0x13')](_0x62d0('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x62d0('0x14')](_0x62d0('0xb'),auth['isAuthenticated'](),controller[_0x62d0('0x15')]);module[_0x62d0('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 5c5445f..9e5a66e 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 _0x75f1=['exports','STRING','ENUM','pdf','xlsx','csv','DATE','Loading','manual','scheduled','sequelize'];(function(_0x403b9b,_0x444f75){var _0x5708df=function(_0xd77ed0){while(--_0xd77ed0){_0x403b9b['push'](_0x403b9b['shift']());}};_0x5708df(++_0x444f75);}(_0x75f1,0x78));var _0x175f=function(_0x4ae58a,_0x72bd08){_0x4ae58a=_0x4ae58a-0x0;var _0x3c0445=_0x75f1[_0x4ae58a];return _0x3c0445;};'use strict';var Sequelize=require(_0x175f('0x0'));var moment=require('moment');module[_0x175f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x175f('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x175f('0x3')]('csv',_0x175f('0x4'),_0x175f('0x5')),'allowNull':![],'defaultValue':_0x175f('0x6')},'savename':{'type':Sequelize[_0x175f('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x175f('0x7')]},'status':{'type':Sequelize[_0x175f('0x2')],'defaultValue':_0x175f('0x8')},'type':{'type':Sequelize['ENUM'](_0x175f('0x9'),_0x175f('0xa')),'allowNull':![],'defaultValue':_0x175f('0x9')},'reportId':{'type':Sequelize['INTEGER'](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x175f('0x2')]}}; \ No newline at end of file +var _0xc640=['sequelize','moment','exports','STRING','ENUM','pdf','xlsx','csv','DATE','Loading','manual','scheduled','UNSIGNED'];(function(_0x19d317,_0x365978){var _0x533155=function(_0xedfbf4){while(--_0xedfbf4){_0x19d317['push'](_0x19d317['shift']());}};_0x533155(++_0x365978);}(_0xc640,0x193));var _0x0c64=function(_0x7d1679,_0x3227b8){_0x7d1679=_0x7d1679-0x0;var _0x3afd5d=_0xc640[_0x7d1679];return _0x3afd5d;};'use strict';var Sequelize=require(_0x0c64('0x0'));var moment=require(_0x0c64('0x1'));module[_0x0c64('0x2')]={'name':{'type':Sequelize[_0x0c64('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x0c64('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x0c64('0x4')]('csv',_0x0c64('0x5'),_0x0c64('0x6')),'allowNull':![],'defaultValue':_0x0c64('0x7')},'savename':{'type':Sequelize[_0x0c64('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x0c64('0x8')]},'endDate':{'type':Sequelize[_0x0c64('0x8')]},'status':{'type':Sequelize[_0x0c64('0x3')],'defaultValue':_0x0c64('0x9')},'type':{'type':Sequelize[_0x0c64('0x4')](_0x0c64('0xa'),_0x0c64('0xb')),'allowNull':![],'defaultValue':_0x0c64('0xa')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x0c64('0xc')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 931e8a9..0f2d438 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 _0x1e43=['UserProfileSection','userProfileId','autoAssociation','params','download','basename','savename','output','existsSync','join','server/files/reports','Sequelize','ValidationError','root','format','%s.%s','toLowerCase','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','get','ExtractedReports','UserProfileResource','error','stack','name','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','model','filters','intersection','query','attributes','fields','length','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','catch','keys','find','create','body','role'];(function(_0x50d00f,_0xd2a8bb){var _0x358c70=function(_0x33ab83){while(--_0x33ab83){_0x50d00f['push'](_0x50d00f['shift']());}};_0x358c70(++_0xd2a8bb);}(_0x1e43,0x69));var _0x31e4=function(_0x1ad07b,_0x551d55){_0x1ad07b=_0x1ad07b-0x0;var _0x2c447f=_0x1e43[_0x1ad07b];return _0x2c447f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x31e4('0x0'));var zipdir=require(_0x31e4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x31e4('0x2'));var moment=require(_0x31e4('0x3'));var BPromise=require(_0x31e4('0x4'));var Mustache=require('mustache');var util=require(_0x31e4('0x5'));var path=require(_0x31e4('0x6'));var sox=require('sox');var csv=require(_0x31e4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x31e4('0x8'));var _=require(_0x31e4('0x9'));var squel=require(_0x31e4('0xa'));var crypto=require('crypto');var jsforce=require(_0x31e4('0xb'));var deskjs=require(_0x31e4('0xc'));var toCsv=require(_0x31e4('0x7'));var querystring=require(_0x31e4('0xd'));var Papa=require(_0x31e4('0xe'));var Redis=require(_0x31e4('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x31e4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x31e4('0x11'))(_0x31e4('0x12'));var utils=require(_0x31e4('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x31e4('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e1098,_0x301358){_0x301358=_0x301358||0xcc;return function(_0x14ed73){if(_0x14ed73){return _0x2e1098[_0x31e4('0x15')](_0x301358);}return _0x2e1098[_0x31e4('0x16')](_0x301358)[_0x31e4('0x17')]();};}function respondWithResult(_0x130b7d,_0x2b7228){_0x2b7228=_0x2b7228||0xc8;return function(_0x378bfd){if(_0x378bfd){return _0x130b7d['status'](_0x2b7228)[_0x31e4('0x18')](_0x378bfd);}};}function respondWithFilteredResult(_0x4e5093,_0x10d7c9){return function(_0x1de25d){if(_0x1de25d){var _0x3d4f6a=typeof _0x10d7c9[_0x31e4('0x19')]==='undefined'&&typeof _0x10d7c9[_0x31e4('0x1a')]===_0x31e4('0x1b');var _0x1125f4=_0x1de25d[_0x31e4('0x1c')];var _0xcdd8a1=_0x3d4f6a?0x0:_0x10d7c9[_0x31e4('0x19')];var _0x542485=_0x3d4f6a?_0x1de25d[_0x31e4('0x1c')]:_0x10d7c9['offset']+_0x10d7c9[_0x31e4('0x1a')];var _0x1ab25f;if(_0x542485>=_0x1125f4){_0x542485=_0x1125f4;_0x1ab25f=0xc8;}else{_0x1ab25f=0xce;}_0x4e5093[_0x31e4('0x16')](_0x1ab25f);return _0x4e5093[_0x31e4('0x1d')](_0x31e4('0x1e'),_0xcdd8a1+'-'+_0x542485+'/'+_0x1125f4)[_0x31e4('0x18')](_0x1de25d);}return null;};}function patchUpdates(_0x4712f7){return function(_0x25a06d){try{jsonpatch[_0x31e4('0x1f')](_0x25a06d,_0x4712f7,!![]);}catch(_0x162ec1){return BPromise[_0x31e4('0x20')](_0x162ec1);}return _0x25a06d[_0x31e4('0x21')]();};}function saveUpdates(_0x3902a6,_0x53f3ac){return function(_0x5ce198){if(_0x5ce198){return _0x5ce198[_0x31e4('0x22')](_0x3902a6)['then'](function(_0x1f34c7){return _0x1f34c7;});}return null;};}function removeEntity(_0x5b59a4,_0x3f4126){return function(_0x2f549e){if(_0x2f549e){return _0x2f549e[_0x31e4('0x23')]()[_0x31e4('0x24')](function(){var _0x4ef5ec=_0x2f549e[_0x31e4('0x25')]({'plain':!![]});var _0x5afc3b=_0x31e4('0x26');return db[_0x31e4('0x27')]['destroy']({'where':{'type':_0x5afc3b,'resourceId':_0x4ef5ec['id']}})['then'](function(){return _0x2f549e;});})[_0x31e4('0x24')](function(){_0x5b59a4[_0x31e4('0x16')](0xcc)[_0x31e4('0x17')]();});}};}function handleEntityNotFound(_0x3c7ee0,_0xaec60c){return function(_0x2fbbfb){if(!_0x2fbbfb){_0x3c7ee0['sendStatus'](0x194);}return _0x2fbbfb;};}function handleError(_0x4b78d1,_0xb36087){_0xb36087=_0xb36087||0x1f4;return function(_0xc7a7d7){logger[_0x31e4('0x28')](_0xc7a7d7[_0x31e4('0x29')]);if(_0xc7a7d7[_0x31e4('0x2a')]){delete _0xc7a7d7[_0x31e4('0x2a')];}_0x4b78d1[_0x31e4('0x16')](_0xb36087)['send'](_0xc7a7d7);};}exports[_0x31e4('0x2b')]=function(_0x1ff38f,_0x13dec9){var _0x26c848={},_0xffa1ad={},_0x29b94d={'count':0x0,'rows':[]};var _0x3edaca=_[_0x31e4('0x2c')](db[_0x31e4('0x2d')][_0x31e4('0x2e')],function(_0x221698){return{'name':_0x221698[_0x31e4('0x2f')],'type':_0x221698[_0x31e4('0x30')]['key']};});_0xffa1ad[_0x31e4('0x31')]=_[_0x31e4('0x2c')](_0x3edaca,_0x31e4('0x2a'));_0xffa1ad['query']=_['keys'](_0x1ff38f['query']);_0xffa1ad[_0x31e4('0x32')]=_[_0x31e4('0x33')](_0xffa1ad[_0x31e4('0x31')],_0xffa1ad[_0x31e4('0x34')]);_0x26c848[_0x31e4('0x35')]=_['intersection'](_0xffa1ad['model'],qs[_0x31e4('0x36')](_0x1ff38f[_0x31e4('0x34')][_0x31e4('0x36')]));_0x26c848[_0x31e4('0x35')]=_0x26c848[_0x31e4('0x35')][_0x31e4('0x37')]?_0x26c848[_0x31e4('0x35')]:_0xffa1ad[_0x31e4('0x31')];if(!_0x1ff38f[_0x31e4('0x34')]['hasOwnProperty']('nolimit')){_0x26c848['limit']=qs[_0x31e4('0x1a')](_0x1ff38f[_0x31e4('0x34')]['limit']);_0x26c848[_0x31e4('0x19')]=qs['offset'](_0x1ff38f[_0x31e4('0x34')][_0x31e4('0x19')]);}_0x26c848[_0x31e4('0x38')]=qs[_0x31e4('0x39')](_0x1ff38f[_0x31e4('0x34')][_0x31e4('0x39')]);_0x26c848[_0x31e4('0x3a')]=qs[_0x31e4('0x32')](_['pick'](_0x1ff38f[_0x31e4('0x34')],_0xffa1ad[_0x31e4('0x32')]),_0x3edaca);if(_0x1ff38f[_0x31e4('0x34')][_0x31e4('0x3b')]){_0x26c848[_0x31e4('0x3a')]=_[_0x31e4('0x3c')](_0x26c848[_0x31e4('0x3a')],{'$or':_[_0x31e4('0x2c')](_0x3edaca,function(_0x5d2ff0){if(_0x5d2ff0['type']!==_0x31e4('0x3d')){var _0x378158={};_0x378158[_0x5d2ff0[_0x31e4('0x2a')]]={'$like':'%'+_0x1ff38f[_0x31e4('0x34')][_0x31e4('0x3b')]+'%'};return _0x378158;}})});}_0x26c848=_[_0x31e4('0x3c')]({},_0x26c848,_0x1ff38f['options']);var _0x529038={'where':_0x26c848['where']};return db[_0x31e4('0x2d')]['count'](_0x529038)[_0x31e4('0x24')](function(_0x237b47){_0x29b94d[_0x31e4('0x1c')]=_0x237b47;if(_0x1ff38f[_0x31e4('0x34')][_0x31e4('0x3e')]){_0x26c848[_0x31e4('0x3f')]=[{'all':!![]}];}return db[_0x31e4('0x2d')][_0x31e4('0x40')](_0x26c848);})[_0x31e4('0x24')](function(_0x3fd26a){_0x29b94d['rows']=_0x3fd26a;return _0x29b94d;})[_0x31e4('0x24')](respondWithFilteredResult(_0x13dec9,_0x26c848))[_0x31e4('0x41')](handleError(_0x13dec9,null));};exports['show']=function(_0x4f17ea,_0x1efdb2){var _0x3082c5={'raw':!![],'where':{'id':_0x4f17ea['params']['id']}},_0x1f49ac={};_0x1f49ac[_0x31e4('0x31')]=_[_0x31e4('0x42')](db[_0x31e4('0x2d')]['rawAttributes']);_0x1f49ac[_0x31e4('0x34')]=_['keys'](_0x4f17ea[_0x31e4('0x34')]);_0x1f49ac[_0x31e4('0x32')]=_['intersection'](_0x1f49ac['model'],_0x1f49ac[_0x31e4('0x34')]);_0x3082c5['attributes']=_[_0x31e4('0x33')](_0x1f49ac[_0x31e4('0x31')],qs[_0x31e4('0x36')](_0x4f17ea['query'][_0x31e4('0x36')]));_0x3082c5[_0x31e4('0x35')]=_0x3082c5[_0x31e4('0x35')]['length']?_0x3082c5['attributes']:_0x1f49ac['model'];if(_0x4f17ea[_0x31e4('0x34')]['includeAll']){_0x3082c5[_0x31e4('0x3f')]=[{'all':!![]}];}_0x3082c5=_[_0x31e4('0x3c')]({},_0x3082c5,_0x4f17ea['options']);return db[_0x31e4('0x2d')][_0x31e4('0x43')](_0x3082c5)['then'](handleEntityNotFound(_0x1efdb2,null))[_0x31e4('0x24')](respondWithResult(_0x1efdb2,null))[_0x31e4('0x41')](handleError(_0x1efdb2,null));};exports[_0x31e4('0x44')]=function(_0x55ae7e,_0x2da0a4){return db[_0x31e4('0x2d')][_0x31e4('0x44')](_0x55ae7e[_0x31e4('0x45')],{})[_0x31e4('0x24')](function(_0x42c171){var _0x1e2a2a=_0x55ae7e['user'][_0x31e4('0x25')]({'plain':!![]});if(!_0x1e2a2a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e2a2a[_0x31e4('0x46')]==='user'){var _0x54aa3b=_0x42c171[_0x31e4('0x25')]({'plain':!![]});var _0x4af3d9=_0x31e4('0x26');return db[_0x31e4('0x47')]['find']({'where':{'name':_0x4af3d9,'userProfileId':_0x1e2a2a[_0x31e4('0x48')]},'raw':!![]})[_0x31e4('0x24')](function(_0x40acae){if(_0x40acae&&_0x40acae[_0x31e4('0x49')]===0x0){return db[_0x31e4('0x27')]['create']({'name':_0x54aa3b[_0x31e4('0x2a')],'resourceId':_0x54aa3b['id'],'type':_0x40acae[_0x31e4('0x2a')],'sectionId':_0x40acae['id']},{})[_0x31e4('0x24')](function(){return _0x42c171;});}else{return _0x42c171;}})[_0x31e4('0x41')](function(_0x15a178){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x15a178);throw _0x15a178;});}return _0x42c171;})[_0x31e4('0x24')](respondWithResult(_0x2da0a4,0xc9))[_0x31e4('0x41')](handleError(_0x2da0a4,null));};exports['update']=function(_0x1fd0ef,_0x1c92ab){if(_0x1fd0ef['body']['id']){delete _0x1fd0ef[_0x31e4('0x45')]['id'];}return db[_0x31e4('0x2d')]['find']({'where':{'id':_0x1fd0ef[_0x31e4('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1c92ab,null))[_0x31e4('0x24')](saveUpdates(_0x1fd0ef['body'],null))['then'](respondWithResult(_0x1c92ab,null))[_0x31e4('0x41')](handleError(_0x1c92ab,null));};exports[_0x31e4('0x23')]=function(_0x1b0b36,_0x5ddb37){return db[_0x31e4('0x2d')]['find']({'where':{'id':_0x1b0b36[_0x31e4('0x4a')]['id']}})[_0x31e4('0x24')](handleEntityNotFound(_0x5ddb37,null))['then'](removeEntity(_0x5ddb37,null))['catch'](handleError(_0x5ddb37,null));};exports[_0x31e4('0x4b')]=function(_0x45b800,_0x5829a7,_0x4ec81d){return db[_0x31e4('0x2d')][_0x31e4('0x43')]({'where':{'id':_0x45b800['params']['id']},'attributes':[_0x31e4('0x2a'),_0x31e4('0x4c'),_0x31e4('0x4d'),_0x31e4('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x5829a7,null))[_0x31e4('0x24')](function(_0x580501){if(_0x580501){if(!fs[_0x31e4('0x4f')](path[_0x31e4('0x50')](config['root'],_0x31e4('0x51'),_0x580501[_0x31e4('0x4d')]))){throw new db[(_0x31e4('0x52'))][(_0x31e4('0x53'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x45b800[_0x31e4('0x34')]['exists']){return _0x5829a7[_0x31e4('0x15')](0xc8);}return _0x5829a7[_0x31e4('0x4b')](path['join'](config[_0x31e4('0x54')],'server/files/reports',_0x580501['savename']),util[_0x31e4('0x55')](_0x31e4('0x56'),_0x580501[_0x31e4('0x4c')]||_0x580501['name'],_0x580501[_0x31e4('0x4e')][_0x31e4('0x57')]()));}})[_0x31e4('0x41')](handleError(_0x5829a7,null));}; \ No newline at end of file +var _0xa42f=['order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','update','download','savename','output','join','root','server/files/reports','Sequelize','ValidationError','exists','format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','UserProfileResource','destroy','then','end','sendStatus','error','stack','name','send','index','AnalyticExtractedReport','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa42f,0x145));var _0xfa42=function(_0x3b8548,_0x2a1461){_0x3b8548=_0x3b8548-0x0;var _0x5bfe9d=_0xa42f[_0x3b8548];return _0x5bfe9d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfa42('0x0'));var zipdir=require(_0xfa42('0x1'));var jsonpatch=require(_0xfa42('0x2'));var rp=require(_0xfa42('0x3'));var moment=require(_0xfa42('0x4'));var BPromise=require(_0xfa42('0x5'));var Mustache=require(_0xfa42('0x6'));var util=require(_0xfa42('0x7'));var path=require(_0xfa42('0x8'));var sox=require(_0xfa42('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfa42('0xa'));var _=require(_0xfa42('0xb'));var squel=require(_0xfa42('0xc'));var crypto=require(_0xfa42('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xfa42('0xe'));var toCsv=require(_0xfa42('0xf'));var querystring=require(_0xfa42('0x10'));var Papa=require(_0xfa42('0x11'));var Redis=require('ioredis');var authService=require(_0xfa42('0x12'));var qs=require(_0xfa42('0x13'));var as=require(_0xfa42('0x14'));var hardwareService=require(_0xfa42('0x15'));var logger=require(_0xfa42('0x16'))(_0xfa42('0x17'));var utils=require(_0xfa42('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x437a9c,_0x11c065){_0x11c065=_0x11c065||0xcc;return function(_0x4611cc){if(_0x4611cc){return _0x437a9c['sendStatus'](_0x11c065);}return _0x437a9c[_0xfa42('0x19')](_0x11c065)['end']();};}function respondWithResult(_0x249501,_0x1237d2){_0x1237d2=_0x1237d2||0xc8;return function(_0x43dac2){if(_0x43dac2){return _0x249501[_0xfa42('0x19')](_0x1237d2)[_0xfa42('0x1a')](_0x43dac2);}};}function respondWithFilteredResult(_0x418290,_0xd1e831){return function(_0x440a9c){if(_0x440a9c){var _0x551119=typeof _0xd1e831['offset']===_0xfa42('0x1b')&&typeof _0xd1e831[_0xfa42('0x1c')]===_0xfa42('0x1b');var _0x4bf88e=_0x440a9c[_0xfa42('0x1d')];var _0x1be195=_0x551119?0x0:_0xd1e831[_0xfa42('0x1e')];var _0x2d0d0f=_0x551119?_0x440a9c[_0xfa42('0x1d')]:_0xd1e831[_0xfa42('0x1e')]+_0xd1e831[_0xfa42('0x1c')];var _0x4bf806;if(_0x2d0d0f>=_0x4bf88e){_0x2d0d0f=_0x4bf88e;_0x4bf806=0xc8;}else{_0x4bf806=0xce;}_0x418290['status'](_0x4bf806);return _0x418290[_0xfa42('0x1f')](_0xfa42('0x20'),_0x1be195+'-'+_0x2d0d0f+'/'+_0x4bf88e)[_0xfa42('0x1a')](_0x440a9c);}return null;};}function patchUpdates(_0x2560f2){return function(_0x160012){try{jsonpatch[_0xfa42('0x21')](_0x160012,_0x2560f2,!![]);}catch(_0x344736){return BPromise[_0xfa42('0x22')](_0x344736);}return _0x160012[_0xfa42('0x23')]();};}function saveUpdates(_0x52f51e,_0x52a4ee){return function(_0x1e0efc){if(_0x1e0efc){return _0x1e0efc['update'](_0x52f51e)['then'](function(_0x2f4958){return _0x2f4958;});}return null;};}function removeEntity(_0x348022,_0x36f30e){return function(_0xa552bf){if(_0xa552bf){return _0xa552bf['destroy']()['then'](function(){var _0x382611=_0xa552bf['get']({'plain':!![]});var _0x12b102='ExtractedReports';return db[_0xfa42('0x24')][_0xfa42('0x25')]({'where':{'type':_0x12b102,'resourceId':_0x382611['id']}})[_0xfa42('0x26')](function(){return _0xa552bf;});})[_0xfa42('0x26')](function(){_0x348022[_0xfa42('0x19')](0xcc)[_0xfa42('0x27')]();});}};}function handleEntityNotFound(_0x491dce,_0x5d0d4d){return function(_0x3ba192){if(!_0x3ba192){_0x491dce[_0xfa42('0x28')](0x194);}return _0x3ba192;};}function handleError(_0x437b9f,_0x16bee1){_0x16bee1=_0x16bee1||0x1f4;return function(_0x3c2d2b){logger[_0xfa42('0x29')](_0x3c2d2b[_0xfa42('0x2a')]);if(_0x3c2d2b[_0xfa42('0x2b')]){delete _0x3c2d2b[_0xfa42('0x2b')];}_0x437b9f[_0xfa42('0x19')](_0x16bee1)[_0xfa42('0x2c')](_0x3c2d2b);};}exports[_0xfa42('0x2d')]=function(_0x38bffe,_0x4f4b87){var _0x33e48d={},_0xf16471={},_0x19e046={'count':0x0,'rows':[]};var _0x596713=_['map'](db[_0xfa42('0x2e')][_0xfa42('0x2f')],function(_0x1d6025){return{'name':_0x1d6025['fieldName'],'type':_0x1d6025[_0xfa42('0x30')][_0xfa42('0x31')]};});_0xf16471['model']=_['map'](_0x596713,'name');_0xf16471[_0xfa42('0x32')]=_['keys'](_0x38bffe['query']);_0xf16471[_0xfa42('0x33')]=_[_0xfa42('0x34')](_0xf16471[_0xfa42('0x35')],_0xf16471[_0xfa42('0x32')]);_0x33e48d[_0xfa42('0x36')]=_[_0xfa42('0x34')](_0xf16471[_0xfa42('0x35')],qs[_0xfa42('0x37')](_0x38bffe[_0xfa42('0x32')][_0xfa42('0x37')]));_0x33e48d[_0xfa42('0x36')]=_0x33e48d[_0xfa42('0x36')][_0xfa42('0x38')]?_0x33e48d[_0xfa42('0x36')]:_0xf16471[_0xfa42('0x35')];if(!_0x38bffe[_0xfa42('0x32')][_0xfa42('0x39')](_0xfa42('0x3a'))){_0x33e48d['limit']=qs['limit'](_0x38bffe[_0xfa42('0x32')][_0xfa42('0x1c')]);_0x33e48d['offset']=qs[_0xfa42('0x1e')](_0x38bffe[_0xfa42('0x32')][_0xfa42('0x1e')]);}_0x33e48d[_0xfa42('0x3b')]=qs[_0xfa42('0x3c')](_0x38bffe[_0xfa42('0x32')][_0xfa42('0x3c')]);_0x33e48d['where']=qs[_0xfa42('0x33')](_[_0xfa42('0x3d')](_0x38bffe[_0xfa42('0x32')],_0xf16471[_0xfa42('0x33')]),_0x596713);if(_0x38bffe[_0xfa42('0x32')][_0xfa42('0x3e')]){_0x33e48d[_0xfa42('0x3f')]=_[_0xfa42('0x40')](_0x33e48d[_0xfa42('0x3f')],{'$or':_[_0xfa42('0x41')](_0x596713,function(_0x205008){if(_0x205008['type']!==_0xfa42('0x42')){var _0x5066eb={};_0x5066eb[_0x205008[_0xfa42('0x2b')]]={'$like':'%'+_0x38bffe['query'][_0xfa42('0x3e')]+'%'};return _0x5066eb;}})});}_0x33e48d=_[_0xfa42('0x40')]({},_0x33e48d,_0x38bffe[_0xfa42('0x43')]);var _0x4eb961={'where':_0x33e48d[_0xfa42('0x3f')]};return db[_0xfa42('0x2e')][_0xfa42('0x1d')](_0x4eb961)['then'](function(_0x346782){_0x19e046[_0xfa42('0x1d')]=_0x346782;if(_0x38bffe['query'][_0xfa42('0x44')]){_0x33e48d[_0xfa42('0x45')]=[{'all':!![]}];}return db[_0xfa42('0x2e')][_0xfa42('0x46')](_0x33e48d);})['then'](function(_0x22c491){_0x19e046[_0xfa42('0x47')]=_0x22c491;return _0x19e046;})[_0xfa42('0x26')](respondWithFilteredResult(_0x4f4b87,_0x33e48d))[_0xfa42('0x48')](handleError(_0x4f4b87,null));};exports[_0xfa42('0x49')]=function(_0x236b67,_0x3bef8b){var _0x494103={'raw':!![],'where':{'id':_0x236b67[_0xfa42('0x4a')]['id']}},_0x4f1fb2={};_0x4f1fb2[_0xfa42('0x35')]=_[_0xfa42('0x4b')](db[_0xfa42('0x2e')]['rawAttributes']);_0x4f1fb2[_0xfa42('0x32')]=_[_0xfa42('0x4b')](_0x236b67[_0xfa42('0x32')]);_0x4f1fb2[_0xfa42('0x33')]=_['intersection'](_0x4f1fb2[_0xfa42('0x35')],_0x4f1fb2[_0xfa42('0x32')]);_0x494103[_0xfa42('0x36')]=_[_0xfa42('0x34')](_0x4f1fb2['model'],qs[_0xfa42('0x37')](_0x236b67[_0xfa42('0x32')]['fields']));_0x494103[_0xfa42('0x36')]=_0x494103['attributes'][_0xfa42('0x38')]?_0x494103[_0xfa42('0x36')]:_0x4f1fb2['model'];if(_0x236b67[_0xfa42('0x32')][_0xfa42('0x44')]){_0x494103['include']=[{'all':!![]}];}_0x494103=_['merge']({},_0x494103,_0x236b67[_0xfa42('0x43')]);return db['AnalyticExtractedReport'][_0xfa42('0x4c')](_0x494103)[_0xfa42('0x26')](handleEntityNotFound(_0x3bef8b,null))[_0xfa42('0x26')](respondWithResult(_0x3bef8b,null))[_0xfa42('0x48')](handleError(_0x3bef8b,null));};exports[_0xfa42('0x4d')]=function(_0x3f86c4,_0x49bd33){return db[_0xfa42('0x2e')][_0xfa42('0x4d')](_0x3f86c4[_0xfa42('0x4e')],{})['then'](function(_0x413750){var _0x10d8ae=_0x3f86c4[_0xfa42('0x4f')]['get']({'plain':!![]});if(!_0x10d8ae)throw new Error(_0xfa42('0x50'));if(_0x10d8ae[_0xfa42('0x51')]==='user'){var _0x59cde2=_0x413750[_0xfa42('0x52')]({'plain':!![]});var _0x1c80df='ExtractedReports';return db[_0xfa42('0x53')][_0xfa42('0x4c')]({'where':{'name':_0x1c80df,'userProfileId':_0x10d8ae['userProfileId']},'raw':!![]})['then'](function(_0x200a7d){if(_0x200a7d&&_0x200a7d[_0xfa42('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x59cde2[_0xfa42('0x2b')],'resourceId':_0x59cde2['id'],'type':_0x200a7d[_0xfa42('0x2b')],'sectionId':_0x200a7d['id']},{})[_0xfa42('0x26')](function(){return _0x413750;});}else{return _0x413750;}})[_0xfa42('0x48')](function(_0x46b66c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x46b66c);throw _0x46b66c;});}return _0x413750;})[_0xfa42('0x26')](respondWithResult(_0x49bd33,0xc9))[_0xfa42('0x48')](handleError(_0x49bd33,null));};exports[_0xfa42('0x55')]=function(_0x22c8af,_0x10a605){if(_0x22c8af[_0xfa42('0x4e')]['id']){delete _0x22c8af[_0xfa42('0x4e')]['id'];}return db[_0xfa42('0x2e')]['find']({'where':{'id':_0x22c8af['params']['id']}})[_0xfa42('0x26')](handleEntityNotFound(_0x10a605,null))[_0xfa42('0x26')](saveUpdates(_0x22c8af[_0xfa42('0x4e')],null))[_0xfa42('0x26')](respondWithResult(_0x10a605,null))['catch'](handleError(_0x10a605,null));};exports[_0xfa42('0x25')]=function(_0x3b87ae,_0x13def5){return db['AnalyticExtractedReport'][_0xfa42('0x4c')]({'where':{'id':_0x3b87ae[_0xfa42('0x4a')]['id']}})[_0xfa42('0x26')](handleEntityNotFound(_0x13def5,null))['then'](removeEntity(_0x13def5,null))['catch'](handleError(_0x13def5,null));};exports[_0xfa42('0x56')]=function(_0x335dbc,_0x293f2c,_0x359e42){return db[_0xfa42('0x2e')][_0xfa42('0x4c')]({'where':{'id':_0x335dbc[_0xfa42('0x4a')]['id']},'attributes':[_0xfa42('0x2b'),'basename',_0xfa42('0x57'),_0xfa42('0x58')],'raw':!![]})['then'](handleEntityNotFound(_0x293f2c,null))[_0xfa42('0x26')](function(_0x1a3232){if(_0x1a3232){if(!fs['existsSync'](path[_0xfa42('0x59')](config[_0xfa42('0x5a')],_0xfa42('0x5b'),_0x1a3232['savename']))){throw new db[(_0xfa42('0x5c'))][(_0xfa42('0x5d'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x335dbc['query'][_0xfa42('0x5e')]){return _0x293f2c[_0xfa42('0x28')](0xc8);}return _0x293f2c['download'](path['join'](config[_0xfa42('0x5a')],_0xfa42('0x5b'),_0x1a3232['savename']),util[_0xfa42('0x5f')]('%s.%s',_0x1a3232['basename']||_0x1a3232[_0xfa42('0x2b')],_0x1a3232['output']['toLowerCase']()));}})[_0xfa42('0x48')](handleError(_0x293f2c,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index a085e91..c0cfefd 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 _0xf7d6=['util','../../config/logger','api','bluebird','path','../../config/environment','define','AnalyticExtractedReport','lodash'];(function(_0x5660f6,_0x5646db){var _0x4bf573=function(_0x12a85){while(--_0x12a85){_0x5660f6['push'](_0x5660f6['shift']());}};_0x4bf573(++_0x5646db);}(_0xf7d6,0x182));var _0x6f7d=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xf7d6[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x6f7d('0x0'));var util=require(_0x6f7d('0x1'));var logger=require(_0x6f7d('0x2'))(_0x6f7d('0x3'));var moment=require('moment');var BPromise=require(_0x6f7d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f7d('0x5'));var rimraf=require('rimraf');var config=require(_0x6f7d('0x6'));var attributes=require('./analyticExtractedReport.attributes');module['exports']=function(_0x184667,_0x97c5d6){return _0x184667[_0x6f7d('0x7')](_0x6f7d('0x8'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb5ae=['rimraf','../../config/environment','./analyticExtractedReport.attributes','define','AnalyticExtractedReport','lodash','api','path'];(function(_0x487550,_0x51d700){var _0x3663c6=function(_0x24a968){while(--_0x24a968){_0x487550['push'](_0x487550['shift']());}};_0x3663c6(++_0x51d700);}(_0xb5ae,0x7d));var _0xeb5a=function(_0x3cc553,_0x3685f5){_0x3cc553=_0x3cc553-0x0;var _0x531082=_0xb5ae[_0x3cc553];return _0x531082;};'use strict';var _=require(_0xeb5a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xeb5a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeb5a('0x2'));var rimraf=require(_0xeb5a('0x3'));var config=require(_0xeb5a('0x4'));var attributes=require(_0xeb5a('0x5'));module['exports']=function(_0x5af737,_0xc9ccea){return _0x5af737[_0xeb5a('0x6')](_0xeb5a('0x7'),attributes,{'tableName':'analytics_extracted_reports','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 28c3510..c109099 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 _0xac96=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util'];(function(_0x4edeae,_0x9399fa){var _0x184c1c=function(_0x4f6c4e){while(--_0x4f6c4e){_0x4edeae['push'](_0x4edeae['shift']());}};_0x184c1c(++_0x9399fa);}(_0xac96,0x149));var _0x6ac9=function(_0x1f3063,_0x238740){_0x1f3063=_0x1f3063-0x0;var _0x562471=_0xac96[_0x1f3063];return _0x562471;};'use strict';var _=require('lodash');var util=require(_0x6ac9('0x0'));var moment=require(_0x6ac9('0x1'));var BPromise=require(_0x6ac9('0x2'));var rs=require(_0x6ac9('0x3'));var fs=require('fs');var Redis=require(_0x6ac9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ac9('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x6ac9('0x6'));var jayson=require(_0x6ac9('0x7'));var client=jayson[_0x6ac9('0x8')][_0x6ac9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16519f,_0x19286b,_0x53d772){return new BPromise(function(_0x24775e,_0x2817f2){return client['request'](_0x16519f,_0x53d772)[_0x6ac9('0xa')](function(_0x479dce){logger['info'](_0x6ac9('0xb'),_0x19286b,_0x6ac9('0xc'));logger[_0x6ac9('0xd')](_0x6ac9('0xe'),_0x19286b,_0x6ac9('0xc'),JSON[_0x6ac9('0xf')](_0x479dce));if(_0x479dce[_0x6ac9('0x10')]){if(_0x479dce[_0x6ac9('0x10')][_0x6ac9('0x11')]===0x1f4){logger[_0x6ac9('0x10')](_0x6ac9('0xb'),_0x19286b,_0x479dce[_0x6ac9('0x10')][_0x6ac9('0x12')]);return _0x2817f2(_0x479dce[_0x6ac9('0x10')][_0x6ac9('0x12')]);}logger[_0x6ac9('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x19286b,_0x479dce['error']['message']);return _0x24775e(_0x479dce['error'][_0x6ac9('0x12')]);}else{logger[_0x6ac9('0x13')](_0x6ac9('0xb'),_0x19286b,_0x6ac9('0xc'));_0x24775e(_0x479dce[_0x6ac9('0x14')][_0x6ac9('0x12')]);}})[_0x6ac9('0x15')](function(_0x1d106d){logger[_0x6ac9('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x19286b,_0x1d106d);_0x2817f2(_0x1d106d);});});} \ No newline at end of file +var _0xbc09=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x48c42d,_0x563cfa){var _0x48e33a=function(_0x2f555e){while(--_0x2f555e){_0x48c42d['push'](_0x48c42d['shift']());}};_0x48e33a(++_0x563cfa);}(_0xbc09,0x17b));var _0x9bc0=function(_0x275d46,_0x5ac3d6){_0x275d46=_0x275d46-0x0;var _0x20c4dc=_0xbc09[_0x275d46];return _0x20c4dc;};'use strict';var _=require(_0x9bc0('0x0'));var util=require('util');var moment=require(_0x9bc0('0x1'));var BPromise=require(_0x9bc0('0x2'));var rs=require(_0x9bc0('0x3'));var fs=require('fs');var Redis=require(_0x9bc0('0x4'));var db=require(_0x9bc0('0x5'))['db'];var utils=require(_0x9bc0('0x6'));var logger=require(_0x9bc0('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9bc0('0x8'));var client=jayson[_0x9bc0('0x9')][_0x9bc0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47d6fc,_0x4f5442,_0x59276f){return new BPromise(function(_0x19d1e6,_0xca9f3a){return client[_0x9bc0('0xb')](_0x47d6fc,_0x59276f)[_0x9bc0('0xc')](function(_0x6ba1f1){logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x4f5442,_0x9bc0('0xd'));logger[_0x9bc0('0xe')](_0x9bc0('0xf'),_0x4f5442,'request\x20sent',JSON[_0x9bc0('0x10')](_0x6ba1f1));if(_0x6ba1f1[_0x9bc0('0x11')]){if(_0x6ba1f1[_0x9bc0('0x11')][_0x9bc0('0x12')]===0x1f4){logger['error'](_0x9bc0('0x13'),_0x4f5442,_0x6ba1f1[_0x9bc0('0x11')]['message']);return _0xca9f3a(_0x6ba1f1[_0x9bc0('0x11')]['message']);}logger[_0x9bc0('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4f5442,_0x6ba1f1[_0x9bc0('0x11')][_0x9bc0('0x14')]);return _0x19d1e6(_0x6ba1f1[_0x9bc0('0x11')]['message']);}else{logger[_0x9bc0('0x15')](_0x9bc0('0x13'),_0x4f5442,_0x9bc0('0xd'));_0x19d1e6(_0x6ba1f1[_0x9bc0('0x16')][_0x9bc0('0x14')]);}})[_0x9bc0('0x17')](function(_0x3f92ac){logger[_0x9bc0('0x11')](_0x9bc0('0x13'),_0x4f5442,_0x3f92ac);_0xca9f3a(_0x3f92ac);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index d62552e..2e0a976 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 _0xf6c5=['/:id','isAuthenticated','show','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./analyticExtractedReport.controller','get','index'];(function(_0x381363,_0x3a2e29){var _0x81466a=function(_0x4b8481){while(--_0x4b8481){_0x381363['push'](_0x381363['shift']());}};_0x81466a(++_0x3a2e29);}(_0xf6c5,0x1c4));var _0x5f6c=function(_0x499fa3,_0x5f9a57){_0x499fa3=_0x499fa3-0x0;var _0x27199c=_0xf6c5[_0x499fa3];return _0x27199c;};'use strict';var multer=require(_0x5f6c('0x0'));var util=require(_0x5f6c('0x1'));var path=require(_0x5f6c('0x2'));var timeout=require(_0x5f6c('0x3'));var express=require(_0x5f6c('0x4'));var router=express['Router']();var fs_extra=require(_0x5f6c('0x5'));var auth=require(_0x5f6c('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5f6c('0x7'));router[_0x5f6c('0x8')]('/',auth['isAuthenticated'](),controller[_0x5f6c('0x9')]);router[_0x5f6c('0x8')](_0x5f6c('0xa'),auth[_0x5f6c('0xb')](),controller[_0x5f6c('0xc')]);router['get'](_0x5f6c('0xd'),auth[_0x5f6c('0xb')](),controller[_0x5f6c('0xe')]);router[_0x5f6c('0xf')]('/',auth[_0x5f6c('0xb')](),controller[_0x5f6c('0x10')]);router[_0x5f6c('0x11')](_0x5f6c('0xa'),auth['isAuthenticated'](),controller[_0x5f6c('0x12')]);router[_0x5f6c('0x13')](_0x5f6c('0xa'),auth['isAuthenticated'](),controller[_0x5f6c('0x14')]);module[_0x5f6c('0x15')]=router; \ No newline at end of file +var _0x8b02=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','get','isAuthenticated','index','show','download','post','create','/:id','delete','exports','multer','util'];(function(_0x4dbbf2,_0x271d16){var _0x4bd3a7=function(_0x47d43d){while(--_0x47d43d){_0x4dbbf2['push'](_0x4dbbf2['shift']());}};_0x4bd3a7(++_0x271d16);}(_0x8b02,0xda));var _0x28b0=function(_0x46bd02,_0x3c73cc){_0x46bd02=_0x46bd02-0x0;var _0x2b0f33=_0x8b02[_0x46bd02];return _0x2b0f33;};'use strict';var multer=require(_0x28b0('0x0'));var util=require(_0x28b0('0x1'));var path=require(_0x28b0('0x2'));var timeout=require(_0x28b0('0x3'));var express=require(_0x28b0('0x4'));var router=express[_0x28b0('0x5')]();var fs_extra=require(_0x28b0('0x6'));var auth=require(_0x28b0('0x7'));var interaction=require(_0x28b0('0x8'));var config=require('../../config/environment');var controller=require(_0x28b0('0x9'));router[_0x28b0('0xa')]('/',auth[_0x28b0('0xb')](),controller[_0x28b0('0xc')]);router[_0x28b0('0xa')]('/:id',auth[_0x28b0('0xb')](),controller[_0x28b0('0xd')]);router[_0x28b0('0xa')]('/:id/download',auth[_0x28b0('0xb')](),controller[_0x28b0('0xe')]);router[_0x28b0('0xf')]('/',auth['isAuthenticated'](),controller[_0x28b0('0x10')]);router['put'](_0x28b0('0x11'),auth[_0x28b0('0xb')](),controller['update']);router[_0x28b0('0x12')]('/:id',auth[_0x28b0('0xb')](),controller['destroy']);module[_0x28b0('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index b565434..7274fe5 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 _0xdb4e=['BOOLEAN','exports','STRING'];(function(_0x43d7b6,_0x41bd3e){var _0x36a7b9=function(_0x3bf4e3){while(--_0x3bf4e3){_0x43d7b6['push'](_0x43d7b6['shift']());}};_0x36a7b9(++_0x41bd3e);}(_0xdb4e,0x19f));var _0xedb4=function(_0x355f5a,_0x4f36f5){_0x355f5a=_0x355f5a-0x0;var _0x163214=_0xdb4e[_0x355f5a];return _0x163214;};'use strict';var Sequelize=require('sequelize');module[_0xedb4('0x0')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xedb4('0x1')]},'format':{'type':Sequelize[_0xedb4('0x1')]},'groupBy':{'type':Sequelize[_0xedb4('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0xedb4('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xf1c1=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x560431,_0x1fed76){var _0x3e0491=function(_0x230f84){while(--_0x230f84){_0x560431['push'](_0x560431['shift']());}};_0x3e0491(++_0x1fed76);}(_0xf1c1,0x124));var _0x1f1c=function(_0x565d80,_0x2da9af){_0x565d80=_0x565d80-0x0;var _0x5c09d1=_0xf1c1[_0x565d80];return _0x5c09d1;};'use strict';var Sequelize=require(_0x1f1c('0x0'));module[_0x1f1c('0x1')]={'field':{'type':Sequelize[_0x1f1c('0x2')]},'alias':{'type':Sequelize[_0x1f1c('0x3')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x1f1c('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x1f1c('0x3')]},'custom':{'type':Sequelize[_0x1f1c('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 7205024..647a10d 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 _0xe2ef=['offset','Content-Range','apply','reject','save','update','then','error','name','send','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','pick','filter','where','merge','options','AnalyticFieldReport','includeAll','findAll','rows','catch','show','params','keys','find','create','body','bulkCreate','bulkDestroy','destroy','AnalyticCustomReport','sequelize','rimraf','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count'];(function(_0x2cc73c,_0x465104){var _0x39d126=function(_0x7cb926){while(--_0x7cb926){_0x2cc73c['push'](_0x2cc73c['shift']());}};_0x39d126(++_0x465104);}(_0xe2ef,0x104));var _0xfe2e=function(_0x44edb6,_0x174fe7){_0x44edb6=_0x44edb6-0x0;var _0xfca19c=_0xe2ef[_0x44edb6];return _0xfca19c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfe2e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfe2e('0x1'));var rp=require('request-promise');var moment=require(_0xfe2e('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xfe2e('0x3'));var util=require(_0xfe2e('0x4'));var path=require(_0xfe2e('0x5'));var sox=require('sox');var csv=require(_0xfe2e('0x6'));var ejs=require(_0xfe2e('0x7'));var fs=require('fs');var fs_extra=require(_0xfe2e('0x8'));var _=require('lodash');var squel=require(_0xfe2e('0x9'));var crypto=require('crypto');var jsforce=require(_0xfe2e('0xa'));var deskjs=require(_0xfe2e('0xb'));var toCsv=require(_0xfe2e('0x6'));var querystring=require(_0xfe2e('0xc'));var Papa=require(_0xfe2e('0xd'));var Redis=require(_0xfe2e('0xe'));var authService=require(_0xfe2e('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfe2e('0x10'));var hardwareService=require(_0xfe2e('0x11'));var logger=require('../../config/logger')(_0xfe2e('0x12'));var utils=require('../../config/utils');var config=require(_0xfe2e('0x13'));var licenseUtil=require(_0xfe2e('0x14'));var db=require(_0xfe2e('0x15'))['db'];function respondWithStatusCode(_0x34bad4,_0x23fb29){_0x23fb29=_0x23fb29||0xcc;return function(_0x58a134){if(_0x58a134){return _0x34bad4[_0xfe2e('0x16')](_0x23fb29);}return _0x34bad4[_0xfe2e('0x17')](_0x23fb29)[_0xfe2e('0x18')]();};}function respondWithResult(_0x4fafdc,_0x34fc1c){_0x34fc1c=_0x34fc1c||0xc8;return function(_0x550769){if(_0x550769){return _0x4fafdc['status'](_0x34fc1c)['json'](_0x550769);}};}function respondWithFilteredResult(_0x265c6c,_0x3d2379){return function(_0xdae4ac){if(_0xdae4ac){var _0x4877bb=typeof _0x3d2379['offset']===_0xfe2e('0x19')&&typeof _0x3d2379[_0xfe2e('0x1a')]===_0xfe2e('0x19');var _0x3acfdf=_0xdae4ac[_0xfe2e('0x1b')];var _0x18f55b=_0x4877bb?0x0:_0x3d2379[_0xfe2e('0x1c')];var _0x5d515e=_0x4877bb?_0xdae4ac['count']:_0x3d2379[_0xfe2e('0x1c')]+_0x3d2379[_0xfe2e('0x1a')];var _0x286233;if(_0x5d515e>=_0x3acfdf){_0x5d515e=_0x3acfdf;_0x286233=0xc8;}else{_0x286233=0xce;}_0x265c6c[_0xfe2e('0x17')](_0x286233);return _0x265c6c['set'](_0xfe2e('0x1d'),_0x18f55b+'-'+_0x5d515e+'/'+_0x3acfdf)['json'](_0xdae4ac);}return null;};}function patchUpdates(_0x3d705c){return function(_0x2b6a7c){try{jsonpatch[_0xfe2e('0x1e')](_0x2b6a7c,_0x3d705c,!![]);}catch(_0x276190){return BPromise[_0xfe2e('0x1f')](_0x276190);}return _0x2b6a7c[_0xfe2e('0x20')]();};}function saveUpdates(_0x7b4add,_0x32f24){return function(_0x37626b){if(_0x37626b){return _0x37626b[_0xfe2e('0x21')](_0x7b4add)[_0xfe2e('0x22')](function(_0x5a4541){return _0x5a4541;});}return null;};}function removeEntity(_0xb17e1b,_0x1bb266){return function(_0x905eeb){if(_0x905eeb){return _0x905eeb['destroy']()[_0xfe2e('0x22')](function(){_0xb17e1b[_0xfe2e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b5dae,_0x36ff87){return function(_0x5e2f6d){if(!_0x5e2f6d){_0x1b5dae[_0xfe2e('0x16')](0x194);}return _0x5e2f6d;};}function handleError(_0x44b1e0,_0x5b6318){_0x5b6318=_0x5b6318||0x1f4;return function(_0x51a6e4){logger[_0xfe2e('0x23')](_0x51a6e4['stack']);if(_0x51a6e4[_0xfe2e('0x24')]){delete _0x51a6e4[_0xfe2e('0x24')];}_0x44b1e0[_0xfe2e('0x17')](_0x5b6318)[_0xfe2e('0x25')](_0x51a6e4);};}exports['index']=function(_0x5e971e,_0x435621){var _0x2131c3={},_0x143262={},_0x4b68fc={'count':0x0,'rows':[]};var _0x83487b=_['map'](db['AnalyticFieldReport'][_0xfe2e('0x26')],function(_0x527e08){return{'name':_0x527e08[_0xfe2e('0x27')],'type':_0x527e08[_0xfe2e('0x28')][_0xfe2e('0x29')]};});_0x143262[_0xfe2e('0x2a')]=_[_0xfe2e('0x2b')](_0x83487b,_0xfe2e('0x24'));_0x143262[_0xfe2e('0x2c')]=_['keys'](_0x5e971e[_0xfe2e('0x2c')]);_0x143262[_0xfe2e('0x2d')]=_[_0xfe2e('0x2e')](_0x143262[_0xfe2e('0x2a')],_0x143262[_0xfe2e('0x2c')]);_0x2131c3[_0xfe2e('0x2f')]=_['intersection'](_0x143262[_0xfe2e('0x2a')],qs[_0xfe2e('0x30')](_0x5e971e[_0xfe2e('0x2c')][_0xfe2e('0x30')]));_0x2131c3[_0xfe2e('0x2f')]=_0x2131c3[_0xfe2e('0x2f')][_0xfe2e('0x31')]?_0x2131c3[_0xfe2e('0x2f')]:_0x143262[_0xfe2e('0x2a')];if(!_0x5e971e[_0xfe2e('0x2c')][_0xfe2e('0x32')]('nolimit')){_0x2131c3['limit']=qs[_0xfe2e('0x1a')](_0x5e971e[_0xfe2e('0x2c')][_0xfe2e('0x1a')]);_0x2131c3[_0xfe2e('0x1c')]=qs[_0xfe2e('0x1c')](_0x5e971e[_0xfe2e('0x2c')][_0xfe2e('0x1c')]);}_0x2131c3['order']=qs['sort'](_0x5e971e['query']['sort']);_0x2131c3['where']=qs[_0xfe2e('0x2d')](_[_0xfe2e('0x33')](_0x5e971e['query'],_0x143262[_0xfe2e('0x2d')]),_0x83487b);if(_0x5e971e['query'][_0xfe2e('0x34')]){_0x2131c3[_0xfe2e('0x35')]=_[_0xfe2e('0x36')](_0x2131c3[_0xfe2e('0x35')],{'$or':_['map'](_0x83487b,function(_0x3a34f4){if(_0x3a34f4[_0xfe2e('0x28')]!=='VIRTUAL'){var _0x1a288b={};_0x1a288b[_0x3a34f4[_0xfe2e('0x24')]]={'$like':'%'+_0x5e971e[_0xfe2e('0x2c')]['filter']+'%'};return _0x1a288b;}})});}_0x2131c3=_[_0xfe2e('0x36')]({},_0x2131c3,_0x5e971e[_0xfe2e('0x37')]);var _0x4abf9d={'where':_0x2131c3[_0xfe2e('0x35')]};return db[_0xfe2e('0x38')]['count'](_0x4abf9d)[_0xfe2e('0x22')](function(_0x5743df){_0x4b68fc['count']=_0x5743df;if(_0x5e971e[_0xfe2e('0x2c')][_0xfe2e('0x39')]){_0x2131c3['include']=[{'all':!![]}];}return db[_0xfe2e('0x38')][_0xfe2e('0x3a')](_0x2131c3);})[_0xfe2e('0x22')](function(_0x495141){_0x4b68fc[_0xfe2e('0x3b')]=_0x495141;return _0x4b68fc;})[_0xfe2e('0x22')](respondWithFilteredResult(_0x435621,_0x2131c3))[_0xfe2e('0x3c')](handleError(_0x435621,null));};exports[_0xfe2e('0x3d')]=function(_0x5d90c1,_0x308e01){var _0xfb2e1d={'raw':![],'where':{'id':_0x5d90c1[_0xfe2e('0x3e')]['id']}},_0x42c563={};_0x42c563[_0xfe2e('0x2a')]=_[_0xfe2e('0x3f')](db[_0xfe2e('0x38')][_0xfe2e('0x26')]);_0x42c563[_0xfe2e('0x2c')]=_[_0xfe2e('0x3f')](_0x5d90c1[_0xfe2e('0x2c')]);_0x42c563[_0xfe2e('0x2d')]=_[_0xfe2e('0x2e')](_0x42c563[_0xfe2e('0x2a')],_0x42c563[_0xfe2e('0x2c')]);_0xfb2e1d[_0xfe2e('0x2f')]=_[_0xfe2e('0x2e')](_0x42c563[_0xfe2e('0x2a')],qs[_0xfe2e('0x30')](_0x5d90c1['query'][_0xfe2e('0x30')]));_0xfb2e1d[_0xfe2e('0x2f')]=_0xfb2e1d[_0xfe2e('0x2f')][_0xfe2e('0x31')]?_0xfb2e1d[_0xfe2e('0x2f')]:_0x42c563[_0xfe2e('0x2a')];if(_0x5d90c1[_0xfe2e('0x2c')][_0xfe2e('0x39')]){_0xfb2e1d['include']=[{'all':!![]}];}_0xfb2e1d=_[_0xfe2e('0x36')]({},_0xfb2e1d,_0x5d90c1['options']);return db[_0xfe2e('0x38')][_0xfe2e('0x40')](_0xfb2e1d)[_0xfe2e('0x22')](handleEntityNotFound(_0x308e01,null))[_0xfe2e('0x22')](respondWithResult(_0x308e01,null))[_0xfe2e('0x3c')](handleError(_0x308e01,null));};exports[_0xfe2e('0x41')]=function(_0x19d426,_0x3d2ce3){return db[_0xfe2e('0x38')][_0xfe2e('0x41')](_0x19d426[_0xfe2e('0x42')],{})['then'](respondWithResult(_0x3d2ce3,0xc9))[_0xfe2e('0x3c')](handleError(_0x3d2ce3,null));};exports[_0xfe2e('0x43')]=function(_0x7770f0,_0x1c4f4f){return db[_0xfe2e('0x38')][_0xfe2e('0x43')](_0x7770f0[_0xfe2e('0x42')],{'raw':![],'individualHooks':!![]})[_0xfe2e('0x22')](respondWithResult(_0x1c4f4f,0xc9))['catch'](handleError(_0x1c4f4f,null));};exports[_0xfe2e('0x21')]=function(_0x1f0f57,_0x4a4b55){if(_0x1f0f57['body']['id']){delete _0x1f0f57[_0xfe2e('0x42')]['id'];}return db['AnalyticFieldReport']['find']({'where':{'id':_0x1f0f57[_0xfe2e('0x3e')]['id']}})[_0xfe2e('0x22')](handleEntityNotFound(_0x4a4b55,null))['then'](saveUpdates(_0x1f0f57[_0xfe2e('0x42')],null))['then'](respondWithResult(_0x4a4b55,null))[_0xfe2e('0x3c')](handleError(_0x4a4b55,null));};exports['destroy']=function(_0x2f2766,_0x39cb6b){return db[_0xfe2e('0x38')][_0xfe2e('0x40')]({'where':{'id':_0x2f2766[_0xfe2e('0x3e')]['id']}})[_0xfe2e('0x22')](handleEntityNotFound(_0x39cb6b,null))[_0xfe2e('0x22')](removeEntity(_0x39cb6b,null))['catch'](handleError(_0x39cb6b,null));};exports[_0xfe2e('0x44')]=function(_0x6ebaf8,_0x16de7a){return db[_0xfe2e('0x38')][_0xfe2e('0x45')]({'where':{'id':_0x6ebaf8['query']['ids']||[]},'raw':![],'individualHooks':!![]})[_0xfe2e('0x22')](respondWithResult(_0x16de7a,0xcc))[_0xfe2e('0x3c')](handleError(_0x16de7a,null));};exports['addFields']=function(_0x50fb52,_0x1288ea,_0x5ad342){return db[_0xfe2e('0x46')]['findOne']({'where':{'id':_0x50fb52[_0xfe2e('0x3e')]['id']}})[_0xfe2e('0x22')](handleEntityNotFound(_0x1288ea,null))[_0xfe2e('0x22')](function(_0x22d1da){if(_0x22d1da){return db[_0xfe2e('0x47')]['transaction'](function(_0x178e3e){return db[_0xfe2e('0x38')][_0xfe2e('0x45')]({'where':{'CustomReportId':_0x50fb52[_0xfe2e('0x3e')]['id']},'transaction':_0x178e3e})[_0xfe2e('0x22')](function(_0x136aa2){var _0x598fbc=_['map'](_0x50fb52['body'],function(_0x437f7a){delete _0x437f7a['id'];_0x437f7a['CustomReportId']=_0x50fb52[_0xfe2e('0x3e')]['id'];return _0x437f7a;});return db[_0xfe2e('0x38')][_0xfe2e('0x43')](_0x598fbc,{'transaction':_0x178e3e});});})[_0xfe2e('0x22')](function(){return db[_0xfe2e('0x38')]['findAll']({'where':{'CustomReportId':_0x50fb52[_0xfe2e('0x3e')]['id']}});});}})[_0xfe2e('0x22')](respondWithResult(_0x1288ea,null))[_0xfe2e('0x3c')](handleError(_0x1288ea,null));}; \ No newline at end of file +var _0x512b=['moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','offset','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','body','bulkCreate','update','bulkDestroy','ids','AnalyticCustomReport','findOne','transaction','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x4939b9,_0x3d0fa0){var _0x54579d=function(_0x46f9c0){while(--_0x46f9c0){_0x4939b9['push'](_0x4939b9['shift']());}};_0x54579d(++_0x3d0fa0);}(_0x512b,0x195));var _0xb512=function(_0x2de8d5,_0xcc2ef7){_0x2de8d5=_0x2de8d5-0x0;var _0x2b7497=_0x512b[_0x2de8d5];return _0x2b7497;};'use strict';var emlformat=require(_0xb512('0x0'));var rimraf=require(_0xb512('0x1'));var zipdir=require(_0xb512('0x2'));var jsonpatch=require(_0xb512('0x3'));var rp=require(_0xb512('0x4'));var moment=require(_0xb512('0x5'));var BPromise=require(_0xb512('0x6'));var Mustache=require(_0xb512('0x7'));var util=require(_0xb512('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xb512('0x9'));var ejs=require(_0xb512('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb512('0xb'));var squel=require(_0xb512('0xc'));var crypto=require(_0xb512('0xd'));var jsforce=require(_0xb512('0xe'));var deskjs=require(_0xb512('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb512('0x10'));var Papa=require(_0xb512('0x11'));var Redis=require(_0xb512('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb512('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb512('0x14'))('api');var utils=require(_0xb512('0x15'));var config=require(_0xb512('0x16'));var licenseUtil=require(_0xb512('0x17'));var db=require(_0xb512('0x18'))['db'];function respondWithStatusCode(_0x2f5e68,_0x21810e){_0x21810e=_0x21810e||0xcc;return function(_0x40560c){if(_0x40560c){return _0x2f5e68[_0xb512('0x19')](_0x21810e);}return _0x2f5e68[_0xb512('0x1a')](_0x21810e)[_0xb512('0x1b')]();};}function respondWithResult(_0xb34f32,_0x39ed71){_0x39ed71=_0x39ed71||0xc8;return function(_0x1c2925){if(_0x1c2925){return _0xb34f32[_0xb512('0x1a')](_0x39ed71)['json'](_0x1c2925);}};}function respondWithFilteredResult(_0x5514ff,_0x178dc5){return function(_0x178e51){if(_0x178e51){var _0x54bdf6=typeof _0x178dc5['offset']===_0xb512('0x1c')&&typeof _0x178dc5['limit']===_0xb512('0x1c');var _0x43f8e4=_0x178e51['count'];var _0x54f0b9=_0x54bdf6?0x0:_0x178dc5[_0xb512('0x1d')];var _0x16a4b8=_0x54bdf6?_0x178e51[_0xb512('0x1e')]:_0x178dc5[_0xb512('0x1d')]+_0x178dc5['limit'];var _0x17cee0;if(_0x16a4b8>=_0x43f8e4){_0x16a4b8=_0x43f8e4;_0x17cee0=0xc8;}else{_0x17cee0=0xce;}_0x5514ff[_0xb512('0x1a')](_0x17cee0);return _0x5514ff['set'](_0xb512('0x1f'),_0x54f0b9+'-'+_0x16a4b8+'/'+_0x43f8e4)['json'](_0x178e51);}return null;};}function patchUpdates(_0xce48f6){return function(_0x170819){try{jsonpatch[_0xb512('0x20')](_0x170819,_0xce48f6,!![]);}catch(_0x4d941b){return BPromise[_0xb512('0x21')](_0x4d941b);}return _0x170819[_0xb512('0x22')]();};}function saveUpdates(_0x1a3af3,_0x4be163){return function(_0x24d762){if(_0x24d762){return _0x24d762['update'](_0x1a3af3)[_0xb512('0x23')](function(_0x3a1cc8){return _0x3a1cc8;});}return null;};}function removeEntity(_0x50189f,_0x57ad53){return function(_0x3cfdae){if(_0x3cfdae){return _0x3cfdae[_0xb512('0x24')]()[_0xb512('0x23')](function(){_0x50189f[_0xb512('0x1a')](0xcc)[_0xb512('0x1b')]();});}};}function handleEntityNotFound(_0x343357,_0xd17a71){return function(_0x42d21d){if(!_0x42d21d){_0x343357[_0xb512('0x19')](0x194);}return _0x42d21d;};}function handleError(_0x25f5c6,_0x5c4dfe){_0x5c4dfe=_0x5c4dfe||0x1f4;return function(_0x4c15b6){logger[_0xb512('0x25')](_0x4c15b6[_0xb512('0x26')]);if(_0x4c15b6[_0xb512('0x27')]){delete _0x4c15b6[_0xb512('0x27')];}_0x25f5c6[_0xb512('0x1a')](_0x5c4dfe)[_0xb512('0x28')](_0x4c15b6);};}exports[_0xb512('0x29')]=function(_0x4e1ce0,_0x42c9e2){var _0x3def43={},_0x3d008a={},_0x5416de={'count':0x0,'rows':[]};var _0x48c909=_[_0xb512('0x2a')](db[_0xb512('0x2b')][_0xb512('0x2c')],function(_0x1bc953){return{'name':_0x1bc953[_0xb512('0x2d')],'type':_0x1bc953[_0xb512('0x2e')][_0xb512('0x2f')]};});_0x3d008a[_0xb512('0x30')]=_['map'](_0x48c909,_0xb512('0x27'));_0x3d008a[_0xb512('0x31')]=_[_0xb512('0x32')](_0x4e1ce0[_0xb512('0x31')]);_0x3d008a[_0xb512('0x33')]=_[_0xb512('0x34')](_0x3d008a['model'],_0x3d008a[_0xb512('0x31')]);_0x3def43[_0xb512('0x35')]=_['intersection'](_0x3d008a[_0xb512('0x30')],qs[_0xb512('0x36')](_0x4e1ce0[_0xb512('0x31')]['fields']));_0x3def43['attributes']=_0x3def43[_0xb512('0x35')][_0xb512('0x37')]?_0x3def43['attributes']:_0x3d008a[_0xb512('0x30')];if(!_0x4e1ce0[_0xb512('0x31')][_0xb512('0x38')]('nolimit')){_0x3def43['limit']=qs[_0xb512('0x39')](_0x4e1ce0['query'][_0xb512('0x39')]);_0x3def43[_0xb512('0x1d')]=qs[_0xb512('0x1d')](_0x4e1ce0[_0xb512('0x31')]['offset']);}_0x3def43[_0xb512('0x3a')]=qs[_0xb512('0x3b')](_0x4e1ce0[_0xb512('0x31')][_0xb512('0x3b')]);_0x3def43[_0xb512('0x3c')]=qs['filters'](_[_0xb512('0x3d')](_0x4e1ce0['query'],_0x3d008a[_0xb512('0x33')]),_0x48c909);if(_0x4e1ce0[_0xb512('0x31')][_0xb512('0x3e')]){_0x3def43['where']=_[_0xb512('0x3f')](_0x3def43[_0xb512('0x3c')],{'$or':_['map'](_0x48c909,function(_0x22d403){if(_0x22d403[_0xb512('0x2e')]!==_0xb512('0x40')){var _0x49eba3={};_0x49eba3[_0x22d403[_0xb512('0x27')]]={'$like':'%'+_0x4e1ce0[_0xb512('0x31')]['filter']+'%'};return _0x49eba3;}})});}_0x3def43=_['merge']({},_0x3def43,_0x4e1ce0[_0xb512('0x41')]);var _0xd18778={'where':_0x3def43[_0xb512('0x3c')]};return db[_0xb512('0x2b')][_0xb512('0x1e')](_0xd18778)['then'](function(_0x2ec362){_0x5416de['count']=_0x2ec362;if(_0x4e1ce0['query'][_0xb512('0x42')]){_0x3def43[_0xb512('0x43')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0xb512('0x44')](_0x3def43);})[_0xb512('0x23')](function(_0x38fd3d){_0x5416de[_0xb512('0x45')]=_0x38fd3d;return _0x5416de;})[_0xb512('0x23')](respondWithFilteredResult(_0x42c9e2,_0x3def43))['catch'](handleError(_0x42c9e2,null));};exports['show']=function(_0x855800,_0x57dba2){var _0x52581a={'raw':![],'where':{'id':_0x855800[_0xb512('0x46')]['id']}},_0x22ab09={};_0x22ab09[_0xb512('0x30')]=_['keys'](db[_0xb512('0x2b')]['rawAttributes']);_0x22ab09['query']=_[_0xb512('0x32')](_0x855800[_0xb512('0x31')]);_0x22ab09['filters']=_['intersection'](_0x22ab09[_0xb512('0x30')],_0x22ab09[_0xb512('0x31')]);_0x52581a[_0xb512('0x35')]=_[_0xb512('0x34')](_0x22ab09[_0xb512('0x30')],qs[_0xb512('0x36')](_0x855800['query'][_0xb512('0x36')]));_0x52581a[_0xb512('0x35')]=_0x52581a[_0xb512('0x35')]['length']?_0x52581a[_0xb512('0x35')]:_0x22ab09['model'];if(_0x855800[_0xb512('0x31')][_0xb512('0x42')]){_0x52581a['include']=[{'all':!![]}];}_0x52581a=_[_0xb512('0x3f')]({},_0x52581a,_0x855800[_0xb512('0x41')]);return db[_0xb512('0x2b')][_0xb512('0x47')](_0x52581a)[_0xb512('0x23')](handleEntityNotFound(_0x57dba2,null))[_0xb512('0x23')](respondWithResult(_0x57dba2,null))[_0xb512('0x48')](handleError(_0x57dba2,null));};exports[_0xb512('0x49')]=function(_0x4371cf,_0x266b86){return db[_0xb512('0x2b')][_0xb512('0x49')](_0x4371cf[_0xb512('0x4a')],{})[_0xb512('0x23')](respondWithResult(_0x266b86,0xc9))[_0xb512('0x48')](handleError(_0x266b86,null));};exports[_0xb512('0x4b')]=function(_0x33d80b,_0x1d03e7){return db[_0xb512('0x2b')][_0xb512('0x4b')](_0x33d80b[_0xb512('0x4a')],{'raw':![],'individualHooks':!![]})[_0xb512('0x23')](respondWithResult(_0x1d03e7,0xc9))[_0xb512('0x48')](handleError(_0x1d03e7,null));};exports[_0xb512('0x4c')]=function(_0xf41c5,_0x42534f){if(_0xf41c5[_0xb512('0x4a')]['id']){delete _0xf41c5[_0xb512('0x4a')]['id'];}return db[_0xb512('0x2b')][_0xb512('0x47')]({'where':{'id':_0xf41c5[_0xb512('0x46')]['id']}})['then'](handleEntityNotFound(_0x42534f,null))[_0xb512('0x23')](saveUpdates(_0xf41c5[_0xb512('0x4a')],null))['then'](respondWithResult(_0x42534f,null))[_0xb512('0x48')](handleError(_0x42534f,null));};exports[_0xb512('0x24')]=function(_0x207184,_0x125c9d){return db[_0xb512('0x2b')][_0xb512('0x47')]({'where':{'id':_0x207184[_0xb512('0x46')]['id']}})[_0xb512('0x23')](handleEntityNotFound(_0x125c9d,null))[_0xb512('0x23')](removeEntity(_0x125c9d,null))[_0xb512('0x48')](handleError(_0x125c9d,null));};exports[_0xb512('0x4d')]=function(_0x3602c2,_0x1fbfcc){return db[_0xb512('0x2b')][_0xb512('0x24')]({'where':{'id':_0x3602c2['query'][_0xb512('0x4e')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x1fbfcc,0xcc))[_0xb512('0x48')](handleError(_0x1fbfcc,null));};exports['addFields']=function(_0x26e27,_0x580e44,_0xdb7d08){return db[_0xb512('0x4f')][_0xb512('0x50')]({'where':{'id':_0x26e27[_0xb512('0x46')]['id']}})[_0xb512('0x23')](handleEntityNotFound(_0x580e44,null))[_0xb512('0x23')](function(_0x551700){if(_0x551700){return db['sequelize'][_0xb512('0x51')](function(_0x532bb9){return db[_0xb512('0x2b')][_0xb512('0x24')]({'where':{'CustomReportId':_0x26e27['params']['id']},'transaction':_0x532bb9})[_0xb512('0x23')](function(_0x2ae032){var _0x5b2c37=_[_0xb512('0x2a')](_0x26e27['body'],function(_0x425364){delete _0x425364['id'];_0x425364['CustomReportId']=_0x26e27[_0xb512('0x46')]['id'];return _0x425364;});return db['AnalyticFieldReport']['bulkCreate'](_0x5b2c37,{'transaction':_0x532bb9});});})['then'](function(){return db[_0xb512('0x2b')]['findAll']({'where':{'CustomReportId':_0x26e27[_0xb512('0x46')]['id']}});});}})[_0xb512('0x23')](respondWithResult(_0x580e44,null))['catch'](handleError(_0x580e44,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index ccafc52..5c45787 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 _0xeef3=['../../config/logger','moment','request-promise','path','../../config/environment','AnalyticFieldReport','util'];(function(_0x429e65,_0x1c70eb){var _0x35bb4d=function(_0x18a366){while(--_0x18a366){_0x429e65['push'](_0x429e65['shift']());}};_0x35bb4d(++_0x1c70eb);}(_0xeef3,0x141));var _0x3eef=function(_0x3a0863,_0x4cd5ef){_0x3a0863=_0x3a0863-0x0;var _0x85c557=_0xeef3[_0x3a0863];return _0x85c557;};'use strict';var _=require('lodash');var util=require(_0x3eef('0x0'));var logger=require(_0x3eef('0x1'))('api');var moment=require(_0x3eef('0x2'));var BPromise=require('bluebird');var rp=require(_0x3eef('0x3'));var fs=require('fs');var path=require(_0x3eef('0x4'));var rimraf=require('rimraf');var config=require(_0x3eef('0x5'));var attributes=require('./analyticFieldReport.attributes');module['exports']=function(_0x3be3f0,_0x4a12b3){return _0x3be3f0['define'](_0x3eef('0x6'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a62=['rimraf','../../config/environment','./analyticFieldReport.attributes','define','analytics_report_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x150654,_0x22e377){var _0x28dbee=function(_0x31703f){while(--_0x31703f){_0x150654['push'](_0x150654['shift']());}};_0x28dbee(++_0x22e377);}(_0x3a62,0x1d9));var _0x23a6=function(_0x38b916,_0xddeb09){_0x38b916=_0x38b916-0x0;var _0xa06114=_0x3a62[_0x38b916];return _0xa06114;};'use strict';var _=require(_0x23a6('0x0'));var util=require(_0x23a6('0x1'));var logger=require(_0x23a6('0x2'))(_0x23a6('0x3'));var moment=require(_0x23a6('0x4'));var BPromise=require(_0x23a6('0x5'));var rp=require(_0x23a6('0x6'));var fs=require('fs');var path=require(_0x23a6('0x7'));var rimraf=require(_0x23a6('0x8'));var config=require(_0x23a6('0x9'));var attributes=require(_0x23a6('0xa'));module['exports']=function(_0x2de63c,_0x204658){return _0x2de63c[_0x23a6('0xb')]('AnalyticFieldReport',attributes,{'tableName':_0x23a6('0xc'),'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 abe7ced..7a2163f 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 _0xcb84=['code','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0xcb84,0x72));var _0x4cb8=function(_0x5ebf44,_0x4e543e){_0x5ebf44=_0x5ebf44-0x0;var _0x2fef12=_0xcb84[_0x5ebf44];return _0x2fef12;};'use strict';var _=require(_0x4cb8('0x0'));var util=require(_0x4cb8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4cb8('0x2'));var db=require(_0x4cb8('0x3'))['db'];var utils=require(_0x4cb8('0x4'));var logger=require(_0x4cb8('0x5'))(_0x4cb8('0x6'));var config=require(_0x4cb8('0x7'));var jayson=require(_0x4cb8('0x8'));var client=jayson[_0x4cb8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b9bfe,_0xb0b626,_0x4b129f){return new BPromise(function(_0x463a4e,_0x4c0162){return client[_0x4cb8('0xa')](_0x2b9bfe,_0x4b129f)[_0x4cb8('0xb')](function(_0x2d2e3f){logger[_0x4cb8('0xc')](_0x4cb8('0xd'),_0xb0b626,_0x4cb8('0xe'));logger[_0x4cb8('0xf')](_0x4cb8('0x10'),_0xb0b626,_0x4cb8('0xe'),JSON['stringify'](_0x2d2e3f));if(_0x2d2e3f[_0x4cb8('0x11')]){if(_0x2d2e3f['error'][_0x4cb8('0x12')]===0x1f4){logger[_0x4cb8('0x11')](_0x4cb8('0xd'),_0xb0b626,_0x2d2e3f[_0x4cb8('0x11')]['message']);return _0x4c0162(_0x2d2e3f[_0x4cb8('0x11')][_0x4cb8('0x13')]);}logger[_0x4cb8('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0xb0b626,_0x2d2e3f['error']['message']);return _0x463a4e(_0x2d2e3f[_0x4cb8('0x11')][_0x4cb8('0x13')]);}else{logger[_0x4cb8('0xc')](_0x4cb8('0xd'),_0xb0b626,_0x4cb8('0xe'));_0x463a4e(_0x2d2e3f[_0x4cb8('0x14')][_0x4cb8('0x13')]);}})[_0x4cb8('0x15')](function(_0x2969c8){logger[_0x4cb8('0x11')](_0x4cb8('0xd'),_0xb0b626,_0x2969c8);_0x4c0162(_0x2969c8);});});} \ No newline at end of file +var _0x02bb=['../../config/logger','client','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring'];(function(_0x319e2e,_0x2f727f){var _0x302524=function(_0x5cad9d){while(--_0x5cad9d){_0x319e2e['push'](_0x319e2e['shift']());}};_0x302524(++_0x2f727f);}(_0x02bb,0xc0));var _0xb02b=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x02bb[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xb02b('0x0'));var util=require('util');var moment=require(_0xb02b('0x1'));var BPromise=require('bluebird');var rs=require(_0xb02b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb02b('0x3'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb02b('0x4')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe865f2,_0x2944f4,_0x4057d5){return new BPromise(function(_0x568069,_0x5ba72b){return client['request'](_0xe865f2,_0x4057d5)['then'](function(_0x574718){logger['info'](_0xb02b('0x5'),_0x2944f4,_0xb02b('0x6'));logger[_0xb02b('0x7')](_0xb02b('0x8'),_0x2944f4,'request\x20sent',JSON[_0xb02b('0x9')](_0x574718));if(_0x574718[_0xb02b('0xa')]){if(_0x574718[_0xb02b('0xa')][_0xb02b('0xb')]===0x1f4){logger[_0xb02b('0xa')](_0xb02b('0x5'),_0x2944f4,_0x574718[_0xb02b('0xa')]['message']);return _0x5ba72b(_0x574718[_0xb02b('0xa')][_0xb02b('0xc')]);}logger[_0xb02b('0xa')](_0xb02b('0x5'),_0x2944f4,_0x574718[_0xb02b('0xa')]['message']);return _0x568069(_0x574718[_0xb02b('0xa')][_0xb02b('0xc')]);}else{logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x2944f4,_0xb02b('0x6'));_0x568069(_0x574718[_0xb02b('0xd')][_0xb02b('0xc')]);}})[_0xb02b('0xe')](function(_0x58d30f){logger['error'](_0xb02b('0x5'),_0x2944f4,_0x58d30f);_0x5ba72b(_0x58d30f);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 53c2104..0b6e993 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(_0x13b79a,_0x56ef21){var _0x37e0fe=function(_0x1722ad){while(--_0x1722ad){_0x13b79a['push'](_0x13b79a['shift']());}};_0x37e0fe(++_0x56ef21);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x1cd596,_0x47fcc1){var _0xa3110f=function(_0x571497){while(--_0x571497){_0x1cd596['push'](_0x1cd596['shift']());}};_0xa3110f(++_0x47fcc1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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 d0b6374..53fb391 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 _0xd668=['sequelize','exports','STRING','name'];(function(_0x1fcc95,_0x4c0eb8){var _0x36f120=function(_0x116696){while(--_0x116696){_0x1fcc95['push'](_0x1fcc95['shift']());}};_0x36f120(++_0x4c0eb8);}(_0xd668,0x108));var _0x8d66=function(_0x480409,_0x13b0a5){_0x480409=_0x480409-0x0;var _0x4201bf=_0xd668[_0x480409];return _0x4201bf;};'use strict';var Sequelize=require(_0x8d66('0x0'));module[_0x8d66('0x1')]={'name':{'type':Sequelize[_0x8d66('0x2')],'allowNull':![],'unique':_0x8d66('0x3')},'table':{'type':Sequelize[_0x8d66('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x32d5=['TEXT','sequelize','exports','STRING','name'];(function(_0x539894,_0x12844f){var _0xc4d7b1=function(_0x3a9a9d){while(--_0x3a9a9d){_0x539894['push'](_0x539894['shift']());}};_0xc4d7b1(++_0x12844f);}(_0x32d5,0x1aa));var _0x532d=function(_0x38e67f,_0x2ed34a){_0x38e67f=_0x38e67f-0x0;var _0xf2c42=_0x32d5[_0x38e67f];return _0xf2c42;};'use strict';var Sequelize=require(_0x532d('0x0'));module[_0x532d('0x1')]={'name':{'type':Sequelize[_0x532d('0x2')],'allowNull':![],'unique':_0x532d('0x3')},'table':{'type':Sequelize[_0x532d('0x2')]},'metric':{'type':Sequelize[_0x532d('0x4')]},'description':{'type':Sequelize[_0x532d('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 288c15a..295e587 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 _0x9a19=['AnalyticMetric','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','find','body','user','UserProfileSection','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','save','then','destroy','get','Metrics','stack','name','send','index','map'];(function(_0x43e16a,_0x23ac4c){var _0x43a652=function(_0x30aba5){while(--_0x30aba5){_0x43e16a['push'](_0x43e16a['shift']());}};_0x43a652(++_0x23ac4c);}(_0x9a19,0x114));var _0x99a1=function(_0x166e96,_0x55191d){_0x166e96=_0x166e96-0x0;var _0x553d73=_0x9a19[_0x166e96];return _0x553d73;};'use strict';var emlformat=require(_0x99a1('0x0'));var rimraf=require(_0x99a1('0x1'));var zipdir=require(_0x99a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99a1('0x3'));var moment=require(_0x99a1('0x4'));var BPromise=require(_0x99a1('0x5'));var Mustache=require(_0x99a1('0x6'));var util=require(_0x99a1('0x7'));var path=require(_0x99a1('0x8'));var sox=require(_0x99a1('0x9'));var csv=require(_0x99a1('0xa'));var ejs=require(_0x99a1('0xb'));var fs=require('fs');var fs_extra=require(_0x99a1('0xc'));var _=require(_0x99a1('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x99a1('0xe'));var toCsv=require(_0x99a1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99a1('0xf'));var authService=require(_0x99a1('0x10'));var qs=require(_0x99a1('0x11'));var as=require(_0x99a1('0x12'));var hardwareService=require(_0x99a1('0x13'));var logger=require('../../config/logger')(_0x99a1('0x14'));var utils=require(_0x99a1('0x15'));var config=require(_0x99a1('0x16'));var licenseUtil=require(_0x99a1('0x17'));var db=require(_0x99a1('0x18'))['db'];function respondWithStatusCode(_0x1bc7aa,_0x2ff655){_0x2ff655=_0x2ff655||0xcc;return function(_0x532f56){if(_0x532f56){return _0x1bc7aa[_0x99a1('0x19')](_0x2ff655);}return _0x1bc7aa[_0x99a1('0x1a')](_0x2ff655)[_0x99a1('0x1b')]();};}function respondWithResult(_0x47815e,_0xe1a1f){_0xe1a1f=_0xe1a1f||0xc8;return function(_0x3c9ef4){if(_0x3c9ef4){return _0x47815e[_0x99a1('0x1a')](_0xe1a1f)['json'](_0x3c9ef4);}};}function respondWithFilteredResult(_0x2d81ed,_0x3e45d4){return function(_0x1bb464){if(_0x1bb464){var _0x3d40cc=typeof _0x3e45d4[_0x99a1('0x1c')]===_0x99a1('0x1d')&&typeof _0x3e45d4[_0x99a1('0x1e')]==='undefined';var _0x4f049c=_0x1bb464[_0x99a1('0x1f')];var _0xbf62f1=_0x3d40cc?0x0:_0x3e45d4[_0x99a1('0x1c')];var _0x1fcd00=_0x3d40cc?_0x1bb464[_0x99a1('0x1f')]:_0x3e45d4[_0x99a1('0x1c')]+_0x3e45d4[_0x99a1('0x1e')];var _0x3cd62c;if(_0x1fcd00>=_0x4f049c){_0x1fcd00=_0x4f049c;_0x3cd62c=0xc8;}else{_0x3cd62c=0xce;}_0x2d81ed[_0x99a1('0x1a')](_0x3cd62c);return _0x2d81ed[_0x99a1('0x20')](_0x99a1('0x21'),_0xbf62f1+'-'+_0x1fcd00+'/'+_0x4f049c)['json'](_0x1bb464);}return null;};}function patchUpdates(_0x3023a1){return function(_0x20007e){try{jsonpatch['apply'](_0x20007e,_0x3023a1,!![]);}catch(_0x38435b){return BPromise['reject'](_0x38435b);}return _0x20007e[_0x99a1('0x22')]();};}function saveUpdates(_0x2927b0,_0x2d6f20){return function(_0x2d3b82){if(_0x2d3b82){return _0x2d3b82['update'](_0x2927b0)[_0x99a1('0x23')](function(_0x1268a7){return _0x1268a7;});}return null;};}function removeEntity(_0x483c17,_0x44df2d){return function(_0x5b5dfa){if(_0x5b5dfa){return _0x5b5dfa[_0x99a1('0x24')]()[_0x99a1('0x23')](function(){var _0x179597=_0x5b5dfa[_0x99a1('0x25')]({'plain':!![]});var _0x3c813=_0x99a1('0x26');return db['UserProfileResource'][_0x99a1('0x24')]({'where':{'type':_0x3c813,'resourceId':_0x179597['id']}})['then'](function(){return _0x5b5dfa;});})['then'](function(){_0x483c17[_0x99a1('0x1a')](0xcc)[_0x99a1('0x1b')]();});}};}function handleEntityNotFound(_0xa6799b,_0x15a0b6){return function(_0x25d560){if(!_0x25d560){_0xa6799b[_0x99a1('0x19')](0x194);}return _0x25d560;};}function handleError(_0x183037,_0x549645){_0x549645=_0x549645||0x1f4;return function(_0xf41b0d){logger['error'](_0xf41b0d[_0x99a1('0x27')]);if(_0xf41b0d[_0x99a1('0x28')]){delete _0xf41b0d[_0x99a1('0x28')];}_0x183037['status'](_0x549645)[_0x99a1('0x29')](_0xf41b0d);};}exports[_0x99a1('0x2a')]=function(_0x5718b9,_0x37514e){var _0x1434a0={},_0x36aa34={},_0x303d1e={'count':0x0,'rows':[]};var _0x2a5b8c=_[_0x99a1('0x2b')](db[_0x99a1('0x2c')][_0x99a1('0x2d')],function(_0x52da8d){return{'name':_0x52da8d['fieldName'],'type':_0x52da8d[_0x99a1('0x2e')]['key']};});_0x36aa34[_0x99a1('0x2f')]=_[_0x99a1('0x2b')](_0x2a5b8c,'name');_0x36aa34[_0x99a1('0x30')]=_[_0x99a1('0x31')](_0x5718b9[_0x99a1('0x30')]);_0x36aa34[_0x99a1('0x32')]=_[_0x99a1('0x33')](_0x36aa34[_0x99a1('0x2f')],_0x36aa34[_0x99a1('0x30')]);_0x1434a0[_0x99a1('0x34')]=_[_0x99a1('0x33')](_0x36aa34[_0x99a1('0x2f')],qs[_0x99a1('0x35')](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x35')]));_0x1434a0[_0x99a1('0x34')]=_0x1434a0['attributes']['length']?_0x1434a0[_0x99a1('0x34')]:_0x36aa34[_0x99a1('0x2f')];if(!_0x5718b9[_0x99a1('0x30')][_0x99a1('0x36')](_0x99a1('0x37'))){_0x1434a0[_0x99a1('0x1e')]=qs[_0x99a1('0x1e')](_0x5718b9['query'][_0x99a1('0x1e')]);_0x1434a0[_0x99a1('0x1c')]=qs['offset'](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x1c')]);}_0x1434a0[_0x99a1('0x38')]=qs[_0x99a1('0x39')](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x39')]);_0x1434a0[_0x99a1('0x3a')]=qs[_0x99a1('0x32')](_[_0x99a1('0x3b')](_0x5718b9[_0x99a1('0x30')],_0x36aa34[_0x99a1('0x32')]),_0x2a5b8c);if(_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3c')]){_0x1434a0['where']=_['merge'](_0x1434a0['where'],{'$or':_[_0x99a1('0x2b')](_0x2a5b8c,function(_0x169df7){if(_0x169df7[_0x99a1('0x2e')]!==_0x99a1('0x3d')){var _0x40613a={};_0x40613a[_0x169df7['name']]={'$like':'%'+_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3c')]+'%'};return _0x40613a;}})});}_0x1434a0=_[_0x99a1('0x3e')]({},_0x1434a0,_0x5718b9['options']);var _0x49be37={'where':_0x1434a0[_0x99a1('0x3a')]};return db[_0x99a1('0x2c')][_0x99a1('0x1f')](_0x49be37)['then'](function(_0x6c4cb){_0x303d1e[_0x99a1('0x1f')]=_0x6c4cb;if(_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3f')]){_0x1434a0[_0x99a1('0x40')]=[{'all':!![]}];}return db[_0x99a1('0x2c')][_0x99a1('0x41')](_0x1434a0);})[_0x99a1('0x23')](function(_0x1c4ce4){_0x303d1e[_0x99a1('0x42')]=_0x1c4ce4;return _0x303d1e;})['then'](respondWithFilteredResult(_0x37514e,_0x1434a0))[_0x99a1('0x43')](handleError(_0x37514e,null));};exports[_0x99a1('0x44')]=function(_0x3d5373,_0x50d38b){var _0x1beed2={'raw':!![],'where':{'id':_0x3d5373[_0x99a1('0x45')]['id']}},_0x51536d={};_0x51536d[_0x99a1('0x2f')]=_[_0x99a1('0x31')](db[_0x99a1('0x2c')][_0x99a1('0x2d')]);_0x51536d[_0x99a1('0x30')]=_['keys'](_0x3d5373[_0x99a1('0x30')]);_0x51536d['filters']=_[_0x99a1('0x33')](_0x51536d[_0x99a1('0x2f')],_0x51536d[_0x99a1('0x30')]);_0x1beed2[_0x99a1('0x34')]=_[_0x99a1('0x33')](_0x51536d[_0x99a1('0x2f')],qs[_0x99a1('0x35')](_0x3d5373[_0x99a1('0x30')][_0x99a1('0x35')]));_0x1beed2[_0x99a1('0x34')]=_0x1beed2[_0x99a1('0x34')]['length']?_0x1beed2[_0x99a1('0x34')]:_0x51536d[_0x99a1('0x2f')];if(_0x3d5373['query'][_0x99a1('0x3f')]){_0x1beed2[_0x99a1('0x40')]=[{'all':!![]}];}_0x1beed2=_[_0x99a1('0x3e')]({},_0x1beed2,_0x3d5373[_0x99a1('0x46')]);return db[_0x99a1('0x2c')][_0x99a1('0x47')](_0x1beed2)[_0x99a1('0x23')](handleEntityNotFound(_0x50d38b,null))['then'](respondWithResult(_0x50d38b,null))[_0x99a1('0x43')](handleError(_0x50d38b,null));};exports['create']=function(_0x1d4d3f,_0x269798){return db['AnalyticMetric']['create'](_0x1d4d3f[_0x99a1('0x48')],{})[_0x99a1('0x23')](function(_0x462c15){var _0x4519fb=_0x1d4d3f[_0x99a1('0x49')]['get']({'plain':!![]});if(!_0x4519fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4519fb['role']===_0x99a1('0x49')){var _0x4ae90e=_0x462c15[_0x99a1('0x25')]({'plain':!![]});var _0x30fdfb=_0x99a1('0x26');return db[_0x99a1('0x4a')][_0x99a1('0x47')]({'where':{'name':_0x30fdfb,'userProfileId':_0x4519fb['userProfileId']},'raw':!![]})[_0x99a1('0x23')](function(_0x22bfd8){if(_0x22bfd8&&_0x22bfd8[_0x99a1('0x4b')]===0x0){return db['UserProfileResource'][_0x99a1('0x4c')]({'name':_0x4ae90e['name'],'resourceId':_0x4ae90e['id'],'type':_0x22bfd8['name'],'sectionId':_0x22bfd8['id']},{})[_0x99a1('0x23')](function(){return _0x462c15;});}else{return _0x462c15;}})[_0x99a1('0x43')](function(_0x1dd17b){logger[_0x99a1('0x4d')](_0x99a1('0x4e'),_0x1dd17b);throw _0x1dd17b;});}return _0x462c15;})[_0x99a1('0x23')](respondWithResult(_0x269798,0xc9))[_0x99a1('0x43')](handleError(_0x269798,null));};exports[_0x99a1('0x4f')]=function(_0x16641e,_0x53e9eb){if(_0x16641e[_0x99a1('0x48')]['id']){delete _0x16641e['body']['id'];}return db[_0x99a1('0x2c')][_0x99a1('0x47')]({'where':{'id':_0x16641e['params']['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x53e9eb,null))[_0x99a1('0x23')](saveUpdates(_0x16641e[_0x99a1('0x48')],null))[_0x99a1('0x23')](respondWithResult(_0x53e9eb,null))[_0x99a1('0x43')](handleError(_0x53e9eb,null));};exports[_0x99a1('0x24')]=function(_0x157c49,_0x1a5658){return db[_0x99a1('0x2c')][_0x99a1('0x47')]({'where':{'id':_0x157c49[_0x99a1('0x45')]['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x1a5658,null))['then'](removeEntity(_0x1a5658,null))['catch'](handleError(_0x1a5658,null));}; \ No newline at end of file +var _0x1cb9=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','show','params','keys','length','find','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cb9,0x14e));var _0x91cb=function(_0x329b73,_0x4949f9){_0x329b73=_0x329b73-0x0;var _0x309c4d=_0x1cb9[_0x329b73];return _0x309c4d;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];function respondWithStatusCode(_0x366f09,_0x4ba2f2){_0x4ba2f2=_0x4ba2f2||0xcc;return function(_0x20e6e0){if(_0x20e6e0){return _0x366f09[_0x91cb('0x19')](_0x4ba2f2);}return _0x366f09[_0x91cb('0x1a')](_0x4ba2f2)[_0x91cb('0x1b')]();};}function respondWithResult(_0x4a7d45,_0x4cc6ef){_0x4cc6ef=_0x4cc6ef||0xc8;return function(_0x4aae25){if(_0x4aae25){return _0x4a7d45[_0x91cb('0x1a')](_0x4cc6ef)['json'](_0x4aae25);}};}function respondWithFilteredResult(_0x528f73,_0x576369){return function(_0xc3629e){if(_0xc3629e){var _0x347980=typeof _0x576369['offset']===_0x91cb('0x1c')&&typeof _0x576369[_0x91cb('0x1d')]==='undefined';var _0xc594e3=_0xc3629e[_0x91cb('0x1e')];var _0x1cd34b=_0x347980?0x0:_0x576369[_0x91cb('0x1f')];var _0x5cc1c3=_0x347980?_0xc3629e[_0x91cb('0x1e')]:_0x576369[_0x91cb('0x1f')]+_0x576369['limit'];var _0x123847;if(_0x5cc1c3>=_0xc594e3){_0x5cc1c3=_0xc594e3;_0x123847=0xc8;}else{_0x123847=0xce;}_0x528f73['status'](_0x123847);return _0x528f73['set'](_0x91cb('0x20'),_0x1cd34b+'-'+_0x5cc1c3+'/'+_0xc594e3)[_0x91cb('0x21')](_0xc3629e);}return null;};}function patchUpdates(_0x56e409){return function(_0x51a1d5){try{jsonpatch['apply'](_0x51a1d5,_0x56e409,!![]);}catch(_0x438162){return BPromise[_0x91cb('0x22')](_0x438162);}return _0x51a1d5[_0x91cb('0x23')]();};}function saveUpdates(_0x1dbee2,_0x5c6a15){return function(_0x45c4b3){if(_0x45c4b3){return _0x45c4b3[_0x91cb('0x24')](_0x1dbee2)[_0x91cb('0x25')](function(_0x55fa78){return _0x55fa78;});}return null;};}function removeEntity(_0x26f18f,_0x1a7a54){return function(_0x2447e7){if(_0x2447e7){return _0x2447e7[_0x91cb('0x26')]()[_0x91cb('0x25')](function(){var _0x7ad361=_0x2447e7[_0x91cb('0x27')]({'plain':!![]});var _0x423c4f=_0x91cb('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x423c4f,'resourceId':_0x7ad361['id']}})[_0x91cb('0x25')](function(){return _0x2447e7;});})['then'](function(){_0x26f18f[_0x91cb('0x1a')](0xcc)[_0x91cb('0x1b')]();});}};}function handleEntityNotFound(_0x318031,_0x5595c5){return function(_0x9b26a6){if(!_0x9b26a6){_0x318031['sendStatus'](0x194);}return _0x9b26a6;};}function handleError(_0x4572f6,_0x308e8c){_0x308e8c=_0x308e8c||0x1f4;return function(_0x3b3ee6){logger[_0x91cb('0x29')](_0x3b3ee6[_0x91cb('0x2a')]);if(_0x3b3ee6['name']){delete _0x3b3ee6[_0x91cb('0x2b')];}_0x4572f6['status'](_0x308e8c)[_0x91cb('0x2c')](_0x3b3ee6);};}exports[_0x91cb('0x2d')]=function(_0x445fe1,_0x4944bd){var _0x775c25={},_0x146e1f={},_0x25bbf9={'count':0x0,'rows':[]};var _0x361e4c=_[_0x91cb('0x2e')](db[_0x91cb('0x2f')][_0x91cb('0x30')],function(_0x3bbde3){return{'name':_0x3bbde3[_0x91cb('0x31')],'type':_0x3bbde3['type'][_0x91cb('0x32')]};});_0x146e1f[_0x91cb('0x33')]=_[_0x91cb('0x2e')](_0x361e4c,_0x91cb('0x2b'));_0x146e1f[_0x91cb('0x34')]=_['keys'](_0x445fe1[_0x91cb('0x34')]);_0x146e1f[_0x91cb('0x35')]=_[_0x91cb('0x36')](_0x146e1f[_0x91cb('0x33')],_0x146e1f[_0x91cb('0x34')]);_0x775c25['attributes']=_[_0x91cb('0x36')](_0x146e1f['model'],qs['fields'](_0x445fe1['query'][_0x91cb('0x37')]));_0x775c25['attributes']=_0x775c25[_0x91cb('0x38')]['length']?_0x775c25['attributes']:_0x146e1f[_0x91cb('0x33')];if(!_0x445fe1[_0x91cb('0x34')][_0x91cb('0x39')](_0x91cb('0x3a'))){_0x775c25[_0x91cb('0x1d')]=qs['limit'](_0x445fe1[_0x91cb('0x34')][_0x91cb('0x1d')]);_0x775c25[_0x91cb('0x1f')]=qs[_0x91cb('0x1f')](_0x445fe1['query']['offset']);}_0x775c25[_0x91cb('0x3b')]=qs[_0x91cb('0x3c')](_0x445fe1['query'][_0x91cb('0x3c')]);_0x775c25[_0x91cb('0x3d')]=qs['filters'](_[_0x91cb('0x3e')](_0x445fe1[_0x91cb('0x34')],_0x146e1f['filters']),_0x361e4c);if(_0x445fe1[_0x91cb('0x34')]['filter']){_0x775c25[_0x91cb('0x3d')]=_[_0x91cb('0x3f')](_0x775c25[_0x91cb('0x3d')],{'$or':_[_0x91cb('0x2e')](_0x361e4c,function(_0x51d0ea){if(_0x51d0ea[_0x91cb('0x40')]!=='VIRTUAL'){var _0xa90111={};_0xa90111[_0x51d0ea[_0x91cb('0x2b')]]={'$like':'%'+_0x445fe1['query'][_0x91cb('0x41')]+'%'};return _0xa90111;}})});}_0x775c25=_['merge']({},_0x775c25,_0x445fe1[_0x91cb('0x42')]);var _0x2eac87={'where':_0x775c25[_0x91cb('0x3d')]};return db[_0x91cb('0x2f')]['count'](_0x2eac87)[_0x91cb('0x25')](function(_0x5af0e6){_0x25bbf9[_0x91cb('0x1e')]=_0x5af0e6;if(_0x445fe1[_0x91cb('0x34')][_0x91cb('0x43')]){_0x775c25[_0x91cb('0x44')]=[{'all':!![]}];}return db[_0x91cb('0x2f')][_0x91cb('0x45')](_0x775c25);})[_0x91cb('0x25')](function(_0x3cc4c1){_0x25bbf9['rows']=_0x3cc4c1;return _0x25bbf9;})[_0x91cb('0x25')](respondWithFilteredResult(_0x4944bd,_0x775c25))['catch'](handleError(_0x4944bd,null));};exports[_0x91cb('0x46')]=function(_0x5537a0,_0x335879){var _0x52e82c={'raw':!![],'where':{'id':_0x5537a0[_0x91cb('0x47')]['id']}},_0x138f48={};_0x138f48[_0x91cb('0x33')]=_[_0x91cb('0x48')](db['AnalyticMetric'][_0x91cb('0x30')]);_0x138f48[_0x91cb('0x34')]=_['keys'](_0x5537a0[_0x91cb('0x34')]);_0x138f48[_0x91cb('0x35')]=_[_0x91cb('0x36')](_0x138f48[_0x91cb('0x33')],_0x138f48[_0x91cb('0x34')]);_0x52e82c[_0x91cb('0x38')]=_[_0x91cb('0x36')](_0x138f48[_0x91cb('0x33')],qs[_0x91cb('0x37')](_0x5537a0['query'][_0x91cb('0x37')]));_0x52e82c[_0x91cb('0x38')]=_0x52e82c[_0x91cb('0x38')][_0x91cb('0x49')]?_0x52e82c[_0x91cb('0x38')]:_0x138f48[_0x91cb('0x33')];if(_0x5537a0[_0x91cb('0x34')][_0x91cb('0x43')]){_0x52e82c['include']=[{'all':!![]}];}_0x52e82c=_[_0x91cb('0x3f')]({},_0x52e82c,_0x5537a0[_0x91cb('0x42')]);return db[_0x91cb('0x2f')][_0x91cb('0x4a')](_0x52e82c)['then'](handleEntityNotFound(_0x335879,null))[_0x91cb('0x25')](respondWithResult(_0x335879,null))[_0x91cb('0x4b')](handleError(_0x335879,null));};exports['create']=function(_0x212473,_0x47cdb7){return db[_0x91cb('0x2f')]['create'](_0x212473['body'],{})['then'](function(_0x98245b){var _0xff3d11=_0x212473[_0x91cb('0x4c')][_0x91cb('0x27')]({'plain':!![]});if(!_0xff3d11)throw new Error(_0x91cb('0x4d'));if(_0xff3d11['role']==='user'){var _0x1d26b8=_0x98245b[_0x91cb('0x27')]({'plain':!![]});var _0x140994=_0x91cb('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x140994,'userProfileId':_0xff3d11['userProfileId']},'raw':!![]})[_0x91cb('0x25')](function(_0x490417){if(_0x490417&&_0x490417[_0x91cb('0x4e')]===0x0){return db['UserProfileResource'][_0x91cb('0x4f')]({'name':_0x1d26b8[_0x91cb('0x2b')],'resourceId':_0x1d26b8['id'],'type':_0x490417[_0x91cb('0x2b')],'sectionId':_0x490417['id']},{})[_0x91cb('0x25')](function(){return _0x98245b;});}else{return _0x98245b;}})[_0x91cb('0x4b')](function(_0x362532){logger[_0x91cb('0x29')](_0x91cb('0x50'),_0x362532);throw _0x362532;});}return _0x98245b;})[_0x91cb('0x25')](respondWithResult(_0x47cdb7,0xc9))[_0x91cb('0x4b')](handleError(_0x47cdb7,null));};exports[_0x91cb('0x24')]=function(_0x5752ed,_0x1e445a){if(_0x5752ed[_0x91cb('0x51')]['id']){delete _0x5752ed['body']['id'];}return db[_0x91cb('0x2f')][_0x91cb('0x4a')]({'where':{'id':_0x5752ed['params']['id']}})[_0x91cb('0x25')](handleEntityNotFound(_0x1e445a,null))[_0x91cb('0x25')](saveUpdates(_0x5752ed[_0x91cb('0x51')],null))[_0x91cb('0x25')](respondWithResult(_0x1e445a,null))[_0x91cb('0x4b')](handleError(_0x1e445a,null));};exports[_0x91cb('0x26')]=function(_0x1d4b96,_0x274fff){return db[_0x91cb('0x2f')][_0x91cb('0x4a')]({'where':{'id':_0x1d4b96[_0x91cb('0x47')]['id']}})['then'](handleEntityNotFound(_0x274fff,null))[_0x91cb('0x25')](removeEntity(_0x274fff,null))['catch'](handleError(_0x274fff,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index e566e27..3d9f050 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 _0xea31=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./analyticMetric.attributes','exports','define','analytics_metrics','lodash'];(function(_0x274f77,_0x213eec){var _0x46cae0=function(_0x5902e1){while(--_0x5902e1){_0x274f77['push'](_0x274f77['shift']());}};_0x46cae0(++_0x213eec);}(_0xea31,0x6b));var _0x1ea3=function(_0x2fb508,_0x5d3ff9){_0x2fb508=_0x2fb508-0x0;var _0x55ef5f=_0xea31[_0x2fb508];return _0x55ef5f;};'use strict';var _=require(_0x1ea3('0x0'));var util=require('util');var logger=require(_0x1ea3('0x1'))(_0x1ea3('0x2'));var moment=require(_0x1ea3('0x3'));var BPromise=require(_0x1ea3('0x4'));var rp=require(_0x1ea3('0x5'));var fs=require('fs');var path=require(_0x1ea3('0x6'));var rimraf=require(_0x1ea3('0x7'));var config=require('../../config/environment');var attributes=require(_0x1ea3('0x8'));module[_0x1ea3('0x9')]=function(_0x6810da,_0x27c695){return _0x6810da[_0x1ea3('0xa')]('AnalyticMetric',attributes,{'tableName':_0x1ea3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x444e=['moment','request-promise','rimraf','../../config/environment','./analyticMetric.attributes','exports','AnalyticMetric','lodash','../../config/logger'];(function(_0x1198a7,_0x58ca47){var _0x34e937=function(_0x38ee9b){while(--_0x38ee9b){_0x1198a7['push'](_0x1198a7['shift']());}};_0x34e937(++_0x58ca47);}(_0x444e,0xe8));var _0xe444=function(_0x6561f9,_0x1e1ca5){_0x6561f9=_0x6561f9-0x0;var _0x363ca7=_0x444e[_0x6561f9];return _0x363ca7;};'use strict';var _=require(_0xe444('0x0'));var util=require('util');var logger=require(_0xe444('0x1'))('api');var moment=require(_0xe444('0x2'));var BPromise=require('bluebird');var rp=require(_0xe444('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe444('0x4'));var config=require(_0xe444('0x5'));var attributes=require(_0xe444('0x6'));module[_0xe444('0x7')]=function(_0x36ac3b,_0x1ddb27){return _0x36ac3b['define'](_0xe444('0x8'),attributes,{'tableName':'analytics_metrics','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 ce4355e..04300d1 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 _0x201f=['then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','http','request'];(function(_0x1b2e34,_0x8d3ab5){var _0x13c2b9=function(_0x1d4bb3){while(--_0x1d4bb3){_0x1b2e34['push'](_0x1b2e34['shift']());}};_0x13c2b9(++_0x8d3ab5);}(_0x201f,0xda));var _0xf201=function(_0x32381e,_0x122f77){_0x32381e=_0x32381e-0x0;var _0x1617c8=_0x201f[_0x32381e];return _0x1617c8;};'use strict';var _=require(_0xf201('0x0'));var util=require('util');var moment=require(_0xf201('0x1'));var BPromise=require(_0xf201('0x2'));var rs=require(_0xf201('0x3'));var fs=require('fs');var Redis=require(_0xf201('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf201('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf201('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf201('0x7')][_0xf201('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x42c351,_0x1198b2,_0x150386){return new BPromise(function(_0x1a5694,_0x400562){return client[_0xf201('0x9')](_0x42c351,_0x150386)[_0xf201('0xa')](function(_0x2a019f){logger['info'](_0xf201('0xb'),_0x1198b2,_0xf201('0xc'));logger[_0xf201('0xd')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x1198b2,'request\x20sent',JSON[_0xf201('0xe')](_0x2a019f));if(_0x2a019f['error']){if(_0x2a019f[_0xf201('0xf')][_0xf201('0x10')]===0x1f4){logger[_0xf201('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x1198b2,_0x2a019f[_0xf201('0xf')][_0xf201('0x11')]);return _0x400562(_0x2a019f[_0xf201('0xf')][_0xf201('0x11')]);}logger[_0xf201('0xf')](_0xf201('0xb'),_0x1198b2,_0x2a019f[_0xf201('0xf')][_0xf201('0x11')]);return _0x1a5694(_0x2a019f[_0xf201('0xf')][_0xf201('0x11')]);}else{logger['info'](_0xf201('0xb'),_0x1198b2,_0xf201('0xc'));_0x1a5694(_0x2a019f[_0xf201('0x12')][_0xf201('0x11')]);}})['catch'](function(_0x259677){logger['error'](_0xf201('0xb'),_0x1198b2,_0x259677);_0x400562(_0x259677);});});} \ No newline at end of file +var _0x2fdc=['jayson/promise','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x42e0f0,_0x159d06){var _0x49cf7b=function(_0x1ed106){while(--_0x1ed106){_0x42e0f0['push'](_0x42e0f0['shift']());}};_0x49cf7b(++_0x159d06);}(_0x2fdc,0x1db));var _0xc2fd=function(_0x2181fc,_0x7283aa){_0x2181fc=_0x2181fc-0x0;var _0x315da1=_0x2fdc[_0x2181fc];return _0x315da1;};'use strict';var _=require('lodash');var util=require(_0xc2fd('0x0'));var moment=require(_0xc2fd('0x1'));var BPromise=require(_0xc2fd('0x2'));var rs=require(_0xc2fd('0x3'));var fs=require('fs');var Redis=require(_0xc2fd('0x4'));var db=require(_0xc2fd('0x5'))['db'];var utils=require(_0xc2fd('0x6'));var logger=require('../../config/logger')(_0xc2fd('0x7'));var config=require('../../config/environment');var jayson=require(_0xc2fd('0x8'));var client=jayson[_0xc2fd('0x9')][_0xc2fd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d4ee7,_0x34078d,_0x5df0ab){return new BPromise(function(_0x1096cd,_0x2de47d){return client['request'](_0x4d4ee7,_0x5df0ab)[_0xc2fd('0xb')](function(_0xb52083){logger[_0xc2fd('0xc')](_0xc2fd('0xd'),_0x34078d,_0xc2fd('0xe'));logger[_0xc2fd('0xf')](_0xc2fd('0x10'),_0x34078d,_0xc2fd('0xe'),JSON[_0xc2fd('0x11')](_0xb52083));if(_0xb52083[_0xc2fd('0x12')]){if(_0xb52083[_0xc2fd('0x12')][_0xc2fd('0x13')]===0x1f4){logger[_0xc2fd('0x12')](_0xc2fd('0xd'),_0x34078d,_0xb52083[_0xc2fd('0x12')][_0xc2fd('0x14')]);return _0x2de47d(_0xb52083[_0xc2fd('0x12')][_0xc2fd('0x14')]);}logger['error'](_0xc2fd('0xd'),_0x34078d,_0xb52083['error'][_0xc2fd('0x14')]);return _0x1096cd(_0xb52083[_0xc2fd('0x12')][_0xc2fd('0x14')]);}else{logger[_0xc2fd('0xc')]('AnalyticMetric,\x20%s,\x20%s',_0x34078d,_0xc2fd('0xe'));_0x1096cd(_0xb52083[_0xc2fd('0x15')]['message']);}})[_0xc2fd('0x16')](function(_0x1f2071){logger[_0xc2fd('0x12')](_0xc2fd('0xd'),_0x34078d,_0x1f2071);_0x2de47d(_0x1f2071);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 23c3c8c..56cc637 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 _0x5b5a=['create','put','/:id','update','delete','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','index','isAuthenticated','show','post'];(function(_0x2c0ca7,_0x5e03bc){var _0x14428a=function(_0x40b45f){while(--_0x40b45f){_0x2c0ca7['push'](_0x2c0ca7['shift']());}};_0x14428a(++_0x5e03bc);}(_0x5b5a,0xc3));var _0xa5b5=function(_0x232cbf,_0x3e2f33){_0x232cbf=_0x232cbf-0x0;var _0x1cd460=_0x5b5a[_0x232cbf];return _0x1cd460;};'use strict';var multer=require('multer');var util=require(_0xa5b5('0x0'));var path=require(_0xa5b5('0x1'));var timeout=require('connect-timeout');var express=require(_0xa5b5('0x2'));var router=express[_0xa5b5('0x3')]();var fs_extra=require(_0xa5b5('0x4'));var auth=require(_0xa5b5('0x5'));var interaction=require(_0xa5b5('0x6'));var config=require(_0xa5b5('0x7'));var controller=require(_0xa5b5('0x8'));router[_0xa5b5('0x9')]('/',auth['isAuthenticated'](),controller[_0xa5b5('0xa')]);router[_0xa5b5('0x9')]('/:id',auth[_0xa5b5('0xb')](),controller[_0xa5b5('0xc')]);router[_0xa5b5('0xd')]('/',auth[_0xa5b5('0xb')](),controller[_0xa5b5('0xe')]);router[_0xa5b5('0xf')](_0xa5b5('0x10'),auth[_0xa5b5('0xb')](),controller[_0xa5b5('0x11')]);router[_0xa5b5('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6726=['delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','/:id','show','post','create','put','update'];(function(_0x307086,_0x3bfe4e){var _0x699043=function(_0x1a7677){while(--_0x1a7677){_0x307086['push'](_0x307086['shift']());}};_0x699043(++_0x3bfe4e);}(_0x6726,0xdb));var _0x6672=function(_0x4e6eb2,_0x16a451){_0x4e6eb2=_0x4e6eb2-0x0;var _0x4e0c1c=_0x6726[_0x4e6eb2];return _0x4e0c1c;};'use strict';var multer=require('multer');var util=require(_0x6672('0x0'));var path=require(_0x6672('0x1'));var timeout=require('connect-timeout');var express=require(_0x6672('0x2'));var router=express[_0x6672('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6672('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6672('0x5'));var controller=require(_0x6672('0x6'));router[_0x6672('0x7')]('/',auth[_0x6672('0x8')](),controller['index']);router[_0x6672('0x7')](_0x6672('0x9'),auth[_0x6672('0x8')](),controller[_0x6672('0xa')]);router[_0x6672('0xb')]('/',auth[_0x6672('0x8')](),controller[_0x6672('0xc')]);router[_0x6672('0xd')](_0x6672('0x9'),auth['isAuthenticated'](),controller[_0x6672('0xe')]);router[_0x6672('0xf')]('/:id',auth[_0x6672('0x8')](),controller[_0x6672('0x10')]);module[_0x6672('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 07664fc..e5f5de1 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 _0x2c23=['exports'];(function(_0x40e6b8,_0x2d33f9){var _0x575e92=function(_0x21a515){while(--_0x21a515){_0x40e6b8['push'](_0x40e6b8['shift']());}};_0x575e92(++_0x2d33f9);}(_0x2c23,0xc1));var _0x32c2=function(_0x2bb82d,_0x42c7f8){_0x2bb82d=_0x2bb82d-0x0;var _0x5e0b92=_0x2c23[_0x2bb82d];return _0x5e0b92;};'use strict';var Sequelize=require('sequelize');module[_0x32c2('0x0')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0x3cc5=['TEXT','exports'];(function(_0x1c2d76,_0x535557){var _0x4560f9=function(_0x594661){while(--_0x594661){_0x1c2d76['push'](_0x1c2d76['shift']());}};_0x4560f9(++_0x535557);}(_0x3cc5,0x91));var _0x53cc=function(_0x36fb95,_0x417d9f){_0x36fb95=_0x36fb95-0x0;var _0x11bbf0=_0x3cc5[_0x36fb95];return _0x11bbf0;};'use strict';var Sequelize=require('sequelize');module[_0x53cc('0x0')]={'tree':{'type':Sequelize[_0x53cc('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index fa53e40..dc2e039 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 _0x3ff1=['squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','end','sendStatus','error','stack','name','send','map','AnalyticTreeReport','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','find','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x2a5651,_0x4b9dfa){var _0xcf4e0b=function(_0x1f9c18){while(--_0x1f9c18){_0x2a5651['push'](_0x2a5651['shift']());}};_0xcf4e0b(++_0x4b9dfa);}(_0x3ff1,0xd0));var _0x13ff=function(_0x5efb91,_0x39b378){_0x5efb91=_0x5efb91-0x0;var _0x57ff36=_0x3ff1[_0x5efb91];return _0x57ff36;};'use strict';var emlformat=require(_0x13ff('0x0'));var rimraf=require(_0x13ff('0x1'));var zipdir=require(_0x13ff('0x2'));var jsonpatch=require(_0x13ff('0x3'));var rp=require(_0x13ff('0x4'));var moment=require(_0x13ff('0x5'));var BPromise=require(_0x13ff('0x6'));var Mustache=require(_0x13ff('0x7'));var util=require(_0x13ff('0x8'));var path=require('path');var sox=require(_0x13ff('0x9'));var csv=require(_0x13ff('0xa'));var ejs=require(_0x13ff('0xb'));var fs=require('fs');var fs_extra=require(_0x13ff('0xc'));var _=require(_0x13ff('0xd'));var squel=require(_0x13ff('0xe'));var crypto=require(_0x13ff('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x13ff('0x10'));var toCsv=require(_0x13ff('0xa'));var querystring=require(_0x13ff('0x11'));var Papa=require('papaparse');var Redis=require(_0x13ff('0x12'));var authService=require(_0x13ff('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x13ff('0x14'));var logger=require(_0x13ff('0x15'))('api');var utils=require(_0x13ff('0x16'));var config=require(_0x13ff('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2352a7,_0x39e8a5){_0x39e8a5=_0x39e8a5||0xcc;return function(_0x21adfa){if(_0x21adfa){return _0x2352a7['sendStatus'](_0x39e8a5);}return _0x2352a7['status'](_0x39e8a5)['end']();};}function respondWithResult(_0x2a93fb,_0x257af3){_0x257af3=_0x257af3||0xc8;return function(_0xe80015){if(_0xe80015){return _0x2a93fb[_0x13ff('0x18')](_0x257af3)['json'](_0xe80015);}};}function respondWithFilteredResult(_0x379d58,_0x2740a8){return function(_0x5f2bdf){if(_0x5f2bdf){var _0x3b529d=typeof _0x2740a8[_0x13ff('0x19')]===_0x13ff('0x1a')&&typeof _0x2740a8[_0x13ff('0x1b')]==='undefined';var _0x240f05=_0x5f2bdf[_0x13ff('0x1c')];var _0x2440e9=_0x3b529d?0x0:_0x2740a8['offset'];var _0x262056=_0x3b529d?_0x5f2bdf[_0x13ff('0x1c')]:_0x2740a8[_0x13ff('0x19')]+_0x2740a8[_0x13ff('0x1b')];var _0x399a58;if(_0x262056>=_0x240f05){_0x262056=_0x240f05;_0x399a58=0xc8;}else{_0x399a58=0xce;}_0x379d58[_0x13ff('0x18')](_0x399a58);return _0x379d58[_0x13ff('0x1d')](_0x13ff('0x1e'),_0x2440e9+'-'+_0x262056+'/'+_0x240f05)[_0x13ff('0x1f')](_0x5f2bdf);}return null;};}function patchUpdates(_0x58e0ea){return function(_0xc27205){try{jsonpatch[_0x13ff('0x20')](_0xc27205,_0x58e0ea,!![]);}catch(_0xd89295){return BPromise[_0x13ff('0x21')](_0xd89295);}return _0xc27205[_0x13ff('0x22')]();};}function saveUpdates(_0xa7ab1a,_0x27876e){return function(_0x46f3e5){if(_0x46f3e5){return _0x46f3e5[_0x13ff('0x23')](_0xa7ab1a)[_0x13ff('0x24')](function(_0x686019){return _0x686019;});}return null;};}function removeEntity(_0x5b5d91,_0x268ccc){return function(_0x2f1b0d){if(_0x2f1b0d){return _0x2f1b0d['destroy']()[_0x13ff('0x24')](function(){_0x5b5d91['status'](0xcc)[_0x13ff('0x25')]();});}};}function handleEntityNotFound(_0x178baa,_0x3ace5a){return function(_0x367bc9){if(!_0x367bc9){_0x178baa[_0x13ff('0x26')](0x194);}return _0x367bc9;};}function handleError(_0x386e4c,_0x32cf49){_0x32cf49=_0x32cf49||0x1f4;return function(_0xdbc369){logger[_0x13ff('0x27')](_0xdbc369[_0x13ff('0x28')]);if(_0xdbc369[_0x13ff('0x29')]){delete _0xdbc369[_0x13ff('0x29')];}_0x386e4c[_0x13ff('0x18')](_0x32cf49)[_0x13ff('0x2a')](_0xdbc369);};}exports['index']=function(_0x21a766,_0x3eae4f){var _0x514578={},_0x234960={},_0xa1c997={'count':0x0,'rows':[]};var _0x1bc2b1=_[_0x13ff('0x2b')](db[_0x13ff('0x2c')][_0x13ff('0x2d')],function(_0x3f9e94){return{'name':_0x3f9e94[_0x13ff('0x2e')],'type':_0x3f9e94[_0x13ff('0x2f')]['key']};});_0x234960[_0x13ff('0x30')]=_[_0x13ff('0x2b')](_0x1bc2b1,_0x13ff('0x29'));_0x234960[_0x13ff('0x31')]=_[_0x13ff('0x32')](_0x21a766['query']);_0x234960['filters']=_[_0x13ff('0x33')](_0x234960[_0x13ff('0x30')],_0x234960[_0x13ff('0x31')]);_0x514578['attributes']=_['intersection'](_0x234960['model'],qs[_0x13ff('0x34')](_0x21a766[_0x13ff('0x31')][_0x13ff('0x34')]));_0x514578[_0x13ff('0x35')]=_0x514578[_0x13ff('0x35')][_0x13ff('0x36')]?_0x514578[_0x13ff('0x35')]:_0x234960[_0x13ff('0x30')];if(!_0x21a766[_0x13ff('0x31')]['hasOwnProperty'](_0x13ff('0x37'))){_0x514578[_0x13ff('0x1b')]=qs[_0x13ff('0x1b')](_0x21a766['query'][_0x13ff('0x1b')]);_0x514578[_0x13ff('0x19')]=qs['offset'](_0x21a766[_0x13ff('0x31')][_0x13ff('0x19')]);}_0x514578[_0x13ff('0x38')]=qs[_0x13ff('0x39')](_0x21a766[_0x13ff('0x31')]['sort']);_0x514578['where']=qs[_0x13ff('0x3a')](_[_0x13ff('0x3b')](_0x21a766[_0x13ff('0x31')],_0x234960['filters']),_0x1bc2b1);if(_0x21a766['query'][_0x13ff('0x3c')]){_0x514578[_0x13ff('0x3d')]=_[_0x13ff('0x3e')](_0x514578[_0x13ff('0x3d')],{'$or':_['map'](_0x1bc2b1,function(_0x6b14c5){if(_0x6b14c5['type']!=='VIRTUAL'){var _0x3b9aad={};_0x3b9aad[_0x6b14c5[_0x13ff('0x29')]]={'$like':'%'+_0x21a766['query'][_0x13ff('0x3c')]+'%'};return _0x3b9aad;}})});}_0x514578=_[_0x13ff('0x3e')]({},_0x514578,_0x21a766[_0x13ff('0x3f')]);var _0x549d72={'where':_0x514578[_0x13ff('0x3d')]};return db[_0x13ff('0x2c')][_0x13ff('0x1c')](_0x549d72)['then'](function(_0x30bff7){_0xa1c997[_0x13ff('0x1c')]=_0x30bff7;if(_0x21a766['query'][_0x13ff('0x40')]){_0x514578[_0x13ff('0x41')]=[{'all':!![]}];}return db[_0x13ff('0x2c')][_0x13ff('0x42')](_0x514578);})[_0x13ff('0x24')](function(_0x2eef82){_0xa1c997[_0x13ff('0x43')]=_0x2eef82;return _0xa1c997;})['then'](respondWithFilteredResult(_0x3eae4f,_0x514578))[_0x13ff('0x44')](handleError(_0x3eae4f,null));};exports[_0x13ff('0x45')]=function(_0x91196e,_0x594a8e){var _0x552d7d={'raw':!![],'where':{'id':_0x91196e[_0x13ff('0x46')]['id']}},_0x2a98bf={};_0x2a98bf['model']=_[_0x13ff('0x32')](db[_0x13ff('0x2c')]['rawAttributes']);_0x2a98bf[_0x13ff('0x31')]=_[_0x13ff('0x32')](_0x91196e[_0x13ff('0x31')]);_0x2a98bf[_0x13ff('0x3a')]=_[_0x13ff('0x33')](_0x2a98bf['model'],_0x2a98bf['query']);_0x552d7d[_0x13ff('0x35')]=_[_0x13ff('0x33')](_0x2a98bf[_0x13ff('0x30')],qs[_0x13ff('0x34')](_0x91196e[_0x13ff('0x31')][_0x13ff('0x34')]));_0x552d7d[_0x13ff('0x35')]=_0x552d7d['attributes'][_0x13ff('0x36')]?_0x552d7d['attributes']:_0x2a98bf[_0x13ff('0x30')];if(_0x91196e[_0x13ff('0x31')][_0x13ff('0x40')]){_0x552d7d[_0x13ff('0x41')]=[{'all':!![]}];}_0x552d7d=_[_0x13ff('0x3e')]({},_0x552d7d,_0x91196e['options']);return db[_0x13ff('0x2c')][_0x13ff('0x47')](_0x552d7d)[_0x13ff('0x24')](handleEntityNotFound(_0x594a8e,null))['then'](respondWithResult(_0x594a8e,null))[_0x13ff('0x44')](handleError(_0x594a8e,null));};exports['create']=function(_0x4d60f6,_0x306363){return db[_0x13ff('0x2c')]['create'](_0x4d60f6[_0x13ff('0x48')],{})[_0x13ff('0x24')](respondWithResult(_0x306363,0xc9))['catch'](handleError(_0x306363,null));};exports['update']=function(_0x4ce620,_0x25453e){if(_0x4ce620[_0x13ff('0x48')]['id']){delete _0x4ce620[_0x13ff('0x48')]['id'];}return db[_0x13ff('0x2c')][_0x13ff('0x47')]({'where':{'id':_0x4ce620[_0x13ff('0x46')]['id']}})[_0x13ff('0x24')](handleEntityNotFound(_0x25453e,null))[_0x13ff('0x24')](saveUpdates(_0x4ce620[_0x13ff('0x48')],null))[_0x13ff('0x24')](respondWithResult(_0x25453e,null))[_0x13ff('0x44')](handleError(_0x25453e,null));};exports[_0x13ff('0x49')]=function(_0x217ca5,_0x1d6b33){return db[_0x13ff('0x2c')][_0x13ff('0x47')]({'where':{'id':_0x217ca5[_0x13ff('0x46')]['id']}})['then'](handleEntityNotFound(_0x1d6b33,null))[_0x13ff('0x24')](removeEntity(_0x1d6b33,null))[_0x13ff('0x44')](handleError(_0x1d6b33,null));}; \ No newline at end of file +var _0x9518=['key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','VIRTUAL','AnalyticTreeReport','count','include','findAll','rows','show','params','find','create','catch','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type'];(function(_0x3d40eb,_0x49b32e){var _0x87f08f=function(_0x49f562){while(--_0x49f562){_0x3d40eb['push'](_0x3d40eb['shift']());}};_0x87f08f(++_0x49b32e);}(_0x9518,0x6b));var _0x8951=function(_0x2d69e1,_0x43f881){_0x2d69e1=_0x2d69e1-0x0;var _0x9b5140=_0x9518[_0x2d69e1];return _0x9b5140;};'use strict';var emlformat=require(_0x8951('0x0'));var rimraf=require(_0x8951('0x1'));var zipdir=require(_0x8951('0x2'));var jsonpatch=require(_0x8951('0x3'));var rp=require(_0x8951('0x4'));var moment=require(_0x8951('0x5'));var BPromise=require(_0x8951('0x6'));var Mustache=require('mustache');var util=require(_0x8951('0x7'));var path=require('path');var sox=require(_0x8951('0x8'));var csv=require(_0x8951('0x9'));var ejs=require(_0x8951('0xa'));var fs=require('fs');var fs_extra=require(_0x8951('0xb'));var _=require(_0x8951('0xc'));var squel=require(_0x8951('0xd'));var crypto=require(_0x8951('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8951('0x9'));var querystring=require('querystring');var Papa=require(_0x8951('0xf'));var Redis=require(_0x8951('0x10'));var authService=require(_0x8951('0x11'));var qs=require(_0x8951('0x12'));var as=require(_0x8951('0x13'));var hardwareService=require(_0x8951('0x14'));var logger=require(_0x8951('0x15'))('api');var utils=require(_0x8951('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8951('0x17'));var db=require(_0x8951('0x18'))['db'];function respondWithStatusCode(_0x422f30,_0x5717fb){_0x5717fb=_0x5717fb||0xcc;return function(_0x53d7ab){if(_0x53d7ab){return _0x422f30['sendStatus'](_0x5717fb);}return _0x422f30[_0x8951('0x19')](_0x5717fb)['end']();};}function respondWithResult(_0x1ccac7,_0x569ffa){_0x569ffa=_0x569ffa||0xc8;return function(_0x17aa88){if(_0x17aa88){return _0x1ccac7[_0x8951('0x19')](_0x569ffa)[_0x8951('0x1a')](_0x17aa88);}};}function respondWithFilteredResult(_0x5080cc,_0x234049){return function(_0x1796c4){if(_0x1796c4){var _0x332aaa=typeof _0x234049[_0x8951('0x1b')]===_0x8951('0x1c')&&typeof _0x234049['limit']===_0x8951('0x1c');var _0x173f4d=_0x1796c4['count'];var _0xed8aa3=_0x332aaa?0x0:_0x234049['offset'];var _0x57a9b9=_0x332aaa?_0x1796c4['count']:_0x234049[_0x8951('0x1b')]+_0x234049['limit'];var _0x1578fe;if(_0x57a9b9>=_0x173f4d){_0x57a9b9=_0x173f4d;_0x1578fe=0xc8;}else{_0x1578fe=0xce;}_0x5080cc[_0x8951('0x19')](_0x1578fe);return _0x5080cc[_0x8951('0x1d')](_0x8951('0x1e'),_0xed8aa3+'-'+_0x57a9b9+'/'+_0x173f4d)['json'](_0x1796c4);}return null;};}function patchUpdates(_0x53f891){return function(_0x3bcbff){try{jsonpatch[_0x8951('0x1f')](_0x3bcbff,_0x53f891,!![]);}catch(_0x1b5ae5){return BPromise[_0x8951('0x20')](_0x1b5ae5);}return _0x3bcbff[_0x8951('0x21')]();};}function saveUpdates(_0x3781dd,_0x19231b){return function(_0x28dcee){if(_0x28dcee){return _0x28dcee[_0x8951('0x22')](_0x3781dd)[_0x8951('0x23')](function(_0x95bff0){return _0x95bff0;});}return null;};}function removeEntity(_0x364541,_0x35ad04){return function(_0x32a2cd){if(_0x32a2cd){return _0x32a2cd['destroy']()['then'](function(){_0x364541[_0x8951('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13f444,_0x4c899d){return function(_0x1005e9){if(!_0x1005e9){_0x13f444[_0x8951('0x24')](0x194);}return _0x1005e9;};}function handleError(_0x3a7c72,_0x1898d8){_0x1898d8=_0x1898d8||0x1f4;return function(_0x122d99){logger[_0x8951('0x25')](_0x122d99[_0x8951('0x26')]);if(_0x122d99['name']){delete _0x122d99[_0x8951('0x27')];}_0x3a7c72[_0x8951('0x19')](_0x1898d8)[_0x8951('0x28')](_0x122d99);};}exports[_0x8951('0x29')]=function(_0x321861,_0x27c05e){var _0x3787d3={},_0x2453c3={},_0x3b3ebb={'count':0x0,'rows':[]};var _0x115862=_['map'](db['AnalyticTreeReport'][_0x8951('0x2a')],function(_0x2f4261){return{'name':_0x2f4261[_0x8951('0x2b')],'type':_0x2f4261[_0x8951('0x2c')][_0x8951('0x2d')]};});_0x2453c3[_0x8951('0x2e')]=_[_0x8951('0x2f')](_0x115862,_0x8951('0x27'));_0x2453c3[_0x8951('0x30')]=_[_0x8951('0x31')](_0x321861[_0x8951('0x30')]);_0x2453c3[_0x8951('0x32')]=_[_0x8951('0x33')](_0x2453c3[_0x8951('0x2e')],_0x2453c3[_0x8951('0x30')]);_0x3787d3[_0x8951('0x34')]=_[_0x8951('0x33')](_0x2453c3[_0x8951('0x2e')],qs['fields'](_0x321861[_0x8951('0x30')][_0x8951('0x35')]));_0x3787d3[_0x8951('0x34')]=_0x3787d3[_0x8951('0x34')][_0x8951('0x36')]?_0x3787d3[_0x8951('0x34')]:_0x2453c3[_0x8951('0x2e')];if(!_0x321861['query'][_0x8951('0x37')](_0x8951('0x38'))){_0x3787d3[_0x8951('0x39')]=qs['limit'](_0x321861['query'][_0x8951('0x39')]);_0x3787d3[_0x8951('0x1b')]=qs[_0x8951('0x1b')](_0x321861[_0x8951('0x30')][_0x8951('0x1b')]);}_0x3787d3[_0x8951('0x3a')]=qs['sort'](_0x321861['query']['sort']);_0x3787d3[_0x8951('0x3b')]=qs[_0x8951('0x32')](_[_0x8951('0x3c')](_0x321861[_0x8951('0x30')],_0x2453c3[_0x8951('0x32')]),_0x115862);if(_0x321861['query'][_0x8951('0x3d')]){_0x3787d3[_0x8951('0x3b')]=_[_0x8951('0x3e')](_0x3787d3[_0x8951('0x3b')],{'$or':_[_0x8951('0x2f')](_0x115862,function(_0x304d81){if(_0x304d81[_0x8951('0x2c')]!==_0x8951('0x3f')){var _0x53d489={};_0x53d489[_0x304d81['name']]={'$like':'%'+_0x321861[_0x8951('0x30')][_0x8951('0x3d')]+'%'};return _0x53d489;}})});}_0x3787d3=_['merge']({},_0x3787d3,_0x321861['options']);var _0x3fea04={'where':_0x3787d3[_0x8951('0x3b')]};return db[_0x8951('0x40')][_0x8951('0x41')](_0x3fea04)[_0x8951('0x23')](function(_0x48b18c){_0x3b3ebb[_0x8951('0x41')]=_0x48b18c;if(_0x321861['query']['includeAll']){_0x3787d3[_0x8951('0x42')]=[{'all':!![]}];}return db[_0x8951('0x40')][_0x8951('0x43')](_0x3787d3);})[_0x8951('0x23')](function(_0x4a726d){_0x3b3ebb[_0x8951('0x44')]=_0x4a726d;return _0x3b3ebb;})[_0x8951('0x23')](respondWithFilteredResult(_0x27c05e,_0x3787d3))['catch'](handleError(_0x27c05e,null));};exports[_0x8951('0x45')]=function(_0x337745,_0x317f9b){var _0x5a79f9={'raw':!![],'where':{'id':_0x337745[_0x8951('0x46')]['id']}},_0x1a0ab9={};_0x1a0ab9['model']=_['keys'](db[_0x8951('0x40')][_0x8951('0x2a')]);_0x1a0ab9[_0x8951('0x30')]=_[_0x8951('0x31')](_0x337745[_0x8951('0x30')]);_0x1a0ab9['filters']=_[_0x8951('0x33')](_0x1a0ab9[_0x8951('0x2e')],_0x1a0ab9[_0x8951('0x30')]);_0x5a79f9[_0x8951('0x34')]=_[_0x8951('0x33')](_0x1a0ab9[_0x8951('0x2e')],qs[_0x8951('0x35')](_0x337745[_0x8951('0x30')][_0x8951('0x35')]));_0x5a79f9[_0x8951('0x34')]=_0x5a79f9[_0x8951('0x34')]['length']?_0x5a79f9[_0x8951('0x34')]:_0x1a0ab9[_0x8951('0x2e')];if(_0x337745[_0x8951('0x30')]['includeAll']){_0x5a79f9[_0x8951('0x42')]=[{'all':!![]}];}_0x5a79f9=_[_0x8951('0x3e')]({},_0x5a79f9,_0x337745['options']);return db[_0x8951('0x40')][_0x8951('0x47')](_0x5a79f9)['then'](handleEntityNotFound(_0x317f9b,null))[_0x8951('0x23')](respondWithResult(_0x317f9b,null))['catch'](handleError(_0x317f9b,null));};exports[_0x8951('0x48')]=function(_0x2bc500,_0x23e773){return db[_0x8951('0x40')][_0x8951('0x48')](_0x2bc500['body'],{})['then'](respondWithResult(_0x23e773,0xc9))[_0x8951('0x49')](handleError(_0x23e773,null));};exports[_0x8951('0x22')]=function(_0x54de26,_0x51f7e8){if(_0x54de26[_0x8951('0x4a')]['id']){delete _0x54de26[_0x8951('0x4a')]['id'];}return db[_0x8951('0x40')][_0x8951('0x47')]({'where':{'id':_0x54de26[_0x8951('0x46')]['id']}})[_0x8951('0x23')](handleEntityNotFound(_0x51f7e8,null))[_0x8951('0x23')](saveUpdates(_0x54de26[_0x8951('0x4a')],null))['then'](respondWithResult(_0x51f7e8,null))['catch'](handleError(_0x51f7e8,null));};exports[_0x8951('0x4b')]=function(_0x5be030,_0x2d15b4){return db['AnalyticTreeReport']['find']({'where':{'id':_0x5be030[_0x8951('0x46')]['id']}})[_0x8951('0x23')](handleEntityNotFound(_0x2d15b4,null))[_0x8951('0x23')](removeEntity(_0x2d15b4,null))[_0x8951('0x49')](handleError(_0x2d15b4,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 699c9ed..4a063dc 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 _0x6712=['define','AnalyticTreeReport','util','api','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x6712,0x1cd));var _0x2671=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x6712[_0x53ccf2];return _0x5a2964;};'use strict';var _=require('lodash');var util=require(_0x2671('0x0'));var logger=require('../../config/logger')(_0x2671('0x1'));var moment=require('moment');var BPromise=require(_0x2671('0x2'));var rp=require(_0x2671('0x3'));var fs=require('fs');var path=require(_0x2671('0x4'));var rimraf=require('rimraf');var config=require(_0x2671('0x5'));var attributes=require('./analyticTreeReport.attributes');module[_0x2671('0x6')]=function(_0x5ac6f0,_0xa7744){return _0x5ac6f0[_0x2671('0x7')](_0x2671('0x8'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc153=['./analyticTreeReport.attributes','exports','define','analytics_report_trees','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x23311e,_0x345bf6){var _0x51330c=function(_0xb13dd8){while(--_0xb13dd8){_0x23311e['push'](_0x23311e['shift']());}};_0x51330c(++_0x345bf6);}(_0xc153,0xa9));var _0x3c15=function(_0x14ac82,_0x1f2e00){_0x14ac82=_0x14ac82-0x0;var _0x36f60a=_0xc153[_0x14ac82];return _0x36f60a;};'use strict';var _=require(_0x3c15('0x0'));var util=require(_0x3c15('0x1'));var logger=require('../../config/logger')(_0x3c15('0x2'));var moment=require('moment');var BPromise=require(_0x3c15('0x3'));var rp=require(_0x3c15('0x4'));var fs=require('fs');var path=require(_0x3c15('0x5'));var rimraf=require(_0x3c15('0x6'));var config=require('../../config/environment');var attributes=require(_0x3c15('0x7'));module[_0x3c15('0x8')]=function(_0x1311c1,_0x5704d4){return _0x1311c1[_0x3c15('0x9')]('AnalyticTreeReport',attributes,{'tableName':_0x3c15('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 9fbbaf8..b497650 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 _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x5e91bf,_0x45dfe5){var _0xbc47af=function(_0x174fad){while(--_0x174fad){_0x5e91bf['push'](_0x5e91bf['shift']());}};_0xbc47af(++_0x45dfe5);}(_0x5f66,0x1a0));var _0x65f6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5f66[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x103b75,_0x1370a2){var _0x11589f=function(_0x4abfff){while(--_0x4abfff){_0x103b75['push'](_0x103b75['shift']());}};_0x11589f(++_0x1370a2);}(_0xdb28,0x106));var _0x8db2=function(_0x146729,_0x4e15ef){_0x146729=_0x146729-0x0;var _0x271d1d=_0xdb28[_0x146729];return _0x271d1d;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 29337ce..f62ee17 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 _0xc19b=['index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xc19b,0x1d7));var _0xbc19=function(_0xe3e0af,_0x4564ed){_0xe3e0af=_0xe3e0af-0x0;var _0x4828e9=_0xc19b[_0xe3e0af];return _0x4828e9;};'use strict';var multer=require(_0xbc19('0x0'));var util=require(_0xbc19('0x1'));var path=require(_0xbc19('0x2'));var timeout=require(_0xbc19('0x3'));var express=require(_0xbc19('0x4'));var router=express[_0xbc19('0x5')]();var fs_extra=require(_0xbc19('0x6'));var auth=require(_0xbc19('0x7'));var interaction=require(_0xbc19('0x8'));var config=require(_0xbc19('0x9'));var controller=require(_0xbc19('0xa'));router['get']('/',auth[_0xbc19('0xb')](),controller[_0xbc19('0xc')]);router['get'](_0xbc19('0xd'),auth[_0xbc19('0xb')](),controller[_0xbc19('0xe')]);router[_0xbc19('0xf')]('/',auth['isAuthenticated'](),controller[_0xbc19('0x10')]);router[_0xbc19('0x11')](_0xbc19('0xd'),auth[_0xbc19('0xb')](),controller[_0xbc19('0x12')]);router[_0xbc19('0x13')]('/:id',auth[_0xbc19('0xb')](),controller['destroy']);module[_0xbc19('0x14')]=router; \ No newline at end of file +var _0x974e=['index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated'];(function(_0x4d8a39,_0x1209de){var _0x791cca=function(_0x4a2ca4){while(--_0x4a2ca4){_0x4d8a39['push'](_0x4d8a39['shift']());}};_0x791cca(++_0x1209de);}(_0x974e,0x183));var _0xe974=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x974e[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0xe974('0x0'));var util=require(_0xe974('0x1'));var path=require(_0xe974('0x2'));var timeout=require(_0xe974('0x3'));var express=require(_0xe974('0x4'));var router=express[_0xe974('0x5')]();var fs_extra=require(_0xe974('0x6'));var auth=require(_0xe974('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe974('0x8'));var controller=require(_0xe974('0x9'));router[_0xe974('0xa')]('/',auth[_0xe974('0xb')](),controller[_0xe974('0xc')]);router[_0xe974('0xa')](_0xe974('0xd'),auth['isAuthenticated'](),controller[_0xe974('0xe')]);router[_0xe974('0xf')]('/',auth['isAuthenticated'](),controller[_0xe974('0x10')]);router[_0xe974('0x11')](_0xe974('0xd'),auth[_0xe974('0xb')](),controller['update']);router[_0xe974('0x12')](_0xe974('0xd'),auth[_0xe974('0xb')](),controller[_0xe974('0x13')]);module[_0xe974('0x14')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 2e393ac..e6a7071 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 _0x2494=['sequelize','STRING'];(function(_0x439d86,_0x1350d9){var _0x1da83b=function(_0x407f74){while(--_0x407f74){_0x439d86['push'](_0x439d86['shift']());}};_0x1da83b(++_0x1350d9);}(_0x2494,0x82));var _0x4249=function(_0x5ef484,_0x10d067){_0x5ef484=_0x5ef484-0x0;var _0xba9d5f=_0x2494[_0x5ef484];return _0xba9d5f;};'use strict';var Sequelize=require(_0x4249('0x0'));module['exports']={'name':{'type':Sequelize[_0x4249('0x1')]},'basename':{'type':Sequelize[_0x4249('0x1')]},'type':{'type':Sequelize[_0x4249('0x1')]}}; \ No newline at end of file +var _0xa0bc=['exports','STRING'];(function(_0x1b5b16,_0x44dce9){var _0x46f87e=function(_0x816b20){while(--_0x816b20){_0x1b5b16['push'](_0x1b5b16['shift']());}};_0x46f87e(++_0x44dce9);}(_0xa0bc,0x1b6));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xca0b('0x0')]={'name':{'type':Sequelize[_0xca0b('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xca0b('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 9c47df6..23248a2 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 _0x0695=['include','rows','show','params','length','find','catch','clone','omit','createdAt','updatedAt','body','create','file','originalname','basename','filename','mimetype','download','findOne','join','root','eml-format','rimraf','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','send','index','Attachment','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll'];(function(_0x547456,_0x1de17e){var _0xc1fd7b=function(_0x12be35){while(--_0x12be35){_0x547456['push'](_0x547456['shift']());}};_0xc1fd7b(++_0x1de17e);}(_0x0695,0x16e));var _0x5069=function(_0x270a1f,_0x532619){_0x270a1f=_0x270a1f-0x0;var _0x3baab9=_0x0695[_0x270a1f];return _0x3baab9;};'use strict';var emlformat=require(_0x5069('0x0'));var rimraf=require(_0x5069('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5069('0x2'));var BPromise=require(_0x5069('0x3'));var Mustache=require('mustache');var util=require(_0x5069('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x5069('0x5'));var ejs=require(_0x5069('0x6'));var fs=require('fs');var fs_extra=require(_0x5069('0x7'));var _=require(_0x5069('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5069('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x5069('0x5'));var querystring=require(_0x5069('0xa'));var Papa=require(_0x5069('0xb'));var Redis=require(_0x5069('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x5069('0xd'));var as=require(_0x5069('0xe'));var hardwareService=require(_0x5069('0xf'));var logger=require(_0x5069('0x10'))(_0x5069('0x11'));var utils=require(_0x5069('0x12'));var config=require(_0x5069('0x13'));var licenseUtil=require(_0x5069('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37bf8a,_0x149896){_0x149896=_0x149896||0xcc;return function(_0xf2ae6d){if(_0xf2ae6d){return _0x37bf8a['sendStatus'](_0x149896);}return _0x37bf8a[_0x5069('0x15')](_0x149896)[_0x5069('0x16')]();};}function respondWithResult(_0x36ebd3,_0x84b2a4){_0x84b2a4=_0x84b2a4||0xc8;return function(_0x1b2f81){if(_0x1b2f81){return _0x36ebd3[_0x5069('0x15')](_0x84b2a4)[_0x5069('0x17')](_0x1b2f81);}};}function respondWithFilteredResult(_0x48ed6c,_0xf1df1b){return function(_0x4ce69d){if(_0x4ce69d){var _0x39e2cb=typeof _0xf1df1b['offset']===_0x5069('0x18')&&typeof _0xf1df1b[_0x5069('0x19')]===_0x5069('0x18');var _0xa50009=_0x4ce69d[_0x5069('0x1a')];var _0x559291=_0x39e2cb?0x0:_0xf1df1b['offset'];var _0x43b46a=_0x39e2cb?_0x4ce69d[_0x5069('0x1a')]:_0xf1df1b[_0x5069('0x1b')]+_0xf1df1b[_0x5069('0x19')];var _0x403009;if(_0x43b46a>=_0xa50009){_0x43b46a=_0xa50009;_0x403009=0xc8;}else{_0x403009=0xce;}_0x48ed6c[_0x5069('0x15')](_0x403009);return _0x48ed6c[_0x5069('0x1c')](_0x5069('0x1d'),_0x559291+'-'+_0x43b46a+'/'+_0xa50009)[_0x5069('0x17')](_0x4ce69d);}return null;};}function patchUpdates(_0x7dd897){return function(_0x1343d6){try{jsonpatch[_0x5069('0x1e')](_0x1343d6,_0x7dd897,!![]);}catch(_0x55eebd){return BPromise[_0x5069('0x1f')](_0x55eebd);}return _0x1343d6['save']();};}function saveUpdates(_0x4723c3,_0x62d5f2){return function(_0x2957ec){if(_0x2957ec){return _0x2957ec[_0x5069('0x20')](_0x4723c3)[_0x5069('0x21')](function(_0x16f976){return _0x16f976;});}return null;};}function removeEntity(_0x25a172,_0x25b9da){return function(_0x570a2a){if(_0x570a2a){return _0x570a2a[_0x5069('0x22')]()[_0x5069('0x21')](function(){_0x25a172[_0x5069('0x15')](0xcc)[_0x5069('0x16')]();});}};}function handleEntityNotFound(_0x4498ec,_0xbf3568){return function(_0x2717dc){if(!_0x2717dc){_0x4498ec[_0x5069('0x23')](0x194);}return _0x2717dc;};}function handleError(_0x3caf56,_0x38a591){_0x38a591=_0x38a591||0x1f4;return function(_0x28a1df){logger['error'](_0x28a1df[_0x5069('0x24')]);if(_0x28a1df['name']){delete _0x28a1df['name'];}_0x3caf56[_0x5069('0x15')](_0x38a591)[_0x5069('0x25')](_0x28a1df);};}exports[_0x5069('0x26')]=function(_0x3df89,_0x237ac4){var _0x13e182={},_0x4fe792={},_0x4ada47={'count':0x0,'rows':[]};var _0x5be8ad=_['map'](db[_0x5069('0x27')][_0x5069('0x28')],function(_0x101e92){return{'name':_0x101e92[_0x5069('0x29')],'type':_0x101e92[_0x5069('0x2a')][_0x5069('0x2b')]};});_0x4fe792[_0x5069('0x2c')]=_[_0x5069('0x2d')](_0x5be8ad,_0x5069('0x2e'));_0x4fe792[_0x5069('0x2f')]=_[_0x5069('0x30')](_0x3df89[_0x5069('0x2f')]);_0x4fe792[_0x5069('0x31')]=_[_0x5069('0x32')](_0x4fe792[_0x5069('0x2c')],_0x4fe792[_0x5069('0x2f')]);_0x13e182[_0x5069('0x33')]=_['intersection'](_0x4fe792[_0x5069('0x2c')],qs[_0x5069('0x34')](_0x3df89['query'][_0x5069('0x34')]));_0x13e182['attributes']=_0x13e182[_0x5069('0x33')]['length']?_0x13e182[_0x5069('0x33')]:_0x4fe792[_0x5069('0x2c')];if(!_0x3df89[_0x5069('0x2f')][_0x5069('0x35')](_0x5069('0x36'))){_0x13e182[_0x5069('0x19')]=qs[_0x5069('0x19')](_0x3df89[_0x5069('0x2f')]['limit']);_0x13e182[_0x5069('0x1b')]=qs[_0x5069('0x1b')](_0x3df89[_0x5069('0x2f')][_0x5069('0x1b')]);}_0x13e182[_0x5069('0x37')]=qs[_0x5069('0x38')](_0x3df89['query'][_0x5069('0x38')]);_0x13e182['where']=qs['filters'](_[_0x5069('0x39')](_0x3df89[_0x5069('0x2f')],_0x4fe792[_0x5069('0x31')]),_0x5be8ad);if(_0x3df89[_0x5069('0x2f')]['filter']){_0x13e182[_0x5069('0x3a')]=_[_0x5069('0x3b')](_0x13e182[_0x5069('0x3a')],{'$or':_[_0x5069('0x2d')](_0x5be8ad,function(_0x29c4a5){if(_0x29c4a5[_0x5069('0x2a')]!==_0x5069('0x3c')){var _0x20579f={};_0x20579f[_0x29c4a5[_0x5069('0x2e')]]={'$like':'%'+_0x3df89[_0x5069('0x2f')][_0x5069('0x3d')]+'%'};return _0x20579f;}})});}_0x13e182=_[_0x5069('0x3b')]({},_0x13e182,_0x3df89[_0x5069('0x3e')]);var _0x318dba={'where':_0x13e182[_0x5069('0x3a')]};return db['Attachment'][_0x5069('0x1a')](_0x318dba)[_0x5069('0x21')](function(_0x4047d4){_0x4ada47[_0x5069('0x1a')]=_0x4047d4;if(_0x3df89[_0x5069('0x2f')][_0x5069('0x3f')]){_0x13e182[_0x5069('0x40')]=[{'all':!![]}];}return db[_0x5069('0x27')]['findAll'](_0x13e182);})[_0x5069('0x21')](function(_0x341822){_0x4ada47[_0x5069('0x41')]=_0x341822;return _0x4ada47;})['then'](respondWithFilteredResult(_0x237ac4,_0x13e182))['catch'](handleError(_0x237ac4,null));};exports[_0x5069('0x42')]=function(_0x2b4caa,_0x389b5b){var _0x11683d={'raw':!![],'where':{'id':_0x2b4caa[_0x5069('0x43')]['id']}},_0x46b08a={};_0x46b08a[_0x5069('0x2c')]=_[_0x5069('0x30')](db[_0x5069('0x27')][_0x5069('0x28')]);_0x46b08a[_0x5069('0x2f')]=_[_0x5069('0x30')](_0x2b4caa[_0x5069('0x2f')]);_0x46b08a[_0x5069('0x31')]=_[_0x5069('0x32')](_0x46b08a[_0x5069('0x2c')],_0x46b08a[_0x5069('0x2f')]);_0x11683d[_0x5069('0x33')]=_[_0x5069('0x32')](_0x46b08a[_0x5069('0x2c')],qs[_0x5069('0x34')](_0x2b4caa[_0x5069('0x2f')][_0x5069('0x34')]));_0x11683d['attributes']=_0x11683d[_0x5069('0x33')][_0x5069('0x44')]?_0x11683d[_0x5069('0x33')]:_0x46b08a[_0x5069('0x2c')];if(_0x2b4caa['query']['includeAll']){_0x11683d['include']=[{'all':!![]}];}_0x11683d=_[_0x5069('0x3b')]({},_0x11683d,_0x2b4caa[_0x5069('0x3e')]);return db['Attachment'][_0x5069('0x45')](_0x11683d)['then'](handleEntityNotFound(_0x389b5b,null))[_0x5069('0x21')](respondWithResult(_0x389b5b,null))[_0x5069('0x46')](handleError(_0x389b5b,null));};exports[_0x5069('0x47')]=function(_0x49c18f,_0x10154f){var _0x384c5f={'where':{'id':_0x49c18f[_0x5069('0x43')]['id']}},_0x32bbe1={};_0x32bbe1[_0x5069('0x2c')]=_[_0x5069('0x30')](db[_0x5069('0x27')][_0x5069('0x28')]);_0x384c5f[_0x5069('0x33')]=_[_0x5069('0x32')](_0x32bbe1[_0x5069('0x2c')],qs[_0x5069('0x34')](_0x49c18f['query']['fields']));_0x384c5f[_0x5069('0x33')]=_0x384c5f[_0x5069('0x33')][_0x5069('0x44')]?_0x384c5f[_0x5069('0x33')]:_0x32bbe1[_0x5069('0x2c')];if(_0x49c18f[_0x5069('0x2f')]['includeAll']){_0x384c5f[_0x5069('0x40')]=[{'all':!![]}];}_0x384c5f=_[_0x5069('0x3b')]({},_0x384c5f,_0x49c18f[_0x5069('0x3e')]);return db['Attachment'][_0x5069('0x45')](_0x384c5f)[_0x5069('0x21')](handleEntityNotFound(_0x10154f,null))['then'](function(_0x55417a){if(_0x55417a){var _0x2fad22=_0x55417a['get']({'plain':!![]});_0x2fad22=qs[_0x5069('0x48')](_0x2fad22,['id',_0x5069('0x49'),_0x5069('0x4a')]);_0x49c18f[_0x5069('0x4b')]=_['omit'](_0x49c18f[_0x5069('0x4b')],['id',_0x5069('0x49'),_0x5069('0x4a')]);return db['Attachment'][_0x5069('0x4c')](_[_0x5069('0x3b')](_0x2fad22,_0x49c18f['body']),{'include':_0x49c18f[_0x5069('0x2f')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x5069('0x21')](respondWithResult(_0x10154f,0xc9))['catch'](handleError(_0x10154f,null));};exports[_0x5069('0x20')]=function(_0x1edee7,_0xefc90a){if(_0x1edee7[_0x5069('0x4b')]['id']){delete _0x1edee7[_0x5069('0x4b')]['id'];}return db[_0x5069('0x27')][_0x5069('0x45')]({'where':{'id':_0x1edee7[_0x5069('0x43')]['id']}})[_0x5069('0x21')](handleEntityNotFound(_0xefc90a,null))[_0x5069('0x21')](saveUpdates(_0x1edee7[_0x5069('0x4b')],null))[_0x5069('0x21')](respondWithResult(_0xefc90a,null))['catch'](handleError(_0xefc90a,null));};exports['destroy']=function(_0x50030f,_0x1cc13e){return db['Attachment'][_0x5069('0x45')]({'where':{'id':_0x50030f[_0x5069('0x43')]['id']}})[_0x5069('0x21')](handleEntityNotFound(_0x1cc13e,null))[_0x5069('0x21')](removeEntity(_0x1cc13e,null))[_0x5069('0x46')](handleError(_0x1cc13e,null));};exports[_0x5069('0x4c')]=function(_0x41b0d6,_0x32315a,_0x1a9343){_0x41b0d6[_0x5069('0x4b')]['name']=_0x41b0d6[_0x5069('0x4d')][_0x5069('0x4e')];_0x41b0d6[_0x5069('0x4b')][_0x5069('0x4f')]=_0x41b0d6[_0x5069('0x4d')][_0x5069('0x50')];_0x41b0d6[_0x5069('0x4b')][_0x5069('0x2a')]=_0x41b0d6['file'][_0x5069('0x51')];return db[_0x5069('0x27')][_0x5069('0x4c')](_0x41b0d6[_0x5069('0x4b')])[_0x5069('0x21')](respondWithResult(_0x32315a,0xc9))[_0x5069('0x46')](handleError(_0x32315a,null));};exports[_0x5069('0x52')]=function(_0x2fb4e3,_0x1475cc,_0x125e1d){return db[_0x5069('0x27')][_0x5069('0x53')]({'where':{'id':_0x2fb4e3[_0x5069('0x43')]['id']},'raw':!![]})[_0x5069('0x21')](handleEntityNotFound(_0x1475cc,null))['then'](function(_0xf41968){if(_0xf41968){var _0x110c90=_0xf41968['ChatOfflineMessageId']!==null;var _0x3e1235=path[_0x5069('0x54')](config[_0x5069('0x55')],'server/files/attachments/');if(_0x110c90){_0x3e1235=path[_0x5069('0x54')](_0x3e1235,'offline-chat/');}var _0x5997d5=path[_0x5069('0x54')](_0x3e1235,_0xf41968[_0x5069('0x4f')]);return _0x1475cc['download'](_0x5997d5);}})['catch'](handleError(_0x1475cc,null));}; \ No newline at end of file +var _0xcf5b=['filename','mimetype','download','ChatOfflineMessageId','root','join','basename','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','then','end','sendStatus','error','stack','send','Attachment','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','length','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','fields','find','get','createdAt','updatedAt','body','omit','create','file','originalname'];(function(_0x2016d8,_0x100b3d){var _0xe519af=function(_0x585b14){while(--_0x585b14){_0x2016d8['push'](_0x2016d8['shift']());}};_0xe519af(++_0x100b3d);}(_0xcf5b,0xb3));var _0xbcf5=function(_0x5cb97e,_0x132a39){_0x5cb97e=_0x5cb97e-0x0;var _0x1714b4=_0xcf5b[_0x5cb97e];return _0x1714b4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbcf5('0x0'));var zipdir=require(_0xbcf5('0x1'));var jsonpatch=require(_0xbcf5('0x2'));var rp=require(_0xbcf5('0x3'));var moment=require(_0xbcf5('0x4'));var BPromise=require(_0xbcf5('0x5'));var Mustache=require(_0xbcf5('0x6'));var util=require(_0xbcf5('0x7'));var path=require(_0xbcf5('0x8'));var sox=require('sox');var csv=require(_0xbcf5('0x9'));var ejs=require(_0xbcf5('0xa'));var fs=require('fs');var fs_extra=require(_0xbcf5('0xb'));var _=require(_0xbcf5('0xc'));var squel=require('squel');var crypto=require(_0xbcf5('0xd'));var jsforce=require(_0xbcf5('0xe'));var deskjs=require(_0xbcf5('0xf'));var toCsv=require(_0xbcf5('0x9'));var querystring=require('querystring');var Papa=require(_0xbcf5('0x10'));var Redis=require('ioredis');var authService=require(_0xbcf5('0x11'));var qs=require(_0xbcf5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbcf5('0x13'));var logger=require(_0xbcf5('0x14'))(_0xbcf5('0x15'));var utils=require(_0xbcf5('0x16'));var config=require(_0xbcf5('0x17'));var licenseUtil=require(_0xbcf5('0x18'));var db=require(_0xbcf5('0x19'))['db'];function respondWithStatusCode(_0x12c7e5,_0x524511){_0x524511=_0x524511||0xcc;return function(_0x363592){if(_0x363592){return _0x12c7e5['sendStatus'](_0x524511);}return _0x12c7e5[_0xbcf5('0x1a')](_0x524511)['end']();};}function respondWithResult(_0x20faf9,_0x37a832){_0x37a832=_0x37a832||0xc8;return function(_0xfdaa1c){if(_0xfdaa1c){return _0x20faf9[_0xbcf5('0x1a')](_0x37a832)[_0xbcf5('0x1b')](_0xfdaa1c);}};}function respondWithFilteredResult(_0x37bd31,_0x2757f5){return function(_0x3163f3){if(_0x3163f3){var _0x28e047=typeof _0x2757f5[_0xbcf5('0x1c')]===_0xbcf5('0x1d')&&typeof _0x2757f5[_0xbcf5('0x1e')]===_0xbcf5('0x1d');var _0x3562a9=_0x3163f3[_0xbcf5('0x1f')];var _0x19af52=_0x28e047?0x0:_0x2757f5[_0xbcf5('0x1c')];var _0x38b785=_0x28e047?_0x3163f3['count']:_0x2757f5[_0xbcf5('0x1c')]+_0x2757f5['limit'];var _0xaf0501;if(_0x38b785>=_0x3562a9){_0x38b785=_0x3562a9;_0xaf0501=0xc8;}else{_0xaf0501=0xce;}_0x37bd31['status'](_0xaf0501);return _0x37bd31[_0xbcf5('0x20')](_0xbcf5('0x21'),_0x19af52+'-'+_0x38b785+'/'+_0x3562a9)[_0xbcf5('0x1b')](_0x3163f3);}return null;};}function patchUpdates(_0x1e87d7){return function(_0x223f0b){try{jsonpatch['apply'](_0x223f0b,_0x1e87d7,!![]);}catch(_0x851ea4){return BPromise[_0xbcf5('0x22')](_0x851ea4);}return _0x223f0b['save']();};}function saveUpdates(_0x1c6e83,_0x3718d8){return function(_0x42c5cd){if(_0x42c5cd){return _0x42c5cd[_0xbcf5('0x23')](_0x1c6e83)['then'](function(_0x314db3){return _0x314db3;});}return null;};}function removeEntity(_0x33d480,_0x13d934){return function(_0x364407){if(_0x364407){return _0x364407[_0xbcf5('0x24')]()[_0xbcf5('0x25')](function(){_0x33d480[_0xbcf5('0x1a')](0xcc)[_0xbcf5('0x26')]();});}};}function handleEntityNotFound(_0x5565c7,_0x1dad81){return function(_0x51a2a4){if(!_0x51a2a4){_0x5565c7[_0xbcf5('0x27')](0x194);}return _0x51a2a4;};}function handleError(_0x3c3f45,_0x5367d0){_0x5367d0=_0x5367d0||0x1f4;return function(_0x1777d4){logger[_0xbcf5('0x28')](_0x1777d4[_0xbcf5('0x29')]);if(_0x1777d4['name']){delete _0x1777d4['name'];}_0x3c3f45['status'](_0x5367d0)[_0xbcf5('0x2a')](_0x1777d4);};}exports['index']=function(_0x256679,_0x2ee124){var _0x4c2c49={},_0x3b52fe={},_0x5e6beb={'count':0x0,'rows':[]};var _0x42e462=_['map'](db[_0xbcf5('0x2b')][_0xbcf5('0x2c')],function(_0x9f75e8){return{'name':_0x9f75e8[_0xbcf5('0x2d')],'type':_0x9f75e8[_0xbcf5('0x2e')]['key']};});_0x3b52fe[_0xbcf5('0x2f')]=_['map'](_0x42e462,_0xbcf5('0x30'));_0x3b52fe[_0xbcf5('0x31')]=_[_0xbcf5('0x32')](_0x256679[_0xbcf5('0x31')]);_0x3b52fe[_0xbcf5('0x33')]=_[_0xbcf5('0x34')](_0x3b52fe[_0xbcf5('0x2f')],_0x3b52fe[_0xbcf5('0x31')]);_0x4c2c49[_0xbcf5('0x35')]=_[_0xbcf5('0x34')](_0x3b52fe[_0xbcf5('0x2f')],qs['fields'](_0x256679[_0xbcf5('0x31')]['fields']));_0x4c2c49[_0xbcf5('0x35')]=_0x4c2c49[_0xbcf5('0x35')][_0xbcf5('0x36')]?_0x4c2c49[_0xbcf5('0x35')]:_0x3b52fe[_0xbcf5('0x2f')];if(!_0x256679['query']['hasOwnProperty']('nolimit')){_0x4c2c49[_0xbcf5('0x1e')]=qs['limit'](_0x256679[_0xbcf5('0x31')]['limit']);_0x4c2c49[_0xbcf5('0x1c')]=qs[_0xbcf5('0x1c')](_0x256679[_0xbcf5('0x31')][_0xbcf5('0x1c')]);}_0x4c2c49[_0xbcf5('0x37')]=qs['sort'](_0x256679['query'][_0xbcf5('0x38')]);_0x4c2c49[_0xbcf5('0x39')]=qs[_0xbcf5('0x33')](_[_0xbcf5('0x3a')](_0x256679[_0xbcf5('0x31')],_0x3b52fe['filters']),_0x42e462);if(_0x256679[_0xbcf5('0x31')][_0xbcf5('0x3b')]){_0x4c2c49['where']=_['merge'](_0x4c2c49[_0xbcf5('0x39')],{'$or':_['map'](_0x42e462,function(_0x4942eb){if(_0x4942eb[_0xbcf5('0x2e')]!=='VIRTUAL'){var _0x1b548d={};_0x1b548d[_0x4942eb[_0xbcf5('0x30')]]={'$like':'%'+_0x256679[_0xbcf5('0x31')][_0xbcf5('0x3b')]+'%'};return _0x1b548d;}})});}_0x4c2c49=_[_0xbcf5('0x3c')]({},_0x4c2c49,_0x256679[_0xbcf5('0x3d')]);var _0x564faa={'where':_0x4c2c49['where']};return db[_0xbcf5('0x2b')][_0xbcf5('0x1f')](_0x564faa)[_0xbcf5('0x25')](function(_0x25fa91){_0x5e6beb['count']=_0x25fa91;if(_0x256679[_0xbcf5('0x31')][_0xbcf5('0x3e')]){_0x4c2c49[_0xbcf5('0x3f')]=[{'all':!![]}];}return db[_0xbcf5('0x2b')][_0xbcf5('0x40')](_0x4c2c49);})['then'](function(_0xfce913){_0x5e6beb[_0xbcf5('0x41')]=_0xfce913;return _0x5e6beb;})['then'](respondWithFilteredResult(_0x2ee124,_0x4c2c49))[_0xbcf5('0x42')](handleError(_0x2ee124,null));};exports[_0xbcf5('0x43')]=function(_0x490959,_0x5b83b0){var _0x5a94f5={'raw':!![],'where':{'id':_0x490959[_0xbcf5('0x44')]['id']}},_0x4f4ff9={};_0x4f4ff9[_0xbcf5('0x2f')]=_[_0xbcf5('0x32')](db[_0xbcf5('0x2b')]['rawAttributes']);_0x4f4ff9['query']=_[_0xbcf5('0x32')](_0x490959[_0xbcf5('0x31')]);_0x4f4ff9[_0xbcf5('0x33')]=_[_0xbcf5('0x34')](_0x4f4ff9['model'],_0x4f4ff9[_0xbcf5('0x31')]);_0x5a94f5[_0xbcf5('0x35')]=_[_0xbcf5('0x34')](_0x4f4ff9[_0xbcf5('0x2f')],qs[_0xbcf5('0x45')](_0x490959[_0xbcf5('0x31')][_0xbcf5('0x45')]));_0x5a94f5[_0xbcf5('0x35')]=_0x5a94f5['attributes'][_0xbcf5('0x36')]?_0x5a94f5['attributes']:_0x4f4ff9[_0xbcf5('0x2f')];if(_0x490959[_0xbcf5('0x31')][_0xbcf5('0x3e')]){_0x5a94f5['include']=[{'all':!![]}];}_0x5a94f5=_[_0xbcf5('0x3c')]({},_0x5a94f5,_0x490959[_0xbcf5('0x3d')]);return db[_0xbcf5('0x2b')][_0xbcf5('0x46')](_0x5a94f5)[_0xbcf5('0x25')](handleEntityNotFound(_0x5b83b0,null))[_0xbcf5('0x25')](respondWithResult(_0x5b83b0,null))[_0xbcf5('0x42')](handleError(_0x5b83b0,null));};exports['clone']=function(_0x257bf3,_0x12ee26){var _0x338f4b={'where':{'id':_0x257bf3[_0xbcf5('0x44')]['id']}},_0x27106f={};_0x27106f[_0xbcf5('0x2f')]=_[_0xbcf5('0x32')](db[_0xbcf5('0x2b')][_0xbcf5('0x2c')]);_0x338f4b[_0xbcf5('0x35')]=_[_0xbcf5('0x34')](_0x27106f[_0xbcf5('0x2f')],qs[_0xbcf5('0x45')](_0x257bf3[_0xbcf5('0x31')]['fields']));_0x338f4b['attributes']=_0x338f4b['attributes'][_0xbcf5('0x36')]?_0x338f4b[_0xbcf5('0x35')]:_0x27106f['model'];if(_0x257bf3[_0xbcf5('0x31')][_0xbcf5('0x3e')]){_0x338f4b[_0xbcf5('0x3f')]=[{'all':!![]}];}_0x338f4b=_[_0xbcf5('0x3c')]({},_0x338f4b,_0x257bf3['options']);return db[_0xbcf5('0x2b')][_0xbcf5('0x46')](_0x338f4b)[_0xbcf5('0x25')](handleEntityNotFound(_0x12ee26,null))[_0xbcf5('0x25')](function(_0x2450ab){if(_0x2450ab){var _0x13ac85=_0x2450ab[_0xbcf5('0x47')]({'plain':!![]});_0x13ac85=qs['omit'](_0x13ac85,['id',_0xbcf5('0x48'),_0xbcf5('0x49')]);_0x257bf3[_0xbcf5('0x4a')]=_[_0xbcf5('0x4b')](_0x257bf3['body'],['id',_0xbcf5('0x48'),'updatedAt']);return db[_0xbcf5('0x2b')][_0xbcf5('0x4c')](_[_0xbcf5('0x3c')](_0x13ac85,_0x257bf3[_0xbcf5('0x4a')]),{'include':_0x257bf3[_0xbcf5('0x31')]['includeAll']?[{'all':!![]}]:undefined});}})[_0xbcf5('0x25')](respondWithResult(_0x12ee26,0xc9))[_0xbcf5('0x42')](handleError(_0x12ee26,null));};exports[_0xbcf5('0x23')]=function(_0x139fc2,_0x1f355b){if(_0x139fc2['body']['id']){delete _0x139fc2['body']['id'];}return db[_0xbcf5('0x2b')][_0xbcf5('0x46')]({'where':{'id':_0x139fc2['params']['id']}})[_0xbcf5('0x25')](handleEntityNotFound(_0x1f355b,null))[_0xbcf5('0x25')](saveUpdates(_0x139fc2[_0xbcf5('0x4a')],null))['then'](respondWithResult(_0x1f355b,null))['catch'](handleError(_0x1f355b,null));};exports[_0xbcf5('0x24')]=function(_0x28f0b1,_0x3040f5){return db['Attachment'][_0xbcf5('0x46')]({'where':{'id':_0x28f0b1['params']['id']}})[_0xbcf5('0x25')](handleEntityNotFound(_0x3040f5,null))[_0xbcf5('0x25')](removeEntity(_0x3040f5,null))[_0xbcf5('0x42')](handleError(_0x3040f5,null));};exports[_0xbcf5('0x4c')]=function(_0x704b5c,_0x775dba,_0xa2100){_0x704b5c[_0xbcf5('0x4a')]['name']=_0x704b5c[_0xbcf5('0x4d')][_0xbcf5('0x4e')];_0x704b5c[_0xbcf5('0x4a')]['basename']=_0x704b5c[_0xbcf5('0x4d')][_0xbcf5('0x4f')];_0x704b5c[_0xbcf5('0x4a')][_0xbcf5('0x2e')]=_0x704b5c[_0xbcf5('0x4d')][_0xbcf5('0x50')];return db[_0xbcf5('0x2b')]['create'](_0x704b5c[_0xbcf5('0x4a')])[_0xbcf5('0x25')](respondWithResult(_0x775dba,0xc9))[_0xbcf5('0x42')](handleError(_0x775dba,null));};exports[_0xbcf5('0x51')]=function(_0xd0c8e9,_0x452f15,_0x4f8134){return db[_0xbcf5('0x2b')]['findOne']({'where':{'id':_0xd0c8e9['params']['id']},'raw':!![]})[_0xbcf5('0x25')](handleEntityNotFound(_0x452f15,null))[_0xbcf5('0x25')](function(_0x8a4bd7){if(_0x8a4bd7){var _0x2f2d1f=_0x8a4bd7[_0xbcf5('0x52')]!==null;var _0x5efaee=path['join'](config[_0xbcf5('0x53')],'server/files/attachments/');if(_0x2f2d1f){_0x5efaee=path[_0xbcf5('0x54')](_0x5efaee,'offline-chat/');}var _0x1f5320=path[_0xbcf5('0x54')](_0x5efaee,_0x8a4bd7[_0xbcf5('0x55')]);return _0x452f15[_0xbcf5('0x51')](_0x1f5320);}})[_0xbcf5('0x42')](handleError(_0x452f15,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 814c8a8..0383260 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 _0xea89=['util','../../config/logger','api','moment','path','rimraf','./attachment.attributes','define','attachments'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xea89,0x17a));var _0x9ea8=function(_0x42a36,_0x5dfcaa){_0x42a36=_0x42a36-0x0;var _0x58f817=_0xea89[_0x42a36];return _0x58f817;};'use strict';var _=require('lodash');var util=require(_0x9ea8('0x0'));var logger=require(_0x9ea8('0x1'))(_0x9ea8('0x2'));var moment=require(_0x9ea8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9ea8('0x4'));var rimraf=require(_0x9ea8('0x5'));var config=require('../../config/environment');var attributes=require(_0x9ea8('0x6'));module['exports']=function(_0x29bcbd,_0x32f48c){return _0x29bcbd[_0x9ea8('0x7')]('Attachment',attributes,{'tableName':_0x9ea8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0967=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Attachment','attachments','lodash','util','api'];(function(_0x5a92ee,_0x17ccdb){var _0x4946d6=function(_0x5513cc){while(--_0x5513cc){_0x5a92ee['push'](_0x5a92ee['shift']());}};_0x4946d6(++_0x17ccdb);}(_0x0967,0x142));var _0x7096=function(_0x53af11,_0x2b1403){_0x53af11=_0x53af11-0x0;var _0x17a532=_0x0967[_0x53af11];return _0x17a532;};'use strict';var _=require(_0x7096('0x0'));var util=require(_0x7096('0x1'));var logger=require('../../config/logger')(_0x7096('0x2'));var moment=require(_0x7096('0x3'));var BPromise=require(_0x7096('0x4'));var rp=require(_0x7096('0x5'));var fs=require('fs');var path=require(_0x7096('0x6'));var rimraf=require(_0x7096('0x7'));var config=require(_0x7096('0x8'));var attributes=require('./attachment.attributes');module[_0x7096('0x9')]=function(_0x2f3d60,_0x1235a7){return _0x2f3d60[_0x7096('0xa')](_0x7096('0xb'),attributes,{'tableName':_0x7096('0xc'),'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 2d8271b..9bc12ae 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 _0x1be1=['Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateAttachment','body','options','raw','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Attachment,\x20%s,\x20%s','debug'];(function(_0x117f4c,_0x36a9b1){var _0x2b24e9=function(_0x31761b){while(--_0x31761b){_0x117f4c['push'](_0x117f4c['shift']());}};_0x2b24e9(++_0x36a9b1);}(_0x1be1,0x192));var _0x11be=function(_0x15fe43,_0x19411a){_0x15fe43=_0x15fe43-0x0;var _0x5c5a83=_0x1be1[_0x15fe43];return _0x5c5a83;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x11be('0x0'));var BPromise=require(_0x11be('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11be('0x2'));var db=require(_0x11be('0x3'))['db'];var utils=require(_0x11be('0x4'));var logger=require(_0x11be('0x5'))('rpc');var config=require(_0x11be('0x6'));var jayson=require(_0x11be('0x7'));var client=jayson[_0x11be('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfe8c62,_0x497730,_0x18f661){return new BPromise(function(_0x11fc15,_0x246772){return client[_0x11be('0x9')](_0xfe8c62,_0x18f661)[_0x11be('0xa')](function(_0x5f3d04){logger[_0x11be('0xb')](_0x11be('0xc'),_0x497730,'request\x20sent');logger[_0x11be('0xd')](_0x11be('0xe'),_0x497730,_0x11be('0xf'),JSON[_0x11be('0x10')](_0x5f3d04));if(_0x5f3d04['error']){if(_0x5f3d04[_0x11be('0x11')][_0x11be('0x12')]===0x1f4){logger[_0x11be('0x11')]('Attachment,\x20%s,\x20%s',_0x497730,_0x5f3d04[_0x11be('0x11')][_0x11be('0x13')]);return _0x246772(_0x5f3d04['error'][_0x11be('0x13')]);}logger['error']('Attachment,\x20%s,\x20%s',_0x497730,_0x5f3d04['error']['message']);return _0x11fc15(_0x5f3d04['error']['message']);}else{logger['info'](_0x11be('0xc'),_0x497730,'request\x20sent');_0x11fc15(_0x5f3d04[_0x11be('0x14')][_0x11be('0x13')]);}})[_0x11be('0x15')](function(_0x216b8c){logger['error'](_0x11be('0xc'),_0x497730,_0x216b8c);_0x246772(_0x216b8c);});});}exports[_0x11be('0x16')]=function(_0x56ab61){var _0x299f45=this;return new Promise(function(_0xc3263c,_0x23aa5f){return db['Attachment']['create'](_0x56ab61[_0x11be('0x17')],{'raw':_0x56ab61[_0x11be('0x18')]?_0x56ab61[_0x11be('0x18')][_0x11be('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x12a5bd){logger[_0x11be('0xb')](_0x11be('0x16'),_0x56ab61);logger[_0x11be('0xd')](_0x11be('0x16'),_0x56ab61,JSON[_0x11be('0x10')](_0x12a5bd));_0xc3263c(_0x12a5bd);})[_0x11be('0x15')](function(_0x17678d){logger[_0x11be('0x11')](_0x11be('0x16'),_0x17678d['message'],_0x56ab61);_0x23aa5f(_0x299f45[_0x11be('0x11')](0x1f4,_0x17678d[_0x11be('0x13')]));});});}; \ No newline at end of file +var _0x7dc2=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','CreateAttachment','Attachment','create','body','options','raw','moment','bluebird','randomstring'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7dc2,0x19d));var _0x27dc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7dc2[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x27dc('0x0'));var BPromise=require(_0x27dc('0x1'));var rs=require(_0x27dc('0x2'));var fs=require('fs');var Redis=require(_0x27dc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x27dc('0x4'));var logger=require(_0x27dc('0x5'))('rpc');var config=require(_0x27dc('0x6'));var jayson=require(_0x27dc('0x7'));var client=jayson['client'][_0x27dc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4d2e10,_0x95bbb6,_0x3b3eee){return new BPromise(function(_0x5181ab,_0x45aa07){return client[_0x27dc('0x9')](_0x4d2e10,_0x3b3eee)[_0x27dc('0xa')](function(_0x242997){logger['info'](_0x27dc('0xb'),_0x95bbb6,'request\x20sent');logger[_0x27dc('0xc')](_0x27dc('0xd'),_0x95bbb6,_0x27dc('0xe'),JSON['stringify'](_0x242997));if(_0x242997['error']){if(_0x242997[_0x27dc('0xf')][_0x27dc('0x10')]===0x1f4){logger[_0x27dc('0xf')](_0x27dc('0xb'),_0x95bbb6,_0x242997['error'][_0x27dc('0x11')]);return _0x45aa07(_0x242997['error'][_0x27dc('0x11')]);}logger['error'](_0x27dc('0xb'),_0x95bbb6,_0x242997[_0x27dc('0xf')][_0x27dc('0x11')]);return _0x5181ab(_0x242997[_0x27dc('0xf')]['message']);}else{logger[_0x27dc('0x12')](_0x27dc('0xb'),_0x95bbb6,_0x27dc('0xe'));_0x5181ab(_0x242997[_0x27dc('0x13')][_0x27dc('0x11')]);}})['catch'](function(_0x3ff8f8){logger[_0x27dc('0xf')](_0x27dc('0xb'),_0x95bbb6,_0x3ff8f8);_0x45aa07(_0x3ff8f8);});});}exports[_0x27dc('0x14')]=function(_0x5d308b){var _0x5ecb19=this;return new Promise(function(_0x1ff9a2,_0x225b2c){return db[_0x27dc('0x15')][_0x27dc('0x16')](_0x5d308b[_0x27dc('0x17')],{'raw':_0x5d308b[_0x27dc('0x18')]?_0x5d308b[_0x27dc('0x18')][_0x27dc('0x19')]===undefined?!![]:![]:!![]})[_0x27dc('0xa')](function(_0x5064d5){logger[_0x27dc('0x12')](_0x27dc('0x14'),_0x5d308b);logger['debug'](_0x27dc('0x14'),_0x5d308b,JSON['stringify'](_0x5064d5));_0x1ff9a2(_0x5064d5);})['catch'](function(_0x2843b1){logger['error'](_0x27dc('0x14'),_0x2843b1['message'],_0x5d308b);_0x225b2c(_0x5ecb19['error'](0x1f4,_0x2843b1[_0x27dc('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 4d6515a..ace9f2d 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 _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x21b8c9,_0x1a8624){var _0x3830be=function(_0x1992cb){while(--_0x1992cb){_0x21b8c9['push'](_0x21b8c9['shift']());}};_0x3830be(++_0x1a8624);}(_0xb10b,0x12a));var _0xbb10=function(_0x3763da,_0x58158b){_0x3763da=_0x3763da-0x0;var _0x5d192f=_0xb10b[_0x3763da];return _0x5d192f;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file +var _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x3c51ae,_0x1e28ef){var _0x4b01af=function(_0x176b48){while(--_0x176b48){_0x3c51ae['push'](_0x3c51ae['shift']());}};_0x4b01af(++_0x1e28ef);}(_0xb10b,0x12a));var _0xbb10=function(_0x3700fd,_0x5bd346){_0x3700fd=_0x3700fd-0x0;var _0x4ffb6c=_0xb10b[_0x3700fd];return _0x4ffb6c;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index cc78523..1779ee3 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 _0x7f30=['then','User','find','map','emails','value','user','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','minutes','clearBlockUser','getLicense','catch','passport-google-oauth20','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','login','authenticate','google','/login','profile','email','callback','use','secret','Setting','findOne','allowedLoginAttempts','blockDuration'];(function(_0x8a0d7c,_0xb5fb39){var _0x4bbcfb=function(_0x3cc7f3){while(--_0x3cc7f3){_0x8a0d7c['push'](_0x8a0d7c['shift']());}};_0x4bbcfb(++_0xb5fb39);}(_0x7f30,0x1d7));var _0x07f3=function(_0x18d079,_0x2ce7b2){_0x18d079=_0x18d079-0x0;var _0x506833=_0x7f30[_0x18d079];return _0x506833;};'use strict';var _=require('lodash');var passport=require('passport');var GoogleStrategy=require(_0x07f3('0x0'))['Strategy'];var moment=require(_0x07f3('0x1'));var db=require(_0x07f3('0x2'))['db'];var config=require(_0x07f3('0x3'));var signToken=require(_0x07f3('0x4'))[_0x07f3('0x5')];var utils=require('../../config/utils');exports[_0x07f3('0x6')]=passport[_0x07f3('0x7')](_0x07f3('0x8'),{'failureRedirect':_0x07f3('0x9'),'scope':[_0x07f3('0xa'),_0x07f3('0xb')],'session':![]});exports[_0x07f3('0xc')]=passport[_0x07f3('0x7')](_0x07f3('0x8'),{'failureRedirect':_0x07f3('0x9'),'session':![]});passport[_0x07f3('0xd')](new GoogleStrategy({'clientID':config[_0x07f3('0x8')]?config['google']['clientID']:'id','clientSecret':config[_0x07f3('0x8')]?config['google']['clientSecret']:_0x07f3('0xe'),'callbackURL':config[_0x07f3('0x8')]?config[_0x07f3('0x8')]['callbackURL']:''},function(_0x249e56,_0x7596ff,_0x3ac813,_0x1bf8fc){var _0x4b7108,_0x25ceae;return db[_0x07f3('0xf')][_0x07f3('0x10')]({'where':{'id':0x1},'attributes':[_0x07f3('0x11'),_0x07f3('0x12')],'raw':!![]})[_0x07f3('0x13')](function(_0x1cf85d){_0x4b7108=_0x1cf85d;return db[_0x07f3('0x14')][_0x07f3('0x15')]({'where':{'email':_[_0x07f3('0x16')](_0x3ac813[_0x07f3('0x17')],_0x07f3('0x18')),'role':{'$or':['admin',_0x07f3('0x19'),'agent']}}});})[_0x07f3('0x13')](function(_0x57f671){_0x25ceae=_0x57f671;if(_0x25ceae){if(_0x25ceae[_0x07f3('0x1a')]){return _0x1bf8fc(_0x07f3('0x1b'));}else if(_0x4b7108[_0x07f3('0x12')]>0x0){if(_0x25ceae[_0x07f3('0x1c')]){if(moment(_0x25ceae[_0x07f3('0x1d')])[_0x07f3('0x1e')](_0x4b7108[_0x07f3('0x12')],_0x07f3('0x1f'))>moment()){return _0x1bf8fc(_0x07f3('0x1b'));}else{return utils[_0x07f3('0x20')](_0x25ceae,0x0,![],null)['then'](function(){return utils[_0x07f3('0x21')](_0x25ceae);})[_0x07f3('0x13')](function(){return _0x1bf8fc(null,_0x25ceae);});}}else{return utils[_0x07f3('0x21')](_0x25ceae)['then'](function(){return _0x1bf8fc(null,_0x25ceae);});}}else{return utils[_0x07f3('0x21')](_0x25ceae)['then'](function(){return _0x1bf8fc(null,_0x25ceae);});}}return _0x1bf8fc(_0x07f3('0x1b'));})[_0x07f3('0x22')](function(_0x50eaaa){_0x1bf8fc(_0x50eaaa);});})); \ No newline at end of file +var _0x6797=['moment','../../mysqldb','../../components/auth/service','../../config/utils','login','authenticate','google','/login','profile','callback','use','clientID','clientSecret','secret','callbackURL','Setting','allowedLoginAttempts','blockDuration','then','User','emails','admin','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy'];(function(_0x15fc3c,_0x35665b){var _0x94c5c8=function(_0xbab268){while(--_0xbab268){_0x15fc3c['push'](_0x15fc3c['shift']());}};_0x94c5c8(++_0x35665b);}(_0x6797,0xda));var _0x7679=function(_0x49d22e,_0x594189){_0x49d22e=_0x49d22e-0x0;var _0x529582=_0x6797[_0x49d22e];return _0x529582;};'use strict';var _=require(_0x7679('0x0'));var passport=require(_0x7679('0x1'));var GoogleStrategy=require(_0x7679('0x2'))[_0x7679('0x3')];var moment=require(_0x7679('0x4'));var db=require(_0x7679('0x5'))['db'];var config=require('../../config/environment');var signToken=require(_0x7679('0x6'))['signToken'];var utils=require(_0x7679('0x7'));exports[_0x7679('0x8')]=passport[_0x7679('0x9')](_0x7679('0xa'),{'failureRedirect':_0x7679('0xb'),'scope':[_0x7679('0xc'),'email'],'session':![]});exports[_0x7679('0xd')]=passport[_0x7679('0x9')]('google',{'failureRedirect':_0x7679('0xb'),'session':![]});passport[_0x7679('0xe')](new GoogleStrategy({'clientID':config[_0x7679('0xa')]?config[_0x7679('0xa')][_0x7679('0xf')]:'id','clientSecret':config[_0x7679('0xa')]?config[_0x7679('0xa')][_0x7679('0x10')]:_0x7679('0x11'),'callbackURL':config['google']?config['google'][_0x7679('0x12')]:''},function(_0x36f7d9,_0x4221e7,_0x55df50,_0x18a417){var _0x48d950,_0x36f7b4;return db[_0x7679('0x13')]['findOne']({'where':{'id':0x1},'attributes':[_0x7679('0x14'),_0x7679('0x15')],'raw':!![]})[_0x7679('0x16')](function(_0x20e117){_0x48d950=_0x20e117;return db[_0x7679('0x17')]['find']({'where':{'email':_['map'](_0x55df50[_0x7679('0x18')],'value'),'role':{'$or':[_0x7679('0x19'),_0x7679('0x1a'),_0x7679('0x1b')]}}});})[_0x7679('0x16')](function(_0x42a596){_0x36f7b4=_0x42a596;if(_0x36f7b4){if(_0x36f7b4[_0x7679('0x1c')]){return _0x18a417(_0x7679('0x1d'));}else if(_0x48d950['blockDuration']>0x0){if(_0x36f7b4[_0x7679('0x1e')]){if(moment(_0x36f7b4[_0x7679('0x1f')])[_0x7679('0x20')](_0x48d950[_0x7679('0x15')],_0x7679('0x21'))>moment()){return _0x18a417(_0x7679('0x1d'));}else{return utils[_0x7679('0x22')](_0x36f7b4,0x0,![],null)[_0x7679('0x16')](function(){return utils[_0x7679('0x23')](_0x36f7b4);})[_0x7679('0x16')](function(){return _0x18a417(null,_0x36f7b4);});}}else{return utils[_0x7679('0x23')](_0x36f7b4)[_0x7679('0x16')](function(){return _0x18a417(null,_0x36f7b4);});}}else{return utils[_0x7679('0x23')](_0x36f7b4)['then'](function(){return _0x18a417(null,_0x36f7b4);});}}return _0x18a417(_0x7679('0x1d'));})[_0x7679('0x24')](function(_0x169efd){_0x18a417(_0x169efd);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 7253ea8..e7427bf 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 _0xfb4c=['./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','isMiddleware','exports','express','passport','Router'];(function(_0xa4f435,_0x5be8a0){var _0x3b1cb6=function(_0x3eef8e){while(--_0x3eef8e){_0xa4f435['push'](_0xa4f435['shift']());}};_0x3b1cb6(++_0x5be8a0);}(_0xfb4c,0xc5));var _0xcfb4=function(_0x22376f,_0x1d3e6c){_0x22376f=_0x22376f-0x0;var _0x45c934=_0xfb4c[_0x22376f];return _0x45c934;};'use strict';var express=require(_0xcfb4('0x0'));var passport=require(_0xcfb4('0x1'));var router=express[_0xcfb4('0x2')]();var controller=require(_0xcfb4('0x3'));var userController=require(_0xcfb4('0x4'));var authService=require(_0xcfb4('0x5'));router[_0xcfb4('0x6')]('/',controller[_0xcfb4('0x7')]);router[_0xcfb4('0x6')]('/callback',controller['callback'],authService[_0xcfb4('0x8')],userController['login'],authService['setTokenCookie']);module[_0xcfb4('0x9')]=router; \ No newline at end of file +var _0xadf9=['express','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','login','get','/callback','callback','exports'];(function(_0x12023a,_0x11873d){var _0x3f89a6=function(_0x19ca08){while(--_0x19ca08){_0x12023a['push'](_0x12023a['shift']());}};_0x3f89a6(++_0x11873d);}(_0xadf9,0x154));var _0x9adf=function(_0x5c6244,_0x112ab8){_0x5c6244=_0x5c6244-0x0;var _0x5800ce=_0xadf9[_0x5c6244];return _0x5800ce;};'use strict';var express=require(_0x9adf('0x0'));var passport=require('passport');var router=express[_0x9adf('0x1')]();var controller=require(_0x9adf('0x2'));var userController=require(_0x9adf('0x3'));var authService=require(_0x9adf('0x4'));router['get']('/',controller[_0x9adf('0x5')]);router[_0x9adf('0x6')](_0x9adf('0x7'),controller[_0x9adf('0x8')],authService['isMiddleware'],userController[_0x9adf('0x5')],authService['setTokenCookie']);module[_0x9adf('0x9')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 32e765e..b70cc6d 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 _0x298c=['passwordHistoryLimit','Password\x20reset!','use','User','util','passport','passport-local','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','password','salt','role','disabled','blocked','blockedAt','loginAttempts','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service','host','port','secure','authentication','auth','user','merge','format','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','authenticate','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','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','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','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','validatePasswordPattern','validatePasswordHistory','previousPasswords'];(function(_0x4b7d92,_0x588b43){var _0xe931a=function(_0x5591ef){while(--_0x5591ef){_0x4b7d92['push'](_0x4b7d92['shift']());}};_0xe931a(++_0x588b43);}(_0x298c,0x106));var _0xc298=function(_0x4e09fd,_0x4b8809){_0x4e09fd=_0x4e09fd-0x0;var _0xe8e808=_0x298c[_0x4e09fd];return _0xe8e808;};'use strict';var util=require(_0xc298('0x0'));var passport=require(_0xc298('0x1'));var LocalStrategy=require(_0xc298('0x2'))['Strategy'];var jayson=require(_0xc298('0x3'));var _=require(_0xc298('0x4'));var rs=require(_0xc298('0x5'));var moment=require(_0xc298('0x6'));var db=require(_0xc298('0x7'))['db'];var authService=require(_0xc298('0x8'));var utils=require('../../config/utils');var client=jayson[_0xc298('0x9')][_0xc298('0xa')]({'port':0x232b});function localAuthenticate(_0xeef138,_0x27c69e,_0x1f5866,_0x13f0cd){var _0x4af34d,_0x46de8b;return db[_0xc298('0xb')][_0xc298('0xc')]({'where':{'id':0x1},'attributes':[_0xc298('0xd'),_0xc298('0xe')],'raw':!![]})[_0xc298('0xf')](function(_0x2fe39b){_0x4af34d=_0x2fe39b;return _0xeef138['findOne']({'attributes':['id','name',_0xc298('0x10'),_0xc298('0x11'),_0xc298('0x12'),_0xc298('0x13'),_0xc298('0x14'),_0xc298('0x15'),_0xc298('0x16')],'where':{'name':_0x27c69e,'role':{'$or':['admin','user',_0xc298('0x17')]}}});})[_0xc298('0xf')](function(_0x56d029){if(!_0x56d029||_0x56d029&&_0x56d029[_0xc298('0x18')]!==_0x27c69e){throw new Error(_0xc298('0x19'));}else{_0x46de8b=_0x56d029;return _0x46de8b;}})['then'](function(){_0x46de8b['authenticate'](_0x1f5866,function(_0x4a565d,_0x292c39){var _0x2f3560=_0x46de8b[_0xc298('0x16')]+0x1;if(_0x4a565d){return _0x13f0cd(_0x4a565d);}else if(!_0x292c39){if(_0x46de8b[_0xc298('0x13')]){return _0x13f0cd(null,![],{'message':_0xc298('0x19')});}else if(_0x4af34d[_0xc298('0xd')]>0x0){if(_0x46de8b[_0xc298('0x14')]){if(_0x4af34d[_0xc298('0xe')]>0x0){if(moment(_0x46de8b[_0xc298('0x15')])[_0xc298('0x1a')](_0x4af34d[_0xc298('0xe')],_0xc298('0x1b'))>moment()){return _0x13f0cd(null,![],{'message':_0xc298('0x19')});}else{return utils[_0xc298('0x1c')](_0x46de8b,_0x2f3560,![],null)['then'](function(){return _0x13f0cd(null,![],{'message':_0xc298('0x19')});});}}else{return _0x13f0cd(null,![],{'message':_0xc298('0x19')});}}else{if(_0x2f3560>=_0x4af34d[_0xc298('0xd')]){return utils[_0xc298('0x1c')](_0x46de8b,0x0,!![],moment())[_0xc298('0xf')](function(){return _0x13f0cd(null,![],{'message':_0xc298('0x19')});});}else{return utils[_0xc298('0x1c')](_0x46de8b,_0x2f3560,![],null)['then'](function(){return _0x13f0cd(null,![],{'message':_0xc298('0x19')});});}}}else{return _0x13f0cd(null,![],{'message':_0xc298('0x19')});}}else{if(_0x46de8b['disabled']){return _0x13f0cd(null,![],{'message':_0xc298('0x19')});}else if(_0x4af34d['allowedLoginAttempts']>0x0){if(_0x46de8b[_0xc298('0x14')]){if(_0x4af34d[_0xc298('0xe')]>0x0){if(moment(_0x46de8b[_0xc298('0x15')])[_0xc298('0x1a')](_0x4af34d[_0xc298('0xe')],_0xc298('0x1b'))>moment()){return _0x13f0cd(null,![],{'message':_0xc298('0x19')});}else{return utils['clearBlockUser'](_0x46de8b,0x0,![],null)[_0xc298('0xf')](function(){return utils[_0xc298('0x1d')](_0x46de8b);})[_0xc298('0xf')](function(){return _0x13f0cd(null,_0x46de8b);});}}else{return _0x13f0cd(null,![],{'message':_0xc298('0x19')});}}else{return utils[_0xc298('0x1c')](_0x46de8b,0x0,![],null)[_0xc298('0xf')](function(){return utils[_0xc298('0x1d')](_0x46de8b);})['then'](function(){return _0x13f0cd(null,_0x46de8b);})['catch'](function(_0x15c214){return _0x13f0cd(null,![],_0x15c214);});}}else{if(_0x46de8b[_0xc298('0x14')]){return _0x13f0cd(null,![],{'message':_0xc298('0x19')});}else{return utils[_0xc298('0x1d')](_0x46de8b)[_0xc298('0xf')](function(){return _0x13f0cd(null,_0x46de8b);});}}}});})[_0xc298('0x1e')](function(_0x391864){return _0x13f0cd(null,![],_0x391864);});}function sendServiceMail(_0x184e05){return db[_0xc298('0x1f')][_0xc298('0x20')]({'where':{'service':!![]},'attributes':['id',_0xc298('0x18'),_0xc298('0x21')],'include':[{'model':db['MailServerOut'],'as':'Smtp'}]})['then'](function(_0x4c4ddd){if(!_0x4c4ddd){throw new Error(_0xc298('0x22'));}var _0x3e5ffe={'tls':{'rejectUnauthorized':![]}};if(_0x4c4ddd[_0xc298('0x23')][_0xc298('0x24')]){_0x3e5ffe['service']=_0x4c4ddd['Smtp'][_0xc298('0x24')];}else{_0x3e5ffe[_0xc298('0x25')]=_0x4c4ddd['Smtp']['host'];_0x3e5ffe[_0xc298('0x26')]=_0x4c4ddd[_0xc298('0x23')]['port'];_0x3e5ffe[_0xc298('0x27')]=_0x4c4ddd[_0xc298('0x23')][_0xc298('0x27')];}if(_0x4c4ddd[_0xc298('0x23')][_0xc298('0x28')]){_0x3e5ffe[_0xc298('0x29')]={'user':_0x4c4ddd[_0xc298('0x23')][_0xc298('0x2a')],'pass':_0x4c4ddd['Smtp']['pass']};}var _0x2fafe2={'account':_0x3e5ffe,'message':_[_0xc298('0x2b')]({'from':util[_0xc298('0x2c')]('\x22%s\x22\x20<%s>',_0x4c4ddd['name'],_0x4c4ddd[_0xc298('0x21')]||_0x4c4ddd[_0xc298('0x23')][_0xc298('0x2a')])},_0x184e05)};return client['request']('SendMail',_0x2fafe2);})[_0xc298('0xf')](function(_0x2a327b){if(_0x2a327b[_0xc298('0x2d')]){throw new Error(util[_0xc298('0x2c')](_0xc298('0x2e'),_0x2a327b['error'][_0xc298('0x2f')]||JSON[_0xc298('0x30')](_0x2a327b['error'])));}return!![];});}function handleError(_0x272290,_0x1998e6,_0x2d4eeb){return _0x272290[_0xc298('0x31')](_0x1998e6||0x1f4)[_0xc298('0x32')]({'message':_0x2d4eeb?_0x2d4eeb[_0xc298('0x2f')]||_0x2d4eeb:''});}exports[_0xc298('0x33')]=function(_0x501786,_0x3cf349,_0x707740){passport[_0xc298('0x34')](_0xc298('0x35'),function(_0x25df3c,_0x33c862,_0x1e9e0f){var _0x50c358=_0x25df3c||_0x1e9e0f;if(_0x50c358){return handleError(_0x3cf349,0x191,_0x50c358);}if(!_0x33c862){return handleError(_0x3cf349,0x194,{'message':_0xc298('0x36')});}else{var _0x4d0a6d={'payload':{'id':_0x33c862['id'],'role':_0x33c862[_0xc298('0x12')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x4d0a6d)[_0xc298('0xf')](function(_0x4aeef6){_0x3cf349[_0xc298('0x37')]({'id':_0x33c862['id'],'token':_0x4aeef6,'statusCall':'','isAlreadyLogged':_0x33c862[_0xc298('0x38')]});});}})(_0x501786,_0x3cf349,_0x707740);};exports[_0xc298('0x39')]=function(_0x666d72,_0x5c34e7,_0x3502a7){if(!_0x666d72[_0xc298('0x3a')]['email']){return handleError(_0x5c34e7,0x1f4,{'message':_0xc298('0x3b')});}var _0x23a4d4=rs[_0xc298('0x3c')]();_0x666d72[_0xc298('0x3a')][_0xc298('0x21')]=_0x666d72[_0xc298('0x3a')]['email'][_0xc298('0x3d')]()[_0xc298('0x3e')]();var _0x20fcbe;return db[_0xc298('0xb')][_0xc298('0xc')]({'where':{'id':0x1},'attributes':[_0xc298('0xd'),_0xc298('0xe')],'raw':!![]})[_0xc298('0xf')](function(_0x578a22){_0x20fcbe=_0x578a22;return db['User'][_0xc298('0x20')]({'where':{'email':_0x666d72[_0xc298('0x3a')][_0xc298('0x21')]}});})[_0xc298('0xf')](function(_0x37c885){if(!_0x37c885){throw new Error(_0xc298('0x3f'));}if(_0x37c885[_0xc298('0x13')]){throw new Error(_0xc298('0x40'));}if(_0x37c885[_0xc298('0x14')]){if(moment(_0x37c885[_0xc298('0x15')])[_0xc298('0x1a')](_0x20fcbe['blockDuration'],_0xc298('0x1b'))>moment()){throw new Error(_0xc298('0x41'));}else{_0x37c885[_0xc298('0x14')]=![];_0x37c885[_0xc298('0x15')]=null;}}_0x37c885[_0xc298('0x42')]=_0x23a4d4;_0x37c885[_0xc298('0x43')]=Date[_0xc298('0x44')]()+0x36ee80;return _0x37c885[_0xc298('0x45')]();})[_0xc298('0xf')](function(){return sendServiceMail({'to':_0x666d72[_0xc298('0x3a')][_0xc298('0x21')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xc298('0x46')+_0xc298('0x47')+_0xc298('0x48')+_0x666d72['headers'][_0xc298('0x25')]+'/reset/'+_0x23a4d4+'\x0a\x0a'+_0xc298('0x49')});})[_0xc298('0xf')](function(){_0x5c34e7[_0xc298('0x31')](0xc8)[_0xc298('0x32')]({'message':'Reset\x20Email\x20sent!'});})[_0xc298('0x1e')](function(_0x5c06ac){return handleError(_0x5c34e7,0x1f4,_0x5c06ac);});};exports[_0xc298('0x4a')]=function(_0x3b3464,_0x3ae7d4,_0x1e4051){return db['User']['find']({'where':{'resetPasswordToken':_0x3b3464[_0xc298('0x4b')]['token'],'resetPasswordExpires':{'$gt':Date[_0xc298('0x44')]()}}})[_0xc298('0xf')](function(_0x116b1b){if(!_0x116b1b){throw new Error(_0xc298('0x4c'));}return db[_0xc298('0xb')][_0xc298('0xc')]({'attributes':['id',_0xc298('0x4d'),_0xc298('0x4e'),'passwordHistoryLimit']})[_0xc298('0xf')](function(_0x44f046){if(_0x44f046['securePassword'])authService[_0xc298('0x4f')](_0x3b3464[_0xc298('0x3a')][_0xc298('0x10')]);if(!_0x44f046[_0xc298('0x4e')]||!_0x116b1b['previousPasswords'])return _0x116b1b;authService[_0xc298('0x50')](_0x3b3464['body'][_0xc298('0x10')],_0x116b1b[_0xc298('0x51')],_0x44f046[_0xc298('0x52')]);return _0x116b1b;})[_0xc298('0xf')](function(){_0x116b1b['password']=_0x3b3464[_0xc298('0x3a')][_0xc298('0x10')];_0x116b1b['resetPasswordToken']=null;_0x116b1b[_0xc298('0x43')]=null;return _0x116b1b[_0xc298('0x45')]();});})[_0xc298('0xf')](function(){_0x3ae7d4[_0xc298('0x31')](0xc8)[_0xc298('0x32')]({'message':_0xc298('0x53')});})[_0xc298('0x1e')](function(_0x177cc6){return handleError(_0x3ae7d4,0x1f4,_0x177cc6);});};passport[_0xc298('0x54')](new LocalStrategy({'usernameField':_0xc298('0x18'),'passwordField':_0xc298('0x10')},function(_0x2c007b,_0x2c61c4,_0x5c1163){return localAuthenticate(db[_0xc298('0x55')],_0x2c007b,_0x2c61c4,_0x5c1163);})); \ No newline at end of file +var _0xaf80=['Strategy','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blockedAt','loginAttempts','admin','user','agent','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','minutes','clearBlockUser','getLicense','blocked','catch','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','merge','format','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','send','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','forgot','generate','body','trim','findOne','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','save','xCally\x20Motion\x20Password\x20Reset','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','params','token','now','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','resetPasswordToken','use','util','passport','passport-local'];(function(_0x5b06b4,_0x5e8611){var _0x3c5245=function(_0x8153ae){while(--_0x8153ae){_0x5b06b4['push'](_0x5b06b4['shift']());}};_0x3c5245(++_0x5e8611);}(_0xaf80,0x1ef));var _0x0af8=function(_0x5a4514,_0x3057a7){_0x5a4514=_0x5a4514-0x0;var _0x248847=_0xaf80[_0x5a4514];return _0x248847;};'use strict';var util=require(_0x0af8('0x0'));var passport=require(_0x0af8('0x1'));var LocalStrategy=require(_0x0af8('0x2'))[_0x0af8('0x3')];var jayson=require('jayson/promise');var _=require('lodash');var rs=require('randomstring');var moment=require(_0x0af8('0x4'));var db=require(_0x0af8('0x5'))['db'];var authService=require(_0x0af8('0x6'));var utils=require(_0x0af8('0x7'));var client=jayson[_0x0af8('0x8')][_0x0af8('0x9')]({'port':0x232b});function localAuthenticate(_0x5180bf,_0x4bce2c,_0x28f555,_0x538c1c){var _0x207a9b,_0x430bd4;return db[_0x0af8('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0x0af8('0xb'),_0x0af8('0xc')],'raw':!![]})[_0x0af8('0xd')](function(_0x55964b){_0x207a9b=_0x55964b;return _0x5180bf['findOne']({'attributes':['id',_0x0af8('0xe'),_0x0af8('0xf'),_0x0af8('0x10'),_0x0af8('0x11'),_0x0af8('0x12'),'blocked',_0x0af8('0x13'),_0x0af8('0x14')],'where':{'name':_0x4bce2c,'role':{'$or':[_0x0af8('0x15'),_0x0af8('0x16'),_0x0af8('0x17')]}}});})[_0x0af8('0xd')](function(_0xe51111){if(!_0xe51111||_0xe51111&&_0xe51111['name']!==_0x4bce2c){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x430bd4=_0xe51111;return _0x430bd4;}})[_0x0af8('0xd')](function(){_0x430bd4[_0x0af8('0x18')](_0x28f555,function(_0x287cfc,_0x216f0b){var _0x2a42a4=_0x430bd4[_0x0af8('0x14')]+0x1;if(_0x287cfc){return _0x538c1c(_0x287cfc);}else if(!_0x216f0b){if(_0x430bd4[_0x0af8('0x12')]){return _0x538c1c(null,![],{'message':_0x0af8('0x19')});}else if(_0x207a9b['allowedLoginAttempts']>0x0){if(_0x430bd4['blocked']){if(_0x207a9b['blockDuration']>0x0){if(moment(_0x430bd4[_0x0af8('0x13')])[_0x0af8('0x1a')](_0x207a9b['blockDuration'],_0x0af8('0x1b'))>moment()){return _0x538c1c(null,![],{'message':_0x0af8('0x19')});}else{return utils[_0x0af8('0x1c')](_0x430bd4,_0x2a42a4,![],null)['then'](function(){return _0x538c1c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x538c1c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x2a42a4>=_0x207a9b[_0x0af8('0xb')]){return utils[_0x0af8('0x1c')](_0x430bd4,0x0,!![],moment())['then'](function(){return _0x538c1c(null,![],{'message':_0x0af8('0x19')});});}else{return utils['clearBlockUser'](_0x430bd4,_0x2a42a4,![],null)['then'](function(){return _0x538c1c(null,![],{'message':_0x0af8('0x19')});});}}}else{return _0x538c1c(null,![],{'message':_0x0af8('0x19')});}}else{if(_0x430bd4[_0x0af8('0x12')]){return _0x538c1c(null,![],{'message':_0x0af8('0x19')});}else if(_0x207a9b[_0x0af8('0xb')]>0x0){if(_0x430bd4['blocked']){if(_0x207a9b['blockDuration']>0x0){if(moment(_0x430bd4[_0x0af8('0x13')])[_0x0af8('0x1a')](_0x207a9b[_0x0af8('0xc')],_0x0af8('0x1b'))>moment()){return _0x538c1c(null,![],{'message':_0x0af8('0x19')});}else{return utils[_0x0af8('0x1c')](_0x430bd4,0x0,![],null)[_0x0af8('0xd')](function(){return utils[_0x0af8('0x1d')](_0x430bd4);})['then'](function(){return _0x538c1c(null,_0x430bd4);});}}else{return _0x538c1c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x0af8('0x1c')](_0x430bd4,0x0,![],null)[_0x0af8('0xd')](function(){return utils[_0x0af8('0x1d')](_0x430bd4);})[_0x0af8('0xd')](function(){return _0x538c1c(null,_0x430bd4);})['catch'](function(_0x500fd5){return _0x538c1c(null,![],_0x500fd5);});}}else{if(_0x430bd4[_0x0af8('0x1e')]){return _0x538c1c(null,![],{'message':_0x0af8('0x19')});}else{return utils[_0x0af8('0x1d')](_0x430bd4)[_0x0af8('0xd')](function(){return _0x538c1c(null,_0x430bd4);});}}}});})[_0x0af8('0x1f')](function(_0x410216){return _0x538c1c(null,![],_0x410216);});}function sendServiceMail(_0x318476){return db['MailAccount'][_0x0af8('0x20')]({'where':{'service':!![]},'attributes':['id',_0x0af8('0xe'),_0x0af8('0x21')],'include':[{'model':db[_0x0af8('0x22')],'as':_0x0af8('0x23')}]})[_0x0af8('0xd')](function(_0x4575b0){if(!_0x4575b0){throw new Error(_0x0af8('0x24'));}var _0x80bdcc={'tls':{'rejectUnauthorized':![]}};if(_0x4575b0[_0x0af8('0x23')][_0x0af8('0x25')]){_0x80bdcc['service']=_0x4575b0[_0x0af8('0x23')]['service'];}else{_0x80bdcc[_0x0af8('0x26')]=_0x4575b0['Smtp'][_0x0af8('0x26')];_0x80bdcc[_0x0af8('0x27')]=_0x4575b0['Smtp'][_0x0af8('0x27')];_0x80bdcc[_0x0af8('0x28')]=_0x4575b0[_0x0af8('0x23')]['secure'];}if(_0x4575b0[_0x0af8('0x23')][_0x0af8('0x29')]){_0x80bdcc[_0x0af8('0x2a')]={'user':_0x4575b0['Smtp'][_0x0af8('0x16')],'pass':_0x4575b0[_0x0af8('0x23')][_0x0af8('0x2b')]};}var _0x1aded0={'account':_0x80bdcc,'message':_[_0x0af8('0x2c')]({'from':util[_0x0af8('0x2d')]('\x22%s\x22\x20<%s>',_0x4575b0[_0x0af8('0xe')],_0x4575b0[_0x0af8('0x21')]||_0x4575b0[_0x0af8('0x23')][_0x0af8('0x16')])},_0x318476)};return client[_0x0af8('0x2e')](_0x0af8('0x2f'),_0x1aded0);})[_0x0af8('0xd')](function(_0xb999b1){if(_0xb999b1[_0x0af8('0x30')]){throw new Error(util[_0x0af8('0x2d')](_0x0af8('0x31'),_0xb999b1[_0x0af8('0x30')]['message']||JSON[_0x0af8('0x32')](_0xb999b1[_0x0af8('0x30')])));}return!![];});}function handleError(_0x43d1a2,_0x1b843e,_0x159d72){return _0x43d1a2[_0x0af8('0x33')](_0x1b843e||0x1f4)[_0x0af8('0x34')]({'message':_0x159d72?_0x159d72['message']||_0x159d72:''});}exports[_0x0af8('0x35')]=function(_0x4537d9,_0x268a31,_0x4d7e1f){passport[_0x0af8('0x18')](_0x0af8('0x36'),function(_0x2e1c37,_0x4ad618,_0x6781fe){var _0x122382=_0x2e1c37||_0x6781fe;if(_0x122382){return handleError(_0x268a31,0x191,_0x122382);}if(!_0x4ad618){return handleError(_0x268a31,0x194,{'message':_0x0af8('0x37')});}else{var _0x3f160f={'payload':{'id':_0x4ad618['id'],'role':_0x4ad618[_0x0af8('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0x0af8('0x38')](_0x3f160f)[_0x0af8('0xd')](function(_0x5e900a){_0x268a31['json']({'id':_0x4ad618['id'],'token':_0x5e900a,'statusCall':'','isAlreadyLogged':_0x4ad618[_0x0af8('0x39')]});});}})(_0x4537d9,_0x268a31,_0x4d7e1f);};exports[_0x0af8('0x3a')]=function(_0x5bc8f5,_0x1590bc,_0x4486b8){if(!_0x5bc8f5['body'][_0x0af8('0x21')]){return handleError(_0x1590bc,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x446281=rs[_0x0af8('0x3b')]();_0x5bc8f5['body'][_0x0af8('0x21')]=_0x5bc8f5[_0x0af8('0x3c')]['email'][_0x0af8('0x3d')]()['toLowerCase']();var _0x2e15ec;return db[_0x0af8('0xa')][_0x0af8('0x3e')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0x0af8('0xd')](function(_0xb4c4db){_0x2e15ec=_0xb4c4db;return db[_0x0af8('0x3f')][_0x0af8('0x20')]({'where':{'email':_0x5bc8f5['body'][_0x0af8('0x21')]}});})[_0x0af8('0xd')](function(_0x32e32f){if(!_0x32e32f){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x32e32f[_0x0af8('0x12')]){throw new Error(_0x0af8('0x40'));}if(_0x32e32f['blocked']){if(moment(_0x32e32f[_0x0af8('0x13')])['add'](_0x2e15ec[_0x0af8('0xc')],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x32e32f['blocked']=![];_0x32e32f[_0x0af8('0x13')]=null;}}_0x32e32f['resetPasswordToken']=_0x446281;_0x32e32f[_0x0af8('0x41')]=Date['now']()+0x36ee80;return _0x32e32f[_0x0af8('0x42')]();})[_0x0af8('0xd')](function(){return sendServiceMail({'to':_0x5bc8f5[_0x0af8('0x3c')][_0x0af8('0x21')],'subject':_0x0af8('0x43'),'text':'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'+_0x0af8('0x44')+_0x5bc8f5[_0x0af8('0x45')][_0x0af8('0x26')]+_0x0af8('0x46')+_0x446281+'\x0a\x0a'+_0x0af8('0x47')});})[_0x0af8('0xd')](function(){_0x1590bc[_0x0af8('0x33')](0xc8)['send']({'message':'Reset\x20Email\x20sent!'});})[_0x0af8('0x1f')](function(_0x409157){return handleError(_0x1590bc,0x1f4,_0x409157);});};exports[_0x0af8('0x48')]=function(_0x3c57dd,_0x4f4ea7,_0x64efe0){return db[_0x0af8('0x3f')][_0x0af8('0x20')]({'where':{'resetPasswordToken':_0x3c57dd[_0x0af8('0x49')][_0x0af8('0x4a')],'resetPasswordExpires':{'$gt':Date[_0x0af8('0x4b')]()}}})['then'](function(_0x2b7ada){if(!_0x2b7ada){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x0af8('0xa')]['findOne']({'attributes':['id',_0x0af8('0x4c'),_0x0af8('0x4d'),_0x0af8('0x4e')]})['then'](function(_0x1400eb){if(_0x1400eb[_0x0af8('0x4c')])authService['validatePasswordPattern'](_0x3c57dd[_0x0af8('0x3c')][_0x0af8('0xf')]);if(!_0x1400eb[_0x0af8('0x4d')]||!_0x2b7ada[_0x0af8('0x4f')])return _0x2b7ada;authService[_0x0af8('0x50')](_0x3c57dd[_0x0af8('0x3c')][_0x0af8('0xf')],_0x2b7ada['previousPasswords'],_0x1400eb[_0x0af8('0x4e')]);return _0x2b7ada;})[_0x0af8('0xd')](function(){_0x2b7ada['password']=_0x3c57dd['body'][_0x0af8('0xf')];_0x2b7ada[_0x0af8('0x51')]=null;_0x2b7ada['resetPasswordExpires']=null;return _0x2b7ada[_0x0af8('0x42')]();});})[_0x0af8('0xd')](function(){_0x4f4ea7['status'](0xc8)[_0x0af8('0x34')]({'message':'Password\x20reset!'});})['catch'](function(_0x306a77){return handleError(_0x4f4ea7,0x1f4,_0x306a77);});};passport[_0x0af8('0x52')](new LocalStrategy({'usernameField':'name','passwordField':_0x0af8('0xf')},function(_0xfb13fe,_0x5c48e0,_0x11b510){return localAuthenticate(db['User'],_0xfb13fe,_0x5c48e0,_0x11b510);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 6fe5c26..a847d08 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 _0x08d9=['forgot','/reset/:token','reset','exports','express','./authLocal.controller','post','login'];(function(_0x5c8e0a,_0x5472c9){var _0x17fae2=function(_0x328c14){while(--_0x328c14){_0x5c8e0a['push'](_0x5c8e0a['shift']());}};_0x17fae2(++_0x5472c9);}(_0x08d9,0x7c));var _0x908d=function(_0x1204b8,_0x19b935){_0x1204b8=_0x1204b8-0x0;var _0x188faa=_0x08d9[_0x1204b8];return _0x188faa;};'use strict';var express=require(_0x908d('0x0'));var router=express['Router']();var controller=require(_0x908d('0x1'));router[_0x908d('0x2')]('/',controller[_0x908d('0x3')]);router['post']('/forgot',controller[_0x908d('0x4')]);router['post'](_0x908d('0x5'),controller[_0x908d('0x6')]);module[_0x908d('0x7')]=router; \ No newline at end of file +var _0x0212=['post','login'];(function(_0x3381f9,_0x50b280){var _0x2423fd=function(_0x2adbd6){while(--_0x2adbd6){_0x3381f9['push'](_0x3381f9['shift']());}};_0x2423fd(++_0x50b280);}(_0x0212,0x7b));var _0x2021=function(_0x1a78d5,_0x11b5fe){_0x1a78d5=_0x1a78d5-0x0;var _0x4d6245=_0x0212[_0x1a78d5];return _0x4d6245;};'use strict';var express=require('express');var router=express['Router']();var controller=require('./authLocal.controller');router['post']('/',controller[_0x2021('0x0')]);router[_0x2021('0x1')]('/forgot',controller['forgot']);router[_0x2021('0x1')]('/reset/:token',controller['reset']);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index c6019d6..3b3de8c 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 _0xf8d0=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x58d32d,_0x419525){var _0x4bf44c=function(_0x54c0d0){while(--_0x54c0d0){_0x58d32d['push'](_0x58d32d['shift']());}};_0x4bf44c(++_0x419525);}(_0xf8d0,0x1b4));var _0x0f8d=function(_0x52c884,_0xde957a){_0x52c884=_0x52c884-0x0;var _0x44a774=_0xf8d0[_0x52c884];return _0x44a774;};'use strict';var Sequelize=require(_0x0f8d('0x0'));module[_0x0f8d('0x1')]={'name':{'type':Sequelize[_0x0f8d('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x0f8d('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x0f8d('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x0f8d('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x1410=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x12d293,_0x48be2c){var _0x24da92=function(_0x2df93d){while(--_0x2df93d){_0x12d293['push'](_0x12d293['shift']());}};_0x24da92(++_0x48be2c);}(_0x1410,0x67));var _0x0141=function(_0x1ecf60,_0xe4ac05){_0x1ecf60=_0x1ecf60-0x0;var _0x21d98c=_0x1410[_0x1ecf60];return _0x21d98c;};'use strict';var Sequelize=require(_0x0141('0x0'));module[_0x0141('0x1')]={'name':{'type':Sequelize[_0x0141('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x0141('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x0141('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 9ce7df1..3c4ce86 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 _0xc392=['fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','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','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','sendStatus','error','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create','catch','body','addConditions','find','ids','omit','findOne','Condition','pick','getConditions','addActions','Action','getActions','eml-format','rimraf'];(function(_0x4cbd8e,_0x533cf1){var _0x36816a=function(_0x59edbd){while(--_0x59edbd){_0x4cbd8e['push'](_0x4cbd8e['shift']());}};_0x36816a(++_0x533cf1);}(_0xc392,0xb0));var _0x2c39=function(_0x14c0a7,_0xb44cb){_0x14c0a7=_0x14c0a7-0x0;var _0x585b82=_0xc392[_0x14c0a7];return _0x585b82;};'use strict';var emlformat=require(_0x2c39('0x0'));var rimraf=require(_0x2c39('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2c39('0x2'));var rp=require(_0x2c39('0x3'));var moment=require(_0x2c39('0x4'));var BPromise=require(_0x2c39('0x5'));var Mustache=require(_0x2c39('0x6'));var util=require(_0x2c39('0x7'));var path=require('path');var sox=require(_0x2c39('0x8'));var csv=require(_0x2c39('0x9'));var ejs=require(_0x2c39('0xa'));var fs=require('fs');var fs_extra=require(_0x2c39('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2c39('0xc'));var jsforce=require(_0x2c39('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2c39('0x9'));var querystring=require(_0x2c39('0xe'));var Papa=require(_0x2c39('0xf'));var Redis=require(_0x2c39('0x10'));var authService=require(_0x2c39('0x11'));var qs=require(_0x2c39('0x12'));var as=require(_0x2c39('0x13'));var hardwareService=require(_0x2c39('0x14'));var logger=require(_0x2c39('0x15'))(_0x2c39('0x16'));var utils=require(_0x2c39('0x17'));var config=require(_0x2c39('0x18'));var licenseUtil=require(_0x2c39('0x19'));var db=require(_0x2c39('0x1a'))['db'];function respondWithStatusCode(_0x5e7167,_0x4bb153){_0x4bb153=_0x4bb153||0xcc;return function(_0x3ada78){if(_0x3ada78){return _0x5e7167['sendStatus'](_0x4bb153);}return _0x5e7167['status'](_0x4bb153)[_0x2c39('0x1b')]();};}function respondWithResult(_0x3334d8,_0x47aad0){_0x47aad0=_0x47aad0||0xc8;return function(_0x35a7d3){if(_0x35a7d3){return _0x3334d8[_0x2c39('0x1c')](_0x47aad0)[_0x2c39('0x1d')](_0x35a7d3);}};}function respondWithFilteredResult(_0x2d34e6,_0x597672){return function(_0x5c16ff){if(_0x5c16ff){var _0x1b580a=typeof _0x597672[_0x2c39('0x1e')]==='undefined'&&typeof _0x597672['limit']===_0x2c39('0x1f');var _0x4fd4ea=_0x5c16ff['count'];var _0x4e90a1=_0x1b580a?0x0:_0x597672['offset'];var _0x24541e=_0x1b580a?_0x5c16ff[_0x2c39('0x20')]:_0x597672[_0x2c39('0x1e')]+_0x597672[_0x2c39('0x21')];var _0x35bd19;if(_0x24541e>=_0x4fd4ea){_0x24541e=_0x4fd4ea;_0x35bd19=0xc8;}else{_0x35bd19=0xce;}_0x2d34e6[_0x2c39('0x1c')](_0x35bd19);return _0x2d34e6[_0x2c39('0x22')](_0x2c39('0x23'),_0x4e90a1+'-'+_0x24541e+'/'+_0x4fd4ea)['json'](_0x5c16ff);}return null;};}function patchUpdates(_0x494002){return function(_0x3c0195){try{jsonpatch[_0x2c39('0x24')](_0x3c0195,_0x494002,!![]);}catch(_0x11cc48){return BPromise[_0x2c39('0x25')](_0x11cc48);}return _0x3c0195['save']();};}function saveUpdates(_0x27c272,_0x4e2d1e){return function(_0x26e3fa){if(_0x26e3fa){return _0x26e3fa['update'](_0x27c272)[_0x2c39('0x26')](function(_0x112c7b){return _0x112c7b;});}return null;};}function removeEntity(_0x3e93d8,_0x208bda){return function(_0x11acba){if(_0x11acba){return _0x11acba[_0x2c39('0x27')]()[_0x2c39('0x26')](function(){_0x3e93d8[_0x2c39('0x1c')](0xcc)[_0x2c39('0x1b')]();});}};}function handleEntityNotFound(_0x2b896c,_0x391f11){return function(_0x47805c){if(!_0x47805c){_0x2b896c[_0x2c39('0x28')](0x194);}return _0x47805c;};}function handleError(_0x570ef4,_0x275bdd){_0x275bdd=_0x275bdd||0x1f4;return function(_0x403071){logger[_0x2c39('0x29')](_0x403071[_0x2c39('0x2a')]);if(_0x403071[_0x2c39('0x2b')]){delete _0x403071['name'];}_0x570ef4[_0x2c39('0x1c')](_0x275bdd)[_0x2c39('0x2c')](_0x403071);};}exports[_0x2c39('0x2d')]=function(_0x56adda,_0x4eefb4){var _0x4f13a7={},_0x5383e2={},_0x50c847={'count':0x0,'rows':[]};var _0x37276f=_[_0x2c39('0x2e')](db[_0x2c39('0x2f')][_0x2c39('0x30')],function(_0x4fd163){return{'name':_0x4fd163[_0x2c39('0x31')],'type':_0x4fd163[_0x2c39('0x32')][_0x2c39('0x33')]};});_0x5383e2[_0x2c39('0x34')]=_[_0x2c39('0x2e')](_0x37276f,'name');_0x5383e2['query']=_[_0x2c39('0x35')](_0x56adda[_0x2c39('0x36')]);_0x5383e2['filters']=_[_0x2c39('0x37')](_0x5383e2['model'],_0x5383e2[_0x2c39('0x36')]);_0x4f13a7[_0x2c39('0x38')]=_[_0x2c39('0x37')](_0x5383e2[_0x2c39('0x34')],qs[_0x2c39('0x39')](_0x56adda[_0x2c39('0x36')][_0x2c39('0x39')]));_0x4f13a7[_0x2c39('0x38')]=_0x4f13a7['attributes'][_0x2c39('0x3a')]?_0x4f13a7['attributes']:_0x5383e2['model'];if(!_0x56adda[_0x2c39('0x36')][_0x2c39('0x3b')](_0x2c39('0x3c'))){_0x4f13a7[_0x2c39('0x21')]=qs[_0x2c39('0x21')](_0x56adda[_0x2c39('0x36')][_0x2c39('0x21')]);_0x4f13a7[_0x2c39('0x1e')]=qs['offset'](_0x56adda[_0x2c39('0x36')][_0x2c39('0x1e')]);}_0x4f13a7[_0x2c39('0x3d')]=qs[_0x2c39('0x3e')](_0x56adda['query']['sort']);_0x4f13a7[_0x2c39('0x3f')]=qs[_0x2c39('0x40')](_['pick'](_0x56adda[_0x2c39('0x36')],_0x5383e2[_0x2c39('0x40')]),_0x37276f);if(_0x56adda[_0x2c39('0x36')][_0x2c39('0x41')]){_0x4f13a7[_0x2c39('0x3f')]=_[_0x2c39('0x42')](_0x4f13a7[_0x2c39('0x3f')],{'$or':_['map'](_0x37276f,function(_0x52fc39){if(_0x52fc39[_0x2c39('0x32')]!==_0x2c39('0x43')){var _0x110ba9={};_0x110ba9[_0x52fc39[_0x2c39('0x2b')]]={'$like':'%'+_0x56adda[_0x2c39('0x36')][_0x2c39('0x41')]+'%'};return _0x110ba9;}})});}_0x4f13a7=_[_0x2c39('0x42')]({},_0x4f13a7,_0x56adda[_0x2c39('0x44')]);var _0x199095={'where':_0x4f13a7[_0x2c39('0x3f')]};return db[_0x2c39('0x2f')][_0x2c39('0x20')](_0x199095)['then'](function(_0x345d79){_0x50c847[_0x2c39('0x20')]=_0x345d79;if(_0x56adda[_0x2c39('0x36')][_0x2c39('0x45')]){_0x4f13a7[_0x2c39('0x46')]=[{'all':!![]}];}return db['Automation'][_0x2c39('0x47')](_0x4f13a7);})[_0x2c39('0x26')](function(_0x17253d){_0x50c847[_0x2c39('0x48')]=_0x17253d;return _0x50c847;})[_0x2c39('0x26')](respondWithFilteredResult(_0x4eefb4,_0x4f13a7))['catch'](handleError(_0x4eefb4,null));};exports[_0x2c39('0x49')]=function(_0x3733e9,_0x1e1a48){var _0x5e6f76={'raw':![],'where':{'id':_0x3733e9[_0x2c39('0x4a')]['id']}},_0x23b98f={};_0x23b98f['model']=_['keys'](db[_0x2c39('0x2f')]['rawAttributes']);_0x23b98f[_0x2c39('0x36')]=_[_0x2c39('0x35')](_0x3733e9[_0x2c39('0x36')]);_0x23b98f[_0x2c39('0x40')]=_[_0x2c39('0x37')](_0x23b98f['model'],_0x23b98f['query']);_0x5e6f76[_0x2c39('0x38')]=_['intersection'](_0x23b98f[_0x2c39('0x34')],qs[_0x2c39('0x39')](_0x3733e9[_0x2c39('0x36')][_0x2c39('0x39')]));_0x5e6f76[_0x2c39('0x38')]=_0x5e6f76[_0x2c39('0x38')]['length']?_0x5e6f76[_0x2c39('0x38')]:_0x23b98f[_0x2c39('0x34')];if(_0x3733e9[_0x2c39('0x36')][_0x2c39('0x45')]){_0x5e6f76[_0x2c39('0x46')]=[{'all':!![]}];}_0x5e6f76=_[_0x2c39('0x42')]({},_0x5e6f76,_0x3733e9['options']);return db[_0x2c39('0x2f')]['find'](_0x5e6f76)[_0x2c39('0x26')](handleEntityNotFound(_0x1e1a48,null))['then'](respondWithResult(_0x1e1a48,null))['catch'](handleError(_0x1e1a48,null));};exports[_0x2c39('0x4b')]=function(_0x3f52c0,_0x123bc9){return db[_0x2c39('0x2f')][_0x2c39('0x4b')](_0x3f52c0['body'],{})[_0x2c39('0x26')](respondWithResult(_0x123bc9,0xc9))[_0x2c39('0x4c')](handleError(_0x123bc9,null));};exports['update']=function(_0x257dd2,_0x56b822){if(_0x257dd2[_0x2c39('0x4d')]['id']){delete _0x257dd2[_0x2c39('0x4d')]['id'];}return db[_0x2c39('0x2f')]['find']({'where':{'id':_0x257dd2['params']['id']}})[_0x2c39('0x26')](handleEntityNotFound(_0x56b822,null))[_0x2c39('0x26')](saveUpdates(_0x257dd2['body'],null))[_0x2c39('0x26')](respondWithResult(_0x56b822,null))[_0x2c39('0x4c')](handleError(_0x56b822,null));};exports[_0x2c39('0x27')]=function(_0x4a3907,_0x5c759f){return db[_0x2c39('0x2f')]['find']({'where':{'id':_0x4a3907[_0x2c39('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5c759f,null))[_0x2c39('0x26')](removeEntity(_0x5c759f,null))[_0x2c39('0x4c')](handleError(_0x5c759f,null));};exports[_0x2c39('0x4e')]=function(_0x1e1ece,_0x1367cd,_0x3ce671){return db['Condition'][_0x2c39('0x4f')]({'where':{'id':_0x1e1ece[_0x2c39('0x4a')]['id']}})[_0x2c39('0x26')](handleEntityNotFound(_0x1367cd,null))[_0x2c39('0x26')](function(_0x16bae7){if(_0x16bae7){return _0x16bae7[_0x2c39('0x4e')](_0x1e1ece[_0x2c39('0x4d')][_0x2c39('0x50')],_[_0x2c39('0x51')](_0x1e1ece[_0x2c39('0x4d')],[_0x2c39('0x50'),'id'])||{});}})['then'](respondWithResult(_0x1367cd,null))[_0x2c39('0x4c')](handleError(_0x1367cd,null));};exports['getConditions']=function(_0x634433,_0x22b277,_0x46b1e8){var _0x2d5e62={};var _0x236e66={};var _0xc097da;var _0x520a0b;return db[_0x2c39('0x2f')][_0x2c39('0x52')]({'where':{'id':_0x634433[_0x2c39('0x4a')]['id']}})[_0x2c39('0x26')](handleEntityNotFound(_0x22b277,null))[_0x2c39('0x26')](function(_0x45231b){if(_0x45231b){_0xc097da=_0x45231b;_0x236e66[_0x2c39('0x34')]=_[_0x2c39('0x35')](db[_0x2c39('0x53')][_0x2c39('0x30')]);_0x236e66[_0x2c39('0x36')]=_[_0x2c39('0x35')](_0x634433[_0x2c39('0x36')]);_0x236e66[_0x2c39('0x40')]=_['intersection'](_0x236e66[_0x2c39('0x34')],_0x236e66[_0x2c39('0x36')]);_0x2d5e62[_0x2c39('0x38')]=_['intersection'](_0x236e66[_0x2c39('0x34')],qs[_0x2c39('0x39')](_0x634433[_0x2c39('0x36')][_0x2c39('0x39')]));_0x2d5e62[_0x2c39('0x38')]=_0x2d5e62['attributes']['length']?_0x2d5e62[_0x2c39('0x38')]:_0x236e66[_0x2c39('0x34')];_0x2d5e62['order']=qs[_0x2c39('0x3e')](_0x634433[_0x2c39('0x36')][_0x2c39('0x3e')]);_0x2d5e62['where']=qs[_0x2c39('0x40')](_[_0x2c39('0x54')](_0x634433['query'],_0x236e66[_0x2c39('0x40')]));if(_0x634433['query']['filter']){_0x2d5e62[_0x2c39('0x3f')]=_[_0x2c39('0x42')](_0x2d5e62[_0x2c39('0x3f')],{'$or':_[_0x2c39('0x2e')](_0x2d5e62[_0x2c39('0x38')],function(_0x2808bc){var _0x58d3b3={};_0x58d3b3[_0x2808bc]={'$like':'%'+_0x634433['query'][_0x2c39('0x41')]+'%'};return _0x58d3b3;})});}_0x2d5e62=_[_0x2c39('0x42')]({},_0x2d5e62,_0x634433[_0x2c39('0x44')]);return _0xc097da['getConditions'](_0x2d5e62);}})[_0x2c39('0x26')](function(_0x271108){if(_0x271108){_0x520a0b=_0x271108[_0x2c39('0x3a')];if(!_0x634433[_0x2c39('0x36')][_0x2c39('0x3b')](_0x2c39('0x3c'))){_0x2d5e62[_0x2c39('0x21')]=qs[_0x2c39('0x21')](_0x634433['query'][_0x2c39('0x21')]);_0x2d5e62[_0x2c39('0x1e')]=qs[_0x2c39('0x1e')](_0x634433[_0x2c39('0x36')][_0x2c39('0x1e')]);}return _0xc097da[_0x2c39('0x55')](_0x2d5e62);}})['then'](function(_0x215585){if(_0x215585){return _0x215585?{'count':_0x520a0b,'rows':_0x215585}:null;}})[_0x2c39('0x26')](respondWithResult(_0x22b277,null))['catch'](handleError(_0x22b277,null));};exports[_0x2c39('0x56')]=function(_0x50a9fc,_0xaf2d6d,_0x2c7ecb){return db[_0x2c39('0x57')]['find']({'where':{'id':_0x50a9fc[_0x2c39('0x4a')]['id']}})[_0x2c39('0x26')](handleEntityNotFound(_0xaf2d6d,null))[_0x2c39('0x26')](function(_0x33e25e){if(_0x33e25e){return _0x33e25e[_0x2c39('0x56')](_0x50a9fc[_0x2c39('0x4d')][_0x2c39('0x50')],_[_0x2c39('0x51')](_0x50a9fc[_0x2c39('0x4d')],['ids','id'])||{});}})['then'](respondWithResult(_0xaf2d6d,null))[_0x2c39('0x4c')](handleError(_0xaf2d6d,null));};exports[_0x2c39('0x58')]=function(_0x16a19b,_0x2a8d08,_0x3080a8){var _0x1d7b4d={};var _0x2e58db={};var _0x38c6a2;var _0x16e6b4;return db['Automation'][_0x2c39('0x52')]({'where':{'id':_0x16a19b[_0x2c39('0x4a')]['id']}})[_0x2c39('0x26')](handleEntityNotFound(_0x2a8d08,null))[_0x2c39('0x26')](function(_0x362b1f){if(_0x362b1f){_0x38c6a2=_0x362b1f;_0x2e58db['model']=_[_0x2c39('0x35')](db[_0x2c39('0x57')][_0x2c39('0x30')]);_0x2e58db['query']=_['keys'](_0x16a19b[_0x2c39('0x36')]);_0x2e58db[_0x2c39('0x40')]=_[_0x2c39('0x37')](_0x2e58db[_0x2c39('0x34')],_0x2e58db[_0x2c39('0x36')]);_0x1d7b4d['attributes']=_[_0x2c39('0x37')](_0x2e58db['model'],qs[_0x2c39('0x39')](_0x16a19b[_0x2c39('0x36')]['fields']));_0x1d7b4d[_0x2c39('0x38')]=_0x1d7b4d[_0x2c39('0x38')]['length']?_0x1d7b4d[_0x2c39('0x38')]:_0x2e58db[_0x2c39('0x34')];_0x1d7b4d[_0x2c39('0x3d')]=qs['sort'](_0x16a19b[_0x2c39('0x36')][_0x2c39('0x3e')]);_0x1d7b4d['where']=qs['filters'](_[_0x2c39('0x54')](_0x16a19b[_0x2c39('0x36')],_0x2e58db['filters']));if(_0x16a19b['query'][_0x2c39('0x41')]){_0x1d7b4d['where']=_['merge'](_0x1d7b4d[_0x2c39('0x3f')],{'$or':_[_0x2c39('0x2e')](_0x1d7b4d['attributes'],function(_0x1033de){var _0x13fb67={};_0x13fb67[_0x1033de]={'$like':'%'+_0x16a19b[_0x2c39('0x36')][_0x2c39('0x41')]+'%'};return _0x13fb67;})});}_0x1d7b4d=_['merge']({},_0x1d7b4d,_0x16a19b[_0x2c39('0x44')]);return _0x38c6a2[_0x2c39('0x58')](_0x1d7b4d);}})[_0x2c39('0x26')](function(_0x4240fe){if(_0x4240fe){_0x16e6b4=_0x4240fe['length'];if(!_0x16a19b['query'][_0x2c39('0x3b')]('nolimit')){_0x1d7b4d[_0x2c39('0x21')]=qs['limit'](_0x16a19b[_0x2c39('0x36')]['limit']);_0x1d7b4d[_0x2c39('0x1e')]=qs[_0x2c39('0x1e')](_0x16a19b[_0x2c39('0x36')][_0x2c39('0x1e')]);}return _0x38c6a2[_0x2c39('0x58')](_0x1d7b4d);}})['then'](function(_0x253a8f){if(_0x253a8f){return _0x253a8f?{'count':_0x16e6b4,'rows':_0x253a8f}:null;}})['then'](respondWithResult(_0x2a8d08,null))[_0x2c39('0x4c')](handleError(_0x2a8d08,null));}; \ No newline at end of file +var _0x61d5=['bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','apply','reject','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','type','filter','options','includeAll','include','Automation','catch','show','params','find','create','body','addConditions','ids','omit','findOne','getConditions','nolimit','addActions','Action','getActions','hasOwnProperty','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x3108d9,_0xf08d6){var _0x1455e6=function(_0xfd5906){while(--_0xfd5906){_0x3108d9['push'](_0x3108d9['shift']());}};_0x1455e6(++_0xf08d6);}(_0x61d5,0x1db));var _0x561d=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x61d5[_0x1d24eb];return _0x1dc576;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x561d('0x0'));var zipdir=require(_0x561d('0x1'));var jsonpatch=require(_0x561d('0x2'));var rp=require(_0x561d('0x3'));var moment=require(_0x561d('0x4'));var BPromise=require(_0x561d('0x5'));var Mustache=require(_0x561d('0x6'));var util=require(_0x561d('0x7'));var path=require('path');var sox=require(_0x561d('0x8'));var csv=require(_0x561d('0x9'));var ejs=require(_0x561d('0xa'));var fs=require('fs');var fs_extra=require(_0x561d('0xb'));var _=require('lodash');var squel=require(_0x561d('0xc'));var crypto=require(_0x561d('0xd'));var jsforce=require(_0x561d('0xe'));var deskjs=require(_0x561d('0xf'));var toCsv=require(_0x561d('0x9'));var querystring=require(_0x561d('0x10'));var Papa=require(_0x561d('0x11'));var Redis=require(_0x561d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x561d('0x13'));var as=require(_0x561d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x561d('0x15'));var db=require(_0x561d('0x16'))['db'];function respondWithStatusCode(_0x45866d,_0x25fe5c){_0x25fe5c=_0x25fe5c||0xcc;return function(_0x55743a){if(_0x55743a){return _0x45866d[_0x561d('0x17')](_0x25fe5c);}return _0x45866d['status'](_0x25fe5c)[_0x561d('0x18')]();};}function respondWithResult(_0x4b1a7c,_0x23ced2){_0x23ced2=_0x23ced2||0xc8;return function(_0x46ed5d){if(_0x46ed5d){return _0x4b1a7c['status'](_0x23ced2)[_0x561d('0x19')](_0x46ed5d);}};}function respondWithFilteredResult(_0x2f5b28,_0x212993){return function(_0x2a4103){if(_0x2a4103){var _0x57e14e=typeof _0x212993[_0x561d('0x1a')]===_0x561d('0x1b')&&typeof _0x212993['limit']===_0x561d('0x1b');var _0x4b3c54=_0x2a4103['count'];var _0x5c7a3b=_0x57e14e?0x0:_0x212993[_0x561d('0x1a')];var _0x4e16d3=_0x57e14e?_0x2a4103[_0x561d('0x1c')]:_0x212993['offset']+_0x212993[_0x561d('0x1d')];var _0xd70572;if(_0x4e16d3>=_0x4b3c54){_0x4e16d3=_0x4b3c54;_0xd70572=0xc8;}else{_0xd70572=0xce;}_0x2f5b28[_0x561d('0x1e')](_0xd70572);return _0x2f5b28[_0x561d('0x1f')]('Content-Range',_0x5c7a3b+'-'+_0x4e16d3+'/'+_0x4b3c54)[_0x561d('0x19')](_0x2a4103);}return null;};}function patchUpdates(_0x2889cc){return function(_0x4cffa9){try{jsonpatch[_0x561d('0x20')](_0x4cffa9,_0x2889cc,!![]);}catch(_0x11e50f){return BPromise[_0x561d('0x21')](_0x11e50f);}return _0x4cffa9['save']();};}function saveUpdates(_0x20bd2e,_0x9879a7){return function(_0x22ec8b){if(_0x22ec8b){return _0x22ec8b[_0x561d('0x22')](_0x20bd2e)['then'](function(_0x2de1a8){return _0x2de1a8;});}return null;};}function removeEntity(_0x441c7c,_0x5e9dbf){return function(_0x346284){if(_0x346284){return _0x346284['destroy']()[_0x561d('0x23')](function(){_0x441c7c['status'](0xcc)[_0x561d('0x18')]();});}};}function handleEntityNotFound(_0x1984f8,_0x343428){return function(_0x2f2ca){if(!_0x2f2ca){_0x1984f8[_0x561d('0x17')](0x194);}return _0x2f2ca;};}function handleError(_0x255b50,_0x46cfa2){_0x46cfa2=_0x46cfa2||0x1f4;return function(_0x3b2e0f){logger[_0x561d('0x24')](_0x3b2e0f[_0x561d('0x25')]);if(_0x3b2e0f[_0x561d('0x26')]){delete _0x3b2e0f['name'];}_0x255b50[_0x561d('0x1e')](_0x46cfa2)[_0x561d('0x27')](_0x3b2e0f);};}exports[_0x561d('0x28')]=function(_0x24289c,_0x135b72){var _0x48b78b={},_0x926285={},_0x10b080={'count':0x0,'rows':[]};var _0x4fb6d6=_[_0x561d('0x29')](db['Automation'][_0x561d('0x2a')],function(_0x4d2e0a){return{'name':_0x4d2e0a[_0x561d('0x2b')],'type':_0x4d2e0a['type'][_0x561d('0x2c')]};});_0x926285[_0x561d('0x2d')]=_['map'](_0x4fb6d6,_0x561d('0x26'));_0x926285[_0x561d('0x2e')]=_[_0x561d('0x2f')](_0x24289c['query']);_0x926285[_0x561d('0x30')]=_[_0x561d('0x31')](_0x926285[_0x561d('0x2d')],_0x926285[_0x561d('0x2e')]);_0x48b78b[_0x561d('0x32')]=_['intersection'](_0x926285[_0x561d('0x2d')],qs[_0x561d('0x33')](_0x24289c['query'][_0x561d('0x33')]));_0x48b78b[_0x561d('0x32')]=_0x48b78b[_0x561d('0x32')][_0x561d('0x34')]?_0x48b78b[_0x561d('0x32')]:_0x926285[_0x561d('0x2d')];if(!_0x24289c[_0x561d('0x2e')]['hasOwnProperty']('nolimit')){_0x48b78b[_0x561d('0x1d')]=qs[_0x561d('0x1d')](_0x24289c['query'][_0x561d('0x1d')]);_0x48b78b[_0x561d('0x1a')]=qs[_0x561d('0x1a')](_0x24289c[_0x561d('0x2e')][_0x561d('0x1a')]);}_0x48b78b[_0x561d('0x35')]=qs['sort'](_0x24289c[_0x561d('0x2e')][_0x561d('0x36')]);_0x48b78b[_0x561d('0x37')]=qs['filters'](_[_0x561d('0x38')](_0x24289c[_0x561d('0x2e')],_0x926285[_0x561d('0x30')]),_0x4fb6d6);if(_0x24289c[_0x561d('0x2e')]['filter']){_0x48b78b['where']=_[_0x561d('0x39')](_0x48b78b[_0x561d('0x37')],{'$or':_['map'](_0x4fb6d6,function(_0x2f33e2){if(_0x2f33e2[_0x561d('0x3a')]!=='VIRTUAL'){var _0xa42e9c={};_0xa42e9c[_0x2f33e2[_0x561d('0x26')]]={'$like':'%'+_0x24289c[_0x561d('0x2e')][_0x561d('0x3b')]+'%'};return _0xa42e9c;}})});}_0x48b78b=_[_0x561d('0x39')]({},_0x48b78b,_0x24289c[_0x561d('0x3c')]);var _0x2f360d={'where':_0x48b78b['where']};return db['Automation'][_0x561d('0x1c')](_0x2f360d)[_0x561d('0x23')](function(_0x4c2d1e){_0x10b080[_0x561d('0x1c')]=_0x4c2d1e;if(_0x24289c[_0x561d('0x2e')][_0x561d('0x3d')]){_0x48b78b[_0x561d('0x3e')]=[{'all':!![]}];}return db[_0x561d('0x3f')]['findAll'](_0x48b78b);})[_0x561d('0x23')](function(_0x46236a){_0x10b080['rows']=_0x46236a;return _0x10b080;})[_0x561d('0x23')](respondWithFilteredResult(_0x135b72,_0x48b78b))[_0x561d('0x40')](handleError(_0x135b72,null));};exports[_0x561d('0x41')]=function(_0x14549f,_0xa92775){var _0x2d9e52={'raw':![],'where':{'id':_0x14549f[_0x561d('0x42')]['id']}},_0x2a96bc={};_0x2a96bc['model']=_[_0x561d('0x2f')](db[_0x561d('0x3f')]['rawAttributes']);_0x2a96bc[_0x561d('0x2e')]=_[_0x561d('0x2f')](_0x14549f[_0x561d('0x2e')]);_0x2a96bc[_0x561d('0x30')]=_[_0x561d('0x31')](_0x2a96bc[_0x561d('0x2d')],_0x2a96bc['query']);_0x2d9e52['attributes']=_[_0x561d('0x31')](_0x2a96bc[_0x561d('0x2d')],qs[_0x561d('0x33')](_0x14549f[_0x561d('0x2e')][_0x561d('0x33')]));_0x2d9e52[_0x561d('0x32')]=_0x2d9e52[_0x561d('0x32')][_0x561d('0x34')]?_0x2d9e52['attributes']:_0x2a96bc[_0x561d('0x2d')];if(_0x14549f[_0x561d('0x2e')]['includeAll']){_0x2d9e52[_0x561d('0x3e')]=[{'all':!![]}];}_0x2d9e52=_[_0x561d('0x39')]({},_0x2d9e52,_0x14549f[_0x561d('0x3c')]);return db[_0x561d('0x3f')][_0x561d('0x43')](_0x2d9e52)[_0x561d('0x23')](handleEntityNotFound(_0xa92775,null))[_0x561d('0x23')](respondWithResult(_0xa92775,null))[_0x561d('0x40')](handleError(_0xa92775,null));};exports['create']=function(_0x28abf2,_0x34cb05){return db['Automation'][_0x561d('0x44')](_0x28abf2[_0x561d('0x45')],{})['then'](respondWithResult(_0x34cb05,0xc9))[_0x561d('0x40')](handleError(_0x34cb05,null));};exports[_0x561d('0x22')]=function(_0x543ddd,_0x239c02){if(_0x543ddd[_0x561d('0x45')]['id']){delete _0x543ddd[_0x561d('0x45')]['id'];}return db[_0x561d('0x3f')][_0x561d('0x43')]({'where':{'id':_0x543ddd[_0x561d('0x42')]['id']}})['then'](handleEntityNotFound(_0x239c02,null))[_0x561d('0x23')](saveUpdates(_0x543ddd[_0x561d('0x45')],null))[_0x561d('0x23')](respondWithResult(_0x239c02,null))[_0x561d('0x40')](handleError(_0x239c02,null));};exports['destroy']=function(_0x1cd2dc,_0x50cf21){return db[_0x561d('0x3f')]['find']({'where':{'id':_0x1cd2dc[_0x561d('0x42')]['id']}})[_0x561d('0x23')](handleEntityNotFound(_0x50cf21,null))[_0x561d('0x23')](removeEntity(_0x50cf21,null))['catch'](handleError(_0x50cf21,null));};exports[_0x561d('0x46')]=function(_0x5b4add,_0x478304,_0x5585b6){return db['Condition']['find']({'where':{'id':_0x5b4add[_0x561d('0x42')]['id']}})[_0x561d('0x23')](handleEntityNotFound(_0x478304,null))[_0x561d('0x23')](function(_0x4b96a2){if(_0x4b96a2){return _0x4b96a2[_0x561d('0x46')](_0x5b4add[_0x561d('0x45')][_0x561d('0x47')],_[_0x561d('0x48')](_0x5b4add[_0x561d('0x45')],[_0x561d('0x47'),'id'])||{});}})['then'](respondWithResult(_0x478304,null))[_0x561d('0x40')](handleError(_0x478304,null));};exports['getConditions']=function(_0x2845b0,_0x91fe8d,_0x5c4303){var _0x4a8cd9={};var _0x49d477={};var _0x4c6c55;var _0xa55d4;return db[_0x561d('0x3f')][_0x561d('0x49')]({'where':{'id':_0x2845b0[_0x561d('0x42')]['id']}})['then'](handleEntityNotFound(_0x91fe8d,null))[_0x561d('0x23')](function(_0x2b52c3){if(_0x2b52c3){_0x4c6c55=_0x2b52c3;_0x49d477[_0x561d('0x2d')]=_[_0x561d('0x2f')](db['Condition'][_0x561d('0x2a')]);_0x49d477[_0x561d('0x2e')]=_['keys'](_0x2845b0[_0x561d('0x2e')]);_0x49d477['filters']=_['intersection'](_0x49d477['model'],_0x49d477[_0x561d('0x2e')]);_0x4a8cd9['attributes']=_[_0x561d('0x31')](_0x49d477[_0x561d('0x2d')],qs[_0x561d('0x33')](_0x2845b0[_0x561d('0x2e')][_0x561d('0x33')]));_0x4a8cd9[_0x561d('0x32')]=_0x4a8cd9[_0x561d('0x32')][_0x561d('0x34')]?_0x4a8cd9[_0x561d('0x32')]:_0x49d477[_0x561d('0x2d')];_0x4a8cd9[_0x561d('0x35')]=qs['sort'](_0x2845b0[_0x561d('0x2e')]['sort']);_0x4a8cd9['where']=qs[_0x561d('0x30')](_[_0x561d('0x38')](_0x2845b0[_0x561d('0x2e')],_0x49d477[_0x561d('0x30')]));if(_0x2845b0[_0x561d('0x2e')][_0x561d('0x3b')]){_0x4a8cd9['where']=_[_0x561d('0x39')](_0x4a8cd9[_0x561d('0x37')],{'$or':_['map'](_0x4a8cd9[_0x561d('0x32')],function(_0x4d1b6c){var _0x148bbb={};_0x148bbb[_0x4d1b6c]={'$like':'%'+_0x2845b0[_0x561d('0x2e')]['filter']+'%'};return _0x148bbb;})});}_0x4a8cd9=_[_0x561d('0x39')]({},_0x4a8cd9,_0x2845b0[_0x561d('0x3c')]);return _0x4c6c55[_0x561d('0x4a')](_0x4a8cd9);}})[_0x561d('0x23')](function(_0x417669){if(_0x417669){_0xa55d4=_0x417669[_0x561d('0x34')];if(!_0x2845b0['query']['hasOwnProperty'](_0x561d('0x4b'))){_0x4a8cd9[_0x561d('0x1d')]=qs['limit'](_0x2845b0['query']['limit']);_0x4a8cd9['offset']=qs['offset'](_0x2845b0[_0x561d('0x2e')]['offset']);}return _0x4c6c55[_0x561d('0x4a')](_0x4a8cd9);}})[_0x561d('0x23')](function(_0x332364){if(_0x332364){return _0x332364?{'count':_0xa55d4,'rows':_0x332364}:null;}})[_0x561d('0x23')](respondWithResult(_0x91fe8d,null))[_0x561d('0x40')](handleError(_0x91fe8d,null));};exports[_0x561d('0x4c')]=function(_0x358aab,_0x35dae3,_0x4f5c01){return db[_0x561d('0x4d')][_0x561d('0x43')]({'where':{'id':_0x358aab[_0x561d('0x42')]['id']}})[_0x561d('0x23')](handleEntityNotFound(_0x35dae3,null))[_0x561d('0x23')](function(_0xeb1d4f){if(_0xeb1d4f){return _0xeb1d4f['addActions'](_0x358aab['body'][_0x561d('0x47')],_['omit'](_0x358aab[_0x561d('0x45')],['ids','id'])||{});}})['then'](respondWithResult(_0x35dae3,null))[_0x561d('0x40')](handleError(_0x35dae3,null));};exports[_0x561d('0x4e')]=function(_0x25e56e,_0x40a700,_0x21d13d){var _0x50bd72={};var _0x7d92de={};var _0x1eb250;var _0x55cd77;return db['Automation'][_0x561d('0x49')]({'where':{'id':_0x25e56e[_0x561d('0x42')]['id']}})[_0x561d('0x23')](handleEntityNotFound(_0x40a700,null))[_0x561d('0x23')](function(_0x21ffb5){if(_0x21ffb5){_0x1eb250=_0x21ffb5;_0x7d92de[_0x561d('0x2d')]=_[_0x561d('0x2f')](db['Action']['rawAttributes']);_0x7d92de[_0x561d('0x2e')]=_[_0x561d('0x2f')](_0x25e56e[_0x561d('0x2e')]);_0x7d92de[_0x561d('0x30')]=_[_0x561d('0x31')](_0x7d92de['model'],_0x7d92de[_0x561d('0x2e')]);_0x50bd72[_0x561d('0x32')]=_[_0x561d('0x31')](_0x7d92de[_0x561d('0x2d')],qs[_0x561d('0x33')](_0x25e56e[_0x561d('0x2e')][_0x561d('0x33')]));_0x50bd72[_0x561d('0x32')]=_0x50bd72[_0x561d('0x32')]['length']?_0x50bd72['attributes']:_0x7d92de['model'];_0x50bd72[_0x561d('0x35')]=qs[_0x561d('0x36')](_0x25e56e[_0x561d('0x2e')][_0x561d('0x36')]);_0x50bd72[_0x561d('0x37')]=qs[_0x561d('0x30')](_[_0x561d('0x38')](_0x25e56e['query'],_0x7d92de[_0x561d('0x30')]));if(_0x25e56e[_0x561d('0x2e')][_0x561d('0x3b')]){_0x50bd72[_0x561d('0x37')]=_[_0x561d('0x39')](_0x50bd72[_0x561d('0x37')],{'$or':_[_0x561d('0x29')](_0x50bd72[_0x561d('0x32')],function(_0x1eeb64){var _0x3a31cf={};_0x3a31cf[_0x1eeb64]={'$like':'%'+_0x25e56e[_0x561d('0x2e')][_0x561d('0x3b')]+'%'};return _0x3a31cf;})});}_0x50bd72=_['merge']({},_0x50bd72,_0x25e56e[_0x561d('0x3c')]);return _0x1eb250[_0x561d('0x4e')](_0x50bd72);}})[_0x561d('0x23')](function(_0x5a2c97){if(_0x5a2c97){_0x55cd77=_0x5a2c97['length'];if(!_0x25e56e[_0x561d('0x2e')][_0x561d('0x4f')]('nolimit')){_0x50bd72[_0x561d('0x1d')]=qs[_0x561d('0x1d')](_0x25e56e[_0x561d('0x2e')]['limit']);_0x50bd72[_0x561d('0x1a')]=qs[_0x561d('0x1a')](_0x25e56e[_0x561d('0x2e')][_0x561d('0x1a')]);}return _0x1eb250[_0x561d('0x4e')](_0x50bd72);}})['then'](function(_0x1b6601){if(_0x1b6601){return _0x1b6601?{'count':_0x55cd77,'rows':_0x1b6601}:null;}})[_0x561d('0x23')](respondWithResult(_0x40a700,null))['catch'](handleError(_0x40a700,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index c11deb2..915e8e8 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 _0x0622=['bluebird','request-promise','path','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','api'];(function(_0x3ccdf8,_0x584ceb){var _0x243dab=function(_0x1a90d1){while(--_0x1a90d1){_0x3ccdf8['push'](_0x3ccdf8['shift']());}};_0x243dab(++_0x584ceb);}(_0x0622,0x1c1));var _0x2062=function(_0x493370,_0x4c7fac){_0x493370=_0x493370-0x0;var _0xac15d=_0x0622[_0x493370];return _0xac15d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x2062('0x0'));var moment=require('moment');var BPromise=require(_0x2062('0x1'));var rp=require(_0x2062('0x2'));var fs=require('fs');var path=require(_0x2062('0x3'));var rimraf=require('rimraf');var config=require(_0x2062('0x4'));var attributes=require(_0x2062('0x5'));module[_0x2062('0x6')]=function(_0x25413e,_0x3b9199){return _0x25413e[_0x2062('0x7')](_0x2062('0x8'),attributes,{'tableName':_0x2062('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe9f7=['./automation.attributes','exports','Automation','tools_automations','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x43a34d,_0x2e07f2){var _0x18ff9b=function(_0x1a634d){while(--_0x1a634d){_0x43a34d['push'](_0x43a34d['shift']());}};_0x18ff9b(++_0x2e07f2);}(_0xe9f7,0x68));var _0x7e9f=function(_0x42f3a5,_0x3a4470){_0x42f3a5=_0x42f3a5-0x0;var _0x1a7d74=_0xe9f7[_0x42f3a5];return _0x1a7d74;};'use strict';var _=require('lodash');var util=require(_0x7e9f('0x0'));var logger=require(_0x7e9f('0x1'))(_0x7e9f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7e9f('0x3'));var fs=require('fs');var path=require(_0x7e9f('0x4'));var rimraf=require(_0x7e9f('0x5'));var config=require('../../config/environment');var attributes=require(_0x7e9f('0x6'));module[_0x7e9f('0x7')]=function(_0x4a372c,_0x3663dc){return _0x4a372c['define'](_0x7e9f('0x8'),attributes,{'tableName':_0x7e9f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index b02c6ba..c179f10 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 _0xbecf=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Automation,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis'];(function(_0x144b9d,_0x6329cc){var _0x3ccfc1=function(_0x7ce284){while(--_0x7ce284){_0x144b9d['push'](_0x144b9d['shift']());}};_0x3ccfc1(++_0x6329cc);}(_0xbecf,0x15c));var _0xfbec=function(_0x2de6f5,_0x1fcd85){_0x2de6f5=_0x2de6f5-0x0;var _0x377e6e=_0xbecf[_0x2de6f5];return _0x377e6e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfbec('0x0'));var BPromise=require(_0xfbec('0x1'));var rs=require(_0xfbec('0x2'));var fs=require('fs');var Redis=require(_0xfbec('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfbec('0x4'));var logger=require(_0xfbec('0x5'))(_0xfbec('0x6'));var config=require(_0xfbec('0x7'));var jayson=require(_0xfbec('0x8'));var client=jayson['client'][_0xfbec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34a717,_0x33c701,_0x410cab){return new BPromise(function(_0x43bc5b,_0x312ad1){return client[_0xfbec('0xa')](_0x34a717,_0x410cab)[_0xfbec('0xb')](function(_0x21863f){logger['info']('Automation,\x20%s,\x20%s',_0x33c701,'request\x20sent');logger[_0xfbec('0xc')](_0xfbec('0xd'),_0x33c701,_0xfbec('0xe'),JSON[_0xfbec('0xf')](_0x21863f));if(_0x21863f[_0xfbec('0x10')]){if(_0x21863f['error'][_0xfbec('0x11')]===0x1f4){logger[_0xfbec('0x10')](_0xfbec('0x12'),_0x33c701,_0x21863f[_0xfbec('0x10')]['message']);return _0x312ad1(_0x21863f[_0xfbec('0x10')][_0xfbec('0x13')]);}logger[_0xfbec('0x10')](_0xfbec('0x12'),_0x33c701,_0x21863f['error'][_0xfbec('0x13')]);return _0x43bc5b(_0x21863f['error'][_0xfbec('0x13')]);}else{logger['info'](_0xfbec('0x12'),_0x33c701,_0xfbec('0xe'));_0x43bc5b(_0x21863f[_0xfbec('0x14')]['message']);}})[_0xfbec('0x15')](function(_0x2a3329){logger[_0xfbec('0x10')]('Automation,\x20%s,\x20%s',_0x33c701,_0x2a3329);_0x312ad1(_0x2a3329);});});} \ No newline at end of file +var _0x5b6e=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','Automation,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','ioredis'];(function(_0x3f8dc7,_0x28efb9){var _0x513590=function(_0x149e19){while(--_0x149e19){_0x3f8dc7['push'](_0x3f8dc7['shift']());}};_0x513590(++_0x28efb9);}(_0x5b6e,0x14c));var _0xe5b6=function(_0x5caa2d,_0x56281a){_0x5caa2d=_0x5caa2d-0x0;var _0x1eb3e8=_0x5b6e[_0x5caa2d];return _0x1eb3e8;};'use strict';var _=require(_0xe5b6('0x0'));var util=require(_0xe5b6('0x1'));var moment=require('moment');var BPromise=require(_0xe5b6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe5b6('0x3'));var db=require(_0xe5b6('0x4'))['db'];var utils=require(_0xe5b6('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xe5b6('0x6'));var jayson=require(_0xe5b6('0x7'));var client=jayson[_0xe5b6('0x8')][_0xe5b6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x554d53,_0x17ec5f,_0x326502){return new BPromise(function(_0x2bde31,_0x587efe){return client[_0xe5b6('0xa')](_0x554d53,_0x326502)['then'](function(_0x3f908a){logger[_0xe5b6('0xb')]('Automation,\x20%s,\x20%s',_0x17ec5f,_0xe5b6('0xc'));logger[_0xe5b6('0xd')]('Automation,\x20%s,\x20%s,\x20%s',_0x17ec5f,_0xe5b6('0xc'),JSON[_0xe5b6('0xe')](_0x3f908a));if(_0x3f908a['error']){if(_0x3f908a[_0xe5b6('0xf')][_0xe5b6('0x10')]===0x1f4){logger['error'](_0xe5b6('0x11'),_0x17ec5f,_0x3f908a[_0xe5b6('0xf')][_0xe5b6('0x12')]);return _0x587efe(_0x3f908a[_0xe5b6('0xf')][_0xe5b6('0x12')]);}logger['error'](_0xe5b6('0x11'),_0x17ec5f,_0x3f908a[_0xe5b6('0xf')][_0xe5b6('0x12')]);return _0x2bde31(_0x3f908a[_0xe5b6('0xf')][_0xe5b6('0x12')]);}else{logger[_0xe5b6('0xb')](_0xe5b6('0x11'),_0x17ec5f,_0xe5b6('0xc'));_0x2bde31(_0x3f908a[_0xe5b6('0x13')][_0xe5b6('0x12')]);}})[_0xe5b6('0x14')](function(_0x5dd731){logger[_0xe5b6('0xf')]('Automation,\x20%s,\x20%s',_0x17ec5f,_0x5dd731);_0x587efe(_0x5dd731);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index a99d1ad..d202a86 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 _0xb19f=['/:id/actions','getActions','post','create','addConditions','addActions','put','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','./automation.controller','isAuthenticated','index','/:id','show','/:id/conditions','getConditions'];(function(_0x2e9482,_0x5c4256){var _0x2eef28=function(_0x3e2410){while(--_0x3e2410){_0x2e9482['push'](_0x2e9482['shift']());}};_0x2eef28(++_0x5c4256);}(_0xb19f,0x7d));var _0xfb19=function(_0x24ddf6,_0x114e56){_0x24ddf6=_0x24ddf6-0x0;var _0x393d70=_0xb19f[_0x24ddf6];return _0x393d70;};'use strict';var multer=require(_0xfb19('0x0'));var util=require(_0xfb19('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfb19('0x2'));var router=express[_0xfb19('0x3')]();var fs_extra=require(_0xfb19('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xfb19('0x5'));var config=require('../../config/environment');var controller=require(_0xfb19('0x6'));router['get']('/',auth[_0xfb19('0x7')](),controller[_0xfb19('0x8')]);router['get'](_0xfb19('0x9'),auth['isAuthenticated'](),controller[_0xfb19('0xa')]);router['get'](_0xfb19('0xb'),auth['isAuthenticated'](),controller[_0xfb19('0xc')]);router['get'](_0xfb19('0xd'),auth[_0xfb19('0x7')](),controller[_0xfb19('0xe')]);router[_0xfb19('0xf')]('/',auth[_0xfb19('0x7')](),controller[_0xfb19('0x10')]);router[_0xfb19('0xf')](_0xfb19('0xb'),auth[_0xfb19('0x7')](),controller[_0xfb19('0x11')]);router[_0xfb19('0xf')](_0xfb19('0xd'),auth[_0xfb19('0x7')](),controller[_0xfb19('0x12')]);router[_0xfb19('0x13')](_0xfb19('0x9'),auth[_0xfb19('0x7')](),controller['update']);router[_0xfb19('0x14')]('/:id',auth[_0xfb19('0x7')](),controller[_0xfb19('0x15')]);module[_0xfb19('0x16')]=router; \ No newline at end of file +var _0x6ff1=['delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','/:id','update'];(function(_0x35a274,_0x98b399){var _0x40d905=function(_0x5c8455){while(--_0x5c8455){_0x35a274['push'](_0x35a274['shift']());}};_0x40d905(++_0x98b399);}(_0x6ff1,0x10a));var _0x16ff=function(_0x4e13c8,_0x3656e6){_0x4e13c8=_0x4e13c8-0x0;var _0x41962d=_0x6ff1[_0x4e13c8];return _0x41962d;};'use strict';var multer=require(_0x16ff('0x0'));var util=require(_0x16ff('0x1'));var path=require(_0x16ff('0x2'));var timeout=require(_0x16ff('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x16ff('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x16ff('0x5'));var config=require(_0x16ff('0x6'));var controller=require(_0x16ff('0x7'));router[_0x16ff('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x16ff('0x9')](),controller[_0x16ff('0xa')]);router[_0x16ff('0x8')](_0x16ff('0xb'),auth[_0x16ff('0x9')](),controller[_0x16ff('0xc')]);router[_0x16ff('0x8')](_0x16ff('0xd'),auth[_0x16ff('0x9')](),controller[_0x16ff('0xe')]);router[_0x16ff('0xf')]('/',auth[_0x16ff('0x9')](),controller[_0x16ff('0x10')]);router[_0x16ff('0xf')](_0x16ff('0xb'),auth[_0x16ff('0x9')](),controller[_0x16ff('0x11')]);router[_0x16ff('0xf')](_0x16ff('0xd'),auth[_0x16ff('0x9')](),controller['addActions']);router['put'](_0x16ff('0x12'),auth[_0x16ff('0x9')](),controller[_0x16ff('0x13')]);router[_0x16ff('0x14')](_0x16ff('0x12'),auth[_0x16ff('0x9')](),controller['destroy']);module[_0x16ff('0x15')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 9bc5f9a..555d1f0 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 _0x4ec7=['NoSuchNumber\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)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\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)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'];(function(_0x344b68,_0x3d6992){var _0x1a66c4=function(_0x10180f){while(--_0x10180f){_0x344b68['push'](_0x344b68['shift']());}};_0x1a66c4(++_0x3d6992);}(_0x4ec7,0x102));var _0x74ec=function(_0x3beb1a,_0x19427d){_0x3beb1a=_0x3beb1a-0x0;var _0x4fd02d=_0x4ec7[_0x3beb1a];return _0x4fd02d;};'use strict';var Sequelize=require(_0x74ec('0x0'));module[_0x74ec('0x1')]={'name':{'type':Sequelize[_0x74ec('0x2')],'unique':_0x74ec('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x74ec('0x4')](_0x74ec('0x5')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x74ec('0x2')]},'active':{'type':Sequelize[_0x74ec('0x6')],'defaultValue':0x0,'comment':_0x74ec('0x7')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x74ec('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x74ec('0x9')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x74ec('0xa')](0x3)[_0x74ec('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x74ec('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0x74ec('0xa')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x74ec('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x74ec('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x74ec('0xa')](0x3)[_0x74ec('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x74ec('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0x74ec('0xa')](0x5)[_0x74ec('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x74ec('0xa')](0x3)[_0x74ec('0x8')],'defaultValue':0x3,'comment':_0x74ec('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x74ec('0xa')](0x5)[_0x74ec('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x74ec('0xa')](0x3)[_0x74ec('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x74ec('0xf')},'dialTimezone':{'type':Sequelize[_0x74ec('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x74ec('0x2')],'defaultValue':_0x74ec('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x74ec('0x4')](_0x74ec('0x11'),_0x74ec('0x12'),_0x74ec('0x13')),'defaultValue':_0x74ec('0x11')},'dialAMDActive':{'type':Sequelize[_0x74ec('0x6')],'defaultValue':0x0,'comment':_0x74ec('0x14')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x74ec('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x74ec('0xa')](0x9)[_0x74ec('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x74ec('0xa')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x74ec('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x74ec('0xa')](0x9)[_0x74ec('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x74ec('0xa')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x74ec('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x74ec('0xa')](0x9)[_0x74ec('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x74ec('0xa')](0x9)[_0x74ec('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x74ec('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x74ec('0xa')](0x5)[_0x74ec('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x74ec('0xa')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x74ec('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0x74ec('0x4')](_0x74ec('0x19'),_0x74ec('0x1a')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x74ec('0xa')](0x3)[_0x74ec('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x74ec('0x1b')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x74ec('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x74ec('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x74ec('0xa')](0x3)[_0x74ec('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x74ec('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x74ec('0xa')](0x5)[_0x74ec('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x74ec('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0x74ec('0xa')](0x3)[_0x74ec('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x74ec('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x74ec('0xa')](0x3)[_0x74ec('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x74ec('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x74ec('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x74ec('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0x74ec('0xa')](0x3)[_0x74ec('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x74ec('0x21')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x74ec('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x74ec('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x74ec('0xa')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x74ec('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x74ec('0xa')](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 _0x91da=['Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x91da,0xe7));var _0xa91d=function(_0x5de023,_0x1eecad){_0x5de023=_0x5de023-0x0;var _0x283255=_0x91da[_0x5de023];return _0x283255;};'use strict';var Sequelize=require(_0xa91d('0x0'));module[_0xa91d('0x1')]={'name':{'type':Sequelize[_0xa91d('0x2')],'unique':_0xa91d('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xa91d('0x4')),'allowNull':![],'defaultValue':_0xa91d('0x4')},'description':{'type':Sequelize[_0xa91d('0x2')]},'active':{'type':Sequelize[_0xa91d('0x5')],'defaultValue':0x0,'comment':_0xa91d('0x6')},'limitCalls':{'type':Sequelize[_0xa91d('0x7')](0x4)[_0xa91d('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xa91d('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0xa91d('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xa91d('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xa91d('0x7')](0x3)[_0xa91d('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa91d('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0xa91d('0x7')](0x3)[_0xa91d('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'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[_0xa91d('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xa91d('0x7')](0x5)[_0xa91d('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa91d('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xa91d('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xa91d('0x7')](0x5)[_0xa91d('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa91d('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0xa91d('0x7')](0x3)[_0xa91d('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xa91d('0xe')},'dialTimezone':{'type':Sequelize[_0xa91d('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xa91d('0x2')],'defaultValue':_0xa91d('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0xa91d('0x10')]('always',_0xa91d('0x11'),_0xa91d('0x12')),'defaultValue':_0xa91d('0x13')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xa91d('0x14')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xa91d('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xa91d('0x15')},'dialAMDGreeting':{'type':Sequelize[_0xa91d('0x7')](0x9)[_0xa91d('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xa91d('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xa91d('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xa91d('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa91d('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0xa91d('0x7')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xa91d('0x7')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xa91d('0x7')](0x9)[_0xa91d('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xa91d('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xa91d('0x7')](0x5)[_0xa91d('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xa91d('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xa91d('0x7')](0x9)[_0xa91d('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xa91d('0x10')]('DESC',_0xa91d('0x1a')),'defaultValue':_0xa91d('0x1b')},'dialPrefix':{'type':Sequelize[_0xa91d('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xa91d('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa91d('0x1c')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xa91d('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa91d('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xa91d('0x7')](0x3)[_0xa91d('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa91d('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa91d('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa91d('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0xa91d('0x7')](0x3)[_0xa91d('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa91d('0x20')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa91d('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa91d('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xa91d('0x7')](0x3)[_0xa91d('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa91d('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa91d('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa91d('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0xa91d('0x7')](0x3)[_0xa91d('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xa91d('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xa91d('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa91d('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xa91d('0x7')](0x5)[_0xa91d('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa91d('0x25')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index e40b8f6..c027d67 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 _0x6d03=['stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','autoAssociation','update','getHoppers','findOne','CmHopper','pick','CampaignId','getHopperHistories','CmHopperHistory','CmHopperFinal','order','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','select','phone','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','get','IvrCampaigns','UserProfileResource','destroy','sendStatus'];(function(_0x47a854,_0x5871dd){var _0x51a0af=function(_0x3c0d6d){while(--_0x3c0d6d){_0x47a854['push'](_0x47a854['shift']());}};_0x51a0af(++_0x5871dd);}(_0x6d03,0xe5));var _0x36d0=function(_0x2ecfd5,_0x411d04){_0x2ecfd5=_0x2ecfd5-0x0;var _0x5284ff=_0x6d03[_0x2ecfd5];return _0x5284ff;};'use strict';var emlformat=require(_0x36d0('0x0'));var rimraf=require(_0x36d0('0x1'));var zipdir=require(_0x36d0('0x2'));var jsonpatch=require(_0x36d0('0x3'));var rp=require(_0x36d0('0x4'));var moment=require('moment');var BPromise=require(_0x36d0('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x36d0('0x6'));var sox=require(_0x36d0('0x7'));var csv=require(_0x36d0('0x8'));var ejs=require(_0x36d0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x36d0('0xa'));var squel=require(_0x36d0('0xb'));var crypto=require(_0x36d0('0xc'));var jsforce=require(_0x36d0('0xd'));var deskjs=require(_0x36d0('0xe'));var toCsv=require(_0x36d0('0x8'));var querystring=require(_0x36d0('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x36d0('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x36d0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x36d0('0x12'))(_0x36d0('0x13'));var utils=require(_0x36d0('0x14'));var config=require(_0x36d0('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b1137,_0x1e29d3){_0x1e29d3=_0x1e29d3||0xcc;return function(_0x42e0cd){if(_0x42e0cd){return _0x3b1137['sendStatus'](_0x1e29d3);}return _0x3b1137[_0x36d0('0x16')](_0x1e29d3)[_0x36d0('0x17')]();};}function respondWithResult(_0x2ddf20,_0x57ef51){_0x57ef51=_0x57ef51||0xc8;return function(_0x1d8c31){if(_0x1d8c31){return _0x2ddf20['status'](_0x57ef51)[_0x36d0('0x18')](_0x1d8c31);}};}function respondWithFilteredResult(_0x129eb8,_0x56480b){return function(_0x3f2141){if(_0x3f2141){var _0x339a13=typeof _0x56480b[_0x36d0('0x19')]===_0x36d0('0x1a')&&typeof _0x56480b[_0x36d0('0x1b')]==='undefined';var _0x5d19bb=_0x3f2141[_0x36d0('0x1c')];var _0x5e6819=_0x339a13?0x0:_0x56480b['offset'];var _0x504446=_0x339a13?_0x3f2141[_0x36d0('0x1c')]:_0x56480b['offset']+_0x56480b[_0x36d0('0x1b')];var _0x5878c7;if(_0x504446>=_0x5d19bb){_0x504446=_0x5d19bb;_0x5878c7=0xc8;}else{_0x5878c7=0xce;}_0x129eb8[_0x36d0('0x16')](_0x5878c7);return _0x129eb8[_0x36d0('0x1d')](_0x36d0('0x1e'),_0x5e6819+'-'+_0x504446+'/'+_0x5d19bb)[_0x36d0('0x18')](_0x3f2141);}return null;};}function patchUpdates(_0x34ef22){return function(_0x2a3a99){try{jsonpatch[_0x36d0('0x1f')](_0x2a3a99,_0x34ef22,!![]);}catch(_0x37a4b8){return BPromise[_0x36d0('0x20')](_0x37a4b8);}return _0x2a3a99['save']();};}function saveUpdates(_0x5202d0,_0x2e4974){return function(_0x243a3e){if(_0x243a3e){return _0x243a3e['update'](_0x5202d0)['then'](function(_0x5bebc8){return _0x5bebc8;});}return null;};}function removeEntity(_0x54080f,_0x508e99){return function(_0xf77b9d){if(_0xf77b9d){return _0xf77b9d['destroy']()[_0x36d0('0x21')](function(){var _0x285a46=_0xf77b9d[_0x36d0('0x22')]({'plain':!![]});var _0x5d9476=_0x36d0('0x23');return db[_0x36d0('0x24')][_0x36d0('0x25')]({'where':{'type':_0x5d9476,'resourceId':_0x285a46['id']}})['then'](function(){return _0xf77b9d;});})[_0x36d0('0x21')](function(){_0x54080f['status'](0xcc)[_0x36d0('0x17')]();});}};}function handleEntityNotFound(_0x2bb686,_0x8268a9){return function(_0x3f2f35){if(!_0x3f2f35){_0x2bb686[_0x36d0('0x26')](0x194);}return _0x3f2f35;};}function handleError(_0x2cbcca,_0x32151b){_0x32151b=_0x32151b||0x1f4;return function(_0x40fbbe){logger['error'](_0x40fbbe[_0x36d0('0x27')]);if(_0x40fbbe['name']){delete _0x40fbbe[_0x36d0('0x28')];}_0x2cbcca['status'](_0x32151b)[_0x36d0('0x29')](_0x40fbbe);};}exports[_0x36d0('0x2a')]=function(_0x40c733,_0xf63c16){var _0x2f8e97={},_0x2d5e61={},_0x2f57ba={'count':0x0,'rows':[]};var _0x5e9109=_[_0x36d0('0x2b')](db[_0x36d0('0x2c')][_0x36d0('0x2d')],function(_0x2de87c){return{'name':_0x2de87c[_0x36d0('0x2e')],'type':_0x2de87c[_0x36d0('0x2f')][_0x36d0('0x30')]};});_0x2d5e61['model']=_[_0x36d0('0x2b')](_0x5e9109,_0x36d0('0x28'));_0x2d5e61[_0x36d0('0x31')]=_['keys'](_0x40c733['query']);_0x2d5e61[_0x36d0('0x32')]=_[_0x36d0('0x33')](_0x2d5e61[_0x36d0('0x34')],_0x2d5e61[_0x36d0('0x31')]);_0x2f8e97[_0x36d0('0x35')]=_[_0x36d0('0x33')](_0x2d5e61['model'],qs[_0x36d0('0x36')](_0x40c733['query']['fields']));_0x2f8e97[_0x36d0('0x35')]=_0x2f8e97['attributes'][_0x36d0('0x37')]?_0x2f8e97[_0x36d0('0x35')]:_0x2d5e61[_0x36d0('0x34')];if(!_0x40c733[_0x36d0('0x31')][_0x36d0('0x38')](_0x36d0('0x39'))){_0x2f8e97[_0x36d0('0x1b')]=qs['limit'](_0x40c733[_0x36d0('0x31')]['limit']);_0x2f8e97[_0x36d0('0x19')]=qs[_0x36d0('0x19')](_0x40c733[_0x36d0('0x31')][_0x36d0('0x19')]);}_0x2f8e97['order']=qs[_0x36d0('0x3a')](_0x40c733[_0x36d0('0x31')][_0x36d0('0x3a')]);_0x2f8e97[_0x36d0('0x3b')]=qs[_0x36d0('0x32')](_['pick'](_0x40c733['query'],_0x2d5e61[_0x36d0('0x32')]),_0x5e9109);if(_0x40c733[_0x36d0('0x31')][_0x36d0('0x3c')]){_0x2f8e97[_0x36d0('0x3b')]=_[_0x36d0('0x3d')](_0x2f8e97['where'],{'$or':_[_0x36d0('0x2b')](_0x5e9109,function(_0x3890ac){if(_0x3890ac[_0x36d0('0x2f')]!=='VIRTUAL'){var _0x3f6d39={};_0x3f6d39[_0x3890ac[_0x36d0('0x28')]]={'$like':'%'+_0x40c733[_0x36d0('0x31')][_0x36d0('0x3c')]+'%'};return _0x3f6d39;}})});}_0x2f8e97=_[_0x36d0('0x3d')]({},_0x2f8e97,_0x40c733[_0x36d0('0x3e')]);var _0x5a00e4={'where':_0x2f8e97[_0x36d0('0x3b')]};return db['Campaign'][_0x36d0('0x1c')](_0x5a00e4)[_0x36d0('0x21')](function(_0x513106){_0x2f57ba[_0x36d0('0x1c')]=_0x513106;if(_0x40c733[_0x36d0('0x31')][_0x36d0('0x3f')]){_0x2f8e97[_0x36d0('0x40')]=[{'all':!![]}];}return db[_0x36d0('0x2c')][_0x36d0('0x41')](_0x2f8e97);})[_0x36d0('0x21')](function(_0x2ce8b3){_0x2f57ba[_0x36d0('0x42')]=_0x2ce8b3;return _0x2f57ba;})[_0x36d0('0x21')](respondWithFilteredResult(_0xf63c16,_0x2f8e97))['catch'](handleError(_0xf63c16,null));};exports[_0x36d0('0x43')]=function(_0x483c0c,_0x457a8a){var _0x4fcdae={'raw':![],'where':{'id':_0x483c0c[_0x36d0('0x44')]['id']}},_0x54c412={};_0x54c412['model']=_[_0x36d0('0x45')](db[_0x36d0('0x2c')]['rawAttributes']);_0x54c412[_0x36d0('0x31')]=_['keys'](_0x483c0c[_0x36d0('0x31')]);_0x54c412['filters']=_['intersection'](_0x54c412['model'],_0x54c412[_0x36d0('0x31')]);_0x4fcdae['attributes']=_[_0x36d0('0x33')](_0x54c412['model'],qs['fields'](_0x483c0c[_0x36d0('0x31')][_0x36d0('0x36')]));_0x4fcdae[_0x36d0('0x35')]=_0x4fcdae[_0x36d0('0x35')][_0x36d0('0x37')]?_0x4fcdae[_0x36d0('0x35')]:_0x54c412[_0x36d0('0x34')];if(_0x483c0c[_0x36d0('0x31')]['includeAll']){_0x4fcdae[_0x36d0('0x40')]=[{'all':!![]}];}_0x4fcdae=_['merge']({},_0x4fcdae,_0x483c0c[_0x36d0('0x3e')]);return db[_0x36d0('0x2c')][_0x36d0('0x46')](_0x4fcdae)[_0x36d0('0x21')](handleEntityNotFound(_0x457a8a,null))[_0x36d0('0x21')](respondWithResult(_0x457a8a,null))[_0x36d0('0x47')](handleError(_0x457a8a,null));};exports[_0x36d0('0x48')]=function(_0x12eb49,_0x1b0ff7){return db[_0x36d0('0x2c')][_0x36d0('0x48')](_0x12eb49[_0x36d0('0x49')],{})[_0x36d0('0x21')](function(_0x3e616e){var _0x34254a=_0x12eb49[_0x36d0('0x4a')][_0x36d0('0x22')]({'plain':!![]});if(!_0x34254a)throw new Error(_0x36d0('0x4b'));if(_0x34254a[_0x36d0('0x4c')]==='user'){var _0x559d58=_0x3e616e[_0x36d0('0x22')]({'plain':!![]});var _0x3c4abe='IvrCampaigns';return db[_0x36d0('0x4d')][_0x36d0('0x46')]({'where':{'name':_0x3c4abe,'userProfileId':_0x34254a[_0x36d0('0x4e')]},'raw':!![]})[_0x36d0('0x21')](function(_0x358119){if(_0x358119&&_0x358119['autoAssociation']===0x0){return db[_0x36d0('0x24')][_0x36d0('0x48')]({'name':_0x559d58['name'],'resourceId':_0x559d58['id'],'type':_0x358119[_0x36d0('0x28')],'sectionId':_0x358119['id']},{})[_0x36d0('0x21')](function(){return _0x3e616e;});}else{return _0x3e616e;}})[_0x36d0('0x47')](function(_0x333813){logger[_0x36d0('0x4f')](_0x36d0('0x50'),_0x333813);throw _0x333813;});}return _0x3e616e;})[_0x36d0('0x21')](respondWithResult(_0x1b0ff7,0xc9))[_0x36d0('0x47')](handleError(_0x1b0ff7,null));};exports['clone']=function(_0x2acb01,_0x1a9d28){var _0x4a0d14={'where':{'id':_0x2acb01[_0x36d0('0x44')]['id']}},_0x54cecf={};_0x54cecf[_0x36d0('0x34')]=_[_0x36d0('0x45')](db[_0x36d0('0x2c')][_0x36d0('0x2d')]);_0x4a0d14[_0x36d0('0x35')]=_[_0x36d0('0x33')](_0x54cecf[_0x36d0('0x34')],qs[_0x36d0('0x36')](_0x2acb01[_0x36d0('0x31')]['fields']));_0x4a0d14['attributes']=_0x4a0d14[_0x36d0('0x35')][_0x36d0('0x37')]?_0x4a0d14['attributes']:_0x54cecf[_0x36d0('0x34')];if(_0x2acb01[_0x36d0('0x31')][_0x36d0('0x3f')]){_0x4a0d14[_0x36d0('0x40')]=[{'all':!![]}];}_0x4a0d14=_[_0x36d0('0x3d')]({},_0x4a0d14,_0x2acb01[_0x36d0('0x3e')]);return db['Campaign']['find'](_0x4a0d14)['then'](handleEntityNotFound(_0x1a9d28,null))[_0x36d0('0x21')](function(_0x145adc){if(_0x145adc){var _0x277c46=_0x145adc[_0x36d0('0x22')]({'plain':!![]});_0x277c46=qs[_0x36d0('0x51')](_0x277c46,['id',_0x36d0('0x52'),'updatedAt']);_0x2acb01[_0x36d0('0x49')]=_[_0x36d0('0x51')](_0x2acb01[_0x36d0('0x49')],['id',_0x36d0('0x52'),_0x36d0('0x53')]);return db[_0x36d0('0x2c')][_0x36d0('0x48')](_[_0x36d0('0x3d')](_0x277c46,_0x2acb01[_0x36d0('0x49')]),{'include':_0x2acb01[_0x36d0('0x31')][_0x36d0('0x3f')]?[{'all':!![]}]:undefined})['then'](function(_0x4d4dab){var _0x35896d=_0x2acb01['user'][_0x36d0('0x22')]({'plain':!![]});if(!_0x35896d)throw new Error(_0x36d0('0x4b'));if(_0x35896d['role']===_0x36d0('0x4a')){var _0x119c00=_0x4d4dab[_0x36d0('0x22')]({'plain':!![]});var _0x5c8f82=_0x36d0('0x23');return db[_0x36d0('0x4d')]['find']({'where':{'name':_0x5c8f82,'userProfileId':_0x35896d[_0x36d0('0x4e')]},'raw':!![]})[_0x36d0('0x21')](function(_0x8619d7){if(_0x8619d7&&_0x8619d7[_0x36d0('0x54')]===0x0){return db[_0x36d0('0x24')][_0x36d0('0x48')]({'name':_0x119c00[_0x36d0('0x28')],'resourceId':_0x119c00['id'],'type':_0x8619d7[_0x36d0('0x28')],'sectionId':_0x8619d7['id']},{})[_0x36d0('0x21')](function(){return _0x4d4dab;});}else{return _0x4d4dab;}})['catch'](function(_0x36d873){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36d873);throw _0x36d873;});}return _0x4d4dab;});}})[_0x36d0('0x21')](respondWithResult(_0x1a9d28,0xc9))[_0x36d0('0x47')](handleError(_0x1a9d28,null));};exports[_0x36d0('0x55')]=function(_0x26e82d,_0x1b73db){if(_0x26e82d[_0x36d0('0x49')]['id']){delete _0x26e82d[_0x36d0('0x49')]['id'];}return db[_0x36d0('0x2c')][_0x36d0('0x46')]({'where':{'id':_0x26e82d[_0x36d0('0x44')]['id']}})[_0x36d0('0x21')](handleEntityNotFound(_0x1b73db,null))['then'](saveUpdates(_0x26e82d[_0x36d0('0x49')],null))['then'](respondWithResult(_0x1b73db,null))[_0x36d0('0x47')](handleError(_0x1b73db,null));};exports['destroy']=function(_0x452788,_0x247757){return db['Campaign'][_0x36d0('0x46')]({'where':{'id':_0x452788[_0x36d0('0x44')]['id']}})[_0x36d0('0x21')](handleEntityNotFound(_0x247757,null))[_0x36d0('0x21')](removeEntity(_0x247757,null))[_0x36d0('0x47')](handleError(_0x247757,null));};exports[_0x36d0('0x56')]=function(_0xe54356,_0x42917d,_0x3bb713){var _0x216e97={'raw':!![],'where':{}};var _0x51a7d1={};var _0x420972={'count':0x0,'rows':[]};return db[_0x36d0('0x2c')][_0x36d0('0x57')]({'where':{'id':_0xe54356[_0x36d0('0x44')]['id']}})[_0x36d0('0x21')](handleEntityNotFound(_0x42917d,null))[_0x36d0('0x21')](function(_0x418f10){if(_0x418f10){_0x51a7d1[_0x36d0('0x34')]=_[_0x36d0('0x45')](db[_0x36d0('0x58')][_0x36d0('0x2d')]);_0x51a7d1[_0x36d0('0x31')]=_[_0x36d0('0x45')](_0xe54356['query']);_0x51a7d1['filters']=_['intersection'](_0x51a7d1['model'],_0x51a7d1['query']);_0x216e97['attributes']=_[_0x36d0('0x33')](_0x51a7d1[_0x36d0('0x34')],qs[_0x36d0('0x36')](_0xe54356['query'][_0x36d0('0x36')]));_0x216e97[_0x36d0('0x35')]=_0x216e97[_0x36d0('0x35')][_0x36d0('0x37')]?_0x216e97[_0x36d0('0x35')]:_0x51a7d1[_0x36d0('0x34')];if(!_0xe54356[_0x36d0('0x31')]['hasOwnProperty'](_0x36d0('0x39'))){_0x216e97[_0x36d0('0x1b')]=qs[_0x36d0('0x1b')](_0xe54356['query'][_0x36d0('0x1b')]);_0x216e97['offset']=qs[_0x36d0('0x19')](_0xe54356[_0x36d0('0x31')]['offset']);}_0x216e97['order']=qs[_0x36d0('0x3a')](_0xe54356['query'][_0x36d0('0x3a')]);_0x216e97[_0x36d0('0x3b')]=qs['filters'](_[_0x36d0('0x59')](_0xe54356[_0x36d0('0x31')],_0x51a7d1[_0x36d0('0x32')]));_0x216e97[_0x36d0('0x3b')][_0x36d0('0x5a')]=_0x418f10['id'];if(_0xe54356[_0x36d0('0x31')][_0x36d0('0x3c')]){_0x216e97[_0x36d0('0x3b')]=_[_0x36d0('0x3d')](_0x216e97[_0x36d0('0x3b')],{'$or':_['map'](_0x216e97[_0x36d0('0x35')],function(_0x522055){var _0x216c2d={};_0x216c2d[_0x522055]={'$like':'%'+_0xe54356['query'][_0x36d0('0x3c')]+'%'};return _0x216c2d;})});}_0x216e97=_[_0x36d0('0x3d')]({},_0x216e97,_0xe54356[_0x36d0('0x3e')]);return db[_0x36d0('0x58')][_0x36d0('0x1c')]({'where':_0x216e97[_0x36d0('0x3b')]})[_0x36d0('0x21')](function(_0x522891){_0x420972[_0x36d0('0x1c')]=_0x522891;if(_0xe54356[_0x36d0('0x31')]['includeAll']){_0x216e97[_0x36d0('0x40')]=[{'all':!![]}];}return db[_0x36d0('0x58')][_0x36d0('0x41')](_0x216e97);})[_0x36d0('0x21')](function(_0xee845b){_0x420972['rows']=_0xee845b;return _0x420972;});}})[_0x36d0('0x21')](respondWithFilteredResult(_0x42917d,_0x216e97))[_0x36d0('0x47')](handleError(_0x42917d,null));};exports[_0x36d0('0x5b')]=function(_0x26d1fd,_0x302b2a,_0x58ec5b){var _0x5536ba={'raw':!![],'where':{}};var _0x1d6e5a={};var _0x5f1866={'count':0x0,'rows':[]};return db[_0x36d0('0x2c')]['findOne']({'where':{'id':_0x26d1fd['params']['id']}})[_0x36d0('0x21')](handleEntityNotFound(_0x302b2a,null))[_0x36d0('0x21')](function(_0x267c9a){if(_0x267c9a){_0x1d6e5a[_0x36d0('0x34')]=_[_0x36d0('0x45')](db[_0x36d0('0x5c')][_0x36d0('0x2d')]);_0x1d6e5a[_0x36d0('0x31')]=_['keys'](_0x26d1fd[_0x36d0('0x31')]);_0x1d6e5a['filters']=_['intersection'](_0x1d6e5a[_0x36d0('0x34')],_0x1d6e5a[_0x36d0('0x31')]);_0x5536ba[_0x36d0('0x35')]=_[_0x36d0('0x33')](_0x1d6e5a['model'],qs[_0x36d0('0x36')](_0x26d1fd['query'][_0x36d0('0x36')]));_0x5536ba[_0x36d0('0x35')]=_0x5536ba[_0x36d0('0x35')]['length']?_0x5536ba[_0x36d0('0x35')]:_0x1d6e5a['model'];if(!_0x26d1fd[_0x36d0('0x31')][_0x36d0('0x38')](_0x36d0('0x39'))){_0x5536ba[_0x36d0('0x1b')]=qs[_0x36d0('0x1b')](_0x26d1fd[_0x36d0('0x31')][_0x36d0('0x1b')]);_0x5536ba[_0x36d0('0x19')]=qs[_0x36d0('0x19')](_0x26d1fd['query'][_0x36d0('0x19')]);}_0x5536ba['order']=qs[_0x36d0('0x3a')](_0x26d1fd[_0x36d0('0x31')][_0x36d0('0x3a')]);_0x5536ba[_0x36d0('0x3b')]=qs[_0x36d0('0x32')](_[_0x36d0('0x59')](_0x26d1fd['query'],_0x1d6e5a[_0x36d0('0x32')]));_0x5536ba[_0x36d0('0x3b')][_0x36d0('0x5a')]=_0x267c9a['id'];if(_0x26d1fd['query'][_0x36d0('0x3c')]){_0x5536ba[_0x36d0('0x3b')]=_[_0x36d0('0x3d')](_0x5536ba[_0x36d0('0x3b')],{'$or':_[_0x36d0('0x2b')](_0x5536ba['attributes'],function(_0x545382){var _0x5b46df={};_0x5b46df[_0x545382]={'$like':'%'+_0x26d1fd[_0x36d0('0x31')][_0x36d0('0x3c')]+'%'};return _0x5b46df;})});}_0x5536ba=_[_0x36d0('0x3d')]({},_0x5536ba,_0x26d1fd[_0x36d0('0x3e')]);return db[_0x36d0('0x5c')][_0x36d0('0x1c')]({'where':_0x5536ba[_0x36d0('0x3b')]})[_0x36d0('0x21')](function(_0x3f15fa){_0x5f1866[_0x36d0('0x1c')]=_0x3f15fa;if(_0x26d1fd[_0x36d0('0x31')][_0x36d0('0x3f')]){_0x5536ba[_0x36d0('0x40')]=[{'all':!![]}];}return db[_0x36d0('0x5c')][_0x36d0('0x41')](_0x5536ba);})[_0x36d0('0x21')](function(_0x3079b4){_0x5f1866[_0x36d0('0x42')]=_0x3079b4;return _0x5f1866;});}})[_0x36d0('0x21')](respondWithFilteredResult(_0x302b2a,_0x5536ba))[_0x36d0('0x47')](handleError(_0x302b2a,null));};exports['getHopperFinals']=function(_0x2c9365,_0x4948df,_0x408f81){var _0xd1633b={'raw':!![],'where':{}};var _0x428eb2={};var _0x154931={'count':0x0,'rows':[]};return db[_0x36d0('0x2c')][_0x36d0('0x57')]({'where':{'id':_0x2c9365[_0x36d0('0x44')]['id']}})[_0x36d0('0x21')](handleEntityNotFound(_0x4948df,null))[_0x36d0('0x21')](function(_0xcae7d){if(_0xcae7d){_0x428eb2[_0x36d0('0x34')]=_[_0x36d0('0x45')](db[_0x36d0('0x5d')][_0x36d0('0x2d')]);_0x428eb2[_0x36d0('0x31')]=_[_0x36d0('0x45')](_0x2c9365[_0x36d0('0x31')]);_0x428eb2[_0x36d0('0x32')]=_[_0x36d0('0x33')](_0x428eb2[_0x36d0('0x34')],_0x428eb2[_0x36d0('0x31')]);_0xd1633b[_0x36d0('0x35')]=_['intersection'](_0x428eb2[_0x36d0('0x34')],qs[_0x36d0('0x36')](_0x2c9365['query'][_0x36d0('0x36')]));_0xd1633b[_0x36d0('0x35')]=_0xd1633b['attributes']['length']?_0xd1633b['attributes']:_0x428eb2[_0x36d0('0x34')];if(!_0x2c9365[_0x36d0('0x31')][_0x36d0('0x38')](_0x36d0('0x39'))){_0xd1633b[_0x36d0('0x1b')]=qs['limit'](_0x2c9365[_0x36d0('0x31')]['limit']);_0xd1633b['offset']=qs['offset'](_0x2c9365['query'][_0x36d0('0x19')]);}_0xd1633b[_0x36d0('0x5e')]=qs['sort'](_0x2c9365[_0x36d0('0x31')][_0x36d0('0x3a')]);_0xd1633b[_0x36d0('0x3b')]=qs[_0x36d0('0x32')](_[_0x36d0('0x59')](_0x2c9365[_0x36d0('0x31')],_0x428eb2[_0x36d0('0x32')]));_0xd1633b[_0x36d0('0x3b')][_0x36d0('0x5a')]=_0xcae7d['id'];if(_0x2c9365[_0x36d0('0x31')]['filter']){_0xd1633b[_0x36d0('0x3b')]=_[_0x36d0('0x3d')](_0xd1633b[_0x36d0('0x3b')],{'$or':_[_0x36d0('0x2b')](_0xd1633b['attributes'],function(_0x5b139d){var _0x4db4b8={};_0x4db4b8[_0x5b139d]={'$like':'%'+_0x2c9365[_0x36d0('0x31')][_0x36d0('0x3c')]+'%'};return _0x4db4b8;})});}_0xd1633b=_[_0x36d0('0x3d')]({},_0xd1633b,_0x2c9365[_0x36d0('0x3e')]);return db[_0x36d0('0x5d')][_0x36d0('0x1c')]({'where':_0xd1633b[_0x36d0('0x3b')]})[_0x36d0('0x21')](function(_0x5653c9){_0x154931['count']=_0x5653c9;if(_0x2c9365[_0x36d0('0x31')][_0x36d0('0x3f')]){_0xd1633b['include']=[{'all':!![]}];}return db[_0x36d0('0x5d')][_0x36d0('0x41')](_0xd1633b);})[_0x36d0('0x21')](function(_0x2ba62a){_0x154931[_0x36d0('0x42')]=_0x2ba62a;return _0x154931;});}})['then'](respondWithFilteredResult(_0x4948df,_0xd1633b))[_0x36d0('0x47')](handleError(_0x4948df,null));};exports[_0x36d0('0x5f')]=function(_0x15b642,_0x292106,_0x1719fd){var _0x2fe614={'raw':!![],'where':{}};var _0x48e973={};var _0xce6d2d={'count':0x0,'rows':[]};return db['Campaign'][_0x36d0('0x57')]({'where':{'id':_0x15b642['params']['id']}})[_0x36d0('0x21')](handleEntityNotFound(_0x292106,null))[_0x36d0('0x21')](function(_0x46e236){if(_0x46e236){_0x48e973[_0x36d0('0x34')]=_[_0x36d0('0x45')](db[_0x36d0('0x60')][_0x36d0('0x2d')]);_0x48e973[_0x36d0('0x31')]=_[_0x36d0('0x45')](_0x15b642[_0x36d0('0x31')]);_0x48e973[_0x36d0('0x32')]=_[_0x36d0('0x33')](_0x48e973['model'],_0x48e973[_0x36d0('0x31')]);_0x2fe614['attributes']=_[_0x36d0('0x33')](_0x48e973[_0x36d0('0x34')],qs[_0x36d0('0x36')](_0x15b642['query']['fields']));_0x2fe614['attributes']=_0x2fe614[_0x36d0('0x35')][_0x36d0('0x37')]?_0x2fe614[_0x36d0('0x35')]:_0x48e973['model'];if(!_0x15b642[_0x36d0('0x31')]['hasOwnProperty']('nolimit')){_0x2fe614['limit']=qs[_0x36d0('0x1b')](_0x15b642[_0x36d0('0x31')][_0x36d0('0x1b')]);_0x2fe614[_0x36d0('0x19')]=qs[_0x36d0('0x19')](_0x15b642['query']['offset']);}_0x2fe614['order']=qs[_0x36d0('0x3a')](_0x15b642[_0x36d0('0x31')][_0x36d0('0x3a')]);_0x2fe614['where']=qs['filters'](_[_0x36d0('0x59')](_0x15b642['query'],_0x48e973[_0x36d0('0x32')]));_0x2fe614[_0x36d0('0x3b')]['CampaignId']=_0x46e236['id'];if(_0x15b642[_0x36d0('0x31')][_0x36d0('0x3c')]){_0x2fe614[_0x36d0('0x3b')]=_['merge'](_0x2fe614['where'],{'$or':_['map'](_0x2fe614['attributes'],function(_0x489976){var _0x1207c0={};_0x1207c0[_0x489976]={'$like':'%'+_0x15b642[_0x36d0('0x31')][_0x36d0('0x3c')]+'%'};return _0x1207c0;})});}_0x2fe614=_[_0x36d0('0x3d')]({},_0x2fe614,_0x15b642['options']);return db[_0x36d0('0x60')][_0x36d0('0x1c')]({'where':_0x2fe614[_0x36d0('0x3b')]})[_0x36d0('0x21')](function(_0x2c9360){_0xce6d2d['count']=_0x2c9360;if(_0x15b642[_0x36d0('0x31')]['includeAll']){_0x2fe614[_0x36d0('0x40')]=[{'all':!![]}];}return db[_0x36d0('0x60')][_0x36d0('0x41')](_0x2fe614);})[_0x36d0('0x21')](function(_0x25ebc0){_0xce6d2d['rows']=_0x25ebc0;return _0xce6d2d;});}})[_0x36d0('0x21')](respondWithFilteredResult(_0x292106,_0x2fe614))['catch'](handleError(_0x292106,null));};exports['getLists']=function(_0x132e3d,_0x13569c,_0x591e06){var _0x1e4da9={};var _0x41cb8a={};var _0xfc9e19;var _0x2efbe6;return db[_0x36d0('0x2c')][_0x36d0('0x57')]({'where':{'id':_0x132e3d[_0x36d0('0x44')]['id']}})[_0x36d0('0x21')](handleEntityNotFound(_0x13569c,null))['then'](function(_0x3e2c7c){if(_0x3e2c7c){_0xfc9e19=_0x3e2c7c;_0x41cb8a[_0x36d0('0x34')]=_[_0x36d0('0x45')](db[_0x36d0('0x61')][_0x36d0('0x2d')]);_0x41cb8a[_0x36d0('0x31')]=_[_0x36d0('0x45')](_0x132e3d[_0x36d0('0x31')]);_0x41cb8a[_0x36d0('0x32')]=_[_0x36d0('0x33')](_0x41cb8a[_0x36d0('0x34')],_0x41cb8a[_0x36d0('0x31')]);_0x1e4da9[_0x36d0('0x35')]=_[_0x36d0('0x33')](_0x41cb8a[_0x36d0('0x34')],qs[_0x36d0('0x36')](_0x132e3d[_0x36d0('0x31')][_0x36d0('0x36')]));_0x1e4da9[_0x36d0('0x35')]=_0x1e4da9[_0x36d0('0x35')]['length']?_0x1e4da9[_0x36d0('0x35')]:_0x41cb8a[_0x36d0('0x34')];_0x1e4da9[_0x36d0('0x5e')]=qs['sort'](_0x132e3d[_0x36d0('0x31')][_0x36d0('0x3a')]);_0x1e4da9[_0x36d0('0x3b')]=qs[_0x36d0('0x32')](_['pick'](_0x132e3d[_0x36d0('0x31')],_0x41cb8a[_0x36d0('0x32')]));if(_0x132e3d['query'][_0x36d0('0x3c')]){_0x1e4da9[_0x36d0('0x3b')]=_[_0x36d0('0x3d')](_0x1e4da9[_0x36d0('0x3b')],{'$or':_['map'](_0x1e4da9[_0x36d0('0x35')],function(_0x119b30){var _0x509a1c={};_0x509a1c[_0x119b30]={'$like':'%'+_0x132e3d[_0x36d0('0x31')][_0x36d0('0x3c')]+'%'};return _0x509a1c;})});}_0x1e4da9=_[_0x36d0('0x3d')]({},_0x1e4da9,_0x132e3d['options']);return _0xfc9e19[_0x36d0('0x62')](_0x1e4da9);}})[_0x36d0('0x21')](function(_0x51117a){if(_0x51117a){_0x2efbe6=_0x51117a[_0x36d0('0x37')];if(!_0x132e3d[_0x36d0('0x31')][_0x36d0('0x38')](_0x36d0('0x39'))){_0x1e4da9[_0x36d0('0x1b')]=qs[_0x36d0('0x1b')](_0x132e3d[_0x36d0('0x31')]['limit']);_0x1e4da9['offset']=qs[_0x36d0('0x19')](_0x132e3d[_0x36d0('0x31')][_0x36d0('0x19')]);}return _0xfc9e19[_0x36d0('0x62')](_0x1e4da9);}})[_0x36d0('0x21')](function(_0x52f282){if(_0x52f282){return _0x52f282?{'count':_0x2efbe6,'rows':_0x52f282}:null;}})['then'](respondWithResult(_0x13569c,null))[_0x36d0('0x47')](handleError(_0x13569c,null));};exports['addLists']=function(_0x116a39,_0x2f1b88,_0x143d2b){var _0x1c936a,_0x197c13;return db[_0x36d0('0x2c')]['find']({'where':{'id':_0x116a39[_0x36d0('0x44')]['id']}})[_0x36d0('0x21')](handleEntityNotFound(_0x2f1b88,null))[_0x36d0('0x21')](function(_0x3fd88e){if(_0x3fd88e){_0x197c13=_0x3fd88e;return _0x3fd88e[_0x36d0('0x63')](_0x116a39['body'][_0x36d0('0x64')],_[_0x36d0('0x51')](_0x116a39[_0x36d0('0x49')],[_0x36d0('0x64'),'id'])||{});}return null;})[_0x36d0('0x65')](function(_0x26f95c){var _0x58501d;_0x1c936a=_0x26f95c||[];var _0x3acdc6=[];if(_0x26f95c){for(var _0x42551b=0x0;_0x42551b<_0x26f95c[_0x36d0('0x37')];_0x42551b+=0x1){var _0x50152d=_0x26f95c[_0x42551b][_0x36d0('0x22')]({'plain':!![]});_0x197c13['dialCheckDuplicateType']=_0x116a39[_0x36d0('0x49')][_0x36d0('0x66')]?_0x116a39[_0x36d0('0x49')][_0x36d0('0x66')]:_0x197c13[_0x36d0('0x66')];switch(_0x197c13[_0x36d0('0x66')]){case _0x36d0('0x67'):_0x58501d=squel[_0x36d0('0x68')]()[_0x36d0('0x69')](_0x36d0('0x6a'))[_0x36d0('0x6b')](['phone',_0x36d0('0x6c'),_0x36d0('0x6d'),_0x36d0('0x6e'),'CampaignId',_0x36d0('0x52'),'updatedAt'],squel[_0x36d0('0x6f')]()['field'](_0x36d0('0x70'),'phone')[_0x36d0('0x71')](_0x36d0('0x72'),'scheduledAt')[_0x36d0('0x71')]('id','ContactId')[_0x36d0('0x71')](_0x50152d[_0x36d0('0x73')][_0x36d0('0x74')](),_0x36d0('0x6e'))[_0x36d0('0x71')](_0x116a39['params']['id']['toString'](),_0x36d0('0x5a'))[_0x36d0('0x71')]('NOW()','createdAt')[_0x36d0('0x71')](_0x36d0('0x72'),_0x36d0('0x53'))[_0x36d0('0x75')](_0x36d0('0x76'))['where'](_0x36d0('0x77'))[_0x36d0('0x3b')](_0x36d0('0x78'),_0x50152d['CmListId']['toString']())['where'](_0x36d0('0x79'))[_0x36d0('0x3b')](_0x36d0('0x7a'),squel[_0x36d0('0x6f')]()[_0x36d0('0x71')]('COALESCE(calleridnum,\x27\x27)')[_0x36d0('0x75')]('cm_hopper_final')[_0x36d0('0x3b')](_0x36d0('0x7b'),_0x116a39[_0x36d0('0x44')]['id'][_0x36d0('0x74')]()))[_0x36d0('0x3b')](_0x36d0('0x7a'),squel['select']()[_0x36d0('0x71')](_0x36d0('0x7c'))[_0x36d0('0x75')](_0x36d0('0x6a'))[_0x36d0('0x3b')](_0x36d0('0x7b'),_0x116a39[_0x36d0('0x44')]['id'][_0x36d0('0x74')]())))[_0x36d0('0x74')]();break;case _0x36d0('0x7d'):_0x58501d=squel['insert']()[_0x36d0('0x69')](_0x36d0('0x6a'))['fromQuery']([_0x36d0('0x70'),_0x36d0('0x6c'),'ContactId',_0x36d0('0x6e'),'CampaignId',_0x36d0('0x52'),_0x36d0('0x53')],squel[_0x36d0('0x6f')]()[_0x36d0('0x71')](_0x36d0('0x70'),_0x36d0('0x70'))[_0x36d0('0x71')]('NOW()','scheduledAt')[_0x36d0('0x71')]('id',_0x36d0('0x6d'))[_0x36d0('0x71')](_0x50152d[_0x36d0('0x73')][_0x36d0('0x74')](),_0x36d0('0x6e'))['field'](_0x116a39[_0x36d0('0x44')]['id'][_0x36d0('0x74')](),'CampaignId')['field'](_0x36d0('0x72'),'createdAt')[_0x36d0('0x71')](_0x36d0('0x72'),_0x36d0('0x53'))[_0x36d0('0x75')]('cm_contacts')[_0x36d0('0x3b')]('deletedAt\x20IS\x20NULL')[_0x36d0('0x3b')](_0x36d0('0x78'),_0x50152d[_0x36d0('0x73')]['toString']())[_0x36d0('0x3b')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x36d0('0x7a'),squel[_0x36d0('0x6f')]()[_0x36d0('0x71')](_0x36d0('0x7c'))[_0x36d0('0x75')](_0x36d0('0x6a'))[_0x36d0('0x3b')](_0x36d0('0x7b'),_0x116a39[_0x36d0('0x44')]['id'][_0x36d0('0x74')]())))[_0x36d0('0x74')]();break;default:_0x58501d=squel[_0x36d0('0x68')]()[_0x36d0('0x69')](_0x36d0('0x6a'))['fromQuery'](['phone',_0x36d0('0x6c'),_0x36d0('0x6d'),'ListId',_0x36d0('0x5a'),_0x36d0('0x52'),'updatedAt'],squel[_0x36d0('0x6f')]()[_0x36d0('0x71')]('phone',_0x36d0('0x70'))[_0x36d0('0x71')](_0x36d0('0x72'),_0x36d0('0x6c'))[_0x36d0('0x71')]('id',_0x36d0('0x6d'))[_0x36d0('0x71')](_0x50152d['CmListId'][_0x36d0('0x74')](),_0x36d0('0x6e'))[_0x36d0('0x71')](_0x116a39['params']['id'][_0x36d0('0x74')](),_0x36d0('0x5a'))['field'](_0x36d0('0x72'),_0x36d0('0x52'))[_0x36d0('0x71')](_0x36d0('0x72'),_0x36d0('0x53'))[_0x36d0('0x75')]('cm_contacts')[_0x36d0('0x3b')](_0x36d0('0x77'))[_0x36d0('0x3b')](_0x36d0('0x78'),_0x50152d[_0x36d0('0x73')][_0x36d0('0x74')]())[_0x36d0('0x3b')]('phone\x20IS\x20NOT\x20NULL'))[_0x36d0('0x74')]();}_0x3acdc6[_0x36d0('0x7e')](db[_0x36d0('0x7f')][_0x36d0('0x31')](_0x58501d));}return BPromise[_0x36d0('0x80')](_0x3acdc6);}})['then'](function(){return _0x1c936a;})['then'](respondWithResult(_0x2f1b88,null))[_0x36d0('0x47')](handleError(_0x2f1b88,null));};exports[_0x36d0('0x81')]=function(_0x5d7087,_0x41e9aa,_0x4aad79){return db['Campaign'][_0x36d0('0x46')]({'where':{'id':_0x5d7087['params']['id']}})[_0x36d0('0x21')](handleEntityNotFound(_0x41e9aa,null))[_0x36d0('0x21')](function(_0x1be697){if(_0x1be697){return _0x1be697[_0x36d0('0x81')](_0x5d7087[_0x36d0('0x31')][_0x36d0('0x64')]);}})[_0x36d0('0x21')](function(_0x5ba981){if(_0x5ba981){return db['CmHopper'][_0x36d0('0x25')]({'where':{'ListId':_0x5d7087[_0x36d0('0x31')][_0x36d0('0x64')],'CampaignId':_0x5d7087['params']['id']}})['then'](function(){return _0x5ba981;});}})[_0x36d0('0x21')](respondWithStatusCode(_0x41e9aa,null))[_0x36d0('0x47')](handleError(_0x41e9aa,null));};exports[_0x36d0('0x82')]=function(_0x30b41c,_0x16d34e,_0x49a89f){var _0x47615b={};var _0x468e92={};var _0x58346a;var _0x1b4c9e;return db[_0x36d0('0x2c')]['findOne']({'where':{'id':_0x30b41c[_0x36d0('0x44')]['id']}})[_0x36d0('0x21')](handleEntityNotFound(_0x16d34e,null))[_0x36d0('0x21')](function(_0x57f481){if(_0x57f481){_0x58346a=_0x57f481;_0x468e92[_0x36d0('0x34')]=_['keys'](db[_0x36d0('0x61')][_0x36d0('0x2d')]);_0x468e92['query']=_[_0x36d0('0x45')](_0x30b41c[_0x36d0('0x31')]);_0x468e92['filters']=_[_0x36d0('0x33')](_0x468e92['model'],_0x468e92[_0x36d0('0x31')]);_0x47615b['attributes']=_[_0x36d0('0x33')](_0x468e92['model'],qs[_0x36d0('0x36')](_0x30b41c[_0x36d0('0x31')]['fields']));_0x47615b[_0x36d0('0x35')]=_0x47615b['attributes'][_0x36d0('0x37')]?_0x47615b['attributes']:_0x468e92[_0x36d0('0x34')];_0x47615b[_0x36d0('0x5e')]=qs[_0x36d0('0x3a')](_0x30b41c['query']['sort']);_0x47615b['where']=qs[_0x36d0('0x32')](_[_0x36d0('0x59')](_0x30b41c[_0x36d0('0x31')],_0x468e92[_0x36d0('0x32')]));if(_0x30b41c[_0x36d0('0x31')][_0x36d0('0x3c')]){_0x47615b['where']=_[_0x36d0('0x3d')](_0x47615b['where'],{'$or':_[_0x36d0('0x2b')](_0x47615b[_0x36d0('0x35')],function(_0x6d9797){var _0x5adcdb={};_0x5adcdb[_0x6d9797]={'$like':'%'+_0x30b41c[_0x36d0('0x31')][_0x36d0('0x3c')]+'%'};return _0x5adcdb;})});}_0x47615b=_[_0x36d0('0x3d')]({},_0x47615b,_0x30b41c[_0x36d0('0x3e')]);return _0x58346a['getBlackLists'](_0x47615b);}})[_0x36d0('0x21')](function(_0x5c9a61){if(_0x5c9a61){_0x1b4c9e=_0x5c9a61[_0x36d0('0x37')];if(!_0x30b41c[_0x36d0('0x31')][_0x36d0('0x38')](_0x36d0('0x39'))){_0x47615b[_0x36d0('0x1b')]=qs[_0x36d0('0x1b')](_0x30b41c[_0x36d0('0x31')]['limit']);_0x47615b[_0x36d0('0x19')]=qs[_0x36d0('0x19')](_0x30b41c['query'][_0x36d0('0x19')]);}return _0x58346a['getBlackLists'](_0x47615b);}})[_0x36d0('0x21')](function(_0x2c93bf){if(_0x2c93bf){return _0x2c93bf?{'count':_0x1b4c9e,'rows':_0x2c93bf}:null;}})[_0x36d0('0x21')](respondWithResult(_0x16d34e,null))[_0x36d0('0x47')](handleError(_0x16d34e,null));};exports[_0x36d0('0x83')]=function(_0x5e8602,_0x30fcef,_0xf2c794){var _0x5bcb19,_0x50622b;return db[_0x36d0('0x2c')][_0x36d0('0x46')]({'where':{'id':_0x5e8602[_0x36d0('0x44')]['id']}})[_0x36d0('0x21')](handleEntityNotFound(_0x30fcef,null))[_0x36d0('0x21')](function(_0x2c4d10){if(_0x2c4d10){_0x50622b=_0x2c4d10;return _0x2c4d10['addBlackLists'](_0x5e8602[_0x36d0('0x49')][_0x36d0('0x64')],_[_0x36d0('0x51')](_0x5e8602[_0x36d0('0x49')],[_0x36d0('0x64'),'id'])||{});}return null;})[_0x36d0('0x65')](function(_0x468849){var _0xa94a22;_0x5bcb19=_0x468849||[];var _0x1d0f35=[];if(_0x468849){for(var _0x5215f6=0x0;_0x5215f6<_0x468849[_0x36d0('0x37')];_0x5215f6+=0x1){var _0xa818a5=_0x468849[_0x5215f6][_0x36d0('0x22')]({'plain':!![]});_0xa94a22=squel[_0x36d0('0x68')]()[_0x36d0('0x69')](_0x36d0('0x84'))['fromQuery']([_0x36d0('0x70'),'ContactId',_0x36d0('0x6e'),_0x36d0('0x5a'),'createdAt',_0x36d0('0x53')],squel[_0x36d0('0x6f')]()[_0x36d0('0x71')](_0x36d0('0x70'),_0x36d0('0x70'))[_0x36d0('0x71')]('id',_0x36d0('0x6d'))[_0x36d0('0x71')](_0xa818a5[_0x36d0('0x73')][_0x36d0('0x74')](),'ListId')[_0x36d0('0x71')](_0x5e8602[_0x36d0('0x44')]['id']['toString'](),_0x36d0('0x5a'))[_0x36d0('0x71')]('NOW()',_0x36d0('0x52'))[_0x36d0('0x71')](_0x36d0('0x72'),'updatedAt')[_0x36d0('0x75')](_0x36d0('0x76'))[_0x36d0('0x3b')](_0x36d0('0x77'))[_0x36d0('0x3b')](_0x36d0('0x78'),_0xa818a5[_0x36d0('0x73')]['toString']())[_0x36d0('0x3b')](_0x36d0('0x79')))['toString']();_0x1d0f35[_0x36d0('0x7e')](db[_0x36d0('0x7f')][_0x36d0('0x31')](_0xa94a22));}return BPromise[_0x36d0('0x80')](_0x1d0f35);}})['then'](function(){return _0x5bcb19;})[_0x36d0('0x21')](respondWithResult(_0x30fcef,null))[_0x36d0('0x47')](handleError(_0x30fcef,null));};exports[_0x36d0('0x85')]=function(_0x50261f,_0x4f0b93,_0x2934ba){return db[_0x36d0('0x2c')][_0x36d0('0x46')]({'where':{'id':_0x50261f[_0x36d0('0x44')]['id']}})[_0x36d0('0x21')](handleEntityNotFound(_0x4f0b93,null))[_0x36d0('0x21')](function(_0x453bab){if(_0x453bab){return _0x453bab[_0x36d0('0x85')](_0x50261f[_0x36d0('0x31')][_0x36d0('0x64')]);}})['then'](function(_0x1be606){if(_0x1be606){return db['CmHopperBlack'][_0x36d0('0x25')]({'where':{'ListId':_0x50261f[_0x36d0('0x31')][_0x36d0('0x64')],'CampaignId':_0x50261f[_0x36d0('0x44')]['id']}})['then'](function(){return _0x1be606;});}})[_0x36d0('0x21')](respondWithStatusCode(_0x4f0b93,null))['catch'](handleError(_0x4f0b93,null));}; \ No newline at end of file +var _0xed12=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','IvrCampaigns','error','name','send','index','map','Campaign','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','include','rows','catch','show','params','includeAll','options','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','getHoppers','CmHopper','CampaignId','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','findAll','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','select','field','ListId','toString','NOW()','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','ContactId','cm_contacts','push','sequelize','removeLists','destroy','getBlackLists','addBlackLists','spread','all','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x55821d,_0x27a22e){var _0x58ea8a=function(_0x5bdd3d){while(--_0x5bdd3d){_0x55821d['push'](_0x55821d['shift']());}};_0x58ea8a(++_0x27a22e);}(_0xed12,0x181));var _0x2ed1=function(_0x5a0fef,_0x108c31){_0x5a0fef=_0x5a0fef-0x0;var _0xa6e0b4=_0xed12[_0x5a0fef];return _0xa6e0b4;};'use strict';var emlformat=require(_0x2ed1('0x0'));var rimraf=require(_0x2ed1('0x1'));var zipdir=require(_0x2ed1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2ed1('0x3'));var moment=require(_0x2ed1('0x4'));var BPromise=require(_0x2ed1('0x5'));var Mustache=require(_0x2ed1('0x6'));var util=require(_0x2ed1('0x7'));var path=require(_0x2ed1('0x8'));var sox=require(_0x2ed1('0x9'));var csv=require(_0x2ed1('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2ed1('0xb'));var _=require(_0x2ed1('0xc'));var squel=require(_0x2ed1('0xd'));var crypto=require(_0x2ed1('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2ed1('0xf'));var toCsv=require(_0x2ed1('0xa'));var querystring=require(_0x2ed1('0x10'));var Papa=require(_0x2ed1('0x11'));var Redis=require('ioredis');var authService=require(_0x2ed1('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2ed1('0x13'));var hardwareService=require(_0x2ed1('0x14'));var logger=require(_0x2ed1('0x15'))(_0x2ed1('0x16'));var utils=require(_0x2ed1('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2ed1('0x18'));var db=require(_0x2ed1('0x19'))['db'];function respondWithStatusCode(_0x535bd6,_0xc121b3){_0xc121b3=_0xc121b3||0xcc;return function(_0x5d0de9){if(_0x5d0de9){return _0x535bd6[_0x2ed1('0x1a')](_0xc121b3);}return _0x535bd6[_0x2ed1('0x1b')](_0xc121b3)[_0x2ed1('0x1c')]();};}function respondWithResult(_0x256e94,_0x5defd6){_0x5defd6=_0x5defd6||0xc8;return function(_0x5d8e31){if(_0x5d8e31){return _0x256e94[_0x2ed1('0x1b')](_0x5defd6)['json'](_0x5d8e31);}};}function respondWithFilteredResult(_0x15258c,_0x5a95a9){return function(_0x1273a8){if(_0x1273a8){var _0x145d15=typeof _0x5a95a9[_0x2ed1('0x1d')]==='undefined'&&typeof _0x5a95a9[_0x2ed1('0x1e')]===_0x2ed1('0x1f');var _0x3645c9=_0x1273a8[_0x2ed1('0x20')];var _0x34c109=_0x145d15?0x0:_0x5a95a9['offset'];var _0x509b75=_0x145d15?_0x1273a8['count']:_0x5a95a9[_0x2ed1('0x1d')]+_0x5a95a9[_0x2ed1('0x1e')];var _0x2d36db;if(_0x509b75>=_0x3645c9){_0x509b75=_0x3645c9;_0x2d36db=0xc8;}else{_0x2d36db=0xce;}_0x15258c[_0x2ed1('0x1b')](_0x2d36db);return _0x15258c[_0x2ed1('0x21')](_0x2ed1('0x22'),_0x34c109+'-'+_0x509b75+'/'+_0x3645c9)['json'](_0x1273a8);}return null;};}function patchUpdates(_0x5daca3){return function(_0x4695a0){try{jsonpatch[_0x2ed1('0x23')](_0x4695a0,_0x5daca3,!![]);}catch(_0x3fd626){return BPromise['reject'](_0x3fd626);}return _0x4695a0[_0x2ed1('0x24')]();};}function saveUpdates(_0x3b0f9a,_0x57626b){return function(_0xc13deb){if(_0xc13deb){return _0xc13deb[_0x2ed1('0x25')](_0x3b0f9a)['then'](function(_0x40e09f){return _0x40e09f;});}return null;};}function removeEntity(_0x4ff9f4,_0x546d8f){return function(_0x509a6b){if(_0x509a6b){return _0x509a6b['destroy']()[_0x2ed1('0x26')](function(){var _0x25c3e0=_0x509a6b['get']({'plain':!![]});var _0x546411=_0x2ed1('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x546411,'resourceId':_0x25c3e0['id']}})[_0x2ed1('0x26')](function(){return _0x509a6b;});})[_0x2ed1('0x26')](function(){_0x4ff9f4[_0x2ed1('0x1b')](0xcc)[_0x2ed1('0x1c')]();});}};}function handleEntityNotFound(_0x3ad4df,_0x364c51){return function(_0x591b36){if(!_0x591b36){_0x3ad4df[_0x2ed1('0x1a')](0x194);}return _0x591b36;};}function handleError(_0x3b7958,_0x373ad9){_0x373ad9=_0x373ad9||0x1f4;return function(_0x29130b){logger[_0x2ed1('0x28')](_0x29130b['stack']);if(_0x29130b[_0x2ed1('0x29')]){delete _0x29130b[_0x2ed1('0x29')];}_0x3b7958['status'](_0x373ad9)[_0x2ed1('0x2a')](_0x29130b);};}exports[_0x2ed1('0x2b')]=function(_0x48396d,_0x2f0263){var _0x1192f2={},_0x564703={},_0x46403e={'count':0x0,'rows':[]};var _0x19de3f=_[_0x2ed1('0x2c')](db[_0x2ed1('0x2d')][_0x2ed1('0x2e')],function(_0x11a5f4){return{'name':_0x11a5f4['fieldName'],'type':_0x11a5f4[_0x2ed1('0x2f')]['key']};});_0x564703[_0x2ed1('0x30')]=_['map'](_0x19de3f,_0x2ed1('0x29'));_0x564703[_0x2ed1('0x31')]=_[_0x2ed1('0x32')](_0x48396d['query']);_0x564703[_0x2ed1('0x33')]=_[_0x2ed1('0x34')](_0x564703['model'],_0x564703['query']);_0x1192f2[_0x2ed1('0x35')]=_[_0x2ed1('0x34')](_0x564703[_0x2ed1('0x30')],qs[_0x2ed1('0x36')](_0x48396d[_0x2ed1('0x31')][_0x2ed1('0x36')]));_0x1192f2[_0x2ed1('0x35')]=_0x1192f2[_0x2ed1('0x35')][_0x2ed1('0x37')]?_0x1192f2[_0x2ed1('0x35')]:_0x564703[_0x2ed1('0x30')];if(!_0x48396d[_0x2ed1('0x31')][_0x2ed1('0x38')](_0x2ed1('0x39'))){_0x1192f2[_0x2ed1('0x1e')]=qs['limit'](_0x48396d[_0x2ed1('0x31')]['limit']);_0x1192f2[_0x2ed1('0x1d')]=qs['offset'](_0x48396d[_0x2ed1('0x31')][_0x2ed1('0x1d')]);}_0x1192f2[_0x2ed1('0x3a')]=qs[_0x2ed1('0x3b')](_0x48396d[_0x2ed1('0x31')]['sort']);_0x1192f2['where']=qs[_0x2ed1('0x33')](_[_0x2ed1('0x3c')](_0x48396d[_0x2ed1('0x31')],_0x564703[_0x2ed1('0x33')]),_0x19de3f);if(_0x48396d['query'][_0x2ed1('0x3d')]){_0x1192f2[_0x2ed1('0x3e')]=_[_0x2ed1('0x3f')](_0x1192f2[_0x2ed1('0x3e')],{'$or':_[_0x2ed1('0x2c')](_0x19de3f,function(_0x58cdb3){if(_0x58cdb3[_0x2ed1('0x2f')]!==_0x2ed1('0x40')){var _0x48bd3b={};_0x48bd3b[_0x58cdb3[_0x2ed1('0x29')]]={'$like':'%'+_0x48396d[_0x2ed1('0x31')][_0x2ed1('0x3d')]+'%'};return _0x48bd3b;}})});}_0x1192f2=_['merge']({},_0x1192f2,_0x48396d['options']);var _0x4413ca={'where':_0x1192f2[_0x2ed1('0x3e')]};return db[_0x2ed1('0x2d')][_0x2ed1('0x20')](_0x4413ca)[_0x2ed1('0x26')](function(_0x3fc85f){_0x46403e['count']=_0x3fc85f;if(_0x48396d[_0x2ed1('0x31')]['includeAll']){_0x1192f2[_0x2ed1('0x41')]=[{'all':!![]}];}return db[_0x2ed1('0x2d')]['findAll'](_0x1192f2);})[_0x2ed1('0x26')](function(_0x13a808){_0x46403e[_0x2ed1('0x42')]=_0x13a808;return _0x46403e;})['then'](respondWithFilteredResult(_0x2f0263,_0x1192f2))[_0x2ed1('0x43')](handleError(_0x2f0263,null));};exports[_0x2ed1('0x44')]=function(_0x5572f6,_0x32d1e1){var _0xb1376b={'raw':![],'where':{'id':_0x5572f6[_0x2ed1('0x45')]['id']}},_0x2ac210={};_0x2ac210[_0x2ed1('0x30')]=_[_0x2ed1('0x32')](db[_0x2ed1('0x2d')][_0x2ed1('0x2e')]);_0x2ac210['query']=_[_0x2ed1('0x32')](_0x5572f6['query']);_0x2ac210[_0x2ed1('0x33')]=_[_0x2ed1('0x34')](_0x2ac210[_0x2ed1('0x30')],_0x2ac210['query']);_0xb1376b[_0x2ed1('0x35')]=_[_0x2ed1('0x34')](_0x2ac210['model'],qs['fields'](_0x5572f6[_0x2ed1('0x31')][_0x2ed1('0x36')]));_0xb1376b[_0x2ed1('0x35')]=_0xb1376b[_0x2ed1('0x35')][_0x2ed1('0x37')]?_0xb1376b[_0x2ed1('0x35')]:_0x2ac210[_0x2ed1('0x30')];if(_0x5572f6[_0x2ed1('0x31')][_0x2ed1('0x46')]){_0xb1376b[_0x2ed1('0x41')]=[{'all':!![]}];}_0xb1376b=_[_0x2ed1('0x3f')]({},_0xb1376b,_0x5572f6[_0x2ed1('0x47')]);return db[_0x2ed1('0x2d')]['find'](_0xb1376b)[_0x2ed1('0x26')](handleEntityNotFound(_0x32d1e1,null))[_0x2ed1('0x26')](respondWithResult(_0x32d1e1,null))[_0x2ed1('0x43')](handleError(_0x32d1e1,null));};exports[_0x2ed1('0x48')]=function(_0x4b390c,_0xc07b61){return db[_0x2ed1('0x2d')]['create'](_0x4b390c[_0x2ed1('0x49')],{})[_0x2ed1('0x26')](function(_0x1b17bb){var _0x560731=_0x4b390c['user'][_0x2ed1('0x4a')]({'plain':!![]});if(!_0x560731)throw new Error(_0x2ed1('0x4b'));if(_0x560731[_0x2ed1('0x4c')]===_0x2ed1('0x4d')){var _0x51ab61=_0x1b17bb[_0x2ed1('0x4a')]({'plain':!![]});var _0x29552a='IvrCampaigns';return db[_0x2ed1('0x4e')][_0x2ed1('0x4f')]({'where':{'name':_0x29552a,'userProfileId':_0x560731[_0x2ed1('0x50')]},'raw':!![]})['then'](function(_0x3f85c8){if(_0x3f85c8&&_0x3f85c8[_0x2ed1('0x51')]===0x0){return db[_0x2ed1('0x52')][_0x2ed1('0x48')]({'name':_0x51ab61[_0x2ed1('0x29')],'resourceId':_0x51ab61['id'],'type':_0x3f85c8[_0x2ed1('0x29')],'sectionId':_0x3f85c8['id']},{})[_0x2ed1('0x26')](function(){return _0x1b17bb;});}else{return _0x1b17bb;}})[_0x2ed1('0x43')](function(_0x55b06e){logger[_0x2ed1('0x28')](_0x2ed1('0x53'),_0x55b06e);throw _0x55b06e;});}return _0x1b17bb;})['then'](respondWithResult(_0xc07b61,0xc9))[_0x2ed1('0x43')](handleError(_0xc07b61,null));};exports[_0x2ed1('0x54')]=function(_0x55b956,_0x1dfe10){var _0x4c127e={'where':{'id':_0x55b956[_0x2ed1('0x45')]['id']}},_0x2afe0e={};_0x2afe0e[_0x2ed1('0x30')]=_[_0x2ed1('0x32')](db[_0x2ed1('0x2d')][_0x2ed1('0x2e')]);_0x4c127e['attributes']=_[_0x2ed1('0x34')](_0x2afe0e['model'],qs[_0x2ed1('0x36')](_0x55b956[_0x2ed1('0x31')][_0x2ed1('0x36')]));_0x4c127e['attributes']=_0x4c127e['attributes']['length']?_0x4c127e[_0x2ed1('0x35')]:_0x2afe0e[_0x2ed1('0x30')];if(_0x55b956[_0x2ed1('0x31')]['includeAll']){_0x4c127e[_0x2ed1('0x41')]=[{'all':!![]}];}_0x4c127e=_[_0x2ed1('0x3f')]({},_0x4c127e,_0x55b956[_0x2ed1('0x47')]);return db[_0x2ed1('0x2d')][_0x2ed1('0x4f')](_0x4c127e)[_0x2ed1('0x26')](handleEntityNotFound(_0x1dfe10,null))['then'](function(_0x55c6d4){if(_0x55c6d4){var _0x4e683a=_0x55c6d4[_0x2ed1('0x4a')]({'plain':!![]});_0x4e683a=qs[_0x2ed1('0x55')](_0x4e683a,['id',_0x2ed1('0x56'),'updatedAt']);_0x55b956[_0x2ed1('0x49')]=_['omit'](_0x55b956[_0x2ed1('0x49')],['id',_0x2ed1('0x56'),_0x2ed1('0x57')]);return db[_0x2ed1('0x2d')][_0x2ed1('0x48')](_[_0x2ed1('0x3f')](_0x4e683a,_0x55b956['body']),{'include':_0x55b956[_0x2ed1('0x31')]['includeAll']?[{'all':!![]}]:undefined})[_0x2ed1('0x26')](function(_0x207d7d){var _0x130fff=_0x55b956['user'][_0x2ed1('0x4a')]({'plain':!![]});if(!_0x130fff)throw new Error(_0x2ed1('0x4b'));if(_0x130fff[_0x2ed1('0x4c')]===_0x2ed1('0x4d')){var _0x27175b=_0x207d7d[_0x2ed1('0x4a')]({'plain':!![]});var _0x19a008=_0x2ed1('0x27');return db[_0x2ed1('0x4e')][_0x2ed1('0x4f')]({'where':{'name':_0x19a008,'userProfileId':_0x130fff[_0x2ed1('0x50')]},'raw':!![]})[_0x2ed1('0x26')](function(_0x5223a2){if(_0x5223a2&&_0x5223a2[_0x2ed1('0x51')]===0x0){return db[_0x2ed1('0x52')]['create']({'name':_0x27175b[_0x2ed1('0x29')],'resourceId':_0x27175b['id'],'type':_0x5223a2[_0x2ed1('0x29')],'sectionId':_0x5223a2['id']},{})[_0x2ed1('0x26')](function(){return _0x207d7d;});}else{return _0x207d7d;}})[_0x2ed1('0x43')](function(_0x3f2ba3){logger['error'](_0x2ed1('0x53'),_0x3f2ba3);throw _0x3f2ba3;});}return _0x207d7d;});}})['then'](respondWithResult(_0x1dfe10,0xc9))[_0x2ed1('0x43')](handleError(_0x1dfe10,null));};exports['update']=function(_0x22129e,_0x2292b0){if(_0x22129e[_0x2ed1('0x49')]['id']){delete _0x22129e[_0x2ed1('0x49')]['id'];}return db[_0x2ed1('0x2d')][_0x2ed1('0x4f')]({'where':{'id':_0x22129e[_0x2ed1('0x45')]['id']}})[_0x2ed1('0x26')](handleEntityNotFound(_0x2292b0,null))[_0x2ed1('0x26')](saveUpdates(_0x22129e[_0x2ed1('0x49')],null))[_0x2ed1('0x26')](respondWithResult(_0x2292b0,null))['catch'](handleError(_0x2292b0,null));};exports['destroy']=function(_0x1382ec,_0x255cc4){return db[_0x2ed1('0x2d')][_0x2ed1('0x4f')]({'where':{'id':_0x1382ec[_0x2ed1('0x45')]['id']}})[_0x2ed1('0x26')](handleEntityNotFound(_0x255cc4,null))['then'](removeEntity(_0x255cc4,null))[_0x2ed1('0x43')](handleError(_0x255cc4,null));};exports[_0x2ed1('0x58')]=function(_0x56da3b,_0x2329ed,_0xf1607){var _0x5de5f6={'raw':!![],'where':{}};var _0x572dfe={};var _0x149e91={'count':0x0,'rows':[]};return db[_0x2ed1('0x2d')]['findOne']({'where':{'id':_0x56da3b['params']['id']}})[_0x2ed1('0x26')](handleEntityNotFound(_0x2329ed,null))[_0x2ed1('0x26')](function(_0x55d9cc){if(_0x55d9cc){_0x572dfe[_0x2ed1('0x30')]=_[_0x2ed1('0x32')](db[_0x2ed1('0x59')][_0x2ed1('0x2e')]);_0x572dfe[_0x2ed1('0x31')]=_[_0x2ed1('0x32')](_0x56da3b[_0x2ed1('0x31')]);_0x572dfe[_0x2ed1('0x33')]=_[_0x2ed1('0x34')](_0x572dfe['model'],_0x572dfe[_0x2ed1('0x31')]);_0x5de5f6[_0x2ed1('0x35')]=_['intersection'](_0x572dfe[_0x2ed1('0x30')],qs[_0x2ed1('0x36')](_0x56da3b[_0x2ed1('0x31')]['fields']));_0x5de5f6[_0x2ed1('0x35')]=_0x5de5f6[_0x2ed1('0x35')][_0x2ed1('0x37')]?_0x5de5f6[_0x2ed1('0x35')]:_0x572dfe['model'];if(!_0x56da3b[_0x2ed1('0x31')][_0x2ed1('0x38')](_0x2ed1('0x39'))){_0x5de5f6['limit']=qs['limit'](_0x56da3b['query'][_0x2ed1('0x1e')]);_0x5de5f6[_0x2ed1('0x1d')]=qs[_0x2ed1('0x1d')](_0x56da3b[_0x2ed1('0x31')][_0x2ed1('0x1d')]);}_0x5de5f6[_0x2ed1('0x3a')]=qs[_0x2ed1('0x3b')](_0x56da3b[_0x2ed1('0x31')][_0x2ed1('0x3b')]);_0x5de5f6[_0x2ed1('0x3e')]=qs['filters'](_[_0x2ed1('0x3c')](_0x56da3b[_0x2ed1('0x31')],_0x572dfe['filters']));_0x5de5f6[_0x2ed1('0x3e')][_0x2ed1('0x5a')]=_0x55d9cc['id'];if(_0x56da3b[_0x2ed1('0x31')][_0x2ed1('0x3d')]){_0x5de5f6[_0x2ed1('0x3e')]=_[_0x2ed1('0x3f')](_0x5de5f6['where'],{'$or':_[_0x2ed1('0x2c')](_0x5de5f6[_0x2ed1('0x35')],function(_0x2136aa){var _0x1c5e2f={};_0x1c5e2f[_0x2136aa]={'$like':'%'+_0x56da3b['query'][_0x2ed1('0x3d')]+'%'};return _0x1c5e2f;})});}_0x5de5f6=_['merge']({},_0x5de5f6,_0x56da3b['options']);return db['CmHopper'][_0x2ed1('0x20')]({'where':_0x5de5f6[_0x2ed1('0x3e')]})['then'](function(_0x4365af){_0x149e91['count']=_0x4365af;if(_0x56da3b[_0x2ed1('0x31')][_0x2ed1('0x46')]){_0x5de5f6[_0x2ed1('0x41')]=[{'all':!![]}];}return db[_0x2ed1('0x59')]['findAll'](_0x5de5f6);})[_0x2ed1('0x26')](function(_0x2a7f8d){_0x149e91[_0x2ed1('0x42')]=_0x2a7f8d;return _0x149e91;});}})['then'](respondWithFilteredResult(_0x2329ed,_0x5de5f6))[_0x2ed1('0x43')](handleError(_0x2329ed,null));};exports[_0x2ed1('0x5b')]=function(_0x1ed917,_0x44b850,_0x4a79aa){var _0x536620={'raw':!![],'where':{}};var _0x2af9e2={};var _0x3b51b1={'count':0x0,'rows':[]};return db[_0x2ed1('0x2d')][_0x2ed1('0x5c')]({'where':{'id':_0x1ed917[_0x2ed1('0x45')]['id']}})[_0x2ed1('0x26')](handleEntityNotFound(_0x44b850,null))[_0x2ed1('0x26')](function(_0x3f4e7c){if(_0x3f4e7c){_0x2af9e2[_0x2ed1('0x30')]=_['keys'](db[_0x2ed1('0x5d')][_0x2ed1('0x2e')]);_0x2af9e2['query']=_[_0x2ed1('0x32')](_0x1ed917[_0x2ed1('0x31')]);_0x2af9e2[_0x2ed1('0x33')]=_[_0x2ed1('0x34')](_0x2af9e2[_0x2ed1('0x30')],_0x2af9e2[_0x2ed1('0x31')]);_0x536620[_0x2ed1('0x35')]=_[_0x2ed1('0x34')](_0x2af9e2['model'],qs[_0x2ed1('0x36')](_0x1ed917['query']['fields']));_0x536620[_0x2ed1('0x35')]=_0x536620[_0x2ed1('0x35')][_0x2ed1('0x37')]?_0x536620[_0x2ed1('0x35')]:_0x2af9e2[_0x2ed1('0x30')];if(!_0x1ed917[_0x2ed1('0x31')]['hasOwnProperty'](_0x2ed1('0x39'))){_0x536620[_0x2ed1('0x1e')]=qs['limit'](_0x1ed917[_0x2ed1('0x31')][_0x2ed1('0x1e')]);_0x536620[_0x2ed1('0x1d')]=qs['offset'](_0x1ed917[_0x2ed1('0x31')][_0x2ed1('0x1d')]);}_0x536620[_0x2ed1('0x3a')]=qs[_0x2ed1('0x3b')](_0x1ed917['query'][_0x2ed1('0x3b')]);_0x536620[_0x2ed1('0x3e')]=qs[_0x2ed1('0x33')](_[_0x2ed1('0x3c')](_0x1ed917[_0x2ed1('0x31')],_0x2af9e2[_0x2ed1('0x33')]));_0x536620[_0x2ed1('0x3e')][_0x2ed1('0x5a')]=_0x3f4e7c['id'];if(_0x1ed917[_0x2ed1('0x31')][_0x2ed1('0x3d')]){_0x536620[_0x2ed1('0x3e')]=_[_0x2ed1('0x3f')](_0x536620[_0x2ed1('0x3e')],{'$or':_[_0x2ed1('0x2c')](_0x536620[_0x2ed1('0x35')],function(_0x3624a4){var _0x22e958={};_0x22e958[_0x3624a4]={'$like':'%'+_0x1ed917['query'][_0x2ed1('0x3d')]+'%'};return _0x22e958;})});}_0x536620=_['merge']({},_0x536620,_0x1ed917[_0x2ed1('0x47')]);return db[_0x2ed1('0x5d')][_0x2ed1('0x20')]({'where':_0x536620[_0x2ed1('0x3e')]})[_0x2ed1('0x26')](function(_0x13f856){_0x3b51b1[_0x2ed1('0x20')]=_0x13f856;if(_0x1ed917[_0x2ed1('0x31')]['includeAll']){_0x536620[_0x2ed1('0x41')]=[{'all':!![]}];}return db[_0x2ed1('0x5d')]['findAll'](_0x536620);})[_0x2ed1('0x26')](function(_0x3e6ffe){_0x3b51b1['rows']=_0x3e6ffe;return _0x3b51b1;});}})[_0x2ed1('0x26')](respondWithFilteredResult(_0x44b850,_0x536620))['catch'](handleError(_0x44b850,null));};exports[_0x2ed1('0x5e')]=function(_0x255a4d,_0x2ac28c,_0x1c7cbd){var _0x36431d={'raw':!![],'where':{}};var _0x5cd0f2={};var _0x263f6e={'count':0x0,'rows':[]};return db['Campaign'][_0x2ed1('0x5c')]({'where':{'id':_0x255a4d['params']['id']}})['then'](handleEntityNotFound(_0x2ac28c,null))[_0x2ed1('0x26')](function(_0x38b9cf){if(_0x38b9cf){_0x5cd0f2[_0x2ed1('0x30')]=_[_0x2ed1('0x32')](db[_0x2ed1('0x5f')][_0x2ed1('0x2e')]);_0x5cd0f2[_0x2ed1('0x31')]=_['keys'](_0x255a4d[_0x2ed1('0x31')]);_0x5cd0f2[_0x2ed1('0x33')]=_[_0x2ed1('0x34')](_0x5cd0f2[_0x2ed1('0x30')],_0x5cd0f2[_0x2ed1('0x31')]);_0x36431d[_0x2ed1('0x35')]=_[_0x2ed1('0x34')](_0x5cd0f2[_0x2ed1('0x30')],qs[_0x2ed1('0x36')](_0x255a4d[_0x2ed1('0x31')][_0x2ed1('0x36')]));_0x36431d[_0x2ed1('0x35')]=_0x36431d[_0x2ed1('0x35')][_0x2ed1('0x37')]?_0x36431d[_0x2ed1('0x35')]:_0x5cd0f2[_0x2ed1('0x30')];if(!_0x255a4d[_0x2ed1('0x31')][_0x2ed1('0x38')](_0x2ed1('0x39'))){_0x36431d[_0x2ed1('0x1e')]=qs['limit'](_0x255a4d[_0x2ed1('0x31')][_0x2ed1('0x1e')]);_0x36431d['offset']=qs[_0x2ed1('0x1d')](_0x255a4d[_0x2ed1('0x31')][_0x2ed1('0x1d')]);}_0x36431d[_0x2ed1('0x3a')]=qs[_0x2ed1('0x3b')](_0x255a4d[_0x2ed1('0x31')]['sort']);_0x36431d[_0x2ed1('0x3e')]=qs[_0x2ed1('0x33')](_[_0x2ed1('0x3c')](_0x255a4d[_0x2ed1('0x31')],_0x5cd0f2[_0x2ed1('0x33')]));_0x36431d['where'][_0x2ed1('0x5a')]=_0x38b9cf['id'];if(_0x255a4d[_0x2ed1('0x31')]['filter']){_0x36431d[_0x2ed1('0x3e')]=_['merge'](_0x36431d['where'],{'$or':_[_0x2ed1('0x2c')](_0x36431d[_0x2ed1('0x35')],function(_0x59be49){var _0x373946={};_0x373946[_0x59be49]={'$like':'%'+_0x255a4d[_0x2ed1('0x31')][_0x2ed1('0x3d')]+'%'};return _0x373946;})});}_0x36431d=_[_0x2ed1('0x3f')]({},_0x36431d,_0x255a4d[_0x2ed1('0x47')]);return db[_0x2ed1('0x5f')][_0x2ed1('0x20')]({'where':_0x36431d[_0x2ed1('0x3e')]})[_0x2ed1('0x26')](function(_0x2f5041){_0x263f6e[_0x2ed1('0x20')]=_0x2f5041;if(_0x255a4d[_0x2ed1('0x31')]['includeAll']){_0x36431d['include']=[{'all':!![]}];}return db[_0x2ed1('0x5f')][_0x2ed1('0x60')](_0x36431d);})[_0x2ed1('0x26')](function(_0x19c53d){_0x263f6e[_0x2ed1('0x42')]=_0x19c53d;return _0x263f6e;});}})['then'](respondWithFilteredResult(_0x2ac28c,_0x36431d))[_0x2ed1('0x43')](handleError(_0x2ac28c,null));};exports[_0x2ed1('0x61')]=function(_0x46a965,_0x345ed1,_0x256c1c){var _0x24dfbd={'raw':!![],'where':{}};var _0x22f4d7={};var _0x5a1ca7={'count':0x0,'rows':[]};return db[_0x2ed1('0x2d')][_0x2ed1('0x5c')]({'where':{'id':_0x46a965['params']['id']}})[_0x2ed1('0x26')](handleEntityNotFound(_0x345ed1,null))[_0x2ed1('0x26')](function(_0x2d7d71){if(_0x2d7d71){_0x22f4d7[_0x2ed1('0x30')]=_['keys'](db[_0x2ed1('0x62')][_0x2ed1('0x2e')]);_0x22f4d7[_0x2ed1('0x31')]=_[_0x2ed1('0x32')](_0x46a965[_0x2ed1('0x31')]);_0x22f4d7[_0x2ed1('0x33')]=_[_0x2ed1('0x34')](_0x22f4d7[_0x2ed1('0x30')],_0x22f4d7[_0x2ed1('0x31')]);_0x24dfbd[_0x2ed1('0x35')]=_[_0x2ed1('0x34')](_0x22f4d7[_0x2ed1('0x30')],qs[_0x2ed1('0x36')](_0x46a965[_0x2ed1('0x31')][_0x2ed1('0x36')]));_0x24dfbd[_0x2ed1('0x35')]=_0x24dfbd[_0x2ed1('0x35')]['length']?_0x24dfbd[_0x2ed1('0x35')]:_0x22f4d7[_0x2ed1('0x30')];if(!_0x46a965[_0x2ed1('0x31')][_0x2ed1('0x38')](_0x2ed1('0x39'))){_0x24dfbd['limit']=qs[_0x2ed1('0x1e')](_0x46a965['query'][_0x2ed1('0x1e')]);_0x24dfbd['offset']=qs[_0x2ed1('0x1d')](_0x46a965[_0x2ed1('0x31')][_0x2ed1('0x1d')]);}_0x24dfbd[_0x2ed1('0x3a')]=qs[_0x2ed1('0x3b')](_0x46a965[_0x2ed1('0x31')][_0x2ed1('0x3b')]);_0x24dfbd[_0x2ed1('0x3e')]=qs[_0x2ed1('0x33')](_[_0x2ed1('0x3c')](_0x46a965[_0x2ed1('0x31')],_0x22f4d7[_0x2ed1('0x33')]));_0x24dfbd[_0x2ed1('0x3e')]['CampaignId']=_0x2d7d71['id'];if(_0x46a965[_0x2ed1('0x31')][_0x2ed1('0x3d')]){_0x24dfbd[_0x2ed1('0x3e')]=_[_0x2ed1('0x3f')](_0x24dfbd['where'],{'$or':_[_0x2ed1('0x2c')](_0x24dfbd[_0x2ed1('0x35')],function(_0x2bbdd9){var _0x282b0b={};_0x282b0b[_0x2bbdd9]={'$like':'%'+_0x46a965[_0x2ed1('0x31')][_0x2ed1('0x3d')]+'%'};return _0x282b0b;})});}_0x24dfbd=_[_0x2ed1('0x3f')]({},_0x24dfbd,_0x46a965[_0x2ed1('0x47')]);return db[_0x2ed1('0x62')][_0x2ed1('0x20')]({'where':_0x24dfbd['where']})[_0x2ed1('0x26')](function(_0x15338c){_0x5a1ca7[_0x2ed1('0x20')]=_0x15338c;if(_0x46a965[_0x2ed1('0x31')][_0x2ed1('0x46')]){_0x24dfbd[_0x2ed1('0x41')]=[{'all':!![]}];}return db[_0x2ed1('0x62')][_0x2ed1('0x60')](_0x24dfbd);})['then'](function(_0x49d6a1){_0x5a1ca7[_0x2ed1('0x42')]=_0x49d6a1;return _0x5a1ca7;});}})[_0x2ed1('0x26')](respondWithFilteredResult(_0x345ed1,_0x24dfbd))['catch'](handleError(_0x345ed1,null));};exports[_0x2ed1('0x63')]=function(_0x44fd09,_0x136756,_0x1ce94b){var _0x48947d={};var _0x59a2df={};var _0xf9b558;var _0x21656f;return db['Campaign'][_0x2ed1('0x5c')]({'where':{'id':_0x44fd09['params']['id']}})[_0x2ed1('0x26')](handleEntityNotFound(_0x136756,null))[_0x2ed1('0x26')](function(_0x39f220){if(_0x39f220){_0xf9b558=_0x39f220;_0x59a2df[_0x2ed1('0x30')]=_['keys'](db['CmList'][_0x2ed1('0x2e')]);_0x59a2df[_0x2ed1('0x31')]=_[_0x2ed1('0x32')](_0x44fd09['query']);_0x59a2df[_0x2ed1('0x33')]=_[_0x2ed1('0x34')](_0x59a2df[_0x2ed1('0x30')],_0x59a2df['query']);_0x48947d[_0x2ed1('0x35')]=_[_0x2ed1('0x34')](_0x59a2df['model'],qs[_0x2ed1('0x36')](_0x44fd09['query'][_0x2ed1('0x36')]));_0x48947d[_0x2ed1('0x35')]=_0x48947d['attributes'][_0x2ed1('0x37')]?_0x48947d['attributes']:_0x59a2df['model'];_0x48947d[_0x2ed1('0x3a')]=qs[_0x2ed1('0x3b')](_0x44fd09[_0x2ed1('0x31')][_0x2ed1('0x3b')]);_0x48947d[_0x2ed1('0x3e')]=qs[_0x2ed1('0x33')](_[_0x2ed1('0x3c')](_0x44fd09[_0x2ed1('0x31')],_0x59a2df[_0x2ed1('0x33')]));if(_0x44fd09['query'][_0x2ed1('0x3d')]){_0x48947d['where']=_['merge'](_0x48947d[_0x2ed1('0x3e')],{'$or':_['map'](_0x48947d['attributes'],function(_0x15a477){var _0x13bb56={};_0x13bb56[_0x15a477]={'$like':'%'+_0x44fd09[_0x2ed1('0x31')][_0x2ed1('0x3d')]+'%'};return _0x13bb56;})});}_0x48947d=_['merge']({},_0x48947d,_0x44fd09['options']);return _0xf9b558[_0x2ed1('0x63')](_0x48947d);}})['then'](function(_0x124d3b){if(_0x124d3b){_0x21656f=_0x124d3b[_0x2ed1('0x37')];if(!_0x44fd09[_0x2ed1('0x31')]['hasOwnProperty'](_0x2ed1('0x39'))){_0x48947d['limit']=qs[_0x2ed1('0x1e')](_0x44fd09[_0x2ed1('0x31')][_0x2ed1('0x1e')]);_0x48947d[_0x2ed1('0x1d')]=qs[_0x2ed1('0x1d')](_0x44fd09[_0x2ed1('0x31')][_0x2ed1('0x1d')]);}return _0xf9b558[_0x2ed1('0x63')](_0x48947d);}})[_0x2ed1('0x26')](function(_0x44bcc8){if(_0x44bcc8){return _0x44bcc8?{'count':_0x21656f,'rows':_0x44bcc8}:null;}})[_0x2ed1('0x26')](respondWithResult(_0x136756,null))['catch'](handleError(_0x136756,null));};exports[_0x2ed1('0x64')]=function(_0x91f69c,_0x388680,_0x2a13c6){var _0x448912,_0x5d87c5;return db[_0x2ed1('0x2d')][_0x2ed1('0x4f')]({'where':{'id':_0x91f69c[_0x2ed1('0x45')]['id']}})['then'](handleEntityNotFound(_0x388680,null))[_0x2ed1('0x26')](function(_0x137249){if(_0x137249){_0x5d87c5=_0x137249;return _0x137249['addLists'](_0x91f69c[_0x2ed1('0x49')]['ids'],_[_0x2ed1('0x55')](_0x91f69c[_0x2ed1('0x49')],[_0x2ed1('0x65'),'id'])||{});}return null;})['spread'](function(_0x4b529e){var _0x173d70;_0x448912=_0x4b529e||[];var _0x117d82=[];if(_0x4b529e){for(var _0x555572=0x0;_0x555572<_0x4b529e[_0x2ed1('0x37')];_0x555572+=0x1){var _0x3ad450=_0x4b529e[_0x555572][_0x2ed1('0x4a')]({'plain':!![]});_0x5d87c5[_0x2ed1('0x66')]=_0x91f69c[_0x2ed1('0x49')][_0x2ed1('0x66')]?_0x91f69c['body'][_0x2ed1('0x66')]:_0x5d87c5['dialCheckDuplicateType'];switch(_0x5d87c5[_0x2ed1('0x66')]){case'always':_0x173d70=squel[_0x2ed1('0x67')]()[_0x2ed1('0x68')](_0x2ed1('0x69'))[_0x2ed1('0x6a')]([_0x2ed1('0x6b'),_0x2ed1('0x6c'),'ContactId','ListId','CampaignId',_0x2ed1('0x56'),_0x2ed1('0x57')],squel[_0x2ed1('0x6d')]()[_0x2ed1('0x6e')](_0x2ed1('0x6b'),_0x2ed1('0x6b'))['field']('NOW()',_0x2ed1('0x6c'))[_0x2ed1('0x6e')]('id','ContactId')[_0x2ed1('0x6e')](_0x3ad450['CmListId']['toString'](),_0x2ed1('0x6f'))[_0x2ed1('0x6e')](_0x91f69c[_0x2ed1('0x45')]['id'][_0x2ed1('0x70')](),_0x2ed1('0x5a'))[_0x2ed1('0x6e')]('NOW()','createdAt')['field'](_0x2ed1('0x71'),_0x2ed1('0x57'))[_0x2ed1('0x72')]('cm_contacts')[_0x2ed1('0x3e')](_0x2ed1('0x73'))[_0x2ed1('0x3e')](_0x2ed1('0x74'),_0x3ad450[_0x2ed1('0x75')][_0x2ed1('0x70')]())[_0x2ed1('0x3e')](_0x2ed1('0x76'))[_0x2ed1('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0x2ed1('0x6d')]()[_0x2ed1('0x6e')](_0x2ed1('0x77'))[_0x2ed1('0x72')](_0x2ed1('0x78'))[_0x2ed1('0x3e')](_0x2ed1('0x79'),_0x91f69c[_0x2ed1('0x45')]['id'][_0x2ed1('0x70')]()))['where'](_0x2ed1('0x7a'),squel[_0x2ed1('0x6d')]()['field'](_0x2ed1('0x7b'))[_0x2ed1('0x72')](_0x2ed1('0x69'))['where'](_0x2ed1('0x79'),_0x91f69c[_0x2ed1('0x45')]['id']['toString']())))[_0x2ed1('0x70')]();break;case'onlyIfOpen':_0x173d70=squel[_0x2ed1('0x67')]()[_0x2ed1('0x68')](_0x2ed1('0x69'))[_0x2ed1('0x6a')]([_0x2ed1('0x6b'),_0x2ed1('0x6c'),_0x2ed1('0x7c'),_0x2ed1('0x6f'),'CampaignId','createdAt',_0x2ed1('0x57')],squel[_0x2ed1('0x6d')]()[_0x2ed1('0x6e')](_0x2ed1('0x6b'),'phone')['field'](_0x2ed1('0x71'),'scheduledAt')['field']('id',_0x2ed1('0x7c'))[_0x2ed1('0x6e')](_0x3ad450['CmListId'][_0x2ed1('0x70')](),'ListId')[_0x2ed1('0x6e')](_0x91f69c[_0x2ed1('0x45')]['id'][_0x2ed1('0x70')](),'CampaignId')[_0x2ed1('0x6e')](_0x2ed1('0x71'),_0x2ed1('0x56'))[_0x2ed1('0x6e')](_0x2ed1('0x71'),_0x2ed1('0x57'))['from'](_0x2ed1('0x7d'))['where'](_0x2ed1('0x73'))[_0x2ed1('0x3e')]('ListId\x20=\x20?',_0x3ad450[_0x2ed1('0x75')]['toString']())[_0x2ed1('0x3e')]('phone\x20IS\x20NOT\x20NULL')[_0x2ed1('0x3e')](_0x2ed1('0x7a'),squel[_0x2ed1('0x6d')]()[_0x2ed1('0x6e')]('COALESCE(phone,\x27\x27)')[_0x2ed1('0x72')]('cm_hopper')[_0x2ed1('0x3e')](_0x2ed1('0x79'),_0x91f69c[_0x2ed1('0x45')]['id'][_0x2ed1('0x70')]())))[_0x2ed1('0x70')]();break;default:_0x173d70=squel[_0x2ed1('0x67')]()['into'](_0x2ed1('0x69'))[_0x2ed1('0x6a')](['phone',_0x2ed1('0x6c'),_0x2ed1('0x7c'),_0x2ed1('0x6f'),_0x2ed1('0x5a'),_0x2ed1('0x56'),_0x2ed1('0x57')],squel['select']()['field'](_0x2ed1('0x6b'),_0x2ed1('0x6b'))['field'](_0x2ed1('0x71'),_0x2ed1('0x6c'))[_0x2ed1('0x6e')]('id',_0x2ed1('0x7c'))[_0x2ed1('0x6e')](_0x3ad450[_0x2ed1('0x75')][_0x2ed1('0x70')](),_0x2ed1('0x6f'))[_0x2ed1('0x6e')](_0x91f69c[_0x2ed1('0x45')]['id']['toString'](),_0x2ed1('0x5a'))[_0x2ed1('0x6e')](_0x2ed1('0x71'),_0x2ed1('0x56'))[_0x2ed1('0x6e')]('NOW()','updatedAt')[_0x2ed1('0x72')](_0x2ed1('0x7d'))['where'](_0x2ed1('0x73'))[_0x2ed1('0x3e')](_0x2ed1('0x74'),_0x3ad450[_0x2ed1('0x75')]['toString']())['where'](_0x2ed1('0x76')))[_0x2ed1('0x70')]();}_0x117d82[_0x2ed1('0x7e')](db[_0x2ed1('0x7f')]['query'](_0x173d70));}return BPromise['all'](_0x117d82);}})[_0x2ed1('0x26')](function(){return _0x448912;})['then'](respondWithResult(_0x388680,null))[_0x2ed1('0x43')](handleError(_0x388680,null));};exports[_0x2ed1('0x80')]=function(_0x37cb3f,_0x512ab7,_0x216bcb){return db[_0x2ed1('0x2d')][_0x2ed1('0x4f')]({'where':{'id':_0x37cb3f[_0x2ed1('0x45')]['id']}})['then'](handleEntityNotFound(_0x512ab7,null))[_0x2ed1('0x26')](function(_0x5a08d2){if(_0x5a08d2){return _0x5a08d2['removeLists'](_0x37cb3f[_0x2ed1('0x31')]['ids']);}})['then'](function(_0x550a4b){if(_0x550a4b){return db['CmHopper'][_0x2ed1('0x81')]({'where':{'ListId':_0x37cb3f['query'][_0x2ed1('0x65')],'CampaignId':_0x37cb3f[_0x2ed1('0x45')]['id']}})[_0x2ed1('0x26')](function(){return _0x550a4b;});}})['then'](respondWithStatusCode(_0x512ab7,null))['catch'](handleError(_0x512ab7,null));};exports[_0x2ed1('0x82')]=function(_0x407085,_0x3e86f1,_0x54de20){var _0x3c3a70={};var _0x187aa1={};var _0x391300;var _0x2c4e9a;return db[_0x2ed1('0x2d')][_0x2ed1('0x5c')]({'where':{'id':_0x407085[_0x2ed1('0x45')]['id']}})[_0x2ed1('0x26')](handleEntityNotFound(_0x3e86f1,null))[_0x2ed1('0x26')](function(_0x13d3dd){if(_0x13d3dd){_0x391300=_0x13d3dd;_0x187aa1[_0x2ed1('0x30')]=_['keys'](db['CmList'][_0x2ed1('0x2e')]);_0x187aa1[_0x2ed1('0x31')]=_['keys'](_0x407085['query']);_0x187aa1['filters']=_[_0x2ed1('0x34')](_0x187aa1[_0x2ed1('0x30')],_0x187aa1['query']);_0x3c3a70[_0x2ed1('0x35')]=_[_0x2ed1('0x34')](_0x187aa1[_0x2ed1('0x30')],qs[_0x2ed1('0x36')](_0x407085['query'][_0x2ed1('0x36')]));_0x3c3a70['attributes']=_0x3c3a70['attributes'][_0x2ed1('0x37')]?_0x3c3a70[_0x2ed1('0x35')]:_0x187aa1[_0x2ed1('0x30')];_0x3c3a70[_0x2ed1('0x3a')]=qs[_0x2ed1('0x3b')](_0x407085[_0x2ed1('0x31')][_0x2ed1('0x3b')]);_0x3c3a70['where']=qs[_0x2ed1('0x33')](_[_0x2ed1('0x3c')](_0x407085[_0x2ed1('0x31')],_0x187aa1['filters']));if(_0x407085[_0x2ed1('0x31')][_0x2ed1('0x3d')]){_0x3c3a70['where']=_[_0x2ed1('0x3f')](_0x3c3a70['where'],{'$or':_['map'](_0x3c3a70[_0x2ed1('0x35')],function(_0x2ea1bb){var _0x2b11f6={};_0x2b11f6[_0x2ea1bb]={'$like':'%'+_0x407085['query'][_0x2ed1('0x3d')]+'%'};return _0x2b11f6;})});}_0x3c3a70=_['merge']({},_0x3c3a70,_0x407085['options']);return _0x391300[_0x2ed1('0x82')](_0x3c3a70);}})[_0x2ed1('0x26')](function(_0x2486dd){if(_0x2486dd){_0x2c4e9a=_0x2486dd[_0x2ed1('0x37')];if(!_0x407085[_0x2ed1('0x31')][_0x2ed1('0x38')](_0x2ed1('0x39'))){_0x3c3a70['limit']=qs['limit'](_0x407085[_0x2ed1('0x31')][_0x2ed1('0x1e')]);_0x3c3a70[_0x2ed1('0x1d')]=qs[_0x2ed1('0x1d')](_0x407085[_0x2ed1('0x31')][_0x2ed1('0x1d')]);}return _0x391300[_0x2ed1('0x82')](_0x3c3a70);}})[_0x2ed1('0x26')](function(_0x7dd30a){if(_0x7dd30a){return _0x7dd30a?{'count':_0x2c4e9a,'rows':_0x7dd30a}:null;}})[_0x2ed1('0x26')](respondWithResult(_0x3e86f1,null))[_0x2ed1('0x43')](handleError(_0x3e86f1,null));};exports[_0x2ed1('0x83')]=function(_0x1e5e2d,_0x82c257,_0x565e3e){var _0x5b49fd,_0x20fa6c;return db[_0x2ed1('0x2d')][_0x2ed1('0x4f')]({'where':{'id':_0x1e5e2d[_0x2ed1('0x45')]['id']}})[_0x2ed1('0x26')](handleEntityNotFound(_0x82c257,null))[_0x2ed1('0x26')](function(_0x6120c0){if(_0x6120c0){_0x20fa6c=_0x6120c0;return _0x6120c0[_0x2ed1('0x83')](_0x1e5e2d[_0x2ed1('0x49')][_0x2ed1('0x65')],_['omit'](_0x1e5e2d[_0x2ed1('0x49')],[_0x2ed1('0x65'),'id'])||{});}return null;})[_0x2ed1('0x84')](function(_0x2b1c7a){var _0xfc1cd;_0x5b49fd=_0x2b1c7a||[];var _0x458cfb=[];if(_0x2b1c7a){for(var _0x478b69=0x0;_0x478b69<_0x2b1c7a[_0x2ed1('0x37')];_0x478b69+=0x1){var _0x5bcb11=_0x2b1c7a[_0x478b69][_0x2ed1('0x4a')]({'plain':!![]});_0xfc1cd=squel[_0x2ed1('0x67')]()['into']('cm_hopper_black')[_0x2ed1('0x6a')](['phone','ContactId',_0x2ed1('0x6f'),'CampaignId','createdAt',_0x2ed1('0x57')],squel[_0x2ed1('0x6d')]()[_0x2ed1('0x6e')]('phone',_0x2ed1('0x6b'))[_0x2ed1('0x6e')]('id',_0x2ed1('0x7c'))['field'](_0x5bcb11[_0x2ed1('0x75')][_0x2ed1('0x70')](),'ListId')[_0x2ed1('0x6e')](_0x1e5e2d[_0x2ed1('0x45')]['id'][_0x2ed1('0x70')](),_0x2ed1('0x5a'))[_0x2ed1('0x6e')](_0x2ed1('0x71'),_0x2ed1('0x56'))[_0x2ed1('0x6e')](_0x2ed1('0x71'),_0x2ed1('0x57'))[_0x2ed1('0x72')](_0x2ed1('0x7d'))['where']('deletedAt\x20IS\x20NULL')[_0x2ed1('0x3e')](_0x2ed1('0x74'),_0x5bcb11[_0x2ed1('0x75')][_0x2ed1('0x70')]())['where'](_0x2ed1('0x76')))[_0x2ed1('0x70')]();_0x458cfb[_0x2ed1('0x7e')](db[_0x2ed1('0x7f')][_0x2ed1('0x31')](_0xfc1cd));}return BPromise[_0x2ed1('0x85')](_0x458cfb);}})[_0x2ed1('0x26')](function(){return _0x5b49fd;})[_0x2ed1('0x26')](respondWithResult(_0x82c257,null))[_0x2ed1('0x43')](handleError(_0x82c257,null));};exports['removeBlackLists']=function(_0x5aacd9,_0x1d767b,_0x276e04){return db[_0x2ed1('0x2d')]['find']({'where':{'id':_0x5aacd9[_0x2ed1('0x45')]['id']}})[_0x2ed1('0x26')](handleEntityNotFound(_0x1d767b,null))[_0x2ed1('0x26')](function(_0x3bc2c9){if(_0x3bc2c9){return _0x3bc2c9[_0x2ed1('0x86')](_0x5aacd9[_0x2ed1('0x31')][_0x2ed1('0x65')]);}})[_0x2ed1('0x26')](function(_0x401a5c){if(_0x401a5c){return db[_0x2ed1('0x62')][_0x2ed1('0x81')]({'where':{'ListId':_0x5aacd9[_0x2ed1('0x31')]['ids'],'CampaignId':_0x5aacd9['params']['id']}})['then'](function(){return _0x401a5c;});}})[_0x2ed1('0x26')](respondWithStatusCode(_0x1d767b,null))['catch'](handleError(_0x1d767b,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index b48a8e2..6de4d30 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(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_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(_0x54e81a,_0x4ba69d){var _0x937fe=function(_0x12f7c6){while(--_0x12f7c6){_0x54e81a['push'](_0x54e81a['shift']());}};_0x937fe(++_0x4ba69d);}(_0x7a54,0x106));var _0x47a5=function(_0x1478eb,_0x3712d0){_0x1478eb=_0x1478eb-0x0;var _0xf4498=_0x7a54[_0x1478eb];return _0xf4498;};'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 efc7a01..8f77a3e 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 _0x2cc1=['stringify','error','code','message','result','catch','GetCampaign','Campaign','findAll','options','where','attributes','limit','include','model','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x2cc1,0x1bd));var _0x12cc=function(_0xa86f0e,_0x48f50b){_0xa86f0e=_0xa86f0e-0x0;var _0x31815f=_0x2cc1[_0xa86f0e];return _0x31815f;};'use strict';var _=require(_0x12cc('0x0'));var util=require(_0x12cc('0x1'));var moment=require(_0x12cc('0x2'));var BPromise=require(_0x12cc('0x3'));var rs=require(_0x12cc('0x4'));var fs=require('fs');var Redis=require(_0x12cc('0x5'));var db=require(_0x12cc('0x6'))['db'];var utils=require(_0x12cc('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x12cc('0x8'));var jayson=require(_0x12cc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3dee73,_0x132370,_0x21d042){return new BPromise(function(_0x286d82,_0x1f9d00){return client[_0x12cc('0xa')](_0x3dee73,_0x21d042)[_0x12cc('0xb')](function(_0x325d01){logger[_0x12cc('0xc')](_0x12cc('0xd'),_0x132370,_0x12cc('0xe'));logger[_0x12cc('0xf')](_0x12cc('0x10'),_0x132370,'request\x20sent',JSON[_0x12cc('0x11')](_0x325d01));if(_0x325d01['error']){if(_0x325d01[_0x12cc('0x12')][_0x12cc('0x13')]===0x1f4){logger[_0x12cc('0x12')](_0x12cc('0xd'),_0x132370,_0x325d01[_0x12cc('0x12')][_0x12cc('0x14')]);return _0x1f9d00(_0x325d01['error']['message']);}logger[_0x12cc('0x12')]('Campaign,\x20%s,\x20%s',_0x132370,_0x325d01[_0x12cc('0x12')]['message']);return _0x286d82(_0x325d01[_0x12cc('0x12')][_0x12cc('0x14')]);}else{logger[_0x12cc('0xc')](_0x12cc('0xd'),_0x132370,_0x12cc('0xe'));_0x286d82(_0x325d01[_0x12cc('0x15')]['message']);}})[_0x12cc('0x16')](function(_0x639eca){logger['error'](_0x12cc('0xd'),_0x132370,_0x639eca);_0x1f9d00(_0x639eca);});});}exports[_0x12cc('0x17')]=function(_0x1ad81f){var _0x33db40=this;return new Promise(function(_0x32d942,_0xe6f84){return db[_0x12cc('0x18')][_0x12cc('0x19')]({'raw':_0x1ad81f[_0x12cc('0x1a')]?_0x1ad81f['options']['raw']===undefined?!![]:![]:!![],'where':_0x1ad81f['options']?_0x1ad81f[_0x12cc('0x1a')][_0x12cc('0x1b')]||null:null,'attributes':_0x1ad81f[_0x12cc('0x1a')]?_0x1ad81f[_0x12cc('0x1a')][_0x12cc('0x1c')]||null:null,'limit':_0x1ad81f[_0x12cc('0x1a')]?_0x1ad81f[_0x12cc('0x1a')][_0x12cc('0x1d')]||null:null,'include':_0x1ad81f[_0x12cc('0x1a')]?_0x1ad81f['options'][_0x12cc('0x1e')]?_['map'](_0x1ad81f[_0x12cc('0x1a')][_0x12cc('0x1e')],function(_0x4814b8){return{'model':db[_0x4814b8[_0x12cc('0x1f')]],'as':_0x4814b8['as'],'attributes':_0x4814b8[_0x12cc('0x1c')],'include':_0x4814b8['include']?_['map'](_0x4814b8[_0x12cc('0x1e')],function(_0x5ab109){return{'model':db[_0x5ab109[_0x12cc('0x1f')]],'as':_0x5ab109['as'],'attributes':_0x5ab109[_0x12cc('0x1c')],'include':_0x5ab109[_0x12cc('0x1e')]?_[_0x12cc('0x20')](_0x5ab109[_0x12cc('0x1e')],function(_0x281da6){return{'model':db[_0x281da6[_0x12cc('0x1f')]],'as':_0x281da6['as'],'attributes':_0x281da6[_0x12cc('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x12cc('0xb')](function(_0x180cfe){logger[_0x12cc('0xc')](_0x12cc('0x17'),_0x1ad81f);logger[_0x12cc('0xf')](_0x12cc('0x17'),_0x1ad81f,JSON[_0x12cc('0x11')](_0x180cfe));_0x32d942(_0x180cfe);})[_0x12cc('0x16')](function(_0x5cb159){logger[_0x12cc('0x12')](_0x12cc('0x17'),_0x5cb159[_0x12cc('0x14')],_0x1ad81f);_0xe6f84(_0x33db40[_0x12cc('0x12')](0x1f4,_0x5cb159[_0x12cc('0x14')]));});});}; \ No newline at end of file +var _0xf675=['../../config/environment','jayson/promise','client','http','request','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x50626b,_0x49249e){var _0x4f40f7=function(_0x35c4d4){while(--_0x35c4d4){_0x50626b['push'](_0x50626b['shift']());}};_0x4f40f7(++_0x49249e);}(_0xf675,0x199));var _0x5f67=function(_0x49c057,_0xc808ed){_0x49c057=_0x49c057-0x0;var _0xd8f0e6=_0xf675[_0x49c057];return _0xd8f0e6;};'use strict';var _=require(_0x5f67('0x0'));var util=require(_0x5f67('0x1'));var moment=require(_0x5f67('0x2'));var BPromise=require('bluebird');var rs=require(_0x5f67('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5f67('0x4'))['db'];var utils=require(_0x5f67('0x5'));var logger=require(_0x5f67('0x6'))('rpc');var config=require(_0x5f67('0x7'));var jayson=require(_0x5f67('0x8'));var client=jayson[_0x5f67('0x9')][_0x5f67('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b67eb,_0xc71a7,_0x121d19){return new BPromise(function(_0x55efcd,_0x5749f5){return client[_0x5f67('0xb')](_0x5b67eb,_0x121d19)[_0x5f67('0xc')](function(_0x530ef1){logger['info'](_0x5f67('0xd'),_0xc71a7,_0x5f67('0xe'));logger[_0x5f67('0xf')]('Campaign,\x20%s,\x20%s,\x20%s',_0xc71a7,'request\x20sent',JSON['stringify'](_0x530ef1));if(_0x530ef1[_0x5f67('0x10')]){if(_0x530ef1[_0x5f67('0x10')]['code']===0x1f4){logger[_0x5f67('0x10')]('Campaign,\x20%s,\x20%s',_0xc71a7,_0x530ef1[_0x5f67('0x10')]['message']);return _0x5749f5(_0x530ef1[_0x5f67('0x10')][_0x5f67('0x11')]);}logger[_0x5f67('0x10')]('Campaign,\x20%s,\x20%s',_0xc71a7,_0x530ef1[_0x5f67('0x10')]['message']);return _0x55efcd(_0x530ef1[_0x5f67('0x10')]['message']);}else{logger[_0x5f67('0x12')]('Campaign,\x20%s,\x20%s',_0xc71a7,_0x5f67('0xe'));_0x55efcd(_0x530ef1[_0x5f67('0x13')][_0x5f67('0x11')]);}})[_0x5f67('0x14')](function(_0x444ee5){logger[_0x5f67('0x10')](_0x5f67('0xd'),_0xc71a7,_0x444ee5);_0x5749f5(_0x444ee5);});});}exports[_0x5f67('0x15')]=function(_0xc539c6){var _0x8f3bd6=this;return new Promise(function(_0x5275d6,_0x5bc956){return db[_0x5f67('0x16')][_0x5f67('0x17')]({'raw':_0xc539c6['options']?_0xc539c6[_0x5f67('0x18')][_0x5f67('0x19')]===undefined?!![]:![]:!![],'where':_0xc539c6[_0x5f67('0x18')]?_0xc539c6[_0x5f67('0x18')][_0x5f67('0x1a')]||null:null,'attributes':_0xc539c6[_0x5f67('0x18')]?_0xc539c6[_0x5f67('0x18')][_0x5f67('0x1b')]||null:null,'limit':_0xc539c6[_0x5f67('0x18')]?_0xc539c6[_0x5f67('0x18')][_0x5f67('0x1c')]||null:null,'include':_0xc539c6[_0x5f67('0x18')]?_0xc539c6['options'][_0x5f67('0x1d')]?_[_0x5f67('0x1e')](_0xc539c6[_0x5f67('0x18')]['include'],function(_0x537b39){return{'model':db[_0x537b39[_0x5f67('0x1f')]],'as':_0x537b39['as'],'attributes':_0x537b39[_0x5f67('0x1b')],'include':_0x537b39['include']?_[_0x5f67('0x1e')](_0x537b39[_0x5f67('0x1d')],function(_0x241d17){return{'model':db[_0x241d17[_0x5f67('0x1f')]],'as':_0x241d17['as'],'attributes':_0x241d17['attributes'],'include':_0x241d17[_0x5f67('0x1d')]?_['map'](_0x241d17[_0x5f67('0x1d')],function(_0x167601){return{'model':db[_0x167601['model']],'as':_0x167601['as'],'attributes':_0x167601[_0x5f67('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5f67('0xc')](function(_0x57f373){logger['info'](_0x5f67('0x15'),_0xc539c6);logger[_0x5f67('0xf')](_0x5f67('0x15'),_0xc539c6,JSON['stringify'](_0x57f373));_0x5275d6(_0x57f373);})[_0x5f67('0x14')](function(_0xd36b79){logger['error'](_0x5f67('0x15'),_0xd36b79[_0x5f67('0x11')],_0xc539c6);_0x5bc956(_0x8f3bd6['error'](0x1f4,_0xd36b79[_0x5f67('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index cdede49..b5c58c7 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 _0x569b=['getHoppers','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addBlackLists','put','update','destroy','delete','removeLists','removeBlackLists','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','isAuthenticated','/:id','show','/:id/hoppers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x569b,0x173));var _0xb569=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x569b[_0x2be8c2];return _0x97f531;};'use strict';var multer=require(_0xb569('0x0'));var util=require(_0xb569('0x1'));var path=require('path');var timeout=require(_0xb569('0x2'));var express=require(_0xb569('0x3'));var router=express[_0xb569('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb569('0x5'));var interaction=require(_0xb569('0x6'));var config=require('../../config/environment');var controller=require(_0xb569('0x7'));router[_0xb569('0x8')]('/',auth[_0xb569('0x9')](),controller['index']);router[_0xb569('0x8')](_0xb569('0xa'),auth[_0xb569('0x9')](),controller[_0xb569('0xb')]);router['get'](_0xb569('0xc'),auth['isAuthenticated'](),controller[_0xb569('0xd')]);router[_0xb569('0x8')]('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0xb569('0xe')]);router[_0xb569('0x8')](_0xb569('0xf'),auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0xb569('0x10'),auth[_0xb569('0x9')](),controller[_0xb569('0x11')]);router[_0xb569('0x8')](_0xb569('0x12'),auth[_0xb569('0x9')](),controller[_0xb569('0x13')]);router['get'](_0xb569('0x14'),auth[_0xb569('0x9')](),controller[_0xb569('0x15')]);router[_0xb569('0x16')]('/',auth['isAuthenticated'](),controller[_0xb569('0x17')]);router[_0xb569('0x16')](_0xb569('0x18'),auth[_0xb569('0x9')](),controller['clone']);router['post']('/:id/lists',auth[_0xb569('0x9')](),controller['addLists']);router[_0xb569('0x16')](_0xb569('0x14'),auth['isAuthenticated'](),controller[_0xb569('0x19')]);router[_0xb569('0x1a')](_0xb569('0xa'),auth[_0xb569('0x9')](),controller[_0xb569('0x1b')]);router['delete'](_0xb569('0xa'),auth[_0xb569('0x9')](),controller[_0xb569('0x1c')]);router[_0xb569('0x1d')](_0xb569('0x12'),auth[_0xb569('0x9')](),controller[_0xb569('0x1e')]);router[_0xb569('0x1d')](_0xb569('0x14'),auth[_0xb569('0x9')](),controller[_0xb569('0x1f')]);module['exports']=router; \ No newline at end of file +var _0x0b30=['/:id/lists','/:id/blacklists','getBlackLists','create','post','clone','addLists','addBlackLists','put','update','delete','destroy','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','/:id','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black'];(function(_0x21b99d,_0x46fbc9){var _0x31335a=function(_0x3985a8){while(--_0x3985a8){_0x21b99d['push'](_0x21b99d['shift']());}};_0x31335a(++_0x46fbc9);}(_0x0b30,0x1a7));var _0x00b3=function(_0x1ee1e7,_0x1cfbea){_0x1ee1e7=_0x1ee1e7-0x0;var _0x5f1f0e=_0x0b30[_0x1ee1e7];return _0x5f1f0e;};'use strict';var multer=require(_0x00b3('0x0'));var util=require(_0x00b3('0x1'));var path=require(_0x00b3('0x2'));var timeout=require(_0x00b3('0x3'));var express=require(_0x00b3('0x4'));var router=express[_0x00b3('0x5')]();var fs_extra=require(_0x00b3('0x6'));var auth=require(_0x00b3('0x7'));var interaction=require(_0x00b3('0x8'));var config=require(_0x00b3('0x9'));var controller=require(_0x00b3('0xa'));router[_0x00b3('0xb')]('/',auth[_0x00b3('0xc')](),controller['index']);router['get'](_0x00b3('0xd'),auth[_0x00b3('0xc')](),controller['show']);router['get']('/:id/hoppers',auth['isAuthenticated'](),controller[_0x00b3('0xe')]);router[_0x00b3('0xb')]('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0x00b3('0xf')]);router[_0x00b3('0xb')](_0x00b3('0x10'),auth[_0x00b3('0xc')](),controller[_0x00b3('0x11')]);router[_0x00b3('0xb')](_0x00b3('0x12'),auth['isAuthenticated'](),controller['getHopperBlacks']);router[_0x00b3('0xb')](_0x00b3('0x13'),auth[_0x00b3('0xc')](),controller['getLists']);router[_0x00b3('0xb')](_0x00b3('0x14'),auth['isAuthenticated'](),controller[_0x00b3('0x15')]);router['post']('/',auth[_0x00b3('0xc')](),controller[_0x00b3('0x16')]);router[_0x00b3('0x17')]('/:id/clone',auth['isAuthenticated'](),controller[_0x00b3('0x18')]);router[_0x00b3('0x17')](_0x00b3('0x13'),auth['isAuthenticated'](),controller[_0x00b3('0x19')]);router[_0x00b3('0x17')]('/:id/blacklists',auth[_0x00b3('0xc')](),controller[_0x00b3('0x1a')]);router[_0x00b3('0x1b')](_0x00b3('0xd'),auth[_0x00b3('0xc')](),controller[_0x00b3('0x1c')]);router[_0x00b3('0x1d')]('/:id',auth['isAuthenticated'](),controller[_0x00b3('0x1e')]);router[_0x00b3('0x1d')](_0x00b3('0x13'),auth[_0x00b3('0xc')](),controller[_0x00b3('0x1f')]);router[_0x00b3('0x1d')]('/:id/blacklists',auth[_0x00b3('0xc')](),controller[_0x00b3('0x20')]);module[_0x00b3('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 6b27c72..0fa7f89 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 _0x7405=['STRING','VIRTUAL','getDataValue','sequelize','exports','TEXT'];(function(_0x14ce19,_0x583642){var _0x5e7b4c=function(_0x4d2ecb){while(--_0x4d2ecb){_0x14ce19['push'](_0x14ce19['shift']());}};_0x5e7b4c(++_0x583642);}(_0x7405,0x1cb));var _0x5740=function(_0x2b9c0c,_0x4678a3){_0x2b9c0c=_0x2b9c0c-0x0;var _0xd8577b=_0x7405[_0x2b9c0c];return _0xd8577b;};'use strict';var Sequelize=require(_0x5740('0x0'));module[_0x5740('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x5740('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5740('0x3')]},'name':{'type':Sequelize[_0x5740('0x4')],'get':function(){return this[_0x5740('0x5')]('key');}}}; \ No newline at end of file +var _0x0ae7=['getDataValue','sequelize','exports','STRING','TEXT','VIRTUAL'];(function(_0x4d22f4,_0x1b5bd6){var _0x4047be=function(_0x3501a1){while(--_0x3501a1){_0x4d22f4['push'](_0x4d22f4['shift']());}};_0x4047be(++_0x1b5bd6);}(_0x0ae7,0x67));var _0x70ae=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x0ae7[_0x28947d];return _0x12d2ee;};'use strict';var Sequelize=require(_0x70ae('0x0'));module[_0x70ae('0x1')]={'key':{'type':Sequelize[_0x70ae('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x70ae('0x3')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x70ae('0x4')],'get':function(){return this[_0x70ae('0x5')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index cf94a65..5e3964d 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 _0x63ca=['to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','CannedAnswers','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','sort','filters','pick','filter','merge','where','options','count','includeAll','include','findAll','rows','show','params','find','catch','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','user','role','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox'];(function(_0x14755d,_0x4dff3d){var _0x15ed57=function(_0x329a65){while(--_0x329a65){_0x14755d['push'](_0x14755d['shift']());}};_0x15ed57(++_0x4dff3d);}(_0x63ca,0x159));var _0xa63c=function(_0xd6e388,_0x3495ab){_0xd6e388=_0xd6e388-0x0;var _0xef7093=_0x63ca[_0xd6e388];return _0xef7093;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa63c('0x0'));var jsonpatch=require(_0xa63c('0x1'));var rp=require(_0xa63c('0x2'));var moment=require(_0xa63c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa63c('0x4'));var util=require('util');var path=require(_0xa63c('0x5'));var sox=require(_0xa63c('0x6'));var csv=require(_0xa63c('0x7'));var ejs=require(_0xa63c('0x8'));var fs=require('fs');var fs_extra=require(_0xa63c('0x9'));var _=require(_0xa63c('0xa'));var squel=require(_0xa63c('0xb'));var crypto=require('crypto');var jsforce=require(_0xa63c('0xc'));var deskjs=require(_0xa63c('0xd'));var toCsv=require(_0xa63c('0x7'));var querystring=require(_0xa63c('0xe'));var Papa=require('papaparse');var Redis=require(_0xa63c('0xf'));var authService=require(_0xa63c('0x10'));var qs=require(_0xa63c('0x11'));var as=require(_0xa63c('0x12'));var hardwareService=require(_0xa63c('0x13'));var logger=require(_0xa63c('0x14'))('api');var utils=require(_0xa63c('0x15'));var config=require(_0xa63c('0x16'));var licenseUtil=require(_0xa63c('0x17'));var db=require(_0xa63c('0x18'))['db'];function respondWithStatusCode(_0x112281,_0xeb6890){_0xeb6890=_0xeb6890||0xcc;return function(_0x1b8e5d){if(_0x1b8e5d){return _0x112281[_0xa63c('0x19')](_0xeb6890);}return _0x112281[_0xa63c('0x1a')](_0xeb6890)[_0xa63c('0x1b')]();};}function respondWithResult(_0x103815,_0x451d9d){_0x451d9d=_0x451d9d||0xc8;return function(_0x51b76f){if(_0x51b76f){return _0x103815[_0xa63c('0x1a')](_0x451d9d)['json'](_0x51b76f);}};}function respondWithFilteredResult(_0x5bbbae,_0x1cec71){return function(_0x59ac13){if(_0x59ac13){var _0x5e69a0=typeof _0x1cec71[_0xa63c('0x1c')]===_0xa63c('0x1d')&&typeof _0x1cec71[_0xa63c('0x1e')]==='undefined';var _0x5ed3fe=_0x59ac13['count'];var _0x3a6e2c=_0x5e69a0?0x0:_0x1cec71[_0xa63c('0x1c')];var _0x49bae5=_0x5e69a0?_0x59ac13['count']:_0x1cec71[_0xa63c('0x1c')]+_0x1cec71[_0xa63c('0x1e')];var _0x5874f3;if(_0x49bae5>=_0x5ed3fe){_0x49bae5=_0x5ed3fe;_0x5874f3=0xc8;}else{_0x5874f3=0xce;}_0x5bbbae['status'](_0x5874f3);return _0x5bbbae[_0xa63c('0x1f')](_0xa63c('0x20'),_0x3a6e2c+'-'+_0x49bae5+'/'+_0x5ed3fe)[_0xa63c('0x21')](_0x59ac13);}return null;};}function patchUpdates(_0x1db647){return function(_0x434608){try{jsonpatch[_0xa63c('0x22')](_0x434608,_0x1db647,!![]);}catch(_0x16106c){return BPromise[_0xa63c('0x23')](_0x16106c);}return _0x434608[_0xa63c('0x24')]();};}function saveUpdates(_0x5db40c,_0x2aa26b){return function(_0xb83117){if(_0xb83117){return _0xb83117[_0xa63c('0x25')](_0x5db40c)[_0xa63c('0x26')](function(_0x3915f9){return _0x3915f9;});}return null;};}function removeEntity(_0x1089bd,_0x2c1963){return function(_0x38694b){if(_0x38694b){return _0x38694b[_0xa63c('0x27')]()[_0xa63c('0x26')](function(){var _0x4ae41c=_0x38694b[_0xa63c('0x28')]({'plain':!![]});var _0x45cbd8=_0xa63c('0x29');return db['UserProfileResource'][_0xa63c('0x27')]({'where':{'type':_0x45cbd8,'resourceId':_0x4ae41c['id']}})[_0xa63c('0x26')](function(){return _0x38694b;});})[_0xa63c('0x26')](function(){_0x1089bd[_0xa63c('0x1a')](0xcc)[_0xa63c('0x1b')]();});}};}function handleEntityNotFound(_0x318404,_0x79791){return function(_0x10e81d){if(!_0x10e81d){_0x318404[_0xa63c('0x19')](0x194);}return _0x10e81d;};}function handleError(_0x21d492,_0x5a57f1){_0x5a57f1=_0x5a57f1||0x1f4;return function(_0x5af801){logger['error'](_0x5af801['stack']);if(_0x5af801[_0xa63c('0x2a')]){delete _0x5af801[_0xa63c('0x2a')];}_0x21d492[_0xa63c('0x1a')](_0x5a57f1)[_0xa63c('0x2b')](_0x5af801);};}exports[_0xa63c('0x2c')]=function(_0x2fae7a,_0x5b0f1d){var _0x548f6a={},_0x4ad99c={},_0x3de3bc={'count':0x0,'rows':[]};var _0x9d7317=_[_0xa63c('0x2d')](db[_0xa63c('0x2e')][_0xa63c('0x2f')],function(_0x4c6dbb){return{'name':_0x4c6dbb[_0xa63c('0x30')],'type':_0x4c6dbb[_0xa63c('0x31')][_0xa63c('0x32')]};});_0x4ad99c['model']=_['map'](_0x9d7317,'name');_0x4ad99c['query']=_[_0xa63c('0x33')](_0x2fae7a['query']);_0x4ad99c['filters']=_[_0xa63c('0x34')](_0x4ad99c[_0xa63c('0x35')],_0x4ad99c[_0xa63c('0x36')]);_0x548f6a[_0xa63c('0x37')]=_[_0xa63c('0x34')](_0x4ad99c[_0xa63c('0x35')],qs[_0xa63c('0x38')](_0x2fae7a['query'][_0xa63c('0x38')]));_0x548f6a[_0xa63c('0x37')]=_0x548f6a[_0xa63c('0x37')][_0xa63c('0x39')]?_0x548f6a[_0xa63c('0x37')]:_0x4ad99c[_0xa63c('0x35')];if(!_0x2fae7a[_0xa63c('0x36')][_0xa63c('0x3a')]('nolimit')){_0x548f6a['limit']=qs[_0xa63c('0x1e')](_0x2fae7a[_0xa63c('0x36')][_0xa63c('0x1e')]);_0x548f6a['offset']=qs[_0xa63c('0x1c')](_0x2fae7a[_0xa63c('0x36')]['offset']);}_0x548f6a['order']=qs[_0xa63c('0x3b')](_0x2fae7a[_0xa63c('0x36')][_0xa63c('0x3b')]);_0x548f6a['where']=qs[_0xa63c('0x3c')](_[_0xa63c('0x3d')](_0x2fae7a[_0xa63c('0x36')],_0x4ad99c[_0xa63c('0x3c')]),_0x9d7317);if(_0x2fae7a[_0xa63c('0x36')][_0xa63c('0x3e')]){_0x548f6a['where']=_[_0xa63c('0x3f')](_0x548f6a[_0xa63c('0x40')],{'$or':[{'key':{'$like':'%'+_0x2fae7a['query'][_0xa63c('0x3e')]+'%'}},{'value':{'$like':'%'+_0x2fae7a[_0xa63c('0x36')]['filter']+'%'}}]});}_0x548f6a=_['merge']({},_0x548f6a,_0x2fae7a[_0xa63c('0x41')]);var _0x61cc2a={'where':_0x548f6a['where']};return db['CannedAnswer'][_0xa63c('0x42')](_0x61cc2a)[_0xa63c('0x26')](function(_0x56d6d0){_0x3de3bc[_0xa63c('0x42')]=_0x56d6d0;if(_0x2fae7a[_0xa63c('0x36')][_0xa63c('0x43')]){_0x548f6a[_0xa63c('0x44')]=[{'all':!![]}];}return db[_0xa63c('0x2e')][_0xa63c('0x45')](_0x548f6a);})[_0xa63c('0x26')](function(_0xdc30d8){_0x3de3bc[_0xa63c('0x46')]=_0xdc30d8;return _0x3de3bc;})[_0xa63c('0x26')](respondWithFilteredResult(_0x5b0f1d,_0x548f6a))['catch'](handleError(_0x5b0f1d,null));};exports[_0xa63c('0x47')]=function(_0x1390a7,_0x320c0d){var _0x16cddf={'raw':!![],'where':{'id':_0x1390a7[_0xa63c('0x48')]['id']}},_0x5f3c02={};_0x5f3c02['model']=_[_0xa63c('0x33')](db[_0xa63c('0x2e')][_0xa63c('0x2f')]);_0x5f3c02[_0xa63c('0x36')]=_[_0xa63c('0x33')](_0x1390a7[_0xa63c('0x36')]);_0x5f3c02['filters']=_['intersection'](_0x5f3c02[_0xa63c('0x35')],_0x5f3c02[_0xa63c('0x36')]);_0x16cddf['attributes']=_[_0xa63c('0x34')](_0x5f3c02[_0xa63c('0x35')],qs[_0xa63c('0x38')](_0x1390a7[_0xa63c('0x36')]['fields']));_0x16cddf[_0xa63c('0x37')]=_0x16cddf[_0xa63c('0x37')]['length']?_0x16cddf['attributes']:_0x5f3c02['model'];if(_0x1390a7['query'][_0xa63c('0x43')]){_0x16cddf[_0xa63c('0x44')]=[{'all':!![]}];}_0x16cddf=_[_0xa63c('0x3f')]({},_0x16cddf,_0x1390a7['options']);return db[_0xa63c('0x2e')][_0xa63c('0x49')](_0x16cddf)[_0xa63c('0x26')](handleEntityNotFound(_0x320c0d,null))['then'](respondWithResult(_0x320c0d,null))[_0xa63c('0x4a')](handleError(_0x320c0d,null));};exports['update']=function(_0x11fbf8,_0xc3de22){if(_0x11fbf8[_0xa63c('0x4b')]['id']){delete _0x11fbf8[_0xa63c('0x4b')]['id'];}return db[_0xa63c('0x2e')][_0xa63c('0x49')]({'where':{'id':_0x11fbf8[_0xa63c('0x48')]['id']}})[_0xa63c('0x26')](handleEntityNotFound(_0xc3de22,null))[_0xa63c('0x26')](saveUpdates(_0x11fbf8[_0xa63c('0x4b')],null))[_0xa63c('0x26')](respondWithResult(_0xc3de22,null))[_0xa63c('0x4a')](handleError(_0xc3de22,null));};exports[_0xa63c('0x27')]=function(_0x30312b,_0x42b545){return db[_0xa63c('0x2e')][_0xa63c('0x49')]({'where':{'id':_0x30312b['params']['id']}})[_0xa63c('0x26')](handleEntityNotFound(_0x42b545,null))['then'](removeEntity(_0x42b545,null))[_0xa63c('0x4a')](handleError(_0x42b545,null));};exports[_0xa63c('0x4c')]=function(_0xb23e7b,_0x1c135f){var _0xaffd82={'key':_0xb23e7b[_0xa63c('0x4b')]['key']};if(_0xb23e7b[_0xa63c('0x4b')][_0xa63c('0x4d')]){_0xaffd82[_0xa63c('0x4d')]=_0xb23e7b[_0xa63c('0x4b')][_0xa63c('0x4d')];}else if(_0xb23e7b[_0xa63c('0x4b')][_0xa63c('0x4e')]){_0xaffd82['SmsAccountId']=_0xb23e7b[_0xa63c('0x4b')]['SmsAccountId'];}else if(_0xb23e7b[_0xa63c('0x4b')][_0xa63c('0x4f')]){_0xaffd82[_0xa63c('0x4f')]=_0xb23e7b[_0xa63c('0x4b')][_0xa63c('0x4f')];}else if(_0xb23e7b[_0xa63c('0x4b')][_0xa63c('0x50')]){_0xaffd82['ChatWebsiteId']=_0xb23e7b[_0xa63c('0x4b')][_0xa63c('0x50')];}return db['CannedAnswer'][_0xa63c('0x49')]({'where':_0xaffd82})[_0xa63c('0x26')](function(_0x4fec47){if(_0x4fec47){throw new db['Sequelize'][(_0xa63c('0x51'))]('The\x20inserted\x20key\x20already\x20exists.');}return db['CannedAnswer'][_0xa63c('0x4c')](_0xb23e7b[_0xa63c('0x4b')]);})[_0xa63c('0x26')](function(_0x16cdad){var _0xb7c814=_0xb23e7b[_0xa63c('0x52')][_0xa63c('0x28')]({'plain':!![]});if(!_0xb7c814)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xb7c814[_0xa63c('0x53')]==='user'){var _0x1e5ea8=_0x16cdad[_0xa63c('0x28')]({'plain':!![]});return db['UserProfileSection'][_0xa63c('0x49')]({'where':{'name':_0xa63c('0x29'),'userProfileId':_0xb7c814[_0xa63c('0x54')]},'raw':!![]})['then'](function(_0x583c2d){if(_0x583c2d&&_0x583c2d['autoAssociation']===0x0){return db[_0xa63c('0x55')][_0xa63c('0x4c')]({'name':_0x1e5ea8[_0xa63c('0x2a')],'resourceId':_0x1e5ea8['id'],'type':_0x583c2d[_0xa63c('0x2a')],'sectionId':_0x583c2d['id']},{})[_0xa63c('0x26')](function(){return _0x16cdad;});}else{return _0x16cdad;}})[_0xa63c('0x4a')](function(_0x3bf017){logger[_0xa63c('0x56')](_0xa63c('0x57'),_0x3bf017);throw _0x3bf017;});}return _0x16cdad;})[_0xa63c('0x26')](respondWithResult(_0x1c135f,0xc9))[_0xa63c('0x4a')](handleError(_0x1c135f,null));}; \ No newline at end of file +var _0xe736=['ChatWebsiteId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','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','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','get','CannedAnswers','UserProfileResource','destroy','end','error','stack','name','send','index','CannedAnswer','fieldName','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','includeAll','include','findAll','rows','catch','keys','rawAttributes','options','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId'];(function(_0x505e18,_0x271068){var _0x5052e5=function(_0x32cb54){while(--_0x32cb54){_0x505e18['push'](_0x505e18['shift']());}};_0x5052e5(++_0x271068);}(_0xe736,0x10b));var _0x6e73=function(_0x1ddeef,_0x571b46){_0x1ddeef=_0x1ddeef-0x0;var _0x28d9ae=_0xe736[_0x1ddeef];return _0x28d9ae;};'use strict';var emlformat=require(_0x6e73('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6e73('0x1'));var jsonpatch=require(_0x6e73('0x2'));var rp=require(_0x6e73('0x3'));var moment=require(_0x6e73('0x4'));var BPromise=require(_0x6e73('0x5'));var Mustache=require(_0x6e73('0x6'));var util=require(_0x6e73('0x7'));var path=require(_0x6e73('0x8'));var sox=require('sox');var csv=require(_0x6e73('0x9'));var ejs=require(_0x6e73('0xa'));var fs=require('fs');var fs_extra=require(_0x6e73('0xb'));var _=require(_0x6e73('0xc'));var squel=require(_0x6e73('0xd'));var crypto=require('crypto');var jsforce=require(_0x6e73('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6e73('0xf'));var Papa=require(_0x6e73('0x10'));var Redis=require(_0x6e73('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6e73('0x12'));var hardwareService=require(_0x6e73('0x13'));var logger=require(_0x6e73('0x14'))(_0x6e73('0x15'));var utils=require('../../config/utils');var config=require(_0x6e73('0x16'));var licenseUtil=require(_0x6e73('0x17'));var db=require(_0x6e73('0x18'))['db'];function respondWithStatusCode(_0x52e07f,_0x3d74f8){_0x3d74f8=_0x3d74f8||0xcc;return function(_0x22cae4){if(_0x22cae4){return _0x52e07f[_0x6e73('0x19')](_0x3d74f8);}return _0x52e07f[_0x6e73('0x1a')](_0x3d74f8)['end']();};}function respondWithResult(_0x34474b,_0x5519d6){_0x5519d6=_0x5519d6||0xc8;return function(_0x4ef679){if(_0x4ef679){return _0x34474b['status'](_0x5519d6)[_0x6e73('0x1b')](_0x4ef679);}};}function respondWithFilteredResult(_0xd39ba4,_0x16bfc6){return function(_0x4277bc){if(_0x4277bc){var _0x50b762=typeof _0x16bfc6['offset']===_0x6e73('0x1c')&&typeof _0x16bfc6[_0x6e73('0x1d')]==='undefined';var _0x383578=_0x4277bc[_0x6e73('0x1e')];var _0x453b2c=_0x50b762?0x0:_0x16bfc6[_0x6e73('0x1f')];var _0x3c345a=_0x50b762?_0x4277bc[_0x6e73('0x1e')]:_0x16bfc6[_0x6e73('0x1f')]+_0x16bfc6[_0x6e73('0x1d')];var _0x4d2574;if(_0x3c345a>=_0x383578){_0x3c345a=_0x383578;_0x4d2574=0xc8;}else{_0x4d2574=0xce;}_0xd39ba4[_0x6e73('0x1a')](_0x4d2574);return _0xd39ba4[_0x6e73('0x20')](_0x6e73('0x21'),_0x453b2c+'-'+_0x3c345a+'/'+_0x383578)[_0x6e73('0x1b')](_0x4277bc);}return null;};}function patchUpdates(_0x37cba9){return function(_0x594e38){try{jsonpatch['apply'](_0x594e38,_0x37cba9,!![]);}catch(_0x493ae1){return BPromise[_0x6e73('0x22')](_0x493ae1);}return _0x594e38[_0x6e73('0x23')]();};}function saveUpdates(_0x101333,_0x42c54d){return function(_0x3cee59){if(_0x3cee59){return _0x3cee59[_0x6e73('0x24')](_0x101333)[_0x6e73('0x25')](function(_0x2990d2){return _0x2990d2;});}return null;};}function removeEntity(_0x3bca9c,_0x4d48b7){return function(_0x18e146){if(_0x18e146){return _0x18e146['destroy']()[_0x6e73('0x25')](function(){var _0x1aecc5=_0x18e146[_0x6e73('0x26')]({'plain':!![]});var _0x27fdbc=_0x6e73('0x27');return db[_0x6e73('0x28')][_0x6e73('0x29')]({'where':{'type':_0x27fdbc,'resourceId':_0x1aecc5['id']}})[_0x6e73('0x25')](function(){return _0x18e146;});})[_0x6e73('0x25')](function(){_0x3bca9c[_0x6e73('0x1a')](0xcc)[_0x6e73('0x2a')]();});}};}function handleEntityNotFound(_0x3c8d3c,_0x3684b3){return function(_0x5e50e3){if(!_0x5e50e3){_0x3c8d3c[_0x6e73('0x19')](0x194);}return _0x5e50e3;};}function handleError(_0x4a05a1,_0x138646){_0x138646=_0x138646||0x1f4;return function(_0x578a0f){logger[_0x6e73('0x2b')](_0x578a0f[_0x6e73('0x2c')]);if(_0x578a0f[_0x6e73('0x2d')]){delete _0x578a0f[_0x6e73('0x2d')];}_0x4a05a1[_0x6e73('0x1a')](_0x138646)[_0x6e73('0x2e')](_0x578a0f);};}exports[_0x6e73('0x2f')]=function(_0x1d7c96,_0x21799a){var _0x2ef0ed={},_0x2642ce={},_0x449d50={'count':0x0,'rows':[]};var _0x360ccc=_['map'](db[_0x6e73('0x30')]['rawAttributes'],function(_0x144378){return{'name':_0x144378[_0x6e73('0x31')],'type':_0x144378['type'][_0x6e73('0x32')]};});_0x2642ce[_0x6e73('0x33')]=_['map'](_0x360ccc,_0x6e73('0x2d'));_0x2642ce[_0x6e73('0x34')]=_['keys'](_0x1d7c96[_0x6e73('0x34')]);_0x2642ce['filters']=_[_0x6e73('0x35')](_0x2642ce['model'],_0x2642ce[_0x6e73('0x34')]);_0x2ef0ed['attributes']=_['intersection'](_0x2642ce[_0x6e73('0x33')],qs[_0x6e73('0x36')](_0x1d7c96[_0x6e73('0x34')][_0x6e73('0x36')]));_0x2ef0ed[_0x6e73('0x37')]=_0x2ef0ed[_0x6e73('0x37')][_0x6e73('0x38')]?_0x2ef0ed['attributes']:_0x2642ce[_0x6e73('0x33')];if(!_0x1d7c96[_0x6e73('0x34')][_0x6e73('0x39')](_0x6e73('0x3a'))){_0x2ef0ed['limit']=qs[_0x6e73('0x1d')](_0x1d7c96[_0x6e73('0x34')][_0x6e73('0x1d')]);_0x2ef0ed['offset']=qs['offset'](_0x1d7c96['query']['offset']);}_0x2ef0ed[_0x6e73('0x3b')]=qs[_0x6e73('0x3c')](_0x1d7c96['query'][_0x6e73('0x3c')]);_0x2ef0ed[_0x6e73('0x3d')]=qs[_0x6e73('0x3e')](_[_0x6e73('0x3f')](_0x1d7c96[_0x6e73('0x34')],_0x2642ce[_0x6e73('0x3e')]),_0x360ccc);if(_0x1d7c96[_0x6e73('0x34')]['filter']){_0x2ef0ed[_0x6e73('0x3d')]=_[_0x6e73('0x40')](_0x2ef0ed[_0x6e73('0x3d')],{'$or':[{'key':{'$like':'%'+_0x1d7c96[_0x6e73('0x34')][_0x6e73('0x41')]+'%'}},{'value':{'$like':'%'+_0x1d7c96[_0x6e73('0x34')][_0x6e73('0x41')]+'%'}}]});}_0x2ef0ed=_[_0x6e73('0x40')]({},_0x2ef0ed,_0x1d7c96['options']);var _0x1723c4={'where':_0x2ef0ed['where']};return db[_0x6e73('0x30')]['count'](_0x1723c4)[_0x6e73('0x25')](function(_0x554f4f){_0x449d50[_0x6e73('0x1e')]=_0x554f4f;if(_0x1d7c96[_0x6e73('0x34')][_0x6e73('0x42')]){_0x2ef0ed[_0x6e73('0x43')]=[{'all':!![]}];}return db['CannedAnswer'][_0x6e73('0x44')](_0x2ef0ed);})[_0x6e73('0x25')](function(_0x40e1c4){_0x449d50[_0x6e73('0x45')]=_0x40e1c4;return _0x449d50;})[_0x6e73('0x25')](respondWithFilteredResult(_0x21799a,_0x2ef0ed))[_0x6e73('0x46')](handleError(_0x21799a,null));};exports['show']=function(_0x463aa3,_0x48b886){var _0x357693={'raw':!![],'where':{'id':_0x463aa3['params']['id']}},_0x56b0ff={};_0x56b0ff['model']=_[_0x6e73('0x47')](db[_0x6e73('0x30')][_0x6e73('0x48')]);_0x56b0ff[_0x6e73('0x34')]=_['keys'](_0x463aa3['query']);_0x56b0ff[_0x6e73('0x3e')]=_[_0x6e73('0x35')](_0x56b0ff[_0x6e73('0x33')],_0x56b0ff[_0x6e73('0x34')]);_0x357693[_0x6e73('0x37')]=_['intersection'](_0x56b0ff[_0x6e73('0x33')],qs[_0x6e73('0x36')](_0x463aa3[_0x6e73('0x34')][_0x6e73('0x36')]));_0x357693['attributes']=_0x357693[_0x6e73('0x37')][_0x6e73('0x38')]?_0x357693[_0x6e73('0x37')]:_0x56b0ff[_0x6e73('0x33')];if(_0x463aa3['query'][_0x6e73('0x42')]){_0x357693[_0x6e73('0x43')]=[{'all':!![]}];}_0x357693=_['merge']({},_0x357693,_0x463aa3[_0x6e73('0x49')]);return db[_0x6e73('0x30')][_0x6e73('0x4a')](_0x357693)[_0x6e73('0x25')](handleEntityNotFound(_0x48b886,null))[_0x6e73('0x25')](respondWithResult(_0x48b886,null))[_0x6e73('0x46')](handleError(_0x48b886,null));};exports['update']=function(_0x450a74,_0x5d1202){if(_0x450a74[_0x6e73('0x4b')]['id']){delete _0x450a74[_0x6e73('0x4b')]['id'];}return db['CannedAnswer'][_0x6e73('0x4a')]({'where':{'id':_0x450a74[_0x6e73('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5d1202,null))[_0x6e73('0x25')](saveUpdates(_0x450a74[_0x6e73('0x4b')],null))[_0x6e73('0x25')](respondWithResult(_0x5d1202,null))[_0x6e73('0x46')](handleError(_0x5d1202,null));};exports[_0x6e73('0x29')]=function(_0x43c93a,_0x11170c){return db[_0x6e73('0x30')][_0x6e73('0x4a')]({'where':{'id':_0x43c93a[_0x6e73('0x4c')]['id']}})[_0x6e73('0x25')](handleEntityNotFound(_0x11170c,null))[_0x6e73('0x25')](removeEntity(_0x11170c,null))[_0x6e73('0x46')](handleError(_0x11170c,null));};exports[_0x6e73('0x4d')]=function(_0x292551,_0x2df1d2){var _0x5a4b16={'key':_0x292551[_0x6e73('0x4b')][_0x6e73('0x32')]};if(_0x292551['body'][_0x6e73('0x4e')]){_0x5a4b16[_0x6e73('0x4e')]=_0x292551[_0x6e73('0x4b')][_0x6e73('0x4e')];}else if(_0x292551['body'][_0x6e73('0x4f')]){_0x5a4b16[_0x6e73('0x4f')]=_0x292551[_0x6e73('0x4b')]['SmsAccountId'];}else if(_0x292551['body'][_0x6e73('0x50')]){_0x5a4b16[_0x6e73('0x50')]=_0x292551[_0x6e73('0x4b')]['OpenchannelAccountId'];}else if(_0x292551[_0x6e73('0x4b')][_0x6e73('0x51')]){_0x5a4b16[_0x6e73('0x51')]=_0x292551[_0x6e73('0x4b')]['ChatWebsiteId'];}return db[_0x6e73('0x30')][_0x6e73('0x4a')]({'where':_0x5a4b16})['then'](function(_0x3dc4ba){if(_0x3dc4ba){throw new db['Sequelize']['ValidationError']('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x6e73('0x30')][_0x6e73('0x4d')](_0x292551[_0x6e73('0x4b')]);})[_0x6e73('0x25')](function(_0x524286){var _0x11038a=_0x292551['user'][_0x6e73('0x26')]({'plain':!![]});if(!_0x11038a)throw new Error(_0x6e73('0x52'));if(_0x11038a['role']===_0x6e73('0x53')){var _0x5686d3=_0x524286[_0x6e73('0x26')]({'plain':!![]});return db[_0x6e73('0x54')][_0x6e73('0x4a')]({'where':{'name':_0x6e73('0x27'),'userProfileId':_0x11038a[_0x6e73('0x55')]},'raw':!![]})['then'](function(_0x4c31fa){if(_0x4c31fa&&_0x4c31fa['autoAssociation']===0x0){return db[_0x6e73('0x28')][_0x6e73('0x4d')]({'name':_0x5686d3[_0x6e73('0x2d')],'resourceId':_0x5686d3['id'],'type':_0x4c31fa[_0x6e73('0x2d')],'sectionId':_0x4c31fa['id']},{})[_0x6e73('0x25')](function(){return _0x524286;});}else{return _0x524286;}})[_0x6e73('0x46')](function(_0xa77704){logger[_0x6e73('0x2b')](_0x6e73('0x56'),_0xa77704);throw _0xa77704;});}return _0x524286;})[_0x6e73('0x25')](respondWithResult(_0x2df1d2,0xc9))[_0x6e73('0x46')](handleError(_0x2df1d2,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 6e5b5e7..dd1a7ea 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 _0x0f16=['utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes','define','CannedAnswer','tools_canned_answers','utf8mb4'];(function(_0x5362ea,_0x51f746){var _0x3ed993=function(_0x441da0){while(--_0x441da0){_0x5362ea['push'](_0x5362ea['shift']());}};_0x3ed993(++_0x51f746);}(_0x0f16,0x1d5));var _0x60f1=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x0f16[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x60f1('0x0'));var util=require(_0x60f1('0x1'));var logger=require(_0x60f1('0x2'))('api');var moment=require('moment');var BPromise=require(_0x60f1('0x3'));var rp=require(_0x60f1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x60f1('0x5'));var config=require(_0x60f1('0x6'));var attributes=require(_0x60f1('0x7'));module['exports']=function(_0xfc8c76,_0x1b7568){return _0xfc8c76[_0x60f1('0x8')](_0x60f1('0x9'),attributes,{'tableName':_0x60f1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x60f1('0xb'),'collate':_0x60f1('0xc')});}; \ No newline at end of file +var _0xc720=['path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','CannedAnswer','tools_canned_answers','lodash','util','bluebird','request-promise'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc720,0xe3));var _0x0c72=function(_0x1d57cb,_0x4a45c5){_0x1d57cb=_0x1d57cb-0x0;var _0x36f25b=_0xc720[_0x1d57cb];return _0x36f25b;};'use strict';var _=require(_0x0c72('0x0'));var util=require(_0x0c72('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0c72('0x2'));var rp=require(_0x0c72('0x3'));var fs=require('fs');var path=require(_0x0c72('0x4'));var rimraf=require(_0x0c72('0x5'));var config=require(_0x0c72('0x6'));var attributes=require(_0x0c72('0x7'));module[_0x0c72('0x8')]=function(_0x137f62,_0x4b2398){return _0x137f62['define'](_0x0c72('0x9'),attributes,{'tableName':_0x0c72('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index a6aeb86..9b03f65 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(_0x38916d,_0x1529b9){var _0x3ad7ec=function(_0x21c04a){while(--_0x21c04a){_0x38916d['push'](_0x38916d['shift']());}};_0x3ad7ec(++_0x1529b9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +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(_0x536e19,_0x59ada4){var _0x5edb6d=function(_0x48ea4a){while(--_0x48ea4a){_0x536e19['push'](_0x536e19['shift']());}};_0x5edb6d(++_0x59ada4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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 46c00fe..d1a13dd 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 _0xe885=['fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','put','update','destroy','path','express'];(function(_0x9a8f1,_0x559257){var _0x4acfc=function(_0x653180){while(--_0x653180){_0x9a8f1['push'](_0x9a8f1['shift']());}};_0x4acfc(++_0x559257);}(_0xe885,0x7c));var _0x5e88=function(_0x5175df,_0x12b843){_0x5175df=_0x5175df-0x0;var _0x1e1c5e=_0xe885[_0x5175df];return _0x1e1c5e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5e88('0x0'));var timeout=require('connect-timeout');var express=require(_0x5e88('0x1'));var router=express['Router']();var fs_extra=require(_0x5e88('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x5e88('0x3'));var config=require(_0x5e88('0x4'));var controller=require('./cannedAnswer.controller');router[_0x5e88('0x5')]('/',auth['isAuthenticated'](),controller[_0x5e88('0x6')]);router[_0x5e88('0x5')](_0x5e88('0x7'),auth[_0x5e88('0x8')](),controller[_0x5e88('0x9')]);router[_0x5e88('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5e88('0xb')](_0x5e88('0x7'),auth[_0x5e88('0x8')](),controller[_0x5e88('0xc')]);router['delete'](_0x5e88('0x7'),auth['isAuthenticated'](),controller[_0x5e88('0xd')]);module['exports']=router; \ No newline at end of file +var _0xf78b=['isAuthenticated','index','get','/:id','show','post','put','update','delete','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cannedAnswer.controller'];(function(_0x2d2c63,_0x5a661d){var _0x16e3e7=function(_0x36d501){while(--_0x36d501){_0x2d2c63['push'](_0x2d2c63['shift']());}};_0x16e3e7(++_0x5a661d);}(_0xf78b,0xe2));var _0xbf78=function(_0xd196ba,_0x3bebf4){_0xd196ba=_0xd196ba-0x0;var _0x39419e=_0xf78b[_0xd196ba];return _0x39419e;};'use strict';var multer=require('multer');var util=require(_0xbf78('0x0'));var path=require(_0xbf78('0x1'));var timeout=require('connect-timeout');var express=require(_0xbf78('0x2'));var router=express[_0xbf78('0x3')]();var fs_extra=require(_0xbf78('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbf78('0x5'));var config=require(_0xbf78('0x6'));var controller=require(_0xbf78('0x7'));router['get']('/',auth[_0xbf78('0x8')](),controller[_0xbf78('0x9')]);router[_0xbf78('0xa')](_0xbf78('0xb'),auth[_0xbf78('0x8')](),controller[_0xbf78('0xc')]);router[_0xbf78('0xd')]('/',auth[_0xbf78('0x8')](),controller['create']);router[_0xbf78('0xe')](_0xbf78('0xb'),auth[_0xbf78('0x8')](),controller[_0xbf78('0xf')]);router[_0xbf78('0x10')]('/:id',auth[_0xbf78('0x8')](),controller['destroy']);module[_0xbf78('0x11')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 242b885..2b8892d 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 _0x9f94=['STRING','INTEGER','sequelize','exports','DATE'];(function(_0x109a49,_0x22ced0){var _0x15d6cd=function(_0x5723af){while(--_0x5723af){_0x109a49['push'](_0x109a49['shift']());}};_0x15d6cd(++_0x22ced0);}(_0x9f94,0x1e7));var _0x49f9=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x9f94[_0x46e363];return _0x3fb059;};'use strict';var Sequelize=require(_0x49f9('0x0'));module[_0x49f9('0x1')]={'calldate':{'type':Sequelize[_0x49f9('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x49f9('0x3')]},'dst':{'type':Sequelize[_0x49f9('0x3')]},'dcontext':{'type':Sequelize[_0x49f9('0x3')]},'channel':{'type':Sequelize[_0x49f9('0x3')]},'dstchannel':{'type':Sequelize[_0x49f9('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x49f9('0x3')]},'duration':{'type':Sequelize[_0x49f9('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x49f9('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x49f9('0x3')]},'amaflags':{'type':Sequelize[_0x49f9('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x49f9('0x3')]},'userfield':{'type':Sequelize[_0x49f9('0x3')]},'uniqueid':{'type':Sequelize[_0x49f9('0x3')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x49f9('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x49f9('0x3')]}}; \ No newline at end of file +var _0x9d3d=['exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x2f1a39,_0x11ccc3){var _0x46b69e=function(_0x5da12a){while(--_0x5da12a){_0x2f1a39['push'](_0x2f1a39['shift']());}};_0x46b69e(++_0x11ccc3);}(_0x9d3d,0x96));var _0xd9d3=function(_0x22d771,_0x223905){_0x22d771=_0x22d771-0x0;var _0x29a9fd=_0x9d3d[_0x22d771];return _0x29a9fd;};'use strict';var Sequelize=require('sequelize');module[_0xd9d3('0x0')]={'calldate':{'type':Sequelize[_0xd9d3('0x1')],'allowNull':![],'defaultValue':_0xd9d3('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0xd9d3('0x3')]},'dcontext':{'type':Sequelize[_0xd9d3('0x3')]},'channel':{'type':Sequelize[_0xd9d3('0x3')]},'dstchannel':{'type':Sequelize[_0xd9d3('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xd9d3('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xd9d3('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xd9d3('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xd9d3('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xd9d3('0x3')]},'sequence':{'type':Sequelize[_0xd9d3('0x3')]},'peeraccount':{'type':Sequelize[_0xd9d3('0x3')]},'type':{'type':Sequelize[_0xd9d3('0x3')]},'tag':{'type':Sequelize[_0xd9d3('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 455d0dc..494f0e8 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 _0x8375=['attributes','intersection','fields','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','rows','catch','show','params','rawAttributes','length','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','save','destroy','then','error','stack','name','send','map','Cdr','fieldName','type','model','query','keys'];(function(_0x14ec9d,_0x45d283){var _0x3636df=function(_0x472568){while(--_0x472568){_0x14ec9d['push'](_0x14ec9d['shift']());}};_0x3636df(++_0x45d283);}(_0x8375,0xa8));var _0x5837=function(_0x103839,_0x4dd6ae){_0x103839=_0x103839-0x0;var _0x105f70=_0x8375[_0x103839];return _0x105f70;};'use strict';var emlformat=require(_0x5837('0x0'));var rimraf=require(_0x5837('0x1'));var zipdir=require(_0x5837('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5837('0x3'));var moment=require(_0x5837('0x4'));var BPromise=require(_0x5837('0x5'));var Mustache=require(_0x5837('0x6'));var util=require(_0x5837('0x7'));var path=require(_0x5837('0x8'));var sox=require('sox');var csv=require(_0x5837('0x9'));var ejs=require(_0x5837('0xa'));var fs=require('fs');var fs_extra=require(_0x5837('0xb'));var _=require(_0x5837('0xc'));var squel=require(_0x5837('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5837('0xe'));var toCsv=require(_0x5837('0x9'));var querystring=require('querystring');var Papa=require(_0x5837('0xf'));var Redis=require('ioredis');var authService=require(_0x5837('0x10'));var qs=require(_0x5837('0x11'));var as=require(_0x5837('0x12'));var hardwareService=require(_0x5837('0x13'));var logger=require(_0x5837('0x14'))(_0x5837('0x15'));var utils=require('../../config/utils');var config=require(_0x5837('0x16'));var licenseUtil=require(_0x5837('0x17'));var db=require(_0x5837('0x18'))['db'];function respondWithStatusCode(_0x10c1a1,_0x143210){_0x143210=_0x143210||0xcc;return function(_0x485366){if(_0x485366){return _0x10c1a1['sendStatus'](_0x143210);}return _0x10c1a1['status'](_0x143210)[_0x5837('0x19')]();};}function respondWithResult(_0x111dbf,_0x469903){_0x469903=_0x469903||0xc8;return function(_0xa5718d){if(_0xa5718d){return _0x111dbf[_0x5837('0x1a')](_0x469903)[_0x5837('0x1b')](_0xa5718d);}};}function respondWithFilteredResult(_0x206f02,_0x754f39){return function(_0x10d882){if(_0x10d882){var _0x59a378=typeof _0x754f39[_0x5837('0x1c')]===_0x5837('0x1d')&&typeof _0x754f39['limit']===_0x5837('0x1d');var _0x2297b4=_0x10d882[_0x5837('0x1e')];var _0x49279d=_0x59a378?0x0:_0x754f39['offset'];var _0x4bee08=_0x59a378?_0x10d882[_0x5837('0x1e')]:_0x754f39[_0x5837('0x1c')]+_0x754f39[_0x5837('0x1f')];var _0x58e7f7;if(_0x4bee08>=_0x2297b4){_0x4bee08=_0x2297b4;_0x58e7f7=0xc8;}else{_0x58e7f7=0xce;}_0x206f02[_0x5837('0x1a')](_0x58e7f7);return _0x206f02[_0x5837('0x20')](_0x5837('0x21'),_0x49279d+'-'+_0x4bee08+'/'+_0x2297b4)[_0x5837('0x1b')](_0x10d882);}return null;};}function patchUpdates(_0x5881ff){return function(_0x4908c2){try{jsonpatch['apply'](_0x4908c2,_0x5881ff,!![]);}catch(_0x3d352f){return BPromise['reject'](_0x3d352f);}return _0x4908c2[_0x5837('0x22')]();};}function saveUpdates(_0x2bd103,_0x32733a){return function(_0x3a7efe){if(_0x3a7efe){return _0x3a7efe['update'](_0x2bd103)['then'](function(_0x1b80db){return _0x1b80db;});}return null;};}function removeEntity(_0x2262b9,_0x406506){return function(_0x5e8089){if(_0x5e8089){return _0x5e8089[_0x5837('0x23')]()[_0x5837('0x24')](function(){_0x2262b9[_0x5837('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41f86a,_0x2646ed){return function(_0x39babd){if(!_0x39babd){_0x41f86a['sendStatus'](0x194);}return _0x39babd;};}function handleError(_0x57baed,_0x1d545c){_0x1d545c=_0x1d545c||0x1f4;return function(_0x15655e){logger[_0x5837('0x25')](_0x15655e[_0x5837('0x26')]);if(_0x15655e[_0x5837('0x27')]){delete _0x15655e[_0x5837('0x27')];}_0x57baed[_0x5837('0x1a')](_0x1d545c)[_0x5837('0x28')](_0x15655e);};}exports['index']=function(_0x2f0c8d,_0x13830f){var _0x3cbd3f={},_0x3918ee={},_0x1c9f32={'count':0x0,'rows':[]};var _0x228f1=_[_0x5837('0x29')](db[_0x5837('0x2a')]['rawAttributes'],function(_0x4f7502){return{'name':_0x4f7502[_0x5837('0x2b')],'type':_0x4f7502[_0x5837('0x2c')]['key']};});_0x3918ee[_0x5837('0x2d')]=_[_0x5837('0x29')](_0x228f1,'name');_0x3918ee[_0x5837('0x2e')]=_[_0x5837('0x2f')](_0x2f0c8d[_0x5837('0x2e')]);_0x3918ee['filters']=_['intersection'](_0x3918ee['model'],_0x3918ee[_0x5837('0x2e')]);_0x3cbd3f[_0x5837('0x30')]=_[_0x5837('0x31')](_0x3918ee[_0x5837('0x2d')],qs[_0x5837('0x32')](_0x2f0c8d['query']['fields']));_0x3cbd3f[_0x5837('0x30')]=_0x3cbd3f[_0x5837('0x30')]['length']?_0x3cbd3f['attributes']:_0x3918ee[_0x5837('0x2d')];if(!_0x2f0c8d['query']['hasOwnProperty'](_0x5837('0x33'))){_0x3cbd3f[_0x5837('0x1f')]=qs['limit'](_0x2f0c8d[_0x5837('0x2e')][_0x5837('0x1f')]);_0x3cbd3f[_0x5837('0x1c')]=qs['offset'](_0x2f0c8d[_0x5837('0x2e')][_0x5837('0x1c')]);}_0x3cbd3f[_0x5837('0x34')]=qs[_0x5837('0x35')](_0x2f0c8d[_0x5837('0x2e')]['sort']);_0x3cbd3f[_0x5837('0x36')]=qs['filters'](_['pick'](_0x2f0c8d[_0x5837('0x2e')],_0x3918ee[_0x5837('0x37')]),_0x228f1);if(_0x2f0c8d['query'][_0x5837('0x38')]){_0x3cbd3f[_0x5837('0x36')]=_[_0x5837('0x39')](_0x3cbd3f[_0x5837('0x36')],{'$or':_['map'](_0x228f1,function(_0x2ed688){if(_0x2ed688[_0x5837('0x2c')]!==_0x5837('0x3a')){var _0x5dcd18={};_0x5dcd18[_0x2ed688[_0x5837('0x27')]]={'$like':'%'+_0x2f0c8d[_0x5837('0x2e')][_0x5837('0x38')]+'%'};return _0x5dcd18;}})});}_0x3cbd3f=_[_0x5837('0x39')]({},_0x3cbd3f,_0x2f0c8d[_0x5837('0x3b')]);var _0x76f00d={'where':_0x3cbd3f[_0x5837('0x36')]};return db[_0x5837('0x2a')][_0x5837('0x1e')](_0x76f00d)[_0x5837('0x24')](function(_0x1a5e2d){_0x1c9f32[_0x5837('0x1e')]=_0x1a5e2d;if(_0x2f0c8d['query']['includeAll']){_0x3cbd3f[_0x5837('0x3c')]=[{'all':!![]}];}return db[_0x5837('0x2a')]['findAll'](_0x3cbd3f);})[_0x5837('0x24')](function(_0x1ae168){_0x1c9f32[_0x5837('0x3d')]=_0x1ae168;return _0x1c9f32;})['then'](respondWithFilteredResult(_0x13830f,_0x3cbd3f))[_0x5837('0x3e')](handleError(_0x13830f,null));};exports[_0x5837('0x3f')]=function(_0x1c81ed,_0x3acdf5){var _0x4643e3={'raw':!![],'where':{'id':_0x1c81ed[_0x5837('0x40')]['id']}},_0xd443be={};_0xd443be[_0x5837('0x2d')]=_[_0x5837('0x2f')](db['Cdr'][_0x5837('0x41')]);_0xd443be[_0x5837('0x2e')]=_[_0x5837('0x2f')](_0x1c81ed['query']);_0xd443be['filters']=_[_0x5837('0x31')](_0xd443be[_0x5837('0x2d')],_0xd443be[_0x5837('0x2e')]);_0x4643e3[_0x5837('0x30')]=_[_0x5837('0x31')](_0xd443be[_0x5837('0x2d')],qs[_0x5837('0x32')](_0x1c81ed[_0x5837('0x2e')][_0x5837('0x32')]));_0x4643e3[_0x5837('0x30')]=_0x4643e3[_0x5837('0x30')][_0x5837('0x42')]?_0x4643e3['attributes']:_0xd443be[_0x5837('0x2d')];if(_0x1c81ed['query'][_0x5837('0x43')]){_0x4643e3[_0x5837('0x3c')]=[{'all':!![]}];}_0x4643e3=_['merge']({},_0x4643e3,_0x1c81ed[_0x5837('0x3b')]);return db[_0x5837('0x2a')]['find'](_0x4643e3)[_0x5837('0x24')](handleEntityNotFound(_0x3acdf5,null))[_0x5837('0x24')](respondWithResult(_0x3acdf5,null))[_0x5837('0x3e')](handleError(_0x3acdf5,null));};exports[_0x5837('0x44')]=function(_0x54a23b,_0x55cf2b){return db[_0x5837('0x2a')][_0x5837('0x44')](_0x54a23b['body'],{})['then'](respondWithResult(_0x55cf2b,0xc9))['catch'](handleError(_0x55cf2b,null));};exports['update']=function(_0x38e987,_0x6423f2){if(_0x38e987[_0x5837('0x45')]['id']){delete _0x38e987['body']['id'];}return db['Cdr'][_0x5837('0x46')]({'where':{'id':_0x38e987[_0x5837('0x40')]['id']}})[_0x5837('0x24')](handleEntityNotFound(_0x6423f2,null))[_0x5837('0x24')](saveUpdates(_0x38e987[_0x5837('0x45')],null))[_0x5837('0x24')](respondWithResult(_0x6423f2,null))[_0x5837('0x3e')](handleError(_0x6423f2,null));};exports[_0x5837('0x23')]=function(_0x27f7b9,_0x38743a){return db['Cdr'][_0x5837('0x46')]({'where':{'id':_0x27f7b9[_0x5837('0x40')]['id']}})['then'](handleEntityNotFound(_0x38743a,null))[_0x5837('0x24')](removeEntity(_0x38743a,null))[_0x5837('0x3e')](handleError(_0x38743a,null));};exports[_0x5837('0x47')]=function(_0x397cd9,_0x38e75d){return db['Cdr'][_0x5837('0x47')]()[_0x5837('0x24')](respondWithResult(_0x38e75d,null))[_0x5837('0x3e')](handleError(_0x38e75d,null));}; \ No newline at end of file +var _0xac95=['query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','include','catch','params','rawAttributes','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','sendStatus','error','stack','name','index','map','Cdr','type','key','model'];(function(_0x1e1020,_0xd64a27){var _0x464719=function(_0x376ffa){while(--_0x376ffa){_0x1e1020['push'](_0x1e1020['shift']());}};_0x464719(++_0xd64a27);}(_0xac95,0xa8));var _0x5ac9=function(_0x5afe38,_0x30cbf8){_0x5afe38=_0x5afe38-0x0;var _0x39bd5e=_0xac95[_0x5afe38];return _0x39bd5e;};'use strict';var emlformat=require(_0x5ac9('0x0'));var rimraf=require(_0x5ac9('0x1'));var zipdir=require(_0x5ac9('0x2'));var jsonpatch=require(_0x5ac9('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5ac9('0x4'));var Mustache=require(_0x5ac9('0x5'));var util=require('util');var path=require(_0x5ac9('0x6'));var sox=require(_0x5ac9('0x7'));var csv=require('to-csv');var ejs=require(_0x5ac9('0x8'));var fs=require('fs');var fs_extra=require(_0x5ac9('0x9'));var _=require(_0x5ac9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5ac9('0xb'));var deskjs=require(_0x5ac9('0xc'));var toCsv=require(_0x5ac9('0xd'));var querystring=require(_0x5ac9('0xe'));var Papa=require(_0x5ac9('0xf'));var Redis=require(_0x5ac9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5ac9('0x11'));var as=require(_0x5ac9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ac9('0x13'))('api');var utils=require(_0x5ac9('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5ac9('0x15'));var db=require(_0x5ac9('0x16'))['db'];function respondWithStatusCode(_0x371231,_0x40eb62){_0x40eb62=_0x40eb62||0xcc;return function(_0x4f9a04){if(_0x4f9a04){return _0x371231['sendStatus'](_0x40eb62);}return _0x371231[_0x5ac9('0x17')](_0x40eb62)['end']();};}function respondWithResult(_0x3a7d64,_0x364007){_0x364007=_0x364007||0xc8;return function(_0x50658c){if(_0x50658c){return _0x3a7d64[_0x5ac9('0x17')](_0x364007)[_0x5ac9('0x18')](_0x50658c);}};}function respondWithFilteredResult(_0x3f8fac,_0x122590){return function(_0x456ed9){if(_0x456ed9){var _0x2fe47e=typeof _0x122590[_0x5ac9('0x19')]===_0x5ac9('0x1a')&&typeof _0x122590[_0x5ac9('0x1b')]==='undefined';var _0x53a8db=_0x456ed9[_0x5ac9('0x1c')];var _0x193c56=_0x2fe47e?0x0:_0x122590[_0x5ac9('0x19')];var _0x4463ff=_0x2fe47e?_0x456ed9[_0x5ac9('0x1c')]:_0x122590[_0x5ac9('0x19')]+_0x122590[_0x5ac9('0x1b')];var _0x429bf3;if(_0x4463ff>=_0x53a8db){_0x4463ff=_0x53a8db;_0x429bf3=0xc8;}else{_0x429bf3=0xce;}_0x3f8fac[_0x5ac9('0x17')](_0x429bf3);return _0x3f8fac[_0x5ac9('0x1d')](_0x5ac9('0x1e'),_0x193c56+'-'+_0x4463ff+'/'+_0x53a8db)[_0x5ac9('0x18')](_0x456ed9);}return null;};}function patchUpdates(_0x2efa5f){return function(_0x479c6b){try{jsonpatch[_0x5ac9('0x1f')](_0x479c6b,_0x2efa5f,!![]);}catch(_0x1f5546){return BPromise[_0x5ac9('0x20')](_0x1f5546);}return _0x479c6b[_0x5ac9('0x21')]();};}function saveUpdates(_0x2d2ba5,_0x492679){return function(_0x45417d){if(_0x45417d){return _0x45417d[_0x5ac9('0x22')](_0x2d2ba5)['then'](function(_0x5e42a1){return _0x5e42a1;});}return null;};}function removeEntity(_0x5a4664,_0xc36d2){return function(_0x2e666b){if(_0x2e666b){return _0x2e666b['destroy']()['then'](function(){_0x5a4664[_0x5ac9('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49352f,_0x2d1bb5){return function(_0x505acc){if(!_0x505acc){_0x49352f[_0x5ac9('0x23')](0x194);}return _0x505acc;};}function handleError(_0x3b77be,_0x770c48){_0x770c48=_0x770c48||0x1f4;return function(_0x3a7f68){logger[_0x5ac9('0x24')](_0x3a7f68[_0x5ac9('0x25')]);if(_0x3a7f68[_0x5ac9('0x26')]){delete _0x3a7f68[_0x5ac9('0x26')];}_0x3b77be[_0x5ac9('0x17')](_0x770c48)['send'](_0x3a7f68);};}exports[_0x5ac9('0x27')]=function(_0x14a7fe,_0x2a7db9){var _0x3a536c={},_0x3d51ab={},_0x58c9be={'count':0x0,'rows':[]};var _0x47f6ad=_[_0x5ac9('0x28')](db[_0x5ac9('0x29')]['rawAttributes'],function(_0x3a15cf){return{'name':_0x3a15cf['fieldName'],'type':_0x3a15cf[_0x5ac9('0x2a')][_0x5ac9('0x2b')]};});_0x3d51ab[_0x5ac9('0x2c')]=_['map'](_0x47f6ad,_0x5ac9('0x26'));_0x3d51ab[_0x5ac9('0x2d')]=_[_0x5ac9('0x2e')](_0x14a7fe[_0x5ac9('0x2d')]);_0x3d51ab[_0x5ac9('0x2f')]=_[_0x5ac9('0x30')](_0x3d51ab['model'],_0x3d51ab['query']);_0x3a536c[_0x5ac9('0x31')]=_['intersection'](_0x3d51ab['model'],qs[_0x5ac9('0x32')](_0x14a7fe[_0x5ac9('0x2d')][_0x5ac9('0x32')]));_0x3a536c[_0x5ac9('0x31')]=_0x3a536c[_0x5ac9('0x31')][_0x5ac9('0x33')]?_0x3a536c[_0x5ac9('0x31')]:_0x3d51ab[_0x5ac9('0x2c')];if(!_0x14a7fe[_0x5ac9('0x2d')]['hasOwnProperty'](_0x5ac9('0x34'))){_0x3a536c[_0x5ac9('0x1b')]=qs['limit'](_0x14a7fe['query'][_0x5ac9('0x1b')]);_0x3a536c[_0x5ac9('0x19')]=qs[_0x5ac9('0x19')](_0x14a7fe[_0x5ac9('0x2d')]['offset']);}_0x3a536c[_0x5ac9('0x35')]=qs['sort'](_0x14a7fe[_0x5ac9('0x2d')][_0x5ac9('0x36')]);_0x3a536c[_0x5ac9('0x37')]=qs[_0x5ac9('0x2f')](_[_0x5ac9('0x38')](_0x14a7fe[_0x5ac9('0x2d')],_0x3d51ab[_0x5ac9('0x2f')]),_0x47f6ad);if(_0x14a7fe[_0x5ac9('0x2d')][_0x5ac9('0x39')]){_0x3a536c[_0x5ac9('0x37')]=_[_0x5ac9('0x3a')](_0x3a536c[_0x5ac9('0x37')],{'$or':_['map'](_0x47f6ad,function(_0x5d57ff){if(_0x5d57ff[_0x5ac9('0x2a')]!==_0x5ac9('0x3b')){var _0x3003f6={};_0x3003f6[_0x5d57ff[_0x5ac9('0x26')]]={'$like':'%'+_0x14a7fe[_0x5ac9('0x2d')][_0x5ac9('0x39')]+'%'};return _0x3003f6;}})});}_0x3a536c=_['merge']({},_0x3a536c,_0x14a7fe[_0x5ac9('0x3c')]);var _0x16b74e={'where':_0x3a536c['where']};return db['Cdr']['count'](_0x16b74e)[_0x5ac9('0x3d')](function(_0xc6be86){_0x58c9be[_0x5ac9('0x1c')]=_0xc6be86;if(_0x14a7fe[_0x5ac9('0x2d')]['includeAll']){_0x3a536c[_0x5ac9('0x3e')]=[{'all':!![]}];}return db['Cdr']['findAll'](_0x3a536c);})[_0x5ac9('0x3d')](function(_0x45bc9b){_0x58c9be['rows']=_0x45bc9b;return _0x58c9be;})[_0x5ac9('0x3d')](respondWithFilteredResult(_0x2a7db9,_0x3a536c))[_0x5ac9('0x3f')](handleError(_0x2a7db9,null));};exports['show']=function(_0x2a1c19,_0xba7c84){var _0x433634={'raw':!![],'where':{'id':_0x2a1c19[_0x5ac9('0x40')]['id']}},_0x1caf84={};_0x1caf84[_0x5ac9('0x2c')]=_[_0x5ac9('0x2e')](db[_0x5ac9('0x29')][_0x5ac9('0x41')]);_0x1caf84[_0x5ac9('0x2d')]=_[_0x5ac9('0x2e')](_0x2a1c19[_0x5ac9('0x2d')]);_0x1caf84['filters']=_[_0x5ac9('0x30')](_0x1caf84[_0x5ac9('0x2c')],_0x1caf84[_0x5ac9('0x2d')]);_0x433634['attributes']=_[_0x5ac9('0x30')](_0x1caf84[_0x5ac9('0x2c')],qs[_0x5ac9('0x32')](_0x2a1c19['query'][_0x5ac9('0x32')]));_0x433634[_0x5ac9('0x31')]=_0x433634[_0x5ac9('0x31')][_0x5ac9('0x33')]?_0x433634[_0x5ac9('0x31')]:_0x1caf84[_0x5ac9('0x2c')];if(_0x2a1c19['query']['includeAll']){_0x433634[_0x5ac9('0x3e')]=[{'all':!![]}];}_0x433634=_['merge']({},_0x433634,_0x2a1c19[_0x5ac9('0x3c')]);return db['Cdr'][_0x5ac9('0x42')](_0x433634)[_0x5ac9('0x3d')](handleEntityNotFound(_0xba7c84,null))[_0x5ac9('0x3d')](respondWithResult(_0xba7c84,null))[_0x5ac9('0x3f')](handleError(_0xba7c84,null));};exports[_0x5ac9('0x43')]=function(_0x671363,_0x324b7d){return db[_0x5ac9('0x29')][_0x5ac9('0x43')](_0x671363[_0x5ac9('0x44')],{})[_0x5ac9('0x3d')](respondWithResult(_0x324b7d,0xc9))['catch'](handleError(_0x324b7d,null));};exports[_0x5ac9('0x22')]=function(_0x4bb9c7,_0x482df4){if(_0x4bb9c7['body']['id']){delete _0x4bb9c7[_0x5ac9('0x44')]['id'];}return db[_0x5ac9('0x29')][_0x5ac9('0x42')]({'where':{'id':_0x4bb9c7['params']['id']}})[_0x5ac9('0x3d')](handleEntityNotFound(_0x482df4,null))[_0x5ac9('0x3d')](saveUpdates(_0x4bb9c7[_0x5ac9('0x44')],null))[_0x5ac9('0x3d')](respondWithResult(_0x482df4,null))[_0x5ac9('0x3f')](handleError(_0x482df4,null));};exports[_0x5ac9('0x45')]=function(_0x499fd3,_0x47a7b8){return db[_0x5ac9('0x29')][_0x5ac9('0x42')]({'where':{'id':_0x499fd3['params']['id']}})[_0x5ac9('0x3d')](handleEntityNotFound(_0x47a7b8,null))[_0x5ac9('0x3d')](removeEntity(_0x47a7b8,null))[_0x5ac9('0x3f')](handleError(_0x47a7b8,null));};exports[_0x5ac9('0x46')]=function(_0x6b3995,_0x575a3f){return db[_0x5ac9('0x29')][_0x5ac9('0x46')]()[_0x5ac9('0x3d')](respondWithResult(_0x575a3f,null))['catch'](handleError(_0x575a3f,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 2eff1e0..6d61a38 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x12c110,_0xbe715c){var _0x26eafc=function(_0x26514e){while(--_0x26514e){_0x12c110['push'](_0x12c110['shift']());}};_0x26eafc(++_0xbe715c);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x3cbf3e,_0x4555cf){var _0x1735e0=function(_0x2a5bd9){while(--_0x2a5bd9){_0x3cbf3e['push'](_0x3cbf3e['shift']());}};_0x1735e0(++_0x4555cf);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index c541ff5..8541d5c 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 _0xba8e=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','message','info','result'];(function(_0x59520f,_0xc939d7){var _0x1c7e29=function(_0x11c88e){while(--_0x11c88e){_0x59520f['push'](_0x59520f['shift']());}};_0x1c7e29(++_0xc939d7);}(_0xba8e,0xb1));var _0xeba8=function(_0x36de10,_0xfe25e8){_0x36de10=_0x36de10-0x0;var _0x58100f=_0xba8e[_0x36de10];return _0x58100f;};'use strict';var _=require(_0xeba8('0x0'));var util=require(_0xeba8('0x1'));var moment=require(_0xeba8('0x2'));var BPromise=require(_0xeba8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeba8('0x4'));var db=require(_0xeba8('0x5'))['db'];var utils=require(_0xeba8('0x6'));var logger=require('../../config/logger')(_0xeba8('0x7'));var config=require(_0xeba8('0x8'));var jayson=require(_0xeba8('0x9'));var client=jayson[_0xeba8('0xa')][_0xeba8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18b194,_0x1be09c,_0x4b5666){return new BPromise(function(_0x19bd07,_0x3b0ef8){return client[_0xeba8('0xc')](_0x18b194,_0x4b5666)['then'](function(_0x375dec){logger['info'](_0xeba8('0xd'),_0x1be09c,_0xeba8('0xe'));logger[_0xeba8('0xf')](_0xeba8('0x10'),_0x1be09c,'request\x20sent',JSON['stringify'](_0x375dec));if(_0x375dec['error']){if(_0x375dec[_0xeba8('0x11')]['code']===0x1f4){logger[_0xeba8('0x11')](_0xeba8('0xd'),_0x1be09c,_0x375dec['error'][_0xeba8('0x12')]);return _0x3b0ef8(_0x375dec[_0xeba8('0x11')][_0xeba8('0x12')]);}logger[_0xeba8('0x11')]('Cdr,\x20%s,\x20%s',_0x1be09c,_0x375dec[_0xeba8('0x11')][_0xeba8('0x12')]);return _0x19bd07(_0x375dec[_0xeba8('0x11')][_0xeba8('0x12')]);}else{logger[_0xeba8('0x13')](_0xeba8('0xd'),_0x1be09c,_0xeba8('0xe'));_0x19bd07(_0x375dec[_0xeba8('0x14')]['message']);}})[_0xeba8('0x15')](function(_0x3ef84f){logger[_0xeba8('0x11')]('Cdr,\x20%s,\x20%s',_0x1be09c,_0x3ef84f);_0x3b0ef8(_0x3ef84f);});});} \ No newline at end of file +var _0xa397=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','Cdr,\x20%s,\x20%s','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','bluebird','randomstring','ioredis'];(function(_0x3a24f2,_0x441682){var _0x17c0da=function(_0x489016){while(--_0x489016){_0x3a24f2['push'](_0x3a24f2['shift']());}};_0x17c0da(++_0x441682);}(_0xa397,0x188));var _0x7a39=function(_0x20c2f8,_0x6ea91){_0x20c2f8=_0x20c2f8-0x0;var _0x3ce3fc=_0xa397[_0x20c2f8];return _0x3ce3fc;};'use strict';var _=require(_0x7a39('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7a39('0x1'));var rs=require(_0x7a39('0x2'));var fs=require('fs');var Redis=require(_0x7a39('0x3'));var db=require(_0x7a39('0x4'))['db'];var utils=require(_0x7a39('0x5'));var logger=require('../../config/logger')(_0x7a39('0x6'));var config=require('../../config/environment');var jayson=require(_0x7a39('0x7'));var client=jayson[_0x7a39('0x8')][_0x7a39('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d7acf,_0x396033,_0x4f5d4e){return new BPromise(function(_0x4f07a2,_0xad4c32){return client[_0x7a39('0xa')](_0x5d7acf,_0x4f5d4e)['then'](function(_0x38a573){logger[_0x7a39('0xb')](_0x7a39('0xc'),_0x396033,'request\x20sent');logger['debug'](_0x7a39('0xd'),_0x396033,'request\x20sent',JSON[_0x7a39('0xe')](_0x38a573));if(_0x38a573[_0x7a39('0xf')]){if(_0x38a573[_0x7a39('0xf')]['code']===0x1f4){logger[_0x7a39('0xf')](_0x7a39('0xc'),_0x396033,_0x38a573[_0x7a39('0xf')][_0x7a39('0x10')]);return _0xad4c32(_0x38a573[_0x7a39('0xf')][_0x7a39('0x10')]);}logger[_0x7a39('0xf')](_0x7a39('0xc'),_0x396033,_0x38a573[_0x7a39('0xf')][_0x7a39('0x10')]);return _0x4f07a2(_0x38a573[_0x7a39('0xf')][_0x7a39('0x10')]);}else{logger['info'](_0x7a39('0xc'),_0x396033,'request\x20sent');_0x4f07a2(_0x38a573['result'][_0x7a39('0x10')]);}})[_0x7a39('0x11')](function(_0x466742){logger[_0x7a39('0xf')](_0x7a39('0xc'),_0x396033,_0x466742);_0xad4c32(_0x466742);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index dfec15f..d24112e 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(_0x4b4f24,_0x5654a8){var _0x1c13d4=function(_0x4940bf){while(--_0x4940bf){_0x4b4f24['push'](_0x4b4f24['shift']());}};_0x1c13d4(++_0x5654a8);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 _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(_0x3124f8,_0x1a8b23){var _0x5bab5f=function(_0x18b09b){while(--_0x18b09b){_0x3124f8['push'](_0x3124f8['shift']());}};_0x5bab5f(++_0x1a8b23);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 051a0b4..102cb42 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 _0xdf3d=['STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x4c2942,_0x2f6fb1){var _0x2c9a5e=function(_0x5dea75){while(--_0x5dea75){_0x4c2942['push'](_0x4c2942['shift']());}};_0x2c9a5e(++_0x2f6fb1);}(_0xdf3d,0xb2));var _0xddf3=function(_0x3df223,_0x1740fc){_0x3df223=_0x3df223-0x0;var _0x562d11=_0xdf3d[_0x3df223];return _0x562d11;};'use strict';var Sequelize=require(_0xddf3('0x0'));module[_0xddf3('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xddf3('0x2')],'allowNull':![],'defaultValue':_0xddf3('0x3')},'appdata':{'type':Sequelize[_0xddf3('0x4')]()},'description':{'type':Sequelize[_0xddf3('0x2')]},'interval':{'type':Sequelize[_0xddf3('0x2')],'defaultValue':_0xddf3('0x5')}}; \ No newline at end of file +var _0xb692=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x2d4efe,_0x53ed16){var _0x4937ba=function(_0x3a2bc0){while(--_0x3a2bc0){_0x2d4efe['push'](_0x2d4efe['shift']());}};_0x4937ba(++_0x53ed16);}(_0xb692,0x1ae));var _0x2b69=function(_0x4a1353,_0x2fbe86){_0x4a1353=_0x4a1353-0x0;var _0x3805cc=_0xb692[_0x4a1353];return _0x3805cc;};'use strict';var Sequelize=require(_0x2b69('0x0'));module[_0x2b69('0x1')]={'priority':{'type':Sequelize[_0x2b69('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2b69('0x3')],'allowNull':![],'defaultValue':_0x2b69('0x4')},'appdata':{'type':Sequelize[_0x2b69('0x5')]()},'description':{'type':Sequelize[_0x2b69('0x3')]},'interval':{'type':Sequelize[_0x2b69('0x3')],'defaultValue':_0x2b69('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 81d026d..404ab1b 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 _0xfc03=['util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show','params','model','keys','ChatApplication','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','catch','body','find','eml-format','zip-dir','fast-json-patch','moment','mustache'];(function(_0x193ddf,_0x6f30bb){var _0x5bc6df=function(_0x70fd9e){while(--_0x70fd9e){_0x193ddf['push'](_0x193ddf['shift']());}};_0x5bc6df(++_0x6f30bb);}(_0xfc03,0x16f));var _0x3fc0=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xfc03[_0x4ff09b];return _0x3f5c2e;};'use strict';var emlformat=require(_0x3fc0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3fc0('0x1'));var jsonpatch=require(_0x3fc0('0x2'));var rp=require('request-promise');var moment=require(_0x3fc0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3fc0('0x4'));var util=require(_0x3fc0('0x5'));var path=require(_0x3fc0('0x6'));var sox=require(_0x3fc0('0x7'));var csv=require(_0x3fc0('0x8'));var ejs=require(_0x3fc0('0x9'));var fs=require('fs');var fs_extra=require(_0x3fc0('0xa'));var _=require(_0x3fc0('0xb'));var squel=require('squel');var crypto=require(_0x3fc0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3fc0('0xd'));var toCsv=require(_0x3fc0('0x8'));var querystring=require(_0x3fc0('0xe'));var Papa=require(_0x3fc0('0xf'));var Redis=require('ioredis');var authService=require(_0x3fc0('0x10'));var qs=require(_0x3fc0('0x11'));var as=require(_0x3fc0('0x12'));var hardwareService=require(_0x3fc0('0x13'));var logger=require(_0x3fc0('0x14'))('api');var utils=require(_0x3fc0('0x15'));var config=require(_0x3fc0('0x16'));var licenseUtil=require(_0x3fc0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1011b7,_0x582e22){_0x582e22=_0x582e22||0xcc;return function(_0x3a4cc0){if(_0x3a4cc0){return _0x1011b7[_0x3fc0('0x18')](_0x582e22);}return _0x1011b7['status'](_0x582e22)[_0x3fc0('0x19')]();};}function respondWithResult(_0x422926,_0x392c46){_0x392c46=_0x392c46||0xc8;return function(_0x4eb69a){if(_0x4eb69a){return _0x422926[_0x3fc0('0x1a')](_0x392c46)[_0x3fc0('0x1b')](_0x4eb69a);}};}function respondWithFilteredResult(_0x367ce1,_0x27619a){return function(_0x562ecc){if(_0x562ecc){var _0x277dbf=typeof _0x27619a[_0x3fc0('0x1c')]===_0x3fc0('0x1d')&&typeof _0x27619a['limit']===_0x3fc0('0x1d');var _0x491446=_0x562ecc[_0x3fc0('0x1e')];var _0x3c5026=_0x277dbf?0x0:_0x27619a['offset'];var _0x3bb388=_0x277dbf?_0x562ecc[_0x3fc0('0x1e')]:_0x27619a[_0x3fc0('0x1c')]+_0x27619a[_0x3fc0('0x1f')];var _0x1bd575;if(_0x3bb388>=_0x491446){_0x3bb388=_0x491446;_0x1bd575=0xc8;}else{_0x1bd575=0xce;}_0x367ce1[_0x3fc0('0x1a')](_0x1bd575);return _0x367ce1[_0x3fc0('0x20')](_0x3fc0('0x21'),_0x3c5026+'-'+_0x3bb388+'/'+_0x491446)[_0x3fc0('0x1b')](_0x562ecc);}return null;};}function patchUpdates(_0x5c859e){return function(_0xf13744){try{jsonpatch[_0x3fc0('0x22')](_0xf13744,_0x5c859e,!![]);}catch(_0x34ffa7){return BPromise[_0x3fc0('0x23')](_0x34ffa7);}return _0xf13744[_0x3fc0('0x24')]();};}function saveUpdates(_0x448293,_0x47c770){return function(_0x477674){if(_0x477674){return _0x477674[_0x3fc0('0x25')](_0x448293)[_0x3fc0('0x26')](function(_0x28fc65){return _0x28fc65;});}return null;};}function removeEntity(_0x46c213,_0x303dd2){return function(_0x2f423e){if(_0x2f423e){return _0x2f423e[_0x3fc0('0x27')]()[_0x3fc0('0x26')](function(){_0x46c213[_0x3fc0('0x1a')](0xcc)[_0x3fc0('0x19')]();});}};}function handleEntityNotFound(_0x1abe10,_0x784765){return function(_0xba1a23){if(!_0xba1a23){_0x1abe10[_0x3fc0('0x18')](0x194);}return _0xba1a23;};}function handleError(_0xbec5b5,_0x4f5111){_0x4f5111=_0x4f5111||0x1f4;return function(_0x365c8e){logger[_0x3fc0('0x28')](_0x365c8e[_0x3fc0('0x29')]);if(_0x365c8e[_0x3fc0('0x2a')]){delete _0x365c8e['name'];}_0xbec5b5[_0x3fc0('0x1a')](_0x4f5111)[_0x3fc0('0x2b')](_0x365c8e);};}exports[_0x3fc0('0x2c')]=function(_0x2645b4,_0x559fcc){var _0x1e4d99={'raw':!![],'where':{'id':_0x2645b4[_0x3fc0('0x2d')]['id']}},_0x1a2261={};_0x1a2261[_0x3fc0('0x2e')]=_[_0x3fc0('0x2f')](db[_0x3fc0('0x30')]['rawAttributes']);_0x1a2261[_0x3fc0('0x31')]=_[_0x3fc0('0x2f')](_0x2645b4[_0x3fc0('0x31')]);_0x1a2261[_0x3fc0('0x32')]=_[_0x3fc0('0x33')](_0x1a2261[_0x3fc0('0x2e')],_0x1a2261[_0x3fc0('0x31')]);_0x1e4d99[_0x3fc0('0x34')]=_['intersection'](_0x1a2261['model'],qs[_0x3fc0('0x35')](_0x2645b4['query'][_0x3fc0('0x35')]));_0x1e4d99[_0x3fc0('0x34')]=_0x1e4d99[_0x3fc0('0x34')][_0x3fc0('0x36')]?_0x1e4d99[_0x3fc0('0x34')]:_0x1a2261['model'];if(_0x2645b4['query'][_0x3fc0('0x37')]){_0x1e4d99[_0x3fc0('0x38')]=[{'all':!![]}];}_0x1e4d99=_[_0x3fc0('0x39')]({},_0x1e4d99,_0x2645b4[_0x3fc0('0x3a')]);return db[_0x3fc0('0x30')]['find'](_0x1e4d99)[_0x3fc0('0x26')](handleEntityNotFound(_0x559fcc,null))[_0x3fc0('0x26')](respondWithResult(_0x559fcc,null))[_0x3fc0('0x3b')](handleError(_0x559fcc,null));};exports['update']=function(_0x1a39c1,_0x4279c0){if(_0x1a39c1[_0x3fc0('0x3c')]['id']){delete _0x1a39c1[_0x3fc0('0x3c')]['id'];}return db['ChatApplication'][_0x3fc0('0x3d')]({'where':{'id':_0x1a39c1[_0x3fc0('0x2d')]['id']}})['then'](handleEntityNotFound(_0x4279c0,null))[_0x3fc0('0x26')](saveUpdates(_0x1a39c1['body'],null))[_0x3fc0('0x26')](respondWithResult(_0x4279c0,null))[_0x3fc0('0x3b')](handleError(_0x4279c0,null));};exports[_0x3fc0('0x27')]=function(_0x2db02e,_0x302a02){return db[_0x3fc0('0x30')][_0x3fc0('0x3d')]({'where':{'id':_0x2db02e[_0x3fc0('0x2d')]['id']}})[_0x3fc0('0x26')](handleEntityNotFound(_0x302a02,null))[_0x3fc0('0x26')](removeEntity(_0x302a02,null))[_0x3fc0('0x3b')](handleError(_0x302a02,null));}; \ No newline at end of file +var _0x4345=['rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','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','sendStatus','end','status','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','error','stack','name','show','model','keys','rawAttributes','query','intersection','attributes','fields','length','includeAll','include','merge','options','ChatApplication','find','then','catch','body','params','eml-format'];(function(_0x676eb1,_0x190ce8){var _0x107859=function(_0x57594b){while(--_0x57594b){_0x676eb1['push'](_0x676eb1['shift']());}};_0x107859(++_0x190ce8);}(_0x4345,0x77));var _0x5434=function(_0x9e1074,_0xfecfb0){_0x9e1074=_0x9e1074-0x0;var _0x242876=_0x4345[_0x9e1074];return _0x242876;};'use strict';var emlformat=require(_0x5434('0x0'));var rimraf=require(_0x5434('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5434('0x2'));var rp=require(_0x5434('0x3'));var moment=require(_0x5434('0x4'));var BPromise=require(_0x5434('0x5'));var Mustache=require('mustache');var util=require(_0x5434('0x6'));var path=require('path');var sox=require(_0x5434('0x7'));var csv=require(_0x5434('0x8'));var ejs=require(_0x5434('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5434('0xa'));var squel=require('squel');var crypto=require(_0x5434('0xb'));var jsforce=require(_0x5434('0xc'));var deskjs=require(_0x5434('0xd'));var toCsv=require(_0x5434('0x8'));var querystring=require(_0x5434('0xe'));var Papa=require(_0x5434('0xf'));var Redis=require(_0x5434('0x10'));var authService=require(_0x5434('0x11'));var qs=require(_0x5434('0x12'));var as=require(_0x5434('0x13'));var hardwareService=require(_0x5434('0x14'));var logger=require(_0x5434('0x15'))(_0x5434('0x16'));var utils=require(_0x5434('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x5434('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36a2d9,_0xf27177){_0xf27177=_0xf27177||0xcc;return function(_0x13a13f){if(_0x13a13f){return _0x36a2d9[_0x5434('0x19')](_0xf27177);}return _0x36a2d9['status'](_0xf27177)[_0x5434('0x1a')]();};}function respondWithResult(_0x223766,_0x5aa606){_0x5aa606=_0x5aa606||0xc8;return function(_0x44ea26){if(_0x44ea26){return _0x223766[_0x5434('0x1b')](_0x5aa606)[_0x5434('0x1c')](_0x44ea26);}};}function respondWithFilteredResult(_0x1a7a2c,_0x48be48){return function(_0x2b88c4){if(_0x2b88c4){var _0x437664=typeof _0x48be48['offset']===_0x5434('0x1d')&&typeof _0x48be48['limit']===_0x5434('0x1d');var _0x42a118=_0x2b88c4[_0x5434('0x1e')];var _0x148b3c=_0x437664?0x0:_0x48be48[_0x5434('0x1f')];var _0x2d60be=_0x437664?_0x2b88c4[_0x5434('0x1e')]:_0x48be48['offset']+_0x48be48[_0x5434('0x20')];var _0x5a4570;if(_0x2d60be>=_0x42a118){_0x2d60be=_0x42a118;_0x5a4570=0xc8;}else{_0x5a4570=0xce;}_0x1a7a2c[_0x5434('0x1b')](_0x5a4570);return _0x1a7a2c['set'](_0x5434('0x21'),_0x148b3c+'-'+_0x2d60be+'/'+_0x42a118)[_0x5434('0x1c')](_0x2b88c4);}return null;};}function patchUpdates(_0x240787){return function(_0x4d34d6){try{jsonpatch[_0x5434('0x22')](_0x4d34d6,_0x240787,!![]);}catch(_0x2513e9){return BPromise[_0x5434('0x23')](_0x2513e9);}return _0x4d34d6[_0x5434('0x24')]();};}function saveUpdates(_0x1da16d,_0x5c43ef){return function(_0x5e92d0){if(_0x5e92d0){return _0x5e92d0[_0x5434('0x25')](_0x1da16d)['then'](function(_0x4524f9){return _0x4524f9;});}return null;};}function removeEntity(_0x85a5a1,_0x464093){return function(_0xd83da2){if(_0xd83da2){return _0xd83da2['destroy']()['then'](function(){_0x85a5a1[_0x5434('0x1b')](0xcc)[_0x5434('0x1a')]();});}};}function handleEntityNotFound(_0x27ea93,_0x417dc1){return function(_0x2c8fb1){if(!_0x2c8fb1){_0x27ea93[_0x5434('0x19')](0x194);}return _0x2c8fb1;};}function handleError(_0xaa9184,_0xa0f1b2){_0xa0f1b2=_0xa0f1b2||0x1f4;return function(_0x1b827f){logger[_0x5434('0x26')](_0x1b827f[_0x5434('0x27')]);if(_0x1b827f[_0x5434('0x28')]){delete _0x1b827f['name'];}_0xaa9184['status'](_0xa0f1b2)['send'](_0x1b827f);};}exports[_0x5434('0x29')]=function(_0x124371,_0x4189f9){var _0x1330ff={'raw':!![],'where':{'id':_0x124371['params']['id']}},_0x4598bd={};_0x4598bd[_0x5434('0x2a')]=_[_0x5434('0x2b')](db['ChatApplication'][_0x5434('0x2c')]);_0x4598bd[_0x5434('0x2d')]=_['keys'](_0x124371['query']);_0x4598bd['filters']=_[_0x5434('0x2e')](_0x4598bd[_0x5434('0x2a')],_0x4598bd[_0x5434('0x2d')]);_0x1330ff[_0x5434('0x2f')]=_[_0x5434('0x2e')](_0x4598bd[_0x5434('0x2a')],qs['fields'](_0x124371[_0x5434('0x2d')][_0x5434('0x30')]));_0x1330ff[_0x5434('0x2f')]=_0x1330ff[_0x5434('0x2f')][_0x5434('0x31')]?_0x1330ff[_0x5434('0x2f')]:_0x4598bd[_0x5434('0x2a')];if(_0x124371['query'][_0x5434('0x32')]){_0x1330ff[_0x5434('0x33')]=[{'all':!![]}];}_0x1330ff=_[_0x5434('0x34')]({},_0x1330ff,_0x124371[_0x5434('0x35')]);return db[_0x5434('0x36')][_0x5434('0x37')](_0x1330ff)['then'](handleEntityNotFound(_0x4189f9,null))[_0x5434('0x38')](respondWithResult(_0x4189f9,null))[_0x5434('0x39')](handleError(_0x4189f9,null));};exports[_0x5434('0x25')]=function(_0x168db5,_0x24f907){if(_0x168db5[_0x5434('0x3a')]['id']){delete _0x168db5[_0x5434('0x3a')]['id'];}return db[_0x5434('0x36')][_0x5434('0x37')]({'where':{'id':_0x168db5[_0x5434('0x3b')]['id']}})['then'](handleEntityNotFound(_0x24f907,null))[_0x5434('0x38')](saveUpdates(_0x168db5[_0x5434('0x3a')],null))[_0x5434('0x38')](respondWithResult(_0x24f907,null))[_0x5434('0x39')](handleError(_0x24f907,null));};exports['destroy']=function(_0x243163,_0x1fe399){return db['ChatApplication']['find']({'where':{'id':_0x243163[_0x5434('0x3b')]['id']}})[_0x5434('0x38')](handleEntityNotFound(_0x1fe399,null))['then'](removeEntity(_0x1fe399,null))[_0x5434('0x39')](handleError(_0x1fe399,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index ccf83bc..5f4ab86 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 _0xa57a=['../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0xa57a,0x173));var _0xaa57=function(_0x4f094e,_0x499498){_0x4f094e=_0x4f094e-0x0;var _0x30885b=_0xa57a[_0x4f094e];return _0x30885b;};'use strict';var _=require('lodash');var util=require(_0xaa57('0x0'));var logger=require(_0xaa57('0x1'))(_0xaa57('0x2'));var moment=require(_0xaa57('0x3'));var BPromise=require(_0xaa57('0x4'));var rp=require(_0xaa57('0x5'));var fs=require('fs');var path=require(_0xaa57('0x6'));var rimraf=require('rimraf');var config=require(_0xaa57('0x7'));var attributes=require(_0xaa57('0x8'));module[_0xaa57('0x9')]=function(_0xdfabc8,_0x69441d){return _0xdfabc8[_0xaa57('0xa')](_0xaa57('0xb'),attributes,{'tableName':_0xaa57('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xaa57('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x474d=['./chatApplication.attributes','exports','define','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','rimraf','../../config/environment'];(function(_0x3be0c4,_0x5b7eff){var _0x11af9f=function(_0x3f5113){while(--_0x3f5113){_0x3be0c4['push'](_0x3be0c4['shift']());}};_0x11af9f(++_0x5b7eff);}(_0x474d,0x13a));var _0xd474=function(_0x2022fa,_0x2aaa1c){_0x2022fa=_0x2022fa-0x0;var _0x101332=_0x474d[_0x2022fa];return _0x101332;};'use strict';var _=require(_0xd474('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd474('0x1'));var moment=require(_0xd474('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd474('0x3'));var config=require(_0xd474('0x4'));var attributes=require(_0xd474('0x5'));module[_0xd474('0x6')]=function(_0x4b813f,_0xb9e022){return _0x4b813f[_0xd474('0x7')]('ChatApplication',attributes,{'tableName':_0xd474('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd474('0x9'),'collate':_0xd474('0xa')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 096333e..94960de 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 _0x781a=['request\x20sent','stringify','error','message','result','catch','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s'];(function(_0xd5f814,_0x1da457){var _0x119b7c=function(_0x2a8f31){while(--_0x2a8f31){_0xd5f814['push'](_0xd5f814['shift']());}};_0x119b7c(++_0x1da457);}(_0x781a,0xd8));var _0xa781=function(_0x13c8c4,_0x27a9cf){_0x13c8c4=_0x13c8c4-0x0;var _0x40c8dd=_0x781a[_0x13c8c4];return _0x40c8dd;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xa781('0x0'));var rs=require(_0xa781('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa781('0x2'))['db'];var utils=require(_0xa781('0x3'));var logger=require(_0xa781('0x4'))(_0xa781('0x5'));var config=require(_0xa781('0x6'));var jayson=require(_0xa781('0x7'));var client=jayson[_0xa781('0x8')][_0xa781('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcd2713,_0x56fa4b,_0x1615e5){return new BPromise(function(_0x5bbec0,_0x43cdc9){return client[_0xa781('0xa')](_0xcd2713,_0x1615e5)['then'](function(_0x2632a9){logger[_0xa781('0xb')](_0xa781('0xc'),_0x56fa4b,'request\x20sent');logger[_0xa781('0xd')](_0xa781('0xe'),_0x56fa4b,_0xa781('0xf'),JSON[_0xa781('0x10')](_0x2632a9));if(_0x2632a9[_0xa781('0x11')]){if(_0x2632a9[_0xa781('0x11')]['code']===0x1f4){logger[_0xa781('0x11')](_0xa781('0xc'),_0x56fa4b,_0x2632a9['error'][_0xa781('0x12')]);return _0x43cdc9(_0x2632a9['error'][_0xa781('0x12')]);}logger[_0xa781('0x11')](_0xa781('0xc'),_0x56fa4b,_0x2632a9[_0xa781('0x11')]['message']);return _0x5bbec0(_0x2632a9['error']['message']);}else{logger[_0xa781('0xb')](_0xa781('0xc'),_0x56fa4b,_0xa781('0xf'));_0x5bbec0(_0x2632a9[_0xa781('0x13')][_0xa781('0x12')]);}})[_0xa781('0x14')](function(_0x307349){logger[_0xa781('0x11')](_0xa781('0xc'),_0x56fa4b,_0x307349);_0x43cdc9(_0x307349);});});} \ No newline at end of file +var _0x55cc=['../../config/logger','../../config/environment','http','request','info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x51e3ff,_0x8bf3e9){var _0x2c44ee=function(_0x151e7c){while(--_0x151e7c){_0x51e3ff['push'](_0x51e3ff['shift']());}};_0x2c44ee(++_0x8bf3e9);}(_0x55cc,0x188));var _0xc55c=function(_0x4cfbd8,_0x407c81){_0x4cfbd8=_0x4cfbd8-0x0;var _0x46820f=_0x55cc[_0x4cfbd8];return _0x46820f;};'use strict';var _=require(_0xc55c('0x0'));var util=require(_0xc55c('0x1'));var moment=require(_0xc55c('0x2'));var BPromise=require(_0xc55c('0x3'));var rs=require(_0xc55c('0x4'));var fs=require('fs');var Redis=require(_0xc55c('0x5'));var db=require(_0xc55c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc55c('0x7'))('rpc');var config=require(_0xc55c('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ee6e2,_0x278384,_0x2eb3c1){return new BPromise(function(_0x56302b,_0x2b8873){return client[_0xc55c('0xa')](_0x2ee6e2,_0x2eb3c1)['then'](function(_0x47a9a0){logger[_0xc55c('0xb')](_0xc55c('0xc'),_0x278384,'request\x20sent');logger[_0xc55c('0xd')](_0xc55c('0xe'),_0x278384,_0xc55c('0xf'),JSON[_0xc55c('0x10')](_0x47a9a0));if(_0x47a9a0['error']){if(_0x47a9a0[_0xc55c('0x11')][_0xc55c('0x12')]===0x1f4){logger[_0xc55c('0x11')](_0xc55c('0xc'),_0x278384,_0x47a9a0['error'][_0xc55c('0x13')]);return _0x2b8873(_0x47a9a0['error'][_0xc55c('0x13')]);}logger[_0xc55c('0x11')](_0xc55c('0xc'),_0x278384,_0x47a9a0[_0xc55c('0x11')][_0xc55c('0x13')]);return _0x56302b(_0x47a9a0['error'][_0xc55c('0x13')]);}else{logger[_0xc55c('0xb')](_0xc55c('0xc'),_0x278384,'request\x20sent');_0x56302b(_0x47a9a0['result'][_0xc55c('0x13')]);}})[_0xc55c('0x14')](function(_0x4f2076){logger[_0xc55c('0x11')](_0xc55c('0xc'),_0x278384,_0x4f2076);_0x2b8873(_0x4f2076);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index c05ca66..452b717 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 _0x73ab=['get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','./chatApplication.controller'];(function(_0x2ea853,_0x47cbac){var _0x1f9bf1=function(_0x3af8ab){while(--_0x3af8ab){_0x2ea853['push'](_0x2ea853['shift']());}};_0x1f9bf1(++_0x47cbac);}(_0x73ab,0xdb));var _0xb73a=function(_0x560448,_0x2c1082){_0x560448=_0x560448-0x0;var _0x550276=_0x73ab[_0x560448];return _0x550276;};'use strict';var multer=require(_0xb73a('0x0'));var util=require(_0xb73a('0x1'));var path=require(_0xb73a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xb73a('0x3'));var auth=require(_0xb73a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb73a('0x5'));router[_0xb73a('0x6')](_0xb73a('0x7'),auth[_0xb73a('0x8')](),controller[_0xb73a('0x9')]);router[_0xb73a('0xa')](_0xb73a('0x7'),auth[_0xb73a('0x8')](),controller[_0xb73a('0xb')]);router[_0xb73a('0xc')](_0xb73a('0x7'),auth['isAuthenticated'](),controller[_0xb73a('0xd')]);module[_0xb73a('0xe')]=router; \ No newline at end of file +var _0x0fb4=['../../components/auth/service','../../config/environment','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer','util','connect-timeout','fs-extra'];(function(_0x164af1,_0x3cf772){var _0x5d81a2=function(_0xa57547){while(--_0xa57547){_0x164af1['push'](_0x164af1['shift']());}};_0x5d81a2(++_0x3cf772);}(_0x0fb4,0x168));var _0x40fb=function(_0x4ea955,_0x1eda76){_0x4ea955=_0x4ea955-0x0;var _0x558561=_0x0fb4[_0x4ea955];return _0x558561;};'use strict';var multer=require(_0x40fb('0x0'));var util=require(_0x40fb('0x1'));var path=require('path');var timeout=require(_0x40fb('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x40fb('0x3'));var auth=require(_0x40fb('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x40fb('0x5'));var controller=require('./chatApplication.controller');router['get'](_0x40fb('0x6'),auth[_0x40fb('0x7')](),controller[_0x40fb('0x8')]);router[_0x40fb('0x9')](_0x40fb('0x6'),auth[_0x40fb('0x7')](),controller[_0x40fb('0xa')]);router[_0x40fb('0xb')](_0x40fb('0x6'),auth[_0x40fb('0x7')](),controller[_0x40fb('0xc')]);module[_0x40fb('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 bb0a051..d8a9721 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 _0xb2ea=['exports','STRING','BOOLEAN','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb2ea,0x1eb));var _0xab2e=function(_0x466e89,_0x237ae3){_0x466e89=_0x466e89-0x0;var _0x580986=_0xb2ea[_0x466e89];return _0x580986;};'use strict';var Sequelize=require(_0xab2e('0x0'));module[_0xab2e('0x1')]={'name':{'type':Sequelize[_0xab2e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xab2e('0x2')]},'write':{'type':Sequelize[_0xab2e('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x9c49=['BOOLEAN','sequelize','exports','STRING'];(function(_0x29a986,_0x78c061){var _0x52de75=function(_0x4b1f0f){while(--_0x4b1f0f){_0x29a986['push'](_0x29a986['shift']());}};_0x52de75(++_0x78c061);}(_0x9c49,0x189));var _0x99c4=function(_0x2bca99,_0x584680){_0x2bca99=_0x2bca99-0x0;var _0x385f3b=_0x9c49[_0x2bca99];return _0x385f3b;};'use strict';var Sequelize=require(_0x99c4('0x0'));module[_0x99c4('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x99c4('0x2')]},'write':{'type':Sequelize[_0x99c4('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 15ceed4..3d1fb58 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 _0x307d=['include','findAll','rows','catch','show','params','keys','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','pick','hasOwnProperty','removeMembers','addMessage','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','ChatGroup','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll'];(function(_0x3baa6a,_0x14e69d){var _0x5821b1=function(_0x155b61){while(--_0x155b61){_0x3baa6a['push'](_0x3baa6a['shift']());}};_0x5821b1(++_0x14e69d);}(_0x307d,0x19c));var _0xd307=function(_0x4d947e,_0x2e6de6){_0x4d947e=_0x4d947e-0x0;var _0x579b0c=_0x307d[_0x4d947e];return _0x579b0c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd307('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd307('0x1'));var moment=require(_0xd307('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xd307('0x3'));var util=require(_0xd307('0x4'));var path=require(_0xd307('0x5'));var sox=require(_0xd307('0x6'));var csv=require('to-csv');var ejs=require(_0xd307('0x7'));var fs=require('fs');var fs_extra=require(_0xd307('0x8'));var _=require(_0xd307('0x9'));var squel=require(_0xd307('0xa'));var crypto=require(_0xd307('0xb'));var jsforce=require(_0xd307('0xc'));var deskjs=require(_0xd307('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd307('0xe'));var Papa=require('papaparse');var Redis=require(_0xd307('0xf'));var authService=require(_0xd307('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd307('0x11'));var logger=require(_0xd307('0x12'))(_0xd307('0x13'));var utils=require(_0xd307('0x14'));var config=require(_0xd307('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd307('0x16'))['db'];config[_0xd307('0x17')]=_['defaults'](config['redis'],{'host':_0xd307('0x18'),'port':0x18eb});var socket=require(_0xd307('0x19'))(new Redis(config['redis']));require('./chatGroup.socket')[_0xd307('0x1a')](socket);function respondWithStatusCode(_0x54a70d,_0x22c073){_0x22c073=_0x22c073||0xcc;return function(_0x97d348){if(_0x97d348){return _0x54a70d[_0xd307('0x1b')](_0x22c073);}return _0x54a70d['status'](_0x22c073)[_0xd307('0x1c')]();};}function respondWithResult(_0x5ec27d,_0x28d4c7){_0x28d4c7=_0x28d4c7||0xc8;return function(_0x47514f){if(_0x47514f){return _0x5ec27d[_0xd307('0x1d')](_0x28d4c7)[_0xd307('0x1e')](_0x47514f);}};}function respondWithFilteredResult(_0xe4af07,_0x1fc6de){return function(_0x463d19){if(_0x463d19){var _0x3a6fc6=typeof _0x1fc6de['offset']===_0xd307('0x1f')&&typeof _0x1fc6de[_0xd307('0x20')]===_0xd307('0x1f');var _0x4d5f5b=_0x463d19[_0xd307('0x21')];var _0x45223e=_0x3a6fc6?0x0:_0x1fc6de[_0xd307('0x22')];var _0x5a1d6d=_0x3a6fc6?_0x463d19['count']:_0x1fc6de[_0xd307('0x22')]+_0x1fc6de[_0xd307('0x20')];var _0x5c1ecb;if(_0x5a1d6d>=_0x4d5f5b){_0x5a1d6d=_0x4d5f5b;_0x5c1ecb=0xc8;}else{_0x5c1ecb=0xce;}_0xe4af07[_0xd307('0x1d')](_0x5c1ecb);return _0xe4af07[_0xd307('0x23')](_0xd307('0x24'),_0x45223e+'-'+_0x5a1d6d+'/'+_0x4d5f5b)[_0xd307('0x1e')](_0x463d19);}return null;};}function patchUpdates(_0xb82a5a){return function(_0x545b07){try{jsonpatch[_0xd307('0x25')](_0x545b07,_0xb82a5a,!![]);}catch(_0x5695b1){return BPromise[_0xd307('0x26')](_0x5695b1);}return _0x545b07[_0xd307('0x27')]();};}function saveUpdates(_0x468f46,_0x273eb5){return function(_0x254174){if(_0x254174){return _0x254174[_0xd307('0x28')](_0x468f46)[_0xd307('0x29')](function(_0x1e4bb9){return _0x1e4bb9;});}return null;};}function removeEntity(_0x36d037,_0x46199d){return function(_0x3fa248){if(_0x3fa248){return _0x3fa248[_0xd307('0x2a')]()[_0xd307('0x29')](function(){_0x36d037['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5945f3,_0x5d261f){return function(_0xf71df1){if(!_0xf71df1){_0x5945f3['sendStatus'](0x194);}return _0xf71df1;};}function handleError(_0xa6bf89,_0x1bbab8){_0x1bbab8=_0x1bbab8||0x1f4;return function(_0xf2fa93){logger[_0xd307('0x2b')](_0xf2fa93[_0xd307('0x2c')]);if(_0xf2fa93[_0xd307('0x2d')]){delete _0xf2fa93[_0xd307('0x2d')];}_0xa6bf89['status'](_0x1bbab8)['send'](_0xf2fa93);};}exports['index']=function(_0x5c263a,_0x3b6a5b){var _0x579d04={},_0x4b9947={},_0x4f5c2e={'count':0x0,'rows':[]};var _0x5ddc3e=_[_0xd307('0x2e')](db[_0xd307('0x2f')][_0xd307('0x30')],function(_0x4d63f5){return{'name':_0x4d63f5[_0xd307('0x31')],'type':_0x4d63f5['type'][_0xd307('0x32')]};});_0x4b9947[_0xd307('0x33')]=_[_0xd307('0x2e')](_0x5ddc3e,'name');_0x4b9947[_0xd307('0x34')]=_['keys'](_0x5c263a['query']);_0x4b9947[_0xd307('0x35')]=_[_0xd307('0x36')](_0x4b9947[_0xd307('0x33')],_0x4b9947[_0xd307('0x34')]);_0x579d04[_0xd307('0x37')]=_[_0xd307('0x36')](_0x4b9947[_0xd307('0x33')],qs[_0xd307('0x38')](_0x5c263a[_0xd307('0x34')][_0xd307('0x38')]));_0x579d04[_0xd307('0x37')]=_0x579d04[_0xd307('0x37')][_0xd307('0x39')]?_0x579d04[_0xd307('0x37')]:_0x4b9947[_0xd307('0x33')];if(!_0x5c263a[_0xd307('0x34')]['hasOwnProperty'](_0xd307('0x3a'))){_0x579d04[_0xd307('0x20')]=qs[_0xd307('0x20')](_0x5c263a['query'][_0xd307('0x20')]);_0x579d04[_0xd307('0x22')]=qs[_0xd307('0x22')](_0x5c263a['query'][_0xd307('0x22')]);}_0x579d04[_0xd307('0x3b')]=qs[_0xd307('0x3c')](_0x5c263a[_0xd307('0x34')][_0xd307('0x3c')]);_0x579d04[_0xd307('0x3d')]=qs[_0xd307('0x35')](_['pick'](_0x5c263a[_0xd307('0x34')],_0x4b9947[_0xd307('0x35')]),_0x5ddc3e);if(_0x5c263a[_0xd307('0x34')]['filter']){_0x579d04['where']=_[_0xd307('0x3e')](_0x579d04['where'],{'$or':_[_0xd307('0x2e')](_0x5ddc3e,function(_0xe74308){if(_0xe74308[_0xd307('0x3f')]!==_0xd307('0x40')){var _0x53cb60={};_0x53cb60[_0xe74308['name']]={'$like':'%'+_0x5c263a[_0xd307('0x34')][_0xd307('0x41')]+'%'};return _0x53cb60;}})});}_0x579d04=_[_0xd307('0x3e')]({},_0x579d04,_0x5c263a[_0xd307('0x42')]);var _0x432004={'where':_0x579d04[_0xd307('0x3d')]};return db[_0xd307('0x2f')][_0xd307('0x21')](_0x432004)[_0xd307('0x29')](function(_0xabbbf8){_0x4f5c2e[_0xd307('0x21')]=_0xabbbf8;if(_0x5c263a[_0xd307('0x34')][_0xd307('0x43')]){_0x579d04[_0xd307('0x44')]=[{'all':!![]}];}return db[_0xd307('0x2f')][_0xd307('0x45')](_0x579d04);})[_0xd307('0x29')](function(_0x434611){_0x4f5c2e[_0xd307('0x46')]=_0x434611;return _0x4f5c2e;})[_0xd307('0x29')](respondWithFilteredResult(_0x3b6a5b,_0x579d04))[_0xd307('0x47')](handleError(_0x3b6a5b,null));};exports[_0xd307('0x48')]=function(_0x31557a,_0x5e298e){var _0x203ac5={'raw':!![],'where':{'id':_0x31557a[_0xd307('0x49')]['id']}},_0x33cfb5={};_0x33cfb5[_0xd307('0x33')]=_[_0xd307('0x4a')](db['ChatGroup'][_0xd307('0x30')]);_0x33cfb5[_0xd307('0x34')]=_['keys'](_0x31557a[_0xd307('0x34')]);_0x33cfb5[_0xd307('0x35')]=_[_0xd307('0x36')](_0x33cfb5[_0xd307('0x33')],_0x33cfb5[_0xd307('0x34')]);_0x203ac5['attributes']=_[_0xd307('0x36')](_0x33cfb5['model'],qs[_0xd307('0x38')](_0x31557a[_0xd307('0x34')][_0xd307('0x38')]));_0x203ac5['attributes']=_0x203ac5[_0xd307('0x37')][_0xd307('0x39')]?_0x203ac5[_0xd307('0x37')]:_0x33cfb5[_0xd307('0x33')];if(_0x31557a[_0xd307('0x34')][_0xd307('0x43')]){_0x203ac5[_0xd307('0x44')]=[{'all':!![]}];}_0x203ac5=_[_0xd307('0x3e')]({},_0x203ac5,_0x31557a[_0xd307('0x42')]);return db[_0xd307('0x2f')][_0xd307('0x4b')](_0x203ac5)[_0xd307('0x29')](handleEntityNotFound(_0x5e298e,null))[_0xd307('0x29')](respondWithResult(_0x5e298e,null))[_0xd307('0x47')](handleError(_0x5e298e,null));};exports[_0xd307('0x4c')]=function(_0x452eef,_0x177f85){return db[_0xd307('0x2f')][_0xd307('0x4c')](_0x452eef[_0xd307('0x4d')],{})['then'](respondWithResult(_0x177f85,0xc9))['catch'](handleError(_0x177f85,null));};exports[_0xd307('0x28')]=function(_0x1f8133,_0x27e61b){if(_0x1f8133[_0xd307('0x4d')]['id']){delete _0x1f8133[_0xd307('0x4d')]['id'];}return db[_0xd307('0x2f')][_0xd307('0x4b')]({'where':{'id':_0x1f8133[_0xd307('0x49')]['id']}})['then'](handleEntityNotFound(_0x27e61b,null))[_0xd307('0x29')](saveUpdates(_0x1f8133[_0xd307('0x4d')],null))[_0xd307('0x29')](respondWithResult(_0x27e61b,null))[_0xd307('0x47')](handleError(_0x27e61b,null));};exports[_0xd307('0x2a')]=function(_0x319a13,_0x1f742d){return db[_0xd307('0x2f')][_0xd307('0x4b')]({'where':{'id':_0x319a13[_0xd307('0x49')]['id']}})[_0xd307('0x29')](handleEntityNotFound(_0x1f742d,null))['then'](removeEntity(_0x1f742d,null))[_0xd307('0x47')](handleError(_0x1f742d,null));};exports[_0xd307('0x4e')]=function(_0x46c557,_0x3b6c5e){return db['ChatGroup'][_0xd307('0x4e')]()[_0xd307('0x29')](respondWithResult(_0x3b6c5e,null))[_0xd307('0x47')](handleError(_0x3b6c5e,null));};exports[_0xd307('0x4f')]=function(_0x55cc05,_0x9b5dab,_0x38a359){return db[_0xd307('0x50')][_0xd307('0x21')]({'where':{'ChatGroupId':_0x55cc05['params']['id'],'ToId':_0x55cc05[_0xd307('0x51')]['id'],'read':![]}})[_0xd307('0x29')](function(_0x52d9a6){return{'id':_[_0xd307('0x52')](_0x55cc05['params']['id']),'count':_0x52d9a6};})[_0xd307('0x29')](respondWithResult(_0x9b5dab,null))[_0xd307('0x47')](handleError(_0x9b5dab,null));};exports[_0xd307('0x53')]=function(_0x250d73,_0xe17cae,_0x43c4aa){return db['ChatGroup']['find']({'where':{'id':_0x250d73['params']['id']}})['then'](handleEntityNotFound(_0xe17cae,null))[_0xd307('0x29')](function(_0x4418e1){if(_0x4418e1){return _0x4418e1[_0xd307('0x53')](_0x250d73[_0xd307('0x4d')][_0xd307('0x54')],_[_0xd307('0x55')](_0x250d73[_0xd307('0x4d')],[_0xd307('0x54'),'id'])||{});}})[_0xd307('0x29')](respondWithResult(_0xe17cae,null))[_0xd307('0x47')](handleError(_0xe17cae,null));};exports[_0xd307('0x56')]=function(_0x341514,_0x20722f,_0x5a7804){var _0x17af66={};var _0x9415d3={};var _0x52b4ab;var _0x2ab408;return db[_0xd307('0x2f')][_0xd307('0x57')]({'where':{'id':_0x341514['params']['id']}})['then'](handleEntityNotFound(_0x20722f,null))['then'](function(_0x368e51){if(_0x368e51){_0x52b4ab=_0x368e51;_0x9415d3[_0xd307('0x33')]=_['keys'](db[_0xd307('0x58')][_0xd307('0x30')]);_0x9415d3['query']=_[_0xd307('0x4a')](_0x341514[_0xd307('0x34')]);_0x9415d3[_0xd307('0x35')]=_[_0xd307('0x36')](_0x9415d3[_0xd307('0x33')],_0x9415d3[_0xd307('0x34')]);_0x17af66[_0xd307('0x37')]=_[_0xd307('0x36')](_0x9415d3['model'],qs[_0xd307('0x38')](_0x341514[_0xd307('0x34')][_0xd307('0x38')]));_0x17af66['attributes']=_0x17af66[_0xd307('0x37')][_0xd307('0x39')]?_0x17af66['attributes']:_0x9415d3[_0xd307('0x33')];_0x17af66[_0xd307('0x3b')]=qs[_0xd307('0x3c')](_0x341514[_0xd307('0x34')]['sort']);_0x17af66[_0xd307('0x3d')]=qs[_0xd307('0x35')](_[_0xd307('0x59')](_0x341514[_0xd307('0x34')],_0x9415d3['filters']));if(_0x341514[_0xd307('0x34')][_0xd307('0x41')]){_0x17af66[_0xd307('0x3d')]=_['merge'](_0x17af66['where'],{'$or':_[_0xd307('0x2e')](_0x17af66[_0xd307('0x37')],function(_0x5fbebc){var _0xb381bc={};_0xb381bc[_0x5fbebc]={'$like':'%'+_0x341514[_0xd307('0x34')]['filter']+'%'};return _0xb381bc;})});}_0x17af66=_[_0xd307('0x3e')]({},_0x17af66,_0x341514[_0xd307('0x42')]);return _0x52b4ab[_0xd307('0x56')](_0x17af66);}})[_0xd307('0x29')](function(_0x27c3da){if(_0x27c3da){_0x2ab408=_0x27c3da[_0xd307('0x39')];if(!_0x341514['query'][_0xd307('0x5a')]('nolimit')){_0x17af66[_0xd307('0x20')]=qs[_0xd307('0x20')](_0x341514[_0xd307('0x34')]['limit']);_0x17af66['offset']=qs[_0xd307('0x22')](_0x341514[_0xd307('0x34')][_0xd307('0x22')]);}return _0x52b4ab['getMembers'](_0x17af66);}})['then'](function(_0x4e0b9a){if(_0x4e0b9a){return _0x4e0b9a?{'count':_0x2ab408,'rows':_0x4e0b9a}:null;}})[_0xd307('0x29')](respondWithResult(_0x20722f,null))['catch'](handleError(_0x20722f,null));};exports[_0xd307('0x5b')]=function(_0x2712be,_0x2eb614,_0xf08e25){return db[_0xd307('0x2f')][_0xd307('0x4b')]({'where':{'id':_0x2712be['params']['id']}})['then'](handleEntityNotFound(_0x2eb614,null))[_0xd307('0x29')](function(_0x117cfe){if(_0x117cfe){return _0x117cfe[_0xd307('0x5b')](_0x2712be[_0xd307('0x34')][_0xd307('0x54')]);}})['then'](respondWithStatusCode(_0x2eb614,null))[_0xd307('0x47')](handleError(_0x2eb614,null));};exports[_0xd307('0x5c')]=function(_0x693945,_0x1ce9ac,_0x2893b3){if(_0x693945[_0xd307('0x4d')]['id']){delete _0x693945['body']['id'];}return db[_0xd307('0x2f')]['find']({'where':{'id':_0x693945[_0xd307('0x49')]['id']}})['then'](handleEntityNotFound(_0x1ce9ac,null))[_0xd307('0x29')](function(_0x3b809e){if(_0x3b809e){_0x693945[_0xd307('0x4d')]['ChatGroupId']=_0x3b809e['id'];return db[_0xd307('0x50')][_0xd307('0x4c')](_0x693945['body']);}})['then'](respondWithResult(_0x1ce9ac,null))[_0xd307('0x47')](handleError(_0x1ce9ac,null));};exports[_0xd307('0x5d')]=function(_0x58a92a,_0x1bd0a9,_0x5dd83a){var _0x21511c={};var _0x25af23={};var _0x50b052;var _0x4d1598;return db[_0xd307('0x2f')][_0xd307('0x57')]({'where':{'id':_0x58a92a[_0xd307('0x49')]['id']}})[_0xd307('0x29')](handleEntityNotFound(_0x1bd0a9,null))[_0xd307('0x29')](function(_0x1e95d8){if(_0x1e95d8){_0x50b052=_0x1e95d8;_0x25af23[_0xd307('0x33')]=_['keys'](db[_0xd307('0x50')][_0xd307('0x30')]);_0x25af23[_0xd307('0x34')]=_[_0xd307('0x4a')](_0x58a92a['query']);_0x25af23[_0xd307('0x35')]=_[_0xd307('0x36')](_0x25af23[_0xd307('0x33')],_0x25af23[_0xd307('0x34')]);_0x21511c[_0xd307('0x37')]=_['intersection'](_0x25af23['model'],qs[_0xd307('0x38')](_0x58a92a[_0xd307('0x34')][_0xd307('0x38')]));_0x21511c['attributes']=_0x21511c[_0xd307('0x37')][_0xd307('0x39')]?_0x21511c[_0xd307('0x37')]:_0x25af23[_0xd307('0x33')];_0x21511c[_0xd307('0x3b')]=qs[_0xd307('0x3c')](_0x58a92a[_0xd307('0x34')][_0xd307('0x3c')]);_0x21511c[_0xd307('0x3d')]=qs[_0xd307('0x35')](_[_0xd307('0x59')](_0x58a92a[_0xd307('0x34')],_0x25af23[_0xd307('0x35')]));if(_0x58a92a['query'][_0xd307('0x41')]){_0x21511c[_0xd307('0x3d')]=_['merge'](_0x21511c[_0xd307('0x3d')],{'$or':_[_0xd307('0x2e')](_0x21511c[_0xd307('0x37')],function(_0x43d73e){var _0x1e6485={};_0x1e6485[_0x43d73e]={'$like':'%'+_0x58a92a[_0xd307('0x34')]['filter']+'%'};return _0x1e6485;})});}if(_0x58a92a[_0xd307('0x34')]['$gte']){var _0x23d987=_0x58a92a['query'][_0xd307('0x5e')]['split'](',');var _0x26bd82={};_0x26bd82[_0x23d987[0x0]]={'$gte':moment(_0x23d987[0x1])['format'](_0xd307('0x5f'))};_0x21511c['where']=_[_0xd307('0x3e')](_0x21511c[_0xd307('0x3d')],_0x26bd82);}_0x21511c=_[_0xd307('0x3e')]({},_0x21511c,_0x58a92a['options']);return _0x50b052[_0xd307('0x5d')](_0x21511c);}})[_0xd307('0x29')](function(_0x172a0c){if(_0x172a0c){_0x4d1598=_0x172a0c['length'];if(!_0x58a92a[_0xd307('0x34')]['hasOwnProperty']('nolimit')){_0x21511c['limit']=qs[_0xd307('0x20')](_0x58a92a['query'][_0xd307('0x20')]);_0x21511c['offset']=qs[_0xd307('0x22')](_0x58a92a[_0xd307('0x34')][_0xd307('0x22')]);}return _0x50b052[_0xd307('0x5d')](_0x21511c);}})[_0xd307('0x29')](function(_0x5ae4a3){if(_0x5ae4a3){return _0x5ae4a3?{'count':_0x4d1598,'rows':_0x5ae4a3}:null;}})[_0xd307('0x29')](respondWithResult(_0x1bd0a9,null))[_0xd307('0x47')](handleError(_0x1bd0a9,null));}; \ No newline at end of file +var _0x9174=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','error','stack','name','send','ChatGroup','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','update','body','describe','ChatInternalMessage','user','addMembers','omit','ids','getMembers','findOne','User','pick','removeMembers','addMessage','ChatGroupId','create','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','fs-extra','squel','crypto','querystring','papaparse','ioredis'];(function(_0x48112e,_0x261e02){var _0x4789ed=function(_0x316ea7){while(--_0x316ea7){_0x48112e['push'](_0x48112e['shift']());}};_0x4789ed(++_0x261e02);}(_0x9174,0x165));var _0x4917=function(_0x34928e,_0xd44165){_0x34928e=_0x34928e-0x0;var _0x5b99ca=_0x9174[_0x34928e];return _0x5b99ca;};'use strict';var emlformat=require(_0x4917('0x0'));var rimraf=require(_0x4917('0x1'));var zipdir=require(_0x4917('0x2'));var jsonpatch=require(_0x4917('0x3'));var rp=require(_0x4917('0x4'));var moment=require(_0x4917('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4917('0x6'));var util=require('util');var path=require(_0x4917('0x7'));var sox=require('sox');var csv=require(_0x4917('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4917('0x9'));var _=require('lodash');var squel=require(_0x4917('0xa'));var crypto=require(_0x4917('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4917('0xc'));var Papa=require(_0x4917('0xd'));var Redis=require(_0x4917('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4917('0xf'));var hardwareService=require(_0x4917('0x10'));var logger=require(_0x4917('0x11'))(_0x4917('0x12'));var utils=require(_0x4917('0x13'));var config=require(_0x4917('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x4917('0x15')]=_[_0x4917('0x16')](config[_0x4917('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x4917('0x17'))(new Redis(config[_0x4917('0x15')]));require(_0x4917('0x18'))[_0x4917('0x19')](socket);function respondWithStatusCode(_0x3c1491,_0x1bec8e){_0x1bec8e=_0x1bec8e||0xcc;return function(_0x355aba){if(_0x355aba){return _0x3c1491[_0x4917('0x1a')](_0x1bec8e);}return _0x3c1491[_0x4917('0x1b')](_0x1bec8e)[_0x4917('0x1c')]();};}function respondWithResult(_0x4ba676,_0x2c430a){_0x2c430a=_0x2c430a||0xc8;return function(_0xe7a848){if(_0xe7a848){return _0x4ba676['status'](_0x2c430a)['json'](_0xe7a848);}};}function respondWithFilteredResult(_0x351999,_0x1ca3bf){return function(_0x43d66b){if(_0x43d66b){var _0xbd3ef4=typeof _0x1ca3bf[_0x4917('0x1d')]===_0x4917('0x1e')&&typeof _0x1ca3bf[_0x4917('0x1f')]===_0x4917('0x1e');var _0xbee921=_0x43d66b[_0x4917('0x20')];var _0x3bbb59=_0xbd3ef4?0x0:_0x1ca3bf['offset'];var _0x348ceb=_0xbd3ef4?_0x43d66b[_0x4917('0x20')]:_0x1ca3bf['offset']+_0x1ca3bf[_0x4917('0x1f')];var _0x12ec42;if(_0x348ceb>=_0xbee921){_0x348ceb=_0xbee921;_0x12ec42=0xc8;}else{_0x12ec42=0xce;}_0x351999[_0x4917('0x1b')](_0x12ec42);return _0x351999[_0x4917('0x21')](_0x4917('0x22'),_0x3bbb59+'-'+_0x348ceb+'/'+_0xbee921)[_0x4917('0x23')](_0x43d66b);}return null;};}function patchUpdates(_0x2c613b){return function(_0x5f4946){try{jsonpatch[_0x4917('0x24')](_0x5f4946,_0x2c613b,!![]);}catch(_0x3d1332){return BPromise[_0x4917('0x25')](_0x3d1332);}return _0x5f4946[_0x4917('0x26')]();};}function saveUpdates(_0x22f0a7,_0x2aebc4){return function(_0x19f476){if(_0x19f476){return _0x19f476['update'](_0x22f0a7)[_0x4917('0x27')](function(_0x5ec7c3){return _0x5ec7c3;});}return null;};}function removeEntity(_0x34d5f5,_0x43bc0d){return function(_0x5d7394){if(_0x5d7394){return _0x5d7394['destroy']()[_0x4917('0x27')](function(){_0x34d5f5[_0x4917('0x1b')](0xcc)[_0x4917('0x1c')]();});}};}function handleEntityNotFound(_0x4daa41,_0x2fa8c9){return function(_0x1b31c2){if(!_0x1b31c2){_0x4daa41[_0x4917('0x1a')](0x194);}return _0x1b31c2;};}function handleError(_0x766c49,_0x794b3e){_0x794b3e=_0x794b3e||0x1f4;return function(_0x1a33ac){logger[_0x4917('0x28')](_0x1a33ac[_0x4917('0x29')]);if(_0x1a33ac[_0x4917('0x2a')]){delete _0x1a33ac[_0x4917('0x2a')];}_0x766c49[_0x4917('0x1b')](_0x794b3e)[_0x4917('0x2b')](_0x1a33ac);};}exports['index']=function(_0x25b710,_0x12774f){var _0x24b3c9={},_0x5d0b49={},_0x4a9e7f={'count':0x0,'rows':[]};var _0x5b2741=_['map'](db[_0x4917('0x2c')]['rawAttributes'],function(_0x215cd1){return{'name':_0x215cd1[_0x4917('0x2d')],'type':_0x215cd1[_0x4917('0x2e')][_0x4917('0x2f')]};});_0x5d0b49[_0x4917('0x30')]=_[_0x4917('0x31')](_0x5b2741,_0x4917('0x2a'));_0x5d0b49[_0x4917('0x32')]=_['keys'](_0x25b710['query']);_0x5d0b49[_0x4917('0x33')]=_[_0x4917('0x34')](_0x5d0b49[_0x4917('0x30')],_0x5d0b49[_0x4917('0x32')]);_0x24b3c9[_0x4917('0x35')]=_['intersection'](_0x5d0b49['model'],qs[_0x4917('0x36')](_0x25b710['query'][_0x4917('0x36')]));_0x24b3c9[_0x4917('0x35')]=_0x24b3c9[_0x4917('0x35')][_0x4917('0x37')]?_0x24b3c9[_0x4917('0x35')]:_0x5d0b49[_0x4917('0x30')];if(!_0x25b710[_0x4917('0x32')][_0x4917('0x38')]('nolimit')){_0x24b3c9['limit']=qs[_0x4917('0x1f')](_0x25b710[_0x4917('0x32')][_0x4917('0x1f')]);_0x24b3c9[_0x4917('0x1d')]=qs[_0x4917('0x1d')](_0x25b710[_0x4917('0x32')]['offset']);}_0x24b3c9[_0x4917('0x39')]=qs['sort'](_0x25b710[_0x4917('0x32')][_0x4917('0x3a')]);_0x24b3c9[_0x4917('0x3b')]=qs[_0x4917('0x33')](_['pick'](_0x25b710['query'],_0x5d0b49[_0x4917('0x33')]),_0x5b2741);if(_0x25b710[_0x4917('0x32')][_0x4917('0x3c')]){_0x24b3c9[_0x4917('0x3b')]=_[_0x4917('0x3d')](_0x24b3c9['where'],{'$or':_['map'](_0x5b2741,function(_0x4c96c0){if(_0x4c96c0[_0x4917('0x2e')]!=='VIRTUAL'){var _0x4c0b6d={};_0x4c0b6d[_0x4c96c0['name']]={'$like':'%'+_0x25b710[_0x4917('0x32')][_0x4917('0x3c')]+'%'};return _0x4c0b6d;}})});}_0x24b3c9=_[_0x4917('0x3d')]({},_0x24b3c9,_0x25b710[_0x4917('0x3e')]);var _0x4a5b57={'where':_0x24b3c9[_0x4917('0x3b')]};return db['ChatGroup'][_0x4917('0x20')](_0x4a5b57)['then'](function(_0x1d4902){_0x4a9e7f[_0x4917('0x20')]=_0x1d4902;if(_0x25b710[_0x4917('0x32')][_0x4917('0x3f')]){_0x24b3c9[_0x4917('0x40')]=[{'all':!![]}];}return db['ChatGroup'][_0x4917('0x41')](_0x24b3c9);})[_0x4917('0x27')](function(_0x1a2bb9){_0x4a9e7f[_0x4917('0x42')]=_0x1a2bb9;return _0x4a9e7f;})[_0x4917('0x27')](respondWithFilteredResult(_0x12774f,_0x24b3c9))[_0x4917('0x43')](handleError(_0x12774f,null));};exports[_0x4917('0x44')]=function(_0x54b80a,_0x42d0c0){var _0x259207={'raw':!![],'where':{'id':_0x54b80a[_0x4917('0x45')]['id']}},_0x56c047={};_0x56c047['model']=_[_0x4917('0x46')](db[_0x4917('0x2c')][_0x4917('0x47')]);_0x56c047[_0x4917('0x32')]=_['keys'](_0x54b80a['query']);_0x56c047[_0x4917('0x33')]=_['intersection'](_0x56c047[_0x4917('0x30')],_0x56c047['query']);_0x259207['attributes']=_[_0x4917('0x34')](_0x56c047[_0x4917('0x30')],qs[_0x4917('0x36')](_0x54b80a[_0x4917('0x32')][_0x4917('0x36')]));_0x259207[_0x4917('0x35')]=_0x259207['attributes'][_0x4917('0x37')]?_0x259207[_0x4917('0x35')]:_0x56c047[_0x4917('0x30')];if(_0x54b80a[_0x4917('0x32')][_0x4917('0x3f')]){_0x259207[_0x4917('0x40')]=[{'all':!![]}];}_0x259207=_[_0x4917('0x3d')]({},_0x259207,_0x54b80a['options']);return db[_0x4917('0x2c')][_0x4917('0x48')](_0x259207)[_0x4917('0x27')](handleEntityNotFound(_0x42d0c0,null))[_0x4917('0x27')](respondWithResult(_0x42d0c0,null))[_0x4917('0x43')](handleError(_0x42d0c0,null));};exports['create']=function(_0x19711f,_0x4c0012){return db['ChatGroup']['create'](_0x19711f['body'],{})[_0x4917('0x27')](respondWithResult(_0x4c0012,0xc9))['catch'](handleError(_0x4c0012,null));};exports[_0x4917('0x49')]=function(_0x51e992,_0x35861b){if(_0x51e992[_0x4917('0x4a')]['id']){delete _0x51e992['body']['id'];}return db[_0x4917('0x2c')][_0x4917('0x48')]({'where':{'id':_0x51e992['params']['id']}})['then'](handleEntityNotFound(_0x35861b,null))[_0x4917('0x27')](saveUpdates(_0x51e992['body'],null))[_0x4917('0x27')](respondWithResult(_0x35861b,null))[_0x4917('0x43')](handleError(_0x35861b,null));};exports['destroy']=function(_0x25c7b9,_0x408772){return db[_0x4917('0x2c')][_0x4917('0x48')]({'where':{'id':_0x25c7b9['params']['id']}})[_0x4917('0x27')](handleEntityNotFound(_0x408772,null))[_0x4917('0x27')](removeEntity(_0x408772,null))[_0x4917('0x43')](handleError(_0x408772,null));};exports[_0x4917('0x4b')]=function(_0x3d374e,_0x1a6f17){return db[_0x4917('0x2c')][_0x4917('0x4b')]()[_0x4917('0x27')](respondWithResult(_0x1a6f17,null))[_0x4917('0x43')](handleError(_0x1a6f17,null));};exports['getUnread']=function(_0x230225,_0x5ae4cc,_0x271106){return db[_0x4917('0x4c')][_0x4917('0x20')]({'where':{'ChatGroupId':_0x230225[_0x4917('0x45')]['id'],'ToId':_0x230225[_0x4917('0x4d')]['id'],'read':![]}})['then'](function(_0x554729){return{'id':_['toInteger'](_0x230225['params']['id']),'count':_0x554729};})['then'](respondWithResult(_0x5ae4cc,null))['catch'](handleError(_0x5ae4cc,null));};exports[_0x4917('0x4e')]=function(_0xa244b1,_0x49b13c,_0x4dc24f){return db[_0x4917('0x2c')][_0x4917('0x48')]({'where':{'id':_0xa244b1[_0x4917('0x45')]['id']}})[_0x4917('0x27')](handleEntityNotFound(_0x49b13c,null))[_0x4917('0x27')](function(_0x42a39d){if(_0x42a39d){return _0x42a39d[_0x4917('0x4e')](_0xa244b1[_0x4917('0x4a')]['ids'],_[_0x4917('0x4f')](_0xa244b1[_0x4917('0x4a')],[_0x4917('0x50'),'id'])||{});}})[_0x4917('0x27')](respondWithResult(_0x49b13c,null))['catch'](handleError(_0x49b13c,null));};exports[_0x4917('0x51')]=function(_0x47a6b7,_0x525de6,_0x5a1c2f){var _0x584c2c={};var _0x12456e={};var _0x35d4f7;var _0xf2e2c7;return db[_0x4917('0x2c')][_0x4917('0x52')]({'where':{'id':_0x47a6b7[_0x4917('0x45')]['id']}})[_0x4917('0x27')](handleEntityNotFound(_0x525de6,null))['then'](function(_0xff26ca){if(_0xff26ca){_0x35d4f7=_0xff26ca;_0x12456e[_0x4917('0x30')]=_[_0x4917('0x46')](db[_0x4917('0x53')]['rawAttributes']);_0x12456e[_0x4917('0x32')]=_[_0x4917('0x46')](_0x47a6b7[_0x4917('0x32')]);_0x12456e[_0x4917('0x33')]=_[_0x4917('0x34')](_0x12456e[_0x4917('0x30')],_0x12456e['query']);_0x584c2c[_0x4917('0x35')]=_[_0x4917('0x34')](_0x12456e[_0x4917('0x30')],qs[_0x4917('0x36')](_0x47a6b7[_0x4917('0x32')]['fields']));_0x584c2c['attributes']=_0x584c2c[_0x4917('0x35')]['length']?_0x584c2c[_0x4917('0x35')]:_0x12456e[_0x4917('0x30')];_0x584c2c['order']=qs['sort'](_0x47a6b7[_0x4917('0x32')]['sort']);_0x584c2c['where']=qs[_0x4917('0x33')](_[_0x4917('0x54')](_0x47a6b7['query'],_0x12456e['filters']));if(_0x47a6b7[_0x4917('0x32')][_0x4917('0x3c')]){_0x584c2c[_0x4917('0x3b')]=_['merge'](_0x584c2c[_0x4917('0x3b')],{'$or':_['map'](_0x584c2c['attributes'],function(_0x3219f4){var _0xd91f35={};_0xd91f35[_0x3219f4]={'$like':'%'+_0x47a6b7['query']['filter']+'%'};return _0xd91f35;})});}_0x584c2c=_['merge']({},_0x584c2c,_0x47a6b7['options']);return _0x35d4f7[_0x4917('0x51')](_0x584c2c);}})['then'](function(_0x3e0e74){if(_0x3e0e74){_0xf2e2c7=_0x3e0e74[_0x4917('0x37')];if(!_0x47a6b7['query'][_0x4917('0x38')]('nolimit')){_0x584c2c[_0x4917('0x1f')]=qs[_0x4917('0x1f')](_0x47a6b7['query'][_0x4917('0x1f')]);_0x584c2c[_0x4917('0x1d')]=qs['offset'](_0x47a6b7[_0x4917('0x32')][_0x4917('0x1d')]);}return _0x35d4f7[_0x4917('0x51')](_0x584c2c);}})[_0x4917('0x27')](function(_0x32d7c4){if(_0x32d7c4){return _0x32d7c4?{'count':_0xf2e2c7,'rows':_0x32d7c4}:null;}})[_0x4917('0x27')](respondWithResult(_0x525de6,null))[_0x4917('0x43')](handleError(_0x525de6,null));};exports[_0x4917('0x55')]=function(_0x4b972f,_0x2a92ae,_0x43f412){return db[_0x4917('0x2c')][_0x4917('0x48')]({'where':{'id':_0x4b972f[_0x4917('0x45')]['id']}})['then'](handleEntityNotFound(_0x2a92ae,null))[_0x4917('0x27')](function(_0x36b4b4){if(_0x36b4b4){return _0x36b4b4[_0x4917('0x55')](_0x4b972f[_0x4917('0x32')][_0x4917('0x50')]);}})[_0x4917('0x27')](respondWithStatusCode(_0x2a92ae,null))[_0x4917('0x43')](handleError(_0x2a92ae,null));};exports[_0x4917('0x56')]=function(_0x18cf44,_0x2d20af,_0x329546){if(_0x18cf44[_0x4917('0x4a')]['id']){delete _0x18cf44[_0x4917('0x4a')]['id'];}return db['ChatGroup'][_0x4917('0x48')]({'where':{'id':_0x18cf44[_0x4917('0x45')]['id']}})[_0x4917('0x27')](handleEntityNotFound(_0x2d20af,null))[_0x4917('0x27')](function(_0x4b9f94){if(_0x4b9f94){_0x18cf44[_0x4917('0x4a')][_0x4917('0x57')]=_0x4b9f94['id'];return db['ChatInternalMessage'][_0x4917('0x58')](_0x18cf44[_0x4917('0x4a')]);}})[_0x4917('0x27')](respondWithResult(_0x2d20af,null))[_0x4917('0x43')](handleError(_0x2d20af,null));};exports[_0x4917('0x59')]=function(_0x4f36a5,_0x155b41,_0x4eaf1b){var _0x156575={};var _0x5d2729={};var _0x47ce18;var _0x17d39b;return db[_0x4917('0x2c')][_0x4917('0x52')]({'where':{'id':_0x4f36a5[_0x4917('0x45')]['id']}})[_0x4917('0x27')](handleEntityNotFound(_0x155b41,null))['then'](function(_0x324b74){if(_0x324b74){_0x47ce18=_0x324b74;_0x5d2729[_0x4917('0x30')]=_[_0x4917('0x46')](db[_0x4917('0x4c')][_0x4917('0x47')]);_0x5d2729[_0x4917('0x32')]=_['keys'](_0x4f36a5[_0x4917('0x32')]);_0x5d2729[_0x4917('0x33')]=_[_0x4917('0x34')](_0x5d2729['model'],_0x5d2729['query']);_0x156575[_0x4917('0x35')]=_[_0x4917('0x34')](_0x5d2729[_0x4917('0x30')],qs[_0x4917('0x36')](_0x4f36a5[_0x4917('0x32')][_0x4917('0x36')]));_0x156575[_0x4917('0x35')]=_0x156575[_0x4917('0x35')][_0x4917('0x37')]?_0x156575[_0x4917('0x35')]:_0x5d2729['model'];_0x156575[_0x4917('0x39')]=qs[_0x4917('0x3a')](_0x4f36a5['query'][_0x4917('0x3a')]);_0x156575[_0x4917('0x3b')]=qs[_0x4917('0x33')](_[_0x4917('0x54')](_0x4f36a5['query'],_0x5d2729[_0x4917('0x33')]));if(_0x4f36a5['query'][_0x4917('0x3c')]){_0x156575['where']=_[_0x4917('0x3d')](_0x156575[_0x4917('0x3b')],{'$or':_['map'](_0x156575[_0x4917('0x35')],function(_0x529083){var _0x4150e3={};_0x4150e3[_0x529083]={'$like':'%'+_0x4f36a5['query'][_0x4917('0x3c')]+'%'};return _0x4150e3;})});}if(_0x4f36a5['query']['$gte']){var _0x5ee30a=_0x4f36a5[_0x4917('0x32')][_0x4917('0x5a')][_0x4917('0x5b')](',');var _0x5df005={};_0x5df005[_0x5ee30a[0x0]]={'$gte':moment(_0x5ee30a[0x1])['format'](_0x4917('0x5c'))};_0x156575['where']=_['merge'](_0x156575[_0x4917('0x3b')],_0x5df005);}_0x156575=_[_0x4917('0x3d')]({},_0x156575,_0x4f36a5[_0x4917('0x3e')]);return _0x47ce18[_0x4917('0x59')](_0x156575);}})[_0x4917('0x27')](function(_0x50b095){if(_0x50b095){_0x17d39b=_0x50b095['length'];if(!_0x4f36a5['query'][_0x4917('0x38')]('nolimit')){_0x156575['limit']=qs[_0x4917('0x1f')](_0x4f36a5['query'][_0x4917('0x1f')]);_0x156575[_0x4917('0x1d')]=qs[_0x4917('0x1d')](_0x4f36a5[_0x4917('0x32')][_0x4917('0x1d')]);}return _0x47ce18['getMessages'](_0x156575);}})['then'](function(_0x53b44d){if(_0x53b44d){return _0x53b44d?{'count':_0x17d39b,'rows':_0x53b44d}:null;}})[_0x4917('0x27')](respondWithResult(_0x155b41,null))[_0x4917('0x43')](handleError(_0x155b41,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 47b66a5..5d19deb 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 _0xada4=['emit','hasOwnProperty','hook','../../mysqldb','ChatGroup','setMaxListeners','save','update','remove'];(function(_0x134e09,_0x4dc91c){var _0x5165da=function(_0x3dc71c){while(--_0x3dc71c){_0x134e09['push'](_0x134e09['shift']());}};_0x5165da(++_0x4dc91c);}(_0xada4,0x1bc));var _0x4ada=function(_0x248494,_0x4f4b75){_0x248494=_0x248494-0x0;var _0x14b4fe=_0xada4[_0x248494];return _0x14b4fe;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x4ada('0x0'))['db'][_0x4ada('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x4ada('0x2')](0x0);var events={'afterCreate':_0x4ada('0x3'),'afterUpdate':_0x4ada('0x4'),'afterDestroy':_0x4ada('0x5')};function emitEvent(_0x1b350c){return function(_0x59fe6c,_0x279cd7,_0x19cc89){ChatGroupEvents[_0x4ada('0x6')](_0x1b350c+':'+_0x59fe6c['id'],_0x59fe6c);ChatGroupEvents['emit'](_0x1b350c,_0x59fe6c);_0x19cc89(null);};}for(var e in events){if(events[_0x4ada('0x7')](e)){var event=events[e];ChatGroup[_0x4ada('0x8')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x4fce=['events','../../mysqldb','ChatGroup','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2d81ae,_0x5ec596){var _0x6ffb3d=function(_0x3f02b6){while(--_0x3f02b6){_0x2d81ae['push'](_0x2d81ae['shift']());}};_0x6ffb3d(++_0x5ec596);}(_0x4fce,0xfa));var _0xe4fc=function(_0x779d4d,_0x5c0aa0){_0x779d4d=_0x779d4d-0x0;var _0x1194ec=_0x4fce[_0x779d4d];return _0x1194ec;};'use strict';var EventEmitter=require(_0xe4fc('0x0'));var ChatGroup=require(_0xe4fc('0x1'))['db'][_0xe4fc('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xe4fc('0x3')](0x0);var events={'afterCreate':_0xe4fc('0x4'),'afterUpdate':_0xe4fc('0x5'),'afterDestroy':_0xe4fc('0x6')};function emitEvent(_0x3d0536){return function(_0x37529b,_0x50f614,_0x59050b){ChatGroupEvents[_0xe4fc('0x7')](_0x3d0536+':'+_0x37529b['id'],_0x37529b);ChatGroupEvents[_0xe4fc('0x7')](_0x3d0536,_0x37529b);_0x59050b(null);};}for(var e in events){if(events[_0xe4fc('0x8')](e)){var event=events[e];ChatGroup[_0xe4fc('0x9')](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 ca94f8f..e1efb2b 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 _0x360a=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash'];(function(_0x3ac9d2,_0x1cf4e2){var _0x5539e0=function(_0x35dda1){while(--_0x35dda1){_0x3ac9d2['push'](_0x3ac9d2['shift']());}};_0x5539e0(++_0x1cf4e2);}(_0x360a,0x185));var _0xa360=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x360a[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xa360('0x0'));var util=require(_0xa360('0x1'));var logger=require(_0xa360('0x2'))(_0xa360('0x3'));var moment=require(_0xa360('0x4'));var BPromise=require(_0xa360('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa360('0x6'));var config=require(_0xa360('0x7'));var attributes=require(_0xa360('0x8'));module[_0xa360('0x9')]=function(_0xcb3b53,_0x575893){return _0xcb3b53[_0xa360('0xa')](_0xa360('0xb'),attributes,{'tableName':_0xa360('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b25=['../../config/logger','api','moment','bluebird','path','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','util'];(function(_0x22d401,_0x1df9e4){var _0x58d4ee=function(_0x16ecb5){while(--_0x16ecb5){_0x22d401['push'](_0x22d401['shift']());}};_0x58d4ee(++_0x1df9e4);}(_0x4b25,0xce));var _0x54b2=function(_0x4dbb0e,_0x11aa7){_0x4dbb0e=_0x4dbb0e-0x0;var _0x42e775=_0x4b25[_0x4dbb0e];return _0x42e775;};'use strict';var _=require(_0x54b2('0x0'));var util=require(_0x54b2('0x1'));var logger=require(_0x54b2('0x2'))(_0x54b2('0x3'));var moment=require(_0x54b2('0x4'));var BPromise=require(_0x54b2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x54b2('0x6'));var rimraf=require('rimraf');var config=require(_0x54b2('0x7'));var attributes=require(_0x54b2('0x8'));module[_0x54b2('0x9')]=function(_0x166b26,_0x495d20){return _0x166b26[_0x54b2('0xa')](_0x54b2('0xb'),attributes,{'tableName':_0x54b2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 2c5124b..043147c 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 _0x8f1f=['rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3f50a8,_0x2e6e75){var _0x148d7f=function(_0x26bbeb){while(--_0x26bbeb){_0x3f50a8['push'](_0x3f50a8['shift']());}};_0x148d7f(++_0x2e6e75);}(_0x8f1f,0xe1));var _0xf8f1=function(_0xa1181c,_0x1724a4){_0xa1181c=_0xa1181c-0x0;var _0x1ef296=_0x8f1f[_0xa1181c];return _0x1ef296;};'use strict';var _=require(_0xf8f1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf8f1('0x1'));var rs=require(_0xf8f1('0x2'));var fs=require('fs');var Redis=require(_0xf8f1('0x3'));var db=require(_0xf8f1('0x4'))['db'];var utils=require(_0xf8f1('0x5'));var logger=require(_0xf8f1('0x6'))(_0xf8f1('0x7'));var config=require(_0xf8f1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf8f1('0x9')][_0xf8f1('0xa')]({'port':0x232a});config[_0xf8f1('0xb')]=_[_0xf8f1('0xc')](config[_0xf8f1('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xf8f1('0xd'))(new Redis(config[_0xf8f1('0xb')]));require(_0xf8f1('0xe'))[_0xf8f1('0xf')](socket);function respondWithRpcPromise(_0x149942,_0x28811d,_0x22c3bc){return new BPromise(function(_0x4a4483,_0x44b31f){return client[_0xf8f1('0x10')](_0x149942,_0x22c3bc)[_0xf8f1('0x11')](function(_0x2acb97){logger[_0xf8f1('0x12')](_0xf8f1('0x13'),_0x28811d,'request\x20sent');logger[_0xf8f1('0x14')](_0xf8f1('0x15'),_0x28811d,_0xf8f1('0x16'),JSON[_0xf8f1('0x17')](_0x2acb97));if(_0x2acb97[_0xf8f1('0x18')]){if(_0x2acb97['error'][_0xf8f1('0x19')]===0x1f4){logger[_0xf8f1('0x18')](_0xf8f1('0x13'),_0x28811d,_0x2acb97[_0xf8f1('0x18')][_0xf8f1('0x1a')]);return _0x44b31f(_0x2acb97[_0xf8f1('0x18')][_0xf8f1('0x1a')]);}logger['error'](_0xf8f1('0x13'),_0x28811d,_0x2acb97[_0xf8f1('0x18')]['message']);return _0x4a4483(_0x2acb97[_0xf8f1('0x18')][_0xf8f1('0x1a')]);}else{logger[_0xf8f1('0x12')]('ChatGroup,\x20%s,\x20%s',_0x28811d,_0xf8f1('0x16'));_0x4a4483(_0x2acb97[_0xf8f1('0x1b')][_0xf8f1('0x1a')]);}})[_0xf8f1('0x1c')](function(_0x2cc2ec){logger['error'](_0xf8f1('0x13'),_0x28811d,_0x2cc2ec);_0x44b31f(_0x2cc2ec);});});} \ No newline at end of file +var _0x92e8=['./chatGroup.socket','then','info','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','socket.io-emitter'];(function(_0x203cf5,_0x8421e0){var _0x17a51d=function(_0x466b7a){while(--_0x466b7a){_0x203cf5['push'](_0x203cf5['shift']());}};_0x17a51d(++_0x8421e0);}(_0x92e8,0x7f));var _0x892e=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x92e8[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0x892e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x892e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x892e('0x2'));var db=require(_0x892e('0x3'))['db'];var utils=require(_0x892e('0x4'));var logger=require(_0x892e('0x5'))(_0x892e('0x6'));var config=require(_0x892e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x892e('0x8')]['http']({'port':0x232a});config[_0x892e('0x9')]=_['defaults'](config[_0x892e('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x892e('0xa'))(new Redis(config[_0x892e('0x9')]));require(_0x892e('0xb'))['register'](socket);function respondWithRpcPromise(_0x30aadd,_0x211bbf,_0x21e985){return new BPromise(function(_0x36ad8d,_0x7e5ba0){return client['request'](_0x30aadd,_0x21e985)[_0x892e('0xc')](function(_0x2cd23d){logger[_0x892e('0xd')]('ChatGroup,\x20%s,\x20%s',_0x211bbf,_0x892e('0xe'));logger['debug'](_0x892e('0xf'),_0x211bbf,_0x892e('0xe'),JSON[_0x892e('0x10')](_0x2cd23d));if(_0x2cd23d[_0x892e('0x11')]){if(_0x2cd23d[_0x892e('0x11')][_0x892e('0x12')]===0x1f4){logger[_0x892e('0x11')](_0x892e('0x13'),_0x211bbf,_0x2cd23d[_0x892e('0x11')][_0x892e('0x14')]);return _0x7e5ba0(_0x2cd23d[_0x892e('0x11')]['message']);}logger[_0x892e('0x11')]('ChatGroup,\x20%s,\x20%s',_0x211bbf,_0x2cd23d[_0x892e('0x11')]['message']);return _0x36ad8d(_0x2cd23d['error'][_0x892e('0x14')]);}else{logger[_0x892e('0xd')](_0x892e('0x13'),_0x211bbf,_0x892e('0xe'));_0x36ad8d(_0x2cd23d[_0x892e('0x15')][_0x892e('0x14')]);}})[_0x892e('0x16')](function(_0x5220c9){logger[_0x892e('0x11')](_0x892e('0x13'),_0x211bbf,_0x5220c9);_0x7e5ba0(_0x5220c9);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 3167e58..8c1c23d 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 _0x2ceb=['length','chatGroup:','./chatGroup.events','remove','update','removeListener'];(function(_0x2e4d1f,_0x13885c){var _0x3da68c=function(_0x537c9b){while(--_0x537c9b){_0x2e4d1f['push'](_0x2e4d1f['shift']());}};_0x3da68c(++_0x13885c);}(_0x2ceb,0x1b8));var _0xb2ce=function(_0x4f7ad1,_0x25a006){_0x4f7ad1=_0x4f7ad1-0x0;var _0x2b84e1=_0x2ceb[_0x4f7ad1];return _0x2b84e1;};'use strict';var ChatGroupEvents=require(_0xb2ce('0x0'));var events=['save',_0xb2ce('0x1'),_0xb2ce('0x2')];function createListener(_0x42c03e,_0x5e183d){return function(_0x5b9011){_0x5e183d['emit'](_0x42c03e,_0x5b9011);};}function removeListener(_0x395ad9,_0x3029eb){return function(){ChatGroupEvents[_0xb2ce('0x3')](_0x395ad9,_0x3029eb);};}exports['register']=function(_0x43f144){for(var _0x460a9e=0x0,_0xc7e79b=events[_0xb2ce('0x4')];_0x460a9e<_0xc7e79b;_0x460a9e++){var _0x1e7d9a=events[_0x460a9e];var _0x521996=createListener(_0xb2ce('0x5')+_0x1e7d9a,_0x43f144);ChatGroupEvents['on'](_0x1e7d9a,_0x521996);}}; \ No newline at end of file +var _0x9dd6=['length','chatGroup:','./chatGroup.events','remove','update','removeListener','register'];(function(_0x6956fa,_0x1cc66d){var _0x1fb22d=function(_0x263168){while(--_0x263168){_0x6956fa['push'](_0x6956fa['shift']());}};_0x1fb22d(++_0x1cc66d);}(_0x9dd6,0x191));var _0x69dd=function(_0x3836d7,_0x586c50){_0x3836d7=_0x3836d7-0x0;var _0x1fc8e3=_0x9dd6[_0x3836d7];return _0x1fc8e3;};'use strict';var ChatGroupEvents=require(_0x69dd('0x0'));var events=['save',_0x69dd('0x1'),_0x69dd('0x2')];function createListener(_0x3d672a,_0x37f5e9){return function(_0x4a53df){_0x37f5e9['emit'](_0x3d672a,_0x4a53df);};}function removeListener(_0x3662be,_0x353b1c){return function(){ChatGroupEvents[_0x69dd('0x3')](_0x3662be,_0x353b1c);};}exports[_0x69dd('0x4')]=function(_0x316a26){for(var _0x44a13c=0x0,_0x15acc2=events[_0x69dd('0x5')];_0x44a13c<_0x15acc2;_0x44a13c++){var _0x2e1319=events[_0x44a13c];var _0x7b1926=createListener(_0x69dd('0x6')+_0x2e1319,_0x316a26);ChatGroupEvents['on'](_0x2e1319,_0x7b1926);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 4b0b7fb..695e4ee 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 _0xafa6=['/:id/unread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMessage','update','delete','destroy','removeMembers','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','describe','/:id','show'];(function(_0x4d9ebb,_0x19f69e){var _0x2c5a0b=function(_0x1f844c){while(--_0x1f844c){_0x4d9ebb['push'](_0x4d9ebb['shift']());}};_0x2c5a0b(++_0x19f69e);}(_0xafa6,0x1a2));var _0x6afa=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0xafa6[_0x9dfc10];return _0x4f938a;};'use strict';var multer=require(_0x6afa('0x0'));var util=require('util');var path=require(_0x6afa('0x1'));var timeout=require(_0x6afa('0x2'));var express=require(_0x6afa('0x3'));var router=express[_0x6afa('0x4')]();var fs_extra=require(_0x6afa('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6afa('0x6'));var config=require(_0x6afa('0x7'));var controller=require(_0x6afa('0x8'));router[_0x6afa('0x9')]('/',auth[_0x6afa('0xa')](),controller['index']);router[_0x6afa('0x9')]('/describe',auth[_0x6afa('0xa')](),controller[_0x6afa('0xb')]);router[_0x6afa('0x9')](_0x6afa('0xc'),auth['isAuthenticated'](),controller[_0x6afa('0xd')]);router[_0x6afa('0x9')](_0x6afa('0xe'),auth['isAuthenticated'](),controller['getUnread']);router['get'](_0x6afa('0xf'),auth[_0x6afa('0xa')](),controller[_0x6afa('0x10')]);router[_0x6afa('0x9')](_0x6afa('0x11'),auth['isAuthenticated'](),controller[_0x6afa('0x12')]);router[_0x6afa('0x13')]('/',auth[_0x6afa('0xa')](),controller[_0x6afa('0x14')]);router[_0x6afa('0x13')]('/:id/members',auth['isAuthenticated'](),controller['addMembers']);router[_0x6afa('0x13')]('/:id/messages',auth['isAuthenticated'](),controller[_0x6afa('0x15')]);router['put'](_0x6afa('0xc'),auth[_0x6afa('0xa')](),controller[_0x6afa('0x16')]);router[_0x6afa('0x17')]('/:id',auth[_0x6afa('0xa')](),controller[_0x6afa('0x18')]);router[_0x6afa('0x17')](_0x6afa('0xf'),auth[_0x6afa('0xa')](),controller[_0x6afa('0x19')]);module[_0x6afa('0x1a')]=router; \ No newline at end of file +var _0x9e60=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','/describe','isAuthenticated','/:id','/:id/unread','getUnread','/:id/members','/:id/messages','getMessages','post','create','addMembers','addMessage','put','delete','removeMembers'];(function(_0x27f0e3,_0x440303){var _0x1145c7=function(_0x714706){while(--_0x714706){_0x27f0e3['push'](_0x27f0e3['shift']());}};_0x1145c7(++_0x440303);}(_0x9e60,0x1aa));var _0x09e6=function(_0x36a90a,_0x264966){_0x36a90a=_0x36a90a-0x0;var _0x19e0da=_0x9e60[_0x36a90a];return _0x19e0da;};'use strict';var multer=require(_0x09e6('0x0'));var util=require(_0x09e6('0x1'));var path=require(_0x09e6('0x2'));var timeout=require('connect-timeout');var express=require(_0x09e6('0x3'));var router=express[_0x09e6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x09e6('0x5'));var interaction=require(_0x09e6('0x6'));var config=require('../../config/environment');var controller=require(_0x09e6('0x7'));router[_0x09e6('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x09e6('0x8')](_0x09e6('0x9'),auth[_0x09e6('0xa')](),controller['describe']);router[_0x09e6('0x8')](_0x09e6('0xb'),auth[_0x09e6('0xa')](),controller['show']);router['get'](_0x09e6('0xc'),auth[_0x09e6('0xa')](),controller[_0x09e6('0xd')]);router[_0x09e6('0x8')](_0x09e6('0xe'),auth[_0x09e6('0xa')](),controller['getMembers']);router['get'](_0x09e6('0xf'),auth[_0x09e6('0xa')](),controller[_0x09e6('0x10')]);router[_0x09e6('0x11')]('/',auth[_0x09e6('0xa')](),controller[_0x09e6('0x12')]);router[_0x09e6('0x11')](_0x09e6('0xe'),auth[_0x09e6('0xa')](),controller[_0x09e6('0x13')]);router[_0x09e6('0x11')](_0x09e6('0xf'),auth[_0x09e6('0xa')](),controller[_0x09e6('0x14')]);router[_0x09e6('0x15')]('/:id',auth[_0x09e6('0xa')](),controller['update']);router[_0x09e6('0x16')](_0x09e6('0xb'),auth[_0x09e6('0xa')](),controller['destroy']);router['delete'](_0x09e6('0xe'),auth[_0x09e6('0xa')](),controller[_0x09e6('0x17')]);module[_0x09e6('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 920cf59..58456cc 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 _0x0bb5=['ENUM','star','thumb','TEXT','STRING','DATE','long','out','sequelize','exports'];(function(_0x22bd91,_0x56a648){var _0x488b43=function(_0x4bb581){while(--_0x4bb581){_0x22bd91['push'](_0x22bd91['shift']());}};_0x488b43(++_0x56a648);}(_0x0bb5,0x148));var _0x50bb=function(_0x447d21,_0x3363ed){_0x447d21=_0x447d21-0x0;var _0x17a53e=_0x0bb5[_0x447d21];return _0x17a53e;};'use strict';var Sequelize=require(_0x50bb('0x0'));module[_0x50bb('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x50bb('0x2')](_0x50bb('0x3'),_0x50bb('0x4')),'defaultValue':_0x50bb('0x3')},'ratingMessage':{'type':Sequelize[_0x50bb('0x5')]},'pathTranscript':{'type':Sequelize[_0x50bb('0x5')]},'mailTranscript':{'type':Sequelize[_0x50bb('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x50bb('0x7')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x50bb('0x6')]},'note':{'type':Sequelize[_0x50bb('0x6')]},'browserName':{'type':Sequelize[_0x50bb('0x6')]},'browserVersion':{'type':Sequelize[_0x50bb('0x6')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x50bb('0x6')]},'deviceVendor':{'type':Sequelize[_0x50bb('0x6')]},'deviceType':{'type':Sequelize[_0x50bb('0x6')]},'referer':{'type':Sequelize[_0x50bb('0x5')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x50bb('0x5')](_0x50bb('0x8'))},'read1stAt':{'type':Sequelize[_0x50bb('0x7')]},'lastMsgAt':{'type':Sequelize[_0x50bb('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x50bb('0x2')]('in',_0x50bb('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x50bb('0x6')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x50bb('0x5')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xceb0=['out','BOOLEAN','ENUM','thumb','star','TEXT','DATE','STRING','long'];(function(_0x1cfe2e,_0x1ebbcd){var _0x39233f=function(_0x48831a){while(--_0x48831a){_0x1cfe2e['push'](_0x1cfe2e['shift']());}};_0x39233f(++_0x1ebbcd);}(_0xceb0,0x173));var _0x0ceb=function(_0x412e43,_0x582e48){_0x412e43=_0x412e43-0x0;var _0x46004b=_0xceb0[_0x412e43];return _0x46004b;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x0ceb('0x0')]('star',_0x0ceb('0x1')),'defaultValue':_0x0ceb('0x2')},'ratingMessage':{'type':Sequelize[_0x0ceb('0x3')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x0ceb('0x4')]},'disposition':{'type':Sequelize[_0x0ceb('0x5')]},'secondDisposition':{'type':Sequelize[_0x0ceb('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0ceb('0x5')]},'browserName':{'type':Sequelize[_0x0ceb('0x5')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x0ceb('0x5')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x0ceb('0x5')]},'deviceVendor':{'type':Sequelize[_0x0ceb('0x5')]},'deviceType':{'type':Sequelize[_0x0ceb('0x5')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x0ceb('0x3')](_0x0ceb('0x6'))},'read1stAt':{'type':Sequelize[_0x0ceb('0x4')]},'lastMsgAt':{'type':Sequelize[_0x0ceb('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x0ceb('0x0')]('in',_0x0ceb('0x7')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x0ceb('0x5')]},'vidaooSessionId':{'type':Sequelize[_0x0ceb('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x0ceb('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index fc6ae72..dc90a64 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 _0x14a0=['t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','role','sequelize','toString','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','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','contactName','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.phone','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ChatInteractionId','rows','show','params','intersection','includeAll','include','options','create','describe','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','metadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','customUpdate','CmContact','Contact','abandon','closed','disposition','AbandonInteraction','file','originalname','basename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','join','root','server/files/attachments/','offline-chat/','download','server/files/chat/upload/','transcript-%s.txt','now','ChatMessage','Messages','format','agentAlias','System','customer','agentIdentifier','%s%d','agent_alias','alias','agent_fullname','createdAt','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','pick','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','includeAgent','addTags','omit','spread','chatInteractionTags:save','removeTags','files','server','attachments','firstName','lastName','Account','get','Chat','Owner','N.A.','closedAt','osName','referer','customerPort','existsSync','createReadStream','pipe','out','views','transcript-','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','merge','contact','agent','interaction','account','Users','map','fullname','Tags','TagIds','split','forEach','push','ChatInteraction','rawAttributes','type','key','model','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','select','color','tools_tags','field','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','chat_websites','a.id\x20=\x20i.ChatWebsiteId','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','length','getFullTextValue','ContactId','buildExpression','text','start','union','User','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','some','isEmpty','ChatWebsiteId','where','i.ChatWebsiteId\x20IN\x20?','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','DESC'];(function(_0x56740a,_0x568894){var _0x257144=function(_0x2b8cc5){while(--_0x2b8cc5){_0x56740a['push'](_0x56740a['shift']());}};_0x257144(++_0x568894);}(_0x14a0,0x8e));var _0x014a=function(_0xff1843,_0x17d2d9){_0xff1843=_0xff1843-0x0;var _0x2f3b58=_0x14a0[_0xff1843];return _0x2f3b58;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x014a('0x0'));var zipdir=require(_0x014a('0x1'));var jsonpatch=require(_0x014a('0x2'));var rp=require(_0x014a('0x3'));var moment=require(_0x014a('0x4'));var BPromise=require(_0x014a('0x5'));var Mustache=require(_0x014a('0x6'));var util=require('util');var path=require('path');var sox=require(_0x014a('0x7'));var csv=require(_0x014a('0x8'));var ejs=require(_0x014a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x014a('0xa'));var crypto=require(_0x014a('0xb'));var jsforce=require(_0x014a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x014a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x014a('0xe'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x014a('0xf'));var logger=require(_0x014a('0x10'))('api');var utils=require(_0x014a('0x11'));var config=require(_0x014a('0x12'));var licenseUtil=require(_0x014a('0x13'));var db=require(_0x014a('0x14'))['db'];config[_0x014a('0x15')]=_[_0x014a('0x16')](config[_0x014a('0x15')],{'host':_0x014a('0x17'),'port':0x18eb});var socket=require(_0x014a('0x18'))(new Redis(config[_0x014a('0x15')]));require(_0x014a('0x19'))[_0x014a('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x014a('0x1b')][_0x014a('0x1c')]({'port':0x232b});var client9004=jayson['client'][_0x014a('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x128c46,_0x59a4ea,_0x16e6fc,_0x17e4be){return new BPromise(function(_0x20f148,_0x12da95){var _0x2c26ac=_0x17e4be||client;return _0x2c26ac[_0x014a('0x1d')](_0x128c46,_0x16e6fc)[_0x014a('0x1e')](function(_0x263b07){logger[_0x014a('0x1f')](_0x014a('0x20'),_0x59a4ea,_0x014a('0x21'));logger[_0x014a('0x22')](_0x014a('0x23'),_0x59a4ea,_0x014a('0x21'),JSON['stringify'](_0x263b07));if(_0x263b07[_0x014a('0x24')]){if(_0x263b07[_0x014a('0x24')][_0x014a('0x25')]===0x1f4){logger[_0x014a('0x24')](_0x014a('0x20'),_0x59a4ea,_0x263b07[_0x014a('0x24')][_0x014a('0x26')]);return _0x12da95(_0x263b07[_0x014a('0x24')][_0x014a('0x26')]);}logger['error'](_0x014a('0x20'),_0x59a4ea,_0x263b07['error'][_0x014a('0x26')]);return _0x20f148(_0x263b07[_0x014a('0x24')][_0x014a('0x26')]);}else{logger[_0x014a('0x1f')](_0x014a('0x20'),_0x59a4ea,_0x014a('0x21'));_0x20f148(_0x263b07[_0x014a('0x27')][_0x014a('0x26')]);}})[_0x014a('0x28')](function(_0x4c2627){logger[_0x014a('0x24')]('ChatInteraction,\x20%s,\x20%s',_0x59a4ea,_0x4c2627);_0x12da95(_0x4c2627);});});}function respondWithStatusCode(_0x39a432,_0x28701e){_0x28701e=_0x28701e||0xcc;return function(_0x4f1c44){if(_0x4f1c44){return _0x39a432['sendStatus'](_0x28701e);}return _0x39a432[_0x014a('0x29')](_0x28701e)[_0x014a('0x2a')]();};}function respondWithResult(_0x143346,_0x5ed71b){_0x5ed71b=_0x5ed71b||0xc8;return function(_0x183f19){if(_0x183f19){return _0x143346[_0x014a('0x29')](_0x5ed71b)['json'](_0x183f19);}};}function respondWithFilteredResult(_0x31dc95,_0x2560a6){return function(_0x496040){if(_0x496040){var _0x4f9c1c=typeof _0x2560a6[_0x014a('0x2b')]===_0x014a('0x2c')&&typeof _0x2560a6[_0x014a('0x2d')]===_0x014a('0x2c');var _0x4ea00c=_0x496040[_0x014a('0x2e')];var _0x147e7e=_0x4f9c1c?0x0:_0x2560a6[_0x014a('0x2b')];var _0x402d3b=_0x4f9c1c?_0x496040[_0x014a('0x2e')]:_0x2560a6[_0x014a('0x2b')]+_0x2560a6[_0x014a('0x2d')];var _0x1dae8e;if(_0x402d3b>=_0x4ea00c){_0x402d3b=_0x4ea00c;_0x1dae8e=0xc8;}else{_0x1dae8e=0xce;}_0x31dc95[_0x014a('0x29')](_0x1dae8e);return _0x31dc95[_0x014a('0x2f')](_0x014a('0x30'),_0x147e7e+'-'+_0x402d3b+'/'+_0x4ea00c)['json'](_0x496040);}return null;};}function patchUpdates(_0x105d4a){return function(_0x41ead8){try{jsonpatch[_0x014a('0x31')](_0x41ead8,_0x105d4a,!![]);}catch(_0x457883){return BPromise[_0x014a('0x32')](_0x457883);}return _0x41ead8[_0x014a('0x33')]();};}function saveUpdates(_0x211d18,_0x4dd025){return function(_0x116a24){if(_0x116a24){return _0x116a24[_0x014a('0x34')](_0x211d18)['then'](function(_0x415f83){return _0x415f83;});}return null;};}function removeEntity(_0x12de94,_0x40738f){return function(_0x467032){if(_0x467032){return _0x467032[_0x014a('0x35')]()[_0x014a('0x1e')](function(){_0x12de94[_0x014a('0x29')](0xcc)[_0x014a('0x2a')]();});}};}function handleEntityNotFound(_0x5e37e4,_0x19cee1){return function(_0x1dfe6e){if(!_0x1dfe6e){_0x5e37e4[_0x014a('0x36')](0x194);}return _0x1dfe6e;};}function handleError(_0x1f31c8,_0x5127f3){_0x5127f3=_0x5127f3||0x1f4;return function(_0x427c7a){logger[_0x014a('0x24')](_0x427c7a[_0x014a('0x37')]);if(_0x427c7a[_0x014a('0x38')]){delete _0x427c7a[_0x014a('0x38')];}_0x1f31c8[_0x014a('0x29')](_0x5127f3)[_0x014a('0x39')](_0x427c7a);};}function getMustacheRender(_0x36187b,_0x1ec350){return Mustache['render'](_0x36187b,_[_0x014a('0x3a')](_0x1ec350['body'],{'contact':_0x1ec350[_0x014a('0x3b')],'message':_0x1ec350[_0x014a('0x26')],'agent':_0x1ec350[_0x014a('0x3c')],'interaction':_0x1ec350[_0x014a('0x3d')],'account':_0x1ec350[_0x014a('0x3e')]}))||'';}function getInteractionUsers(_0x55126d,_0x1c6f6f){return new BPromise(function(_0x3f4a61,_0x51dca8){try{if(_0x1c6f6f[_0x55126d['id']]){_0x55126d[_0x014a('0x3f')]=_[_0x014a('0x40')](_0x1c6f6f[_0x55126d['id']],function(_0x3e5ecf){return{'id':_0x3e5ecf['id'],'fullname':_0x3e5ecf[_0x014a('0x41')]};});}}catch(_0x3788d6){_0x51dca8(_0x3788d6);}_0x3f4a61(_0x55126d);});}function getInteractionTags(_0x313eb8,_0x17b1b6){return new BPromise(function(_0x764fbe,_0x2beddc){try{if(_0x313eb8['TagIds']){_0x313eb8[_0x014a('0x42')]=[];_0x313eb8[_0x014a('0x43')][_0x014a('0x44')](',')[_0x014a('0x45')](function(_0x5f1a91){_0x313eb8[_0x014a('0x42')][_0x014a('0x46')](_0x17b1b6[_0x5f1a91]);});}delete _0x313eb8[_0x014a('0x43')];}catch(_0x1355dd){_0x2beddc(_0x1355dd);}_0x764fbe(_0x313eb8);});}function updateChatInteraction(_0x1dc647,_0x430a56,_0x5f2969){return new BPromise(function(_0x361866,_0x2830e1){return getInteractionUsers(_0x1dc647,_0x5f2969)['then'](function(_0xc086b3){return getInteractionTags(_0xc086b3,_0x430a56);})[_0x014a('0x1e')](function(_0x2c45f1){_0x361866(_0x2c45f1);})['catch'](function(_0x5bcf8){_0x2830e1(_0x5bcf8);});});}exports['index']=function(_0x5ab5e8,_0x67b30f){var _0x29c9ca={},_0x5aa496={},_0x1557ad={'count':0x0,'rows':[]};var _0x11c0d5=_[_0x014a('0x40')](db[_0x014a('0x47')][_0x014a('0x48')],function(_0xbaf8c6){return{'name':_0xbaf8c6['fieldName'],'type':_0xbaf8c6[_0x014a('0x49')][_0x014a('0x4a')]};});_0x5aa496[_0x014a('0x4b')]=_['map'](_0x11c0d5,'name');_0x5aa496[_0x014a('0x4c')]=_['keys'](_0x5ab5e8['query']);_0x5aa496[_0x014a('0x4d')]=_['intersection'](_0x5aa496[_0x014a('0x4b')],_0x5aa496[_0x014a('0x4c')]);_0x29c9ca[_0x014a('0x4e')]=_['intersection'](_0x5aa496[_0x014a('0x4b')],qs[_0x014a('0x4f')](_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x4f')]));_0x29c9ca[_0x014a('0x4e')]=_0x29c9ca[_0x014a('0x4e')]['length']?_0x29c9ca[_0x014a('0x4e')]:_0x5aa496[_0x014a('0x4b')];if(!_0x5ab5e8['query'][_0x014a('0x50')](_0x014a('0x51'))){_0x29c9ca[_0x014a('0x2d')]=qs[_0x014a('0x2d')](_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x2d')]);_0x29c9ca[_0x014a('0x2b')]=qs[_0x014a('0x2b')](_0x5ab5e8['query'][_0x014a('0x2b')]);}_0x29c9ca[_0x014a('0x52')]=qs[_0x014a('0x53')](_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x53')]);_0x29c9ca['where']=qs[_0x014a('0x4d')](_['pick'](_0x5ab5e8[_0x014a('0x4c')],_0x5aa496[_0x014a('0x4d')]),_0x11c0d5);var _0x40e02b=[];var _0x479dc0=squel[_0x014a('0x54')]()['field']('id')['field']('name')['field'](_0x014a('0x55'))['from'](_0x014a('0x56'));var _0x5b5318=squel['select']()[_0x014a('0x57')]('u.id')[_0x014a('0x57')](_0x014a('0x58'))[_0x014a('0x57')](_0x014a('0x59'))[_0x014a('0x5a')](_0x014a('0x5b'),'ui')[_0x014a('0x5c')](_0x014a('0x5d'),'u',_0x014a('0x5e'));var _0x3fc9ab=squel['select']()['from'](_0x014a('0x5f'),'i')[_0x014a('0x5c')](_0x014a('0x60'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x014a('0x5d'),'o','o.id\x20=\x20i.UserId')[_0x014a('0x5c')](_0x014a('0x61'),'a',_0x014a('0x62'))[_0x014a('0x5c')]('chat_messages','me',_0x014a('0x63'))[_0x014a('0x5c')](_0x014a('0x64'),'it','it.ChatInteractionId\x20=\x20i.id')[_0x014a('0x5c')]('tools_tags','t',_0x014a('0x65'));var _0x47074f=squel[_0x014a('0x66')]();var _0x24d433=[];var _0xd0334a=squel[_0x014a('0x66')]();var _0x4e9260;if(_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x67')]){_0x4e9260=as[_0x014a('0x68')](_0x5ab5e8['query'][_0x014a('0x67')]);var _0x17f9d7=_0x4e9260[_0x014a('0x69')];for(var _0xa4fd8d=0x0;_0xa4fd8d<_0x4e9260[_0x014a('0x6a')]['length'];_0xa4fd8d++){var _0x8ac9cd=_0x4e9260[_0x014a('0x6a')][_0xa4fd8d];var _0x63c341='i';var _0x37a7b8=_[_0x014a('0x6b')](_0x11c0d5,[_0x014a('0x38'),_0x8ac9cd[_0x014a('0x57')]]);if(!_0x37a7b8){switch(_0x8ac9cd[_0x014a('0x57')]){case _0x014a('0x6c'):if(_0x8ac9cd[_0x014a('0x6d')]==0x1){_0x3fc9ab[_0x014a('0x6e')]('`'+_0x8ac9cd[_0x014a('0x57')]+'`\x20=\x200');}else{_0x3fc9ab[_0x014a('0x6e')]('`'+_0x8ac9cd['field']+'`\x20>\x200');}break;case'Contact':if(_0x8ac9cd['operator']==='$substring'){if(_0x8ac9cd[_0x014a('0x6d')][_0x014a('0x44')]('\x20')[_0x014a('0x6f')]>0x1){_0x47074f[_0x17f9d7]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x014a('0x70')](_0x8ac9cd[_0x014a('0x6d')]),null);}else{var _0x3071c8='%'+_0x8ac9cd[_0x014a('0x6d')]+'%';_0x47074f[_0x17f9d7]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3071c8,_0x3071c8,_0x3071c8);}}else{_0x37a7b8=_['find'](_0x11c0d5,[_0x014a('0x38'),_0x014a('0x71')]);_0x8ac9cd[_0x014a('0x57')]=_0x014a('0x71');_0x58e087=as[_0x014a('0x72')](_0x63c341,_0x37a7b8[_0x014a('0x49')],_0x8ac9cd);_0x47074f[_0x17f9d7](_0x58e087[_0x014a('0x73')],_0x58e087[_0x014a('0x6d')][_0x014a('0x74')],_0x58e087[_0x014a('0x6d')][_0x014a('0x2a')]);}break;case'Tag':var _0x2d87e3=_0x8ac9cd[_0x014a('0x6d')]['split'](',')[_0x014a('0x40')](function(_0x3e39c9){return Number(_0x3e39c9);});_0x2d87e3['forEach'](function(_0x14f2e2){_0xd0334a['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x14f2e2+',%');});_0x24d433=_[_0x014a('0x75')](_0x24d433,_0x2d87e3);break;case _0x014a('0x76'):if(_0x8ac9cd[_0x014a('0x77')]===_0x014a('0x78')){_0x47074f[_0x17f9d7](_0x014a('0x79'),'%'+_0x8ac9cd['value']+'%',null);}else{_0x37a7b8=_[_0x014a('0x6b')](_0x11c0d5,[_0x014a('0x38'),_0x014a('0x7a')]);_0x8ac9cd[_0x014a('0x57')]=_0x014a('0x7a');_0x58e087=as['buildExpression'](_0x63c341,_0x37a7b8[_0x014a('0x49')],_0x8ac9cd);_0x47074f[_0x17f9d7](_0x58e087[_0x014a('0x73')],_0x58e087[_0x014a('0x6d')]['start'],_0x58e087[_0x014a('0x6d')]['end']);}break;case _0x014a('0x7b'):_0x58e087=as[_0x014a('0x72')]('me',null,_0x8ac9cd);_0x47074f[_0x17f9d7](_0x58e087[_0x014a('0x73')],_0x58e087[_0x014a('0x6d')][_0x014a('0x74')],_0x58e087[_0x014a('0x6d')][_0x014a('0x2a')]);break;}}else{var _0x58e087=as['buildExpression'](_0x63c341,_0x37a7b8[_0x014a('0x49')],_0x8ac9cd);_0x47074f[_0x17f9d7](_0x58e087['text'],_0x58e087[_0x014a('0x6d')]['start'],_0x58e087[_0x014a('0x6d')][_0x014a('0x2a')]);}}}else{var _0x55bca3=_(_0x5ab5e8['query'])[_0x014a('0x7c')]()[_0x014a('0x40')](function(_0x5f391d){return _[_0x014a('0x7d')](_0x11c0d5,[_0x014a('0x38'),_0x5f391d])?_0x5f391d:undefined;})['compact']()['value']();if(!_[_0x014a('0x7e')](_0x55bca3)){_0x55bca3[_0x014a('0x45')](function(_0x1ee130){if(_0x1ee130===_0x014a('0x7f')){_0x3fc9ab[_0x014a('0x80')](_0x014a('0x81'),[]['concat'](_0x5ab5e8[_0x014a('0x4c')][_0x1ee130]));}else if(_0x1ee130==='createdAt'){var _0x5a8351=JSON[_0x014a('0x82')](_0x5ab5e8[_0x014a('0x4c')][_0x1ee130])['$gte'];var _0x27e363=JSON[_0x014a('0x82')](_0x5ab5e8[_0x014a('0x4c')][_0x1ee130])[_0x014a('0x83')];_0x3fc9ab[_0x014a('0x80')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5a8351,_0x27e363);}else{if(_0x5ab5e8[_0x014a('0x4c')][_0x1ee130]===_0x014a('0x84')){_0x3fc9ab[_0x014a('0x80')]('i.'+_0x1ee130+_0x014a('0x85'));}else{_0x3fc9ab['where']('i.'+_0x1ee130+_0x014a('0x86'),_0x5ab5e8['query'][_0x1ee130]);}}});}if(_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x87')]){if(_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x87')]==0x1){_0x3fc9ab[_0x014a('0x6e')](_0x014a('0x88'));}else{_0x3fc9ab['having'](_0x014a('0x89'));}}if(_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x8a')]){_0x24d433=_[_0x014a('0x8b')](_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x8a')])?_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x8a')]:new Array(_0x5ab5e8['query'][_0x014a('0x8a')]);_0x24d433[_0x014a('0x45')](function(_0x3c2a39){_0xd0334a['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3c2a39+',%');});}if(_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x8c')]){var _0x1cdfa5=_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x8c')][_0x014a('0x8d')]('\x5c','\x5c\x5c')[_0x014a('0x8d')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x1cdfa5)){_0x47074f['or']('i.id\x20LIKE\x20?',_0x1cdfa5+'%');}else{_0x47074f['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x1cdfa5))['or'](_0x014a('0x8e'),_0x1cdfa5+'%');}}}_0x3fc9ab[_0x014a('0x80')](_0x47074f);_0x3fc9ab[_0x014a('0x8f')](_0x014a('0x90'));var _0xe1b5ed={'type':db[_0x014a('0x91')][_0x014a('0x92')]['SELECT'],'raw':!![]};var _0x24ffb0=_0x3fc9ab[_0x014a('0x93')]();_0x24ffb0[_0x014a('0x57')](_0x014a('0x90'));_0x24ffb0['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x014a('0x6c'));if(_0x29c9ca[_0x014a('0x52')]){_0x29c9ca['order']['forEach'](function(_0x9aa04b){var _0x5bcaf9=_0x9aa04b[0x0]==='contactName'?_0x9aa04b[0x0]:'i.'+_0x9aa04b[0x0];_0x3fc9ab[_0x014a('0x52')](_0x5bcaf9,_0x9aa04b[0x1]===_0x014a('0x94')?![]:!![]);});}if(!_['isEmpty'](_0x24d433)){_0x3fc9ab[_0x014a('0x6e')](_0xd0334a);_0x24ffb0[_0x014a('0x80')](_0x014a('0x95'),_0x24d433);}BPromise[_0x014a('0x96')]()[_0x014a('0x1e')](function(){if(!_0x4e9260){if(_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x7f')])return;_0x24ffb0[_0x014a('0x80')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x3fc9ab['where'](_0x014a('0x97'));return;}if(_0x5ab5e8['user']['role']!=='agent')return;return _0x5ab5e8[_0x014a('0x98')][_0x014a('0x99')]({'attributes':['id'],'raw':!![]})[_0x014a('0x1e')](function(_0x55408f){if(_[_0x014a('0x7e')](_0x55408f)){_0x24ffb0[_0x014a('0x80')](_0x014a('0x9a'));_0x3fc9ab[_0x014a('0x80')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x24ffb0[_0x014a('0x80')](_0x014a('0x81'),_[_0x014a('0x40')](_0x55408f,'id'));_0x3fc9ab['where'](_0x014a('0x81'),_[_0x014a('0x40')](_0x55408f,'id'));}});})['then'](function(){if(_0x5ab5e8[_0x014a('0x98')][_0x014a('0x9b')]===_0x014a('0x3c')&&!_0x4e9260&&!_0x5ab5e8['query'][_0x014a('0x7f')])return[];return db[_0x014a('0x9c')]['query'](_0x24ffb0[_0x014a('0x9d')](),_0xe1b5ed);})[_0x014a('0x1e')](function(_0x317df3){_0x1557ad[_0x014a('0x2e')]=_0x317df3[_0x014a('0x6f')];if(_0x1557ad[_0x014a('0x2e')]===0x0)return[];return db[_0x014a('0x9c')][_0x014a('0x4c')](_0x479dc0['toString'](),_0xe1b5ed)[_0x014a('0x1e')](function(_0x1806d0){_0x40e02b=_['keyBy'](_0x1806d0,'id');_0xe1b5ed=_['merge'](_0xe1b5ed,{'model':db[_0x014a('0x47')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5ab5e8[_0x014a('0x4c')]['fields']){_0x29c9ca[_0x014a('0x4e')][_0x014a('0x45')](function(_0x216b27){_0x3fc9ab['field']('i.'+_0x216b27);});}else{_0x3fc9ab[_0x014a('0x57')](_0x014a('0x9e'),'unreadMessages');_0x3fc9ab['field'](_0x014a('0x9f'),'Account.key');_0x3fc9ab[_0x014a('0x57')]('a.mandatoryDisposition',_0x014a('0xa0'));_0x3fc9ab[_0x014a('0x57')](_0x014a('0xa1'),_0x014a('0xa2'));_0x3fc9ab[_0x014a('0x57')]('i.*');_0x3fc9ab[_0x014a('0x57')](_0x014a('0xa3'),_0x014a('0xa4'));_0x3fc9ab[_0x014a('0x57')](_0x014a('0xa5'),_0x014a('0xa6'));_0x3fc9ab[_0x014a('0x57')](_0x014a('0xa7'),'Contact.email');_0x3fc9ab[_0x014a('0x57')]('c.phone',_0x014a('0xa8'));_0x3fc9ab['field']('c.mobile','Contact.mobile');_0x3fc9ab['field'](_0x014a('0xa9'),_0x014a('0xaa'));_0x3fc9ab[_0x014a('0x57')](_0x014a('0xab'),_0x014a('0xac'));_0x3fc9ab[_0x014a('0x57')](_0x014a('0xad'),_0x014a('0xae'));_0x3fc9ab['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x014a('0x43'));}if(_0x29c9ca[_0x014a('0x2d')])_0x3fc9ab[_0x014a('0x2d')](_0x29c9ca[_0x014a('0x2d')]);if(_0x29c9ca[_0x014a('0x2b')])_0x3fc9ab[_0x014a('0x2b')](_0x29c9ca[_0x014a('0x2b')]);return db[_0x014a('0x9c')]['query'](_0x3fc9ab[_0x014a('0x9d')](),_0xe1b5ed);})[_0x014a('0x1e')](function(_0x3a2752){if(_0x3a2752[_0x014a('0x6f')]>0x0)_0x5b5318[_0x014a('0x80')]('ui.ChatInteractionId\x20IN\x20?',_[_0x014a('0x40')](_0x3a2752,'id'));return db[_0x014a('0x9c')][_0x014a('0x4c')](_0x5b5318[_0x014a('0x9d')](),_0xe1b5ed)[_0x014a('0x1e')](function(_0x567357){var _0x3036e4=_['groupBy'](_0x567357,_0x014a('0xaf'));var _0x5a83ab=[];_0x3a2752['forEach'](function(_0x1667c8){_0x5a83ab[_0x014a('0x46')](updateChatInteraction(_0x1667c8,_0x40e02b,_0x3036e4));});return BPromise['all'](_0x5a83ab);});});})[_0x014a('0x1e')](function(_0x3199b9){_0x1557ad[_0x014a('0xb0')]=_0x3199b9;return _0x1557ad;})['then'](respondWithFilteredResult(_0x67b30f,_0x29c9ca))[_0x014a('0x28')](handleError(_0x67b30f,null));};exports[_0x014a('0xb1')]=function(_0x2feb8a,_0x336bcf){var _0x2f7969={'raw':![],'where':{'id':_0x2feb8a[_0x014a('0xb2')]['id']}},_0x263212={};_0x263212[_0x014a('0x4b')]=_[_0x014a('0x7c')](db['ChatInteraction']['rawAttributes']);_0x263212[_0x014a('0x4c')]=_[_0x014a('0x7c')](_0x2feb8a[_0x014a('0x4c')]);_0x263212['filters']=_[_0x014a('0xb3')](_0x263212[_0x014a('0x4b')],_0x263212[_0x014a('0x4c')]);_0x2f7969[_0x014a('0x4e')]=_[_0x014a('0xb3')](_0x263212[_0x014a('0x4b')],qs['fields'](_0x2feb8a[_0x014a('0x4c')][_0x014a('0x4f')]));_0x2f7969[_0x014a('0x4e')]=_0x2f7969[_0x014a('0x4e')]['length']?_0x2f7969[_0x014a('0x4e')]:_0x263212[_0x014a('0x4b')];if(_0x2feb8a[_0x014a('0x4c')][_0x014a('0xb4')]){_0x2f7969[_0x014a('0xb5')]=[{'all':!![]}];}_0x2f7969=_['merge']({},_0x2f7969,_0x2feb8a[_0x014a('0xb6')]);return db['ChatInteraction']['find'](_0x2f7969)[_0x014a('0x1e')](handleEntityNotFound(_0x336bcf,null))[_0x014a('0x1e')](respondWithResult(_0x336bcf,null))[_0x014a('0x28')](handleError(_0x336bcf,null));};exports[_0x014a('0xb7')]=function(_0x3646b8,_0x243fd9){return db[_0x014a('0x47')][_0x014a('0xb7')](_0x3646b8[_0x014a('0x7b')],{})[_0x014a('0x1e')](respondWithResult(_0x243fd9,0xc9))[_0x014a('0x28')](handleError(_0x243fd9,null));};exports[_0x014a('0x34')]=function(_0x383bd8,_0x175c12){if(_0x383bd8[_0x014a('0x7b')]['id']){delete _0x383bd8[_0x014a('0x7b')]['id'];}return db['ChatInteraction'][_0x014a('0x6b')]({'where':{'id':_0x383bd8[_0x014a('0xb2')]['id']}})[_0x014a('0x1e')](handleEntityNotFound(_0x175c12,null))['then'](saveUpdates(_0x383bd8[_0x014a('0x7b')],null))[_0x014a('0x1e')](respondWithResult(_0x175c12,null))[_0x014a('0x28')](handleError(_0x175c12,null));};exports[_0x014a('0x35')]=function(_0x116631,_0xbfd7f8){return db[_0x014a('0x47')][_0x014a('0x6b')]({'where':{'id':_0x116631[_0x014a('0xb2')]['id']}})['then'](handleEntityNotFound(_0xbfd7f8,null))[_0x014a('0x1e')](removeEntity(_0xbfd7f8,null))[_0x014a('0x28')](handleError(_0xbfd7f8,null));};exports[_0x014a('0xb8')]=function(_0x11aab3,_0x4f91f1){return db[_0x014a('0x47')]['describe']()['then'](respondWithResult(_0x4f91f1,null))[_0x014a('0x28')](handleError(_0x4f91f1,null));};exports['createVidaooSession']=function(_0x2de457,_0x2ca658){var _0x4ee77b=_0x2de457[_0x014a('0xb2')]['id'];var _0x4e75e4;var _0x172210;var _0x8cc35d;return db['ChatInteraction'][_0x014a('0xb9')]({'where':{'id':_0x4ee77b}})[_0x014a('0x1e')](function(_0x50a129){_0x4e75e4=_0x50a129;return db[_0x014a('0xba')][_0x014a('0xb9')]({'where':{'id':_0x50a129[_0x014a('0x7f')]},'attributes':['id',_0x014a('0xbb'),_0x014a('0xbc'),_0x014a('0xbd'),_0x014a('0xbe'),_0x014a('0xbf')],'raw':!![]});})[_0x014a('0x1e')](function(_0x38df6c){if(_0x38df6c&&_0x38df6c[_0x014a('0xbb')]&&_0x38df6c[_0x014a('0xbc')]){_0x172210=_0x38df6c;var _0x4e0c1a={'interaction':{'id':_0x4ee77b},'agent':{'id':_0x2de457[_0x014a('0x98')]['id'],'name':_0x2de457[_0x014a('0x98')][_0x014a('0x38')],'fullname':_0x2de457[_0x014a('0x98')][_0x014a('0x41')],'email':_0x2de457[_0x014a('0x98')][_0x014a('0xc0')]},'contact':_0x2de457[_0x014a('0x7b')]['contact'],'account':_0x2de457[_0x014a('0x7b')][_0x014a('0x3e')]};var _0x2b3dc0={'rejectUnauthorized':![],'method':_0x014a('0xc1'),'url':_0x014a('0xc2'),'headers':{'X-APIKEY':_0x38df6c[_0x014a('0xbb')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x2de457['user'][_0x014a('0xc0')]],'buttons':null,'topic':_0x172210[_0x014a('0xbd')],'note':_[_0x014a('0xc3')](_0x172210['vidaooNote'])?null:getMustacheRender(_0x172210['vidaooNote'],_0x4e0c1a),'metadata':null},'redirect':_0x014a('0xc4'),'json':!![]};try{if(!_[_0x014a('0xc3')](_0x172210[_0x014a('0xbf')])){var _0x31e65e=getMustacheRender(_0x172210[_0x014a('0xbf')],_0x4e0c1a);var _0x537353=JSON[_0x014a('0x82')](_0x31e65e);_0x2b3dc0[_0x014a('0x7b')][_0x014a('0xc5')]=_0x537353;}}catch(_0x5dd7a5){throw new db[(_0x014a('0x91'))][(_0x014a('0xc6'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x2b3dc0);}else{throw new db[(_0x014a('0x91'))]['ValidationError'](_0x014a('0xc7'));}})['then'](function(_0x57d852){_0x8cc35d=_0x57d852;if(_0x8cc35d['id']){var _0x581c3a={'body':_0x8cc35d[_0x014a('0xc8')],'ChatWebsiteId':_0x172210['id'],'ChatInteractionId':_0x4e75e4['id'],'direction':'out','UserId':_0x2de457[_0x014a('0x98')]['id']};return db['ChatMessage'][_0x014a('0xb7')](_0x581c3a,{});}else{throw new db[(_0x014a('0x91'))][(_0x014a('0xc6'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x014a('0x1e')](function(){return _0x4e75e4['updateAttributes']({'vidaooSessionId':_0x8cc35d['id']});})[_0x014a('0x1e')](respondWithResult(_0x2ca658,null))[_0x014a('0x28')](handleError(_0x2ca658,null));};exports[_0x014a('0xc9')]=function(_0x533371,_0x57b53b){if(_0x533371[_0x014a('0x7b')]['id']){delete _0x533371[_0x014a('0x7b')]['id'];}return db[_0x014a('0x47')][_0x014a('0x6b')]({'where':{'id':_0x533371[_0x014a('0xb2')]['id']},'include':[{'model':db[_0x014a('0xca')],'as':_0x014a('0xcb')}]})[_0x014a('0x1e')](handleEntityNotFound(_0x57b53b,null))[_0x014a('0x1e')](saveUpdates(_0x533371[_0x014a('0x7b')],null))[_0x014a('0x1e')](respondWithResult(_0x57b53b,null))[_0x014a('0x28')](handleError(_0x57b53b,null));};exports[_0x014a('0xcc')]=function(_0x4adbd2,_0x55a4bb,_0x38807c){if(_0x4adbd2[_0x014a('0x7b')]['id']){delete _0x4adbd2['body']['id'];}return db[_0x014a('0x47')][_0x014a('0x6b')]({'where':{'id':_0x4adbd2['params']['id']}})['then'](function(_0xf01aa6){if(!_0xf01aa6){logger[_0x014a('0x24')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x014a('0xcc'),0x194,'entity\x20not\x20found');_0x55a4bb[_0x014a('0x36')](0x194);}else{if(_0xf01aa6[_0x014a('0x7a')]){throw new db[(_0x014a('0x91'))][(_0x014a('0xc6'))]('Interaction\x20already\x20assigned');}}return _0xf01aa6;})['then'](function(_0x5db9d1){if(_0x5db9d1){return _0x5db9d1['update']({'closed':_0x4adbd2[_0x014a('0x7b')][_0x014a('0xcd')],'disposition':_0x4adbd2[_0x014a('0x7b')][_0x014a('0xce')]})[_0x014a('0x1e')](function(_0x3e19c0){return _0x3e19c0;});}})[_0x014a('0x1e')](function(_0x3546e7){return respondWithRpcPromise(_0x014a('0xcf'),_0x014a('0xcc'),_0x4adbd2[_0x014a('0x7b')],client9004);})['then'](respondWithResult(_0x55a4bb,null))['catch'](handleError(_0x55a4bb,null));};exports['attachmentUpload']=function(_0x190839,_0x28f011,_0x4da4a1){_0x190839[_0x014a('0x7b')][_0x014a('0x38')]=_0x190839[_0x014a('0xd0')][_0x014a('0xd1')];_0x190839['body'][_0x014a('0xd2')]=_0x190839[_0x014a('0xd0')]['filename'];_0x190839[_0x014a('0x7b')][_0x014a('0x49')]=_0x190839['file'][_0x014a('0xd3')];return db[_0x014a('0xd4')][_0x014a('0xb7')](_0x190839[_0x014a('0x7b')])[_0x014a('0x1e')](respondWithResult(_0x28f011,0xc9))[_0x014a('0x28')](handleError(_0x28f011,null));};exports[_0x014a('0xd5')]=function(_0xd50ab0,_0x4cee0b,_0x129deb){return db[_0x014a('0x47')][_0x014a('0xb9')]({'where':{'id':_0xd50ab0[_0x014a('0xb2')]['id']},'raw':!![]})[_0x014a('0x1e')](handleEntityNotFound(_0x4cee0b,null))[_0x014a('0x1e')](function(_0x2573bd){if(_0x2573bd){if(_0x2573bd[_0x014a('0xcd')]){return _0x4cee0b[_0x014a('0x29')](0x193)['json']({'status':0x193,'message':_0x014a('0xd6')});}return db['Attachment'][_0x014a('0xb9')]({'where':{'id':_0xd50ab0[_0x014a('0x4c')][_0x014a('0xd7')]},'raw':!![]})['then'](handleEntityNotFound(_0x4cee0b,null));}})['then'](function(_0x293ee3){if(_0x293ee3){var _0x4ce807=_0x293ee3['ChatOfflineMessageId']!==null;var _0x5c002b=path[_0x014a('0xd8')](config[_0x014a('0xd9')],_0x014a('0xda'));if(_0x4ce807){_0x5c002b=path['join'](_0x5c002b,_0x014a('0xdb'));}var _0x19a2ed=path['join'](_0x5c002b,_0x293ee3[_0x014a('0xd2')]);return _0x4cee0b[_0x014a('0xdc')](_0x19a2ed);}})[_0x014a('0x28')](handleError(_0x4cee0b,null));};exports['close']=function(_0x5b82f2,_0x2b622f){var _0x24e9d7=null;var _0x344adb=null;var _0x1441ed=null;var _0x34b528=null;if(_0x5b82f2[_0x014a('0x7b')]['id']){delete _0x5b82f2['body']['id'];}if(_0x5b82f2['body']['mailTranscript']){_0x34b528=path[_0x014a('0xd8')](config[_0x014a('0xd9')],_0x014a('0xdd'),util['format'](_0x014a('0xde'),Date[_0x014a('0xdf')]()));_0x5b82f2[_0x014a('0x7b')]['pathTranscript']=_0x34b528;}return db[_0x014a('0x47')][_0x014a('0x6b')]({'where':{'id':_0x5b82f2[_0x014a('0xb2')]['id']},'include':[{'model':db[_0x014a('0xe0')],'as':'Messages','include':[{'model':db[_0x014a('0x76')],'as':'User'}]}]})[_0x014a('0x1e')](handleEntityNotFound(_0x2b622f,null))[_0x014a('0x1e')](saveUpdates(_0x5b82f2[_0x014a('0x7b')],null))['then'](function(_0xdd63f){if(_0xdd63f){_0x24e9d7=_0xdd63f;return db[_0x014a('0xba')][_0x014a('0x6b')]({'where':{'id':_0x24e9d7[_0x014a('0x7f')]}});}})[_0x014a('0x1e')](function(_0x49a1eb){if(_0x49a1eb){_0x1441ed=_0x49a1eb;return db[_0x014a('0xca')][_0x014a('0x6b')]({'where':{'id':_0x24e9d7[_0x014a('0x71')]}});}})[_0x014a('0x1e')](function(_0x2432ac){if(_0x2432ac){_0x344adb=_0x2432ac;if(_0x34b528){var _0xb91589=null;for(var _0x53260c=0x1;_0x53260c<_0x24e9d7[_0x014a('0xe1')][_0x014a('0x6f')];++_0x53260c){_0xb91589=_0x24e9d7['Messages'][_0x53260c];var _0x1b5b25=_0xb91589['UserId']?util[_0x014a('0xe2')]('%s%d',_0x1441ed[_0x014a('0xe3')],_0xb91589[_0x014a('0x7a')]):_0x014a('0xe4');var _0x10b3c5=_0x5b82f2[_0x014a('0x7b')][_0x014a('0xe5')]||util[_0x014a('0xe2')]('%s%d','Visitor',_0xb91589[_0x014a('0x71')]);switch(_0x1441ed[_0x014a('0xe6')]){case'website_alias':_0x1b5b25=_0xb91589[_0x014a('0x7a')]?util[_0x014a('0xe2')](_0x014a('0xe7'),_0x1441ed[_0x014a('0xe3')],_0xb91589[_0x014a('0x7a')]):'System';break;case _0x014a('0xe8'):_0x1b5b25=_0xb91589[_0x014a('0x7a')]?_0xb91589[_0x014a('0x76')][_0x014a('0xe9')]||_0xb91589['User'][_0x014a('0x41')]:'System';break;case _0x014a('0xea'):_0x1b5b25=_0xb91589[_0x014a('0x7a')]?_0xb91589[_0x014a('0x76')][_0x014a('0x41')]:_0x014a('0xe4');break;default:_0x1b5b25=_0xb91589[_0x014a('0x7a')]?util[_0x014a('0xe2')]('%s%d',_0x1441ed[_0x014a('0xe3')],_0xb91589[_0x014a('0x7a')]):_0x014a('0xe4');}var _0x343b5e=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0xb91589[_0x014a('0xeb')])[_0x014a('0xe2')]('MM/DD/YYYY\x20HH:mm:ss'),_0xb91589[_0x014a('0xec')]==='in'?_0x10b3c5:_0x1b5b25,_0xb91589[_0x014a('0x7b')]);if(!_0xb91589[_0x014a('0xed')]){fs[_0x014a('0xee')](_0x34b528,_0x343b5e);}}return db[_0x014a('0xef')][_0x014a('0xb9')]({'where':{'service':!![]},'include':[{'model':db[_0x014a('0xf0')],'as':_0x014a('0xf1'),'raw':!![]}]});}}})[_0x014a('0x1e')](function(_0x4ad0c6){if(_0x4ad0c6&&_0x4ad0c6[_0x014a('0xf1')]&&_0x5b82f2['body']){var _0x5f8d5b={'tls':{'rejectUnauthorized':![]}};if(_0x4ad0c6[_0x014a('0xf1')]['service']){_0x5f8d5b[_0x014a('0xf2')]=_0x4ad0c6[_0x014a('0xf1')][_0x014a('0xf2')];}else{_0x5f8d5b[_0x014a('0xf3')]=_0x4ad0c6[_0x014a('0xf1')]['host'];_0x5f8d5b[_0x014a('0xf4')]=_0x4ad0c6[_0x014a('0xf1')][_0x014a('0xf4')];_0x5f8d5b[_0x014a('0xf5')]=_0x4ad0c6[_0x014a('0xf1')][_0x014a('0xf5')];}if(_0x4ad0c6[_0x014a('0xf1')][_0x014a('0xf6')]){_0x5f8d5b['auth']={'user':_0x4ad0c6[_0x014a('0xf1')]['user'],'pass':_0x4ad0c6[_0x014a('0xf1')][_0x014a('0xf7')]};}return respondWithRpcPromise(_0x014a('0xf8'),_0x014a('0xf9'),{'account':_0x5f8d5b,'message':{'from':util[_0x014a('0xe2')](_0x014a('0xfa'),_0x4ad0c6['name'],_0x4ad0c6[_0x014a('0xc0')]||_0x4ad0c6['Smtp'][_0x014a('0x98')]),'to':_0x5b82f2[_0x014a('0x7b')][_0x014a('0xfb')],'subject':_0x014a('0xfc'),'text':util[_0x014a('0xe2')](_0x014a('0xfd'),_0x5b82f2[_0x014a('0x7b')][_0x014a('0xfb')]),'attachments':[{'path':_0x34b528}]}})['then'](function(){return _0x24e9d7;})['catch'](function(_0xac886c){console[_0x014a('0x24')](_0xac886c);});}else{return _0x24e9d7;}})[_0x014a('0x1e')](respondWithStatusCode(_0x2b622f,0xc8))[_0x014a('0x28')](handleError(_0x2b622f,null));};exports[_0x014a('0xfe')]=function(_0x30aa7b,_0x451579,_0x3858a1){return db[_0x014a('0xe0')][_0x014a('0x6b')]({'where':{'id':_0x30aa7b[_0x014a('0xb2')]['id']}})[_0x014a('0x1e')](handleEntityNotFound(_0x451579,null))[_0x014a('0x1e')](function(_0x57bd30){if(_0x57bd30){return _0x57bd30[_0x014a('0xfe')](_0x30aa7b[_0x014a('0x7b')][_0x014a('0xff')],_['omit'](_0x30aa7b[_0x014a('0x7b')],[_0x014a('0xff'),'id'])||{});}})[_0x014a('0x1e')](respondWithResult(_0x451579,null))[_0x014a('0x28')](handleError(_0x451579,null));};exports[_0x014a('0x100')]=function(_0x36c94d,_0x44cb05,_0x30a903){var _0x3bb1f={'raw':![],'where':{}};var _0x4775a4={};var _0x13ec10={'count':0x0,'rows':[]};return db[_0x014a('0x47')]['findOne']({'where':{'id':_0x36c94d['params']['id']}})[_0x014a('0x1e')](handleEntityNotFound(_0x44cb05,null))[_0x014a('0x1e')](function(_0x4a361b){if(_0x4a361b){_0x4775a4[_0x014a('0x4b')]=_[_0x014a('0x7c')](db[_0x014a('0xe0')][_0x014a('0x48')]);_0x4775a4[_0x014a('0x4c')]=_[_0x014a('0x7c')](_0x36c94d[_0x014a('0x4c')]);_0x4775a4[_0x014a('0x4d')]=_['intersection'](_0x4775a4[_0x014a('0x4b')],_0x4775a4[_0x014a('0x4c')]);_0x3bb1f[_0x014a('0x4e')]=_[_0x014a('0xb3')](_0x4775a4['model'],qs[_0x014a('0x4f')](_0x36c94d[_0x014a('0x4c')][_0x014a('0x4f')]));_0x3bb1f['attributes']=_0x3bb1f[_0x014a('0x4e')][_0x014a('0x6f')]?_0x3bb1f['attributes']:_0x4775a4[_0x014a('0x4b')];if(!_0x36c94d[_0x014a('0x4c')][_0x014a('0x50')]('nolimit')){_0x3bb1f[_0x014a('0x2d')]=qs[_0x014a('0x2d')](_0x36c94d[_0x014a('0x4c')]['limit']);_0x3bb1f[_0x014a('0x2b')]=qs['offset'](_0x36c94d[_0x014a('0x4c')]['offset']);}_0x3bb1f[_0x014a('0x52')]=qs[_0x014a('0x53')](_0x36c94d['query'][_0x014a('0x53')]);_0x3bb1f['where']=qs[_0x014a('0x4d')](_[_0x014a('0x101')](_0x36c94d[_0x014a('0x4c')],_0x4775a4[_0x014a('0x4d')]));_0x3bb1f[_0x014a('0x80')]['ChatInteractionId']=_0x4a361b['id'];if(_0x36c94d[_0x014a('0x4c')][_0x014a('0x8c')]){_0x3bb1f[_0x014a('0x80')]=_['merge'](_0x3bb1f[_0x014a('0x80')],{'$or':_[_0x014a('0x40')](_0x3bb1f['attributes'],function(_0x565da5){var _0x309858={};_0x309858[_0x565da5]={'$like':'%'+_0x36c94d[_0x014a('0x4c')]['filter']+'%'};return _0x309858;})});}if(_0x36c94d[_0x014a('0x4c')]['$gte']){var _0x56bfaf=_0x36c94d[_0x014a('0x4c')][_0x014a('0x102')]['split'](',');var _0x5f14e4={};_0x5f14e4[_0x56bfaf[0x0]]={'$gte':moment(_0x56bfaf[0x1])['format'](_0x014a('0x103'))};_0x3bb1f[_0x014a('0x80')]=_[_0x014a('0x3a')](_0x3bb1f['where'],_0x5f14e4);}_0x3bb1f=_['merge']({},_0x3bb1f,_0x36c94d[_0x014a('0xb6')]);return db['ChatMessage'][_0x014a('0x2e')]({'where':_0x3bb1f[_0x014a('0x80')]})['then'](function(_0x4acfe9){_0x13ec10[_0x014a('0x2e')]=_0x4acfe9;if(_0x36c94d[_0x014a('0x4c')]['includeAll']){_0x3bb1f[_0x014a('0xb5')]=[{'all':!![]}];}return db['ChatMessage'][_0x014a('0x104')](_0x3bb1f);})['then'](function(_0x8c21a7){_0x13ec10[_0x014a('0xb0')]=_0x8c21a7;return _0x13ec10;});}})[_0x014a('0x1e')](respondWithFilteredResult(_0x44cb05,_0x3bb1f))[_0x014a('0x28')](handleError(_0x44cb05,null));};exports[_0x014a('0x105')]=function(_0x260f79,_0x68de07,_0x4126a3){var _0x4f1f23={'where':{}},_0x1ef9b0={},_0x11d0e9={'count':0x0,'rows':[]};return db[_0x014a('0x47')][_0x014a('0xb9')]({'where':{'id':_0x260f79[_0x014a('0xb2')]['id']}})[_0x014a('0x1e')](handleEntityNotFound(_0x68de07,null))[_0x014a('0x1e')](function(_0x4f7960){if(_0x4f7960){_0x1ef9b0['model']=_[_0x014a('0x7c')](db[_0x014a('0xe0')][_0x014a('0x48')]);_0x1ef9b0[_0x014a('0x4c')]=_[_0x014a('0x7c')](_0x260f79[_0x014a('0x4c')]);_0x1ef9b0[_0x014a('0x4d')]=_[_0x014a('0xb3')](_0x1ef9b0[_0x014a('0x4b')],_0x1ef9b0[_0x014a('0x4c')]);_0x4f1f23[_0x014a('0x4e')]=_['intersection'](_0x1ef9b0[_0x014a('0x4b')],qs[_0x014a('0x4f')](_0x260f79[_0x014a('0x4c')][_0x014a('0x4f')]));_0x4f1f23[_0x014a('0x4e')]=_0x4f1f23[_0x014a('0x4e')][_0x014a('0x6f')]?_0x4f1f23['attributes']:_0x1ef9b0['model'];if(!_0x260f79[_0x014a('0x4c')][_0x014a('0x50')](_0x014a('0x51'))){_0x4f1f23[_0x014a('0x2d')]=qs[_0x014a('0x2d')](_0x260f79['query'][_0x014a('0x2d')]);_0x4f1f23[_0x014a('0x2b')]=qs['offset'](_0x260f79[_0x014a('0x4c')][_0x014a('0x2b')]);}_0x4f1f23[_0x014a('0x52')]=qs['sort'](_0x260f79[_0x014a('0x4c')][_0x014a('0x53')]);_0x4f1f23[_0x014a('0x80')]=qs['filters'](_[_0x014a('0x101')](_0x260f79[_0x014a('0x4c')],_0x1ef9b0['filters']));_0x4f1f23[_0x014a('0x80')][_0x014a('0xaf')]=_0x4f7960['id'];if(_0x260f79[_0x014a('0x4c')]['filter']){_0x4f1f23[_0x014a('0x80')]=_['merge'](_0x4f1f23['where'],{'$or':_['map'](_0x4f1f23['attributes'],function(_0xf3e4fb){var _0x126084={};_0x126084[_0xf3e4fb]={'$like':'%'+_0x260f79[_0x014a('0x4c')][_0x014a('0x8c')]+'%'};return _0x126084;})});}_0x4f1f23[_0x014a('0x80')][_0x014a('0xed')]=![];if(_0x260f79[_0x014a('0x4c')]['id']){_0x4f1f23['where']['id']={'$gt':_0x260f79[_0x014a('0x4c')]['id']};}_0x4f1f23=_['merge']({},_0x4f1f23,_0x260f79[_0x014a('0xb6')]);return db[_0x014a('0xe0')][_0x014a('0x2e')]({'where':_0x4f1f23['where']})[_0x014a('0x1e')](function(_0x58421d){_0x11d0e9['count']=_0x58421d;_0x4f1f23[_0x014a('0xb5')]=[];if(_0x260f79[_0x014a('0x4c')][_0x014a('0x106')]){_0x4f1f23['include']['push']({'model':db[_0x014a('0x76')],'as':_0x014a('0x76'),'attributes':['id',_0x014a('0x41'),_0x014a('0xe9')]});}if(_0x260f79[_0x014a('0x4c')][_0x014a('0xb4')]){_0x4f1f23['include']=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x4f1f23);})[_0x014a('0x1e')](function(_0x40a47f){_0x11d0e9[_0x014a('0xb0')]=_0x40a47f;return _0x11d0e9;});}})['then'](respondWithFilteredResult(_0x68de07,_0x4f1f23))[_0x014a('0x28')](handleError(_0x68de07,null));};exports[_0x014a('0x107')]=function(_0x8a099,_0x81208d,_0x320be9){return db[_0x014a('0x47')][_0x014a('0x6b')]({'where':{'id':_0x8a099[_0x014a('0xb2')]['id']}})['then'](handleEntityNotFound(_0x81208d,null))[_0x014a('0x1e')](function(_0x46a2c5){if(_0x46a2c5){return _0x46a2c5['setTags'](_0x8a099[_0x014a('0x7b')][_0x014a('0xff')],_[_0x014a('0x108')](_0x8a099['body'],[_0x014a('0xff'),'id'])||{})[_0x014a('0x109')](function(){return db['Tag'][_0x014a('0x104')]({'attributes':['id','name',_0x014a('0x55')],'where':{'id':_0x8a099[_0x014a('0x7b')][_0x014a('0xff')]}});})[_0x014a('0x1e')](function(_0x4f56a9){socket['emit'](_0x014a('0x10a'),{'id':Number(_0x8a099[_0x014a('0xb2')]['id']),'tags':_0x4f56a9||[]});return{'id':Number(_0x8a099[_0x014a('0xb2')]['id']),'tags':_0x4f56a9||[]};});}})[_0x014a('0x1e')](respondWithResult(_0x81208d,null))[_0x014a('0x28')](handleError(_0x81208d,null));};exports[_0x014a('0x10b')]=function(_0x32ba5d,_0x120047,_0x570898){return db['ChatInteraction']['find']({'where':{'id':_0x32ba5d[_0x014a('0xb2')]['id']}})[_0x014a('0x1e')](handleEntityNotFound(_0x120047,null))[_0x014a('0x1e')](function(_0x47cd44){if(_0x47cd44){return _0x47cd44[_0x014a('0x10b')](_0x32ba5d[_0x014a('0x4c')][_0x014a('0xff')]);}})['then'](respondWithStatusCode(_0x120047,null))[_0x014a('0x28')](handleError(_0x120047,null));};exports['download']=function(_0x546af7,_0x4c492f){var _0x331ba9=moment()['unix']()[_0x014a('0x9d')]();var _0x3e7923=path['join'](config[_0x014a('0xd9')],'server',_0x014a('0x10c'),'tmp');var _0x387e49=path[_0x014a('0xd8')](config[_0x014a('0xd9')],_0x014a('0x10d'),_0x014a('0x10c'),_0x014a('0x10e'));var _0x1c5606=path['join'](_0x3e7923,_0x331ba9);var _0x4b4336=util[_0x014a('0xe2')]('transcript-%d-%s.zip',_0x546af7[_0x014a('0xb2')]['id'],_0x331ba9);var _0x1b3f4d=path[_0x014a('0xd8')](_0x3e7923,_0x4b4336);var _0x5f58bd=[];_0x5f58bd[_0x014a('0x46')]({'model':db[_0x014a('0x76')],'as':'User','attributes':['id',_0x014a('0x41')],'raw':!![]});_0x5f58bd[_0x014a('0x46')]({'model':db[_0x014a('0xca')],'as':_0x014a('0xcb'),'attributes':['id',_0x014a('0x10f'),_0x014a('0x110')],'raw':!![]});if(_0x546af7[_0x014a('0x4c')]['attachments']){_0x5f58bd[_0x014a('0x46')]({'model':db[_0x014a('0xd4')],'as':'Attachment','raw':!![]});}var _0x5104b1=[{'model':db[_0x014a('0xe0')],'as':_0x014a('0xe1'),'attributes':['id',_0x014a('0x7b'),_0x014a('0xeb'),'direction',_0x014a('0xed'),_0x014a('0x87')],'include':_0x5f58bd}];_0x5104b1[_0x014a('0x46')]({'model':db[_0x014a('0xba')],'as':_0x014a('0x111'),'attributes':['id',_0x014a('0x38')]});_0x5104b1['push']({'model':db['User'],'as':'Owner','attributes':['id',_0x014a('0x41')]});return db['ChatInteraction'][_0x014a('0x6b')]({'where':{'id':_0x546af7[_0x014a('0xb2')]['id']},'include':_0x5104b1})[_0x014a('0x1e')](handleEntityNotFound(_0x4c492f,null))['then'](function(_0x501d05){if(_0x501d05){var _0x48c669=_0x501d05[_0x014a('0x112')]({'plain':!![]});fs['mkdirSync'](_0x1c5606);var _0x5d4bae={'channel':_0x014a('0x113'),'account':_0x48c669[_0x014a('0x111')][_0x014a('0x38')],'agent':_0x48c669[_0x014a('0x114')]?_0x48c669[_0x014a('0x114')][_0x014a('0x41')]:_0x014a('0x115'),'createdAt':moment(_0x48c669[_0x014a('0xeb')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x48c669['closed']?moment(_0x48c669[_0x014a('0x116')])[_0x014a('0xe2')](_0x014a('0x103'))[_0x014a('0x9d')]():'','disposition':_0x48c669[_0x014a('0xce')],'chatInfo':{'browser':_0x48c669['browserName'],'os':_0x48c669[_0x014a('0x117')],'referer':_0x48c669[_0x014a('0x118')],'customerIp':_0x48c669['customerIp'],'customerPort':_0x48c669[_0x014a('0x119')]?_0x48c669[_0x014a('0x119')]:_0x014a('0x115')},'messages':_(_0x48c669[_0x014a('0xe1')])['tail']()[_0x014a('0x8c')]({'secret':![]})[_0x014a('0x40')](function(_0x5afb91){if(_0x5afb91[_0x014a('0xd4')]){var _0x172440=path[_0x014a('0xd8')](_0x387e49,_0x5afb91[_0x014a('0xd4')][_0x014a('0xd2')]);if(fs[_0x014a('0x11a')](_0x172440)){fs[_0x014a('0x11b')](_0x172440)[_0x014a('0x11c')](fs['createWriteStream'](path[_0x014a('0xd8')](_0x1c5606,_0x5afb91[_0x014a('0xd4')][_0x014a('0xd2')])));}}return{'date':moment(_0x5afb91['createdAt'])['format'](_0x014a('0x103'))[_0x014a('0x9d')](),'sender':_0x5afb91[_0x014a('0xec')]==='out'?_0x5afb91[_0x014a('0x76')]?_0x5afb91[_0x014a('0x76')][_0x014a('0x41')]:_0x014a('0xe4'):_0x5afb91[_0x014a('0xcb')][_0x014a('0x10f')]+(_0x5afb91[_0x014a('0xcb')][_0x014a('0x110')]?'\x20'+_0x5afb91[_0x014a('0xcb')][_0x014a('0x110')]:''),'body':_0x5afb91[_0x014a('0xd4')]?_0x5afb91[_0x014a('0xd4')][_0x014a('0xd2')]:_0x5afb91[_0x014a('0x7b')],'direction':_0x5afb91[_0x014a('0xec')]===_0x014a('0x11d')?'A':'C','secret':_0x5afb91[_0x014a('0xed')],'read':_0x5afb91['read'],'attachment':_0x5afb91[_0x014a('0xd4')]};})[_0x014a('0x6d')]()};return ejs['renderFile'](path['join'](config['root'],_0x014a('0x10d'),_0x014a('0x11e'),'downloadInteraction.ejs'),{'interaction':_0x5d4bae})['then'](function(_0x374e3d){var _0x2d9178=path['join'](_0x1c5606,_0x014a('0x11f')+_0x48c669['id']+'-'+_0x331ba9+'.pdf');var _0x30c604={'path':_0x2d9178,'channel':'Chat','interactionId':_0x48c669['id']};return pdf['createPdfFromHTML'](_0x374e3d,_0x30c604);})[_0x014a('0x1e')](function(){return new BPromise(function(_0x321a17,_0x2f20e7){zipdir(_0x1c5606,{'saveTo':_0x1b3f4d},function(_0x18edd1,_0xcad1af){if(_0x18edd1)return _0x2f20e7(_0x18edd1);return _0x321a17(_0xcad1af);});})['then'](function(){return new BPromise(function(_0x42cd23,_0x82d77b){rimraf(_0x1c5606,function(_0x48bcec){if(_0x48bcec)_0x82d77b(_0x48bcec);return _0x42cd23();});});})[_0x014a('0x1e')](function(){return _0x4c492f[_0x014a('0xdc')](_0x1b3f4d,_0x4b4336,function(_0x1d8179){if(_0x1d8179){console[_0x014a('0x120')](_0x014a('0x121'),_0x1d8179);}else{fs[_0x014a('0x122')](_0x1b3f4d);}});});});}else{return _0x4c492f[_0x014a('0x36')](0xc8);}})['catch'](handleError(_0x4c492f,null));}; \ No newline at end of file +var _0x4fc2=['result','catch','sendStatus','end','status','json','offset','undefined','count','Content-Range','apply','reject','save','update','destroy','stack','name','send','render','merge','body','contact','agent','interaction','account','map','fullname','TagIds','Tags','split','forEach','push','ChatInteraction','rawAttributes','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','select','field','color','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','search','parseSearch','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','having','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','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','keys','some','compact','isEmpty','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','DESC','t.id\x20IN\x20?','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','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.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','params','includeAll','options','create','describe','createVidaooSession','findOne','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','metadata','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','attachmentUpload','file','originalname','filename','mimetype','Attachment','Unauthorized','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','basename','download','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','Messages','User','ChatWebsite','%s%d','agentAlias','System','customer','website_alias','alias','agent_fullname','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','pick','YYYY-MM-DD\x20HH:mm:ss','include','findAll','getMyMessages','includeAgent','addTags','setTags','spread','Tag','removeTags','unix','server','files','attachments','transcript-%d-%s.zip','firstName','lastName','direction','Account','Owner','mkdirSync','N.A.','closedAt','customerIp','customerPort','existsSync','createWriteStream','out','renderFile','downloadInteraction.ejs','transcript-','.pdf','Chat','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','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','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message'];(function(_0x1b0ccc,_0x5eae42){var _0x95652f=function(_0x6aa6c2){while(--_0x6aa6c2){_0x1b0ccc['push'](_0x1b0ccc['shift']());}};_0x95652f(++_0x5eae42);}(_0x4fc2,0x111));var _0x24fc=function(_0x143a91,_0x235332){_0x143a91=_0x143a91-0x0;var _0x1906f5=_0x4fc2[_0x143a91];return _0x1906f5;};'use strict';var emlformat=require(_0x24fc('0x0'));var rimraf=require(_0x24fc('0x1'));var zipdir=require(_0x24fc('0x2'));var jsonpatch=require(_0x24fc('0x3'));var rp=require('request-promise');var moment=require(_0x24fc('0x4'));var BPromise=require(_0x24fc('0x5'));var Mustache=require(_0x24fc('0x6'));var util=require('util');var path=require(_0x24fc('0x7'));var sox=require(_0x24fc('0x8'));var csv=require('to-csv');var ejs=require(_0x24fc('0x9'));var fs=require('fs');var fs_extra=require(_0x24fc('0xa'));var _=require('lodash');var squel=require(_0x24fc('0xb'));var crypto=require(_0x24fc('0xc'));var jsforce=require(_0x24fc('0xd'));var deskjs=require(_0x24fc('0xe'));var toCsv=require(_0x24fc('0xf'));var querystring=require(_0x24fc('0x10'));var Papa=require('papaparse');var Redis=require(_0x24fc('0x11'));var authService=require(_0x24fc('0x12'));var qs=require(_0x24fc('0x13'));var as=require(_0x24fc('0x14'));var pdf=require(_0x24fc('0x15'));var hardwareService=require(_0x24fc('0x16'));var logger=require(_0x24fc('0x17'))(_0x24fc('0x18'));var utils=require('../../config/utils');var config=require(_0x24fc('0x19'));var licenseUtil=require(_0x24fc('0x1a'));var db=require('../../mysqldb')['db'];config[_0x24fc('0x1b')]=_[_0x24fc('0x1c')](config[_0x24fc('0x1b')],{'host':_0x24fc('0x1d'),'port':0x18eb});var socket=require(_0x24fc('0x1e'))(new Redis(config[_0x24fc('0x1b')]));require('./chatInteraction.socket')[_0x24fc('0x1f')](socket);var jayson=require(_0x24fc('0x20'));var client=jayson[_0x24fc('0x21')][_0x24fc('0x22')]({'port':0x232b});var client9004=jayson['client'][_0x24fc('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x588543,_0x4af098,_0x3385c7,_0x218fb6){return new BPromise(function(_0x41c593,_0x25cb40){var _0x52a884=_0x218fb6||client;return _0x52a884[_0x24fc('0x23')](_0x588543,_0x3385c7)[_0x24fc('0x24')](function(_0x6cfa0a){logger[_0x24fc('0x25')]('ChatInteraction,\x20%s,\x20%s',_0x4af098,_0x24fc('0x26'));logger[_0x24fc('0x27')](_0x24fc('0x28'),_0x4af098,'request\x20sent',JSON[_0x24fc('0x29')](_0x6cfa0a));if(_0x6cfa0a[_0x24fc('0x2a')]){if(_0x6cfa0a[_0x24fc('0x2a')][_0x24fc('0x2b')]===0x1f4){logger['error'](_0x24fc('0x2c'),_0x4af098,_0x6cfa0a['error'][_0x24fc('0x2d')]);return _0x25cb40(_0x6cfa0a['error'][_0x24fc('0x2d')]);}logger[_0x24fc('0x2a')](_0x24fc('0x2c'),_0x4af098,_0x6cfa0a['error'][_0x24fc('0x2d')]);return _0x41c593(_0x6cfa0a['error'][_0x24fc('0x2d')]);}else{logger[_0x24fc('0x25')](_0x24fc('0x2c'),_0x4af098,_0x24fc('0x26'));_0x41c593(_0x6cfa0a[_0x24fc('0x2e')][_0x24fc('0x2d')]);}})[_0x24fc('0x2f')](function(_0x20192b){logger[_0x24fc('0x2a')](_0x24fc('0x2c'),_0x4af098,_0x20192b);_0x25cb40(_0x20192b);});});}function respondWithStatusCode(_0x568441,_0x11c913){_0x11c913=_0x11c913||0xcc;return function(_0x16f27f){if(_0x16f27f){return _0x568441[_0x24fc('0x30')](_0x11c913);}return _0x568441['status'](_0x11c913)[_0x24fc('0x31')]();};}function respondWithResult(_0x3d1ec8,_0x35f9f9){_0x35f9f9=_0x35f9f9||0xc8;return function(_0x290f84){if(_0x290f84){return _0x3d1ec8[_0x24fc('0x32')](_0x35f9f9)[_0x24fc('0x33')](_0x290f84);}};}function respondWithFilteredResult(_0x5ac1f2,_0x240ae7){return function(_0x29a461){if(_0x29a461){var _0x3c99ed=typeof _0x240ae7[_0x24fc('0x34')]===_0x24fc('0x35')&&typeof _0x240ae7['limit']==='undefined';var _0x4e6f73=_0x29a461[_0x24fc('0x36')];var _0x574ba3=_0x3c99ed?0x0:_0x240ae7[_0x24fc('0x34')];var _0x3e6389=_0x3c99ed?_0x29a461[_0x24fc('0x36')]:_0x240ae7[_0x24fc('0x34')]+_0x240ae7['limit'];var _0x66eec0;if(_0x3e6389>=_0x4e6f73){_0x3e6389=_0x4e6f73;_0x66eec0=0xc8;}else{_0x66eec0=0xce;}_0x5ac1f2[_0x24fc('0x32')](_0x66eec0);return _0x5ac1f2['set'](_0x24fc('0x37'),_0x574ba3+'-'+_0x3e6389+'/'+_0x4e6f73)[_0x24fc('0x33')](_0x29a461);}return null;};}function patchUpdates(_0x4d756f){return function(_0x48c62a){try{jsonpatch[_0x24fc('0x38')](_0x48c62a,_0x4d756f,!![]);}catch(_0x56eae7){return BPromise[_0x24fc('0x39')](_0x56eae7);}return _0x48c62a[_0x24fc('0x3a')]();};}function saveUpdates(_0x5491b0,_0x2ae896){return function(_0x33bbf2){if(_0x33bbf2){return _0x33bbf2[_0x24fc('0x3b')](_0x5491b0)[_0x24fc('0x24')](function(_0x1c5874){return _0x1c5874;});}return null;};}function removeEntity(_0x1e205d,_0x3b3932){return function(_0x2a209d){if(_0x2a209d){return _0x2a209d[_0x24fc('0x3c')]()['then'](function(){_0x1e205d[_0x24fc('0x32')](0xcc)[_0x24fc('0x31')]();});}};}function handleEntityNotFound(_0x2fbe30,_0x316aa2){return function(_0x242bd5){if(!_0x242bd5){_0x2fbe30['sendStatus'](0x194);}return _0x242bd5;};}function handleError(_0x56a9bd,_0xd52d10){_0xd52d10=_0xd52d10||0x1f4;return function(_0x5d48fe){logger[_0x24fc('0x2a')](_0x5d48fe[_0x24fc('0x3d')]);if(_0x5d48fe[_0x24fc('0x3e')]){delete _0x5d48fe[_0x24fc('0x3e')];}_0x56a9bd['status'](_0xd52d10)[_0x24fc('0x3f')](_0x5d48fe);};}function getMustacheRender(_0x4f4ec8,_0x65771d){return Mustache[_0x24fc('0x40')](_0x4f4ec8,_[_0x24fc('0x41')](_0x65771d[_0x24fc('0x42')],{'contact':_0x65771d[_0x24fc('0x43')],'message':_0x65771d['message'],'agent':_0x65771d[_0x24fc('0x44')],'interaction':_0x65771d[_0x24fc('0x45')],'account':_0x65771d[_0x24fc('0x46')]}))||'';}function getInteractionUsers(_0x22a75c,_0x5ceae2){return new BPromise(function(_0x172923,_0x2f0bd9){try{if(_0x5ceae2[_0x22a75c['id']]){_0x22a75c['Users']=_[_0x24fc('0x47')](_0x5ceae2[_0x22a75c['id']],function(_0x52df2e){return{'id':_0x52df2e['id'],'fullname':_0x52df2e[_0x24fc('0x48')]};});}}catch(_0x2fd30d){_0x2f0bd9(_0x2fd30d);}_0x172923(_0x22a75c);});}function getInteractionTags(_0x3a15ab,_0x1e045a){return new BPromise(function(_0x431189,_0x278b18){try{if(_0x3a15ab[_0x24fc('0x49')]){_0x3a15ab[_0x24fc('0x4a')]=[];_0x3a15ab['TagIds'][_0x24fc('0x4b')](',')[_0x24fc('0x4c')](function(_0x32f72c){_0x3a15ab['Tags'][_0x24fc('0x4d')](_0x1e045a[_0x32f72c]);});}delete _0x3a15ab[_0x24fc('0x49')];}catch(_0x4ae4a7){_0x278b18(_0x4ae4a7);}_0x431189(_0x3a15ab);});}function updateChatInteraction(_0x2c4a6c,_0x22f30b,_0x2c598c){return new BPromise(function(_0x5e4e9b,_0x31ddd0){return getInteractionUsers(_0x2c4a6c,_0x2c598c)[_0x24fc('0x24')](function(_0x585e48){return getInteractionTags(_0x585e48,_0x22f30b);})[_0x24fc('0x24')](function(_0x169982){_0x5e4e9b(_0x169982);})[_0x24fc('0x2f')](function(_0x2a0ac4){_0x31ddd0(_0x2a0ac4);});});}exports['index']=function(_0x2eecaf,_0x9bc56a){var _0x3ce7b3={},_0x7b38fa={},_0xbcbcfa={'count':0x0,'rows':[]};var _0x58a950=_[_0x24fc('0x47')](db[_0x24fc('0x4e')][_0x24fc('0x4f')],function(_0x3c6ffb){return{'name':_0x3c6ffb['fieldName'],'type':_0x3c6ffb[_0x24fc('0x50')][_0x24fc('0x51')]};});_0x7b38fa['model']=_['map'](_0x58a950,_0x24fc('0x3e'));_0x7b38fa['query']=_['keys'](_0x2eecaf[_0x24fc('0x52')]);_0x7b38fa['filters']=_[_0x24fc('0x53')](_0x7b38fa[_0x24fc('0x54')],_0x7b38fa[_0x24fc('0x52')]);_0x3ce7b3['attributes']=_[_0x24fc('0x53')](_0x7b38fa[_0x24fc('0x54')],qs[_0x24fc('0x55')](_0x2eecaf[_0x24fc('0x52')][_0x24fc('0x55')]));_0x3ce7b3[_0x24fc('0x56')]=_0x3ce7b3[_0x24fc('0x56')][_0x24fc('0x57')]?_0x3ce7b3['attributes']:_0x7b38fa['model'];if(!_0x2eecaf[_0x24fc('0x52')][_0x24fc('0x58')](_0x24fc('0x59'))){_0x3ce7b3['limit']=qs['limit'](_0x2eecaf[_0x24fc('0x52')][_0x24fc('0x5a')]);_0x3ce7b3[_0x24fc('0x34')]=qs[_0x24fc('0x34')](_0x2eecaf[_0x24fc('0x52')][_0x24fc('0x34')]);}_0x3ce7b3[_0x24fc('0x5b')]=qs[_0x24fc('0x5c')](_0x2eecaf[_0x24fc('0x52')][_0x24fc('0x5c')]);_0x3ce7b3[_0x24fc('0x5d')]=qs[_0x24fc('0x5e')](_['pick'](_0x2eecaf[_0x24fc('0x52')],_0x7b38fa[_0x24fc('0x5e')]),_0x58a950);var _0x32a466=[];var _0xb0fc00=squel[_0x24fc('0x5f')]()['field']('id')[_0x24fc('0x60')]('name')[_0x24fc('0x60')](_0x24fc('0x61'))[_0x24fc('0x62')](_0x24fc('0x63'));var _0x40f42b=squel[_0x24fc('0x5f')]()['field'](_0x24fc('0x64'))[_0x24fc('0x60')](_0x24fc('0x65'))[_0x24fc('0x60')](_0x24fc('0x66'))[_0x24fc('0x62')]('user_has_chat_interactions','ui')[_0x24fc('0x67')](_0x24fc('0x68'),'u',_0x24fc('0x69'));var _0x1b69ad=squel[_0x24fc('0x5f')]()[_0x24fc('0x62')](_0x24fc('0x6a'),'i')['left_join'](_0x24fc('0x6b'),'c',_0x24fc('0x6c'))['left_join'](_0x24fc('0x68'),'o',_0x24fc('0x6d'))[_0x24fc('0x67')](_0x24fc('0x6e'),'a',_0x24fc('0x6f'))[_0x24fc('0x67')]('chat_messages','me',_0x24fc('0x70'))['left_join'](_0x24fc('0x71'),'it',_0x24fc('0x72'))['left_join'](_0x24fc('0x63'),'t','t.id\x20=\x20it.TagId');var _0x1c1f74=squel['expr']();var _0xdff811=[];var _0x27b612=squel['expr']();var _0x2edef7;if(_0x2eecaf['query'][_0x24fc('0x73')]){_0x2edef7=as[_0x24fc('0x74')](_0x2eecaf['query'][_0x24fc('0x73')]);var _0x3ec1a8=_0x2edef7[_0x24fc('0x75')];for(var _0x47179d=0x0;_0x47179d<_0x2edef7[_0x24fc('0x76')]['length'];_0x47179d++){var _0x39da59=_0x2edef7[_0x24fc('0x76')][_0x47179d];var _0x2d657a='i';var _0x2b5dca=_[_0x24fc('0x77')](_0x58a950,['name',_0x39da59['field']]);if(!_0x2b5dca){switch(_0x39da59[_0x24fc('0x60')]){case _0x24fc('0x78'):if(_0x39da59['value']==0x1){_0x1b69ad['having']('`'+_0x39da59[_0x24fc('0x60')]+_0x24fc('0x79'));}else{_0x1b69ad[_0x24fc('0x7a')]('`'+_0x39da59[_0x24fc('0x60')]+'`\x20>\x200');}break;case _0x24fc('0x7b'):if(_0x39da59[_0x24fc('0x7c')]===_0x24fc('0x7d')){if(_0x39da59[_0x24fc('0x7e')][_0x24fc('0x4b')]('\x20')[_0x24fc('0x57')]>0x1){_0x1c1f74[_0x3ec1a8](_0x24fc('0x7f'),qs[_0x24fc('0x80')](_0x39da59[_0x24fc('0x7e')]),null);}else{var _0x1f6a71='%'+_0x39da59[_0x24fc('0x7e')]+'%';_0x1c1f74[_0x3ec1a8](_0x24fc('0x81'),_0x1f6a71,_0x1f6a71,_0x1f6a71);}}else{_0x2b5dca=_[_0x24fc('0x77')](_0x58a950,[_0x24fc('0x3e'),_0x24fc('0x82')]);_0x39da59['field']=_0x24fc('0x82');_0x10ef7c=as[_0x24fc('0x83')](_0x2d657a,_0x2b5dca[_0x24fc('0x50')],_0x39da59);_0x1c1f74[_0x3ec1a8](_0x10ef7c[_0x24fc('0x84')],_0x10ef7c[_0x24fc('0x7e')][_0x24fc('0x85')],_0x10ef7c[_0x24fc('0x7e')][_0x24fc('0x31')]);}break;case'Tag':var _0x3475b8=_0x39da59[_0x24fc('0x7e')][_0x24fc('0x4b')](',')[_0x24fc('0x47')](function(_0x55fceb){return Number(_0x55fceb);});_0x3475b8[_0x24fc('0x4c')](function(_0x29b381){_0x27b612['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x29b381+',%');});_0xdff811=_['union'](_0xdff811,_0x3475b8);break;case'User':if(_0x39da59[_0x24fc('0x7c')]===_0x24fc('0x7d')){_0x1c1f74[_0x3ec1a8](_0x24fc('0x86'),'%'+_0x39da59[_0x24fc('0x7e')]+'%',null);}else{_0x2b5dca=_[_0x24fc('0x77')](_0x58a950,[_0x24fc('0x3e'),'UserId']);_0x39da59[_0x24fc('0x60')]=_0x24fc('0x87');_0x10ef7c=as['buildExpression'](_0x2d657a,_0x2b5dca['type'],_0x39da59);_0x1c1f74[_0x3ec1a8](_0x10ef7c[_0x24fc('0x84')],_0x10ef7c[_0x24fc('0x7e')][_0x24fc('0x85')],_0x10ef7c['value'][_0x24fc('0x31')]);}break;case _0x24fc('0x42'):_0x10ef7c=as[_0x24fc('0x83')]('me',null,_0x39da59);_0x1c1f74[_0x3ec1a8](_0x10ef7c['text'],_0x10ef7c['value']['start'],_0x10ef7c['value']['end']);break;}}else{var _0x10ef7c=as[_0x24fc('0x83')](_0x2d657a,_0x2b5dca[_0x24fc('0x50')],_0x39da59);_0x1c1f74[_0x3ec1a8](_0x10ef7c[_0x24fc('0x84')],_0x10ef7c['value'][_0x24fc('0x85')],_0x10ef7c['value'][_0x24fc('0x31')]);}}}else{var _0x4e6eec=_(_0x2eecaf[_0x24fc('0x52')])[_0x24fc('0x88')]()[_0x24fc('0x47')](function(_0x4291bd){return _[_0x24fc('0x89')](_0x58a950,[_0x24fc('0x3e'),_0x4291bd])?_0x4291bd:undefined;})[_0x24fc('0x8a')]()['value']();if(!_[_0x24fc('0x8b')](_0x4e6eec)){_0x4e6eec[_0x24fc('0x4c')](function(_0x2de101){if(_0x2de101==='ChatWebsiteId'){_0x1b69ad['where'](_0x24fc('0x8c'),[][_0x24fc('0x8d')](_0x2eecaf['query'][_0x2de101]));}else if(_0x2de101===_0x24fc('0x8e')){var _0x1a2e6d=JSON['parse'](_0x2eecaf[_0x24fc('0x52')][_0x2de101])[_0x24fc('0x8f')];var _0x5249ea=JSON[_0x24fc('0x90')](_0x2eecaf[_0x24fc('0x52')][_0x2de101])[_0x24fc('0x91')];_0x1b69ad[_0x24fc('0x5d')](_0x24fc('0x92'),_0x1a2e6d,_0x5249ea);}else{if(_0x2eecaf[_0x24fc('0x52')][_0x2de101]==='null'){_0x1b69ad['where']('i.'+_0x2de101+_0x24fc('0x93'));}else{_0x1b69ad['where']('i.'+_0x2de101+_0x24fc('0x94'),_0x2eecaf['query'][_0x2de101]);}}});}if(_0x2eecaf['query'][_0x24fc('0x95')]){if(_0x2eecaf[_0x24fc('0x52')][_0x24fc('0x95')]==0x1){_0x1b69ad[_0x24fc('0x7a')](_0x24fc('0x96'));}else{_0x1b69ad[_0x24fc('0x7a')](_0x24fc('0x97'));}}if(_0x2eecaf[_0x24fc('0x52')]['tag']){_0xdff811=_[_0x24fc('0x98')](_0x2eecaf[_0x24fc('0x52')]['tag'])?_0x2eecaf['query'][_0x24fc('0x99')]:new Array(_0x2eecaf[_0x24fc('0x52')][_0x24fc('0x99')]);_0xdff811[_0x24fc('0x4c')](function(_0xd1e6){_0x27b612['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xd1e6+',%');});}if(_0x2eecaf[_0x24fc('0x52')][_0x24fc('0x9a')]){var _0x5ca35b=_0x2eecaf[_0x24fc('0x52')][_0x24fc('0x9a')][_0x24fc('0x9b')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x24fc('0x9c')](_0x5ca35b)){_0x1c1f74['or'](_0x24fc('0x9d'),_0x5ca35b+'%');}else{_0x1c1f74['or'](_0x24fc('0x9e'),qs[_0x24fc('0x80')](_0x5ca35b))['or'](_0x24fc('0x9f'),_0x5ca35b+'%');}}}_0x1b69ad[_0x24fc('0x5d')](_0x1c1f74);_0x1b69ad[_0x24fc('0xa0')](_0x24fc('0xa1'));var _0x188edb={'type':db['Sequelize'][_0x24fc('0xa2')][_0x24fc('0xa3')],'raw':!![]};var _0x1dcccf=_0x1b69ad['clone']();_0x1dcccf['field']('i.id');_0x1dcccf[_0x24fc('0x60')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x24fc('0x78'));if(_0x3ce7b3[_0x24fc('0x5b')]){_0x3ce7b3['order'][_0x24fc('0x4c')](function(_0x559692){var _0x41cef7=_0x559692[0x0]==='contactName'?_0x559692[0x0]:'i.'+_0x559692[0x0];_0x1b69ad[_0x24fc('0x5b')](_0x41cef7,_0x559692[0x1]===_0x24fc('0xa4')?![]:!![]);});}if(!_[_0x24fc('0x8b')](_0xdff811)){_0x1b69ad[_0x24fc('0x7a')](_0x27b612);_0x1dcccf[_0x24fc('0x5d')](_0x24fc('0xa5'),_0xdff811);}BPromise['resolve']()[_0x24fc('0x24')](function(){if(!_0x2edef7){if(_0x2eecaf[_0x24fc('0x52')][_0x24fc('0xa6')])return;_0x1dcccf[_0x24fc('0x5d')](_0x24fc('0xa7'));_0x1b69ad[_0x24fc('0x5d')](_0x24fc('0xa7'));return;}if(_0x2eecaf[_0x24fc('0xa8')][_0x24fc('0xa9')]!=='agent')return;return _0x2eecaf[_0x24fc('0xa8')][_0x24fc('0xaa')]({'attributes':['id'],'raw':!![]})[_0x24fc('0x24')](function(_0x30ed50){if(_['isEmpty'](_0x30ed50)){_0x1dcccf[_0x24fc('0x5d')](_0x24fc('0xab'));_0x1b69ad[_0x24fc('0x5d')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x1dcccf[_0x24fc('0x5d')]('i.ChatWebsiteId\x20IN\x20?',_['map'](_0x30ed50,'id'));_0x1b69ad['where'](_0x24fc('0x8c'),_['map'](_0x30ed50,'id'));}});})[_0x24fc('0x24')](function(){if(_0x2eecaf[_0x24fc('0xa8')][_0x24fc('0xa9')]===_0x24fc('0x44')&&!_0x2edef7&&!_0x2eecaf['query'][_0x24fc('0xa6')])return[];return db[_0x24fc('0xac')][_0x24fc('0x52')](_0x1dcccf[_0x24fc('0xad')](),_0x188edb);})[_0x24fc('0x24')](function(_0x5c80a5){_0xbcbcfa[_0x24fc('0x36')]=_0x5c80a5[_0x24fc('0x57')];if(_0xbcbcfa[_0x24fc('0x36')]===0x0)return[];return db[_0x24fc('0xac')]['query'](_0xb0fc00['toString'](),_0x188edb)[_0x24fc('0x24')](function(_0x4216da){_0x32a466=_[_0x24fc('0xae')](_0x4216da,'id');_0x188edb=_[_0x24fc('0x41')](_0x188edb,{'model':db[_0x24fc('0x4e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2eecaf['query'][_0x24fc('0x55')]){_0x3ce7b3[_0x24fc('0x56')][_0x24fc('0x4c')](function(_0x5d5a59){_0x1b69ad[_0x24fc('0x60')]('i.'+_0x5d5a59);});}else{_0x1b69ad[_0x24fc('0x60')](_0x24fc('0xaf'),_0x24fc('0x78'));_0x1b69ad[_0x24fc('0x60')]('a.key','Account.key');_0x1b69ad['field'](_0x24fc('0xb0'),_0x24fc('0xb1'));_0x1b69ad[_0x24fc('0x60')](_0x24fc('0xb2'),_0x24fc('0xb3'));_0x1b69ad[_0x24fc('0x60')](_0x24fc('0xb4'));_0x1b69ad[_0x24fc('0x60')](_0x24fc('0xb5'),_0x24fc('0xb6'));_0x1b69ad[_0x24fc('0x60')](_0x24fc('0xb7'),'Contact.lastName');_0x1b69ad['field'](_0x24fc('0xb8'),'Contact.email');_0x1b69ad[_0x24fc('0x60')](_0x24fc('0xb9'),_0x24fc('0xba'));_0x1b69ad[_0x24fc('0x60')](_0x24fc('0xbb'),_0x24fc('0xbc'));_0x1b69ad[_0x24fc('0x60')](_0x24fc('0xbd'),_0x24fc('0xbe'));_0x1b69ad['field'](_0x24fc('0xbf'),_0x24fc('0xc0'));_0x1b69ad['field']('o.internal',_0x24fc('0xc1'));_0x1b69ad[_0x24fc('0x60')](_0x24fc('0xc2'),_0x24fc('0x49'));}if(_0x3ce7b3[_0x24fc('0x5a')])_0x1b69ad[_0x24fc('0x5a')](_0x3ce7b3['limit']);if(_0x3ce7b3[_0x24fc('0x34')])_0x1b69ad[_0x24fc('0x34')](_0x3ce7b3[_0x24fc('0x34')]);return db[_0x24fc('0xac')]['query'](_0x1b69ad[_0x24fc('0xad')](),_0x188edb);})[_0x24fc('0x24')](function(_0x1506e8){if(_0x1506e8['length']>0x0)_0x40f42b[_0x24fc('0x5d')](_0x24fc('0xc3'),_[_0x24fc('0x47')](_0x1506e8,'id'));return db['sequelize'][_0x24fc('0x52')](_0x40f42b[_0x24fc('0xad')](),_0x188edb)['then'](function(_0x543db4){var _0x283251=_[_0x24fc('0xc4')](_0x543db4,_0x24fc('0xc5'));var _0x2029cd=[];_0x1506e8[_0x24fc('0x4c')](function(_0x3afe80){_0x2029cd['push'](updateChatInteraction(_0x3afe80,_0x32a466,_0x283251));});return BPromise[_0x24fc('0xc6')](_0x2029cd);});});})[_0x24fc('0x24')](function(_0x17a6a9){_0xbcbcfa[_0x24fc('0xc7')]=_0x17a6a9;return _0xbcbcfa;})[_0x24fc('0x24')](respondWithFilteredResult(_0x9bc56a,_0x3ce7b3))[_0x24fc('0x2f')](handleError(_0x9bc56a,null));};exports['show']=function(_0x4018d3,_0x4a2522){var _0x5226aa={'raw':![],'where':{'id':_0x4018d3[_0x24fc('0xc8')]['id']}},_0x260a62={};_0x260a62['model']=_[_0x24fc('0x88')](db[_0x24fc('0x4e')][_0x24fc('0x4f')]);_0x260a62[_0x24fc('0x52')]=_['keys'](_0x4018d3[_0x24fc('0x52')]);_0x260a62[_0x24fc('0x5e')]=_[_0x24fc('0x53')](_0x260a62[_0x24fc('0x54')],_0x260a62[_0x24fc('0x52')]);_0x5226aa[_0x24fc('0x56')]=_['intersection'](_0x260a62['model'],qs['fields'](_0x4018d3[_0x24fc('0x52')][_0x24fc('0x55')]));_0x5226aa['attributes']=_0x5226aa[_0x24fc('0x56')][_0x24fc('0x57')]?_0x5226aa[_0x24fc('0x56')]:_0x260a62['model'];if(_0x4018d3[_0x24fc('0x52')][_0x24fc('0xc9')]){_0x5226aa['include']=[{'all':!![]}];}_0x5226aa=_['merge']({},_0x5226aa,_0x4018d3[_0x24fc('0xca')]);return db[_0x24fc('0x4e')][_0x24fc('0x77')](_0x5226aa)['then'](handleEntityNotFound(_0x4a2522,null))[_0x24fc('0x24')](respondWithResult(_0x4a2522,null))['catch'](handleError(_0x4a2522,null));};exports['create']=function(_0x344c0f,_0x52484a){return db['ChatInteraction'][_0x24fc('0xcb')](_0x344c0f['body'],{})[_0x24fc('0x24')](respondWithResult(_0x52484a,0xc9))[_0x24fc('0x2f')](handleError(_0x52484a,null));};exports[_0x24fc('0x3b')]=function(_0x11eaeb,_0x4ae346){if(_0x11eaeb[_0x24fc('0x42')]['id']){delete _0x11eaeb[_0x24fc('0x42')]['id'];}return db['ChatInteraction'][_0x24fc('0x77')]({'where':{'id':_0x11eaeb[_0x24fc('0xc8')]['id']}})[_0x24fc('0x24')](handleEntityNotFound(_0x4ae346,null))[_0x24fc('0x24')](saveUpdates(_0x11eaeb[_0x24fc('0x42')],null))['then'](respondWithResult(_0x4ae346,null))[_0x24fc('0x2f')](handleError(_0x4ae346,null));};exports[_0x24fc('0x3c')]=function(_0x5793d9,_0x759d35){return db[_0x24fc('0x4e')][_0x24fc('0x77')]({'where':{'id':_0x5793d9[_0x24fc('0xc8')]['id']}})[_0x24fc('0x24')](handleEntityNotFound(_0x759d35,null))['then'](removeEntity(_0x759d35,null))[_0x24fc('0x2f')](handleError(_0x759d35,null));};exports['describe']=function(_0x5c8969,_0x42c158){return db[_0x24fc('0x4e')][_0x24fc('0xcc')]()['then'](respondWithResult(_0x42c158,null))['catch'](handleError(_0x42c158,null));};exports[_0x24fc('0xcd')]=function(_0x38fba8,_0xfa9d58){var _0x353a64=_0x38fba8[_0x24fc('0xc8')]['id'];var _0x4ee1ad;var _0x4875bd;var _0x1efb25;return db['ChatInteraction']['findOne']({'where':{'id':_0x353a64}})[_0x24fc('0x24')](function(_0x484775){_0x4ee1ad=_0x484775;return db['ChatWebsite'][_0x24fc('0xce')]({'where':{'id':_0x484775[_0x24fc('0xa6')]},'attributes':['id',_0x24fc('0xcf'),_0x24fc('0xd0'),_0x24fc('0xd1'),_0x24fc('0xd2'),_0x24fc('0xd3')],'raw':!![]});})['then'](function(_0x3b2891){if(_0x3b2891&&_0x3b2891[_0x24fc('0xcf')]&&_0x3b2891[_0x24fc('0xd0')]){_0x4875bd=_0x3b2891;var _0x6e3447={'interaction':{'id':_0x353a64},'agent':{'id':_0x38fba8[_0x24fc('0xa8')]['id'],'name':_0x38fba8[_0x24fc('0xa8')][_0x24fc('0x3e')],'fullname':_0x38fba8[_0x24fc('0xa8')][_0x24fc('0x48')],'email':_0x38fba8[_0x24fc('0xa8')][_0x24fc('0xd4')]},'contact':_0x38fba8[_0x24fc('0x42')][_0x24fc('0x43')],'account':_0x38fba8[_0x24fc('0x42')][_0x24fc('0x46')]};var _0x38ec08={'rejectUnauthorized':![],'method':_0x24fc('0xd5'),'url':_0x24fc('0xd6'),'headers':{'X-APIKEY':_0x3b2891[_0x24fc('0xcf')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x38fba8[_0x24fc('0xa8')][_0x24fc('0xd4')]],'buttons':null,'topic':_0x4875bd[_0x24fc('0xd1')],'note':_[_0x24fc('0xd7')](_0x4875bd[_0x24fc('0xd2')])?null:getMustacheRender(_0x4875bd[_0x24fc('0xd2')],_0x6e3447),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x24fc('0xd7')](_0x4875bd[_0x24fc('0xd3')])){var _0x1d8a8f=getMustacheRender(_0x4875bd[_0x24fc('0xd3')],_0x6e3447);var _0x534388=JSON['parse'](_0x1d8a8f);_0x38ec08['body'][_0x24fc('0xd8')]=_0x534388;}}catch(_0x5aa947){throw new db[(_0x24fc('0xd9'))]['ValidationError'](_0x24fc('0xda'));}return rp(_0x38ec08);}else{throw new db[(_0x24fc('0xd9'))][(_0x24fc('0xdb'))](_0x24fc('0xdc'));}})[_0x24fc('0x24')](function(_0x468477){_0x1efb25=_0x468477;if(_0x1efb25['id']){var _0x1c4ac1={'body':_0x1efb25[_0x24fc('0xdd')],'ChatWebsiteId':_0x4875bd['id'],'ChatInteractionId':_0x4ee1ad['id'],'direction':'out','UserId':_0x38fba8[_0x24fc('0xa8')]['id']};return db[_0x24fc('0xde')][_0x24fc('0xcb')](_0x1c4ac1,{});}else{throw new db[(_0x24fc('0xd9'))]['ValidationError'](_0x24fc('0xdf'));}})[_0x24fc('0x24')](function(){return _0x4ee1ad[_0x24fc('0xe0')]({'vidaooSessionId':_0x1efb25['id']});})[_0x24fc('0x24')](respondWithResult(_0xfa9d58,null))[_0x24fc('0x2f')](handleError(_0xfa9d58,null));};exports[_0x24fc('0xe1')]=function(_0x17280c,_0x13f9e3){if(_0x17280c[_0x24fc('0x42')]['id']){delete _0x17280c[_0x24fc('0x42')]['id'];}return db[_0x24fc('0x4e')][_0x24fc('0x77')]({'where':{'id':_0x17280c['params']['id']},'include':[{'model':db[_0x24fc('0xe2')],'as':_0x24fc('0x7b')}]})[_0x24fc('0x24')](handleEntityNotFound(_0x13f9e3,null))[_0x24fc('0x24')](saveUpdates(_0x17280c[_0x24fc('0x42')],null))[_0x24fc('0x24')](respondWithResult(_0x13f9e3,null))[_0x24fc('0x2f')](handleError(_0x13f9e3,null));};exports['abandon']=function(_0x2400a3,_0x16368d,_0x5b1fe2){if(_0x2400a3[_0x24fc('0x42')]['id']){delete _0x2400a3[_0x24fc('0x42')]['id'];}return db['ChatInteraction'][_0x24fc('0x77')]({'where':{'id':_0x2400a3['params']['id']}})[_0x24fc('0x24')](function(_0x21d6d3){if(!_0x21d6d3){logger['error'](_0x24fc('0xe3'),_0x24fc('0xe4'),0x194,_0x24fc('0xe5'));_0x16368d[_0x24fc('0x30')](0x194);}else{if(_0x21d6d3[_0x24fc('0x87')]){throw new db[(_0x24fc('0xd9'))][(_0x24fc('0xdb'))](_0x24fc('0xe6'));}}return _0x21d6d3;})[_0x24fc('0x24')](function(_0x2c6ac9){if(_0x2c6ac9){return _0x2c6ac9[_0x24fc('0x3b')]({'closed':_0x2400a3[_0x24fc('0x42')][_0x24fc('0xe7')],'disposition':_0x2400a3[_0x24fc('0x42')][_0x24fc('0xe8')]})[_0x24fc('0x24')](function(_0x2ccd34){return _0x2ccd34;});}})['then'](function(_0x51764e){return respondWithRpcPromise('AbandonInteraction',_0x24fc('0xe4'),_0x2400a3['body'],client9004);})[_0x24fc('0x24')](respondWithResult(_0x16368d,null))[_0x24fc('0x2f')](handleError(_0x16368d,null));};exports[_0x24fc('0xe9')]=function(_0x2d7ecb,_0xf4f427,_0x41fbf1){_0x2d7ecb[_0x24fc('0x42')][_0x24fc('0x3e')]=_0x2d7ecb[_0x24fc('0xea')][_0x24fc('0xeb')];_0x2d7ecb[_0x24fc('0x42')]['basename']=_0x2d7ecb['file'][_0x24fc('0xec')];_0x2d7ecb[_0x24fc('0x42')][_0x24fc('0x50')]=_0x2d7ecb['file'][_0x24fc('0xed')];return db[_0x24fc('0xee')][_0x24fc('0xcb')](_0x2d7ecb[_0x24fc('0x42')])[_0x24fc('0x24')](respondWithResult(_0xf4f427,0xc9))[_0x24fc('0x2f')](handleError(_0xf4f427,null));};exports['attachmentDownload']=function(_0x3c41c1,_0x337fad,_0x525d4f){return db[_0x24fc('0x4e')]['findOne']({'where':{'id':_0x3c41c1['params']['id']},'raw':!![]})[_0x24fc('0x24')](handleEntityNotFound(_0x337fad,null))[_0x24fc('0x24')](function(_0x282848){if(_0x282848){if(_0x282848[_0x24fc('0xe7')]){return _0x337fad['status'](0x193)[_0x24fc('0x33')]({'status':0x193,'message':_0x24fc('0xef')});}return db[_0x24fc('0xee')][_0x24fc('0xce')]({'where':{'id':_0x3c41c1[_0x24fc('0x52')]['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x337fad,null));}})[_0x24fc('0x24')](function(_0x2cbaa1){if(_0x2cbaa1){var _0xaab85=_0x2cbaa1[_0x24fc('0xf0')]!==null;var _0x42d3ae=path['join'](config[_0x24fc('0xf1')],_0x24fc('0xf2'));if(_0xaab85){_0x42d3ae=path[_0x24fc('0xf3')](_0x42d3ae,_0x24fc('0xf4'));}var _0xc73868=path[_0x24fc('0xf3')](_0x42d3ae,_0x2cbaa1[_0x24fc('0xf5')]);return _0x337fad[_0x24fc('0xf6')](_0xc73868);}})[_0x24fc('0x2f')](handleError(_0x337fad,null));};exports['close']=function(_0x3f0da7,_0x36f9d2){var _0x50a4c5=null;var _0x299fd8=null;var _0x5d01fa=null;var _0x92d51d=null;if(_0x3f0da7[_0x24fc('0x42')]['id']){delete _0x3f0da7['body']['id'];}if(_0x3f0da7['body'][_0x24fc('0xf7')]){_0x92d51d=path['join'](config[_0x24fc('0xf1')],_0x24fc('0xf8'),util[_0x24fc('0xf9')](_0x24fc('0xfa'),Date['now']()));_0x3f0da7[_0x24fc('0x42')][_0x24fc('0xfb')]=_0x92d51d;}return db[_0x24fc('0x4e')][_0x24fc('0x77')]({'where':{'id':_0x3f0da7[_0x24fc('0xc8')]['id']},'include':[{'model':db[_0x24fc('0xde')],'as':_0x24fc('0xfc'),'include':[{'model':db[_0x24fc('0xfd')],'as':_0x24fc('0xfd')}]}]})[_0x24fc('0x24')](handleEntityNotFound(_0x36f9d2,null))[_0x24fc('0x24')](saveUpdates(_0x3f0da7[_0x24fc('0x42')],null))[_0x24fc('0x24')](function(_0x210bc5){if(_0x210bc5){_0x50a4c5=_0x210bc5;return db[_0x24fc('0xfe')][_0x24fc('0x77')]({'where':{'id':_0x50a4c5[_0x24fc('0xa6')]}});}})[_0x24fc('0x24')](function(_0x4dbbf1){if(_0x4dbbf1){_0x5d01fa=_0x4dbbf1;return db[_0x24fc('0xe2')][_0x24fc('0x77')]({'where':{'id':_0x50a4c5[_0x24fc('0x82')]}});}})[_0x24fc('0x24')](function(_0x61a50b){if(_0x61a50b){_0x299fd8=_0x61a50b;if(_0x92d51d){var _0x282e8c=null;for(var _0x47637c=0x1;_0x47637c<_0x50a4c5[_0x24fc('0xfc')]['length'];++_0x47637c){_0x282e8c=_0x50a4c5[_0x24fc('0xfc')][_0x47637c];var _0x36788c=_0x282e8c[_0x24fc('0x87')]?util['format'](_0x24fc('0xff'),_0x5d01fa[_0x24fc('0x100')],_0x282e8c[_0x24fc('0x87')]):_0x24fc('0x101');var _0x1bbfe1=_0x3f0da7[_0x24fc('0x42')][_0x24fc('0x102')]||util[_0x24fc('0xf9')]('%s%d','Visitor',_0x282e8c[_0x24fc('0x82')]);switch(_0x5d01fa['agentIdentifier']){case _0x24fc('0x103'):_0x36788c=_0x282e8c[_0x24fc('0x87')]?util[_0x24fc('0xf9')](_0x24fc('0xff'),_0x5d01fa[_0x24fc('0x100')],_0x282e8c[_0x24fc('0x87')]):_0x24fc('0x101');break;case'agent_alias':_0x36788c=_0x282e8c[_0x24fc('0x87')]?_0x282e8c[_0x24fc('0xfd')][_0x24fc('0x104')]||_0x282e8c['User'][_0x24fc('0x48')]:_0x24fc('0x101');break;case _0x24fc('0x105'):_0x36788c=_0x282e8c['UserId']?_0x282e8c[_0x24fc('0xfd')][_0x24fc('0x48')]:_0x24fc('0x101');break;default:_0x36788c=_0x282e8c[_0x24fc('0x87')]?util[_0x24fc('0xf9')](_0x24fc('0xff'),_0x5d01fa[_0x24fc('0x100')],_0x282e8c[_0x24fc('0x87')]):_0x24fc('0x101');}var _0x3f1c36=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0x282e8c[_0x24fc('0x8e')])[_0x24fc('0xf9')](_0x24fc('0x106')),_0x282e8c['direction']==='in'?_0x1bbfe1:_0x36788c,_0x282e8c[_0x24fc('0x42')]);if(!_0x282e8c[_0x24fc('0x107')]){fs[_0x24fc('0x108')](_0x92d51d,_0x3f1c36);}}return db[_0x24fc('0x109')][_0x24fc('0xce')]({'where':{'service':!![]},'include':[{'model':db[_0x24fc('0x10a')],'as':_0x24fc('0x10b'),'raw':!![]}]});}}})[_0x24fc('0x24')](function(_0x18ab28){if(_0x18ab28&&_0x18ab28[_0x24fc('0x10b')]&&_0x3f0da7[_0x24fc('0x42')]){var _0x14b0b5={'tls':{'rejectUnauthorized':![]}};if(_0x18ab28[_0x24fc('0x10b')][_0x24fc('0x10c')]){_0x14b0b5[_0x24fc('0x10c')]=_0x18ab28['Smtp'][_0x24fc('0x10c')];}else{_0x14b0b5[_0x24fc('0x10d')]=_0x18ab28[_0x24fc('0x10b')]['host'];_0x14b0b5[_0x24fc('0x10e')]=_0x18ab28[_0x24fc('0x10b')][_0x24fc('0x10e')];_0x14b0b5[_0x24fc('0x10f')]=_0x18ab28[_0x24fc('0x10b')][_0x24fc('0x10f')];}if(_0x18ab28[_0x24fc('0x10b')][_0x24fc('0x110')]){_0x14b0b5[_0x24fc('0x111')]={'user':_0x18ab28[_0x24fc('0x10b')][_0x24fc('0xa8')],'pass':_0x18ab28[_0x24fc('0x10b')]['pass']};}return respondWithRpcPromise(_0x24fc('0x112'),_0x24fc('0x113'),{'account':_0x14b0b5,'message':{'from':util[_0x24fc('0xf9')](_0x24fc('0x114'),_0x18ab28[_0x24fc('0x3e')],_0x18ab28[_0x24fc('0xd4')]||_0x18ab28['Smtp'][_0x24fc('0xa8')]),'to':_0x3f0da7[_0x24fc('0x42')][_0x24fc('0xf7')],'subject':_0x24fc('0x115'),'text':util[_0x24fc('0xf9')](_0x24fc('0x116'),_0x3f0da7[_0x24fc('0x42')][_0x24fc('0xf7')]),'attachments':[{'path':_0x92d51d}]}})[_0x24fc('0x24')](function(){return _0x50a4c5;})[_0x24fc('0x2f')](function(_0x51ecc4){console['error'](_0x51ecc4);});}else{return _0x50a4c5;}})['then'](respondWithStatusCode(_0x36f9d2,0xc8))[_0x24fc('0x2f')](handleError(_0x36f9d2,null));};exports[_0x24fc('0x117')]=function(_0x21d021,_0x15035b,_0xe5f00){return db[_0x24fc('0xde')][_0x24fc('0x77')]({'where':{'id':_0x21d021[_0x24fc('0xc8')]['id']}})['then'](handleEntityNotFound(_0x15035b,null))[_0x24fc('0x24')](function(_0x263597){if(_0x263597){return _0x263597['addMessage'](_0x21d021[_0x24fc('0x42')][_0x24fc('0x118')],_[_0x24fc('0x119')](_0x21d021[_0x24fc('0x42')],[_0x24fc('0x118'),'id'])||{});}})[_0x24fc('0x24')](respondWithResult(_0x15035b,null))[_0x24fc('0x2f')](handleError(_0x15035b,null));};exports['getMessages']=function(_0xda0576,_0x1a136f,_0x47833f){var _0x59d561={'raw':![],'where':{}};var _0x4614fe={};var _0x7a2cca={'count':0x0,'rows':[]};return db[_0x24fc('0x4e')][_0x24fc('0xce')]({'where':{'id':_0xda0576[_0x24fc('0xc8')]['id']}})[_0x24fc('0x24')](handleEntityNotFound(_0x1a136f,null))['then'](function(_0x14bd08){if(_0x14bd08){_0x4614fe[_0x24fc('0x54')]=_['keys'](db[_0x24fc('0xde')][_0x24fc('0x4f')]);_0x4614fe[_0x24fc('0x52')]=_[_0x24fc('0x88')](_0xda0576[_0x24fc('0x52')]);_0x4614fe[_0x24fc('0x5e')]=_[_0x24fc('0x53')](_0x4614fe[_0x24fc('0x54')],_0x4614fe[_0x24fc('0x52')]);_0x59d561[_0x24fc('0x56')]=_['intersection'](_0x4614fe['model'],qs[_0x24fc('0x55')](_0xda0576[_0x24fc('0x52')]['fields']));_0x59d561[_0x24fc('0x56')]=_0x59d561[_0x24fc('0x56')][_0x24fc('0x57')]?_0x59d561['attributes']:_0x4614fe[_0x24fc('0x54')];if(!_0xda0576[_0x24fc('0x52')][_0x24fc('0x58')](_0x24fc('0x59'))){_0x59d561['limit']=qs[_0x24fc('0x5a')](_0xda0576['query'][_0x24fc('0x5a')]);_0x59d561['offset']=qs[_0x24fc('0x34')](_0xda0576[_0x24fc('0x52')]['offset']);}_0x59d561[_0x24fc('0x5b')]=qs[_0x24fc('0x5c')](_0xda0576[_0x24fc('0x52')]['sort']);_0x59d561[_0x24fc('0x5d')]=qs[_0x24fc('0x5e')](_[_0x24fc('0x11a')](_0xda0576['query'],_0x4614fe[_0x24fc('0x5e')]));_0x59d561[_0x24fc('0x5d')][_0x24fc('0xc5')]=_0x14bd08['id'];if(_0xda0576['query'][_0x24fc('0x9a')]){_0x59d561[_0x24fc('0x5d')]=_[_0x24fc('0x41')](_0x59d561[_0x24fc('0x5d')],{'$or':_[_0x24fc('0x47')](_0x59d561[_0x24fc('0x56')],function(_0x6fa372){var _0x1e5616={};_0x1e5616[_0x6fa372]={'$like':'%'+_0xda0576[_0x24fc('0x52')]['filter']+'%'};return _0x1e5616;})});}if(_0xda0576['query'][_0x24fc('0x8f')]){var _0x59cd3c=_0xda0576[_0x24fc('0x52')]['$gte']['split'](',');var _0x235cd7={};_0x235cd7[_0x59cd3c[0x0]]={'$gte':moment(_0x59cd3c[0x1])['format'](_0x24fc('0x11b'))};_0x59d561[_0x24fc('0x5d')]=_[_0x24fc('0x41')](_0x59d561['where'],_0x235cd7);}_0x59d561=_[_0x24fc('0x41')]({},_0x59d561,_0xda0576[_0x24fc('0xca')]);return db[_0x24fc('0xde')][_0x24fc('0x36')]({'where':_0x59d561[_0x24fc('0x5d')]})[_0x24fc('0x24')](function(_0x3e6fda){_0x7a2cca[_0x24fc('0x36')]=_0x3e6fda;if(_0xda0576[_0x24fc('0x52')][_0x24fc('0xc9')]){_0x59d561[_0x24fc('0x11c')]=[{'all':!![]}];}return db[_0x24fc('0xde')][_0x24fc('0x11d')](_0x59d561);})[_0x24fc('0x24')](function(_0x4f5acf){_0x7a2cca[_0x24fc('0xc7')]=_0x4f5acf;return _0x7a2cca;});}})[_0x24fc('0x24')](respondWithFilteredResult(_0x1a136f,_0x59d561))[_0x24fc('0x2f')](handleError(_0x1a136f,null));};exports[_0x24fc('0x11e')]=function(_0x4ba8de,_0x53e48e,_0x50012d){var _0x1449f2={'where':{}},_0x43492b={},_0x487e55={'count':0x0,'rows':[]};return db[_0x24fc('0x4e')][_0x24fc('0xce')]({'where':{'id':_0x4ba8de['params']['id']}})['then'](handleEntityNotFound(_0x53e48e,null))[_0x24fc('0x24')](function(_0x5a41d8){if(_0x5a41d8){_0x43492b['model']=_['keys'](db[_0x24fc('0xde')][_0x24fc('0x4f')]);_0x43492b[_0x24fc('0x52')]=_[_0x24fc('0x88')](_0x4ba8de[_0x24fc('0x52')]);_0x43492b[_0x24fc('0x5e')]=_[_0x24fc('0x53')](_0x43492b[_0x24fc('0x54')],_0x43492b['query']);_0x1449f2[_0x24fc('0x56')]=_[_0x24fc('0x53')](_0x43492b[_0x24fc('0x54')],qs[_0x24fc('0x55')](_0x4ba8de[_0x24fc('0x52')][_0x24fc('0x55')]));_0x1449f2[_0x24fc('0x56')]=_0x1449f2[_0x24fc('0x56')][_0x24fc('0x57')]?_0x1449f2[_0x24fc('0x56')]:_0x43492b[_0x24fc('0x54')];if(!_0x4ba8de[_0x24fc('0x52')]['hasOwnProperty'](_0x24fc('0x59'))){_0x1449f2[_0x24fc('0x5a')]=qs[_0x24fc('0x5a')](_0x4ba8de[_0x24fc('0x52')]['limit']);_0x1449f2[_0x24fc('0x34')]=qs[_0x24fc('0x34')](_0x4ba8de[_0x24fc('0x52')][_0x24fc('0x34')]);}_0x1449f2['order']=qs['sort'](_0x4ba8de[_0x24fc('0x52')][_0x24fc('0x5c')]);_0x1449f2[_0x24fc('0x5d')]=qs[_0x24fc('0x5e')](_['pick'](_0x4ba8de[_0x24fc('0x52')],_0x43492b['filters']));_0x1449f2[_0x24fc('0x5d')][_0x24fc('0xc5')]=_0x5a41d8['id'];if(_0x4ba8de[_0x24fc('0x52')]['filter']){_0x1449f2[_0x24fc('0x5d')]=_[_0x24fc('0x41')](_0x1449f2[_0x24fc('0x5d')],{'$or':_[_0x24fc('0x47')](_0x1449f2['attributes'],function(_0x4ae822){var _0x545714={};_0x545714[_0x4ae822]={'$like':'%'+_0x4ba8de[_0x24fc('0x52')][_0x24fc('0x9a')]+'%'};return _0x545714;})});}_0x1449f2[_0x24fc('0x5d')]['secret']=![];if(_0x4ba8de[_0x24fc('0x52')]['id']){_0x1449f2[_0x24fc('0x5d')]['id']={'$gt':_0x4ba8de['query']['id']};}_0x1449f2=_[_0x24fc('0x41')]({},_0x1449f2,_0x4ba8de[_0x24fc('0xca')]);return db[_0x24fc('0xde')][_0x24fc('0x36')]({'where':_0x1449f2['where']})['then'](function(_0x12921f){_0x487e55[_0x24fc('0x36')]=_0x12921f;_0x1449f2['include']=[];if(_0x4ba8de[_0x24fc('0x52')][_0x24fc('0x11f')]){_0x1449f2[_0x24fc('0x11c')]['push']({'model':db[_0x24fc('0xfd')],'as':_0x24fc('0xfd'),'attributes':['id','fullname','alias']});}if(_0x4ba8de[_0x24fc('0x52')][_0x24fc('0xc9')]){_0x1449f2[_0x24fc('0x11c')]=[{'all':!![]}];}return db[_0x24fc('0xde')][_0x24fc('0x11d')](_0x1449f2);})[_0x24fc('0x24')](function(_0x214f7d){_0x487e55[_0x24fc('0xc7')]=_0x214f7d;return _0x487e55;});}})[_0x24fc('0x24')](respondWithFilteredResult(_0x53e48e,_0x1449f2))[_0x24fc('0x2f')](handleError(_0x53e48e,null));};exports[_0x24fc('0x120')]=function(_0x1a7f96,_0x59d246,_0x281eed){return db[_0x24fc('0x4e')]['find']({'where':{'id':_0x1a7f96[_0x24fc('0xc8')]['id']}})[_0x24fc('0x24')](handleEntityNotFound(_0x59d246,null))['then'](function(_0x4e2c71){if(_0x4e2c71){return _0x4e2c71[_0x24fc('0x121')](_0x1a7f96['body'][_0x24fc('0x118')],_['omit'](_0x1a7f96[_0x24fc('0x42')],['ids','id'])||{})[_0x24fc('0x122')](function(){return db[_0x24fc('0x123')][_0x24fc('0x11d')]({'attributes':['id',_0x24fc('0x3e'),_0x24fc('0x61')],'where':{'id':_0x1a7f96[_0x24fc('0x42')][_0x24fc('0x118')]}});})[_0x24fc('0x24')](function(_0x3c5996){socket['emit']('chatInteractionTags:save',{'id':Number(_0x1a7f96['params']['id']),'tags':_0x3c5996||[]});return{'id':Number(_0x1a7f96[_0x24fc('0xc8')]['id']),'tags':_0x3c5996||[]};});}})[_0x24fc('0x24')](respondWithResult(_0x59d246,null))[_0x24fc('0x2f')](handleError(_0x59d246,null));};exports['removeTags']=function(_0x8dc31b,_0x5941bd,_0x4d73bb){return db[_0x24fc('0x4e')][_0x24fc('0x77')]({'where':{'id':_0x8dc31b[_0x24fc('0xc8')]['id']}})['then'](handleEntityNotFound(_0x5941bd,null))[_0x24fc('0x24')](function(_0x464057){if(_0x464057){return _0x464057[_0x24fc('0x124')](_0x8dc31b[_0x24fc('0x52')][_0x24fc('0x118')]);}})[_0x24fc('0x24')](respondWithStatusCode(_0x5941bd,null))['catch'](handleError(_0x5941bd,null));};exports[_0x24fc('0xf6')]=function(_0x9c34d9,_0x3e4f49){var _0x231f0b=moment()[_0x24fc('0x125')]()['toString']();var _0x34355e=path[_0x24fc('0xf3')](config[_0x24fc('0xf1')],_0x24fc('0x126'),_0x24fc('0x127'),'tmp');var _0x4d0910=path[_0x24fc('0xf3')](config[_0x24fc('0xf1')],'server','files',_0x24fc('0x128'));var _0x49025e=path[_0x24fc('0xf3')](_0x34355e,_0x231f0b);var _0x2c9a19=util['format'](_0x24fc('0x129'),_0x9c34d9['params']['id'],_0x231f0b);var _0x38ca24=path['join'](_0x34355e,_0x2c9a19);var _0x53a9aa=[];_0x53a9aa['push']({'model':db['User'],'as':_0x24fc('0xfd'),'attributes':['id',_0x24fc('0x48')],'raw':!![]});_0x53a9aa['push']({'model':db[_0x24fc('0xe2')],'as':_0x24fc('0x7b'),'attributes':['id',_0x24fc('0x12a'),_0x24fc('0x12b')],'raw':!![]});if(_0x9c34d9[_0x24fc('0x52')]['attachments']){_0x53a9aa[_0x24fc('0x4d')]({'model':db[_0x24fc('0xee')],'as':_0x24fc('0xee'),'raw':!![]});}var _0x2139e8=[{'model':db[_0x24fc('0xde')],'as':_0x24fc('0xfc'),'attributes':['id',_0x24fc('0x42'),'createdAt',_0x24fc('0x12c'),_0x24fc('0x107'),_0x24fc('0x95')],'include':_0x53a9aa}];_0x2139e8[_0x24fc('0x4d')]({'model':db['ChatWebsite'],'as':_0x24fc('0x12d'),'attributes':['id',_0x24fc('0x3e')]});_0x2139e8[_0x24fc('0x4d')]({'model':db[_0x24fc('0xfd')],'as':_0x24fc('0x12e'),'attributes':['id','fullname']});return db[_0x24fc('0x4e')]['find']({'where':{'id':_0x9c34d9[_0x24fc('0xc8')]['id']},'include':_0x2139e8})[_0x24fc('0x24')](handleEntityNotFound(_0x3e4f49,null))[_0x24fc('0x24')](function(_0x26179a){if(_0x26179a){var _0x6f1617=_0x26179a['get']({'plain':!![]});fs[_0x24fc('0x12f')](_0x49025e);var _0x57dfbc={'channel':'Chat','account':_0x6f1617['Account'][_0x24fc('0x3e')],'agent':_0x6f1617[_0x24fc('0x12e')]?_0x6f1617[_0x24fc('0x12e')][_0x24fc('0x48')]:_0x24fc('0x130'),'createdAt':moment(_0x6f1617[_0x24fc('0x8e')])[_0x24fc('0xf9')](_0x24fc('0x11b'))[_0x24fc('0xad')](),'closedAt':_0x6f1617[_0x24fc('0xe7')]?moment(_0x6f1617[_0x24fc('0x131')])[_0x24fc('0xf9')](_0x24fc('0x11b'))['toString']():'','disposition':_0x6f1617['disposition'],'chatInfo':{'browser':_0x6f1617['browserName'],'os':_0x6f1617['osName'],'referer':_0x6f1617['referer'],'customerIp':_0x6f1617[_0x24fc('0x132')],'customerPort':_0x6f1617[_0x24fc('0x133')]?_0x6f1617[_0x24fc('0x133')]:_0x24fc('0x130')},'messages':_(_0x6f1617['Messages'])['tail']()[_0x24fc('0x9a')]({'secret':![]})[_0x24fc('0x47')](function(_0x2ee9a6){if(_0x2ee9a6[_0x24fc('0xee')]){var _0x40409c=path['join'](_0x4d0910,_0x2ee9a6[_0x24fc('0xee')][_0x24fc('0xf5')]);if(fs[_0x24fc('0x134')](_0x40409c)){fs['createReadStream'](_0x40409c)['pipe'](fs[_0x24fc('0x135')](path[_0x24fc('0xf3')](_0x49025e,_0x2ee9a6[_0x24fc('0xee')][_0x24fc('0xf5')])));}}return{'date':moment(_0x2ee9a6[_0x24fc('0x8e')])[_0x24fc('0xf9')](_0x24fc('0x11b'))['toString'](),'sender':_0x2ee9a6[_0x24fc('0x12c')]===_0x24fc('0x136')?_0x2ee9a6[_0x24fc('0xfd')]?_0x2ee9a6[_0x24fc('0xfd')]['fullname']:'System':_0x2ee9a6['Contact']['firstName']+(_0x2ee9a6['Contact'][_0x24fc('0x12b')]?'\x20'+_0x2ee9a6[_0x24fc('0x7b')]['lastName']:''),'body':_0x2ee9a6[_0x24fc('0xee')]?_0x2ee9a6[_0x24fc('0xee')]['basename']:_0x2ee9a6[_0x24fc('0x42')],'direction':_0x2ee9a6['direction']===_0x24fc('0x136')?'A':'C','secret':_0x2ee9a6[_0x24fc('0x107')],'read':_0x2ee9a6[_0x24fc('0x95')],'attachment':_0x2ee9a6['Attachment']};})[_0x24fc('0x7e')]()};return ejs[_0x24fc('0x137')](path['join'](config[_0x24fc('0xf1')],'server','views',_0x24fc('0x138')),{'interaction':_0x57dfbc})[_0x24fc('0x24')](function(_0x24101d){var _0x5defce=path[_0x24fc('0xf3')](_0x49025e,_0x24fc('0x139')+_0x6f1617['id']+'-'+_0x231f0b+_0x24fc('0x13a'));var _0x187770={'path':_0x5defce,'channel':_0x24fc('0x13b'),'interactionId':_0x6f1617['id']};return pdf['createPdfFromHTML'](_0x24101d,_0x187770);})['then'](function(){return new BPromise(function(_0x3357cb,_0x2b633b){zipdir(_0x49025e,{'saveTo':_0x38ca24},function(_0x4ad7c4,_0x1d8b26){if(_0x4ad7c4)return _0x2b633b(_0x4ad7c4);return _0x3357cb(_0x1d8b26);});})[_0x24fc('0x24')](function(){return new BPromise(function(_0x4b0f8b,_0x59d408){rimraf(_0x49025e,function(_0x547f6b){if(_0x547f6b)_0x59d408(_0x547f6b);return _0x4b0f8b();});});})[_0x24fc('0x24')](function(){return _0x3e4f49[_0x24fc('0xf6')](_0x38ca24,_0x2c9a19,function(_0x3a2ffd){if(_0x3a2ffd){console[_0x24fc('0x13c')](_0x24fc('0x13d'),_0x3a2ffd);}else{fs[_0x24fc('0x13e')](_0x38ca24);}});});});}else{return _0x3e4f49[_0x24fc('0x30')](0xc8);}})['catch'](handleError(_0x3e4f49,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index aa05f31..86b3c32 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 _0xda23=['setDataValue','Users','map','findAll','unreadMessages','emit','hasOwnProperty','hook','exports','ChatInteraction','ChatMessage','save','update','remove','getUsers','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xda23,0x79));var _0x3da2=function(_0x58c86a,_0x602654){_0x58c86a=_0x58c86a-0x0;var _0x2bb374=_0xda23[_0x58c86a];return _0x2bb374;};'use strict';var EventEmitter=require('events');var ChatInteraction=require('../../mysqldb')['db'][_0x3da2('0x0')];var ChatMessage=require('../../mysqldb')['db'][_0x3da2('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3da2('0x2'),'afterUpdate':_0x3da2('0x3'),'afterDestroy':_0x3da2('0x4')};function emitEvent(_0x4a847a){return function(_0x5f4f5b,_0x5d6207,_0x9c2c9b){_0x5f4f5b[_0x3da2('0x5')]({'attributes':['id'],'raw':!![]})[_0x3da2('0x6')](function(_0x761e15){_0x5f4f5b[_0x3da2('0x7')](_0x3da2('0x8'),_0x761e15[_0x3da2('0x9')](function(_0x1efd10){return{'id':_0x1efd10['id']};}));return ChatMessage[_0x3da2('0xa')]({'where':{'ChatInteractionId':_0x5f4f5b['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x31d6f5){_0x5f4f5b['setDataValue'](_0x3da2('0xb'),_0x31d6f5['length']);ChatInteractionEvents[_0x3da2('0xc')](_0x4a847a+':'+_0x5f4f5b['id'],_0x5f4f5b);ChatInteractionEvents[_0x3da2('0xc')](_0x4a847a,_0x5f4f5b);_0x9c2c9b(null);})['catch'](_0x9c2c9b(null));};}for(var e in events){if(events[_0x3da2('0xd')](e)){var event=events[e];ChatInteraction[_0x3da2('0xe')](e,emitEvent(event));}}module[_0x3da2('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0x1533=['map','findAll','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','setMaxListeners','save','update','remove','setDataValue','Users'];(function(_0x49de70,_0x40c18e){var _0x20b19d=function(_0x38f14e){while(--_0x38f14e){_0x49de70['push'](_0x49de70['shift']());}};_0x20b19d(++_0x40c18e);}(_0x1533,0x1c7));var _0x3153=function(_0x13ea36,_0x2805ad){_0x13ea36=_0x13ea36-0x0;var _0x312066=_0x1533[_0x13ea36];return _0x312066;};'use strict';var EventEmitter=require(_0x3153('0x0'));var ChatInteraction=require(_0x3153('0x1'))['db'][_0x3153('0x2')];var ChatMessage=require(_0x3153('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x3153('0x3')](0x0);var events={'afterCreate':_0x3153('0x4'),'afterUpdate':_0x3153('0x5'),'afterDestroy':_0x3153('0x6')};function emitEvent(_0xac7d0c){return function(_0x4b62ac,_0x2c0315,_0x4bb32d){_0x4b62ac['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0xd39141){_0x4b62ac[_0x3153('0x7')](_0x3153('0x8'),_0xd39141[_0x3153('0x9')](function(_0x3e43aa){return{'id':_0x3e43aa['id']};}));return ChatMessage[_0x3153('0xa')]({'where':{'ChatInteractionId':_0x4b62ac['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3a98b3){_0x4b62ac[_0x3153('0x7')]('unreadMessages',_0x3a98b3['length']);ChatInteractionEvents[_0x3153('0xb')](_0xac7d0c+':'+_0x4b62ac['id'],_0x4b62ac);ChatInteractionEvents[_0x3153('0xb')](_0xac7d0c,_0x4b62ac);_0x4bb32d(null);})[_0x3153('0xc')](_0x4bb32d(null));};}for(var e in events){if(events[_0x3153('0xd')](e)){var event=events[e];ChatInteraction[_0x3153('0xe')](e,emitEvent(event));}}module[_0x3153('0xf')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 107b61b..b38d2a5 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 _0x1fc4=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x359e4f,_0x25efbe){var _0x3d0d31=function(_0x5b9420){while(--_0x5b9420){_0x359e4f['push'](_0x359e4f['shift']());}};_0x3d0d31(++_0x25efbe);}(_0x1fc4,0x1b2));var _0x41fc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1fc4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x41fc('0x0'));var util=require('util');var logger=require(_0x41fc('0x1'))('api');var moment=require('moment');var BPromise=require(_0x41fc('0x2'));var rp=require(_0x41fc('0x3'));var fs=require('fs');var path=require(_0x41fc('0x4'));var rimraf=require(_0x41fc('0x5'));var config=require(_0x41fc('0x6'));var attributes=require(_0x41fc('0x7'));module[_0x41fc('0x8')]=function(_0x256856,_0x5c3860){return _0x256856[_0x41fc('0x9')](_0x41fc('0xa'),attributes,{'tableName':_0x41fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x542ca1,_0xb3ae81,_0x5bb617){if(_0x542ca1[_0x41fc('0xc')]('closed')){_0x542ca1[_0x41fc('0xd')]=moment()[_0x41fc('0xe')](_0x41fc('0xf'));}_0x5bb617(null,_0x542ca1);}},'charset':_0x41fc('0x10'),'collate':_0x41fc('0x11')});}; \ No newline at end of file +var _0x41a4=['YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','define','ChatInteraction','chat_interactions','changed','closed'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x41a4,0x1e2));var _0x441a=function(_0x2adc09,_0x4ec164){_0x2adc09=_0x2adc09-0x0;var _0x4c0033=_0x41a4[_0x2adc09];return _0x4c0033;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x441a('0x0'));var moment=require(_0x441a('0x1'));var BPromise=require(_0x441a('0x2'));var rp=require(_0x441a('0x3'));var fs=require('fs');var path=require(_0x441a('0x4'));var rimraf=require(_0x441a('0x5'));var config=require(_0x441a('0x6'));var attributes=require(_0x441a('0x7'));module['exports']=function(_0x5a1ba5,_0x3630c2){return _0x5a1ba5[_0x441a('0x8')](_0x441a('0x9'),attributes,{'tableName':_0x441a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4d9702,_0x247eeb,_0x590819){if(_0x4d9702[_0x441a('0xb')](_0x441a('0xc'))){_0x4d9702['closedAt']=moment()['format'](_0x441a('0xd'));}_0x590819(null,_0x4d9702);}},'charset':'utf8mb4','collate':_0x441a('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 66ea82f..45337be 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 _0x95fd=['ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','ChatInteraction','body','options','where','UpdateChatInteraction','addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','redis','defaults','localhost','./chatInteraction.socket','register','request','info'];(function(_0x47a30c,_0x11f71c){var _0x18e93f=function(_0x24f7bb){while(--_0x24f7bb){_0x47a30c['push'](_0x47a30c['shift']());}};_0x18e93f(++_0x11f71c);}(_0x95fd,0x19f));var _0xd95f=function(_0x14ac95,_0x57a1b7){_0x14ac95=_0x14ac95-0x0;var _0x5bc624=_0x95fd[_0x14ac95];return _0x5bc624;};'use strict';var _=require(_0xd95f('0x0'));var util=require(_0xd95f('0x1'));var moment=require(_0xd95f('0x2'));var BPromise=require('bluebird');var rs=require(_0xd95f('0x3'));var fs=require('fs');var Redis=require(_0xd95f('0x4'));var db=require(_0xd95f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd95f('0x6'));var config=require('../../config/environment');var jayson=require(_0xd95f('0x7'));var client=jayson[_0xd95f('0x8')][_0xd95f('0x9')]({'port':0x232a});config[_0xd95f('0xa')]=_[_0xd95f('0xb')](config[_0xd95f('0xa')],{'host':_0xd95f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd95f('0xa')]));require(_0xd95f('0xd'))[_0xd95f('0xe')](socket);function respondWithRpcPromise(_0x4314b3,_0x203fa0,_0x5f0ea4){return new BPromise(function(_0x4c7aa7,_0x3a7983){return client[_0xd95f('0xf')](_0x4314b3,_0x5f0ea4)['then'](function(_0x35aa67){logger[_0xd95f('0x10')](_0xd95f('0x11'),_0x203fa0,'request\x20sent');logger[_0xd95f('0x12')](_0xd95f('0x13'),_0x203fa0,_0xd95f('0x14'),JSON[_0xd95f('0x15')](_0x35aa67));if(_0x35aa67[_0xd95f('0x16')]){if(_0x35aa67[_0xd95f('0x16')]['code']===0x1f4){logger[_0xd95f('0x16')](_0xd95f('0x11'),_0x203fa0,_0x35aa67[_0xd95f('0x16')][_0xd95f('0x17')]);return _0x3a7983(_0x35aa67[_0xd95f('0x16')]['message']);}logger[_0xd95f('0x16')](_0xd95f('0x11'),_0x203fa0,_0x35aa67[_0xd95f('0x16')][_0xd95f('0x17')]);return _0x4c7aa7(_0x35aa67[_0xd95f('0x16')][_0xd95f('0x17')]);}else{logger['info'](_0xd95f('0x11'),_0x203fa0,_0xd95f('0x14'));_0x4c7aa7(_0x35aa67[_0xd95f('0x18')]['message']);}})[_0xd95f('0x19')](function(_0x3f623b){logger[_0xd95f('0x16')](_0xd95f('0x11'),_0x203fa0,_0x3f623b);_0x3a7983(_0x3f623b);});});}exports['UpdateChatInteraction']=function(_0x1506dc){var _0x334683=this;return new Promise(function(_0x21ed64,_0xc47ea6){return db[_0xd95f('0x1a')]['update'](_0x1506dc[_0xd95f('0x1b')],{'raw':_0x1506dc[_0xd95f('0x1c')]?_0x1506dc['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1506dc[_0xd95f('0x1c')]?_0x1506dc[_0xd95f('0x1c')][_0xd95f('0x1d')]||null:null,'attributes':_0x1506dc[_0xd95f('0x1c')]?_0x1506dc[_0xd95f('0x1c')]['attributes']||null:null,'limit':_0x1506dc[_0xd95f('0x1c')]?_0x1506dc[_0xd95f('0x1c')]['limit']||null:null})['then'](function(_0x2fe562){logger[_0xd95f('0x10')](_0xd95f('0x1e'),_0x1506dc);logger[_0xd95f('0x12')](_0xd95f('0x1e'),_0x1506dc,JSON[_0xd95f('0x15')](_0x2fe562));_0x21ed64(_0x2fe562);})[_0xd95f('0x19')](function(_0x1fb901){logger[_0xd95f('0x16')](_0xd95f('0x1e'),_0x1fb901[_0xd95f('0x17')],_0x1506dc);_0xc47ea6(_0x334683[_0xd95f('0x16')](0x1f4,_0x1fb901[_0xd95f('0x17')]));});});};exports['AddTagsToChatInteraction']=function(_0x1c8372){return new Promise(function(_0x1d25a8,_0x1eac32){return db[_0xd95f('0x1a')]['find']({'where':_0x1c8372[_0xd95f('0x1c')]?_0x1c8372[_0xd95f('0x1c')][_0xd95f('0x1d')]||null:null})['then'](function(_0x3db5f4){if(_0x3db5f4){return _0x3db5f4[_0xd95f('0x1f')](_0x1c8372[_0xd95f('0x1b')][_0xd95f('0x20')],_[_0xd95f('0x21')](_0x1c8372['body'],[_0xd95f('0x20'),'id'])||{});}})[_0xd95f('0x22')](function(_0x8ea163){logger[_0xd95f('0x10')](_0xd95f('0x23'),_0x1c8372);logger['debug']('AddTags',_0x1c8372,JSON[_0xd95f('0x15')](_0x8ea163));_0x1d25a8(_0x8ea163);})[_0xd95f('0x19')](function(_0x1ac119){logger[_0xd95f('0x16')](_0xd95f('0x23'),_0x1ac119[_0xd95f('0x17')],_0x1c8372);_0x1eac32(_this['error'](0x1f4,_0x1ac119[_0xd95f('0x17')]));});});}; \ No newline at end of file +var _0xb72c=['message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','attributes','limit','then','stringify','AddTagsToChatInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./chatInteraction.socket','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x16b024,_0x57ef28){var _0x11a89c=function(_0x21d6b8){while(--_0x21d6b8){_0x16b024['push'](_0x16b024['shift']());}};_0x11a89c(++_0x57ef28);}(_0xb72c,0x1af));var _0xcb72=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb72c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcb72('0x0'));var util=require(_0xcb72('0x1'));var moment=require(_0xcb72('0x2'));var BPromise=require('bluebird');var rs=require(_0xcb72('0x3'));var fs=require('fs');var Redis=require(_0xcb72('0x4'));var db=require(_0xcb72('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb72('0x6'))(_0xcb72('0x7'));var config=require(_0xcb72('0x8'));var jayson=require(_0xcb72('0x9'));var client=jayson[_0xcb72('0xa')][_0xcb72('0xb')]({'port':0x232a});config[_0xcb72('0xc')]=_['defaults'](config[_0xcb72('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xcb72('0xd'))(new Redis(config[_0xcb72('0xc')]));require(_0xcb72('0xe'))['register'](socket);function respondWithRpcPromise(_0x13edc5,_0x24b736,_0x293f00){return new BPromise(function(_0x5ed682,_0x2dc1e2){return client['request'](_0x13edc5,_0x293f00)['then'](function(_0x246080){logger[_0xcb72('0xf')](_0xcb72('0x10'),_0x24b736,_0xcb72('0x11'));logger[_0xcb72('0x12')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x24b736,_0xcb72('0x11'),JSON['stringify'](_0x246080));if(_0x246080[_0xcb72('0x13')]){if(_0x246080[_0xcb72('0x13')]['code']===0x1f4){logger[_0xcb72('0x13')](_0xcb72('0x10'),_0x24b736,_0x246080[_0xcb72('0x13')][_0xcb72('0x14')]);return _0x2dc1e2(_0x246080[_0xcb72('0x13')][_0xcb72('0x14')]);}logger['error'](_0xcb72('0x10'),_0x24b736,_0x246080[_0xcb72('0x13')][_0xcb72('0x14')]);return _0x5ed682(_0x246080[_0xcb72('0x13')][_0xcb72('0x14')]);}else{logger['info'](_0xcb72('0x10'),_0x24b736,'request\x20sent');_0x5ed682(_0x246080[_0xcb72('0x15')][_0xcb72('0x14')]);}})[_0xcb72('0x16')](function(_0x356031){logger[_0xcb72('0x13')](_0xcb72('0x10'),_0x24b736,_0x356031);_0x2dc1e2(_0x356031);});});}exports[_0xcb72('0x17')]=function(_0x385576){var _0x5e6955=this;return new Promise(function(_0x3952ca,_0x4d1a28){return db[_0xcb72('0x18')][_0xcb72('0x19')](_0x385576[_0xcb72('0x1a')],{'raw':_0x385576[_0xcb72('0x1b')]?_0x385576[_0xcb72('0x1b')][_0xcb72('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x385576[_0xcb72('0x1b')]?_0x385576[_0xcb72('0x1b')]['where']||null:null,'attributes':_0x385576[_0xcb72('0x1b')]?_0x385576[_0xcb72('0x1b')][_0xcb72('0x1d')]||null:null,'limit':_0x385576['options']?_0x385576['options'][_0xcb72('0x1e')]||null:null})[_0xcb72('0x1f')](function(_0x1210fd){logger['info'](_0xcb72('0x17'),_0x385576);logger['debug'](_0xcb72('0x17'),_0x385576,JSON[_0xcb72('0x20')](_0x1210fd));_0x3952ca(_0x1210fd);})[_0xcb72('0x16')](function(_0x32fa61){logger[_0xcb72('0x13')]('UpdateChatInteraction',_0x32fa61[_0xcb72('0x14')],_0x385576);_0x4d1a28(_0x5e6955[_0xcb72('0x13')](0x1f4,_0x32fa61[_0xcb72('0x14')]));});});};exports[_0xcb72('0x21')]=function(_0x2872a3){return new Promise(function(_0x1da6ab,_0x3adfb2){return db[_0xcb72('0x18')][_0xcb72('0x22')]({'where':_0x2872a3['options']?_0x2872a3[_0xcb72('0x1b')][_0xcb72('0x23')]||null:null})[_0xcb72('0x1f')](function(_0x431837){if(_0x431837){return _0x431837[_0xcb72('0x24')](_0x2872a3[_0xcb72('0x1a')][_0xcb72('0x25')],_[_0xcb72('0x26')](_0x2872a3[_0xcb72('0x1a')],[_0xcb72('0x25'),'id'])||{});}})[_0xcb72('0x27')](function(_0x282be3){logger[_0xcb72('0xf')](_0xcb72('0x28'),_0x2872a3);logger[_0xcb72('0x12')](_0xcb72('0x28'),_0x2872a3,JSON[_0xcb72('0x20')](_0x282be3));_0x1da6ab(_0x282be3);})[_0xcb72('0x16')](function(_0x21ba37){logger[_0xcb72('0x13')]('AddTags',_0x21ba37[_0xcb72('0x14')],_0x2872a3);_0x3adfb2(_this[_0xcb72('0x13')](0x1f4,_0x21ba37[_0xcb72('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 62cda4c..31aca3d 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 _0x9a43=['removeListener','register','length','chatInteraction:','./chatInteraction.events','save','update','emit'];(function(_0xfb7a0a,_0x36ea5a){var _0x39a4b3=function(_0x3b5c5e){while(--_0x3b5c5e){_0xfb7a0a['push'](_0xfb7a0a['shift']());}};_0x39a4b3(++_0x36ea5a);}(_0x9a43,0x1f4));var _0x39a4=function(_0x235563,_0x260ece){_0x235563=_0x235563-0x0;var _0x219be0=_0x9a43[_0x235563];return _0x219be0;};'use strict';var ChatInteractionEvents=require(_0x39a4('0x0'));var events=[_0x39a4('0x1'),'remove',_0x39a4('0x2')];function createListener(_0xb7f9a1,_0x190fb2){return function(_0x43e5ca){_0x190fb2[_0x39a4('0x3')](_0xb7f9a1,_0x43e5ca);};}function removeListener(_0x51dc85,_0x2b0284){return function(){ChatInteractionEvents[_0x39a4('0x4')](_0x51dc85,_0x2b0284);};}exports[_0x39a4('0x5')]=function(_0x636c2b){for(var _0x1512b1=0x0,_0x3dbf45=events[_0x39a4('0x6')];_0x1512b1<_0x3dbf45;_0x1512b1++){var _0x2a3369=events[_0x1512b1];var _0x7a4ef5=createListener(_0x39a4('0x7')+_0x2a3369,_0x636c2b);ChatInteractionEvents['on'](_0x2a3369,_0x7a4ef5);}}; \ No newline at end of file +var _0x6113=['./chatInteraction.events','save','remove','emit','removeListener','chatInteraction:'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x6113,0x1c8));var _0x3611=function(_0x2a9453,_0x40e729){_0x2a9453=_0x2a9453-0x0;var _0x5eb5e7=_0x6113[_0x2a9453];return _0x5eb5e7;};'use strict';var ChatInteractionEvents=require(_0x3611('0x0'));var events=[_0x3611('0x1'),_0x3611('0x2'),'update'];function createListener(_0xf0e7c6,_0x3952bd){return function(_0x37f54d){_0x3952bd[_0x3611('0x3')](_0xf0e7c6,_0x37f54d);};}function removeListener(_0x3cc782,_0x1661c9){return function(){ChatInteractionEvents[_0x3611('0x4')](_0x3cc782,_0x1661c9);};}exports['register']=function(_0x377654){for(var _0x18306f=0x0,_0x12a094=events['length'];_0x18306f<_0x12a094;_0x18306f++){var _0x47435b=events[_0x18306f];var _0x454512=createListener(_0x3611('0x5')+_0x47435b,_0x377654);ChatInteractionEvents['on'](_0x47435b,_0x454512);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index f3455c4..a607fb1 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 _0xe091=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','get','/describe','describe','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/messages','/:id/my_messages','getMyMessages','create','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','attachmentUpload','addMessage','/:id/tags','tracked','chatinteraction:addtags','put','/:id','chatinteraction:update','update','/:id/custom_update','customUpdate','abandon','close','delete','chat','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path'];(function(_0x3ea3ae,_0x29dd29){var _0x2aa587=function(_0x1d6dca){while(--_0x1d6dca){_0x3ea3ae['push'](_0x3ea3ae['shift']());}};_0x2aa587(++_0x29dd29);}(_0xe091,0x169));var _0x1e09=function(_0x5affd8,_0x4d7d09){_0x5affd8=_0x5affd8-0x0;var _0xd95330=_0xe091[_0x5affd8];return _0xd95330;};'use strict';var multer=require(_0x1e09('0x0'));var util=require(_0x1e09('0x1'));var path=require(_0x1e09('0x2'));var timeout=require(_0x1e09('0x3'));var express=require(_0x1e09('0x4'));var router=express['Router']();var fs_extra=require(_0x1e09('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1e09('0x6'));var config=require(_0x1e09('0x7'));var controller=require(_0x1e09('0x8'));router['get']('/',auth[_0x1e09('0x9')](),controller[_0x1e09('0xa')]);router[_0x1e09('0xb')](_0x1e09('0xc'),auth[_0x1e09('0x9')](),controller[_0x1e09('0xd')]);router[_0x1e09('0xb')]('/:id',auth[_0x1e09('0xe')](),controller[_0x1e09('0xf')]);router['get'](_0x1e09('0x10'),auth[_0x1e09('0xe')](),controller['attachmentDownload']);router[_0x1e09('0xb')](_0x1e09('0x11'),auth[_0x1e09('0x9')](),controller['getMessages']);router[_0x1e09('0xb')](_0x1e09('0x12'),auth[_0x1e09('0xe')](),controller[_0x1e09('0x13')]);router[_0x1e09('0xb')]('/:id/download',auth[_0x1e09('0x9')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x1e09('0x14')]);router[_0x1e09('0x15')](_0x1e09('0x16'),auth[_0x1e09('0x9')](),controller[_0x1e09('0x17')]);var upload=multer({'storage':multer[_0x1e09('0x18')]({'destination':function(_0x1170ae,_0x115f4e,_0x383a56){_0x383a56(null,path[_0x1e09('0x19')](config[_0x1e09('0x1a')],_0x1e09('0x1b')));},'filename':function(_0x52bb13,_0x5d0aac,_0x543d02){_0x543d02(null,util[_0x1e09('0x1c')](_0x1e09('0x1d'),Date[_0x1e09('0x1e')](),_0x5d0aac[_0x1e09('0x1f')][_0x1e09('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x1e09('0x15')]('/:id/attachment_upload',upload['single']('file'),controller[_0x1e09('0x21')]);router[_0x1e09('0x15')](_0x1e09('0x11'),auth[_0x1e09('0xe')](),controller[_0x1e09('0x22')]);router['post'](_0x1e09('0x23'),auth[_0x1e09('0x9')](),interaction[_0x1e09('0x24')]('chat',_0x1e09('0x25')),controller['addTags']);router[_0x1e09('0x26')](_0x1e09('0x27'),auth[_0x1e09('0x9')](),interaction[_0x1e09('0x24')]('chat',_0x1e09('0x28')),controller[_0x1e09('0x29')]);router[_0x1e09('0x26')](_0x1e09('0x2a'),controller[_0x1e09('0x2b')]);router[_0x1e09('0x26')]('/:id/abandon',auth[_0x1e09('0xe')](),controller[_0x1e09('0x2c')]);router[_0x1e09('0x26')]('/:id/close',controller[_0x1e09('0x2d')]);router[_0x1e09('0x2e')](_0x1e09('0x27'),auth[_0x1e09('0x9')](),interaction[_0x1e09('0x24')](_0x1e09('0x2f'),_0x1e09('0x30')),controller[_0x1e09('0x31')]);router[_0x1e09('0x2e')](_0x1e09('0x23'),auth[_0x1e09('0x9')](),controller[_0x1e09('0x32')]);module[_0x1e09('0x33')]=router; \ No newline at end of file +var _0x47ea=['../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','/:id/my_messages','getMyMessages','/:id/download','post','create','/:id/vidaoo','createVidaooSession','server/files/attachments/','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','addTags','chatinteraction:update','update','put','/:id/custom_update','customUpdate','abandon','/:id/close','close','delete','chatinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x2c91bc,_0x586658){var _0x398c11=function(_0x15f52b){while(--_0x15f52b){_0x2c91bc['push'](_0x2c91bc['shift']());}};_0x398c11(++_0x586658);}(_0x47ea,0x1df));var _0xa47e=function(_0x4bb2b9,_0x459c78){_0x4bb2b9=_0x4bb2b9-0x0;var _0x40e2a2=_0x47ea[_0x4bb2b9];return _0x40e2a2;};'use strict';var multer=require(_0xa47e('0x0'));var util=require(_0xa47e('0x1'));var path=require(_0xa47e('0x2'));var timeout=require(_0xa47e('0x3'));var express=require('express');var router=express[_0xa47e('0x4')]();var fs_extra=require(_0xa47e('0x5'));var auth=require(_0xa47e('0x6'));var interaction=require(_0xa47e('0x7'));var config=require(_0xa47e('0x8'));var controller=require(_0xa47e('0x9'));router[_0xa47e('0xa')]('/',auth[_0xa47e('0xb')](),controller[_0xa47e('0xc')]);router['get'](_0xa47e('0xd'),auth[_0xa47e('0xb')](),controller[_0xa47e('0xe')]);router[_0xa47e('0xa')](_0xa47e('0xf'),auth[_0xa47e('0x10')](),controller[_0xa47e('0x11')]);router[_0xa47e('0xa')](_0xa47e('0x12'),auth[_0xa47e('0x10')](),controller[_0xa47e('0x13')]);router['get'](_0xa47e('0x14'),auth['isAuthenticated'](),controller['getMessages']);router[_0xa47e('0xa')](_0xa47e('0x15'),auth[_0xa47e('0x10')](),controller[_0xa47e('0x16')]);router[_0xa47e('0xa')](_0xa47e('0x17'),auth['isAuthenticated'](),controller['download']);router[_0xa47e('0x18')]('/',auth[_0xa47e('0xb')](),controller[_0xa47e('0x19')]);router['post'](_0xa47e('0x1a'),auth['isAuthenticated'](),controller[_0xa47e('0x1b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3a4c00,_0x319e69,_0x47bbaa){_0x47bbaa(null,path['join'](config['root'],_0xa47e('0x1c')));},'filename':function(_0x588630,_0x50255b,_0x1e8f44){_0x1e8f44(null,util['format'](_0xa47e('0x1d'),Date[_0xa47e('0x1e')](),_0x50255b[_0xa47e('0x1f')][_0xa47e('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xa47e('0x21'),upload[_0xa47e('0x22')](_0xa47e('0x23')),controller[_0xa47e('0x24')]);router[_0xa47e('0x18')](_0xa47e('0x14'),auth[_0xa47e('0x10')](),controller[_0xa47e('0x25')]);router[_0xa47e('0x18')](_0xa47e('0x26'),auth['isAuthenticated'](),interaction[_0xa47e('0x27')](_0xa47e('0x28'),'chatinteraction:addtags'),controller[_0xa47e('0x29')]);router['put']('/:id',auth[_0xa47e('0xb')](),interaction[_0xa47e('0x27')](_0xa47e('0x28'),_0xa47e('0x2a')),controller[_0xa47e('0x2b')]);router[_0xa47e('0x2c')](_0xa47e('0x2d'),controller[_0xa47e('0x2e')]);router[_0xa47e('0x2c')]('/:id/abandon',auth['isChatInteractionAuthorized'](),controller[_0xa47e('0x2f')]);router[_0xa47e('0x2c')](_0xa47e('0x30'),controller[_0xa47e('0x31')]);router[_0xa47e('0x32')]('/:id',auth['isAuthenticated'](),interaction[_0xa47e('0x27')](_0xa47e('0x28'),_0xa47e('0x33')),controller['destroy']);router[_0xa47e('0x32')]('/:id/tags',auth[_0xa47e('0xb')](),controller[_0xa47e('0x34')]);module[_0xa47e('0x35')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 89b258d..8886f32 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 _0x0dc8=['sequelize','TEXT','medium','BOOLEAN','INTEGER'];(function(_0x4f0d23,_0x518e4e){var _0x48a016=function(_0xe35384){while(--_0xe35384){_0x4f0d23['push'](_0x4f0d23['shift']());}};_0x48a016(++_0x518e4e);}(_0x0dc8,0x8c));var _0x80dc=function(_0x5de7f2,_0x358f95){_0x5de7f2=_0x5de7f2-0x0;var _0x1095d3=_0x0dc8[_0x5de7f2];return _0x1095d3;};'use strict';var Sequelize=require(_0x80dc('0x0'));module['exports']={'body':{'type':Sequelize[_0x80dc('0x1')](_0x80dc('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x80dc('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x80dc('0x4')]}}; \ No newline at end of file +var _0x62d8=['exports','medium','BOOLEAN','sequelize'];(function(_0x533110,_0x20937f){var _0xc3c866=function(_0x2d4a68){while(--_0x2d4a68){_0x533110['push'](_0x533110['shift']());}};_0xc3c866(++_0x20937f);}(_0x62d8,0x1ef));var _0x862d=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x62d8[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x862d('0x0'));module[_0x862d('0x1')]={'body':{'type':Sequelize['TEXT'](_0x862d('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x862d('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 f612a9d..ec868a1 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 _0x84b7=['Agents','UserProfileResource','length','agent','resourceId','push','FromId','ToId','read','-createdAt','all','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','end','status','offset','limit','undefined','count','set','json','apply','reject','save','update','then','destroy','sendStatus','name','send','index','map','rawAttributes','fieldName','key','query','filters','attributes','intersection','model','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','ChatInternalMessage','include','findAll','catch','keys','includeAll','find','create','body','params','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','admin','user','fullname','role','userpic','internal','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','UserProfileSection'];(function(_0x149745,_0xc02079){var _0x1c745e=function(_0x244f1f){while(--_0x244f1f){_0x149745['push'](_0x149745['shift']());}};_0x1c745e(++_0xc02079);}(_0x84b7,0xef));var _0x784b=function(_0x1ae31c,_0x8dcd2d){_0x1ae31c=_0x1ae31c-0x0;var _0x19519d=_0x84b7[_0x1ae31c];return _0x19519d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x784b('0x0'));var zipdir=require(_0x784b('0x1'));var jsonpatch=require(_0x784b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x784b('0x3'));var Mustache=require('mustache');var util=require(_0x784b('0x4'));var path=require(_0x784b('0x5'));var sox=require(_0x784b('0x6'));var csv=require(_0x784b('0x7'));var ejs=require(_0x784b('0x8'));var fs=require('fs');var fs_extra=require(_0x784b('0x9'));var _=require(_0x784b('0xa'));var squel=require(_0x784b('0xb'));var crypto=require(_0x784b('0xc'));var jsforce=require(_0x784b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x784b('0x7'));var querystring=require(_0x784b('0xe'));var Papa=require(_0x784b('0xf'));var Redis=require(_0x784b('0x10'));var authService=require(_0x784b('0x11'));var qs=require(_0x784b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x784b('0x13'));var logger=require(_0x784b('0x14'))(_0x784b('0x15'));var utils=require(_0x784b('0x16'));var config=require(_0x784b('0x17'));var licenseUtil=require(_0x784b('0x18'));var db=require(_0x784b('0x19'))['db'];config[_0x784b('0x1a')]=_[_0x784b('0x1b')](config[_0x784b('0x1a')],{'host':_0x784b('0x1c'),'port':0x18eb});var socket=require(_0x784b('0x1d'))(new Redis(config[_0x784b('0x1a')]));require(_0x784b('0x1e'))[_0x784b('0x1f')](socket);function respondWithStatusCode(_0x575375,_0x425168){_0x425168=_0x425168||0xcc;return function(_0x3370cf){if(_0x3370cf){return _0x575375['sendStatus'](_0x425168);}return _0x575375['status'](_0x425168)[_0x784b('0x20')]();};}function respondWithResult(_0x5a5590,_0x457a70){_0x457a70=_0x457a70||0xc8;return function(_0xa02f4f){if(_0xa02f4f){return _0x5a5590[_0x784b('0x21')](_0x457a70)['json'](_0xa02f4f);}};}function respondWithFilteredResult(_0x6ed2f3,_0x3443bd){return function(_0x114a7d){if(_0x114a7d){var _0x205042=typeof _0x3443bd[_0x784b('0x22')]==='undefined'&&typeof _0x3443bd[_0x784b('0x23')]===_0x784b('0x24');var _0x56efef=_0x114a7d[_0x784b('0x25')];var _0x3e962a=_0x205042?0x0:_0x3443bd[_0x784b('0x22')];var _0x9481c2=_0x205042?_0x114a7d[_0x784b('0x25')]:_0x3443bd[_0x784b('0x22')]+_0x3443bd[_0x784b('0x23')];var _0x3b39c0;if(_0x9481c2>=_0x56efef){_0x9481c2=_0x56efef;_0x3b39c0=0xc8;}else{_0x3b39c0=0xce;}_0x6ed2f3[_0x784b('0x21')](_0x3b39c0);return _0x6ed2f3[_0x784b('0x26')]('Content-Range',_0x3e962a+'-'+_0x9481c2+'/'+_0x56efef)[_0x784b('0x27')](_0x114a7d);}return null;};}function patchUpdates(_0x15d89b){return function(_0x34b26f){try{jsonpatch[_0x784b('0x28')](_0x34b26f,_0x15d89b,!![]);}catch(_0x3905c7){return BPromise[_0x784b('0x29')](_0x3905c7);}return _0x34b26f[_0x784b('0x2a')]();};}function saveUpdates(_0x1a702c,_0x34d98d){return function(_0x463260){if(_0x463260){return _0x463260[_0x784b('0x2b')](_0x1a702c)[_0x784b('0x2c')](function(_0x46955e){return _0x46955e;});}return null;};}function removeEntity(_0x8dcf24,_0x1566ce){return function(_0x536c42){if(_0x536c42){return _0x536c42[_0x784b('0x2d')]()[_0x784b('0x2c')](function(){_0x8dcf24[_0x784b('0x21')](0xcc)[_0x784b('0x20')]();});}};}function handleEntityNotFound(_0x3b437d,_0x397077){return function(_0x537abb){if(!_0x537abb){_0x3b437d[_0x784b('0x2e')](0x194);}return _0x537abb;};}function handleError(_0x1bde81,_0x370f31){_0x370f31=_0x370f31||0x1f4;return function(_0x280727){logger['error'](_0x280727['stack']);if(_0x280727[_0x784b('0x2f')]){delete _0x280727[_0x784b('0x2f')];}_0x1bde81[_0x784b('0x21')](_0x370f31)[_0x784b('0x30')](_0x280727);};}exports[_0x784b('0x31')]=function(_0x16de7f,_0x20a1a6){var _0x5dc706={},_0x4722ea={},_0x4b643e={'count':0x0,'rows':[]};var _0x55596a=_[_0x784b('0x32')](db['ChatInternalMessage'][_0x784b('0x33')],function(_0x2df3bb){return{'name':_0x2df3bb[_0x784b('0x34')],'type':_0x2df3bb['type'][_0x784b('0x35')]};});_0x4722ea['model']=_[_0x784b('0x32')](_0x55596a,_0x784b('0x2f'));_0x4722ea[_0x784b('0x36')]=_['keys'](_0x16de7f['query']);_0x4722ea[_0x784b('0x37')]=_['intersection'](_0x4722ea['model'],_0x4722ea[_0x784b('0x36')]);_0x5dc706[_0x784b('0x38')]=_[_0x784b('0x39')](_0x4722ea[_0x784b('0x3a')],qs['fields'](_0x16de7f['query'][_0x784b('0x3b')]));_0x5dc706['attributes']=_0x5dc706[_0x784b('0x38')]['length']?_0x5dc706[_0x784b('0x38')]:_0x4722ea[_0x784b('0x3a')];if(!_0x16de7f[_0x784b('0x36')][_0x784b('0x3c')](_0x784b('0x3d'))){_0x5dc706[_0x784b('0x23')]=qs['limit'](_0x16de7f[_0x784b('0x36')]['limit']);_0x5dc706['offset']=qs[_0x784b('0x22')](_0x16de7f[_0x784b('0x36')][_0x784b('0x22')]);}_0x5dc706[_0x784b('0x3e')]=qs['sort'](_0x16de7f['query'][_0x784b('0x3f')]);_0x5dc706['where']=qs[_0x784b('0x37')](_[_0x784b('0x40')](_0x16de7f[_0x784b('0x36')],_0x4722ea[_0x784b('0x37')]),_0x55596a);if(_0x16de7f[_0x784b('0x36')][_0x784b('0x41')]){_0x5dc706[_0x784b('0x42')]=_[_0x784b('0x43')](_0x5dc706[_0x784b('0x42')],{'$or':_[_0x784b('0x32')](_0x55596a,function(_0x56a912){if(_0x56a912['type']!==_0x784b('0x44')){var _0x36e21d={};_0x36e21d[_0x56a912[_0x784b('0x2f')]]={'$like':'%'+_0x16de7f[_0x784b('0x36')][_0x784b('0x41')]+'%'};return _0x36e21d;}})});}_0x5dc706=_['merge']({},_0x5dc706,_0x16de7f[_0x784b('0x45')]);var _0x511b53={'where':_0x5dc706[_0x784b('0x42')]};return db[_0x784b('0x46')][_0x784b('0x25')](_0x511b53)[_0x784b('0x2c')](function(_0x3ed86a){_0x4b643e['count']=_0x3ed86a;if(_0x16de7f['query']['includeAll']){_0x5dc706[_0x784b('0x47')]=[{'all':!![]}];}return db[_0x784b('0x46')][_0x784b('0x48')](_0x5dc706);})[_0x784b('0x2c')](function(_0x3ae433){_0x4b643e['rows']=_0x3ae433;return _0x4b643e;})[_0x784b('0x2c')](respondWithFilteredResult(_0x20a1a6,_0x5dc706))[_0x784b('0x49')](handleError(_0x20a1a6,null));};exports['show']=function(_0x257d1c,_0x197af6){var _0x23d4c1={'raw':!![],'where':{'id':_0x257d1c['params']['id']}},_0x3f6536={};_0x3f6536[_0x784b('0x3a')]=_['keys'](db[_0x784b('0x46')][_0x784b('0x33')]);_0x3f6536[_0x784b('0x36')]=_[_0x784b('0x4a')](_0x257d1c[_0x784b('0x36')]);_0x3f6536['filters']=_[_0x784b('0x39')](_0x3f6536['model'],_0x3f6536[_0x784b('0x36')]);_0x23d4c1[_0x784b('0x38')]=_[_0x784b('0x39')](_0x3f6536[_0x784b('0x3a')],qs['fields'](_0x257d1c['query'][_0x784b('0x3b')]));_0x23d4c1[_0x784b('0x38')]=_0x23d4c1['attributes']['length']?_0x23d4c1['attributes']:_0x3f6536[_0x784b('0x3a')];if(_0x257d1c[_0x784b('0x36')][_0x784b('0x4b')]){_0x23d4c1['include']=[{'all':!![]}];}_0x23d4c1=_[_0x784b('0x43')]({},_0x23d4c1,_0x257d1c[_0x784b('0x45')]);return db[_0x784b('0x46')][_0x784b('0x4c')](_0x23d4c1)[_0x784b('0x2c')](handleEntityNotFound(_0x197af6,null))['then'](respondWithResult(_0x197af6,null))[_0x784b('0x49')](handleError(_0x197af6,null));};exports[_0x784b('0x4d')]=function(_0x5b4a2d,_0x3f8904){return db[_0x784b('0x46')][_0x784b('0x4d')](_0x5b4a2d[_0x784b('0x4e')],{})[_0x784b('0x2c')](respondWithResult(_0x3f8904,0xc9))[_0x784b('0x49')](handleError(_0x3f8904,null));};exports['update']=function(_0x57e128,_0xd06b1f){if(_0x57e128['body']['id']){delete _0x57e128['body']['id'];}return db[_0x784b('0x46')][_0x784b('0x4c')]({'where':{'id':_0x57e128['params']['id']}})['then'](handleEntityNotFound(_0xd06b1f,null))[_0x784b('0x2c')](saveUpdates(_0x57e128[_0x784b('0x4e')],null))[_0x784b('0x2c')](respondWithResult(_0xd06b1f,null))[_0x784b('0x49')](handleError(_0xd06b1f,null));};exports['destroy']=function(_0x57d25e,_0x3ed74e){return db[_0x784b('0x46')][_0x784b('0x4c')]({'where':{'id':_0x57d25e[_0x784b('0x4f')]['id']}})[_0x784b('0x2c')](handleEntityNotFound(_0x3ed74e,null))['then'](removeEntity(_0x3ed74e,null))['catch'](handleError(_0x3ed74e,null));};exports[_0x784b('0x50')]=function(_0x395d83,_0x379b2c){return db['ChatInternalMessage'][_0x784b('0x50')]()[_0x784b('0x2c')](respondWithResult(_0x379b2c,null))[_0x784b('0x49')](handleError(_0x379b2c,null));};function wrapUser(_0x57fdfa){return function(_0x54da94){var _0x53a897=_0x57fdfa[_0x784b('0x51')]({'plain':!![]});_0x53a897[_0x784b('0x52')]=[];if(_0x54da94){_0x53a897[_0x784b('0x53')]=_0x54da94[_0x784b('0x54')];_0x53a897[_0x784b('0x55')]=_0x54da94;}else{_0x53a897[_0x784b('0x53')]=moment(0x0)[_0x784b('0x56')](_0x784b('0x57'));_0x53a897[_0x784b('0x55')]={};}return _0x53a897;};}exports[_0x784b('0x58')]=function(_0x3d2ebe,_0x2458aa,_0x338d88){var _0xc686cc=[];return db[_0x784b('0x59')]['findAll']({'where':{'role':['agent',_0x784b('0x5a'),_0x784b('0x5b')]},'attributes':['id',_0x784b('0x5c'),_0x784b('0x2f'),_0x784b('0x5d'),_0x784b('0x5e'),_0x784b('0x5f'),'online',_0x784b('0x60'),_0x784b('0x61'),_0x784b('0x62')],'order':qs['sort'](_0x784b('0x63')),'include':[{'model':db[_0x784b('0x64')],'as':_0x784b('0x65'),'attributes':['id','name','type'],'through':{'attributes':[]}}]})[_0x784b('0x2c')](function(_0x49bbbf){if(_0x49bbbf){var _0x474fac=_0x3d2ebe['user'][_0x784b('0x51')]({'plain':!![]});if(!_0x474fac)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x474fac['role']===_0x784b('0x5b')){return db[_0x784b('0x66')][_0x784b('0x4c')]({'where':{'name':_0x784b('0x67'),'userProfileId':_0x474fac['userProfileId']},'raw':!![]})['then'](function(_0x4e4349){if(_0x4e4349){if(_0x4e4349['autoAssociation']===0x0){return db[_0x784b('0x68')][_0x784b('0x48')]({'where':{'sectionId':_0x4e4349['id']},'raw':!![]})[_0x784b('0x2c')](function(_0x4c9288){var _0x16a262=[];if(_['isEmpty'](_0x4c9288)){_0x16a262=_['filter'](_0x49bbbf,function(_0x4c6d50){if(_0x4c6d50['role']!=='agent'){return _0x4c6d50;}});return _0x16a262;}else{for(var _0x54b3f1=0x0;_0x54b3f1<_0x49bbbf[_0x784b('0x69')];_0x54b3f1++){var _0x4c88e1=_0x49bbbf[_0x54b3f1];if(_0x4c88e1[_0x784b('0x5d')]===_0x784b('0x6a')){var _0x15e9e9=_[_0x784b('0x4c')](_0x4c9288,function(_0x6bcb9e){return _0x6bcb9e[_0x784b('0x6b')]===_0x4c88e1['id'];});if(_0x15e9e9)_0x16a262['push'](_0x4c88e1);}else{_0x16a262[_0x784b('0x6c')](_0x4c88e1);}}return _0x16a262;}});}else{return _0x49bbbf;}}else{var _0x4cb719=_[_0x784b('0x41')](_0x49bbbf,function(_0x307405){if(_0x307405['role']!=='agent'){return _0x307405;}});return _0x4cb719;}});}else{return _0x49bbbf;}}})['then'](function(_0x60f88d){var _0x2b0f9d=[];if(_0x60f88d){_0xc686cc=_0x60f88d;for(var _0x4417b8=0x0;_0x4417b8<_0x60f88d[_0x784b('0x69')];_0x4417b8+=0x1){_0xc686cc[_0x4417b8][_0x784b('0x52')]=[];_0x2b0f9d[_0x784b('0x6c')](db[_0x784b('0x46')][_0x784b('0x4c')]({'where':{'FromId':[_0x3d2ebe[_0x784b('0x5b')]['id'],_0x60f88d[_0x4417b8]['id']],'ToId':[_0x3d2ebe[_0x784b('0x5b')]['id'],_0x60f88d[_0x4417b8]['id']],'ChatGroupId':null},'attributes':['id',_0x784b('0x54'),_0x784b('0x6d'),_0x784b('0x6e'),_0x784b('0x6f'),_0x784b('0x4e')],'order':qs[_0x784b('0x3f')](_0x784b('0x70')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x784b('0x2c')](wrapUser(_0x60f88d[_0x4417b8])));}return BPromise[_0x784b('0x71')](_0x2b0f9d);}return[];})['then'](function(_0x431440){return{'rows':_0x431440,'count':_0x431440[_0x784b('0x69')]};})[_0x784b('0x2c')](respondWithResult(_0x2458aa,null))[_0x784b('0x49')](handleError(_0x2458aa,null));}; \ No newline at end of file +var _0x82d2=['lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','user','fullname','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','push','FromId','ToId','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','show','include','options','find','create','body','params','describe','get','messages','createdAt'];(function(_0x30abff,_0x5f2c5f){var _0x4c571e=function(_0x43de9a){while(--_0x43de9a){_0x30abff['push'](_0x30abff['shift']());}};_0x4c571e(++_0x5f2c5f);}(_0x82d2,0x1de));var _0x282d=function(_0x30ebca,_0x516daa){_0x30ebca=_0x30ebca-0x0;var _0x2f37cf=_0x82d2[_0x30ebca];return _0x2f37cf;};'use strict';var emlformat=require(_0x282d('0x0'));var rimraf=require(_0x282d('0x1'));var zipdir=require(_0x282d('0x2'));var jsonpatch=require(_0x282d('0x3'));var rp=require(_0x282d('0x4'));var moment=require(_0x282d('0x5'));var BPromise=require(_0x282d('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x282d('0x7'));var ejs=require(_0x282d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x282d('0x9'));var squel=require('squel');var crypto=require(_0x282d('0xa'));var jsforce=require(_0x282d('0xb'));var deskjs=require(_0x282d('0xc'));var toCsv=require('to-csv');var querystring=require(_0x282d('0xd'));var Papa=require(_0x282d('0xe'));var Redis=require(_0x282d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x282d('0x10'));var as=require(_0x282d('0x11'));var hardwareService=require(_0x282d('0x12'));var logger=require(_0x282d('0x13'))(_0x282d('0x14'));var utils=require(_0x282d('0x15'));var config=require(_0x282d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x282d('0x17'))['db'];config[_0x282d('0x18')]=_['defaults'](config[_0x282d('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x282d('0x19'))(new Redis(config[_0x282d('0x18')]));require('./chatInternalMessage.socket')[_0x282d('0x1a')](socket);function respondWithStatusCode(_0x4eeaca,_0x595660){_0x595660=_0x595660||0xcc;return function(_0x56306a){if(_0x56306a){return _0x4eeaca[_0x282d('0x1b')](_0x595660);}return _0x4eeaca[_0x282d('0x1c')](_0x595660)[_0x282d('0x1d')]();};}function respondWithResult(_0x1bf0eb,_0x5bae9f){_0x5bae9f=_0x5bae9f||0xc8;return function(_0x4c2f8f){if(_0x4c2f8f){return _0x1bf0eb[_0x282d('0x1c')](_0x5bae9f)[_0x282d('0x1e')](_0x4c2f8f);}};}function respondWithFilteredResult(_0xe81367,_0x814a5){return function(_0x5d233e){if(_0x5d233e){var _0x2fc620=typeof _0x814a5[_0x282d('0x1f')]===_0x282d('0x20')&&typeof _0x814a5['limit']===_0x282d('0x20');var _0x2eb6a9=_0x5d233e[_0x282d('0x21')];var _0x285079=_0x2fc620?0x0:_0x814a5['offset'];var _0x1f8734=_0x2fc620?_0x5d233e[_0x282d('0x21')]:_0x814a5[_0x282d('0x1f')]+_0x814a5[_0x282d('0x22')];var _0x42ddef;if(_0x1f8734>=_0x2eb6a9){_0x1f8734=_0x2eb6a9;_0x42ddef=0xc8;}else{_0x42ddef=0xce;}_0xe81367[_0x282d('0x1c')](_0x42ddef);return _0xe81367[_0x282d('0x23')](_0x282d('0x24'),_0x285079+'-'+_0x1f8734+'/'+_0x2eb6a9)[_0x282d('0x1e')](_0x5d233e);}return null;};}function patchUpdates(_0x4dec99){return function(_0x2ac9e8){try{jsonpatch['apply'](_0x2ac9e8,_0x4dec99,!![]);}catch(_0x4bc33f){return BPromise[_0x282d('0x25')](_0x4bc33f);}return _0x2ac9e8[_0x282d('0x26')]();};}function saveUpdates(_0x4ae500,_0x29a0d8){return function(_0x327a1a){if(_0x327a1a){return _0x327a1a['update'](_0x4ae500)[_0x282d('0x27')](function(_0x230bb6){return _0x230bb6;});}return null;};}function removeEntity(_0x7f216e,_0x4826d6){return function(_0x304935){if(_0x304935){return _0x304935[_0x282d('0x28')]()[_0x282d('0x27')](function(){_0x7f216e[_0x282d('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f45c0,_0x36b2e2){return function(_0x5d9c61){if(!_0x5d9c61){_0x5f45c0[_0x282d('0x1b')](0x194);}return _0x5d9c61;};}function handleError(_0x771403,_0xe76281){_0xe76281=_0xe76281||0x1f4;return function(_0x1fbbc9){logger[_0x282d('0x29')](_0x1fbbc9[_0x282d('0x2a')]);if(_0x1fbbc9[_0x282d('0x2b')]){delete _0x1fbbc9[_0x282d('0x2b')];}_0x771403[_0x282d('0x1c')](_0xe76281)[_0x282d('0x2c')](_0x1fbbc9);};}exports[_0x282d('0x2d')]=function(_0x56086b,_0x396e86){var _0x1cb5fb={},_0x573922={},_0x4bee4f={'count':0x0,'rows':[]};var _0x26faa3=_[_0x282d('0x2e')](db[_0x282d('0x2f')][_0x282d('0x30')],function(_0x16681b){return{'name':_0x16681b[_0x282d('0x31')],'type':_0x16681b[_0x282d('0x32')][_0x282d('0x33')]};});_0x573922['model']=_['map'](_0x26faa3,_0x282d('0x2b'));_0x573922['query']=_[_0x282d('0x34')](_0x56086b[_0x282d('0x35')]);_0x573922[_0x282d('0x36')]=_[_0x282d('0x37')](_0x573922[_0x282d('0x38')],_0x573922[_0x282d('0x35')]);_0x1cb5fb['attributes']=_['intersection'](_0x573922[_0x282d('0x38')],qs[_0x282d('0x39')](_0x56086b['query']['fields']));_0x1cb5fb[_0x282d('0x3a')]=_0x1cb5fb[_0x282d('0x3a')][_0x282d('0x3b')]?_0x1cb5fb[_0x282d('0x3a')]:_0x573922[_0x282d('0x38')];if(!_0x56086b[_0x282d('0x35')][_0x282d('0x3c')](_0x282d('0x3d'))){_0x1cb5fb['limit']=qs[_0x282d('0x22')](_0x56086b[_0x282d('0x35')][_0x282d('0x22')]);_0x1cb5fb[_0x282d('0x1f')]=qs[_0x282d('0x1f')](_0x56086b['query'][_0x282d('0x1f')]);}_0x1cb5fb['order']=qs['sort'](_0x56086b[_0x282d('0x35')][_0x282d('0x3e')]);_0x1cb5fb[_0x282d('0x3f')]=qs[_0x282d('0x36')](_[_0x282d('0x40')](_0x56086b[_0x282d('0x35')],_0x573922['filters']),_0x26faa3);if(_0x56086b[_0x282d('0x35')]['filter']){_0x1cb5fb[_0x282d('0x3f')]=_['merge'](_0x1cb5fb[_0x282d('0x3f')],{'$or':_[_0x282d('0x2e')](_0x26faa3,function(_0x4ddd46){if(_0x4ddd46['type']!=='VIRTUAL'){var _0x5b2a25={};_0x5b2a25[_0x4ddd46[_0x282d('0x2b')]]={'$like':'%'+_0x56086b[_0x282d('0x35')][_0x282d('0x41')]+'%'};return _0x5b2a25;}})});}_0x1cb5fb=_[_0x282d('0x42')]({},_0x1cb5fb,_0x56086b['options']);var _0x14549f={'where':_0x1cb5fb[_0x282d('0x3f')]};return db[_0x282d('0x2f')]['count'](_0x14549f)[_0x282d('0x27')](function(_0x2df434){_0x4bee4f[_0x282d('0x21')]=_0x2df434;if(_0x56086b[_0x282d('0x35')][_0x282d('0x43')]){_0x1cb5fb['include']=[{'all':!![]}];}return db[_0x282d('0x2f')][_0x282d('0x44')](_0x1cb5fb);})[_0x282d('0x27')](function(_0x662175){_0x4bee4f[_0x282d('0x45')]=_0x662175;return _0x4bee4f;})[_0x282d('0x27')](respondWithFilteredResult(_0x396e86,_0x1cb5fb))[_0x282d('0x46')](handleError(_0x396e86,null));};exports[_0x282d('0x47')]=function(_0x482e0e,_0x1bad24){var _0x4f217c={'raw':!![],'where':{'id':_0x482e0e['params']['id']}},_0x149947={};_0x149947[_0x282d('0x38')]=_[_0x282d('0x34')](db['ChatInternalMessage'][_0x282d('0x30')]);_0x149947[_0x282d('0x35')]=_[_0x282d('0x34')](_0x482e0e[_0x282d('0x35')]);_0x149947['filters']=_['intersection'](_0x149947['model'],_0x149947['query']);_0x4f217c['attributes']=_[_0x282d('0x37')](_0x149947[_0x282d('0x38')],qs[_0x282d('0x39')](_0x482e0e[_0x282d('0x35')][_0x282d('0x39')]));_0x4f217c[_0x282d('0x3a')]=_0x4f217c['attributes']['length']?_0x4f217c[_0x282d('0x3a')]:_0x149947[_0x282d('0x38')];if(_0x482e0e['query'][_0x282d('0x43')]){_0x4f217c[_0x282d('0x48')]=[{'all':!![]}];}_0x4f217c=_[_0x282d('0x42')]({},_0x4f217c,_0x482e0e[_0x282d('0x49')]);return db[_0x282d('0x2f')][_0x282d('0x4a')](_0x4f217c)[_0x282d('0x27')](handleEntityNotFound(_0x1bad24,null))[_0x282d('0x27')](respondWithResult(_0x1bad24,null))[_0x282d('0x46')](handleError(_0x1bad24,null));};exports['create']=function(_0x3c4390,_0x38379b){return db[_0x282d('0x2f')][_0x282d('0x4b')](_0x3c4390[_0x282d('0x4c')],{})['then'](respondWithResult(_0x38379b,0xc9))[_0x282d('0x46')](handleError(_0x38379b,null));};exports['update']=function(_0x1ec10c,_0x250a34){if(_0x1ec10c[_0x282d('0x4c')]['id']){delete _0x1ec10c[_0x282d('0x4c')]['id'];}return db[_0x282d('0x2f')][_0x282d('0x4a')]({'where':{'id':_0x1ec10c['params']['id']}})[_0x282d('0x27')](handleEntityNotFound(_0x250a34,null))[_0x282d('0x27')](saveUpdates(_0x1ec10c[_0x282d('0x4c')],null))[_0x282d('0x27')](respondWithResult(_0x250a34,null))[_0x282d('0x46')](handleError(_0x250a34,null));};exports[_0x282d('0x28')]=function(_0x100a6e,_0x37b09b){return db[_0x282d('0x2f')]['find']({'where':{'id':_0x100a6e[_0x282d('0x4d')]['id']}})[_0x282d('0x27')](handleEntityNotFound(_0x37b09b,null))[_0x282d('0x27')](removeEntity(_0x37b09b,null))[_0x282d('0x46')](handleError(_0x37b09b,null));};exports[_0x282d('0x4e')]=function(_0x51a84b,_0x28cd31){return db[_0x282d('0x2f')]['describe']()['then'](respondWithResult(_0x28cd31,null))[_0x282d('0x46')](handleError(_0x28cd31,null));};function wrapUser(_0x87fc00){return function(_0x5577c6){var _0x7c5256=_0x87fc00[_0x282d('0x4f')]({'plain':!![]});_0x7c5256[_0x282d('0x50')]=[];if(_0x5577c6){_0x7c5256['lastMessageAt']=_0x5577c6[_0x282d('0x51')];_0x7c5256[_0x282d('0x52')]=_0x5577c6;}else{_0x7c5256[_0x282d('0x53')]=moment(0x0)[_0x282d('0x54')](_0x282d('0x55'));_0x7c5256[_0x282d('0x52')]={};}return _0x7c5256;};}exports[_0x282d('0x56')]=function(_0x3992fd,_0x4ce518,_0x4dea36){var _0x27e39c=[];return db[_0x282d('0x57')][_0x282d('0x44')]({'where':{'role':[_0x282d('0x58'),'admin',_0x282d('0x59')]},'attributes':['id',_0x282d('0x5a'),_0x282d('0x2b'),'role',_0x282d('0x5b'),_0x282d('0x5c'),_0x282d('0x5d'),_0x282d('0x5e'),_0x282d('0x5f'),_0x282d('0x60')],'order':qs[_0x282d('0x3e')](_0x282d('0x61')),'include':[{'model':db[_0x282d('0x62')],'as':_0x282d('0x63'),'attributes':['id','name',_0x282d('0x32')],'through':{'attributes':[]}}]})['then'](function(_0x48d833){if(_0x48d833){var _0x587e6e=_0x3992fd[_0x282d('0x59')][_0x282d('0x4f')]({'plain':!![]});if(!_0x587e6e)throw new Error(_0x282d('0x64'));if(_0x587e6e[_0x282d('0x65')]===_0x282d('0x59')){return db[_0x282d('0x66')][_0x282d('0x4a')]({'where':{'name':_0x282d('0x67'),'userProfileId':_0x587e6e[_0x282d('0x68')]},'raw':!![]})[_0x282d('0x27')](function(_0xb20c36){if(_0xb20c36){if(_0xb20c36[_0x282d('0x69')]===0x0){return db[_0x282d('0x6a')][_0x282d('0x44')]({'where':{'sectionId':_0xb20c36['id']},'raw':!![]})['then'](function(_0x4edf9d){var _0xd39718=[];if(_['isEmpty'](_0x4edf9d)){_0xd39718=_['filter'](_0x48d833,function(_0x276a09){if(_0x276a09['role']!==_0x282d('0x58')){return _0x276a09;}});return _0xd39718;}else{for(var _0x180257=0x0;_0x180257<_0x48d833[_0x282d('0x3b')];_0x180257++){var _0x40cc9b=_0x48d833[_0x180257];if(_0x40cc9b[_0x282d('0x65')]===_0x282d('0x58')){var _0x4d748e=_[_0x282d('0x4a')](_0x4edf9d,function(_0x3d70fd){return _0x3d70fd['resourceId']===_0x40cc9b['id'];});if(_0x4d748e)_0xd39718[_0x282d('0x6b')](_0x40cc9b);}else{_0xd39718[_0x282d('0x6b')](_0x40cc9b);}}return _0xd39718;}});}else{return _0x48d833;}}else{var _0x24b259=_['filter'](_0x48d833,function(_0x353141){if(_0x353141[_0x282d('0x65')]!==_0x282d('0x58')){return _0x353141;}});return _0x24b259;}});}else{return _0x48d833;}}})[_0x282d('0x27')](function(_0x35df8a){var _0x27f915=[];if(_0x35df8a){_0x27e39c=_0x35df8a;for(var _0x3dab99=0x0;_0x3dab99<_0x35df8a[_0x282d('0x3b')];_0x3dab99+=0x1){_0x27e39c[_0x3dab99][_0x282d('0x50')]=[];_0x27f915[_0x282d('0x6b')](db[_0x282d('0x2f')][_0x282d('0x4a')]({'where':{'FromId':[_0x3992fd['user']['id'],_0x35df8a[_0x3dab99]['id']],'ToId':[_0x3992fd[_0x282d('0x59')]['id'],_0x35df8a[_0x3dab99]['id']],'ChatGroupId':null},'attributes':['id',_0x282d('0x51'),_0x282d('0x6c'),_0x282d('0x6d'),'read',_0x282d('0x4c')],'order':qs[_0x282d('0x3e')](_0x282d('0x6e')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x35df8a[_0x3dab99])));}return BPromise[_0x282d('0x6f')](_0x27f915);}return[];})[_0x282d('0x27')](function(_0x515716){return{'rows':_0x515716,'count':_0x515716[_0x282d('0x3b')]};})['then'](respondWithResult(_0x4ce518,null))[_0x282d('0x46')](handleError(_0x4ce518,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 617749c..fca291a 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 _0x4d1f=['exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x5421eb,_0x426220){var _0x2a23e5=function(_0x565bc2){while(--_0x565bc2){_0x5421eb['push'](_0x5421eb['shift']());}};_0x2a23e5(++_0x426220);}(_0x4d1f,0x141));var _0xf4d1=function(_0x377899,_0xd248ce){_0x377899=_0x377899-0x0;var _0x3a494b=_0x4d1f[_0x377899];return _0x3a494b;};'use strict';var EventEmitter=require(_0xf4d1('0x0'));var ChatInternalMessage=require(_0xf4d1('0x1'))['db'][_0xf4d1('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xf4d1('0x3')](0x0);var events={'afterCreate':_0xf4d1('0x4'),'afterUpdate':_0xf4d1('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4edab4){return function(_0x1f04b3,_0x506c1c,_0xc4a5c3){ChatInternalMessageEvents['emit'](_0x4edab4+':'+_0x1f04b3['id'],_0x1f04b3);ChatInternalMessageEvents[_0xf4d1('0x6')](_0x4edab4,_0x1f04b3);_0xc4a5c3(null);};}for(var e in events){if(events[_0xf4d1('0x7')](e)){var event=events[e];ChatInternalMessage[_0xf4d1('0x8')](e,emitEvent(event));}}module[_0xf4d1('0x9')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x29a1=['ChatInternalMessage','setMaxListeners','save','update','remove','emit','hook','exports','../../mysqldb'];(function(_0x4afe41,_0x22bd75){var _0x552f0f=function(_0x486dd9){while(--_0x486dd9){_0x4afe41['push'](_0x4afe41['shift']());}};_0x552f0f(++_0x22bd75);}(_0x29a1,0x98));var _0x129a=function(_0x5b855e,_0x5e7311){_0x5b855e=_0x5b855e-0x0;var _0x212462=_0x29a1[_0x5b855e];return _0x212462;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x129a('0x0'))['db'][_0x129a('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x129a('0x2')](0x0);var events={'afterCreate':_0x129a('0x3'),'afterUpdate':_0x129a('0x4'),'afterDestroy':_0x129a('0x5')};function emitEvent(_0x388a4c){return function(_0x37ea8a,_0x5ee4c5,_0x1e846a){ChatInternalMessageEvents[_0x129a('0x6')](_0x388a4c+':'+_0x37ea8a['id'],_0x37ea8a);ChatInternalMessageEvents[_0x129a('0x6')](_0x388a4c,_0x37ea8a);_0x1e846a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x129a('0x7')](e,emitEvent(event));}}module[_0x129a('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 22d46d1..dd33884 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 _0x2e29=['ChatInternalMessage','lodash','../../config/logger','rimraf','../../config/environment','./chatInternalMessage.attributes','define'];(function(_0x58fd96,_0x29c830){var _0x42feab=function(_0x3456d6){while(--_0x3456d6){_0x58fd96['push'](_0x58fd96['shift']());}};_0x42feab(++_0x29c830);}(_0x2e29,0x10b));var _0x92e2=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x2e29[_0x1d24eb];return _0x1dc576;};'use strict';var _=require(_0x92e2('0x0'));var util=require('util');var logger=require(_0x92e2('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x92e2('0x2'));var config=require(_0x92e2('0x3'));var attributes=require(_0x92e2('0x4'));module['exports']=function(_0x548d91,_0x508970){return _0x548d91[_0x92e2('0x5')](_0x92e2('0x6'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd8f6=['exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x10fb4c,_0x36352d){var _0x29e105=function(_0x30ceb2){while(--_0x30ceb2){_0x10fb4c['push'](_0x10fb4c['shift']());}};_0x29e105(++_0x36352d);}(_0xd8f6,0x17e));var _0x6d8f=function(_0x531bc3,_0x3294fa){_0x531bc3=_0x531bc3-0x0;var _0x470938=_0xd8f6[_0x531bc3];return _0x470938;};'use strict';var _=require(_0x6d8f('0x0'));var util=require('util');var logger=require(_0x6d8f('0x1'))(_0x6d8f('0x2'));var moment=require(_0x6d8f('0x3'));var BPromise=require(_0x6d8f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6d8f('0x5'));var rimraf=require(_0x6d8f('0x6'));var config=require(_0x6d8f('0x7'));var attributes=require('./chatInternalMessage.attributes');module[_0x6d8f('0x8')]=function(_0x5ea19d,_0x1b801a){return _0x5ea19d[_0x6d8f('0x9')](_0x6d8f('0xa'),attributes,{'tableName':_0x6d8f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6d8f('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index c140552..bbdd163 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 _0xab86=['info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then'];(function(_0x2d268b,_0x4d097f){var _0x5df1c4=function(_0x4eef49){while(--_0x4eef49){_0x2d268b['push'](_0x2d268b['shift']());}};_0x5df1c4(++_0x4d097f);}(_0xab86,0x13e));var _0x6ab8=function(_0x5187ae,_0x471bc8){_0x5187ae=_0x5187ae-0x0;var _0x46c152=_0xab86[_0x5187ae];return _0x46c152;};'use strict';var _=require(_0x6ab8('0x0'));var util=require(_0x6ab8('0x1'));var moment=require(_0x6ab8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ab8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ab8('0x4'));var logger=require('../../config/logger')(_0x6ab8('0x5'));var config=require(_0x6ab8('0x6'));var jayson=require(_0x6ab8('0x7'));var client=jayson[_0x6ab8('0x8')][_0x6ab8('0x9')]({'port':0x232a});config[_0x6ab8('0xa')]=_[_0x6ab8('0xb')](config[_0x6ab8('0xa')],{'host':_0x6ab8('0xc'),'port':0x18eb});var socket=require(_0x6ab8('0xd'))(new Redis(config[_0x6ab8('0xa')]));require(_0x6ab8('0xe'))[_0x6ab8('0xf')](socket);function respondWithRpcPromise(_0x5127eb,_0x5ea6e6,_0x383594){return new BPromise(function(_0x5b7732,_0x18d3a3){return client[_0x6ab8('0x10')](_0x5127eb,_0x383594)[_0x6ab8('0x11')](function(_0x52d636){logger[_0x6ab8('0x12')](_0x6ab8('0x13'),_0x5ea6e6,'request\x20sent');logger[_0x6ab8('0x14')](_0x6ab8('0x15'),_0x5ea6e6,_0x6ab8('0x16'),JSON['stringify'](_0x52d636));if(_0x52d636[_0x6ab8('0x17')]){if(_0x52d636[_0x6ab8('0x17')][_0x6ab8('0x18')]===0x1f4){logger[_0x6ab8('0x17')](_0x6ab8('0x13'),_0x5ea6e6,_0x52d636[_0x6ab8('0x17')][_0x6ab8('0x19')]);return _0x18d3a3(_0x52d636[_0x6ab8('0x17')][_0x6ab8('0x19')]);}logger['error'](_0x6ab8('0x13'),_0x5ea6e6,_0x52d636[_0x6ab8('0x17')][_0x6ab8('0x19')]);return _0x5b7732(_0x52d636['error'][_0x6ab8('0x19')]);}else{logger[_0x6ab8('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x5ea6e6,'request\x20sent');_0x5b7732(_0x52d636[_0x6ab8('0x1a')]['message']);}})[_0x6ab8('0x1b')](function(_0x292b36){logger[_0x6ab8('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x5ea6e6,_0x292b36);_0x18d3a3(_0x292b36);});});} \ No newline at end of file +var _0x0810=['request\x20sent','debug','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','client','redis','register','then'];(function(_0x43cea3,_0xd8addc){var _0x2723aa=function(_0x57c7ad){while(--_0x57c7ad){_0x43cea3['push'](_0x43cea3['shift']());}};_0x2723aa(++_0xd8addc);}(_0x0810,0x95));var _0x0081=function(_0x3e8e30,_0x3561cc){_0x3e8e30=_0x3e8e30-0x0;var _0x5e123e=_0x0810[_0x3e8e30];return _0x5e123e;};'use strict';var _=require(_0x0081('0x0'));var util=require(_0x0081('0x1'));var moment=require(_0x0081('0x2'));var BPromise=require(_0x0081('0x3'));var rs=require(_0x0081('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0081('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x0081('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0081('0x7')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x0081('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0081('0x8')]));require('./chatInternalMessage.socket')[_0x0081('0x9')](socket);function respondWithRpcPromise(_0x23baed,_0x322360,_0x3d8088){return new BPromise(function(_0x5a1251,_0x24378e){return client['request'](_0x23baed,_0x3d8088)[_0x0081('0xa')](function(_0xd4a7f4){logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x322360,_0x0081('0xb'));logger[_0x0081('0xc')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x322360,_0x0081('0xb'),JSON[_0x0081('0xd')](_0xd4a7f4));if(_0xd4a7f4[_0x0081('0xe')]){if(_0xd4a7f4[_0x0081('0xe')][_0x0081('0xf')]===0x1f4){logger['error'](_0x0081('0x10'),_0x322360,_0xd4a7f4[_0x0081('0xe')]['message']);return _0x24378e(_0xd4a7f4[_0x0081('0xe')][_0x0081('0x11')]);}logger[_0x0081('0xe')](_0x0081('0x10'),_0x322360,_0xd4a7f4[_0x0081('0xe')][_0x0081('0x11')]);return _0x5a1251(_0xd4a7f4['error']['message']);}else{logger[_0x0081('0x12')](_0x0081('0x10'),_0x322360,_0x0081('0xb'));_0x5a1251(_0xd4a7f4[_0x0081('0x13')][_0x0081('0x11')]);}})['catch'](function(_0x15e653){logger[_0x0081('0xe')](_0x0081('0x10'),_0x322360,_0x15e653);_0x24378e(_0x15e653);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 4904a48..ef9f5ae 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 _0x9fb4=['./chatInternalMessage.events','save','remove','update','emit','register','length','chatInternalMessage:'];(function(_0x2d7ea4,_0x57d9cd){var _0x47a6e6=function(_0x5bdad4){while(--_0x5bdad4){_0x2d7ea4['push'](_0x2d7ea4['shift']());}};_0x47a6e6(++_0x57d9cd);}(_0x9fb4,0x68));var _0x49fb=function(_0x34933a,_0x327378){_0x34933a=_0x34933a-0x0;var _0x36abb4=_0x9fb4[_0x34933a];return _0x36abb4;};'use strict';var ChatInternalMessageEvents=require(_0x49fb('0x0'));var events=[_0x49fb('0x1'),_0x49fb('0x2'),_0x49fb('0x3')];function createListener(_0x44f569,_0x4af89d){return function(_0x369c4a){_0x4af89d[_0x49fb('0x4')](_0x44f569,_0x369c4a);};}function removeListener(_0x19bfa6,_0x5f384a){return function(){ChatInternalMessageEvents['removeListener'](_0x19bfa6,_0x5f384a);};}exports[_0x49fb('0x5')]=function(_0x33d1f9){for(var _0x2d6219=0x0,_0x1318b2=events[_0x49fb('0x6')];_0x2d6219<_0x1318b2;_0x2d6219++){var _0x1304a6=events[_0x2d6219];var _0x1dd881=createListener(_0x49fb('0x7')+_0x1304a6,_0x33d1f9);ChatInternalMessageEvents['on'](_0x1304a6,_0x1dd881);}}; \ No newline at end of file +var _0x0465=['register','save','remove','update','emit'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x0465,0x169));var _0x5046=function(_0x525e3d,_0x3c1387){_0x525e3d=_0x525e3d-0x0;var _0x368f1f=_0x0465[_0x525e3d];return _0x368f1f;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x5046('0x0'),_0x5046('0x1'),_0x5046('0x2')];function createListener(_0xe59af1,_0x5b2b2e){return function(_0x38755e){_0x5b2b2e[_0x5046('0x3')](_0xe59af1,_0x38755e);};}function removeListener(_0x3d04d6,_0x5acf20){return function(){ChatInternalMessageEvents['removeListener'](_0x3d04d6,_0x5acf20);};}exports[_0x5046('0x4')]=function(_0xcd73c){for(var _0x33a552=0x0,_0x34466b=events['length'];_0x33a552<_0x34466b;_0x33a552++){var _0xcddcf0=events[_0x33a552];var _0x3a0fc8=createListener('chatInternalMessage:'+_0xcddcf0,_0xcd73c);ChatInternalMessageEvents['on'](_0xcddcf0,_0x3a0fc8);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 0d8b169..85e06fb 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 _0xcb3b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','getUsers','/:id','post','create','put','update','delete','destroy','multer','util','path','express','Router','fs-extra'];(function(_0x52cc12,_0x278385){var _0x273f82=function(_0x27ed2f){while(--_0x27ed2f){_0x52cc12['push'](_0x52cc12['shift']());}};_0x273f82(++_0x278385);}(_0xcb3b,0x10e));var _0xbcb3=function(_0x6e7d2,_0x14e4cd){_0x6e7d2=_0x6e7d2-0x0;var _0x54b7a3=_0xcb3b[_0x6e7d2];return _0x54b7a3;};'use strict';var multer=require(_0xbcb3('0x0'));var util=require(_0xbcb3('0x1'));var path=require(_0xbcb3('0x2'));var timeout=require('connect-timeout');var express=require(_0xbcb3('0x3'));var router=express[_0xbcb3('0x4')]();var fs_extra=require(_0xbcb3('0x5'));var auth=require(_0xbcb3('0x6'));var interaction=require(_0xbcb3('0x7'));var config=require(_0xbcb3('0x8'));var controller=require(_0xbcb3('0x9'));router[_0xbcb3('0xa')]('/',auth[_0xbcb3('0xb')](),controller[_0xbcb3('0xc')]);router[_0xbcb3('0xa')](_0xbcb3('0xd'),auth[_0xbcb3('0xb')](),controller[_0xbcb3('0xe')]);router['get']('/users',auth[_0xbcb3('0xb')](),controller[_0xbcb3('0xf')]);router[_0xbcb3('0xa')](_0xbcb3('0x10'),auth[_0xbcb3('0xb')](),controller['show']);router[_0xbcb3('0x11')]('/',auth[_0xbcb3('0xb')](),controller[_0xbcb3('0x12')]);router[_0xbcb3('0x13')](_0xbcb3('0x10'),controller[_0xbcb3('0x14')]);router[_0xbcb3('0x15')](_0xbcb3('0x10'),auth[_0xbcb3('0xb')](),controller[_0xbcb3('0x16')]);module['exports']=router; \ No newline at end of file +var _0x8504=['put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','isAuthenticated','get','/describe','describe','/users','getUsers','/:id','show','post','create'];(function(_0x5b893a,_0x181a26){var _0x17d001=function(_0x380ca6){while(--_0x380ca6){_0x5b893a['push'](_0x5b893a['shift']());}};_0x17d001(++_0x181a26);}(_0x8504,0xac));var _0x4850=function(_0xf785ae,_0x211032){_0xf785ae=_0xf785ae-0x0;var _0x2e9f79=_0x8504[_0xf785ae];return _0x2e9f79;};'use strict';var multer=require(_0x4850('0x0'));var util=require('util');var path=require(_0x4850('0x1'));var timeout=require(_0x4850('0x2'));var express=require(_0x4850('0x3'));var router=express[_0x4850('0x4')]();var fs_extra=require(_0x4850('0x5'));var auth=require(_0x4850('0x6'));var interaction=require(_0x4850('0x7'));var config=require(_0x4850('0x8'));var controller=require(_0x4850('0x9'));router['get']('/',auth[_0x4850('0xa')](),controller['index']);router[_0x4850('0xb')](_0x4850('0xc'),auth[_0x4850('0xa')](),controller[_0x4850('0xd')]);router[_0x4850('0xb')](_0x4850('0xe'),auth[_0x4850('0xa')](),controller[_0x4850('0xf')]);router[_0x4850('0xb')](_0x4850('0x10'),auth[_0x4850('0xa')](),controller[_0x4850('0x11')]);router[_0x4850('0x12')]('/',auth[_0x4850('0xa')](),controller[_0x4850('0x13')]);router[_0x4850('0x14')](_0x4850('0x10'),controller[_0x4850('0x15')]);router[_0x4850('0x16')](_0x4850('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x4850('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index c0ab029..29f2c90 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 _0x26f9=['exports','medium','ENUM','out','DATE','STRING','TEXT','sequelize'];(function(_0xaa7460,_0x33e950){var _0x298718=function(_0x1d357c){while(--_0x1d357c){_0xaa7460['push'](_0xaa7460['shift']());}};_0x298718(++_0x33e950);}(_0x26f9,0x16f));var _0x926f=function(_0x29e030,_0x1c60cd){_0x29e030=_0x29e030-0x0;var _0x375763=_0x26f9[_0x29e030];return _0x375763;};'use strict';var Sequelize=require(_0x926f('0x0'));module[_0x926f('0x1')]={'body':{'type':Sequelize['TEXT'](_0x926f('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x926f('0x3')]('in',_0x926f('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x926f('0x5')]},'providerName':{'type':Sequelize[_0x926f('0x6')]},'providerResponse':{'type':Sequelize[_0x926f('0x7')]}}; \ No newline at end of file +var _0xbb35=['medium','BOOLEAN','out','DATE','STRING','exports','TEXT'];(function(_0x1475a6,_0x56628c){var _0x3c0d07=function(_0xf4e6f3){while(--_0xf4e6f3){_0x1475a6['push'](_0x1475a6['shift']());}};_0x3c0d07(++_0x56628c);}(_0xbb35,0x1d3));var _0x5bb3=function(_0x216b44,_0xafe5d1){_0x216b44=_0x216b44-0x0;var _0x49fc9b=_0xbb35[_0x216b44];return _0x49fc9b;};'use strict';var Sequelize=require('sequelize');module[_0x5bb3('0x0')]={'body':{'type':Sequelize[_0x5bb3('0x1')](_0x5bb3('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x5bb3('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x5bb3('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x5bb3('0x4')),'defaultValue':_0x5bb3('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x5bb3('0x5')]},'providerName':{'type':Sequelize[_0x5bb3('0x6')]},'providerResponse':{'type':Sequelize[_0x5bb3('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 5cce0fa..c307859 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 _0xc10a=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','destroy','end','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','rows','show','params','length','options','create','body','find','describe','chat-interactions','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','ChatInteractionId','update','isNil','read1stAt','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','interface','SIP/%s','channel','motionChannel','accept','EventManager','acceptmessage','parse','formData','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','fullname','event','rejectmessage','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc10a,0xff));var _0xac10=function(_0x5466ab,_0x227b13){_0x5466ab=_0x5466ab-0x0;var _0x40751a=_0xc10a[_0x5466ab];return _0x40751a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xac10('0x0'));var zipdir=require(_0xac10('0x1'));var jsonpatch=require(_0xac10('0x2'));var rp=require('request-promise');var moment=require(_0xac10('0x3'));var BPromise=require(_0xac10('0x4'));var Mustache=require(_0xac10('0x5'));var util=require(_0xac10('0x6'));var path=require(_0xac10('0x7'));var sox=require(_0xac10('0x8'));var csv=require(_0xac10('0x9'));var ejs=require(_0xac10('0xa'));var fs=require('fs');var fs_extra=require(_0xac10('0xb'));var _=require(_0xac10('0xc'));var squel=require('squel');var crypto=require(_0xac10('0xd'));var jsforce=require(_0xac10('0xe'));var deskjs=require(_0xac10('0xf'));var toCsv=require(_0xac10('0x9'));var querystring=require(_0xac10('0x10'));var Papa=require(_0xac10('0x11'));var Redis=require(_0xac10('0x12'));var authService=require(_0xac10('0x13'));var qs=require(_0xac10('0x14'));var as=require(_0xac10('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac10('0x16'))(_0xac10('0x17'));var utils=require(_0xac10('0x18'));var config=require(_0xac10('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xac10('0x1a')]=_[_0xac10('0x1b')](config['redis'],{'host':_0xac10('0x1c'),'port':0x18eb});var socket=require(_0xac10('0x1d'))(new Redis(config[_0xac10('0x1a')]));require(_0xac10('0x1e'))[_0xac10('0x1f')](socket);var jayson=require(_0xac10('0x20'));var client=jayson[_0xac10('0x21')][_0xac10('0x22')]({'port':0x232c});var client9002=jayson['client'][_0xac10('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x972bea,_0x4deb12,_0x5519f7,_0x57c33a){return new BPromise(function(_0x204bb3,_0x42c1e6){var _0x42581c=_0x57c33a||client;return _0x42581c[_0xac10('0x23')](_0x972bea,_0x5519f7)[_0xac10('0x24')](function(_0x279e78){logger[_0xac10('0x25')](_0xac10('0x26'),_0x4deb12,_0xac10('0x27'));logger[_0xac10('0x28')](_0xac10('0x29'),_0x4deb12,_0xac10('0x27'),JSON[_0xac10('0x2a')](_0x279e78));if(_0x279e78[_0xac10('0x2b')]){if(_0x279e78['error'][_0xac10('0x2c')]===0x1f4){logger['error'](_0xac10('0x26'),_0x4deb12,_0x279e78[_0xac10('0x2b')][_0xac10('0x2d')]);return _0x42c1e6(_0x279e78['error'][_0xac10('0x2d')]);}logger[_0xac10('0x2b')](_0xac10('0x26'),_0x4deb12,_0x279e78['error'][_0xac10('0x2d')]);return _0x204bb3(_0x279e78[_0xac10('0x2b')][_0xac10('0x2d')]);}else{logger[_0xac10('0x25')](_0xac10('0x26'),_0x4deb12,_0xac10('0x27'));_0x204bb3(_0x279e78[_0xac10('0x2e')][_0xac10('0x2d')]);}})[_0xac10('0x2f')](function(_0x2eeb65){logger[_0xac10('0x2b')](_0xac10('0x26'),_0x4deb12,_0x2eeb65);_0x42c1e6(_0x2eeb65);});});}function respondWithStatusCode(_0x51dd53,_0x466780){_0x466780=_0x466780||0xcc;return function(_0x58f28f){if(_0x58f28f){return _0x51dd53[_0xac10('0x30')](_0x466780);}return _0x51dd53[_0xac10('0x31')](_0x466780)['end']();};}function respondWithResult(_0x508805,_0x256c27){_0x256c27=_0x256c27||0xc8;return function(_0x281687){if(_0x281687){return _0x508805['status'](_0x256c27)[_0xac10('0x32')](_0x281687);}};}function respondWithFilteredResult(_0x55c11b,_0x52935c){return function(_0x1d73c8){if(_0x1d73c8){var _0x1220dc=typeof _0x52935c[_0xac10('0x33')]==='undefined'&&typeof _0x52935c['limit']===_0xac10('0x34');var _0x459cfb=_0x1d73c8[_0xac10('0x35')];var _0x2121af=_0x1220dc?0x0:_0x52935c['offset'];var _0x53c4d0=_0x1220dc?_0x1d73c8[_0xac10('0x35')]:_0x52935c[_0xac10('0x33')]+_0x52935c[_0xac10('0x36')];var _0x26f6c3;if(_0x53c4d0>=_0x459cfb){_0x53c4d0=_0x459cfb;_0x26f6c3=0xc8;}else{_0x26f6c3=0xce;}_0x55c11b['status'](_0x26f6c3);return _0x55c11b[_0xac10('0x37')](_0xac10('0x38'),_0x2121af+'-'+_0x53c4d0+'/'+_0x459cfb)[_0xac10('0x32')](_0x1d73c8);}return null;};}function patchUpdates(_0x4ee060){return function(_0x5cb4a5){try{jsonpatch[_0xac10('0x39')](_0x5cb4a5,_0x4ee060,!![]);}catch(_0x377621){return BPromise['reject'](_0x377621);}return _0x5cb4a5['save']();};}function saveUpdates(_0x2d08b3,_0x4c5874){return function(_0x8f7a1f){if(_0x8f7a1f){return _0x8f7a1f['update'](_0x2d08b3)[_0xac10('0x24')](function(_0x1d2d1a){return _0x1d2d1a;});}return null;};}function removeEntity(_0x16b694,_0x316cab){return function(_0x25c594){if(_0x25c594){return _0x25c594[_0xac10('0x3a')]()[_0xac10('0x24')](function(){_0x16b694[_0xac10('0x31')](0xcc)[_0xac10('0x3b')]();});}};}function handleEntityNotFound(_0x4b34d2,_0x24649b){return function(_0x242bad){if(!_0x242bad){_0x4b34d2[_0xac10('0x30')](0x194);}return _0x242bad;};}function handleError(_0x1ac645,_0x5bcec9){_0x5bcec9=_0x5bcec9||0x1f4;return function(_0x13a5e8){logger[_0xac10('0x2b')](_0x13a5e8[_0xac10('0x3c')]);if(_0x13a5e8[_0xac10('0x3d')]){delete _0x13a5e8[_0xac10('0x3d')];}_0x1ac645['status'](_0x5bcec9)[_0xac10('0x3e')](_0x13a5e8);};}exports[_0xac10('0x3f')]=function(_0x5a5239,_0x5c8070){var _0x446013={},_0x3519da={},_0x37ed26={'count':0x0,'rows':[]};var _0x2a97aa=_[_0xac10('0x40')](db[_0xac10('0x41')][_0xac10('0x42')],function(_0x59182c){return{'name':_0x59182c[_0xac10('0x43')],'type':_0x59182c[_0xac10('0x44')]['key']};});_0x3519da[_0xac10('0x45')]=_[_0xac10('0x40')](_0x2a97aa,_0xac10('0x3d'));_0x3519da[_0xac10('0x46')]=_[_0xac10('0x47')](_0x5a5239[_0xac10('0x46')]);_0x3519da[_0xac10('0x48')]=_[_0xac10('0x49')](_0x3519da[_0xac10('0x45')],_0x3519da[_0xac10('0x46')]);_0x446013[_0xac10('0x4a')]=_['intersection'](_0x3519da['model'],qs[_0xac10('0x4b')](_0x5a5239['query'][_0xac10('0x4b')]));_0x446013[_0xac10('0x4a')]=_0x446013['attributes']['length']?_0x446013[_0xac10('0x4a')]:_0x3519da['model'];if(!_0x5a5239[_0xac10('0x46')][_0xac10('0x4c')](_0xac10('0x4d'))){_0x446013[_0xac10('0x36')]=qs['limit'](_0x5a5239[_0xac10('0x46')][_0xac10('0x36')]);_0x446013[_0xac10('0x33')]=qs[_0xac10('0x33')](_0x5a5239['query']['offset']);}_0x446013[_0xac10('0x4e')]=qs[_0xac10('0x4f')](_0x5a5239[_0xac10('0x46')]['sort']);_0x446013['where']=qs[_0xac10('0x48')](_[_0xac10('0x50')](_0x5a5239[_0xac10('0x46')],_0x3519da[_0xac10('0x48')]),_0x2a97aa);if(_0x5a5239[_0xac10('0x46')][_0xac10('0x51')]){_0x446013[_0xac10('0x52')]=_[_0xac10('0x53')](_0x446013[_0xac10('0x52')],{'$or':_[_0xac10('0x40')](_0x2a97aa,function(_0x1a768e){if(_0x1a768e[_0xac10('0x44')]!=='VIRTUAL'){var _0x452b58={};_0x452b58[_0x1a768e['name']]={'$like':'%'+_0x5a5239[_0xac10('0x46')][_0xac10('0x51')]+'%'};return _0x452b58;}})});}_0x446013=_[_0xac10('0x53')]({},_0x446013,_0x5a5239['options']);var _0x4c638c={'where':_0x446013[_0xac10('0x52')]};return db['ChatMessage']['count'](_0x4c638c)[_0xac10('0x24')](function(_0x4ad4d9){_0x37ed26[_0xac10('0x35')]=_0x4ad4d9;if(_0x5a5239[_0xac10('0x46')][_0xac10('0x54')]){_0x446013[_0xac10('0x55')]=[{'all':!![]}];}return db[_0xac10('0x41')]['findAll'](_0x446013);})[_0xac10('0x24')](function(_0x29e5c5){_0x37ed26[_0xac10('0x56')]=_0x29e5c5;return _0x37ed26;})[_0xac10('0x24')](respondWithFilteredResult(_0x5c8070,_0x446013))['catch'](handleError(_0x5c8070,null));};exports[_0xac10('0x57')]=function(_0x128ce8,_0x5e50ee){var _0x5a3931={'raw':!![],'where':{'id':_0x128ce8[_0xac10('0x58')]['id']}},_0x41018c={};_0x41018c['model']=_[_0xac10('0x47')](db[_0xac10('0x41')]['rawAttributes']);_0x41018c[_0xac10('0x46')]=_[_0xac10('0x47')](_0x128ce8[_0xac10('0x46')]);_0x41018c[_0xac10('0x48')]=_['intersection'](_0x41018c['model'],_0x41018c['query']);_0x5a3931[_0xac10('0x4a')]=_[_0xac10('0x49')](_0x41018c[_0xac10('0x45')],qs[_0xac10('0x4b')](_0x128ce8[_0xac10('0x46')][_0xac10('0x4b')]));_0x5a3931[_0xac10('0x4a')]=_0x5a3931[_0xac10('0x4a')][_0xac10('0x59')]?_0x5a3931['attributes']:_0x41018c[_0xac10('0x45')];if(_0x128ce8[_0xac10('0x46')][_0xac10('0x54')]){_0x5a3931['include']=[{'all':!![]}];}_0x5a3931=_[_0xac10('0x53')]({},_0x5a3931,_0x128ce8[_0xac10('0x5a')]);return db[_0xac10('0x41')]['find'](_0x5a3931)[_0xac10('0x24')](handleEntityNotFound(_0x5e50ee,null))[_0xac10('0x24')](respondWithResult(_0x5e50ee,null))[_0xac10('0x2f')](handleError(_0x5e50ee,null));};exports[_0xac10('0x5b')]=function(_0x4f2b7f,_0x49a93a){return db[_0xac10('0x41')]['create'](_0x4f2b7f['body'],{})[_0xac10('0x24')](respondWithResult(_0x49a93a,0xc9))[_0xac10('0x2f')](handleError(_0x49a93a,null));};exports['update']=function(_0x5d5353,_0x2595ca){if(_0x5d5353[_0xac10('0x5c')]['id']){delete _0x5d5353[_0xac10('0x5c')]['id'];}return db[_0xac10('0x41')][_0xac10('0x5d')]({'where':{'id':_0x5d5353[_0xac10('0x58')]['id']}})['then'](handleEntityNotFound(_0x2595ca,null))[_0xac10('0x24')](saveUpdates(_0x5d5353[_0xac10('0x5c')],null))[_0xac10('0x24')](respondWithResult(_0x2595ca,null))[_0xac10('0x2f')](handleError(_0x2595ca,null));};exports[_0xac10('0x3a')]=function(_0x46afa6,_0x5b3056){return db['ChatMessage'][_0xac10('0x5d')]({'where':{'id':_0x46afa6['params']['id']}})[_0xac10('0x24')](handleEntityNotFound(_0x5b3056,null))[_0xac10('0x24')](removeEntity(_0x5b3056,null))['catch'](handleError(_0x5b3056,null));};exports[_0xac10('0x5e')]=function(_0x3e7dff,_0x5973b1){return db[_0xac10('0x41')][_0xac10('0x5e')]()[_0xac10('0x24')](respondWithResult(_0x5973b1,null))[_0xac10('0x2f')](handleError(_0x5973b1,null));};var interaction_log=require(_0xac10('0x16'))(_0xac10('0x5f'));exports['accept']=function(_0x50500c,_0x5de52f,_0x5992ce){var _0x5492f2={'agent':{},'channel':'chat'};if(_0x50500c[_0xac10('0x5c')]['id']){delete _0x50500c[_0xac10('0x5c')]['id'];}_0x50500c[_0xac10('0x5c')][_0xac10('0x60')]=!![];_0x50500c['body']['readAt']=moment()[_0xac10('0x61')](_0xac10('0x62'));_0x50500c[_0xac10('0x5c')][_0xac10('0x63')]=_0x50500c[_0xac10('0x5c')]['UserId']||_0x50500c[_0xac10('0x64')]['id'];_0x5492f2[_0xac10('0x65')]['id']=_0x50500c[_0xac10('0x5c')][_0xac10('0x63')];return db[_0xac10('0x41')][_0xac10('0x5d')]({'where':{'id':_0x50500c[_0xac10('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5de52f,null))[_0xac10('0x24')](saveUpdates(_0x50500c[_0xac10('0x5c')],null))[_0xac10('0x24')](function(_0xe2be20){if(_0xe2be20){_0x5492f2[_0xac10('0x2d')]=_0xe2be20['get']({'plain':!![]});return db['ChatInteraction'][_0xac10('0x5d')]({'where':{'id':_0xe2be20[_0xac10('0x66')]}});}return null;})[_0xac10('0x24')](handleEntityNotFound(_0x5de52f,null))[_0xac10('0x24')](function(_0x3be0b6){if(_0x3be0b6){return _0x3be0b6[_0xac10('0x67')]({'UserId':_0x50500c[_0xac10('0x5c')][_0xac10('0x63')],'read1stAt':_[_0xac10('0x68')](_0x3be0b6[_0xac10('0x69')])?moment()['format'](_0xac10('0x62')):undefined});}return null;})[_0xac10('0x24')](function(_0x4a8613){if(_0x4a8613){_0x5492f2[_0xac10('0x6a')]=_0x4a8613[_0xac10('0x6b')]({'plain':!![]});interaction_log[_0xac10('0x25')](_0xac10('0x6c'),_0x50500c[_0xac10('0x64')]['id'],_0x50500c[_0xac10('0x64')][_0xac10('0x3d')],_0x50500c['user'][_0xac10('0x6d')],_0x5492f2['interaction']['id'],_0x50500c['body']?JSON[_0xac10('0x2a')](_0x50500c[_0xac10('0x5c')]):_0xac10('0x6e'));return respondWithRpcPromise(_0xac10('0x6f'),_0xac10('0x70'),_0x5492f2);}return null;})[_0xac10('0x24')](function(_0x1275c2){var _0x1b05a9='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1275c2['message'][_0xac10('0x71')];return db[_0xac10('0x72')][_0xac10('0x46')](_0x1b05a9,{'type':db[_0xac10('0x73')][_0xac10('0x74')][_0xac10('0x75')],'raw':!![]})['then'](function(_0x3be08b){return _0x3be08b;});})[_0xac10('0x24')](function(_0x5d610f){if(_0x5d610f){_0x5492f2[_0xac10('0x2d')][_0xac10('0x76')]=_0x5d610f[0x0];if(!_0x50500c[_0xac10('0x5c')]['UserId'])return;return db[_0xac10('0x77')]['find']({'where':{'id':_0x50500c[_0xac10('0x5c')][_0xac10('0x63')],'role':_0xac10('0x65')},'attributes':['id',_0xac10('0x3d'),'fullname',_0xac10('0x78'),_0xac10('0x79')],'raw':!![]});}return null;})['then'](function(_0x4c7f6b){if(!_0x4c7f6b)return null;_0x5492f2['message'][_0xac10('0x65')]=_0x4c7f6b;return _0x5492f2;})[_0xac10('0x24')](function(_0x452270){if(_0x452270){if(_0x50500c[_0xac10('0x5c')][_0xac10('0x7a')]){_0x5492f2[_0xac10('0x2d')][_0xac10('0x7b')]=util[_0xac10('0x61')](_0xac10('0x7c'),_0x50500c[_0xac10('0x64')][_0xac10('0x3d')]);_0x5492f2[_0xac10('0x2d')][_0xac10('0x7d')]=_0x5492f2[_0xac10('0x7d')];_0x5492f2[_0xac10('0x2d')][_0xac10('0x7e')]=_0x5492f2[_0xac10('0x7d')];_0x5492f2[_0xac10('0x2d')]['event']=_0xac10('0x7f');return respondWithRpcPromise(_0xac10('0x80'),'EventManager',{'event':_0xac10('0x81'),'message':_[_0xac10('0x53')](_0x5492f2['message'],JSON[_0xac10('0x82')](_0x5492f2[_0xac10('0x6a')][_0xac10('0x83')]))},client9002)[_0xac10('0x24')](function(){return _0x5492f2;});}return _0x5492f2;}return null;})[_0xac10('0x24')](respondWithResult(_0x5de52f,null))['catch'](handleError(_0x5de52f,null));};var interaction_log=require(_0xac10('0x16'))(_0xac10('0x5f'));exports['reject']=function(_0x56cdd1,_0x5e1889,_0x33f7af){var _0x4a0c8a={'agent':{},'channel':'chat'};if(_0x56cdd1[_0xac10('0x5c')]['id']){delete _0x56cdd1['body']['id'];}_0x56cdd1['body'][_0xac10('0x63')]=_0x56cdd1[_0xac10('0x5c')][_0xac10('0x63')]||_0x56cdd1[_0xac10('0x64')]['id'];_0x4a0c8a[_0xac10('0x65')]['id']=_0x56cdd1['body'][_0xac10('0x63')];return db[_0xac10('0x41')][_0xac10('0x5d')]({'where':{'id':_0x56cdd1[_0xac10('0x58')]['id'],'UserId':null}})[_0xac10('0x24')](handleEntityNotFound(_0x5e1889,null))[_0xac10('0x24')](function(_0x2ef83f){if(_0x2ef83f){_0x4a0c8a[_0xac10('0x2d')]=_0x2ef83f['get']({'plain':!![]});return db['ChatInteraction'][_0xac10('0x5d')]({'where':{'id':_0x2ef83f[_0xac10('0x66')]}});}return null;})[_0xac10('0x24')](handleEntityNotFound(_0x5e1889,null))[_0xac10('0x24')](function(_0x52153f){if(_0x52153f){_0x4a0c8a['interaction']=_0x52153f[_0xac10('0x6b')]({'plain':!![]});interaction_log[_0xac10('0x25')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x56cdd1[_0xac10('0x64')]['id'],_0x56cdd1[_0xac10('0x64')]['name'],_0x56cdd1[_0xac10('0x64')]['role'],_0x4a0c8a[_0xac10('0x6a')]['id'],_0x56cdd1[_0xac10('0x5c')]?JSON[_0xac10('0x2a')](_0x56cdd1[_0xac10('0x5c')]):_0xac10('0x6e'));return respondWithRpcPromise('RejectMessage',_0xac10('0x84'),_0x4a0c8a);}return null;})[_0xac10('0x24')](function(_0x1a39e7){var _0x12ae23=_0xac10('0x85')+_0x1a39e7['message'][_0xac10('0x71')];return db[_0xac10('0x72')][_0xac10('0x46')](_0x12ae23,{'type':db[_0xac10('0x73')][_0xac10('0x74')]['SELECT'],'raw':!![]})['then'](function(_0x89c07f){return _0x89c07f;});})['then'](function(_0x3100aa){if(_0x3100aa){_0x4a0c8a['message'][_0xac10('0x76')]=_0x3100aa[0x0];if(!_0x56cdd1['body'][_0xac10('0x63')])return;return db[_0xac10('0x77')]['find']({'where':{'id':_0x56cdd1[_0xac10('0x5c')][_0xac10('0x63')],'role':_0xac10('0x65')},'attributes':['id','name',_0xac10('0x86'),'email',_0xac10('0x79')],'raw':!![]});}return null;})[_0xac10('0x24')](function(_0xd70c6d){if(!_0xd70c6d)return null;_0x4a0c8a['message']['agent']=_0xd70c6d;return _0x4a0c8a;})['then'](function(_0x4adfa0){if(_0x4adfa0){_0x4adfa0[_0xac10('0x2d')][_0xac10('0x7b')]=util[_0xac10('0x61')](_0xac10('0x7c'),_0x56cdd1[_0xac10('0x64')][_0xac10('0x3d')]);_0x4adfa0['message'][_0xac10('0x7d')]=_0x4a0c8a[_0xac10('0x7d')];_0x4adfa0['message'][_0xac10('0x7e')]=_0x4a0c8a[_0xac10('0x7d')];_0x4adfa0[_0xac10('0x2d')][_0xac10('0x87')]='reject';respondWithRpcPromise(_0xac10('0x80'),_0xac10('0x80'),{'event':_0xac10('0x88'),'message':_[_0xac10('0x53')](_0x4a0c8a[_0xac10('0x2d')],JSON[_0xac10('0x82')](_0x4a0c8a[_0xac10('0x6a')]['formData']))},client9002);return _0x4a0c8a;}return null;})[_0xac10('0x24')](respondWithResult(_0x5e1889,null))['catch'](handleError(_0x5e1889,null));}; \ No newline at end of file +var _0xc098=['reject','save','update','destroy','end','stack','name','index','ChatMessage','fieldName','type','key','model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','rawAttributes','intersection','length','merge','find','create','body','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','agent','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','interaction','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','RejectMessage','SELECT','rejectmessage','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply'];(function(_0x4c0f34,_0x1e1992){var _0x1afcac=function(_0x4920cd){while(--_0x4920cd){_0x4c0f34['push'](_0x4c0f34['shift']());}};_0x1afcac(++_0x1e1992);}(_0xc098,0x1ef));var _0x8c09=function(_0x32993a,_0x20df64){_0x32993a=_0x32993a-0x0;var _0x3e9712=_0xc098[_0x32993a];return _0x3e9712;};'use strict';var emlformat=require(_0x8c09('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8c09('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8c09('0x2'));var moment=require('moment');var BPromise=require(_0x8c09('0x3'));var Mustache=require(_0x8c09('0x4'));var util=require(_0x8c09('0x5'));var path=require(_0x8c09('0x6'));var sox=require('sox');var csv=require(_0x8c09('0x7'));var ejs=require(_0x8c09('0x8'));var fs=require('fs');var fs_extra=require(_0x8c09('0x9'));var _=require(_0x8c09('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8c09('0xb'));var deskjs=require(_0x8c09('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8c09('0xd'));var Redis=require('ioredis');var authService=require(_0x8c09('0xe'));var qs=require(_0x8c09('0xf'));var as=require(_0x8c09('0x10'));var hardwareService=require(_0x8c09('0x11'));var logger=require(_0x8c09('0x12'))(_0x8c09('0x13'));var utils=require(_0x8c09('0x14'));var config=require(_0x8c09('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8c09('0x16'))['db'];config[_0x8c09('0x17')]=_[_0x8c09('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8c09('0x19'))(new Redis(config[_0x8c09('0x17')]));require(_0x8c09('0x1a'))[_0x8c09('0x1b')](socket);var jayson=require(_0x8c09('0x1c'));var client=jayson[_0x8c09('0x1d')][_0x8c09('0x1e')]({'port':0x232c});var client9002=jayson[_0x8c09('0x1d')][_0x8c09('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x25efd3,_0x5ec49b,_0x4521c7,_0x521778){return new BPromise(function(_0x2ae7a0,_0x2ccebe){var _0x1a01a3=_0x521778||client;return _0x1a01a3[_0x8c09('0x1f')](_0x25efd3,_0x4521c7)[_0x8c09('0x20')](function(_0x46f4cd){logger[_0x8c09('0x21')]('ChatMessage,\x20%s,\x20%s',_0x5ec49b,_0x8c09('0x22'));logger[_0x8c09('0x23')](_0x8c09('0x24'),_0x5ec49b,_0x8c09('0x22'),JSON['stringify'](_0x46f4cd));if(_0x46f4cd[_0x8c09('0x25')]){if(_0x46f4cd[_0x8c09('0x25')][_0x8c09('0x26')]===0x1f4){logger[_0x8c09('0x25')](_0x8c09('0x27'),_0x5ec49b,_0x46f4cd['error'][_0x8c09('0x28')]);return _0x2ccebe(_0x46f4cd[_0x8c09('0x25')][_0x8c09('0x28')]);}logger[_0x8c09('0x25')](_0x8c09('0x27'),_0x5ec49b,_0x46f4cd[_0x8c09('0x25')][_0x8c09('0x28')]);return _0x2ae7a0(_0x46f4cd[_0x8c09('0x25')]['message']);}else{logger[_0x8c09('0x21')](_0x8c09('0x27'),_0x5ec49b,'request\x20sent');_0x2ae7a0(_0x46f4cd[_0x8c09('0x29')][_0x8c09('0x28')]);}})[_0x8c09('0x2a')](function(_0x22c395){logger['error'](_0x8c09('0x27'),_0x5ec49b,_0x22c395);_0x2ccebe(_0x22c395);});});}function respondWithStatusCode(_0x15c0a4,_0xc51f2c){_0xc51f2c=_0xc51f2c||0xcc;return function(_0x40b065){if(_0x40b065){return _0x15c0a4[_0x8c09('0x2b')](_0xc51f2c);}return _0x15c0a4[_0x8c09('0x2c')](_0xc51f2c)['end']();};}function respondWithResult(_0x3c3377,_0x356a79){_0x356a79=_0x356a79||0xc8;return function(_0xe84def){if(_0xe84def){return _0x3c3377[_0x8c09('0x2c')](_0x356a79)[_0x8c09('0x2d')](_0xe84def);}};}function respondWithFilteredResult(_0x247568,_0x273d04){return function(_0x44b71d){if(_0x44b71d){var _0x5a6b8a=typeof _0x273d04['offset']==='undefined'&&typeof _0x273d04['limit']===_0x8c09('0x2e');var _0x431cc5=_0x44b71d[_0x8c09('0x2f')];var _0x2340f6=_0x5a6b8a?0x0:_0x273d04['offset'];var _0x346717=_0x5a6b8a?_0x44b71d[_0x8c09('0x2f')]:_0x273d04[_0x8c09('0x30')]+_0x273d04[_0x8c09('0x31')];var _0x26d33c;if(_0x346717>=_0x431cc5){_0x346717=_0x431cc5;_0x26d33c=0xc8;}else{_0x26d33c=0xce;}_0x247568['status'](_0x26d33c);return _0x247568[_0x8c09('0x32')](_0x8c09('0x33'),_0x2340f6+'-'+_0x346717+'/'+_0x431cc5)[_0x8c09('0x2d')](_0x44b71d);}return null;};}function patchUpdates(_0x2917d1){return function(_0x53b79a){try{jsonpatch[_0x8c09('0x34')](_0x53b79a,_0x2917d1,!![]);}catch(_0x14d220){return BPromise[_0x8c09('0x35')](_0x14d220);}return _0x53b79a[_0x8c09('0x36')]();};}function saveUpdates(_0xa34176,_0x5f0bbb){return function(_0x45c697){if(_0x45c697){return _0x45c697[_0x8c09('0x37')](_0xa34176)[_0x8c09('0x20')](function(_0x2fd7c3){return _0x2fd7c3;});}return null;};}function removeEntity(_0x56b797,_0x345980){return function(_0x892009){if(_0x892009){return _0x892009[_0x8c09('0x38')]()[_0x8c09('0x20')](function(){_0x56b797['status'](0xcc)[_0x8c09('0x39')]();});}};}function handleEntityNotFound(_0x56dbe2,_0x13486e){return function(_0x3f0940){if(!_0x3f0940){_0x56dbe2[_0x8c09('0x2b')](0x194);}return _0x3f0940;};}function handleError(_0x3bd5ef,_0xcd810b){_0xcd810b=_0xcd810b||0x1f4;return function(_0x478a66){logger[_0x8c09('0x25')](_0x478a66[_0x8c09('0x3a')]);if(_0x478a66[_0x8c09('0x3b')]){delete _0x478a66['name'];}_0x3bd5ef['status'](_0xcd810b)['send'](_0x478a66);};}exports[_0x8c09('0x3c')]=function(_0xc57369,_0x288b35){var _0x3d7b9a={},_0x1fcc24={},_0x1bd32b={'count':0x0,'rows':[]};var _0x1e713a=_['map'](db[_0x8c09('0x3d')]['rawAttributes'],function(_0x32d193){return{'name':_0x32d193[_0x8c09('0x3e')],'type':_0x32d193[_0x8c09('0x3f')][_0x8c09('0x40')]};});_0x1fcc24[_0x8c09('0x41')]=_[_0x8c09('0x42')](_0x1e713a,'name');_0x1fcc24[_0x8c09('0x43')]=_[_0x8c09('0x44')](_0xc57369[_0x8c09('0x43')]);_0x1fcc24[_0x8c09('0x45')]=_['intersection'](_0x1fcc24[_0x8c09('0x41')],_0x1fcc24[_0x8c09('0x43')]);_0x3d7b9a[_0x8c09('0x46')]=_['intersection'](_0x1fcc24[_0x8c09('0x41')],qs[_0x8c09('0x47')](_0xc57369['query']['fields']));_0x3d7b9a[_0x8c09('0x46')]=_0x3d7b9a[_0x8c09('0x46')]['length']?_0x3d7b9a['attributes']:_0x1fcc24['model'];if(!_0xc57369[_0x8c09('0x43')][_0x8c09('0x48')](_0x8c09('0x49'))){_0x3d7b9a[_0x8c09('0x31')]=qs['limit'](_0xc57369['query']['limit']);_0x3d7b9a[_0x8c09('0x30')]=qs[_0x8c09('0x30')](_0xc57369[_0x8c09('0x43')][_0x8c09('0x30')]);}_0x3d7b9a[_0x8c09('0x4a')]=qs[_0x8c09('0x4b')](_0xc57369[_0x8c09('0x43')]['sort']);_0x3d7b9a[_0x8c09('0x4c')]=qs['filters'](_[_0x8c09('0x4d')](_0xc57369[_0x8c09('0x43')],_0x1fcc24[_0x8c09('0x45')]),_0x1e713a);if(_0xc57369['query']['filter']){_0x3d7b9a['where']=_['merge'](_0x3d7b9a['where'],{'$or':_[_0x8c09('0x42')](_0x1e713a,function(_0x40ebb1){if(_0x40ebb1['type']!==_0x8c09('0x4e')){var _0x216a80={};_0x216a80[_0x40ebb1[_0x8c09('0x3b')]]={'$like':'%'+_0xc57369[_0x8c09('0x43')][_0x8c09('0x4f')]+'%'};return _0x216a80;}})});}_0x3d7b9a=_['merge']({},_0x3d7b9a,_0xc57369[_0x8c09('0x50')]);var _0x21b7bc={'where':_0x3d7b9a[_0x8c09('0x4c')]};return db['ChatMessage'][_0x8c09('0x2f')](_0x21b7bc)[_0x8c09('0x20')](function(_0x40062f){_0x1bd32b[_0x8c09('0x2f')]=_0x40062f;if(_0xc57369['query'][_0x8c09('0x51')]){_0x3d7b9a['include']=[{'all':!![]}];}return db[_0x8c09('0x3d')][_0x8c09('0x52')](_0x3d7b9a);})[_0x8c09('0x20')](function(_0x2e219c){_0x1bd32b[_0x8c09('0x53')]=_0x2e219c;return _0x1bd32b;})[_0x8c09('0x20')](respondWithFilteredResult(_0x288b35,_0x3d7b9a))[_0x8c09('0x2a')](handleError(_0x288b35,null));};exports[_0x8c09('0x54')]=function(_0x5b0059,_0x57f49a){var _0x1c1fee={'raw':!![],'where':{'id':_0x5b0059[_0x8c09('0x55')]['id']}},_0x4e8ce5={};_0x4e8ce5['model']=_[_0x8c09('0x44')](db['ChatMessage'][_0x8c09('0x56')]);_0x4e8ce5['query']=_[_0x8c09('0x44')](_0x5b0059['query']);_0x4e8ce5[_0x8c09('0x45')]=_[_0x8c09('0x57')](_0x4e8ce5['model'],_0x4e8ce5[_0x8c09('0x43')]);_0x1c1fee[_0x8c09('0x46')]=_[_0x8c09('0x57')](_0x4e8ce5['model'],qs[_0x8c09('0x47')](_0x5b0059[_0x8c09('0x43')]['fields']));_0x1c1fee['attributes']=_0x1c1fee[_0x8c09('0x46')][_0x8c09('0x58')]?_0x1c1fee[_0x8c09('0x46')]:_0x4e8ce5[_0x8c09('0x41')];if(_0x5b0059[_0x8c09('0x43')][_0x8c09('0x51')]){_0x1c1fee['include']=[{'all':!![]}];}_0x1c1fee=_[_0x8c09('0x59')]({},_0x1c1fee,_0x5b0059[_0x8c09('0x50')]);return db[_0x8c09('0x3d')][_0x8c09('0x5a')](_0x1c1fee)[_0x8c09('0x20')](handleEntityNotFound(_0x57f49a,null))[_0x8c09('0x20')](respondWithResult(_0x57f49a,null))['catch'](handleError(_0x57f49a,null));};exports[_0x8c09('0x5b')]=function(_0x14b32b,_0x3c6c81){return db[_0x8c09('0x3d')][_0x8c09('0x5b')](_0x14b32b[_0x8c09('0x5c')],{})[_0x8c09('0x20')](respondWithResult(_0x3c6c81,0xc9))[_0x8c09('0x2a')](handleError(_0x3c6c81,null));};exports[_0x8c09('0x37')]=function(_0xa521ad,_0x1178c3){if(_0xa521ad[_0x8c09('0x5c')]['id']){delete _0xa521ad[_0x8c09('0x5c')]['id'];}return db[_0x8c09('0x3d')]['find']({'where':{'id':_0xa521ad[_0x8c09('0x55')]['id']}})['then'](handleEntityNotFound(_0x1178c3,null))[_0x8c09('0x20')](saveUpdates(_0xa521ad[_0x8c09('0x5c')],null))[_0x8c09('0x20')](respondWithResult(_0x1178c3,null))[_0x8c09('0x2a')](handleError(_0x1178c3,null));};exports['destroy']=function(_0x4fd717,_0x2a4c04){return db[_0x8c09('0x3d')][_0x8c09('0x5a')]({'where':{'id':_0x4fd717[_0x8c09('0x55')]['id']}})[_0x8c09('0x20')](handleEntityNotFound(_0x2a4c04,null))[_0x8c09('0x20')](removeEntity(_0x2a4c04,null))[_0x8c09('0x2a')](handleError(_0x2a4c04,null));};exports[_0x8c09('0x5d')]=function(_0x4b3063,_0x20e279){return db[_0x8c09('0x3d')][_0x8c09('0x5d')]()[_0x8c09('0x20')](respondWithResult(_0x20e279,null))[_0x8c09('0x2a')](handleError(_0x20e279,null));};var interaction_log=require(_0x8c09('0x12'))(_0x8c09('0x5e'));exports[_0x8c09('0x5f')]=function(_0x2c7a36,_0x1f3d94,_0x1ee55b){var _0x8d70ab={'agent':{},'channel':_0x8c09('0x60')};if(_0x2c7a36[_0x8c09('0x5c')]['id']){delete _0x2c7a36[_0x8c09('0x5c')]['id'];}_0x2c7a36['body'][_0x8c09('0x61')]=!![];_0x2c7a36[_0x8c09('0x5c')][_0x8c09('0x62')]=moment()[_0x8c09('0x63')](_0x8c09('0x64'));_0x2c7a36['body'][_0x8c09('0x65')]=_0x2c7a36[_0x8c09('0x5c')][_0x8c09('0x65')]||_0x2c7a36[_0x8c09('0x66')]['id'];_0x8d70ab['agent']['id']=_0x2c7a36[_0x8c09('0x5c')][_0x8c09('0x65')];return db[_0x8c09('0x3d')][_0x8c09('0x5a')]({'where':{'id':_0x2c7a36[_0x8c09('0x55')]['id'],'UserId':null}})[_0x8c09('0x20')](handleEntityNotFound(_0x1f3d94,null))['then'](saveUpdates(_0x2c7a36['body'],null))[_0x8c09('0x20')](function(_0x13c66d){if(_0x13c66d){_0x8d70ab[_0x8c09('0x28')]=_0x13c66d[_0x8c09('0x67')]({'plain':!![]});return db[_0x8c09('0x68')][_0x8c09('0x5a')]({'where':{'id':_0x13c66d[_0x8c09('0x69')]}});}return null;})[_0x8c09('0x20')](handleEntityNotFound(_0x1f3d94,null))['then'](function(_0x493621){if(_0x493621){return _0x493621[_0x8c09('0x37')]({'UserId':_0x2c7a36[_0x8c09('0x5c')]['UserId'],'read1stAt':_[_0x8c09('0x6a')](_0x493621[_0x8c09('0x6b')])?moment()[_0x8c09('0x63')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x8c09('0x20')](function(_0x34e841){if(_0x34e841){_0x8d70ab['interaction']=_0x34e841[_0x8c09('0x67')]({'plain':!![]});interaction_log[_0x8c09('0x21')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2c7a36['user']['id'],_0x2c7a36[_0x8c09('0x66')]['name'],_0x2c7a36['user']['role'],_0x8d70ab['interaction']['id'],_0x2c7a36[_0x8c09('0x5c')]?JSON['stringify'](_0x2c7a36[_0x8c09('0x5c')]):_0x8c09('0x6c'));return respondWithRpcPromise(_0x8c09('0x6d'),'acceptMessage',_0x8d70ab);}return null;})['then'](function(_0x11ed29){var _0x3fc15b=_0x8c09('0x6e')+_0x11ed29[_0x8c09('0x28')][_0x8c09('0x6f')];return db[_0x8c09('0x70')][_0x8c09('0x43')](_0x3fc15b,{'type':db[_0x8c09('0x71')][_0x8c09('0x72')]['SELECT'],'raw':!![]})[_0x8c09('0x20')](function(_0x29d460){return _0x29d460;});})[_0x8c09('0x20')](function(_0x14999c){if(_0x14999c){_0x8d70ab[_0x8c09('0x28')][_0x8c09('0x73')]=_0x14999c[0x0];if(!_0x2c7a36[_0x8c09('0x5c')]['UserId'])return;return db[_0x8c09('0x74')][_0x8c09('0x5a')]({'where':{'id':_0x2c7a36[_0x8c09('0x5c')][_0x8c09('0x65')],'role':_0x8c09('0x75')},'attributes':['id',_0x8c09('0x3b'),_0x8c09('0x76'),_0x8c09('0x77'),_0x8c09('0x78')],'raw':!![]});}return null;})['then'](function(_0x18676a){if(!_0x18676a)return null;_0x8d70ab[_0x8c09('0x28')][_0x8c09('0x75')]=_0x18676a;return _0x8d70ab;})[_0x8c09('0x20')](function(_0x48c021){if(_0x48c021){if(_0x2c7a36[_0x8c09('0x5c')]['manual']){_0x8d70ab[_0x8c09('0x28')][_0x8c09('0x79')]=util['format'](_0x8c09('0x7a'),_0x2c7a36[_0x8c09('0x66')][_0x8c09('0x3b')]);_0x8d70ab[_0x8c09('0x28')][_0x8c09('0x7b')]=_0x8d70ab[_0x8c09('0x7b')];_0x8d70ab[_0x8c09('0x28')][_0x8c09('0x7c')]=_0x8d70ab[_0x8c09('0x7b')];_0x8d70ab[_0x8c09('0x28')][_0x8c09('0x7d')]=_0x8c09('0x5f');return respondWithRpcPromise(_0x8c09('0x7e'),'EventManager',{'event':_0x8c09('0x7f'),'message':_['merge'](_0x8d70ab['message'],JSON[_0x8c09('0x80')](_0x8d70ab[_0x8c09('0x81')][_0x8c09('0x82')]))},client9002)[_0x8c09('0x20')](function(){return _0x8d70ab;});}return _0x8d70ab;}return null;})[_0x8c09('0x20')](respondWithResult(_0x1f3d94,null))['catch'](handleError(_0x1f3d94,null));};var interaction_log=require(_0x8c09('0x12'))(_0x8c09('0x5e'));exports['reject']=function(_0x459748,_0x1def45,_0x33d356){var _0x5d2e90={'agent':{},'channel':_0x8c09('0x60')};if(_0x459748[_0x8c09('0x5c')]['id']){delete _0x459748[_0x8c09('0x5c')]['id'];}_0x459748[_0x8c09('0x5c')][_0x8c09('0x65')]=_0x459748[_0x8c09('0x5c')]['UserId']||_0x459748['user']['id'];_0x5d2e90[_0x8c09('0x75')]['id']=_0x459748[_0x8c09('0x5c')]['UserId'];return db[_0x8c09('0x3d')][_0x8c09('0x5a')]({'where':{'id':_0x459748[_0x8c09('0x55')]['id'],'UserId':null}})[_0x8c09('0x20')](handleEntityNotFound(_0x1def45,null))[_0x8c09('0x20')](function(_0x18bc7b){if(_0x18bc7b){_0x5d2e90['message']=_0x18bc7b[_0x8c09('0x67')]({'plain':!![]});return db[_0x8c09('0x68')][_0x8c09('0x5a')]({'where':{'id':_0x18bc7b[_0x8c09('0x69')]}});}return null;})[_0x8c09('0x20')](handleEntityNotFound(_0x1def45,null))[_0x8c09('0x20')](function(_0x2055c1){if(_0x2055c1){_0x5d2e90['interaction']=_0x2055c1[_0x8c09('0x67')]({'plain':!![]});interaction_log[_0x8c09('0x21')](_0x8c09('0x83'),_0x459748['user']['id'],_0x459748[_0x8c09('0x66')][_0x8c09('0x3b')],_0x459748[_0x8c09('0x66')][_0x8c09('0x84')],_0x5d2e90[_0x8c09('0x81')]['id'],_0x459748[_0x8c09('0x5c')]?JSON[_0x8c09('0x85')](_0x459748[_0x8c09('0x5c')]):_0x8c09('0x6c'));return respondWithRpcPromise(_0x8c09('0x86'),'rejectMessage',_0x5d2e90);}return null;})[_0x8c09('0x20')](function(_0x58d7d4){var _0x3088b4=_0x8c09('0x6e')+_0x58d7d4['message'][_0x8c09('0x6f')];return db[_0x8c09('0x70')][_0x8c09('0x43')](_0x3088b4,{'type':db[_0x8c09('0x71')][_0x8c09('0x72')][_0x8c09('0x87')],'raw':!![]})[_0x8c09('0x20')](function(_0x5e2c29){return _0x5e2c29;});})[_0x8c09('0x20')](function(_0x3ca935){if(_0x3ca935){_0x5d2e90[_0x8c09('0x28')][_0x8c09('0x73')]=_0x3ca935[0x0];if(!_0x459748['body'][_0x8c09('0x65')])return;return db['User'][_0x8c09('0x5a')]({'where':{'id':_0x459748[_0x8c09('0x5c')]['UserId'],'role':_0x8c09('0x75')},'attributes':['id',_0x8c09('0x3b'),'fullname',_0x8c09('0x77'),'internal'],'raw':!![]});}return null;})[_0x8c09('0x20')](function(_0x5c1ace){if(!_0x5c1ace)return null;_0x5d2e90[_0x8c09('0x28')]['agent']=_0x5c1ace;return _0x5d2e90;})[_0x8c09('0x20')](function(_0x13f30a){if(_0x13f30a){_0x13f30a[_0x8c09('0x28')][_0x8c09('0x79')]=util[_0x8c09('0x63')]('SIP/%s',_0x459748[_0x8c09('0x66')][_0x8c09('0x3b')]);_0x13f30a['message'][_0x8c09('0x7b')]=_0x5d2e90[_0x8c09('0x7b')];_0x13f30a['message'][_0x8c09('0x7c')]=_0x5d2e90[_0x8c09('0x7b')];_0x13f30a[_0x8c09('0x28')][_0x8c09('0x7d')]=_0x8c09('0x35');respondWithRpcPromise(_0x8c09('0x7e'),_0x8c09('0x7e'),{'event':_0x8c09('0x88'),'message':_[_0x8c09('0x59')](_0x5d2e90[_0x8c09('0x28')],JSON[_0x8c09('0x80')](_0x5d2e90['interaction'][_0x8c09('0x82')]))},client9002);return _0x5d2e90;}return null;})[_0x8c09('0x20')](respondWithResult(_0x1def45,null))['catch'](handleError(_0x1def45,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 76d76bb..53dc914 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 _0x04b3=['hook','exports','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x4e8aff,_0x32f049){var _0x2b0ca7=function(_0x42e292){while(--_0x42e292){_0x4e8aff['push'](_0x4e8aff['shift']());}};_0x2b0ca7(++_0x32f049);}(_0x04b3,0x142));var _0x304b=function(_0x4309b7,_0x3c5156){_0x4309b7=_0x4309b7-0x0;var _0x40859b=_0x04b3[_0x4309b7];return _0x40859b;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x304b('0x0'))['db'][_0x304b('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x304b('0x2')](0x0);var events={'afterCreate':_0x304b('0x3'),'afterUpdate':_0x304b('0x4'),'afterDestroy':_0x304b('0x5')};function emitEvent(_0x592d06){return function(_0xff68db,_0x5ce770,_0x414a8c){ChatMessageEvents[_0x304b('0x6')](_0x592d06+':'+_0xff68db['id'],_0xff68db);ChatMessageEvents[_0x304b('0x6')](_0x592d06,_0xff68db);_0x414a8c(null);};}for(var e in events){if(events[_0x304b('0x7')](e)){var event=events[e];ChatMessage[_0x304b('0x8')](e,emitEvent(event));}}module[_0x304b('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0xd900=['../../mysqldb','ChatMessage','save','update','emit','hasOwnProperty','hook'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xd900,0x13b));var _0x0d90=function(_0x5e7e92,_0xdb0f1){_0x5e7e92=_0x5e7e92-0x0;var _0x412746=_0xd900[_0x5e7e92];return _0x412746;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x0d90('0x0'))['db'][_0x0d90('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0d90('0x2'),'afterUpdate':_0x0d90('0x3'),'afterDestroy':'remove'};function emitEvent(_0x525da3){return function(_0x287398,_0x31919b,_0x3ee725){ChatMessageEvents[_0x0d90('0x4')](_0x525da3+':'+_0x287398['id'],_0x287398);ChatMessageEvents[_0x0d90('0x4')](_0x525da3,_0x287398);_0x3ee725(null);};}for(var e in events){if(events[_0x0d90('0x5')](e)){var event=events[e];ChatMessage[_0x0d90('0x6')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 0d1aa7f..b15fbf2 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 _0x0504=['ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','ChatInteraction','ChatInteractionId','then','update','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x0504,0x147));var _0x4050=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x0504[_0x279d37];return _0x530173;};'use strict';var _=require('lodash');var util=require(_0x4050('0x0'));var logger=require(_0x4050('0x1'))(_0x4050('0x2'));var moment=require(_0x4050('0x3'));var BPromise=require(_0x4050('0x4'));var rp=require(_0x4050('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4050('0x6'));var config=require(_0x4050('0x7'));var attributes=require('./chatMessage.attributes');module[_0x4050('0x8')]=function(_0x26da81,_0x2fd317){return _0x26da81['define'](_0x4050('0x9'),attributes,{'tableName':_0x4050('0xa'),'paranoid':![],'indexes':[{'name':_0x4050('0xb'),'fields':[_0x4050('0xc')],'type':_0x4050('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x51a7ba,_0x1a9b86,_0x78777){var _0x1f5f78=_0x26da81[_0x4050('0xe')];var _0x1bcf7e=_0x51a7ba[_0x4050('0xf')]({'plain':!![]});if(_0x1bcf7e['direction']['toLowerCase']()==='in'||_0x1bcf7e[_0x4050('0x10')][_0x4050('0x11')]()===_0x4050('0x12')&&!_0x1bcf7e[_0x4050('0x13')]&&!_[_0x4050('0x14')](_0x1bcf7e['UserId'])){_0x1f5f78[_0x4050('0x15')]['findOne']({'where':{'id':_0x1bcf7e[_0x4050('0x16')]}})[_0x4050('0x17')](function(_0x374a23){if(_0x374a23){_0x374a23[_0x4050('0x18')]({'lastMsgAt':_0x1bcf7e['createdAt'],'lastMsgDirection':_0x1bcf7e[_0x4050('0x10')][_0x4050('0x11')]()});}})[_0x4050('0x19')](function(_0x1c689b){console['error'](_0x1c689b);});}_0x78777();}},'charset':_0x4050('0x1a'),'collate':_0x4050('0x1b')});}; \ No newline at end of file +var _0x950a=['error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./chatMessage.attributes','exports','define','fti_chat_messages','body','FULLTEXT','get','toLowerCase','direction','secret','UserId','ChatInteraction','findOne','then','update','catch'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x950a,0x111));var _0xa950=function(_0x9e2e28,_0x34a5c4){_0x9e2e28=_0x9e2e28-0x0;var _0xc96456=_0x950a[_0x9e2e28];return _0xc96456;};'use strict';var _=require(_0xa950('0x0'));var util=require(_0xa950('0x1'));var logger=require(_0xa950('0x2'))(_0xa950('0x3'));var moment=require('moment');var BPromise=require(_0xa950('0x4'));var rp=require(_0xa950('0x5'));var fs=require('fs');var path=require(_0xa950('0x6'));var rimraf=require(_0xa950('0x7'));var config=require('../../config/environment');var attributes=require(_0xa950('0x8'));module[_0xa950('0x9')]=function(_0x512c0e,_0x14b4ac){return _0x512c0e[_0xa950('0xa')]('ChatMessage',attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0xa950('0xb'),'fields':[_0xa950('0xc')],'type':_0xa950('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2c77da,_0x274d9a,_0x1b4ec6){var _0x4e4700=_0x512c0e['models'];var _0x546c08=_0x2c77da[_0xa950('0xe')]({'plain':!![]});if(_0x546c08['direction'][_0xa950('0xf')]()==='in'||_0x546c08[_0xa950('0x10')][_0xa950('0xf')]()==='out'&&!_0x546c08[_0xa950('0x11')]&&!_['isNil'](_0x546c08[_0xa950('0x12')])){_0x4e4700[_0xa950('0x13')][_0xa950('0x14')]({'where':{'id':_0x546c08['ChatInteractionId']}})[_0xa950('0x15')](function(_0x2aed6a){if(_0x2aed6a){_0x2aed6a[_0xa950('0x16')]({'lastMsgAt':_0x546c08['createdAt'],'lastMsgDirection':_0x546c08[_0xa950('0x10')][_0xa950('0xf')]()});}})[_0xa950('0x17')](function(_0x5d5f4c){console[_0xa950('0x18')](_0x5d5f4c);});}_0x1b4ec6();}},'charset':_0xa950('0x19'),'collate':_0xa950('0x1a')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index d7d00f6..3d0fcd4 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 _0xe22e=['bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatMessage.socket','register','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateChatMessage','ChatMessage','body','options','raw','then','catch','lodash','util','moment'];(function(_0x4182d8,_0x53e67a){var _0x479f59=function(_0x1890ed){while(--_0x1890ed){_0x4182d8['push'](_0x4182d8['shift']());}};_0x479f59(++_0x53e67a);}(_0xe22e,0x12f));var _0xee22=function(_0x71d4f3,_0x4662e1){_0x71d4f3=_0x71d4f3-0x0;var _0x330245=_0xe22e[_0x71d4f3];return _0x330245;};'use strict';var _=require(_0xee22('0x0'));var util=require(_0xee22('0x1'));var moment=require(_0xee22('0x2'));var BPromise=require(_0xee22('0x3'));var rs=require(_0xee22('0x4'));var fs=require('fs');var Redis=require(_0xee22('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xee22('0x6'));var logger=require('../../config/logger')(_0xee22('0x7'));var config=require(_0xee22('0x8'));var jayson=require(_0xee22('0x9'));var client=jayson[_0xee22('0xa')][_0xee22('0xb')]({'port':0x232a});config[_0xee22('0xc')]=_[_0xee22('0xd')](config[_0xee22('0xc')],{'host':_0xee22('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xee22('0xc')]));require(_0xee22('0xf'))[_0xee22('0x10')](socket);function respondWithRpcPromise(_0x471766,_0x2234f7,_0x57030b){return new BPromise(function(_0x72604e,_0x27d022){return client['request'](_0x471766,_0x57030b)['then'](function(_0x4da248){logger[_0xee22('0x11')](_0xee22('0x12'),_0x2234f7,_0xee22('0x13'));logger[_0xee22('0x14')](_0xee22('0x15'),_0x2234f7,_0xee22('0x13'),JSON[_0xee22('0x16')](_0x4da248));if(_0x4da248[_0xee22('0x17')]){if(_0x4da248[_0xee22('0x17')][_0xee22('0x18')]===0x1f4){logger[_0xee22('0x17')](_0xee22('0x12'),_0x2234f7,_0x4da248[_0xee22('0x17')][_0xee22('0x19')]);return _0x27d022(_0x4da248[_0xee22('0x17')]['message']);}logger[_0xee22('0x17')](_0xee22('0x12'),_0x2234f7,_0x4da248[_0xee22('0x17')]['message']);return _0x72604e(_0x4da248[_0xee22('0x17')][_0xee22('0x19')]);}else{logger[_0xee22('0x11')]('ChatMessage,\x20%s,\x20%s',_0x2234f7,_0xee22('0x13'));_0x72604e(_0x4da248[_0xee22('0x1a')][_0xee22('0x19')]);}})['catch'](function(_0xc23d29){logger['error'](_0xee22('0x12'),_0x2234f7,_0xc23d29);_0x27d022(_0xc23d29);});});}exports[_0xee22('0x1b')]=function(_0xd08f5c){var _0x4b67b4=this;return new Promise(function(_0x2405fc,_0x269e69){return db[_0xee22('0x1c')]['create'](_0xd08f5c[_0xee22('0x1d')],{'raw':_0xd08f5c[_0xee22('0x1e')]?_0xd08f5c[_0xee22('0x1e')][_0xee22('0x1f')]===undefined?!![]:![]:!![]})[_0xee22('0x20')](function(_0x3882fe){logger[_0xee22('0x11')](_0xee22('0x1b'),_0xd08f5c);logger[_0xee22('0x14')](_0xee22('0x1b'),_0xd08f5c,JSON[_0xee22('0x16')](_0x3882fe));_0x2405fc(_0x3882fe);})[_0xee22('0x21')](function(_0x45c062){logger[_0xee22('0x17')](_0xee22('0x1b'),_0x45c062[_0xee22('0x19')],_0xd08f5c);_0x269e69(_0x4b67b4[_0xee22('0x17')](0x1f4,_0x45c062['message']));});});}; \ No newline at end of file +var _0x936e=['info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatMessage','create','body','options','raw','CreateChatMessage','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','then'];(function(_0x1d0fe3,_0x18a4f0){var _0x222151=function(_0x23ad78){while(--_0x23ad78){_0x1d0fe3['push'](_0x1d0fe3['shift']());}};_0x222151(++_0x18a4f0);}(_0x936e,0x95));var _0xe936=function(_0x30c646,_0x1056ce){_0x30c646=_0x30c646-0x0;var _0x19b17a=_0x936e[_0x30c646];return _0x19b17a;};'use strict';var _=require(_0xe936('0x0'));var util=require(_0xe936('0x1'));var moment=require(_0xe936('0x2'));var BPromise=require(_0xe936('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe936('0x4'));var db=require(_0xe936('0x5'))['db'];var utils=require(_0xe936('0x6'));var logger=require(_0xe936('0x7'))(_0xe936('0x8'));var config=require(_0xe936('0x9'));var jayson=require(_0xe936('0xa'));var client=jayson[_0xe936('0xb')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xe936('0xc')],{'host':_0xe936('0xd'),'port':0x18eb});var socket=require(_0xe936('0xe'))(new Redis(config[_0xe936('0xc')]));require('./chatMessage.socket')['register'](socket);function respondWithRpcPromise(_0x1e54dd,_0xd8e0e8,_0x28aecf){return new BPromise(function(_0x34d684,_0x5d5a7d){return client['request'](_0x1e54dd,_0x28aecf)[_0xe936('0xf')](function(_0x4a95ba){logger[_0xe936('0x10')](_0xe936('0x11'),_0xd8e0e8,_0xe936('0x12'));logger[_0xe936('0x13')](_0xe936('0x14'),_0xd8e0e8,_0xe936('0x12'),JSON[_0xe936('0x15')](_0x4a95ba));if(_0x4a95ba[_0xe936('0x16')]){if(_0x4a95ba[_0xe936('0x16')][_0xe936('0x17')]===0x1f4){logger[_0xe936('0x16')]('ChatMessage,\x20%s,\x20%s',_0xd8e0e8,_0x4a95ba[_0xe936('0x16')]['message']);return _0x5d5a7d(_0x4a95ba[_0xe936('0x16')][_0xe936('0x18')]);}logger[_0xe936('0x16')]('ChatMessage,\x20%s,\x20%s',_0xd8e0e8,_0x4a95ba[_0xe936('0x16')][_0xe936('0x18')]);return _0x34d684(_0x4a95ba['error'][_0xe936('0x18')]);}else{logger[_0xe936('0x10')](_0xe936('0x11'),_0xd8e0e8,'request\x20sent');_0x34d684(_0x4a95ba[_0xe936('0x19')][_0xe936('0x18')]);}})[_0xe936('0x1a')](function(_0x154e2f){logger['error']('ChatMessage,\x20%s,\x20%s',_0xd8e0e8,_0x154e2f);_0x5d5a7d(_0x154e2f);});});}exports['CreateChatMessage']=function(_0x11571a){var _0x2ac424=this;return new Promise(function(_0x1ece52,_0x250ade){return db[_0xe936('0x1b')][_0xe936('0x1c')](_0x11571a[_0xe936('0x1d')],{'raw':_0x11571a[_0xe936('0x1e')]?_0x11571a['options'][_0xe936('0x1f')]===undefined?!![]:![]:!![]})[_0xe936('0xf')](function(_0x3c8ac9){logger[_0xe936('0x10')](_0xe936('0x20'),_0x11571a);logger[_0xe936('0x13')](_0xe936('0x20'),_0x11571a,JSON[_0xe936('0x15')](_0x3c8ac9));_0x1ece52(_0x3c8ac9);})['catch'](function(_0x12d6fb){logger[_0xe936('0x16')]('CreateChatMessage',_0x12d6fb[_0xe936('0x18')],_0x11571a);_0x250ade(_0x2ac424[_0xe936('0x16')](0x1f4,_0x12d6fb['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 2864fd9..76b5b92 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 _0x9b67=['register','length','chatMessage:','./chatMessage.events','save','remove','update','emit','removeListener'];(function(_0x2a5508,_0x3d032f){var _0x4b202b=function(_0xb91451){while(--_0xb91451){_0x2a5508['push'](_0x2a5508['shift']());}};_0x4b202b(++_0x3d032f);}(_0x9b67,0xf6));var _0x79b6=function(_0x8f8e85,_0x4eb18c){_0x8f8e85=_0x8f8e85-0x0;var _0x172c58=_0x9b67[_0x8f8e85];return _0x172c58;};'use strict';var ChatMessageEvents=require(_0x79b6('0x0'));var events=[_0x79b6('0x1'),_0x79b6('0x2'),_0x79b6('0x3')];function createListener(_0x29728d,_0x5523a1){return function(_0x3ba25a){_0x5523a1[_0x79b6('0x4')](_0x29728d,_0x3ba25a);};}function removeListener(_0x5297d0,_0x4e8794){return function(){ChatMessageEvents[_0x79b6('0x5')](_0x5297d0,_0x4e8794);};}exports[_0x79b6('0x6')]=function(_0x258103){for(var _0xec367e=0x0,_0xfa6a05=events[_0x79b6('0x7')];_0xec367e<_0xfa6a05;_0xec367e++){var _0x34adbe=events[_0xec367e];var _0x58ae2d=createListener(_0x79b6('0x8')+_0x34adbe,_0x258103);ChatMessageEvents['on'](_0x34adbe,_0x58ae2d);}}; \ No newline at end of file +var _0x1696=['length','chatMessage:','./chatMessage.events','remove','update','emit','removeListener'];(function(_0x16db8b,_0xca7d28){var _0x5ba017=function(_0x35b933){while(--_0x35b933){_0x16db8b['push'](_0x16db8b['shift']());}};_0x5ba017(++_0xca7d28);}(_0x1696,0x79));var _0x6169=function(_0x2dbf41,_0x4fdb82){_0x2dbf41=_0x2dbf41-0x0;var _0x18eaa7=_0x1696[_0x2dbf41];return _0x18eaa7;};'use strict';var ChatMessageEvents=require(_0x6169('0x0'));var events=['save',_0x6169('0x1'),_0x6169('0x2')];function createListener(_0x1c5bac,_0xab8597){return function(_0x20d57e){_0xab8597[_0x6169('0x3')](_0x1c5bac,_0x20d57e);};}function removeListener(_0x357aaf,_0x10d0ab){return function(){ChatMessageEvents[_0x6169('0x4')](_0x357aaf,_0x10d0ab);};}exports['register']=function(_0x3569ff){for(var _0x128cf1=0x0,_0x277459=events[_0x6169('0x5')];_0x128cf1<_0x277459;_0x128cf1++){var _0x289333=events[_0x128cf1];var _0x2a1658=createListener(_0x6169('0x6')+_0x289333,_0x3569ff);ChatMessageEvents['on'](_0x289333,_0x2a1658);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 284eecc..e0d5cae 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 _0x41f0=['chat','chatmessage:create','create','/:id','put','/:id/accept','/:id/reject','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatMessage.controller','isAuthenticated','index','get','/describe','show','post'];(function(_0x1fe396,_0x2426a0){var _0x5610b0=function(_0x2aed10){while(--_0x2aed10){_0x1fe396['push'](_0x1fe396['shift']());}};_0x5610b0(++_0x2426a0);}(_0x41f0,0x14e));var _0x041f=function(_0x32a916,_0x2be893){_0x32a916=_0x32a916-0x0;var _0x117189=_0x41f0[_0x32a916];return _0x117189;};'use strict';var multer=require(_0x041f('0x0'));var util=require(_0x041f('0x1'));var path=require(_0x041f('0x2'));var timeout=require(_0x041f('0x3'));var express=require(_0x041f('0x4'));var router=express[_0x041f('0x5')]();var fs_extra=require(_0x041f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x041f('0x7'));var config=require(_0x041f('0x8'));var controller=require(_0x041f('0x9'));router['get']('/',auth[_0x041f('0xa')](),controller[_0x041f('0xb')]);router[_0x041f('0xc')](_0x041f('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x041f('0xc')]('/:id',auth[_0x041f('0xa')](),controller[_0x041f('0xe')]);router[_0x041f('0xf')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x041f('0x10'),_0x041f('0x11')),controller[_0x041f('0x12')]);router['put'](_0x041f('0x13'),controller['update']);router[_0x041f('0x14')](_0x041f('0x15'),auth[_0x041f('0xa')](),controller['accept']);router['put'](_0x041f('0x16'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x041f('0x13'),auth['isAuthenticated'](),controller[_0x041f('0x17')]);module[_0x041f('0x18')]=router; \ No newline at end of file +var _0xc0ce=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','chat','chatmessage:create','update','put','accept','reject','multer','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc0ce,0x11c));var _0xec0c=function(_0x5c5505,_0x49c6eb){_0x5c5505=_0x5c5505-0x0;var _0x98823c=_0xc0ce[_0x5c5505];return _0x98823c;};'use strict';var multer=require(_0xec0c('0x0'));var util=require(_0xec0c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xec0c('0x2'));var router=express[_0xec0c('0x3')]();var fs_extra=require(_0xec0c('0x4'));var auth=require(_0xec0c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xec0c('0x6'));var controller=require('./chatMessage.controller');router[_0xec0c('0x7')]('/',auth[_0xec0c('0x8')](),controller[_0xec0c('0x9')]);router[_0xec0c('0x7')](_0xec0c('0xa'),auth['isAuthenticated'](),controller[_0xec0c('0xb')]);router[_0xec0c('0x7')](_0xec0c('0xc'),auth[_0xec0c('0x8')](),controller[_0xec0c('0xd')]);router[_0xec0c('0xe')]('/',auth[_0xec0c('0x8')](),interaction[_0xec0c('0xf')](_0xec0c('0x10'),_0xec0c('0x11')),controller['create']);router['put'](_0xec0c('0xc'),controller[_0xec0c('0x12')]);router[_0xec0c('0x13')]('/:id/accept',auth['isAuthenticated'](),controller[_0xec0c('0x14')]);router[_0xec0c('0x13')]('/:id/reject',auth[_0xec0c('0x8')](),controller[_0xec0c('0x15')]);router['delete']('/:id',auth[_0xec0c('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index fbffcbf..0056e67 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 _0x67da=['exports','TEXT','medium'];(function(_0x29e8b0,_0x47ad3f){var _0x306f53=function(_0x203fba){while(--_0x203fba){_0x29e8b0['push'](_0x29e8b0['shift']());}};_0x306f53(++_0x47ad3f);}(_0x67da,0x192));var _0xa67d=function(_0x5a8e0a,_0x193c09){_0x5a8e0a=_0x5a8e0a-0x0;var _0x5b15fa=_0x67da[_0x5a8e0a];return _0x5b15fa;};'use strict';var Sequelize=require('sequelize');module[_0xa67d('0x0')]={'body':{'type':Sequelize[_0xa67d('0x1')](_0xa67d('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0xa289=['exports','sequelize'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa289,0x111));var _0x9a28=function(_0x572096,_0x189798){_0x572096=_0x572096-0x0;var _0x17d648=_0xa289[_0x572096];return _0x17d648;};'use strict';var Sequelize=require(_0x9a28('0x0'));module[_0x9a28('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index f98c402..d86f558 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(_0x3e7168,_0x27f340){var _0x256818=function(_0x559066){while(--_0x559066){_0x3e7168['push'](_0x3e7168['shift']());}};_0x256818(++_0x27f340);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x5aec42,_0x8d9522){var _0x52bb2e=function(_0x3037c4){while(--_0x3037c4){_0x5aec42['push'](_0x5aec42['shift']());}};_0x52bb2e(++_0x8d9522);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 2856034..29da3ee 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 _0x6dc7=['moment','bluebird','request-promise','path','../../config/environment','./chatOfflineMessage.attributes','exports','ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x96cb45,_0x3cb473){var _0x3047ae=function(_0x537a50){while(--_0x537a50){_0x96cb45['push'](_0x96cb45['shift']());}};_0x3047ae(++_0x3cb473);}(_0x6dc7,0x128));var _0x76dc=function(_0x18c266,_0x2da663){_0x18c266=_0x18c266-0x0;var _0x4e517a=_0x6dc7[_0x18c266];return _0x4e517a;};'use strict';var _=require(_0x76dc('0x0'));var util=require(_0x76dc('0x1'));var logger=require(_0x76dc('0x2'))('api');var moment=require(_0x76dc('0x3'));var BPromise=require(_0x76dc('0x4'));var rp=require(_0x76dc('0x5'));var fs=require('fs');var path=require(_0x76dc('0x6'));var rimraf=require('rimraf');var config=require(_0x76dc('0x7'));var attributes=require(_0x76dc('0x8'));module[_0x76dc('0x9')]=function(_0x211385,_0x52665a){return _0x211385['define'](_0x76dc('0xa'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x76dc('0xb'),'collate':_0x76dc('0xc')});}; \ No newline at end of file +var _0xbb07=['exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xbb07,0x10a));var _0x7bb0=function(_0x583277,_0x5ca82d){_0x583277=_0x583277-0x0;var _0x1baf2c=_0xbb07[_0x583277];return _0x1baf2c;};'use strict';var _=require('lodash');var util=require(_0x7bb0('0x0'));var logger=require(_0x7bb0('0x1'))(_0x7bb0('0x2'));var moment=require(_0x7bb0('0x3'));var BPromise=require(_0x7bb0('0x4'));var rp=require(_0x7bb0('0x5'));var fs=require('fs');var path=require(_0x7bb0('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatOfflineMessage.attributes');module[_0x7bb0('0x7')]=function(_0x45d163,_0xbb371d){return _0x45d163[_0x7bb0('0x8')](_0x7bb0('0x9'),attributes,{'tableName':_0x7bb0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7bb0('0xb'),'collate':_0x7bb0('0xc')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index a2e378d..1765768 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 _0x6b3f=['request\x20sent','error','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/environment','client','request','then','info','ChatOfflineMessage,\x20%s,\x20%s'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x6b3f,0xe4));var _0xf6b3=function(_0x4fb2f9,_0x3e966e){_0x4fb2f9=_0x4fb2f9-0x0;var _0x1f9e7d=_0x6b3f[_0x4fb2f9];return _0x1f9e7d;};'use strict';var _=require(_0xf6b3('0x0'));var util=require(_0xf6b3('0x1'));var moment=require(_0xf6b3('0x2'));var BPromise=require('bluebird');var rs=require(_0xf6b3('0x3'));var fs=require('fs');var Redis=require(_0xf6b3('0x4'));var db=require(_0xf6b3('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xf6b3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf6b3('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ae04d,_0x1cec13,_0x4e5613){return new BPromise(function(_0x46da49,_0x32a60f){return client[_0xf6b3('0x8')](_0x2ae04d,_0x4e5613)[_0xf6b3('0x9')](function(_0x46d964){logger[_0xf6b3('0xa')](_0xf6b3('0xb'),_0x1cec13,_0xf6b3('0xc'));logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x1cec13,_0xf6b3('0xc'),JSON['stringify'](_0x46d964));if(_0x46d964[_0xf6b3('0xd')]){if(_0x46d964['error']['code']===0x1f4){logger[_0xf6b3('0xd')](_0xf6b3('0xb'),_0x1cec13,_0x46d964[_0xf6b3('0xd')][_0xf6b3('0xe')]);return _0x32a60f(_0x46d964[_0xf6b3('0xd')][_0xf6b3('0xe')]);}logger[_0xf6b3('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1cec13,_0x46d964[_0xf6b3('0xd')]['message']);return _0x46da49(_0x46d964[_0xf6b3('0xd')][_0xf6b3('0xe')]);}else{logger[_0xf6b3('0xa')](_0xf6b3('0xb'),_0x1cec13,'request\x20sent');_0x46da49(_0x46d964[_0xf6b3('0xf')]['message']);}})['catch'](function(_0x3918da){logger[_0xf6b3('0xd')](_0xf6b3('0xb'),_0x1cec13,_0x3918da);_0x32a60f(_0x3918da);});});} \ No newline at end of file +var _0xf611=['ChatOfflineMessage,\x20%s,\x20%s','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','../../config/utils','rpc','../../config/environment','http','request','then','info'];(function(_0x3d7959,_0x180c1c){var _0x4fffa0=function(_0x3fbfc7){while(--_0x3fbfc7){_0x3d7959['push'](_0x3d7959['shift']());}};_0x4fffa0(++_0x180c1c);}(_0xf611,0x7b));var _0x1f61=function(_0x10b7a5,_0xd3f792){_0x10b7a5=_0x10b7a5-0x0;var _0x1764b9=_0xf611[_0x10b7a5];return _0x1764b9;};'use strict';var _=require('lodash');var util=require(_0x1f61('0x0'));var moment=require(_0x1f61('0x1'));var BPromise=require(_0x1f61('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1f61('0x3'));var logger=require('../../config/logger')(_0x1f61('0x4'));var config=require(_0x1f61('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1f61('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x34a924,_0x3a5e33,_0x21e3f6){return new BPromise(function(_0x5b2e5b,_0x2d3aeb){return client[_0x1f61('0x7')](_0x34a924,_0x21e3f6)[_0x1f61('0x8')](function(_0x47f426){logger[_0x1f61('0x9')](_0x1f61('0xa'),_0x3a5e33,'request\x20sent');logger['debug'](_0x1f61('0xb'),_0x3a5e33,_0x1f61('0xc'),JSON[_0x1f61('0xd')](_0x47f426));if(_0x47f426[_0x1f61('0xe')]){if(_0x47f426[_0x1f61('0xe')][_0x1f61('0xf')]===0x1f4){logger[_0x1f61('0xe')](_0x1f61('0xa'),_0x3a5e33,_0x47f426['error'][_0x1f61('0x10')]);return _0x2d3aeb(_0x47f426[_0x1f61('0xe')][_0x1f61('0x10')]);}logger[_0x1f61('0xe')](_0x1f61('0xa'),_0x3a5e33,_0x47f426[_0x1f61('0xe')][_0x1f61('0x10')]);return _0x5b2e5b(_0x47f426[_0x1f61('0xe')][_0x1f61('0x10')]);}else{logger[_0x1f61('0x9')](_0x1f61('0xa'),_0x3a5e33,_0x1f61('0xc'));_0x5b2e5b(_0x47f426[_0x1f61('0x11')][_0x1f61('0x10')]);}})[_0x1f61('0x12')](function(_0x3a3a5a){logger[_0x1f61('0xe')](_0x1f61('0xa'),_0x3a5e33,_0x3a3a5a);_0x2d3aeb(_0x3a3a5a);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 0afcde6..57d5e90 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 _0x72ed=['show','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','index','/describe','isAuthenticated','/:id'];(function(_0x2db47c,_0x3d33d7){var _0x401315=function(_0x274a36){while(--_0x274a36){_0x2db47c['push'](_0x2db47c['shift']());}};_0x401315(++_0x3d33d7);}(_0x72ed,0x16f));var _0xd72e=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0x72ed[_0x307d86];return _0x361745;};'use strict';var multer=require('multer');var util=require(_0xd72e('0x0'));var path=require(_0xd72e('0x1'));var timeout=require(_0xd72e('0x2'));var express=require(_0xd72e('0x3'));var router=express[_0xd72e('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd72e('0x5'));var config=require(_0xd72e('0x6'));var controller=require(_0xd72e('0x7'));router[_0xd72e('0x8')]('/',auth['isAuthenticated'](),controller[_0xd72e('0x9')]);router[_0xd72e('0x8')](_0xd72e('0xa'),auth[_0xd72e('0xb')](),controller['describe']);router['get'](_0xd72e('0xc'),auth[_0xd72e('0xb')](),controller[_0xd72e('0xd')]);router[_0xd72e('0xe')]('/',auth[_0xd72e('0xb')](),controller[_0xd72e('0xf')]);router[_0xd72e('0x10')](_0xd72e('0xc'),auth[_0xd72e('0xb')](),controller[_0xd72e('0x11')]);router[_0xd72e('0x12')](_0xd72e('0xc'),auth[_0xd72e('0xb')](),controller[_0xd72e('0x13')]);module['exports']=router; \ No newline at end of file +var _0x103f=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','post','put','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x3dfea7,_0x34923a){var _0x30facb=function(_0x38216e){while(--_0x38216e){_0x3dfea7['push'](_0x3dfea7['shift']());}};_0x30facb(++_0x34923a);}(_0x103f,0x1e7));var _0xf103=function(_0x2823c1,_0x36e0af){_0x2823c1=_0x2823c1-0x0;var _0x8d0582=_0x103f[_0x2823c1];return _0x8d0582;};'use strict';var multer=require(_0xf103('0x0'));var util=require(_0xf103('0x1'));var path=require(_0xf103('0x2'));var timeout=require(_0xf103('0x3'));var express=require('express');var router=express[_0xf103('0x4')]();var fs_extra=require(_0xf103('0x5'));var auth=require(_0xf103('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf103('0x7'));var controller=require('./chatOfflineMessage.controller');router[_0xf103('0x8')]('/',auth[_0xf103('0x9')](),controller[_0xf103('0xa')]);router[_0xf103('0x8')](_0xf103('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xf103('0xc'),auth[_0xf103('0x9')](),controller['show']);router[_0xf103('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf103('0xe')](_0xf103('0xc'),auth[_0xf103('0x9')](),controller['update']);router['delete'](_0xf103('0xc'),auth[_0xf103('0x9')](),controller[_0xf103('0xf')]);module[_0xf103('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 6f902d9..8e3e67b 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 _0xc48f=['sequelize','STRING','mouseOver','timeout','INTEGER'];(function(_0x16dbfd,_0x2f9431){var _0x382254=function(_0x19dade){while(--_0x19dade){_0x16dbfd['push'](_0x16dbfd['shift']());}};_0x382254(++_0x2f9431);}(_0xc48f,0xdc));var _0xfc48=function(_0x24a9eb,_0x3849df){_0x24a9eb=_0x24a9eb-0x0;var _0x37a2c7=_0xc48f[_0x24a9eb];return _0x37a2c7;};'use strict';var Sequelize=require(_0xfc48('0x0'));module['exports']={'name':{'type':Sequelize[_0xfc48('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xfc48('0x2'),_0xfc48('0x3')),'defaultValue':_0xfc48('0x2')},'selector':{'type':Sequelize[_0xfc48('0x1')]},'timeout':{'type':Sequelize[_0xfc48('0x4')]}}; \ No newline at end of file +var _0xc47b=['sequelize','timeout','mouseOver','STRING','INTEGER'];(function(_0x27c24e,_0x5db1c7){var _0x39004a=function(_0x44286d){while(--_0x44286d){_0x27c24e['push'](_0x27c24e['shift']());}};_0x39004a(++_0x5db1c7);}(_0xc47b,0x19f));var _0xbc47=function(_0x53a975,_0xef9d88){_0x53a975=_0x53a975-0x0;var _0x46237c=_0xc47b[_0x53a975];return _0x46237c;};'use strict';var Sequelize=require(_0xbc47('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('mouseOver',_0xbc47('0x1')),'defaultValue':_0xbc47('0x2')},'selector':{'type':Sequelize[_0xbc47('0x3')]},'timeout':{'type':Sequelize[_0xbc47('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 01ca2b7..e73592c 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 _0x6075=['body','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','show','params','model','keys','ChatProactiveAction','query','filters','intersection','fields','attributes','includeAll','include','merge','find','create'];(function(_0x393f03,_0x406130){var _0x4d6baf=function(_0x1a5f0e){while(--_0x1a5f0e){_0x393f03['push'](_0x393f03['shift']());}};_0x4d6baf(++_0x406130);}(_0x6075,0x191));var _0x5607=function(_0x3021c6,_0x2c6d6e){_0x3021c6=_0x3021c6-0x0;var _0xc06274=_0x6075[_0x3021c6];return _0xc06274;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5607('0x0'));var zipdir=require(_0x5607('0x1'));var jsonpatch=require(_0x5607('0x2'));var rp=require(_0x5607('0x3'));var moment=require(_0x5607('0x4'));var BPromise=require(_0x5607('0x5'));var Mustache=require(_0x5607('0x6'));var util=require(_0x5607('0x7'));var path=require(_0x5607('0x8'));var sox=require('sox');var csv=require(_0x5607('0x9'));var ejs=require(_0x5607('0xa'));var fs=require('fs');var fs_extra=require(_0x5607('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5607('0xc'));var jsforce=require(_0x5607('0xd'));var deskjs=require(_0x5607('0xe'));var toCsv=require(_0x5607('0x9'));var querystring=require(_0x5607('0xf'));var Papa=require('papaparse');var Redis=require(_0x5607('0x10'));var authService=require(_0x5607('0x11'));var qs=require(_0x5607('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5607('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x5607('0x14'));var config=require(_0x5607('0x15'));var licenseUtil=require(_0x5607('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c8013,_0x42a405){_0x42a405=_0x42a405||0xcc;return function(_0xc534bd){if(_0xc534bd){return _0x2c8013[_0x5607('0x17')](_0x42a405);}return _0x2c8013[_0x5607('0x18')](_0x42a405)[_0x5607('0x19')]();};}function respondWithResult(_0x138d74,_0x1c8cbc){_0x1c8cbc=_0x1c8cbc||0xc8;return function(_0x2daf4c){if(_0x2daf4c){return _0x138d74['status'](_0x1c8cbc)[_0x5607('0x1a')](_0x2daf4c);}};}function respondWithFilteredResult(_0x275c5d,_0xe3e004){return function(_0x505b12){if(_0x505b12){var _0x556397=typeof _0xe3e004[_0x5607('0x1b')]==='undefined'&&typeof _0xe3e004[_0x5607('0x1c')]===_0x5607('0x1d');var _0x1fa238=_0x505b12[_0x5607('0x1e')];var _0x3eaaa0=_0x556397?0x0:_0xe3e004[_0x5607('0x1b')];var _0x55689e=_0x556397?_0x505b12[_0x5607('0x1e')]:_0xe3e004['offset']+_0xe3e004[_0x5607('0x1c')];var _0x3e071b;if(_0x55689e>=_0x1fa238){_0x55689e=_0x1fa238;_0x3e071b=0xc8;}else{_0x3e071b=0xce;}_0x275c5d[_0x5607('0x18')](_0x3e071b);return _0x275c5d['set'](_0x5607('0x1f'),_0x3eaaa0+'-'+_0x55689e+'/'+_0x1fa238)[_0x5607('0x1a')](_0x505b12);}return null;};}function patchUpdates(_0x303089){return function(_0x4e66f0){try{jsonpatch[_0x5607('0x20')](_0x4e66f0,_0x303089,!![]);}catch(_0x2fdc13){return BPromise[_0x5607('0x21')](_0x2fdc13);}return _0x4e66f0['save']();};}function saveUpdates(_0x44f7a2,_0x4feb1c){return function(_0x49f918){if(_0x49f918){return _0x49f918[_0x5607('0x22')](_0x44f7a2)[_0x5607('0x23')](function(_0x32d30a){return _0x32d30a;});}return null;};}function removeEntity(_0x2d983f,_0x351c32){return function(_0x34df69){if(_0x34df69){return _0x34df69[_0x5607('0x24')]()[_0x5607('0x23')](function(){_0x2d983f[_0x5607('0x18')](0xcc)[_0x5607('0x19')]();});}};}function handleEntityNotFound(_0x593df7,_0x20ae60){return function(_0x27e144){if(!_0x27e144){_0x593df7['sendStatus'](0x194);}return _0x27e144;};}function handleError(_0xa83081,_0x14dd08){_0x14dd08=_0x14dd08||0x1f4;return function(_0xdb07c8){logger[_0x5607('0x25')](_0xdb07c8[_0x5607('0x26')]);if(_0xdb07c8[_0x5607('0x27')]){delete _0xdb07c8[_0x5607('0x27')];}_0xa83081[_0x5607('0x18')](_0x14dd08)['send'](_0xdb07c8);};}exports[_0x5607('0x28')]=function(_0x309ede,_0x51b7d5){var _0x5932ae={'raw':!![],'where':{'id':_0x309ede[_0x5607('0x29')]['id']}},_0x12f58f={};_0x12f58f[_0x5607('0x2a')]=_[_0x5607('0x2b')](db[_0x5607('0x2c')]['rawAttributes']);_0x12f58f[_0x5607('0x2d')]=_['keys'](_0x309ede[_0x5607('0x2d')]);_0x12f58f[_0x5607('0x2e')]=_[_0x5607('0x2f')](_0x12f58f['model'],_0x12f58f[_0x5607('0x2d')]);_0x5932ae['attributes']=_[_0x5607('0x2f')](_0x12f58f[_0x5607('0x2a')],qs[_0x5607('0x30')](_0x309ede[_0x5607('0x2d')][_0x5607('0x30')]));_0x5932ae['attributes']=_0x5932ae[_0x5607('0x31')]['length']?_0x5932ae[_0x5607('0x31')]:_0x12f58f[_0x5607('0x2a')];if(_0x309ede['query'][_0x5607('0x32')]){_0x5932ae[_0x5607('0x33')]=[{'all':!![]}];}_0x5932ae=_[_0x5607('0x34')]({},_0x5932ae,_0x309ede['options']);return db[_0x5607('0x2c')][_0x5607('0x35')](_0x5932ae)[_0x5607('0x23')](handleEntityNotFound(_0x51b7d5,null))[_0x5607('0x23')](respondWithResult(_0x51b7d5,null))['catch'](handleError(_0x51b7d5,null));};exports[_0x5607('0x36')]=function(_0x36bc31,_0x4f63ce){return db[_0x5607('0x2c')][_0x5607('0x36')](_0x36bc31[_0x5607('0x37')],{})['then'](respondWithResult(_0x4f63ce,0xc9))[_0x5607('0x38')](handleError(_0x4f63ce,null));};exports['update']=function(_0x2ed4c2,_0x287430){if(_0x2ed4c2[_0x5607('0x37')]['id']){delete _0x2ed4c2['body']['id'];}return db['ChatProactiveAction']['find']({'where':{'id':_0x2ed4c2[_0x5607('0x29')]['id']}})[_0x5607('0x23')](handleEntityNotFound(_0x287430,null))[_0x5607('0x23')](saveUpdates(_0x2ed4c2[_0x5607('0x37')],null))[_0x5607('0x23')](respondWithResult(_0x287430,null))[_0x5607('0x38')](handleError(_0x287430,null));};exports[_0x5607('0x24')]=function(_0x2fa6bc,_0x54cc53){return db[_0x5607('0x2c')][_0x5607('0x35')]({'where':{'id':_0x2fa6bc[_0x5607('0x29')]['id']}})[_0x5607('0x23')](handleEntityNotFound(_0x54cc53,null))['then'](removeEntity(_0x54cc53,null))[_0x5607('0x38')](handleError(_0x54cc53,null));}; \ No newline at end of file +var _0x86f4=['catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','params','model','ChatProactiveAction','query','keys','filters','intersection','attributes','fields','includeAll','include','merge','options'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x86f4,0x18a));var _0x486f=function(_0x3bea09,_0x5cb563){_0x3bea09=_0x3bea09-0x0;var _0x1f7b6e=_0x86f4[_0x3bea09];return _0x1f7b6e;};'use strict';var emlformat=require(_0x486f('0x0'));var rimraf=require(_0x486f('0x1'));var zipdir=require(_0x486f('0x2'));var jsonpatch=require(_0x486f('0x3'));var rp=require(_0x486f('0x4'));var moment=require(_0x486f('0x5'));var BPromise=require(_0x486f('0x6'));var Mustache=require('mustache');var util=require(_0x486f('0x7'));var path=require(_0x486f('0x8'));var sox=require('sox');var csv=require(_0x486f('0x9'));var ejs=require(_0x486f('0xa'));var fs=require('fs');var fs_extra=require(_0x486f('0xb'));var _=require(_0x486f('0xc'));var squel=require(_0x486f('0xd'));var crypto=require(_0x486f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x486f('0xf'));var toCsv=require(_0x486f('0x9'));var querystring=require(_0x486f('0x10'));var Papa=require(_0x486f('0x11'));var Redis=require(_0x486f('0x12'));var authService=require(_0x486f('0x13'));var qs=require(_0x486f('0x14'));var as=require(_0x486f('0x15'));var hardwareService=require(_0x486f('0x16'));var logger=require(_0x486f('0x17'))(_0x486f('0x18'));var utils=require(_0x486f('0x19'));var config=require(_0x486f('0x1a'));var licenseUtil=require(_0x486f('0x1b'));var db=require(_0x486f('0x1c'))['db'];function respondWithStatusCode(_0x4312fb,_0x1c4e55){_0x1c4e55=_0x1c4e55||0xcc;return function(_0x4eb4f9){if(_0x4eb4f9){return _0x4312fb[_0x486f('0x1d')](_0x1c4e55);}return _0x4312fb['status'](_0x1c4e55)[_0x486f('0x1e')]();};}function respondWithResult(_0x2cc608,_0x1ac871){_0x1ac871=_0x1ac871||0xc8;return function(_0x50bee8){if(_0x50bee8){return _0x2cc608['status'](_0x1ac871)[_0x486f('0x1f')](_0x50bee8);}};}function respondWithFilteredResult(_0x3a4fef,_0x51334f){return function(_0x16830e){if(_0x16830e){var _0x2ab753=typeof _0x51334f[_0x486f('0x20')]==='undefined'&&typeof _0x51334f['limit']===_0x486f('0x21');var _0x3eeae0=_0x16830e[_0x486f('0x22')];var _0x39bfac=_0x2ab753?0x0:_0x51334f['offset'];var _0x59deb8=_0x2ab753?_0x16830e[_0x486f('0x22')]:_0x51334f[_0x486f('0x20')]+_0x51334f[_0x486f('0x23')];var _0x20a1f7;if(_0x59deb8>=_0x3eeae0){_0x59deb8=_0x3eeae0;_0x20a1f7=0xc8;}else{_0x20a1f7=0xce;}_0x3a4fef[_0x486f('0x24')](_0x20a1f7);return _0x3a4fef[_0x486f('0x25')](_0x486f('0x26'),_0x39bfac+'-'+_0x59deb8+'/'+_0x3eeae0)[_0x486f('0x1f')](_0x16830e);}return null;};}function patchUpdates(_0xe0b1cc){return function(_0x3d79bc){try{jsonpatch[_0x486f('0x27')](_0x3d79bc,_0xe0b1cc,!![]);}catch(_0x4ccac0){return BPromise[_0x486f('0x28')](_0x4ccac0);}return _0x3d79bc[_0x486f('0x29')]();};}function saveUpdates(_0x26a909,_0x4a0eb5){return function(_0x4d784e){if(_0x4d784e){return _0x4d784e[_0x486f('0x2a')](_0x26a909)[_0x486f('0x2b')](function(_0x16a530){return _0x16a530;});}return null;};}function removeEntity(_0x14b309,_0x351f81){return function(_0x26822b){if(_0x26822b){return _0x26822b[_0x486f('0x2c')]()[_0x486f('0x2b')](function(){_0x14b309[_0x486f('0x24')](0xcc)[_0x486f('0x1e')]();});}};}function handleEntityNotFound(_0x2e983b,_0x71a26f){return function(_0x387462){if(!_0x387462){_0x2e983b[_0x486f('0x1d')](0x194);}return _0x387462;};}function handleError(_0x8b3277,_0x30b322){_0x30b322=_0x30b322||0x1f4;return function(_0x6f1e8e){logger[_0x486f('0x2d')](_0x6f1e8e[_0x486f('0x2e')]);if(_0x6f1e8e[_0x486f('0x2f')]){delete _0x6f1e8e[_0x486f('0x2f')];}_0x8b3277[_0x486f('0x24')](_0x30b322)['send'](_0x6f1e8e);};}exports['show']=function(_0x52fb3a,_0x5b4718){var _0x173512={'raw':!![],'where':{'id':_0x52fb3a[_0x486f('0x30')]['id']}},_0x5c994a={};_0x5c994a[_0x486f('0x31')]=_['keys'](db[_0x486f('0x32')]['rawAttributes']);_0x5c994a[_0x486f('0x33')]=_[_0x486f('0x34')](_0x52fb3a[_0x486f('0x33')]);_0x5c994a[_0x486f('0x35')]=_[_0x486f('0x36')](_0x5c994a[_0x486f('0x31')],_0x5c994a['query']);_0x173512[_0x486f('0x37')]=_[_0x486f('0x36')](_0x5c994a[_0x486f('0x31')],qs[_0x486f('0x38')](_0x52fb3a[_0x486f('0x33')][_0x486f('0x38')]));_0x173512[_0x486f('0x37')]=_0x173512[_0x486f('0x37')]['length']?_0x173512[_0x486f('0x37')]:_0x5c994a[_0x486f('0x31')];if(_0x52fb3a['query'][_0x486f('0x39')]){_0x173512[_0x486f('0x3a')]=[{'all':!![]}];}_0x173512=_[_0x486f('0x3b')]({},_0x173512,_0x52fb3a[_0x486f('0x3c')]);return db[_0x486f('0x32')]['find'](_0x173512)[_0x486f('0x2b')](handleEntityNotFound(_0x5b4718,null))[_0x486f('0x2b')](respondWithResult(_0x5b4718,null))[_0x486f('0x3d')](handleError(_0x5b4718,null));};exports[_0x486f('0x3e')]=function(_0x387939,_0x1d2d13){return db[_0x486f('0x32')]['create'](_0x387939[_0x486f('0x3f')],{})[_0x486f('0x2b')](respondWithResult(_0x1d2d13,0xc9))[_0x486f('0x3d')](handleError(_0x1d2d13,null));};exports['update']=function(_0x5678d8,_0x3fbdc6){if(_0x5678d8[_0x486f('0x3f')]['id']){delete _0x5678d8['body']['id'];}return db[_0x486f('0x32')]['find']({'where':{'id':_0x5678d8[_0x486f('0x30')]['id']}})[_0x486f('0x2b')](handleEntityNotFound(_0x3fbdc6,null))['then'](saveUpdates(_0x5678d8['body'],null))[_0x486f('0x2b')](respondWithResult(_0x3fbdc6,null))[_0x486f('0x3d')](handleError(_0x3fbdc6,null));};exports[_0x486f('0x2c')]=function(_0x286d0d,_0xdedd85){return db[_0x486f('0x32')][_0x486f('0x40')]({'where':{'id':_0x286d0d[_0x486f('0x30')]['id']}})[_0x486f('0x2b')](handleEntityNotFound(_0xdedd85,null))[_0x486f('0x2b')](removeEntity(_0xdedd85,null))[_0x486f('0x3d')](handleError(_0xdedd85,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 6fdc0f9..80282a9 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 _0x41c2=['../../config/environment','./chatProactiveAction.attributes','define','chat_proactive_actions','util','api','moment','request-promise','path'];(function(_0x17470e,_0x1a1607){var _0x2334d9=function(_0x9e64a7){while(--_0x9e64a7){_0x17470e['push'](_0x17470e['shift']());}};_0x2334d9(++_0x1a1607);}(_0x41c2,0xca));var _0x241c=function(_0x355f71,_0x3e97a6){_0x355f71=_0x355f71-0x0;var _0x5cc384=_0x41c2[_0x355f71];return _0x5cc384;};'use strict';var _=require('lodash');var util=require(_0x241c('0x0'));var logger=require('../../config/logger')(_0x241c('0x1'));var moment=require(_0x241c('0x2'));var BPromise=require('bluebird');var rp=require(_0x241c('0x3'));var fs=require('fs');var path=require(_0x241c('0x4'));var rimraf=require('rimraf');var config=require(_0x241c('0x5'));var attributes=require(_0x241c('0x6'));module['exports']=function(_0xa9a071,_0x527d60){return _0xa9a071[_0x241c('0x7')]('ChatProactiveAction',attributes,{'tableName':_0x241c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x42b7=['chat_proactive_actions','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','ChatProactiveAction'];(function(_0x4db4f2,_0x422e88){var _0x4ccfee=function(_0xf74f82){while(--_0xf74f82){_0x4db4f2['push'](_0x4db4f2['shift']());}};_0x4ccfee(++_0x422e88);}(_0x42b7,0x64));var _0x742b=function(_0x4e55ba,_0xb33d31){_0x4e55ba=_0x4e55ba-0x0;var _0x196ae5=_0x42b7[_0x4e55ba];return _0x196ae5;};'use strict';var _=require(_0x742b('0x0'));var util=require('util');var logger=require(_0x742b('0x1'))('api');var moment=require(_0x742b('0x2'));var BPromise=require('bluebird');var rp=require(_0x742b('0x3'));var fs=require('fs');var path=require(_0x742b('0x4'));var rimraf=require(_0x742b('0x5'));var config=require(_0x742b('0x6'));var attributes=require('./chatProactiveAction.attributes');module['exports']=function(_0x472991,_0x89b091){return _0x472991['define'](_0x742b('0x7'),attributes,{'tableName':_0x742b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 411710d..b2dfc62 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 _0xbb7d=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error'];(function(_0xb51e97,_0x4dd742){var _0x2ae4c9=function(_0x530735){while(--_0x530735){_0xb51e97['push'](_0xb51e97['shift']());}};_0x2ae4c9(++_0x4dd742);}(_0xbb7d,0x122));var _0xdbb7=function(_0x440a73,_0x2ae57d){_0x440a73=_0x440a73-0x0;var _0x48dc26=_0xbb7d[_0x440a73];return _0x48dc26;};'use strict';var _=require(_0xdbb7('0x0'));var util=require(_0xdbb7('0x1'));var moment=require(_0xdbb7('0x2'));var BPromise=require(_0xdbb7('0x3'));var rs=require(_0xdbb7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdbb7('0x5'))['db'];var utils=require(_0xdbb7('0x6'));var logger=require(_0xdbb7('0x7'))(_0xdbb7('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdbb7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21681e,_0x2be800,_0x28db21){return new BPromise(function(_0x4f17d9,_0x5781ec){return client[_0xdbb7('0xa')](_0x21681e,_0x28db21)[_0xdbb7('0xb')](function(_0x279c1b){logger[_0xdbb7('0xc')](_0xdbb7('0xd'),_0x2be800,_0xdbb7('0xe'));logger[_0xdbb7('0xf')](_0xdbb7('0x10'),_0x2be800,_0xdbb7('0xe'),JSON['stringify'](_0x279c1b));if(_0x279c1b['error']){if(_0x279c1b[_0xdbb7('0x11')][_0xdbb7('0x12')]===0x1f4){logger['error'](_0xdbb7('0xd'),_0x2be800,_0x279c1b[_0xdbb7('0x11')]['message']);return _0x5781ec(_0x279c1b[_0xdbb7('0x11')][_0xdbb7('0x13')]);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x2be800,_0x279c1b[_0xdbb7('0x11')]['message']);return _0x4f17d9(_0x279c1b[_0xdbb7('0x11')]['message']);}else{logger['info'](_0xdbb7('0xd'),_0x2be800,_0xdbb7('0xe'));_0x4f17d9(_0x279c1b[_0xdbb7('0x14')][_0xdbb7('0x13')]);}})[_0xdbb7('0x15')](function(_0x22fb8f){logger[_0xdbb7('0x11')](_0xdbb7('0xd'),_0x2be800,_0x22fb8f);_0x5781ec(_0x22fb8f);});});} \ No newline at end of file +var _0x7f65=['debug','stringify','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent'];(function(_0x5c5604,_0x58cb5e){var _0xf036e8=function(_0x1c01a4){while(--_0x1c01a4){_0x5c5604['push'](_0x5c5604['shift']());}};_0xf036e8(++_0x58cb5e);}(_0x7f65,0xed));var _0x57f6=function(_0x54948e,_0xf4d899){_0x54948e=_0x54948e-0x0;var _0x4098c4=_0x7f65[_0x54948e];return _0x4098c4;};'use strict';var _=require('lodash');var util=require(_0x57f6('0x0'));var moment=require('moment');var BPromise=require(_0x57f6('0x1'));var rs=require(_0x57f6('0x2'));var fs=require('fs');var Redis=require(_0x57f6('0x3'));var db=require(_0x57f6('0x4'))['db'];var utils=require(_0x57f6('0x5'));var logger=require(_0x57f6('0x6'))(_0x57f6('0x7'));var config=require(_0x57f6('0x8'));var jayson=require(_0x57f6('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5582ff,_0x2494ea,_0x598714){return new BPromise(function(_0x8b987c,_0x1f8cef){return client[_0x57f6('0xa')](_0x5582ff,_0x598714)[_0x57f6('0xb')](function(_0x6fb6b7){logger[_0x57f6('0xc')](_0x57f6('0xd'),_0x2494ea,_0x57f6('0xe'));logger[_0x57f6('0xf')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x2494ea,_0x57f6('0xe'),JSON[_0x57f6('0x10')](_0x6fb6b7));if(_0x6fb6b7[_0x57f6('0x11')]){if(_0x6fb6b7['error']['code']===0x1f4){logger[_0x57f6('0x11')](_0x57f6('0xd'),_0x2494ea,_0x6fb6b7[_0x57f6('0x11')]['message']);return _0x1f8cef(_0x6fb6b7[_0x57f6('0x11')]['message']);}logger[_0x57f6('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x2494ea,_0x6fb6b7[_0x57f6('0x11')]['message']);return _0x8b987c(_0x6fb6b7[_0x57f6('0x11')][_0x57f6('0x12')]);}else{logger[_0x57f6('0xc')](_0x57f6('0xd'),_0x2494ea,_0x57f6('0xe'));_0x8b987c(_0x6fb6b7[_0x57f6('0x13')][_0x57f6('0x12')]);}})[_0x57f6('0x14')](function(_0xd9c150){logger[_0x57f6('0x11')](_0x57f6('0xd'),_0x2494ea,_0xd9c150);_0x1f8cef(_0xd9c150);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 7f72dc1..667eacb 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 _0x2675=['../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put','delete','exports','multer','express','Router'];(function(_0x2f4bbf,_0xe66cad){var _0x3e8ff8=function(_0x1369d2){while(--_0x1369d2){_0x2f4bbf['push'](_0x2f4bbf['shift']());}};_0x3e8ff8(++_0xe66cad);}(_0x2675,0x75));var _0x5267=function(_0x5f1205,_0x52a220){_0x5f1205=_0x5f1205-0x0;var _0x3fb900=_0x2675[_0x5f1205];return _0x3fb900;};'use strict';var multer=require(_0x5267('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5267('0x1'));var router=express[_0x5267('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x5267('0x3'));var interaction=require(_0x5267('0x4'));var config=require('../../config/environment');var controller=require(_0x5267('0x5'));router[_0x5267('0x6')](_0x5267('0x7'),auth[_0x5267('0x8')](),controller[_0x5267('0x9')]);router[_0x5267('0xa')]('/',auth['isAuthenticated'](),controller[_0x5267('0xb')]);router[_0x5267('0xc')]('/:id',auth[_0x5267('0x8')](),controller['update']);router[_0x5267('0xd')](_0x5267('0x7'),auth[_0x5267('0x8')](),controller['destroy']);module[_0x5267('0xe')]=router; \ No newline at end of file +var _0x8958=['show','post','put','update','delete','destroy','exports','util','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id','isAuthenticated'];(function(_0x1a60dd,_0x2f6df7){var _0x33a621=function(_0x4594a0){while(--_0x4594a0){_0x1a60dd['push'](_0x1a60dd['shift']());}};_0x33a621(++_0x2f6df7);}(_0x8958,0x93));var _0x8895=function(_0xa802d4,_0x579262){_0xa802d4=_0xa802d4-0x0;var _0x14b8ef=_0x8958[_0xa802d4];return _0x14b8ef;};'use strict';var multer=require('multer');var util=require(_0x8895('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x8895('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x8895('0x2'));var config=require(_0x8895('0x3'));var controller=require(_0x8895('0x4'));router['get'](_0x8895('0x5'),auth[_0x8895('0x6')](),controller[_0x8895('0x7')]);router[_0x8895('0x8')]('/',auth[_0x8895('0x6')](),controller['create']);router[_0x8895('0x9')](_0x8895('0x5'),auth[_0x8895('0x6')](),controller[_0x8895('0xa')]);router[_0x8895('0xb')](_0x8895('0x5'),auth[_0x8895('0x6')](),controller[_0x8895('0xc')]);module[_0x8895('0xd')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 64d414e..22ea1d8 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 _0xb606=['beepall','sequelize','exports','name','STRING','INTEGER','ENUM','rrmemory'];(function(_0x314d94,_0x35ff04){var _0x444bc7=function(_0x5915d9){while(--_0x5915d9){_0x314d94['push'](_0x314d94['shift']());}};_0x444bc7(++_0x35ff04);}(_0xb606,0x79));var _0x6b60=function(_0x21d36e,_0x5dc096){_0x21d36e=_0x21d36e-0x0;var _0x4cc307=_0xb606[_0x21d36e];return _0x4cc307;};'use strict';var Sequelize=require(_0x6b60('0x0'));module[_0x6b60('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6b60('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6b60('0x3')]},'timeout':{'type':Sequelize[_0x6b60('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6b60('0x5')](_0x6b60('0x6'),_0x6b60('0x7'),'roundrobin')}}; \ No newline at end of file +var _0x83c4=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x287dca,_0xb21c70){var _0x106ee8=function(_0x17eaa1){while(--_0x17eaa1){_0x287dca['push'](_0x287dca['shift']());}};_0x106ee8(++_0xb21c70);}(_0x83c4,0x1d8));var _0x483c=function(_0x13f198,_0x3a2508){_0x13f198=_0x13f198-0x0;var _0x15a919=_0x83c4[_0x13f198];return _0x15a919;};'use strict';var Sequelize=require(_0x483c('0x0'));module[_0x483c('0x1')]={'name':{'type':Sequelize[_0x483c('0x2')],'unique':_0x483c('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x483c('0x2')]},'timeout':{'type':Sequelize[_0x483c('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x483c('0x5')](_0x483c('0x6'),_0x483c('0x7'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 344a48c..3d8a9eb 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 _0x26ea=['ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','save','update','destroy','ChatQueues','UserProfileResource','stack','name','map','ChatQueue','fieldName','type','key','query','keys','intersection','model','attributes','fields','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','options','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','%s/%s','SIP','Team','getTeams','nolimit','ids','online','voicePause','interface','flatMap','Agents','sequelize','addTeams','each','findOrCreate','userChatQueue:save','select','field','from','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','removeTeams','removeAgents','emit','userChatQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','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','redis','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','http','request','then','info'];(function(_0x1d3cb3,_0x1ef743){var _0x29dc7b=function(_0x5966d3){while(--_0x5966d3){_0x1d3cb3['push'](_0x1d3cb3['shift']());}};_0x29dc7b(++_0x1ef743);}(_0x26ea,0x1a5));var _0xa26e=function(_0x3eba78,_0x1acef4){_0x3eba78=_0x3eba78-0x0;var _0x7defdc=_0x26ea[_0x3eba78];return _0x7defdc;};'use strict';var emlformat=require(_0xa26e('0x0'));var rimraf=require(_0xa26e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa26e('0x2'));var rp=require(_0xa26e('0x3'));var moment=require('moment');var BPromise=require(_0xa26e('0x4'));var Mustache=require(_0xa26e('0x5'));var util=require('util');var path=require('path');var sox=require(_0xa26e('0x6'));var csv=require(_0xa26e('0x7'));var ejs=require(_0xa26e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa26e('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa26e('0xa'));var toCsv=require(_0xa26e('0x7'));var querystring=require(_0xa26e('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa26e('0xc'));var qs=require(_0xa26e('0xd'));var as=require(_0xa26e('0xe'));var hardwareService=require(_0xa26e('0xf'));var logger=require(_0xa26e('0x10'))(_0xa26e('0x11'));var utils=require(_0xa26e('0x12'));var config=require(_0xa26e('0x13'));var licenseUtil=require(_0xa26e('0x14'));var db=require(_0xa26e('0x15'))['db'];config[_0xa26e('0x16')]=_['defaults'](config['redis'],{'host':_0xa26e('0x17'),'port':0x18eb});var socket=require(_0xa26e('0x18'))(new Redis(config[_0xa26e('0x16')]));require(_0xa26e('0x19'))[_0xa26e('0x1a')](socket);var jayson=require(_0xa26e('0x1b'));var client=jayson['client'][_0xa26e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x34b0d4,_0x5725c5,_0x238d11,_0x49c69d){return new BPromise(function(_0x2d20c0,_0x4fd823){var _0x16113c=_0x49c69d||client;return _0x16113c[_0xa26e('0x1d')](_0x34b0d4,_0x238d11)[_0xa26e('0x1e')](function(_0x268d49){logger[_0xa26e('0x1f')](_0xa26e('0x20'),_0x5725c5,'request\x20sent');logger[_0xa26e('0x21')](_0xa26e('0x22'),_0x5725c5,_0xa26e('0x23'),JSON[_0xa26e('0x24')](_0x268d49));if(_0x268d49[_0xa26e('0x25')]){if(_0x268d49['error'][_0xa26e('0x26')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x5725c5,_0x268d49[_0xa26e('0x25')][_0xa26e('0x27')]);return _0x4fd823(_0x268d49[_0xa26e('0x25')][_0xa26e('0x27')]);}logger['error'](_0xa26e('0x20'),_0x5725c5,_0x268d49['error'][_0xa26e('0x27')]);return _0x2d20c0(_0x268d49[_0xa26e('0x25')]['message']);}else{logger[_0xa26e('0x1f')](_0xa26e('0x20'),_0x5725c5,_0xa26e('0x23'));_0x2d20c0(_0x268d49[_0xa26e('0x28')]['message']);}})['catch'](function(_0x499e97){logger['error'](_0xa26e('0x20'),_0x5725c5,_0x499e97);_0x4fd823(_0x499e97);});});}function respondWithStatusCode(_0x40b3de,_0x420570){_0x420570=_0x420570||0xcc;return function(_0x14aac7){if(_0x14aac7){return _0x40b3de[_0xa26e('0x29')](_0x420570);}return _0x40b3de['status'](_0x420570)[_0xa26e('0x2a')]();};}function respondWithResult(_0x202cf5,_0x462d37){_0x462d37=_0x462d37||0xc8;return function(_0x25602f){if(_0x25602f){return _0x202cf5['status'](_0x462d37)['json'](_0x25602f);}};}function respondWithFilteredResult(_0x4ded11,_0x18c5ce){return function(_0x197838){if(_0x197838){var _0x2715fe=typeof _0x18c5ce[_0xa26e('0x2b')]===_0xa26e('0x2c')&&typeof _0x18c5ce[_0xa26e('0x2d')]===_0xa26e('0x2c');var _0x20680b=_0x197838[_0xa26e('0x2e')];var _0x1ed922=_0x2715fe?0x0:_0x18c5ce['offset'];var _0x1048ff=_0x2715fe?_0x197838[_0xa26e('0x2e')]:_0x18c5ce[_0xa26e('0x2b')]+_0x18c5ce[_0xa26e('0x2d')];var _0x2dee5b;if(_0x1048ff>=_0x20680b){_0x1048ff=_0x20680b;_0x2dee5b=0xc8;}else{_0x2dee5b=0xce;}_0x4ded11[_0xa26e('0x2f')](_0x2dee5b);return _0x4ded11[_0xa26e('0x30')](_0xa26e('0x31'),_0x1ed922+'-'+_0x1048ff+'/'+_0x20680b)[_0xa26e('0x32')](_0x197838);}return null;};}function patchUpdates(_0x26bd76){return function(_0x2fabdd){try{jsonpatch[_0xa26e('0x33')](_0x2fabdd,_0x26bd76,!![]);}catch(_0x44075d){return BPromise[_0xa26e('0x34')](_0x44075d);}return _0x2fabdd[_0xa26e('0x35')]();};}function saveUpdates(_0x190333,_0x256660){return function(_0x5d231c){if(_0x5d231c){return _0x5d231c[_0xa26e('0x36')](_0x190333)['then'](function(_0x403e67){return _0x403e67;});}return null;};}function removeEntity(_0x402454,_0x43bead){return function(_0xd2f1da){if(_0xd2f1da){return _0xd2f1da[_0xa26e('0x37')]()['then'](function(){var _0x2c5efe=_0xd2f1da['get']({'plain':!![]});var _0x1ab6ab=_0xa26e('0x38');return db[_0xa26e('0x39')][_0xa26e('0x37')]({'where':{'type':_0x1ab6ab,'resourceId':_0x2c5efe['id']}})[_0xa26e('0x1e')](function(){return _0xd2f1da;});})[_0xa26e('0x1e')](function(){_0x402454[_0xa26e('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x553a5b,_0x3f90f6){return function(_0x56095d){if(!_0x56095d){_0x553a5b[_0xa26e('0x29')](0x194);}return _0x56095d;};}function handleError(_0x11e41c,_0x29c995){_0x29c995=_0x29c995||0x1f4;return function(_0x1ef63f){logger[_0xa26e('0x25')](_0x1ef63f[_0xa26e('0x3a')]);if(_0x1ef63f['name']){delete _0x1ef63f[_0xa26e('0x3b')];}_0x11e41c[_0xa26e('0x2f')](_0x29c995)['send'](_0x1ef63f);};}exports['index']=function(_0x1e6dc1,_0xa9c847){var _0x32a65c={},_0x9295fe={},_0x35e14f={'count':0x0,'rows':[]};var _0x2c9967=_[_0xa26e('0x3c')](db[_0xa26e('0x3d')]['rawAttributes'],function(_0x3990af){return{'name':_0x3990af[_0xa26e('0x3e')],'type':_0x3990af[_0xa26e('0x3f')][_0xa26e('0x40')]};});_0x9295fe['model']=_['map'](_0x2c9967,_0xa26e('0x3b'));_0x9295fe[_0xa26e('0x41')]=_[_0xa26e('0x42')](_0x1e6dc1[_0xa26e('0x41')]);_0x9295fe['filters']=_[_0xa26e('0x43')](_0x9295fe[_0xa26e('0x44')],_0x9295fe[_0xa26e('0x41')]);_0x32a65c[_0xa26e('0x45')]=_[_0xa26e('0x43')](_0x9295fe[_0xa26e('0x44')],qs[_0xa26e('0x46')](_0x1e6dc1['query']['fields']));_0x32a65c['attributes']=_0x32a65c[_0xa26e('0x45')]['length']?_0x32a65c[_0xa26e('0x45')]:_0x9295fe['model'];if(!_0x1e6dc1[_0xa26e('0x41')]['hasOwnProperty']('nolimit')){_0x32a65c[_0xa26e('0x2d')]=qs[_0xa26e('0x2d')](_0x1e6dc1[_0xa26e('0x41')][_0xa26e('0x2d')]);_0x32a65c[_0xa26e('0x2b')]=qs[_0xa26e('0x2b')](_0x1e6dc1['query'][_0xa26e('0x2b')]);}_0x32a65c[_0xa26e('0x47')]=qs[_0xa26e('0x48')](_0x1e6dc1[_0xa26e('0x41')][_0xa26e('0x48')]);_0x32a65c[_0xa26e('0x49')]=qs['filters'](_[_0xa26e('0x4a')](_0x1e6dc1[_0xa26e('0x41')],_0x9295fe[_0xa26e('0x4b')]),_0x2c9967);if(_0x1e6dc1['query'][_0xa26e('0x4c')]){_0x32a65c['where']=_[_0xa26e('0x4d')](_0x32a65c[_0xa26e('0x49')],{'$or':_['map'](_0x2c9967,function(_0x374d5a){if(_0x374d5a[_0xa26e('0x3f')]!==_0xa26e('0x4e')){var _0xeac2dc={};_0xeac2dc[_0x374d5a[_0xa26e('0x3b')]]={'$like':'%'+_0x1e6dc1[_0xa26e('0x41')]['filter']+'%'};return _0xeac2dc;}})});}_0x32a65c=_['merge']({},_0x32a65c,_0x1e6dc1['options']);var _0x165aeb={'where':_0x32a65c['where']};return db[_0xa26e('0x3d')][_0xa26e('0x2e')](_0x165aeb)[_0xa26e('0x1e')](function(_0x354d2f){_0x35e14f[_0xa26e('0x2e')]=_0x354d2f;if(_0x1e6dc1[_0xa26e('0x41')][_0xa26e('0x4f')]){_0x32a65c[_0xa26e('0x50')]=[{'all':!![]}];}return db['ChatQueue'][_0xa26e('0x51')](_0x32a65c);})['then'](function(_0x4362b0){_0x35e14f[_0xa26e('0x52')]=_0x4362b0;return _0x35e14f;})[_0xa26e('0x1e')](respondWithFilteredResult(_0xa9c847,_0x32a65c))[_0xa26e('0x53')](handleError(_0xa9c847,null));};exports[_0xa26e('0x54')]=function(_0xbd43b8,_0x20849e){var _0x43d7d3={'raw':!![],'where':{'id':_0xbd43b8[_0xa26e('0x55')]['id']}},_0x13227c={};_0x13227c[_0xa26e('0x44')]=_[_0xa26e('0x42')](db[_0xa26e('0x3d')][_0xa26e('0x56')]);_0x13227c[_0xa26e('0x41')]=_[_0xa26e('0x42')](_0xbd43b8[_0xa26e('0x41')]);_0x13227c[_0xa26e('0x4b')]=_[_0xa26e('0x43')](_0x13227c['model'],_0x13227c[_0xa26e('0x41')]);_0x43d7d3['attributes']=_[_0xa26e('0x43')](_0x13227c['model'],qs[_0xa26e('0x46')](_0xbd43b8[_0xa26e('0x41')][_0xa26e('0x46')]));_0x43d7d3[_0xa26e('0x45')]=_0x43d7d3['attributes'][_0xa26e('0x57')]?_0x43d7d3[_0xa26e('0x45')]:_0x13227c[_0xa26e('0x44')];if(_0xbd43b8['query'][_0xa26e('0x4f')]){_0x43d7d3['include']=[{'all':!![]}];}_0x43d7d3=_[_0xa26e('0x4d')]({},_0x43d7d3,_0xbd43b8[_0xa26e('0x58')]);return db[_0xa26e('0x3d')]['find'](_0x43d7d3)[_0xa26e('0x1e')](handleEntityNotFound(_0x20849e,null))[_0xa26e('0x1e')](respondWithResult(_0x20849e,null))[_0xa26e('0x53')](handleError(_0x20849e,null));};exports['create']=function(_0x29abd1,_0x33dee7){return db[_0xa26e('0x3d')]['create'](_0x29abd1['body'],{})[_0xa26e('0x1e')](function(_0x487feb){var _0x1cd896=_0x29abd1['user']['get']({'plain':!![]});if(!_0x1cd896)throw new Error(_0xa26e('0x59'));if(_0x1cd896['role']==='user'){var _0xaa2131=_0x487feb[_0xa26e('0x5a')]({'plain':!![]});var _0x2f9294=_0xa26e('0x38');return db[_0xa26e('0x5b')][_0xa26e('0x5c')]({'where':{'name':_0x2f9294,'userProfileId':_0x1cd896[_0xa26e('0x5d')]},'raw':!![]})[_0xa26e('0x1e')](function(_0x14287f){if(_0x14287f&&_0x14287f[_0xa26e('0x5e')]===0x0){return db[_0xa26e('0x39')]['create']({'name':_0xaa2131[_0xa26e('0x3b')],'resourceId':_0xaa2131['id'],'type':_0x14287f[_0xa26e('0x3b')],'sectionId':_0x14287f['id']},{})[_0xa26e('0x1e')](function(){return _0x487feb;});}else{return _0x487feb;}})[_0xa26e('0x53')](function(_0x494e5d){logger['error'](_0xa26e('0x5f'),_0x494e5d);throw _0x494e5d;});}return _0x487feb;})[_0xa26e('0x1e')](respondWithResult(_0x33dee7,0xc9))[_0xa26e('0x53')](handleError(_0x33dee7,null));};exports[_0xa26e('0x36')]=function(_0x4e11fb,_0x130452){if(_0x4e11fb['body']['id']){delete _0x4e11fb['body']['id'];}return db[_0xa26e('0x3d')]['find']({'where':{'id':_0x4e11fb[_0xa26e('0x55')]['id']}})[_0xa26e('0x1e')](handleEntityNotFound(_0x130452,null))[_0xa26e('0x1e')](saveUpdates(_0x4e11fb[_0xa26e('0x60')],null))[_0xa26e('0x1e')](respondWithResult(_0x130452,null))[_0xa26e('0x53')](handleError(_0x130452,null));};exports[_0xa26e('0x37')]=function(_0x429eae,_0x2f490a){return db['ChatQueue']['find']({'where':{'id':_0x429eae[_0xa26e('0x55')]['id']}})[_0xa26e('0x1e')](handleEntityNotFound(_0x2f490a,null))['then'](removeEntity(_0x2f490a,null))[_0xa26e('0x53')](handleError(_0x2f490a,null));};exports[_0xa26e('0x61')]=function(_0x1465c5,_0x2adce8){return db['ChatQueue']['describe']()[_0xa26e('0x1e')](respondWithResult(_0x2adce8,null))['catch'](handleError(_0x2adce8,null));};exports[_0xa26e('0x62')]=function(_0x13ef2c,_0x41c25e,_0x2c4e01){var _0x8119b5={'raw':!![],'where':{}},_0x979bd7={},_0x1e3660;return db['ChatQueue'][_0xa26e('0x63')]({'where':{'id':_0x13ef2c['params']['id']}})[_0xa26e('0x1e')](handleEntityNotFound(_0x41c25e,null))[_0xa26e('0x1e')](function(_0x33b58f){if(_0x33b58f){_0x1e3660=_0x33b58f[_0xa26e('0x5a')]({'plain':!![]});_0x979bd7[_0xa26e('0x44')]=_['keys'](db[_0xa26e('0x64')]['rawAttributes']);_0x979bd7[_0xa26e('0x41')]=_[_0xa26e('0x42')](_0x13ef2c[_0xa26e('0x41')]);_0x979bd7[_0xa26e('0x4b')]=_[_0xa26e('0x43')](_0x979bd7['model'],_0x979bd7[_0xa26e('0x41')]);_0x8119b5[_0xa26e('0x45')]=_[_0xa26e('0x43')](_0x979bd7[_0xa26e('0x44')],qs[_0xa26e('0x46')](_0x13ef2c[_0xa26e('0x41')][_0xa26e('0x46')]));_0x8119b5['attributes']=_0x8119b5[_0xa26e('0x45')]['length']?_0x8119b5[_0xa26e('0x45')]:_0x979bd7[_0xa26e('0x44')];if(!_0x13ef2c[_0xa26e('0x41')][_0xa26e('0x65')]('nolimit')){_0x8119b5[_0xa26e('0x2d')]=qs[_0xa26e('0x2d')](_0x13ef2c[_0xa26e('0x41')][_0xa26e('0x2d')]);_0x8119b5[_0xa26e('0x2b')]=qs[_0xa26e('0x2b')](_0x13ef2c[_0xa26e('0x41')][_0xa26e('0x2b')]);}_0x8119b5['order']=qs['sort'](_0x13ef2c[_0xa26e('0x41')][_0xa26e('0x48')]);_0x8119b5['where']=qs['filters'](_[_0xa26e('0x4a')](_0x13ef2c[_0xa26e('0x41')],_0x979bd7[_0xa26e('0x4b')]));_0x8119b5[_0xa26e('0x49')]['ChatQueueId']=_0x33b58f['id'];if(_0x13ef2c[_0xa26e('0x41')]['filter']){_0x8119b5[_0xa26e('0x49')]=_[_0xa26e('0x4d')](_0x8119b5[_0xa26e('0x49')],{'$or':_['map'](_0x8119b5[_0xa26e('0x45')],function(_0x2bb6d6){var _0x17a6c1={};_0x17a6c1[_0x2bb6d6]={'$like':'%'+_0x13ef2c[_0xa26e('0x41')]['filter']+'%'};return _0x17a6c1;})});}_0x8119b5=_[_0xa26e('0x4d')]({},_0x8119b5,_0x13ef2c[_0xa26e('0x58')]);return db[_0xa26e('0x64')][_0xa26e('0x51')](_0x8119b5);}})[_0xa26e('0x1e')](function(_0x37afbd){if(_0x37afbd){return db[_0xa26e('0x66')][_0xa26e('0x67')]({'where':{'id':_[_0xa26e('0x3c')](_0x37afbd,_0xa26e('0x68')),'role':_0xa26e('0x69')},'attributes':['id',_0xa26e('0x3b'),_0xa26e('0x6a'),_0xa26e('0x6b'),_0xa26e('0x6c')]});}})['then'](function(_0x41c7d2){if(_0x41c7d2){return{'count':_0x41c7d2[_0xa26e('0x2e')],'rows':_[_0xa26e('0x3c')](_0x41c7d2[_0xa26e('0x52')],function(_0x5d6f62){return{'membername':_0x5d6f62[_0xa26e('0x3b')],'UserId':_0x5d6f62['id'],'queue_name':_0x1e3660[_0xa26e('0x3b')],'ChatQueueId':_0x1e3660['id'],'interface':util['format'](_0xa26e('0x6d'),_0xa26e('0x6e'),_0x5d6f62[_0xa26e('0x3b')]),'penalty':0x0,'paused':_0x5d6f62['chatPause'],'createdAt':_0x5d6f62[_0xa26e('0x6c')],'updatedAt':_0x5d6f62[_0xa26e('0x6b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa26e('0x1e')](respondWithFilteredResult(_0x41c25e,_0x8119b5))[_0xa26e('0x53')](handleError(_0x41c25e,null));};exports['getTeams']=function(_0x22dbdc,_0x4f2531,_0x38d4c2){var _0x333268={};var _0x401cf6={};var _0x533410;var _0x4a3e95;return db[_0xa26e('0x3d')][_0xa26e('0x63')]({'where':{'id':_0x22dbdc[_0xa26e('0x55')]['id']}})[_0xa26e('0x1e')](handleEntityNotFound(_0x4f2531,null))[_0xa26e('0x1e')](function(_0x1fde00){if(_0x1fde00){_0x533410=_0x1fde00;_0x401cf6['model']=_[_0xa26e('0x42')](db[_0xa26e('0x6f')]['rawAttributes']);_0x401cf6[_0xa26e('0x41')]=_['keys'](_0x22dbdc[_0xa26e('0x41')]);_0x401cf6[_0xa26e('0x4b')]=_[_0xa26e('0x43')](_0x401cf6['model'],_0x401cf6[_0xa26e('0x41')]);_0x333268[_0xa26e('0x45')]=_[_0xa26e('0x43')](_0x401cf6[_0xa26e('0x44')],qs[_0xa26e('0x46')](_0x22dbdc[_0xa26e('0x41')][_0xa26e('0x46')]));_0x333268[_0xa26e('0x45')]=_0x333268[_0xa26e('0x45')]['length']?_0x333268[_0xa26e('0x45')]:_0x401cf6[_0xa26e('0x44')];_0x333268['order']=qs['sort'](_0x22dbdc[_0xa26e('0x41')][_0xa26e('0x48')]);_0x333268[_0xa26e('0x49')]=qs[_0xa26e('0x4b')](_[_0xa26e('0x4a')](_0x22dbdc[_0xa26e('0x41')],_0x401cf6[_0xa26e('0x4b')]));if(_0x22dbdc[_0xa26e('0x41')][_0xa26e('0x4c')]){_0x333268[_0xa26e('0x49')]=_[_0xa26e('0x4d')](_0x333268[_0xa26e('0x49')],{'$or':_[_0xa26e('0x3c')](_0x333268[_0xa26e('0x45')],function(_0x4caf18){var _0x17db3d={};_0x17db3d[_0x4caf18]={'$like':'%'+_0x22dbdc['query'][_0xa26e('0x4c')]+'%'};return _0x17db3d;})});}_0x333268=_[_0xa26e('0x4d')]({},_0x333268,_0x22dbdc[_0xa26e('0x58')]);return _0x533410[_0xa26e('0x70')](_0x333268);}})['then'](function(_0x4e405b){if(_0x4e405b){_0x4a3e95=_0x4e405b[_0xa26e('0x57')];if(!_0x22dbdc['query'][_0xa26e('0x65')](_0xa26e('0x71'))){_0x333268[_0xa26e('0x2d')]=qs['limit'](_0x22dbdc[_0xa26e('0x41')][_0xa26e('0x2d')]);_0x333268['offset']=qs[_0xa26e('0x2b')](_0x22dbdc[_0xa26e('0x41')][_0xa26e('0x2b')]);}return _0x533410['getTeams'](_0x333268);}})[_0xa26e('0x1e')](function(_0x80d8b){if(_0x80d8b){return _0x80d8b?{'count':_0x4a3e95,'rows':_0x80d8b}:null;}})[_0xa26e('0x1e')](respondWithResult(_0x4f2531,null))[_0xa26e('0x53')](handleError(_0x4f2531,null));};exports['addTeams']=function(_0x1d0113,_0x41df62,_0x488953){var _0x3feda3=_0x1d0113[_0xa26e('0x60')][_0xa26e('0x72')];return db[_0xa26e('0x6f')][_0xa26e('0x51')]({'where':{'id':_0x3feda3},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0xa26e('0x73'),_0xa26e('0x74'),_0xa26e('0x75')],'raw':!![]}]})[_0xa26e('0x1e')](function(_0x192765){if(_0x192765){var _0x1f4cee=_[_0xa26e('0x76')](_0x192765,function(_0x4d58e7){var _0xc64cab=_0x4d58e7[_0xa26e('0x5a')]({'plain':!![]});return _0xc64cab[_0xa26e('0x77')];});return db[_0xa26e('0x3d')]['find']({'where':{'id':_0x1d0113[_0xa26e('0x55')]['id']}})['then'](function(_0x297b35){return db[_0xa26e('0x78')]['transaction'](function(_0x2d52d4){return _0x297b35[_0xa26e('0x79')](_0x3feda3,{'transaction':_0x2d52d4})[_0xa26e('0x1e')](function(){return BPromise[_0xa26e('0x7a')](_0x1f4cee,function(_0x24b51f){return db[_0xa26e('0x64')][_0xa26e('0x7b')]({'where':{'UserId':_0x24b51f['id'],'ChatQueueId':_0x1d0113[_0xa26e('0x55')]['id']},'transaction':_0x2d52d4});});})['then'](function(){_0x1f4cee['forEach'](function(_0x41aca0){socket['emit'](_0xa26e('0x7c'),{'UserId':_0x41aca0['id'],'ChatQueueId':_0x297b35['id']});});});});});}})['then'](respondWithStatusCode(_0x41df62,null))['catch'](handleError(_0x41df62,null));};exports['removeTeams']=function(_0x42548c,_0x225324,_0x1e5683){return db[_0xa26e('0x6f')][_0xa26e('0x51')]({'where':{'id':_0x42548c[_0xa26e('0x41')]['ids']},'attributes':['id'],'include':[{'model':db[_0xa26e('0x66')],'as':_0xa26e('0x77'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x225324,null))['then'](function(_0x4044a6){var _0x4f014a=_[_0xa26e('0x3c')](_0x4044a6,'id');var _0x2f2819=[];var _0x2f2b60=[];var _0x4d11b7=squel[_0xa26e('0x7d')]();_0x4d11b7[_0xa26e('0x7e')]('tq.TeamId')[_0xa26e('0x7f')](_0xa26e('0x80'),'tq')['join'](_0xa26e('0x81'),'ut',_0xa26e('0x82'))[_0xa26e('0x49')](_0xa26e('0x83'),_0x42548c[_0xa26e('0x55')]['id']);for(var _0x216623=0x0;_0x216623<_0x4044a6[_0xa26e('0x57')];_0x216623+=0x1){let _0x22b282=_0x4044a6[_0x216623];for(var _0x2803a7=0x0;_0x2803a7<_0x22b282[_0xa26e('0x77')]['length'];_0x2803a7+=0x1){let _0x1b1df2=_0x22b282['Agents'][_0x2803a7];var _0x43ce52=_0x4d11b7[_0xa26e('0x84')]();_0x43ce52[_0xa26e('0x49')](_0xa26e('0x85'),_0x1b1df2['id']);_0x2f2b60[_0xa26e('0x86')](db[_0xa26e('0x78')][_0xa26e('0x41')](_0x43ce52['toString'](),{'type':db[_0xa26e('0x78')][_0xa26e('0x87')][_0xa26e('0x88')]})['then'](function(_0x1feb6b){if(_0x1feb6b['length']===0x1){return _0x1b1df2['id'];}else{var _0x17a96d=_[_0xa26e('0x89')](_[_0xa26e('0x3c')](_0x1feb6b,_0xa26e('0x8a')),function(_0x88ed8c){return _[_0xa26e('0x8b')](_0x4f014a,_0x88ed8c);});if(_0x17a96d){return _0x1b1df2['id'];}}}));}}return BPromise[_0xa26e('0x8c')](_0x2f2b60)['then'](function(_0x31811d){_0x2f2819=_(_0x2f2819)['union'](_0x31811d)[_0xa26e('0x8d')]()[_0xa26e('0x8e')]();return db['ChatQueue'][_0xa26e('0x5c')]({'where':{'id':_0x42548c['params']['id']}})[_0xa26e('0x1e')](function(_0x1b601e){return db[_0xa26e('0x78')]['transaction'](function(_0x4863e4){return _0x1b601e[_0xa26e('0x8f')](_0x42548c[_0xa26e('0x41')][_0xa26e('0x72')],{'transaction':_0x4863e4})['then'](function(){if(!_['isEmpty'](_0x2f2819)){return _0x1b601e[_0xa26e('0x90')](_0x2f2819,{'transaction':_0x4863e4});}})[_0xa26e('0x1e')](function(){_0x2f2819['forEach'](function(_0x12754a){socket[_0xa26e('0x91')](_0xa26e('0x92'),{'UserId':_0x12754a,'ChatQueueId':_0x1b601e['id']});});});});});});})[_0xa26e('0x1e')](respondWithStatusCode(_0x225324,null))[_0xa26e('0x53')](handleError(_0x225324,null));};exports[_0xa26e('0x93')]=function(_0x4d6cf0,_0x35b31c,_0x40b345){return db[_0xa26e('0x3d')]['find']({'where':{'id':_0x4d6cf0[_0xa26e('0x55')]['id']}})['then'](handleEntityNotFound(_0x35b31c,null))[_0xa26e('0x1e')](function(_0x4e9c6c){if(_0x4e9c6c){return _0x4e9c6c[_0xa26e('0x93')](_0x4d6cf0[_0xa26e('0x60')][_0xa26e('0x72')],_['omit'](_0x4d6cf0['body'],[_0xa26e('0x72'),'id'])||{})[_0xa26e('0x94')](function(_0x167368){for(var _0x114189=0x0;_0x114189<_0x4d6cf0['body']['ids'][_0xa26e('0x57')];_0x114189+=0x1){socket[_0xa26e('0x91')](_0xa26e('0x7c'),{'UserId':Number(_0x4d6cf0[_0xa26e('0x60')][_0xa26e('0x72')][_0x114189]),'ChatQueueId':Number(_0x4d6cf0[_0xa26e('0x55')]['id'])});}return _0x167368;});}})['then'](respondWithResult(_0x35b31c,null))['catch'](handleError(_0x35b31c,null));};exports[_0xa26e('0x90')]=function(_0x1dcffb,_0x51360d,_0x2ef9b5){return db[_0xa26e('0x3d')]['find']({'where':{'id':_0x1dcffb[_0xa26e('0x55')]['id']}})[_0xa26e('0x1e')](handleEntityNotFound(_0x51360d,null))['then'](function(_0x5b1e06){if(_0x5b1e06){return _0x5b1e06[_0xa26e('0x90')](_0x1dcffb[_0xa26e('0x41')]['ids'])[_0xa26e('0x1e')](function(){if(_[_0xa26e('0x95')](_0x1dcffb[_0xa26e('0x41')][_0xa26e('0x72')])){for(var _0xc17764=0x0;_0xc17764<_0x1dcffb[_0xa26e('0x41')]['ids'][_0xa26e('0x57')];_0xc17764+=0x1){socket[_0xa26e('0x91')](_0xa26e('0x92'),{'UserId':Number(_0x1dcffb[_0xa26e('0x41')][_0xa26e('0x72')][_0xc17764]),'ChatQueueId':Number(_0x1dcffb[_0xa26e('0x55')]['id'])});}}else{socket[_0xa26e('0x91')](_0xa26e('0x92'),{'UserId':Number(_0x1dcffb[_0xa26e('0x41')][_0xa26e('0x72')]),'ChatQueueId':Number(_0x1dcffb[_0xa26e('0x55')]['id'])});}});}})[_0xa26e('0x1e')](respondWithStatusCode(_0x51360d,null))[_0xa26e('0x53')](handleError(_0x51360d,null));};exports[_0xa26e('0x96')]=function(_0x27fc6e,_0x1ab9ad,_0x42e1f8){var _0x13a8c2={};var _0x527352={};var _0x432b0f;var _0x4a5cba;return db[_0xa26e('0x3d')][_0xa26e('0x63')]({'where':{'id':_0x27fc6e[_0xa26e('0x55')]['id']}})[_0xa26e('0x1e')](handleEntityNotFound(_0x1ab9ad,null))['then'](function(_0x5a43f5){if(_0x5a43f5){_0x432b0f=_0x5a43f5;_0x527352[_0xa26e('0x44')]=_[_0xa26e('0x42')](db[_0xa26e('0x66')]['rawAttributes']);_0x527352[_0xa26e('0x41')]=_[_0xa26e('0x42')](_0x27fc6e['query']);_0x527352[_0xa26e('0x4b')]=_[_0xa26e('0x43')](_0x527352[_0xa26e('0x44')],_0x527352[_0xa26e('0x41')]);_0x13a8c2[_0xa26e('0x45')]=_[_0xa26e('0x43')](_0x527352['model'],qs[_0xa26e('0x46')](_0x27fc6e['query'][_0xa26e('0x46')]));_0x13a8c2[_0xa26e('0x45')]=_0x13a8c2[_0xa26e('0x45')][_0xa26e('0x57')]?_0x13a8c2[_0xa26e('0x45')]:_0x527352[_0xa26e('0x44')];_0x13a8c2['order']=qs[_0xa26e('0x48')](_0x27fc6e['query'][_0xa26e('0x48')]);_0x13a8c2[_0xa26e('0x49')]=qs[_0xa26e('0x4b')](_[_0xa26e('0x4a')](_0x27fc6e[_0xa26e('0x41')],_0x527352[_0xa26e('0x4b')]));if(_0x27fc6e[_0xa26e('0x41')][_0xa26e('0x4c')]){_0x13a8c2[_0xa26e('0x49')]=_[_0xa26e('0x4d')](_0x13a8c2['where'],{'$or':_[_0xa26e('0x3c')](_0x13a8c2[_0xa26e('0x45')],function(_0x59096d){var _0x43129e={};_0x43129e[_0x59096d]={'$like':'%'+_0x27fc6e[_0xa26e('0x41')][_0xa26e('0x4c')]+'%'};return _0x43129e;})});}_0x13a8c2=_['merge']({},_0x13a8c2,_0x27fc6e[_0xa26e('0x58')]);return _0x432b0f['getAgents'](_0x13a8c2);}})[_0xa26e('0x1e')](function(_0x2a8640){if(_0x2a8640){_0x4a5cba=_0x2a8640[_0xa26e('0x57')];if(!_0x27fc6e[_0xa26e('0x41')][_0xa26e('0x65')]('nolimit')){_0x13a8c2[_0xa26e('0x2d')]=qs['limit'](_0x27fc6e['query'][_0xa26e('0x2d')]);_0x13a8c2[_0xa26e('0x2b')]=qs[_0xa26e('0x2b')](_0x27fc6e[_0xa26e('0x41')][_0xa26e('0x2b')]);}return _0x432b0f[_0xa26e('0x96')](_0x13a8c2);}})[_0xa26e('0x1e')](function(_0x50a7d7){if(_0x50a7d7){return _0x50a7d7?{'count':_0x4a5cba,'rows':_0x50a7d7}:null;}})[_0xa26e('0x1e')](respondWithResult(_0x1ab9ad,null))[_0xa26e('0x53')](handleError(_0x1ab9ad,null));}; \ No newline at end of file +var _0xc790=['userChatQueue:remove','addAgents','omit','removeAgents','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','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','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','client','http','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','reject','save','update','destroy','get','ChatQueues','UserProfileResource','name','send','map','ChatQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows','params','options','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','order','ChatQueueId','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','%s/%s','SIP','getTeams','ids','Team','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','select','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','includes','union','compact','removeTeams'];(function(_0x4e5a6c,_0x493d08){var _0x6b6265=function(_0x31ebcd){while(--_0x31ebcd){_0x4e5a6c['push'](_0x4e5a6c['shift']());}};_0x6b6265(++_0x493d08);}(_0xc790,0x132));var _0x0c79=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xc790[_0xbd08b4];return _0x314f1e;};'use strict';var emlformat=require(_0x0c79('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0c79('0x1'));var jsonpatch=require(_0x0c79('0x2'));var rp=require(_0x0c79('0x3'));var moment=require(_0x0c79('0x4'));var BPromise=require(_0x0c79('0x5'));var Mustache=require(_0x0c79('0x6'));var util=require(_0x0c79('0x7'));var path=require(_0x0c79('0x8'));var sox=require('sox');var csv=require(_0x0c79('0x9'));var ejs=require(_0x0c79('0xa'));var fs=require('fs');var fs_extra=require(_0x0c79('0xb'));var _=require('lodash');var squel=require(_0x0c79('0xc'));var crypto=require('crypto');var jsforce=require(_0x0c79('0xd'));var deskjs=require(_0x0c79('0xe'));var toCsv=require(_0x0c79('0x9'));var querystring=require('querystring');var Papa=require(_0x0c79('0xf'));var Redis=require(_0x0c79('0x10'));var authService=require(_0x0c79('0x11'));var qs=require(_0x0c79('0x12'));var as=require(_0x0c79('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0c79('0x14'))(_0x0c79('0x15'));var utils=require(_0x0c79('0x16'));var config=require(_0x0c79('0x17'));var licenseUtil=require(_0x0c79('0x18'));var db=require(_0x0c79('0x19'))['db'];config[_0x0c79('0x1a')]=_[_0x0c79('0x1b')](config[_0x0c79('0x1a')],{'host':_0x0c79('0x1c'),'port':0x18eb});var socket=require(_0x0c79('0x1d'))(new Redis(config['redis']));require(_0x0c79('0x1e'))[_0x0c79('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0c79('0x20')][_0x0c79('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x2faf48,_0x1b1216,_0x311ee6,_0x39170e){return new BPromise(function(_0x3044a2,_0x5d7df8){var _0x1ec2c9=_0x39170e||client;return _0x1ec2c9['request'](_0x2faf48,_0x311ee6)[_0x0c79('0x22')](function(_0x21722b){logger[_0x0c79('0x23')](_0x0c79('0x24'),_0x1b1216,_0x0c79('0x25'));logger[_0x0c79('0x26')](_0x0c79('0x27'),_0x1b1216,'request\x20sent',JSON[_0x0c79('0x28')](_0x21722b));if(_0x21722b[_0x0c79('0x29')]){if(_0x21722b[_0x0c79('0x29')][_0x0c79('0x2a')]===0x1f4){logger[_0x0c79('0x29')]('ChatQueue,\x20%s,\x20%s',_0x1b1216,_0x21722b[_0x0c79('0x29')]['message']);return _0x5d7df8(_0x21722b[_0x0c79('0x29')][_0x0c79('0x2b')]);}logger['error'](_0x0c79('0x24'),_0x1b1216,_0x21722b[_0x0c79('0x29')][_0x0c79('0x2b')]);return _0x3044a2(_0x21722b[_0x0c79('0x29')]['message']);}else{logger['info'](_0x0c79('0x24'),_0x1b1216,_0x0c79('0x25'));_0x3044a2(_0x21722b[_0x0c79('0x2c')][_0x0c79('0x2b')]);}})[_0x0c79('0x2d')](function(_0x421e1f){logger[_0x0c79('0x29')](_0x0c79('0x24'),_0x1b1216,_0x421e1f);_0x5d7df8(_0x421e1f);});});}function respondWithStatusCode(_0x29ade4,_0x2ea61b){_0x2ea61b=_0x2ea61b||0xcc;return function(_0x46138d){if(_0x46138d){return _0x29ade4[_0x0c79('0x2e')](_0x2ea61b);}return _0x29ade4[_0x0c79('0x2f')](_0x2ea61b)[_0x0c79('0x30')]();};}function respondWithResult(_0x15e0d2,_0x4cc858){_0x4cc858=_0x4cc858||0xc8;return function(_0x143d32){if(_0x143d32){return _0x15e0d2['status'](_0x4cc858)['json'](_0x143d32);}};}function respondWithFilteredResult(_0x56ebd7,_0x1ed5c8){return function(_0x2290e2){if(_0x2290e2){var _0x3df3d4=typeof _0x1ed5c8['offset']===_0x0c79('0x31')&&typeof _0x1ed5c8[_0x0c79('0x32')]===_0x0c79('0x31');var _0x182707=_0x2290e2[_0x0c79('0x33')];var _0x23bb06=_0x3df3d4?0x0:_0x1ed5c8[_0x0c79('0x34')];var _0x47fcf3=_0x3df3d4?_0x2290e2[_0x0c79('0x33')]:_0x1ed5c8['offset']+_0x1ed5c8[_0x0c79('0x32')];var _0x1c71bd;if(_0x47fcf3>=_0x182707){_0x47fcf3=_0x182707;_0x1c71bd=0xc8;}else{_0x1c71bd=0xce;}_0x56ebd7[_0x0c79('0x2f')](_0x1c71bd);return _0x56ebd7[_0x0c79('0x35')](_0x0c79('0x36'),_0x23bb06+'-'+_0x47fcf3+'/'+_0x182707)[_0x0c79('0x37')](_0x2290e2);}return null;};}function patchUpdates(_0x96030d){return function(_0x2d91a7){try{jsonpatch['apply'](_0x2d91a7,_0x96030d,!![]);}catch(_0x5ea021){return BPromise[_0x0c79('0x38')](_0x5ea021);}return _0x2d91a7[_0x0c79('0x39')]();};}function saveUpdates(_0x564c2a,_0x346236){return function(_0x1a383a){if(_0x1a383a){return _0x1a383a[_0x0c79('0x3a')](_0x564c2a)[_0x0c79('0x22')](function(_0x1b11e8){return _0x1b11e8;});}return null;};}function removeEntity(_0x2ade96,_0x1b4050){return function(_0x57a5ef){if(_0x57a5ef){return _0x57a5ef[_0x0c79('0x3b')]()[_0x0c79('0x22')](function(){var _0x5e0318=_0x57a5ef[_0x0c79('0x3c')]({'plain':!![]});var _0x1bdddb=_0x0c79('0x3d');return db[_0x0c79('0x3e')][_0x0c79('0x3b')]({'where':{'type':_0x1bdddb,'resourceId':_0x5e0318['id']}})['then'](function(){return _0x57a5ef;});})[_0x0c79('0x22')](function(){_0x2ade96['status'](0xcc)[_0x0c79('0x30')]();});}};}function handleEntityNotFound(_0x3ad59f,_0x3361aa){return function(_0xd3fc52){if(!_0xd3fc52){_0x3ad59f[_0x0c79('0x2e')](0x194);}return _0xd3fc52;};}function handleError(_0x2cbc64,_0x130655){_0x130655=_0x130655||0x1f4;return function(_0x43c6cd){logger[_0x0c79('0x29')](_0x43c6cd['stack']);if(_0x43c6cd[_0x0c79('0x3f')]){delete _0x43c6cd[_0x0c79('0x3f')];}_0x2cbc64[_0x0c79('0x2f')](_0x130655)[_0x0c79('0x40')](_0x43c6cd);};}exports['index']=function(_0x2fc726,_0x1be219){var _0x30825c={},_0xc9d705={},_0x17e9f2={'count':0x0,'rows':[]};var _0x4ca47e=_[_0x0c79('0x41')](db[_0x0c79('0x42')][_0x0c79('0x43')],function(_0x59cf55){return{'name':_0x59cf55[_0x0c79('0x44')],'type':_0x59cf55['type'][_0x0c79('0x45')]};});_0xc9d705[_0x0c79('0x46')]=_[_0x0c79('0x41')](_0x4ca47e,_0x0c79('0x3f'));_0xc9d705[_0x0c79('0x47')]=_[_0x0c79('0x48')](_0x2fc726[_0x0c79('0x47')]);_0xc9d705[_0x0c79('0x49')]=_[_0x0c79('0x4a')](_0xc9d705['model'],_0xc9d705[_0x0c79('0x47')]);_0x30825c['attributes']=_['intersection'](_0xc9d705[_0x0c79('0x46')],qs[_0x0c79('0x4b')](_0x2fc726[_0x0c79('0x47')]['fields']));_0x30825c[_0x0c79('0x4c')]=_0x30825c['attributes'][_0x0c79('0x4d')]?_0x30825c[_0x0c79('0x4c')]:_0xc9d705['model'];if(!_0x2fc726[_0x0c79('0x47')]['hasOwnProperty'](_0x0c79('0x4e'))){_0x30825c[_0x0c79('0x32')]=qs[_0x0c79('0x32')](_0x2fc726[_0x0c79('0x47')][_0x0c79('0x32')]);_0x30825c[_0x0c79('0x34')]=qs['offset'](_0x2fc726['query'][_0x0c79('0x34')]);}_0x30825c['order']=qs[_0x0c79('0x4f')](_0x2fc726[_0x0c79('0x47')]['sort']);_0x30825c[_0x0c79('0x50')]=qs[_0x0c79('0x49')](_[_0x0c79('0x51')](_0x2fc726[_0x0c79('0x47')],_0xc9d705[_0x0c79('0x49')]),_0x4ca47e);if(_0x2fc726[_0x0c79('0x47')]['filter']){_0x30825c[_0x0c79('0x50')]=_[_0x0c79('0x52')](_0x30825c[_0x0c79('0x50')],{'$or':_[_0x0c79('0x41')](_0x4ca47e,function(_0x28bc6d){if(_0x28bc6d['type']!==_0x0c79('0x53')){var _0x43b700={};_0x43b700[_0x28bc6d[_0x0c79('0x3f')]]={'$like':'%'+_0x2fc726[_0x0c79('0x47')][_0x0c79('0x54')]+'%'};return _0x43b700;}})});}_0x30825c=_[_0x0c79('0x52')]({},_0x30825c,_0x2fc726['options']);var _0x590fcc={'where':_0x30825c[_0x0c79('0x50')]};return db['ChatQueue'][_0x0c79('0x33')](_0x590fcc)['then'](function(_0x47d554){_0x17e9f2[_0x0c79('0x33')]=_0x47d554;if(_0x2fc726[_0x0c79('0x47')]['includeAll']){_0x30825c[_0x0c79('0x55')]=[{'all':!![]}];}return db[_0x0c79('0x42')][_0x0c79('0x56')](_0x30825c);})['then'](function(_0x1e45b5){_0x17e9f2[_0x0c79('0x57')]=_0x1e45b5;return _0x17e9f2;})[_0x0c79('0x22')](respondWithFilteredResult(_0x1be219,_0x30825c))[_0x0c79('0x2d')](handleError(_0x1be219,null));};exports['show']=function(_0x345b02,_0x434e18){var _0x5a3d79={'raw':!![],'where':{'id':_0x345b02[_0x0c79('0x58')]['id']}},_0x35d64d={};_0x35d64d[_0x0c79('0x46')]=_[_0x0c79('0x48')](db[_0x0c79('0x42')][_0x0c79('0x43')]);_0x35d64d[_0x0c79('0x47')]=_[_0x0c79('0x48')](_0x345b02[_0x0c79('0x47')]);_0x35d64d['filters']=_[_0x0c79('0x4a')](_0x35d64d['model'],_0x35d64d[_0x0c79('0x47')]);_0x5a3d79[_0x0c79('0x4c')]=_['intersection'](_0x35d64d[_0x0c79('0x46')],qs[_0x0c79('0x4b')](_0x345b02[_0x0c79('0x47')][_0x0c79('0x4b')]));_0x5a3d79['attributes']=_0x5a3d79[_0x0c79('0x4c')][_0x0c79('0x4d')]?_0x5a3d79[_0x0c79('0x4c')]:_0x35d64d[_0x0c79('0x46')];if(_0x345b02[_0x0c79('0x47')]['includeAll']){_0x5a3d79[_0x0c79('0x55')]=[{'all':!![]}];}_0x5a3d79=_[_0x0c79('0x52')]({},_0x5a3d79,_0x345b02[_0x0c79('0x59')]);return db[_0x0c79('0x42')][_0x0c79('0x5a')](_0x5a3d79)['then'](handleEntityNotFound(_0x434e18,null))[_0x0c79('0x22')](respondWithResult(_0x434e18,null))[_0x0c79('0x2d')](handleError(_0x434e18,null));};exports[_0x0c79('0x5b')]=function(_0x4d918c,_0x4006a9){return db[_0x0c79('0x42')][_0x0c79('0x5b')](_0x4d918c[_0x0c79('0x5c')],{})['then'](function(_0x4fdfd7){var _0x519679=_0x4d918c['user'][_0x0c79('0x3c')]({'plain':!![]});if(!_0x519679)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x519679[_0x0c79('0x5d')]===_0x0c79('0x5e')){var _0xca1e4c=_0x4fdfd7[_0x0c79('0x3c')]({'plain':!![]});var _0x1abc92=_0x0c79('0x3d');return db[_0x0c79('0x5f')][_0x0c79('0x5a')]({'where':{'name':_0x1abc92,'userProfileId':_0x519679[_0x0c79('0x60')]},'raw':!![]})[_0x0c79('0x22')](function(_0x1d6d7a){if(_0x1d6d7a&&_0x1d6d7a[_0x0c79('0x61')]===0x0){return db['UserProfileResource']['create']({'name':_0xca1e4c[_0x0c79('0x3f')],'resourceId':_0xca1e4c['id'],'type':_0x1d6d7a[_0x0c79('0x3f')],'sectionId':_0x1d6d7a['id']},{})[_0x0c79('0x22')](function(){return _0x4fdfd7;});}else{return _0x4fdfd7;}})[_0x0c79('0x2d')](function(_0x3cb6a6){logger[_0x0c79('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3cb6a6);throw _0x3cb6a6;});}return _0x4fdfd7;})[_0x0c79('0x22')](respondWithResult(_0x4006a9,0xc9))[_0x0c79('0x2d')](handleError(_0x4006a9,null));};exports[_0x0c79('0x3a')]=function(_0x57a1e1,_0x49df07){if(_0x57a1e1['body']['id']){delete _0x57a1e1[_0x0c79('0x5c')]['id'];}return db[_0x0c79('0x42')][_0x0c79('0x5a')]({'where':{'id':_0x57a1e1[_0x0c79('0x58')]['id']}})[_0x0c79('0x22')](handleEntityNotFound(_0x49df07,null))[_0x0c79('0x22')](saveUpdates(_0x57a1e1[_0x0c79('0x5c')],null))[_0x0c79('0x22')](respondWithResult(_0x49df07,null))[_0x0c79('0x2d')](handleError(_0x49df07,null));};exports['destroy']=function(_0x3048bf,_0x46ba64){return db['ChatQueue']['find']({'where':{'id':_0x3048bf['params']['id']}})[_0x0c79('0x22')](handleEntityNotFound(_0x46ba64,null))[_0x0c79('0x22')](removeEntity(_0x46ba64,null))[_0x0c79('0x2d')](handleError(_0x46ba64,null));};exports[_0x0c79('0x62')]=function(_0x10297c,_0x3f1cad){return db['ChatQueue'][_0x0c79('0x62')]()[_0x0c79('0x22')](respondWithResult(_0x3f1cad,null))[_0x0c79('0x2d')](handleError(_0x3f1cad,null));};exports[_0x0c79('0x63')]=function(_0x1134a6,_0x5d7682,_0x483315){var _0x507de2={'raw':!![],'where':{}},_0x388604={},_0x16ac0b;return db[_0x0c79('0x42')][_0x0c79('0x64')]({'where':{'id':_0x1134a6[_0x0c79('0x58')]['id']}})[_0x0c79('0x22')](handleEntityNotFound(_0x5d7682,null))[_0x0c79('0x22')](function(_0x39439e){if(_0x39439e){_0x16ac0b=_0x39439e[_0x0c79('0x3c')]({'plain':!![]});_0x388604[_0x0c79('0x46')]=_['keys'](db[_0x0c79('0x65')][_0x0c79('0x43')]);_0x388604[_0x0c79('0x47')]=_[_0x0c79('0x48')](_0x1134a6[_0x0c79('0x47')]);_0x388604[_0x0c79('0x49')]=_['intersection'](_0x388604[_0x0c79('0x46')],_0x388604[_0x0c79('0x47')]);_0x507de2[_0x0c79('0x4c')]=_['intersection'](_0x388604['model'],qs[_0x0c79('0x4b')](_0x1134a6[_0x0c79('0x47')][_0x0c79('0x4b')]));_0x507de2[_0x0c79('0x4c')]=_0x507de2[_0x0c79('0x4c')]['length']?_0x507de2['attributes']:_0x388604[_0x0c79('0x46')];if(!_0x1134a6['query'][_0x0c79('0x66')](_0x0c79('0x4e'))){_0x507de2['limit']=qs['limit'](_0x1134a6[_0x0c79('0x47')][_0x0c79('0x32')]);_0x507de2[_0x0c79('0x34')]=qs[_0x0c79('0x34')](_0x1134a6['query']['offset']);}_0x507de2[_0x0c79('0x67')]=qs[_0x0c79('0x4f')](_0x1134a6[_0x0c79('0x47')][_0x0c79('0x4f')]);_0x507de2[_0x0c79('0x50')]=qs['filters'](_[_0x0c79('0x51')](_0x1134a6['query'],_0x388604[_0x0c79('0x49')]));_0x507de2[_0x0c79('0x50')][_0x0c79('0x68')]=_0x39439e['id'];if(_0x1134a6['query'][_0x0c79('0x54')]){_0x507de2['where']=_[_0x0c79('0x52')](_0x507de2[_0x0c79('0x50')],{'$or':_[_0x0c79('0x41')](_0x507de2[_0x0c79('0x4c')],function(_0x17519f){var _0x1b5bcb={};_0x1b5bcb[_0x17519f]={'$like':'%'+_0x1134a6[_0x0c79('0x47')][_0x0c79('0x54')]+'%'};return _0x1b5bcb;})});}_0x507de2=_[_0x0c79('0x52')]({},_0x507de2,_0x1134a6[_0x0c79('0x59')]);return db['UserChatQueue'][_0x0c79('0x56')](_0x507de2);}})[_0x0c79('0x22')](function(_0x9b128a){if(_0x9b128a){return db[_0x0c79('0x69')][_0x0c79('0x6a')]({'where':{'id':_[_0x0c79('0x41')](_0x9b128a,_0x0c79('0x6b')),'role':_0x0c79('0x6c')},'attributes':['id',_0x0c79('0x3f'),_0x0c79('0x6d'),_0x0c79('0x6e'),_0x0c79('0x6f')]});}})['then'](function(_0x2681f5){if(_0x2681f5){return{'count':_0x2681f5['count'],'rows':_[_0x0c79('0x41')](_0x2681f5['rows'],function(_0xe009ac){return{'membername':_0xe009ac[_0x0c79('0x3f')],'UserId':_0xe009ac['id'],'queue_name':_0x16ac0b[_0x0c79('0x3f')],'ChatQueueId':_0x16ac0b['id'],'interface':util['format'](_0x0c79('0x70'),_0x0c79('0x71'),_0xe009ac[_0x0c79('0x3f')]),'penalty':0x0,'paused':_0xe009ac['chatPause'],'createdAt':_0xe009ac['createdAt'],'updatedAt':_0xe009ac[_0x0c79('0x6e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0c79('0x22')](respondWithFilteredResult(_0x5d7682,_0x507de2))[_0x0c79('0x2d')](handleError(_0x5d7682,null));};exports[_0x0c79('0x72')]=function(_0x214ce2,_0x55c65f,_0x243e7c){var _0x571bee={};var _0x37f3be={};var _0x445451;var _0x58a3a2;return db[_0x0c79('0x42')]['findOne']({'where':{'id':_0x214ce2[_0x0c79('0x58')]['id']}})[_0x0c79('0x22')](handleEntityNotFound(_0x55c65f,null))[_0x0c79('0x22')](function(_0x463d0c){if(_0x463d0c){_0x445451=_0x463d0c;_0x37f3be[_0x0c79('0x46')]=_['keys'](db['Team']['rawAttributes']);_0x37f3be[_0x0c79('0x47')]=_[_0x0c79('0x48')](_0x214ce2[_0x0c79('0x47')]);_0x37f3be['filters']=_['intersection'](_0x37f3be['model'],_0x37f3be[_0x0c79('0x47')]);_0x571bee[_0x0c79('0x4c')]=_['intersection'](_0x37f3be['model'],qs[_0x0c79('0x4b')](_0x214ce2['query']['fields']));_0x571bee['attributes']=_0x571bee[_0x0c79('0x4c')]['length']?_0x571bee[_0x0c79('0x4c')]:_0x37f3be[_0x0c79('0x46')];_0x571bee[_0x0c79('0x67')]=qs[_0x0c79('0x4f')](_0x214ce2[_0x0c79('0x47')]['sort']);_0x571bee[_0x0c79('0x50')]=qs[_0x0c79('0x49')](_[_0x0c79('0x51')](_0x214ce2['query'],_0x37f3be['filters']));if(_0x214ce2['query'][_0x0c79('0x54')]){_0x571bee['where']=_[_0x0c79('0x52')](_0x571bee['where'],{'$or':_[_0x0c79('0x41')](_0x571bee['attributes'],function(_0x5b1e61){var _0x57ddf2={};_0x57ddf2[_0x5b1e61]={'$like':'%'+_0x214ce2[_0x0c79('0x47')][_0x0c79('0x54')]+'%'};return _0x57ddf2;})});}_0x571bee=_[_0x0c79('0x52')]({},_0x571bee,_0x214ce2[_0x0c79('0x59')]);return _0x445451['getTeams'](_0x571bee);}})[_0x0c79('0x22')](function(_0x10a9d1){if(_0x10a9d1){_0x58a3a2=_0x10a9d1[_0x0c79('0x4d')];if(!_0x214ce2[_0x0c79('0x47')][_0x0c79('0x66')](_0x0c79('0x4e'))){_0x571bee['limit']=qs[_0x0c79('0x32')](_0x214ce2[_0x0c79('0x47')][_0x0c79('0x32')]);_0x571bee['offset']=qs[_0x0c79('0x34')](_0x214ce2['query'][_0x0c79('0x34')]);}return _0x445451[_0x0c79('0x72')](_0x571bee);}})[_0x0c79('0x22')](function(_0x23fae0){if(_0x23fae0){return _0x23fae0?{'count':_0x58a3a2,'rows':_0x23fae0}:null;}})[_0x0c79('0x22')](respondWithResult(_0x55c65f,null))['catch'](handleError(_0x55c65f,null));};exports['addTeams']=function(_0x45dc5c,_0x1aeb92,_0x38e7e4){var _0x3a21e8=_0x45dc5c['body'][_0x0c79('0x73')];return db[_0x0c79('0x74')][_0x0c79('0x56')]({'where':{'id':_0x3a21e8},'attributes':['id'],'include':[{'model':db[_0x0c79('0x69')],'as':_0x0c79('0x75'),'attributes':['id',_0x0c79('0x3f'),_0x0c79('0x76'),'voicePause',_0x0c79('0x77')],'raw':!![]}]})['then'](function(_0x1cc1fb){if(_0x1cc1fb){var _0x4b069b=_[_0x0c79('0x78')](_0x1cc1fb,function(_0x1e2e62){var _0x5eb0fa=_0x1e2e62[_0x0c79('0x3c')]({'plain':!![]});return _0x5eb0fa[_0x0c79('0x75')];});return db[_0x0c79('0x42')][_0x0c79('0x5a')]({'where':{'id':_0x45dc5c['params']['id']}})[_0x0c79('0x22')](function(_0x3bd859){return db[_0x0c79('0x79')][_0x0c79('0x7a')](function(_0x14ab85){return _0x3bd859['addTeams'](_0x3a21e8,{'transaction':_0x14ab85})[_0x0c79('0x22')](function(){return BPromise[_0x0c79('0x7b')](_0x4b069b,function(_0x4b72d2){return db[_0x0c79('0x65')][_0x0c79('0x7c')]({'where':{'UserId':_0x4b72d2['id'],'ChatQueueId':_0x45dc5c['params']['id']},'transaction':_0x14ab85});});})['then'](function(){_0x4b069b[_0x0c79('0x7d')](function(_0x46c2f0){socket[_0x0c79('0x7e')](_0x0c79('0x7f'),{'UserId':_0x46c2f0['id'],'ChatQueueId':_0x3bd859['id']});});});});});}})[_0x0c79('0x22')](respondWithStatusCode(_0x1aeb92,null))[_0x0c79('0x2d')](handleError(_0x1aeb92,null));};exports['removeTeams']=function(_0x13307b,_0x4358b0,_0x27f30c){return db['Team'][_0x0c79('0x56')]({'where':{'id':_0x13307b[_0x0c79('0x47')][_0x0c79('0x73')]},'attributes':['id'],'include':[{'model':db[_0x0c79('0x69')],'as':_0x0c79('0x75'),'attributes':['id'],'raw':!![]}]})[_0x0c79('0x22')](handleEntityNotFound(_0x4358b0,null))[_0x0c79('0x22')](function(_0x513156){var _0x5db569=_[_0x0c79('0x41')](_0x513156,'id');var _0x336396=[];var _0x977645=[];var _0x3fee06=squel[_0x0c79('0x80')]();_0x3fee06['field'](_0x0c79('0x81'))[_0x0c79('0x82')](_0x0c79('0x83'),'tq')[_0x0c79('0x84')](_0x0c79('0x85'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0c79('0x50')](_0x0c79('0x86'),_0x13307b['params']['id']);for(var _0x1ddf0e=0x0;_0x1ddf0e<_0x513156[_0x0c79('0x4d')];_0x1ddf0e+=0x1){let _0x312cc8=_0x513156[_0x1ddf0e];for(var _0x44f28d=0x0;_0x44f28d<_0x312cc8['Agents'][_0x0c79('0x4d')];_0x44f28d+=0x1){let _0x3e00dc=_0x312cc8[_0x0c79('0x75')][_0x44f28d];var _0x161623=_0x3fee06[_0x0c79('0x87')]();_0x161623[_0x0c79('0x50')](_0x0c79('0x88'),_0x3e00dc['id']);_0x977645['push'](db[_0x0c79('0x79')][_0x0c79('0x47')](_0x161623[_0x0c79('0x89')](),{'type':db[_0x0c79('0x79')][_0x0c79('0x8a')]['SELECT']})[_0x0c79('0x22')](function(_0x511aed){if(_0x511aed[_0x0c79('0x4d')]===0x1){return _0x3e00dc['id'];}else{var _0x1b342d=_[_0x0c79('0x8b')](_[_0x0c79('0x41')](_0x511aed,'TeamId'),function(_0x1bc5fd){return _[_0x0c79('0x8c')](_0x5db569,_0x1bc5fd);});if(_0x1b342d){return _0x3e00dc['id'];}}}));}}return BPromise['all'](_0x977645)[_0x0c79('0x22')](function(_0x4b1dfc){_0x336396=_(_0x336396)[_0x0c79('0x8d')](_0x4b1dfc)[_0x0c79('0x8e')]()['value']();return db[_0x0c79('0x42')][_0x0c79('0x5a')]({'where':{'id':_0x13307b[_0x0c79('0x58')]['id']}})[_0x0c79('0x22')](function(_0x29cbef){return db['sequelize'][_0x0c79('0x7a')](function(_0x43847b){return _0x29cbef[_0x0c79('0x8f')](_0x13307b['query'][_0x0c79('0x73')],{'transaction':_0x43847b})[_0x0c79('0x22')](function(){if(!_['isEmpty'](_0x336396)){return _0x29cbef['removeAgents'](_0x336396,{'transaction':_0x43847b});}})[_0x0c79('0x22')](function(){_0x336396[_0x0c79('0x7d')](function(_0x36b8e1){socket[_0x0c79('0x7e')](_0x0c79('0x90'),{'UserId':_0x36b8e1,'ChatQueueId':_0x29cbef['id']});});});});});});})[_0x0c79('0x22')](respondWithStatusCode(_0x4358b0,null))[_0x0c79('0x2d')](handleError(_0x4358b0,null));};exports[_0x0c79('0x91')]=function(_0x151bd7,_0x24350e,_0x2b4089){return db[_0x0c79('0x42')]['find']({'where':{'id':_0x151bd7[_0x0c79('0x58')]['id']}})[_0x0c79('0x22')](handleEntityNotFound(_0x24350e,null))['then'](function(_0x43bdb1){if(_0x43bdb1){return _0x43bdb1[_0x0c79('0x91')](_0x151bd7[_0x0c79('0x5c')][_0x0c79('0x73')],_[_0x0c79('0x92')](_0x151bd7[_0x0c79('0x5c')],[_0x0c79('0x73'),'id'])||{})['spread'](function(_0x375e26){for(var _0x42a54f=0x0;_0x42a54f<_0x151bd7[_0x0c79('0x5c')][_0x0c79('0x73')][_0x0c79('0x4d')];_0x42a54f+=0x1){socket[_0x0c79('0x7e')]('userChatQueue:save',{'UserId':Number(_0x151bd7['body']['ids'][_0x42a54f]),'ChatQueueId':Number(_0x151bd7[_0x0c79('0x58')]['id'])});}return _0x375e26;});}})[_0x0c79('0x22')](respondWithResult(_0x24350e,null))[_0x0c79('0x2d')](handleError(_0x24350e,null));};exports['removeAgents']=function(_0x40fdc1,_0x13dbbc,_0x362e76){return db[_0x0c79('0x42')][_0x0c79('0x5a')]({'where':{'id':_0x40fdc1[_0x0c79('0x58')]['id']}})[_0x0c79('0x22')](handleEntityNotFound(_0x13dbbc,null))[_0x0c79('0x22')](function(_0x210495){if(_0x210495){return _0x210495[_0x0c79('0x93')](_0x40fdc1[_0x0c79('0x47')][_0x0c79('0x73')])['then'](function(){if(_[_0x0c79('0x94')](_0x40fdc1[_0x0c79('0x47')][_0x0c79('0x73')])){for(var _0x3312b4=0x0;_0x3312b4<_0x40fdc1['query'][_0x0c79('0x73')][_0x0c79('0x4d')];_0x3312b4+=0x1){socket[_0x0c79('0x7e')](_0x0c79('0x90'),{'UserId':Number(_0x40fdc1[_0x0c79('0x47')][_0x0c79('0x73')][_0x3312b4]),'ChatQueueId':Number(_0x40fdc1[_0x0c79('0x58')]['id'])});}}else{socket['emit'](_0x0c79('0x90'),{'UserId':Number(_0x40fdc1[_0x0c79('0x47')]['ids']),'ChatQueueId':Number(_0x40fdc1[_0x0c79('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x13dbbc,null))[_0x0c79('0x2d')](handleError(_0x13dbbc,null));};exports[_0x0c79('0x95')]=function(_0x469e1f,_0x2d6635,_0x4de6d4){var _0x27ea8b={};var _0x351021={};var _0x3867ca;var _0x1ddcce;return db['ChatQueue'][_0x0c79('0x64')]({'where':{'id':_0x469e1f[_0x0c79('0x58')]['id']}})['then'](handleEntityNotFound(_0x2d6635,null))[_0x0c79('0x22')](function(_0x307055){if(_0x307055){_0x3867ca=_0x307055;_0x351021[_0x0c79('0x46')]=_[_0x0c79('0x48')](db[_0x0c79('0x69')]['rawAttributes']);_0x351021[_0x0c79('0x47')]=_['keys'](_0x469e1f['query']);_0x351021[_0x0c79('0x49')]=_[_0x0c79('0x4a')](_0x351021[_0x0c79('0x46')],_0x351021['query']);_0x27ea8b[_0x0c79('0x4c')]=_['intersection'](_0x351021[_0x0c79('0x46')],qs['fields'](_0x469e1f[_0x0c79('0x47')][_0x0c79('0x4b')]));_0x27ea8b[_0x0c79('0x4c')]=_0x27ea8b[_0x0c79('0x4c')][_0x0c79('0x4d')]?_0x27ea8b[_0x0c79('0x4c')]:_0x351021['model'];_0x27ea8b[_0x0c79('0x67')]=qs[_0x0c79('0x4f')](_0x469e1f[_0x0c79('0x47')]['sort']);_0x27ea8b[_0x0c79('0x50')]=qs['filters'](_[_0x0c79('0x51')](_0x469e1f[_0x0c79('0x47')],_0x351021[_0x0c79('0x49')]));if(_0x469e1f[_0x0c79('0x47')][_0x0c79('0x54')]){_0x27ea8b[_0x0c79('0x50')]=_['merge'](_0x27ea8b[_0x0c79('0x50')],{'$or':_[_0x0c79('0x41')](_0x27ea8b[_0x0c79('0x4c')],function(_0x35be6a){var _0x2f7e0b={};_0x2f7e0b[_0x35be6a]={'$like':'%'+_0x469e1f[_0x0c79('0x47')]['filter']+'%'};return _0x2f7e0b;})});}_0x27ea8b=_[_0x0c79('0x52')]({},_0x27ea8b,_0x469e1f[_0x0c79('0x59')]);return _0x3867ca[_0x0c79('0x95')](_0x27ea8b);}})[_0x0c79('0x22')](function(_0x40a354){if(_0x40a354){_0x1ddcce=_0x40a354[_0x0c79('0x4d')];if(!_0x469e1f[_0x0c79('0x47')][_0x0c79('0x66')]('nolimit')){_0x27ea8b[_0x0c79('0x32')]=qs[_0x0c79('0x32')](_0x469e1f[_0x0c79('0x47')][_0x0c79('0x32')]);_0x27ea8b[_0x0c79('0x34')]=qs[_0x0c79('0x34')](_0x469e1f[_0x0c79('0x47')]['offset']);}return _0x3867ca[_0x0c79('0x95')](_0x27ea8b);}})[_0x0c79('0x22')](function(_0x267407){if(_0x267407){return _0x267407?{'count':_0x1ddcce,'rows':_0x267407}:null;}})[_0x0c79('0x22')](respondWithResult(_0x2d6635,null))[_0x0c79('0x2d')](handleError(_0x2d6635,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 9e2f7cf..57f476f 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 _0xfb93=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','ChatQueue'];(function(_0x2fe5b9,_0x127e48){var _0x6f874=function(_0x23f8e7){while(--_0x23f8e7){_0x2fe5b9['push'](_0x2fe5b9['shift']());}};_0x6f874(++_0x127e48);}(_0xfb93,0x115));var _0x3fb9=function(_0x4880fc,_0x407738){_0x4880fc=_0x4880fc-0x0;var _0x22d8e8=_0xfb93[_0x4880fc];return _0x22d8e8;};'use strict';var EventEmitter=require(_0x3fb9('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x3fb9('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x3fb9('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3fb9('0x3'),'afterDestroy':_0x3fb9('0x4')};function emitEvent(_0x518d74){return function(_0x4d262b,_0x43b635,_0x543591){ChatQueueEvents[_0x3fb9('0x5')](_0x518d74+':'+_0x4d262b['id'],_0x4d262b);ChatQueueEvents[_0x3fb9('0x5')](_0x518d74,_0x4d262b);_0x543591(null);};}for(var e in events){if(events[_0x3fb9('0x6')](e)){var event=events[e];ChatQueue[_0x3fb9('0x7')](e,emitEvent(event));}}module[_0x3fb9('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0xe7b5=['../../mysqldb','ChatQueue','save','update','emit','hasOwnProperty','exports'];(function(_0x9ccc17,_0x1d087c){var _0x46e989=function(_0x302510){while(--_0x302510){_0x9ccc17['push'](_0x9ccc17['shift']());}};_0x46e989(++_0x1d087c);}(_0xe7b5,0x9a));var _0x5e7b=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe7b5[_0x42cae2];return _0x5f256f;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x5e7b('0x0'))['db'][_0x5e7b('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5e7b('0x2'),'afterUpdate':_0x5e7b('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1a4d18){return function(_0x3fc96a,_0x3a3b46,_0x1a4221){ChatQueueEvents[_0x5e7b('0x4')](_0x1a4d18+':'+_0x3fc96a['id'],_0x3fc96a);ChatQueueEvents[_0x5e7b('0x4')](_0x1a4d18,_0x3fc96a);_0x1a4221(null);};}for(var e in events){if(events[_0x5e7b('0x5')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x5e7b('0x6')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index f4faa25..5ade070 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 _0xa8ae=['exports','ChatQueue','chat_queues','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes'];(function(_0x1d7853,_0x1f20c3){var _0xbdebec=function(_0x103253){while(--_0x103253){_0x1d7853['push'](_0x1d7853['shift']());}};_0xbdebec(++_0x1f20c3);}(_0xa8ae,0x7b));var _0xea8a=function(_0x7c8691,_0x582a41){_0x7c8691=_0x7c8691-0x0;var _0x2fbf11=_0xa8ae[_0x7c8691];return _0x2fbf11;};'use strict';var _=require(_0xea8a('0x0'));var util=require('util');var logger=require(_0xea8a('0x1'))(_0xea8a('0x2'));var moment=require(_0xea8a('0x3'));var BPromise=require('bluebird');var rp=require(_0xea8a('0x4'));var fs=require('fs');var path=require(_0xea8a('0x5'));var rimraf=require(_0xea8a('0x6'));var config=require(_0xea8a('0x7'));var attributes=require(_0xea8a('0x8'));module[_0xea8a('0x9')]=function(_0x400802,_0x3058d1){return _0x400802['define'](_0xea8a('0xa'),attributes,{'tableName':_0xea8a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8386=['rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x23a359,_0x11f75c){var _0x46da2d=function(_0x34e657){while(--_0x34e657){_0x23a359['push'](_0x23a359['shift']());}};_0x46da2d(++_0x11f75c);}(_0x8386,0xae));var _0x6838=function(_0x114494,_0x1ba604){_0x114494=_0x114494-0x0;var _0x392471=_0x8386[_0x114494];return _0x392471;};'use strict';var _=require(_0x6838('0x0'));var util=require(_0x6838('0x1'));var logger=require(_0x6838('0x2'))('api');var moment=require(_0x6838('0x3'));var BPromise=require('bluebird');var rp=require(_0x6838('0x4'));var fs=require('fs');var path=require(_0x6838('0x5'));var rimraf=require(_0x6838('0x6'));var config=require(_0x6838('0x7'));var attributes=require(_0x6838('0x8'));module[_0x6838('0x9')]=function(_0x4807ba,_0x3d8db7){return _0x4807ba[_0x6838('0xa')](_0x6838('0xb'),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 739ba8a..1f2aca5 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 _0xaadd=['then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','include','map','model','ShowChatQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register'];(function(_0x36c433,_0xe59e97){var _0x3e70b5=function(_0x55cd2b){while(--_0x55cd2b){_0x36c433['push'](_0x36c433['shift']());}};_0x3e70b5(++_0xe59e97);}(_0xaadd,0x19b));var _0xdaad=function(_0x3890f8,_0x1b39df){_0x3890f8=_0x3890f8-0x0;var _0x40713e=_0xaadd[_0x3890f8];return _0x40713e;};'use strict';var _=require(_0xdaad('0x0'));var util=require(_0xdaad('0x1'));var moment=require(_0xdaad('0x2'));var BPromise=require(_0xdaad('0x3'));var rs=require(_0xdaad('0x4'));var fs=require('fs');var Redis=require(_0xdaad('0x5'));var db=require(_0xdaad('0x6'))['db'];var utils=require(_0xdaad('0x7'));var logger=require('../../config/logger')(_0xdaad('0x8'));var config=require(_0xdaad('0x9'));var jayson=require(_0xdaad('0xa'));var client=jayson[_0xdaad('0xb')][_0xdaad('0xc')]({'port':0x232a});config['redis']=_[_0xdaad('0xd')](config[_0xdaad('0xe')],{'host':_0xdaad('0xf'),'port':0x18eb});var socket=require(_0xdaad('0x10'))(new Redis(config[_0xdaad('0xe')]));require(_0xdaad('0x11'))[_0xdaad('0x12')](socket);function respondWithRpcPromise(_0x271a20,_0x41c99a,_0x46131e){return new BPromise(function(_0x179758,_0x1f3716){return client['request'](_0x271a20,_0x46131e)[_0xdaad('0x13')](function(_0x48ef52){logger[_0xdaad('0x14')]('ChatQueue,\x20%s,\x20%s',_0x41c99a,_0xdaad('0x15'));logger[_0xdaad('0x16')](_0xdaad('0x17'),_0x41c99a,'request\x20sent',JSON[_0xdaad('0x18')](_0x48ef52));if(_0x48ef52[_0xdaad('0x19')]){if(_0x48ef52[_0xdaad('0x19')][_0xdaad('0x1a')]===0x1f4){logger[_0xdaad('0x19')](_0xdaad('0x1b'),_0x41c99a,_0x48ef52[_0xdaad('0x19')][_0xdaad('0x1c')]);return _0x1f3716(_0x48ef52[_0xdaad('0x19')]['message']);}logger['error'](_0xdaad('0x1b'),_0x41c99a,_0x48ef52[_0xdaad('0x19')][_0xdaad('0x1c')]);return _0x179758(_0x48ef52[_0xdaad('0x19')][_0xdaad('0x1c')]);}else{logger[_0xdaad('0x14')](_0xdaad('0x1b'),_0x41c99a,'request\x20sent');_0x179758(_0x48ef52[_0xdaad('0x1d')][_0xdaad('0x1c')]);}})[_0xdaad('0x1e')](function(_0x30dd8){logger[_0xdaad('0x19')](_0xdaad('0x1b'),_0x41c99a,_0x30dd8);_0x1f3716(_0x30dd8);});});}exports[_0xdaad('0x1f')]=function(_0x59251d){var _0x38dd3b=this;return new Promise(function(_0x4fb8dd,_0x1d68cd){return db[_0xdaad('0x20')][_0xdaad('0x21')]({'raw':_0x59251d[_0xdaad('0x22')]?_0x59251d['options'][_0xdaad('0x23')]===undefined?!![]:![]:!![],'where':_0x59251d[_0xdaad('0x22')]?_0x59251d[_0xdaad('0x22')][_0xdaad('0x24')]||null:null,'attributes':_0x59251d[_0xdaad('0x22')]?_0x59251d[_0xdaad('0x22')][_0xdaad('0x25')]||null:null,'limit':_0x59251d['options']?_0x59251d[_0xdaad('0x22')]['limit']||null:null,'include':_0x59251d['options']?_0x59251d[_0xdaad('0x22')][_0xdaad('0x26')]?_[_0xdaad('0x27')](_0x59251d['options'][_0xdaad('0x26')],function(_0x3b265a){return{'model':db[_0x3b265a[_0xdaad('0x28')]],'as':_0x3b265a['as'],'attributes':_0x3b265a[_0xdaad('0x25')],'include':_0x3b265a[_0xdaad('0x26')]?_[_0xdaad('0x27')](_0x3b265a[_0xdaad('0x26')],function(_0x8b8d82){return{'model':db[_0x8b8d82[_0xdaad('0x28')]],'as':_0x8b8d82['as'],'attributes':_0x8b8d82[_0xdaad('0x25')],'include':_0x8b8d82['include']?_['map'](_0x8b8d82[_0xdaad('0x26')],function(_0x13ae73){return{'model':db[_0x13ae73[_0xdaad('0x28')]],'as':_0x13ae73['as'],'attributes':_0x13ae73['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ab040){logger['info'](_0xdaad('0x1f'),_0x59251d);logger['debug'](_0xdaad('0x1f'),_0x59251d,JSON[_0xdaad('0x18')](_0x2ab040));_0x4fb8dd(_0x2ab040);})[_0xdaad('0x1e')](function(_0x5cb67f){logger[_0xdaad('0x19')](_0xdaad('0x1f'),_0x5cb67f[_0xdaad('0x1c')],_0x59251d);_0x1d68cd(_0x38dd3b[_0xdaad('0x19')](0x1f4,_0x5cb67f[_0xdaad('0x1c')]));});});};exports[_0xdaad('0x29')]=function(_0xfa28a){var _0x5865f3=this;return new Promise(function(_0x447d95,_0x69f297){return db[_0xdaad('0x20')][_0xdaad('0x2a')]({'raw':_0xfa28a['options']?_0xfa28a[_0xdaad('0x22')][_0xdaad('0x23')]===undefined?!![]:![]:!![],'where':_0xfa28a[_0xdaad('0x22')]?_0xfa28a['options'][_0xdaad('0x24')]||null:null,'attributes':_0xfa28a[_0xdaad('0x22')]?_0xfa28a['options'][_0xdaad('0x25')]||null:null,'include':_0xfa28a[_0xdaad('0x22')]?_0xfa28a[_0xdaad('0x22')][_0xdaad('0x26')]?_['map'](_0xfa28a[_0xdaad('0x22')][_0xdaad('0x26')],function(_0x2db89d){return{'model':db[_0x2db89d[_0xdaad('0x28')]],'as':_0x2db89d['as'],'attributes':_0x2db89d[_0xdaad('0x25')],'include':_0x2db89d[_0xdaad('0x26')]?_[_0xdaad('0x27')](_0x2db89d[_0xdaad('0x26')],function(_0x118b71){return{'model':db[_0x118b71[_0xdaad('0x28')]],'as':_0x118b71['as'],'attributes':_0x118b71['attributes'],'include':_0x118b71[_0xdaad('0x26')]?_[_0xdaad('0x27')](_0x118b71[_0xdaad('0x26')],function(_0x47221d){return{'model':db[_0x47221d[_0xdaad('0x28')]],'as':_0x47221d['as'],'attributes':_0x47221d['attributes']};}):[]};}):[]};}):[]:[]})[_0xdaad('0x13')](function(_0x149caf){logger[_0xdaad('0x14')](_0xdaad('0x29'),_0xfa28a);logger[_0xdaad('0x16')]('ShowChatQueue',_0xfa28a,JSON[_0xdaad('0x18')](_0x149caf));_0x447d95(_0x149caf);})[_0xdaad('0x1e')](function(_0x2e340e){logger[_0xdaad('0x19')](_0xdaad('0x29'),_0x2e340e[_0xdaad('0x1c')],_0xfa28a);_0x69f297(_0x5865f3['error'](0x1f4,_0x2e340e[_0xdaad('0x1c')]));});});}; \ No newline at end of file +var _0xa962=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./chatQueue.socket','request','then','info','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','code','ChatQueue,\x20%s,\x20%s','error','message','catch','GetChatQueue','ChatQueue','raw','options','where','limit','include','map','model','attributes','ShowChatQueue','find','debug'];(function(_0x25e201,_0x3b9fa6){var _0x34a81e=function(_0x5174a6){while(--_0x5174a6){_0x25e201['push'](_0x25e201['shift']());}};_0x34a81e(++_0x3b9fa6);}(_0xa962,0xea));var _0x2a96=function(_0x2bd8c1,_0x597e60){_0x2bd8c1=_0x2bd8c1-0x0;var _0x453eb2=_0xa962[_0x2bd8c1];return _0x453eb2;};'use strict';var _=require(_0x2a96('0x0'));var util=require(_0x2a96('0x1'));var moment=require('moment');var BPromise=require(_0x2a96('0x2'));var rs=require(_0x2a96('0x3'));var fs=require('fs');var Redis=require(_0x2a96('0x4'));var db=require(_0x2a96('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2a96('0x6'))(_0x2a96('0x7'));var config=require(_0x2a96('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2a96('0x9')][_0x2a96('0xa')]({'port':0x232a});config[_0x2a96('0xb')]=_[_0x2a96('0xc')](config[_0x2a96('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x2a96('0xd'))(new Redis(config[_0x2a96('0xb')]));require(_0x2a96('0xe'))['register'](socket);function respondWithRpcPromise(_0xc20916,_0x575e85,_0x3935b2){return new BPromise(function(_0x4e2d4b,_0x514730){return client[_0x2a96('0xf')](_0xc20916,_0x3935b2)[_0x2a96('0x10')](function(_0x5a6203){logger[_0x2a96('0x11')]('ChatQueue,\x20%s,\x20%s',_0x575e85,_0x2a96('0x12'));logger['debug'](_0x2a96('0x13'),_0x575e85,_0x2a96('0x12'),JSON[_0x2a96('0x14')](_0x5a6203));if(_0x5a6203['error']){if(_0x5a6203['error'][_0x2a96('0x15')]===0x1f4){logger['error'](_0x2a96('0x16'),_0x575e85,_0x5a6203[_0x2a96('0x17')]['message']);return _0x514730(_0x5a6203['error'][_0x2a96('0x18')]);}logger['error'](_0x2a96('0x16'),_0x575e85,_0x5a6203[_0x2a96('0x17')]['message']);return _0x4e2d4b(_0x5a6203[_0x2a96('0x17')][_0x2a96('0x18')]);}else{logger[_0x2a96('0x11')](_0x2a96('0x16'),_0x575e85,_0x2a96('0x12'));_0x4e2d4b(_0x5a6203['result']['message']);}})[_0x2a96('0x19')](function(_0x356ae4){logger[_0x2a96('0x17')]('ChatQueue,\x20%s,\x20%s',_0x575e85,_0x356ae4);_0x514730(_0x356ae4);});});}exports[_0x2a96('0x1a')]=function(_0x24c47f){var _0xf727de=this;return new Promise(function(_0x433bea,_0x230d6b){return db[_0x2a96('0x1b')]['findAll']({'raw':_0x24c47f['options']?_0x24c47f['options'][_0x2a96('0x1c')]===undefined?!![]:![]:!![],'where':_0x24c47f['options']?_0x24c47f[_0x2a96('0x1d')][_0x2a96('0x1e')]||null:null,'attributes':_0x24c47f[_0x2a96('0x1d')]?_0x24c47f[_0x2a96('0x1d')]['attributes']||null:null,'limit':_0x24c47f['options']?_0x24c47f[_0x2a96('0x1d')][_0x2a96('0x1f')]||null:null,'include':_0x24c47f[_0x2a96('0x1d')]?_0x24c47f[_0x2a96('0x1d')][_0x2a96('0x20')]?_[_0x2a96('0x21')](_0x24c47f['options'][_0x2a96('0x20')],function(_0x17c42d){return{'model':db[_0x17c42d[_0x2a96('0x22')]],'as':_0x17c42d['as'],'attributes':_0x17c42d[_0x2a96('0x23')],'include':_0x17c42d[_0x2a96('0x20')]?_['map'](_0x17c42d[_0x2a96('0x20')],function(_0x12c322){return{'model':db[_0x12c322['model']],'as':_0x12c322['as'],'attributes':_0x12c322['attributes'],'include':_0x12c322[_0x2a96('0x20')]?_['map'](_0x12c322['include'],function(_0x4b4d00){return{'model':db[_0x4b4d00[_0x2a96('0x22')]],'as':_0x4b4d00['as'],'attributes':_0x4b4d00[_0x2a96('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x94b4a8){logger[_0x2a96('0x11')]('GetChatQueue',_0x24c47f);logger['debug'](_0x2a96('0x1a'),_0x24c47f,JSON[_0x2a96('0x14')](_0x94b4a8));_0x433bea(_0x94b4a8);})[_0x2a96('0x19')](function(_0xb9c981){logger[_0x2a96('0x17')](_0x2a96('0x1a'),_0xb9c981[_0x2a96('0x18')],_0x24c47f);_0x230d6b(_0xf727de[_0x2a96('0x17')](0x1f4,_0xb9c981['message']));});});};exports[_0x2a96('0x24')]=function(_0x514a55){var _0x3c8d61=this;return new Promise(function(_0xa46487,_0x30f210){return db[_0x2a96('0x1b')][_0x2a96('0x25')]({'raw':_0x514a55[_0x2a96('0x1d')]?_0x514a55[_0x2a96('0x1d')][_0x2a96('0x1c')]===undefined?!![]:![]:!![],'where':_0x514a55[_0x2a96('0x1d')]?_0x514a55[_0x2a96('0x1d')]['where']||null:null,'attributes':_0x514a55['options']?_0x514a55[_0x2a96('0x1d')][_0x2a96('0x23')]||null:null,'include':_0x514a55[_0x2a96('0x1d')]?_0x514a55[_0x2a96('0x1d')][_0x2a96('0x20')]?_[_0x2a96('0x21')](_0x514a55[_0x2a96('0x1d')][_0x2a96('0x20')],function(_0x45e656){return{'model':db[_0x45e656[_0x2a96('0x22')]],'as':_0x45e656['as'],'attributes':_0x45e656[_0x2a96('0x23')],'include':_0x45e656[_0x2a96('0x20')]?_[_0x2a96('0x21')](_0x45e656['include'],function(_0x53820e){return{'model':db[_0x53820e['model']],'as':_0x53820e['as'],'attributes':_0x53820e['attributes'],'include':_0x53820e[_0x2a96('0x20')]?_[_0x2a96('0x21')](_0x53820e[_0x2a96('0x20')],function(_0x37bb63){return{'model':db[_0x37bb63[_0x2a96('0x22')]],'as':_0x37bb63['as'],'attributes':_0x37bb63['attributes']};}):[]};}):[]};}):[]:[]})[_0x2a96('0x10')](function(_0x4fb6b6){logger[_0x2a96('0x11')](_0x2a96('0x24'),_0x514a55);logger[_0x2a96('0x26')](_0x2a96('0x24'),_0x514a55,JSON[_0x2a96('0x14')](_0x4fb6b6));_0xa46487(_0x4fb6b6);})[_0x2a96('0x19')](function(_0x42ed22){logger[_0x2a96('0x17')](_0x2a96('0x24'),_0x42ed22[_0x2a96('0x18')],_0x514a55);_0x30f210(_0x3c8d61[_0x2a96('0x17')](0x1f4,_0x42ed22[_0x2a96('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 0dc0b55..db3f523 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 _0x4d9e=['removeListener','register','length','chatQueue:','./chatQueue.events','update','emit'];(function(_0x4b47c7,_0x316b2c){var _0xad1ad=function(_0xe48e88){while(--_0xe48e88){_0x4b47c7['push'](_0x4b47c7['shift']());}};_0xad1ad(++_0x316b2c);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x3b94f6,_0x5be699){_0x3b94f6=_0x3b94f6-0x0;var _0xced00c=_0x4d9e[_0x3b94f6];return _0xced00c;};'use strict';var ChatQueueEvents=require(_0xe4d9('0x0'));var events=['save','remove',_0xe4d9('0x1')];function createListener(_0x574c1d,_0x36adac){return function(_0x4d7687){_0x36adac[_0xe4d9('0x2')](_0x574c1d,_0x4d7687);};}function removeListener(_0x2deaef,_0x47a09f){return function(){ChatQueueEvents[_0xe4d9('0x3')](_0x2deaef,_0x47a09f);};}exports[_0xe4d9('0x4')]=function(_0x278035){for(var _0x34c2a2=0x0,_0x125dbc=events[_0xe4d9('0x5')];_0x34c2a2<_0x125dbc;_0x34c2a2++){var _0x54a63a=events[_0x34c2a2];var _0x36316f=createListener(_0xe4d9('0x6')+_0x54a63a,_0x278035);ChatQueueEvents['on'](_0x54a63a,_0x36316f);}}; \ No newline at end of file +var _0xc874=['emit','removeListener','register','length','./chatQueue.events','remove','update'];(function(_0xfb2d7d,_0x48e158){var _0xa96c79=function(_0x3f61d2){while(--_0x3f61d2){_0xfb2d7d['push'](_0xfb2d7d['shift']());}};_0xa96c79(++_0x48e158);}(_0xc874,0x154));var _0x4c87=function(_0x13b392,_0x3481f2){_0x13b392=_0x13b392-0x0;var _0x39db24=_0xc874[_0x13b392];return _0x39db24;};'use strict';var ChatQueueEvents=require(_0x4c87('0x0'));var events=['save',_0x4c87('0x1'),_0x4c87('0x2')];function createListener(_0x505440,_0x5e6d61){return function(_0xfc1b9f){_0x5e6d61[_0x4c87('0x3')](_0x505440,_0xfc1b9f);};}function removeListener(_0x1c3dbc,_0x575a7c){return function(){ChatQueueEvents[_0x4c87('0x4')](_0x1c3dbc,_0x575a7c);};}exports[_0x4c87('0x5')]=function(_0x5d63ae){for(var _0x46e0f5=0x0,_0x3dafe0=events[_0x4c87('0x6')];_0x46e0f5<_0x3dafe0;_0x46e0f5++){var _0xdc4a29=events[_0x46e0f5];var _0x116649=createListener('chatQueue:'+_0xdc4a29,_0x5d63ae);ChatQueueEvents['on'](_0xdc4a29,_0x116649);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 62427be..9b8db6a 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 _0x814b=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x13eae1,_0x34693e){var _0x26cf2c=function(_0x2937c4){while(--_0x2937c4){_0x13eae1['push'](_0x13eae1['shift']());}};_0x26cf2c(++_0x34693e);}(_0x814b,0x1a2));var _0xb814=function(_0x55f549,_0x4f90ac){_0x55f549=_0x55f549-0x0;var _0x589a78=_0x814b[_0x55f549];return _0x589a78;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0x16')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0x16')](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x18')]);router[_0xb814('0x16')](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x19')]);router[_0xb814('0x1a')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller['destroy']);router[_0xb814('0x1c')]('/:id/teams',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xb814('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4d82ea,_0x4d459f){_0x4d82ea=_0x4d82ea-0x0;var _0x257f4a=_0x5fc3[_0x4d82ea];return _0x257f4a;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 3315793..26eb69b 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 _0xe799=['moment','exports','STRING','DATE'];(function(_0x4e027c,_0x8ba375){var _0x3a86b9=function(_0x46924){while(--_0x46924){_0x4e027c['push'](_0x4e027c['shift']());}};_0x3a86b9(++_0x8ba375);}(_0xe799,0x170));var _0x9e79=function(_0x407215,_0x1fa6bd){_0x407215=_0x407215-0x0;var _0x49289c=_0xe799[_0x407215];return _0x49289c;};'use strict';var moment=require(_0x9e79('0x0'));var Sequelize=require('sequelize');module[_0x9e79('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x9e79('0x2')]},'joinAt':{'type':Sequelize[_0x9e79('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x9e79('0x3')]},'exitAt':{'type':Sequelize[_0x9e79('0x3')]},'reason':{'type':Sequelize[_0x9e79('0x2')]}}; \ No newline at end of file +var _0x8485=['moment','exports','STRING','DATE'];(function(_0x12fb36,_0x2285e9){var _0x37952d=function(_0xb5fe2d){while(--_0xb5fe2d){_0x12fb36['push'](_0x12fb36['shift']());}};_0x37952d(++_0x2285e9);}(_0x8485,0x88));var _0x5848=function(_0x181f29,_0x14b975){_0x181f29=_0x181f29-0x0;var _0x120a5f=_0x8485[_0x181f29];return _0x120a5f;};'use strict';var moment=require(_0x5848('0x0'));var Sequelize=require('sequelize');module[_0x5848('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x5848('0x2')]},'joinAt':{'type':Sequelize[_0x5848('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x5848('0x3')]},'reason':{'type':Sequelize[_0x5848('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index f7028fc..b61e6b9 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 _0x7524=['../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','find','catch','create','body','describe','rimraf','zip-dir','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x7524,0xce));var _0x4752=function(_0x41534c,_0x56359f){_0x41534c=_0x41534c-0x0;var _0x4e059b=_0x7524[_0x41534c];return _0x4e059b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4752('0x0'));var zipdir=require(_0x4752('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4752('0x2'));var moment=require(_0x4752('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4752('0x4'));var path=require('path');var sox=require(_0x4752('0x5'));var csv=require(_0x4752('0x6'));var ejs=require(_0x4752('0x7'));var fs=require('fs');var fs_extra=require(_0x4752('0x8'));var _=require(_0x4752('0x9'));var squel=require('squel');var crypto=require(_0x4752('0xa'));var jsforce=require(_0x4752('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4752('0xc'));var Papa=require(_0x4752('0xd'));var Redis=require(_0x4752('0xe'));var authService=require(_0x4752('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4752('0x10'));var hardwareService=require(_0x4752('0x11'));var logger=require(_0x4752('0x12'))(_0x4752('0x13'));var utils=require(_0x4752('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4752('0x15'));var db=require(_0x4752('0x16'))['db'];function respondWithStatusCode(_0x404e5a,_0x2724dd){_0x2724dd=_0x2724dd||0xcc;return function(_0xe6023b){if(_0xe6023b){return _0x404e5a[_0x4752('0x17')](_0x2724dd);}return _0x404e5a[_0x4752('0x18')](_0x2724dd)['end']();};}function respondWithResult(_0xefacbb,_0x479a02){_0x479a02=_0x479a02||0xc8;return function(_0x38e6bb){if(_0x38e6bb){return _0xefacbb[_0x4752('0x18')](_0x479a02)[_0x4752('0x19')](_0x38e6bb);}};}function respondWithFilteredResult(_0x17a8b8,_0x2e53e4){return function(_0x33131a){if(_0x33131a){var _0x410f88=typeof _0x2e53e4['offset']===_0x4752('0x1a')&&typeof _0x2e53e4[_0x4752('0x1b')]==='undefined';var _0x2b80b7=_0x33131a['count'];var _0x1429f4=_0x410f88?0x0:_0x2e53e4[_0x4752('0x1c')];var _0x516f3e=_0x410f88?_0x33131a[_0x4752('0x1d')]:_0x2e53e4['offset']+_0x2e53e4['limit'];var _0x285688;if(_0x516f3e>=_0x2b80b7){_0x516f3e=_0x2b80b7;_0x285688=0xc8;}else{_0x285688=0xce;}_0x17a8b8[_0x4752('0x18')](_0x285688);return _0x17a8b8[_0x4752('0x1e')](_0x4752('0x1f'),_0x1429f4+'-'+_0x516f3e+'/'+_0x2b80b7)[_0x4752('0x19')](_0x33131a);}return null;};}function patchUpdates(_0x3142b){return function(_0x55c67c){try{jsonpatch[_0x4752('0x20')](_0x55c67c,_0x3142b,!![]);}catch(_0x2d2f9e){return BPromise[_0x4752('0x21')](_0x2d2f9e);}return _0x55c67c[_0x4752('0x22')]();};}function saveUpdates(_0x3facf5,_0xaa95a4){return function(_0x593c2d){if(_0x593c2d){return _0x593c2d[_0x4752('0x23')](_0x3facf5)[_0x4752('0x24')](function(_0x54a0bd){return _0x54a0bd;});}return null;};}function removeEntity(_0x11725c,_0x403005){return function(_0x1e4e86){if(_0x1e4e86){return _0x1e4e86[_0x4752('0x25')]()[_0x4752('0x24')](function(){_0x11725c[_0x4752('0x18')](0xcc)[_0x4752('0x26')]();});}};}function handleEntityNotFound(_0x45c557,_0xca8dd1){return function(_0x2c259a){if(!_0x2c259a){_0x45c557['sendStatus'](0x194);}return _0x2c259a;};}function handleError(_0x113cd5,_0x560df8){_0x560df8=_0x560df8||0x1f4;return function(_0x4b2635){logger['error'](_0x4b2635[_0x4752('0x27')]);if(_0x4b2635[_0x4752('0x28')]){delete _0x4b2635[_0x4752('0x28')];}_0x113cd5[_0x4752('0x18')](_0x560df8)[_0x4752('0x29')](_0x4b2635);};}exports[_0x4752('0x2a')]=function(_0xd27309,_0x1dbba0){var _0x486c11={},_0x5745c0={},_0x2e0811={'count':0x0,'rows':[]};var _0x2c3d6d=_[_0x4752('0x2b')](db[_0x4752('0x2c')][_0x4752('0x2d')],function(_0xf8c5f9){return{'name':_0xf8c5f9[_0x4752('0x2e')],'type':_0xf8c5f9[_0x4752('0x2f')][_0x4752('0x30')]};});_0x5745c0[_0x4752('0x31')]=_[_0x4752('0x2b')](_0x2c3d6d,_0x4752('0x28'));_0x5745c0[_0x4752('0x32')]=_[_0x4752('0x33')](_0xd27309[_0x4752('0x32')]);_0x5745c0[_0x4752('0x34')]=_['intersection'](_0x5745c0['model'],_0x5745c0[_0x4752('0x32')]);_0x486c11[_0x4752('0x35')]=_[_0x4752('0x36')](_0x5745c0[_0x4752('0x31')],qs[_0x4752('0x37')](_0xd27309[_0x4752('0x32')][_0x4752('0x37')]));_0x486c11[_0x4752('0x35')]=_0x486c11[_0x4752('0x35')][_0x4752('0x38')]?_0x486c11['attributes']:_0x5745c0[_0x4752('0x31')];if(!_0xd27309['query'][_0x4752('0x39')](_0x4752('0x3a'))){_0x486c11[_0x4752('0x1b')]=qs[_0x4752('0x1b')](_0xd27309[_0x4752('0x32')]['limit']);_0x486c11[_0x4752('0x1c')]=qs['offset'](_0xd27309[_0x4752('0x32')][_0x4752('0x1c')]);}_0x486c11[_0x4752('0x3b')]=qs[_0x4752('0x3c')](_0xd27309[_0x4752('0x32')][_0x4752('0x3c')]);_0x486c11[_0x4752('0x3d')]=qs[_0x4752('0x34')](_[_0x4752('0x3e')](_0xd27309[_0x4752('0x32')],_0x5745c0['filters']),_0x2c3d6d);if(_0xd27309[_0x4752('0x32')][_0x4752('0x3f')]){_0x486c11[_0x4752('0x3d')]=_[_0x4752('0x40')](_0x486c11[_0x4752('0x3d')],{'$or':_[_0x4752('0x2b')](_0x2c3d6d,function(_0x317547){if(_0x317547[_0x4752('0x2f')]!=='VIRTUAL'){var _0x2f6928={};_0x2f6928[_0x317547['name']]={'$like':'%'+_0xd27309[_0x4752('0x32')][_0x4752('0x3f')]+'%'};return _0x2f6928;}})});}_0x486c11=_[_0x4752('0x40')]({},_0x486c11,_0xd27309[_0x4752('0x41')]);var _0x5e32c4={'where':_0x486c11['where']};return db['ChatQueueReport']['count'](_0x5e32c4)[_0x4752('0x24')](function(_0x81303e){_0x2e0811['count']=_0x81303e;if(_0xd27309[_0x4752('0x32')][_0x4752('0x42')]){_0x486c11[_0x4752('0x43')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x4752('0x44')](_0x486c11);})[_0x4752('0x24')](function(_0x1ad9d2){_0x2e0811[_0x4752('0x45')]=_0x1ad9d2;return _0x2e0811;})[_0x4752('0x24')](respondWithFilteredResult(_0x1dbba0,_0x486c11))['catch'](handleError(_0x1dbba0,null));};exports['show']=function(_0x3fdbff,_0x31cef5){var _0x828534={'raw':!![],'where':{'id':_0x3fdbff[_0x4752('0x46')]['id']}},_0x222f82={};_0x222f82[_0x4752('0x31')]=_[_0x4752('0x33')](db[_0x4752('0x2c')][_0x4752('0x2d')]);_0x222f82[_0x4752('0x32')]=_[_0x4752('0x33')](_0x3fdbff[_0x4752('0x32')]);_0x222f82['filters']=_[_0x4752('0x36')](_0x222f82['model'],_0x222f82[_0x4752('0x32')]);_0x828534[_0x4752('0x35')]=_['intersection'](_0x222f82[_0x4752('0x31')],qs[_0x4752('0x37')](_0x3fdbff[_0x4752('0x32')][_0x4752('0x37')]));_0x828534[_0x4752('0x35')]=_0x828534[_0x4752('0x35')]['length']?_0x828534[_0x4752('0x35')]:_0x222f82[_0x4752('0x31')];if(_0x3fdbff[_0x4752('0x32')][_0x4752('0x42')]){_0x828534[_0x4752('0x43')]=[{'all':!![]}];}_0x828534=_[_0x4752('0x40')]({},_0x828534,_0x3fdbff['options']);return db[_0x4752('0x2c')][_0x4752('0x47')](_0x828534)[_0x4752('0x24')](handleEntityNotFound(_0x31cef5,null))[_0x4752('0x24')](respondWithResult(_0x31cef5,null))[_0x4752('0x48')](handleError(_0x31cef5,null));};exports[_0x4752('0x49')]=function(_0x47d096,_0x335912){return db['ChatQueueReport']['create'](_0x47d096[_0x4752('0x4a')],{})[_0x4752('0x24')](respondWithResult(_0x335912,0xc9))[_0x4752('0x48')](handleError(_0x335912,null));};exports['update']=function(_0x1a92c6,_0x1ebb03){if(_0x1a92c6['body']['id']){delete _0x1a92c6[_0x4752('0x4a')]['id'];}return db[_0x4752('0x2c')][_0x4752('0x47')]({'where':{'id':_0x1a92c6['params']['id']}})[_0x4752('0x24')](handleEntityNotFound(_0x1ebb03,null))[_0x4752('0x24')](saveUpdates(_0x1a92c6[_0x4752('0x4a')],null))[_0x4752('0x24')](respondWithResult(_0x1ebb03,null))[_0x4752('0x48')](handleError(_0x1ebb03,null));};exports[_0x4752('0x25')]=function(_0x54389f,_0x3b7db0){return db['ChatQueueReport'][_0x4752('0x47')]({'where':{'id':_0x54389f[_0x4752('0x46')]['id']}})['then'](handleEntityNotFound(_0x3b7db0,null))['then'](removeEntity(_0x3b7db0,null))['catch'](handleError(_0x3b7db0,null));};exports['describe']=function(_0x4cf5ac,_0x3ebf27){return db[_0x4752('0x2c')][_0x4752('0x4b')]()[_0x4752('0x24')](respondWithResult(_0x3ebf27,null))['catch'](handleError(_0x3ebf27,null));}; \ No newline at end of file +var _0xfd2e=['end','error','stack','name','send','map','ChatQueueReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','rawAttributes','find','create','body','params','describe','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','fs-extra','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy'];(function(_0x53e1db,_0x1cf8d5){var _0x244501=function(_0x534aa3){while(--_0x534aa3){_0x53e1db['push'](_0x53e1db['shift']());}};_0x244501(++_0x1cf8d5);}(_0xfd2e,0x6e));var _0xefd2=function(_0x4548f9,_0x44ac14){_0x4548f9=_0x4548f9-0x0;var _0x4cc044=_0xfd2e[_0x4548f9];return _0x4cc044;};'use strict';var emlformat=require(_0xefd2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xefd2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xefd2('0x2'));var moment=require('moment');var BPromise=require(_0xefd2('0x3'));var Mustache=require(_0xefd2('0x4'));var util=require(_0xefd2('0x5'));var path=require(_0xefd2('0x6'));var sox=require(_0xefd2('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xefd2('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xefd2('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xefd2('0xa'));var toCsv=require(_0xefd2('0xb'));var querystring=require(_0xefd2('0xc'));var Papa=require(_0xefd2('0xd'));var Redis=require(_0xefd2('0xe'));var authService=require(_0xefd2('0xf'));var qs=require(_0xefd2('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xefd2('0x11'));var logger=require(_0xefd2('0x12'))(_0xefd2('0x13'));var utils=require(_0xefd2('0x14'));var config=require(_0xefd2('0x15'));var licenseUtil=require(_0xefd2('0x16'));var db=require(_0xefd2('0x17'))['db'];function respondWithStatusCode(_0x2f1472,_0x53d09b){_0x53d09b=_0x53d09b||0xcc;return function(_0x5b6df5){if(_0x5b6df5){return _0x2f1472[_0xefd2('0x18')](_0x53d09b);}return _0x2f1472['status'](_0x53d09b)['end']();};}function respondWithResult(_0x87493c,_0x2b4d24){_0x2b4d24=_0x2b4d24||0xc8;return function(_0x1150ec){if(_0x1150ec){return _0x87493c[_0xefd2('0x19')](_0x2b4d24)[_0xefd2('0x1a')](_0x1150ec);}};}function respondWithFilteredResult(_0x518354,_0x1a35b7){return function(_0x20192b){if(_0x20192b){var _0x2e706a=typeof _0x1a35b7[_0xefd2('0x1b')]===_0xefd2('0x1c')&&typeof _0x1a35b7[_0xefd2('0x1d')]==='undefined';var _0x48ef07=_0x20192b[_0xefd2('0x1e')];var _0x111d7b=_0x2e706a?0x0:_0x1a35b7[_0xefd2('0x1b')];var _0x471175=_0x2e706a?_0x20192b[_0xefd2('0x1e')]:_0x1a35b7['offset']+_0x1a35b7[_0xefd2('0x1d')];var _0x1ca355;if(_0x471175>=_0x48ef07){_0x471175=_0x48ef07;_0x1ca355=0xc8;}else{_0x1ca355=0xce;}_0x518354[_0xefd2('0x19')](_0x1ca355);return _0x518354[_0xefd2('0x1f')]('Content-Range',_0x111d7b+'-'+_0x471175+'/'+_0x48ef07)[_0xefd2('0x1a')](_0x20192b);}return null;};}function patchUpdates(_0x387398){return function(_0x22ff6a){try{jsonpatch[_0xefd2('0x20')](_0x22ff6a,_0x387398,!![]);}catch(_0x570473){return BPromise[_0xefd2('0x21')](_0x570473);}return _0x22ff6a[_0xefd2('0x22')]();};}function saveUpdates(_0xfd1d0f,_0x25196e){return function(_0x2aaa1b){if(_0x2aaa1b){return _0x2aaa1b[_0xefd2('0x23')](_0xfd1d0f)[_0xefd2('0x24')](function(_0x49146f){return _0x49146f;});}return null;};}function removeEntity(_0x491286,_0x31180b){return function(_0x2636a5){if(_0x2636a5){return _0x2636a5[_0xefd2('0x25')]()[_0xefd2('0x24')](function(){_0x491286[_0xefd2('0x19')](0xcc)[_0xefd2('0x26')]();});}};}function handleEntityNotFound(_0x42e4e6,_0x35ea40){return function(_0x159a53){if(!_0x159a53){_0x42e4e6[_0xefd2('0x18')](0x194);}return _0x159a53;};}function handleError(_0x3f9663,_0x50dc75){_0x50dc75=_0x50dc75||0x1f4;return function(_0x348019){logger[_0xefd2('0x27')](_0x348019[_0xefd2('0x28')]);if(_0x348019[_0xefd2('0x29')]){delete _0x348019[_0xefd2('0x29')];}_0x3f9663[_0xefd2('0x19')](_0x50dc75)[_0xefd2('0x2a')](_0x348019);};}exports['index']=function(_0x386ee1,_0x12a0f5){var _0x25f25a={},_0x46e68d={},_0x168a43={'count':0x0,'rows':[]};var _0x50b245=_[_0xefd2('0x2b')](db[_0xefd2('0x2c')]['rawAttributes'],function(_0x2ebfdc){return{'name':_0x2ebfdc[_0xefd2('0x2d')],'type':_0x2ebfdc[_0xefd2('0x2e')][_0xefd2('0x2f')]};});_0x46e68d[_0xefd2('0x30')]=_[_0xefd2('0x2b')](_0x50b245,_0xefd2('0x29'));_0x46e68d[_0xefd2('0x31')]=_[_0xefd2('0x32')](_0x386ee1[_0xefd2('0x31')]);_0x46e68d[_0xefd2('0x33')]=_['intersection'](_0x46e68d[_0xefd2('0x30')],_0x46e68d[_0xefd2('0x31')]);_0x25f25a[_0xefd2('0x34')]=_[_0xefd2('0x35')](_0x46e68d[_0xefd2('0x30')],qs[_0xefd2('0x36')](_0x386ee1[_0xefd2('0x31')][_0xefd2('0x36')]));_0x25f25a[_0xefd2('0x34')]=_0x25f25a[_0xefd2('0x34')][_0xefd2('0x37')]?_0x25f25a['attributes']:_0x46e68d[_0xefd2('0x30')];if(!_0x386ee1[_0xefd2('0x31')]['hasOwnProperty'](_0xefd2('0x38'))){_0x25f25a[_0xefd2('0x1d')]=qs['limit'](_0x386ee1['query'][_0xefd2('0x1d')]);_0x25f25a['offset']=qs[_0xefd2('0x1b')](_0x386ee1[_0xefd2('0x31')][_0xefd2('0x1b')]);}_0x25f25a[_0xefd2('0x39')]=qs[_0xefd2('0x3a')](_0x386ee1['query'][_0xefd2('0x3a')]);_0x25f25a[_0xefd2('0x3b')]=qs[_0xefd2('0x33')](_[_0xefd2('0x3c')](_0x386ee1[_0xefd2('0x31')],_0x46e68d[_0xefd2('0x33')]),_0x50b245);if(_0x386ee1[_0xefd2('0x31')][_0xefd2('0x3d')]){_0x25f25a[_0xefd2('0x3b')]=_[_0xefd2('0x3e')](_0x25f25a[_0xefd2('0x3b')],{'$or':_[_0xefd2('0x2b')](_0x50b245,function(_0x11cbfb){if(_0x11cbfb[_0xefd2('0x2e')]!==_0xefd2('0x3f')){var _0x40f773={};_0x40f773[_0x11cbfb[_0xefd2('0x29')]]={'$like':'%'+_0x386ee1[_0xefd2('0x31')][_0xefd2('0x3d')]+'%'};return _0x40f773;}})});}_0x25f25a=_[_0xefd2('0x3e')]({},_0x25f25a,_0x386ee1[_0xefd2('0x40')]);var _0x4d5492={'where':_0x25f25a[_0xefd2('0x3b')]};return db['ChatQueueReport'][_0xefd2('0x1e')](_0x4d5492)['then'](function(_0x5586ba){_0x168a43[_0xefd2('0x1e')]=_0x5586ba;if(_0x386ee1[_0xefd2('0x31')][_0xefd2('0x41')]){_0x25f25a[_0xefd2('0x42')]=[{'all':!![]}];}return db[_0xefd2('0x2c')]['findAll'](_0x25f25a);})['then'](function(_0x235f52){_0x168a43['rows']=_0x235f52;return _0x168a43;})[_0xefd2('0x24')](respondWithFilteredResult(_0x12a0f5,_0x25f25a))[_0xefd2('0x43')](handleError(_0x12a0f5,null));};exports['show']=function(_0x10f2fa,_0xc43985){var _0x3602ed={'raw':!![],'where':{'id':_0x10f2fa['params']['id']}},_0x476698={};_0x476698[_0xefd2('0x30')]=_[_0xefd2('0x32')](db['ChatQueueReport'][_0xefd2('0x44')]);_0x476698['query']=_[_0xefd2('0x32')](_0x10f2fa['query']);_0x476698['filters']=_[_0xefd2('0x35')](_0x476698[_0xefd2('0x30')],_0x476698['query']);_0x3602ed[_0xefd2('0x34')]=_['intersection'](_0x476698[_0xefd2('0x30')],qs['fields'](_0x10f2fa[_0xefd2('0x31')][_0xefd2('0x36')]));_0x3602ed[_0xefd2('0x34')]=_0x3602ed['attributes'][_0xefd2('0x37')]?_0x3602ed[_0xefd2('0x34')]:_0x476698['model'];if(_0x10f2fa['query'][_0xefd2('0x41')]){_0x3602ed[_0xefd2('0x42')]=[{'all':!![]}];}_0x3602ed=_['merge']({},_0x3602ed,_0x10f2fa[_0xefd2('0x40')]);return db[_0xefd2('0x2c')][_0xefd2('0x45')](_0x3602ed)[_0xefd2('0x24')](handleEntityNotFound(_0xc43985,null))['then'](respondWithResult(_0xc43985,null))[_0xefd2('0x43')](handleError(_0xc43985,null));};exports[_0xefd2('0x46')]=function(_0x165231,_0x5222a4){return db[_0xefd2('0x2c')]['create'](_0x165231[_0xefd2('0x47')],{})['then'](respondWithResult(_0x5222a4,0xc9))[_0xefd2('0x43')](handleError(_0x5222a4,null));};exports[_0xefd2('0x23')]=function(_0x501288,_0x2a4f7b){if(_0x501288[_0xefd2('0x47')]['id']){delete _0x501288[_0xefd2('0x47')]['id'];}return db['ChatQueueReport']['find']({'where':{'id':_0x501288[_0xefd2('0x48')]['id']}})['then'](handleEntityNotFound(_0x2a4f7b,null))[_0xefd2('0x24')](saveUpdates(_0x501288[_0xefd2('0x47')],null))[_0xefd2('0x24')](respondWithResult(_0x2a4f7b,null))['catch'](handleError(_0x2a4f7b,null));};exports['destroy']=function(_0x53fbbb,_0x290a46){return db[_0xefd2('0x2c')][_0xefd2('0x45')]({'where':{'id':_0x53fbbb[_0xefd2('0x48')]['id']}})[_0xefd2('0x24')](handleEntityNotFound(_0x290a46,null))['then'](removeEntity(_0x290a46,null))[_0xefd2('0x43')](handleError(_0x290a46,null));};exports[_0xefd2('0x49')]=function(_0x3d654b,_0xb0691a){return db[_0xefd2('0x2c')][_0xefd2('0x49')]()[_0xefd2('0x24')](respondWithResult(_0xb0691a,null))[_0xefd2('0x43')](handleError(_0xb0691a,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 435e699..60c42c6 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 _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x10626e,_0x14348b){var _0x5426b3=function(_0x537260){while(--_0x537260){_0x10626e['push'](_0x10626e['shift']());}};_0x5426b3(++_0x14348b);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['path','rimraf','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x478779,_0x4c64b7){var _0x320bfe=function(_0x527013){while(--_0x527013){_0x478779['push'](_0x478779['shift']());}};_0x320bfe(++_0x4c64b7);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x593564,_0x43583f){_0x593564=_0x593564-0x0;var _0x211a89=_0xcb91[_0x593564];return _0x211a89;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('ChatQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 5fca294..04dc4c2 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 _0x77a9=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','info','ChatQueueReport,\x20%s,\x20%s','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','ChatQueueReport','options','raw','then','debug','CreateChatQueueReport','update','body','where','attributes','limit','UpdateChatQueueReport','lodash','util','moment'];(function(_0x2de399,_0x3c557d){var _0x50cba8=function(_0x585f7d){while(--_0x585f7d){_0x2de399['push'](_0x2de399['shift']());}};_0x50cba8(++_0x3c557d);}(_0x77a9,0x1ec));var _0x977a=function(_0x2d5291,_0x11ef01){_0x2d5291=_0x2d5291-0x0;var _0x1af4f0=_0x77a9[_0x2d5291];return _0x1af4f0;};'use strict';var _=require(_0x977a('0x0'));var util=require(_0x977a('0x1'));var moment=require(_0x977a('0x2'));var BPromise=require(_0x977a('0x3'));var rs=require(_0x977a('0x4'));var fs=require('fs');var Redis=require(_0x977a('0x5'));var db=require(_0x977a('0x6'))['db'];var utils=require(_0x977a('0x7'));var logger=require(_0x977a('0x8'))(_0x977a('0x9'));var config=require(_0x977a('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x977a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x593dda,_0x442103,_0x4363e4){return new BPromise(function(_0x270d66,_0x56b524){return client['request'](_0x593dda,_0x4363e4)['then'](function(_0x307cb9){logger[_0x977a('0xc')](_0x977a('0xd'),_0x442103,'request\x20sent');logger['debug'](_0x977a('0xe'),_0x442103,_0x977a('0xf'),JSON[_0x977a('0x10')](_0x307cb9));if(_0x307cb9[_0x977a('0x11')]){if(_0x307cb9[_0x977a('0x11')]['code']===0x1f4){logger[_0x977a('0x11')](_0x977a('0xd'),_0x442103,_0x307cb9['error'][_0x977a('0x12')]);return _0x56b524(_0x307cb9[_0x977a('0x11')][_0x977a('0x12')]);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x442103,_0x307cb9[_0x977a('0x11')][_0x977a('0x12')]);return _0x270d66(_0x307cb9[_0x977a('0x11')][_0x977a('0x12')]);}else{logger['info'](_0x977a('0xd'),_0x442103,_0x977a('0xf'));_0x270d66(_0x307cb9[_0x977a('0x13')][_0x977a('0x12')]);}})[_0x977a('0x14')](function(_0xf36aa){logger[_0x977a('0x11')](_0x977a('0xd'),_0x442103,_0xf36aa);_0x56b524(_0xf36aa);});});}exports['CreateChatQueueReport']=function(_0x1582c8){var _0x3b337b=this;return new Promise(function(_0x234ed3,_0x2212f6){return db[_0x977a('0x15')]['create'](_0x1582c8['body'],{'raw':_0x1582c8[_0x977a('0x16')]?_0x1582c8[_0x977a('0x16')][_0x977a('0x17')]===undefined?!![]:![]:!![]})[_0x977a('0x18')](function(_0x2db4a5){logger[_0x977a('0xc')]('CreateChatQueueReport',_0x1582c8);logger[_0x977a('0x19')](_0x977a('0x1a'),_0x1582c8,JSON[_0x977a('0x10')](_0x2db4a5));_0x234ed3(_0x2db4a5);})[_0x977a('0x14')](function(_0x530915){logger['error'](_0x977a('0x1a'),_0x530915[_0x977a('0x12')],_0x1582c8);_0x2212f6(_0x3b337b['error'](0x1f4,_0x530915['message']));});});};exports['UpdateChatQueueReport']=function(_0x196c27){var _0x1078e=this;return new Promise(function(_0x204b60,_0xe4deeb){return db[_0x977a('0x15')][_0x977a('0x1b')](_0x196c27[_0x977a('0x1c')],{'raw':_0x196c27[_0x977a('0x16')]?_0x196c27[_0x977a('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x196c27[_0x977a('0x16')]?_0x196c27[_0x977a('0x16')][_0x977a('0x1d')]||null:null,'attributes':_0x196c27['options']?_0x196c27[_0x977a('0x16')][_0x977a('0x1e')]||null:null,'limit':_0x196c27[_0x977a('0x16')]?_0x196c27['options'][_0x977a('0x1f')]||null:null})['then'](function(_0x7fe43d){logger[_0x977a('0xc')](_0x977a('0x20'),_0x196c27);logger[_0x977a('0x19')](_0x977a('0x20'),_0x196c27,JSON[_0x977a('0x10')](_0x7fe43d));_0x204b60(_0x7fe43d);})['catch'](function(_0x2c31d3){logger[_0x977a('0x11')](_0x977a('0x20'),_0x2c31d3[_0x977a('0x12')],_0x196c27);_0xe4deeb(_0x1078e[_0x977a('0x11')](0x1f4,_0x2c31d3['message']));});});}; \ No newline at end of file +var _0xa82b=['stringify','error','message','result','CreateChatQueueReport','create','body','options','raw','catch','UpdateChatQueueReport','ChatQueueReport','update','where','lodash','util','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa82b,0x1b2));var _0xba82=function(_0x5aada8,_0x460a35){_0x5aada8=_0x5aada8-0x0;var _0xf5247e=_0xa82b[_0x5aada8];return _0xf5247e;};'use strict';var _=require(_0xba82('0x0'));var util=require(_0xba82('0x1'));var moment=require('moment');var BPromise=require(_0xba82('0x2'));var rs=require(_0xba82('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba82('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xba82('0x5'));var config=require(_0xba82('0x6'));var jayson=require(_0xba82('0x7'));var client=jayson[_0xba82('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x492416,_0x30450f,_0x5bdc0b){return new BPromise(function(_0x4c3f12,_0x41de41){return client[_0xba82('0x9')](_0x492416,_0x5bdc0b)[_0xba82('0xa')](function(_0x4e9fc0){logger[_0xba82('0xb')](_0xba82('0xc'),_0x30450f,_0xba82('0xd'));logger[_0xba82('0xe')](_0xba82('0xf'),_0x30450f,'request\x20sent',JSON[_0xba82('0x10')](_0x4e9fc0));if(_0x4e9fc0['error']){if(_0x4e9fc0['error']['code']===0x1f4){logger['error'](_0xba82('0xc'),_0x30450f,_0x4e9fc0[_0xba82('0x11')][_0xba82('0x12')]);return _0x41de41(_0x4e9fc0[_0xba82('0x11')][_0xba82('0x12')]);}logger[_0xba82('0x11')](_0xba82('0xc'),_0x30450f,_0x4e9fc0[_0xba82('0x11')]['message']);return _0x4c3f12(_0x4e9fc0[_0xba82('0x11')][_0xba82('0x12')]);}else{logger['info'](_0xba82('0xc'),_0x30450f,_0xba82('0xd'));_0x4c3f12(_0x4e9fc0[_0xba82('0x13')][_0xba82('0x12')]);}})['catch'](function(_0x1d26ab){logger[_0xba82('0x11')](_0xba82('0xc'),_0x30450f,_0x1d26ab);_0x41de41(_0x1d26ab);});});}exports[_0xba82('0x14')]=function(_0x12939f){var _0x1ecedc=this;return new Promise(function(_0xc2da,_0x3a12fe){return db['ChatQueueReport'][_0xba82('0x15')](_0x12939f[_0xba82('0x16')],{'raw':_0x12939f[_0xba82('0x17')]?_0x12939f[_0xba82('0x17')][_0xba82('0x18')]===undefined?!![]:![]:!![]})[_0xba82('0xa')](function(_0x2781db){logger[_0xba82('0xb')](_0xba82('0x14'),_0x12939f);logger[_0xba82('0xe')](_0xba82('0x14'),_0x12939f,JSON[_0xba82('0x10')](_0x2781db));_0xc2da(_0x2781db);})[_0xba82('0x19')](function(_0x1a9909){logger[_0xba82('0x11')](_0xba82('0x14'),_0x1a9909[_0xba82('0x12')],_0x12939f);_0x3a12fe(_0x1ecedc[_0xba82('0x11')](0x1f4,_0x1a9909['message']));});});};exports[_0xba82('0x1a')]=function(_0xb796dd){var _0x53789c=this;return new Promise(function(_0x2aa7e1,_0x8cc5df){return db[_0xba82('0x1b')][_0xba82('0x1c')](_0xb796dd[_0xba82('0x16')],{'raw':_0xb796dd[_0xba82('0x17')]?_0xb796dd[_0xba82('0x17')][_0xba82('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb796dd['options']?_0xb796dd[_0xba82('0x17')][_0xba82('0x1d')]||null:null,'attributes':_0xb796dd['options']?_0xb796dd['options']['attributes']||null:null,'limit':_0xb796dd['options']?_0xb796dd['options']['limit']||null:null})[_0xba82('0xa')](function(_0x1cc721){logger['info'](_0xba82('0x1a'),_0xb796dd);logger['debug'](_0xba82('0x1a'),_0xb796dd,JSON[_0xba82('0x10')](_0x1cc721));_0x2aa7e1(_0x1cc721);})[_0xba82('0x19')](function(_0x3143dc){logger[_0xba82('0x11')](_0xba82('0x1a'),_0x3143dc[_0xba82('0x12')],_0xb796dd);_0x8cc5df(_0x53789c[_0xba82('0x11')](0x1f4,_0x3143dc['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index bc32758..e339caa 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 _0xc228=['put','update','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','/describe','/:id','show','post','create'];(function(_0xb8cfbe,_0x2e81b6){var _0x227d51=function(_0x5cb1ff){while(--_0x5cb1ff){_0xb8cfbe['push'](_0xb8cfbe['shift']());}};_0x227d51(++_0x2e81b6);}(_0xc228,0x93));var _0x8c22=function(_0x10620b,_0x499fb5){_0x10620b=_0x10620b-0x0;var _0x59e078=_0xc228[_0x10620b];return _0x59e078;};'use strict';var multer=require(_0x8c22('0x0'));var util=require('util');var path=require(_0x8c22('0x1'));var timeout=require(_0x8c22('0x2'));var express=require(_0x8c22('0x3'));var router=express[_0x8c22('0x4')]();var fs_extra=require(_0x8c22('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8c22('0x6'));var controller=require(_0x8c22('0x7'));router[_0x8c22('0x8')]('/',auth[_0x8c22('0x9')](),controller['index']);router[_0x8c22('0x8')](_0x8c22('0xa'),auth[_0x8c22('0x9')](),controller['describe']);router[_0x8c22('0x8')](_0x8c22('0xb'),auth[_0x8c22('0x9')](),controller[_0x8c22('0xc')]);router[_0x8c22('0xd')]('/',auth['isAuthenticated'](),controller[_0x8c22('0xe')]);router[_0x8c22('0xf')]('/:id',auth[_0x8c22('0x9')](),controller[_0x8c22('0x10')]);router['delete']('/:id',auth[_0x8c22('0x9')](),controller[_0x8c22('0x11')]);module['exports']=router; \ No newline at end of file +var _0x9c6a=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','get','describe','show','post','create','put','/:id','delete'];(function(_0xf86776,_0x1e54db){var _0x7c0d19=function(_0x33e654){while(--_0x33e654){_0xf86776['push'](_0xf86776['shift']());}};_0x7c0d19(++_0x1e54db);}(_0x9c6a,0xf2));var _0xa9c6=function(_0x130962,_0x437d26){_0x130962=_0x130962-0x0;var _0x1aeb58=_0x9c6a[_0x130962];return _0x1aeb58;};'use strict';var multer=require(_0xa9c6('0x0'));var util=require(_0xa9c6('0x1'));var path=require(_0xa9c6('0x2'));var timeout=require(_0xa9c6('0x3'));var express=require(_0xa9c6('0x4'));var router=express['Router']();var fs_extra=require(_0xa9c6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa9c6('0x6'));var config=require(_0xa9c6('0x7'));var controller=require(_0xa9c6('0x8'));router['get']('/',auth[_0xa9c6('0x9')](),controller['index']);router[_0xa9c6('0xa')]('/describe',auth[_0xa9c6('0x9')](),controller[_0xa9c6('0xb')]);router[_0xa9c6('0xa')]('/:id',auth[_0xa9c6('0x9')](),controller[_0xa9c6('0xc')]);router[_0xa9c6('0xd')]('/',auth[_0xa9c6('0x9')](),controller[_0xa9c6('0xe')]);router[_0xa9c6('0xf')](_0xa9c6('0x10'),auth['isAuthenticated'](),controller['update']);router[_0xa9c6('0x11')](_0xa9c6('0x10'),auth[_0xa9c6('0x9')](),controller[_0xa9c6('0x12')]);module[_0xa9c6('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index d3f4866..8f4e8a5 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x5d2309,_0x1a5d0e){var _0xa8d871=function(_0x38da1f){while(--_0x38da1f){_0x5d2309['push'](_0x5d2309['shift']());}};_0xa8d871(++_0x1a5d0e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x421c56,_0x4efd00){_0x421c56=_0x421c56-0x0;var _0x49b244=_0xcb91[_0x421c56];return _0x49b244;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x29d5c3,_0x3db739){var _0x161fee=function(_0x39221b){while(--_0x39221b){_0x29d5c3['push'](_0x29d5c3['shift']());}};_0x161fee(++_0x3db739);}(_0xf4eb,0xec));var _0xbf4e=function(_0x1c2049,_0x3dd6a6){_0x1c2049=_0x1c2049-0x0;var _0x42825a=_0xf4eb[_0x1c2049];return _0x42825a;};'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 6151415..e3758db 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 _0x312f=['sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','show','intersection','find','catch','create','body','update','params','describe','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','then','destroy','stack','name','send','map','ChatTransferReport','rawAttributes','type','key','model','keys','query','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x490459,_0x167058){var _0x14876b=function(_0x22590f){while(--_0x22590f){_0x490459['push'](_0x490459['shift']());}};_0x14876b(++_0x167058);}(_0x312f,0x17c));var _0xf312=function(_0x494cab,_0x5f176f){_0x494cab=_0x494cab-0x0;var _0x58a27e=_0x312f[_0x494cab];return _0x58a27e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf312('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf312('0x1'));var rp=require(_0xf312('0x2'));var moment=require('moment');var BPromise=require(_0xf312('0x3'));var Mustache=require(_0xf312('0x4'));var util=require(_0xf312('0x5'));var path=require(_0xf312('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf312('0x7'));var fs=require('fs');var fs_extra=require(_0xf312('0x8'));var _=require('lodash');var squel=require(_0xf312('0x9'));var crypto=require('crypto');var jsforce=require(_0xf312('0xa'));var deskjs=require(_0xf312('0xb'));var toCsv=require(_0xf312('0xc'));var querystring=require(_0xf312('0xd'));var Papa=require(_0xf312('0xe'));var Redis=require(_0xf312('0xf'));var authService=require(_0xf312('0x10'));var qs=require(_0xf312('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf312('0x12'));var logger=require(_0xf312('0x13'))('api');var utils=require(_0xf312('0x14'));var config=require(_0xf312('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf312('0x16'))['db'];function respondWithStatusCode(_0x112290,_0x3856a8){_0x3856a8=_0x3856a8||0xcc;return function(_0x3b856a){if(_0x3b856a){return _0x112290[_0xf312('0x17')](_0x3856a8);}return _0x112290['status'](_0x3856a8)[_0xf312('0x18')]();};}function respondWithResult(_0x27895b,_0xa0aacd){_0xa0aacd=_0xa0aacd||0xc8;return function(_0x823862){if(_0x823862){return _0x27895b[_0xf312('0x19')](_0xa0aacd)[_0xf312('0x1a')](_0x823862);}};}function respondWithFilteredResult(_0x4ebc28,_0x3ca9d2){return function(_0x342f2c){if(_0x342f2c){var _0x4d052e=typeof _0x3ca9d2[_0xf312('0x1b')]===_0xf312('0x1c')&&typeof _0x3ca9d2[_0xf312('0x1d')]==='undefined';var _0x332d4f=_0x342f2c['count'];var _0x1fc597=_0x4d052e?0x0:_0x3ca9d2['offset'];var _0x49c468=_0x4d052e?_0x342f2c[_0xf312('0x1e')]:_0x3ca9d2['offset']+_0x3ca9d2[_0xf312('0x1d')];var _0xd20c87;if(_0x49c468>=_0x332d4f){_0x49c468=_0x332d4f;_0xd20c87=0xc8;}else{_0xd20c87=0xce;}_0x4ebc28[_0xf312('0x19')](_0xd20c87);return _0x4ebc28[_0xf312('0x1f')]('Content-Range',_0x1fc597+'-'+_0x49c468+'/'+_0x332d4f)[_0xf312('0x1a')](_0x342f2c);}return null;};}function patchUpdates(_0x276ca7){return function(_0x559602){try{jsonpatch['apply'](_0x559602,_0x276ca7,!![]);}catch(_0x1d3d7e){return BPromise[_0xf312('0x20')](_0x1d3d7e);}return _0x559602['save']();};}function saveUpdates(_0x4b9aa2,_0x472e17){return function(_0x5ac331){if(_0x5ac331){return _0x5ac331['update'](_0x4b9aa2)[_0xf312('0x21')](function(_0x343e4d){return _0x343e4d;});}return null;};}function removeEntity(_0x5e4817,_0x55b67e){return function(_0x50f634){if(_0x50f634){return _0x50f634[_0xf312('0x22')]()[_0xf312('0x21')](function(){_0x5e4817[_0xf312('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40f3cb,_0x2abf4b){return function(_0x2e338e){if(!_0x2e338e){_0x40f3cb['sendStatus'](0x194);}return _0x2e338e;};}function handleError(_0x1a0949,_0x4e22d8){_0x4e22d8=_0x4e22d8||0x1f4;return function(_0x52ee36){logger['error'](_0x52ee36[_0xf312('0x23')]);if(_0x52ee36[_0xf312('0x24')]){delete _0x52ee36[_0xf312('0x24')];}_0x1a0949[_0xf312('0x19')](_0x4e22d8)[_0xf312('0x25')](_0x52ee36);};}exports['index']=function(_0x11df69,_0x3301da){var _0x2cc5b1={},_0x3073f6={},_0x1bd826={'count':0x0,'rows':[]};var _0x4fa157=_[_0xf312('0x26')](db[_0xf312('0x27')][_0xf312('0x28')],function(_0x5c5eb6){return{'name':_0x5c5eb6['fieldName'],'type':_0x5c5eb6[_0xf312('0x29')][_0xf312('0x2a')]};});_0x3073f6[_0xf312('0x2b')]=_[_0xf312('0x26')](_0x4fa157,_0xf312('0x24'));_0x3073f6['query']=_[_0xf312('0x2c')](_0x11df69[_0xf312('0x2d')]);_0x3073f6['filters']=_['intersection'](_0x3073f6[_0xf312('0x2b')],_0x3073f6[_0xf312('0x2d')]);_0x2cc5b1[_0xf312('0x2e')]=_['intersection'](_0x3073f6['model'],qs[_0xf312('0x2f')](_0x11df69[_0xf312('0x2d')]['fields']));_0x2cc5b1[_0xf312('0x2e')]=_0x2cc5b1['attributes'][_0xf312('0x30')]?_0x2cc5b1[_0xf312('0x2e')]:_0x3073f6['model'];if(!_0x11df69[_0xf312('0x2d')][_0xf312('0x31')](_0xf312('0x32'))){_0x2cc5b1[_0xf312('0x1d')]=qs[_0xf312('0x1d')](_0x11df69[_0xf312('0x2d')][_0xf312('0x1d')]);_0x2cc5b1[_0xf312('0x1b')]=qs[_0xf312('0x1b')](_0x11df69[_0xf312('0x2d')]['offset']);}_0x2cc5b1[_0xf312('0x33')]=qs['sort'](_0x11df69[_0xf312('0x2d')][_0xf312('0x34')]);_0x2cc5b1[_0xf312('0x35')]=qs[_0xf312('0x36')](_[_0xf312('0x37')](_0x11df69[_0xf312('0x2d')],_0x3073f6[_0xf312('0x36')]),_0x4fa157);if(_0x11df69[_0xf312('0x2d')][_0xf312('0x38')]){_0x2cc5b1[_0xf312('0x35')]=_[_0xf312('0x39')](_0x2cc5b1[_0xf312('0x35')],{'$or':_[_0xf312('0x26')](_0x4fa157,function(_0x2959dd){if(_0x2959dd[_0xf312('0x29')]!=='VIRTUAL'){var _0x8d0d51={};_0x8d0d51[_0x2959dd[_0xf312('0x24')]]={'$like':'%'+_0x11df69['query'][_0xf312('0x38')]+'%'};return _0x8d0d51;}})});}_0x2cc5b1=_[_0xf312('0x39')]({},_0x2cc5b1,_0x11df69[_0xf312('0x3a')]);var _0x12948b={'where':_0x2cc5b1[_0xf312('0x35')]};return db[_0xf312('0x27')][_0xf312('0x1e')](_0x12948b)[_0xf312('0x21')](function(_0x5763ea){_0x1bd826[_0xf312('0x1e')]=_0x5763ea;if(_0x11df69[_0xf312('0x2d')][_0xf312('0x3b')]){_0x2cc5b1[_0xf312('0x3c')]=[{'all':!![]}];}return db[_0xf312('0x27')][_0xf312('0x3d')](_0x2cc5b1);})[_0xf312('0x21')](function(_0x3067c3){_0x1bd826[_0xf312('0x3e')]=_0x3067c3;return _0x1bd826;})[_0xf312('0x21')](respondWithFilteredResult(_0x3301da,_0x2cc5b1))['catch'](handleError(_0x3301da,null));};exports[_0xf312('0x3f')]=function(_0x586f75,_0x5bb30e){var _0x1c8ca7={'raw':!![],'where':{'id':_0x586f75['params']['id']}},_0x4cdf78={};_0x4cdf78['model']=_[_0xf312('0x2c')](db[_0xf312('0x27')][_0xf312('0x28')]);_0x4cdf78[_0xf312('0x2d')]=_[_0xf312('0x2c')](_0x586f75['query']);_0x4cdf78[_0xf312('0x36')]=_[_0xf312('0x40')](_0x4cdf78[_0xf312('0x2b')],_0x4cdf78[_0xf312('0x2d')]);_0x1c8ca7[_0xf312('0x2e')]=_[_0xf312('0x40')](_0x4cdf78[_0xf312('0x2b')],qs[_0xf312('0x2f')](_0x586f75[_0xf312('0x2d')]['fields']));_0x1c8ca7[_0xf312('0x2e')]=_0x1c8ca7['attributes'][_0xf312('0x30')]?_0x1c8ca7[_0xf312('0x2e')]:_0x4cdf78[_0xf312('0x2b')];if(_0x586f75[_0xf312('0x2d')][_0xf312('0x3b')]){_0x1c8ca7[_0xf312('0x3c')]=[{'all':!![]}];}_0x1c8ca7=_[_0xf312('0x39')]({},_0x1c8ca7,_0x586f75[_0xf312('0x3a')]);return db[_0xf312('0x27')][_0xf312('0x41')](_0x1c8ca7)[_0xf312('0x21')](handleEntityNotFound(_0x5bb30e,null))[_0xf312('0x21')](respondWithResult(_0x5bb30e,null))[_0xf312('0x42')](handleError(_0x5bb30e,null));};exports[_0xf312('0x43')]=function(_0x453c22,_0x450bc7){return db[_0xf312('0x27')][_0xf312('0x43')](_0x453c22[_0xf312('0x44')],{})['then'](respondWithResult(_0x450bc7,0xc9))[_0xf312('0x42')](handleError(_0x450bc7,null));};exports[_0xf312('0x45')]=function(_0x22d7d9,_0x545704){if(_0x22d7d9['body']['id']){delete _0x22d7d9[_0xf312('0x44')]['id'];}return db[_0xf312('0x27')][_0xf312('0x41')]({'where':{'id':_0x22d7d9['params']['id']}})[_0xf312('0x21')](handleEntityNotFound(_0x545704,null))[_0xf312('0x21')](saveUpdates(_0x22d7d9['body'],null))[_0xf312('0x21')](respondWithResult(_0x545704,null))['catch'](handleError(_0x545704,null));};exports[_0xf312('0x22')]=function(_0x7127e7,_0x1401d2){return db[_0xf312('0x27')]['find']({'where':{'id':_0x7127e7[_0xf312('0x46')]['id']}})['then'](handleEntityNotFound(_0x1401d2,null))[_0xf312('0x21')](removeEntity(_0x1401d2,null))[_0xf312('0x42')](handleError(_0x1401d2,null));};exports[_0xf312('0x47')]=function(_0x5923c2,_0x351de9){return db[_0xf312('0x27')][_0xf312('0x47')]()[_0xf312('0x21')](respondWithResult(_0x351de9,null))[_0xf312('0x42')](handleError(_0x351de9,null));}; \ No newline at end of file +var _0x7c2a=['map','ChatTransferReport','rawAttributes','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','intersection','find','create','body','describe','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','status','error','name','send'];(function(_0x5813d3,_0x40377c){var _0x5ab22c=function(_0x4a9c0c){while(--_0x4a9c0c){_0x5813d3['push'](_0x5813d3['shift']());}};_0x5ab22c(++_0x40377c);}(_0x7c2a,0x13e));var _0xa7c2=function(_0x2c83ee,_0x2736ed){_0x2c83ee=_0x2c83ee-0x0;var _0x349107=_0x7c2a[_0x2c83ee];return _0x349107;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa7c2('0x0'));var rp=require(_0xa7c2('0x1'));var moment=require(_0xa7c2('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xa7c2('0x3'));var util=require(_0xa7c2('0x4'));var path=require(_0xa7c2('0x5'));var sox=require(_0xa7c2('0x6'));var csv=require(_0xa7c2('0x7'));var ejs=require(_0xa7c2('0x8'));var fs=require('fs');var fs_extra=require(_0xa7c2('0x9'));var _=require(_0xa7c2('0xa'));var squel=require(_0xa7c2('0xb'));var crypto=require(_0xa7c2('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa7c2('0x7'));var querystring=require(_0xa7c2('0xd'));var Papa=require(_0xa7c2('0xe'));var Redis=require(_0xa7c2('0xf'));var authService=require(_0xa7c2('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa7c2('0x11'));var logger=require(_0xa7c2('0x12'))(_0xa7c2('0x13'));var utils=require(_0xa7c2('0x14'));var config=require(_0xa7c2('0x15'));var licenseUtil=require(_0xa7c2('0x16'));var db=require(_0xa7c2('0x17'))['db'];function respondWithStatusCode(_0x5c60e3,_0x59b973){_0x59b973=_0x59b973||0xcc;return function(_0x27676b){if(_0x27676b){return _0x5c60e3[_0xa7c2('0x18')](_0x59b973);}return _0x5c60e3['status'](_0x59b973)[_0xa7c2('0x19')]();};}function respondWithResult(_0x2b5724,_0x4ed3b2){_0x4ed3b2=_0x4ed3b2||0xc8;return function(_0x141a33){if(_0x141a33){return _0x2b5724['status'](_0x4ed3b2)[_0xa7c2('0x1a')](_0x141a33);}};}function respondWithFilteredResult(_0x490d36,_0x4222a8){return function(_0x3d7f3a){if(_0x3d7f3a){var _0x523331=typeof _0x4222a8[_0xa7c2('0x1b')]===_0xa7c2('0x1c')&&typeof _0x4222a8[_0xa7c2('0x1d')]==='undefined';var _0x2760ca=_0x3d7f3a[_0xa7c2('0x1e')];var _0x50a6cb=_0x523331?0x0:_0x4222a8[_0xa7c2('0x1b')];var _0xb87f6a=_0x523331?_0x3d7f3a['count']:_0x4222a8[_0xa7c2('0x1b')]+_0x4222a8[_0xa7c2('0x1d')];var _0x2f1069;if(_0xb87f6a>=_0x2760ca){_0xb87f6a=_0x2760ca;_0x2f1069=0xc8;}else{_0x2f1069=0xce;}_0x490d36['status'](_0x2f1069);return _0x490d36[_0xa7c2('0x1f')]('Content-Range',_0x50a6cb+'-'+_0xb87f6a+'/'+_0x2760ca)[_0xa7c2('0x1a')](_0x3d7f3a);}return null;};}function patchUpdates(_0x100153){return function(_0x10d24a){try{jsonpatch[_0xa7c2('0x20')](_0x10d24a,_0x100153,!![]);}catch(_0x50259a){return BPromise[_0xa7c2('0x21')](_0x50259a);}return _0x10d24a[_0xa7c2('0x22')]();};}function saveUpdates(_0x260dc5,_0x41c245){return function(_0x493044){if(_0x493044){return _0x493044[_0xa7c2('0x23')](_0x260dc5)[_0xa7c2('0x24')](function(_0x1e991a){return _0x1e991a;});}return null;};}function removeEntity(_0x2ded48,_0x4bf677){return function(_0x5b7646){if(_0x5b7646){return _0x5b7646[_0xa7c2('0x25')]()[_0xa7c2('0x24')](function(){_0x2ded48[_0xa7c2('0x26')](0xcc)[_0xa7c2('0x19')]();});}};}function handleEntityNotFound(_0x24acc8,_0x579c98){return function(_0xab21c4){if(!_0xab21c4){_0x24acc8[_0xa7c2('0x18')](0x194);}return _0xab21c4;};}function handleError(_0x2d1ecb,_0x41dae3){_0x41dae3=_0x41dae3||0x1f4;return function(_0x166ac4){logger[_0xa7c2('0x27')](_0x166ac4['stack']);if(_0x166ac4[_0xa7c2('0x28')]){delete _0x166ac4[_0xa7c2('0x28')];}_0x2d1ecb[_0xa7c2('0x26')](_0x41dae3)[_0xa7c2('0x29')](_0x166ac4);};}exports['index']=function(_0x2d1868,_0x470a1b){var _0x326a21={},_0x2e5428={},_0x76be57={'count':0x0,'rows':[]};var _0x2543a4=_[_0xa7c2('0x2a')](db[_0xa7c2('0x2b')][_0xa7c2('0x2c')],function(_0x23a9c8){return{'name':_0x23a9c8['fieldName'],'type':_0x23a9c8[_0xa7c2('0x2d')][_0xa7c2('0x2e')]};});_0x2e5428[_0xa7c2('0x2f')]=_['map'](_0x2543a4,_0xa7c2('0x28'));_0x2e5428[_0xa7c2('0x30')]=_[_0xa7c2('0x31')](_0x2d1868[_0xa7c2('0x30')]);_0x2e5428['filters']=_['intersection'](_0x2e5428[_0xa7c2('0x2f')],_0x2e5428[_0xa7c2('0x30')]);_0x326a21[_0xa7c2('0x32')]=_['intersection'](_0x2e5428[_0xa7c2('0x2f')],qs[_0xa7c2('0x33')](_0x2d1868[_0xa7c2('0x30')][_0xa7c2('0x33')]));_0x326a21[_0xa7c2('0x32')]=_0x326a21[_0xa7c2('0x32')][_0xa7c2('0x34')]?_0x326a21['attributes']:_0x2e5428[_0xa7c2('0x2f')];if(!_0x2d1868[_0xa7c2('0x30')][_0xa7c2('0x35')](_0xa7c2('0x36'))){_0x326a21[_0xa7c2('0x1d')]=qs[_0xa7c2('0x1d')](_0x2d1868[_0xa7c2('0x30')][_0xa7c2('0x1d')]);_0x326a21['offset']=qs['offset'](_0x2d1868['query'][_0xa7c2('0x1b')]);}_0x326a21['order']=qs[_0xa7c2('0x37')](_0x2d1868[_0xa7c2('0x30')][_0xa7c2('0x37')]);_0x326a21[_0xa7c2('0x38')]=qs['filters'](_['pick'](_0x2d1868['query'],_0x2e5428[_0xa7c2('0x39')]),_0x2543a4);if(_0x2d1868['query'][_0xa7c2('0x3a')]){_0x326a21[_0xa7c2('0x38')]=_[_0xa7c2('0x3b')](_0x326a21[_0xa7c2('0x38')],{'$or':_[_0xa7c2('0x2a')](_0x2543a4,function(_0x10de56){if(_0x10de56[_0xa7c2('0x2d')]!==_0xa7c2('0x3c')){var _0x13518e={};_0x13518e[_0x10de56[_0xa7c2('0x28')]]={'$like':'%'+_0x2d1868[_0xa7c2('0x30')]['filter']+'%'};return _0x13518e;}})});}_0x326a21=_[_0xa7c2('0x3b')]({},_0x326a21,_0x2d1868[_0xa7c2('0x3d')]);var _0x57d7cc={'where':_0x326a21['where']};return db[_0xa7c2('0x2b')][_0xa7c2('0x1e')](_0x57d7cc)[_0xa7c2('0x24')](function(_0x256ab8){_0x76be57[_0xa7c2('0x1e')]=_0x256ab8;if(_0x2d1868[_0xa7c2('0x30')]['includeAll']){_0x326a21['include']=[{'all':!![]}];}return db[_0xa7c2('0x2b')][_0xa7c2('0x3e')](_0x326a21);})[_0xa7c2('0x24')](function(_0x9a8e53){_0x76be57[_0xa7c2('0x3f')]=_0x9a8e53;return _0x76be57;})[_0xa7c2('0x24')](respondWithFilteredResult(_0x470a1b,_0x326a21))[_0xa7c2('0x40')](handleError(_0x470a1b,null));};exports[_0xa7c2('0x41')]=function(_0x5f14ea,_0x625dcd){var _0x30f045={'raw':!![],'where':{'id':_0x5f14ea[_0xa7c2('0x42')]['id']}},_0x1b2947={};_0x1b2947['model']=_[_0xa7c2('0x31')](db[_0xa7c2('0x2b')]['rawAttributes']);_0x1b2947[_0xa7c2('0x30')]=_['keys'](_0x5f14ea[_0xa7c2('0x30')]);_0x1b2947[_0xa7c2('0x39')]=_['intersection'](_0x1b2947[_0xa7c2('0x2f')],_0x1b2947['query']);_0x30f045[_0xa7c2('0x32')]=_[_0xa7c2('0x43')](_0x1b2947['model'],qs['fields'](_0x5f14ea[_0xa7c2('0x30')]['fields']));_0x30f045[_0xa7c2('0x32')]=_0x30f045[_0xa7c2('0x32')][_0xa7c2('0x34')]?_0x30f045[_0xa7c2('0x32')]:_0x1b2947[_0xa7c2('0x2f')];if(_0x5f14ea['query']['includeAll']){_0x30f045['include']=[{'all':!![]}];}_0x30f045=_[_0xa7c2('0x3b')]({},_0x30f045,_0x5f14ea['options']);return db[_0xa7c2('0x2b')][_0xa7c2('0x44')](_0x30f045)[_0xa7c2('0x24')](handleEntityNotFound(_0x625dcd,null))[_0xa7c2('0x24')](respondWithResult(_0x625dcd,null))['catch'](handleError(_0x625dcd,null));};exports[_0xa7c2('0x45')]=function(_0x56884c,_0x3bf24b){return db[_0xa7c2('0x2b')]['create'](_0x56884c['body'],{})[_0xa7c2('0x24')](respondWithResult(_0x3bf24b,0xc9))[_0xa7c2('0x40')](handleError(_0x3bf24b,null));};exports[_0xa7c2('0x23')]=function(_0x3ffa8b,_0x1161aa){if(_0x3ffa8b[_0xa7c2('0x46')]['id']){delete _0x3ffa8b[_0xa7c2('0x46')]['id'];}return db[_0xa7c2('0x2b')]['find']({'where':{'id':_0x3ffa8b[_0xa7c2('0x42')]['id']}})['then'](handleEntityNotFound(_0x1161aa,null))[_0xa7c2('0x24')](saveUpdates(_0x3ffa8b[_0xa7c2('0x46')],null))['then'](respondWithResult(_0x1161aa,null))[_0xa7c2('0x40')](handleError(_0x1161aa,null));};exports[_0xa7c2('0x25')]=function(_0x49af3e,_0x24ebf7){return db[_0xa7c2('0x2b')]['find']({'where':{'id':_0x49af3e[_0xa7c2('0x42')]['id']}})[_0xa7c2('0x24')](handleEntityNotFound(_0x24ebf7,null))[_0xa7c2('0x24')](removeEntity(_0x24ebf7,null))[_0xa7c2('0x40')](handleError(_0x24ebf7,null));};exports[_0xa7c2('0x47')]=function(_0x3d5dc1,_0x9736d2){return db['ChatTransferReport'][_0xa7c2('0x47')]()[_0xa7c2('0x24')](respondWithResult(_0x9736d2,null))[_0xa7c2('0x40')](handleError(_0x9736d2,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index ea3874b..8428e8c 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 _0xdc0d=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','report_chat_transfer','uniqueid','lodash'];(function(_0x1b2704,_0x567fc8){var _0x553084=function(_0x5bb87c){while(--_0x5bb87c){_0x1b2704['push'](_0x1b2704['shift']());}};_0x553084(++_0x567fc8);}(_0xdc0d,0xc2));var _0xddc0=function(_0x18d5f7,_0x503a18){_0x18d5f7=_0x18d5f7-0x0;var _0xae207=_0xdc0d[_0x18d5f7];return _0xae207;};'use strict';var _=require(_0xddc0('0x0'));var util=require(_0xddc0('0x1'));var logger=require(_0xddc0('0x2'))(_0xddc0('0x3'));var moment=require(_0xddc0('0x4'));var BPromise=require('bluebird');var rp=require(_0xddc0('0x5'));var fs=require('fs');var path=require(_0xddc0('0x6'));var rimraf=require(_0xddc0('0x7'));var config=require(_0xddc0('0x8'));var attributes=require(_0xddc0('0x9'));module[_0xddc0('0xa')]=function(_0xca167a,_0x366782){return _0xca167a['define']('ChatTransferReport',attributes,{'tableName':_0xddc0('0xb'),'paranoid':![],'indexes':[{'name':_0xddc0('0xc'),'fields':[_0xddc0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4468=['define','ChatTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./chatTransferReport.attributes'];(function(_0x149f9f,_0x43fc13){var _0x47646c=function(_0x1557eb){while(--_0x1557eb){_0x149f9f['push'](_0x149f9f['shift']());}};_0x47646c(++_0x43fc13);}(_0x4468,0xdb));var _0x8446=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4468[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x8446('0x0'));var util=require(_0x8446('0x1'));var logger=require(_0x8446('0x2'))(_0x8446('0x3'));var moment=require(_0x8446('0x4'));var BPromise=require(_0x8446('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8446('0x6'));var rimraf=require('rimraf');var config=require(_0x8446('0x7'));var attributes=require(_0x8446('0x8'));module['exports']=function(_0x3c452e,_0x1a0ae8){return _0x3c452e[_0x8446('0x9')](_0x8446('0xa'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x8446('0xb'),'fields':[_0x8446('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index c7f8e90..85d89e1 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 _0x5d49=['code','message','ChatTransferReport,\x20%s,\x20%s','result','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x5dc03e,_0x54e60c){var _0x466a07=function(_0x2ce0cd){while(--_0x2ce0cd){_0x5dc03e['push'](_0x5dc03e['shift']());}};_0x466a07(++_0x54e60c);}(_0x5d49,0xa5));var _0x95d4=function(_0x472813,_0x34f529){_0x472813=_0x472813-0x0;var _0xbca655=_0x5d49[_0x472813];return _0xbca655;};'use strict';var _=require('lodash');var util=require(_0x95d4('0x0'));var moment=require('moment');var BPromise=require(_0x95d4('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x95d4('0x2'));var db=require(_0x95d4('0x3'))['db'];var utils=require(_0x95d4('0x4'));var logger=require(_0x95d4('0x5'))(_0x95d4('0x6'));var config=require(_0x95d4('0x7'));var jayson=require(_0x95d4('0x8'));var client=jayson[_0x95d4('0x9')][_0x95d4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36ad21,_0x16996c,_0x3aa01a){return new BPromise(function(_0x119959,_0x3c6c5d){return client[_0x95d4('0xb')](_0x36ad21,_0x3aa01a)[_0x95d4('0xc')](function(_0x37b1db){logger[_0x95d4('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x16996c,'request\x20sent');logger[_0x95d4('0xe')](_0x95d4('0xf'),_0x16996c,_0x95d4('0x10'),JSON[_0x95d4('0x11')](_0x37b1db));if(_0x37b1db[_0x95d4('0x12')]){if(_0x37b1db['error'][_0x95d4('0x13')]===0x1f4){logger[_0x95d4('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x16996c,_0x37b1db[_0x95d4('0x12')][_0x95d4('0x14')]);return _0x3c6c5d(_0x37b1db[_0x95d4('0x12')]['message']);}logger[_0x95d4('0x12')](_0x95d4('0x15'),_0x16996c,_0x37b1db[_0x95d4('0x12')][_0x95d4('0x14')]);return _0x119959(_0x37b1db[_0x95d4('0x12')]['message']);}else{logger[_0x95d4('0xd')](_0x95d4('0x15'),_0x16996c,_0x95d4('0x10'));_0x119959(_0x37b1db[_0x95d4('0x16')][_0x95d4('0x14')]);}})['catch'](function(_0x4e1708){logger[_0x95d4('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x16996c,_0x4e1708);_0x3c6c5d(_0x4e1708);});});} \ No newline at end of file +var _0xb9db=['ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x69a451,_0x49fd37){var _0x3d6ef5=function(_0x27ebf4){while(--_0x27ebf4){_0x69a451['push'](_0x69a451['shift']());}};_0x3d6ef5(++_0x49fd37);}(_0xb9db,0x100));var _0xbb9d=function(_0x478be4,_0x3b66b3){_0x478be4=_0x478be4-0x0;var _0x32c979=_0xb9db[_0x478be4];return _0x32c979;};'use strict';var _=require(_0xbb9d('0x0'));var util=require(_0xbb9d('0x1'));var moment=require(_0xbb9d('0x2'));var BPromise=require(_0xbb9d('0x3'));var rs=require(_0xbb9d('0x4'));var fs=require('fs');var Redis=require(_0xbb9d('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbb9d('0x6'))(_0xbb9d('0x7'));var config=require(_0xbb9d('0x8'));var jayson=require(_0xbb9d('0x9'));var client=jayson[_0xbb9d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12ecf6,_0x537aac,_0x3edc19){return new BPromise(function(_0x14d7a1,_0x202d12){return client[_0xbb9d('0xb')](_0x12ecf6,_0x3edc19)[_0xbb9d('0xc')](function(_0x46ff5f){logger[_0xbb9d('0xd')](_0xbb9d('0xe'),_0x537aac,_0xbb9d('0xf'));logger[_0xbb9d('0x10')](_0xbb9d('0x11'),_0x537aac,_0xbb9d('0xf'),JSON[_0xbb9d('0x12')](_0x46ff5f));if(_0x46ff5f[_0xbb9d('0x13')]){if(_0x46ff5f[_0xbb9d('0x13')]['code']===0x1f4){logger['error'](_0xbb9d('0xe'),_0x537aac,_0x46ff5f[_0xbb9d('0x13')][_0xbb9d('0x14')]);return _0x202d12(_0x46ff5f[_0xbb9d('0x13')]['message']);}logger[_0xbb9d('0x13')](_0xbb9d('0xe'),_0x537aac,_0x46ff5f['error'][_0xbb9d('0x14')]);return _0x14d7a1(_0x46ff5f['error'][_0xbb9d('0x14')]);}else{logger['info'](_0xbb9d('0xe'),_0x537aac,_0xbb9d('0xf'));_0x14d7a1(_0x46ff5f['result']['message']);}})['catch'](function(_0x4f7b7e){logger['error'](_0xbb9d('0xe'),_0x537aac,_0x4f7b7e);_0x202d12(_0x4f7b7e);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 3fb0c6e..5abf474 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 _0xaf49=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','show','post','put','update','delete','/:id','destroy','exports','multer','util'];(function(_0x2a67fe,_0x295c09){var _0x57e726=function(_0x280573){while(--_0x280573){_0x2a67fe['push'](_0x2a67fe['shift']());}};_0x57e726(++_0x295c09);}(_0xaf49,0x1a0));var _0x9af4=function(_0x5bedbf,_0x114ef4){_0x5bedbf=_0x5bedbf-0x0;var _0x46288f=_0xaf49[_0x5bedbf];return _0x46288f;};'use strict';var multer=require(_0x9af4('0x0'));var util=require(_0x9af4('0x1'));var path=require(_0x9af4('0x2'));var timeout=require(_0x9af4('0x3'));var express=require('express');var router=express[_0x9af4('0x4')]();var fs_extra=require(_0x9af4('0x5'));var auth=require(_0x9af4('0x6'));var interaction=require(_0x9af4('0x7'));var config=require(_0x9af4('0x8'));var controller=require(_0x9af4('0x9'));router[_0x9af4('0xa')]('/',auth[_0x9af4('0xb')](),controller[_0x9af4('0xc')]);router[_0x9af4('0xa')](_0x9af4('0xd'),auth[_0x9af4('0xb')](),controller['describe']);router[_0x9af4('0xa')]('/:id',auth[_0x9af4('0xb')](),controller[_0x9af4('0xe')]);router[_0x9af4('0xf')]('/',auth[_0x9af4('0xb')](),controller['create']);router[_0x9af4('0x10')]('/:id',auth[_0x9af4('0xb')](),controller[_0x9af4('0x11')]);router[_0x9af4('0x12')](_0x9af4('0x13'),auth['isAuthenticated'](),controller[_0x9af4('0x14')]);module[_0x9af4('0x15')]=router; \ No newline at end of file +var _0x97c8=['delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','./chatTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','put','update'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x97c8,0x1a7));var _0x897c=function(_0x403ca6,_0x24e284){_0x403ca6=_0x403ca6-0x0;var _0x4e0e05=_0x97c8[_0x403ca6];return _0x4e0e05;};'use strict';var multer=require(_0x897c('0x0'));var util=require(_0x897c('0x1'));var path=require(_0x897c('0x2'));var timeout=require(_0x897c('0x3'));var express=require(_0x897c('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x897c('0x5'));var config=require('../../config/environment');var controller=require(_0x897c('0x6'));router['get']('/',auth[_0x897c('0x7')](),controller[_0x897c('0x8')]);router[_0x897c('0x9')](_0x897c('0xa'),auth[_0x897c('0x7')](),controller[_0x897c('0xb')]);router[_0x897c('0x9')](_0x897c('0xc'),auth[_0x897c('0x7')](),controller[_0x897c('0xd')]);router[_0x897c('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x897c('0xf')]('/:id',auth[_0x897c('0x7')](),controller[_0x897c('0x10')]);router[_0x897c('0x11')](_0x897c('0xc'),auth[_0x897c('0x7')](),controller[_0x897c('0x12')]);module[_0x897c('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 7661cb3..95c1280 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 _0xe21c=['Chat','Send','Contact\x20us','BOOLEAN','INTEGER','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','star','thumb','input','name','getDataValue','onlineForm','parse','setDataValue','stringify','textarea','Comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','exports','STRING','address','email','Agent','#011F6A','#ffffff','ENUM','rounded','squared','We\x20are\x20here!'];(function(_0x29113c,_0x91bb04){var _0x16e4a0=function(_0x33aa0f){while(--_0x33aa0f){_0x29113c['push'](_0x29113c['shift']());}};_0x16e4a0(++_0x91bb04);}(_0xe21c,0x12c));var _0xce21=function(_0x21090b,_0x39dd3b){_0x21090b=_0x21090b-0x0;var _0x3c68d7=_0xe21c[_0x21090b];return _0x3c68d7;};'use strict';var Sequelize=require(_0xce21('0x0'));var rs=require('randomstring');module[_0xce21('0x1')]={'name':{'type':Sequelize[_0xce21('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xce21('0x3')},'description':{'type':Sequelize[_0xce21('0x2')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xce21('0x4')},'mapKeyOffline':{'type':Sequelize[_0xce21('0x2')],'defaultValue':_0xce21('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xce21('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xce21('0x2')],'allowNull':![],'defaultValue':_0xce21('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xce21('0x2')],'allowNull':![],'defaultValue':_0xce21('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xce21('0x8')](_0xce21('0x9'),_0xce21('0xa')),'defaultValue':_0xce21('0x9')},'header_online':{'type':Sequelize[_0xce21('0x2')],'defaultValue':_0xce21('0xb')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xce21('0xc')},'offline_chat_button':{'type':Sequelize[_0xce21('0x2')],'defaultValue':_0xce21('0xd')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xce21('0xe')},'download_transcript':{'type':Sequelize[_0xce21('0xf')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xce21('0x10')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xce21('0x2')],'defaultValue':_0xce21('0x11')},'defaultWhiteLabel':{'type':Sequelize[_0xce21('0xf')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xce21('0x12')]},'closingQuestion':{'type':Sequelize[_0xce21('0x2')],'defaultValue':_0xce21('0x13')},'formSubmitSuccessMessage':{'type':Sequelize[_0xce21('0x2')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0xce21('0x2')],'defaultValue':_0xce21('0x14')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xce21('0x2')],'defaultValue':_0xce21('0x15')},'closingMessage':{'type':Sequelize[_0xce21('0x2')],'defaultValue':_0xce21('0x16')},'closingMessageButton':{'type':Sequelize[_0xce21('0x2')],'defaultValue':_0xce21('0xd')},'skipMessageButton':{'type':Sequelize[_0xce21('0x2')],'defaultValue':_0xce21('0x17')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xce21('0xf')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xce21('0xf')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xce21('0xf')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xce21('0x2')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0xce21('0x8')](_0xce21('0x18'),_0xce21('0x19')),'defaultValue':_0xce21('0x18')},'ratingStarsNumber':{'type':Sequelize[_0xce21('0x10')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xce21('0x1a'),'variable':null,'config':{'placeholder':_0xce21('0x1b'),'type':'text','required':!![]},'props':{'title':_0xce21('0x1b'),'helpText':''}},{'type':_0xce21('0x1a'),'props':{'title':_0xce21('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xce21('0x4'),'type':_0xce21('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xce21('0x1c')](_0xce21('0x1d'))?JSON[_0xce21('0x1e')](this['getDataValue'](_0xce21('0x1d'))):{};},'set':function(_0x371e85){return this[_0xce21('0x1f')](_0xce21('0x1d'),JSON[_0xce21('0x20')](_0x371e85));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xce21('0x20')]({'items':[{'type':_0xce21('0x1a'),'props':{'title':_0xce21('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xce21('0x4'),'type':'email'},'variable':null},{'type':_0xce21('0x21'),'config':{'placeholder':_0xce21('0x22')},'props':{'title':_0xce21('0x22'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xce21('0x1c')](_0xce21('0x23'))?JSON[_0xce21('0x1e')](this['getDataValue'](_0xce21('0x23'))):{};},'set':function(_0x1f66fb){return this[_0xce21('0x1f')](_0xce21('0x23'),JSON[_0xce21('0x20')](_0x1f66fb));}},'token':{'type':Sequelize[_0xce21('0x2')],'defaultValue':function(){return rs[_0xce21('0x24')]();}},'autoclose':{'type':Sequelize[_0xce21('0xf')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xce21('0xf')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xce21('0x2')]},'forwardOffline':{'type':Sequelize[_0xce21('0xf')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xce21('0x2')]},'waitingTitle':{'type':Sequelize[_0xce21('0x2')],'defaultValue':_0xce21('0x25')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xce21('0x26')},'offlineMessageSubject':{'type':Sequelize[_0xce21('0x2')],'defaultValue':_0xce21('0x27')},'offlineMessageBody':{'type':Sequelize[_0xce21('0x2')],'defaultValue':_0xce21('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0xce21('0xf')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xce21('0x2')],'defaultValue':_0xce21('0x29')},'skipUnmanaged':{'type':Sequelize[_0xce21('0x2')],'defaultValue':_0xce21('0x17')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xce21('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0xce21('0xf')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xce21('0x12')]},'showAgentAvatar':{'type':Sequelize[_0xce21('0xf')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xce21('0x2')]},'notificationTemplate':{'type':Sequelize[_0xce21('0x12')],'defaultValue':function(){return _0xce21('0x2a');}},'notificationSound':{'type':Sequelize[_0xce21('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xce21('0xf')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xce21('0x2')],'defaultValue':_0xce21('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xce21('0x2')],'defaultValue':_0xce21('0x2c')},'verticalAlignment':{'type':Sequelize[_0xce21('0x10')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xce21('0x2d')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0xce21('0xf')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xce21('0x10')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xce21('0x2')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xce21('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xce21('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xce21('0x2')],'defaultValue':_0xce21('0x2e')},'systemAvatar':{'type':Sequelize[_0xce21('0x12')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xce21('0x2f')},'mandatoryDisposition':{'type':Sequelize[_0xce21('0xf')],'defaultValue':![],'comment':_0xce21('0x30'),'set':function(_0x2a4857){if(!_0x2a4857)this[_0xce21('0x1f')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xce21('0x31'),_0x2a4857);}},'vidaooEscalation':{'type':Sequelize[_0xce21('0xf')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xce21('0x2')]},'vidaooTopic':{'type':Sequelize[_0xce21('0x2')],'allowNull':![],'defaultValue':_0xce21('0x32')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xce21('0x33');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xce21('0xf')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xce21('0x12')]}}; \ No newline at end of file +var _0x1a5f=['stringify','input','name','getDataValue','onlineForm','setDataValue','TEXT','textarea','Comments','parse','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','website_alias','bottom_right','alternate','#fafafa','System','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','exports','STRING','email','#011F6A','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','star','thumb','INTEGER'];(function(_0xaf06ee,_0x139d54){var _0x5e463e=function(_0x4338f5){while(--_0x4338f5){_0xaf06ee['push'](_0xaf06ee['shift']());}};_0x5e463e(++_0x139d54);}(_0x1a5f,0x1e4));var _0xf1a5=function(_0x428e88,_0x382058){_0x428e88=_0x428e88-0x0;var _0x1c7c9a=_0x1a5f[_0x428e88];return _0x1c7c9a;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xf1a5('0x0'));module[_0xf1a5('0x1')]={'name':{'type':Sequelize[_0xf1a5('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xf1a5('0x2')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0xf1a5('0x2')]},'mapKey':{'type':Sequelize[_0xf1a5('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0xf1a5('0x2')],'defaultValue':_0xf1a5('0x3')},'key':{'type':Sequelize[_0xf1a5('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xf1a5('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xf1a5('0x2')],'allowNull':![],'defaultValue':_0xf1a5('0x4'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xf1a5('0x2')],'allowNull':![],'defaultValue':_0xf1a5('0x4'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xf1a5('0x2')]},'animation':{'type':Sequelize[_0xf1a5('0x5')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xf1a5('0x6')](_0xf1a5('0x7'),_0xf1a5('0x8')),'defaultValue':_0xf1a5('0x7')},'header_online':{'type':Sequelize[_0xf1a5('0x2')],'defaultValue':_0xf1a5('0x9')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xf1a5('0xa')},'offline_chat_button':{'type':Sequelize[_0xf1a5('0x2')],'defaultValue':_0xf1a5('0xb')},'header_offline':{'type':Sequelize[_0xf1a5('0x2')],'defaultValue':_0xf1a5('0xc')},'download_transcript':{'type':Sequelize[_0xf1a5('0x5')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xf1a5('0x2')],'defaultValue':_0xf1a5('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0xf1a5('0x5')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xf1a5('0x2')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0xf1a5('0x2')],'defaultValue':_0xf1a5('0xe')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xf1a5('0x2')],'defaultValue':_0xf1a5('0xf')},'placeholderMessage':{'type':Sequelize[_0xf1a5('0x2')],'defaultValue':_0xf1a5('0x10')},'closingMessage':{'type':Sequelize[_0xf1a5('0x2')],'defaultValue':_0xf1a5('0x11')},'closingMessageButton':{'type':Sequelize[_0xf1a5('0x2')],'defaultValue':_0xf1a5('0xb')},'skipMessageButton':{'type':Sequelize[_0xf1a5('0x2')],'defaultValue':_0xf1a5('0x12')},'conditionAgreement':{'type':Sequelize[_0xf1a5('0x5')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xf1a5('0x5')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xf1a5('0x5')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xf1a5('0x5')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xf1a5('0x2')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0xf1a5('0x6')](_0xf1a5('0x13'),_0xf1a5('0x14')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xf1a5('0x15')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xf1a5('0x16')]({'items':[{'type':_0xf1a5('0x17'),'variable':null,'config':{'placeholder':'name','type':'text','required':!![]},'props':{'title':_0xf1a5('0x18'),'helpText':''}},{'type':_0xf1a5('0x17'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xf1a5('0x3'),'type':_0xf1a5('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xf1a5('0x19')](_0xf1a5('0x1a'))?JSON['parse'](this[_0xf1a5('0x19')](_0xf1a5('0x1a'))):{};},'set':function(_0x449642){return this[_0xf1a5('0x1b')](_0xf1a5('0x1a'),JSON['stringify'](_0x449642));}},'offlineForm':{'type':Sequelize[_0xf1a5('0x1c')],'defaultValue':function(){return JSON[_0xf1a5('0x16')]({'items':[{'type':_0xf1a5('0x17'),'props':{'title':_0xf1a5('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xf1a5('0x3'),'type':'email'},'variable':null},{'type':_0xf1a5('0x1d'),'config':{'placeholder':_0xf1a5('0x1e')},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xf1a5('0x19')]('offlineForm')?JSON[_0xf1a5('0x1f')](this[_0xf1a5('0x19')](_0xf1a5('0x20'))):{};},'set':function(_0x98da9c){return this['setDataValue'](_0xf1a5('0x20'),JSON[_0xf1a5('0x16')](_0x98da9c));}},'token':{'type':Sequelize[_0xf1a5('0x2')],'defaultValue':function(){return rs[_0xf1a5('0x21')]();}},'autoclose':{'type':Sequelize[_0xf1a5('0x5')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xf1a5('0x5')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xf1a5('0x2')]},'forwardOffline':{'type':Sequelize[_0xf1a5('0x5')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xf1a5('0x2')]},'waitingTitle':{'type':Sequelize[_0xf1a5('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0xf1a5('0x2')],'defaultValue':_0xf1a5('0x22')},'offlineMessageSubject':{'type':Sequelize[_0xf1a5('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xf1a5('0x2')],'defaultValue':_0xf1a5('0x23')},'enableUnmanagedNote':{'type':Sequelize[_0xf1a5('0x5')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xf1a5('0x2')],'defaultValue':_0xf1a5('0x24')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xf1a5('0x12')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0xf1a5('0x5')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xf1a5('0x5')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0xf1a5('0x5')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xf1a5('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[_0xf1a5('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf1a5('0x5')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0xf1a5('0x25')},'waitForTheAssignedAgent':{'type':Sequelize[_0xf1a5('0x15')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xf1a5('0x2')],'defaultValue':_0xf1a5('0x26')},'verticalAlignment':{'type':Sequelize[_0xf1a5('0x15')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xf1a5('0x27')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0xf1a5('0x1c')]},'showCustomerAvatar':{'type':Sequelize[_0xf1a5('0x5')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xf1a5('0x15')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xf1a5('0x2')],'allowNull':![],'defaultValue':_0xf1a5('0x28'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xf1a5('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf1a5('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf1a5('0x15')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xf1a5('0x2')],'defaultValue':_0xf1a5('0x29')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf1a5('0x15')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xf1a5('0x5')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x39f9a4){if(!_0x39f9a4)this[_0xf1a5('0x1b')](_0xf1a5('0x2a'),null);this[_0xf1a5('0x1b')](_0xf1a5('0x2b'),_0x39f9a4);}},'vidaooEscalation':{'type':Sequelize[_0xf1a5('0x5')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xf1a5('0x2')]},'vidaooTopic':{'type':Sequelize[_0xf1a5('0x2')],'allowNull':![],'defaultValue':_0xf1a5('0x2c')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xf1a5('0x2d');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xf1a5('0x1c')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 26a6bb3..2fe42e6 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 _0x5599=['interaction','firstName','messageId','created','autoclose','push','*,*,*,*','ChatMessage','contact','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','describe','ListId','send','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','mimetype','server','attachments','offline-chat','basename','sequelize','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','auth','SendMail','sendMail','\x22%s\x22\x20<%s>','email','openNewInteraction','MailAccountId','originalname','subjectOffline','mapValues','offlineMessageSubject','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','interval','iftime\x20%s','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','No\x20timezone','inspect','Interval','virtual','License','increment','Intervals','all','some','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','color_button','backgroundColor','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','sendStatus','getApplications','addProactiveActions','getProactiveActions','getFields','false','offlineForm','onlineForm','items','fromKey','Attachments','addAgents','spread','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','ejs','fs-extra','lodash','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./chatWebsite.socket','register','jayson/promise','client','http','request','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','end','status','offset','undefined','limit','count','set','Content-Range','json','update','then','ChatWebsites','destroy','stack','name','index','Pause','mandatoryDispositionPause','map','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','ChatWebsite','includeAll','params','keys','include','create','body','role','user','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','rawAttributes','findAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','order','removeAnswers','addLogo','sitepic','file','filename','addAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','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','user-agent','getResult','CmContact','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','from','Sequelize','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','List','Contacts','DESC','Applications','account','applications','list','orderBy','priority','asc','customerIp','headers','cf-connecting-ip','first','x-forwarded-for','lastName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','%s\x20%s\x20%s','vendor','threadId','ChatInteraction','externalUrl'];(function(_0x437d7f,_0x1feb46){var _0x31058c=function(_0x49dd1a){while(--_0x49dd1a){_0x437d7f['push'](_0x437d7f['shift']());}};_0x31058c(++_0x1feb46);}(_0x5599,0x1b1));var _0x9559=function(_0x3edc7a,_0x39cdf0){_0x3edc7a=_0x3edc7a-0x0;var _0x1655b8=_0x5599[_0x3edc7a];return _0x1655b8;};'use strict';var BPromise=require(_0x9559('0x0'));var Mustache=require(_0x9559('0x1'));var util=require(_0x9559('0x2'));var path=require(_0x9559('0x3'));var ejs=require(_0x9559('0x4'));var fs=require('fs');var fs_extra=require(_0x9559('0x5'));var _=require(_0x9559('0x6'));var querystring=require(_0x9559('0x7'));var Redis=require('ioredis');var qs=require(_0x9559('0x8'));var logger=require(_0x9559('0x9'))(_0x9559('0xa'));var config=require(_0x9559('0xb'));var db=require(_0x9559('0xc'))['db'];config['redis']=_[_0x9559('0xd')](config['redis'],{'host':_0x9559('0xe'),'port':0x18eb});var socket=require(_0x9559('0xf'))(new Redis(config[_0x9559('0x10')]));require(_0x9559('0x11'))[_0x9559('0x12')](socket);var jayson=require(_0x9559('0x13'));var client=jayson[_0x9559('0x14')]['http']({'port':0x232c});var client9002=jayson[_0x9559('0x14')][_0x9559('0x15')]({'port':0x232a});var client9003=jayson['client']['http']({'port':0x232b});var client9001=jayson[_0x9559('0x14')][_0x9559('0x15')]({'port':0x2329});function respondWithRpcPromise(_0x420b1f,_0x5cf79a,_0x3d0d89,_0x389862){return new BPromise(function(_0x3e4df9,_0x103449){var _0xdf0fe7=_0x389862||client;return _0xdf0fe7[_0x9559('0x16')](_0x420b1f,_0x3d0d89)['then'](function(_0x115145){logger[_0x9559('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x5cf79a,_0x9559('0x18'));logger[_0x9559('0x19')](_0x9559('0x1a'),_0x5cf79a,_0x9559('0x18'),JSON[_0x9559('0x1b')](_0x115145));if(_0x115145[_0x9559('0x1c')]){if(_0x115145[_0x9559('0x1c')][_0x9559('0x1d')]===0x1f4){logger[_0x9559('0x1c')](_0x9559('0x1e'),_0x5cf79a,_0x115145['error']['message']);return _0x103449(_0x115145[_0x9559('0x1c')][_0x9559('0x1f')]);}logger['error'](_0x9559('0x1e'),_0x5cf79a,_0x115145['error'][_0x9559('0x1f')]);return _0x3e4df9(_0x115145[_0x9559('0x1c')]['message']);}else{logger[_0x9559('0x17')](_0x9559('0x1e'),_0x5cf79a,'request\x20sent');_0x3e4df9(_0x115145[_0x9559('0x20')]['message']);}})[_0x9559('0x21')](function(_0x4bb829){logger['error'](_0x9559('0x1e'),_0x5cf79a,_0x4bb829);_0x103449(_0x4bb829);});});}function respondWithStatusCode(_0x3ca0b8,_0x2e6ece){_0x2e6ece=_0x2e6ece||0xcc;return function(_0x38bf42){if(_0x38bf42){return _0x3ca0b8['sendStatus'](_0x2e6ece);}return _0x3ca0b8['status'](_0x2e6ece)[_0x9559('0x22')]();};}function respondWithResult(_0x20bfe8,_0x404252){_0x404252=_0x404252||0xc8;return function(_0x3f1e93){if(_0x3f1e93){return _0x20bfe8[_0x9559('0x23')](_0x404252)['json'](_0x3f1e93);}};}function respondWithFilteredResult(_0x2531ef,_0x7ff854){return function(_0x1c6362){if(_0x1c6362){var _0x314a21=typeof _0x7ff854[_0x9559('0x24')]===_0x9559('0x25')&&typeof _0x7ff854[_0x9559('0x26')]===_0x9559('0x25');var _0x23f4e4=_0x1c6362[_0x9559('0x27')];var _0x3eecfc=_0x314a21?0x0:_0x7ff854['offset'];var _0x1d3a8b=_0x314a21?_0x1c6362['count']:_0x7ff854[_0x9559('0x24')]+_0x7ff854[_0x9559('0x26')];var _0x415d1a;if(_0x1d3a8b>=_0x23f4e4){_0x1d3a8b=_0x23f4e4;_0x415d1a=0xc8;}else{_0x415d1a=0xce;}_0x2531ef['status'](_0x415d1a);return _0x2531ef[_0x9559('0x28')](_0x9559('0x29'),_0x3eecfc+'-'+_0x1d3a8b+'/'+_0x23f4e4)[_0x9559('0x2a')](_0x1c6362);}return null;};}function saveUpdates(_0x1cd76b){return function(_0x2adb83){if(_0x2adb83){return _0x2adb83[_0x9559('0x2b')](_0x1cd76b)[_0x9559('0x2c')](function(_0x3b4263){return _0x3b4263;});}return null;};}function removeEntity(_0xa30dbd){return function(_0x53e815){if(_0x53e815){return _0x53e815['destroy']()[_0x9559('0x2c')](function(){var _0x5beccb=_0x53e815['get']({'plain':!![]});var _0x2afa8e=_0x9559('0x2d');return db['UserProfileResource'][_0x9559('0x2e')]({'where':{'type':_0x2afa8e,'resourceId':_0x5beccb['id']}})[_0x9559('0x2c')](function(){return _0x53e815;});})[_0x9559('0x2c')](function(){_0xa30dbd[_0x9559('0x23')](0xcc)[_0x9559('0x22')]();});}};}function handleEntityNotFound(_0x534254){return function(_0x41e85a){if(!_0x41e85a){_0x534254['sendStatus'](0x194);}return _0x41e85a;};}function handleError(_0x140b4b,_0x474b4a){_0x474b4a=_0x474b4a||0x1f4;return function(_0x4aafee){logger[_0x9559('0x1c')](_0x4aafee[_0x9559('0x2f')]);if(_0x4aafee[_0x9559('0x30')]){delete _0x4aafee[_0x9559('0x30')];}_0x140b4b[_0x9559('0x23')](_0x474b4a)['send'](_0x4aafee);};}exports[_0x9559('0x31')]=function(_0x1165e0,_0x4a125e){var _0x48be77={'include':[{'model':db[_0x9559('0x32')],'as':_0x9559('0x33')}]},_0x16f8de={},_0x43a459={'count':0x0,'rows':[]};var _0xdc342=_[_0x9559('0x34')](db['ChatWebsite']['rawAttributes'],function(_0x1b911a){return{'name':_0x1b911a[_0x9559('0x35')],'type':_0x1b911a['type'][_0x9559('0x36')]};});_0x16f8de[_0x9559('0x37')]=_[_0x9559('0x34')](_0xdc342,_0x9559('0x30'));_0x16f8de[_0x9559('0x38')]=_['keys'](_0x1165e0['query']);_0x16f8de[_0x9559('0x39')]=_['intersection'](_0x16f8de['model'],_0x16f8de['query']);_0x48be77[_0x9559('0x3a')]=_[_0x9559('0x3b')](_0x16f8de['model'],qs[_0x9559('0x3c')](_0x1165e0[_0x9559('0x38')][_0x9559('0x3c')]));_0x48be77[_0x9559('0x3a')]=_0x48be77[_0x9559('0x3a')][_0x9559('0x3d')]?_0x48be77[_0x9559('0x3a')]:_0x16f8de[_0x9559('0x37')];if(!_0x1165e0[_0x9559('0x38')][_0x9559('0x3e')](_0x9559('0x3f'))){_0x48be77[_0x9559('0x26')]=qs[_0x9559('0x26')](_0x1165e0[_0x9559('0x38')][_0x9559('0x26')]);_0x48be77[_0x9559('0x24')]=qs[_0x9559('0x24')](_0x1165e0[_0x9559('0x38')][_0x9559('0x24')]);}_0x48be77['order']=qs[_0x9559('0x40')](_0x1165e0[_0x9559('0x38')][_0x9559('0x40')]);_0x48be77[_0x9559('0x41')]=qs[_0x9559('0x39')](_[_0x9559('0x42')](_0x1165e0[_0x9559('0x38')],_0x16f8de['filters']),_0xdc342);if(_0x1165e0[_0x9559('0x38')]['filter']){_0x48be77[_0x9559('0x41')]=_[_0x9559('0x43')](_0x48be77[_0x9559('0x41')],{'$or':_['map'](_0xdc342,function(_0x1e23bb){if(_0x1e23bb['type']!=='VIRTUAL'){var _0x32ec62={};_0x32ec62[_0x1e23bb[_0x9559('0x30')]]={'$like':'%'+_0x1165e0[_0x9559('0x38')][_0x9559('0x44')]+'%'};return _0x32ec62;}})});}_0x48be77=_['merge']({},_0x48be77,_0x1165e0[_0x9559('0x45')]);var _0x37f237={'where':_0x48be77['where']};return db[_0x9559('0x46')][_0x9559('0x27')](_0x37f237)[_0x9559('0x2c')](function(_0x50b350){_0x43a459[_0x9559('0x27')]=_0x50b350;if(_0x1165e0[_0x9559('0x38')][_0x9559('0x47')]){_0x48be77['include']=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0x48be77);})[_0x9559('0x2c')](function(_0x155916){_0x43a459['rows']=_0x155916;return _0x43a459;})[_0x9559('0x2c')](respondWithFilteredResult(_0x4a125e,_0x48be77))[_0x9559('0x21')](handleError(_0x4a125e,null));};exports['show']=function(_0x17cbc4,_0x51e5ce){var _0x511095={'raw':![],'where':{'id':_0x17cbc4[_0x9559('0x48')]['id']},'include':[{'model':db[_0x9559('0x32')],'as':'mandatoryDispositionPause'}]},_0x2c4eda={};_0x2c4eda[_0x9559('0x37')]=_[_0x9559('0x49')](db[_0x9559('0x46')]['rawAttributes']);_0x2c4eda[_0x9559('0x38')]=_[_0x9559('0x49')](_0x17cbc4['query']);_0x2c4eda[_0x9559('0x39')]=_['intersection'](_0x2c4eda[_0x9559('0x37')],_0x2c4eda[_0x9559('0x38')]);_0x511095[_0x9559('0x3a')]=_[_0x9559('0x3b')](_0x2c4eda[_0x9559('0x37')],qs[_0x9559('0x3c')](_0x17cbc4['query'][_0x9559('0x3c')]));_0x511095[_0x9559('0x3a')]=_0x511095[_0x9559('0x3a')][_0x9559('0x3d')]?_0x511095[_0x9559('0x3a')]:_0x2c4eda[_0x9559('0x37')];if(_0x17cbc4[_0x9559('0x38')][_0x9559('0x47')]){_0x511095[_0x9559('0x4a')]=[{'all':!![]}];}_0x511095=_[_0x9559('0x43')]({},_0x511095,_0x17cbc4[_0x9559('0x45')]);return db[_0x9559('0x46')]['find'](_0x511095)[_0x9559('0x2c')](handleEntityNotFound(_0x51e5ce,null))[_0x9559('0x2c')](respondWithResult(_0x51e5ce,null))['catch'](handleError(_0x51e5ce,null));};exports[_0x9559('0x4b')]=function(_0x44344e,_0x46424d){return db['ChatWebsite']['create'](_0x44344e[_0x9559('0x4c')],{})['then'](function(_0x436ad9){var _0x24a0fc=_0x44344e['user']['get']({'plain':!![]});if(!_0x24a0fc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x24a0fc[_0x9559('0x4d')]===_0x9559('0x4e')){var _0x5645da=_0x436ad9[_0x9559('0x4f')]({'plain':!![]});var _0x27f361=_0x9559('0x2d');return db[_0x9559('0x50')]['find']({'where':{'name':_0x27f361,'userProfileId':_0x24a0fc[_0x9559('0x51')]},'raw':!![]})[_0x9559('0x2c')](function(_0x8a1ced){if(_0x8a1ced&&_0x8a1ced[_0x9559('0x52')]===0x0){return db[_0x9559('0x53')]['create']({'name':_0x5645da[_0x9559('0x30')],'resourceId':_0x5645da['id'],'type':_0x8a1ced[_0x9559('0x30')],'sectionId':_0x8a1ced['id']},{})[_0x9559('0x2c')](function(){return _0x436ad9;});}else{return _0x436ad9;}})['catch'](function(_0x11143e){logger[_0x9559('0x1c')](_0x9559('0x54'),_0x11143e);throw _0x11143e;});}return _0x436ad9;})[_0x9559('0x2c')](respondWithResult(_0x46424d,0xc9))['catch'](handleError(_0x46424d,null));};exports[_0x9559('0x2b')]=function(_0x4343b5,_0x28b179){if(_0x4343b5['body']['id']){delete _0x4343b5[_0x9559('0x4c')]['id'];}return db[_0x9559('0x46')][_0x9559('0x55')]({'where':{'id':_0x4343b5[_0x9559('0x48')]['id']},'include':[{'model':db[_0x9559('0x32')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x28b179,null))[_0x9559('0x2c')](saveUpdates(_0x4343b5['body'],null))[_0x9559('0x2c')](respondWithResult(_0x28b179,null))[_0x9559('0x21')](handleError(_0x28b179,null));};exports[_0x9559('0x2e')]=function(_0x976b0b,_0x10a0ee){return db[_0x9559('0x46')][_0x9559('0x55')]({'where':{'id':_0x976b0b['params']['id']}})[_0x9559('0x2c')](handleEntityNotFound(_0x10a0ee,null))[_0x9559('0x2c')](removeEntity(_0x10a0ee,null))[_0x9559('0x21')](handleError(_0x10a0ee,null));};exports['describe']=function(_0x486dda,_0x2c7a36){return db[_0x9559('0x46')]['describe']()[_0x9559('0x2c')](respondWithResult(_0x2c7a36,null))[_0x9559('0x21')](handleError(_0x2c7a36,null));};exports[_0x9559('0x56')]=function(_0x4a7645,_0x30e051){if(_0x4a7645[_0x9559('0x4c')]['id']){delete _0x4a7645['body']['id'];}return db[_0x9559('0x46')]['find']({'where':{'id':_0x4a7645[_0x9559('0x48')]['id']}})[_0x9559('0x2c')](handleEntityNotFound(_0x30e051,null))[_0x9559('0x2c')](function(_0x582ca3){if(_0x582ca3){_0x4a7645[_0x9559('0x4c')][_0x9559('0x57')]=_0x582ca3['id'];return db[_0x9559('0x58')][_0x9559('0x4b')](_0x4a7645[_0x9559('0x4c')]);}})[_0x9559('0x2c')](respondWithResult(_0x30e051,null))[_0x9559('0x21')](handleError(_0x30e051,null));};exports[_0x9559('0x59')]=function(_0x684bb8,_0x22b602){var _0x2e8c30={'raw':![],'where':{}};var _0x468b1e={};var _0x5cbb40={'count':0x0,'rows':[]};return db[_0x9559('0x46')][_0x9559('0x5a')]({'where':{'id':_0x684bb8[_0x9559('0x48')]['id']}})['then'](handleEntityNotFound(_0x22b602,null))[_0x9559('0x2c')](function(_0x108533){if(_0x108533){_0x468b1e['model']=_[_0x9559('0x49')](db[_0x9559('0x58')][_0x9559('0x5b')]);_0x468b1e[_0x9559('0x38')]=_[_0x9559('0x49')](_0x684bb8[_0x9559('0x38')]);_0x468b1e[_0x9559('0x39')]=_['intersection'](_0x468b1e[_0x9559('0x37')],_0x468b1e[_0x9559('0x38')]);_0x2e8c30['attributes']=_[_0x9559('0x3b')](_0x468b1e[_0x9559('0x37')],qs[_0x9559('0x3c')](_0x684bb8[_0x9559('0x38')]['fields']));_0x2e8c30['attributes']=_0x2e8c30[_0x9559('0x3a')][_0x9559('0x3d')]?_0x2e8c30[_0x9559('0x3a')]:_0x468b1e[_0x9559('0x37')];if(!_0x684bb8['query']['hasOwnProperty'](_0x9559('0x3f'))){_0x2e8c30[_0x9559('0x26')]=qs[_0x9559('0x26')](_0x684bb8[_0x9559('0x38')][_0x9559('0x26')]);_0x2e8c30['offset']=qs[_0x9559('0x24')](_0x684bb8['query'][_0x9559('0x24')]);}_0x2e8c30['order']=qs[_0x9559('0x40')](_0x684bb8[_0x9559('0x38')][_0x9559('0x40')]);_0x2e8c30[_0x9559('0x41')]=qs[_0x9559('0x39')](_[_0x9559('0x42')](_0x684bb8[_0x9559('0x38')],_0x468b1e[_0x9559('0x39')]));_0x2e8c30[_0x9559('0x41')][_0x9559('0x57')]=_0x108533['id'];if(_0x684bb8[_0x9559('0x38')][_0x9559('0x44')]){_0x2e8c30['where']=_[_0x9559('0x43')](_0x2e8c30[_0x9559('0x41')],{'$or':_[_0x9559('0x34')](_0x2e8c30[_0x9559('0x3a')],function(_0x13217d){var _0x482856={};_0x482856[_0x13217d]={'$like':'%'+_0x684bb8['query'][_0x9559('0x44')]+'%'};return _0x482856;})});}_0x2e8c30=_[_0x9559('0x43')]({},_0x2e8c30,_0x684bb8[_0x9559('0x45')]);return db[_0x9559('0x58')][_0x9559('0x27')]({'where':_0x2e8c30[_0x9559('0x41')]})[_0x9559('0x2c')](function(_0x430712){_0x5cbb40['count']=_0x430712;if(_0x684bb8['query'][_0x9559('0x47')]){_0x2e8c30['include']=[{'all':!![]}];}return db['Disposition'][_0x9559('0x5c')](_0x2e8c30);})[_0x9559('0x2c')](function(_0xa640dc){_0x5cbb40[_0x9559('0x5d')]=_0xa640dc;return _0x5cbb40;});}})[_0x9559('0x2c')](respondWithFilteredResult(_0x22b602,_0x2e8c30))[_0x9559('0x21')](handleError(_0x22b602,null));};exports['removeDispositions']=function(_0x4d1225,_0x24b3da){return db[_0x9559('0x46')]['find']({'where':{'id':_0x4d1225[_0x9559('0x48')]['id']}})[_0x9559('0x2c')](handleEntityNotFound(_0x24b3da,null))['then'](function(_0x1529f4){if(_0x1529f4){return _0x1529f4[_0x9559('0x5e')](_0x4d1225['query'][_0x9559('0x5f')]);}})[_0x9559('0x2c')](respondWithStatusCode(_0x24b3da,null))[_0x9559('0x21')](handleError(_0x24b3da,null));};exports[_0x9559('0x60')]=function(_0x4e0e09,_0xd866c5){if(_0x4e0e09[_0x9559('0x4c')]['id']){delete _0x4e0e09[_0x9559('0x4c')]['id'];}return db['ChatWebsite'][_0x9559('0x55')]({'where':{'id':_0x4e0e09['params']['id']}})[_0x9559('0x2c')](handleEntityNotFound(_0xd866c5,null))[_0x9559('0x2c')](function(_0x5ebe99){if(_0x5ebe99){_0x4e0e09[_0x9559('0x4c')]['ChatWebsiteId']=_0x5ebe99['id'];return db[_0x9559('0x61')]['create'](_0x4e0e09['body']);}})[_0x9559('0x2c')](respondWithResult(_0xd866c5,null))[_0x9559('0x21')](handleError(_0xd866c5,null));};exports[_0x9559('0x62')]=function(_0x2911d2,_0x5b7e82){var _0x1f4c7c={'raw':![],'where':{}};var _0x3fc7eb={};var _0x261c21={'count':0x0,'rows':[]};return db[_0x9559('0x46')]['findOne']({'where':{'id':_0x2911d2[_0x9559('0x48')]['id']}})[_0x9559('0x2c')](handleEntityNotFound(_0x5b7e82,null))['then'](function(_0x52b2a4){if(_0x52b2a4){_0x3fc7eb[_0x9559('0x37')]=_['keys'](db[_0x9559('0x61')]['rawAttributes']);_0x3fc7eb[_0x9559('0x38')]=_[_0x9559('0x49')](_0x2911d2[_0x9559('0x38')]);_0x3fc7eb[_0x9559('0x39')]=_['intersection'](_0x3fc7eb['model'],_0x3fc7eb[_0x9559('0x38')]);_0x1f4c7c['attributes']=_[_0x9559('0x3b')](_0x3fc7eb[_0x9559('0x37')],qs['fields'](_0x2911d2[_0x9559('0x38')][_0x9559('0x3c')]));_0x1f4c7c[_0x9559('0x3a')]=_0x1f4c7c[_0x9559('0x3a')][_0x9559('0x3d')]?_0x1f4c7c[_0x9559('0x3a')]:_0x3fc7eb[_0x9559('0x37')];if(!_0x2911d2['query'][_0x9559('0x3e')]('nolimit')){_0x1f4c7c[_0x9559('0x26')]=qs['limit'](_0x2911d2[_0x9559('0x38')][_0x9559('0x26')]);_0x1f4c7c[_0x9559('0x24')]=qs['offset'](_0x2911d2['query'][_0x9559('0x24')]);}_0x1f4c7c[_0x9559('0x63')]=qs[_0x9559('0x40')](_0x2911d2[_0x9559('0x38')][_0x9559('0x40')]);_0x1f4c7c[_0x9559('0x41')]=qs['filters'](_[_0x9559('0x42')](_0x2911d2[_0x9559('0x38')],_0x3fc7eb[_0x9559('0x39')]));_0x1f4c7c[_0x9559('0x41')][_0x9559('0x57')]=_0x52b2a4['id'];if(_0x2911d2[_0x9559('0x38')][_0x9559('0x44')]){_0x1f4c7c[_0x9559('0x41')]=_[_0x9559('0x43')](_0x1f4c7c[_0x9559('0x41')],{'$or':_['map'](_0x1f4c7c[_0x9559('0x3a')],function(_0x3ca8f2){var _0xb0f071={};_0xb0f071[_0x3ca8f2]={'$like':'%'+_0x2911d2[_0x9559('0x38')]['filter']+'%'};return _0xb0f071;})});}_0x1f4c7c=_['merge']({},_0x1f4c7c,_0x2911d2[_0x9559('0x45')]);return db[_0x9559('0x61')][_0x9559('0x27')]({'where':_0x1f4c7c['where']})[_0x9559('0x2c')](function(_0x40e097){_0x261c21[_0x9559('0x27')]=_0x40e097;if(_0x2911d2[_0x9559('0x38')][_0x9559('0x47')]){_0x1f4c7c[_0x9559('0x4a')]=[{'all':!![]}];}return db['CannedAnswer'][_0x9559('0x5c')](_0x1f4c7c);})[_0x9559('0x2c')](function(_0x40d58d){_0x261c21[_0x9559('0x5d')]=_0x40d58d;return _0x261c21;});}})[_0x9559('0x2c')](respondWithFilteredResult(_0x5b7e82,_0x1f4c7c))[_0x9559('0x21')](handleError(_0x5b7e82,null));};exports['removeAnswers']=function(_0x106b73,_0x87c948){return db[_0x9559('0x46')][_0x9559('0x55')]({'where':{'id':_0x106b73[_0x9559('0x48')]['id']}})[_0x9559('0x2c')](handleEntityNotFound(_0x87c948,null))[_0x9559('0x2c')](function(_0x4acf71){if(_0x4acf71){return _0x4acf71[_0x9559('0x64')](_0x106b73[_0x9559('0x38')]['ids']);}})[_0x9559('0x2c')](respondWithStatusCode(_0x87c948,null))[_0x9559('0x21')](handleError(_0x87c948,null));};exports[_0x9559('0x65')]=function(_0x4f3b3d,_0x13836d){_0x4f3b3d[_0x9559('0x4c')][_0x9559('0x66')]=_0x4f3b3d[_0x9559('0x67')][_0x9559('0x68')];return db['ChatWebsite'][_0x9559('0x55')]({'where':{'id':_0x4f3b3d['params']['id']}})['then'](handleEntityNotFound(_0x13836d,null))[_0x9559('0x2c')](saveUpdates(_0x4f3b3d[_0x9559('0x4c')],null))['then'](respondWithResult(_0x13836d,null))[_0x9559('0x21')](handleError(_0x13836d,null));};exports[_0x9559('0x69')]=function(_0x2c5221,_0x2baa06){_0x2c5221[_0x9559('0x4c')]['agentAvatar']=_0x2c5221['file'][_0x9559('0x68')];return db[_0x9559('0x46')][_0x9559('0x55')]({'where':{'id':_0x2c5221[_0x9559('0x48')]['id']}})[_0x9559('0x2c')](handleEntityNotFound(_0x2baa06,null))[_0x9559('0x2c')](saveUpdates(_0x2c5221['body'],null))['then'](respondWithResult(_0x2baa06,null))['catch'](handleError(_0x2baa06,null));};exports[_0x9559('0x6a')]=function(_0x2e4b00,_0x45a4d9){_0x2e4b00[_0x9559('0x4c')][_0x9559('0x6b')]=_0x2e4b00[_0x9559('0x67')][_0x9559('0x68')];return db[_0x9559('0x46')][_0x9559('0x55')]({'where':{'id':_0x2e4b00[_0x9559('0x48')]['id']}})[_0x9559('0x2c')](handleEntityNotFound(_0x45a4d9,null))[_0x9559('0x2c')](saveUpdates(_0x2e4b00[_0x9559('0x4c')],null))[_0x9559('0x2c')](respondWithResult(_0x45a4d9,null))[_0x9559('0x21')](handleError(_0x45a4d9,null));};exports[_0x9559('0x6c')]=function(_0x21059c,_0x3d1b1c){_0x21059c['body'][_0x9559('0x6d')]=_0x21059c[_0x9559('0x67')]['filename'];return db[_0x9559('0x46')][_0x9559('0x55')]({'where':{'id':_0x21059c[_0x9559('0x48')]['id']}})[_0x9559('0x2c')](handleEntityNotFound(_0x3d1b1c,null))[_0x9559('0x2c')](saveUpdates(_0x21059c['body'],null))[_0x9559('0x2c')](respondWithResult(_0x3d1b1c,null))['catch'](handleError(_0x3d1b1c,null));};exports['getLogo']=function(_0x3da51f,_0x4a0789){var _0x281b90=path[_0x9559('0x6e')](config[_0x9559('0x6f')],_0x9559('0x70'));var _0x96a5d5={'where':{'id':_0x3da51f[_0x9559('0x48')]['id']},'attributes':['id',_0x9559('0x66')],'raw':!![]};var _0x430129=![];return require(_0x9559('0x71'))[_0x9559('0x72')]()[_0x9559('0x2c')](function(_0xbd18dc){if(_0xbd18dc){_0x430129=_0xbd18dc[_0x9559('0x73')];}})[_0x9559('0x2c')](function(){return db[_0x9559('0x46')]['find'](_0x96a5d5);})[_0x9559('0x2c')](handleEntityNotFound(_0x4a0789,null))[_0x9559('0x2c')](function(_0x23bb36){if(_0x23bb36){if(!_[_0x9559('0x74')](_0x23bb36[_0x9559('0x66')])){if(fs[_0x9559('0x75')](path[_0x9559('0x6e')](config[_0x9559('0x6f')],_0x9559('0x76'),_0x23bb36['sitepic']))&&_0x430129){_0x281b90=path[_0x9559('0x6e')](config[_0x9559('0x6f')],_0x9559('0x76'),_0x23bb36[_0x9559('0x66')]);}}return _0x4a0789[_0x9559('0x77')](_0x281b90);}})[_0x9559('0x21')](handleError(_0x4a0789,null));};exports['getAvatar']=function(_0x3e743b,_0x5e551c){var _0x4711ec=path[_0x9559('0x6e')](config[_0x9559('0x6f')],_0x9559('0x78'));var _0x1ac4d3={'where':{'id':_0x3e743b['params']['id']},'attributes':['id',_0x9559('0x79')],'raw':!![]};return db[_0x9559('0x46')][_0x9559('0x55')](_0x1ac4d3)[_0x9559('0x2c')](handleEntityNotFound(_0x5e551c,null))[_0x9559('0x2c')](function(_0x27d320){if(_0x27d320){if(!_[_0x9559('0x74')](_0x27d320[_0x9559('0x79')])){if(fs[_0x9559('0x75')](path[_0x9559('0x6e')](config['root'],_0x9559('0x7a'),_0x27d320[_0x9559('0x79')]))){_0x4711ec=path[_0x9559('0x6e')](config[_0x9559('0x6f')],_0x9559('0x7a'),_0x27d320[_0x9559('0x79')]);}}return _0x5e551c[_0x9559('0x77')](_0x4711ec);}})[_0x9559('0x21')](handleError(_0x5e551c,null));};exports[_0x9559('0x7b')]=function(_0x9e066b,_0x14c6f2){var _0x1f633c=path[_0x9559('0x6e')](config[_0x9559('0x6f')],_0x9559('0x7c'));var _0xdc549b={'where':{'id':_0x9e066b['params']['id']},'attributes':['id',_0x9559('0x6b'),'showCustomerAvatar'],'raw':!![]};return db[_0x9559('0x46')][_0x9559('0x55')](_0xdc549b)[_0x9559('0x2c')](handleEntityNotFound(_0x14c6f2,null))[_0x9559('0x2c')](function(_0x376b4b){if(_0x376b4b){if(!_[_0x9559('0x74')](_0x376b4b['customerAvatar'])){if(fs['existsSync'](path[_0x9559('0x6e')](config[_0x9559('0x6f')],_0x9559('0x7a'),_0x376b4b[_0x9559('0x6b')]))&&_0x376b4b[_0x9559('0x7d')]){_0x1f633c=path[_0x9559('0x6e')](config[_0x9559('0x6f')],_0x9559('0x7a'),_0x376b4b[_0x9559('0x6b')]);}}return _0x14c6f2[_0x9559('0x77')](_0x1f633c);}})[_0x9559('0x21')](handleError(_0x14c6f2,null));};exports[_0x9559('0x7e')]=function(_0x1c25f8,_0x80b8e2){var _0x33886d=path['join'](config['root'],_0x9559('0x7f'));var _0x4543d0={'where':{'id':_0x1c25f8['params']['id']},'attributes':['id',_0x9559('0x6d')],'raw':!![]};return db[_0x9559('0x46')][_0x9559('0x55')](_0x4543d0)[_0x9559('0x2c')](handleEntityNotFound(_0x80b8e2,null))[_0x9559('0x2c')](function(_0x2899da){if(_0x2899da){if(!_[_0x9559('0x74')](_0x2899da['systemAvatar'])){if(fs[_0x9559('0x75')](path['join'](config[_0x9559('0x6f')],'server/files/images/avatars/',_0x2899da[_0x9559('0x6d')]))){_0x33886d=path[_0x9559('0x6e')](config[_0x9559('0x6f')],_0x9559('0x7a'),_0x2899da['systemAvatar']);}}return _0x80b8e2[_0x9559('0x77')](_0x33886d);}})[_0x9559('0x21')](handleError(_0x80b8e2,null));};exports[_0x9559('0x80')]=function(_0x1054ae,_0x1e900e){var _0x427827=require(_0x9559('0x81'));var _0x4142ce=new _0x427827();var _0x134caf=_0x4142ce['setUA'](_0x1054ae['headers'][_0x9559('0x82')])[_0x9559('0x83')]();var _0x2056c1={'body':_0x1054ae['body'],'channel':'chat'};var _0x54eb89=[];var _0x2ee4b5=[];var _0xd2011d={};var _0x1887a0=![];return db[_0x9559('0x84')]['describe']()[_0x9559('0x2c')](function(_0x422bfa){if(!_0x422bfa){throw new db['Sequelize'][(_0x9559('0x85'))](_0x9559('0x86'));}_0x54eb89=_[_0x9559('0x87')](_[_0x9559('0x49')](_0x422bfa),['createdAt',_0x9559('0x88')]);_0x2ee4b5=_['difference'](_['keys'](_0x422bfa),[_0x9559('0x89'),_0x9559('0x88'),_0x9559('0x8a'),'ListId']);if(_0x1054ae[_0x9559('0x4c')]['id']){delete _0x1054ae[_0x9559('0x4c')]['id'];}if(_['isNil'](_0x1054ae[_0x9559('0x4c')][_0x9559('0x8b')])){throw new db[(_0x9559('0x8c'))]['ValidationError'](_0x9559('0x8d'));}if(_['isNil'](_0x1054ae['body'][_0x9559('0x4c')])||_0x1054ae['body'][_0x9559('0x4c')]===''){throw new db[(_0x9559('0x8c'))][(_0x9559('0x85'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x1054ae[_0x9559('0x4c')]['mapKey'])){throw new db[(_0x9559('0x8c'))][(_0x9559('0x85'))](_0x9559('0x8e')+_0x2ee4b5);}if(!_[_0x9559('0x8f')](_0x2ee4b5,_0x1054ae[_0x9559('0x4c')]['mapKey'])){throw new db[(_0x9559('0x8c'))]['ValidationError'](_0x9559('0x90')+_0x2ee4b5);}_0xd2011d[_0x1054ae['body'][_0x9559('0x91')]]=_0x1054ae[_0x9559('0x4c')][_0x9559('0x8b')];})[_0x9559('0x2c')](function(){return db[_0x9559('0x46')][_0x9559('0x55')]({'where':{'id':_0x1054ae[_0x9559('0x48')]['id']},'include':[{'model':db['CmList'],'as':_0x9559('0x92'),'include':[{'model':db[_0x9559('0x84')],'as':_0x9559('0x93'),'where':_0xd2011d,'limit':0x1,'order':[[_0x9559('0x88'),_0x9559('0x94')]]}]},{'model':db['ChatApplication'],'as':_0x9559('0x95')}]});})['then'](handleEntityNotFound(_0x1e900e,null))[_0x9559('0x2c')](function(_0x16eb20){if(_0x16eb20&&_0x16eb20[_0x9559('0x92')]){_0x2056c1[_0x9559('0x96')]=_0x16eb20;_0x2056c1[_0x9559('0x97')]=_0x16eb20[_0x9559('0x95')];_0x2056c1[_0x9559('0x98')]=_0x16eb20[_0x9559('0x92')];_0x2056c1[_0x9559('0x97')]=_[_0x9559('0x99')](_0x2056c1[_0x9559('0x97')],[_0x9559('0x9a')],[_0x9559('0x9b')]);if(_0x2056c1[_0x9559('0x96')][_0x9559('0x95')]){delete _0x2056c1[_0x9559('0x96')][_0x9559('0x95')];}if(_0x2056c1[_0x9559('0x96')]['List']&&_0x2056c1['account'][_0x9559('0x92')][_0x9559('0x93')][_0x9559('0x3d')]){return _0x2056c1['account'][_0x9559('0x92')][_0x9559('0x93')][0x0];}var _0x303c3d=_['defaults'](_0x1054ae[_0x9559('0x4c')],{'firstName':_0x1054ae[_0x9559('0x4c')][_0x9559('0x8b')],'ListId':_0x16eb20['ListId']});_0x303c3d[_0x1054ae['body'][_0x9559('0x91')]]=_0x1054ae[_0x9559('0x4c')][_0x9559('0x8b')];return db['CmContact'][_0x9559('0x4b')](_0x303c3d,{'fields':_0x54eb89,'raw':!![]});}})[_0x9559('0x2c')](handleEntityNotFound(_0x1e900e,null))[_0x9559('0x2c')](function(_0x3fa37f){_0x2056c1['contact']=_0x3fa37f;var _0x57bd0a=_0x1054ae[_0x9559('0x4c')][_0x9559('0x9c')];if(_0x1054ae[_0x9559('0x9d')]['cf-connecting-ip']){_0x57bd0a=_0x1054ae['headers'][_0x9559('0x9e')];}else if(_0x1054ae['headers']['x-forwarded-for']){_0x57bd0a=_[_0x9559('0x9f')](_0x1054ae[_0x9559('0x9d')][_0x9559('0xa0')]['split'](','));}if(_0x3fa37f){var _0x30c8dd={'ContactId':_0x3fa37f['id'],'ChatWebsiteId':_0x1054ae[_0x9559('0x48')]['id'],'from':(_0x3fa37f['firstName']||'')+'\x20'+(_0x3fa37f[_0x9559('0xa1')]||''),'customerIp':_0x57bd0a,'customerPort':_0x1054ae['headers'][_0x9559('0xa2')]?_0x1054ae[_0x9559('0x9d')][_0x9559('0xa2')]:null,'referer':_0x1054ae['body'][_0x9559('0xa3')],'browserName':_0x134caf[_0x9559('0xa4')][_0x9559('0x30')]&&_0x134caf[_0x9559('0xa4')][_0x9559('0xa5')]?util[_0x9559('0xa6')]('%s\x20%s',_0x134caf[_0x9559('0xa4')][_0x9559('0x30')],_0x134caf[_0x9559('0xa4')][_0x9559('0xa5')]):'unknown','browserVersion':_0x134caf[_0x9559('0xa4')][_0x9559('0xa5')]||_0x9559('0xa7'),'osName':util[_0x9559('0xa6')](_0x9559('0xa8'),_0x134caf['os']['name'],_0x134caf['os'][_0x9559('0xa5')]),'osVersion':_0x134caf['os'][_0x9559('0xa5')],'deviceModel':_0x134caf[_0x9559('0xa9')][_0x9559('0x37')]&&_0x134caf[_0x9559('0xa9')]['vendor']?util[_0x9559('0xa6')](_0x9559('0xaa'),_0x134caf[_0x9559('0xa9')]['model'],_0x134caf[_0x9559('0xa9')][_0x9559('0xab')],_0x134caf[_0x9559('0xa9')]['type']):null,'deviceVendor':_0x134caf[_0x9559('0xa9')][_0x9559('0xab')],'deviceType':_0x134caf[_0x9559('0xa9')]['type'],'formData':JSON[_0x9559('0x1b')](_0x1054ae[_0x9559('0x4c')])};var _0x102da2={'ChatWebsiteId':_0x1054ae[_0x9559('0x48')]['id'],'closed':![]};if(_0x1054ae['body'][_0x9559('0xac')]){_0x102da2['threadId']=_0x1054ae['body'][_0x9559('0xac')];return db[_0x9559('0xad')][_0x9559('0x55')]({'where':_0x102da2})[_0x9559('0x2c')](function(_0x2ba630){if(_0x2ba630){return[_0x2ba630,![]];}_0x30c8dd['threadId']=_0x1054ae['body'][_0x9559('0xac')];_0x30c8dd['externalUrl']=_0x1054ae[_0x9559('0x4c')][_0x9559('0xae')];return db['ChatInteraction'][_0x9559('0x4b')](_0x30c8dd)['then'](function(_0x10bdea){return[_0x10bdea,!![]];});});}_0x102da2['ContactId']=_0x3fa37f['id'];if(_0x1054ae['body'][_0x9559('0xaf')]&&_0x1054ae[_0x9559('0x4c')][_0x9559('0xaf')]['id']){_0x102da2['id']=_0x1054ae[_0x9559('0x4c')][_0x9559('0xaf')]['id'];return db[_0x9559('0xad')][_0x9559('0x55')]({'where':_0x102da2})[_0x9559('0x2c')](function(_0x38d69b){if(_0x38d69b){return[_0x38d69b,![]];}return db[_0x9559('0xad')][_0x9559('0x4b')](_0x30c8dd)[_0x9559('0x2c')](function(_0x23b842){return[_0x23b842,!![]];});});}return db[_0x9559('0xad')][_0x9559('0x4b')](_0x30c8dd)[_0x9559('0x2c')](function(_0x453271){return[_0x453271,!![]];});}})['spread'](function(_0x1a2150,_0xbdff54){if(_0x1a2150){_0x1887a0=_0xbdff54;if(!_0xbdff54){var _0x2d1b14={'from':(_0x2056c1['contact'][_0x9559('0xb0')]||'')+'\x20'+(_0x2056c1['contact'][_0x9559('0xa1')]||'')};if(_0x1054ae[_0x9559('0x4c')][_0x9559('0xac')]&&_0x1054ae[_0x9559('0x4c')]['messageId']&&_0x1054ae[_0x9559('0x4c')]['threadId']!=_0x1054ae[_0x9559('0x4c')]['messageId']){_0x2d1b14[_0x9559('0xac')]=_0x1054ae[_0x9559('0x4c')][_0x9559('0xb1')];}return _0x1a2150['update'](_0x2d1b14);}else{return _0x1a2150;}}})[_0x9559('0x2c')](function(_0x450a51){_0x2056c1['interaction']=_0x450a51[_0x9559('0x4f')]({'plain':!![]});_0x2056c1['interaction'][_0x9559('0xb2')]=_0x1887a0;if(_0x2056c1[_0x9559('0xaf')][_0x9559('0xb2')]){if(_0x2056c1[_0x9559('0x96')][_0x9559('0xb3')]){_0x2056c1[_0x9559('0x97')][_0x9559('0xb4')]({'id':0x0,'priority':_0x2056c1[_0x9559('0x97')][_0x9559('0x3d')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x9559('0xb5')});}}return db[_0x9559('0xb6')][_0x9559('0x4b')]({'body':_0x1054ae['body'][_0x9559('0x4c')],'ChatWebsiteId':_0x1054ae[_0x9559('0x48')]['id'],'ChatInteractionId':_0x450a51['id'],'direction':'in','ContactId':_0x2056c1[_0x9559('0xb7')]['id'],'AttachmentId':_0x1054ae[_0x9559('0x4c')][_0x9559('0xb8')]});})[_0x9559('0x2c')](function(_0x3e54c1){_0x2056c1[_0x9559('0x1f')]=_0x3e54c1;if(_0x2056c1['interaction']['UserId']){return db[_0x9559('0xb9')][_0x9559('0x55')]({'attributes':['id',_0x9559('0x30')],'where':{'id':_0x2056c1[_0x9559('0xaf')][_0x9559('0xba')]}})[_0x9559('0x2c')](function(_0x9c2cdc){if(_0x9c2cdc){_0x2056c1[_0x9559('0x97')][_0x9559('0xbb')]({'id':0x0,'priority':0x0,'app':_0x9559('0xbc'),'appdata':_0x9c2cdc[_0x9559('0x30')]+','+(_0x2056c1['account'][_0x9559('0xbd')]||0xa),'interval':_0x9559('0xb5')});_0x2056c1[_0x9559('0xbe')]=!![];}return respondWithRpcPromise(_0x9559('0xbf'),'startRouting',_0x2056c1);});}return respondWithRpcPromise('Start',_0x9559('0xc0'),_0x2056c1);})['then'](function(_0x5d4ade){respondWithRpcPromise(_0x9559('0xc1'),_0x9559('0xc1'),{'event':_0x9559('0x80'),'message':_0x5d4ade},client9002);return _0x5d4ade;})[_0x9559('0x2c')](respondWithResult(_0x1e900e,null))['catch'](handleError(_0x1e900e,null));};exports[_0x9559('0xc2')]=function(_0x4405bb,_0xc9a21f){var _0x25fb0e,_0xfa4348,_0x2c489f;var _0x5a534d=[];var _0x173ee1={};var _0x485e3b=_0x4405bb[_0x9559('0xc3')]||[];var _0x4a80bc=[];var _0x47564c;return db[_0x9559('0x84')][_0x9559('0xc4')]()['then'](function(_0x248dc2){if(!_0x248dc2){throw new db[(_0x9559('0x8c'))]['ValidationError'](_0x9559('0x86'));}_0x5a534d=_[_0x9559('0x87')](_[_0x9559('0x49')](_0x248dc2),['createdAt',_0x9559('0x88'),_0x9559('0x8a'),_0x9559('0xc5')]);if(_0x4405bb[_0x9559('0x4c')]['id']){delete _0x4405bb[_0x9559('0x4c')]['id'];}if(_['isNil'](_0x4405bb[_0x9559('0x4c')][_0x9559('0x8b')])){throw _0xc9a21f['status'](0x1f4)[_0x9559('0xc6')](new db[(_0x9559('0x8c'))][(_0x9559('0x85'))](_0x9559('0x8d')));}if(_[_0x9559('0x74')](_0x4405bb[_0x9559('0x4c')][_0x9559('0x4c')])||_0x4405bb[_0x9559('0x4c')][_0x9559('0x4c')]===''){throw _0xc9a21f[_0x9559('0x23')](0x1f4)[_0x9559('0xc6')](new db[(_0x9559('0x8c'))][(_0x9559('0x85'))](_0x9559('0xc7')));}if(_[_0x9559('0x74')](_0x4405bb[_0x9559('0x4c')][_0x9559('0xc8')])){throw _0xc9a21f[_0x9559('0x23')](0x1f4)[_0x9559('0xc6')](new db[(_0x9559('0x8c'))]['ValidationError']('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5a534d));}if(!_[_0x9559('0x8f')](_0x5a534d,_0x4405bb[_0x9559('0x4c')][_0x9559('0xc8')])){throw _0xc9a21f[_0x9559('0x23')](0x1f4)[_0x9559('0xc6')](new db['Sequelize']['ValidationError'](_0x9559('0xc9')+_0x5a534d));}_0x173ee1[_0x4405bb[_0x9559('0x4c')]['mapKeyOffline']]=_0x4405bb['body']['from'];})[_0x9559('0x2c')](function(){return db[_0x9559('0x46')][_0x9559('0x55')]({'where':{'id':_0x4405bb[_0x9559('0x48')]['id']},'include':[{'model':db[_0x9559('0xca')],'as':_0x9559('0x92')},{'model':db[_0x9559('0xcb')],'as':_0x9559('0xcb')}]});})['then'](handleEntityNotFound(_0xc9a21f,null))['then'](function(_0x410d46){if(_0x410d46&&_0x410d46[_0x9559('0x92')]){_0xfa4348=_0x410d46;var _0x3b465b=_[_0x9559('0xd')](_0x4405bb[_0x9559('0x4c')],{'firstName':_0x4405bb[_0x9559('0x4c')][_0x9559('0x8b')],'phone':_0x4405bb['body']['from'],'ListId':_0x410d46['ListId']});_0x3b465b[_0x4405bb[_0x9559('0x4c')][_0x9559('0xc8')]]=_0x4405bb[_0x9559('0x4c')][_0x9559('0x8b')];return db[_0x9559('0x84')]['findOrCreate']({'where':_0x173ee1,'defaults':_0x3b465b});}})['spread'](function(_0x37bd05){if(_0x37bd05){_0x2c489f=_0x37bd05;var _0x521cbe=fs[_0x9559('0xcc')](path['join'](config[_0x9559('0x6f')],_0x9559('0xcd')),_0x9559('0xce'));var _0x46d0ea=ejs[_0x9559('0xcf')](_0x521cbe,{'body':_[_0x9559('0xd0')](_0x4405bb[_0x9559('0x4c')][_0x9559('0x4c')]),'bodyTitle':_0xfa4348[_0x9559('0xd1')]});return db[_0x9559('0xd2')][_0x9559('0x4b')]({'body':_0x46d0ea,'ContactId':_0x37bd05['id'],'ChatWebsiteId':_0xfa4348['id']});}})['then'](function(_0x8c0eca){_0x47564c=_0x8c0eca;if(_0x485e3b['length']){var _0x4dd97f=_0x485e3b['map'](function(_0x161b7d){return{'name':_0x161b7d['originalname'],'basename':_0x161b7d[_0x9559('0x68')],'type':_0x161b7d[_0x9559('0xd3')],'ChatOfflineMessageId':_0x8c0eca['id']};});_0x4a80bc=_0x4dd97f[_0x9559('0x34')](_0x142ffc=>{var _0x45a631={'filename':_0x142ffc['name'],'path':path['join'](config[_0x9559('0x6f')],_0x9559('0xd4'),_0x9559('0xc3'),_0x9559('0xd5'),_0x9559('0xd6'),_0x142ffc[_0x9559('0xd7')])};return _0x45a631;});if(!_0xfa4348['openNewInteraction']){return db[_0x9559('0xd8')]['transaction'](function(_0x242794){return db[_0x9559('0xd9')][_0x9559('0xda')](_0x4dd97f,{'transaction':_0x242794});});}}})[_0x9559('0x2c')](function(){if(_0x47564c){_0x25fb0e=_0x47564c;return db['MailAccount'][_0x9559('0x5a')]({'where':{'active':!![]},'include':[{'model':db[_0x9559('0xdb')],'as':_0x9559('0xdc'),'raw':!![]}]});}})[_0x9559('0x2c')](function(_0x536b3e){if(_0x536b3e&&_0x536b3e[_0x9559('0xdc')]&&_0xfa4348[_0x9559('0xdd')]&&_0xfa4348[_0x9559('0xde')]){var _0x5d472d={'tls':{'rejectUnauthorized':![]}};if(_0x536b3e[_0x9559('0xdc')][_0x9559('0xdf')]){_0x5d472d['service']=_0x536b3e[_0x9559('0xdc')]['service'];}else{_0x5d472d[_0x9559('0xe0')]=_0x536b3e[_0x9559('0xdc')][_0x9559('0xe0')];_0x5d472d['port']=_0x536b3e['Smtp'][_0x9559('0xe1')];_0x5d472d['secure']=_0x536b3e['Smtp'][_0x9559('0xe2')];}if(_0x536b3e[_0x9559('0xdc')][_0x9559('0xe3')]){_0x5d472d[_0x9559('0xe4')]={'user':_0x536b3e['Smtp'][_0x9559('0x4e')],'pass':_0x536b3e['Smtp']['pass']};}return respondWithRpcPromise(_0x9559('0xe5'),_0x9559('0xe6'),{'account':_0x5d472d,'message':{'from':util[_0x9559('0xa6')](_0x9559('0xe7'),_0x536b3e['name'],_0x536b3e[_0x9559('0xe8')]||_0x536b3e['Smtp']['user']),'to':_0xfa4348['forwardOfflineAddress'],'subject':_0xfa4348['offlineMessageSubject'],'html':_0x25fb0e[_0x9559('0x4c')],'attachments':_0x4a80bc}},client9003)['then'](function(){return _0x25fb0e;})[_0x9559('0x21')](function(_0x119b2b){console[_0x9559('0x1c')](_0x119b2b);});}})[_0x9559('0x2c')](function(){if(_0xfa4348&&_0xfa4348[_0x9559('0xe9')]&&_0xfa4348[_0x9559('0xea')]){var _0x2fba66=[];if(_0x485e3b['length']){_0x2fba66=_0x485e3b[_0x9559('0x34')](function(_0x3b77d0){return{'name':_0x3b77d0[_0x9559('0xeb')],'basename':_0x3b77d0['filename'],'type':_0x3b77d0[_0x9559('0xd3')],'ChatOfflineMessageId':_0x47564c['id']};});}var _0x58fae5;if(!_[_0x9559('0x74')](_0xfa4348[_0x9559('0xec')])){var _0x567911=_['map'](_0x4405bb[_0x9559('0x4c')],function(_0x397bdf){return _0x397bdf;});var _0x50ed47=_['toPairsIn'](_0x567911)[0x0];var _0x48593b=_[_0x9559('0xed')](_0x50ed47,function(_0x5131fc){return _0x5131fc;});_0x58fae5=_0x48593b[0x1][_0xfa4348['subjectOffline']];}var _0x3fc6bf={'from':_0x2c489f[_0x9559('0xe8')],'firstName':_0x2c489f[_0x9559('0xb0')],'lastName':_0x2c489f['lastName'],'mapKey':_0x9559('0xe8'),'message':{'from':_0x2c489f['email'],'to':_0xfa4348[_0x9559('0xcb')][_0x9559('0xe8')],'cc':'','subject':_[_0x9559('0x74')](_0x58fae5)?_0xfa4348[_0x9559('0xee')]:_0x58fae5,'messageId':'','sentAt':new Date(),'attach':_0x2fba66[_0x9559('0x3d')],'attachments':_0x2fba66,'originChannel':'Chat','ChatWebsiteId':_0xfa4348['id'],'ChatOfflineMessageId':_0x25fb0e['id'],'originTo':_0xfa4348[_0x9559('0xcb')][_0x9559('0xe8')]},'body':_0x25fb0e[_0x9559('0x4c')]};var _0x340e6a={'account':{'id':_0xfa4348['MailAccountId']},'body':_0x3fc6bf,'log':_0x9559('0xef')};return respondWithRpcPromise('NotifyMailAccount',_0x9559('0xf0'),_0x340e6a,client9001)[_0x9559('0x2c')](function(){return _0x25fb0e;})[_0x9559('0x21')](function(_0x5068cc){console[_0x9559('0x1c')](_0x5068cc);});}return;})['then'](function(){if(_0x25fb0e){return _0x25fb0e;}})[_0x9559('0x2c')](respondWithResult(_0xc9a21f,null))['catch'](function(_0x2b0eb9){console[_0x9559('0x1c')](_0x9559('0x21'),_0x2b0eb9);for(var _0xbc1add of _0x485e3b){var _0x4a4a09=path['join'](config['root'],_0x9559('0xd4'),_0x9559('0xc3'),_0x9559('0xd5'),_0x9559('0xd6'),_0xbc1add[_0x9559('0x68')]);fs_extra[_0x9559('0xf1')](_0x4a4a09)[_0x9559('0x21')](function(_0x627e71){console[_0x9559('0x1c')](_0x9559('0xf2'),_0x4a4a09,_0x627e71);});}});};exports['addInteraction']=function(_0x614be3,_0x532ac8){return db[_0x9559('0xad')]['find']({'where':{'id':_0x614be3[_0x9559('0x48')]['id']}})[_0x9559('0x2c')](handleEntityNotFound(_0x532ac8,null))[_0x9559('0x2c')](function(_0x110dd0){if(_0x110dd0){return _0x110dd0[_0x9559('0xf3')](_0x614be3['body'][_0x9559('0x5f')],_[_0x9559('0xf4')](_0x614be3[_0x9559('0x4c')],['ids','id'])||{});}})['then'](respondWithResult(_0x532ac8,null))['catch'](handleError(_0x532ac8,null));};exports[_0x9559('0xf5')]=function(_0x9e459a,_0x4363f0){var _0x4e4673={'raw':![],'where':{}};var _0x3fd118={};var _0x2086ed={'count':0x0,'rows':[]};return db[_0x9559('0x46')]['findOne']({'where':{'id':_0x9e459a['params']['id']}})[_0x9559('0x2c')](handleEntityNotFound(_0x4363f0,null))[_0x9559('0x2c')](function(_0x62e36f){if(_0x62e36f){_0x3fd118[_0x9559('0x37')]=_[_0x9559('0x49')](db['ChatInteraction'][_0x9559('0x5b')]);_0x3fd118[_0x9559('0x38')]=_[_0x9559('0x49')](_0x9e459a[_0x9559('0x38')]);_0x3fd118[_0x9559('0x39')]=_[_0x9559('0x3b')](_0x3fd118[_0x9559('0x37')],_0x3fd118[_0x9559('0x38')]);_0x4e4673[_0x9559('0x3a')]=_[_0x9559('0x3b')](_0x3fd118[_0x9559('0x37')],qs[_0x9559('0x3c')](_0x9e459a[_0x9559('0x38')][_0x9559('0x3c')]));_0x4e4673['attributes']=_0x4e4673['attributes'][_0x9559('0x3d')]?_0x4e4673[_0x9559('0x3a')]:_0x3fd118[_0x9559('0x37')];if(!_0x9e459a[_0x9559('0x38')]['hasOwnProperty']('nolimit')){_0x4e4673['limit']=qs[_0x9559('0x26')](_0x9e459a[_0x9559('0x38')][_0x9559('0x26')]);_0x4e4673['offset']=qs[_0x9559('0x24')](_0x9e459a['query'][_0x9559('0x24')]);}_0x4e4673[_0x9559('0x63')]=qs[_0x9559('0x40')](_0x9e459a[_0x9559('0x38')][_0x9559('0x40')]);_0x4e4673[_0x9559('0x41')]=qs[_0x9559('0x39')](_[_0x9559('0x42')](_0x9e459a[_0x9559('0x38')],_0x3fd118[_0x9559('0x39')]));_0x4e4673[_0x9559('0x41')][_0x9559('0x57')]=_0x62e36f['id'];if(_0x9e459a[_0x9559('0x38')][_0x9559('0x44')]){_0x4e4673[_0x9559('0x41')]=_[_0x9559('0x43')](_0x4e4673[_0x9559('0x41')],{'$or':_[_0x9559('0x34')](_0x4e4673[_0x9559('0x3a')],function(_0x23b37b){var _0x1f83a6={};_0x1f83a6[_0x23b37b]={'$like':'%'+_0x9e459a[_0x9559('0x38')][_0x9559('0x44')]+'%'};return _0x1f83a6;})});}_0x4e4673=_[_0x9559('0x43')]({},_0x4e4673,_0x9e459a[_0x9559('0x45')]);return db[_0x9559('0xad')][_0x9559('0x27')]({'where':_0x4e4673[_0x9559('0x41')]})[_0x9559('0x2c')](function(_0x946697){_0x2086ed[_0x9559('0x27')]=_0x946697;if(_0x9e459a[_0x9559('0x38')][_0x9559('0x47')]){_0x4e4673['include']=[{'model':db[_0x9559('0x84')],'as':_0x9559('0xf6'),'required':![]},{'model':db[_0x9559('0xb9')],'as':_0x9559('0xf7'),'attributes':[_0x9559('0x30'),_0x9559('0xf8'),_0x9559('0xf9')],'required':![]},{'model':db[_0x9559('0xfa')],'as':_0x9559('0xfb'),'attributes':['id',_0x9559('0x30'),_0x9559('0xfc')],'where':_0x9e459a[_0x9559('0x38')][_0x9559('0xfd')]?{'id':_0x9e459a['query'][_0x9559('0xfd')]}:undefined,'required':_0x9e459a[_0x9559('0x38')][_0x9559('0xfd')]?!![]:![]}];}return db[_0x9559('0xad')][_0x9559('0x5c')](_0x4e4673);})['then'](function(_0x53bd2d){_0x2086ed[_0x9559('0x5d')]=_0x53bd2d;return _0x2086ed;});}})[_0x9559('0x2c')](respondWithFilteredResult(_0x4363f0,_0x4e4673))[_0x9559('0x21')](handleError(_0x4363f0,null));};function iftimePromise(_0x11c978,_0xe5dab6){return respondWithRpcPromise(_0x9559('0xfe'),_0x9559('0xff'),{'command':_0xe5dab6[_0x9559('0x100')]?util[_0x9559('0xa6')]('iftime\x20%s,%s',_0x11c978[_0x9559('0x101')],_0xe5dab6['timezone']):util[_0x9559('0xa6')](_0x9559('0x102'),_0x11c978[_0x9559('0x101')])},client9002)[_0x9559('0x2c')](function(_0x4385e5){var _0x33d21b=_0x4385e5&&_0x4385e5['indexOf']('true')>=0x0?!![]:![];logger['info'](_0x9559('0x103'),_0xe5dab6['id'],_0x11c978['id'],_0x11c978['interval'],_0x33d21b?'ONLINE':'OFFLINE',_0xe5dab6[_0x9559('0x100')]?_0xe5dab6['timezone']:_0x9559('0x104'));return _0x33d21b;})[_0x9559('0x21')](function(_0x3722f3){logger[_0x9559('0x1c')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0xe5dab6['id'],_0x11c978['id'],_0x11c978[_0x9559('0x101')],util[_0x9559('0x105')](_0x3722f3,{'showHidden':![],'depth':null}),_0xe5dab6[_0x9559('0x100')]?_0xe5dab6['timezone']:'No\x20timezone');return![];});}exports[_0x9559('0xff')]=function(_0x5a3183,_0x4c3b55){var _0x4b2ff7=0x0;var _0x37aaa2=0x0;var _0x8702a5=![];var _0x2f087a;var _0x4bb043;return db[_0x9559('0x46')][_0x9559('0x55')]({'where':{'id':_0x5a3183[_0x9559('0x48')]['id']},'include':[{'model':db[_0x9559('0x106')],'as':'Interval','include':[{'model':db[_0x9559('0x106')],'as':'Intervals','attributes':['id',_0x9559('0x101')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x4c3b55,null))[_0x9559('0x2c')](function(_0x216c38){if(_0x216c38){_0x2f087a=_0x216c38;return _0x216c38['getProactiveActions']({'raw':!![]});}})['then'](function(_0x5e2652){if(_0x2f087a){if(_0x5e2652){_0x4bb043=_0x5e2652;}}return require(_0x9559('0x71'))[_0x9559('0x72')]();})[_0x9559('0x2c')](function(_0x3afd57){if(_0x3afd57){_0x37aaa2=_0x3afd57[_0x9559('0x107')];_0x8702a5=_0x3afd57[_0x9559('0x73')];}})[_0x9559('0x2c')](function(){return db['ChatInteraction'][_0x9559('0x27')]({'where':{'closed':![]}});})['then'](function(_0x2a0fbb){_0x4b2ff7=_0x2a0fbb;if(_0x37aaa2&&_0x2a0fbb>_0x37aaa2){return db[_0x9559('0x108')][_0x9559('0x5a')]({'where':{'id':0x1}})[_0x9559('0x2c')](function(_0xe5c8bd){if(_0xe5c8bd){_0xe5c8bd[_0x9559('0x109')]('chatLicenseExceeded');}});}})[_0x9559('0x2c')](function(){if(_0x2f087a['Interval']&&_0x2f087a['Interval']['Intervals']){var _0x4f0adf=[];for(var _0x325b45=0x0;_0x325b45<_0x2f087a[_0x9559('0x106')]['Intervals'][_0x9559('0x3d')];_0x325b45++){var _0x378ec6=_0x2f087a[_0x9559('0x106')][_0x9559('0x10a')][_0x325b45][_0x9559('0x4f')]({'plain':!![]});_0x4f0adf['push'](iftimePromise(_0x378ec6,_0x2f087a));}return BPromise[_0x9559('0x10b')](_0x4f0adf)[_0x9559('0x2c')](function(_0x5afb33){return _[_0x9559('0x10c')](_0x5afb33);});}else{return!![];}})['then'](function(_0x38e78b){var _0x44fcda=fs[_0x9559('0xcc')](path[_0x9559('0x6e')](config['root'],_0x9559('0x10d')),_0x9559('0xce'));var _0x37d063={'remote':_0x2f087a[_0x9559('0x10e')],'query':querystring[_0x9559('0x1b')](_[_0x9559('0x43')](_0x2f087a[_0x9559('0x4f')]({'plain':!![]}),{'customerIp':_0x5a3183[_0x9559('0x9d')][_0x9559('0xa0')]||_0x5a3183[_0x9559('0x9d')][_0x9559('0x10f')]||_0x5a3183[_0x9559('0x110')][_0x9559('0x111')]||_0x5a3183['ip'],'referer':_0x5a3183[_0x9559('0x9d')][_0x9559('0xa3')],'openedInteractions':_0x4b2ff7,'maxInteractions':_0x37aaa2,'virtual':_0x8702a5['virtual'],'online':_0x38e78b,'custom':_0x8702a5}))[_0x9559('0x112')](/'/g,'\x5c\x27')};_0x4c3b55[_0x9559('0xc6')](ejs['render'](Mustache[_0x9559('0xcf')](_0x44fcda,_0x37d063),{'proactiveActions':_0x4bb043,'alignment':_0x2f087a[_0x9559('0x113')],'verticalAlignment':_0x2f087a[_0x9559('0x114')],'div_color':_0x2f087a[_0x9559('0xfc')],'text_color':_0x2f087a['textColor'],'button_color':_0x2f087a[_0x9559('0x115')],'background_color':_0x2f087a[_0x9559('0x116')]}));})[_0x9559('0x21')](handleError(_0x4c3b55,null));};exports[_0x9559('0x117')]=function(_0x5dee66,_0x4be443){var _0x48cbf0=_0x5dee66['params']['id'];var _0x4eba8a=_0x5dee66['body'];var _0xf2b9ed=0xc8;var _0x475780=null;return db[_0x9559('0xd8')][_0x9559('0x118')]({'isolationLevel':db['sequelize'][_0x9559('0x119')][_0x9559('0x11a')][_0x9559('0x11b')]},function(_0x4e97b9){return db[_0x9559('0x46')][_0x9559('0x5a')]({'where':{'id':_0x48cbf0},'transaction':_0x4e97b9})['then'](function(_0x17cbda){if(_0x17cbda){return db[_0x9559('0x11c')][_0x9559('0x2e')]({'where':{'ChatWebsiteId':_0x48cbf0},'transaction':_0x4e97b9})[_0x9559('0x2c')](function(){var _0x536c44=_['map'](_0x4eba8a,function(_0x2870d5){_0x2870d5[_0x9559('0x57')]=_0x48cbf0;return _0x2870d5;});return db[_0x9559('0x11c')]['bulkCreate'](_0x536c44,{'transaction':_0x4e97b9});});}else{_0xf2b9ed=0x194;_0x475780=[];}});})[_0x9559('0x2c')](function(){if(_0xf2b9ed!==0x194){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x48cbf0},'order':_0x9559('0x9a')})[_0x9559('0x2c')](function(_0x13e049){_0x475780=_0x13e049;});}})[_0x9559('0x21')](function(_0x330a0e){_0xf2b9ed=0x1f4;logger[_0x9559('0x1c')](_0x330a0e[_0x9559('0x2f')]);if(_0x330a0e[_0x9559('0x30')]){delete _0x330a0e['name'];}_0x475780=_0x330a0e;})['finally'](function(){if(_0x475780===null){_0x4be443[_0x9559('0x11d')](_0xf2b9ed);}else{if(_0xf2b9ed===0x1f4){_0x4be443['status'](_0xf2b9ed)[_0x9559('0xc6')](_0x475780);}else{_0x4be443['status'](_0xf2b9ed)[_0x9559('0x2a')](_0x475780);}}});};exports[_0x9559('0x11e')]=function(_0x508fd9,_0x2d7939){var _0x5e3dce={};var _0x3d7d72={};var _0x2488aa;var _0x4f95d2;return db['ChatWebsite'][_0x9559('0x5a')]({'where':{'id':_0x508fd9[_0x9559('0x48')]['id']}})[_0x9559('0x2c')](handleEntityNotFound(_0x2d7939,null))[_0x9559('0x2c')](function(_0x123714){if(_0x123714){_0x2488aa=_0x123714;_0x3d7d72[_0x9559('0x37')]=_[_0x9559('0x49')](db[_0x9559('0x11c')]['rawAttributes']);_0x3d7d72[_0x9559('0x38')]=_[_0x9559('0x49')](_0x508fd9[_0x9559('0x38')]);_0x3d7d72['filters']=_[_0x9559('0x3b')](_0x3d7d72['model'],_0x3d7d72[_0x9559('0x38')]);_0x5e3dce['attributes']=_[_0x9559('0x3b')](_0x3d7d72[_0x9559('0x37')],qs[_0x9559('0x3c')](_0x508fd9[_0x9559('0x38')][_0x9559('0x3c')]));_0x5e3dce['attributes']=_0x5e3dce[_0x9559('0x3a')][_0x9559('0x3d')]?_0x5e3dce['attributes']:_0x3d7d72[_0x9559('0x37')];_0x5e3dce[_0x9559('0x63')]=qs['sort'](_0x508fd9['query'][_0x9559('0x40')]);_0x5e3dce['where']=qs[_0x9559('0x39')](_['pick'](_0x508fd9[_0x9559('0x38')],_0x3d7d72[_0x9559('0x39')]));if(_0x508fd9[_0x9559('0x38')][_0x9559('0x44')]){_0x5e3dce[_0x9559('0x41')]=_['merge'](_0x5e3dce[_0x9559('0x41')],{'$or':_[_0x9559('0x34')](_0x5e3dce['attributes'],function(_0x3cff3e){var _0x183af9={};_0x183af9[_0x3cff3e]={'$like':'%'+_0x508fd9['query'][_0x9559('0x44')]+'%'};return _0x183af9;})});}_0x5e3dce=_[_0x9559('0x43')]({},_0x5e3dce,_0x508fd9[_0x9559('0x45')]);return _0x2488aa[_0x9559('0x11e')](_0x5e3dce);}})[_0x9559('0x2c')](function(_0x1f4820){if(_0x1f4820){_0x4f95d2=_0x1f4820['length'];if(!_0x508fd9[_0x9559('0x38')][_0x9559('0x3e')](_0x9559('0x3f'))){_0x5e3dce[_0x9559('0x26')]=qs['limit'](_0x508fd9[_0x9559('0x38')][_0x9559('0x26')]);_0x5e3dce[_0x9559('0x24')]=qs[_0x9559('0x24')](_0x508fd9[_0x9559('0x38')][_0x9559('0x24')]);}return _0x2488aa[_0x9559('0x11e')](_0x5e3dce);}})[_0x9559('0x2c')](function(_0x563e47){if(_0x563e47){return _0x563e47?{'count':_0x4f95d2,'rows':_0x563e47}:null;}})[_0x9559('0x2c')](respondWithResult(_0x2d7939,null))[_0x9559('0x21')](handleError(_0x2d7939,null));};exports[_0x9559('0x11f')]=function(_0xe0a4b6,_0xf36cd8){return db['chatProactiveAction'][_0x9559('0x55')]({'where':{'id':_0xe0a4b6['params']['id']}})[_0x9559('0x2c')](handleEntityNotFound(_0xf36cd8,null))[_0x9559('0x2c')](function(_0x389bde){if(_0x389bde){return _0x389bde[_0x9559('0x11f')](_0xe0a4b6[_0x9559('0x4c')][_0x9559('0x5f')],_[_0x9559('0xf4')](_0xe0a4b6[_0x9559('0x4c')],[_0x9559('0x5f'),'id'])||{});}})[_0x9559('0x2c')](respondWithResult(_0xf36cd8,null))['catch'](handleError(_0xf36cd8,null));};exports['getProactiveActions']=function(_0x343517,_0x4e9450){var _0x5952db={};var _0x34df31={};var _0x2331b7;var _0x1953b7;return db[_0x9559('0x46')][_0x9559('0x5a')]({'where':{'id':_0x343517['params']['id']}})[_0x9559('0x2c')](handleEntityNotFound(_0x4e9450,null))[_0x9559('0x2c')](function(_0x4b22f2){if(_0x4b22f2){_0x2331b7=_0x4b22f2;_0x34df31[_0x9559('0x37')]=_[_0x9559('0x49')](db['ChatProactiveAction']['rawAttributes']);_0x34df31[_0x9559('0x38')]=_[_0x9559('0x49')](_0x343517[_0x9559('0x38')]);_0x34df31[_0x9559('0x39')]=_[_0x9559('0x3b')](_0x34df31[_0x9559('0x37')],_0x34df31[_0x9559('0x38')]);_0x5952db['attributes']=_[_0x9559('0x3b')](_0x34df31[_0x9559('0x37')],qs[_0x9559('0x3c')](_0x343517[_0x9559('0x38')][_0x9559('0x3c')]));_0x5952db[_0x9559('0x3a')]=_0x5952db['attributes'][_0x9559('0x3d')]?_0x5952db['attributes']:_0x34df31[_0x9559('0x37')];_0x5952db['order']=qs[_0x9559('0x40')](_0x343517[_0x9559('0x38')]['sort']);_0x5952db[_0x9559('0x41')]=qs[_0x9559('0x39')](_[_0x9559('0x42')](_0x343517[_0x9559('0x38')],_0x34df31[_0x9559('0x39')]));if(_0x343517['query'][_0x9559('0x44')]){_0x5952db['where']=_['merge'](_0x5952db[_0x9559('0x41')],{'$or':_['map'](_0x5952db[_0x9559('0x3a')],function(_0x3efe27){var _0x233bf8={};_0x233bf8[_0x3efe27]={'$like':'%'+_0x343517[_0x9559('0x38')][_0x9559('0x44')]+'%'};return _0x233bf8;})});}_0x5952db=_[_0x9559('0x43')]({},_0x5952db,_0x343517['options']);return _0x2331b7[_0x9559('0x120')](_0x5952db);}})[_0x9559('0x2c')](function(_0x359d10){if(_0x359d10){_0x1953b7=_0x359d10[_0x9559('0x3d')];if(!_0x343517['query'][_0x9559('0x3e')](_0x9559('0x3f'))){_0x5952db[_0x9559('0x26')]=qs['limit'](_0x343517['query'][_0x9559('0x26')]);_0x5952db[_0x9559('0x24')]=qs['offset'](_0x343517[_0x9559('0x38')][_0x9559('0x24')]);}return _0x2331b7[_0x9559('0x120')](_0x5952db);}})['then'](function(_0x14ec35){if(_0x14ec35){return _0x14ec35?{'count':_0x1953b7,'rows':_0x14ec35}:null;}})['then'](respondWithResult(_0x4e9450,null))[_0x9559('0x21')](handleError(_0x4e9450,null));};exports[_0x9559('0x121')]=function(_0x4ca3d9,_0x5c8c6c){var _0x5cfd8f=_0x4ca3d9[_0x9559('0x38')]['online']===_0x9559('0x122')?_0x9559('0x123'):_0x9559('0x124');return db['ChatWebsite'][_0x9559('0x55')]({'attributes':['id',_0x5cfd8f],'where':{'id':_0x4ca3d9[_0x9559('0x48')]['id']}})[_0x9559('0x2c')](handleEntityNotFound(_0x5c8c6c,null))[_0x9559('0x2c')](function(_0x2ba2fc){if(_0x2ba2fc){var _0x58f781=_0x2ba2fc[_0x5cfd8f];var _0x36a186=_0x58f781&&_0x58f781['items']?_0x58f781[_0x9559('0x125')]:[];_0x5c8c6c[_0x9559('0xc6')]({'fromKey':_['isNil'](_0x58f781[_0x9559('0x126')])?undefined:_0x58f781[_0x9559('0x126')],'count':_0x36a186['length'],'rows':_0x36a186});}})[_0x9559('0x21')](handleError(_0x5c8c6c,null));};exports['getOfflineMessages']=function(_0x280f41,_0x5f182a){var _0x2ce75c={'raw':![],'where':{}};var _0x561d23={};var _0x4482a2={'count':0x0,'rows':[]};return db[_0x9559('0x46')][_0x9559('0x5a')]({'where':{'id':_0x280f41[_0x9559('0x48')]['id']}})['then'](handleEntityNotFound(_0x5f182a,null))[_0x9559('0x2c')](function(_0x560247){if(_0x560247){_0x561d23[_0x9559('0x37')]=_[_0x9559('0x49')](db[_0x9559('0xd2')][_0x9559('0x5b')]);_0x561d23[_0x9559('0x38')]=_['keys'](_0x280f41[_0x9559('0x38')]);_0x561d23['filters']=_['intersection'](_0x561d23[_0x9559('0x37')],_0x561d23[_0x9559('0x38')]);_0x2ce75c[_0x9559('0x3a')]=_[_0x9559('0x3b')](_0x561d23['model'],qs[_0x9559('0x3c')](_0x280f41[_0x9559('0x38')][_0x9559('0x3c')]));_0x2ce75c[_0x9559('0x3a')]=_0x2ce75c[_0x9559('0x3a')]['length']?_0x2ce75c[_0x9559('0x3a')]:_0x561d23[_0x9559('0x37')];if(!_0x280f41[_0x9559('0x38')][_0x9559('0x3e')](_0x9559('0x3f'))){_0x2ce75c[_0x9559('0x26')]=qs[_0x9559('0x26')](_0x280f41['query']['limit']);_0x2ce75c[_0x9559('0x24')]=qs[_0x9559('0x24')](_0x280f41[_0x9559('0x38')][_0x9559('0x24')]);}_0x2ce75c[_0x9559('0x63')]=qs[_0x9559('0x40')](_0x280f41['query'][_0x9559('0x40')]);_0x2ce75c[_0x9559('0x41')]=qs[_0x9559('0x39')](_['pick'](_0x280f41[_0x9559('0x38')],_0x561d23[_0x9559('0x39')]));_0x2ce75c[_0x9559('0x41')][_0x9559('0x57')]=_0x560247['id'];if(_0x280f41[_0x9559('0x38')]['filter']){_0x2ce75c[_0x9559('0x41')]=_[_0x9559('0x43')](_0x2ce75c[_0x9559('0x41')],{'$or':_[_0x9559('0x34')](_0x2ce75c[_0x9559('0x3a')],function(_0x583eb7){var _0x4e6b15={};_0x4e6b15[_0x583eb7]={'$like':'%'+_0x280f41[_0x9559('0x38')][_0x9559('0x44')]+'%'};return _0x4e6b15;})});}_0x2ce75c=_['merge']({},_0x2ce75c,_0x280f41['options']);return db['ChatOfflineMessage'][_0x9559('0x27')]({'where':_0x2ce75c[_0x9559('0x41')]})[_0x9559('0x2c')](function(_0x5b9eca){_0x4482a2[_0x9559('0x27')]=_0x5b9eca;if(_0x280f41[_0x9559('0x38')][_0x9559('0x47')]){_0x2ce75c[_0x9559('0x4a')]=[{'all':!![]}];}else{_0x2ce75c[_0x9559('0x4a')]=[{'model':db['CmContact'],'as':_0x9559('0xf6'),'required':![]},{'model':db[_0x9559('0xd9')],'as':_0x9559('0x127'),'required':![]}];}return db['ChatOfflineMessage'][_0x9559('0x5c')](_0x2ce75c);})[_0x9559('0x2c')](function(_0x3ec452){_0x4482a2['rows']=_0x3ec452;return _0x4482a2;});}})[_0x9559('0x2c')](respondWithFilteredResult(_0x5f182a,_0x2ce75c))['catch'](handleError(_0x5f182a,null));};exports[_0x9559('0x128')]=function(_0x2eee33,_0x37ee88){return db[_0x9559('0x46')][_0x9559('0x55')]({'where':{'id':_0x2eee33[_0x9559('0x48')]['id']}})[_0x9559('0x2c')](handleEntityNotFound(_0x37ee88,null))[_0x9559('0x2c')](function(_0x28c188){if(_0x28c188){return _0x28c188['addAgents'](_0x2eee33[_0x9559('0x4c')]['ids'],_[_0x9559('0xf4')](_0x2eee33[_0x9559('0x4c')],[_0x9559('0x5f'),'id'])||{})[_0x9559('0x129')](function(_0x5e4041){for(var _0x2ebded=0x0;_0x2ebded<_0x2eee33[_0x9559('0x4c')]['ids'][_0x9559('0x3d')];_0x2ebded+=0x1){socket[_0x9559('0x12a')](_0x9559('0x12b'),{'UserId':Number(_0x2eee33['body'][_0x9559('0x5f')][_0x2ebded]),'ChatWebsiteId':Number(_0x2eee33[_0x9559('0x48')]['id'])});}return _0x5e4041;});}})['then'](respondWithResult(_0x37ee88,null))[_0x9559('0x21')](handleError(_0x37ee88,null));};exports[_0x9559('0x12c')]=function(_0x10be88,_0x3482af){return db[_0x9559('0x46')][_0x9559('0x55')]({'where':{'id':_0x10be88[_0x9559('0x48')]['id']}})[_0x9559('0x2c')](handleEntityNotFound(_0x3482af,null))[_0x9559('0x2c')](function(_0x2ec25b){if(_0x2ec25b){return _0x2ec25b[_0x9559('0x12c')](_0x10be88[_0x9559('0x38')][_0x9559('0x5f')])[_0x9559('0x2c')](function(){if(_[_0x9559('0x12d')](_0x10be88['query']['ids'])){for(var _0x2878fb=0x0;_0x2878fb<_0x10be88['query'][_0x9559('0x5f')][_0x9559('0x3d')];_0x2878fb+=0x1){socket[_0x9559('0x12a')](_0x9559('0x12e'),{'UserId':Number(_0x10be88['query'][_0x9559('0x5f')][_0x2878fb]),'ChatWebsiteId':Number(_0x10be88['params']['id'])});}}else{socket[_0x9559('0x12a')](_0x9559('0x12e'),{'UserId':Number(_0x10be88[_0x9559('0x38')][_0x9559('0x5f')]),'ChatWebsiteId':Number(_0x10be88[_0x9559('0x48')]['id'])});}});}})[_0x9559('0x2c')](respondWithStatusCode(_0x3482af,null))[_0x9559('0x21')](handleError(_0x3482af,null));};exports[_0x9559('0x12f')]=function(_0x4b6b05,_0x12efde){var _0x10dfee={};var _0x421952={};var _0x21839f;var _0x2cb968;return db['ChatWebsite']['findOne']({'where':{'id':_0x4b6b05['params']['id']}})['then'](handleEntityNotFound(_0x12efde,null))[_0x9559('0x2c')](function(_0x2130fe){if(_0x2130fe){_0x21839f=_0x2130fe;_0x421952[_0x9559('0x37')]=_[_0x9559('0x49')](db['User']['rawAttributes']);_0x421952[_0x9559('0x38')]=_[_0x9559('0x49')](_0x4b6b05[_0x9559('0x38')]);_0x421952[_0x9559('0x39')]=_[_0x9559('0x3b')](_0x421952[_0x9559('0x37')],_0x421952['query']);_0x10dfee[_0x9559('0x3a')]=_['intersection'](_0x421952[_0x9559('0x37')],qs[_0x9559('0x3c')](_0x4b6b05['query']['fields']));_0x10dfee[_0x9559('0x3a')]=_0x10dfee[_0x9559('0x3a')][_0x9559('0x3d')]?_0x10dfee['attributes']:_0x421952[_0x9559('0x37')];_0x10dfee[_0x9559('0x63')]=qs[_0x9559('0x40')](_0x4b6b05[_0x9559('0x38')][_0x9559('0x40')]);_0x10dfee[_0x9559('0x41')]=qs[_0x9559('0x39')](_['pick'](_0x4b6b05[_0x9559('0x38')],_0x421952['filters']));if(_0x4b6b05[_0x9559('0x38')][_0x9559('0x44')]){_0x10dfee['where']=_[_0x9559('0x43')](_0x10dfee['where'],{'$or':_[_0x9559('0x34')](_0x10dfee[_0x9559('0x3a')],function(_0x2497f3){var _0x3e2713={};_0x3e2713[_0x2497f3]={'$like':'%'+_0x4b6b05[_0x9559('0x38')][_0x9559('0x44')]+'%'};return _0x3e2713;})});}_0x10dfee=_[_0x9559('0x43')]({},_0x10dfee,_0x4b6b05['options']);return _0x21839f[_0x9559('0x12f')](_0x10dfee);}})[_0x9559('0x2c')](function(_0x23e825){if(_0x23e825){_0x2cb968=_0x23e825[_0x9559('0x3d')];if(!_0x4b6b05[_0x9559('0x38')]['hasOwnProperty'](_0x9559('0x3f'))){_0x10dfee[_0x9559('0x26')]=qs['limit'](_0x4b6b05[_0x9559('0x38')][_0x9559('0x26')]);_0x10dfee[_0x9559('0x24')]=qs[_0x9559('0x24')](_0x4b6b05[_0x9559('0x38')][_0x9559('0x24')]);}return _0x21839f[_0x9559('0x12f')](_0x10dfee);}})[_0x9559('0x2c')](function(_0x11dca0){if(_0x11dca0){return _0x11dca0?{'count':_0x2cb968,'rows':_0x11dca0}:null;}})[_0x9559('0x2c')](respondWithResult(_0x12efde,null))[_0x9559('0x21')](handleError(_0x12efde,null));}; \ No newline at end of file +var _0x6d5e=['orderBy','priority','asc','defaults','customerIp','cf-connecting-ip','headers','x-forwarded-for','first','split','firstName','lastName','x-real-port','browser','format','%s\x20%s','version','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','ContactId','spread','contact','messageId','interaction','created','autoclose','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','offline','files','mapKeyOffline','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','attachments','offline-chat','basename','openNewInteraction','Attachment','bulkCreate','Smtp','forwardOffline','service','host','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','subjectOffline','toPairsIn','mapValues','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','User','Owner','internal','Tag','Tags','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','custom','License','increment','chatLicenseExceeded','push','all','remote','x-real-ip','remoteAddress','referer','virtual','replace','verticalAlignment','color','textColor','color_button','backgroundColor','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','getApplications','addProactiveActions','ChatProactiveAction','getFields','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','userChatWebsite:save','removeAgents','emit','userChatWebsite:remove','getAgents','bluebird','mustache','util','ejs','fs-extra','querystring','ioredis','../../config/logger','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatWebsite,\x20%s,\x20%s','catch','status','end','json','undefined','limit','count','offset','set','Content-Range','update','destroy','get','ChatWebsites','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','options','include','rows','show','params','length','includeAll','find','create','body','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','nolimit','order','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','filename','addAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','isNil','existsSync','server/files/images/logos/','join','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','setUA','user-agent','getResult','chat','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','account','applications','list'];(function(_0x5049e1,_0x4ac87a){var _0x37f162=function(_0x2e06cb){while(--_0x2e06cb){_0x5049e1['push'](_0x5049e1['shift']());}};_0x37f162(++_0x4ac87a);}(_0x6d5e,0x1c6));var _0xe6d5=function(_0x1df8cb,_0x53a66c){_0x1df8cb=_0x1df8cb-0x0;var _0x259a5a=_0x6d5e[_0x1df8cb];return _0x259a5a;};'use strict';var BPromise=require(_0xe6d5('0x0'));var Mustache=require(_0xe6d5('0x1'));var util=require(_0xe6d5('0x2'));var path=require('path');var ejs=require(_0xe6d5('0x3'));var fs=require('fs');var fs_extra=require(_0xe6d5('0x4'));var _=require('lodash');var querystring=require(_0xe6d5('0x5'));var Redis=require(_0xe6d5('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0xe6d5('0x7'))('api');var config=require('../../config/environment');var db=require(_0xe6d5('0x8'))['db'];config[_0xe6d5('0x9')]=_['defaults'](config['redis'],{'host':_0xe6d5('0xa'),'port':0x18eb});var socket=require(_0xe6d5('0xb'))(new Redis(config[_0xe6d5('0x9')]));require(_0xe6d5('0xc'))[_0xe6d5('0xd')](socket);var jayson=require(_0xe6d5('0xe'));var client=jayson[_0xe6d5('0xf')][_0xe6d5('0x10')]({'port':0x232c});var client9002=jayson[_0xe6d5('0xf')][_0xe6d5('0x10')]({'port':0x232a});var client9003=jayson['client'][_0xe6d5('0x10')]({'port':0x232b});var client9001=jayson[_0xe6d5('0xf')]['http']({'port':0x2329});function respondWithRpcPromise(_0x2990c1,_0x3ad387,_0x35c540,_0x12a715){return new BPromise(function(_0xbb2244,_0x597ca8){var _0x2aa3fa=_0x12a715||client;return _0x2aa3fa[_0xe6d5('0x11')](_0x2990c1,_0x35c540)[_0xe6d5('0x12')](function(_0x2608c6){logger[_0xe6d5('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x3ad387,_0xe6d5('0x14'));logger[_0xe6d5('0x15')](_0xe6d5('0x16'),_0x3ad387,_0xe6d5('0x14'),JSON[_0xe6d5('0x17')](_0x2608c6));if(_0x2608c6[_0xe6d5('0x18')]){if(_0x2608c6[_0xe6d5('0x18')]['code']===0x1f4){logger[_0xe6d5('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x3ad387,_0x2608c6[_0xe6d5('0x18')][_0xe6d5('0x19')]);return _0x597ca8(_0x2608c6[_0xe6d5('0x18')][_0xe6d5('0x19')]);}logger[_0xe6d5('0x18')](_0xe6d5('0x1a'),_0x3ad387,_0x2608c6[_0xe6d5('0x18')]['message']);return _0xbb2244(_0x2608c6['error']['message']);}else{logger[_0xe6d5('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x3ad387,_0xe6d5('0x14'));_0xbb2244(_0x2608c6['result'][_0xe6d5('0x19')]);}})[_0xe6d5('0x1b')](function(_0x56fc13){logger[_0xe6d5('0x18')](_0xe6d5('0x1a'),_0x3ad387,_0x56fc13);_0x597ca8(_0x56fc13);});});}function respondWithStatusCode(_0x1dc1f9,_0x5994c8){_0x5994c8=_0x5994c8||0xcc;return function(_0x39bfe5){if(_0x39bfe5){return _0x1dc1f9['sendStatus'](_0x5994c8);}return _0x1dc1f9[_0xe6d5('0x1c')](_0x5994c8)[_0xe6d5('0x1d')]();};}function respondWithResult(_0x20b724,_0x252b20){_0x252b20=_0x252b20||0xc8;return function(_0x55ee29){if(_0x55ee29){return _0x20b724[_0xe6d5('0x1c')](_0x252b20)[_0xe6d5('0x1e')](_0x55ee29);}};}function respondWithFilteredResult(_0x4cfee6,_0x4d43eb){return function(_0x22fe3c){if(_0x22fe3c){var _0x5a47d9=typeof _0x4d43eb['offset']===_0xe6d5('0x1f')&&typeof _0x4d43eb[_0xe6d5('0x20')]===_0xe6d5('0x1f');var _0x2dd993=_0x22fe3c[_0xe6d5('0x21')];var _0x959852=_0x5a47d9?0x0:_0x4d43eb[_0xe6d5('0x22')];var _0x1a2545=_0x5a47d9?_0x22fe3c[_0xe6d5('0x21')]:_0x4d43eb[_0xe6d5('0x22')]+_0x4d43eb['limit'];var _0x492059;if(_0x1a2545>=_0x2dd993){_0x1a2545=_0x2dd993;_0x492059=0xc8;}else{_0x492059=0xce;}_0x4cfee6[_0xe6d5('0x1c')](_0x492059);return _0x4cfee6[_0xe6d5('0x23')](_0xe6d5('0x24'),_0x959852+'-'+_0x1a2545+'/'+_0x2dd993)[_0xe6d5('0x1e')](_0x22fe3c);}return null;};}function saveUpdates(_0x3cbb06){return function(_0x420c95){if(_0x420c95){return _0x420c95[_0xe6d5('0x25')](_0x3cbb06)['then'](function(_0x233a7e){return _0x233a7e;});}return null;};}function removeEntity(_0x9e90d2){return function(_0x3f400b){if(_0x3f400b){return _0x3f400b[_0xe6d5('0x26')]()[_0xe6d5('0x12')](function(){var _0x2bbd64=_0x3f400b[_0xe6d5('0x27')]({'plain':!![]});var _0x2ca1f5=_0xe6d5('0x28');return db[_0xe6d5('0x29')][_0xe6d5('0x26')]({'where':{'type':_0x2ca1f5,'resourceId':_0x2bbd64['id']}})['then'](function(){return _0x3f400b;});})['then'](function(){_0x9e90d2[_0xe6d5('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54eb06){return function(_0x5492f3){if(!_0x5492f3){_0x54eb06[_0xe6d5('0x2a')](0x194);}return _0x5492f3;};}function handleError(_0x56dc77,_0xf39a96){_0xf39a96=_0xf39a96||0x1f4;return function(_0x1385a4){logger['error'](_0x1385a4[_0xe6d5('0x2b')]);if(_0x1385a4[_0xe6d5('0x2c')]){delete _0x1385a4[_0xe6d5('0x2c')];}_0x56dc77[_0xe6d5('0x1c')](_0xf39a96)[_0xe6d5('0x2d')](_0x1385a4);};}exports[_0xe6d5('0x2e')]=function(_0x13b049,_0x3bd880){var _0x428db9={'include':[{'model':db[_0xe6d5('0x2f')],'as':_0xe6d5('0x30')}]},_0x46bfeb={},_0x4b5a45={'count':0x0,'rows':[]};var _0x165781=_[_0xe6d5('0x31')](db[_0xe6d5('0x32')][_0xe6d5('0x33')],function(_0x29222c){return{'name':_0x29222c[_0xe6d5('0x34')],'type':_0x29222c[_0xe6d5('0x35')][_0xe6d5('0x36')]};});_0x46bfeb[_0xe6d5('0x37')]=_[_0xe6d5('0x31')](_0x165781,'name');_0x46bfeb[_0xe6d5('0x38')]=_[_0xe6d5('0x39')](_0x13b049[_0xe6d5('0x38')]);_0x46bfeb[_0xe6d5('0x3a')]=_[_0xe6d5('0x3b')](_0x46bfeb[_0xe6d5('0x37')],_0x46bfeb[_0xe6d5('0x38')]);_0x428db9[_0xe6d5('0x3c')]=_[_0xe6d5('0x3b')](_0x46bfeb[_0xe6d5('0x37')],qs[_0xe6d5('0x3d')](_0x13b049[_0xe6d5('0x38')][_0xe6d5('0x3d')]));_0x428db9[_0xe6d5('0x3c')]=_0x428db9[_0xe6d5('0x3c')]['length']?_0x428db9[_0xe6d5('0x3c')]:_0x46bfeb['model'];if(!_0x13b049[_0xe6d5('0x38')][_0xe6d5('0x3e')]('nolimit')){_0x428db9[_0xe6d5('0x20')]=qs[_0xe6d5('0x20')](_0x13b049[_0xe6d5('0x38')][_0xe6d5('0x20')]);_0x428db9['offset']=qs[_0xe6d5('0x22')](_0x13b049[_0xe6d5('0x38')][_0xe6d5('0x22')]);}_0x428db9['order']=qs[_0xe6d5('0x3f')](_0x13b049[_0xe6d5('0x38')][_0xe6d5('0x3f')]);_0x428db9[_0xe6d5('0x40')]=qs['filters'](_[_0xe6d5('0x41')](_0x13b049[_0xe6d5('0x38')],_0x46bfeb[_0xe6d5('0x3a')]),_0x165781);if(_0x13b049[_0xe6d5('0x38')][_0xe6d5('0x42')]){_0x428db9[_0xe6d5('0x40')]=_[_0xe6d5('0x43')](_0x428db9[_0xe6d5('0x40')],{'$or':_[_0xe6d5('0x31')](_0x165781,function(_0x18cdd9){if(_0x18cdd9[_0xe6d5('0x35')]!=='VIRTUAL'){var _0x263ed6={};_0x263ed6[_0x18cdd9[_0xe6d5('0x2c')]]={'$like':'%'+_0x13b049[_0xe6d5('0x38')][_0xe6d5('0x42')]+'%'};return _0x263ed6;}})});}_0x428db9=_['merge']({},_0x428db9,_0x13b049[_0xe6d5('0x44')]);var _0x484a79={'where':_0x428db9[_0xe6d5('0x40')]};return db[_0xe6d5('0x32')][_0xe6d5('0x21')](_0x484a79)[_0xe6d5('0x12')](function(_0x5eb3a6){_0x4b5a45['count']=_0x5eb3a6;if(_0x13b049['query']['includeAll']){_0x428db9[_0xe6d5('0x45')]=[{'all':!![]}];}return db[_0xe6d5('0x32')]['findAll'](_0x428db9);})[_0xe6d5('0x12')](function(_0x467827){_0x4b5a45[_0xe6d5('0x46')]=_0x467827;return _0x4b5a45;})[_0xe6d5('0x12')](respondWithFilteredResult(_0x3bd880,_0x428db9))[_0xe6d5('0x1b')](handleError(_0x3bd880,null));};exports[_0xe6d5('0x47')]=function(_0x3c09af,_0x5d0fbc){var _0x45e066={'raw':![],'where':{'id':_0x3c09af[_0xe6d5('0x48')]['id']},'include':[{'model':db[_0xe6d5('0x2f')],'as':_0xe6d5('0x30')}]},_0x2bb27d={};_0x2bb27d[_0xe6d5('0x37')]=_[_0xe6d5('0x39')](db[_0xe6d5('0x32')][_0xe6d5('0x33')]);_0x2bb27d[_0xe6d5('0x38')]=_[_0xe6d5('0x39')](_0x3c09af[_0xe6d5('0x38')]);_0x2bb27d[_0xe6d5('0x3a')]=_[_0xe6d5('0x3b')](_0x2bb27d[_0xe6d5('0x37')],_0x2bb27d[_0xe6d5('0x38')]);_0x45e066[_0xe6d5('0x3c')]=_[_0xe6d5('0x3b')](_0x2bb27d['model'],qs[_0xe6d5('0x3d')](_0x3c09af['query'][_0xe6d5('0x3d')]));_0x45e066['attributes']=_0x45e066[_0xe6d5('0x3c')][_0xe6d5('0x49')]?_0x45e066['attributes']:_0x2bb27d[_0xe6d5('0x37')];if(_0x3c09af[_0xe6d5('0x38')][_0xe6d5('0x4a')]){_0x45e066[_0xe6d5('0x45')]=[{'all':!![]}];}_0x45e066=_[_0xe6d5('0x43')]({},_0x45e066,_0x3c09af[_0xe6d5('0x44')]);return db['ChatWebsite'][_0xe6d5('0x4b')](_0x45e066)['then'](handleEntityNotFound(_0x5d0fbc,null))[_0xe6d5('0x12')](respondWithResult(_0x5d0fbc,null))[_0xe6d5('0x1b')](handleError(_0x5d0fbc,null));};exports[_0xe6d5('0x4c')]=function(_0x54a916,_0x2af27e){return db[_0xe6d5('0x32')][_0xe6d5('0x4c')](_0x54a916[_0xe6d5('0x4d')],{})['then'](function(_0x4394f0){var _0x27939b=_0x54a916[_0xe6d5('0x4e')][_0xe6d5('0x27')]({'plain':!![]});if(!_0x27939b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x27939b['role']===_0xe6d5('0x4e')){var _0x4e4391=_0x4394f0[_0xe6d5('0x27')]({'plain':!![]});var _0x28a6cb=_0xe6d5('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x28a6cb,'userProfileId':_0x27939b[_0xe6d5('0x4f')]},'raw':!![]})[_0xe6d5('0x12')](function(_0x23aaba){if(_0x23aaba&&_0x23aaba['autoAssociation']===0x0){return db[_0xe6d5('0x29')][_0xe6d5('0x4c')]({'name':_0x4e4391[_0xe6d5('0x2c')],'resourceId':_0x4e4391['id'],'type':_0x23aaba[_0xe6d5('0x2c')],'sectionId':_0x23aaba['id']},{})[_0xe6d5('0x12')](function(){return _0x4394f0;});}else{return _0x4394f0;}})[_0xe6d5('0x1b')](function(_0xd9052a){logger['error'](_0xe6d5('0x50'),_0xd9052a);throw _0xd9052a;});}return _0x4394f0;})[_0xe6d5('0x12')](respondWithResult(_0x2af27e,0xc9))[_0xe6d5('0x1b')](handleError(_0x2af27e,null));};exports[_0xe6d5('0x25')]=function(_0x2fe88c,_0x1746e3){if(_0x2fe88c[_0xe6d5('0x4d')]['id']){delete _0x2fe88c[_0xe6d5('0x4d')]['id'];}return db[_0xe6d5('0x32')]['find']({'where':{'id':_0x2fe88c[_0xe6d5('0x48')]['id']},'include':[{'model':db[_0xe6d5('0x2f')],'as':_0xe6d5('0x30')}]})[_0xe6d5('0x12')](handleEntityNotFound(_0x1746e3,null))['then'](saveUpdates(_0x2fe88c[_0xe6d5('0x4d')],null))[_0xe6d5('0x12')](respondWithResult(_0x1746e3,null))[_0xe6d5('0x1b')](handleError(_0x1746e3,null));};exports['destroy']=function(_0x3f8dd6,_0x775e8c){return db[_0xe6d5('0x32')][_0xe6d5('0x4b')]({'where':{'id':_0x3f8dd6[_0xe6d5('0x48')]['id']}})[_0xe6d5('0x12')](handleEntityNotFound(_0x775e8c,null))[_0xe6d5('0x12')](removeEntity(_0x775e8c,null))[_0xe6d5('0x1b')](handleError(_0x775e8c,null));};exports[_0xe6d5('0x51')]=function(_0x229549,_0x2f5934){return db[_0xe6d5('0x32')][_0xe6d5('0x51')]()[_0xe6d5('0x12')](respondWithResult(_0x2f5934,null))['catch'](handleError(_0x2f5934,null));};exports[_0xe6d5('0x52')]=function(_0x4ea32f,_0xc3d5){if(_0x4ea32f[_0xe6d5('0x4d')]['id']){delete _0x4ea32f[_0xe6d5('0x4d')]['id'];}return db['ChatWebsite'][_0xe6d5('0x4b')]({'where':{'id':_0x4ea32f[_0xe6d5('0x48')]['id']}})[_0xe6d5('0x12')](handleEntityNotFound(_0xc3d5,null))['then'](function(_0x3dcb7c){if(_0x3dcb7c){_0x4ea32f[_0xe6d5('0x4d')][_0xe6d5('0x53')]=_0x3dcb7c['id'];return db[_0xe6d5('0x54')]['create'](_0x4ea32f['body']);}})[_0xe6d5('0x12')](respondWithResult(_0xc3d5,null))[_0xe6d5('0x1b')](handleError(_0xc3d5,null));};exports[_0xe6d5('0x55')]=function(_0x114e59,_0x41a446){var _0x397cde={'raw':![],'where':{}};var _0x542d41={};var _0x350429={'count':0x0,'rows':[]};return db[_0xe6d5('0x32')][_0xe6d5('0x56')]({'where':{'id':_0x114e59['params']['id']}})[_0xe6d5('0x12')](handleEntityNotFound(_0x41a446,null))['then'](function(_0x187d41){if(_0x187d41){_0x542d41[_0xe6d5('0x37')]=_[_0xe6d5('0x39')](db['Disposition'][_0xe6d5('0x33')]);_0x542d41['query']=_[_0xe6d5('0x39')](_0x114e59[_0xe6d5('0x38')]);_0x542d41[_0xe6d5('0x3a')]=_['intersection'](_0x542d41['model'],_0x542d41[_0xe6d5('0x38')]);_0x397cde[_0xe6d5('0x3c')]=_[_0xe6d5('0x3b')](_0x542d41[_0xe6d5('0x37')],qs[_0xe6d5('0x3d')](_0x114e59[_0xe6d5('0x38')]['fields']));_0x397cde[_0xe6d5('0x3c')]=_0x397cde[_0xe6d5('0x3c')][_0xe6d5('0x49')]?_0x397cde['attributes']:_0x542d41['model'];if(!_0x114e59[_0xe6d5('0x38')]['hasOwnProperty'](_0xe6d5('0x57'))){_0x397cde[_0xe6d5('0x20')]=qs[_0xe6d5('0x20')](_0x114e59[_0xe6d5('0x38')][_0xe6d5('0x20')]);_0x397cde[_0xe6d5('0x22')]=qs[_0xe6d5('0x22')](_0x114e59['query'][_0xe6d5('0x22')]);}_0x397cde[_0xe6d5('0x58')]=qs['sort'](_0x114e59[_0xe6d5('0x38')][_0xe6d5('0x3f')]);_0x397cde[_0xe6d5('0x40')]=qs[_0xe6d5('0x3a')](_[_0xe6d5('0x41')](_0x114e59[_0xe6d5('0x38')],_0x542d41[_0xe6d5('0x3a')]));_0x397cde[_0xe6d5('0x40')][_0xe6d5('0x53')]=_0x187d41['id'];if(_0x114e59[_0xe6d5('0x38')][_0xe6d5('0x42')]){_0x397cde[_0xe6d5('0x40')]=_[_0xe6d5('0x43')](_0x397cde['where'],{'$or':_[_0xe6d5('0x31')](_0x397cde['attributes'],function(_0x537e99){var _0x5760c7={};_0x5760c7[_0x537e99]={'$like':'%'+_0x114e59[_0xe6d5('0x38')]['filter']+'%'};return _0x5760c7;})});}_0x397cde=_[_0xe6d5('0x43')]({},_0x397cde,_0x114e59[_0xe6d5('0x44')]);return db[_0xe6d5('0x54')][_0xe6d5('0x21')]({'where':_0x397cde[_0xe6d5('0x40')]})['then'](function(_0x374875){_0x350429[_0xe6d5('0x21')]=_0x374875;if(_0x114e59[_0xe6d5('0x38')][_0xe6d5('0x4a')]){_0x397cde[_0xe6d5('0x45')]=[{'all':!![]}];}return db[_0xe6d5('0x54')][_0xe6d5('0x59')](_0x397cde);})[_0xe6d5('0x12')](function(_0x5b1a59){_0x350429['rows']=_0x5b1a59;return _0x350429;});}})['then'](respondWithFilteredResult(_0x41a446,_0x397cde))['catch'](handleError(_0x41a446,null));};exports[_0xe6d5('0x5a')]=function(_0x279350,_0x245f66){return db[_0xe6d5('0x32')][_0xe6d5('0x4b')]({'where':{'id':_0x279350[_0xe6d5('0x48')]['id']}})[_0xe6d5('0x12')](handleEntityNotFound(_0x245f66,null))[_0xe6d5('0x12')](function(_0x2231f4){if(_0x2231f4){return _0x2231f4[_0xe6d5('0x5a')](_0x279350['query'][_0xe6d5('0x5b')]);}})[_0xe6d5('0x12')](respondWithStatusCode(_0x245f66,null))[_0xe6d5('0x1b')](handleError(_0x245f66,null));};exports[_0xe6d5('0x5c')]=function(_0x425afc,_0x19ed45){if(_0x425afc[_0xe6d5('0x4d')]['id']){delete _0x425afc['body']['id'];}return db[_0xe6d5('0x32')][_0xe6d5('0x4b')]({'where':{'id':_0x425afc[_0xe6d5('0x48')]['id']}})['then'](handleEntityNotFound(_0x19ed45,null))[_0xe6d5('0x12')](function(_0x1cac47){if(_0x1cac47){_0x425afc[_0xe6d5('0x4d')][_0xe6d5('0x53')]=_0x1cac47['id'];return db[_0xe6d5('0x5d')][_0xe6d5('0x4c')](_0x425afc[_0xe6d5('0x4d')]);}})['then'](respondWithResult(_0x19ed45,null))[_0xe6d5('0x1b')](handleError(_0x19ed45,null));};exports[_0xe6d5('0x5e')]=function(_0x24f883,_0x1f880b){var _0x172f7d={'raw':![],'where':{}};var _0x544ae5={};var _0x52cb25={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x24f883['params']['id']}})[_0xe6d5('0x12')](handleEntityNotFound(_0x1f880b,null))[_0xe6d5('0x12')](function(_0x5b5982){if(_0x5b5982){_0x544ae5[_0xe6d5('0x37')]=_[_0xe6d5('0x39')](db[_0xe6d5('0x5d')][_0xe6d5('0x33')]);_0x544ae5[_0xe6d5('0x38')]=_[_0xe6d5('0x39')](_0x24f883[_0xe6d5('0x38')]);_0x544ae5['filters']=_['intersection'](_0x544ae5['model'],_0x544ae5[_0xe6d5('0x38')]);_0x172f7d[_0xe6d5('0x3c')]=_[_0xe6d5('0x3b')](_0x544ae5['model'],qs[_0xe6d5('0x3d')](_0x24f883['query']['fields']));_0x172f7d[_0xe6d5('0x3c')]=_0x172f7d[_0xe6d5('0x3c')][_0xe6d5('0x49')]?_0x172f7d[_0xe6d5('0x3c')]:_0x544ae5[_0xe6d5('0x37')];if(!_0x24f883[_0xe6d5('0x38')][_0xe6d5('0x3e')](_0xe6d5('0x57'))){_0x172f7d[_0xe6d5('0x20')]=qs[_0xe6d5('0x20')](_0x24f883['query']['limit']);_0x172f7d[_0xe6d5('0x22')]=qs['offset'](_0x24f883['query'][_0xe6d5('0x22')]);}_0x172f7d[_0xe6d5('0x58')]=qs['sort'](_0x24f883[_0xe6d5('0x38')][_0xe6d5('0x3f')]);_0x172f7d[_0xe6d5('0x40')]=qs[_0xe6d5('0x3a')](_[_0xe6d5('0x41')](_0x24f883['query'],_0x544ae5[_0xe6d5('0x3a')]));_0x172f7d[_0xe6d5('0x40')][_0xe6d5('0x53')]=_0x5b5982['id'];if(_0x24f883['query'][_0xe6d5('0x42')]){_0x172f7d[_0xe6d5('0x40')]=_[_0xe6d5('0x43')](_0x172f7d[_0xe6d5('0x40')],{'$or':_[_0xe6d5('0x31')](_0x172f7d[_0xe6d5('0x3c')],function(_0x3136b2){var _0xcdd2d8={};_0xcdd2d8[_0x3136b2]={'$like':'%'+_0x24f883[_0xe6d5('0x38')]['filter']+'%'};return _0xcdd2d8;})});}_0x172f7d=_[_0xe6d5('0x43')]({},_0x172f7d,_0x24f883[_0xe6d5('0x44')]);return db[_0xe6d5('0x5d')][_0xe6d5('0x21')]({'where':_0x172f7d[_0xe6d5('0x40')]})[_0xe6d5('0x12')](function(_0x50bf10){_0x52cb25[_0xe6d5('0x21')]=_0x50bf10;if(_0x24f883['query'][_0xe6d5('0x4a')]){_0x172f7d[_0xe6d5('0x45')]=[{'all':!![]}];}return db[_0xe6d5('0x5d')][_0xe6d5('0x59')](_0x172f7d);})['then'](function(_0x312c41){_0x52cb25['rows']=_0x312c41;return _0x52cb25;});}})[_0xe6d5('0x12')](respondWithFilteredResult(_0x1f880b,_0x172f7d))[_0xe6d5('0x1b')](handleError(_0x1f880b,null));};exports[_0xe6d5('0x5f')]=function(_0x441dfa,_0xc93e60){return db[_0xe6d5('0x32')]['find']({'where':{'id':_0x441dfa['params']['id']}})['then'](handleEntityNotFound(_0xc93e60,null))[_0xe6d5('0x12')](function(_0x17b6fc){if(_0x17b6fc){return _0x17b6fc[_0xe6d5('0x5f')](_0x441dfa['query'][_0xe6d5('0x5b')]);}})[_0xe6d5('0x12')](respondWithStatusCode(_0xc93e60,null))[_0xe6d5('0x1b')](handleError(_0xc93e60,null));};exports[_0xe6d5('0x60')]=function(_0x163194,_0x247137){_0x163194[_0xe6d5('0x4d')][_0xe6d5('0x61')]=_0x163194['file'][_0xe6d5('0x62')];return db['ChatWebsite'][_0xe6d5('0x4b')]({'where':{'id':_0x163194[_0xe6d5('0x48')]['id']}})[_0xe6d5('0x12')](handleEntityNotFound(_0x247137,null))[_0xe6d5('0x12')](saveUpdates(_0x163194[_0xe6d5('0x4d')],null))['then'](respondWithResult(_0x247137,null))[_0xe6d5('0x1b')](handleError(_0x247137,null));};exports[_0xe6d5('0x63')]=function(_0x1cb9a6,_0x2a9cdf){_0x1cb9a6['body']['agentAvatar']=_0x1cb9a6[_0xe6d5('0x64')][_0xe6d5('0x62')];return db[_0xe6d5('0x32')][_0xe6d5('0x4b')]({'where':{'id':_0x1cb9a6['params']['id']}})[_0xe6d5('0x12')](handleEntityNotFound(_0x2a9cdf,null))['then'](saveUpdates(_0x1cb9a6['body'],null))[_0xe6d5('0x12')](respondWithResult(_0x2a9cdf,null))['catch'](handleError(_0x2a9cdf,null));};exports[_0xe6d5('0x65')]=function(_0x1322df,_0x89959e){_0x1322df[_0xe6d5('0x4d')][_0xe6d5('0x66')]=_0x1322df[_0xe6d5('0x64')][_0xe6d5('0x62')];return db['ChatWebsite'][_0xe6d5('0x4b')]({'where':{'id':_0x1322df[_0xe6d5('0x48')]['id']}})['then'](handleEntityNotFound(_0x89959e,null))[_0xe6d5('0x12')](saveUpdates(_0x1322df[_0xe6d5('0x4d')],null))[_0xe6d5('0x12')](respondWithResult(_0x89959e,null))[_0xe6d5('0x1b')](handleError(_0x89959e,null));};exports[_0xe6d5('0x67')]=function(_0x3563b4,_0x44db10){_0x3563b4[_0xe6d5('0x4d')]['systemAvatar']=_0x3563b4['file'][_0xe6d5('0x62')];return db[_0xe6d5('0x32')]['find']({'where':{'id':_0x3563b4[_0xe6d5('0x48')]['id']}})['then'](handleEntityNotFound(_0x44db10,null))['then'](saveUpdates(_0x3563b4[_0xe6d5('0x4d')],null))[_0xe6d5('0x12')](respondWithResult(_0x44db10,null))[_0xe6d5('0x1b')](handleError(_0x44db10,null));};exports[_0xe6d5('0x68')]=function(_0xb3fd24,_0x4e5a47){var _0x32fc7a=path['join'](config[_0xe6d5('0x69')],_0xe6d5('0x6a'));var _0x3bee53={'where':{'id':_0xb3fd24['params']['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x5a9cf6=![];return require(_0xe6d5('0x6b'))[_0xe6d5('0x6c')]()[_0xe6d5('0x12')](function(_0x30f7ea){if(_0x30f7ea){_0x5a9cf6=_0x30f7ea['custom'];}})['then'](function(){return db[_0xe6d5('0x32')][_0xe6d5('0x4b')](_0x3bee53);})[_0xe6d5('0x12')](handleEntityNotFound(_0x4e5a47,null))[_0xe6d5('0x12')](function(_0x5d1ef2){if(_0x5d1ef2){if(!_[_0xe6d5('0x6d')](_0x5d1ef2['sitepic'])){if(fs[_0xe6d5('0x6e')](path['join'](config[_0xe6d5('0x69')],_0xe6d5('0x6f'),_0x5d1ef2[_0xe6d5('0x61')]))&&_0x5a9cf6){_0x32fc7a=path[_0xe6d5('0x70')](config[_0xe6d5('0x69')],_0xe6d5('0x6f'),_0x5d1ef2[_0xe6d5('0x61')]);}}return _0x4e5a47[_0xe6d5('0x71')](_0x32fc7a);}})['catch'](handleError(_0x4e5a47,null));};exports[_0xe6d5('0x72')]=function(_0x91575c,_0x21de5e){var _0x25cb74=path[_0xe6d5('0x70')](config[_0xe6d5('0x69')],_0xe6d5('0x73'));var _0x542622={'where':{'id':_0x91575c['params']['id']},'attributes':['id',_0xe6d5('0x74')],'raw':!![]};return db[_0xe6d5('0x32')][_0xe6d5('0x4b')](_0x542622)['then'](handleEntityNotFound(_0x21de5e,null))[_0xe6d5('0x12')](function(_0x19b838){if(_0x19b838){if(!_['isNil'](_0x19b838[_0xe6d5('0x74')])){if(fs[_0xe6d5('0x6e')](path['join'](config[_0xe6d5('0x69')],'server/files/images/avatars/',_0x19b838[_0xe6d5('0x74')]))){_0x25cb74=path[_0xe6d5('0x70')](config[_0xe6d5('0x69')],'server/files/images/avatars/',_0x19b838[_0xe6d5('0x74')]);}}return _0x21de5e[_0xe6d5('0x71')](_0x25cb74);}})[_0xe6d5('0x1b')](handleError(_0x21de5e,null));};exports['getCustomerAvatar']=function(_0x68ce9a,_0x482759){var _0xb8c059=path['join'](config['root'],'server/files/images/avatars/customer_avatar.png');var _0x5ac945={'where':{'id':_0x68ce9a[_0xe6d5('0x48')]['id']},'attributes':['id',_0xe6d5('0x66'),'showCustomerAvatar'],'raw':!![]};return db[_0xe6d5('0x32')]['find'](_0x5ac945)['then'](handleEntityNotFound(_0x482759,null))[_0xe6d5('0x12')](function(_0x50f161){if(_0x50f161){if(!_[_0xe6d5('0x6d')](_0x50f161[_0xe6d5('0x66')])){if(fs['existsSync'](path[_0xe6d5('0x70')](config['root'],_0xe6d5('0x75'),_0x50f161[_0xe6d5('0x66')]))&&_0x50f161[_0xe6d5('0x76')]){_0xb8c059=path[_0xe6d5('0x70')](config[_0xe6d5('0x69')],'server/files/images/avatars/',_0x50f161[_0xe6d5('0x66')]);}}return _0x482759[_0xe6d5('0x71')](_0xb8c059);}})[_0xe6d5('0x1b')](handleError(_0x482759,null));};exports[_0xe6d5('0x77')]=function(_0x2d0e81,_0x1de4c8){var _0x1fd736=path[_0xe6d5('0x70')](config['root'],_0xe6d5('0x78'));var _0x5c4589={'where':{'id':_0x2d0e81[_0xe6d5('0x48')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xe6d5('0x32')][_0xe6d5('0x4b')](_0x5c4589)[_0xe6d5('0x12')](handleEntityNotFound(_0x1de4c8,null))['then'](function(_0x159d06){if(_0x159d06){if(!_['isNil'](_0x159d06[_0xe6d5('0x79')])){if(fs['existsSync'](path['join'](config[_0xe6d5('0x69')],_0xe6d5('0x75'),_0x159d06['systemAvatar']))){_0x1fd736=path['join'](config['root'],_0xe6d5('0x75'),_0x159d06[_0xe6d5('0x79')]);}}return _0x1de4c8[_0xe6d5('0x71')](_0x1fd736);}})['catch'](handleError(_0x1de4c8,null));};exports[_0xe6d5('0x7a')]=function(_0xa459e8,_0x11ed51){var _0x24c259=require('user-agent-parser');var _0xc907f1=new _0x24c259();var _0x1baac1=_0xc907f1[_0xe6d5('0x7b')](_0xa459e8['headers'][_0xe6d5('0x7c')])[_0xe6d5('0x7d')]();var _0x142e0b={'body':_0xa459e8[_0xe6d5('0x4d')],'channel':_0xe6d5('0x7e')};var _0x239e6b=[];var _0x2b98d9=[];var _0x51ba37={};var _0x344051=![];return db[_0xe6d5('0x7f')][_0xe6d5('0x51')]()[_0xe6d5('0x12')](function(_0x46b661){if(!_0x46b661){throw new db['Sequelize'][(_0xe6d5('0x80'))](_0xe6d5('0x81'));}_0x239e6b=_[_0xe6d5('0x82')](_[_0xe6d5('0x39')](_0x46b661),[_0xe6d5('0x83'),'updatedAt']);_0x2b98d9=_['difference'](_[_0xe6d5('0x39')](_0x46b661),[_0xe6d5('0x83'),_0xe6d5('0x84'),_0xe6d5('0x85'),_0xe6d5('0x86')]);if(_0xa459e8[_0xe6d5('0x4d')]['id']){delete _0xa459e8['body']['id'];}if(_[_0xe6d5('0x6d')](_0xa459e8['body'][_0xe6d5('0x87')])){throw new db[(_0xe6d5('0x88'))][(_0xe6d5('0x80'))](_0xe6d5('0x89'));}if(_[_0xe6d5('0x6d')](_0xa459e8[_0xe6d5('0x4d')]['body'])||_0xa459e8['body'][_0xe6d5('0x4d')]===''){throw new db[(_0xe6d5('0x88'))]['ValidationError'](_0xe6d5('0x8a'));}if(_['isNil'](_0xa459e8[_0xe6d5('0x4d')][_0xe6d5('0x8b')])){throw new db['Sequelize'][(_0xe6d5('0x80'))](_0xe6d5('0x8c')+_0x2b98d9);}if(!_[_0xe6d5('0x8d')](_0x2b98d9,_0xa459e8[_0xe6d5('0x4d')][_0xe6d5('0x8b')])){throw new db['Sequelize'][(_0xe6d5('0x80'))](_0xe6d5('0x8e')+_0x2b98d9);}_0x51ba37[_0xa459e8[_0xe6d5('0x4d')][_0xe6d5('0x8b')]]=_0xa459e8[_0xe6d5('0x4d')][_0xe6d5('0x87')];})[_0xe6d5('0x12')](function(){return db[_0xe6d5('0x32')]['find']({'where':{'id':_0xa459e8['params']['id']},'include':[{'model':db[_0xe6d5('0x8f')],'as':_0xe6d5('0x90'),'include':[{'model':db[_0xe6d5('0x7f')],'as':_0xe6d5('0x91'),'where':_0x51ba37,'limit':0x1,'order':[['updatedAt',_0xe6d5('0x92')]]}]},{'model':db[_0xe6d5('0x93')],'as':_0xe6d5('0x94')}]});})['then'](handleEntityNotFound(_0x11ed51,null))[_0xe6d5('0x12')](function(_0x2370d0){if(_0x2370d0&&_0x2370d0[_0xe6d5('0x90')]){_0x142e0b[_0xe6d5('0x95')]=_0x2370d0;_0x142e0b[_0xe6d5('0x96')]=_0x2370d0[_0xe6d5('0x94')];_0x142e0b[_0xe6d5('0x97')]=_0x2370d0[_0xe6d5('0x90')];_0x142e0b[_0xe6d5('0x96')]=_[_0xe6d5('0x98')](_0x142e0b[_0xe6d5('0x96')],[_0xe6d5('0x99')],[_0xe6d5('0x9a')]);if(_0x142e0b['account'][_0xe6d5('0x94')]){delete _0x142e0b['account'][_0xe6d5('0x94')];}if(_0x142e0b[_0xe6d5('0x95')][_0xe6d5('0x90')]&&_0x142e0b[_0xe6d5('0x95')][_0xe6d5('0x90')][_0xe6d5('0x91')][_0xe6d5('0x49')]){return _0x142e0b[_0xe6d5('0x95')][_0xe6d5('0x90')][_0xe6d5('0x91')][0x0];}var _0x2ed970=_[_0xe6d5('0x9b')](_0xa459e8[_0xe6d5('0x4d')],{'firstName':_0xa459e8[_0xe6d5('0x4d')]['from'],'ListId':_0x2370d0[_0xe6d5('0x86')]});_0x2ed970[_0xa459e8['body'][_0xe6d5('0x8b')]]=_0xa459e8[_0xe6d5('0x4d')][_0xe6d5('0x87')];return db[_0xe6d5('0x7f')][_0xe6d5('0x4c')](_0x2ed970,{'fields':_0x239e6b,'raw':!![]});}})['then'](handleEntityNotFound(_0x11ed51,null))[_0xe6d5('0x12')](function(_0x5225ce){_0x142e0b['contact']=_0x5225ce;var _0x4695d9=_0xa459e8[_0xe6d5('0x4d')][_0xe6d5('0x9c')];if(_0xa459e8['headers']['cf-connecting-ip']){_0x4695d9=_0xa459e8['headers'][_0xe6d5('0x9d')];}else if(_0xa459e8[_0xe6d5('0x9e')][_0xe6d5('0x9f')]){_0x4695d9=_[_0xe6d5('0xa0')](_0xa459e8['headers'][_0xe6d5('0x9f')][_0xe6d5('0xa1')](','));}if(_0x5225ce){var _0x1343ba={'ContactId':_0x5225ce['id'],'ChatWebsiteId':_0xa459e8[_0xe6d5('0x48')]['id'],'from':(_0x5225ce[_0xe6d5('0xa2')]||'')+'\x20'+(_0x5225ce[_0xe6d5('0xa3')]||''),'customerIp':_0x4695d9,'customerPort':_0xa459e8[_0xe6d5('0x9e')][_0xe6d5('0xa4')]?_0xa459e8['headers'][_0xe6d5('0xa4')]:null,'referer':_0xa459e8[_0xe6d5('0x4d')]['referer'],'browserName':_0x1baac1[_0xe6d5('0xa5')][_0xe6d5('0x2c')]&&_0x1baac1[_0xe6d5('0xa5')]['version']?util[_0xe6d5('0xa6')](_0xe6d5('0xa7'),_0x1baac1[_0xe6d5('0xa5')]['name'],_0x1baac1[_0xe6d5('0xa5')]['version']):'unknown','browserVersion':_0x1baac1['browser'][_0xe6d5('0xa8')]||_0xe6d5('0xa9'),'osName':util[_0xe6d5('0xa6')](_0xe6d5('0xa7'),_0x1baac1['os'][_0xe6d5('0x2c')],_0x1baac1['os'][_0xe6d5('0xa8')]),'osVersion':_0x1baac1['os'][_0xe6d5('0xa8')],'deviceModel':_0x1baac1[_0xe6d5('0xaa')][_0xe6d5('0x37')]&&_0x1baac1[_0xe6d5('0xaa')][_0xe6d5('0xab')]?util[_0xe6d5('0xa6')](_0xe6d5('0xac'),_0x1baac1['device'][_0xe6d5('0x37')],_0x1baac1[_0xe6d5('0xaa')][_0xe6d5('0xab')],_0x1baac1[_0xe6d5('0xaa')][_0xe6d5('0x35')]):null,'deviceVendor':_0x1baac1[_0xe6d5('0xaa')][_0xe6d5('0xab')],'deviceType':_0x1baac1[_0xe6d5('0xaa')][_0xe6d5('0x35')],'formData':JSON[_0xe6d5('0x17')](_0xa459e8[_0xe6d5('0x4d')])};var _0x5ab6a2={'ChatWebsiteId':_0xa459e8['params']['id'],'closed':![]};if(_0xa459e8[_0xe6d5('0x4d')][_0xe6d5('0xad')]){_0x5ab6a2['threadId']=_0xa459e8[_0xe6d5('0x4d')][_0xe6d5('0xad')];return db[_0xe6d5('0xae')][_0xe6d5('0x4b')]({'where':_0x5ab6a2})[_0xe6d5('0x12')](function(_0xc8320f){if(_0xc8320f){return[_0xc8320f,![]];}_0x1343ba[_0xe6d5('0xad')]=_0xa459e8[_0xe6d5('0x4d')][_0xe6d5('0xad')];_0x1343ba['externalUrl']=_0xa459e8[_0xe6d5('0x4d')]['externalUrl'];return db[_0xe6d5('0xae')][_0xe6d5('0x4c')](_0x1343ba)['then'](function(_0x3af1b1){return[_0x3af1b1,!![]];});});}_0x5ab6a2[_0xe6d5('0xaf')]=_0x5225ce['id'];if(_0xa459e8[_0xe6d5('0x4d')]['interaction']&&_0xa459e8['body']['interaction']['id']){_0x5ab6a2['id']=_0xa459e8['body']['interaction']['id'];return db[_0xe6d5('0xae')][_0xe6d5('0x4b')]({'where':_0x5ab6a2})['then'](function(_0x3585b5){if(_0x3585b5){return[_0x3585b5,![]];}return db['ChatInteraction']['create'](_0x1343ba)[_0xe6d5('0x12')](function(_0x40edab){return[_0x40edab,!![]];});});}return db['ChatInteraction'][_0xe6d5('0x4c')](_0x1343ba)[_0xe6d5('0x12')](function(_0x3c6248){return[_0x3c6248,!![]];});}})[_0xe6d5('0xb0')](function(_0x3eaa1d,_0x207f02){if(_0x3eaa1d){_0x344051=_0x207f02;if(!_0x207f02){var _0x2c2808={'from':(_0x142e0b[_0xe6d5('0xb1')][_0xe6d5('0xa2')]||'')+'\x20'+(_0x142e0b[_0xe6d5('0xb1')]['lastName']||'')};if(_0xa459e8[_0xe6d5('0x4d')][_0xe6d5('0xad')]&&_0xa459e8['body'][_0xe6d5('0xb2')]&&_0xa459e8[_0xe6d5('0x4d')][_0xe6d5('0xad')]!=_0xa459e8['body']['messageId']){_0x2c2808[_0xe6d5('0xad')]=_0xa459e8[_0xe6d5('0x4d')][_0xe6d5('0xb2')];}return _0x3eaa1d[_0xe6d5('0x25')](_0x2c2808);}else{return _0x3eaa1d;}}})[_0xe6d5('0x12')](function(_0x389229){_0x142e0b[_0xe6d5('0xb3')]=_0x389229[_0xe6d5('0x27')]({'plain':!![]});_0x142e0b[_0xe6d5('0xb3')][_0xe6d5('0xb4')]=_0x344051;if(_0x142e0b['interaction'][_0xe6d5('0xb4')]){if(_0x142e0b['account'][_0xe6d5('0xb5')]){_0x142e0b[_0xe6d5('0x96')]['push']({'id':0x0,'priority':_0x142e0b['applications'][_0xe6d5('0x49')]+0x1,'app':_0xe6d5('0xb6'),'appdata':_0xe6d5('0xb7'),'interval':_0xe6d5('0xb8')});}}return db[_0xe6d5('0xb9')][_0xe6d5('0x4c')]({'body':_0xa459e8[_0xe6d5('0x4d')][_0xe6d5('0x4d')],'ChatWebsiteId':_0xa459e8['params']['id'],'ChatInteractionId':_0x389229['id'],'direction':'in','ContactId':_0x142e0b[_0xe6d5('0xb1')]['id'],'AttachmentId':_0xa459e8[_0xe6d5('0x4d')][_0xe6d5('0xba')]});})['then'](function(_0x2f28c8){_0x142e0b[_0xe6d5('0x19')]=_0x2f28c8;if(_0x142e0b[_0xe6d5('0xb3')]['UserId']){return db['User'][_0xe6d5('0x4b')]({'attributes':['id',_0xe6d5('0x2c')],'where':{'id':_0x142e0b[_0xe6d5('0xb3')][_0xe6d5('0xbb')]}})[_0xe6d5('0x12')](function(_0xda9ce){if(_0xda9ce){_0x142e0b[_0xe6d5('0x96')][_0xe6d5('0xbc')]({'id':0x0,'priority':0x0,'app':_0xe6d5('0xbd'),'appdata':_0xda9ce['name']+','+(_0x142e0b[_0xe6d5('0x95')][_0xe6d5('0xbe')]||0xa),'interval':'*,*,*,*'});_0x142e0b[_0xe6d5('0xbf')]=!![];}return respondWithRpcPromise('Start',_0xe6d5('0xc0'),_0x142e0b);});}return respondWithRpcPromise(_0xe6d5('0xc1'),_0xe6d5('0xc0'),_0x142e0b);})[_0xe6d5('0x12')](function(_0x3119a2){respondWithRpcPromise(_0xe6d5('0xc2'),_0xe6d5('0xc2'),{'event':_0xe6d5('0x7a'),'message':_0x3119a2},client9002);return _0x3119a2;})[_0xe6d5('0x12')](respondWithResult(_0x11ed51,null))[_0xe6d5('0x1b')](handleError(_0x11ed51,null));};exports[_0xe6d5('0xc3')]=function(_0x382273,_0x44b2ac){var _0x2afa44,_0x5a0731,_0x3afa7f;var _0x5bbb4c=[];var _0x559317={};var _0x3ec330=_0x382273[_0xe6d5('0xc4')]||[];var _0x53346d=[];var _0x59f592;return db[_0xe6d5('0x7f')][_0xe6d5('0x51')]()['then'](function(_0x21bfb6){if(!_0x21bfb6){throw new db[(_0xe6d5('0x88'))][(_0xe6d5('0x80'))](_0xe6d5('0x81'));}_0x5bbb4c=_[_0xe6d5('0x82')](_[_0xe6d5('0x39')](_0x21bfb6),[_0xe6d5('0x83'),'updatedAt','CompanyId',_0xe6d5('0x86')]);if(_0x382273[_0xe6d5('0x4d')]['id']){delete _0x382273[_0xe6d5('0x4d')]['id'];}if(_['isNil'](_0x382273[_0xe6d5('0x4d')]['from'])){throw _0x44b2ac[_0xe6d5('0x1c')](0x1f4)[_0xe6d5('0x2d')](new db[(_0xe6d5('0x88'))][(_0xe6d5('0x80'))]('from\x20is\x20mandatory'));}if(_[_0xe6d5('0x6d')](_0x382273[_0xe6d5('0x4d')]['body'])||_0x382273[_0xe6d5('0x4d')][_0xe6d5('0x4d')]===''){throw _0x44b2ac[_0xe6d5('0x1c')](0x1f4)[_0xe6d5('0x2d')](new db[(_0xe6d5('0x88'))]['ValidationError'](_0xe6d5('0x8a')));}if(_[_0xe6d5('0x6d')](_0x382273[_0xe6d5('0x4d')][_0xe6d5('0xc5')])){throw _0x44b2ac[_0xe6d5('0x1c')](0x1f4)['send'](new db[(_0xe6d5('0x88'))]['ValidationError']('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5bbb4c));}if(!_['includes'](_0x5bbb4c,_0x382273[_0xe6d5('0x4d')]['mapKeyOffline'])){throw _0x44b2ac[_0xe6d5('0x1c')](0x1f4)[_0xe6d5('0x2d')](new db['Sequelize'][(_0xe6d5('0x80'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5bbb4c));}_0x559317[_0x382273['body']['mapKeyOffline']]=_0x382273[_0xe6d5('0x4d')][_0xe6d5('0x87')];})[_0xe6d5('0x12')](function(){return db['ChatWebsite'][_0xe6d5('0x4b')]({'where':{'id':_0x382273[_0xe6d5('0x48')]['id']},'include':[{'model':db[_0xe6d5('0x8f')],'as':'List'},{'model':db[_0xe6d5('0xc6')],'as':_0xe6d5('0xc6')}]});})[_0xe6d5('0x12')](handleEntityNotFound(_0x44b2ac,null))[_0xe6d5('0x12')](function(_0x5a81dc){if(_0x5a81dc&&_0x5a81dc['List']){_0x5a0731=_0x5a81dc;var _0x1222d7=_[_0xe6d5('0x9b')](_0x382273[_0xe6d5('0x4d')],{'firstName':_0x382273[_0xe6d5('0x4d')][_0xe6d5('0x87')],'phone':_0x382273['body'][_0xe6d5('0x87')],'ListId':_0x5a81dc[_0xe6d5('0x86')]});_0x1222d7[_0x382273['body'][_0xe6d5('0xc5')]]=_0x382273[_0xe6d5('0x4d')][_0xe6d5('0x87')];return db[_0xe6d5('0x7f')][_0xe6d5('0xc7')]({'where':_0x559317,'defaults':_0x1222d7});}})['spread'](function(_0x57efa2){if(_0x57efa2){_0x3afa7f=_0x57efa2;var _0x242cec=fs[_0xe6d5('0xc8')](path[_0xe6d5('0x70')](config[_0xe6d5('0x69')],_0xe6d5('0xc9')),_0xe6d5('0xca'));var _0x3700d4=ejs[_0xe6d5('0xcb')](_0x242cec,{'body':_[_0xe6d5('0xcc')](_0x382273['body'][_0xe6d5('0x4d')]),'bodyTitle':_0x5a0731[_0xe6d5('0xcd')]});return db[_0xe6d5('0xce')][_0xe6d5('0x4c')]({'body':_0x3700d4,'ContactId':_0x57efa2['id'],'ChatWebsiteId':_0x5a0731['id']});}})[_0xe6d5('0x12')](function(_0x4e975e){_0x59f592=_0x4e975e;if(_0x3ec330['length']){var _0x435de7=_0x3ec330[_0xe6d5('0x31')](function(_0x194221){return{'name':_0x194221[_0xe6d5('0xcf')],'basename':_0x194221['filename'],'type':_0x194221[_0xe6d5('0xd0')],'ChatOfflineMessageId':_0x4e975e['id']};});_0x53346d=_0x435de7[_0xe6d5('0x31')](_0x52a2a9=>{var _0x2862ed={'filename':_0x52a2a9[_0xe6d5('0x2c')],'path':path[_0xe6d5('0x70')](config[_0xe6d5('0x69')],_0xe6d5('0xd1'),_0xe6d5('0xc4'),_0xe6d5('0xd2'),_0xe6d5('0xd3'),_0x52a2a9[_0xe6d5('0xd4')])};return _0x2862ed;});if(!_0x5a0731[_0xe6d5('0xd5')]){return db['sequelize']['transaction'](function(_0x119ac8){return db[_0xe6d5('0xd6')][_0xe6d5('0xd7')](_0x435de7,{'transaction':_0x119ac8});});}}})[_0xe6d5('0x12')](function(){if(_0x59f592){_0x2afa44=_0x59f592;return db[_0xe6d5('0xc6')][_0xe6d5('0x56')]({'where':{'active':!![]},'include':[{'model':db['MailServerOut'],'as':_0xe6d5('0xd8'),'raw':!![]}]});}})[_0xe6d5('0x12')](function(_0xc9bd67){if(_0xc9bd67&&_0xc9bd67[_0xe6d5('0xd8')]&&_0x5a0731[_0xe6d5('0xd9')]&&_0x5a0731['forwardOfflineAddress']){var _0x268687={'tls':{'rejectUnauthorized':![]}};if(_0xc9bd67['Smtp']['service']){_0x268687[_0xe6d5('0xda')]=_0xc9bd67[_0xe6d5('0xd8')][_0xe6d5('0xda')];}else{_0x268687[_0xe6d5('0xdb')]=_0xc9bd67[_0xe6d5('0xd8')][_0xe6d5('0xdb')];_0x268687['port']=_0xc9bd67[_0xe6d5('0xd8')]['port'];_0x268687[_0xe6d5('0xdc')]=_0xc9bd67[_0xe6d5('0xd8')][_0xe6d5('0xdc')];}if(_0xc9bd67[_0xe6d5('0xd8')][_0xe6d5('0xdd')]){_0x268687[_0xe6d5('0xde')]={'user':_0xc9bd67[_0xe6d5('0xd8')][_0xe6d5('0x4e')],'pass':_0xc9bd67[_0xe6d5('0xd8')][_0xe6d5('0xdf')]};}return respondWithRpcPromise(_0xe6d5('0xe0'),_0xe6d5('0xe1'),{'account':_0x268687,'message':{'from':util[_0xe6d5('0xa6')](_0xe6d5('0xe2'),_0xc9bd67['name'],_0xc9bd67[_0xe6d5('0xe3')]||_0xc9bd67[_0xe6d5('0xd8')][_0xe6d5('0x4e')]),'to':_0x5a0731[_0xe6d5('0xe4')],'subject':_0x5a0731[_0xe6d5('0xe5')],'html':_0x2afa44[_0xe6d5('0x4d')],'attachments':_0x53346d}},client9003)[_0xe6d5('0x12')](function(){return _0x2afa44;})[_0xe6d5('0x1b')](function(_0x1ef33e){console[_0xe6d5('0x18')](_0x1ef33e);});}})[_0xe6d5('0x12')](function(){if(_0x5a0731&&_0x5a0731[_0xe6d5('0xd5')]&&_0x5a0731['MailAccountId']){var _0x189cb7=[];if(_0x3ec330[_0xe6d5('0x49')]){_0x189cb7=_0x3ec330[_0xe6d5('0x31')](function(_0x4c3487){return{'name':_0x4c3487[_0xe6d5('0xcf')],'basename':_0x4c3487[_0xe6d5('0x62')],'type':_0x4c3487[_0xe6d5('0xd0')],'ChatOfflineMessageId':_0x59f592['id']};});}var _0x2f010f;if(!_[_0xe6d5('0x6d')](_0x5a0731[_0xe6d5('0xe6')])){var _0x1bcfa3=_['map'](_0x382273[_0xe6d5('0x4d')],function(_0x1bfa28){return _0x1bfa28;});var _0x52c7ca=_[_0xe6d5('0xe7')](_0x1bcfa3)[0x0];var _0x508b14=_[_0xe6d5('0xe8')](_0x52c7ca,function(_0x5cf3e4){return _0x5cf3e4;});_0x2f010f=_0x508b14[0x1][_0x5a0731[_0xe6d5('0xe6')]];}var _0x28249a={'from':_0x3afa7f[_0xe6d5('0xe3')],'firstName':_0x3afa7f['firstName'],'lastName':_0x3afa7f['lastName'],'mapKey':'email','message':{'from':_0x3afa7f[_0xe6d5('0xe3')],'to':_0x5a0731[_0xe6d5('0xc6')]['email'],'cc':'','subject':_[_0xe6d5('0x6d')](_0x2f010f)?_0x5a0731[_0xe6d5('0xe5')]:_0x2f010f,'messageId':'','sentAt':new Date(),'attach':_0x189cb7['length'],'attachments':_0x189cb7,'originChannel':'Chat','ChatWebsiteId':_0x5a0731['id'],'ChatOfflineMessageId':_0x2afa44['id'],'originTo':_0x5a0731[_0xe6d5('0xc6')][_0xe6d5('0xe3')]},'body':_0x2afa44[_0xe6d5('0x4d')]};var _0x3df306={'account':{'id':_0x5a0731['MailAccountId']},'body':_0x28249a,'log':_0xe6d5('0xe9')};return respondWithRpcPromise(_0xe6d5('0xe9'),_0xe6d5('0xea'),_0x3df306,client9001)[_0xe6d5('0x12')](function(){return _0x2afa44;})[_0xe6d5('0x1b')](function(_0x360de2){console[_0xe6d5('0x18')](_0x360de2);});}return;})[_0xe6d5('0x12')](function(){if(_0x2afa44){return _0x2afa44;}})[_0xe6d5('0x12')](respondWithResult(_0x44b2ac,null))[_0xe6d5('0x1b')](function(_0x3fa56a){console['error'](_0xe6d5('0x1b'),_0x3fa56a);for(var _0x163ea2 of _0x3ec330){var _0x46a7e2=path['join'](config['root'],'server',_0xe6d5('0xc4'),_0xe6d5('0xd2'),_0xe6d5('0xd3'),_0x163ea2['filename']);fs_extra[_0xe6d5('0xeb')](_0x46a7e2)[_0xe6d5('0x1b')](function(_0x412658){console[_0xe6d5('0x18')](_0xe6d5('0xec'),_0x46a7e2,_0x412658);});}});};exports[_0xe6d5('0xed')]=function(_0x287821,_0x1059d8){return db[_0xe6d5('0xae')][_0xe6d5('0x4b')]({'where':{'id':_0x287821['params']['id']}})[_0xe6d5('0x12')](handleEntityNotFound(_0x1059d8,null))['then'](function(_0xf576c8){if(_0xf576c8){return _0xf576c8['addInteraction'](_0x287821[_0xe6d5('0x4d')][_0xe6d5('0x5b')],_[_0xe6d5('0xee')](_0x287821['body'],[_0xe6d5('0x5b'),'id'])||{});}})[_0xe6d5('0x12')](respondWithResult(_0x1059d8,null))[_0xe6d5('0x1b')](handleError(_0x1059d8,null));};exports[_0xe6d5('0xef')]=function(_0x4e37f0,_0x4a71a2){var _0xa93669={'raw':![],'where':{}};var _0x167930={};var _0x48e6d1={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x4e37f0['params']['id']}})[_0xe6d5('0x12')](handleEntityNotFound(_0x4a71a2,null))[_0xe6d5('0x12')](function(_0x5cb442){if(_0x5cb442){_0x167930['model']=_['keys'](db[_0xe6d5('0xae')][_0xe6d5('0x33')]);_0x167930['query']=_['keys'](_0x4e37f0[_0xe6d5('0x38')]);_0x167930[_0xe6d5('0x3a')]=_[_0xe6d5('0x3b')](_0x167930[_0xe6d5('0x37')],_0x167930[_0xe6d5('0x38')]);_0xa93669[_0xe6d5('0x3c')]=_[_0xe6d5('0x3b')](_0x167930['model'],qs[_0xe6d5('0x3d')](_0x4e37f0[_0xe6d5('0x38')][_0xe6d5('0x3d')]));_0xa93669[_0xe6d5('0x3c')]=_0xa93669[_0xe6d5('0x3c')][_0xe6d5('0x49')]?_0xa93669['attributes']:_0x167930[_0xe6d5('0x37')];if(!_0x4e37f0[_0xe6d5('0x38')][_0xe6d5('0x3e')](_0xe6d5('0x57'))){_0xa93669[_0xe6d5('0x20')]=qs[_0xe6d5('0x20')](_0x4e37f0[_0xe6d5('0x38')][_0xe6d5('0x20')]);_0xa93669['offset']=qs['offset'](_0x4e37f0[_0xe6d5('0x38')]['offset']);}_0xa93669[_0xe6d5('0x58')]=qs[_0xe6d5('0x3f')](_0x4e37f0[_0xe6d5('0x38')]['sort']);_0xa93669['where']=qs['filters'](_[_0xe6d5('0x41')](_0x4e37f0[_0xe6d5('0x38')],_0x167930[_0xe6d5('0x3a')]));_0xa93669[_0xe6d5('0x40')][_0xe6d5('0x53')]=_0x5cb442['id'];if(_0x4e37f0[_0xe6d5('0x38')]['filter']){_0xa93669[_0xe6d5('0x40')]=_[_0xe6d5('0x43')](_0xa93669[_0xe6d5('0x40')],{'$or':_[_0xe6d5('0x31')](_0xa93669[_0xe6d5('0x3c')],function(_0x5a90a2){var _0x467de9={};_0x467de9[_0x5a90a2]={'$like':'%'+_0x4e37f0[_0xe6d5('0x38')][_0xe6d5('0x42')]+'%'};return _0x467de9;})});}_0xa93669=_[_0xe6d5('0x43')]({},_0xa93669,_0x4e37f0[_0xe6d5('0x44')]);return db[_0xe6d5('0xae')]['count']({'where':_0xa93669[_0xe6d5('0x40')]})[_0xe6d5('0x12')](function(_0xabcac7){_0x48e6d1['count']=_0xabcac7;if(_0x4e37f0[_0xe6d5('0x38')][_0xe6d5('0x4a')]){_0xa93669['include']=[{'model':db[_0xe6d5('0x7f')],'as':_0xe6d5('0xf0'),'required':![]},{'model':db[_0xe6d5('0xf1')],'as':_0xe6d5('0xf2'),'attributes':[_0xe6d5('0x2c'),'fullname',_0xe6d5('0xf3')],'required':![]},{'model':db[_0xe6d5('0xf4')],'as':_0xe6d5('0xf5'),'attributes':['id',_0xe6d5('0x2c'),'color'],'where':_0x4e37f0['query']['tag']?{'id':_0x4e37f0[_0xe6d5('0x38')][_0xe6d5('0xf6')]}:undefined,'required':_0x4e37f0[_0xe6d5('0x38')][_0xe6d5('0xf6')]?!![]:![]}];}return db[_0xe6d5('0xae')][_0xe6d5('0x59')](_0xa93669);})[_0xe6d5('0x12')](function(_0x36337d){_0x48e6d1['rows']=_0x36337d;return _0x48e6d1;});}})[_0xe6d5('0x12')](respondWithFilteredResult(_0x4a71a2,_0xa93669))[_0xe6d5('0x1b')](handleError(_0x4a71a2,null));};function iftimePromise(_0x2a501d,_0x48142a){return respondWithRpcPromise(_0xe6d5('0xf7'),_0xe6d5('0xf8'),{'command':_0x48142a[_0xe6d5('0xf9')]?util['format'](_0xe6d5('0xfa'),_0x2a501d[_0xe6d5('0xfb')],_0x48142a[_0xe6d5('0xf9')]):util[_0xe6d5('0xa6')](_0xe6d5('0xfc'),_0x2a501d[_0xe6d5('0xfb')])},client9002)['then'](function(_0x5dd782){var _0x42d4bc=_0x5dd782&&_0x5dd782[_0xe6d5('0xfd')](_0xe6d5('0xfe'))>=0x0?!![]:![];logger['info'](_0xe6d5('0xff'),_0x48142a['id'],_0x2a501d['id'],_0x2a501d[_0xe6d5('0xfb')],_0x42d4bc?_0xe6d5('0x100'):_0xe6d5('0x101'),_0x48142a['timezone']?_0x48142a[_0xe6d5('0xf9')]:_0xe6d5('0x102'));return _0x42d4bc;})[_0xe6d5('0x1b')](function(_0x4bff2c){logger[_0xe6d5('0x18')](_0xe6d5('0xff'),_0x48142a['id'],_0x2a501d['id'],_0x2a501d[_0xe6d5('0xfb')],util[_0xe6d5('0x103')](_0x4bff2c,{'showHidden':![],'depth':null}),_0x48142a[_0xe6d5('0xf9')]?_0x48142a[_0xe6d5('0xf9')]:_0xe6d5('0x102'));return![];});}exports['getSnippet']=function(_0xc134a6,_0xcaac11){var _0x4e6549=0x0;var _0x353942=0x0;var _0x7d2d79=![];var _0x41b535;var _0x53b53a;return db['ChatWebsite'][_0xe6d5('0x4b')]({'where':{'id':_0xc134a6[_0xe6d5('0x48')]['id']},'include':[{'model':db[_0xe6d5('0x104')],'as':_0xe6d5('0x104'),'include':[{'model':db[_0xe6d5('0x104')],'as':_0xe6d5('0x105'),'attributes':['id',_0xe6d5('0xfb')],'raw':!![]}]}]})[_0xe6d5('0x12')](handleEntityNotFound(_0xcaac11,null))[_0xe6d5('0x12')](function(_0xce13d2){if(_0xce13d2){_0x41b535=_0xce13d2;return _0xce13d2[_0xe6d5('0x106')]({'raw':!![]});}})[_0xe6d5('0x12')](function(_0x1c55e4){if(_0x41b535){if(_0x1c55e4){_0x53b53a=_0x1c55e4;}}return require('../../config/license/util')[_0xe6d5('0x6c')]();})['then'](function(_0x2774d7){if(_0x2774d7){_0x353942=_0x2774d7['virtual'];_0x7d2d79=_0x2774d7[_0xe6d5('0x107')];}})[_0xe6d5('0x12')](function(){return db[_0xe6d5('0xae')][_0xe6d5('0x21')]({'where':{'closed':![]}});})['then'](function(_0x1b9376){_0x4e6549=_0x1b9376;if(_0x353942&&_0x1b9376>_0x353942){return db[_0xe6d5('0x108')][_0xe6d5('0x56')]({'where':{'id':0x1}})[_0xe6d5('0x12')](function(_0x48556a){if(_0x48556a){_0x48556a[_0xe6d5('0x109')](_0xe6d5('0x10a'));}});}})[_0xe6d5('0x12')](function(){if(_0x41b535[_0xe6d5('0x104')]&&_0x41b535['Interval'][_0xe6d5('0x105')]){var _0x925f22=[];for(var _0xca2705=0x0;_0xca2705<_0x41b535['Interval']['Intervals']['length'];_0xca2705++){var _0x20e2a1=_0x41b535[_0xe6d5('0x104')][_0xe6d5('0x105')][_0xca2705]['get']({'plain':!![]});_0x925f22[_0xe6d5('0x10b')](iftimePromise(_0x20e2a1,_0x41b535));}return BPromise[_0xe6d5('0x10c')](_0x925f22)['then'](function(_0x83faf){return _['some'](_0x83faf);});}else{return!![];}})[_0xe6d5('0x12')](function(_0x1cf712){var _0x4b426f=fs[_0xe6d5('0xc8')](path['join'](config[_0xe6d5('0x69')],'server/files/chat/iframe.ejs'),_0xe6d5('0xca'));var _0x48cb34={'remote':_0x41b535[_0xe6d5('0x10d')],'query':querystring[_0xe6d5('0x17')](_[_0xe6d5('0x43')](_0x41b535[_0xe6d5('0x27')]({'plain':!![]}),{'customerIp':_0xc134a6[_0xe6d5('0x9e')][_0xe6d5('0x9f')]||_0xc134a6[_0xe6d5('0x9e')][_0xe6d5('0x10e')]||_0xc134a6['connection'][_0xe6d5('0x10f')]||_0xc134a6['ip'],'referer':_0xc134a6['headers'][_0xe6d5('0x110')],'openedInteractions':_0x4e6549,'maxInteractions':_0x353942,'virtual':_0x7d2d79[_0xe6d5('0x111')],'online':_0x1cf712,'custom':_0x7d2d79}))[_0xe6d5('0x112')](/'/g,'\x5c\x27')};_0xcaac11[_0xe6d5('0x2d')](ejs[_0xe6d5('0xcb')](Mustache[_0xe6d5('0xcb')](_0x4b426f,_0x48cb34),{'proactiveActions':_0x53b53a,'alignment':_0x41b535['alignment'],'verticalAlignment':_0x41b535[_0xe6d5('0x113')],'div_color':_0x41b535[_0xe6d5('0x114')],'text_color':_0x41b535[_0xe6d5('0x115')],'button_color':_0x41b535[_0xe6d5('0x116')],'background_color':_0x41b535[_0xe6d5('0x117')]}));})[_0xe6d5('0x1b')](handleError(_0xcaac11,null));};exports['addApplications']=function(_0x314d26,_0x112e36){var _0x3e5a2c=_0x314d26['params']['id'];var _0x1181dd=_0x314d26[_0xe6d5('0x4d')];var _0x37a533=0xc8;var _0x2df312=null;return db[_0xe6d5('0x118')][_0xe6d5('0x119')]({'isolationLevel':db[_0xe6d5('0x118')][_0xe6d5('0x11a')][_0xe6d5('0x11b')][_0xe6d5('0x11c')]},function(_0x4d5071){return db[_0xe6d5('0x32')][_0xe6d5('0x56')]({'where':{'id':_0x3e5a2c},'transaction':_0x4d5071})[_0xe6d5('0x12')](function(_0x641d0e){if(_0x641d0e){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x3e5a2c},'transaction':_0x4d5071})[_0xe6d5('0x12')](function(){var _0x523010=_[_0xe6d5('0x31')](_0x1181dd,function(_0x4c061e){_0x4c061e['ChatWebsiteId']=_0x3e5a2c;return _0x4c061e;});return db[_0xe6d5('0x93')][_0xe6d5('0xd7')](_0x523010,{'transaction':_0x4d5071});});}else{_0x37a533=0x194;_0x2df312=[];}});})[_0xe6d5('0x12')](function(){if(_0x37a533!==0x194){return db[_0xe6d5('0x93')][_0xe6d5('0x11d')]({'where':{'ChatWebsiteId':_0x3e5a2c},'order':_0xe6d5('0x99')})[_0xe6d5('0x12')](function(_0x10c334){_0x2df312=_0x10c334;});}})[_0xe6d5('0x1b')](function(_0x40b12b){_0x37a533=0x1f4;logger[_0xe6d5('0x18')](_0x40b12b[_0xe6d5('0x2b')]);if(_0x40b12b[_0xe6d5('0x2c')]){delete _0x40b12b[_0xe6d5('0x2c')];}_0x2df312=_0x40b12b;})['finally'](function(){if(_0x2df312===null){_0x112e36[_0xe6d5('0x2a')](_0x37a533);}else{if(_0x37a533===0x1f4){_0x112e36['status'](_0x37a533)[_0xe6d5('0x2d')](_0x2df312);}else{_0x112e36['status'](_0x37a533)[_0xe6d5('0x1e')](_0x2df312);}}});};exports['getApplications']=function(_0x532576,_0x2aeecc){var _0x9d6f43={};var _0x3c00b4={};var _0x37a0c6;var _0x110112;return db['ChatWebsite']['findOne']({'where':{'id':_0x532576['params']['id']}})[_0xe6d5('0x12')](handleEntityNotFound(_0x2aeecc,null))[_0xe6d5('0x12')](function(_0x5bdcfb){if(_0x5bdcfb){_0x37a0c6=_0x5bdcfb;_0x3c00b4['model']=_[_0xe6d5('0x39')](db['ChatApplication'][_0xe6d5('0x33')]);_0x3c00b4[_0xe6d5('0x38')]=_[_0xe6d5('0x39')](_0x532576['query']);_0x3c00b4['filters']=_[_0xe6d5('0x3b')](_0x3c00b4[_0xe6d5('0x37')],_0x3c00b4[_0xe6d5('0x38')]);_0x9d6f43['attributes']=_[_0xe6d5('0x3b')](_0x3c00b4[_0xe6d5('0x37')],qs['fields'](_0x532576[_0xe6d5('0x38')]['fields']));_0x9d6f43[_0xe6d5('0x3c')]=_0x9d6f43[_0xe6d5('0x3c')][_0xe6d5('0x49')]?_0x9d6f43['attributes']:_0x3c00b4[_0xe6d5('0x37')];_0x9d6f43[_0xe6d5('0x58')]=qs[_0xe6d5('0x3f')](_0x532576[_0xe6d5('0x38')]['sort']);_0x9d6f43['where']=qs['filters'](_[_0xe6d5('0x41')](_0x532576[_0xe6d5('0x38')],_0x3c00b4[_0xe6d5('0x3a')]));if(_0x532576[_0xe6d5('0x38')][_0xe6d5('0x42')]){_0x9d6f43['where']=_[_0xe6d5('0x43')](_0x9d6f43[_0xe6d5('0x40')],{'$or':_[_0xe6d5('0x31')](_0x9d6f43[_0xe6d5('0x3c')],function(_0x35e75c){var _0x40008f={};_0x40008f[_0x35e75c]={'$like':'%'+_0x532576['query'][_0xe6d5('0x42')]+'%'};return _0x40008f;})});}_0x9d6f43=_[_0xe6d5('0x43')]({},_0x9d6f43,_0x532576['options']);return _0x37a0c6[_0xe6d5('0x11e')](_0x9d6f43);}})['then'](function(_0x5de5c3){if(_0x5de5c3){_0x110112=_0x5de5c3[_0xe6d5('0x49')];if(!_0x532576['query'][_0xe6d5('0x3e')]('nolimit')){_0x9d6f43[_0xe6d5('0x20')]=qs['limit'](_0x532576[_0xe6d5('0x38')][_0xe6d5('0x20')]);_0x9d6f43[_0xe6d5('0x22')]=qs['offset'](_0x532576['query'][_0xe6d5('0x22')]);}return _0x37a0c6[_0xe6d5('0x11e')](_0x9d6f43);}})['then'](function(_0x220ba4){if(_0x220ba4){return _0x220ba4?{'count':_0x110112,'rows':_0x220ba4}:null;}})[_0xe6d5('0x12')](respondWithResult(_0x2aeecc,null))[_0xe6d5('0x1b')](handleError(_0x2aeecc,null));};exports[_0xe6d5('0x11f')]=function(_0x1dc1b9,_0x33f79b){return db['chatProactiveAction'][_0xe6d5('0x4b')]({'where':{'id':_0x1dc1b9['params']['id']}})[_0xe6d5('0x12')](handleEntityNotFound(_0x33f79b,null))[_0xe6d5('0x12')](function(_0x5aae74){if(_0x5aae74){return _0x5aae74[_0xe6d5('0x11f')](_0x1dc1b9[_0xe6d5('0x4d')][_0xe6d5('0x5b')],_[_0xe6d5('0xee')](_0x1dc1b9[_0xe6d5('0x4d')],['ids','id'])||{});}})['then'](respondWithResult(_0x33f79b,null))[_0xe6d5('0x1b')](handleError(_0x33f79b,null));};exports[_0xe6d5('0x106')]=function(_0x51e8e0,_0x347941){var _0x44742c={};var _0x565d91={};var _0x1bbb12;var _0x1fb768;return db[_0xe6d5('0x32')][_0xe6d5('0x56')]({'where':{'id':_0x51e8e0[_0xe6d5('0x48')]['id']}})['then'](handleEntityNotFound(_0x347941,null))[_0xe6d5('0x12')](function(_0x16a757){if(_0x16a757){_0x1bbb12=_0x16a757;_0x565d91[_0xe6d5('0x37')]=_[_0xe6d5('0x39')](db[_0xe6d5('0x120')][_0xe6d5('0x33')]);_0x565d91[_0xe6d5('0x38')]=_[_0xe6d5('0x39')](_0x51e8e0[_0xe6d5('0x38')]);_0x565d91[_0xe6d5('0x3a')]=_[_0xe6d5('0x3b')](_0x565d91['model'],_0x565d91[_0xe6d5('0x38')]);_0x44742c[_0xe6d5('0x3c')]=_['intersection'](_0x565d91[_0xe6d5('0x37')],qs[_0xe6d5('0x3d')](_0x51e8e0[_0xe6d5('0x38')][_0xe6d5('0x3d')]));_0x44742c[_0xe6d5('0x3c')]=_0x44742c[_0xe6d5('0x3c')][_0xe6d5('0x49')]?_0x44742c[_0xe6d5('0x3c')]:_0x565d91['model'];_0x44742c['order']=qs[_0xe6d5('0x3f')](_0x51e8e0[_0xe6d5('0x38')][_0xe6d5('0x3f')]);_0x44742c[_0xe6d5('0x40')]=qs[_0xe6d5('0x3a')](_[_0xe6d5('0x41')](_0x51e8e0[_0xe6d5('0x38')],_0x565d91[_0xe6d5('0x3a')]));if(_0x51e8e0[_0xe6d5('0x38')][_0xe6d5('0x42')]){_0x44742c[_0xe6d5('0x40')]=_[_0xe6d5('0x43')](_0x44742c[_0xe6d5('0x40')],{'$or':_[_0xe6d5('0x31')](_0x44742c['attributes'],function(_0x5eb7d2){var _0x1cd8d9={};_0x1cd8d9[_0x5eb7d2]={'$like':'%'+_0x51e8e0[_0xe6d5('0x38')]['filter']+'%'};return _0x1cd8d9;})});}_0x44742c=_[_0xe6d5('0x43')]({},_0x44742c,_0x51e8e0[_0xe6d5('0x44')]);return _0x1bbb12[_0xe6d5('0x106')](_0x44742c);}})[_0xe6d5('0x12')](function(_0x2caac6){if(_0x2caac6){_0x1fb768=_0x2caac6['length'];if(!_0x51e8e0[_0xe6d5('0x38')]['hasOwnProperty'](_0xe6d5('0x57'))){_0x44742c[_0xe6d5('0x20')]=qs[_0xe6d5('0x20')](_0x51e8e0['query'][_0xe6d5('0x20')]);_0x44742c['offset']=qs[_0xe6d5('0x22')](_0x51e8e0[_0xe6d5('0x38')][_0xe6d5('0x22')]);}return _0x1bbb12['getProactiveActions'](_0x44742c);}})[_0xe6d5('0x12')](function(_0x457986){if(_0x457986){return _0x457986?{'count':_0x1fb768,'rows':_0x457986}:null;}})['then'](respondWithResult(_0x347941,null))[_0xe6d5('0x1b')](handleError(_0x347941,null));};exports[_0xe6d5('0x121')]=function(_0x3dac80,_0x3e047b){var _0x4af1b7=_0x3dac80[_0xe6d5('0x38')][_0xe6d5('0x122')]==='false'?_0xe6d5('0x123'):_0xe6d5('0x124');return db[_0xe6d5('0x32')][_0xe6d5('0x4b')]({'attributes':['id',_0x4af1b7],'where':{'id':_0x3dac80['params']['id']}})['then'](handleEntityNotFound(_0x3e047b,null))[_0xe6d5('0x12')](function(_0x2d4387){if(_0x2d4387){var _0x4eef56=_0x2d4387[_0x4af1b7];var _0x2f01bd=_0x4eef56&&_0x4eef56[_0xe6d5('0x125')]?_0x4eef56[_0xe6d5('0x125')]:[];_0x3e047b[_0xe6d5('0x2d')]({'fromKey':_[_0xe6d5('0x6d')](_0x4eef56[_0xe6d5('0x126')])?undefined:_0x4eef56[_0xe6d5('0x126')],'count':_0x2f01bd[_0xe6d5('0x49')],'rows':_0x2f01bd});}})['catch'](handleError(_0x3e047b,null));};exports[_0xe6d5('0x127')]=function(_0x542886,_0x52a4f2){var _0x5032d5={'raw':![],'where':{}};var _0x4cf54b={};var _0x37f332={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xe6d5('0x56')]({'where':{'id':_0x542886['params']['id']}})['then'](handleEntityNotFound(_0x52a4f2,null))[_0xe6d5('0x12')](function(_0x3de61e){if(_0x3de61e){_0x4cf54b[_0xe6d5('0x37')]=_[_0xe6d5('0x39')](db['ChatOfflineMessage'][_0xe6d5('0x33')]);_0x4cf54b['query']=_['keys'](_0x542886[_0xe6d5('0x38')]);_0x4cf54b['filters']=_[_0xe6d5('0x3b')](_0x4cf54b[_0xe6d5('0x37')],_0x4cf54b[_0xe6d5('0x38')]);_0x5032d5[_0xe6d5('0x3c')]=_[_0xe6d5('0x3b')](_0x4cf54b[_0xe6d5('0x37')],qs[_0xe6d5('0x3d')](_0x542886['query']['fields']));_0x5032d5[_0xe6d5('0x3c')]=_0x5032d5[_0xe6d5('0x3c')][_0xe6d5('0x49')]?_0x5032d5['attributes']:_0x4cf54b['model'];if(!_0x542886[_0xe6d5('0x38')][_0xe6d5('0x3e')](_0xe6d5('0x57'))){_0x5032d5[_0xe6d5('0x20')]=qs[_0xe6d5('0x20')](_0x542886[_0xe6d5('0x38')][_0xe6d5('0x20')]);_0x5032d5['offset']=qs[_0xe6d5('0x22')](_0x542886[_0xe6d5('0x38')]['offset']);}_0x5032d5['order']=qs[_0xe6d5('0x3f')](_0x542886[_0xe6d5('0x38')][_0xe6d5('0x3f')]);_0x5032d5[_0xe6d5('0x40')]=qs['filters'](_['pick'](_0x542886[_0xe6d5('0x38')],_0x4cf54b[_0xe6d5('0x3a')]));_0x5032d5[_0xe6d5('0x40')][_0xe6d5('0x53')]=_0x3de61e['id'];if(_0x542886['query']['filter']){_0x5032d5[_0xe6d5('0x40')]=_[_0xe6d5('0x43')](_0x5032d5[_0xe6d5('0x40')],{'$or':_['map'](_0x5032d5[_0xe6d5('0x3c')],function(_0x4f1884){var _0x5d85b3={};_0x5d85b3[_0x4f1884]={'$like':'%'+_0x542886[_0xe6d5('0x38')][_0xe6d5('0x42')]+'%'};return _0x5d85b3;})});}_0x5032d5=_['merge']({},_0x5032d5,_0x542886[_0xe6d5('0x44')]);return db['ChatOfflineMessage'][_0xe6d5('0x21')]({'where':_0x5032d5[_0xe6d5('0x40')]})['then'](function(_0x59a39e){_0x37f332[_0xe6d5('0x21')]=_0x59a39e;if(_0x542886[_0xe6d5('0x38')][_0xe6d5('0x4a')]){_0x5032d5[_0xe6d5('0x45')]=[{'all':!![]}];}else{_0x5032d5[_0xe6d5('0x45')]=[{'model':db[_0xe6d5('0x7f')],'as':_0xe6d5('0xf0'),'required':![]},{'model':db['Attachment'],'as':_0xe6d5('0x128'),'required':![]}];}return db[_0xe6d5('0xce')]['findAll'](_0x5032d5);})[_0xe6d5('0x12')](function(_0x557c2b){_0x37f332[_0xe6d5('0x46')]=_0x557c2b;return _0x37f332;});}})[_0xe6d5('0x12')](respondWithFilteredResult(_0x52a4f2,_0x5032d5))['catch'](handleError(_0x52a4f2,null));};exports[_0xe6d5('0x129')]=function(_0x3cc878,_0x443401){return db[_0xe6d5('0x32')][_0xe6d5('0x4b')]({'where':{'id':_0x3cc878['params']['id']}})[_0xe6d5('0x12')](handleEntityNotFound(_0x443401,null))['then'](function(_0x30e12a){if(_0x30e12a){return _0x30e12a[_0xe6d5('0x129')](_0x3cc878[_0xe6d5('0x4d')][_0xe6d5('0x5b')],_[_0xe6d5('0xee')](_0x3cc878[_0xe6d5('0x4d')],['ids','id'])||{})[_0xe6d5('0xb0')](function(_0x5176f5){for(var _0x4a471e=0x0;_0x4a471e<_0x3cc878['body'][_0xe6d5('0x5b')]['length'];_0x4a471e+=0x1){socket['emit'](_0xe6d5('0x12a'),{'UserId':Number(_0x3cc878[_0xe6d5('0x4d')]['ids'][_0x4a471e]),'ChatWebsiteId':Number(_0x3cc878['params']['id'])});}return _0x5176f5;});}})[_0xe6d5('0x12')](respondWithResult(_0x443401,null))[_0xe6d5('0x1b')](handleError(_0x443401,null));};exports[_0xe6d5('0x12b')]=function(_0x2380be,_0x3017ad){return db['ChatWebsite'][_0xe6d5('0x4b')]({'where':{'id':_0x2380be[_0xe6d5('0x48')]['id']}})[_0xe6d5('0x12')](handleEntityNotFound(_0x3017ad,null))[_0xe6d5('0x12')](function(_0x1d56c9){if(_0x1d56c9){return _0x1d56c9['removeAgents'](_0x2380be[_0xe6d5('0x38')]['ids'])['then'](function(){if(_['isArray'](_0x2380be[_0xe6d5('0x38')][_0xe6d5('0x5b')])){for(var _0x2344a4=0x0;_0x2344a4<_0x2380be[_0xe6d5('0x38')][_0xe6d5('0x5b')][_0xe6d5('0x49')];_0x2344a4+=0x1){socket[_0xe6d5('0x12c')](_0xe6d5('0x12d'),{'UserId':Number(_0x2380be[_0xe6d5('0x38')]['ids'][_0x2344a4]),'ChatWebsiteId':Number(_0x2380be[_0xe6d5('0x48')]['id'])});}}else{socket[_0xe6d5('0x12c')](_0xe6d5('0x12d'),{'UserId':Number(_0x2380be['query'][_0xe6d5('0x5b')]),'ChatWebsiteId':Number(_0x2380be['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3017ad,null))[_0xe6d5('0x1b')](handleError(_0x3017ad,null));};exports['getAgents']=function(_0x142614,_0x364f6c){var _0x49cf06={};var _0x585ea5={};var _0x5558ff;var _0x2fe752;return db['ChatWebsite'][_0xe6d5('0x56')]({'where':{'id':_0x142614['params']['id']}})[_0xe6d5('0x12')](handleEntityNotFound(_0x364f6c,null))['then'](function(_0x577e55){if(_0x577e55){_0x5558ff=_0x577e55;_0x585ea5[_0xe6d5('0x37')]=_[_0xe6d5('0x39')](db['User'][_0xe6d5('0x33')]);_0x585ea5[_0xe6d5('0x38')]=_['keys'](_0x142614[_0xe6d5('0x38')]);_0x585ea5[_0xe6d5('0x3a')]=_[_0xe6d5('0x3b')](_0x585ea5['model'],_0x585ea5[_0xe6d5('0x38')]);_0x49cf06[_0xe6d5('0x3c')]=_[_0xe6d5('0x3b')](_0x585ea5[_0xe6d5('0x37')],qs[_0xe6d5('0x3d')](_0x142614[_0xe6d5('0x38')][_0xe6d5('0x3d')]));_0x49cf06[_0xe6d5('0x3c')]=_0x49cf06[_0xe6d5('0x3c')][_0xe6d5('0x49')]?_0x49cf06['attributes']:_0x585ea5[_0xe6d5('0x37')];_0x49cf06['order']=qs[_0xe6d5('0x3f')](_0x142614[_0xe6d5('0x38')][_0xe6d5('0x3f')]);_0x49cf06[_0xe6d5('0x40')]=qs[_0xe6d5('0x3a')](_[_0xe6d5('0x41')](_0x142614['query'],_0x585ea5['filters']));if(_0x142614[_0xe6d5('0x38')][_0xe6d5('0x42')]){_0x49cf06[_0xe6d5('0x40')]=_[_0xe6d5('0x43')](_0x49cf06[_0xe6d5('0x40')],{'$or':_['map'](_0x49cf06[_0xe6d5('0x3c')],function(_0x38fb0a){var _0x355d03={};_0x355d03[_0x38fb0a]={'$like':'%'+_0x142614[_0xe6d5('0x38')][_0xe6d5('0x42')]+'%'};return _0x355d03;})});}_0x49cf06=_['merge']({},_0x49cf06,_0x142614[_0xe6d5('0x44')]);return _0x5558ff[_0xe6d5('0x12e')](_0x49cf06);}})[_0xe6d5('0x12')](function(_0x4d9e8e){if(_0x4d9e8e){_0x2fe752=_0x4d9e8e['length'];if(!_0x142614[_0xe6d5('0x38')][_0xe6d5('0x3e')](_0xe6d5('0x57'))){_0x49cf06[_0xe6d5('0x20')]=qs[_0xe6d5('0x20')](_0x142614[_0xe6d5('0x38')][_0xe6d5('0x20')]);_0x49cf06['offset']=qs[_0xe6d5('0x22')](_0x142614[_0xe6d5('0x38')][_0xe6d5('0x22')]);}return _0x5558ff[_0xe6d5('0x12e')](_0x49cf06);}})[_0xe6d5('0x12')](function(_0x22de41){if(_0x22de41){return _0x22de41?{'count':_0x2fe752,'rows':_0x22de41}:null;}})[_0xe6d5('0x12')](respondWithResult(_0x364f6c,null))[_0xe6d5('0x1b')](handleError(_0x364f6c,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 4e1e15b..0ccbc80 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 _0x8ff9=['update','remove','emit','hook','exports','events','../../mysqldb','ChatWebsite','save'];(function(_0x1ef510,_0x431218){var _0x18ed0e=function(_0x55c576){while(--_0x55c576){_0x1ef510['push'](_0x1ef510['shift']());}};_0x18ed0e(++_0x431218);}(_0x8ff9,0x188));var _0x98ff=function(_0x54eedb,_0x422ef6){_0x54eedb=_0x54eedb-0x0;var _0xd5611=_0x8ff9[_0x54eedb];return _0xd5611;};'use strict';var EventEmitter=require(_0x98ff('0x0'));var ChatWebsite=require(_0x98ff('0x1'))['db'][_0x98ff('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x98ff('0x3'),'afterUpdate':_0x98ff('0x4'),'afterDestroy':_0x98ff('0x5')};function emitEvent(_0x16e131){return function(_0x1619f1,_0x1448fc,_0x34845d){ChatWebsiteEvents['emit'](_0x16e131+':'+_0x1619f1['id'],_0x1619f1);ChatWebsiteEvents[_0x98ff('0x6')](_0x16e131,_0x1619f1);_0x34845d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x98ff('0x7')](e,emitEvent(event));}}module[_0x98ff('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0xdb13=['setMaxListeners','save','update','remove','emit','hook','exports','../../mysqldb','ChatWebsite'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xdb13,0x10c));var _0x3db1=function(_0x3b680b,_0x55bf75){_0x3b680b=_0x3b680b-0x0;var _0x3eec9e=_0xdb13[_0x3b680b];return _0x3eec9e;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x3db1('0x0'))['db'][_0x3db1('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x3db1('0x2')](0x0);var events={'afterCreate':_0x3db1('0x3'),'afterUpdate':_0x3db1('0x4'),'afterDestroy':_0x3db1('0x5')};function emitEvent(_0x581a73){return function(_0x3352e3,_0x41fb5d,_0x1c1495){ChatWebsiteEvents[_0x3db1('0x6')](_0x581a73+':'+_0x3352e3['id'],_0x3352e3);ChatWebsiteEvents[_0x3db1('0x6')](_0x581a73,_0x3352e3);_0x1c1495(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x3db1('0x7')](e,emitEvent(event));}}module[_0x3db1('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 00d4f3d..c5adc62 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 _0x9a93=['ChatWebsite','chat_websites','lodash','util','../../config/logger','api','moment','path','../../config/environment','./chatWebsite.attributes','define'];(function(_0x146633,_0x42c6e8){var _0x1a0de6=function(_0x40a961){while(--_0x40a961){_0x146633['push'](_0x146633['shift']());}};_0x1a0de6(++_0x42c6e8);}(_0x9a93,0x1f1));var _0x39a9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9a93[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x39a9('0x0'));var util=require(_0x39a9('0x1'));var logger=require(_0x39a9('0x2'))(_0x39a9('0x3'));var moment=require(_0x39a9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x39a9('0x5'));var rimraf=require('rimraf');var config=require(_0x39a9('0x6'));var attributes=require(_0x39a9('0x7'));module['exports']=function(_0x1626eb,_0xa164e7){return _0x1626eb[_0x39a9('0x8')](_0x39a9('0x9'),attributes,{'tableName':_0x39a9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafe6=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','ChatWebsite','chat_websites'];(function(_0x166831,_0x4ae6f3){var _0x33d622=function(_0xa59f4){while(--_0xa59f4){_0x166831['push'](_0x166831['shift']());}};_0x33d622(++_0x4ae6f3);}(_0xafe6,0x78));var _0x6afe=function(_0x228e9a,_0x24f414){_0x228e9a=_0x228e9a-0x0;var _0x21160a=_0xafe6[_0x228e9a];return _0x21160a;};'use strict';var _=require('lodash');var util=require(_0x6afe('0x0'));var logger=require(_0x6afe('0x1'))(_0x6afe('0x2'));var moment=require(_0x6afe('0x3'));var BPromise=require(_0x6afe('0x4'));var rp=require(_0x6afe('0x5'));var fs=require('fs');var path=require(_0x6afe('0x6'));var rimraf=require('rimraf');var config=require(_0x6afe('0x7'));var attributes=require('./chatWebsite.attributes');module[_0x6afe('0x8')]=function(_0x12886a,_0x9f6da6){return _0x12886a[_0x6afe('0x9')](_0x6afe('0xa'),attributes,{'tableName':_0x6afe('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 7a0399c..1f2fd6a 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 _0xe261=['request','then','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatWebsite.socket','register'];(function(_0x1c5142,_0x30ea72){var _0x1268cb=function(_0xaa2299){while(--_0xaa2299){_0x1c5142['push'](_0x1c5142['shift']());}};_0x1268cb(++_0x30ea72);}(_0xe261,0xd7));var _0x1e26=function(_0x578383,_0x5e2e79){_0x578383=_0x578383-0x0;var _0xfc9cae=_0xe261[_0x578383];return _0xfc9cae;};'use strict';var _=require(_0x1e26('0x0'));var util=require(_0x1e26('0x1'));var moment=require(_0x1e26('0x2'));var BPromise=require(_0x1e26('0x3'));var rs=require(_0x1e26('0x4'));var fs=require('fs');var Redis=require(_0x1e26('0x5'));var db=require(_0x1e26('0x6'))['db'];var utils=require(_0x1e26('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x1e26('0x8'));var jayson=require(_0x1e26('0x9'));var client=jayson[_0x1e26('0xa')][_0x1e26('0xb')]({'port':0x232a});config[_0x1e26('0xc')]=_[_0x1e26('0xd')](config[_0x1e26('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x1e26('0xe'))(new Redis(config[_0x1e26('0xc')]));require(_0x1e26('0xf'))[_0x1e26('0x10')](socket);function respondWithRpcPromise(_0x4e75da,_0x420a3e,_0x1eed39){return new BPromise(function(_0x2c6bcb,_0x39ec09){return client[_0x1e26('0x11')](_0x4e75da,_0x1eed39)[_0x1e26('0x12')](function(_0x25b4a3){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x420a3e,_0x1e26('0x13'));logger['debug'](_0x1e26('0x14'),_0x420a3e,_0x1e26('0x13'),JSON[_0x1e26('0x15')](_0x25b4a3));if(_0x25b4a3[_0x1e26('0x16')]){if(_0x25b4a3[_0x1e26('0x16')][_0x1e26('0x17')]===0x1f4){logger[_0x1e26('0x16')](_0x1e26('0x18'),_0x420a3e,_0x25b4a3[_0x1e26('0x16')][_0x1e26('0x19')]);return _0x39ec09(_0x25b4a3[_0x1e26('0x16')][_0x1e26('0x19')]);}logger[_0x1e26('0x16')](_0x1e26('0x18'),_0x420a3e,_0x25b4a3[_0x1e26('0x16')][_0x1e26('0x19')]);return _0x2c6bcb(_0x25b4a3[_0x1e26('0x16')]['message']);}else{logger[_0x1e26('0x1a')](_0x1e26('0x18'),_0x420a3e,_0x1e26('0x13'));_0x2c6bcb(_0x25b4a3[_0x1e26('0x1b')]['message']);}})[_0x1e26('0x1c')](function(_0x2d657b){logger[_0x1e26('0x16')](_0x1e26('0x18'),_0x420a3e,_0x2d657b);_0x39ec09(_0x2d657b);});});} \ No newline at end of file +var _0x1889=['message','result','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','then','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ChatWebsite,\x20%s,\x20%s'];(function(_0x597da3,_0x51b62b){var _0xd3cd83=function(_0x4a92df){while(--_0x4a92df){_0x597da3['push'](_0x597da3['shift']());}};_0xd3cd83(++_0x51b62b);}(_0x1889,0x92));var _0x9188=function(_0x4cf4a4,_0xb50574){_0x4cf4a4=_0x4cf4a4-0x0;var _0x22d797=_0x1889[_0x4cf4a4];return _0x22d797;};'use strict';var _=require(_0x9188('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9188('0x1'));var fs=require('fs');var Redis=require(_0x9188('0x2'));var db=require(_0x9188('0x3'))['db'];var utils=require(_0x9188('0x4'));var logger=require(_0x9188('0x5'))(_0x9188('0x6'));var config=require('../../config/environment');var jayson=require(_0x9188('0x7'));var client=jayson[_0x9188('0x8')]['http']({'port':0x232a});config['redis']=_[_0x9188('0x9')](config[_0x9188('0xa')],{'host':_0x9188('0xb'),'port':0x18eb});var socket=require(_0x9188('0xc'))(new Redis(config['redis']));require(_0x9188('0xd'))[_0x9188('0xe')](socket);function respondWithRpcPromise(_0x237d7f,_0x1b4cd5,_0x4bfb55){return new BPromise(function(_0x8dc703,_0x376d9a){return client['request'](_0x237d7f,_0x4bfb55)[_0x9188('0xf')](function(_0x4da4f1){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x1b4cd5,'request\x20sent');logger[_0x9188('0x10')](_0x9188('0x11'),_0x1b4cd5,_0x9188('0x12'),JSON[_0x9188('0x13')](_0x4da4f1));if(_0x4da4f1[_0x9188('0x14')]){if(_0x4da4f1[_0x9188('0x14')]['code']===0x1f4){logger[_0x9188('0x14')](_0x9188('0x15'),_0x1b4cd5,_0x4da4f1[_0x9188('0x14')][_0x9188('0x16')]);return _0x376d9a(_0x4da4f1['error'][_0x9188('0x16')]);}logger[_0x9188('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x1b4cd5,_0x4da4f1['error']['message']);return _0x8dc703(_0x4da4f1['error'][_0x9188('0x16')]);}else{logger['info'](_0x9188('0x15'),_0x1b4cd5,'request\x20sent');_0x8dc703(_0x4da4f1[_0x9188('0x17')]['message']);}})['catch'](function(_0x343815){logger[_0x9188('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x1b4cd5,_0x343815);_0x376d9a(_0x343815);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index a4dda2b..d9a1fd2 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 _0x9aa2=['emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x4430b3,_0x43ff47){var _0xed44da=function(_0x4c31a3){while(--_0x4c31a3){_0x4430b3['push'](_0x4430b3['shift']());}};_0xed44da(++_0x43ff47);}(_0x9aa2,0x85));var _0x29aa=function(_0x44ed71,_0x175c83){_0x44ed71=_0x44ed71-0x0;var _0x332ad9=_0x9aa2[_0x44ed71];return _0x332ad9;};'use strict';var ChatWebsiteEvents=require(_0x29aa('0x0'));var events=['save',_0x29aa('0x1'),_0x29aa('0x2')];function createListener(_0x581c39,_0x554ba4){return function(_0xa8cc9a){_0x554ba4[_0x29aa('0x3')](_0x581c39,_0xa8cc9a);};}function removeListener(_0x4f9788,_0x3bf77c){return function(){ChatWebsiteEvents[_0x29aa('0x4')](_0x4f9788,_0x3bf77c);};}exports[_0x29aa('0x5')]=function(_0x5e3f2d){for(var _0x391681=0x0,_0x4e38f9=events[_0x29aa('0x6')];_0x391681<_0x4e38f9;_0x391681++){var _0x54f523=events[_0x391681];var _0xe29cf1=createListener(_0x29aa('0x7')+_0x54f523,_0x5e3f2d);ChatWebsiteEvents['on'](_0x54f523,_0xe29cf1);}}; \ No newline at end of file +var _0xc447=['register','length','./chatWebsite.events','save','remove','update','emit'];(function(_0x100d76,_0x351c25){var _0x31fbcf=function(_0x481293){while(--_0x481293){_0x100d76['push'](_0x100d76['shift']());}};_0x31fbcf(++_0x351c25);}(_0xc447,0x8e));var _0x7c44=function(_0x16494d,_0x3cbf7a){_0x16494d=_0x16494d-0x0;var _0x28a859=_0xc447[_0x16494d];return _0x28a859;};'use strict';var ChatWebsiteEvents=require(_0x7c44('0x0'));var events=[_0x7c44('0x1'),_0x7c44('0x2'),_0x7c44('0x3')];function createListener(_0x48726e,_0x342054){return function(_0x352101){_0x342054[_0x7c44('0x4')](_0x48726e,_0x352101);};}function removeListener(_0x52741a,_0x14bcb2){return function(){ChatWebsiteEvents['removeListener'](_0x52741a,_0x14bcb2);};}exports[_0x7c44('0x5')]=function(_0x208d37){for(var _0x3f3972=0x0,_0x2a3c79=events[_0x7c44('0x6')];_0x3f3972<_0x2a3c79;_0x3f3972++){var _0x2d863a=events[_0x3f3972];var _0x17e1d3=createListener('chatWebsite:'+_0x2d863a,_0x208d37);ChatWebsiteEvents['on'](_0x2d863a,_0x17e1d3);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 928504a..207e997 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 _0x149e=['getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','diskStorage','root','server/files/images/logos/','%s-%s','now','originalname','single','addLogo','join','server/files/images/avatars/','file','addAvatar','format','server/files','attachments','ensureDir','replace','extname','any','offline','addInteraction','addApplications','addAgents','update','delete','removeDispositions','removeAgents','util','path','connect-timeout','fs-extra','../../config/environment','./chatWebsite.controller','isAuthenticated','get','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/interactions','getInteractions','/:id/snippet'];(function(_0x26ae63,_0x321902){var _0x318359=function(_0x404f74){while(--_0x404f74){_0x26ae63['push'](_0x26ae63['shift']());}};_0x318359(++_0x321902);}(_0x149e,0xe6));var _0xe149=function(_0x38dc8d,_0x26d480){_0x38dc8d=_0x38dc8d-0x0;var _0x28aa3b=_0x149e[_0x38dc8d];return _0x28aa3b;};'use strict';var multer=require('multer');var util=require(_0xe149('0x0'));var path=require(_0xe149('0x1'));var timeout=require(_0xe149('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe149('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe149('0x4'));var controller=require(_0xe149('0x5'));router['get']('/',auth[_0xe149('0x6')](),controller['index']);router[_0xe149('0x7')]('/describe',auth[_0xe149('0x6')](),controller[_0xe149('0x8')]);router[_0xe149('0x7')](_0xe149('0x9'),auth[_0xe149('0x6')](),controller[_0xe149('0xa')]);router[_0xe149('0x7')](_0xe149('0xb'),auth[_0xe149('0x6')](),controller[_0xe149('0xc')]);router['get']('/:id/canned_answers',auth[_0xe149('0x6')](),controller[_0xe149('0xd')]);router[_0xe149('0x7')](_0xe149('0xe'),controller[_0xe149('0xf')]);router[_0xe149('0x7')](_0xe149('0x10'),controller[_0xe149('0x11')]);router[_0xe149('0x7')](_0xe149('0x12'),controller['getCustomerAvatar']);router[_0xe149('0x7')]('/:id/system_avatar',controller['getSystemAvatar']);router[_0xe149('0x7')](_0xe149('0x13'),auth['isAuthenticated'](),controller[_0xe149('0x14')]);router[_0xe149('0x7')](_0xe149('0x15'),controller[_0xe149('0x16')]);router['get'](_0xe149('0x17'),auth[_0xe149('0x6')](),controller[_0xe149('0x18')]);router[_0xe149('0x7')](_0xe149('0x19'),auth[_0xe149('0x6')](),controller[_0xe149('0x1a')]);router[_0xe149('0x7')]('/:id/fields',controller[_0xe149('0x1b')]);router[_0xe149('0x7')](_0xe149('0x1c'),auth['isAuthenticated'](),controller[_0xe149('0x1d')]);router['get'](_0xe149('0x1e'),auth['isAuthenticated'](),controller[_0xe149('0x1f')]);router[_0xe149('0x20')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xe149('0xb'),auth[_0xe149('0x6')](),controller[_0xe149('0x21')]);router['post'](_0xe149('0x22'),auth[_0xe149('0x6')](),controller[_0xe149('0x23')]);var upload=multer({'storage':multer[_0xe149('0x24')]({'destination':function(_0x3cd0df,_0x33960a,_0x3cf538){_0x3cf538(null,path['join'](config[_0xe149('0x25')],_0xe149('0x26')));},'filename':function(_0x4c1c58,_0x5099ce,_0x34a28b){_0x34a28b(null,util['format'](_0xe149('0x27'),Date[_0xe149('0x28')](),_0x5099ce[_0xe149('0x29')]));}})});router[_0xe149('0x20')](_0xe149('0xe'),upload[_0xe149('0x2a')]('file'),controller[_0xe149('0x2b')]);var upload=multer({'storage':multer[_0xe149('0x24')]({'destination':function(_0x3b0172,_0x249b7f,_0x55025a){_0x55025a(null,path[_0xe149('0x2c')](config[_0xe149('0x25')],_0xe149('0x2d')));},'filename':function(_0x5689cc,_0x4461e8,_0x7afa38){_0x7afa38(null,util['format'](_0xe149('0x27'),Date['now'](),_0x4461e8['originalname']));}})});router[_0xe149('0x20')]('/:id/avatar',upload[_0xe149('0x2a')](_0xe149('0x2e')),controller[_0xe149('0x2f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3a3840,_0x6358f3,_0x1f88d1){_0x1f88d1(null,path[_0xe149('0x2c')](config[_0xe149('0x25')],_0xe149('0x2d')));},'filename':function(_0x352d64,_0x125261,_0x2f6fa1){_0x2f6fa1(null,util['format'](_0xe149('0x27'),Date[_0xe149('0x28')](),_0x125261[_0xe149('0x29')]));}})});router[_0xe149('0x20')]('/:id/customer_avatar',upload[_0xe149('0x2a')]('file'),controller['addCustomerAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x34fcf6,_0x46cd37,_0x312633){_0x312633(null,path[_0xe149('0x2c')](config[_0xe149('0x25')],'server/files/images/avatars/'));},'filename':function(_0x54345f,_0x36d109,_0x2b1056){_0x2b1056(null,util[_0xe149('0x30')](_0xe149('0x27'),Date[_0xe149('0x28')](),_0x36d109[_0xe149('0x29')]));}})});router[_0xe149('0x20')]('/:id/system_avatar',upload['single'](_0xe149('0x2e')),controller['addSystemAvatar']);router[_0xe149('0x20')]('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0xe149('0x24')]({'destination':function(_0x107001,_0xea8904,_0x5c7205){const _0x8f6d3f=path[_0xe149('0x2c')](config[_0xe149('0x25')],_0xe149('0x31'),_0xe149('0x32'),'offline-chat');fs_extra[_0xe149('0x33')](_0x8f6d3f,function(){_0x5c7205(null,_0x8f6d3f);});},'filename':function(_0x49588a,_0x56f945,_0x37efdb){const _0x185f02=_0x56f945[_0xe149('0x29')][_0xe149('0x34')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0xa4a025=path[_0xe149('0x35')](_0x185f02);const _0x3bd3c7=Date[_0xe149('0x28')]()+'-'+_0x185f02[_0xe149('0x34')](_0xa4a025,'')+_0xa4a025;_0x37efdb(null,_0x3bd3c7);}})});router[_0xe149('0x20')]('/:id/offline',offlineUploadMulter[_0xe149('0x36')](),controller[_0xe149('0x37')]);router[_0xe149('0x20')]('/:id/interactions',auth[_0xe149('0x6')](),controller[_0xe149('0x38')]);router[_0xe149('0x20')](_0xe149('0x17'),auth[_0xe149('0x6')](),controller[_0xe149('0x39')]);router['post'](_0xe149('0x19'),auth['isAuthenticated'](),controller['addProactiveActions']);router[_0xe149('0x20')](_0xe149('0x1e'),auth[_0xe149('0x6')](),controller[_0xe149('0x3a')]);router['put'](_0xe149('0x9'),auth[_0xe149('0x6')](),controller[_0xe149('0x3b')]);router[_0xe149('0x3c')](_0xe149('0x9'),auth[_0xe149('0x6')](),controller['destroy']);router[_0xe149('0x3c')](_0xe149('0xb'),auth[_0xe149('0x6')](),controller[_0xe149('0x3d')]);router[_0xe149('0x3c')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0xe149('0x3c')](_0xe149('0x1e'),auth[_0xe149('0x6')](),controller[_0xe149('0x3e')]);module['exports']=router; \ No newline at end of file +var _0xd6c5=['delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','getAnswers','/:id/logo','getLogo','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','getApplications','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','getAgents','post','/:id/dispositions','addDisposition','/:id/canned_answers','diskStorage','join','server/files/images/logos/','format','%s-%s','now','file','addLogo','server/files/images/avatars/','originalname','/:id/avatar','single','addAvatar','root','/:id/notify','server/files','attachments','offline-chat','ensureDir','replace','/:id/offline','any','offline','addInteraction','addApplications','addProactiveActions','/:id/users','addAgents','put','/:id','update'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xd6c5,0x19e));var _0x5d6c=function(_0x333ded,_0x1d5a09){_0x333ded=_0x333ded-0x0;var _0x4c90ae=_0xd6c5[_0x333ded];return _0x4c90ae;};'use strict';var multer=require('multer');var util=require(_0x5d6c('0x0'));var path=require(_0x5d6c('0x1'));var timeout=require(_0x5d6c('0x2'));var express=require(_0x5d6c('0x3'));var router=express[_0x5d6c('0x4')]();var fs_extra=require(_0x5d6c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5d6c('0x6'));var config=require(_0x5d6c('0x7'));var controller=require('./chatWebsite.controller');router[_0x5d6c('0x8')]('/',auth[_0x5d6c('0x9')](),controller[_0x5d6c('0xa')]);router[_0x5d6c('0x8')](_0x5d6c('0xb'),auth[_0x5d6c('0x9')](),controller['describe']);router[_0x5d6c('0x8')]('/:id',auth[_0x5d6c('0x9')](),controller['show']);router[_0x5d6c('0x8')]('/:id/dispositions',auth[_0x5d6c('0x9')](),controller['getDispositions']);router[_0x5d6c('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x5d6c('0xc')]);router[_0x5d6c('0x8')](_0x5d6c('0xd'),controller[_0x5d6c('0xe')]);router[_0x5d6c('0x8')]('/:id/avatar',controller[_0x5d6c('0xf')]);router['get']('/:id/customer_avatar',controller[_0x5d6c('0x10')]);router[_0x5d6c('0x8')](_0x5d6c('0x11'),controller[_0x5d6c('0x12')]);router[_0x5d6c('0x8')](_0x5d6c('0x13'),auth[_0x5d6c('0x9')](),controller[_0x5d6c('0x14')]);router[_0x5d6c('0x8')]('/:id/snippet',controller['getSnippet']);router[_0x5d6c('0x8')]('/:id/applications',auth[_0x5d6c('0x9')](),controller[_0x5d6c('0x15')]);router[_0x5d6c('0x8')](_0x5d6c('0x16'),auth[_0x5d6c('0x9')](),controller[_0x5d6c('0x17')]);router[_0x5d6c('0x8')]('/:id/fields',controller[_0x5d6c('0x18')]);router[_0x5d6c('0x8')](_0x5d6c('0x19'),auth['isAuthenticated'](),controller['getOfflineMessages']);router[_0x5d6c('0x8')]('/:id/users',auth[_0x5d6c('0x9')](),controller[_0x5d6c('0x1a')]);router[_0x5d6c('0x1b')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5d6c('0x1b')](_0x5d6c('0x1c'),auth[_0x5d6c('0x9')](),controller[_0x5d6c('0x1d')]);router[_0x5d6c('0x1b')](_0x5d6c('0x1e'),auth[_0x5d6c('0x9')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x5d6c('0x1f')]({'destination':function(_0x4628d4,_0x3f7119,_0x30d761){_0x30d761(null,path[_0x5d6c('0x20')](config['root'],_0x5d6c('0x21')));},'filename':function(_0x1ef2d1,_0x227081,_0x49a84a){_0x49a84a(null,util[_0x5d6c('0x22')](_0x5d6c('0x23'),Date[_0x5d6c('0x24')](),_0x227081['originalname']));}})});router[_0x5d6c('0x1b')](_0x5d6c('0xd'),upload['single'](_0x5d6c('0x25')),controller[_0x5d6c('0x26')]);var upload=multer({'storage':multer[_0x5d6c('0x1f')]({'destination':function(_0x8c36c2,_0x4fe969,_0x1acdc1){_0x1acdc1(null,path[_0x5d6c('0x20')](config['root'],_0x5d6c('0x27')));},'filename':function(_0x588fc4,_0xd330ff,_0x4d7e7d){_0x4d7e7d(null,util[_0x5d6c('0x22')](_0x5d6c('0x23'),Date[_0x5d6c('0x24')](),_0xd330ff[_0x5d6c('0x28')]));}})});router[_0x5d6c('0x1b')](_0x5d6c('0x29'),upload[_0x5d6c('0x2a')](_0x5d6c('0x25')),controller[_0x5d6c('0x2b')]);var upload=multer({'storage':multer[_0x5d6c('0x1f')]({'destination':function(_0x20eabf,_0x216797,_0x2d1ca5){_0x2d1ca5(null,path[_0x5d6c('0x20')](config[_0x5d6c('0x2c')],_0x5d6c('0x27')));},'filename':function(_0x783b20,_0x200817,_0x403267){_0x403267(null,util[_0x5d6c('0x22')](_0x5d6c('0x23'),Date['now'](),_0x200817[_0x5d6c('0x28')]));}})});router['post']('/:id/customer_avatar',upload['single'](_0x5d6c('0x25')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x5d6c('0x1f')]({'destination':function(_0x5547b7,_0x46ed90,_0x26fe3c){_0x26fe3c(null,path[_0x5d6c('0x20')](config[_0x5d6c('0x2c')],'server/files/images/avatars/'));},'filename':function(_0x581ed8,_0x184432,_0x231e4e){_0x231e4e(null,util[_0x5d6c('0x22')](_0x5d6c('0x23'),Date[_0x5d6c('0x24')](),_0x184432[_0x5d6c('0x28')]));}})});router['post']('/:id/system_avatar',upload['single'](_0x5d6c('0x25')),controller['addSystemAvatar']);router['post'](_0x5d6c('0x2d'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x5d6c('0x1f')]({'destination':function(_0x439789,_0x4db979,_0x4713da){const _0x5f0446=path[_0x5d6c('0x20')](config[_0x5d6c('0x2c')],_0x5d6c('0x2e'),_0x5d6c('0x2f'),_0x5d6c('0x30'));fs_extra[_0x5d6c('0x31')](_0x5f0446,function(){_0x4713da(null,_0x5f0446);});},'filename':function(_0x3a2c1b,_0x415618,_0x3cc4f5){const _0x1eb9b7=_0x415618[_0x5d6c('0x28')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2215ca=path['extname'](_0x1eb9b7);const _0x5db12d=Date[_0x5d6c('0x24')]()+'-'+_0x1eb9b7[_0x5d6c('0x32')](_0x2215ca,'')+_0x2215ca;_0x3cc4f5(null,_0x5db12d);}})});router['post'](_0x5d6c('0x33'),offlineUploadMulter[_0x5d6c('0x34')](),controller[_0x5d6c('0x35')]);router['post']('/:id/interactions',auth[_0x5d6c('0x9')](),controller[_0x5d6c('0x36')]);router[_0x5d6c('0x1b')]('/:id/applications',auth['isAuthenticated'](),controller[_0x5d6c('0x37')]);router[_0x5d6c('0x1b')](_0x5d6c('0x16'),auth[_0x5d6c('0x9')](),controller[_0x5d6c('0x38')]);router['post'](_0x5d6c('0x39'),auth[_0x5d6c('0x9')](),controller[_0x5d6c('0x3a')]);router[_0x5d6c('0x3b')](_0x5d6c('0x3c'),auth[_0x5d6c('0x9')](),controller[_0x5d6c('0x3d')]);router[_0x5d6c('0x3e')](_0x5d6c('0x3c'),auth['isAuthenticated'](),controller[_0x5d6c('0x3f')]);router[_0x5d6c('0x3e')](_0x5d6c('0x1c'),auth['isAuthenticated'](),controller[_0x5d6c('0x40')]);router['delete'](_0x5d6c('0x1e'),auth[_0x5d6c('0x9')](),controller[_0x5d6c('0x41')]);router[_0x5d6c('0x3e')](_0x5d6c('0x39'),auth[_0x5d6c('0x9')](),controller[_0x5d6c('0x42')]);module[_0x5d6c('0x43')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index dcb689b..9d4f1a0 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 _0xac6a=['exports','STRING','ENUM','AmazonAWS','sequelize'];(function(_0x2c679f,_0x4096be){var _0xa65f87=function(_0x2bb75b){while(--_0x2bb75b){_0x2c679f['push'](_0x2c679f['shift']());}};_0xa65f87(++_0x4096be);}(_0xac6a,0xc2));var _0xaac6=function(_0x1ba17e,_0x1e2385){_0x1ba17e=_0x1ba17e-0x0;var _0x483630=_0xac6a[_0x1ba17e];return _0x483630;};'use strict';var Sequelize=require(_0xaac6('0x0'));module[_0xaac6('0x1')]={'name':{'type':Sequelize[_0xaac6('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xaac6('0x3')](_0xaac6('0x4'),'Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xaac6('0x2')]},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5a93=['AmazonAWS','STRING','exports','ENUM'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x5a93,0xf6));var _0x35a9=function(_0x48cc52,_0x482f45){_0x48cc52=_0x48cc52-0x0;var _0x3c51b2=_0x5a93[_0x48cc52];return _0x3c51b2;};'use strict';var Sequelize=require('sequelize');module[_0x35a9('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x35a9('0x1')](_0x35a9('0x2'),'Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x35a9('0x3')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 9bccadd..43e6934 100644 --- a/server/api/cloudProvider/cloudProvider.controller.js +++ b/server/api/cloudProvider/cloudProvider.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','include','find','create','body','params','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','CloudProvider','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length'];(function(_0x42d903,_0xbc931d){var _0x7406c=function(_0x44052b){while(--_0x44052b){_0x42d903['push'](_0x42d903['shift']());}};_0x7406c(++_0xbc931d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x0b0e[_0x1694f5];return _0x5b4321;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['CloudProvider'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'all':!![]}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x41')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x402a0e){_0x36d137[_0xe0b0('0x42')]=_0x402a0e;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))[_0xe0b0('0x43')](handleError(_0x5b7a64,null));};exports[_0xe0b0('0x44')]=function(_0x52ffe4,_0x2aad80){var _0x309bbf={'raw':!![],'where':{'id':_0x52ffe4['params']['id']}},_0x528818={};_0x528818[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db['CloudProvider'][_0xe0b0('0x2b')]);_0x528818[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x52ffe4[_0xe0b0('0x2e')]);_0x528818[_0xe0b0('0x39')]=_['intersection'](_0x528818['model'],_0x528818['query']);_0x309bbf[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x528818['model'],qs[_0xe0b0('0x33')](_0x52ffe4[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x309bbf[_0xe0b0('0x32')]=_0x309bbf[_0xe0b0('0x32')]['length']?_0x309bbf['attributes']:_0x528818[_0xe0b0('0x31')];if(_0x52ffe4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x309bbf[_0xe0b0('0x45')]=[{'all':!![]}];}_0x309bbf=_[_0xe0b0('0x3b')]({},_0x309bbf,_0x52ffe4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x46')](_0x309bbf)['then'](handleEntityNotFound(_0x2aad80,null))['then'](respondWithResult(_0x2aad80,null))['catch'](handleError(_0x2aad80,null));};exports[_0xe0b0('0x47')]=function(_0x2184d3,_0x2419ce){return db[_0xe0b0('0x2a')]['create'](_0x2184d3[_0xe0b0('0x48')],{})[_0xe0b0('0x23')](respondWithResult(_0x2419ce,0xc9))['catch'](handleError(_0x2419ce,null));};exports['update']=function(_0x2365be,_0x1bc6e0){if(_0x2365be['body']['id']){delete _0x2365be[_0xe0b0('0x48')]['id'];}return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x2365be['params']['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x1bc6e0,null))['then'](saveUpdates(_0x2365be[_0xe0b0('0x48')],null))[_0xe0b0('0x23')](respondWithResult(_0x1bc6e0,null))[_0xe0b0('0x43')](handleError(_0x1bc6e0,null));};exports[_0xe0b0('0x24')]=function(_0x19ee71,_0xf9e694){return db['CloudProvider']['find']({'where':{'id':_0x19ee71[_0xe0b0('0x49')]['id']}})['then'](handleEntityNotFound(_0xf9e694,null))['then'](removeEntity(_0xf9e694,null))[_0xe0b0('0x43')](handleError(_0xf9e694,null));}; \ No newline at end of file +var _0xdb28=['error','stack','name','send','index','CloudProvider','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus'];(function(_0x57bd98,_0x5dde4c){var _0x5ba93f=function(_0x161397){while(--_0x161397){_0x57bd98['push'](_0x57bd98['shift']());}};_0x5ba93f(++_0x5dde4c);}(_0xdb28,0x106));var _0x8db2=function(_0x3e005a,_0x1f86fa){_0x3e005a=_0x3e005a-0x0;var _0x9427cf=_0xdb28[_0x3e005a];return _0x9427cf;};'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 34e6f0f..92755f8 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 _0xb642=['../../config/logger','moment','bluebird','request-promise','../../config/environment','exports','define','CloudProvider','cloud_providers','util'];(function(_0x5f4388,_0x529430){var _0xe109f6=function(_0x4b8866){while(--_0x4b8866){_0x5f4388['push'](_0x5f4388['shift']());}};_0xe109f6(++_0x529430);}(_0xb642,0x15d));var _0x2b64=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xb642[_0x28947d];return _0x12d2ee;};'use strict';var _=require('lodash');var util=require(_0x2b64('0x0'));var logger=require(_0x2b64('0x1'))('api');var moment=require(_0x2b64('0x2'));var BPromise=require(_0x2b64('0x3'));var rp=require(_0x2b64('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2b64('0x5'));var attributes=require('./cloudProvider.attributes');module[_0x2b64('0x6')]=function(_0x4331f0,_0x4dedfc){return _0x4331f0[_0x2b64('0x7')](_0x2b64('0x8'),attributes,{'tableName':_0x2b64('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x79aa=['../../config/environment','exports','define','CloudProvider','lodash','util','api','request-promise','path','rimraf'];(function(_0x2f7c39,_0x50df36){var _0x19e571=function(_0x82273d){while(--_0x82273d){_0x2f7c39['push'](_0x2f7c39['shift']());}};_0x19e571(++_0x50df36);}(_0x79aa,0x1a8));var _0xa79a=function(_0x1069f5,_0x51cc78){_0x1069f5=_0x1069f5-0x0;var _0x5c211d=_0x79aa[_0x1069f5];return _0x5c211d;};'use strict';var _=require(_0xa79a('0x0'));var util=require(_0xa79a('0x1'));var logger=require('../../config/logger')(_0xa79a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa79a('0x3'));var fs=require('fs');var path=require(_0xa79a('0x4'));var rimraf=require(_0xa79a('0x5'));var config=require(_0xa79a('0x6'));var attributes=require('./cloudProvider.attributes');module[_0xa79a('0x7')]=function(_0x3d4c21,_0x2dd983){return _0x3d4c21[_0xa79a('0x8')](_0xa79a('0x9'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index ddf9ef0..63768d9 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 _0x30fc=['CloudProvider,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x2b3932,_0x196bfb){var _0x322b2e=function(_0x50cbd7){while(--_0x50cbd7){_0x2b3932['push'](_0x2b3932['shift']());}};_0x322b2e(++_0x196bfb);}(_0x30fc,0x64));var _0xc30f=function(_0x362d8d,_0x543ba7){_0x362d8d=_0x362d8d-0x0;var _0x88cef5=_0x30fc[_0x362d8d];return _0x88cef5;};'use strict';var _=require(_0xc30f('0x0'));var util=require(_0xc30f('0x1'));var moment=require('moment');var BPromise=require(_0xc30f('0x2'));var rs=require(_0xc30f('0x3'));var fs=require('fs');var Redis=require(_0xc30f('0x4'));var db=require(_0xc30f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc30f('0x6'))(_0xc30f('0x7'));var config=require(_0xc30f('0x8'));var jayson=require(_0xc30f('0x9'));var client=jayson[_0xc30f('0xa')][_0xc30f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54c174,_0x23528c,_0x325a64){return new BPromise(function(_0x33a769,_0x3d2167){return client[_0xc30f('0xc')](_0x54c174,_0x325a64)[_0xc30f('0xd')](function(_0x436059){logger[_0xc30f('0xe')](_0xc30f('0xf'),_0x23528c,'request\x20sent');logger[_0xc30f('0x10')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x23528c,_0xc30f('0x11'),JSON[_0xc30f('0x12')](_0x436059));if(_0x436059[_0xc30f('0x13')]){if(_0x436059[_0xc30f('0x13')][_0xc30f('0x14')]===0x1f4){logger[_0xc30f('0x13')]('CloudProvider,\x20%s,\x20%s',_0x23528c,_0x436059['error'][_0xc30f('0x15')]);return _0x3d2167(_0x436059[_0xc30f('0x13')][_0xc30f('0x15')]);}logger[_0xc30f('0x13')]('CloudProvider,\x20%s,\x20%s',_0x23528c,_0x436059[_0xc30f('0x13')][_0xc30f('0x15')]);return _0x33a769(_0x436059[_0xc30f('0x13')][_0xc30f('0x15')]);}else{logger[_0xc30f('0xe')](_0xc30f('0xf'),_0x23528c,_0xc30f('0x11'));_0x33a769(_0x436059['result']['message']);}})[_0xc30f('0x16')](function(_0x1b02c5){logger[_0xc30f('0x13')](_0xc30f('0xf'),_0x23528c,_0x1b02c5);_0x3d2167(_0x1b02c5);});});} \ No newline at end of file +var _0xd914=['CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info'];(function(_0x512a67,_0x1ce102){var _0x778d6a=function(_0x5cc6cc){while(--_0x5cc6cc){_0x512a67['push'](_0x512a67['shift']());}};_0x778d6a(++_0x1ce102);}(_0xd914,0x17f));var _0x4d91=function(_0x32729c,_0xf5afd8){_0x32729c=_0x32729c-0x0;var _0x482cfd=_0xd914[_0x32729c];return _0x482cfd;};'use strict';var _=require(_0x4d91('0x0'));var util=require(_0x4d91('0x1'));var moment=require('moment');var BPromise=require(_0x4d91('0x2'));var rs=require(_0x4d91('0x3'));var fs=require('fs');var Redis=require(_0x4d91('0x4'));var db=require(_0x4d91('0x5'))['db'];var utils=require(_0x4d91('0x6'));var logger=require(_0x4d91('0x7'))('rpc');var config=require(_0x4d91('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4d91('0x9')][_0x4d91('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x175ce3,_0x27c0d5,_0x22f2a4){return new BPromise(function(_0x150767,_0x3016c0){return client[_0x4d91('0xb')](_0x175ce3,_0x22f2a4)['then'](function(_0x37bde4){logger[_0x4d91('0xc')](_0x4d91('0xd'),_0x27c0d5,_0x4d91('0xe'));logger[_0x4d91('0xf')](_0x4d91('0x10'),_0x27c0d5,'request\x20sent',JSON['stringify'](_0x37bde4));if(_0x37bde4[_0x4d91('0x11')]){if(_0x37bde4[_0x4d91('0x11')][_0x4d91('0x12')]===0x1f4){logger[_0x4d91('0x11')](_0x4d91('0xd'),_0x27c0d5,_0x37bde4[_0x4d91('0x11')]['message']);return _0x3016c0(_0x37bde4['error'][_0x4d91('0x13')]);}logger[_0x4d91('0x11')](_0x4d91('0xd'),_0x27c0d5,_0x37bde4[_0x4d91('0x11')][_0x4d91('0x13')]);return _0x150767(_0x37bde4[_0x4d91('0x11')][_0x4d91('0x13')]);}else{logger['info'](_0x4d91('0xd'),_0x27c0d5,_0x4d91('0xe'));_0x150767(_0x37bde4[_0x4d91('0x14')][_0x4d91('0x13')]);}})[_0x4d91('0x15')](function(_0x554ca8){logger[_0x4d91('0x11')](_0x4d91('0xd'),_0x27c0d5,_0x554ca8);_0x3016c0(_0x554ca8);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 68d3a7e..6318b43 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 _0x7833=['update','delete','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x56860e,_0x5f46de){var _0x28a590=function(_0x24814b){while(--_0x24814b){_0x56860e['push'](_0x56860e['shift']());}};_0x28a590(++_0x5f46de);}(_0x7833,0x1d6));var _0x3783=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x7833[_0x199572];return _0x13cfa3;};'use strict';var multer=require(_0x3783('0x0'));var util=require(_0x3783('0x1'));var path=require('path');var timeout=require(_0x3783('0x2'));var express=require('express');var router=express[_0x3783('0x3')]();var fs_extra=require(_0x3783('0x4'));var auth=require(_0x3783('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3783('0x6'));var controller=require(_0x3783('0x7'));router[_0x3783('0x8')]('/',auth[_0x3783('0x9')](),controller[_0x3783('0xa')]);router[_0x3783('0x8')](_0x3783('0xb'),auth[_0x3783('0x9')](),controller[_0x3783('0xc')]);router[_0x3783('0xd')]('/',auth[_0x3783('0x9')](),controller[_0x3783('0xe')]);router[_0x3783('0xf')](_0x3783('0xb'),auth[_0x3783('0x9')](),controller[_0x3783('0x10')]);router[_0x3783('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf628=['get','index','/:id','isAuthenticated','post','create','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller'];(function(_0x49d27a,_0x166543){var _0x3f0b62=function(_0x4eb485){while(--_0x4eb485){_0x49d27a['push'](_0x49d27a['shift']());}};_0x3f0b62(++_0x166543);}(_0xf628,0x7f));var _0x8f62=function(_0x3a7589,_0x4396b2){_0x3a7589=_0x3a7589-0x0;var _0x2a7235=_0xf628[_0x3a7589];return _0x2a7235;};'use strict';var multer=require(_0x8f62('0x0'));var util=require(_0x8f62('0x1'));var path=require(_0x8f62('0x2'));var timeout=require(_0x8f62('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8f62('0x4'));var interaction=require(_0x8f62('0x5'));var config=require(_0x8f62('0x6'));var controller=require(_0x8f62('0x7'));router[_0x8f62('0x8')]('/',auth['isAuthenticated'](),controller[_0x8f62('0x9')]);router['get'](_0x8f62('0xa'),auth[_0x8f62('0xb')](),controller['show']);router[_0x8f62('0xc')]('/',auth[_0x8f62('0xb')](),controller[_0x8f62('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x8f62('0xa'),auth[_0x8f62('0xb')](),controller['destroy']);module[_0x8f62('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 0433d9e..32b1a38 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 _0xb73c=['STRING','name','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb73c,0x1cd));var _0xcb73=function(_0x7c9784,_0x105c50){_0x7c9784=_0x7c9784-0x0;var _0x46ed1a=_0xb73c[_0x7c9784];return _0x46ed1a;};'use strict';var Sequelize=require(_0xcb73('0x0'));module['exports']={'name':{'type':Sequelize[_0xcb73('0x1')],'unique':_0xcb73('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xcb73('0x1')]},'companyId':{'type':Sequelize[_0xcb73('0x1')]},'website':{'type':Sequelize[_0xcb73('0x1')]},'phone':{'type':Sequelize[_0xcb73('0x1')]},'fax':{'type':Sequelize[_0xcb73('0x1')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xcb73('0x1')]},'postalCode':{'type':Sequelize[_0xcb73('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xcb73('0x1')]},'sStreet':{'type':Sequelize[_0xcb73('0x1')]},'sPostalCode':{'type':Sequelize[_0xcb73('0x1')]},'sCity':{'type':Sequelize[_0xcb73('0x1')]},'sCountry':{'type':Sequelize[_0xcb73('0x1')]},'description':{'type':Sequelize[_0xcb73('0x1')]}}; \ No newline at end of file +var _0xab60=['STRING','name','sequelize','exports'];(function(_0x30b973,_0x10f977){var _0x5525a8=function(_0x26ea78){while(--_0x26ea78){_0x30b973['push'](_0x30b973['shift']());}};_0x5525a8(++_0x10f977);}(_0xab60,0xea));var _0x0ab6=function(_0x3a43ee,_0xb22d3){_0x3a43ee=_0x3a43ee-0x0;var _0x565e69=_0xab60[_0x3a43ee];return _0x565e69;};'use strict';var Sequelize=require(_0x0ab6('0x0'));module[_0x0ab6('0x1')]={'name':{'type':Sequelize[_0x0ab6('0x2')],'unique':_0x0ab6('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x0ab6('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x0ab6('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0ab6('0x2')]},'street':{'type':Sequelize[_0x0ab6('0x2')]},'postalCode':{'type':Sequelize[_0x0ab6('0x2')]},'city':{'type':Sequelize[_0x0ab6('0x2')]},'country':{'type':Sequelize[_0x0ab6('0x2')]},'email':{'type':Sequelize[_0x0ab6('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x0ab6('0x2')]},'sStreet':{'type':Sequelize[_0x0ab6('0x2')]},'sPostalCode':{'type':Sequelize[_0x0ab6('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x0ab6('0x2')]},'description':{'type':Sequelize[_0x0ab6('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index c81d1e2..0b4026e 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 _0xf53d=['ids','getContacts','findOne','rawAttributes','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Companies','UserProfileResource','error','name','CmCompany','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','merge','map','filter','options','includeAll','include','findAll','catch','show','params','filters','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','addContacts','CmContact','omit'];(function(_0x331a6e,_0xa6122b){var _0x5116c6=function(_0x35e8d7){while(--_0x35e8d7){_0x331a6e['push'](_0x331a6e['shift']());}};_0x5116c6(++_0xa6122b);}(_0xf53d,0xac));var _0xdf53=function(_0xafac2b,_0xce00a6){_0xafac2b=_0xafac2b-0x0;var _0x1a0278=_0xf53d[_0xafac2b];return _0x1a0278;};'use strict';var emlformat=require(_0xdf53('0x0'));var rimraf=require(_0xdf53('0x1'));var zipdir=require(_0xdf53('0x2'));var jsonpatch=require(_0xdf53('0x3'));var rp=require('request-promise');var moment=require(_0xdf53('0x4'));var BPromise=require(_0xdf53('0x5'));var Mustache=require('mustache');var util=require(_0xdf53('0x6'));var path=require(_0xdf53('0x7'));var sox=require(_0xdf53('0x8'));var csv=require(_0xdf53('0x9'));var ejs=require(_0xdf53('0xa'));var fs=require('fs');var fs_extra=require(_0xdf53('0xb'));var _=require(_0xdf53('0xc'));var squel=require(_0xdf53('0xd'));var crypto=require(_0xdf53('0xe'));var jsforce=require(_0xdf53('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xdf53('0x9'));var querystring=require(_0xdf53('0x10'));var Papa=require(_0xdf53('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdf53('0x12'));var hardwareService=require(_0xdf53('0x13'));var logger=require(_0xdf53('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xdf53('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xdf53('0x16'))['db'];function respondWithStatusCode(_0x3a1369,_0x49789e){_0x49789e=_0x49789e||0xcc;return function(_0x359ac9){if(_0x359ac9){return _0x3a1369[_0xdf53('0x17')](_0x49789e);}return _0x3a1369['status'](_0x49789e)[_0xdf53('0x18')]();};}function respondWithResult(_0x4f762a,_0x14b0f1){_0x14b0f1=_0x14b0f1||0xc8;return function(_0x483445){if(_0x483445){return _0x4f762a[_0xdf53('0x19')](_0x14b0f1)[_0xdf53('0x1a')](_0x483445);}};}function respondWithFilteredResult(_0x55e89f,_0x138760){return function(_0x882063){if(_0x882063){var _0x33e5c6=typeof _0x138760['offset']===_0xdf53('0x1b')&&typeof _0x138760[_0xdf53('0x1c')]===_0xdf53('0x1b');var _0x5bc5e1=_0x882063[_0xdf53('0x1d')];var _0x4d5a67=_0x33e5c6?0x0:_0x138760['offset'];var _0x4628d4=_0x33e5c6?_0x882063[_0xdf53('0x1d')]:_0x138760['offset']+_0x138760['limit'];var _0x2ac754;if(_0x4628d4>=_0x5bc5e1){_0x4628d4=_0x5bc5e1;_0x2ac754=0xc8;}else{_0x2ac754=0xce;}_0x55e89f[_0xdf53('0x19')](_0x2ac754);return _0x55e89f[_0xdf53('0x1e')](_0xdf53('0x1f'),_0x4d5a67+'-'+_0x4628d4+'/'+_0x5bc5e1)[_0xdf53('0x1a')](_0x882063);}return null;};}function patchUpdates(_0x45a449){return function(_0x495567){try{jsonpatch[_0xdf53('0x20')](_0x495567,_0x45a449,!![]);}catch(_0x3067e0){return BPromise[_0xdf53('0x21')](_0x3067e0);}return _0x495567[_0xdf53('0x22')]();};}function saveUpdates(_0x43675c,_0x47a741){return function(_0x386ad7){if(_0x386ad7){return _0x386ad7[_0xdf53('0x23')](_0x43675c)[_0xdf53('0x24')](function(_0x2a6dcb){return _0x2a6dcb;});}return null;};}function removeEntity(_0x38c211,_0x466331){return function(_0x42ef98){if(_0x42ef98){return _0x42ef98[_0xdf53('0x25')]()[_0xdf53('0x24')](function(){var _0x51879a=_0x42ef98[_0xdf53('0x26')]({'plain':!![]});var _0x4ca7bb=_0xdf53('0x27');return db[_0xdf53('0x28')]['destroy']({'where':{'type':_0x4ca7bb,'resourceId':_0x51879a['id']}})[_0xdf53('0x24')](function(){return _0x42ef98;});})[_0xdf53('0x24')](function(){_0x38c211[_0xdf53('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x336bec,_0x469e3a){return function(_0x3127c){if(!_0x3127c){_0x336bec[_0xdf53('0x17')](0x194);}return _0x3127c;};}function handleError(_0xaa93d,_0x9b8561){_0x9b8561=_0x9b8561||0x1f4;return function(_0x545ead){logger[_0xdf53('0x29')](_0x545ead['stack']);if(_0x545ead[_0xdf53('0x2a')]){delete _0x545ead[_0xdf53('0x2a')];}_0xaa93d[_0xdf53('0x19')](_0x9b8561)['send'](_0x545ead);};}exports['index']=function(_0x44cd78,_0x261555){var _0x29e032={},_0x148abf={},_0x343668={'count':0x0,'rows':[]};return db[_0xdf53('0x2b')]['describe']()[_0xdf53('0x24')](function(_0x25841c){_0x148abf['model']=_[_0xdf53('0x2c')](_0x25841c);_0x148abf[_0xdf53('0x2d')]=_[_0xdf53('0x2c')](_0x44cd78[_0xdf53('0x2d')]);_0x148abf['filters']=_[_0xdf53('0x2e')](_0x148abf[_0xdf53('0x2f')],_0x148abf[_0xdf53('0x2d')]);_0x29e032[_0xdf53('0x30')]=_[_0xdf53('0x2e')](_0x148abf[_0xdf53('0x2f')],qs[_0xdf53('0x31')](_0x44cd78[_0xdf53('0x2d')][_0xdf53('0x31')]));_0x29e032['attributes']=_0x29e032[_0xdf53('0x30')][_0xdf53('0x32')]?_0x29e032[_0xdf53('0x30')]:_0x148abf[_0xdf53('0x2f')];if(!_0x44cd78['query'][_0xdf53('0x33')](_0xdf53('0x34'))){_0x29e032[_0xdf53('0x1c')]=qs[_0xdf53('0x1c')](_0x44cd78[_0xdf53('0x2d')]['limit']);_0x29e032['offset']=qs[_0xdf53('0x35')](_0x44cd78[_0xdf53('0x2d')][_0xdf53('0x35')]);}_0x29e032['order']=qs[_0xdf53('0x36')](_0x44cd78[_0xdf53('0x2d')][_0xdf53('0x36')]);_0x29e032[_0xdf53('0x37')]=qs['filters'](_[_0xdf53('0x38')](_0x44cd78[_0xdf53('0x2d')],_0x148abf['filters']),_0x25841c);if(_0x44cd78[_0xdf53('0x2d')]['filter']){_0x29e032[_0xdf53('0x37')]=_[_0xdf53('0x39')](_0x29e032[_0xdf53('0x37')],{'$or':_[_0xdf53('0x3a')](_0x29e032[_0xdf53('0x30')],function(_0x2dad97){var _0x3d9f9b={};_0x3d9f9b[_0x2dad97]={'$like':'%'+_0x44cd78[_0xdf53('0x2d')][_0xdf53('0x3b')]+'%'};return _0x3d9f9b;})});}_0x29e032=_[_0xdf53('0x39')]({},_0x29e032,_0x44cd78[_0xdf53('0x3c')]);var _0x4c7002={'where':_0x29e032[_0xdf53('0x37')]};return db[_0xdf53('0x2b')][_0xdf53('0x1d')](_0x4c7002)[_0xdf53('0x24')](function(_0x52f621){_0x343668['count']=_0x52f621;if(_0x44cd78[_0xdf53('0x2d')][_0xdf53('0x3d')]){_0x29e032[_0xdf53('0x3e')]=[{'all':!![]}];}return db[_0xdf53('0x2b')][_0xdf53('0x3f')](_0x29e032);})['then'](function(_0x48d465){_0x343668['rows']=_0x48d465;return _0x343668;})['then'](respondWithFilteredResult(_0x261555,_0x29e032))[_0xdf53('0x40')](handleError(_0x261555,null));})['catch'](handleError(_0x261555,null));};exports[_0xdf53('0x41')]=function(_0x5b95d7,_0x6206f5){var _0x22c35c={'raw':![],'where':{'id':_0x5b95d7[_0xdf53('0x42')]['id']}},_0x505c43={};_0x505c43['model']=_[_0xdf53('0x2c')](db['CmCompany']['rawAttributes']);_0x505c43[_0xdf53('0x2d')]=_[_0xdf53('0x2c')](_0x5b95d7[_0xdf53('0x2d')]);_0x505c43[_0xdf53('0x43')]=_[_0xdf53('0x2e')](_0x505c43[_0xdf53('0x2f')],_0x505c43['query']);_0x22c35c[_0xdf53('0x30')]=_[_0xdf53('0x2e')](_0x505c43[_0xdf53('0x2f')],qs['fields'](_0x5b95d7[_0xdf53('0x2d')][_0xdf53('0x31')]));_0x22c35c[_0xdf53('0x30')]=_0x22c35c[_0xdf53('0x30')]['length']?_0x22c35c[_0xdf53('0x30')]:_0x505c43[_0xdf53('0x2f')];if(_0x5b95d7[_0xdf53('0x2d')][_0xdf53('0x3d')]){_0x22c35c[_0xdf53('0x3e')]=[{'all':!![]}];}_0x22c35c=_[_0xdf53('0x39')]({},_0x22c35c,_0x5b95d7[_0xdf53('0x3c')]);return db['CmCompany']['find'](_0x22c35c)[_0xdf53('0x24')](handleEntityNotFound(_0x6206f5,null))[_0xdf53('0x24')](respondWithResult(_0x6206f5,null))[_0xdf53('0x40')](handleError(_0x6206f5,null));};exports[_0xdf53('0x44')]=function(_0x43a7b8,_0x3b37a3){return db['CmCompany'][_0xdf53('0x44')](_0x43a7b8[_0xdf53('0x45')],{})[_0xdf53('0x24')](function(_0x195edf){var _0x28d55e=_0x43a7b8[_0xdf53('0x46')][_0xdf53('0x26')]({'plain':!![]});if(!_0x28d55e)throw new Error(_0xdf53('0x47'));if(_0x28d55e[_0xdf53('0x48')]===_0xdf53('0x46')){var _0xf80383=_0x195edf['get']({'plain':!![]});var _0x4eb14e=_0xdf53('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x4eb14e,'userProfileId':_0x28d55e['userProfileId']},'raw':!![]})['then'](function(_0xb2ddc0){if(_0xb2ddc0&&_0xb2ddc0[_0xdf53('0x49')]===0x0){return db[_0xdf53('0x28')]['create']({'name':_0xf80383[_0xdf53('0x2a')],'resourceId':_0xf80383['id'],'type':_0xb2ddc0[_0xdf53('0x2a')],'sectionId':_0xb2ddc0['id']},{})['then'](function(){return _0x195edf;});}else{return _0x195edf;}})[_0xdf53('0x40')](function(_0x57bec7){logger[_0xdf53('0x29')](_0xdf53('0x4a'),_0x57bec7);throw _0x57bec7;});}return _0x195edf;})[_0xdf53('0x24')](respondWithResult(_0x3b37a3,0xc9))[_0xdf53('0x40')](handleError(_0x3b37a3,null));};exports[_0xdf53('0x23')]=function(_0x403c38,_0x134e30){if(_0x403c38[_0xdf53('0x45')]['id']){delete _0x403c38[_0xdf53('0x45')]['id'];}return db[_0xdf53('0x2b')][_0xdf53('0x4b')]({'where':{'id':_0x403c38['params']['id']}})[_0xdf53('0x24')](handleEntityNotFound(_0x134e30,null))[_0xdf53('0x24')](saveUpdates(_0x403c38['body'],null))[_0xdf53('0x24')](respondWithResult(_0x134e30,null))[_0xdf53('0x40')](handleError(_0x134e30,null));};exports[_0xdf53('0x25')]=function(_0x461d7c,_0x3536fa){return db[_0xdf53('0x2b')][_0xdf53('0x4b')]({'where':{'id':_0x461d7c[_0xdf53('0x42')]['id']}})[_0xdf53('0x24')](handleEntityNotFound(_0x3536fa,null))['then'](removeEntity(_0x3536fa,null))[_0xdf53('0x40')](handleError(_0x3536fa,null));};exports[_0xdf53('0x4c')]=function(_0x44de3b,_0x2e2dae){return db[_0xdf53('0x2b')]['describe']()[_0xdf53('0x24')](respondWithResult(_0x2e2dae,null))[_0xdf53('0x40')](handleError(_0x2e2dae,null));};exports[_0xdf53('0x4d')]=function(_0x249bb8,_0x2021f3,_0x31d5c2){return db[_0xdf53('0x4e')][_0xdf53('0x4b')]({'where':{'id':_0x249bb8[_0xdf53('0x42')]['id']}})['then'](handleEntityNotFound(_0x2021f3,null))['then'](function(_0x2eb1d3){if(_0x2eb1d3){return _0x2eb1d3[_0xdf53('0x4d')](_0x249bb8['body']['ids'],_[_0xdf53('0x4f')](_0x249bb8[_0xdf53('0x45')],[_0xdf53('0x50'),'id'])||{});}})['then'](respondWithResult(_0x2021f3,null))[_0xdf53('0x40')](handleError(_0x2021f3,null));};exports[_0xdf53('0x51')]=function(_0x1a36cc,_0x29443c,_0x5628ea){var _0x2945fb={};var _0x3101b9={};var _0x1353f8;var _0x6fd5e2;return db[_0xdf53('0x2b')][_0xdf53('0x52')]({'where':{'id':_0x1a36cc[_0xdf53('0x42')]['id']}})[_0xdf53('0x24')](handleEntityNotFound(_0x29443c,null))['then'](function(_0x4ca06f){if(_0x4ca06f){_0x1353f8=_0x4ca06f;_0x3101b9[_0xdf53('0x2f')]=_['keys'](db[_0xdf53('0x4e')][_0xdf53('0x53')]);_0x3101b9[_0xdf53('0x2d')]=_['keys'](_0x1a36cc[_0xdf53('0x2d')]);_0x3101b9[_0xdf53('0x43')]=_[_0xdf53('0x2e')](_0x3101b9[_0xdf53('0x2f')],_0x3101b9[_0xdf53('0x2d')]);_0x2945fb['attributes']=_[_0xdf53('0x2e')](_0x3101b9[_0xdf53('0x2f')],qs[_0xdf53('0x31')](_0x1a36cc[_0xdf53('0x2d')]['fields']));_0x2945fb[_0xdf53('0x30')]=_0x2945fb[_0xdf53('0x30')][_0xdf53('0x32')]?_0x2945fb[_0xdf53('0x30')]:_0x3101b9[_0xdf53('0x2f')];_0x2945fb['order']=qs['sort'](_0x1a36cc[_0xdf53('0x2d')][_0xdf53('0x36')]);_0x2945fb[_0xdf53('0x37')]=qs['filters'](_['pick'](_0x1a36cc[_0xdf53('0x2d')],_0x3101b9['filters']));if(_0x1a36cc[_0xdf53('0x2d')][_0xdf53('0x3b')]){_0x2945fb['where']=_[_0xdf53('0x39')](_0x2945fb[_0xdf53('0x37')],{'$or':_[_0xdf53('0x3a')](_0x2945fb[_0xdf53('0x30')],function(_0x3bac6e){var _0x116cbc={};_0x116cbc[_0x3bac6e]={'$like':'%'+_0x1a36cc[_0xdf53('0x2d')][_0xdf53('0x3b')]+'%'};return _0x116cbc;})});}_0x2945fb=_['merge']({},_0x2945fb,_0x1a36cc[_0xdf53('0x3c')]);return _0x1353f8['getContacts'](_0x2945fb);}})['then'](function(_0x5d299e){if(_0x5d299e){_0x6fd5e2=_0x5d299e[_0xdf53('0x32')];if(!_0x1a36cc[_0xdf53('0x2d')][_0xdf53('0x33')](_0xdf53('0x34'))){_0x2945fb['limit']=qs[_0xdf53('0x1c')](_0x1a36cc[_0xdf53('0x2d')][_0xdf53('0x1c')]);_0x2945fb[_0xdf53('0x35')]=qs[_0xdf53('0x35')](_0x1a36cc[_0xdf53('0x2d')][_0xdf53('0x35')]);}return _0x1353f8['getContacts'](_0x2945fb);}})[_0xdf53('0x24')](function(_0x579589){if(_0x579589){return _0x579589?{'count':_0x6fd5e2,'rows':_0x579589}:null;}})['then'](respondWithResult(_0x29443c,null))['catch'](handleError(_0x29443c,null));}; \ No newline at end of file +var _0xbf72=['../../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','Content-Range','update','then','Companies','UserProfileResource','destroy','name','send','describe','keys','query','filters','intersection','model','attributes','fields','nolimit','order','sort','pick','where','map','merge','CmCompany','include','catch','show','params','includeAll','options','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addContacts','omit','ids','getContacts','findOne','length','filter','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x18abd2,_0x22d4b3){var _0x1dcad6=function(_0xcc08c4){while(--_0xcc08c4){_0x18abd2['push'](_0x18abd2['shift']());}};_0x1dcad6(++_0x22d4b3);}(_0xbf72,0x143));var _0x2bf7=function(_0x3eafa0,_0x418fc6){_0x3eafa0=_0x3eafa0-0x0;var _0x3fdabc=_0xbf72[_0x3eafa0];return _0x3fdabc;};'use strict';var emlformat=require(_0x2bf7('0x0'));var rimraf=require(_0x2bf7('0x1'));var zipdir=require(_0x2bf7('0x2'));var jsonpatch=require(_0x2bf7('0x3'));var rp=require(_0x2bf7('0x4'));var moment=require(_0x2bf7('0x5'));var BPromise=require(_0x2bf7('0x6'));var Mustache=require(_0x2bf7('0x7'));var util=require(_0x2bf7('0x8'));var path=require(_0x2bf7('0x9'));var sox=require(_0x2bf7('0xa'));var csv=require(_0x2bf7('0xb'));var ejs=require(_0x2bf7('0xc'));var fs=require('fs');var fs_extra=require(_0x2bf7('0xd'));var _=require(_0x2bf7('0xe'));var squel=require(_0x2bf7('0xf'));var crypto=require('crypto');var jsforce=require(_0x2bf7('0x10'));var deskjs=require(_0x2bf7('0x11'));var toCsv=require(_0x2bf7('0xb'));var querystring=require(_0x2bf7('0x12'));var Papa=require(_0x2bf7('0x13'));var Redis=require(_0x2bf7('0x14'));var authService=require(_0x2bf7('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x2bf7('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2bf7('0x17'))(_0x2bf7('0x18'));var utils=require(_0x2bf7('0x19'));var config=require(_0x2bf7('0x1a'));var licenseUtil=require(_0x2bf7('0x1b'));var db=require(_0x2bf7('0x1c'))['db'];function respondWithStatusCode(_0x29be65,_0x46e2e5){_0x46e2e5=_0x46e2e5||0xcc;return function(_0x1938d0){if(_0x1938d0){return _0x29be65[_0x2bf7('0x1d')](_0x46e2e5);}return _0x29be65[_0x2bf7('0x1e')](_0x46e2e5)[_0x2bf7('0x1f')]();};}function respondWithResult(_0xcb2982,_0x344357){_0x344357=_0x344357||0xc8;return function(_0x289de5){if(_0x289de5){return _0xcb2982[_0x2bf7('0x1e')](_0x344357)[_0x2bf7('0x20')](_0x289de5);}};}function respondWithFilteredResult(_0x3c1f23,_0x482d4f){return function(_0x1f0476){if(_0x1f0476){var _0x239743=typeof _0x482d4f[_0x2bf7('0x21')]===_0x2bf7('0x22')&&typeof _0x482d4f[_0x2bf7('0x23')]===_0x2bf7('0x22');var _0x5c8211=_0x1f0476['count'];var _0x371229=_0x239743?0x0:_0x482d4f[_0x2bf7('0x21')];var _0x134c4d=_0x239743?_0x1f0476[_0x2bf7('0x24')]:_0x482d4f[_0x2bf7('0x21')]+_0x482d4f[_0x2bf7('0x23')];var _0x502424;if(_0x134c4d>=_0x5c8211){_0x134c4d=_0x5c8211;_0x502424=0xc8;}else{_0x502424=0xce;}_0x3c1f23['status'](_0x502424);return _0x3c1f23[_0x2bf7('0x25')](_0x2bf7('0x26'),_0x371229+'-'+_0x134c4d+'/'+_0x5c8211)[_0x2bf7('0x20')](_0x1f0476);}return null;};}function patchUpdates(_0x4367ef){return function(_0x2e396b){try{jsonpatch['apply'](_0x2e396b,_0x4367ef,!![]);}catch(_0xdc9cff){return BPromise['reject'](_0xdc9cff);}return _0x2e396b['save']();};}function saveUpdates(_0xc5ee25,_0x51cd21){return function(_0x63531f){if(_0x63531f){return _0x63531f[_0x2bf7('0x27')](_0xc5ee25)[_0x2bf7('0x28')](function(_0x244382){return _0x244382;});}return null;};}function removeEntity(_0x147e84,_0x464e2a){return function(_0x40babd){if(_0x40babd){return _0x40babd['destroy']()[_0x2bf7('0x28')](function(){var _0x359b22=_0x40babd['get']({'plain':!![]});var _0x5031a1=_0x2bf7('0x29');return db[_0x2bf7('0x2a')][_0x2bf7('0x2b')]({'where':{'type':_0x5031a1,'resourceId':_0x359b22['id']}})[_0x2bf7('0x28')](function(){return _0x40babd;});})[_0x2bf7('0x28')](function(){_0x147e84[_0x2bf7('0x1e')](0xcc)[_0x2bf7('0x1f')]();});}};}function handleEntityNotFound(_0x46f97f,_0x51b5ad){return function(_0x4d0399){if(!_0x4d0399){_0x46f97f[_0x2bf7('0x1d')](0x194);}return _0x4d0399;};}function handleError(_0x37456a,_0x336662){_0x336662=_0x336662||0x1f4;return function(_0x24d8e1){logger['error'](_0x24d8e1['stack']);if(_0x24d8e1[_0x2bf7('0x2c')]){delete _0x24d8e1[_0x2bf7('0x2c')];}_0x37456a[_0x2bf7('0x1e')](_0x336662)[_0x2bf7('0x2d')](_0x24d8e1);};}exports['index']=function(_0x60bdec,_0x16336a){var _0x4d6317={},_0x54f98a={},_0x3e3234={'count':0x0,'rows':[]};return db['CmCompany'][_0x2bf7('0x2e')]()[_0x2bf7('0x28')](function(_0x5a3101){_0x54f98a['model']=_[_0x2bf7('0x2f')](_0x5a3101);_0x54f98a[_0x2bf7('0x30')]=_[_0x2bf7('0x2f')](_0x60bdec['query']);_0x54f98a[_0x2bf7('0x31')]=_[_0x2bf7('0x32')](_0x54f98a[_0x2bf7('0x33')],_0x54f98a[_0x2bf7('0x30')]);_0x4d6317[_0x2bf7('0x34')]=_[_0x2bf7('0x32')](_0x54f98a['model'],qs['fields'](_0x60bdec[_0x2bf7('0x30')][_0x2bf7('0x35')]));_0x4d6317['attributes']=_0x4d6317[_0x2bf7('0x34')]['length']?_0x4d6317[_0x2bf7('0x34')]:_0x54f98a[_0x2bf7('0x33')];if(!_0x60bdec[_0x2bf7('0x30')]['hasOwnProperty'](_0x2bf7('0x36'))){_0x4d6317['limit']=qs[_0x2bf7('0x23')](_0x60bdec['query'][_0x2bf7('0x23')]);_0x4d6317[_0x2bf7('0x21')]=qs[_0x2bf7('0x21')](_0x60bdec[_0x2bf7('0x30')][_0x2bf7('0x21')]);}_0x4d6317[_0x2bf7('0x37')]=qs[_0x2bf7('0x38')](_0x60bdec[_0x2bf7('0x30')]['sort']);_0x4d6317['where']=qs[_0x2bf7('0x31')](_[_0x2bf7('0x39')](_0x60bdec['query'],_0x54f98a[_0x2bf7('0x31')]),_0x5a3101);if(_0x60bdec[_0x2bf7('0x30')]['filter']){_0x4d6317[_0x2bf7('0x3a')]=_['merge'](_0x4d6317[_0x2bf7('0x3a')],{'$or':_[_0x2bf7('0x3b')](_0x4d6317['attributes'],function(_0x3f6e1e){var _0x547bbc={};_0x547bbc[_0x3f6e1e]={'$like':'%'+_0x60bdec[_0x2bf7('0x30')]['filter']+'%'};return _0x547bbc;})});}_0x4d6317=_[_0x2bf7('0x3c')]({},_0x4d6317,_0x60bdec['options']);var _0x443485={'where':_0x4d6317[_0x2bf7('0x3a')]};return db[_0x2bf7('0x3d')]['count'](_0x443485)[_0x2bf7('0x28')](function(_0x4a7b60){_0x3e3234[_0x2bf7('0x24')]=_0x4a7b60;if(_0x60bdec[_0x2bf7('0x30')]['includeAll']){_0x4d6317[_0x2bf7('0x3e')]=[{'all':!![]}];}return db[_0x2bf7('0x3d')]['findAll'](_0x4d6317);})[_0x2bf7('0x28')](function(_0x220769){_0x3e3234['rows']=_0x220769;return _0x3e3234;})[_0x2bf7('0x28')](respondWithFilteredResult(_0x16336a,_0x4d6317))['catch'](handleError(_0x16336a,null));})[_0x2bf7('0x3f')](handleError(_0x16336a,null));};exports[_0x2bf7('0x40')]=function(_0x2569c3,_0x4b5dc3){var _0x145d91={'raw':![],'where':{'id':_0x2569c3[_0x2bf7('0x41')]['id']}},_0x2d22d5={};_0x2d22d5[_0x2bf7('0x33')]=_['keys'](db['CmCompany']['rawAttributes']);_0x2d22d5[_0x2bf7('0x30')]=_[_0x2bf7('0x2f')](_0x2569c3[_0x2bf7('0x30')]);_0x2d22d5[_0x2bf7('0x31')]=_[_0x2bf7('0x32')](_0x2d22d5['model'],_0x2d22d5[_0x2bf7('0x30')]);_0x145d91[_0x2bf7('0x34')]=_[_0x2bf7('0x32')](_0x2d22d5[_0x2bf7('0x33')],qs[_0x2bf7('0x35')](_0x2569c3['query']['fields']));_0x145d91['attributes']=_0x145d91['attributes']['length']?_0x145d91[_0x2bf7('0x34')]:_0x2d22d5[_0x2bf7('0x33')];if(_0x2569c3[_0x2bf7('0x30')][_0x2bf7('0x42')]){_0x145d91[_0x2bf7('0x3e')]=[{'all':!![]}];}_0x145d91=_[_0x2bf7('0x3c')]({},_0x145d91,_0x2569c3[_0x2bf7('0x43')]);return db[_0x2bf7('0x3d')][_0x2bf7('0x44')](_0x145d91)['then'](handleEntityNotFound(_0x4b5dc3,null))[_0x2bf7('0x28')](respondWithResult(_0x4b5dc3,null))[_0x2bf7('0x3f')](handleError(_0x4b5dc3,null));};exports[_0x2bf7('0x45')]=function(_0x5ea010,_0x2dd445){return db[_0x2bf7('0x3d')][_0x2bf7('0x45')](_0x5ea010['body'],{})[_0x2bf7('0x28')](function(_0x4bacef){var _0x2ea477=_0x5ea010[_0x2bf7('0x46')]['get']({'plain':!![]});if(!_0x2ea477)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ea477[_0x2bf7('0x47')]===_0x2bf7('0x46')){var _0x50f216=_0x4bacef['get']({'plain':!![]});var _0x4a4525=_0x2bf7('0x29');return db[_0x2bf7('0x48')]['find']({'where':{'name':_0x4a4525,'userProfileId':_0x2ea477[_0x2bf7('0x49')]},'raw':!![]})[_0x2bf7('0x28')](function(_0x17e6c1){if(_0x17e6c1&&_0x17e6c1[_0x2bf7('0x4a')]===0x0){return db[_0x2bf7('0x2a')][_0x2bf7('0x45')]({'name':_0x50f216[_0x2bf7('0x2c')],'resourceId':_0x50f216['id'],'type':_0x17e6c1[_0x2bf7('0x2c')],'sectionId':_0x17e6c1['id']},{})[_0x2bf7('0x28')](function(){return _0x4bacef;});}else{return _0x4bacef;}})[_0x2bf7('0x3f')](function(_0x3fdb5b){logger[_0x2bf7('0x4b')](_0x2bf7('0x4c'),_0x3fdb5b);throw _0x3fdb5b;});}return _0x4bacef;})[_0x2bf7('0x28')](respondWithResult(_0x2dd445,0xc9))[_0x2bf7('0x3f')](handleError(_0x2dd445,null));};exports[_0x2bf7('0x27')]=function(_0x355b4c,_0x513872){if(_0x355b4c['body']['id']){delete _0x355b4c[_0x2bf7('0x4d')]['id'];}return db['CmCompany'][_0x2bf7('0x44')]({'where':{'id':_0x355b4c['params']['id']}})[_0x2bf7('0x28')](handleEntityNotFound(_0x513872,null))[_0x2bf7('0x28')](saveUpdates(_0x355b4c[_0x2bf7('0x4d')],null))[_0x2bf7('0x28')](respondWithResult(_0x513872,null))[_0x2bf7('0x3f')](handleError(_0x513872,null));};exports[_0x2bf7('0x2b')]=function(_0x2e159e,_0x5a8943){return db['CmCompany'][_0x2bf7('0x44')]({'where':{'id':_0x2e159e[_0x2bf7('0x41')]['id']}})['then'](handleEntityNotFound(_0x5a8943,null))[_0x2bf7('0x28')](removeEntity(_0x5a8943,null))[_0x2bf7('0x3f')](handleError(_0x5a8943,null));};exports[_0x2bf7('0x2e')]=function(_0x413ea8,_0x3b31aa){return db['CmCompany'][_0x2bf7('0x2e')]()[_0x2bf7('0x28')](respondWithResult(_0x3b31aa,null))['catch'](handleError(_0x3b31aa,null));};exports['addContacts']=function(_0x1f264d,_0x4185b5,_0x48d189){return db['CmContact'][_0x2bf7('0x44')]({'where':{'id':_0x1f264d[_0x2bf7('0x41')]['id']}})[_0x2bf7('0x28')](handleEntityNotFound(_0x4185b5,null))[_0x2bf7('0x28')](function(_0x3d7811){if(_0x3d7811){return _0x3d7811[_0x2bf7('0x4e')](_0x1f264d['body']['ids'],_[_0x2bf7('0x4f')](_0x1f264d[_0x2bf7('0x4d')],[_0x2bf7('0x50'),'id'])||{});}})['then'](respondWithResult(_0x4185b5,null))['catch'](handleError(_0x4185b5,null));};exports[_0x2bf7('0x51')]=function(_0x2e6738,_0x36c82b,_0xd3b6ab){var _0x3e5e2b={};var _0x324955={};var _0x3877f2;var _0x801a12;return db[_0x2bf7('0x3d')][_0x2bf7('0x52')]({'where':{'id':_0x2e6738[_0x2bf7('0x41')]['id']}})[_0x2bf7('0x28')](handleEntityNotFound(_0x36c82b,null))[_0x2bf7('0x28')](function(_0x196ce0){if(_0x196ce0){_0x3877f2=_0x196ce0;_0x324955[_0x2bf7('0x33')]=_[_0x2bf7('0x2f')](db['CmContact']['rawAttributes']);_0x324955[_0x2bf7('0x30')]=_[_0x2bf7('0x2f')](_0x2e6738[_0x2bf7('0x30')]);_0x324955[_0x2bf7('0x31')]=_[_0x2bf7('0x32')](_0x324955['model'],_0x324955[_0x2bf7('0x30')]);_0x3e5e2b['attributes']=_[_0x2bf7('0x32')](_0x324955[_0x2bf7('0x33')],qs['fields'](_0x2e6738[_0x2bf7('0x30')][_0x2bf7('0x35')]));_0x3e5e2b[_0x2bf7('0x34')]=_0x3e5e2b[_0x2bf7('0x34')][_0x2bf7('0x53')]?_0x3e5e2b[_0x2bf7('0x34')]:_0x324955['model'];_0x3e5e2b['order']=qs[_0x2bf7('0x38')](_0x2e6738[_0x2bf7('0x30')][_0x2bf7('0x38')]);_0x3e5e2b[_0x2bf7('0x3a')]=qs['filters'](_[_0x2bf7('0x39')](_0x2e6738[_0x2bf7('0x30')],_0x324955[_0x2bf7('0x31')]));if(_0x2e6738['query'][_0x2bf7('0x54')]){_0x3e5e2b[_0x2bf7('0x3a')]=_[_0x2bf7('0x3c')](_0x3e5e2b['where'],{'$or':_[_0x2bf7('0x3b')](_0x3e5e2b[_0x2bf7('0x34')],function(_0x428bb){var _0x1cd9cb={};_0x1cd9cb[_0x428bb]={'$like':'%'+_0x2e6738[_0x2bf7('0x30')][_0x2bf7('0x54')]+'%'};return _0x1cd9cb;})});}_0x3e5e2b=_[_0x2bf7('0x3c')]({},_0x3e5e2b,_0x2e6738['options']);return _0x3877f2[_0x2bf7('0x51')](_0x3e5e2b);}})[_0x2bf7('0x28')](function(_0x1c6fea){if(_0x1c6fea){_0x801a12=_0x1c6fea[_0x2bf7('0x53')];if(!_0x2e6738[_0x2bf7('0x30')][_0x2bf7('0x55')]('nolimit')){_0x3e5e2b[_0x2bf7('0x23')]=qs[_0x2bf7('0x23')](_0x2e6738[_0x2bf7('0x30')][_0x2bf7('0x23')]);_0x3e5e2b[_0x2bf7('0x21')]=qs[_0x2bf7('0x21')](_0x2e6738[_0x2bf7('0x30')][_0x2bf7('0x21')]);}return _0x3877f2[_0x2bf7('0x51')](_0x3e5e2b);}})[_0x2bf7('0x28')](function(_0x37d9f0){if(_0x37d9f0){return _0x37d9f0?{'count':_0x801a12,'rows':_0x37d9f0}:null;}})['then'](respondWithResult(_0x36c82b,null))[_0x2bf7('0x3f')](handleError(_0x36c82b,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 47d7512..303a7f8 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 _0x0ab1=['bluebird','request-promise','path','./cmCompany.attributes','exports','define','util','../../config/logger','api','moment'];(function(_0x3339e0,_0x47ff5c){var _0x21072e=function(_0x531cd8){while(--_0x531cd8){_0x3339e0['push'](_0x3339e0['shift']());}};_0x21072e(++_0x47ff5c);}(_0x0ab1,0xce));var _0x10ab=function(_0x16cf7d,_0x54bc4e){_0x16cf7d=_0x16cf7d-0x0;var _0x3ad54d=_0x0ab1[_0x16cf7d];return _0x3ad54d;};'use strict';var _=require('lodash');var util=require(_0x10ab('0x0'));var logger=require(_0x10ab('0x1'))(_0x10ab('0x2'));var moment=require(_0x10ab('0x3'));var BPromise=require(_0x10ab('0x4'));var rp=require(_0x10ab('0x5'));var fs=require('fs');var path=require(_0x10ab('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x10ab('0x7'));module[_0x10ab('0x8')]=function(_0x503d22,_0x936db1){return _0x503d22[_0x10ab('0x9')]('CmCompany',attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2766=['exports','define','CmCompany','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./cmCompany.attributes'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x2766,0x7b));var _0x6276=function(_0x18e89d,_0x4814fe){_0x18e89d=_0x18e89d-0x0;var _0x1aea52=_0x2766[_0x18e89d];return _0x1aea52;};'use strict';var _=require(_0x6276('0x0'));var util=require(_0x6276('0x1'));var logger=require(_0x6276('0x2'))(_0x6276('0x3'));var moment=require(_0x6276('0x4'));var BPromise=require('bluebird');var rp=require(_0x6276('0x5'));var fs=require('fs');var path=require(_0x6276('0x6'));var rimraf=require(_0x6276('0x7'));var config=require('../../config/environment');var attributes=require(_0x6276('0x8'));module[_0x6276('0x9')]=function(_0x6b9476,_0x49f895){return _0x6b9476[_0x6276('0xa')](_0x6276('0xb'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index b2ba8de..befe8d8 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 _0x8bca=['../../config/environment','client','http','info','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x57f8c0,_0x136cf6){var _0x117f08=function(_0x426cd4){while(--_0x426cd4){_0x57f8c0['push'](_0x57f8c0['shift']());}};_0x117f08(++_0x136cf6);}(_0x8bca,0x1d4));var _0xa8bc=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x8bca[_0x411017];return _0x2adeea;};'use strict';var _=require(_0xa8bc('0x0'));var util=require(_0xa8bc('0x1'));var moment=require('moment');var BPromise=require(_0xa8bc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa8bc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa8bc('0x4'));var logger=require(_0xa8bc('0x5'))(_0xa8bc('0x6'));var config=require(_0xa8bc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa8bc('0x8')][_0xa8bc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fe760,_0xc82c1a,_0x47c36f){return new BPromise(function(_0x2f3ad0,_0x28e9ff){return client['request'](_0x2fe760,_0x47c36f)['then'](function(_0x43d4a2){logger[_0xa8bc('0xa')](_0xa8bc('0xb'),_0xc82c1a,'request\x20sent');logger[_0xa8bc('0xc')](_0xa8bc('0xd'),_0xc82c1a,_0xa8bc('0xe'),JSON[_0xa8bc('0xf')](_0x43d4a2));if(_0x43d4a2[_0xa8bc('0x10')]){if(_0x43d4a2[_0xa8bc('0x10')][_0xa8bc('0x11')]===0x1f4){logger[_0xa8bc('0x10')](_0xa8bc('0xb'),_0xc82c1a,_0x43d4a2[_0xa8bc('0x10')][_0xa8bc('0x12')]);return _0x28e9ff(_0x43d4a2['error'][_0xa8bc('0x12')]);}logger['error']('CmCompany,\x20%s,\x20%s',_0xc82c1a,_0x43d4a2[_0xa8bc('0x10')][_0xa8bc('0x12')]);return _0x2f3ad0(_0x43d4a2[_0xa8bc('0x10')][_0xa8bc('0x12')]);}else{logger[_0xa8bc('0xa')](_0xa8bc('0xb'),_0xc82c1a,_0xa8bc('0xe'));_0x2f3ad0(_0x43d4a2['result'][_0xa8bc('0x12')]);}})['catch'](function(_0x4167d5){logger[_0xa8bc('0x10')](_0xa8bc('0xb'),_0xc82c1a,_0x4167d5);_0x28e9ff(_0x4167d5);});});} \ No newline at end of file +var _0xbded=['http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/environment','jayson/promise','client'];(function(_0x5c0839,_0x2feb7b){var _0x3a3fdb=function(_0x1d99d3){while(--_0x1d99d3){_0x5c0839['push'](_0x5c0839['shift']());}};_0x3a3fdb(++_0x2feb7b);}(_0xbded,0xa0));var _0xdbde=function(_0x31f22e,_0x434db1){_0x31f22e=_0x31f22e-0x0;var _0x16e1b0=_0xbded[_0x31f22e];return _0x16e1b0;};'use strict';var _=require(_0xdbde('0x0'));var util=require(_0xdbde('0x1'));var moment=require(_0xdbde('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdbde('0x3'));var db=require(_0xdbde('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xdbde('0x5'));var jayson=require(_0xdbde('0x6'));var client=jayson[_0xdbde('0x7')][_0xdbde('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x59b0d0,_0x90dd20,_0x34c877){return new BPromise(function(_0x51d368,_0x12e6e3){return client[_0xdbde('0x9')](_0x59b0d0,_0x34c877)[_0xdbde('0xa')](function(_0xf5333a){logger[_0xdbde('0xb')](_0xdbde('0xc'),_0x90dd20,_0xdbde('0xd'));logger[_0xdbde('0xe')](_0xdbde('0xf'),_0x90dd20,_0xdbde('0xd'),JSON[_0xdbde('0x10')](_0xf5333a));if(_0xf5333a[_0xdbde('0x11')]){if(_0xf5333a[_0xdbde('0x11')][_0xdbde('0x12')]===0x1f4){logger[_0xdbde('0x11')](_0xdbde('0xc'),_0x90dd20,_0xf5333a['error'][_0xdbde('0x13')]);return _0x12e6e3(_0xf5333a[_0xdbde('0x11')]['message']);}logger['error'](_0xdbde('0xc'),_0x90dd20,_0xf5333a[_0xdbde('0x11')][_0xdbde('0x13')]);return _0x51d368(_0xf5333a[_0xdbde('0x11')][_0xdbde('0x13')]);}else{logger['info'](_0xdbde('0xc'),_0x90dd20,_0xdbde('0xd'));_0x51d368(_0xf5333a['result']['message']);}})[_0xdbde('0x14')](function(_0x1fda3a){logger[_0xdbde('0x11')](_0xdbde('0xc'),_0x90dd20,_0x1fda3a);_0x12e6e3(_0x1fda3a);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index b5551ae..8a129f5 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 _0xcb03=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','show','/:id/contacts','getContacts','post','create','addContacts','/:id','destroy','exports','connect-timeout'];(function(_0x7327fb,_0x513747){var _0x51114b=function(_0x34edfd){while(--_0x34edfd){_0x7327fb['push'](_0x7327fb['shift']());}};_0x51114b(++_0x513747);}(_0xcb03,0x19f));var _0x3cb0=function(_0x520584,_0x24af2b){_0x520584=_0x520584-0x0;var _0x57ab46=_0xcb03[_0x520584];return _0x57ab46;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x3cb0('0x0'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3cb0('0x1'));var interaction=require('../../components/interaction/service');var config=require(_0x3cb0('0x2'));var controller=require('./cmCompany.controller');router[_0x3cb0('0x3')]('/',auth[_0x3cb0('0x4')](),controller[_0x3cb0('0x5')]);router[_0x3cb0('0x3')]('/describe',auth[_0x3cb0('0x4')](),controller[_0x3cb0('0x6')]);router[_0x3cb0('0x3')]('/:id',auth['isAuthenticated'](),controller[_0x3cb0('0x7')]);router[_0x3cb0('0x3')](_0x3cb0('0x8'),auth[_0x3cb0('0x4')](),controller[_0x3cb0('0x9')]);router[_0x3cb0('0xa')]('/',auth[_0x3cb0('0x4')](),controller[_0x3cb0('0xb')]);router[_0x3cb0('0xa')](_0x3cb0('0x8'),auth[_0x3cb0('0x4')](),controller[_0x3cb0('0xc')]);router['put']('/:id',auth[_0x3cb0('0x4')](),controller['update']);router['delete'](_0x3cb0('0xd'),auth[_0x3cb0('0x4')](),controller[_0x3cb0('0xe')]);module[_0x3cb0('0xf')]=router; \ No newline at end of file +var _0xe22b=['put','/:id','update','delete','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','show','/:id/contacts','post','addContacts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe22b,0xe1));var _0xbe22=function(_0x4e22ba,_0x56671f){_0x4e22ba=_0x4e22ba-0x0;var _0x184397=_0xe22b[_0x4e22ba];return _0x184397;};'use strict';var multer=require(_0xbe22('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbe22('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbe22('0x2'));var auth=require(_0xbe22('0x3'));var interaction=require(_0xbe22('0x4'));var config=require('../../config/environment');var controller=require(_0xbe22('0x5'));router[_0xbe22('0x6')]('/',auth[_0xbe22('0x7')](),controller[_0xbe22('0x8')]);router[_0xbe22('0x6')](_0xbe22('0x9'),auth['isAuthenticated'](),controller[_0xbe22('0xa')]);router[_0xbe22('0x6')]('/:id',auth[_0xbe22('0x7')](),controller[_0xbe22('0xb')]);router[_0xbe22('0x6')](_0xbe22('0xc'),auth[_0xbe22('0x7')](),controller['getContacts']);router[_0xbe22('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbe22('0xd')](_0xbe22('0xc'),auth[_0xbe22('0x7')](),controller[_0xbe22('0xe')]);router[_0xbe22('0xf')](_0xbe22('0x10'),auth[_0xbe22('0x7')](),controller[_0xbe22('0x11')]);router[_0xbe22('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xbe22('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index d8b500a..625346e 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 _0xc628=['INTEGER','UNSIGNED','NOW','lodash','exports','STRING','TEXT'];(function(_0x4ce073,_0xe25c97){var _0x4be3b0=function(_0x23897f){while(--_0x23897f){_0x4ce073['push'](_0x4ce073['shift']());}};_0x4be3b0(++_0xe25c97);}(_0xc628,0x16f));var _0x8c62=function(_0x4660bb,_0x2c0c18){_0x4660bb=_0x4660bb-0x0;var _0x3cd016=_0xc628[_0x4660bb];return _0x3cd016;};'use strict';var _=require(_0x8c62('0x0'));var Sequelize=require('sequelize');module[_0x8c62('0x1')]={'firstName':{'type':Sequelize[_0x8c62('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x8c62('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x8c62('0x2')]},'city':{'type':Sequelize[_0x8c62('0x2')]},'country':{'type':Sequelize[_0x8c62('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8c62('0x3')]},'phone':{'type':Sequelize[_0x8c62('0x2')]},'mobile':{'type':Sequelize[_0x8c62('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x8c62('0x2')]},'url':{'type':Sequelize[_0x8c62('0x2')]},'facebook':{'type':Sequelize[_0x8c62('0x2')]},'fb_data':{'type':Sequelize[_0x8c62('0x2')]},'twitter':{'type':Sequelize[_0x8c62('0x2')]},'skype':{'type':Sequelize[_0x8c62('0x2')]},'teams':{'type':Sequelize[_0x8c62('0x2')]},'viber':{'type':Sequelize[_0x8c62('0x2')]},'line':{'type':Sequelize[_0x8c62('0x2')]},'wechat':{'type':Sequelize[_0x8c62('0x2')]},'telegram':{'type':Sequelize[_0x8c62('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0x8c62('0x4')](0x2)[_0x8c62('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x8c62('0x6')]}}; \ No newline at end of file +var _0x2098=['UNSIGNED','DATE','NOW','lodash','sequelize','STRING','TEXT','INTEGER'];(function(_0x3037d2,_0x564e58){var _0x5beb9b=function(_0x3b4bb9){while(--_0x3b4bb9){_0x3037d2['push'](_0x3037d2['shift']());}};_0x5beb9b(++_0x564e58);}(_0x2098,0x14b));var _0x8209=function(_0x264d71,_0x5dc4bd){_0x264d71=_0x264d71-0x0;var _0x520a66=_0x2098[_0x264d71];return _0x520a66;};'use strict';var _=require(_0x8209('0x0'));var Sequelize=require(_0x8209('0x1'));module['exports']={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x8209('0x2')]},'street':{'type':Sequelize[_0x8209('0x2')]},'postalCode':{'type':Sequelize[_0x8209('0x2')]},'city':{'type':Sequelize[_0x8209('0x2')]},'country':{'type':Sequelize[_0x8209('0x2')]},'dateOfBirth':{'type':Sequelize[_0x8209('0x2')]},'description':{'type':Sequelize[_0x8209('0x3')]},'phone':{'type':Sequelize[_0x8209('0x2')]},'mobile':{'type':Sequelize[_0x8209('0x2')]},'fax':{'type':Sequelize[_0x8209('0x2')]},'email':{'type':Sequelize[_0x8209('0x2')]},'url':{'type':Sequelize[_0x8209('0x2')]},'facebook':{'type':Sequelize[_0x8209('0x2')]},'fb_data':{'type':Sequelize[_0x8209('0x2')]},'twitter':{'type':Sequelize[_0x8209('0x2')]},'skype':{'type':Sequelize[_0x8209('0x2')]},'teams':{'type':Sequelize[_0x8209('0x2')]},'viber':{'type':Sequelize[_0x8209('0x2')]},'line':{'type':Sequelize[_0x8209('0x2')]},'wechat':{'type':Sequelize[_0x8209('0x2')]},'telegram':{'type':Sequelize[_0x8209('0x2')]},'UserId':{'type':Sequelize[_0x8209('0x4')]},'priority':{'type':Sequelize[_0x8209('0x4')](0x2)[_0x8209('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x8209('0x6')],'defaultValue':Sequelize[_0x8209('0x7')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 84cec66..a276f4b 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 _0xda00=['findOne','trimStart','cf_','fieldType','type','query','filters','model','attributes','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','tools_tags','from','left_join','uc.CmContactId\x20=\x20c.id','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','find','Tag','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','and','uc.UserId\x20=\x20?','value','dateOfBirth','DATE','text','start','filter','isNil','Contact','push','isEmpty','c.ListId\x20IN\x20?','\x20=\x20?','tag','isArray','replace','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','group','c.id','Sequelize','SELECT','DESC','having','t.id\x20IN\x20?','resolve','role','agent','user','c.ListId\x20IS\x20NULL','ListId','sequelize','toString','keyBy','merge','c.lastName','c.mobile','c.fax','c.email','c.ListId','c.deletedAt','c.CompanyId','TagIds','Tags','rows','catch','analytics','findAll','columnName','displayName','alias','values','body','get','mergeWith','tags','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','info','[CmContact][merge][destroy][CmHopper],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','SmsMessage','FaxInteraction','OpenchannelInteraction','CmHopperFinal','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','duplicates','$or','findOrCreate','spread','params','$and','format','omit','cf_%d','table','setFields','phone','rawAttributes','intersection','fields','getTags','setTags','ids','getHoppers','options','includeAll','include','getHopperHistories','CmHopperHistory','getHopperFinals','getJscriptySessions','ContactId','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','socket_timestamp','File\x20uploaded\x20correctly!','upload','parse','meta','import','binding','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','stringify','start\x20child\x20process\x20correctly!','pid','exit','error\x20child\x20process','getJourney','mail','chat','sms','openchannel','whatsapp','voice','channel','includes','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','source','destination','callerid','starttime','duration','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','findAndCountAll','startCase','Website','Account','closedAt','note','disposition','secondDisposition','key','customerIp','deviceModel','osName','ratingType','ratingValue','referer','subject','substatus','Interaction','Owner','all','flatten','sortBy','reverse','moment','bluebird','util','path','lodash','papaparse','../../config/logger','../../config/environment','defaults','localhost','register','status','json','offset','limit','undefined','count','set','Content-Range','then','destroy','end','sendStatus','stack','name','send','index','CmContact','describe','keys','length','CmCustomField'];(function(_0xeb9649,_0x2f78b2){var _0x2f9920=function(_0x7c1075){while(--_0x7c1075){_0xeb9649['push'](_0xeb9649['shift']());}};_0x2f9920(++_0x2f78b2);}(_0xda00,0xe4));var _0x0da0=function(_0x4199c,_0x19b12d){_0x4199c=_0x4199c-0x0;var _0x35fc0d=_0xda00[_0x4199c];return _0x35fc0d;};'use strict';var moment=require(_0x0da0('0x0'));var BPromise=require(_0x0da0('0x1'));var util=require(_0x0da0('0x2'));var path=require(_0x0da0('0x3'));var fs=require('fs');var _=require(_0x0da0('0x4'));var squel=require('squel');var Papa=require(_0x0da0('0x5'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var logger=require(_0x0da0('0x6'))('api');var config=require(_0x0da0('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0da0('0x8')](config['redis'],{'host':_0x0da0('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./cmContact.socket')[_0x0da0('0xa')](socket);function respondWithResult(_0x436f44,_0x19e3d0){_0x19e3d0=_0x19e3d0||0xc8;return function(_0x3d7707){if(_0x3d7707){return _0x436f44[_0x0da0('0xb')](_0x19e3d0)[_0x0da0('0xc')](_0x3d7707);}};}function respondWithFilteredResult(_0x378456,_0x414bf8){return function(_0x4fb8b6){if(_0x4fb8b6){var _0x2ca5d9=typeof _0x414bf8[_0x0da0('0xd')]==='undefined'&&typeof _0x414bf8[_0x0da0('0xe')]===_0x0da0('0xf');var _0x19250a=_0x4fb8b6[_0x0da0('0x10')];var _0x502b0a=_0x2ca5d9?0x0:_0x414bf8[_0x0da0('0xd')];var _0x3504b9=_0x2ca5d9?_0x4fb8b6[_0x0da0('0x10')]:_0x414bf8[_0x0da0('0xd')]+_0x414bf8[_0x0da0('0xe')];var _0x35836a;if(_0x3504b9>=_0x19250a){_0x3504b9=_0x19250a;_0x35836a=0xc8;}else{_0x35836a=0xce;}_0x378456[_0x0da0('0xb')](_0x35836a);return _0x378456[_0x0da0('0x11')](_0x0da0('0x12'),_0x502b0a+'-'+_0x3504b9+'/'+_0x19250a)['json'](_0x4fb8b6);}return null;};}function saveUpdates(_0x49dfde){return function(_0x437c16){if(_0x437c16){return _0x437c16['update'](_0x49dfde)[_0x0da0('0x13')](function(_0x3e9f79){return _0x3e9f79;});}return null;};}function removeEntity(_0x52c9d3){return function(_0x5d6e0c){if(_0x5d6e0c){return _0x5d6e0c[_0x0da0('0x14')]()['then'](function(){_0x52c9d3['status'](0xcc)[_0x0da0('0x15')]();});}};}function handleEntityNotFound(_0x3cd1e7){return function(_0x49b688){if(!_0x49b688){_0x3cd1e7[_0x0da0('0x16')](0x194);}return _0x49b688;};}function handleError(_0xa9fe67,_0x111035){_0x111035=_0x111035||0x1f4;return function(_0x27188d){logger['error'](_0x27188d[_0x0da0('0x17')]);if(_0x27188d[_0x0da0('0x18')]){delete _0x27188d['name'];}_0xa9fe67[_0x0da0('0xb')](_0x111035)[_0x0da0('0x19')](_0x27188d);};}exports[_0x0da0('0x1a')]=function(_0x1951b1,_0x411032){var _0x346fd3={},_0x426b4d={},_0x983639={'count':0x0,'rows':[]};return db[_0x0da0('0x1b')][_0x0da0('0x1c')]()[_0x0da0('0x13')](function(_0xb62124){var _0x13333c=[];for(var _0x940478=0x0;_0x9404780x1){_0x25b312['or'](_0x0da0('0x54'),qs['getFullTextValue'](_0x3cab92),null);}else{if(qs['isNumeric'](_0x3cab92)){_0x25b312['or'](_0x0da0('0x55'),_0x3cab92+'%');_0x25b312['or']('c.phone\x20LIKE\x20?',_0x3cab92+'%');_0x25b312['or'](_0x0da0('0x56'),_0x3cab92+'%');_0x25b312['or']('c.fax\x20LIKE\x20?',_0x3cab92+'%');}else if(qs[_0x0da0('0x57')](_0x3cab92)){_0x25b312['or'](_0x0da0('0x58'),_0x3cab92+'%');}else{_0x25b312['or'](_0x0da0('0x59'),'%'+_0x3cab92+'%');_0x25b312['or']('c.lastName\x20LIKE\x20?','%'+_0x3cab92+'%');_0x25b312['or'](_0x0da0('0x58'),'%'+_0x3cab92+'%');}}}}_0x7fb23d[_0x0da0('0x2d')](_0x25b312);_0x7fb23d[_0x0da0('0x5a')](_0x0da0('0x5b'));var _0x5e93ae={'type':db[_0x0da0('0x5c')]['QueryTypes'][_0x0da0('0x5d')],'raw':!![]};var _0x267524=_0x7fb23d['clone']()[_0x0da0('0x30')]('c.id');if(_0x346fd3['order']){_0x346fd3[_0x0da0('0x2b')][_0x0da0('0x3f')](function(_0x3eaac8){_0x7fb23d[_0x0da0('0x2b')]('c.'+_0x3eaac8[0x0],_0x3eaac8[0x1]===_0x0da0('0x5e')?![]:!![]);});}if(!_[_0x0da0('0x4d')](_0x3a5c59)){_0x7fb23d[_0x0da0('0x5f')](_0x3e99a5);_0x267524[_0x0da0('0x2d')](_0x0da0('0x60'),_0x3a5c59);}BPromise[_0x0da0('0x61')]()['then'](function(){if(!_0x295fb4)return;if(_0x1951b1['user'][_0x0da0('0x62')]!==_0x0da0('0x63'))return;if(!_['some'](_0x295fb4['conditions'],[_0x0da0('0x30'),_0x0da0('0x41')])){return _0x1951b1[_0x0da0('0x64')]['getLists']({'attributes':['id'],'raw':!![]})[_0x0da0('0x13')](function(_0x2fb7b9){if(_[_0x0da0('0x4d')](_0x2fb7b9)){_0x267524[_0x0da0('0x2d')]('c.ListId\x20IS\x20NULL');_0x7fb23d['where'](_0x0da0('0x65'));}else{_0x267524[_0x0da0('0x2d')]('c.ListId\x20IN\x20?',_['map'](_0x2fb7b9,'id'));_0x7fb23d[_0x0da0('0x2d')](_0x0da0('0x4e'),_[_0x0da0('0x3e')](_0x2fb7b9,'id'));}});}})[_0x0da0('0x13')](function(){if(_0x1951b1[_0x0da0('0x64')][_0x0da0('0x62')]===_0x0da0('0x63')&&!_0x295fb4&&!_0x1951b1['query'][_0x0da0('0x66')])return[];return db[_0x0da0('0x67')][_0x0da0('0x25')](_0x267524[_0x0da0('0x68')](),_0x5e93ae);})[_0x0da0('0x13')](function(_0x4c6f89){_0x983639[_0x0da0('0x10')]=_0x4c6f89[_0x0da0('0x1e')];if(_0x983639[_0x0da0('0x10')]===0x0)return[];return db[_0x0da0('0x67')][_0x0da0('0x25')](_0x1ec3ad[_0x0da0('0x68')](),_0x5e93ae)[_0x0da0('0x13')](function(_0x546748){_0x1f5679=_[_0x0da0('0x69')](_0x546748,'id');_0x5e93ae=_[_0x0da0('0x6a')](_0x5e93ae,{'model':db[_0x0da0('0x1b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1951b1['query']['fields']){_0x346fd3[_0x0da0('0x28')][_0x0da0('0x3f')](function(_0x384abc){_0x7fb23d[_0x0da0('0x30')]('c.'+_0x384abc);});}else{_0x7fb23d[_0x0da0('0x30')]('c.id');_0x7fb23d[_0x0da0('0x30')]('c.firstName');_0x7fb23d['field'](_0x0da0('0x6b'));_0x7fb23d[_0x0da0('0x30')]('c.phone');_0x7fb23d[_0x0da0('0x30')](_0x0da0('0x6c'));_0x7fb23d['field'](_0x0da0('0x6d'));_0x7fb23d[_0x0da0('0x30')](_0x0da0('0x6e'));_0x7fb23d[_0x0da0('0x30')](_0x0da0('0x6f'));_0x7fb23d[_0x0da0('0x30')]('c.createdAt');_0x7fb23d[_0x0da0('0x30')](_0x0da0('0x70'));_0x7fb23d[_0x0da0('0x30')](_0x0da0('0x71'));_0x7fb23d[_0x0da0('0x30')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x0da0('0x72'));}if(_0x346fd3[_0x0da0('0xe')])_0x7fb23d['limit'](_0x346fd3['limit']);if(_0x346fd3[_0x0da0('0xd')])_0x7fb23d[_0x0da0('0xd')](_0x346fd3['offset']);return db['sequelize'][_0x0da0('0x25')](_0x7fb23d[_0x0da0('0x68')](),_0x5e93ae);});})[_0x0da0('0x13')](function(_0x79b74){_0x79b74[_0x0da0('0x3f')](function(_0x318940){if(_0x318940[_0x0da0('0x72')]){_0x318940[_0x0da0('0x73')]=[];_0x318940[_0x0da0('0x72')][_0x0da0('0x53')](',')['forEach'](function(_0x1aafad){_0x318940['Tags']['push'](_0x1f5679[_0x1aafad]);});}delete _0x318940[_0x0da0('0x72')];});_0x983639[_0x0da0('0x74')]=_0x79b74;return _0x983639;})[_0x0da0('0x13')](respondWithFilteredResult(_0x411032,_0x346fd3));})[_0x0da0('0x75')](handleError(_0x411032,null));};exports[_0x0da0('0x14')]=function(_0x3f8757,_0x245cad){return db[_0x0da0('0x1b')][_0x0da0('0x3c')]({'where':{'id':_0x3f8757['params']['id']}})[_0x0da0('0x13')](handleEntityNotFound(_0x245cad,null))[_0x0da0('0x13')](removeEntity(_0x245cad,null))[_0x0da0('0x75')](handleError(_0x245cad,null));};exports[_0x0da0('0x1c')]=function(_0x22ae26,_0x4aea4c){return db['CmContact'][_0x0da0('0x1c')]()[_0x0da0('0x13')](function(_0x27df44){delete _0x27df44['tags'];for(var _0x5bcf67=0x0;_0x5bcf67=_0x36d0b3){_0x18299f=_0x36d0b3;_0x484720=0xc8;}else{_0x484720=0xce;}_0x3235a9[_0x3070('0xe')](_0x484720);return _0x3235a9[_0x3070('0x13')](_0x3070('0x14'),_0xbb6689+'-'+_0x18299f+'/'+_0x36d0b3)['json'](_0x186b40);}return null;};}function saveUpdates(_0x10a8fc){return function(_0x25934e){if(_0x25934e){return _0x25934e[_0x3070('0x15')](_0x10a8fc)[_0x3070('0x16')](function(_0x43564c){return _0x43564c;});}return null;};}function removeEntity(_0x6ec56b){return function(_0x166250){if(_0x166250){return _0x166250['destroy']()[_0x3070('0x16')](function(){_0x6ec56b[_0x3070('0xe')](0xcc)[_0x3070('0x17')]();});}};}function handleEntityNotFound(_0x2f29f9){return function(_0x1509ed){if(!_0x1509ed){_0x2f29f9[_0x3070('0x18')](0x194);}return _0x1509ed;};}function handleError(_0x419ad7,_0x182197){_0x182197=_0x182197||0x1f4;return function(_0x3c8b7c){logger[_0x3070('0x19')](_0x3c8b7c[_0x3070('0x1a')]);if(_0x3c8b7c['name']){delete _0x3c8b7c[_0x3070('0x1b')];}_0x419ad7['status'](_0x182197)[_0x3070('0x1c')](_0x3c8b7c);};}exports[_0x3070('0x1d')]=function(_0x438a60,_0x3296ee){var _0x1329e3={},_0x5bdb51={},_0xb68a8={'count':0x0,'rows':[]};return db[_0x3070('0x1e')][_0x3070('0x1f')]()[_0x3070('0x16')](function(_0x12fe15){var _0x168c87=[];for(var _0x35dce4=0x0;_0x35dce40x1){_0x588eea['or'](_0x3070('0x5a'),qs[_0x3070('0x5b')](_0x21d72a),null);}else{if(qs[_0x3070('0x5c')](_0x21d72a)){_0x588eea['or']('c.id\x20LIKE\x20?',_0x21d72a+'%');_0x588eea['or'](_0x3070('0x5d'),_0x21d72a+'%');_0x588eea['or'](_0x3070('0x5e'),_0x21d72a+'%');_0x588eea['or'](_0x3070('0x5f'),_0x21d72a+'%');}else if(qs['isEmail'](_0x21d72a)){_0x588eea['or'](_0x3070('0x60'),_0x21d72a+'%');}else{_0x588eea['or'](_0x3070('0x61'),'%'+_0x21d72a+'%');_0x588eea['or'](_0x3070('0x62'),'%'+_0x21d72a+'%');_0x588eea['or'](_0x3070('0x60'),'%'+_0x21d72a+'%');}}}}_0x22b0e9[_0x3070('0x32')](_0x588eea);_0x22b0e9[_0x3070('0x63')]('c.id');var _0x2608b0={'type':db[_0x3070('0x64')][_0x3070('0x65')][_0x3070('0x66')],'raw':!![]};var _0xd822b5=_0x22b0e9[_0x3070('0x67')]()[_0x3070('0x35')](_0x3070('0x68'));if(_0x1329e3['order']){_0x1329e3[_0x3070('0x30')][_0x3070('0x45')](function(_0xe82140){_0x22b0e9['order']('c.'+_0xe82140[0x0],_0xe82140[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x58e702)){_0x22b0e9[_0x3070('0x69')](_0x18b9a0);_0xd822b5['where'](_0x3070('0x6a'),_0x58e702);}BPromise[_0x3070('0x6b')]()[_0x3070('0x16')](function(){if(!_0x54e430)return;if(_0x438a60['user'][_0x3070('0x6c')]!=='agent')return;if(!_['some'](_0x54e430['conditions'],['field',_0x3070('0x6d')])){return _0x438a60[_0x3070('0x6e')]['getLists']({'attributes':['id'],'raw':!![]})[_0x3070('0x16')](function(_0x2483a2){if(_[_0x3070('0x6f')](_0x2483a2)){_0xd822b5[_0x3070('0x32')](_0x3070('0x70'));_0x22b0e9[_0x3070('0x32')](_0x3070('0x70'));}else{_0xd822b5['where'](_0x3070('0x71'),_[_0x3070('0x44')](_0x2483a2,'id'));_0x22b0e9[_0x3070('0x32')](_0x3070('0x71'),_[_0x3070('0x44')](_0x2483a2,'id'));}});}})[_0x3070('0x16')](function(){if(_0x438a60[_0x3070('0x6e')][_0x3070('0x6c')]===_0x3070('0x72')&&!_0x54e430&&!_0x438a60[_0x3070('0x29')]['ListId'])return[];return db[_0x3070('0x73')]['query'](_0xd822b5['toString'](),_0x2608b0);})[_0x3070('0x16')](function(_0xac5e51){_0xb68a8[_0x3070('0x12')]=_0xac5e51[_0x3070('0x20')];if(_0xb68a8['count']===0x0)return[];return db[_0x3070('0x73')][_0x3070('0x29')](_0x2a8a2d['toString'](),_0x2608b0)[_0x3070('0x16')](function(_0x1f647e){_0x2792e1=_[_0x3070('0x74')](_0x1f647e,'id');_0x2608b0=_['merge'](_0x2608b0,{'model':db[_0x3070('0x1e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x438a60[_0x3070('0x29')]['fields']){_0x1329e3[_0x3070('0x2d')]['forEach'](function(_0x4a9068){_0x22b0e9['field']('c.'+_0x4a9068);});}else{_0x22b0e9[_0x3070('0x35')](_0x3070('0x68'));_0x22b0e9[_0x3070('0x35')](_0x3070('0x75'));_0x22b0e9[_0x3070('0x35')](_0x3070('0x76'));_0x22b0e9[_0x3070('0x35')]('c.phone');_0x22b0e9['field']('c.mobile');_0x22b0e9[_0x3070('0x35')](_0x3070('0x77'));_0x22b0e9[_0x3070('0x35')](_0x3070('0x78'));_0x22b0e9[_0x3070('0x35')](_0x3070('0x79'));_0x22b0e9[_0x3070('0x35')]('c.createdAt');_0x22b0e9[_0x3070('0x35')](_0x3070('0x7a'));_0x22b0e9[_0x3070('0x35')]('c.CompanyId');_0x22b0e9[_0x3070('0x35')](_0x3070('0x7b'),_0x3070('0x7c'));}if(_0x1329e3[_0x3070('0xf')])_0x22b0e9[_0x3070('0xf')](_0x1329e3[_0x3070('0xf')]);if(_0x1329e3[_0x3070('0x11')])_0x22b0e9[_0x3070('0x11')](_0x1329e3['offset']);return db[_0x3070('0x73')][_0x3070('0x29')](_0x22b0e9[_0x3070('0x7d')](),_0x2608b0);});})['then'](function(_0x597cca){_0x597cca['forEach'](function(_0x4a9cbf){if(_0x4a9cbf[_0x3070('0x7c')]){_0x4a9cbf[_0x3070('0x7e')]=[];_0x4a9cbf[_0x3070('0x7c')][_0x3070('0x59')](',')[_0x3070('0x45')](function(_0x1b2d1e){_0x4a9cbf['Tags'][_0x3070('0x24')](_0x2792e1[_0x1b2d1e]);});}delete _0x4a9cbf[_0x3070('0x7c')];});_0xb68a8['rows']=_0x597cca;return _0xb68a8;})[_0x3070('0x16')](respondWithFilteredResult(_0x3296ee,_0x1329e3));})[_0x3070('0x7f')](handleError(_0x3296ee,null));};exports['destroy']=function(_0x51e65e,_0x10f3f8){return db[_0x3070('0x1e')][_0x3070('0x42')]({'where':{'id':_0x51e65e[_0x3070('0x80')]['id']}})[_0x3070('0x16')](handleEntityNotFound(_0x10f3f8,null))[_0x3070('0x16')](removeEntity(_0x10f3f8,null))[_0x3070('0x7f')](handleError(_0x10f3f8,null));};exports[_0x3070('0x1f')]=function(_0x17d5e7,_0xafed7a){return db[_0x3070('0x1e')]['describe']()['then'](function(_0x37a935){delete _0x37a935['tags'];for(var _0x48dec6=0x0;_0x48dec6{}\s\\|]/g,'-');_0x3afbff(null,util[_0xcaf4('0x20')](_0xcaf4('0x21'),path['basename'](_0xef5f59[_0xcaf4('0x1e')],path[_0xcaf4('0x22')](_0xef5f59[_0xcaf4('0x1e')])),Date['now'](),path[_0xcaf4('0x22')](_0xef5f59[_0xcaf4('0x1e')])));}})});router[_0xcaf4('0x16')](_0xcaf4('0x23'),upload[_0xcaf4('0x24')](_0xcaf4('0x25')),controller[_0xcaf4('0x26')]);var upload=multer({'storage':multer[_0xcaf4('0x1b')]({'destination':function(_0x2b7fb8,_0x27d664,_0x29bf49){_0x29bf49(null,path[_0xcaf4('0x27')](config[_0xcaf4('0x1c')],_0xcaf4('0x1d')));},'filename':function(_0x2f81ce,_0x469d66,_0x4d1609){_0x469d66[_0xcaf4('0x1e')]=_0x469d66[_0xcaf4('0x1e')][_0xcaf4('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4d1609(null,util[_0xcaf4('0x20')](_0xcaf4('0x21'),path['basename'](_0x469d66[_0xcaf4('0x1e')],path[_0xcaf4('0x22')](_0x469d66['originalname'])),Date[_0xcaf4('0x28')](),path[_0xcaf4('0x22')](_0x469d66[_0xcaf4('0x1e')])));}})});router[_0xcaf4('0x16')](_0xcaf4('0x29'),upload['single']('file'),controller[_0xcaf4('0x2a')]);router[_0xcaf4('0x16')]('/upload/:id',auth[_0xcaf4('0x8')](),controller[_0xcaf4('0x2b')]);router[_0xcaf4('0x2c')]('/:id',auth[_0xcaf4('0x8')](),controller['update']);router[_0xcaf4('0x2d')](_0xcaf4('0xb'),auth['isAuthenticated'](),controller[_0xcaf4('0x2e')]);module['exports']=router; \ No newline at end of file +var _0xbed4=['basename','now','extname','/csv','single','file','uploadCsv','/upload','upload','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','describe','/:id','isAuthenticated','/:id/tags','/:id/hoppers','getHopperHistories','/:id/hopper_finals','getJscriptySessions','/:id/journey','post','merge','create','setTags','diskStorage','join','root','originalname','replace','format','%s-%s%s'];(function(_0x38b14f,_0xd08fa8){var _0x22a324=function(_0x4bbb05){while(--_0x4bbb05){_0x38b14f['push'](_0x38b14f['shift']());}};_0x22a324(++_0xd08fa8);}(_0xbed4,0x66));var _0x4bed=function(_0x45bd8c,_0x790aa){_0x45bd8c=_0x45bd8c-0x0;var _0x31412a=_0xbed4[_0x45bd8c];return _0x31412a;};'use strict';var multer=require('multer');var util=require(_0x4bed('0x0'));var path=require(_0x4bed('0x1'));var timeout=require(_0x4bed('0x2'));var express=require('express');var router=express[_0x4bed('0x3')]();var fs_extra=require(_0x4bed('0x4'));var auth=require(_0x4bed('0x5'));var interaction=require(_0x4bed('0x6'));var config=require(_0x4bed('0x7'));var controller=require('./cmContact.controller');router[_0x4bed('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x4bed('0x9'),auth['isAuthenticated'](),controller[_0x4bed('0xa')]);router[_0x4bed('0x8')](_0x4bed('0xb'),auth[_0x4bed('0xc')](),controller['show']);router['get'](_0x4bed('0xd'),auth['isAuthenticated'](),controller['getTags']);router[_0x4bed('0x8')](_0x4bed('0xe'),auth['isAuthenticated'](),controller['getHoppers']);router['get']('/:id/hopper_histories',auth[_0x4bed('0xc')](),controller[_0x4bed('0xf')]);router['get'](_0x4bed('0x10'),auth[_0x4bed('0xc')](),controller['getHopperFinals']);router['get']('/:id/jscripty_sessions',auth[_0x4bed('0xc')](),controller[_0x4bed('0x11')]);router[_0x4bed('0x8')](_0x4bed('0x12'),auth[_0x4bed('0xc')](),controller['getJourney']);router[_0x4bed('0x13')]('/merge',auth[_0x4bed('0xc')](),controller[_0x4bed('0x14')]);router['post']('/',auth[_0x4bed('0xc')](),controller[_0x4bed('0x15')]);router['post']('/create_many',auth[_0x4bed('0xc')](),controller['bulkCreate']);router[_0x4bed('0x13')](_0x4bed('0xd'),auth[_0x4bed('0xc')](),controller[_0x4bed('0x16')]);var upload=multer({'storage':multer[_0x4bed('0x17')]({'destination':function(_0x3dbb8f,_0x276325,_0xc5b461){_0xc5b461(null,path[_0x4bed('0x18')](config[_0x4bed('0x19')],'server/files/tmp'));},'filename':function(_0x513ee1,_0x4ea373,_0xb5a8ec){_0x4ea373['originalname']=_0x4ea373[_0x4bed('0x1a')][_0x4bed('0x1b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xb5a8ec(null,util[_0x4bed('0x1c')](_0x4bed('0x1d'),path[_0x4bed('0x1e')](_0x4ea373[_0x4bed('0x1a')],path['extname'](_0x4ea373[_0x4bed('0x1a')])),Date[_0x4bed('0x1f')](),path[_0x4bed('0x20')](_0x4ea373['originalname'])));}})});router[_0x4bed('0x13')](_0x4bed('0x21'),upload[_0x4bed('0x22')](_0x4bed('0x23')),controller[_0x4bed('0x24')]);var upload=multer({'storage':multer[_0x4bed('0x17')]({'destination':function(_0x5a8c9b,_0x178e1a,_0x455a35){_0x455a35(null,path[_0x4bed('0x18')](config[_0x4bed('0x19')],'server/files/tmp'));},'filename':function(_0x4adfeb,_0x589c30,_0xf64f4e){_0x589c30[_0x4bed('0x1a')]=_0x589c30[_0x4bed('0x1a')][_0x4bed('0x1b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xf64f4e(null,util[_0x4bed('0x1c')](_0x4bed('0x1d'),path['basename'](_0x589c30['originalname'],path['extname'](_0x589c30[_0x4bed('0x1a')])),Date[_0x4bed('0x1f')](),path[_0x4bed('0x20')](_0x589c30[_0x4bed('0x1a')])));}})});router[_0x4bed('0x13')](_0x4bed('0x25'),upload['single'](_0x4bed('0x23')),controller[_0x4bed('0x26')]);router[_0x4bed('0x13')]('/upload/:id',auth[_0x4bed('0xc')](),controller['import']);router[_0x4bed('0x27')](_0x4bed('0xb'),auth['isAuthenticated'](),controller[_0x4bed('0x28')]);router[_0x4bed('0x29')](_0x4bed('0xb'),auth[_0x4bed('0xc')](),controller[_0x4bed('0x2a')]);module[_0x4bed('0x2b')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index d9d2d86..c762b6b 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 _0xf4b3=['ENUM','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','type','parse','values'];(function(_0x27fd5c,_0x37c57c){var _0x5e7d82=function(_0x23c4bb){while(--_0x23c4bb){_0x27fd5c['push'](_0x27fd5c['shift']());}};_0x5e7d82(++_0x37c57c);}(_0xf4b3,0x1b3));var _0x3f4b=function(_0x362333,_0xa40fda){_0x362333=_0x362333-0x0;var _0x2cba45=_0xf4b3[_0x362333];return _0x2cba45;};'use strict';var Sequelize=require(_0x3f4b('0x0'));var _=require(_0x3f4b('0x1'));module[_0x3f4b('0x2')]={'name':{'type':Sequelize[_0x3f4b('0x3')],'get':function(_0x1f029f){return this[_0x3f4b('0x4')](_0x3f4b('0x5'));}},'alias':{'type':Sequelize[_0x3f4b('0x6')],'allowNull':![],'set':function(_0x2ec6f8){this[_0x3f4b('0x7')](_0x3f4b('0x5'),_0x2ec6f8?_0x2ec6f8:this[_0x3f4b('0x4')](_0x3f4b('0x8')));}},'type':{'type':Sequelize[_0x3f4b('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x3f4b('0x9')]('long'),'get':function(){if(this['getDataValue'](_0x3f4b('0xa'))==='select'){return JSON[_0x3f4b('0xb')](this[_0x3f4b('0x4')](_0x3f4b('0xc')));}else{return this[_0x3f4b('0x4')](_0x3f4b('0xc'));}},'set':function(_0x5b98b5){if(Array['isArray'](_0x5b98b5)){this[_0x3f4b('0x7')](_0x3f4b('0xc'),JSON['stringify'](_0x5b98b5));}else{this[_0x3f4b('0x7')](_0x3f4b('0xc'),_0x5b98b5);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x3f4b('0xd')]('voice')}}; \ No newline at end of file +var _0x4856=['isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','setDataValue','name','TEXT','type','select','parse','values'];(function(_0x35af23,_0x9190f6){var _0x340506=function(_0xd4c26b){while(--_0xd4c26b){_0x35af23['push'](_0x35af23['shift']());}};_0x340506(++_0x9190f6);}(_0x4856,0x149));var _0x6485=function(_0x65eb73,_0x1cc017){_0x65eb73=_0x65eb73-0x0;var _0x4e0f06=_0x4856[_0x65eb73];return _0x4e0f06;};'use strict';var Sequelize=require(_0x6485('0x0'));var _=require(_0x6485('0x1'));module[_0x6485('0x2')]={'name':{'type':Sequelize[_0x6485('0x3')],'get':function(_0x44b20d){return this[_0x6485('0x4')](_0x6485('0x5'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x5978d0){this[_0x6485('0x6')](_0x6485('0x5'),_0x5978d0?_0x5978d0:this[_0x6485('0x4')](_0x6485('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x6485('0x8')]('long'),'get':function(){if(this[_0x6485('0x4')](_0x6485('0x9'))===_0x6485('0xa')){return JSON[_0x6485('0xb')](this['getDataValue'](_0x6485('0xc')));}else{return this[_0x6485('0x4')](_0x6485('0xc'));}},'set':function(_0x5eaba1){if(Array[_0x6485('0xd')](_0x5eaba1)){this[_0x6485('0x6')](_0x6485('0xc'),JSON[_0x6485('0xe')](_0x5eaba1));}else{this[_0x6485('0x6')](_0x6485('0xc'),_0x5eaba1);}}},'required':{'type':Sequelize[_0x6485('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x6485('0x10')](_0x6485('0x11'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 40c612b..7895589 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 _0x5d2a=['keys','filters','intersection','attributes','model','fields','length','nolimit','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','params','find','body','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','differenceBy','query'];(function(_0x3ab83e,_0xe1368f){var _0x379ffc=function(_0x3792b3){while(--_0x3792b3){_0x3ab83e['push'](_0x3ab83e['shift']());}};_0x379ffc(++_0xe1368f);}(_0x5d2a,0x139));var _0xa5d2=function(_0x4850b5,_0x8a6d44){_0x4850b5=_0x4850b5-0x0;var _0x1c8ada=_0x5d2a[_0x4850b5];return _0x1c8ada;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa5d2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa5d2('0x1'));var moment=require(_0xa5d2('0x2'));var BPromise=require(_0xa5d2('0x3'));var Mustache=require(_0xa5d2('0x4'));var util=require(_0xa5d2('0x5'));var path=require(_0xa5d2('0x6'));var sox=require(_0xa5d2('0x7'));var csv=require('to-csv');var ejs=require(_0xa5d2('0x8'));var fs=require('fs');var fs_extra=require(_0xa5d2('0x9'));var _=require(_0xa5d2('0xa'));var squel=require(_0xa5d2('0xb'));var crypto=require(_0xa5d2('0xc'));var jsforce=require(_0xa5d2('0xd'));var deskjs=require(_0xa5d2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa5d2('0xf'));var Papa=require(_0xa5d2('0x10'));var Redis=require(_0xa5d2('0x11'));var authService=require(_0xa5d2('0x12'));var qs=require(_0xa5d2('0x13'));var as=require(_0xa5d2('0x14'));var hardwareService=require(_0xa5d2('0x15'));var logger=require(_0xa5d2('0x16'))(_0xa5d2('0x17'));var utils=require('../../config/utils');var config=require(_0xa5d2('0x18'));var licenseUtil=require(_0xa5d2('0x19'));var db=require(_0xa5d2('0x1a'))['db'];function respondWithStatusCode(_0x33bdd8,_0x2cc45d){_0x2cc45d=_0x2cc45d||0xcc;return function(_0x1b42c6){if(_0x1b42c6){return _0x33bdd8[_0xa5d2('0x1b')](_0x2cc45d);}return _0x33bdd8[_0xa5d2('0x1c')](_0x2cc45d)[_0xa5d2('0x1d')]();};}function respondWithResult(_0xdaf4b,_0x5875b3){_0x5875b3=_0x5875b3||0xc8;return function(_0x13df58){if(_0x13df58){return _0xdaf4b[_0xa5d2('0x1c')](_0x5875b3)[_0xa5d2('0x1e')](_0x13df58);}};}function respondWithFilteredResult(_0x4d8fb7,_0x5777d4){return function(_0x16bd37){if(_0x16bd37){var _0xfab4b9=typeof _0x5777d4[_0xa5d2('0x1f')]===_0xa5d2('0x20')&&typeof _0x5777d4[_0xa5d2('0x21')]==='undefined';var _0x4f00b9=_0x16bd37['count'];var _0xf94ffa=_0xfab4b9?0x0:_0x5777d4[_0xa5d2('0x1f')];var _0x3d99de=_0xfab4b9?_0x16bd37[_0xa5d2('0x22')]:_0x5777d4[_0xa5d2('0x1f')]+_0x5777d4[_0xa5d2('0x21')];var _0x469ec9;if(_0x3d99de>=_0x4f00b9){_0x3d99de=_0x4f00b9;_0x469ec9=0xc8;}else{_0x469ec9=0xce;}_0x4d8fb7[_0xa5d2('0x1c')](_0x469ec9);return _0x4d8fb7[_0xa5d2('0x23')](_0xa5d2('0x24'),_0xf94ffa+'-'+_0x3d99de+'/'+_0x4f00b9)[_0xa5d2('0x1e')](_0x16bd37);}return null;};}function patchUpdates(_0x24fa24){return function(_0x159d62){try{jsonpatch[_0xa5d2('0x25')](_0x159d62,_0x24fa24,!![]);}catch(_0x48e0c4){return BPromise[_0xa5d2('0x26')](_0x48e0c4);}return _0x159d62[_0xa5d2('0x27')]();};}function saveUpdates(_0xeabe0a,_0x18e135){return function(_0x4c913d){if(_0x4c913d){return _0x4c913d[_0xa5d2('0x28')](_0xeabe0a)[_0xa5d2('0x29')](function(_0x34e68e){return _0x34e68e;});}return null;};}function removeEntity(_0x521ca0,_0x5593f5){return function(_0x142425){if(_0x142425){return _0x142425[_0xa5d2('0x2a')]()[_0xa5d2('0x29')](function(){_0x521ca0[_0xa5d2('0x1c')](0xcc)[_0xa5d2('0x1d')]();});}};}function handleEntityNotFound(_0x347082,_0x29b712){return function(_0x33a19c){if(!_0x33a19c){_0x347082[_0xa5d2('0x1b')](0x194);}return _0x33a19c;};}function handleError(_0x3a4ebe,_0x2a43e5){_0x2a43e5=_0x2a43e5||0x1f4;return function(_0x4d55f5){logger[_0xa5d2('0x2b')](_0x4d55f5['stack']);if(_0x4d55f5[_0xa5d2('0x2c')]){delete _0x4d55f5[_0xa5d2('0x2c')];}_0x3a4ebe['status'](_0x2a43e5)[_0xa5d2('0x2d')](_0x4d55f5);};}exports[_0xa5d2('0x2e')]=function(_0x566d4a,_0x18d9f3){var _0x314af6={},_0x11fa42={},_0x2b90f6={'count':0x0,'rows':[]};var _0x41c9bc=_[_0xa5d2('0x2f')](db[_0xa5d2('0x30')][_0xa5d2('0x31')],function(_0x581246){return{'name':_0x581246[_0xa5d2('0x32')],'type':_0x581246[_0xa5d2('0x33')][_0xa5d2('0x34')]};});_0x11fa42['model']=_[_0xa5d2('0x35')](_['map'](_0x41c9bc,_0xa5d2('0x2c')),[_0xa5d2('0x2c')]);_0x11fa42[_0xa5d2('0x36')]=_[_0xa5d2('0x37')](_0x566d4a[_0xa5d2('0x36')]);_0x11fa42[_0xa5d2('0x38')]=_[_0xa5d2('0x39')](_0x11fa42['model'],_0x11fa42[_0xa5d2('0x36')]);_0x314af6[_0xa5d2('0x3a')]=_['intersection'](_0x11fa42[_0xa5d2('0x3b')],qs[_0xa5d2('0x3c')](_0x566d4a[_0xa5d2('0x36')]['fields']));_0x314af6[_0xa5d2('0x3a')]=_0x314af6[_0xa5d2('0x3a')][_0xa5d2('0x3d')]?_0x314af6[_0xa5d2('0x3a')]:_0x11fa42[_0xa5d2('0x3b')];if(!_0x566d4a['query']['hasOwnProperty'](_0xa5d2('0x3e'))){_0x314af6[_0xa5d2('0x21')]=qs['limit'](_0x566d4a[_0xa5d2('0x36')][_0xa5d2('0x21')]);_0x314af6[_0xa5d2('0x1f')]=qs[_0xa5d2('0x1f')](_0x566d4a[_0xa5d2('0x36')][_0xa5d2('0x1f')]);}_0x314af6['order']=qs['sort'](_0x566d4a[_0xa5d2('0x36')][_0xa5d2('0x3f')]);_0x314af6[_0xa5d2('0x40')]=qs['filters'](_[_0xa5d2('0x41')](_0x566d4a[_0xa5d2('0x36')],_0x11fa42[_0xa5d2('0x38')]),_0x41c9bc);if(_0x566d4a[_0xa5d2('0x36')][_0xa5d2('0x42')]){_0x314af6[_0xa5d2('0x40')]=_[_0xa5d2('0x43')](_0x314af6[_0xa5d2('0x40')],{'$or':_['map'](_0x41c9bc,function(_0x1a4941){if(_0x1a4941[_0xa5d2('0x33')]!=='VIRTUAL'){var _0x3edbbc={};_0x3edbbc[_0x1a4941[_0xa5d2('0x2c')]]={'$like':'%'+_0x566d4a[_0xa5d2('0x36')]['filter']+'%'};return _0x3edbbc;}})});}_0x314af6=_[_0xa5d2('0x43')]({},_0x314af6,_0x566d4a['options']);var _0x4e4756={'where':_0x314af6[_0xa5d2('0x40')]};return db[_0xa5d2('0x30')][_0xa5d2('0x22')](_0x4e4756)[_0xa5d2('0x29')](function(_0x126909){_0x2b90f6[_0xa5d2('0x22')]=_0x126909;if(_0x566d4a[_0xa5d2('0x36')][_0xa5d2('0x44')]){_0x314af6[_0xa5d2('0x45')]=[{'all':!![]}];}return db['CmCustomField']['findAll'](_0x314af6);})[_0xa5d2('0x29')](function(_0x15427f){_0x2b90f6[_0xa5d2('0x46')]=_0x15427f;return _0x2b90f6;})[_0xa5d2('0x29')](respondWithFilteredResult(_0x18d9f3,_0x314af6))[_0xa5d2('0x47')](handleError(_0x18d9f3,null));};exports[_0xa5d2('0x48')]=function(_0x506d3a,_0x1169b2){var _0x2aa1a0={'raw':!![],'where':{'id':_0x506d3a[_0xa5d2('0x49')]['id']}},_0x2de628={};_0x2de628[_0xa5d2('0x3b')]=_['keys'](db[_0xa5d2('0x30')][_0xa5d2('0x31')]);_0x2de628[_0xa5d2('0x36')]=_[_0xa5d2('0x37')](_0x506d3a[_0xa5d2('0x36')]);_0x2de628[_0xa5d2('0x38')]=_[_0xa5d2('0x39')](_0x2de628['model'],_0x2de628[_0xa5d2('0x36')]);_0x2aa1a0[_0xa5d2('0x3a')]=_[_0xa5d2('0x39')](_0x2de628[_0xa5d2('0x3b')],qs[_0xa5d2('0x3c')](_0x506d3a[_0xa5d2('0x36')][_0xa5d2('0x3c')]));_0x2aa1a0['attributes']=_0x2aa1a0[_0xa5d2('0x3a')][_0xa5d2('0x3d')]?_0x2aa1a0[_0xa5d2('0x3a')]:_0x2de628[_0xa5d2('0x3b')];if(_0x506d3a[_0xa5d2('0x36')][_0xa5d2('0x44')]){_0x2aa1a0[_0xa5d2('0x45')]=[{'all':!![]}];}_0x2aa1a0=_[_0xa5d2('0x43')]({},_0x2aa1a0,_0x506d3a['options']);return db[_0xa5d2('0x30')][_0xa5d2('0x4a')](_0x2aa1a0)[_0xa5d2('0x29')](handleEntityNotFound(_0x1169b2,null))['then'](respondWithResult(_0x1169b2,null))[_0xa5d2('0x47')](handleError(_0x1169b2,null));};exports[_0xa5d2('0x28')]=function(_0x2b9c4c,_0x494540){if(_0x2b9c4c[_0xa5d2('0x4b')]['id']){delete _0x2b9c4c[_0xa5d2('0x4b')]['id'];}return db[_0xa5d2('0x30')]['find']({'where':{'id':_0x2b9c4c[_0xa5d2('0x49')]['id']}})[_0xa5d2('0x29')](handleEntityNotFound(_0x494540,null))[_0xa5d2('0x29')](saveUpdates(_0x2b9c4c[_0xa5d2('0x4b')],null))[_0xa5d2('0x29')](respondWithResult(_0x494540,null))[_0xa5d2('0x47')](handleError(_0x494540,null));};exports[_0xa5d2('0x2a')]=function(_0x21179c,_0x1cc1c7){return db['CmCustomField'][_0xa5d2('0x4a')]({'where':{'id':_0x21179c['params']['id']}})['then'](handleEntityNotFound(_0x1cc1c7,null))[_0xa5d2('0x29')](removeEntity(_0x1cc1c7,null))[_0xa5d2('0x47')](handleError(_0x1cc1c7,null));};exports[_0xa5d2('0x4c')]=function(_0x41c8a9,_0x470b8e){var _0x25ddfe;return db[_0xa5d2('0x4d')][_0xa5d2('0x4e')](function(_0x231150){return db[_0xa5d2('0x30')][_0xa5d2('0x4c')](_0x41c8a9[_0xa5d2('0x4b')],{'transaction':_0x231150})['then'](function(_0x310801){_0x25ddfe=_0x310801;var _0x59a5c9={'type':db[_0xa5d2('0x4f')][_0xa5d2('0x50')],'transaction':_0x231150};switch(_0x41c8a9['body'][_0xa5d2('0x33')]){case _0xa5d2('0x51'):_0x59a5c9['type']=db[_0xa5d2('0x4f')][_0xa5d2('0x50')];break;case _0xa5d2('0x52'):_0x59a5c9[_0xa5d2('0x33')]=db[_0xa5d2('0x4f')][_0xa5d2('0x53')];break;case _0xa5d2('0x54'):_0x59a5c9[_0xa5d2('0x33')]=db[_0xa5d2('0x4f')][_0xa5d2('0x55')];_0x59a5c9[_0xa5d2('0x56')]=![];break;default:}return db['sequelize'][_0xa5d2('0x57')][_0xa5d2('0x58')](_0xa5d2('0x59'),util[_0xa5d2('0x5a')](_0xa5d2('0x5b'),_0x25ddfe['id']),_0x59a5c9);})[_0xa5d2('0x29')](function(){return _0x25ddfe;});})['then'](respondWithResult(_0x470b8e,0xc9))[_0xa5d2('0x47')](handleError(_0x470b8e,null));}; \ No newline at end of file +var _0x5cc1=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','reject','save','update','then','end','error','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','body','destroy','sequelize','transaction','create','TEXT','Sequelize','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','zip-dir','request-promise','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse'];(function(_0x5d3306,_0x6e1379){var _0x6968f7=function(_0x3f9b44){while(--_0x3f9b44){_0x5d3306['push'](_0x5d3306['shift']());}};_0x6968f7(++_0x6e1379);}(_0x5cc1,0xee));var _0x15cc=function(_0x4f0a03,_0x5e3feb){_0x4f0a03=_0x4f0a03-0x0;var _0x2d3579=_0x5cc1[_0x4f0a03];return _0x2d3579;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x15cc('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x15cc('0x1'));var moment=require('moment');var BPromise=require(_0x15cc('0x2'));var Mustache=require(_0x15cc('0x3'));var util=require(_0x15cc('0x4'));var path=require(_0x15cc('0x5'));var sox=require(_0x15cc('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x15cc('0x7'));var squel=require('squel');var crypto=require(_0x15cc('0x8'));var jsforce=require(_0x15cc('0x9'));var deskjs=require(_0x15cc('0xa'));var toCsv=require(_0x15cc('0xb'));var querystring=require(_0x15cc('0xc'));var Papa=require(_0x15cc('0xd'));var Redis=require('ioredis');var authService=require(_0x15cc('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x15cc('0xf'));var hardwareService=require(_0x15cc('0x10'));var logger=require(_0x15cc('0x11'))(_0x15cc('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x15cc('0x13'));var db=require(_0x15cc('0x14'))['db'];function respondWithStatusCode(_0x46503b,_0x4ca63c){_0x4ca63c=_0x4ca63c||0xcc;return function(_0x131fc6){if(_0x131fc6){return _0x46503b[_0x15cc('0x15')](_0x4ca63c);}return _0x46503b[_0x15cc('0x16')](_0x4ca63c)['end']();};}function respondWithResult(_0x9401e6,_0x3e88eb){_0x3e88eb=_0x3e88eb||0xc8;return function(_0x496ad2){if(_0x496ad2){return _0x9401e6[_0x15cc('0x16')](_0x3e88eb)['json'](_0x496ad2);}};}function respondWithFilteredResult(_0x2aafa4,_0x1e8c3d){return function(_0x31fff0){if(_0x31fff0){var _0x5af451=typeof _0x1e8c3d[_0x15cc('0x17')]===_0x15cc('0x18')&&typeof _0x1e8c3d[_0x15cc('0x19')]===_0x15cc('0x18');var _0x56e108=_0x31fff0[_0x15cc('0x1a')];var _0x1e848c=_0x5af451?0x0:_0x1e8c3d['offset'];var _0x4f8a24=_0x5af451?_0x31fff0['count']:_0x1e8c3d[_0x15cc('0x17')]+_0x1e8c3d[_0x15cc('0x19')];var _0x3f718a;if(_0x4f8a24>=_0x56e108){_0x4f8a24=_0x56e108;_0x3f718a=0xc8;}else{_0x3f718a=0xce;}_0x2aafa4[_0x15cc('0x16')](_0x3f718a);return _0x2aafa4['set'](_0x15cc('0x1b'),_0x1e848c+'-'+_0x4f8a24+'/'+_0x56e108)['json'](_0x31fff0);}return null;};}function patchUpdates(_0x42e12b){return function(_0x23e701){try{jsonpatch['apply'](_0x23e701,_0x42e12b,!![]);}catch(_0x184da1){return BPromise[_0x15cc('0x1c')](_0x184da1);}return _0x23e701[_0x15cc('0x1d')]();};}function saveUpdates(_0x47e383,_0x577666){return function(_0x2a81de){if(_0x2a81de){return _0x2a81de[_0x15cc('0x1e')](_0x47e383)['then'](function(_0x3a5544){return _0x3a5544;});}return null;};}function removeEntity(_0x330332,_0x45af9e){return function(_0x18357b){if(_0x18357b){return _0x18357b['destroy']()[_0x15cc('0x1f')](function(){_0x330332[_0x15cc('0x16')](0xcc)[_0x15cc('0x20')]();});}};}function handleEntityNotFound(_0x185fbb,_0x5f4765){return function(_0x1a41e4){if(!_0x1a41e4){_0x185fbb[_0x15cc('0x15')](0x194);}return _0x1a41e4;};}function handleError(_0x5943a9,_0xcc93d3){_0xcc93d3=_0xcc93d3||0x1f4;return function(_0x914210){logger[_0x15cc('0x21')](_0x914210['stack']);if(_0x914210[_0x15cc('0x22')]){delete _0x914210[_0x15cc('0x22')];}_0x5943a9['status'](_0xcc93d3)[_0x15cc('0x23')](_0x914210);};}exports[_0x15cc('0x24')]=function(_0x46d203,_0x4b536d){var _0x36e34b={},_0xcd37e2={},_0x5d9cb7={'count':0x0,'rows':[]};var _0x1bb32c=_[_0x15cc('0x25')](db[_0x15cc('0x26')][_0x15cc('0x27')],function(_0x2ee00a){return{'name':_0x2ee00a[_0x15cc('0x28')],'type':_0x2ee00a[_0x15cc('0x29')]['key']};});_0xcd37e2[_0x15cc('0x2a')]=_[_0x15cc('0x2b')](_[_0x15cc('0x25')](_0x1bb32c,_0x15cc('0x22')),['name']);_0xcd37e2[_0x15cc('0x2c')]=_[_0x15cc('0x2d')](_0x46d203[_0x15cc('0x2c')]);_0xcd37e2[_0x15cc('0x2e')]=_[_0x15cc('0x2f')](_0xcd37e2[_0x15cc('0x2a')],_0xcd37e2[_0x15cc('0x2c')]);_0x36e34b[_0x15cc('0x30')]=_[_0x15cc('0x2f')](_0xcd37e2[_0x15cc('0x2a')],qs[_0x15cc('0x31')](_0x46d203[_0x15cc('0x2c')][_0x15cc('0x31')]));_0x36e34b['attributes']=_0x36e34b[_0x15cc('0x30')][_0x15cc('0x32')]?_0x36e34b[_0x15cc('0x30')]:_0xcd37e2['model'];if(!_0x46d203[_0x15cc('0x2c')][_0x15cc('0x33')](_0x15cc('0x34'))){_0x36e34b[_0x15cc('0x19')]=qs[_0x15cc('0x19')](_0x46d203[_0x15cc('0x2c')][_0x15cc('0x19')]);_0x36e34b['offset']=qs[_0x15cc('0x17')](_0x46d203[_0x15cc('0x2c')][_0x15cc('0x17')]);}_0x36e34b['order']=qs[_0x15cc('0x35')](_0x46d203['query'][_0x15cc('0x35')]);_0x36e34b['where']=qs['filters'](_[_0x15cc('0x36')](_0x46d203[_0x15cc('0x2c')],_0xcd37e2['filters']),_0x1bb32c);if(_0x46d203[_0x15cc('0x2c')][_0x15cc('0x37')]){_0x36e34b['where']=_['merge'](_0x36e34b[_0x15cc('0x38')],{'$or':_[_0x15cc('0x25')](_0x1bb32c,function(_0x145cef){if(_0x145cef[_0x15cc('0x29')]!==_0x15cc('0x39')){var _0x494b17={};_0x494b17[_0x145cef[_0x15cc('0x22')]]={'$like':'%'+_0x46d203['query'][_0x15cc('0x37')]+'%'};return _0x494b17;}})});}_0x36e34b=_[_0x15cc('0x3a')]({},_0x36e34b,_0x46d203[_0x15cc('0x3b')]);var _0x14e3cf={'where':_0x36e34b[_0x15cc('0x38')]};return db[_0x15cc('0x26')][_0x15cc('0x1a')](_0x14e3cf)['then'](function(_0xb92938){_0x5d9cb7[_0x15cc('0x1a')]=_0xb92938;if(_0x46d203['query'][_0x15cc('0x3c')]){_0x36e34b[_0x15cc('0x3d')]=[{'all':!![]}];}return db['CmCustomField'][_0x15cc('0x3e')](_0x36e34b);})[_0x15cc('0x1f')](function(_0x46effa){_0x5d9cb7[_0x15cc('0x3f')]=_0x46effa;return _0x5d9cb7;})[_0x15cc('0x1f')](respondWithFilteredResult(_0x4b536d,_0x36e34b))[_0x15cc('0x40')](handleError(_0x4b536d,null));};exports[_0x15cc('0x41')]=function(_0x5e58a9,_0x313c36){var _0x346569={'raw':!![],'where':{'id':_0x5e58a9[_0x15cc('0x42')]['id']}},_0x5ee7bd={};_0x5ee7bd[_0x15cc('0x2a')]=_[_0x15cc('0x2d')](db[_0x15cc('0x26')][_0x15cc('0x27')]);_0x5ee7bd[_0x15cc('0x2c')]=_[_0x15cc('0x2d')](_0x5e58a9[_0x15cc('0x2c')]);_0x5ee7bd[_0x15cc('0x2e')]=_[_0x15cc('0x2f')](_0x5ee7bd[_0x15cc('0x2a')],_0x5ee7bd[_0x15cc('0x2c')]);_0x346569[_0x15cc('0x30')]=_['intersection'](_0x5ee7bd[_0x15cc('0x2a')],qs[_0x15cc('0x31')](_0x5e58a9[_0x15cc('0x2c')][_0x15cc('0x31')]));_0x346569[_0x15cc('0x30')]=_0x346569[_0x15cc('0x30')][_0x15cc('0x32')]?_0x346569[_0x15cc('0x30')]:_0x5ee7bd[_0x15cc('0x2a')];if(_0x5e58a9[_0x15cc('0x2c')][_0x15cc('0x3c')]){_0x346569[_0x15cc('0x3d')]=[{'all':!![]}];}_0x346569=_[_0x15cc('0x3a')]({},_0x346569,_0x5e58a9['options']);return db['CmCustomField'][_0x15cc('0x43')](_0x346569)[_0x15cc('0x1f')](handleEntityNotFound(_0x313c36,null))[_0x15cc('0x1f')](respondWithResult(_0x313c36,null))[_0x15cc('0x40')](handleError(_0x313c36,null));};exports[_0x15cc('0x1e')]=function(_0x2b4a6e,_0x59ef65){if(_0x2b4a6e['body']['id']){delete _0x2b4a6e['body']['id'];}return db[_0x15cc('0x26')]['find']({'where':{'id':_0x2b4a6e[_0x15cc('0x42')]['id']}})[_0x15cc('0x1f')](handleEntityNotFound(_0x59ef65,null))[_0x15cc('0x1f')](saveUpdates(_0x2b4a6e[_0x15cc('0x44')],null))[_0x15cc('0x1f')](respondWithResult(_0x59ef65,null))['catch'](handleError(_0x59ef65,null));};exports[_0x15cc('0x45')]=function(_0x375abd,_0x4f5fb2){return db[_0x15cc('0x26')]['find']({'where':{'id':_0x375abd[_0x15cc('0x42')]['id']}})['then'](handleEntityNotFound(_0x4f5fb2,null))[_0x15cc('0x1f')](removeEntity(_0x4f5fb2,null))['catch'](handleError(_0x4f5fb2,null));};exports['create']=function(_0x4e7f36,_0x506b29){var _0x554880;return db[_0x15cc('0x46')][_0x15cc('0x47')](function(_0x448352){return db[_0x15cc('0x26')][_0x15cc('0x48')](_0x4e7f36['body'],{'transaction':_0x448352})['then'](function(_0x5ac0eb){_0x554880=_0x5ac0eb;var _0x24f07b={'type':db['Sequelize'][_0x15cc('0x49')],'transaction':_0x448352};switch(_0x4e7f36[_0x15cc('0x44')]['type']){case'text':_0x24f07b['type']=db[_0x15cc('0x4a')][_0x15cc('0x49')];break;case'number':_0x24f07b[_0x15cc('0x29')]=db[_0x15cc('0x4a')][_0x15cc('0x4b')];break;case _0x15cc('0x4c'):_0x24f07b[_0x15cc('0x29')]=db[_0x15cc('0x4a')][_0x15cc('0x4d')];_0x24f07b[_0x15cc('0x4e')]=![];break;default:}return db[_0x15cc('0x46')][_0x15cc('0x4f')][_0x15cc('0x50')](_0x15cc('0x51'),util[_0x15cc('0x52')](_0x15cc('0x53'),_0x554880['id']),_0x24f07b);})['then'](function(){return _0x554880;});})['then'](respondWithResult(_0x506b29,0xc9))[_0x15cc('0x40')](handleError(_0x506b29,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 148007e..1e0330e 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 _0x894d=['api','bluebird','request-promise','rimraf','../../config/environment','./cmCustomField.attributes','exports','CmCustomField','cm_custom_fields','lodash','util','../../config/logger'];(function(_0x1bf020,_0x2a7bb8){var _0x44d568=function(_0x16dff4){while(--_0x16dff4){_0x1bf020['push'](_0x1bf020['shift']());}};_0x44d568(++_0x2a7bb8);}(_0x894d,0xd5));var _0xd894=function(_0x234441,_0x206fd6){_0x234441=_0x234441-0x0;var _0x2b4c82=_0x894d[_0x234441];return _0x2b4c82;};'use strict';var _=require(_0xd894('0x0'));var util=require(_0xd894('0x1'));var logger=require(_0xd894('0x2'))(_0xd894('0x3'));var moment=require('moment');var BPromise=require(_0xd894('0x4'));var rp=require(_0xd894('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd894('0x6'));var config=require(_0xd894('0x7'));var attributes=require(_0xd894('0x8'));module[_0xd894('0x9')]=function(_0x964016,_0x484937){return _0x964016['define'](_0xd894('0xa'),attributes,{'tableName':_0xd894('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f87=['api','bluebird','request-promise','path','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','util'];(function(_0x580971,_0x10984d){var _0x16d873=function(_0x594084){while(--_0x594084){_0x580971['push'](_0x580971['shift']());}};_0x16d873(++_0x10984d);}(_0x8f87,0x1c1));var _0x78f8=function(_0x2a0183,_0x3fc93c){_0x2a0183=_0x2a0183-0x0;var _0x158c3a=_0x8f87[_0x2a0183];return _0x158c3a;};'use strict';var _=require('lodash');var util=require(_0x78f8('0x0'));var logger=require('../../config/logger')(_0x78f8('0x1'));var moment=require('moment');var BPromise=require(_0x78f8('0x2'));var rp=require(_0x78f8('0x3'));var fs=require('fs');var path=require(_0x78f8('0x4'));var rimraf=require('rimraf');var config=require(_0x78f8('0x5'));var attributes=require(_0x78f8('0x6'));module[_0x78f8('0x7')]=function(_0x1e1350,_0x11c736){return _0x1e1350[_0x78f8('0x8')](_0x78f8('0x9'),attributes,{'tableName':'cm_custom_fields','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 3c1b3be..e31c284 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 _0x86d3=['CmCustomField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x32f9f7,_0x3b5263){var _0x43b7f6=function(_0x21e602){while(--_0x21e602){_0x32f9f7['push'](_0x32f9f7['shift']());}};_0x43b7f6(++_0x3b5263);}(_0x86d3,0x14a));var _0x386d=function(_0xf0c56a,_0x5a0beb){_0xf0c56a=_0xf0c56a-0x0;var _0x23b4ac=_0x86d3[_0xf0c56a];return _0x23b4ac;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x386d('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x386d('0x1'));var db=require(_0x386d('0x2'))['db'];var utils=require(_0x386d('0x3'));var logger=require(_0x386d('0x4'))(_0x386d('0x5'));var config=require(_0x386d('0x6'));var jayson=require(_0x386d('0x7'));var client=jayson[_0x386d('0x8')][_0x386d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x919c41,_0x1df046,_0x52ceeb){return new BPromise(function(_0x140aa4,_0x33ea68){return client[_0x386d('0xa')](_0x919c41,_0x52ceeb)['then'](function(_0x4fd93f){logger[_0x386d('0xb')](_0x386d('0xc'),_0x1df046,_0x386d('0xd'));logger[_0x386d('0xe')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x1df046,_0x386d('0xd'),JSON['stringify'](_0x4fd93f));if(_0x4fd93f[_0x386d('0xf')]){if(_0x4fd93f[_0x386d('0xf')][_0x386d('0x10')]===0x1f4){logger[_0x386d('0xf')](_0x386d('0xc'),_0x1df046,_0x4fd93f[_0x386d('0xf')][_0x386d('0x11')]);return _0x33ea68(_0x4fd93f[_0x386d('0xf')]['message']);}logger[_0x386d('0xf')](_0x386d('0xc'),_0x1df046,_0x4fd93f['error'][_0x386d('0x11')]);return _0x140aa4(_0x4fd93f[_0x386d('0xf')][_0x386d('0x11')]);}else{logger[_0x386d('0xb')](_0x386d('0xc'),_0x1df046,_0x386d('0xd'));_0x140aa4(_0x4fd93f['result']['message']);}})[_0x386d('0x12')](function(_0x1d05c7){logger[_0x386d('0xf')](_0x386d('0xc'),_0x1df046,_0x1d05c7);_0x33ea68(_0x1d05c7);});});} \ No newline at end of file +var _0x5de6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x51ec61,_0xf9d1e3){var _0x223200=function(_0x3bd510){while(--_0x3bd510){_0x51ec61['push'](_0x51ec61['shift']());}};_0x223200(++_0xf9d1e3);}(_0x5de6,0x13a));var _0x65de=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5de6[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x65de('0x0'));var util=require(_0x65de('0x1'));var moment=require(_0x65de('0x2'));var BPromise=require(_0x65de('0x3'));var rs=require(_0x65de('0x4'));var fs=require('fs');var Redis=require(_0x65de('0x5'));var db=require(_0x65de('0x6'))['db'];var utils=require(_0x65de('0x7'));var logger=require(_0x65de('0x8'))(_0x65de('0x9'));var config=require(_0x65de('0xa'));var jayson=require(_0x65de('0xb'));var client=jayson[_0x65de('0xc')][_0x65de('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x16481a,_0x1bc952,_0x4af71d){return new BPromise(function(_0x18cd86,_0x4b152f){return client['request'](_0x16481a,_0x4af71d)[_0x65de('0xe')](function(_0x2c7dd3){logger[_0x65de('0xf')](_0x65de('0x10'),_0x1bc952,_0x65de('0x11'));logger[_0x65de('0x12')](_0x65de('0x13'),_0x1bc952,_0x65de('0x11'),JSON[_0x65de('0x14')](_0x2c7dd3));if(_0x2c7dd3[_0x65de('0x15')]){if(_0x2c7dd3[_0x65de('0x15')][_0x65de('0x16')]===0x1f4){logger[_0x65de('0x15')](_0x65de('0x10'),_0x1bc952,_0x2c7dd3[_0x65de('0x15')][_0x65de('0x17')]);return _0x4b152f(_0x2c7dd3['error']['message']);}logger[_0x65de('0x15')](_0x65de('0x10'),_0x1bc952,_0x2c7dd3['error'][_0x65de('0x17')]);return _0x18cd86(_0x2c7dd3[_0x65de('0x15')][_0x65de('0x17')]);}else{logger[_0x65de('0xf')](_0x65de('0x10'),_0x1bc952,_0x65de('0x11'));_0x18cd86(_0x2c7dd3[_0x65de('0x18')][_0x65de('0x17')]);}})[_0x65de('0x19')](function(_0x347bc3){logger[_0x65de('0x15')](_0x65de('0x10'),_0x1bc952,_0x347bc3);_0x4b152f(_0x347bc3);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index e551b20..5c38811 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 _0x237b=['put','/:id','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','index','isAuthenticated','post','create'];(function(_0x2d2949,_0x24c559){var _0x4bb11f=function(_0x2a75d7){while(--_0x2a75d7){_0x2d2949['push'](_0x2d2949['shift']());}};_0x4bb11f(++_0x24c559);}(_0x237b,0x1a7));var _0xb237=function(_0x261945,_0x1898d5){_0x261945=_0x261945-0x0;var _0x4f1049=_0x237b[_0x261945];return _0x4f1049;};'use strict';var multer=require(_0xb237('0x0'));var util=require(_0xb237('0x1'));var path=require(_0xb237('0x2'));var timeout=require(_0xb237('0x3'));var express=require('express');var router=express[_0xb237('0x4')]();var fs_extra=require(_0xb237('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb237('0x6'));var config=require(_0xb237('0x7'));var controller=require(_0xb237('0x8'));router[_0xb237('0x9')]('/',auth['isAuthenticated'](),controller[_0xb237('0xa')]);router[_0xb237('0x9')]('/:id',auth[_0xb237('0xb')](),controller['show']);router[_0xb237('0xc')]('/',auth[_0xb237('0xb')](),controller[_0xb237('0xd')]);router[_0xb237('0xe')](_0xb237('0xf'),auth[_0xb237('0xb')](),controller[_0xb237('0x10')]);router['delete'](_0xb237('0xf'),auth[_0xb237('0xb')](),controller[_0xb237('0x11')]);module[_0xb237('0x12')]=router; \ No newline at end of file +var _0xa48b=['destroy','multer','util','path','Router','../../components/interaction/service','../../config/environment','./cmCustomField.controller','isAuthenticated','index','post','/:id','update'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa48b,0xc4));var _0xba48=function(_0x2d3939,_0x1fbe10){_0x2d3939=_0x2d3939-0x0;var _0x1326e2=_0xa48b[_0x2d3939];return _0x1326e2;};'use strict';var multer=require(_0xba48('0x0'));var util=require(_0xba48('0x1'));var path=require(_0xba48('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xba48('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xba48('0x4'));var config=require(_0xba48('0x5'));var controller=require(_0xba48('0x6'));router['get']('/',auth[_0xba48('0x7')](),controller[_0xba48('0x8')]);router['get']('/:id',auth[_0xba48('0x7')](),controller['show']);router[_0xba48('0x9')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xba48('0xa'),auth['isAuthenticated'](),controller[_0xba48('0xb')]);router['delete'](_0xba48('0xa'),auth['isAuthenticated'](),controller[_0xba48('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index c781480..1bb20c3 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 _0xf7b4=['format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','DATE','UNSIGNED','contactListQueue','moment','sequelize','exports','BOOLEAN'];(function(_0x233ec7,_0x518f13){var _0x347def=function(_0x53f49f){while(--_0x53f49f){_0x233ec7['push'](_0x233ec7['shift']());}};_0x347def(++_0x518f13);}(_0xf7b4,0x17d));var _0x4f7b=function(_0x24dc39,_0x3e65b9){_0x24dc39=_0x24dc39-0x0;var _0x1c8524=_0xf7b4[_0x24dc39];return _0x1c8524;};'use strict';var moment=require(_0x4f7b('0x0'));var Sequelize=require(_0x4f7b('0x1'));module[_0x4f7b('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x4f7b('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x4f7b('0x4')](_0x4f7b('0x5'))},'countbusyretry':{'type':Sequelize[_0x4f7b('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4f7b('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4f7b('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x4f7b('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4f7b('0x7')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4f7b('0x8')]},'priority':{'type':Sequelize[_0x4f7b('0x6')](0x2)[_0x4f7b('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x4f7b('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x4f7b('0xa')},'ListId':{'type':Sequelize[_0x4f7b('0x6')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x4f7b('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x4f7b('0x6')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x4f7b('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4f7b('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4f7b('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4f7b('0x6')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0516=['sequelize','exports','STRING','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','DATE','UNSIGNED','contactListQueue'];(function(_0x2264f8,_0x10a2d3){var _0x1c5aec=function(_0x4d6f06){while(--_0x4d6f06){_0x2264f8['push'](_0x2264f8['shift']());}};_0x1c5aec(++_0x10a2d3);}(_0x0516,0xaa));var _0x6051=function(_0x5734e1,_0x3e1d75){_0x5734e1=_0x5734e1-0x0;var _0x22c784=_0x0516[_0x5734e1];return _0x22c784;};'use strict';var moment=require('moment');var Sequelize=require(_0x6051('0x0'));module[_0x6051('0x1')]={'phone':{'type':Sequelize[_0x6051('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x6051('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x6051('0x4')](_0x6051('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6051('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x6051('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6051('0x7')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x6051('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x6051('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x6051('0x9')},'ListId':{'type':Sequelize[_0x6051('0x6')],'unique':'contactListQueue'},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x6051('0x6')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x6051('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6051('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6051('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6051('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6051('0x6')],'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 bed1b7c..0ba9fc2 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 _0x1a54=['UserId','deletedat','format','calleridnum','campaigntype','queue','ContactId','firstName','lastName','isNil','calleridname','CmHopperFinal','create','getPreview','getVoiceQueues','preview','dialOrderByScheduledAt','sequelize','transaction','YYYY-MM-DD\x20HH:mm:ss','dialPreviewAutoRecallMe','value','prev','isEmpty','hopperIds','ASC','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','priority','DESC','findOne','scheduledat','LOCK','UPDATE','CmContact','Contact','Company','CmList','List','Queue','getOpenContacts','outbound','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','rimraf','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$not','$between','$notBetween','$in','$notIn','$notLike','$iLike','$notILike','$overlap','$contained','$any','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','CmHopper','count','includeAll','include','findAll','rows','catch','show','params','options','update','find','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','campaign','membername','user'];(function(_0x4c5a90,_0x39edaf){var _0x8e83e8=function(_0xce4f7e){while(--_0xce4f7e){_0x4c5a90['push'](_0x4c5a90['shift']());}};_0x8e83e8(++_0x39edaf);}(_0x1a54,0x14f));var _0x41a5=function(_0x4b9813,_0x22c673){_0x4b9813=_0x4b9813-0x0;var _0x4296b7=_0x1a54[_0x4b9813];return _0x4296b7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x41a5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x41a5('0x1'));var rp=require(_0x41a5('0x2'));var moment=require('moment');var BPromise=require(_0x41a5('0x3'));var Mustache=require('mustache');var util=require(_0x41a5('0x4'));var path=require('path');var sox=require(_0x41a5('0x5'));var csv=require(_0x41a5('0x6'));var ejs=require(_0x41a5('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x41a5('0x8'));var squel=require(_0x41a5('0x9'));var crypto=require(_0x41a5('0xa'));var jsforce=require(_0x41a5('0xb'));var deskjs=require(_0x41a5('0xc'));var toCsv=require(_0x41a5('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x41a5('0xd'));var authService=require(_0x41a5('0xe'));var qs=require(_0x41a5('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x41a5('0x10'))(_0x41a5('0x11'));var utils=require(_0x41a5('0x12'));var config=require(_0x41a5('0x13'));var licenseUtil=require(_0x41a5('0x14'));var db=require(_0x41a5('0x15'))['db'];function respondWithStatusCode(_0x372b6a,_0x5bd44e){_0x5bd44e=_0x5bd44e||0xcc;return function(_0x6c18e1){if(_0x6c18e1){return _0x372b6a['sendStatus'](_0x5bd44e);}return _0x372b6a[_0x41a5('0x16')](_0x5bd44e)[_0x41a5('0x17')]();};}function respondWithResult(_0x4f9aab,_0x13d05f){_0x13d05f=_0x13d05f||0xc8;return function(_0x2e111b){if(_0x2e111b){return _0x4f9aab[_0x41a5('0x16')](_0x13d05f)[_0x41a5('0x18')](_0x2e111b);}};}function respondWithFilteredResult(_0x3fc008,_0x4dc67c){return function(_0x332861){if(_0x332861){var _0x53c211=typeof _0x4dc67c[_0x41a5('0x19')]===_0x41a5('0x1a')&&typeof _0x4dc67c[_0x41a5('0x1b')]===_0x41a5('0x1a');var _0x45bf8d=_0x332861['count'];var _0x18c379=_0x53c211?0x0:_0x4dc67c[_0x41a5('0x19')];var _0x1ae341=_0x53c211?_0x332861['count']:_0x4dc67c[_0x41a5('0x19')]+_0x4dc67c['limit'];var _0x1657ae;if(_0x1ae341>=_0x45bf8d){_0x1ae341=_0x45bf8d;_0x1657ae=0xc8;}else{_0x1657ae=0xce;}_0x3fc008[_0x41a5('0x16')](_0x1657ae);return _0x3fc008[_0x41a5('0x1c')](_0x41a5('0x1d'),_0x18c379+'-'+_0x1ae341+'/'+_0x45bf8d)[_0x41a5('0x18')](_0x332861);}return null;};}function patchUpdates(_0x1691cc){return function(_0x565cd4){try{jsonpatch['apply'](_0x565cd4,_0x1691cc,!![]);}catch(_0x4886c7){return BPromise[_0x41a5('0x1e')](_0x4886c7);}return _0x565cd4[_0x41a5('0x1f')]();};}function saveUpdates(_0x2682d9,_0x2d8878){return function(_0x3704df){if(_0x3704df){return _0x3704df['update'](_0x2682d9)[_0x41a5('0x20')](function(_0x1a87aa){return _0x1a87aa;});}return null;};}function removeEntity(_0x422baa,_0x2e3818){return function(_0x84b3aa){if(_0x84b3aa){return _0x84b3aa[_0x41a5('0x21')]()[_0x41a5('0x20')](function(){_0x422baa[_0x41a5('0x16')](0xcc)[_0x41a5('0x17')]();});}};}function handleEntityNotFound(_0x1148c4,_0x10fff6){return function(_0x4db9ff){if(!_0x4db9ff){_0x1148c4['sendStatus'](0x194);}return _0x4db9ff;};}function handleError(_0x33eebb,_0x4183e4){_0x4183e4=_0x4183e4||0x1f4;return function(_0xa33004){logger[_0x41a5('0x22')](_0xa33004[_0x41a5('0x23')]);if(_0xa33004['name']){delete _0xa33004[_0x41a5('0x24')];}_0x33eebb[_0x41a5('0x16')](_0x4183e4)['send'](_0xa33004);};}exports['index']=function(_0x1436bd,_0x4bb465){var _0x1f5e2d={},_0x2a8568={},_0x4d5afd={'count':0x0,'rows':[]};var _0x1a49b6=_[_0x41a5('0x25')](db['CmHopper'][_0x41a5('0x26')],function(_0x341ee7){return{'name':_0x341ee7[_0x41a5('0x27')],'type':_0x341ee7[_0x41a5('0x28')][_0x41a5('0x29')]};});_0x2a8568[_0x41a5('0x2a')]=_[_0x41a5('0x25')](_0x1a49b6,_0x41a5('0x24'));_0x2a8568[_0x41a5('0x2b')]=_[_0x41a5('0x2c')](_0x1436bd[_0x41a5('0x2b')]);_0x2a8568[_0x41a5('0x2d')]=_['intersection'](_0x2a8568[_0x41a5('0x2a')],_0x2a8568[_0x41a5('0x2b')]);_0x2a8568[_0x41a5('0x2d')]=_[_0x41a5('0x2e')](_0x2a8568['filters'],[_0x41a5('0x2f'),_0x41a5('0x30'),_0x41a5('0x31'),_0x41a5('0x32'),_0x41a5('0x33'),_0x41a5('0x34'),_0x41a5('0x35'),'$eq',_0x41a5('0x36'),_0x41a5('0x37'),_0x41a5('0x38'),_0x41a5('0x39'),_0x41a5('0x3a'),'$like',_0x41a5('0x3b'),_0x41a5('0x3c'),_0x41a5('0x3d'),'$like',_0x41a5('0x3e'),'$contains',_0x41a5('0x3f'),_0x41a5('0x40')]);_0x1f5e2d['attributes']=_[_0x41a5('0x41')](_0x2a8568[_0x41a5('0x2a')],qs[_0x41a5('0x42')](_0x1436bd['query'][_0x41a5('0x42')]));_0x1f5e2d[_0x41a5('0x43')]=_0x1f5e2d[_0x41a5('0x43')][_0x41a5('0x44')]?_0x1f5e2d[_0x41a5('0x43')]:_0x2a8568[_0x41a5('0x2a')];if(!_0x1436bd[_0x41a5('0x2b')][_0x41a5('0x45')]('nolimit')){_0x1f5e2d[_0x41a5('0x1b')]=qs[_0x41a5('0x1b')](_0x1436bd['query'][_0x41a5('0x1b')]);_0x1f5e2d[_0x41a5('0x19')]=qs['offset'](_0x1436bd[_0x41a5('0x2b')][_0x41a5('0x19')]);}_0x1f5e2d[_0x41a5('0x46')]=qs[_0x41a5('0x47')](_0x1436bd[_0x41a5('0x2b')][_0x41a5('0x47')]);_0x1f5e2d[_0x41a5('0x48')]=qs[_0x41a5('0x2d')](_[_0x41a5('0x49')](_0x1436bd[_0x41a5('0x2b')],_0x2a8568['filters']),_0x1a49b6);if(_0x1436bd['query'][_0x41a5('0x4a')]){_0x1f5e2d[_0x41a5('0x48')]=_[_0x41a5('0x4b')](_0x1f5e2d[_0x41a5('0x48')],{'$or':_[_0x41a5('0x25')](_0x1a49b6,function(_0x32dbce){if(_0x32dbce[_0x41a5('0x28')]!==_0x41a5('0x4c')){var _0x48be22={};_0x48be22[_0x32dbce[_0x41a5('0x24')]]={'$like':'%'+_0x1436bd[_0x41a5('0x2b')][_0x41a5('0x4a')]+'%'};return _0x48be22;}})});}_0x1f5e2d=_[_0x41a5('0x4b')]({},_0x1f5e2d,_0x1436bd['options']);var _0xd8acaf={'where':_0x1f5e2d[_0x41a5('0x48')]};return db[_0x41a5('0x4d')][_0x41a5('0x4e')](_0xd8acaf)[_0x41a5('0x20')](function(_0x48c9c0){_0x4d5afd['count']=_0x48c9c0;if(_0x1436bd[_0x41a5('0x2b')][_0x41a5('0x4f')]){_0x1f5e2d[_0x41a5('0x50')]=[{'all':!![]}];}return db[_0x41a5('0x4d')][_0x41a5('0x51')](_0x1f5e2d);})[_0x41a5('0x20')](function(_0x501a8c){_0x4d5afd[_0x41a5('0x52')]=_0x501a8c;return _0x4d5afd;})[_0x41a5('0x20')](respondWithFilteredResult(_0x4bb465,_0x1f5e2d))[_0x41a5('0x53')](handleError(_0x4bb465,null));};exports[_0x41a5('0x54')]=function(_0x2a930b,_0x144ac3){var _0x1de1c9={'raw':!![],'where':{'id':_0x2a930b[_0x41a5('0x55')]['id']}},_0x589431={};_0x589431['model']=_['keys'](db[_0x41a5('0x4d')][_0x41a5('0x26')]);_0x589431[_0x41a5('0x2b')]=_[_0x41a5('0x2c')](_0x2a930b['query']);_0x589431[_0x41a5('0x2d')]=_[_0x41a5('0x41')](_0x589431[_0x41a5('0x2a')],_0x589431[_0x41a5('0x2b')]);_0x1de1c9['attributes']=_[_0x41a5('0x41')](_0x589431['model'],qs[_0x41a5('0x42')](_0x2a930b[_0x41a5('0x2b')]['fields']));_0x1de1c9[_0x41a5('0x43')]=_0x1de1c9[_0x41a5('0x43')][_0x41a5('0x44')]?_0x1de1c9[_0x41a5('0x43')]:_0x589431['model'];if(_0x2a930b[_0x41a5('0x2b')][_0x41a5('0x4f')]){_0x1de1c9['include']=[{'all':!![]}];}_0x1de1c9=_[_0x41a5('0x4b')]({},_0x1de1c9,_0x2a930b[_0x41a5('0x56')]);return db['CmHopper']['find'](_0x1de1c9)[_0x41a5('0x20')](handleEntityNotFound(_0x144ac3,null))[_0x41a5('0x20')](respondWithResult(_0x144ac3,null))[_0x41a5('0x53')](handleError(_0x144ac3,null));};exports['create']=function(_0x99a42d,_0x5c459c){return db[_0x41a5('0x4d')]['create'](_0x99a42d['body'],{})[_0x41a5('0x20')](respondWithResult(_0x5c459c,0xc9))['catch'](handleError(_0x5c459c,null));};exports[_0x41a5('0x57')]=function(_0x2a38de,_0x4dea38){if(_0x2a38de['body']['id']){delete _0x2a38de['body']['id'];}return db[_0x41a5('0x4d')][_0x41a5('0x58')]({'where':{'id':_0x2a38de[_0x41a5('0x55')]['id']}})['then'](handleEntityNotFound(_0x4dea38,null))[_0x41a5('0x20')](saveUpdates(_0x2a38de[_0x41a5('0x59')],null))[_0x41a5('0x20')](respondWithResult(_0x4dea38,null))[_0x41a5('0x53')](handleError(_0x4dea38,null));};exports['describe']=function(_0x492b95,_0xc91915){return db[_0x41a5('0x4d')][_0x41a5('0x5a')]()[_0x41a5('0x20')](respondWithResult(_0xc91915,null))['catch'](handleError(_0xc91915,null));};exports[_0x41a5('0x21')]=function(_0x2b539e,_0x1e6341){var _0x4607a9;return db[_0x41a5('0x4d')]['find']({'where':{'id':_0x2b539e['params']['id']}})[_0x41a5('0x20')](handleEntityNotFound(_0x1e6341,null))[_0x41a5('0x20')](function(_0x11e7e0){if(_0x11e7e0){return _0x11e7e0[_0x41a5('0x21')]()[_0x41a5('0x20')](function(_0x5b1c79){return _0x5b1c79;});}})['then'](function(_0x471522){_0x4607a9=_0x471522;if(_0x471522){if(_0x471522[_0x41a5('0x5b')]||_0x471522[_0x41a5('0x5c')]){return db[_0x471522['VoiceQueueId']?_0x41a5('0x5d'):_0x41a5('0x5e')][_0x41a5('0x58')]({'where':{'id':_0x471522[_0x41a5('0x5b')]?_0x471522[_0x41a5('0x5b')]:_0x471522[_0x41a5('0x5c')]},'attributes':['id',_0x41a5('0x24')],'raw':!![]});}}})[_0x41a5('0x20')](function(_0x48fd33){var _0x3a02f4={};if(_0x48fd33){_[_0x41a5('0x4b')](_0x3a02f4,_[_0x41a5('0x5f')](_0x4607a9[_0x41a5('0x60')],['createdAt','updatedAt','id']));_0x3a02f4['state']=0x15;_0x3a02f4['statedesc']='deleted';_0x3a02f4[_0x41a5('0x61')]=_0x48fd33[_0x41a5('0x24')];_0x3a02f4[_0x41a5('0x62')]=_0x2b539e[_0x41a5('0x63')]['name'];_0x3a02f4[_0x41a5('0x64')]=_0x2b539e[_0x41a5('0x63')]['id'];_0x3a02f4['deleted']=!![];_0x3a02f4[_0x41a5('0x65')]=moment()[_0x41a5('0x66')]('YYYY-MM-DD\x20HH:mm:ss');_0x3a02f4[_0x41a5('0x67')]=_0x4607a9['phone'];_0x3a02f4[_0x41a5('0x68')]=_0x4607a9[_0x41a5('0x5b')]?_0x41a5('0x69'):'ivr';return db['CmContact'][_0x41a5('0x58')]({'where':{'id':_0x3a02f4[_0x41a5('0x6a')]},'attributes':[_0x41a5('0x6b'),_0x41a5('0x6c')]})['then'](function(_0x1f046b){if(!_[_0x41a5('0x6d')](_0x1e6341)&&!_[_0x41a5('0x6d')](_0x1f046b[_0x41a5('0x6b')])){_0x3a02f4[_0x41a5('0x6e')]=_0x1f046b['firstName'];if(!_[_0x41a5('0x6d')](_0x1f046b[_0x41a5('0x6c')])){_0x3a02f4['calleridname']+='\x20'+_0x1f046b['lastName'];}}})['finally'](function(){return db[_0x41a5('0x6f')][_0x41a5('0x70')](_0x3a02f4);});}})[_0x41a5('0x20')](function(){return _0x1e6341[_0x41a5('0x16')](0xcc)[_0x41a5('0x17')]();})['catch'](handleError(_0x1e6341,null));};exports[_0x41a5('0x71')]=function(_0x560a,_0xb7b18,_0x4dcc52){var _0x4218de=[];return db['CmContact'][_0x41a5('0x5a')]()['then'](function(_0x17881e){_0x4218de=_['keys'](_0x17881e);return _0x560a[_0x41a5('0x63')][_0x41a5('0x72')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x41a5('0x73')},'attributes':['id',_0x41a5('0x74'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0x41a5('0x20')](function(_0x362f3f){if(_0x362f3f&&_0x362f3f['length']){return db[_0x41a5('0x75')][_0x41a5('0x76')](function(_0x5c452e){var _0x14b141={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x41a5('0x66')](_0x41a5('0x77'))},'VoiceQueueId':{'$in':_[_0x41a5('0x25')](_0x362f3f,'id')},'$or':[{'UserId':null},{'UserId':_0x560a['user']['id']}]};var _0x5ab32d={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x362f3f)[_0x41a5('0x4a')]([_0x41a5('0x78'),0x0])['map']('id')[_0x41a5('0x79')]()},'$or':[{'UserId':null},{'UserId':_0x560a[_0x41a5('0x63')]['id']}]};var _0x52510b={'$or':[_0x14b141,_0x5ab32d]};var _0x3a92d5=[];if(_0x560a[_0x41a5('0x59')]['direction']&&_0x560a[_0x41a5('0x59')]['direction']===_0x41a5('0x7a')){if(!_[_0x41a5('0x7b')](_0x560a[_0x41a5('0x59')][_0x41a5('0x7c')])){_0x52510b['id']={'$in':_0x560a[_0x41a5('0x59')]['hopperIds']};}_0x3a92d5=[['priority',_0x41a5('0x7d')],[_0x41a5('0x7e'),_0x362f3f[0x0]['dialOrderByScheduledAt']==='ASC'?'DESC':'ASC'],db[_0x41a5('0x75')][_0x41a5('0x7f')](_0x41a5('0x80')),['id','DESC']];}else{if(!_[_0x41a5('0x7b')](_0x560a[_0x41a5('0x59')][_0x41a5('0x7c')])){_0x52510b['id']={'$notIn':_0x560a[_0x41a5('0x59')][_0x41a5('0x7c')]};}_0x3a92d5=[[_0x41a5('0x81'),_0x41a5('0x82')],[_0x41a5('0x7e'),_0x362f3f[0x0][_0x41a5('0x74')]],db['sequelize'][_0x41a5('0x7f')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x41a5('0x7d')]];}return db[_0x41a5('0x4d')][_0x41a5('0x83')]({'attributes':['id',_0x41a5('0x84'),'recallme'],'where':_0x52510b,'order':_0x3a92d5,'transaction':_0x5c452e,'lock':_0x5c452e[_0x41a5('0x85')][_0x41a5('0x86')],'include':[{'model':db[_0x41a5('0x87')],'as':_0x41a5('0x88'),'attributes':_0x4218de,'include':[{'model':db['CmCompany'],'as':_0x41a5('0x89'),'attributes':['id',_0x41a5('0x24')]}]},{'model':db[_0x41a5('0x8a')],'as':_0x41a5('0x8b'),'attributes':['id',_0x41a5('0x24')]},{'model':db['VoiceQueue'],'as':_0x41a5('0x8c'),'attributes':['id',_0x41a5('0x24'),'dialActive']}]})[_0x41a5('0x20')](function(_0x56eae7){if(_0x56eae7){return _0x56eae7['update']({'UserId':_0x560a[_0x41a5('0x63')]['id']},{'transaction':_0x5c452e});}});});}})['then'](handleEntityNotFound(_0xb7b18,null))[_0x41a5('0x20')](respondWithResult(_0xb7b18,null))[_0x41a5('0x53')](handleError(_0xb7b18,null));};exports[_0x41a5('0x8d')]=function(_0x216349,_0xa6690e,_0x149e3b){return _0x216349[_0x41a5('0x63')][_0x41a5('0x72')]({'where':{'type':_0x41a5('0x8e'),'dialActive':!![],'dialMethod':_0x41a5('0x73')},'attributes':['id'],'raw':!![]})[_0x41a5('0x20')](function(_0x1b5f08){if(_0x1b5f08&&_0x1b5f08[_0x41a5('0x44')]){return db[_0x41a5('0x4d')][_0x41a5('0x4e')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x41a5('0x77'))},'VoiceQueueId':{'$in':_['map'](_0x1b5f08,'id')},'$or':[{'UserId':null},{'UserId':_0x216349[_0x41a5('0x63')]['id']}]}});}return 0x0;})[_0x41a5('0x20')](function(_0xcc3cf5){if(!_[_0x41a5('0x6d')](_0xcc3cf5)&&_[_0x41a5('0x8f')](_0xcc3cf5)){return _0xa6690e[_0x41a5('0x16')](0xc8)['json']({'contacts':_0xcc3cf5});}else{logger['error'](_0x41a5('0x90'),_0x41a5('0x8d'),0x194,'entity\x20not\x20found');_0xa6690e['sendStatus'](0x194);}})[_0x41a5('0x53')](handleError(_0xa6690e,null));}; \ No newline at end of file +var _0x23bb=['deletedat','format','calleridnum','campaigntype','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','CmHopperFinal','getPreview','getVoiceQueues','outbound','dialOrderByScheduledAt','sequelize','transaction','YYYY-MM-DD\x20HH:mm:ss','dialPreviewAutoRecallMe','value','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','LOCK','Contact','Company','CmList','List','getOpenContacts','isNumber','entity\x20not\x20found','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','update','then','error','name','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$like','$notLike','$iLike','$notILike','$overlap','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','CmHopper','count','include','findAll','catch','show','find','create','body','params','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','createdAt','updatedAt','state','statedesc','campaign','user','UserId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x23bb,0xc1));var _0xb23b=function(_0x38aeea,_0x57522a){_0x38aeea=_0x38aeea-0x0;var _0x5e8d2c=_0x23bb[_0x38aeea];return _0x5e8d2c;};'use strict';var emlformat=require(_0xb23b('0x0'));var rimraf=require(_0xb23b('0x1'));var zipdir=require(_0xb23b('0x2'));var jsonpatch=require(_0xb23b('0x3'));var rp=require(_0xb23b('0x4'));var moment=require('moment');var BPromise=require(_0xb23b('0x5'));var Mustache=require('mustache');var util=require(_0xb23b('0x6'));var path=require(_0xb23b('0x7'));var sox=require(_0xb23b('0x8'));var csv=require('to-csv');var ejs=require(_0xb23b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb23b('0xa'));var squel=require(_0xb23b('0xb'));var crypto=require(_0xb23b('0xc'));var jsforce=require(_0xb23b('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb23b('0xe'));var Redis=require(_0xb23b('0xf'));var authService=require(_0xb23b('0x10'));var qs=require(_0xb23b('0x11'));var as=require(_0xb23b('0x12'));var hardwareService=require(_0xb23b('0x13'));var logger=require('../../config/logger')(_0xb23b('0x14'));var utils=require(_0xb23b('0x15'));var config=require(_0xb23b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb23b('0x17'))['db'];function respondWithStatusCode(_0x1b5755,_0x894374){_0x894374=_0x894374||0xcc;return function(_0x3e048a){if(_0x3e048a){return _0x1b5755[_0xb23b('0x18')](_0x894374);}return _0x1b5755[_0xb23b('0x19')](_0x894374)[_0xb23b('0x1a')]();};}function respondWithResult(_0x24cf76,_0x4ca09e){_0x4ca09e=_0x4ca09e||0xc8;return function(_0x5b2974){if(_0x5b2974){return _0x24cf76['status'](_0x4ca09e)[_0xb23b('0x1b')](_0x5b2974);}};}function respondWithFilteredResult(_0x1175e2,_0x40b2f2){return function(_0x19ebe8){if(_0x19ebe8){var _0x5351e0=typeof _0x40b2f2[_0xb23b('0x1c')]===_0xb23b('0x1d')&&typeof _0x40b2f2[_0xb23b('0x1e')]===_0xb23b('0x1d');var _0x52a4a8=_0x19ebe8['count'];var _0x32221a=_0x5351e0?0x0:_0x40b2f2[_0xb23b('0x1c')];var _0x3934e6=_0x5351e0?_0x19ebe8['count']:_0x40b2f2[_0xb23b('0x1c')]+_0x40b2f2[_0xb23b('0x1e')];var _0x1ef1eb;if(_0x3934e6>=_0x52a4a8){_0x3934e6=_0x52a4a8;_0x1ef1eb=0xc8;}else{_0x1ef1eb=0xce;}_0x1175e2['status'](_0x1ef1eb);return _0x1175e2[_0xb23b('0x1f')]('Content-Range',_0x32221a+'-'+_0x3934e6+'/'+_0x52a4a8)['json'](_0x19ebe8);}return null;};}function patchUpdates(_0x1afd4f){return function(_0x46ef92){try{jsonpatch[_0xb23b('0x20')](_0x46ef92,_0x1afd4f,!![]);}catch(_0x3a267c){return BPromise[_0xb23b('0x21')](_0x3a267c);}return _0x46ef92[_0xb23b('0x22')]();};}function saveUpdates(_0x4f3fa6,_0x16c91){return function(_0x3e35a3){if(_0x3e35a3){return _0x3e35a3[_0xb23b('0x23')](_0x4f3fa6)[_0xb23b('0x24')](function(_0xd2b1cf){return _0xd2b1cf;});}return null;};}function removeEntity(_0x13a3a7,_0x5eb980){return function(_0x30d866){if(_0x30d866){return _0x30d866['destroy']()['then'](function(){_0x13a3a7[_0xb23b('0x19')](0xcc)[_0xb23b('0x1a')]();});}};}function handleEntityNotFound(_0x25ff38,_0x2199a4){return function(_0x529435){if(!_0x529435){_0x25ff38[_0xb23b('0x18')](0x194);}return _0x529435;};}function handleError(_0x361038,_0x1036e6){_0x1036e6=_0x1036e6||0x1f4;return function(_0x5ce29d){logger[_0xb23b('0x25')](_0x5ce29d['stack']);if(_0x5ce29d[_0xb23b('0x26')]){delete _0x5ce29d[_0xb23b('0x26')];}_0x361038['status'](_0x1036e6)['send'](_0x5ce29d);};}exports[_0xb23b('0x27')]=function(_0x5f2ac1,_0x4ffbdd){var _0x66025c={},_0x16e71f={},_0x3bc9e6={'count':0x0,'rows':[]};var _0x499d71=_[_0xb23b('0x28')](db['CmHopper'][_0xb23b('0x29')],function(_0x5649f3){return{'name':_0x5649f3[_0xb23b('0x2a')],'type':_0x5649f3[_0xb23b('0x2b')]['key']};});_0x16e71f[_0xb23b('0x2c')]=_[_0xb23b('0x28')](_0x499d71,'name');_0x16e71f['query']=_[_0xb23b('0x2d')](_0x5f2ac1[_0xb23b('0x2e')]);_0x16e71f[_0xb23b('0x2f')]=_[_0xb23b('0x30')](_0x16e71f[_0xb23b('0x2c')],_0x16e71f[_0xb23b('0x2e')]);_0x16e71f['filters']=_[_0xb23b('0x31')](_0x16e71f[_0xb23b('0x2f')],[_0xb23b('0x32'),_0xb23b('0x33'),_0xb23b('0x34'),_0xb23b('0x35'),_0xb23b('0x36'),_0xb23b('0x37'),_0xb23b('0x38'),_0xb23b('0x39'),_0xb23b('0x3a'),_0xb23b('0x3b'),_0xb23b('0x3c'),_0xb23b('0x3d'),'$notIn',_0xb23b('0x3e'),_0xb23b('0x3f'),_0xb23b('0x40'),_0xb23b('0x41'),'$like',_0xb23b('0x42'),'$contains',_0xb23b('0x43'),_0xb23b('0x44')]);_0x66025c[_0xb23b('0x45')]=_[_0xb23b('0x30')](_0x16e71f[_0xb23b('0x2c')],qs[_0xb23b('0x46')](_0x5f2ac1[_0xb23b('0x2e')]['fields']));_0x66025c[_0xb23b('0x45')]=_0x66025c['attributes'][_0xb23b('0x47')]?_0x66025c[_0xb23b('0x45')]:_0x16e71f[_0xb23b('0x2c')];if(!_0x5f2ac1[_0xb23b('0x2e')][_0xb23b('0x48')](_0xb23b('0x49'))){_0x66025c[_0xb23b('0x1e')]=qs['limit'](_0x5f2ac1[_0xb23b('0x2e')][_0xb23b('0x1e')]);_0x66025c['offset']=qs[_0xb23b('0x1c')](_0x5f2ac1[_0xb23b('0x2e')]['offset']);}_0x66025c['order']=qs[_0xb23b('0x4a')](_0x5f2ac1[_0xb23b('0x2e')][_0xb23b('0x4a')]);_0x66025c[_0xb23b('0x4b')]=qs[_0xb23b('0x2f')](_[_0xb23b('0x4c')](_0x5f2ac1[_0xb23b('0x2e')],_0x16e71f[_0xb23b('0x2f')]),_0x499d71);if(_0x5f2ac1['query'][_0xb23b('0x4d')]){_0x66025c[_0xb23b('0x4b')]=_[_0xb23b('0x4e')](_0x66025c[_0xb23b('0x4b')],{'$or':_[_0xb23b('0x28')](_0x499d71,function(_0x195930){if(_0x195930[_0xb23b('0x2b')]!==_0xb23b('0x4f')){var _0x431994={};_0x431994[_0x195930['name']]={'$like':'%'+_0x5f2ac1[_0xb23b('0x2e')][_0xb23b('0x4d')]+'%'};return _0x431994;}})});}_0x66025c=_['merge']({},_0x66025c,_0x5f2ac1[_0xb23b('0x50')]);var _0x30cc76={'where':_0x66025c['where']};return db[_0xb23b('0x51')][_0xb23b('0x52')](_0x30cc76)[_0xb23b('0x24')](function(_0x186258){_0x3bc9e6[_0xb23b('0x52')]=_0x186258;if(_0x5f2ac1[_0xb23b('0x2e')]['includeAll']){_0x66025c[_0xb23b('0x53')]=[{'all':!![]}];}return db['CmHopper'][_0xb23b('0x54')](_0x66025c);})[_0xb23b('0x24')](function(_0x5fa4c8){_0x3bc9e6['rows']=_0x5fa4c8;return _0x3bc9e6;})[_0xb23b('0x24')](respondWithFilteredResult(_0x4ffbdd,_0x66025c))[_0xb23b('0x55')](handleError(_0x4ffbdd,null));};exports[_0xb23b('0x56')]=function(_0x41f72c,_0x198327){var _0x375560={'raw':!![],'where':{'id':_0x41f72c['params']['id']}},_0x56a909={};_0x56a909[_0xb23b('0x2c')]=_[_0xb23b('0x2d')](db[_0xb23b('0x51')][_0xb23b('0x29')]);_0x56a909[_0xb23b('0x2e')]=_[_0xb23b('0x2d')](_0x41f72c[_0xb23b('0x2e')]);_0x56a909[_0xb23b('0x2f')]=_['intersection'](_0x56a909[_0xb23b('0x2c')],_0x56a909[_0xb23b('0x2e')]);_0x375560[_0xb23b('0x45')]=_['intersection'](_0x56a909[_0xb23b('0x2c')],qs[_0xb23b('0x46')](_0x41f72c[_0xb23b('0x2e')][_0xb23b('0x46')]));_0x375560[_0xb23b('0x45')]=_0x375560[_0xb23b('0x45')][_0xb23b('0x47')]?_0x375560[_0xb23b('0x45')]:_0x56a909['model'];if(_0x41f72c['query']['includeAll']){_0x375560[_0xb23b('0x53')]=[{'all':!![]}];}_0x375560=_[_0xb23b('0x4e')]({},_0x375560,_0x41f72c[_0xb23b('0x50')]);return db[_0xb23b('0x51')][_0xb23b('0x57')](_0x375560)['then'](handleEntityNotFound(_0x198327,null))[_0xb23b('0x24')](respondWithResult(_0x198327,null))[_0xb23b('0x55')](handleError(_0x198327,null));};exports[_0xb23b('0x58')]=function(_0x32fea5,_0xf2ee65){return db[_0xb23b('0x51')][_0xb23b('0x58')](_0x32fea5[_0xb23b('0x59')],{})[_0xb23b('0x24')](respondWithResult(_0xf2ee65,0xc9))[_0xb23b('0x55')](handleError(_0xf2ee65,null));};exports[_0xb23b('0x23')]=function(_0x46b405,_0x22b80a){if(_0x46b405[_0xb23b('0x59')]['id']){delete _0x46b405[_0xb23b('0x59')]['id'];}return db[_0xb23b('0x51')][_0xb23b('0x57')]({'where':{'id':_0x46b405[_0xb23b('0x5a')]['id']}})[_0xb23b('0x24')](handleEntityNotFound(_0x22b80a,null))[_0xb23b('0x24')](saveUpdates(_0x46b405[_0xb23b('0x59')],null))['then'](respondWithResult(_0x22b80a,null))['catch'](handleError(_0x22b80a,null));};exports['describe']=function(_0x4fe054,_0x218599){return db[_0xb23b('0x51')][_0xb23b('0x5b')]()[_0xb23b('0x24')](respondWithResult(_0x218599,null))[_0xb23b('0x55')](handleError(_0x218599,null));};exports[_0xb23b('0x5c')]=function(_0x3ae3e0,_0x38ccb9){var _0x18aa9f;return db[_0xb23b('0x51')][_0xb23b('0x57')]({'where':{'id':_0x3ae3e0[_0xb23b('0x5a')]['id']}})[_0xb23b('0x24')](handleEntityNotFound(_0x38ccb9,null))[_0xb23b('0x24')](function(_0x515810){if(_0x515810){return _0x515810[_0xb23b('0x5c')]()[_0xb23b('0x24')](function(_0x519b5a){return _0x519b5a;});}})['then'](function(_0x921869){_0x18aa9f=_0x921869;if(_0x921869){if(_0x921869[_0xb23b('0x5d')]||_0x921869[_0xb23b('0x5e')]){return db[_0x921869['VoiceQueueId']?_0xb23b('0x5f'):_0xb23b('0x60')][_0xb23b('0x57')]({'where':{'id':_0x921869[_0xb23b('0x5d')]?_0x921869[_0xb23b('0x5d')]:_0x921869[_0xb23b('0x5e')]},'attributes':['id',_0xb23b('0x26')],'raw':!![]});}}})[_0xb23b('0x24')](function(_0x538848){var _0x44ffe7={};if(_0x538848){_[_0xb23b('0x4e')](_0x44ffe7,_[_0xb23b('0x61')](_0x18aa9f['dataValues'],[_0xb23b('0x62'),_0xb23b('0x63'),'id']));_0x44ffe7[_0xb23b('0x64')]=0x15;_0x44ffe7[_0xb23b('0x65')]='deleted';_0x44ffe7[_0xb23b('0x66')]=_0x538848[_0xb23b('0x26')];_0x44ffe7['membername']=_0x3ae3e0[_0xb23b('0x67')][_0xb23b('0x26')];_0x44ffe7[_0xb23b('0x68')]=_0x3ae3e0[_0xb23b('0x67')]['id'];_0x44ffe7['deleted']=!![];_0x44ffe7[_0xb23b('0x69')]=moment()[_0xb23b('0x6a')]('YYYY-MM-DD\x20HH:mm:ss');_0x44ffe7[_0xb23b('0x6b')]=_0x18aa9f['phone'];_0x44ffe7[_0xb23b('0x6c')]=_0x18aa9f[_0xb23b('0x5d')]?_0xb23b('0x6d'):_0xb23b('0x6e');return db[_0xb23b('0x6f')]['find']({'where':{'id':_0x44ffe7[_0xb23b('0x70')]},'attributes':['firstName',_0xb23b('0x71')]})['then'](function(_0x170fb1){if(!_[_0xb23b('0x72')](_0x38ccb9)&&!_[_0xb23b('0x72')](_0x170fb1['firstName'])){_0x44ffe7['calleridname']=_0x170fb1[_0xb23b('0x73')];if(!_[_0xb23b('0x72')](_0x170fb1[_0xb23b('0x71')])){_0x44ffe7[_0xb23b('0x74')]+='\x20'+_0x170fb1['lastName'];}}})['finally'](function(){return db[_0xb23b('0x75')][_0xb23b('0x58')](_0x44ffe7);});}})[_0xb23b('0x24')](function(){return _0x38ccb9[_0xb23b('0x19')](0xcc)[_0xb23b('0x1a')]();})[_0xb23b('0x55')](handleError(_0x38ccb9,null));};exports[_0xb23b('0x76')]=function(_0x5c552b,_0x11cee3,_0x4a04da){var _0x17bc21=[];return db[_0xb23b('0x6f')][_0xb23b('0x5b')]()[_0xb23b('0x24')](function(_0x4e6a40){_0x17bc21=_[_0xb23b('0x2d')](_0x4e6a40);return _0x5c552b[_0xb23b('0x67')][_0xb23b('0x77')]({'where':{'type':_0xb23b('0x78'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xb23b('0x79'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0xb23b('0x24')](function(_0x331c20){if(_0x331c20&&_0x331c20[_0xb23b('0x47')]){return db[_0xb23b('0x7a')][_0xb23b('0x7b')](function(_0x56bace){var _0x100fdc={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xb23b('0x7c'))},'VoiceQueueId':{'$in':_[_0xb23b('0x28')](_0x331c20,'id')},'$or':[{'UserId':null},{'UserId':_0x5c552b['user']['id']}]};var _0x4336cc={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x331c20)[_0xb23b('0x4d')]([_0xb23b('0x7d'),0x0])[_0xb23b('0x28')]('id')[_0xb23b('0x7e')]()},'$or':[{'UserId':null},{'UserId':_0x5c552b[_0xb23b('0x67')]['id']}]};var _0x59fbfa={'$or':[_0x100fdc,_0x4336cc]};var _0x3487ff=[];if(_0x5c552b[_0xb23b('0x59')]['direction']&&_0x5c552b['body'][_0xb23b('0x7f')]===_0xb23b('0x80')){if(!_[_0xb23b('0x81')](_0x5c552b[_0xb23b('0x59')][_0xb23b('0x82')])){_0x59fbfa['id']={'$in':_0x5c552b['body']['hopperIds']};}_0x3487ff=[[_0xb23b('0x83'),_0xb23b('0x84')],['scheduledAt',_0x331c20[0x0]['dialOrderByScheduledAt']===_0xb23b('0x84')?_0xb23b('0x85'):_0xb23b('0x84')],db['sequelize'][_0xb23b('0x86')](_0xb23b('0x87')),['id',_0xb23b('0x85')]];}else{if(!_[_0xb23b('0x81')](_0x5c552b[_0xb23b('0x59')]['hopperIds'])){_0x59fbfa['id']={'$notIn':_0x5c552b[_0xb23b('0x59')][_0xb23b('0x82')]};}_0x3487ff=[[_0xb23b('0x83'),'DESC'],[_0xb23b('0x88'),_0x331c20[0x0]['dialOrderByScheduledAt']],db['sequelize']['literal'](_0xb23b('0x89')),['id','ASC']];}return db[_0xb23b('0x51')][_0xb23b('0x8a')]({'attributes':['id',_0xb23b('0x8b'),_0xb23b('0x8c')],'where':_0x59fbfa,'order':_0x3487ff,'transaction':_0x56bace,'lock':_0x56bace[_0xb23b('0x8d')]['UPDATE'],'include':[{'model':db[_0xb23b('0x6f')],'as':_0xb23b('0x8e'),'attributes':_0x17bc21,'include':[{'model':db['CmCompany'],'as':_0xb23b('0x8f'),'attributes':['id',_0xb23b('0x26')]}]},{'model':db[_0xb23b('0x90')],'as':_0xb23b('0x91'),'attributes':['id','name']},{'model':db[_0xb23b('0x5f')],'as':'Queue','attributes':['id',_0xb23b('0x26'),'dialActive']}]})[_0xb23b('0x24')](function(_0x5053c2){if(_0x5053c2){return _0x5053c2[_0xb23b('0x23')]({'UserId':_0x5c552b[_0xb23b('0x67')]['id']},{'transaction':_0x56bace});}});});}})['then'](handleEntityNotFound(_0x11cee3,null))[_0xb23b('0x24')](respondWithResult(_0x11cee3,null))[_0xb23b('0x55')](handleError(_0x11cee3,null));};exports[_0xb23b('0x92')]=function(_0x373e4e,_0x377dd2,_0x15efac){return _0x373e4e['user']['getVoiceQueues']({'where':{'type':_0xb23b('0x78'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0xb23b('0x24')](function(_0x2cc776){if(_0x2cc776&&_0x2cc776[_0xb23b('0x47')]){return db['CmHopper'][_0xb23b('0x52')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xb23b('0x6a')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xb23b('0x28')](_0x2cc776,'id')},'$or':[{'UserId':null},{'UserId':_0x373e4e[_0xb23b('0x67')]['id']}]}});}return 0x0;})[_0xb23b('0x24')](function(_0x2abae3){if(!_[_0xb23b('0x72')](_0x2abae3)&&_[_0xb23b('0x93')](_0x2abae3)){return _0x377dd2['status'](0xc8)[_0xb23b('0x1b')]({'contacts':_0x2abae3});}else{logger[_0xb23b('0x25')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xb23b('0x92'),0x194,_0xb23b('0x94'));_0x377dd2['sendStatus'](0x194);}})[_0xb23b('0x55')](handleError(_0x377dd2,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 810e03c..360cd58 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 _0x7096=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','util','api'];(function(_0x6ef2c7,_0x1a6da5){var _0x5e0d27=function(_0x42d2e0){while(--_0x42d2e0){_0x6ef2c7['push'](_0x6ef2c7['shift']());}};_0x5e0d27(++_0x1a6da5);}(_0x7096,0x10c));var _0x6709=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x7096[_0x5447fd];return _0x15b28a;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var logger=require('../../config/logger')(_0x6709('0x1'));var moment=require('moment');var BPromise=require(_0x6709('0x2'));var rp=require(_0x6709('0x3'));var fs=require('fs');var path=require(_0x6709('0x4'));var rimraf=require(_0x6709('0x5'));var config=require(_0x6709('0x6'));var attributes=require(_0x6709('0x7'));module[_0x6709('0x8')]=function(_0x9d630f,_0xa35832){return _0x9d630f[_0x6709('0x9')](_0x6709('0xa'),attributes,{'tableName':_0x6709('0xb'),'paranoid':![],'indexes':[{'name':_0x6709('0xc'),'fields':['scheduledat']},{'name':'phone','fields':[_0x6709('0xd')]},{'name':_0x6709('0xe'),'fields':[_0x6709('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc6ac=['./cmHopper.attributes','exports','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x2614ec,_0x305db3){_0x2614ec=_0x2614ec-0x0;var _0x141a95=_0xc6ac[_0x2614ec];return _0x141a95;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var logger=require(_0xcc6a('0x2'))(_0xcc6a('0x3'));var moment=require(_0xcc6a('0x4'));var BPromise=require(_0xcc6a('0x5'));var rp=require(_0xcc6a('0x6'));var fs=require('fs');var path=require(_0xcc6a('0x7'));var rimraf=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var attributes=require(_0xcc6a('0xa'));module[_0xcc6a('0xb')]=function(_0x12330e,_0x197bd7){return _0x12330e['define'](_0xcc6a('0xc'),attributes,{'tableName':_0xcc6a('0xd'),'paranoid':![],'indexes':[{'name':_0xcc6a('0xe'),'fields':['scheduledat']},{'name':_0xcc6a('0xf'),'fields':[_0xcc6a('0xf')]},{'name':_0xcc6a('0x10'),'fields':[_0xcc6a('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 685b05b..e45c863 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 _0x008d=['CmContact','describe','sequelize','transaction','findAll','order','LOCK','keys','User','Agent','name','voicePause','UserId','push','length','dataValues','ContactId','MoveContactManagedDialer','CountReScheduled','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','UPDATE','all','Contact','ResetActiveCalls','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','request','then','CmHopper,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','GetCmHopper','CmHopper','raw','options','attributes','limit','include','map','model','debug','catch','ShowCmHopper','find','where','CreateCmHopper','create','UpdateCmHopper','update','body','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer'];(function(_0x9d2771,_0xb12659){var _0x194fda=function(_0x1b7127){while(--_0x1b7127){_0x9d2771['push'](_0x9d2771['shift']());}};_0x194fda(++_0xb12659);}(_0x008d,0xf7));var _0xd008=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x008d[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0xd008('0x0'));var util=require(_0xd008('0x1'));var moment=require('moment');var BPromise=require(_0xd008('0x2'));var rs=require(_0xd008('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd008('0x4'))['db'];var utils=require(_0xd008('0x5'));var logger=require('../../config/logger')(_0xd008('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x22405f,_0x535ab5,_0x52b75e){return new BPromise(function(_0x2aa30e,_0x41ab0d){return client[_0xd008('0x7')](_0x22405f,_0x52b75e)[_0xd008('0x8')](function(_0x547201){logger['info'](_0xd008('0x9'),_0x535ab5,_0xd008('0xa'));logger['debug']('CmHopper,\x20%s,\x20%s,\x20%s',_0x535ab5,_0xd008('0xa'),JSON[_0xd008('0xb')](_0x547201));if(_0x547201[_0xd008('0xc')]){if(_0x547201[_0xd008('0xc')][_0xd008('0xd')]===0x1f4){logger[_0xd008('0xc')]('CmHopper,\x20%s,\x20%s',_0x535ab5,_0x547201[_0xd008('0xc')][_0xd008('0xe')]);return _0x41ab0d(_0x547201['error'][_0xd008('0xe')]);}logger['error'](_0xd008('0x9'),_0x535ab5,_0x547201[_0xd008('0xc')][_0xd008('0xe')]);return _0x2aa30e(_0x547201['error'][_0xd008('0xe')]);}else{logger[_0xd008('0xf')](_0xd008('0x9'),_0x535ab5,_0xd008('0xa'));_0x2aa30e(_0x547201[_0xd008('0x10')][_0xd008('0xe')]);}})['catch'](function(_0x32e296){logger['error'](_0xd008('0x9'),_0x535ab5,_0x32e296);_0x41ab0d(_0x32e296);});});}exports[_0xd008('0x11')]=function(_0x4c7f5c){var _0x215721=this;return new Promise(function(_0x4b2b1a,_0x5e9a03){return db[_0xd008('0x12')]['findAll']({'raw':_0x4c7f5c['options']?_0x4c7f5c['options'][_0xd008('0x13')]===undefined?!![]:![]:!![],'where':_0x4c7f5c[_0xd008('0x14')]?_0x4c7f5c[_0xd008('0x14')]['where']||null:null,'attributes':_0x4c7f5c['options']?_0x4c7f5c[_0xd008('0x14')][_0xd008('0x15')]||null:null,'limit':_0x4c7f5c[_0xd008('0x14')]?_0x4c7f5c[_0xd008('0x14')][_0xd008('0x16')]||null:null,'include':_0x4c7f5c[_0xd008('0x14')]?_0x4c7f5c['options'][_0xd008('0x17')]?_[_0xd008('0x18')](_0x4c7f5c[_0xd008('0x14')]['include'],function(_0x5d7641){return{'model':db[_0x5d7641[_0xd008('0x19')]],'as':_0x5d7641['as'],'attributes':_0x5d7641[_0xd008('0x15')],'include':_0x5d7641['include']?_[_0xd008('0x18')](_0x5d7641[_0xd008('0x17')],function(_0x5a89af){return{'model':db[_0x5a89af[_0xd008('0x19')]],'as':_0x5a89af['as'],'attributes':_0x5a89af[_0xd008('0x15')],'include':_0x5a89af['include']?_[_0xd008('0x18')](_0x5a89af[_0xd008('0x17')],function(_0x2d55d1){return{'model':db[_0x2d55d1[_0xd008('0x19')]],'as':_0x2d55d1['as'],'attributes':_0x2d55d1[_0xd008('0x15')]};}):[]};}):[]};}):[]:[]})[_0xd008('0x8')](function(_0x34afb7){logger['info'](_0xd008('0x11'),_0x4c7f5c);logger[_0xd008('0x1a')](_0xd008('0x11'),_0x4c7f5c,JSON['stringify'](_0x34afb7));_0x4b2b1a(_0x34afb7);})[_0xd008('0x1b')](function(_0x29fa79){logger[_0xd008('0xc')](_0xd008('0x11'),_0x29fa79[_0xd008('0xe')],_0x4c7f5c);_0x5e9a03(_0x215721[_0xd008('0xc')](0x1f4,_0x29fa79[_0xd008('0xe')]));});});};exports[_0xd008('0x1c')]=function(_0x495985){var _0x72fde=this;return new Promise(function(_0x51a40a,_0x1799d6){return db[_0xd008('0x12')][_0xd008('0x1d')]({'raw':_0x495985[_0xd008('0x14')]?_0x495985[_0xd008('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x495985[_0xd008('0x14')]?_0x495985[_0xd008('0x14')][_0xd008('0x1e')]||null:null,'attributes':_0x495985[_0xd008('0x14')]?_0x495985[_0xd008('0x14')][_0xd008('0x15')]||null:null,'include':_0x495985[_0xd008('0x14')]?_0x495985[_0xd008('0x14')][_0xd008('0x17')]?_[_0xd008('0x18')](_0x495985[_0xd008('0x14')][_0xd008('0x17')],function(_0x4052a0){return{'model':db[_0x4052a0[_0xd008('0x19')]],'as':_0x4052a0['as'],'attributes':_0x4052a0[_0xd008('0x15')],'include':_0x4052a0['include']?_[_0xd008('0x18')](_0x4052a0['include'],function(_0x1784b7){return{'model':db[_0x1784b7[_0xd008('0x19')]],'as':_0x1784b7['as'],'attributes':_0x1784b7['attributes'],'include':_0x1784b7['include']?_[_0xd008('0x18')](_0x1784b7[_0xd008('0x17')],function(_0x396d00){return{'model':db[_0x396d00[_0xd008('0x19')]],'as':_0x396d00['as'],'attributes':_0x396d00[_0xd008('0x15')]};}):[]};}):[]};}):[]:[]})[_0xd008('0x8')](function(_0x878d0){logger[_0xd008('0xf')](_0xd008('0x1c'),_0x495985);logger[_0xd008('0x1a')](_0xd008('0x1c'),_0x495985,JSON['stringify'](_0x878d0));_0x51a40a(_0x878d0);})[_0xd008('0x1b')](function(_0x3a9dd9){logger[_0xd008('0xc')](_0xd008('0x1c'),_0x3a9dd9['message'],_0x495985);_0x1799d6(_0x72fde['error'](0x1f4,_0x3a9dd9[_0xd008('0xe')]));});});};exports[_0xd008('0x1f')]=function(_0xf73da6){var _0x44434a=this;return new Promise(function(_0x27ca4a,_0x5a83d7){return db[_0xd008('0x12')][_0xd008('0x20')](_0xf73da6['body'],{'raw':_0xf73da6[_0xd008('0x14')]?_0xf73da6[_0xd008('0x14')][_0xd008('0x13')]===undefined?!![]:![]:!![]})[_0xd008('0x8')](function(_0x327542){logger[_0xd008('0xf')](_0xd008('0x1f'),_0xf73da6);logger[_0xd008('0x1a')](_0xd008('0x1f'),_0xf73da6,JSON[_0xd008('0xb')](_0x327542));_0x27ca4a(_0x327542);})[_0xd008('0x1b')](function(_0x5006e5){logger[_0xd008('0xc')]('CreateCmHopper',_0x5006e5[_0xd008('0xe')],_0xf73da6);_0x5a83d7(_0x44434a['error'](0x1f4,_0x5006e5['message']));});});};exports[_0xd008('0x21')]=function(_0x43f19b){var _0x388099=this;return new Promise(function(_0x51e2,_0x8c566e){return db[_0xd008('0x12')][_0xd008('0x22')](_0x43f19b[_0xd008('0x23')],{'raw':_0x43f19b['options']?_0x43f19b['options'][_0xd008('0x13')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43f19b[_0xd008('0x14')]?_0x43f19b[_0xd008('0x14')][_0xd008('0x1e')]||null:null,'attributes':_0x43f19b[_0xd008('0x14')]?_0x43f19b[_0xd008('0x14')][_0xd008('0x15')]||null:null,'limit':_0x43f19b[_0xd008('0x14')]?_0x43f19b[_0xd008('0x14')]['limit']||null:null})[_0xd008('0x8')](function(_0x3f9999){logger[_0xd008('0xf')](_0xd008('0x21'),_0x43f19b);logger[_0xd008('0xf')](_0xd008('0x24'),JSON[_0xd008('0xb')](_0x43f19b[_0xd008('0x14')][_0xd008('0x1e')]),_0x43f19b[_0xd008('0x23')][_0xd008('0x25')]);logger[_0xd008('0x1a')](_0xd008('0x21'),_0x43f19b,JSON[_0xd008('0xb')](_0x3f9999));_0x51e2(_0x3f9999);})[_0xd008('0x1b')](function(_0x16bdf4){logger[_0xd008('0xc')](_0xd008('0x21'),_0x16bdf4[_0xd008('0xe')],_0x43f19b);_0x8c566e(_0x388099[_0xd008('0xc')](0x1f4,_0x16bdf4[_0xd008('0xe')]));});});};exports[_0xd008('0x26')]=function(_0x3b63c3){var _0x2ceac7=this;return new Promise(function(_0x5a06dd,_0x1b8405){return db['CmHopper'][_0xd008('0x27')]({'where':_0x3b63c3[_0xd008('0x14')]?_0x3b63c3[_0xd008('0x14')][_0xd008('0x1e')]||null:null})[_0xd008('0x8')](function(_0x73468d){logger[_0xd008('0xf')](_0xd008('0x26'),_0x3b63c3);logger[_0xd008('0x1a')](_0xd008('0x26'),_0x3b63c3,JSON[_0xd008('0xb')](_0x73468d));_0x5a06dd(_0x73468d);})['catch'](function(_0x5adffe){logger[_0xd008('0xc')](_0xd008('0x26'),_0x5adffe[_0xd008('0xe')],_0x3b63c3);_0x1b8405(_0x2ceac7['error'](0x1f4,_0x5adffe[_0xd008('0xe')]));});});};exports[_0xd008('0x28')]=function(_0x6ccd66){var _0x3a17e8=this;return new Promise(function(_0x15796b,_0x4c4798){return db[_0xd008('0x29')][_0xd008('0x2a')]()[_0xd008('0x8')](function(_0x5ac2c3){return db[_0xd008('0x2b')][_0xd008('0x2c')](function(_0x146f75){return db[_0xd008('0x12')][_0xd008('0x2d')]({'where':_0x6ccd66['options']?_0x6ccd66['options'][_0xd008('0x1e')]||null:null,'attributes':_0x6ccd66[_0xd008('0x14')]?_0x6ccd66[_0xd008('0x14')][_0xd008('0x15')]||null:null,'limit':_0x6ccd66['options']?_0x6ccd66[_0xd008('0x14')]['limit']||null:null,'order':_0x6ccd66[_0xd008('0x14')]?_0x6ccd66[_0xd008('0x14')][_0xd008('0x2e')]||null:null,'transaction':_0x146f75,'lock':_0x146f75[_0xd008('0x2f')]['UPDATE'],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_[_0xd008('0x30')](_0x5ac2c3)},{'model':db[_0xd008('0x31')],'as':_0xd008('0x32'),'attributes':['id',_0xd008('0x33'),_0xd008('0x34')]}]})[_0xd008('0x8')](function(_0x2f6b1f){var _0xe7a194=[];var _0x53c89e=[];for(var _0x39b5ad=0x0;_0x39b5ad<_0x2f6b1f['length'];_0x39b5ad+=0x1){var _0x4b09c6=_0x2f6b1f[_0x39b5ad][_0xd008('0x35')];if(_0x4b09c6===null){_0xe7a194[_0xd008('0x36')](_0x2f6b1f[_0x39b5ad]['update'](_0x6ccd66[_0xd008('0x23')],{'transaction':_0x146f75}));}else if(!_0x53c89e['includes'](_0x4b09c6)){_0x53c89e[_0xd008('0x36')](_0x4b09c6);_0xe7a194[_0xd008('0x36')](_0x2f6b1f[_0x39b5ad][_0xd008('0x22')](_0x6ccd66[_0xd008('0x23')],{'transaction':_0x146f75}));}}return BPromise['all'](_0xe7a194);});})[_0xd008('0x8')](function(_0x771d46){logger[_0xd008('0xf')](_0xd008('0x28'),_0x6ccd66);if(_0x771d46[_0xd008('0x37')]>0x0){logger[_0xd008('0xf')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x771d46[0x0]['dataValues']['id'],_0x771d46[0x0][_0xd008('0x38')][_0xd008('0x39')],_0x771d46[0x0][_0xd008('0x38')][_0xd008('0x25')]);}logger[_0xd008('0x1a')](_0xd008('0x28'),_0x6ccd66,JSON[_0xd008('0xb')](_0x771d46));_0x15796b(_0x771d46);})[_0xd008('0x1b')](function(_0x3b4cb5){logger[_0xd008('0xc')](_0xd008('0x28'),_0x3b4cb5[_0xd008('0xe')],_0x6ccd66);_0x4c4798(_0x3a17e8[_0xd008('0xc')](0x1f4,_0x3b4cb5[_0xd008('0xe')]));});});});};exports[_0xd008('0x3a')]=function(_0x365b0c){var _0x548e6c=this;return new Promise(function(_0x25f190,_0x5db892){return db[_0xd008('0x2b')][_0xd008('0x2c')](function(_0x2fa69d){return db['CmHopperFinal'][_0xd008('0x20')](_0x365b0c[_0xd008('0x23')],{'raw':_0x365b0c[_0xd008('0x14')]?_0x365b0c[_0xd008('0x14')][_0xd008('0x13')]===undefined?!![]:![]:!![],'transaction':_0x2fa69d})[_0xd008('0x8')](function(){logger[_0xd008('0xf')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xd008('0xb')](_0x365b0c[_0xd008('0x14')][_0xd008('0x1e')]),_0x365b0c['options']['where'][_0xd008('0x25')]);return db[_0xd008('0x12')][_0xd008('0x27')]({'where':_0x365b0c[_0xd008('0x14')]?_0x365b0c[_0xd008('0x14')][_0xd008('0x1e')]||null:null,'transaction':_0x2fa69d});});})[_0xd008('0x8')](function(_0x2278f0){logger[_0xd008('0xf')](_0xd008('0x3a'),_0x365b0c);logger['debug'](_0xd008('0x3a'),_0x365b0c,JSON['stringify'](_0x2278f0));_0x25f190(_0x2278f0);})['catch'](function(_0x114af0){logger['error'](_0xd008('0x3a'),_0x114af0[_0xd008('0xe')],_0x365b0c);_0x5db892(_0x548e6c[_0xd008('0xc')](0x1f4,_0x114af0[_0xd008('0xe')]));});});};exports[_0xd008('0x3b')]=function(_0x2120a3){var _0x1572f0=this;return new Promise(function(_0x38b370,_0x22ac32){return db['CmHopper'][_0xd008('0x2d')]({'raw':_0x2120a3[_0xd008('0x14')]?_0x2120a3[_0xd008('0x14')][_0xd008('0x13')]===undefined?!![]:![]:!![],'where':_0x2120a3[_0xd008('0x14')]?_0x2120a3['options'][_0xd008('0x1e')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0xd008('0x2b')]['fn']('IF',db[_0xd008('0x2b')][_0xd008('0x3c')](_0xd008('0x3d')+util[_0xd008('0x3e')](_0xd008('0x3f'),moment()[_0xd008('0x3e')](_0xd008('0x40')))+_0xd008('0x41')))),_0xd008('0x42')]]})[_0xd008('0x8')](function(_0x328efe){logger['info'](_0xd008('0x3b'),_0x2120a3);logger[_0xd008('0x1a')](_0xd008('0x3b'),_0x2120a3,JSON[_0xd008('0xb')](_0x328efe));_0x38b370(_0x328efe);})[_0xd008('0x1b')](function(_0x170469){logger[_0xd008('0xc')](_0xd008('0x3b'),_0x170469['message'],_0x2120a3);_0x22ac32(_0x1572f0['error'](0x1f4,_0x170469[_0xd008('0xe')]));});});};exports[_0xd008('0x43')]=function(_0x3302b1){var _0x43a3c0=this;return new Promise(function(_0x1f62ee,_0x15ae0f){return db[_0xd008('0x29')][_0xd008('0x2a')]()[_0xd008('0x8')](function(_0x58e496){return db[_0xd008('0x2b')][_0xd008('0x2c')](function(_0x308b21){return db[_0xd008('0x12')]['findAll']({'where':_0x3302b1['options']?_0x3302b1[_0xd008('0x14')]['where']||null:null,'attributes':_0x3302b1[_0xd008('0x14')]?_0x3302b1[_0xd008('0x14')][_0xd008('0x15')]||null:null,'limit':0x1,'order':_0x3302b1[_0xd008('0x14')]?_0x3302b1[_0xd008('0x14')][_0xd008('0x2e')]||null:null,'group':db[_0xd008('0x12')][_0xd008('0x35')],'transaction':_0x308b21,'lock':_0x308b21[_0xd008('0x2f')][_0xd008('0x44')],'include':_0x3302b1[_0xd008('0x14')]?_0x3302b1[_0xd008('0x14')][_0xd008('0x17')]?_[_0xd008('0x18')](_0x3302b1[_0xd008('0x14')]['include'],function(_0x52659e){return{'model':db[_0x52659e[_0xd008('0x19')]],'as':_0x52659e['as'],'attributes':_0x52659e[_0xd008('0x15')],'include':_0x52659e[_0xd008('0x17')]?_[_0xd008('0x18')](_0x52659e[_0xd008('0x17')],function(_0x3edd73){return{'model':db[_0x3edd73['model']],'as':_0x3edd73['as'],'attributes':_0x3edd73['attributes'],'include':_0x3edd73['include']?_[_0xd008('0x18')](_0x3edd73[_0xd008('0x17')],function(_0x22d36e){return{'model':db[_0x22d36e[_0xd008('0x19')]],'as':_0x22d36e['as'],'attributes':_0x22d36e['attributes']};}):[]};}):[]};}):[]:[]})[_0xd008('0x8')](function(_0x3fb32b){var _0x41d0f6=[];for(var _0x534c9f=0x0;_0x534c9f<_0x3fb32b['length'];_0x534c9f+=0x1){_0x41d0f6[_0xd008('0x36')](_0x3fb32b[_0x534c9f]['update'](_0x3302b1[_0xd008('0x23')],{'transaction':_0x308b21}));}return BPromise[_0xd008('0x45')](_0x41d0f6);});})[_0xd008('0x8')](function(_0x2ef7b0){logger[_0xd008('0xf')](_0xd008('0x43'),_0x3302b1);logger['debug']('GetContactRecallMe',_0x3302b1,JSON[_0xd008('0xb')](_0x2ef7b0));_0x1f62ee(_0x2ef7b0);})['catch'](function(_0xe07c93){logger[_0xd008('0xc')]('GetContactRecallMe',_0xe07c93[_0xd008('0xe')],_0x3302b1);_0x15ae0f(_0x43a3c0[_0xd008('0xc')](0x1f4,_0xe07c93[_0xd008('0xe')]));});});});};exports['GetCmHopperPreview']=function(_0x599263){var _0x438a76=this;return new Promise(function(_0x479e94,_0x5653b3){db[_0xd008('0x29')][_0xd008('0x2a')]()['then'](function(_0x55d8e4){return db['CmHopper'][_0xd008('0x2d')]({'raw':_0x599263[_0xd008('0x14')]?_0x599263['options'][_0xd008('0x13')]===undefined?!![]:![]:!![],'where':_0x599263[_0xd008('0x14')]?_0x599263['options'][_0xd008('0x1e')]||null:null,'attributes':_0x599263[_0xd008('0x14')]?_0x599263[_0xd008('0x14')][_0xd008('0x15')]||null:null,'limit':_0x599263[_0xd008('0x14')]?_0x599263[_0xd008('0x14')][_0xd008('0x16')]||null:null,'include':_0x599263[_0xd008('0x14')]?_0x599263[_0xd008('0x14')][_0xd008('0x17')]?_[_0xd008('0x18')](_0x599263[_0xd008('0x14')][_0xd008('0x17')],function(_0x421fa0){return{'model':db[_0x421fa0['model']],'as':_0x421fa0['as'],'attributes':_0x421fa0['as']===_0xd008('0x46')?_[_0xd008('0x30')](_0x55d8e4):_0x421fa0[_0xd008('0x15')],'include':_0x421fa0['include']?_[_0xd008('0x18')](_0x421fa0[_0xd008('0x17')],function(_0x53ddd7){return{'model':db[_0x53ddd7['model']],'as':_0x53ddd7['as'],'attributes':_0x53ddd7[_0xd008('0x15')],'include':_0x53ddd7['include']?_[_0xd008('0x18')](_0x53ddd7[_0xd008('0x17')],function(_0x10c450){return{'model':db[_0x10c450[_0xd008('0x19')]],'as':_0x10c450['as'],'attributes':_0x10c450[_0xd008('0x15')]};}):[]};}):[]};}):[]:[]})[_0xd008('0x8')](function(_0x35a036){logger['info']('GetCmHopper',_0x599263);logger[_0xd008('0x1a')](_0xd008('0x11'),_0x599263,JSON[_0xd008('0xb')](_0x35a036));_0x479e94(_0x35a036);})['catch'](function(_0x89406a){logger[_0xd008('0xc')](_0xd008('0x11'),_0x89406a[_0xd008('0xe')],_0x599263);_0x5653b3(_0x438a76[_0xd008('0xc')](0x1f4,_0x89406a[_0xd008('0xe')]));});});});};exports['ResetActiveCalls']=function(_0x14c30f){var _0x27cf44=this;return new Promise(function(_0x107309,_0x372584){return db[_0xd008('0x2b')][_0xd008('0x2c')](function(_0x2f3ec5){return db['CmHopper'][_0xd008('0x22')]({'active':![]},{'where':{},'transaction':_0x2f3ec5})[_0xd008('0x8')](function(_0x47ef2f){logger['info']('ResetActiveCalls',_0x14c30f);logger[_0xd008('0x1a')]('ResetActiveCalls',_0x14c30f,JSON['stringify'](_0x47ef2f));_0x107309(_0x47ef2f);})[_0xd008('0x1b')](function(_0x32406b){logger[_0xd008('0xc')](_0xd008('0x47'),_0x32406b[_0xd008('0xe')],_0x14c30f);_0x372584(_0x27cf44[_0xd008('0xc')](0x1f4,_0x32406b[_0xd008('0xe')]));});});});}; \ No newline at end of file +var _0x5885=['active','destroy','DestroyCmHopper','describe','sequelize','transaction','order','LOCK','UPDATE','CmContact','Contact','keys','User','name','voicePause','push','all','GetContactDialer','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','MoveContactManagedDialer','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','GetContactRecallMe','ResetActiveCalls','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopper,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','ShowCmHopper','find','CreateCmHopper','create','body','UpdateCmHopper','update'];(function(_0x37ea09,_0x52e8cc){var _0x55b39e=function(_0x2d5cc3){while(--_0x2d5cc3){_0x37ea09['push'](_0x37ea09['shift']());}};_0x55b39e(++_0x52e8cc);}(_0x5885,0x1db));var _0x5588=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5885[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x5588('0x0'));var util=require(_0x5588('0x1'));var moment=require(_0x5588('0x2'));var BPromise=require(_0x5588('0x3'));var rs=require(_0x5588('0x4'));var fs=require('fs');var Redis=require(_0x5588('0x5'));var db=require(_0x5588('0x6'))['db'];var utils=require(_0x5588('0x7'));var logger=require('../../config/logger')(_0x5588('0x8'));var config=require(_0x5588('0x9'));var jayson=require(_0x5588('0xa'));var client=jayson[_0x5588('0xb')][_0x5588('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x163c1d,_0x525d14,_0x19a365){return new BPromise(function(_0x18bbff,_0x5c2f7a){return client[_0x5588('0xd')](_0x163c1d,_0x19a365)[_0x5588('0xe')](function(_0x2e97c3){logger[_0x5588('0xf')](_0x5588('0x10'),_0x525d14,'request\x20sent');logger[_0x5588('0x11')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x525d14,'request\x20sent',JSON[_0x5588('0x12')](_0x2e97c3));if(_0x2e97c3[_0x5588('0x13')]){if(_0x2e97c3[_0x5588('0x13')][_0x5588('0x14')]===0x1f4){logger[_0x5588('0x13')](_0x5588('0x10'),_0x525d14,_0x2e97c3[_0x5588('0x13')]['message']);return _0x5c2f7a(_0x2e97c3[_0x5588('0x13')][_0x5588('0x15')]);}logger[_0x5588('0x13')]('CmHopper,\x20%s,\x20%s',_0x525d14,_0x2e97c3[_0x5588('0x13')]['message']);return _0x18bbff(_0x2e97c3['error'][_0x5588('0x15')]);}else{logger[_0x5588('0xf')]('CmHopper,\x20%s,\x20%s',_0x525d14,_0x5588('0x16'));_0x18bbff(_0x2e97c3[_0x5588('0x17')]['message']);}})[_0x5588('0x18')](function(_0x7e5f2e){logger[_0x5588('0x13')](_0x5588('0x10'),_0x525d14,_0x7e5f2e);_0x5c2f7a(_0x7e5f2e);});});}exports[_0x5588('0x19')]=function(_0x589d38){var _0x49abb5=this;return new Promise(function(_0x3beea4,_0x58af22){return db[_0x5588('0x1a')][_0x5588('0x1b')]({'raw':_0x589d38[_0x5588('0x1c')]?_0x589d38[_0x5588('0x1c')][_0x5588('0x1d')]===undefined?!![]:![]:!![],'where':_0x589d38[_0x5588('0x1c')]?_0x589d38[_0x5588('0x1c')][_0x5588('0x1e')]||null:null,'attributes':_0x589d38[_0x5588('0x1c')]?_0x589d38[_0x5588('0x1c')][_0x5588('0x1f')]||null:null,'limit':_0x589d38[_0x5588('0x1c')]?_0x589d38[_0x5588('0x1c')][_0x5588('0x20')]||null:null,'include':_0x589d38['options']?_0x589d38[_0x5588('0x1c')][_0x5588('0x21')]?_[_0x5588('0x22')](_0x589d38['options'][_0x5588('0x21')],function(_0x48ffd5){return{'model':db[_0x48ffd5[_0x5588('0x23')]],'as':_0x48ffd5['as'],'attributes':_0x48ffd5[_0x5588('0x1f')],'include':_0x48ffd5['include']?_[_0x5588('0x22')](_0x48ffd5[_0x5588('0x21')],function(_0x16aa72){return{'model':db[_0x16aa72[_0x5588('0x23')]],'as':_0x16aa72['as'],'attributes':_0x16aa72['attributes'],'include':_0x16aa72[_0x5588('0x21')]?_[_0x5588('0x22')](_0x16aa72[_0x5588('0x21')],function(_0x19c4ba){return{'model':db[_0x19c4ba['model']],'as':_0x19c4ba['as'],'attributes':_0x19c4ba[_0x5588('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5588('0xe')](function(_0x222edf){logger[_0x5588('0xf')](_0x5588('0x19'),_0x589d38);logger['debug'](_0x5588('0x19'),_0x589d38,JSON['stringify'](_0x222edf));_0x3beea4(_0x222edf);})[_0x5588('0x18')](function(_0x3406dd){logger[_0x5588('0x13')]('GetCmHopper',_0x3406dd[_0x5588('0x15')],_0x589d38);_0x58af22(_0x49abb5[_0x5588('0x13')](0x1f4,_0x3406dd['message']));});});};exports[_0x5588('0x24')]=function(_0x4782e9){var _0x5dfac8=this;return new Promise(function(_0x2b7ead,_0x176e62){return db[_0x5588('0x1a')][_0x5588('0x25')]({'raw':_0x4782e9[_0x5588('0x1c')]?_0x4782e9[_0x5588('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4782e9['options']?_0x4782e9['options']['where']||null:null,'attributes':_0x4782e9[_0x5588('0x1c')]?_0x4782e9[_0x5588('0x1c')]['attributes']||null:null,'include':_0x4782e9[_0x5588('0x1c')]?_0x4782e9['options'][_0x5588('0x21')]?_[_0x5588('0x22')](_0x4782e9[_0x5588('0x1c')][_0x5588('0x21')],function(_0x28c4db){return{'model':db[_0x28c4db[_0x5588('0x23')]],'as':_0x28c4db['as'],'attributes':_0x28c4db['attributes'],'include':_0x28c4db['include']?_[_0x5588('0x22')](_0x28c4db[_0x5588('0x21')],function(_0x73c4f0){return{'model':db[_0x73c4f0['model']],'as':_0x73c4f0['as'],'attributes':_0x73c4f0['attributes'],'include':_0x73c4f0[_0x5588('0x21')]?_[_0x5588('0x22')](_0x73c4f0['include'],function(_0x2566c5){return{'model':db[_0x2566c5[_0x5588('0x23')]],'as':_0x2566c5['as'],'attributes':_0x2566c5[_0x5588('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5588('0xe')](function(_0x270993){logger[_0x5588('0xf')](_0x5588('0x24'),_0x4782e9);logger['debug']('ShowCmHopper',_0x4782e9,JSON['stringify'](_0x270993));_0x2b7ead(_0x270993);})[_0x5588('0x18')](function(_0x2bc50c){logger['error'](_0x5588('0x24'),_0x2bc50c['message'],_0x4782e9);_0x176e62(_0x5dfac8[_0x5588('0x13')](0x1f4,_0x2bc50c[_0x5588('0x15')]));});});};exports[_0x5588('0x26')]=function(_0x5eb4ae){var _0x506d68=this;return new Promise(function(_0x4778d2,_0x2958ae){return db[_0x5588('0x1a')][_0x5588('0x27')](_0x5eb4ae[_0x5588('0x28')],{'raw':_0x5eb4ae[_0x5588('0x1c')]?_0x5eb4ae[_0x5588('0x1c')][_0x5588('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x226fc1){logger[_0x5588('0xf')](_0x5588('0x26'),_0x5eb4ae);logger[_0x5588('0x11')](_0x5588('0x26'),_0x5eb4ae,JSON['stringify'](_0x226fc1));_0x4778d2(_0x226fc1);})[_0x5588('0x18')](function(_0x2f19dd){logger[_0x5588('0x13')]('CreateCmHopper',_0x2f19dd[_0x5588('0x15')],_0x5eb4ae);_0x2958ae(_0x506d68['error'](0x1f4,_0x2f19dd[_0x5588('0x15')]));});});};exports[_0x5588('0x29')]=function(_0xee843e){var _0x4638ef=this;return new Promise(function(_0x2783ce,_0x327263){return db[_0x5588('0x1a')][_0x5588('0x2a')](_0xee843e[_0x5588('0x28')],{'raw':_0xee843e['options']?_0xee843e[_0x5588('0x1c')][_0x5588('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xee843e[_0x5588('0x1c')]?_0xee843e[_0x5588('0x1c')][_0x5588('0x1e')]||null:null,'attributes':_0xee843e['options']?_0xee843e['options']['attributes']||null:null,'limit':_0xee843e[_0x5588('0x1c')]?_0xee843e[_0x5588('0x1c')]['limit']||null:null})[_0x5588('0xe')](function(_0x4d7799){logger['info'](_0x5588('0x29'),_0xee843e);logger[_0x5588('0xf')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x5588('0x12')](_0xee843e[_0x5588('0x1c')][_0x5588('0x1e')]),_0xee843e[_0x5588('0x28')][_0x5588('0x2b')]);logger['debug'](_0x5588('0x29'),_0xee843e,JSON['stringify'](_0x4d7799));_0x2783ce(_0x4d7799);})[_0x5588('0x18')](function(_0x5359f0){logger[_0x5588('0x13')]('UpdateCmHopper',_0x5359f0['message'],_0xee843e);_0x327263(_0x4638ef[_0x5588('0x13')](0x1f4,_0x5359f0[_0x5588('0x15')]));});});};exports['DestroyCmHopper']=function(_0x15e650){var _0x38c336=this;return new Promise(function(_0x33305c,_0x3eea54){return db[_0x5588('0x1a')][_0x5588('0x2c')]({'where':_0x15e650[_0x5588('0x1c')]?_0x15e650[_0x5588('0x1c')][_0x5588('0x1e')]||null:null})[_0x5588('0xe')](function(_0x15765c){logger[_0x5588('0xf')](_0x5588('0x2d'),_0x15e650);logger['debug'](_0x5588('0x2d'),_0x15e650,JSON[_0x5588('0x12')](_0x15765c));_0x33305c(_0x15765c);})[_0x5588('0x18')](function(_0x1f7b99){logger[_0x5588('0x13')](_0x5588('0x2d'),_0x1f7b99[_0x5588('0x15')],_0x15e650);_0x3eea54(_0x38c336[_0x5588('0x13')](0x1f4,_0x1f7b99['message']));});});};exports['GetContactDialer']=function(_0x46b70f){var _0x97e628=this;return new Promise(function(_0x5dce3a,_0x1aeb77){return db['CmContact'][_0x5588('0x2e')]()[_0x5588('0xe')](function(_0x9c08ec){return db[_0x5588('0x2f')][_0x5588('0x30')](function(_0x5995b7){return db[_0x5588('0x1a')]['findAll']({'where':_0x46b70f[_0x5588('0x1c')]?_0x46b70f['options'][_0x5588('0x1e')]||null:null,'attributes':_0x46b70f[_0x5588('0x1c')]?_0x46b70f[_0x5588('0x1c')]['attributes']||null:null,'limit':_0x46b70f[_0x5588('0x1c')]?_0x46b70f[_0x5588('0x1c')][_0x5588('0x20')]||null:null,'order':_0x46b70f[_0x5588('0x1c')]?_0x46b70f[_0x5588('0x1c')][_0x5588('0x31')]||null:null,'transaction':_0x5995b7,'lock':_0x5995b7[_0x5588('0x32')][_0x5588('0x33')],'include':[{'model':db[_0x5588('0x34')],'as':_0x5588('0x35'),'attributes':_[_0x5588('0x36')](_0x9c08ec)},{'model':db[_0x5588('0x37')],'as':'Agent','attributes':['id',_0x5588('0x38'),_0x5588('0x39')]}]})[_0x5588('0xe')](function(_0x25ad29){var _0x58d125=[];var _0x4a057f=[];for(var _0x1a72e4=0x0;_0x1a72e4<_0x25ad29['length'];_0x1a72e4+=0x1){var _0x2fe187=_0x25ad29[_0x1a72e4]['UserId'];if(_0x2fe187===null){_0x58d125['push'](_0x25ad29[_0x1a72e4][_0x5588('0x2a')](_0x46b70f['body'],{'transaction':_0x5995b7}));}else if(!_0x4a057f['includes'](_0x2fe187)){_0x4a057f[_0x5588('0x3a')](_0x2fe187);_0x58d125[_0x5588('0x3a')](_0x25ad29[_0x1a72e4][_0x5588('0x2a')](_0x46b70f[_0x5588('0x28')],{'transaction':_0x5995b7}));}}return BPromise[_0x5588('0x3b')](_0x58d125);});})['then'](function(_0x3307ce){logger[_0x5588('0xf')](_0x5588('0x3c'),_0x46b70f);if(_0x3307ce[_0x5588('0x3d')]>0x0){logger['info'](_0x5588('0x3e'),_0x3307ce[0x0][_0x5588('0x3f')]['id'],_0x3307ce[0x0][_0x5588('0x3f')]['ContactId'],_0x3307ce[0x0][_0x5588('0x3f')][_0x5588('0x2b')]);}logger[_0x5588('0x11')](_0x5588('0x3c'),_0x46b70f,JSON[_0x5588('0x12')](_0x3307ce));_0x5dce3a(_0x3307ce);})[_0x5588('0x18')](function(_0x2d4fe7){logger[_0x5588('0x13')]('GetContactDialer',_0x2d4fe7[_0x5588('0x15')],_0x46b70f);_0x1aeb77(_0x97e628['error'](0x1f4,_0x2d4fe7[_0x5588('0x15')]));});});});};exports[_0x5588('0x40')]=function(_0xff5522){var _0x340753=this;return new Promise(function(_0x3be7ec,_0x3f6256){return db[_0x5588('0x2f')][_0x5588('0x30')](function(_0x5b12c5){return db['CmHopperFinal'][_0x5588('0x27')](_0xff5522[_0x5588('0x28')],{'raw':_0xff5522[_0x5588('0x1c')]?_0xff5522[_0x5588('0x1c')][_0x5588('0x1d')]===undefined?!![]:![]:!![],'transaction':_0x5b12c5})[_0x5588('0xe')](function(){logger[_0x5588('0xf')](_0x5588('0x41'),JSON[_0x5588('0x12')](_0xff5522[_0x5588('0x1c')]['where']),_0xff5522[_0x5588('0x1c')][_0x5588('0x1e')][_0x5588('0x2b')]);return db['CmHopper'][_0x5588('0x2c')]({'where':_0xff5522[_0x5588('0x1c')]?_0xff5522['options']['where']||null:null,'transaction':_0x5b12c5});});})[_0x5588('0xe')](function(_0x28b133){logger[_0x5588('0xf')](_0x5588('0x40'),_0xff5522);logger[_0x5588('0x11')](_0x5588('0x40'),_0xff5522,JSON[_0x5588('0x12')](_0x28b133));_0x3be7ec(_0x28b133);})[_0x5588('0x18')](function(_0x5c10c5){logger[_0x5588('0x13')](_0x5588('0x40'),_0x5c10c5[_0x5588('0x15')],_0xff5522);_0x3f6256(_0x340753[_0x5588('0x13')](0x1f4,_0x5c10c5['message']));});});};exports[_0x5588('0x42')]=function(_0x35769a){var _0x5b7541=this;return new Promise(function(_0x1afb87,_0x54a60c){return db['CmHopper'][_0x5588('0x1b')]({'raw':_0x35769a['options']?_0x35769a[_0x5588('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x35769a[_0x5588('0x1c')]?_0x35769a[_0x5588('0x1c')][_0x5588('0x1e')]||null:null,'attributes':[[db[_0x5588('0x2f')]['fn'](_0x5588('0x43'),db[_0x5588('0x2f')]['fn']('IF',db['sequelize']['literal'](_0x5588('0x44')+util['format'](_0x5588('0x45'),moment()[_0x5588('0x46')](_0x5588('0x47')))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})[_0x5588('0xe')](function(_0x33d115){logger[_0x5588('0xf')](_0x5588('0x42'),_0x35769a);logger[_0x5588('0x11')](_0x5588('0x42'),_0x35769a,JSON[_0x5588('0x12')](_0x33d115));_0x1afb87(_0x33d115);})[_0x5588('0x18')](function(_0x1ad9e2){logger[_0x5588('0x13')](_0x5588('0x42'),_0x1ad9e2[_0x5588('0x15')],_0x35769a);_0x54a60c(_0x5b7541[_0x5588('0x13')](0x1f4,_0x1ad9e2[_0x5588('0x15')]));});});};exports[_0x5588('0x48')]=function(_0x413d4f){var _0x349ce2=this;return new Promise(function(_0x57dc08,_0x31e971){return db[_0x5588('0x34')][_0x5588('0x2e')]()[_0x5588('0xe')](function(_0x1b8776){return db[_0x5588('0x2f')][_0x5588('0x30')](function(_0x4d3758){return db['CmHopper'][_0x5588('0x1b')]({'where':_0x413d4f[_0x5588('0x1c')]?_0x413d4f[_0x5588('0x1c')][_0x5588('0x1e')]||null:null,'attributes':_0x413d4f[_0x5588('0x1c')]?_0x413d4f[_0x5588('0x1c')][_0x5588('0x1f')]||null:null,'limit':0x1,'order':_0x413d4f[_0x5588('0x1c')]?_0x413d4f['options'][_0x5588('0x31')]||null:null,'group':db[_0x5588('0x1a')]['UserId'],'transaction':_0x4d3758,'lock':_0x4d3758[_0x5588('0x32')]['UPDATE'],'include':_0x413d4f[_0x5588('0x1c')]?_0x413d4f[_0x5588('0x1c')][_0x5588('0x21')]?_[_0x5588('0x22')](_0x413d4f['options'][_0x5588('0x21')],function(_0x362322){return{'model':db[_0x362322[_0x5588('0x23')]],'as':_0x362322['as'],'attributes':_0x362322['attributes'],'include':_0x362322[_0x5588('0x21')]?_['map'](_0x362322['include'],function(_0x19c027){return{'model':db[_0x19c027['model']],'as':_0x19c027['as'],'attributes':_0x19c027[_0x5588('0x1f')],'include':_0x19c027[_0x5588('0x21')]?_[_0x5588('0x22')](_0x19c027['include'],function(_0x4748a2){return{'model':db[_0x4748a2[_0x5588('0x23')]],'as':_0x4748a2['as'],'attributes':_0x4748a2[_0x5588('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5588('0xe')](function(_0x52d923){var _0x33d4fe=[];for(var _0x118ac8=0x0;_0x118ac8<_0x52d923['length'];_0x118ac8+=0x1){_0x33d4fe[_0x5588('0x3a')](_0x52d923[_0x118ac8]['update'](_0x413d4f[_0x5588('0x28')],{'transaction':_0x4d3758}));}return BPromise['all'](_0x33d4fe);});})[_0x5588('0xe')](function(_0x12977f){logger[_0x5588('0xf')](_0x5588('0x48'),_0x413d4f);logger[_0x5588('0x11')](_0x5588('0x48'),_0x413d4f,JSON[_0x5588('0x12')](_0x12977f));_0x57dc08(_0x12977f);})['catch'](function(_0x3f8a37){logger['error'](_0x5588('0x48'),_0x3f8a37[_0x5588('0x15')],_0x413d4f);_0x31e971(_0x349ce2[_0x5588('0x13')](0x1f4,_0x3f8a37[_0x5588('0x15')]));});});});};exports['GetCmHopperPreview']=function(_0x254b41){var _0x518794=this;return new Promise(function(_0x36e541,_0x39045b){db[_0x5588('0x34')][_0x5588('0x2e')]()[_0x5588('0xe')](function(_0x3b827e){return db[_0x5588('0x1a')][_0x5588('0x1b')]({'raw':_0x254b41['options']?_0x254b41[_0x5588('0x1c')][_0x5588('0x1d')]===undefined?!![]:![]:!![],'where':_0x254b41[_0x5588('0x1c')]?_0x254b41[_0x5588('0x1c')]['where']||null:null,'attributes':_0x254b41['options']?_0x254b41[_0x5588('0x1c')][_0x5588('0x1f')]||null:null,'limit':_0x254b41[_0x5588('0x1c')]?_0x254b41[_0x5588('0x1c')][_0x5588('0x20')]||null:null,'include':_0x254b41['options']?_0x254b41[_0x5588('0x1c')]['include']?_['map'](_0x254b41[_0x5588('0x1c')]['include'],function(_0x1d83e2){return{'model':db[_0x1d83e2[_0x5588('0x23')]],'as':_0x1d83e2['as'],'attributes':_0x1d83e2['as']===_0x5588('0x35')?_[_0x5588('0x36')](_0x3b827e):_0x1d83e2[_0x5588('0x1f')],'include':_0x1d83e2['include']?_[_0x5588('0x22')](_0x1d83e2[_0x5588('0x21')],function(_0xaee7d0){return{'model':db[_0xaee7d0[_0x5588('0x23')]],'as':_0xaee7d0['as'],'attributes':_0xaee7d0[_0x5588('0x1f')],'include':_0xaee7d0[_0x5588('0x21')]?_['map'](_0xaee7d0['include'],function(_0x4a83a1){return{'model':db[_0x4a83a1['model']],'as':_0x4a83a1['as'],'attributes':_0x4a83a1['attributes']};}):[]};}):[]};}):[]:[]})[_0x5588('0xe')](function(_0x3b34fa){logger[_0x5588('0xf')](_0x5588('0x19'),_0x254b41);logger[_0x5588('0x11')](_0x5588('0x19'),_0x254b41,JSON[_0x5588('0x12')](_0x3b34fa));_0x36e541(_0x3b34fa);})[_0x5588('0x18')](function(_0x35550c){logger[_0x5588('0x13')](_0x5588('0x19'),_0x35550c['message'],_0x254b41);_0x39045b(_0x518794[_0x5588('0x13')](0x1f4,_0x35550c[_0x5588('0x15')]));});});});};exports[_0x5588('0x49')]=function(_0x55e5fd){var _0x1502b8=this;return new Promise(function(_0x3dc5b4,_0x1a98fd){return db[_0x5588('0x2f')][_0x5588('0x30')](function(_0x24cc3d){return db[_0x5588('0x1a')][_0x5588('0x2a')]({'active':![]},{'where':{},'transaction':_0x24cc3d})[_0x5588('0xe')](function(_0x4f5995){logger[_0x5588('0xf')]('ResetActiveCalls',_0x55e5fd);logger['debug'](_0x5588('0x49'),_0x55e5fd,JSON[_0x5588('0x12')](_0x4f5995));_0x3dc5b4(_0x4f5995);})[_0x5588('0x18')](function(_0x187e1f){logger[_0x5588('0x13')](_0x5588('0x49'),_0x187e1f[_0x5588('0x15')],_0x55e5fd);_0x1a98fd(_0x1502b8[_0x5588('0x13')](0x1f4,_0x187e1f['message']));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 9c84e71..51ba399 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 _0x2183=['get','/describe','/opencontacts','/:id','show','create','getPreview','put','delete','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','isAuthenticated','index'];(function(_0x3bdf87,_0x1238a0){var _0x4ccc5f=function(_0x123969){while(--_0x123969){_0x3bdf87['push'](_0x3bdf87['shift']());}};_0x4ccc5f(++_0x1238a0);}(_0x2183,0x15d));var _0x3218=function(_0x4b6aaa,_0x5df37e){_0x4b6aaa=_0x4b6aaa-0x0;var _0x10856f=_0x2183[_0x4b6aaa];return _0x10856f;};'use strict';var multer=require(_0x3218('0x0'));var util=require(_0x3218('0x1'));var path=require('path');var timeout=require(_0x3218('0x2'));var express=require(_0x3218('0x3'));var router=express['Router']();var fs_extra=require(_0x3218('0x4'));var auth=require(_0x3218('0x5'));var interaction=require(_0x3218('0x6'));var config=require(_0x3218('0x7'));var controller=require(_0x3218('0x8'));router['get']('/',auth[_0x3218('0x9')](),controller[_0x3218('0xa')]);router[_0x3218('0xb')](_0x3218('0xc'),auth[_0x3218('0x9')](),controller['describe']);router[_0x3218('0xb')](_0x3218('0xd'),auth[_0x3218('0x9')](),controller['getOpenContacts']);router[_0x3218('0xb')](_0x3218('0xe'),auth[_0x3218('0x9')](),controller[_0x3218('0xf')]);router['post']('/',auth[_0x3218('0x9')](),controller[_0x3218('0x10')]);router['post']('/preview',auth['isAuthenticated'](),controller[_0x3218('0x11')]);router[_0x3218('0x12')](_0x3218('0xe'),auth[_0x3218('0x9')](),controller['update']);router[_0x3218('0x13')](_0x3218('0xe'),auth[_0x3218('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x05b8=['delete','destroy','path','connect-timeout','fs-extra','./cmHopper.controller','get','isAuthenticated','/describe','describe','/opencontacts','getOpenContacts','/:id','show','post','/preview','put','update'];(function(_0x406a2b,_0x2cad33){var _0xb2f03e=function(_0x303cce){while(--_0x303cce){_0x406a2b['push'](_0x406a2b['shift']());}};_0xb2f03e(++_0x2cad33);}(_0x05b8,0x80));var _0x805b=function(_0x2edc14,_0x46b3bf){_0x2edc14=_0x2edc14-0x0;var _0x269c89=_0x05b8[_0x2edc14];return _0x269c89;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x805b('0x0'));var timeout=require(_0x805b('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x805b('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x805b('0x3'));router[_0x805b('0x4')]('/',auth[_0x805b('0x5')](),controller['index']);router['get'](_0x805b('0x6'),auth[_0x805b('0x5')](),controller[_0x805b('0x7')]);router[_0x805b('0x4')](_0x805b('0x8'),auth['isAuthenticated'](),controller[_0x805b('0x9')]);router[_0x805b('0x4')](_0x805b('0xa'),auth[_0x805b('0x5')](),controller[_0x805b('0xb')]);router[_0x805b('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x805b('0xc')](_0x805b('0xd'),auth['isAuthenticated'](),controller['getPreview']);router[_0x805b('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x805b('0xf')]);router[_0x805b('0x10')](_0x805b('0xa'),auth['isAuthenticated'](),controller[_0x805b('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index d181292..40492e5 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 _0x8411=['exports','STRING','INTEGER','contactListQueue'];(function(_0x404ac5,_0x3b8f41){var _0xc11604=function(_0x45aff8){while(--_0x45aff8){_0x404ac5['push'](_0x404ac5['shift']());}};_0xc11604(++_0x3b8f41);}(_0x8411,0x118));var _0x1841=function(_0x463480,_0x4a1f6c){_0x463480=_0x463480-0x0;var _0x3b5401=_0x8411[_0x463480];return _0x3b5401;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1841('0x0')]={'phone':{'type':Sequelize[_0x1841('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x1841('0x2')],'unique':_0x1841('0x3')},'VoiceQueueId':{'type':Sequelize[_0x1841('0x2')],'unique':_0x1841('0x3')}}; \ No newline at end of file +var _0x307e=['STRING','INTEGER','contactListQueue','moment','sequelize','exports'];(function(_0x5485c4,_0x10d0fc){var _0x562ea4=function(_0x37523b){while(--_0x37523b){_0x5485c4['push'](_0x5485c4['shift']());}};_0x562ea4(++_0x10d0fc);}(_0x307e,0xc9));var _0xe307=function(_0x7e11fd,_0x4de978){_0x7e11fd=_0x7e11fd-0x0;var _0x428e14=_0x307e[_0x7e11fd];return _0x428e14;};'use strict';var moment=require(_0xe307('0x0'));var Sequelize=require(_0xe307('0x1'));module[_0xe307('0x2')]={'phone':{'type':Sequelize[_0xe307('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xe307('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xe307('0x4')],'unique':_0xe307('0x5')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xe307('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index e555bcf..aa4bcdc 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 _0x529a=['../../config/license/util','../../mysqldb','sendStatus','status','json','limit','count','offset','Content-Range','apply','reject','save','then','end','error','stack','name','index','map','CmHopperBlack','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','include','rows','catch','rawAttributes','includeAll','find','update','body','params','destroy','describe','eml-format','zip-dir','moment','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x317395,_0x54537c){var _0x297041=function(_0x5b4073){while(--_0x5b4073){_0x317395['push'](_0x317395['shift']());}};_0x297041(++_0x54537c);}(_0x529a,0x77));var _0xa529=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x529a[_0x45e98e];return _0x374dba;};'use strict';var emlformat=require(_0xa529('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa529('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa529('0x2'));var BPromise=require(_0xa529('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa529('0x4'));var sox=require(_0xa529('0x5'));var csv=require(_0xa529('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa529('0x7'));var squel=require(_0xa529('0x8'));var crypto=require(_0xa529('0x9'));var jsforce=require(_0xa529('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa529('0x6'));var querystring=require(_0xa529('0xb'));var Papa=require(_0xa529('0xc'));var Redis=require('ioredis');var authService=require(_0xa529('0xd'));var qs=require(_0xa529('0xe'));var as=require(_0xa529('0xf'));var hardwareService=require(_0xa529('0x10'));var logger=require(_0xa529('0x11'))(_0xa529('0x12'));var utils=require(_0xa529('0x13'));var config=require(_0xa529('0x14'));var licenseUtil=require(_0xa529('0x15'));var db=require(_0xa529('0x16'))['db'];function respondWithStatusCode(_0x48fd89,_0x3dddd5){_0x3dddd5=_0x3dddd5||0xcc;return function(_0x14be07){if(_0x14be07){return _0x48fd89[_0xa529('0x17')](_0x3dddd5);}return _0x48fd89[_0xa529('0x18')](_0x3dddd5)['end']();};}function respondWithResult(_0x18b1db,_0x5608c9){_0x5608c9=_0x5608c9||0xc8;return function(_0x47aa7a){if(_0x47aa7a){return _0x18b1db[_0xa529('0x18')](_0x5608c9)[_0xa529('0x19')](_0x47aa7a);}};}function respondWithFilteredResult(_0x55683b,_0x2cd846){return function(_0x41a708){if(_0x41a708){var _0x490247=typeof _0x2cd846['offset']==='undefined'&&typeof _0x2cd846[_0xa529('0x1a')]==='undefined';var _0x1afc7c=_0x41a708[_0xa529('0x1b')];var _0x463687=_0x490247?0x0:_0x2cd846[_0xa529('0x1c')];var _0x37c9c9=_0x490247?_0x41a708['count']:_0x2cd846[_0xa529('0x1c')]+_0x2cd846[_0xa529('0x1a')];var _0xf67ddf;if(_0x37c9c9>=_0x1afc7c){_0x37c9c9=_0x1afc7c;_0xf67ddf=0xc8;}else{_0xf67ddf=0xce;}_0x55683b[_0xa529('0x18')](_0xf67ddf);return _0x55683b['set'](_0xa529('0x1d'),_0x463687+'-'+_0x37c9c9+'/'+_0x1afc7c)[_0xa529('0x19')](_0x41a708);}return null;};}function patchUpdates(_0x1580d4){return function(_0x502ea1){try{jsonpatch[_0xa529('0x1e')](_0x502ea1,_0x1580d4,!![]);}catch(_0x150b6b){return BPromise[_0xa529('0x1f')](_0x150b6b);}return _0x502ea1[_0xa529('0x20')]();};}function saveUpdates(_0x24dac2,_0x5cd9c0){return function(_0x5c6ecc){if(_0x5c6ecc){return _0x5c6ecc['update'](_0x24dac2)[_0xa529('0x21')](function(_0x1bb7bc){return _0x1bb7bc;});}return null;};}function removeEntity(_0x33ce95,_0x39c0d3){return function(_0x4170d2){if(_0x4170d2){return _0x4170d2['destroy']()[_0xa529('0x21')](function(){_0x33ce95[_0xa529('0x18')](0xcc)[_0xa529('0x22')]();});}};}function handleEntityNotFound(_0x19cbe,_0x1800e7){return function(_0x391760){if(!_0x391760){_0x19cbe[_0xa529('0x17')](0x194);}return _0x391760;};}function handleError(_0x5ddbef,_0x5d5983){_0x5d5983=_0x5d5983||0x1f4;return function(_0x2c6921){logger[_0xa529('0x23')](_0x2c6921[_0xa529('0x24')]);if(_0x2c6921[_0xa529('0x25')]){delete _0x2c6921[_0xa529('0x25')];}_0x5ddbef[_0xa529('0x18')](_0x5d5983)['send'](_0x2c6921);};}exports[_0xa529('0x26')]=function(_0x4f117b,_0x2243d2){var _0x215f5e={},_0x228c7e={},_0x90852a={'count':0x0,'rows':[]};var _0x447e0f=_[_0xa529('0x27')](db[_0xa529('0x28')]['rawAttributes'],function(_0x48ca5a){return{'name':_0x48ca5a[_0xa529('0x29')],'type':_0x48ca5a[_0xa529('0x2a')][_0xa529('0x2b')]};});_0x228c7e[_0xa529('0x2c')]=_[_0xa529('0x27')](_0x447e0f,_0xa529('0x25'));_0x228c7e[_0xa529('0x2d')]=_[_0xa529('0x2e')](_0x4f117b[_0xa529('0x2d')]);_0x228c7e[_0xa529('0x2f')]=_[_0xa529('0x30')](_0x228c7e['model'],_0x228c7e[_0xa529('0x2d')]);_0x215f5e['attributes']=_[_0xa529('0x30')](_0x228c7e[_0xa529('0x2c')],qs[_0xa529('0x31')](_0x4f117b[_0xa529('0x2d')]['fields']));_0x215f5e[_0xa529('0x32')]=_0x215f5e[_0xa529('0x32')]['length']?_0x215f5e['attributes']:_0x228c7e['model'];if(!_0x4f117b[_0xa529('0x2d')][_0xa529('0x33')](_0xa529('0x34'))){_0x215f5e[_0xa529('0x1a')]=qs[_0xa529('0x1a')](_0x4f117b['query'][_0xa529('0x1a')]);_0x215f5e[_0xa529('0x1c')]=qs['offset'](_0x4f117b[_0xa529('0x2d')]['offset']);}_0x215f5e['order']=qs[_0xa529('0x35')](_0x4f117b[_0xa529('0x2d')]['sort']);_0x215f5e['where']=qs[_0xa529('0x2f')](_['pick'](_0x4f117b[_0xa529('0x2d')],_0x228c7e['filters']),_0x447e0f);if(_0x4f117b['query'][_0xa529('0x36')]){_0x215f5e[_0xa529('0x37')]=_[_0xa529('0x38')](_0x215f5e[_0xa529('0x37')],{'$or':_[_0xa529('0x27')](_0x447e0f,function(_0x3bee04){if(_0x3bee04[_0xa529('0x2a')]!==_0xa529('0x39')){var _0x492f7d={};_0x492f7d[_0x3bee04[_0xa529('0x25')]]={'$like':'%'+_0x4f117b[_0xa529('0x2d')][_0xa529('0x36')]+'%'};return _0x492f7d;}})});}_0x215f5e=_['merge']({},_0x215f5e,_0x4f117b[_0xa529('0x3a')]);var _0x40735e={'where':_0x215f5e[_0xa529('0x37')]};return db[_0xa529('0x28')][_0xa529('0x1b')](_0x40735e)[_0xa529('0x21')](function(_0x4b6e1f){_0x90852a[_0xa529('0x1b')]=_0x4b6e1f;if(_0x4f117b[_0xa529('0x2d')]['includeAll']){_0x215f5e[_0xa529('0x3b')]=[{'all':!![]}];}return db[_0xa529('0x28')]['findAll'](_0x215f5e);})[_0xa529('0x21')](function(_0x16ec9f){_0x90852a[_0xa529('0x3c')]=_0x16ec9f;return _0x90852a;})[_0xa529('0x21')](respondWithFilteredResult(_0x2243d2,_0x215f5e))[_0xa529('0x3d')](handleError(_0x2243d2,null));};exports['show']=function(_0x4931d4,_0x28418e){var _0x2ca541={'raw':!![],'where':{'id':_0x4931d4['params']['id']}},_0x50bcff={};_0x50bcff[_0xa529('0x2c')]=_[_0xa529('0x2e')](db['CmHopperBlack'][_0xa529('0x3e')]);_0x50bcff[_0xa529('0x2d')]=_[_0xa529('0x2e')](_0x4931d4[_0xa529('0x2d')]);_0x50bcff['filters']=_[_0xa529('0x30')](_0x50bcff[_0xa529('0x2c')],_0x50bcff[_0xa529('0x2d')]);_0x2ca541[_0xa529('0x32')]=_['intersection'](_0x50bcff[_0xa529('0x2c')],qs[_0xa529('0x31')](_0x4931d4['query'][_0xa529('0x31')]));_0x2ca541['attributes']=_0x2ca541['attributes']['length']?_0x2ca541['attributes']:_0x50bcff[_0xa529('0x2c')];if(_0x4931d4[_0xa529('0x2d')][_0xa529('0x3f')]){_0x2ca541[_0xa529('0x3b')]=[{'all':!![]}];}_0x2ca541=_[_0xa529('0x38')]({},_0x2ca541,_0x4931d4[_0xa529('0x3a')]);return db[_0xa529('0x28')][_0xa529('0x40')](_0x2ca541)[_0xa529('0x21')](handleEntityNotFound(_0x28418e,null))[_0xa529('0x21')](respondWithResult(_0x28418e,null))[_0xa529('0x3d')](handleError(_0x28418e,null));};exports[_0xa529('0x41')]=function(_0x48de43,_0x59fb2f){if(_0x48de43[_0xa529('0x42')]['id']){delete _0x48de43[_0xa529('0x42')]['id'];}return db[_0xa529('0x28')][_0xa529('0x40')]({'where':{'id':_0x48de43[_0xa529('0x43')]['id']}})[_0xa529('0x21')](handleEntityNotFound(_0x59fb2f,null))['then'](saveUpdates(_0x48de43[_0xa529('0x42')],null))[_0xa529('0x21')](respondWithResult(_0x59fb2f,null))[_0xa529('0x3d')](handleError(_0x59fb2f,null));};exports[_0xa529('0x44')]=function(_0x3e71bb,_0x3e27af){return db['CmHopperBlack'][_0xa529('0x40')]({'where':{'id':_0x3e71bb[_0xa529('0x43')]['id']}})['then'](handleEntityNotFound(_0x3e27af,null))[_0xa529('0x21')](removeEntity(_0x3e27af,null))[_0xa529('0x3d')](handleError(_0x3e27af,null));};exports['describe']=function(_0x4d7938,_0x96ca54){return db[_0xa529('0x28')][_0xa529('0x45')]()[_0xa529('0x21')](respondWithResult(_0x96ca54,null))[_0xa529('0x3d')](handleError(_0x96ca54,null));}; \ No newline at end of file +var _0x2285=['where','pick','filter','options','include','rows','params','keys','includeAll','merge','find','body','catch','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','error','name','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort'];(function(_0x2568b3,_0x1b598b){var _0x1918aa=function(_0xe4c559){while(--_0xe4c559){_0x2568b3['push'](_0x2568b3['shift']());}};_0x1918aa(++_0x1b598b);}(_0x2285,0xa3));var _0x5228=function(_0x5d9e5b,_0x5538d2){_0x5d9e5b=_0x5d9e5b-0x0;var _0x2151c0=_0x2285[_0x5d9e5b];return _0x2151c0;};'use strict';var emlformat=require(_0x5228('0x0'));var rimraf=require(_0x5228('0x1'));var zipdir=require(_0x5228('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5228('0x3'));var moment=require(_0x5228('0x4'));var BPromise=require(_0x5228('0x5'));var Mustache=require(_0x5228('0x6'));var util=require(_0x5228('0x7'));var path=require(_0x5228('0x8'));var sox=require(_0x5228('0x9'));var csv=require(_0x5228('0xa'));var ejs=require(_0x5228('0xb'));var fs=require('fs');var fs_extra=require(_0x5228('0xc'));var _=require(_0x5228('0xd'));var squel=require(_0x5228('0xe'));var crypto=require('crypto');var jsforce=require(_0x5228('0xf'));var deskjs=require(_0x5228('0x10'));var toCsv=require('to-csv');var querystring=require(_0x5228('0x11'));var Papa=require(_0x5228('0x12'));var Redis=require('ioredis');var authService=require(_0x5228('0x13'));var qs=require(_0x5228('0x14'));var as=require(_0x5228('0x15'));var hardwareService=require(_0x5228('0x16'));var logger=require(_0x5228('0x17'))(_0x5228('0x18'));var utils=require(_0x5228('0x19'));var config=require(_0x5228('0x1a'));var licenseUtil=require(_0x5228('0x1b'));var db=require(_0x5228('0x1c'))['db'];function respondWithStatusCode(_0x48f2b0,_0x380a4f){_0x380a4f=_0x380a4f||0xcc;return function(_0x3d4962){if(_0x3d4962){return _0x48f2b0['sendStatus'](_0x380a4f);}return _0x48f2b0[_0x5228('0x1d')](_0x380a4f)[_0x5228('0x1e')]();};}function respondWithResult(_0x2b9c1c,_0x5d9e63){_0x5d9e63=_0x5d9e63||0xc8;return function(_0x4cfd05){if(_0x4cfd05){return _0x2b9c1c[_0x5228('0x1d')](_0x5d9e63)[_0x5228('0x1f')](_0x4cfd05);}};}function respondWithFilteredResult(_0x3ef87c,_0x2a310e){return function(_0x308bcf){if(_0x308bcf){var _0x38f045=typeof _0x2a310e[_0x5228('0x20')]===_0x5228('0x21')&&typeof _0x2a310e[_0x5228('0x22')]===_0x5228('0x21');var _0xf1c925=_0x308bcf[_0x5228('0x23')];var _0x3d8979=_0x38f045?0x0:_0x2a310e['offset'];var _0x327e52=_0x38f045?_0x308bcf[_0x5228('0x23')]:_0x2a310e[_0x5228('0x20')]+_0x2a310e[_0x5228('0x22')];var _0x3cc2a9;if(_0x327e52>=_0xf1c925){_0x327e52=_0xf1c925;_0x3cc2a9=0xc8;}else{_0x3cc2a9=0xce;}_0x3ef87c['status'](_0x3cc2a9);return _0x3ef87c['set'](_0x5228('0x24'),_0x3d8979+'-'+_0x327e52+'/'+_0xf1c925)[_0x5228('0x1f')](_0x308bcf);}return null;};}function patchUpdates(_0x3f5b71){return function(_0x8a61ea){try{jsonpatch['apply'](_0x8a61ea,_0x3f5b71,!![]);}catch(_0x43713a){return BPromise[_0x5228('0x25')](_0x43713a);}return _0x8a61ea['save']();};}function saveUpdates(_0x6974cb,_0x1400b4){return function(_0x2b9169){if(_0x2b9169){return _0x2b9169[_0x5228('0x26')](_0x6974cb)[_0x5228('0x27')](function(_0x4e2867){return _0x4e2867;});}return null;};}function removeEntity(_0x3cf6b9,_0xca8603){return function(_0x3b7042){if(_0x3b7042){return _0x3b7042['destroy']()[_0x5228('0x27')](function(){_0x3cf6b9[_0x5228('0x1d')](0xcc)[_0x5228('0x1e')]();});}};}function handleEntityNotFound(_0x59a3b3,_0x4fe551){return function(_0x75af0d){if(!_0x75af0d){_0x59a3b3['sendStatus'](0x194);}return _0x75af0d;};}function handleError(_0x6d0ee3,_0x574223){_0x574223=_0x574223||0x1f4;return function(_0xab6164){logger[_0x5228('0x28')](_0xab6164['stack']);if(_0xab6164[_0x5228('0x29')]){delete _0xab6164['name'];}_0x6d0ee3['status'](_0x574223)['send'](_0xab6164);};}exports[_0x5228('0x2a')]=function(_0x23efef,_0x140f33){var _0x1f3b98={},_0x5137b5={},_0x3800dd={'count':0x0,'rows':[]};var _0x225529=_[_0x5228('0x2b')](db[_0x5228('0x2c')][_0x5228('0x2d')],function(_0xa339ae){return{'name':_0xa339ae[_0x5228('0x2e')],'type':_0xa339ae[_0x5228('0x2f')][_0x5228('0x30')]};});_0x5137b5[_0x5228('0x31')]=_[_0x5228('0x2b')](_0x225529,'name');_0x5137b5[_0x5228('0x32')]=_['keys'](_0x23efef[_0x5228('0x32')]);_0x5137b5[_0x5228('0x33')]=_[_0x5228('0x34')](_0x5137b5[_0x5228('0x31')],_0x5137b5[_0x5228('0x32')]);_0x1f3b98[_0x5228('0x35')]=_[_0x5228('0x34')](_0x5137b5[_0x5228('0x31')],qs[_0x5228('0x36')](_0x23efef[_0x5228('0x32')][_0x5228('0x36')]));_0x1f3b98[_0x5228('0x35')]=_0x1f3b98[_0x5228('0x35')][_0x5228('0x37')]?_0x1f3b98['attributes']:_0x5137b5[_0x5228('0x31')];if(!_0x23efef['query']['hasOwnProperty'](_0x5228('0x38'))){_0x1f3b98['limit']=qs[_0x5228('0x22')](_0x23efef[_0x5228('0x32')][_0x5228('0x22')]);_0x1f3b98['offset']=qs[_0x5228('0x20')](_0x23efef['query'][_0x5228('0x20')]);}_0x1f3b98[_0x5228('0x39')]=qs[_0x5228('0x3a')](_0x23efef['query']['sort']);_0x1f3b98[_0x5228('0x3b')]=qs[_0x5228('0x33')](_[_0x5228('0x3c')](_0x23efef[_0x5228('0x32')],_0x5137b5['filters']),_0x225529);if(_0x23efef[_0x5228('0x32')][_0x5228('0x3d')]){_0x1f3b98[_0x5228('0x3b')]=_['merge'](_0x1f3b98[_0x5228('0x3b')],{'$or':_[_0x5228('0x2b')](_0x225529,function(_0x26fc00){if(_0x26fc00[_0x5228('0x2f')]!=='VIRTUAL'){var _0xb69d1f={};_0xb69d1f[_0x26fc00['name']]={'$like':'%'+_0x23efef['query'][_0x5228('0x3d')]+'%'};return _0xb69d1f;}})});}_0x1f3b98=_['merge']({},_0x1f3b98,_0x23efef[_0x5228('0x3e')]);var _0x56e6dc={'where':_0x1f3b98[_0x5228('0x3b')]};return db[_0x5228('0x2c')][_0x5228('0x23')](_0x56e6dc)[_0x5228('0x27')](function(_0x55e957){_0x3800dd[_0x5228('0x23')]=_0x55e957;if(_0x23efef[_0x5228('0x32')]['includeAll']){_0x1f3b98[_0x5228('0x3f')]=[{'all':!![]}];}return db[_0x5228('0x2c')]['findAll'](_0x1f3b98);})[_0x5228('0x27')](function(_0x7412f){_0x3800dd[_0x5228('0x40')]=_0x7412f;return _0x3800dd;})['then'](respondWithFilteredResult(_0x140f33,_0x1f3b98))['catch'](handleError(_0x140f33,null));};exports['show']=function(_0x4f8a05,_0x291d57){var _0x5a13d2={'raw':!![],'where':{'id':_0x4f8a05[_0x5228('0x41')]['id']}},_0x174a6c={};_0x174a6c[_0x5228('0x31')]=_[_0x5228('0x42')](db[_0x5228('0x2c')]['rawAttributes']);_0x174a6c[_0x5228('0x32')]=_['keys'](_0x4f8a05['query']);_0x174a6c[_0x5228('0x33')]=_[_0x5228('0x34')](_0x174a6c['model'],_0x174a6c[_0x5228('0x32')]);_0x5a13d2[_0x5228('0x35')]=_[_0x5228('0x34')](_0x174a6c['model'],qs['fields'](_0x4f8a05['query'][_0x5228('0x36')]));_0x5a13d2[_0x5228('0x35')]=_0x5a13d2[_0x5228('0x35')][_0x5228('0x37')]?_0x5a13d2[_0x5228('0x35')]:_0x174a6c[_0x5228('0x31')];if(_0x4f8a05['query'][_0x5228('0x43')]){_0x5a13d2['include']=[{'all':!![]}];}_0x5a13d2=_[_0x5228('0x44')]({},_0x5a13d2,_0x4f8a05[_0x5228('0x3e')]);return db['CmHopperBlack'][_0x5228('0x45')](_0x5a13d2)[_0x5228('0x27')](handleEntityNotFound(_0x291d57,null))['then'](respondWithResult(_0x291d57,null))['catch'](handleError(_0x291d57,null));};exports[_0x5228('0x26')]=function(_0x178d7c,_0x3eb49c){if(_0x178d7c[_0x5228('0x46')]['id']){delete _0x178d7c[_0x5228('0x46')]['id'];}return db['CmHopperBlack']['find']({'where':{'id':_0x178d7c[_0x5228('0x41')]['id']}})[_0x5228('0x27')](handleEntityNotFound(_0x3eb49c,null))[_0x5228('0x27')](saveUpdates(_0x178d7c['body'],null))[_0x5228('0x27')](respondWithResult(_0x3eb49c,null))[_0x5228('0x47')](handleError(_0x3eb49c,null));};exports[_0x5228('0x48')]=function(_0xa7407b,_0x2a88cd){return db[_0x5228('0x2c')][_0x5228('0x45')]({'where':{'id':_0xa7407b[_0x5228('0x41')]['id']}})[_0x5228('0x27')](handleEntityNotFound(_0x2a88cd,null))[_0x5228('0x27')](removeEntity(_0x2a88cd,null))['catch'](handleError(_0x2a88cd,null));};exports[_0x5228('0x49')]=function(_0x44c6fd,_0x20549d){return db[_0x5228('0x2c')]['describe']()[_0x5228('0x27')](respondWithResult(_0x20549d,null))[_0x5228('0x47')](handleError(_0x20549d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index dd12b96..c5d26df 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 _0xa03d=['CmHopperBlack','cm_hopper_black','api','bluebird','request-promise','rimraf','./cmHopperBlack.attributes','exports','define'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0xa03d,0x1e8));var _0xda03=function(_0x540c01,_0x5a6acd){_0x540c01=_0x540c01-0x0;var _0x4a1ea0=_0xa03d[_0x540c01];return _0x4a1ea0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xda03('0x0'));var moment=require('moment');var BPromise=require(_0xda03('0x1'));var rp=require(_0xda03('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xda03('0x3'));var config=require('../../config/environment');var attributes=require(_0xda03('0x4'));module[_0xda03('0x5')]=function(_0x3a6067,_0x2eb31f){return _0x3a6067[_0xda03('0x6')](_0xda03('0x7'),attributes,{'tableName':_0xda03('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e14=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','cm_hopper_black','lodash','util','moment'];(function(_0x1f9e92,_0x8443da){var _0x8c109=function(_0xf1bde4){while(--_0xf1bde4){_0x1f9e92['push'](_0x1f9e92['shift']());}};_0x8c109(++_0x8443da);}(_0x3e14,0x1ad));var _0x43e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e14[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x43e1('0x0'));var util=require(_0x43e1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x43e1('0x2'));var BPromise=require(_0x43e1('0x3'));var rp=require(_0x43e1('0x4'));var fs=require('fs');var path=require(_0x43e1('0x5'));var rimraf=require(_0x43e1('0x6'));var config=require(_0x43e1('0x7'));var attributes=require(_0x43e1('0x8'));module[_0x43e1('0x9')]=function(_0x28e520,_0x4dd5a7){return _0x28e520[_0x43e1('0xa')]('CmHopperBlack',attributes,{'tableName':_0x43e1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index a6f8885..a29e2cd 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 _0x3f2b=['randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','model','map','GetCmHopperBlack','UpdateCmHopperBlack','update','body','destroy','DestroyCmHopperBlack','lodash','util','bluebird'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x3f2b,0xb6));var _0xb3f2=function(_0x3c78ac,_0x337dc5){_0x3c78ac=_0x3c78ac-0x0;var _0x1293bd=_0x3f2b[_0x3c78ac];return _0x1293bd;};'use strict';var _=require(_0xb3f2('0x0'));var util=require(_0xb3f2('0x1'));var moment=require('moment');var BPromise=require(_0xb3f2('0x2'));var rs=require(_0xb3f2('0x3'));var fs=require('fs');var Redis=require(_0xb3f2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb3f2('0x5'))('rpc');var config=require(_0xb3f2('0x6'));var jayson=require(_0xb3f2('0x7'));var client=jayson[_0xb3f2('0x8')][_0xb3f2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5aa3fa,_0x38dd1c,_0x35c9f4){return new BPromise(function(_0x3723f7,_0x23532d){return client[_0xb3f2('0xa')](_0x5aa3fa,_0x35c9f4)[_0xb3f2('0xb')](function(_0x41284e){logger[_0xb3f2('0xc')](_0xb3f2('0xd'),_0x38dd1c,'request\x20sent');logger[_0xb3f2('0xe')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x38dd1c,'request\x20sent',JSON[_0xb3f2('0xf')](_0x41284e));if(_0x41284e[_0xb3f2('0x10')]){if(_0x41284e['error']['code']===0x1f4){logger[_0xb3f2('0x10')](_0xb3f2('0xd'),_0x38dd1c,_0x41284e[_0xb3f2('0x10')][_0xb3f2('0x11')]);return _0x23532d(_0x41284e['error'][_0xb3f2('0x11')]);}logger[_0xb3f2('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x38dd1c,_0x41284e[_0xb3f2('0x10')][_0xb3f2('0x11')]);return _0x3723f7(_0x41284e[_0xb3f2('0x10')][_0xb3f2('0x11')]);}else{logger[_0xb3f2('0xc')](_0xb3f2('0xd'),_0x38dd1c,_0xb3f2('0x12'));_0x3723f7(_0x41284e[_0xb3f2('0x13')]['message']);}})[_0xb3f2('0x14')](function(_0x3aceb8){logger[_0xb3f2('0x10')](_0xb3f2('0xd'),_0x38dd1c,_0x3aceb8);_0x23532d(_0x3aceb8);});});}exports['GetCmHopperBlack']=function(_0x1b9c26){var _0x10c94d=this;return new Promise(function(_0x5a590b,_0x14727a){return db[_0xb3f2('0x15')][_0xb3f2('0x16')]({'raw':_0x1b9c26['options']?_0x1b9c26[_0xb3f2('0x17')][_0xb3f2('0x18')]===undefined?!![]:![]:!![],'where':_0x1b9c26[_0xb3f2('0x17')]?_0x1b9c26[_0xb3f2('0x17')][_0xb3f2('0x19')]||null:null,'attributes':_0x1b9c26[_0xb3f2('0x17')]?_0x1b9c26[_0xb3f2('0x17')][_0xb3f2('0x1a')]||null:null,'limit':_0x1b9c26[_0xb3f2('0x17')]?_0x1b9c26[_0xb3f2('0x17')][_0xb3f2('0x1b')]||null:null,'include':_0x1b9c26[_0xb3f2('0x17')]?_0x1b9c26['options']['include']?_['map'](_0x1b9c26[_0xb3f2('0x17')][_0xb3f2('0x1c')],function(_0x3b5e67){return{'model':db[_0x3b5e67[_0xb3f2('0x1d')]],'as':_0x3b5e67['as'],'attributes':_0x3b5e67[_0xb3f2('0x1a')],'include':_0x3b5e67[_0xb3f2('0x1c')]?_[_0xb3f2('0x1e')](_0x3b5e67[_0xb3f2('0x1c')],function(_0xce82a7){return{'model':db[_0xce82a7[_0xb3f2('0x1d')]],'as':_0xce82a7['as'],'attributes':_0xce82a7[_0xb3f2('0x1a')],'include':_0xce82a7[_0xb3f2('0x1c')]?_['map'](_0xce82a7['include'],function(_0x32ee4c){return{'model':db[_0x32ee4c[_0xb3f2('0x1d')]],'as':_0x32ee4c['as'],'attributes':_0x32ee4c[_0xb3f2('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb3f2('0xb')](function(_0x64102b){logger[_0xb3f2('0xc')](_0xb3f2('0x1f'),_0x1b9c26);logger['debug'](_0xb3f2('0x1f'),_0x1b9c26,JSON[_0xb3f2('0xf')](_0x64102b));_0x5a590b(_0x64102b);})[_0xb3f2('0x14')](function(_0x4226f4){logger[_0xb3f2('0x10')](_0xb3f2('0x1f'),_0x4226f4[_0xb3f2('0x11')],_0x1b9c26);_0x14727a(_0x10c94d['error'](0x1f4,_0x4226f4[_0xb3f2('0x11')]));});});};exports[_0xb3f2('0x20')]=function(_0x39ded9){var _0x4f2c71=this;return new Promise(function(_0x335376,_0x54ac94){return db[_0xb3f2('0x15')][_0xb3f2('0x21')](_0x39ded9[_0xb3f2('0x22')],{'raw':_0x39ded9[_0xb3f2('0x17')]?_0x39ded9[_0xb3f2('0x17')][_0xb3f2('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39ded9[_0xb3f2('0x17')]?_0x39ded9[_0xb3f2('0x17')][_0xb3f2('0x19')]||null:null,'attributes':_0x39ded9[_0xb3f2('0x17')]?_0x39ded9[_0xb3f2('0x17')][_0xb3f2('0x1a')]||null:null,'limit':_0x39ded9[_0xb3f2('0x17')]?_0x39ded9[_0xb3f2('0x17')][_0xb3f2('0x1b')]||null:null})[_0xb3f2('0xb')](function(_0x4c0c03){logger[_0xb3f2('0xc')]('UpdateCmHopperBlack',_0x39ded9);logger['debug']('UpdateCmHopperBlack',_0x39ded9,JSON[_0xb3f2('0xf')](_0x4c0c03));_0x335376(_0x4c0c03);})[_0xb3f2('0x14')](function(_0x134628){logger[_0xb3f2('0x10')](_0xb3f2('0x20'),_0x134628['message'],_0x39ded9);_0x54ac94(_0x4f2c71[_0xb3f2('0x10')](0x1f4,_0x134628[_0xb3f2('0x11')]));});});};exports['DestroyCmHopperBlack']=function(_0x3c18){var _0x54677c=this;return new Promise(function(_0x4674a5,_0x4d0d5f){return db[_0xb3f2('0x15')][_0xb3f2('0x23')]({'where':_0x3c18[_0xb3f2('0x17')]?_0x3c18[_0xb3f2('0x17')][_0xb3f2('0x19')]||null:null})['then'](function(_0x1f01fb){logger[_0xb3f2('0xc')](_0xb3f2('0x24'),_0x3c18);logger['debug'](_0xb3f2('0x24'),_0x3c18,JSON[_0xb3f2('0xf')](_0x1f01fb));_0x4674a5(_0x1f01fb);})[_0xb3f2('0x14')](function(_0xfa1dfd){logger['error'](_0xb3f2('0x24'),_0xfa1dfd['message'],_0x3c18);_0x4d0d5f(_0x54677c[_0xb3f2('0x10')](0x1f4,_0xfa1dfd[_0xb3f2('0x11')]));});});}; \ No newline at end of file +var _0x4a9e=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','CmHopperBlack,\x20%s,\x20%s','message','info','result','catch','options','raw','attributes','limit','include','map','model','debug','GetCmHopperBlack','UpdateCmHopperBlack','CmHopperBlack','update','body','where','DestroyCmHopperBlack','destroy','util','moment','bluebird'];(function(_0x2a7e67,_0x15d75d){var _0x4b99d9=function(_0x1b99a2){while(--_0x1b99a2){_0x2a7e67['push'](_0x2a7e67['shift']());}};_0x4b99d9(++_0x15d75d);}(_0x4a9e,0x1d1));var _0xe4a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4a9e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xe4a9('0x0'));var moment=require(_0xe4a9('0x1'));var BPromise=require(_0xe4a9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe4a9('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xe4a9('0x4'))(_0xe4a9('0x5'));var config=require(_0xe4a9('0x6'));var jayson=require(_0xe4a9('0x7'));var client=jayson['client'][_0xe4a9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x46fd26,_0x2ecda1,_0x7e245){return new BPromise(function(_0x528a02,_0x5bc115){return client[_0xe4a9('0x9')](_0x46fd26,_0x7e245)[_0xe4a9('0xa')](function(_0x304c56){logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x2ecda1,_0xe4a9('0xb'));logger['debug'](_0xe4a9('0xc'),_0x2ecda1,_0xe4a9('0xb'),JSON[_0xe4a9('0xd')](_0x304c56));if(_0x304c56[_0xe4a9('0xe')]){if(_0x304c56[_0xe4a9('0xe')]['code']===0x1f4){logger[_0xe4a9('0xe')](_0xe4a9('0xf'),_0x2ecda1,_0x304c56[_0xe4a9('0xe')][_0xe4a9('0x10')]);return _0x5bc115(_0x304c56['error'][_0xe4a9('0x10')]);}logger[_0xe4a9('0xe')]('CmHopperBlack,\x20%s,\x20%s',_0x2ecda1,_0x304c56[_0xe4a9('0xe')][_0xe4a9('0x10')]);return _0x528a02(_0x304c56['error']['message']);}else{logger[_0xe4a9('0x11')](_0xe4a9('0xf'),_0x2ecda1,_0xe4a9('0xb'));_0x528a02(_0x304c56[_0xe4a9('0x12')]['message']);}})[_0xe4a9('0x13')](function(_0x2ddb88){logger[_0xe4a9('0xe')](_0xe4a9('0xf'),_0x2ecda1,_0x2ddb88);_0x5bc115(_0x2ddb88);});});}exports['GetCmHopperBlack']=function(_0x405928){var _0x570e42=this;return new Promise(function(_0x908b17,_0xc1a7fe){return db['CmHopperBlack']['findAll']({'raw':_0x405928[_0xe4a9('0x14')]?_0x405928[_0xe4a9('0x14')][_0xe4a9('0x15')]===undefined?!![]:![]:!![],'where':_0x405928[_0xe4a9('0x14')]?_0x405928[_0xe4a9('0x14')]['where']||null:null,'attributes':_0x405928[_0xe4a9('0x14')]?_0x405928[_0xe4a9('0x14')][_0xe4a9('0x16')]||null:null,'limit':_0x405928['options']?_0x405928[_0xe4a9('0x14')][_0xe4a9('0x17')]||null:null,'include':_0x405928[_0xe4a9('0x14')]?_0x405928['options'][_0xe4a9('0x18')]?_[_0xe4a9('0x19')](_0x405928[_0xe4a9('0x14')][_0xe4a9('0x18')],function(_0x2a5f15){return{'model':db[_0x2a5f15[_0xe4a9('0x1a')]],'as':_0x2a5f15['as'],'attributes':_0x2a5f15[_0xe4a9('0x16')],'include':_0x2a5f15[_0xe4a9('0x18')]?_[_0xe4a9('0x19')](_0x2a5f15['include'],function(_0x4f2636){return{'model':db[_0x4f2636[_0xe4a9('0x1a')]],'as':_0x4f2636['as'],'attributes':_0x4f2636['attributes'],'include':_0x4f2636['include']?_[_0xe4a9('0x19')](_0x4f2636[_0xe4a9('0x18')],function(_0x3f513e){return{'model':db[_0x3f513e['model']],'as':_0x3f513e['as'],'attributes':_0x3f513e[_0xe4a9('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x354733){logger['info']('GetCmHopperBlack',_0x405928);logger[_0xe4a9('0x1b')](_0xe4a9('0x1c'),_0x405928,JSON[_0xe4a9('0xd')](_0x354733));_0x908b17(_0x354733);})[_0xe4a9('0x13')](function(_0xb76eed){logger[_0xe4a9('0xe')](_0xe4a9('0x1c'),_0xb76eed[_0xe4a9('0x10')],_0x405928);_0xc1a7fe(_0x570e42[_0xe4a9('0xe')](0x1f4,_0xb76eed[_0xe4a9('0x10')]));});});};exports[_0xe4a9('0x1d')]=function(_0x31c2b4){var _0x571809=this;return new Promise(function(_0x5bd666,_0x2a54e1){return db[_0xe4a9('0x1e')][_0xe4a9('0x1f')](_0x31c2b4[_0xe4a9('0x20')],{'raw':_0x31c2b4[_0xe4a9('0x14')]?_0x31c2b4[_0xe4a9('0x14')][_0xe4a9('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31c2b4['options']?_0x31c2b4[_0xe4a9('0x14')][_0xe4a9('0x21')]||null:null,'attributes':_0x31c2b4[_0xe4a9('0x14')]?_0x31c2b4[_0xe4a9('0x14')]['attributes']||null:null,'limit':_0x31c2b4['options']?_0x31c2b4[_0xe4a9('0x14')][_0xe4a9('0x17')]||null:null})[_0xe4a9('0xa')](function(_0xbc0144){logger[_0xe4a9('0x11')](_0xe4a9('0x1d'),_0x31c2b4);logger[_0xe4a9('0x1b')](_0xe4a9('0x1d'),_0x31c2b4,JSON['stringify'](_0xbc0144));_0x5bd666(_0xbc0144);})[_0xe4a9('0x13')](function(_0x451fdb){logger[_0xe4a9('0xe')](_0xe4a9('0x1d'),_0x451fdb[_0xe4a9('0x10')],_0x31c2b4);_0x2a54e1(_0x571809['error'](0x1f4,_0x451fdb[_0xe4a9('0x10')]));});});};exports[_0xe4a9('0x22')]=function(_0x4b9906){var _0x6ea0ee=this;return new Promise(function(_0x3dcb55,_0x5a5389){return db['CmHopperBlack'][_0xe4a9('0x23')]({'where':_0x4b9906['options']?_0x4b9906[_0xe4a9('0x14')][_0xe4a9('0x21')]||null:null})['then'](function(_0x556eec){logger[_0xe4a9('0x11')](_0xe4a9('0x22'),_0x4b9906);logger[_0xe4a9('0x1b')]('DestroyCmHopperBlack',_0x4b9906,JSON[_0xe4a9('0xd')](_0x556eec));_0x3dcb55(_0x556eec);})[_0xe4a9('0x13')](function(_0x433e95){logger['error'](_0xe4a9('0x22'),_0x433e95[_0xe4a9('0x10')],_0x4b9906);_0x5a5389(_0x6ea0ee[_0xe4a9('0xe')](0x1f4,_0x433e95[_0xe4a9('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 34c95e0..6541e29 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 _0x90b1=['index','get','/describe','isAuthenticated','describe','/:id','show','put','update','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x494f52,_0x3fc3da){var _0x37c647=function(_0x3189e1){while(--_0x3189e1){_0x494f52['push'](_0x494f52['shift']());}};_0x37c647(++_0x3fc3da);}(_0x90b1,0x1bb));var _0x190b=function(_0x3bbf1b,_0x57f10a){_0x3bbf1b=_0x3bbf1b-0x0;var _0x4da9ef=_0x90b1[_0x3bbf1b];return _0x4da9ef;};'use strict';var multer=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var path=require(_0x190b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x190b('0x3')]();var fs_extra=require(_0x190b('0x4'));var auth=require(_0x190b('0x5'));var interaction=require(_0x190b('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x190b('0x7')]);router[_0x190b('0x8')](_0x190b('0x9'),auth[_0x190b('0xa')](),controller[_0x190b('0xb')]);router[_0x190b('0x8')](_0x190b('0xc'),auth['isAuthenticated'](),controller[_0x190b('0xd')]);router[_0x190b('0xe')](_0x190b('0xc'),auth[_0x190b('0xa')](),controller[_0x190b('0xf')]);router[_0x190b('0x10')](_0x190b('0xc'),auth[_0x190b('0xa')](),controller['destroy']);module[_0x190b('0x11')]=router; \ No newline at end of file +var _0x3a6d=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','describe','/:id','show','put','delete','destroy','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3a6d,0x143));var _0xd3a6=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x3a6d[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0xd3a6('0x0'));var util=require(_0xd3a6('0x1'));var path=require('path');var timeout=require(_0xd3a6('0x2'));var express=require(_0xd3a6('0x3'));var router=express[_0xd3a6('0x4')]();var fs_extra=require(_0xd3a6('0x5'));var auth=require(_0xd3a6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd3a6('0x7'));var controller=require(_0xd3a6('0x8'));router[_0xd3a6('0x9')]('/',auth[_0xd3a6('0xa')](),controller[_0xd3a6('0xb')]);router[_0xd3a6('0x9')]('/describe',auth[_0xd3a6('0xa')](),controller[_0xd3a6('0xc')]);router[_0xd3a6('0x9')](_0xd3a6('0xd'),auth[_0xd3a6('0xa')](),controller[_0xd3a6('0xe')]);router[_0xd3a6('0xf')](_0xd3a6('0xd'),auth[_0xd3a6('0xa')](),controller['update']);router[_0xd3a6('0x10')](_0xd3a6('0xd'),auth[_0xd3a6('0xa')](),controller[_0xd3a6('0x11')]);module[_0xd3a6('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 979e317..26f7d37 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 _0x2b87=['seconds','setDataValue','dispositionat','BOOLEAN','sequelize','moment','INTEGER','STRING','DATE','getDataValue','followuptime'];(function(_0x42557b,_0x290c94){var _0x3a3ff2=function(_0x33f6cc){while(--_0x33f6cc){_0x42557b['push'](_0x42557b['shift']());}};_0x3a3ff2(++_0x290c94);}(_0x2b87,0x138));var _0x72b8=function(_0x5abf51,_0x57a167){_0x5abf51=_0x5abf51-0x0;var _0x35aeef=_0x2b87[_0x5abf51];return _0x35aeef;};'use strict';var Sequelize=require(_0x72b8('0x0'));var moment=require(_0x72b8('0x1'));module['exports']={'state':{'type':Sequelize[_0x72b8('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x72b8('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x72b8('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x72b8('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x72b8('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x72b8('0x3')]},'calleridnum':{'type':Sequelize[_0x72b8('0x3')]},'calleridname':{'type':Sequelize[_0x72b8('0x3')]},'starttime':{'type':Sequelize[_0x72b8('0x4')]},'responsetime':{'type':Sequelize[_0x72b8('0x4')]},'answertime':{'type':Sequelize[_0x72b8('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x72b8('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x72b8('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x72b8('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x72b8('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x72b8('0x3')]},'campaign':{'type':Sequelize[_0x72b8('0x3')]},'campaigntype':{'type':Sequelize[_0x72b8('0x3')]},'membername':{'type':Sequelize[_0x72b8('0x3')]},'reason':{'type':Sequelize[_0x72b8('0x3')]},'disposition':{'type':Sequelize[_0x72b8('0x3')]},'secondDisposition':{'type':Sequelize[_0x72b8('0x3')]},'thirdDisposition':{'type':Sequelize[_0x72b8('0x3')]},'dispositionat':{'type':Sequelize[_0x72b8('0x4')],'set':function(_0x5060db){var _0x14e443=this[_0x72b8('0x5')]('endtime');if(_0x14e443&&_0x5060db){this['setDataValue'](_0x72b8('0x6'),moment(_0x5060db)['diff'](moment(_0x14e443),_0x72b8('0x7')));}return this[_0x72b8('0x8')](_0x72b8('0x9'),_0x5060db);}},'amd':{'type':Sequelize[_0x72b8('0xa')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x72b8('0x4')]},'callback':{'type':Sequelize[_0x72b8('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x72b8('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x72b8('0x4')]},'deleted':{'type':Sequelize[_0x72b8('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x72b8('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x72b8('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x72b8('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x72b8('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x72b8('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x72b8('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2300=['DATE','STRING','getDataValue','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','moment','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2300,0xb1));var _0x0230=function(_0x1808d1,_0x3d887c){_0x1808d1=_0x1808d1-0x0;var _0x247a8f=_0x2300[_0x1808d1];return _0x247a8f;};'use strict';var Sequelize=require(_0x0230('0x0'));var moment=require(_0x0230('0x1'));module['exports']={'state':{'type':Sequelize[_0x0230('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x0230('0x3')]},'countbusyretry':{'type':Sequelize[_0x0230('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0230('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0230('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0230('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0230('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x0230('0x4')]},'originatecalleridname':{'type':Sequelize[_0x0230('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x0230('0x3')]},'responsetime':{'type':Sequelize[_0x0230('0x3')]},'answertime':{'type':Sequelize[_0x0230('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x0230('0x3')]},'ringtime':{'type':Sequelize[_0x0230('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0230('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x0230('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x0230('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x0230('0x4')]},'campaigntype':{'type':Sequelize[_0x0230('0x4')]},'membername':{'type':Sequelize[_0x0230('0x4')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x0230('0x4')]},'secondDisposition':{'type':Sequelize[_0x0230('0x4')]},'thirdDisposition':{'type':Sequelize[_0x0230('0x4')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x1901a7){var _0x5b301e=this[_0x0230('0x5')](_0x0230('0x6'));if(_0x5b301e&&_0x1901a7){this[_0x0230('0x7')](_0x0230('0x8'),moment(_0x1901a7)[_0x0230('0x9')](moment(_0x5b301e),_0x0230('0xa')));}return this[_0x0230('0x7')]('dispositionat',_0x1901a7);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x0230('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x0230('0x3')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0230('0x3')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x0230('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x0230('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x0230('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0230('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0230('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0230('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0230('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 0782ed4..aed877a 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 _0x2ef3=['params','keys','describe','uniqueid','body','find','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','countContactsIvrCampaignHopperFinal','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','answeringMachine','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','createdAt','updatedAt','field','NOW()','VoiceQueueId','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','select','from','calleridnum','state\x20=\x204','group','Campaign','ListId','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','CampaignId\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','CmHopper','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','pick','filter','merge','options','CmHopperFinal','then','includeAll','include','findAll','catch','show'];(function(_0x491573,_0x1c9d5f){var _0x30090d=function(_0x4cd470){while(--_0x4cd470){_0x491573['push'](_0x491573['shift']());}};_0x30090d(++_0x1c9d5f);}(_0x2ef3,0xba));var _0x32ef=function(_0x1637d7,_0x16e704){_0x1637d7=_0x1637d7-0x0;var _0x498b7c=_0x2ef3[_0x1637d7];return _0x498b7c;};'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['CmHopperFinal'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':!![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['CmHopperFinal'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['CmHopperFinal']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')]()[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,null))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x30ad49,_0x36a65c){if(_0x30ad49['body'][_0x32ef('0x47')]){delete _0x30ad49[_0x32ef('0x48')][_0x32ef('0x47')];}return db[_0x32ef('0x3d')][_0x32ef('0x49')]({'where':{'uniqueid':_0x30ad49[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x36a65c,null))[_0x32ef('0x3e')](saveUpdates(_0x30ad49[_0x32ef('0x48')],null))[_0x32ef('0x3e')](respondWithResult(_0x36a65c,null))[_0x32ef('0x42')](handleError(_0x36a65c,null));};exports[_0x32ef('0x4a')]=function(_0x272377,_0x326445,_0x307ac8){return db[_0x32ef('0x3d')][_0x32ef('0x41')]({'raw':![],'where':{'VoiceQueueId':_0x272377[_0x32ef('0x44')]['id']},'attributes':[[db['sequelize']['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x4d')))),_0x32ef('0x4e')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x50')))),'noAnswerContacts'],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x51')))),'busyContacts'],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db['sequelize'][_0x32ef('0x4c')]('`state`\x20=\x208,\x201,\x20null'))),_0x32ef('0x52')],[db[_0x32ef('0x4b')]['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db['sequelize'][_0x32ef('0x4c')](_0x32ef('0x53')))),_0x32ef('0x54')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x32ef('0x55')],[db['sequelize']['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x56')))),_0x32ef('0x57')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0x32ef('0x3e')](handleEntityNotFound(_0x326445,null))[_0x32ef('0x3e')](respondWithResult(_0x326445,null))['catch'](handleError(_0x326445,null));};exports[_0x32ef('0x58')]=function(_0x12e1ef,_0x2b5703,_0x49c245){return db[_0x32ef('0x3d')][_0x32ef('0x41')]({'raw':![],'where':{'CampaignId':_0x12e1ef[_0x32ef('0x44')]['id']},'attributes':[[db['sequelize']['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db['sequelize'][_0x32ef('0x4c')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db['sequelize'][_0x32ef('0x4c')](_0x32ef('0x50')))),_0x32ef('0x59')],[db['sequelize']['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x32ef('0x51')))),_0x32ef('0x5a')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')]['literal'](_0x32ef('0x5b')))),_0x32ef('0x52')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x53')))),_0x32ef('0x54')],[db['sequelize']['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x5c')))),'abandonedContacts'],[db['sequelize']['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x56')))),'reCallContacts'],[db[_0x32ef('0x4b')]['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0x32ef('0x5d')]]})[_0x32ef('0x3e')](handleEntityNotFound(_0x2b5703,null))[_0x32ef('0x3e')](respondWithResult(_0x2b5703,null))['catch'](handleError(_0x2b5703,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x3b4a8e,_0x5edd29,_0x7d2c3a){return db[_0x32ef('0x5e')]['find']({'where':{'id':_0x3b4a8e[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x5edd29,null))[_0x32ef('0x3e')](function(_0xd7a78){var _0x9df27c;if(_0xd7a78){_0x9df27c=squel[_0x32ef('0x5f')]()[_0x32ef('0x60')](_0x32ef('0x61'))[_0x32ef('0x62')]([_0x32ef('0x63'),_0x32ef('0x64'),_0x32ef('0x65'),'ListId','VoiceQueueId',_0x32ef('0x66'),_0x32ef('0x67')],squel['select']()[_0x32ef('0x68')]('ANY_VALUE(calleridnum)',_0x32ef('0x63'))[_0x32ef('0x68')](_0x32ef('0x69'),'scheduledAt')[_0x32ef('0x68')]('ANY_VALUE(ContactId)',_0x32ef('0x65'))[_0x32ef('0x68')]('ANY_VALUE(ListId)','ListId')[_0x32ef('0x68')]('ANY_VALUE(VoiceQueueId)',_0x32ef('0x6a'))['field'](_0x32ef('0x69'),_0x32ef('0x66'))[_0x32ef('0x68')]('NOW()','updatedAt')['from'](_0x32ef('0x6b'))['where'](_0x32ef('0x6c'),_0x3b4a8e[_0x32ef('0x44')]['id'][_0x32ef('0x6d')]())[_0x32ef('0x38')](_0x32ef('0x6e'),_0x3b4a8e[_0x32ef('0x48')]['state'][_0x32ef('0x6d')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0x32ef('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x32ef('0x6f')]()[_0x32ef('0x68')]('phone')[_0x32ef('0x70')](_0x32ef('0x61'))[_0x32ef('0x38')](_0x32ef('0x6c'),_0x3b4a8e[_0x32ef('0x44')]['id'][_0x32ef('0x6d')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x32ef('0x6f')]()['field'](_0x32ef('0x71'))[_0x32ef('0x70')](_0x32ef('0x6b'))[_0x32ef('0x38')](_0x32ef('0x6c'),_0x3b4a8e[_0x32ef('0x44')]['id']['toString']())[_0x32ef('0x38')](_0x32ef('0x72')))[_0x32ef('0x73')](_0x32ef('0x65')))[_0x32ef('0x6d')]();return db['sequelize']['query'](_0x9df27c);}return[];})[_0x32ef('0x3e')](respondWithResult(_0x5edd29,null))[_0x32ef('0x42')](handleError(_0x5edd29,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x211fb1,_0x2e333d,_0x338578){return db[_0x32ef('0x74')][_0x32ef('0x49')]({'where':{'id':_0x211fb1[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x2e333d,null))[_0x32ef('0x3e')](function(_0x353641){var _0x54e65d;if(_0x353641){_0x54e65d=squel[_0x32ef('0x5f')]()[_0x32ef('0x60')]('cm_hopper')[_0x32ef('0x62')](['phone',_0x32ef('0x64'),'ContactId',_0x32ef('0x75'),_0x32ef('0x76'),_0x32ef('0x66'),_0x32ef('0x67')],squel['select']()[_0x32ef('0x68')](_0x32ef('0x77'),_0x32ef('0x63'))['field']('NOW()','scheduledAt')[_0x32ef('0x68')](_0x32ef('0x78'),_0x32ef('0x65'))[_0x32ef('0x68')](_0x32ef('0x79'),'ListId')[_0x32ef('0x68')]('ANY_VALUE(CampaignId)',_0x32ef('0x76'))[_0x32ef('0x68')](_0x32ef('0x69'),'createdAt')[_0x32ef('0x68')](_0x32ef('0x69'),_0x32ef('0x67'))[_0x32ef('0x70')](_0x32ef('0x6b'))['where'](_0x32ef('0x7a'),_0x211fb1['params']['id'][_0x32ef('0x6d')]())[_0x32ef('0x38')]('state\x20=\x20?',_0x211fb1['body'][_0x32ef('0x7b')][_0x32ef('0x6d')]())[_0x32ef('0x38')](_0x32ef('0x7c'))['where'](_0x32ef('0x7d'),squel['select']()['field'](_0x32ef('0x63'))['from'](_0x32ef('0x61'))[_0x32ef('0x38')](_0x32ef('0x7a'),_0x211fb1['params']['id']['toString']()))[_0x32ef('0x38')](_0x32ef('0x7d'),squel[_0x32ef('0x6f')]()[_0x32ef('0x68')](_0x32ef('0x71'))[_0x32ef('0x70')](_0x32ef('0x6b'))['where'](_0x32ef('0x7a'),_0x211fb1[_0x32ef('0x44')]['id'][_0x32ef('0x6d')]())[_0x32ef('0x38')]('state\x20=\x204'))['group'](_0x32ef('0x65')))['toString']();return db[_0x32ef('0x4b')][_0x32ef('0x2f')](_0x54e65d);}return[];})['then'](respondWithResult(_0x2e333d,null))['catch'](handleError(_0x2e333d,null));};exports['checkContactHopper']=function(_0x201675,_0x33f6c3,_0xa53375){return db[_0x32ef('0x7e')]['findOne']({'where':{'VoiceQueueId':_0x201675[_0x32ef('0x48')][_0x32ef('0x6a')],'CampaignId':_0x201675[_0x32ef('0x48')]['CampaignId'],'ContactId':_0x201675[_0x32ef('0x48')]['ContactId']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x33f6c3,null))[_0x32ef('0x3e')](function(_0x5f4890){if(_0x5f4890){return _0x5f4890;}return null;})['then'](respondWithResult(_0x33f6c3,null))[_0x32ef('0x42')](handleError(_0x33f6c3,null));}; \ No newline at end of file +var _0xadb5=['`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','noSuchContacts','VoiceQueue','find','insert','cm_hopper','fromQuery','phone','ContactId','ListId','createdAt','select','field','NOW()','scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','updatedAt','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','Campaign','into','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','VoiceQueueId','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','CmHopperFinal','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts'];(function(_0x4408f0,_0x3b9a2d){var _0x508296=function(_0x2ccdf2){while(--_0x2ccdf2){_0x4408f0['push'](_0x4408f0['shift']());}};_0x508296(++_0x3b9a2d);}(_0xadb5,0xad));var _0x5adb=function(_0x5d6d74,_0x2cfca3){_0x5d6d74=_0x5d6d74-0x0;var _0x369ff7=_0xadb5[_0x5d6d74];return _0x369ff7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['CmHopperFinal']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'all':!![]}];}return db[_0x5adb('0x2a')][_0x5adb('0x40')](_0x5d457e);})['then'](function(_0x53f2c6){_0x1eac55[_0x5adb('0x41')]=_0x53f2c6;return _0x1eac55;})['then'](respondWithFilteredResult(_0x49992e,_0x5d457e))[_0x5adb('0x42')](handleError(_0x49992e,null));};exports[_0x5adb('0x43')]=function(_0x299746,_0x121714){var _0xdfecfd={'raw':!![],'where':{'id':_0x299746[_0x5adb('0x44')]['id']}},_0x522ee5={};_0x522ee5[_0x5adb('0x2e')]=_['keys'](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x522ee5['query']=_[_0x5adb('0x30')](_0x299746[_0x5adb('0x2f')]);_0x522ee5[_0x5adb('0x39')]=_[_0x5adb('0x31')](_0x522ee5[_0x5adb('0x2e')],_0x522ee5[_0x5adb('0x2f')]);_0xdfecfd[_0x5adb('0x32')]=_['intersection'](_0x522ee5['model'],qs[_0x5adb('0x33')](_0x299746[_0x5adb('0x2f')][_0x5adb('0x33')]));_0xdfecfd[_0x5adb('0x32')]=_0xdfecfd['attributes']['length']?_0xdfecfd[_0x5adb('0x32')]:_0x522ee5[_0x5adb('0x2e')];if(_0x299746[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0xdfecfd[_0x5adb('0x3f')]=[{'all':!![]}];}_0xdfecfd=_['merge']({},_0xdfecfd,_0x299746[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')]['find'](_0xdfecfd)[_0x5adb('0x22')](handleEntityNotFound(_0x121714,null))[_0x5adb('0x22')](respondWithResult(_0x121714,null))[_0x5adb('0x42')](handleError(_0x121714,null));};exports[_0x5adb('0x46')]=function(_0x186bd2,_0x3a5409){return db[_0x5adb('0x2a')][_0x5adb('0x46')]()['then'](respondWithResult(_0x3a5409,null))[_0x5adb('0x42')](handleError(_0x3a5409,null));};exports['update']=function(_0x51bc49,_0x5015ee){if(_0x51bc49[_0x5adb('0x47')][_0x5adb('0x48')]){delete _0x51bc49[_0x5adb('0x47')]['uniqueid'];}return db[_0x5adb('0x2a')]['find']({'where':{'uniqueid':_0x51bc49[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x5015ee,null))[_0x5adb('0x22')](saveUpdates(_0x51bc49['body'],null))[_0x5adb('0x22')](respondWithResult(_0x5015ee,null))['catch'](handleError(_0x5015ee,null));};exports[_0x5adb('0x49')]=function(_0x6dc067,_0x55c535,_0x2402a3){return db[_0x5adb('0x2a')][_0x5adb('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x6dc067[_0x5adb('0x44')]['id']},'attributes':[[db[_0x5adb('0x4a')]['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x4c')))),'noSuchContacts'],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db['sequelize'][_0x5adb('0x4b')](_0x5adb('0x4e')))),_0x5adb('0x4f')],[db[_0x5adb('0x4a')]['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x50')))),_0x5adb('0x51')],[db['sequelize']['fn'](_0x5adb('0x4d'),db['sequelize']['fn']('IF',db[_0x5adb('0x4a')]['literal'](_0x5adb('0x52')))),_0x5adb('0x53')],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db['sequelize']['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x54')))),'dropContacts'],[db['sequelize']['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x55')))),_0x5adb('0x56')],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x57')))),_0x5adb('0x58')],[db[_0x5adb('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x59')))),_0x5adb('0x5a')]]})['then'](handleEntityNotFound(_0x55c535,null))[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x42')](handleError(_0x55c535,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x5cb50e,_0x476e62,_0x1505f7){return db['CmHopperFinal'][_0x5adb('0x40')]({'raw':![],'where':{'CampaignId':_0x5cb50e[_0x5adb('0x44')]['id']},'attributes':[[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')]['literal'](_0x5adb('0x4c')))),_0x5adb('0x5b')],[db[_0x5adb('0x4a')]['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')]('`state`\x20=\x203,\x201,\x20null'))),_0x5adb('0x4f')],[db['sequelize']['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')]['literal'](_0x5adb('0x50')))),_0x5adb('0x51')],[db['sequelize']['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')]('`state`\x20=\x208,\x201,\x20null'))),_0x5adb('0x53')],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db['sequelize']['literal'](_0x5adb('0x54')))),'dropContacts'],[db['sequelize']['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')]['literal'](_0x5adb('0x55')))),_0x5adb('0x56')],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x57')))),'reCallContacts'],[db['sequelize']['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x59')))),_0x5adb('0x5a')]]})[_0x5adb('0x22')](handleEntityNotFound(_0x476e62,null))[_0x5adb('0x22')](respondWithResult(_0x476e62,null))[_0x5adb('0x42')](handleError(_0x476e62,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x5e55c2,_0x1fc73b,_0x56df90){return db[_0x5adb('0x5c')][_0x5adb('0x5d')]({'where':{'id':_0x5e55c2[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x1fc73b,null))[_0x5adb('0x22')](function(_0x236f59){var _0x338aee;if(_0x236f59){_0x338aee=squel[_0x5adb('0x5e')]()['into'](_0x5adb('0x5f'))[_0x5adb('0x60')]([_0x5adb('0x61'),'scheduledAt',_0x5adb('0x62'),_0x5adb('0x63'),'VoiceQueueId',_0x5adb('0x64'),'updatedAt'],squel[_0x5adb('0x65')]()[_0x5adb('0x66')]('ANY_VALUE(calleridnum)',_0x5adb('0x61'))[_0x5adb('0x66')](_0x5adb('0x67'),_0x5adb('0x68'))[_0x5adb('0x66')](_0x5adb('0x69'),_0x5adb('0x62'))[_0x5adb('0x66')]('ANY_VALUE(ListId)',_0x5adb('0x63'))[_0x5adb('0x66')](_0x5adb('0x6a'),'VoiceQueueId')['field'](_0x5adb('0x67'),'createdAt')[_0x5adb('0x66')](_0x5adb('0x67'),_0x5adb('0x6b'))['from'](_0x5adb('0x6c'))[_0x5adb('0x37')](_0x5adb('0x6d'),_0x5e55c2[_0x5adb('0x44')]['id'][_0x5adb('0x6e')]())['where'](_0x5adb('0x6f'),_0x5e55c2[_0x5adb('0x47')][_0x5adb('0x70')][_0x5adb('0x6e')]())['where'](_0x5adb('0x71'))[_0x5adb('0x37')](_0x5adb('0x72'),squel[_0x5adb('0x65')]()[_0x5adb('0x66')](_0x5adb('0x61'))[_0x5adb('0x73')]('cm_hopper')[_0x5adb('0x37')](_0x5adb('0x6d'),_0x5e55c2['params']['id'][_0x5adb('0x6e')]()))[_0x5adb('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x5adb('0x65')]()['field'](_0x5adb('0x74'))[_0x5adb('0x73')]('cm_hopper_final')[_0x5adb('0x37')]('VoiceQueueId\x20=\x20?',_0x5e55c2[_0x5adb('0x44')]['id'][_0x5adb('0x6e')]())[_0x5adb('0x37')](_0x5adb('0x75')))[_0x5adb('0x76')]('ContactId'))[_0x5adb('0x6e')]();return db[_0x5adb('0x4a')][_0x5adb('0x2f')](_0x338aee);}return[];})[_0x5adb('0x22')](respondWithResult(_0x1fc73b,null))['catch'](handleError(_0x1fc73b,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x3f3db9,_0x461a07,_0x2e5c96){return db[_0x5adb('0x77')][_0x5adb('0x5d')]({'where':{'id':_0x3f3db9[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x461a07,null))['then'](function(_0xda26cc){var _0x14bada;if(_0xda26cc){_0x14bada=squel[_0x5adb('0x5e')]()[_0x5adb('0x78')]('cm_hopper')[_0x5adb('0x60')]([_0x5adb('0x61'),_0x5adb('0x68'),_0x5adb('0x62'),_0x5adb('0x63'),_0x5adb('0x79'),_0x5adb('0x64'),_0x5adb('0x6b')],squel[_0x5adb('0x65')]()['field'](_0x5adb('0x7a'),_0x5adb('0x61'))['field'](_0x5adb('0x67'),_0x5adb('0x68'))[_0x5adb('0x66')](_0x5adb('0x69'),_0x5adb('0x62'))[_0x5adb('0x66')](_0x5adb('0x7b'),_0x5adb('0x63'))['field'](_0x5adb('0x7c'),_0x5adb('0x79'))['field'](_0x5adb('0x67'),_0x5adb('0x64'))[_0x5adb('0x66')]('NOW()','updatedAt')[_0x5adb('0x73')](_0x5adb('0x6c'))[_0x5adb('0x37')]('CampaignId\x20=\x20?',_0x3f3db9[_0x5adb('0x44')]['id'][_0x5adb('0x6e')]())[_0x5adb('0x37')](_0x5adb('0x6f'),_0x3f3db9[_0x5adb('0x47')][_0x5adb('0x70')][_0x5adb('0x6e')]())[_0x5adb('0x37')](_0x5adb('0x71'))[_0x5adb('0x37')](_0x5adb('0x72'),squel[_0x5adb('0x65')]()['field']('phone')[_0x5adb('0x73')](_0x5adb('0x5f'))['where'](_0x5adb('0x7d'),_0x3f3db9[_0x5adb('0x44')]['id'][_0x5adb('0x6e')]()))[_0x5adb('0x37')](_0x5adb('0x72'),squel[_0x5adb('0x65')]()[_0x5adb('0x66')](_0x5adb('0x74'))[_0x5adb('0x73')]('cm_hopper_final')[_0x5adb('0x37')](_0x5adb('0x7d'),_0x3f3db9[_0x5adb('0x44')]['id']['toString']())[_0x5adb('0x37')](_0x5adb('0x75')))[_0x5adb('0x76')](_0x5adb('0x62')))[_0x5adb('0x6e')]();return db[_0x5adb('0x4a')]['query'](_0x14bada);}return[];})[_0x5adb('0x22')](respondWithResult(_0x461a07,null))[_0x5adb('0x42')](handleError(_0x461a07,null));};exports[_0x5adb('0x7e')]=function(_0x1e5532,_0x2c3af8,_0x3a201a){return db[_0x5adb('0x7f')][_0x5adb('0x80')]({'where':{'VoiceQueueId':_0x1e5532[_0x5adb('0x47')][_0x5adb('0x81')],'CampaignId':_0x1e5532['body'][_0x5adb('0x79')],'ContactId':_0x1e5532['body'][_0x5adb('0x62')]}})[_0x5adb('0x22')](handleEntityNotFound(_0x2c3af8,null))[_0x5adb('0x22')](function(_0x193a29){if(_0x193a29){return _0x193a29;}return null;})[_0x5adb('0x22')](respondWithResult(_0x2c3af8,null))['catch'](handleError(_0x2c3af8,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index f1f8f35..37c5f13 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 _0xfb2e=['request-promise','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','../../config/logger','moment','bluebird'];(function(_0x188703,_0x596b26){var _0x1a0c81=function(_0x1cd22d){while(--_0x1cd22d){_0x188703['push'](_0x188703['shift']());}};_0x1a0c81(++_0x596b26);}(_0xfb2e,0x159));var _0xefb2=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xfb2e[_0x37bd26];return _0xe83dc4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xefb2('0x0'))('api');var moment=require(_0xefb2('0x1'));var BPromise=require(_0xefb2('0x2'));var rp=require(_0xefb2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xefb2('0x4'));var attributes=require(_0xefb2('0x5'));module[_0xefb2('0x6')]=function(_0x1dfdda,_0x1e79ad){return _0x1dfdda[_0xefb2('0x7')](_0xefb2('0x8'),attributes,{'tableName':_0xefb2('0x9'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0xefb2('0xa')]},{'name':_0xefb2('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x317c=['exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x5cd584,_0x491b6b){var _0x36b013=function(_0x305bd0){while(--_0x305bd0){_0x5cd584['push'](_0x5cd584['shift']());}};_0x36b013(++_0x491b6b);}(_0x317c,0x1aa));var _0xc317=function(_0x150eba,_0xbeda54){_0x150eba=_0x150eba-0x0;var _0x52262b=_0x317c[_0x150eba];return _0x52262b;};'use strict';var _=require(_0xc317('0x0'));var util=require(_0xc317('0x1'));var logger=require(_0xc317('0x2'))(_0xc317('0x3'));var moment=require(_0xc317('0x4'));var BPromise=require(_0xc317('0x5'));var rp=require(_0xc317('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc317('0x7'));var attributes=require('./cmHopperFinal.attributes');module[_0xc317('0x8')]=function(_0x3f8496,_0x5266ad){return _0x3f8496[_0xc317('0x9')](_0xc317('0xa'),attributes,{'tableName':_0xc317('0xb'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0xc317('0xc')]},{'name':_0xc317('0xd'),'fields':[_0xc317('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index bc0319d..e62bfff 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(_0x17a1bd,_0x3de33d){var _0x166c80=function(_0x95c8d7){while(--_0x95c8d7){_0x17a1bd['push'](_0x17a1bd['shift']());}};_0x166c80(++_0x3de33d);}(_0xb10b,0x12a));var _0xbb10=function(_0x21bb2f,_0x4199b9){_0x21bb2f=_0x21bb2f-0x0;var _0x279b0e=_0xb10b[_0x21bb2f];return _0x279b0e;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x4e61cb,_0x52b27c){var _0x529fb6=function(_0x3f86e4){while(--_0x3f86e4){_0x4e61cb['push'](_0x4e61cb['shift']());}};_0x529fb6(++_0x52b27c);}(_0xb10b,0x12a));var _0xbb10=function(_0x290c31,_0x534b8a){_0x290c31=_0x290c31-0x0;var _0x2eb0ac=_0xb10b[_0x290c31];return _0x2eb0ac;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index d7ebb01..caac404 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 _0x7215=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put'];(function(_0x5c1c31,_0x2f3ab8){var _0x2b021e=function(_0xcb3286){while(--_0xcb3286){_0x5c1c31['push'](_0x5c1c31['shift']());}};_0x2b021e(++_0x2f3ab8);}(_0x7215,0x138));var _0x5721=function(_0x50ea29,_0x307322){_0x50ea29=_0x50ea29-0x0;var _0x826beb=_0x7215[_0x50ea29];return _0x826beb;};'use strict';var multer=require(_0x5721('0x0'));var util=require(_0x5721('0x1'));var path=require('path');var timeout=require(_0x5721('0x2'));var express=require(_0x5721('0x3'));var router=express[_0x5721('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5721('0x5'));var interaction=require(_0x5721('0x6'));var config=require(_0x5721('0x7'));var controller=require('./cmHopperFinal.controller');router['get']('/',auth[_0x5721('0x8')](),controller[_0x5721('0x9')]);router[_0x5721('0xa')](_0x5721('0xb'),auth[_0x5721('0x8')](),controller[_0x5721('0xc')]);router['get'](_0x5721('0xd'),auth[_0x5721('0x8')](),controller[_0x5721('0xe')]);router[_0x5721('0xa')]('/voice/queue/countAttributes/:id',auth['isAuthenticated'](),controller['countContactsQueueCampaignHopperFinal']);router[_0x5721('0xa')](_0x5721('0xf'),auth[_0x5721('0x8')](),controller[_0x5721('0x10')]);router[_0x5721('0x11')](_0x5721('0x12'),auth[_0x5721('0x8')](),controller[_0x5721('0x13')]);router[_0x5721('0x11')](_0x5721('0x14'),auth[_0x5721('0x8')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x5721('0x11')](_0x5721('0x15'),auth[_0x5721('0x8')](),controller[_0x5721('0x16')]);router[_0x5721('0x17')](_0x5721('0xd'),auth[_0x5721('0x8')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x0c6a=['index','isAuthenticated','describe','/:id','show','get','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','update','exports','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0c6a,0x157));var _0xa0c6=function(_0x11af81,_0x3d1a99){_0x11af81=_0x11af81-0x0;var _0x367dc6=_0x0c6a[_0x11af81];return _0x367dc6;};'use strict';var multer=require('multer');var util=require(_0xa0c6('0x0'));var path=require('path');var timeout=require(_0xa0c6('0x1'));var express=require('express');var router=express[_0xa0c6('0x2')]();var fs_extra=require(_0xa0c6('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa0c6('0x4'));var config=require(_0xa0c6('0x5'));var controller=require(_0xa0c6('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xa0c6('0x7')]);router['get']('/describe',auth[_0xa0c6('0x8')](),controller[_0xa0c6('0x9')]);router['get'](_0xa0c6('0xa'),auth['isAuthenticated'](),controller[_0xa0c6('0xb')]);router[_0xa0c6('0xc')]('/voice/queue/countAttributes/:id',auth[_0xa0c6('0x8')](),controller[_0xa0c6('0xd')]);router[_0xa0c6('0xc')](_0xa0c6('0xe'),auth[_0xa0c6('0x8')](),controller[_0xa0c6('0xf')]);router[_0xa0c6('0x10')](_0xa0c6('0x11'),auth[_0xa0c6('0x8')](),controller[_0xa0c6('0x12')]);router[_0xa0c6('0x10')](_0xa0c6('0x13'),auth[_0xa0c6('0x8')](),controller[_0xa0c6('0x14')]);router['post']('/checkContactHopper',auth[_0xa0c6('0x8')](),controller[_0xa0c6('0x15')]);router[_0xa0c6('0x16')](_0xa0c6('0xa'),auth['isAuthenticated'](),controller[_0xa0c6('0x17')]);module[_0xa0c6('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 371fb2b..cd3d0f0 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 _0xc4c0=['exports','STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0x584e99,_0x29ccb7){var _0x128080=function(_0x573ab1){while(--_0x573ab1){_0x584e99['push'](_0x584e99['shift']());}};_0x128080(++_0x29ccb7);}(_0xc4c0,0x17f));var _0x0c4c=function(_0x9faff7,_0x59a564){_0x9faff7=_0x9faff7-0x0;var _0x4f8043=_0xc4c0[_0x9faff7];return _0x4f8043;};'use strict';var Sequelize=require(_0x0c4c('0x0'));module[_0x0c4c('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x0c4c('0x2')]},'scheduledat':{'type':Sequelize[_0x0c4c('0x3')]},'countbusyretry':{'type':Sequelize[_0x0c4c('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0c4c('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0c4c('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x0c4c('0x2')]},'originatecalleridname':{'type':Sequelize[_0x0c4c('0x2')]},'calleridnum':{'type':Sequelize[_0x0c4c('0x2')]},'calleridname':{'type':Sequelize[_0x0c4c('0x2')]},'starttime':{'type':Sequelize[_0x0c4c('0x3')]},'responsetime':{'type':Sequelize[_0x0c4c('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x0c4c('0x3')]},'endtime':{'type':Sequelize[_0x0c4c('0x3')]},'ringtime':{'type':Sequelize[_0x0c4c('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x0c4c('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x0c4c('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x0c4c('0x2')]},'campaign':{'type':Sequelize[_0x0c4c('0x2')]},'campaigntype':{'type':Sequelize[_0x0c4c('0x2')]},'membername':{'type':Sequelize[_0x0c4c('0x2')]},'reason':{'type':Sequelize[_0x0c4c('0x2')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x0c4c('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0c4c('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x0c4c('0x3')]},'edited':{'type':Sequelize[_0x0c4c('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0c4c('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0c4c('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0c4c('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xaa2b=['STRING','DATE','BOOLEAN','exports','INTEGER'];(function(_0x194794,_0x2858f2){var _0x4720fb=function(_0x2baeb0){while(--_0x2baeb0){_0x194794['push'](_0x194794['shift']());}};_0x4720fb(++_0x2858f2);}(_0xaa2b,0x1f2));var _0xbaa2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xaa2b[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require('sequelize');module[_0xbaa2('0x0')]={'state':{'type':Sequelize[_0xbaa2('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xbaa2('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbaa2('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xbaa2('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xbaa2('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xbaa2('0x2')]},'originatecalleridname':{'type':Sequelize[_0xbaa2('0x2')]},'calleridnum':{'type':Sequelize[_0xbaa2('0x2')]},'calleridname':{'type':Sequelize[_0xbaa2('0x2')]},'starttime':{'type':Sequelize[_0xbaa2('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xbaa2('0x3')]},'droptime':{'type':Sequelize[_0xbaa2('0x3')]},'endtime':{'type':Sequelize[_0xbaa2('0x3')]},'ringtime':{'type':Sequelize[_0xbaa2('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xbaa2('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xbaa2('0x2')]},'campaigntype':{'type':Sequelize[_0xbaa2('0x2')]},'membername':{'type':Sequelize[_0xbaa2('0x2')]},'reason':{'type':Sequelize[_0xbaa2('0x2')]},'amd':{'type':Sequelize[_0xbaa2('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0xbaa2('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xbaa2('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xbaa2('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xbaa2('0x3')]},'edited':{'type':Sequelize[_0xbaa2('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xbaa2('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xbaa2('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbaa2('0x1')],'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 fa924b0..18dd4a9 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 _0x3793=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','order','sort','where','filter','merge','options','include','findAll','rows','show','params','catch','create','body','describe','update','uniqueid','find','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x1240b9,_0x288cd6){var _0x18243a=function(_0x1dc6de){while(--_0x1dc6de){_0x1240b9['push'](_0x1240b9['shift']());}};_0x18243a(++_0x288cd6);}(_0x3793,0x1a2));var _0x3379=function(_0x140832,_0x56d04b){_0x140832=_0x140832-0x0;var _0x4cd35a=_0x3793[_0x140832];return _0x4cd35a;};'use strict';var emlformat=require(_0x3379('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3379('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3379('0x2'));var moment=require(_0x3379('0x3'));var BPromise=require(_0x3379('0x4'));var Mustache=require(_0x3379('0x5'));var util=require('util');var path=require(_0x3379('0x6'));var sox=require(_0x3379('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3379('0x8'));var _=require(_0x3379('0x9'));var squel=require(_0x3379('0xa'));var crypto=require(_0x3379('0xb'));var jsforce=require(_0x3379('0xc'));var deskjs=require(_0x3379('0xd'));var toCsv=require(_0x3379('0xe'));var querystring=require(_0x3379('0xf'));var Papa=require(_0x3379('0x10'));var Redis=require(_0x3379('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3379('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3379('0x13'));var logger=require(_0x3379('0x14'))(_0x3379('0x15'));var utils=require(_0x3379('0x16'));var config=require(_0x3379('0x17'));var licenseUtil=require(_0x3379('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36a2b2,_0xb6bfbf){_0xb6bfbf=_0xb6bfbf||0xcc;return function(_0x300f2c){if(_0x300f2c){return _0x36a2b2[_0x3379('0x19')](_0xb6bfbf);}return _0x36a2b2[_0x3379('0x1a')](_0xb6bfbf)[_0x3379('0x1b')]();};}function respondWithResult(_0x270109,_0x461abc){_0x461abc=_0x461abc||0xc8;return function(_0x53fa32){if(_0x53fa32){return _0x270109[_0x3379('0x1a')](_0x461abc)[_0x3379('0x1c')](_0x53fa32);}};}function respondWithFilteredResult(_0x1462b4,_0xc81bd4){return function(_0x548bb8){if(_0x548bb8){var _0x35331d=typeof _0xc81bd4[_0x3379('0x1d')]===_0x3379('0x1e')&&typeof _0xc81bd4[_0x3379('0x1f')]==='undefined';var _0x41b39c=_0x548bb8[_0x3379('0x20')];var _0x4f482f=_0x35331d?0x0:_0xc81bd4[_0x3379('0x1d')];var _0x398c03=_0x35331d?_0x548bb8['count']:_0xc81bd4[_0x3379('0x1d')]+_0xc81bd4[_0x3379('0x1f')];var _0x519604;if(_0x398c03>=_0x41b39c){_0x398c03=_0x41b39c;_0x519604=0xc8;}else{_0x519604=0xce;}_0x1462b4[_0x3379('0x1a')](_0x519604);return _0x1462b4[_0x3379('0x21')](_0x3379('0x22'),_0x4f482f+'-'+_0x398c03+'/'+_0x41b39c)[_0x3379('0x1c')](_0x548bb8);}return null;};}function patchUpdates(_0xf54d94){return function(_0x4a33d7){try{jsonpatch[_0x3379('0x23')](_0x4a33d7,_0xf54d94,!![]);}catch(_0x1d13d6){return BPromise['reject'](_0x1d13d6);}return _0x4a33d7[_0x3379('0x24')]();};}function saveUpdates(_0x23603c,_0x443478){return function(_0x5a86f6){if(_0x5a86f6){return _0x5a86f6['update'](_0x23603c)[_0x3379('0x25')](function(_0x24373f){return _0x24373f;});}return null;};}function removeEntity(_0x1a8c2e,_0x439112){return function(_0x4f04e5){if(_0x4f04e5){return _0x4f04e5[_0x3379('0x26')]()[_0x3379('0x25')](function(){_0x1a8c2e[_0x3379('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bd723,_0x25c4d0){return function(_0x26ae4f){if(!_0x26ae4f){_0x5bd723[_0x3379('0x19')](0x194);}return _0x26ae4f;};}function handleError(_0x138eff,_0x3d4017){_0x3d4017=_0x3d4017||0x1f4;return function(_0x23a2cf){logger['error'](_0x23a2cf['stack']);if(_0x23a2cf[_0x3379('0x27')]){delete _0x23a2cf['name'];}_0x138eff[_0x3379('0x1a')](_0x3d4017)[_0x3379('0x28')](_0x23a2cf);};}exports[_0x3379('0x29')]=function(_0x269492,_0x427925){var _0x41ded6={},_0x367e90={},_0x430209={'count':0x0,'rows':[]};var _0x5a0350=_[_0x3379('0x2a')](db[_0x3379('0x2b')][_0x3379('0x2c')],function(_0x5b7d02){return{'name':_0x5b7d02[_0x3379('0x2d')],'type':_0x5b7d02[_0x3379('0x2e')][_0x3379('0x2f')]};});_0x367e90['model']=_[_0x3379('0x2a')](_0x5a0350,_0x3379('0x27'));_0x367e90[_0x3379('0x30')]=_[_0x3379('0x31')](_0x269492[_0x3379('0x30')]);_0x367e90[_0x3379('0x32')]=_[_0x3379('0x33')](_0x367e90['model'],_0x367e90[_0x3379('0x30')]);_0x41ded6[_0x3379('0x34')]=_[_0x3379('0x33')](_0x367e90[_0x3379('0x35')],qs[_0x3379('0x36')](_0x269492[_0x3379('0x30')][_0x3379('0x36')]));_0x41ded6['attributes']=_0x41ded6[_0x3379('0x34')][_0x3379('0x37')]?_0x41ded6[_0x3379('0x34')]:_0x367e90['model'];if(!_0x269492[_0x3379('0x30')]['hasOwnProperty']('nolimit')){_0x41ded6[_0x3379('0x1f')]=qs[_0x3379('0x1f')](_0x269492[_0x3379('0x30')]['limit']);_0x41ded6[_0x3379('0x1d')]=qs['offset'](_0x269492[_0x3379('0x30')]['offset']);}_0x41ded6[_0x3379('0x38')]=qs[_0x3379('0x39')](_0x269492[_0x3379('0x30')][_0x3379('0x39')]);_0x41ded6[_0x3379('0x3a')]=qs['filters'](_['pick'](_0x269492[_0x3379('0x30')],_0x367e90[_0x3379('0x32')]),_0x5a0350);if(_0x269492[_0x3379('0x30')][_0x3379('0x3b')]){_0x41ded6[_0x3379('0x3a')]=_[_0x3379('0x3c')](_0x41ded6[_0x3379('0x3a')],{'$or':_['map'](_0x5a0350,function(_0x957ad1){if(_0x957ad1[_0x3379('0x2e')]!=='VIRTUAL'){var _0x65f81a={};_0x65f81a[_0x957ad1[_0x3379('0x27')]]={'$like':'%'+_0x269492['query'][_0x3379('0x3b')]+'%'};return _0x65f81a;}})});}_0x41ded6=_[_0x3379('0x3c')]({},_0x41ded6,_0x269492[_0x3379('0x3d')]);var _0x2fdaf2={'where':_0x41ded6[_0x3379('0x3a')]};return db[_0x3379('0x2b')][_0x3379('0x20')](_0x2fdaf2)[_0x3379('0x25')](function(_0x24e849){_0x430209[_0x3379('0x20')]=_0x24e849;if(_0x269492['query']['includeAll']){_0x41ded6[_0x3379('0x3e')]=[{'all':!![]}];}return db[_0x3379('0x2b')][_0x3379('0x3f')](_0x41ded6);})['then'](function(_0x116eb7){_0x430209[_0x3379('0x40')]=_0x116eb7;return _0x430209;})[_0x3379('0x25')](respondWithFilteredResult(_0x427925,_0x41ded6))['catch'](handleError(_0x427925,null));};exports[_0x3379('0x41')]=function(_0x4015b0,_0x2e1c06){var _0x12b036={'raw':!![],'where':{'id':_0x4015b0[_0x3379('0x42')]['id']}},_0x99f161={};_0x99f161[_0x3379('0x35')]=_['keys'](db[_0x3379('0x2b')][_0x3379('0x2c')]);_0x99f161[_0x3379('0x30')]=_[_0x3379('0x31')](_0x4015b0[_0x3379('0x30')]);_0x99f161[_0x3379('0x32')]=_['intersection'](_0x99f161[_0x3379('0x35')],_0x99f161[_0x3379('0x30')]);_0x12b036[_0x3379('0x34')]=_[_0x3379('0x33')](_0x99f161['model'],qs[_0x3379('0x36')](_0x4015b0[_0x3379('0x30')][_0x3379('0x36')]));_0x12b036[_0x3379('0x34')]=_0x12b036[_0x3379('0x34')]['length']?_0x12b036['attributes']:_0x99f161['model'];if(_0x4015b0['query']['includeAll']){_0x12b036[_0x3379('0x3e')]=[{'all':!![]}];}_0x12b036=_[_0x3379('0x3c')]({},_0x12b036,_0x4015b0[_0x3379('0x3d')]);return db[_0x3379('0x2b')]['find'](_0x12b036)[_0x3379('0x25')](handleEntityNotFound(_0x2e1c06,null))[_0x3379('0x25')](respondWithResult(_0x2e1c06,null))[_0x3379('0x43')](handleError(_0x2e1c06,null));};exports[_0x3379('0x44')]=function(_0x1fd578,_0x19cc2b){return db[_0x3379('0x2b')][_0x3379('0x44')](_0x1fd578[_0x3379('0x45')],{})[_0x3379('0x25')](respondWithResult(_0x19cc2b,0xc9))[_0x3379('0x43')](handleError(_0x19cc2b,null));};exports[_0x3379('0x46')]=function(_0x4a3ddf,_0x335b88){return db[_0x3379('0x2b')][_0x3379('0x46')]()['then'](respondWithResult(_0x335b88,null))[_0x3379('0x43')](handleError(_0x335b88,null));};exports[_0x3379('0x47')]=function(_0x4e962b,_0x4bb311){if(_0x4e962b[_0x3379('0x45')][_0x3379('0x48')]){delete _0x4e962b[_0x3379('0x45')][_0x3379('0x48')];}return db[_0x3379('0x2b')][_0x3379('0x49')]({'where':{'uniqueid':_0x4e962b[_0x3379('0x42')]['id']}})[_0x3379('0x25')](handleEntityNotFound(_0x4bb311,null))[_0x3379('0x25')](saveUpdates(_0x4e962b[_0x3379('0x45')],null))[_0x3379('0x25')](respondWithResult(_0x4bb311,null))[_0x3379('0x43')](handleError(_0x4bb311,null));}; \ No newline at end of file +var _0xdf92=['nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','options','CmHopperHistory','count','includeAll','include','findAll','rows','catch','length','merge','create','body','describe','uniqueid','find','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','status','json','offset','undefined','limit','set','Content-Range','save','update','then','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','fields','attributes','hasOwnProperty'];(function(_0x41c746,_0x59ddf0){var _0x2d7282=function(_0x288680){while(--_0x288680){_0x41c746['push'](_0x41c746['shift']());}};_0x2d7282(++_0x59ddf0);}(_0xdf92,0x1d5));var _0x2df9=function(_0x4d8dc7,_0x4023df){_0x4d8dc7=_0x4d8dc7-0x0;var _0x44d2b7=_0xdf92[_0x4d8dc7];return _0x44d2b7;};'use strict';var emlformat=require(_0x2df9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2df9('0x1'));var jsonpatch=require(_0x2df9('0x2'));var rp=require(_0x2df9('0x3'));var moment=require(_0x2df9('0x4'));var BPromise=require(_0x2df9('0x5'));var Mustache=require('mustache');var util=require(_0x2df9('0x6'));var path=require('path');var sox=require(_0x2df9('0x7'));var csv=require(_0x2df9('0x8'));var ejs=require(_0x2df9('0x9'));var fs=require('fs');var fs_extra=require(_0x2df9('0xa'));var _=require(_0x2df9('0xb'));var squel=require(_0x2df9('0xc'));var crypto=require(_0x2df9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2df9('0xe'));var toCsv=require(_0x2df9('0x8'));var querystring=require('querystring');var Papa=require(_0x2df9('0xf'));var Redis=require('ioredis');var authService=require(_0x2df9('0x10'));var qs=require(_0x2df9('0x11'));var as=require(_0x2df9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2df9('0x13'))(_0x2df9('0x14'));var utils=require(_0x2df9('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1702cb,_0x56bee7){_0x56bee7=_0x56bee7||0xcc;return function(_0x4f889e){if(_0x4f889e){return _0x1702cb['sendStatus'](_0x56bee7);}return _0x1702cb[_0x2df9('0x16')](_0x56bee7)['end']();};}function respondWithResult(_0xdc6642,_0x37eee5){_0x37eee5=_0x37eee5||0xc8;return function(_0x5a1583){if(_0x5a1583){return _0xdc6642[_0x2df9('0x16')](_0x37eee5)[_0x2df9('0x17')](_0x5a1583);}};}function respondWithFilteredResult(_0x4bd30f,_0x14910e){return function(_0x557e99){if(_0x557e99){var _0xc06b91=typeof _0x14910e[_0x2df9('0x18')]===_0x2df9('0x19')&&typeof _0x14910e['limit']===_0x2df9('0x19');var _0x20644d=_0x557e99['count'];var _0x2048f7=_0xc06b91?0x0:_0x14910e['offset'];var _0x3b1c45=_0xc06b91?_0x557e99['count']:_0x14910e[_0x2df9('0x18')]+_0x14910e[_0x2df9('0x1a')];var _0x426ce4;if(_0x3b1c45>=_0x20644d){_0x3b1c45=_0x20644d;_0x426ce4=0xc8;}else{_0x426ce4=0xce;}_0x4bd30f[_0x2df9('0x16')](_0x426ce4);return _0x4bd30f[_0x2df9('0x1b')](_0x2df9('0x1c'),_0x2048f7+'-'+_0x3b1c45+'/'+_0x20644d)[_0x2df9('0x17')](_0x557e99);}return null;};}function patchUpdates(_0x948411){return function(_0x4d8180){try{jsonpatch['apply'](_0x4d8180,_0x948411,!![]);}catch(_0x53229b){return BPromise['reject'](_0x53229b);}return _0x4d8180[_0x2df9('0x1d')]();};}function saveUpdates(_0x45a65f,_0x4ed9b4){return function(_0x53536b){if(_0x53536b){return _0x53536b[_0x2df9('0x1e')](_0x45a65f)[_0x2df9('0x1f')](function(_0x1c6687){return _0x1c6687;});}return null;};}function removeEntity(_0x518505,_0x4786f2){return function(_0x44693a){if(_0x44693a){return _0x44693a['destroy']()[_0x2df9('0x1f')](function(){_0x518505[_0x2df9('0x16')](0xcc)[_0x2df9('0x20')]();});}};}function handleEntityNotFound(_0x57ba30,_0x1afed0){return function(_0x574438){if(!_0x574438){_0x57ba30[_0x2df9('0x21')](0x194);}return _0x574438;};}function handleError(_0xd9847f,_0x5caba6){_0x5caba6=_0x5caba6||0x1f4;return function(_0x1ebd20){logger['error'](_0x1ebd20[_0x2df9('0x22')]);if(_0x1ebd20[_0x2df9('0x23')]){delete _0x1ebd20[_0x2df9('0x23')];}_0xd9847f[_0x2df9('0x16')](_0x5caba6)[_0x2df9('0x24')](_0x1ebd20);};}exports[_0x2df9('0x25')]=function(_0x3b9ea0,_0xd13924){var _0x376496={},_0x420efd={},_0x4bb125={'count':0x0,'rows':[]};var _0xf7987=_[_0x2df9('0x26')](db['CmHopperHistory'][_0x2df9('0x27')],function(_0x1c3954){return{'name':_0x1c3954[_0x2df9('0x28')],'type':_0x1c3954['type'][_0x2df9('0x29')]};});_0x420efd[_0x2df9('0x2a')]=_['map'](_0xf7987,_0x2df9('0x23'));_0x420efd['query']=_[_0x2df9('0x2b')](_0x3b9ea0[_0x2df9('0x2c')]);_0x420efd['filters']=_[_0x2df9('0x2d')](_0x420efd[_0x2df9('0x2a')],_0x420efd[_0x2df9('0x2c')]);_0x376496['attributes']=_[_0x2df9('0x2d')](_0x420efd[_0x2df9('0x2a')],qs[_0x2df9('0x2e')](_0x3b9ea0[_0x2df9('0x2c')][_0x2df9('0x2e')]));_0x376496[_0x2df9('0x2f')]=_0x376496[_0x2df9('0x2f')]['length']?_0x376496[_0x2df9('0x2f')]:_0x420efd['model'];if(!_0x3b9ea0[_0x2df9('0x2c')][_0x2df9('0x30')](_0x2df9('0x31'))){_0x376496[_0x2df9('0x1a')]=qs['limit'](_0x3b9ea0['query'][_0x2df9('0x1a')]);_0x376496[_0x2df9('0x18')]=qs['offset'](_0x3b9ea0['query']['offset']);}_0x376496[_0x2df9('0x32')]=qs[_0x2df9('0x33')](_0x3b9ea0[_0x2df9('0x2c')]['sort']);_0x376496[_0x2df9('0x34')]=qs[_0x2df9('0x35')](_[_0x2df9('0x36')](_0x3b9ea0[_0x2df9('0x2c')],_0x420efd['filters']),_0xf7987);if(_0x3b9ea0[_0x2df9('0x2c')][_0x2df9('0x37')]){_0x376496[_0x2df9('0x34')]=_['merge'](_0x376496[_0x2df9('0x34')],{'$or':_['map'](_0xf7987,function(_0x26892c){if(_0x26892c[_0x2df9('0x38')]!==_0x2df9('0x39')){var _0x3b04fa={};_0x3b04fa[_0x26892c[_0x2df9('0x23')]]={'$like':'%'+_0x3b9ea0[_0x2df9('0x2c')][_0x2df9('0x37')]+'%'};return _0x3b04fa;}})});}_0x376496=_['merge']({},_0x376496,_0x3b9ea0[_0x2df9('0x3a')]);var _0x1ace7b={'where':_0x376496[_0x2df9('0x34')]};return db[_0x2df9('0x3b')][_0x2df9('0x3c')](_0x1ace7b)['then'](function(_0x30cd2c){_0x4bb125[_0x2df9('0x3c')]=_0x30cd2c;if(_0x3b9ea0[_0x2df9('0x2c')][_0x2df9('0x3d')]){_0x376496[_0x2df9('0x3e')]=[{'all':!![]}];}return db[_0x2df9('0x3b')][_0x2df9('0x3f')](_0x376496);})[_0x2df9('0x1f')](function(_0x5b02ca){_0x4bb125[_0x2df9('0x40')]=_0x5b02ca;return _0x4bb125;})[_0x2df9('0x1f')](respondWithFilteredResult(_0xd13924,_0x376496))[_0x2df9('0x41')](handleError(_0xd13924,null));};exports['show']=function(_0x5f2a47,_0x14ae6c){var _0x5a380a={'raw':!![],'where':{'id':_0x5f2a47['params']['id']}},_0x5d1888={};_0x5d1888[_0x2df9('0x2a')]=_[_0x2df9('0x2b')](db[_0x2df9('0x3b')][_0x2df9('0x27')]);_0x5d1888[_0x2df9('0x2c')]=_[_0x2df9('0x2b')](_0x5f2a47[_0x2df9('0x2c')]);_0x5d1888[_0x2df9('0x35')]=_['intersection'](_0x5d1888['model'],_0x5d1888[_0x2df9('0x2c')]);_0x5a380a[_0x2df9('0x2f')]=_['intersection'](_0x5d1888['model'],qs[_0x2df9('0x2e')](_0x5f2a47[_0x2df9('0x2c')][_0x2df9('0x2e')]));_0x5a380a['attributes']=_0x5a380a[_0x2df9('0x2f')][_0x2df9('0x42')]?_0x5a380a[_0x2df9('0x2f')]:_0x5d1888[_0x2df9('0x2a')];if(_0x5f2a47[_0x2df9('0x2c')][_0x2df9('0x3d')]){_0x5a380a[_0x2df9('0x3e')]=[{'all':!![]}];}_0x5a380a=_[_0x2df9('0x43')]({},_0x5a380a,_0x5f2a47[_0x2df9('0x3a')]);return db[_0x2df9('0x3b')]['find'](_0x5a380a)[_0x2df9('0x1f')](handleEntityNotFound(_0x14ae6c,null))[_0x2df9('0x1f')](respondWithResult(_0x14ae6c,null))[_0x2df9('0x41')](handleError(_0x14ae6c,null));};exports[_0x2df9('0x44')]=function(_0x22b5ba,_0x4299b7){return db[_0x2df9('0x3b')][_0x2df9('0x44')](_0x22b5ba[_0x2df9('0x45')],{})['then'](respondWithResult(_0x4299b7,0xc9))[_0x2df9('0x41')](handleError(_0x4299b7,null));};exports[_0x2df9('0x46')]=function(_0x231d57,_0x5a0547){return db['CmHopperHistory']['describe']()['then'](respondWithResult(_0x5a0547,null))['catch'](handleError(_0x5a0547,null));};exports[_0x2df9('0x1e')]=function(_0x3b83dd,_0x3950a4){if(_0x3b83dd[_0x2df9('0x45')]['uniqueid']){delete _0x3b83dd[_0x2df9('0x45')][_0x2df9('0x47')];}return db['CmHopperHistory'][_0x2df9('0x48')]({'where':{'uniqueid':_0x3b83dd[_0x2df9('0x49')]['id']}})[_0x2df9('0x1f')](handleEntityNotFound(_0x3950a4,null))[_0x2df9('0x1f')](saveUpdates(_0x3b83dd[_0x2df9('0x45')],null))[_0x2df9('0x1f')](respondWithResult(_0x3950a4,null))['catch'](handleError(_0x3950a4,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index ad7b86d..4ae49d4 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 _0xc17d=['path','rimraf','./cmHopperHistory.attributes','CmHopperHistory','cm_hopper_history','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3fa47c,_0x4c9992){var _0x143226=function(_0x2b9000){while(--_0x2b9000){_0x3fa47c['push'](_0x3fa47c['shift']());}};_0x143226(++_0x4c9992);}(_0xc17d,0x96));var _0xdc17=function(_0x14cf1d,_0x35ae74){_0x14cf1d=_0x14cf1d-0x0;var _0x433004=_0xc17d[_0x14cf1d];return _0x433004;};'use strict';var _=require(_0xdc17('0x0'));var util=require(_0xdc17('0x1'));var logger=require(_0xdc17('0x2'))(_0xdc17('0x3'));var moment=require('moment');var BPromise=require(_0xdc17('0x4'));var rp=require(_0xdc17('0x5'));var fs=require('fs');var path=require(_0xdc17('0x6'));var rimraf=require(_0xdc17('0x7'));var config=require('../../config/environment');var attributes=require(_0xdc17('0x8'));module['exports']=function(_0x47ba52,_0x44f7d0){return _0x47ba52['define'](_0xdc17('0x9'),attributes,{'tableName':_0xdc17('0xa'),'paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':_0xdc17('0xb'),'fields':[_0xdc17('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc19f=['exports','cm_hopper_history','endtime','uniqueid','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes'];(function(_0x2ee83d,_0xe17c3){var _0x37f316=function(_0xf545d6){while(--_0xf545d6){_0x2ee83d['push'](_0x2ee83d['shift']());}};_0x37f316(++_0xe17c3);}(_0xc19f,0x164));var _0xfc19=function(_0x3ebcab,_0x482df2){_0x3ebcab=_0x3ebcab-0x0;var _0x4074d3=_0xc19f[_0x3ebcab];return _0x4074d3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfc19('0x0'))(_0xfc19('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfc19('0x2'));var fs=require('fs');var path=require(_0xfc19('0x3'));var rimraf=require(_0xfc19('0x4'));var config=require(_0xfc19('0x5'));var attributes=require(_0xfc19('0x6'));module[_0xfc19('0x7')]=function(_0x3ca66e,_0x56332d){return _0x3ca66e['define']('CmHopperHistory',attributes,{'tableName':_0xfc19('0x8'),'paranoid':![],'indexes':[{'name':_0xfc19('0x9'),'fields':[_0xfc19('0x9')]},{'name':_0xfc19('0xa'),'fields':[_0xfc19('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 3503c4f..98cb355 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 _0xed8a=['then','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','code','CmHopperHistory,\x20%s,\x20%s','error','message','result','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','catch','AvgHandleTime','findAll','where','sequelize','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','col','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http'];(function(_0x51c846,_0x58d180){var _0x17b30d=function(_0x31ea5a){while(--_0x31ea5a){_0x51c846['push'](_0x51c846['shift']());}};_0x17b30d(++_0x58d180);}(_0xed8a,0xc5));var _0xaed8=function(_0x42d855,_0x52e3b6){_0x42d855=_0x42d855-0x0;var _0x44bc88=_0xed8a[_0x42d855];return _0x44bc88;};'use strict';var _=require(_0xaed8('0x0'));var util=require(_0xaed8('0x1'));var moment=require(_0xaed8('0x2'));var BPromise=require(_0xaed8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaed8('0x4'));var db=require(_0xaed8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaed8('0x6'))(_0xaed8('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xaed8('0x8')][_0xaed8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3db036,_0x2f6ab8,_0x291304){return new BPromise(function(_0x42bc11,_0x24ba07){return client['request'](_0x3db036,_0x291304)[_0xaed8('0xa')](function(_0x9c677){logger[_0xaed8('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x2f6ab8,_0xaed8('0xc'));logger[_0xaed8('0xd')](_0xaed8('0xe'),_0x2f6ab8,_0xaed8('0xc'),JSON[_0xaed8('0xf')](_0x9c677));if(_0x9c677['error']){if(_0x9c677['error'][_0xaed8('0x10')]===0x1f4){logger['error'](_0xaed8('0x11'),_0x2f6ab8,_0x9c677[_0xaed8('0x12')][_0xaed8('0x13')]);return _0x24ba07(_0x9c677[_0xaed8('0x12')]['message']);}logger[_0xaed8('0x12')](_0xaed8('0x11'),_0x2f6ab8,_0x9c677[_0xaed8('0x12')][_0xaed8('0x13')]);return _0x42bc11(_0x9c677[_0xaed8('0x12')][_0xaed8('0x13')]);}else{logger['info'](_0xaed8('0x11'),_0x2f6ab8,'request\x20sent');_0x42bc11(_0x9c677[_0xaed8('0x14')][_0xaed8('0x13')]);}})['catch'](function(_0x1827a9){logger[_0xaed8('0x12')](_0xaed8('0x11'),_0x2f6ab8,_0x1827a9);_0x24ba07(_0x1827a9);});});}exports[_0xaed8('0x15')]=function(_0x427d37){var _0x1b8eb8=this;return new Promise(function(_0x42eae7,_0x3c6313){return db[_0xaed8('0x16')][_0xaed8('0x17')](_0x427d37[_0xaed8('0x18')],{'raw':_0x427d37[_0xaed8('0x19')]?_0x427d37[_0xaed8('0x19')][_0xaed8('0x1a')]===undefined?!![]:![]:!![]})[_0xaed8('0xa')](function(_0x48828f){logger['info'](_0xaed8('0x15'),_0x427d37);logger['debug'](_0xaed8('0x15'),_0x427d37,JSON[_0xaed8('0xf')](_0x48828f));_0x42eae7(_0x48828f);})[_0xaed8('0x1b')](function(_0x344949){logger['error']('CreateCmHopperHistory',_0x344949['message'],_0x427d37);_0x3c6313(_0x1b8eb8[_0xaed8('0x12')](0x1f4,_0x344949[_0xaed8('0x13')]));});});};exports[_0xaed8('0x1c')]=function(_0x38a3f1){var _0x112eab=this;return new Promise(function(_0x3f6750,_0x290b32){return db[_0xaed8('0x16')][_0xaed8('0x1d')]({'raw':_0x38a3f1['options']?_0x38a3f1[_0xaed8('0x19')][_0xaed8('0x1a')]===undefined?!![]:![]:!![],'where':_0x38a3f1[_0xaed8('0x19')]?_0x38a3f1[_0xaed8('0x19')][_0xaed8('0x1e')]||null:null,'attributes':[[db[_0xaed8('0x1f')]['fn']('COUNT',db[_0xaed8('0x1f')]['col']('id')),_0xaed8('0x20')],[db['sequelize']['fn'](_0xaed8('0x21'),db['sequelize']['fn']('IF',db[_0xaed8('0x1f')][_0xaed8('0x22')](_0xaed8('0x23')))),_0xaed8('0x24')],[db[_0xaed8('0x1f')]['fn'](_0xaed8('0x21'),db[_0xaed8('0x1f')]['fn']('IF',db[_0xaed8('0x1f')][_0xaed8('0x22')](_0xaed8('0x25')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xaed8('0x1f')]['fn'](_0xaed8('0x21'),db[_0xaed8('0x1f')]['fn']('IF',db[_0xaed8('0x1f')][_0xaed8('0x22')]('`state`\x20=\x2011,\x201,\x20null'))),_0xaed8('0x26')],[db[_0xaed8('0x1f')]['fn'](_0xaed8('0x27'),db[_0xaed8('0x1f')]['fn']('IF',db[_0xaed8('0x1f')][_0xaed8('0x22')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),'predictiveIntervalAvgHoldtime'],[db[_0xaed8('0x1f')]['fn'](_0xaed8('0x27'),db[_0xaed8('0x1f')]['fn']('IF',db['sequelize']['literal'](_0xaed8('0x28')))),_0xaed8('0x29')]]})[_0xaed8('0xa')](function(_0x50edec){logger[_0xaed8('0xb')](_0xaed8('0x1c'),_0x38a3f1);logger[_0xaed8('0xd')]('AvgHandleTime',_0x38a3f1,JSON[_0xaed8('0xf')](_0x50edec));_0x3f6750(_0x50edec);})[_0xaed8('0x1b')](function(_0x1f1970){logger[_0xaed8('0x12')](_0xaed8('0x1c'),_0x1f1970[_0xaed8('0x13')],_0x38a3f1);_0x290b32(_0x112eab[_0xaed8('0x12')](0x1f4,_0x1f1970[_0xaed8('0x13')]));});});};exports[_0xaed8('0x2a')]=function(_0x4dd3bc){var _0x17f3be=this;return new Promise(function(_0x1f2d62,_0x2c60fd){return db[_0xaed8('0x16')]['findAll']({'raw':_0x4dd3bc[_0xaed8('0x19')]?_0x4dd3bc[_0xaed8('0x19')][_0xaed8('0x1a')]===undefined?!![]:![]:!![],'where':_0x4dd3bc[_0xaed8('0x19')]?_0x4dd3bc[_0xaed8('0x19')][_0xaed8('0x1e')]||null:null,'attributes':[[_0xaed8('0x2b'),_0xaed8('0x2c')],[db['sequelize']['fn'](_0xaed8('0x21'),db[_0xaed8('0x1f')]['fn']('IF',db['sequelize'][_0xaed8('0x22')]('`state`\x20=\x200,\x201,\x20null'))),_0xaed8('0x2d')],[db[_0xaed8('0x1f')]['fn']('COUNT',db[_0xaed8('0x1f')]['fn']('IF',db[_0xaed8('0x1f')]['literal'](_0xaed8('0x2e')))),_0xaed8('0x2f')],[db['sequelize']['fn'](_0xaed8('0x21'),db[_0xaed8('0x1f')]['fn']('IF',db['sequelize'][_0xaed8('0x22')]('`state`\x20=\x204,\x201,\x20null'))),_0xaed8('0x30')],[db[_0xaed8('0x1f')]['fn'](_0xaed8('0x21'),db['sequelize']['fn']('IF',db['sequelize'][_0xaed8('0x22')](_0xaed8('0x31')))),'outboundBusyCallsDay'],[db[_0xaed8('0x1f')]['fn'](_0xaed8('0x21'),db[_0xaed8('0x1f')]['fn']('IF',db[_0xaed8('0x1f')][_0xaed8('0x22')](_0xaed8('0x32')))),_0xaed8('0x33')],[db[_0xaed8('0x1f')]['fn'](_0xaed8('0x21'),db[_0xaed8('0x1f')]['fn']('IF',db['sequelize'][_0xaed8('0x22')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xaed8('0x34')],[db[_0xaed8('0x1f')]['fn']('COUNT',db[_0xaed8('0x1f')]['fn']('IF',db[_0xaed8('0x1f')][_0xaed8('0x22')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xaed8('0x35')],[db[_0xaed8('0x1f')]['fn']('COUNT',db[_0xaed8('0x1f')]['fn']('IF',db[_0xaed8('0x1f')][_0xaed8('0x22')](_0xaed8('0x36')))),_0xaed8('0x37')],[db[_0xaed8('0x1f')]['fn']('COUNT',db[_0xaed8('0x1f')]['fn']('IF',db[_0xaed8('0x1f')][_0xaed8('0x22')](_0xaed8('0x38')))),_0xaed8('0x39')],[db[_0xaed8('0x1f')]['fn']('COUNT',db[_0xaed8('0x1f')]['fn']('IF',db[_0xaed8('0x1f')][_0xaed8('0x22')](_0xaed8('0x3a')))),_0xaed8('0x3b')],[db[_0xaed8('0x1f')]['fn'](_0xaed8('0x21'),db[_0xaed8('0x1f')]['fn']('IF',db[_0xaed8('0x1f')][_0xaed8('0x22')]('`state`\x20=\x2018,\x201,\x20null'))),_0xaed8('0x3c')],[db[_0xaed8('0x1f')]['fn']('COUNT',db[_0xaed8('0x1f')]['fn']('IF',db[_0xaed8('0x1f')][_0xaed8('0x22')]('`state`\x20=\x2016,\x201,\x20null'))),_0xaed8('0x3d')],[db[_0xaed8('0x1f')]['fn']('COUNT',db[_0xaed8('0x1f')]['fn']('IF',db[_0xaed8('0x1f')][_0xaed8('0x22')](_0xaed8('0x3e')))),_0xaed8('0x3c')],[db[_0xaed8('0x1f')]['fn'](_0xaed8('0x21'),db['sequelize']['fn']('IF',db[_0xaed8('0x1f')][_0xaed8('0x22')](_0xaed8('0x3f')))),_0xaed8('0x40')]],'group':[_0xaed8('0x2b')]})[_0xaed8('0xa')](function(_0x2508fa){logger[_0xaed8('0xb')]('GetVoiceQueueHopperHistory',_0x4dd3bc);logger[_0xaed8('0xd')](_0xaed8('0x2a'),_0x4dd3bc,JSON[_0xaed8('0xf')](_0x2508fa));_0x1f2d62(_0x2508fa);})[_0xaed8('0x1b')](function(_0x7a404){logger[_0xaed8('0x12')](_0xaed8('0x2a'),_0x7a404[_0xaed8('0x13')],_0x4dd3bc);_0x2c60fd(_0x17f3be['error'](0x1f4,_0x7a404['message']));});});};exports[_0xaed8('0x41')]=function(_0x66a1ec){var _0x7083ec=this;return new Promise(function(_0x697f37,_0x20a637){return db[_0xaed8('0x16')][_0xaed8('0x1d')]({'raw':_0x66a1ec[_0xaed8('0x19')]?_0x66a1ec[_0xaed8('0x19')][_0xaed8('0x1a')]===undefined?!![]:![]:!![],'where':_0x66a1ec[_0xaed8('0x19')]?_0x66a1ec[_0xaed8('0x19')][_0xaed8('0x1e')]||null:null,'attributes':[[_0xaed8('0x2b'),_0xaed8('0x2c')],[db['sequelize']['fn'](_0xaed8('0x21'),db[_0xaed8('0x1f')][_0xaed8('0x42')]('id')),_0xaed8('0x43')],[db['sequelize']['fn'](_0xaed8('0x21'),db['sequelize']['fn']('IF',db[_0xaed8('0x1f')][_0xaed8('0x22')](_0xaed8('0x23')))),_0xaed8('0x44')]],'group':[_0xaed8('0x2b')]})[_0xaed8('0xa')](function(_0x1e5563){logger[_0xaed8('0xb')](_0xaed8('0x41'),_0x66a1ec);logger[_0xaed8('0xd')]('GetCampaignHopperHistory',_0x66a1ec,JSON[_0xaed8('0xf')](_0x1e5563));_0x697f37(_0x1e5563);})[_0xaed8('0x1b')](function(_0x4f1ee4){logger[_0xaed8('0x12')](_0xaed8('0x41'),_0x4f1ee4['message'],_0x66a1ec);_0x20a637(_0x7083ec[_0xaed8('0x12')](0x1f4,_0x4f1ee4['message']));});});}; \ No newline at end of file +var _0xb545=['outboundBlacklistCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperHistory,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','CreateCmHopperHistory','CmHopperHistory','create','body','options','catch','AvgHandleTime','sequelize','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','GetVoiceQueueHopperHistory','findAll','raw','where','campaign','name','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0xb545,0xcf));var _0x5b54=function(_0x2aee9e,_0x3b3652){_0x2aee9e=_0x2aee9e-0x0;var _0xcce03e=_0xb545[_0x2aee9e];return _0xcce03e;};'use strict';var _=require('lodash');var util=require(_0x5b54('0x0'));var moment=require('moment');var BPromise=require(_0x5b54('0x1'));var rs=require(_0x5b54('0x2'));var fs=require('fs');var Redis=require(_0x5b54('0x3'));var db=require(_0x5b54('0x4'))['db'];var utils=require(_0x5b54('0x5'));var logger=require('../../config/logger')(_0x5b54('0x6'));var config=require(_0x5b54('0x7'));var jayson=require(_0x5b54('0x8'));var client=jayson[_0x5b54('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50b9c1,_0x2ee77f,_0x41e579){return new BPromise(function(_0x32a785,_0x321734){return client[_0x5b54('0xa')](_0x50b9c1,_0x41e579)[_0x5b54('0xb')](function(_0x553a32){logger[_0x5b54('0xc')](_0x5b54('0xd'),_0x2ee77f,'request\x20sent');logger[_0x5b54('0xe')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x2ee77f,_0x5b54('0xf'),JSON[_0x5b54('0x10')](_0x553a32));if(_0x553a32[_0x5b54('0x11')]){if(_0x553a32[_0x5b54('0x11')][_0x5b54('0x12')]===0x1f4){logger[_0x5b54('0x11')](_0x5b54('0xd'),_0x2ee77f,_0x553a32[_0x5b54('0x11')]['message']);return _0x321734(_0x553a32['error']['message']);}logger[_0x5b54('0x11')](_0x5b54('0xd'),_0x2ee77f,_0x553a32[_0x5b54('0x11')]['message']);return _0x32a785(_0x553a32[_0x5b54('0x11')][_0x5b54('0x13')]);}else{logger[_0x5b54('0xc')](_0x5b54('0xd'),_0x2ee77f,_0x5b54('0xf'));_0x32a785(_0x553a32['result'][_0x5b54('0x13')]);}})['catch'](function(_0x257abd){logger['error'](_0x5b54('0xd'),_0x2ee77f,_0x257abd);_0x321734(_0x257abd);});});}exports[_0x5b54('0x14')]=function(_0x333aaf){var _0x331b15=this;return new Promise(function(_0x138360,_0x377e91){return db[_0x5b54('0x15')][_0x5b54('0x16')](_0x333aaf[_0x5b54('0x17')],{'raw':_0x333aaf['options']?_0x333aaf[_0x5b54('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3f933d){logger['info']('CreateCmHopperHistory',_0x333aaf);logger[_0x5b54('0xe')](_0x5b54('0x14'),_0x333aaf,JSON['stringify'](_0x3f933d));_0x138360(_0x3f933d);})[_0x5b54('0x19')](function(_0x5031f7){logger['error'](_0x5b54('0x14'),_0x5031f7[_0x5b54('0x13')],_0x333aaf);_0x377e91(_0x331b15[_0x5b54('0x11')](0x1f4,_0x5031f7[_0x5b54('0x13')]));});});};exports[_0x5b54('0x1a')]=function(_0xe954f5){var _0x395fa7=this;return new Promise(function(_0x22e5be,_0x1f9e42){return db[_0x5b54('0x15')]['findAll']({'raw':_0xe954f5['options']?_0xe954f5[_0x5b54('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xe954f5[_0x5b54('0x18')]?_0xe954f5['options']['where']||null:null,'attributes':[[db[_0x5b54('0x1b')]['fn']('COUNT',db[_0x5b54('0x1b')]['col']('id')),'predictiveIntervalTotalCalls'],[db['sequelize']['fn'](_0x5b54('0x1c'),db[_0x5b54('0x1b')]['fn']('IF',db[_0x5b54('0x1b')][_0x5b54('0x1d')](_0x5b54('0x1e')))),_0x5b54('0x1f')],[db['sequelize']['fn'](_0x5b54('0x1c'),db['sequelize']['fn']('IF',db[_0x5b54('0x1b')][_0x5b54('0x1d')](_0x5b54('0x20')))),_0x5b54('0x21')],[db[_0x5b54('0x1b')]['fn'](_0x5b54('0x1c'),db[_0x5b54('0x1b')]['fn']('IF',db['sequelize'][_0x5b54('0x1d')]('`state`\x20=\x2011,\x201,\x20null'))),_0x5b54('0x22')],[db[_0x5b54('0x1b')]['fn'](_0x5b54('0x23'),db[_0x5b54('0x1b')]['fn']('IF',db[_0x5b54('0x1b')][_0x5b54('0x1d')](_0x5b54('0x24')))),_0x5b54('0x25')],[db[_0x5b54('0x1b')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0x5b54('0x1b')][_0x5b54('0x1d')](_0x5b54('0x26')))),'predictiveIntervalAvgTalktime']]})[_0x5b54('0xb')](function(_0x179503){logger[_0x5b54('0xc')]('AvgHandleTime',_0xe954f5);logger['debug'](_0x5b54('0x1a'),_0xe954f5,JSON[_0x5b54('0x10')](_0x179503));_0x22e5be(_0x179503);})['catch'](function(_0x21559e){logger[_0x5b54('0x11')](_0x5b54('0x1a'),_0x21559e[_0x5b54('0x13')],_0xe954f5);_0x1f9e42(_0x395fa7[_0x5b54('0x11')](0x1f4,_0x21559e[_0x5b54('0x13')]));});});};exports[_0x5b54('0x27')]=function(_0x35c6a8){var _0x4e75e0=this;return new Promise(function(_0x575de5,_0x2e3a7d){return db[_0x5b54('0x15')][_0x5b54('0x28')]({'raw':_0x35c6a8['options']?_0x35c6a8[_0x5b54('0x18')][_0x5b54('0x29')]===undefined?!![]:![]:!![],'where':_0x35c6a8['options']?_0x35c6a8[_0x5b54('0x18')][_0x5b54('0x2a')]||null:null,'attributes':[[_0x5b54('0x2b'),_0x5b54('0x2c')],[db[_0x5b54('0x1b')]['fn'](_0x5b54('0x1c'),db['sequelize']['fn']('IF',db[_0x5b54('0x1b')][_0x5b54('0x1d')]('`state`\x20=\x200,\x201,\x20null'))),_0x5b54('0x2d')],[db['sequelize']['fn'](_0x5b54('0x1c'),db[_0x5b54('0x1b')]['fn']('IF',db[_0x5b54('0x1b')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x5b54('0x2e')],[db[_0x5b54('0x1b')]['fn']('COUNT',db[_0x5b54('0x1b')]['fn']('IF',db[_0x5b54('0x1b')]['literal'](_0x5b54('0x1e')))),_0x5b54('0x2f')],[db[_0x5b54('0x1b')]['fn']('COUNT',db[_0x5b54('0x1b')]['fn']('IF',db[_0x5b54('0x1b')]['literal'](_0x5b54('0x30')))),_0x5b54('0x31')],[db[_0x5b54('0x1b')]['fn']('COUNT',db[_0x5b54('0x1b')]['fn']('IF',db[_0x5b54('0x1b')][_0x5b54('0x1d')](_0x5b54('0x32')))),_0x5b54('0x33')],[db['sequelize']['fn'](_0x5b54('0x1c'),db[_0x5b54('0x1b')]['fn']('IF',db[_0x5b54('0x1b')][_0x5b54('0x1d')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x5b54('0x34')],[db[_0x5b54('0x1b')]['fn'](_0x5b54('0x1c'),db[_0x5b54('0x1b')]['fn']('IF',db[_0x5b54('0x1b')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x5b54('0x35')],[db['sequelize']['fn'](_0x5b54('0x1c'),db[_0x5b54('0x1b')]['fn']('IF',db[_0x5b54('0x1b')]['literal'](_0x5b54('0x36')))),_0x5b54('0x37')],[db['sequelize']['fn']('COUNT',db[_0x5b54('0x1b')]['fn']('IF',db[_0x5b54('0x1b')][_0x5b54('0x1d')](_0x5b54('0x38')))),_0x5b54('0x39')],[db[_0x5b54('0x1b')]['fn'](_0x5b54('0x1c'),db[_0x5b54('0x1b')]['fn']('IF',db[_0x5b54('0x1b')][_0x5b54('0x1d')]('`state`\x20=\x2014,\x201,\x20null'))),'outboundOriginateFailureCallsDay'],[db[_0x5b54('0x1b')]['fn'](_0x5b54('0x1c'),db[_0x5b54('0x1b')]['fn']('IF',db[_0x5b54('0x1b')][_0x5b54('0x1d')](_0x5b54('0x3a')))),_0x5b54('0x3b')],[db[_0x5b54('0x1b')]['fn']('COUNT',db[_0x5b54('0x1b')]['fn']('IF',db[_0x5b54('0x1b')][_0x5b54('0x1d')](_0x5b54('0x3c')))),'outboundAnswerAgiCallsDay'],[db[_0x5b54('0x1b')]['fn'](_0x5b54('0x1c'),db[_0x5b54('0x1b')]['fn']('IF',db[_0x5b54('0x1b')][_0x5b54('0x1d')](_0x5b54('0x3d')))),_0x5b54('0x3b')],[db[_0x5b54('0x1b')]['fn'](_0x5b54('0x1c'),db[_0x5b54('0x1b')]['fn']('IF',db['sequelize'][_0x5b54('0x1d')](_0x5b54('0x3e')))),'outboundReCallsDay']],'group':[_0x5b54('0x2b')]})[_0x5b54('0xb')](function(_0x1a9daf){logger[_0x5b54('0xc')](_0x5b54('0x27'),_0x35c6a8);logger[_0x5b54('0xe')]('GetVoiceQueueHopperHistory',_0x35c6a8,JSON[_0x5b54('0x10')](_0x1a9daf));_0x575de5(_0x1a9daf);})[_0x5b54('0x19')](function(_0xdeca8c){logger[_0x5b54('0x11')]('GetVoiceQueueHopperHistory',_0xdeca8c[_0x5b54('0x13')],_0x35c6a8);_0x2e3a7d(_0x4e75e0[_0x5b54('0x11')](0x1f4,_0xdeca8c[_0x5b54('0x13')]));});});};exports[_0x5b54('0x3f')]=function(_0x5ad735){var _0x3fa4b3=this;return new Promise(function(_0x28f8fa,_0x3d0cdf){return db[_0x5b54('0x15')][_0x5b54('0x28')]({'raw':_0x5ad735[_0x5b54('0x18')]?_0x5ad735[_0x5b54('0x18')][_0x5b54('0x29')]===undefined?!![]:![]:!![],'where':_0x5ad735[_0x5b54('0x18')]?_0x5ad735[_0x5b54('0x18')][_0x5b54('0x2a')]||null:null,'attributes':[['campaign',_0x5b54('0x2c')],[db['sequelize']['fn'](_0x5b54('0x1c'),db[_0x5b54('0x1b')]['col']('id')),_0x5b54('0x40')],[db['sequelize']['fn'](_0x5b54('0x1c'),db[_0x5b54('0x1b')]['fn']('IF',db[_0x5b54('0x1b')]['literal'](_0x5b54('0x1e')))),_0x5b54('0x41')]],'group':[_0x5b54('0x2b')]})[_0x5b54('0xb')](function(_0x49d990){logger['info'](_0x5b54('0x3f'),_0x5ad735);logger[_0x5b54('0xe')](_0x5b54('0x3f'),_0x5ad735,JSON[_0x5b54('0x10')](_0x49d990));_0x28f8fa(_0x49d990);})[_0x5b54('0x19')](function(_0x55ff71){logger['error'](_0x5b54('0x3f'),_0x55ff71[_0x5b54('0x13')],_0x5ad735);_0x3d0cdf(_0x3fa4b3['error'](0x1f4,_0x55ff71[_0x5b54('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index c6d977f..f3fff74 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 _0xa5f4=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','describe','show','post','/:id','exports','path','connect-timeout','express','Router'];(function(_0x4d67de,_0x270659){var _0x315f60=function(_0x5ad571){while(--_0x5ad571){_0x4d67de['push'](_0x4d67de['shift']());}};_0x315f60(++_0x270659);}(_0xa5f4,0x16c));var _0x4a5f=function(_0x111b72,_0x1b9284){_0x111b72=_0x111b72-0x0;var _0x52d312=_0xa5f4[_0x111b72];return _0x52d312;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4a5f('0x0'));var timeout=require(_0x4a5f('0x1'));var express=require(_0x4a5f('0x2'));var router=express[_0x4a5f('0x3')]();var fs_extra=require(_0x4a5f('0x4'));var auth=require(_0x4a5f('0x5'));var interaction=require(_0x4a5f('0x6'));var config=require(_0x4a5f('0x7'));var controller=require(_0x4a5f('0x8'));router[_0x4a5f('0x9')]('/',auth[_0x4a5f('0xa')](),controller['index']);router[_0x4a5f('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x4a5f('0xb')]);router[_0x4a5f('0x9')]('/:id',auth[_0x4a5f('0xa')](),controller[_0x4a5f('0xc')]);router[_0x4a5f('0xd')]('/',auth[_0x4a5f('0xa')](),controller['create']);router['put'](_0x4a5f('0xe'),auth[_0x4a5f('0xa')](),controller['update']);module[_0x4a5f('0xf')]=router; \ No newline at end of file +var _0x475b=['show','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x1434e7,_0x231cb9){var _0x2e4cec=function(_0x3bbaaa){while(--_0x3bbaaa){_0x1434e7['push'](_0x1434e7['shift']());}};_0x2e4cec(++_0x231cb9);}(_0x475b,0x1cd));var _0xb475=function(_0x15f449,_0x2f1388){_0x15f449=_0x15f449-0x0;var _0x517ab6=_0x475b[_0x15f449];return _0x517ab6;};'use strict';var multer=require(_0xb475('0x0'));var util=require(_0xb475('0x1'));var path=require(_0xb475('0x2'));var timeout=require(_0xb475('0x3'));var express=require(_0xb475('0x4'));var router=express[_0xb475('0x5')]();var fs_extra=require(_0xb475('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb475('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperHistory.controller');router[_0xb475('0x8')]('/',auth[_0xb475('0x9')](),controller[_0xb475('0xa')]);router[_0xb475('0x8')](_0xb475('0xb'),auth[_0xb475('0x9')](),controller[_0xb475('0xc')]);router[_0xb475('0x8')](_0xb475('0xd'),auth[_0xb475('0x9')](),controller[_0xb475('0xe')]);router['post']('/',auth[_0xb475('0x9')](),controller[_0xb475('0xf')]);router[_0xb475('0x10')](_0xb475('0xd'),auth[_0xb475('0x9')](),controller[_0xb475('0x11')]);module[_0xb475('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 8b7b37e..9b5ea22 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 _0xca8d=['STRING','name','sequelize','exports'];(function(_0x33d7bc,_0x46fb31){var _0x45787e=function(_0x285da7){while(--_0x285da7){_0x33d7bc['push'](_0x33d7bc['shift']());}};_0x45787e(++_0x46fb31);}(_0xca8d,0x172));var _0xdca8=function(_0x233385,_0x2bc576){_0x233385=_0x233385-0x0;var _0x4d016a=_0xca8d[_0x233385];return _0x4d016a;};'use strict';var Sequelize=require(_0xdca8('0x0'));module[_0xdca8('0x1')]={'name':{'type':Sequelize[_0xdca8('0x2')],'unique':_0xdca8('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdca8('0x2')]},'dialPrefix':{'type':Sequelize[_0xdca8('0x2')]}}; \ No newline at end of file +var _0x2209=['name','sequelize','exports','STRING'];(function(_0x249266,_0x742d23){var _0xf96f22=function(_0x386e20){while(--_0x386e20){_0x249266['push'](_0x249266['shift']());}};_0xf96f22(++_0x742d23);}(_0x2209,0x95));var _0x9220=function(_0x19da58,_0x3883b6){_0x19da58=_0x19da58-0x0;var _0x3d8ae7=_0x2209[_0x19da58];return _0x3d8ae7;};'use strict';var Sequelize=require(_0x9220('0x0'));module[_0x9220('0x1')]={'name':{'type':Sequelize[_0x9220('0x2')],'unique':_0x9220('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9220('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index aaa8aba..a3e3d10 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 _0x1f97=['ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./cmList.socket','sendStatus','status','offset','undefined','limit','count','set','json','reject','save','update','then','destroy','get','Lists','UserProfileResource','end','error','stack','name','send','map','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','CmList','body','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ListId','Disposition','getDispositions','length','nolimit','rows','removeDispositions','ids','CmContact','tags','isArray','omit','success','push','dataValues','errors','message','Malformed\x20request\x20syntax','CustomFields','concat','cf_%d','raw','getContacts','getContactsCsv','CmCustomField','format','isEmpty','setHeader','Content-disposition','list_%d_%s.csv','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','findOne','sequelize','addCustomFields','Sequelize','TEXT','text','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','getCustomFields','rawAttributes','findAndCountAll','addAgents','spread','emit','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x45e56c,_0x4235d0){var _0x4826ef=function(_0x18ae28){while(--_0x18ae28){_0x45e56c['push'](_0x45e56c['shift']());}};_0x4826ef(++_0x4235d0);}(_0x1f97,0x82));var _0x71f9=function(_0x253099,_0x4761b5){_0x253099=_0x253099-0x0;var _0x1f0861=_0x1f97[_0x253099];return _0x1f0861;};'use strict';var emlformat=require(_0x71f9('0x0'));var rimraf=require(_0x71f9('0x1'));var zipdir=require(_0x71f9('0x2'));var jsonpatch=require(_0x71f9('0x3'));var rp=require(_0x71f9('0x4'));var moment=require(_0x71f9('0x5'));var BPromise=require(_0x71f9('0x6'));var Mustache=require(_0x71f9('0x7'));var util=require(_0x71f9('0x8'));var path=require(_0x71f9('0x9'));var sox=require(_0x71f9('0xa'));var csv=require(_0x71f9('0xb'));var ejs=require(_0x71f9('0xc'));var fs=require('fs');var fs_extra=require(_0x71f9('0xd'));var _=require(_0x71f9('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x71f9('0xf'));var deskjs=require(_0x71f9('0x10'));var toCsv=require(_0x71f9('0xb'));var querystring=require('querystring');var Papa=require(_0x71f9('0x11'));var Redis=require(_0x71f9('0x12'));var authService=require(_0x71f9('0x13'));var qs=require(_0x71f9('0x14'));var as=require(_0x71f9('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x71f9('0x16'))(_0x71f9('0x17'));var utils=require('../../config/utils');var config=require(_0x71f9('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x71f9('0x19'))['db'];config['redis']=_[_0x71f9('0x1a')](config[_0x71f9('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x71f9('0x1c'))(new Redis(config[_0x71f9('0x1b')]));require(_0x71f9('0x1d'))['register'](socket);function respondWithStatusCode(_0x17664d,_0x2c80f5){_0x2c80f5=_0x2c80f5||0xcc;return function(_0xb5dba2){if(_0xb5dba2){return _0x17664d[_0x71f9('0x1e')](_0x2c80f5);}return _0x17664d[_0x71f9('0x1f')](_0x2c80f5)['end']();};}function respondWithResult(_0x4c1219,_0x5a3d6e){_0x5a3d6e=_0x5a3d6e||0xc8;return function(_0x57c530){if(_0x57c530){return _0x4c1219[_0x71f9('0x1f')](_0x5a3d6e)['json'](_0x57c530);}};}function respondWithFilteredResult(_0x59b4bd,_0x2771c3){return function(_0x169c6a){if(_0x169c6a){var _0x2e3c0a=typeof _0x2771c3[_0x71f9('0x20')]===_0x71f9('0x21')&&typeof _0x2771c3[_0x71f9('0x22')]==='undefined';var _0x3fd825=_0x169c6a['count'];var _0x572614=_0x2e3c0a?0x0:_0x2771c3[_0x71f9('0x20')];var _0x543173=_0x2e3c0a?_0x169c6a[_0x71f9('0x23')]:_0x2771c3[_0x71f9('0x20')]+_0x2771c3['limit'];var _0x50fda1;if(_0x543173>=_0x3fd825){_0x543173=_0x3fd825;_0x50fda1=0xc8;}else{_0x50fda1=0xce;}_0x59b4bd['status'](_0x50fda1);return _0x59b4bd[_0x71f9('0x24')]('Content-Range',_0x572614+'-'+_0x543173+'/'+_0x3fd825)[_0x71f9('0x25')](_0x169c6a);}return null;};}function patchUpdates(_0xe92878){return function(_0x3b2297){try{jsonpatch['apply'](_0x3b2297,_0xe92878,!![]);}catch(_0x407dc5){return BPromise[_0x71f9('0x26')](_0x407dc5);}return _0x3b2297[_0x71f9('0x27')]();};}function saveUpdates(_0x335a26,_0xbfb51c){return function(_0x471d66){if(_0x471d66){return _0x471d66[_0x71f9('0x28')](_0x335a26)[_0x71f9('0x29')](function(_0x2ec051){return _0x2ec051;});}return null;};}function removeEntity(_0x4b52b6,_0x136343){return function(_0x51f0fb){if(_0x51f0fb){return _0x51f0fb[_0x71f9('0x2a')]()[_0x71f9('0x29')](function(){var _0x1012fe=_0x51f0fb[_0x71f9('0x2b')]({'plain':!![]});var _0x1fef2b=_0x71f9('0x2c');return db[_0x71f9('0x2d')][_0x71f9('0x2a')]({'where':{'type':_0x1fef2b,'resourceId':_0x1012fe['id']}})['then'](function(){return _0x51f0fb;});})[_0x71f9('0x29')](function(){_0x4b52b6['status'](0xcc)[_0x71f9('0x2e')]();});}};}function handleEntityNotFound(_0x280a16,_0x18efc6){return function(_0x53eb27){if(!_0x53eb27){_0x280a16[_0x71f9('0x1e')](0x194);}return _0x53eb27;};}function handleError(_0x2bf51e,_0x103ab3){_0x103ab3=_0x103ab3||0x1f4;return function(_0x208514){logger[_0x71f9('0x2f')](_0x208514[_0x71f9('0x30')]);if(_0x208514[_0x71f9('0x31')]){delete _0x208514['name'];}_0x2bf51e[_0x71f9('0x1f')](_0x103ab3)[_0x71f9('0x32')](_0x208514);};}exports['index']=function(_0xdb59fb,_0x5506a1){var _0x4c6c97={},_0x350022={},_0x531367={'count':0x0,'rows':[]};var _0x5a697e=_[_0x71f9('0x33')](db['CmList']['rawAttributes'],function(_0x14f0bf){return{'name':_0x14f0bf[_0x71f9('0x34')],'type':_0x14f0bf['type'][_0x71f9('0x35')]};});_0x350022[_0x71f9('0x36')]=_[_0x71f9('0x33')](_0x5a697e,_0x71f9('0x31'));_0x350022['query']=_['keys'](_0xdb59fb[_0x71f9('0x37')]);_0x350022[_0x71f9('0x38')]=_[_0x71f9('0x39')](_0x350022[_0x71f9('0x36')],_0x350022['query']);_0x4c6c97['attributes']=_[_0x71f9('0x39')](_0x350022[_0x71f9('0x36')],qs[_0x71f9('0x3a')](_0xdb59fb['query']['fields']));_0x4c6c97[_0x71f9('0x3b')]=_0x4c6c97[_0x71f9('0x3b')]['length']?_0x4c6c97[_0x71f9('0x3b')]:_0x350022[_0x71f9('0x36')];if(!_0xdb59fb[_0x71f9('0x37')][_0x71f9('0x3c')]('nolimit')){_0x4c6c97['limit']=qs[_0x71f9('0x22')](_0xdb59fb[_0x71f9('0x37')][_0x71f9('0x22')]);_0x4c6c97[_0x71f9('0x20')]=qs[_0x71f9('0x20')](_0xdb59fb[_0x71f9('0x37')][_0x71f9('0x20')]);}_0x4c6c97[_0x71f9('0x3d')]=qs['sort'](_0xdb59fb[_0x71f9('0x37')][_0x71f9('0x3e')]);_0x4c6c97[_0x71f9('0x3f')]=qs[_0x71f9('0x38')](_[_0x71f9('0x40')](_0xdb59fb['query'],_0x350022[_0x71f9('0x38')]),_0x5a697e);if(_0xdb59fb[_0x71f9('0x37')][_0x71f9('0x41')]){_0x4c6c97[_0x71f9('0x3f')]=_[_0x71f9('0x42')](_0x4c6c97[_0x71f9('0x3f')],{'$or':_['map'](_0x5a697e,function(_0x11be69){if(_0x11be69[_0x71f9('0x43')]!==_0x71f9('0x44')){var _0x27de89={};_0x27de89[_0x11be69[_0x71f9('0x31')]]={'$like':'%'+_0xdb59fb['query']['filter']+'%'};return _0x27de89;}})});}_0x4c6c97=_['merge']({},_0x4c6c97,_0xdb59fb[_0x71f9('0x45')]);var _0x2afc3e={'where':_0x4c6c97['where']};return db['CmList'][_0x71f9('0x23')](_0x2afc3e)[_0x71f9('0x29')](function(_0x13bd87){_0x531367[_0x71f9('0x23')]=_0x13bd87;if(_0xdb59fb[_0x71f9('0x37')][_0x71f9('0x46')]){_0x4c6c97[_0x71f9('0x47')]=[{'all':!![]}];}return db['CmList'][_0x71f9('0x48')](_0x4c6c97);})['then'](function(_0x5361a9){_0x531367['rows']=_0x5361a9;return _0x531367;})['then'](respondWithFilteredResult(_0x5506a1,_0x4c6c97))[_0x71f9('0x49')](handleError(_0x5506a1,null));};exports[_0x71f9('0x4a')]=function(_0x3bb4ba,_0x32ab8e){var _0x57d9c9={'raw':![],'where':{'id':_0x3bb4ba[_0x71f9('0x4b')]['id']}},_0x21b746={};_0x21b746[_0x71f9('0x36')]=_[_0x71f9('0x4c')](db['CmList']['rawAttributes']);_0x21b746[_0x71f9('0x37')]=_[_0x71f9('0x4c')](_0x3bb4ba[_0x71f9('0x37')]);_0x21b746[_0x71f9('0x38')]=_[_0x71f9('0x39')](_0x21b746[_0x71f9('0x36')],_0x21b746['query']);_0x57d9c9[_0x71f9('0x3b')]=_[_0x71f9('0x39')](_0x21b746['model'],qs[_0x71f9('0x3a')](_0x3bb4ba[_0x71f9('0x37')][_0x71f9('0x3a')]));_0x57d9c9[_0x71f9('0x3b')]=_0x57d9c9[_0x71f9('0x3b')]['length']?_0x57d9c9['attributes']:_0x21b746[_0x71f9('0x36')];if(_0x3bb4ba[_0x71f9('0x37')][_0x71f9('0x46')]){_0x57d9c9[_0x71f9('0x47')]=[{'all':!![]}];}_0x57d9c9=_[_0x71f9('0x42')]({},_0x57d9c9,_0x3bb4ba['options']);return db['CmList'][_0x71f9('0x4d')](_0x57d9c9)[_0x71f9('0x29')](handleEntityNotFound(_0x32ab8e,null))[_0x71f9('0x29')](respondWithResult(_0x32ab8e,null))[_0x71f9('0x49')](handleError(_0x32ab8e,null));};exports[_0x71f9('0x4e')]=function(_0x42b0ab,_0x134a79){return db[_0x71f9('0x4f')]['create'](_0x42b0ab[_0x71f9('0x50')],{})['then'](function(_0x581aaa){var _0x50ecfb=_0x42b0ab[_0x71f9('0x51')][_0x71f9('0x2b')]({'plain':!![]});if(!_0x50ecfb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x50ecfb['role']===_0x71f9('0x51')){var _0x86a0d3=_0x581aaa[_0x71f9('0x2b')]({'plain':!![]});var _0x56b579=_0x71f9('0x2c');return db[_0x71f9('0x52')][_0x71f9('0x4d')]({'where':{'name':_0x56b579,'userProfileId':_0x50ecfb['userProfileId']},'raw':!![]})[_0x71f9('0x29')](function(_0x54d82c){if(_0x54d82c&&_0x54d82c[_0x71f9('0x53')]===0x0){return db[_0x71f9('0x2d')][_0x71f9('0x4e')]({'name':_0x86a0d3[_0x71f9('0x31')],'resourceId':_0x86a0d3['id'],'type':_0x54d82c[_0x71f9('0x31')],'sectionId':_0x54d82c['id']},{})['then'](function(){return _0x581aaa;});}else{return _0x581aaa;}})[_0x71f9('0x49')](function(_0x4e849a){logger[_0x71f9('0x2f')](_0x71f9('0x54'),_0x4e849a);throw _0x4e849a;});}return _0x581aaa;})[_0x71f9('0x29')](respondWithResult(_0x134a79,0xc9))[_0x71f9('0x49')](handleError(_0x134a79,null));};exports[_0x71f9('0x28')]=function(_0x43ab37,_0x19c2a0){if(_0x43ab37[_0x71f9('0x50')]['id']){delete _0x43ab37[_0x71f9('0x50')]['id'];}return db[_0x71f9('0x4f')][_0x71f9('0x4d')]({'where':{'id':_0x43ab37[_0x71f9('0x4b')]['id']}})['then'](handleEntityNotFound(_0x19c2a0,null))[_0x71f9('0x29')](saveUpdates(_0x43ab37[_0x71f9('0x50')],null))[_0x71f9('0x29')](respondWithResult(_0x19c2a0,null))['catch'](handleError(_0x19c2a0,null));};exports[_0x71f9('0x2a')]=function(_0x24da84,_0x3baa41){return db[_0x71f9('0x4f')]['find']({'where':{'id':_0x24da84[_0x71f9('0x4b')]['id']}})[_0x71f9('0x29')](handleEntityNotFound(_0x3baa41,null))['then'](removeEntity(_0x3baa41,null))[_0x71f9('0x49')](handleError(_0x3baa41,null));};exports['describe']=function(_0x18889f,_0x339599){return db[_0x71f9('0x4f')][_0x71f9('0x55')]()[_0x71f9('0x29')](respondWithResult(_0x339599,null))[_0x71f9('0x49')](handleError(_0x339599,null));};exports['addDisposition']=function(_0x3a7716,_0x14cf7d,_0x498832){if(_0x3a7716[_0x71f9('0x50')]['id']){delete _0x3a7716[_0x71f9('0x50')]['id'];}return db[_0x71f9('0x4f')][_0x71f9('0x4d')]({'where':{'id':_0x3a7716['params']['id']}})[_0x71f9('0x29')](handleEntityNotFound(_0x14cf7d,null))[_0x71f9('0x29')](function(_0x294b4c){if(_0x294b4c){_0x3a7716['body'][_0x71f9('0x56')]=_0x294b4c['id'];return db[_0x71f9('0x57')][_0x71f9('0x4e')](_0x3a7716[_0x71f9('0x50')]);}})[_0x71f9('0x29')](respondWithResult(_0x14cf7d,null))[_0x71f9('0x49')](handleError(_0x14cf7d,null));};exports[_0x71f9('0x58')]=function(_0x5e1cfc,_0x1e4a6e,_0x386e5d){var _0x387c21={'raw':![],'where':{}};var _0x188d3a={};var _0x5e6a8d={'count':0x0,'rows':[]};return db[_0x71f9('0x4f')]['findOne']({'where':{'id':_0x5e1cfc[_0x71f9('0x4b')]['id']}})[_0x71f9('0x29')](handleEntityNotFound(_0x1e4a6e,null))[_0x71f9('0x29')](function(_0x29e2ad){if(_0x29e2ad){_0x188d3a[_0x71f9('0x36')]=_[_0x71f9('0x4c')](db['Disposition']['rawAttributes']);_0x188d3a[_0x71f9('0x37')]=_[_0x71f9('0x4c')](_0x5e1cfc[_0x71f9('0x37')]);_0x188d3a[_0x71f9('0x38')]=_[_0x71f9('0x39')](_0x188d3a['model'],_0x188d3a[_0x71f9('0x37')]);_0x387c21[_0x71f9('0x3b')]=_['intersection'](_0x188d3a['model'],qs[_0x71f9('0x3a')](_0x5e1cfc['query'][_0x71f9('0x3a')]));_0x387c21[_0x71f9('0x3b')]=_0x387c21[_0x71f9('0x3b')][_0x71f9('0x59')]?_0x387c21[_0x71f9('0x3b')]:_0x188d3a[_0x71f9('0x36')];if(!_0x5e1cfc[_0x71f9('0x37')][_0x71f9('0x3c')](_0x71f9('0x5a'))){_0x387c21[_0x71f9('0x22')]=qs[_0x71f9('0x22')](_0x5e1cfc[_0x71f9('0x37')][_0x71f9('0x22')]);_0x387c21[_0x71f9('0x20')]=qs[_0x71f9('0x20')](_0x5e1cfc[_0x71f9('0x37')][_0x71f9('0x20')]);}_0x387c21['order']=qs[_0x71f9('0x3e')](_0x5e1cfc[_0x71f9('0x37')][_0x71f9('0x3e')]);_0x387c21[_0x71f9('0x3f')]=qs[_0x71f9('0x38')](_[_0x71f9('0x40')](_0x5e1cfc[_0x71f9('0x37')],_0x188d3a['filters']));_0x387c21[_0x71f9('0x3f')][_0x71f9('0x56')]=_0x29e2ad['id'];if(_0x5e1cfc[_0x71f9('0x37')][_0x71f9('0x41')]){_0x387c21[_0x71f9('0x3f')]=_[_0x71f9('0x42')](_0x387c21[_0x71f9('0x3f')],{'$or':_[_0x71f9('0x33')](_0x387c21[_0x71f9('0x3b')],function(_0x521887){var _0x1bfb2a={};_0x1bfb2a[_0x521887]={'$like':'%'+_0x5e1cfc['query'][_0x71f9('0x41')]+'%'};return _0x1bfb2a;})});}_0x387c21=_[_0x71f9('0x42')]({},_0x387c21,_0x5e1cfc[_0x71f9('0x45')]);return db[_0x71f9('0x57')]['count']({'where':_0x387c21[_0x71f9('0x3f')]})[_0x71f9('0x29')](function(_0x30aa40){_0x5e6a8d['count']=_0x30aa40;if(_0x5e1cfc[_0x71f9('0x37')][_0x71f9('0x46')]){_0x387c21[_0x71f9('0x47')]=[{'all':!![]}];}return db[_0x71f9('0x57')]['findAll'](_0x387c21);})[_0x71f9('0x29')](function(_0x47dcd7){_0x5e6a8d[_0x71f9('0x5b')]=_0x47dcd7;return _0x5e6a8d;});}})[_0x71f9('0x29')](respondWithFilteredResult(_0x1e4a6e,_0x387c21))[_0x71f9('0x49')](handleError(_0x1e4a6e,null));};exports[_0x71f9('0x5c')]=function(_0x2da65e,_0x543ec7,_0x55e47c){return db[_0x71f9('0x4f')][_0x71f9('0x4d')]({'where':{'id':_0x2da65e[_0x71f9('0x4b')]['id']}})[_0x71f9('0x29')](handleEntityNotFound(_0x543ec7,null))['then'](function(_0x52a2e7){if(_0x52a2e7){return _0x52a2e7[_0x71f9('0x5c')](_0x2da65e[_0x71f9('0x37')][_0x71f9('0x5d')]);}})[_0x71f9('0x29')](respondWithStatusCode(_0x543ec7,null))[_0x71f9('0x49')](handleError(_0x543ec7,null));};exports['addContacts']=function(_0x10959d,_0x31669c,_0x17f68a){return db['CmList']['find']({'where':{'id':_0x10959d['params']['id']}})['then'](handleEntityNotFound(_0x31669c,null))[_0x71f9('0x29')](function(_0x2118e5){if(_0x2118e5){var _0x50dd56=[];var _0x41d678={'success':[],'errors':[]};return db[_0x71f9('0x5e')][_0x71f9('0x55')]()['then'](function(_0x470069){if(_0x10959d[_0x71f9('0x50')][_0x71f9('0x5f')]&&_[_0x71f9('0x60')](_0x10959d[_0x71f9('0x50')][_0x71f9('0x5f')])){if(_0x10959d[_0x71f9('0x50')][_0x71f9('0x5f')][_0x71f9('0x59')]){_0x10959d['body'][_0x71f9('0x5f')]=_0x10959d[_0x71f9('0x50')][_0x71f9('0x5f')]['join'](';')+';';}else{_0x10959d['body'][_0x71f9('0x5f')]=null;}}else{_0x10959d[_0x71f9('0x50')]['tags']=null;}if(_0x10959d[_0x71f9('0x50')]&&_[_0x71f9('0x60')](_0x10959d[_0x71f9('0x50')])){for(var _0x1419ed=0x0;_0x1419ed<_0x10959d[_0x71f9('0x50')]['length'];_0x1419ed+=0x1){_0x10959d[_0x71f9('0x50')][_0x1419ed]['ListId']=_0x10959d['params']['id'];_0x50dd56['push'](_0x10959d[_0x71f9('0x50')][_0x1419ed]);}return BPromise['each'](_0x50dd56,function(_0x17e6b9){return db[_0x71f9('0x5e')][_0x71f9('0x4e')](_[_0x71f9('0x61')](_0x17e6b9,['ids','id'])||{},{'fields':_[_0x71f9('0x4c')](_0x470069),'raw':!![]})[_0x71f9('0x29')](function(_0x1531eb){_0x41d678[_0x71f9('0x62')][_0x71f9('0x63')](_0x1531eb[_0x71f9('0x64')]);})[_0x71f9('0x49')](function(_0x5a55be){_0x41d678[_0x71f9('0x65')][_0x71f9('0x63')]({'data':_0x17e6b9,'error':_0x5a55be[_0x71f9('0x66')]});});})[_0x71f9('0x29')](function(_0x26cf65){return _0x41d678;})[_0x71f9('0x49')](function(_0x251177){return _0x251177;});}else{_0x31669c[_0x71f9('0x1f')](0x190)[_0x71f9('0x25')]({'message':_0x71f9('0x67')});}});}})[_0x71f9('0x29')](respondWithResult(_0x31669c,null))['catch'](handleError(_0x31669c,null));};exports['getContacts']=function(_0x41c2aa,_0x252ccb,_0x4b55c9){var _0x5d72e8;return db[_0x71f9('0x4f')][_0x71f9('0x4d')]({'where':{'id':_0x41c2aa[_0x71f9('0x4b')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x71f9('0x68')}]})['then'](handleEntityNotFound(_0x252ccb,null))[_0x71f9('0x29')](function(_0x4994ce){if(_0x4994ce){_0x5d72e8=_0x4994ce;return db[_0x71f9('0x5e')]['rawAttributes'];}})[_0x71f9('0x29')](function(_0x1453d9){if(_0x1453d9){var _0x17affb={};var _0x4ee355={};_0x4ee355['model']=_[_0x71f9('0x69')](_['keys'](_0x1453d9),_[_0x71f9('0x33')](_0x5d72e8['CustomFields'],function(_0x36dc3d){return util['format'](_0x71f9('0x6a'),_0x36dc3d['id']);}));_0x4ee355[_0x71f9('0x37')]=_[_0x71f9('0x4c')](_0x41c2aa[_0x71f9('0x37')]);_0x4ee355['filters']=_['intersection'](_0x4ee355[_0x71f9('0x36')],_0x4ee355['query']);_0x17affb[_0x71f9('0x3b')]=_['intersection'](_0x4ee355[_0x71f9('0x36')],qs[_0x71f9('0x3a')](_0x41c2aa[_0x71f9('0x37')]['fields']));_0x17affb[_0x71f9('0x3b')]=_0x17affb[_0x71f9('0x3b')]['length']?_0x17affb[_0x71f9('0x3b')]:_0x4ee355['model'];if(!_0x41c2aa[_0x71f9('0x37')][_0x71f9('0x3c')]('nolimit')){_0x17affb[_0x71f9('0x22')]=qs[_0x71f9('0x22')](_0x41c2aa['query'][_0x71f9('0x22')]);_0x17affb['offset']=qs[_0x71f9('0x20')](_0x41c2aa[_0x71f9('0x37')][_0x71f9('0x20')]);}_0x17affb[_0x71f9('0x3d')]=qs['sort'](_0x41c2aa[_0x71f9('0x37')][_0x71f9('0x3e')]);_0x17affb[_0x71f9('0x3f')]=qs[_0x71f9('0x38')](_['pick'](_0x41c2aa[_0x71f9('0x37')],_0x4ee355[_0x71f9('0x38')]));_0x17affb[_0x71f9('0x6b')]=!![];if(_0x41c2aa[_0x71f9('0x37')]['filter']){_0x17affb[_0x71f9('0x3f')]=_['merge'](_0x17affb[_0x71f9('0x3f')],{'$or':_[_0x71f9('0x33')](_0x17affb['attributes'],function(_0x4baca1){var _0x4704={};_0x4704[_0x4baca1]={'$like':'%'+_0x41c2aa[_0x71f9('0x37')][_0x71f9('0x41')]+'%'};return _0x4704;})});}_0x17affb=_[_0x71f9('0x42')]({},_0x17affb,_0x41c2aa[_0x71f9('0x45')]);return _0x5d72e8[_0x71f9('0x6c')](_0x17affb);}})['then'](respondWithResult(_0x252ccb,null))[_0x71f9('0x49')](handleError(_0x252ccb,null));};exports[_0x71f9('0x6d')]=function(_0x865b99,_0x41f443,_0x56e82f){var _0x355220;return db[_0x71f9('0x4f')][_0x71f9('0x4d')]({'where':{'id':_0x865b99[_0x71f9('0x4b')]['id']},'include':[{'model':db[_0x71f9('0x6e')],'as':_0x71f9('0x68')}]})[_0x71f9('0x29')](handleEntityNotFound(_0x41f443,null))[_0x71f9('0x29')](function(_0x5ebcd2){if(_0x5ebcd2){_0x355220=_0x5ebcd2;return db[_0x71f9('0x5e')]['rawAttributes'];}})[_0x71f9('0x29')](function(_0x35320c){if(_0x35320c){var _0x2b3de3={};var _0x1c7047={};_0x1c7047[_0x71f9('0x36')]=_[_0x71f9('0x69')](_[_0x71f9('0x4c')](_0x35320c),_[_0x71f9('0x33')](_0x355220[_0x71f9('0x68')],function(_0x158aa6){return util[_0x71f9('0x6f')](_0x71f9('0x6a'),_0x158aa6['id']);}));_0x1c7047[_0x71f9('0x37')]=_[_0x71f9('0x4c')](_0x865b99[_0x71f9('0x37')]);_0x1c7047[_0x71f9('0x38')]=_[_0x71f9('0x39')](_0x1c7047[_0x71f9('0x36')],_0x1c7047['query']);_0x2b3de3[_0x71f9('0x3b')]=_[_0x71f9('0x39')](_0x1c7047[_0x71f9('0x36')],qs[_0x71f9('0x3a')](_0x865b99[_0x71f9('0x37')][_0x71f9('0x3a')]));_0x2b3de3[_0x71f9('0x3b')]=_0x2b3de3[_0x71f9('0x3b')][_0x71f9('0x59')]?_0x2b3de3[_0x71f9('0x3b')]:_0x1c7047['model'];if(!_0x865b99[_0x71f9('0x37')]['hasOwnProperty'](_0x71f9('0x5a'))){_0x2b3de3[_0x71f9('0x22')]=qs[_0x71f9('0x22')](_0x865b99[_0x71f9('0x37')][_0x71f9('0x22')]);_0x2b3de3[_0x71f9('0x20')]=qs[_0x71f9('0x20')](_0x865b99['query'][_0x71f9('0x20')]);}_0x2b3de3[_0x71f9('0x3d')]=qs[_0x71f9('0x3e')](_0x865b99[_0x71f9('0x37')][_0x71f9('0x3e')]);_0x2b3de3[_0x71f9('0x3f')]=qs[_0x71f9('0x38')](_[_0x71f9('0x40')](_0x865b99[_0x71f9('0x37')],_0x1c7047[_0x71f9('0x38')]));_0x2b3de3[_0x71f9('0x6b')]=!![];if(_0x865b99[_0x71f9('0x37')][_0x71f9('0x41')]){_0x2b3de3[_0x71f9('0x3f')]=_[_0x71f9('0x42')](_0x2b3de3[_0x71f9('0x3f')],{'$or':_[_0x71f9('0x33')](_0x2b3de3[_0x71f9('0x3b')],function(_0x5ae810){var _0x13107f={};_0x13107f[_0x5ae810]={'$like':'%'+_0x865b99['query'][_0x71f9('0x41')]+'%'};return _0x13107f;})});}_0x2b3de3=_[_0x71f9('0x42')]({},_0x2b3de3,_0x865b99['options']);return _0x355220[_0x71f9('0x6c')](_0x2b3de3);}})[_0x71f9('0x29')](function(_0x9b7a64){if(!_[_0x71f9('0x70')](_0x9b7a64)){var _0x72929d=toCsv(_0x9b7a64);var _0xb88ce=Date['now']();fs['writeFileSync'](util[_0x71f9('0x6f')]('/tmp/list_%d_%s.csv',_0x355220['id'],_0xb88ce),_0x72929d);_0x41f443[_0x71f9('0x71')](_0x71f9('0x72'),'attachment;\x20filename='+util['format'](_0x71f9('0x73'),_0x355220['id'],_0xb88ce));_0x41f443[_0x71f9('0x71')](_0x71f9('0x74'),_0x71f9('0x75'));return _0x41f443[_0x71f9('0x76')](util[_0x71f9('0x6f')](_0x71f9('0x77'),_0x355220['id'],_0xb88ce));}else{return _0x41f443[_0x71f9('0x1e')](0xcc);}})[_0x71f9('0x49')](handleError(_0x41f443,null));};exports[_0x71f9('0x78')]=function(_0x92e15e,_0x4ae22d,_0x3a974f){var _0x22f7a2;delete _0x92e15e[_0x71f9('0x50')]['id'];return db[_0x71f9('0x4f')][_0x71f9('0x79')]({'where':{'id':_0x92e15e[_0x71f9('0x4b')]['id']}})[_0x71f9('0x29')](handleEntityNotFound(_0x4ae22d,null))[_0x71f9('0x29')](function(_0x1f7688){if(_0x1f7688){return db[_0x71f9('0x7a')]['transaction'](function(_0x1c9282){return db['CmCustomField'][_0x71f9('0x4e')](_0x92e15e[_0x71f9('0x50')],{'transaction':_0x1c9282})[_0x71f9('0x29')](function(_0xa882c5){_0x22f7a2=_0xa882c5;return _0x1f7688[_0x71f9('0x7b')](_0xa882c5,{'transaction':_0x1c9282});})['then'](function(){var _0x1dc7f9={'type':db[_0x71f9('0x7c')][_0x71f9('0x7d')],'transaction':_0x1c9282};switch(_0x92e15e[_0x71f9('0x50')]['type']){case _0x71f9('0x7e'):_0x1dc7f9[_0x71f9('0x43')]=db[_0x71f9('0x7c')]['TEXT'];break;case'number':_0x1dc7f9['type']=db[_0x71f9('0x7c')][_0x71f9('0x7f')];break;case _0x71f9('0x80'):_0x1dc7f9[_0x71f9('0x43')]=db[_0x71f9('0x7c')][_0x71f9('0x81')];_0x1dc7f9[_0x71f9('0x82')]=![];break;default:}return db['sequelize'][_0x71f9('0x83')]['addColumn']('cm_contacts',util['format']('cf_%s',_0x22f7a2['id']),_0x1dc7f9);})[_0x71f9('0x29')](function(){return _0x22f7a2;});});}})[_0x71f9('0x29')](respondWithResult(_0x4ae22d,null))[_0x71f9('0x49')](handleError(_0x4ae22d,null));};exports[_0x71f9('0x84')]=function(_0x1b4c82,_0x3ea26b,_0x511a3d){var _0x171701={};var _0x3fc663={};var _0x27572b;var _0x51930d;return db[_0x71f9('0x4f')][_0x71f9('0x79')]({'where':{'id':_0x1b4c82[_0x71f9('0x4b')]['id']}})[_0x71f9('0x29')](handleEntityNotFound(_0x3ea26b,null))['then'](function(_0x5a18a4){if(_0x5a18a4){_0x27572b=_0x5a18a4;_0x3fc663['model']=_[_0x71f9('0x4c')](db[_0x71f9('0x6e')][_0x71f9('0x85')]);_0x3fc663[_0x71f9('0x37')]=_[_0x71f9('0x4c')](_0x1b4c82[_0x71f9('0x37')]);_0x3fc663['filters']=_[_0x71f9('0x39')](_0x3fc663[_0x71f9('0x36')],_0x3fc663[_0x71f9('0x37')]);_0x171701[_0x71f9('0x3b')]=_[_0x71f9('0x39')](_0x3fc663['model'],qs[_0x71f9('0x3a')](_0x1b4c82[_0x71f9('0x37')][_0x71f9('0x3a')]));_0x171701['attributes']=_0x171701['attributes']['length']?_0x171701[_0x71f9('0x3b')]:_0x3fc663[_0x71f9('0x36')];_0x171701['order']=qs[_0x71f9('0x3e')](_0x1b4c82[_0x71f9('0x37')][_0x71f9('0x3e')]);_0x171701[_0x71f9('0x3f')]=qs[_0x71f9('0x38')](_[_0x71f9('0x40')](_0x1b4c82['query'],_0x3fc663['filters']));_0x171701[_0x71f9('0x3f')]=_['merge'](_0x171701[_0x71f9('0x3f')],{'$or':[{'ListId':_0x5a18a4['id']},{'ListId':null}]});if(_0x1b4c82[_0x71f9('0x37')]['filter']){_0x171701[_0x71f9('0x3f')]=_['merge'](_0x171701[_0x71f9('0x3f')],{'$or':_['map'](_0x171701[_0x71f9('0x3b')],function(_0x3eb63a){var _0x346f38={};_0x346f38[_0x3eb63a]={'$like':'%'+_0x1b4c82[_0x71f9('0x37')][_0x71f9('0x41')]+'%'};return _0x346f38;})});}_0x171701=_[_0x71f9('0x42')]({},_0x171701,_0x1b4c82[_0x71f9('0x45')]);return db['CmCustomField'][_0x71f9('0x86')](_0x171701);}})['then'](respondWithResult(_0x3ea26b,null))[_0x71f9('0x49')](handleError(_0x3ea26b,null));};exports[_0x71f9('0x87')]=function(_0x1f65e9,_0x4e1320,_0x82f8ea){return db[_0x71f9('0x4f')][_0x71f9('0x4d')]({'where':{'id':_0x1f65e9['params']['id']}})[_0x71f9('0x29')](handleEntityNotFound(_0x4e1320,null))['then'](function(_0x58788e){if(_0x58788e){return _0x58788e[_0x71f9('0x87')](_0x1f65e9[_0x71f9('0x50')]['ids'],_[_0x71f9('0x61')](_0x1f65e9[_0x71f9('0x50')],['ids','id'])||{})[_0x71f9('0x88')](function(_0x3791f2){for(var _0x4f2628=0x0;_0x4f2628<_0x1f65e9[_0x71f9('0x50')][_0x71f9('0x5d')][_0x71f9('0x59')];_0x4f2628+=0x1){socket[_0x71f9('0x89')]('userCmList:save',{'UserId':Number(_0x1f65e9[_0x71f9('0x50')][_0x71f9('0x5d')][_0x4f2628]),'CmListId':Number(_0x1f65e9[_0x71f9('0x4b')]['id'])});}return _0x3791f2;});}})[_0x71f9('0x29')](respondWithResult(_0x4e1320,null))[_0x71f9('0x49')](handleError(_0x4e1320,null));};exports[_0x71f9('0x8a')]=function(_0x5613f3,_0x15c859,_0x16210c){return db[_0x71f9('0x4f')][_0x71f9('0x4d')]({'where':{'id':_0x5613f3[_0x71f9('0x4b')]['id']}})[_0x71f9('0x29')](handleEntityNotFound(_0x15c859,null))['then'](function(_0x31ad56){if(_0x31ad56){return _0x31ad56[_0x71f9('0x8a')](_0x5613f3['query']['ids'])[_0x71f9('0x29')](function(){if(_['isArray'](_0x5613f3[_0x71f9('0x37')][_0x71f9('0x5d')])){for(var _0x1bb433=0x0;_0x1bb433<_0x5613f3['query']['ids'][_0x71f9('0x59')];_0x1bb433+=0x1){socket[_0x71f9('0x89')](_0x71f9('0x8b'),{'UserId':Number(_0x5613f3[_0x71f9('0x37')][_0x71f9('0x5d')][_0x1bb433]),'CmListId':Number(_0x5613f3[_0x71f9('0x4b')]['id'])});}}else{socket[_0x71f9('0x89')](_0x71f9('0x8b'),{'UserId':Number(_0x5613f3['query']['ids']),'CmListId':Number(_0x5613f3[_0x71f9('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x15c859,null))['catch'](handleError(_0x15c859,null));};exports[_0x71f9('0x8c')]=function(_0x6a686c,_0x5b866f,_0x176f6e){var _0x4162d3={};var _0x465f1d={};var _0x417d3d;var _0x3a4433;return db[_0x71f9('0x4f')][_0x71f9('0x79')]({'where':{'id':_0x6a686c[_0x71f9('0x4b')]['id']}})[_0x71f9('0x29')](handleEntityNotFound(_0x5b866f,null))[_0x71f9('0x29')](function(_0x249219){if(_0x249219){_0x417d3d=_0x249219;_0x465f1d[_0x71f9('0x36')]=_[_0x71f9('0x4c')](db[_0x71f9('0x8d')]['rawAttributes']);_0x465f1d['query']=_[_0x71f9('0x4c')](_0x6a686c[_0x71f9('0x37')]);_0x465f1d[_0x71f9('0x38')]=_[_0x71f9('0x39')](_0x465f1d[_0x71f9('0x36')],_0x465f1d[_0x71f9('0x37')]);_0x4162d3[_0x71f9('0x3b')]=_['intersection'](_0x465f1d[_0x71f9('0x36')],qs[_0x71f9('0x3a')](_0x6a686c[_0x71f9('0x37')][_0x71f9('0x3a')]));_0x4162d3[_0x71f9('0x3b')]=_0x4162d3['attributes'][_0x71f9('0x59')]?_0x4162d3[_0x71f9('0x3b')]:_0x465f1d[_0x71f9('0x36')];_0x4162d3['order']=qs[_0x71f9('0x3e')](_0x6a686c[_0x71f9('0x37')][_0x71f9('0x3e')]);_0x4162d3[_0x71f9('0x3f')]=qs[_0x71f9('0x38')](_[_0x71f9('0x40')](_0x6a686c[_0x71f9('0x37')],_0x465f1d[_0x71f9('0x38')]));if(_0x6a686c[_0x71f9('0x37')][_0x71f9('0x41')]){_0x4162d3[_0x71f9('0x3f')]=_[_0x71f9('0x42')](_0x4162d3['where'],{'$or':_[_0x71f9('0x33')](_0x4162d3[_0x71f9('0x3b')],function(_0x556b00){var _0x3404d5={};_0x3404d5[_0x556b00]={'$like':'%'+_0x6a686c[_0x71f9('0x37')][_0x71f9('0x41')]+'%'};return _0x3404d5;})});}_0x4162d3=_[_0x71f9('0x42')]({},_0x4162d3,_0x6a686c[_0x71f9('0x45')]);return _0x417d3d['getAgents'](_0x4162d3);}})[_0x71f9('0x29')](function(_0x5cf65f){if(_0x5cf65f){_0x3a4433=_0x5cf65f[_0x71f9('0x59')];if(!_0x6a686c[_0x71f9('0x37')][_0x71f9('0x3c')](_0x71f9('0x5a'))){_0x4162d3[_0x71f9('0x22')]=qs[_0x71f9('0x22')](_0x6a686c[_0x71f9('0x37')][_0x71f9('0x22')]);_0x4162d3['offset']=qs[_0x71f9('0x20')](_0x6a686c[_0x71f9('0x37')][_0x71f9('0x20')]);}return _0x417d3d[_0x71f9('0x8c')](_0x4162d3);}})['then'](function(_0x465aa2){if(_0x465aa2){return _0x465aa2?{'count':_0x3a4433,'rows':_0x465aa2}:null;}})['then'](respondWithResult(_0x5b866f,null))[_0x71f9('0x49')](handleError(_0x5b866f,null));}; \ No newline at end of file +var _0x4143=['../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','Lists','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','CmList','includeAll','include','findAll','rows','show','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ListId','findOne','Disposition','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','omit','dataValues','errors','message','CmCustomField','CustomFields','concat','raw','getContacts','getContactsCsv','format','isEmpty','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','sendStatus','transaction','addCustomFields','Sequelize','TEXT','number','INTEGER','switch','defaultValue','queryInterface','addColumn','cm_contacts','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x4143,0x106));var _0x3414=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x4143[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0x3414('0x0'));var rimraf=require(_0x3414('0x1'));var zipdir=require(_0x3414('0x2'));var jsonpatch=require(_0x3414('0x3'));var rp=require(_0x3414('0x4'));var moment=require(_0x3414('0x5'));var BPromise=require(_0x3414('0x6'));var Mustache=require(_0x3414('0x7'));var util=require(_0x3414('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x3414('0x9'));var ejs=require(_0x3414('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3414('0xb'));var squel=require(_0x3414('0xc'));var crypto=require('crypto');var jsforce=require(_0x3414('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3414('0x9'));var querystring=require(_0x3414('0xe'));var Papa=require(_0x3414('0xf'));var Redis=require(_0x3414('0x10'));var authService=require(_0x3414('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3414('0x12'));var hardwareService=require(_0x3414('0x13'));var logger=require(_0x3414('0x14'))(_0x3414('0x15'));var utils=require(_0x3414('0x16'));var config=require(_0x3414('0x17'));var licenseUtil=require(_0x3414('0x18'));var db=require(_0x3414('0x19'))['db'];config[_0x3414('0x1a')]=_[_0x3414('0x1b')](config['redis'],{'host':_0x3414('0x1c'),'port':0x18eb});var socket=require(_0x3414('0x1d'))(new Redis(config[_0x3414('0x1a')]));require(_0x3414('0x1e'))[_0x3414('0x1f')](socket);function respondWithStatusCode(_0xe86160,_0x4e7bb3){_0x4e7bb3=_0x4e7bb3||0xcc;return function(_0x19396d){if(_0x19396d){return _0xe86160['sendStatus'](_0x4e7bb3);}return _0xe86160[_0x3414('0x20')](_0x4e7bb3)['end']();};}function respondWithResult(_0x595b27,_0x335cdd){_0x335cdd=_0x335cdd||0xc8;return function(_0x50ea3d){if(_0x50ea3d){return _0x595b27[_0x3414('0x20')](_0x335cdd)[_0x3414('0x21')](_0x50ea3d);}};}function respondWithFilteredResult(_0x656dd9,_0x380903){return function(_0x279733){if(_0x279733){var _0x542762=typeof _0x380903[_0x3414('0x22')]===_0x3414('0x23')&&typeof _0x380903[_0x3414('0x24')]===_0x3414('0x23');var _0x226513=_0x279733['count'];var _0x3e5f54=_0x542762?0x0:_0x380903['offset'];var _0xee09e6=_0x542762?_0x279733[_0x3414('0x25')]:_0x380903[_0x3414('0x22')]+_0x380903[_0x3414('0x24')];var _0x5f2ab3;if(_0xee09e6>=_0x226513){_0xee09e6=_0x226513;_0x5f2ab3=0xc8;}else{_0x5f2ab3=0xce;}_0x656dd9[_0x3414('0x20')](_0x5f2ab3);return _0x656dd9[_0x3414('0x26')](_0x3414('0x27'),_0x3e5f54+'-'+_0xee09e6+'/'+_0x226513)['json'](_0x279733);}return null;};}function patchUpdates(_0x384798){return function(_0x387ea5){try{jsonpatch[_0x3414('0x28')](_0x387ea5,_0x384798,!![]);}catch(_0x284fac){return BPromise[_0x3414('0x29')](_0x284fac);}return _0x387ea5[_0x3414('0x2a')]();};}function saveUpdates(_0x53aacb,_0x321d6e){return function(_0x6f2ff0){if(_0x6f2ff0){return _0x6f2ff0[_0x3414('0x2b')](_0x53aacb)[_0x3414('0x2c')](function(_0x17104e){return _0x17104e;});}return null;};}function removeEntity(_0x3024bd,_0x19dd6f){return function(_0x1ac1a1){if(_0x1ac1a1){return _0x1ac1a1['destroy']()[_0x3414('0x2c')](function(){var _0x3f7df4=_0x1ac1a1[_0x3414('0x2d')]({'plain':!![]});var _0x388c6f=_0x3414('0x2e');return db['UserProfileResource'][_0x3414('0x2f')]({'where':{'type':_0x388c6f,'resourceId':_0x3f7df4['id']}})[_0x3414('0x2c')](function(){return _0x1ac1a1;});})[_0x3414('0x2c')](function(){_0x3024bd[_0x3414('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x850c33,_0x291ae1){return function(_0x2d0fac){if(!_0x2d0fac){_0x850c33['sendStatus'](0x194);}return _0x2d0fac;};}function handleError(_0x35828d,_0xbc46f1){_0xbc46f1=_0xbc46f1||0x1f4;return function(_0x13fc1b){logger[_0x3414('0x30')](_0x13fc1b[_0x3414('0x31')]);if(_0x13fc1b[_0x3414('0x32')]){delete _0x13fc1b[_0x3414('0x32')];}_0x35828d[_0x3414('0x20')](_0xbc46f1)[_0x3414('0x33')](_0x13fc1b);};}exports['index']=function(_0xa13ddf,_0x5dec04){var _0x168d76={},_0x21548c={},_0x2ac19a={'count':0x0,'rows':[]};var _0x34169a=_[_0x3414('0x34')](db['CmList'][_0x3414('0x35')],function(_0x431d03){return{'name':_0x431d03[_0x3414('0x36')],'type':_0x431d03[_0x3414('0x37')][_0x3414('0x38')]};});_0x21548c[_0x3414('0x39')]=_[_0x3414('0x34')](_0x34169a,_0x3414('0x32'));_0x21548c[_0x3414('0x3a')]=_[_0x3414('0x3b')](_0xa13ddf[_0x3414('0x3a')]);_0x21548c[_0x3414('0x3c')]=_[_0x3414('0x3d')](_0x21548c[_0x3414('0x39')],_0x21548c[_0x3414('0x3a')]);_0x168d76[_0x3414('0x3e')]=_[_0x3414('0x3d')](_0x21548c[_0x3414('0x39')],qs[_0x3414('0x3f')](_0xa13ddf[_0x3414('0x3a')][_0x3414('0x3f')]));_0x168d76['attributes']=_0x168d76['attributes'][_0x3414('0x40')]?_0x168d76['attributes']:_0x21548c[_0x3414('0x39')];if(!_0xa13ddf[_0x3414('0x3a')][_0x3414('0x41')](_0x3414('0x42'))){_0x168d76[_0x3414('0x24')]=qs[_0x3414('0x24')](_0xa13ddf[_0x3414('0x3a')][_0x3414('0x24')]);_0x168d76[_0x3414('0x22')]=qs[_0x3414('0x22')](_0xa13ddf[_0x3414('0x3a')]['offset']);}_0x168d76[_0x3414('0x43')]=qs[_0x3414('0x44')](_0xa13ddf[_0x3414('0x3a')][_0x3414('0x44')]);_0x168d76['where']=qs[_0x3414('0x3c')](_[_0x3414('0x45')](_0xa13ddf[_0x3414('0x3a')],_0x21548c[_0x3414('0x3c')]),_0x34169a);if(_0xa13ddf[_0x3414('0x3a')][_0x3414('0x46')]){_0x168d76[_0x3414('0x47')]=_[_0x3414('0x48')](_0x168d76[_0x3414('0x47')],{'$or':_[_0x3414('0x34')](_0x34169a,function(_0x40f8b1){if(_0x40f8b1[_0x3414('0x37')]!=='VIRTUAL'){var _0x5544a5={};_0x5544a5[_0x40f8b1[_0x3414('0x32')]]={'$like':'%'+_0xa13ddf[_0x3414('0x3a')][_0x3414('0x46')]+'%'};return _0x5544a5;}})});}_0x168d76=_[_0x3414('0x48')]({},_0x168d76,_0xa13ddf[_0x3414('0x49')]);var _0x4931e2={'where':_0x168d76[_0x3414('0x47')]};return db[_0x3414('0x4a')][_0x3414('0x25')](_0x4931e2)['then'](function(_0x47dd37){_0x2ac19a[_0x3414('0x25')]=_0x47dd37;if(_0xa13ddf[_0x3414('0x3a')][_0x3414('0x4b')]){_0x168d76[_0x3414('0x4c')]=[{'all':!![]}];}return db[_0x3414('0x4a')][_0x3414('0x4d')](_0x168d76);})['then'](function(_0x532683){_0x2ac19a[_0x3414('0x4e')]=_0x532683;return _0x2ac19a;})[_0x3414('0x2c')](respondWithFilteredResult(_0x5dec04,_0x168d76))['catch'](handleError(_0x5dec04,null));};exports[_0x3414('0x4f')]=function(_0x3864b9,_0x1c26a3){var _0x283ce2={'raw':![],'where':{'id':_0x3864b9['params']['id']}},_0x50fba9={};_0x50fba9[_0x3414('0x39')]=_['keys'](db[_0x3414('0x4a')]['rawAttributes']);_0x50fba9[_0x3414('0x3a')]=_['keys'](_0x3864b9['query']);_0x50fba9[_0x3414('0x3c')]=_['intersection'](_0x50fba9[_0x3414('0x39')],_0x50fba9[_0x3414('0x3a')]);_0x283ce2['attributes']=_['intersection'](_0x50fba9[_0x3414('0x39')],qs[_0x3414('0x3f')](_0x3864b9[_0x3414('0x3a')]['fields']));_0x283ce2[_0x3414('0x3e')]=_0x283ce2[_0x3414('0x3e')][_0x3414('0x40')]?_0x283ce2['attributes']:_0x50fba9['model'];if(_0x3864b9[_0x3414('0x3a')][_0x3414('0x4b')]){_0x283ce2[_0x3414('0x4c')]=[{'all':!![]}];}_0x283ce2=_[_0x3414('0x48')]({},_0x283ce2,_0x3864b9[_0x3414('0x49')]);return db[_0x3414('0x4a')]['find'](_0x283ce2)[_0x3414('0x2c')](handleEntityNotFound(_0x1c26a3,null))[_0x3414('0x2c')](respondWithResult(_0x1c26a3,null))[_0x3414('0x50')](handleError(_0x1c26a3,null));};exports['create']=function(_0x3a4e8b,_0x234fd7){return db['CmList'][_0x3414('0x51')](_0x3a4e8b[_0x3414('0x52')],{})[_0x3414('0x2c')](function(_0x263edd){var _0x346f81=_0x3a4e8b['user'][_0x3414('0x2d')]({'plain':!![]});if(!_0x346f81)throw new Error(_0x3414('0x53'));if(_0x346f81['role']===_0x3414('0x54')){var _0x53e572=_0x263edd[_0x3414('0x2d')]({'plain':!![]});var _0x3216cc='Lists';return db[_0x3414('0x55')][_0x3414('0x56')]({'where':{'name':_0x3216cc,'userProfileId':_0x346f81['userProfileId']},'raw':!![]})[_0x3414('0x2c')](function(_0xcf0033){if(_0xcf0033&&_0xcf0033[_0x3414('0x57')]===0x0){return db[_0x3414('0x58')][_0x3414('0x51')]({'name':_0x53e572['name'],'resourceId':_0x53e572['id'],'type':_0xcf0033[_0x3414('0x32')],'sectionId':_0xcf0033['id']},{})[_0x3414('0x2c')](function(){return _0x263edd;});}else{return _0x263edd;}})[_0x3414('0x50')](function(_0x27c082){logger[_0x3414('0x30')](_0x3414('0x59'),_0x27c082);throw _0x27c082;});}return _0x263edd;})[_0x3414('0x2c')](respondWithResult(_0x234fd7,0xc9))[_0x3414('0x50')](handleError(_0x234fd7,null));};exports[_0x3414('0x2b')]=function(_0x1f0b05,_0x5ef2f7){if(_0x1f0b05[_0x3414('0x52')]['id']){delete _0x1f0b05['body']['id'];}return db[_0x3414('0x4a')][_0x3414('0x56')]({'where':{'id':_0x1f0b05[_0x3414('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5ef2f7,null))['then'](saveUpdates(_0x1f0b05[_0x3414('0x52')],null))['then'](respondWithResult(_0x5ef2f7,null))[_0x3414('0x50')](handleError(_0x5ef2f7,null));};exports[_0x3414('0x2f')]=function(_0x7bbcc5,_0x138a57){return db[_0x3414('0x4a')]['find']({'where':{'id':_0x7bbcc5[_0x3414('0x5a')]['id']}})[_0x3414('0x2c')](handleEntityNotFound(_0x138a57,null))[_0x3414('0x2c')](removeEntity(_0x138a57,null))[_0x3414('0x50')](handleError(_0x138a57,null));};exports[_0x3414('0x5b')]=function(_0x32e11a,_0x3bb56c){return db[_0x3414('0x4a')][_0x3414('0x5b')]()[_0x3414('0x2c')](respondWithResult(_0x3bb56c,null))[_0x3414('0x50')](handleError(_0x3bb56c,null));};exports[_0x3414('0x5c')]=function(_0x1cac64,_0x5aea99,_0x278bf3){if(_0x1cac64[_0x3414('0x52')]['id']){delete _0x1cac64[_0x3414('0x52')]['id'];}return db[_0x3414('0x4a')]['find']({'where':{'id':_0x1cac64[_0x3414('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5aea99,null))[_0x3414('0x2c')](function(_0x176264){if(_0x176264){_0x1cac64['body'][_0x3414('0x5d')]=_0x176264['id'];return db['Disposition'][_0x3414('0x51')](_0x1cac64[_0x3414('0x52')]);}})['then'](respondWithResult(_0x5aea99,null))[_0x3414('0x50')](handleError(_0x5aea99,null));};exports['getDispositions']=function(_0x312395,_0x1c2fbd,_0x2a7de3){var _0x29c6cd={'raw':![],'where':{}};var _0x4bd11e={};var _0x2603c2={'count':0x0,'rows':[]};return db[_0x3414('0x4a')][_0x3414('0x5e')]({'where':{'id':_0x312395[_0x3414('0x5a')]['id']}})[_0x3414('0x2c')](handleEntityNotFound(_0x1c2fbd,null))['then'](function(_0x20cd06){if(_0x20cd06){_0x4bd11e[_0x3414('0x39')]=_[_0x3414('0x3b')](db[_0x3414('0x5f')][_0x3414('0x35')]);_0x4bd11e[_0x3414('0x3a')]=_[_0x3414('0x3b')](_0x312395['query']);_0x4bd11e[_0x3414('0x3c')]=_[_0x3414('0x3d')](_0x4bd11e[_0x3414('0x39')],_0x4bd11e[_0x3414('0x3a')]);_0x29c6cd[_0x3414('0x3e')]=_[_0x3414('0x3d')](_0x4bd11e[_0x3414('0x39')],qs[_0x3414('0x3f')](_0x312395[_0x3414('0x3a')][_0x3414('0x3f')]));_0x29c6cd[_0x3414('0x3e')]=_0x29c6cd[_0x3414('0x3e')][_0x3414('0x40')]?_0x29c6cd[_0x3414('0x3e')]:_0x4bd11e[_0x3414('0x39')];if(!_0x312395[_0x3414('0x3a')][_0x3414('0x41')](_0x3414('0x42'))){_0x29c6cd[_0x3414('0x24')]=qs[_0x3414('0x24')](_0x312395[_0x3414('0x3a')][_0x3414('0x24')]);_0x29c6cd[_0x3414('0x22')]=qs[_0x3414('0x22')](_0x312395[_0x3414('0x3a')][_0x3414('0x22')]);}_0x29c6cd[_0x3414('0x43')]=qs[_0x3414('0x44')](_0x312395[_0x3414('0x3a')][_0x3414('0x44')]);_0x29c6cd[_0x3414('0x47')]=qs[_0x3414('0x3c')](_['pick'](_0x312395['query'],_0x4bd11e['filters']));_0x29c6cd[_0x3414('0x47')][_0x3414('0x5d')]=_0x20cd06['id'];if(_0x312395['query'][_0x3414('0x46')]){_0x29c6cd[_0x3414('0x47')]=_[_0x3414('0x48')](_0x29c6cd[_0x3414('0x47')],{'$or':_[_0x3414('0x34')](_0x29c6cd[_0x3414('0x3e')],function(_0x2e257e){var _0x79348f={};_0x79348f[_0x2e257e]={'$like':'%'+_0x312395[_0x3414('0x3a')][_0x3414('0x46')]+'%'};return _0x79348f;})});}_0x29c6cd=_[_0x3414('0x48')]({},_0x29c6cd,_0x312395[_0x3414('0x49')]);return db[_0x3414('0x5f')][_0x3414('0x25')]({'where':_0x29c6cd['where']})[_0x3414('0x2c')](function(_0xdd0b4d){_0x2603c2[_0x3414('0x25')]=_0xdd0b4d;if(_0x312395[_0x3414('0x3a')]['includeAll']){_0x29c6cd[_0x3414('0x4c')]=[{'all':!![]}];}return db[_0x3414('0x5f')][_0x3414('0x4d')](_0x29c6cd);})[_0x3414('0x2c')](function(_0x1fc357){_0x2603c2[_0x3414('0x4e')]=_0x1fc357;return _0x2603c2;});}})['then'](respondWithFilteredResult(_0x1c2fbd,_0x29c6cd))['catch'](handleError(_0x1c2fbd,null));};exports[_0x3414('0x60')]=function(_0x477f49,_0x4d7853,_0x46555d){return db[_0x3414('0x4a')][_0x3414('0x56')]({'where':{'id':_0x477f49[_0x3414('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4d7853,null))[_0x3414('0x2c')](function(_0x105c9a){if(_0x105c9a){return _0x105c9a[_0x3414('0x60')](_0x477f49[_0x3414('0x3a')][_0x3414('0x61')]);}})[_0x3414('0x2c')](respondWithStatusCode(_0x4d7853,null))['catch'](handleError(_0x4d7853,null));};exports[_0x3414('0x62')]=function(_0x2793c2,_0x47459d,_0x3b5e37){return db[_0x3414('0x4a')][_0x3414('0x56')]({'where':{'id':_0x2793c2[_0x3414('0x5a')]['id']}})[_0x3414('0x2c')](handleEntityNotFound(_0x47459d,null))['then'](function(_0x1944e2){if(_0x1944e2){var _0x71257c=[];var _0x58b0d8={'success':[],'errors':[]};return db[_0x3414('0x63')][_0x3414('0x5b')]()['then'](function(_0x4615c7){if(_0x2793c2[_0x3414('0x52')][_0x3414('0x64')]&&_[_0x3414('0x65')](_0x2793c2[_0x3414('0x52')][_0x3414('0x64')])){if(_0x2793c2['body'][_0x3414('0x64')][_0x3414('0x40')]){_0x2793c2[_0x3414('0x52')][_0x3414('0x64')]=_0x2793c2[_0x3414('0x52')][_0x3414('0x64')][_0x3414('0x66')](';')+';';}else{_0x2793c2[_0x3414('0x52')][_0x3414('0x64')]=null;}}else{_0x2793c2[_0x3414('0x52')]['tags']=null;}if(_0x2793c2[_0x3414('0x52')]&&_[_0x3414('0x65')](_0x2793c2[_0x3414('0x52')])){for(var _0x3d035d=0x0;_0x3d035d<_0x2793c2[_0x3414('0x52')][_0x3414('0x40')];_0x3d035d+=0x1){_0x2793c2[_0x3414('0x52')][_0x3d035d][_0x3414('0x5d')]=_0x2793c2[_0x3414('0x5a')]['id'];_0x71257c[_0x3414('0x67')](_0x2793c2[_0x3414('0x52')][_0x3d035d]);}return BPromise[_0x3414('0x68')](_0x71257c,function(_0x33a8d0){return db[_0x3414('0x63')][_0x3414('0x51')](_[_0x3414('0x69')](_0x33a8d0,[_0x3414('0x61'),'id'])||{},{'fields':_[_0x3414('0x3b')](_0x4615c7),'raw':!![]})[_0x3414('0x2c')](function(_0x30c7b0){_0x58b0d8['success']['push'](_0x30c7b0[_0x3414('0x6a')]);})[_0x3414('0x50')](function(_0x357eba){_0x58b0d8[_0x3414('0x6b')][_0x3414('0x67')]({'data':_0x33a8d0,'error':_0x357eba[_0x3414('0x6c')]});});})[_0x3414('0x2c')](function(_0x10cafe){return _0x58b0d8;})['catch'](function(_0x4f98c2){return _0x4f98c2;});}else{_0x47459d[_0x3414('0x20')](0x190)[_0x3414('0x21')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x3414('0x2c')](respondWithResult(_0x47459d,null))[_0x3414('0x50')](handleError(_0x47459d,null));};exports['getContacts']=function(_0x2e4288,_0x590a79,_0x329fc2){var _0xe1199f;return db[_0x3414('0x4a')][_0x3414('0x56')]({'where':{'id':_0x2e4288[_0x3414('0x5a')]['id']},'include':[{'model':db[_0x3414('0x6d')],'as':_0x3414('0x6e')}]})[_0x3414('0x2c')](handleEntityNotFound(_0x590a79,null))[_0x3414('0x2c')](function(_0x3e183b){if(_0x3e183b){_0xe1199f=_0x3e183b;return db[_0x3414('0x63')][_0x3414('0x35')];}})[_0x3414('0x2c')](function(_0x4e2b87){if(_0x4e2b87){var _0x48f8f7={};var _0x21362f={};_0x21362f['model']=_[_0x3414('0x6f')](_[_0x3414('0x3b')](_0x4e2b87),_[_0x3414('0x34')](_0xe1199f['CustomFields'],function(_0x3ad494){return util['format']('cf_%d',_0x3ad494['id']);}));_0x21362f[_0x3414('0x3a')]=_[_0x3414('0x3b')](_0x2e4288[_0x3414('0x3a')]);_0x21362f[_0x3414('0x3c')]=_['intersection'](_0x21362f[_0x3414('0x39')],_0x21362f[_0x3414('0x3a')]);_0x48f8f7[_0x3414('0x3e')]=_[_0x3414('0x3d')](_0x21362f['model'],qs['fields'](_0x2e4288[_0x3414('0x3a')][_0x3414('0x3f')]));_0x48f8f7['attributes']=_0x48f8f7[_0x3414('0x3e')][_0x3414('0x40')]?_0x48f8f7[_0x3414('0x3e')]:_0x21362f[_0x3414('0x39')];if(!_0x2e4288[_0x3414('0x3a')][_0x3414('0x41')](_0x3414('0x42'))){_0x48f8f7[_0x3414('0x24')]=qs[_0x3414('0x24')](_0x2e4288[_0x3414('0x3a')][_0x3414('0x24')]);_0x48f8f7[_0x3414('0x22')]=qs['offset'](_0x2e4288[_0x3414('0x3a')][_0x3414('0x22')]);}_0x48f8f7['order']=qs[_0x3414('0x44')](_0x2e4288[_0x3414('0x3a')][_0x3414('0x44')]);_0x48f8f7['where']=qs[_0x3414('0x3c')](_[_0x3414('0x45')](_0x2e4288[_0x3414('0x3a')],_0x21362f[_0x3414('0x3c')]));_0x48f8f7[_0x3414('0x70')]=!![];if(_0x2e4288['query'][_0x3414('0x46')]){_0x48f8f7[_0x3414('0x47')]=_[_0x3414('0x48')](_0x48f8f7['where'],{'$or':_[_0x3414('0x34')](_0x48f8f7[_0x3414('0x3e')],function(_0x44f201){var _0x26e809={};_0x26e809[_0x44f201]={'$like':'%'+_0x2e4288[_0x3414('0x3a')][_0x3414('0x46')]+'%'};return _0x26e809;})});}_0x48f8f7=_[_0x3414('0x48')]({},_0x48f8f7,_0x2e4288[_0x3414('0x49')]);return _0xe1199f[_0x3414('0x71')](_0x48f8f7);}})[_0x3414('0x2c')](respondWithResult(_0x590a79,null))[_0x3414('0x50')](handleError(_0x590a79,null));};exports[_0x3414('0x72')]=function(_0x2edbc8,_0x4804f1,_0x200961){var _0x410790;return db[_0x3414('0x4a')][_0x3414('0x56')]({'where':{'id':_0x2edbc8[_0x3414('0x5a')]['id']},'include':[{'model':db[_0x3414('0x6d')],'as':_0x3414('0x6e')}]})[_0x3414('0x2c')](handleEntityNotFound(_0x4804f1,null))['then'](function(_0x16896f){if(_0x16896f){_0x410790=_0x16896f;return db[_0x3414('0x63')]['rawAttributes'];}})['then'](function(_0x55f724){if(_0x55f724){var _0x3f7fe9={};var _0x2733f6={};_0x2733f6[_0x3414('0x39')]=_['concat'](_[_0x3414('0x3b')](_0x55f724),_[_0x3414('0x34')](_0x410790[_0x3414('0x6e')],function(_0x201be7){return util[_0x3414('0x73')]('cf_%d',_0x201be7['id']);}));_0x2733f6[_0x3414('0x3a')]=_['keys'](_0x2edbc8['query']);_0x2733f6[_0x3414('0x3c')]=_['intersection'](_0x2733f6[_0x3414('0x39')],_0x2733f6[_0x3414('0x3a')]);_0x3f7fe9[_0x3414('0x3e')]=_[_0x3414('0x3d')](_0x2733f6['model'],qs[_0x3414('0x3f')](_0x2edbc8[_0x3414('0x3a')][_0x3414('0x3f')]));_0x3f7fe9[_0x3414('0x3e')]=_0x3f7fe9[_0x3414('0x3e')]['length']?_0x3f7fe9[_0x3414('0x3e')]:_0x2733f6[_0x3414('0x39')];if(!_0x2edbc8[_0x3414('0x3a')][_0x3414('0x41')](_0x3414('0x42'))){_0x3f7fe9['limit']=qs[_0x3414('0x24')](_0x2edbc8['query'][_0x3414('0x24')]);_0x3f7fe9['offset']=qs[_0x3414('0x22')](_0x2edbc8[_0x3414('0x3a')]['offset']);}_0x3f7fe9[_0x3414('0x43')]=qs['sort'](_0x2edbc8[_0x3414('0x3a')][_0x3414('0x44')]);_0x3f7fe9[_0x3414('0x47')]=qs['filters'](_[_0x3414('0x45')](_0x2edbc8[_0x3414('0x3a')],_0x2733f6[_0x3414('0x3c')]));_0x3f7fe9[_0x3414('0x70')]=!![];if(_0x2edbc8[_0x3414('0x3a')][_0x3414('0x46')]){_0x3f7fe9[_0x3414('0x47')]=_[_0x3414('0x48')](_0x3f7fe9[_0x3414('0x47')],{'$or':_[_0x3414('0x34')](_0x3f7fe9['attributes'],function(_0x12f71b){var _0x316b13={};_0x316b13[_0x12f71b]={'$like':'%'+_0x2edbc8[_0x3414('0x3a')]['filter']+'%'};return _0x316b13;})});}_0x3f7fe9=_[_0x3414('0x48')]({},_0x3f7fe9,_0x2edbc8['options']);return _0x410790[_0x3414('0x71')](_0x3f7fe9);}})['then'](function(_0x560d1e){if(!_[_0x3414('0x74')](_0x560d1e)){var _0x9299c9=toCsv(_0x560d1e);var _0x303b38=Date['now']();fs['writeFileSync'](util[_0x3414('0x73')]('/tmp/list_%d_%s.csv',_0x410790['id'],_0x303b38),_0x9299c9);_0x4804f1[_0x3414('0x75')](_0x3414('0x76'),_0x3414('0x77')+util['format'](_0x3414('0x78'),_0x410790['id'],_0x303b38));_0x4804f1['setHeader'](_0x3414('0x79'),_0x3414('0x7a'));return _0x4804f1[_0x3414('0x7b')](util[_0x3414('0x73')]('/tmp/list_%d_%s.csv',_0x410790['id'],_0x303b38));}else{return _0x4804f1[_0x3414('0x7c')](0xcc);}})['catch'](handleError(_0x4804f1,null));};exports['addCustomField']=function(_0x3cedb4,_0x541893,_0x59d32e){var _0x3f0686;delete _0x3cedb4[_0x3414('0x52')]['id'];return db['CmList'][_0x3414('0x5e')]({'where':{'id':_0x3cedb4[_0x3414('0x5a')]['id']}})[_0x3414('0x2c')](handleEntityNotFound(_0x541893,null))['then'](function(_0x14a469){if(_0x14a469){return db['sequelize'][_0x3414('0x7d')](function(_0x5bcb4c){return db[_0x3414('0x6d')][_0x3414('0x51')](_0x3cedb4['body'],{'transaction':_0x5bcb4c})['then'](function(_0x2004dc){_0x3f0686=_0x2004dc;return _0x14a469[_0x3414('0x7e')](_0x2004dc,{'transaction':_0x5bcb4c});})['then'](function(){var _0x176740={'type':db[_0x3414('0x7f')][_0x3414('0x80')],'transaction':_0x5bcb4c};switch(_0x3cedb4[_0x3414('0x52')][_0x3414('0x37')]){case'text':_0x176740[_0x3414('0x37')]=db[_0x3414('0x7f')][_0x3414('0x80')];break;case _0x3414('0x81'):_0x176740[_0x3414('0x37')]=db['Sequelize'][_0x3414('0x82')];break;case _0x3414('0x83'):_0x176740[_0x3414('0x37')]=db[_0x3414('0x7f')]['BOOLEAN'];_0x176740[_0x3414('0x84')]=![];break;default:}return db['sequelize'][_0x3414('0x85')][_0x3414('0x86')](_0x3414('0x87'),util[_0x3414('0x73')]('cf_%s',_0x3f0686['id']),_0x176740);})[_0x3414('0x2c')](function(){return _0x3f0686;});});}})[_0x3414('0x2c')](respondWithResult(_0x541893,null))['catch'](handleError(_0x541893,null));};exports['getCustomFields']=function(_0x3ce07b,_0x1a4cf1,_0x3ed2c0){var _0x1473ee={};var _0x165bbe={};var _0xfb3758;var _0x81d79b;return db[_0x3414('0x4a')][_0x3414('0x5e')]({'where':{'id':_0x3ce07b[_0x3414('0x5a')]['id']}})[_0x3414('0x2c')](handleEntityNotFound(_0x1a4cf1,null))['then'](function(_0xa2d092){if(_0xa2d092){_0xfb3758=_0xa2d092;_0x165bbe[_0x3414('0x39')]=_['keys'](db['CmCustomField']['rawAttributes']);_0x165bbe[_0x3414('0x3a')]=_[_0x3414('0x3b')](_0x3ce07b[_0x3414('0x3a')]);_0x165bbe[_0x3414('0x3c')]=_['intersection'](_0x165bbe[_0x3414('0x39')],_0x165bbe[_0x3414('0x3a')]);_0x1473ee[_0x3414('0x3e')]=_[_0x3414('0x3d')](_0x165bbe[_0x3414('0x39')],qs[_0x3414('0x3f')](_0x3ce07b[_0x3414('0x3a')][_0x3414('0x3f')]));_0x1473ee['attributes']=_0x1473ee[_0x3414('0x3e')]['length']?_0x1473ee[_0x3414('0x3e')]:_0x165bbe['model'];_0x1473ee[_0x3414('0x43')]=qs['sort'](_0x3ce07b[_0x3414('0x3a')][_0x3414('0x44')]);_0x1473ee[_0x3414('0x47')]=qs['filters'](_[_0x3414('0x45')](_0x3ce07b[_0x3414('0x3a')],_0x165bbe['filters']));_0x1473ee['where']=_[_0x3414('0x48')](_0x1473ee[_0x3414('0x47')],{'$or':[{'ListId':_0xa2d092['id']},{'ListId':null}]});if(_0x3ce07b[_0x3414('0x3a')][_0x3414('0x46')]){_0x1473ee['where']=_[_0x3414('0x48')](_0x1473ee[_0x3414('0x47')],{'$or':_[_0x3414('0x34')](_0x1473ee[_0x3414('0x3e')],function(_0xa69167){var _0x4f59bf={};_0x4f59bf[_0xa69167]={'$like':'%'+_0x3ce07b[_0x3414('0x3a')][_0x3414('0x46')]+'%'};return _0x4f59bf;})});}_0x1473ee=_[_0x3414('0x48')]({},_0x1473ee,_0x3ce07b[_0x3414('0x49')]);return db[_0x3414('0x6d')]['findAndCountAll'](_0x1473ee);}})[_0x3414('0x2c')](respondWithResult(_0x1a4cf1,null))[_0x3414('0x50')](handleError(_0x1a4cf1,null));};exports[_0x3414('0x88')]=function(_0x36d7ab,_0x7ca8d0,_0x28adeb){return db[_0x3414('0x4a')][_0x3414('0x56')]({'where':{'id':_0x36d7ab[_0x3414('0x5a')]['id']}})[_0x3414('0x2c')](handleEntityNotFound(_0x7ca8d0,null))[_0x3414('0x2c')](function(_0x4ee73b){if(_0x4ee73b){return _0x4ee73b[_0x3414('0x88')](_0x36d7ab[_0x3414('0x52')]['ids'],_[_0x3414('0x69')](_0x36d7ab['body'],[_0x3414('0x61'),'id'])||{})[_0x3414('0x89')](function(_0x2b7f50){for(var _0x57a0a6=0x0;_0x57a0a6<_0x36d7ab[_0x3414('0x52')][_0x3414('0x61')]['length'];_0x57a0a6+=0x1){socket[_0x3414('0x8a')](_0x3414('0x8b'),{'UserId':Number(_0x36d7ab[_0x3414('0x52')]['ids'][_0x57a0a6]),'CmListId':Number(_0x36d7ab[_0x3414('0x5a')]['id'])});}return _0x2b7f50;});}})[_0x3414('0x2c')](respondWithResult(_0x7ca8d0,null))[_0x3414('0x50')](handleError(_0x7ca8d0,null));};exports[_0x3414('0x8c')]=function(_0x29c080,_0x458552,_0x3e7538){return db[_0x3414('0x4a')][_0x3414('0x56')]({'where':{'id':_0x29c080[_0x3414('0x5a')]['id']}})[_0x3414('0x2c')](handleEntityNotFound(_0x458552,null))['then'](function(_0x214908){if(_0x214908){return _0x214908['removeAgents'](_0x29c080[_0x3414('0x3a')]['ids'])['then'](function(){if(_[_0x3414('0x65')](_0x29c080['query'][_0x3414('0x61')])){for(var _0x177f50=0x0;_0x177f50<_0x29c080[_0x3414('0x3a')][_0x3414('0x61')][_0x3414('0x40')];_0x177f50+=0x1){socket[_0x3414('0x8a')](_0x3414('0x8d'),{'UserId':Number(_0x29c080[_0x3414('0x3a')]['ids'][_0x177f50]),'CmListId':Number(_0x29c080[_0x3414('0x5a')]['id'])});}}else{socket[_0x3414('0x8a')](_0x3414('0x8d'),{'UserId':Number(_0x29c080[_0x3414('0x3a')][_0x3414('0x61')]),'CmListId':Number(_0x29c080[_0x3414('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x458552,null))[_0x3414('0x50')](handleError(_0x458552,null));};exports[_0x3414('0x8e')]=function(_0x1dd946,_0x5c06f3,_0x4c1803){var _0x5cc9ab={};var _0x3dba1c={};var _0x37a906;var _0x35902b;return db['CmList'][_0x3414('0x5e')]({'where':{'id':_0x1dd946[_0x3414('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5c06f3,null))[_0x3414('0x2c')](function(_0x76ff13){if(_0x76ff13){_0x37a906=_0x76ff13;_0x3dba1c[_0x3414('0x39')]=_[_0x3414('0x3b')](db['User'][_0x3414('0x35')]);_0x3dba1c['query']=_[_0x3414('0x3b')](_0x1dd946[_0x3414('0x3a')]);_0x3dba1c[_0x3414('0x3c')]=_[_0x3414('0x3d')](_0x3dba1c[_0x3414('0x39')],_0x3dba1c['query']);_0x5cc9ab['attributes']=_[_0x3414('0x3d')](_0x3dba1c[_0x3414('0x39')],qs[_0x3414('0x3f')](_0x1dd946[_0x3414('0x3a')]['fields']));_0x5cc9ab['attributes']=_0x5cc9ab[_0x3414('0x3e')][_0x3414('0x40')]?_0x5cc9ab[_0x3414('0x3e')]:_0x3dba1c[_0x3414('0x39')];_0x5cc9ab[_0x3414('0x43')]=qs[_0x3414('0x44')](_0x1dd946[_0x3414('0x3a')][_0x3414('0x44')]);_0x5cc9ab['where']=qs[_0x3414('0x3c')](_[_0x3414('0x45')](_0x1dd946[_0x3414('0x3a')],_0x3dba1c[_0x3414('0x3c')]));if(_0x1dd946['query'][_0x3414('0x46')]){_0x5cc9ab['where']=_[_0x3414('0x48')](_0x5cc9ab['where'],{'$or':_['map'](_0x5cc9ab['attributes'],function(_0x41e5d8){var _0x49b223={};_0x49b223[_0x41e5d8]={'$like':'%'+_0x1dd946[_0x3414('0x3a')][_0x3414('0x46')]+'%'};return _0x49b223;})});}_0x5cc9ab=_[_0x3414('0x48')]({},_0x5cc9ab,_0x1dd946[_0x3414('0x49')]);return _0x37a906[_0x3414('0x8e')](_0x5cc9ab);}})['then'](function(_0x7b1e12){if(_0x7b1e12){_0x35902b=_0x7b1e12[_0x3414('0x40')];if(!_0x1dd946[_0x3414('0x3a')][_0x3414('0x41')](_0x3414('0x42'))){_0x5cc9ab[_0x3414('0x24')]=qs[_0x3414('0x24')](_0x1dd946[_0x3414('0x3a')][_0x3414('0x24')]);_0x5cc9ab[_0x3414('0x22')]=qs[_0x3414('0x22')](_0x1dd946[_0x3414('0x3a')][_0x3414('0x22')]);}return _0x37a906[_0x3414('0x8e')](_0x5cc9ab);}})['then'](function(_0x23a393){if(_0x23a393){return _0x23a393?{'count':_0x35902b,'rows':_0x23a393}:null;}})['then'](respondWithResult(_0x5c06f3,null))['catch'](handleError(_0x5c06f3,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 3540f8b..62560b1 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 _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe14b,0x93));var _0xbe14=function(_0x274037,_0x4ad50b){_0x274037=_0x274037-0x0;var _0x51848b=_0xe14b[_0x274037];return _0x51848b;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file +var _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x569caa,_0x5174ce){var _0x44cb5a=function(_0x456df4){while(--_0x456df4){_0x569caa['push'](_0x569caa['shift']());}};_0x44cb5a(++_0x5174ce);}(_0x5fc3,0xa8));var _0x35fc=function(_0x303c30,_0x16edcb){_0x303c30=_0x303c30-0x0;var _0x43161b=_0x5fc3[_0x303c30];return _0x43161b;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index e52106a..8efcabc 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmList.attributes','exports','CmList','util'];(function(_0x51c2c4,_0x104ee2){var _0x1ea78f=function(_0x5246ae){while(--_0x5246ae){_0x51c2c4['push'](_0x51c2c4['shift']());}};_0x1ea78f(++_0x104ee2);}(_0xedd9,0xfc));var _0x9edd=function(_0xc6bd06,_0x3ad410){_0xc6bd06=_0xc6bd06-0x0;var _0x56e726=_0xedd9[_0xc6bd06];return _0x56e726;};'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':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdace=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','CmList','cm_lists','lodash'];(function(_0x22abdb,_0x13876b){var _0x16c30c=function(_0x3a48bb){while(--_0x3a48bb){_0x22abdb['push'](_0x22abdb['shift']());}};_0x16c30c(++_0x13876b);}(_0xdace,0xc5));var _0xedac=function(_0x5756f8,_0x22b6d5){_0x5756f8=_0x5756f8-0x0;var _0x3bb749=_0xdace[_0x5756f8];return _0x3bb749;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var logger=require(_0xedac('0x1'))(_0xedac('0x2'));var moment=require(_0xedac('0x3'));var BPromise=require('bluebird');var rp=require(_0xedac('0x4'));var fs=require('fs');var path=require(_0xedac('0x5'));var rimraf=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var attributes=require('./cmList.attributes');module[_0xedac('0x8')]=function(_0x1cba89,_0x39328a){return _0x1cba89['define'](_0xedac('0x9'),attributes,{'tableName':_0xedac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index deefed3..a5ce2ba 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 _0xa3b7=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result'];(function(_0x5e1359,_0x58a782){var _0x56b986=function(_0x103f0c){while(--_0x103f0c){_0x5e1359['push'](_0x5e1359['shift']());}};_0x56b986(++_0x58a782);}(_0xa3b7,0x150));var _0x7a3b=function(_0x3238ea,_0x91809d){_0x3238ea=_0x3238ea-0x0;var _0x4aaac2=_0xa3b7[_0x3238ea];return _0x4aaac2;};'use strict';var _=require(_0x7a3b('0x0'));var util=require('util');var moment=require(_0x7a3b('0x1'));var BPromise=require(_0x7a3b('0x2'));var rs=require(_0x7a3b('0x3'));var fs=require('fs');var Redis=require(_0x7a3b('0x4'));var db=require(_0x7a3b('0x5'))['db'];var utils=require(_0x7a3b('0x6'));var logger=require(_0x7a3b('0x7'))(_0x7a3b('0x8'));var config=require(_0x7a3b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7a3b('0xa')][_0x7a3b('0xb')]({'port':0x232a});config[_0x7a3b('0xc')]=_[_0x7a3b('0xd')](config[_0x7a3b('0xc')],{'host':_0x7a3b('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7a3b('0xf'))[_0x7a3b('0x10')](socket);function respondWithRpcPromise(_0x3b81f9,_0x20494d,_0x208ebd){return new BPromise(function(_0xa936a2,_0x254eb6){return client[_0x7a3b('0x11')](_0x3b81f9,_0x208ebd)[_0x7a3b('0x12')](function(_0x3c4d35){logger['info'](_0x7a3b('0x13'),_0x20494d,_0x7a3b('0x14'));logger[_0x7a3b('0x15')]('CmList,\x20%s,\x20%s,\x20%s',_0x20494d,_0x7a3b('0x14'),JSON[_0x7a3b('0x16')](_0x3c4d35));if(_0x3c4d35[_0x7a3b('0x17')]){if(_0x3c4d35[_0x7a3b('0x17')][_0x7a3b('0x18')]===0x1f4){logger[_0x7a3b('0x17')]('CmList,\x20%s,\x20%s',_0x20494d,_0x3c4d35[_0x7a3b('0x17')][_0x7a3b('0x19')]);return _0x254eb6(_0x3c4d35['error'][_0x7a3b('0x19')]);}logger['error']('CmList,\x20%s,\x20%s',_0x20494d,_0x3c4d35['error'][_0x7a3b('0x19')]);return _0xa936a2(_0x3c4d35[_0x7a3b('0x17')]['message']);}else{logger[_0x7a3b('0x1a')](_0x7a3b('0x13'),_0x20494d,_0x7a3b('0x14'));_0xa936a2(_0x3c4d35[_0x7a3b('0x1b')]['message']);}})['catch'](function(_0x5e6ebd){logger[_0x7a3b('0x17')](_0x7a3b('0x13'),_0x20494d,_0x5e6ebd);_0x254eb6(_0x5e6ebd);});});} \ No newline at end of file +var _0xb913=['util','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','CmList,\x20%s,\x20%s','message','result','catch'];(function(_0x3b341f,_0x23c3e0){var _0x1715de=function(_0x481263){while(--_0x481263){_0x3b341f['push'](_0x3b341f['shift']());}};_0x1715de(++_0x23c3e0);}(_0xb913,0x15e));var _0x3b91=function(_0x349fcf,_0x2cdb26){_0x349fcf=_0x349fcf-0x0;var _0x5f1771=_0xb913[_0x349fcf];return _0x5f1771;};'use strict';var _=require('lodash');var util=require(_0x3b91('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3b91('0x1'));var fs=require('fs');var Redis=require(_0x3b91('0x2'));var db=require(_0x3b91('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x3b91('0x4'));var jayson=require(_0x3b91('0x5'));var client=jayson['client'][_0x3b91('0x6')]({'port':0x232a});config[_0x3b91('0x7')]=_[_0x3b91('0x8')](config[_0x3b91('0x7')],{'host':_0x3b91('0x9'),'port':0x18eb});var socket=require(_0x3b91('0xa'))(new Redis(config[_0x3b91('0x7')]));require(_0x3b91('0xb'))[_0x3b91('0xc')](socket);function respondWithRpcPromise(_0x2a35d1,_0x519b6a,_0x3d95e6){return new BPromise(function(_0x37b2a6,_0x4b91b9){return client[_0x3b91('0xd')](_0x2a35d1,_0x3d95e6)['then'](function(_0xc1767f){logger[_0x3b91('0xe')]('CmList,\x20%s,\x20%s',_0x519b6a,_0x3b91('0xf'));logger[_0x3b91('0x10')](_0x3b91('0x11'),_0x519b6a,_0x3b91('0xf'),JSON[_0x3b91('0x12')](_0xc1767f));if(_0xc1767f[_0x3b91('0x13')]){if(_0xc1767f[_0x3b91('0x13')][_0x3b91('0x14')]===0x1f4){logger[_0x3b91('0x13')](_0x3b91('0x15'),_0x519b6a,_0xc1767f[_0x3b91('0x13')][_0x3b91('0x16')]);return _0x4b91b9(_0xc1767f[_0x3b91('0x13')][_0x3b91('0x16')]);}logger[_0x3b91('0x13')]('CmList,\x20%s,\x20%s',_0x519b6a,_0xc1767f[_0x3b91('0x13')][_0x3b91('0x16')]);return _0x37b2a6(_0xc1767f[_0x3b91('0x13')]['message']);}else{logger[_0x3b91('0xe')](_0x3b91('0x15'),_0x519b6a,_0x3b91('0xf'));_0x37b2a6(_0xc1767f[_0x3b91('0x17')][_0x3b91('0x16')]);}})[_0x3b91('0x18')](function(_0x234a65){logger[_0x3b91('0x13')](_0x3b91('0x15'),_0x519b6a,_0x234a65);_0x4b91b9(_0x234a65);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 5b9c0de..96e7eec 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 _0x8a0a=['length','cmList:','./cmList.events','save','update'];(function(_0x22e513,_0x53d375){var _0x55d29b=function(_0x2ccff5){while(--_0x2ccff5){_0x22e513['push'](_0x22e513['shift']());}};_0x55d29b(++_0x53d375);}(_0x8a0a,0x8e));var _0xa8a0=function(_0x5ebed7,_0x4e57ab){_0x5ebed7=_0x5ebed7-0x0;var _0x247402=_0x8a0a[_0x5ebed7];return _0x247402;};'use strict';var CmListEvents=require(_0xa8a0('0x0'));var events=[_0xa8a0('0x1'),'remove',_0xa8a0('0x2')];function createListener(_0x24a259,_0x3eed49){return function(_0x50d473){_0x3eed49['emit'](_0x24a259,_0x50d473);};}function removeListener(_0x23b7e4,_0xa081d3){return function(){CmListEvents['removeListener'](_0x23b7e4,_0xa081d3);};}exports['register']=function(_0x592499){for(var _0x4f8ca8=0x0,_0x36ee67=events[_0xa8a0('0x3')];_0x4f8ca8<_0x36ee67;_0x4f8ca8++){var _0x353d8f=events[_0x4f8ca8];var _0x99b6ca=createListener(_0xa8a0('0x4')+_0x353d8f,_0x592499);CmListEvents['on'](_0x353d8f,_0x99b6ca);}}; \ No newline at end of file +var _0xe6e1=['register','length','cmList:','./cmList.events','save','remove','removeListener'];(function(_0x20b626,_0x3e02f4){var _0x21d0e0=function(_0x5d8ea0){while(--_0x5d8ea0){_0x20b626['push'](_0x20b626['shift']());}};_0x21d0e0(++_0x3e02f4);}(_0xe6e1,0x122));var _0x1e6e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xe6e1[_0x4243a3];return _0x1b2a33;};'use strict';var CmListEvents=require(_0x1e6e('0x0'));var events=[_0x1e6e('0x1'),_0x1e6e('0x2'),'update'];function createListener(_0x5b6d72,_0x4d8e6f){return function(_0x468f3a){_0x4d8e6f['emit'](_0x5b6d72,_0x468f3a);};}function removeListener(_0x576633,_0x265870){return function(){CmListEvents[_0x1e6e('0x3')](_0x576633,_0x265870);};}exports[_0x1e6e('0x4')]=function(_0x94f793){for(var _0x6da12b=0x0,_0x2706a0=events[_0x1e6e('0x5')];_0x6da12b<_0x2706a0;_0x6da12b++){var _0x532ecb=events[_0x6da12b];var _0x268227=createListener(_0x1e6e('0x6')+_0x532ecb,_0x94f793);CmListEvents['on'](_0x532ecb,_0x268227);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index a9c2438..07f1259 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 _0xca26=['destroy','removeDispositions','removeAgents','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','create','addDisposition','post','addContacts','addCustomField','put','update','delete'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xca26,0x1b3));var _0x6ca2=function(_0x30f030,_0xd03b7a){_0x30f030=_0x30f030-0x0;var _0xf7614f=_0xca26[_0x30f030];return _0xf7614f;};'use strict';var multer=require(_0x6ca2('0x0'));var util=require(_0x6ca2('0x1'));var path=require(_0x6ca2('0x2'));var timeout=require(_0x6ca2('0x3'));var express=require('express');var router=express[_0x6ca2('0x4')]();var fs_extra=require(_0x6ca2('0x5'));var auth=require(_0x6ca2('0x6'));var interaction=require(_0x6ca2('0x7'));var config=require('../../config/environment');var controller=require(_0x6ca2('0x8'));router[_0x6ca2('0x9')]('/',auth[_0x6ca2('0xa')](),controller[_0x6ca2('0xb')]);router[_0x6ca2('0x9')]('/describe',auth[_0x6ca2('0xa')](),controller[_0x6ca2('0xc')]);router[_0x6ca2('0x9')](_0x6ca2('0xd'),auth[_0x6ca2('0xa')](),controller[_0x6ca2('0xe')]);router[_0x6ca2('0x9')](_0x6ca2('0xf'),auth[_0x6ca2('0xa')](),controller[_0x6ca2('0x10')]);router[_0x6ca2('0x9')](_0x6ca2('0x11'),auth['isAuthenticated'](),controller[_0x6ca2('0x12')]);router[_0x6ca2('0x9')](_0x6ca2('0x13'),auth[_0x6ca2('0xa')](),controller[_0x6ca2('0x14')]);router[_0x6ca2('0x9')](_0x6ca2('0x15'),auth[_0x6ca2('0xa')](),controller[_0x6ca2('0x16')]);router['get'](_0x6ca2('0x17'),auth[_0x6ca2('0xa')](),controller[_0x6ca2('0x18')]);router['post']('/',auth[_0x6ca2('0xa')](),controller[_0x6ca2('0x19')]);router['post'](_0x6ca2('0xf'),auth[_0x6ca2('0xa')](),controller[_0x6ca2('0x1a')]);router[_0x6ca2('0x1b')](_0x6ca2('0x11'),auth['isAuthenticated'](),controller[_0x6ca2('0x1c')]);router['post'](_0x6ca2('0x15'),auth[_0x6ca2('0xa')](),controller[_0x6ca2('0x1d')]);router[_0x6ca2('0x1b')](_0x6ca2('0x17'),auth['isAuthenticated'](),controller['addAgents']);router[_0x6ca2('0x1e')](_0x6ca2('0xd'),auth[_0x6ca2('0xa')](),controller[_0x6ca2('0x1f')]);router[_0x6ca2('0x20')](_0x6ca2('0xd'),auth[_0x6ca2('0xa')](),controller[_0x6ca2('0x21')]);router[_0x6ca2('0x20')](_0x6ca2('0xf'),auth[_0x6ca2('0xa')](),controller[_0x6ca2('0x22')]);router['delete'](_0x6ca2('0x17'),auth[_0x6ca2('0xa')](),controller[_0x6ca2('0x23')]);module['exports']=router; \ No newline at end of file +var _0xd1bb=['getContacts','getContactsCsv','/:id/fields','getCustomFields','getAgents','create','post','addDisposition','/:id/contacts','/:id/users','addAgents','put','update','destroy','removeDispositions','delete','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','describe','get','/:id','/:id/dispositions','getDispositions'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xd1bb,0x172));var _0xbd1b=function(_0x23bd49,_0x134f2b){_0x23bd49=_0x23bd49-0x0;var _0x278a3a=_0xd1bb[_0x23bd49];return _0x278a3a;};'use strict';var multer=require('multer');var util=require(_0xbd1b('0x0'));var path=require(_0xbd1b('0x1'));var timeout=require(_0xbd1b('0x2'));var express=require(_0xbd1b('0x3'));var router=express[_0xbd1b('0x4')]();var fs_extra=require(_0xbd1b('0x5'));var auth=require(_0xbd1b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbd1b('0x7'));var controller=require('./cmList.controller');router['get']('/',auth[_0xbd1b('0x8')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0xbd1b('0x9')]);router[_0xbd1b('0xa')](_0xbd1b('0xb'),auth[_0xbd1b('0x8')](),controller['show']);router[_0xbd1b('0xa')](_0xbd1b('0xc'),auth[_0xbd1b('0x8')](),controller[_0xbd1b('0xd')]);router[_0xbd1b('0xa')]('/:id/contacts',auth[_0xbd1b('0x8')](),controller[_0xbd1b('0xe')]);router[_0xbd1b('0xa')]('/:id/contacts/csv',auth['isAuthenticated'](),controller[_0xbd1b('0xf')]);router[_0xbd1b('0xa')](_0xbd1b('0x10'),auth['isAuthenticated'](),controller[_0xbd1b('0x11')]);router[_0xbd1b('0xa')]('/:id/users',auth[_0xbd1b('0x8')](),controller[_0xbd1b('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbd1b('0x13')]);router[_0xbd1b('0x14')](_0xbd1b('0xc'),auth[_0xbd1b('0x8')](),controller[_0xbd1b('0x15')]);router['post'](_0xbd1b('0x16'),auth[_0xbd1b('0x8')](),controller['addContacts']);router[_0xbd1b('0x14')]('/:id/fields',auth[_0xbd1b('0x8')](),controller['addCustomField']);router[_0xbd1b('0x14')](_0xbd1b('0x17'),auth[_0xbd1b('0x8')](),controller[_0xbd1b('0x18')]);router[_0xbd1b('0x19')](_0xbd1b('0xb'),auth[_0xbd1b('0x8')](),controller[_0xbd1b('0x1a')]);router['delete']('/:id',auth[_0xbd1b('0x8')](),controller[_0xbd1b('0x1b')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xbd1b('0x1c')]);router[_0xbd1b('0x1d')](_0xbd1b('0x17'),auth[_0xbd1b('0x8')](),controller[_0xbd1b('0x1e')]);module[_0xbd1b('0x1f')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index e54d0a1..daaf61e 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 _0x7c8a=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x1695b0,_0x276914){var _0x587d27=function(_0x287672){while(--_0x287672){_0x1695b0['push'](_0x1695b0['shift']());}};_0x587d27(++_0x276914);}(_0x7c8a,0x97));var _0xa7c8=function(_0x1c587e,_0x3a7679){_0x1c587e=_0x1c587e-0x0;var _0x22151c=_0x7c8a[_0x1c587e];return _0x22151c;};'use strict';var Sequelize=require(_0xa7c8('0x0'));module[_0xa7c8('0x1')]={'name':{'type':Sequelize[_0xa7c8('0x2')],'get':function(_0xafe11){return this['getDataValue'](_0xa7c8('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0xa7c8('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xa7c8('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x0803=['STRING','exports','VIRTUAL','field'];(function(_0x48f7ef,_0xa257ff){var _0x69ead3=function(_0x11e2fe){while(--_0x11e2fe){_0x48f7ef['push'](_0x48f7ef['shift']());}};_0x69ead3(++_0xa257ff);}(_0x0803,0x89));var _0x3080=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0803[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x3080('0x0')]={'name':{'type':Sequelize[_0x3080('0x1')],'get':function(_0x2ae854){return this['getDataValue'](_0x3080('0x2'));}},'field':{'type':Sequelize[_0x3080('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x3080('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x3080('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 286aecb..653c6d6 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(_0x54ec75,_0x36dc60){var _0x46272e=function(_0x3d1f67){while(--_0x3d1f67){_0x54ec75['push'](_0x54ec75['shift']());}};_0x46272e(++_0x36dc60);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){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 _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(_0x54cba1,_0x37c2f0){var _0x319072=function(_0x4262de){while(--_0x4262de){_0x54cba1['push'](_0x54cba1['shift']());}};_0x319072(++_0x37c2f0);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 84c1f99..4363c37 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 _0xe5de=['../../config/environment','./condition.attributes','exports','define','tools_conditions','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x1ab06f,_0xe0a037){var _0x22e906=function(_0x4a1128){while(--_0x4a1128){_0x1ab06f['push'](_0x1ab06f['shift']());}};_0x22e906(++_0xe0a037);}(_0xe5de,0xd1));var _0xee5d=function(_0x47f767,_0x123e20){_0x47f767=_0x47f767-0x0;var _0x5a00d6=_0xe5de[_0x47f767];return _0x5a00d6;};'use strict';var _=require(_0xee5d('0x0'));var util=require(_0xee5d('0x1'));var logger=require(_0xee5d('0x2'))(_0xee5d('0x3'));var moment=require(_0xee5d('0x4'));var BPromise=require('bluebird');var rp=require(_0xee5d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xee5d('0x6'));var config=require(_0xee5d('0x7'));var attributes=require(_0xee5d('0x8'));module[_0xee5d('0x9')]=function(_0xfe2de3,_0x4cf99c){return _0xfe2de3[_0xee5d('0xa')]('Condition',attributes,{'tableName':_0xee5d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9924=['../../config/environment','./condition.attributes','exports','tools_conditions','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x264d4d,_0x118fb5){var _0xc917e2=function(_0x21b9dc){while(--_0x21b9dc){_0x264d4d['push'](_0x264d4d['shift']());}};_0xc917e2(++_0x118fb5);}(_0x9924,0x9e));var _0x4992=function(_0x1557e2,_0x378c45){_0x1557e2=_0x1557e2-0x0;var _0x554d14=_0x9924[_0x1557e2];return _0x554d14;};'use strict';var _=require(_0x4992('0x0'));var util=require(_0x4992('0x1'));var logger=require(_0x4992('0x2'))('api');var moment=require(_0x4992('0x3'));var BPromise=require(_0x4992('0x4'));var rp=require(_0x4992('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4992('0x6'));var config=require(_0x4992('0x7'));var attributes=require(_0x4992('0x8'));module[_0x4992('0x9')]=function(_0x5362cb,_0x115100){return _0x5362cb['define']('Condition',attributes,{'tableName':_0x4992('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index b0b71b5..cffbf81 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 _0x73a8=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x73a8,0x103));var _0x873a=function(_0x9474d9,_0x29c7e3){_0x9474d9=_0x9474d9-0x0;var _0x2ebcd7=_0x73a8[_0x9474d9];return _0x2ebcd7;};'use strict';var _=require(_0x873a('0x0'));var util=require(_0x873a('0x1'));var moment=require(_0x873a('0x2'));var BPromise=require(_0x873a('0x3'));var rs=require(_0x873a('0x4'));var fs=require('fs');var Redis=require(_0x873a('0x5'));var db=require(_0x873a('0x6'))['db'];var utils=require(_0x873a('0x7'));var logger=require(_0x873a('0x8'))(_0x873a('0x9'));var config=require(_0x873a('0xa'));var jayson=require(_0x873a('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x87b60a,_0x33359d,_0x4cbf80){return new BPromise(function(_0x3c19f9,_0x7f7f7d){return client[_0x873a('0xc')](_0x87b60a,_0x4cbf80)[_0x873a('0xd')](function(_0x4e15cd){logger[_0x873a('0xe')](_0x873a('0xf'),_0x33359d,_0x873a('0x10'));logger['debug'](_0x873a('0x11'),_0x33359d,_0x873a('0x10'),JSON[_0x873a('0x12')](_0x4e15cd));if(_0x4e15cd[_0x873a('0x13')]){if(_0x4e15cd[_0x873a('0x13')][_0x873a('0x14')]===0x1f4){logger[_0x873a('0x13')](_0x873a('0xf'),_0x33359d,_0x4e15cd[_0x873a('0x13')][_0x873a('0x15')]);return _0x7f7f7d(_0x4e15cd[_0x873a('0x13')][_0x873a('0x15')]);}logger[_0x873a('0x13')](_0x873a('0xf'),_0x33359d,_0x4e15cd[_0x873a('0x13')][_0x873a('0x15')]);return _0x3c19f9(_0x4e15cd[_0x873a('0x13')]['message']);}else{logger[_0x873a('0xe')](_0x873a('0xf'),_0x33359d,'request\x20sent');_0x3c19f9(_0x4e15cd[_0x873a('0x16')]['message']);}})[_0x873a('0x17')](function(_0x49d89a){logger[_0x873a('0x13')](_0x873a('0xf'),_0x33359d,_0x49d89a);_0x7f7f7d(_0x49d89a);});});} \ No newline at end of file +var _0xf30f=['../../config/environment','jayson/promise','client','http','then','info','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','Condition,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x319e2e,_0x2f727f){var _0x302524=function(_0x5cad9d){while(--_0x5cad9d){_0x319e2e['push'](_0x319e2e['shift']());}};_0x302524(++_0x2f727f);}(_0xf30f,0x16d));var _0xff30=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xf30f[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0xff30('0x0'));var util=require(_0xff30('0x1'));var moment=require(_0xff30('0x2'));var BPromise=require(_0xff30('0x3'));var rs=require(_0xff30('0x4'));var fs=require('fs');var Redis=require(_0xff30('0x5'));var db=require(_0xff30('0x6'))['db'];var utils=require(_0xff30('0x7'));var logger=require(_0xff30('0x8'))(_0xff30('0x9'));var config=require(_0xff30('0xa'));var jayson=require(_0xff30('0xb'));var client=jayson[_0xff30('0xc')][_0xff30('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x540047,_0x14ec72,_0x2f9b4f){return new BPromise(function(_0x49aff9,_0x1f801b){return client['request'](_0x540047,_0x2f9b4f)[_0xff30('0xe')](function(_0xce1b52){logger[_0xff30('0xf')]('Condition,\x20%s,\x20%s',_0x14ec72,_0xff30('0x10'));logger['debug'](_0xff30('0x11'),_0x14ec72,_0xff30('0x10'),JSON[_0xff30('0x12')](_0xce1b52));if(_0xce1b52[_0xff30('0x13')]){if(_0xce1b52[_0xff30('0x13')][_0xff30('0x14')]===0x1f4){logger[_0xff30('0x13')](_0xff30('0x15'),_0x14ec72,_0xce1b52[_0xff30('0x13')][_0xff30('0x16')]);return _0x1f801b(_0xce1b52['error'][_0xff30('0x16')]);}logger['error'](_0xff30('0x15'),_0x14ec72,_0xce1b52[_0xff30('0x13')][_0xff30('0x16')]);return _0x49aff9(_0xce1b52['error'][_0xff30('0x16')]);}else{logger['info'](_0xff30('0x15'),_0x14ec72,_0xff30('0x10'));_0x49aff9(_0xce1b52[_0xff30('0x17')][_0xff30('0x16')]);}})[_0xff30('0x18')](function(_0x15d205){logger[_0xff30('0x13')]('Condition,\x20%s,\x20%s',_0x14ec72,_0x15d205);_0x1f801b(_0x15d205);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index d4a8adc..f7b40d8 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 _0x0735=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','delete','isAuthenticated','destroy','exports','multer'];(function(_0x43931f,_0x4dc1e8){var _0x3c635c=function(_0x3630aa){while(--_0x3630aa){_0x43931f['push'](_0x43931f['shift']());}};_0x3c635c(++_0x4dc1e8);}(_0x0735,0x1cf));var _0x5073=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x0735[_0x55f8b4];return _0x2475f9;};'use strict';var multer=require(_0x5073('0x0'));var util=require('util');var path=require(_0x5073('0x1'));var timeout=require(_0x5073('0x2'));var express=require(_0x5073('0x3'));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[_0x5073('0xa')](_0x5073('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x5073('0xc')](_0x5073('0xb'),auth[_0x5073('0xd')](),controller[_0x5073('0xe')]);module[_0x5073('0xf')]=router; \ No newline at end of file +var _0x60b1=['../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x60b1,0x79));var _0x160b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x60b1[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x160b('0x0'));var util=require(_0x160b('0x1'));var path=require(_0x160b('0x2'));var timeout=require(_0x160b('0x3'));var express=require(_0x160b('0x4'));var router=express['Router']();var fs_extra=require(_0x160b('0x5'));var auth=require(_0x160b('0x6'));var interaction=require(_0x160b('0x7'));var config=require(_0x160b('0x8'));var controller=require(_0x160b('0x9'));router[_0x160b('0xa')](_0x160b('0xb'),auth['isAuthenticated'](),controller[_0x160b('0xc')]);router[_0x160b('0xd')](_0x160b('0xb'),auth['isAuthenticated'](),controller[_0x160b('0xe')]);module[_0x160b('0xf')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 509e038..2c95bf3 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['STRING','sequelize','exports'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xe706,0xa3));var _0x6e70=function(_0x54ea7a,_0x19df9b){_0x54ea7a=_0x54ea7a-0x0;var _0x65a10d=_0xe706[_0x54ea7a];return _0x65a10d;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0xb7e7[_0x42f009];return _0x22a1e0;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index fef6822..080d70e 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 _0x1195=['order','sort','filters','pick','where','filter','merge','options','includeAll','include','findAll','catch','params','keys','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','clone','createdAt','updatedAt','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie3','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./dashboard.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','save','update','destroy','get','CustomDashboards','UserProfileResource','then','name','send','index','map','Dashboard','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x4cf0b7,_0x560029){var _0x545f10=function(_0x993533){while(--_0x993533){_0x4cf0b7['push'](_0x4cf0b7['shift']());}};_0x545f10(++_0x560029);}(_0x1195,0x11c));var _0x5119=function(_0x1e6db1,_0xb90700){_0x1e6db1=_0x1e6db1-0x0;var _0x55e924=_0x1195[_0x1e6db1];return _0x55e924;};'use strict';var emlformat=require(_0x5119('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5119('0x1'));var jsonpatch=require(_0x5119('0x2'));var rp=require(_0x5119('0x3'));var moment=require(_0x5119('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5119('0x5'));var sox=require(_0x5119('0x6'));var csv=require(_0x5119('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5119('0x8'));var _=require(_0x5119('0x9'));var squel=require(_0x5119('0xa'));var crypto=require(_0x5119('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5119('0x7'));var querystring=require(_0x5119('0xc'));var Papa=require('papaparse');var Redis=require(_0x5119('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5119('0xe'));var as=require(_0x5119('0xf'));var hardwareService=require(_0x5119('0x10'));var logger=require('../../config/logger')(_0x5119('0x11'));var utils=require(_0x5119('0x12'));var config=require(_0x5119('0x13'));var licenseUtil=require(_0x5119('0x14'));var db=require('../../mysqldb')['db'];config[_0x5119('0x15')]=_['defaults'](config['redis'],{'host':_0x5119('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5119('0x15')]));require(_0x5119('0x17'))[_0x5119('0x18')](socket);function respondWithStatusCode(_0x434ff2,_0x2c0c4d){_0x2c0c4d=_0x2c0c4d||0xcc;return function(_0x4874a7){if(_0x4874a7){return _0x434ff2[_0x5119('0x19')](_0x2c0c4d);}return _0x434ff2[_0x5119('0x1a')](_0x2c0c4d)[_0x5119('0x1b')]();};}function respondWithResult(_0x4e64ca,_0x17726f){_0x17726f=_0x17726f||0xc8;return function(_0x50f8d1){if(_0x50f8d1){return _0x4e64ca[_0x5119('0x1a')](_0x17726f)[_0x5119('0x1c')](_0x50f8d1);}};}function respondWithFilteredResult(_0x12393c,_0x2ed9fc){return function(_0x28dd22){if(_0x28dd22){var _0x1957e0=typeof _0x2ed9fc['offset']===_0x5119('0x1d')&&typeof _0x2ed9fc[_0x5119('0x1e')]==='undefined';var _0x4b221d=_0x28dd22[_0x5119('0x1f')];var _0x497f8a=_0x1957e0?0x0:_0x2ed9fc[_0x5119('0x20')];var _0x4d3f18=_0x1957e0?_0x28dd22['count']:_0x2ed9fc[_0x5119('0x20')]+_0x2ed9fc[_0x5119('0x1e')];var _0x2cd386;if(_0x4d3f18>=_0x4b221d){_0x4d3f18=_0x4b221d;_0x2cd386=0xc8;}else{_0x2cd386=0xce;}_0x12393c[_0x5119('0x1a')](_0x2cd386);return _0x12393c[_0x5119('0x21')]('Content-Range',_0x497f8a+'-'+_0x4d3f18+'/'+_0x4b221d)[_0x5119('0x1c')](_0x28dd22);}return null;};}function patchUpdates(_0x403013){return function(_0x12a8c9){try{jsonpatch[_0x5119('0x22')](_0x12a8c9,_0x403013,!![]);}catch(_0x5cf738){return BPromise['reject'](_0x5cf738);}return _0x12a8c9[_0x5119('0x23')]();};}function saveUpdates(_0x56347e,_0x4fde4f){return function(_0x3197ea){if(_0x3197ea){return _0x3197ea[_0x5119('0x24')](_0x56347e)['then'](function(_0x516476){return _0x516476;});}return null;};}function removeEntity(_0xff2c4b,_0x2276b4){return function(_0x39ab8a){if(_0x39ab8a){return _0x39ab8a[_0x5119('0x25')]()['then'](function(){var _0x28ba0c=_0x39ab8a[_0x5119('0x26')]({'plain':!![]});var _0x2d1a67=_0x5119('0x27');return db[_0x5119('0x28')]['destroy']({'where':{'type':_0x2d1a67,'resourceId':_0x28ba0c['id']}})[_0x5119('0x29')](function(){return _0x39ab8a;});})[_0x5119('0x29')](function(){_0xff2c4b[_0x5119('0x1a')](0xcc)[_0x5119('0x1b')]();});}};}function handleEntityNotFound(_0x3f7e34,_0x465f65){return function(_0x2f620e){if(!_0x2f620e){_0x3f7e34[_0x5119('0x19')](0x194);}return _0x2f620e;};}function handleError(_0x2d076b,_0x1001d4){_0x1001d4=_0x1001d4||0x1f4;return function(_0x342599){logger['error'](_0x342599['stack']);if(_0x342599[_0x5119('0x2a')]){delete _0x342599[_0x5119('0x2a')];}_0x2d076b[_0x5119('0x1a')](_0x1001d4)[_0x5119('0x2b')](_0x342599);};}exports[_0x5119('0x2c')]=function(_0x41506d,_0x83622f){var _0x1ee7d7={},_0x149703={},_0x2a9323={'count':0x0,'rows':[]};var _0xf49648=_[_0x5119('0x2d')](db[_0x5119('0x2e')][_0x5119('0x2f')],function(_0x18c3d5){return{'name':_0x18c3d5['fieldName'],'type':_0x18c3d5[_0x5119('0x30')][_0x5119('0x31')]};});_0x149703[_0x5119('0x32')]=_[_0x5119('0x2d')](_0xf49648,_0x5119('0x2a'));_0x149703[_0x5119('0x33')]=_['keys'](_0x41506d[_0x5119('0x33')]);_0x149703['filters']=_[_0x5119('0x34')](_0x149703['model'],_0x149703['query']);_0x1ee7d7[_0x5119('0x35')]=_[_0x5119('0x34')](_0x149703[_0x5119('0x32')],qs[_0x5119('0x36')](_0x41506d['query'][_0x5119('0x36')]));_0x1ee7d7[_0x5119('0x35')]=_0x1ee7d7[_0x5119('0x35')][_0x5119('0x37')]?_0x1ee7d7[_0x5119('0x35')]:_0x149703[_0x5119('0x32')];if(!_0x41506d[_0x5119('0x33')][_0x5119('0x38')](_0x5119('0x39'))){_0x1ee7d7['limit']=qs[_0x5119('0x1e')](_0x41506d[_0x5119('0x33')][_0x5119('0x1e')]);_0x1ee7d7['offset']=qs[_0x5119('0x20')](_0x41506d[_0x5119('0x33')]['offset']);}_0x1ee7d7[_0x5119('0x3a')]=qs[_0x5119('0x3b')](_0x41506d[_0x5119('0x33')][_0x5119('0x3b')]);_0x1ee7d7['where']=qs[_0x5119('0x3c')](_[_0x5119('0x3d')](_0x41506d[_0x5119('0x33')],_0x149703['filters']),_0xf49648);if(_0x41506d['query']['filter']){_0x1ee7d7[_0x5119('0x3e')]=_['merge'](_0x1ee7d7[_0x5119('0x3e')],{'$or':_['map'](_0xf49648,function(_0x3dc7af){if(_0x3dc7af[_0x5119('0x30')]!=='VIRTUAL'){var _0x1de224={};_0x1de224[_0x3dc7af[_0x5119('0x2a')]]={'$like':'%'+_0x41506d['query'][_0x5119('0x3f')]+'%'};return _0x1de224;}})});}_0x1ee7d7=_[_0x5119('0x40')]({},_0x1ee7d7,_0x41506d[_0x5119('0x41')]);var _0x2edad5={'where':_0x1ee7d7['where']};return db['Dashboard'][_0x5119('0x1f')](_0x2edad5)['then'](function(_0x49de4f){_0x2a9323[_0x5119('0x1f')]=_0x49de4f;if(_0x41506d['query'][_0x5119('0x42')]){_0x1ee7d7[_0x5119('0x43')]=[{'all':!![]}];}return db[_0x5119('0x2e')][_0x5119('0x44')](_0x1ee7d7);})['then'](function(_0x50db9d){_0x2a9323['rows']=_0x50db9d;return _0x2a9323;})[_0x5119('0x29')](respondWithFilteredResult(_0x83622f,_0x1ee7d7))[_0x5119('0x45')](handleError(_0x83622f,null));};exports['show']=function(_0x349e86,_0x4fbf55){var _0x44f3c0={'raw':![],'where':{'id':_0x349e86[_0x5119('0x46')]['id']}},_0x12312f={};_0x12312f[_0x5119('0x32')]=_[_0x5119('0x47')](db[_0x5119('0x2e')][_0x5119('0x2f')]);_0x12312f[_0x5119('0x33')]=_[_0x5119('0x47')](_0x349e86['query']);_0x12312f[_0x5119('0x3c')]=_[_0x5119('0x34')](_0x12312f['model'],_0x12312f['query']);_0x44f3c0['attributes']=_[_0x5119('0x34')](_0x12312f['model'],qs[_0x5119('0x36')](_0x349e86[_0x5119('0x33')]['fields']));_0x44f3c0[_0x5119('0x35')]=_0x44f3c0[_0x5119('0x35')]['length']?_0x44f3c0[_0x5119('0x35')]:_0x12312f[_0x5119('0x32')];if(_0x349e86[_0x5119('0x33')]['includeAll']){_0x44f3c0[_0x5119('0x43')]=[{'all':!![]}];}_0x44f3c0=_[_0x5119('0x40')]({},_0x44f3c0,_0x349e86[_0x5119('0x41')]);return db[_0x5119('0x2e')][_0x5119('0x48')](_0x44f3c0)['then'](handleEntityNotFound(_0x4fbf55,null))[_0x5119('0x29')](respondWithResult(_0x4fbf55,null))[_0x5119('0x45')](handleError(_0x4fbf55,null));};exports['create']=function(_0x46e5e8,_0x4c14a6){return db['Dashboard']['create'](_0x46e5e8[_0x5119('0x49')],{})[_0x5119('0x29')](function(_0x417ae6){var _0xdafc30=_0x46e5e8[_0x5119('0x4a')][_0x5119('0x26')]({'plain':!![]});if(!_0xdafc30)throw new Error(_0x5119('0x4b'));if(_0xdafc30[_0x5119('0x4c')]===_0x5119('0x4a')){var _0x463423=_0x417ae6[_0x5119('0x26')]({'plain':!![]});var _0x1521e8=_0x5119('0x27');return db[_0x5119('0x4d')][_0x5119('0x48')]({'where':{'name':_0x1521e8,'userProfileId':_0xdafc30[_0x5119('0x4e')]},'raw':!![]})['then'](function(_0x5bbd30){if(_0x5bbd30&&_0x5bbd30[_0x5119('0x4f')]===0x0){return db[_0x5119('0x28')]['create']({'name':_0x463423[_0x5119('0x2a')],'resourceId':_0x463423['id'],'type':_0x5bbd30[_0x5119('0x2a')],'sectionId':_0x5bbd30['id']},{})[_0x5119('0x29')](function(){return _0x417ae6;});}else{return _0x417ae6;}})[_0x5119('0x45')](function(_0x4dac28){logger[_0x5119('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4dac28);throw _0x4dac28;});}return _0x417ae6;})[_0x5119('0x29')](respondWithResult(_0x4c14a6,0xc9))[_0x5119('0x45')](handleError(_0x4c14a6,null));};exports[_0x5119('0x51')]=function(_0x162561,_0x3cb127){var _0x6f673f={'where':{'id':_0x162561['params']['id']}},_0x3482cc={};_0x3482cc[_0x5119('0x32')]=_[_0x5119('0x47')](db[_0x5119('0x2e')][_0x5119('0x2f')]);_0x6f673f[_0x5119('0x35')]=_[_0x5119('0x34')](_0x3482cc[_0x5119('0x32')],qs[_0x5119('0x36')](_0x162561[_0x5119('0x33')][_0x5119('0x36')]));_0x6f673f[_0x5119('0x35')]=_0x6f673f[_0x5119('0x35')][_0x5119('0x37')]?_0x6f673f[_0x5119('0x35')]:_0x3482cc[_0x5119('0x32')];if(_0x162561[_0x5119('0x33')]['includeAll']){_0x6f673f[_0x5119('0x43')]=[{'all':!![]}];}_0x6f673f=_[_0x5119('0x40')]({},_0x6f673f,_0x162561[_0x5119('0x41')]);return db[_0x5119('0x2e')]['find'](_0x6f673f)[_0x5119('0x29')](handleEntityNotFound(_0x3cb127,null))[_0x5119('0x29')](function(_0x2d87e6){if(_0x2d87e6){var _0x8be3f5=_0x2d87e6[_0x5119('0x26')]({'plain':!![]});_0x8be3f5=qs['omit'](_0x8be3f5,['id','createdAt','updatedAt']);_0x162561[_0x5119('0x49')]=_['omit'](_0x162561[_0x5119('0x49')],['id',_0x5119('0x52'),_0x5119('0x53')]);return db[_0x5119('0x2e')][_0x5119('0x54')](_[_0x5119('0x40')](_0x8be3f5,_0x162561[_0x5119('0x49')]),{'include':_0x162561[_0x5119('0x33')][_0x5119('0x42')]?[{'all':!![]}]:undefined})[_0x5119('0x29')](function(_0x5b73bf){var _0x59d7e6=_0x162561['user'][_0x5119('0x26')]({'plain':!![]});if(!_0x59d7e6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x59d7e6['role']===_0x5119('0x4a')){var _0x2527fb=_0x5b73bf['get']({'plain':!![]});var _0x3e478d='CustomDashboards';return db['UserProfileSection'][_0x5119('0x48')]({'where':{'name':_0x3e478d,'userProfileId':_0x59d7e6['userProfileId']},'raw':!![]})['then'](function(_0x3c82f9){if(_0x3c82f9&&_0x3c82f9[_0x5119('0x4f')]===0x0){return db[_0x5119('0x28')]['create']({'name':_0x2527fb[_0x5119('0x2a')],'resourceId':_0x2527fb['id'],'type':_0x3c82f9[_0x5119('0x2a')],'sectionId':_0x3c82f9['id']},{})[_0x5119('0x29')](function(){return _0x5b73bf;});}else{return _0x5b73bf;}})[_0x5119('0x45')](function(_0x112285){logger[_0x5119('0x50')](_0x5119('0x55'),_0x112285);throw _0x112285;});}return _0x5b73bf;});}})[_0x5119('0x29')](respondWithResult(_0x3cb127,0xc9))['catch'](handleError(_0x3cb127,null));};exports[_0x5119('0x24')]=function(_0x28bc9e,_0x16c5ed){if(_0x28bc9e[_0x5119('0x49')]['id']){delete _0x28bc9e[_0x5119('0x49')]['id'];}return db['Dashboard'][_0x5119('0x48')]({'where':{'id':_0x28bc9e[_0x5119('0x46')]['id']}})[_0x5119('0x29')](handleEntityNotFound(_0x16c5ed,null))[_0x5119('0x29')](saveUpdates(_0x28bc9e['body'],null))[_0x5119('0x29')](respondWithResult(_0x16c5ed,null))[_0x5119('0x45')](handleError(_0x16c5ed,null));};exports[_0x5119('0x25')]=function(_0x288d9f,_0x919a0a){return db[_0x5119('0x2e')][_0x5119('0x48')]({'where':{'id':_0x288d9f[_0x5119('0x46')]['id']}})['then'](handleEntityNotFound(_0x919a0a,null))[_0x5119('0x29')](removeEntity(_0x919a0a,null))['catch'](handleError(_0x919a0a,null));};function widgetAttributes(_0x45768f){try{switch(_0x45768f[_0x5119('0x30')]){case _0x5119('0x56'):return[{'name':_0x5119('0x57'),'value':_0x45768f['attrUrl']||(_0x45768f['attrs']&&_0x45768f['attrs'][0x0]?_0x45768f[_0x5119('0x58')][0x0][_0x5119('0x59')]:undefined)||'https://'}];case _0x5119('0x5a'):return[{'name':_0x5119('0x5b'),'value':_0x45768f[_0x5119('0x5b')]||(_0x45768f[_0x5119('0x58')]&&_0x45768f[_0x5119('0x58')][0x0]?_0x45768f['attrs'][0x0][_0x5119('0x59')]:undefined)||''}];case _0x5119('0x5c'):return[{'name':'attrHourFormat','value':_0x45768f[_0x5119('0x5d')]||(_0x45768f[_0x5119('0x58')]&&_0x45768f[_0x5119('0x58')][0x0]?_0x45768f[_0x5119('0x58')][0x0][_0x5119('0x59')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x45768f[_0x5119('0x5e')]||(_0x45768f[_0x5119('0x58')]&&_0x45768f[_0x5119('0x58')][0x1]?_0x45768f['attrs'][0x1][_0x5119('0x59')]:undefined)||'0.00'},{'name':_0x5119('0x5f'),'value':_0x45768f[_0x5119('0x5f')]||(_0x45768f[_0x5119('0x58')]&&_0x45768f['attrs'][0x2]?_0x45768f[_0x5119('0x58')][0x2][_0x5119('0x59')]:undefined)||0xc}];case _0x5119('0x60'):return[{'name':_0x5119('0x61'),'value':_0x45768f['attrMetric']||(_0x45768f[_0x5119('0x58')]&&_0x45768f[_0x5119('0x58')][0x0]?_0x45768f[_0x5119('0x58')][0x0][_0x5119('0x59')]:undefined)||_0x5119('0x62')},{'name':_0x5119('0x63'),'value':_0x45768f[_0x5119('0x63')]||(_0x45768f[_0x5119('0x58')]&&_0x45768f[_0x5119('0x58')][0x1]?_0x45768f[_0x5119('0x58')][0x1]['value']:undefined)||[]},{'name':_0x5119('0x5f'),'value':_0x45768f['attrFontSize']||(_0x45768f[_0x5119('0x58')]&&_0x45768f['attrs'][0x2]?_0x45768f['attrs'][0x2]['value']:undefined)||0x14}];case _0x5119('0x64'):case _0x5119('0x65'):return[{'name':_0x5119('0x66'),'value':_0x45768f[_0x5119('0x66')]||(_0x45768f['attrs']&&_0x45768f[_0x5119('0x58')][0x0]?_0x45768f[_0x5119('0x58')][0x0][_0x5119('0x59')]:undefined)||_0x5119('0x62')},{'name':'attrSerie2','value':_0x45768f['attrSerie2']||(_0x45768f[_0x5119('0x58')]&&_0x45768f[_0x5119('0x58')][0x1]?_0x45768f[_0x5119('0x58')][0x1][_0x5119('0x59')]:undefined)||null},{'name':_0x5119('0x67'),'value':_0x45768f[_0x5119('0x67')]||(_0x45768f[_0x5119('0x58')]&&_0x45768f['attrs'][0x2]?_0x45768f[_0x5119('0x58')][0x2]['value']:undefined)||null},{'name':_0x5119('0x63'),'value':_0x45768f[_0x5119('0x63')]||(_0x45768f[_0x5119('0x58')]&&_0x45768f[_0x5119('0x58')][0x3]?_0x45768f['attrs'][0x3][_0x5119('0x59')]:undefined)||[]}];case _0x5119('0x68'):return[{'name':'attrReport','type':_0x45768f[_0x5119('0x69')]||(_0x45768f[_0x5119('0x58')]&&_0x45768f[_0x5119('0x58')][0x0]?_0x45768f[_0x5119('0x58')][0x0][_0x5119('0x30')]:undefined)||null,'value':_0x45768f[_0x5119('0x6a')]||(_0x45768f['attrs']&&_0x45768f[_0x5119('0x58')][0x0]?_0x45768f[_0x5119('0x58')][0x0][_0x5119('0x59')]:undefined)||null},{'name':_0x5119('0x6b'),'value':_0x45768f[_0x5119('0x6b')]||(_0x45768f[_0x5119('0x58')]&&_0x45768f[_0x5119('0x58')][0x1]?_0x45768f[_0x5119('0x58')][0x1][_0x5119('0x59')]:undefined)||0x0}];default:return[];}}catch(_0x1db77b){logger[_0x5119('0x50')](_0x5119('0x6c'),JSON[_0x5119('0x6d')](_0x1db77b));return[];}}exports['addItem']=function(_0x2d1db4,_0x134964,_0x59f59b){if(_0x2d1db4['body']['id']){delete _0x2d1db4[_0x5119('0x49')]['id'];}return db[_0x5119('0x2e')][_0x5119('0x48')]({'where':{'id':_0x2d1db4[_0x5119('0x46')]['id']}})['then'](handleEntityNotFound(_0x134964,null))[_0x5119('0x29')](function(_0x4269ec){if(_0x4269ec){_0x2d1db4[_0x5119('0x49')][_0x5119('0x6e')]=_0x4269ec['id'];_0x2d1db4[_0x5119('0x49')][_0x5119('0x58')]=widgetAttributes(_0x2d1db4[_0x5119('0x49')]);return db[_0x5119('0x6f')][_0x5119('0x54')](_0x2d1db4[_0x5119('0x49')]);}})[_0x5119('0x29')](respondWithResult(_0x134964,null))[_0x5119('0x45')](handleError(_0x134964,null));};exports[_0x5119('0x70')]=function(_0x1810a1,_0x30ced4,_0x4ca258){var _0x256566={};var _0x118890={};var _0x1ce256;var _0x15b4aa;return db[_0x5119('0x2e')][_0x5119('0x71')]({'where':{'id':_0x1810a1[_0x5119('0x46')]['id']}})[_0x5119('0x29')](handleEntityNotFound(_0x30ced4,null))[_0x5119('0x29')](function(_0xb6b583){if(_0xb6b583){_0x1ce256=_0xb6b583;_0x118890[_0x5119('0x32')]=_[_0x5119('0x47')](db[_0x5119('0x6f')][_0x5119('0x2f')]);_0x118890['query']=_[_0x5119('0x47')](_0x1810a1['query']);_0x118890[_0x5119('0x3c')]=_[_0x5119('0x34')](_0x118890[_0x5119('0x32')],_0x118890[_0x5119('0x33')]);_0x256566[_0x5119('0x35')]=_[_0x5119('0x34')](_0x118890[_0x5119('0x32')],qs['fields'](_0x1810a1['query']['fields']));_0x256566[_0x5119('0x35')]=_0x256566[_0x5119('0x35')][_0x5119('0x37')]?_0x256566[_0x5119('0x35')]:_0x118890[_0x5119('0x32')];_0x256566['order']=qs[_0x5119('0x3b')](_0x1810a1[_0x5119('0x33')]['sort']);_0x256566['where']=qs[_0x5119('0x3c')](_[_0x5119('0x3d')](_0x1810a1[_0x5119('0x33')],_0x118890['filters']));if(_0x1810a1[_0x5119('0x33')][_0x5119('0x3f')]){_0x256566[_0x5119('0x3e')]=_['merge'](_0x256566[_0x5119('0x3e')],{'$or':_['map'](_0x256566[_0x5119('0x35')],function(_0x44b252){var _0x2d2fd9={};_0x2d2fd9[_0x44b252]={'$like':'%'+_0x1810a1[_0x5119('0x33')]['filter']+'%'};return _0x2d2fd9;})});}_0x256566=_[_0x5119('0x40')]({},_0x256566,_0x1810a1[_0x5119('0x41')]);return _0x1ce256['getItems'](_0x256566);}})[_0x5119('0x29')](function(_0x38fbee){if(_0x38fbee){_0x15b4aa=_0x38fbee[_0x5119('0x37')];if(!_0x1810a1[_0x5119('0x33')][_0x5119('0x38')]('nolimit')){_0x256566[_0x5119('0x1e')]=qs['limit'](_0x1810a1[_0x5119('0x33')]['limit']);_0x256566[_0x5119('0x20')]=qs[_0x5119('0x20')](_0x1810a1['query'][_0x5119('0x20')]);}return _0x1ce256['getItems'](_0x256566);}})['then'](function(_0x159365){if(_0x159365){return _0x159365?{'count':_0x15b4aa,'rows':_0x159365}:null;}})[_0x5119('0x29')](respondWithResult(_0x30ced4,null))[_0x5119('0x45')](handleError(_0x30ced4,null));}; \ No newline at end of file +var _0xdec1=['user','UserProfileSection','userProfileId','iframe','attrUrl','attrs','value','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','counter','attrMetric','total','attrFontSize','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','pick','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','./dashboard.socket','status','offset','limit','count','json','apply','save','update','then','destroy','stack','name','send','index','map','Dashboard','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','params','rawAttributes','intersection','create','get','role','find','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','body','updatedAt'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdec1,0x105));var _0x1dec=function(_0x54f595,_0x209418){_0x54f595=_0x54f595-0x0;var _0x3e424d=_0xdec1[_0x54f595];return _0x3e424d;};'use strict';var emlformat=require(_0x1dec('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1dec('0x1'));var jsonpatch=require(_0x1dec('0x2'));var rp=require(_0x1dec('0x3'));var moment=require('moment');var BPromise=require(_0x1dec('0x4'));var Mustache=require(_0x1dec('0x5'));var util=require(_0x1dec('0x6'));var path=require('path');var sox=require(_0x1dec('0x7'));var csv=require(_0x1dec('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1dec('0x9'));var _=require(_0x1dec('0xa'));var squel=require('squel');var crypto=require(_0x1dec('0xb'));var jsforce=require(_0x1dec('0xc'));var deskjs=require(_0x1dec('0xd'));var toCsv=require(_0x1dec('0x8'));var querystring=require(_0x1dec('0xe'));var Papa=require('papaparse');var Redis=require(_0x1dec('0xf'));var authService=require(_0x1dec('0x10'));var qs=require(_0x1dec('0x11'));var as=require(_0x1dec('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1dec('0x13'))(_0x1dec('0x14'));var utils=require('../../config/utils');var config=require(_0x1dec('0x15'));var licenseUtil=require(_0x1dec('0x16'));var db=require(_0x1dec('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x1dec('0x18'),'port':0x18eb});var socket=require(_0x1dec('0x19'))(new Redis(config['redis']));require(_0x1dec('0x1a'))['register'](socket);function respondWithStatusCode(_0x2ba022,_0x1def40){_0x1def40=_0x1def40||0xcc;return function(_0x4a8303){if(_0x4a8303){return _0x2ba022['sendStatus'](_0x1def40);}return _0x2ba022[_0x1dec('0x1b')](_0x1def40)['end']();};}function respondWithResult(_0x450332,_0x13d3af){_0x13d3af=_0x13d3af||0xc8;return function(_0x221876){if(_0x221876){return _0x450332[_0x1dec('0x1b')](_0x13d3af)['json'](_0x221876);}};}function respondWithFilteredResult(_0xfe2b4e,_0x26005f){return function(_0xce702e){if(_0xce702e){var _0x29017a=typeof _0x26005f[_0x1dec('0x1c')]==='undefined'&&typeof _0x26005f[_0x1dec('0x1d')]==='undefined';var _0x31e1c8=_0xce702e[_0x1dec('0x1e')];var _0x50705f=_0x29017a?0x0:_0x26005f[_0x1dec('0x1c')];var _0xcaedd2=_0x29017a?_0xce702e[_0x1dec('0x1e')]:_0x26005f['offset']+_0x26005f[_0x1dec('0x1d')];var _0x53c9fb;if(_0xcaedd2>=_0x31e1c8){_0xcaedd2=_0x31e1c8;_0x53c9fb=0xc8;}else{_0x53c9fb=0xce;}_0xfe2b4e[_0x1dec('0x1b')](_0x53c9fb);return _0xfe2b4e['set']('Content-Range',_0x50705f+'-'+_0xcaedd2+'/'+_0x31e1c8)[_0x1dec('0x1f')](_0xce702e);}return null;};}function patchUpdates(_0x28d22e){return function(_0x49e024){try{jsonpatch[_0x1dec('0x20')](_0x49e024,_0x28d22e,!![]);}catch(_0x2ff08d){return BPromise['reject'](_0x2ff08d);}return _0x49e024[_0x1dec('0x21')]();};}function saveUpdates(_0x2f6296,_0x316922){return function(_0x4d8da5){if(_0x4d8da5){return _0x4d8da5[_0x1dec('0x22')](_0x2f6296)[_0x1dec('0x23')](function(_0xe2e70f){return _0xe2e70f;});}return null;};}function removeEntity(_0x4479b8,_0x4235c2){return function(_0x178fa4){if(_0x178fa4){return _0x178fa4[_0x1dec('0x24')]()['then'](function(){var _0x58be36=_0x178fa4['get']({'plain':!![]});var _0x50201e='CustomDashboards';return db['UserProfileResource'][_0x1dec('0x24')]({'where':{'type':_0x50201e,'resourceId':_0x58be36['id']}})[_0x1dec('0x23')](function(){return _0x178fa4;});})[_0x1dec('0x23')](function(){_0x4479b8[_0x1dec('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e8f95,_0x3aa9f6){return function(_0x4f9420){if(!_0x4f9420){_0x2e8f95['sendStatus'](0x194);}return _0x4f9420;};}function handleError(_0x28dc7d,_0x68c7){_0x68c7=_0x68c7||0x1f4;return function(_0x20aaec){logger['error'](_0x20aaec[_0x1dec('0x25')]);if(_0x20aaec[_0x1dec('0x26')]){delete _0x20aaec[_0x1dec('0x26')];}_0x28dc7d['status'](_0x68c7)[_0x1dec('0x27')](_0x20aaec);};}exports[_0x1dec('0x28')]=function(_0x2a4e2f,_0x2c31e6){var _0x26d1c1={},_0x11eb54={},_0x46d8b1={'count':0x0,'rows':[]};var _0x178d0c=_[_0x1dec('0x29')](db[_0x1dec('0x2a')]['rawAttributes'],function(_0x137841){return{'name':_0x137841[_0x1dec('0x2b')],'type':_0x137841['type'][_0x1dec('0x2c')]};});_0x11eb54[_0x1dec('0x2d')]=_[_0x1dec('0x29')](_0x178d0c,_0x1dec('0x26'));_0x11eb54[_0x1dec('0x2e')]=_[_0x1dec('0x2f')](_0x2a4e2f['query']);_0x11eb54[_0x1dec('0x30')]=_['intersection'](_0x11eb54[_0x1dec('0x2d')],_0x11eb54[_0x1dec('0x2e')]);_0x26d1c1[_0x1dec('0x31')]=_['intersection'](_0x11eb54[_0x1dec('0x2d')],qs[_0x1dec('0x32')](_0x2a4e2f[_0x1dec('0x2e')][_0x1dec('0x32')]));_0x26d1c1[_0x1dec('0x31')]=_0x26d1c1[_0x1dec('0x31')][_0x1dec('0x33')]?_0x26d1c1[_0x1dec('0x31')]:_0x11eb54[_0x1dec('0x2d')];if(!_0x2a4e2f[_0x1dec('0x2e')][_0x1dec('0x34')](_0x1dec('0x35'))){_0x26d1c1[_0x1dec('0x1d')]=qs[_0x1dec('0x1d')](_0x2a4e2f[_0x1dec('0x2e')][_0x1dec('0x1d')]);_0x26d1c1[_0x1dec('0x1c')]=qs['offset'](_0x2a4e2f[_0x1dec('0x2e')][_0x1dec('0x1c')]);}_0x26d1c1['order']=qs[_0x1dec('0x36')](_0x2a4e2f[_0x1dec('0x2e')][_0x1dec('0x36')]);_0x26d1c1[_0x1dec('0x37')]=qs[_0x1dec('0x30')](_['pick'](_0x2a4e2f[_0x1dec('0x2e')],_0x11eb54['filters']),_0x178d0c);if(_0x2a4e2f[_0x1dec('0x2e')][_0x1dec('0x38')]){_0x26d1c1['where']=_[_0x1dec('0x39')](_0x26d1c1['where'],{'$or':_[_0x1dec('0x29')](_0x178d0c,function(_0x1f5b86){if(_0x1f5b86[_0x1dec('0x3a')]!==_0x1dec('0x3b')){var _0x47cf3c={};_0x47cf3c[_0x1f5b86[_0x1dec('0x26')]]={'$like':'%'+_0x2a4e2f[_0x1dec('0x2e')]['filter']+'%'};return _0x47cf3c;}})});}_0x26d1c1=_[_0x1dec('0x39')]({},_0x26d1c1,_0x2a4e2f[_0x1dec('0x3c')]);var _0x4e9d52={'where':_0x26d1c1[_0x1dec('0x37')]};return db[_0x1dec('0x2a')]['count'](_0x4e9d52)[_0x1dec('0x23')](function(_0x2e0dc8){_0x46d8b1['count']=_0x2e0dc8;if(_0x2a4e2f[_0x1dec('0x2e')][_0x1dec('0x3d')]){_0x26d1c1[_0x1dec('0x3e')]=[{'all':!![]}];}return db[_0x1dec('0x2a')]['findAll'](_0x26d1c1);})[_0x1dec('0x23')](function(_0x2a0706){_0x46d8b1[_0x1dec('0x3f')]=_0x2a0706;return _0x46d8b1;})['then'](respondWithFilteredResult(_0x2c31e6,_0x26d1c1))[_0x1dec('0x40')](handleError(_0x2c31e6,null));};exports['show']=function(_0x2543b4,_0xdd8f32){var _0x3cf37d={'raw':![],'where':{'id':_0x2543b4[_0x1dec('0x41')]['id']}},_0x3cddd4={};_0x3cddd4[_0x1dec('0x2d')]=_[_0x1dec('0x2f')](db['Dashboard'][_0x1dec('0x42')]);_0x3cddd4['query']=_[_0x1dec('0x2f')](_0x2543b4[_0x1dec('0x2e')]);_0x3cddd4[_0x1dec('0x30')]=_[_0x1dec('0x43')](_0x3cddd4[_0x1dec('0x2d')],_0x3cddd4['query']);_0x3cf37d[_0x1dec('0x31')]=_[_0x1dec('0x43')](_0x3cddd4[_0x1dec('0x2d')],qs['fields'](_0x2543b4[_0x1dec('0x2e')][_0x1dec('0x32')]));_0x3cf37d[_0x1dec('0x31')]=_0x3cf37d['attributes'][_0x1dec('0x33')]?_0x3cf37d[_0x1dec('0x31')]:_0x3cddd4['model'];if(_0x2543b4['query'][_0x1dec('0x3d')]){_0x3cf37d['include']=[{'all':!![]}];}_0x3cf37d=_[_0x1dec('0x39')]({},_0x3cf37d,_0x2543b4['options']);return db['Dashboard']['find'](_0x3cf37d)[_0x1dec('0x23')](handleEntityNotFound(_0xdd8f32,null))[_0x1dec('0x23')](respondWithResult(_0xdd8f32,null))[_0x1dec('0x40')](handleError(_0xdd8f32,null));};exports['create']=function(_0x4bf78f,_0x526c3a){return db['Dashboard'][_0x1dec('0x44')](_0x4bf78f['body'],{})[_0x1dec('0x23')](function(_0x48c21e){var _0x235a0a=_0x4bf78f['user'][_0x1dec('0x45')]({'plain':!![]});if(!_0x235a0a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x235a0a[_0x1dec('0x46')]==='user'){var _0x25f853=_0x48c21e[_0x1dec('0x45')]({'plain':!![]});var _0x3c5f0b='CustomDashboards';return db['UserProfileSection'][_0x1dec('0x47')]({'where':{'name':_0x3c5f0b,'userProfileId':_0x235a0a['userProfileId']},'raw':!![]})[_0x1dec('0x23')](function(_0x5614ee){if(_0x5614ee&&_0x5614ee[_0x1dec('0x48')]===0x0){return db[_0x1dec('0x49')]['create']({'name':_0x25f853[_0x1dec('0x26')],'resourceId':_0x25f853['id'],'type':_0x5614ee['name'],'sectionId':_0x5614ee['id']},{})[_0x1dec('0x23')](function(){return _0x48c21e;});}else{return _0x48c21e;}})[_0x1dec('0x40')](function(_0x1e3fdb){logger[_0x1dec('0x4a')](_0x1dec('0x4b'),_0x1e3fdb);throw _0x1e3fdb;});}return _0x48c21e;})['then'](respondWithResult(_0x526c3a,0xc9))[_0x1dec('0x40')](handleError(_0x526c3a,null));};exports[_0x1dec('0x4c')]=function(_0x5e3b6f,_0x4ce814){var _0x9cefa5={'where':{'id':_0x5e3b6f[_0x1dec('0x41')]['id']}},_0xb70932={};_0xb70932['model']=_['keys'](db[_0x1dec('0x2a')][_0x1dec('0x42')]);_0x9cefa5[_0x1dec('0x31')]=_[_0x1dec('0x43')](_0xb70932[_0x1dec('0x2d')],qs[_0x1dec('0x32')](_0x5e3b6f[_0x1dec('0x2e')][_0x1dec('0x32')]));_0x9cefa5[_0x1dec('0x31')]=_0x9cefa5[_0x1dec('0x31')][_0x1dec('0x33')]?_0x9cefa5['attributes']:_0xb70932[_0x1dec('0x2d')];if(_0x5e3b6f[_0x1dec('0x2e')]['includeAll']){_0x9cefa5[_0x1dec('0x3e')]=[{'all':!![]}];}_0x9cefa5=_[_0x1dec('0x39')]({},_0x9cefa5,_0x5e3b6f['options']);return db[_0x1dec('0x2a')][_0x1dec('0x47')](_0x9cefa5)[_0x1dec('0x23')](handleEntityNotFound(_0x4ce814,null))[_0x1dec('0x23')](function(_0x54ea66){if(_0x54ea66){var _0x4d3b60=_0x54ea66[_0x1dec('0x45')]({'plain':!![]});_0x4d3b60=qs[_0x1dec('0x4d')](_0x4d3b60,['id',_0x1dec('0x4e'),'updatedAt']);_0x5e3b6f[_0x1dec('0x4f')]=_[_0x1dec('0x4d')](_0x5e3b6f['body'],['id','createdAt',_0x1dec('0x50')]);return db[_0x1dec('0x2a')][_0x1dec('0x44')](_[_0x1dec('0x39')](_0x4d3b60,_0x5e3b6f[_0x1dec('0x4f')]),{'include':_0x5e3b6f[_0x1dec('0x2e')][_0x1dec('0x3d')]?[{'all':!![]}]:undefined})[_0x1dec('0x23')](function(_0x4c5911){var _0x5a48c2=_0x5e3b6f[_0x1dec('0x51')][_0x1dec('0x45')]({'plain':!![]});if(!_0x5a48c2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a48c2[_0x1dec('0x46')]===_0x1dec('0x51')){var _0x4f7009=_0x4c5911[_0x1dec('0x45')]({'plain':!![]});var _0x1a8f9e='CustomDashboards';return db[_0x1dec('0x52')][_0x1dec('0x47')]({'where':{'name':_0x1a8f9e,'userProfileId':_0x5a48c2[_0x1dec('0x53')]},'raw':!![]})[_0x1dec('0x23')](function(_0x530d54){if(_0x530d54&&_0x530d54[_0x1dec('0x48')]===0x0){return db['UserProfileResource'][_0x1dec('0x44')]({'name':_0x4f7009[_0x1dec('0x26')],'resourceId':_0x4f7009['id'],'type':_0x530d54['name'],'sectionId':_0x530d54['id']},{})[_0x1dec('0x23')](function(){return _0x4c5911;});}else{return _0x4c5911;}})[_0x1dec('0x40')](function(_0x123179){logger['error'](_0x1dec('0x4b'),_0x123179);throw _0x123179;});}return _0x4c5911;});}})['then'](respondWithResult(_0x4ce814,0xc9))[_0x1dec('0x40')](handleError(_0x4ce814,null));};exports['update']=function(_0x5eadb0,_0x1ba217){if(_0x5eadb0[_0x1dec('0x4f')]['id']){delete _0x5eadb0[_0x1dec('0x4f')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x5eadb0['params']['id']}})['then'](handleEntityNotFound(_0x1ba217,null))['then'](saveUpdates(_0x5eadb0['body'],null))['then'](respondWithResult(_0x1ba217,null))['catch'](handleError(_0x1ba217,null));};exports[_0x1dec('0x24')]=function(_0x12b0d2,_0x148125){return db[_0x1dec('0x2a')][_0x1dec('0x47')]({'where':{'id':_0x12b0d2[_0x1dec('0x41')]['id']}})['then'](handleEntityNotFound(_0x148125,null))[_0x1dec('0x23')](removeEntity(_0x148125,null))[_0x1dec('0x40')](handleError(_0x148125,null));};function widgetAttributes(_0x55dd31){try{switch(_0x55dd31[_0x1dec('0x3a')]){case _0x1dec('0x54'):return[{'name':_0x1dec('0x55'),'value':_0x55dd31['attrUrl']||(_0x55dd31[_0x1dec('0x56')]&&_0x55dd31['attrs'][0x0]?_0x55dd31[_0x1dec('0x56')][0x0][_0x1dec('0x57')]:undefined)||'https://'}];case'custom':return[{'name':'attrPath','value':_0x55dd31[_0x1dec('0x58')]||(_0x55dd31[_0x1dec('0x56')]&&_0x55dd31[_0x1dec('0x56')][0x0]?_0x55dd31[_0x1dec('0x56')][0x0][_0x1dec('0x57')]:undefined)||''}];case'clock':return[{'name':_0x1dec('0x59'),'value':_0x55dd31[_0x1dec('0x59')]||(_0x55dd31['attrs']&&_0x55dd31[_0x1dec('0x56')][0x0]?_0x55dd31[_0x1dec('0x56')][0x0][_0x1dec('0x57')]:undefined)||_0x1dec('0x5a')},{'name':'attrTimezone','value':_0x55dd31[_0x1dec('0x5b')]||(_0x55dd31[_0x1dec('0x56')]&&_0x55dd31['attrs'][0x1]?_0x55dd31[_0x1dec('0x56')][0x1][_0x1dec('0x57')]:undefined)||_0x1dec('0x5c')},{'name':'attrFontSize','value':_0x55dd31['attrFontSize']||(_0x55dd31[_0x1dec('0x56')]&&_0x55dd31[_0x1dec('0x56')][0x2]?_0x55dd31[_0x1dec('0x56')][0x2][_0x1dec('0x57')]:undefined)||0xc}];case _0x1dec('0x5d'):return[{'name':_0x1dec('0x5e'),'value':_0x55dd31[_0x1dec('0x5e')]||(_0x55dd31[_0x1dec('0x56')]&&_0x55dd31[_0x1dec('0x56')][0x0]?_0x55dd31[_0x1dec('0x56')][0x0][_0x1dec('0x57')]:undefined)||_0x1dec('0x5f')},{'name':'attrVoiceQueues','value':_0x55dd31['attrVoiceQueues']||(_0x55dd31['attrs']&&_0x55dd31['attrs'][0x1]?_0x55dd31[_0x1dec('0x56')][0x1][_0x1dec('0x57')]:undefined)||[]},{'name':_0x1dec('0x60'),'value':_0x55dd31[_0x1dec('0x60')]||(_0x55dd31[_0x1dec('0x56')]&&_0x55dd31[_0x1dec('0x56')][0x2]?_0x55dd31[_0x1dec('0x56')][0x2]['value']:undefined)||0x14}];case _0x1dec('0x61'):case'pie-chart':return[{'name':_0x1dec('0x62'),'value':_0x55dd31[_0x1dec('0x62')]||(_0x55dd31[_0x1dec('0x56')]&&_0x55dd31[_0x1dec('0x56')][0x0]?_0x55dd31[_0x1dec('0x56')][0x0][_0x1dec('0x57')]:undefined)||'total'},{'name':_0x1dec('0x63'),'value':_0x55dd31[_0x1dec('0x63')]||(_0x55dd31[_0x1dec('0x56')]&&_0x55dd31['attrs'][0x1]?_0x55dd31['attrs'][0x1][_0x1dec('0x57')]:undefined)||null},{'name':_0x1dec('0x64'),'value':_0x55dd31['attrSerie3']||(_0x55dd31[_0x1dec('0x56')]&&_0x55dd31[_0x1dec('0x56')][0x2]?_0x55dd31['attrs'][0x2]['value']:undefined)||null},{'name':_0x1dec('0x65'),'value':_0x55dd31[_0x1dec('0x65')]||(_0x55dd31[_0x1dec('0x56')]&&_0x55dd31['attrs'][0x3]?_0x55dd31['attrs'][0x3][_0x1dec('0x57')]:undefined)||[]}];case _0x1dec('0x66'):return[{'name':_0x1dec('0x67'),'type':_0x55dd31[_0x1dec('0x68')]||(_0x55dd31[_0x1dec('0x56')]&&_0x55dd31[_0x1dec('0x56')][0x0]?_0x55dd31[_0x1dec('0x56')][0x0][_0x1dec('0x3a')]:undefined)||null,'value':_0x55dd31[_0x1dec('0x67')]||(_0x55dd31[_0x1dec('0x56')]&&_0x55dd31['attrs'][0x0]?_0x55dd31['attrs'][0x0][_0x1dec('0x57')]:undefined)||null},{'name':_0x1dec('0x69'),'value':_0x55dd31[_0x1dec('0x69')]||(_0x55dd31[_0x1dec('0x56')]&&_0x55dd31['attrs'][0x1]?_0x55dd31[_0x1dec('0x56')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x4cf9c5){logger[_0x1dec('0x4a')](_0x1dec('0x6a'),JSON[_0x1dec('0x6b')](_0x4cf9c5));return[];}}exports[_0x1dec('0x6c')]=function(_0x582d64,_0x468206,_0x7674c6){if(_0x582d64[_0x1dec('0x4f')]['id']){delete _0x582d64[_0x1dec('0x4f')]['id'];}return db[_0x1dec('0x2a')][_0x1dec('0x47')]({'where':{'id':_0x582d64['params']['id']}})[_0x1dec('0x23')](handleEntityNotFound(_0x468206,null))[_0x1dec('0x23')](function(_0x4ec6d5){if(_0x4ec6d5){_0x582d64['body'][_0x1dec('0x6d')]=_0x4ec6d5['id'];_0x582d64['body']['attrs']=widgetAttributes(_0x582d64[_0x1dec('0x4f')]);return db[_0x1dec('0x6e')][_0x1dec('0x44')](_0x582d64[_0x1dec('0x4f')]);}})['then'](respondWithResult(_0x468206,null))['catch'](handleError(_0x468206,null));};exports[_0x1dec('0x6f')]=function(_0x54d796,_0xb68f9d,_0x16f3c5){var _0x2b7039={};var _0x265a35={};var _0x4ac723;var _0x3e5525;return db[_0x1dec('0x2a')][_0x1dec('0x70')]({'where':{'id':_0x54d796[_0x1dec('0x41')]['id']}})[_0x1dec('0x23')](handleEntityNotFound(_0xb68f9d,null))[_0x1dec('0x23')](function(_0x116e00){if(_0x116e00){_0x4ac723=_0x116e00;_0x265a35[_0x1dec('0x2d')]=_['keys'](db[_0x1dec('0x6e')][_0x1dec('0x42')]);_0x265a35[_0x1dec('0x2e')]=_[_0x1dec('0x2f')](_0x54d796[_0x1dec('0x2e')]);_0x265a35[_0x1dec('0x30')]=_[_0x1dec('0x43')](_0x265a35[_0x1dec('0x2d')],_0x265a35[_0x1dec('0x2e')]);_0x2b7039['attributes']=_[_0x1dec('0x43')](_0x265a35[_0x1dec('0x2d')],qs[_0x1dec('0x32')](_0x54d796[_0x1dec('0x2e')][_0x1dec('0x32')]));_0x2b7039['attributes']=_0x2b7039[_0x1dec('0x31')][_0x1dec('0x33')]?_0x2b7039['attributes']:_0x265a35[_0x1dec('0x2d')];_0x2b7039['order']=qs[_0x1dec('0x36')](_0x54d796[_0x1dec('0x2e')][_0x1dec('0x36')]);_0x2b7039['where']=qs['filters'](_[_0x1dec('0x71')](_0x54d796[_0x1dec('0x2e')],_0x265a35[_0x1dec('0x30')]));if(_0x54d796['query']['filter']){_0x2b7039[_0x1dec('0x37')]=_[_0x1dec('0x39')](_0x2b7039[_0x1dec('0x37')],{'$or':_['map'](_0x2b7039[_0x1dec('0x31')],function(_0x5c5728){var _0x372ad8={};_0x372ad8[_0x5c5728]={'$like':'%'+_0x54d796[_0x1dec('0x2e')][_0x1dec('0x38')]+'%'};return _0x372ad8;})});}_0x2b7039=_['merge']({},_0x2b7039,_0x54d796['options']);return _0x4ac723[_0x1dec('0x6f')](_0x2b7039);}})[_0x1dec('0x23')](function(_0x335d66){if(_0x335d66){_0x3e5525=_0x335d66['length'];if(!_0x54d796[_0x1dec('0x2e')][_0x1dec('0x34')]('nolimit')){_0x2b7039[_0x1dec('0x1d')]=qs['limit'](_0x54d796[_0x1dec('0x2e')]['limit']);_0x2b7039[_0x1dec('0x1c')]=qs[_0x1dec('0x1c')](_0x54d796[_0x1dec('0x2e')][_0x1dec('0x1c')]);}return _0x4ac723['getItems'](_0x2b7039);}})['then'](function(_0x124e0b){if(_0x124e0b){return _0x124e0b?{'count':_0x3e5525,'rows':_0x124e0b}:null;}})[_0x1dec('0x23')](respondWithResult(_0xb68f9d,null))[_0x1dec('0x40')](handleError(_0xb68f9d,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index c180f6f..1309297 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 _0x89b8=['exports','events','../../mysqldb','Dashboard','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x5070a4,_0x1db896){var _0x179668=function(_0x43b757){while(--_0x43b757){_0x5070a4['push'](_0x5070a4['shift']());}};_0x179668(++_0x1db896);}(_0x89b8,0x19f));var _0x889b=function(_0x5434b7,_0x5bc54f){_0x5434b7=_0x5434b7-0x0;var _0x20d73d=_0x89b8[_0x5434b7];return _0x20d73d;};'use strict';var EventEmitter=require(_0x889b('0x0'));var Dashboard=require(_0x889b('0x1'))['db'][_0x889b('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x889b('0x3')](0x0);var events={'afterCreate':_0x889b('0x4'),'afterUpdate':_0x889b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x383d3c){return function(_0x1d4725,_0x3db972,_0x58ae50){DashboardEvents[_0x889b('0x6')](_0x383d3c+':'+_0x1d4725['id'],_0x1d4725);DashboardEvents[_0x889b('0x6')](_0x383d3c,_0x1d4725);_0x58ae50(null);};}for(var e in events){if(events[_0x889b('0x7')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x889b('0x8')]=DashboardEvents; \ No newline at end of file +var _0x7601=['Dashboard','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x2dc069,_0x9fe901){var _0x24a59d=function(_0x155a5f){while(--_0x155a5f){_0x2dc069['push'](_0x2dc069['shift']());}};_0x24a59d(++_0x9fe901);}(_0x7601,0x1d3));var _0x1760=function(_0x588fb7,_0x16c606){_0x588fb7=_0x588fb7-0x0;var _0x538362=_0x7601[_0x588fb7];return _0x538362;};'use strict';var EventEmitter=require(_0x1760('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x1760('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x1760('0x2')](0x0);var events={'afterCreate':_0x1760('0x3'),'afterUpdate':_0x1760('0x4'),'afterDestroy':_0x1760('0x5')};function emitEvent(_0x487ca3){return function(_0x468533,_0x428689,_0x299388){DashboardEvents[_0x1760('0x6')](_0x487ca3+':'+_0x468533['id'],_0x468533);DashboardEvents['emit'](_0x487ca3,_0x468533);_0x299388(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x1760('0x7')](e,emitEvent(event));}}module[_0x1760('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index c804a7a..73970d1 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 _0xbfa1=['lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','define','dashboards'];(function(_0x300ee2,_0x2e7a20){var _0x44d6a3=function(_0xd611a2){while(--_0xd611a2){_0x300ee2['push'](_0x300ee2['shift']());}};_0x44d6a3(++_0x2e7a20);}(_0xbfa1,0x140));var _0x1bfa=function(_0x9a9dc2,_0x2f22d4){_0x9a9dc2=_0x9a9dc2-0x0;var _0x41afe8=_0xbfa1[_0x9a9dc2];return _0x41afe8;};'use strict';var _=require(_0x1bfa('0x0'));var util=require('util');var logger=require(_0x1bfa('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1bfa('0x2'));var rp=require(_0x1bfa('0x3'));var fs=require('fs');var path=require(_0x1bfa('0x4'));var rimraf=require(_0x1bfa('0x5'));var config=require(_0x1bfa('0x6'));var attributes=require(_0x1bfa('0x7'));module['exports']=function(_0x78cdc,_0x93d58d){return _0x78cdc[_0x1bfa('0x8')]('Dashboard',attributes,{'tableName':_0x1bfa('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafbd=['path','rimraf','./dashboard.attributes','Dashboard','lodash','../../config/logger','api','moment','bluebird'];(function(_0x4189e7,_0x30e706){var _0x3a8a4e=function(_0x485fe8){while(--_0x485fe8){_0x4189e7['push'](_0x4189e7['shift']());}};_0x3a8a4e(++_0x30e706);}(_0xafbd,0x1ab));var _0xdafb=function(_0x2272b5,_0x362458){_0x2272b5=_0x2272b5-0x0;var _0x110156=_0xafbd[_0x2272b5];return _0x110156;};'use strict';var _=require(_0xdafb('0x0'));var util=require('util');var logger=require(_0xdafb('0x1'))(_0xdafb('0x2'));var moment=require(_0xdafb('0x3'));var BPromise=require(_0xdafb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdafb('0x5'));var rimraf=require(_0xdafb('0x6'));var config=require('../../config/environment');var attributes=require(_0xdafb('0x7'));module['exports']=function(_0xf40655,_0x2b0b75){return _0xf40655['define'](_0xdafb('0x8'),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 9f4c8e9..f7b3212 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 _0xc818=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s'];(function(_0x5826ef,_0x23018f){var _0x5af785=function(_0x40c321){while(--_0x40c321){_0x5826ef['push'](_0x5826ef['shift']());}};_0x5af785(++_0x23018f);}(_0xc818,0xe6));var _0x8c81=function(_0x51d09c,_0x3b2caf){_0x51d09c=_0x51d09c-0x0;var _0x18bb06=_0xc818[_0x51d09c];return _0x18bb06;};'use strict';var _=require(_0x8c81('0x0'));var util=require(_0x8c81('0x1'));var moment=require(_0x8c81('0x2'));var BPromise=require(_0x8c81('0x3'));var rs=require(_0x8c81('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c81('0x5'))['db'];var utils=require(_0x8c81('0x6'));var logger=require(_0x8c81('0x7'))(_0x8c81('0x8'));var config=require(_0x8c81('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8c81('0xa')]({'port':0x232a});config[_0x8c81('0xb')]=_[_0x8c81('0xc')](config[_0x8c81('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8c81('0xd'))(new Redis(config['redis']));require(_0x8c81('0xe'))[_0x8c81('0xf')](socket);function respondWithRpcPromise(_0x7bdab5,_0x2fd0a3,_0xef8209){return new BPromise(function(_0x5b31b3,_0x131968){return client[_0x8c81('0x10')](_0x7bdab5,_0xef8209)[_0x8c81('0x11')](function(_0x3aff47){logger[_0x8c81('0x12')](_0x8c81('0x13'),_0x2fd0a3,_0x8c81('0x14'));logger['debug'](_0x8c81('0x15'),_0x2fd0a3,_0x8c81('0x14'),JSON[_0x8c81('0x16')](_0x3aff47));if(_0x3aff47[_0x8c81('0x17')]){if(_0x3aff47[_0x8c81('0x17')][_0x8c81('0x18')]===0x1f4){logger['error'](_0x8c81('0x13'),_0x2fd0a3,_0x3aff47[_0x8c81('0x17')][_0x8c81('0x19')]);return _0x131968(_0x3aff47[_0x8c81('0x17')][_0x8c81('0x19')]);}logger['error'](_0x8c81('0x13'),_0x2fd0a3,_0x3aff47[_0x8c81('0x17')]['message']);return _0x5b31b3(_0x3aff47[_0x8c81('0x17')][_0x8c81('0x19')]);}else{logger['info'](_0x8c81('0x13'),_0x2fd0a3,_0x8c81('0x14'));_0x5b31b3(_0x3aff47[_0x8c81('0x1a')][_0x8c81('0x19')]);}})[_0x8c81('0x1b')](function(_0x2cd89a){logger['error'](_0x8c81('0x13'),_0x2fd0a3,_0x2cd89a);_0x131968(_0x2cd89a);});});} \ No newline at end of file +var _0xce63=['stringify','error','code','message','info','catch','lodash','util','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','./dashboard.socket','register','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xce63,0x186));var _0x3ce6=function(_0x2b49bc,_0x47b636){_0x2b49bc=_0x2b49bc-0x0;var _0x43cc65=_0xce63[_0x2b49bc];return _0x43cc65;};'use strict';var _=require(_0x3ce6('0x0'));var util=require(_0x3ce6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3ce6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3ce6('0x3'));var logger=require(_0x3ce6('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3ce6('0x5'));var client=jayson[_0x3ce6('0x6')][_0x3ce6('0x7')]({'port':0x232a});config[_0x3ce6('0x8')]=_[_0x3ce6('0x9')](config[_0x3ce6('0x8')],{'host':_0x3ce6('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3ce6('0x8')]));require(_0x3ce6('0xb'))[_0x3ce6('0xc')](socket);function respondWithRpcPromise(_0x174b2e,_0x4afee9,_0x2d559d){return new BPromise(function(_0x43feb2,_0x3cb217){return client[_0x3ce6('0xd')](_0x174b2e,_0x2d559d)[_0x3ce6('0xe')](function(_0x7c4305){logger['info'](_0x3ce6('0xf'),_0x4afee9,_0x3ce6('0x10'));logger[_0x3ce6('0x11')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x4afee9,_0x3ce6('0x10'),JSON[_0x3ce6('0x12')](_0x7c4305));if(_0x7c4305[_0x3ce6('0x13')]){if(_0x7c4305[_0x3ce6('0x13')][_0x3ce6('0x14')]===0x1f4){logger[_0x3ce6('0x13')]('Dashboard,\x20%s,\x20%s',_0x4afee9,_0x7c4305[_0x3ce6('0x13')]['message']);return _0x3cb217(_0x7c4305['error'][_0x3ce6('0x15')]);}logger[_0x3ce6('0x13')](_0x3ce6('0xf'),_0x4afee9,_0x7c4305['error'][_0x3ce6('0x15')]);return _0x43feb2(_0x7c4305[_0x3ce6('0x13')][_0x3ce6('0x15')]);}else{logger[_0x3ce6('0x16')](_0x3ce6('0xf'),_0x4afee9,'request\x20sent');_0x43feb2(_0x7c4305['result'][_0x3ce6('0x15')]);}})[_0x3ce6('0x17')](function(_0x3ba6c9){logger[_0x3ce6('0x13')]('Dashboard,\x20%s,\x20%s',_0x4afee9,_0x3ba6c9);_0x3cb217(_0x3ba6c9);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 53a3f32..e47e96a 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 _0xee72=['register','./dashboard.events','save','remove','emit'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xee72,0x10f));var _0x2ee7=function(_0x379304,_0x3d02fd){_0x379304=_0x379304-0x0;var _0x5b0779=_0xee72[_0x379304];return _0x5b0779;};'use strict';var DashboardEvents=require(_0x2ee7('0x0'));var events=[_0x2ee7('0x1'),_0x2ee7('0x2'),'update'];function createListener(_0x26e661,_0x388c1c){return function(_0x1e7eb7){_0x388c1c[_0x2ee7('0x3')](_0x26e661,_0x1e7eb7);};}function removeListener(_0xb1187b,_0x4b9933){return function(){DashboardEvents['removeListener'](_0xb1187b,_0x4b9933);};}exports[_0x2ee7('0x4')]=function(_0x58cf29){for(var _0x238012=0x0,_0xba270e=events['length'];_0x238012<_0xba270e;_0x238012++){var _0x577d75=events[_0x238012];var _0x2b4b36=createListener('dashboard:'+_0x577d75,_0x58cf29);DashboardEvents['on'](_0x577d75,_0x2b4b36);}}; \ No newline at end of file +var _0xdbb3=['update','emit','removeListener','register','dashboard:','./dashboard.events','save','remove'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xdbb3,0x105));var _0x3dbb=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xdbb3[_0x3e112d];return _0x531c31;};'use strict';var DashboardEvents=require(_0x3dbb('0x0'));var events=[_0x3dbb('0x1'),_0x3dbb('0x2'),_0x3dbb('0x3')];function createListener(_0x57ff4c,_0x2494be){return function(_0x424111){_0x2494be[_0x3dbb('0x4')](_0x57ff4c,_0x424111);};}function removeListener(_0x5e4c21,_0x51ec87){return function(){DashboardEvents[_0x3dbb('0x5')](_0x5e4c21,_0x51ec87);};}exports[_0x3dbb('0x6')]=function(_0x1dd56f){for(var _0x147515=0x0,_0x29b93b=events['length'];_0x147515<_0x29b93b;_0x147515++){var _0x1a048f=events[_0x147515];var _0x42f050=createListener(_0x3dbb('0x7')+_0x1a048f,_0x1dd56f);DashboardEvents['on'](_0x1a048f,_0x42f050);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 80632a2..8dc44c9 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 _0x1198=['express','fs-extra','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','create','post','/:id/clone','clone','put','delete','destroy','exports'];(function(_0x3cfb3c,_0x8b172){var _0x5c3d52=function(_0x26b7c4){while(--_0x26b7c4){_0x3cfb3c['push'](_0x3cfb3c['shift']());}};_0x5c3d52(++_0x8b172);}(_0x1198,0xab));var _0x8119=function(_0x5732e7,_0x409a47){_0x5732e7=_0x5732e7-0x0;var _0x44736e=_0x1198[_0x5732e7];return _0x44736e;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8119('0x0'));var router=express['Router']();var fs_extra=require(_0x8119('0x1'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8119('0x2'));var controller=require(_0x8119('0x3'));router[_0x8119('0x4')]('/',auth[_0x8119('0x5')](),controller[_0x8119('0x6')]);router['get'](_0x8119('0x7'),auth[_0x8119('0x5')](),controller[_0x8119('0x8')]);router[_0x8119('0x4')](_0x8119('0x9'),auth[_0x8119('0x5')](),controller[_0x8119('0xa')]);router['post']('/',auth[_0x8119('0x5')](),controller[_0x8119('0xb')]);router[_0x8119('0xc')](_0x8119('0xd'),auth[_0x8119('0x5')](),controller[_0x8119('0xe')]);router[_0x8119('0xc')](_0x8119('0x9'),auth[_0x8119('0x5')](),controller['addItem']);router[_0x8119('0xf')](_0x8119('0x7'),auth[_0x8119('0x5')](),controller['update']);router[_0x8119('0x10')]('/:id',auth[_0x8119('0x5')](),controller[_0x8119('0x11')]);module[_0x8119('0x12')]=router; \ No newline at end of file +var _0x8202=['addItem','put','/:id','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','show','get','/:id/items','getItems','post','create','/:id/clone','clone'];(function(_0x261d0e,_0x15cba4){var _0x35dd15=function(_0x359a13){while(--_0x359a13){_0x261d0e['push'](_0x261d0e['shift']());}};_0x35dd15(++_0x15cba4);}(_0x8202,0x103));var _0x2820=function(_0x4741bf,_0x4ab337){_0x4741bf=_0x4741bf-0x0;var _0x42a8cc=_0x8202[_0x4741bf];return _0x42a8cc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2820('0x0'));var timeout=require(_0x2820('0x1'));var express=require(_0x2820('0x2'));var router=express[_0x2820('0x3')]();var fs_extra=require(_0x2820('0x4'));var auth=require(_0x2820('0x5'));var interaction=require(_0x2820('0x6'));var config=require('../../config/environment');var controller=require('./dashboard.controller');router['get']('/',auth[_0x2820('0x7')](),controller[_0x2820('0x8')]);router['get']('/:id',auth[_0x2820('0x7')](),controller[_0x2820('0x9')]);router[_0x2820('0xa')](_0x2820('0xb'),auth[_0x2820('0x7')](),controller[_0x2820('0xc')]);router[_0x2820('0xd')]('/',auth[_0x2820('0x7')](),controller[_0x2820('0xe')]);router[_0x2820('0xd')](_0x2820('0xf'),auth[_0x2820('0x7')](),controller[_0x2820('0x10')]);router[_0x2820('0xd')](_0x2820('0xb'),auth[_0x2820('0x7')](),controller[_0x2820('0x11')]);router[_0x2820('0x12')](_0x2820('0x13'),auth[_0x2820('0x7')](),controller[_0x2820('0x14')]);router[_0x2820('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x2820('0x16')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index bf14e4b..875c38b 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 _0xb4c7=['TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x3e9b53,_0x2beece){_0x3e9b53=_0x3e9b53-0x0;var _0x98c507=_0xb4c7[_0x3e9b53];return _0x98c507;};'use strict';var Sequelize=require(_0x7b4c('0x0'));var squel=require(_0x7b4c('0x1'));var _=require(_0x7b4c('0x2'));module[_0x7b4c('0x3')]={'title':{'type':Sequelize[_0x7b4c('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x7b4c('0x5')](_0x7b4c('0x6')),'get':function(){try{return JSON[_0x7b4c('0x7')](this[_0x7b4c('0x8')](_0x7b4c('0x9')));}catch(_0x5adec9){return[];}},'set':function(_0x1b0f57){try{this[_0x7b4c('0xa')](_0x7b4c('0x9'),JSON['stringify'](_0x1b0f57));}catch(_0x2d7b7e){this[_0x7b4c('0xa')]('attrs',JSON[_0x7b4c('0xb')]([]));}}},'sizeX':{'type':Sequelize[_0x7b4c('0xc')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x7b4c('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x7b4c('0xc')]},'col':{'type':Sequelize[_0x7b4c('0xc')]},'background':{'type':Sequelize[_0x7b4c('0x4')],'allowNull':![],'defaultValue':_0x7b4c('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x7b4c('0x4')],'allowNull':![],'defaultValue':_0x7b4c('0xe'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x7b4c('0x4')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0xc1c6=['long','parse','setDataValue','stringify','attrs','INTEGER','#ffffff','sequelize','squel','lodash','STRING','TEXT'];(function(_0x522f2d,_0x5a73a9){var _0x100e6e=function(_0x5f33cb){while(--_0x5f33cb){_0x522f2d['push'](_0x522f2d['shift']());}};_0x100e6e(++_0x5a73a9);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x3cb351,_0x5306f3){_0x3cb351=_0x3cb351-0x0;var _0xdd1b65=_0xc1c6[_0x3cb351];return _0xdd1b65;};'use strict';var Sequelize=require(_0x6c1c('0x0'));var squel=require(_0x6c1c('0x1'));var _=require(_0x6c1c('0x2'));module['exports']={'title':{'type':Sequelize[_0x6c1c('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x6c1c('0x4')](_0x6c1c('0x5')),'get':function(){try{return JSON[_0x6c1c('0x6')](this['getDataValue']('attrs'));}catch(_0x32af84){return[];}},'set':function(_0x524a6b){try{this[_0x6c1c('0x7')]('attrs',JSON[_0x6c1c('0x8')](_0x524a6b));}catch(_0x2eb1ba){this[_0x6c1c('0x7')](_0x6c1c('0x9'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x6c1c('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x6c1c('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x6c1c('0xa')]},'background':{'type':Sequelize[_0x6c1c('0x3')],'allowNull':![],'defaultValue':_0x6c1c('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x6c1c('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x6c1c('0x3')]},'titleFontSize':{'type':Sequelize[_0x6c1c('0xa')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index e0d2c7a..d7ef0bf 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 _0xbb50=['clock','attrHourFormat','value','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','body','create','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','show','model','keys','DashboardItem','rawAttributes','query','attributes','intersection','fields','length','includeAll','include','merge','options','find','params','type','attrUrl','attrs','https://','custom','attrPath'];(function(_0x3ae1c3,_0x1ee680){var _0x55c54f=function(_0x1b0c87){while(--_0x1b0c87){_0x3ae1c3['push'](_0x3ae1c3['shift']());}};_0x55c54f(++_0x1ee680);}(_0xbb50,0x1d8));var _0x0bb5=function(_0x2cd17f,_0x3e9c94){_0x2cd17f=_0x2cd17f-0x0;var _0x5bab50=_0xbb50[_0x2cd17f];return _0x5bab50;};'use strict';var emlformat=require(_0x0bb5('0x0'));var rimraf=require(_0x0bb5('0x1'));var zipdir=require(_0x0bb5('0x2'));var jsonpatch=require(_0x0bb5('0x3'));var rp=require(_0x0bb5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0bb5('0x5'));var util=require(_0x0bb5('0x6'));var path=require('path');var sox=require(_0x0bb5('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0bb5('0x8'));var _=require(_0x0bb5('0x9'));var squel=require(_0x0bb5('0xa'));var crypto=require(_0x0bb5('0xb'));var jsforce=require(_0x0bb5('0xc'));var deskjs=require(_0x0bb5('0xd'));var toCsv=require(_0x0bb5('0xe'));var querystring=require(_0x0bb5('0xf'));var Papa=require(_0x0bb5('0x10'));var Redis=require('ioredis');var authService=require(_0x0bb5('0x11'));var qs=require(_0x0bb5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0bb5('0x13'));var logger=require(_0x0bb5('0x14'))(_0x0bb5('0x15'));var utils=require(_0x0bb5('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0bb5('0x17'));var db=require(_0x0bb5('0x18'))['db'];config[_0x0bb5('0x19')]=_['defaults'](config[_0x0bb5('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x0bb5('0x1a'))(new Redis(config['redis']));require(_0x0bb5('0x1b'))[_0x0bb5('0x1c')](socket);function respondWithStatusCode(_0x1f24e0,_0x1453b0){_0x1453b0=_0x1453b0||0xcc;return function(_0x45e24b){if(_0x45e24b){return _0x1f24e0[_0x0bb5('0x1d')](_0x1453b0);}return _0x1f24e0[_0x0bb5('0x1e')](_0x1453b0)['end']();};}function respondWithResult(_0x541142,_0x5bc5b6){_0x5bc5b6=_0x5bc5b6||0xc8;return function(_0x40ca66){if(_0x40ca66){return _0x541142[_0x0bb5('0x1e')](_0x5bc5b6)['json'](_0x40ca66);}};}function respondWithFilteredResult(_0xd99b00,_0x4dfc1e){return function(_0x2bd3b6){if(_0x2bd3b6){var _0x39dc04=typeof _0x4dfc1e[_0x0bb5('0x1f')]===_0x0bb5('0x20')&&typeof _0x4dfc1e[_0x0bb5('0x21')]===_0x0bb5('0x20');var _0x156801=_0x2bd3b6[_0x0bb5('0x22')];var _0x491678=_0x39dc04?0x0:_0x4dfc1e[_0x0bb5('0x1f')];var _0xfd98d2=_0x39dc04?_0x2bd3b6[_0x0bb5('0x22')]:_0x4dfc1e['offset']+_0x4dfc1e[_0x0bb5('0x21')];var _0x4ae974;if(_0xfd98d2>=_0x156801){_0xfd98d2=_0x156801;_0x4ae974=0xc8;}else{_0x4ae974=0xce;}_0xd99b00[_0x0bb5('0x1e')](_0x4ae974);return _0xd99b00[_0x0bb5('0x23')](_0x0bb5('0x24'),_0x491678+'-'+_0xfd98d2+'/'+_0x156801)['json'](_0x2bd3b6);}return null;};}function patchUpdates(_0x25502a){return function(_0x1dc366){try{jsonpatch[_0x0bb5('0x25')](_0x1dc366,_0x25502a,!![]);}catch(_0x575952){return BPromise[_0x0bb5('0x26')](_0x575952);}return _0x1dc366['save']();};}function saveUpdates(_0xad2b43,_0x4367a6){return function(_0x282322){if(_0x282322){return _0x282322[_0x0bb5('0x27')](_0xad2b43)[_0x0bb5('0x28')](function(_0x330859){return _0x330859;});}return null;};}function removeEntity(_0x12ddb3,_0x4c0d57){return function(_0x3d2ac5){if(_0x3d2ac5){return _0x3d2ac5[_0x0bb5('0x29')]()[_0x0bb5('0x28')](function(){_0x12ddb3[_0x0bb5('0x1e')](0xcc)[_0x0bb5('0x2a')]();});}};}function handleEntityNotFound(_0x4ed0b8,_0x1df3ac){return function(_0x4d4cbf){if(!_0x4d4cbf){_0x4ed0b8['sendStatus'](0x194);}return _0x4d4cbf;};}function handleError(_0x303d85,_0x39d815){_0x39d815=_0x39d815||0x1f4;return function(_0x4b0a12){logger[_0x0bb5('0x2b')](_0x4b0a12[_0x0bb5('0x2c')]);if(_0x4b0a12[_0x0bb5('0x2d')]){delete _0x4b0a12[_0x0bb5('0x2d')];}_0x303d85[_0x0bb5('0x1e')](_0x39d815)['send'](_0x4b0a12);};}exports[_0x0bb5('0x2e')]=function(_0x20715e,_0x509465){var _0x5e2ae3={'raw':![],'where':{'id':_0x20715e['params']['id']}},_0x56baa5={};_0x56baa5[_0x0bb5('0x2f')]=_[_0x0bb5('0x30')](db[_0x0bb5('0x31')][_0x0bb5('0x32')]);_0x56baa5[_0x0bb5('0x33')]=_['keys'](_0x20715e[_0x0bb5('0x33')]);_0x56baa5['filters']=_['intersection'](_0x56baa5['model'],_0x56baa5['query']);_0x5e2ae3[_0x0bb5('0x34')]=_[_0x0bb5('0x35')](_0x56baa5[_0x0bb5('0x2f')],qs[_0x0bb5('0x36')](_0x20715e[_0x0bb5('0x33')][_0x0bb5('0x36')]));_0x5e2ae3['attributes']=_0x5e2ae3['attributes'][_0x0bb5('0x37')]?_0x5e2ae3[_0x0bb5('0x34')]:_0x56baa5['model'];if(_0x20715e[_0x0bb5('0x33')][_0x0bb5('0x38')]){_0x5e2ae3[_0x0bb5('0x39')]=[{'all':!![]}];}_0x5e2ae3=_[_0x0bb5('0x3a')]({},_0x5e2ae3,_0x20715e[_0x0bb5('0x3b')]);return db[_0x0bb5('0x31')]['find'](_0x5e2ae3)[_0x0bb5('0x28')](handleEntityNotFound(_0x509465,null))['then'](respondWithResult(_0x509465,null))['catch'](handleError(_0x509465,null));};exports[_0x0bb5('0x29')]=function(_0x5ec348,_0x1214ba){return db['DashboardItem'][_0x0bb5('0x3c')]({'where':{'id':_0x5ec348[_0x0bb5('0x3d')]['id']}})['then'](handleEntityNotFound(_0x1214ba,null))[_0x0bb5('0x28')](removeEntity(_0x1214ba,null))['catch'](handleError(_0x1214ba,null));};function widgetAttributes(_0x1c83b7){try{switch(_0x1c83b7[_0x0bb5('0x3e')]){case'iframe':return[{'name':_0x0bb5('0x3f'),'value':_0x1c83b7[_0x0bb5('0x3f')]||(_0x1c83b7[_0x0bb5('0x40')]&&_0x1c83b7[_0x0bb5('0x40')][0x0]?_0x1c83b7[_0x0bb5('0x40')][0x0]['value']:undefined)||_0x0bb5('0x41')}];case _0x0bb5('0x42'):return[{'name':_0x0bb5('0x43'),'value':_0x1c83b7[_0x0bb5('0x43')]||(_0x1c83b7[_0x0bb5('0x40')]&&_0x1c83b7['attrs'][0x0]?_0x1c83b7[_0x0bb5('0x40')][0x0]['value']:undefined)||''}];case _0x0bb5('0x44'):return[{'name':_0x0bb5('0x45'),'value':_0x1c83b7[_0x0bb5('0x45')]||(_0x1c83b7[_0x0bb5('0x40')]&&_0x1c83b7['attrs'][0x0]?_0x1c83b7[_0x0bb5('0x40')][0x0][_0x0bb5('0x46')]:undefined)||'HH:mm:ss'},{'name':_0x0bb5('0x47'),'value':_0x1c83b7[_0x0bb5('0x47')]||(_0x1c83b7[_0x0bb5('0x40')]&&_0x1c83b7[_0x0bb5('0x40')][0x1]?_0x1c83b7[_0x0bb5('0x40')][0x1][_0x0bb5('0x46')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x1c83b7[_0x0bb5('0x48')]||(_0x1c83b7[_0x0bb5('0x40')]&&_0x1c83b7[_0x0bb5('0x40')][0x2]?_0x1c83b7['attrs'][0x2]['value']:undefined)||0xc}];case _0x0bb5('0x49'):return[{'name':_0x0bb5('0x4a'),'value':_0x1c83b7[_0x0bb5('0x4a')]||(_0x1c83b7[_0x0bb5('0x40')]&&_0x1c83b7[_0x0bb5('0x40')][0x0]?_0x1c83b7[_0x0bb5('0x40')][0x0]['value']:undefined)||_0x0bb5('0x4b')},{'name':_0x0bb5('0x4c'),'value':_0x1c83b7['attrVoiceQueues']||(_0x1c83b7[_0x0bb5('0x40')]&&_0x1c83b7[_0x0bb5('0x40')][0x1]?_0x1c83b7['attrs'][0x1][_0x0bb5('0x46')]:undefined)||[]},{'name':_0x0bb5('0x48'),'value':_0x1c83b7['attrFontSize']||(_0x1c83b7[_0x0bb5('0x40')]&&_0x1c83b7[_0x0bb5('0x40')][0x2]?_0x1c83b7['attrs'][0x2][_0x0bb5('0x46')]:undefined)||0x14}];case _0x0bb5('0x4d'):case'pie-chart':return[{'name':_0x0bb5('0x4e'),'value':_0x1c83b7[_0x0bb5('0x4e')]||(_0x1c83b7[_0x0bb5('0x40')]&&_0x1c83b7[_0x0bb5('0x40')][0x0]?_0x1c83b7['attrs'][0x0][_0x0bb5('0x46')]:undefined)||'total'},{'name':_0x0bb5('0x4f'),'value':_0x1c83b7[_0x0bb5('0x4f')]||(_0x1c83b7['attrs']&&_0x1c83b7[_0x0bb5('0x40')][0x1]?_0x1c83b7['attrs'][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x1c83b7[_0x0bb5('0x50')]||(_0x1c83b7[_0x0bb5('0x40')]&&_0x1c83b7['attrs'][0x2]?_0x1c83b7[_0x0bb5('0x40')][0x2][_0x0bb5('0x46')]:undefined)||null},{'name':_0x0bb5('0x4c'),'value':_0x1c83b7['attrVoiceQueues']||(_0x1c83b7['attrs']&&_0x1c83b7['attrs'][0x3]?_0x1c83b7[_0x0bb5('0x40')][0x3][_0x0bb5('0x46')]:undefined)||[]}];case _0x0bb5('0x51'):return[{'name':_0x0bb5('0x52'),'type':_0x1c83b7[_0x0bb5('0x53')]||(_0x1c83b7[_0x0bb5('0x40')]&&_0x1c83b7[_0x0bb5('0x40')][0x0]?_0x1c83b7[_0x0bb5('0x40')][0x0][_0x0bb5('0x3e')]:undefined)||null,'value':_0x1c83b7[_0x0bb5('0x52')]||(_0x1c83b7[_0x0bb5('0x40')]&&_0x1c83b7[_0x0bb5('0x40')][0x0]?_0x1c83b7[_0x0bb5('0x40')][0x0][_0x0bb5('0x46')]:undefined)||null},{'name':_0x0bb5('0x54'),'value':_0x1c83b7[_0x0bb5('0x54')]||(_0x1c83b7['attrs']&&_0x1c83b7[_0x0bb5('0x40')][0x1]?_0x1c83b7[_0x0bb5('0x40')][0x1][_0x0bb5('0x46')]:undefined)||0x0}];default:return[];}}catch(_0x25ec7d){logger[_0x0bb5('0x2b')](_0x0bb5('0x55'),JSON[_0x0bb5('0x56')](_0x25ec7d));return[];}}exports['create']=function(_0x429360,_0x1346de){if(_0x429360[_0x0bb5('0x57')]){_0x429360[_0x0bb5('0x57')][_0x0bb5('0x40')]=widgetAttributes(_0x429360[_0x0bb5('0x57')]);}return db[_0x0bb5('0x31')][_0x0bb5('0x58')](_0x429360['body'],{})['then'](respondWithResult(_0x1346de,0xc9))[_0x0bb5('0x59')](handleError(_0x1346de,null));};exports[_0x0bb5('0x27')]=function(_0x471336,_0x1f1ee5){if(_0x471336['body']['id']){delete _0x471336[_0x0bb5('0x57')]['id'];}_0x471336[_0x0bb5('0x57')][_0x0bb5('0x40')]=widgetAttributes(_0x471336['body']);return db[_0x0bb5('0x31')]['find']({'where':{'id':_0x471336[_0x0bb5('0x3d')]['id']}})[_0x0bb5('0x28')](handleEntityNotFound(_0x1f1ee5,null))[_0x0bb5('0x28')](saveUpdates(_0x471336[_0x0bb5('0x57')],null))[_0x0bb5('0x28')](respondWithResult(_0x1f1ee5,null))['catch'](handleError(_0x1f1ee5,null));}; \ No newline at end of file +var _0xbc0f=['stack','name','model','rawAttributes','query','intersection','fields','attributes','length','includeAll','merge','DashboardItem','catch','find','params','type','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrMetric','attrVoiceQueues','attrFontSize','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','stringify','body','create','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','error'];(function(_0x4a5494,_0x3ad336){var _0x57cbb5=function(_0xa5a1ac){while(--_0xa5a1ac){_0x4a5494['push'](_0x4a5494['shift']());}};_0x57cbb5(++_0x3ad336);}(_0xbc0f,0x175));var _0xfbc0=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0xbc0f[_0x1762b4];return _0x29beda;};'use strict';var emlformat=require(_0xfbc0('0x0'));var rimraf=require(_0xfbc0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfbc0('0x2'));var rp=require(_0xfbc0('0x3'));var moment=require(_0xfbc0('0x4'));var BPromise=require(_0xfbc0('0x5'));var Mustache=require(_0xfbc0('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xfbc0('0x7'));var ejs=require(_0xfbc0('0x8'));var fs=require('fs');var fs_extra=require(_0xfbc0('0x9'));var _=require(_0xfbc0('0xa'));var squel=require('squel');var crypto=require(_0xfbc0('0xb'));var jsforce=require(_0xfbc0('0xc'));var deskjs=require(_0xfbc0('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfbc0('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xfbc0('0xf'));var as=require(_0xfbc0('0x10'));var hardwareService=require(_0xfbc0('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xfbc0('0x12'));var config=require(_0xfbc0('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xfbc0('0x14'))['db'];config['redis']=_[_0xfbc0('0x15')](config[_0xfbc0('0x16')],{'host':_0xfbc0('0x17'),'port':0x18eb});var socket=require(_0xfbc0('0x18'))(new Redis(config[_0xfbc0('0x16')]));require(_0xfbc0('0x19'))['register'](socket);function respondWithStatusCode(_0x4fe7a9,_0x4edefe){_0x4edefe=_0x4edefe||0xcc;return function(_0x4a44c0){if(_0x4a44c0){return _0x4fe7a9[_0xfbc0('0x1a')](_0x4edefe);}return _0x4fe7a9[_0xfbc0('0x1b')](_0x4edefe)[_0xfbc0('0x1c')]();};}function respondWithResult(_0x523ba2,_0x566d58){_0x566d58=_0x566d58||0xc8;return function(_0x1586c2){if(_0x1586c2){return _0x523ba2[_0xfbc0('0x1b')](_0x566d58)[_0xfbc0('0x1d')](_0x1586c2);}};}function respondWithFilteredResult(_0x267d37,_0x31b33c){return function(_0x22fb2d){if(_0x22fb2d){var _0x2546d7=typeof _0x31b33c[_0xfbc0('0x1e')]===_0xfbc0('0x1f')&&typeof _0x31b33c[_0xfbc0('0x20')]===_0xfbc0('0x1f');var _0x5b2920=_0x22fb2d[_0xfbc0('0x21')];var _0x214795=_0x2546d7?0x0:_0x31b33c[_0xfbc0('0x1e')];var _0x23ae11=_0x2546d7?_0x22fb2d['count']:_0x31b33c[_0xfbc0('0x1e')]+_0x31b33c[_0xfbc0('0x20')];var _0xf56d67;if(_0x23ae11>=_0x5b2920){_0x23ae11=_0x5b2920;_0xf56d67=0xc8;}else{_0xf56d67=0xce;}_0x267d37[_0xfbc0('0x1b')](_0xf56d67);return _0x267d37[_0xfbc0('0x22')](_0xfbc0('0x23'),_0x214795+'-'+_0x23ae11+'/'+_0x5b2920)[_0xfbc0('0x1d')](_0x22fb2d);}return null;};}function patchUpdates(_0x2d4f29){return function(_0x2db638){try{jsonpatch['apply'](_0x2db638,_0x2d4f29,!![]);}catch(_0x3d6b39){return BPromise[_0xfbc0('0x24')](_0x3d6b39);}return _0x2db638[_0xfbc0('0x25')]();};}function saveUpdates(_0x14cdad,_0x167803){return function(_0x35d251){if(_0x35d251){return _0x35d251[_0xfbc0('0x26')](_0x14cdad)['then'](function(_0x2c5843){return _0x2c5843;});}return null;};}function removeEntity(_0x29bbca,_0x2e9f0a){return function(_0x5b4588){if(_0x5b4588){return _0x5b4588[_0xfbc0('0x27')]()[_0xfbc0('0x28')](function(){_0x29bbca[_0xfbc0('0x1b')](0xcc)[_0xfbc0('0x1c')]();});}};}function handleEntityNotFound(_0x49e00f,_0x265321){return function(_0x348c1d){if(!_0x348c1d){_0x49e00f['sendStatus'](0x194);}return _0x348c1d;};}function handleError(_0x98fc66,_0x5c3824){_0x5c3824=_0x5c3824||0x1f4;return function(_0x2f8446){logger[_0xfbc0('0x29')](_0x2f8446[_0xfbc0('0x2a')]);if(_0x2f8446[_0xfbc0('0x2b')]){delete _0x2f8446[_0xfbc0('0x2b')];}_0x98fc66[_0xfbc0('0x1b')](_0x5c3824)['send'](_0x2f8446);};}exports['show']=function(_0x3602c6,_0x140d4a){var _0x311932={'raw':![],'where':{'id':_0x3602c6['params']['id']}},_0x3f6ada={};_0x3f6ada[_0xfbc0('0x2c')]=_['keys'](db['DashboardItem'][_0xfbc0('0x2d')]);_0x3f6ada[_0xfbc0('0x2e')]=_['keys'](_0x3602c6[_0xfbc0('0x2e')]);_0x3f6ada['filters']=_[_0xfbc0('0x2f')](_0x3f6ada[_0xfbc0('0x2c')],_0x3f6ada[_0xfbc0('0x2e')]);_0x311932['attributes']=_['intersection'](_0x3f6ada[_0xfbc0('0x2c')],qs[_0xfbc0('0x30')](_0x3602c6[_0xfbc0('0x2e')][_0xfbc0('0x30')]));_0x311932[_0xfbc0('0x31')]=_0x311932['attributes'][_0xfbc0('0x32')]?_0x311932[_0xfbc0('0x31')]:_0x3f6ada['model'];if(_0x3602c6[_0xfbc0('0x2e')][_0xfbc0('0x33')]){_0x311932['include']=[{'all':!![]}];}_0x311932=_[_0xfbc0('0x34')]({},_0x311932,_0x3602c6['options']);return db[_0xfbc0('0x35')]['find'](_0x311932)[_0xfbc0('0x28')](handleEntityNotFound(_0x140d4a,null))[_0xfbc0('0x28')](respondWithResult(_0x140d4a,null))[_0xfbc0('0x36')](handleError(_0x140d4a,null));};exports[_0xfbc0('0x27')]=function(_0x2380af,_0x8a1d94){return db[_0xfbc0('0x35')][_0xfbc0('0x37')]({'where':{'id':_0x2380af[_0xfbc0('0x38')]['id']}})[_0xfbc0('0x28')](handleEntityNotFound(_0x8a1d94,null))[_0xfbc0('0x28')](removeEntity(_0x8a1d94,null))[_0xfbc0('0x36')](handleError(_0x8a1d94,null));};function widgetAttributes(_0x879a67){try{switch(_0x879a67[_0xfbc0('0x39')]){case _0xfbc0('0x3a'):return[{'name':_0xfbc0('0x3b'),'value':_0x879a67[_0xfbc0('0x3b')]||(_0x879a67[_0xfbc0('0x3c')]&&_0x879a67[_0xfbc0('0x3c')][0x0]?_0x879a67['attrs'][0x0]['value']:undefined)||_0xfbc0('0x3d')}];case _0xfbc0('0x3e'):return[{'name':_0xfbc0('0x3f'),'value':_0x879a67['attrPath']||(_0x879a67[_0xfbc0('0x3c')]&&_0x879a67[_0xfbc0('0x3c')][0x0]?_0x879a67[_0xfbc0('0x3c')][0x0][_0xfbc0('0x40')]:undefined)||''}];case _0xfbc0('0x41'):return[{'name':_0xfbc0('0x42'),'value':_0x879a67[_0xfbc0('0x42')]||(_0x879a67[_0xfbc0('0x3c')]&&_0x879a67[_0xfbc0('0x3c')][0x0]?_0x879a67[_0xfbc0('0x3c')][0x0][_0xfbc0('0x40')]:undefined)||_0xfbc0('0x43')},{'name':_0xfbc0('0x44'),'value':_0x879a67[_0xfbc0('0x44')]||(_0x879a67[_0xfbc0('0x3c')]&&_0x879a67[_0xfbc0('0x3c')][0x1]?_0x879a67[_0xfbc0('0x3c')][0x1][_0xfbc0('0x40')]:undefined)||_0xfbc0('0x45')},{'name':'attrFontSize','value':_0x879a67['attrFontSize']||(_0x879a67[_0xfbc0('0x3c')]&&_0x879a67[_0xfbc0('0x3c')][0x2]?_0x879a67[_0xfbc0('0x3c')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0xfbc0('0x46'),'value':_0x879a67[_0xfbc0('0x46')]||(_0x879a67[_0xfbc0('0x3c')]&&_0x879a67[_0xfbc0('0x3c')][0x0]?_0x879a67[_0xfbc0('0x3c')][0x0]['value']:undefined)||'total'},{'name':_0xfbc0('0x47'),'value':_0x879a67[_0xfbc0('0x47')]||(_0x879a67[_0xfbc0('0x3c')]&&_0x879a67[_0xfbc0('0x3c')][0x1]?_0x879a67[_0xfbc0('0x3c')][0x1]['value']:undefined)||[]},{'name':_0xfbc0('0x48'),'value':_0x879a67[_0xfbc0('0x48')]||(_0x879a67[_0xfbc0('0x3c')]&&_0x879a67['attrs'][0x2]?_0x879a67[_0xfbc0('0x3c')][0x2][_0xfbc0('0x40')]:undefined)||0x14}];case'multibar-chart':case _0xfbc0('0x49'):return[{'name':_0xfbc0('0x4a'),'value':_0x879a67['attrSerie1']||(_0x879a67['attrs']&&_0x879a67[_0xfbc0('0x3c')][0x0]?_0x879a67[_0xfbc0('0x3c')][0x0][_0xfbc0('0x40')]:undefined)||'total'},{'name':'attrSerie2','value':_0x879a67[_0xfbc0('0x4b')]||(_0x879a67[_0xfbc0('0x3c')]&&_0x879a67['attrs'][0x1]?_0x879a67['attrs'][0x1]['value']:undefined)||null},{'name':_0xfbc0('0x4c'),'value':_0x879a67[_0xfbc0('0x4c')]||(_0x879a67[_0xfbc0('0x3c')]&&_0x879a67[_0xfbc0('0x3c')][0x2]?_0x879a67[_0xfbc0('0x3c')][0x2][_0xfbc0('0x40')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x879a67['attrVoiceQueues']||(_0x879a67[_0xfbc0('0x3c')]&&_0x879a67[_0xfbc0('0x3c')][0x3]?_0x879a67['attrs'][0x3]['value']:undefined)||[]}];case'web-report':return[{'name':_0xfbc0('0x4d'),'type':_0x879a67[_0xfbc0('0x4e')]||(_0x879a67[_0xfbc0('0x3c')]&&_0x879a67[_0xfbc0('0x3c')][0x0]?_0x879a67[_0xfbc0('0x3c')][0x0]['type']:undefined)||null,'value':_0x879a67['attrReport']||(_0x879a67[_0xfbc0('0x3c')]&&_0x879a67[_0xfbc0('0x3c')][0x0]?_0x879a67[_0xfbc0('0x3c')][0x0][_0xfbc0('0x40')]:undefined)||null},{'name':_0xfbc0('0x4f'),'value':_0x879a67[_0xfbc0('0x4f')]||(_0x879a67[_0xfbc0('0x3c')]&&_0x879a67[_0xfbc0('0x3c')][0x1]?_0x879a67[_0xfbc0('0x3c')][0x1][_0xfbc0('0x40')]:undefined)||0x0}];default:return[];}}catch(_0x1c1e25){logger[_0xfbc0('0x29')]('widgetAttributes:\x20%s',JSON[_0xfbc0('0x50')](_0x1c1e25));return[];}}exports['create']=function(_0x34c7db,_0x513fb1){if(_0x34c7db['body']){_0x34c7db[_0xfbc0('0x51')][_0xfbc0('0x3c')]=widgetAttributes(_0x34c7db[_0xfbc0('0x51')]);}return db['DashboardItem'][_0xfbc0('0x52')](_0x34c7db[_0xfbc0('0x51')],{})[_0xfbc0('0x28')](respondWithResult(_0x513fb1,0xc9))[_0xfbc0('0x36')](handleError(_0x513fb1,null));};exports[_0xfbc0('0x26')]=function(_0x2b2dcd,_0x10cd10){if(_0x2b2dcd['body']['id']){delete _0x2b2dcd[_0xfbc0('0x51')]['id'];}_0x2b2dcd[_0xfbc0('0x51')][_0xfbc0('0x3c')]=widgetAttributes(_0x2b2dcd['body']);return db[_0xfbc0('0x35')][_0xfbc0('0x37')]({'where':{'id':_0x2b2dcd[_0xfbc0('0x38')]['id']}})['then'](handleEntityNotFound(_0x10cd10,null))['then'](saveUpdates(_0x2b2dcd[_0xfbc0('0x51')],null))[_0xfbc0('0x28')](respondWithResult(_0x10cd10,null))[_0xfbc0('0x36')](handleError(_0x10cd10,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 6cbd78c..e3fd0ba 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 _0x9cc3=['exports','events','../../mysqldb','DashboardItem','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x56502e,_0x8c301d){var _0x3934ae=function(_0x5befd6){while(--_0x5befd6){_0x56502e['push'](_0x56502e['shift']());}};_0x3934ae(++_0x8c301d);}(_0x9cc3,0xeb));var _0x39cc=function(_0x3c1791,_0x1a6bf4){_0x3c1791=_0x3c1791-0x0;var _0x378d3=_0x9cc3[_0x3c1791];return _0x378d3;};'use strict';var EventEmitter=require(_0x39cc('0x0'));var DashboardItem=require(_0x39cc('0x1'))['db'][_0x39cc('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x39cc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x39cc('0x4'),'afterDestroy':'remove'};function emitEvent(_0x29f48d){return function(_0x317c43,_0x33f5f6,_0x35e85f){DashboardItemEvents['emit'](_0x29f48d+':'+_0x317c43['id'],_0x317c43);DashboardItemEvents[_0x39cc('0x5')](_0x29f48d,_0x317c43);_0x35e85f(null);};}for(var e in events){if(events[_0x39cc('0x6')](e)){var event=events[e];DashboardItem[_0x39cc('0x7')](e,emitEvent(event));}}module[_0x39cc('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0xcc87=['events','DashboardItem','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x24d24e,_0x4e17a4){var _0x20e068=function(_0x48d5e5){while(--_0x48d5e5){_0x24d24e['push'](_0x24d24e['shift']());}};_0x20e068(++_0x4e17a4);}(_0xcc87,0x158));var _0x7cc8=function(_0x343ec2,_0x4f4049){_0x343ec2=_0x343ec2-0x0;var _0x2af9eb=_0xcc87[_0x343ec2];return _0x2af9eb;};'use strict';var EventEmitter=require(_0x7cc8('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x7cc8('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x7cc8('0x2')](0x0);var events={'afterCreate':_0x7cc8('0x3'),'afterUpdate':_0x7cc8('0x4'),'afterDestroy':'remove'};function emitEvent(_0x18cce6){return function(_0x9080cd,_0x460ca7,_0x351d75){DashboardItemEvents[_0x7cc8('0x5')](_0x18cce6+':'+_0x9080cd['id'],_0x9080cd);DashboardItemEvents[_0x7cc8('0x5')](_0x18cce6,_0x9080cd);_0x351d75(null);};}for(var e in events){if(events[_0x7cc8('0x6')](e)){var event=events[e];DashboardItem[_0x7cc8('0x7')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index e5f95ea..e88bfe0 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 _0x810c=['exports','define','dashboard_items','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./dashboardItem.attributes'];(function(_0xe5b349,_0x5f06e4){var _0x26b0ad=function(_0x1a97f1){while(--_0x1a97f1){_0xe5b349['push'](_0xe5b349['shift']());}};_0x26b0ad(++_0x5f06e4);}(_0x810c,0x1a5));var _0xc810=function(_0xf91431,_0x43afe7){_0xf91431=_0xf91431-0x0;var _0x1b86ee=_0x810c[_0xf91431];return _0x1b86ee;};'use strict';var _=require(_0xc810('0x0'));var util=require(_0xc810('0x1'));var logger=require('../../config/logger')(_0xc810('0x2'));var moment=require(_0xc810('0x3'));var BPromise=require('bluebird');var rp=require(_0xc810('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc810('0x5'));var config=require(_0xc810('0x6'));var attributes=require(_0xc810('0x7'));module[_0xc810('0x8')]=function(_0x1f71b5,_0x3c5bb8){return _0x1f71b5[_0xc810('0x9')]('DashboardItem',attributes,{'tableName':_0xc810('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb439=['define','DashboardItem','dashboard_items','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./dashboardItem.attributes','exports'];(function(_0x1c58c1,_0x4d3079){var _0x50025d=function(_0x20ec69){while(--_0x20ec69){_0x1c58c1['push'](_0x1c58c1['shift']());}};_0x50025d(++_0x4d3079);}(_0xb439,0x87));var _0x9b43=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xb439[_0x5f1391];return _0x50ebe3;};'use strict';var _=require(_0x9b43('0x0'));var util=require(_0x9b43('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9b43('0x2'));var BPromise=require(_0x9b43('0x3'));var rp=require(_0x9b43('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9b43('0x5'));var config=require(_0x9b43('0x6'));var attributes=require(_0x9b43('0x7'));module[_0x9b43('0x8')]=function(_0x3ab870,_0x3d2a05){return _0x3ab870[_0x9b43('0x9')](_0x9b43('0xa'),attributes,{'tableName':_0x9b43('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 93d7f17..c644e2d 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 _0x3783=['DashboardItem,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','request','then','info','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','error'];(function(_0xb5466b,_0x1b0411){var _0x14391a=function(_0x18aaf5){while(--_0x18aaf5){_0xb5466b['push'](_0xb5466b['shift']());}};_0x14391a(++_0x1b0411);}(_0x3783,0x68));var _0x3378=function(_0x26b7a6,_0x4f58d1){_0x26b7a6=_0x26b7a6-0x0;var _0x20c444=_0x3783[_0x26b7a6];return _0x20c444;};'use strict';var _=require(_0x3378('0x0'));var util=require(_0x3378('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3378('0x2'));var fs=require('fs');var Redis=require(_0x3378('0x3'));var db=require(_0x3378('0x4'))['db'];var utils=require(_0x3378('0x5'));var logger=require(_0x3378('0x6'))(_0x3378('0x7'));var config=require(_0x3378('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3378('0x9')]['http']({'port':0x232a});config[_0x3378('0xa')]=_[_0x3378('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3378('0xc'))(new Redis(config[_0x3378('0xa')]));require(_0x3378('0xd'))[_0x3378('0xe')](socket);function respondWithRpcPromise(_0x47edeb,_0x52ca3c,_0x2ab890){return new BPromise(function(_0x58d9cf,_0x32dc06){return client[_0x3378('0xf')](_0x47edeb,_0x2ab890)[_0x3378('0x10')](function(_0x4a7d4d){logger[_0x3378('0x11')]('DashboardItem,\x20%s,\x20%s',_0x52ca3c,_0x3378('0x12'));logger['debug'](_0x3378('0x13'),_0x52ca3c,_0x3378('0x12'),JSON['stringify'](_0x4a7d4d));if(_0x4a7d4d[_0x3378('0x14')]){if(_0x4a7d4d['error']['code']===0x1f4){logger['error'](_0x3378('0x15'),_0x52ca3c,_0x4a7d4d['error'][_0x3378('0x16')]);return _0x32dc06(_0x4a7d4d[_0x3378('0x14')][_0x3378('0x16')]);}logger[_0x3378('0x14')]('DashboardItem,\x20%s,\x20%s',_0x52ca3c,_0x4a7d4d[_0x3378('0x14')][_0x3378('0x16')]);return _0x58d9cf(_0x4a7d4d[_0x3378('0x14')][_0x3378('0x16')]);}else{logger[_0x3378('0x11')](_0x3378('0x15'),_0x52ca3c,_0x3378('0x12'));_0x58d9cf(_0x4a7d4d[_0x3378('0x17')][_0x3378('0x16')]);}})[_0x3378('0x18')](function(_0x2b9410){logger[_0x3378('0x14')]('DashboardItem,\x20%s,\x20%s',_0x52ca3c,_0x2b9410);_0x32dc06(_0x2b9410);});});} \ No newline at end of file +var _0xf571=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','request','then','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','DashboardItem,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x288b93,_0x3c556c){var _0x8965e9=function(_0xf7f560){while(--_0xf7f560){_0x288b93['push'](_0x288b93['shift']());}};_0x8965e9(++_0x3c556c);}(_0xf571,0x7b));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 moment=require(_0x1f57('0x2'));var BPromise=require(_0x1f57('0x3'));var rs=require(_0x1f57('0x4'));var fs=require('fs');var Redis=require(_0x1f57('0x5'));var db=require(_0x1f57('0x6'))['db'];var utils=require(_0x1f57('0x7'));var logger=require(_0x1f57('0x8'))(_0x1f57('0x9'));var config=require(_0x1f57('0xa'));var jayson=require(_0x1f57('0xb'));var client=jayson[_0x1f57('0xc')][_0x1f57('0xd')]({'port':0x232a});config[_0x1f57('0xe')]=_['defaults'](config['redis'],{'host':_0x1f57('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./dashboardItem.socket')['register'](socket);function respondWithRpcPromise(_0x4f2dd2,_0x3e99b4,_0x50c753){return new BPromise(function(_0x517c63,_0x1f6a08){return client[_0x1f57('0x10')](_0x4f2dd2,_0x50c753)[_0x1f57('0x11')](function(_0x56c870){logger[_0x1f57('0x12')]('DashboardItem,\x20%s,\x20%s',_0x3e99b4,_0x1f57('0x13'));logger[_0x1f57('0x14')](_0x1f57('0x15'),_0x3e99b4,'request\x20sent',JSON['stringify'](_0x56c870));if(_0x56c870['error']){if(_0x56c870['error']['code']===0x1f4){logger['error'](_0x1f57('0x16'),_0x3e99b4,_0x56c870[_0x1f57('0x17')][_0x1f57('0x18')]);return _0x1f6a08(_0x56c870[_0x1f57('0x17')][_0x1f57('0x18')]);}logger[_0x1f57('0x17')](_0x1f57('0x16'),_0x3e99b4,_0x56c870[_0x1f57('0x17')][_0x1f57('0x18')]);return _0x517c63(_0x56c870[_0x1f57('0x17')][_0x1f57('0x18')]);}else{logger[_0x1f57('0x12')]('DashboardItem,\x20%s,\x20%s',_0x3e99b4,_0x1f57('0x13'));_0x517c63(_0x56c870['result'][_0x1f57('0x18')]);}})[_0x1f57('0x19')](function(_0x58c1cc){logger[_0x1f57('0x17')](_0x1f57('0x16'),_0x3e99b4,_0x58c1cc);_0x1f6a08(_0x58c1cc);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index b557317..60392b0 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 _0xf8ba=['emit','removeListener','register','dashboardItem:','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf8ba,0x126));var _0xaf8b=function(_0x30626b,_0x41b7ef){_0x30626b=_0x30626b-0x0;var _0x254440=_0xf8ba[_0x30626b];return _0x254440;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=['save','remove',_0xaf8b('0x0')];function createListener(_0x39a771,_0x16f6cd){return function(_0x2d2640){_0x16f6cd[_0xaf8b('0x1')](_0x39a771,_0x2d2640);};}function removeListener(_0x58085b,_0x421982){return function(){DashboardItemEvents[_0xaf8b('0x2')](_0x58085b,_0x421982);};}exports[_0xaf8b('0x3')]=function(_0x532606){for(var _0x21a1e4=0x0,_0x489137=events['length'];_0x21a1e4<_0x489137;_0x21a1e4++){var _0x2718dd=events[_0x21a1e4];var _0x1a840e=createListener(_0xaf8b('0x4')+_0x2718dd,_0x532606);DashboardItemEvents['on'](_0x2718dd,_0x1a840e);}}; \ No newline at end of file +var _0x4600=['update','emit','dashboardItem:','save'];(function(_0x162bc9,_0x5c117e){var _0x475e2d=function(_0x18c0e7){while(--_0x18c0e7){_0x162bc9['push'](_0x162bc9['shift']());}};_0x475e2d(++_0x5c117e);}(_0x4600,0x1df));var _0x0460=function(_0x59a3a2,_0x233d09){_0x59a3a2=_0x59a3a2-0x0;var _0x5144d0=_0x4600[_0x59a3a2];return _0x5144d0;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x0460('0x0'),'remove',_0x0460('0x1')];function createListener(_0x2fe4f3,_0x5427dc){return function(_0x1a711f){_0x5427dc[_0x0460('0x2')](_0x2fe4f3,_0x1a711f);};}function removeListener(_0x364ada,_0x559d9a){return function(){DashboardItemEvents['removeListener'](_0x364ada,_0x559d9a);};}exports['register']=function(_0x2b004f){for(var _0x654ffd=0x0,_0x3f6f6b=events['length'];_0x654ffd<_0x3f6f6b;_0x654ffd++){var _0x3ed8a5=events[_0x654ffd];var _0x1ea66d=createListener(_0x0460('0x3')+_0x3ed8a5,_0x2b004f);DashboardItemEvents['on'](_0x3ed8a5,_0x1ea66d);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index e4050ea..a63f748 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 _0x94fd=['isAuthenticated','create','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x94fd,0x97));var _0xd94f=function(_0xf03c17,_0x507e2f){_0xf03c17=_0xf03c17-0x0;var _0x1a87c3=_0x94fd[_0xf03c17];return _0x1a87c3;};'use strict';var multer=require(_0xd94f('0x0'));var util=require('util');var path=require(_0xd94f('0x1'));var timeout=require(_0xd94f('0x2'));var express=require(_0xd94f('0x3'));var router=express[_0xd94f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd94f('0x5'));var interaction=require(_0xd94f('0x6'));var config=require(_0xd94f('0x7'));var controller=require(_0xd94f('0x8'));router['get']('/:id',auth[_0xd94f('0x9')](),controller['show']);router['post']('/',auth[_0xd94f('0x9')](),controller[_0xd94f('0xa')]);router[_0xd94f('0xb')](_0xd94f('0xc'),auth[_0xd94f('0x9')](),controller[_0xd94f('0xd')]);router[_0xd94f('0xe')](_0xd94f('0xc'),auth['isAuthenticated'](),controller[_0xd94f('0xf')]);module['exports']=router; \ No newline at end of file +var _0xd13a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','multer','util','path'];(function(_0x218e88,_0x2e96bc){var _0x4795f4=function(_0x2f7484){while(--_0x2f7484){_0x218e88['push'](_0x218e88['shift']());}};_0x4795f4(++_0x2e96bc);}(_0xd13a,0x123));var _0xad13=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xd13a[_0x5d4607];return _0x5e4a86;};'use strict';var multer=require(_0xad13('0x0'));var util=require(_0xad13('0x1'));var path=require(_0xad13('0x2'));var timeout=require(_0xad13('0x3'));var express=require(_0xad13('0x4'));var router=express[_0xad13('0x5')]();var fs_extra=require(_0xad13('0x6'));var auth=require(_0xad13('0x7'));var interaction=require(_0xad13('0x8'));var config=require(_0xad13('0x9'));var controller=require(_0xad13('0xa'));router[_0xad13('0xb')](_0xad13('0xc'),auth[_0xad13('0xd')](),controller[_0xad13('0xe')]);router[_0xad13('0xf')]('/',auth[_0xad13('0xd')](),controller[_0xad13('0x10')]);router[_0xad13('0x11')](_0xad13('0xc'),auth[_0xad13('0xd')](),controller['update']);router[_0xad13('0x12')](_0xad13('0xc'),auth[_0xad13('0xd')](),controller[_0xad13('0x13')]);module[_0xad13('0x14')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 24a380e..80ab015 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 _0xf7d6=['STRING','ENUM','second','first','exports'];(function(_0x5f3831,_0x2e7b0d){var _0x3cf8f1=function(_0x20b7f7){while(--_0x20b7f7){_0x5f3831['push'](_0x5f3831['shift']());}};_0x3cf8f1(++_0x2e7b0d);}(_0xf7d6,0xef));var _0x6f7d=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xf7d6[_0x134c2e];return _0x2825db;};'use strict';var Sequelize=require('sequelize');module[_0x6f7d('0x0')]={'name':{'type':Sequelize[_0x6f7d('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x6f7d('0x2')]('first',_0x6f7d('0x3'),'third'),'allowNull':![],'defaultValue':_0x6f7d('0x4')},'description':{'type':Sequelize[_0x6f7d('0x1')]}}; \ No newline at end of file +var _0xf7a1=['first','second','third','sequelize','STRING','ENUM'];(function(_0x58ddfa,_0x46459b){var _0x2e121c=function(_0x50e436){while(--_0x50e436){_0x58ddfa['push'](_0x58ddfa['shift']());}};_0x2e121c(++_0x46459b);}(_0xf7a1,0x141));var _0x1f7a=function(_0x4a71f5,_0x401424){_0x4a71f5=_0x4a71f5-0x0;var _0x27162f=_0xf7a1[_0x4a71f5];return _0x27162f;};'use strict';var Sequelize=require(_0x1f7a('0x0'));module['exports']={'name':{'type':Sequelize[_0x1f7a('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x1f7a('0x2')](_0x1f7a('0x3'),_0x1f7a('0x4'),_0x1f7a('0x5')),'allowNull':![],'defaultValue':_0x1f7a('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 8007ea2..c493411 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 _0x41ec=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','destroy','Dispositions','UserProfileResource','end','error','stack','name','send','map','Disposition','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','nolimit','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','params','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3d2ec3,_0x5ee6c7){var _0x4088cb=function(_0x544f0b){while(--_0x544f0b){_0x3d2ec3['push'](_0x3d2ec3['shift']());}};_0x4088cb(++_0x5ee6c7);}(_0x41ec,0x143));var _0xc41e=function(_0x290c44,_0x271ae0){_0x290c44=_0x290c44-0x0;var _0x31cf95=_0x41ec[_0x290c44];return _0x31cf95;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc41e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc41e('0x1'));var rp=require(_0xc41e('0x2'));var moment=require('moment');var BPromise=require(_0xc41e('0x3'));var Mustache=require(_0xc41e('0x4'));var util=require(_0xc41e('0x5'));var path=require(_0xc41e('0x6'));var sox=require(_0xc41e('0x7'));var csv=require(_0xc41e('0x8'));var ejs=require(_0xc41e('0x9'));var fs=require('fs');var fs_extra=require(_0xc41e('0xa'));var _=require(_0xc41e('0xb'));var squel=require(_0xc41e('0xc'));var crypto=require(_0xc41e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc41e('0xe'));var toCsv=require(_0xc41e('0x8'));var querystring=require(_0xc41e('0xf'));var Papa=require(_0xc41e('0x10'));var Redis=require(_0xc41e('0x11'));var authService=require(_0xc41e('0x12'));var qs=require(_0xc41e('0x13'));var as=require(_0xc41e('0x14'));var hardwareService=require(_0xc41e('0x15'));var logger=require(_0xc41e('0x16'))(_0xc41e('0x17'));var utils=require('../../config/utils');var config=require(_0xc41e('0x18'));var licenseUtil=require(_0xc41e('0x19'));var db=require(_0xc41e('0x1a'))['db'];function respondWithStatusCode(_0x3d7280,_0x11a117){_0x11a117=_0x11a117||0xcc;return function(_0x433ca9){if(_0x433ca9){return _0x3d7280[_0xc41e('0x1b')](_0x11a117);}return _0x3d7280[_0xc41e('0x1c')](_0x11a117)['end']();};}function respondWithResult(_0x3b3900,_0x6b614a){_0x6b614a=_0x6b614a||0xc8;return function(_0xcd58a0){if(_0xcd58a0){return _0x3b3900[_0xc41e('0x1c')](_0x6b614a)['json'](_0xcd58a0);}};}function respondWithFilteredResult(_0x5c705e,_0x4f960d){return function(_0x28eb53){if(_0x28eb53){var _0x4293a5=typeof _0x4f960d['offset']===_0xc41e('0x1d')&&typeof _0x4f960d[_0xc41e('0x1e')]==='undefined';var _0x4e7aa3=_0x28eb53[_0xc41e('0x1f')];var _0x5c0517=_0x4293a5?0x0:_0x4f960d[_0xc41e('0x20')];var _0x23c9b6=_0x4293a5?_0x28eb53['count']:_0x4f960d[_0xc41e('0x20')]+_0x4f960d[_0xc41e('0x1e')];var _0xee0f01;if(_0x23c9b6>=_0x4e7aa3){_0x23c9b6=_0x4e7aa3;_0xee0f01=0xc8;}else{_0xee0f01=0xce;}_0x5c705e[_0xc41e('0x1c')](_0xee0f01);return _0x5c705e[_0xc41e('0x21')](_0xc41e('0x22'),_0x5c0517+'-'+_0x23c9b6+'/'+_0x4e7aa3)[_0xc41e('0x23')](_0x28eb53);}return null;};}function patchUpdates(_0x57e0c4){return function(_0x239c25){try{jsonpatch[_0xc41e('0x24')](_0x239c25,_0x57e0c4,!![]);}catch(_0x3f26d5){return BPromise['reject'](_0x3f26d5);}return _0x239c25[_0xc41e('0x25')]();};}function saveUpdates(_0x408d27,_0x814a72){return function(_0x490cc3){if(_0x490cc3){return _0x490cc3[_0xc41e('0x26')](_0x408d27)[_0xc41e('0x27')](function(_0x602bd7){return _0x602bd7;});}return null;};}function removeEntity(_0x4adaad,_0x5a06dd){return function(_0x4c20b1){if(_0x4c20b1){return _0x4c20b1[_0xc41e('0x28')]()[_0xc41e('0x27')](function(){var _0x4f9b2d=_0x4c20b1['get']({'plain':!![]});var _0x5a3e0d=_0xc41e('0x29');return db[_0xc41e('0x2a')][_0xc41e('0x28')]({'where':{'type':_0x5a3e0d,'resourceId':_0x4f9b2d['id']}})[_0xc41e('0x27')](function(){return _0x4c20b1;});})[_0xc41e('0x27')](function(){_0x4adaad['status'](0xcc)[_0xc41e('0x2b')]();});}};}function handleEntityNotFound(_0xdf9a54,_0xbf33ef){return function(_0x5bd682){if(!_0x5bd682){_0xdf9a54[_0xc41e('0x1b')](0x194);}return _0x5bd682;};}function handleError(_0x3ca037,_0x52773d){_0x52773d=_0x52773d||0x1f4;return function(_0x25b319){logger[_0xc41e('0x2c')](_0x25b319[_0xc41e('0x2d')]);if(_0x25b319[_0xc41e('0x2e')]){delete _0x25b319[_0xc41e('0x2e')];}_0x3ca037[_0xc41e('0x1c')](_0x52773d)[_0xc41e('0x2f')](_0x25b319);};}exports['index']=function(_0x57dad9,_0x541ac4){var _0x3cd142={},_0x1fc6e2={},_0x24b7ac={'count':0x0,'rows':[]};var _0x3334f8=_[_0xc41e('0x30')](db[_0xc41e('0x31')][_0xc41e('0x32')],function(_0x4b2514){return{'name':_0x4b2514[_0xc41e('0x33')],'type':_0x4b2514[_0xc41e('0x34')][_0xc41e('0x35')]};});_0x1fc6e2['model']=_[_0xc41e('0x30')](_0x3334f8,'name');_0x1fc6e2[_0xc41e('0x36')]=_[_0xc41e('0x37')](_0x57dad9[_0xc41e('0x36')]);_0x1fc6e2[_0xc41e('0x38')]=_['intersection'](_0x1fc6e2['model'],_0x1fc6e2[_0xc41e('0x36')]);_0x3cd142[_0xc41e('0x39')]=_[_0xc41e('0x3a')](_0x1fc6e2[_0xc41e('0x3b')],qs[_0xc41e('0x3c')](_0x57dad9[_0xc41e('0x36')]['fields']));_0x3cd142[_0xc41e('0x39')]=_0x3cd142[_0xc41e('0x39')][_0xc41e('0x3d')]?_0x3cd142['attributes']:_0x1fc6e2[_0xc41e('0x3b')];if(!_0x57dad9[_0xc41e('0x36')]['hasOwnProperty'](_0xc41e('0x3e'))){_0x3cd142[_0xc41e('0x1e')]=qs[_0xc41e('0x1e')](_0x57dad9[_0xc41e('0x36')][_0xc41e('0x1e')]);_0x3cd142['offset']=qs['offset'](_0x57dad9[_0xc41e('0x36')][_0xc41e('0x20')]);}_0x3cd142[_0xc41e('0x3f')]=qs[_0xc41e('0x40')](_0x57dad9[_0xc41e('0x36')][_0xc41e('0x40')]);_0x3cd142[_0xc41e('0x41')]=qs[_0xc41e('0x38')](_[_0xc41e('0x42')](_0x57dad9['query'],_0x1fc6e2['filters']),_0x3334f8);if(_0x57dad9[_0xc41e('0x36')][_0xc41e('0x43')]){_0x3cd142[_0xc41e('0x41')]=_[_0xc41e('0x44')](_0x3cd142[_0xc41e('0x41')],{'$or':_[_0xc41e('0x30')](_0x3334f8,function(_0x102905){if(_0x102905[_0xc41e('0x34')]!=='VIRTUAL'){var _0x5e9d54={};_0x5e9d54[_0x102905[_0xc41e('0x2e')]]={'$like':'%'+_0x57dad9[_0xc41e('0x36')][_0xc41e('0x43')]+'%'};return _0x5e9d54;}})});}_0x3cd142=_['merge']({},_0x3cd142,_0x57dad9['options']);var _0x128a2e={'where':_0x3cd142['where']};return db['Disposition']['count'](_0x128a2e)['then'](function(_0x3c30e2){_0x24b7ac[_0xc41e('0x1f')]=_0x3c30e2;if(_0x57dad9[_0xc41e('0x36')][_0xc41e('0x45')]){_0x3cd142[_0xc41e('0x46')]=[{'all':!![]}];}return db[_0xc41e('0x31')]['findAll'](_0x3cd142);})[_0xc41e('0x27')](function(_0x1a3e67){_0x24b7ac[_0xc41e('0x47')]=_0x1a3e67;return _0x24b7ac;})[_0xc41e('0x27')](respondWithFilteredResult(_0x541ac4,_0x3cd142))[_0xc41e('0x48')](handleError(_0x541ac4,null));};exports[_0xc41e('0x49')]=function(_0x49b21b,_0x39dd97){var _0xce94f6={'raw':!![],'where':{'id':_0x49b21b[_0xc41e('0x4a')]['id']}},_0x515f41={};_0x515f41[_0xc41e('0x3b')]=_['keys'](db[_0xc41e('0x31')]['rawAttributes']);_0x515f41[_0xc41e('0x36')]=_[_0xc41e('0x37')](_0x49b21b[_0xc41e('0x36')]);_0x515f41['filters']=_[_0xc41e('0x3a')](_0x515f41[_0xc41e('0x3b')],_0x515f41['query']);_0xce94f6['attributes']=_['intersection'](_0x515f41['model'],qs[_0xc41e('0x3c')](_0x49b21b['query'][_0xc41e('0x3c')]));_0xce94f6['attributes']=_0xce94f6['attributes'][_0xc41e('0x3d')]?_0xce94f6['attributes']:_0x515f41[_0xc41e('0x3b')];if(_0x49b21b[_0xc41e('0x36')][_0xc41e('0x45')]){_0xce94f6[_0xc41e('0x46')]=[{'all':!![]}];}_0xce94f6=_[_0xc41e('0x44')]({},_0xce94f6,_0x49b21b[_0xc41e('0x4b')]);return db[_0xc41e('0x31')][_0xc41e('0x4c')](_0xce94f6)[_0xc41e('0x27')](handleEntityNotFound(_0x39dd97,null))[_0xc41e('0x27')](respondWithResult(_0x39dd97,null))[_0xc41e('0x48')](handleError(_0x39dd97,null));};exports['create']=function(_0x4b67d4,_0x1cdf49){return db[_0xc41e('0x31')][_0xc41e('0x4d')](_0x4b67d4['body'],{})[_0xc41e('0x27')](function(_0x43a952){var _0x5f881b=_0x4b67d4[_0xc41e('0x4e')][_0xc41e('0x4f')]({'plain':!![]});if(!_0x5f881b)throw new Error(_0xc41e('0x50'));if(_0x5f881b[_0xc41e('0x51')]==='user'){var _0x3c867a=_0x43a952[_0xc41e('0x4f')]({'plain':!![]});var _0x511085='Dispositions';return db[_0xc41e('0x52')][_0xc41e('0x4c')]({'where':{'name':_0x511085,'userProfileId':_0x5f881b[_0xc41e('0x53')]},'raw':!![]})[_0xc41e('0x27')](function(_0x38d948){if(_0x38d948&&_0x38d948['autoAssociation']===0x0){return db['UserProfileResource'][_0xc41e('0x4d')]({'name':_0x3c867a['name'],'resourceId':_0x3c867a['id'],'type':_0x38d948[_0xc41e('0x2e')],'sectionId':_0x38d948['id']},{})['then'](function(){return _0x43a952;});}else{return _0x43a952;}})['catch'](function(_0x3d71c2){logger['error'](_0xc41e('0x54'),_0x3d71c2);throw _0x3d71c2;});}return _0x43a952;})[_0xc41e('0x27')](respondWithResult(_0x1cdf49,0xc9))[_0xc41e('0x48')](handleError(_0x1cdf49,null));};exports[_0xc41e('0x26')]=function(_0x2c29f9,_0x13e0de){if(_0x2c29f9['body']['id']){delete _0x2c29f9[_0xc41e('0x55')]['id'];}return db[_0xc41e('0x31')][_0xc41e('0x4c')]({'where':{'id':_0x2c29f9[_0xc41e('0x4a')]['id']}})[_0xc41e('0x27')](handleEntityNotFound(_0x13e0de,null))['then'](saveUpdates(_0x2c29f9[_0xc41e('0x55')],null))[_0xc41e('0x27')](respondWithResult(_0x13e0de,null))['catch'](handleError(_0x13e0de,null));};exports[_0xc41e('0x28')]=function(_0x7dada1,_0x20a7bf){return db['Disposition'][_0xc41e('0x4c')]({'where':{'id':_0x7dada1[_0xc41e('0x4a')]['id']}})[_0xc41e('0x27')](handleEntityNotFound(_0x20a7bf,null))[_0xc41e('0x27')](removeEntity(_0x20a7bf,null))['catch'](handleError(_0x20a7bf,null));}; \ No newline at end of file +var _0xdbb1=['options','includeAll','include','findAll','rows','catch','params','filters','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','request-promise','mustache','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','name','index','map','Disposition','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x23420b,_0x21ea96){var _0x454451=function(_0x125f6a){while(--_0x125f6a){_0x23420b['push'](_0x23420b['shift']());}};_0x454451(++_0x21ea96);}(_0xdbb1,0x105));var _0x1dbb=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0xdbb1[_0x397cfb];return _0x15fed9;};'use strict';var emlformat=require(_0x1dbb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1dbb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1dbb('0x2'));var util=require('util');var path=require(_0x1dbb('0x3'));var sox=require(_0x1dbb('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1dbb('0x5'));var _=require(_0x1dbb('0x6'));var squel=require(_0x1dbb('0x7'));var crypto=require(_0x1dbb('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x1dbb('0x9'));var toCsv=require(_0x1dbb('0xa'));var querystring=require('querystring');var Papa=require(_0x1dbb('0xb'));var Redis=require(_0x1dbb('0xc'));var authService=require(_0x1dbb('0xd'));var qs=require(_0x1dbb('0xe'));var as=require(_0x1dbb('0xf'));var hardwareService=require(_0x1dbb('0x10'));var logger=require(_0x1dbb('0x11'))(_0x1dbb('0x12'));var utils=require(_0x1dbb('0x13'));var config=require(_0x1dbb('0x14'));var licenseUtil=require(_0x1dbb('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x425fef,_0x28c292){_0x28c292=_0x28c292||0xcc;return function(_0x332380){if(_0x332380){return _0x425fef[_0x1dbb('0x16')](_0x28c292);}return _0x425fef['status'](_0x28c292)['end']();};}function respondWithResult(_0x1d87b9,_0x175864){_0x175864=_0x175864||0xc8;return function(_0xf5f7ed){if(_0xf5f7ed){return _0x1d87b9[_0x1dbb('0x17')](_0x175864)[_0x1dbb('0x18')](_0xf5f7ed);}};}function respondWithFilteredResult(_0x539721,_0x15dc51){return function(_0x188515){if(_0x188515){var _0x409bee=typeof _0x15dc51['offset']===_0x1dbb('0x19')&&typeof _0x15dc51[_0x1dbb('0x1a')]==='undefined';var _0x2c2aa8=_0x188515[_0x1dbb('0x1b')];var _0x98b8d2=_0x409bee?0x0:_0x15dc51[_0x1dbb('0x1c')];var _0xb21bc5=_0x409bee?_0x188515[_0x1dbb('0x1b')]:_0x15dc51[_0x1dbb('0x1c')]+_0x15dc51[_0x1dbb('0x1a')];var _0x58aa43;if(_0xb21bc5>=_0x2c2aa8){_0xb21bc5=_0x2c2aa8;_0x58aa43=0xc8;}else{_0x58aa43=0xce;}_0x539721['status'](_0x58aa43);return _0x539721['set'](_0x1dbb('0x1d'),_0x98b8d2+'-'+_0xb21bc5+'/'+_0x2c2aa8)[_0x1dbb('0x18')](_0x188515);}return null;};}function patchUpdates(_0x570896){return function(_0x21e48c){try{jsonpatch[_0x1dbb('0x1e')](_0x21e48c,_0x570896,!![]);}catch(_0x23e6b2){return BPromise[_0x1dbb('0x1f')](_0x23e6b2);}return _0x21e48c[_0x1dbb('0x20')]();};}function saveUpdates(_0x3ddd80,_0x330f45){return function(_0x4b206d){if(_0x4b206d){return _0x4b206d[_0x1dbb('0x21')](_0x3ddd80)[_0x1dbb('0x22')](function(_0x2a2458){return _0x2a2458;});}return null;};}function removeEntity(_0x2d1b0c,_0x2c0993){return function(_0x429253){if(_0x429253){return _0x429253[_0x1dbb('0x23')]()[_0x1dbb('0x22')](function(){var _0x2945ec=_0x429253[_0x1dbb('0x24')]({'plain':!![]});var _0x18f188='Dispositions';return db[_0x1dbb('0x25')]['destroy']({'where':{'type':_0x18f188,'resourceId':_0x2945ec['id']}})[_0x1dbb('0x22')](function(){return _0x429253;});})['then'](function(){_0x2d1b0c[_0x1dbb('0x17')](0xcc)[_0x1dbb('0x26')]();});}};}function handleEntityNotFound(_0x346372,_0x3ece10){return function(_0x271ee5){if(!_0x271ee5){_0x346372[_0x1dbb('0x16')](0x194);}return _0x271ee5;};}function handleError(_0x5e5059,_0x14fca1){_0x14fca1=_0x14fca1||0x1f4;return function(_0x410979){logger[_0x1dbb('0x27')](_0x410979['stack']);if(_0x410979['name']){delete _0x410979[_0x1dbb('0x28')];}_0x5e5059['status'](_0x14fca1)['send'](_0x410979);};}exports[_0x1dbb('0x29')]=function(_0x27c844,_0x4511b3){var _0x151525={},_0x292a36={},_0x154884={'count':0x0,'rows':[]};var _0x15cc71=_[_0x1dbb('0x2a')](db[_0x1dbb('0x2b')]['rawAttributes'],function(_0x4d70fc){return{'name':_0x4d70fc[_0x1dbb('0x2c')],'type':_0x4d70fc[_0x1dbb('0x2d')][_0x1dbb('0x2e')]};});_0x292a36['model']=_['map'](_0x15cc71,_0x1dbb('0x28'));_0x292a36[_0x1dbb('0x2f')]=_[_0x1dbb('0x30')](_0x27c844['query']);_0x292a36['filters']=_[_0x1dbb('0x31')](_0x292a36[_0x1dbb('0x32')],_0x292a36['query']);_0x151525[_0x1dbb('0x33')]=_[_0x1dbb('0x31')](_0x292a36[_0x1dbb('0x32')],qs[_0x1dbb('0x34')](_0x27c844['query'][_0x1dbb('0x34')]));_0x151525[_0x1dbb('0x33')]=_0x151525[_0x1dbb('0x33')][_0x1dbb('0x35')]?_0x151525[_0x1dbb('0x33')]:_0x292a36[_0x1dbb('0x32')];if(!_0x27c844['query'][_0x1dbb('0x36')](_0x1dbb('0x37'))){_0x151525['limit']=qs[_0x1dbb('0x1a')](_0x27c844[_0x1dbb('0x2f')][_0x1dbb('0x1a')]);_0x151525[_0x1dbb('0x1c')]=qs[_0x1dbb('0x1c')](_0x27c844['query'][_0x1dbb('0x1c')]);}_0x151525[_0x1dbb('0x38')]=qs[_0x1dbb('0x39')](_0x27c844[_0x1dbb('0x2f')][_0x1dbb('0x39')]);_0x151525[_0x1dbb('0x3a')]=qs['filters'](_[_0x1dbb('0x3b')](_0x27c844[_0x1dbb('0x2f')],_0x292a36['filters']),_0x15cc71);if(_0x27c844[_0x1dbb('0x2f')][_0x1dbb('0x3c')]){_0x151525[_0x1dbb('0x3a')]=_[_0x1dbb('0x3d')](_0x151525[_0x1dbb('0x3a')],{'$or':_[_0x1dbb('0x2a')](_0x15cc71,function(_0xbce716){if(_0xbce716[_0x1dbb('0x2d')]!==_0x1dbb('0x3e')){var _0x476fc7={};_0x476fc7[_0xbce716[_0x1dbb('0x28')]]={'$like':'%'+_0x27c844[_0x1dbb('0x2f')][_0x1dbb('0x3c')]+'%'};return _0x476fc7;}})});}_0x151525=_['merge']({},_0x151525,_0x27c844[_0x1dbb('0x3f')]);var _0x142c74={'where':_0x151525[_0x1dbb('0x3a')]};return db[_0x1dbb('0x2b')][_0x1dbb('0x1b')](_0x142c74)[_0x1dbb('0x22')](function(_0x414609){_0x154884[_0x1dbb('0x1b')]=_0x414609;if(_0x27c844[_0x1dbb('0x2f')][_0x1dbb('0x40')]){_0x151525[_0x1dbb('0x41')]=[{'all':!![]}];}return db[_0x1dbb('0x2b')][_0x1dbb('0x42')](_0x151525);})['then'](function(_0x148c2f){_0x154884[_0x1dbb('0x43')]=_0x148c2f;return _0x154884;})[_0x1dbb('0x22')](respondWithFilteredResult(_0x4511b3,_0x151525))[_0x1dbb('0x44')](handleError(_0x4511b3,null));};exports['show']=function(_0x3fa964,_0x2b3b1b){var _0x12c16b={'raw':!![],'where':{'id':_0x3fa964[_0x1dbb('0x45')]['id']}},_0xf73796={};_0xf73796[_0x1dbb('0x32')]=_[_0x1dbb('0x30')](db[_0x1dbb('0x2b')]['rawAttributes']);_0xf73796[_0x1dbb('0x2f')]=_[_0x1dbb('0x30')](_0x3fa964[_0x1dbb('0x2f')]);_0xf73796[_0x1dbb('0x46')]=_[_0x1dbb('0x31')](_0xf73796[_0x1dbb('0x32')],_0xf73796['query']);_0x12c16b[_0x1dbb('0x33')]=_['intersection'](_0xf73796[_0x1dbb('0x32')],qs[_0x1dbb('0x34')](_0x3fa964['query'][_0x1dbb('0x34')]));_0x12c16b[_0x1dbb('0x33')]=_0x12c16b[_0x1dbb('0x33')][_0x1dbb('0x35')]?_0x12c16b[_0x1dbb('0x33')]:_0xf73796['model'];if(_0x3fa964[_0x1dbb('0x2f')][_0x1dbb('0x40')]){_0x12c16b[_0x1dbb('0x41')]=[{'all':!![]}];}_0x12c16b=_[_0x1dbb('0x3d')]({},_0x12c16b,_0x3fa964[_0x1dbb('0x3f')]);return db['Disposition'][_0x1dbb('0x47')](_0x12c16b)['then'](handleEntityNotFound(_0x2b3b1b,null))['then'](respondWithResult(_0x2b3b1b,null))[_0x1dbb('0x44')](handleError(_0x2b3b1b,null));};exports['create']=function(_0x33969b,_0xb47fb7){return db[_0x1dbb('0x2b')][_0x1dbb('0x48')](_0x33969b[_0x1dbb('0x49')],{})[_0x1dbb('0x22')](function(_0x4f71ef){var _0x16cf4f=_0x33969b[_0x1dbb('0x4a')][_0x1dbb('0x24')]({'plain':!![]});if(!_0x16cf4f)throw new Error(_0x1dbb('0x4b'));if(_0x16cf4f[_0x1dbb('0x4c')]===_0x1dbb('0x4a')){var _0x512408=_0x4f71ef['get']({'plain':!![]});var _0xc071cc='Dispositions';return db[_0x1dbb('0x4d')][_0x1dbb('0x47')]({'where':{'name':_0xc071cc,'userProfileId':_0x16cf4f[_0x1dbb('0x4e')]},'raw':!![]})['then'](function(_0x34dece){if(_0x34dece&&_0x34dece[_0x1dbb('0x4f')]===0x0){return db[_0x1dbb('0x25')][_0x1dbb('0x48')]({'name':_0x512408['name'],'resourceId':_0x512408['id'],'type':_0x34dece[_0x1dbb('0x28')],'sectionId':_0x34dece['id']},{})[_0x1dbb('0x22')](function(){return _0x4f71ef;});}else{return _0x4f71ef;}})[_0x1dbb('0x44')](function(_0x325876){logger[_0x1dbb('0x27')](_0x1dbb('0x50'),_0x325876);throw _0x325876;});}return _0x4f71ef;})[_0x1dbb('0x22')](respondWithResult(_0xb47fb7,0xc9))[_0x1dbb('0x44')](handleError(_0xb47fb7,null));};exports[_0x1dbb('0x21')]=function(_0xfd3cf0,_0xb22ae6){if(_0xfd3cf0[_0x1dbb('0x49')]['id']){delete _0xfd3cf0[_0x1dbb('0x49')]['id'];}return db[_0x1dbb('0x2b')]['find']({'where':{'id':_0xfd3cf0['params']['id']}})[_0x1dbb('0x22')](handleEntityNotFound(_0xb22ae6,null))['then'](saveUpdates(_0xfd3cf0[_0x1dbb('0x49')],null))[_0x1dbb('0x22')](respondWithResult(_0xb22ae6,null))[_0x1dbb('0x44')](handleError(_0xb22ae6,null));};exports[_0x1dbb('0x23')]=function(_0x20c294,_0x23936d){return db[_0x1dbb('0x2b')][_0x1dbb('0x47')]({'where':{'id':_0x20c294[_0x1dbb('0x45')]['id']}})[_0x1dbb('0x22')](handleEntityNotFound(_0x23936d,null))[_0x1dbb('0x22')](removeEntity(_0x23936d,null))['catch'](handleError(_0x23936d,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 55bba33..5cb4671 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 _0xa723=['FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','Disposition','tools_dispositions','name','ListId','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa723,0x185));var _0x3a72=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa723[_0x49ca18];return _0x145d54;};'use strict';var _=require('lodash');var util=require(_0x3a72('0x0'));var logger=require(_0x3a72('0x1'))(_0x3a72('0x2'));var moment=require('moment');var BPromise=require(_0x3a72('0x3'));var rp=require(_0x3a72('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3a72('0x5'));var config=require(_0x3a72('0x6'));var attributes=require('./disposition.attributes');module[_0x3a72('0x7')]=function(_0x79a6d6,_0x27601f){return _0x79a6d6[_0x3a72('0x8')](_0x3a72('0x9'),attributes,{'tableName':_0x3a72('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x3a72('0xb'),_0x3a72('0xc')]},{'unique':!![],'name':'name_chat','fields':[_0x3a72('0xb'),_0x3a72('0xd')]},{'unique':!![],'name':_0x3a72('0xe'),'fields':['name',_0x3a72('0xf')]},{'unique':!![],'name':_0x3a72('0x10'),'fields':[_0x3a72('0xb'),_0x3a72('0x11')]},{'unique':!![],'name':_0x3a72('0x12'),'fields':[_0x3a72('0xb'),_0x3a72('0x13')]},{'unique':!![],'name':_0x3a72('0x14'),'fields':[_0x3a72('0xb'),_0x3a72('0x15')]},{'unique':!![],'name':_0x3a72('0x16'),'fields':[_0x3a72('0xb'),_0x3a72('0x17')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2319=['rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','OpenchannelAccountId','WhatsappAccountId','api','request-promise'];(function(_0x4b44f4,_0x262e34){var _0x1f4c31=function(_0x227337){while(--_0x227337){_0x4b44f4['push'](_0x4b44f4['shift']());}};_0x1f4c31(++_0x262e34);}(_0x2319,0x116));var _0x9231=function(_0x3e7f4c,_0x1666eb){_0x3e7f4c=_0x3e7f4c-0x0;var _0x19cbfb=_0x2319[_0x3e7f4c];return _0x19cbfb;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x9231('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9231('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9231('0x2'));var config=require(_0x9231('0x3'));var attributes=require(_0x9231('0x4'));module[_0x9231('0x5')]=function(_0x1255c1,_0x1f9ca8){return _0x1255c1[_0x9231('0x6')](_0x9231('0x7'),attributes,{'tableName':_0x9231('0x8'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x9231('0x9'),'fields':[_0x9231('0xa'),_0x9231('0xb')]},{'unique':!![],'name':_0x9231('0xc'),'fields':[_0x9231('0xa'),'ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':['name',_0x9231('0xd')]},{'unique':!![],'name':_0x9231('0xe'),'fields':[_0x9231('0xa'),_0x9231('0xf')]},{'unique':!![],'name':_0x9231('0x10'),'fields':[_0x9231('0xa'),_0x9231('0x11')]},{'unique':!![],'name':'name_openchannel','fields':['name',_0x9231('0x12')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x9231('0xa'),_0x9231('0x13')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index d41951a..1d45ed1 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(_0x551e3a,_0x37d753){var _0x26dd9f=function(_0x2259e6){while(--_0x2259e6){_0x551e3a['push'](_0x551e3a['shift']());}};_0x26dd9f(++_0x37d753);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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(_0x1682e2,_0x56baa9){var _0x47817f=function(_0x1e3242){while(--_0x1e3242){_0x1682e2['push'](_0x1682e2['shift']());}};_0x47817f(++_0x56baa9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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 d705228..51c07d9 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 _0x6adb=['/:id','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./disposition.controller','get','isAuthenticated'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x6adb,0x105));var _0xb6ad=function(_0x2fe5b9,_0x127e48){_0x2fe5b9=_0x2fe5b9-0x0;var _0x6f874=_0x6adb[_0x2fe5b9];return _0x6f874;};'use strict';var multer=require(_0xb6ad('0x0'));var util=require(_0xb6ad('0x1'));var path=require(_0xb6ad('0x2'));var timeout=require(_0xb6ad('0x3'));var express=require('express');var router=express[_0xb6ad('0x4')]();var fs_extra=require(_0xb6ad('0x5'));var auth=require(_0xb6ad('0x6'));var interaction=require(_0xb6ad('0x7'));var config=require('../../config/environment');var controller=require(_0xb6ad('0x8'));router[_0xb6ad('0x9')]('/',auth[_0xb6ad('0xa')](),controller['index']);router['get'](_0xb6ad('0xb'),auth[_0xb6ad('0xa')](),controller['show']);router['post']('/',auth[_0xb6ad('0xa')](),controller[_0xb6ad('0xc')]);router[_0xb6ad('0xd')](_0xb6ad('0xb'),auth[_0xb6ad('0xa')](),controller['update']);router[_0xb6ad('0xe')](_0xb6ad('0xb'),auth[_0xb6ad('0xa')](),controller[_0xb6ad('0xf')]);module[_0xb6ad('0x10')]=router; \ No newline at end of file +var _0x08b4=['Router','fs-extra','../../config/environment','./disposition.controller','get','index','/:id','isAuthenticated','show','post','create','put','exports','multer','util','path','connect-timeout','express'];(function(_0x27f39d,_0x5efee5){var _0x355e1e=function(_0x55afce){while(--_0x55afce){_0x27f39d['push'](_0x27f39d['shift']());}};_0x355e1e(++_0x5efee5);}(_0x08b4,0x67));var _0x408b=function(_0xda6d0f,_0x35e271){_0xda6d0f=_0xda6d0f-0x0;var _0x244540=_0x08b4[_0xda6d0f];return _0x244540;};'use strict';var multer=require(_0x408b('0x0'));var util=require(_0x408b('0x1'));var path=require(_0x408b('0x2'));var timeout=require(_0x408b('0x3'));var express=require(_0x408b('0x4'));var router=express[_0x408b('0x5')]();var fs_extra=require(_0x408b('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x408b('0x7'));var controller=require(_0x408b('0x8'));router[_0x408b('0x9')]('/',auth['isAuthenticated'](),controller[_0x408b('0xa')]);router[_0x408b('0x9')](_0x408b('0xb'),auth[_0x408b('0xc')](),controller[_0x408b('0xd')]);router[_0x408b('0xe')]('/',auth[_0x408b('0xc')](),controller[_0x408b('0xf')]);router[_0x408b('0x10')](_0x408b('0xb'),auth[_0x408b('0xc')](),controller['update']);router['delete']('/:id',auth[_0x408b('0xc')](),controller['destroy']);module[_0x408b('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 61a74ac..fa6670f 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 _0xb223=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','localstationid','2400','4800','9600','12000','14400','7200','SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x529958,_0x2a717d){var _0x589d45=function(_0x4688fa){while(--_0x4688fa){_0x529958['push'](_0x529958['shift']());}};_0x589d45(++_0x2a717d);}(_0xb223,0x1e4));var _0x3b22=function(_0x59d764,_0x290d7a){_0x59d764=_0x59d764-0x0;var _0x1d02af=_0xb223[_0x59d764];return _0x1d02af;};'use strict';var Sequelize=require(_0x3b22('0x0'));module[_0x3b22('0x1')]={'name':{'type':Sequelize[_0x3b22('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3b22('0x2')]},'ecm':{'type':Sequelize[_0x3b22('0x3')](_0x3b22('0x4'),'no'),'defaultValue':_0x3b22('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x3b22('0x2')],'unique':_0x3b22('0x5')},'minrate':{'type':Sequelize[_0x3b22('0x3')](_0x3b22('0x6'),_0x3b22('0x7'),'7200',_0x3b22('0x8'),_0x3b22('0x9'),_0x3b22('0xa')),'defaultValue':_0x3b22('0x7')},'maxrate':{'type':Sequelize[_0x3b22('0x3')](_0x3b22('0x6'),_0x3b22('0x7'),_0x3b22('0xb'),_0x3b22('0x8'),_0x3b22('0x9'),_0x3b22('0xa')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x3b22('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x3b22('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x3b22('0x3')](_0x3b22('0xc'),_0x3b22('0xd'),_0x3b22('0xe'),'KHOMP'),'defaultValue':'SIP'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x3b22('0xf')],'defaultValue':function(){return _0x3b22('0x10');}},'notificationSound':{'type':Sequelize[_0x3b22('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3b22('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3b22('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3b22('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3b22('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3b22('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x3b22('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x3b22('0x11')],'defaultValue':![],'comment':_0x3b22('0x14'),'set':function(_0x4f1e56){if(!_0x4f1e56)this[_0x3b22('0x15')](_0x3b22('0x16'),null);this[_0x3b22('0x15')](_0x3b22('0x17'),_0x4f1e56);}}}; \ No newline at end of file +var _0x42a2=['localstationid','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','setDataValue','mandatoryDispositionPauseId','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x42a2,0x163));var _0x242a=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x42a2[_0x599f41];return _0x2e4d58;};'use strict';var Sequelize=require(_0x242a('0x0'));module['exports']={'name':{'type':Sequelize[_0x242a('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x242a('0x1')]},'ecm':{'type':Sequelize[_0x242a('0x2')](_0x242a('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x242a('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x242a('0x5')},'minrate':{'type':Sequelize[_0x242a('0x2')](_0x242a('0x6'),_0x242a('0x7'),_0x242a('0x8'),_0x242a('0x9'),_0x242a('0xa'),'14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x242a('0x2')](_0x242a('0x6'),_0x242a('0x7'),_0x242a('0x8'),_0x242a('0x9'),_0x242a('0xa'),_0x242a('0xb')),'defaultValue':_0x242a('0xb')},'modem':{'type':Sequelize[_0x242a('0x1')],'defaultValue':_0x242a('0xc')},'gateway':{'type':Sequelize[_0x242a('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x242a('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x242a('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x242a('0x2')](_0x242a('0xe'),_0x242a('0xf'),_0x242a('0x10'),_0x242a('0x11')),'defaultValue':_0x242a('0xe')},'key':{'type':Sequelize[_0x242a('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x242a('0x12')],'defaultValue':function(){return _0x242a('0x13');}},'notificationSound':{'type':Sequelize[_0x242a('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x242a('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x242a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x242a('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x242a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x242a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x242a('0x15')},'mandatoryDisposition':{'type':Sequelize[_0x242a('0x14')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x14d43b){if(!_0x14d43b)this[_0x242a('0x16')](_0x242a('0x17'),null);this[_0x242a('0x16')]('mandatoryDisposition',_0x14d43b);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index bf8cc23..73eb208 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 _0xde89=['createdAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','List','Contacts','DESC','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','CmContact','List\x20not\x20found','user','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','isArray','userFaxAccount:remove','emit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','FaxAccounts','name','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','FaxAccount','includeAll','findAll','rows','params','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','pick','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','nolimit','removeAnswers','addInteraction','FaxInteraction','getInteractions','Contact','User','Owner','Tag','Tags','color','tag','sequelize','transaction','Transaction','READ_COMMITTED','FaxApplication','findAndCountAll','stack','finally','send','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','priority','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','VoiceExtension','updateAccountApplications','bulkCreate'];(function(_0x8f6906,_0x1c4fe6){var _0x493cd9=function(_0x48bff6){while(--_0x48bff6){_0x8f6906['push'](_0x8f6906['shift']());}};_0x493cd9(++_0x1c4fe6);}(_0xde89,0x1ad));var _0x9de8=function(_0x30bd4d,_0x50eb60){_0x30bd4d=_0x30bd4d-0x0;var _0x306915=_0xde89[_0x30bd4d];return _0x306915;};'use strict';var emlformat=require(_0x9de8('0x0'));var rimraf=require(_0x9de8('0x1'));var zipdir=require(_0x9de8('0x2'));var jsonpatch=require(_0x9de8('0x3'));var rp=require('request-promise');var moment=require(_0x9de8('0x4'));var BPromise=require(_0x9de8('0x5'));var Mustache=require(_0x9de8('0x6'));var util=require(_0x9de8('0x7'));var path=require(_0x9de8('0x8'));var sox=require(_0x9de8('0x9'));var csv=require(_0x9de8('0xa'));var ejs=require(_0x9de8('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9de8('0xc'));var squel=require(_0x9de8('0xd'));var crypto=require(_0x9de8('0xe'));var jsforce=require(_0x9de8('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x9de8('0xa'));var querystring=require(_0x9de8('0x10'));var Papa=require(_0x9de8('0x11'));var Redis=require(_0x9de8('0x12'));var authService=require(_0x9de8('0x13'));var qs=require(_0x9de8('0x14'));var as=require(_0x9de8('0x15'));var hardwareService=require(_0x9de8('0x16'));var logger=require(_0x9de8('0x17'))('api');var utils=require(_0x9de8('0x18'));var config=require(_0x9de8('0x19'));var licenseUtil=require(_0x9de8('0x1a'));var db=require(_0x9de8('0x1b'))['db'];config[_0x9de8('0x1c')]=_[_0x9de8('0x1d')](config[_0x9de8('0x1c')],{'host':_0x9de8('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9de8('0x1c')]));require('./faxAccount.socket')[_0x9de8('0x1f')](socket);var jayson=require(_0x9de8('0x20'));var client=jayson[_0x9de8('0x21')][_0x9de8('0x22')]({'port':0x232c});var client9002=jayson[_0x9de8('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc569fe,_0x4a96c6,_0x455f2f,_0x538d14){return new BPromise(function(_0x59be01,_0x474c7c){var _0x2694f6=_0x538d14||client;return _0x2694f6['request'](_0xc569fe,_0x455f2f)[_0x9de8('0x23')](function(_0x59be93){logger['info'](_0x9de8('0x24'),_0x4a96c6,_0x9de8('0x25'));logger[_0x9de8('0x26')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x4a96c6,_0x9de8('0x25'),JSON[_0x9de8('0x27')](_0x59be93));if(_0x59be93[_0x9de8('0x28')]){if(_0x59be93[_0x9de8('0x28')][_0x9de8('0x29')]===0x1f4){logger['error'](_0x9de8('0x24'),_0x4a96c6,_0x59be93['error']['message']);return _0x474c7c(_0x59be93[_0x9de8('0x28')][_0x9de8('0x2a')]);}logger['error'](_0x9de8('0x24'),_0x4a96c6,_0x59be93[_0x9de8('0x28')][_0x9de8('0x2a')]);return _0x59be01(_0x59be93[_0x9de8('0x28')][_0x9de8('0x2a')]);}else{logger[_0x9de8('0x2b')]('FaxAccount,\x20%s,\x20%s',_0x4a96c6,_0x9de8('0x25'));_0x59be01(_0x59be93['result']['message']);}})[_0x9de8('0x2c')](function(_0x105fbd){logger[_0x9de8('0x28')](_0x9de8('0x24'),_0x4a96c6,_0x105fbd);_0x474c7c(_0x105fbd);});});}function respondWithStatusCode(_0x1f9a38,_0x5e8c5b){_0x5e8c5b=_0x5e8c5b||0xcc;return function(_0xf2fa11){if(_0xf2fa11){return _0x1f9a38[_0x9de8('0x2d')](_0x5e8c5b);}return _0x1f9a38['status'](_0x5e8c5b)[_0x9de8('0x2e')]();};}function respondWithResult(_0x4bec5d,_0x2c174c){_0x2c174c=_0x2c174c||0xc8;return function(_0x11c3ad){if(_0x11c3ad){return _0x4bec5d[_0x9de8('0x2f')](_0x2c174c)[_0x9de8('0x30')](_0x11c3ad);}};}function respondWithFilteredResult(_0x329d1a,_0xf4ecec){return function(_0x51803d){if(_0x51803d){var _0x1b1faf=typeof _0xf4ecec[_0x9de8('0x31')]===_0x9de8('0x32')&&typeof _0xf4ecec[_0x9de8('0x33')]===_0x9de8('0x32');var _0x993bfc=_0x51803d[_0x9de8('0x34')];var _0x2eced5=_0x1b1faf?0x0:_0xf4ecec[_0x9de8('0x31')];var _0x2556a8=_0x1b1faf?_0x51803d[_0x9de8('0x34')]:_0xf4ecec[_0x9de8('0x31')]+_0xf4ecec[_0x9de8('0x33')];var _0x5deb2d;if(_0x2556a8>=_0x993bfc){_0x2556a8=_0x993bfc;_0x5deb2d=0xc8;}else{_0x5deb2d=0xce;}_0x329d1a['status'](_0x5deb2d);return _0x329d1a[_0x9de8('0x35')](_0x9de8('0x36'),_0x2eced5+'-'+_0x2556a8+'/'+_0x993bfc)[_0x9de8('0x30')](_0x51803d);}return null;};}function patchUpdates(_0x33a8dd){return function(_0x4346da){try{jsonpatch[_0x9de8('0x37')](_0x4346da,_0x33a8dd,!![]);}catch(_0x28177d){return BPromise['reject'](_0x28177d);}return _0x4346da['save']();};}function saveUpdates(_0x4d55fe,_0x18b5ef){return function(_0x143bdc){if(_0x143bdc){return _0x143bdc[_0x9de8('0x38')](_0x4d55fe)[_0x9de8('0x23')](function(_0x57dc6c){return _0x57dc6c;});}return null;};}function removeEntity(_0x27b112,_0x38958a){return function(_0x549b66){if(_0x549b66){return _0x549b66[_0x9de8('0x39')]()['then'](function(){var _0x5603e5=_0x549b66['get']({'plain':!![]});var _0x2c77ed=_0x9de8('0x3a');return db['UserProfileResource'][_0x9de8('0x39')]({'where':{'type':_0x2c77ed,'resourceId':_0x5603e5['id']}})[_0x9de8('0x23')](function(){return _0x549b66;});})['then'](function(){_0x27b112[_0x9de8('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a6cc9,_0x260212){return function(_0x1b6abe){if(!_0x1b6abe){_0x3a6cc9[_0x9de8('0x2d')](0x194);}return _0x1b6abe;};}function handleError(_0xa85e62,_0x54061b){_0x54061b=_0x54061b||0x1f4;return function(_0x59c282){logger['error'](_0x59c282['stack']);if(_0x59c282[_0x9de8('0x3b')]){delete _0x59c282[_0x9de8('0x3b')];}_0xa85e62['status'](_0x54061b)['send'](_0x59c282);};}exports['index']=function(_0x16af3a,_0x23b910){var _0x1e1442={'include':[{'model':db[_0x9de8('0x3c')],'as':_0x9de8('0x3d')}]},_0x36e143={},_0x503f17={'count':0x0,'rows':[]};var _0xbdce6d=_[_0x9de8('0x3e')](db['FaxAccount'][_0x9de8('0x3f')],function(_0x37c348){return{'name':_0x37c348[_0x9de8('0x40')],'type':_0x37c348[_0x9de8('0x41')][_0x9de8('0x42')]};});_0x36e143[_0x9de8('0x43')]=_['map'](_0xbdce6d,_0x9de8('0x3b'));_0x36e143[_0x9de8('0x44')]=_[_0x9de8('0x45')](_0x16af3a[_0x9de8('0x44')]);_0x36e143[_0x9de8('0x46')]=_[_0x9de8('0x47')](_0x36e143[_0x9de8('0x43')],_0x36e143[_0x9de8('0x44')]);_0x1e1442[_0x9de8('0x48')]=_[_0x9de8('0x47')](_0x36e143[_0x9de8('0x43')],qs[_0x9de8('0x49')](_0x16af3a[_0x9de8('0x44')][_0x9de8('0x49')]));_0x1e1442[_0x9de8('0x48')]=_0x1e1442[_0x9de8('0x48')][_0x9de8('0x4a')]?_0x1e1442[_0x9de8('0x48')]:_0x36e143[_0x9de8('0x43')];if(!_0x16af3a[_0x9de8('0x44')][_0x9de8('0x4b')]('nolimit')){_0x1e1442[_0x9de8('0x33')]=qs['limit'](_0x16af3a[_0x9de8('0x44')]['limit']);_0x1e1442[_0x9de8('0x31')]=qs[_0x9de8('0x31')](_0x16af3a[_0x9de8('0x44')][_0x9de8('0x31')]);}_0x1e1442[_0x9de8('0x4c')]=qs[_0x9de8('0x4d')](_0x16af3a[_0x9de8('0x44')][_0x9de8('0x4d')]);_0x1e1442[_0x9de8('0x4e')]=qs['filters'](_['pick'](_0x16af3a['query'],_0x36e143['filters']),_0xbdce6d);if(_0x16af3a[_0x9de8('0x44')][_0x9de8('0x4f')]){_0x1e1442[_0x9de8('0x4e')]=_[_0x9de8('0x50')](_0x1e1442['where'],{'$or':_[_0x9de8('0x3e')](_0xbdce6d,function(_0x4328da){if(_0x4328da[_0x9de8('0x41')]!=='VIRTUAL'){var _0x4ecef9={};_0x4ecef9[_0x4328da[_0x9de8('0x3b')]]={'$like':'%'+_0x16af3a['query'][_0x9de8('0x4f')]+'%'};return _0x4ecef9;}})});}_0x1e1442=_[_0x9de8('0x50')]({},_0x1e1442,_0x16af3a[_0x9de8('0x51')]);var _0x29787a={'where':_0x1e1442['where']};return db[_0x9de8('0x52')]['count'](_0x29787a)['then'](function(_0x4cb304){_0x503f17['count']=_0x4cb304;if(_0x16af3a[_0x9de8('0x44')][_0x9de8('0x53')]){_0x1e1442['include']=[{'all':!![]}];}return db[_0x9de8('0x52')][_0x9de8('0x54')](_0x1e1442);})[_0x9de8('0x23')](function(_0x498f24){_0x503f17[_0x9de8('0x55')]=_0x498f24;return _0x503f17;})['then'](respondWithFilteredResult(_0x23b910,_0x1e1442))[_0x9de8('0x2c')](handleError(_0x23b910,null));};exports['show']=function(_0x41570c,_0x5c59a3){var _0x1c69d3={'raw':![],'where':{'id':_0x41570c[_0x9de8('0x56')]['id']},'include':[{'model':db[_0x9de8('0x3c')],'as':_0x9de8('0x3d')}]},_0x46ff15={};_0x46ff15['model']=_[_0x9de8('0x45')](db[_0x9de8('0x52')]['rawAttributes']);_0x46ff15[_0x9de8('0x44')]=_[_0x9de8('0x45')](_0x41570c[_0x9de8('0x44')]);_0x46ff15['filters']=_[_0x9de8('0x47')](_0x46ff15[_0x9de8('0x43')],_0x46ff15['query']);_0x1c69d3[_0x9de8('0x48')]=_[_0x9de8('0x47')](_0x46ff15[_0x9de8('0x43')],qs['fields'](_0x41570c['query'][_0x9de8('0x49')]));_0x1c69d3[_0x9de8('0x48')]=_0x1c69d3[_0x9de8('0x48')]['length']?_0x1c69d3[_0x9de8('0x48')]:_0x46ff15[_0x9de8('0x43')];if(_0x41570c['query'][_0x9de8('0x53')]){_0x1c69d3[_0x9de8('0x57')]=[{'all':!![]}];}_0x1c69d3=_[_0x9de8('0x50')]({},_0x1c69d3,_0x41570c[_0x9de8('0x51')]);return db[_0x9de8('0x52')][_0x9de8('0x58')](_0x1c69d3)['then'](handleEntityNotFound(_0x5c59a3,null))[_0x9de8('0x23')](respondWithResult(_0x5c59a3,null))['catch'](handleError(_0x5c59a3,null));};exports['create']=function(_0x1763d4,_0x3b07ae){return db[_0x9de8('0x52')][_0x9de8('0x59')](_0x1763d4[_0x9de8('0x5a')],{})[_0x9de8('0x23')](function(_0x4af0c8){var _0x49ad96=_0x1763d4['user'][_0x9de8('0x5b')]({'plain':!![]});if(!_0x49ad96)throw new Error(_0x9de8('0x5c'));if(_0x49ad96[_0x9de8('0x5d')]==='user'){var _0x4bd7f1=_0x4af0c8[_0x9de8('0x5b')]({'plain':!![]});var _0x22b5ca=_0x9de8('0x3a');return db[_0x9de8('0x5e')]['find']({'where':{'name':_0x22b5ca,'userProfileId':_0x49ad96[_0x9de8('0x5f')]},'raw':!![]})[_0x9de8('0x23')](function(_0x38ac78){if(_0x38ac78&&_0x38ac78['autoAssociation']===0x0){return db[_0x9de8('0x60')][_0x9de8('0x59')]({'name':_0x4bd7f1[_0x9de8('0x3b')],'resourceId':_0x4bd7f1['id'],'type':_0x38ac78['name'],'sectionId':_0x38ac78['id']},{})[_0x9de8('0x23')](function(){return _0x4af0c8;});}else{return _0x4af0c8;}})['catch'](function(_0x50a435){logger[_0x9de8('0x28')](_0x9de8('0x61'),_0x50a435);throw _0x50a435;});}return _0x4af0c8;})[_0x9de8('0x23')](respondWithResult(_0x3b07ae,0xc9))[_0x9de8('0x2c')](handleError(_0x3b07ae,null));};exports[_0x9de8('0x38')]=function(_0x404af9,_0x5aae0d){if(_0x404af9[_0x9de8('0x5a')]['id']){delete _0x404af9[_0x9de8('0x5a')]['id'];}return db['FaxAccount'][_0x9de8('0x58')]({'where':{'id':_0x404af9[_0x9de8('0x56')]['id']},'include':[{'model':db[_0x9de8('0x3c')],'as':_0x9de8('0x3d')}]})[_0x9de8('0x23')](handleEntityNotFound(_0x5aae0d,null))['then'](saveUpdates(_0x404af9['body'],null))[_0x9de8('0x23')](respondWithResult(_0x5aae0d,null))['catch'](handleError(_0x5aae0d,null));};exports['destroy']=function(_0x337ea6,_0x29f452){return db[_0x9de8('0x52')][_0x9de8('0x58')]({'where':{'id':_0x337ea6[_0x9de8('0x56')]['id']}})[_0x9de8('0x23')](handleEntityNotFound(_0x29f452,null))[_0x9de8('0x23')](removeEntity(_0x29f452,null))[_0x9de8('0x2c')](handleError(_0x29f452,null));};exports['describe']=function(_0x5e537d,_0xb94cbf){return db[_0x9de8('0x52')][_0x9de8('0x62')]()[_0x9de8('0x23')](respondWithResult(_0xb94cbf,null))['catch'](handleError(_0xb94cbf,null));};exports[_0x9de8('0x63')]=function(_0x29dd75,_0x961cf3,_0x2f161){if(_0x29dd75[_0x9de8('0x5a')]['id']){delete _0x29dd75['body']['id'];}return db[_0x9de8('0x52')][_0x9de8('0x58')]({'where':{'id':_0x29dd75['params']['id']}})['then'](handleEntityNotFound(_0x961cf3,null))[_0x9de8('0x23')](function(_0x5ee8b3){if(_0x5ee8b3){_0x29dd75[_0x9de8('0x5a')][_0x9de8('0x64')]=_0x5ee8b3['id'];return db[_0x9de8('0x65')][_0x9de8('0x59')](_0x29dd75[_0x9de8('0x5a')]);}})[_0x9de8('0x23')](respondWithResult(_0x961cf3,null))[_0x9de8('0x2c')](handleError(_0x961cf3,null));};exports[_0x9de8('0x66')]=function(_0x57d122,_0x2b20c7,_0x47f664){var _0x48195a={'raw':![],'where':{}};var _0xc28d5={};var _0x3b3445={'count':0x0,'rows':[]};return db[_0x9de8('0x52')][_0x9de8('0x67')]({'where':{'id':_0x57d122[_0x9de8('0x56')]['id']}})[_0x9de8('0x23')](handleEntityNotFound(_0x2b20c7,null))['then'](function(_0x4331b8){if(_0x4331b8){_0xc28d5[_0x9de8('0x43')]=_['keys'](db['Disposition']['rawAttributes']);_0xc28d5[_0x9de8('0x44')]=_[_0x9de8('0x45')](_0x57d122['query']);_0xc28d5[_0x9de8('0x46')]=_[_0x9de8('0x47')](_0xc28d5[_0x9de8('0x43')],_0xc28d5[_0x9de8('0x44')]);_0x48195a[_0x9de8('0x48')]=_[_0x9de8('0x47')](_0xc28d5[_0x9de8('0x43')],qs[_0x9de8('0x49')](_0x57d122['query'][_0x9de8('0x49')]));_0x48195a[_0x9de8('0x48')]=_0x48195a[_0x9de8('0x48')][_0x9de8('0x4a')]?_0x48195a['attributes']:_0xc28d5[_0x9de8('0x43')];if(!_0x57d122[_0x9de8('0x44')][_0x9de8('0x4b')]('nolimit')){_0x48195a[_0x9de8('0x33')]=qs[_0x9de8('0x33')](_0x57d122['query'][_0x9de8('0x33')]);_0x48195a['offset']=qs['offset'](_0x57d122[_0x9de8('0x44')][_0x9de8('0x31')]);}_0x48195a[_0x9de8('0x4c')]=qs[_0x9de8('0x4d')](_0x57d122['query']['sort']);_0x48195a[_0x9de8('0x4e')]=qs[_0x9de8('0x46')](_[_0x9de8('0x68')](_0x57d122[_0x9de8('0x44')],_0xc28d5[_0x9de8('0x46')]));_0x48195a[_0x9de8('0x4e')][_0x9de8('0x64')]=_0x4331b8['id'];if(_0x57d122['query'][_0x9de8('0x4f')]){_0x48195a['where']=_['merge'](_0x48195a[_0x9de8('0x4e')],{'$or':_[_0x9de8('0x3e')](_0x48195a[_0x9de8('0x48')],function(_0x13eb65){var _0x4e72c9={};_0x4e72c9[_0x13eb65]={'$like':'%'+_0x57d122['query'][_0x9de8('0x4f')]+'%'};return _0x4e72c9;})});}_0x48195a=_['merge']({},_0x48195a,_0x57d122[_0x9de8('0x51')]);return db['Disposition']['count']({'where':_0x48195a['where']})[_0x9de8('0x23')](function(_0x2768af){_0x3b3445[_0x9de8('0x34')]=_0x2768af;if(_0x57d122[_0x9de8('0x44')]['includeAll']){_0x48195a[_0x9de8('0x57')]=[{'all':!![]}];}return db[_0x9de8('0x65')][_0x9de8('0x54')](_0x48195a);})[_0x9de8('0x23')](function(_0x575a85){_0x3b3445[_0x9de8('0x55')]=_0x575a85;return _0x3b3445;});}})['then'](respondWithFilteredResult(_0x2b20c7,_0x48195a))['catch'](handleError(_0x2b20c7,null));};exports[_0x9de8('0x69')]=function(_0x224ba3,_0x42bff1,_0x204f81){return db[_0x9de8('0x52')]['find']({'where':{'id':_0x224ba3['params']['id']}})[_0x9de8('0x23')](handleEntityNotFound(_0x42bff1,null))[_0x9de8('0x23')](function(_0x1fe23){if(_0x1fe23){return _0x1fe23[_0x9de8('0x69')](_0x224ba3[_0x9de8('0x44')][_0x9de8('0x6a')]);}})[_0x9de8('0x23')](respondWithStatusCode(_0x42bff1,null))[_0x9de8('0x2c')](handleError(_0x42bff1,null));};exports[_0x9de8('0x6b')]=function(_0x5647cb,_0x2be5f2,_0x557a1e){if(_0x5647cb['body']['id']){delete _0x5647cb[_0x9de8('0x5a')]['id'];}return db[_0x9de8('0x52')][_0x9de8('0x58')]({'where':{'id':_0x5647cb[_0x9de8('0x56')]['id']}})[_0x9de8('0x23')](handleEntityNotFound(_0x2be5f2,null))['then'](function(_0x4b7f7c){if(_0x4b7f7c){_0x5647cb[_0x9de8('0x5a')]['FaxAccountId']=_0x4b7f7c['id'];return db['CannedAnswer'][_0x9de8('0x59')](_0x5647cb[_0x9de8('0x5a')]);}})[_0x9de8('0x23')](respondWithResult(_0x2be5f2,null))[_0x9de8('0x2c')](handleError(_0x2be5f2,null));};exports[_0x9de8('0x6c')]=function(_0x2263ad,_0x8cb041,_0x3c9ee0){var _0x52edd0={'raw':![],'where':{}};var _0x861371={};var _0x1f0b8a={'count':0x0,'rows':[]};return db['FaxAccount'][_0x9de8('0x67')]({'where':{'id':_0x2263ad[_0x9de8('0x56')]['id']}})[_0x9de8('0x23')](handleEntityNotFound(_0x8cb041,null))[_0x9de8('0x23')](function(_0x325844){if(_0x325844){_0x861371[_0x9de8('0x43')]=_[_0x9de8('0x45')](db[_0x9de8('0x6d')][_0x9de8('0x3f')]);_0x861371[_0x9de8('0x44')]=_[_0x9de8('0x45')](_0x2263ad[_0x9de8('0x44')]);_0x861371[_0x9de8('0x46')]=_['intersection'](_0x861371['model'],_0x861371[_0x9de8('0x44')]);_0x52edd0['attributes']=_[_0x9de8('0x47')](_0x861371[_0x9de8('0x43')],qs[_0x9de8('0x49')](_0x2263ad['query']['fields']));_0x52edd0[_0x9de8('0x48')]=_0x52edd0[_0x9de8('0x48')][_0x9de8('0x4a')]?_0x52edd0[_0x9de8('0x48')]:_0x861371[_0x9de8('0x43')];if(!_0x2263ad[_0x9de8('0x44')][_0x9de8('0x4b')](_0x9de8('0x6e'))){_0x52edd0['limit']=qs[_0x9de8('0x33')](_0x2263ad[_0x9de8('0x44')][_0x9de8('0x33')]);_0x52edd0['offset']=qs[_0x9de8('0x31')](_0x2263ad[_0x9de8('0x44')][_0x9de8('0x31')]);}_0x52edd0[_0x9de8('0x4c')]=qs[_0x9de8('0x4d')](_0x2263ad[_0x9de8('0x44')][_0x9de8('0x4d')]);_0x52edd0[_0x9de8('0x4e')]=qs['filters'](_[_0x9de8('0x68')](_0x2263ad[_0x9de8('0x44')],_0x861371[_0x9de8('0x46')]));_0x52edd0[_0x9de8('0x4e')][_0x9de8('0x64')]=_0x325844['id'];if(_0x2263ad[_0x9de8('0x44')]['filter']){_0x52edd0[_0x9de8('0x4e')]=_[_0x9de8('0x50')](_0x52edd0[_0x9de8('0x4e')],{'$or':_[_0x9de8('0x3e')](_0x52edd0[_0x9de8('0x48')],function(_0x1d6de1){var _0x5b1961={};_0x5b1961[_0x1d6de1]={'$like':'%'+_0x2263ad[_0x9de8('0x44')][_0x9de8('0x4f')]+'%'};return _0x5b1961;})});}_0x52edd0=_[_0x9de8('0x50')]({},_0x52edd0,_0x2263ad[_0x9de8('0x51')]);return db[_0x9de8('0x6d')]['count']({'where':_0x52edd0[_0x9de8('0x4e')]})['then'](function(_0x3fd6ff){_0x1f0b8a[_0x9de8('0x34')]=_0x3fd6ff;if(_0x2263ad[_0x9de8('0x44')]['includeAll']){_0x52edd0[_0x9de8('0x57')]=[{'all':!![]}];}return db[_0x9de8('0x6d')][_0x9de8('0x54')](_0x52edd0);})['then'](function(_0x30c890){_0x1f0b8a[_0x9de8('0x55')]=_0x30c890;return _0x1f0b8a;});}})[_0x9de8('0x23')](respondWithFilteredResult(_0x8cb041,_0x52edd0))[_0x9de8('0x2c')](handleError(_0x8cb041,null));};exports[_0x9de8('0x6f')]=function(_0x3bc93f,_0x24dbc2,_0x128cd6){return db[_0x9de8('0x52')][_0x9de8('0x58')]({'where':{'id':_0x3bc93f['params']['id']}})[_0x9de8('0x23')](handleEntityNotFound(_0x24dbc2,null))[_0x9de8('0x23')](function(_0x19bfdd){if(_0x19bfdd){return _0x19bfdd[_0x9de8('0x6f')](_0x3bc93f[_0x9de8('0x44')]['ids']);}})['then'](respondWithStatusCode(_0x24dbc2,null))[_0x9de8('0x2c')](handleError(_0x24dbc2,null));};exports[_0x9de8('0x70')]=function(_0x417854,_0x1a7d46,_0x53dfb9){return db[_0x9de8('0x71')][_0x9de8('0x58')]({'where':{'id':_0x417854[_0x9de8('0x56')]['id']}})[_0x9de8('0x23')](handleEntityNotFound(_0x1a7d46,null))[_0x9de8('0x23')](function(_0x5a9c06){if(_0x5a9c06){return _0x5a9c06[_0x9de8('0x70')](_0x417854[_0x9de8('0x5a')][_0x9de8('0x6a')],_['omit'](_0x417854[_0x9de8('0x5a')],[_0x9de8('0x6a'),'id'])||{});}})[_0x9de8('0x23')](respondWithResult(_0x1a7d46,null))[_0x9de8('0x2c')](handleError(_0x1a7d46,null));};exports[_0x9de8('0x72')]=function(_0xf4f384,_0x1822ed,_0x6f4dbe){var _0x534cc3={'raw':![],'where':{}};var _0x4cd26b={};var _0x498237={'count':0x0,'rows':[]};return db[_0x9de8('0x52')][_0x9de8('0x67')]({'where':{'id':_0xf4f384['params']['id']}})[_0x9de8('0x23')](handleEntityNotFound(_0x1822ed,null))[_0x9de8('0x23')](function(_0x276456){if(_0x276456){_0x4cd26b['model']=_[_0x9de8('0x45')](db['FaxInteraction'][_0x9de8('0x3f')]);_0x4cd26b['query']=_['keys'](_0xf4f384[_0x9de8('0x44')]);_0x4cd26b['filters']=_[_0x9de8('0x47')](_0x4cd26b[_0x9de8('0x43')],_0x4cd26b[_0x9de8('0x44')]);_0x534cc3[_0x9de8('0x48')]=_['intersection'](_0x4cd26b[_0x9de8('0x43')],qs[_0x9de8('0x49')](_0xf4f384['query'][_0x9de8('0x49')]));_0x534cc3[_0x9de8('0x48')]=_0x534cc3['attributes'][_0x9de8('0x4a')]?_0x534cc3[_0x9de8('0x48')]:_0x4cd26b[_0x9de8('0x43')];if(!_0xf4f384[_0x9de8('0x44')][_0x9de8('0x4b')]('nolimit')){_0x534cc3['limit']=qs[_0x9de8('0x33')](_0xf4f384[_0x9de8('0x44')][_0x9de8('0x33')]);_0x534cc3[_0x9de8('0x31')]=qs[_0x9de8('0x31')](_0xf4f384[_0x9de8('0x44')]['offset']);}_0x534cc3['order']=qs[_0x9de8('0x4d')](_0xf4f384[_0x9de8('0x44')]['sort']);_0x534cc3[_0x9de8('0x4e')]=qs[_0x9de8('0x46')](_[_0x9de8('0x68')](_0xf4f384[_0x9de8('0x44')],_0x4cd26b['filters']));_0x534cc3[_0x9de8('0x4e')][_0x9de8('0x64')]=_0x276456['id'];if(_0xf4f384[_0x9de8('0x44')]['filter']){_0x534cc3[_0x9de8('0x4e')]=_[_0x9de8('0x50')](_0x534cc3[_0x9de8('0x4e')],{'$or':_[_0x9de8('0x3e')](_0x534cc3['attributes'],function(_0x25b4c0){var _0x523423={};_0x523423[_0x25b4c0]={'$like':'%'+_0xf4f384[_0x9de8('0x44')][_0x9de8('0x4f')]+'%'};return _0x523423;})});}_0x534cc3=_[_0x9de8('0x50')]({},_0x534cc3,_0xf4f384[_0x9de8('0x51')]);return db[_0x9de8('0x71')]['count']({'where':_0x534cc3[_0x9de8('0x4e')]})[_0x9de8('0x23')](function(_0x8afd00){_0x498237[_0x9de8('0x34')]=_0x8afd00;if(_0xf4f384[_0x9de8('0x44')][_0x9de8('0x53')]){_0x534cc3['include']=[{'model':db['CmContact'],'as':_0x9de8('0x73'),'required':![]},{'model':db[_0x9de8('0x74')],'as':_0x9de8('0x75'),'attributes':[_0x9de8('0x3b'),'fullname','internal'],'required':![]},{'model':db[_0x9de8('0x76')],'as':_0x9de8('0x77'),'attributes':['id',_0x9de8('0x3b'),_0x9de8('0x78')],'where':_0xf4f384['query'][_0x9de8('0x79')]?{'id':_0xf4f384['query'][_0x9de8('0x79')]}:undefined,'required':_0xf4f384['query'][_0x9de8('0x79')]?!![]:![]}];}return db[_0x9de8('0x71')]['findAll'](_0x534cc3);})['then'](function(_0x37de87){_0x498237[_0x9de8('0x55')]=_0x37de87;return _0x498237;});}})[_0x9de8('0x23')](respondWithFilteredResult(_0x1822ed,_0x534cc3))[_0x9de8('0x2c')](handleError(_0x1822ed,null));};exports['addApplications']=function(_0x26bcee,_0x195f48){var _0x2d5d39=_0x26bcee[_0x9de8('0x56')]['id'];var _0xcb60f9=_0x26bcee[_0x9de8('0x5a')];var _0x9295f8=0xc8;var _0x1dbb1f=null;return db[_0x9de8('0x7a')][_0x9de8('0x7b')]({'isolationLevel':db[_0x9de8('0x7a')][_0x9de8('0x7c')]['ISOLATION_LEVELS'][_0x9de8('0x7d')]},function(_0x42c648){return db['FaxAccount'][_0x9de8('0x67')]({'where':{'id':_0x2d5d39},'transaction':_0x42c648})[_0x9de8('0x23')](function(_0x5d18f2){if(_0x5d18f2){return db[_0x9de8('0x7e')][_0x9de8('0x39')]({'where':{'FaxAccountId':_0x2d5d39},'transaction':_0x42c648})[_0x9de8('0x23')](function(){var _0x5472cc=_[_0x9de8('0x3e')](_0xcb60f9,function(_0x31453b){_0x31453b[_0x9de8('0x64')]=_0x2d5d39;return _0x31453b;});return db[_0x9de8('0x7e')]['bulkCreate'](_0x5472cc,{'transaction':_0x42c648});});}else{_0x9295f8=0x194;_0x1dbb1f=[];}});})[_0x9de8('0x23')](function(){if(_0x9295f8!==0x194){return db[_0x9de8('0x7e')][_0x9de8('0x7f')]({'where':{'FaxAccountId':_0x2d5d39},'order':'priority'})[_0x9de8('0x23')](function(_0x412b43){_0x1dbb1f=_0x412b43;});}})[_0x9de8('0x2c')](function(_0x39b5a0){_0x9295f8=0x1f4;logger[_0x9de8('0x28')](_0x39b5a0[_0x9de8('0x80')]);if(_0x39b5a0['name']){delete _0x39b5a0[_0x9de8('0x3b')];}_0x1dbb1f=_0x39b5a0;})[_0x9de8('0x81')](function(){if(_0x1dbb1f===null){_0x195f48[_0x9de8('0x2d')](_0x9295f8);}else{if(_0x9295f8===0x1f4){_0x195f48[_0x9de8('0x2f')](_0x9295f8)[_0x9de8('0x82')](_0x1dbb1f);}else{_0x195f48[_0x9de8('0x2f')](_0x9295f8)['json'](_0x1dbb1f);}}});};exports[_0x9de8('0x83')]=function(_0x4be769,_0x4f5a64,_0x259e39){var _0x4eb079={};var _0x9e1738={};var _0xd32c8b;var _0x533748;return db[_0x9de8('0x52')][_0x9de8('0x67')]({'where':{'id':_0x4be769[_0x9de8('0x56')]['id']}})['then'](handleEntityNotFound(_0x4f5a64,null))[_0x9de8('0x23')](function(_0x16edf5){if(_0x16edf5){_0xd32c8b=_0x16edf5;_0x9e1738[_0x9de8('0x43')]=_['keys'](db['FaxApplication'][_0x9de8('0x3f')]);_0x9e1738[_0x9de8('0x44')]=_[_0x9de8('0x45')](_0x4be769['query']);_0x9e1738[_0x9de8('0x46')]=_[_0x9de8('0x47')](_0x9e1738[_0x9de8('0x43')],_0x9e1738[_0x9de8('0x44')]);_0x4eb079[_0x9de8('0x48')]=_[_0x9de8('0x47')](_0x9e1738[_0x9de8('0x43')],qs[_0x9de8('0x49')](_0x4be769[_0x9de8('0x44')][_0x9de8('0x49')]));_0x4eb079[_0x9de8('0x48')]=_0x4eb079[_0x9de8('0x48')][_0x9de8('0x4a')]?_0x4eb079[_0x9de8('0x48')]:_0x9e1738[_0x9de8('0x43')];_0x4eb079['order']=qs[_0x9de8('0x4d')](_0x4be769['query'][_0x9de8('0x4d')]);_0x4eb079[_0x9de8('0x4e')]=qs[_0x9de8('0x46')](_[_0x9de8('0x68')](_0x4be769['query'],_0x9e1738[_0x9de8('0x46')]));if(_0x4be769[_0x9de8('0x44')]['filter']){_0x4eb079[_0x9de8('0x4e')]=_[_0x9de8('0x50')](_0x4eb079[_0x9de8('0x4e')],{'$or':_['map'](_0x4eb079[_0x9de8('0x48')],function(_0x429683){var _0x4f5230={};_0x4f5230[_0x429683]={'$like':'%'+_0x4be769[_0x9de8('0x44')][_0x9de8('0x4f')]+'%'};return _0x4f5230;})});}_0x4eb079=_[_0x9de8('0x50')]({},_0x4eb079,_0x4be769[_0x9de8('0x51')]);return _0xd32c8b[_0x9de8('0x83')](_0x4eb079);}})[_0x9de8('0x23')](function(_0x5703e4){if(_0x5703e4){_0x533748=_0x5703e4['length'];if(!_0x4be769[_0x9de8('0x44')]['hasOwnProperty'](_0x9de8('0x6e'))){_0x4eb079[_0x9de8('0x33')]=qs[_0x9de8('0x33')](_0x4be769[_0x9de8('0x44')][_0x9de8('0x33')]);_0x4eb079[_0x9de8('0x31')]=qs['offset'](_0x4be769['query'][_0x9de8('0x31')]);}return _0xd32c8b[_0x9de8('0x83')](_0x4eb079);}})['then'](function(_0x40e1f0){if(_0x40e1f0){return _0x40e1f0?{'count':_0x533748,'rows':_0x40e1f0}:null;}})[_0x9de8('0x23')](respondWithResult(_0x4f5a64,null))[_0x9de8('0x2c')](handleError(_0x4f5a64,null));};function Extension(_0x3b8005,_0x3ab4c3,_0x3e2921,_0x4135e5){this[_0x9de8('0x84')]=_0x9de8('0x85');this[_0x9de8('0x86')]=_0x3b8005[_0x9de8('0x87')];this[_0x9de8('0x88')]=_0x4135e5;this[_0x9de8('0x41')]=_0x9de8('0x89');this[_0x9de8('0x8a')]=_0x9de8('0x8b');this[_0x9de8('0x64')]=_0x3b8005['id'];this[_0x9de8('0x8c')]=_0x3ab4c3;this[_0x9de8('0x8d')]=_0x3e2921;}function createExtensionsReciveFax(_0xe05227){var _0x50a969=0x1;var _0x1bd7a3=[];_0x1bd7a3[_0x9de8('0x8e')](new Extension(_0xe05227,_0x50a969,'',_0x9de8('0x8f')));_0x50a969+=0x1;_0x1bd7a3[_0x9de8('0x8e')](new Extension(_0xe05227,_0x50a969,_0x9de8('0x90'),_0x9de8('0x91')));_0x50a969+=0x1;for(var _0x438b7c in _0xe05227){if(_0xe05227[_0x9de8('0x4b')](_0x438b7c)&&(_0x438b7c===_0x9de8('0x92')||_0x438b7c===_0x9de8('0x87')||_0x438b7c==='gateway'||_0x438b7c==='faxdetect'||_0x438b7c===_0x9de8('0x93')||_0x438b7c===_0x9de8('0x94')||_0x438b7c===_0x9de8('0x95')||_0x438b7c===_0x9de8('0x96')||_0x438b7c===_0x9de8('0x97'))){_0x1bd7a3[_0x9de8('0x8e')](new Extension(_0xe05227,_0x50a969,_0x9de8('0x98')+_0x438b7c+')='+_0xe05227[_0x438b7c],_0x9de8('0x91')));_0x50a969+=0x1;}}_0x1bd7a3[_0x9de8('0x8e')](new Extension(_0xe05227,_0x50a969,'6',_0x9de8('0x99')));_0x50a969+=0x1;_0x1bd7a3['push'](new Extension(_0xe05227,_0x50a969,_0x9de8('0x9a'),_0x9de8('0x9b')));_0x50a969=0x0;return _0x1bd7a3;}exports['addAccountApplications']=function(_0x5725ab,_0x193718,_0x34d765){var _0x2b1d28;return db[_0x9de8('0x7a')][_0x9de8('0x7b')](function(_0x726cc5){return db[_0x9de8('0x52')][_0x9de8('0x59')](_0x5725ab[_0x9de8('0x5a')],{'transaction':_0x726cc5})[_0x9de8('0x23')](function(_0x1f2fec){_0x2b1d28=_0x1f2fec[_0x9de8('0x5b')]({'plain':!![]});return db[_0x9de8('0x9c')]['bulkCreate'](createExtensionsReciveFax(_0x2b1d28),{'transaction':_0x726cc5});});})['then'](function(){return _0x2b1d28;})['then'](respondWithResult(_0x193718,null))['catch'](handleError(_0x193718,null));};exports[_0x9de8('0x9d')]=function(_0x19a41d,_0x35fda4,_0x5d0640){var _0x463e38;return db[_0x9de8('0x7a')][_0x9de8('0x7b')](function(_0x2ca9ce){return db['FaxAccount']['update'](_0x19a41d[_0x9de8('0x5a')],{'where':{'id':_0x19a41d['body']['id']},'transaction':_0x2ca9ce})[_0x9de8('0x23')](function(_0x28fd26){return db['VoiceExtension']['destroy']({'where':{'FaxAccountId':_0x19a41d['body']['id']},'transaction':_0x2ca9ce})[_0x9de8('0x23')](function(_0x4f758b){return db['VoiceExtension'][_0x9de8('0x9e')](createExtensionsReciveFax(_['omit'](_0x19a41d[_0x9de8('0x5a')],['tech',_0x9de8('0x42'),_0x9de8('0x9f'),'updatedAt',_0x9de8('0xa0'),_0x9de8('0xa1')])),{'transaction':_0x2ca9ce});});});})[_0x9de8('0x23')](function(){return db[_0x9de8('0x52')][_0x9de8('0xa2')](_0x19a41d[_0x9de8('0x5a')]['id']);})[_0x9de8('0x23')](respondWithResult(_0x35fda4,null))[_0x9de8('0x2c')](handleError(_0x35fda4,null));};exports[_0x9de8('0xa3')]=function(_0x944f01,_0x57a318,_0xf18657){var _0x3bd72e={'raw':!![],'where':{}};var _0x130987={};var _0x1dd4bf={'count':0x0,'rows':[]};return db[_0x9de8('0x52')][_0x9de8('0x67')]({'where':{'id':_0x944f01[_0x9de8('0x56')]['id']}})[_0x9de8('0x23')](handleEntityNotFound(_0x57a318,null))[_0x9de8('0x23')](function(_0xcd857a){if(_0xcd857a){_0x130987[_0x9de8('0x43')]=_[_0x9de8('0x45')](db[_0x9de8('0xa4')][_0x9de8('0x3f')]);_0x130987[_0x9de8('0x44')]=_[_0x9de8('0x45')](_0x944f01[_0x9de8('0x44')]);_0x130987[_0x9de8('0x46')]=_['intersection'](_0x130987['model'],_0x130987[_0x9de8('0x44')]);_0x3bd72e[_0x9de8('0x48')]=_['intersection'](_0x130987[_0x9de8('0x43')],qs[_0x9de8('0x49')](_0x944f01[_0x9de8('0x44')][_0x9de8('0x49')]));_0x3bd72e[_0x9de8('0x48')]=_0x3bd72e[_0x9de8('0x48')][_0x9de8('0x4a')]?_0x3bd72e[_0x9de8('0x48')]:_0x130987[_0x9de8('0x43')];if(!_0x944f01[_0x9de8('0x44')][_0x9de8('0x4b')](_0x9de8('0x6e'))){_0x3bd72e[_0x9de8('0x33')]=qs[_0x9de8('0x33')](_0x944f01[_0x9de8('0x44')]['limit']);_0x3bd72e[_0x9de8('0x31')]=qs[_0x9de8('0x31')](_0x944f01[_0x9de8('0x44')][_0x9de8('0x31')]);}_0x3bd72e[_0x9de8('0x4c')]=qs[_0x9de8('0x4d')](_0x944f01[_0x9de8('0x44')][_0x9de8('0x4d')]);_0x3bd72e[_0x9de8('0x4e')]=qs[_0x9de8('0x46')](_[_0x9de8('0x68')](_0x944f01[_0x9de8('0x44')],_0x130987['filters']));_0x3bd72e[_0x9de8('0x4e')]['FaxAccountId']=_0xcd857a['id'];if(_0x944f01[_0x9de8('0x44')][_0x9de8('0x4f')]){_0x3bd72e[_0x9de8('0x4e')]=_[_0x9de8('0x50')](_0x3bd72e[_0x9de8('0x4e')],{'$or':_[_0x9de8('0x3e')](_0x3bd72e['attributes'],function(_0x3032b1){var _0x3dbb65={};_0x3dbb65[_0x3032b1]={'$like':'%'+_0x944f01[_0x9de8('0x44')]['filter']+'%'};return _0x3dbb65;})});}if(_0x944f01['query'][_0x9de8('0xa5')]){var _0x3f060d=_0x944f01[_0x9de8('0x44')][_0x9de8('0xa5')]['split'](',');var _0x1b773d={};_0x1b773d[_0x3f060d[0x0]]={'$gte':moment(_0x3f060d[0x1])[_0x9de8('0xa6')](_0x9de8('0xa7'))};_0x3bd72e[_0x9de8('0x4e')]=_['merge'](_0x3bd72e[_0x9de8('0x4e')],_0x1b773d);}_0x3bd72e=_[_0x9de8('0x50')]({},_0x3bd72e,_0x944f01[_0x9de8('0x51')]);return db[_0x9de8('0xa4')][_0x9de8('0x34')]({'where':_0x3bd72e[_0x9de8('0x4e')]})[_0x9de8('0x23')](function(_0x323079){_0x1dd4bf[_0x9de8('0x34')]=_0x323079;if(_0x944f01[_0x9de8('0x44')][_0x9de8('0x53')]){_0x3bd72e[_0x9de8('0x57')]=[{'all':!![]}];}return db[_0x9de8('0xa4')][_0x9de8('0x54')](_0x3bd72e);})[_0x9de8('0x23')](function(_0x2a6968){_0x1dd4bf['rows']=_0x2a6968;return _0x1dd4bf;});}})[_0x9de8('0x23')](respondWithFilteredResult(_0x57a318,_0x3bd72e))[_0x9de8('0x2c')](handleError(_0x57a318,null));};exports[_0x9de8('0x82')]=function(_0x45ed93,_0x82cd96,_0x4dfad9){var _0x4fbeca,_0xe1f1a5={},_0x22c932;if(_0x45ed93['body']['to']){_0x22c932=_0x45ed93[_0x9de8('0x5a')]['to'][0x0];}return db[_0x9de8('0x52')]['find']({'where':{'id':_0x45ed93['params']['id']},'include':[{'model':db['CmList'],'as':_0x9de8('0xa8'),'include':[{'model':db['CmContact'],'as':_0x9de8('0xa9'),'where':{'fax':_0x22c932},'limit':0x1,'order':[['updatedAt',_0x9de8('0xaa')]]}]}]})['then'](handleEntityNotFound(_0x82cd96,null))[_0x9de8('0x23')](function(_0x389f8c){_0x4fbeca=_0x389f8c;if(_0x45ed93[_0x9de8('0x5a')][_0x9de8('0xab')]&&_0x45ed93[_0x9de8('0x5a')][_0x9de8('0xab')][_0x9de8('0x4a')]){for(var _0x33651f=0x0;_0x33651f<_0x45ed93['body']['attachments'][_0x9de8('0x4a')];_0x33651f+=0x1){_0x45ed93[_0x9de8('0x5a')][_0x9de8('0xab')][_0x33651f]={'filename':_0x45ed93['body'][_0x9de8('0xab')][_0x33651f][_0x9de8('0x3b')],'id':_0x45ed93[_0x9de8('0x5a')][_0x9de8('0xab')][_0x33651f]['id'],'path':path[_0x9de8('0xac')](config[_0x9de8('0xad')],_0x9de8('0xae'),_0x45ed93[_0x9de8('0x5a')]['attachments'][_0x33651f]['basename'])};}}return respondWithRpcPromise('CheckAfterSend',_0x9de8('0xaf'),{'FaxAccountId':_[_0x9de8('0xb0')](_0x45ed93['params']['id'])?undefined:_0x45ed93['params']['id'],'path':_[_0x9de8('0xb0')](_0x45ed93[_0x9de8('0x5a')][_0x9de8('0xab')][0x0][_0x9de8('0x8')])?undefined:_0x45ed93[_0x9de8('0x5a')]['attachments'][0x0][_0x9de8('0x8')],'fax':_[_0x9de8('0xb0')](_0x45ed93[_0x9de8('0x5a')]['to'][0x0])?undefined:_0x45ed93['body']['to'][0x0]},client9002);})['then'](function(){if(_0x4fbeca){if(_[_0x9de8('0xb0')](_0x45ed93[_0x9de8('0x5a')][_0x9de8('0xb1')])){_0x45ed93[_0x9de8('0x5a')][_0x9de8('0xb1')]=util[_0x9de8('0xa6')](_0x9de8('0xb2'),_0x4fbeca['name'],_0x4fbeca[_0x9de8('0xb3')]);}if(_0x4fbeca[_0x9de8('0xa8')]){if(_0x4fbeca[_0x9de8('0xa8')][_0x9de8('0xa9')][_0x9de8('0x4a')]){return _0x4fbeca['List']['Contacts'][0x0];}else{return db[_0x9de8('0xb4')][_0x9de8('0x59')](_[_0x9de8('0x1d')](_0x45ed93[_0x9de8('0x5a')],{'firstName':_0x45ed93[_0x9de8('0x5a')]['to'][0x0],'phone':_0x45ed93[_0x9de8('0x5a')]['to'][0x0],'fax':_0x45ed93[_0x9de8('0x5a')]['to'][0x0],'ListId':_0x4fbeca[_0x9de8('0xa1')]}));}}else{throw new Error(_0x9de8('0xb5'));}}else{throw new Error('Send\x20Fax\x20failed');}})['then'](function(_0x165308){if(_0x165308){return db[_0x9de8('0x71')][_0x9de8('0x58')]({'where':{'ContactId':_0x165308['id'],'closed':![],'FaxAccountId':_0x4fbeca['id']}})[_0x9de8('0x23')](function(_0xec1c3e){if(_0xec1c3e){return[_0xec1c3e,![]];}return db[_0x9de8('0x71')]['create']({'UserId':_0x45ed93[_0x9de8('0xb6')]['id'],'ContactId':_0x165308['id'],'FaxAccountId':_0x4fbeca['id'],'fax':_0x45ed93[_0x9de8('0x5a')]['to'][0x0],'firstMsgDirection':_0x9de8('0xb7'),'Messages':[_['merge'](_0x45ed93[_0x9de8('0x5a')],{'read':![],'body':_0x45ed93[_0x9de8('0x5a')][_0x9de8('0xab')][0x0][_0x9de8('0xb8')],'FaxAccountId':_0x4fbeca['id'],'UserId':_0x45ed93['user']['id'],'ContactId':_0x165308['id'],'AttachmentId':_0x45ed93['body'][_0x9de8('0xab')][0x0]['id']})]},{'include':[{'model':db[_0x9de8('0xa4')],'as':_0x9de8('0xb9')}]})[_0x9de8('0x23')](function(_0x4fff99){return[_0x4fff99,!![]];});});}else{throw new Error(_0x9de8('0xba'));}})[_0x9de8('0xbb')](function(_0x59d4e2,_0x16b5d8){if(_0x16b5d8){return _0x59d4e2;}return db[_0x9de8('0xa4')][_0x9de8('0x59')]({'direction':'out','read':![],'body':_0x45ed93[_0x9de8('0x5a')]['attachments'][0x0]['filename'],'FaxAccountId':_0x4fbeca['id'],'FaxInteractionId':_0x59d4e2['id'],'UserId':_0x45ed93['user']['id'],'ContactId':_0x59d4e2[_0x9de8('0xbc')],'AttachmentId':_0x45ed93[_0x9de8('0x5a')][_0x9de8('0xab')][0x0]['id']})['then'](function(_0x448bec){_0x59d4e2[_0x9de8('0xbd')][_0x9de8('0xb9')]=[];_0x59d4e2[_0x9de8('0xbd')][_0x9de8('0xb9')][_0x9de8('0x8e')](_0x448bec[_0x9de8('0xbd')]);return _0x59d4e2;});})[_0x9de8('0x23')](function(_0x3916cb){respondWithRpcPromise(_0x9de8('0xbe'),'SendFax',{'FaxAccountId':_['isNil'](_0x45ed93[_0x9de8('0x56')]['id'])?undefined:_0x45ed93[_0x9de8('0x56')]['id'],'path':_['isNil'](_0x45ed93[_0x9de8('0x5a')][_0x9de8('0xab')][0x0][_0x9de8('0x8')])?undefined:_0x45ed93[_0x9de8('0x5a')][_0x9de8('0xab')][0x0]['path'],'fax':_['isNil'](_0x45ed93[_0x9de8('0x5a')]['to'][0x0])?undefined:_0x45ed93[_0x9de8('0x5a')]['to'][0x0],'AttachmentId':_0x45ed93[_0x9de8('0x5a')]['attachments'][0x0]['id']},client9002)[_0x9de8('0x23')](function(_0x3ca236){logger[_0x9de8('0x2b')]('SendFaxRpc,\x20%s',_0x3ca236);})[_0x9de8('0x2c')](function(_0x486e1e){logger[_0x9de8('0x2b')](_0x9de8('0xbf'),_0x486e1e);});return _0x3916cb;})[_0x9de8('0x23')](respondWithResult(_0x82cd96,null))['catch'](handleError(_0x82cd96,null));};exports['addAgents']=function(_0x2d38b1,_0x3d5bf0,_0x504eb6){return db['FaxAccount']['find']({'where':{'id':_0x2d38b1[_0x9de8('0x56')]['id']}})[_0x9de8('0x23')](handleEntityNotFound(_0x3d5bf0,null))[_0x9de8('0x23')](function(_0x28675a){if(_0x28675a){return _0x28675a['addAgents'](_0x2d38b1['body']['ids'],_['omit'](_0x2d38b1[_0x9de8('0x5a')],['ids','id'])||{})[_0x9de8('0xbb')](function(_0x32e0a2){for(var _0x66124d=0x0;_0x66124d<_0x2d38b1[_0x9de8('0x5a')]['ids'][_0x9de8('0x4a')];_0x66124d+=0x1){socket['emit']('userFaxAccount:save',{'UserId':Number(_0x2d38b1[_0x9de8('0x5a')][_0x9de8('0x6a')][_0x66124d]),'FaxAccountId':Number(_0x2d38b1[_0x9de8('0x56')]['id'])});}return _0x32e0a2;});}})[_0x9de8('0x23')](respondWithResult(_0x3d5bf0,null))[_0x9de8('0x2c')](handleError(_0x3d5bf0,null));};exports['removeAgents']=function(_0x1e134a,_0x338039,_0x27a1fc){return db[_0x9de8('0x52')][_0x9de8('0x58')]({'where':{'id':_0x1e134a[_0x9de8('0x56')]['id']}})[_0x9de8('0x23')](handleEntityNotFound(_0x338039,null))[_0x9de8('0x23')](function(_0x5595b7){if(_0x5595b7){return _0x5595b7['removeAgents'](_0x1e134a[_0x9de8('0x44')][_0x9de8('0x6a')])[_0x9de8('0x23')](function(){if(_[_0x9de8('0xc0')](_0x1e134a[_0x9de8('0x44')][_0x9de8('0x6a')])){for(var _0x5e5ce1=0x0;_0x5e5ce1<_0x1e134a[_0x9de8('0x44')][_0x9de8('0x6a')][_0x9de8('0x4a')];_0x5e5ce1+=0x1){socket['emit'](_0x9de8('0xc1'),{'UserId':Number(_0x1e134a['query'][_0x9de8('0x6a')][_0x5e5ce1]),'FaxAccountId':Number(_0x1e134a[_0x9de8('0x56')]['id'])});}}else{socket[_0x9de8('0xc2')]('userFaxAccount:remove',{'UserId':Number(_0x1e134a[_0x9de8('0x44')][_0x9de8('0x6a')]),'FaxAccountId':Number(_0x1e134a['params']['id'])});}});}})['then'](respondWithStatusCode(_0x338039,null))[_0x9de8('0x2c')](handleError(_0x338039,null));};exports['getAgents']=function(_0x60f35,_0xae2f72,_0x5e0dd4){var _0x5b60bd={};var _0x1fa4d9={};var _0x970797;var _0xa5b112;return db[_0x9de8('0x52')][_0x9de8('0x67')]({'where':{'id':_0x60f35[_0x9de8('0x56')]['id']}})['then'](handleEntityNotFound(_0xae2f72,null))[_0x9de8('0x23')](function(_0x46836a){if(_0x46836a){_0x970797=_0x46836a;_0x1fa4d9[_0x9de8('0x43')]=_[_0x9de8('0x45')](db[_0x9de8('0x74')][_0x9de8('0x3f')]);_0x1fa4d9[_0x9de8('0x44')]=_[_0x9de8('0x45')](_0x60f35[_0x9de8('0x44')]);_0x1fa4d9[_0x9de8('0x46')]=_[_0x9de8('0x47')](_0x1fa4d9[_0x9de8('0x43')],_0x1fa4d9['query']);_0x5b60bd[_0x9de8('0x48')]=_[_0x9de8('0x47')](_0x1fa4d9[_0x9de8('0x43')],qs[_0x9de8('0x49')](_0x60f35[_0x9de8('0x44')][_0x9de8('0x49')]));_0x5b60bd['attributes']=_0x5b60bd[_0x9de8('0x48')][_0x9de8('0x4a')]?_0x5b60bd['attributes']:_0x1fa4d9[_0x9de8('0x43')];_0x5b60bd[_0x9de8('0x4c')]=qs[_0x9de8('0x4d')](_0x60f35[_0x9de8('0x44')][_0x9de8('0x4d')]);_0x5b60bd[_0x9de8('0x4e')]=qs[_0x9de8('0x46')](_['pick'](_0x60f35['query'],_0x1fa4d9[_0x9de8('0x46')]));if(_0x60f35[_0x9de8('0x44')][_0x9de8('0x4f')]){_0x5b60bd[_0x9de8('0x4e')]=_[_0x9de8('0x50')](_0x5b60bd[_0x9de8('0x4e')],{'$or':_[_0x9de8('0x3e')](_0x5b60bd['attributes'],function(_0x43c243){var _0x28281f={};_0x28281f[_0x43c243]={'$like':'%'+_0x60f35[_0x9de8('0x44')][_0x9de8('0x4f')]+'%'};return _0x28281f;})});}_0x5b60bd=_[_0x9de8('0x50')]({},_0x5b60bd,_0x60f35['options']);return _0x970797[_0x9de8('0xc3')](_0x5b60bd);}})['then'](function(_0xb68f37){if(_0xb68f37){_0xa5b112=_0xb68f37[_0x9de8('0x4a')];if(!_0x60f35[_0x9de8('0x44')][_0x9de8('0x4b')]('nolimit')){_0x5b60bd[_0x9de8('0x33')]=qs[_0x9de8('0x33')](_0x60f35[_0x9de8('0x44')]['limit']);_0x5b60bd[_0x9de8('0x31')]=qs[_0x9de8('0x31')](_0x60f35[_0x9de8('0x44')]['offset']);}return _0x970797[_0x9de8('0xc3')](_0x5b60bd);}})[_0x9de8('0x23')](function(_0x2e8222){if(_0x2e8222){return _0x2e8222?{'count':_0xa5b112,'rows':_0x2e8222}:null;}})[_0x9de8('0x23')](respondWithResult(_0xae2f72,null))[_0x9de8('0x2c')](handleError(_0xae2f72,null));}; \ No newline at end of file +var _0x74b0=['findAll','rows','catch','show','length','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','FaxAccountId','getDispositions','sort','Disposition','removeDispositions','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','ids','addInteraction','FaxInteraction','omit','getInteractions','CmContact','User','Owner','Tag','tag','addApplications','sequelize','Transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','exten','localstationid','app','system','description','Fax\x20Extension','push','Answer','CDR(type)=inbound-fax','Set','ecm','headerinfo','maxrate','minrate','modem','t38timeout','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','update','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','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','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','client','http','request','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','info','result','sendStatus','status','json','limit','undefined','count','offset','Content-Range','apply','reject','save','then','get','FaxAccounts','UserProfileResource','destroy','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL','options','includeAll','include'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x74b0,0x135));var _0x074b=function(_0x2641e5,_0x165b4b){_0x2641e5=_0x2641e5-0x0;var _0x3831f2=_0x74b0[_0x2641e5];return _0x3831f2;};'use strict';var emlformat=require(_0x074b('0x0'));var rimraf=require(_0x074b('0x1'));var zipdir=require(_0x074b('0x2'));var jsonpatch=require(_0x074b('0x3'));var rp=require(_0x074b('0x4'));var moment=require('moment');var BPromise=require(_0x074b('0x5'));var Mustache=require('mustache');var util=require(_0x074b('0x6'));var path=require(_0x074b('0x7'));var sox=require(_0x074b('0x8'));var csv=require(_0x074b('0x9'));var ejs=require(_0x074b('0xa'));var fs=require('fs');var fs_extra=require(_0x074b('0xb'));var _=require(_0x074b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x074b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x074b('0x9'));var querystring=require(_0x074b('0xe'));var Papa=require(_0x074b('0xf'));var Redis=require(_0x074b('0x10'));var authService=require(_0x074b('0x11'));var qs=require(_0x074b('0x12'));var as=require(_0x074b('0x13'));var hardwareService=require(_0x074b('0x14'));var logger=require(_0x074b('0x15'))(_0x074b('0x16'));var utils=require(_0x074b('0x17'));var config=require(_0x074b('0x18'));var licenseUtil=require(_0x074b('0x19'));var db=require(_0x074b('0x1a'))['db'];config[_0x074b('0x1b')]=_[_0x074b('0x1c')](config[_0x074b('0x1b')],{'host':_0x074b('0x1d'),'port':0x18eb});var socket=require(_0x074b('0x1e'))(new Redis(config['redis']));require(_0x074b('0x1f'))[_0x074b('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0x074b('0x21')][_0x074b('0x22')]({'port':0x232c});var client9002=jayson['client'][_0x074b('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x28a9b4,_0xd61525,_0x22bead,_0x5c0057){return new BPromise(function(_0x54bc1f,_0x95445a){var _0x217459=_0x5c0057||client;return _0x217459[_0x074b('0x23')](_0x28a9b4,_0x22bead)['then'](function(_0x3be08c){logger['info']('FaxAccount,\x20%s,\x20%s',_0xd61525,_0x074b('0x24'));logger[_0x074b('0x25')](_0x074b('0x26'),_0xd61525,_0x074b('0x24'),JSON[_0x074b('0x27')](_0x3be08c));if(_0x3be08c[_0x074b('0x28')]){if(_0x3be08c[_0x074b('0x28')][_0x074b('0x29')]===0x1f4){logger[_0x074b('0x28')](_0x074b('0x2a'),_0xd61525,_0x3be08c[_0x074b('0x28')]['message']);return _0x95445a(_0x3be08c['error'][_0x074b('0x2b')]);}logger['error'](_0x074b('0x2a'),_0xd61525,_0x3be08c['error']['message']);return _0x54bc1f(_0x3be08c[_0x074b('0x28')][_0x074b('0x2b')]);}else{logger[_0x074b('0x2c')](_0x074b('0x2a'),_0xd61525,_0x074b('0x24'));_0x54bc1f(_0x3be08c[_0x074b('0x2d')][_0x074b('0x2b')]);}})['catch'](function(_0x323892){logger[_0x074b('0x28')](_0x074b('0x2a'),_0xd61525,_0x323892);_0x95445a(_0x323892);});});}function respondWithStatusCode(_0xc64e54,_0x103230){_0x103230=_0x103230||0xcc;return function(_0x2b69b7){if(_0x2b69b7){return _0xc64e54[_0x074b('0x2e')](_0x103230);}return _0xc64e54[_0x074b('0x2f')](_0x103230)['end']();};}function respondWithResult(_0xe8e2bb,_0x268e49){_0x268e49=_0x268e49||0xc8;return function(_0x47a391){if(_0x47a391){return _0xe8e2bb[_0x074b('0x2f')](_0x268e49)[_0x074b('0x30')](_0x47a391);}};}function respondWithFilteredResult(_0x2f3282,_0x56dae0){return function(_0x2184fe){if(_0x2184fe){var _0x19027b=typeof _0x56dae0['offset']==='undefined'&&typeof _0x56dae0[_0x074b('0x31')]===_0x074b('0x32');var _0x1600d8=_0x2184fe[_0x074b('0x33')];var _0x2682b0=_0x19027b?0x0:_0x56dae0[_0x074b('0x34')];var _0x489785=_0x19027b?_0x2184fe[_0x074b('0x33')]:_0x56dae0[_0x074b('0x34')]+_0x56dae0[_0x074b('0x31')];var _0x5edeea;if(_0x489785>=_0x1600d8){_0x489785=_0x1600d8;_0x5edeea=0xc8;}else{_0x5edeea=0xce;}_0x2f3282[_0x074b('0x2f')](_0x5edeea);return _0x2f3282['set'](_0x074b('0x35'),_0x2682b0+'-'+_0x489785+'/'+_0x1600d8)[_0x074b('0x30')](_0x2184fe);}return null;};}function patchUpdates(_0x21d96d){return function(_0x58f5c0){try{jsonpatch[_0x074b('0x36')](_0x58f5c0,_0x21d96d,!![]);}catch(_0x2cb6e3){return BPromise[_0x074b('0x37')](_0x2cb6e3);}return _0x58f5c0[_0x074b('0x38')]();};}function saveUpdates(_0xed2720,_0x17b0ef){return function(_0x263ae6){if(_0x263ae6){return _0x263ae6['update'](_0xed2720)['then'](function(_0x2991a2){return _0x2991a2;});}return null;};}function removeEntity(_0x406efd,_0x49fb47){return function(_0x4cc812){if(_0x4cc812){return _0x4cc812['destroy']()[_0x074b('0x39')](function(){var _0x2b88f0=_0x4cc812[_0x074b('0x3a')]({'plain':!![]});var _0x372015=_0x074b('0x3b');return db[_0x074b('0x3c')][_0x074b('0x3d')]({'where':{'type':_0x372015,'resourceId':_0x2b88f0['id']}})[_0x074b('0x39')](function(){return _0x4cc812;});})['then'](function(){_0x406efd['status'](0xcc)[_0x074b('0x3e')]();});}};}function handleEntityNotFound(_0x5baca3,_0x31df0d){return function(_0x3d02c9){if(!_0x3d02c9){_0x5baca3[_0x074b('0x2e')](0x194);}return _0x3d02c9;};}function handleError(_0x53df97,_0x383275){_0x383275=_0x383275||0x1f4;return function(_0x4cb12a){logger[_0x074b('0x28')](_0x4cb12a[_0x074b('0x3f')]);if(_0x4cb12a['name']){delete _0x4cb12a[_0x074b('0x40')];}_0x53df97['status'](_0x383275)[_0x074b('0x41')](_0x4cb12a);};}exports[_0x074b('0x42')]=function(_0x30cbbc,_0x138167){var _0x393eb0={'include':[{'model':db[_0x074b('0x43')],'as':_0x074b('0x44')}]},_0x71c9e0={},_0xdbb825={'count':0x0,'rows':[]};var _0x937e21=_[_0x074b('0x45')](db[_0x074b('0x46')][_0x074b('0x47')],function(_0x2ffc54){return{'name':_0x2ffc54[_0x074b('0x48')],'type':_0x2ffc54[_0x074b('0x49')][_0x074b('0x4a')]};});_0x71c9e0[_0x074b('0x4b')]=_['map'](_0x937e21,'name');_0x71c9e0[_0x074b('0x4c')]=_[_0x074b('0x4d')](_0x30cbbc[_0x074b('0x4c')]);_0x71c9e0[_0x074b('0x4e')]=_[_0x074b('0x4f')](_0x71c9e0[_0x074b('0x4b')],_0x71c9e0[_0x074b('0x4c')]);_0x393eb0[_0x074b('0x50')]=_['intersection'](_0x71c9e0[_0x074b('0x4b')],qs[_0x074b('0x51')](_0x30cbbc[_0x074b('0x4c')][_0x074b('0x51')]));_0x393eb0[_0x074b('0x50')]=_0x393eb0[_0x074b('0x50')]['length']?_0x393eb0[_0x074b('0x50')]:_0x71c9e0[_0x074b('0x4b')];if(!_0x30cbbc[_0x074b('0x4c')][_0x074b('0x52')](_0x074b('0x53'))){_0x393eb0[_0x074b('0x31')]=qs['limit'](_0x30cbbc[_0x074b('0x4c')][_0x074b('0x31')]);_0x393eb0[_0x074b('0x34')]=qs[_0x074b('0x34')](_0x30cbbc[_0x074b('0x4c')][_0x074b('0x34')]);}_0x393eb0[_0x074b('0x54')]=qs['sort'](_0x30cbbc[_0x074b('0x4c')]['sort']);_0x393eb0['where']=qs[_0x074b('0x4e')](_[_0x074b('0x55')](_0x30cbbc[_0x074b('0x4c')],_0x71c9e0[_0x074b('0x4e')]),_0x937e21);if(_0x30cbbc[_0x074b('0x4c')][_0x074b('0x56')]){_0x393eb0[_0x074b('0x57')]=_[_0x074b('0x58')](_0x393eb0[_0x074b('0x57')],{'$or':_[_0x074b('0x45')](_0x937e21,function(_0x5ff552){if(_0x5ff552[_0x074b('0x49')]!==_0x074b('0x59')){var _0x22ebed={};_0x22ebed[_0x5ff552['name']]={'$like':'%'+_0x30cbbc[_0x074b('0x4c')][_0x074b('0x56')]+'%'};return _0x22ebed;}})});}_0x393eb0=_[_0x074b('0x58')]({},_0x393eb0,_0x30cbbc[_0x074b('0x5a')]);var _0x3aa222={'where':_0x393eb0['where']};return db[_0x074b('0x46')][_0x074b('0x33')](_0x3aa222)[_0x074b('0x39')](function(_0x399d43){_0xdbb825[_0x074b('0x33')]=_0x399d43;if(_0x30cbbc[_0x074b('0x4c')][_0x074b('0x5b')]){_0x393eb0[_0x074b('0x5c')]=[{'all':!![]}];}return db[_0x074b('0x46')][_0x074b('0x5d')](_0x393eb0);})['then'](function(_0x3b8275){_0xdbb825[_0x074b('0x5e')]=_0x3b8275;return _0xdbb825;})[_0x074b('0x39')](respondWithFilteredResult(_0x138167,_0x393eb0))[_0x074b('0x5f')](handleError(_0x138167,null));};exports[_0x074b('0x60')]=function(_0x5af97f,_0x334dac){var _0x599a2c={'raw':![],'where':{'id':_0x5af97f['params']['id']},'include':[{'model':db['Pause'],'as':_0x074b('0x44')}]},_0x39c716={};_0x39c716['model']=_[_0x074b('0x4d')](db[_0x074b('0x46')]['rawAttributes']);_0x39c716[_0x074b('0x4c')]=_[_0x074b('0x4d')](_0x5af97f[_0x074b('0x4c')]);_0x39c716[_0x074b('0x4e')]=_['intersection'](_0x39c716[_0x074b('0x4b')],_0x39c716[_0x074b('0x4c')]);_0x599a2c[_0x074b('0x50')]=_[_0x074b('0x4f')](_0x39c716[_0x074b('0x4b')],qs[_0x074b('0x51')](_0x5af97f['query'][_0x074b('0x51')]));_0x599a2c[_0x074b('0x50')]=_0x599a2c['attributes'][_0x074b('0x61')]?_0x599a2c[_0x074b('0x50')]:_0x39c716[_0x074b('0x4b')];if(_0x5af97f[_0x074b('0x4c')]['includeAll']){_0x599a2c[_0x074b('0x5c')]=[{'all':!![]}];}_0x599a2c=_['merge']({},_0x599a2c,_0x5af97f[_0x074b('0x5a')]);return db[_0x074b('0x46')][_0x074b('0x62')](_0x599a2c)[_0x074b('0x39')](handleEntityNotFound(_0x334dac,null))[_0x074b('0x39')](respondWithResult(_0x334dac,null))[_0x074b('0x5f')](handleError(_0x334dac,null));};exports['create']=function(_0x5e6328,_0x1b0a12){return db[_0x074b('0x46')][_0x074b('0x63')](_0x5e6328[_0x074b('0x64')],{})[_0x074b('0x39')](function(_0x16b307){var _0x3dc301=_0x5e6328[_0x074b('0x65')][_0x074b('0x3a')]({'plain':!![]});if(!_0x3dc301)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3dc301[_0x074b('0x66')]==='user'){var _0x1a8ab2=_0x16b307['get']({'plain':!![]});var _0xa95686=_0x074b('0x3b');return db[_0x074b('0x67')][_0x074b('0x62')]({'where':{'name':_0xa95686,'userProfileId':_0x3dc301['userProfileId']},'raw':!![]})[_0x074b('0x39')](function(_0x376cfd){if(_0x376cfd&&_0x376cfd[_0x074b('0x68')]===0x0){return db[_0x074b('0x3c')][_0x074b('0x63')]({'name':_0x1a8ab2[_0x074b('0x40')],'resourceId':_0x1a8ab2['id'],'type':_0x376cfd['name'],'sectionId':_0x376cfd['id']},{})[_0x074b('0x39')](function(){return _0x16b307;});}else{return _0x16b307;}})[_0x074b('0x5f')](function(_0x38f4da){logger[_0x074b('0x28')](_0x074b('0x69'),_0x38f4da);throw _0x38f4da;});}return _0x16b307;})['then'](respondWithResult(_0x1b0a12,0xc9))['catch'](handleError(_0x1b0a12,null));};exports['update']=function(_0x4f5d1c,_0x1c6603){if(_0x4f5d1c[_0x074b('0x64')]['id']){delete _0x4f5d1c[_0x074b('0x64')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x4f5d1c[_0x074b('0x6a')]['id']},'include':[{'model':db[_0x074b('0x43')],'as':'mandatoryDispositionPause'}]})[_0x074b('0x39')](handleEntityNotFound(_0x1c6603,null))[_0x074b('0x39')](saveUpdates(_0x4f5d1c[_0x074b('0x64')],null))[_0x074b('0x39')](respondWithResult(_0x1c6603,null))[_0x074b('0x5f')](handleError(_0x1c6603,null));};exports[_0x074b('0x3d')]=function(_0x147956,_0x509feb){return db[_0x074b('0x46')][_0x074b('0x62')]({'where':{'id':_0x147956['params']['id']}})[_0x074b('0x39')](handleEntityNotFound(_0x509feb,null))[_0x074b('0x39')](removeEntity(_0x509feb,null))[_0x074b('0x5f')](handleError(_0x509feb,null));};exports[_0x074b('0x6b')]=function(_0x37120d,_0x4a97f8){return db[_0x074b('0x46')][_0x074b('0x6b')]()['then'](respondWithResult(_0x4a97f8,null))[_0x074b('0x5f')](handleError(_0x4a97f8,null));};exports[_0x074b('0x6c')]=function(_0x1d0933,_0x4136a7,_0x12d800){if(_0x1d0933['body']['id']){delete _0x1d0933['body']['id'];}return db[_0x074b('0x46')][_0x074b('0x62')]({'where':{'id':_0x1d0933[_0x074b('0x6a')]['id']}})[_0x074b('0x39')](handleEntityNotFound(_0x4136a7,null))[_0x074b('0x39')](function(_0x21b482){if(_0x21b482){_0x1d0933[_0x074b('0x64')][_0x074b('0x6d')]=_0x21b482['id'];return db['Disposition'][_0x074b('0x63')](_0x1d0933[_0x074b('0x64')]);}})['then'](respondWithResult(_0x4136a7,null))['catch'](handleError(_0x4136a7,null));};exports[_0x074b('0x6e')]=function(_0x45dda9,_0x60db42,_0x2637d6){var _0x2d2a60={'raw':![],'where':{}};var _0x2f3d89={};var _0x91229b={'count':0x0,'rows':[]};return db[_0x074b('0x46')]['findOne']({'where':{'id':_0x45dda9[_0x074b('0x6a')]['id']}})[_0x074b('0x39')](handleEntityNotFound(_0x60db42,null))[_0x074b('0x39')](function(_0x569c9d){if(_0x569c9d){_0x2f3d89[_0x074b('0x4b')]=_[_0x074b('0x4d')](db['Disposition']['rawAttributes']);_0x2f3d89[_0x074b('0x4c')]=_[_0x074b('0x4d')](_0x45dda9[_0x074b('0x4c')]);_0x2f3d89['filters']=_[_0x074b('0x4f')](_0x2f3d89[_0x074b('0x4b')],_0x2f3d89[_0x074b('0x4c')]);_0x2d2a60[_0x074b('0x50')]=_['intersection'](_0x2f3d89[_0x074b('0x4b')],qs[_0x074b('0x51')](_0x45dda9[_0x074b('0x4c')]['fields']));_0x2d2a60[_0x074b('0x50')]=_0x2d2a60[_0x074b('0x50')][_0x074b('0x61')]?_0x2d2a60[_0x074b('0x50')]:_0x2f3d89[_0x074b('0x4b')];if(!_0x45dda9[_0x074b('0x4c')][_0x074b('0x52')](_0x074b('0x53'))){_0x2d2a60[_0x074b('0x31')]=qs[_0x074b('0x31')](_0x45dda9[_0x074b('0x4c')]['limit']);_0x2d2a60['offset']=qs[_0x074b('0x34')](_0x45dda9[_0x074b('0x4c')][_0x074b('0x34')]);}_0x2d2a60[_0x074b('0x54')]=qs[_0x074b('0x6f')](_0x45dda9[_0x074b('0x4c')][_0x074b('0x6f')]);_0x2d2a60['where']=qs[_0x074b('0x4e')](_[_0x074b('0x55')](_0x45dda9[_0x074b('0x4c')],_0x2f3d89[_0x074b('0x4e')]));_0x2d2a60[_0x074b('0x57')]['FaxAccountId']=_0x569c9d['id'];if(_0x45dda9[_0x074b('0x4c')][_0x074b('0x56')]){_0x2d2a60[_0x074b('0x57')]=_[_0x074b('0x58')](_0x2d2a60[_0x074b('0x57')],{'$or':_[_0x074b('0x45')](_0x2d2a60[_0x074b('0x50')],function(_0x42f9f2){var _0x26db78={};_0x26db78[_0x42f9f2]={'$like':'%'+_0x45dda9[_0x074b('0x4c')][_0x074b('0x56')]+'%'};return _0x26db78;})});}_0x2d2a60=_['merge']({},_0x2d2a60,_0x45dda9[_0x074b('0x5a')]);return db[_0x074b('0x70')]['count']({'where':_0x2d2a60[_0x074b('0x57')]})[_0x074b('0x39')](function(_0x162fec){_0x91229b['count']=_0x162fec;if(_0x45dda9['query'][_0x074b('0x5b')]){_0x2d2a60[_0x074b('0x5c')]=[{'all':!![]}];}return db['Disposition'][_0x074b('0x5d')](_0x2d2a60);})[_0x074b('0x39')](function(_0x3b9532){_0x91229b[_0x074b('0x5e')]=_0x3b9532;return _0x91229b;});}})[_0x074b('0x39')](respondWithFilteredResult(_0x60db42,_0x2d2a60))['catch'](handleError(_0x60db42,null));};exports[_0x074b('0x71')]=function(_0x5dae55,_0xab2720,_0x20b4cd){return db[_0x074b('0x46')][_0x074b('0x62')]({'where':{'id':_0x5dae55[_0x074b('0x6a')]['id']}})[_0x074b('0x39')](handleEntityNotFound(_0xab2720,null))[_0x074b('0x39')](function(_0x191031){if(_0x191031){return _0x191031[_0x074b('0x71')](_0x5dae55[_0x074b('0x4c')]['ids']);}})['then'](respondWithStatusCode(_0xab2720,null))['catch'](handleError(_0xab2720,null));};exports[_0x074b('0x72')]=function(_0x44c287,_0x3cae5a,_0x353c5e){if(_0x44c287[_0x074b('0x64')]['id']){delete _0x44c287[_0x074b('0x64')]['id'];}return db[_0x074b('0x46')][_0x074b('0x62')]({'where':{'id':_0x44c287[_0x074b('0x6a')]['id']}})[_0x074b('0x39')](handleEntityNotFound(_0x3cae5a,null))[_0x074b('0x39')](function(_0x3b259d){if(_0x3b259d){_0x44c287['body'][_0x074b('0x6d')]=_0x3b259d['id'];return db['CannedAnswer'][_0x074b('0x63')](_0x44c287['body']);}})[_0x074b('0x39')](respondWithResult(_0x3cae5a,null))[_0x074b('0x5f')](handleError(_0x3cae5a,null));};exports[_0x074b('0x73')]=function(_0xe727c9,_0x493f81,_0x9e7ff6){var _0xae8083={'raw':![],'where':{}};var _0x46e980={};var _0x5cb043={'count':0x0,'rows':[]};return db[_0x074b('0x46')][_0x074b('0x74')]({'where':{'id':_0xe727c9[_0x074b('0x6a')]['id']}})['then'](handleEntityNotFound(_0x493f81,null))[_0x074b('0x39')](function(_0x2a6e80){if(_0x2a6e80){_0x46e980[_0x074b('0x4b')]=_[_0x074b('0x4d')](db[_0x074b('0x75')][_0x074b('0x47')]);_0x46e980[_0x074b('0x4c')]=_[_0x074b('0x4d')](_0xe727c9['query']);_0x46e980['filters']=_[_0x074b('0x4f')](_0x46e980[_0x074b('0x4b')],_0x46e980[_0x074b('0x4c')]);_0xae8083[_0x074b('0x50')]=_[_0x074b('0x4f')](_0x46e980[_0x074b('0x4b')],qs['fields'](_0xe727c9[_0x074b('0x4c')][_0x074b('0x51')]));_0xae8083[_0x074b('0x50')]=_0xae8083[_0x074b('0x50')]['length']?_0xae8083[_0x074b('0x50')]:_0x46e980[_0x074b('0x4b')];if(!_0xe727c9[_0x074b('0x4c')][_0x074b('0x52')](_0x074b('0x53'))){_0xae8083[_0x074b('0x31')]=qs['limit'](_0xe727c9[_0x074b('0x4c')]['limit']);_0xae8083[_0x074b('0x34')]=qs[_0x074b('0x34')](_0xe727c9[_0x074b('0x4c')][_0x074b('0x34')]);}_0xae8083[_0x074b('0x54')]=qs[_0x074b('0x6f')](_0xe727c9[_0x074b('0x4c')][_0x074b('0x6f')]);_0xae8083[_0x074b('0x57')]=qs['filters'](_['pick'](_0xe727c9[_0x074b('0x4c')],_0x46e980[_0x074b('0x4e')]));_0xae8083['where'][_0x074b('0x6d')]=_0x2a6e80['id'];if(_0xe727c9[_0x074b('0x4c')][_0x074b('0x56')]){_0xae8083[_0x074b('0x57')]=_[_0x074b('0x58')](_0xae8083[_0x074b('0x57')],{'$or':_['map'](_0xae8083[_0x074b('0x50')],function(_0x5007c6){var _0x5c69b1={};_0x5c69b1[_0x5007c6]={'$like':'%'+_0xe727c9['query'][_0x074b('0x56')]+'%'};return _0x5c69b1;})});}_0xae8083=_['merge']({},_0xae8083,_0xe727c9[_0x074b('0x5a')]);return db[_0x074b('0x75')][_0x074b('0x33')]({'where':_0xae8083[_0x074b('0x57')]})[_0x074b('0x39')](function(_0x397a29){_0x5cb043[_0x074b('0x33')]=_0x397a29;if(_0xe727c9[_0x074b('0x4c')][_0x074b('0x5b')]){_0xae8083['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x074b('0x5d')](_0xae8083);})[_0x074b('0x39')](function(_0x55466a){_0x5cb043[_0x074b('0x5e')]=_0x55466a;return _0x5cb043;});}})[_0x074b('0x39')](respondWithFilteredResult(_0x493f81,_0xae8083))[_0x074b('0x5f')](handleError(_0x493f81,null));};exports[_0x074b('0x76')]=function(_0x5ac431,_0x2a5a54,_0x54d022){return db[_0x074b('0x46')]['find']({'where':{'id':_0x5ac431[_0x074b('0x6a')]['id']}})[_0x074b('0x39')](handleEntityNotFound(_0x2a5a54,null))[_0x074b('0x39')](function(_0x1e6bf1){if(_0x1e6bf1){return _0x1e6bf1['removeAnswers'](_0x5ac431['query'][_0x074b('0x77')]);}})['then'](respondWithStatusCode(_0x2a5a54,null))[_0x074b('0x5f')](handleError(_0x2a5a54,null));};exports[_0x074b('0x78')]=function(_0x334d8e,_0x1fe1f1,_0x2720aa){return db[_0x074b('0x79')][_0x074b('0x62')]({'where':{'id':_0x334d8e[_0x074b('0x6a')]['id']}})[_0x074b('0x39')](handleEntityNotFound(_0x1fe1f1,null))['then'](function(_0x3afd84){if(_0x3afd84){return _0x3afd84[_0x074b('0x78')](_0x334d8e[_0x074b('0x64')][_0x074b('0x77')],_[_0x074b('0x7a')](_0x334d8e['body'],[_0x074b('0x77'),'id'])||{});}})['then'](respondWithResult(_0x1fe1f1,null))[_0x074b('0x5f')](handleError(_0x1fe1f1,null));};exports[_0x074b('0x7b')]=function(_0x551b58,_0x5bd8f8,_0x71ef91){var _0xb3cd84={'raw':![],'where':{}};var _0x58423b={};var _0x1f6257={'count':0x0,'rows':[]};return db['FaxAccount'][_0x074b('0x74')]({'where':{'id':_0x551b58[_0x074b('0x6a')]['id']}})[_0x074b('0x39')](handleEntityNotFound(_0x5bd8f8,null))['then'](function(_0x4ef627){if(_0x4ef627){_0x58423b['model']=_[_0x074b('0x4d')](db[_0x074b('0x79')]['rawAttributes']);_0x58423b[_0x074b('0x4c')]=_[_0x074b('0x4d')](_0x551b58[_0x074b('0x4c')]);_0x58423b[_0x074b('0x4e')]=_[_0x074b('0x4f')](_0x58423b[_0x074b('0x4b')],_0x58423b['query']);_0xb3cd84[_0x074b('0x50')]=_[_0x074b('0x4f')](_0x58423b[_0x074b('0x4b')],qs[_0x074b('0x51')](_0x551b58[_0x074b('0x4c')][_0x074b('0x51')]));_0xb3cd84['attributes']=_0xb3cd84['attributes']['length']?_0xb3cd84['attributes']:_0x58423b['model'];if(!_0x551b58[_0x074b('0x4c')]['hasOwnProperty']('nolimit')){_0xb3cd84['limit']=qs['limit'](_0x551b58['query'][_0x074b('0x31')]);_0xb3cd84[_0x074b('0x34')]=qs['offset'](_0x551b58[_0x074b('0x4c')]['offset']);}_0xb3cd84[_0x074b('0x54')]=qs[_0x074b('0x6f')](_0x551b58['query'][_0x074b('0x6f')]);_0xb3cd84[_0x074b('0x57')]=qs[_0x074b('0x4e')](_[_0x074b('0x55')](_0x551b58[_0x074b('0x4c')],_0x58423b[_0x074b('0x4e')]));_0xb3cd84[_0x074b('0x57')][_0x074b('0x6d')]=_0x4ef627['id'];if(_0x551b58['query'][_0x074b('0x56')]){_0xb3cd84[_0x074b('0x57')]=_[_0x074b('0x58')](_0xb3cd84[_0x074b('0x57')],{'$or':_[_0x074b('0x45')](_0xb3cd84[_0x074b('0x50')],function(_0x57df8b){var _0x51ef59={};_0x51ef59[_0x57df8b]={'$like':'%'+_0x551b58['query']['filter']+'%'};return _0x51ef59;})});}_0xb3cd84=_['merge']({},_0xb3cd84,_0x551b58[_0x074b('0x5a')]);return db[_0x074b('0x79')][_0x074b('0x33')]({'where':_0xb3cd84[_0x074b('0x57')]})[_0x074b('0x39')](function(_0x222fd4){_0x1f6257[_0x074b('0x33')]=_0x222fd4;if(_0x551b58[_0x074b('0x4c')][_0x074b('0x5b')]){_0xb3cd84[_0x074b('0x5c')]=[{'model':db[_0x074b('0x7c')],'as':'Contact','required':![]},{'model':db[_0x074b('0x7d')],'as':_0x074b('0x7e'),'attributes':[_0x074b('0x40'),'fullname','internal'],'required':![]},{'model':db[_0x074b('0x7f')],'as':'Tags','attributes':['id',_0x074b('0x40'),'color'],'where':_0x551b58[_0x074b('0x4c')][_0x074b('0x80')]?{'id':_0x551b58[_0x074b('0x4c')][_0x074b('0x80')]}:undefined,'required':_0x551b58['query'][_0x074b('0x80')]?!![]:![]}];}return db[_0x074b('0x79')]['findAll'](_0xb3cd84);})[_0x074b('0x39')](function(_0x482476){_0x1f6257['rows']=_0x482476;return _0x1f6257;});}})[_0x074b('0x39')](respondWithFilteredResult(_0x5bd8f8,_0xb3cd84))[_0x074b('0x5f')](handleError(_0x5bd8f8,null));};exports[_0x074b('0x81')]=function(_0x1f7c0e,_0x12a698){var _0x3ec4c1=_0x1f7c0e[_0x074b('0x6a')]['id'];var _0x5715dc=_0x1f7c0e['body'];var _0x3b4f8d=0xc8;var _0x390d0a=null;return db[_0x074b('0x82')]['transaction']({'isolationLevel':db['sequelize'][_0x074b('0x83')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x1bad4d){return db[_0x074b('0x46')][_0x074b('0x74')]({'where':{'id':_0x3ec4c1},'transaction':_0x1bad4d})[_0x074b('0x39')](function(_0x2c0f4f){if(_0x2c0f4f){return db[_0x074b('0x84')]['destroy']({'where':{'FaxAccountId':_0x3ec4c1},'transaction':_0x1bad4d})['then'](function(){var _0x192e64=_[_0x074b('0x45')](_0x5715dc,function(_0x3b9681){_0x3b9681[_0x074b('0x6d')]=_0x3ec4c1;return _0x3b9681;});return db[_0x074b('0x84')][_0x074b('0x85')](_0x192e64,{'transaction':_0x1bad4d});});}else{_0x3b4f8d=0x194;_0x390d0a=[];}});})['then'](function(){if(_0x3b4f8d!==0x194){return db[_0x074b('0x84')][_0x074b('0x86')]({'where':{'FaxAccountId':_0x3ec4c1},'order':_0x074b('0x87')})[_0x074b('0x39')](function(_0x35e5a2){_0x390d0a=_0x35e5a2;});}})['catch'](function(_0x40a2b9){_0x3b4f8d=0x1f4;logger['error'](_0x40a2b9[_0x074b('0x3f')]);if(_0x40a2b9[_0x074b('0x40')]){delete _0x40a2b9[_0x074b('0x40')];}_0x390d0a=_0x40a2b9;})['finally'](function(){if(_0x390d0a===null){_0x12a698[_0x074b('0x2e')](_0x3b4f8d);}else{if(_0x3b4f8d===0x1f4){_0x12a698[_0x074b('0x2f')](_0x3b4f8d)[_0x074b('0x41')](_0x390d0a);}else{_0x12a698['status'](_0x3b4f8d)[_0x074b('0x30')](_0x390d0a);}}});};exports[_0x074b('0x88')]=function(_0xfbd393,_0x4a3b82,_0x485d50){var _0x36c0ed={};var _0x15e782={};var _0x319a0f;var _0x217327;return db[_0x074b('0x46')][_0x074b('0x74')]({'where':{'id':_0xfbd393['params']['id']}})[_0x074b('0x39')](handleEntityNotFound(_0x4a3b82,null))['then'](function(_0x1e0215){if(_0x1e0215){_0x319a0f=_0x1e0215;_0x15e782['model']=_[_0x074b('0x4d')](db[_0x074b('0x84')][_0x074b('0x47')]);_0x15e782[_0x074b('0x4c')]=_['keys'](_0xfbd393[_0x074b('0x4c')]);_0x15e782[_0x074b('0x4e')]=_[_0x074b('0x4f')](_0x15e782[_0x074b('0x4b')],_0x15e782[_0x074b('0x4c')]);_0x36c0ed['attributes']=_[_0x074b('0x4f')](_0x15e782['model'],qs['fields'](_0xfbd393[_0x074b('0x4c')][_0x074b('0x51')]));_0x36c0ed[_0x074b('0x50')]=_0x36c0ed[_0x074b('0x50')][_0x074b('0x61')]?_0x36c0ed[_0x074b('0x50')]:_0x15e782[_0x074b('0x4b')];_0x36c0ed['order']=qs[_0x074b('0x6f')](_0xfbd393['query'][_0x074b('0x6f')]);_0x36c0ed[_0x074b('0x57')]=qs[_0x074b('0x4e')](_[_0x074b('0x55')](_0xfbd393[_0x074b('0x4c')],_0x15e782[_0x074b('0x4e')]));if(_0xfbd393[_0x074b('0x4c')][_0x074b('0x56')]){_0x36c0ed[_0x074b('0x57')]=_[_0x074b('0x58')](_0x36c0ed[_0x074b('0x57')],{'$or':_[_0x074b('0x45')](_0x36c0ed[_0x074b('0x50')],function(_0xb61cb2){var _0x1ffa14={};_0x1ffa14[_0xb61cb2]={'$like':'%'+_0xfbd393[_0x074b('0x4c')]['filter']+'%'};return _0x1ffa14;})});}_0x36c0ed=_['merge']({},_0x36c0ed,_0xfbd393['options']);return _0x319a0f['getApplications'](_0x36c0ed);}})[_0x074b('0x39')](function(_0x5bd3ca){if(_0x5bd3ca){_0x217327=_0x5bd3ca[_0x074b('0x61')];if(!_0xfbd393['query'][_0x074b('0x52')]('nolimit')){_0x36c0ed[_0x074b('0x31')]=qs['limit'](_0xfbd393[_0x074b('0x4c')][_0x074b('0x31')]);_0x36c0ed[_0x074b('0x34')]=qs[_0x074b('0x34')](_0xfbd393[_0x074b('0x4c')]['offset']);}return _0x319a0f[_0x074b('0x88')](_0x36c0ed);}})['then'](function(_0x440256){if(_0x440256){return _0x440256?{'count':_0x217327,'rows':_0x440256}:null;}})[_0x074b('0x39')](respondWithResult(_0x4a3b82,null))[_0x074b('0x5f')](handleError(_0x4a3b82,null));};function Extension(_0x4d4dc8,_0x4c8002,_0x4a18da,_0x32615a){this[_0x074b('0x89')]='from-voip-provider';this[_0x074b('0x8a')]=_0x4d4dc8[_0x074b('0x8b')];this[_0x074b('0x8c')]=_0x32615a;this[_0x074b('0x49')]=_0x074b('0x8d');this[_0x074b('0x8e')]=_0x074b('0x8f');this[_0x074b('0x6d')]=_0x4d4dc8['id'];this[_0x074b('0x87')]=_0x4c8002;this['appdata']=_0x4a18da;}function createExtensionsReciveFax(_0x4c6fb7){var _0x355f40=0x1;var _0x24d316=[];_0x24d316[_0x074b('0x90')](new Extension(_0x4c6fb7,_0x355f40,'',_0x074b('0x91')));_0x355f40+=0x1;_0x24d316[_0x074b('0x90')](new Extension(_0x4c6fb7,_0x355f40,_0x074b('0x92'),_0x074b('0x93')));_0x355f40+=0x1;for(var _0x4a5262 in _0x4c6fb7){if(_0x4c6fb7[_0x074b('0x52')](_0x4a5262)&&(_0x4a5262===_0x074b('0x94')||_0x4a5262==='localstationid'||_0x4a5262==='gateway'||_0x4a5262==='faxdetect'||_0x4a5262===_0x074b('0x95')||_0x4a5262===_0x074b('0x96')||_0x4a5262===_0x074b('0x97')||_0x4a5262===_0x074b('0x98')||_0x4a5262===_0x074b('0x99'))){_0x24d316[_0x074b('0x90')](new Extension(_0x4c6fb7,_0x355f40,'FAXOPT('+_0x4a5262+')='+_0x4c6fb7[_0x4a5262],'Set'));_0x355f40+=0x1;}}_0x24d316[_0x074b('0x90')](new Extension(_0x4c6fb7,_0x355f40,'6',_0x074b('0x9a')));_0x355f40+=0x1;_0x24d316[_0x074b('0x90')](new Extension(_0x4c6fb7,_0x355f40,_0x074b('0x9b'),_0x074b('0x9c')));_0x355f40=0x0;return _0x24d316;}exports[_0x074b('0x9d')]=function(_0x5c54bf,_0xa76639,_0x856c5f){var _0x1ba253;return db[_0x074b('0x82')][_0x074b('0x9e')](function(_0x457b18){return db['FaxAccount'][_0x074b('0x63')](_0x5c54bf[_0x074b('0x64')],{'transaction':_0x457b18})[_0x074b('0x39')](function(_0x5b8107){_0x1ba253=_0x5b8107[_0x074b('0x3a')]({'plain':!![]});return db[_0x074b('0x9f')][_0x074b('0x85')](createExtensionsReciveFax(_0x1ba253),{'transaction':_0x457b18});});})[_0x074b('0x39')](function(){return _0x1ba253;})[_0x074b('0x39')](respondWithResult(_0xa76639,null))[_0x074b('0x5f')](handleError(_0xa76639,null));};exports[_0x074b('0xa0')]=function(_0x510401,_0x365b27,_0x88e843){var _0x311ccc;return db[_0x074b('0x82')][_0x074b('0x9e')](function(_0x27cfb5){return db[_0x074b('0x46')][_0x074b('0xa1')](_0x510401[_0x074b('0x64')],{'where':{'id':_0x510401[_0x074b('0x64')]['id']},'transaction':_0x27cfb5})[_0x074b('0x39')](function(_0x5bcf47){return db[_0x074b('0x9f')]['destroy']({'where':{'FaxAccountId':_0x510401[_0x074b('0x64')]['id']},'transaction':_0x27cfb5})['then'](function(_0x477ee0){return db['VoiceExtension'][_0x074b('0x85')](createExtensionsReciveFax(_[_0x074b('0x7a')](_0x510401[_0x074b('0x64')],[_0x074b('0xa2'),_0x074b('0x4a'),_0x074b('0xa3'),_0x074b('0xa4'),_0x074b('0xa5'),_0x074b('0xa6')])),{'transaction':_0x27cfb5});});});})[_0x074b('0x39')](function(){return db[_0x074b('0x46')][_0x074b('0xa7')](_0x510401[_0x074b('0x64')]['id']);})[_0x074b('0x39')](respondWithResult(_0x365b27,null))[_0x074b('0x5f')](handleError(_0x365b27,null));};exports[_0x074b('0xa8')]=function(_0x1cd66f,_0x55d75a,_0x5d10dd){var _0x252f40={'raw':!![],'where':{}};var _0x2bb927={};var _0x4fb60a={'count':0x0,'rows':[]};return db[_0x074b('0x46')]['findOne']({'where':{'id':_0x1cd66f[_0x074b('0x6a')]['id']}})[_0x074b('0x39')](handleEntityNotFound(_0x55d75a,null))[_0x074b('0x39')](function(_0x59eeb1){if(_0x59eeb1){_0x2bb927[_0x074b('0x4b')]=_[_0x074b('0x4d')](db[_0x074b('0xa9')]['rawAttributes']);_0x2bb927[_0x074b('0x4c')]=_[_0x074b('0x4d')](_0x1cd66f[_0x074b('0x4c')]);_0x2bb927[_0x074b('0x4e')]=_['intersection'](_0x2bb927[_0x074b('0x4b')],_0x2bb927['query']);_0x252f40['attributes']=_[_0x074b('0x4f')](_0x2bb927['model'],qs[_0x074b('0x51')](_0x1cd66f[_0x074b('0x4c')][_0x074b('0x51')]));_0x252f40[_0x074b('0x50')]=_0x252f40[_0x074b('0x50')][_0x074b('0x61')]?_0x252f40[_0x074b('0x50')]:_0x2bb927[_0x074b('0x4b')];if(!_0x1cd66f[_0x074b('0x4c')][_0x074b('0x52')](_0x074b('0x53'))){_0x252f40['limit']=qs[_0x074b('0x31')](_0x1cd66f[_0x074b('0x4c')][_0x074b('0x31')]);_0x252f40[_0x074b('0x34')]=qs[_0x074b('0x34')](_0x1cd66f['query'][_0x074b('0x34')]);}_0x252f40['order']=qs[_0x074b('0x6f')](_0x1cd66f[_0x074b('0x4c')]['sort']);_0x252f40[_0x074b('0x57')]=qs[_0x074b('0x4e')](_['pick'](_0x1cd66f[_0x074b('0x4c')],_0x2bb927[_0x074b('0x4e')]));_0x252f40['where']['FaxAccountId']=_0x59eeb1['id'];if(_0x1cd66f[_0x074b('0x4c')][_0x074b('0x56')]){_0x252f40[_0x074b('0x57')]=_[_0x074b('0x58')](_0x252f40['where'],{'$or':_[_0x074b('0x45')](_0x252f40[_0x074b('0x50')],function(_0x2f1149){var _0x4ca154={};_0x4ca154[_0x2f1149]={'$like':'%'+_0x1cd66f[_0x074b('0x4c')][_0x074b('0x56')]+'%'};return _0x4ca154;})});}if(_0x1cd66f[_0x074b('0x4c')]['$gte']){var _0x4c7e41=_0x1cd66f[_0x074b('0x4c')][_0x074b('0xaa')][_0x074b('0xab')](',');var _0x5a3ca9={};_0x5a3ca9[_0x4c7e41[0x0]]={'$gte':moment(_0x4c7e41[0x1])['format'](_0x074b('0xac'))};_0x252f40[_0x074b('0x57')]=_[_0x074b('0x58')](_0x252f40[_0x074b('0x57')],_0x5a3ca9);}_0x252f40=_[_0x074b('0x58')]({},_0x252f40,_0x1cd66f[_0x074b('0x5a')]);return db[_0x074b('0xa9')][_0x074b('0x33')]({'where':_0x252f40[_0x074b('0x57')]})[_0x074b('0x39')](function(_0x293911){_0x4fb60a['count']=_0x293911;if(_0x1cd66f[_0x074b('0x4c')][_0x074b('0x5b')]){_0x252f40[_0x074b('0x5c')]=[{'all':!![]}];}return db['FaxMessage'][_0x074b('0x5d')](_0x252f40);})[_0x074b('0x39')](function(_0x1196d6){_0x4fb60a['rows']=_0x1196d6;return _0x4fb60a;});}})[_0x074b('0x39')](respondWithFilteredResult(_0x55d75a,_0x252f40))[_0x074b('0x5f')](handleError(_0x55d75a,null));};exports[_0x074b('0x41')]=function(_0x328764,_0x25084a,_0x357048){var _0x4e3ca1,_0x42dffe={},_0x2d0495;if(_0x328764[_0x074b('0x64')]['to']){_0x2d0495=_0x328764[_0x074b('0x64')]['to'][0x0];}return db[_0x074b('0x46')][_0x074b('0x62')]({'where':{'id':_0x328764[_0x074b('0x6a')]['id']},'include':[{'model':db[_0x074b('0xad')],'as':'List','include':[{'model':db[_0x074b('0x7c')],'as':_0x074b('0xae'),'where':{'fax':_0x2d0495},'limit':0x1,'order':[[_0x074b('0xa4'),_0x074b('0xaf')]]}]}]})[_0x074b('0x39')](handleEntityNotFound(_0x25084a,null))[_0x074b('0x39')](function(_0x4ec240){_0x4e3ca1=_0x4ec240;if(_0x328764[_0x074b('0x64')][_0x074b('0xb0')]&&_0x328764[_0x074b('0x64')]['attachments'][_0x074b('0x61')]){for(var _0x4a28a6=0x0;_0x4a28a6<_0x328764['body'][_0x074b('0xb0')][_0x074b('0x61')];_0x4a28a6+=0x1){_0x328764[_0x074b('0x64')][_0x074b('0xb0')][_0x4a28a6]={'filename':_0x328764[_0x074b('0x64')][_0x074b('0xb0')][_0x4a28a6][_0x074b('0x40')],'id':_0x328764[_0x074b('0x64')][_0x074b('0xb0')][_0x4a28a6]['id'],'path':path[_0x074b('0xb1')](config[_0x074b('0xb2')],_0x074b('0xb3'),_0x328764['body'][_0x074b('0xb0')][_0x4a28a6][_0x074b('0xb4')])};}}return respondWithRpcPromise(_0x074b('0xb5'),'CheckAfterSend',{'FaxAccountId':_[_0x074b('0xb6')](_0x328764[_0x074b('0x6a')]['id'])?undefined:_0x328764['params']['id'],'path':_[_0x074b('0xb6')](_0x328764[_0x074b('0x64')]['attachments'][0x0][_0x074b('0x7')])?undefined:_0x328764['body'][_0x074b('0xb0')][0x0]['path'],'fax':_[_0x074b('0xb6')](_0x328764[_0x074b('0x64')]['to'][0x0])?undefined:_0x328764[_0x074b('0x64')]['to'][0x0]},client9002);})['then'](function(){if(_0x4e3ca1){if(_['isNil'](_0x328764['body']['from'])){_0x328764['body'][_0x074b('0xb7')]=util['format'](_0x074b('0xb8'),_0x4e3ca1['name'],_0x4e3ca1[_0x074b('0xb9')]);}if(_0x4e3ca1[_0x074b('0xba')]){if(_0x4e3ca1[_0x074b('0xba')][_0x074b('0xae')][_0x074b('0x61')]){return _0x4e3ca1[_0x074b('0xba')]['Contacts'][0x0];}else{return db[_0x074b('0x7c')][_0x074b('0x63')](_['defaults'](_0x328764[_0x074b('0x64')],{'firstName':_0x328764[_0x074b('0x64')]['to'][0x0],'phone':_0x328764[_0x074b('0x64')]['to'][0x0],'fax':_0x328764[_0x074b('0x64')]['to'][0x0],'ListId':_0x4e3ca1[_0x074b('0xa6')]}));}}else{throw new Error(_0x074b('0xbb'));}}else{throw new Error(_0x074b('0xbc'));}})['then'](function(_0x1ccfe5){if(_0x1ccfe5){return db[_0x074b('0x79')]['find']({'where':{'ContactId':_0x1ccfe5['id'],'closed':![],'FaxAccountId':_0x4e3ca1['id']}})[_0x074b('0x39')](function(_0x47122f){if(_0x47122f){return[_0x47122f,![]];}return db[_0x074b('0x79')][_0x074b('0x63')]({'UserId':_0x328764[_0x074b('0x65')]['id'],'ContactId':_0x1ccfe5['id'],'FaxAccountId':_0x4e3ca1['id'],'fax':_0x328764[_0x074b('0x64')]['to'][0x0],'firstMsgDirection':_0x074b('0xbd'),'Messages':[_[_0x074b('0x58')](_0x328764[_0x074b('0x64')],{'read':![],'body':_0x328764['body'][_0x074b('0xb0')][0x0][_0x074b('0xbe')],'FaxAccountId':_0x4e3ca1['id'],'UserId':_0x328764[_0x074b('0x65')]['id'],'ContactId':_0x1ccfe5['id'],'AttachmentId':_0x328764[_0x074b('0x64')][_0x074b('0xb0')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x074b('0xbf')}]})[_0x074b('0x39')](function(_0x5d3fbc){return[_0x5d3fbc,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x074b('0xc0')](function(_0xe15f20,_0x9df7bb){if(_0x9df7bb){return _0xe15f20;}return db['FaxMessage'][_0x074b('0x63')]({'direction':_0x074b('0xbd'),'read':![],'body':_0x328764[_0x074b('0x64')][_0x074b('0xb0')][0x0][_0x074b('0xbe')],'FaxAccountId':_0x4e3ca1['id'],'FaxInteractionId':_0xe15f20['id'],'UserId':_0x328764[_0x074b('0x65')]['id'],'ContactId':_0xe15f20[_0x074b('0xc1')],'AttachmentId':_0x328764[_0x074b('0x64')][_0x074b('0xb0')][0x0]['id']})[_0x074b('0x39')](function(_0x12a866){_0xe15f20['dataValues']['Messages']=[];_0xe15f20['dataValues']['Messages'][_0x074b('0x90')](_0x12a866[_0x074b('0xc2')]);return _0xe15f20;});})[_0x074b('0x39')](function(_0x1a152f){respondWithRpcPromise('SendFax',_0x074b('0xc3'),{'FaxAccountId':_['isNil'](_0x328764[_0x074b('0x6a')]['id'])?undefined:_0x328764[_0x074b('0x6a')]['id'],'path':_[_0x074b('0xb6')](_0x328764[_0x074b('0x64')][_0x074b('0xb0')][0x0][_0x074b('0x7')])?undefined:_0x328764['body'][_0x074b('0xb0')][0x0]['path'],'fax':_[_0x074b('0xb6')](_0x328764[_0x074b('0x64')]['to'][0x0])?undefined:_0x328764['body']['to'][0x0],'AttachmentId':_0x328764[_0x074b('0x64')][_0x074b('0xb0')][0x0]['id']},client9002)['then'](function(_0xb0c469){logger['info'](_0x074b('0xc4'),_0xb0c469);})['catch'](function(_0xb87ea9){logger[_0x074b('0x2c')]('SendFaxRpc,\x20%s',_0xb87ea9);});return _0x1a152f;})[_0x074b('0x39')](respondWithResult(_0x25084a,null))[_0x074b('0x5f')](handleError(_0x25084a,null));};exports['addAgents']=function(_0x726e89,_0x1105ec,_0x20feca){return db[_0x074b('0x46')]['find']({'where':{'id':_0x726e89[_0x074b('0x6a')]['id']}})[_0x074b('0x39')](handleEntityNotFound(_0x1105ec,null))['then'](function(_0x5bb1b7){if(_0x5bb1b7){return _0x5bb1b7[_0x074b('0xc5')](_0x726e89['body'][_0x074b('0x77')],_[_0x074b('0x7a')](_0x726e89[_0x074b('0x64')],[_0x074b('0x77'),'id'])||{})[_0x074b('0xc0')](function(_0x322ed3){for(var _0xe51b61=0x0;_0xe51b61<_0x726e89['body']['ids'][_0x074b('0x61')];_0xe51b61+=0x1){socket[_0x074b('0xc6')]('userFaxAccount:save',{'UserId':Number(_0x726e89[_0x074b('0x64')][_0x074b('0x77')][_0xe51b61]),'FaxAccountId':Number(_0x726e89[_0x074b('0x6a')]['id'])});}return _0x322ed3;});}})[_0x074b('0x39')](respondWithResult(_0x1105ec,null))['catch'](handleError(_0x1105ec,null));};exports['removeAgents']=function(_0x5428fa,_0x5c53c4,_0x35d884){return db[_0x074b('0x46')][_0x074b('0x62')]({'where':{'id':_0x5428fa[_0x074b('0x6a')]['id']}})[_0x074b('0x39')](handleEntityNotFound(_0x5c53c4,null))[_0x074b('0x39')](function(_0x4a98f9){if(_0x4a98f9){return _0x4a98f9['removeAgents'](_0x5428fa[_0x074b('0x4c')][_0x074b('0x77')])[_0x074b('0x39')](function(){if(_['isArray'](_0x5428fa[_0x074b('0x4c')][_0x074b('0x77')])){for(var _0x2ecaae=0x0;_0x2ecaae<_0x5428fa['query']['ids']['length'];_0x2ecaae+=0x1){socket[_0x074b('0xc6')](_0x074b('0xc7'),{'UserId':Number(_0x5428fa['query'][_0x074b('0x77')][_0x2ecaae]),'FaxAccountId':Number(_0x5428fa[_0x074b('0x6a')]['id'])});}}else{socket[_0x074b('0xc6')](_0x074b('0xc7'),{'UserId':Number(_0x5428fa[_0x074b('0x4c')]['ids']),'FaxAccountId':Number(_0x5428fa[_0x074b('0x6a')]['id'])});}});}})[_0x074b('0x39')](respondWithStatusCode(_0x5c53c4,null))['catch'](handleError(_0x5c53c4,null));};exports[_0x074b('0xc8')]=function(_0x23f35e,_0x4ac359,_0x4e261a){var _0x20979b={};var _0x59121e={};var _0x113526;var _0x517f7a;return db[_0x074b('0x46')][_0x074b('0x74')]({'where':{'id':_0x23f35e['params']['id']}})[_0x074b('0x39')](handleEntityNotFound(_0x4ac359,null))[_0x074b('0x39')](function(_0xe8354c){if(_0xe8354c){_0x113526=_0xe8354c;_0x59121e[_0x074b('0x4b')]=_[_0x074b('0x4d')](db[_0x074b('0x7d')]['rawAttributes']);_0x59121e['query']=_[_0x074b('0x4d')](_0x23f35e[_0x074b('0x4c')]);_0x59121e[_0x074b('0x4e')]=_[_0x074b('0x4f')](_0x59121e[_0x074b('0x4b')],_0x59121e[_0x074b('0x4c')]);_0x20979b[_0x074b('0x50')]=_[_0x074b('0x4f')](_0x59121e[_0x074b('0x4b')],qs['fields'](_0x23f35e[_0x074b('0x4c')][_0x074b('0x51')]));_0x20979b[_0x074b('0x50')]=_0x20979b[_0x074b('0x50')][_0x074b('0x61')]?_0x20979b['attributes']:_0x59121e[_0x074b('0x4b')];_0x20979b[_0x074b('0x54')]=qs[_0x074b('0x6f')](_0x23f35e[_0x074b('0x4c')][_0x074b('0x6f')]);_0x20979b[_0x074b('0x57')]=qs[_0x074b('0x4e')](_['pick'](_0x23f35e[_0x074b('0x4c')],_0x59121e[_0x074b('0x4e')]));if(_0x23f35e[_0x074b('0x4c')]['filter']){_0x20979b[_0x074b('0x57')]=_['merge'](_0x20979b[_0x074b('0x57')],{'$or':_[_0x074b('0x45')](_0x20979b[_0x074b('0x50')],function(_0x45d29d){var _0x36db23={};_0x36db23[_0x45d29d]={'$like':'%'+_0x23f35e['query'][_0x074b('0x56')]+'%'};return _0x36db23;})});}_0x20979b=_[_0x074b('0x58')]({},_0x20979b,_0x23f35e['options']);return _0x113526['getAgents'](_0x20979b);}})['then'](function(_0x264328){if(_0x264328){_0x517f7a=_0x264328['length'];if(!_0x23f35e[_0x074b('0x4c')]['hasOwnProperty'](_0x074b('0x53'))){_0x20979b[_0x074b('0x31')]=qs[_0x074b('0x31')](_0x23f35e[_0x074b('0x4c')][_0x074b('0x31')]);_0x20979b[_0x074b('0x34')]=qs['offset'](_0x23f35e['query']['offset']);}return _0x113526[_0x074b('0xc8')](_0x20979b);}})['then'](function(_0x446abd){if(_0x446abd){return _0x446abd?{'count':_0x517f7a,'rows':_0x446abd}:null;}})[_0x074b('0x39')](respondWithResult(_0x4ac359,null))[_0x074b('0x5f')](handleError(_0x4ac359,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index bd22ca3..5c6889a 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 _0xac08=['emit','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x2a7b74,_0x45b0d5){var _0x114666=function(_0x1a293b){while(--_0x1a293b){_0x2a7b74['push'](_0x2a7b74['shift']());}};_0x114666(++_0x45b0d5);}(_0xac08,0xae));var _0x8ac0=function(_0x3f36e5,_0x106313){_0x3f36e5=_0x3f36e5-0x0;var _0x21bdae=_0xac08[_0x3f36e5];return _0x21bdae;};'use strict';var EventEmitter=require(_0x8ac0('0x0'));var FaxAccount=require(_0x8ac0('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x8ac0('0x2')](0x0);var events={'afterCreate':_0x8ac0('0x3'),'afterUpdate':_0x8ac0('0x4'),'afterDestroy':_0x8ac0('0x5')};function emitEvent(_0x23da3c){return function(_0x2658a3,_0x3d87de,_0x2051d1){FaxAccountEvents[_0x8ac0('0x6')](_0x23da3c+':'+_0x2658a3['id'],_0x2658a3);FaxAccountEvents[_0x8ac0('0x6')](_0x23da3c,_0x2658a3);_0x2051d1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x8ac0('0x7')](e,emitEvent(event));}}module[_0x8ac0('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x31a3=['hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x1d6998,_0x22d239){var _0x4267ba=function(_0x516b97){while(--_0x516b97){_0x1d6998['push'](_0x1d6998['shift']());}};_0x4267ba(++_0x22d239);}(_0x31a3,0x183));var _0x331a=function(_0x590a3a,_0xd9db9){_0x590a3a=_0x590a3a-0x0;var _0x49017f=_0x31a3[_0x590a3a];return _0x49017f;};'use strict';var EventEmitter=require(_0x331a('0x0'));var FaxAccount=require(_0x331a('0x1'))['db'][_0x331a('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x331a('0x3')](0x0);var events={'afterCreate':_0x331a('0x4'),'afterUpdate':_0x331a('0x5'),'afterDestroy':_0x331a('0x6')};function emitEvent(_0x26566f){return function(_0x153053,_0x1aa8c7,_0x39a478){FaxAccountEvents[_0x331a('0x7')](_0x26566f+':'+_0x153053['id'],_0x153053);FaxAccountEvents[_0x331a('0x7')](_0x26566f,_0x153053);_0x39a478(null);};}for(var e in events){if(events[_0x331a('0x8')](e)){var event=events[e];FaxAccount[_0x331a('0x9')](e,emitEvent(event));}}module[_0x331a('0xa')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 7e4bbbc..ed5fce0 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 _0xd163=['exports','define','lodash','api','bluebird','path','rimraf','../../config/environment','./faxAccount.attributes'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xd163,0x16a));var _0x3d16=function(_0x72a33d,_0x5691da){_0x72a33d=_0x72a33d-0x0;var _0x2621d5=_0xd163[_0x72a33d];return _0x2621d5;};'use strict';var _=require(_0x3d16('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3d16('0x1'));var moment=require('moment');var BPromise=require(_0x3d16('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3d16('0x3'));var rimraf=require(_0x3d16('0x4'));var config=require(_0x3d16('0x5'));var attributes=require(_0x3d16('0x6'));module[_0x3d16('0x7')]=function(_0x2f20e3,_0x4e9c87){return _0x2f20e3[_0x3d16('0x8')]('FaxAccount',attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b06=['bluebird','request-promise','exports','define','FaxAccount','lodash','../../config/logger','moment'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x5b06,0xcd));var _0x65b0=function(_0xb1d49c,_0x32418c){_0xb1d49c=_0xb1d49c-0x0;var _0x349c0c=_0x5b06[_0xb1d49c];return _0x349c0c;};'use strict';var _=require(_0x65b0('0x0'));var util=require('util');var logger=require(_0x65b0('0x1'))('api');var moment=require(_0x65b0('0x2'));var BPromise=require(_0x65b0('0x3'));var rp=require(_0x65b0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxAccount.attributes');module[_0x65b0('0x5')]=function(_0x1b2d92,_0x53909d){return _0x1b2d92[_0x65b0('0x6')](_0x65b0('0x7'),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 617bcea..c18b39e 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 _0x3718=['list','priority','asc','Contacts','length','defaults','create','spread','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','attributes','limit','include','map','model','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','keys','createdAt','updatedAt','difference','CompanyId','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','DESC','FaxApplication','Applications','List','get','applications'];(function(_0x2f9312,_0x2c0c31){var _0x409e6a=function(_0x259c8d){while(--_0x259c8d){_0x2f9312['push'](_0x2f9312['shift']());}};_0x409e6a(++_0x2c0c31);}(_0x3718,0xc9));var _0x8371=function(_0x2fa547,_0x6741ef){_0x2fa547=_0x2fa547-0x0;var _0x38b622=_0x3718[_0x2fa547];return _0x38b622;};'use strict';var _=require(_0x8371('0x0'));var util=require(_0x8371('0x1'));var moment=require(_0x8371('0x2'));var BPromise=require(_0x8371('0x3'));var rs=require(_0x8371('0x4'));var fs=require('fs');var Redis=require(_0x8371('0x5'));var db=require(_0x8371('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8371('0x7'))(_0x8371('0x8'));var config=require(_0x8371('0x9'));var jayson=require(_0x8371('0xa'));var client=jayson[_0x8371('0xb')][_0x8371('0xc')]({'port':0x232c});config['redis']=_['defaults'](config[_0x8371('0xd')],{'host':_0x8371('0xe'),'port':0x18eb});var socket=require(_0x8371('0xf'))(new Redis(config[_0x8371('0xd')]));require('./faxAccount.socket')[_0x8371('0x10')](socket);function respondWithRpcPromise(_0x321335,_0x4332fb,_0x3a9f2f){return new BPromise(function(_0x99d69,_0x4f5b17){return client[_0x8371('0x11')](_0x321335,_0x3a9f2f)[_0x8371('0x12')](function(_0x2297e1){logger[_0x8371('0x13')]('FaxAccount,\x20%s,\x20%s',_0x4332fb,_0x8371('0x14'));logger[_0x8371('0x15')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x4332fb,_0x8371('0x14'),JSON[_0x8371('0x16')](_0x2297e1));if(_0x2297e1[_0x8371('0x17')]){if(_0x2297e1[_0x8371('0x17')][_0x8371('0x18')]===0x1f4){logger[_0x8371('0x17')](_0x8371('0x19'),_0x4332fb,_0x2297e1[_0x8371('0x17')][_0x8371('0x1a')]);return _0x4f5b17(_0x2297e1[_0x8371('0x17')][_0x8371('0x1a')]);}logger[_0x8371('0x17')](_0x8371('0x19'),_0x4332fb,_0x2297e1[_0x8371('0x17')][_0x8371('0x1a')]);return _0x99d69(_0x2297e1[_0x8371('0x17')][_0x8371('0x1a')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x4332fb,_0x8371('0x14'));_0x99d69(_0x2297e1[_0x8371('0x1b')][_0x8371('0x1a')]);}})[_0x8371('0x1c')](function(_0x8d75b5){logger['error'](_0x8371('0x19'),_0x4332fb,_0x8d75b5);_0x4f5b17(_0x8d75b5);});});}exports[_0x8371('0x1d')]=function(_0x2f4e59){var _0x7dcd8c=this;return new Promise(function(_0x17b51a,_0xd3edb8){return db[_0x8371('0x1e')][_0x8371('0x1f')]({'raw':_0x2f4e59[_0x8371('0x20')]?_0x2f4e59[_0x8371('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x2f4e59['options']?_0x2f4e59[_0x8371('0x20')]['where']||null:null,'attributes':_0x2f4e59[_0x8371('0x20')]?_0x2f4e59['options'][_0x8371('0x21')]||null:null,'limit':_0x2f4e59[_0x8371('0x20')]?_0x2f4e59[_0x8371('0x20')][_0x8371('0x22')]||null:null,'include':_0x2f4e59[_0x8371('0x20')]?_0x2f4e59[_0x8371('0x20')][_0x8371('0x23')]?_[_0x8371('0x24')](_0x2f4e59['options'][_0x8371('0x23')],function(_0x43f717){return{'model':db[_0x43f717['model']],'as':_0x43f717['as'],'attributes':_0x43f717[_0x8371('0x21')],'include':_0x43f717[_0x8371('0x23')]?_[_0x8371('0x24')](_0x43f717[_0x8371('0x23')],function(_0x479958){return{'model':db[_0x479958[_0x8371('0x25')]],'as':_0x479958['as'],'attributes':_0x479958[_0x8371('0x21')],'include':_0x479958[_0x8371('0x23')]?_[_0x8371('0x24')](_0x479958[_0x8371('0x23')],function(_0x1260ff){return{'model':db[_0x1260ff[_0x8371('0x25')]],'as':_0x1260ff['as'],'attributes':_0x1260ff[_0x8371('0x21')]};}):[]};}):[]};}):[]:[]})[_0x8371('0x12')](function(_0x53a004){logger[_0x8371('0x13')]('GetFaxAccount',_0x2f4e59);logger[_0x8371('0x15')](_0x8371('0x1d'),_0x2f4e59,JSON[_0x8371('0x16')](_0x53a004));_0x17b51a(_0x53a004);})[_0x8371('0x1c')](function(_0x4d627d){logger['error'](_0x8371('0x1d'),_0x4d627d[_0x8371('0x1a')],_0x2f4e59);_0xd3edb8(_0x7dcd8c[_0x8371('0x17')](0x1f4,_0x4d627d[_0x8371('0x1a')]));});});};exports[_0x8371('0x26')]=function(_0x21d5f2,_0x49c3f9,_0x2284ae){var _0x278a95=this;return new Promise(function(_0x515430,_0x102ac9){var _0x216c35={'body':_0x21d5f2[_0x8371('0x27')],'channel':_0x8371('0x28')};var _0x10d4ea=[];var _0x556697=[];var _0xa0f46f={};return db[_0x8371('0x29')][_0x8371('0x2a')]()['then'](function(_0x4dddee){if(!_0x4dddee){throw new db[(_0x8371('0x2b'))][(_0x8371('0x2c'))](_0x8371('0x2d'));}_0x10d4ea=_['difference'](_[_0x8371('0x2e')](_0x4dddee),[_0x8371('0x2f'),_0x8371('0x30')]);_0x556697=_[_0x8371('0x31')](_[_0x8371('0x2e')](_0x4dddee),['createdAt',_0x8371('0x30'),_0x8371('0x32'),_0x8371('0x33')]);if(_0x21d5f2[_0x8371('0x27')]['id']){delete _0x21d5f2[_0x8371('0x27')]['id'];}if(_[_0x8371('0x34')](_0x21d5f2['body'][_0x8371('0x35')])){throw new db[(_0x8371('0x2b'))][(_0x8371('0x2c'))]('from\x20is\x20mandatory');}if(_[_0x8371('0x34')](_0x21d5f2[_0x8371('0x27')][_0x8371('0x27')])||_0x21d5f2['body']['body']===''){throw new db['Sequelize'][(_0x8371('0x2c'))](_0x8371('0x36'));}if(_[_0x8371('0x34')](_0x21d5f2[_0x8371('0x27')][_0x8371('0x37')])){throw new db[(_0x8371('0x2b'))][(_0x8371('0x2c'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x556697);}if(!_['includes'](_0x556697,_0x21d5f2[_0x8371('0x27')][_0x8371('0x37')])){throw new db[(_0x8371('0x2b'))][(_0x8371('0x2c'))](_0x8371('0x38')+_0x556697);}_0xa0f46f[_0x21d5f2[_0x8371('0x27')][_0x8371('0x37')]]=_0x21d5f2['body'][_0x8371('0x35')];})[_0x8371('0x12')](function(){return db[_0x8371('0x1e')][_0x8371('0x39')]({'where':{'id':_0x21d5f2[_0x8371('0x3a')]['id']},'include':[{'model':db[_0x8371('0x3b')],'as':'List','include':[{'model':db[_0x8371('0x29')],'as':'Contacts','where':_0xa0f46f,'limit':0x1,'order':[['updatedAt',_0x8371('0x3c')]]}]},{'model':db[_0x8371('0x3d')],'as':_0x8371('0x3e')}]});})['then'](function(_0x59f33b){if(_0x59f33b&&_0x59f33b[_0x8371('0x3f')]){var _0x54302e=_0x59f33b[_0x8371('0x40')]({'plain':!![]});_0x216c35[_0x8371('0x3a')]=_0x54302e;_0x216c35[_0x8371('0x41')]=_0x54302e[_0x8371('0x3e')];_0x216c35[_0x8371('0x42')]=_0x54302e[_0x8371('0x3f')];_0x216c35[_0x8371('0x41')]=_['orderBy'](_0x216c35[_0x8371('0x41')],[_0x8371('0x43')],[_0x8371('0x44')]);if(_0x216c35[_0x8371('0x3a')][_0x8371('0x3e')]){delete _0x216c35[_0x8371('0x3a')][_0x8371('0x3e')];}if(_0x216c35['account']['List']&&_0x216c35['account'][_0x8371('0x3f')][_0x8371('0x45')][_0x8371('0x46')]){return _0x216c35['account'][_0x8371('0x3f')][_0x8371('0x45')][0x0];}var _0x4e892e=_[_0x8371('0x47')](_0x21d5f2[_0x8371('0x27')],{'firstName':_0x21d5f2['body'][_0x8371('0x35')],'ListId':_0x54302e[_0x8371('0x33')]});_0x4e892e[_0x21d5f2['body'][_0x8371('0x37')]]=_0x21d5f2[_0x8371('0x27')][_0x8371('0x35')];return db[_0x8371('0x29')]['create'](_0x4e892e,{'fields':_0x10d4ea,'raw':!![]});}})[_0x8371('0x12')](function(_0x4f340c){_0x216c35['contact']=_0x4f340c;if(_0x4f340c){var _0x405a8f={'ContactId':_0x4f340c['id'],'FaxAccountId':_0x21d5f2[_0x8371('0x3a')]['id'],'fax':_0x4f340c[_0x8371('0x28')]};return db['FaxInteraction'][_0x8371('0x39')]({'where':{'ContactId':_0x4f340c['id'],'closed':![],'FaxAccountId':_0x21d5f2[_0x8371('0x3a')]['id']}})['then'](function(_0xf462bd){if(_0xf462bd){return[_0xf462bd,![]];}return db['FaxInteraction'][_0x8371('0x48')](_0x405a8f)['then'](function(_0x2b22fe){return[_0x2b22fe,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x8371('0x49')](function(_0x5042e9,_0x4b5ff0){var _0x4dfa47=_0x5042e9[_0x8371('0x40')]({'plain':!![]});if(_0x4b5ff0){if(_0x216c35[_0x8371('0x3a')]['autoclose']){_0x216c35['applications']['push']({'id':0x0,'priority':_0x216c35['applications'][_0x8371('0x46')]+0x1,'app':_0x8371('0x4a'),'appdata':_0x8371('0x4b'),'interval':_0x8371('0x4c')});}_0x4dfa47[_0x8371('0x4d')]=!![];}else{_0x4dfa47['created']=![];}_0x216c35[_0x8371('0x4e')]=_0x4dfa47;return db[_0x8371('0x4f')][_0x8371('0x48')]({'body':_0x21d5f2['body']['body'],'FaxAccountId':_0x21d5f2['account']['id'],'FaxInteractionId':_0x5042e9['id'],'direction':'in','ContactId':_0x5042e9[_0x8371('0x50')],'AttachmentId':_0x21d5f2[_0x8371('0x27')][_0x8371('0x51')]});})[_0x8371('0x12')](function(_0x3fdf38){_0x216c35[_0x8371('0x1a')]=_0x3fdf38;if(_0x216c35['interaction'][_0x8371('0x52')]){return db['User'][_0x8371('0x39')]({'attributes':['id','name'],'where':{'id':_0x216c35[_0x8371('0x4e')][_0x8371('0x52')]}})[_0x8371('0x12')](function(_0x4f8f4d){if(_0x4f8f4d){_0x216c35[_0x8371('0x41')][_0x8371('0x53')]({'id':0x0,'priority':0x0,'app':_0x8371('0x54'),'appdata':_0x4f8f4d[_0x8371('0x55')]+','+(_0x216c35[_0x8371('0x3a')][_0x8371('0x56')]||0xa),'interval':_0x8371('0x4c')});}return respondWithRpcPromise(_0x8371('0x57'),_0x8371('0x58'),_0x216c35);});}return respondWithRpcPromise('Start',_0x8371('0x58'),_0x216c35);})[_0x8371('0x12')](function(_0xc6d608){_0x515430(_0xc6d608);})[_0x8371('0x1c')](function(_0x1f1b41){_0x102ac9(_0x278a95[_0x8371('0x17')](0x1f4,_0x1f1b41[_0x8371('0x1a')]));});});}; \ No newline at end of file +var _0x7a22=['options','where','include','model','attributes','map','GetFaxAccount','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','CompanyId','ListId','body','from','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','account','CmList','List','Contacts','updatedAt','DESC','FaxApplication','get','applications','Applications','orderBy','priority','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','AttachmentId','UserId','User','name','unshift','waitForTheAssignedAgent','Start','startRouting','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','request\x20sent','stringify','error','code','message','FaxAccount,\x20%s,\x20%s','catch','findAll','raw'];(function(_0x3fceaf,_0x181d1e){var _0x50d57c=function(_0x5d87ef){while(--_0x5d87ef){_0x3fceaf['push'](_0x3fceaf['shift']());}};_0x50d57c(++_0x181d1e);}(_0x7a22,0x19b));var _0x27a2=function(_0x220e60,_0x15e84e){_0x220e60=_0x220e60-0x0;var _0x16a088=_0x7a22[_0x220e60];return _0x16a088;};'use strict';var _=require('lodash');var util=require(_0x27a2('0x0'));var moment=require('moment');var BPromise=require(_0x27a2('0x1'));var rs=require(_0x27a2('0x2'));var fs=require('fs');var Redis=require(_0x27a2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x27a2('0x4'));var logger=require(_0x27a2('0x5'))(_0x27a2('0x6'));var config=require(_0x27a2('0x7'));var jayson=require(_0x27a2('0x8'));var client=jayson[_0x27a2('0x9')][_0x27a2('0xa')]({'port':0x232c});config[_0x27a2('0xb')]=_[_0x27a2('0xc')](config[_0x27a2('0xb')],{'host':_0x27a2('0xd'),'port':0x18eb});var socket=require(_0x27a2('0xe'))(new Redis(config[_0x27a2('0xb')]));require(_0x27a2('0xf'))[_0x27a2('0x10')](socket);function respondWithRpcPromise(_0x437294,_0x32e5e6,_0x28283b){return new BPromise(function(_0x5791bc,_0x59cd38){return client[_0x27a2('0x11')](_0x437294,_0x28283b)[_0x27a2('0x12')](function(_0x26051e){logger[_0x27a2('0x13')]('FaxAccount,\x20%s,\x20%s',_0x32e5e6,'request\x20sent');logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x32e5e6,_0x27a2('0x14'),JSON[_0x27a2('0x15')](_0x26051e));if(_0x26051e[_0x27a2('0x16')]){if(_0x26051e[_0x27a2('0x16')][_0x27a2('0x17')]===0x1f4){logger[_0x27a2('0x16')]('FaxAccount,\x20%s,\x20%s',_0x32e5e6,_0x26051e[_0x27a2('0x16')][_0x27a2('0x18')]);return _0x59cd38(_0x26051e['error']['message']);}logger[_0x27a2('0x16')](_0x27a2('0x19'),_0x32e5e6,_0x26051e[_0x27a2('0x16')]['message']);return _0x5791bc(_0x26051e[_0x27a2('0x16')]['message']);}else{logger[_0x27a2('0x13')]('FaxAccount,\x20%s,\x20%s',_0x32e5e6,'request\x20sent');_0x5791bc(_0x26051e['result'][_0x27a2('0x18')]);}})[_0x27a2('0x1a')](function(_0x1613fe){logger['error'](_0x27a2('0x19'),_0x32e5e6,_0x1613fe);_0x59cd38(_0x1613fe);});});}exports['GetFaxAccount']=function(_0x1cee31){var _0x10e855=this;return new Promise(function(_0x2c9e34,_0x2432a8){return db['FaxAccount'][_0x27a2('0x1b')]({'raw':_0x1cee31['options']?_0x1cee31['options'][_0x27a2('0x1c')]===undefined?!![]:![]:!![],'where':_0x1cee31[_0x27a2('0x1d')]?_0x1cee31['options'][_0x27a2('0x1e')]||null:null,'attributes':_0x1cee31[_0x27a2('0x1d')]?_0x1cee31['options']['attributes']||null:null,'limit':_0x1cee31[_0x27a2('0x1d')]?_0x1cee31[_0x27a2('0x1d')]['limit']||null:null,'include':_0x1cee31[_0x27a2('0x1d')]?_0x1cee31['options'][_0x27a2('0x1f')]?_['map'](_0x1cee31[_0x27a2('0x1d')][_0x27a2('0x1f')],function(_0x4d6e93){return{'model':db[_0x4d6e93[_0x27a2('0x20')]],'as':_0x4d6e93['as'],'attributes':_0x4d6e93[_0x27a2('0x21')],'include':_0x4d6e93[_0x27a2('0x1f')]?_['map'](_0x4d6e93[_0x27a2('0x1f')],function(_0x52030d){return{'model':db[_0x52030d[_0x27a2('0x20')]],'as':_0x52030d['as'],'attributes':_0x52030d[_0x27a2('0x21')],'include':_0x52030d[_0x27a2('0x1f')]?_[_0x27a2('0x22')](_0x52030d['include'],function(_0x15d981){return{'model':db[_0x15d981['model']],'as':_0x15d981['as'],'attributes':_0x15d981[_0x27a2('0x21')]};}):[]};}):[]};}):[]:[]})[_0x27a2('0x12')](function(_0x408c79){logger[_0x27a2('0x13')](_0x27a2('0x23'),_0x1cee31);logger['debug'](_0x27a2('0x23'),_0x1cee31,JSON[_0x27a2('0x15')](_0x408c79));_0x2c9e34(_0x408c79);})[_0x27a2('0x1a')](function(_0x28322d){logger[_0x27a2('0x16')](_0x27a2('0x23'),_0x28322d[_0x27a2('0x18')],_0x1cee31);_0x2432a8(_0x10e855[_0x27a2('0x16')](0x1f4,_0x28322d[_0x27a2('0x18')]));});});};exports['NotifyFaxAccount']=function(_0xc79e2a,_0x541e42,_0x411a15){var _0x33d000=this;return new Promise(function(_0x2bdbc8,_0x3514c6){var _0x1d3e54={'body':_0xc79e2a['body'],'channel':_0x27a2('0x24')};var _0x1965b9=[];var _0x464c3c=[];var _0x531e93={};return db[_0x27a2('0x25')][_0x27a2('0x26')]()[_0x27a2('0x12')](function(_0x34ba3e){if(!_0x34ba3e){throw new db[(_0x27a2('0x27'))][(_0x27a2('0x28'))](_0x27a2('0x29'));}_0x1965b9=_[_0x27a2('0x2a')](_[_0x27a2('0x2b')](_0x34ba3e),['createdAt','updatedAt']);_0x464c3c=_[_0x27a2('0x2a')](_[_0x27a2('0x2b')](_0x34ba3e),['createdAt','updatedAt',_0x27a2('0x2c'),_0x27a2('0x2d')]);if(_0xc79e2a[_0x27a2('0x2e')]['id']){delete _0xc79e2a['body']['id'];}if(_['isNil'](_0xc79e2a[_0x27a2('0x2e')][_0x27a2('0x2f')])){throw new db[(_0x27a2('0x27'))][(_0x27a2('0x28'))](_0x27a2('0x30'));}if(_['isNil'](_0xc79e2a[_0x27a2('0x2e')][_0x27a2('0x2e')])||_0xc79e2a[_0x27a2('0x2e')][_0x27a2('0x2e')]===''){throw new db[(_0x27a2('0x27'))][(_0x27a2('0x28'))](_0x27a2('0x31'));}if(_['isNil'](_0xc79e2a['body']['mapKey'])){throw new db[(_0x27a2('0x27'))]['ValidationError'](_0x27a2('0x32')+_0x464c3c);}if(!_[_0x27a2('0x33')](_0x464c3c,_0xc79e2a[_0x27a2('0x2e')][_0x27a2('0x34')])){throw new db[(_0x27a2('0x27'))][(_0x27a2('0x28'))](_0x27a2('0x35')+_0x464c3c);}_0x531e93[_0xc79e2a[_0x27a2('0x2e')][_0x27a2('0x34')]]=_0xc79e2a[_0x27a2('0x2e')]['from'];})[_0x27a2('0x12')](function(){return db['FaxAccount']['find']({'where':{'id':_0xc79e2a[_0x27a2('0x36')]['id']},'include':[{'model':db[_0x27a2('0x37')],'as':_0x27a2('0x38'),'include':[{'model':db[_0x27a2('0x25')],'as':_0x27a2('0x39'),'where':_0x531e93,'limit':0x1,'order':[[_0x27a2('0x3a'),_0x27a2('0x3b')]]}]},{'model':db[_0x27a2('0x3c')],'as':'Applications'}]});})[_0x27a2('0x12')](function(_0x5a989c){if(_0x5a989c&&_0x5a989c[_0x27a2('0x38')]){var _0x2c1cdb=_0x5a989c[_0x27a2('0x3d')]({'plain':!![]});_0x1d3e54[_0x27a2('0x36')]=_0x2c1cdb;_0x1d3e54[_0x27a2('0x3e')]=_0x2c1cdb[_0x27a2('0x3f')];_0x1d3e54['list']=_0x2c1cdb[_0x27a2('0x38')];_0x1d3e54[_0x27a2('0x3e')]=_[_0x27a2('0x40')](_0x1d3e54['applications'],[_0x27a2('0x41')],['asc']);if(_0x1d3e54[_0x27a2('0x36')][_0x27a2('0x3f')]){delete _0x1d3e54[_0x27a2('0x36')][_0x27a2('0x3f')];}if(_0x1d3e54[_0x27a2('0x36')][_0x27a2('0x38')]&&_0x1d3e54[_0x27a2('0x36')][_0x27a2('0x38')][_0x27a2('0x39')][_0x27a2('0x42')]){return _0x1d3e54[_0x27a2('0x36')][_0x27a2('0x38')]['Contacts'][0x0];}var _0x4f7c81=_[_0x27a2('0xc')](_0xc79e2a['body'],{'firstName':_0xc79e2a[_0x27a2('0x2e')]['from'],'ListId':_0x2c1cdb[_0x27a2('0x2d')]});_0x4f7c81[_0xc79e2a[_0x27a2('0x2e')][_0x27a2('0x34')]]=_0xc79e2a[_0x27a2('0x2e')][_0x27a2('0x2f')];return db[_0x27a2('0x25')][_0x27a2('0x43')](_0x4f7c81,{'fields':_0x1965b9,'raw':!![]});}})[_0x27a2('0x12')](function(_0x2bef15){_0x1d3e54[_0x27a2('0x44')]=_0x2bef15;if(_0x2bef15){var _0x3840e3={'ContactId':_0x2bef15['id'],'FaxAccountId':_0xc79e2a['account']['id'],'fax':_0x2bef15[_0x27a2('0x24')]};return db[_0x27a2('0x45')]['find']({'where':{'ContactId':_0x2bef15['id'],'closed':![],'FaxAccountId':_0xc79e2a[_0x27a2('0x36')]['id']}})[_0x27a2('0x12')](function(_0x95ecdf){if(_0x95ecdf){return[_0x95ecdf,![]];}return db[_0x27a2('0x45')][_0x27a2('0x43')](_0x3840e3)[_0x27a2('0x12')](function(_0x3bf243){return[_0x3bf243,!![]];});});}else{throw new Error(_0x27a2('0x46'));}})[_0x27a2('0x47')](function(_0x1e7aa6,_0x1990ba){var _0x4cef76=_0x1e7aa6[_0x27a2('0x3d')]({'plain':!![]});if(_0x1990ba){if(_0x1d3e54[_0x27a2('0x36')][_0x27a2('0x48')]){_0x1d3e54[_0x27a2('0x3e')][_0x27a2('0x49')]({'id':0x0,'priority':_0x1d3e54[_0x27a2('0x3e')][_0x27a2('0x42')]+0x1,'app':_0x27a2('0x4a'),'appdata':_0x27a2('0x4b'),'interval':_0x27a2('0x4c')});}_0x4cef76[_0x27a2('0x4d')]=!![];}else{_0x4cef76[_0x27a2('0x4d')]=![];}_0x1d3e54[_0x27a2('0x4e')]=_0x4cef76;return db[_0x27a2('0x4f')][_0x27a2('0x43')]({'body':_0xc79e2a[_0x27a2('0x2e')][_0x27a2('0x2e')],'FaxAccountId':_0xc79e2a[_0x27a2('0x36')]['id'],'FaxInteractionId':_0x1e7aa6['id'],'direction':'in','ContactId':_0x1e7aa6['ContactId'],'AttachmentId':_0xc79e2a[_0x27a2('0x2e')][_0x27a2('0x50')]});})[_0x27a2('0x12')](function(_0x4d9647){_0x1d3e54[_0x27a2('0x18')]=_0x4d9647;if(_0x1d3e54['interaction'][_0x27a2('0x51')]){return db[_0x27a2('0x52')]['find']({'attributes':['id',_0x27a2('0x53')],'where':{'id':_0x1d3e54[_0x27a2('0x4e')]['UserId']}})[_0x27a2('0x12')](function(_0x456995){if(_0x456995){_0x1d3e54['applications'][_0x27a2('0x54')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x456995[_0x27a2('0x53')]+','+(_0x1d3e54[_0x27a2('0x36')][_0x27a2('0x55')]||0xa),'interval':_0x27a2('0x4c')});}return respondWithRpcPromise(_0x27a2('0x56'),'startRouting',_0x1d3e54);});}return respondWithRpcPromise(_0x27a2('0x56'),_0x27a2('0x57'),_0x1d3e54);})[_0x27a2('0x12')](function(_0x4732e9){_0x2bdbc8(_0x4732e9);})[_0x27a2('0x1a')](function(_0x255438){_0x3514c6(_0x33d000[_0x27a2('0x16')](0x1f4,_0x255438['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 144492b..fb5eeb9 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 _0xa1bd=['emit','removeListener','register','length','faxAccount:','./faxAccount.events','save','remove','update'];(function(_0x4d573c,_0x40c29e){var _0x3d8abe=function(_0x3c1d44){while(--_0x3c1d44){_0x4d573c['push'](_0x4d573c['shift']());}};_0x3d8abe(++_0x40c29e);}(_0xa1bd,0x71));var _0xda1b=function(_0x2176ad,_0x27f115){_0x2176ad=_0x2176ad-0x0;var _0x3c2dc7=_0xa1bd[_0x2176ad];return _0x3c2dc7;};'use strict';var FaxAccountEvents=require(_0xda1b('0x0'));var events=[_0xda1b('0x1'),_0xda1b('0x2'),_0xda1b('0x3')];function createListener(_0x2a6fdf,_0x4e8896){return function(_0xb729b1){_0x4e8896[_0xda1b('0x4')](_0x2a6fdf,_0xb729b1);};}function removeListener(_0x4c2a4d,_0x59fc8){return function(){FaxAccountEvents[_0xda1b('0x5')](_0x4c2a4d,_0x59fc8);};}exports[_0xda1b('0x6')]=function(_0x60037d){for(var _0x3b28c4=0x0,_0x315562=events[_0xda1b('0x7')];_0x3b28c4<_0x315562;_0x3b28c4++){var _0x486df6=events[_0x3b28c4];var _0x2c821c=createListener(_0xda1b('0x8')+_0x486df6,_0x60037d);FaxAccountEvents['on'](_0x486df6,_0x2c821c);}}; \ No newline at end of file +var _0xcfb5=['update','emit','register','length','./faxAccount.events','save'];(function(_0x119be7,_0x1beb9e){var _0x10420c=function(_0x302a87){while(--_0x302a87){_0x119be7['push'](_0x119be7['shift']());}};_0x10420c(++_0x1beb9e);}(_0xcfb5,0x10c));var _0x5cfb=function(_0x1e9d6a,_0x3e5cab){_0x1e9d6a=_0x1e9d6a-0x0;var _0x222bd1=_0xcfb5[_0x1e9d6a];return _0x222bd1;};'use strict';var FaxAccountEvents=require(_0x5cfb('0x0'));var events=[_0x5cfb('0x1'),'remove',_0x5cfb('0x2')];function createListener(_0x270172,_0x55ceb4){return function(_0x14e229){_0x55ceb4[_0x5cfb('0x3')](_0x270172,_0x14e229);};}function removeListener(_0x109cb1,_0x44a7de){return function(){FaxAccountEvents['removeListener'](_0x109cb1,_0x44a7de);};}exports[_0x5cfb('0x4')]=function(_0x187559){for(var _0x1aa7a0=0x0,_0x2358fe=events[_0x5cfb('0x5')];_0x1aa7a0<_0x2358fe;_0x1aa7a0++){var _0x3f36a1=events[_0x1aa7a0];var _0x4debad=createListener('faxAccount:'+_0x3f36a1,_0x187559);FaxAccountEvents['on'](_0x3f36a1,_0x4debad);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index f37008c..4c40276 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(_0x4768dc,_0x2f5014){var _0x1c75cc=function(_0x3109ba){while(--_0x3109ba){_0x4768dc['push'](_0x4768dc['shift']());}};_0x1c75cc(++_0x2f5014);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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(_0x2e60c4,_0x1f06c6){var _0xd92e53=function(_0x59586c){while(--_0x59586c){_0x2e60c4['push'](_0x2e60c4['shift']());}};_0xd92e53(++_0x1f06c6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('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 df1955a..16ff74b 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 _0x9af1=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9af1,0xcd));var _0x19af=function(_0x293257,_0x480d4b){_0x293257=_0x293257-0x0;var _0x51a3bc=_0x9af1[_0x293257];return _0x51a3bc;};'use strict';var Sequelize=require(_0x19af('0x0'));module[_0x19af('0x1')]={'priority':{'type':Sequelize[_0x19af('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x19af('0x3')],'allowNull':![],'defaultValue':_0x19af('0x4')},'appdata':{'type':Sequelize[_0x19af('0x5')]()},'description':{'type':Sequelize[_0x19af('0x3')]},'interval':{'type':Sequelize[_0x19af('0x3')],'defaultValue':_0x19af('0x6')}}; \ No newline at end of file +var _0x2906=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x37dbce,_0x1b471e){var _0x41ad96=function(_0x158665){while(--_0x158665){_0x37dbce['push'](_0x37dbce['shift']());}};_0x41ad96(++_0x1b471e);}(_0x2906,0x1c0));var _0x6290=function(_0x4433b,_0x1eded1){_0x4433b=_0x4433b-0x0;var _0xffc1da=_0x2906[_0x4433b];return _0xffc1da;};'use strict';var Sequelize=require(_0x6290('0x0'));module[_0x6290('0x1')]={'priority':{'type':Sequelize[_0x6290('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6290('0x3')],'allowNull':![],'defaultValue':_0x6290('0x4')},'appdata':{'type':Sequelize[_0x6290('0x5')]()},'description':{'type':Sequelize[_0x6290('0x3')]},'interval':{'type':Sequelize[_0x6290('0x3')],'defaultValue':_0x6290('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index d845436..1a25b36 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 _0x9e7a=['params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','status','json','undefined','count','offset','limit','set','Content-Range','save','then','destroy','end','stack','name','send','index','map','FaxApplication','fieldName','model','query','filters','attributes','intersection','fields','length','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','rawAttributes','keys','find','body','update'];(function(_0x3e2ddf,_0x1d5ca6){var _0x8f294f=function(_0xf89c73){while(--_0xf89c73){_0x3e2ddf['push'](_0x3e2ddf['shift']());}};_0x8f294f(++_0x1d5ca6);}(_0x9e7a,0x150));var _0xa9e7=function(_0x20598b,_0xef113d){_0x20598b=_0x20598b-0x0;var _0x4c9e0f=_0x9e7a[_0x20598b];return _0x4c9e0f;};'use strict';var emlformat=require(_0xa9e7('0x0'));var rimraf=require(_0xa9e7('0x1'));var zipdir=require(_0xa9e7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa9e7('0x3'));var moment=require(_0xa9e7('0x4'));var BPromise=require(_0xa9e7('0x5'));var Mustache=require(_0xa9e7('0x6'));var util=require(_0xa9e7('0x7'));var path=require(_0xa9e7('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa9e7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa9e7('0xa'));var squel=require(_0xa9e7('0xb'));var crypto=require(_0xa9e7('0xc'));var jsforce=require(_0xa9e7('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa9e7('0xe'));var querystring=require(_0xa9e7('0xf'));var Papa=require(_0xa9e7('0x10'));var Redis=require(_0xa9e7('0x11'));var authService=require(_0xa9e7('0x12'));var qs=require(_0xa9e7('0x13'));var as=require(_0xa9e7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xa9e7('0x15'));var licenseUtil=require(_0xa9e7('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3aa833,_0x1d1a2d){_0x1d1a2d=_0x1d1a2d||0xcc;return function(_0x4f3fb5){if(_0x4f3fb5){return _0x3aa833['sendStatus'](_0x1d1a2d);}return _0x3aa833[_0xa9e7('0x17')](_0x1d1a2d)['end']();};}function respondWithResult(_0x42c681,_0x5d6516){_0x5d6516=_0x5d6516||0xc8;return function(_0x25caed){if(_0x25caed){return _0x42c681['status'](_0x5d6516)[_0xa9e7('0x18')](_0x25caed);}};}function respondWithFilteredResult(_0x48d7a4,_0x4c4ddd){return function(_0x14ff64){if(_0x14ff64){var _0x131566=typeof _0x4c4ddd['offset']===_0xa9e7('0x19')&&typeof _0x4c4ddd['limit']==='undefined';var _0x5bdf59=_0x14ff64[_0xa9e7('0x1a')];var _0x3d461b=_0x131566?0x0:_0x4c4ddd['offset'];var _0x4a317d=_0x131566?_0x14ff64[_0xa9e7('0x1a')]:_0x4c4ddd[_0xa9e7('0x1b')]+_0x4c4ddd[_0xa9e7('0x1c')];var _0x3cef50;if(_0x4a317d>=_0x5bdf59){_0x4a317d=_0x5bdf59;_0x3cef50=0xc8;}else{_0x3cef50=0xce;}_0x48d7a4['status'](_0x3cef50);return _0x48d7a4[_0xa9e7('0x1d')](_0xa9e7('0x1e'),_0x3d461b+'-'+_0x4a317d+'/'+_0x5bdf59)[_0xa9e7('0x18')](_0x14ff64);}return null;};}function patchUpdates(_0x58e249){return function(_0x20e2d0){try{jsonpatch['apply'](_0x20e2d0,_0x58e249,!![]);}catch(_0x29088c){return BPromise['reject'](_0x29088c);}return _0x20e2d0[_0xa9e7('0x1f')]();};}function saveUpdates(_0x5e9070,_0x443640){return function(_0x5c240b){if(_0x5c240b){return _0x5c240b['update'](_0x5e9070)[_0xa9e7('0x20')](function(_0x53f74f){return _0x53f74f;});}return null;};}function removeEntity(_0x2788a6,_0x5e0aed){return function(_0x322e6e){if(_0x322e6e){return _0x322e6e[_0xa9e7('0x21')]()['then'](function(){_0x2788a6[_0xa9e7('0x17')](0xcc)[_0xa9e7('0x22')]();});}};}function handleEntityNotFound(_0x4bd244,_0x1e43fd){return function(_0x417cbc){if(!_0x417cbc){_0x4bd244['sendStatus'](0x194);}return _0x417cbc;};}function handleError(_0x50ac72,_0xa6f9bd){_0xa6f9bd=_0xa6f9bd||0x1f4;return function(_0x4ded9d){logger['error'](_0x4ded9d[_0xa9e7('0x23')]);if(_0x4ded9d[_0xa9e7('0x24')]){delete _0x4ded9d[_0xa9e7('0x24')];}_0x50ac72['status'](_0xa6f9bd)[_0xa9e7('0x25')](_0x4ded9d);};}exports[_0xa9e7('0x26')]=function(_0x5c578c,_0x41b6b3){var _0x581434={},_0x1f80d1={},_0x2009ca={'count':0x0,'rows':[]};var _0x1e1be6=_[_0xa9e7('0x27')](db[_0xa9e7('0x28')]['rawAttributes'],function(_0x214aac){return{'name':_0x214aac[_0xa9e7('0x29')],'type':_0x214aac['type']['key']};});_0x1f80d1[_0xa9e7('0x2a')]=_['map'](_0x1e1be6,_0xa9e7('0x24'));_0x1f80d1[_0xa9e7('0x2b')]=_['keys'](_0x5c578c[_0xa9e7('0x2b')]);_0x1f80d1[_0xa9e7('0x2c')]=_['intersection'](_0x1f80d1[_0xa9e7('0x2a')],_0x1f80d1[_0xa9e7('0x2b')]);_0x581434[_0xa9e7('0x2d')]=_[_0xa9e7('0x2e')](_0x1f80d1[_0xa9e7('0x2a')],qs[_0xa9e7('0x2f')](_0x5c578c['query'][_0xa9e7('0x2f')]));_0x581434[_0xa9e7('0x2d')]=_0x581434[_0xa9e7('0x2d')][_0xa9e7('0x30')]?_0x581434[_0xa9e7('0x2d')]:_0x1f80d1[_0xa9e7('0x2a')];if(!_0x5c578c[_0xa9e7('0x2b')]['hasOwnProperty']('nolimit')){_0x581434[_0xa9e7('0x1c')]=qs[_0xa9e7('0x1c')](_0x5c578c[_0xa9e7('0x2b')][_0xa9e7('0x1c')]);_0x581434[_0xa9e7('0x1b')]=qs[_0xa9e7('0x1b')](_0x5c578c['query'][_0xa9e7('0x1b')]);}_0x581434['order']=qs[_0xa9e7('0x31')](_0x5c578c[_0xa9e7('0x2b')][_0xa9e7('0x31')]);_0x581434[_0xa9e7('0x32')]=qs[_0xa9e7('0x2c')](_[_0xa9e7('0x33')](_0x5c578c[_0xa9e7('0x2b')],_0x1f80d1[_0xa9e7('0x2c')]),_0x1e1be6);if(_0x5c578c[_0xa9e7('0x2b')]['filter']){_0x581434[_0xa9e7('0x32')]=_[_0xa9e7('0x34')](_0x581434[_0xa9e7('0x32')],{'$or':_[_0xa9e7('0x27')](_0x1e1be6,function(_0x7ac797){if(_0x7ac797['type']!==_0xa9e7('0x35')){var _0x26d049={};_0x26d049[_0x7ac797['name']]={'$like':'%'+_0x5c578c[_0xa9e7('0x2b')][_0xa9e7('0x36')]+'%'};return _0x26d049;}})});}_0x581434=_[_0xa9e7('0x34')]({},_0x581434,_0x5c578c[_0xa9e7('0x37')]);var _0x4c5930={'where':_0x581434[_0xa9e7('0x32')]};return db[_0xa9e7('0x28')][_0xa9e7('0x1a')](_0x4c5930)[_0xa9e7('0x20')](function(_0x12d935){_0x2009ca['count']=_0x12d935;if(_0x5c578c[_0xa9e7('0x2b')][_0xa9e7('0x38')]){_0x581434[_0xa9e7('0x39')]=[{'all':!![]}];}return db[_0xa9e7('0x28')]['findAll'](_0x581434);})[_0xa9e7('0x20')](function(_0x138bd2){_0x2009ca[_0xa9e7('0x3a')]=_0x138bd2;return _0x2009ca;})[_0xa9e7('0x20')](respondWithFilteredResult(_0x41b6b3,_0x581434))[_0xa9e7('0x3b')](handleError(_0x41b6b3,null));};exports[_0xa9e7('0x3c')]=function(_0x2dd6b2,_0x5a233e){var _0x2c6157={'raw':!![],'where':{'id':_0x2dd6b2['params']['id']}},_0x518d64={};_0x518d64[_0xa9e7('0x2a')]=_['keys'](db[_0xa9e7('0x28')][_0xa9e7('0x3d')]);_0x518d64['query']=_[_0xa9e7('0x3e')](_0x2dd6b2[_0xa9e7('0x2b')]);_0x518d64[_0xa9e7('0x2c')]=_[_0xa9e7('0x2e')](_0x518d64[_0xa9e7('0x2a')],_0x518d64['query']);_0x2c6157[_0xa9e7('0x2d')]=_[_0xa9e7('0x2e')](_0x518d64[_0xa9e7('0x2a')],qs[_0xa9e7('0x2f')](_0x2dd6b2[_0xa9e7('0x2b')]['fields']));_0x2c6157['attributes']=_0x2c6157[_0xa9e7('0x2d')][_0xa9e7('0x30')]?_0x2c6157[_0xa9e7('0x2d')]:_0x518d64[_0xa9e7('0x2a')];if(_0x2dd6b2[_0xa9e7('0x2b')]['includeAll']){_0x2c6157[_0xa9e7('0x39')]=[{'all':!![]}];}_0x2c6157=_[_0xa9e7('0x34')]({},_0x2c6157,_0x2dd6b2[_0xa9e7('0x37')]);return db[_0xa9e7('0x28')][_0xa9e7('0x3f')](_0x2c6157)[_0xa9e7('0x20')](handleEntityNotFound(_0x5a233e,null))[_0xa9e7('0x20')](respondWithResult(_0x5a233e,null))[_0xa9e7('0x3b')](handleError(_0x5a233e,null));};exports['create']=function(_0x3a2dc9,_0xd94f03){return db[_0xa9e7('0x28')]['create'](_0x3a2dc9[_0xa9e7('0x40')],{})['then'](respondWithResult(_0xd94f03,0xc9))[_0xa9e7('0x3b')](handleError(_0xd94f03,null));};exports[_0xa9e7('0x41')]=function(_0x3ad823,_0x494fd6){if(_0x3ad823[_0xa9e7('0x40')]['id']){delete _0x3ad823[_0xa9e7('0x40')]['id'];}return db['FaxApplication'][_0xa9e7('0x3f')]({'where':{'id':_0x3ad823[_0xa9e7('0x42')]['id']}})[_0xa9e7('0x20')](handleEntityNotFound(_0x494fd6,null))[_0xa9e7('0x20')](saveUpdates(_0x3ad823[_0xa9e7('0x40')],null))[_0xa9e7('0x20')](respondWithResult(_0x494fd6,null))[_0xa9e7('0x3b')](handleError(_0x494fd6,null));};exports[_0xa9e7('0x21')]=function(_0x4c64a4,_0x538b67){return db[_0xa9e7('0x28')][_0xa9e7('0x3f')]({'where':{'id':_0x4c64a4['params']['id']}})[_0xa9e7('0x20')](handleEntityNotFound(_0x538b67,null))['then'](removeEntity(_0x538b67,null))[_0xa9e7('0x3b')](handleError(_0x538b67,null));}; \ No newline at end of file +var _0x293c=['intersection','fields','length','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','rows','catch','model','include','create','body','params','rimraf','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','limit','undefined','count','offset','Content-Range','apply','save','update','destroy','error','stack','name','index','map','FaxApplication','rawAttributes','fieldName','type','key','keys','filters','query'];(function(_0x2ea48,_0x5046dc){var _0x540534=function(_0x4ee101){while(--_0x4ee101){_0x2ea48['push'](_0x2ea48['shift']());}};_0x540534(++_0x5046dc);}(_0x293c,0x126));var _0xc293=function(_0x2a41a4,_0x537de5){_0x2a41a4=_0x2a41a4-0x0;var _0x517e96=_0x293c[_0x2a41a4];return _0x517e96;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc293('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc293('0x1'));var rp=require('request-promise');var moment=require(_0xc293('0x2'));var BPromise=require(_0xc293('0x3'));var Mustache=require(_0xc293('0x4'));var util=require('util');var path=require(_0xc293('0x5'));var sox=require('sox');var csv=require(_0xc293('0x6'));var ejs=require(_0xc293('0x7'));var fs=require('fs');var fs_extra=require(_0xc293('0x8'));var _=require('lodash');var squel=require(_0xc293('0x9'));var crypto=require(_0xc293('0xa'));var jsforce=require(_0xc293('0xb'));var deskjs=require(_0xc293('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc293('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc293('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc293('0xf'));var logger=require(_0xc293('0x10'))(_0xc293('0x11'));var utils=require(_0xc293('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xc293('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5874bc,_0x5ddde3){_0x5ddde3=_0x5ddde3||0xcc;return function(_0x168fcb){if(_0x168fcb){return _0x5874bc[_0xc293('0x14')](_0x5ddde3);}return _0x5874bc['status'](_0x5ddde3)[_0xc293('0x15')]();};}function respondWithResult(_0x509d2b,_0x433df3){_0x433df3=_0x433df3||0xc8;return function(_0x5a4d81){if(_0x5a4d81){return _0x509d2b[_0xc293('0x16')](_0x433df3)[_0xc293('0x17')](_0x5a4d81);}};}function respondWithFilteredResult(_0x578a62,_0x40d820){return function(_0x171a2e){if(_0x171a2e){var _0x1e470d=typeof _0x40d820['offset']==='undefined'&&typeof _0x40d820[_0xc293('0x18')]===_0xc293('0x19');var _0x17b289=_0x171a2e[_0xc293('0x1a')];var _0x26b455=_0x1e470d?0x0:_0x40d820[_0xc293('0x1b')];var _0x46f9ad=_0x1e470d?_0x171a2e[_0xc293('0x1a')]:_0x40d820[_0xc293('0x1b')]+_0x40d820[_0xc293('0x18')];var _0x52980b;if(_0x46f9ad>=_0x17b289){_0x46f9ad=_0x17b289;_0x52980b=0xc8;}else{_0x52980b=0xce;}_0x578a62['status'](_0x52980b);return _0x578a62['set'](_0xc293('0x1c'),_0x26b455+'-'+_0x46f9ad+'/'+_0x17b289)[_0xc293('0x17')](_0x171a2e);}return null;};}function patchUpdates(_0x46f103){return function(_0x2fb26b){try{jsonpatch[_0xc293('0x1d')](_0x2fb26b,_0x46f103,!![]);}catch(_0x269036){return BPromise['reject'](_0x269036);}return _0x2fb26b[_0xc293('0x1e')]();};}function saveUpdates(_0x114856,_0xa56333){return function(_0x2099a8){if(_0x2099a8){return _0x2099a8[_0xc293('0x1f')](_0x114856)['then'](function(_0x5ca777){return _0x5ca777;});}return null;};}function removeEntity(_0x1b05b4,_0xf8acb){return function(_0xaeee1c){if(_0xaeee1c){return _0xaeee1c[_0xc293('0x20')]()['then'](function(){_0x1b05b4[_0xc293('0x16')](0xcc)[_0xc293('0x15')]();});}};}function handleEntityNotFound(_0x3324d1,_0xd85798){return function(_0x15eef3){if(!_0x15eef3){_0x3324d1['sendStatus'](0x194);}return _0x15eef3;};}function handleError(_0x4503e2,_0xf15dfb){_0xf15dfb=_0xf15dfb||0x1f4;return function(_0x526851){logger[_0xc293('0x21')](_0x526851[_0xc293('0x22')]);if(_0x526851[_0xc293('0x23')]){delete _0x526851[_0xc293('0x23')];}_0x4503e2['status'](_0xf15dfb)['send'](_0x526851);};}exports[_0xc293('0x24')]=function(_0x4e2f0c,_0x54c3c5){var _0x3da490={},_0x4ea07e={},_0x584744={'count':0x0,'rows':[]};var _0xdd34ba=_[_0xc293('0x25')](db[_0xc293('0x26')][_0xc293('0x27')],function(_0x59b9d0){return{'name':_0x59b9d0[_0xc293('0x28')],'type':_0x59b9d0[_0xc293('0x29')][_0xc293('0x2a')]};});_0x4ea07e['model']=_['map'](_0xdd34ba,_0xc293('0x23'));_0x4ea07e['query']=_[_0xc293('0x2b')](_0x4e2f0c['query']);_0x4ea07e[_0xc293('0x2c')]=_['intersection'](_0x4ea07e['model'],_0x4ea07e[_0xc293('0x2d')]);_0x3da490['attributes']=_[_0xc293('0x2e')](_0x4ea07e['model'],qs[_0xc293('0x2f')](_0x4e2f0c[_0xc293('0x2d')][_0xc293('0x2f')]));_0x3da490['attributes']=_0x3da490['attributes'][_0xc293('0x30')]?_0x3da490[_0xc293('0x31')]:_0x4ea07e['model'];if(!_0x4e2f0c[_0xc293('0x2d')]['hasOwnProperty'](_0xc293('0x32'))){_0x3da490[_0xc293('0x18')]=qs[_0xc293('0x18')](_0x4e2f0c[_0xc293('0x2d')][_0xc293('0x18')]);_0x3da490[_0xc293('0x1b')]=qs[_0xc293('0x1b')](_0x4e2f0c[_0xc293('0x2d')]['offset']);}_0x3da490[_0xc293('0x33')]=qs[_0xc293('0x34')](_0x4e2f0c[_0xc293('0x2d')][_0xc293('0x34')]);_0x3da490[_0xc293('0x35')]=qs[_0xc293('0x2c')](_[_0xc293('0x36')](_0x4e2f0c[_0xc293('0x2d')],_0x4ea07e[_0xc293('0x2c')]),_0xdd34ba);if(_0x4e2f0c[_0xc293('0x2d')][_0xc293('0x37')]){_0x3da490[_0xc293('0x35')]=_[_0xc293('0x38')](_0x3da490['where'],{'$or':_[_0xc293('0x25')](_0xdd34ba,function(_0x41333f){if(_0x41333f[_0xc293('0x29')]!==_0xc293('0x39')){var _0x581afd={};_0x581afd[_0x41333f[_0xc293('0x23')]]={'$like':'%'+_0x4e2f0c['query'][_0xc293('0x37')]+'%'};return _0x581afd;}})});}_0x3da490=_[_0xc293('0x38')]({},_0x3da490,_0x4e2f0c[_0xc293('0x3a')]);var _0x5f0c41={'where':_0x3da490[_0xc293('0x35')]};return db[_0xc293('0x26')][_0xc293('0x1a')](_0x5f0c41)[_0xc293('0x3b')](function(_0x59acab){_0x584744[_0xc293('0x1a')]=_0x59acab;if(_0x4e2f0c[_0xc293('0x2d')][_0xc293('0x3c')]){_0x3da490['include']=[{'all':!![]}];}return db[_0xc293('0x26')]['findAll'](_0x3da490);})[_0xc293('0x3b')](function(_0x47137e){_0x584744[_0xc293('0x3d')]=_0x47137e;return _0x584744;})['then'](respondWithFilteredResult(_0x54c3c5,_0x3da490))[_0xc293('0x3e')](handleError(_0x54c3c5,null));};exports['show']=function(_0x4ee545,_0x34bb3e){var _0x465c3d={'raw':!![],'where':{'id':_0x4ee545['params']['id']}},_0x528707={};_0x528707[_0xc293('0x3f')]=_['keys'](db[_0xc293('0x26')][_0xc293('0x27')]);_0x528707[_0xc293('0x2d')]=_[_0xc293('0x2b')](_0x4ee545['query']);_0x528707['filters']=_[_0xc293('0x2e')](_0x528707[_0xc293('0x3f')],_0x528707['query']);_0x465c3d[_0xc293('0x31')]=_['intersection'](_0x528707[_0xc293('0x3f')],qs[_0xc293('0x2f')](_0x4ee545[_0xc293('0x2d')]['fields']));_0x465c3d[_0xc293('0x31')]=_0x465c3d[_0xc293('0x31')][_0xc293('0x30')]?_0x465c3d[_0xc293('0x31')]:_0x528707['model'];if(_0x4ee545[_0xc293('0x2d')][_0xc293('0x3c')]){_0x465c3d[_0xc293('0x40')]=[{'all':!![]}];}_0x465c3d=_[_0xc293('0x38')]({},_0x465c3d,_0x4ee545[_0xc293('0x3a')]);return db['FaxApplication']['find'](_0x465c3d)[_0xc293('0x3b')](handleEntityNotFound(_0x34bb3e,null))[_0xc293('0x3b')](respondWithResult(_0x34bb3e,null))[_0xc293('0x3e')](handleError(_0x34bb3e,null));};exports[_0xc293('0x41')]=function(_0x3424bf,_0x19e2f4){return db[_0xc293('0x26')][_0xc293('0x41')](_0x3424bf[_0xc293('0x42')],{})[_0xc293('0x3b')](respondWithResult(_0x19e2f4,0xc9))[_0xc293('0x3e')](handleError(_0x19e2f4,null));};exports['update']=function(_0x34517b,_0x26b21f){if(_0x34517b[_0xc293('0x42')]['id']){delete _0x34517b[_0xc293('0x42')]['id'];}return db['FaxApplication']['find']({'where':{'id':_0x34517b['params']['id']}})[_0xc293('0x3b')](handleEntityNotFound(_0x26b21f,null))[_0xc293('0x3b')](saveUpdates(_0x34517b[_0xc293('0x42')],null))[_0xc293('0x3b')](respondWithResult(_0x26b21f,null))['catch'](handleError(_0x26b21f,null));};exports['destroy']=function(_0x1c454c,_0x3c8c37){return db[_0xc293('0x26')]['find']({'where':{'id':_0x1c454c[_0xc293('0x43')]['id']}})['then'](handleEntityNotFound(_0x3c8c37,null))[_0xc293('0x3b')](removeEntity(_0x3c8c37,null))[_0xc293('0x3e')](handleError(_0x3c8c37,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 432bf0d..fbdc1ce 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 _0x87b9=['utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','fax_applications'];(function(_0x365eee,_0x1999b9){var _0x167c0c=function(_0x2ae01d){while(--_0x2ae01d){_0x365eee['push'](_0x365eee['shift']());}};_0x167c0c(++_0x1999b9);}(_0x87b9,0x1c3));var _0x987b=function(_0x45c3da,_0x3fb915){_0x45c3da=_0x45c3da-0x0;var _0x12ff3d=_0x87b9[_0x45c3da];return _0x12ff3d;};'use strict';var _=require(_0x987b('0x0'));var util=require(_0x987b('0x1'));var logger=require(_0x987b('0x2'))(_0x987b('0x3'));var moment=require(_0x987b('0x4'));var BPromise=require(_0x987b('0x5'));var rp=require(_0x987b('0x6'));var fs=require('fs');var path=require(_0x987b('0x7'));var rimraf=require(_0x987b('0x8'));var config=require(_0x987b('0x9'));var attributes=require(_0x987b('0xa'));module[_0x987b('0xb')]=function(_0x5d8b7d,_0x327d90){return _0x5d8b7d[_0x987b('0xc')]('FaxApplication',attributes,{'tableName':_0x987b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x987b('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x323b=['utf8mb4_unicode_ci','lodash','util','api','moment','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','fax_applications','utf8mb4'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x323b,0x1ae));var _0xb323=function(_0x1abee8,_0x2a2250){_0x1abee8=_0x1abee8-0x0;var _0x342551=_0x323b[_0x1abee8];return _0x342551;};'use strict';var _=require(_0xb323('0x0'));var util=require(_0xb323('0x1'));var logger=require('../../config/logger')(_0xb323('0x2'));var moment=require(_0xb323('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb323('0x4'));var rimraf=require(_0xb323('0x5'));var config=require(_0xb323('0x6'));var attributes=require(_0xb323('0x7'));module[_0xb323('0x8')]=function(_0xb8509f,_0x1bf913){return _0xb8509f[_0xb323('0x9')]('FaxApplication',attributes,{'tableName':_0xb323('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb323('0xb'),'collate':_0xb323('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 02c3858..e95aeb5 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 _0x9e78=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','UpdateFaxApplication','FaxApplication','update','options','raw','where','attributes','then','catch','lodash','moment'];(function(_0x5ded53,_0x9b4f9d){var _0x299b15=function(_0x46aa15){while(--_0x46aa15){_0x5ded53['push'](_0x5ded53['shift']());}};_0x299b15(++_0x9b4f9d);}(_0x9e78,0x14e));var _0x89e7=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x9e78[_0x6cf19c];return _0xce14f3;};'use strict';var _=require(_0x89e7('0x0'));var util=require('util');var moment=require(_0x89e7('0x1'));var BPromise=require(_0x89e7('0x2'));var rs=require(_0x89e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x89e7('0x4'))['db'];var utils=require(_0x89e7('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x89e7('0x6'));var jayson=require(_0x89e7('0x7'));var client=jayson['client'][_0x89e7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20620f,_0x441d46,_0x317fed){return new BPromise(function(_0x1d585a,_0x3cff52){return client['request'](_0x20620f,_0x317fed)['then'](function(_0x2983b5){logger[_0x89e7('0x9')](_0x89e7('0xa'),_0x441d46,'request\x20sent');logger[_0x89e7('0xb')](_0x89e7('0xc'),_0x441d46,_0x89e7('0xd'),JSON[_0x89e7('0xe')](_0x2983b5));if(_0x2983b5[_0x89e7('0xf')]){if(_0x2983b5[_0x89e7('0xf')][_0x89e7('0x10')]===0x1f4){logger[_0x89e7('0xf')](_0x89e7('0xa'),_0x441d46,_0x2983b5[_0x89e7('0xf')][_0x89e7('0x11')]);return _0x3cff52(_0x2983b5[_0x89e7('0xf')]['message']);}logger[_0x89e7('0xf')](_0x89e7('0xa'),_0x441d46,_0x2983b5[_0x89e7('0xf')]['message']);return _0x1d585a(_0x2983b5[_0x89e7('0xf')]['message']);}else{logger['info'](_0x89e7('0xa'),_0x441d46,_0x89e7('0xd'));_0x1d585a(_0x2983b5[_0x89e7('0x12')][_0x89e7('0x11')]);}})['catch'](function(_0x21ee36){logger['error'](_0x89e7('0xa'),_0x441d46,_0x21ee36);_0x3cff52(_0x21ee36);});});}exports[_0x89e7('0x13')]=function(_0x35a961){var _0x1d2ff3=this;return new Promise(function(_0x3bd7ee,_0x4b3e67){return db[_0x89e7('0x14')][_0x89e7('0x15')](_0x35a961['body'],{'raw':_0x35a961['options']?_0x35a961[_0x89e7('0x16')][_0x89e7('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35a961[_0x89e7('0x16')]?_0x35a961['options'][_0x89e7('0x18')]||null:null,'attributes':_0x35a961[_0x89e7('0x16')]?_0x35a961[_0x89e7('0x16')][_0x89e7('0x19')]||null:null,'limit':_0x35a961[_0x89e7('0x16')]?_0x35a961[_0x89e7('0x16')]['limit']||null:null})[_0x89e7('0x1a')](function(_0x1762ea){logger[_0x89e7('0x9')](_0x89e7('0x13'),_0x35a961);logger[_0x89e7('0xb')](_0x89e7('0x13'),_0x35a961,JSON[_0x89e7('0xe')](_0x1762ea));_0x3bd7ee(_0x1762ea);})[_0x89e7('0x1b')](function(_0x2370bd){logger[_0x89e7('0xf')](_0x89e7('0x13'),_0x2370bd[_0x89e7('0x11')],_0x35a961);_0x4b3e67(_0x1d2ff3[_0x89e7('0xf')](0x1f4,_0x2370bd[_0x89e7('0x11')]));});});}; \ No newline at end of file +var _0x9b1a=['UpdateFaxApplication','update','body','options','raw','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x371a19,_0x127fc2){var _0x21479e=function(_0x1be17c){while(--_0x1be17c){_0x371a19['push'](_0x371a19['shift']());}};_0x21479e(++_0x127fc2);}(_0x9b1a,0x66));var _0xa9b1=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x9b1a[_0xbf8ebe];return _0x1e25e8;};'use strict';var _=require(_0xa9b1('0x0'));var util=require(_0xa9b1('0x1'));var moment=require(_0xa9b1('0x2'));var BPromise=require(_0xa9b1('0x3'));var rs=require(_0xa9b1('0x4'));var fs=require('fs');var Redis=require(_0xa9b1('0x5'));var db=require(_0xa9b1('0x6'))['db'];var utils=require(_0xa9b1('0x7'));var logger=require(_0xa9b1('0x8'))(_0xa9b1('0x9'));var config=require(_0xa9b1('0xa'));var jayson=require(_0xa9b1('0xb'));var client=jayson[_0xa9b1('0xc')][_0xa9b1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3acf75,_0x2c505e,_0x5f4832){return new BPromise(function(_0x1865a5,_0x361161){return client[_0xa9b1('0xe')](_0x3acf75,_0x5f4832)[_0xa9b1('0xf')](function(_0x40c565){logger[_0xa9b1('0x10')](_0xa9b1('0x11'),_0x2c505e,_0xa9b1('0x12'));logger[_0xa9b1('0x13')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x2c505e,_0xa9b1('0x12'),JSON[_0xa9b1('0x14')](_0x40c565));if(_0x40c565[_0xa9b1('0x15')]){if(_0x40c565[_0xa9b1('0x15')][_0xa9b1('0x16')]===0x1f4){logger[_0xa9b1('0x15')](_0xa9b1('0x11'),_0x2c505e,_0x40c565[_0xa9b1('0x15')][_0xa9b1('0x17')]);return _0x361161(_0x40c565[_0xa9b1('0x15')][_0xa9b1('0x17')]);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x2c505e,_0x40c565[_0xa9b1('0x15')]['message']);return _0x1865a5(_0x40c565[_0xa9b1('0x15')][_0xa9b1('0x17')]);}else{logger[_0xa9b1('0x10')](_0xa9b1('0x11'),_0x2c505e,'request\x20sent');_0x1865a5(_0x40c565[_0xa9b1('0x18')][_0xa9b1('0x17')]);}})[_0xa9b1('0x19')](function(_0x406a04){logger[_0xa9b1('0x15')](_0xa9b1('0x11'),_0x2c505e,_0x406a04);_0x361161(_0x406a04);});});}exports[_0xa9b1('0x1a')]=function(_0x3ce099){var _0x2dc0b8=this;return new Promise(function(_0x248b6b,_0x502f27){return db['FaxApplication'][_0xa9b1('0x1b')](_0x3ce099[_0xa9b1('0x1c')],{'raw':_0x3ce099[_0xa9b1('0x1d')]?_0x3ce099[_0xa9b1('0x1d')][_0xa9b1('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ce099[_0xa9b1('0x1d')]?_0x3ce099['options'][_0xa9b1('0x1f')]||null:null,'attributes':_0x3ce099[_0xa9b1('0x1d')]?_0x3ce099[_0xa9b1('0x1d')]['attributes']||null:null,'limit':_0x3ce099[_0xa9b1('0x1d')]?_0x3ce099[_0xa9b1('0x1d')]['limit']||null:null})[_0xa9b1('0xf')](function(_0x1591ae){logger[_0xa9b1('0x10')](_0xa9b1('0x1a'),_0x3ce099);logger[_0xa9b1('0x13')](_0xa9b1('0x1a'),_0x3ce099,JSON[_0xa9b1('0x14')](_0x1591ae));_0x248b6b(_0x1591ae);})['catch'](function(_0x26f33a){logger[_0xa9b1('0x15')](_0xa9b1('0x1a'),_0x26f33a['message'],_0x3ce099);_0x502f27(_0x2dc0b8['error'](0x1f4,_0x26f33a[_0xa9b1('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 95aa055..54c97c2 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 _0x087b=['destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x1401f6,_0x40e0ec){var _0x458d70=function(_0x240198){while(--_0x240198){_0x1401f6['push'](_0x1401f6['shift']());}};_0x458d70(++_0x40e0ec);}(_0x087b,0x11a));var _0xb087=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x087b[_0x42bdad];return _0x122626;};'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('0xd')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0xe')]);router[_0xb087('0xf')](_0xb087('0xb'),auth['isAuthenticated'](),controller[_0xb087('0x10')]);router[_0xb087('0x11')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0x12')]);module[_0xb087('0x13')]=router; \ No newline at end of file +var _0x34b7=['express','Router','fs-extra','../../components/auth/service','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','update','delete','destroy','exports','path','connect-timeout'];(function(_0x1de489,_0x23c464){var _0xfe5a5c=function(_0x4d4ab6){while(--_0x4d4ab6){_0x1de489['push'](_0x1de489['shift']());}};_0xfe5a5c(++_0x23c464);}(_0x34b7,0x196));var _0x734b=function(_0x2657fa,_0x15fab8){_0x2657fa=_0x2657fa-0x0;var _0x555b92=_0x34b7[_0x2657fa];return _0x555b92;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x734b('0x0'));var timeout=require(_0x734b('0x1'));var express=require(_0x734b('0x2'));var router=express[_0x734b('0x3')]();var fs_extra=require(_0x734b('0x4'));var auth=require(_0x734b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x734b('0x6'));router[_0x734b('0x7')]('/',auth[_0x734b('0x8')](),controller[_0x734b('0x9')]);router[_0x734b('0x7')](_0x734b('0xa'),auth['isAuthenticated'](),controller[_0x734b('0xb')]);router[_0x734b('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x734b('0xa'),auth['isAuthenticated'](),controller[_0x734b('0xd')]);router[_0x734b('0xe')](_0x734b('0xa'),auth[_0x734b('0x8')](),controller[_0x734b('0xf')]);module[_0x734b('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index b43d208..e3e0c12 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 _0x70ae=['exports','DATE','STRING','ENUM','out','sequelize'];(function(_0x17860a,_0x41edf2){var _0x55b6ea=function(_0x2b5dd8){while(--_0x2b5dd8){_0x17860a['push'](_0x17860a['shift']());}};_0x55b6ea(++_0x41edf2);}(_0x70ae,0x14f));var _0xe70a=function(_0x1cce35,_0x4fd31a){_0x1cce35=_0x1cce35-0x0;var _0x172b90=_0x70ae[_0x1cce35];return _0x172b90;};'use strict';var Sequelize=require(_0xe70a('0x0'));module[_0xe70a('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe70a('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xe70a('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xe70a('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xe70a('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xe70a('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe70a('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xe70a('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xabc4=['out','sequelize','BOOLEAN','DATE','STRING','ENUM'];(function(_0x32b50d,_0x4e0723){var _0x1b4bfd=function(_0x21d1dc){while(--_0x21d1dc){_0x32b50d['push'](_0x32b50d['shift']());}};_0x1b4bfd(++_0x4e0723);}(_0xabc4,0xfd));var _0x4abc=function(_0x39e853,_0x16d356){_0x39e853=_0x39e853-0x0;var _0x3a0ddb=_0xabc4[_0x39e853];return _0x3a0ddb;};'use strict';var Sequelize=require(_0x4abc('0x0'));module['exports']={'closed':{'type':Sequelize[_0x4abc('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4abc('0x2')]},'disposition':{'type':Sequelize[_0x4abc('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x4abc('0x3')]},'note':{'type':Sequelize[_0x4abc('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x4abc('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x4abc('0x4')]('in',_0x4abc('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4abc('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x4abc('0x4')]('in',_0x4abc('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 a87f3a3..7663a15 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 _0x0d92=['text','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','start','body','buildExpression','compact','isEmpty','i.FaxAccountId\x20IN\x20?','concat','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','having','`unreadMessages`\x20=\x200','tag','filter','replace','isNumeric','i.fax\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','resolve','FaxAccountId','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','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','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','all','show','params','intersection','include','merge','options','create','destroy','describe','addMessage','ids','omit','getMessages','findOne','FaxMessage','hasOwnProperty','pick','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','setTags','spread','findAll','emit','faxInteractionTags:save','removeTags','download','unix','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','Attachment','Messages','createdAt','mkdirSync','basename','existsSync','pipe','createWriteStream','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','socket.io-emitter','./faxInteraction.socket','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','reject','save','update','then','error','stack','name','send','Users','map','fullname','TagIds','split','push','catch','index','FaxInteraction','rawAttributes','type','key','query','keys','model','fields','attributes','length','nolimit','order','sort','where','filters','select','field','color','from','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','users','u.id\x20=\x20ui.UserId','left_join','cm_contacts','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\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'];(function(_0x522e30,_0x4fb55c){var _0x1bf4a8=function(_0x78b33d){while(--_0x78b33d){_0x522e30['push'](_0x522e30['shift']());}};_0x1bf4a8(++_0x4fb55c);}(_0x0d92,0x72));var _0x20d9=function(_0x3ffaa7,_0x5b07ff){_0x3ffaa7=_0x3ffaa7-0x0;var _0x3cd853=_0x0d92[_0x3ffaa7];return _0x3cd853;};'use strict';var emlformat=require(_0x20d9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x20d9('0x1'));var jsonpatch=require(_0x20d9('0x2'));var rp=require(_0x20d9('0x3'));var moment=require(_0x20d9('0x4'));var BPromise=require(_0x20d9('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x20d9('0x6'));var csv=require(_0x20d9('0x7'));var ejs=require(_0x20d9('0x8'));var fs=require('fs');var fs_extra=require(_0x20d9('0x9'));var _=require(_0x20d9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x20d9('0xb'));var toCsv=require(_0x20d9('0x7'));var querystring=require(_0x20d9('0xc'));var Papa=require(_0x20d9('0xd'));var Redis=require('ioredis');var authService=require(_0x20d9('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x20d9('0xf'));var logger=require(_0x20d9('0x10'))('api');var utils=require(_0x20d9('0x11'));var config=require(_0x20d9('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x20d9('0x13')]=_['defaults'](config[_0x20d9('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0x20d9('0x14'))(new Redis(config[_0x20d9('0x13')]));require(_0x20d9('0x15'))['register'](socket);function respondWithStatusCode(_0x45031a,_0x13c9a4){_0x13c9a4=_0x13c9a4||0xcc;return function(_0x16ea8d){if(_0x16ea8d){return _0x45031a[_0x20d9('0x16')](_0x13c9a4);}return _0x45031a[_0x20d9('0x17')](_0x13c9a4)[_0x20d9('0x18')]();};}function respondWithResult(_0x44b538,_0x52ce25){_0x52ce25=_0x52ce25||0xc8;return function(_0x3faf88){if(_0x3faf88){return _0x44b538['status'](_0x52ce25)['json'](_0x3faf88);}};}function respondWithFilteredResult(_0x5ef508,_0x23b0ef){return function(_0x394915){if(_0x394915){var _0x4e5c6b=typeof _0x23b0ef['offset']===_0x20d9('0x19')&&typeof _0x23b0ef[_0x20d9('0x1a')]==='undefined';var _0x5e6396=_0x394915[_0x20d9('0x1b')];var _0x4779bf=_0x4e5c6b?0x0:_0x23b0ef[_0x20d9('0x1c')];var _0x3593ab=_0x4e5c6b?_0x394915[_0x20d9('0x1b')]:_0x23b0ef[_0x20d9('0x1c')]+_0x23b0ef[_0x20d9('0x1a')];var _0x45ad6e;if(_0x3593ab>=_0x5e6396){_0x3593ab=_0x5e6396;_0x45ad6e=0xc8;}else{_0x45ad6e=0xce;}_0x5ef508['status'](_0x45ad6e);return _0x5ef508[_0x20d9('0x1d')](_0x20d9('0x1e'),_0x4779bf+'-'+_0x3593ab+'/'+_0x5e6396)[_0x20d9('0x1f')](_0x394915);}return null;};}function patchUpdates(_0x30b6e7){return function(_0x4bb00f){try{jsonpatch['apply'](_0x4bb00f,_0x30b6e7,!![]);}catch(_0x4cddd9){return BPromise[_0x20d9('0x20')](_0x4cddd9);}return _0x4bb00f[_0x20d9('0x21')]();};}function saveUpdates(_0x59a7f4,_0x44d283){return function(_0x40a4e3){if(_0x40a4e3){return _0x40a4e3[_0x20d9('0x22')](_0x59a7f4)[_0x20d9('0x23')](function(_0x135684){return _0x135684;});}return null;};}function removeEntity(_0x102c5f,_0x583b57){return function(_0x317296){if(_0x317296){return _0x317296['destroy']()[_0x20d9('0x23')](function(){_0x102c5f[_0x20d9('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6e6b29,_0x2c7aa8){return function(_0x3ca34d){if(!_0x3ca34d){_0x6e6b29['sendStatus'](0x194);}return _0x3ca34d;};}function handleError(_0x54cdea,_0x46a34a){_0x46a34a=_0x46a34a||0x1f4;return function(_0x54c9e7){logger[_0x20d9('0x24')](_0x54c9e7[_0x20d9('0x25')]);if(_0x54c9e7['name']){delete _0x54c9e7[_0x20d9('0x26')];}_0x54cdea[_0x20d9('0x17')](_0x46a34a)[_0x20d9('0x27')](_0x54c9e7);};}function getInteractionUsers(_0x18d43c,_0x22b8ac){return new BPromise(function(_0xad04fd,_0x1fe78e){try{if(_0x22b8ac[_0x18d43c['id']]){_0x18d43c[_0x20d9('0x28')]=_[_0x20d9('0x29')](_0x22b8ac[_0x18d43c['id']],function(_0x281d7a){return{'id':_0x281d7a['id'],'fullname':_0x281d7a[_0x20d9('0x2a')]};});}}catch(_0x1c351f){_0x1fe78e(_0x1c351f);}_0xad04fd(_0x18d43c);});}function getInteractionTags(_0x3b6a7f,_0x4cf922){return new BPromise(function(_0x423db1,_0xf48b1a){try{if(_0x3b6a7f[_0x20d9('0x2b')]){_0x3b6a7f['Tags']=[];_0x3b6a7f[_0x20d9('0x2b')][_0x20d9('0x2c')](',')['forEach'](function(_0x567518){_0x3b6a7f['Tags'][_0x20d9('0x2d')](_0x4cf922[_0x567518]);});}delete _0x3b6a7f['TagIds'];}catch(_0x1b8f4e){_0xf48b1a(_0x1b8f4e);}_0x423db1(_0x3b6a7f);});}function updateFaxInteraction(_0x26ae79,_0x188df2,_0x247533){return new BPromise(function(_0x2af486,_0x53852b){return getInteractionUsers(_0x26ae79,_0x247533)[_0x20d9('0x23')](function(_0x4ff9fc){return getInteractionTags(_0x4ff9fc,_0x188df2);})[_0x20d9('0x23')](function(_0x340615){_0x2af486(_0x340615);})[_0x20d9('0x2e')](function(_0x35047d){_0x53852b(_0x35047d);});});}exports[_0x20d9('0x2f')]=function(_0x2d9c4,_0x14496){var _0x5bbb9a={},_0x21675f={},_0x4a4f61={'count':0x0,'rows':[]};var _0x45952f=_['map'](db[_0x20d9('0x30')][_0x20d9('0x31')],function(_0x1a26be){return{'name':_0x1a26be['fieldName'],'type':_0x1a26be[_0x20d9('0x32')][_0x20d9('0x33')]};});_0x21675f['model']=_['map'](_0x45952f,_0x20d9('0x26'));_0x21675f[_0x20d9('0x34')]=_[_0x20d9('0x35')](_0x2d9c4[_0x20d9('0x34')]);_0x21675f['filters']=_['intersection'](_0x21675f[_0x20d9('0x36')],_0x21675f[_0x20d9('0x34')]);_0x5bbb9a['attributes']=_['intersection'](_0x21675f[_0x20d9('0x36')],qs[_0x20d9('0x37')](_0x2d9c4[_0x20d9('0x34')][_0x20d9('0x37')]));_0x5bbb9a[_0x20d9('0x38')]=_0x5bbb9a['attributes'][_0x20d9('0x39')]?_0x5bbb9a[_0x20d9('0x38')]:_0x21675f['model'];if(!_0x2d9c4[_0x20d9('0x34')]['hasOwnProperty'](_0x20d9('0x3a'))){_0x5bbb9a[_0x20d9('0x1a')]=qs[_0x20d9('0x1a')](_0x2d9c4['query'][_0x20d9('0x1a')]);_0x5bbb9a[_0x20d9('0x1c')]=qs['offset'](_0x2d9c4['query'][_0x20d9('0x1c')]);}_0x5bbb9a[_0x20d9('0x3b')]=qs[_0x20d9('0x3c')](_0x2d9c4[_0x20d9('0x34')][_0x20d9('0x3c')]);_0x5bbb9a[_0x20d9('0x3d')]=qs[_0x20d9('0x3e')](_['pick'](_0x2d9c4['query'],_0x21675f['filters']),_0x45952f);var _0x2d96a4=[];var _0x36481f=squel[_0x20d9('0x3f')]()['field']('id')[_0x20d9('0x40')]('name')['field'](_0x20d9('0x41'))[_0x20d9('0x42')]('tools_tags');var _0x416834=squel[_0x20d9('0x3f')]()[_0x20d9('0x40')](_0x20d9('0x43'))['field'](_0x20d9('0x44'))['field'](_0x20d9('0x45'))[_0x20d9('0x42')](_0x20d9('0x46'),'ui')['left_join'](_0x20d9('0x47'),'u',_0x20d9('0x48'));var _0x41e950=squel[_0x20d9('0x3f')]()[_0x20d9('0x42')]('fax_interactions','i')[_0x20d9('0x49')](_0x20d9('0x4a'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x20d9('0x49')](_0x20d9('0x47'),'o',_0x20d9('0x4b'))[_0x20d9('0x49')](_0x20d9('0x4c'),'a',_0x20d9('0x4d'))[_0x20d9('0x49')](_0x20d9('0x4e'),'me',_0x20d9('0x4f'))[_0x20d9('0x49')]('fax_interaction_has_tags','it',_0x20d9('0x50'))[_0x20d9('0x49')]('tools_tags','t',_0x20d9('0x51'));var _0x49238b=squel[_0x20d9('0x52')]();var _0x324543=[];var _0x475926=squel[_0x20d9('0x52')]();var _0x2b04b2;if(_0x2d9c4[_0x20d9('0x34')][_0x20d9('0x53')]){_0x2b04b2=as[_0x20d9('0x54')](_0x2d9c4[_0x20d9('0x34')]['search']);var _0x11f19f=_0x2b04b2[_0x20d9('0x55')];for(var _0x5487ca=0x0;_0x5487ca<_0x2b04b2[_0x20d9('0x56')][_0x20d9('0x39')];_0x5487ca++){var _0x157001=_0x2b04b2[_0x20d9('0x56')][_0x5487ca];var _0x3e382b='i';var _0x1b28e9=_[_0x20d9('0x57')](_0x45952f,[_0x20d9('0x26'),_0x157001[_0x20d9('0x40')]]);if(!_0x1b28e9){switch(_0x157001[_0x20d9('0x40')]){case _0x20d9('0x58'):if(_0x157001[_0x20d9('0x59')]==0x1){_0x41e950['having']('`'+_0x157001['field']+'`\x20=\x200');}else{_0x41e950['having']('`'+_0x157001[_0x20d9('0x40')]+_0x20d9('0x5a'));}break;case _0x20d9('0x5b'):if(_0x157001[_0x20d9('0x5c')]===_0x20d9('0x5d')){if(_0x157001[_0x20d9('0x59')]['split']('\x20')[_0x20d9('0x39')]>0x1){_0x49238b[_0x11f19f](_0x20d9('0x5e'),qs[_0x20d9('0x5f')](_0x157001[_0x20d9('0x59')]),null);}else{var _0x3f9fb8='%'+_0x157001[_0x20d9('0x59')]+'%';_0x49238b[_0x11f19f](_0x20d9('0x60'),_0x3f9fb8,_0x3f9fb8,_0x3f9fb8);}}else{_0x1b28e9=_[_0x20d9('0x57')](_0x45952f,['name',_0x20d9('0x61')]);_0x157001[_0x20d9('0x40')]='ContactId';_0x24fc8d=as['buildExpression'](_0x3e382b,_0x1b28e9[_0x20d9('0x32')],_0x157001);_0x49238b[_0x11f19f](_0x24fc8d[_0x20d9('0x62')],_0x24fc8d[_0x20d9('0x59')]['start'],_0x24fc8d[_0x20d9('0x59')][_0x20d9('0x18')]);}break;case _0x20d9('0x63'):var _0x1c5761=_0x157001[_0x20d9('0x59')][_0x20d9('0x2c')](',')[_0x20d9('0x29')](function(_0x3f27ef){return Number(_0x3f27ef);});_0x1c5761[_0x20d9('0x64')](function(_0x38fd92){_0x475926['or'](_0x20d9('0x65'),'%,'+_0x38fd92+',%');});_0x324543=_[_0x20d9('0x66')](_0x324543,_0x1c5761);break;case _0x20d9('0x67'):if(_0x157001[_0x20d9('0x5c')]==='$substring'){_0x49238b[_0x11f19f]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x157001[_0x20d9('0x59')]+'%',null);}else{_0x1b28e9=_[_0x20d9('0x57')](_0x45952f,[_0x20d9('0x26'),_0x20d9('0x68')]);_0x157001[_0x20d9('0x40')]='UserId';_0x24fc8d=as['buildExpression'](_0x3e382b,_0x1b28e9[_0x20d9('0x32')],_0x157001);_0x49238b[_0x11f19f](_0x24fc8d['text'],_0x24fc8d[_0x20d9('0x59')][_0x20d9('0x69')],_0x24fc8d[_0x20d9('0x59')][_0x20d9('0x18')]);}break;case _0x20d9('0x6a'):_0x24fc8d=as[_0x20d9('0x6b')]('me',null,_0x157001);_0x49238b[_0x11f19f](_0x24fc8d[_0x20d9('0x62')],_0x24fc8d[_0x20d9('0x59')][_0x20d9('0x69')],_0x24fc8d[_0x20d9('0x59')][_0x20d9('0x18')]);break;}}else{var _0x24fc8d=as['buildExpression'](_0x3e382b,_0x1b28e9['type'],_0x157001);_0x49238b[_0x11f19f](_0x24fc8d[_0x20d9('0x62')],_0x24fc8d['value'][_0x20d9('0x69')],_0x24fc8d[_0x20d9('0x59')]['end']);}}}else{var _0x499246=_(_0x2d9c4['query'])[_0x20d9('0x35')]()[_0x20d9('0x29')](function(_0x1ee984){return _['some'](_0x45952f,[_0x20d9('0x26'),_0x1ee984])?_0x1ee984:undefined;})[_0x20d9('0x6c')]()[_0x20d9('0x59')]();if(!_[_0x20d9('0x6d')](_0x499246)){_0x499246[_0x20d9('0x64')](function(_0x436900){if(_0x436900==='FaxAccountId'){_0x41e950['where'](_0x20d9('0x6e'),[][_0x20d9('0x6f')](_0x2d9c4[_0x20d9('0x34')][_0x436900]));}else if(_0x436900==='createdAt'){var _0x1b57e0=JSON['parse'](_0x2d9c4['query'][_0x436900])[_0x20d9('0x70')];var _0x5edff2=JSON[_0x20d9('0x71')](_0x2d9c4[_0x20d9('0x34')][_0x436900])['$lte'];_0x41e950[_0x20d9('0x3d')](_0x20d9('0x72'),_0x1b57e0,_0x5edff2);}else{if(_0x2d9c4[_0x20d9('0x34')][_0x436900]===_0x20d9('0x73')){_0x41e950[_0x20d9('0x3d')]('i.'+_0x436900+_0x20d9('0x74'));}else{_0x41e950['where']('i.'+_0x436900+'\x20=\x20?',_0x2d9c4[_0x20d9('0x34')][_0x436900]);}}});}if(_0x2d9c4[_0x20d9('0x34')]['read']){if(_0x2d9c4['query']['read']==0x1){_0x41e950[_0x20d9('0x75')](_0x20d9('0x76'));}else{_0x41e950[_0x20d9('0x75')]('`unreadMessages`\x20>\x200');}}if(_0x2d9c4[_0x20d9('0x34')][_0x20d9('0x77')]){_0x324543=_['isArray'](_0x2d9c4['query'][_0x20d9('0x77')])?_0x2d9c4[_0x20d9('0x34')][_0x20d9('0x77')]:new Array(_0x2d9c4[_0x20d9('0x34')]['tag']);_0x324543[_0x20d9('0x64')](function(_0xd11aaa){_0x475926['or'](_0x20d9('0x65'),'%,'+_0xd11aaa+',%');});}if(_0x2d9c4['query'][_0x20d9('0x78')]){var _0x20e4ea=_0x2d9c4['query']['filter'][_0x20d9('0x79')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x20d9('0x7a')](_0x20e4ea)){_0x49238b['or']('i.id\x20LIKE\x20?',_0x20e4ea+'%')['or'](_0x20d9('0x7b'),_0x20e4ea+'%');}_0x49238b['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x20e4ea+'%');}}_0x41e950[_0x20d9('0x3d')](_0x49238b);_0x41e950[_0x20d9('0x7c')](_0x20d9('0x7d'));var _0x38574e={'type':db[_0x20d9('0x7e')][_0x20d9('0x7f')][_0x20d9('0x80')],'raw':!![]};var _0x5947aa=_0x41e950[_0x20d9('0x81')]();_0x5947aa[_0x20d9('0x40')](_0x20d9('0x7d'));_0x5947aa[_0x20d9('0x40')](_0x20d9('0x82'),'unreadMessages');if(_0x5bbb9a['order']){_0x5bbb9a['order'][_0x20d9('0x64')](function(_0x360e62){var _0x31a475=_0x360e62[0x0]===_0x20d9('0x83')?_0x360e62[0x0]:'i.'+_0x360e62[0x0];_0x41e950[_0x20d9('0x3b')](_0x31a475,_0x360e62[0x1]==='DESC'?![]:!![]);});}if(!_[_0x20d9('0x6d')](_0x324543)){_0x41e950[_0x20d9('0x75')](_0x475926);_0x5947aa[_0x20d9('0x3d')]('t.id\x20IN\x20?',_0x324543);}BPromise[_0x20d9('0x84')]()[_0x20d9('0x23')](function(){if(!_0x2b04b2){if(_0x2d9c4[_0x20d9('0x34')][_0x20d9('0x85')])return;_0x5947aa[_0x20d9('0x3d')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x41e950[_0x20d9('0x3d')](_0x20d9('0x86'));return;}if(_0x2d9c4['user'][_0x20d9('0x87')]!==_0x20d9('0x88'))return;return _0x2d9c4[_0x20d9('0x89')][_0x20d9('0x8a')]({'attributes':['id'],'raw':!![]})[_0x20d9('0x23')](function(_0x98b5e8){if(_[_0x20d9('0x6d')](_0x98b5e8)){_0x5947aa[_0x20d9('0x3d')](_0x20d9('0x8b'));_0x41e950[_0x20d9('0x3d')](_0x20d9('0x8b'));}else{_0x5947aa[_0x20d9('0x3d')](_0x20d9('0x6e'),_[_0x20d9('0x29')](_0x98b5e8,'id'));_0x41e950[_0x20d9('0x3d')](_0x20d9('0x6e'),_[_0x20d9('0x29')](_0x98b5e8,'id'));}});})[_0x20d9('0x23')](function(){if(_0x2d9c4['user'][_0x20d9('0x87')]===_0x20d9('0x88')&&!_0x2b04b2&&!_0x2d9c4['query']['FaxAccountId'])return[];return db[_0x20d9('0x8c')]['query'](_0x5947aa[_0x20d9('0x8d')](),_0x38574e);})[_0x20d9('0x23')](function(_0x5b5f33){_0x4a4f61[_0x20d9('0x1b')]=_0x5b5f33['length'];if(_0x4a4f61[_0x20d9('0x1b')]===0x0)return[];return db['sequelize']['query'](_0x36481f[_0x20d9('0x8d')](),_0x38574e)[_0x20d9('0x23')](function(_0x326dd6){_0x2d96a4=_[_0x20d9('0x8e')](_0x326dd6,'id');_0x38574e=_['merge'](_0x38574e,{'model':db[_0x20d9('0x30')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2d9c4['query'][_0x20d9('0x37')]){_0x5bbb9a[_0x20d9('0x38')][_0x20d9('0x64')](function(_0x5cc0ee){_0x41e950[_0x20d9('0x40')]('i.'+_0x5cc0ee);});}else{_0x41e950[_0x20d9('0x40')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x20d9('0x58'));_0x41e950[_0x20d9('0x40')](_0x20d9('0x8f'),_0x20d9('0x90'));_0x41e950[_0x20d9('0x40')](_0x20d9('0x91'),_0x20d9('0x92'));_0x41e950[_0x20d9('0x40')](_0x20d9('0x93'),'contactName');_0x41e950[_0x20d9('0x40')](_0x20d9('0x94'));_0x41e950[_0x20d9('0x40')](_0x20d9('0x95'),_0x20d9('0x96'));_0x41e950[_0x20d9('0x40')]('c.lastName',_0x20d9('0x97'));_0x41e950[_0x20d9('0x40')](_0x20d9('0x98'),_0x20d9('0x99'));_0x41e950['field'](_0x20d9('0x9a'),_0x20d9('0x9b'));_0x41e950[_0x20d9('0x40')](_0x20d9('0x9c'),_0x20d9('0x9d'));_0x41e950[_0x20d9('0x40')](_0x20d9('0x9e'),'Contact.fax');_0x41e950['field']('o.fullname',_0x20d9('0x9f'));_0x41e950[_0x20d9('0x40')](_0x20d9('0xa0'),_0x20d9('0xa1'));_0x41e950[_0x20d9('0x40')](_0x20d9('0xa2'),'TagIds');}if(_0x5bbb9a[_0x20d9('0x1a')])_0x41e950[_0x20d9('0x1a')](_0x5bbb9a['limit']);if(_0x5bbb9a['offset'])_0x41e950[_0x20d9('0x1c')](_0x5bbb9a['offset']);return db['sequelize'][_0x20d9('0x34')](_0x41e950[_0x20d9('0x8d')](),_0x38574e);})[_0x20d9('0x23')](function(_0x40250d){if(_0x40250d[_0x20d9('0x39')]>0x0)_0x416834[_0x20d9('0x3d')](_0x20d9('0xa3'),_[_0x20d9('0x29')](_0x40250d,'id'));return db[_0x20d9('0x8c')]['query'](_0x416834[_0x20d9('0x8d')](),_0x38574e)[_0x20d9('0x23')](function(_0xd10239){var _0x404893=_[_0x20d9('0xa4')](_0xd10239,'FaxInteractionId');var _0x223503=[];_0x40250d[_0x20d9('0x64')](function(_0x41d229){_0x223503[_0x20d9('0x2d')](updateFaxInteraction(_0x41d229,_0x2d96a4,_0x404893));});return BPromise[_0x20d9('0xa5')](_0x223503);});});})['then'](function(_0x2d40e5){_0x4a4f61['rows']=_0x2d40e5;return _0x4a4f61;})[_0x20d9('0x23')](respondWithFilteredResult(_0x14496,_0x5bbb9a))['catch'](handleError(_0x14496,null));};exports[_0x20d9('0xa6')]=function(_0x396f5d,_0x2e048f){var _0x2048fa={'raw':![],'where':{'id':_0x396f5d[_0x20d9('0xa7')]['id']}},_0x4c8d08={};_0x4c8d08[_0x20d9('0x36')]=_[_0x20d9('0x35')](db[_0x20d9('0x30')][_0x20d9('0x31')]);_0x4c8d08[_0x20d9('0x34')]=_['keys'](_0x396f5d[_0x20d9('0x34')]);_0x4c8d08['filters']=_[_0x20d9('0xa8')](_0x4c8d08[_0x20d9('0x36')],_0x4c8d08[_0x20d9('0x34')]);_0x2048fa['attributes']=_[_0x20d9('0xa8')](_0x4c8d08['model'],qs[_0x20d9('0x37')](_0x396f5d[_0x20d9('0x34')][_0x20d9('0x37')]));_0x2048fa[_0x20d9('0x38')]=_0x2048fa[_0x20d9('0x38')][_0x20d9('0x39')]?_0x2048fa[_0x20d9('0x38')]:_0x4c8d08[_0x20d9('0x36')];if(_0x396f5d['query']['includeAll']){_0x2048fa[_0x20d9('0xa9')]=[{'all':!![]}];}_0x2048fa=_[_0x20d9('0xaa')]({},_0x2048fa,_0x396f5d[_0x20d9('0xab')]);return db[_0x20d9('0x30')]['find'](_0x2048fa)[_0x20d9('0x23')](handleEntityNotFound(_0x2e048f,null))[_0x20d9('0x23')](respondWithResult(_0x2e048f,null))[_0x20d9('0x2e')](handleError(_0x2e048f,null));};exports[_0x20d9('0xac')]=function(_0x4cb848,_0x4b05ad){return db['FaxInteraction'][_0x20d9('0xac')](_0x4cb848[_0x20d9('0x6a')],{})[_0x20d9('0x23')](respondWithResult(_0x4b05ad,0xc9))[_0x20d9('0x2e')](handleError(_0x4b05ad,null));};exports[_0x20d9('0x22')]=function(_0x34fa58,_0x1e2c50){if(_0x34fa58[_0x20d9('0x6a')]['id']){delete _0x34fa58['body']['id'];}return db[_0x20d9('0x30')][_0x20d9('0x57')]({'where':{'id':_0x34fa58[_0x20d9('0xa7')]['id']}})[_0x20d9('0x23')](handleEntityNotFound(_0x1e2c50,null))[_0x20d9('0x23')](saveUpdates(_0x34fa58[_0x20d9('0x6a')],null))[_0x20d9('0x23')](respondWithResult(_0x1e2c50,null))[_0x20d9('0x2e')](handleError(_0x1e2c50,null));};exports[_0x20d9('0xad')]=function(_0x145574,_0x12fbb1){return db['FaxInteraction'][_0x20d9('0x57')]({'where':{'id':_0x145574[_0x20d9('0xa7')]['id']}})[_0x20d9('0x23')](handleEntityNotFound(_0x12fbb1,null))[_0x20d9('0x23')](removeEntity(_0x12fbb1,null))['catch'](handleError(_0x12fbb1,null));};exports['describe']=function(_0x7cf6e9,_0x504790){return db[_0x20d9('0x30')][_0x20d9('0xae')]()['then'](respondWithResult(_0x504790,null))[_0x20d9('0x2e')](handleError(_0x504790,null));};exports[_0x20d9('0xaf')]=function(_0x2ade15,_0x58e4ff,_0xeedb79){return db['FaxMessage'][_0x20d9('0x57')]({'where':{'id':_0x2ade15['params']['id']}})[_0x20d9('0x23')](handleEntityNotFound(_0x58e4ff,null))[_0x20d9('0x23')](function(_0x20d285){if(_0x20d285){return _0x20d285[_0x20d9('0xaf')](_0x2ade15[_0x20d9('0x6a')][_0x20d9('0xb0')],_[_0x20d9('0xb1')](_0x2ade15[_0x20d9('0x6a')],[_0x20d9('0xb0'),'id'])||{});}})['then'](respondWithResult(_0x58e4ff,null))['catch'](handleError(_0x58e4ff,null));};exports[_0x20d9('0xb2')]=function(_0x4b6d87,_0x1c9c26,_0x133326){var _0x40ba1e={'raw':![],'where':{}};var _0x7d9641={};var _0x2ba8d7={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x20d9('0xb3')]({'where':{'id':_0x4b6d87[_0x20d9('0xa7')]['id']}})[_0x20d9('0x23')](handleEntityNotFound(_0x1c9c26,null))[_0x20d9('0x23')](function(_0x535194){if(_0x535194){_0x7d9641[_0x20d9('0x36')]=_['keys'](db[_0x20d9('0xb4')][_0x20d9('0x31')]);_0x7d9641['query']=_[_0x20d9('0x35')](_0x4b6d87[_0x20d9('0x34')]);_0x7d9641['filters']=_[_0x20d9('0xa8')](_0x7d9641['model'],_0x7d9641['query']);_0x40ba1e[_0x20d9('0x38')]=_[_0x20d9('0xa8')](_0x7d9641[_0x20d9('0x36')],qs[_0x20d9('0x37')](_0x4b6d87[_0x20d9('0x34')]['fields']));_0x40ba1e[_0x20d9('0x38')]=_0x40ba1e[_0x20d9('0x38')][_0x20d9('0x39')]?_0x40ba1e['attributes']:_0x7d9641['model'];if(!_0x4b6d87[_0x20d9('0x34')][_0x20d9('0xb5')](_0x20d9('0x3a'))){_0x40ba1e[_0x20d9('0x1a')]=qs[_0x20d9('0x1a')](_0x4b6d87[_0x20d9('0x34')][_0x20d9('0x1a')]);_0x40ba1e[_0x20d9('0x1c')]=qs[_0x20d9('0x1c')](_0x4b6d87['query'][_0x20d9('0x1c')]);}_0x40ba1e[_0x20d9('0x3b')]=qs[_0x20d9('0x3c')](_0x4b6d87[_0x20d9('0x34')]['sort']);_0x40ba1e['where']=qs[_0x20d9('0x3e')](_[_0x20d9('0xb6')](_0x4b6d87[_0x20d9('0x34')],_0x7d9641['filters']));_0x40ba1e[_0x20d9('0x3d')]['FaxInteractionId']=_0x535194['id'];if(_0x4b6d87[_0x20d9('0x34')]['filter']){_0x40ba1e['where']=_[_0x20d9('0xaa')](_0x40ba1e['where'],{'$or':_[_0x20d9('0x29')](_0x40ba1e['attributes'],function(_0x50772b){var _0x5d84c1={};_0x5d84c1[_0x50772b]={'$like':'%'+_0x4b6d87[_0x20d9('0x34')][_0x20d9('0x78')]+'%'};return _0x5d84c1;})});}if(_0x4b6d87[_0x20d9('0x34')][_0x20d9('0x70')]){var _0x1567b5=_0x4b6d87['query'][_0x20d9('0x70')]['split'](',');var _0x349719={};_0x349719[_0x1567b5[0x0]]={'$gte':moment(_0x1567b5[0x1])[_0x20d9('0xb7')](_0x20d9('0xb8'))};_0x40ba1e[_0x20d9('0x3d')]=_[_0x20d9('0xaa')](_0x40ba1e[_0x20d9('0x3d')],_0x349719);}_0x40ba1e=_[_0x20d9('0xaa')]({},_0x40ba1e,_0x4b6d87[_0x20d9('0xab')]);return db[_0x20d9('0xb4')][_0x20d9('0x1b')]({'where':_0x40ba1e[_0x20d9('0x3d')]})['then'](function(_0x1e6d12){_0x2ba8d7[_0x20d9('0x1b')]=_0x1e6d12;if(_0x4b6d87['query'][_0x20d9('0xb9')]){_0x40ba1e[_0x20d9('0xa9')]=[{'all':!![]}];}return db[_0x20d9('0xb4')]['findAll'](_0x40ba1e);})[_0x20d9('0x23')](function(_0x1399cf){_0x2ba8d7['rows']=_0x1399cf;return _0x2ba8d7;});}})[_0x20d9('0x23')](respondWithFilteredResult(_0x1c9c26,_0x40ba1e))['catch'](handleError(_0x1c9c26,null));};exports['addTags']=function(_0x4e7c95,_0x464aab,_0x2ee2b3){return db['FaxInteraction'][_0x20d9('0x57')]({'where':{'id':_0x4e7c95['params']['id']}})[_0x20d9('0x23')](handleEntityNotFound(_0x464aab,null))[_0x20d9('0x23')](function(_0x20a2bd){if(_0x20a2bd){return _0x20a2bd[_0x20d9('0xba')](_0x4e7c95[_0x20d9('0x6a')][_0x20d9('0xb0')],_['omit'](_0x4e7c95['body'],[_0x20d9('0xb0'),'id'])||{})[_0x20d9('0xbb')](function(){return db[_0x20d9('0x63')][_0x20d9('0xbc')]({'attributes':['id',_0x20d9('0x26'),_0x20d9('0x41')],'where':{'id':_0x4e7c95[_0x20d9('0x6a')][_0x20d9('0xb0')]}});})[_0x20d9('0x23')](function(_0x4d257c){socket[_0x20d9('0xbd')](_0x20d9('0xbe'),{'id':Number(_0x4e7c95[_0x20d9('0xa7')]['id']),'tags':_0x4d257c||[]});return{'id':Number(_0x4e7c95[_0x20d9('0xa7')]['id']),'tags':_0x4d257c||[]};});}})[_0x20d9('0x23')](respondWithResult(_0x464aab,null))[_0x20d9('0x2e')](handleError(_0x464aab,null));};exports[_0x20d9('0xbf')]=function(_0x2b0802,_0x4c88c8,_0x3a8d93){return db[_0x20d9('0x30')][_0x20d9('0x57')]({'where':{'id':_0x2b0802['params']['id']}})[_0x20d9('0x23')](handleEntityNotFound(_0x4c88c8,null))[_0x20d9('0x23')](function(_0x97eb99){if(_0x97eb99){return _0x97eb99[_0x20d9('0xbf')](_0x2b0802[_0x20d9('0x34')]['ids']);}})[_0x20d9('0x23')](respondWithStatusCode(_0x4c88c8,null))[_0x20d9('0x2e')](handleError(_0x4c88c8,null));};exports[_0x20d9('0xc0')]=function(_0xe5a46e,_0x5ef0e3){var _0x357482=moment()[_0x20d9('0xc1')]()['toString']();var _0x3afca2=path[_0x20d9('0xc2')](config[_0x20d9('0xc3')],'server',_0x20d9('0xc4'),_0x20d9('0xc5'));var _0x523270=path['join'](config['root'],_0x20d9('0xc6'),'files',_0x20d9('0xc7'));var _0x53ec06=path[_0x20d9('0xc2')](_0x3afca2,_0x357482);var _0x48bb16=util[_0x20d9('0xb7')](_0x20d9('0xc8'),_0xe5a46e[_0x20d9('0xa7')]['id'],_0x357482);var _0x509800=path['join'](_0x3afca2,_0x48bb16);var _0x64015e=[];_0x64015e[_0x20d9('0x2d')]({'model':db[_0x20d9('0xc9')],'as':_0x20d9('0xc9'),'raw':!![]});var _0x680abb=[{'model':db[_0x20d9('0xb4')],'as':_0x20d9('0xca'),'attributes':['id','body',_0x20d9('0xcb')],'include':_0x64015e}];return db['FaxInteraction'][_0x20d9('0x57')]({'where':{'id':_0xe5a46e[_0x20d9('0xa7')]['id']},'include':_0x680abb})[_0x20d9('0x23')](handleEntityNotFound(_0x5ef0e3,null))[_0x20d9('0x23')](function(_0x6172e7){if(_0x6172e7&&_0x6172e7['Messages']){var _0x33c50e=_0x6172e7['get']({'plain':!![]});fs[_0x20d9('0xcc')](_0x53ec06);for(var _0x148715=0x0;_0x148715<_0x33c50e['Messages'][_0x20d9('0x39')];_0x148715++){var _0x143da2=_0x33c50e[_0x20d9('0xca')][_0x148715][_0x20d9('0xc9')];if(_0x143da2){var _0x52064f=path['join'](_0x523270,_0x143da2[_0x20d9('0xcd')]);if(fs[_0x20d9('0xce')](_0x52064f)){fs['createReadStream'](_0x52064f)[_0x20d9('0xcf')](fs[_0x20d9('0xd0')](path[_0x20d9('0xc2')](_0x53ec06,_0x143da2[_0x20d9('0xcd')])));}}}return BPromise[_0x20d9('0x84')]()[_0x20d9('0x23')](function(){return new BPromise(function(_0x5568e0,_0x3f83ca){zipdir(_0x53ec06,{'saveTo':_0x509800},function(_0x5675f1,_0x7f8ffd){if(_0x5675f1)return _0x3f83ca(_0x5675f1);return _0x5568e0(_0x7f8ffd);});})[_0x20d9('0x23')](function(){return new BPromise(function(_0x240734,_0x17d1c0){rimraf(_0x53ec06,function(_0x401232){if(_0x401232)_0x17d1c0(_0x401232);return _0x240734();});});})['then'](function(){return _0x5ef0e3[_0x20d9('0xc0')](_0x509800,_0x48bb16,function(_0x156926){if(_0x156926){console[_0x20d9('0xd1')](_0x20d9('0xd2'),_0x156926);}else{fs[_0x20d9('0xd3')](_0x509800);}});});});}else{return _0x5ef0e3[_0x20d9('0x16')](0xc8);}})[_0x20d9('0x2e')](handleError(_0x5ef0e3,null));}; \ No newline at end of file +var _0x962f=['unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','isEmpty','FaxAccountId','concat','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','replace','isNumeric','i.fax\x20LIKE\x20?','i.id','Sequelize','QueryTypes','clone','contactName','t.id\x20IN\x20?','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','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.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','all','catch','show','params','rawAttributes','include','options','create','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','filter','format','YYYY-MM-DD\x20HH:mm:ss','rows','Tag','findAll','emit','removeTags','unix','join','root','server','files','tmp','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','createWriteStream','resolve','download','log','unlinkSync','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','status','offset','undefined','limit','count','apply','reject','save','then','destroy','end','sendStatus','error','stack','send','Users','map','Tags','TagIds','split','forEach','push','index','FaxInteraction','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','expr','parseSearch','search','sqlOperator','conditions','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x962f,0x73));var _0xf962=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x962f[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf962('0x0'));var jsonpatch=require(_0xf962('0x1'));var rp=require(_0xf962('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf962('0x3'));var util=require(_0xf962('0x4'));var path=require('path');var sox=require(_0xf962('0x5'));var csv=require(_0xf962('0x6'));var ejs=require(_0xf962('0x7'));var fs=require('fs');var fs_extra=require(_0xf962('0x8'));var _=require(_0xf962('0x9'));var squel=require(_0xf962('0xa'));var crypto=require(_0xf962('0xb'));var jsforce=require(_0xf962('0xc'));var deskjs=require(_0xf962('0xd'));var toCsv=require(_0xf962('0x6'));var querystring=require('querystring');var Papa=require(_0xf962('0xe'));var Redis=require(_0xf962('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf962('0x10'));var logger=require(_0xf962('0x11'))('api');var utils=require(_0xf962('0x12'));var config=require(_0xf962('0x13'));var licenseUtil=require(_0xf962('0x14'));var db=require('../../mysqldb')['db'];config[_0xf962('0x15')]=_[_0xf962('0x16')](config[_0xf962('0x15')],{'host':_0xf962('0x17'),'port':0x18eb});var socket=require(_0xf962('0x18'))(new Redis(config[_0xf962('0x15')]));require(_0xf962('0x19'))[_0xf962('0x1a')](socket);function respondWithStatusCode(_0x2ed4c4,_0x4a0a77){_0x4a0a77=_0x4a0a77||0xcc;return function(_0x2c871e){if(_0x2c871e){return _0x2ed4c4['sendStatus'](_0x4a0a77);}return _0x2ed4c4['status'](_0x4a0a77)['end']();};}function respondWithResult(_0x3a3f13,_0x16f655){_0x16f655=_0x16f655||0xc8;return function(_0x58f8a3){if(_0x58f8a3){return _0x3a3f13[_0xf962('0x1b')](_0x16f655)['json'](_0x58f8a3);}};}function respondWithFilteredResult(_0x33855e,_0x5ec9e2){return function(_0x24d461){if(_0x24d461){var _0x32860a=typeof _0x5ec9e2[_0xf962('0x1c')]===_0xf962('0x1d')&&typeof _0x5ec9e2[_0xf962('0x1e')]==='undefined';var _0x115548=_0x24d461['count'];var _0x2619d7=_0x32860a?0x0:_0x5ec9e2[_0xf962('0x1c')];var _0x4bad28=_0x32860a?_0x24d461[_0xf962('0x1f')]:_0x5ec9e2['offset']+_0x5ec9e2[_0xf962('0x1e')];var _0x4cc1b2;if(_0x4bad28>=_0x115548){_0x4bad28=_0x115548;_0x4cc1b2=0xc8;}else{_0x4cc1b2=0xce;}_0x33855e[_0xf962('0x1b')](_0x4cc1b2);return _0x33855e['set']('Content-Range',_0x2619d7+'-'+_0x4bad28+'/'+_0x115548)['json'](_0x24d461);}return null;};}function patchUpdates(_0x499739){return function(_0x2116af){try{jsonpatch[_0xf962('0x20')](_0x2116af,_0x499739,!![]);}catch(_0x1d7c93){return BPromise[_0xf962('0x21')](_0x1d7c93);}return _0x2116af[_0xf962('0x22')]();};}function saveUpdates(_0x26437f,_0x308bd2){return function(_0x2fa579){if(_0x2fa579){return _0x2fa579['update'](_0x26437f)[_0xf962('0x23')](function(_0x570114){return _0x570114;});}return null;};}function removeEntity(_0x3f67de,_0x3457be){return function(_0x4fec8f){if(_0x4fec8f){return _0x4fec8f[_0xf962('0x24')]()['then'](function(){_0x3f67de[_0xf962('0x1b')](0xcc)[_0xf962('0x25')]();});}};}function handleEntityNotFound(_0x1776f3,_0x248f9e){return function(_0x5612e4){if(!_0x5612e4){_0x1776f3[_0xf962('0x26')](0x194);}return _0x5612e4;};}function handleError(_0x50d7bc,_0x588372){_0x588372=_0x588372||0x1f4;return function(_0x5e8273){logger[_0xf962('0x27')](_0x5e8273[_0xf962('0x28')]);if(_0x5e8273['name']){delete _0x5e8273['name'];}_0x50d7bc[_0xf962('0x1b')](_0x588372)[_0xf962('0x29')](_0x5e8273);};}function getInteractionUsers(_0x33da6c,_0x361a2f){return new BPromise(function(_0x428943,_0x5090e5){try{if(_0x361a2f[_0x33da6c['id']]){_0x33da6c[_0xf962('0x2a')]=_[_0xf962('0x2b')](_0x361a2f[_0x33da6c['id']],function(_0x9c1776){return{'id':_0x9c1776['id'],'fullname':_0x9c1776['fullname']};});}}catch(_0x1e98a7){_0x5090e5(_0x1e98a7);}_0x428943(_0x33da6c);});}function getInteractionTags(_0x523471,_0x5d649b){return new BPromise(function(_0x3be4b4,_0x331619){try{if(_0x523471['TagIds']){_0x523471[_0xf962('0x2c')]=[];_0x523471[_0xf962('0x2d')][_0xf962('0x2e')](',')[_0xf962('0x2f')](function(_0x52061a){_0x523471['Tags'][_0xf962('0x30')](_0x5d649b[_0x52061a]);});}delete _0x523471[_0xf962('0x2d')];}catch(_0x2c4587){_0x331619(_0x2c4587);}_0x3be4b4(_0x523471);});}function updateFaxInteraction(_0x5c5479,_0xc573db,_0xd7140b){return new BPromise(function(_0x4339ef,_0x157a24){return getInteractionUsers(_0x5c5479,_0xd7140b)[_0xf962('0x23')](function(_0x3cf2f4){return getInteractionTags(_0x3cf2f4,_0xc573db);})[_0xf962('0x23')](function(_0x346877){_0x4339ef(_0x346877);})['catch'](function(_0x5c9f8b){_0x157a24(_0x5c9f8b);});});}exports[_0xf962('0x31')]=function(_0x2dd276,_0x372c22){var _0x18176e={},_0x3757b5={},_0x30f4fe={'count':0x0,'rows':[]};var _0x104531=_['map'](db[_0xf962('0x32')]['rawAttributes'],function(_0x4d5c6e){return{'name':_0x4d5c6e[_0xf962('0x33')],'type':_0x4d5c6e[_0xf962('0x34')]['key']};});_0x3757b5[_0xf962('0x35')]=_[_0xf962('0x2b')](_0x104531,_0xf962('0x36'));_0x3757b5[_0xf962('0x37')]=_[_0xf962('0x38')](_0x2dd276['query']);_0x3757b5[_0xf962('0x39')]=_[_0xf962('0x3a')](_0x3757b5[_0xf962('0x35')],_0x3757b5['query']);_0x18176e[_0xf962('0x3b')]=_['intersection'](_0x3757b5[_0xf962('0x35')],qs[_0xf962('0x3c')](_0x2dd276[_0xf962('0x37')][_0xf962('0x3c')]));_0x18176e['attributes']=_0x18176e[_0xf962('0x3b')][_0xf962('0x3d')]?_0x18176e[_0xf962('0x3b')]:_0x3757b5[_0xf962('0x35')];if(!_0x2dd276[_0xf962('0x37')][_0xf962('0x3e')](_0xf962('0x3f'))){_0x18176e['limit']=qs[_0xf962('0x1e')](_0x2dd276[_0xf962('0x37')]['limit']);_0x18176e['offset']=qs[_0xf962('0x1c')](_0x2dd276[_0xf962('0x37')]['offset']);}_0x18176e[_0xf962('0x40')]=qs[_0xf962('0x41')](_0x2dd276[_0xf962('0x37')][_0xf962('0x41')]);_0x18176e[_0xf962('0x42')]=qs['filters'](_[_0xf962('0x43')](_0x2dd276[_0xf962('0x37')],_0x3757b5[_0xf962('0x39')]),_0x104531);var _0x283a0d=[];var _0x38caab=squel[_0xf962('0x44')]()[_0xf962('0x45')]('id')['field'](_0xf962('0x36'))['field'](_0xf962('0x46'))[_0xf962('0x47')](_0xf962('0x48'));var _0x2ae374=squel['select']()[_0xf962('0x45')]('u.id')[_0xf962('0x45')](_0xf962('0x49'))[_0xf962('0x45')](_0xf962('0x4a'))[_0xf962('0x47')](_0xf962('0x4b'),'ui')[_0xf962('0x4c')](_0xf962('0x4d'),'u','u.id\x20=\x20ui.UserId');var _0x2291ee=squel['select']()[_0xf962('0x47')]('fax_interactions','i')[_0xf962('0x4c')](_0xf962('0x4e'),'c',_0xf962('0x4f'))['left_join'](_0xf962('0x4d'),'o',_0xf962('0x50'))[_0xf962('0x4c')](_0xf962('0x51'),'a','a.id\x20=\x20i.FaxAccountId')['left_join'](_0xf962('0x52'),'me',_0xf962('0x53'))[_0xf962('0x4c')](_0xf962('0x54'),'it',_0xf962('0x55'))['left_join'](_0xf962('0x48'),'t','t.id\x20=\x20it.TagId');var _0x418d9b=squel[_0xf962('0x56')]();var _0x255d13=[];var _0x4e17fc=squel[_0xf962('0x56')]();var _0x3510ca;if(_0x2dd276[_0xf962('0x37')]['search']){_0x3510ca=as[_0xf962('0x57')](_0x2dd276[_0xf962('0x37')][_0xf962('0x58')]);var _0x163b1b=_0x3510ca[_0xf962('0x59')];for(var _0x2c623d=0x0;_0x2c623d<_0x3510ca[_0xf962('0x5a')][_0xf962('0x3d')];_0x2c623d++){var _0x376460=_0x3510ca['conditions'][_0x2c623d];var _0x5576b7='i';var _0x4e424a=_[_0xf962('0x5b')](_0x104531,['name',_0x376460[_0xf962('0x45')]]);if(!_0x4e424a){switch(_0x376460[_0xf962('0x45')]){case _0xf962('0x5c'):if(_0x376460[_0xf962('0x5d')]==0x1){_0x2291ee[_0xf962('0x5e')]('`'+_0x376460[_0xf962('0x45')]+_0xf962('0x5f'));}else{_0x2291ee[_0xf962('0x5e')]('`'+_0x376460[_0xf962('0x45')]+_0xf962('0x60'));}break;case _0xf962('0x61'):if(_0x376460[_0xf962('0x62')]===_0xf962('0x63')){if(_0x376460[_0xf962('0x5d')]['split']('\x20')['length']>0x1){_0x418d9b[_0x163b1b](_0xf962('0x64'),qs[_0xf962('0x65')](_0x376460['value']),null);}else{var _0x1363e2='%'+_0x376460[_0xf962('0x5d')]+'%';_0x418d9b[_0x163b1b]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x1363e2,_0x1363e2,_0x1363e2);}}else{_0x4e424a=_[_0xf962('0x5b')](_0x104531,[_0xf962('0x36'),_0xf962('0x66')]);_0x376460[_0xf962('0x45')]=_0xf962('0x66');_0x63bd41=as[_0xf962('0x67')](_0x5576b7,_0x4e424a[_0xf962('0x34')],_0x376460);_0x418d9b[_0x163b1b](_0x63bd41[_0xf962('0x68')],_0x63bd41['value'][_0xf962('0x69')],_0x63bd41[_0xf962('0x5d')][_0xf962('0x25')]);}break;case'Tag':var _0x1656fc=_0x376460[_0xf962('0x5d')][_0xf962('0x2e')](',')['map'](function(_0x2c960d){return Number(_0x2c960d);});_0x1656fc['forEach'](function(_0x564d5f){_0x4e17fc['or'](_0xf962('0x6a'),'%,'+_0x564d5f+',%');});_0x255d13=_['union'](_0x255d13,_0x1656fc);break;case'User':if(_0x376460['operator']===_0xf962('0x63')){_0x418d9b[_0x163b1b](_0xf962('0x6b'),'%'+_0x376460[_0xf962('0x5d')]+'%',null);}else{_0x4e424a=_[_0xf962('0x5b')](_0x104531,[_0xf962('0x36'),_0xf962('0x6c')]);_0x376460['field']=_0xf962('0x6c');_0x63bd41=as['buildExpression'](_0x5576b7,_0x4e424a[_0xf962('0x34')],_0x376460);_0x418d9b[_0x163b1b](_0x63bd41[_0xf962('0x68')],_0x63bd41[_0xf962('0x5d')][_0xf962('0x69')],_0x63bd41[_0xf962('0x5d')][_0xf962('0x25')]);}break;case _0xf962('0x6d'):_0x63bd41=as[_0xf962('0x67')]('me',null,_0x376460);_0x418d9b[_0x163b1b](_0x63bd41[_0xf962('0x68')],_0x63bd41[_0xf962('0x5d')][_0xf962('0x69')],_0x63bd41[_0xf962('0x5d')]['end']);break;}}else{var _0x63bd41=as['buildExpression'](_0x5576b7,_0x4e424a[_0xf962('0x34')],_0x376460);_0x418d9b[_0x163b1b](_0x63bd41[_0xf962('0x68')],_0x63bd41['value'][_0xf962('0x69')],_0x63bd41[_0xf962('0x5d')][_0xf962('0x25')]);}}}else{var _0x2fca04=_(_0x2dd276[_0xf962('0x37')])[_0xf962('0x38')]()[_0xf962('0x2b')](function(_0x15eeb3){return _[_0xf962('0x6e')](_0x104531,[_0xf962('0x36'),_0x15eeb3])?_0x15eeb3:undefined;})['compact']()[_0xf962('0x5d')]();if(!_[_0xf962('0x6f')](_0x2fca04)){_0x2fca04[_0xf962('0x2f')](function(_0x17db4d){if(_0x17db4d===_0xf962('0x70')){_0x2291ee[_0xf962('0x42')]('i.FaxAccountId\x20IN\x20?',[][_0xf962('0x71')](_0x2dd276[_0xf962('0x37')][_0x17db4d]));}else if(_0x17db4d===_0xf962('0x72')){var _0xf5703d=JSON['parse'](_0x2dd276['query'][_0x17db4d])[_0xf962('0x73')];var _0x187ef3=JSON[_0xf962('0x74')](_0x2dd276[_0xf962('0x37')][_0x17db4d])['$lte'];_0x2291ee[_0xf962('0x42')](_0xf962('0x75'),_0xf5703d,_0x187ef3);}else{if(_0x2dd276[_0xf962('0x37')][_0x17db4d]==='null'){_0x2291ee[_0xf962('0x42')]('i.'+_0x17db4d+_0xf962('0x76'));}else{_0x2291ee[_0xf962('0x42')]('i.'+_0x17db4d+_0xf962('0x77'),_0x2dd276[_0xf962('0x37')][_0x17db4d]);}}});}if(_0x2dd276[_0xf962('0x37')][_0xf962('0x78')]){if(_0x2dd276['query'][_0xf962('0x78')]==0x1){_0x2291ee[_0xf962('0x5e')]('`unreadMessages`\x20=\x200');}else{_0x2291ee[_0xf962('0x5e')](_0xf962('0x79'));}}if(_0x2dd276[_0xf962('0x37')][_0xf962('0x7a')]){_0x255d13=_[_0xf962('0x7b')](_0x2dd276[_0xf962('0x37')]['tag'])?_0x2dd276[_0xf962('0x37')][_0xf962('0x7a')]:new Array(_0x2dd276['query'][_0xf962('0x7a')]);_0x255d13[_0xf962('0x2f')](function(_0xe11d3e){_0x4e17fc['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xe11d3e+',%');});}if(_0x2dd276[_0xf962('0x37')]['filter']){var _0x8a0564=_0x2dd276[_0xf962('0x37')]['filter'][_0xf962('0x7c')]('\x5c','\x5c\x5c')[_0xf962('0x7c')](/'/g,'\x27\x27');if(qs[_0xf962('0x7d')](_0x8a0564)){_0x418d9b['or']('i.id\x20LIKE\x20?',_0x8a0564+'%')['or'](_0xf962('0x7e'),_0x8a0564+'%');}_0x418d9b['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x8a0564+'%');}}_0x2291ee[_0xf962('0x42')](_0x418d9b);_0x2291ee['group'](_0xf962('0x7f'));var _0x130b12={'type':db[_0xf962('0x80')][_0xf962('0x81')]['SELECT'],'raw':!![]};var _0x29c0f3=_0x2291ee[_0xf962('0x82')]();_0x29c0f3[_0xf962('0x45')](_0xf962('0x7f'));_0x29c0f3[_0xf962('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf962('0x5c'));if(_0x18176e[_0xf962('0x40')]){_0x18176e[_0xf962('0x40')][_0xf962('0x2f')](function(_0x282f1b){var _0x37f4b7=_0x282f1b[0x0]===_0xf962('0x83')?_0x282f1b[0x0]:'i.'+_0x282f1b[0x0];_0x2291ee[_0xf962('0x40')](_0x37f4b7,_0x282f1b[0x1]==='DESC'?![]:!![]);});}if(!_[_0xf962('0x6f')](_0x255d13)){_0x2291ee[_0xf962('0x5e')](_0x4e17fc);_0x29c0f3[_0xf962('0x42')](_0xf962('0x84'),_0x255d13);}BPromise['resolve']()[_0xf962('0x23')](function(){if(!_0x3510ca){if(_0x2dd276[_0xf962('0x37')][_0xf962('0x70')])return;_0x29c0f3[_0xf962('0x42')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x2291ee[_0xf962('0x42')](_0xf962('0x85'));return;}if(_0x2dd276[_0xf962('0x86')][_0xf962('0x87')]!==_0xf962('0x88'))return;return _0x2dd276[_0xf962('0x86')][_0xf962('0x89')]({'attributes':['id'],'raw':!![]})['then'](function(_0x535ba9){if(_['isEmpty'](_0x535ba9)){_0x29c0f3['where'](_0xf962('0x8a'));_0x2291ee[_0xf962('0x42')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x29c0f3[_0xf962('0x42')](_0xf962('0x8b'),_[_0xf962('0x2b')](_0x535ba9,'id'));_0x2291ee[_0xf962('0x42')]('i.FaxAccountId\x20IN\x20?',_[_0xf962('0x2b')](_0x535ba9,'id'));}});})[_0xf962('0x23')](function(){if(_0x2dd276[_0xf962('0x86')][_0xf962('0x87')]===_0xf962('0x88')&&!_0x3510ca&&!_0x2dd276[_0xf962('0x37')][_0xf962('0x70')])return[];return db[_0xf962('0x8c')][_0xf962('0x37')](_0x29c0f3[_0xf962('0x8d')](),_0x130b12);})['then'](function(_0x4019ec){_0x30f4fe[_0xf962('0x1f')]=_0x4019ec['length'];if(_0x30f4fe[_0xf962('0x1f')]===0x0)return[];return db[_0xf962('0x8c')][_0xf962('0x37')](_0x38caab[_0xf962('0x8d')](),_0x130b12)[_0xf962('0x23')](function(_0x1cfa6d){_0x283a0d=_[_0xf962('0x8e')](_0x1cfa6d,'id');_0x130b12=_[_0xf962('0x8f')](_0x130b12,{'model':db[_0xf962('0x32')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2dd276[_0xf962('0x37')]['fields']){_0x18176e['attributes']['forEach'](function(_0x14845e){_0x2291ee[_0xf962('0x45')]('i.'+_0x14845e);});}else{_0x2291ee[_0xf962('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf962('0x5c'));_0x2291ee['field'](_0xf962('0x90'),'Account.key');_0x2291ee[_0xf962('0x45')](_0xf962('0x91'),_0xf962('0x92'));_0x2291ee[_0xf962('0x45')](_0xf962('0x93'),_0xf962('0x83'));_0x2291ee[_0xf962('0x45')](_0xf962('0x94'));_0x2291ee[_0xf962('0x45')]('c.firstName',_0xf962('0x95'));_0x2291ee[_0xf962('0x45')](_0xf962('0x96'),_0xf962('0x97'));_0x2291ee[_0xf962('0x45')](_0xf962('0x98'),_0xf962('0x99'));_0x2291ee[_0xf962('0x45')](_0xf962('0x9a'),_0xf962('0x9b'));_0x2291ee[_0xf962('0x45')](_0xf962('0x9c'),_0xf962('0x9d'));_0x2291ee[_0xf962('0x45')](_0xf962('0x9e'),_0xf962('0x9f'));_0x2291ee[_0xf962('0x45')](_0xf962('0xa0'),'Owner.fullname');_0x2291ee[_0xf962('0x45')]('o.internal',_0xf962('0xa1'));_0x2291ee[_0xf962('0x45')](_0xf962('0xa2'),_0xf962('0x2d'));}if(_0x18176e[_0xf962('0x1e')])_0x2291ee[_0xf962('0x1e')](_0x18176e[_0xf962('0x1e')]);if(_0x18176e[_0xf962('0x1c')])_0x2291ee[_0xf962('0x1c')](_0x18176e['offset']);return db[_0xf962('0x8c')][_0xf962('0x37')](_0x2291ee[_0xf962('0x8d')](),_0x130b12);})[_0xf962('0x23')](function(_0x4cbeb5){if(_0x4cbeb5[_0xf962('0x3d')]>0x0)_0x2ae374[_0xf962('0x42')](_0xf962('0xa3'),_[_0xf962('0x2b')](_0x4cbeb5,'id'));return db[_0xf962('0x8c')][_0xf962('0x37')](_0x2ae374['toString'](),_0x130b12)[_0xf962('0x23')](function(_0x171a6a){var _0x397576=_[_0xf962('0xa4')](_0x171a6a,'FaxInteractionId');var _0x4d942e=[];_0x4cbeb5[_0xf962('0x2f')](function(_0xfc146d){_0x4d942e[_0xf962('0x30')](updateFaxInteraction(_0xfc146d,_0x283a0d,_0x397576));});return BPromise[_0xf962('0xa5')](_0x4d942e);});});})[_0xf962('0x23')](function(_0x23c72e){_0x30f4fe['rows']=_0x23c72e;return _0x30f4fe;})[_0xf962('0x23')](respondWithFilteredResult(_0x372c22,_0x18176e))[_0xf962('0xa6')](handleError(_0x372c22,null));};exports[_0xf962('0xa7')]=function(_0x404b6d,_0x4202b6){var _0x2e51ea={'raw':![],'where':{'id':_0x404b6d[_0xf962('0xa8')]['id']}},_0xd8ed15={};_0xd8ed15[_0xf962('0x35')]=_[_0xf962('0x38')](db[_0xf962('0x32')][_0xf962('0xa9')]);_0xd8ed15[_0xf962('0x37')]=_[_0xf962('0x38')](_0x404b6d[_0xf962('0x37')]);_0xd8ed15[_0xf962('0x39')]=_[_0xf962('0x3a')](_0xd8ed15[_0xf962('0x35')],_0xd8ed15[_0xf962('0x37')]);_0x2e51ea[_0xf962('0x3b')]=_[_0xf962('0x3a')](_0xd8ed15['model'],qs[_0xf962('0x3c')](_0x404b6d['query']['fields']));_0x2e51ea[_0xf962('0x3b')]=_0x2e51ea[_0xf962('0x3b')]['length']?_0x2e51ea['attributes']:_0xd8ed15[_0xf962('0x35')];if(_0x404b6d[_0xf962('0x37')]['includeAll']){_0x2e51ea[_0xf962('0xaa')]=[{'all':!![]}];}_0x2e51ea=_[_0xf962('0x8f')]({},_0x2e51ea,_0x404b6d[_0xf962('0xab')]);return db[_0xf962('0x32')]['find'](_0x2e51ea)[_0xf962('0x23')](handleEntityNotFound(_0x4202b6,null))[_0xf962('0x23')](respondWithResult(_0x4202b6,null))[_0xf962('0xa6')](handleError(_0x4202b6,null));};exports[_0xf962('0xac')]=function(_0x1a97f6,_0x1ea6d8){return db[_0xf962('0x32')][_0xf962('0xac')](_0x1a97f6[_0xf962('0x6d')],{})[_0xf962('0x23')](respondWithResult(_0x1ea6d8,0xc9))['catch'](handleError(_0x1ea6d8,null));};exports['update']=function(_0x513316,_0xe67825){if(_0x513316['body']['id']){delete _0x513316[_0xf962('0x6d')]['id'];}return db[_0xf962('0x32')][_0xf962('0x5b')]({'where':{'id':_0x513316[_0xf962('0xa8')]['id']}})[_0xf962('0x23')](handleEntityNotFound(_0xe67825,null))['then'](saveUpdates(_0x513316[_0xf962('0x6d')],null))[_0xf962('0x23')](respondWithResult(_0xe67825,null))[_0xf962('0xa6')](handleError(_0xe67825,null));};exports[_0xf962('0x24')]=function(_0x228a1b,_0x18b9ef){return db['FaxInteraction'][_0xf962('0x5b')]({'where':{'id':_0x228a1b['params']['id']}})['then'](handleEntityNotFound(_0x18b9ef,null))[_0xf962('0x23')](removeEntity(_0x18b9ef,null))[_0xf962('0xa6')](handleError(_0x18b9ef,null));};exports[_0xf962('0xad')]=function(_0xad5ba,_0x2fe753){return db[_0xf962('0x32')]['describe']()['then'](respondWithResult(_0x2fe753,null))[_0xf962('0xa6')](handleError(_0x2fe753,null));};exports[_0xf962('0xae')]=function(_0x1bce43,_0x3fe03e,_0x37a2c1){return db[_0xf962('0xaf')][_0xf962('0x5b')]({'where':{'id':_0x1bce43['params']['id']}})[_0xf962('0x23')](handleEntityNotFound(_0x3fe03e,null))['then'](function(_0x154434){if(_0x154434){return _0x154434[_0xf962('0xae')](_0x1bce43[_0xf962('0x6d')][_0xf962('0xb0')],_[_0xf962('0xb1')](_0x1bce43[_0xf962('0x6d')],['ids','id'])||{});}})['then'](respondWithResult(_0x3fe03e,null))[_0xf962('0xa6')](handleError(_0x3fe03e,null));};exports[_0xf962('0xb2')]=function(_0x1d9f4d,_0x371f4f,_0x556f0c){var _0x374e68={'raw':![],'where':{}};var _0xef8922={};var _0x2ae8d8={'count':0x0,'rows':[]};return db[_0xf962('0x32')][_0xf962('0xb3')]({'where':{'id':_0x1d9f4d[_0xf962('0xa8')]['id']}})[_0xf962('0x23')](handleEntityNotFound(_0x371f4f,null))['then'](function(_0x3bc7ea){if(_0x3bc7ea){_0xef8922['model']=_[_0xf962('0x38')](db['FaxMessage'][_0xf962('0xa9')]);_0xef8922[_0xf962('0x37')]=_['keys'](_0x1d9f4d[_0xf962('0x37')]);_0xef8922[_0xf962('0x39')]=_[_0xf962('0x3a')](_0xef8922[_0xf962('0x35')],_0xef8922['query']);_0x374e68['attributes']=_[_0xf962('0x3a')](_0xef8922[_0xf962('0x35')],qs[_0xf962('0x3c')](_0x1d9f4d[_0xf962('0x37')][_0xf962('0x3c')]));_0x374e68['attributes']=_0x374e68[_0xf962('0x3b')][_0xf962('0x3d')]?_0x374e68[_0xf962('0x3b')]:_0xef8922['model'];if(!_0x1d9f4d[_0xf962('0x37')]['hasOwnProperty']('nolimit')){_0x374e68['limit']=qs['limit'](_0x1d9f4d['query']['limit']);_0x374e68['offset']=qs[_0xf962('0x1c')](_0x1d9f4d[_0xf962('0x37')]['offset']);}_0x374e68[_0xf962('0x40')]=qs[_0xf962('0x41')](_0x1d9f4d[_0xf962('0x37')][_0xf962('0x41')]);_0x374e68[_0xf962('0x42')]=qs[_0xf962('0x39')](_['pick'](_0x1d9f4d[_0xf962('0x37')],_0xef8922[_0xf962('0x39')]));_0x374e68[_0xf962('0x42')]['FaxInteractionId']=_0x3bc7ea['id'];if(_0x1d9f4d['query'][_0xf962('0xb4')]){_0x374e68[_0xf962('0x42')]=_[_0xf962('0x8f')](_0x374e68[_0xf962('0x42')],{'$or':_[_0xf962('0x2b')](_0x374e68[_0xf962('0x3b')],function(_0xfcfc8){var _0x3e2a40={};_0x3e2a40[_0xfcfc8]={'$like':'%'+_0x1d9f4d[_0xf962('0x37')]['filter']+'%'};return _0x3e2a40;})});}if(_0x1d9f4d['query']['$gte']){var _0x122d06=_0x1d9f4d['query'][_0xf962('0x73')][_0xf962('0x2e')](',');var _0x413352={};_0x413352[_0x122d06[0x0]]={'$gte':moment(_0x122d06[0x1])[_0xf962('0xb5')](_0xf962('0xb6'))};_0x374e68[_0xf962('0x42')]=_['merge'](_0x374e68[_0xf962('0x42')],_0x413352);}_0x374e68=_[_0xf962('0x8f')]({},_0x374e68,_0x1d9f4d[_0xf962('0xab')]);return db['FaxMessage']['count']({'where':_0x374e68[_0xf962('0x42')]})['then'](function(_0x379ef3){_0x2ae8d8[_0xf962('0x1f')]=_0x379ef3;if(_0x1d9f4d[_0xf962('0x37')]['includeAll']){_0x374e68[_0xf962('0xaa')]=[{'all':!![]}];}return db[_0xf962('0xaf')]['findAll'](_0x374e68);})['then'](function(_0x5d3fcf){_0x2ae8d8[_0xf962('0xb7')]=_0x5d3fcf;return _0x2ae8d8;});}})['then'](respondWithFilteredResult(_0x371f4f,_0x374e68))[_0xf962('0xa6')](handleError(_0x371f4f,null));};exports['addTags']=function(_0x14be3e,_0x4d221b,_0x5ee300){return db[_0xf962('0x32')][_0xf962('0x5b')]({'where':{'id':_0x14be3e['params']['id']}})['then'](handleEntityNotFound(_0x4d221b,null))[_0xf962('0x23')](function(_0x3b0a31){if(_0x3b0a31){return _0x3b0a31['setTags'](_0x14be3e[_0xf962('0x6d')][_0xf962('0xb0')],_['omit'](_0x14be3e['body'],[_0xf962('0xb0'),'id'])||{})['spread'](function(){return db[_0xf962('0xb8')][_0xf962('0xb9')]({'attributes':['id',_0xf962('0x36'),_0xf962('0x46')],'where':{'id':_0x14be3e[_0xf962('0x6d')]['ids']}});})[_0xf962('0x23')](function(_0x5598c5){socket[_0xf962('0xba')]('faxInteractionTags:save',{'id':Number(_0x14be3e['params']['id']),'tags':_0x5598c5||[]});return{'id':Number(_0x14be3e[_0xf962('0xa8')]['id']),'tags':_0x5598c5||[]};});}})[_0xf962('0x23')](respondWithResult(_0x4d221b,null))[_0xf962('0xa6')](handleError(_0x4d221b,null));};exports['removeTags']=function(_0x1f2ed9,_0x117fdc,_0x4e8640){return db[_0xf962('0x32')][_0xf962('0x5b')]({'where':{'id':_0x1f2ed9['params']['id']}})['then'](handleEntityNotFound(_0x117fdc,null))[_0xf962('0x23')](function(_0x5d3fd4){if(_0x5d3fd4){return _0x5d3fd4[_0xf962('0xbb')](_0x1f2ed9[_0xf962('0x37')][_0xf962('0xb0')]);}})[_0xf962('0x23')](respondWithStatusCode(_0x117fdc,null))[_0xf962('0xa6')](handleError(_0x117fdc,null));};exports['download']=function(_0x12fd63,_0x3bd340){var _0x2fb7ce=moment()[_0xf962('0xbc')]()[_0xf962('0x8d')]();var _0x2b942b=path[_0xf962('0xbd')](config[_0xf962('0xbe')],_0xf962('0xbf'),_0xf962('0xc0'),_0xf962('0xc1'));var _0x44a52a=path['join'](config['root'],_0xf962('0xbf'),_0xf962('0xc0'),'attachments');var _0x1795f7=path[_0xf962('0xbd')](_0x2b942b,_0x2fb7ce);var _0x3f3c67=util['format'](_0xf962('0xc2'),_0x12fd63[_0xf962('0xa8')]['id'],_0x2fb7ce);var _0x59ce8b=path['join'](_0x2b942b,_0x3f3c67);var _0x5b4181=[];_0x5b4181[_0xf962('0x30')]({'model':db['Attachment'],'as':_0xf962('0xc3'),'raw':!![]});var _0x4bac66=[{'model':db['FaxMessage'],'as':_0xf962('0xc4'),'attributes':['id','body','createdAt'],'include':_0x5b4181}];return db[_0xf962('0x32')][_0xf962('0x5b')]({'where':{'id':_0x12fd63[_0xf962('0xa8')]['id']},'include':_0x4bac66})[_0xf962('0x23')](handleEntityNotFound(_0x3bd340,null))[_0xf962('0x23')](function(_0x144d4d){if(_0x144d4d&&_0x144d4d['Messages']){var _0x5a4e0a=_0x144d4d[_0xf962('0xc5')]({'plain':!![]});fs[_0xf962('0xc6')](_0x1795f7);for(var _0x421dfc=0x0;_0x421dfc<_0x5a4e0a[_0xf962('0xc4')][_0xf962('0x3d')];_0x421dfc++){var _0x27be08=_0x5a4e0a['Messages'][_0x421dfc][_0xf962('0xc3')];if(_0x27be08){var _0x2657ff=path[_0xf962('0xbd')](_0x44a52a,_0x27be08[_0xf962('0xc7')]);if(fs[_0xf962('0xc8')](_0x2657ff)){fs[_0xf962('0xc9')](_0x2657ff)['pipe'](fs[_0xf962('0xca')](path[_0xf962('0xbd')](_0x1795f7,_0x27be08[_0xf962('0xc7')])));}}}return BPromise[_0xf962('0xcb')]()[_0xf962('0x23')](function(){return new BPromise(function(_0x37b855,_0x3a2802){zipdir(_0x1795f7,{'saveTo':_0x59ce8b},function(_0x3e077d,_0xbcce93){if(_0x3e077d)return _0x3a2802(_0x3e077d);return _0x37b855(_0xbcce93);});})['then'](function(){return new BPromise(function(_0x323358,_0x5a9d7f){rimraf(_0x1795f7,function(_0xd4482e){if(_0xd4482e)_0x5a9d7f(_0xd4482e);return _0x323358();});});})[_0xf962('0x23')](function(){return _0x3bd340[_0xf962('0xcc')](_0x59ce8b,_0x3f3c67,function(_0x196442){if(_0x196442){console[_0xf962('0xcd')]('err',_0x196442);}else{fs[_0xf962('0xce')](_0x59ce8b);}});});});}else{return _0x3bd340[_0xf962('0x26')](0xc8);}})[_0xf962('0xa6')](handleError(_0x3bd340,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 9dd465d..5249302 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 _0xdb66=['FaxMessage','setMaxListeners','save','remove','getUsers','setDataValue','map','findAll','then','unreadMessages','emit','catch','exports','events','../../mysqldb','FaxInteraction'];(function(_0xaa51e0,_0x388691){var _0x5cbbba=function(_0x21cc84){while(--_0x21cc84){_0xaa51e0['push'](_0xaa51e0['shift']());}};_0x5cbbba(++_0x388691);}(_0xdb66,0xad));var _0x6db6=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xdb66[_0x3b5250];return _0xc844a1;};'use strict';var EventEmitter=require(_0x6db6('0x0'));var FaxInteraction=require(_0x6db6('0x1'))['db'][_0x6db6('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0x6db6('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x6db6('0x4')](0x0);var events={'afterCreate':_0x6db6('0x5'),'afterUpdate':'update','afterDestroy':_0x6db6('0x6')};function emitEvent(_0xe4dcf0){return function(_0x351e52,_0x5b69d9,_0x143e3c){_0x351e52[_0x6db6('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1b1106){_0x351e52[_0x6db6('0x8')]('Users',_0x1b1106[_0x6db6('0x9')](function(_0x54d99d){return{'id':_0x54d99d['id']};}));return FaxMessage[_0x6db6('0xa')]({'where':{'FaxInteractionId':_0x351e52['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6db6('0xb')](function(_0x2165ff){_0x351e52[_0x6db6('0x8')](_0x6db6('0xc'),_0x2165ff['length']);FaxInteractionEvents[_0x6db6('0xd')](_0xe4dcf0+':'+_0x351e52['id'],_0x351e52);FaxInteractionEvents[_0x6db6('0xd')](_0xe4dcf0,_0x351e52);_0x143e3c(null);})[_0x6db6('0xe')](_0x143e3c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x6db6('0xf')]=FaxInteractionEvents; \ No newline at end of file +var _0x9f25=['setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','FaxInteraction','FaxMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f25,0x12c));var _0x59f2=function(_0x3d1996,_0x1f08f0){_0x3d1996=_0x3d1996-0x0;var _0x550afd=_0x9f25[_0x3d1996];return _0x550afd;};'use strict';var EventEmitter=require(_0x59f2('0x0'));var FaxInteraction=require(_0x59f2('0x1'))['db'][_0x59f2('0x2')];var FaxMessage=require(_0x59f2('0x1'))['db'][_0x59f2('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x59f2('0x4')](0x0);var events={'afterCreate':_0x59f2('0x5'),'afterUpdate':_0x59f2('0x6'),'afterDestroy':_0x59f2('0x7')};function emitEvent(_0x20cf3a){return function(_0x4fa4a5,_0x51c0ac,_0x312efd){_0x4fa4a5[_0x59f2('0x8')]({'attributes':['id'],'raw':!![]})[_0x59f2('0x9')](function(_0x3ebb8f){_0x4fa4a5[_0x59f2('0xa')](_0x59f2('0xb'),_0x3ebb8f[_0x59f2('0xc')](function(_0x229b2a){return{'id':_0x229b2a['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x4fa4a5['id'],'direction':'in','read':![]},'raw':!![]});})[_0x59f2('0x9')](function(_0x201fbd){_0x4fa4a5[_0x59f2('0xa')](_0x59f2('0xd'),_0x201fbd[_0x59f2('0xe')]);FaxInteractionEvents['emit'](_0x20cf3a+':'+_0x4fa4a5['id'],_0x4fa4a5);FaxInteractionEvents[_0x59f2('0xf')](_0x20cf3a,_0x4fa4a5);_0x312efd(null);})[_0x59f2('0x10')](_0x312efd(null));};}for(var e in events){if(events[_0x59f2('0x11')](e)){var event=events[e];FaxInteraction[_0x59f2('0x12')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 4d78db4..f8a92f6 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 _0x81c0=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','./faxInteraction.attributes','define','FaxInteraction','changed','closed','closedAt','format'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x81c0,0x1e1));var _0x081c=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x81c0[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x081c('0x0'));var util=require(_0x081c('0x1'));var logger=require('../../config/logger')(_0x081c('0x2'));var moment=require(_0x081c('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('../../config/environment');var attributes=require(_0x081c('0x4'));module['exports']=function(_0xe549ee,_0x27030a){return _0xe549ee[_0x081c('0x5')](_0x081c('0x6'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x38bc2c,_0x130800,_0x4aa381){if(_0x38bc2c[_0x081c('0x7')](_0x081c('0x8'))){_0x38bc2c[_0x081c('0x9')]=moment()[_0x081c('0xa')](_0x081c('0xb'));}_0x4aa381(null,_0x38bc2c);}}});}; \ No newline at end of file +var _0xbd89=['format','YYYY-MM-DD\x20HH:mm:ss','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxInteraction','fax_interactions','changed'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xbd89,0x9e));var _0x9bd8=function(_0x3ea076,_0x34ae1e){_0x3ea076=_0x3ea076-0x0;var _0x4805c8=_0xbd89[_0x3ea076];return _0x4805c8;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x9bd8('0x0'));var moment=require('moment');var BPromise=require(_0x9bd8('0x1'));var rp=require(_0x9bd8('0x2'));var fs=require('fs');var path=require(_0x9bd8('0x3'));var rimraf=require(_0x9bd8('0x4'));var config=require(_0x9bd8('0x5'));var attributes=require('./faxInteraction.attributes');module[_0x9bd8('0x6')]=function(_0x143594,_0x38eedc){return _0x143594[_0x9bd8('0x7')](_0x9bd8('0x8'),attributes,{'tableName':_0x9bd8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x219c66,_0x233e9e,_0x13c974){if(_0x219c66[_0x9bd8('0xa')]('closed')){_0x219c66['closedAt']=moment()[_0x9bd8('0xb')](_0x9bd8('0xc'));}_0x13c974(null,_0x219c66);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 97d7bf1..42aede5 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 _0x0ea4=['find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxInteraction.socket','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','FaxInteraction','update','options','raw','where','attributes','UpdateFaxInteraction','stringify','AddTagsToFaxInteraction'];(function(_0x12e679,_0x39cc73){var _0xc99b75=function(_0x108cfb){while(--_0x108cfb){_0x12e679['push'](_0x12e679['shift']());}};_0xc99b75(++_0x39cc73);}(_0x0ea4,0x12d));var _0x40ea=function(_0xc6d85a,_0x522f89){_0xc6d85a=_0xc6d85a-0x0;var _0x2d59f9=_0x0ea4[_0xc6d85a];return _0x2d59f9;};'use strict';var _=require(_0x40ea('0x0'));var util=require(_0x40ea('0x1'));var moment=require(_0x40ea('0x2'));var BPromise=require('bluebird');var rs=require(_0x40ea('0x3'));var fs=require('fs');var Redis=require(_0x40ea('0x4'));var db=require(_0x40ea('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x40ea('0x6'))(_0x40ea('0x7'));var config=require('../../config/environment');var jayson=require(_0x40ea('0x8'));var client=jayson[_0x40ea('0x9')][_0x40ea('0xa')]({'port':0x232a});config[_0x40ea('0xb')]=_[_0x40ea('0xc')](config[_0x40ea('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x40ea('0xd'))(new Redis(config[_0x40ea('0xb')]));require(_0x40ea('0xe'))['register'](socket);function respondWithRpcPromise(_0x10b251,_0x1ec47a,_0xb21ffb){return new BPromise(function(_0x3cbdde,_0x20f5c6){return client[_0x40ea('0xf')](_0x10b251,_0xb21ffb)[_0x40ea('0x10')](function(_0x410bd5){logger[_0x40ea('0x11')](_0x40ea('0x12'),_0x1ec47a,_0x40ea('0x13'));logger[_0x40ea('0x14')](_0x40ea('0x15'),_0x1ec47a,_0x40ea('0x13'),JSON['stringify'](_0x410bd5));if(_0x410bd5[_0x40ea('0x16')]){if(_0x410bd5[_0x40ea('0x16')][_0x40ea('0x17')]===0x1f4){logger[_0x40ea('0x16')](_0x40ea('0x12'),_0x1ec47a,_0x410bd5[_0x40ea('0x16')]['message']);return _0x20f5c6(_0x410bd5[_0x40ea('0x16')]['message']);}logger[_0x40ea('0x16')](_0x40ea('0x12'),_0x1ec47a,_0x410bd5[_0x40ea('0x16')][_0x40ea('0x18')]);return _0x3cbdde(_0x410bd5[_0x40ea('0x16')][_0x40ea('0x18')]);}else{logger[_0x40ea('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x1ec47a,_0x40ea('0x13'));_0x3cbdde(_0x410bd5['result'][_0x40ea('0x18')]);}})[_0x40ea('0x19')](function(_0x21368c){logger[_0x40ea('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x1ec47a,_0x21368c);_0x20f5c6(_0x21368c);});});}exports['UpdateFaxInteraction']=function(_0x343778){var _0x28d201=this;return new Promise(function(_0x5af963,_0x1d6e99){return db[_0x40ea('0x1a')][_0x40ea('0x1b')](_0x343778['body'],{'raw':_0x343778[_0x40ea('0x1c')]?_0x343778[_0x40ea('0x1c')][_0x40ea('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x343778[_0x40ea('0x1c')]?_0x343778[_0x40ea('0x1c')][_0x40ea('0x1e')]||null:null,'attributes':_0x343778['options']?_0x343778[_0x40ea('0x1c')][_0x40ea('0x1f')]||null:null,'limit':_0x343778[_0x40ea('0x1c')]?_0x343778[_0x40ea('0x1c')]['limit']||null:null})['then'](function(_0x504071){logger[_0x40ea('0x11')](_0x40ea('0x20'),_0x343778);logger[_0x40ea('0x14')](_0x40ea('0x20'),_0x343778,JSON[_0x40ea('0x21')](_0x504071));_0x5af963(_0x504071);})[_0x40ea('0x19')](function(_0x3ed8d3){logger[_0x40ea('0x16')](_0x40ea('0x20'),_0x3ed8d3[_0x40ea('0x18')],_0x343778);_0x1d6e99(_0x28d201[_0x40ea('0x16')](0x1f4,_0x3ed8d3[_0x40ea('0x18')]));});});};exports[_0x40ea('0x22')]=function(_0x53b811){return new Promise(function(_0xa9f85d,_0x1b9bc0){return db['FaxInteraction'][_0x40ea('0x23')]({'where':_0x53b811[_0x40ea('0x1c')]?_0x53b811[_0x40ea('0x1c')][_0x40ea('0x1e')]||null:null})[_0x40ea('0x10')](function(_0x3cc377){if(_0x3cc377){return _0x3cc377[_0x40ea('0x24')](_0x53b811[_0x40ea('0x25')][_0x40ea('0x26')],_[_0x40ea('0x27')](_0x53b811[_0x40ea('0x25')],['ids','id'])||{});}})[_0x40ea('0x28')](function(_0x2252ed){logger['info'](_0x40ea('0x29'),_0x53b811);logger['debug'](_0x40ea('0x29'),_0x53b811,JSON[_0x40ea('0x21')](_0x2252ed));_0xa9f85d(_0x2252ed);})[_0x40ea('0x19')](function(_0x5474e3){logger['error']('AddTags',_0x5474e3[_0x40ea('0x18')],_0x53b811);_0x1b9bc0(_this[_0x40ea('0x16')](0x1f4,_0x5474e3[_0x40ea('0x18')]));});});}; \ No newline at end of file +var _0xa5d6=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','request','info','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','FaxInteraction','update','options','raw','then','UpdateFaxInteraction','AddTagsToFaxInteraction','where','addTags','body','ids','AddTags','lodash','util','randomstring'];(function(_0x573726,_0x5e9fb8){var _0xc124aa=function(_0x1f0489){while(--_0x1f0489){_0x573726['push'](_0x573726['shift']());}};_0xc124aa(++_0x5e9fb8);}(_0xa5d6,0x16f));var _0x6a5d=function(_0x182e9b,_0x5687c5){_0x182e9b=_0x182e9b-0x0;var _0x11e8d0=_0xa5d6[_0x182e9b];return _0x11e8d0;};'use strict';var _=require(_0x6a5d('0x0'));var util=require(_0x6a5d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6a5d('0x2'));var fs=require('fs');var Redis=require(_0x6a5d('0x3'));var db=require(_0x6a5d('0x4'))['db'];var utils=require(_0x6a5d('0x5'));var logger=require(_0x6a5d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6a5d('0x7'));var client=jayson[_0x6a5d('0x8')]['http']({'port':0x232a});config[_0x6a5d('0x9')]=_[_0x6a5d('0xa')](config['redis'],{'host':_0x6a5d('0xb'),'port':0x18eb});var socket=require(_0x6a5d('0xc'))(new Redis(config[_0x6a5d('0x9')]));require(_0x6a5d('0xd'))['register'](socket);function respondWithRpcPromise(_0x2a89fe,_0x1a0a3b,_0x49d741){return new BPromise(function(_0x302f13,_0x45a68b){return client[_0x6a5d('0xe')](_0x2a89fe,_0x49d741)['then'](function(_0x9cf14d){logger[_0x6a5d('0xf')](_0x6a5d('0x10'),_0x1a0a3b,'request\x20sent');logger[_0x6a5d('0x11')](_0x6a5d('0x12'),_0x1a0a3b,'request\x20sent',JSON[_0x6a5d('0x13')](_0x9cf14d));if(_0x9cf14d[_0x6a5d('0x14')]){if(_0x9cf14d[_0x6a5d('0x14')]['code']===0x1f4){logger[_0x6a5d('0x14')](_0x6a5d('0x10'),_0x1a0a3b,_0x9cf14d['error'][_0x6a5d('0x15')]);return _0x45a68b(_0x9cf14d['error'][_0x6a5d('0x15')]);}logger['error'](_0x6a5d('0x10'),_0x1a0a3b,_0x9cf14d[_0x6a5d('0x14')][_0x6a5d('0x15')]);return _0x302f13(_0x9cf14d[_0x6a5d('0x14')]['message']);}else{logger[_0x6a5d('0xf')](_0x6a5d('0x10'),_0x1a0a3b,_0x6a5d('0x16'));_0x302f13(_0x9cf14d[_0x6a5d('0x17')][_0x6a5d('0x15')]);}})[_0x6a5d('0x18')](function(_0x3ae121){logger[_0x6a5d('0x14')](_0x6a5d('0x10'),_0x1a0a3b,_0x3ae121);_0x45a68b(_0x3ae121);});});}exports['UpdateFaxInteraction']=function(_0x29b3a1){var _0x47f7ad=this;return new Promise(function(_0x1911cc,_0x3254fd){return db[_0x6a5d('0x19')][_0x6a5d('0x1a')](_0x29b3a1['body'],{'raw':_0x29b3a1[_0x6a5d('0x1b')]?_0x29b3a1[_0x6a5d('0x1b')][_0x6a5d('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29b3a1[_0x6a5d('0x1b')]?_0x29b3a1[_0x6a5d('0x1b')]['where']||null:null,'attributes':_0x29b3a1[_0x6a5d('0x1b')]?_0x29b3a1[_0x6a5d('0x1b')]['attributes']||null:null,'limit':_0x29b3a1[_0x6a5d('0x1b')]?_0x29b3a1[_0x6a5d('0x1b')]['limit']||null:null})[_0x6a5d('0x1d')](function(_0x18657b){logger[_0x6a5d('0xf')](_0x6a5d('0x1e'),_0x29b3a1);logger[_0x6a5d('0x11')](_0x6a5d('0x1e'),_0x29b3a1,JSON['stringify'](_0x18657b));_0x1911cc(_0x18657b);})['catch'](function(_0x59e44f){logger['error'](_0x6a5d('0x1e'),_0x59e44f[_0x6a5d('0x15')],_0x29b3a1);_0x3254fd(_0x47f7ad['error'](0x1f4,_0x59e44f[_0x6a5d('0x15')]));});});};exports[_0x6a5d('0x1f')]=function(_0x38ca83){return new Promise(function(_0x5ce2e5,_0x1aa6ef){return db[_0x6a5d('0x19')]['find']({'where':_0x38ca83[_0x6a5d('0x1b')]?_0x38ca83['options'][_0x6a5d('0x20')]||null:null})[_0x6a5d('0x1d')](function(_0x459318){if(_0x459318){return _0x459318[_0x6a5d('0x21')](_0x38ca83[_0x6a5d('0x22')][_0x6a5d('0x23')],_['omit'](_0x38ca83[_0x6a5d('0x22')],[_0x6a5d('0x23'),'id'])||{});}})['spread'](function(_0x292736){logger[_0x6a5d('0xf')]('AddTags',_0x38ca83);logger[_0x6a5d('0x11')](_0x6a5d('0x24'),_0x38ca83,JSON['stringify'](_0x292736));_0x5ce2e5(_0x292736);})[_0x6a5d('0x18')](function(_0x536f87){logger[_0x6a5d('0x14')]('AddTags',_0x536f87[_0x6a5d('0x15')],_0x38ca83);_0x1aa6ef(_this[_0x6a5d('0x14')](0x1f4,_0x536f87[_0x6a5d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 56688eb..7b3d452 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 _0x17a3=['emit','removeListener','register','length','faxInteraction:','./faxInteraction.events','save','update'];(function(_0x1a174b,_0x1495ae){var _0x140b43=function(_0x52f87f){while(--_0x52f87f){_0x1a174b['push'](_0x1a174b['shift']());}};_0x140b43(++_0x1495ae);}(_0x17a3,0xfd));var _0x317a=function(_0x4f3cb2,_0x31b881){_0x4f3cb2=_0x4f3cb2-0x0;var _0x57f275=_0x17a3[_0x4f3cb2];return _0x57f275;};'use strict';var FaxInteractionEvents=require(_0x317a('0x0'));var events=[_0x317a('0x1'),'remove',_0x317a('0x2')];function createListener(_0x39db5a,_0x25225c){return function(_0x17a68c){_0x25225c[_0x317a('0x3')](_0x39db5a,_0x17a68c);};}function removeListener(_0x267b18,_0xe60eb7){return function(){FaxInteractionEvents[_0x317a('0x4')](_0x267b18,_0xe60eb7);};}exports[_0x317a('0x5')]=function(_0x4739df){for(var _0x18beba=0x0,_0x18b3a4=events[_0x317a('0x6')];_0x18beba<_0x18b3a4;_0x18beba++){var _0x52e01c=events[_0x18beba];var _0x27590f=createListener(_0x317a('0x7')+_0x52e01c,_0x4739df);FaxInteractionEvents['on'](_0x52e01c,_0x27590f);}}; \ No newline at end of file +var _0xf239=['remove','update','emit','removeListener','length','faxInteraction:','./faxInteraction.events','save'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0xf239,0x86));var _0x9f23=function(_0x5614d4,_0x48d868){_0x5614d4=_0x5614d4-0x0;var _0x40f276=_0xf239[_0x5614d4];return _0x40f276;};'use strict';var FaxInteractionEvents=require(_0x9f23('0x0'));var events=[_0x9f23('0x1'),_0x9f23('0x2'),_0x9f23('0x3')];function createListener(_0x3af930,_0x1c98fd){return function(_0x497125){_0x1c98fd[_0x9f23('0x4')](_0x3af930,_0x497125);};}function removeListener(_0x48cb9,_0x881572){return function(){FaxInteractionEvents[_0x9f23('0x5')](_0x48cb9,_0x881572);};}exports['register']=function(_0x94b1b5){for(var _0x4f8bec=0x0,_0x54eb70=events[_0x9f23('0x6')];_0x4f8bec<_0x54eb70;_0x4f8bec++){var _0x22ccf3=events[_0x4f8bec];var _0x3f856f=createListener(_0x9f23('0x7')+_0x22ccf3,_0x94b1b5);FaxInteractionEvents['on'](_0x22ccf3,_0x3f856f);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 986ce03..2d5616a 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 _0xabf1=['addMessage','/:id/tags','fax','addTags','put','tracked','faxinteraction:update','update','delete','faxinteraction:destroy','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/messages','/:id/download','download','post','create'];(function(_0x122a6e,_0xcbba28){var _0x185449=function(_0x1b6cd5){while(--_0x1b6cd5){_0x122a6e['push'](_0x122a6e['shift']());}};_0x185449(++_0xcbba28);}(_0xabf1,0xa0));var _0x1abf=function(_0x16270b,_0x4ff120){_0x16270b=_0x16270b-0x0;var _0x2cd122=_0xabf1[_0x16270b];return _0x2cd122;};'use strict';var multer=require(_0x1abf('0x0'));var util=require(_0x1abf('0x1'));var path=require(_0x1abf('0x2'));var timeout=require(_0x1abf('0x3'));var express=require('express');var router=express[_0x1abf('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1abf('0x5'));var config=require(_0x1abf('0x6'));var controller=require(_0x1abf('0x7'));router[_0x1abf('0x8')]('/',auth['isAuthenticated'](),controller[_0x1abf('0x9')]);router[_0x1abf('0x8')](_0x1abf('0xa'),auth['isAuthenticated'](),controller[_0x1abf('0xb')]);router[_0x1abf('0x8')](_0x1abf('0xc'),auth[_0x1abf('0xd')](),controller[_0x1abf('0xe')]);router['get'](_0x1abf('0xf'),auth[_0x1abf('0xd')](),controller['getMessages']);router[_0x1abf('0x8')](_0x1abf('0x10'),auth[_0x1abf('0xd')](),controller[_0x1abf('0x11')]);router[_0x1abf('0x12')]('/',auth[_0x1abf('0xd')](),controller[_0x1abf('0x13')]);router[_0x1abf('0x12')](_0x1abf('0xf'),auth[_0x1abf('0xd')](),controller[_0x1abf('0x14')]);router[_0x1abf('0x12')](_0x1abf('0x15'),auth[_0x1abf('0xd')](),interaction['tracked'](_0x1abf('0x16'),'faxinteraction:addtags'),controller[_0x1abf('0x17')]);router[_0x1abf('0x18')](_0x1abf('0xc'),auth[_0x1abf('0xd')](),interaction[_0x1abf('0x19')](_0x1abf('0x16'),_0x1abf('0x1a')),controller[_0x1abf('0x1b')]);router[_0x1abf('0x1c')](_0x1abf('0xc'),auth[_0x1abf('0xd')](),interaction[_0x1abf('0x19')](_0x1abf('0x16'),_0x1abf('0x1d')),controller['destroy']);router[_0x1abf('0x1c')](_0x1abf('0x15'),auth[_0x1abf('0xd')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xebc3=['index','describe','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','tracked','addTags','put','fax','faxinteraction:update','/:id','destroy','delete','removeTags','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated'];(function(_0x4b3b48,_0x1776ec){var _0x2eb0a4=function(_0x11b2f0){while(--_0x11b2f0){_0x4b3b48['push'](_0x4b3b48['shift']());}};_0x2eb0a4(++_0x1776ec);}(_0xebc3,0xc1));var _0x3ebc=function(_0x29b695,_0x1d591e){_0x29b695=_0x29b695-0x0;var _0x596fe3=_0xebc3[_0x29b695];return _0x596fe3;};'use strict';var multer=require(_0x3ebc('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3ebc('0x1'));var express=require('express');var router=express[_0x3ebc('0x2')]();var fs_extra=require(_0x3ebc('0x3'));var auth=require(_0x3ebc('0x4'));var interaction=require(_0x3ebc('0x5'));var config=require(_0x3ebc('0x6'));var controller=require(_0x3ebc('0x7'));router[_0x3ebc('0x8')]('/',auth[_0x3ebc('0x9')](),controller[_0x3ebc('0xa')]);router[_0x3ebc('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x3ebc('0xb')]);router[_0x3ebc('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x3ebc('0x8')](_0x3ebc('0xc'),auth['isAuthenticated'](),controller[_0x3ebc('0xd')]);router[_0x3ebc('0x8')](_0x3ebc('0xe'),auth[_0x3ebc('0x9')](),controller[_0x3ebc('0xf')]);router[_0x3ebc('0x10')]('/',auth[_0x3ebc('0x9')](),controller[_0x3ebc('0x11')]);router[_0x3ebc('0x10')](_0x3ebc('0xc'),auth['isAuthenticated'](),controller['addMessage']);router[_0x3ebc('0x10')](_0x3ebc('0x12'),auth[_0x3ebc('0x9')](),interaction[_0x3ebc('0x13')]('fax','faxinteraction:addtags'),controller[_0x3ebc('0x14')]);router[_0x3ebc('0x15')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x3ebc('0x16'),_0x3ebc('0x17')),controller['update']);router['delete'](_0x3ebc('0x18'),auth[_0x3ebc('0x9')](),interaction[_0x3ebc('0x13')](_0x3ebc('0x16'),'faxinteraction:destroy'),controller[_0x3ebc('0x19')]);router[_0x3ebc('0x1a')]('/:id/tags',auth['isAuthenticated'](),controller[_0x3ebc('0x1b')]);module[_0x3ebc('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 30c44aa..8fd5f6f 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 _0x9c44=['out','TEXT','medium','BOOLEAN','ENUM'];(function(_0x452abb,_0x1a66ee){var _0x3dd051=function(_0x4edb06){while(--_0x4edb06){_0x452abb['push'](_0x452abb['shift']());}};_0x3dd051(++_0x1a66ee);}(_0x9c44,0x178));var _0x49c4=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x9c44[_0x3b0731];return _0x4204d7;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x49c4('0x0')](_0x49c4('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x49c4('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x49c4('0x3')]('in',_0x49c4('0x4')),'defaultValue':_0x49c4('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x4a81=['DATE','sequelize','exports','TEXT','medium','out'];(function(_0x42c0aa,_0x548aa3){var _0x2cc449=function(_0x2ba2b8){while(--_0x2ba2b8){_0x42c0aa['push'](_0x42c0aa['shift']());}};_0x2cc449(++_0x548aa3);}(_0x4a81,0x1b7));var _0x14a8=function(_0x38163d,_0xf43a41){_0x38163d=_0x38163d-0x0;var _0x1c51f6=_0x4a81[_0x38163d];return _0x1c51f6;};'use strict';var Sequelize=require(_0x14a8('0x0'));module[_0x14a8('0x1')]={'body':{'type':Sequelize[_0x14a8('0x2')](_0x14a8('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x14a8('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x14a8('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x14a8('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 8e04b9a..93c2418 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 _0xf8dc=['options','includeAll','include','findAll','rows','show','params','find','body','describe','fax-interactions','fax','readAt','format','UserId','get','FaxInteraction','FaxInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','AcceptMessage','ContactId','sequelize','QueryTypes','SELECT','User','agent','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','accept','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','email','event','rejectmessage','create','CmContact','findOne','isNil','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','join','server','attachments','download','basename','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','undefined','offset','count','limit','Content-Range','reject','update','then','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf8dc,0x1f2));var _0xcf8d=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xf8dc[_0x4ea69d];return _0x5318e0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcf8d('0x0'));var zipdir=require(_0xcf8d('0x1'));var jsonpatch=require(_0xcf8d('0x2'));var rp=require(_0xcf8d('0x3'));var moment=require('moment');var BPromise=require(_0xcf8d('0x4'));var Mustache=require(_0xcf8d('0x5'));var util=require(_0xcf8d('0x6'));var path=require(_0xcf8d('0x7'));var sox=require(_0xcf8d('0x8'));var csv=require('to-csv');var ejs=require(_0xcf8d('0x9'));var fs=require('fs');var fs_extra=require(_0xcf8d('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xcf8d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xcf8d('0xc'));var toCsv=require(_0xcf8d('0xd'));var querystring=require(_0xcf8d('0xe'));var Papa=require(_0xcf8d('0xf'));var Redis=require(_0xcf8d('0x10'));var authService=require(_0xcf8d('0x11'));var qs=require(_0xcf8d('0x12'));var as=require(_0xcf8d('0x13'));var hardwareService=require(_0xcf8d('0x14'));var logger=require(_0xcf8d('0x15'))(_0xcf8d('0x16'));var utils=require(_0xcf8d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcf8d('0x18'))['db'];config['redis']=_[_0xcf8d('0x19')](config['redis'],{'host':_0xcf8d('0x1a'),'port':0x18eb});var socket=require(_0xcf8d('0x1b'))(new Redis(config['redis']));require(_0xcf8d('0x1c'))[_0xcf8d('0x1d')](socket);var jayson=require(_0xcf8d('0x1e'));var client=jayson[_0xcf8d('0x1f')][_0xcf8d('0x20')]({'port':0x232c});var client9002=jayson[_0xcf8d('0x1f')][_0xcf8d('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x34700a,_0x564223,_0x50ceba,_0x3af4a6){return new BPromise(function(_0x579b78,_0x5369b9){var _0x5bdec0=_0x3af4a6||client;return _0x5bdec0[_0xcf8d('0x21')](_0x34700a,_0x50ceba)['then'](function(_0x12cc3b){logger[_0xcf8d('0x22')](_0xcf8d('0x23'),_0x564223,'request\x20sent');logger[_0xcf8d('0x24')](_0xcf8d('0x25'),_0x564223,_0xcf8d('0x26'),JSON[_0xcf8d('0x27')](_0x12cc3b));if(_0x12cc3b[_0xcf8d('0x28')]){if(_0x12cc3b[_0xcf8d('0x28')][_0xcf8d('0x29')]===0x1f4){logger['error'](_0xcf8d('0x23'),_0x564223,_0x12cc3b['error'][_0xcf8d('0x2a')]);return _0x5369b9(_0x12cc3b[_0xcf8d('0x28')][_0xcf8d('0x2a')]);}logger[_0xcf8d('0x28')](_0xcf8d('0x23'),_0x564223,_0x12cc3b['error'][_0xcf8d('0x2a')]);return _0x579b78(_0x12cc3b[_0xcf8d('0x28')]['message']);}else{logger['info'](_0xcf8d('0x23'),_0x564223,_0xcf8d('0x26'));_0x579b78(_0x12cc3b['result'][_0xcf8d('0x2a')]);}})[_0xcf8d('0x2b')](function(_0x5024e1){logger[_0xcf8d('0x28')](_0xcf8d('0x23'),_0x564223,_0x5024e1);_0x5369b9(_0x5024e1);});});}function respondWithStatusCode(_0x165d9b,_0x28fb19){_0x28fb19=_0x28fb19||0xcc;return function(_0x34fa0a){if(_0x34fa0a){return _0x165d9b[_0xcf8d('0x2c')](_0x28fb19);}return _0x165d9b[_0xcf8d('0x2d')](_0x28fb19)[_0xcf8d('0x2e')]();};}function respondWithResult(_0xd782a6,_0x25a736){_0x25a736=_0x25a736||0xc8;return function(_0xe5a541){if(_0xe5a541){return _0xd782a6[_0xcf8d('0x2d')](_0x25a736)[_0xcf8d('0x2f')](_0xe5a541);}};}function respondWithFilteredResult(_0x5854f8,_0x1b836d){return function(_0x45b580){if(_0x45b580){var _0x2710ba=typeof _0x1b836d['offset']==='undefined'&&typeof _0x1b836d['limit']===_0xcf8d('0x30');var _0x3d820d=_0x45b580['count'];var _0x834e38=_0x2710ba?0x0:_0x1b836d[_0xcf8d('0x31')];var _0xa5221e=_0x2710ba?_0x45b580[_0xcf8d('0x32')]:_0x1b836d[_0xcf8d('0x31')]+_0x1b836d[_0xcf8d('0x33')];var _0x106f39;if(_0xa5221e>=_0x3d820d){_0xa5221e=_0x3d820d;_0x106f39=0xc8;}else{_0x106f39=0xce;}_0x5854f8[_0xcf8d('0x2d')](_0x106f39);return _0x5854f8['set'](_0xcf8d('0x34'),_0x834e38+'-'+_0xa5221e+'/'+_0x3d820d)[_0xcf8d('0x2f')](_0x45b580);}return null;};}function patchUpdates(_0x17b550){return function(_0x2feeb7){try{jsonpatch['apply'](_0x2feeb7,_0x17b550,!![]);}catch(_0x10dd80){return BPromise[_0xcf8d('0x35')](_0x10dd80);}return _0x2feeb7['save']();};}function saveUpdates(_0x350edc,_0x2cf1ef){return function(_0x444b07){if(_0x444b07){return _0x444b07[_0xcf8d('0x36')](_0x350edc)[_0xcf8d('0x37')](function(_0x2888b5){return _0x2888b5;});}return null;};}function removeEntity(_0x510274,_0x93ab7d){return function(_0x5dc3c1){if(_0x5dc3c1){return _0x5dc3c1[_0xcf8d('0x38')]()['then'](function(){_0x510274[_0xcf8d('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe8a73d,_0x505ff7){return function(_0x207a64){if(!_0x207a64){_0xe8a73d[_0xcf8d('0x2c')](0x194);}return _0x207a64;};}function handleError(_0x5ab296,_0x35eeb2){_0x35eeb2=_0x35eeb2||0x1f4;return function(_0xb20819){logger['error'](_0xb20819[_0xcf8d('0x39')]);if(_0xb20819['name']){delete _0xb20819[_0xcf8d('0x3a')];}_0x5ab296['status'](_0x35eeb2)[_0xcf8d('0x3b')](_0xb20819);};}exports[_0xcf8d('0x3c')]=function(_0x2d2dba,_0x54bb37){var _0x430ba5={},_0x13127b={},_0xa480ac={'count':0x0,'rows':[]};var _0x581aef=_[_0xcf8d('0x3d')](db[_0xcf8d('0x3e')][_0xcf8d('0x3f')],function(_0x41aeab){return{'name':_0x41aeab[_0xcf8d('0x40')],'type':_0x41aeab[_0xcf8d('0x41')]['key']};});_0x13127b[_0xcf8d('0x42')]=_[_0xcf8d('0x3d')](_0x581aef,'name');_0x13127b[_0xcf8d('0x43')]=_[_0xcf8d('0x44')](_0x2d2dba[_0xcf8d('0x43')]);_0x13127b[_0xcf8d('0x45')]=_['intersection'](_0x13127b['model'],_0x13127b[_0xcf8d('0x43')]);_0x430ba5[_0xcf8d('0x46')]=_[_0xcf8d('0x47')](_0x13127b[_0xcf8d('0x42')],qs['fields'](_0x2d2dba[_0xcf8d('0x43')][_0xcf8d('0x48')]));_0x430ba5[_0xcf8d('0x46')]=_0x430ba5[_0xcf8d('0x46')][_0xcf8d('0x49')]?_0x430ba5[_0xcf8d('0x46')]:_0x13127b[_0xcf8d('0x42')];if(!_0x2d2dba[_0xcf8d('0x43')][_0xcf8d('0x4a')](_0xcf8d('0x4b'))){_0x430ba5['limit']=qs[_0xcf8d('0x33')](_0x2d2dba[_0xcf8d('0x43')][_0xcf8d('0x33')]);_0x430ba5[_0xcf8d('0x31')]=qs['offset'](_0x2d2dba['query'][_0xcf8d('0x31')]);}_0x430ba5[_0xcf8d('0x4c')]=qs[_0xcf8d('0x4d')](_0x2d2dba[_0xcf8d('0x43')]['sort']);_0x430ba5[_0xcf8d('0x4e')]=qs['filters'](_[_0xcf8d('0x4f')](_0x2d2dba[_0xcf8d('0x43')],_0x13127b[_0xcf8d('0x45')]),_0x581aef);if(_0x2d2dba[_0xcf8d('0x43')][_0xcf8d('0x50')]){_0x430ba5[_0xcf8d('0x4e')]=_['merge'](_0x430ba5[_0xcf8d('0x4e')],{'$or':_[_0xcf8d('0x3d')](_0x581aef,function(_0x100316){if(_0x100316[_0xcf8d('0x41')]!=='VIRTUAL'){var _0x5727fb={};_0x5727fb[_0x100316['name']]={'$like':'%'+_0x2d2dba[_0xcf8d('0x43')]['filter']+'%'};return _0x5727fb;}})});}_0x430ba5=_[_0xcf8d('0x51')]({},_0x430ba5,_0x2d2dba[_0xcf8d('0x52')]);var _0x3a5ace={'where':_0x430ba5[_0xcf8d('0x4e')]};return db['FaxMessage'][_0xcf8d('0x32')](_0x3a5ace)[_0xcf8d('0x37')](function(_0x3f6942){_0xa480ac[_0xcf8d('0x32')]=_0x3f6942;if(_0x2d2dba['query'][_0xcf8d('0x53')]){_0x430ba5[_0xcf8d('0x54')]=[{'all':!![]}];}return db['FaxMessage'][_0xcf8d('0x55')](_0x430ba5);})[_0xcf8d('0x37')](function(_0x787e0e){_0xa480ac[_0xcf8d('0x56')]=_0x787e0e;return _0xa480ac;})[_0xcf8d('0x37')](respondWithFilteredResult(_0x54bb37,_0x430ba5))['catch'](handleError(_0x54bb37,null));};exports[_0xcf8d('0x57')]=function(_0x17998d,_0x170904){var _0x24abe8={'raw':!![],'where':{'id':_0x17998d[_0xcf8d('0x58')]['id']}},_0x35ae78={};_0x35ae78['model']=_[_0xcf8d('0x44')](db[_0xcf8d('0x3e')][_0xcf8d('0x3f')]);_0x35ae78[_0xcf8d('0x43')]=_[_0xcf8d('0x44')](_0x17998d['query']);_0x35ae78['filters']=_[_0xcf8d('0x47')](_0x35ae78[_0xcf8d('0x42')],_0x35ae78['query']);_0x24abe8[_0xcf8d('0x46')]=_[_0xcf8d('0x47')](_0x35ae78['model'],qs[_0xcf8d('0x48')](_0x17998d[_0xcf8d('0x43')][_0xcf8d('0x48')]));_0x24abe8[_0xcf8d('0x46')]=_0x24abe8['attributes'][_0xcf8d('0x49')]?_0x24abe8[_0xcf8d('0x46')]:_0x35ae78[_0xcf8d('0x42')];if(_0x17998d['query']['includeAll']){_0x24abe8['include']=[{'all':!![]}];}_0x24abe8=_[_0xcf8d('0x51')]({},_0x24abe8,_0x17998d[_0xcf8d('0x52')]);return db[_0xcf8d('0x3e')][_0xcf8d('0x59')](_0x24abe8)['then'](handleEntityNotFound(_0x170904,null))[_0xcf8d('0x37')](respondWithResult(_0x170904,null))[_0xcf8d('0x2b')](handleError(_0x170904,null));};exports[_0xcf8d('0x36')]=function(_0x4df5cf,_0x157247){if(_0x4df5cf[_0xcf8d('0x5a')]['id']){delete _0x4df5cf[_0xcf8d('0x5a')]['id'];}return db[_0xcf8d('0x3e')][_0xcf8d('0x59')]({'where':{'id':_0x4df5cf['params']['id']}})[_0xcf8d('0x37')](handleEntityNotFound(_0x157247,null))[_0xcf8d('0x37')](saveUpdates(_0x4df5cf[_0xcf8d('0x5a')],null))['then'](respondWithResult(_0x157247,null))[_0xcf8d('0x2b')](handleError(_0x157247,null));};exports['destroy']=function(_0x166ce3,_0x3b714e){return db['FaxMessage']['find']({'where':{'id':_0x166ce3[_0xcf8d('0x58')]['id']}})[_0xcf8d('0x37')](handleEntityNotFound(_0x3b714e,null))[_0xcf8d('0x37')](removeEntity(_0x3b714e,null))[_0xcf8d('0x2b')](handleError(_0x3b714e,null));};exports[_0xcf8d('0x5b')]=function(_0x35b889,_0x1898db){return db[_0xcf8d('0x3e')]['describe']()[_0xcf8d('0x37')](respondWithResult(_0x1898db,null))['catch'](handleError(_0x1898db,null));};var interaction_log=require(_0xcf8d('0x15'))(_0xcf8d('0x5c'));exports['accept']=function(_0x2ca0a3,_0x1482d1,_0xa21436){var _0x449972={'agent':{},'channel':_0xcf8d('0x5d')};if(_0x2ca0a3[_0xcf8d('0x5a')]['id']){delete _0x2ca0a3[_0xcf8d('0x5a')]['id'];}_0x2ca0a3['body']['read']=!![];_0x2ca0a3[_0xcf8d('0x5a')][_0xcf8d('0x5e')]=moment()[_0xcf8d('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x2ca0a3['body'][_0xcf8d('0x60')]=_0x2ca0a3[_0xcf8d('0x5a')][_0xcf8d('0x60')]||_0x2ca0a3['user']['id'];_0x449972['agent']['id']=_0x2ca0a3[_0xcf8d('0x5a')][_0xcf8d('0x60')];return db[_0xcf8d('0x3e')][_0xcf8d('0x59')]({'where':{'id':_0x2ca0a3[_0xcf8d('0x58')]['id'],'UserId':null}})[_0xcf8d('0x37')](handleEntityNotFound(_0x1482d1,null))['then'](saveUpdates(_0x2ca0a3[_0xcf8d('0x5a')],null))[_0xcf8d('0x37')](function(_0x289a3f){if(_0x289a3f){_0x449972[_0xcf8d('0x2a')]=_0x289a3f[_0xcf8d('0x61')]({'plain':!![]});return db[_0xcf8d('0x62')][_0xcf8d('0x59')]({'where':{'id':_0x289a3f[_0xcf8d('0x63')]}});}return null;})[_0xcf8d('0x37')](handleEntityNotFound(_0x1482d1,null))[_0xcf8d('0x37')](function(_0x3f09ee){if(_0x3f09ee){return _0x3f09ee[_0xcf8d('0x36')]({'UserId':_0x2ca0a3[_0xcf8d('0x5a')]['UserId'],'read1stAt':_['isNil'](_0x3f09ee[_0xcf8d('0x64')])?moment()[_0xcf8d('0x5f')](_0xcf8d('0x65')):undefined});}return null;})[_0xcf8d('0x37')](function(_0x48db42){if(_0x48db42){_0x449972['interaction']=_0x48db42[_0xcf8d('0x61')]({'plain':!![]});interaction_log[_0xcf8d('0x22')](_0xcf8d('0x66'),_0x2ca0a3[_0xcf8d('0x67')]['id'],_0x2ca0a3[_0xcf8d('0x67')][_0xcf8d('0x3a')],_0x2ca0a3[_0xcf8d('0x67')][_0xcf8d('0x68')],_0x449972[_0xcf8d('0x69')]['id'],_0x2ca0a3['body']?JSON[_0xcf8d('0x27')](_0x2ca0a3[_0xcf8d('0x5a')]):'null');return respondWithRpcPromise(_0xcf8d('0x6a'),'acceptMessage',_0x449972);}return null;})['then'](function(_0x3f47b6){var _0xe4946b='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3f47b6[_0xcf8d('0x2a')][_0xcf8d('0x6b')];return db[_0xcf8d('0x6c')][_0xcf8d('0x43')](_0xe4946b,{'type':db['Sequelize'][_0xcf8d('0x6d')][_0xcf8d('0x6e')],'raw':!![]})[_0xcf8d('0x37')](function(_0x519a68){return _0x519a68;});})[_0xcf8d('0x37')](function(_0x51fe54){if(_0x51fe54){_0x449972[_0xcf8d('0x2a')]['contact']=_0x51fe54[0x0];if(!_0x2ca0a3[_0xcf8d('0x5a')]['UserId'])return;return db[_0xcf8d('0x6f')][_0xcf8d('0x59')]({'where':{'id':_0x2ca0a3[_0xcf8d('0x5a')][_0xcf8d('0x60')],'role':_0xcf8d('0x70')},'attributes':['id',_0xcf8d('0x3a'),_0xcf8d('0x71'),'email',_0xcf8d('0x72')],'raw':!![]});}return null;})[_0xcf8d('0x37')](function(_0x18fdde){if(!_0x18fdde)return null;_0x449972['message']['agent']=_0x18fdde;return _0x449972;})[_0xcf8d('0x37')](function(_0x371095){if(_0x371095){if(_0x2ca0a3['body'][_0xcf8d('0x73')]){_0x449972[_0xcf8d('0x2a')][_0xcf8d('0x74')]=util[_0xcf8d('0x5f')](_0xcf8d('0x75'),_0x2ca0a3[_0xcf8d('0x67')][_0xcf8d('0x3a')]);_0x449972[_0xcf8d('0x2a')][_0xcf8d('0x76')]=_0x449972[_0xcf8d('0x76')];_0x449972[_0xcf8d('0x2a')][_0xcf8d('0x77')]=_0x449972[_0xcf8d('0x76')];_0x449972['message']['event']=_0xcf8d('0x78');return respondWithRpcPromise(_0xcf8d('0x79'),_0xcf8d('0x79'),{'event':_0xcf8d('0x7a'),'message':_0x449972[_0xcf8d('0x2a')]},client9002)[_0xcf8d('0x37')](function(){return _0x449972;});}return _0x449972;}return null;})[_0xcf8d('0x37')](respondWithResult(_0x1482d1,null))[_0xcf8d('0x2b')](handleError(_0x1482d1,null));};var interaction_log=require(_0xcf8d('0x15'))('fax-interactions');exports[_0xcf8d('0x35')]=function(_0x50ac68,_0x4fbe46,_0x31e0ec){var _0x187f13={'agent':{},'channel':_0xcf8d('0x5d')};if(_0x50ac68[_0xcf8d('0x5a')]['id']){delete _0x50ac68['body']['id'];}_0x50ac68[_0xcf8d('0x5a')][_0xcf8d('0x60')]=_0x50ac68[_0xcf8d('0x5a')][_0xcf8d('0x60')]||_0x50ac68['user']['id'];_0x187f13[_0xcf8d('0x70')]['id']=_0x50ac68[_0xcf8d('0x5a')][_0xcf8d('0x60')];return db[_0xcf8d('0x3e')][_0xcf8d('0x59')]({'where':{'id':_0x50ac68[_0xcf8d('0x58')]['id'],'UserId':null}})[_0xcf8d('0x37')](handleEntityNotFound(_0x4fbe46,null))[_0xcf8d('0x37')](function(_0x6f9ff2){if(_0x6f9ff2){_0x187f13[_0xcf8d('0x2a')]=_0x6f9ff2[_0xcf8d('0x61')]({'plain':!![]});return db[_0xcf8d('0x62')][_0xcf8d('0x59')]({'where':{'id':_0x6f9ff2['FaxInteractionId']}});}return null;})[_0xcf8d('0x37')](handleEntityNotFound(_0x4fbe46,null))['then'](function(_0x1b1fe6){if(_0x1b1fe6){_0x187f13[_0xcf8d('0x69')]=_0x1b1fe6[_0xcf8d('0x61')]({'plain':!![]});interaction_log[_0xcf8d('0x22')](_0xcf8d('0x7b'),_0x50ac68[_0xcf8d('0x67')]['id'],_0x50ac68[_0xcf8d('0x67')][_0xcf8d('0x3a')],_0x50ac68[_0xcf8d('0x67')][_0xcf8d('0x68')],_0x187f13[_0xcf8d('0x69')]['id'],_0x50ac68['body']?JSON[_0xcf8d('0x27')](_0x50ac68['body']):_0xcf8d('0x7c'));return respondWithRpcPromise(_0xcf8d('0x7d'),_0xcf8d('0x7e'),_0x187f13);}return null;})[_0xcf8d('0x37')](function(_0x5c6dd5){var _0x3cb2b9=_0xcf8d('0x7f')+_0x5c6dd5['message'][_0xcf8d('0x6b')];return db[_0xcf8d('0x6c')]['query'](_0x3cb2b9,{'type':db['Sequelize'][_0xcf8d('0x6d')]['SELECT'],'raw':!![]})[_0xcf8d('0x37')](function(_0x29f4f5){return _0x29f4f5;});})[_0xcf8d('0x37')](function(_0x256e42){if(_0x256e42){_0x187f13[_0xcf8d('0x2a')]['contact']=_0x256e42[0x0];if(!_0x50ac68[_0xcf8d('0x5a')]['UserId'])return;return db[_0xcf8d('0x6f')]['find']({'where':{'id':_0x50ac68[_0xcf8d('0x5a')][_0xcf8d('0x60')],'role':_0xcf8d('0x70')},'attributes':['id','name',_0xcf8d('0x71'),_0xcf8d('0x80'),_0xcf8d('0x72')],'raw':!![]});}return null;})['then'](function(_0xf9e14c){if(!_0xf9e14c)return null;_0x187f13[_0xcf8d('0x2a')]['agent']=_0xf9e14c;return _0x187f13;})['then'](function(_0x265eb4){if(_0x265eb4){_0x265eb4['message'][_0xcf8d('0x74')]=util['format'](_0xcf8d('0x75'),_0x50ac68[_0xcf8d('0x67')][_0xcf8d('0x3a')]);_0x265eb4['message'][_0xcf8d('0x76')]=_0x187f13[_0xcf8d('0x76')];_0x265eb4[_0xcf8d('0x2a')][_0xcf8d('0x77')]=_0x187f13[_0xcf8d('0x76')];_0x265eb4[_0xcf8d('0x2a')][_0xcf8d('0x81')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0xcf8d('0x82'),'message':_0x265eb4['message']},client9002);return _0x187f13;}return null;})['then'](respondWithResult(_0x4fbe46,null))[_0xcf8d('0x2b')](handleError(_0x4fbe46,null));};exports[_0xcf8d('0x83')]=function(_0x21a004,_0x12f1c5){var _0x30e37e;return db['FaxMessage']['create'](_0x21a004[_0xcf8d('0x5a')],{})[_0xcf8d('0x37')](function(_0x230225){_0x30e37e=_0x230225;return db[_0xcf8d('0x84')][_0xcf8d('0x85')]({'where':{'id':_0x30e37e[_0xcf8d('0x6b')]}});})['then'](function(_0x434280){if(_[_0xcf8d('0x86')](_0x434280)){return;}else{_0x30e37e[_0xcf8d('0x5d')]=_0x434280[_0xcf8d('0x5d')];return db[_0xcf8d('0x87')]['findOne']({'where':{'id':_0x30e37e[_0xcf8d('0x88')]}});}})[_0xcf8d('0x37')](function(_0x1e3d8d){return respondWithRpcPromise('SendFax',_0xcf8d('0x89'),{'FaxAccountId':_[_0xcf8d('0x86')](_0x21a004[_0xcf8d('0x5a')])?undefined:_0x21a004[_0xcf8d('0x5a')][_0xcf8d('0x8a')],'path':_[_0xcf8d('0x86')](_0x1e3d8d)?undefined:util[_0xcf8d('0x5f')](_0xcf8d('0x8b'),_0x1e3d8d['basename']),'fax':_['isNil'](_0x30e37e[_0xcf8d('0x5d')])?undefined:_0x30e37e[_0xcf8d('0x5d')],'AttachmentId':_0x30e37e[_0xcf8d('0x88')]},client9002);})[_0xcf8d('0x37')](respondWithResult(_0x12f1c5,0xc9))[_0xcf8d('0x2b')](handleError(_0x12f1c5,null));};exports['download']=function(_0x4c4c71,_0x2998dd){var _0x201755=path[_0xcf8d('0x8c')](config['root'],_0xcf8d('0x8d'),'files',_0xcf8d('0x8e'));return db[_0xcf8d('0x3e')]['find']({'where':{'id':_0x4c4c71[_0xcf8d('0x58')]['id']},'include':[{'model':db['Attachment'],'as':_0xcf8d('0x87')}]})[_0xcf8d('0x37')](handleEntityNotFound(_0x2998dd,null))[_0xcf8d('0x37')](function(_0x4e2184){if(_0x4e2184){return _0x2998dd[_0xcf8d('0x8f')](path[_0xcf8d('0x8c')](_0x201755,_0x4e2184[_0xcf8d('0x87')][_0xcf8d('0x90')]));}})[_0xcf8d('0x2b')](handleError(_0x2998dd,null));}; \ No newline at end of file +var _0x6a95=['channel','motionChannel','acceptmessage','reject','agent','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','event','EventManager','rejectmessage','findOne','Attachment','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','download','root','server','files','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','jayson/promise','http','client','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','error','message','result','catch','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','destroy','then','sendStatus','stack','send','index','map','fieldName','type','key','model','name','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','FaxMessage','includeAll','include','rows','params','rawAttributes','filters','find','body','describe','fax-interactions','accept','fax','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteraction','FaxInteractionId','isNil','format','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','interface','SIP/%s'];(function(_0x385c3f,_0x2c7062){var _0x2e17c3=function(_0x3c62d7){while(--_0x3c62d7){_0x385c3f['push'](_0x385c3f['shift']());}};_0x2e17c3(++_0x2c7062);}(_0x6a95,0x1ce));var _0x56a9=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6a95[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x56a9('0x0'));var zipdir=require(_0x56a9('0x1'));var jsonpatch=require(_0x56a9('0x2'));var rp=require(_0x56a9('0x3'));var moment=require(_0x56a9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x56a9('0x5'));var util=require(_0x56a9('0x6'));var path=require(_0x56a9('0x7'));var sox=require(_0x56a9('0x8'));var csv=require(_0x56a9('0x9'));var ejs=require(_0x56a9('0xa'));var fs=require('fs');var fs_extra=require(_0x56a9('0xb'));var _=require(_0x56a9('0xc'));var squel=require(_0x56a9('0xd'));var crypto=require(_0x56a9('0xe'));var jsforce=require(_0x56a9('0xf'));var deskjs=require(_0x56a9('0x10'));var toCsv=require('to-csv');var querystring=require(_0x56a9('0x11'));var Papa=require(_0x56a9('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x56a9('0x13'));var as=require(_0x56a9('0x14'));var hardwareService=require(_0x56a9('0x15'));var logger=require(_0x56a9('0x16'))(_0x56a9('0x17'));var utils=require(_0x56a9('0x18'));var config=require(_0x56a9('0x19'));var licenseUtil=require(_0x56a9('0x1a'));var db=require(_0x56a9('0x1b'))['db'];config[_0x56a9('0x1c')]=_[_0x56a9('0x1d')](config[_0x56a9('0x1c')],{'host':_0x56a9('0x1e'),'port':0x18eb});var socket=require(_0x56a9('0x1f'))(new Redis(config[_0x56a9('0x1c')]));require(_0x56a9('0x20'))['register'](socket);var jayson=require(_0x56a9('0x21'));var client=jayson['client'][_0x56a9('0x22')]({'port':0x232c});var client9002=jayson[_0x56a9('0x23')][_0x56a9('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x5d7cb1,_0x9ad7d9,_0x7bd4eb,_0x126ac5){return new BPromise(function(_0x3113f0,_0xbba35b){var _0x17550d=_0x126ac5||client;return _0x17550d[_0x56a9('0x24')](_0x5d7cb1,_0x7bd4eb)['then'](function(_0x3ffcec){logger[_0x56a9('0x25')](_0x56a9('0x26'),_0x9ad7d9,_0x56a9('0x27'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x9ad7d9,_0x56a9('0x27'),JSON['stringify'](_0x3ffcec));if(_0x3ffcec['error']){if(_0x3ffcec[_0x56a9('0x28')]['code']===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x9ad7d9,_0x3ffcec[_0x56a9('0x28')][_0x56a9('0x29')]);return _0xbba35b(_0x3ffcec[_0x56a9('0x28')][_0x56a9('0x29')]);}logger[_0x56a9('0x28')](_0x56a9('0x26'),_0x9ad7d9,_0x3ffcec['error']['message']);return _0x3113f0(_0x3ffcec[_0x56a9('0x28')][_0x56a9('0x29')]);}else{logger[_0x56a9('0x25')](_0x56a9('0x26'),_0x9ad7d9,_0x56a9('0x27'));_0x3113f0(_0x3ffcec[_0x56a9('0x2a')][_0x56a9('0x29')]);}})[_0x56a9('0x2b')](function(_0x4df8c9){logger[_0x56a9('0x28')]('FaxMessage,\x20%s,\x20%s',_0x9ad7d9,_0x4df8c9);_0xbba35b(_0x4df8c9);});});}function respondWithStatusCode(_0x2e8da7,_0x54a91b){_0x54a91b=_0x54a91b||0xcc;return function(_0x50c2c3){if(_0x50c2c3){return _0x2e8da7['sendStatus'](_0x54a91b);}return _0x2e8da7[_0x56a9('0x2c')](_0x54a91b)[_0x56a9('0x2d')]();};}function respondWithResult(_0x374de2,_0x3bf702){_0x3bf702=_0x3bf702||0xc8;return function(_0x55b98c){if(_0x55b98c){return _0x374de2['status'](_0x3bf702)[_0x56a9('0x2e')](_0x55b98c);}};}function respondWithFilteredResult(_0x28a95f,_0x2f95e6){return function(_0x2182fb){if(_0x2182fb){var _0x4c73b8=typeof _0x2f95e6['offset']===_0x56a9('0x2f')&&typeof _0x2f95e6[_0x56a9('0x30')]===_0x56a9('0x2f');var _0x11a140=_0x2182fb[_0x56a9('0x31')];var _0x21d37e=_0x4c73b8?0x0:_0x2f95e6[_0x56a9('0x32')];var _0x11fb89=_0x4c73b8?_0x2182fb[_0x56a9('0x31')]:_0x2f95e6[_0x56a9('0x32')]+_0x2f95e6[_0x56a9('0x30')];var _0x583bff;if(_0x11fb89>=_0x11a140){_0x11fb89=_0x11a140;_0x583bff=0xc8;}else{_0x583bff=0xce;}_0x28a95f[_0x56a9('0x2c')](_0x583bff);return _0x28a95f[_0x56a9('0x33')](_0x56a9('0x34'),_0x21d37e+'-'+_0x11fb89+'/'+_0x11a140)[_0x56a9('0x2e')](_0x2182fb);}return null;};}function patchUpdates(_0xdb792f){return function(_0x30a0b3){try{jsonpatch['apply'](_0x30a0b3,_0xdb792f,!![]);}catch(_0x4eb9d5){return BPromise['reject'](_0x4eb9d5);}return _0x30a0b3[_0x56a9('0x35')]();};}function saveUpdates(_0xb9236d,_0x375f97){return function(_0x16e138){if(_0x16e138){return _0x16e138[_0x56a9('0x36')](_0xb9236d)['then'](function(_0x8e7a24){return _0x8e7a24;});}return null;};}function removeEntity(_0x5be5ac,_0x4ff94f){return function(_0x5aa9fd){if(_0x5aa9fd){return _0x5aa9fd[_0x56a9('0x37')]()[_0x56a9('0x38')](function(){_0x5be5ac['status'](0xcc)[_0x56a9('0x2d')]();});}};}function handleEntityNotFound(_0x383798,_0x5ea1b6){return function(_0x218fef){if(!_0x218fef){_0x383798[_0x56a9('0x39')](0x194);}return _0x218fef;};}function handleError(_0x3af101,_0x5a568b){_0x5a568b=_0x5a568b||0x1f4;return function(_0x22ba75){logger['error'](_0x22ba75[_0x56a9('0x3a')]);if(_0x22ba75['name']){delete _0x22ba75['name'];}_0x3af101[_0x56a9('0x2c')](_0x5a568b)[_0x56a9('0x3b')](_0x22ba75);};}exports[_0x56a9('0x3c')]=function(_0xa243d5,_0x3ba3b6){var _0x381b2f={},_0x4bf29a={},_0x2f45db={'count':0x0,'rows':[]};var _0x7af815=_[_0x56a9('0x3d')](db['FaxMessage']['rawAttributes'],function(_0x76f688){return{'name':_0x76f688[_0x56a9('0x3e')],'type':_0x76f688[_0x56a9('0x3f')][_0x56a9('0x40')]};});_0x4bf29a[_0x56a9('0x41')]=_['map'](_0x7af815,_0x56a9('0x42'));_0x4bf29a['query']=_[_0x56a9('0x43')](_0xa243d5[_0x56a9('0x44')]);_0x4bf29a['filters']=_['intersection'](_0x4bf29a[_0x56a9('0x41')],_0x4bf29a[_0x56a9('0x44')]);_0x381b2f['attributes']=_[_0x56a9('0x45')](_0x4bf29a[_0x56a9('0x41')],qs[_0x56a9('0x46')](_0xa243d5[_0x56a9('0x44')][_0x56a9('0x46')]));_0x381b2f['attributes']=_0x381b2f[_0x56a9('0x47')][_0x56a9('0x48')]?_0x381b2f[_0x56a9('0x47')]:_0x4bf29a['model'];if(!_0xa243d5['query'][_0x56a9('0x49')](_0x56a9('0x4a'))){_0x381b2f[_0x56a9('0x30')]=qs[_0x56a9('0x30')](_0xa243d5[_0x56a9('0x44')][_0x56a9('0x30')]);_0x381b2f[_0x56a9('0x32')]=qs[_0x56a9('0x32')](_0xa243d5[_0x56a9('0x44')]['offset']);}_0x381b2f[_0x56a9('0x4b')]=qs[_0x56a9('0x4c')](_0xa243d5[_0x56a9('0x44')][_0x56a9('0x4c')]);_0x381b2f['where']=qs['filters'](_[_0x56a9('0x4d')](_0xa243d5['query'],_0x4bf29a['filters']),_0x7af815);if(_0xa243d5[_0x56a9('0x44')]['filter']){_0x381b2f[_0x56a9('0x4e')]=_['merge'](_0x381b2f[_0x56a9('0x4e')],{'$or':_[_0x56a9('0x3d')](_0x7af815,function(_0x30e6f4){if(_0x30e6f4[_0x56a9('0x3f')]!==_0x56a9('0x4f')){var _0x84e44f={};_0x84e44f[_0x30e6f4['name']]={'$like':'%'+_0xa243d5[_0x56a9('0x44')][_0x56a9('0x50')]+'%'};return _0x84e44f;}})});}_0x381b2f=_[_0x56a9('0x51')]({},_0x381b2f,_0xa243d5[_0x56a9('0x52')]);var _0x282cd1={'where':_0x381b2f[_0x56a9('0x4e')]};return db[_0x56a9('0x53')][_0x56a9('0x31')](_0x282cd1)[_0x56a9('0x38')](function(_0x225df2){_0x2f45db[_0x56a9('0x31')]=_0x225df2;if(_0xa243d5[_0x56a9('0x44')][_0x56a9('0x54')]){_0x381b2f[_0x56a9('0x55')]=[{'all':!![]}];}return db[_0x56a9('0x53')]['findAll'](_0x381b2f);})[_0x56a9('0x38')](function(_0x12887e){_0x2f45db[_0x56a9('0x56')]=_0x12887e;return _0x2f45db;})[_0x56a9('0x38')](respondWithFilteredResult(_0x3ba3b6,_0x381b2f))[_0x56a9('0x2b')](handleError(_0x3ba3b6,null));};exports['show']=function(_0x11348e,_0x308a68){var _0x34708b={'raw':!![],'where':{'id':_0x11348e[_0x56a9('0x57')]['id']}},_0x4fd616={};_0x4fd616[_0x56a9('0x41')]=_['keys'](db[_0x56a9('0x53')][_0x56a9('0x58')]);_0x4fd616[_0x56a9('0x44')]=_[_0x56a9('0x43')](_0x11348e[_0x56a9('0x44')]);_0x4fd616[_0x56a9('0x59')]=_[_0x56a9('0x45')](_0x4fd616[_0x56a9('0x41')],_0x4fd616[_0x56a9('0x44')]);_0x34708b[_0x56a9('0x47')]=_[_0x56a9('0x45')](_0x4fd616[_0x56a9('0x41')],qs[_0x56a9('0x46')](_0x11348e[_0x56a9('0x44')][_0x56a9('0x46')]));_0x34708b['attributes']=_0x34708b[_0x56a9('0x47')][_0x56a9('0x48')]?_0x34708b['attributes']:_0x4fd616[_0x56a9('0x41')];if(_0x11348e[_0x56a9('0x44')][_0x56a9('0x54')]){_0x34708b['include']=[{'all':!![]}];}_0x34708b=_[_0x56a9('0x51')]({},_0x34708b,_0x11348e[_0x56a9('0x52')]);return db[_0x56a9('0x53')][_0x56a9('0x5a')](_0x34708b)[_0x56a9('0x38')](handleEntityNotFound(_0x308a68,null))[_0x56a9('0x38')](respondWithResult(_0x308a68,null))['catch'](handleError(_0x308a68,null));};exports[_0x56a9('0x36')]=function(_0x3df629,_0xd53179){if(_0x3df629[_0x56a9('0x5b')]['id']){delete _0x3df629[_0x56a9('0x5b')]['id'];}return db['FaxMessage'][_0x56a9('0x5a')]({'where':{'id':_0x3df629[_0x56a9('0x57')]['id']}})[_0x56a9('0x38')](handleEntityNotFound(_0xd53179,null))[_0x56a9('0x38')](saveUpdates(_0x3df629[_0x56a9('0x5b')],null))[_0x56a9('0x38')](respondWithResult(_0xd53179,null))[_0x56a9('0x2b')](handleError(_0xd53179,null));};exports[_0x56a9('0x37')]=function(_0x5b6a84,_0x2000f9){return db[_0x56a9('0x53')][_0x56a9('0x5a')]({'where':{'id':_0x5b6a84[_0x56a9('0x57')]['id']}})[_0x56a9('0x38')](handleEntityNotFound(_0x2000f9,null))[_0x56a9('0x38')](removeEntity(_0x2000f9,null))[_0x56a9('0x2b')](handleError(_0x2000f9,null));};exports['describe']=function(_0x8f4aed,_0x34b32a){return db[_0x56a9('0x53')][_0x56a9('0x5c')]()[_0x56a9('0x38')](respondWithResult(_0x34b32a,null))['catch'](handleError(_0x34b32a,null));};var interaction_log=require(_0x56a9('0x16'))(_0x56a9('0x5d'));exports[_0x56a9('0x5e')]=function(_0x53646f,_0x59ec4b,_0x68bd0f){var _0x2ce9d8={'agent':{},'channel':_0x56a9('0x5f')};if(_0x53646f[_0x56a9('0x5b')]['id']){delete _0x53646f[_0x56a9('0x5b')]['id'];}_0x53646f['body'][_0x56a9('0x60')]=!![];_0x53646f['body'][_0x56a9('0x61')]=moment()['format'](_0x56a9('0x62'));_0x53646f[_0x56a9('0x5b')][_0x56a9('0x63')]=_0x53646f[_0x56a9('0x5b')][_0x56a9('0x63')]||_0x53646f[_0x56a9('0x64')]['id'];_0x2ce9d8['agent']['id']=_0x53646f[_0x56a9('0x5b')][_0x56a9('0x63')];return db['FaxMessage'][_0x56a9('0x5a')]({'where':{'id':_0x53646f[_0x56a9('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x59ec4b,null))[_0x56a9('0x38')](saveUpdates(_0x53646f[_0x56a9('0x5b')],null))['then'](function(_0x15bb02){if(_0x15bb02){_0x2ce9d8['message']=_0x15bb02[_0x56a9('0x65')]({'plain':!![]});return db[_0x56a9('0x66')]['find']({'where':{'id':_0x15bb02[_0x56a9('0x67')]}});}return null;})[_0x56a9('0x38')](handleEntityNotFound(_0x59ec4b,null))[_0x56a9('0x38')](function(_0x3d21ba){if(_0x3d21ba){return _0x3d21ba[_0x56a9('0x36')]({'UserId':_0x53646f[_0x56a9('0x5b')][_0x56a9('0x63')],'read1stAt':_[_0x56a9('0x68')](_0x3d21ba['read1stAt'])?moment()[_0x56a9('0x69')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x56a9('0x38')](function(_0x491f34){if(_0x491f34){_0x2ce9d8['interaction']=_0x491f34['get']({'plain':!![]});interaction_log[_0x56a9('0x25')](_0x56a9('0x6a'),_0x53646f[_0x56a9('0x64')]['id'],_0x53646f[_0x56a9('0x64')][_0x56a9('0x42')],_0x53646f[_0x56a9('0x64')][_0x56a9('0x6b')],_0x2ce9d8[_0x56a9('0x6c')]['id'],_0x53646f[_0x56a9('0x5b')]?JSON['stringify'](_0x53646f[_0x56a9('0x5b')]):_0x56a9('0x6d'));return respondWithRpcPromise('AcceptMessage',_0x56a9('0x6e'),_0x2ce9d8);}return null;})[_0x56a9('0x38')](function(_0x37b36b){var _0x522091='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x37b36b['message'][_0x56a9('0x6f')];return db['sequelize'][_0x56a9('0x44')](_0x522091,{'type':db[_0x56a9('0x70')][_0x56a9('0x71')][_0x56a9('0x72')],'raw':!![]})[_0x56a9('0x38')](function(_0x3d9c08){return _0x3d9c08;});})[_0x56a9('0x38')](function(_0x17e10e){if(_0x17e10e){_0x2ce9d8[_0x56a9('0x29')][_0x56a9('0x73')]=_0x17e10e[0x0];if(!_0x53646f[_0x56a9('0x5b')][_0x56a9('0x63')])return;return db[_0x56a9('0x74')][_0x56a9('0x5a')]({'where':{'id':_0x53646f['body'][_0x56a9('0x63')],'role':'agent'},'attributes':['id','name','fullname',_0x56a9('0x75'),_0x56a9('0x76')],'raw':!![]});}return null;})['then'](function(_0x1a9fc9){if(!_0x1a9fc9)return null;_0x2ce9d8[_0x56a9('0x29')]['agent']=_0x1a9fc9;return _0x2ce9d8;})[_0x56a9('0x38')](function(_0xcad2f1){if(_0xcad2f1){if(_0x53646f[_0x56a9('0x5b')][_0x56a9('0x77')]){_0x2ce9d8[_0x56a9('0x29')][_0x56a9('0x78')]=util[_0x56a9('0x69')](_0x56a9('0x79'),_0x53646f[_0x56a9('0x64')][_0x56a9('0x42')]);_0x2ce9d8['message'][_0x56a9('0x7a')]=_0x2ce9d8['channel'];_0x2ce9d8['message'][_0x56a9('0x7b')]=_0x2ce9d8[_0x56a9('0x7a')];_0x2ce9d8['message']['event']=_0x56a9('0x5e');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x56a9('0x7c'),'message':_0x2ce9d8[_0x56a9('0x29')]},client9002)[_0x56a9('0x38')](function(){return _0x2ce9d8;});}return _0x2ce9d8;}return null;})['then'](respondWithResult(_0x59ec4b,null))[_0x56a9('0x2b')](handleError(_0x59ec4b,null));};var interaction_log=require(_0x56a9('0x16'))(_0x56a9('0x5d'));exports[_0x56a9('0x7d')]=function(_0x11776f,_0x507daf,_0x1a8198){var _0x1d07b1={'agent':{},'channel':_0x56a9('0x5f')};if(_0x11776f[_0x56a9('0x5b')]['id']){delete _0x11776f['body']['id'];}_0x11776f[_0x56a9('0x5b')][_0x56a9('0x63')]=_0x11776f[_0x56a9('0x5b')]['UserId']||_0x11776f['user']['id'];_0x1d07b1[_0x56a9('0x7e')]['id']=_0x11776f[_0x56a9('0x5b')][_0x56a9('0x63')];return db[_0x56a9('0x53')][_0x56a9('0x5a')]({'where':{'id':_0x11776f['params']['id'],'UserId':null}})[_0x56a9('0x38')](handleEntityNotFound(_0x507daf,null))[_0x56a9('0x38')](function(_0x23d0fc){if(_0x23d0fc){_0x1d07b1[_0x56a9('0x29')]=_0x23d0fc['get']({'plain':!![]});return db[_0x56a9('0x66')][_0x56a9('0x5a')]({'where':{'id':_0x23d0fc['FaxInteractionId']}});}return null;})[_0x56a9('0x38')](handleEntityNotFound(_0x507daf,null))[_0x56a9('0x38')](function(_0x38901d){if(_0x38901d){_0x1d07b1[_0x56a9('0x6c')]=_0x38901d[_0x56a9('0x65')]({'plain':!![]});interaction_log['info'](_0x56a9('0x7f'),_0x11776f[_0x56a9('0x64')]['id'],_0x11776f[_0x56a9('0x64')][_0x56a9('0x42')],_0x11776f[_0x56a9('0x64')][_0x56a9('0x6b')],_0x1d07b1[_0x56a9('0x6c')]['id'],_0x11776f[_0x56a9('0x5b')]?JSON[_0x56a9('0x80')](_0x11776f[_0x56a9('0x5b')]):_0x56a9('0x6d'));return respondWithRpcPromise(_0x56a9('0x81'),_0x56a9('0x82'),_0x1d07b1);}return null;})['then'](function(_0x2faf0c){var _0x45a682=_0x56a9('0x83')+_0x2faf0c[_0x56a9('0x29')][_0x56a9('0x6f')];return db[_0x56a9('0x84')]['query'](_0x45a682,{'type':db[_0x56a9('0x70')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x327d3d){return _0x327d3d;});})[_0x56a9('0x38')](function(_0x2b045e){if(_0x2b045e){_0x1d07b1[_0x56a9('0x29')][_0x56a9('0x73')]=_0x2b045e[0x0];if(!_0x11776f['body']['UserId'])return;return db['User']['find']({'where':{'id':_0x11776f[_0x56a9('0x5b')][_0x56a9('0x63')],'role':'agent'},'attributes':['id','name','fullname','email',_0x56a9('0x76')],'raw':!![]});}return null;})[_0x56a9('0x38')](function(_0x302574){if(!_0x302574)return null;_0x1d07b1[_0x56a9('0x29')][_0x56a9('0x7e')]=_0x302574;return _0x1d07b1;})['then'](function(_0x30c470){if(_0x30c470){_0x30c470[_0x56a9('0x29')][_0x56a9('0x78')]=util[_0x56a9('0x69')]('SIP/%s',_0x11776f[_0x56a9('0x64')][_0x56a9('0x42')]);_0x30c470[_0x56a9('0x29')][_0x56a9('0x7a')]=_0x1d07b1['channel'];_0x30c470[_0x56a9('0x29')][_0x56a9('0x7b')]=_0x1d07b1[_0x56a9('0x7a')];_0x30c470['message'][_0x56a9('0x85')]=_0x56a9('0x7d');respondWithRpcPromise('EventManager',_0x56a9('0x86'),{'event':_0x56a9('0x87'),'message':_0x30c470[_0x56a9('0x29')]},client9002);return _0x1d07b1;}return null;})['then'](respondWithResult(_0x507daf,null))[_0x56a9('0x2b')](handleError(_0x507daf,null));};exports['create']=function(_0x3bc0bf,_0x260384){var _0x51ab06;return db[_0x56a9('0x53')]['create'](_0x3bc0bf[_0x56a9('0x5b')],{})[_0x56a9('0x38')](function(_0x149095){_0x51ab06=_0x149095;return db['CmContact'][_0x56a9('0x88')]({'where':{'id':_0x51ab06['ContactId']}});})[_0x56a9('0x38')](function(_0x28aaf9){if(_[_0x56a9('0x68')](_0x28aaf9)){return;}else{_0x51ab06['fax']=_0x28aaf9['fax'];return db[_0x56a9('0x89')][_0x56a9('0x88')]({'where':{'id':_0x51ab06[_0x56a9('0x8a')]}});}})[_0x56a9('0x38')](function(_0x3b21d7){return respondWithRpcPromise(_0x56a9('0x8b'),'SendFax',{'FaxAccountId':_['isNil'](_0x3bc0bf[_0x56a9('0x5b')])?undefined:_0x3bc0bf[_0x56a9('0x5b')]['FaxAccountId'],'path':_[_0x56a9('0x68')](_0x3b21d7)?undefined:util['format'](_0x56a9('0x8c'),_0x3b21d7[_0x56a9('0x8d')]),'fax':_['isNil'](_0x51ab06['fax'])?undefined:_0x51ab06[_0x56a9('0x5f')],'AttachmentId':_0x51ab06[_0x56a9('0x8a')]},client9002);})['then'](respondWithResult(_0x260384,0xc9))['catch'](handleError(_0x260384,null));};exports[_0x56a9('0x8e')]=function(_0xf6f71c,_0x549754){var _0x302081=path['join'](config[_0x56a9('0x8f')],_0x56a9('0x90'),_0x56a9('0x91'),'attachments');return db[_0x56a9('0x53')]['find']({'where':{'id':_0xf6f71c[_0x56a9('0x57')]['id']},'include':[{'model':db['Attachment'],'as':_0x56a9('0x89')}]})['then'](handleEntityNotFound(_0x549754,null))[_0x56a9('0x38')](function(_0x170637){if(_0x170637){return _0x549754[_0x56a9('0x8e')](path['join'](_0x302081,_0x170637[_0x56a9('0x89')][_0x56a9('0x8d')]));}})[_0x56a9('0x2b')](handleError(_0x549754,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 497f8ad..6a1b309 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 _0xc373=['../../mysqldb','FaxMessage','setMaxListeners','remove','emit','hook','exports'];(function(_0xe353ce,_0x3e0a84){var _0x208296=function(_0x2b63cb){while(--_0x2b63cb){_0xe353ce['push'](_0xe353ce['shift']());}};_0x208296(++_0x3e0a84);}(_0xc373,0x1c7));var _0x3c37=function(_0x1fd9e7,_0x24cdbe){_0x1fd9e7=_0x1fd9e7-0x0;var _0x1781f2=_0xc373[_0x1fd9e7];return _0x1781f2;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x3c37('0x0'))['db'][_0x3c37('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x3c37('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x3c37('0x3')};function emitEvent(_0x138f81){return function(_0x38d2d3,_0x2ca426,_0x1417ac){FaxMessageEvents[_0x3c37('0x4')](_0x138f81+':'+_0x38d2d3['id'],_0x38d2d3);FaxMessageEvents['emit'](_0x138f81,_0x38d2d3);_0x1417ac(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x3c37('0x5')](e,emitEvent(event));}}module[_0x3c37('0x6')]=FaxMessageEvents; \ No newline at end of file +var _0x3974=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxMessage','update'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x3974,0xbc));var _0x4397=function(_0x36d547,_0x4e94e5){_0x36d547=_0x36d547-0x0;var _0x1f8d59=_0x3974[_0x36d547];return _0x1f8d59;};'use strict';var EventEmitter=require(_0x4397('0x0'));var FaxMessage=require(_0x4397('0x1'))['db'][_0x4397('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4397('0x3'),'afterDestroy':_0x4397('0x4')};function emitEvent(_0x9db237){return function(_0x1337be,_0x3eefc4,_0x55a542){FaxMessageEvents[_0x4397('0x5')](_0x9db237+':'+_0x1337be['id'],_0x1337be);FaxMessageEvents[_0x4397('0x5')](_0x9db237,_0x1337be);_0x55a542(null);};}for(var e in events){if(events[_0x4397('0x6')](e)){var event=events[e];FaxMessage[_0x4397('0x7')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 27186e2..4fdc73c 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 _0x2a0a=['FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','models','get','toLowerCase','direction','out','secret','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','moment','rimraf','../../config/environment','./faxMessage.attributes','exports'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x2a0a,0xd8));var _0xa2a0=function(_0x9bf877,_0x58c7ad){_0x9bf877=_0x9bf877-0x0;var _0xa03d30=_0x2a0a[_0x9bf877];return _0xa03d30;};'use strict';var _=require(_0xa2a0('0x0'));var util=require(_0xa2a0('0x1'));var logger=require(_0xa2a0('0x2'))('api');var moment=require(_0xa2a0('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa2a0('0x4'));var config=require(_0xa2a0('0x5'));var attributes=require(_0xa2a0('0x6'));module[_0xa2a0('0x7')]=function(_0x1b5169,_0x11a716){return _0x1b5169['define'](_0xa2a0('0x8'),attributes,{'tableName':_0xa2a0('0x9'),'paranoid':![],'indexes':[{'name':_0xa2a0('0xa'),'fields':['body'],'type':_0xa2a0('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x32c7d7,_0x55a302,_0x450d21){var _0x51260d=_0x1b5169[_0xa2a0('0xc')];var _0x3fcc28=_0x32c7d7[_0xa2a0('0xd')]({'plain':!![]});if(_0x3fcc28['direction'][_0xa2a0('0xe')]()==='in'||_0x3fcc28[_0xa2a0('0xf')]['toLowerCase']()===_0xa2a0('0x10')&&!_0x3fcc28[_0xa2a0('0x11')]&&!_['isNil'](_0x3fcc28[_0xa2a0('0x12')])){_0x51260d[_0xa2a0('0x13')][_0xa2a0('0x14')]({'where':{'id':_0x3fcc28[_0xa2a0('0x15')]}})[_0xa2a0('0x16')](function(_0xe807ae){if(_0xe807ae){_0xe807ae[_0xa2a0('0x17')]({'lastMsgAt':_0x3fcc28[_0xa2a0('0x18')],'lastMsgDirection':_0x3fcc28[_0xa2a0('0xf')]['toLowerCase']()});}})[_0xa2a0('0x19')](function(_0x4ad56a){console[_0xa2a0('0x1a')](_0x4ad56a);});}_0x450d21();}},'charset':_0xa2a0('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3bdc=['FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','api','moment','rimraf','../../config/environment','./faxMessage.attributes','define','fax_messages','fti_fax_messages'];(function(_0xed2649,_0x1d8bee){var _0x36f471=function(_0xc498dc){while(--_0xc498dc){_0xed2649['push'](_0xed2649['shift']());}};_0x36f471(++_0x1d8bee);}(_0x3bdc,0x79));var _0xc3bd=function(_0x218915,_0x39a16c){_0x218915=_0x218915-0x0;var _0x57eb25=_0x3bdc[_0x218915];return _0x57eb25;};'use strict';var _=require('lodash');var util=require(_0xc3bd('0x0'));var logger=require('../../config/logger')(_0xc3bd('0x1'));var moment=require(_0xc3bd('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc3bd('0x3'));var config=require(_0xc3bd('0x4'));var attributes=require(_0xc3bd('0x5'));module['exports']=function(_0x430320,_0x1bdd0a){return _0x430320[_0xc3bd('0x6')]('FaxMessage',attributes,{'tableName':_0xc3bd('0x7'),'paranoid':![],'indexes':[{'name':_0xc3bd('0x8'),'fields':['body'],'type':_0xc3bd('0x9')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1afbb8,_0x5b3cdf,_0x2e3fec){var _0x11589e=_0x430320['models'];var _0x264a0e=_0x1afbb8[_0xc3bd('0xa')]({'plain':!![]});if(_0x264a0e[_0xc3bd('0xb')][_0xc3bd('0xc')]()==='in'||_0x264a0e[_0xc3bd('0xb')][_0xc3bd('0xc')]()===_0xc3bd('0xd')&&!_0x264a0e[_0xc3bd('0xe')]&&!_[_0xc3bd('0xf')](_0x264a0e[_0xc3bd('0x10')])){_0x11589e[_0xc3bd('0x11')]['findOne']({'where':{'id':_0x264a0e[_0xc3bd('0x12')]}})[_0xc3bd('0x13')](function(_0x5d07f8){if(_0x5d07f8){_0x5d07f8[_0xc3bd('0x14')]({'lastMsgAt':_0x264a0e[_0xc3bd('0x15')],'lastMsgDirection':_0x264a0e[_0xc3bd('0xb')][_0xc3bd('0xc')]()});}})[_0xc3bd('0x16')](function(_0x369cfc){console[_0xc3bd('0x17')](_0x369cfc);});}_0x2e3fec();}},'charset':_0xc3bd('0x18'),'collate':_0xc3bd('0x19')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index d0fc47f..72c4fe7 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 _0x032e=['FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','UpdateFaxMessage','where','attributes','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info'];(function(_0x271e88,_0xfe36d4){var _0x3e0e85=function(_0x2086c7){while(--_0x2086c7){_0x271e88['push'](_0x271e88['shift']());}};_0x3e0e85(++_0xfe36d4);}(_0x032e,0x124));var _0xe032=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x032e[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0xe032('0x0'));var util=require('util');var moment=require(_0xe032('0x1'));var BPromise=require(_0xe032('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe032('0x3'))['db'];var utils=require(_0xe032('0x4'));var logger=require(_0xe032('0x5'))(_0xe032('0x6'));var config=require(_0xe032('0x7'));var jayson=require(_0xe032('0x8'));var client=jayson[_0xe032('0x9')][_0xe032('0xa')]({'port':0x232a});config[_0xe032('0xb')]=_[_0xe032('0xc')](config[_0xe032('0xb')],{'host':_0xe032('0xd'),'port':0x18eb});var socket=require(_0xe032('0xe'))(new Redis(config[_0xe032('0xb')]));require(_0xe032('0xf'))[_0xe032('0x10')](socket);function respondWithRpcPromise(_0x2dc9e5,_0x167bd9,_0x4aec53){return new BPromise(function(_0x1382e1,_0x1ce2ae){return client[_0xe032('0x11')](_0x2dc9e5,_0x4aec53)[_0xe032('0x12')](function(_0x244f93){logger[_0xe032('0x13')](_0xe032('0x14'),_0x167bd9,'request\x20sent');logger[_0xe032('0x15')](_0xe032('0x16'),_0x167bd9,_0xe032('0x17'),JSON[_0xe032('0x18')](_0x244f93));if(_0x244f93['error']){if(_0x244f93[_0xe032('0x19')][_0xe032('0x1a')]===0x1f4){logger[_0xe032('0x19')](_0xe032('0x14'),_0x167bd9,_0x244f93[_0xe032('0x19')][_0xe032('0x1b')]);return _0x1ce2ae(_0x244f93[_0xe032('0x19')]['message']);}logger[_0xe032('0x19')](_0xe032('0x14'),_0x167bd9,_0x244f93[_0xe032('0x19')][_0xe032('0x1b')]);return _0x1382e1(_0x244f93[_0xe032('0x19')][_0xe032('0x1b')]);}else{logger['info'](_0xe032('0x14'),_0x167bd9,_0xe032('0x17'));_0x1382e1(_0x244f93[_0xe032('0x1c')][_0xe032('0x1b')]);}})[_0xe032('0x1d')](function(_0x5721ce){logger['error']('FaxMessage,\x20%s,\x20%s',_0x167bd9,_0x5721ce);_0x1ce2ae(_0x5721ce);});});}exports[_0xe032('0x1e')]=function(_0x505d8c){var _0x46dc27=this;return new Promise(function(_0x4608e4,_0x3f0257){return db[_0xe032('0x1f')][_0xe032('0x20')](_0x505d8c[_0xe032('0x21')],{'raw':_0x505d8c[_0xe032('0x22')]?_0x505d8c['options'][_0xe032('0x23')]===undefined?!![]:![]:!![]})[_0xe032('0x12')](function(_0x232e8f){logger[_0xe032('0x13')](_0xe032('0x1e'),_0x505d8c);logger[_0xe032('0x15')](_0xe032('0x1e'),_0x505d8c,JSON[_0xe032('0x18')](_0x232e8f));_0x4608e4(_0x232e8f);})['catch'](function(_0x4f1aa3){logger['error'](_0xe032('0x1e'),_0x4f1aa3[_0xe032('0x1b')],_0x505d8c);_0x3f0257(_0x46dc27[_0xe032('0x19')](0x1f4,_0x4f1aa3[_0xe032('0x1b')]));});});};exports[_0xe032('0x24')]=function(_0x200671){var _0x36ece7=this;return new Promise(function(_0x2b6ffa,_0x4dcbf1){return db[_0xe032('0x1f')]['update'](_0x200671[_0xe032('0x21')],{'raw':_0x200671[_0xe032('0x22')]?_0x200671[_0xe032('0x22')][_0xe032('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x200671['options']?_0x200671['options'][_0xe032('0x25')]||null:null,'attributes':_0x200671[_0xe032('0x22')]?_0x200671[_0xe032('0x22')][_0xe032('0x26')]||null:null,'limit':_0x200671['options']?_0x200671['options']['limit']||null:null})[_0xe032('0x12')](function(_0x1dd34f){logger[_0xe032('0x13')](_0xe032('0x24'),_0x200671);logger['debug'](_0xe032('0x24'),_0x200671,JSON[_0xe032('0x18')](_0x1dd34f));_0x2b6ffa(_0x1dd34f);})[_0xe032('0x1d')](function(_0x4348f8){logger[_0xe032('0x19')]('UpdateFaxMessage',_0x4348f8[_0xe032('0x1b')],_0x200671);_0x4dcbf1(_0x36ece7[_0xe032('0x19')](0x1f4,_0x4348f8[_0xe032('0x1b')]));});});}; \ No newline at end of file +var _0x22fb=['request','FaxMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','create','options','raw','then','debug','UpdateFaxMessage','update','body','attributes','limit','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x22fb,0x192));var _0xb22f=function(_0x28e1d8,_0x54ef19){_0x28e1d8=_0x28e1d8-0x0;var _0x39105d=_0x22fb[_0x28e1d8];return _0x39105d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb22f('0x0'));var BPromise=require('bluebird');var rs=require(_0xb22f('0x1'));var fs=require('fs');var Redis=require(_0xb22f('0x2'));var db=require(_0xb22f('0x3'))['db'];var utils=require(_0xb22f('0x4'));var logger=require(_0xb22f('0x5'))('rpc');var config=require(_0xb22f('0x6'));var jayson=require(_0xb22f('0x7'));var client=jayson[_0xb22f('0x8')][_0xb22f('0x9')]({'port':0x232a});config[_0xb22f('0xa')]=_[_0xb22f('0xb')](config['redis'],{'host':_0xb22f('0xc'),'port':0x18eb});var socket=require(_0xb22f('0xd'))(new Redis(config[_0xb22f('0xa')]));require(_0xb22f('0xe'))[_0xb22f('0xf')](socket);function respondWithRpcPromise(_0x3593fb,_0x188cea,_0x2ca6dd){return new BPromise(function(_0x26cf79,_0x2676f3){return client[_0xb22f('0x10')](_0x3593fb,_0x2ca6dd)['then'](function(_0x4b9e56){logger['info'](_0xb22f('0x11'),_0x188cea,'request\x20sent');logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x188cea,_0xb22f('0x12'),JSON[_0xb22f('0x13')](_0x4b9e56));if(_0x4b9e56[_0xb22f('0x14')]){if(_0x4b9e56[_0xb22f('0x14')][_0xb22f('0x15')]===0x1f4){logger[_0xb22f('0x14')]('FaxMessage,\x20%s,\x20%s',_0x188cea,_0x4b9e56[_0xb22f('0x14')]['message']);return _0x2676f3(_0x4b9e56[_0xb22f('0x14')]['message']);}logger[_0xb22f('0x14')](_0xb22f('0x11'),_0x188cea,_0x4b9e56[_0xb22f('0x14')][_0xb22f('0x16')]);return _0x26cf79(_0x4b9e56[_0xb22f('0x14')]['message']);}else{logger[_0xb22f('0x17')]('FaxMessage,\x20%s,\x20%s',_0x188cea,_0xb22f('0x12'));_0x26cf79(_0x4b9e56[_0xb22f('0x18')][_0xb22f('0x16')]);}})[_0xb22f('0x19')](function(_0x139bb6){logger[_0xb22f('0x14')]('FaxMessage,\x20%s,\x20%s',_0x188cea,_0x139bb6);_0x2676f3(_0x139bb6);});});}exports[_0xb22f('0x1a')]=function(_0x4b4510){var _0x3e05ce=this;return new Promise(function(_0x3878d8,_0x316f11){return db[_0xb22f('0x1b')][_0xb22f('0x1c')](_0x4b4510['body'],{'raw':_0x4b4510['options']?_0x4b4510[_0xb22f('0x1d')][_0xb22f('0x1e')]===undefined?!![]:![]:!![]})[_0xb22f('0x1f')](function(_0x16e465){logger[_0xb22f('0x17')](_0xb22f('0x1a'),_0x4b4510);logger[_0xb22f('0x20')](_0xb22f('0x1a'),_0x4b4510,JSON['stringify'](_0x16e465));_0x3878d8(_0x16e465);})['catch'](function(_0x3ab1d8){logger[_0xb22f('0x14')]('CreateFaxMessage',_0x3ab1d8[_0xb22f('0x16')],_0x4b4510);_0x316f11(_0x3e05ce[_0xb22f('0x14')](0x1f4,_0x3ab1d8['message']));});});};exports[_0xb22f('0x21')]=function(_0x2918be){var _0x4dfb62=this;return new Promise(function(_0x3e471f,_0x2c4a9e){return db[_0xb22f('0x1b')][_0xb22f('0x22')](_0x2918be[_0xb22f('0x23')],{'raw':_0x2918be[_0xb22f('0x1d')]?_0x2918be[_0xb22f('0x1d')][_0xb22f('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2918be['options']?_0x2918be['options']['where']||null:null,'attributes':_0x2918be[_0xb22f('0x1d')]?_0x2918be['options'][_0xb22f('0x24')]||null:null,'limit':_0x2918be[_0xb22f('0x1d')]?_0x2918be[_0xb22f('0x1d')][_0xb22f('0x25')]||null:null})[_0xb22f('0x1f')](function(_0x5b2a42){logger['info'](_0xb22f('0x21'),_0x2918be);logger[_0xb22f('0x20')](_0xb22f('0x21'),_0x2918be,JSON[_0xb22f('0x13')](_0x5b2a42));_0x3e471f(_0x5b2a42);})['catch'](function(_0x176133){logger[_0xb22f('0x14')]('UpdateFaxMessage',_0x176133[_0xb22f('0x16')],_0x2918be);_0x2c4a9e(_0x4dfb62[_0xb22f('0x14')](0x1f4,_0x176133[_0xb22f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index f533d06..7456755 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 _0x6ee8=['./faxMessage.events','save','update','emit','removeListener','register','faxMessage:'];(function(_0x3385c1,_0x525d4d){var _0x50db08=function(_0x41784a){while(--_0x41784a){_0x3385c1['push'](_0x3385c1['shift']());}};_0x50db08(++_0x525d4d);}(_0x6ee8,0x77));var _0x86ee=function(_0x52db55,_0x16f68f){_0x52db55=_0x52db55-0x0;var _0x19a27c=_0x6ee8[_0x52db55];return _0x19a27c;};'use strict';var FaxMessageEvents=require(_0x86ee('0x0'));var events=[_0x86ee('0x1'),'remove',_0x86ee('0x2')];function createListener(_0xbae0ef,_0x21a2d2){return function(_0x1bcba1){_0x21a2d2[_0x86ee('0x3')](_0xbae0ef,_0x1bcba1);};}function removeListener(_0x474dcf,_0x50a359){return function(){FaxMessageEvents[_0x86ee('0x4')](_0x474dcf,_0x50a359);};}exports[_0x86ee('0x5')]=function(_0xb26d8b){for(var _0x2b7aaf=0x0,_0xfd7a84=events['length'];_0x2b7aaf<_0xfd7a84;_0x2b7aaf++){var _0x8adf35=events[_0x2b7aaf];var _0x5ed1fe=createListener(_0x86ee('0x6')+_0x8adf35,_0xb26d8b);FaxMessageEvents['on'](_0x8adf35,_0x5ed1fe);}}; \ No newline at end of file +var _0xb3b3=['register','faxMessage:','./faxMessage.events','save','remove','update','emit'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0xb3b3,0xc6));var _0x3b3b=function(_0x1a5de5,_0x5a7efc){_0x1a5de5=_0x1a5de5-0x0;var _0x3a8a54=_0xb3b3[_0x1a5de5];return _0x3a8a54;};'use strict';var FaxMessageEvents=require(_0x3b3b('0x0'));var events=[_0x3b3b('0x1'),_0x3b3b('0x2'),_0x3b3b('0x3')];function createListener(_0x279f6b,_0x3d5998){return function(_0x250639){_0x3d5998[_0x3b3b('0x4')](_0x279f6b,_0x250639);};}function removeListener(_0x5a468c,_0x2af0e7){return function(){FaxMessageEvents['removeListener'](_0x5a468c,_0x2af0e7);};}exports[_0x3b3b('0x5')]=function(_0x55d7dd){for(var _0x59f4e5=0x0,_0x6a8aca=events['length'];_0x59f4e5<_0x6a8aca;_0x59f4e5++){var _0x16a095=events[_0x59f4e5];var _0x296abc=createListener(_0x3b3b('0x6')+_0x16a095,_0x55d7dd);FaxMessageEvents['on'](_0x16a095,_0x296abc);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index f4cc6f1..b0fe6c7 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 _0x222f=['/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','show','/:id/download','post','tracked','fax','create','put','update','/:id/accept'];(function(_0x4a5195,_0x20603e){var _0x30908e=function(_0x3c57bf){while(--_0x3c57bf){_0x4a5195['push'](_0x4a5195['shift']());}};_0x30908e(++_0x20603e);}(_0x222f,0x1a4));var _0xf222=function(_0x1daaa9,_0x220393){_0x1daaa9=_0x1daaa9-0x0;var _0x1dd221=_0x222f[_0x1daaa9];return _0x1dd221;};'use strict';var multer=require(_0xf222('0x0'));var util=require(_0xf222('0x1'));var path=require(_0xf222('0x2'));var timeout=require(_0xf222('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf222('0x4'));var auth=require(_0xf222('0x5'));var interaction=require(_0xf222('0x6'));var config=require(_0xf222('0x7'));var controller=require('./faxMessage.controller');router[_0xf222('0x8')]('/',auth['isAuthenticated'](),controller[_0xf222('0x9')]);router[_0xf222('0x8')]('/describe',auth[_0xf222('0xa')](),controller[_0xf222('0xb')]);router['get'](_0xf222('0xc'),auth[_0xf222('0xa')](),controller[_0xf222('0xd')]);router[_0xf222('0x8')](_0xf222('0xe'),auth[_0xf222('0xa')](),controller['download']);router[_0xf222('0xf')]('/',auth[_0xf222('0xa')](),interaction[_0xf222('0x10')](_0xf222('0x11'),'faxmessage:create'),controller[_0xf222('0x12')]);router[_0xf222('0x13')](_0xf222('0xc'),auth[_0xf222('0xa')](),controller[_0xf222('0x14')]);router[_0xf222('0x13')](_0xf222('0x15'),auth[_0xf222('0xa')](),controller['accept']);router['put'](_0xf222('0x16'),auth[_0xf222('0xa')](),controller['reject']);router[_0xf222('0x17')](_0xf222('0xc'),auth[_0xf222('0xa')](),controller[_0xf222('0x18')]);module[_0xf222('0x19')]=router; \ No newline at end of file +var _0x2547=['/:id/download','download','post','tracked','faxmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x592d48,_0x23f1ba){var _0x5d789e=function(_0x156900){while(--_0x156900){_0x592d48['push'](_0x592d48['shift']());}};_0x5d789e(++_0x23f1ba);}(_0x2547,0x1cd));var _0x7254=function(_0x431cdb,_0x2c4186){_0x431cdb=_0x431cdb-0x0;var _0x81a78b=_0x2547[_0x431cdb];return _0x81a78b;};'use strict';var multer=require('multer');var util=require(_0x7254('0x0'));var path=require(_0x7254('0x1'));var timeout=require(_0x7254('0x2'));var express=require(_0x7254('0x3'));var router=express[_0x7254('0x4')]();var fs_extra=require(_0x7254('0x5'));var auth=require(_0x7254('0x6'));var interaction=require(_0x7254('0x7'));var config=require('../../config/environment');var controller=require(_0x7254('0x8'));router[_0x7254('0x9')]('/',auth[_0x7254('0xa')](),controller[_0x7254('0xb')]);router['get'](_0x7254('0xc'),auth[_0x7254('0xa')](),controller[_0x7254('0xd')]);router['get'](_0x7254('0xe'),auth['isAuthenticated'](),controller['show']);router['get'](_0x7254('0xf'),auth[_0x7254('0xa')](),controller[_0x7254('0x10')]);router[_0x7254('0x11')]('/',auth[_0x7254('0xa')](),interaction[_0x7254('0x12')]('fax',_0x7254('0x13')),controller['create']);router[_0x7254('0x14')]('/:id',auth[_0x7254('0xa')](),controller[_0x7254('0x15')]);router[_0x7254('0x14')](_0x7254('0x16'),auth[_0x7254('0xa')](),controller[_0x7254('0x17')]);router[_0x7254('0x14')](_0x7254('0x18'),auth[_0x7254('0xa')](),controller[_0x7254('0x19')]);router[_0x7254('0x1a')](_0x7254('0xe'),auth[_0x7254('0xa')](),controller['destroy']);module[_0x7254('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 25fa396..8c641b6 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 _0xa3bb=['rrmemory','roundrobin','sequelize','exports','name','STRING','INTEGER','ENUM'];(function(_0x19bc90,_0x335e95){var _0x250c6f=function(_0x2978da){while(--_0x2978da){_0x19bc90['push'](_0x19bc90['shift']());}};_0x250c6f(++_0x335e95);}(_0xa3bb,0xd2));var _0xba3b=function(_0x10849b,_0x3780e1){_0x10849b=_0x10849b-0x0;var _0x3092f2=_0xa3bb[_0x10849b];return _0x3092f2;};'use strict';var Sequelize=require(_0xba3b('0x0'));module[_0xba3b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xba3b('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xba3b('0x3')]},'timeout':{'type':Sequelize[_0xba3b('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xba3b('0x5')](_0xba3b('0x6'),'beepall',_0xba3b('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xba3b('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2bb2=['rrmemory','sequelize','exports','STRING','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2bb2,0x17d));var _0x22bb=function(_0x57cc47,_0x5492f4){_0x57cc47=_0x57cc47-0x0;var _0x52229c=_0x2bb2[_0x57cc47];return _0x52229c;};'use strict';var Sequelize=require(_0x22bb('0x0'));module[_0x22bb('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x22bb('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x22bb('0x3')](_0x22bb('0x4'),'beepall','roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'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 6f79133..d4cbebf 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 _0x063e=['Team','addTeams','ids','Agents','online','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','toString','sequelize','TeamId','includes','all','union','compact','isEmpty','removeAgents','userFaxQueue:remove','addAgents','spread','isArray','getAgents','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','UserProfileResource','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','where','type','VIRTUAL','includeAll','include','FaxQueue','findAll','catch','show','params','options','find','create','body','role','user','get','FaxQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','nolimit','FaxQueueId','User','findAndCountAll','UserId','updatedAt','rows','format','SIP','createdAt','getTeams'];(function(_0x472246,_0x3e0bcd){var _0xf2391b=function(_0x12bedb){while(--_0x12bedb){_0x472246['push'](_0x472246['shift']());}};_0xf2391b(++_0x3e0bcd);}(_0x063e,0x13c));var _0xe063=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x063e[_0x15bc81];return _0x59440e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe063('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe063('0x1'));var rp=require(_0xe063('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe063('0x3'));var util=require(_0xe063('0x4'));var path=require(_0xe063('0x5'));var sox=require(_0xe063('0x6'));var csv=require(_0xe063('0x7'));var ejs=require(_0xe063('0x8'));var fs=require('fs');var fs_extra=require(_0xe063('0x9'));var _=require(_0xe063('0xa'));var squel=require(_0xe063('0xb'));var crypto=require(_0xe063('0xc'));var jsforce=require(_0xe063('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe063('0xe'));var Papa=require('papaparse');var Redis=require(_0xe063('0xf'));var authService=require(_0xe063('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe063('0x11'));var hardwareService=require(_0xe063('0x12'));var logger=require(_0xe063('0x13'))(_0xe063('0x14'));var utils=require(_0xe063('0x15'));var config=require(_0xe063('0x16'));var licenseUtil=require(_0xe063('0x17'));var db=require(_0xe063('0x18'))['db'];config[_0xe063('0x19')]=_['defaults'](config[_0xe063('0x19')],{'host':_0xe063('0x1a'),'port':0x18eb});var socket=require(_0xe063('0x1b'))(new Redis(config[_0xe063('0x19')]));require(_0xe063('0x1c'))['register'](socket);function respondWithStatusCode(_0x271b6e,_0xb722bc){_0xb722bc=_0xb722bc||0xcc;return function(_0x5c63b1){if(_0x5c63b1){return _0x271b6e[_0xe063('0x1d')](_0xb722bc);}return _0x271b6e['status'](_0xb722bc)['end']();};}function respondWithResult(_0x3c6992,_0x1480c0){_0x1480c0=_0x1480c0||0xc8;return function(_0x504ff3){if(_0x504ff3){return _0x3c6992[_0xe063('0x1e')](_0x1480c0)[_0xe063('0x1f')](_0x504ff3);}};}function respondWithFilteredResult(_0x2ed050,_0x57d723){return function(_0x2e833f){if(_0x2e833f){var _0x395dfa=typeof _0x57d723[_0xe063('0x20')]===_0xe063('0x21')&&typeof _0x57d723[_0xe063('0x22')]===_0xe063('0x21');var _0x5550b5=_0x2e833f[_0xe063('0x23')];var _0xf88d94=_0x395dfa?0x0:_0x57d723[_0xe063('0x20')];var _0x40c0f4=_0x395dfa?_0x2e833f[_0xe063('0x23')]:_0x57d723[_0xe063('0x20')]+_0x57d723['limit'];var _0x4f5228;if(_0x40c0f4>=_0x5550b5){_0x40c0f4=_0x5550b5;_0x4f5228=0xc8;}else{_0x4f5228=0xce;}_0x2ed050[_0xe063('0x1e')](_0x4f5228);return _0x2ed050[_0xe063('0x24')](_0xe063('0x25'),_0xf88d94+'-'+_0x40c0f4+'/'+_0x5550b5)['json'](_0x2e833f);}return null;};}function patchUpdates(_0x33eae5){return function(_0x49ea7c){try{jsonpatch[_0xe063('0x26')](_0x49ea7c,_0x33eae5,!![]);}catch(_0x14581d){return BPromise[_0xe063('0x27')](_0x14581d);}return _0x49ea7c[_0xe063('0x28')]();};}function saveUpdates(_0x14e866,_0x2a3c59){return function(_0x2824f0){if(_0x2824f0){return _0x2824f0[_0xe063('0x29')](_0x14e866)[_0xe063('0x2a')](function(_0xb4da99){return _0xb4da99;});}return null;};}function removeEntity(_0x6c79e0,_0x330cab){return function(_0x2539b1){if(_0x2539b1){return _0x2539b1['destroy']()['then'](function(){var _0x20e956=_0x2539b1['get']({'plain':!![]});var _0x46ac72='FaxQueues';return db[_0xe063('0x2b')][_0xe063('0x2c')]({'where':{'type':_0x46ac72,'resourceId':_0x20e956['id']}})[_0xe063('0x2a')](function(){return _0x2539b1;});})['then'](function(){_0x6c79e0[_0xe063('0x1e')](0xcc)[_0xe063('0x2d')]();});}};}function handleEntityNotFound(_0x3e8f85,_0x3b6a50){return function(_0x178b20){if(!_0x178b20){_0x3e8f85['sendStatus'](0x194);}return _0x178b20;};}function handleError(_0x310024,_0x5f42b2){_0x5f42b2=_0x5f42b2||0x1f4;return function(_0x4f4720){logger[_0xe063('0x2e')](_0x4f4720[_0xe063('0x2f')]);if(_0x4f4720[_0xe063('0x30')]){delete _0x4f4720[_0xe063('0x30')];}_0x310024[_0xe063('0x1e')](_0x5f42b2)[_0xe063('0x31')](_0x4f4720);};}exports['index']=function(_0x16d7b7,_0x2d6790){var _0x3358b3={},_0x5d0d33={},_0x43c893={'count':0x0,'rows':[]};var _0x3ac5e4=_[_0xe063('0x32')](db['FaxQueue'][_0xe063('0x33')],function(_0x31d73f){return{'name':_0x31d73f[_0xe063('0x34')],'type':_0x31d73f['type'][_0xe063('0x35')]};});_0x5d0d33[_0xe063('0x36')]=_[_0xe063('0x32')](_0x3ac5e4,'name');_0x5d0d33[_0xe063('0x37')]=_[_0xe063('0x38')](_0x16d7b7[_0xe063('0x37')]);_0x5d0d33[_0xe063('0x39')]=_[_0xe063('0x3a')](_0x5d0d33[_0xe063('0x36')],_0x5d0d33[_0xe063('0x37')]);_0x3358b3['attributes']=_[_0xe063('0x3a')](_0x5d0d33[_0xe063('0x36')],qs[_0xe063('0x3b')](_0x16d7b7[_0xe063('0x37')][_0xe063('0x3b')]));_0x3358b3[_0xe063('0x3c')]=_0x3358b3[_0xe063('0x3c')][_0xe063('0x3d')]?_0x3358b3[_0xe063('0x3c')]:_0x5d0d33[_0xe063('0x36')];if(!_0x16d7b7[_0xe063('0x37')][_0xe063('0x3e')]('nolimit')){_0x3358b3[_0xe063('0x22')]=qs['limit'](_0x16d7b7['query'][_0xe063('0x22')]);_0x3358b3[_0xe063('0x20')]=qs[_0xe063('0x20')](_0x16d7b7['query']['offset']);}_0x3358b3[_0xe063('0x3f')]=qs['sort'](_0x16d7b7[_0xe063('0x37')][_0xe063('0x40')]);_0x3358b3['where']=qs[_0xe063('0x39')](_[_0xe063('0x41')](_0x16d7b7['query'],_0x5d0d33[_0xe063('0x39')]),_0x3ac5e4);if(_0x16d7b7[_0xe063('0x37')][_0xe063('0x42')]){_0x3358b3['where']=_[_0xe063('0x43')](_0x3358b3[_0xe063('0x44')],{'$or':_[_0xe063('0x32')](_0x3ac5e4,function(_0x1195ac){if(_0x1195ac[_0xe063('0x45')]!==_0xe063('0x46')){var _0xd24e54={};_0xd24e54[_0x1195ac['name']]={'$like':'%'+_0x16d7b7['query'][_0xe063('0x42')]+'%'};return _0xd24e54;}})});}_0x3358b3=_[_0xe063('0x43')]({},_0x3358b3,_0x16d7b7['options']);var _0xb19569={'where':_0x3358b3[_0xe063('0x44')]};return db['FaxQueue'][_0xe063('0x23')](_0xb19569)[_0xe063('0x2a')](function(_0x35ae36){_0x43c893[_0xe063('0x23')]=_0x35ae36;if(_0x16d7b7['query'][_0xe063('0x47')]){_0x3358b3[_0xe063('0x48')]=[{'all':!![]}];}return db[_0xe063('0x49')][_0xe063('0x4a')](_0x3358b3);})[_0xe063('0x2a')](function(_0x18d007){_0x43c893['rows']=_0x18d007;return _0x43c893;})['then'](respondWithFilteredResult(_0x2d6790,_0x3358b3))[_0xe063('0x4b')](handleError(_0x2d6790,null));};exports[_0xe063('0x4c')]=function(_0x3e0165,_0x383438){var _0x3c4585={'raw':!![],'where':{'id':_0x3e0165[_0xe063('0x4d')]['id']}},_0x5fd024={};_0x5fd024[_0xe063('0x36')]=_[_0xe063('0x38')](db[_0xe063('0x49')][_0xe063('0x33')]);_0x5fd024['query']=_['keys'](_0x3e0165[_0xe063('0x37')]);_0x5fd024[_0xe063('0x39')]=_['intersection'](_0x5fd024[_0xe063('0x36')],_0x5fd024[_0xe063('0x37')]);_0x3c4585[_0xe063('0x3c')]=_[_0xe063('0x3a')](_0x5fd024[_0xe063('0x36')],qs['fields'](_0x3e0165[_0xe063('0x37')]['fields']));_0x3c4585[_0xe063('0x3c')]=_0x3c4585['attributes'][_0xe063('0x3d')]?_0x3c4585[_0xe063('0x3c')]:_0x5fd024['model'];if(_0x3e0165[_0xe063('0x37')]['includeAll']){_0x3c4585['include']=[{'all':!![]}];}_0x3c4585=_[_0xe063('0x43')]({},_0x3c4585,_0x3e0165[_0xe063('0x4e')]);return db[_0xe063('0x49')][_0xe063('0x4f')](_0x3c4585)[_0xe063('0x2a')](handleEntityNotFound(_0x383438,null))[_0xe063('0x2a')](respondWithResult(_0x383438,null))['catch'](handleError(_0x383438,null));};exports['create']=function(_0x14aacc,_0x4703ef){return db[_0xe063('0x49')][_0xe063('0x50')](_0x14aacc[_0xe063('0x51')],{})[_0xe063('0x2a')](function(_0x2e936e){var _0x44e13a=_0x14aacc['user']['get']({'plain':!![]});if(!_0x44e13a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x44e13a[_0xe063('0x52')]===_0xe063('0x53')){var _0x4ee8cb=_0x2e936e[_0xe063('0x54')]({'plain':!![]});var _0x371c29=_0xe063('0x55');return db[_0xe063('0x56')][_0xe063('0x4f')]({'where':{'name':_0x371c29,'userProfileId':_0x44e13a[_0xe063('0x57')]},'raw':!![]})['then'](function(_0xec2bac){if(_0xec2bac&&_0xec2bac['autoAssociation']===0x0){return db[_0xe063('0x2b')][_0xe063('0x50')]({'name':_0x4ee8cb[_0xe063('0x30')],'resourceId':_0x4ee8cb['id'],'type':_0xec2bac['name'],'sectionId':_0xec2bac['id']},{})[_0xe063('0x2a')](function(){return _0x2e936e;});}else{return _0x2e936e;}})[_0xe063('0x4b')](function(_0x441d32){logger[_0xe063('0x2e')](_0xe063('0x58'),_0x441d32);throw _0x441d32;});}return _0x2e936e;})['then'](respondWithResult(_0x4703ef,0xc9))[_0xe063('0x4b')](handleError(_0x4703ef,null));};exports['update']=function(_0x360db8,_0x200002){if(_0x360db8[_0xe063('0x51')]['id']){delete _0x360db8['body']['id'];}return db[_0xe063('0x49')][_0xe063('0x4f')]({'where':{'id':_0x360db8['params']['id']}})[_0xe063('0x2a')](handleEntityNotFound(_0x200002,null))[_0xe063('0x2a')](saveUpdates(_0x360db8[_0xe063('0x51')],null))[_0xe063('0x2a')](respondWithResult(_0x200002,null))[_0xe063('0x4b')](handleError(_0x200002,null));};exports[_0xe063('0x2c')]=function(_0x30634a,_0x1bdf87){return db[_0xe063('0x49')][_0xe063('0x4f')]({'where':{'id':_0x30634a['params']['id']}})[_0xe063('0x2a')](handleEntityNotFound(_0x1bdf87,null))['then'](removeEntity(_0x1bdf87,null))[_0xe063('0x4b')](handleError(_0x1bdf87,null));};exports[_0xe063('0x59')]=function(_0x2ba892,_0x1de8db){return db[_0xe063('0x49')][_0xe063('0x59')]()[_0xe063('0x2a')](respondWithResult(_0x1de8db,null))[_0xe063('0x4b')](handleError(_0x1de8db,null));};exports[_0xe063('0x5a')]=function(_0x4b16ee,_0xd9355a,_0x3f112c){var _0x3f2889={'raw':!![],'where':{}},_0x5dda56={},_0x2de8cd;return db['FaxQueue'][_0xe063('0x5b')]({'where':{'id':_0x4b16ee['params']['id']}})[_0xe063('0x2a')](handleEntityNotFound(_0xd9355a,null))[_0xe063('0x2a')](function(_0x44dc68){if(_0x44dc68){_0x2de8cd=_0x44dc68[_0xe063('0x54')]({'plain':!![]});_0x5dda56['model']=_[_0xe063('0x38')](db[_0xe063('0x5c')][_0xe063('0x33')]);_0x5dda56[_0xe063('0x37')]=_[_0xe063('0x38')](_0x4b16ee['query']);_0x5dda56[_0xe063('0x39')]=_['intersection'](_0x5dda56['model'],_0x5dda56[_0xe063('0x37')]);_0x3f2889[_0xe063('0x3c')]=_[_0xe063('0x3a')](_0x5dda56[_0xe063('0x36')],qs['fields'](_0x4b16ee[_0xe063('0x37')][_0xe063('0x3b')]));_0x3f2889[_0xe063('0x3c')]=_0x3f2889[_0xe063('0x3c')]['length']?_0x3f2889[_0xe063('0x3c')]:_0x5dda56[_0xe063('0x36')];if(!_0x4b16ee[_0xe063('0x37')]['hasOwnProperty'](_0xe063('0x5d'))){_0x3f2889[_0xe063('0x22')]=qs[_0xe063('0x22')](_0x4b16ee['query']['limit']);_0x3f2889['offset']=qs['offset'](_0x4b16ee['query']['offset']);}_0x3f2889[_0xe063('0x3f')]=qs[_0xe063('0x40')](_0x4b16ee['query']['sort']);_0x3f2889[_0xe063('0x44')]=qs['filters'](_['pick'](_0x4b16ee[_0xe063('0x37')],_0x5dda56[_0xe063('0x39')]));_0x3f2889[_0xe063('0x44')][_0xe063('0x5e')]=_0x44dc68['id'];if(_0x4b16ee[_0xe063('0x37')][_0xe063('0x42')]){_0x3f2889[_0xe063('0x44')]=_[_0xe063('0x43')](_0x3f2889[_0xe063('0x44')],{'$or':_['map'](_0x3f2889[_0xe063('0x3c')],function(_0x1fa61e){var _0x50bba4={};_0x50bba4[_0x1fa61e]={'$like':'%'+_0x4b16ee['query'][_0xe063('0x42')]+'%'};return _0x50bba4;})});}_0x3f2889=_[_0xe063('0x43')]({},_0x3f2889,_0x4b16ee[_0xe063('0x4e')]);return db[_0xe063('0x5c')][_0xe063('0x4a')](_0x3f2889);}})[_0xe063('0x2a')](function(_0xbbaa9c){if(_0xbbaa9c){return db[_0xe063('0x5f')][_0xe063('0x60')]({'where':{'id':_['map'](_0xbbaa9c,_0xe063('0x61')),'role':'agent'},'attributes':['id','name','faxPause',_0xe063('0x62'),'createdAt']});}})[_0xe063('0x2a')](function(_0x14d509){if(_0x14d509){return{'count':_0x14d509[_0xe063('0x23')],'rows':_['map'](_0x14d509[_0xe063('0x63')],function(_0x28997b){return{'membername':_0x28997b[_0xe063('0x30')],'UserId':_0x28997b['id'],'queue_name':_0x2de8cd[_0xe063('0x30')],'FaxQueueId':_0x2de8cd['id'],'interface':util[_0xe063('0x64')]('%s/%s',_0xe063('0x65'),_0x28997b[_0xe063('0x30')]),'penalty':0x0,'paused':_0x28997b['faxPause'],'createdAt':_0x28997b[_0xe063('0x66')],'updatedAt':_0x28997b['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xd9355a,_0x3f2889))[_0xe063('0x4b')](handleError(_0xd9355a,null));};exports[_0xe063('0x67')]=function(_0x516563,_0x271d75,_0x3f0903){var _0x9bc552={};var _0x2798a9={};var _0x2ac83a;var _0x2c7fee;return db[_0xe063('0x49')][_0xe063('0x5b')]({'where':{'id':_0x516563[_0xe063('0x4d')]['id']}})[_0xe063('0x2a')](handleEntityNotFound(_0x271d75,null))[_0xe063('0x2a')](function(_0x122897){if(_0x122897){_0x2ac83a=_0x122897;_0x2798a9[_0xe063('0x36')]=_[_0xe063('0x38')](db[_0xe063('0x68')][_0xe063('0x33')]);_0x2798a9['query']=_[_0xe063('0x38')](_0x516563[_0xe063('0x37')]);_0x2798a9[_0xe063('0x39')]=_[_0xe063('0x3a')](_0x2798a9[_0xe063('0x36')],_0x2798a9['query']);_0x9bc552[_0xe063('0x3c')]=_[_0xe063('0x3a')](_0x2798a9['model'],qs['fields'](_0x516563['query'][_0xe063('0x3b')]));_0x9bc552[_0xe063('0x3c')]=_0x9bc552['attributes']['length']?_0x9bc552[_0xe063('0x3c')]:_0x2798a9[_0xe063('0x36')];_0x9bc552['order']=qs[_0xe063('0x40')](_0x516563[_0xe063('0x37')][_0xe063('0x40')]);_0x9bc552[_0xe063('0x44')]=qs[_0xe063('0x39')](_[_0xe063('0x41')](_0x516563[_0xe063('0x37')],_0x2798a9[_0xe063('0x39')]));if(_0x516563[_0xe063('0x37')][_0xe063('0x42')]){_0x9bc552[_0xe063('0x44')]=_['merge'](_0x9bc552[_0xe063('0x44')],{'$or':_['map'](_0x9bc552[_0xe063('0x3c')],function(_0x20950c){var _0x1d9d26={};_0x1d9d26[_0x20950c]={'$like':'%'+_0x516563[_0xe063('0x37')]['filter']+'%'};return _0x1d9d26;})});}_0x9bc552=_[_0xe063('0x43')]({},_0x9bc552,_0x516563[_0xe063('0x4e')]);return _0x2ac83a[_0xe063('0x67')](_0x9bc552);}})[_0xe063('0x2a')](function(_0x204bbe){if(_0x204bbe){_0x2c7fee=_0x204bbe[_0xe063('0x3d')];if(!_0x516563[_0xe063('0x37')]['hasOwnProperty'](_0xe063('0x5d'))){_0x9bc552[_0xe063('0x22')]=qs['limit'](_0x516563['query'][_0xe063('0x22')]);_0x9bc552[_0xe063('0x20')]=qs[_0xe063('0x20')](_0x516563['query']['offset']);}return _0x2ac83a[_0xe063('0x67')](_0x9bc552);}})[_0xe063('0x2a')](function(_0x5079f9){if(_0x5079f9){return _0x5079f9?{'count':_0x2c7fee,'rows':_0x5079f9}:null;}})[_0xe063('0x2a')](respondWithResult(_0x271d75,null))[_0xe063('0x4b')](handleError(_0x271d75,null));};exports[_0xe063('0x69')]=function(_0x2eb845,_0x5e6c33,_0x1a009f){var _0x1773cb=_0x2eb845[_0xe063('0x51')][_0xe063('0x6a')];return db[_0xe063('0x68')][_0xe063('0x4a')]({'where':{'id':_0x1773cb},'attributes':['id'],'include':[{'model':db[_0xe063('0x5f')],'as':_0xe063('0x6b'),'attributes':['id','name',_0xe063('0x6c'),'voicePause','interface'],'raw':!![]}]})[_0xe063('0x2a')](function(_0x30f73f){if(_0x30f73f){var _0x41a7c6=_['flatMap'](_0x30f73f,function(_0x183962){var _0x276658=_0x183962[_0xe063('0x54')]({'plain':!![]});return _0x276658[_0xe063('0x6b')];});return db[_0xe063('0x49')]['find']({'where':{'id':_0x2eb845['params']['id']}})[_0xe063('0x2a')](function(_0x35ff79){return db['sequelize'][_0xe063('0x6d')](function(_0x3841fa){return _0x35ff79[_0xe063('0x69')](_0x1773cb,{'transaction':_0x3841fa})[_0xe063('0x2a')](function(){return BPromise[_0xe063('0x6e')](_0x41a7c6,function(_0x9d91f4){return db[_0xe063('0x5c')][_0xe063('0x6f')]({'where':{'UserId':_0x9d91f4['id'],'FaxQueueId':_0x2eb845[_0xe063('0x4d')]['id']},'transaction':_0x3841fa});});})[_0xe063('0x2a')](function(){_0x41a7c6[_0xe063('0x70')](function(_0x40615c){socket[_0xe063('0x71')](_0xe063('0x72'),{'UserId':_0x40615c['id'],'FaxQueueId':_0x35ff79['id']});});});});});}})[_0xe063('0x2a')](respondWithStatusCode(_0x5e6c33,null))[_0xe063('0x4b')](handleError(_0x5e6c33,null));};exports[_0xe063('0x73')]=function(_0x2690dd,_0x3cd5bd,_0x11cd5f){return db[_0xe063('0x68')]['findAll']({'where':{'id':_0x2690dd[_0xe063('0x37')][_0xe063('0x6a')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe063('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xe063('0x2a')](handleEntityNotFound(_0x3cd5bd,null))[_0xe063('0x2a')](function(_0x3b2252){var _0x4cf8a9=_[_0xe063('0x32')](_0x3b2252,'id');var _0x29240b=[];var _0x4777f2=[];var _0x34d02d=squel[_0xe063('0x74')]();_0x34d02d['field'](_0xe063('0x75'))[_0xe063('0x76')](_0xe063('0x77'),'tq')[_0xe063('0x78')](_0xe063('0x79'),'ut',_0xe063('0x7a'))[_0xe063('0x44')](_0xe063('0x7b'),_0x2690dd[_0xe063('0x4d')]['id']);for(var _0x9cc805=0x0;_0x9cc805<_0x3b2252[_0xe063('0x3d')];_0x9cc805+=0x1){let _0x2ff2df=_0x3b2252[_0x9cc805];for(var _0x53042c=0x0;_0x53042c<_0x2ff2df[_0xe063('0x6b')][_0xe063('0x3d')];_0x53042c+=0x1){let _0x3ecebb=_0x2ff2df['Agents'][_0x53042c];var _0x129360=_0x34d02d[_0xe063('0x7c')]();_0x129360[_0xe063('0x44')]('ut.UserId\x20=\x20?',_0x3ecebb['id']);_0x4777f2[_0xe063('0x7d')](db['sequelize'][_0xe063('0x37')](_0x129360[_0xe063('0x7e')](),{'type':db[_0xe063('0x7f')]['QueryTypes']['SELECT']})['then'](function(_0x5099af){if(_0x5099af[_0xe063('0x3d')]===0x1){return _0x3ecebb['id'];}else{var _0x361aae=_['every'](_['map'](_0x5099af,_0xe063('0x80')),function(_0x2f6fa5){return _[_0xe063('0x81')](_0x4cf8a9,_0x2f6fa5);});if(_0x361aae){return _0x3ecebb['id'];}}}));}}return BPromise[_0xe063('0x82')](_0x4777f2)['then'](function(_0xec2b0a){_0x29240b=_(_0x29240b)[_0xe063('0x83')](_0xec2b0a)[_0xe063('0x84')]()['value']();return db[_0xe063('0x49')][_0xe063('0x4f')]({'where':{'id':_0x2690dd[_0xe063('0x4d')]['id']}})[_0xe063('0x2a')](function(_0x372030){return db[_0xe063('0x7f')][_0xe063('0x6d')](function(_0x20b1c6){return _0x372030[_0xe063('0x73')](_0x2690dd[_0xe063('0x37')]['ids'],{'transaction':_0x20b1c6})[_0xe063('0x2a')](function(){if(!_[_0xe063('0x85')](_0x29240b)){return _0x372030[_0xe063('0x86')](_0x29240b,{'transaction':_0x20b1c6});}})['then'](function(){_0x29240b[_0xe063('0x70')](function(_0x26486a){socket[_0xe063('0x71')](_0xe063('0x87'),{'UserId':_0x26486a,'FaxQueueId':_0x372030['id']});});});});});});})[_0xe063('0x2a')](respondWithStatusCode(_0x3cd5bd,null))['catch'](handleError(_0x3cd5bd,null));};exports['addAgents']=function(_0x1a641f,_0x3b85b2,_0x25509f){return db[_0xe063('0x49')][_0xe063('0x4f')]({'where':{'id':_0x1a641f[_0xe063('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3b85b2,null))[_0xe063('0x2a')](function(_0x217d8d){if(_0x217d8d){return _0x217d8d[_0xe063('0x88')](_0x1a641f['body'][_0xe063('0x6a')],_['omit'](_0x1a641f['body'],[_0xe063('0x6a'),'id'])||{})[_0xe063('0x89')](function(_0x197793){for(var _0x5d79d5=0x0;_0x5d79d5<_0x1a641f[_0xe063('0x51')][_0xe063('0x6a')][_0xe063('0x3d')];_0x5d79d5+=0x1){socket[_0xe063('0x71')](_0xe063('0x72'),{'UserId':Number(_0x1a641f[_0xe063('0x51')][_0xe063('0x6a')][_0x5d79d5]),'FaxQueueId':Number(_0x1a641f['params']['id'])});}return _0x197793;});}})[_0xe063('0x2a')](respondWithResult(_0x3b85b2,null))['catch'](handleError(_0x3b85b2,null));};exports[_0xe063('0x86')]=function(_0x1aefaa,_0x5a3d6b,_0x481b9c){return db[_0xe063('0x49')][_0xe063('0x4f')]({'where':{'id':_0x1aefaa['params']['id']}})['then'](handleEntityNotFound(_0x5a3d6b,null))['then'](function(_0x5d1c4d){if(_0x5d1c4d){return _0x5d1c4d[_0xe063('0x86')](_0x1aefaa[_0xe063('0x37')][_0xe063('0x6a')])[_0xe063('0x2a')](function(){if(_[_0xe063('0x8a')](_0x1aefaa[_0xe063('0x37')][_0xe063('0x6a')])){for(var _0x282827=0x0;_0x282827<_0x1aefaa[_0xe063('0x37')][_0xe063('0x6a')][_0xe063('0x3d')];_0x282827+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x1aefaa['query'][_0xe063('0x6a')][_0x282827]),'FaxQueueId':Number(_0x1aefaa[_0xe063('0x4d')]['id'])});}}else{socket[_0xe063('0x71')]('userFaxQueue:remove',{'UserId':Number(_0x1aefaa[_0xe063('0x37')][_0xe063('0x6a')]),'FaxQueueId':Number(_0x1aefaa[_0xe063('0x4d')]['id'])});}});}})[_0xe063('0x2a')](respondWithStatusCode(_0x5a3d6b,null))[_0xe063('0x4b')](handleError(_0x5a3d6b,null));};exports[_0xe063('0x8b')]=function(_0xa0b637,_0x53b2b4,_0x53f1da){var _0x1cf8b0={};var _0x5557ac={};var _0x13aec7;var _0x501a0f;return db[_0xe063('0x49')][_0xe063('0x5b')]({'where':{'id':_0xa0b637[_0xe063('0x4d')]['id']}})['then'](handleEntityNotFound(_0x53b2b4,null))[_0xe063('0x2a')](function(_0x4fa5c4){if(_0x4fa5c4){_0x13aec7=_0x4fa5c4;_0x5557ac[_0xe063('0x36')]=_[_0xe063('0x38')](db[_0xe063('0x5f')][_0xe063('0x33')]);_0x5557ac['query']=_[_0xe063('0x38')](_0xa0b637[_0xe063('0x37')]);_0x5557ac[_0xe063('0x39')]=_[_0xe063('0x3a')](_0x5557ac[_0xe063('0x36')],_0x5557ac['query']);_0x1cf8b0[_0xe063('0x3c')]=_[_0xe063('0x3a')](_0x5557ac[_0xe063('0x36')],qs[_0xe063('0x3b')](_0xa0b637[_0xe063('0x37')][_0xe063('0x3b')]));_0x1cf8b0[_0xe063('0x3c')]=_0x1cf8b0[_0xe063('0x3c')][_0xe063('0x3d')]?_0x1cf8b0['attributes']:_0x5557ac[_0xe063('0x36')];_0x1cf8b0[_0xe063('0x3f')]=qs['sort'](_0xa0b637['query'][_0xe063('0x40')]);_0x1cf8b0[_0xe063('0x44')]=qs['filters'](_[_0xe063('0x41')](_0xa0b637[_0xe063('0x37')],_0x5557ac[_0xe063('0x39')]));if(_0xa0b637[_0xe063('0x37')][_0xe063('0x42')]){_0x1cf8b0[_0xe063('0x44')]=_['merge'](_0x1cf8b0[_0xe063('0x44')],{'$or':_['map'](_0x1cf8b0[_0xe063('0x3c')],function(_0x338abf){var _0x483473={};_0x483473[_0x338abf]={'$like':'%'+_0xa0b637[_0xe063('0x37')][_0xe063('0x42')]+'%'};return _0x483473;})});}_0x1cf8b0=_['merge']({},_0x1cf8b0,_0xa0b637[_0xe063('0x4e')]);return _0x13aec7[_0xe063('0x8b')](_0x1cf8b0);}})['then'](function(_0x50fc45){if(_0x50fc45){_0x501a0f=_0x50fc45['length'];if(!_0xa0b637['query'][_0xe063('0x3e')](_0xe063('0x5d'))){_0x1cf8b0[_0xe063('0x22')]=qs['limit'](_0xa0b637[_0xe063('0x37')][_0xe063('0x22')]);_0x1cf8b0[_0xe063('0x20')]=qs[_0xe063('0x20')](_0xa0b637[_0xe063('0x37')]['offset']);}return _0x13aec7['getAgents'](_0x1cf8b0);}})[_0xe063('0x2a')](function(_0x13be36){if(_0x13be36){return _0x13be36?{'count':_0x501a0f,'rows':_0x13be36}:null;}})[_0xe063('0x2a')](respondWithResult(_0x53b2b4,null))[_0xe063('0x4b')](handleError(_0x53b2b4,null));}; \ No newline at end of file +var _0x1a33=['team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','all','union','compact','value','removeTeams','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','redis','defaults','./faxQueue.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','destroy','get','FaxQueues','UserProfileResource','then','error','name','send','index','map','FaxQueue','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','order','sort','pick','merge','where','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','describe','getMembers','findOne','hasOwnProperty','nolimit','FaxQueueId','filter','options','UserFaxQueue','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','SIP','getTeams','Team','ids','Agents','voicePause','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userFaxQueue:save','select','field','tq.TeamId','from'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1a33,0x1bb));var _0x31a3=function(_0x29a0aa,_0x264e19){_0x29a0aa=_0x29a0aa-0x0;var _0x41c74f=_0x1a33[_0x29a0aa];return _0x41c74f;};'use strict';var emlformat=require(_0x31a3('0x0'));var rimraf=require(_0x31a3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x31a3('0x2'));var moment=require('moment');var BPromise=require(_0x31a3('0x3'));var Mustache=require(_0x31a3('0x4'));var util=require(_0x31a3('0x5'));var path=require(_0x31a3('0x6'));var sox=require(_0x31a3('0x7'));var csv=require(_0x31a3('0x8'));var ejs=require(_0x31a3('0x9'));var fs=require('fs');var fs_extra=require(_0x31a3('0xa'));var _=require('lodash');var squel=require(_0x31a3('0xb'));var crypto=require(_0x31a3('0xc'));var jsforce=require(_0x31a3('0xd'));var deskjs=require(_0x31a3('0xe'));var toCsv=require('to-csv');var querystring=require(_0x31a3('0xf'));var Papa=require(_0x31a3('0x10'));var Redis=require('ioredis');var authService=require(_0x31a3('0x11'));var qs=require(_0x31a3('0x12'));var as=require(_0x31a3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x31a3('0x14'));var utils=require(_0x31a3('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x31a3('0x16'))['db'];config[_0x31a3('0x17')]=_[_0x31a3('0x18')](config[_0x31a3('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x31a3('0x19'))[_0x31a3('0x1a')](socket);function respondWithStatusCode(_0x4d7ab1,_0x366483){_0x366483=_0x366483||0xcc;return function(_0x18fd77){if(_0x18fd77){return _0x4d7ab1[_0x31a3('0x1b')](_0x366483);}return _0x4d7ab1[_0x31a3('0x1c')](_0x366483)[_0x31a3('0x1d')]();};}function respondWithResult(_0x4e0b2a,_0x2ce5b2){_0x2ce5b2=_0x2ce5b2||0xc8;return function(_0x14daf3){if(_0x14daf3){return _0x4e0b2a[_0x31a3('0x1c')](_0x2ce5b2)[_0x31a3('0x1e')](_0x14daf3);}};}function respondWithFilteredResult(_0x4d096f,_0x3c4a4b){return function(_0x17d4b1){if(_0x17d4b1){var _0x26c956=typeof _0x3c4a4b['offset']===_0x31a3('0x1f')&&typeof _0x3c4a4b[_0x31a3('0x20')]===_0x31a3('0x1f');var _0x3ab672=_0x17d4b1[_0x31a3('0x21')];var _0x3a95a6=_0x26c956?0x0:_0x3c4a4b[_0x31a3('0x22')];var _0x55a71d=_0x26c956?_0x17d4b1[_0x31a3('0x21')]:_0x3c4a4b[_0x31a3('0x22')]+_0x3c4a4b[_0x31a3('0x20')];var _0x1e5ef9;if(_0x55a71d>=_0x3ab672){_0x55a71d=_0x3ab672;_0x1e5ef9=0xc8;}else{_0x1e5ef9=0xce;}_0x4d096f[_0x31a3('0x1c')](_0x1e5ef9);return _0x4d096f[_0x31a3('0x23')](_0x31a3('0x24'),_0x3a95a6+'-'+_0x55a71d+'/'+_0x3ab672)[_0x31a3('0x1e')](_0x17d4b1);}return null;};}function patchUpdates(_0x5ab230){return function(_0x28772d){try{jsonpatch[_0x31a3('0x25')](_0x28772d,_0x5ab230,!![]);}catch(_0x4e5b17){return BPromise[_0x31a3('0x26')](_0x4e5b17);}return _0x28772d['save']();};}function saveUpdates(_0x43a826,_0x3d3fe7){return function(_0x1d0057){if(_0x1d0057){return _0x1d0057[_0x31a3('0x27')](_0x43a826)['then'](function(_0x5249b8){return _0x5249b8;});}return null;};}function removeEntity(_0x572d2b,_0x26a164){return function(_0x563f09){if(_0x563f09){return _0x563f09[_0x31a3('0x28')]()['then'](function(){var _0x43582a=_0x563f09[_0x31a3('0x29')]({'plain':!![]});var _0x28451c=_0x31a3('0x2a');return db[_0x31a3('0x2b')][_0x31a3('0x28')]({'where':{'type':_0x28451c,'resourceId':_0x43582a['id']}})['then'](function(){return _0x563f09;});})[_0x31a3('0x2c')](function(){_0x572d2b[_0x31a3('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4282c6,_0x143ed3){return function(_0x3e4ef5){if(!_0x3e4ef5){_0x4282c6[_0x31a3('0x1b')](0x194);}return _0x3e4ef5;};}function handleError(_0x2f8ab0,_0x529b3f){_0x529b3f=_0x529b3f||0x1f4;return function(_0x4c5c0b){logger[_0x31a3('0x2d')](_0x4c5c0b['stack']);if(_0x4c5c0b[_0x31a3('0x2e')]){delete _0x4c5c0b[_0x31a3('0x2e')];}_0x2f8ab0[_0x31a3('0x1c')](_0x529b3f)[_0x31a3('0x2f')](_0x4c5c0b);};}exports[_0x31a3('0x30')]=function(_0x70d049,_0x23b600){var _0x478246={},_0x5c001f={},_0x562720={'count':0x0,'rows':[]};var _0x5ce15b=_[_0x31a3('0x31')](db[_0x31a3('0x32')][_0x31a3('0x33')],function(_0x40838b){return{'name':_0x40838b['fieldName'],'type':_0x40838b[_0x31a3('0x34')][_0x31a3('0x35')]};});_0x5c001f[_0x31a3('0x36')]=_[_0x31a3('0x31')](_0x5ce15b,_0x31a3('0x2e'));_0x5c001f[_0x31a3('0x37')]=_['keys'](_0x70d049[_0x31a3('0x37')]);_0x5c001f[_0x31a3('0x38')]=_[_0x31a3('0x39')](_0x5c001f[_0x31a3('0x36')],_0x5c001f[_0x31a3('0x37')]);_0x478246['attributes']=_['intersection'](_0x5c001f['model'],qs[_0x31a3('0x3a')](_0x70d049[_0x31a3('0x37')][_0x31a3('0x3a')]));_0x478246[_0x31a3('0x3b')]=_0x478246[_0x31a3('0x3b')][_0x31a3('0x3c')]?_0x478246[_0x31a3('0x3b')]:_0x5c001f[_0x31a3('0x36')];if(!_0x70d049[_0x31a3('0x37')]['hasOwnProperty']('nolimit')){_0x478246[_0x31a3('0x20')]=qs[_0x31a3('0x20')](_0x70d049[_0x31a3('0x37')][_0x31a3('0x20')]);_0x478246[_0x31a3('0x22')]=qs[_0x31a3('0x22')](_0x70d049[_0x31a3('0x37')][_0x31a3('0x22')]);}_0x478246[_0x31a3('0x3d')]=qs[_0x31a3('0x3e')](_0x70d049['query'][_0x31a3('0x3e')]);_0x478246['where']=qs[_0x31a3('0x38')](_[_0x31a3('0x3f')](_0x70d049[_0x31a3('0x37')],_0x5c001f[_0x31a3('0x38')]),_0x5ce15b);if(_0x70d049[_0x31a3('0x37')]['filter']){_0x478246['where']=_[_0x31a3('0x40')](_0x478246[_0x31a3('0x41')],{'$or':_[_0x31a3('0x31')](_0x5ce15b,function(_0x3ff574){if(_0x3ff574[_0x31a3('0x34')]!=='VIRTUAL'){var _0x3c3b90={};_0x3c3b90[_0x3ff574[_0x31a3('0x2e')]]={'$like':'%'+_0x70d049['query']['filter']+'%'};return _0x3c3b90;}})});}_0x478246=_['merge']({},_0x478246,_0x70d049['options']);var _0x678d9b={'where':_0x478246[_0x31a3('0x41')]};return db[_0x31a3('0x32')][_0x31a3('0x21')](_0x678d9b)[_0x31a3('0x2c')](function(_0x3e0f78){_0x562720[_0x31a3('0x21')]=_0x3e0f78;if(_0x70d049[_0x31a3('0x37')][_0x31a3('0x42')]){_0x478246[_0x31a3('0x43')]=[{'all':!![]}];}return db[_0x31a3('0x32')][_0x31a3('0x44')](_0x478246);})[_0x31a3('0x2c')](function(_0x224245){_0x562720[_0x31a3('0x45')]=_0x224245;return _0x562720;})['then'](respondWithFilteredResult(_0x23b600,_0x478246))[_0x31a3('0x46')](handleError(_0x23b600,null));};exports[_0x31a3('0x47')]=function(_0x2d847c,_0x15a3b8){var _0x3ca0fd={'raw':!![],'where':{'id':_0x2d847c[_0x31a3('0x48')]['id']}},_0x22a3fe={};_0x22a3fe[_0x31a3('0x36')]=_[_0x31a3('0x49')](db[_0x31a3('0x32')][_0x31a3('0x33')]);_0x22a3fe[_0x31a3('0x37')]=_[_0x31a3('0x49')](_0x2d847c[_0x31a3('0x37')]);_0x22a3fe[_0x31a3('0x38')]=_[_0x31a3('0x39')](_0x22a3fe[_0x31a3('0x36')],_0x22a3fe[_0x31a3('0x37')]);_0x3ca0fd[_0x31a3('0x3b')]=_[_0x31a3('0x39')](_0x22a3fe['model'],qs['fields'](_0x2d847c[_0x31a3('0x37')]['fields']));_0x3ca0fd[_0x31a3('0x3b')]=_0x3ca0fd[_0x31a3('0x3b')][_0x31a3('0x3c')]?_0x3ca0fd[_0x31a3('0x3b')]:_0x22a3fe['model'];if(_0x2d847c[_0x31a3('0x37')]['includeAll']){_0x3ca0fd['include']=[{'all':!![]}];}_0x3ca0fd=_[_0x31a3('0x40')]({},_0x3ca0fd,_0x2d847c['options']);return db[_0x31a3('0x32')][_0x31a3('0x4a')](_0x3ca0fd)[_0x31a3('0x2c')](handleEntityNotFound(_0x15a3b8,null))[_0x31a3('0x2c')](respondWithResult(_0x15a3b8,null))['catch'](handleError(_0x15a3b8,null));};exports[_0x31a3('0x4b')]=function(_0x5e023b,_0x5bbcd7){return db['FaxQueue'][_0x31a3('0x4b')](_0x5e023b[_0x31a3('0x4c')],{})[_0x31a3('0x2c')](function(_0x3288a1){var _0x343a14=_0x5e023b['user'][_0x31a3('0x29')]({'plain':!![]});if(!_0x343a14)throw new Error(_0x31a3('0x4d'));if(_0x343a14[_0x31a3('0x4e')]===_0x31a3('0x4f')){var _0x582c54=_0x3288a1[_0x31a3('0x29')]({'plain':!![]});var _0x56a380=_0x31a3('0x2a');return db['UserProfileSection'][_0x31a3('0x4a')]({'where':{'name':_0x56a380,'userProfileId':_0x343a14[_0x31a3('0x50')]},'raw':!![]})[_0x31a3('0x2c')](function(_0x16bf32){if(_0x16bf32&&_0x16bf32[_0x31a3('0x51')]===0x0){return db[_0x31a3('0x2b')][_0x31a3('0x4b')]({'name':_0x582c54[_0x31a3('0x2e')],'resourceId':_0x582c54['id'],'type':_0x16bf32[_0x31a3('0x2e')],'sectionId':_0x16bf32['id']},{})[_0x31a3('0x2c')](function(){return _0x3288a1;});}else{return _0x3288a1;}})[_0x31a3('0x46')](function(_0x587abc){logger[_0x31a3('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x587abc);throw _0x587abc;});}return _0x3288a1;})[_0x31a3('0x2c')](respondWithResult(_0x5bbcd7,0xc9))[_0x31a3('0x46')](handleError(_0x5bbcd7,null));};exports[_0x31a3('0x27')]=function(_0x4dd6d6,_0x31c153){if(_0x4dd6d6['body']['id']){delete _0x4dd6d6[_0x31a3('0x4c')]['id'];}return db[_0x31a3('0x32')]['find']({'where':{'id':_0x4dd6d6[_0x31a3('0x48')]['id']}})[_0x31a3('0x2c')](handleEntityNotFound(_0x31c153,null))[_0x31a3('0x2c')](saveUpdates(_0x4dd6d6['body'],null))['then'](respondWithResult(_0x31c153,null))['catch'](handleError(_0x31c153,null));};exports[_0x31a3('0x28')]=function(_0x495baf,_0x179e7d){return db[_0x31a3('0x32')][_0x31a3('0x4a')]({'where':{'id':_0x495baf[_0x31a3('0x48')]['id']}})[_0x31a3('0x2c')](handleEntityNotFound(_0x179e7d,null))[_0x31a3('0x2c')](removeEntity(_0x179e7d,null))['catch'](handleError(_0x179e7d,null));};exports[_0x31a3('0x52')]=function(_0x56b2f4,_0x32c261){return db[_0x31a3('0x32')][_0x31a3('0x52')]()[_0x31a3('0x2c')](respondWithResult(_0x32c261,null))['catch'](handleError(_0x32c261,null));};exports[_0x31a3('0x53')]=function(_0x4097df,_0x29a5f0,_0x349bf0){var _0xb391d3={'raw':!![],'where':{}},_0x31f045={},_0x5e6036;return db[_0x31a3('0x32')][_0x31a3('0x54')]({'where':{'id':_0x4097df[_0x31a3('0x48')]['id']}})[_0x31a3('0x2c')](handleEntityNotFound(_0x29a5f0,null))[_0x31a3('0x2c')](function(_0x3d8a10){if(_0x3d8a10){_0x5e6036=_0x3d8a10['get']({'plain':!![]});_0x31f045[_0x31a3('0x36')]=_[_0x31a3('0x49')](db['UserFaxQueue'][_0x31a3('0x33')]);_0x31f045['query']=_['keys'](_0x4097df[_0x31a3('0x37')]);_0x31f045[_0x31a3('0x38')]=_['intersection'](_0x31f045[_0x31a3('0x36')],_0x31f045[_0x31a3('0x37')]);_0xb391d3[_0x31a3('0x3b')]=_[_0x31a3('0x39')](_0x31f045[_0x31a3('0x36')],qs[_0x31a3('0x3a')](_0x4097df[_0x31a3('0x37')][_0x31a3('0x3a')]));_0xb391d3[_0x31a3('0x3b')]=_0xb391d3['attributes']['length']?_0xb391d3['attributes']:_0x31f045[_0x31a3('0x36')];if(!_0x4097df[_0x31a3('0x37')][_0x31a3('0x55')](_0x31a3('0x56'))){_0xb391d3['limit']=qs['limit'](_0x4097df[_0x31a3('0x37')]['limit']);_0xb391d3[_0x31a3('0x22')]=qs[_0x31a3('0x22')](_0x4097df['query'][_0x31a3('0x22')]);}_0xb391d3[_0x31a3('0x3d')]=qs['sort'](_0x4097df[_0x31a3('0x37')][_0x31a3('0x3e')]);_0xb391d3[_0x31a3('0x41')]=qs[_0x31a3('0x38')](_['pick'](_0x4097df[_0x31a3('0x37')],_0x31f045[_0x31a3('0x38')]));_0xb391d3[_0x31a3('0x41')][_0x31a3('0x57')]=_0x3d8a10['id'];if(_0x4097df['query'][_0x31a3('0x58')]){_0xb391d3['where']=_[_0x31a3('0x40')](_0xb391d3[_0x31a3('0x41')],{'$or':_[_0x31a3('0x31')](_0xb391d3[_0x31a3('0x3b')],function(_0x5b799d){var _0x5ae1f8={};_0x5ae1f8[_0x5b799d]={'$like':'%'+_0x4097df[_0x31a3('0x37')][_0x31a3('0x58')]+'%'};return _0x5ae1f8;})});}_0xb391d3=_[_0x31a3('0x40')]({},_0xb391d3,_0x4097df[_0x31a3('0x59')]);return db[_0x31a3('0x5a')][_0x31a3('0x44')](_0xb391d3);}})['then'](function(_0x5b603a){if(_0x5b603a){return db[_0x31a3('0x5b')][_0x31a3('0x5c')]({'where':{'id':_[_0x31a3('0x31')](_0x5b603a,_0x31a3('0x5d')),'role':_0x31a3('0x5e')},'attributes':['id','name',_0x31a3('0x5f'),_0x31a3('0x60'),_0x31a3('0x61')]});}})[_0x31a3('0x2c')](function(_0x2f700b){if(_0x2f700b){return{'count':_0x2f700b[_0x31a3('0x21')],'rows':_[_0x31a3('0x31')](_0x2f700b['rows'],function(_0x3cf57f){return{'membername':_0x3cf57f[_0x31a3('0x2e')],'UserId':_0x3cf57f['id'],'queue_name':_0x5e6036[_0x31a3('0x2e')],'FaxQueueId':_0x5e6036['id'],'interface':util['format']('%s/%s',_0x31a3('0x62'),_0x3cf57f[_0x31a3('0x2e')]),'penalty':0x0,'paused':_0x3cf57f[_0x31a3('0x5f')],'createdAt':_0x3cf57f[_0x31a3('0x61')],'updatedAt':_0x3cf57f[_0x31a3('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x31a3('0x2c')](respondWithFilteredResult(_0x29a5f0,_0xb391d3))['catch'](handleError(_0x29a5f0,null));};exports[_0x31a3('0x63')]=function(_0xbf7ded,_0x3cc92f,_0x3288f6){var _0x11fd0d={};var _0x59c6df={};var _0x20a679;var _0x2f724b;return db['FaxQueue'][_0x31a3('0x54')]({'where':{'id':_0xbf7ded[_0x31a3('0x48')]['id']}})[_0x31a3('0x2c')](handleEntityNotFound(_0x3cc92f,null))[_0x31a3('0x2c')](function(_0x1771bd){if(_0x1771bd){_0x20a679=_0x1771bd;_0x59c6df[_0x31a3('0x36')]=_[_0x31a3('0x49')](db[_0x31a3('0x64')][_0x31a3('0x33')]);_0x59c6df[_0x31a3('0x37')]=_[_0x31a3('0x49')](_0xbf7ded['query']);_0x59c6df[_0x31a3('0x38')]=_[_0x31a3('0x39')](_0x59c6df[_0x31a3('0x36')],_0x59c6df[_0x31a3('0x37')]);_0x11fd0d[_0x31a3('0x3b')]=_['intersection'](_0x59c6df[_0x31a3('0x36')],qs[_0x31a3('0x3a')](_0xbf7ded[_0x31a3('0x37')][_0x31a3('0x3a')]));_0x11fd0d[_0x31a3('0x3b')]=_0x11fd0d[_0x31a3('0x3b')][_0x31a3('0x3c')]?_0x11fd0d[_0x31a3('0x3b')]:_0x59c6df[_0x31a3('0x36')];_0x11fd0d[_0x31a3('0x3d')]=qs[_0x31a3('0x3e')](_0xbf7ded[_0x31a3('0x37')][_0x31a3('0x3e')]);_0x11fd0d['where']=qs[_0x31a3('0x38')](_[_0x31a3('0x3f')](_0xbf7ded[_0x31a3('0x37')],_0x59c6df[_0x31a3('0x38')]));if(_0xbf7ded['query']['filter']){_0x11fd0d[_0x31a3('0x41')]=_[_0x31a3('0x40')](_0x11fd0d[_0x31a3('0x41')],{'$or':_['map'](_0x11fd0d[_0x31a3('0x3b')],function(_0x357728){var _0x2be53a={};_0x2be53a[_0x357728]={'$like':'%'+_0xbf7ded[_0x31a3('0x37')][_0x31a3('0x58')]+'%'};return _0x2be53a;})});}_0x11fd0d=_['merge']({},_0x11fd0d,_0xbf7ded[_0x31a3('0x59')]);return _0x20a679[_0x31a3('0x63')](_0x11fd0d);}})[_0x31a3('0x2c')](function(_0x295356){if(_0x295356){_0x2f724b=_0x295356[_0x31a3('0x3c')];if(!_0xbf7ded['query']['hasOwnProperty'](_0x31a3('0x56'))){_0x11fd0d[_0x31a3('0x20')]=qs['limit'](_0xbf7ded[_0x31a3('0x37')]['limit']);_0x11fd0d['offset']=qs[_0x31a3('0x22')](_0xbf7ded[_0x31a3('0x37')]['offset']);}return _0x20a679[_0x31a3('0x63')](_0x11fd0d);}})[_0x31a3('0x2c')](function(_0x224af3){if(_0x224af3){return _0x224af3?{'count':_0x2f724b,'rows':_0x224af3}:null;}})[_0x31a3('0x2c')](respondWithResult(_0x3cc92f,null))[_0x31a3('0x46')](handleError(_0x3cc92f,null));};exports['addTeams']=function(_0x2734a0,_0x4bbb69,_0xc125ec){var _0x1d7bf4=_0x2734a0[_0x31a3('0x4c')][_0x31a3('0x65')];return db[_0x31a3('0x64')]['findAll']({'where':{'id':_0x1d7bf4},'attributes':['id'],'include':[{'model':db[_0x31a3('0x5b')],'as':_0x31a3('0x66'),'attributes':['id','name','online',_0x31a3('0x67'),'interface'],'raw':!![]}]})[_0x31a3('0x2c')](function(_0x220b74){if(_0x220b74){var _0x41852f=_[_0x31a3('0x68')](_0x220b74,function(_0x17c2d4){var _0x206933=_0x17c2d4[_0x31a3('0x29')]({'plain':!![]});return _0x206933['Agents'];});return db[_0x31a3('0x32')]['find']({'where':{'id':_0x2734a0[_0x31a3('0x48')]['id']}})[_0x31a3('0x2c')](function(_0x275119){return db[_0x31a3('0x69')][_0x31a3('0x6a')](function(_0x5eab2a){return _0x275119[_0x31a3('0x6b')](_0x1d7bf4,{'transaction':_0x5eab2a})[_0x31a3('0x2c')](function(){return BPromise[_0x31a3('0x6c')](_0x41852f,function(_0x3a86ea){return db['UserFaxQueue'][_0x31a3('0x6d')]({'where':{'UserId':_0x3a86ea['id'],'FaxQueueId':_0x2734a0[_0x31a3('0x48')]['id']},'transaction':_0x5eab2a});});})[_0x31a3('0x2c')](function(){_0x41852f[_0x31a3('0x6e')](function(_0x4d1697){socket[_0x31a3('0x6f')](_0x31a3('0x70'),{'UserId':_0x4d1697['id'],'FaxQueueId':_0x275119['id']});});});});});}})[_0x31a3('0x2c')](respondWithStatusCode(_0x4bbb69,null))[_0x31a3('0x46')](handleError(_0x4bbb69,null));};exports['removeTeams']=function(_0x573a4b,_0x3ad802,_0x5a9fbc){return db[_0x31a3('0x64')][_0x31a3('0x44')]({'where':{'id':_0x573a4b['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x31a3('0x5b')],'as':_0x31a3('0x66'),'attributes':['id'],'raw':!![]}]})[_0x31a3('0x2c')](handleEntityNotFound(_0x3ad802,null))[_0x31a3('0x2c')](function(_0x451842){var _0x5516f4=_['map'](_0x451842,'id');var _0x42aed6=[];var _0x477ea0=[];var _0x14b37a=squel[_0x31a3('0x71')]();_0x14b37a[_0x31a3('0x72')](_0x31a3('0x73'))[_0x31a3('0x74')](_0x31a3('0x75'),'tq')['join'](_0x31a3('0x76'),'ut',_0x31a3('0x77'))['where'](_0x31a3('0x78'),_0x573a4b['params']['id']);for(var _0x2b77b6=0x0;_0x2b77b6<_0x451842[_0x31a3('0x3c')];_0x2b77b6+=0x1){let _0x20a5fb=_0x451842[_0x2b77b6];for(var _0x3e2d06=0x0;_0x3e2d06<_0x20a5fb[_0x31a3('0x66')][_0x31a3('0x3c')];_0x3e2d06+=0x1){let _0x481e7e=_0x20a5fb[_0x31a3('0x66')][_0x3e2d06];var _0x4398e8=_0x14b37a[_0x31a3('0x79')]();_0x4398e8[_0x31a3('0x41')](_0x31a3('0x7a'),_0x481e7e['id']);_0x477ea0[_0x31a3('0x7b')](db[_0x31a3('0x69')][_0x31a3('0x37')](_0x4398e8[_0x31a3('0x7c')](),{'type':db['sequelize'][_0x31a3('0x7d')]['SELECT']})[_0x31a3('0x2c')](function(_0x30f53a){if(_0x30f53a[_0x31a3('0x3c')]===0x1){return _0x481e7e['id'];}else{var _0x444fac=_[_0x31a3('0x7e')](_[_0x31a3('0x31')](_0x30f53a,'TeamId'),function(_0x39fbf9){return _['includes'](_0x5516f4,_0x39fbf9);});if(_0x444fac){return _0x481e7e['id'];}}}));}}return BPromise[_0x31a3('0x7f')](_0x477ea0)[_0x31a3('0x2c')](function(_0x57ce1e){_0x42aed6=_(_0x42aed6)[_0x31a3('0x80')](_0x57ce1e)[_0x31a3('0x81')]()[_0x31a3('0x82')]();return db[_0x31a3('0x32')][_0x31a3('0x4a')]({'where':{'id':_0x573a4b[_0x31a3('0x48')]['id']}})[_0x31a3('0x2c')](function(_0x3eec28){return db[_0x31a3('0x69')]['transaction'](function(_0x293c58){return _0x3eec28[_0x31a3('0x83')](_0x573a4b['query'][_0x31a3('0x65')],{'transaction':_0x293c58})[_0x31a3('0x2c')](function(){if(!_[_0x31a3('0x84')](_0x42aed6)){return _0x3eec28[_0x31a3('0x85')](_0x42aed6,{'transaction':_0x293c58});}})['then'](function(){_0x42aed6[_0x31a3('0x6e')](function(_0x2783d7){socket[_0x31a3('0x6f')](_0x31a3('0x86'),{'UserId':_0x2783d7,'FaxQueueId':_0x3eec28['id']});});});});});});})[_0x31a3('0x2c')](respondWithStatusCode(_0x3ad802,null))[_0x31a3('0x46')](handleError(_0x3ad802,null));};exports[_0x31a3('0x87')]=function(_0x557183,_0x1f9487,_0x4c9f52){return db[_0x31a3('0x32')][_0x31a3('0x4a')]({'where':{'id':_0x557183[_0x31a3('0x48')]['id']}})[_0x31a3('0x2c')](handleEntityNotFound(_0x1f9487,null))[_0x31a3('0x2c')](function(_0x1a34f8){if(_0x1a34f8){return _0x1a34f8[_0x31a3('0x87')](_0x557183[_0x31a3('0x4c')]['ids'],_[_0x31a3('0x88')](_0x557183[_0x31a3('0x4c')],['ids','id'])||{})[_0x31a3('0x89')](function(_0x563501){for(var _0x1ef2e7=0x0;_0x1ef2e7<_0x557183[_0x31a3('0x4c')]['ids'][_0x31a3('0x3c')];_0x1ef2e7+=0x1){socket['emit'](_0x31a3('0x70'),{'UserId':Number(_0x557183['body'][_0x31a3('0x65')][_0x1ef2e7]),'FaxQueueId':Number(_0x557183['params']['id'])});}return _0x563501;});}})[_0x31a3('0x2c')](respondWithResult(_0x1f9487,null))['catch'](handleError(_0x1f9487,null));};exports[_0x31a3('0x85')]=function(_0x264341,_0x1e2615,_0x151f4f){return db[_0x31a3('0x32')]['find']({'where':{'id':_0x264341[_0x31a3('0x48')]['id']}})[_0x31a3('0x2c')](handleEntityNotFound(_0x1e2615,null))[_0x31a3('0x2c')](function(_0x486113){if(_0x486113){return _0x486113[_0x31a3('0x85')](_0x264341[_0x31a3('0x37')]['ids'])['then'](function(){if(_[_0x31a3('0x8a')](_0x264341[_0x31a3('0x37')][_0x31a3('0x65')])){for(var _0x4c4d57=0x0;_0x4c4d57<_0x264341[_0x31a3('0x37')][_0x31a3('0x65')][_0x31a3('0x3c')];_0x4c4d57+=0x1){socket[_0x31a3('0x6f')]('userFaxQueue:remove',{'UserId':Number(_0x264341[_0x31a3('0x37')]['ids'][_0x4c4d57]),'FaxQueueId':Number(_0x264341[_0x31a3('0x48')]['id'])});}}else{socket[_0x31a3('0x6f')](_0x31a3('0x86'),{'UserId':Number(_0x264341[_0x31a3('0x37')]['ids']),'FaxQueueId':Number(_0x264341[_0x31a3('0x48')]['id'])});}});}})[_0x31a3('0x2c')](respondWithStatusCode(_0x1e2615,null))[_0x31a3('0x46')](handleError(_0x1e2615,null));};exports[_0x31a3('0x8b')]=function(_0x5ed145,_0x4f3eda,_0x1afc5d){var _0x5c1967={};var _0x1ee5d4={};var _0xa46552;var _0x314212;return db[_0x31a3('0x32')][_0x31a3('0x54')]({'where':{'id':_0x5ed145[_0x31a3('0x48')]['id']}})[_0x31a3('0x2c')](handleEntityNotFound(_0x4f3eda,null))[_0x31a3('0x2c')](function(_0x1dceed){if(_0x1dceed){_0xa46552=_0x1dceed;_0x1ee5d4['model']=_[_0x31a3('0x49')](db[_0x31a3('0x5b')][_0x31a3('0x33')]);_0x1ee5d4[_0x31a3('0x37')]=_[_0x31a3('0x49')](_0x5ed145[_0x31a3('0x37')]);_0x1ee5d4[_0x31a3('0x38')]=_[_0x31a3('0x39')](_0x1ee5d4[_0x31a3('0x36')],_0x1ee5d4[_0x31a3('0x37')]);_0x5c1967[_0x31a3('0x3b')]=_[_0x31a3('0x39')](_0x1ee5d4[_0x31a3('0x36')],qs['fields'](_0x5ed145[_0x31a3('0x37')][_0x31a3('0x3a')]));_0x5c1967[_0x31a3('0x3b')]=_0x5c1967[_0x31a3('0x3b')][_0x31a3('0x3c')]?_0x5c1967[_0x31a3('0x3b')]:_0x1ee5d4[_0x31a3('0x36')];_0x5c1967[_0x31a3('0x3d')]=qs['sort'](_0x5ed145[_0x31a3('0x37')]['sort']);_0x5c1967[_0x31a3('0x41')]=qs[_0x31a3('0x38')](_['pick'](_0x5ed145[_0x31a3('0x37')],_0x1ee5d4[_0x31a3('0x38')]));if(_0x5ed145[_0x31a3('0x37')]['filter']){_0x5c1967[_0x31a3('0x41')]=_[_0x31a3('0x40')](_0x5c1967['where'],{'$or':_[_0x31a3('0x31')](_0x5c1967[_0x31a3('0x3b')],function(_0x1854b1){var _0x46d8f1={};_0x46d8f1[_0x1854b1]={'$like':'%'+_0x5ed145['query'][_0x31a3('0x58')]+'%'};return _0x46d8f1;})});}_0x5c1967=_['merge']({},_0x5c1967,_0x5ed145[_0x31a3('0x59')]);return _0xa46552[_0x31a3('0x8b')](_0x5c1967);}})['then'](function(_0xc8b872){if(_0xc8b872){_0x314212=_0xc8b872[_0x31a3('0x3c')];if(!_0x5ed145[_0x31a3('0x37')][_0x31a3('0x55')]('nolimit')){_0x5c1967['limit']=qs['limit'](_0x5ed145[_0x31a3('0x37')]['limit']);_0x5c1967[_0x31a3('0x22')]=qs[_0x31a3('0x22')](_0x5ed145[_0x31a3('0x37')][_0x31a3('0x22')]);}return _0xa46552[_0x31a3('0x8b')](_0x5c1967);}})[_0x31a3('0x2c')](function(_0x271342){if(_0x271342){return _0x271342?{'count':_0x314212,'rows':_0x271342}:null;}})[_0x31a3('0x2c')](respondWithResult(_0x4f3eda,null))[_0x31a3('0x46')](handleError(_0x4f3eda,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 5c2b331..6672ee2 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 _0x7142=['exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x1c101f,_0x52141d){var _0xe02ee4=function(_0x1d9034){while(--_0x1d9034){_0x1c101f['push'](_0x1c101f['shift']());}};_0xe02ee4(++_0x52141d);}(_0x7142,0x155));var _0x2714=function(_0x476f68,_0x59dcbd){_0x476f68=_0x476f68-0x0;var _0xdf1b61=_0x7142[_0x476f68];return _0xdf1b61;};'use strict';var EventEmitter=require(_0x2714('0x0'));var FaxQueue=require(_0x2714('0x1'))['db'][_0x2714('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x2714('0x3')](0x0);var events={'afterCreate':_0x2714('0x4'),'afterUpdate':_0x2714('0x5'),'afterDestroy':_0x2714('0x6')};function emitEvent(_0x50c20d){return function(_0x54732c,_0x78955b,_0x5db577){FaxQueueEvents[_0x2714('0x7')](_0x50c20d+':'+_0x54732c['id'],_0x54732c);FaxQueueEvents['emit'](_0x50c20d,_0x54732c);_0x5db577(null);};}for(var e in events){if(events[_0x2714('0x8')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x2714('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0x0f66=['exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x383356,_0x33d2f5){var _0x32ee5a=function(_0x2741db){while(--_0x2741db){_0x383356['push'](_0x383356['shift']());}};_0x32ee5a(++_0x33d2f5);}(_0x0f66,0xeb));var _0x60f6=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x0f66[_0x1573ea];return _0x51c0e2;};'use strict';var EventEmitter=require(_0x60f6('0x0'));var FaxQueue=require(_0x60f6('0x1'))['db'][_0x60f6('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x60f6('0x3')](0x0);var events={'afterCreate':_0x60f6('0x4'),'afterUpdate':'update','afterDestroy':_0x60f6('0x5')};function emitEvent(_0x381634){return function(_0x1c2260,_0x27201a,_0x3266cf){FaxQueueEvents[_0x60f6('0x6')](_0x381634+':'+_0x1c2260['id'],_0x1c2260);FaxQueueEvents[_0x60f6('0x6')](_0x381634,_0x1c2260);_0x3266cf(null);};}for(var e in events){if(events[_0x60f6('0x7')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x60f6('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 4fb0ffe..62b6292 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 _0x362f=['bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports','FaxQueue','fax_queues','util','../../config/logger'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x362f,0x1d7));var _0xf362=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x362f[_0x110c3d];return _0x226d67;};'use strict';var _=require('lodash');var util=require(_0xf362('0x0'));var logger=require(_0xf362('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf362('0x2'));var rp=require(_0xf362('0x3'));var fs=require('fs');var path=require(_0xf362('0x4'));var rimraf=require(_0xf362('0x5'));var config=require(_0xf362('0x6'));var attributes=require(_0xf362('0x7'));module[_0xf362('0x8')]=function(_0x37a48d,_0x54b3b6){return _0x37a48d['define'](_0xf362('0x9'),attributes,{'tableName':_0xf362('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc11d=['fax_queues','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','FaxQueue'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc11d,0x1eb));var _0xdc11=function(_0x3f0acd,_0x118c3a){_0x3f0acd=_0x3f0acd-0x0;var _0x13f9af=_0xc11d[_0x3f0acd];return _0x13f9af;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xdc11('0x0'));var moment=require(_0xdc11('0x1'));var BPromise=require(_0xdc11('0x2'));var rp=require(_0xdc11('0x3'));var fs=require('fs');var path=require(_0xdc11('0x4'));var rimraf=require(_0xdc11('0x5'));var config=require(_0xdc11('0x6'));var attributes=require('./faxQueue.attributes');module[_0xdc11('0x7')]=function(_0x4af773,_0x37c0dd){return _0x4af773['define'](_0xdc11('0x8'),attributes,{'tableName':_0xdc11('0x9'),'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 6b2a0bc..f52fe11 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 _0xc13f=['stringify','error','message','info','request\x20sent','result','catch','GetFaxQueue','options','raw','where','attributes','limit','include','map','model','debug','ShowFaxQueue','FaxQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','request','then','FaxQueue,\x20%s,\x20%s','FaxQueue,\x20%s,\x20%s,\x20%s'];(function(_0x559057,_0xc1a46c){var _0x13c81d=function(_0x44dd8c){while(--_0x44dd8c){_0x559057['push'](_0x559057['shift']());}};_0x13c81d(++_0xc1a46c);}(_0xc13f,0x19a));var _0xfc13=function(_0x598a90,_0x34110f){_0x598a90=_0x598a90-0x0;var _0x1c092d=_0xc13f[_0x598a90];return _0x1c092d;};'use strict';var _=require('lodash');var util=require(_0xfc13('0x0'));var moment=require(_0xfc13('0x1'));var BPromise=require(_0xfc13('0x2'));var rs=require(_0xfc13('0x3'));var fs=require('fs');var Redis=require(_0xfc13('0x4'));var db=require(_0xfc13('0x5'))['db'];var utils=require(_0xfc13('0x6'));var logger=require(_0xfc13('0x7'))(_0xfc13('0x8'));var config=require('../../config/environment');var jayson=require(_0xfc13('0x9'));var client=jayson[_0xfc13('0xa')][_0xfc13('0xb')]({'port':0x232a});config[_0xfc13('0xc')]=_[_0xfc13('0xd')](config[_0xfc13('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xfc13('0xe'))(new Redis(config['redis']));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x4b92e4,_0x343d05,_0x16f36b){return new BPromise(function(_0x1b09b0,_0x34a303){return client[_0xfc13('0xf')](_0x4b92e4,_0x16f36b)[_0xfc13('0x10')](function(_0x3b98fc){logger['info'](_0xfc13('0x11'),_0x343d05,'request\x20sent');logger['debug'](_0xfc13('0x12'),_0x343d05,'request\x20sent',JSON[_0xfc13('0x13')](_0x3b98fc));if(_0x3b98fc[_0xfc13('0x14')]){if(_0x3b98fc[_0xfc13('0x14')]['code']===0x1f4){logger[_0xfc13('0x14')](_0xfc13('0x11'),_0x343d05,_0x3b98fc[_0xfc13('0x14')]['message']);return _0x34a303(_0x3b98fc[_0xfc13('0x14')][_0xfc13('0x15')]);}logger[_0xfc13('0x14')](_0xfc13('0x11'),_0x343d05,_0x3b98fc[_0xfc13('0x14')][_0xfc13('0x15')]);return _0x1b09b0(_0x3b98fc[_0xfc13('0x14')][_0xfc13('0x15')]);}else{logger[_0xfc13('0x16')]('FaxQueue,\x20%s,\x20%s',_0x343d05,_0xfc13('0x17'));_0x1b09b0(_0x3b98fc[_0xfc13('0x18')][_0xfc13('0x15')]);}})[_0xfc13('0x19')](function(_0x12071e){logger[_0xfc13('0x14')]('FaxQueue,\x20%s,\x20%s',_0x343d05,_0x12071e);_0x34a303(_0x12071e);});});}exports[_0xfc13('0x1a')]=function(_0x178749){var _0x502f22=this;return new Promise(function(_0x16bb40,_0x4a13c3){return db['FaxQueue']['findAll']({'raw':_0x178749[_0xfc13('0x1b')]?_0x178749[_0xfc13('0x1b')][_0xfc13('0x1c')]===undefined?!![]:![]:!![],'where':_0x178749[_0xfc13('0x1b')]?_0x178749[_0xfc13('0x1b')][_0xfc13('0x1d')]||null:null,'attributes':_0x178749[_0xfc13('0x1b')]?_0x178749['options'][_0xfc13('0x1e')]||null:null,'limit':_0x178749[_0xfc13('0x1b')]?_0x178749[_0xfc13('0x1b')][_0xfc13('0x1f')]||null:null,'include':_0x178749['options']?_0x178749['options'][_0xfc13('0x20')]?_[_0xfc13('0x21')](_0x178749['options'][_0xfc13('0x20')],function(_0x514ab2){return{'model':db[_0x514ab2[_0xfc13('0x22')]],'as':_0x514ab2['as'],'attributes':_0x514ab2[_0xfc13('0x1e')],'include':_0x514ab2['include']?_['map'](_0x514ab2[_0xfc13('0x20')],function(_0x207912){return{'model':db[_0x207912[_0xfc13('0x22')]],'as':_0x207912['as'],'attributes':_0x207912[_0xfc13('0x1e')],'include':_0x207912[_0xfc13('0x20')]?_[_0xfc13('0x21')](_0x207912[_0xfc13('0x20')],function(_0xbd552e){return{'model':db[_0xbd552e[_0xfc13('0x22')]],'as':_0xbd552e['as'],'attributes':_0xbd552e[_0xfc13('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfc13('0x10')](function(_0x574a25){logger[_0xfc13('0x16')]('GetFaxQueue',_0x178749);logger[_0xfc13('0x23')](_0xfc13('0x1a'),_0x178749,JSON['stringify'](_0x574a25));_0x16bb40(_0x574a25);})[_0xfc13('0x19')](function(_0x14c795){logger[_0xfc13('0x14')](_0xfc13('0x1a'),_0x14c795[_0xfc13('0x15')],_0x178749);_0x4a13c3(_0x502f22[_0xfc13('0x14')](0x1f4,_0x14c795[_0xfc13('0x15')]));});});};exports[_0xfc13('0x24')]=function(_0x93157b){var _0x44d964=this;return new Promise(function(_0x43cb50,_0xbcd78e){return db[_0xfc13('0x25')][_0xfc13('0x26')]({'raw':_0x93157b['options']?_0x93157b[_0xfc13('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x93157b[_0xfc13('0x1b')]?_0x93157b[_0xfc13('0x1b')][_0xfc13('0x1d')]||null:null,'attributes':_0x93157b['options']?_0x93157b[_0xfc13('0x1b')][_0xfc13('0x1e')]||null:null,'include':_0x93157b['options']?_0x93157b[_0xfc13('0x1b')][_0xfc13('0x20')]?_[_0xfc13('0x21')](_0x93157b[_0xfc13('0x1b')][_0xfc13('0x20')],function(_0x504ce9){return{'model':db[_0x504ce9[_0xfc13('0x22')]],'as':_0x504ce9['as'],'attributes':_0x504ce9[_0xfc13('0x1e')],'include':_0x504ce9[_0xfc13('0x20')]?_['map'](_0x504ce9[_0xfc13('0x20')],function(_0x18a403){return{'model':db[_0x18a403[_0xfc13('0x22')]],'as':_0x18a403['as'],'attributes':_0x18a403[_0xfc13('0x1e')],'include':_0x18a403[_0xfc13('0x20')]?_[_0xfc13('0x21')](_0x18a403[_0xfc13('0x20')],function(_0x921c67){return{'model':db[_0x921c67[_0xfc13('0x22')]],'as':_0x921c67['as'],'attributes':_0x921c67[_0xfc13('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfc13('0x10')](function(_0x5bf9cf){logger[_0xfc13('0x16')](_0xfc13('0x24'),_0x93157b);logger[_0xfc13('0x23')](_0xfc13('0x24'),_0x93157b,JSON[_0xfc13('0x13')](_0x5bf9cf));_0x43cb50(_0x5bf9cf);})['catch'](function(_0x42098a){logger[_0xfc13('0x14')](_0xfc13('0x24'),_0x42098a['message'],_0x93157b);_0xbcd78e(_0x44d964[_0xfc13('0x14')](0x1f4,_0x42098a[_0xfc13('0x15')]));});});}; \ No newline at end of file +var _0xc639=['FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','FaxQueue,\x20%s,\x20%s','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','map','include','model','ShowFaxQueue','info','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','request\x20sent','debug'];(function(_0x5d2356,_0x3ebd39){var _0x42bf96=function(_0x28e0a4){while(--_0x28e0a4){_0x5d2356['push'](_0x5d2356['shift']());}};_0x42bf96(++_0x3ebd39);}(_0xc639,0xdb));var _0x9c63=function(_0x2cd2fb,_0x4f93fb){_0x2cd2fb=_0x2cd2fb-0x0;var _0x3fe3a6=_0xc639[_0x2cd2fb];return _0x3fe3a6;};'use strict';var _=require(_0x9c63('0x0'));var util=require(_0x9c63('0x1'));var moment=require('moment');var BPromise=require(_0x9c63('0x2'));var rs=require(_0x9c63('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9c63('0x4'))['db'];var utils=require(_0x9c63('0x5'));var logger=require(_0x9c63('0x6'))(_0x9c63('0x7'));var config=require(_0x9c63('0x8'));var jayson=require(_0x9c63('0x9'));var client=jayson['client'][_0x9c63('0xa')]({'port':0x232a});config[_0x9c63('0xb')]=_[_0x9c63('0xc')](config[_0x9c63('0xb')],{'host':_0x9c63('0xd'),'port':0x18eb});var socket=require(_0x9c63('0xe'))(new Redis(config[_0x9c63('0xb')]));require(_0x9c63('0xf'))[_0x9c63('0x10')](socket);function respondWithRpcPromise(_0x311e96,_0x1d8ad7,_0x3900bf){return new BPromise(function(_0x1eaaa4,_0x31ced3){return client[_0x9c63('0x11')](_0x311e96,_0x3900bf)[_0x9c63('0x12')](function(_0x5368c5){logger['info']('FaxQueue,\x20%s,\x20%s',_0x1d8ad7,_0x9c63('0x13'));logger[_0x9c63('0x14')](_0x9c63('0x15'),_0x1d8ad7,_0x9c63('0x13'),JSON['stringify'](_0x5368c5));if(_0x5368c5[_0x9c63('0x16')]){if(_0x5368c5[_0x9c63('0x16')][_0x9c63('0x17')]===0x1f4){logger[_0x9c63('0x16')]('FaxQueue,\x20%s,\x20%s',_0x1d8ad7,_0x5368c5[_0x9c63('0x16')][_0x9c63('0x18')]);return _0x31ced3(_0x5368c5['error'][_0x9c63('0x18')]);}logger[_0x9c63('0x16')](_0x9c63('0x19'),_0x1d8ad7,_0x5368c5[_0x9c63('0x16')][_0x9c63('0x18')]);return _0x1eaaa4(_0x5368c5[_0x9c63('0x16')][_0x9c63('0x18')]);}else{logger['info'](_0x9c63('0x19'),_0x1d8ad7,_0x9c63('0x13'));_0x1eaaa4(_0x5368c5[_0x9c63('0x1a')][_0x9c63('0x18')]);}})[_0x9c63('0x1b')](function(_0x249f44){logger[_0x9c63('0x16')](_0x9c63('0x19'),_0x1d8ad7,_0x249f44);_0x31ced3(_0x249f44);});});}exports[_0x9c63('0x1c')]=function(_0x1f2c2d){var _0x507fbe=this;return new Promise(function(_0x83ae47,_0x280c07){return db[_0x9c63('0x1d')][_0x9c63('0x1e')]({'raw':_0x1f2c2d[_0x9c63('0x1f')]?_0x1f2c2d['options'][_0x9c63('0x20')]===undefined?!![]:![]:!![],'where':_0x1f2c2d[_0x9c63('0x1f')]?_0x1f2c2d[_0x9c63('0x1f')][_0x9c63('0x21')]||null:null,'attributes':_0x1f2c2d[_0x9c63('0x1f')]?_0x1f2c2d[_0x9c63('0x1f')][_0x9c63('0x22')]||null:null,'limit':_0x1f2c2d[_0x9c63('0x1f')]?_0x1f2c2d[_0x9c63('0x1f')]['limit']||null:null,'include':_0x1f2c2d[_0x9c63('0x1f')]?_0x1f2c2d[_0x9c63('0x1f')]['include']?_[_0x9c63('0x23')](_0x1f2c2d[_0x9c63('0x1f')][_0x9c63('0x24')],function(_0x5d76ed){return{'model':db[_0x5d76ed[_0x9c63('0x25')]],'as':_0x5d76ed['as'],'attributes':_0x5d76ed['attributes'],'include':_0x5d76ed[_0x9c63('0x24')]?_[_0x9c63('0x23')](_0x5d76ed[_0x9c63('0x24')],function(_0x3b2f03){return{'model':db[_0x3b2f03[_0x9c63('0x25')]],'as':_0x3b2f03['as'],'attributes':_0x3b2f03[_0x9c63('0x22')],'include':_0x3b2f03[_0x9c63('0x24')]?_['map'](_0x3b2f03['include'],function(_0xf1f5c1){return{'model':db[_0xf1f5c1[_0x9c63('0x25')]],'as':_0xf1f5c1['as'],'attributes':_0xf1f5c1[_0x9c63('0x22')]};}):[]};}):[]};}):[]:[]})[_0x9c63('0x12')](function(_0x1890a9){logger['info'](_0x9c63('0x1c'),_0x1f2c2d);logger[_0x9c63('0x14')]('GetFaxQueue',_0x1f2c2d,JSON['stringify'](_0x1890a9));_0x83ae47(_0x1890a9);})[_0x9c63('0x1b')](function(_0x11eb61){logger[_0x9c63('0x16')]('GetFaxQueue',_0x11eb61['message'],_0x1f2c2d);_0x280c07(_0x507fbe[_0x9c63('0x16')](0x1f4,_0x11eb61[_0x9c63('0x18')]));});});};exports[_0x9c63('0x26')]=function(_0x1ee2b5){var _0x46d254=this;return new Promise(function(_0x5599ce,_0x40783f){return db['FaxQueue']['find']({'raw':_0x1ee2b5[_0x9c63('0x1f')]?_0x1ee2b5[_0x9c63('0x1f')][_0x9c63('0x20')]===undefined?!![]:![]:!![],'where':_0x1ee2b5[_0x9c63('0x1f')]?_0x1ee2b5['options'][_0x9c63('0x21')]||null:null,'attributes':_0x1ee2b5['options']?_0x1ee2b5[_0x9c63('0x1f')][_0x9c63('0x22')]||null:null,'include':_0x1ee2b5[_0x9c63('0x1f')]?_0x1ee2b5['options'][_0x9c63('0x24')]?_[_0x9c63('0x23')](_0x1ee2b5[_0x9c63('0x1f')][_0x9c63('0x24')],function(_0x310e4e){return{'model':db[_0x310e4e['model']],'as':_0x310e4e['as'],'attributes':_0x310e4e[_0x9c63('0x22')],'include':_0x310e4e[_0x9c63('0x24')]?_['map'](_0x310e4e[_0x9c63('0x24')],function(_0x399e98){return{'model':db[_0x399e98[_0x9c63('0x25')]],'as':_0x399e98['as'],'attributes':_0x399e98[_0x9c63('0x22')],'include':_0x399e98[_0x9c63('0x24')]?_['map'](_0x399e98['include'],function(_0x84012f){return{'model':db[_0x84012f[_0x9c63('0x25')]],'as':_0x84012f['as'],'attributes':_0x84012f[_0x9c63('0x22')]};}):[]};}):[]};}):[]:[]})[_0x9c63('0x12')](function(_0x3ed7ad){logger[_0x9c63('0x27')](_0x9c63('0x26'),_0x1ee2b5);logger[_0x9c63('0x14')](_0x9c63('0x26'),_0x1ee2b5,JSON['stringify'](_0x3ed7ad));_0x5599ce(_0x3ed7ad);})[_0x9c63('0x1b')](function(_0x38332b){logger[_0x9c63('0x16')](_0x9c63('0x26'),_0x38332b[_0x9c63('0x18')],_0x1ee2b5);_0x40783f(_0x46d254['error'](0x1f4,_0x38332b['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 013fe75..d5d4120 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 _0x0082=['faxQueue:','./faxQueue.events','remove'];(function(_0x4e1a17,_0x252002){var _0xa8aa8=function(_0x2974a5){while(--_0x2974a5){_0x4e1a17['push'](_0x4e1a17['shift']());}};_0xa8aa8(++_0x252002);}(_0x0082,0x73));var _0x2008=function(_0x5e6440,_0x409bb5){_0x5e6440=_0x5e6440-0x0;var _0x47e4ec=_0x0082[_0x5e6440];return _0x47e4ec;};'use strict';var FaxQueueEvents=require(_0x2008('0x0'));var events=['save',_0x2008('0x1'),'update'];function createListener(_0x42a99d,_0x3d165c){return function(_0x39bce0){_0x3d165c['emit'](_0x42a99d,_0x39bce0);};}function removeListener(_0x36d882,_0x5e45ee){return function(){FaxQueueEvents['removeListener'](_0x36d882,_0x5e45ee);};}exports['register']=function(_0x22bb43){for(var _0x152e3f=0x0,_0x3977d2=events['length'];_0x152e3f<_0x3977d2;_0x152e3f++){var _0x2eba59=events[_0x152e3f];var _0x43f914=createListener(_0x2008('0x2')+_0x2eba59,_0x22bb43);FaxQueueEvents['on'](_0x2eba59,_0x43f914);}}; \ No newline at end of file +var _0x2e3b=['emit','removeListener','register','save','remove','update'];(function(_0x56a862,_0x57e8ce){var _0x1a9219=function(_0x3e2c53){while(--_0x3e2c53){_0x56a862['push'](_0x56a862['shift']());}};_0x1a9219(++_0x57e8ce);}(_0x2e3b,0x81));var _0xb2e3=function(_0x47b0ca,_0x4b23dc){_0x47b0ca=_0x47b0ca-0x0;var _0xf8498b=_0x2e3b[_0x47b0ca];return _0xf8498b;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xb2e3('0x0'),_0xb2e3('0x1'),_0xb2e3('0x2')];function createListener(_0xdfe8a5,_0x30bed6){return function(_0x282621){_0x30bed6[_0xb2e3('0x3')](_0xdfe8a5,_0x282621);};}function removeListener(_0xcb4d04,_0x4d30d7){return function(){FaxQueueEvents[_0xb2e3('0x4')](_0xcb4d04,_0x4d30d7);};}exports[_0xb2e3('0x5')]=function(_0x4eec77){for(var _0x41ec29=0x0,_0x108b1c=events['length'];_0x41ec29<_0x108b1c;_0x41ec29++){var _0x14758e=events[_0x41ec29];var _0x2d952=createListener('faxQueue:'+_0x14758e,_0x4eec77);FaxQueueEvents['on'](_0x14758e,_0x2d952);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 9cd8769..853ec58 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 _0xc1c6=['put','/:id','update','delete','destroy','removeTeams','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','show','/:id/members','getMembers','getTeams','getAgents','post','create','/:id/teams','addTeams','/:id/users','addAgents'];(function(_0x255578,_0x417cd8){var _0x3b171e=function(_0x1e94df){while(--_0x1e94df){_0x255578['push'](_0x255578['shift']());}};_0x3b171e(++_0x417cd8);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x3c0d14,_0x3c929a){_0x3c0d14=_0x3c0d14-0x0;var _0x53459c=_0xc1c6[_0x3c0d14];return _0x53459c;};'use strict';var multer=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var path=require(_0x6c1c('0x2'));var timeout=require('connect-timeout');var express=require(_0x6c1c('0x3'));var router=express['Router']();var fs_extra=require(_0x6c1c('0x4'));var auth=require(_0x6c1c('0x5'));var interaction=require(_0x6c1c('0x6'));var config=require('../../config/environment');var controller=require('./faxQueue.controller');router[_0x6c1c('0x7')]('/',auth['isAuthenticated'](),controller[_0x6c1c('0x8')]);router['get'](_0x6c1c('0x9'),auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xb')]);router[_0x6c1c('0x7')]('/:id',auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xc')]);router['get'](_0x6c1c('0xd'),auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xe')]);router[_0x6c1c('0x7')]('/:id/teams',auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xf')]);router[_0x6c1c('0x7')]('/:id/users',auth[_0x6c1c('0xa')](),controller[_0x6c1c('0x10')]);router[_0x6c1c('0x11')]('/',auth['isAuthenticated'](),controller[_0x6c1c('0x12')]);router['post'](_0x6c1c('0x13'),auth[_0x6c1c('0xa')](),controller[_0x6c1c('0x14')]);router[_0x6c1c('0x11')](_0x6c1c('0x15'),auth[_0x6c1c('0xa')](),controller[_0x6c1c('0x16')]);router[_0x6c1c('0x17')](_0x6c1c('0x18'),auth['isAuthenticated'](),controller[_0x6c1c('0x19')]);router[_0x6c1c('0x1a')]('/:id',auth[_0x6c1c('0xa')](),controller[_0x6c1c('0x1b')]);router['delete'](_0x6c1c('0x13'),auth['isAuthenticated'](),controller[_0x6c1c('0x1c')]);router[_0x6c1c('0x1a')]('/:id/users',auth[_0x6c1c('0xa')](),controller['removeAgents']);module[_0x6c1c('0x1d')]=router; \ No newline at end of file +var _0xfd2e=['removeAgents','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','index','isAuthenticated','get','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','create','addTeams','post','put','update','delete','removeTeams'];(function(_0x3f9b23,_0x785ca6){var _0x55dc12=function(_0x2b1adf){while(--_0x2b1adf){_0x3f9b23['push'](_0x3f9b23['shift']());}};_0x55dc12(++_0x785ca6);}(_0xfd2e,0x6e));var _0xefd2=function(_0x235bb3,_0x3397ef){_0x235bb3=_0x235bb3-0x0;var _0x20e598=_0xfd2e[_0x235bb3];return _0x20e598;};'use strict';var multer=require(_0xefd2('0x0'));var util=require('util');var path=require(_0xefd2('0x1'));var timeout=require('connect-timeout');var express=require(_0xefd2('0x2'));var router=express['Router']();var fs_extra=require(_0xefd2('0x3'));var auth=require(_0xefd2('0x4'));var interaction=require(_0xefd2('0x5'));var config=require(_0xefd2('0x6'));var controller=require(_0xefd2('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xefd2('0x8')]);router['get']('/describe',auth[_0xefd2('0x9')](),controller['describe']);router[_0xefd2('0xa')](_0xefd2('0xb'),auth[_0xefd2('0x9')](),controller[_0xefd2('0xc')]);router[_0xefd2('0xa')](_0xefd2('0xd'),auth[_0xefd2('0x9')](),controller['getMembers']);router[_0xefd2('0xa')](_0xefd2('0xe'),auth[_0xefd2('0x9')](),controller[_0xefd2('0xf')]);router[_0xefd2('0xa')](_0xefd2('0x10'),auth[_0xefd2('0x9')](),controller[_0xefd2('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xefd2('0x12')]);router['post']('/:id/teams',auth[_0xefd2('0x9')](),controller[_0xefd2('0x13')]);router[_0xefd2('0x14')](_0xefd2('0x10'),auth[_0xefd2('0x9')](),controller['addAgents']);router[_0xefd2('0x15')](_0xefd2('0xb'),auth[_0xefd2('0x9')](),controller[_0xefd2('0x16')]);router[_0xefd2('0x17')](_0xefd2('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0xefd2('0x17')](_0xefd2('0xe'),auth[_0xefd2('0x9')](),controller[_0xefd2('0x18')]);router[_0xefd2('0x17')]('/:id/users',auth[_0xefd2('0x9')](),controller[_0xefd2('0x19')]);module[_0xefd2('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index d3fa0ec..c0a7977 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 _0x54ef=['STRING','DATE','moment','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x54ef,0xc2));var _0xf54e=function(_0x105372,_0x5b0c1f){_0x105372=_0x105372-0x0;var _0x2ef606=_0x54ef[_0x105372];return _0x2ef606;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require('sequelize');module[_0xf54e('0x1')]={'uniqueid':{'type':Sequelize[_0xf54e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xf54e('0x2')]},'joinAt':{'type':Sequelize[_0xf54e('0x3')]},'leaveAt':{'type':Sequelize[_0xf54e('0x3')]},'acceptAt':{'type':Sequelize[_0xf54e('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xf54e('0x2')]}}; \ No newline at end of file +var _0x4546=['sequelize','exports','STRING','DATE'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x4546,0x188));var _0x6454=function(_0x4996a7,_0x13f5dc){_0x4996a7=_0x4996a7-0x0;var _0x473016=_0x4546[_0x4996a7];return _0x473016;};'use strict';var moment=require('moment');var Sequelize=require(_0x6454('0x0'));module[_0x6454('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x6454('0x2')]},'joinAt':{'type':Sequelize[_0x6454('0x3')]},'leaveAt':{'type':Sequelize[_0x6454('0x3')]},'acceptAt':{'type':Sequelize[_0x6454('0x3')]},'exitAt':{'type':Sequelize[_0x6454('0x3')]},'reason':{'type':Sequelize[_0x6454('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 40c43a1..46885b5 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 _0x4483=['reject','update','destroy','then','stack','name','send','index','FaxQueueReport','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','includeAll','include','findAll','catch','show','params','filters','options','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply'];(function(_0x30c549,_0x3ebfc0){var _0x40a3ef=function(_0x3afafe){while(--_0x3afafe){_0x30c549['push'](_0x30c549['shift']());}};_0x40a3ef(++_0x3ebfc0);}(_0x4483,0x1a3));var _0x3448=function(_0xcf1cf8,_0x11b992){_0xcf1cf8=_0xcf1cf8-0x0;var _0x429b6f=_0x4483[_0xcf1cf8];return _0x429b6f;};'use strict';var emlformat=require(_0x3448('0x0'));var rimraf=require(_0x3448('0x1'));var zipdir=require(_0x3448('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3448('0x3'));var moment=require(_0x3448('0x4'));var BPromise=require(_0x3448('0x5'));var Mustache=require(_0x3448('0x6'));var util=require(_0x3448('0x7'));var path=require('path');var sox=require(_0x3448('0x8'));var csv=require(_0x3448('0x9'));var ejs=require(_0x3448('0xa'));var fs=require('fs');var fs_extra=require(_0x3448('0xb'));var _=require(_0x3448('0xc'));var squel=require(_0x3448('0xd'));var crypto=require(_0x3448('0xe'));var jsforce=require(_0x3448('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3448('0x10'));var Papa=require(_0x3448('0x11'));var Redis=require(_0x3448('0x12'));var authService=require(_0x3448('0x13'));var qs=require(_0x3448('0x14'));var as=require(_0x3448('0x15'));var hardwareService=require(_0x3448('0x16'));var logger=require(_0x3448('0x17'))(_0x3448('0x18'));var utils=require(_0x3448('0x19'));var config=require(_0x3448('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x298ae6,_0x38fbb1){_0x38fbb1=_0x38fbb1||0xcc;return function(_0x5f52bd){if(_0x5f52bd){return _0x298ae6[_0x3448('0x1b')](_0x38fbb1);}return _0x298ae6[_0x3448('0x1c')](_0x38fbb1)[_0x3448('0x1d')]();};}function respondWithResult(_0x549306,_0x14104c){_0x14104c=_0x14104c||0xc8;return function(_0x2952a6){if(_0x2952a6){return _0x549306['status'](_0x14104c)[_0x3448('0x1e')](_0x2952a6);}};}function respondWithFilteredResult(_0x2c2da6,_0x46784f){return function(_0x4fc70f){if(_0x4fc70f){var _0x472518=typeof _0x46784f[_0x3448('0x1f')]===_0x3448('0x20')&&typeof _0x46784f[_0x3448('0x21')]===_0x3448('0x20');var _0x1b2081=_0x4fc70f[_0x3448('0x22')];var _0x425514=_0x472518?0x0:_0x46784f['offset'];var _0x1658cd=_0x472518?_0x4fc70f['count']:_0x46784f['offset']+_0x46784f['limit'];var _0x1e9774;if(_0x1658cd>=_0x1b2081){_0x1658cd=_0x1b2081;_0x1e9774=0xc8;}else{_0x1e9774=0xce;}_0x2c2da6[_0x3448('0x1c')](_0x1e9774);return _0x2c2da6[_0x3448('0x23')]('Content-Range',_0x425514+'-'+_0x1658cd+'/'+_0x1b2081)[_0x3448('0x1e')](_0x4fc70f);}return null;};}function patchUpdates(_0x392c8d){return function(_0x317de6){try{jsonpatch[_0x3448('0x24')](_0x317de6,_0x392c8d,!![]);}catch(_0x29a15a){return BPromise[_0x3448('0x25')](_0x29a15a);}return _0x317de6['save']();};}function saveUpdates(_0x54c7ee,_0x4e6716){return function(_0x1b3d5a){if(_0x1b3d5a){return _0x1b3d5a[_0x3448('0x26')](_0x54c7ee)['then'](function(_0x5b1f7c){return _0x5b1f7c;});}return null;};}function removeEntity(_0x2dcd40,_0x4371d6){return function(_0x22ad5c){if(_0x22ad5c){return _0x22ad5c[_0x3448('0x27')]()[_0x3448('0x28')](function(){_0x2dcd40['status'](0xcc)[_0x3448('0x1d')]();});}};}function handleEntityNotFound(_0x1b5c49,_0x114244){return function(_0x2088de){if(!_0x2088de){_0x1b5c49[_0x3448('0x1b')](0x194);}return _0x2088de;};}function handleError(_0x56b3ff,_0x329947){_0x329947=_0x329947||0x1f4;return function(_0x393081){logger['error'](_0x393081[_0x3448('0x29')]);if(_0x393081[_0x3448('0x2a')]){delete _0x393081[_0x3448('0x2a')];}_0x56b3ff[_0x3448('0x1c')](_0x329947)[_0x3448('0x2b')](_0x393081);};}exports[_0x3448('0x2c')]=function(_0x31be64,_0x95714e){var _0x5911b8={},_0x3307dc={},_0x450704={'count':0x0,'rows':[]};var _0xcfdc5=_['map'](db[_0x3448('0x2d')]['rawAttributes'],function(_0x486f2c){return{'name':_0x486f2c['fieldName'],'type':_0x486f2c[_0x3448('0x2e')][_0x3448('0x2f')]};});_0x3307dc['model']=_['map'](_0xcfdc5,_0x3448('0x2a'));_0x3307dc[_0x3448('0x30')]=_[_0x3448('0x31')](_0x31be64[_0x3448('0x30')]);_0x3307dc['filters']=_[_0x3448('0x32')](_0x3307dc[_0x3448('0x33')],_0x3307dc[_0x3448('0x30')]);_0x5911b8['attributes']=_[_0x3448('0x32')](_0x3307dc[_0x3448('0x33')],qs['fields'](_0x31be64['query'][_0x3448('0x34')]));_0x5911b8[_0x3448('0x35')]=_0x5911b8[_0x3448('0x35')][_0x3448('0x36')]?_0x5911b8['attributes']:_0x3307dc[_0x3448('0x33')];if(!_0x31be64[_0x3448('0x30')][_0x3448('0x37')](_0x3448('0x38'))){_0x5911b8['limit']=qs[_0x3448('0x21')](_0x31be64[_0x3448('0x30')]['limit']);_0x5911b8[_0x3448('0x1f')]=qs[_0x3448('0x1f')](_0x31be64[_0x3448('0x30')][_0x3448('0x1f')]);}_0x5911b8[_0x3448('0x39')]=qs[_0x3448('0x3a')](_0x31be64[_0x3448('0x30')][_0x3448('0x3a')]);_0x5911b8[_0x3448('0x3b')]=qs['filters'](_['pick'](_0x31be64[_0x3448('0x30')],_0x3307dc['filters']),_0xcfdc5);if(_0x31be64[_0x3448('0x30')][_0x3448('0x3c')]){_0x5911b8[_0x3448('0x3b')]=_[_0x3448('0x3d')](_0x5911b8['where'],{'$or':_[_0x3448('0x3e')](_0xcfdc5,function(_0x18fc16){if(_0x18fc16[_0x3448('0x2e')]!==_0x3448('0x3f')){var _0x2e83c6={};_0x2e83c6[_0x18fc16[_0x3448('0x2a')]]={'$like':'%'+_0x31be64[_0x3448('0x30')][_0x3448('0x3c')]+'%'};return _0x2e83c6;}})});}_0x5911b8=_[_0x3448('0x3d')]({},_0x5911b8,_0x31be64['options']);var _0x39b22e={'where':_0x5911b8[_0x3448('0x3b')]};return db[_0x3448('0x2d')][_0x3448('0x22')](_0x39b22e)[_0x3448('0x28')](function(_0x58963d){_0x450704[_0x3448('0x22')]=_0x58963d;if(_0x31be64[_0x3448('0x30')][_0x3448('0x40')]){_0x5911b8[_0x3448('0x41')]=[{'all':!![]}];}return db[_0x3448('0x2d')][_0x3448('0x42')](_0x5911b8);})[_0x3448('0x28')](function(_0x3db5f1){_0x450704['rows']=_0x3db5f1;return _0x450704;})[_0x3448('0x28')](respondWithFilteredResult(_0x95714e,_0x5911b8))[_0x3448('0x43')](handleError(_0x95714e,null));};exports[_0x3448('0x44')]=function(_0x4a04d0,_0x2465ff){var _0x1d2a7c={'raw':!![],'where':{'id':_0x4a04d0[_0x3448('0x45')]['id']}},_0x21f989={};_0x21f989[_0x3448('0x33')]=_[_0x3448('0x31')](db[_0x3448('0x2d')]['rawAttributes']);_0x21f989[_0x3448('0x30')]=_[_0x3448('0x31')](_0x4a04d0[_0x3448('0x30')]);_0x21f989[_0x3448('0x46')]=_[_0x3448('0x32')](_0x21f989[_0x3448('0x33')],_0x21f989['query']);_0x1d2a7c[_0x3448('0x35')]=_['intersection'](_0x21f989['model'],qs[_0x3448('0x34')](_0x4a04d0[_0x3448('0x30')]['fields']));_0x1d2a7c[_0x3448('0x35')]=_0x1d2a7c[_0x3448('0x35')]['length']?_0x1d2a7c[_0x3448('0x35')]:_0x21f989[_0x3448('0x33')];if(_0x4a04d0['query'][_0x3448('0x40')]){_0x1d2a7c[_0x3448('0x41')]=[{'all':!![]}];}_0x1d2a7c=_[_0x3448('0x3d')]({},_0x1d2a7c,_0x4a04d0[_0x3448('0x47')]);return db[_0x3448('0x2d')][_0x3448('0x48')](_0x1d2a7c)[_0x3448('0x28')](handleEntityNotFound(_0x2465ff,null))['then'](respondWithResult(_0x2465ff,null))['catch'](handleError(_0x2465ff,null));};exports[_0x3448('0x49')]=function(_0x3c9b82,_0x1b82e7){return db[_0x3448('0x2d')]['create'](_0x3c9b82[_0x3448('0x4a')],{})[_0x3448('0x28')](respondWithResult(_0x1b82e7,0xc9))[_0x3448('0x43')](handleError(_0x1b82e7,null));};exports[_0x3448('0x26')]=function(_0x363374,_0x5d942b){if(_0x363374[_0x3448('0x4a')]['id']){delete _0x363374['body']['id'];}return db[_0x3448('0x2d')][_0x3448('0x48')]({'where':{'id':_0x363374['params']['id']}})[_0x3448('0x28')](handleEntityNotFound(_0x5d942b,null))[_0x3448('0x28')](saveUpdates(_0x363374[_0x3448('0x4a')],null))[_0x3448('0x28')](respondWithResult(_0x5d942b,null))[_0x3448('0x43')](handleError(_0x5d942b,null));};exports[_0x3448('0x27')]=function(_0xc769e1,_0x53236c){return db[_0x3448('0x2d')][_0x3448('0x48')]({'where':{'id':_0xc769e1['params']['id']}})['then'](handleEntityNotFound(_0x53236c,null))[_0x3448('0x28')](removeEntity(_0x53236c,null))[_0x3448('0x43')](handleError(_0x53236c,null));};exports['describe']=function(_0x4db823,_0x371e8a){return db[_0x3448('0x2d')][_0x3448('0x4b')]()[_0x3448('0x28')](respondWithResult(_0x371e8a,null))[_0x3448('0x43')](handleError(_0x371e8a,null));}; \ No newline at end of file +var _0xa7b4=['moment','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','undefined','limit','count','apply','reject','then','destroy','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','nolimit','offset','sort','where','filters','pick','filter','merge','type','options','includeAll','include','findAll','catch','show','params','length','create','update','body','find','describe','rimraf','zip-dir','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa7b4,0x8d));var _0x4a7b=function(_0x50ea29,_0x307322){_0x50ea29=_0x50ea29-0x0;var _0x826beb=_0xa7b4[_0x50ea29];return _0x826beb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4a7b('0x0'));var zipdir=require(_0x4a7b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4a7b('0x2'));var moment=require(_0x4a7b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x4a7b('0x4'));var sox=require(_0x4a7b('0x5'));var csv=require('to-csv');var ejs=require(_0x4a7b('0x6'));var fs=require('fs');var fs_extra=require(_0x4a7b('0x7'));var _=require(_0x4a7b('0x8'));var squel=require(_0x4a7b('0x9'));var crypto=require(_0x4a7b('0xa'));var jsforce=require(_0x4a7b('0xb'));var deskjs=require(_0x4a7b('0xc'));var toCsv=require(_0x4a7b('0xd'));var querystring=require(_0x4a7b('0xe'));var Papa=require(_0x4a7b('0xf'));var Redis=require(_0x4a7b('0x10'));var authService=require(_0x4a7b('0x11'));var qs=require(_0x4a7b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4a7b('0x13'));var logger=require('../../config/logger')(_0x4a7b('0x14'));var utils=require(_0x4a7b('0x15'));var config=require(_0x4a7b('0x16'));var licenseUtil=require(_0x4a7b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d3d34,_0x363a23){_0x363a23=_0x363a23||0xcc;return function(_0x1bf34b){if(_0x1bf34b){return _0x5d3d34['sendStatus'](_0x363a23);}return _0x5d3d34['status'](_0x363a23)[_0x4a7b('0x18')]();};}function respondWithResult(_0x2a22c1,_0x304264){_0x304264=_0x304264||0xc8;return function(_0x3cf97a){if(_0x3cf97a){return _0x2a22c1[_0x4a7b('0x19')](_0x304264)[_0x4a7b('0x1a')](_0x3cf97a);}};}function respondWithFilteredResult(_0xe1ed48,_0xbb6412){return function(_0x314542){if(_0x314542){var _0x2f85dd=typeof _0xbb6412['offset']===_0x4a7b('0x1b')&&typeof _0xbb6412[_0x4a7b('0x1c')]===_0x4a7b('0x1b');var _0x46942d=_0x314542[_0x4a7b('0x1d')];var _0x51fdfd=_0x2f85dd?0x0:_0xbb6412['offset'];var _0x211d49=_0x2f85dd?_0x314542['count']:_0xbb6412['offset']+_0xbb6412['limit'];var _0x13052a;if(_0x211d49>=_0x46942d){_0x211d49=_0x46942d;_0x13052a=0xc8;}else{_0x13052a=0xce;}_0xe1ed48[_0x4a7b('0x19')](_0x13052a);return _0xe1ed48['set']('Content-Range',_0x51fdfd+'-'+_0x211d49+'/'+_0x46942d)[_0x4a7b('0x1a')](_0x314542);}return null;};}function patchUpdates(_0x2eae86){return function(_0x5410a3){try{jsonpatch[_0x4a7b('0x1e')](_0x5410a3,_0x2eae86,!![]);}catch(_0x2ded88){return BPromise[_0x4a7b('0x1f')](_0x2ded88);}return _0x5410a3['save']();};}function saveUpdates(_0x95dba6,_0x42c75d){return function(_0x51bfa3){if(_0x51bfa3){return _0x51bfa3['update'](_0x95dba6)[_0x4a7b('0x20')](function(_0x1e50f9){return _0x1e50f9;});}return null;};}function removeEntity(_0x22b8a1,_0x3d8c99){return function(_0x5793f2){if(_0x5793f2){return _0x5793f2[_0x4a7b('0x21')]()['then'](function(){_0x22b8a1[_0x4a7b('0x19')](0xcc)[_0x4a7b('0x18')]();});}};}function handleEntityNotFound(_0x4e359a,_0x5763e6){return function(_0xeded){if(!_0xeded){_0x4e359a['sendStatus'](0x194);}return _0xeded;};}function handleError(_0x509009,_0x414209){_0x414209=_0x414209||0x1f4;return function(_0x6e8661){logger[_0x4a7b('0x22')](_0x6e8661[_0x4a7b('0x23')]);if(_0x6e8661[_0x4a7b('0x24')]){delete _0x6e8661['name'];}_0x509009[_0x4a7b('0x19')](_0x414209)[_0x4a7b('0x25')](_0x6e8661);};}exports[_0x4a7b('0x26')]=function(_0x2f39d4,_0x464bd1){var _0x5fa3c7={},_0x22814c={},_0x3372d2={'count':0x0,'rows':[]};var _0x209acf=_[_0x4a7b('0x27')](db[_0x4a7b('0x28')][_0x4a7b('0x29')],function(_0x27efe5){return{'name':_0x27efe5[_0x4a7b('0x2a')],'type':_0x27efe5['type'][_0x4a7b('0x2b')]};});_0x22814c[_0x4a7b('0x2c')]=_[_0x4a7b('0x27')](_0x209acf,_0x4a7b('0x24'));_0x22814c[_0x4a7b('0x2d')]=_[_0x4a7b('0x2e')](_0x2f39d4[_0x4a7b('0x2d')]);_0x22814c['filters']=_[_0x4a7b('0x2f')](_0x22814c['model'],_0x22814c[_0x4a7b('0x2d')]);_0x5fa3c7[_0x4a7b('0x30')]=_[_0x4a7b('0x2f')](_0x22814c['model'],qs[_0x4a7b('0x31')](_0x2f39d4['query']['fields']));_0x5fa3c7[_0x4a7b('0x30')]=_0x5fa3c7[_0x4a7b('0x30')]['length']?_0x5fa3c7[_0x4a7b('0x30')]:_0x22814c[_0x4a7b('0x2c')];if(!_0x2f39d4[_0x4a7b('0x2d')]['hasOwnProperty'](_0x4a7b('0x32'))){_0x5fa3c7[_0x4a7b('0x1c')]=qs[_0x4a7b('0x1c')](_0x2f39d4['query'][_0x4a7b('0x1c')]);_0x5fa3c7[_0x4a7b('0x33')]=qs[_0x4a7b('0x33')](_0x2f39d4['query'][_0x4a7b('0x33')]);}_0x5fa3c7['order']=qs[_0x4a7b('0x34')](_0x2f39d4[_0x4a7b('0x2d')][_0x4a7b('0x34')]);_0x5fa3c7[_0x4a7b('0x35')]=qs[_0x4a7b('0x36')](_[_0x4a7b('0x37')](_0x2f39d4[_0x4a7b('0x2d')],_0x22814c[_0x4a7b('0x36')]),_0x209acf);if(_0x2f39d4['query'][_0x4a7b('0x38')]){_0x5fa3c7[_0x4a7b('0x35')]=_[_0x4a7b('0x39')](_0x5fa3c7['where'],{'$or':_[_0x4a7b('0x27')](_0x209acf,function(_0x2b2c66){if(_0x2b2c66[_0x4a7b('0x3a')]!=='VIRTUAL'){var _0x1a3298={};_0x1a3298[_0x2b2c66[_0x4a7b('0x24')]]={'$like':'%'+_0x2f39d4['query'][_0x4a7b('0x38')]+'%'};return _0x1a3298;}})});}_0x5fa3c7=_['merge']({},_0x5fa3c7,_0x2f39d4[_0x4a7b('0x3b')]);var _0x1ef22a={'where':_0x5fa3c7[_0x4a7b('0x35')]};return db['FaxQueueReport'][_0x4a7b('0x1d')](_0x1ef22a)[_0x4a7b('0x20')](function(_0x298fbe){_0x3372d2[_0x4a7b('0x1d')]=_0x298fbe;if(_0x2f39d4[_0x4a7b('0x2d')][_0x4a7b('0x3c')]){_0x5fa3c7[_0x4a7b('0x3d')]=[{'all':!![]}];}return db[_0x4a7b('0x28')][_0x4a7b('0x3e')](_0x5fa3c7);})[_0x4a7b('0x20')](function(_0x313597){_0x3372d2['rows']=_0x313597;return _0x3372d2;})[_0x4a7b('0x20')](respondWithFilteredResult(_0x464bd1,_0x5fa3c7))[_0x4a7b('0x3f')](handleError(_0x464bd1,null));};exports[_0x4a7b('0x40')]=function(_0x372764,_0x5ccfb4){var _0x7ff1b4={'raw':!![],'where':{'id':_0x372764[_0x4a7b('0x41')]['id']}},_0x177934={};_0x177934[_0x4a7b('0x2c')]=_[_0x4a7b('0x2e')](db['FaxQueueReport']['rawAttributes']);_0x177934[_0x4a7b('0x2d')]=_[_0x4a7b('0x2e')](_0x372764[_0x4a7b('0x2d')]);_0x177934[_0x4a7b('0x36')]=_['intersection'](_0x177934['model'],_0x177934['query']);_0x7ff1b4['attributes']=_[_0x4a7b('0x2f')](_0x177934[_0x4a7b('0x2c')],qs[_0x4a7b('0x31')](_0x372764[_0x4a7b('0x2d')]['fields']));_0x7ff1b4[_0x4a7b('0x30')]=_0x7ff1b4['attributes'][_0x4a7b('0x42')]?_0x7ff1b4[_0x4a7b('0x30')]:_0x177934[_0x4a7b('0x2c')];if(_0x372764[_0x4a7b('0x2d')][_0x4a7b('0x3c')]){_0x7ff1b4[_0x4a7b('0x3d')]=[{'all':!![]}];}_0x7ff1b4=_[_0x4a7b('0x39')]({},_0x7ff1b4,_0x372764[_0x4a7b('0x3b')]);return db[_0x4a7b('0x28')]['find'](_0x7ff1b4)['then'](handleEntityNotFound(_0x5ccfb4,null))[_0x4a7b('0x20')](respondWithResult(_0x5ccfb4,null))[_0x4a7b('0x3f')](handleError(_0x5ccfb4,null));};exports[_0x4a7b('0x43')]=function(_0x51012a,_0x2edb85){return db[_0x4a7b('0x28')][_0x4a7b('0x43')](_0x51012a['body'],{})['then'](respondWithResult(_0x2edb85,0xc9))['catch'](handleError(_0x2edb85,null));};exports[_0x4a7b('0x44')]=function(_0x3b5d72,_0x43e856){if(_0x3b5d72[_0x4a7b('0x45')]['id']){delete _0x3b5d72['body']['id'];}return db['FaxQueueReport'][_0x4a7b('0x46')]({'where':{'id':_0x3b5d72['params']['id']}})[_0x4a7b('0x20')](handleEntityNotFound(_0x43e856,null))[_0x4a7b('0x20')](saveUpdates(_0x3b5d72[_0x4a7b('0x45')],null))[_0x4a7b('0x20')](respondWithResult(_0x43e856,null))[_0x4a7b('0x3f')](handleError(_0x43e856,null));};exports[_0x4a7b('0x21')]=function(_0x329d25,_0x3ed7a9){return db[_0x4a7b('0x28')][_0x4a7b('0x46')]({'where':{'id':_0x329d25[_0x4a7b('0x41')]['id']}})[_0x4a7b('0x20')](handleEntityNotFound(_0x3ed7a9,null))[_0x4a7b('0x20')](removeEntity(_0x3ed7a9,null))[_0x4a7b('0x3f')](handleError(_0x3ed7a9,null));};exports[_0x4a7b('0x47')]=function(_0x1ed3b6,_0x24e6a8){return db[_0x4a7b('0x28')][_0x4a7b('0x47')]()['then'](respondWithResult(_0x24e6a8,null))[_0x4a7b('0x3f')](handleError(_0x24e6a8,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 92a4398..514bb54 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 _0x7217=['api','moment','bluebird','request-promise','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger'];(function(_0x73dcd,_0x482364){var _0x4949fa=function(_0x593f20){while(--_0x593f20){_0x73dcd['push'](_0x73dcd['shift']());}};_0x4949fa(++_0x482364);}(_0x7217,0x19e));var _0x7721=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x7217[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[{'name':_0x7721('0xc'),'fields':[_0x7721('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','../../config/logger','api'];(function(_0x24bb01,_0x1f23d2){var _0x53affc=function(_0x43afa6){while(--_0x43afa6){_0x24bb01['push'](_0x24bb01['shift']());}};_0x53affc(++_0x1f23d2);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x26f4a4,_0xeb0dc6){_0x26f4a4=_0x26f4a4-0x0;var _0x437404=_0x7fbe[_0x26f4a4];return _0x437404;};'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':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xe7fb('0xc'),'fields':[_0xe7fb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 24e4e60..7dfe500 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 _0x986c=['stringify','error','message','catch','CreateFaxQueueReport','FaxQueueReport','create','body','raw','UpdateFaxQueueReport','update','options','where','attributes','limit','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x986c,0x1d2));var _0xc986=function(_0x47b264,_0x1f717e){_0x47b264=_0x47b264-0x0;var _0x7de066=_0x986c[_0x47b264];return _0x7de066;};'use strict';var _=require(_0xc986('0x0'));var util=require(_0xc986('0x1'));var moment=require(_0xc986('0x2'));var BPromise=require(_0xc986('0x3'));var rs=require(_0xc986('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc986('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc986('0x6'))(_0xc986('0x7'));var config=require(_0xc986('0x8'));var jayson=require(_0xc986('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x11e578,_0x11b6ee,_0x41a8f8){return new BPromise(function(_0x56d4f3,_0x3d4f14){return client['request'](_0x11e578,_0x41a8f8)[_0xc986('0xa')](function(_0x2ca41b){logger[_0xc986('0xb')](_0xc986('0xc'),_0x11b6ee,_0xc986('0xd'));logger['debug']('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x11b6ee,_0xc986('0xd'),JSON[_0xc986('0xe')](_0x2ca41b));if(_0x2ca41b[_0xc986('0xf')]){if(_0x2ca41b[_0xc986('0xf')]['code']===0x1f4){logger[_0xc986('0xf')](_0xc986('0xc'),_0x11b6ee,_0x2ca41b['error'][_0xc986('0x10')]);return _0x3d4f14(_0x2ca41b['error'][_0xc986('0x10')]);}logger[_0xc986('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x11b6ee,_0x2ca41b[_0xc986('0xf')][_0xc986('0x10')]);return _0x56d4f3(_0x2ca41b[_0xc986('0xf')][_0xc986('0x10')]);}else{logger[_0xc986('0xb')](_0xc986('0xc'),_0x11b6ee,'request\x20sent');_0x56d4f3(_0x2ca41b['result'][_0xc986('0x10')]);}})[_0xc986('0x11')](function(_0x2e51fb){logger[_0xc986('0xf')](_0xc986('0xc'),_0x11b6ee,_0x2e51fb);_0x3d4f14(_0x2e51fb);});});}exports[_0xc986('0x12')]=function(_0x1c4a98){var _0x2aeb18=this;return new Promise(function(_0x532009,_0x4ad4e4){return db[_0xc986('0x13')][_0xc986('0x14')](_0x1c4a98[_0xc986('0x15')],{'raw':_0x1c4a98['options']?_0x1c4a98['options'][_0xc986('0x16')]===undefined?!![]:![]:!![]})[_0xc986('0xa')](function(_0x198dfa){logger[_0xc986('0xb')](_0xc986('0x12'),_0x1c4a98);logger['debug'](_0xc986('0x12'),_0x1c4a98,JSON[_0xc986('0xe')](_0x198dfa));_0x532009(_0x198dfa);})['catch'](function(_0x30ebdf){logger[_0xc986('0xf')](_0xc986('0x12'),_0x30ebdf['message'],_0x1c4a98);_0x4ad4e4(_0x2aeb18[_0xc986('0xf')](0x1f4,_0x30ebdf[_0xc986('0x10')]));});});};exports[_0xc986('0x17')]=function(_0x238164){var _0xf43047=this;return new Promise(function(_0x318260,_0x1b5893){return db[_0xc986('0x13')][_0xc986('0x18')](_0x238164[_0xc986('0x15')],{'raw':_0x238164['options']?_0x238164[_0xc986('0x19')][_0xc986('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x238164[_0xc986('0x19')]?_0x238164[_0xc986('0x19')][_0xc986('0x1a')]||null:null,'attributes':_0x238164[_0xc986('0x19')]?_0x238164[_0xc986('0x19')][_0xc986('0x1b')]||null:null,'limit':_0x238164[_0xc986('0x19')]?_0x238164[_0xc986('0x19')][_0xc986('0x1c')]||null:null})[_0xc986('0xa')](function(_0x2499b1){logger[_0xc986('0xb')]('UpdateFaxQueueReport',_0x238164);logger[_0xc986('0x1d')](_0xc986('0x17'),_0x238164,JSON[_0xc986('0xe')](_0x2499b1));_0x318260(_0x2499b1);})[_0xc986('0x11')](function(_0x1389a1){logger['error'](_0xc986('0x17'),_0x1389a1[_0xc986('0x10')],_0x238164);_0x1b5893(_0xf43047[_0xc986('0xf')](0x1f4,_0x1389a1[_0xc986('0x10')]));});});}; \ No newline at end of file +var _0xf3a5=['rpc','../../config/environment','client','request','then','info','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','options','raw','update','body','where','attributes','limit','UpdateFaxQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x4f7ab5,_0x29536b){var _0x4067cb=function(_0x435a09){while(--_0x435a09){_0x4f7ab5['push'](_0x4f7ab5['shift']());}};_0x4067cb(++_0x29536b);}(_0xf3a5,0x143));var _0x5f3a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf3a5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5f3a('0x0'));var util=require('util');var moment=require(_0x5f3a('0x1'));var BPromise=require(_0x5f3a('0x2'));var rs=require(_0x5f3a('0x3'));var fs=require('fs');var Redis=require(_0x5f3a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f3a('0x5'));var logger=require(_0x5f3a('0x6'))(_0x5f3a('0x7'));var config=require(_0x5f3a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5f3a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40348a,_0x8157ad,_0x22505c){return new BPromise(function(_0x4eeb0f,_0x1bf302){return client[_0x5f3a('0xa')](_0x40348a,_0x22505c)[_0x5f3a('0xb')](function(_0x54f064){logger[_0x5f3a('0xc')](_0x5f3a('0xd'),_0x8157ad,'request\x20sent');logger[_0x5f3a('0xe')](_0x5f3a('0xf'),_0x8157ad,_0x5f3a('0x10'),JSON[_0x5f3a('0x11')](_0x54f064));if(_0x54f064[_0x5f3a('0x12')]){if(_0x54f064['error'][_0x5f3a('0x13')]===0x1f4){logger[_0x5f3a('0x12')](_0x5f3a('0xd'),_0x8157ad,_0x54f064[_0x5f3a('0x12')]['message']);return _0x1bf302(_0x54f064[_0x5f3a('0x12')]['message']);}logger['error'](_0x5f3a('0xd'),_0x8157ad,_0x54f064[_0x5f3a('0x12')][_0x5f3a('0x14')]);return _0x4eeb0f(_0x54f064[_0x5f3a('0x12')][_0x5f3a('0x14')]);}else{logger[_0x5f3a('0xc')](_0x5f3a('0xd'),_0x8157ad,_0x5f3a('0x10'));_0x4eeb0f(_0x54f064[_0x5f3a('0x15')][_0x5f3a('0x14')]);}})[_0x5f3a('0x16')](function(_0x5e9635){logger[_0x5f3a('0x12')](_0x5f3a('0xd'),_0x8157ad,_0x5e9635);_0x1bf302(_0x5e9635);});});}exports[_0x5f3a('0x17')]=function(_0x2285a7){var _0x41e602=this;return new Promise(function(_0x30c2ff,_0x58ad97){return db[_0x5f3a('0x18')]['create'](_0x2285a7['body'],{'raw':_0x2285a7[_0x5f3a('0x19')]?_0x2285a7[_0x5f3a('0x19')][_0x5f3a('0x1a')]===undefined?!![]:![]:!![]})[_0x5f3a('0xb')](function(_0x18990c){logger[_0x5f3a('0xc')](_0x5f3a('0x17'),_0x2285a7);logger['debug'](_0x5f3a('0x17'),_0x2285a7,JSON['stringify'](_0x18990c));_0x30c2ff(_0x18990c);})[_0x5f3a('0x16')](function(_0x243ce3){logger['error'](_0x5f3a('0x17'),_0x243ce3[_0x5f3a('0x14')],_0x2285a7);_0x58ad97(_0x41e602['error'](0x1f4,_0x243ce3[_0x5f3a('0x14')]));});});};exports['UpdateFaxQueueReport']=function(_0x3a1acb){var _0x254d7f=this;return new Promise(function(_0x1c6043,_0x5e55e4){return db[_0x5f3a('0x18')][_0x5f3a('0x1b')](_0x3a1acb[_0x5f3a('0x1c')],{'raw':_0x3a1acb[_0x5f3a('0x19')]?_0x3a1acb['options'][_0x5f3a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a1acb[_0x5f3a('0x19')]?_0x3a1acb['options'][_0x5f3a('0x1d')]||null:null,'attributes':_0x3a1acb['options']?_0x3a1acb[_0x5f3a('0x19')][_0x5f3a('0x1e')]||null:null,'limit':_0x3a1acb['options']?_0x3a1acb[_0x5f3a('0x19')][_0x5f3a('0x1f')]||null:null})['then'](function(_0x24fa15){logger['info'](_0x5f3a('0x20'),_0x3a1acb);logger[_0x5f3a('0xe')]('UpdateFaxQueueReport',_0x3a1acb,JSON['stringify'](_0x24fa15));_0x1c6043(_0x24fa15);})[_0x5f3a('0x16')](function(_0x28689d){logger[_0x5f3a('0x12')](_0x5f3a('0x20'),_0x28689d['message'],_0x3a1acb);_0x5e55e4(_0x254d7f[_0x5f3a('0x12')](0x1f4,_0x28689d[_0x5f3a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index c62798e..5c832b4 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 _0x5ec1=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','post','update','destroy','multer','util'];(function(_0xaff6ff,_0x363fdc){var _0x4e6375=function(_0x39ee22){while(--_0x39ee22){_0xaff6ff['push'](_0xaff6ff['shift']());}};_0x4e6375(++_0x363fdc);}(_0x5ec1,0x184));var _0x15ec=function(_0x154192,_0x2d360f){_0x154192=_0x154192-0x0;var _0x3c2792=_0x5ec1[_0x154192];return _0x3c2792;};'use strict';var multer=require(_0x15ec('0x0'));var util=require(_0x15ec('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x15ec('0x2')]();var fs_extra=require(_0x15ec('0x3'));var auth=require(_0x15ec('0x4'));var interaction=require(_0x15ec('0x5'));var config=require(_0x15ec('0x6'));var controller=require('./faxQueueReport.controller');router[_0x15ec('0x7')]('/',auth[_0x15ec('0x8')](),controller['index']);router['get']('/describe',auth[_0x15ec('0x8')](),controller[_0x15ec('0x9')]);router['get'](_0x15ec('0xa'),auth[_0x15ec('0x8')](),controller[_0x15ec('0xb')]);router[_0x15ec('0xc')]('/',auth[_0x15ec('0x8')](),controller['create']);router['put'](_0x15ec('0xa'),auth['isAuthenticated'](),controller[_0x15ec('0xd')]);router['delete'](_0x15ec('0xa'),auth[_0x15ec('0x8')](),controller[_0x15ec('0xe')]);module['exports']=router; \ No newline at end of file +var _0x0a07=['put','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post'];(function(_0x423a9a,_0x2ec223){var _0x564475=function(_0x33b25a){while(--_0x33b25a){_0x423a9a['push'](_0x423a9a['shift']());}};_0x564475(++_0x2ec223);}(_0x0a07,0x101));var _0x70a0=function(_0x5e84a0,_0x54d944){_0x5e84a0=_0x5e84a0-0x0;var _0x43ce17=_0x0a07[_0x5e84a0];return _0x43ce17;};'use strict';var multer=require(_0x70a0('0x0'));var util=require(_0x70a0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x70a0('0x2')]();var fs_extra=require(_0x70a0('0x3'));var auth=require(_0x70a0('0x4'));var interaction=require(_0x70a0('0x5'));var config=require(_0x70a0('0x6'));var controller=require(_0x70a0('0x7'));router[_0x70a0('0x8')]('/',auth[_0x70a0('0x9')](),controller['index']);router[_0x70a0('0x8')](_0x70a0('0xa'),auth[_0x70a0('0x9')](),controller[_0x70a0('0xb')]);router['get'](_0x70a0('0xc'),auth[_0x70a0('0x9')](),controller[_0x70a0('0xd')]);router[_0x70a0('0xe')]('/',auth[_0x70a0('0x9')](),controller['create']);router[_0x70a0('0xf')](_0x70a0('0xc'),auth[_0x70a0('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x70a0('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index a832858..e9adc22 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 _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0xe4ef3b,_0x37d066){var _0x27df91=function(_0x448012){while(--_0x448012){_0xe4ef3b['push'](_0xe4ef3b['shift']());}};_0x27df91(++_0x37d066);}(_0xe706,0xa3));var _0x6e70=function(_0x1c9093,_0x31eb87){_0x1c9093=_0x1c9093-0x0;var _0x32dd36=_0xe706[_0x1c9093];return _0x32dd36;};'use strict';var moment=require(_0x6e70('0x0'));var Sequelize=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6e70('0x3')](_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'allowNull':![],'defaultValue':_0x6e70('0x6')},'transferredAt':{'type':Sequelize[_0x6e70('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6e70('0x8')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x5cc61d,_0x4fe17b){var _0x2e25d0=function(_0x265dd8){while(--_0x265dd8){_0x5cc61d['push'](_0x5cc61d['shift']());}};_0x2e25d0(++_0x4fe17b);}(_0x9c44,0x178));var _0x49c4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9c44[_0x465a0c];return _0x1e202e;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 593239b..cb40bae 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 _0x8904=['hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','destroy','find','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','FaxTransferReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x8904,0xb4));var _0x4890=function(_0x47a6b3,_0x1e16be){_0x47a6b3=_0x47a6b3-0x0;var _0x2c07f1=_0x8904[_0x47a6b3];return _0x2c07f1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4890('0x0'));var zipdir=require(_0x4890('0x1'));var jsonpatch=require(_0x4890('0x2'));var rp=require('request-promise');var moment=require(_0x4890('0x3'));var BPromise=require(_0x4890('0x4'));var Mustache=require(_0x4890('0x5'));var util=require(_0x4890('0x6'));var path=require(_0x4890('0x7'));var sox=require(_0x4890('0x8'));var csv=require(_0x4890('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4890('0xa'));var crypto=require(_0x4890('0xb'));var jsforce=require(_0x4890('0xc'));var deskjs=require(_0x4890('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4890('0xe'));var Papa=require(_0x4890('0xf'));var Redis=require(_0x4890('0x10'));var authService=require(_0x4890('0x11'));var qs=require(_0x4890('0x12'));var as=require(_0x4890('0x13'));var hardwareService=require(_0x4890('0x14'));var logger=require(_0x4890('0x15'))(_0x4890('0x16'));var utils=require('../../config/utils');var config=require(_0x4890('0x17'));var licenseUtil=require(_0x4890('0x18'));var db=require(_0x4890('0x19'))['db'];function respondWithStatusCode(_0x48a2a6,_0x4a58db){_0x4a58db=_0x4a58db||0xcc;return function(_0x2584ad){if(_0x2584ad){return _0x48a2a6[_0x4890('0x1a')](_0x4a58db);}return _0x48a2a6[_0x4890('0x1b')](_0x4a58db)[_0x4890('0x1c')]();};}function respondWithResult(_0x4bfb5b,_0x25618b){_0x25618b=_0x25618b||0xc8;return function(_0x2559d4){if(_0x2559d4){return _0x4bfb5b[_0x4890('0x1b')](_0x25618b)[_0x4890('0x1d')](_0x2559d4);}};}function respondWithFilteredResult(_0x1ba526,_0x14417c){return function(_0xb7731a){if(_0xb7731a){var _0x32b13d=typeof _0x14417c[_0x4890('0x1e')]===_0x4890('0x1f')&&typeof _0x14417c['limit']===_0x4890('0x1f');var _0x18a003=_0xb7731a[_0x4890('0x20')];var _0x304812=_0x32b13d?0x0:_0x14417c[_0x4890('0x1e')];var _0xd1fc6d=_0x32b13d?_0xb7731a[_0x4890('0x20')]:_0x14417c['offset']+_0x14417c[_0x4890('0x21')];var _0x15feb4;if(_0xd1fc6d>=_0x18a003){_0xd1fc6d=_0x18a003;_0x15feb4=0xc8;}else{_0x15feb4=0xce;}_0x1ba526[_0x4890('0x1b')](_0x15feb4);return _0x1ba526[_0x4890('0x22')](_0x4890('0x23'),_0x304812+'-'+_0xd1fc6d+'/'+_0x18a003)[_0x4890('0x1d')](_0xb7731a);}return null;};}function patchUpdates(_0x2656d6){return function(_0x56f7de){try{jsonpatch[_0x4890('0x24')](_0x56f7de,_0x2656d6,!![]);}catch(_0xffa50b){return BPromise[_0x4890('0x25')](_0xffa50b);}return _0x56f7de[_0x4890('0x26')]();};}function saveUpdates(_0x433055,_0x19d364){return function(_0x48365e){if(_0x48365e){return _0x48365e[_0x4890('0x27')](_0x433055)['then'](function(_0x4cd1b0){return _0x4cd1b0;});}return null;};}function removeEntity(_0x8bef7b,_0x48cc59){return function(_0x31ad76){if(_0x31ad76){return _0x31ad76['destroy']()[_0x4890('0x28')](function(){_0x8bef7b[_0x4890('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58c686,_0x2e7f19){return function(_0x5a60cb){if(!_0x5a60cb){_0x58c686['sendStatus'](0x194);}return _0x5a60cb;};}function handleError(_0x168107,_0x12e015){_0x12e015=_0x12e015||0x1f4;return function(_0x35a0a2){logger[_0x4890('0x29')](_0x35a0a2[_0x4890('0x2a')]);if(_0x35a0a2[_0x4890('0x2b')]){delete _0x35a0a2[_0x4890('0x2b')];}_0x168107[_0x4890('0x1b')](_0x12e015)['send'](_0x35a0a2);};}exports[_0x4890('0x2c')]=function(_0x35b9b9,_0x5cda85){var _0x117c89={},_0x5cb7a5={},_0x535731={'count':0x0,'rows':[]};var _0x179ca1=_[_0x4890('0x2d')](db[_0x4890('0x2e')][_0x4890('0x2f')],function(_0x128d5c){return{'name':_0x128d5c['fieldName'],'type':_0x128d5c[_0x4890('0x30')][_0x4890('0x31')]};});_0x5cb7a5[_0x4890('0x32')]=_[_0x4890('0x2d')](_0x179ca1,_0x4890('0x2b'));_0x5cb7a5['query']=_['keys'](_0x35b9b9[_0x4890('0x33')]);_0x5cb7a5[_0x4890('0x34')]=_[_0x4890('0x35')](_0x5cb7a5['model'],_0x5cb7a5['query']);_0x117c89[_0x4890('0x36')]=_[_0x4890('0x35')](_0x5cb7a5[_0x4890('0x32')],qs[_0x4890('0x37')](_0x35b9b9['query']['fields']));_0x117c89[_0x4890('0x36')]=_0x117c89[_0x4890('0x36')][_0x4890('0x38')]?_0x117c89[_0x4890('0x36')]:_0x5cb7a5['model'];if(!_0x35b9b9[_0x4890('0x33')][_0x4890('0x39')](_0x4890('0x3a'))){_0x117c89['limit']=qs[_0x4890('0x21')](_0x35b9b9[_0x4890('0x33')][_0x4890('0x21')]);_0x117c89[_0x4890('0x1e')]=qs['offset'](_0x35b9b9[_0x4890('0x33')][_0x4890('0x1e')]);}_0x117c89['order']=qs[_0x4890('0x3b')](_0x35b9b9[_0x4890('0x33')]['sort']);_0x117c89[_0x4890('0x3c')]=qs[_0x4890('0x34')](_[_0x4890('0x3d')](_0x35b9b9[_0x4890('0x33')],_0x5cb7a5[_0x4890('0x34')]),_0x179ca1);if(_0x35b9b9[_0x4890('0x33')][_0x4890('0x3e')]){_0x117c89[_0x4890('0x3c')]=_[_0x4890('0x3f')](_0x117c89[_0x4890('0x3c')],{'$or':_[_0x4890('0x2d')](_0x179ca1,function(_0x1b7137){if(_0x1b7137[_0x4890('0x30')]!==_0x4890('0x40')){var _0x46146a={};_0x46146a[_0x1b7137[_0x4890('0x2b')]]={'$like':'%'+_0x35b9b9['query'][_0x4890('0x3e')]+'%'};return _0x46146a;}})});}_0x117c89=_['merge']({},_0x117c89,_0x35b9b9[_0x4890('0x41')]);var _0x580fed={'where':_0x117c89[_0x4890('0x3c')]};return db['FaxTransferReport'][_0x4890('0x20')](_0x580fed)[_0x4890('0x28')](function(_0x11face){_0x535731[_0x4890('0x20')]=_0x11face;if(_0x35b9b9['query'][_0x4890('0x42')]){_0x117c89[_0x4890('0x43')]=[{'all':!![]}];}return db[_0x4890('0x2e')][_0x4890('0x44')](_0x117c89);})['then'](function(_0x4d8f5e){_0x535731[_0x4890('0x45')]=_0x4d8f5e;return _0x535731;})[_0x4890('0x28')](respondWithFilteredResult(_0x5cda85,_0x117c89))[_0x4890('0x46')](handleError(_0x5cda85,null));};exports[_0x4890('0x47')]=function(_0x49aef6,_0x141ece){var _0x5c5072={'raw':!![],'where':{'id':_0x49aef6[_0x4890('0x48')]['id']}},_0x32a639={};_0x32a639[_0x4890('0x32')]=_[_0x4890('0x49')](db['FaxTransferReport']['rawAttributes']);_0x32a639[_0x4890('0x33')]=_[_0x4890('0x49')](_0x49aef6[_0x4890('0x33')]);_0x32a639[_0x4890('0x34')]=_[_0x4890('0x35')](_0x32a639[_0x4890('0x32')],_0x32a639[_0x4890('0x33')]);_0x5c5072[_0x4890('0x36')]=_['intersection'](_0x32a639[_0x4890('0x32')],qs[_0x4890('0x37')](_0x49aef6[_0x4890('0x33')]['fields']));_0x5c5072[_0x4890('0x36')]=_0x5c5072[_0x4890('0x36')]['length']?_0x5c5072['attributes']:_0x32a639['model'];if(_0x49aef6['query']['includeAll']){_0x5c5072['include']=[{'all':!![]}];}_0x5c5072=_[_0x4890('0x3f')]({},_0x5c5072,_0x49aef6['options']);return db[_0x4890('0x2e')]['find'](_0x5c5072)[_0x4890('0x28')](handleEntityNotFound(_0x141ece,null))['then'](respondWithResult(_0x141ece,null))[_0x4890('0x46')](handleError(_0x141ece,null));};exports[_0x4890('0x4a')]=function(_0x5eb2cc,_0x5ed114){return db[_0x4890('0x2e')][_0x4890('0x4a')](_0x5eb2cc[_0x4890('0x4b')],{})['then'](respondWithResult(_0x5ed114,0xc9))[_0x4890('0x46')](handleError(_0x5ed114,null));};exports[_0x4890('0x27')]=function(_0x52f90c,_0x5a6143){if(_0x52f90c['body']['id']){delete _0x52f90c[_0x4890('0x4b')]['id'];}return db[_0x4890('0x2e')]['find']({'where':{'id':_0x52f90c['params']['id']}})['then'](handleEntityNotFound(_0x5a6143,null))['then'](saveUpdates(_0x52f90c[_0x4890('0x4b')],null))[_0x4890('0x28')](respondWithResult(_0x5a6143,null))[_0x4890('0x46')](handleError(_0x5a6143,null));};exports[_0x4890('0x4c')]=function(_0x346c1a,_0x52685f){return db[_0x4890('0x2e')][_0x4890('0x4d')]({'where':{'id':_0x346c1a[_0x4890('0x48')]['id']}})[_0x4890('0x28')](handleEntityNotFound(_0x52685f,null))[_0x4890('0x28')](removeEntity(_0x52685f,null))['catch'](handleError(_0x52685f,null));};exports[_0x4890('0x4e')]=function(_0x184f4c,_0x23fa79){return db[_0x4890('0x2e')]['describe']()[_0x4890('0x28')](respondWithResult(_0x23fa79,null))[_0x4890('0x46')](handleError(_0x23fa79,null));}; \ No newline at end of file +var _0x1184=['sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','apply','reject','update','then','error','stack','name','map','FaxTransferReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x4450b1,_0x214ace){var _0x399b0b=function(_0x2197df){while(--_0x2197df){_0x4450b1['push'](_0x4450b1['shift']());}};_0x399b0b(++_0x214ace);}(_0x1184,0xe7));var _0x4118=function(_0x1047b8,_0x51a603){_0x1047b8=_0x1047b8-0x0;var _0x304a8c=_0x1184[_0x1047b8];return _0x304a8c;};'use strict';var emlformat=require(_0x4118('0x0'));var rimraf=require(_0x4118('0x1'));var zipdir=require(_0x4118('0x2'));var jsonpatch=require(_0x4118('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4118('0x4'));var Mustache=require(_0x4118('0x5'));var util=require(_0x4118('0x6'));var path=require(_0x4118('0x7'));var sox=require(_0x4118('0x8'));var csv=require(_0x4118('0x9'));var ejs=require(_0x4118('0xa'));var fs=require('fs');var fs_extra=require(_0x4118('0xb'));var _=require(_0x4118('0xc'));var squel=require(_0x4118('0xd'));var crypto=require(_0x4118('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4118('0xf'));var toCsv=require(_0x4118('0x9'));var querystring=require('querystring');var Papa=require(_0x4118('0x10'));var Redis=require(_0x4118('0x11'));var authService=require(_0x4118('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4118('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4118('0x14'));var utils=require('../../config/utils');var config=require(_0x4118('0x15'));var licenseUtil=require(_0x4118('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43d85f,_0xb64a84){_0xb64a84=_0xb64a84||0xcc;return function(_0x450820){if(_0x450820){return _0x43d85f[_0x4118('0x17')](_0xb64a84);}return _0x43d85f[_0x4118('0x18')](_0xb64a84)['end']();};}function respondWithResult(_0x19f916,_0x4cdd46){_0x4cdd46=_0x4cdd46||0xc8;return function(_0x536f63){if(_0x536f63){return _0x19f916['status'](_0x4cdd46)[_0x4118('0x19')](_0x536f63);}};}function respondWithFilteredResult(_0x4b3339,_0xd892fe){return function(_0x3efae1){if(_0x3efae1){var _0x3da2a0=typeof _0xd892fe[_0x4118('0x1a')]===_0x4118('0x1b')&&typeof _0xd892fe['limit']==='undefined';var _0x596220=_0x3efae1['count'];var _0x7df354=_0x3da2a0?0x0:_0xd892fe[_0x4118('0x1a')];var _0x92a4d9=_0x3da2a0?_0x3efae1[_0x4118('0x1c')]:_0xd892fe['offset']+_0xd892fe[_0x4118('0x1d')];var _0x5ccd06;if(_0x92a4d9>=_0x596220){_0x92a4d9=_0x596220;_0x5ccd06=0xc8;}else{_0x5ccd06=0xce;}_0x4b3339['status'](_0x5ccd06);return _0x4b3339['set']('Content-Range',_0x7df354+'-'+_0x92a4d9+'/'+_0x596220)[_0x4118('0x19')](_0x3efae1);}return null;};}function patchUpdates(_0x4ca1b6){return function(_0x199146){try{jsonpatch[_0x4118('0x1e')](_0x199146,_0x4ca1b6,!![]);}catch(_0x5b9b3a){return BPromise[_0x4118('0x1f')](_0x5b9b3a);}return _0x199146['save']();};}function saveUpdates(_0x111869,_0x325cdb){return function(_0x57b9f0){if(_0x57b9f0){return _0x57b9f0[_0x4118('0x20')](_0x111869)[_0x4118('0x21')](function(_0x36d91e){return _0x36d91e;});}return null;};}function removeEntity(_0x45e8d2,_0x1a7467){return function(_0x3b6ae2){if(_0x3b6ae2){return _0x3b6ae2['destroy']()[_0x4118('0x21')](function(){_0x45e8d2[_0x4118('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26224a,_0x4a5a28){return function(_0x5eb0c2){if(!_0x5eb0c2){_0x26224a[_0x4118('0x17')](0x194);}return _0x5eb0c2;};}function handleError(_0xe617b4,_0x47e211){_0x47e211=_0x47e211||0x1f4;return function(_0x394892){logger[_0x4118('0x22')](_0x394892[_0x4118('0x23')]);if(_0x394892[_0x4118('0x24')]){delete _0x394892[_0x4118('0x24')];}_0xe617b4[_0x4118('0x18')](_0x47e211)['send'](_0x394892);};}exports['index']=function(_0x18a4ca,_0x375182){var _0x3bcc9f={},_0x11f4c4={},_0x570d81={'count':0x0,'rows':[]};var _0x45b3b6=_[_0x4118('0x25')](db[_0x4118('0x26')][_0x4118('0x27')],function(_0x65f809){return{'name':_0x65f809[_0x4118('0x28')],'type':_0x65f809[_0x4118('0x29')]['key']};});_0x11f4c4['model']=_[_0x4118('0x25')](_0x45b3b6,'name');_0x11f4c4[_0x4118('0x2a')]=_[_0x4118('0x2b')](_0x18a4ca[_0x4118('0x2a')]);_0x11f4c4[_0x4118('0x2c')]=_[_0x4118('0x2d')](_0x11f4c4[_0x4118('0x2e')],_0x11f4c4['query']);_0x3bcc9f[_0x4118('0x2f')]=_['intersection'](_0x11f4c4[_0x4118('0x2e')],qs[_0x4118('0x30')](_0x18a4ca[_0x4118('0x2a')]['fields']));_0x3bcc9f[_0x4118('0x2f')]=_0x3bcc9f[_0x4118('0x2f')][_0x4118('0x31')]?_0x3bcc9f['attributes']:_0x11f4c4[_0x4118('0x2e')];if(!_0x18a4ca[_0x4118('0x2a')][_0x4118('0x32')](_0x4118('0x33'))){_0x3bcc9f['limit']=qs[_0x4118('0x1d')](_0x18a4ca[_0x4118('0x2a')][_0x4118('0x1d')]);_0x3bcc9f[_0x4118('0x1a')]=qs['offset'](_0x18a4ca[_0x4118('0x2a')]['offset']);}_0x3bcc9f[_0x4118('0x34')]=qs[_0x4118('0x35')](_0x18a4ca['query']['sort']);_0x3bcc9f[_0x4118('0x36')]=qs[_0x4118('0x2c')](_[_0x4118('0x37')](_0x18a4ca[_0x4118('0x2a')],_0x11f4c4[_0x4118('0x2c')]),_0x45b3b6);if(_0x18a4ca[_0x4118('0x2a')][_0x4118('0x38')]){_0x3bcc9f[_0x4118('0x36')]=_[_0x4118('0x39')](_0x3bcc9f[_0x4118('0x36')],{'$or':_[_0x4118('0x25')](_0x45b3b6,function(_0x457606){if(_0x457606[_0x4118('0x29')]!==_0x4118('0x3a')){var _0x43e86f={};_0x43e86f[_0x457606[_0x4118('0x24')]]={'$like':'%'+_0x18a4ca[_0x4118('0x2a')][_0x4118('0x38')]+'%'};return _0x43e86f;}})});}_0x3bcc9f=_[_0x4118('0x39')]({},_0x3bcc9f,_0x18a4ca[_0x4118('0x3b')]);var _0x2cc511={'where':_0x3bcc9f['where']};return db[_0x4118('0x26')]['count'](_0x2cc511)[_0x4118('0x21')](function(_0x24e921){_0x570d81[_0x4118('0x1c')]=_0x24e921;if(_0x18a4ca['query']['includeAll']){_0x3bcc9f[_0x4118('0x3c')]=[{'all':!![]}];}return db[_0x4118('0x26')][_0x4118('0x3d')](_0x3bcc9f);})['then'](function(_0x4e20c3){_0x570d81[_0x4118('0x3e')]=_0x4e20c3;return _0x570d81;})[_0x4118('0x21')](respondWithFilteredResult(_0x375182,_0x3bcc9f))[_0x4118('0x3f')](handleError(_0x375182,null));};exports['show']=function(_0x55b980,_0x170ba3){var _0x10cba4={'raw':!![],'where':{'id':_0x55b980[_0x4118('0x40')]['id']}},_0x2b2f60={};_0x2b2f60['model']=_[_0x4118('0x2b')](db[_0x4118('0x26')][_0x4118('0x27')]);_0x2b2f60[_0x4118('0x2a')]=_[_0x4118('0x2b')](_0x55b980[_0x4118('0x2a')]);_0x2b2f60[_0x4118('0x2c')]=_[_0x4118('0x2d')](_0x2b2f60[_0x4118('0x2e')],_0x2b2f60[_0x4118('0x2a')]);_0x10cba4[_0x4118('0x2f')]=_[_0x4118('0x2d')](_0x2b2f60[_0x4118('0x2e')],qs[_0x4118('0x30')](_0x55b980[_0x4118('0x2a')][_0x4118('0x30')]));_0x10cba4[_0x4118('0x2f')]=_0x10cba4['attributes'][_0x4118('0x31')]?_0x10cba4[_0x4118('0x2f')]:_0x2b2f60[_0x4118('0x2e')];if(_0x55b980[_0x4118('0x2a')][_0x4118('0x41')]){_0x10cba4[_0x4118('0x3c')]=[{'all':!![]}];}_0x10cba4=_[_0x4118('0x39')]({},_0x10cba4,_0x55b980[_0x4118('0x3b')]);return db[_0x4118('0x26')][_0x4118('0x42')](_0x10cba4)[_0x4118('0x21')](handleEntityNotFound(_0x170ba3,null))[_0x4118('0x21')](respondWithResult(_0x170ba3,null))['catch'](handleError(_0x170ba3,null));};exports[_0x4118('0x43')]=function(_0x4ee99a,_0x215a62){return db['FaxTransferReport'][_0x4118('0x43')](_0x4ee99a[_0x4118('0x44')],{})[_0x4118('0x21')](respondWithResult(_0x215a62,0xc9))[_0x4118('0x3f')](handleError(_0x215a62,null));};exports['update']=function(_0x29318e,_0x1c1d3e){if(_0x29318e[_0x4118('0x44')]['id']){delete _0x29318e[_0x4118('0x44')]['id'];}return db[_0x4118('0x26')][_0x4118('0x42')]({'where':{'id':_0x29318e[_0x4118('0x40')]['id']}})[_0x4118('0x21')](handleEntityNotFound(_0x1c1d3e,null))[_0x4118('0x21')](saveUpdates(_0x29318e[_0x4118('0x44')],null))[_0x4118('0x21')](respondWithResult(_0x1c1d3e,null))[_0x4118('0x3f')](handleError(_0x1c1d3e,null));};exports[_0x4118('0x45')]=function(_0x28a800,_0x2e5be2){return db[_0x4118('0x26')][_0x4118('0x42')]({'where':{'id':_0x28a800[_0x4118('0x40')]['id']}})[_0x4118('0x21')](handleEntityNotFound(_0x2e5be2,null))[_0x4118('0x21')](removeEntity(_0x2e5be2,null))[_0x4118('0x3f')](handleError(_0x2e5be2,null));};exports['describe']=function(_0x2867a5,_0xc6bd7f){return db[_0x4118('0x26')][_0x4118('0x46')]()['then'](respondWithResult(_0xc6bd7f,null))[_0x4118('0x3f')](handleError(_0xc6bd7f,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index bfdb9a7..c49de19 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 _0x707b=['rimraf','../../config/environment','./faxTransferReport.attributes','exports','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','moment','path'];(function(_0x2640fa,_0xaeaf32){var _0x5aa2cd=function(_0x3a0bf2){while(--_0x3a0bf2){_0x2640fa['push'](_0x2640fa['shift']());}};_0x5aa2cd(++_0xaeaf32);}(_0x707b,0xdf));var _0xb707=function(_0x503d48,_0x42e5a9){_0x503d48=_0x503d48-0x0;var _0x59743e=_0x707b[_0x503d48];return _0x59743e;};'use strict';var _=require(_0xb707('0x0'));var util=require(_0xb707('0x1'));var logger=require(_0xb707('0x2'))('api');var moment=require(_0xb707('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb707('0x4'));var rimraf=require(_0xb707('0x5'));var config=require(_0xb707('0x6'));var attributes=require(_0xb707('0x7'));module[_0xb707('0x8')]=function(_0x5b6fc6,_0x4b8f73){return _0x5b6fc6['define'](_0xb707('0x9'),attributes,{'tableName':_0xb707('0xa'),'paranoid':![],'indexes':[{'name':_0xb707('0xb'),'fields':[_0xb707('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x98c3=['define','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes'];(function(_0x631a3c,_0x1b61b6){var _0x2bdfa3=function(_0x21711b){while(--_0x21711b){_0x631a3c['push'](_0x631a3c['shift']());}};_0x2bdfa3(++_0x1b61b6);}(_0x98c3,0xab));var _0x398c=function(_0x53c2e7,_0x4e897f){_0x53c2e7=_0x53c2e7-0x0;var _0xf44005=_0x98c3[_0x53c2e7];return _0xf44005;};'use strict';var _=require(_0x398c('0x0'));var util=require(_0x398c('0x1'));var logger=require(_0x398c('0x2'))(_0x398c('0x3'));var moment=require(_0x398c('0x4'));var BPromise=require(_0x398c('0x5'));var rp=require(_0x398c('0x6'));var fs=require('fs');var path=require(_0x398c('0x7'));var rimraf=require(_0x398c('0x8'));var config=require(_0x398c('0x9'));var attributes=require(_0x398c('0xa'));module['exports']=function(_0x1ec8ca,_0x57d7cc){return _0x1ec8ca[_0x398c('0xb')]('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x398c('0xc'),'fields':[_0x398c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index f09db1c..8fc40bc 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 _0x6dc6=['code','message','FaxTransferReport,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x51b3b6,_0x57fc11){var _0xf6020=function(_0x86d377){while(--_0x86d377){_0x51b3b6['push'](_0x51b3b6['shift']());}};_0xf6020(++_0x57fc11);}(_0x6dc6,0xeb));var _0x66dc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6dc6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x66dc('0x0'));var util=require(_0x66dc('0x1'));var moment=require(_0x66dc('0x2'));var BPromise=require(_0x66dc('0x3'));var rs=require(_0x66dc('0x4'));var fs=require('fs');var Redis=require(_0x66dc('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x66dc('0x6'));var logger=require('../../config/logger')(_0x66dc('0x7'));var config=require(_0x66dc('0x8'));var jayson=require(_0x66dc('0x9'));var client=jayson[_0x66dc('0xa')][_0x66dc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x32a390,_0xd3f65b,_0x159c09){return new BPromise(function(_0xe7756c,_0x5664eb){return client[_0x66dc('0xc')](_0x32a390,_0x159c09)[_0x66dc('0xd')](function(_0x1480fc){logger['info']('FaxTransferReport,\x20%s,\x20%s',_0xd3f65b,_0x66dc('0xe'));logger['debug'](_0x66dc('0xf'),_0xd3f65b,_0x66dc('0xe'),JSON[_0x66dc('0x10')](_0x1480fc));if(_0x1480fc['error']){if(_0x1480fc[_0x66dc('0x11')][_0x66dc('0x12')]===0x1f4){logger[_0x66dc('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0xd3f65b,_0x1480fc[_0x66dc('0x11')]['message']);return _0x5664eb(_0x1480fc['error'][_0x66dc('0x13')]);}logger['error'](_0x66dc('0x14'),_0xd3f65b,_0x1480fc[_0x66dc('0x11')]['message']);return _0xe7756c(_0x1480fc[_0x66dc('0x11')][_0x66dc('0x13')]);}else{logger['info'](_0x66dc('0x14'),_0xd3f65b,_0x66dc('0xe'));_0xe7756c(_0x1480fc[_0x66dc('0x15')][_0x66dc('0x13')]);}})[_0x66dc('0x16')](function(_0x47d543){logger[_0x66dc('0x11')](_0x66dc('0x14'),_0xd3f65b,_0x47d543);_0x5664eb(_0x47d543);});});} \ No newline at end of file +var _0x68c4=['stringify','error','message','result','catch','util','moment','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x181451,_0x1331d1){var _0x165333=function(_0x1bdb3f){while(--_0x1bdb3f){_0x181451['push'](_0x181451['shift']());}};_0x165333(++_0x1331d1);}(_0x68c4,0x131));var _0x468c=function(_0x4296b3,_0x58c241){_0x4296b3=_0x4296b3-0x0;var _0x146ad8=_0x68c4[_0x4296b3];return _0x146ad8;};'use strict';var _=require('lodash');var util=require(_0x468c('0x0'));var moment=require(_0x468c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x468c('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x468c('0x3'));var logger=require('../../config/logger')(_0x468c('0x4'));var config=require(_0x468c('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x468c('0x6')][_0x468c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x330dd9,_0x388a8e,_0x922e88){return new BPromise(function(_0x3a2ebc,_0x55bc9a){return client[_0x468c('0x8')](_0x330dd9,_0x922e88)[_0x468c('0x9')](function(_0x3618dd){logger[_0x468c('0xa')](_0x468c('0xb'),_0x388a8e,_0x468c('0xc'));logger[_0x468c('0xd')](_0x468c('0xe'),_0x388a8e,_0x468c('0xc'),JSON[_0x468c('0xf')](_0x3618dd));if(_0x3618dd[_0x468c('0x10')]){if(_0x3618dd[_0x468c('0x10')]['code']===0x1f4){logger['error'](_0x468c('0xb'),_0x388a8e,_0x3618dd[_0x468c('0x10')][_0x468c('0x11')]);return _0x55bc9a(_0x3618dd[_0x468c('0x10')][_0x468c('0x11')]);}logger[_0x468c('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x388a8e,_0x3618dd[_0x468c('0x10')]['message']);return _0x3a2ebc(_0x3618dd[_0x468c('0x10')][_0x468c('0x11')]);}else{logger[_0x468c('0xa')](_0x468c('0xb'),_0x388a8e,_0x468c('0xc'));_0x3a2ebc(_0x3618dd[_0x468c('0x12')]['message']);}})[_0x468c('0x13')](function(_0x427eff){logger[_0x468c('0x10')](_0x468c('0xb'),_0x388a8e,_0x427eff);_0x55bc9a(_0x427eff);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index e790592..7d2b2d1 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 _0x6ac1=['describe','/:id','show','post','create','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller','get','index','/describe','isAuthenticated'];(function(_0x38b1c7,_0x4dcb3b){var _0x146e21=function(_0x1ea9f1){while(--_0x1ea9f1){_0x38b1c7['push'](_0x38b1c7['shift']());}};_0x146e21(++_0x4dcb3b);}(_0x6ac1,0x1ac));var _0x16ac=function(_0x1d7907,_0x131382){_0x1d7907=_0x1d7907-0x0;var _0x4656fa=_0x6ac1[_0x1d7907];return _0x4656fa;};'use strict';var multer=require(_0x16ac('0x0'));var util=require('util');var path=require(_0x16ac('0x1'));var timeout=require(_0x16ac('0x2'));var express=require(_0x16ac('0x3'));var router=express['Router']();var fs_extra=require(_0x16ac('0x4'));var auth=require(_0x16ac('0x5'));var interaction=require(_0x16ac('0x6'));var config=require('../../config/environment');var controller=require(_0x16ac('0x7'));router[_0x16ac('0x8')]('/',auth['isAuthenticated'](),controller[_0x16ac('0x9')]);router[_0x16ac('0x8')](_0x16ac('0xa'),auth[_0x16ac('0xb')](),controller[_0x16ac('0xc')]);router['get'](_0x16ac('0xd'),auth['isAuthenticated'](),controller[_0x16ac('0xe')]);router[_0x16ac('0xf')]('/',auth['isAuthenticated'](),controller[_0x16ac('0x10')]);router['put'](_0x16ac('0xd'),auth[_0x16ac('0xb')](),controller[_0x16ac('0x11')]);router['delete'](_0x16ac('0xd'),auth['isAuthenticated'](),controller[_0x16ac('0x12')]);module[_0x16ac('0x13')]=router; \ No newline at end of file +var _0xcc31=['../../config/environment','isAuthenticated','index','get','/describe','/:id','create','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2769f6,_0x4261a3){var _0x302769=function(_0x5ebd48){while(--_0x5ebd48){_0x2769f6['push'](_0x2769f6['shift']());}};_0x302769(++_0x4261a3);}(_0xcc31,0x72));var _0x1cc3=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xcc31[_0x433a86];return _0x23000c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cc3('0x0'));var timeout=require(_0x1cc3('0x1'));var express=require(_0x1cc3('0x2'));var router=express[_0x1cc3('0x3')]();var fs_extra=require(_0x1cc3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1cc3('0x5'));var config=require(_0x1cc3('0x6'));var controller=require('./faxTransferReport.controller');router['get']('/',auth[_0x1cc3('0x7')](),controller[_0x1cc3('0x8')]);router[_0x1cc3('0x9')](_0x1cc3('0xa'),auth[_0x1cc3('0x7')](),controller['describe']);router[_0x1cc3('0x9')](_0x1cc3('0xb'),auth[_0x1cc3('0x7')](),controller['show']);router['post']('/',auth[_0x1cc3('0x7')](),controller[_0x1cc3('0xc')]);router['put'](_0x1cc3('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x1cc3('0xd')](_0x1cc3('0xb'),auth[_0x1cc3('0x7')](),controller['destroy']);module[_0x1cc3('0xe')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 3197f00..de3a9f3 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 _0xc86a=['exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy'];(function(_0x39f928,_0x4139ed){var _0x1a4646=function(_0x4cd277){while(--_0x4cd277){_0x39f928['push'](_0x39f928['shift']());}};_0x1a4646(++_0x4139ed);}(_0xc86a,0xf1));var _0xac86=function(_0xcfe8cc,_0xb83aeb){_0xcfe8cc=_0xcfe8cc-0x0;var _0x55ac53=_0xc86a[_0xcfe8cc];return _0x55ac53;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xac86('0x0'));var timeout=require(_0xac86('0x1'));var express=require(_0xac86('0x2'));var router=express[_0xac86('0x3')]();var fs_extra=require(_0xac86('0x4'));var auth=require(_0xac86('0x5'));var interaction=require(_0xac86('0x6'));var config=require(_0xac86('0x7'));var controller=require(_0xac86('0x8'));router[_0xac86('0x9')]('/',auth[_0xac86('0xa')](),controller[_0xac86('0xb')]);router['get'](_0xac86('0xc'),auth[_0xac86('0xa')](),controller[_0xac86('0xd')]);router['get'](_0xac86('0xe'),auth[_0xac86('0xa')](),controller['getConfigurations']);router[_0xac86('0x9')](_0xac86('0xf'),auth[_0xac86('0xa')](),controller[_0xac86('0x10')]);router[_0xac86('0x11')]('/',auth[_0xac86('0xa')](),controller[_0xac86('0x12')]);router[_0xac86('0x11')](_0xac86('0xe'),auth['isAuthenticated'](),controller[_0xac86('0x13')]);router[_0xac86('0x14')](_0xac86('0xc'),auth[_0xac86('0xa')](),controller['update']);router[_0xac86('0x15')](_0xac86('0xc'),auth[_0xac86('0xa')](),controller[_0xac86('0x16')]);module[_0xac86('0x17')]=router; \ No newline at end of file +var _0x883b=['get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','./intDeskAccount.controller','isAuthenticated','index','/:id','show'];(function(_0x14c1dd,_0x5346e4){var _0xfa7b7=function(_0x2579a5){while(--_0x2579a5){_0x14c1dd['push'](_0x14c1dd['shift']());}};_0xfa7b7(++_0x5346e4);}(_0x883b,0x13f));var _0xb883=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x883b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xb883('0x0'));var path=require(_0xb883('0x1'));var timeout=require(_0xb883('0x2'));var express=require(_0xb883('0x3'));var router=express[_0xb883('0x4')]();var fs_extra=require(_0xb883('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb883('0x6'));router['get']('/',auth[_0xb883('0x7')](),controller[_0xb883('0x8')]);router['get'](_0xb883('0x9'),auth['isAuthenticated'](),controller[_0xb883('0xa')]);router[_0xb883('0xb')](_0xb883('0xc'),auth[_0xb883('0x7')](),controller[_0xb883('0xd')]);router[_0xb883('0xb')](_0xb883('0xe'),auth[_0xb883('0x7')](),controller[_0xb883('0xf')]);router['post']('/',auth[_0xb883('0x7')](),controller['create']);router[_0xb883('0x10')](_0xb883('0xc'),auth[_0xb883('0x7')](),controller[_0xb883('0x11')]);router[_0xb883('0x12')]('/:id',auth[_0xb883('0x7')](),controller['update']);router[_0xb883('0x13')](_0xb883('0x9'),auth[_0xb883('0x7')](),controller[_0xb883('0x14')]);module[_0xb883('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index e32cf73..e90b0c0 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 _0xa531=['basic','newTab','integrationTab','STRING','ENUM'];(function(_0x50b750,_0xe5817b){var _0x1b60a8=function(_0x23a6e8){while(--_0x23a6e8){_0x50b750['push'](_0x50b750['shift']());}};_0x1b60a8(++_0xe5817b);}(_0xa531,0x111));var _0x1a53=function(_0x613bd0,_0x2abfa0){_0x613bd0=_0x613bd0-0x0;var _0x5e6b01=_0xa531[_0x613bd0];return _0x5e6b01;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1a53('0x0')]},'username':{'type':Sequelize[_0x1a53('0x0')]},'remoteUri':{'type':Sequelize[_0x1a53('0x0')]},'authType':{'type':Sequelize[_0x1a53('0x1')]('basic'),'defaultValue':_0x1a53('0x2')},'password':{'type':Sequelize[_0x1a53('0x0')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x1a53('0x0')]},'token':{'type':Sequelize[_0x1a53('0x0')]},'tokenSecret':{'type':Sequelize[_0x1a53('0x0')]},'serverUrl':{'type':Sequelize[_0x1a53('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x1a53('0x1')]('integrationTab',_0x1a53('0x3')),'defaultValue':_0x1a53('0x4')}}; \ No newline at end of file +var _0x805e=['sequelize','STRING','ENUM','basic','integrationTab'];(function(_0x37ce48,_0x1ab976){var _0xa62d35=function(_0x15cb87){while(--_0x15cb87){_0x37ce48['push'](_0x37ce48['shift']());}};_0xa62d35(++_0x1ab976);}(_0x805e,0x168));var _0xe805=function(_0x891b81,_0xfbb107){_0x891b81=_0x891b81-0x0;var _0x585932=_0x805e[_0x891b81];return _0x585932;};'use strict';var Sequelize=require(_0xe805('0x0'));module['exports']={'name':{'type':Sequelize[_0xe805('0x1')]},'description':{'type':Sequelize[_0xe805('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xe805('0x1')]},'authType':{'type':Sequelize[_0xe805('0x2')]('basic'),'defaultValue':_0xe805('0x3')},'password':{'type':Sequelize[_0xe805('0x1')]},'consumerKey':{'type':Sequelize[_0xe805('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xe805('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xe805('0x2')](_0xe805('0x4'),'newTab'),'defaultValue':_0xe805('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 3a65db1..b4f553e 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 _0x2f81=['apply','save','then','error','stack','name','send','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','DeskAccount','include','rows','show','params','rawAttributes','keys','length','includeAll','find','catch','create','body','getConfigurations','findOne','DeskConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','password','consumerKey','token','tokenSecret','remoteUri','slice','lastIndexOf','GET','format','%s/custom_fields','application/json','authType','basic','headers','Authorization','Basic\x20%s','%s:%s','username','toString','active','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','limit','undefined','count','set'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2f81,0xba));var _0x12f8=function(_0x2425ed,_0x3a6637){_0x2425ed=_0x2425ed-0x0;var _0x8ce321=_0x2f81[_0x2425ed];return _0x8ce321;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x12f8('0x0'));var jsonpatch=require(_0x12f8('0x1'));var rp=require(_0x12f8('0x2'));var moment=require('moment');var BPromise=require(_0x12f8('0x3'));var Mustache=require(_0x12f8('0x4'));var util=require('util');var path=require(_0x12f8('0x5'));var sox=require(_0x12f8('0x6'));var csv=require(_0x12f8('0x7'));var ejs=require(_0x12f8('0x8'));var fs=require('fs');var fs_extra=require(_0x12f8('0x9'));var _=require(_0x12f8('0xa'));var squel=require(_0x12f8('0xb'));var crypto=require(_0x12f8('0xc'));var jsforce=require(_0x12f8('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x12f8('0xe'));var Papa=require(_0x12f8('0xf'));var Redis=require(_0x12f8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x12f8('0x11'));var as=require(_0x12f8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x12f8('0x13'))(_0x12f8('0x14'));var utils=require('../../config/utils');var config=require(_0x12f8('0x15'));var licenseUtil=require(_0x12f8('0x16'));var db=require(_0x12f8('0x17'))['db'];var integrations=require(_0x12f8('0x18'));function respondWithStatusCode(_0x3eea66,_0x41ab56){_0x41ab56=_0x41ab56||0xcc;return function(_0x1ead1f){if(_0x1ead1f){return _0x3eea66[_0x12f8('0x19')](_0x41ab56);}return _0x3eea66['status'](_0x41ab56)[_0x12f8('0x1a')]();};}function respondWithResult(_0x43639c,_0x1c6894){_0x1c6894=_0x1c6894||0xc8;return function(_0x47abd6){if(_0x47abd6){return _0x43639c[_0x12f8('0x1b')](_0x1c6894)[_0x12f8('0x1c')](_0x47abd6);}};}function respondWithFilteredResult(_0x10e396,_0x23b1af){return function(_0x5ad244){if(_0x5ad244){var _0x3d801b=typeof _0x23b1af[_0x12f8('0x1d')]==='undefined'&&typeof _0x23b1af[_0x12f8('0x1e')]===_0x12f8('0x1f');var _0x27e492=_0x5ad244[_0x12f8('0x20')];var _0x4eff35=_0x3d801b?0x0:_0x23b1af['offset'];var _0x504f4e=_0x3d801b?_0x5ad244[_0x12f8('0x20')]:_0x23b1af[_0x12f8('0x1d')]+_0x23b1af['limit'];var _0x2c050a;if(_0x504f4e>=_0x27e492){_0x504f4e=_0x27e492;_0x2c050a=0xc8;}else{_0x2c050a=0xce;}_0x10e396[_0x12f8('0x1b')](_0x2c050a);return _0x10e396[_0x12f8('0x21')]('Content-Range',_0x4eff35+'-'+_0x504f4e+'/'+_0x27e492)[_0x12f8('0x1c')](_0x5ad244);}return null;};}function patchUpdates(_0x244612){return function(_0xba086a){try{jsonpatch[_0x12f8('0x22')](_0xba086a,_0x244612,!![]);}catch(_0x4ca53a){return BPromise['reject'](_0x4ca53a);}return _0xba086a[_0x12f8('0x23')]();};}function saveUpdates(_0x4f8f43,_0x19f10e){return function(_0x44099b){if(_0x44099b){return _0x44099b['update'](_0x4f8f43)[_0x12f8('0x24')](function(_0x29e904){return _0x29e904;});}return null;};}function removeEntity(_0x3ba59c,_0x2370f5){return function(_0x3bd9e4){if(_0x3bd9e4){return _0x3bd9e4['destroy']()['then'](function(){_0x3ba59c[_0x12f8('0x1b')](0xcc)[_0x12f8('0x1a')]();});}};}function handleEntityNotFound(_0x3f4588,_0x55bd5f){return function(_0x2f7759){if(!_0x2f7759){_0x3f4588[_0x12f8('0x19')](0x194);}return _0x2f7759;};}function handleError(_0x2b6efc,_0x35f6d1){_0x35f6d1=_0x35f6d1||0x1f4;return function(_0x3064da){logger[_0x12f8('0x25')](_0x3064da[_0x12f8('0x26')]);if(_0x3064da[_0x12f8('0x27')]){delete _0x3064da['name'];}_0x2b6efc['status'](_0x35f6d1)[_0x12f8('0x28')](_0x3064da);};}exports['index']=function(_0x2aba67,_0xf540f2){var _0x2a4262={},_0x37a4f4={},_0x2a7f18={'count':0x0,'rows':[]};var _0x27a066=_[_0x12f8('0x29')](db['DeskAccount']['rawAttributes'],function(_0xffec8b){return{'name':_0xffec8b[_0x12f8('0x2a')],'type':_0xffec8b[_0x12f8('0x2b')][_0x12f8('0x2c')]};});_0x37a4f4[_0x12f8('0x2d')]=_[_0x12f8('0x29')](_0x27a066,'name');_0x37a4f4[_0x12f8('0x2e')]=_['keys'](_0x2aba67['query']);_0x37a4f4[_0x12f8('0x2f')]=_[_0x12f8('0x30')](_0x37a4f4['model'],_0x37a4f4[_0x12f8('0x2e')]);_0x2a4262['attributes']=_[_0x12f8('0x30')](_0x37a4f4[_0x12f8('0x2d')],qs[_0x12f8('0x31')](_0x2aba67[_0x12f8('0x2e')][_0x12f8('0x31')]));_0x2a4262[_0x12f8('0x32')]=_0x2a4262['attributes']['length']?_0x2a4262[_0x12f8('0x32')]:_0x37a4f4[_0x12f8('0x2d')];if(!_0x2aba67[_0x12f8('0x2e')]['hasOwnProperty'](_0x12f8('0x33'))){_0x2a4262[_0x12f8('0x1e')]=qs[_0x12f8('0x1e')](_0x2aba67['query'][_0x12f8('0x1e')]);_0x2a4262[_0x12f8('0x1d')]=qs[_0x12f8('0x1d')](_0x2aba67[_0x12f8('0x2e')]['offset']);}_0x2a4262[_0x12f8('0x34')]=qs[_0x12f8('0x35')](_0x2aba67[_0x12f8('0x2e')][_0x12f8('0x35')]);_0x2a4262[_0x12f8('0x36')]=qs[_0x12f8('0x2f')](_[_0x12f8('0x37')](_0x2aba67[_0x12f8('0x2e')],_0x37a4f4[_0x12f8('0x2f')]),_0x27a066);if(_0x2aba67['query'][_0x12f8('0x38')]){_0x2a4262['where']=_[_0x12f8('0x39')](_0x2a4262[_0x12f8('0x36')],{'$or':_[_0x12f8('0x29')](_0x27a066,function(_0xf5641e){if(_0xf5641e[_0x12f8('0x2b')]!==_0x12f8('0x3a')){var _0x4dc155={};_0x4dc155[_0xf5641e[_0x12f8('0x27')]]={'$like':'%'+_0x2aba67[_0x12f8('0x2e')]['filter']+'%'};return _0x4dc155;}})});}_0x2a4262=_['merge']({},_0x2a4262,_0x2aba67[_0x12f8('0x3b')]);var _0x50e3c0={'where':_0x2a4262[_0x12f8('0x36')]};return db[_0x12f8('0x3c')][_0x12f8('0x20')](_0x50e3c0)[_0x12f8('0x24')](function(_0x35c668){_0x2a7f18['count']=_0x35c668;if(_0x2aba67[_0x12f8('0x2e')]['includeAll']){_0x2a4262[_0x12f8('0x3d')]=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x2a4262);})[_0x12f8('0x24')](function(_0x5884fa){_0x2a7f18[_0x12f8('0x3e')]=_0x5884fa;return _0x2a7f18;})[_0x12f8('0x24')](respondWithFilteredResult(_0xf540f2,_0x2a4262))['catch'](handleError(_0xf540f2,null));};exports[_0x12f8('0x3f')]=function(_0xde1c50,_0xde993d){var _0x961a31={'raw':![],'where':{'id':_0xde1c50[_0x12f8('0x40')]['id']}},_0x2eef98={};_0x2eef98['model']=_['keys'](db[_0x12f8('0x3c')][_0x12f8('0x41')]);_0x2eef98['query']=_[_0x12f8('0x42')](_0xde1c50['query']);_0x2eef98['filters']=_['intersection'](_0x2eef98[_0x12f8('0x2d')],_0x2eef98['query']);_0x961a31[_0x12f8('0x32')]=_[_0x12f8('0x30')](_0x2eef98[_0x12f8('0x2d')],qs[_0x12f8('0x31')](_0xde1c50[_0x12f8('0x2e')][_0x12f8('0x31')]));_0x961a31[_0x12f8('0x32')]=_0x961a31['attributes'][_0x12f8('0x43')]?_0x961a31[_0x12f8('0x32')]:_0x2eef98[_0x12f8('0x2d')];if(_0xde1c50[_0x12f8('0x2e')][_0x12f8('0x44')]){_0x961a31[_0x12f8('0x3d')]=[{'all':!![]}];}_0x961a31=_[_0x12f8('0x39')]({},_0x961a31,_0xde1c50['options']);return db[_0x12f8('0x3c')][_0x12f8('0x45')](_0x961a31)['then'](handleEntityNotFound(_0xde993d,null))[_0x12f8('0x24')](respondWithResult(_0xde993d,null))[_0x12f8('0x46')](handleError(_0xde993d,null));};exports[_0x12f8('0x47')]=function(_0x5b914e,_0x13794c){return db[_0x12f8('0x3c')][_0x12f8('0x47')](_0x5b914e[_0x12f8('0x48')],{})[_0x12f8('0x24')](respondWithResult(_0x13794c,0xc9))['catch'](handleError(_0x13794c,null));};exports['update']=function(_0x488fb0,_0x2ecabc){if(_0x488fb0[_0x12f8('0x48')]['id']){delete _0x488fb0['body']['id'];}return db['DeskAccount']['find']({'where':{'id':_0x488fb0['params']['id']}})[_0x12f8('0x24')](handleEntityNotFound(_0x2ecabc,null))[_0x12f8('0x24')](saveUpdates(_0x488fb0[_0x12f8('0x48')],null))[_0x12f8('0x24')](respondWithResult(_0x2ecabc,null))['catch'](handleError(_0x2ecabc,null));};exports['destroy']=function(_0x42f06d,_0x4459ce){return db['DeskAccount'][_0x12f8('0x45')]({'where':{'id':_0x42f06d[_0x12f8('0x40')]['id']}})['then'](handleEntityNotFound(_0x4459ce,null))[_0x12f8('0x24')](removeEntity(_0x4459ce,null))[_0x12f8('0x46')](handleError(_0x4459ce,null));};exports[_0x12f8('0x49')]=function(_0x147295,_0x136a21,_0x4235a9){var _0x1f850d={};var _0x5d97b8={};var _0x477e03;var _0x4231ec;return db[_0x12f8('0x3c')][_0x12f8('0x4a')]({'where':{'id':_0x147295[_0x12f8('0x40')]['id']}})['then'](handleEntityNotFound(_0x136a21,null))['then'](function(_0x50c60d){if(_0x50c60d){_0x477e03=_0x50c60d;_0x5d97b8[_0x12f8('0x2d')]=_[_0x12f8('0x42')](db[_0x12f8('0x4b')][_0x12f8('0x41')]);_0x5d97b8[_0x12f8('0x2e')]=_[_0x12f8('0x42')](_0x147295[_0x12f8('0x2e')]);_0x5d97b8[_0x12f8('0x2f')]=_['intersection'](_0x5d97b8[_0x12f8('0x2d')],_0x5d97b8[_0x12f8('0x2e')]);_0x1f850d[_0x12f8('0x32')]=_[_0x12f8('0x30')](_0x5d97b8[_0x12f8('0x2d')],qs[_0x12f8('0x31')](_0x147295['query']['fields']));_0x1f850d['attributes']=_0x1f850d[_0x12f8('0x32')][_0x12f8('0x43')]?_0x1f850d['attributes']:_0x5d97b8['model'];_0x1f850d[_0x12f8('0x34')]=qs['sort'](_0x147295[_0x12f8('0x2e')]['sort']);_0x1f850d[_0x12f8('0x36')]=qs[_0x12f8('0x2f')](_[_0x12f8('0x37')](_0x147295[_0x12f8('0x2e')],_0x5d97b8[_0x12f8('0x2f')]));if(_0x147295[_0x12f8('0x2e')]['filter']){_0x1f850d[_0x12f8('0x36')]=_[_0x12f8('0x39')](_0x1f850d[_0x12f8('0x36')],{'$or':_['map'](_0x1f850d['attributes'],function(_0x1bb713){var _0x5e1e5b={};_0x5e1e5b[_0x1bb713]={'$like':'%'+_0x147295[_0x12f8('0x2e')][_0x12f8('0x38')]+'%'};return _0x5e1e5b;})});}_0x1f850d=_[_0x12f8('0x39')]({},_0x1f850d,_0x147295[_0x12f8('0x3b')]);return _0x477e03[_0x12f8('0x49')](_0x1f850d);}})[_0x12f8('0x24')](function(_0x18eddb){if(_0x18eddb){_0x4231ec=_0x18eddb['length'];if(!_0x147295[_0x12f8('0x2e')][_0x12f8('0x4c')]('nolimit')){_0x1f850d[_0x12f8('0x1e')]=qs[_0x12f8('0x1e')](_0x147295['query'][_0x12f8('0x1e')]);_0x1f850d['offset']=qs[_0x12f8('0x1d')](_0x147295['query'][_0x12f8('0x1d')]);}return _0x477e03[_0x12f8('0x49')](_0x1f850d);}})['then'](function(_0x1aec80){if(_0x1aec80){return _0x1aec80?{'count':_0x4231ec,'rows':_0x1aec80}:null;}})[_0x12f8('0x24')](respondWithResult(_0x136a21,null))[_0x12f8('0x46')](handleError(_0x136a21,null));};exports[_0x12f8('0x4d')]=function(_0x1c079e,_0x599e07,_0x3b1638){if(_0x1c079e[_0x12f8('0x48')]['id']){delete _0x1c079e['body']['id'];}return db['DeskAccount'][_0x12f8('0x4a')]({'where':{'id':_0x1c079e[_0x12f8('0x40')]['id']}})[_0x12f8('0x24')](handleEntityNotFound(_0x599e07,null))['then'](function(_0x15c58b){if(_0x15c58b){_0x1c079e[_0x12f8('0x48')][_0x12f8('0x4e')]=_0x15c58b['id'];_0x1c079e[_0x12f8('0x48')][_0x12f8('0x4f')]=integrations['getSubjects'](_0x1c079e[_0x12f8('0x48')][_0x12f8('0x50')],_0x1c079e[_0x12f8('0x48')]['type']);_0x1c079e[_0x12f8('0x48')][_0x12f8('0x51')]=integrations[_0x12f8('0x52')](_0x1c079e[_0x12f8('0x48')]['channel'],_0x1c079e[_0x12f8('0x48')][_0x12f8('0x2b')]);return db[_0x12f8('0x4b')][_0x12f8('0x47')](_0x1c079e[_0x12f8('0x48')],{'include':[{'model':db['DeskField'],'as':_0x12f8('0x4f')},{'model':db[_0x12f8('0x53')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x599e07,null))[_0x12f8('0x46')](handleError(_0x599e07,null));};exports[_0x12f8('0x54')]=function(_0x37a8e5,_0x46ff44,_0x1cc633){var _0x2de021=[{'name':_0x12f8('0x55'),'label':_0x12f8('0x55'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x592f84='';return db['DeskAccount'][_0x12f8('0x4a')]({'where':{'id':_0x37a8e5['params']['id']},'attributes':['id','remoteUri','authType','username',_0x12f8('0x56'),_0x12f8('0x57'),'consumerSecret',_0x12f8('0x58'),_0x12f8('0x59')]})[_0x12f8('0x24')](handleEntityNotFound(_0x46ff44,null))[_0x12f8('0x24')](function(_0x4ddae9){if(_0x4ddae9){_0x592f84=_0x4ddae9[_0x12f8('0x5a')];var _0x377a7d=_0x592f84[_0x12f8('0x5b')](-0x1);if(_0x377a7d==='/'){_0x592f84=_0x592f84['substring'](0x0,_0x592f84[_0x12f8('0x5c')](_0x377a7d));}var _0x400f31={'method':_0x12f8('0x5d'),'uri':util[_0x12f8('0x5e')](_0x12f8('0x5f'),_0x592f84),'headers':{'Content-Type':'application/json','Accept':_0x12f8('0x60')},'json':!![]};if(_0x4ddae9[_0x12f8('0x61')]===_0x12f8('0x62')){_0x400f31[_0x12f8('0x63')][_0x12f8('0x64')]=util[_0x12f8('0x5e')](_0x12f8('0x65'),new Buffer(util[_0x12f8('0x5e')](_0x12f8('0x66'),_0x4ddae9[_0x12f8('0x67')],_0x4ddae9[_0x12f8('0x56')]))[_0x12f8('0x68')]('base64'));}return rp(_0x400f31)['then'](function(_0x51013){return _0x2de021['concat'](_['map'](_0x51013['_embedded']['entries'],function(_0x3e3442){return{'id':_0x3e3442[_0x12f8('0x27')],'name':_0x3e3442['name'],'type':_0x3e3442['type'],'active':_0x3e3442[_0x12f8('0x69')],'label':_0x3e3442['label'],'custom':!![]};}));});}})[_0x12f8('0x24')](function(_0x4c5dc3){return{'count':_0x4c5dc3[_0x12f8('0x43')],'rows':_0x4c5dc3};})['then'](respondWithResult(_0x46ff44,null))[_0x12f8('0x46')](function(_0x54afc2){var _0x45bc8f=_0x37a8e5[_0x12f8('0x2e')][_0x12f8('0x6a')]?0x1f4:_0x54afc2[_0x12f8('0x6b')]||0x1f4;logger[_0x12f8('0x25')](_0x12f8('0x6c'),'getFields',_0x45bc8f,JSON['stringify'](_0x54afc2));delete _0x54afc2[_0x12f8('0x27')];if(_0x45bc8f===0x191){_0x45bc8f=0x190;}_0x46ff44[_0x12f8('0x1b')](_0x45bc8f)['send'](_0x37a8e5[_0x12f8('0x2e')][_0x12f8('0x6a')]?{'message':_0x12f8('0x6d'),'statusCode':_0x54afc2[_0x12f8('0x6b')]}:_0x54afc2);});}; \ No newline at end of file +var _0xcef6=['attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','count','DeskAccount','findAll','catch','include','find','create','body','update','params','findOne','DeskConfiguration','length','pick','getConfigurations','addConfiguration','getSubjects','Descriptions','getDescriptions','channel','DeskField','getFields','priority','remoteUri','authType','password','consumerSecret','token','substring','lastIndexOf','%s/custom_fields','application/json','basic','headers','Authorization','format','%s:%s','toString','base64','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xcef6,0x1e7));var _0x6cef=function(_0x412dd8,_0x355780){_0x412dd8=_0x412dd8-0x0;var _0x47b96=_0xcef6[_0x412dd8];return _0x47b96;};'use strict';var emlformat=require(_0x6cef('0x0'));var rimraf=require(_0x6cef('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6cef('0x2'));var moment=require(_0x6cef('0x3'));var BPromise=require(_0x6cef('0x4'));var Mustache=require('mustache');var util=require(_0x6cef('0x5'));var path=require(_0x6cef('0x6'));var sox=require(_0x6cef('0x7'));var csv=require('to-csv');var ejs=require(_0x6cef('0x8'));var fs=require('fs');var fs_extra=require(_0x6cef('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6cef('0xa'));var deskjs=require(_0x6cef('0xb'));var toCsv=require(_0x6cef('0xc'));var querystring=require(_0x6cef('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6cef('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x6cef('0xf'));var hardwareService=require(_0x6cef('0x10'));var logger=require(_0x6cef('0x11'))(_0x6cef('0x12'));var utils=require(_0x6cef('0x13'));var config=require(_0x6cef('0x14'));var licenseUtil=require(_0x6cef('0x15'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x122990,_0x4bc497){_0x4bc497=_0x4bc497||0xcc;return function(_0x166828){if(_0x166828){return _0x122990[_0x6cef('0x16')](_0x4bc497);}return _0x122990['status'](_0x4bc497)[_0x6cef('0x17')]();};}function respondWithResult(_0x235933,_0x34bf93){_0x34bf93=_0x34bf93||0xc8;return function(_0x1b1e69){if(_0x1b1e69){return _0x235933[_0x6cef('0x18')](_0x34bf93)['json'](_0x1b1e69);}};}function respondWithFilteredResult(_0x1a2276,_0x2fd9d1){return function(_0x3078a4){if(_0x3078a4){var _0x461f2c=typeof _0x2fd9d1[_0x6cef('0x19')]===_0x6cef('0x1a')&&typeof _0x2fd9d1[_0x6cef('0x1b')]===_0x6cef('0x1a');var _0x6b0775=_0x3078a4['count'];var _0x3d5d15=_0x461f2c?0x0:_0x2fd9d1[_0x6cef('0x19')];var _0x3889cc=_0x461f2c?_0x3078a4['count']:_0x2fd9d1[_0x6cef('0x19')]+_0x2fd9d1[_0x6cef('0x1b')];var _0x6ecbfe;if(_0x3889cc>=_0x6b0775){_0x3889cc=_0x6b0775;_0x6ecbfe=0xc8;}else{_0x6ecbfe=0xce;}_0x1a2276[_0x6cef('0x18')](_0x6ecbfe);return _0x1a2276[_0x6cef('0x1c')](_0x6cef('0x1d'),_0x3d5d15+'-'+_0x3889cc+'/'+_0x6b0775)['json'](_0x3078a4);}return null;};}function patchUpdates(_0x32879c){return function(_0x18c2e5){try{jsonpatch[_0x6cef('0x1e')](_0x18c2e5,_0x32879c,!![]);}catch(_0x343696){return BPromise[_0x6cef('0x1f')](_0x343696);}return _0x18c2e5['save']();};}function saveUpdates(_0x4c35dd,_0x3cc37d){return function(_0x53c8c3){if(_0x53c8c3){return _0x53c8c3['update'](_0x4c35dd)[_0x6cef('0x20')](function(_0x51972a){return _0x51972a;});}return null;};}function removeEntity(_0x488108,_0x54ab8a){return function(_0x4116fb){if(_0x4116fb){return _0x4116fb[_0x6cef('0x21')]()['then'](function(){_0x488108[_0x6cef('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xec183a,_0x3c9a0c){return function(_0x513761){if(!_0x513761){_0xec183a[_0x6cef('0x16')](0x194);}return _0x513761;};}function handleError(_0x1acdee,_0x1f69a7){_0x1f69a7=_0x1f69a7||0x1f4;return function(_0x54981d){logger[_0x6cef('0x22')](_0x54981d[_0x6cef('0x23')]);if(_0x54981d[_0x6cef('0x24')]){delete _0x54981d[_0x6cef('0x24')];}_0x1acdee[_0x6cef('0x18')](_0x1f69a7)[_0x6cef('0x25')](_0x54981d);};}exports[_0x6cef('0x26')]=function(_0x3fdf71,_0x4cd285){var _0x2d6dd0={},_0x106e9e={},_0x4555bd={'count':0x0,'rows':[]};var _0x44e67a=_['map'](db['DeskAccount'][_0x6cef('0x27')],function(_0x3a585e){return{'name':_0x3a585e[_0x6cef('0x28')],'type':_0x3a585e[_0x6cef('0x29')][_0x6cef('0x2a')]};});_0x106e9e[_0x6cef('0x2b')]=_[_0x6cef('0x2c')](_0x44e67a,_0x6cef('0x24'));_0x106e9e[_0x6cef('0x2d')]=_[_0x6cef('0x2e')](_0x3fdf71['query']);_0x106e9e[_0x6cef('0x2f')]=_['intersection'](_0x106e9e['model'],_0x106e9e[_0x6cef('0x2d')]);_0x2d6dd0[_0x6cef('0x30')]=_[_0x6cef('0x31')](_0x106e9e[_0x6cef('0x2b')],qs[_0x6cef('0x32')](_0x3fdf71['query'][_0x6cef('0x32')]));_0x2d6dd0[_0x6cef('0x30')]=_0x2d6dd0['attributes']['length']?_0x2d6dd0[_0x6cef('0x30')]:_0x106e9e[_0x6cef('0x2b')];if(!_0x3fdf71[_0x6cef('0x2d')][_0x6cef('0x33')](_0x6cef('0x34'))){_0x2d6dd0[_0x6cef('0x1b')]=qs[_0x6cef('0x1b')](_0x3fdf71['query'][_0x6cef('0x1b')]);_0x2d6dd0[_0x6cef('0x19')]=qs[_0x6cef('0x19')](_0x3fdf71[_0x6cef('0x2d')][_0x6cef('0x19')]);}_0x2d6dd0[_0x6cef('0x35')]=qs[_0x6cef('0x36')](_0x3fdf71[_0x6cef('0x2d')][_0x6cef('0x36')]);_0x2d6dd0['where']=qs[_0x6cef('0x2f')](_['pick'](_0x3fdf71[_0x6cef('0x2d')],_0x106e9e[_0x6cef('0x2f')]),_0x44e67a);if(_0x3fdf71[_0x6cef('0x2d')][_0x6cef('0x37')]){_0x2d6dd0['where']=_['merge'](_0x2d6dd0[_0x6cef('0x38')],{'$or':_[_0x6cef('0x2c')](_0x44e67a,function(_0xd617dd){if(_0xd617dd[_0x6cef('0x29')]!==_0x6cef('0x39')){var _0x2a59ce={};_0x2a59ce[_0xd617dd[_0x6cef('0x24')]]={'$like':'%'+_0x3fdf71[_0x6cef('0x2d')][_0x6cef('0x37')]+'%'};return _0x2a59ce;}})});}_0x2d6dd0=_[_0x6cef('0x3a')]({},_0x2d6dd0,_0x3fdf71[_0x6cef('0x3b')]);var _0x20c391={'where':_0x2d6dd0[_0x6cef('0x38')]};return db['DeskAccount'][_0x6cef('0x3c')](_0x20c391)[_0x6cef('0x20')](function(_0x281704){_0x4555bd[_0x6cef('0x3c')]=_0x281704;if(_0x3fdf71['query']['includeAll']){_0x2d6dd0['include']=[{'all':!![]}];}return db[_0x6cef('0x3d')][_0x6cef('0x3e')](_0x2d6dd0);})['then'](function(_0x4bf65b){_0x4555bd['rows']=_0x4bf65b;return _0x4555bd;})[_0x6cef('0x20')](respondWithFilteredResult(_0x4cd285,_0x2d6dd0))[_0x6cef('0x3f')](handleError(_0x4cd285,null));};exports['show']=function(_0x96c7e4,_0x20246c){var _0x3248f7={'raw':![],'where':{'id':_0x96c7e4['params']['id']}},_0x363d8c={};_0x363d8c[_0x6cef('0x2b')]=_[_0x6cef('0x2e')](db[_0x6cef('0x3d')][_0x6cef('0x27')]);_0x363d8c['query']=_['keys'](_0x96c7e4[_0x6cef('0x2d')]);_0x363d8c['filters']=_['intersection'](_0x363d8c[_0x6cef('0x2b')],_0x363d8c[_0x6cef('0x2d')]);_0x3248f7[_0x6cef('0x30')]=_['intersection'](_0x363d8c[_0x6cef('0x2b')],qs['fields'](_0x96c7e4[_0x6cef('0x2d')][_0x6cef('0x32')]));_0x3248f7['attributes']=_0x3248f7['attributes']['length']?_0x3248f7['attributes']:_0x363d8c['model'];if(_0x96c7e4[_0x6cef('0x2d')]['includeAll']){_0x3248f7[_0x6cef('0x40')]=[{'all':!![]}];}_0x3248f7=_['merge']({},_0x3248f7,_0x96c7e4[_0x6cef('0x3b')]);return db[_0x6cef('0x3d')][_0x6cef('0x41')](_0x3248f7)[_0x6cef('0x20')](handleEntityNotFound(_0x20246c,null))['then'](respondWithResult(_0x20246c,null))[_0x6cef('0x3f')](handleError(_0x20246c,null));};exports[_0x6cef('0x42')]=function(_0x164a32,_0x29e8aa){return db[_0x6cef('0x3d')][_0x6cef('0x42')](_0x164a32[_0x6cef('0x43')],{})['then'](respondWithResult(_0x29e8aa,0xc9))[_0x6cef('0x3f')](handleError(_0x29e8aa,null));};exports[_0x6cef('0x44')]=function(_0x425f1d,_0x9a87d8){if(_0x425f1d[_0x6cef('0x43')]['id']){delete _0x425f1d['body']['id'];}return db[_0x6cef('0x3d')][_0x6cef('0x41')]({'where':{'id':_0x425f1d['params']['id']}})[_0x6cef('0x20')](handleEntityNotFound(_0x9a87d8,null))[_0x6cef('0x20')](saveUpdates(_0x425f1d[_0x6cef('0x43')],null))[_0x6cef('0x20')](respondWithResult(_0x9a87d8,null))[_0x6cef('0x3f')](handleError(_0x9a87d8,null));};exports[_0x6cef('0x21')]=function(_0x1707e9,_0x13205b){return db[_0x6cef('0x3d')][_0x6cef('0x41')]({'where':{'id':_0x1707e9[_0x6cef('0x45')]['id']}})['then'](handleEntityNotFound(_0x13205b,null))[_0x6cef('0x20')](removeEntity(_0x13205b,null))['catch'](handleError(_0x13205b,null));};exports['getConfigurations']=function(_0x504521,_0x5db7b2,_0x321f3f){var _0xb1b3a5={};var _0x318a27={};var _0x2d3bb3;var _0x26ef60;return db['DeskAccount'][_0x6cef('0x46')]({'where':{'id':_0x504521[_0x6cef('0x45')]['id']}})['then'](handleEntityNotFound(_0x5db7b2,null))[_0x6cef('0x20')](function(_0x262d62){if(_0x262d62){_0x2d3bb3=_0x262d62;_0x318a27['model']=_['keys'](db[_0x6cef('0x47')][_0x6cef('0x27')]);_0x318a27['query']=_[_0x6cef('0x2e')](_0x504521['query']);_0x318a27[_0x6cef('0x2f')]=_[_0x6cef('0x31')](_0x318a27['model'],_0x318a27[_0x6cef('0x2d')]);_0xb1b3a5[_0x6cef('0x30')]=_[_0x6cef('0x31')](_0x318a27[_0x6cef('0x2b')],qs[_0x6cef('0x32')](_0x504521[_0x6cef('0x2d')][_0x6cef('0x32')]));_0xb1b3a5[_0x6cef('0x30')]=_0xb1b3a5[_0x6cef('0x30')][_0x6cef('0x48')]?_0xb1b3a5[_0x6cef('0x30')]:_0x318a27[_0x6cef('0x2b')];_0xb1b3a5[_0x6cef('0x35')]=qs[_0x6cef('0x36')](_0x504521[_0x6cef('0x2d')][_0x6cef('0x36')]);_0xb1b3a5[_0x6cef('0x38')]=qs[_0x6cef('0x2f')](_[_0x6cef('0x49')](_0x504521[_0x6cef('0x2d')],_0x318a27[_0x6cef('0x2f')]));if(_0x504521[_0x6cef('0x2d')][_0x6cef('0x37')]){_0xb1b3a5['where']=_[_0x6cef('0x3a')](_0xb1b3a5[_0x6cef('0x38')],{'$or':_[_0x6cef('0x2c')](_0xb1b3a5[_0x6cef('0x30')],function(_0x35235f){var _0x481c2b={};_0x481c2b[_0x35235f]={'$like':'%'+_0x504521['query'][_0x6cef('0x37')]+'%'};return _0x481c2b;})});}_0xb1b3a5=_[_0x6cef('0x3a')]({},_0xb1b3a5,_0x504521['options']);return _0x2d3bb3[_0x6cef('0x4a')](_0xb1b3a5);}})[_0x6cef('0x20')](function(_0x281e50){if(_0x281e50){_0x26ef60=_0x281e50[_0x6cef('0x48')];if(!_0x504521[_0x6cef('0x2d')]['hasOwnProperty'](_0x6cef('0x34'))){_0xb1b3a5[_0x6cef('0x1b')]=qs[_0x6cef('0x1b')](_0x504521[_0x6cef('0x2d')][_0x6cef('0x1b')]);_0xb1b3a5[_0x6cef('0x19')]=qs[_0x6cef('0x19')](_0x504521[_0x6cef('0x2d')][_0x6cef('0x19')]);}return _0x2d3bb3[_0x6cef('0x4a')](_0xb1b3a5);}})['then'](function(_0x6edc02){if(_0x6edc02){return _0x6edc02?{'count':_0x26ef60,'rows':_0x6edc02}:null;}})[_0x6cef('0x20')](respondWithResult(_0x5db7b2,null))[_0x6cef('0x3f')](handleError(_0x5db7b2,null));};exports[_0x6cef('0x4b')]=function(_0x5ea38f,_0x398e3c,_0x3d12c5){if(_0x5ea38f[_0x6cef('0x43')]['id']){delete _0x5ea38f[_0x6cef('0x43')]['id'];}return db[_0x6cef('0x3d')]['findOne']({'where':{'id':_0x5ea38f['params']['id']}})['then'](handleEntityNotFound(_0x398e3c,null))[_0x6cef('0x20')](function(_0x285fa5){if(_0x285fa5){_0x5ea38f[_0x6cef('0x43')]['AccountId']=_0x285fa5['id'];_0x5ea38f['body']['Subjects']=integrations[_0x6cef('0x4c')](_0x5ea38f[_0x6cef('0x43')]['channel'],_0x5ea38f[_0x6cef('0x43')][_0x6cef('0x29')]);_0x5ea38f[_0x6cef('0x43')][_0x6cef('0x4d')]=integrations[_0x6cef('0x4e')](_0x5ea38f[_0x6cef('0x43')][_0x6cef('0x4f')],_0x5ea38f[_0x6cef('0x43')][_0x6cef('0x29')]);return db[_0x6cef('0x47')]['create'](_0x5ea38f['body'],{'include':[{'model':db[_0x6cef('0x50')],'as':'Subjects'},{'model':db[_0x6cef('0x50')],'as':_0x6cef('0x4d')}]});}return null;})[_0x6cef('0x20')](respondWithResult(_0x398e3c,null))['catch'](handleError(_0x398e3c,null));};exports[_0x6cef('0x51')]=function(_0x43dc1b,_0x45ec0e,_0x36505a){var _0x468d41=[{'name':_0x6cef('0x52'),'label':_0x6cef('0x52'),'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 _0x1af327='';return db['DeskAccount'][_0x6cef('0x46')]({'where':{'id':_0x43dc1b['params']['id']},'attributes':['id',_0x6cef('0x53'),_0x6cef('0x54'),'username',_0x6cef('0x55'),'consumerKey',_0x6cef('0x56'),_0x6cef('0x57'),'tokenSecret']})['then'](handleEntityNotFound(_0x45ec0e,null))['then'](function(_0xa6d59){if(_0xa6d59){_0x1af327=_0xa6d59[_0x6cef('0x53')];var _0x4c26f4=_0x1af327['slice'](-0x1);if(_0x4c26f4==='/'){_0x1af327=_0x1af327[_0x6cef('0x58')](0x0,_0x1af327[_0x6cef('0x59')](_0x4c26f4));}var _0xaf54ab={'method':'GET','uri':util['format'](_0x6cef('0x5a'),_0x1af327),'headers':{'Content-Type':'application/json','Accept':_0x6cef('0x5b')},'json':!![]};if(_0xa6d59[_0x6cef('0x54')]===_0x6cef('0x5c')){_0xaf54ab[_0x6cef('0x5d')][_0x6cef('0x5e')]=util[_0x6cef('0x5f')]('Basic\x20%s',new Buffer(util['format'](_0x6cef('0x60'),_0xa6d59['username'],_0xa6d59[_0x6cef('0x55')]))[_0x6cef('0x61')](_0x6cef('0x62')));}return rp(_0xaf54ab)[_0x6cef('0x20')](function(_0x34a499){return _0x468d41['concat'](_[_0x6cef('0x2c')](_0x34a499[_0x6cef('0x63')][_0x6cef('0x64')],function(_0x550897){return{'id':_0x550897[_0x6cef('0x24')],'name':_0x550897[_0x6cef('0x24')],'type':_0x550897['type'],'active':_0x550897[_0x6cef('0x65')],'label':_0x550897[_0x6cef('0x66')],'custom':!![]};}));});}})[_0x6cef('0x20')](function(_0x5d5ce4){return{'count':_0x5d5ce4['length'],'rows':_0x5d5ce4};})[_0x6cef('0x20')](respondWithResult(_0x45ec0e,null))[_0x6cef('0x3f')](function(_0x3e30b8){var _0x997ade=_0x43dc1b[_0x6cef('0x2d')][_0x6cef('0x67')]?0x1f4:_0x3e30b8[_0x6cef('0x68')]||0x1f4;logger[_0x6cef('0x22')](_0x6cef('0x69'),'getFields',_0x997ade,JSON[_0x6cef('0x6a')](_0x3e30b8));delete _0x3e30b8[_0x6cef('0x24')];if(_0x997ade===0x191){_0x997ade=0x190;}_0x45ec0e[_0x6cef('0x18')](_0x997ade)[_0x6cef('0x25')](_0x43dc1b['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x3e30b8[_0x6cef('0x68')]}:_0x3e30b8);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 18a20f6..b6573a2 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 _0xb6be=['../../config/logger','api','bluebird','request-promise','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','exports','DeskAccount','int_desk_accounts','lodash','util'];(function(_0x210d7f,_0x2abe4f){var _0x42d687=function(_0x46b2ae){while(--_0x46b2ae){_0x210d7f['push'](_0x210d7f['shift']());}};_0x42d687(++_0x2abe4f);}(_0xb6be,0x18a));var _0xeb6b=function(_0x513047,_0x2199c5){_0x513047=_0x513047-0x0;var _0x15b779=_0xb6be[_0x513047];return _0x15b779;};'use strict';var _=require(_0xeb6b('0x0'));var util=require(_0xeb6b('0x1'));var logger=require(_0xeb6b('0x2'))(_0xeb6b('0x3'));var moment=require('moment');var BPromise=require(_0xeb6b('0x4'));var rp=require(_0xeb6b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeb6b('0x6'));var config=require('../../config/environment');var attributes=require(_0xeb6b('0x7'));var integrations=require(_0xeb6b('0x8'));module[_0xeb6b('0x9')]=function(_0x5ba339,_0x497b32){return _0x5ba339['define'](_0xeb6b('0xa'),attributes,{'tableName':_0xeb6b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfbad=['int_desk_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0xfbad,0x16d));var _0xdfba=function(_0x525d37,_0xf3be09){_0x525d37=_0x525d37-0x0;var _0x42f8ee=_0xfbad[_0x525d37];return _0x42f8ee;};'use strict';var _=require(_0xdfba('0x0'));var util=require(_0xdfba('0x1'));var logger=require(_0xdfba('0x2'))(_0xdfba('0x3'));var moment=require('moment');var BPromise=require(_0xdfba('0x4'));var rp=require(_0xdfba('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdfba('0x6'));var config=require('../../config/environment');var attributes=require(_0xdfba('0x7'));var integrations=require(_0xdfba('0x8'));module[_0xdfba('0x9')]=function(_0x1354f1,_0x1ea189){return _0x1354f1[_0xdfba('0xa')](_0xdfba('0xb'),attributes,{'tableName':_0xdfba('0xc'),'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 d3c50dd..1fb3899 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 _0xee30=['jayson/promise','client','http','request','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','include','model','map','then','ShowDeskAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x58381c,_0x3b9374){var _0x1a7440=function(_0x2bc7f1){while(--_0x2bc7f1){_0x58381c['push'](_0x58381c['shift']());}};_0x1a7440(++_0x3b9374);}(_0xee30,0x156));var _0x0ee3=function(_0x5979ff,_0x19c19a){_0x5979ff=_0x5979ff-0x0;var _0x4eb1c7=_0xee30[_0x5979ff];return _0x4eb1c7;};'use strict';var _=require(_0x0ee3('0x0'));var util=require(_0x0ee3('0x1'));var moment=require(_0x0ee3('0x2'));var BPromise=require(_0x0ee3('0x3'));var rs=require(_0x0ee3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0ee3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0ee3('0x6'))(_0x0ee3('0x7'));var config=require('../../config/environment');var jayson=require(_0x0ee3('0x8'));var client=jayson[_0x0ee3('0x9')][_0x0ee3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7aaa80,_0x586341,_0x2f868e){return new BPromise(function(_0x240ab5,_0x2952d0){return client[_0x0ee3('0xb')](_0x7aaa80,_0x2f868e)['then'](function(_0x22c9fc){logger[_0x0ee3('0xc')](_0x0ee3('0xd'),_0x586341,_0x0ee3('0xe'));logger[_0x0ee3('0xf')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x586341,_0x0ee3('0xe'),JSON[_0x0ee3('0x10')](_0x22c9fc));if(_0x22c9fc[_0x0ee3('0x11')]){if(_0x22c9fc[_0x0ee3('0x11')]['code']===0x1f4){logger[_0x0ee3('0x11')]('DeskAccount,\x20%s,\x20%s',_0x586341,_0x22c9fc[_0x0ee3('0x11')][_0x0ee3('0x12')]);return _0x2952d0(_0x22c9fc[_0x0ee3('0x11')][_0x0ee3('0x12')]);}logger['error'](_0x0ee3('0xd'),_0x586341,_0x22c9fc[_0x0ee3('0x11')][_0x0ee3('0x12')]);return _0x240ab5(_0x22c9fc[_0x0ee3('0x11')][_0x0ee3('0x12')]);}else{logger[_0x0ee3('0xc')](_0x0ee3('0xd'),_0x586341,_0x0ee3('0xe'));_0x240ab5(_0x22c9fc[_0x0ee3('0x13')]['message']);}})[_0x0ee3('0x14')](function(_0x21a1b4){logger[_0x0ee3('0x11')]('DeskAccount,\x20%s,\x20%s',_0x586341,_0x21a1b4);_0x2952d0(_0x21a1b4);});});}exports[_0x0ee3('0x15')]=function(_0xa2b6c0){var _0x52ad47=this;return new Promise(function(_0x1cadde,_0x237dbf){return db[_0x0ee3('0x16')][_0x0ee3('0x17')]({'raw':_0xa2b6c0['options']?_0xa2b6c0[_0x0ee3('0x18')][_0x0ee3('0x19')]===undefined?!![]:![]:!![],'where':_0xa2b6c0[_0x0ee3('0x18')]?_0xa2b6c0[_0x0ee3('0x18')][_0x0ee3('0x1a')]||null:null,'attributes':_0xa2b6c0[_0x0ee3('0x18')]?_0xa2b6c0[_0x0ee3('0x18')][_0x0ee3('0x1b')]||null:null,'limit':_0xa2b6c0[_0x0ee3('0x18')]?_0xa2b6c0['options'][_0x0ee3('0x1c')]||null:null,'include':_0xa2b6c0[_0x0ee3('0x18')]?_0xa2b6c0[_0x0ee3('0x18')]['include']?_['map'](_0xa2b6c0['options'][_0x0ee3('0x1d')],function(_0x577676){return{'model':db[_0x577676[_0x0ee3('0x1e')]],'as':_0x577676['as'],'attributes':_0x577676[_0x0ee3('0x1b')],'include':_0x577676[_0x0ee3('0x1d')]?_['map'](_0x577676[_0x0ee3('0x1d')],function(_0x5a5cae){return{'model':db[_0x5a5cae[_0x0ee3('0x1e')]],'as':_0x5a5cae['as'],'attributes':_0x5a5cae[_0x0ee3('0x1b')],'include':_0x5a5cae[_0x0ee3('0x1d')]?_[_0x0ee3('0x1f')](_0x5a5cae['include'],function(_0x1c9c64){return{'model':db[_0x1c9c64[_0x0ee3('0x1e')]],'as':_0x1c9c64['as'],'attributes':_0x1c9c64[_0x0ee3('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0ee3('0x20')](function(_0x108727){logger[_0x0ee3('0xc')](_0x0ee3('0x15'),_0xa2b6c0);logger[_0x0ee3('0xf')](_0x0ee3('0x15'),_0xa2b6c0,JSON['stringify'](_0x108727));_0x1cadde(_0x108727);})['catch'](function(_0x363caf){logger[_0x0ee3('0x11')](_0x0ee3('0x15'),_0x363caf[_0x0ee3('0x12')],_0xa2b6c0);_0x237dbf(_0x52ad47['error'](0x1f4,_0x363caf[_0x0ee3('0x12')]));});});};exports[_0x0ee3('0x21')]=function(_0x2212b1){var _0x1c7ca2=this;return new Promise(function(_0x21b047,_0x318b97){return db['DeskAccount'][_0x0ee3('0x22')]({'raw':_0x2212b1[_0x0ee3('0x18')]?_0x2212b1[_0x0ee3('0x18')][_0x0ee3('0x19')]===undefined?!![]:![]:!![],'where':_0x2212b1[_0x0ee3('0x18')]?_0x2212b1[_0x0ee3('0x18')][_0x0ee3('0x1a')]||null:null,'attributes':_0x2212b1[_0x0ee3('0x18')]?_0x2212b1[_0x0ee3('0x18')][_0x0ee3('0x1b')]||null:null,'include':_0x2212b1[_0x0ee3('0x18')]?_0x2212b1['options'][_0x0ee3('0x1d')]?_[_0x0ee3('0x1f')](_0x2212b1[_0x0ee3('0x18')]['include'],function(_0x2cb0c5){return{'model':db[_0x2cb0c5[_0x0ee3('0x1e')]],'as':_0x2cb0c5['as'],'attributes':_0x2cb0c5[_0x0ee3('0x1b')],'include':_0x2cb0c5['include']?_[_0x0ee3('0x1f')](_0x2cb0c5[_0x0ee3('0x1d')],function(_0x421363){return{'model':db[_0x421363[_0x0ee3('0x1e')]],'as':_0x421363['as'],'attributes':_0x421363[_0x0ee3('0x1b')],'include':_0x421363[_0x0ee3('0x1d')]?_[_0x0ee3('0x1f')](_0x421363[_0x0ee3('0x1d')],function(_0x235317){return{'model':db[_0x235317[_0x0ee3('0x1e')]],'as':_0x235317['as'],'attributes':_0x235317[_0x0ee3('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0ee3('0x20')](function(_0x179645){logger[_0x0ee3('0xc')](_0x0ee3('0x21'),_0x2212b1);logger[_0x0ee3('0xf')](_0x0ee3('0x21'),_0x2212b1,JSON[_0x0ee3('0x10')](_0x179645));_0x21b047(_0x179645);})[_0x0ee3('0x14')](function(_0x1206e9){logger[_0x0ee3('0x11')](_0x0ee3('0x21'),_0x1206e9[_0x0ee3('0x12')],_0x2212b1);_0x318b97(_0x1c7ca2[_0x0ee3('0x11')](0x1f4,_0x1206e9['message']));});});}; \ No newline at end of file +var _0x00ff=['randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetDeskAccount','findAll','options','where','attributes','limit','include','map','model','catch','DeskAccount','find','raw','info','ShowDeskAccount','lodash','util','moment','bluebird'];(function(_0x15f43a,_0x57c8b5){var _0x2369bc=function(_0x46c265){while(--_0x46c265){_0x15f43a['push'](_0x15f43a['shift']());}};_0x2369bc(++_0x57c8b5);}(_0x00ff,0xf8));var _0xf00f=function(_0x51f037,_0xdfa1e9){_0x51f037=_0x51f037-0x0;var _0x35faaa=_0x00ff[_0x51f037];return _0x35faaa;};'use strict';var _=require(_0xf00f('0x0'));var util=require(_0xf00f('0x1'));var moment=require(_0xf00f('0x2'));var BPromise=require(_0xf00f('0x3'));var rs=require(_0xf00f('0x4'));var fs=require('fs');var Redis=require(_0xf00f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf00f('0x6'))(_0xf00f('0x7'));var config=require('../../config/environment');var jayson=require(_0xf00f('0x8'));var client=jayson[_0xf00f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x459553,_0x26a631,_0x5895f1){return new BPromise(function(_0x39afff,_0x41dd8c){return client[_0xf00f('0xa')](_0x459553,_0x5895f1)[_0xf00f('0xb')](function(_0x58173a){logger['info'](_0xf00f('0xc'),_0x26a631,_0xf00f('0xd'));logger[_0xf00f('0xe')](_0xf00f('0xf'),_0x26a631,'request\x20sent',JSON[_0xf00f('0x10')](_0x58173a));if(_0x58173a[_0xf00f('0x11')]){if(_0x58173a[_0xf00f('0x11')][_0xf00f('0x12')]===0x1f4){logger[_0xf00f('0x11')](_0xf00f('0xc'),_0x26a631,_0x58173a['error'][_0xf00f('0x13')]);return _0x41dd8c(_0x58173a[_0xf00f('0x11')][_0xf00f('0x13')]);}logger[_0xf00f('0x11')](_0xf00f('0xc'),_0x26a631,_0x58173a[_0xf00f('0x11')][_0xf00f('0x13')]);return _0x39afff(_0x58173a[_0xf00f('0x11')][_0xf00f('0x13')]);}else{logger['info'](_0xf00f('0xc'),_0x26a631,_0xf00f('0xd'));_0x39afff(_0x58173a[_0xf00f('0x14')]['message']);}})['catch'](function(_0x5caa54){logger[_0xf00f('0x11')](_0xf00f('0xc'),_0x26a631,_0x5caa54);_0x41dd8c(_0x5caa54);});});}exports[_0xf00f('0x15')]=function(_0xedd1ee){var _0x5b75e2=this;return new Promise(function(_0x525162,_0x2488ed){return db['DeskAccount'][_0xf00f('0x16')]({'raw':_0xedd1ee[_0xf00f('0x17')]?_0xedd1ee[_0xf00f('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xedd1ee[_0xf00f('0x17')]?_0xedd1ee['options'][_0xf00f('0x18')]||null:null,'attributes':_0xedd1ee[_0xf00f('0x17')]?_0xedd1ee['options'][_0xf00f('0x19')]||null:null,'limit':_0xedd1ee[_0xf00f('0x17')]?_0xedd1ee[_0xf00f('0x17')][_0xf00f('0x1a')]||null:null,'include':_0xedd1ee['options']?_0xedd1ee[_0xf00f('0x17')][_0xf00f('0x1b')]?_[_0xf00f('0x1c')](_0xedd1ee[_0xf00f('0x17')]['include'],function(_0x34bed4){return{'model':db[_0x34bed4['model']],'as':_0x34bed4['as'],'attributes':_0x34bed4['attributes'],'include':_0x34bed4[_0xf00f('0x1b')]?_[_0xf00f('0x1c')](_0x34bed4[_0xf00f('0x1b')],function(_0x3d067f){return{'model':db[_0x3d067f[_0xf00f('0x1d')]],'as':_0x3d067f['as'],'attributes':_0x3d067f['attributes'],'include':_0x3d067f['include']?_[_0xf00f('0x1c')](_0x3d067f['include'],function(_0x3b9509){return{'model':db[_0x3b9509['model']],'as':_0x3b9509['as'],'attributes':_0x3b9509[_0xf00f('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23b26b){logger['info'](_0xf00f('0x15'),_0xedd1ee);logger[_0xf00f('0xe')](_0xf00f('0x15'),_0xedd1ee,JSON[_0xf00f('0x10')](_0x23b26b));_0x525162(_0x23b26b);})[_0xf00f('0x1e')](function(_0x3f9427){logger[_0xf00f('0x11')](_0xf00f('0x15'),_0x3f9427[_0xf00f('0x13')],_0xedd1ee);_0x2488ed(_0x5b75e2[_0xf00f('0x11')](0x1f4,_0x3f9427[_0xf00f('0x13')]));});});};exports['ShowDeskAccount']=function(_0x454e7b){var _0x1602ab=this;return new Promise(function(_0x294ab3,_0x466101){return db[_0xf00f('0x1f')][_0xf00f('0x20')]({'raw':_0x454e7b['options']?_0x454e7b['options'][_0xf00f('0x21')]===undefined?!![]:![]:!![],'where':_0x454e7b['options']?_0x454e7b[_0xf00f('0x17')]['where']||null:null,'attributes':_0x454e7b['options']?_0x454e7b[_0xf00f('0x17')][_0xf00f('0x19')]||null:null,'include':_0x454e7b[_0xf00f('0x17')]?_0x454e7b[_0xf00f('0x17')][_0xf00f('0x1b')]?_[_0xf00f('0x1c')](_0x454e7b[_0xf00f('0x17')]['include'],function(_0x1495ea){return{'model':db[_0x1495ea[_0xf00f('0x1d')]],'as':_0x1495ea['as'],'attributes':_0x1495ea[_0xf00f('0x19')],'include':_0x1495ea[_0xf00f('0x1b')]?_[_0xf00f('0x1c')](_0x1495ea['include'],function(_0x5c3e5e){return{'model':db[_0x5c3e5e[_0xf00f('0x1d')]],'as':_0x5c3e5e['as'],'attributes':_0x5c3e5e[_0xf00f('0x19')],'include':_0x5c3e5e['include']?_[_0xf00f('0x1c')](_0x5c3e5e['include'],function(_0x560c32){return{'model':db[_0x560c32['model']],'as':_0x560c32['as'],'attributes':_0x560c32[_0xf00f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf00f('0xb')](function(_0x43db31){logger[_0xf00f('0x22')](_0xf00f('0x23'),_0x454e7b);logger['debug']('ShowDeskAccount',_0x454e7b,JSON[_0xf00f('0x10')](_0x43db31));_0x294ab3(_0x43db31);})[_0xf00f('0x1e')](function(_0x547c2b){logger['error']('ShowDeskAccount',_0x547c2b[_0xf00f('0x13')],_0x454e7b);_0x466101(_0x1602ab[_0xf00f('0x11')](0x1f4,_0x547c2b[_0xf00f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 42c6a83..d51a0cd 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(_0x59a7a6,_0x729eee){var _0x524ac4=function(_0x5a836c){while(--_0x5a836c){_0x59a7a6['push'](_0x59a7a6['shift']());}};_0x524ac4(++_0x729eee);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/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(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0x55ca,0x126));var _0xa55c=function(_0x3fb2d4,_0x44a3a8){_0x3fb2d4=_0x3fb2d4-0x0;var _0x4cfd9a=_0x55ca[_0x3fb2d4];return _0x4cfd9a;};'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 d5e2607..4cd2c44 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 _0xc3f6=['exports','STRING'];(function(_0x4223a6,_0x514d1e){var _0x5aa4e7=function(_0x1ee835){while(--_0x1ee835){_0x4223a6['push'](_0x4223a6['shift']());}};_0x5aa4e7(++_0x514d1e);}(_0xc3f6,0x1aa));var _0x6c3f=function(_0x5492b8,_0x53c03a){_0x5492b8=_0x5492b8-0x0;var _0x5ecb2e=_0xc3f6[_0x5492b8];return _0x5ecb2e;};'use strict';var Sequelize=require('sequelize');module[_0x6c3f('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6c3f('0x1')]}}; \ No newline at end of file +var _0xc769=['exports','STRING'];(function(_0x21a71a,_0x5c6e42){var _0x1ad1d3=function(_0x4aad75){while(--_0x4aad75){_0x21a71a['push'](_0x21a71a['shift']());}};_0x1ad1d3(++_0x5c6e42);}(_0xc769,0x10a));var _0x9c76=function(_0x200bf6,_0xacd42c){_0x200bf6=_0x200bf6-0x0;var _0x2f44e9=_0xc769[_0x200bf6];return _0x2f44e9;};'use strict';var Sequelize=require('sequelize');module[_0x9c76('0x0')]={'name':{'type':Sequelize[_0x9c76('0x1')]},'description':{'type':Sequelize[_0x9c76('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 88b8296..730cca0 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 _0x4138=['request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','count','offset','apply','reject','update','then','destroy','error','name','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','params','DeskConfiguration','rawAttributes','includeAll','find','create','body','getFields','DeskField','getSubjects','findOne','order','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x4138,0x13d));var _0x8413=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x4138[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0x8413('0x0'));var rimraf=require(_0x8413('0x1'));var zipdir=require(_0x8413('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8413('0x3'));var moment=require(_0x8413('0x4'));var BPromise=require(_0x8413('0x5'));var Mustache=require(_0x8413('0x6'));var util=require(_0x8413('0x7'));var path=require(_0x8413('0x8'));var sox=require(_0x8413('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8413('0xa'));var _=require(_0x8413('0xb'));var squel=require('squel');var crypto=require(_0x8413('0xc'));var jsforce=require(_0x8413('0xd'));var deskjs=require(_0x8413('0xe'));var toCsv=require(_0x8413('0xf'));var querystring=require(_0x8413('0x10'));var Papa=require('papaparse');var Redis=require(_0x8413('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8413('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8413('0x13'));var logger=require(_0x8413('0x14'))(_0x8413('0x15'));var utils=require(_0x8413('0x16'));var config=require(_0x8413('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7e90a8,_0x6a1f8d){_0x6a1f8d=_0x6a1f8d||0xcc;return function(_0x26691a){if(_0x26691a){return _0x7e90a8[_0x8413('0x18')](_0x6a1f8d);}return _0x7e90a8[_0x8413('0x19')](_0x6a1f8d)[_0x8413('0x1a')]();};}function respondWithResult(_0x53219d,_0x44fc82){_0x44fc82=_0x44fc82||0xc8;return function(_0x37c639){if(_0x37c639){return _0x53219d[_0x8413('0x19')](_0x44fc82)[_0x8413('0x1b')](_0x37c639);}};}function respondWithFilteredResult(_0x47df62,_0x237fd8){return function(_0x335821){if(_0x335821){var _0x3cbf81=typeof _0x237fd8['offset']===_0x8413('0x1c')&&typeof _0x237fd8['limit']==='undefined';var _0x1c1ddb=_0x335821[_0x8413('0x1d')];var _0x1742a4=_0x3cbf81?0x0:_0x237fd8[_0x8413('0x1e')];var _0xa7522a=_0x3cbf81?_0x335821[_0x8413('0x1d')]:_0x237fd8[_0x8413('0x1e')]+_0x237fd8['limit'];var _0x48ca63;if(_0xa7522a>=_0x1c1ddb){_0xa7522a=_0x1c1ddb;_0x48ca63=0xc8;}else{_0x48ca63=0xce;}_0x47df62['status'](_0x48ca63);return _0x47df62['set']('Content-Range',_0x1742a4+'-'+_0xa7522a+'/'+_0x1c1ddb)[_0x8413('0x1b')](_0x335821);}return null;};}function patchUpdates(_0x3e9fb7){return function(_0x29852c){try{jsonpatch[_0x8413('0x1f')](_0x29852c,_0x3e9fb7,!![]);}catch(_0x388bfb){return BPromise[_0x8413('0x20')](_0x388bfb);}return _0x29852c['save']();};}function saveUpdates(_0x28cec3,_0x10900e){return function(_0x14d9f9){if(_0x14d9f9){return _0x14d9f9[_0x8413('0x21')](_0x28cec3)[_0x8413('0x22')](function(_0x4912fd){return _0x4912fd;});}return null;};}function removeEntity(_0x5b9d2d,_0x35c3ce){return function(_0x263d76){if(_0x263d76){return _0x263d76[_0x8413('0x23')]()['then'](function(){_0x5b9d2d[_0x8413('0x19')](0xcc)[_0x8413('0x1a')]();});}};}function handleEntityNotFound(_0x5230e9,_0x43f220){return function(_0x23e0ba){if(!_0x23e0ba){_0x5230e9[_0x8413('0x18')](0x194);}return _0x23e0ba;};}function handleError(_0xc53c50,_0x3d4693){_0x3d4693=_0x3d4693||0x1f4;return function(_0x4a9569){logger[_0x8413('0x24')](_0x4a9569['stack']);if(_0x4a9569['name']){delete _0x4a9569[_0x8413('0x25')];}_0xc53c50[_0x8413('0x19')](_0x3d4693)['send'](_0x4a9569);};}exports[_0x8413('0x26')]=function(_0x549594,_0x1edda9){var _0x25f789={},_0x3240b3={},_0x218f20={'count':0x0,'rows':[]};var _0x984792=_[_0x8413('0x27')](db['DeskConfiguration']['rawAttributes'],function(_0xb27c01){return{'name':_0xb27c01[_0x8413('0x28')],'type':_0xb27c01[_0x8413('0x29')][_0x8413('0x2a')]};});_0x3240b3[_0x8413('0x2b')]=_[_0x8413('0x27')](_0x984792,'name');_0x3240b3[_0x8413('0x2c')]=_[_0x8413('0x2d')](_0x549594[_0x8413('0x2c')]);_0x3240b3[_0x8413('0x2e')]=_[_0x8413('0x2f')](_0x3240b3[_0x8413('0x2b')],_0x3240b3[_0x8413('0x2c')]);_0x25f789[_0x8413('0x30')]=_[_0x8413('0x2f')](_0x3240b3[_0x8413('0x2b')],qs[_0x8413('0x31')](_0x549594[_0x8413('0x2c')][_0x8413('0x31')]));_0x25f789[_0x8413('0x30')]=_0x25f789[_0x8413('0x30')][_0x8413('0x32')]?_0x25f789[_0x8413('0x30')]:_0x3240b3['model'];if(!_0x549594[_0x8413('0x2c')][_0x8413('0x33')](_0x8413('0x34'))){_0x25f789[_0x8413('0x35')]=qs[_0x8413('0x35')](_0x549594[_0x8413('0x2c')][_0x8413('0x35')]);_0x25f789[_0x8413('0x1e')]=qs[_0x8413('0x1e')](_0x549594[_0x8413('0x2c')]['offset']);}_0x25f789['order']=qs[_0x8413('0x36')](_0x549594[_0x8413('0x2c')][_0x8413('0x36')]);_0x25f789[_0x8413('0x37')]=qs[_0x8413('0x2e')](_[_0x8413('0x38')](_0x549594[_0x8413('0x2c')],_0x3240b3[_0x8413('0x2e')]),_0x984792);if(_0x549594[_0x8413('0x2c')][_0x8413('0x39')]){_0x25f789[_0x8413('0x37')]=_[_0x8413('0x3a')](_0x25f789['where'],{'$or':_['map'](_0x984792,function(_0x53ecd2){if(_0x53ecd2['type']!==_0x8413('0x3b')){var _0x274f89={};_0x274f89[_0x53ecd2[_0x8413('0x25')]]={'$like':'%'+_0x549594[_0x8413('0x2c')][_0x8413('0x39')]+'%'};return _0x274f89;}})});}_0x25f789=_[_0x8413('0x3a')]({},_0x25f789,_0x549594[_0x8413('0x3c')]);var _0x2ef913={'where':_0x25f789[_0x8413('0x37')]};return db['DeskConfiguration']['count'](_0x2ef913)['then'](function(_0x5e0e1a){_0x218f20[_0x8413('0x1d')]=_0x5e0e1a;if(_0x549594[_0x8413('0x2c')]['includeAll']){_0x25f789[_0x8413('0x3d')]=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x25f789);})[_0x8413('0x22')](function(_0x5dff02){_0x218f20[_0x8413('0x3e')]=_0x5dff02;return _0x218f20;})[_0x8413('0x22')](respondWithFilteredResult(_0x1edda9,_0x25f789))[_0x8413('0x3f')](handleError(_0x1edda9,null));};exports['show']=function(_0x24e5fb,_0x28c6e5){var _0x263e74={'raw':![],'where':{'id':_0x24e5fb[_0x8413('0x40')]['id']}},_0x3be0a3={};_0x3be0a3['model']=_[_0x8413('0x2d')](db[_0x8413('0x41')][_0x8413('0x42')]);_0x3be0a3[_0x8413('0x2c')]=_[_0x8413('0x2d')](_0x24e5fb[_0x8413('0x2c')]);_0x3be0a3[_0x8413('0x2e')]=_['intersection'](_0x3be0a3['model'],_0x3be0a3[_0x8413('0x2c')]);_0x263e74[_0x8413('0x30')]=_[_0x8413('0x2f')](_0x3be0a3[_0x8413('0x2b')],qs[_0x8413('0x31')](_0x24e5fb[_0x8413('0x2c')]['fields']));_0x263e74['attributes']=_0x263e74['attributes'][_0x8413('0x32')]?_0x263e74[_0x8413('0x30')]:_0x3be0a3[_0x8413('0x2b')];if(_0x24e5fb['query'][_0x8413('0x43')]){_0x263e74[_0x8413('0x3d')]=[{'all':!![]}];}_0x263e74=_[_0x8413('0x3a')]({},_0x263e74,_0x24e5fb[_0x8413('0x3c')]);return db[_0x8413('0x41')][_0x8413('0x44')](_0x263e74)[_0x8413('0x22')](handleEntityNotFound(_0x28c6e5,null))[_0x8413('0x22')](respondWithResult(_0x28c6e5,null))[_0x8413('0x3f')](handleError(_0x28c6e5,null));};exports[_0x8413('0x45')]=function(_0x3d62d5,_0xe79689){return db['DeskConfiguration']['create'](_0x3d62d5[_0x8413('0x46')],{})[_0x8413('0x22')](respondWithResult(_0xe79689,0xc9))[_0x8413('0x3f')](handleError(_0xe79689,null));};exports[_0x8413('0x21')]=function(_0x82f797,_0x41c264){if(_0x82f797[_0x8413('0x46')]['id']){delete _0x82f797[_0x8413('0x46')]['id'];}return db['DeskConfiguration'][_0x8413('0x44')]({'where':{'id':_0x82f797[_0x8413('0x40')]['id']}})['then'](handleEntityNotFound(_0x41c264,null))[_0x8413('0x22')](saveUpdates(_0x82f797[_0x8413('0x46')],null))[_0x8413('0x22')](respondWithResult(_0x41c264,null))['catch'](handleError(_0x41c264,null));};exports[_0x8413('0x23')]=function(_0x4075c2,_0x58ad13){return db[_0x8413('0x41')][_0x8413('0x44')]({'where':{'id':_0x4075c2[_0x8413('0x40')]['id']}})[_0x8413('0x22')](handleEntityNotFound(_0x58ad13,null))[_0x8413('0x22')](removeEntity(_0x58ad13,null))[_0x8413('0x3f')](handleError(_0x58ad13,null));};exports[_0x8413('0x47')]=function(_0x2bc2f5,_0xde504d,_0x43ebd9){var _0x2434e0={};var _0x978a07={};var _0x2e29f2;var _0xd01ad4;return db['DeskConfiguration']['findOne']({'where':{'id':_0x2bc2f5[_0x8413('0x40')]['id']}})[_0x8413('0x22')](handleEntityNotFound(_0xde504d,null))[_0x8413('0x22')](function(_0x116b77){if(_0x116b77){_0x2e29f2=_0x116b77;_0x978a07['model']=_['keys'](db[_0x8413('0x48')][_0x8413('0x42')]);_0x978a07[_0x8413('0x2c')]=_[_0x8413('0x2d')](_0x2bc2f5[_0x8413('0x2c')]);_0x978a07[_0x8413('0x2e')]=_[_0x8413('0x2f')](_0x978a07[_0x8413('0x2b')],_0x978a07[_0x8413('0x2c')]);_0x2434e0[_0x8413('0x30')]=_['intersection'](_0x978a07['model'],qs[_0x8413('0x31')](_0x2bc2f5[_0x8413('0x2c')][_0x8413('0x31')]));_0x2434e0[_0x8413('0x30')]=_0x2434e0['attributes']['length']?_0x2434e0[_0x8413('0x30')]:_0x978a07[_0x8413('0x2b')];_0x2434e0['order']=qs[_0x8413('0x36')](_0x2bc2f5['query'][_0x8413('0x36')]);_0x2434e0[_0x8413('0x37')]=qs['filters'](_[_0x8413('0x38')](_0x2bc2f5[_0x8413('0x2c')],_0x978a07[_0x8413('0x2e')]));if(_0x2bc2f5['query']['filter']){_0x2434e0[_0x8413('0x37')]=_[_0x8413('0x3a')](_0x2434e0[_0x8413('0x37')],{'$or':_[_0x8413('0x27')](_0x2434e0[_0x8413('0x30')],function(_0x26ba77){var _0x3627ca={};_0x3627ca[_0x26ba77]={'$like':'%'+_0x2bc2f5['query'][_0x8413('0x39')]+'%'};return _0x3627ca;})});}_0x2434e0=_[_0x8413('0x3a')]({},_0x2434e0,_0x2bc2f5['options']);return _0x2e29f2['getFields'](_0x2434e0);}})[_0x8413('0x22')](function(_0x2b2ea0){if(_0x2b2ea0){_0xd01ad4=_0x2b2ea0[_0x8413('0x32')];if(!_0x2bc2f5[_0x8413('0x2c')][_0x8413('0x33')](_0x8413('0x34'))){_0x2434e0['limit']=qs['limit'](_0x2bc2f5[_0x8413('0x2c')][_0x8413('0x35')]);_0x2434e0[_0x8413('0x1e')]=qs[_0x8413('0x1e')](_0x2bc2f5['query'][_0x8413('0x1e')]);}return _0x2e29f2[_0x8413('0x47')](_0x2434e0);}})[_0x8413('0x22')](function(_0x1d3a7b){if(_0x1d3a7b){return _0x1d3a7b?{'count':_0xd01ad4,'rows':_0x1d3a7b}:null;}})['then'](respondWithResult(_0xde504d,null))[_0x8413('0x3f')](handleError(_0xde504d,null));};exports[_0x8413('0x49')]=function(_0x304092,_0x58ca3f,_0x5632e4){var _0x3d2aec={};var _0xeee5b3={};var _0x1dcb36;var _0x463511;return db[_0x8413('0x41')][_0x8413('0x4a')]({'where':{'id':_0x304092[_0x8413('0x40')]['id']}})[_0x8413('0x22')](handleEntityNotFound(_0x58ca3f,null))[_0x8413('0x22')](function(_0x231f2e){if(_0x231f2e){_0x1dcb36=_0x231f2e;_0xeee5b3['model']=_[_0x8413('0x2d')](db[_0x8413('0x48')]['rawAttributes']);_0xeee5b3[_0x8413('0x2c')]=_['keys'](_0x304092[_0x8413('0x2c')]);_0xeee5b3[_0x8413('0x2e')]=_['intersection'](_0xeee5b3[_0x8413('0x2b')],_0xeee5b3[_0x8413('0x2c')]);_0x3d2aec[_0x8413('0x30')]=_[_0x8413('0x2f')](_0xeee5b3[_0x8413('0x2b')],qs[_0x8413('0x31')](_0x304092[_0x8413('0x2c')][_0x8413('0x31')]));_0x3d2aec['attributes']=_0x3d2aec['attributes'][_0x8413('0x32')]?_0x3d2aec[_0x8413('0x30')]:_0xeee5b3['model'];_0x3d2aec[_0x8413('0x4b')]=qs[_0x8413('0x36')](_0x304092[_0x8413('0x2c')][_0x8413('0x36')]);_0x3d2aec[_0x8413('0x37')]=qs['filters'](_[_0x8413('0x38')](_0x304092[_0x8413('0x2c')],_0xeee5b3[_0x8413('0x2e')]));if(_0x304092[_0x8413('0x2c')][_0x8413('0x39')]){_0x3d2aec['where']=_[_0x8413('0x3a')](_0x3d2aec[_0x8413('0x37')],{'$or':_[_0x8413('0x27')](_0x3d2aec['attributes'],function(_0x2c1113){var _0x307c0f={};_0x307c0f[_0x2c1113]={'$like':'%'+_0x304092[_0x8413('0x2c')]['filter']+'%'};return _0x307c0f;})});}_0x3d2aec=_['merge']({},_0x3d2aec,_0x304092[_0x8413('0x3c')]);return _0x1dcb36[_0x8413('0x49')](_0x3d2aec);}})[_0x8413('0x22')](function(_0x2e8d46){if(_0x2e8d46){_0x463511=_0x2e8d46[_0x8413('0x32')];if(!_0x304092[_0x8413('0x2c')]['hasOwnProperty'](_0x8413('0x34'))){_0x3d2aec[_0x8413('0x35')]=qs['limit'](_0x304092['query'][_0x8413('0x35')]);_0x3d2aec[_0x8413('0x1e')]=qs[_0x8413('0x1e')](_0x304092['query'][_0x8413('0x1e')]);}return _0x1dcb36[_0x8413('0x49')](_0x3d2aec);}})[_0x8413('0x22')](function(_0x172f91){if(_0x172f91){return _0x172f91?{'count':_0x463511,'rows':_0x172f91}:null;}})[_0x8413('0x22')](respondWithResult(_0x58ca3f,null))[_0x8413('0x3f')](handleError(_0x58ca3f,null));};exports[_0x8413('0x4c')]=function(_0x323473,_0x556066,_0x4df461){var _0x51c135={};var _0x1e9f6a={};var _0x32d921;var _0x3e16e9;return db[_0x8413('0x41')][_0x8413('0x4a')]({'where':{'id':_0x323473[_0x8413('0x40')]['id']}})[_0x8413('0x22')](handleEntityNotFound(_0x556066,null))[_0x8413('0x22')](function(_0x4211ab){if(_0x4211ab){_0x32d921=_0x4211ab;_0x1e9f6a[_0x8413('0x2b')]=_[_0x8413('0x2d')](db[_0x8413('0x48')]['rawAttributes']);_0x1e9f6a[_0x8413('0x2c')]=_['keys'](_0x323473[_0x8413('0x2c')]);_0x1e9f6a['filters']=_[_0x8413('0x2f')](_0x1e9f6a['model'],_0x1e9f6a[_0x8413('0x2c')]);_0x51c135['attributes']=_[_0x8413('0x2f')](_0x1e9f6a[_0x8413('0x2b')],qs[_0x8413('0x31')](_0x323473[_0x8413('0x2c')][_0x8413('0x31')]));_0x51c135['attributes']=_0x51c135[_0x8413('0x30')][_0x8413('0x32')]?_0x51c135[_0x8413('0x30')]:_0x1e9f6a['model'];_0x51c135[_0x8413('0x4b')]=qs[_0x8413('0x36')](_0x323473[_0x8413('0x2c')]['sort']);_0x51c135['where']=qs['filters'](_['pick'](_0x323473[_0x8413('0x2c')],_0x1e9f6a[_0x8413('0x2e')]));if(_0x323473['query'][_0x8413('0x39')]){_0x51c135[_0x8413('0x37')]=_[_0x8413('0x3a')](_0x51c135['where'],{'$or':_['map'](_0x51c135[_0x8413('0x30')],function(_0x2735f9){var _0x4df524={};_0x4df524[_0x2735f9]={'$like':'%'+_0x323473[_0x8413('0x2c')][_0x8413('0x39')]+'%'};return _0x4df524;})});}_0x51c135=_[_0x8413('0x3a')]({},_0x51c135,_0x323473[_0x8413('0x3c')]);return _0x32d921[_0x8413('0x4c')](_0x51c135);}})['then'](function(_0x3102e6){if(_0x3102e6){_0x3e16e9=_0x3102e6['length'];if(!_0x323473[_0x8413('0x2c')][_0x8413('0x33')](_0x8413('0x34'))){_0x51c135[_0x8413('0x35')]=qs['limit'](_0x323473[_0x8413('0x2c')][_0x8413('0x35')]);_0x51c135[_0x8413('0x1e')]=qs[_0x8413('0x1e')](_0x323473[_0x8413('0x2c')]['offset']);}return _0x32d921[_0x8413('0x4c')](_0x51c135);}})[_0x8413('0x22')](function(_0x5da386){if(_0x5da386){return _0x5da386?{'count':_0x3e16e9,'rows':_0x5da386}:null;}})[_0x8413('0x22')](respondWithResult(_0x556066,null))[_0x8413('0x3f')](handleError(_0x556066,null));};exports['getTags']=function(_0x45ede1,_0x390446,_0x3d6923){var _0x336d8d={};var _0x569b7b={};var _0x3e931d;var _0x4faa8e;return db[_0x8413('0x41')][_0x8413('0x4a')]({'where':{'id':_0x45ede1[_0x8413('0x40')]['id']}})['then'](handleEntityNotFound(_0x390446,null))[_0x8413('0x22')](function(_0x3af297){if(_0x3af297){_0x3e931d=_0x3af297;_0x569b7b[_0x8413('0x2b')]=_[_0x8413('0x2d')](db['Tag'][_0x8413('0x42')]);_0x569b7b[_0x8413('0x2c')]=_[_0x8413('0x2d')](_0x45ede1[_0x8413('0x2c')]);_0x569b7b[_0x8413('0x2e')]=_['intersection'](_0x569b7b[_0x8413('0x2b')],_0x569b7b['query']);_0x336d8d[_0x8413('0x30')]=_[_0x8413('0x2f')](_0x569b7b[_0x8413('0x2b')],qs[_0x8413('0x31')](_0x45ede1[_0x8413('0x2c')][_0x8413('0x31')]));_0x336d8d[_0x8413('0x30')]=_0x336d8d[_0x8413('0x30')][_0x8413('0x32')]?_0x336d8d['attributes']:_0x569b7b[_0x8413('0x2b')];_0x336d8d[_0x8413('0x4b')]=qs['sort'](_0x45ede1[_0x8413('0x2c')][_0x8413('0x36')]);_0x336d8d[_0x8413('0x37')]=qs[_0x8413('0x2e')](_['pick'](_0x45ede1['query'],_0x569b7b['filters']));if(_0x45ede1[_0x8413('0x2c')][_0x8413('0x39')]){_0x336d8d['where']=_[_0x8413('0x3a')](_0x336d8d[_0x8413('0x37')],{'$or':_[_0x8413('0x27')](_0x336d8d[_0x8413('0x30')],function(_0x5f3e0b){var _0x3e5bac={};_0x3e5bac[_0x5f3e0b]={'$like':'%'+_0x45ede1[_0x8413('0x2c')][_0x8413('0x39')]+'%'};return _0x3e5bac;})});}_0x336d8d=_[_0x8413('0x3a')]({},_0x336d8d,_0x45ede1[_0x8413('0x3c')]);return _0x3e931d[_0x8413('0x4d')](_0x336d8d);}})[_0x8413('0x22')](function(_0x340651){if(_0x340651){_0x4faa8e=_0x340651[_0x8413('0x32')];if(!_0x45ede1['query']['hasOwnProperty']('nolimit')){_0x336d8d[_0x8413('0x35')]=qs[_0x8413('0x35')](_0x45ede1['query'][_0x8413('0x35')]);_0x336d8d[_0x8413('0x1e')]=qs['offset'](_0x45ede1[_0x8413('0x2c')][_0x8413('0x1e')]);}return _0x3e931d[_0x8413('0x4d')](_0x336d8d);}})[_0x8413('0x22')](function(_0x1f6b57){if(_0x1f6b57){return _0x1f6b57?{'count':_0x4faa8e,'rows':_0x1f6b57}:null;}})[_0x8413('0x22')](respondWithResult(_0x390446,null))['catch'](handleError(_0x390446,null));};exports[_0x8413('0x4e')]=function(_0x582120,_0x5720c5,_0x448f9a){if(_0x582120[_0x8413('0x46')]['id']){delete _0x582120[_0x8413('0x46')]['id'];}return db[_0x8413('0x41')][_0x8413('0x4a')]({'where':{'id':_0x582120[_0x8413('0x40')]['id']}})[_0x8413('0x22')](handleEntityNotFound(_0x5720c5,null))[_0x8413('0x22')](function(_0x4f1207){if(_0x4f1207){return _0x4f1207[_0x8413('0x4e')](_0x582120[_0x8413('0x46')][_0x8413('0x4f')]||[]);}return null;})['then'](respondWithResult(_0x5720c5,null))['catch'](handleError(_0x5720c5,null));}; \ No newline at end of file +var _0xd61d=['rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','Content-Range','then','destroy','error','name','map','DeskConfiguration','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','count','findAll','rows','show','params','include','options','catch','create','body','update','find','getFields','findOne','DeskField','rawAttributes','getSubjects','getDescriptions','getTags','Tag','setTags'];(function(_0x3aa924,_0x516c1f){var _0x1dfcef=function(_0x4590e6){while(--_0x4590e6){_0x3aa924['push'](_0x3aa924['shift']());}};_0x1dfcef(++_0x516c1f);}(_0xd61d,0x1d4));var _0xdd61=function(_0x29dbf2,_0x224ad2){_0x29dbf2=_0x29dbf2-0x0;var _0x37dd34=_0xd61d[_0x29dbf2];return _0x37dd34;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdd61('0x0'));var zipdir=require(_0xdd61('0x1'));var jsonpatch=require(_0xdd61('0x2'));var rp=require('request-promise');var moment=require(_0xdd61('0x3'));var BPromise=require(_0xdd61('0x4'));var Mustache=require(_0xdd61('0x5'));var util=require(_0xdd61('0x6'));var path=require(_0xdd61('0x7'));var sox=require(_0xdd61('0x8'));var csv=require(_0xdd61('0x9'));var ejs=require(_0xdd61('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdd61('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdd61('0x9'));var querystring=require(_0xdd61('0xc'));var Papa=require(_0xdd61('0xd'));var Redis=require(_0xdd61('0xe'));var authService=require(_0xdd61('0xf'));var qs=require(_0xdd61('0x10'));var as=require(_0xdd61('0x11'));var hardwareService=require(_0xdd61('0x12'));var logger=require(_0xdd61('0x13'))(_0xdd61('0x14'));var utils=require('../../config/utils');var config=require(_0xdd61('0x15'));var licenseUtil=require(_0xdd61('0x16'));var db=require(_0xdd61('0x17'))['db'];function respondWithStatusCode(_0x366883,_0x131220){_0x131220=_0x131220||0xcc;return function(_0x247ca4){if(_0x247ca4){return _0x366883[_0xdd61('0x18')](_0x131220);}return _0x366883['status'](_0x131220)[_0xdd61('0x19')]();};}function respondWithResult(_0x5cb4b3,_0x11ccd9){_0x11ccd9=_0x11ccd9||0xc8;return function(_0x106aa6){if(_0x106aa6){return _0x5cb4b3[_0xdd61('0x1a')](_0x11ccd9)[_0xdd61('0x1b')](_0x106aa6);}};}function respondWithFilteredResult(_0x589543,_0x7ea2de){return function(_0x572b1b){if(_0x572b1b){var _0x4e9b85=typeof _0x7ea2de[_0xdd61('0x1c')]===_0xdd61('0x1d')&&typeof _0x7ea2de['limit']===_0xdd61('0x1d');var _0x348524=_0x572b1b['count'];var _0x2e9ca6=_0x4e9b85?0x0:_0x7ea2de[_0xdd61('0x1c')];var _0x5a10ff=_0x4e9b85?_0x572b1b['count']:_0x7ea2de[_0xdd61('0x1c')]+_0x7ea2de['limit'];var _0x1e7845;if(_0x5a10ff>=_0x348524){_0x5a10ff=_0x348524;_0x1e7845=0xc8;}else{_0x1e7845=0xce;}_0x589543[_0xdd61('0x1a')](_0x1e7845);return _0x589543['set'](_0xdd61('0x1e'),_0x2e9ca6+'-'+_0x5a10ff+'/'+_0x348524)[_0xdd61('0x1b')](_0x572b1b);}return null;};}function patchUpdates(_0x1b89d7){return function(_0x52dc57){try{jsonpatch['apply'](_0x52dc57,_0x1b89d7,!![]);}catch(_0xda1123){return BPromise['reject'](_0xda1123);}return _0x52dc57['save']();};}function saveUpdates(_0x2687d4,_0x1da8c1){return function(_0x2934bf){if(_0x2934bf){return _0x2934bf['update'](_0x2687d4)[_0xdd61('0x1f')](function(_0x39b2d6){return _0x39b2d6;});}return null;};}function removeEntity(_0x2cd686,_0x5d2139){return function(_0x10e2b8){if(_0x10e2b8){return _0x10e2b8[_0xdd61('0x20')]()[_0xdd61('0x1f')](function(){_0x2cd686[_0xdd61('0x1a')](0xcc)[_0xdd61('0x19')]();});}};}function handleEntityNotFound(_0x2c605a,_0x21e3d8){return function(_0x562f6c){if(!_0x562f6c){_0x2c605a[_0xdd61('0x18')](0x194);}return _0x562f6c;};}function handleError(_0x536538,_0x1cca60){_0x1cca60=_0x1cca60||0x1f4;return function(_0x55841a){logger[_0xdd61('0x21')](_0x55841a['stack']);if(_0x55841a[_0xdd61('0x22')]){delete _0x55841a['name'];}_0x536538[_0xdd61('0x1a')](_0x1cca60)['send'](_0x55841a);};}exports['index']=function(_0x390ae8,_0x357373){var _0x17d436={},_0x97a34f={},_0x1d36a7={'count':0x0,'rows':[]};var _0x3f3e4c=_[_0xdd61('0x23')](db[_0xdd61('0x24')]['rawAttributes'],function(_0x363992){return{'name':_0x363992[_0xdd61('0x25')],'type':_0x363992[_0xdd61('0x26')][_0xdd61('0x27')]};});_0x97a34f[_0xdd61('0x28')]=_['map'](_0x3f3e4c,_0xdd61('0x22'));_0x97a34f['query']=_[_0xdd61('0x29')](_0x390ae8['query']);_0x97a34f[_0xdd61('0x2a')]=_[_0xdd61('0x2b')](_0x97a34f[_0xdd61('0x28')],_0x97a34f[_0xdd61('0x2c')]);_0x17d436[_0xdd61('0x2d')]=_['intersection'](_0x97a34f['model'],qs[_0xdd61('0x2e')](_0x390ae8[_0xdd61('0x2c')]['fields']));_0x17d436[_0xdd61('0x2d')]=_0x17d436['attributes'][_0xdd61('0x2f')]?_0x17d436[_0xdd61('0x2d')]:_0x97a34f['model'];if(!_0x390ae8['query'][_0xdd61('0x30')](_0xdd61('0x31'))){_0x17d436['limit']=qs[_0xdd61('0x32')](_0x390ae8[_0xdd61('0x2c')][_0xdd61('0x32')]);_0x17d436['offset']=qs[_0xdd61('0x1c')](_0x390ae8['query']['offset']);}_0x17d436[_0xdd61('0x33')]=qs[_0xdd61('0x34')](_0x390ae8[_0xdd61('0x2c')][_0xdd61('0x34')]);_0x17d436[_0xdd61('0x35')]=qs[_0xdd61('0x2a')](_[_0xdd61('0x36')](_0x390ae8[_0xdd61('0x2c')],_0x97a34f[_0xdd61('0x2a')]),_0x3f3e4c);if(_0x390ae8['query'][_0xdd61('0x37')]){_0x17d436[_0xdd61('0x35')]=_[_0xdd61('0x38')](_0x17d436[_0xdd61('0x35')],{'$or':_[_0xdd61('0x23')](_0x3f3e4c,function(_0x286ea1){if(_0x286ea1[_0xdd61('0x26')]!=='VIRTUAL'){var _0x2a637c={};_0x2a637c[_0x286ea1['name']]={'$like':'%'+_0x390ae8['query'][_0xdd61('0x37')]+'%'};return _0x2a637c;}})});}_0x17d436=_[_0xdd61('0x38')]({},_0x17d436,_0x390ae8['options']);var _0x282c84={'where':_0x17d436['where']};return db[_0xdd61('0x24')][_0xdd61('0x39')](_0x282c84)[_0xdd61('0x1f')](function(_0x439a24){_0x1d36a7[_0xdd61('0x39')]=_0x439a24;if(_0x390ae8[_0xdd61('0x2c')]['includeAll']){_0x17d436['include']=[{'all':!![]}];}return db['DeskConfiguration'][_0xdd61('0x3a')](_0x17d436);})['then'](function(_0x54047f){_0x1d36a7[_0xdd61('0x3b')]=_0x54047f;return _0x1d36a7;})[_0xdd61('0x1f')](respondWithFilteredResult(_0x357373,_0x17d436))['catch'](handleError(_0x357373,null));};exports[_0xdd61('0x3c')]=function(_0x2c9263,_0x1f0c75){var _0x5c58bc={'raw':![],'where':{'id':_0x2c9263[_0xdd61('0x3d')]['id']}},_0x2f7010={};_0x2f7010[_0xdd61('0x28')]=_[_0xdd61('0x29')](db[_0xdd61('0x24')]['rawAttributes']);_0x2f7010['query']=_['keys'](_0x2c9263[_0xdd61('0x2c')]);_0x2f7010[_0xdd61('0x2a')]=_[_0xdd61('0x2b')](_0x2f7010[_0xdd61('0x28')],_0x2f7010[_0xdd61('0x2c')]);_0x5c58bc[_0xdd61('0x2d')]=_[_0xdd61('0x2b')](_0x2f7010['model'],qs[_0xdd61('0x2e')](_0x2c9263[_0xdd61('0x2c')][_0xdd61('0x2e')]));_0x5c58bc[_0xdd61('0x2d')]=_0x5c58bc[_0xdd61('0x2d')][_0xdd61('0x2f')]?_0x5c58bc[_0xdd61('0x2d')]:_0x2f7010[_0xdd61('0x28')];if(_0x2c9263['query']['includeAll']){_0x5c58bc[_0xdd61('0x3e')]=[{'all':!![]}];}_0x5c58bc=_[_0xdd61('0x38')]({},_0x5c58bc,_0x2c9263[_0xdd61('0x3f')]);return db['DeskConfiguration']['find'](_0x5c58bc)[_0xdd61('0x1f')](handleEntityNotFound(_0x1f0c75,null))[_0xdd61('0x1f')](respondWithResult(_0x1f0c75,null))[_0xdd61('0x40')](handleError(_0x1f0c75,null));};exports[_0xdd61('0x41')]=function(_0x4d3664,_0x12c486){return db[_0xdd61('0x24')][_0xdd61('0x41')](_0x4d3664[_0xdd61('0x42')],{})[_0xdd61('0x1f')](respondWithResult(_0x12c486,0xc9))[_0xdd61('0x40')](handleError(_0x12c486,null));};exports[_0xdd61('0x43')]=function(_0x2c743d,_0x5bd36c){if(_0x2c743d[_0xdd61('0x42')]['id']){delete _0x2c743d['body']['id'];}return db[_0xdd61('0x24')][_0xdd61('0x44')]({'where':{'id':_0x2c743d[_0xdd61('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5bd36c,null))[_0xdd61('0x1f')](saveUpdates(_0x2c743d[_0xdd61('0x42')],null))[_0xdd61('0x1f')](respondWithResult(_0x5bd36c,null))[_0xdd61('0x40')](handleError(_0x5bd36c,null));};exports[_0xdd61('0x20')]=function(_0x3ece03,_0x19f049){return db[_0xdd61('0x24')][_0xdd61('0x44')]({'where':{'id':_0x3ece03[_0xdd61('0x3d')]['id']}})['then'](handleEntityNotFound(_0x19f049,null))['then'](removeEntity(_0x19f049,null))[_0xdd61('0x40')](handleError(_0x19f049,null));};exports[_0xdd61('0x45')]=function(_0x580874,_0x406d67,_0x24c5a0){var _0x4f6c38={};var _0x52dff3={};var _0x3f6971;var _0x25ed27;return db['DeskConfiguration'][_0xdd61('0x46')]({'where':{'id':_0x580874[_0xdd61('0x3d')]['id']}})[_0xdd61('0x1f')](handleEntityNotFound(_0x406d67,null))[_0xdd61('0x1f')](function(_0x40e96c){if(_0x40e96c){_0x3f6971=_0x40e96c;_0x52dff3[_0xdd61('0x28')]=_[_0xdd61('0x29')](db['DeskField']['rawAttributes']);_0x52dff3[_0xdd61('0x2c')]=_[_0xdd61('0x29')](_0x580874['query']);_0x52dff3[_0xdd61('0x2a')]=_[_0xdd61('0x2b')](_0x52dff3[_0xdd61('0x28')],_0x52dff3['query']);_0x4f6c38['attributes']=_[_0xdd61('0x2b')](_0x52dff3['model'],qs['fields'](_0x580874[_0xdd61('0x2c')]['fields']));_0x4f6c38[_0xdd61('0x2d')]=_0x4f6c38['attributes'][_0xdd61('0x2f')]?_0x4f6c38[_0xdd61('0x2d')]:_0x52dff3['model'];_0x4f6c38[_0xdd61('0x33')]=qs[_0xdd61('0x34')](_0x580874['query']['sort']);_0x4f6c38[_0xdd61('0x35')]=qs['filters'](_[_0xdd61('0x36')](_0x580874['query'],_0x52dff3[_0xdd61('0x2a')]));if(_0x580874['query'][_0xdd61('0x37')]){_0x4f6c38[_0xdd61('0x35')]=_['merge'](_0x4f6c38[_0xdd61('0x35')],{'$or':_[_0xdd61('0x23')](_0x4f6c38[_0xdd61('0x2d')],function(_0x4bcdb7){var _0x57d874={};_0x57d874[_0x4bcdb7]={'$like':'%'+_0x580874[_0xdd61('0x2c')]['filter']+'%'};return _0x57d874;})});}_0x4f6c38=_['merge']({},_0x4f6c38,_0x580874[_0xdd61('0x3f')]);return _0x3f6971['getFields'](_0x4f6c38);}})['then'](function(_0x173703){if(_0x173703){_0x25ed27=_0x173703[_0xdd61('0x2f')];if(!_0x580874[_0xdd61('0x2c')][_0xdd61('0x30')](_0xdd61('0x31'))){_0x4f6c38['limit']=qs[_0xdd61('0x32')](_0x580874[_0xdd61('0x2c')][_0xdd61('0x32')]);_0x4f6c38[_0xdd61('0x1c')]=qs[_0xdd61('0x1c')](_0x580874[_0xdd61('0x2c')][_0xdd61('0x1c')]);}return _0x3f6971[_0xdd61('0x45')](_0x4f6c38);}})['then'](function(_0x492afb){if(_0x492afb){return _0x492afb?{'count':_0x25ed27,'rows':_0x492afb}:null;}})[_0xdd61('0x1f')](respondWithResult(_0x406d67,null))[_0xdd61('0x40')](handleError(_0x406d67,null));};exports['getSubjects']=function(_0x438ccd,_0x4120a6,_0x15972b){var _0x36c9b4={};var _0x3051db={};var _0x4467d7;var _0x1564a8;return db[_0xdd61('0x24')]['findOne']({'where':{'id':_0x438ccd['params']['id']}})[_0xdd61('0x1f')](handleEntityNotFound(_0x4120a6,null))[_0xdd61('0x1f')](function(_0x5869fe){if(_0x5869fe){_0x4467d7=_0x5869fe;_0x3051db['model']=_[_0xdd61('0x29')](db[_0xdd61('0x47')][_0xdd61('0x48')]);_0x3051db[_0xdd61('0x2c')]=_['keys'](_0x438ccd['query']);_0x3051db['filters']=_[_0xdd61('0x2b')](_0x3051db['model'],_0x3051db[_0xdd61('0x2c')]);_0x36c9b4[_0xdd61('0x2d')]=_['intersection'](_0x3051db[_0xdd61('0x28')],qs['fields'](_0x438ccd['query']['fields']));_0x36c9b4[_0xdd61('0x2d')]=_0x36c9b4[_0xdd61('0x2d')][_0xdd61('0x2f')]?_0x36c9b4[_0xdd61('0x2d')]:_0x3051db[_0xdd61('0x28')];_0x36c9b4[_0xdd61('0x33')]=qs[_0xdd61('0x34')](_0x438ccd[_0xdd61('0x2c')][_0xdd61('0x34')]);_0x36c9b4[_0xdd61('0x35')]=qs[_0xdd61('0x2a')](_['pick'](_0x438ccd[_0xdd61('0x2c')],_0x3051db['filters']));if(_0x438ccd[_0xdd61('0x2c')][_0xdd61('0x37')]){_0x36c9b4[_0xdd61('0x35')]=_['merge'](_0x36c9b4[_0xdd61('0x35')],{'$or':_[_0xdd61('0x23')](_0x36c9b4[_0xdd61('0x2d')],function(_0x4e7c24){var _0x55f62b={};_0x55f62b[_0x4e7c24]={'$like':'%'+_0x438ccd[_0xdd61('0x2c')][_0xdd61('0x37')]+'%'};return _0x55f62b;})});}_0x36c9b4=_['merge']({},_0x36c9b4,_0x438ccd[_0xdd61('0x3f')]);return _0x4467d7[_0xdd61('0x49')](_0x36c9b4);}})[_0xdd61('0x1f')](function(_0x1d08bd){if(_0x1d08bd){_0x1564a8=_0x1d08bd['length'];if(!_0x438ccd[_0xdd61('0x2c')][_0xdd61('0x30')](_0xdd61('0x31'))){_0x36c9b4['limit']=qs['limit'](_0x438ccd['query'][_0xdd61('0x32')]);_0x36c9b4[_0xdd61('0x1c')]=qs['offset'](_0x438ccd[_0xdd61('0x2c')][_0xdd61('0x1c')]);}return _0x4467d7[_0xdd61('0x49')](_0x36c9b4);}})[_0xdd61('0x1f')](function(_0x224c8b){if(_0x224c8b){return _0x224c8b?{'count':_0x1564a8,'rows':_0x224c8b}:null;}})[_0xdd61('0x1f')](respondWithResult(_0x4120a6,null))['catch'](handleError(_0x4120a6,null));};exports[_0xdd61('0x4a')]=function(_0x55fd09,_0xb28d85,_0x3bd836){var _0x206928={};var _0x28b1ca={};var _0x935337;var _0x310b80;return db['DeskConfiguration'][_0xdd61('0x46')]({'where':{'id':_0x55fd09[_0xdd61('0x3d')]['id']}})[_0xdd61('0x1f')](handleEntityNotFound(_0xb28d85,null))[_0xdd61('0x1f')](function(_0x24356a){if(_0x24356a){_0x935337=_0x24356a;_0x28b1ca[_0xdd61('0x28')]=_[_0xdd61('0x29')](db[_0xdd61('0x47')][_0xdd61('0x48')]);_0x28b1ca[_0xdd61('0x2c')]=_[_0xdd61('0x29')](_0x55fd09[_0xdd61('0x2c')]);_0x28b1ca['filters']=_[_0xdd61('0x2b')](_0x28b1ca[_0xdd61('0x28')],_0x28b1ca[_0xdd61('0x2c')]);_0x206928[_0xdd61('0x2d')]=_[_0xdd61('0x2b')](_0x28b1ca[_0xdd61('0x28')],qs[_0xdd61('0x2e')](_0x55fd09[_0xdd61('0x2c')]['fields']));_0x206928['attributes']=_0x206928[_0xdd61('0x2d')][_0xdd61('0x2f')]?_0x206928[_0xdd61('0x2d')]:_0x28b1ca[_0xdd61('0x28')];_0x206928[_0xdd61('0x33')]=qs[_0xdd61('0x34')](_0x55fd09['query']['sort']);_0x206928[_0xdd61('0x35')]=qs[_0xdd61('0x2a')](_[_0xdd61('0x36')](_0x55fd09[_0xdd61('0x2c')],_0x28b1ca['filters']));if(_0x55fd09[_0xdd61('0x2c')]['filter']){_0x206928[_0xdd61('0x35')]=_['merge'](_0x206928[_0xdd61('0x35')],{'$or':_[_0xdd61('0x23')](_0x206928['attributes'],function(_0x3bff70){var _0x43f26e={};_0x43f26e[_0x3bff70]={'$like':'%'+_0x55fd09['query'][_0xdd61('0x37')]+'%'};return _0x43f26e;})});}_0x206928=_['merge']({},_0x206928,_0x55fd09[_0xdd61('0x3f')]);return _0x935337['getDescriptions'](_0x206928);}})[_0xdd61('0x1f')](function(_0x161962){if(_0x161962){_0x310b80=_0x161962[_0xdd61('0x2f')];if(!_0x55fd09['query'][_0xdd61('0x30')](_0xdd61('0x31'))){_0x206928[_0xdd61('0x32')]=qs[_0xdd61('0x32')](_0x55fd09[_0xdd61('0x2c')][_0xdd61('0x32')]);_0x206928[_0xdd61('0x1c')]=qs[_0xdd61('0x1c')](_0x55fd09['query']['offset']);}return _0x935337['getDescriptions'](_0x206928);}})['then'](function(_0x40de79){if(_0x40de79){return _0x40de79?{'count':_0x310b80,'rows':_0x40de79}:null;}})[_0xdd61('0x1f')](respondWithResult(_0xb28d85,null))['catch'](handleError(_0xb28d85,null));};exports[_0xdd61('0x4b')]=function(_0x4f952d,_0x2e7861,_0x23cca7){var _0x25acd7={};var _0x51e240={};var _0xcb09ef;var _0xd640fe;return db[_0xdd61('0x24')][_0xdd61('0x46')]({'where':{'id':_0x4f952d['params']['id']}})['then'](handleEntityNotFound(_0x2e7861,null))['then'](function(_0x21f172){if(_0x21f172){_0xcb09ef=_0x21f172;_0x51e240[_0xdd61('0x28')]=_[_0xdd61('0x29')](db[_0xdd61('0x4c')][_0xdd61('0x48')]);_0x51e240['query']=_[_0xdd61('0x29')](_0x4f952d[_0xdd61('0x2c')]);_0x51e240[_0xdd61('0x2a')]=_[_0xdd61('0x2b')](_0x51e240[_0xdd61('0x28')],_0x51e240[_0xdd61('0x2c')]);_0x25acd7['attributes']=_[_0xdd61('0x2b')](_0x51e240[_0xdd61('0x28')],qs[_0xdd61('0x2e')](_0x4f952d[_0xdd61('0x2c')][_0xdd61('0x2e')]));_0x25acd7[_0xdd61('0x2d')]=_0x25acd7['attributes'][_0xdd61('0x2f')]?_0x25acd7[_0xdd61('0x2d')]:_0x51e240['model'];_0x25acd7[_0xdd61('0x33')]=qs[_0xdd61('0x34')](_0x4f952d['query'][_0xdd61('0x34')]);_0x25acd7[_0xdd61('0x35')]=qs[_0xdd61('0x2a')](_[_0xdd61('0x36')](_0x4f952d['query'],_0x51e240[_0xdd61('0x2a')]));if(_0x4f952d[_0xdd61('0x2c')][_0xdd61('0x37')]){_0x25acd7[_0xdd61('0x35')]=_[_0xdd61('0x38')](_0x25acd7[_0xdd61('0x35')],{'$or':_[_0xdd61('0x23')](_0x25acd7[_0xdd61('0x2d')],function(_0x15f10c){var _0x1b8314={};_0x1b8314[_0x15f10c]={'$like':'%'+_0x4f952d[_0xdd61('0x2c')][_0xdd61('0x37')]+'%'};return _0x1b8314;})});}_0x25acd7=_[_0xdd61('0x38')]({},_0x25acd7,_0x4f952d[_0xdd61('0x3f')]);return _0xcb09ef[_0xdd61('0x4b')](_0x25acd7);}})[_0xdd61('0x1f')](function(_0x2beb9b){if(_0x2beb9b){_0xd640fe=_0x2beb9b[_0xdd61('0x2f')];if(!_0x4f952d['query'][_0xdd61('0x30')](_0xdd61('0x31'))){_0x25acd7[_0xdd61('0x32')]=qs[_0xdd61('0x32')](_0x4f952d['query'][_0xdd61('0x32')]);_0x25acd7[_0xdd61('0x1c')]=qs[_0xdd61('0x1c')](_0x4f952d[_0xdd61('0x2c')][_0xdd61('0x1c')]);}return _0xcb09ef[_0xdd61('0x4b')](_0x25acd7);}})[_0xdd61('0x1f')](function(_0x540789){if(_0x540789){return _0x540789?{'count':_0xd640fe,'rows':_0x540789}:null;}})[_0xdd61('0x1f')](respondWithResult(_0x2e7861,null))[_0xdd61('0x40')](handleError(_0x2e7861,null));};exports[_0xdd61('0x4d')]=function(_0x570e7a,_0x8f26b4,_0x495ae2){if(_0x570e7a[_0xdd61('0x42')]['id']){delete _0x570e7a[_0xdd61('0x42')]['id'];}return db[_0xdd61('0x24')][_0xdd61('0x46')]({'where':{'id':_0x570e7a[_0xdd61('0x3d')]['id']}})[_0xdd61('0x1f')](handleEntityNotFound(_0x8f26b4,null))[_0xdd61('0x1f')](function(_0x5d68f6){if(_0x5d68f6){return _0x5d68f6['setTags'](_0x570e7a[_0xdd61('0x42')]['ids']||[]);}return null;})['then'](respondWithResult(_0x8f26b4,null))['catch'](handleError(_0x8f26b4,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index d38a975..be2ac90 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 _0xce91=['./intDeskConfiguration.attributes','exports','define','DeskConfiguration','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0xf84870,_0x4dc38f){var _0x4541a4=function(_0x3ff5d5){while(--_0x3ff5d5){_0xf84870['push'](_0xf84870['shift']());}};_0x4541a4(++_0x4dc38f);}(_0xce91,0x1e5));var _0x1ce9=function(_0x1bae7b,_0x1e6b5a){_0x1bae7b=_0x1bae7b-0x0;var _0x333283=_0xce91[_0x1bae7b];return _0x333283;};'use strict';var _=require(_0x1ce9('0x0'));var util=require(_0x1ce9('0x1'));var logger=require(_0x1ce9('0x2'))(_0x1ce9('0x3'));var moment=require(_0x1ce9('0x4'));var BPromise=require(_0x1ce9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1ce9('0x6'));var rimraf=require(_0x1ce9('0x7'));var config=require(_0x1ce9('0x8'));var attributes=require(_0x1ce9('0x9'));module[_0x1ce9('0xa')]=function(_0x3d9e38,_0x31f394){return _0x3d9e38[_0x1ce9('0xb')](_0x1ce9('0xc'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd436=['define','DeskConfiguration','lodash','util','api','bluebird','path','./intDeskConfiguration.attributes'];(function(_0x56195c,_0x2adb9e){var _0x1439ea=function(_0x3b9ee4){while(--_0x3b9ee4){_0x56195c['push'](_0x56195c['shift']());}};_0x1439ea(++_0x2adb9e);}(_0xd436,0x1ea));var _0x6d43=function(_0x3d6907,_0x2f08fb){_0x3d6907=_0x3d6907-0x0;var _0x2ab3aa=_0xd436[_0x3d6907];return _0x2ab3aa;};'use strict';var _=require(_0x6d43('0x0'));var util=require(_0x6d43('0x1'));var logger=require('../../config/logger')(_0x6d43('0x2'));var moment=require('moment');var BPromise=require(_0x6d43('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6d43('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6d43('0x5'));module['exports']=function(_0x1eb081,_0x20a476){return _0x1eb081[_0x6d43('0x6')](_0x6d43('0x7'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index ef813d8..703e5d9 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 _0xb982=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','moment','bluebird'];(function(_0x51a5d3,_0x9bb804){var _0x5a4af1=function(_0x38f858){while(--_0x38f858){_0x51a5d3['push'](_0x51a5d3['shift']());}};_0x5a4af1(++_0x9bb804);}(_0xb982,0x15e));var _0x2b98=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb982[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2b98('0x0'));var BPromise=require(_0x2b98('0x1'));var rs=require(_0x2b98('0x2'));var fs=require('fs');var Redis=require(_0x2b98('0x3'));var db=require(_0x2b98('0x4'))['db'];var utils=require(_0x2b98('0x5'));var logger=require(_0x2b98('0x6'))(_0x2b98('0x7'));var config=require(_0x2b98('0x8'));var jayson=require(_0x2b98('0x9'));var client=jayson['client'][_0x2b98('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1166cb,_0x15ee91,_0x4626ad){return new BPromise(function(_0x3a6bad,_0x6b6f9e){return client['request'](_0x1166cb,_0x4626ad)[_0x2b98('0xb')](function(_0x4c64b5){logger['info'](_0x2b98('0xc'),_0x15ee91,'request\x20sent');logger[_0x2b98('0xd')](_0x2b98('0xe'),_0x15ee91,_0x2b98('0xf'),JSON[_0x2b98('0x10')](_0x4c64b5));if(_0x4c64b5[_0x2b98('0x11')]){if(_0x4c64b5['error'][_0x2b98('0x12')]===0x1f4){logger['error'](_0x2b98('0xc'),_0x15ee91,_0x4c64b5[_0x2b98('0x11')][_0x2b98('0x13')]);return _0x6b6f9e(_0x4c64b5[_0x2b98('0x11')][_0x2b98('0x13')]);}logger[_0x2b98('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x15ee91,_0x4c64b5[_0x2b98('0x11')][_0x2b98('0x13')]);return _0x3a6bad(_0x4c64b5[_0x2b98('0x11')][_0x2b98('0x13')]);}else{logger[_0x2b98('0x14')](_0x2b98('0xc'),_0x15ee91,_0x2b98('0xf'));_0x3a6bad(_0x4c64b5['result'][_0x2b98('0x13')]);}})[_0x2b98('0x15')](function(_0x51eb95){logger[_0x2b98('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x15ee91,_0x51eb95);_0x6b6f9e(_0x51eb95);});});} \ No newline at end of file +var _0xfa75=['jayson/promise','client','http','request','then','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x58612a,_0xfe83a){var _0x38801e=function(_0x2707d2){while(--_0x2707d2){_0x58612a['push'](_0x58612a['shift']());}};_0x38801e(++_0xfe83a);}(_0xfa75,0x1ef));var _0x5fa7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfa75[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x5fa7('0x0'));var util=require(_0x5fa7('0x1'));var moment=require(_0x5fa7('0x2'));var BPromise=require('bluebird');var rs=require(_0x5fa7('0x3'));var fs=require('fs');var Redis=require(_0x5fa7('0x4'));var db=require(_0x5fa7('0x5'))['db'];var utils=require(_0x5fa7('0x6'));var logger=require('../../config/logger')(_0x5fa7('0x7'));var config=require(_0x5fa7('0x8'));var jayson=require(_0x5fa7('0x9'));var client=jayson[_0x5fa7('0xa')][_0x5fa7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x548e4e,_0x317893,_0x56ff0a){return new BPromise(function(_0x9543ee,_0x2df4b8){return client[_0x5fa7('0xc')](_0x548e4e,_0x56ff0a)[_0x5fa7('0xd')](function(_0x29b8d0){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x317893,_0x5fa7('0xe'));logger['debug'](_0x5fa7('0xf'),_0x317893,'request\x20sent',JSON[_0x5fa7('0x10')](_0x29b8d0));if(_0x29b8d0['error']){if(_0x29b8d0[_0x5fa7('0x11')][_0x5fa7('0x12')]===0x1f4){logger['error'](_0x5fa7('0x13'),_0x317893,_0x29b8d0[_0x5fa7('0x11')][_0x5fa7('0x14')]);return _0x2df4b8(_0x29b8d0[_0x5fa7('0x11')][_0x5fa7('0x14')]);}logger[_0x5fa7('0x11')](_0x5fa7('0x13'),_0x317893,_0x29b8d0[_0x5fa7('0x11')][_0x5fa7('0x14')]);return _0x9543ee(_0x29b8d0[_0x5fa7('0x11')][_0x5fa7('0x14')]);}else{logger[_0x5fa7('0x15')]('DeskConfiguration,\x20%s,\x20%s',_0x317893,'request\x20sent');_0x9543ee(_0x29b8d0[_0x5fa7('0x16')][_0x5fa7('0x14')]);}})[_0x5fa7('0x17')](function(_0x6999a0){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x317893,_0x6999a0);_0x2df4b8(_0x6999a0);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index bcbb326..e44d0c2 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 _0xbc1d=['../../components/interaction/service','./intDeskField.controller','isAuthenticated','index','get','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x578ab1,_0xf0f9eb){var _0x4d030f=function(_0x121af2){while(--_0x121af2){_0x578ab1['push'](_0x578ab1['shift']());}};_0x4d030f(++_0xf0f9eb);}(_0xbc1d,0x12a));var _0xdbc1=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xbc1d[_0x376b45];return _0x2341b3;};'use strict';var multer=require(_0xdbc1('0x0'));var util=require(_0xdbc1('0x1'));var path=require(_0xdbc1('0x2'));var timeout=require('connect-timeout');var express=require(_0xdbc1('0x3'));var router=express[_0xdbc1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdbc1('0x5'));var interaction=require(_0xdbc1('0x6'));var config=require('../../config/environment');var controller=require(_0xdbc1('0x7'));router['get']('/',auth[_0xdbc1('0x8')](),controller[_0xdbc1('0x9')]);router[_0xdbc1('0xa')](_0xdbc1('0xb'),auth[_0xdbc1('0x8')](),controller[_0xdbc1('0xc')]);router[_0xdbc1('0xd')]('/',auth[_0xdbc1('0x8')](),controller[_0xdbc1('0xe')]);router['put'](_0xdbc1('0xb'),auth[_0xdbc1('0x8')](),controller[_0xdbc1('0xf')]);router[_0xdbc1('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xdbc1('0x11')]);module[_0xdbc1('0x12')]=router; \ No newline at end of file +var _0xd01c=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','put','delete','exports','multer'];(function(_0x1e003b,_0x3e4ded){var _0x268789=function(_0x559062){while(--_0x559062){_0x1e003b['push'](_0x1e003b['shift']());}};_0x268789(++_0x3e4ded);}(_0xd01c,0xfb));var _0xcd01=function(_0x164186,_0x1be237){_0x164186=_0x164186-0x0;var _0x407234=_0xd01c[_0x164186];return _0x407234;};'use strict';var multer=require(_0xcd01('0x0'));var util=require(_0xcd01('0x1'));var path=require(_0xcd01('0x2'));var timeout=require(_0xcd01('0x3'));var express=require(_0xcd01('0x4'));var router=express['Router']();var fs_extra=require(_0xcd01('0x5'));var auth=require(_0xcd01('0x6'));var interaction=require(_0xcd01('0x7'));var config=require('../../config/environment');var controller=require(_0xcd01('0x8'));router[_0xcd01('0x9')]('/',auth[_0xcd01('0xa')](),controller[_0xcd01('0xb')]);router['get'](_0xcd01('0xc'),auth[_0xcd01('0xa')](),controller[_0xcd01('0xd')]);router[_0xcd01('0xe')]('/',auth[_0xcd01('0xa')](),controller['create']);router[_0xcd01('0xf')](_0xcd01('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xcd01('0x10')](_0xcd01('0xc'),auth[_0xcd01('0xa')](),controller['destroy']);module[_0xcd01('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 95a2a27..b010dd6 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 _0x58c8=['keyValue','STRING','customVariable','BOOLEAN','sequelize','ENUM','string','variable'];(function(_0x2c778d,_0x29682f){var _0x256184=function(_0x2fbea3){while(--_0x2fbea3){_0x2c778d['push'](_0x2c778d['shift']());}};_0x256184(++_0x29682f);}(_0x58c8,0x17c));var _0x858c=function(_0xc01a2a,_0x60798e){_0xc01a2a=_0xc01a2a-0x0;var _0x1bee3c=_0x58c8[_0xc01a2a];return _0x1bee3c;};'use strict';var Sequelize=require(_0x858c('0x0'));module['exports']={'type':{'type':Sequelize[_0x858c('0x1')](_0x858c('0x2'),_0x858c('0x3'),'customVariable',_0x858c('0x4'),'picklist'),'defaultValue':_0x858c('0x2')},'content':{'type':Sequelize[_0x858c('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0x858c('0x3'),_0x858c('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x858c('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x858c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x858c('0x5')]}}; \ No newline at end of file +var _0x81eb=['variable','customVariable','picklist','STRING','sequelize','ENUM','string'];(function(_0x447f6d,_0x36fc29){var _0x56a9b8=function(_0x16444e){while(--_0x16444e){_0x447f6d['push'](_0x447f6d['shift']());}};_0x56a9b8(++_0x36fc29);}(_0x81eb,0x1af));var _0xb81e=function(_0x17a390,_0x38aecf){_0x17a390=_0x17a390-0x0;var _0x572885=_0x81eb[_0x17a390];return _0x572885;};'use strict';var Sequelize=require(_0xb81e('0x0'));module['exports']={'type':{'type':Sequelize[_0xb81e('0x1')](_0xb81e('0x2'),_0xb81e('0x3'),_0xb81e('0x4'),'keyValue',_0xb81e('0x5')),'defaultValue':_0xb81e('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb81e('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xb81e('0x2'),'variable',_0xb81e('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xb81e('0x6')]},'nameField':{'type':Sequelize[_0xb81e('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb81e('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index c2d83d1..764d70c 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 _0x9134=['zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','Content-Range','reject','save','update','destroy','then','end','error','stack','name','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','VIRTUAL','includeAll','rows','catch','show','params','options','create','body','rimraf'];(function(_0x25df25,_0x2b638e){var _0x4b67fd=function(_0x293f39){while(--_0x293f39){_0x25df25['push'](_0x25df25['shift']());}};_0x4b67fd(++_0x2b638e);}(_0x9134,0x87));var _0x4913=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9134[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4913('0x0'));var zipdir=require(_0x4913('0x1'));var jsonpatch=require(_0x4913('0x2'));var rp=require(_0x4913('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4913('0x4'));var util=require(_0x4913('0x5'));var path=require(_0x4913('0x6'));var sox=require(_0x4913('0x7'));var csv=require(_0x4913('0x8'));var ejs=require(_0x4913('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4913('0xa'));var squel=require(_0x4913('0xb'));var crypto=require(_0x4913('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4913('0xd'));var toCsv=require(_0x4913('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4913('0xe'));var authService=require(_0x4913('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4913('0x10'));var hardwareService=require(_0x4913('0x11'));var logger=require(_0x4913('0x12'))(_0x4913('0x13'));var utils=require(_0x4913('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4913('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23b04f,_0x5ada12){_0x5ada12=_0x5ada12||0xcc;return function(_0x2394e7){if(_0x2394e7){return _0x23b04f[_0x4913('0x16')](_0x5ada12);}return _0x23b04f[_0x4913('0x17')](_0x5ada12)['end']();};}function respondWithResult(_0x3c8dc1,_0x34cc89){_0x34cc89=_0x34cc89||0xc8;return function(_0x525990){if(_0x525990){return _0x3c8dc1['status'](_0x34cc89)[_0x4913('0x18')](_0x525990);}};}function respondWithFilteredResult(_0xa6bd33,_0x270802){return function(_0x41b53c){if(_0x41b53c){var _0x579144=typeof _0x270802[_0x4913('0x19')]===_0x4913('0x1a')&&typeof _0x270802['limit']===_0x4913('0x1a');var _0x504efe=_0x41b53c[_0x4913('0x1b')];var _0x398f2f=_0x579144?0x0:_0x270802['offset'];var _0x366045=_0x579144?_0x41b53c['count']:_0x270802[_0x4913('0x19')]+_0x270802[_0x4913('0x1c')];var _0x3c22de;if(_0x366045>=_0x504efe){_0x366045=_0x504efe;_0x3c22de=0xc8;}else{_0x3c22de=0xce;}_0xa6bd33['status'](_0x3c22de);return _0xa6bd33['set'](_0x4913('0x1d'),_0x398f2f+'-'+_0x366045+'/'+_0x504efe)['json'](_0x41b53c);}return null;};}function patchUpdates(_0xcb1c7a){return function(_0x195f17){try{jsonpatch['apply'](_0x195f17,_0xcb1c7a,!![]);}catch(_0x15935b){return BPromise[_0x4913('0x1e')](_0x15935b);}return _0x195f17[_0x4913('0x1f')]();};}function saveUpdates(_0x12cd8a,_0x2611b8){return function(_0x3c099e){if(_0x3c099e){return _0x3c099e[_0x4913('0x20')](_0x12cd8a)['then'](function(_0x262cab){return _0x262cab;});}return null;};}function removeEntity(_0x53cf21,_0x3d450f){return function(_0x3ff8de){if(_0x3ff8de){return _0x3ff8de[_0x4913('0x21')]()[_0x4913('0x22')](function(){_0x53cf21[_0x4913('0x17')](0xcc)[_0x4913('0x23')]();});}};}function handleEntityNotFound(_0x8f40a9,_0x4139a1){return function(_0x203ba7){if(!_0x203ba7){_0x8f40a9[_0x4913('0x16')](0x194);}return _0x203ba7;};}function handleError(_0x3bb9cd,_0x38a4a2){_0x38a4a2=_0x38a4a2||0x1f4;return function(_0x5afb75){logger[_0x4913('0x24')](_0x5afb75[_0x4913('0x25')]);if(_0x5afb75['name']){delete _0x5afb75[_0x4913('0x26')];}_0x3bb9cd[_0x4913('0x17')](_0x38a4a2)['send'](_0x5afb75);};}exports['index']=function(_0x115f54,_0x1dc1da){var _0x2f74c4={},_0x4c68bf={},_0x2ff818={'count':0x0,'rows':[]};var _0x3c1798=_[_0x4913('0x27')](db[_0x4913('0x28')][_0x4913('0x29')],function(_0x3ba6ea){return{'name':_0x3ba6ea[_0x4913('0x2a')],'type':_0x3ba6ea[_0x4913('0x2b')][_0x4913('0x2c')]};});_0x4c68bf[_0x4913('0x2d')]=_[_0x4913('0x27')](_0x3c1798,_0x4913('0x26'));_0x4c68bf[_0x4913('0x2e')]=_[_0x4913('0x2f')](_0x115f54['query']);_0x4c68bf[_0x4913('0x30')]=_['intersection'](_0x4c68bf['model'],_0x4c68bf[_0x4913('0x2e')]);_0x2f74c4[_0x4913('0x31')]=_[_0x4913('0x32')](_0x4c68bf[_0x4913('0x2d')],qs[_0x4913('0x33')](_0x115f54[_0x4913('0x2e')][_0x4913('0x33')]));_0x2f74c4[_0x4913('0x31')]=_0x2f74c4[_0x4913('0x31')][_0x4913('0x34')]?_0x2f74c4['attributes']:_0x4c68bf[_0x4913('0x2d')];if(!_0x115f54['query'][_0x4913('0x35')](_0x4913('0x36'))){_0x2f74c4['limit']=qs[_0x4913('0x1c')](_0x115f54[_0x4913('0x2e')][_0x4913('0x1c')]);_0x2f74c4[_0x4913('0x19')]=qs['offset'](_0x115f54[_0x4913('0x2e')][_0x4913('0x19')]);}_0x2f74c4['order']=qs[_0x4913('0x37')](_0x115f54['query'][_0x4913('0x37')]);_0x2f74c4['where']=qs['filters'](_['pick'](_0x115f54[_0x4913('0x2e')],_0x4c68bf[_0x4913('0x30')]),_0x3c1798);if(_0x115f54['query'][_0x4913('0x38')]){_0x2f74c4['where']=_[_0x4913('0x39')](_0x2f74c4[_0x4913('0x3a')],{'$or':_[_0x4913('0x27')](_0x3c1798,function(_0x281db4){if(_0x281db4[_0x4913('0x2b')]!==_0x4913('0x3b')){var _0x166b23={};_0x166b23[_0x281db4[_0x4913('0x26')]]={'$like':'%'+_0x115f54[_0x4913('0x2e')][_0x4913('0x38')]+'%'};return _0x166b23;}})});}_0x2f74c4=_[_0x4913('0x39')]({},_0x2f74c4,_0x115f54['options']);var _0x10bcc1={'where':_0x2f74c4[_0x4913('0x3a')]};return db['DeskField'][_0x4913('0x1b')](_0x10bcc1)['then'](function(_0x90c348){_0x2ff818[_0x4913('0x1b')]=_0x90c348;if(_0x115f54['query'][_0x4913('0x3c')]){_0x2f74c4['include']=[{'all':!![]}];}return db[_0x4913('0x28')]['findAll'](_0x2f74c4);})[_0x4913('0x22')](function(_0x51c6c3){_0x2ff818[_0x4913('0x3d')]=_0x51c6c3;return _0x2ff818;})['then'](respondWithFilteredResult(_0x1dc1da,_0x2f74c4))[_0x4913('0x3e')](handleError(_0x1dc1da,null));};exports[_0x4913('0x3f')]=function(_0xa5a5f8,_0x69a188){var _0x354bfa={'raw':!![],'where':{'id':_0xa5a5f8[_0x4913('0x40')]['id']}},_0x4d6536={};_0x4d6536[_0x4913('0x2d')]=_[_0x4913('0x2f')](db[_0x4913('0x28')]['rawAttributes']);_0x4d6536[_0x4913('0x2e')]=_[_0x4913('0x2f')](_0xa5a5f8[_0x4913('0x2e')]);_0x4d6536[_0x4913('0x30')]=_[_0x4913('0x32')](_0x4d6536['model'],_0x4d6536[_0x4913('0x2e')]);_0x354bfa[_0x4913('0x31')]=_[_0x4913('0x32')](_0x4d6536['model'],qs[_0x4913('0x33')](_0xa5a5f8[_0x4913('0x2e')][_0x4913('0x33')]));_0x354bfa[_0x4913('0x31')]=_0x354bfa[_0x4913('0x31')][_0x4913('0x34')]?_0x354bfa[_0x4913('0x31')]:_0x4d6536[_0x4913('0x2d')];if(_0xa5a5f8[_0x4913('0x2e')]['includeAll']){_0x354bfa['include']=[{'all':!![]}];}_0x354bfa=_['merge']({},_0x354bfa,_0xa5a5f8[_0x4913('0x41')]);return db[_0x4913('0x28')]['find'](_0x354bfa)[_0x4913('0x22')](handleEntityNotFound(_0x69a188,null))['then'](respondWithResult(_0x69a188,null))['catch'](handleError(_0x69a188,null));};exports[_0x4913('0x42')]=function(_0x3e9186,_0x38e1e8){return db[_0x4913('0x28')][_0x4913('0x42')](_0x3e9186[_0x4913('0x43')],{})[_0x4913('0x22')](respondWithResult(_0x38e1e8,0xc9))[_0x4913('0x3e')](handleError(_0x38e1e8,null));};exports[_0x4913('0x20')]=function(_0x82d456,_0x23c32d){if(_0x82d456[_0x4913('0x43')]['id']){delete _0x82d456[_0x4913('0x43')]['id'];}return db[_0x4913('0x28')]['find']({'where':{'id':_0x82d456['params']['id']}})[_0x4913('0x22')](handleEntityNotFound(_0x23c32d,null))[_0x4913('0x22')](saveUpdates(_0x82d456['body'],null))['then'](respondWithResult(_0x23c32d,null))[_0x4913('0x3e')](handleError(_0x23c32d,null));};exports[_0x4913('0x21')]=function(_0x2793ec,_0x261eb6){return db[_0x4913('0x28')]['find']({'where':{'id':_0x2793ec[_0x4913('0x40')]['id']}})[_0x4913('0x22')](handleEntityNotFound(_0x261eb6,null))[_0x4913('0x22')](removeEntity(_0x261eb6,null))['catch'](handleError(_0x261eb6,null));}; \ No newline at end of file +var _0x3e26=['filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','options','includeAll','rows','catch','show','params','include','create','update','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','then','stack','name','index','map','DeskField','fieldName','key','query','keys'];(function(_0x4f426d,_0x1fea33){var _0x2a6263=function(_0x18b9ae){while(--_0x18b9ae){_0x4f426d['push'](_0x4f426d['shift']());}};_0x2a6263(++_0x1fea33);}(_0x3e26,0xed));var _0x63e2=function(_0x1734a8,_0x24987e){_0x1734a8=_0x1734a8-0x0;var _0x3ab0d1=_0x3e26[_0x1734a8];return _0x3ab0d1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x63e2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x63e2('0x1'));var rp=require(_0x63e2('0x2'));var moment=require(_0x63e2('0x3'));var BPromise=require(_0x63e2('0x4'));var Mustache=require(_0x63e2('0x5'));var util=require(_0x63e2('0x6'));var path=require(_0x63e2('0x7'));var sox=require(_0x63e2('0x8'));var csv=require(_0x63e2('0x9'));var ejs=require(_0x63e2('0xa'));var fs=require('fs');var fs_extra=require(_0x63e2('0xb'));var _=require(_0x63e2('0xc'));var squel=require(_0x63e2('0xd'));var crypto=require('crypto');var jsforce=require(_0x63e2('0xe'));var deskjs=require(_0x63e2('0xf'));var toCsv=require(_0x63e2('0x9'));var querystring=require(_0x63e2('0x10'));var Papa=require(_0x63e2('0x11'));var Redis=require('ioredis');var authService=require(_0x63e2('0x12'));var qs=require(_0x63e2('0x13'));var as=require(_0x63e2('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x63e2('0x15'))(_0x63e2('0x16'));var utils=require('../../config/utils');var config=require(_0x63e2('0x17'));var licenseUtil=require(_0x63e2('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c2fc0,_0x42f74f){_0x42f74f=_0x42f74f||0xcc;return function(_0x37a805){if(_0x37a805){return _0x3c2fc0[_0x63e2('0x19')](_0x42f74f);}return _0x3c2fc0['status'](_0x42f74f)[_0x63e2('0x1a')]();};}function respondWithResult(_0x13e7c4,_0x3b4e81){_0x3b4e81=_0x3b4e81||0xc8;return function(_0x313298){if(_0x313298){return _0x13e7c4['status'](_0x3b4e81)[_0x63e2('0x1b')](_0x313298);}};}function respondWithFilteredResult(_0x3b1ec5,_0x44a6c6){return function(_0x4e0a86){if(_0x4e0a86){var _0x21533a=typeof _0x44a6c6[_0x63e2('0x1c')]===_0x63e2('0x1d')&&typeof _0x44a6c6[_0x63e2('0x1e')]==='undefined';var _0x4eea95=_0x4e0a86[_0x63e2('0x1f')];var _0x353227=_0x21533a?0x0:_0x44a6c6[_0x63e2('0x1c')];var _0x496c4d=_0x21533a?_0x4e0a86[_0x63e2('0x1f')]:_0x44a6c6[_0x63e2('0x1c')]+_0x44a6c6[_0x63e2('0x1e')];var _0x2889c2;if(_0x496c4d>=_0x4eea95){_0x496c4d=_0x4eea95;_0x2889c2=0xc8;}else{_0x2889c2=0xce;}_0x3b1ec5[_0x63e2('0x20')](_0x2889c2);return _0x3b1ec5[_0x63e2('0x21')](_0x63e2('0x22'),_0x353227+'-'+_0x496c4d+'/'+_0x4eea95)[_0x63e2('0x1b')](_0x4e0a86);}return null;};}function patchUpdates(_0x11623b){return function(_0x4a4a45){try{jsonpatch[_0x63e2('0x23')](_0x4a4a45,_0x11623b,!![]);}catch(_0x433884){return BPromise['reject'](_0x433884);}return _0x4a4a45[_0x63e2('0x24')]();};}function saveUpdates(_0x5d3e0,_0x4d80aa){return function(_0x4e774d){if(_0x4e774d){return _0x4e774d['update'](_0x5d3e0)[_0x63e2('0x25')](function(_0x45ea41){return _0x45ea41;});}return null;};}function removeEntity(_0x30cab3,_0x2a473e){return function(_0x36ead9){if(_0x36ead9){return _0x36ead9['destroy']()['then'](function(){_0x30cab3['status'](0xcc)[_0x63e2('0x1a')]();});}};}function handleEntityNotFound(_0x1373bb,_0x1baa56){return function(_0x5da753){if(!_0x5da753){_0x1373bb[_0x63e2('0x19')](0x194);}return _0x5da753;};}function handleError(_0x1fe923,_0x5ec82f){_0x5ec82f=_0x5ec82f||0x1f4;return function(_0x411208){logger['error'](_0x411208[_0x63e2('0x26')]);if(_0x411208[_0x63e2('0x27')]){delete _0x411208[_0x63e2('0x27')];}_0x1fe923[_0x63e2('0x20')](_0x5ec82f)['send'](_0x411208);};}exports[_0x63e2('0x28')]=function(_0x5878dc,_0x4d1150){var _0x164298={},_0x2dd96f={},_0x227678={'count':0x0,'rows':[]};var _0x445d26=_[_0x63e2('0x29')](db[_0x63e2('0x2a')]['rawAttributes'],function(_0x3b23c7){return{'name':_0x3b23c7[_0x63e2('0x2b')],'type':_0x3b23c7['type'][_0x63e2('0x2c')]};});_0x2dd96f['model']=_[_0x63e2('0x29')](_0x445d26,_0x63e2('0x27'));_0x2dd96f[_0x63e2('0x2d')]=_[_0x63e2('0x2e')](_0x5878dc[_0x63e2('0x2d')]);_0x2dd96f[_0x63e2('0x2f')]=_['intersection'](_0x2dd96f[_0x63e2('0x30')],_0x2dd96f[_0x63e2('0x2d')]);_0x164298[_0x63e2('0x31')]=_[_0x63e2('0x32')](_0x2dd96f['model'],qs['fields'](_0x5878dc[_0x63e2('0x2d')][_0x63e2('0x33')]));_0x164298['attributes']=_0x164298[_0x63e2('0x31')][_0x63e2('0x34')]?_0x164298[_0x63e2('0x31')]:_0x2dd96f[_0x63e2('0x30')];if(!_0x5878dc[_0x63e2('0x2d')][_0x63e2('0x35')](_0x63e2('0x36'))){_0x164298[_0x63e2('0x1e')]=qs[_0x63e2('0x1e')](_0x5878dc[_0x63e2('0x2d')]['limit']);_0x164298[_0x63e2('0x1c')]=qs[_0x63e2('0x1c')](_0x5878dc[_0x63e2('0x2d')][_0x63e2('0x1c')]);}_0x164298[_0x63e2('0x37')]=qs[_0x63e2('0x38')](_0x5878dc[_0x63e2('0x2d')][_0x63e2('0x38')]);_0x164298[_0x63e2('0x39')]=qs['filters'](_['pick'](_0x5878dc[_0x63e2('0x2d')],_0x2dd96f['filters']),_0x445d26);if(_0x5878dc[_0x63e2('0x2d')][_0x63e2('0x3a')]){_0x164298[_0x63e2('0x39')]=_[_0x63e2('0x3b')](_0x164298[_0x63e2('0x39')],{'$or':_['map'](_0x445d26,function(_0x58a803){if(_0x58a803[_0x63e2('0x3c')]!=='VIRTUAL'){var _0x2aa1a3={};_0x2aa1a3[_0x58a803[_0x63e2('0x27')]]={'$like':'%'+_0x5878dc[_0x63e2('0x2d')][_0x63e2('0x3a')]+'%'};return _0x2aa1a3;}})});}_0x164298=_['merge']({},_0x164298,_0x5878dc[_0x63e2('0x3d')]);var _0x38191e={'where':_0x164298['where']};return db[_0x63e2('0x2a')][_0x63e2('0x1f')](_0x38191e)['then'](function(_0x7d4d6e){_0x227678['count']=_0x7d4d6e;if(_0x5878dc[_0x63e2('0x2d')][_0x63e2('0x3e')]){_0x164298['include']=[{'all':!![]}];}return db[_0x63e2('0x2a')]['findAll'](_0x164298);})[_0x63e2('0x25')](function(_0x5bd5af){_0x227678[_0x63e2('0x3f')]=_0x5bd5af;return _0x227678;})[_0x63e2('0x25')](respondWithFilteredResult(_0x4d1150,_0x164298))[_0x63e2('0x40')](handleError(_0x4d1150,null));};exports[_0x63e2('0x41')]=function(_0x386977,_0x25e18c){var _0x4a3d24={'raw':!![],'where':{'id':_0x386977[_0x63e2('0x42')]['id']}},_0x4f7afc={};_0x4f7afc['model']=_['keys'](db['DeskField']['rawAttributes']);_0x4f7afc[_0x63e2('0x2d')]=_[_0x63e2('0x2e')](_0x386977[_0x63e2('0x2d')]);_0x4f7afc[_0x63e2('0x2f')]=_[_0x63e2('0x32')](_0x4f7afc['model'],_0x4f7afc[_0x63e2('0x2d')]);_0x4a3d24['attributes']=_[_0x63e2('0x32')](_0x4f7afc['model'],qs[_0x63e2('0x33')](_0x386977[_0x63e2('0x2d')]['fields']));_0x4a3d24[_0x63e2('0x31')]=_0x4a3d24[_0x63e2('0x31')][_0x63e2('0x34')]?_0x4a3d24['attributes']:_0x4f7afc[_0x63e2('0x30')];if(_0x386977[_0x63e2('0x2d')][_0x63e2('0x3e')]){_0x4a3d24[_0x63e2('0x43')]=[{'all':!![]}];}_0x4a3d24=_['merge']({},_0x4a3d24,_0x386977['options']);return db[_0x63e2('0x2a')]['find'](_0x4a3d24)['then'](handleEntityNotFound(_0x25e18c,null))[_0x63e2('0x25')](respondWithResult(_0x25e18c,null))[_0x63e2('0x40')](handleError(_0x25e18c,null));};exports['create']=function(_0x1e16e2,_0x305a75){return db[_0x63e2('0x2a')][_0x63e2('0x44')](_0x1e16e2['body'],{})[_0x63e2('0x25')](respondWithResult(_0x305a75,0xc9))['catch'](handleError(_0x305a75,null));};exports[_0x63e2('0x45')]=function(_0x50df69,_0x44c8ff){if(_0x50df69['body']['id']){delete _0x50df69[_0x63e2('0x46')]['id'];}return db[_0x63e2('0x2a')]['find']({'where':{'id':_0x50df69['params']['id']}})['then'](handleEntityNotFound(_0x44c8ff,null))[_0x63e2('0x25')](saveUpdates(_0x50df69[_0x63e2('0x46')],null))['then'](respondWithResult(_0x44c8ff,null))[_0x63e2('0x40')](handleError(_0x44c8ff,null));};exports['destroy']=function(_0x5e4896,_0x7e827d){return db[_0x63e2('0x2a')]['find']({'where':{'id':_0x5e4896[_0x63e2('0x42')]['id']}})[_0x63e2('0x25')](handleEntityNotFound(_0x7e827d,null))['then'](removeEntity(_0x7e827d,null))[_0x63e2('0x40')](handleError(_0x7e827d,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 9b31bd4..78c2e46 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 _0x1de1=['request-promise','path','./intDeskField.attributes','exports','int_desk_fields','idField','FieldId','lodash','util','../../config/logger','api','bluebird'];(function(_0x49c28c,_0x2a88b0){var _0x2341b1=function(_0x3063f8){while(--_0x3063f8){_0x49c28c['push'](_0x49c28c['shift']());}};_0x2341b1(++_0x2a88b0);}(_0x1de1,0x163));var _0x11de=function(_0x1d1455,_0x32f243){_0x1d1455=_0x1d1455-0x0;var _0x3c551f=_0x1de1[_0x1d1455];return _0x3c551f;};'use strict';var _=require(_0x11de('0x0'));var util=require(_0x11de('0x1'));var logger=require(_0x11de('0x2'))(_0x11de('0x3'));var moment=require('moment');var BPromise=require(_0x11de('0x4'));var rp=require(_0x11de('0x5'));var fs=require('fs');var path=require(_0x11de('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x11de('0x7'));module[_0x11de('0x8')]=function(_0x7aec23,_0xd2c86b){return _0x7aec23['define']('DeskField',attributes,{'tableName':_0x11de('0x9'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x11de('0xa'),_0x11de('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0717=['idField','FieldId','moment','request-promise','path','exports'];(function(_0x1499be,_0xd806){var _0x185b39=function(_0x45ef32){while(--_0x45ef32){_0x1499be['push'](_0x1499be['shift']());}};_0x185b39(++_0xd806);}(_0x0717,0xa4));var _0x7071=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x0717[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x7071('0x0'));var BPromise=require('bluebird');var rp=require(_0x7071('0x1'));var fs=require('fs');var path=require(_0x7071('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module[_0x7071('0x3')]=function(_0x431f82,_0x44433d){return _0x431f82['define']('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x7071('0x4'),_0x7071('0x5')],'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 92b755e..880030c 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 _0x710d=['then','info','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskField,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x4c52ff,_0xe7a7e1){var _0x4dbaa5=function(_0x5cfa0f){while(--_0x5cfa0f){_0x4c52ff['push'](_0x4c52ff['shift']());}};_0x4dbaa5(++_0xe7a7e1);}(_0x710d,0xa1));var _0xd710=function(_0x5b3950,_0x4e5556){_0x5b3950=_0x5b3950-0x0;var _0x41e436=_0x710d[_0x5b3950];return _0x41e436;};'use strict';var _=require(_0xd710('0x0'));var util=require(_0xd710('0x1'));var moment=require(_0xd710('0x2'));var BPromise=require(_0xd710('0x3'));var rs=require(_0xd710('0x4'));var fs=require('fs');var Redis=require(_0xd710('0x5'));var db=require(_0xd710('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd710('0x7'))(_0xd710('0x8'));var config=require(_0xd710('0x9'));var jayson=require(_0xd710('0xa'));var client=jayson[_0xd710('0xb')][_0xd710('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x51fe19,_0x56a007,_0x5cb296){return new BPromise(function(_0x52ba25,_0x5b42d0){return client[_0xd710('0xd')](_0x51fe19,_0x5cb296)[_0xd710('0xe')](function(_0x4b5a99){logger[_0xd710('0xf')]('DeskField,\x20%s,\x20%s',_0x56a007,_0xd710('0x10'));logger[_0xd710('0x11')](_0xd710('0x12'),_0x56a007,_0xd710('0x10'),JSON[_0xd710('0x13')](_0x4b5a99));if(_0x4b5a99[_0xd710('0x14')]){if(_0x4b5a99['error'][_0xd710('0x15')]===0x1f4){logger[_0xd710('0x14')](_0xd710('0x16'),_0x56a007,_0x4b5a99[_0xd710('0x14')][_0xd710('0x17')]);return _0x5b42d0(_0x4b5a99['error']['message']);}logger[_0xd710('0x14')]('DeskField,\x20%s,\x20%s',_0x56a007,_0x4b5a99[_0xd710('0x14')][_0xd710('0x17')]);return _0x52ba25(_0x4b5a99[_0xd710('0x14')][_0xd710('0x17')]);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x56a007,_0xd710('0x10'));_0x52ba25(_0x4b5a99[_0xd710('0x18')]['message']);}})['catch'](function(_0xad20e5){logger['error'](_0xd710('0x16'),_0x56a007,_0xad20e5);_0x5b42d0(_0xad20e5);});});} \ No newline at end of file +var _0x793b=['error','code','DeskField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x8e9386,_0x3cc60f){var _0x4abf26=function(_0x59de5a){while(--_0x59de5a){_0x8e9386['push'](_0x8e9386['shift']());}};_0x4abf26(++_0x3cc60f);}(_0x793b,0x1b6));var _0xb793=function(_0x4a0a5e,_0x5f478e){_0x4a0a5e=_0x4a0a5e-0x0;var _0x288f66=_0x793b[_0x4a0a5e];return _0x288f66;};'use strict';var _=require(_0xb793('0x0'));var util=require(_0xb793('0x1'));var moment=require(_0xb793('0x2'));var BPromise=require(_0xb793('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb793('0x4'));var db=require(_0xb793('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb793('0x6'))(_0xb793('0x7'));var config=require(_0xb793('0x8'));var jayson=require(_0xb793('0x9'));var client=jayson[_0xb793('0xa')][_0xb793('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16094c,_0xfad508,_0x204c35){return new BPromise(function(_0x5d1b96,_0x610374){return client['request'](_0x16094c,_0x204c35)[_0xb793('0xc')](function(_0x4e4076){logger[_0xb793('0xd')]('DeskField,\x20%s,\x20%s',_0xfad508,_0xb793('0xe'));logger[_0xb793('0xf')](_0xb793('0x10'),_0xfad508,_0xb793('0xe'),JSON[_0xb793('0x11')](_0x4e4076));if(_0x4e4076['error']){if(_0x4e4076[_0xb793('0x12')][_0xb793('0x13')]===0x1f4){logger['error'](_0xb793('0x14'),_0xfad508,_0x4e4076[_0xb793('0x12')][_0xb793('0x15')]);return _0x610374(_0x4e4076['error'][_0xb793('0x15')]);}logger[_0xb793('0x12')](_0xb793('0x14'),_0xfad508,_0x4e4076[_0xb793('0x12')]['message']);return _0x5d1b96(_0x4e4076[_0xb793('0x12')][_0xb793('0x15')]);}else{logger[_0xb793('0xd')]('DeskField,\x20%s,\x20%s',_0xfad508,'request\x20sent');_0x5d1b96(_0x4e4076[_0xb793('0x16')][_0xb793('0x15')]);}})[_0xb793('0x17')](function(_0x5d647d){logger['error'](_0xb793('0x14'),_0xfad508,_0x5d647d);_0x610374(_0x5d647d);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index ad4bd78..9716278 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 _0x0bd8=['put','path','connect-timeout','express','fs-extra','../../config/environment','./intDynamics365Account.controller','isAuthenticated','get','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0bd8,0xde));var _0x80bd=function(_0x27d8bc,_0x19e010){_0x27d8bc=_0x27d8bc-0x0;var _0x4b04cb=_0x0bd8[_0x27d8bc];return _0x4b04cb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x80bd('0x0'));var timeout=require(_0x80bd('0x1'));var express=require(_0x80bd('0x2'));var router=express['Router']();var fs_extra=require(_0x80bd('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x80bd('0x4'));var controller=require(_0x80bd('0x5'));router['get']('/',auth[_0x80bd('0x6')](),controller['index']);router[_0x80bd('0x7')](_0x80bd('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x80bd('0x7')](_0x80bd('0x9'),auth[_0x80bd('0x6')](),controller[_0x80bd('0xa')]);router['get'](_0x80bd('0xb'),auth[_0x80bd('0x6')](),controller[_0x80bd('0xc')]);router['post']('/',auth[_0x80bd('0x6')](),controller[_0x80bd('0xd')]);router[_0x80bd('0xe')](_0x80bd('0x9'),auth[_0x80bd('0x6')](),controller[_0x80bd('0xf')]);router[_0x80bd('0x10')](_0x80bd('0x8'),auth[_0x80bd('0x6')](),controller['update']);router['delete'](_0x80bd('0x8'),auth[_0x80bd('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0c99=['Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x2f3b97,_0x407a02){var _0x27fe03=function(_0x53f287){while(--_0x53f287){_0x2f3b97['push'](_0x2f3b97['shift']());}};_0x27fe03(++_0x407a02);}(_0x0c99,0x1b1));var _0x90c9=function(_0x27beea,_0x3bc9f4){_0x27beea=_0x27beea-0x0;var _0x122645=_0x0c99[_0x27beea];return _0x122645;};'use strict';var multer=require(_0x90c9('0x0'));var util=require('util');var path=require(_0x90c9('0x1'));var timeout=require(_0x90c9('0x2'));var express=require(_0x90c9('0x3'));var router=express[_0x90c9('0x4')]();var fs_extra=require(_0x90c9('0x5'));var auth=require(_0x90c9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x90c9('0x7'));var controller=require(_0x90c9('0x8'));router[_0x90c9('0x9')]('/',auth[_0x90c9('0xa')](),controller['index']);router[_0x90c9('0x9')](_0x90c9('0xb'),auth[_0x90c9('0xa')](),controller[_0x90c9('0xc')]);router[_0x90c9('0x9')](_0x90c9('0xd'),auth[_0x90c9('0xa')](),controller[_0x90c9('0xe')]);router[_0x90c9('0x9')](_0x90c9('0xf'),auth['isAuthenticated'](),controller['getFields']);router[_0x90c9('0x10')]('/',auth[_0x90c9('0xa')](),controller['create']);router[_0x90c9('0x10')](_0x90c9('0xd'),auth['isAuthenticated'](),controller[_0x90c9('0x11')]);router[_0x90c9('0x12')](_0x90c9('0xb'),auth[_0x90c9('0xa')](),controller[_0x90c9('0x13')]);router[_0x90c9('0x14')](_0x90c9('0xb'),auth[_0x90c9('0xa')](),controller[_0x90c9('0x15')]);module[_0x90c9('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index d281a12..9c9bdde 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 _0xf9a8=['STRING','sequelize'];(function(_0x188d31,_0x576e87){var _0x30ed33=function(_0x15f9a5){while(--_0x15f9a5){_0x188d31['push'](_0x188d31['shift']());}};_0x30ed33(++_0x576e87);}(_0xf9a8,0x1bd));var _0x8f9a=function(_0x28b5d0,_0x252ed2){_0x28b5d0=_0x28b5d0-0x0;var _0x12e34b=_0xf9a8[_0x28b5d0];return _0x12e34b;};'use strict';var Sequelize=require(_0x8f9a('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x8f9a('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x8f9a('0x1')]},'tenantId':{'type':Sequelize[_0x8f9a('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x8f9a('0x1')]},'serverUrl':{'type':Sequelize[_0x8f9a('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x8f9a('0x1')]}}; \ No newline at end of file +var _0x2186=['exports','STRING'];(function(_0x4e90e3,_0x570a1d){var _0x295e5b=function(_0x754043){while(--_0x754043){_0x4e90e3['push'](_0x4e90e3['shift']());}};_0x295e5b(++_0x570a1d);}(_0x2186,0x18e));var _0x6218=function(_0x675f6d,_0x246e46){_0x675f6d=_0x675f6d-0x0;var _0x4cd7ee=_0x2186[_0x675f6d];return _0x4cd7ee;};'use strict';var Sequelize=require('sequelize');module[_0x6218('0x0')]={'name':{'type':Sequelize[_0x6218('0x1')]},'username':{'type':Sequelize[_0x6218('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x6218('0x1')]},'tenantId':{'type':Sequelize[_0x6218('0x1')]},'clientId':{'type':Sequelize[_0x6218('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x6218('0x1')],'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 7888702..143ae38 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 _0xe5b3=['subject','phonenumber','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdon','createdonbehalfbyname','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','importsequencenumber','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridtype','owneridyominame','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','versionnumber','concat','username','remoteUri','tenantId','clientId','clientSecret','slice','substring','lastIndexOf','POST','https://login.microsoftonline.com/','/oauth2/token','password','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','all','isNil','push','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','error','Wrong\x20credentials','EntityDefinitions(',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','UserLocalizedLabel','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','OptionSet','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','filters','filter','where','merge','options','count','includeAll','findAll','rows','catch','show','keys','find','create','body','params','getConfigurations','findOne','Dynamics365Configuration','pick','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','Dynamics365Field','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid'];(function(_0x9f47cf,_0x2da62c){var _0xe0f94c=function(_0x1a4f2e){while(--_0x1a4f2e){_0x9f47cf['push'](_0x9f47cf['shift']());}};_0xe0f94c(++_0x2da62c);}(_0xe5b3,0x133));var _0x3e5b=function(_0x3512c3,_0x346843){_0x3512c3=_0x3512c3-0x0;var _0x3b2842=_0xe5b3[_0x3512c3];return _0x3b2842;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];var integrations=require(_0x3e5b('0x19'));function respondWithStatusCode(_0x20b97b,_0x3c4eb1){_0x3c4eb1=_0x3c4eb1||0xcc;return function(_0x405e70){if(_0x405e70){return _0x20b97b['sendStatus'](_0x3c4eb1);}return _0x20b97b[_0x3e5b('0x1a')](_0x3c4eb1)['end']();};}function respondWithResult(_0x51a188,_0x4d71a3){_0x4d71a3=_0x4d71a3||0xc8;return function(_0x3754e3){if(_0x3754e3){return _0x51a188[_0x3e5b('0x1a')](_0x4d71a3)[_0x3e5b('0x1b')](_0x3754e3);}};}function respondWithFilteredResult(_0x4fb471,_0x1f81a7){return function(_0x59ddc0){if(_0x59ddc0){var _0x56a453=typeof _0x1f81a7[_0x3e5b('0x1c')]===_0x3e5b('0x1d')&&typeof _0x1f81a7['limit']===_0x3e5b('0x1d');var _0x143040=_0x59ddc0['count'];var _0xc56a2a=_0x56a453?0x0:_0x1f81a7[_0x3e5b('0x1c')];var _0x52696c=_0x56a453?_0x59ddc0['count']:_0x1f81a7[_0x3e5b('0x1c')]+_0x1f81a7[_0x3e5b('0x1e')];var _0x20b549;if(_0x52696c>=_0x143040){_0x52696c=_0x143040;_0x20b549=0xc8;}else{_0x20b549=0xce;}_0x4fb471[_0x3e5b('0x1a')](_0x20b549);return _0x4fb471[_0x3e5b('0x1f')](_0x3e5b('0x20'),_0xc56a2a+'-'+_0x52696c+'/'+_0x143040)[_0x3e5b('0x1b')](_0x59ddc0);}return null;};}function patchUpdates(_0x21fc32){return function(_0x36c988){try{jsonpatch[_0x3e5b('0x21')](_0x36c988,_0x21fc32,!![]);}catch(_0x2b977c){return BPromise[_0x3e5b('0x22')](_0x2b977c);}return _0x36c988[_0x3e5b('0x23')]();};}function saveUpdates(_0x402873,_0x5b46d4){return function(_0x433f9c){if(_0x433f9c){return _0x433f9c[_0x3e5b('0x24')](_0x402873)[_0x3e5b('0x25')](function(_0x150674){return _0x150674;});}return null;};}function removeEntity(_0x50039b,_0x1eb80f){return function(_0x5b33bb){if(_0x5b33bb){return _0x5b33bb[_0x3e5b('0x26')]()[_0x3e5b('0x25')](function(){_0x50039b['status'](0xcc)[_0x3e5b('0x27')]();});}};}function handleEntityNotFound(_0x2f6368,_0x42d7e9){return function(_0x3c8965){if(!_0x3c8965){_0x2f6368[_0x3e5b('0x28')](0x194);}return _0x3c8965;};}function handleError(_0x26c7f2,_0x160e87){_0x160e87=_0x160e87||0x1f4;return function(_0x2ddf57){logger['error'](_0x2ddf57[_0x3e5b('0x29')]);if(_0x2ddf57['name']){delete _0x2ddf57[_0x3e5b('0x2a')];}_0x26c7f2['status'](_0x160e87)[_0x3e5b('0x2b')](_0x2ddf57);};}exports[_0x3e5b('0x2c')]=function(_0x1296ec,_0x475b39){var _0x10d2ed={},_0x3cfaf6={},_0x307091={'count':0x0,'rows':[]};var _0x9c2123=_[_0x3e5b('0x2d')](db[_0x3e5b('0x2e')][_0x3e5b('0x2f')],function(_0x489221){return{'name':_0x489221[_0x3e5b('0x30')],'type':_0x489221[_0x3e5b('0x31')][_0x3e5b('0x32')]};});_0x3cfaf6[_0x3e5b('0x33')]=_[_0x3e5b('0x2d')](_0x9c2123,_0x3e5b('0x2a'));_0x3cfaf6[_0x3e5b('0x34')]=_['keys'](_0x1296ec[_0x3e5b('0x34')]);_0x3cfaf6['filters']=_['intersection'](_0x3cfaf6[_0x3e5b('0x33')],_0x3cfaf6[_0x3e5b('0x34')]);_0x10d2ed['attributes']=_[_0x3e5b('0x35')](_0x3cfaf6[_0x3e5b('0x33')],qs[_0x3e5b('0x36')](_0x1296ec[_0x3e5b('0x34')][_0x3e5b('0x36')]));_0x10d2ed[_0x3e5b('0x37')]=_0x10d2ed[_0x3e5b('0x37')][_0x3e5b('0x38')]?_0x10d2ed[_0x3e5b('0x37')]:_0x3cfaf6[_0x3e5b('0x33')];if(!_0x1296ec[_0x3e5b('0x34')][_0x3e5b('0x39')]('nolimit')){_0x10d2ed[_0x3e5b('0x1e')]=qs[_0x3e5b('0x1e')](_0x1296ec['query']['limit']);_0x10d2ed[_0x3e5b('0x1c')]=qs['offset'](_0x1296ec[_0x3e5b('0x34')][_0x3e5b('0x1c')]);}_0x10d2ed[_0x3e5b('0x3a')]=qs[_0x3e5b('0x3b')](_0x1296ec['query'][_0x3e5b('0x3b')]);_0x10d2ed['where']=qs[_0x3e5b('0x3c')](_['pick'](_0x1296ec['query'],_0x3cfaf6['filters']),_0x9c2123);if(_0x1296ec[_0x3e5b('0x34')][_0x3e5b('0x3d')]){_0x10d2ed[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x10d2ed[_0x3e5b('0x3e')],{'$or':_[_0x3e5b('0x2d')](_0x9c2123,function(_0x5466ac){if(_0x5466ac['type']!=='VIRTUAL'){var _0x565319={};_0x565319[_0x5466ac['name']]={'$like':'%'+_0x1296ec['query']['filter']+'%'};return _0x565319;}})});}_0x10d2ed=_[_0x3e5b('0x3f')]({},_0x10d2ed,_0x1296ec[_0x3e5b('0x40')]);var _0x13a48d={'where':_0x10d2ed[_0x3e5b('0x3e')]};return db[_0x3e5b('0x2e')][_0x3e5b('0x41')](_0x13a48d)[_0x3e5b('0x25')](function(_0x423be2){_0x307091[_0x3e5b('0x41')]=_0x423be2;if(_0x1296ec[_0x3e5b('0x34')][_0x3e5b('0x42')]){_0x10d2ed['include']=[{'all':!![]}];}return db[_0x3e5b('0x2e')][_0x3e5b('0x43')](_0x10d2ed);})[_0x3e5b('0x25')](function(_0xae974f){_0x307091[_0x3e5b('0x44')]=_0xae974f;return _0x307091;})[_0x3e5b('0x25')](respondWithFilteredResult(_0x475b39,_0x10d2ed))[_0x3e5b('0x45')](handleError(_0x475b39,null));};exports[_0x3e5b('0x46')]=function(_0x351d5d,_0x39da3f){var _0x13c8d5={'raw':![],'where':{'id':_0x351d5d['params']['id']}},_0x559056={};_0x559056['model']=_['keys'](db[_0x3e5b('0x2e')][_0x3e5b('0x2f')]);_0x559056[_0x3e5b('0x34')]=_[_0x3e5b('0x47')](_0x351d5d[_0x3e5b('0x34')]);_0x559056[_0x3e5b('0x3c')]=_[_0x3e5b('0x35')](_0x559056[_0x3e5b('0x33')],_0x559056[_0x3e5b('0x34')]);_0x13c8d5[_0x3e5b('0x37')]=_['intersection'](_0x559056[_0x3e5b('0x33')],qs[_0x3e5b('0x36')](_0x351d5d[_0x3e5b('0x34')][_0x3e5b('0x36')]));_0x13c8d5[_0x3e5b('0x37')]=_0x13c8d5['attributes']['length']?_0x13c8d5['attributes']:_0x559056[_0x3e5b('0x33')];if(_0x351d5d[_0x3e5b('0x34')][_0x3e5b('0x42')]){_0x13c8d5['include']=[{'all':!![]}];}_0x13c8d5=_['merge']({},_0x13c8d5,_0x351d5d[_0x3e5b('0x40')]);return db[_0x3e5b('0x2e')][_0x3e5b('0x48')](_0x13c8d5)['then'](handleEntityNotFound(_0x39da3f,null))['then'](respondWithResult(_0x39da3f,null))[_0x3e5b('0x45')](handleError(_0x39da3f,null));};exports['create']=function(_0x14b62a,_0x3379a1){return db[_0x3e5b('0x2e')][_0x3e5b('0x49')](_0x14b62a[_0x3e5b('0x4a')],{})[_0x3e5b('0x25')](respondWithResult(_0x3379a1,0xc9))[_0x3e5b('0x45')](handleError(_0x3379a1,null));};exports[_0x3e5b('0x24')]=function(_0x339852,_0x4a2ae1){if(_0x339852[_0x3e5b('0x4a')]['id']){delete _0x339852['body']['id'];}return db[_0x3e5b('0x2e')][_0x3e5b('0x48')]({'where':{'id':_0x339852[_0x3e5b('0x4b')]['id']}})[_0x3e5b('0x25')](handleEntityNotFound(_0x4a2ae1,null))[_0x3e5b('0x25')](saveUpdates(_0x339852[_0x3e5b('0x4a')],null))[_0x3e5b('0x25')](respondWithResult(_0x4a2ae1,null))[_0x3e5b('0x45')](handleError(_0x4a2ae1,null));};exports[_0x3e5b('0x26')]=function(_0x371655,_0xf6ca5b){return db[_0x3e5b('0x2e')][_0x3e5b('0x48')]({'where':{'id':_0x371655['params']['id']}})[_0x3e5b('0x25')](handleEntityNotFound(_0xf6ca5b,null))[_0x3e5b('0x25')](removeEntity(_0xf6ca5b,null))[_0x3e5b('0x45')](handleError(_0xf6ca5b,null));};exports[_0x3e5b('0x4c')]=function(_0x16c9f9,_0x2cecd3,_0x55b46c){var _0x131af1={};var _0x1cbdf7={};var _0x25b166;var _0x314d42;return db[_0x3e5b('0x2e')][_0x3e5b('0x4d')]({'where':{'id':_0x16c9f9[_0x3e5b('0x4b')]['id']}})[_0x3e5b('0x25')](handleEntityNotFound(_0x2cecd3,null))['then'](function(_0x1e6403){if(_0x1e6403){_0x25b166=_0x1e6403;_0x1cbdf7['model']=_['keys'](db[_0x3e5b('0x4e')]['rawAttributes']);_0x1cbdf7[_0x3e5b('0x34')]=_[_0x3e5b('0x47')](_0x16c9f9[_0x3e5b('0x34')]);_0x1cbdf7[_0x3e5b('0x3c')]=_['intersection'](_0x1cbdf7['model'],_0x1cbdf7['query']);_0x131af1['attributes']=_[_0x3e5b('0x35')](_0x1cbdf7[_0x3e5b('0x33')],qs[_0x3e5b('0x36')](_0x16c9f9[_0x3e5b('0x34')][_0x3e5b('0x36')]));_0x131af1['attributes']=_0x131af1['attributes'][_0x3e5b('0x38')]?_0x131af1[_0x3e5b('0x37')]:_0x1cbdf7[_0x3e5b('0x33')];_0x131af1[_0x3e5b('0x3a')]=qs[_0x3e5b('0x3b')](_0x16c9f9['query']['sort']);_0x131af1['where']=qs['filters'](_[_0x3e5b('0x4f')](_0x16c9f9[_0x3e5b('0x34')],_0x1cbdf7[_0x3e5b('0x3c')]));if(_0x16c9f9[_0x3e5b('0x34')][_0x3e5b('0x3d')]){_0x131af1[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x131af1[_0x3e5b('0x3e')],{'$or':_['map'](_0x131af1[_0x3e5b('0x37')],function(_0x29897b){var _0x30d4b9={};_0x30d4b9[_0x29897b]={'$like':'%'+_0x16c9f9[_0x3e5b('0x34')][_0x3e5b('0x3d')]+'%'};return _0x30d4b9;})});}_0x131af1=_['merge']({},_0x131af1,_0x16c9f9[_0x3e5b('0x40')]);return _0x25b166['getConfigurations'](_0x131af1);}})[_0x3e5b('0x25')](function(_0x1fd40c){if(_0x1fd40c){_0x314d42=_0x1fd40c['length'];if(!_0x16c9f9['query']['hasOwnProperty'](_0x3e5b('0x50'))){_0x131af1['limit']=qs[_0x3e5b('0x1e')](_0x16c9f9[_0x3e5b('0x34')][_0x3e5b('0x1e')]);_0x131af1[_0x3e5b('0x1c')]=qs[_0x3e5b('0x1c')](_0x16c9f9['query']['offset']);}return _0x25b166[_0x3e5b('0x4c')](_0x131af1);}})[_0x3e5b('0x25')](function(_0x3f7f71){if(_0x3f7f71){return _0x3f7f71?{'count':_0x314d42,'rows':_0x3f7f71}:null;}})['then'](respondWithResult(_0x2cecd3,null))[_0x3e5b('0x45')](handleError(_0x2cecd3,null));};exports[_0x3e5b('0x51')]=function(_0x32a42f,_0x1c9526,_0x206bec){if(_0x32a42f[_0x3e5b('0x4a')]['id']){delete _0x32a42f[_0x3e5b('0x4a')]['id'];}return db[_0x3e5b('0x2e')][_0x3e5b('0x4d')]({'where':{'id':_0x32a42f[_0x3e5b('0x4b')]['id']}})[_0x3e5b('0x25')](handleEntityNotFound(_0x1c9526,null))[_0x3e5b('0x25')](function(_0x33bbb8){if(_0x33bbb8){_0x32a42f[_0x3e5b('0x4a')][_0x3e5b('0x52')]=_0x33bbb8['id'];_0x32a42f[_0x3e5b('0x4a')][_0x3e5b('0x53')]=integrations[_0x3e5b('0x54')](_0x32a42f['body'][_0x3e5b('0x55')],_0x32a42f[_0x3e5b('0x4a')]['type']);_0x32a42f[_0x3e5b('0x4a')][_0x3e5b('0x56')]=integrations['getDescriptions'](_0x32a42f['body']['channel'],_0x32a42f[_0x3e5b('0x4a')][_0x3e5b('0x31')]);return db['Dynamics365Configuration'][_0x3e5b('0x49')](_0x32a42f[_0x3e5b('0x4a')],{'include':[{'model':db['Dynamics365Field'],'as':_0x3e5b('0x53')},{'model':db[_0x3e5b('0x57')],'as':_0x3e5b('0x56')}]});}return null;})[_0x3e5b('0x25')](respondWithResult(_0x1c9526,null))[_0x3e5b('0x45')](handleError(_0x1c9526,null));};exports[_0x3e5b('0x58')]=function(_0x5891fe,_0x410c7a,_0x3f2c6c){var _0x589498=_0x5891fe[_0x3e5b('0x34')][_0x3e5b('0x59')];var _0x2d5685=_0x589498===_0x3e5b('0x5a')?_0x3e5b('0x5b'):_0x3e5b('0x5c');var _0x12c93d='';var _0x4efdbe='';var _0x590f0c='';var _0x1dd82b='';var _0x3ee33c='';var _0x4dd417='';var _0x404621='';var _0x6e1c5='';var _0x35e3ef=[_0x3e5b('0x5d'),_0x3e5b('0x5e'),_0x3e5b('0x5f'),_0x3e5b('0x60'),'caseorigincode',_0x3e5b('0x61'),_0x3e5b('0x62'),'regardingobjectid','directioncode','phonecall_activity_parties'];var _0x8d164e=[_0x3e5b('0x63'),_0x3e5b('0x64'),_0x3e5b('0x65'),_0x3e5b('0x66'),_0x3e5b('0x67'),'contactidyominame',_0x3e5b('0x68'),_0x3e5b('0x69'),'createdbyexternalpartyname',_0x3e5b('0x6a'),'createdbyname','createdbyyominame',_0x3e5b('0x6b'),_0x3e5b('0x6c'),'createdonbehalfbyyominame',_0x3e5b('0x6d'),_0x3e5b('0x6e'),'customeridyominame',_0x3e5b('0x6f'),_0x3e5b('0x70'),_0x3e5b('0x71'),_0x3e5b('0x72'),_0x3e5b('0x73'),_0x3e5b('0x74'),'firstresponsebykpiidname','followupby',_0x3e5b('0x75'),'influencescore','kbarticleidname',_0x3e5b('0x76'),_0x3e5b('0x77'),_0x3e5b('0x78'),'modifiedbyexternalpartyyominame',_0x3e5b('0x79'),'modifiedbyyominame',_0x3e5b('0x7a'),'modifiedonbehalfbyname',_0x3e5b('0x7b'),_0x3e5b('0x7c'),_0x3e5b('0x7d'),_0x3e5b('0x7e'),'onholdtime',_0x3e5b('0x7f'),'owneridname',_0x3e5b('0x80'),_0x3e5b('0x81'),'parentcaseidname',_0x3e5b('0x82'),_0x3e5b('0x83'),_0x3e5b('0x84'),'productidname',_0x3e5b('0x85'),_0x3e5b('0x86'),_0x3e5b('0x87'),'responseby',_0x3e5b('0x88'),_0x3e5b('0x89'),'sentimentvalue',_0x3e5b('0x8a'),_0x3e5b('0x8b'),_0x3e5b('0x8c'),'statecode',_0x3e5b('0x8d'),_0x3e5b('0x8e'),_0x3e5b('0x8f'),_0x3e5b('0x90'),'transactioncurrencyidname',_0x3e5b('0x91'),'utcconversiontimezonecode',_0x3e5b('0x92')];var _0x51b530=_0x35e3ef[_0x3e5b('0x93')](_0x8d164e);return db[_0x3e5b('0x2e')]['findOne']({'where':{'id':_0x5891fe[_0x3e5b('0x4b')]['id']},'attributes':['id',_0x3e5b('0x94'),'password',_0x3e5b('0x95'),_0x3e5b('0x96'),_0x3e5b('0x97'),_0x3e5b('0x98')]})['then'](handleEntityNotFound(_0x410c7a,null))['then'](function(_0xff0183){if(_0xff0183){_0x6e1c5=_0xff0183[_0x3e5b('0x95')];var _0x1ffb60=_0x6e1c5[_0x3e5b('0x99')](-0x1);if(_0x1ffb60==='/'){_0x6e1c5=_0x6e1c5[_0x3e5b('0x9a')](0x0,_0x6e1c5[_0x3e5b('0x9b')](_0x1ffb60));}_0x404621=util['format']('%s/api/data/v9.0/',_0x6e1c5);var _0x19e93f={'method':_0x3e5b('0x9c'),'uri':_0x3e5b('0x9d')+_0xff0183[_0x3e5b('0x96')]+_0x3e5b('0x9e'),'form':{'client_id':_0xff0183[_0x3e5b('0x97')],'resource':_0x6e1c5,'username':_0xff0183[_0x3e5b('0x94')],'password':_0xff0183[_0x3e5b('0x9f')],'grant_type':'password','client_secret':_0xff0183['clientSecret']},'json':!![]};return rp(_0x19e93f);}})[_0x3e5b('0x25')](function(_0x4d36b6){_0x4dd417=_0x4d36b6[_0x3e5b('0xa0')];var _0x44300d={'method':_0x3e5b('0xa1'),'uri':encodeURI(_0x404621+_0x3e5b('0xa2')+_0x2d5685+'\x27'),'headers':{'Authorization':_0x3e5b('0xa3')+_0x4dd417,'If-None-Match':null,'OData-Version':_0x3e5b('0xa4')},'json':!![]};return rp(_0x44300d);})[_0x3e5b('0x25')](function(_0x350bd7){var _0x2b5d74=_0x350bd7[_0x3e5b('0xa5')][0x0];var _0x1299ac=_0x2b5d74[_0x3e5b('0xa6')];var _0x1fe6a1={'method':'GET','uri':_0x404621+'EntityDefinitions('+_0x1299ac+_0x3e5b('0xa7'),'headers':{'Authorization':_0x3e5b('0xa3')+_0x4dd417,'If-None-Match':null,'OData-Version':_0x3e5b('0xa4')},'json':!![]};return rp(_0x1fe6a1);})[_0x3e5b('0x25')](function(_0x49b46c){_0x12c93d=_0x49b46c;_0x4efdbe=_0x12c93d[_0x3e5b('0xa8')];_0x4efdbe=_['remove'](_0x4efdbe,function(_0x215c43){return!_0x51b530['includes'](_0x215c43[_0x3e5b('0xa9')]);});var _0x3f28cc=[];var _0x2c22ef=[];_0x4efdbe[_0x3e5b('0xaa')](function(_0x121c8f){if(_0x121c8f[_0x3e5b('0xab')]){var _0xd93aed=_0x121c8f[_0x3e5b('0xab')][_0x3e5b('0x9a')](_0x121c8f['@odata.type'][_0x3e5b('0x9b')]('.')+0x1);if(_0xd93aed===_0x3e5b('0xac')){_0x3f28cc['push'](getSelectList(_0x404621,_0x589498,_0x2c22ef,_0x12c93d[_0x3e5b('0xa6')],_0x121c8f[_0x3e5b('0xa6')],_0x4dd417));}}});return Promise[_0x3e5b('0xad')](_0x3f28cc);})[_0x3e5b('0x25')](function(_0x41de83){_0x590f0c=_0x41de83[0x0];var _0x2df067=[];var _0x441890=[];_0x4efdbe[_0x3e5b('0xaa')](function(_0x2ddd9b){if(!_[_0x3e5b('0xae')](_0x2ddd9b[_0x3e5b('0xab')])){var _0x144019=_0x2ddd9b['@odata.type'][_0x3e5b('0x9a')](_0x2ddd9b[_0x3e5b('0xab')]['lastIndexOf']('.')+0x1);if(_0x144019==='BooleanAttributeMetadata'){_0x2df067[_0x3e5b('0xaf')](getBooleanList(_0x404621,_0x589498,_0x441890,_0x12c93d[_0x3e5b('0xa6')],_0x2ddd9b[_0x3e5b('0xa6')],_0x4dd417));}}});return Promise[_0x3e5b('0xad')](_0x2df067);})[_0x3e5b('0x25')](function(_0x4c66b7){_0x1dd82b=_0x4c66b7[0x0];var _0xc78d12=[];var _0x41f7c8=[];_0x4efdbe['forEach'](function(_0x53913d){if(_0x53913d[_0x3e5b('0xab')]){var _0x1d92f0=_0x53913d['@odata.type']['substring'](_0x53913d[_0x3e5b('0xab')][_0x3e5b('0x9b')]('.')+0x1);if(_0x1d92f0==='StringAttributeMetadata'||_0x1d92f0===_0x3e5b('0xb0')||_0x1d92f0===_0x3e5b('0xb1')||_0x1d92f0===_0x3e5b('0xb2')||_0x1d92f0===_0x3e5b('0xb3')||_0x1d92f0===_0x3e5b('0xb4')||_0x1d92f0==='StatusAttributeMetadata'||_0x1d92f0==='EntityNameAttributeMetadata'||_0x1d92f0===_0x3e5b('0xb5')||_0x1d92f0===_0x3e5b('0xb6')){_0xc78d12[_0x3e5b('0xaf')](getInputList(_0x404621,_0x589498,_0x1d92f0,_0x41f7c8,_0x12c93d[_0x3e5b('0xa6')],_0x53913d[_0x3e5b('0xa6')],_0x4dd417));}}});return Promise[_0x3e5b('0xad')](_0xc78d12);})[_0x3e5b('0x25')](function(_0x2c93f4){_0x3ee33c=_0x2c93f4[0x0];var _0x37f34c=_0x590f0c[_0x3e5b('0x93')](_0x1dd82b)[_0x3e5b('0x93')](_0x3ee33c);var _0x8efc1b={'count':_0x37f34c[_0x3e5b('0x38')],'rows':_0x37f34c};return _0x8efc1b;})[_0x3e5b('0x25')](respondWithResult(_0x410c7a,null))[_0x3e5b('0x45')](function(_0x3ca1fb){var _0x34edb6=_0x5891fe[_0x3e5b('0x34')][_0x3e5b('0xb7')]?0x1f4:_0x3ca1fb[_0x3e5b('0xb8')]||0x1f4;logger[_0x3e5b('0xb9')](_0x3ca1fb[_0x3e5b('0x29')]);delete _0x3ca1fb[_0x3e5b('0x2a')];if(_0x34edb6===0x191){_0x34edb6=0x190;}_0x410c7a[_0x3e5b('0x1a')](_0x34edb6)[_0x3e5b('0x2b')](_0x5891fe['query']['test']?{'message':_0x3e5b('0xba'),'statusCode':_0x3ca1fb[_0x3e5b('0xb8')]}:_0x3ca1fb);});};function getSelectList(_0x2f4c8f,_0xc015eb,_0x5b33a1,_0x17a736,_0x494adc,_0x1f1062){var _0x3ffc0f={'method':_0x3e5b('0xa1'),'uri':_0x2f4c8f+_0x3e5b('0xbb')+_0x17a736+_0x3e5b('0xbc')+_0x494adc+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x3e5b('0xbd'),'headers':{'Authorization':_0x3e5b('0xa3')+_0x1f1062,'If-None-Match':null,'OData-Version':_0x3e5b('0xa4')},'json':!![]};return rp(_0x3ffc0f)[_0x3e5b('0x25')](function(_0xf51840){var _0x475b31=[];var _0x5db7b6=_0xf51840['OptionSet'][_0x3e5b('0xbe')];_0x5db7b6['forEach'](function(_0x54b166){_0x475b31[_0x3e5b('0xaf')]({'name':_0x54b166[_0x3e5b('0xbf')][_0x3e5b('0xc0')]['Label'],'value':String(_0x54b166['Value'])});});var _0x1968dd={'id':_0xc015eb+'_'+_0xf51840[_0x3e5b('0xa9')],'name':_0xf51840[_0x3e5b('0xc1')][_0x3e5b('0xc0')][_0x3e5b('0xbf')],'custom':![],'options':_0x475b31};_0x5b33a1[_0x3e5b('0xaf')](_0x1968dd);return _0x5b33a1;});}function getBooleanList(_0x4ef443,_0x4c6d02,_0x3c274b,_0x29a427,_0x38db0c,_0x1ac1ad){var _0x1d1b08={'method':_0x3e5b('0xa1'),'uri':_0x4ef443+_0x3e5b('0xbb')+_0x29a427+_0x3e5b('0xbc')+_0x38db0c+_0x3e5b('0xc2'),'headers':{'Authorization':_0x3e5b('0xa3')+_0x1ac1ad,'If-None-Match':null,'OData-Version':_0x3e5b('0xa4')},'json':!![]};return rp(_0x1d1b08)[_0x3e5b('0x25')](function(_0x283452){var _0x3585df=[];_0x3585df[_0x3e5b('0xaf')]({'name':_0x283452['OptionSet'][_0x3e5b('0xc3')][_0x3e5b('0xbf')][_0x3e5b('0xc0')][_0x3e5b('0xbf')],'value':_0x3e5b('0xc4')},{'name':_0x283452[_0x3e5b('0xc5')][_0x3e5b('0xc6')]['Label'][_0x3e5b('0xc0')][_0x3e5b('0xbf')],'value':_0x3e5b('0xc7')});var _0x3c72e1={'id':_0x4c6d02+'_'+_0x283452['LogicalName'],'name':_0x283452[_0x3e5b('0xc1')][_0x3e5b('0xc0')][_0x3e5b('0xbf')],'custom':![],'options':_0x3585df};_0x3c274b[_0x3e5b('0xaf')](_0x3c72e1);return _0x3c274b;});}function getInputList(_0xf8dba5,_0x1ce847,_0x325d92,_0x3acf47,_0x276caa,_0x5a988d,_0x163c14){var _0x157554={'method':'GET','uri':_0xf8dba5+_0x3e5b('0xbb')+_0x276caa+_0x3e5b('0xbc')+_0x5a988d+_0x3e5b('0xc8')+_0x325d92+_0x3e5b('0xc9'),'headers':{'Authorization':_0x3e5b('0xa3')+_0x163c14,'If-None-Match':null,'OData-Version':_0x3e5b('0xa4')},'json':!![]};return rp(_0x157554)[_0x3e5b('0x25')](function(_0x2fe546){var _0xc2aa59={'id':_0x1ce847+'_'+_0x2fe546['LogicalName'],'name':_0x2fe546['DisplayName'][_0x3e5b('0xc0')]?_0x2fe546[_0x3e5b('0xc1')][_0x3e5b('0xc0')]['Label']:_0x2fe546[_0x3e5b('0xa9')],'custom':![],'options':[]};_0x3acf47[_0x3e5b('0xaf')](_0xc2aa59);return _0x3acf47;});} \ No newline at end of file +var _0x6dd1=['modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','slaname','statuscode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','username','password','remoteUri','tenantId','clientSecret','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','clientId','access_token','GET','Bearer\x20','4.0','value','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','substring','all','isNil','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','error','send','test',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','UserLocalizedLabel','Label','Value','DisplayName','EntityDefinitions(','TrueOption','FalseOption','false','?$select=DisplayName,LogicalName','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','stack','name','index','map','rawAttributes','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','Dynamics365Account','includeAll','include','catch','show','keys','find','body','params','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','create','Dynamics365Field','ticketType','incident','Incident','title','description','ownerid','caseorigincode','subject','phonenumber','directioncode','phonecall_activity_parties','actualserviceunits','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyyominame','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','firstresponsebykpiidname','importsequencenumber','kbarticleidname','masteridname','modifiedbyyominame','modifiedonbehalfbyname'];(function(_0x23c58e,_0x1b6f60){var _0x319488=function(_0x195f06){while(--_0x195f06){_0x23c58e['push'](_0x23c58e['shift']());}};_0x319488(++_0x1b6f60);}(_0x6dd1,0x111));var _0x16dd=function(_0x32b169,_0x3a40ef){_0x32b169=_0x32b169-0x0;var _0x5cbea8=_0x6dd1[_0x32b169];return _0x5cbea8;};'use strict';var emlformat=require(_0x16dd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x16dd('0x1'));var jsonpatch=require(_0x16dd('0x2'));var rp=require('request-promise');var moment=require(_0x16dd('0x3'));var BPromise=require(_0x16dd('0x4'));var Mustache=require(_0x16dd('0x5'));var util=require(_0x16dd('0x6'));var path=require(_0x16dd('0x7'));var sox=require(_0x16dd('0x8'));var csv=require(_0x16dd('0x9'));var ejs=require(_0x16dd('0xa'));var fs=require('fs');var fs_extra=require(_0x16dd('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x16dd('0xc'));var toCsv=require(_0x16dd('0x9'));var querystring=require(_0x16dd('0xd'));var Papa=require(_0x16dd('0xe'));var Redis=require('ioredis');var authService=require(_0x16dd('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x16dd('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x16dd('0x11'));var utils=require(_0x16dd('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x16dd('0x13'));var db=require(_0x16dd('0x14'))['db'];var integrations=require(_0x16dd('0x15'));function respondWithStatusCode(_0x5e24c8,_0x204f9e){_0x204f9e=_0x204f9e||0xcc;return function(_0x3783fc){if(_0x3783fc){return _0x5e24c8[_0x16dd('0x16')](_0x204f9e);}return _0x5e24c8[_0x16dd('0x17')](_0x204f9e)[_0x16dd('0x18')]();};}function respondWithResult(_0x4d460c,_0x4f3646){_0x4f3646=_0x4f3646||0xc8;return function(_0xcfde1c){if(_0xcfde1c){return _0x4d460c['status'](_0x4f3646)[_0x16dd('0x19')](_0xcfde1c);}};}function respondWithFilteredResult(_0x167c44,_0x31a026){return function(_0x1719ba){if(_0x1719ba){var _0x3add51=typeof _0x31a026[_0x16dd('0x1a')]===_0x16dd('0x1b')&&typeof _0x31a026[_0x16dd('0x1c')]==='undefined';var _0x3d5bcb=_0x1719ba[_0x16dd('0x1d')];var _0x15b012=_0x3add51?0x0:_0x31a026[_0x16dd('0x1a')];var _0x3e9236=_0x3add51?_0x1719ba['count']:_0x31a026[_0x16dd('0x1a')]+_0x31a026[_0x16dd('0x1c')];var _0x3f36c0;if(_0x3e9236>=_0x3d5bcb){_0x3e9236=_0x3d5bcb;_0x3f36c0=0xc8;}else{_0x3f36c0=0xce;}_0x167c44[_0x16dd('0x17')](_0x3f36c0);return _0x167c44[_0x16dd('0x1e')](_0x16dd('0x1f'),_0x15b012+'-'+_0x3e9236+'/'+_0x3d5bcb)[_0x16dd('0x19')](_0x1719ba);}return null;};}function patchUpdates(_0x44464a){return function(_0x43a6ba){try{jsonpatch[_0x16dd('0x20')](_0x43a6ba,_0x44464a,!![]);}catch(_0x5e4468){return BPromise[_0x16dd('0x21')](_0x5e4468);}return _0x43a6ba[_0x16dd('0x22')]();};}function saveUpdates(_0x44f66b,_0x20a946){return function(_0x96ab00){if(_0x96ab00){return _0x96ab00['update'](_0x44f66b)['then'](function(_0x4445f8){return _0x4445f8;});}return null;};}function removeEntity(_0x239e59,_0x4d1f98){return function(_0x1276e6){if(_0x1276e6){return _0x1276e6[_0x16dd('0x23')]()[_0x16dd('0x24')](function(){_0x239e59['status'](0xcc)[_0x16dd('0x18')]();});}};}function handleEntityNotFound(_0x251be0,_0x33e57d){return function(_0x55b545){if(!_0x55b545){_0x251be0[_0x16dd('0x16')](0x194);}return _0x55b545;};}function handleError(_0x3625ec,_0x409b83){_0x409b83=_0x409b83||0x1f4;return function(_0x4a5dba){logger['error'](_0x4a5dba[_0x16dd('0x25')]);if(_0x4a5dba[_0x16dd('0x26')]){delete _0x4a5dba['name'];}_0x3625ec['status'](_0x409b83)['send'](_0x4a5dba);};}exports[_0x16dd('0x27')]=function(_0x20fc34,_0xf64a61){var _0x482cfb={},_0x455b1d={},_0xb5e868={'count':0x0,'rows':[]};var _0x33af6f=_[_0x16dd('0x28')](db['Dynamics365Account'][_0x16dd('0x29')],function(_0x2057e4){return{'name':_0x2057e4['fieldName'],'type':_0x2057e4[_0x16dd('0x2a')][_0x16dd('0x2b')]};});_0x455b1d['model']=_[_0x16dd('0x28')](_0x33af6f,'name');_0x455b1d[_0x16dd('0x2c')]=_['keys'](_0x20fc34[_0x16dd('0x2c')]);_0x455b1d[_0x16dd('0x2d')]=_[_0x16dd('0x2e')](_0x455b1d['model'],_0x455b1d[_0x16dd('0x2c')]);_0x482cfb[_0x16dd('0x2f')]=_['intersection'](_0x455b1d[_0x16dd('0x30')],qs[_0x16dd('0x31')](_0x20fc34[_0x16dd('0x2c')][_0x16dd('0x31')]));_0x482cfb['attributes']=_0x482cfb[_0x16dd('0x2f')][_0x16dd('0x32')]?_0x482cfb['attributes']:_0x455b1d[_0x16dd('0x30')];if(!_0x20fc34['query'][_0x16dd('0x33')](_0x16dd('0x34'))){_0x482cfb['limit']=qs['limit'](_0x20fc34[_0x16dd('0x2c')][_0x16dd('0x1c')]);_0x482cfb[_0x16dd('0x1a')]=qs[_0x16dd('0x1a')](_0x20fc34[_0x16dd('0x2c')][_0x16dd('0x1a')]);}_0x482cfb[_0x16dd('0x35')]=qs[_0x16dd('0x36')](_0x20fc34[_0x16dd('0x2c')]['sort']);_0x482cfb[_0x16dd('0x37')]=qs[_0x16dd('0x2d')](_[_0x16dd('0x38')](_0x20fc34['query'],_0x455b1d[_0x16dd('0x2d')]),_0x33af6f);if(_0x20fc34[_0x16dd('0x2c')][_0x16dd('0x39')]){_0x482cfb[_0x16dd('0x37')]=_['merge'](_0x482cfb['where'],{'$or':_['map'](_0x33af6f,function(_0x4c4788){if(_0x4c4788[_0x16dd('0x2a')]!=='VIRTUAL'){var _0x3cfe01={};_0x3cfe01[_0x4c4788['name']]={'$like':'%'+_0x20fc34[_0x16dd('0x2c')]['filter']+'%'};return _0x3cfe01;}})});}_0x482cfb=_[_0x16dd('0x3a')]({},_0x482cfb,_0x20fc34[_0x16dd('0x3b')]);var _0x2d92b5={'where':_0x482cfb[_0x16dd('0x37')]};return db[_0x16dd('0x3c')][_0x16dd('0x1d')](_0x2d92b5)['then'](function(_0x324fb9){_0xb5e868[_0x16dd('0x1d')]=_0x324fb9;if(_0x20fc34[_0x16dd('0x2c')][_0x16dd('0x3d')]){_0x482cfb[_0x16dd('0x3e')]=[{'all':!![]}];}return db[_0x16dd('0x3c')]['findAll'](_0x482cfb);})['then'](function(_0x1bdf5d){_0xb5e868['rows']=_0x1bdf5d;return _0xb5e868;})['then'](respondWithFilteredResult(_0xf64a61,_0x482cfb))[_0x16dd('0x3f')](handleError(_0xf64a61,null));};exports[_0x16dd('0x40')]=function(_0x1c0d79,_0x491bf0){var _0x24acb0={'raw':![],'where':{'id':_0x1c0d79['params']['id']}},_0x4c6e9e={};_0x4c6e9e[_0x16dd('0x30')]=_[_0x16dd('0x41')](db[_0x16dd('0x3c')][_0x16dd('0x29')]);_0x4c6e9e[_0x16dd('0x2c')]=_[_0x16dd('0x41')](_0x1c0d79[_0x16dd('0x2c')]);_0x4c6e9e[_0x16dd('0x2d')]=_[_0x16dd('0x2e')](_0x4c6e9e[_0x16dd('0x30')],_0x4c6e9e[_0x16dd('0x2c')]);_0x24acb0[_0x16dd('0x2f')]=_[_0x16dd('0x2e')](_0x4c6e9e['model'],qs['fields'](_0x1c0d79['query'][_0x16dd('0x31')]));_0x24acb0[_0x16dd('0x2f')]=_0x24acb0[_0x16dd('0x2f')][_0x16dd('0x32')]?_0x24acb0['attributes']:_0x4c6e9e[_0x16dd('0x30')];if(_0x1c0d79[_0x16dd('0x2c')][_0x16dd('0x3d')]){_0x24acb0[_0x16dd('0x3e')]=[{'all':!![]}];}_0x24acb0=_[_0x16dd('0x3a')]({},_0x24acb0,_0x1c0d79['options']);return db[_0x16dd('0x3c')][_0x16dd('0x42')](_0x24acb0)[_0x16dd('0x24')](handleEntityNotFound(_0x491bf0,null))[_0x16dd('0x24')](respondWithResult(_0x491bf0,null))[_0x16dd('0x3f')](handleError(_0x491bf0,null));};exports['create']=function(_0x53258b,_0x2e9fab){return db['Dynamics365Account']['create'](_0x53258b[_0x16dd('0x43')],{})[_0x16dd('0x24')](respondWithResult(_0x2e9fab,0xc9))[_0x16dd('0x3f')](handleError(_0x2e9fab,null));};exports['update']=function(_0x10db7c,_0x3b89f6){if(_0x10db7c[_0x16dd('0x43')]['id']){delete _0x10db7c[_0x16dd('0x43')]['id'];}return db[_0x16dd('0x3c')][_0x16dd('0x42')]({'where':{'id':_0x10db7c[_0x16dd('0x44')]['id']}})[_0x16dd('0x24')](handleEntityNotFound(_0x3b89f6,null))[_0x16dd('0x24')](saveUpdates(_0x10db7c[_0x16dd('0x43')],null))[_0x16dd('0x24')](respondWithResult(_0x3b89f6,null))[_0x16dd('0x3f')](handleError(_0x3b89f6,null));};exports[_0x16dd('0x23')]=function(_0x454aae,_0x541837){return db[_0x16dd('0x3c')]['find']({'where':{'id':_0x454aae['params']['id']}})[_0x16dd('0x24')](handleEntityNotFound(_0x541837,null))[_0x16dd('0x24')](removeEntity(_0x541837,null))[_0x16dd('0x3f')](handleError(_0x541837,null));};exports[_0x16dd('0x45')]=function(_0x479e4c,_0x2447c5,_0x400dc5){var _0x3ebbfc={};var _0x928af={};var _0x4a599d;var _0x2e4fbb;return db['Dynamics365Account'][_0x16dd('0x46')]({'where':{'id':_0x479e4c[_0x16dd('0x44')]['id']}})[_0x16dd('0x24')](handleEntityNotFound(_0x2447c5,null))[_0x16dd('0x24')](function(_0x5c5b36){if(_0x5c5b36){_0x4a599d=_0x5c5b36;_0x928af[_0x16dd('0x30')]=_[_0x16dd('0x41')](db[_0x16dd('0x47')]['rawAttributes']);_0x928af[_0x16dd('0x2c')]=_['keys'](_0x479e4c[_0x16dd('0x2c')]);_0x928af[_0x16dd('0x2d')]=_['intersection'](_0x928af[_0x16dd('0x30')],_0x928af[_0x16dd('0x2c')]);_0x3ebbfc[_0x16dd('0x2f')]=_[_0x16dd('0x2e')](_0x928af[_0x16dd('0x30')],qs[_0x16dd('0x31')](_0x479e4c['query'][_0x16dd('0x31')]));_0x3ebbfc[_0x16dd('0x2f')]=_0x3ebbfc['attributes'][_0x16dd('0x32')]?_0x3ebbfc['attributes']:_0x928af['model'];_0x3ebbfc[_0x16dd('0x35')]=qs[_0x16dd('0x36')](_0x479e4c[_0x16dd('0x2c')]['sort']);_0x3ebbfc[_0x16dd('0x37')]=qs[_0x16dd('0x2d')](_[_0x16dd('0x38')](_0x479e4c[_0x16dd('0x2c')],_0x928af[_0x16dd('0x2d')]));if(_0x479e4c['query'][_0x16dd('0x39')]){_0x3ebbfc['where']=_['merge'](_0x3ebbfc[_0x16dd('0x37')],{'$or':_[_0x16dd('0x28')](_0x3ebbfc[_0x16dd('0x2f')],function(_0xf6089f){var _0x29ecf9={};_0x29ecf9[_0xf6089f]={'$like':'%'+_0x479e4c[_0x16dd('0x2c')]['filter']+'%'};return _0x29ecf9;})});}_0x3ebbfc=_['merge']({},_0x3ebbfc,_0x479e4c['options']);return _0x4a599d[_0x16dd('0x45')](_0x3ebbfc);}})['then'](function(_0x3f4ab9){if(_0x3f4ab9){_0x2e4fbb=_0x3f4ab9['length'];if(!_0x479e4c[_0x16dd('0x2c')][_0x16dd('0x33')](_0x16dd('0x34'))){_0x3ebbfc[_0x16dd('0x1c')]=qs[_0x16dd('0x1c')](_0x479e4c['query']['limit']);_0x3ebbfc[_0x16dd('0x1a')]=qs[_0x16dd('0x1a')](_0x479e4c['query']['offset']);}return _0x4a599d[_0x16dd('0x45')](_0x3ebbfc);}})[_0x16dd('0x24')](function(_0x4379d3){if(_0x4379d3){return _0x4379d3?{'count':_0x2e4fbb,'rows':_0x4379d3}:null;}})[_0x16dd('0x24')](respondWithResult(_0x2447c5,null))[_0x16dd('0x3f')](handleError(_0x2447c5,null));};exports[_0x16dd('0x48')]=function(_0x26a35c,_0x84bfc0,_0x5b1fd9){if(_0x26a35c[_0x16dd('0x43')]['id']){delete _0x26a35c[_0x16dd('0x43')]['id'];}return db[_0x16dd('0x3c')][_0x16dd('0x46')]({'where':{'id':_0x26a35c[_0x16dd('0x44')]['id']}})[_0x16dd('0x24')](handleEntityNotFound(_0x84bfc0,null))[_0x16dd('0x24')](function(_0x47d0b6){if(_0x47d0b6){_0x26a35c[_0x16dd('0x43')][_0x16dd('0x49')]=_0x47d0b6['id'];_0x26a35c[_0x16dd('0x43')][_0x16dd('0x4a')]=integrations[_0x16dd('0x4b')](_0x26a35c[_0x16dd('0x43')][_0x16dd('0x4c')],_0x26a35c['body'][_0x16dd('0x2a')]);_0x26a35c[_0x16dd('0x43')][_0x16dd('0x4d')]=integrations['getDescriptions'](_0x26a35c[_0x16dd('0x43')][_0x16dd('0x4c')],_0x26a35c['body'][_0x16dd('0x2a')]);return db[_0x16dd('0x47')][_0x16dd('0x4e')](_0x26a35c[_0x16dd('0x43')],{'include':[{'model':db[_0x16dd('0x4f')],'as':_0x16dd('0x4a')},{'model':db[_0x16dd('0x4f')],'as':_0x16dd('0x4d')}]});}return null;})[_0x16dd('0x24')](respondWithResult(_0x84bfc0,null))[_0x16dd('0x3f')](handleError(_0x84bfc0,null));};exports['getFields']=function(_0x26bcf7,_0x31ad58,_0x53b8a5){var _0x3c4bce=_0x26bcf7[_0x16dd('0x2c')][_0x16dd('0x50')];var _0x177c6=_0x3c4bce===_0x16dd('0x51')?_0x16dd('0x52'):'PhoneCall';var _0x1a4c85='';var _0x3f7709='';var _0x329312='';var _0xa9d2e3='';var _0x40a812='';var _0x581e6b='';var _0x41e692='';var _0x3d9fd1='';var _0x2d1bbd=[_0x16dd('0x53'),_0x16dd('0x54'),'customerid',_0x16dd('0x55'),_0x16dd('0x56'),_0x16dd('0x57'),_0x16dd('0x58'),'regardingobjectid',_0x16dd('0x59'),_0x16dd('0x5a')];var _0x4ed2b3=['accountidname','accountidyominame',_0x16dd('0x5b'),'billedserviceunits','contactidname','contactidyominame','contractdetailidname',_0x16dd('0x5c'),_0x16dd('0x5d'),_0x16dd('0x5e'),_0x16dd('0x5f'),_0x16dd('0x60'),_0x16dd('0x61'),'createdonbehalfbyname',_0x16dd('0x62'),'customeridname',_0x16dd('0x63'),'customeridyominame',_0x16dd('0x64'),_0x16dd('0x65'),_0x16dd('0x66'),'entityimage_url','escalatedon','exchangerate',_0x16dd('0x67'),'followupby',_0x16dd('0x68'),'influencescore',_0x16dd('0x69'),'lastonholdtime',_0x16dd('0x6a'),'modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname',_0x16dd('0x6b'),'modifiedon',_0x16dd('0x6c'),_0x16dd('0x6d'),_0x16dd('0x6e'),_0x16dd('0x6f'),_0x16dd('0x70'),_0x16dd('0x71'),_0x16dd('0x72'),_0x16dd('0x73'),_0x16dd('0x74'),_0x16dd('0x75'),_0x16dd('0x76'),_0x16dd('0x77'),'primarycontactidyominame',_0x16dd('0x78'),'productidname',_0x16dd('0x79'),_0x16dd('0x7a'),_0x16dd('0x7b'),_0x16dd('0x7c'),'responsiblecontactidname',_0x16dd('0x7d'),'sentimentvalue','slainvokedidname',_0x16dd('0x7e'),'socialprofileidname','statecode',_0x16dd('0x7f'),_0x16dd('0x80'),'ticketnumber',_0x16dd('0x81'),_0x16dd('0x82'),_0x16dd('0x83'),'utcconversiontimezonecode',_0x16dd('0x84')];var _0x5a468e=_0x2d1bbd[_0x16dd('0x85')](_0x4ed2b3);return db[_0x16dd('0x3c')][_0x16dd('0x46')]({'where':{'id':_0x26bcf7[_0x16dd('0x44')]['id']},'attributes':['id',_0x16dd('0x86'),_0x16dd('0x87'),_0x16dd('0x88'),_0x16dd('0x89'),'clientId',_0x16dd('0x8a')]})[_0x16dd('0x24')](handleEntityNotFound(_0x31ad58,null))[_0x16dd('0x24')](function(_0x27a2a3){if(_0x27a2a3){_0x3d9fd1=_0x27a2a3['remoteUri'];var _0x58e2f1=_0x3d9fd1['slice'](-0x1);if(_0x58e2f1==='/'){_0x3d9fd1=_0x3d9fd1['substring'](0x0,_0x3d9fd1[_0x16dd('0x8b')](_0x58e2f1));}_0x41e692=util[_0x16dd('0x8c')](_0x16dd('0x8d'),_0x3d9fd1);var _0x1f0bc8={'method':_0x16dd('0x8e'),'uri':_0x16dd('0x8f')+_0x27a2a3['tenantId']+_0x16dd('0x90'),'form':{'client_id':_0x27a2a3[_0x16dd('0x91')],'resource':_0x3d9fd1,'username':_0x27a2a3[_0x16dd('0x86')],'password':_0x27a2a3['password'],'grant_type':'password','client_secret':_0x27a2a3['clientSecret']},'json':!![]};return rp(_0x1f0bc8);}})[_0x16dd('0x24')](function(_0x33e49d){_0x581e6b=_0x33e49d[_0x16dd('0x92')];var _0x280d44={'method':_0x16dd('0x93'),'uri':encodeURI(_0x41e692+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x177c6+'\x27'),'headers':{'Authorization':_0x16dd('0x94')+_0x581e6b,'If-None-Match':null,'OData-Version':_0x16dd('0x95')},'json':!![]};return rp(_0x280d44);})['then'](function(_0x1cb530){var _0x8c697e=_0x1cb530[_0x16dd('0x96')][0x0];var _0x29e5fe=_0x8c697e[_0x16dd('0x97')];var _0x47fcd3={'method':'GET','uri':_0x41e692+'EntityDefinitions('+_0x29e5fe+_0x16dd('0x98'),'headers':{'Authorization':_0x16dd('0x94')+_0x581e6b,'If-None-Match':null,'OData-Version':_0x16dd('0x95')},'json':!![]};return rp(_0x47fcd3);})[_0x16dd('0x24')](function(_0x4c6127){_0x1a4c85=_0x4c6127;_0x3f7709=_0x1a4c85[_0x16dd('0x99')];_0x3f7709=_[_0x16dd('0x9a')](_0x3f7709,function(_0x1e54d6){return!_0x5a468e[_0x16dd('0x9b')](_0x1e54d6[_0x16dd('0x9c')]);});var _0x17ee12=[];var _0x4fbdaa=[];_0x3f7709[_0x16dd('0x9d')](function(_0x273903){if(_0x273903[_0x16dd('0x9e')]){var _0x2dc670=_0x273903[_0x16dd('0x9e')][_0x16dd('0x9f')](_0x273903[_0x16dd('0x9e')][_0x16dd('0x8b')]('.')+0x1);if(_0x2dc670==='PicklistAttributeMetadata'){_0x17ee12['push'](getSelectList(_0x41e692,_0x3c4bce,_0x4fbdaa,_0x1a4c85['MetadataId'],_0x273903['MetadataId'],_0x581e6b));}}});return Promise[_0x16dd('0xa0')](_0x17ee12);})[_0x16dd('0x24')](function(_0x26c40f){_0x329312=_0x26c40f[0x0];var _0x302198=[];var _0x3338db=[];_0x3f7709[_0x16dd('0x9d')](function(_0x593468){if(!_[_0x16dd('0xa1')](_0x593468[_0x16dd('0x9e')])){var _0x4d6c32=_0x593468[_0x16dd('0x9e')][_0x16dd('0x9f')](_0x593468['@odata.type'][_0x16dd('0x8b')]('.')+0x1);if(_0x4d6c32==='BooleanAttributeMetadata'){_0x302198[_0x16dd('0xa2')](getBooleanList(_0x41e692,_0x3c4bce,_0x3338db,_0x1a4c85[_0x16dd('0x97')],_0x593468[_0x16dd('0x97')],_0x581e6b));}}});return Promise[_0x16dd('0xa0')](_0x302198);})[_0x16dd('0x24')](function(_0x5052f7){_0xa9d2e3=_0x5052f7[0x0];var _0x220785=[];var _0x6884bf=[];_0x3f7709[_0x16dd('0x9d')](function(_0x52d714){if(_0x52d714['@odata.type']){var _0x227b25=_0x52d714[_0x16dd('0x9e')][_0x16dd('0x9f')](_0x52d714[_0x16dd('0x9e')]['lastIndexOf']('.')+0x1);if(_0x227b25===_0x16dd('0xa3')||_0x227b25===_0x16dd('0xa4')||_0x227b25===_0x16dd('0xa5')||_0x227b25===_0x16dd('0xa6')||_0x227b25===_0x16dd('0xa7')||_0x227b25===_0x16dd('0xa8')||_0x227b25===_0x16dd('0xa9')||_0x227b25===_0x16dd('0xaa')||_0x227b25===_0x16dd('0xab')||_0x227b25===_0x16dd('0xac')){_0x220785[_0x16dd('0xa2')](getInputList(_0x41e692,_0x3c4bce,_0x227b25,_0x6884bf,_0x1a4c85[_0x16dd('0x97')],_0x52d714['MetadataId'],_0x581e6b));}}});return Promise[_0x16dd('0xa0')](_0x220785);})['then'](function(_0x578fe2){_0x40a812=_0x578fe2[0x0];var _0x499365=_0x329312['concat'](_0xa9d2e3)['concat'](_0x40a812);var _0x4fb44c={'count':_0x499365[_0x16dd('0x32')],'rows':_0x499365};return _0x4fb44c;})[_0x16dd('0x24')](respondWithResult(_0x31ad58,null))['catch'](function(_0x208d33){var _0x4d8cbf=_0x26bcf7[_0x16dd('0x2c')]['test']?0x1f4:_0x208d33[_0x16dd('0xad')]||0x1f4;logger[_0x16dd('0xae')](_0x208d33['stack']);delete _0x208d33[_0x16dd('0x26')];if(_0x4d8cbf===0x191){_0x4d8cbf=0x190;}_0x31ad58[_0x16dd('0x17')](_0x4d8cbf)[_0x16dd('0xaf')](_0x26bcf7['query'][_0x16dd('0xb0')]?{'message':'Wrong\x20credentials','statusCode':_0x208d33['statusCode']}:_0x208d33);});};function getSelectList(_0x2d431d,_0x5a27a9,_0x4ba9b4,_0x4a1c1c,_0x402250,_0x38190a){var _0x1e8540={'method':_0x16dd('0x93'),'uri':_0x2d431d+'EntityDefinitions('+_0x4a1c1c+_0x16dd('0xb1')+_0x402250+_0x16dd('0xb2')+_0x16dd('0xb3'),'headers':{'Authorization':_0x16dd('0x94')+_0x38190a,'If-None-Match':null,'OData-Version':_0x16dd('0x95')},'json':!![]};return rp(_0x1e8540)['then'](function(_0x5dedf3){var _0x207ba8=[];var _0x252c4c=_0x5dedf3[_0x16dd('0xb4')][_0x16dd('0xb5')];_0x252c4c['forEach'](function(_0x573ca3){_0x207ba8[_0x16dd('0xa2')]({'name':_0x573ca3['Label'][_0x16dd('0xb6')][_0x16dd('0xb7')],'value':String(_0x573ca3[_0x16dd('0xb8')])});});var _0x52091a={'id':_0x5a27a9+'_'+_0x5dedf3[_0x16dd('0x9c')],'name':_0x5dedf3[_0x16dd('0xb9')][_0x16dd('0xb6')][_0x16dd('0xb7')],'custom':![],'options':_0x207ba8};_0x4ba9b4[_0x16dd('0xa2')](_0x52091a);return _0x4ba9b4;});}function getBooleanList(_0x206852,_0x5ea073,_0x2cd653,_0x35f536,_0x2624d6,_0x3e9ab0){var _0x1fbc49={'method':_0x16dd('0x93'),'uri':_0x206852+_0x16dd('0xba')+_0x35f536+_0x16dd('0xb1')+_0x2624d6+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x16dd('0x94')+_0x3e9ab0,'If-None-Match':null,'OData-Version':_0x16dd('0x95')},'json':!![]};return rp(_0x1fbc49)[_0x16dd('0x24')](function(_0x49e9f1){var _0x357dc8=[];_0x357dc8[_0x16dd('0xa2')]({'name':_0x49e9f1[_0x16dd('0xb4')][_0x16dd('0xbb')][_0x16dd('0xb7')][_0x16dd('0xb6')][_0x16dd('0xb7')],'value':'true'},{'name':_0x49e9f1['OptionSet'][_0x16dd('0xbc')][_0x16dd('0xb7')][_0x16dd('0xb6')][_0x16dd('0xb7')],'value':_0x16dd('0xbd')});var _0x146978={'id':_0x5ea073+'_'+_0x49e9f1[_0x16dd('0x9c')],'name':_0x49e9f1[_0x16dd('0xb9')][_0x16dd('0xb6')][_0x16dd('0xb7')],'custom':![],'options':_0x357dc8};_0x2cd653[_0x16dd('0xa2')](_0x146978);return _0x2cd653;});}function getInputList(_0x348d24,_0x2402a2,_0x577082,_0x704b13,_0x2c5a67,_0x32274e,_0x295275){var _0xbfd56d={'method':_0x16dd('0x93'),'uri':_0x348d24+_0x16dd('0xba')+_0x2c5a67+')/Attributes('+_0x32274e+')/Microsoft.Dynamics.CRM.'+_0x577082+_0x16dd('0xbe'),'headers':{'Authorization':_0x16dd('0x94')+_0x295275,'If-None-Match':null,'OData-Version':_0x16dd('0x95')},'json':!![]};return rp(_0xbfd56d)[_0x16dd('0x24')](function(_0x4fd92a){var _0x4dfcef={'id':_0x2402a2+'_'+_0x4fd92a['LogicalName'],'name':_0x4fd92a[_0x16dd('0xb9')][_0x16dd('0xb6')]?_0x4fd92a[_0x16dd('0xb9')][_0x16dd('0xb6')]['Label']:_0x4fd92a[_0x16dd('0x9c')],'custom':![],'options':[]};_0x704b13[_0x16dd('0xa2')](_0x4dfcef);return _0x704b13;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 4cbc50e..dc29471 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x24465b,_0x1ef032){var _0x5585da=function(_0x5bc52e){while(--_0x5bc52e){_0x24465b['push'](_0x24465b['shift']());}};_0x5585da(++_0x1ef032);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x998ae,_0x430334){var _0x39bde3=function(_0x204980){while(--_0x204980){_0x998ae['push'](_0x998ae['shift']());}};_0x39bde3(++_0x430334);}(_0x757a,0xde));var _0xa757=function(_0x258166,_0x1114b7){_0x258166=_0x258166-0x0;var _0x3d2a1a=_0x757a[_0x258166];return _0x3d2a1a;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 59e182c..6c6a6dc 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 _0x949a=['message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','where','limit','include','map','attributes','model','ShowDynamics365Account','find','raw','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x165249,_0x4b8009){var _0x42b1bd=function(_0x6b304e){while(--_0x6b304e){_0x165249['push'](_0x165249['shift']());}};_0x42b1bd(++_0x4b8009);}(_0x949a,0x16f));var _0xa949=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x949a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa949('0x0'));var util=require(_0xa949('0x1'));var moment=require(_0xa949('0x2'));var BPromise=require(_0xa949('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa949('0x4'));var db=require(_0xa949('0x5'))['db'];var utils=require(_0xa949('0x6'));var logger=require(_0xa949('0x7'))('rpc');var config=require(_0xa949('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa949('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x218756,_0x643ca1,_0x2494bd){return new BPromise(function(_0x24e077,_0x94e04){return client[_0xa949('0xa')](_0x218756,_0x2494bd)[_0xa949('0xb')](function(_0x4a22db){logger[_0xa949('0xc')](_0xa949('0xd'),_0x643ca1,'request\x20sent');logger['debug']('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x643ca1,_0xa949('0xe'),JSON[_0xa949('0xf')](_0x4a22db));if(_0x4a22db['error']){if(_0x4a22db[_0xa949('0x10')][_0xa949('0x11')]===0x1f4){logger[_0xa949('0x10')](_0xa949('0xd'),_0x643ca1,_0x4a22db[_0xa949('0x10')][_0xa949('0x12')]);return _0x94e04(_0x4a22db['error'][_0xa949('0x12')]);}logger[_0xa949('0x10')](_0xa949('0xd'),_0x643ca1,_0x4a22db['error'][_0xa949('0x12')]);return _0x24e077(_0x4a22db[_0xa949('0x10')][_0xa949('0x12')]);}else{logger[_0xa949('0xc')](_0xa949('0xd'),_0x643ca1,'request\x20sent');_0x24e077(_0x4a22db[_0xa949('0x13')]['message']);}})[_0xa949('0x14')](function(_0x4a7f4e){logger['error'](_0xa949('0xd'),_0x643ca1,_0x4a7f4e);_0x94e04(_0x4a7f4e);});});}exports[_0xa949('0x15')]=function(_0x21254c){var _0x495313=this;return new Promise(function(_0x3c66ec,_0x1a46b9){return db[_0xa949('0x16')][_0xa949('0x17')]({'raw':_0x21254c['options']?_0x21254c[_0xa949('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x21254c[_0xa949('0x18')]?_0x21254c[_0xa949('0x18')][_0xa949('0x19')]||null:null,'attributes':_0x21254c[_0xa949('0x18')]?_0x21254c[_0xa949('0x18')]['attributes']||null:null,'limit':_0x21254c[_0xa949('0x18')]?_0x21254c[_0xa949('0x18')][_0xa949('0x1a')]||null:null,'include':_0x21254c[_0xa949('0x18')]?_0x21254c[_0xa949('0x18')][_0xa949('0x1b')]?_[_0xa949('0x1c')](_0x21254c[_0xa949('0x18')]['include'],function(_0x45775a){return{'model':db[_0x45775a['model']],'as':_0x45775a['as'],'attributes':_0x45775a[_0xa949('0x1d')],'include':_0x45775a[_0xa949('0x1b')]?_[_0xa949('0x1c')](_0x45775a[_0xa949('0x1b')],function(_0x2b425c){return{'model':db[_0x2b425c['model']],'as':_0x2b425c['as'],'attributes':_0x2b425c[_0xa949('0x1d')],'include':_0x2b425c[_0xa949('0x1b')]?_[_0xa949('0x1c')](_0x2b425c[_0xa949('0x1b')],function(_0xb74ebf){return{'model':db[_0xb74ebf[_0xa949('0x1e')]],'as':_0xb74ebf['as'],'attributes':_0xb74ebf[_0xa949('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa949('0xb')](function(_0x2a0759){logger[_0xa949('0xc')](_0xa949('0x15'),_0x21254c);logger['debug'](_0xa949('0x15'),_0x21254c,JSON[_0xa949('0xf')](_0x2a0759));_0x3c66ec(_0x2a0759);})[_0xa949('0x14')](function(_0x53f78b){logger['error']('GetDynamics365Account',_0x53f78b[_0xa949('0x12')],_0x21254c);_0x1a46b9(_0x495313['error'](0x1f4,_0x53f78b['message']));});});};exports[_0xa949('0x1f')]=function(_0x1ee6eb){var _0x41eba7=this;return new Promise(function(_0x3680c2,_0xc974e7){return db[_0xa949('0x16')][_0xa949('0x20')]({'raw':_0x1ee6eb[_0xa949('0x18')]?_0x1ee6eb[_0xa949('0x18')][_0xa949('0x21')]===undefined?!![]:![]:!![],'where':_0x1ee6eb['options']?_0x1ee6eb[_0xa949('0x18')][_0xa949('0x19')]||null:null,'attributes':_0x1ee6eb[_0xa949('0x18')]?_0x1ee6eb['options'][_0xa949('0x1d')]||null:null,'include':_0x1ee6eb['options']?_0x1ee6eb[_0xa949('0x18')]['include']?_[_0xa949('0x1c')](_0x1ee6eb[_0xa949('0x18')][_0xa949('0x1b')],function(_0x187e38){return{'model':db[_0x187e38[_0xa949('0x1e')]],'as':_0x187e38['as'],'attributes':_0x187e38['attributes'],'include':_0x187e38['include']?_[_0xa949('0x1c')](_0x187e38[_0xa949('0x1b')],function(_0x4e3a76){return{'model':db[_0x4e3a76[_0xa949('0x1e')]],'as':_0x4e3a76['as'],'attributes':_0x4e3a76[_0xa949('0x1d')],'include':_0x4e3a76[_0xa949('0x1b')]?_[_0xa949('0x1c')](_0x4e3a76[_0xa949('0x1b')],function(_0x4593bb){return{'model':db[_0x4593bb[_0xa949('0x1e')]],'as':_0x4593bb['as'],'attributes':_0x4593bb[_0xa949('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa949('0xb')](function(_0x266234){logger['info'](_0xa949('0x1f'),_0x1ee6eb);logger[_0xa949('0x22')](_0xa949('0x1f'),_0x1ee6eb,JSON[_0xa949('0xf')](_0x266234));_0x3680c2(_0x266234);})[_0xa949('0x14')](function(_0x276701){logger[_0xa949('0x10')](_0xa949('0x1f'),_0x276701['message'],_0x1ee6eb);_0xc974e7(_0x41eba7['error'](0x1f4,_0x276701[_0xa949('0x12')]));});});}; \ No newline at end of file +var _0x9eb5=['model','attributes','ShowDynamics365Account','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','limit','include','map'];(function(_0x52bc58,_0x502bd0){var _0x2311d3=function(_0x5ea674){while(--_0x5ea674){_0x52bc58['push'](_0x52bc58['shift']());}};_0x2311d3(++_0x502bd0);}(_0x9eb5,0x1e5));var _0x59eb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9eb5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x59eb('0x0'));var util=require(_0x59eb('0x1'));var moment=require(_0x59eb('0x2'));var BPromise=require(_0x59eb('0x3'));var rs=require(_0x59eb('0x4'));var fs=require('fs');var Redis=require(_0x59eb('0x5'));var db=require(_0x59eb('0x6'))['db'];var utils=require(_0x59eb('0x7'));var logger=require(_0x59eb('0x8'))(_0x59eb('0x9'));var config=require(_0x59eb('0xa'));var jayson=require(_0x59eb('0xb'));var client=jayson['client'][_0x59eb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2220f2,_0x34d0f7,_0x588dca){return new BPromise(function(_0x309b49,_0x3d5d1c){return client['request'](_0x2220f2,_0x588dca)[_0x59eb('0xd')](function(_0x34f2fc){logger['info'](_0x59eb('0xe'),_0x34d0f7,_0x59eb('0xf'));logger[_0x59eb('0x10')](_0x59eb('0x11'),_0x34d0f7,_0x59eb('0xf'),JSON[_0x59eb('0x12')](_0x34f2fc));if(_0x34f2fc[_0x59eb('0x13')]){if(_0x34f2fc[_0x59eb('0x13')]['code']===0x1f4){logger[_0x59eb('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x34d0f7,_0x34f2fc['error'][_0x59eb('0x14')]);return _0x3d5d1c(_0x34f2fc[_0x59eb('0x13')][_0x59eb('0x14')]);}logger[_0x59eb('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x34d0f7,_0x34f2fc['error'][_0x59eb('0x14')]);return _0x309b49(_0x34f2fc['error']['message']);}else{logger[_0x59eb('0x15')](_0x59eb('0xe'),_0x34d0f7,_0x59eb('0xf'));_0x309b49(_0x34f2fc[_0x59eb('0x16')][_0x59eb('0x14')]);}})[_0x59eb('0x17')](function(_0x333009){logger['error'](_0x59eb('0xe'),_0x34d0f7,_0x333009);_0x3d5d1c(_0x333009);});});}exports[_0x59eb('0x18')]=function(_0x580cb0){var _0x539dea=this;return new Promise(function(_0x43eb95,_0x9d5d52){return db[_0x59eb('0x19')][_0x59eb('0x1a')]({'raw':_0x580cb0[_0x59eb('0x1b')]?_0x580cb0['options'][_0x59eb('0x1c')]===undefined?!![]:![]:!![],'where':_0x580cb0[_0x59eb('0x1b')]?_0x580cb0['options'][_0x59eb('0x1d')]||null:null,'attributes':_0x580cb0[_0x59eb('0x1b')]?_0x580cb0[_0x59eb('0x1b')]['attributes']||null:null,'limit':_0x580cb0[_0x59eb('0x1b')]?_0x580cb0[_0x59eb('0x1b')][_0x59eb('0x1e')]||null:null,'include':_0x580cb0[_0x59eb('0x1b')]?_0x580cb0[_0x59eb('0x1b')][_0x59eb('0x1f')]?_[_0x59eb('0x20')](_0x580cb0[_0x59eb('0x1b')][_0x59eb('0x1f')],function(_0x51b534){return{'model':db[_0x51b534[_0x59eb('0x21')]],'as':_0x51b534['as'],'attributes':_0x51b534['attributes'],'include':_0x51b534['include']?_['map'](_0x51b534['include'],function(_0x57f824){return{'model':db[_0x57f824[_0x59eb('0x21')]],'as':_0x57f824['as'],'attributes':_0x57f824['attributes'],'include':_0x57f824[_0x59eb('0x1f')]?_[_0x59eb('0x20')](_0x57f824['include'],function(_0x401b7c){return{'model':db[_0x401b7c[_0x59eb('0x21')]],'as':_0x401b7c['as'],'attributes':_0x401b7c[_0x59eb('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1500df){logger[_0x59eb('0x15')](_0x59eb('0x18'),_0x580cb0);logger['debug'](_0x59eb('0x18'),_0x580cb0,JSON[_0x59eb('0x12')](_0x1500df));_0x43eb95(_0x1500df);})[_0x59eb('0x17')](function(_0x40afde){logger[_0x59eb('0x13')](_0x59eb('0x18'),_0x40afde[_0x59eb('0x14')],_0x580cb0);_0x9d5d52(_0x539dea[_0x59eb('0x13')](0x1f4,_0x40afde['message']));});});};exports[_0x59eb('0x23')]=function(_0x13ecd5){var _0x2f888d=this;return new Promise(function(_0x4f94c5,_0xd609ad){return db[_0x59eb('0x19')][_0x59eb('0x24')]({'raw':_0x13ecd5[_0x59eb('0x1b')]?_0x13ecd5[_0x59eb('0x1b')][_0x59eb('0x1c')]===undefined?!![]:![]:!![],'where':_0x13ecd5[_0x59eb('0x1b')]?_0x13ecd5[_0x59eb('0x1b')][_0x59eb('0x1d')]||null:null,'attributes':_0x13ecd5['options']?_0x13ecd5[_0x59eb('0x1b')][_0x59eb('0x22')]||null:null,'include':_0x13ecd5['options']?_0x13ecd5['options'][_0x59eb('0x1f')]?_['map'](_0x13ecd5['options'][_0x59eb('0x1f')],function(_0x3b8204){return{'model':db[_0x3b8204[_0x59eb('0x21')]],'as':_0x3b8204['as'],'attributes':_0x3b8204['attributes'],'include':_0x3b8204['include']?_[_0x59eb('0x20')](_0x3b8204[_0x59eb('0x1f')],function(_0x1298a7){return{'model':db[_0x1298a7[_0x59eb('0x21')]],'as':_0x1298a7['as'],'attributes':_0x1298a7[_0x59eb('0x22')],'include':_0x1298a7[_0x59eb('0x1f')]?_['map'](_0x1298a7[_0x59eb('0x1f')],function(_0x596c31){return{'model':db[_0x596c31[_0x59eb('0x21')]],'as':_0x596c31['as'],'attributes':_0x596c31[_0x59eb('0x22')]};}):[]};}):[]};}):[]:[]})[_0x59eb('0xd')](function(_0x372e12){logger[_0x59eb('0x15')](_0x59eb('0x23'),_0x13ecd5);logger[_0x59eb('0x10')](_0x59eb('0x23'),_0x13ecd5,JSON['stringify'](_0x372e12));_0x4f94c5(_0x372e12);})[_0x59eb('0x17')](function(_0x2074c1){logger[_0x59eb('0x13')]('ShowDynamics365Account',_0x2074c1[_0x59eb('0x14')],_0x13ecd5);_0xd609ad(_0x2f888d[_0x59eb('0x13')](0x1f4,_0x2074c1[_0x59eb('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 9d90cc0..1a7ba4a 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 _0x71ee=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','/:id/descriptions','post','put','update','destroy','exports','multer','path','express'];(function(_0x439850,_0x1a833c){var _0x525f6b=function(_0x205286){while(--_0x205286){_0x439850['push'](_0x439850['shift']());}};_0x525f6b(++_0x1a833c);}(_0x71ee,0x1cb));var _0xe71e=function(_0x352fc9,_0x59fadc){_0x352fc9=_0x352fc9-0x0;var _0x36b574=_0x71ee[_0x352fc9];return _0x36b574;};'use strict';var multer=require(_0xe71e('0x0'));var util=require('util');var path=require(_0xe71e('0x1'));var timeout=require('connect-timeout');var express=require(_0xe71e('0x2'));var router=express[_0xe71e('0x3')]();var fs_extra=require(_0xe71e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe71e('0x5'));var config=require(_0xe71e('0x6'));var controller=require(_0xe71e('0x7'));router[_0xe71e('0x8')]('/',auth[_0xe71e('0x9')](),controller[_0xe71e('0xa')]);router['get'](_0xe71e('0xb'),auth['isAuthenticated'](),controller[_0xe71e('0xc')]);router['get']('/:id/fields',auth[_0xe71e('0x9')](),controller[_0xe71e('0xd')]);router[_0xe71e('0x8')](_0xe71e('0xe'),auth[_0xe71e('0x9')](),controller['getSubjects']);router[_0xe71e('0x8')](_0xe71e('0xf'),auth[_0xe71e('0x9')](),controller['getDescriptions']);router[_0xe71e('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe71e('0x11')]('/:id',auth[_0xe71e('0x9')](),controller[_0xe71e('0x12')]);router['delete'](_0xe71e('0xb'),auth[_0xe71e('0x9')](),controller[_0xe71e('0x13')]);module[_0xe71e('0x14')]=router; \ No newline at end of file +var _0xf682=['isAuthenticated','index','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x2f2d7e,_0x1d95e4){var _0x1eb324=function(_0x25029a){while(--_0x25029a){_0x2f2d7e['push'](_0x2f2d7e['shift']());}};_0x1eb324(++_0x1d95e4);}(_0xf682,0x12f));var _0x2f68=function(_0x4835e9,_0x1b7b16){_0x4835e9=_0x4835e9-0x0;var _0xaee5f=_0xf682[_0x4835e9];return _0xaee5f;};'use strict';var multer=require(_0x2f68('0x0'));var util=require(_0x2f68('0x1'));var path=require(_0x2f68('0x2'));var timeout=require(_0x2f68('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2f68('0x4'));var auth=require(_0x2f68('0x5'));var interaction=require(_0x2f68('0x6'));var config=require(_0x2f68('0x7'));var controller=require('./intDynamics365Configuration.controller');router[_0x2f68('0x8')]('/',auth[_0x2f68('0x9')](),controller[_0x2f68('0xa')]);router[_0x2f68('0x8')]('/:id',auth[_0x2f68('0x9')](),controller[_0x2f68('0xb')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x2f68('0x8')](_0x2f68('0xc'),auth[_0x2f68('0x9')](),controller[_0x2f68('0xd')]);router[_0x2f68('0x8')](_0x2f68('0xe'),auth[_0x2f68('0x9')](),controller[_0x2f68('0xf')]);router[_0x2f68('0x10')]('/',auth[_0x2f68('0x9')](),controller[_0x2f68('0x11')]);router[_0x2f68('0x12')](_0x2f68('0x13'),auth[_0x2f68('0x9')](),controller[_0x2f68('0x14')]);router[_0x2f68('0x15')]('/:id',auth[_0x2f68('0x9')](),controller[_0x2f68('0x16')]);module[_0x2f68('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 9b09be7..ac4a187 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 _0xd846=['exports','STRING','ENUM','phonecall','incident','sequelize'];(function(_0x5227c1,_0x195d3b){var _0x4f0456=function(_0x2a0c67){while(--_0x2a0c67){_0x5227c1['push'](_0x5227c1['shift']());}};_0x4f0456(++_0x195d3b);}(_0xd846,0xad));var _0x6d84=function(_0x148eae,_0x121054){_0x148eae=_0x148eae-0x0;var _0x5b849a=_0xd846[_0x148eae];return _0x5b849a;};'use strict';var Sequelize=require(_0x6d84('0x0'));module[_0x6d84('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6d84('0x2')]},'ticketType':{'type':Sequelize[_0x6d84('0x3')]('incident',_0x6d84('0x4')),'defaultValue':_0x6d84('0x5')}}; \ No newline at end of file +var _0x65b0=['phonecall','sequelize','STRING','ENUM','incident'];(function(_0x36ea51,_0x13d0b9){var _0x24f867=function(_0x1bdac3){while(--_0x1bdac3){_0x36ea51['push'](_0x36ea51['shift']());}};_0x24f867(++_0x13d0b9);}(_0x65b0,0x146));var _0x065b=function(_0x41b9f7,_0x3d0e75){_0x41b9f7=_0x41b9f7-0x0;var _0x5c79bb=_0x65b0[_0x41b9f7];return _0x5c79bb;};'use strict';var Sequelize=require(_0x065b('0x0'));module['exports']={'name':{'type':Sequelize[_0x065b('0x1')]},'description':{'type':Sequelize[_0x065b('0x1')]},'ticketType':{'type':Sequelize[_0x065b('0x2')](_0x065b('0x3'),_0x065b('0x4')),'defaultValue':_0x065b('0x3')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 4b77aca..0f3a189 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 _0x312f=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','end','error','stack','name','index','map','Dynamics365Configuration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','update','getFields','findOne','Dynamics365Field','pick','hasOwnProperty','getSubjects','getDescriptions','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x312f,0x139));var _0xf312=function(_0x4b7cbf,_0x45a394){_0x4b7cbf=_0x4b7cbf-0x0;var _0x480780=_0x312f[_0x4b7cbf];return _0x480780;};'use strict';var emlformat=require(_0xf312('0x0'));var rimraf=require(_0xf312('0x1'));var zipdir=require(_0xf312('0x2'));var jsonpatch=require(_0xf312('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf312('0x4'));var Mustache=require(_0xf312('0x5'));var util=require(_0xf312('0x6'));var path=require(_0xf312('0x7'));var sox=require(_0xf312('0x8'));var csv=require(_0xf312('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf312('0xa'));var _=require(_0xf312('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf312('0xc'));var deskjs=require(_0xf312('0xd'));var toCsv=require(_0xf312('0x9'));var querystring=require(_0xf312('0xe'));var Papa=require(_0xf312('0xf'));var Redis=require(_0xf312('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf312('0x11'));var as=require(_0xf312('0x12'));var hardwareService=require(_0xf312('0x13'));var logger=require(_0xf312('0x14'))(_0xf312('0x15'));var utils=require(_0xf312('0x16'));var config=require(_0xf312('0x17'));var licenseUtil=require(_0xf312('0x18'));var db=require(_0xf312('0x19'))['db'];function respondWithStatusCode(_0x22d99e,_0x12b2b2){_0x12b2b2=_0x12b2b2||0xcc;return function(_0x599119){if(_0x599119){return _0x22d99e[_0xf312('0x1a')](_0x12b2b2);}return _0x22d99e[_0xf312('0x1b')](_0x12b2b2)['end']();};}function respondWithResult(_0x584d29,_0x37f786){_0x37f786=_0x37f786||0xc8;return function(_0x542ce7){if(_0x542ce7){return _0x584d29[_0xf312('0x1b')](_0x37f786)[_0xf312('0x1c')](_0x542ce7);}};}function respondWithFilteredResult(_0x198c15,_0x506ca0){return function(_0xec7c2b){if(_0xec7c2b){var _0x12f814=typeof _0x506ca0[_0xf312('0x1d')]===_0xf312('0x1e')&&typeof _0x506ca0[_0xf312('0x1f')]==='undefined';var _0x253d04=_0xec7c2b[_0xf312('0x20')];var _0x2f827d=_0x12f814?0x0:_0x506ca0[_0xf312('0x1d')];var _0x4d53bb=_0x12f814?_0xec7c2b[_0xf312('0x20')]:_0x506ca0['offset']+_0x506ca0[_0xf312('0x1f')];var _0x16ca3b;if(_0x4d53bb>=_0x253d04){_0x4d53bb=_0x253d04;_0x16ca3b=0xc8;}else{_0x16ca3b=0xce;}_0x198c15[_0xf312('0x1b')](_0x16ca3b);return _0x198c15[_0xf312('0x21')]('Content-Range',_0x2f827d+'-'+_0x4d53bb+'/'+_0x253d04)[_0xf312('0x1c')](_0xec7c2b);}return null;};}function patchUpdates(_0x4a72d9){return function(_0xa1a8fc){try{jsonpatch[_0xf312('0x22')](_0xa1a8fc,_0x4a72d9,!![]);}catch(_0x3274e2){return BPromise[_0xf312('0x23')](_0x3274e2);}return _0xa1a8fc[_0xf312('0x24')]();};}function saveUpdates(_0xa628f2,_0x44faab){return function(_0x3f642a){if(_0x3f642a){return _0x3f642a['update'](_0xa628f2)[_0xf312('0x25')](function(_0x4053b6){return _0x4053b6;});}return null;};}function removeEntity(_0x3616ef,_0x5bdbf8){return function(_0x5f07c7){if(_0x5f07c7){return _0x5f07c7[_0xf312('0x26')]()['then'](function(){_0x3616ef['status'](0xcc)[_0xf312('0x27')]();});}};}function handleEntityNotFound(_0x76e179,_0x4c053b){return function(_0x3a2123){if(!_0x3a2123){_0x76e179[_0xf312('0x1a')](0x194);}return _0x3a2123;};}function handleError(_0xcd5e6b,_0x3edf77){_0x3edf77=_0x3edf77||0x1f4;return function(_0x410580){logger[_0xf312('0x28')](_0x410580[_0xf312('0x29')]);if(_0x410580[_0xf312('0x2a')]){delete _0x410580[_0xf312('0x2a')];}_0xcd5e6b[_0xf312('0x1b')](_0x3edf77)['send'](_0x410580);};}exports[_0xf312('0x2b')]=function(_0x3aa835,_0x413a62){var _0x352603={},_0x2b4f1a={},_0x58b80b={'count':0x0,'rows':[]};var _0x1b74d3=_[_0xf312('0x2c')](db[_0xf312('0x2d')][_0xf312('0x2e')],function(_0x5ba9ae){return{'name':_0x5ba9ae[_0xf312('0x2f')],'type':_0x5ba9ae['type'][_0xf312('0x30')]};});_0x2b4f1a[_0xf312('0x31')]=_[_0xf312('0x2c')](_0x1b74d3,_0xf312('0x2a'));_0x2b4f1a[_0xf312('0x32')]=_[_0xf312('0x33')](_0x3aa835['query']);_0x2b4f1a[_0xf312('0x34')]=_[_0xf312('0x35')](_0x2b4f1a[_0xf312('0x31')],_0x2b4f1a[_0xf312('0x32')]);_0x352603[_0xf312('0x36')]=_[_0xf312('0x35')](_0x2b4f1a[_0xf312('0x31')],qs[_0xf312('0x37')](_0x3aa835[_0xf312('0x32')][_0xf312('0x37')]));_0x352603['attributes']=_0x352603[_0xf312('0x36')][_0xf312('0x38')]?_0x352603['attributes']:_0x2b4f1a[_0xf312('0x31')];if(!_0x3aa835[_0xf312('0x32')]['hasOwnProperty']('nolimit')){_0x352603['limit']=qs[_0xf312('0x1f')](_0x3aa835[_0xf312('0x32')][_0xf312('0x1f')]);_0x352603[_0xf312('0x1d')]=qs[_0xf312('0x1d')](_0x3aa835['query']['offset']);}_0x352603[_0xf312('0x39')]=qs[_0xf312('0x3a')](_0x3aa835[_0xf312('0x32')]['sort']);_0x352603['where']=qs[_0xf312('0x34')](_['pick'](_0x3aa835[_0xf312('0x32')],_0x2b4f1a['filters']),_0x1b74d3);if(_0x3aa835[_0xf312('0x32')][_0xf312('0x3b')]){_0x352603[_0xf312('0x3c')]=_[_0xf312('0x3d')](_0x352603[_0xf312('0x3c')],{'$or':_[_0xf312('0x2c')](_0x1b74d3,function(_0x543d48){if(_0x543d48[_0xf312('0x3e')]!==_0xf312('0x3f')){var _0x58964d={};_0x58964d[_0x543d48[_0xf312('0x2a')]]={'$like':'%'+_0x3aa835[_0xf312('0x32')]['filter']+'%'};return _0x58964d;}})});}_0x352603=_['merge']({},_0x352603,_0x3aa835[_0xf312('0x40')]);var _0x18ee27={'where':_0x352603[_0xf312('0x3c')]};return db[_0xf312('0x2d')][_0xf312('0x20')](_0x18ee27)[_0xf312('0x25')](function(_0x159fba){_0x58b80b[_0xf312('0x20')]=_0x159fba;if(_0x3aa835[_0xf312('0x32')]['includeAll']){_0x352603[_0xf312('0x41')]=[{'all':!![]}];}return db[_0xf312('0x2d')][_0xf312('0x42')](_0x352603);})['then'](function(_0x926b13){_0x58b80b[_0xf312('0x43')]=_0x926b13;return _0x58b80b;})[_0xf312('0x25')](respondWithFilteredResult(_0x413a62,_0x352603))[_0xf312('0x44')](handleError(_0x413a62,null));};exports[_0xf312('0x45')]=function(_0x4c26ea,_0x1485c1){var _0x37886e={'raw':![],'where':{'id':_0x4c26ea[_0xf312('0x46')]['id']}},_0x1b7f61={};_0x1b7f61[_0xf312('0x31')]=_['keys'](db[_0xf312('0x2d')][_0xf312('0x2e')]);_0x1b7f61[_0xf312('0x32')]=_[_0xf312('0x33')](_0x4c26ea[_0xf312('0x32')]);_0x1b7f61[_0xf312('0x34')]=_[_0xf312('0x35')](_0x1b7f61['model'],_0x1b7f61[_0xf312('0x32')]);_0x37886e[_0xf312('0x36')]=_['intersection'](_0x1b7f61[_0xf312('0x31')],qs[_0xf312('0x37')](_0x4c26ea[_0xf312('0x32')]['fields']));_0x37886e[_0xf312('0x36')]=_0x37886e['attributes']['length']?_0x37886e[_0xf312('0x36')]:_0x1b7f61['model'];if(_0x4c26ea[_0xf312('0x32')][_0xf312('0x47')]){_0x37886e['include']=[{'all':!![]}];}_0x37886e=_[_0xf312('0x3d')]({},_0x37886e,_0x4c26ea[_0xf312('0x40')]);return db[_0xf312('0x2d')][_0xf312('0x48')](_0x37886e)['then'](handleEntityNotFound(_0x1485c1,null))[_0xf312('0x25')](respondWithResult(_0x1485c1,null))[_0xf312('0x44')](handleError(_0x1485c1,null));};exports['create']=function(_0x14c0a0,_0x9da5bf){return db[_0xf312('0x2d')][_0xf312('0x49')](_0x14c0a0[_0xf312('0x4a')],{})[_0xf312('0x25')](respondWithResult(_0x9da5bf,0xc9))['catch'](handleError(_0x9da5bf,null));};exports[_0xf312('0x4b')]=function(_0x3c6e6f,_0x3e8594){if(_0x3c6e6f[_0xf312('0x4a')]['id']){delete _0x3c6e6f[_0xf312('0x4a')]['id'];}return db['Dynamics365Configuration'][_0xf312('0x48')]({'where':{'id':_0x3c6e6f[_0xf312('0x46')]['id']}})[_0xf312('0x25')](handleEntityNotFound(_0x3e8594,null))[_0xf312('0x25')](saveUpdates(_0x3c6e6f['body'],null))[_0xf312('0x25')](respondWithResult(_0x3e8594,null))['catch'](handleError(_0x3e8594,null));};exports['destroy']=function(_0x5b1b93,_0x465a05){return db['Dynamics365Configuration'][_0xf312('0x48')]({'where':{'id':_0x5b1b93['params']['id']}})[_0xf312('0x25')](handleEntityNotFound(_0x465a05,null))[_0xf312('0x25')](removeEntity(_0x465a05,null))['catch'](handleError(_0x465a05,null));};exports[_0xf312('0x4c')]=function(_0x23a33f,_0xfaacd2,_0x19dc7e){var _0x59af65={};var _0x39552a={};var _0x96b6e5;var _0x26d6b9;return db['Dynamics365Configuration'][_0xf312('0x4d')]({'where':{'id':_0x23a33f[_0xf312('0x46')]['id']}})[_0xf312('0x25')](handleEntityNotFound(_0xfaacd2,null))[_0xf312('0x25')](function(_0x4d39b4){if(_0x4d39b4){_0x96b6e5=_0x4d39b4;_0x39552a[_0xf312('0x31')]=_[_0xf312('0x33')](db[_0xf312('0x4e')][_0xf312('0x2e')]);_0x39552a[_0xf312('0x32')]=_['keys'](_0x23a33f[_0xf312('0x32')]);_0x39552a[_0xf312('0x34')]=_[_0xf312('0x35')](_0x39552a[_0xf312('0x31')],_0x39552a[_0xf312('0x32')]);_0x59af65['attributes']=_['intersection'](_0x39552a[_0xf312('0x31')],qs['fields'](_0x23a33f['query'][_0xf312('0x37')]));_0x59af65[_0xf312('0x36')]=_0x59af65[_0xf312('0x36')][_0xf312('0x38')]?_0x59af65[_0xf312('0x36')]:_0x39552a['model'];_0x59af65[_0xf312('0x39')]=qs[_0xf312('0x3a')](_0x23a33f[_0xf312('0x32')][_0xf312('0x3a')]);_0x59af65[_0xf312('0x3c')]=qs[_0xf312('0x34')](_[_0xf312('0x4f')](_0x23a33f[_0xf312('0x32')],_0x39552a['filters']));if(_0x23a33f[_0xf312('0x32')][_0xf312('0x3b')]){_0x59af65[_0xf312('0x3c')]=_[_0xf312('0x3d')](_0x59af65[_0xf312('0x3c')],{'$or':_[_0xf312('0x2c')](_0x59af65[_0xf312('0x36')],function(_0x58d4a1){var _0x256997={};_0x256997[_0x58d4a1]={'$like':'%'+_0x23a33f['query'][_0xf312('0x3b')]+'%'};return _0x256997;})});}_0x59af65=_[_0xf312('0x3d')]({},_0x59af65,_0x23a33f[_0xf312('0x40')]);return _0x96b6e5[_0xf312('0x4c')](_0x59af65);}})[_0xf312('0x25')](function(_0x33537c){if(_0x33537c){_0x26d6b9=_0x33537c['length'];if(!_0x23a33f[_0xf312('0x32')][_0xf312('0x50')]('nolimit')){_0x59af65[_0xf312('0x1f')]=qs[_0xf312('0x1f')](_0x23a33f['query']['limit']);_0x59af65[_0xf312('0x1d')]=qs[_0xf312('0x1d')](_0x23a33f['query'][_0xf312('0x1d')]);}return _0x96b6e5['getFields'](_0x59af65);}})[_0xf312('0x25')](function(_0x44d5fe){if(_0x44d5fe){return _0x44d5fe?{'count':_0x26d6b9,'rows':_0x44d5fe}:null;}})[_0xf312('0x25')](respondWithResult(_0xfaacd2,null))[_0xf312('0x44')](handleError(_0xfaacd2,null));};exports[_0xf312('0x51')]=function(_0x1c34ee,_0x57ff83,_0x297955){var _0xd32a3a={};var _0x42524c={};var _0x3b12ed;var _0x3168c2;return db['Dynamics365Configuration'][_0xf312('0x4d')]({'where':{'id':_0x1c34ee['params']['id']}})[_0xf312('0x25')](handleEntityNotFound(_0x57ff83,null))[_0xf312('0x25')](function(_0x27d89e){if(_0x27d89e){_0x3b12ed=_0x27d89e;_0x42524c[_0xf312('0x31')]=_[_0xf312('0x33')](db['Dynamics365Field'][_0xf312('0x2e')]);_0x42524c[_0xf312('0x32')]=_['keys'](_0x1c34ee[_0xf312('0x32')]);_0x42524c[_0xf312('0x34')]=_[_0xf312('0x35')](_0x42524c[_0xf312('0x31')],_0x42524c[_0xf312('0x32')]);_0xd32a3a[_0xf312('0x36')]=_[_0xf312('0x35')](_0x42524c['model'],qs['fields'](_0x1c34ee[_0xf312('0x32')][_0xf312('0x37')]));_0xd32a3a[_0xf312('0x36')]=_0xd32a3a['attributes'][_0xf312('0x38')]?_0xd32a3a[_0xf312('0x36')]:_0x42524c[_0xf312('0x31')];_0xd32a3a[_0xf312('0x39')]=qs[_0xf312('0x3a')](_0x1c34ee[_0xf312('0x32')][_0xf312('0x3a')]);_0xd32a3a[_0xf312('0x3c')]=qs[_0xf312('0x34')](_[_0xf312('0x4f')](_0x1c34ee[_0xf312('0x32')],_0x42524c[_0xf312('0x34')]));if(_0x1c34ee[_0xf312('0x32')][_0xf312('0x3b')]){_0xd32a3a[_0xf312('0x3c')]=_[_0xf312('0x3d')](_0xd32a3a[_0xf312('0x3c')],{'$or':_[_0xf312('0x2c')](_0xd32a3a['attributes'],function(_0x698453){var _0x1da0c4={};_0x1da0c4[_0x698453]={'$like':'%'+_0x1c34ee[_0xf312('0x32')][_0xf312('0x3b')]+'%'};return _0x1da0c4;})});}_0xd32a3a=_[_0xf312('0x3d')]({},_0xd32a3a,_0x1c34ee['options']);return _0x3b12ed[_0xf312('0x51')](_0xd32a3a);}})[_0xf312('0x25')](function(_0x2be5fb){if(_0x2be5fb){_0x3168c2=_0x2be5fb[_0xf312('0x38')];if(!_0x1c34ee[_0xf312('0x32')][_0xf312('0x50')]('nolimit')){_0xd32a3a['limit']=qs['limit'](_0x1c34ee[_0xf312('0x32')][_0xf312('0x1f')]);_0xd32a3a[_0xf312('0x1d')]=qs[_0xf312('0x1d')](_0x1c34ee[_0xf312('0x32')][_0xf312('0x1d')]);}return _0x3b12ed['getSubjects'](_0xd32a3a);}})[_0xf312('0x25')](function(_0x43222f){if(_0x43222f){return _0x43222f?{'count':_0x3168c2,'rows':_0x43222f}:null;}})['then'](respondWithResult(_0x57ff83,null))[_0xf312('0x44')](handleError(_0x57ff83,null));};exports[_0xf312('0x52')]=function(_0x1450f0,_0xc5b1,_0x2d1b3d){var _0x56c94e={};var _0x596c72={};var _0x597b6a;var _0x3855db;return db[_0xf312('0x2d')][_0xf312('0x4d')]({'where':{'id':_0x1450f0[_0xf312('0x46')]['id']}})['then'](handleEntityNotFound(_0xc5b1,null))[_0xf312('0x25')](function(_0x3dc1a5){if(_0x3dc1a5){_0x597b6a=_0x3dc1a5;_0x596c72[_0xf312('0x31')]=_['keys'](db[_0xf312('0x4e')][_0xf312('0x2e')]);_0x596c72[_0xf312('0x32')]=_['keys'](_0x1450f0[_0xf312('0x32')]);_0x596c72[_0xf312('0x34')]=_['intersection'](_0x596c72[_0xf312('0x31')],_0x596c72[_0xf312('0x32')]);_0x56c94e[_0xf312('0x36')]=_[_0xf312('0x35')](_0x596c72[_0xf312('0x31')],qs[_0xf312('0x37')](_0x1450f0[_0xf312('0x32')][_0xf312('0x37')]));_0x56c94e[_0xf312('0x36')]=_0x56c94e[_0xf312('0x36')]['length']?_0x56c94e[_0xf312('0x36')]:_0x596c72['model'];_0x56c94e[_0xf312('0x39')]=qs[_0xf312('0x3a')](_0x1450f0[_0xf312('0x32')][_0xf312('0x3a')]);_0x56c94e[_0xf312('0x3c')]=qs[_0xf312('0x34')](_[_0xf312('0x4f')](_0x1450f0['query'],_0x596c72[_0xf312('0x34')]));if(_0x1450f0[_0xf312('0x32')][_0xf312('0x3b')]){_0x56c94e['where']=_[_0xf312('0x3d')](_0x56c94e[_0xf312('0x3c')],{'$or':_[_0xf312('0x2c')](_0x56c94e['attributes'],function(_0x25f510){var _0x4ba147={};_0x4ba147[_0x25f510]={'$like':'%'+_0x1450f0[_0xf312('0x32')][_0xf312('0x3b')]+'%'};return _0x4ba147;})});}_0x56c94e=_['merge']({},_0x56c94e,_0x1450f0[_0xf312('0x40')]);return _0x597b6a[_0xf312('0x52')](_0x56c94e);}})['then'](function(_0x5167b1){if(_0x5167b1){_0x3855db=_0x5167b1['length'];if(!_0x1450f0[_0xf312('0x32')]['hasOwnProperty'](_0xf312('0x53'))){_0x56c94e['limit']=qs[_0xf312('0x1f')](_0x1450f0[_0xf312('0x32')][_0xf312('0x1f')]);_0x56c94e[_0xf312('0x1d')]=qs[_0xf312('0x1d')](_0x1450f0[_0xf312('0x32')]['offset']);}return _0x597b6a['getDescriptions'](_0x56c94e);}})[_0xf312('0x25')](function(_0x434bbb){if(_0x434bbb){return _0x434bbb?{'count':_0x3855db,'rows':_0x434bbb}:null;}})[_0xf312('0x25')](respondWithResult(_0xc5b1,null))['catch'](handleError(_0xc5b1,null));}; \ No newline at end of file +var _0xcbeb=['ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','Dynamics365Configuration','rawAttributes','fieldName','map','name','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','include','rows','show','keys','includeAll','merge','options','catch','create','body','find','params','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv'];(function(_0x2b749b,_0x3d31e6){var _0x4e0527=function(_0x30d0a1){while(--_0x30d0a1){_0x2b749b['push'](_0x2b749b['shift']());}};_0x4e0527(++_0x3d31e6);}(_0xcbeb,0xec));var _0xbcbe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcbeb[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xbcbe('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbcbe('0x1'));var jsonpatch=require(_0xbcbe('0x2'));var rp=require(_0xbcbe('0x3'));var moment=require(_0xbcbe('0x4'));var BPromise=require(_0xbcbe('0x5'));var Mustache=require(_0xbcbe('0x6'));var util=require(_0xbcbe('0x7'));var path=require('path');var sox=require(_0xbcbe('0x8'));var csv=require(_0xbcbe('0x9'));var ejs=require(_0xbcbe('0xa'));var fs=require('fs');var fs_extra=require(_0xbcbe('0xb'));var _=require(_0xbcbe('0xc'));var squel=require(_0xbcbe('0xd'));var crypto=require(_0xbcbe('0xe'));var jsforce=require(_0xbcbe('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xbcbe('0x9'));var querystring=require(_0xbcbe('0x10'));var Papa=require('papaparse');var Redis=require(_0xbcbe('0x11'));var authService=require(_0xbcbe('0x12'));var qs=require(_0xbcbe('0x13'));var as=require(_0xbcbe('0x14'));var hardwareService=require(_0xbcbe('0x15'));var logger=require('../../config/logger')(_0xbcbe('0x16'));var utils=require(_0xbcbe('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xbcbe('0x18'));var db=require(_0xbcbe('0x19'))['db'];function respondWithStatusCode(_0x2ebe4f,_0x11e846){_0x11e846=_0x11e846||0xcc;return function(_0x5d4b0c){if(_0x5d4b0c){return _0x2ebe4f[_0xbcbe('0x1a')](_0x11e846);}return _0x2ebe4f['status'](_0x11e846)[_0xbcbe('0x1b')]();};}function respondWithResult(_0x48d6a8,_0x86765b){_0x86765b=_0x86765b||0xc8;return function(_0x5b69d6){if(_0x5b69d6){return _0x48d6a8[_0xbcbe('0x1c')](_0x86765b)[_0xbcbe('0x1d')](_0x5b69d6);}};}function respondWithFilteredResult(_0x2508d0,_0x479e9b){return function(_0x36f83d){if(_0x36f83d){var _0x15daeb=typeof _0x479e9b[_0xbcbe('0x1e')]===_0xbcbe('0x1f')&&typeof _0x479e9b[_0xbcbe('0x20')]===_0xbcbe('0x1f');var _0x307009=_0x36f83d['count'];var _0xf29ab5=_0x15daeb?0x0:_0x479e9b[_0xbcbe('0x1e')];var _0x984528=_0x15daeb?_0x36f83d[_0xbcbe('0x21')]:_0x479e9b['offset']+_0x479e9b[_0xbcbe('0x20')];var _0x316cbf;if(_0x984528>=_0x307009){_0x984528=_0x307009;_0x316cbf=0xc8;}else{_0x316cbf=0xce;}_0x2508d0['status'](_0x316cbf);return _0x2508d0[_0xbcbe('0x22')](_0xbcbe('0x23'),_0xf29ab5+'-'+_0x984528+'/'+_0x307009)[_0xbcbe('0x1d')](_0x36f83d);}return null;};}function patchUpdates(_0x35553c){return function(_0x27ea57){try{jsonpatch[_0xbcbe('0x24')](_0x27ea57,_0x35553c,!![]);}catch(_0x1a31c2){return BPromise[_0xbcbe('0x25')](_0x1a31c2);}return _0x27ea57[_0xbcbe('0x26')]();};}function saveUpdates(_0x437ba3,_0x57d8fa){return function(_0x1b58dc){if(_0x1b58dc){return _0x1b58dc[_0xbcbe('0x27')](_0x437ba3)[_0xbcbe('0x28')](function(_0xb6694b){return _0xb6694b;});}return null;};}function removeEntity(_0x215683,_0x595d73){return function(_0x54d525){if(_0x54d525){return _0x54d525[_0xbcbe('0x29')]()[_0xbcbe('0x28')](function(){_0x215683[_0xbcbe('0x1c')](0xcc)[_0xbcbe('0x1b')]();});}};}function handleEntityNotFound(_0x1d3c61,_0x2523a3){return function(_0x40e459){if(!_0x40e459){_0x1d3c61[_0xbcbe('0x1a')](0x194);}return _0x40e459;};}function handleError(_0x30cc80,_0x34b5d0){_0x34b5d0=_0x34b5d0||0x1f4;return function(_0x23ba4d){logger[_0xbcbe('0x2a')](_0x23ba4d[_0xbcbe('0x2b')]);if(_0x23ba4d['name']){delete _0x23ba4d['name'];}_0x30cc80['status'](_0x34b5d0)[_0xbcbe('0x2c')](_0x23ba4d);};}exports['index']=function(_0x20ab01,_0x9d0363){var _0x1ab6b2={},_0x214a28={},_0x8cad58={'count':0x0,'rows':[]};var _0x2d89d9=_['map'](db[_0xbcbe('0x2d')][_0xbcbe('0x2e')],function(_0x23d830){return{'name':_0x23d830[_0xbcbe('0x2f')],'type':_0x23d830['type']['key']};});_0x214a28['model']=_[_0xbcbe('0x30')](_0x2d89d9,_0xbcbe('0x31'));_0x214a28[_0xbcbe('0x32')]=_['keys'](_0x20ab01['query']);_0x214a28[_0xbcbe('0x33')]=_['intersection'](_0x214a28[_0xbcbe('0x34')],_0x214a28[_0xbcbe('0x32')]);_0x1ab6b2['attributes']=_[_0xbcbe('0x35')](_0x214a28['model'],qs[_0xbcbe('0x36')](_0x20ab01[_0xbcbe('0x32')][_0xbcbe('0x36')]));_0x1ab6b2[_0xbcbe('0x37')]=_0x1ab6b2[_0xbcbe('0x37')][_0xbcbe('0x38')]?_0x1ab6b2[_0xbcbe('0x37')]:_0x214a28[_0xbcbe('0x34')];if(!_0x20ab01['query'][_0xbcbe('0x39')](_0xbcbe('0x3a'))){_0x1ab6b2['limit']=qs[_0xbcbe('0x20')](_0x20ab01['query'][_0xbcbe('0x20')]);_0x1ab6b2[_0xbcbe('0x1e')]=qs[_0xbcbe('0x1e')](_0x20ab01[_0xbcbe('0x32')][_0xbcbe('0x1e')]);}_0x1ab6b2[_0xbcbe('0x3b')]=qs[_0xbcbe('0x3c')](_0x20ab01[_0xbcbe('0x32')]['sort']);_0x1ab6b2[_0xbcbe('0x3d')]=qs[_0xbcbe('0x33')](_[_0xbcbe('0x3e')](_0x20ab01['query'],_0x214a28[_0xbcbe('0x33')]),_0x2d89d9);if(_0x20ab01[_0xbcbe('0x32')][_0xbcbe('0x3f')]){_0x1ab6b2[_0xbcbe('0x3d')]=_['merge'](_0x1ab6b2['where'],{'$or':_[_0xbcbe('0x30')](_0x2d89d9,function(_0x157a74){if(_0x157a74[_0xbcbe('0x40')]!=='VIRTUAL'){var _0x208a76={};_0x208a76[_0x157a74['name']]={'$like':'%'+_0x20ab01[_0xbcbe('0x32')]['filter']+'%'};return _0x208a76;}})});}_0x1ab6b2=_['merge']({},_0x1ab6b2,_0x20ab01['options']);var _0x21c4a3={'where':_0x1ab6b2[_0xbcbe('0x3d')]};return db[_0xbcbe('0x2d')][_0xbcbe('0x21')](_0x21c4a3)[_0xbcbe('0x28')](function(_0x28c1cd){_0x8cad58['count']=_0x28c1cd;if(_0x20ab01[_0xbcbe('0x32')]['includeAll']){_0x1ab6b2[_0xbcbe('0x41')]=[{'all':!![]}];}return db[_0xbcbe('0x2d')]['findAll'](_0x1ab6b2);})[_0xbcbe('0x28')](function(_0x540cf4){_0x8cad58[_0xbcbe('0x42')]=_0x540cf4;return _0x8cad58;})[_0xbcbe('0x28')](respondWithFilteredResult(_0x9d0363,_0x1ab6b2))['catch'](handleError(_0x9d0363,null));};exports[_0xbcbe('0x43')]=function(_0x2187d8,_0x57e9e4){var _0x3b1e95={'raw':![],'where':{'id':_0x2187d8['params']['id']}},_0x1f14cf={};_0x1f14cf[_0xbcbe('0x34')]=_[_0xbcbe('0x44')](db[_0xbcbe('0x2d')][_0xbcbe('0x2e')]);_0x1f14cf[_0xbcbe('0x32')]=_[_0xbcbe('0x44')](_0x2187d8['query']);_0x1f14cf[_0xbcbe('0x33')]=_[_0xbcbe('0x35')](_0x1f14cf['model'],_0x1f14cf['query']);_0x3b1e95[_0xbcbe('0x37')]=_[_0xbcbe('0x35')](_0x1f14cf[_0xbcbe('0x34')],qs[_0xbcbe('0x36')](_0x2187d8['query']['fields']));_0x3b1e95[_0xbcbe('0x37')]=_0x3b1e95[_0xbcbe('0x37')][_0xbcbe('0x38')]?_0x3b1e95[_0xbcbe('0x37')]:_0x1f14cf[_0xbcbe('0x34')];if(_0x2187d8[_0xbcbe('0x32')][_0xbcbe('0x45')]){_0x3b1e95[_0xbcbe('0x41')]=[{'all':!![]}];}_0x3b1e95=_[_0xbcbe('0x46')]({},_0x3b1e95,_0x2187d8[_0xbcbe('0x47')]);return db[_0xbcbe('0x2d')]['find'](_0x3b1e95)[_0xbcbe('0x28')](handleEntityNotFound(_0x57e9e4,null))[_0xbcbe('0x28')](respondWithResult(_0x57e9e4,null))[_0xbcbe('0x48')](handleError(_0x57e9e4,null));};exports[_0xbcbe('0x49')]=function(_0x4b6e4e,_0xfca5fa){return db[_0xbcbe('0x2d')][_0xbcbe('0x49')](_0x4b6e4e[_0xbcbe('0x4a')],{})['then'](respondWithResult(_0xfca5fa,0xc9))[_0xbcbe('0x48')](handleError(_0xfca5fa,null));};exports[_0xbcbe('0x27')]=function(_0x77a791,_0x5b3a7){if(_0x77a791[_0xbcbe('0x4a')]['id']){delete _0x77a791[_0xbcbe('0x4a')]['id'];}return db[_0xbcbe('0x2d')][_0xbcbe('0x4b')]({'where':{'id':_0x77a791[_0xbcbe('0x4c')]['id']}})[_0xbcbe('0x28')](handleEntityNotFound(_0x5b3a7,null))[_0xbcbe('0x28')](saveUpdates(_0x77a791[_0xbcbe('0x4a')],null))[_0xbcbe('0x28')](respondWithResult(_0x5b3a7,null))[_0xbcbe('0x48')](handleError(_0x5b3a7,null));};exports['destroy']=function(_0x597be3,_0x3c1f45){return db[_0xbcbe('0x2d')][_0xbcbe('0x4b')]({'where':{'id':_0x597be3[_0xbcbe('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3c1f45,null))[_0xbcbe('0x28')](removeEntity(_0x3c1f45,null))[_0xbcbe('0x48')](handleError(_0x3c1f45,null));};exports[_0xbcbe('0x4d')]=function(_0x27a8e3,_0x386be6,_0x35d32e){var _0x313b01={};var _0x48f5cf={};var _0x28965a;var _0x4b3f8b;return db['Dynamics365Configuration'][_0xbcbe('0x4e')]({'where':{'id':_0x27a8e3['params']['id']}})[_0xbcbe('0x28')](handleEntityNotFound(_0x386be6,null))[_0xbcbe('0x28')](function(_0x5ef4d5){if(_0x5ef4d5){_0x28965a=_0x5ef4d5;_0x48f5cf[_0xbcbe('0x34')]=_[_0xbcbe('0x44')](db[_0xbcbe('0x4f')]['rawAttributes']);_0x48f5cf['query']=_['keys'](_0x27a8e3[_0xbcbe('0x32')]);_0x48f5cf[_0xbcbe('0x33')]=_[_0xbcbe('0x35')](_0x48f5cf[_0xbcbe('0x34')],_0x48f5cf['query']);_0x313b01[_0xbcbe('0x37')]=_[_0xbcbe('0x35')](_0x48f5cf[_0xbcbe('0x34')],qs[_0xbcbe('0x36')](_0x27a8e3[_0xbcbe('0x32')][_0xbcbe('0x36')]));_0x313b01['attributes']=_0x313b01[_0xbcbe('0x37')]['length']?_0x313b01[_0xbcbe('0x37')]:_0x48f5cf[_0xbcbe('0x34')];_0x313b01[_0xbcbe('0x3b')]=qs['sort'](_0x27a8e3['query'][_0xbcbe('0x3c')]);_0x313b01[_0xbcbe('0x3d')]=qs[_0xbcbe('0x33')](_[_0xbcbe('0x3e')](_0x27a8e3[_0xbcbe('0x32')],_0x48f5cf[_0xbcbe('0x33')]));if(_0x27a8e3[_0xbcbe('0x32')][_0xbcbe('0x3f')]){_0x313b01[_0xbcbe('0x3d')]=_[_0xbcbe('0x46')](_0x313b01['where'],{'$or':_['map'](_0x313b01[_0xbcbe('0x37')],function(_0x38ed0d){var _0x1abfd4={};_0x1abfd4[_0x38ed0d]={'$like':'%'+_0x27a8e3[_0xbcbe('0x32')][_0xbcbe('0x3f')]+'%'};return _0x1abfd4;})});}_0x313b01=_[_0xbcbe('0x46')]({},_0x313b01,_0x27a8e3['options']);return _0x28965a[_0xbcbe('0x4d')](_0x313b01);}})[_0xbcbe('0x28')](function(_0x8c1145){if(_0x8c1145){_0x4b3f8b=_0x8c1145['length'];if(!_0x27a8e3[_0xbcbe('0x32')][_0xbcbe('0x39')]('nolimit')){_0x313b01[_0xbcbe('0x20')]=qs[_0xbcbe('0x20')](_0x27a8e3[_0xbcbe('0x32')][_0xbcbe('0x20')]);_0x313b01[_0xbcbe('0x1e')]=qs['offset'](_0x27a8e3['query'][_0xbcbe('0x1e')]);}return _0x28965a[_0xbcbe('0x4d')](_0x313b01);}})['then'](function(_0x5cc2a1){if(_0x5cc2a1){return _0x5cc2a1?{'count':_0x4b3f8b,'rows':_0x5cc2a1}:null;}})[_0xbcbe('0x28')](respondWithResult(_0x386be6,null))[_0xbcbe('0x48')](handleError(_0x386be6,null));};exports[_0xbcbe('0x50')]=function(_0x335fb2,_0x5b919f,_0xb87df2){var _0x5efa29={};var _0x5a2fb1={};var _0x1413c8;var _0x5351c3;return db[_0xbcbe('0x2d')][_0xbcbe('0x4e')]({'where':{'id':_0x335fb2['params']['id']}})[_0xbcbe('0x28')](handleEntityNotFound(_0x5b919f,null))[_0xbcbe('0x28')](function(_0x3da386){if(_0x3da386){_0x1413c8=_0x3da386;_0x5a2fb1['model']=_[_0xbcbe('0x44')](db['Dynamics365Field'][_0xbcbe('0x2e')]);_0x5a2fb1[_0xbcbe('0x32')]=_['keys'](_0x335fb2[_0xbcbe('0x32')]);_0x5a2fb1[_0xbcbe('0x33')]=_[_0xbcbe('0x35')](_0x5a2fb1[_0xbcbe('0x34')],_0x5a2fb1['query']);_0x5efa29[_0xbcbe('0x37')]=_[_0xbcbe('0x35')](_0x5a2fb1[_0xbcbe('0x34')],qs[_0xbcbe('0x36')](_0x335fb2[_0xbcbe('0x32')]['fields']));_0x5efa29[_0xbcbe('0x37')]=_0x5efa29['attributes']['length']?_0x5efa29['attributes']:_0x5a2fb1[_0xbcbe('0x34')];_0x5efa29['order']=qs[_0xbcbe('0x3c')](_0x335fb2['query'][_0xbcbe('0x3c')]);_0x5efa29[_0xbcbe('0x3d')]=qs[_0xbcbe('0x33')](_[_0xbcbe('0x3e')](_0x335fb2[_0xbcbe('0x32')],_0x5a2fb1[_0xbcbe('0x33')]));if(_0x335fb2[_0xbcbe('0x32')][_0xbcbe('0x3f')]){_0x5efa29[_0xbcbe('0x3d')]=_[_0xbcbe('0x46')](_0x5efa29[_0xbcbe('0x3d')],{'$or':_[_0xbcbe('0x30')](_0x5efa29[_0xbcbe('0x37')],function(_0x28b9ee){var _0x26bac8={};_0x26bac8[_0x28b9ee]={'$like':'%'+_0x335fb2[_0xbcbe('0x32')][_0xbcbe('0x3f')]+'%'};return _0x26bac8;})});}_0x5efa29=_[_0xbcbe('0x46')]({},_0x5efa29,_0x335fb2[_0xbcbe('0x47')]);return _0x1413c8[_0xbcbe('0x50')](_0x5efa29);}})[_0xbcbe('0x28')](function(_0x3772de){if(_0x3772de){_0x5351c3=_0x3772de['length'];if(!_0x335fb2[_0xbcbe('0x32')][_0xbcbe('0x39')](_0xbcbe('0x3a'))){_0x5efa29[_0xbcbe('0x20')]=qs[_0xbcbe('0x20')](_0x335fb2[_0xbcbe('0x32')]['limit']);_0x5efa29[_0xbcbe('0x1e')]=qs[_0xbcbe('0x1e')](_0x335fb2[_0xbcbe('0x32')][_0xbcbe('0x1e')]);}return _0x1413c8[_0xbcbe('0x50')](_0x5efa29);}})[_0xbcbe('0x28')](function(_0x48c880){if(_0x48c880){return _0x48c880?{'count':_0x5351c3,'rows':_0x48c880}:null;}})[_0xbcbe('0x28')](respondWithResult(_0x5b919f,null))[_0xbcbe('0x48')](handleError(_0x5b919f,null));};exports[_0xbcbe('0x51')]=function(_0x55da6e,_0xa3ee5a,_0x1ce7df){var _0x24bd30={};var _0x43d5d4={};var _0x2a3b4e;var _0x4162a1;return db['Dynamics365Configuration'][_0xbcbe('0x4e')]({'where':{'id':_0x55da6e['params']['id']}})['then'](handleEntityNotFound(_0xa3ee5a,null))[_0xbcbe('0x28')](function(_0x2e556a){if(_0x2e556a){_0x2a3b4e=_0x2e556a;_0x43d5d4[_0xbcbe('0x34')]=_[_0xbcbe('0x44')](db[_0xbcbe('0x4f')][_0xbcbe('0x2e')]);_0x43d5d4[_0xbcbe('0x32')]=_['keys'](_0x55da6e['query']);_0x43d5d4[_0xbcbe('0x33')]=_[_0xbcbe('0x35')](_0x43d5d4[_0xbcbe('0x34')],_0x43d5d4[_0xbcbe('0x32')]);_0x24bd30[_0xbcbe('0x37')]=_['intersection'](_0x43d5d4[_0xbcbe('0x34')],qs[_0xbcbe('0x36')](_0x55da6e[_0xbcbe('0x32')][_0xbcbe('0x36')]));_0x24bd30['attributes']=_0x24bd30[_0xbcbe('0x37')][_0xbcbe('0x38')]?_0x24bd30[_0xbcbe('0x37')]:_0x43d5d4['model'];_0x24bd30['order']=qs[_0xbcbe('0x3c')](_0x55da6e['query'][_0xbcbe('0x3c')]);_0x24bd30[_0xbcbe('0x3d')]=qs[_0xbcbe('0x33')](_[_0xbcbe('0x3e')](_0x55da6e[_0xbcbe('0x32')],_0x43d5d4[_0xbcbe('0x33')]));if(_0x55da6e['query']['filter']){_0x24bd30[_0xbcbe('0x3d')]=_[_0xbcbe('0x46')](_0x24bd30[_0xbcbe('0x3d')],{'$or':_[_0xbcbe('0x30')](_0x24bd30['attributes'],function(_0x422104){var _0x2ad1db={};_0x2ad1db[_0x422104]={'$like':'%'+_0x55da6e[_0xbcbe('0x32')]['filter']+'%'};return _0x2ad1db;})});}_0x24bd30=_['merge']({},_0x24bd30,_0x55da6e[_0xbcbe('0x47')]);return _0x2a3b4e[_0xbcbe('0x51')](_0x24bd30);}})[_0xbcbe('0x28')](function(_0x10824c){if(_0x10824c){_0x4162a1=_0x10824c[_0xbcbe('0x38')];if(!_0x55da6e[_0xbcbe('0x32')][_0xbcbe('0x39')](_0xbcbe('0x3a'))){_0x24bd30['limit']=qs[_0xbcbe('0x20')](_0x55da6e[_0xbcbe('0x32')][_0xbcbe('0x20')]);_0x24bd30[_0xbcbe('0x1e')]=qs[_0xbcbe('0x1e')](_0x55da6e['query'][_0xbcbe('0x1e')]);}return _0x2a3b4e[_0xbcbe('0x51')](_0x24bd30);}})[_0xbcbe('0x28')](function(_0x2517ed){if(_0x2517ed){return _0x2517ed?{'count':_0x4162a1,'rows':_0x2517ed}:null;}})[_0xbcbe('0x28')](respondWithResult(_0xa3ee5a,null))['catch'](handleError(_0xa3ee5a,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index e7a9ced..546f166 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x57ae88,_0x2e984d){var _0x1ccebe=function(_0x42904e){while(--_0x42904e){_0x57ae88['push'](_0x57ae88['shift']());}};_0x1ccebe(++_0x2e984d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','Dynamics365Configuration','int_dynamics365_configurations','lodash','../../config/logger','api','moment','path','../../config/environment','./intDynamics365Configuration.attributes'];(function(_0x6be9d9,_0x153d7e){var _0x43858f=function(_0x10bc51){while(--_0x10bc51){_0x6be9d9['push'](_0x6be9d9['shift']());}};_0x43858f(++_0x153d7e);}(_0x3e74,0x175));var _0x43e7=function(_0x26dff,_0x17871e){_0x26dff=_0x26dff-0x0;var _0x18a19b=_0x3e74[_0x26dff];return _0x18a19b;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 6951fbd..dca24e5 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 _0x74b4=['../../config/logger','rpc','jayson/promise','client','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x541260,_0x4c7f2e){var _0x1dd2b5=function(_0x4140de){while(--_0x4140de){_0x541260['push'](_0x541260['shift']());}};_0x1dd2b5(++_0x4c7f2e);}(_0x74b4,0xf6));var _0x474b=function(_0x4c463b,_0x505103){_0x4c463b=_0x4c463b-0x0;var _0x199240=_0x74b4[_0x4c463b];return _0x199240;};'use strict';var _=require(_0x474b('0x0'));var util=require(_0x474b('0x1'));var moment=require(_0x474b('0x2'));var BPromise=require('bluebird');var rs=require(_0x474b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x474b('0x4'))['db'];var utils=require(_0x474b('0x5'));var logger=require(_0x474b('0x6'))(_0x474b('0x7'));var config=require('../../config/environment');var jayson=require(_0x474b('0x8'));var client=jayson[_0x474b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f09b0,_0x4c0885,_0x5e4bb0){return new BPromise(function(_0x388957,_0x23451b){return client[_0x474b('0xa')](_0x4f09b0,_0x5e4bb0)[_0x474b('0xb')](function(_0x4a6fa0){logger[_0x474b('0xc')](_0x474b('0xd'),_0x4c0885,_0x474b('0xe'));logger[_0x474b('0xf')](_0x474b('0x10'),_0x4c0885,'request\x20sent',JSON[_0x474b('0x11')](_0x4a6fa0));if(_0x4a6fa0[_0x474b('0x12')]){if(_0x4a6fa0[_0x474b('0x12')]['code']===0x1f4){logger['error'](_0x474b('0xd'),_0x4c0885,_0x4a6fa0[_0x474b('0x12')][_0x474b('0x13')]);return _0x23451b(_0x4a6fa0['error'][_0x474b('0x13')]);}logger[_0x474b('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4c0885,_0x4a6fa0[_0x474b('0x12')]['message']);return _0x388957(_0x4a6fa0[_0x474b('0x12')][_0x474b('0x13')]);}else{logger[_0x474b('0xc')](_0x474b('0xd'),_0x4c0885,_0x474b('0xe'));_0x388957(_0x4a6fa0[_0x474b('0x14')][_0x474b('0x13')]);}})['catch'](function(_0x27f645){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x4c0885,_0x27f645);_0x23451b(_0x27f645);});});} \ No newline at end of file +var _0x2e26=['../../config/environment','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0x2e26,0x195));var _0x62e2=function(_0x164609,_0x45890e){_0x164609=_0x164609-0x0;var _0x4a1a05=_0x2e26[_0x164609];return _0x4a1a05;};'use strict';var _=require(_0x62e2('0x0'));var util=require(_0x62e2('0x1'));var moment=require(_0x62e2('0x2'));var BPromise=require(_0x62e2('0x3'));var rs=require(_0x62e2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x62e2('0x5'))['db'];var utils=require(_0x62e2('0x6'));var logger=require(_0x62e2('0x7'))(_0x62e2('0x8'));var config=require(_0x62e2('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x62e2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xeb45b0,_0x415ae4,_0x179861){return new BPromise(function(_0x3b3ce5,_0x425951){return client[_0x62e2('0xb')](_0xeb45b0,_0x179861)[_0x62e2('0xc')](function(_0x3da2d0){logger['info'](_0x62e2('0xd'),_0x415ae4,_0x62e2('0xe'));logger['debug'](_0x62e2('0xf'),_0x415ae4,_0x62e2('0xe'),JSON[_0x62e2('0x10')](_0x3da2d0));if(_0x3da2d0[_0x62e2('0x11')]){if(_0x3da2d0[_0x62e2('0x11')][_0x62e2('0x12')]===0x1f4){logger[_0x62e2('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x415ae4,_0x3da2d0['error']['message']);return _0x425951(_0x3da2d0['error'][_0x62e2('0x13')]);}logger[_0x62e2('0x11')](_0x62e2('0xd'),_0x415ae4,_0x3da2d0['error']['message']);return _0x3b3ce5(_0x3da2d0[_0x62e2('0x11')]['message']);}else{logger[_0x62e2('0x14')]('Dynamics365Configuration,\x20%s,\x20%s',_0x415ae4,_0x62e2('0xe'));_0x3b3ce5(_0x3da2d0[_0x62e2('0x15')][_0x62e2('0x13')]);}})[_0x62e2('0x16')](function(_0xaab758){logger[_0x62e2('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x415ae4,_0xaab758);_0x425951(_0xaab758);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 0940e7b..8f43b87 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 _0xabc4=['create','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','/:id','isAuthenticated','show'];(function(_0x2181b1,_0x569637){var _0x530548=function(_0x4b31f1){while(--_0x4b31f1){_0x2181b1['push'](_0x2181b1['shift']());}};_0x530548(++_0x569637);}(_0xabc4,0x159));var _0x4abc=function(_0x14e201,_0x31e6d7){_0x14e201=_0x14e201-0x0;var _0x1f0fa0=_0xabc4[_0x14e201];return _0x1f0fa0;};'use strict';var multer=require(_0x4abc('0x0'));var util=require(_0x4abc('0x1'));var path=require(_0x4abc('0x2'));var timeout=require(_0x4abc('0x3'));var express=require(_0x4abc('0x4'));var router=express[_0x4abc('0x5')]();var fs_extra=require(_0x4abc('0x6'));var auth=require(_0x4abc('0x7'));var interaction=require(_0x4abc('0x8'));var config=require(_0x4abc('0x9'));var controller=require(_0x4abc('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x4abc('0xb')](_0x4abc('0xc'),auth[_0x4abc('0xd')](),controller[_0x4abc('0xe')]);router['post']('/',auth[_0x4abc('0xd')](),controller[_0x4abc('0xf')]);router['put'](_0x4abc('0xc'),auth[_0x4abc('0xd')](),controller[_0x4abc('0x10')]);router['delete'](_0x4abc('0xc'),auth[_0x4abc('0xd')](),controller[_0x4abc('0x11')]);module['exports']=router; \ No newline at end of file +var _0x5adf=['show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','isAuthenticated','index','/:id'];(function(_0x2892da,_0x191a40){var _0x28cff2=function(_0x57023d){while(--_0x57023d){_0x2892da['push'](_0x2892da['shift']());}};_0x28cff2(++_0x191a40);}(_0x5adf,0xec));var _0xf5ad=function(_0x1f0db1,_0x165082){_0x1f0db1=_0x1f0db1-0x0;var _0x54f2a1=_0x5adf[_0x1f0db1];return _0x54f2a1;};'use strict';var multer=require('multer');var util=require(_0xf5ad('0x0'));var path=require(_0xf5ad('0x1'));var timeout=require(_0xf5ad('0x2'));var express=require('express');var router=express[_0xf5ad('0x3')]();var fs_extra=require(_0xf5ad('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf5ad('0x5'));var config=require(_0xf5ad('0x6'));var controller=require(_0xf5ad('0x7'));router['get']('/',auth[_0xf5ad('0x8')](),controller[_0xf5ad('0x9')]);router['get'](_0xf5ad('0xa'),auth['isAuthenticated'](),controller[_0xf5ad('0xb')]);router[_0xf5ad('0xc')]('/',auth[_0xf5ad('0x8')](),controller[_0xf5ad('0xd')]);router[_0xf5ad('0xe')](_0xf5ad('0xa'),auth[_0xf5ad('0x8')](),controller[_0xf5ad('0xf')]);router[_0xf5ad('0x10')](_0xf5ad('0xa'),auth['isAuthenticated'](),controller[_0xf5ad('0x11')]);module[_0xf5ad('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 4dbc270..67f5406 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 _0x71c9=['string','variable','customVariable','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x70303d,_0x57e18d){var _0x497bcd=function(_0x351cea){while(--_0x351cea){_0x70303d['push'](_0x70303d['shift']());}};_0x497bcd(++_0x57e18d);}(_0x71c9,0x155));var _0x971c=function(_0x1eb579,_0x25b313){_0x1eb579=_0x1eb579-0x0;var _0x4d9e27=_0x71c9[_0x1eb579];return _0x4d9e27;};'use strict';var Sequelize=require(_0x971c('0x0'));module[_0x971c('0x1')]={'type':{'type':Sequelize[_0x971c('0x2')](_0x971c('0x3'),_0x971c('0x4'),_0x971c('0x5'),'keyValue','picklist'),'defaultValue':_0x971c('0x3')},'content':{'type':Sequelize[_0x971c('0x6')]},'key':{'type':Sequelize[_0x971c('0x6')]},'keyType':{'type':Sequelize[_0x971c('0x2')](_0x971c('0x3'),'variable',_0x971c('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x971c('0x6')]},'nameField':{'type':Sequelize[_0x971c('0x6')]},'customField':{'type':Sequelize[_0x971c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x405e=['string','variable','customVariable','keyValue','picklist','STRING','ENUM','sequelize','exports'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x405e,0x1ae));var _0xe405=function(_0x5ab34c,_0x1910ad){_0x5ab34c=_0x5ab34c-0x0;var _0x4cc833=_0x405e[_0x5ab34c];return _0x4cc833;};'use strict';var Sequelize=require(_0xe405('0x0'));module[_0xe405('0x1')]={'type':{'type':Sequelize['ENUM'](_0xe405('0x2'),_0xe405('0x3'),_0xe405('0x4'),_0xe405('0x5'),_0xe405('0x6')),'defaultValue':_0xe405('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xe405('0x7')]},'keyType':{'type':Sequelize[_0xe405('0x8')](_0xe405('0x2'),_0xe405('0x3'),_0xe405('0x4'))},'keyContent':{'type':Sequelize[_0xe405('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xe405('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe405('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 0f5ed62..c2e0de5 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 _0x2d2c=['map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','Dynamics365Field','include','findAll','rows','catch','merge','options','create','body','find','params','destroy','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','name','index','rawAttributes','type','model'];(function(_0x2a1a9f,_0x378103){var _0x860aac=function(_0x216b51){while(--_0x216b51){_0x2a1a9f['push'](_0x2a1a9f['shift']());}};_0x860aac(++_0x378103);}(_0x2d2c,0x191));var _0xc2d2=function(_0x48b6c6,_0xba4073){_0x48b6c6=_0x48b6c6-0x0;var _0x1bcc9a=_0x2d2c[_0x48b6c6];return _0x1bcc9a;};'use strict';var emlformat=require(_0xc2d2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc2d2('0x1'));var rp=require(_0xc2d2('0x2'));var moment=require(_0xc2d2('0x3'));var BPromise=require(_0xc2d2('0x4'));var Mustache=require(_0xc2d2('0x5'));var util=require(_0xc2d2('0x6'));var path=require(_0xc2d2('0x7'));var sox=require(_0xc2d2('0x8'));var csv=require(_0xc2d2('0x9'));var ejs=require(_0xc2d2('0xa'));var fs=require('fs');var fs_extra=require(_0xc2d2('0xb'));var _=require(_0xc2d2('0xc'));var squel=require(_0xc2d2('0xd'));var crypto=require('crypto');var jsforce=require(_0xc2d2('0xe'));var deskjs=require(_0xc2d2('0xf'));var toCsv=require(_0xc2d2('0x9'));var querystring=require('querystring');var Papa=require(_0xc2d2('0x10'));var Redis=require(_0xc2d2('0x11'));var authService=require(_0xc2d2('0x12'));var qs=require(_0xc2d2('0x13'));var as=require(_0xc2d2('0x14'));var hardwareService=require(_0xc2d2('0x15'));var logger=require(_0xc2d2('0x16'))(_0xc2d2('0x17'));var utils=require(_0xc2d2('0x18'));var config=require(_0xc2d2('0x19'));var licenseUtil=require(_0xc2d2('0x1a'));var db=require(_0xc2d2('0x1b'))['db'];function respondWithStatusCode(_0x48caa1,_0x461e1c){_0x461e1c=_0x461e1c||0xcc;return function(_0x32a565){if(_0x32a565){return _0x48caa1['sendStatus'](_0x461e1c);}return _0x48caa1[_0xc2d2('0x1c')](_0x461e1c)[_0xc2d2('0x1d')]();};}function respondWithResult(_0x4512d0,_0x420139){_0x420139=_0x420139||0xc8;return function(_0x2da026){if(_0x2da026){return _0x4512d0[_0xc2d2('0x1c')](_0x420139)['json'](_0x2da026);}};}function respondWithFilteredResult(_0x4e90e0,_0x5e339d){return function(_0x2f2b14){if(_0x2f2b14){var _0x4d518c=typeof _0x5e339d[_0xc2d2('0x1e')]===_0xc2d2('0x1f')&&typeof _0x5e339d[_0xc2d2('0x20')]===_0xc2d2('0x1f');var _0x46e726=_0x2f2b14[_0xc2d2('0x21')];var _0x552d6a=_0x4d518c?0x0:_0x5e339d[_0xc2d2('0x1e')];var _0x199df6=_0x4d518c?_0x2f2b14[_0xc2d2('0x21')]:_0x5e339d[_0xc2d2('0x1e')]+_0x5e339d['limit'];var _0x591dfc;if(_0x199df6>=_0x46e726){_0x199df6=_0x46e726;_0x591dfc=0xc8;}else{_0x591dfc=0xce;}_0x4e90e0[_0xc2d2('0x1c')](_0x591dfc);return _0x4e90e0[_0xc2d2('0x22')](_0xc2d2('0x23'),_0x552d6a+'-'+_0x199df6+'/'+_0x46e726)[_0xc2d2('0x24')](_0x2f2b14);}return null;};}function patchUpdates(_0x4852d0){return function(_0x5124e3){try{jsonpatch[_0xc2d2('0x25')](_0x5124e3,_0x4852d0,!![]);}catch(_0xdfdcb4){return BPromise[_0xc2d2('0x26')](_0xdfdcb4);}return _0x5124e3[_0xc2d2('0x27')]();};}function saveUpdates(_0x4b7bf9,_0x3843a8){return function(_0x4d7b21){if(_0x4d7b21){return _0x4d7b21[_0xc2d2('0x28')](_0x4b7bf9)[_0xc2d2('0x29')](function(_0x15b4d6){return _0x15b4d6;});}return null;};}function removeEntity(_0x432fe9,_0x2ea191){return function(_0xe93cf6){if(_0xe93cf6){return _0xe93cf6['destroy']()['then'](function(){_0x432fe9[_0xc2d2('0x1c')](0xcc)[_0xc2d2('0x1d')]();});}};}function handleEntityNotFound(_0x27ff0b,_0x2e22e5){return function(_0x4c8df3){if(!_0x4c8df3){_0x27ff0b[_0xc2d2('0x2a')](0x194);}return _0x4c8df3;};}function handleError(_0x11301d,_0x36d35d){_0x36d35d=_0x36d35d||0x1f4;return function(_0x385065){logger[_0xc2d2('0x2b')](_0x385065['stack']);if(_0x385065[_0xc2d2('0x2c')]){delete _0x385065[_0xc2d2('0x2c')];}_0x11301d[_0xc2d2('0x1c')](_0x36d35d)['send'](_0x385065);};}exports[_0xc2d2('0x2d')]=function(_0x3fb06a,_0x1e557b){var _0xba880={},_0x1d34ef={},_0x304263={'count':0x0,'rows':[]};var _0x7b166d=_['map'](db['Dynamics365Field'][_0xc2d2('0x2e')],function(_0x1f786f){return{'name':_0x1f786f['fieldName'],'type':_0x1f786f[_0xc2d2('0x2f')]['key']};});_0x1d34ef[_0xc2d2('0x30')]=_[_0xc2d2('0x31')](_0x7b166d,_0xc2d2('0x2c'));_0x1d34ef[_0xc2d2('0x32')]=_[_0xc2d2('0x33')](_0x3fb06a[_0xc2d2('0x32')]);_0x1d34ef[_0xc2d2('0x34')]=_[_0xc2d2('0x35')](_0x1d34ef[_0xc2d2('0x30')],_0x1d34ef[_0xc2d2('0x32')]);_0xba880['attributes']=_[_0xc2d2('0x35')](_0x1d34ef[_0xc2d2('0x30')],qs['fields'](_0x3fb06a[_0xc2d2('0x32')][_0xc2d2('0x36')]));_0xba880['attributes']=_0xba880[_0xc2d2('0x37')][_0xc2d2('0x38')]?_0xba880[_0xc2d2('0x37')]:_0x1d34ef[_0xc2d2('0x30')];if(!_0x3fb06a[_0xc2d2('0x32')][_0xc2d2('0x39')]('nolimit')){_0xba880['limit']=qs[_0xc2d2('0x20')](_0x3fb06a[_0xc2d2('0x32')][_0xc2d2('0x20')]);_0xba880[_0xc2d2('0x1e')]=qs[_0xc2d2('0x1e')](_0x3fb06a['query']['offset']);}_0xba880[_0xc2d2('0x3a')]=qs[_0xc2d2('0x3b')](_0x3fb06a[_0xc2d2('0x32')]['sort']);_0xba880['where']=qs['filters'](_[_0xc2d2('0x3c')](_0x3fb06a[_0xc2d2('0x32')],_0x1d34ef[_0xc2d2('0x34')]),_0x7b166d);if(_0x3fb06a[_0xc2d2('0x32')][_0xc2d2('0x3d')]){_0xba880['where']=_['merge'](_0xba880['where'],{'$or':_['map'](_0x7b166d,function(_0x5e5c32){if(_0x5e5c32['type']!=='VIRTUAL'){var _0x5aa9f3={};_0x5aa9f3[_0x5e5c32['name']]={'$like':'%'+_0x3fb06a[_0xc2d2('0x32')][_0xc2d2('0x3d')]+'%'};return _0x5aa9f3;}})});}_0xba880=_['merge']({},_0xba880,_0x3fb06a['options']);var _0x3cf537={'where':_0xba880[_0xc2d2('0x3e')]};return db[_0xc2d2('0x3f')][_0xc2d2('0x21')](_0x3cf537)[_0xc2d2('0x29')](function(_0x4e2241){_0x304263['count']=_0x4e2241;if(_0x3fb06a[_0xc2d2('0x32')]['includeAll']){_0xba880[_0xc2d2('0x40')]=[{'all':!![]}];}return db[_0xc2d2('0x3f')][_0xc2d2('0x41')](_0xba880);})[_0xc2d2('0x29')](function(_0x33d87c){_0x304263[_0xc2d2('0x42')]=_0x33d87c;return _0x304263;})[_0xc2d2('0x29')](respondWithFilteredResult(_0x1e557b,_0xba880))[_0xc2d2('0x43')](handleError(_0x1e557b,null));};exports['show']=function(_0x2d8a2c,_0x542e30){var _0x529b65={'raw':!![],'where':{'id':_0x2d8a2c['params']['id']}},_0x264f00={};_0x264f00['model']=_[_0xc2d2('0x33')](db[_0xc2d2('0x3f')][_0xc2d2('0x2e')]);_0x264f00[_0xc2d2('0x32')]=_[_0xc2d2('0x33')](_0x2d8a2c['query']);_0x264f00[_0xc2d2('0x34')]=_[_0xc2d2('0x35')](_0x264f00[_0xc2d2('0x30')],_0x264f00[_0xc2d2('0x32')]);_0x529b65['attributes']=_['intersection'](_0x264f00[_0xc2d2('0x30')],qs[_0xc2d2('0x36')](_0x2d8a2c['query'][_0xc2d2('0x36')]));_0x529b65[_0xc2d2('0x37')]=_0x529b65[_0xc2d2('0x37')][_0xc2d2('0x38')]?_0x529b65['attributes']:_0x264f00[_0xc2d2('0x30')];if(_0x2d8a2c[_0xc2d2('0x32')]['includeAll']){_0x529b65[_0xc2d2('0x40')]=[{'all':!![]}];}_0x529b65=_[_0xc2d2('0x44')]({},_0x529b65,_0x2d8a2c[_0xc2d2('0x45')]);return db[_0xc2d2('0x3f')]['find'](_0x529b65)['then'](handleEntityNotFound(_0x542e30,null))['then'](respondWithResult(_0x542e30,null))[_0xc2d2('0x43')](handleError(_0x542e30,null));};exports[_0xc2d2('0x46')]=function(_0x1149c0,_0x1a5131){return db[_0xc2d2('0x3f')][_0xc2d2('0x46')](_0x1149c0['body'],{})[_0xc2d2('0x29')](respondWithResult(_0x1a5131,0xc9))[_0xc2d2('0x43')](handleError(_0x1a5131,null));};exports[_0xc2d2('0x28')]=function(_0x46ce07,_0x51ca48){if(_0x46ce07[_0xc2d2('0x47')]['id']){delete _0x46ce07[_0xc2d2('0x47')]['id'];}return db[_0xc2d2('0x3f')][_0xc2d2('0x48')]({'where':{'id':_0x46ce07[_0xc2d2('0x49')]['id']}})['then'](handleEntityNotFound(_0x51ca48,null))[_0xc2d2('0x29')](saveUpdates(_0x46ce07[_0xc2d2('0x47')],null))[_0xc2d2('0x29')](respondWithResult(_0x51ca48,null))[_0xc2d2('0x43')](handleError(_0x51ca48,null));};exports[_0xc2d2('0x4a')]=function(_0x2e85f8,_0x8a5636){return db[_0xc2d2('0x3f')][_0xc2d2('0x48')]({'where':{'id':_0x2e85f8[_0xc2d2('0x49')]['id']}})[_0xc2d2('0x29')](handleEntityNotFound(_0x8a5636,null))['then'](removeEntity(_0x8a5636,null))[_0xc2d2('0x43')](handleError(_0x8a5636,null));}; \ No newline at end of file +var _0x9dbf=['status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','Dynamics365Field','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','show','params','rawAttributes','length','find','catch','body','eml-format','zip-dir','fast-json-patch','request-promise','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/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x135c17,_0x1188b2){var _0x2546b0=function(_0x23a1f9){while(--_0x23a1f9){_0x135c17['push'](_0x135c17['shift']());}};_0x2546b0(++_0x1188b2);}(_0x9dbf,0x123));var _0xf9db=function(_0x45c18d,_0x21bf1e){_0x45c18d=_0x45c18d-0x0;var _0x29dd6d=_0x9dbf[_0x45c18d];return _0x29dd6d;};'use strict';var emlformat=require(_0xf9db('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf9db('0x1'));var jsonpatch=require(_0xf9db('0x2'));var rp=require(_0xf9db('0x3'));var moment=require('moment');var BPromise=require(_0xf9db('0x4'));var Mustache=require(_0xf9db('0x5'));var util=require(_0xf9db('0x6'));var path=require(_0xf9db('0x7'));var sox=require(_0xf9db('0x8'));var csv=require(_0xf9db('0x9'));var ejs=require(_0xf9db('0xa'));var fs=require('fs');var fs_extra=require(_0xf9db('0xb'));var _=require(_0xf9db('0xc'));var squel=require(_0xf9db('0xd'));var crypto=require(_0xf9db('0xe'));var jsforce=require(_0xf9db('0xf'));var deskjs=require(_0xf9db('0x10'));var toCsv=require(_0xf9db('0x9'));var querystring=require(_0xf9db('0x11'));var Papa=require('papaparse');var Redis=require(_0xf9db('0x12'));var authService=require(_0xf9db('0x13'));var qs=require(_0xf9db('0x14'));var as=require(_0xf9db('0x15'));var hardwareService=require(_0xf9db('0x16'));var logger=require(_0xf9db('0x17'))(_0xf9db('0x18'));var utils=require('../../config/utils');var config=require(_0xf9db('0x19'));var licenseUtil=require(_0xf9db('0x1a'));var db=require(_0xf9db('0x1b'))['db'];function respondWithStatusCode(_0x79a72c,_0x388b16){_0x388b16=_0x388b16||0xcc;return function(_0x1be991){if(_0x1be991){return _0x79a72c[_0xf9db('0x1c')](_0x388b16);}return _0x79a72c[_0xf9db('0x1d')](_0x388b16)['end']();};}function respondWithResult(_0x1bad50,_0x26748c){_0x26748c=_0x26748c||0xc8;return function(_0x66f171){if(_0x66f171){return _0x1bad50[_0xf9db('0x1d')](_0x26748c)[_0xf9db('0x1e')](_0x66f171);}};}function respondWithFilteredResult(_0x22286e,_0x527e6e){return function(_0x4400e9){if(_0x4400e9){var _0xd5f476=typeof _0x527e6e[_0xf9db('0x1f')]===_0xf9db('0x20')&&typeof _0x527e6e['limit']===_0xf9db('0x20');var _0x3535d6=_0x4400e9[_0xf9db('0x21')];var _0x2e3ea8=_0xd5f476?0x0:_0x527e6e['offset'];var _0x47cbe6=_0xd5f476?_0x4400e9[_0xf9db('0x21')]:_0x527e6e[_0xf9db('0x1f')]+_0x527e6e[_0xf9db('0x22')];var _0x5a62ac;if(_0x47cbe6>=_0x3535d6){_0x47cbe6=_0x3535d6;_0x5a62ac=0xc8;}else{_0x5a62ac=0xce;}_0x22286e['status'](_0x5a62ac);return _0x22286e[_0xf9db('0x23')](_0xf9db('0x24'),_0x2e3ea8+'-'+_0x47cbe6+'/'+_0x3535d6)['json'](_0x4400e9);}return null;};}function patchUpdates(_0x47623c){return function(_0x3a22d9){try{jsonpatch[_0xf9db('0x25')](_0x3a22d9,_0x47623c,!![]);}catch(_0x564e5e){return BPromise[_0xf9db('0x26')](_0x564e5e);}return _0x3a22d9[_0xf9db('0x27')]();};}function saveUpdates(_0x52911f,_0x93b1b4){return function(_0x561a36){if(_0x561a36){return _0x561a36[_0xf9db('0x28')](_0x52911f)[_0xf9db('0x29')](function(_0x3ca351){return _0x3ca351;});}return null;};}function removeEntity(_0xff84d9,_0x56ac56){return function(_0xaf3760){if(_0xaf3760){return _0xaf3760[_0xf9db('0x2a')]()[_0xf9db('0x29')](function(){_0xff84d9[_0xf9db('0x1d')](0xcc)[_0xf9db('0x2b')]();});}};}function handleEntityNotFound(_0x18d601,_0x4f6bd2){return function(_0x48225c){if(!_0x48225c){_0x18d601[_0xf9db('0x1c')](0x194);}return _0x48225c;};}function handleError(_0x4d0a85,_0x15cee9){_0x15cee9=_0x15cee9||0x1f4;return function(_0x4f2089){logger[_0xf9db('0x2c')](_0x4f2089[_0xf9db('0x2d')]);if(_0x4f2089[_0xf9db('0x2e')]){delete _0x4f2089[_0xf9db('0x2e')];}_0x4d0a85[_0xf9db('0x1d')](_0x15cee9)[_0xf9db('0x2f')](_0x4f2089);};}exports[_0xf9db('0x30')]=function(_0x12094f,_0x3780c1){var _0x3e41da={},_0x235f3d={},_0x36d53b={'count':0x0,'rows':[]};var _0x13efc4=_[_0xf9db('0x31')](db[_0xf9db('0x32')]['rawAttributes'],function(_0x159492){return{'name':_0x159492[_0xf9db('0x33')],'type':_0x159492[_0xf9db('0x34')][_0xf9db('0x35')]};});_0x235f3d[_0xf9db('0x36')]=_[_0xf9db('0x31')](_0x13efc4,_0xf9db('0x2e'));_0x235f3d['query']=_[_0xf9db('0x37')](_0x12094f[_0xf9db('0x38')]);_0x235f3d[_0xf9db('0x39')]=_[_0xf9db('0x3a')](_0x235f3d[_0xf9db('0x36')],_0x235f3d['query']);_0x3e41da['attributes']=_[_0xf9db('0x3a')](_0x235f3d[_0xf9db('0x36')],qs['fields'](_0x12094f['query'][_0xf9db('0x3b')]));_0x3e41da[_0xf9db('0x3c')]=_0x3e41da['attributes']['length']?_0x3e41da[_0xf9db('0x3c')]:_0x235f3d[_0xf9db('0x36')];if(!_0x12094f['query'][_0xf9db('0x3d')](_0xf9db('0x3e'))){_0x3e41da['limit']=qs[_0xf9db('0x22')](_0x12094f['query'][_0xf9db('0x22')]);_0x3e41da['offset']=qs['offset'](_0x12094f[_0xf9db('0x38')][_0xf9db('0x1f')]);}_0x3e41da[_0xf9db('0x3f')]=qs[_0xf9db('0x40')](_0x12094f[_0xf9db('0x38')][_0xf9db('0x40')]);_0x3e41da['where']=qs[_0xf9db('0x39')](_[_0xf9db('0x41')](_0x12094f[_0xf9db('0x38')],_0x235f3d[_0xf9db('0x39')]),_0x13efc4);if(_0x12094f[_0xf9db('0x38')][_0xf9db('0x42')]){_0x3e41da[_0xf9db('0x43')]=_[_0xf9db('0x44')](_0x3e41da[_0xf9db('0x43')],{'$or':_[_0xf9db('0x31')](_0x13efc4,function(_0x5ac832){if(_0x5ac832[_0xf9db('0x34')]!==_0xf9db('0x45')){var _0x2f702e={};_0x2f702e[_0x5ac832[_0xf9db('0x2e')]]={'$like':'%'+_0x12094f['query'][_0xf9db('0x42')]+'%'};return _0x2f702e;}})});}_0x3e41da=_['merge']({},_0x3e41da,_0x12094f[_0xf9db('0x46')]);var _0x1ab701={'where':_0x3e41da[_0xf9db('0x43')]};return db[_0xf9db('0x32')][_0xf9db('0x21')](_0x1ab701)[_0xf9db('0x29')](function(_0x217f47){_0x36d53b[_0xf9db('0x21')]=_0x217f47;if(_0x12094f['query'][_0xf9db('0x47')]){_0x3e41da[_0xf9db('0x48')]=[{'all':!![]}];}return db[_0xf9db('0x32')]['findAll'](_0x3e41da);})[_0xf9db('0x29')](function(_0x25e0ab){_0x36d53b['rows']=_0x25e0ab;return _0x36d53b;})[_0xf9db('0x29')](respondWithFilteredResult(_0x3780c1,_0x3e41da))['catch'](handleError(_0x3780c1,null));};exports[_0xf9db('0x49')]=function(_0x171fda,_0x5e5c17){var _0x6518b2={'raw':!![],'where':{'id':_0x171fda[_0xf9db('0x4a')]['id']}},_0x4378e5={};_0x4378e5['model']=_[_0xf9db('0x37')](db[_0xf9db('0x32')][_0xf9db('0x4b')]);_0x4378e5[_0xf9db('0x38')]=_['keys'](_0x171fda[_0xf9db('0x38')]);_0x4378e5[_0xf9db('0x39')]=_[_0xf9db('0x3a')](_0x4378e5[_0xf9db('0x36')],_0x4378e5[_0xf9db('0x38')]);_0x6518b2[_0xf9db('0x3c')]=_[_0xf9db('0x3a')](_0x4378e5[_0xf9db('0x36')],qs['fields'](_0x171fda[_0xf9db('0x38')][_0xf9db('0x3b')]));_0x6518b2[_0xf9db('0x3c')]=_0x6518b2[_0xf9db('0x3c')][_0xf9db('0x4c')]?_0x6518b2['attributes']:_0x4378e5[_0xf9db('0x36')];if(_0x171fda[_0xf9db('0x38')]['includeAll']){_0x6518b2[_0xf9db('0x48')]=[{'all':!![]}];}_0x6518b2=_[_0xf9db('0x44')]({},_0x6518b2,_0x171fda[_0xf9db('0x46')]);return db[_0xf9db('0x32')][_0xf9db('0x4d')](_0x6518b2)[_0xf9db('0x29')](handleEntityNotFound(_0x5e5c17,null))[_0xf9db('0x29')](respondWithResult(_0x5e5c17,null))[_0xf9db('0x4e')](handleError(_0x5e5c17,null));};exports['create']=function(_0x49dafc,_0x1e2bf0){return db[_0xf9db('0x32')]['create'](_0x49dafc[_0xf9db('0x4f')],{})[_0xf9db('0x29')](respondWithResult(_0x1e2bf0,0xc9))['catch'](handleError(_0x1e2bf0,null));};exports['update']=function(_0x1624f4,_0x4c719e){if(_0x1624f4['body']['id']){delete _0x1624f4[_0xf9db('0x4f')]['id'];}return db[_0xf9db('0x32')][_0xf9db('0x4d')]({'where':{'id':_0x1624f4[_0xf9db('0x4a')]['id']}})[_0xf9db('0x29')](handleEntityNotFound(_0x4c719e,null))['then'](saveUpdates(_0x1624f4[_0xf9db('0x4f')],null))[_0xf9db('0x29')](respondWithResult(_0x4c719e,null))[_0xf9db('0x4e')](handleError(_0x4c719e,null));};exports[_0xf9db('0x2a')]=function(_0x45cdd4,_0x5389c4){return db[_0xf9db('0x32')][_0xf9db('0x4d')]({'where':{'id':_0x45cdd4['params']['id']}})[_0xf9db('0x29')](handleEntityNotFound(_0x5389c4,null))['then'](removeEntity(_0x5389c4,null))[_0xf9db('0x4e')](handleError(_0x5389c4,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 72ca573..f30a728 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 _0x9bc3=['idField','FieldId','lodash','api','moment','bluebird','request-promise','../../config/environment','define','int_dynamics365_fields'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x9bc3,0x1ba));var _0x39bc=function(_0x2dd78f,_0x5e3a80){_0x2dd78f=_0x2dd78f-0x0;var _0x2960f0=_0x9bc3[_0x2dd78f];return _0x2960f0;};'use strict';var _=require(_0x39bc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x39bc('0x1'));var moment=require(_0x39bc('0x2'));var BPromise=require(_0x39bc('0x3'));var rp=require(_0x39bc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x39bc('0x5'));var attributes=require('./intDynamics365Field.attributes');module['exports']=function(_0x14180f,_0x25f2a3){return _0x14180f[_0x39bc('0x6')]('Dynamics365Field',attributes,{'tableName':_0x39bc('0x7'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x39bc('0x8'),_0x39bc('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf360=['Dynamics365Field','int_dynamics365_fields','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define'];(function(_0x45dfad,_0x457b37){var _0x15aa1c=function(_0x19df65){while(--_0x19df65){_0x45dfad['push'](_0x45dfad['shift']());}};_0x15aa1c(++_0x457b37);}(_0xf360,0x129));var _0x0f36=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf360[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0f36('0x0'));var util=require('util');var logger=require(_0x0f36('0x1'))(_0x0f36('0x2'));var moment=require(_0x0f36('0x3'));var BPromise=require(_0x0f36('0x4'));var rp=require(_0x0f36('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0f36('0x6'));var config=require(_0x0f36('0x7'));var attributes=require(_0x0f36('0x8'));module[_0x0f36('0x9')]=function(_0x5e1321,_0x2bf9a3){return _0x5e1321[_0x0f36('0xa')](_0x0f36('0xb'),attributes,{'tableName':_0x0f36('0xc'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':['idField',_0x0f36('0xd')],'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 c211245..f7c31da 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 _0x3c48=['debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent'];(function(_0x408b80,_0x50d130){var _0x257a4e=function(_0x21924b){while(--_0x21924b){_0x408b80['push'](_0x408b80['shift']());}};_0x257a4e(++_0x50d130);}(_0x3c48,0xe3));var _0x83c4=function(_0x32b2a4,_0x1a758c){_0x32b2a4=_0x32b2a4-0x0;var _0x409ef3=_0x3c48[_0x32b2a4];return _0x409ef3;};'use strict';var _=require(_0x83c4('0x0'));var util=require('util');var moment=require(_0x83c4('0x1'));var BPromise=require('bluebird');var rs=require(_0x83c4('0x2'));var fs=require('fs');var Redis=require(_0x83c4('0x3'));var db=require(_0x83c4('0x4'))['db'];var utils=require(_0x83c4('0x5'));var logger=require(_0x83c4('0x6'))(_0x83c4('0x7'));var config=require(_0x83c4('0x8'));var jayson=require(_0x83c4('0x9'));var client=jayson[_0x83c4('0xa')][_0x83c4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x231ea2,_0x5ceb38,_0x44fb6e){return new BPromise(function(_0x2f8cfb,_0x561ea5){return client['request'](_0x231ea2,_0x44fb6e)[_0x83c4('0xc')](function(_0x372d1f){logger['info'](_0x83c4('0xd'),_0x5ceb38,_0x83c4('0xe'));logger[_0x83c4('0xf')](_0x83c4('0x10'),_0x5ceb38,'request\x20sent',JSON['stringify'](_0x372d1f));if(_0x372d1f[_0x83c4('0x11')]){if(_0x372d1f['error'][_0x83c4('0x12')]===0x1f4){logger[_0x83c4('0x11')](_0x83c4('0xd'),_0x5ceb38,_0x372d1f[_0x83c4('0x11')][_0x83c4('0x13')]);return _0x561ea5(_0x372d1f[_0x83c4('0x11')][_0x83c4('0x13')]);}logger[_0x83c4('0x11')](_0x83c4('0xd'),_0x5ceb38,_0x372d1f[_0x83c4('0x11')][_0x83c4('0x13')]);return _0x2f8cfb(_0x372d1f[_0x83c4('0x11')][_0x83c4('0x13')]);}else{logger[_0x83c4('0x14')](_0x83c4('0xd'),_0x5ceb38,_0x83c4('0xe'));_0x2f8cfb(_0x372d1f[_0x83c4('0x15')]['message']);}})['catch'](function(_0x73ec54){logger[_0x83c4('0x11')](_0x83c4('0xd'),_0x5ceb38,_0x73ec54);_0x561ea5(_0x73ec54);});});} \ No newline at end of file +var _0x40aa=['info','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','Dynamics365Field,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x5bd013,_0x46179d){var _0xe46f9f=function(_0x5f03ff){while(--_0x5f03ff){_0x5bd013['push'](_0x5bd013['shift']());}};_0xe46f9f(++_0x46179d);}(_0x40aa,0x111));var _0xa40a=function(_0x207a9a,_0x41ac29){_0x207a9a=_0x207a9a-0x0;var _0x2c91eb=_0x40aa[_0x207a9a];return _0x2c91eb;};'use strict';var _=require(_0xa40a('0x0'));var util=require(_0xa40a('0x1'));var moment=require(_0xa40a('0x2'));var BPromise=require('bluebird');var rs=require(_0xa40a('0x3'));var fs=require('fs');var Redis=require(_0xa40a('0x4'));var db=require(_0xa40a('0x5'))['db'];var utils=require(_0xa40a('0x6'));var logger=require(_0xa40a('0x7'))(_0xa40a('0x8'));var config=require(_0xa40a('0x9'));var jayson=require(_0xa40a('0xa'));var client=jayson[_0xa40a('0xb')][_0xa40a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x47be61,_0x58ba72,_0x98a77d){return new BPromise(function(_0x535dbf,_0x50792f){return client[_0xa40a('0xd')](_0x47be61,_0x98a77d)[_0xa40a('0xe')](function(_0x2c4fa0){logger[_0xa40a('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x58ba72,_0xa40a('0x10'));logger[_0xa40a('0x11')](_0xa40a('0x12'),_0x58ba72,_0xa40a('0x10'),JSON['stringify'](_0x2c4fa0));if(_0x2c4fa0[_0xa40a('0x13')]){if(_0x2c4fa0[_0xa40a('0x13')]['code']===0x1f4){logger[_0xa40a('0x13')](_0xa40a('0x14'),_0x58ba72,_0x2c4fa0[_0xa40a('0x13')][_0xa40a('0x15')]);return _0x50792f(_0x2c4fa0[_0xa40a('0x13')][_0xa40a('0x15')]);}logger['error'](_0xa40a('0x14'),_0x58ba72,_0x2c4fa0[_0xa40a('0x13')][_0xa40a('0x15')]);return _0x535dbf(_0x2c4fa0[_0xa40a('0x13')][_0xa40a('0x15')]);}else{logger[_0xa40a('0xf')](_0xa40a('0x14'),_0x58ba72,_0xa40a('0x10'));_0x535dbf(_0x2c4fa0[_0xa40a('0x16')][_0xa40a('0x15')]);}})[_0xa40a('0x17')](function(_0x483eba){logger[_0xa40a('0x13')](_0xa40a('0x14'),_0x58ba72,_0x483eba);_0x50792f(_0x483eba);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 5e3084d..d3c9134 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 _0xfe3c=['isAuthenticated','index','get','/:id','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','update','delete','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x579010,_0x2ee1f8){var _0x48bf58=function(_0x519263){while(--_0x519263){_0x579010['push'](_0x579010['shift']());}};_0x48bf58(++_0x2ee1f8);}(_0xfe3c,0x198));var _0xcfe3=function(_0xa7d601,_0x5902f0){_0xa7d601=_0xa7d601-0x0;var _0x14e50b=_0xfe3c[_0xa7d601];return _0x14e50b;};'use strict';var multer=require(_0xcfe3('0x0'));var util=require('util');var path=require(_0xcfe3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcfe3('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xcfe3('0x3'));var interaction=require(_0xcfe3('0x4'));var config=require(_0xcfe3('0x5'));var controller=require('./intFreshdeskAccount.controller');router['get']('/',auth[_0xcfe3('0x6')](),controller[_0xcfe3('0x7')]);router[_0xcfe3('0x8')](_0xcfe3('0x9'),auth[_0xcfe3('0x6')](),controller['show']);router[_0xcfe3('0x8')](_0xcfe3('0xa'),auth[_0xcfe3('0x6')](),controller[_0xcfe3('0xb')]);router[_0xcfe3('0x8')](_0xcfe3('0xc'),auth[_0xcfe3('0x6')](),controller['getFields']);router[_0xcfe3('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcfe3('0xd')]('/:id/configurations',auth[_0xcfe3('0x6')](),controller[_0xcfe3('0xe')]);router['put']('/:id',auth[_0xcfe3('0x6')](),controller[_0xcfe3('0xf')]);router[_0xcfe3('0x10')](_0xcfe3('0x9'),auth[_0xcfe3('0x6')](),controller['destroy']);module[_0xcfe3('0x11')]=router; \ No newline at end of file +var _0xb6c5=['getFields','create','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations'];(function(_0x79f4d9,_0x2946a8){var _0x55de67=function(_0x248d25){while(--_0x248d25){_0x79f4d9['push'](_0x79f4d9['shift']());}};_0x55de67(++_0x2946a8);}(_0xb6c5,0x183));var _0x5b6c=function(_0x5f3f60,_0x187e7f){_0x5f3f60=_0x5f3f60-0x0;var _0x4ec871=_0xb6c5[_0x5f3f60];return _0x4ec871;};'use strict';var multer=require(_0x5b6c('0x0'));var util=require(_0x5b6c('0x1'));var path=require(_0x5b6c('0x2'));var timeout=require(_0x5b6c('0x3'));var express=require(_0x5b6c('0x4'));var router=express[_0x5b6c('0x5')]();var fs_extra=require(_0x5b6c('0x6'));var auth=require(_0x5b6c('0x7'));var interaction=require(_0x5b6c('0x8'));var config=require(_0x5b6c('0x9'));var controller=require(_0x5b6c('0xa'));router[_0x5b6c('0xb')]('/',auth['isAuthenticated'](),controller[_0x5b6c('0xc')]);router['get'](_0x5b6c('0xd'),auth[_0x5b6c('0xe')](),controller[_0x5b6c('0xf')]);router[_0x5b6c('0xb')](_0x5b6c('0x10'),auth[_0x5b6c('0xe')](),controller[_0x5b6c('0x11')]);router['get']('/:id/fields',auth[_0x5b6c('0xe')](),controller[_0x5b6c('0x12')]);router['post']('/',auth[_0x5b6c('0xe')](),controller[_0x5b6c('0x13')]);router[_0x5b6c('0x14')](_0x5b6c('0x10'),auth['isAuthenticated'](),controller[_0x5b6c('0x15')]);router[_0x5b6c('0x16')](_0x5b6c('0xd'),auth['isAuthenticated'](),controller[_0x5b6c('0x17')]);router[_0x5b6c('0x18')](_0x5b6c('0xd'),auth[_0x5b6c('0xe')](),controller[_0x5b6c('0x19')]);module[_0x5b6c('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 4400739..e8bb107 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 _0x7708=['sequelize','exports','STRING','remoteUri'];(function(_0x4509fd,_0x4d06de){var _0x2c555=function(_0x738918){while(--_0x738918){_0x4509fd['push'](_0x4509fd['shift']());}};_0x2c555(++_0x4d06de);}(_0x7708,0x188));var _0x8770=function(_0x383158,_0x415e43){_0x383158=_0x383158-0x0;var _0x507985=_0x7708[_0x383158];return _0x507985;};'use strict';var Sequelize=require(_0x8770('0x0'));module[_0x8770('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8770('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x8770('0x3')},'serverUrl':{'type':Sequelize[_0x8770('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xdf55=['exports','STRING','remoteUri','sequelize'];(function(_0x523085,_0x5714b){var _0x224744=function(_0x5ca743){while(--_0x5ca743){_0x523085['push'](_0x523085['shift']());}};_0x224744(++_0x5714b);}(_0xdf55,0x83));var _0x5df5=function(_0x3441e9,_0x269c8a){_0x3441e9=_0x3441e9-0x0;var _0x7f9ada=_0xdf55[_0x3441e9];return _0x7f9ada;};'use strict';var Sequelize=require(_0x5df5('0x0'));module[_0x5df5('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5df5('0x2')]},'username':{'type':Sequelize[_0x5df5('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x5df5('0x2')]},'remoteUri':{'type':Sequelize[_0x5df5('0x2')],'unique':_0x5df5('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index c3edda0..62d7a5c 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 _0x49aa=['channel','Descriptions','FreshdeskField','Subjects','getFields','apiKey','remoteUri','slice','substring','GET','api/v2/ticket_fields','format','Basic\x20%s','%s:X','toString','base64','subject','agent','description','priority','group','ticket_type','company','remove','custom_text','label','default','choices','test','getFields,\x20%s,\x20%s,\x20%s','stringify','send','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','stack','name','index','map','FreshdeskAccount','rawAttributes','fieldName','type','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','rows','catch','options','find','create','body','destroy','params','getConfigurations','FreshdeskConfiguration','addConfiguration','findOne','AccountId'];(function(_0x51a6e8,_0x3e754a){var _0xda6ca=function(_0x2bc0e4){while(--_0x2bc0e4){_0x51a6e8['push'](_0x51a6e8['shift']());}};_0xda6ca(++_0x3e754a);}(_0x49aa,0x173));var _0xa49a=function(_0x5480e8,_0x53641b){_0x5480e8=_0x5480e8-0x0;var _0x23daa9=_0x49aa[_0x5480e8];return _0x23daa9;};'use strict';var emlformat=require(_0xa49a('0x0'));var rimraf=require(_0xa49a('0x1'));var zipdir=require(_0xa49a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa49a('0x3'));var moment=require(_0xa49a('0x4'));var BPromise=require(_0xa49a('0x5'));var Mustache=require(_0xa49a('0x6'));var util=require(_0xa49a('0x7'));var path=require(_0xa49a('0x8'));var sox=require('sox');var csv=require(_0xa49a('0x9'));var ejs=require(_0xa49a('0xa'));var fs=require('fs');var fs_extra=require(_0xa49a('0xb'));var _=require(_0xa49a('0xc'));var squel=require(_0xa49a('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa49a('0xe'));var toCsv=require(_0xa49a('0x9'));var querystring=require(_0xa49a('0xf'));var Papa=require(_0xa49a('0x10'));var Redis=require(_0xa49a('0x11'));var authService=require(_0xa49a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa49a('0x13'));var hardwareService=require(_0xa49a('0x14'));var logger=require(_0xa49a('0x15'))(_0xa49a('0x16'));var utils=require(_0xa49a('0x17'));var config=require(_0xa49a('0x18'));var licenseUtil=require(_0xa49a('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa49a('0x1a'));function respondWithStatusCode(_0x355785,_0x1755ad){_0x1755ad=_0x1755ad||0xcc;return function(_0x406e6c){if(_0x406e6c){return _0x355785[_0xa49a('0x1b')](_0x1755ad);}return _0x355785[_0xa49a('0x1c')](_0x1755ad)[_0xa49a('0x1d')]();};}function respondWithResult(_0x55b4ef,_0x33021e){_0x33021e=_0x33021e||0xc8;return function(_0x1c0477){if(_0x1c0477){return _0x55b4ef[_0xa49a('0x1c')](_0x33021e)[_0xa49a('0x1e')](_0x1c0477);}};}function respondWithFilteredResult(_0x537aad,_0x35f807){return function(_0x70baa6){if(_0x70baa6){var _0x48b9e7=typeof _0x35f807[_0xa49a('0x1f')]===_0xa49a('0x20')&&typeof _0x35f807['limit']===_0xa49a('0x20');var _0x24a885=_0x70baa6[_0xa49a('0x21')];var _0x4c712d=_0x48b9e7?0x0:_0x35f807['offset'];var _0x3ad509=_0x48b9e7?_0x70baa6[_0xa49a('0x21')]:_0x35f807[_0xa49a('0x1f')]+_0x35f807[_0xa49a('0x22')];var _0x2cf98e;if(_0x3ad509>=_0x24a885){_0x3ad509=_0x24a885;_0x2cf98e=0xc8;}else{_0x2cf98e=0xce;}_0x537aad[_0xa49a('0x1c')](_0x2cf98e);return _0x537aad[_0xa49a('0x23')](_0xa49a('0x24'),_0x4c712d+'-'+_0x3ad509+'/'+_0x24a885)[_0xa49a('0x1e')](_0x70baa6);}return null;};}function patchUpdates(_0x54a95d){return function(_0x334d5f){try{jsonpatch[_0xa49a('0x25')](_0x334d5f,_0x54a95d,!![]);}catch(_0x855162){return BPromise['reject'](_0x855162);}return _0x334d5f[_0xa49a('0x26')]();};}function saveUpdates(_0x489328,_0x1cdbda){return function(_0x50c0ab){if(_0x50c0ab){return _0x50c0ab[_0xa49a('0x27')](_0x489328)[_0xa49a('0x28')](function(_0x8e597f){return _0x8e597f;});}return null;};}function removeEntity(_0x1a4f5c,_0xf533fb){return function(_0x5fb496){if(_0x5fb496){return _0x5fb496['destroy']()[_0xa49a('0x28')](function(){_0x1a4f5c[_0xa49a('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3300eb,_0x113e51){return function(_0x404c86){if(!_0x404c86){_0x3300eb['sendStatus'](0x194);}return _0x404c86;};}function handleError(_0x22dbb1,_0x3f3bcb){_0x3f3bcb=_0x3f3bcb||0x1f4;return function(_0x28b04f){logger['error'](_0x28b04f[_0xa49a('0x29')]);if(_0x28b04f[_0xa49a('0x2a')]){delete _0x28b04f[_0xa49a('0x2a')];}_0x22dbb1[_0xa49a('0x1c')](_0x3f3bcb)['send'](_0x28b04f);};}exports[_0xa49a('0x2b')]=function(_0x1d0704,_0x468d04){var _0x12aa63={},_0x1f5233={},_0x4576e5={'count':0x0,'rows':[]};var _0x53afb8=_[_0xa49a('0x2c')](db[_0xa49a('0x2d')][_0xa49a('0x2e')],function(_0x51833a){return{'name':_0x51833a[_0xa49a('0x2f')],'type':_0x51833a[_0xa49a('0x30')]['key']};});_0x1f5233['model']=_[_0xa49a('0x2c')](_0x53afb8,_0xa49a('0x2a'));_0x1f5233['query']=_[_0xa49a('0x31')](_0x1d0704[_0xa49a('0x32')]);_0x1f5233['filters']=_[_0xa49a('0x33')](_0x1f5233[_0xa49a('0x34')],_0x1f5233[_0xa49a('0x32')]);_0x12aa63[_0xa49a('0x35')]=_[_0xa49a('0x33')](_0x1f5233['model'],qs[_0xa49a('0x36')](_0x1d0704['query'][_0xa49a('0x36')]));_0x12aa63[_0xa49a('0x35')]=_0x12aa63[_0xa49a('0x35')][_0xa49a('0x37')]?_0x12aa63[_0xa49a('0x35')]:_0x1f5233[_0xa49a('0x34')];if(!_0x1d0704[_0xa49a('0x32')][_0xa49a('0x38')](_0xa49a('0x39'))){_0x12aa63[_0xa49a('0x22')]=qs[_0xa49a('0x22')](_0x1d0704[_0xa49a('0x32')][_0xa49a('0x22')]);_0x12aa63[_0xa49a('0x1f')]=qs[_0xa49a('0x1f')](_0x1d0704['query'][_0xa49a('0x1f')]);}_0x12aa63[_0xa49a('0x3a')]=qs['sort'](_0x1d0704[_0xa49a('0x32')][_0xa49a('0x3b')]);_0x12aa63[_0xa49a('0x3c')]=qs[_0xa49a('0x3d')](_[_0xa49a('0x3e')](_0x1d0704[_0xa49a('0x32')],_0x1f5233[_0xa49a('0x3d')]),_0x53afb8);if(_0x1d0704[_0xa49a('0x32')][_0xa49a('0x3f')]){_0x12aa63[_0xa49a('0x3c')]=_['merge'](_0x12aa63[_0xa49a('0x3c')],{'$or':_[_0xa49a('0x2c')](_0x53afb8,function(_0x17925b){if(_0x17925b[_0xa49a('0x30')]!==_0xa49a('0x40')){var _0x59307f={};_0x59307f[_0x17925b['name']]={'$like':'%'+_0x1d0704[_0xa49a('0x32')]['filter']+'%'};return _0x59307f;}})});}_0x12aa63=_[_0xa49a('0x41')]({},_0x12aa63,_0x1d0704['options']);var _0x125349={'where':_0x12aa63['where']};return db[_0xa49a('0x2d')][_0xa49a('0x21')](_0x125349)['then'](function(_0x451578){_0x4576e5[_0xa49a('0x21')]=_0x451578;if(_0x1d0704[_0xa49a('0x32')][_0xa49a('0x42')]){_0x12aa63[_0xa49a('0x43')]=[{'all':!![]}];}return db['FreshdeskAccount']['findAll'](_0x12aa63);})[_0xa49a('0x28')](function(_0x5a7914){_0x4576e5[_0xa49a('0x44')]=_0x5a7914;return _0x4576e5;})[_0xa49a('0x28')](respondWithFilteredResult(_0x468d04,_0x12aa63))[_0xa49a('0x45')](handleError(_0x468d04,null));};exports['show']=function(_0xb27769,_0x29cb7c){var _0xd28952={'raw':![],'where':{'id':_0xb27769['params']['id']}},_0xd2e737={};_0xd2e737[_0xa49a('0x34')]=_[_0xa49a('0x31')](db['FreshdeskAccount'][_0xa49a('0x2e')]);_0xd2e737[_0xa49a('0x32')]=_[_0xa49a('0x31')](_0xb27769[_0xa49a('0x32')]);_0xd2e737['filters']=_['intersection'](_0xd2e737['model'],_0xd2e737[_0xa49a('0x32')]);_0xd28952['attributes']=_[_0xa49a('0x33')](_0xd2e737['model'],qs[_0xa49a('0x36')](_0xb27769['query'][_0xa49a('0x36')]));_0xd28952[_0xa49a('0x35')]=_0xd28952[_0xa49a('0x35')]['length']?_0xd28952[_0xa49a('0x35')]:_0xd2e737['model'];if(_0xb27769[_0xa49a('0x32')][_0xa49a('0x42')]){_0xd28952[_0xa49a('0x43')]=[{'all':!![]}];}_0xd28952=_[_0xa49a('0x41')]({},_0xd28952,_0xb27769[_0xa49a('0x46')]);return db['FreshdeskAccount'][_0xa49a('0x47')](_0xd28952)['then'](handleEntityNotFound(_0x29cb7c,null))['then'](respondWithResult(_0x29cb7c,null))[_0xa49a('0x45')](handleError(_0x29cb7c,null));};exports[_0xa49a('0x48')]=function(_0x473032,_0x3d6161){return db[_0xa49a('0x2d')][_0xa49a('0x48')](_0x473032[_0xa49a('0x49')],{})[_0xa49a('0x28')](respondWithResult(_0x3d6161,0xc9))[_0xa49a('0x45')](handleError(_0x3d6161,null));};exports[_0xa49a('0x27')]=function(_0x108e89,_0xee5e5a){if(_0x108e89[_0xa49a('0x49')]['id']){delete _0x108e89[_0xa49a('0x49')]['id'];}return db[_0xa49a('0x2d')]['find']({'where':{'id':_0x108e89['params']['id']}})['then'](handleEntityNotFound(_0xee5e5a,null))['then'](saveUpdates(_0x108e89[_0xa49a('0x49')],null))[_0xa49a('0x28')](respondWithResult(_0xee5e5a,null))[_0xa49a('0x45')](handleError(_0xee5e5a,null));};exports[_0xa49a('0x4a')]=function(_0x426d82,_0x41a7de){return db[_0xa49a('0x2d')][_0xa49a('0x47')]({'where':{'id':_0x426d82[_0xa49a('0x4b')]['id']}})[_0xa49a('0x28')](handleEntityNotFound(_0x41a7de,null))['then'](removeEntity(_0x41a7de,null))[_0xa49a('0x45')](handleError(_0x41a7de,null));};exports[_0xa49a('0x4c')]=function(_0x48e4ad,_0x4caf8f,_0x737d43){var _0x43d82e={};var _0xf0f693={};var _0x3a4b52;var _0x559c77;return db[_0xa49a('0x2d')]['findOne']({'where':{'id':_0x48e4ad[_0xa49a('0x4b')]['id']}})[_0xa49a('0x28')](handleEntityNotFound(_0x4caf8f,null))['then'](function(_0x20b955){if(_0x20b955){_0x3a4b52=_0x20b955;_0xf0f693[_0xa49a('0x34')]=_[_0xa49a('0x31')](db[_0xa49a('0x4d')]['rawAttributes']);_0xf0f693[_0xa49a('0x32')]=_[_0xa49a('0x31')](_0x48e4ad[_0xa49a('0x32')]);_0xf0f693[_0xa49a('0x3d')]=_[_0xa49a('0x33')](_0xf0f693['model'],_0xf0f693['query']);_0x43d82e[_0xa49a('0x35')]=_[_0xa49a('0x33')](_0xf0f693['model'],qs[_0xa49a('0x36')](_0x48e4ad[_0xa49a('0x32')]['fields']));_0x43d82e[_0xa49a('0x35')]=_0x43d82e[_0xa49a('0x35')][_0xa49a('0x37')]?_0x43d82e[_0xa49a('0x35')]:_0xf0f693[_0xa49a('0x34')];_0x43d82e[_0xa49a('0x3a')]=qs['sort'](_0x48e4ad[_0xa49a('0x32')][_0xa49a('0x3b')]);_0x43d82e[_0xa49a('0x3c')]=qs['filters'](_['pick'](_0x48e4ad[_0xa49a('0x32')],_0xf0f693['filters']));if(_0x48e4ad[_0xa49a('0x32')][_0xa49a('0x3f')]){_0x43d82e[_0xa49a('0x3c')]=_[_0xa49a('0x41')](_0x43d82e[_0xa49a('0x3c')],{'$or':_[_0xa49a('0x2c')](_0x43d82e[_0xa49a('0x35')],function(_0x20a918){var _0x3e0ab2={};_0x3e0ab2[_0x20a918]={'$like':'%'+_0x48e4ad[_0xa49a('0x32')][_0xa49a('0x3f')]+'%'};return _0x3e0ab2;})});}_0x43d82e=_[_0xa49a('0x41')]({},_0x43d82e,_0x48e4ad[_0xa49a('0x46')]);return _0x3a4b52['getConfigurations'](_0x43d82e);}})[_0xa49a('0x28')](function(_0x5cc961){if(_0x5cc961){_0x559c77=_0x5cc961[_0xa49a('0x37')];if(!_0x48e4ad[_0xa49a('0x32')]['hasOwnProperty']('nolimit')){_0x43d82e[_0xa49a('0x22')]=qs[_0xa49a('0x22')](_0x48e4ad[_0xa49a('0x32')][_0xa49a('0x22')]);_0x43d82e[_0xa49a('0x1f')]=qs[_0xa49a('0x1f')](_0x48e4ad[_0xa49a('0x32')][_0xa49a('0x1f')]);}return _0x3a4b52[_0xa49a('0x4c')](_0x43d82e);}})['then'](function(_0x14d2d0){if(_0x14d2d0){return _0x14d2d0?{'count':_0x559c77,'rows':_0x14d2d0}:null;}})[_0xa49a('0x28')](respondWithResult(_0x4caf8f,null))[_0xa49a('0x45')](handleError(_0x4caf8f,null));};exports[_0xa49a('0x4e')]=function(_0x190f2a,_0x525cef,_0x1452fb){if(_0x190f2a[_0xa49a('0x49')]['id']){delete _0x190f2a[_0xa49a('0x49')]['id'];}return db[_0xa49a('0x2d')][_0xa49a('0x4f')]({'where':{'id':_0x190f2a[_0xa49a('0x4b')]['id']}})[_0xa49a('0x28')](handleEntityNotFound(_0x525cef,null))['then'](function(_0x382396){if(_0x382396){_0x190f2a[_0xa49a('0x49')][_0xa49a('0x50')]=_0x382396['id'];_0x190f2a[_0xa49a('0x49')]['Subjects']=integrations['getSubjects'](_0x190f2a[_0xa49a('0x49')][_0xa49a('0x51')],_0x190f2a[_0xa49a('0x49')][_0xa49a('0x30')]);_0x190f2a[_0xa49a('0x49')][_0xa49a('0x52')]=integrations['getDescriptions'](_0x190f2a[_0xa49a('0x49')]['channel'],_0x190f2a[_0xa49a('0x49')][_0xa49a('0x30')]);return db[_0xa49a('0x4d')][_0xa49a('0x48')](_0x190f2a['body'],{'include':[{'model':db[_0xa49a('0x53')],'as':_0xa49a('0x54')},{'model':db[_0xa49a('0x53')],'as':'Descriptions'}]});}return null;})[_0xa49a('0x28')](respondWithResult(_0x525cef,null))[_0xa49a('0x45')](handleError(_0x525cef,null));};exports[_0xa49a('0x55')]=function(_0xe65f36,_0x19e21d,_0x42d6b2){var _0xf3f1fa='';return db[_0xa49a('0x2d')]['findOne']({'where':{'id':_0xe65f36[_0xa49a('0x4b')]['id']},'attributes':['id','remoteUri',_0xa49a('0x56')]})[_0xa49a('0x28')](handleEntityNotFound(_0x19e21d,null))[_0xa49a('0x28')](function(_0x4e8e6e){if(_0x4e8e6e){_0xf3f1fa=_0x4e8e6e[_0xa49a('0x57')];var _0x5b6938=_0xf3f1fa[_0xa49a('0x58')](-0x1);if(_0x5b6938==='/'){_0xf3f1fa=_0xf3f1fa[_0xa49a('0x59')](0x0,_0xf3f1fa['lastIndexOf'](_0x5b6938));}return rp({'method':_0xa49a('0x5a'),'uri':util['format']('%s/%s',_0xf3f1fa,_0xa49a('0x5b')),'headers':{'Authorization':util[_0xa49a('0x5c')](_0xa49a('0x5d'),new Buffer(util['format'](_0xa49a('0x5e'),_0x4e8e6e[_0xa49a('0x56')]))[_0xa49a('0x5f')](_0xa49a('0x60')))},'json':!![]});}})['then'](function(_0x2cb168){if(_0x2cb168){var _0x572135=['requester',_0xa49a('0x61'),_0xa49a('0x62'),_0xa49a('0x63'),'status',_0xa49a('0x64'),_0xa49a('0x65'),'source',_0xa49a('0x66'),_0xa49a('0x65'),_0xa49a('0x67')];_[_0xa49a('0x68')](_0x2cb168,function(_0x32bfc4){return _0x572135['includes'](_0x32bfc4['name'])||!_0x32bfc4['default']&&_0x32bfc4[_0xa49a('0x30')]!==_0xa49a('0x69')&&_0x32bfc4[_0xa49a('0x30')]!=='custom_dropdown';});return{'count':_0x2cb168[_0xa49a('0x37')],'rows':_[_0xa49a('0x2c')](_0x2cb168,function(_0x47844f){return{'id':_0x47844f[_0xa49a('0x2a')],'name':_0x47844f[_0xa49a('0x6a')],'custom':!_0x47844f[_0xa49a('0x6b')],'options':_0x47844f[_0xa49a('0x6c')]?_[_0xa49a('0x2c')](_0x47844f[_0xa49a('0x6c')],function(_0x484827){return{'name':_['capitalize'](_0x484827),'value':_0x484827};}):[]};})};}})['then'](respondWithResult(_0x19e21d,null))[_0xa49a('0x45')](function(_0x53ae13){var _0x243069=_0xe65f36['query'][_0xa49a('0x6d')]?0x1f4:_0x53ae13['statusCode']||0x1f4;logger['error'](_0xa49a('0x6e'),_0xa49a('0x55'),_0x243069,JSON[_0xa49a('0x6f')](_0x53ae13));delete _0x53ae13[_0xa49a('0x2a')];if(_0x243069===0x191){_0x243069=0x190;}_0x19e21d[_0xa49a('0x1c')](_0x243069)[_0xa49a('0x70')](_0xe65f36['query'][_0xa49a('0x6d')]?{'message':'Wrong\x20credentials','statusCode':_0x53ae13['statusCode']}:_0x53ae13);});}; \ No newline at end of file +var _0x4dc0=['json','apply','reject','save','then','destroy','stack','name','send','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','catch','create','body','update','find','getConfigurations','findOne','FreshdeskConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','slice','substring','GET','format','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','requester','agent','description','priority','ticket_type','group','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range'];(function(_0x345695,_0x2ba140){var _0x5002d3=function(_0x1f6cbb){while(--_0x1f6cbb){_0x345695['push'](_0x345695['shift']());}};_0x5002d3(++_0x2ba140);}(_0x4dc0,0x13d));var _0x04dc=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x4dc0[_0x4154a6];return _0x3b2786;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x04dc('0x0'));var jsonpatch=require(_0x04dc('0x1'));var rp=require(_0x04dc('0x2'));var moment=require(_0x04dc('0x3'));var BPromise=require(_0x04dc('0x4'));var Mustache=require('mustache');var util=require(_0x04dc('0x5'));var path=require(_0x04dc('0x6'));var sox=require(_0x04dc('0x7'));var csv=require('to-csv');var ejs=require(_0x04dc('0x8'));var fs=require('fs');var fs_extra=require(_0x04dc('0x9'));var _=require(_0x04dc('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x04dc('0xb'));var toCsv=require(_0x04dc('0xc'));var querystring=require(_0x04dc('0xd'));var Papa=require(_0x04dc('0xe'));var Redis=require(_0x04dc('0xf'));var authService=require(_0x04dc('0x10'));var qs=require(_0x04dc('0x11'));var as=require(_0x04dc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x04dc('0x13'))(_0x04dc('0x14'));var utils=require(_0x04dc('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x04dc('0x16'));var db=require(_0x04dc('0x17'))['db'];var integrations=require(_0x04dc('0x18'));function respondWithStatusCode(_0x59cd73,_0x388065){_0x388065=_0x388065||0xcc;return function(_0x1ce3b8){if(_0x1ce3b8){return _0x59cd73[_0x04dc('0x19')](_0x388065);}return _0x59cd73[_0x04dc('0x1a')](_0x388065)[_0x04dc('0x1b')]();};}function respondWithResult(_0x28f3c1,_0x32d634){_0x32d634=_0x32d634||0xc8;return function(_0x4a6a1a){if(_0x4a6a1a){return _0x28f3c1['status'](_0x32d634)['json'](_0x4a6a1a);}};}function respondWithFilteredResult(_0x26b72f,_0x253fe0){return function(_0x1a5491){if(_0x1a5491){var _0x2e20cb=typeof _0x253fe0[_0x04dc('0x1c')]===_0x04dc('0x1d')&&typeof _0x253fe0[_0x04dc('0x1e')]===_0x04dc('0x1d');var _0x5ed6ec=_0x1a5491[_0x04dc('0x1f')];var _0x13c259=_0x2e20cb?0x0:_0x253fe0[_0x04dc('0x1c')];var _0x43b657=_0x2e20cb?_0x1a5491[_0x04dc('0x1f')]:_0x253fe0[_0x04dc('0x1c')]+_0x253fe0[_0x04dc('0x1e')];var _0x3d4fea;if(_0x43b657>=_0x5ed6ec){_0x43b657=_0x5ed6ec;_0x3d4fea=0xc8;}else{_0x3d4fea=0xce;}_0x26b72f['status'](_0x3d4fea);return _0x26b72f[_0x04dc('0x20')](_0x04dc('0x21'),_0x13c259+'-'+_0x43b657+'/'+_0x5ed6ec)[_0x04dc('0x22')](_0x1a5491);}return null;};}function patchUpdates(_0x440f1d){return function(_0x5925dd){try{jsonpatch[_0x04dc('0x23')](_0x5925dd,_0x440f1d,!![]);}catch(_0x3b6978){return BPromise[_0x04dc('0x24')](_0x3b6978);}return _0x5925dd[_0x04dc('0x25')]();};}function saveUpdates(_0x14bfa1,_0x2bc113){return function(_0x277b9a){if(_0x277b9a){return _0x277b9a['update'](_0x14bfa1)[_0x04dc('0x26')](function(_0xaf011c){return _0xaf011c;});}return null;};}function removeEntity(_0x273633,_0xef2e0e){return function(_0x3bb822){if(_0x3bb822){return _0x3bb822[_0x04dc('0x27')]()[_0x04dc('0x26')](function(){_0x273633[_0x04dc('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf2211f,_0x520829){return function(_0xc374f3){if(!_0xc374f3){_0xf2211f[_0x04dc('0x19')](0x194);}return _0xc374f3;};}function handleError(_0x390853,_0x3568c2){_0x3568c2=_0x3568c2||0x1f4;return function(_0x45dc26){logger['error'](_0x45dc26[_0x04dc('0x28')]);if(_0x45dc26['name']){delete _0x45dc26[_0x04dc('0x29')];}_0x390853[_0x04dc('0x1a')](_0x3568c2)[_0x04dc('0x2a')](_0x45dc26);};}exports['index']=function(_0x10b13b,_0x18a566){var _0x797fbb={},_0x103cd7={},_0xc96e45={'count':0x0,'rows':[]};var _0x466504=_[_0x04dc('0x2b')](db[_0x04dc('0x2c')][_0x04dc('0x2d')],function(_0x19f7e4){return{'name':_0x19f7e4[_0x04dc('0x2e')],'type':_0x19f7e4[_0x04dc('0x2f')][_0x04dc('0x30')]};});_0x103cd7[_0x04dc('0x31')]=_['map'](_0x466504,_0x04dc('0x29'));_0x103cd7[_0x04dc('0x32')]=_[_0x04dc('0x33')](_0x10b13b[_0x04dc('0x32')]);_0x103cd7[_0x04dc('0x34')]=_[_0x04dc('0x35')](_0x103cd7[_0x04dc('0x31')],_0x103cd7[_0x04dc('0x32')]);_0x797fbb['attributes']=_['intersection'](_0x103cd7[_0x04dc('0x31')],qs[_0x04dc('0x36')](_0x10b13b[_0x04dc('0x32')]['fields']));_0x797fbb['attributes']=_0x797fbb[_0x04dc('0x37')][_0x04dc('0x38')]?_0x797fbb[_0x04dc('0x37')]:_0x103cd7[_0x04dc('0x31')];if(!_0x10b13b['query']['hasOwnProperty'](_0x04dc('0x39'))){_0x797fbb['limit']=qs[_0x04dc('0x1e')](_0x10b13b[_0x04dc('0x32')][_0x04dc('0x1e')]);_0x797fbb['offset']=qs[_0x04dc('0x1c')](_0x10b13b[_0x04dc('0x32')][_0x04dc('0x1c')]);}_0x797fbb[_0x04dc('0x3a')]=qs[_0x04dc('0x3b')](_0x10b13b[_0x04dc('0x32')][_0x04dc('0x3b')]);_0x797fbb[_0x04dc('0x3c')]=qs[_0x04dc('0x34')](_[_0x04dc('0x3d')](_0x10b13b[_0x04dc('0x32')],_0x103cd7[_0x04dc('0x34')]),_0x466504);if(_0x10b13b['query'][_0x04dc('0x3e')]){_0x797fbb[_0x04dc('0x3c')]=_[_0x04dc('0x3f')](_0x797fbb[_0x04dc('0x3c')],{'$or':_['map'](_0x466504,function(_0x225afc){if(_0x225afc[_0x04dc('0x2f')]!=='VIRTUAL'){var _0x44df06={};_0x44df06[_0x225afc[_0x04dc('0x29')]]={'$like':'%'+_0x10b13b[_0x04dc('0x32')][_0x04dc('0x3e')]+'%'};return _0x44df06;}})});}_0x797fbb=_['merge']({},_0x797fbb,_0x10b13b[_0x04dc('0x40')]);var _0x42268d={'where':_0x797fbb[_0x04dc('0x3c')]};return db[_0x04dc('0x2c')][_0x04dc('0x1f')](_0x42268d)['then'](function(_0x32b565){_0xc96e45[_0x04dc('0x1f')]=_0x32b565;if(_0x10b13b[_0x04dc('0x32')][_0x04dc('0x41')]){_0x797fbb[_0x04dc('0x42')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x04dc('0x43')](_0x797fbb);})[_0x04dc('0x26')](function(_0x4dc13d){_0xc96e45['rows']=_0x4dc13d;return _0xc96e45;})[_0x04dc('0x26')](respondWithFilteredResult(_0x18a566,_0x797fbb))['catch'](handleError(_0x18a566,null));};exports[_0x04dc('0x44')]=function(_0x51ab92,_0x39883f){var _0x9dfae5={'raw':![],'where':{'id':_0x51ab92[_0x04dc('0x45')]['id']}},_0x5c9feb={};_0x5c9feb['model']=_[_0x04dc('0x33')](db[_0x04dc('0x2c')][_0x04dc('0x2d')]);_0x5c9feb[_0x04dc('0x32')]=_[_0x04dc('0x33')](_0x51ab92[_0x04dc('0x32')]);_0x5c9feb[_0x04dc('0x34')]=_[_0x04dc('0x35')](_0x5c9feb['model'],_0x5c9feb[_0x04dc('0x32')]);_0x9dfae5['attributes']=_[_0x04dc('0x35')](_0x5c9feb[_0x04dc('0x31')],qs[_0x04dc('0x36')](_0x51ab92[_0x04dc('0x32')]['fields']));_0x9dfae5[_0x04dc('0x37')]=_0x9dfae5[_0x04dc('0x37')]['length']?_0x9dfae5[_0x04dc('0x37')]:_0x5c9feb[_0x04dc('0x31')];if(_0x51ab92[_0x04dc('0x32')][_0x04dc('0x41')]){_0x9dfae5[_0x04dc('0x42')]=[{'all':!![]}];}_0x9dfae5=_['merge']({},_0x9dfae5,_0x51ab92[_0x04dc('0x40')]);return db[_0x04dc('0x2c')]['find'](_0x9dfae5)[_0x04dc('0x26')](handleEntityNotFound(_0x39883f,null))['then'](respondWithResult(_0x39883f,null))[_0x04dc('0x46')](handleError(_0x39883f,null));};exports[_0x04dc('0x47')]=function(_0x2c0b27,_0x106b27){return db['FreshdeskAccount'][_0x04dc('0x47')](_0x2c0b27[_0x04dc('0x48')],{})[_0x04dc('0x26')](respondWithResult(_0x106b27,0xc9))[_0x04dc('0x46')](handleError(_0x106b27,null));};exports[_0x04dc('0x49')]=function(_0x57a31f,_0x443b66){if(_0x57a31f[_0x04dc('0x48')]['id']){delete _0x57a31f[_0x04dc('0x48')]['id'];}return db[_0x04dc('0x2c')][_0x04dc('0x4a')]({'where':{'id':_0x57a31f[_0x04dc('0x45')]['id']}})[_0x04dc('0x26')](handleEntityNotFound(_0x443b66,null))[_0x04dc('0x26')](saveUpdates(_0x57a31f[_0x04dc('0x48')],null))[_0x04dc('0x26')](respondWithResult(_0x443b66,null))[_0x04dc('0x46')](handleError(_0x443b66,null));};exports[_0x04dc('0x27')]=function(_0x58c38f,_0x58bd20){return db[_0x04dc('0x2c')]['find']({'where':{'id':_0x58c38f['params']['id']}})[_0x04dc('0x26')](handleEntityNotFound(_0x58bd20,null))[_0x04dc('0x26')](removeEntity(_0x58bd20,null))['catch'](handleError(_0x58bd20,null));};exports[_0x04dc('0x4b')]=function(_0x1af873,_0x45a40c,_0x53a656){var _0x41df18={};var _0x271762={};var _0x1105ad;var _0x4b36a2;return db[_0x04dc('0x2c')][_0x04dc('0x4c')]({'where':{'id':_0x1af873[_0x04dc('0x45')]['id']}})[_0x04dc('0x26')](handleEntityNotFound(_0x45a40c,null))[_0x04dc('0x26')](function(_0x2c1b90){if(_0x2c1b90){_0x1105ad=_0x2c1b90;_0x271762[_0x04dc('0x31')]=_[_0x04dc('0x33')](db[_0x04dc('0x4d')][_0x04dc('0x2d')]);_0x271762[_0x04dc('0x32')]=_[_0x04dc('0x33')](_0x1af873[_0x04dc('0x32')]);_0x271762[_0x04dc('0x34')]=_['intersection'](_0x271762['model'],_0x271762[_0x04dc('0x32')]);_0x41df18[_0x04dc('0x37')]=_[_0x04dc('0x35')](_0x271762['model'],qs[_0x04dc('0x36')](_0x1af873[_0x04dc('0x32')]['fields']));_0x41df18[_0x04dc('0x37')]=_0x41df18['attributes']['length']?_0x41df18[_0x04dc('0x37')]:_0x271762[_0x04dc('0x31')];_0x41df18[_0x04dc('0x3a')]=qs['sort'](_0x1af873[_0x04dc('0x32')][_0x04dc('0x3b')]);_0x41df18[_0x04dc('0x3c')]=qs[_0x04dc('0x34')](_[_0x04dc('0x3d')](_0x1af873[_0x04dc('0x32')],_0x271762['filters']));if(_0x1af873['query'][_0x04dc('0x3e')]){_0x41df18[_0x04dc('0x3c')]=_[_0x04dc('0x3f')](_0x41df18[_0x04dc('0x3c')],{'$or':_['map'](_0x41df18[_0x04dc('0x37')],function(_0x3d4f4f){var _0x5f07a3={};_0x5f07a3[_0x3d4f4f]={'$like':'%'+_0x1af873[_0x04dc('0x32')]['filter']+'%'};return _0x5f07a3;})});}_0x41df18=_['merge']({},_0x41df18,_0x1af873['options']);return _0x1105ad[_0x04dc('0x4b')](_0x41df18);}})[_0x04dc('0x26')](function(_0x1dda35){if(_0x1dda35){_0x4b36a2=_0x1dda35['length'];if(!_0x1af873[_0x04dc('0x32')][_0x04dc('0x4e')](_0x04dc('0x39'))){_0x41df18['limit']=qs[_0x04dc('0x1e')](_0x1af873['query']['limit']);_0x41df18['offset']=qs['offset'](_0x1af873[_0x04dc('0x32')][_0x04dc('0x1c')]);}return _0x1105ad[_0x04dc('0x4b')](_0x41df18);}})[_0x04dc('0x26')](function(_0x1da613){if(_0x1da613){return _0x1da613?{'count':_0x4b36a2,'rows':_0x1da613}:null;}})[_0x04dc('0x26')](respondWithResult(_0x45a40c,null))[_0x04dc('0x46')](handleError(_0x45a40c,null));};exports[_0x04dc('0x4f')]=function(_0xa0040,_0x4e6020,_0x294a69){if(_0xa0040['body']['id']){delete _0xa0040[_0x04dc('0x48')]['id'];}return db[_0x04dc('0x2c')][_0x04dc('0x4c')]({'where':{'id':_0xa0040[_0x04dc('0x45')]['id']}})[_0x04dc('0x26')](handleEntityNotFound(_0x4e6020,null))[_0x04dc('0x26')](function(_0x28be43){if(_0x28be43){_0xa0040['body'][_0x04dc('0x50')]=_0x28be43['id'];_0xa0040[_0x04dc('0x48')][_0x04dc('0x51')]=integrations[_0x04dc('0x52')](_0xa0040['body']['channel'],_0xa0040['body']['type']);_0xa0040['body']['Descriptions']=integrations[_0x04dc('0x53')](_0xa0040[_0x04dc('0x48')]['channel'],_0xa0040[_0x04dc('0x48')][_0x04dc('0x2f')]);return db[_0x04dc('0x4d')][_0x04dc('0x47')](_0xa0040[_0x04dc('0x48')],{'include':[{'model':db[_0x04dc('0x54')],'as':_0x04dc('0x51')},{'model':db[_0x04dc('0x54')],'as':_0x04dc('0x55')}]});}return null;})[_0x04dc('0x26')](respondWithResult(_0x4e6020,null))[_0x04dc('0x46')](handleError(_0x4e6020,null));};exports[_0x04dc('0x56')]=function(_0x2f67ea,_0x2ce75b,_0x583761){var _0x16847c='';return db['FreshdeskAccount'][_0x04dc('0x4c')]({'where':{'id':_0x2f67ea['params']['id']},'attributes':['id',_0x04dc('0x57'),_0x04dc('0x58')]})[_0x04dc('0x26')](handleEntityNotFound(_0x2ce75b,null))['then'](function(_0x34d2b7){if(_0x34d2b7){_0x16847c=_0x34d2b7['remoteUri'];var _0x4d89fd=_0x16847c[_0x04dc('0x59')](-0x1);if(_0x4d89fd==='/'){_0x16847c=_0x16847c[_0x04dc('0x5a')](0x0,_0x16847c['lastIndexOf'](_0x4d89fd));}return rp({'method':_0x04dc('0x5b'),'uri':util[_0x04dc('0x5c')]('%s/%s',_0x16847c,_0x04dc('0x5d')),'headers':{'Authorization':util[_0x04dc('0x5c')](_0x04dc('0x5e'),new Buffer(util[_0x04dc('0x5c')](_0x04dc('0x5f'),_0x34d2b7[_0x04dc('0x58')]))[_0x04dc('0x60')]('base64'))},'json':!![]});}})[_0x04dc('0x26')](function(_0xca6c02){if(_0xca6c02){var _0x41fc5e=[_0x04dc('0x61'),'subject',_0x04dc('0x62'),_0x04dc('0x63'),_0x04dc('0x1a'),_0x04dc('0x64'),'group','source',_0x04dc('0x65'),_0x04dc('0x66'),_0x04dc('0x67')];_[_0x04dc('0x68')](_0xca6c02,function(_0x3deabc){return _0x41fc5e[_0x04dc('0x69')](_0x3deabc[_0x04dc('0x29')])||!_0x3deabc[_0x04dc('0x6a')]&&_0x3deabc[_0x04dc('0x2f')]!==_0x04dc('0x6b')&&_0x3deabc[_0x04dc('0x2f')]!==_0x04dc('0x6c');});return{'count':_0xca6c02[_0x04dc('0x38')],'rows':_[_0x04dc('0x2b')](_0xca6c02,function(_0x28875a){return{'id':_0x28875a[_0x04dc('0x29')],'name':_0x28875a[_0x04dc('0x6d')],'custom':!_0x28875a[_0x04dc('0x6a')],'options':_0x28875a[_0x04dc('0x6e')]?_[_0x04dc('0x2b')](_0x28875a[_0x04dc('0x6e')],function(_0x1300ec){return{'name':_[_0x04dc('0x6f')](_0x1300ec),'value':_0x1300ec};}):[]};})};}})['then'](respondWithResult(_0x2ce75b,null))[_0x04dc('0x46')](function(_0x49100d){var _0x5a7cad=_0x2f67ea[_0x04dc('0x32')][_0x04dc('0x70')]?0x1f4:_0x49100d[_0x04dc('0x71')]||0x1f4;logger['error'](_0x04dc('0x72'),_0x04dc('0x56'),_0x5a7cad,JSON[_0x04dc('0x73')](_0x49100d));delete _0x49100d[_0x04dc('0x29')];if(_0x5a7cad===0x191){_0x5a7cad=0x190;}_0x2ce75b[_0x04dc('0x1a')](_0x5a7cad)['send'](_0x2f67ea[_0x04dc('0x32')][_0x04dc('0x70')]?{'message':_0x04dc('0x74'),'statusCode':_0x49100d[_0x04dc('0x71')]}:_0x49100d);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 9317b03..906a516 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 _0x7c21=['./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x397f37,_0x3cf86d){var _0x31cae6=function(_0x5cddb9){while(--_0x5cddb9){_0x397f37['push'](_0x397f37['shift']());}};_0x31cae6(++_0x3cf86d);}(_0x7c21,0x180));var _0x17c2=function(_0x583b11,_0x24e2f0){_0x583b11=_0x583b11-0x0;var _0x400108=_0x7c21[_0x583b11];return _0x400108;};'use strict';var _=require(_0x17c2('0x0'));var util=require('util');var logger=require(_0x17c2('0x1'))(_0x17c2('0x2'));var moment=require(_0x17c2('0x3'));var BPromise=require('bluebird');var rp=require(_0x17c2('0x4'));var fs=require('fs');var path=require(_0x17c2('0x5'));var rimraf=require(_0x17c2('0x6'));var config=require(_0x17c2('0x7'));var attributes=require(_0x17c2('0x8'));var integrations=require(_0x17c2('0x9'));module[_0x17c2('0xa')]=function(_0x31f116,_0x2e31af){return _0x31f116[_0x17c2('0xb')](_0x17c2('0xc'),attributes,{'tableName':_0x17c2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa31=['moment','bluebird','path','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','lodash','../../config/logger','api'];(function(_0x493a18,_0x37fc0e){var _0x41eaa9=function(_0x31215d){while(--_0x31215d){_0x493a18['push'](_0x493a18['shift']());}};_0x41eaa9(++_0x37fc0e);}(_0xaa31,0x1e9));var _0x1aa3=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0xaa31[_0x556bb1];return _0x45455f;};'use strict';var _=require(_0x1aa3('0x0'));var util=require('util');var logger=require(_0x1aa3('0x1'))(_0x1aa3('0x2'));var moment=require(_0x1aa3('0x3'));var BPromise=require(_0x1aa3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1aa3('0x5'));var rimraf=require(_0x1aa3('0x6'));var config=require('../../config/environment');var attributes=require(_0x1aa3('0x7'));var integrations=require(_0x1aa3('0x8'));module[_0x1aa3('0x9')]=function(_0x3f5d27,_0x477c60){return _0x3f5d27[_0x1aa3('0xa')](_0x1aa3('0xb'),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 47feb65..03ceb2a 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 _0x63de=['limit','include','map','model','FreshdeskAccount','ShowFreshdeskAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFreshdeskAccount','findAll','options','raw','where','attributes'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x63de,0xb5));var _0xe63d=function(_0x1b3ba6,_0x58662f){_0x1b3ba6=_0x1b3ba6-0x0;var _0x49b813=_0x63de[_0x1b3ba6];return _0x49b813;};'use strict';var _=require(_0xe63d('0x0'));var util=require('util');var moment=require(_0xe63d('0x1'));var BPromise=require(_0xe63d('0x2'));var rs=require(_0xe63d('0x3'));var fs=require('fs');var Redis=require(_0xe63d('0x4'));var db=require(_0xe63d('0x5'))['db'];var utils=require(_0xe63d('0x6'));var logger=require('../../config/logger')(_0xe63d('0x7'));var config=require('../../config/environment');var jayson=require(_0xe63d('0x8'));var client=jayson[_0xe63d('0x9')][_0xe63d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e9986,_0x4c945e,_0x2cf6d0){return new BPromise(function(_0x90b8c9,_0x4b0603){return client[_0xe63d('0xb')](_0x2e9986,_0x2cf6d0)[_0xe63d('0xc')](function(_0x52e876){logger[_0xe63d('0xd')](_0xe63d('0xe'),_0x4c945e,_0xe63d('0xf'));logger[_0xe63d('0x10')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x4c945e,_0xe63d('0xf'),JSON[_0xe63d('0x11')](_0x52e876));if(_0x52e876[_0xe63d('0x12')]){if(_0x52e876[_0xe63d('0x12')][_0xe63d('0x13')]===0x1f4){logger[_0xe63d('0x12')](_0xe63d('0xe'),_0x4c945e,_0x52e876[_0xe63d('0x12')][_0xe63d('0x14')]);return _0x4b0603(_0x52e876[_0xe63d('0x12')][_0xe63d('0x14')]);}logger[_0xe63d('0x12')](_0xe63d('0xe'),_0x4c945e,_0x52e876[_0xe63d('0x12')][_0xe63d('0x14')]);return _0x90b8c9(_0x52e876[_0xe63d('0x12')]['message']);}else{logger[_0xe63d('0xd')](_0xe63d('0xe'),_0x4c945e,'request\x20sent');_0x90b8c9(_0x52e876[_0xe63d('0x15')][_0xe63d('0x14')]);}})[_0xe63d('0x16')](function(_0x5e8d87){logger[_0xe63d('0x12')](_0xe63d('0xe'),_0x4c945e,_0x5e8d87);_0x4b0603(_0x5e8d87);});});}exports[_0xe63d('0x17')]=function(_0x55c364){var _0xf62ad3=this;return new Promise(function(_0x70ad87,_0x44a402){return db['FreshdeskAccount'][_0xe63d('0x18')]({'raw':_0x55c364[_0xe63d('0x19')]?_0x55c364[_0xe63d('0x19')][_0xe63d('0x1a')]===undefined?!![]:![]:!![],'where':_0x55c364[_0xe63d('0x19')]?_0x55c364['options'][_0xe63d('0x1b')]||null:null,'attributes':_0x55c364['options']?_0x55c364[_0xe63d('0x19')][_0xe63d('0x1c')]||null:null,'limit':_0x55c364[_0xe63d('0x19')]?_0x55c364[_0xe63d('0x19')][_0xe63d('0x1d')]||null:null,'include':_0x55c364[_0xe63d('0x19')]?_0x55c364['options'][_0xe63d('0x1e')]?_[_0xe63d('0x1f')](_0x55c364['options']['include'],function(_0x2957bc){return{'model':db[_0x2957bc[_0xe63d('0x20')]],'as':_0x2957bc['as'],'attributes':_0x2957bc[_0xe63d('0x1c')],'include':_0x2957bc[_0xe63d('0x1e')]?_[_0xe63d('0x1f')](_0x2957bc['include'],function(_0x1320ea){return{'model':db[_0x1320ea[_0xe63d('0x20')]],'as':_0x1320ea['as'],'attributes':_0x1320ea['attributes'],'include':_0x1320ea[_0xe63d('0x1e')]?_[_0xe63d('0x1f')](_0x1320ea[_0xe63d('0x1e')],function(_0x2cc7ed){return{'model':db[_0x2cc7ed[_0xe63d('0x20')]],'as':_0x2cc7ed['as'],'attributes':_0x2cc7ed[_0xe63d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe63d('0xc')](function(_0x3d107c){logger[_0xe63d('0xd')](_0xe63d('0x17'),_0x55c364);logger[_0xe63d('0x10')](_0xe63d('0x17'),_0x55c364,JSON[_0xe63d('0x11')](_0x3d107c));_0x70ad87(_0x3d107c);})[_0xe63d('0x16')](function(_0x3cc683){logger[_0xe63d('0x12')](_0xe63d('0x17'),_0x3cc683[_0xe63d('0x14')],_0x55c364);_0x44a402(_0xf62ad3['error'](0x1f4,_0x3cc683[_0xe63d('0x14')]));});});};exports['ShowFreshdeskAccount']=function(_0x2146ae){var _0x3a017b=this;return new Promise(function(_0x25cb2c,_0x25a2e4){return db[_0xe63d('0x21')]['find']({'raw':_0x2146ae[_0xe63d('0x19')]?_0x2146ae[_0xe63d('0x19')][_0xe63d('0x1a')]===undefined?!![]:![]:!![],'where':_0x2146ae[_0xe63d('0x19')]?_0x2146ae[_0xe63d('0x19')]['where']||null:null,'attributes':_0x2146ae['options']?_0x2146ae['options'][_0xe63d('0x1c')]||null:null,'include':_0x2146ae[_0xe63d('0x19')]?_0x2146ae[_0xe63d('0x19')][_0xe63d('0x1e')]?_[_0xe63d('0x1f')](_0x2146ae[_0xe63d('0x19')]['include'],function(_0x4f9bbd){return{'model':db[_0x4f9bbd[_0xe63d('0x20')]],'as':_0x4f9bbd['as'],'attributes':_0x4f9bbd[_0xe63d('0x1c')],'include':_0x4f9bbd[_0xe63d('0x1e')]?_['map'](_0x4f9bbd['include'],function(_0x3d27ae){return{'model':db[_0x3d27ae[_0xe63d('0x20')]],'as':_0x3d27ae['as'],'attributes':_0x3d27ae[_0xe63d('0x1c')],'include':_0x3d27ae['include']?_[_0xe63d('0x1f')](_0x3d27ae[_0xe63d('0x1e')],function(_0x3719d4){return{'model':db[_0x3719d4[_0xe63d('0x20')]],'as':_0x3719d4['as'],'attributes':_0x3719d4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2564c3){logger[_0xe63d('0xd')](_0xe63d('0x22'),_0x2146ae);logger['debug'](_0xe63d('0x22'),_0x2146ae,JSON['stringify'](_0x2564c3));_0x25cb2c(_0x2564c3);})['catch'](function(_0x472571){logger[_0xe63d('0x12')](_0xe63d('0x22'),_0x472571[_0xe63d('0x14')],_0x2146ae);_0x25a2e4(_0x3a017b[_0xe63d('0x12')](0x1f4,_0x472571[_0xe63d('0x14')]));});});}; \ No newline at end of file +var _0x28eb=['model','stringify','ShowFreshdeskAccount','find','raw','map','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','attributes','limit','include'];(function(_0x260aeb,_0x20b598){var _0x45665a=function(_0x1f9c64){while(--_0x1f9c64){_0x260aeb['push'](_0x260aeb['shift']());}};_0x45665a(++_0x20b598);}(_0x28eb,0x19e));var _0xb28e=function(_0x270287,_0x164b7b){_0x270287=_0x270287-0x0;var _0x2644b4=_0x28eb[_0x270287];return _0x2644b4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb28e('0x0'));var BPromise=require(_0xb28e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb28e('0x2'));var db=require(_0xb28e('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb28e('0x4'));var config=require(_0xb28e('0x5'));var jayson=require(_0xb28e('0x6'));var client=jayson[_0xb28e('0x7')][_0xb28e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2ea8c8,_0x20b7fe,_0x4df71a){return new BPromise(function(_0x42472d,_0x4e6da5){return client[_0xb28e('0x9')](_0x2ea8c8,_0x4df71a)[_0xb28e('0xa')](function(_0x256ced){logger[_0xb28e('0xb')](_0xb28e('0xc'),_0x20b7fe,_0xb28e('0xd'));logger[_0xb28e('0xe')](_0xb28e('0xf'),_0x20b7fe,'request\x20sent',JSON['stringify'](_0x256ced));if(_0x256ced['error']){if(_0x256ced[_0xb28e('0x10')][_0xb28e('0x11')]===0x1f4){logger[_0xb28e('0x10')](_0xb28e('0xc'),_0x20b7fe,_0x256ced[_0xb28e('0x10')][_0xb28e('0x12')]);return _0x4e6da5(_0x256ced['error'][_0xb28e('0x12')]);}logger[_0xb28e('0x10')](_0xb28e('0xc'),_0x20b7fe,_0x256ced['error'][_0xb28e('0x12')]);return _0x42472d(_0x256ced[_0xb28e('0x10')][_0xb28e('0x12')]);}else{logger[_0xb28e('0xb')](_0xb28e('0xc'),_0x20b7fe,_0xb28e('0xd'));_0x42472d(_0x256ced[_0xb28e('0x13')][_0xb28e('0x12')]);}})['catch'](function(_0x4dd072){logger['error'](_0xb28e('0xc'),_0x20b7fe,_0x4dd072);_0x4e6da5(_0x4dd072);});});}exports[_0xb28e('0x14')]=function(_0x472de7){var _0x524b7a=this;return new Promise(function(_0x4affef,_0x2dde83){return db[_0xb28e('0x15')][_0xb28e('0x16')]({'raw':_0x472de7[_0xb28e('0x17')]?_0x472de7[_0xb28e('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x472de7['options']?_0x472de7[_0xb28e('0x17')][_0xb28e('0x18')]||null:null,'attributes':_0x472de7['options']?_0x472de7[_0xb28e('0x17')][_0xb28e('0x19')]||null:null,'limit':_0x472de7[_0xb28e('0x17')]?_0x472de7[_0xb28e('0x17')][_0xb28e('0x1a')]||null:null,'include':_0x472de7[_0xb28e('0x17')]?_0x472de7['options'][_0xb28e('0x1b')]?_['map'](_0x472de7[_0xb28e('0x17')]['include'],function(_0x1013bb){return{'model':db[_0x1013bb[_0xb28e('0x1c')]],'as':_0x1013bb['as'],'attributes':_0x1013bb[_0xb28e('0x19')],'include':_0x1013bb[_0xb28e('0x1b')]?_['map'](_0x1013bb[_0xb28e('0x1b')],function(_0x58ce2a){return{'model':db[_0x58ce2a[_0xb28e('0x1c')]],'as':_0x58ce2a['as'],'attributes':_0x58ce2a[_0xb28e('0x19')],'include':_0x58ce2a[_0xb28e('0x1b')]?_['map'](_0x58ce2a[_0xb28e('0x1b')],function(_0x2fac08){return{'model':db[_0x2fac08[_0xb28e('0x1c')]],'as':_0x2fac08['as'],'attributes':_0x2fac08[_0xb28e('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb28e('0xa')](function(_0x44e5c5){logger['info'](_0xb28e('0x14'),_0x472de7);logger[_0xb28e('0xe')]('GetFreshdeskAccount',_0x472de7,JSON[_0xb28e('0x1d')](_0x44e5c5));_0x4affef(_0x44e5c5);})['catch'](function(_0x59346a){logger[_0xb28e('0x10')](_0xb28e('0x14'),_0x59346a[_0xb28e('0x12')],_0x472de7);_0x2dde83(_0x524b7a[_0xb28e('0x10')](0x1f4,_0x59346a[_0xb28e('0x12')]));});});};exports[_0xb28e('0x1e')]=function(_0x1e1038){var _0x50968c=this;return new Promise(function(_0x51dde3,_0x1ec6ed){return db[_0xb28e('0x15')][_0xb28e('0x1f')]({'raw':_0x1e1038['options']?_0x1e1038[_0xb28e('0x17')][_0xb28e('0x20')]===undefined?!![]:![]:!![],'where':_0x1e1038[_0xb28e('0x17')]?_0x1e1038[_0xb28e('0x17')]['where']||null:null,'attributes':_0x1e1038[_0xb28e('0x17')]?_0x1e1038[_0xb28e('0x17')]['attributes']||null:null,'include':_0x1e1038['options']?_0x1e1038[_0xb28e('0x17')][_0xb28e('0x1b')]?_['map'](_0x1e1038[_0xb28e('0x17')][_0xb28e('0x1b')],function(_0x7d6e17){return{'model':db[_0x7d6e17[_0xb28e('0x1c')]],'as':_0x7d6e17['as'],'attributes':_0x7d6e17['attributes'],'include':_0x7d6e17['include']?_[_0xb28e('0x21')](_0x7d6e17['include'],function(_0x59bfc2){return{'model':db[_0x59bfc2[_0xb28e('0x1c')]],'as':_0x59bfc2['as'],'attributes':_0x59bfc2['attributes'],'include':_0x59bfc2[_0xb28e('0x1b')]?_[_0xb28e('0x21')](_0x59bfc2[_0xb28e('0x1b')],function(_0x5d9924){return{'model':db[_0x5d9924[_0xb28e('0x1c')]],'as':_0x5d9924['as'],'attributes':_0x5d9924[_0xb28e('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb28e('0xa')](function(_0xa0ccd0){logger['info']('ShowFreshdeskAccount',_0x1e1038);logger[_0xb28e('0xe')]('ShowFreshdeskAccount',_0x1e1038,JSON[_0xb28e('0x1d')](_0xa0ccd0));_0x51dde3(_0xa0ccd0);})['catch'](function(_0x1577c6){logger[_0xb28e('0x10')](_0xb28e('0x1e'),_0x1577c6[_0xb28e('0x12')],_0x1e1038);_0x1ec6ed(_0x50968c[_0xb28e('0x10')](0x1f4,_0x1577c6[_0xb28e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 371d59a..1d9aa24 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 _0x82f0=['post','create','setTags','put','/:id','update','delete','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','index','isAuthenticated','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags'];(function(_0x5738cf,_0x1f35dc){var _0xb8ed56=function(_0x4f9445){while(--_0x4f9445){_0x5738cf['push'](_0x5738cf['shift']());}};_0xb8ed56(++_0x1f35dc);}(_0x82f0,0x9e));var _0x082f=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x82f0[_0x30ae5e];return _0x1f2e93;};'use strict';var multer=require(_0x082f('0x0'));var util=require(_0x082f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x082f('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x082f('0x3'));var interaction=require(_0x082f('0x4'));var config=require('../../config/environment');var controller=require(_0x082f('0x5'));router[_0x082f('0x6')]('/',auth['isAuthenticated'](),controller[_0x082f('0x7')]);router[_0x082f('0x6')]('/:id',auth[_0x082f('0x8')](),controller[_0x082f('0x9')]);router[_0x082f('0x6')](_0x082f('0xa'),auth[_0x082f('0x8')](),controller[_0x082f('0xb')]);router[_0x082f('0x6')]('/:id/subjects',auth[_0x082f('0x8')](),controller[_0x082f('0xc')]);router['get'](_0x082f('0xd'),auth[_0x082f('0x8')](),controller[_0x082f('0xe')]);router[_0x082f('0x6')](_0x082f('0xf'),auth[_0x082f('0x8')](),controller[_0x082f('0x10')]);router[_0x082f('0x11')]('/',auth[_0x082f('0x8')](),controller[_0x082f('0x12')]);router[_0x082f('0x11')]('/:id/tags',auth[_0x082f('0x8')](),controller[_0x082f('0x13')]);router[_0x082f('0x14')](_0x082f('0x15'),auth[_0x082f('0x8')](),controller[_0x082f('0x16')]);router[_0x082f('0x17')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x082f('0x18')]=router; \ No newline at end of file +var _0x06b4=['getFields','/:id/subjects','getSubjects','getDescriptions','getTags','create','post','/:id/tags','setTags','put','update','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x51539f,_0x37d665){var _0x54b904=function(_0x45397c){while(--_0x45397c){_0x51539f['push'](_0x51539f['shift']());}};_0x54b904(++_0x37d665);}(_0x06b4,0x195));var _0x406b=function(_0xf53937,_0x2bf512){_0xf53937=_0xf53937-0x0;var _0x33b67b=_0x06b4[_0xf53937];return _0x33b67b;};'use strict';var multer=require(_0x406b('0x0'));var util=require(_0x406b('0x1'));var path=require('path');var timeout=require(_0x406b('0x2'));var express=require(_0x406b('0x3'));var router=express['Router']();var fs_extra=require(_0x406b('0x4'));var auth=require(_0x406b('0x5'));var interaction=require(_0x406b('0x6'));var config=require(_0x406b('0x7'));var controller=require(_0x406b('0x8'));router[_0x406b('0x9')]('/',auth[_0x406b('0xa')](),controller[_0x406b('0xb')]);router[_0x406b('0x9')](_0x406b('0xc'),auth[_0x406b('0xa')](),controller[_0x406b('0xd')]);router[_0x406b('0x9')](_0x406b('0xe'),auth[_0x406b('0xa')](),controller[_0x406b('0xf')]);router[_0x406b('0x9')](_0x406b('0x10'),auth[_0x406b('0xa')](),controller[_0x406b('0x11')]);router[_0x406b('0x9')]('/:id/descriptions',auth[_0x406b('0xa')](),controller[_0x406b('0x12')]);router[_0x406b('0x9')]('/:id/tags',auth[_0x406b('0xa')](),controller[_0x406b('0x13')]);router['post']('/',auth[_0x406b('0xa')](),controller[_0x406b('0x14')]);router[_0x406b('0x15')](_0x406b('0x16'),auth['isAuthenticated'](),controller[_0x406b('0x17')]);router[_0x406b('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x406b('0x19')]);router['delete']('/:id',auth[_0x406b('0xa')](),controller[_0x406b('0x1a')]);module[_0x406b('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index cb53ebd..e458736 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 _0xc697=['sequelize','STRING'];(function(_0x145fa7,_0x283baf){var _0x44eef1=function(_0x2b1941){while(--_0x2b1941){_0x145fa7['push'](_0x145fa7['shift']());}};_0x44eef1(++_0x283baf);}(_0xc697,0xc0));var _0x7c69=function(_0xd4424b,_0x7eca1c){_0xd4424b=_0xd4424b-0x0;var _0x5d03c3=_0xc697[_0xd4424b];return _0x5d03c3;};'use strict';var Sequelize=require(_0x7c69('0x0'));module['exports']={'name':{'type':Sequelize[_0x7c69('0x1')]},'description':{'type':Sequelize[_0x7c69('0x1')]}}; \ No newline at end of file +var _0xcb69=['STRING','sequelize'];(function(_0x7cb1c,_0x34a1ef){var _0x37de53=function(_0x22e5d8){while(--_0x22e5d8){_0x7cb1c['push'](_0x7cb1c['shift']());}};_0x37de53(++_0x34a1ef);}(_0xcb69,0x1ef));var _0x9cb6=function(_0x33d750,_0x7431ce){_0x33d750=_0x33d750-0x0;var _0x916846=_0xcb69[_0x33d750];return _0x916846;};'use strict';var Sequelize=require(_0x9cb6('0x0'));module['exports']={'name':{'type':Sequelize[_0x9cb6('0x1')]},'description':{'type':Sequelize[_0x9cb6('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 10b8928..cbcacab 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 _0x0c8c=['pick','getSubjects','getDescriptions','Tag','getTags','setTags','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','then','error','stack','send','index','map','FreshdeskConfiguration','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','keys','find','create','body','destroy','getFields','findOne','FreshdeskField','order'];(function(_0x12a62c,_0xc9c41a){var _0x268a58=function(_0x100ca9){while(--_0x100ca9){_0x12a62c['push'](_0x12a62c['shift']());}};_0x268a58(++_0xc9c41a);}(_0x0c8c,0xff));var _0xc0c8=function(_0x2e1868,_0x1a73b9){_0x2e1868=_0x2e1868-0x0;var _0x46cb50=_0x0c8c[_0x2e1868];return _0x46cb50;};'use strict';var emlformat=require(_0xc0c8('0x0'));var rimraf=require(_0xc0c8('0x1'));var zipdir=require(_0xc0c8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc0c8('0x3'));var moment=require(_0xc0c8('0x4'));var BPromise=require(_0xc0c8('0x5'));var Mustache=require('mustache');var util=require(_0xc0c8('0x6'));var path=require(_0xc0c8('0x7'));var sox=require(_0xc0c8('0x8'));var csv=require(_0xc0c8('0x9'));var ejs=require(_0xc0c8('0xa'));var fs=require('fs');var fs_extra=require(_0xc0c8('0xb'));var _=require(_0xc0c8('0xc'));var squel=require(_0xc0c8('0xd'));var crypto=require('crypto');var jsforce=require(_0xc0c8('0xe'));var deskjs=require(_0xc0c8('0xf'));var toCsv=require(_0xc0c8('0x9'));var querystring=require(_0xc0c8('0x10'));var Papa=require('papaparse');var Redis=require(_0xc0c8('0x11'));var authService=require(_0xc0c8('0x12'));var qs=require(_0xc0c8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc0c8('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xc0c8('0x15'));var config=require(_0xc0c8('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc0c8('0x17'))['db'];function respondWithStatusCode(_0x85d4b6,_0x2b0a33){_0x2b0a33=_0x2b0a33||0xcc;return function(_0x533872){if(_0x533872){return _0x85d4b6[_0xc0c8('0x18')](_0x2b0a33);}return _0x85d4b6[_0xc0c8('0x19')](_0x2b0a33)[_0xc0c8('0x1a')]();};}function respondWithResult(_0x347eaf,_0x578f31){_0x578f31=_0x578f31||0xc8;return function(_0x66d644){if(_0x66d644){return _0x347eaf[_0xc0c8('0x19')](_0x578f31)['json'](_0x66d644);}};}function respondWithFilteredResult(_0x496251,_0x559a35){return function(_0x3a96ed){if(_0x3a96ed){var _0x51c3a7=typeof _0x559a35[_0xc0c8('0x1b')]===_0xc0c8('0x1c')&&typeof _0x559a35[_0xc0c8('0x1d')]==='undefined';var _0x29acf0=_0x3a96ed[_0xc0c8('0x1e')];var _0x1e379b=_0x51c3a7?0x0:_0x559a35[_0xc0c8('0x1b')];var _0x69c0d0=_0x51c3a7?_0x3a96ed['count']:_0x559a35['offset']+_0x559a35[_0xc0c8('0x1d')];var _0x4eb3d7;if(_0x69c0d0>=_0x29acf0){_0x69c0d0=_0x29acf0;_0x4eb3d7=0xc8;}else{_0x4eb3d7=0xce;}_0x496251['status'](_0x4eb3d7);return _0x496251[_0xc0c8('0x1f')](_0xc0c8('0x20'),_0x1e379b+'-'+_0x69c0d0+'/'+_0x29acf0)[_0xc0c8('0x21')](_0x3a96ed);}return null;};}function patchUpdates(_0x55416c){return function(_0x92370a){try{jsonpatch[_0xc0c8('0x22')](_0x92370a,_0x55416c,!![]);}catch(_0x1b28a7){return BPromise[_0xc0c8('0x23')](_0x1b28a7);}return _0x92370a['save']();};}function saveUpdates(_0x3c0b3f,_0x18e0fe){return function(_0x2d7e31){if(_0x2d7e31){return _0x2d7e31['update'](_0x3c0b3f)['then'](function(_0x1e36df){return _0x1e36df;});}return null;};}function removeEntity(_0x155182,_0x2641fa){return function(_0x1ac876){if(_0x1ac876){return _0x1ac876['destroy']()[_0xc0c8('0x24')](function(){_0x155182['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d703f,_0x19a78a){return function(_0x1a1f0d){if(!_0x1a1f0d){_0x5d703f[_0xc0c8('0x18')](0x194);}return _0x1a1f0d;};}function handleError(_0x496886,_0x5171d2){_0x5171d2=_0x5171d2||0x1f4;return function(_0x1d4740){logger[_0xc0c8('0x25')](_0x1d4740[_0xc0c8('0x26')]);if(_0x1d4740['name']){delete _0x1d4740['name'];}_0x496886[_0xc0c8('0x19')](_0x5171d2)[_0xc0c8('0x27')](_0x1d4740);};}exports[_0xc0c8('0x28')]=function(_0x6920c7,_0x1a0f6a){var _0x2bb910={},_0x556747={},_0x50e7ab={'count':0x0,'rows':[]};var _0x7d2ff3=_[_0xc0c8('0x29')](db[_0xc0c8('0x2a')]['rawAttributes'],function(_0x5a4b5c){return{'name':_0x5a4b5c[_0xc0c8('0x2b')],'type':_0x5a4b5c[_0xc0c8('0x2c')][_0xc0c8('0x2d')]};});_0x556747[_0xc0c8('0x2e')]=_[_0xc0c8('0x29')](_0x7d2ff3,'name');_0x556747[_0xc0c8('0x2f')]=_['keys'](_0x6920c7['query']);_0x556747[_0xc0c8('0x30')]=_[_0xc0c8('0x31')](_0x556747[_0xc0c8('0x2e')],_0x556747[_0xc0c8('0x2f')]);_0x2bb910[_0xc0c8('0x32')]=_[_0xc0c8('0x31')](_0x556747[_0xc0c8('0x2e')],qs[_0xc0c8('0x33')](_0x6920c7[_0xc0c8('0x2f')][_0xc0c8('0x33')]));_0x2bb910[_0xc0c8('0x32')]=_0x2bb910[_0xc0c8('0x32')][_0xc0c8('0x34')]?_0x2bb910[_0xc0c8('0x32')]:_0x556747[_0xc0c8('0x2e')];if(!_0x6920c7['query'][_0xc0c8('0x35')](_0xc0c8('0x36'))){_0x2bb910['limit']=qs[_0xc0c8('0x1d')](_0x6920c7[_0xc0c8('0x2f')][_0xc0c8('0x1d')]);_0x2bb910[_0xc0c8('0x1b')]=qs[_0xc0c8('0x1b')](_0x6920c7[_0xc0c8('0x2f')][_0xc0c8('0x1b')]);}_0x2bb910['order']=qs[_0xc0c8('0x37')](_0x6920c7['query']['sort']);_0x2bb910[_0xc0c8('0x38')]=qs[_0xc0c8('0x30')](_['pick'](_0x6920c7[_0xc0c8('0x2f')],_0x556747['filters']),_0x7d2ff3);if(_0x6920c7[_0xc0c8('0x2f')][_0xc0c8('0x39')]){_0x2bb910[_0xc0c8('0x38')]=_[_0xc0c8('0x3a')](_0x2bb910['where'],{'$or':_[_0xc0c8('0x29')](_0x7d2ff3,function(_0x5264b1){if(_0x5264b1[_0xc0c8('0x2c')]!==_0xc0c8('0x3b')){var _0x5c126f={};_0x5c126f[_0x5264b1['name']]={'$like':'%'+_0x6920c7[_0xc0c8('0x2f')]['filter']+'%'};return _0x5c126f;}})});}_0x2bb910=_[_0xc0c8('0x3a')]({},_0x2bb910,_0x6920c7[_0xc0c8('0x3c')]);var _0x580da5={'where':_0x2bb910[_0xc0c8('0x38')]};return db[_0xc0c8('0x2a')]['count'](_0x580da5)[_0xc0c8('0x24')](function(_0xcfc396){_0x50e7ab[_0xc0c8('0x1e')]=_0xcfc396;if(_0x6920c7[_0xc0c8('0x2f')][_0xc0c8('0x3d')]){_0x2bb910['include']=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xc0c8('0x3e')](_0x2bb910);})[_0xc0c8('0x24')](function(_0xd8c872){_0x50e7ab[_0xc0c8('0x3f')]=_0xd8c872;return _0x50e7ab;})['then'](respondWithFilteredResult(_0x1a0f6a,_0x2bb910))[_0xc0c8('0x40')](handleError(_0x1a0f6a,null));};exports[_0xc0c8('0x41')]=function(_0x3652aa,_0x2b8ff6){var _0x151912={'raw':![],'where':{'id':_0x3652aa[_0xc0c8('0x42')]['id']}},_0x1abd47={};_0x1abd47['model']=_['keys'](db[_0xc0c8('0x2a')][_0xc0c8('0x43')]);_0x1abd47['query']=_[_0xc0c8('0x44')](_0x3652aa[_0xc0c8('0x2f')]);_0x1abd47[_0xc0c8('0x30')]=_[_0xc0c8('0x31')](_0x1abd47['model'],_0x1abd47[_0xc0c8('0x2f')]);_0x151912['attributes']=_[_0xc0c8('0x31')](_0x1abd47[_0xc0c8('0x2e')],qs[_0xc0c8('0x33')](_0x3652aa[_0xc0c8('0x2f')][_0xc0c8('0x33')]));_0x151912['attributes']=_0x151912[_0xc0c8('0x32')]['length']?_0x151912[_0xc0c8('0x32')]:_0x1abd47[_0xc0c8('0x2e')];if(_0x3652aa[_0xc0c8('0x2f')][_0xc0c8('0x3d')]){_0x151912['include']=[{'all':!![]}];}_0x151912=_[_0xc0c8('0x3a')]({},_0x151912,_0x3652aa[_0xc0c8('0x3c')]);return db[_0xc0c8('0x2a')][_0xc0c8('0x45')](_0x151912)['then'](handleEntityNotFound(_0x2b8ff6,null))['then'](respondWithResult(_0x2b8ff6,null))[_0xc0c8('0x40')](handleError(_0x2b8ff6,null));};exports[_0xc0c8('0x46')]=function(_0x3b24fc,_0x40f54f){return db[_0xc0c8('0x2a')][_0xc0c8('0x46')](_0x3b24fc[_0xc0c8('0x47')],{})[_0xc0c8('0x24')](respondWithResult(_0x40f54f,0xc9))[_0xc0c8('0x40')](handleError(_0x40f54f,null));};exports['update']=function(_0x2ab530,_0x5b60a6){if(_0x2ab530['body']['id']){delete _0x2ab530[_0xc0c8('0x47')]['id'];}return db[_0xc0c8('0x2a')][_0xc0c8('0x45')]({'where':{'id':_0x2ab530['params']['id']}})[_0xc0c8('0x24')](handleEntityNotFound(_0x5b60a6,null))[_0xc0c8('0x24')](saveUpdates(_0x2ab530[_0xc0c8('0x47')],null))['then'](respondWithResult(_0x5b60a6,null))['catch'](handleError(_0x5b60a6,null));};exports[_0xc0c8('0x48')]=function(_0x5e884b,_0x1e49fc){return db[_0xc0c8('0x2a')][_0xc0c8('0x45')]({'where':{'id':_0x5e884b['params']['id']}})[_0xc0c8('0x24')](handleEntityNotFound(_0x1e49fc,null))['then'](removeEntity(_0x1e49fc,null))[_0xc0c8('0x40')](handleError(_0x1e49fc,null));};exports[_0xc0c8('0x49')]=function(_0xfbcda0,_0x5828df,_0xe4b44a){var _0x2a3f36={};var _0x473bd7={};var _0x4359dc;var _0x2dda8a;return db[_0xc0c8('0x2a')][_0xc0c8('0x4a')]({'where':{'id':_0xfbcda0[_0xc0c8('0x42')]['id']}})[_0xc0c8('0x24')](handleEntityNotFound(_0x5828df,null))[_0xc0c8('0x24')](function(_0x50958b){if(_0x50958b){_0x4359dc=_0x50958b;_0x473bd7[_0xc0c8('0x2e')]=_[_0xc0c8('0x44')](db[_0xc0c8('0x4b')][_0xc0c8('0x43')]);_0x473bd7[_0xc0c8('0x2f')]=_['keys'](_0xfbcda0[_0xc0c8('0x2f')]);_0x473bd7[_0xc0c8('0x30')]=_[_0xc0c8('0x31')](_0x473bd7[_0xc0c8('0x2e')],_0x473bd7[_0xc0c8('0x2f')]);_0x2a3f36[_0xc0c8('0x32')]=_[_0xc0c8('0x31')](_0x473bd7[_0xc0c8('0x2e')],qs[_0xc0c8('0x33')](_0xfbcda0[_0xc0c8('0x2f')][_0xc0c8('0x33')]));_0x2a3f36['attributes']=_0x2a3f36[_0xc0c8('0x32')][_0xc0c8('0x34')]?_0x2a3f36[_0xc0c8('0x32')]:_0x473bd7[_0xc0c8('0x2e')];_0x2a3f36[_0xc0c8('0x4c')]=qs[_0xc0c8('0x37')](_0xfbcda0['query'][_0xc0c8('0x37')]);_0x2a3f36[_0xc0c8('0x38')]=qs['filters'](_[_0xc0c8('0x4d')](_0xfbcda0[_0xc0c8('0x2f')],_0x473bd7[_0xc0c8('0x30')]));if(_0xfbcda0[_0xc0c8('0x2f')]['filter']){_0x2a3f36['where']=_[_0xc0c8('0x3a')](_0x2a3f36[_0xc0c8('0x38')],{'$or':_[_0xc0c8('0x29')](_0x2a3f36['attributes'],function(_0x55e52){var _0x5e5360={};_0x5e5360[_0x55e52]={'$like':'%'+_0xfbcda0[_0xc0c8('0x2f')][_0xc0c8('0x39')]+'%'};return _0x5e5360;})});}_0x2a3f36=_[_0xc0c8('0x3a')]({},_0x2a3f36,_0xfbcda0[_0xc0c8('0x3c')]);return _0x4359dc[_0xc0c8('0x49')](_0x2a3f36);}})[_0xc0c8('0x24')](function(_0x4cf596){if(_0x4cf596){_0x2dda8a=_0x4cf596[_0xc0c8('0x34')];if(!_0xfbcda0[_0xc0c8('0x2f')][_0xc0c8('0x35')](_0xc0c8('0x36'))){_0x2a3f36[_0xc0c8('0x1d')]=qs[_0xc0c8('0x1d')](_0xfbcda0[_0xc0c8('0x2f')]['limit']);_0x2a3f36[_0xc0c8('0x1b')]=qs[_0xc0c8('0x1b')](_0xfbcda0[_0xc0c8('0x2f')]['offset']);}return _0x4359dc[_0xc0c8('0x49')](_0x2a3f36);}})['then'](function(_0xd9356b){if(_0xd9356b){return _0xd9356b?{'count':_0x2dda8a,'rows':_0xd9356b}:null;}})[_0xc0c8('0x24')](respondWithResult(_0x5828df,null))[_0xc0c8('0x40')](handleError(_0x5828df,null));};exports['getSubjects']=function(_0x31b728,_0x5e2e1b,_0x5133b7){var _0x196298={};var _0x1a6992={};var _0x209b6b;var _0x166d37;return db[_0xc0c8('0x2a')][_0xc0c8('0x4a')]({'where':{'id':_0x31b728[_0xc0c8('0x42')]['id']}})['then'](handleEntityNotFound(_0x5e2e1b,null))[_0xc0c8('0x24')](function(_0x1d22e3){if(_0x1d22e3){_0x209b6b=_0x1d22e3;_0x1a6992[_0xc0c8('0x2e')]=_[_0xc0c8('0x44')](db[_0xc0c8('0x4b')][_0xc0c8('0x43')]);_0x1a6992[_0xc0c8('0x2f')]=_['keys'](_0x31b728[_0xc0c8('0x2f')]);_0x1a6992[_0xc0c8('0x30')]=_[_0xc0c8('0x31')](_0x1a6992[_0xc0c8('0x2e')],_0x1a6992['query']);_0x196298[_0xc0c8('0x32')]=_[_0xc0c8('0x31')](_0x1a6992[_0xc0c8('0x2e')],qs[_0xc0c8('0x33')](_0x31b728[_0xc0c8('0x2f')][_0xc0c8('0x33')]));_0x196298[_0xc0c8('0x32')]=_0x196298[_0xc0c8('0x32')][_0xc0c8('0x34')]?_0x196298['attributes']:_0x1a6992[_0xc0c8('0x2e')];_0x196298[_0xc0c8('0x4c')]=qs[_0xc0c8('0x37')](_0x31b728[_0xc0c8('0x2f')]['sort']);_0x196298[_0xc0c8('0x38')]=qs[_0xc0c8('0x30')](_[_0xc0c8('0x4d')](_0x31b728['query'],_0x1a6992[_0xc0c8('0x30')]));if(_0x31b728[_0xc0c8('0x2f')][_0xc0c8('0x39')]){_0x196298[_0xc0c8('0x38')]=_[_0xc0c8('0x3a')](_0x196298[_0xc0c8('0x38')],{'$or':_[_0xc0c8('0x29')](_0x196298[_0xc0c8('0x32')],function(_0x2de84a){var _0x3ea9e8={};_0x3ea9e8[_0x2de84a]={'$like':'%'+_0x31b728[_0xc0c8('0x2f')][_0xc0c8('0x39')]+'%'};return _0x3ea9e8;})});}_0x196298=_[_0xc0c8('0x3a')]({},_0x196298,_0x31b728[_0xc0c8('0x3c')]);return _0x209b6b['getSubjects'](_0x196298);}})['then'](function(_0x26a252){if(_0x26a252){_0x166d37=_0x26a252[_0xc0c8('0x34')];if(!_0x31b728[_0xc0c8('0x2f')]['hasOwnProperty'](_0xc0c8('0x36'))){_0x196298[_0xc0c8('0x1d')]=qs[_0xc0c8('0x1d')](_0x31b728[_0xc0c8('0x2f')][_0xc0c8('0x1d')]);_0x196298[_0xc0c8('0x1b')]=qs['offset'](_0x31b728[_0xc0c8('0x2f')][_0xc0c8('0x1b')]);}return _0x209b6b[_0xc0c8('0x4e')](_0x196298);}})['then'](function(_0xe8ff38){if(_0xe8ff38){return _0xe8ff38?{'count':_0x166d37,'rows':_0xe8ff38}:null;}})[_0xc0c8('0x24')](respondWithResult(_0x5e2e1b,null))[_0xc0c8('0x40')](handleError(_0x5e2e1b,null));};exports[_0xc0c8('0x4f')]=function(_0x10cc78,_0x2235aa,_0x42b495){var _0x534c5d={};var _0x27ba8e={};var _0xafdef5;var _0x55a8a3;return db[_0xc0c8('0x2a')][_0xc0c8('0x4a')]({'where':{'id':_0x10cc78[_0xc0c8('0x42')]['id']}})[_0xc0c8('0x24')](handleEntityNotFound(_0x2235aa,null))[_0xc0c8('0x24')](function(_0x280e4f){if(_0x280e4f){_0xafdef5=_0x280e4f;_0x27ba8e[_0xc0c8('0x2e')]=_['keys'](db[_0xc0c8('0x4b')]['rawAttributes']);_0x27ba8e[_0xc0c8('0x2f')]=_[_0xc0c8('0x44')](_0x10cc78['query']);_0x27ba8e[_0xc0c8('0x30')]=_[_0xc0c8('0x31')](_0x27ba8e[_0xc0c8('0x2e')],_0x27ba8e[_0xc0c8('0x2f')]);_0x534c5d[_0xc0c8('0x32')]=_[_0xc0c8('0x31')](_0x27ba8e[_0xc0c8('0x2e')],qs[_0xc0c8('0x33')](_0x10cc78['query'][_0xc0c8('0x33')]));_0x534c5d[_0xc0c8('0x32')]=_0x534c5d[_0xc0c8('0x32')]['length']?_0x534c5d[_0xc0c8('0x32')]:_0x27ba8e[_0xc0c8('0x2e')];_0x534c5d[_0xc0c8('0x4c')]=qs['sort'](_0x10cc78[_0xc0c8('0x2f')][_0xc0c8('0x37')]);_0x534c5d[_0xc0c8('0x38')]=qs[_0xc0c8('0x30')](_['pick'](_0x10cc78[_0xc0c8('0x2f')],_0x27ba8e[_0xc0c8('0x30')]));if(_0x10cc78[_0xc0c8('0x2f')][_0xc0c8('0x39')]){_0x534c5d['where']=_[_0xc0c8('0x3a')](_0x534c5d[_0xc0c8('0x38')],{'$or':_['map'](_0x534c5d[_0xc0c8('0x32')],function(_0x3bbf98){var _0x5139be={};_0x5139be[_0x3bbf98]={'$like':'%'+_0x10cc78[_0xc0c8('0x2f')][_0xc0c8('0x39')]+'%'};return _0x5139be;})});}_0x534c5d=_[_0xc0c8('0x3a')]({},_0x534c5d,_0x10cc78[_0xc0c8('0x3c')]);return _0xafdef5[_0xc0c8('0x4f')](_0x534c5d);}})[_0xc0c8('0x24')](function(_0x3adbf4){if(_0x3adbf4){_0x55a8a3=_0x3adbf4[_0xc0c8('0x34')];if(!_0x10cc78['query']['hasOwnProperty'](_0xc0c8('0x36'))){_0x534c5d[_0xc0c8('0x1d')]=qs[_0xc0c8('0x1d')](_0x10cc78[_0xc0c8('0x2f')][_0xc0c8('0x1d')]);_0x534c5d[_0xc0c8('0x1b')]=qs['offset'](_0x10cc78['query'][_0xc0c8('0x1b')]);}return _0xafdef5[_0xc0c8('0x4f')](_0x534c5d);}})['then'](function(_0x2b2b1f){if(_0x2b2b1f){return _0x2b2b1f?{'count':_0x55a8a3,'rows':_0x2b2b1f}:null;}})[_0xc0c8('0x24')](respondWithResult(_0x2235aa,null))[_0xc0c8('0x40')](handleError(_0x2235aa,null));};exports['getTags']=function(_0x112ea5,_0x299f02,_0x5f35da){var _0x27f5f5={};var _0x11fb55={};var _0x380bdb;var _0x1105c3;return db[_0xc0c8('0x2a')][_0xc0c8('0x4a')]({'where':{'id':_0x112ea5[_0xc0c8('0x42')]['id']}})['then'](handleEntityNotFound(_0x299f02,null))[_0xc0c8('0x24')](function(_0x4b6f07){if(_0x4b6f07){_0x380bdb=_0x4b6f07;_0x11fb55[_0xc0c8('0x2e')]=_[_0xc0c8('0x44')](db[_0xc0c8('0x50')][_0xc0c8('0x43')]);_0x11fb55['query']=_[_0xc0c8('0x44')](_0x112ea5[_0xc0c8('0x2f')]);_0x11fb55[_0xc0c8('0x30')]=_[_0xc0c8('0x31')](_0x11fb55[_0xc0c8('0x2e')],_0x11fb55['query']);_0x27f5f5[_0xc0c8('0x32')]=_['intersection'](_0x11fb55['model'],qs[_0xc0c8('0x33')](_0x112ea5[_0xc0c8('0x2f')][_0xc0c8('0x33')]));_0x27f5f5[_0xc0c8('0x32')]=_0x27f5f5[_0xc0c8('0x32')][_0xc0c8('0x34')]?_0x27f5f5[_0xc0c8('0x32')]:_0x11fb55['model'];_0x27f5f5[_0xc0c8('0x4c')]=qs[_0xc0c8('0x37')](_0x112ea5[_0xc0c8('0x2f')][_0xc0c8('0x37')]);_0x27f5f5[_0xc0c8('0x38')]=qs[_0xc0c8('0x30')](_[_0xc0c8('0x4d')](_0x112ea5['query'],_0x11fb55[_0xc0c8('0x30')]));if(_0x112ea5[_0xc0c8('0x2f')][_0xc0c8('0x39')]){_0x27f5f5[_0xc0c8('0x38')]=_[_0xc0c8('0x3a')](_0x27f5f5[_0xc0c8('0x38')],{'$or':_['map'](_0x27f5f5[_0xc0c8('0x32')],function(_0xb019ab){var _0x486144={};_0x486144[_0xb019ab]={'$like':'%'+_0x112ea5[_0xc0c8('0x2f')][_0xc0c8('0x39')]+'%'};return _0x486144;})});}_0x27f5f5=_[_0xc0c8('0x3a')]({},_0x27f5f5,_0x112ea5['options']);return _0x380bdb[_0xc0c8('0x51')](_0x27f5f5);}})['then'](function(_0x52e881){if(_0x52e881){_0x1105c3=_0x52e881[_0xc0c8('0x34')];if(!_0x112ea5[_0xc0c8('0x2f')]['hasOwnProperty'](_0xc0c8('0x36'))){_0x27f5f5[_0xc0c8('0x1d')]=qs[_0xc0c8('0x1d')](_0x112ea5['query'][_0xc0c8('0x1d')]);_0x27f5f5[_0xc0c8('0x1b')]=qs[_0xc0c8('0x1b')](_0x112ea5['query'][_0xc0c8('0x1b')]);}return _0x380bdb[_0xc0c8('0x51')](_0x27f5f5);}})[_0xc0c8('0x24')](function(_0x53d9b4){if(_0x53d9b4){return _0x53d9b4?{'count':_0x1105c3,'rows':_0x53d9b4}:null;}})[_0xc0c8('0x24')](respondWithResult(_0x299f02,null))[_0xc0c8('0x40')](handleError(_0x299f02,null));};exports['setTags']=function(_0x2dd33c,_0x15ab66,_0x1a0c81){if(_0x2dd33c['body']['id']){delete _0x2dd33c[_0xc0c8('0x47')]['id'];}return db[_0xc0c8('0x2a')]['findOne']({'where':{'id':_0x2dd33c['params']['id']}})['then'](handleEntityNotFound(_0x15ab66,null))[_0xc0c8('0x24')](function(_0x461706){if(_0x461706){return _0x461706[_0xc0c8('0x52')](_0x2dd33c['body']['ids']||[]);}return null;})['then'](respondWithResult(_0x15ab66,null))[_0xc0c8('0x40')](handleError(_0x15ab66,null));}; \ No newline at end of file +var _0xeed7=['apply','reject','save','update','then','destroy','error','name','send','index','map','FreshdeskConfiguration','rawAttributes','type','query','filters','intersection','model','fields','attributes','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','getFields','nolimit','getSubjects','findOne','hasOwnProperty','getDescriptions','FreshdeskField','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0xa31c0a,_0xb45558){var _0x2cecd4=function(_0x115278){while(--_0x115278){_0xa31c0a['push'](_0xa31c0a['shift']());}};_0x2cecd4(++_0xb45558);}(_0xeed7,0x1c7));var _0x7eed=function(_0x649357,_0x152bec){_0x649357=_0x649357-0x0;var _0x41a6dd=_0xeed7[_0x649357];return _0x41a6dd;};'use strict';var emlformat=require(_0x7eed('0x0'));var rimraf=require(_0x7eed('0x1'));var zipdir=require(_0x7eed('0x2'));var jsonpatch=require(_0x7eed('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7eed('0x4'));var Mustache=require('mustache');var util=require(_0x7eed('0x5'));var path=require(_0x7eed('0x6'));var sox=require('sox');var csv=require(_0x7eed('0x7'));var ejs=require(_0x7eed('0x8'));var fs=require('fs');var fs_extra=require(_0x7eed('0x9'));var _=require('lodash');var squel=require(_0x7eed('0xa'));var crypto=require(_0x7eed('0xb'));var jsforce=require(_0x7eed('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7eed('0x7'));var querystring=require(_0x7eed('0xd'));var Papa=require('papaparse');var Redis=require(_0x7eed('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7eed('0xf'));var hardwareService=require(_0x7eed('0x10'));var logger=require(_0x7eed('0x11'))(_0x7eed('0x12'));var utils=require('../../config/utils');var config=require(_0x7eed('0x13'));var licenseUtil=require(_0x7eed('0x14'));var db=require(_0x7eed('0x15'))['db'];function respondWithStatusCode(_0x3f2a20,_0x5b5a49){_0x5b5a49=_0x5b5a49||0xcc;return function(_0x2843b2){if(_0x2843b2){return _0x3f2a20[_0x7eed('0x16')](_0x5b5a49);}return _0x3f2a20[_0x7eed('0x17')](_0x5b5a49)[_0x7eed('0x18')]();};}function respondWithResult(_0x583b5d,_0x529502){_0x529502=_0x529502||0xc8;return function(_0x237d02){if(_0x237d02){return _0x583b5d[_0x7eed('0x17')](_0x529502)[_0x7eed('0x19')](_0x237d02);}};}function respondWithFilteredResult(_0x8065cb,_0x40d65f){return function(_0x5da6a2){if(_0x5da6a2){var _0x1c8824=typeof _0x40d65f[_0x7eed('0x1a')]===_0x7eed('0x1b')&&typeof _0x40d65f[_0x7eed('0x1c')]===_0x7eed('0x1b');var _0x55bba2=_0x5da6a2['count'];var _0x372577=_0x1c8824?0x0:_0x40d65f[_0x7eed('0x1a')];var _0x2ef3bd=_0x1c8824?_0x5da6a2[_0x7eed('0x1d')]:_0x40d65f[_0x7eed('0x1a')]+_0x40d65f[_0x7eed('0x1c')];var _0x5bac51;if(_0x2ef3bd>=_0x55bba2){_0x2ef3bd=_0x55bba2;_0x5bac51=0xc8;}else{_0x5bac51=0xce;}_0x8065cb['status'](_0x5bac51);return _0x8065cb[_0x7eed('0x1e')]('Content-Range',_0x372577+'-'+_0x2ef3bd+'/'+_0x55bba2)[_0x7eed('0x19')](_0x5da6a2);}return null;};}function patchUpdates(_0x6d263d){return function(_0x40cb3e){try{jsonpatch[_0x7eed('0x1f')](_0x40cb3e,_0x6d263d,!![]);}catch(_0x58fce6){return BPromise[_0x7eed('0x20')](_0x58fce6);}return _0x40cb3e[_0x7eed('0x21')]();};}function saveUpdates(_0x2c181e,_0x486b1a){return function(_0x530782){if(_0x530782){return _0x530782[_0x7eed('0x22')](_0x2c181e)[_0x7eed('0x23')](function(_0x5c8cd5){return _0x5c8cd5;});}return null;};}function removeEntity(_0x47ef94,_0x145128){return function(_0x1a9aba){if(_0x1a9aba){return _0x1a9aba[_0x7eed('0x24')]()[_0x7eed('0x23')](function(){_0x47ef94['status'](0xcc)[_0x7eed('0x18')]();});}};}function handleEntityNotFound(_0x299492,_0x13003b){return function(_0x1d1c26){if(!_0x1d1c26){_0x299492['sendStatus'](0x194);}return _0x1d1c26;};}function handleError(_0x1a348f,_0x36d549){_0x36d549=_0x36d549||0x1f4;return function(_0x5d2004){logger[_0x7eed('0x25')](_0x5d2004['stack']);if(_0x5d2004[_0x7eed('0x26')]){delete _0x5d2004[_0x7eed('0x26')];}_0x1a348f['status'](_0x36d549)[_0x7eed('0x27')](_0x5d2004);};}exports[_0x7eed('0x28')]=function(_0x1236fb,_0x224c29){var _0x3612fc={},_0x54277f={},_0x24d843={'count':0x0,'rows':[]};var _0xd45e69=_[_0x7eed('0x29')](db[_0x7eed('0x2a')][_0x7eed('0x2b')],function(_0x12cc12){return{'name':_0x12cc12['fieldName'],'type':_0x12cc12[_0x7eed('0x2c')]['key']};});_0x54277f['model']=_['map'](_0xd45e69,_0x7eed('0x26'));_0x54277f[_0x7eed('0x2d')]=_['keys'](_0x1236fb[_0x7eed('0x2d')]);_0x54277f[_0x7eed('0x2e')]=_[_0x7eed('0x2f')](_0x54277f[_0x7eed('0x30')],_0x54277f[_0x7eed('0x2d')]);_0x3612fc['attributes']=_['intersection'](_0x54277f[_0x7eed('0x30')],qs[_0x7eed('0x31')](_0x1236fb['query'][_0x7eed('0x31')]));_0x3612fc['attributes']=_0x3612fc[_0x7eed('0x32')]['length']?_0x3612fc[_0x7eed('0x32')]:_0x54277f[_0x7eed('0x30')];if(!_0x1236fb[_0x7eed('0x2d')]['hasOwnProperty']('nolimit')){_0x3612fc['limit']=qs[_0x7eed('0x1c')](_0x1236fb['query']['limit']);_0x3612fc[_0x7eed('0x1a')]=qs[_0x7eed('0x1a')](_0x1236fb['query'][_0x7eed('0x1a')]);}_0x3612fc[_0x7eed('0x33')]=qs['sort'](_0x1236fb[_0x7eed('0x2d')][_0x7eed('0x34')]);_0x3612fc[_0x7eed('0x35')]=qs[_0x7eed('0x2e')](_[_0x7eed('0x36')](_0x1236fb['query'],_0x54277f['filters']),_0xd45e69);if(_0x1236fb[_0x7eed('0x2d')][_0x7eed('0x37')]){_0x3612fc[_0x7eed('0x35')]=_['merge'](_0x3612fc[_0x7eed('0x35')],{'$or':_['map'](_0xd45e69,function(_0xac72fc){if(_0xac72fc[_0x7eed('0x2c')]!==_0x7eed('0x38')){var _0x30bdfa={};_0x30bdfa[_0xac72fc[_0x7eed('0x26')]]={'$like':'%'+_0x1236fb[_0x7eed('0x2d')]['filter']+'%'};return _0x30bdfa;}})});}_0x3612fc=_[_0x7eed('0x39')]({},_0x3612fc,_0x1236fb[_0x7eed('0x3a')]);var _0x4e94a5={'where':_0x3612fc[_0x7eed('0x35')]};return db[_0x7eed('0x2a')][_0x7eed('0x1d')](_0x4e94a5)[_0x7eed('0x23')](function(_0x25ef8e){_0x24d843[_0x7eed('0x1d')]=_0x25ef8e;if(_0x1236fb[_0x7eed('0x2d')][_0x7eed('0x3b')]){_0x3612fc[_0x7eed('0x3c')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x7eed('0x3d')](_0x3612fc);})[_0x7eed('0x23')](function(_0x512900){_0x24d843[_0x7eed('0x3e')]=_0x512900;return _0x24d843;})[_0x7eed('0x23')](respondWithFilteredResult(_0x224c29,_0x3612fc))[_0x7eed('0x3f')](handleError(_0x224c29,null));};exports[_0x7eed('0x40')]=function(_0x5420,_0x4fb19d){var _0x1b94da={'raw':![],'where':{'id':_0x5420[_0x7eed('0x41')]['id']}},_0x2347bc={};_0x2347bc['model']=_[_0x7eed('0x42')](db[_0x7eed('0x2a')][_0x7eed('0x2b')]);_0x2347bc['query']=_['keys'](_0x5420[_0x7eed('0x2d')]);_0x2347bc[_0x7eed('0x2e')]=_[_0x7eed('0x2f')](_0x2347bc['model'],_0x2347bc['query']);_0x1b94da[_0x7eed('0x32')]=_[_0x7eed('0x2f')](_0x2347bc[_0x7eed('0x30')],qs['fields'](_0x5420[_0x7eed('0x2d')][_0x7eed('0x31')]));_0x1b94da[_0x7eed('0x32')]=_0x1b94da[_0x7eed('0x32')][_0x7eed('0x43')]?_0x1b94da[_0x7eed('0x32')]:_0x2347bc[_0x7eed('0x30')];if(_0x5420[_0x7eed('0x2d')][_0x7eed('0x3b')]){_0x1b94da[_0x7eed('0x3c')]=[{'all':!![]}];}_0x1b94da=_[_0x7eed('0x39')]({},_0x1b94da,_0x5420['options']);return db[_0x7eed('0x2a')][_0x7eed('0x44')](_0x1b94da)['then'](handleEntityNotFound(_0x4fb19d,null))[_0x7eed('0x23')](respondWithResult(_0x4fb19d,null))[_0x7eed('0x3f')](handleError(_0x4fb19d,null));};exports[_0x7eed('0x45')]=function(_0x47329c,_0x1b8c16){return db[_0x7eed('0x2a')][_0x7eed('0x45')](_0x47329c[_0x7eed('0x46')],{})['then'](respondWithResult(_0x1b8c16,0xc9))[_0x7eed('0x3f')](handleError(_0x1b8c16,null));};exports[_0x7eed('0x22')]=function(_0x3e1ef9,_0x1cad7e){if(_0x3e1ef9[_0x7eed('0x46')]['id']){delete _0x3e1ef9[_0x7eed('0x46')]['id'];}return db[_0x7eed('0x2a')][_0x7eed('0x44')]({'where':{'id':_0x3e1ef9['params']['id']}})['then'](handleEntityNotFound(_0x1cad7e,null))['then'](saveUpdates(_0x3e1ef9['body'],null))[_0x7eed('0x23')](respondWithResult(_0x1cad7e,null))[_0x7eed('0x3f')](handleError(_0x1cad7e,null));};exports['destroy']=function(_0x39c035,_0xe35fa){return db[_0x7eed('0x2a')]['find']({'where':{'id':_0x39c035[_0x7eed('0x41')]['id']}})[_0x7eed('0x23')](handleEntityNotFound(_0xe35fa,null))[_0x7eed('0x23')](removeEntity(_0xe35fa,null))[_0x7eed('0x3f')](handleError(_0xe35fa,null));};exports['getFields']=function(_0x16b7bd,_0x48195b,_0x28dbfb){var _0x54ca90={};var _0x5e4498={};var _0x1e9692;var _0x3e4a0a;return db[_0x7eed('0x2a')]['findOne']({'where':{'id':_0x16b7bd[_0x7eed('0x41')]['id']}})[_0x7eed('0x23')](handleEntityNotFound(_0x48195b,null))[_0x7eed('0x23')](function(_0x3022f7){if(_0x3022f7){_0x1e9692=_0x3022f7;_0x5e4498[_0x7eed('0x30')]=_[_0x7eed('0x42')](db['FreshdeskField']['rawAttributes']);_0x5e4498[_0x7eed('0x2d')]=_[_0x7eed('0x42')](_0x16b7bd[_0x7eed('0x2d')]);_0x5e4498[_0x7eed('0x2e')]=_[_0x7eed('0x2f')](_0x5e4498['model'],_0x5e4498[_0x7eed('0x2d')]);_0x54ca90[_0x7eed('0x32')]=_['intersection'](_0x5e4498[_0x7eed('0x30')],qs['fields'](_0x16b7bd[_0x7eed('0x2d')][_0x7eed('0x31')]));_0x54ca90[_0x7eed('0x32')]=_0x54ca90['attributes'][_0x7eed('0x43')]?_0x54ca90[_0x7eed('0x32')]:_0x5e4498[_0x7eed('0x30')];_0x54ca90['order']=qs['sort'](_0x16b7bd['query'][_0x7eed('0x34')]);_0x54ca90['where']=qs[_0x7eed('0x2e')](_[_0x7eed('0x36')](_0x16b7bd[_0x7eed('0x2d')],_0x5e4498[_0x7eed('0x2e')]));if(_0x16b7bd[_0x7eed('0x2d')]['filter']){_0x54ca90['where']=_[_0x7eed('0x39')](_0x54ca90['where'],{'$or':_[_0x7eed('0x29')](_0x54ca90['attributes'],function(_0x40428c){var _0x29f171={};_0x29f171[_0x40428c]={'$like':'%'+_0x16b7bd['query'][_0x7eed('0x37')]+'%'};return _0x29f171;})});}_0x54ca90=_[_0x7eed('0x39')]({},_0x54ca90,_0x16b7bd[_0x7eed('0x3a')]);return _0x1e9692[_0x7eed('0x47')](_0x54ca90);}})[_0x7eed('0x23')](function(_0x4bbbc2){if(_0x4bbbc2){_0x3e4a0a=_0x4bbbc2[_0x7eed('0x43')];if(!_0x16b7bd[_0x7eed('0x2d')]['hasOwnProperty'](_0x7eed('0x48'))){_0x54ca90[_0x7eed('0x1c')]=qs['limit'](_0x16b7bd[_0x7eed('0x2d')][_0x7eed('0x1c')]);_0x54ca90[_0x7eed('0x1a')]=qs[_0x7eed('0x1a')](_0x16b7bd[_0x7eed('0x2d')][_0x7eed('0x1a')]);}return _0x1e9692['getFields'](_0x54ca90);}})['then'](function(_0x2ce399){if(_0x2ce399){return _0x2ce399?{'count':_0x3e4a0a,'rows':_0x2ce399}:null;}})[_0x7eed('0x23')](respondWithResult(_0x48195b,null))[_0x7eed('0x3f')](handleError(_0x48195b,null));};exports[_0x7eed('0x49')]=function(_0x3f888f,_0x30214a,_0x23c3c6){var _0x5b2e65={};var _0x14c2a4={};var _0x1455cd;var _0x3c22a2;return db[_0x7eed('0x2a')][_0x7eed('0x4a')]({'where':{'id':_0x3f888f[_0x7eed('0x41')]['id']}})['then'](handleEntityNotFound(_0x30214a,null))[_0x7eed('0x23')](function(_0x3feb57){if(_0x3feb57){_0x1455cd=_0x3feb57;_0x14c2a4[_0x7eed('0x30')]=_[_0x7eed('0x42')](db['FreshdeskField']['rawAttributes']);_0x14c2a4[_0x7eed('0x2d')]=_['keys'](_0x3f888f[_0x7eed('0x2d')]);_0x14c2a4[_0x7eed('0x2e')]=_[_0x7eed('0x2f')](_0x14c2a4[_0x7eed('0x30')],_0x14c2a4[_0x7eed('0x2d')]);_0x5b2e65['attributes']=_['intersection'](_0x14c2a4[_0x7eed('0x30')],qs[_0x7eed('0x31')](_0x3f888f['query'][_0x7eed('0x31')]));_0x5b2e65[_0x7eed('0x32')]=_0x5b2e65['attributes'][_0x7eed('0x43')]?_0x5b2e65['attributes']:_0x14c2a4['model'];_0x5b2e65[_0x7eed('0x33')]=qs['sort'](_0x3f888f['query'][_0x7eed('0x34')]);_0x5b2e65[_0x7eed('0x35')]=qs[_0x7eed('0x2e')](_['pick'](_0x3f888f[_0x7eed('0x2d')],_0x14c2a4[_0x7eed('0x2e')]));if(_0x3f888f[_0x7eed('0x2d')][_0x7eed('0x37')]){_0x5b2e65[_0x7eed('0x35')]=_[_0x7eed('0x39')](_0x5b2e65[_0x7eed('0x35')],{'$or':_[_0x7eed('0x29')](_0x5b2e65['attributes'],function(_0x5b4cee){var _0x5e4820={};_0x5e4820[_0x5b4cee]={'$like':'%'+_0x3f888f['query'][_0x7eed('0x37')]+'%'};return _0x5e4820;})});}_0x5b2e65=_[_0x7eed('0x39')]({},_0x5b2e65,_0x3f888f[_0x7eed('0x3a')]);return _0x1455cd[_0x7eed('0x49')](_0x5b2e65);}})[_0x7eed('0x23')](function(_0x2c1ce6){if(_0x2c1ce6){_0x3c22a2=_0x2c1ce6['length'];if(!_0x3f888f['query'][_0x7eed('0x4b')]('nolimit')){_0x5b2e65['limit']=qs[_0x7eed('0x1c')](_0x3f888f[_0x7eed('0x2d')]['limit']);_0x5b2e65['offset']=qs['offset'](_0x3f888f['query'][_0x7eed('0x1a')]);}return _0x1455cd[_0x7eed('0x49')](_0x5b2e65);}})['then'](function(_0x43b54e){if(_0x43b54e){return _0x43b54e?{'count':_0x3c22a2,'rows':_0x43b54e}:null;}})['then'](respondWithResult(_0x30214a,null))[_0x7eed('0x3f')](handleError(_0x30214a,null));};exports[_0x7eed('0x4c')]=function(_0x142df2,_0x3060fe,_0x25b3a4){var _0x3d93f0={};var _0x4ba46b={};var _0xedc0f8;var _0x1c3f5c;return db[_0x7eed('0x2a')]['findOne']({'where':{'id':_0x142df2[_0x7eed('0x41')]['id']}})[_0x7eed('0x23')](handleEntityNotFound(_0x3060fe,null))[_0x7eed('0x23')](function(_0x4f59d9){if(_0x4f59d9){_0xedc0f8=_0x4f59d9;_0x4ba46b['model']=_[_0x7eed('0x42')](db[_0x7eed('0x4d')][_0x7eed('0x2b')]);_0x4ba46b[_0x7eed('0x2d')]=_[_0x7eed('0x42')](_0x142df2[_0x7eed('0x2d')]);_0x4ba46b[_0x7eed('0x2e')]=_[_0x7eed('0x2f')](_0x4ba46b[_0x7eed('0x30')],_0x4ba46b['query']);_0x3d93f0[_0x7eed('0x32')]=_['intersection'](_0x4ba46b[_0x7eed('0x30')],qs[_0x7eed('0x31')](_0x142df2[_0x7eed('0x2d')][_0x7eed('0x31')]));_0x3d93f0[_0x7eed('0x32')]=_0x3d93f0[_0x7eed('0x32')][_0x7eed('0x43')]?_0x3d93f0[_0x7eed('0x32')]:_0x4ba46b[_0x7eed('0x30')];_0x3d93f0[_0x7eed('0x33')]=qs[_0x7eed('0x34')](_0x142df2[_0x7eed('0x2d')][_0x7eed('0x34')]);_0x3d93f0['where']=qs['filters'](_[_0x7eed('0x36')](_0x142df2[_0x7eed('0x2d')],_0x4ba46b[_0x7eed('0x2e')]));if(_0x142df2['query'][_0x7eed('0x37')]){_0x3d93f0[_0x7eed('0x35')]=_[_0x7eed('0x39')](_0x3d93f0[_0x7eed('0x35')],{'$or':_['map'](_0x3d93f0[_0x7eed('0x32')],function(_0xd916a0){var _0xbff97a={};_0xbff97a[_0xd916a0]={'$like':'%'+_0x142df2[_0x7eed('0x2d')]['filter']+'%'};return _0xbff97a;})});}_0x3d93f0=_['merge']({},_0x3d93f0,_0x142df2[_0x7eed('0x3a')]);return _0xedc0f8[_0x7eed('0x4c')](_0x3d93f0);}})[_0x7eed('0x23')](function(_0x50a0e2){if(_0x50a0e2){_0x1c3f5c=_0x50a0e2[_0x7eed('0x43')];if(!_0x142df2[_0x7eed('0x2d')][_0x7eed('0x4b')](_0x7eed('0x48'))){_0x3d93f0[_0x7eed('0x1c')]=qs[_0x7eed('0x1c')](_0x142df2[_0x7eed('0x2d')]['limit']);_0x3d93f0[_0x7eed('0x1a')]=qs[_0x7eed('0x1a')](_0x142df2[_0x7eed('0x2d')][_0x7eed('0x1a')]);}return _0xedc0f8[_0x7eed('0x4c')](_0x3d93f0);}})['then'](function(_0xac9379){if(_0xac9379){return _0xac9379?{'count':_0x1c3f5c,'rows':_0xac9379}:null;}})['then'](respondWithResult(_0x3060fe,null))[_0x7eed('0x3f')](handleError(_0x3060fe,null));};exports[_0x7eed('0x4e')]=function(_0x5c659b,_0x377c9c,_0x15d225){var _0x2420e1={};var _0x42bf01={};var _0x56d461;var _0x2ee1cc;return db[_0x7eed('0x2a')][_0x7eed('0x4a')]({'where':{'id':_0x5c659b[_0x7eed('0x41')]['id']}})['then'](handleEntityNotFound(_0x377c9c,null))[_0x7eed('0x23')](function(_0x3edfc9){if(_0x3edfc9){_0x56d461=_0x3edfc9;_0x42bf01[_0x7eed('0x30')]=_[_0x7eed('0x42')](db['Tag'][_0x7eed('0x2b')]);_0x42bf01[_0x7eed('0x2d')]=_[_0x7eed('0x42')](_0x5c659b[_0x7eed('0x2d')]);_0x42bf01[_0x7eed('0x2e')]=_[_0x7eed('0x2f')](_0x42bf01[_0x7eed('0x30')],_0x42bf01[_0x7eed('0x2d')]);_0x2420e1[_0x7eed('0x32')]=_[_0x7eed('0x2f')](_0x42bf01[_0x7eed('0x30')],qs[_0x7eed('0x31')](_0x5c659b[_0x7eed('0x2d')]['fields']));_0x2420e1[_0x7eed('0x32')]=_0x2420e1[_0x7eed('0x32')][_0x7eed('0x43')]?_0x2420e1[_0x7eed('0x32')]:_0x42bf01['model'];_0x2420e1[_0x7eed('0x33')]=qs['sort'](_0x5c659b[_0x7eed('0x2d')][_0x7eed('0x34')]);_0x2420e1[_0x7eed('0x35')]=qs[_0x7eed('0x2e')](_[_0x7eed('0x36')](_0x5c659b[_0x7eed('0x2d')],_0x42bf01[_0x7eed('0x2e')]));if(_0x5c659b['query'][_0x7eed('0x37')]){_0x2420e1[_0x7eed('0x35')]=_[_0x7eed('0x39')](_0x2420e1[_0x7eed('0x35')],{'$or':_[_0x7eed('0x29')](_0x2420e1[_0x7eed('0x32')],function(_0x5d778b){var _0x5ab9ba={};_0x5ab9ba[_0x5d778b]={'$like':'%'+_0x5c659b['query'][_0x7eed('0x37')]+'%'};return _0x5ab9ba;})});}_0x2420e1=_[_0x7eed('0x39')]({},_0x2420e1,_0x5c659b[_0x7eed('0x3a')]);return _0x56d461[_0x7eed('0x4e')](_0x2420e1);}})[_0x7eed('0x23')](function(_0x23f41a){if(_0x23f41a){_0x2ee1cc=_0x23f41a[_0x7eed('0x43')];if(!_0x5c659b['query'][_0x7eed('0x4b')](_0x7eed('0x48'))){_0x2420e1[_0x7eed('0x1c')]=qs[_0x7eed('0x1c')](_0x5c659b['query']['limit']);_0x2420e1[_0x7eed('0x1a')]=qs['offset'](_0x5c659b[_0x7eed('0x2d')][_0x7eed('0x1a')]);}return _0x56d461[_0x7eed('0x4e')](_0x2420e1);}})['then'](function(_0x55f8b2){if(_0x55f8b2){return _0x55f8b2?{'count':_0x2ee1cc,'rows':_0x55f8b2}:null;}})[_0x7eed('0x23')](respondWithResult(_0x377c9c,null))[_0x7eed('0x3f')](handleError(_0x377c9c,null));};exports[_0x7eed('0x4f')]=function(_0x5a6547,_0x194f88,_0x28a674){if(_0x5a6547[_0x7eed('0x46')]['id']){delete _0x5a6547[_0x7eed('0x46')]['id'];}return db[_0x7eed('0x2a')]['findOne']({'where':{'id':_0x5a6547[_0x7eed('0x41')]['id']}})[_0x7eed('0x23')](handleEntityNotFound(_0x194f88,null))[_0x7eed('0x23')](function(_0xb63374){if(_0xb63374){return _0xb63374[_0x7eed('0x4f')](_0x5a6547[_0x7eed('0x46')][_0x7eed('0x50')]||[]);}return null;})[_0x7eed('0x23')](respondWithResult(_0x194f88,null))[_0x7eed('0x3f')](handleError(_0x194f88,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 7eec5ee..ab5eb26 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 _0x9946=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','util','../../config/logger'];(function(_0x2c44aa,_0x2fd67f){var _0xa104f8=function(_0x49a05c){while(--_0x49a05c){_0x2c44aa['push'](_0x2c44aa['shift']());}};_0xa104f8(++_0x2fd67f);}(_0x9946,0xfa));var _0x6994=function(_0x11dc88,_0x2416fe){_0x11dc88=_0x11dc88-0x0;var _0x5c8870=_0x9946[_0x11dc88];return _0x5c8870;};'use strict';var _=require('lodash');var util=require(_0x6994('0x0'));var logger=require(_0x6994('0x1'))(_0x6994('0x2'));var moment=require(_0x6994('0x3'));var BPromise=require(_0x6994('0x4'));var rp=require(_0x6994('0x5'));var fs=require('fs');var path=require(_0x6994('0x6'));var rimraf=require(_0x6994('0x7'));var config=require(_0x6994('0x8'));var attributes=require(_0x6994('0x9'));module[_0x6994('0xa')]=function(_0x3d4d87,_0x245e78){return _0x3d4d87[_0x6994('0xb')](_0x6994('0xc'),attributes,{'tableName':_0x6994('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1ed=['moment','bluebird','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util'];(function(_0x122c9e,_0x953140){var _0x73f499=function(_0x3c9943){while(--_0x3c9943){_0x122c9e['push'](_0x122c9e['shift']());}};_0x73f499(++_0x953140);}(_0xc1ed,0xe4));var _0xdc1e=function(_0x55732c,_0x4da144){_0x55732c=_0x55732c-0x0;var _0x24887a=_0xc1ed[_0x55732c];return _0x24887a;};'use strict';var _=require(_0xdc1e('0x0'));var util=require(_0xdc1e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xdc1e('0x2'));var BPromise=require(_0xdc1e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc1e('0x4'));var rimraf=require('rimraf');var config=require(_0xdc1e('0x5'));var attributes=require(_0xdc1e('0x6'));module[_0xdc1e('0x7')]=function(_0x125440,_0x1e0cf7){return _0x125440['define'](_0xdc1e('0x8'),attributes,{'tableName':_0xdc1e('0x9'),'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 89adfd6..c1fe874 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 _0x2bb4=['http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client'];(function(_0x3a7145,_0x1ead83){var _0x56106a=function(_0xf277aa){while(--_0xf277aa){_0x3a7145['push'](_0x3a7145['shift']());}};_0x56106a(++_0x1ead83);}(_0x2bb4,0x108));var _0x42bb=function(_0x1d78db,_0xaf609a){_0x1d78db=_0x1d78db-0x0;var _0x167e1d=_0x2bb4[_0x1d78db];return _0x167e1d;};'use strict';var _=require(_0x42bb('0x0'));var util=require(_0x42bb('0x1'));var moment=require(_0x42bb('0x2'));var BPromise=require(_0x42bb('0x3'));var rs=require(_0x42bb('0x4'));var fs=require('fs');var Redis=require(_0x42bb('0x5'));var db=require(_0x42bb('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x42bb('0x7'));var config=require(_0x42bb('0x8'));var jayson=require(_0x42bb('0x9'));var client=jayson[_0x42bb('0xa')][_0x42bb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x245672,_0x7c7263,_0x49da10){return new BPromise(function(_0x8d8d58,_0x53d568){return client[_0x42bb('0xc')](_0x245672,_0x49da10)[_0x42bb('0xd')](function(_0x56bebf){logger[_0x42bb('0xe')](_0x42bb('0xf'),_0x7c7263,_0x42bb('0x10'));logger[_0x42bb('0x11')](_0x42bb('0x12'),_0x7c7263,'request\x20sent',JSON[_0x42bb('0x13')](_0x56bebf));if(_0x56bebf[_0x42bb('0x14')]){if(_0x56bebf[_0x42bb('0x14')][_0x42bb('0x15')]===0x1f4){logger[_0x42bb('0x14')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x7c7263,_0x56bebf[_0x42bb('0x14')][_0x42bb('0x16')]);return _0x53d568(_0x56bebf[_0x42bb('0x14')][_0x42bb('0x16')]);}logger['error'](_0x42bb('0xf'),_0x7c7263,_0x56bebf[_0x42bb('0x14')][_0x42bb('0x16')]);return _0x8d8d58(_0x56bebf[_0x42bb('0x14')]['message']);}else{logger[_0x42bb('0xe')](_0x42bb('0xf'),_0x7c7263,_0x42bb('0x10'));_0x8d8d58(_0x56bebf[_0x42bb('0x17')][_0x42bb('0x16')]);}})[_0x42bb('0x18')](function(_0x487e16){logger[_0x42bb('0x14')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x7c7263,_0x487e16);_0x53d568(_0x487e16);});});} \ No newline at end of file +var _0x7c30=['error','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x571c1d,_0x3b0586){var _0x33c609=function(_0x226499){while(--_0x226499){_0x571c1d['push'](_0x571c1d['shift']());}};_0x33c609(++_0x3b0586);}(_0x7c30,0x1d1));var _0x07c3=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x7c30[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x07c3('0x0'));var moment=require(_0x07c3('0x1'));var BPromise=require(_0x07c3('0x2'));var rs=require(_0x07c3('0x3'));var fs=require('fs');var Redis=require(_0x07c3('0x4'));var db=require(_0x07c3('0x5'))['db'];var utils=require(_0x07c3('0x6'));var logger=require(_0x07c3('0x7'))(_0x07c3('0x8'));var config=require(_0x07c3('0x9'));var jayson=require(_0x07c3('0xa'));var client=jayson[_0x07c3('0xb')][_0x07c3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x25d2b3,_0x641bef,_0x51ca94){return new BPromise(function(_0x4b02bf,_0x4fdb8d){return client[_0x07c3('0xd')](_0x25d2b3,_0x51ca94)[_0x07c3('0xe')](function(_0xc12eea){logger['info'](_0x07c3('0xf'),_0x641bef,'request\x20sent');logger[_0x07c3('0x10')](_0x07c3('0x11'),_0x641bef,'request\x20sent',JSON['stringify'](_0xc12eea));if(_0xc12eea[_0x07c3('0x12')]){if(_0xc12eea[_0x07c3('0x12')]['code']===0x1f4){logger[_0x07c3('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x641bef,_0xc12eea[_0x07c3('0x12')][_0x07c3('0x13')]);return _0x4fdb8d(_0xc12eea[_0x07c3('0x12')][_0x07c3('0x13')]);}logger[_0x07c3('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x641bef,_0xc12eea['error'][_0x07c3('0x13')]);return _0x4b02bf(_0xc12eea[_0x07c3('0x12')]['message']);}else{logger[_0x07c3('0x14')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x641bef,'request\x20sent');_0x4b02bf(_0xc12eea[_0x07c3('0x15')][_0x07c3('0x13')]);}})[_0x07c3('0x16')](function(_0x124ab5){logger[_0x07c3('0x12')](_0x07c3('0xf'),_0x641bef,_0x124ab5);_0x4fdb8d(_0x124ab5);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 0709858..54f2619 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 _0xd859=['./intFreshdeskField.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x7729b1,_0x468322){var _0x349504=function(_0x401cee){while(--_0x401cee){_0x7729b1['push'](_0x7729b1['shift']());}};_0x349504(++_0x468322);}(_0xd859,0xbf));var _0x9d85=function(_0x39c760,_0x4daa3d){_0x39c760=_0x39c760-0x0;var _0x472eb3=_0xd859[_0x39c760];return _0x472eb3;};'use strict';var multer=require(_0x9d85('0x0'));var util=require(_0x9d85('0x1'));var path=require('path');var timeout=require(_0x9d85('0x2'));var express=require(_0x9d85('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9d85('0x4'));var interaction=require(_0x9d85('0x5'));var config=require(_0x9d85('0x6'));var controller=require(_0x9d85('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x9d85('0x8')](_0x9d85('0x9'),auth[_0x9d85('0xa')](),controller[_0x9d85('0xb')]);router[_0x9d85('0xc')]('/',auth[_0x9d85('0xa')](),controller[_0x9d85('0xd')]);router[_0x9d85('0xe')](_0x9d85('0x9'),auth['isAuthenticated'](),controller[_0x9d85('0xf')]);router[_0x9d85('0x10')](_0x9d85('0x9'),auth[_0x9d85('0xa')](),controller['destroy']);module[_0x9d85('0x11')]=router; \ No newline at end of file +var _0xe231=['show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated','index','get','/:id'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xe231,0xcd));var _0x1e23=function(_0x2d2d37,_0x5778a6){_0x2d2d37=_0x2d2d37-0x0;var _0x55bbce=_0xe231[_0x2d2d37];return _0x55bbce;};'use strict';var multer=require(_0x1e23('0x0'));var util=require(_0x1e23('0x1'));var path=require(_0x1e23('0x2'));var timeout=require(_0x1e23('0x3'));var express=require(_0x1e23('0x4'));var router=express[_0x1e23('0x5')]();var fs_extra=require(_0x1e23('0x6'));var auth=require(_0x1e23('0x7'));var interaction=require(_0x1e23('0x8'));var config=require(_0x1e23('0x9'));var controller=require(_0x1e23('0xa'));router['get']('/',auth[_0x1e23('0xb')](),controller[_0x1e23('0xc')]);router[_0x1e23('0xd')](_0x1e23('0xe'),auth['isAuthenticated'](),controller[_0x1e23('0xf')]);router[_0x1e23('0x10')]('/',auth['isAuthenticated'](),controller[_0x1e23('0x11')]);router[_0x1e23('0x12')](_0x1e23('0xe'),auth['isAuthenticated'](),controller[_0x1e23('0x13')]);router['delete']('/:id',auth[_0x1e23('0xb')](),controller[_0x1e23('0x14')]);module[_0x1e23('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 01485b9..c753bb1 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 _0x79fb=['keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x506181,_0x59cf27){var _0x758102=function(_0x114438){while(--_0x114438){_0x506181['push'](_0x506181['shift']());}};_0x758102(++_0x59cf27);}(_0x79fb,0x1c5));var _0xb79f=function(_0x4012a2,_0x23e24d){_0x4012a2=_0x4012a2-0x0;var _0x4a763a=_0x79fb[_0x4012a2];return _0x4a763a;};'use strict';var Sequelize=require(_0xb79f('0x0'));module[_0xb79f('0x1')]={'type':{'type':Sequelize[_0xb79f('0x2')](_0xb79f('0x3'),_0xb79f('0x4'),_0xb79f('0x5'),_0xb79f('0x6'),_0xb79f('0x7')),'defaultValue':_0xb79f('0x3')},'content':{'type':Sequelize[_0xb79f('0x8')]},'key':{'type':Sequelize[_0xb79f('0x8')]},'keyType':{'type':Sequelize[_0xb79f('0x2')](_0xb79f('0x3'),_0xb79f('0x4'),_0xb79f('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xb79f('0x8')]},'nameField':{'type':Sequelize[_0xb79f('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb79f('0x8')]}}; \ No newline at end of file +var _0x8c98=['STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist'];(function(_0x16e0b1,_0x1fd3d9){var _0x3d573a=function(_0x15186b){while(--_0x15186b){_0x16e0b1['push'](_0x16e0b1['shift']());}};_0x3d573a(++_0x1fd3d9);}(_0x8c98,0xb7));var _0x88c9=function(_0x24a196,_0x212f3c){_0x24a196=_0x24a196-0x0;var _0x29b84f=_0x8c98[_0x24a196];return _0x29b84f;};'use strict';var Sequelize=require(_0x88c9('0x0'));module[_0x88c9('0x1')]={'type':{'type':Sequelize['ENUM'](_0x88c9('0x2'),_0x88c9('0x3'),_0x88c9('0x4'),_0x88c9('0x5'),_0x88c9('0x6')),'defaultValue':_0x88c9('0x2')},'content':{'type':Sequelize[_0x88c9('0x7')]},'key':{'type':Sequelize[_0x88c9('0x7')]},'keyType':{'type':Sequelize[_0x88c9('0x8')]('string','variable',_0x88c9('0x4'))},'keyContent':{'type':Sequelize[_0x88c9('0x7')]},'idField':{'type':Sequelize[_0x88c9('0x7')]},'nameField':{'type':Sequelize[_0x88c9('0x7')]},'customField':{'type':Sequelize[_0x88c9('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x88c9('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index f637227..dc7eb0f 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 _0xa588=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','FreshdeskField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','catch','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra'];(function(_0x27887f,_0x312773){var _0x134185=function(_0x58cee0){while(--_0x58cee0){_0x27887f['push'](_0x27887f['shift']());}};_0x134185(++_0x312773);}(_0xa588,0xe1));var _0x8a58=function(_0x5281ce,_0x210279){_0x5281ce=_0x5281ce-0x0;var _0x138d09=_0xa588[_0x5281ce];return _0x138d09;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8a58('0x0'));var zipdir=require(_0x8a58('0x1'));var jsonpatch=require(_0x8a58('0x2'));var rp=require(_0x8a58('0x3'));var moment=require(_0x8a58('0x4'));var BPromise=require(_0x8a58('0x5'));var Mustache=require(_0x8a58('0x6'));var util=require(_0x8a58('0x7'));var path=require(_0x8a58('0x8'));var sox=require('sox');var csv=require(_0x8a58('0x9'));var ejs=require(_0x8a58('0xa'));var fs=require('fs');var fs_extra=require(_0x8a58('0xb'));var _=require(_0x8a58('0xc'));var squel=require(_0x8a58('0xd'));var crypto=require(_0x8a58('0xe'));var jsforce=require(_0x8a58('0xf'));var deskjs=require(_0x8a58('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8a58('0x11'));var Papa=require(_0x8a58('0x12'));var Redis=require(_0x8a58('0x13'));var authService=require(_0x8a58('0x14'));var qs=require(_0x8a58('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a58('0x16'));var logger=require(_0x8a58('0x17'))(_0x8a58('0x18'));var utils=require(_0x8a58('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8a58('0x1a'))['db'];function respondWithStatusCode(_0x5ec103,_0x21208d){_0x21208d=_0x21208d||0xcc;return function(_0xc5d2fa){if(_0xc5d2fa){return _0x5ec103['sendStatus'](_0x21208d);}return _0x5ec103[_0x8a58('0x1b')](_0x21208d)[_0x8a58('0x1c')]();};}function respondWithResult(_0x56a61d,_0x3d40a5){_0x3d40a5=_0x3d40a5||0xc8;return function(_0x268506){if(_0x268506){return _0x56a61d['status'](_0x3d40a5)[_0x8a58('0x1d')](_0x268506);}};}function respondWithFilteredResult(_0x18a33c,_0x3010ae){return function(_0x3ff39e){if(_0x3ff39e){var _0x26e3a8=typeof _0x3010ae[_0x8a58('0x1e')]===_0x8a58('0x1f')&&typeof _0x3010ae['limit']==='undefined';var _0x31de8d=_0x3ff39e[_0x8a58('0x20')];var _0x18a14d=_0x26e3a8?0x0:_0x3010ae['offset'];var _0x282f2d=_0x26e3a8?_0x3ff39e[_0x8a58('0x20')]:_0x3010ae['offset']+_0x3010ae[_0x8a58('0x21')];var _0x15b527;if(_0x282f2d>=_0x31de8d){_0x282f2d=_0x31de8d;_0x15b527=0xc8;}else{_0x15b527=0xce;}_0x18a33c[_0x8a58('0x1b')](_0x15b527);return _0x18a33c[_0x8a58('0x22')](_0x8a58('0x23'),_0x18a14d+'-'+_0x282f2d+'/'+_0x31de8d)[_0x8a58('0x1d')](_0x3ff39e);}return null;};}function patchUpdates(_0x284bb8){return function(_0x115e19){try{jsonpatch[_0x8a58('0x24')](_0x115e19,_0x284bb8,!![]);}catch(_0xbf556a){return BPromise[_0x8a58('0x25')](_0xbf556a);}return _0x115e19[_0x8a58('0x26')]();};}function saveUpdates(_0x3758fa,_0x34adb8){return function(_0x561a9a){if(_0x561a9a){return _0x561a9a[_0x8a58('0x27')](_0x3758fa)[_0x8a58('0x28')](function(_0x20a6c5){return _0x20a6c5;});}return null;};}function removeEntity(_0x3f07ab,_0x22c898){return function(_0x415946){if(_0x415946){return _0x415946[_0x8a58('0x29')]()['then'](function(){_0x3f07ab[_0x8a58('0x1b')](0xcc)[_0x8a58('0x1c')]();});}};}function handleEntityNotFound(_0x30c96b,_0x24e780){return function(_0x4fb0fb){if(!_0x4fb0fb){_0x30c96b[_0x8a58('0x2a')](0x194);}return _0x4fb0fb;};}function handleError(_0x6b5cbf,_0x231dae){_0x231dae=_0x231dae||0x1f4;return function(_0x4d4835){logger[_0x8a58('0x2b')](_0x4d4835[_0x8a58('0x2c')]);if(_0x4d4835[_0x8a58('0x2d')]){delete _0x4d4835[_0x8a58('0x2d')];}_0x6b5cbf[_0x8a58('0x1b')](_0x231dae)[_0x8a58('0x2e')](_0x4d4835);};}exports[_0x8a58('0x2f')]=function(_0x4d5041,_0x433060){var _0x4ef1eb={},_0x501aa1={},_0x5e7265={'count':0x0,'rows':[]};var _0x4cfc96=_['map'](db[_0x8a58('0x30')][_0x8a58('0x31')],function(_0x1b2d9e){return{'name':_0x1b2d9e[_0x8a58('0x32')],'type':_0x1b2d9e[_0x8a58('0x33')][_0x8a58('0x34')]};});_0x501aa1[_0x8a58('0x35')]=_[_0x8a58('0x36')](_0x4cfc96,_0x8a58('0x2d'));_0x501aa1[_0x8a58('0x37')]=_[_0x8a58('0x38')](_0x4d5041[_0x8a58('0x37')]);_0x501aa1[_0x8a58('0x39')]=_['intersection'](_0x501aa1[_0x8a58('0x35')],_0x501aa1[_0x8a58('0x37')]);_0x4ef1eb[_0x8a58('0x3a')]=_[_0x8a58('0x3b')](_0x501aa1[_0x8a58('0x35')],qs[_0x8a58('0x3c')](_0x4d5041['query'][_0x8a58('0x3c')]));_0x4ef1eb[_0x8a58('0x3a')]=_0x4ef1eb[_0x8a58('0x3a')][_0x8a58('0x3d')]?_0x4ef1eb[_0x8a58('0x3a')]:_0x501aa1[_0x8a58('0x35')];if(!_0x4d5041[_0x8a58('0x37')]['hasOwnProperty'](_0x8a58('0x3e'))){_0x4ef1eb[_0x8a58('0x21')]=qs[_0x8a58('0x21')](_0x4d5041['query']['limit']);_0x4ef1eb['offset']=qs[_0x8a58('0x1e')](_0x4d5041[_0x8a58('0x37')][_0x8a58('0x1e')]);}_0x4ef1eb[_0x8a58('0x3f')]=qs['sort'](_0x4d5041[_0x8a58('0x37')][_0x8a58('0x40')]);_0x4ef1eb[_0x8a58('0x41')]=qs[_0x8a58('0x39')](_['pick'](_0x4d5041[_0x8a58('0x37')],_0x501aa1[_0x8a58('0x39')]),_0x4cfc96);if(_0x4d5041['query'][_0x8a58('0x42')]){_0x4ef1eb[_0x8a58('0x41')]=_[_0x8a58('0x43')](_0x4ef1eb[_0x8a58('0x41')],{'$or':_[_0x8a58('0x36')](_0x4cfc96,function(_0x122e0f){if(_0x122e0f['type']!=='VIRTUAL'){var _0x3afb2b={};_0x3afb2b[_0x122e0f[_0x8a58('0x2d')]]={'$like':'%'+_0x4d5041['query'][_0x8a58('0x42')]+'%'};return _0x3afb2b;}})});}_0x4ef1eb=_[_0x8a58('0x43')]({},_0x4ef1eb,_0x4d5041[_0x8a58('0x44')]);var _0x3dfd34={'where':_0x4ef1eb[_0x8a58('0x41')]};return db['FreshdeskField'][_0x8a58('0x20')](_0x3dfd34)['then'](function(_0x2ad76a){_0x5e7265[_0x8a58('0x20')]=_0x2ad76a;if(_0x4d5041[_0x8a58('0x37')][_0x8a58('0x45')]){_0x4ef1eb[_0x8a58('0x46')]=[{'all':!![]}];}return db[_0x8a58('0x30')][_0x8a58('0x47')](_0x4ef1eb);})['then'](function(_0x5cd9d8){_0x5e7265[_0x8a58('0x48')]=_0x5cd9d8;return _0x5e7265;})['then'](respondWithFilteredResult(_0x433060,_0x4ef1eb))['catch'](handleError(_0x433060,null));};exports[_0x8a58('0x49')]=function(_0x8a79f2,_0x299806){var _0x573cd3={'raw':!![],'where':{'id':_0x8a79f2[_0x8a58('0x4a')]['id']}},_0x56a410={};_0x56a410['model']=_[_0x8a58('0x38')](db[_0x8a58('0x30')][_0x8a58('0x31')]);_0x56a410[_0x8a58('0x37')]=_['keys'](_0x8a79f2[_0x8a58('0x37')]);_0x56a410[_0x8a58('0x39')]=_['intersection'](_0x56a410[_0x8a58('0x35')],_0x56a410[_0x8a58('0x37')]);_0x573cd3[_0x8a58('0x3a')]=_[_0x8a58('0x3b')](_0x56a410['model'],qs[_0x8a58('0x3c')](_0x8a79f2['query'][_0x8a58('0x3c')]));_0x573cd3[_0x8a58('0x3a')]=_0x573cd3['attributes'][_0x8a58('0x3d')]?_0x573cd3['attributes']:_0x56a410['model'];if(_0x8a79f2[_0x8a58('0x37')][_0x8a58('0x45')]){_0x573cd3[_0x8a58('0x46')]=[{'all':!![]}];}_0x573cd3=_[_0x8a58('0x43')]({},_0x573cd3,_0x8a79f2[_0x8a58('0x44')]);return db[_0x8a58('0x30')]['find'](_0x573cd3)['then'](handleEntityNotFound(_0x299806,null))[_0x8a58('0x28')](respondWithResult(_0x299806,null))[_0x8a58('0x4b')](handleError(_0x299806,null));};exports[_0x8a58('0x4c')]=function(_0x19682c,_0x1ec51b){return db[_0x8a58('0x30')][_0x8a58('0x4c')](_0x19682c[_0x8a58('0x4d')],{})[_0x8a58('0x28')](respondWithResult(_0x1ec51b,0xc9))[_0x8a58('0x4b')](handleError(_0x1ec51b,null));};exports[_0x8a58('0x27')]=function(_0x392c32,_0x1ea824){if(_0x392c32[_0x8a58('0x4d')]['id']){delete _0x392c32['body']['id'];}return db[_0x8a58('0x30')][_0x8a58('0x4e')]({'where':{'id':_0x392c32[_0x8a58('0x4a')]['id']}})[_0x8a58('0x28')](handleEntityNotFound(_0x1ea824,null))[_0x8a58('0x28')](saveUpdates(_0x392c32[_0x8a58('0x4d')],null))[_0x8a58('0x28')](respondWithResult(_0x1ea824,null))['catch'](handleError(_0x1ea824,null));};exports['destroy']=function(_0x5ab682,_0x31e12a){return db[_0x8a58('0x30')][_0x8a58('0x4e')]({'where':{'id':_0x5ab682['params']['id']}})[_0x8a58('0x28')](handleEntityNotFound(_0x31e12a,null))[_0x8a58('0x28')](removeEntity(_0x31e12a,null))[_0x8a58('0x4b')](handleError(_0x31e12a,null));}; \ No newline at end of file +var _0xac4a=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','keys','rawAttributes','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','FreshdeskField','type','key','model','query','filters','intersection','attributes','fields'];(function(_0x43941d,_0x45fd0d){var _0x27b82a=function(_0x21851e){while(--_0x21851e){_0x43941d['push'](_0x43941d['shift']());}};_0x27b82a(++_0x45fd0d);}(_0xac4a,0x13f));var _0xaac4=function(_0x40096b,_0x4da753){_0x40096b=_0x40096b-0x0;var _0x5c0217=_0xac4a[_0x40096b];return _0x5c0217;};'use strict';var emlformat=require(_0xaac4('0x0'));var rimraf=require(_0xaac4('0x1'));var zipdir=require(_0xaac4('0x2'));var jsonpatch=require(_0xaac4('0x3'));var rp=require(_0xaac4('0x4'));var moment=require(_0xaac4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaac4('0x6'));var path=require(_0xaac4('0x7'));var sox=require(_0xaac4('0x8'));var csv=require('to-csv');var ejs=require(_0xaac4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaac4('0xa'));var squel=require('squel');var crypto=require(_0xaac4('0xb'));var jsforce=require(_0xaac4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaac4('0xd'));var Papa=require('papaparse');var Redis=require(_0xaac4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaac4('0xf'));var hardwareService=require(_0xaac4('0x10'));var logger=require(_0xaac4('0x11'))(_0xaac4('0x12'));var utils=require(_0xaac4('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaac4('0x14'))['db'];function respondWithStatusCode(_0x2e2d02,_0x45e512){_0x45e512=_0x45e512||0xcc;return function(_0x5a4801){if(_0x5a4801){return _0x2e2d02[_0xaac4('0x15')](_0x45e512);}return _0x2e2d02[_0xaac4('0x16')](_0x45e512)['end']();};}function respondWithResult(_0xf06b1d,_0x2b20d0){_0x2b20d0=_0x2b20d0||0xc8;return function(_0x46698d){if(_0x46698d){return _0xf06b1d[_0xaac4('0x16')](_0x2b20d0)[_0xaac4('0x17')](_0x46698d);}};}function respondWithFilteredResult(_0x2fbeb7,_0x31b7e5){return function(_0x1df9ae){if(_0x1df9ae){var _0x233278=typeof _0x31b7e5[_0xaac4('0x18')]===_0xaac4('0x19')&&typeof _0x31b7e5[_0xaac4('0x1a')]===_0xaac4('0x19');var _0x52686a=_0x1df9ae[_0xaac4('0x1b')];var _0x52085a=_0x233278?0x0:_0x31b7e5[_0xaac4('0x18')];var _0x5b6fd6=_0x233278?_0x1df9ae[_0xaac4('0x1b')]:_0x31b7e5[_0xaac4('0x18')]+_0x31b7e5[_0xaac4('0x1a')];var _0x271bcb;if(_0x5b6fd6>=_0x52686a){_0x5b6fd6=_0x52686a;_0x271bcb=0xc8;}else{_0x271bcb=0xce;}_0x2fbeb7[_0xaac4('0x16')](_0x271bcb);return _0x2fbeb7[_0xaac4('0x1c')](_0xaac4('0x1d'),_0x52085a+'-'+_0x5b6fd6+'/'+_0x52686a)[_0xaac4('0x17')](_0x1df9ae);}return null;};}function patchUpdates(_0x4166ee){return function(_0x480fb0){try{jsonpatch[_0xaac4('0x1e')](_0x480fb0,_0x4166ee,!![]);}catch(_0x4e1e89){return BPromise[_0xaac4('0x1f')](_0x4e1e89);}return _0x480fb0[_0xaac4('0x20')]();};}function saveUpdates(_0x43625c,_0x477b77){return function(_0x17140f){if(_0x17140f){return _0x17140f[_0xaac4('0x21')](_0x43625c)['then'](function(_0x43ccdc){return _0x43ccdc;});}return null;};}function removeEntity(_0x27a84d,_0x174860){return function(_0x4f10ec){if(_0x4f10ec){return _0x4f10ec[_0xaac4('0x22')]()[_0xaac4('0x23')](function(){_0x27a84d[_0xaac4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24186b,_0x4f1b65){return function(_0x54203b){if(!_0x54203b){_0x24186b['sendStatus'](0x194);}return _0x54203b;};}function handleError(_0x5a0bb3,_0x22d5a6){_0x22d5a6=_0x22d5a6||0x1f4;return function(_0x17d25f){logger[_0xaac4('0x24')](_0x17d25f[_0xaac4('0x25')]);if(_0x17d25f[_0xaac4('0x26')]){delete _0x17d25f[_0xaac4('0x26')];}_0x5a0bb3[_0xaac4('0x16')](_0x22d5a6)[_0xaac4('0x27')](_0x17d25f);};}exports[_0xaac4('0x28')]=function(_0x386c9b,_0x4d0f5f){var _0x316445={},_0x16b33c={},_0xda10b6={'count':0x0,'rows':[]};var _0xb76ccc=_[_0xaac4('0x29')](db[_0xaac4('0x2a')]['rawAttributes'],function(_0xcf6c1){return{'name':_0xcf6c1['fieldName'],'type':_0xcf6c1[_0xaac4('0x2b')][_0xaac4('0x2c')]};});_0x16b33c[_0xaac4('0x2d')]=_[_0xaac4('0x29')](_0xb76ccc,'name');_0x16b33c['query']=_['keys'](_0x386c9b[_0xaac4('0x2e')]);_0x16b33c[_0xaac4('0x2f')]=_[_0xaac4('0x30')](_0x16b33c[_0xaac4('0x2d')],_0x16b33c[_0xaac4('0x2e')]);_0x316445[_0xaac4('0x31')]=_[_0xaac4('0x30')](_0x16b33c[_0xaac4('0x2d')],qs[_0xaac4('0x32')](_0x386c9b[_0xaac4('0x2e')][_0xaac4('0x32')]));_0x316445[_0xaac4('0x31')]=_0x316445[_0xaac4('0x31')][_0xaac4('0x33')]?_0x316445[_0xaac4('0x31')]:_0x16b33c['model'];if(!_0x386c9b['query'][_0xaac4('0x34')](_0xaac4('0x35'))){_0x316445[_0xaac4('0x1a')]=qs['limit'](_0x386c9b[_0xaac4('0x2e')][_0xaac4('0x1a')]);_0x316445[_0xaac4('0x18')]=qs[_0xaac4('0x18')](_0x386c9b[_0xaac4('0x2e')][_0xaac4('0x18')]);}_0x316445[_0xaac4('0x36')]=qs['sort'](_0x386c9b[_0xaac4('0x2e')][_0xaac4('0x37')]);_0x316445[_0xaac4('0x38')]=qs['filters'](_[_0xaac4('0x39')](_0x386c9b['query'],_0x16b33c['filters']),_0xb76ccc);if(_0x386c9b[_0xaac4('0x2e')][_0xaac4('0x3a')]){_0x316445[_0xaac4('0x38')]=_['merge'](_0x316445['where'],{'$or':_[_0xaac4('0x29')](_0xb76ccc,function(_0x33cc4){if(_0x33cc4[_0xaac4('0x2b')]!==_0xaac4('0x3b')){var _0x2b65b1={};_0x2b65b1[_0x33cc4[_0xaac4('0x26')]]={'$like':'%'+_0x386c9b['query']['filter']+'%'};return _0x2b65b1;}})});}_0x316445=_[_0xaac4('0x3c')]({},_0x316445,_0x386c9b[_0xaac4('0x3d')]);var _0x5371b4={'where':_0x316445[_0xaac4('0x38')]};return db[_0xaac4('0x2a')][_0xaac4('0x1b')](_0x5371b4)['then'](function(_0x74a1c){_0xda10b6[_0xaac4('0x1b')]=_0x74a1c;if(_0x386c9b[_0xaac4('0x2e')]['includeAll']){_0x316445[_0xaac4('0x3e')]=[{'all':!![]}];}return db[_0xaac4('0x2a')][_0xaac4('0x3f')](_0x316445);})[_0xaac4('0x23')](function(_0x51e59d){_0xda10b6[_0xaac4('0x40')]=_0x51e59d;return _0xda10b6;})['then'](respondWithFilteredResult(_0x4d0f5f,_0x316445))['catch'](handleError(_0x4d0f5f,null));};exports[_0xaac4('0x41')]=function(_0x31e240,_0x27df36){var _0x40c007={'raw':!![],'where':{'id':_0x31e240[_0xaac4('0x42')]['id']}},_0x43bc12={};_0x43bc12[_0xaac4('0x2d')]=_[_0xaac4('0x43')](db['FreshdeskField'][_0xaac4('0x44')]);_0x43bc12[_0xaac4('0x2e')]=_[_0xaac4('0x43')](_0x31e240[_0xaac4('0x2e')]);_0x43bc12['filters']=_[_0xaac4('0x30')](_0x43bc12[_0xaac4('0x2d')],_0x43bc12[_0xaac4('0x2e')]);_0x40c007['attributes']=_[_0xaac4('0x30')](_0x43bc12[_0xaac4('0x2d')],qs[_0xaac4('0x32')](_0x31e240[_0xaac4('0x2e')]['fields']));_0x40c007[_0xaac4('0x31')]=_0x40c007[_0xaac4('0x31')][_0xaac4('0x33')]?_0x40c007['attributes']:_0x43bc12[_0xaac4('0x2d')];if(_0x31e240[_0xaac4('0x2e')][_0xaac4('0x45')]){_0x40c007[_0xaac4('0x3e')]=[{'all':!![]}];}_0x40c007=_[_0xaac4('0x3c')]({},_0x40c007,_0x31e240[_0xaac4('0x3d')]);return db[_0xaac4('0x2a')][_0xaac4('0x46')](_0x40c007)[_0xaac4('0x23')](handleEntityNotFound(_0x27df36,null))['then'](respondWithResult(_0x27df36,null))[_0xaac4('0x47')](handleError(_0x27df36,null));};exports[_0xaac4('0x48')]=function(_0x27425a,_0x360420){return db[_0xaac4('0x2a')]['create'](_0x27425a['body'],{})[_0xaac4('0x23')](respondWithResult(_0x360420,0xc9))[_0xaac4('0x47')](handleError(_0x360420,null));};exports[_0xaac4('0x21')]=function(_0x16c7f4,_0x5f33ea){if(_0x16c7f4[_0xaac4('0x49')]['id']){delete _0x16c7f4['body']['id'];}return db[_0xaac4('0x2a')][_0xaac4('0x46')]({'where':{'id':_0x16c7f4['params']['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x5f33ea,null))[_0xaac4('0x23')](saveUpdates(_0x16c7f4[_0xaac4('0x49')],null))['then'](respondWithResult(_0x5f33ea,null))['catch'](handleError(_0x5f33ea,null));};exports[_0xaac4('0x22')]=function(_0x2c1751,_0x22dda7){return db[_0xaac4('0x2a')][_0xaac4('0x46')]({'where':{'id':_0x2c1751[_0xaac4('0x42')]['id']}})['then'](handleEntityNotFound(_0x22dda7,null))[_0xaac4('0x23')](removeEntity(_0x22dda7,null))[_0xaac4('0x47')](handleError(_0x22dda7,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 5375d63..95df24e 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 _0xe0e3=['int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','util','../../config/logger','moment','request-promise','path','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField'];(function(_0x251e06,_0x580a7e){var _0xca904b=function(_0x395e24){while(--_0x395e24){_0x251e06['push'](_0x251e06['shift']());}};_0xca904b(++_0x580a7e);}(_0xe0e3,0xba));var _0x3e0e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe0e3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x3e0e('0x0'));var logger=require(_0x3e0e('0x1'))('api');var moment=require(_0x3e0e('0x2'));var BPromise=require('bluebird');var rp=require(_0x3e0e('0x3'));var fs=require('fs');var path=require(_0x3e0e('0x4'));var rimraf=require('rimraf');var config=require(_0x3e0e('0x5'));var attributes=require(_0x3e0e('0x6'));module[_0x3e0e('0x7')]=function(_0x8461ca,_0x15a98f){return _0x8461ca[_0x3e0e('0x8')](_0x3e0e('0x9'),attributes,{'tableName':_0x3e0e('0xa'),'paranoid':![],'indexes':[{'name':_0x3e0e('0xb'),'fields':[_0x3e0e('0xc'),_0x3e0e('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x76e0=['request-promise','rimraf','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','api','bluebird'];(function(_0x3351a1,_0x5aeb34){var _0x44bc6f=function(_0x27b636){while(--_0x27b636){_0x3351a1['push'](_0x3351a1['shift']());}};_0x44bc6f(++_0x5aeb34);}(_0x76e0,0x18e));var _0x076e=function(_0x254126,_0x1e5e17){_0x254126=_0x254126-0x0;var _0x43bedf=_0x76e0[_0x254126];return _0x43bedf;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x076e('0x0'));var moment=require('moment');var BPromise=require(_0x076e('0x1'));var rp=require(_0x076e('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x076e('0x3'));var config=require('../../config/environment');var attributes=require(_0x076e('0x4'));module[_0x076e('0x5')]=function(_0x51699f,_0x4c7016){return _0x51699f['define'](_0x076e('0x6'),attributes,{'tableName':_0x076e('0x7'),'paranoid':![],'indexes':[{'name':_0x076e('0x8'),'fields':[_0x076e('0x9'),'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 e390770..1a807b0 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 _0x861e=['lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','FreshdeskField,\x20%s,\x20%s','message','info','catch'];(function(_0x48573e,_0x3ffde8){var _0x460770=function(_0x155f20){while(--_0x155f20){_0x48573e['push'](_0x48573e['shift']());}};_0x460770(++_0x3ffde8);}(_0x861e,0x143));var _0xe861=function(_0x41b255,_0x33a1c0){_0x41b255=_0x41b255-0x0;var _0x132e20=_0x861e[_0x41b255];return _0x132e20;};'use strict';var _=require(_0xe861('0x0'));var util=require('util');var moment=require(_0xe861('0x1'));var BPromise=require(_0xe861('0x2'));var rs=require(_0xe861('0x3'));var fs=require('fs');var Redis=require(_0xe861('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe861('0x5'));var logger=require(_0xe861('0x6'))(_0xe861('0x7'));var config=require(_0xe861('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe861('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd013e9,_0x92f1d8,_0x3608f0){return new BPromise(function(_0x184832,_0x1d1686){return client['request'](_0xd013e9,_0x3608f0)[_0xe861('0xa')](function(_0xb02c6c){logger['info']('FreshdeskField,\x20%s,\x20%s',_0x92f1d8,'request\x20sent');logger['debug'](_0xe861('0xb'),_0x92f1d8,_0xe861('0xc'),JSON[_0xe861('0xd')](_0xb02c6c));if(_0xb02c6c['error']){if(_0xb02c6c['error']['code']===0x1f4){logger[_0xe861('0xe')](_0xe861('0xf'),_0x92f1d8,_0xb02c6c[_0xe861('0xe')]['message']);return _0x1d1686(_0xb02c6c['error'][_0xe861('0x10')]);}logger['error'](_0xe861('0xf'),_0x92f1d8,_0xb02c6c[_0xe861('0xe')][_0xe861('0x10')]);return _0x184832(_0xb02c6c[_0xe861('0xe')][_0xe861('0x10')]);}else{logger[_0xe861('0x11')](_0xe861('0xf'),_0x92f1d8,_0xe861('0xc'));_0x184832(_0xb02c6c['result'][_0xe861('0x10')]);}})[_0xe861('0x12')](function(_0x5b697e){logger[_0xe861('0xe')](_0xe861('0xf'),_0x92f1d8,_0x5b697e);_0x1d1686(_0x5b697e);});});} \ No newline at end of file +var _0x06fe=['info','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x5c1c99,_0x47c1a5){var _0x5fa09f=function(_0x18f3ee){while(--_0x18f3ee){_0x5c1c99['push'](_0x5c1c99['shift']());}};_0x5fa09f(++_0x47c1a5);}(_0x06fe,0x146));var _0xe06f=function(_0x14d175,_0x230bf7){_0x14d175=_0x14d175-0x0;var _0x2946e9=_0x06fe[_0x14d175];return _0x2946e9;};'use strict';var _=require(_0xe06f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe06f('0x1'));var rs=require(_0xe06f('0x2'));var fs=require('fs');var Redis=require(_0xe06f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe06f('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xe06f('0x5'));var jayson=require(_0xe06f('0x6'));var client=jayson['client'][_0xe06f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x395fad,_0x45af81,_0x189af1){return new BPromise(function(_0x2a870b,_0xb4868c){return client[_0xe06f('0x8')](_0x395fad,_0x189af1)[_0xe06f('0x9')](function(_0x4fd8d3){logger['info'](_0xe06f('0xa'),_0x45af81,_0xe06f('0xb'));logger['debug'](_0xe06f('0xc'),_0x45af81,_0xe06f('0xb'),JSON['stringify'](_0x4fd8d3));if(_0x4fd8d3[_0xe06f('0xd')]){if(_0x4fd8d3['error'][_0xe06f('0xe')]===0x1f4){logger['error'](_0xe06f('0xa'),_0x45af81,_0x4fd8d3['error'][_0xe06f('0xf')]);return _0xb4868c(_0x4fd8d3[_0xe06f('0xd')][_0xe06f('0xf')]);}logger[_0xe06f('0xd')]('FreshdeskField,\x20%s,\x20%s',_0x45af81,_0x4fd8d3[_0xe06f('0xd')][_0xe06f('0xf')]);return _0x2a870b(_0x4fd8d3[_0xe06f('0xd')][_0xe06f('0xf')]);}else{logger[_0xe06f('0x10')]('FreshdeskField,\x20%s,\x20%s',_0x45af81,_0xe06f('0xb'));_0x2a870b(_0x4fd8d3[_0xe06f('0x11')][_0xe06f('0xf')]);}})[_0xe06f('0x12')](function(_0x51189c){logger[_0xe06f('0xd')](_0xe06f('0xa'),_0x45af81,_0x51189c);_0xb4868c(_0x51189c);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index f6de888..9eff682 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 _0xee5b=['multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','delete','/:id'];(function(_0x155a75,_0x1f5513){var _0x185671=function(_0x44fac6){while(--_0x44fac6){_0x155a75['push'](_0x155a75['shift']());}};_0x185671(++_0x1f5513);}(_0xee5b,0x1f4));var _0xbee5=function(_0x3cd583,_0x4836b6){_0x3cd583=_0x3cd583-0x0;var _0xa6ef63=_0xee5b[_0x3cd583];return _0xa6ef63;};'use strict';var multer=require(_0xbee5('0x0'));var util=require('util');var path=require(_0xbee5('0x1'));var timeout=require(_0xbee5('0x2'));var express=require('express');var router=express[_0xbee5('0x3')]();var fs_extra=require(_0xbee5('0x4'));var auth=require(_0xbee5('0x5'));var interaction=require(_0xbee5('0x6'));var config=require('../../config/environment');var controller=require('./intFreshsalesAccount.controller');router[_0xbee5('0x7')]('/',auth[_0xbee5('0x8')](),controller[_0xbee5('0x9')]);router[_0xbee5('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router['get']('/:id/configurations',auth[_0xbee5('0x8')](),controller[_0xbee5('0xa')]);router[_0xbee5('0x7')](_0xbee5('0xb'),auth['isAuthenticated'](),controller[_0xbee5('0xc')]);router[_0xbee5('0xd')]('/',auth[_0xbee5('0x8')](),controller[_0xbee5('0xe')]);router[_0xbee5('0xd')](_0xbee5('0xf'),auth[_0xbee5('0x8')](),controller[_0xbee5('0x10')]);router[_0xbee5('0x11')]('/:id',auth[_0xbee5('0x8')](),controller['update']);router[_0xbee5('0x12')](_0xbee5('0x13'),auth[_0xbee5('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xcb91=['addConfiguration','update','delete','/:id','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesAccount.controller','get','index','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','create'];(function(_0x3c841c,_0x46da9b){var _0x306231=function(_0x3462e4){while(--_0x3462e4){_0x3c841c['push'](_0x3c841c['shift']());}};_0x306231(++_0x46da9b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xcb91[_0xa148b7];return _0x51efd3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/:id',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x1cb9('0x7')](_0x1cb9('0xc'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xd')]);router[_0x1cb9('0xe')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0xf')]);router[_0x1cb9('0xe')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x12')](_0x1cb9('0x13'),auth[_0x1cb9('0x9')](),controller['destroy']);module[_0x1cb9('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 9e48a79..40f9730 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 _0x2032=['remoteUri','exports','STRING','username'];(function(_0x1e661c,_0x4542ec){var _0x5a0910=function(_0x4f860e){while(--_0x4f860e){_0x1e661c['push'](_0x1e661c['shift']());}};_0x5a0910(++_0x4542ec);}(_0x2032,0xd9));var _0x2203=function(_0x109992,_0x554a0c){_0x109992=_0x109992-0x0;var _0x5da21a=_0x2032[_0x109992];return _0x5da21a;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')]},'description':{'type':Sequelize[_0x2203('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x2203('0x2')},'apiKey':{'type':Sequelize[_0x2203('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x2203('0x3')},'serverUrl':{'type':Sequelize[_0x2203('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x8603=['remoteUri','exports','STRING'];(function(_0x3f5dee,_0x120ef3){var _0x592a16=function(_0xdbd474){while(--_0xdbd474){_0x3f5dee['push'](_0x3f5dee['shift']());}};_0x592a16(++_0x120ef3);}(_0x8603,0x190));var _0x3860=function(_0x341fd6,_0x9d0e71){_0x341fd6=_0x341fd6-0x0;var _0x3755d3=_0x8603[_0x341fd6];return _0x3755d3;};'use strict';var Sequelize=require('sequelize');module[_0x3860('0x0')]={'name':{'type':Sequelize[_0x3860('0x1')]},'description':{'type':Sequelize[_0x3860('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize[_0x3860('0x1')]},'remoteUri':{'type':Sequelize[_0x3860('0x1')],'unique':_0x3860('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 b6474db..ed3303a 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 _0x8728=['GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','type','model','map','query','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','FreshsalesAccount','include','findAll','rows','catch','show','params','attributes','includeAll','find','create','body','getConfigurations','findOne','keys','rawAttributes','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf'];(function(_0x11f249,_0x4ca4a8){var _0x5c3656=function(_0x27c9f8){while(--_0x27c9f8){_0x11f249['push'](_0x11f249['shift']());}};_0x5c3656(++_0x4ca4a8);}(_0x8728,0xe1));var _0x8872=function(_0x5775ef,_0x47f238){_0x5775ef=_0x5775ef-0x0;var _0x424dff=_0x8728[_0x5775ef];return _0x424dff;};'use strict';var emlformat=require(_0x8872('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8872('0x1'));var jsonpatch=require(_0x8872('0x2'));var rp=require(_0x8872('0x3'));var moment=require('moment');var BPromise=require(_0x8872('0x4'));var Mustache=require(_0x8872('0x5'));var util=require(_0x8872('0x6'));var path=require('path');var sox=require(_0x8872('0x7'));var csv=require(_0x8872('0x8'));var ejs=require(_0x8872('0x9'));var fs=require('fs');var fs_extra=require(_0x8872('0xa'));var _=require(_0x8872('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8872('0xc'));var deskjs=require(_0x8872('0xd'));var toCsv=require(_0x8872('0x8'));var querystring=require(_0x8872('0xe'));var Papa=require(_0x8872('0xf'));var Redis=require(_0x8872('0x10'));var authService=require(_0x8872('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8872('0x12'));var logger=require(_0x8872('0x13'))(_0x8872('0x14'));var utils=require(_0x8872('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8872('0x16'));var db=require(_0x8872('0x17'))['db'];var integrations=require(_0x8872('0x18'));function respondWithStatusCode(_0x413c06,_0x112c91){_0x112c91=_0x112c91||0xcc;return function(_0x1faaed){if(_0x1faaed){return _0x413c06[_0x8872('0x19')](_0x112c91);}return _0x413c06[_0x8872('0x1a')](_0x112c91)[_0x8872('0x1b')]();};}function respondWithResult(_0x508b65,_0x4d06af){_0x4d06af=_0x4d06af||0xc8;return function(_0x5e02e9){if(_0x5e02e9){return _0x508b65[_0x8872('0x1a')](_0x4d06af)[_0x8872('0x1c')](_0x5e02e9);}};}function respondWithFilteredResult(_0x4b6888,_0x434f09){return function(_0x1c54c1){if(_0x1c54c1){var _0x4f0daf=typeof _0x434f09['offset']===_0x8872('0x1d')&&typeof _0x434f09[_0x8872('0x1e')]===_0x8872('0x1d');var _0x5f21e4=_0x1c54c1['count'];var _0x5a21fb=_0x4f0daf?0x0:_0x434f09['offset'];var _0x42e237=_0x4f0daf?_0x1c54c1[_0x8872('0x1f')]:_0x434f09[_0x8872('0x20')]+_0x434f09[_0x8872('0x1e')];var _0x33c995;if(_0x42e237>=_0x5f21e4){_0x42e237=_0x5f21e4;_0x33c995=0xc8;}else{_0x33c995=0xce;}_0x4b6888[_0x8872('0x1a')](_0x33c995);return _0x4b6888[_0x8872('0x21')](_0x8872('0x22'),_0x5a21fb+'-'+_0x42e237+'/'+_0x5f21e4)[_0x8872('0x1c')](_0x1c54c1);}return null;};}function patchUpdates(_0x56da1c){return function(_0x3d52cf){try{jsonpatch['apply'](_0x3d52cf,_0x56da1c,!![]);}catch(_0x340d26){return BPromise[_0x8872('0x23')](_0x340d26);}return _0x3d52cf[_0x8872('0x24')]();};}function saveUpdates(_0x802ee7,_0x17f126){return function(_0x2933ec){if(_0x2933ec){return _0x2933ec[_0x8872('0x25')](_0x802ee7)[_0x8872('0x26')](function(_0x5cba78){return _0x5cba78;});}return null;};}function removeEntity(_0x41adfc,_0x216082){return function(_0x387c1e){if(_0x387c1e){return _0x387c1e[_0x8872('0x27')]()[_0x8872('0x26')](function(){_0x41adfc[_0x8872('0x1a')](0xcc)[_0x8872('0x1b')]();});}};}function handleEntityNotFound(_0x5aa988,_0x5ad245){return function(_0x4a4c13){if(!_0x4a4c13){_0x5aa988[_0x8872('0x19')](0x194);}return _0x4a4c13;};}function handleError(_0x401ab3,_0x903cb0){_0x903cb0=_0x903cb0||0x1f4;return function(_0x2cee58){logger[_0x8872('0x28')](_0x2cee58[_0x8872('0x29')]);if(_0x2cee58[_0x8872('0x2a')]){delete _0x2cee58[_0x8872('0x2a')];}_0x401ab3[_0x8872('0x1a')](_0x903cb0)['send'](_0x2cee58);};}exports[_0x8872('0x2b')]=function(_0x388538,_0x1cd0ff){var _0x21f059={},_0x190ead={},_0x599395={'count':0x0,'rows':[]};var _0x50f46f=_['map'](db['FreshsalesAccount']['rawAttributes'],function(_0x9f159a){return{'name':_0x9f159a['fieldName'],'type':_0x9f159a[_0x8872('0x2c')]['key']};});_0x190ead[_0x8872('0x2d')]=_[_0x8872('0x2e')](_0x50f46f,'name');_0x190ead[_0x8872('0x2f')]=_['keys'](_0x388538[_0x8872('0x2f')]);_0x190ead[_0x8872('0x30')]=_[_0x8872('0x31')](_0x190ead[_0x8872('0x2d')],_0x190ead[_0x8872('0x2f')]);_0x21f059['attributes']=_[_0x8872('0x31')](_0x190ead[_0x8872('0x2d')],qs[_0x8872('0x32')](_0x388538[_0x8872('0x2f')][_0x8872('0x32')]));_0x21f059['attributes']=_0x21f059['attributes'][_0x8872('0x33')]?_0x21f059['attributes']:_0x190ead[_0x8872('0x2d')];if(!_0x388538[_0x8872('0x2f')][_0x8872('0x34')](_0x8872('0x35'))){_0x21f059[_0x8872('0x1e')]=qs[_0x8872('0x1e')](_0x388538[_0x8872('0x2f')][_0x8872('0x1e')]);_0x21f059[_0x8872('0x20')]=qs['offset'](_0x388538['query'][_0x8872('0x20')]);}_0x21f059[_0x8872('0x36')]=qs[_0x8872('0x37')](_0x388538[_0x8872('0x2f')][_0x8872('0x37')]);_0x21f059['where']=qs[_0x8872('0x30')](_[_0x8872('0x38')](_0x388538[_0x8872('0x2f')],_0x190ead[_0x8872('0x30')]),_0x50f46f);if(_0x388538['query']['filter']){_0x21f059[_0x8872('0x39')]=_[_0x8872('0x3a')](_0x21f059[_0x8872('0x39')],{'$or':_['map'](_0x50f46f,function(_0x1722e8){if(_0x1722e8[_0x8872('0x2c')]!==_0x8872('0x3b')){var _0x1ce91f={};_0x1ce91f[_0x1722e8[_0x8872('0x2a')]]={'$like':'%'+_0x388538[_0x8872('0x2f')][_0x8872('0x3c')]+'%'};return _0x1ce91f;}})});}_0x21f059=_[_0x8872('0x3a')]({},_0x21f059,_0x388538[_0x8872('0x3d')]);var _0x23803d={'where':_0x21f059[_0x8872('0x39')]};return db[_0x8872('0x3e')]['count'](_0x23803d)[_0x8872('0x26')](function(_0x462eb1){_0x599395[_0x8872('0x1f')]=_0x462eb1;if(_0x388538[_0x8872('0x2f')]['includeAll']){_0x21f059[_0x8872('0x3f')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x8872('0x40')](_0x21f059);})['then'](function(_0x1fa5dc){_0x599395[_0x8872('0x41')]=_0x1fa5dc;return _0x599395;})[_0x8872('0x26')](respondWithFilteredResult(_0x1cd0ff,_0x21f059))[_0x8872('0x42')](handleError(_0x1cd0ff,null));};exports[_0x8872('0x43')]=function(_0x110767,_0x32c19b){var _0x3896ad={'raw':![],'where':{'id':_0x110767[_0x8872('0x44')]['id']}},_0x193aba={};_0x193aba['model']=_['keys'](db[_0x8872('0x3e')]['rawAttributes']);_0x193aba[_0x8872('0x2f')]=_['keys'](_0x110767[_0x8872('0x2f')]);_0x193aba[_0x8872('0x30')]=_[_0x8872('0x31')](_0x193aba[_0x8872('0x2d')],_0x193aba['query']);_0x3896ad['attributes']=_[_0x8872('0x31')](_0x193aba[_0x8872('0x2d')],qs[_0x8872('0x32')](_0x110767[_0x8872('0x2f')]['fields']));_0x3896ad[_0x8872('0x45')]=_0x3896ad['attributes']['length']?_0x3896ad[_0x8872('0x45')]:_0x193aba['model'];if(_0x110767[_0x8872('0x2f')][_0x8872('0x46')]){_0x3896ad[_0x8872('0x3f')]=[{'all':!![]}];}_0x3896ad=_[_0x8872('0x3a')]({},_0x3896ad,_0x110767['options']);return db[_0x8872('0x3e')][_0x8872('0x47')](_0x3896ad)[_0x8872('0x26')](handleEntityNotFound(_0x32c19b,null))[_0x8872('0x26')](respondWithResult(_0x32c19b,null))[_0x8872('0x42')](handleError(_0x32c19b,null));};exports[_0x8872('0x48')]=function(_0x165173,_0x183484){return db[_0x8872('0x3e')][_0x8872('0x48')](_0x165173['body'],{})[_0x8872('0x26')](respondWithResult(_0x183484,0xc9))['catch'](handleError(_0x183484,null));};exports['update']=function(_0x47870a,_0x3c879a){if(_0x47870a[_0x8872('0x49')]['id']){delete _0x47870a['body']['id'];}return db[_0x8872('0x3e')][_0x8872('0x47')]({'where':{'id':_0x47870a[_0x8872('0x44')]['id']}})[_0x8872('0x26')](handleEntityNotFound(_0x3c879a,null))[_0x8872('0x26')](saveUpdates(_0x47870a[_0x8872('0x49')],null))['then'](respondWithResult(_0x3c879a,null))[_0x8872('0x42')](handleError(_0x3c879a,null));};exports[_0x8872('0x27')]=function(_0x38be1a,_0x337f3d){return db[_0x8872('0x3e')][_0x8872('0x47')]({'where':{'id':_0x38be1a['params']['id']}})[_0x8872('0x26')](handleEntityNotFound(_0x337f3d,null))['then'](removeEntity(_0x337f3d,null))[_0x8872('0x42')](handleError(_0x337f3d,null));};exports[_0x8872('0x4a')]=function(_0x531b81,_0x277b77,_0xf85139){var _0x415c68={};var _0x34a190={};var _0x353946;var _0x4f18bb;return db[_0x8872('0x3e')][_0x8872('0x4b')]({'where':{'id':_0x531b81[_0x8872('0x44')]['id']}})[_0x8872('0x26')](handleEntityNotFound(_0x277b77,null))['then'](function(_0x4479e1){if(_0x4479e1){_0x353946=_0x4479e1;_0x34a190[_0x8872('0x2d')]=_[_0x8872('0x4c')](db['FreshsalesConfiguration'][_0x8872('0x4d')]);_0x34a190[_0x8872('0x2f')]=_['keys'](_0x531b81[_0x8872('0x2f')]);_0x34a190[_0x8872('0x30')]=_['intersection'](_0x34a190[_0x8872('0x2d')],_0x34a190[_0x8872('0x2f')]);_0x415c68['attributes']=_['intersection'](_0x34a190[_0x8872('0x2d')],qs['fields'](_0x531b81['query'][_0x8872('0x32')]));_0x415c68[_0x8872('0x45')]=_0x415c68[_0x8872('0x45')][_0x8872('0x33')]?_0x415c68[_0x8872('0x45')]:_0x34a190[_0x8872('0x2d')];_0x415c68[_0x8872('0x36')]=qs['sort'](_0x531b81[_0x8872('0x2f')]['sort']);_0x415c68[_0x8872('0x39')]=qs['filters'](_[_0x8872('0x38')](_0x531b81[_0x8872('0x2f')],_0x34a190[_0x8872('0x30')]));if(_0x531b81[_0x8872('0x2f')]['filter']){_0x415c68[_0x8872('0x39')]=_[_0x8872('0x3a')](_0x415c68[_0x8872('0x39')],{'$or':_[_0x8872('0x2e')](_0x415c68[_0x8872('0x45')],function(_0x520007){var _0x349e03={};_0x349e03[_0x520007]={'$like':'%'+_0x531b81['query']['filter']+'%'};return _0x349e03;})});}_0x415c68=_[_0x8872('0x3a')]({},_0x415c68,_0x531b81[_0x8872('0x3d')]);return _0x353946[_0x8872('0x4a')](_0x415c68);}})['then'](function(_0x5a36d3){if(_0x5a36d3){_0x4f18bb=_0x5a36d3['length'];if(!_0x531b81[_0x8872('0x2f')]['hasOwnProperty']('nolimit')){_0x415c68[_0x8872('0x1e')]=qs[_0x8872('0x1e')](_0x531b81[_0x8872('0x2f')][_0x8872('0x1e')]);_0x415c68[_0x8872('0x20')]=qs[_0x8872('0x20')](_0x531b81[_0x8872('0x2f')][_0x8872('0x20')]);}return _0x353946[_0x8872('0x4a')](_0x415c68);}})[_0x8872('0x26')](function(_0x3aa959){if(_0x3aa959){return _0x3aa959?{'count':_0x4f18bb,'rows':_0x3aa959}:null;}})[_0x8872('0x26')](respondWithResult(_0x277b77,null))[_0x8872('0x42')](handleError(_0x277b77,null));};exports[_0x8872('0x4e')]=function(_0x13800e,_0x4f81be,_0x3f0cb8){if(_0x13800e[_0x8872('0x49')]['id']){delete _0x13800e[_0x8872('0x49')]['id'];}return db[_0x8872('0x3e')][_0x8872('0x4b')]({'where':{'id':_0x13800e[_0x8872('0x44')]['id']}})[_0x8872('0x26')](handleEntityNotFound(_0x4f81be,null))[_0x8872('0x26')](function(_0x39629c){if(_0x39629c){_0x13800e[_0x8872('0x49')][_0x8872('0x4f')]=_0x39629c['id'];_0x13800e[_0x8872('0x49')][_0x8872('0x50')]=integrations[_0x8872('0x51')](_0x13800e[_0x8872('0x49')][_0x8872('0x52')],_0x13800e[_0x8872('0x49')][_0x8872('0x2c')]);_0x13800e['body'][_0x8872('0x53')]=integrations[_0x8872('0x54')](_0x13800e[_0x8872('0x49')][_0x8872('0x52')],_0x13800e[_0x8872('0x49')][_0x8872('0x2c')]);return db['FreshsalesConfiguration'][_0x8872('0x48')](_0x13800e['body'],{'include':[{'model':db[_0x8872('0x55')],'as':'Subjects'},{'model':db[_0x8872('0x55')],'as':_0x8872('0x53')}]});}return null;})[_0x8872('0x26')](respondWithResult(_0x4f81be,null))[_0x8872('0x42')](handleError(_0x4f81be,null));};exports[_0x8872('0x56')]=function(_0x11f54e,_0x230e24,_0x2e64f4){var _0x20264a='';var _0x4eee56='';return db[_0x8872('0x3e')][_0x8872('0x4b')]({'where':{'id':_0x11f54e[_0x8872('0x44')]['id']},'attributes':['id',_0x8872('0x57'),_0x8872('0x58'),_0x8872('0x59')]})[_0x8872('0x26')](handleEntityNotFound(_0x230e24,null))[_0x8872('0x26')](function(_0x548750){if(_0x548750){_0x4eee56=_0x548750[_0x8872('0x57')];_0x20264a=_0x548750['remoteUri'];var _0x492c15=_0x548750[_0x8872('0x58')][_0x8872('0x5a')](-0x1);if(_0x492c15==='/'){_0x20264a=_0x20264a[_0x8872('0x5b')](0x0,_0x20264a[_0x8872('0x5c')](_0x492c15));}return rp({'method':_0x8872('0x5d'),'uri':util[_0x8872('0x5e')](_0x8872('0x5f'),_0x20264a,_0x8872('0x60')),'headers':{'Authorization':_0x8872('0x61')+_0x548750[_0x8872('0x59')]},'json':!![]});}})[_0x8872('0x26')](function(_0x515ffa){if(_0x515ffa){var _0x5b32ba=_0x515ffa[_0x8872('0x62')];var _0x1d7583=![];var _0x5d9bdf=null;for(_0x5d9bdf=0x0;_0x5d9bdf<_0x5b32ba['length'];_0x5d9bdf++){if(_0x5b32ba[_0x5d9bdf][_0x8872('0x63')]===_0x4eee56){_0x1d7583=!![];}}if(_0x1d7583){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x8872('0x26')](respondWithResult(_0x230e24,null))[_0x8872('0x42')](function(_0x23ac08){var _0x7abf0c=_0x11f54e[_0x8872('0x2f')][_0x8872('0x64')]?0x1f4:_0x23ac08[_0x8872('0x65')]||0x1f4;logger[_0x8872('0x28')](_0x8872('0x66'),_0x8872('0x56'),_0x7abf0c,JSON[_0x8872('0x67')](_0x23ac08));delete _0x23ac08['name'];if(_0x7abf0c===0x191){_0x7abf0c=0x190;}_0x230e24[_0x8872('0x1a')](_0x7abf0c)[_0x8872('0x68')](_0x11f54e['query']['test']?{'message':_0x8872('0x69'),'statusCode':_0x23ac08['statusCode']}:_0x23ac08);});}; \ No newline at end of file +var _0x0043=['path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','offset','undefined','count','limit','set','json','save','update','destroy','then','end','name','map','FreshsalesAccount','rawAttributes','fieldName','key','model','keys','filters','intersection','attributes','fields','length','query','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','nolimit','addConfiguration','AccountId','Subjects','type','channel','remoteUri','apiKey','username','slice','substring','format','%s%s','/api/selector/owners','Token\x20token=','Requested\x20Resource\x20not\x20Found','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','test','Wrong\x20credentials','statusCode','eml-format','zip-dir','request-promise','moment','bluebird','util'];(function(_0x4526f2,_0x5869e2){var _0x58d2df=function(_0x16659f){while(--_0x16659f){_0x4526f2['push'](_0x4526f2['shift']());}};_0x58d2df(++_0x5869e2);}(_0x0043,0xb8));var _0x3004=function(_0x374ada,_0x27b3a5){_0x374ada=_0x374ada-0x0;var _0x449ed8=_0x0043[_0x374ada];return _0x449ed8;};'use strict';var emlformat=require(_0x3004('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3004('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3004('0x2'));var moment=require(_0x3004('0x3'));var BPromise=require(_0x3004('0x4'));var Mustache=require('mustache');var util=require(_0x3004('0x5'));var path=require(_0x3004('0x6'));var sox=require(_0x3004('0x7'));var csv=require(_0x3004('0x8'));var ejs=require(_0x3004('0x9'));var fs=require('fs');var fs_extra=require(_0x3004('0xa'));var _=require(_0x3004('0xb'));var squel=require(_0x3004('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3004('0xd'));var toCsv=require(_0x3004('0x8'));var querystring=require(_0x3004('0xe'));var Papa=require(_0x3004('0xf'));var Redis=require(_0x3004('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3004('0x11'));var hardwareService=require(_0x3004('0x12'));var logger=require('../../config/logger')(_0x3004('0x13'));var utils=require(_0x3004('0x14'));var config=require(_0x3004('0x15'));var licenseUtil=require(_0x3004('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x3004('0x17'));function respondWithStatusCode(_0x125aa6,_0x5c09a6){_0x5c09a6=_0x5c09a6||0xcc;return function(_0x1c3df6){if(_0x1c3df6){return _0x125aa6[_0x3004('0x18')](_0x5c09a6);}return _0x125aa6[_0x3004('0x19')](_0x5c09a6)['end']();};}function respondWithResult(_0x4e7ae3,_0x5a82f0){_0x5a82f0=_0x5a82f0||0xc8;return function(_0x5e36d7){if(_0x5e36d7){return _0x4e7ae3[_0x3004('0x19')](_0x5a82f0)['json'](_0x5e36d7);}};}function respondWithFilteredResult(_0x45329a,_0x44f30a){return function(_0x5e068c){if(_0x5e068c){var _0x565879=typeof _0x44f30a[_0x3004('0x1a')]===_0x3004('0x1b')&&typeof _0x44f30a['limit']===_0x3004('0x1b');var _0x367cad=_0x5e068c[_0x3004('0x1c')];var _0x38e923=_0x565879?0x0:_0x44f30a[_0x3004('0x1a')];var _0x354dea=_0x565879?_0x5e068c[_0x3004('0x1c')]:_0x44f30a[_0x3004('0x1a')]+_0x44f30a[_0x3004('0x1d')];var _0xa5bbde;if(_0x354dea>=_0x367cad){_0x354dea=_0x367cad;_0xa5bbde=0xc8;}else{_0xa5bbde=0xce;}_0x45329a[_0x3004('0x19')](_0xa5bbde);return _0x45329a[_0x3004('0x1e')]('Content-Range',_0x38e923+'-'+_0x354dea+'/'+_0x367cad)[_0x3004('0x1f')](_0x5e068c);}return null;};}function patchUpdates(_0x47018e){return function(_0x5775e6){try{jsonpatch['apply'](_0x5775e6,_0x47018e,!![]);}catch(_0x1f2fc8){return BPromise['reject'](_0x1f2fc8);}return _0x5775e6[_0x3004('0x20')]();};}function saveUpdates(_0x5b653d,_0x2b2929){return function(_0x2050a5){if(_0x2050a5){return _0x2050a5[_0x3004('0x21')](_0x5b653d)['then'](function(_0x12f38f){return _0x12f38f;});}return null;};}function removeEntity(_0x53bed0,_0x54a885){return function(_0x58547f){if(_0x58547f){return _0x58547f[_0x3004('0x22')]()[_0x3004('0x23')](function(){_0x53bed0[_0x3004('0x19')](0xcc)[_0x3004('0x24')]();});}};}function handleEntityNotFound(_0x13adfc,_0x107b41){return function(_0x47977d){if(!_0x47977d){_0x13adfc['sendStatus'](0x194);}return _0x47977d;};}function handleError(_0x1a17ce,_0x439bfd){_0x439bfd=_0x439bfd||0x1f4;return function(_0x4b989d){logger['error'](_0x4b989d['stack']);if(_0x4b989d[_0x3004('0x25')]){delete _0x4b989d[_0x3004('0x25')];}_0x1a17ce['status'](_0x439bfd)['send'](_0x4b989d);};}exports['index']=function(_0x5ecf77,_0x3767b4){var _0x1baad2={},_0x165067={},_0x5d64bc={'count':0x0,'rows':[]};var _0x27e167=_[_0x3004('0x26')](db[_0x3004('0x27')][_0x3004('0x28')],function(_0x8f5d83){return{'name':_0x8f5d83[_0x3004('0x29')],'type':_0x8f5d83['type'][_0x3004('0x2a')]};});_0x165067[_0x3004('0x2b')]=_[_0x3004('0x26')](_0x27e167,_0x3004('0x25'));_0x165067['query']=_[_0x3004('0x2c')](_0x5ecf77['query']);_0x165067[_0x3004('0x2d')]=_[_0x3004('0x2e')](_0x165067[_0x3004('0x2b')],_0x165067['query']);_0x1baad2[_0x3004('0x2f')]=_[_0x3004('0x2e')](_0x165067[_0x3004('0x2b')],qs[_0x3004('0x30')](_0x5ecf77['query']['fields']));_0x1baad2[_0x3004('0x2f')]=_0x1baad2[_0x3004('0x2f')][_0x3004('0x31')]?_0x1baad2['attributes']:_0x165067[_0x3004('0x2b')];if(!_0x5ecf77[_0x3004('0x32')]['hasOwnProperty']('nolimit')){_0x1baad2[_0x3004('0x1d')]=qs['limit'](_0x5ecf77[_0x3004('0x32')][_0x3004('0x1d')]);_0x1baad2[_0x3004('0x1a')]=qs['offset'](_0x5ecf77[_0x3004('0x32')][_0x3004('0x1a')]);}_0x1baad2[_0x3004('0x33')]=qs[_0x3004('0x34')](_0x5ecf77[_0x3004('0x32')][_0x3004('0x34')]);_0x1baad2[_0x3004('0x35')]=qs[_0x3004('0x2d')](_[_0x3004('0x36')](_0x5ecf77['query'],_0x165067[_0x3004('0x2d')]),_0x27e167);if(_0x5ecf77[_0x3004('0x32')][_0x3004('0x37')]){_0x1baad2[_0x3004('0x35')]=_['merge'](_0x1baad2['where'],{'$or':_[_0x3004('0x26')](_0x27e167,function(_0x3cff5f){if(_0x3cff5f['type']!==_0x3004('0x38')){var _0x54fafd={};_0x54fafd[_0x3cff5f['name']]={'$like':'%'+_0x5ecf77['query']['filter']+'%'};return _0x54fafd;}})});}_0x1baad2=_[_0x3004('0x39')]({},_0x1baad2,_0x5ecf77[_0x3004('0x3a')]);var _0x10f9d6={'where':_0x1baad2['where']};return db[_0x3004('0x27')][_0x3004('0x1c')](_0x10f9d6)[_0x3004('0x23')](function(_0xd1a4b8){_0x5d64bc[_0x3004('0x1c')]=_0xd1a4b8;if(_0x5ecf77[_0x3004('0x32')][_0x3004('0x3b')]){_0x1baad2[_0x3004('0x3c')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x3004('0x3d')](_0x1baad2);})['then'](function(_0x11f8d1){_0x5d64bc['rows']=_0x11f8d1;return _0x5d64bc;})[_0x3004('0x23')](respondWithFilteredResult(_0x3767b4,_0x1baad2))[_0x3004('0x3e')](handleError(_0x3767b4,null));};exports[_0x3004('0x3f')]=function(_0x36110f,_0x260083){var _0x276bde={'raw':![],'where':{'id':_0x36110f[_0x3004('0x40')]['id']}},_0x3afa5f={};_0x3afa5f[_0x3004('0x2b')]=_[_0x3004('0x2c')](db[_0x3004('0x27')][_0x3004('0x28')]);_0x3afa5f[_0x3004('0x32')]=_[_0x3004('0x2c')](_0x36110f['query']);_0x3afa5f[_0x3004('0x2d')]=_['intersection'](_0x3afa5f['model'],_0x3afa5f[_0x3004('0x32')]);_0x276bde[_0x3004('0x2f')]=_[_0x3004('0x2e')](_0x3afa5f['model'],qs[_0x3004('0x30')](_0x36110f[_0x3004('0x32')][_0x3004('0x30')]));_0x276bde['attributes']=_0x276bde[_0x3004('0x2f')][_0x3004('0x31')]?_0x276bde[_0x3004('0x2f')]:_0x3afa5f['model'];if(_0x36110f[_0x3004('0x32')][_0x3004('0x3b')]){_0x276bde[_0x3004('0x3c')]=[{'all':!![]}];}_0x276bde=_[_0x3004('0x39')]({},_0x276bde,_0x36110f[_0x3004('0x3a')]);return db[_0x3004('0x27')][_0x3004('0x41')](_0x276bde)['then'](handleEntityNotFound(_0x260083,null))['then'](respondWithResult(_0x260083,null))['catch'](handleError(_0x260083,null));};exports[_0x3004('0x42')]=function(_0x190235,_0x910de){return db[_0x3004('0x27')][_0x3004('0x42')](_0x190235['body'],{})[_0x3004('0x23')](respondWithResult(_0x910de,0xc9))['catch'](handleError(_0x910de,null));};exports[_0x3004('0x21')]=function(_0x1620d2,_0x4dfd37){if(_0x1620d2['body']['id']){delete _0x1620d2[_0x3004('0x43')]['id'];}return db[_0x3004('0x27')][_0x3004('0x41')]({'where':{'id':_0x1620d2[_0x3004('0x40')]['id']}})[_0x3004('0x23')](handleEntityNotFound(_0x4dfd37,null))[_0x3004('0x23')](saveUpdates(_0x1620d2['body'],null))[_0x3004('0x23')](respondWithResult(_0x4dfd37,null))[_0x3004('0x3e')](handleError(_0x4dfd37,null));};exports[_0x3004('0x22')]=function(_0x496edd,_0x267d83){return db[_0x3004('0x27')][_0x3004('0x41')]({'where':{'id':_0x496edd[_0x3004('0x40')]['id']}})[_0x3004('0x23')](handleEntityNotFound(_0x267d83,null))['then'](removeEntity(_0x267d83,null))[_0x3004('0x3e')](handleError(_0x267d83,null));};exports[_0x3004('0x44')]=function(_0x1aff33,_0x5c43c4,_0x4359ef){var _0xdc75d5={};var _0x9c9a5f={};var _0xc7a2a2;var _0x28cbe6;return db['FreshsalesAccount'][_0x3004('0x45')]({'where':{'id':_0x1aff33[_0x3004('0x40')]['id']}})[_0x3004('0x23')](handleEntityNotFound(_0x5c43c4,null))[_0x3004('0x23')](function(_0xb16804){if(_0xb16804){_0xc7a2a2=_0xb16804;_0x9c9a5f[_0x3004('0x2b')]=_[_0x3004('0x2c')](db[_0x3004('0x46')][_0x3004('0x28')]);_0x9c9a5f[_0x3004('0x32')]=_['keys'](_0x1aff33['query']);_0x9c9a5f[_0x3004('0x2d')]=_[_0x3004('0x2e')](_0x9c9a5f[_0x3004('0x2b')],_0x9c9a5f[_0x3004('0x32')]);_0xdc75d5[_0x3004('0x2f')]=_[_0x3004('0x2e')](_0x9c9a5f[_0x3004('0x2b')],qs[_0x3004('0x30')](_0x1aff33[_0x3004('0x32')][_0x3004('0x30')]));_0xdc75d5[_0x3004('0x2f')]=_0xdc75d5['attributes'][_0x3004('0x31')]?_0xdc75d5[_0x3004('0x2f')]:_0x9c9a5f[_0x3004('0x2b')];_0xdc75d5[_0x3004('0x33')]=qs[_0x3004('0x34')](_0x1aff33[_0x3004('0x32')][_0x3004('0x34')]);_0xdc75d5[_0x3004('0x35')]=qs[_0x3004('0x2d')](_[_0x3004('0x36')](_0x1aff33[_0x3004('0x32')],_0x9c9a5f['filters']));if(_0x1aff33['query'][_0x3004('0x37')]){_0xdc75d5[_0x3004('0x35')]=_[_0x3004('0x39')](_0xdc75d5[_0x3004('0x35')],{'$or':_[_0x3004('0x26')](_0xdc75d5[_0x3004('0x2f')],function(_0x392a71){var _0x3ab54f={};_0x3ab54f[_0x392a71]={'$like':'%'+_0x1aff33[_0x3004('0x32')][_0x3004('0x37')]+'%'};return _0x3ab54f;})});}_0xdc75d5=_[_0x3004('0x39')]({},_0xdc75d5,_0x1aff33[_0x3004('0x3a')]);return _0xc7a2a2[_0x3004('0x44')](_0xdc75d5);}})[_0x3004('0x23')](function(_0x2cefa6){if(_0x2cefa6){_0x28cbe6=_0x2cefa6['length'];if(!_0x1aff33[_0x3004('0x32')]['hasOwnProperty'](_0x3004('0x47'))){_0xdc75d5[_0x3004('0x1d')]=qs[_0x3004('0x1d')](_0x1aff33[_0x3004('0x32')]['limit']);_0xdc75d5[_0x3004('0x1a')]=qs[_0x3004('0x1a')](_0x1aff33['query'][_0x3004('0x1a')]);}return _0xc7a2a2[_0x3004('0x44')](_0xdc75d5);}})[_0x3004('0x23')](function(_0x5b3c04){if(_0x5b3c04){return _0x5b3c04?{'count':_0x28cbe6,'rows':_0x5b3c04}:null;}})[_0x3004('0x23')](respondWithResult(_0x5c43c4,null))[_0x3004('0x3e')](handleError(_0x5c43c4,null));};exports[_0x3004('0x48')]=function(_0x371290,_0x446138,_0x58fbd3){if(_0x371290['body']['id']){delete _0x371290[_0x3004('0x43')]['id'];}return db[_0x3004('0x27')]['findOne']({'where':{'id':_0x371290[_0x3004('0x40')]['id']}})['then'](handleEntityNotFound(_0x446138,null))[_0x3004('0x23')](function(_0x219f73){if(_0x219f73){_0x371290[_0x3004('0x43')][_0x3004('0x49')]=_0x219f73['id'];_0x371290[_0x3004('0x43')][_0x3004('0x4a')]=integrations['getSubjects'](_0x371290[_0x3004('0x43')]['channel'],_0x371290[_0x3004('0x43')][_0x3004('0x4b')]);_0x371290['body']['Descriptions']=integrations['getDescriptions'](_0x371290['body'][_0x3004('0x4c')],_0x371290[_0x3004('0x43')][_0x3004('0x4b')]);return db[_0x3004('0x46')][_0x3004('0x42')](_0x371290[_0x3004('0x43')],{'include':[{'model':db['FreshsalesField'],'as':'Subjects'},{'model':db['FreshsalesField'],'as':'Descriptions'}]});}return null;})[_0x3004('0x23')](respondWithResult(_0x446138,null))['catch'](handleError(_0x446138,null));};exports['getFields']=function(_0x4f956a,_0x23ebe7,_0x4babac){var _0x2ed51f='';var _0x4d3525='';return db[_0x3004('0x27')][_0x3004('0x45')]({'where':{'id':_0x4f956a['params']['id']},'attributes':['id','username',_0x3004('0x4d'),_0x3004('0x4e')]})['then'](handleEntityNotFound(_0x23ebe7,null))[_0x3004('0x23')](function(_0x18f5b9){if(_0x18f5b9){_0x4d3525=_0x18f5b9[_0x3004('0x4f')];_0x2ed51f=_0x18f5b9['remoteUri'];var _0x5e08e1=_0x18f5b9[_0x3004('0x4d')][_0x3004('0x50')](-0x1);if(_0x5e08e1==='/'){_0x2ed51f=_0x2ed51f[_0x3004('0x51')](0x0,_0x2ed51f['lastIndexOf'](_0x5e08e1));}return rp({'method':'GET','uri':util[_0x3004('0x52')](_0x3004('0x53'),_0x2ed51f,_0x3004('0x54')),'headers':{'Authorization':_0x3004('0x55')+_0x18f5b9['apiKey']},'json':!![]});}})[_0x3004('0x23')](function(_0x51d88b){if(_0x51d88b){var _0x59b5cb=_0x51d88b['users'];var _0x55bb29=![];var _0x47e66e=null;for(_0x47e66e=0x0;_0x47e66e<_0x59b5cb[_0x3004('0x31')];_0x47e66e++){if(_0x59b5cb[_0x47e66e]['email']===_0x4d3525){_0x55bb29=!![];}}if(_0x55bb29){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x3004('0x56')});}}})[_0x3004('0x23')](respondWithResult(_0x23ebe7,null))[_0x3004('0x3e')](function(_0xaa721a){var _0x6807e8=_0x4f956a[_0x3004('0x32')]['test']?0x1f4:_0xaa721a['statusCode']||0x1f4;logger[_0x3004('0x57')](_0x3004('0x58'),_0x3004('0x59'),_0x6807e8,JSON[_0x3004('0x5a')](_0xaa721a));delete _0xaa721a[_0x3004('0x25')];if(_0x6807e8===0x191){_0x6807e8=0x190;}_0x23ebe7[_0x3004('0x19')](_0x6807e8)[_0x3004('0x5b')](_0x4f956a[_0x3004('0x32')][_0x3004('0x5c')]?{'message':_0x3004('0x5d'),'statusCode':_0xaa721a[_0x3004('0x5e')]}:_0xaa721a);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 319c24b..bc079fd 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 _0x25e7=['request-promise','path','rimraf','../../config/environment','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x568f44,_0x595d2e){var _0x97ecdf=function(_0x50886d){while(--_0x50886d){_0x568f44['push'](_0x568f44['shift']());}};_0x97ecdf(++_0x595d2e);}(_0x25e7,0x1d6));var _0x725e=function(_0x388eea,_0x340518){_0x388eea=_0x388eea-0x0;var _0x4a175b=_0x25e7[_0x388eea];return _0x4a175b;};'use strict';var _=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var logger=require(_0x725e('0x2'))(_0x725e('0x3'));var moment=require(_0x725e('0x4'));var BPromise=require(_0x725e('0x5'));var rp=require(_0x725e('0x6'));var fs=require('fs');var path=require(_0x725e('0x7'));var rimraf=require(_0x725e('0x8'));var config=require(_0x725e('0x9'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x725e('0xa')]=function(_0x480945,_0x481316){return _0x480945[_0x725e('0xb')](_0x725e('0xc'),attributes,{'tableName':_0x725e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x524e=['define','int_freshsales_accounts','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x55e886,_0xa45171){var _0x5e138e=function(_0x350779){while(--_0x350779){_0x55e886['push'](_0x55e886['shift']());}};_0x5e138e(++_0xa45171);}(_0x524e,0x15e));var _0xe524=function(_0xbf836a,_0x28d8a6){_0xbf836a=_0xbf836a-0x0;var _0x4de026=_0x524e[_0xbf836a];return _0x4de026;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe524('0x0'))(_0xe524('0x1'));var moment=require(_0xe524('0x2'));var BPromise=require(_0xe524('0x3'));var rp=require(_0xe524('0x4'));var fs=require('fs');var path=require(_0xe524('0x5'));var rimraf=require(_0xe524('0x6'));var config=require(_0xe524('0x7'));var attributes=require(_0xe524('0x8'));var integrations=require(_0xe524('0x9'));module['exports']=function(_0xaaeaa9,_0x41e1a3){return _0xaaeaa9[_0xe524('0xa')]('FreshsalesAccount',attributes,{'tableName':_0xe524('0xb'),'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 06b41eb..1892b17 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 _0x82c4=['findAll','options','raw','attributes','include','map','model','ShowFreshsalesAccount','FreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFreshsalesAccount'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x82c4,0x1ca));var _0x482c=function(_0x2a87e9,_0x25c03e){_0x2a87e9=_0x2a87e9-0x0;var _0x5de0e6=_0x82c4[_0x2a87e9];return _0x5de0e6;};'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')]('FreshsalesAccount,\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']('FreshsalesAccount,\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')]('FreshsalesAccount,\x20%s,\x20%s',_0x32a503,_0x363403);_0x3846d8(_0x363403);});});}exports[_0x482c('0x15')]=function(_0x5b6f7e){var _0x3aed45=this;return new Promise(function(_0x258148,_0x4af05a){return db['FreshsalesAccount'][_0x482c('0x16')]({'raw':_0x5b6f7e['options']?_0x5b6f7e[_0x482c('0x17')][_0x482c('0x18')]===undefined?!![]:![]:!![],'where':_0x5b6f7e[_0x482c('0x17')]?_0x5b6f7e[_0x482c('0x17')]['where']||null:null,'attributes':_0x5b6f7e[_0x482c('0x17')]?_0x5b6f7e[_0x482c('0x17')][_0x482c('0x19')]||null:null,'limit':_0x5b6f7e[_0x482c('0x17')]?_0x5b6f7e[_0x482c('0x17')]['limit']||null:null,'include':_0x5b6f7e['options']?_0x5b6f7e[_0x482c('0x17')][_0x482c('0x1a')]?_[_0x482c('0x1b')](_0x5b6f7e['options'][_0x482c('0x1a')],function(_0x579d2f){return{'model':db[_0x579d2f[_0x482c('0x1c')]],'as':_0x579d2f['as'],'attributes':_0x579d2f[_0x482c('0x19')],'include':_0x579d2f['include']?_[_0x482c('0x1b')](_0x579d2f['include'],function(_0x589bc6){return{'model':db[_0x589bc6[_0x482c('0x1c')]],'as':_0x589bc6['as'],'attributes':_0x589bc6[_0x482c('0x19')],'include':_0x589bc6[_0x482c('0x1a')]?_[_0x482c('0x1b')](_0x589bc6[_0x482c('0x1a')],function(_0x215826){return{'model':db[_0x215826[_0x482c('0x1c')]],'as':_0x215826['as'],'attributes':_0x215826['attributes']};}):[]};}):[]};}):[]:[]})[_0x482c('0xa')](function(_0x255417){logger['info'](_0x482c('0x15'),_0x5b6f7e);logger['debug']('GetFreshsalesAccount',_0x5b6f7e,JSON[_0x482c('0xf')](_0x255417));_0x258148(_0x255417);})['catch'](function(_0x1ac1c4){logger[_0x482c('0x10')](_0x482c('0x15'),_0x1ac1c4[_0x482c('0x12')],_0x5b6f7e);_0x4af05a(_0x3aed45[_0x482c('0x10')](0x1f4,_0x1ac1c4[_0x482c('0x12')]));});});};exports[_0x482c('0x1d')]=function(_0x3e9b22){var _0x24b4df=this;return new Promise(function(_0x2d3800,_0x3135a7){return db[_0x482c('0x1e')][_0x482c('0x1f')]({'raw':_0x3e9b22[_0x482c('0x17')]?_0x3e9b22[_0x482c('0x17')][_0x482c('0x18')]===undefined?!![]:![]:!![],'where':_0x3e9b22[_0x482c('0x17')]?_0x3e9b22[_0x482c('0x17')]['where']||null:null,'attributes':_0x3e9b22['options']?_0x3e9b22['options'][_0x482c('0x19')]||null:null,'include':_0x3e9b22[_0x482c('0x17')]?_0x3e9b22[_0x482c('0x17')][_0x482c('0x1a')]?_['map'](_0x3e9b22[_0x482c('0x17')]['include'],function(_0x31428c){return{'model':db[_0x31428c[_0x482c('0x1c')]],'as':_0x31428c['as'],'attributes':_0x31428c[_0x482c('0x19')],'include':_0x31428c[_0x482c('0x1a')]?_[_0x482c('0x1b')](_0x31428c[_0x482c('0x1a')],function(_0x129a31){return{'model':db[_0x129a31[_0x482c('0x1c')]],'as':_0x129a31['as'],'attributes':_0x129a31['attributes'],'include':_0x129a31['include']?_[_0x482c('0x1b')](_0x129a31['include'],function(_0xe62a02){return{'model':db[_0xe62a02[_0x482c('0x1c')]],'as':_0xe62a02['as'],'attributes':_0xe62a02[_0x482c('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29cbaa){logger[_0x482c('0xb')](_0x482c('0x1d'),_0x3e9b22);logger[_0x482c('0xe')]('ShowFreshsalesAccount',_0x3e9b22,JSON[_0x482c('0xf')](_0x29cbaa));_0x2d3800(_0x29cbaa);})['catch'](function(_0x1de7f4){logger['error'](_0x482c('0x1d'),_0x1de7f4['message'],_0x3e9b22);_0x3135a7(_0x24b4df[_0x482c('0x10')](0x1f4,_0x1de7f4[_0x482c('0x12')]));});});}; \ No newline at end of file +var _0x3d04=['result','FreshsalesAccount','options','where','attributes','limit','include','map','model','GetFreshsalesAccount','debug','catch','find','raw','ShowFreshsalesAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','stringify','error','FreshsalesAccount,\x20%s,\x20%s','message','info'];(function(_0x4ecda3,_0x5ca92f){var _0xc1dc9c=function(_0x259c69){while(--_0x259c69){_0x4ecda3['push'](_0x4ecda3['shift']());}};_0xc1dc9c(++_0x5ca92f);}(_0x3d04,0xbe));var _0x43d0=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x3d04[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var moment=require(_0x43d0('0x2'));var BPromise=require(_0x43d0('0x3'));var rs=require(_0x43d0('0x4'));var fs=require('fs');var Redis=require(_0x43d0('0x5'));var db=require(_0x43d0('0x6'))['db'];var utils=require(_0x43d0('0x7'));var logger=require('../../config/logger')(_0x43d0('0x8'));var config=require(_0x43d0('0x9'));var jayson=require(_0x43d0('0xa'));var client=jayson[_0x43d0('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x484271,_0x50919e,_0x5efb95){return new BPromise(function(_0x457550,_0x3344d3){return client[_0x43d0('0xc')](_0x484271,_0x5efb95)[_0x43d0('0xd')](function(_0x44a763){logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x50919e,_0x43d0('0xe'));logger['debug']('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x50919e,_0x43d0('0xe'),JSON[_0x43d0('0xf')](_0x44a763));if(_0x44a763[_0x43d0('0x10')]){if(_0x44a763[_0x43d0('0x10')]['code']===0x1f4){logger[_0x43d0('0x10')](_0x43d0('0x11'),_0x50919e,_0x44a763['error'][_0x43d0('0x12')]);return _0x3344d3(_0x44a763[_0x43d0('0x10')][_0x43d0('0x12')]);}logger['error'](_0x43d0('0x11'),_0x50919e,_0x44a763[_0x43d0('0x10')][_0x43d0('0x12')]);return _0x457550(_0x44a763['error'][_0x43d0('0x12')]);}else{logger[_0x43d0('0x13')](_0x43d0('0x11'),_0x50919e,_0x43d0('0xe'));_0x457550(_0x44a763[_0x43d0('0x14')]['message']);}})['catch'](function(_0x1e91a7){logger[_0x43d0('0x10')](_0x43d0('0x11'),_0x50919e,_0x1e91a7);_0x3344d3(_0x1e91a7);});});}exports['GetFreshsalesAccount']=function(_0x2c641e){var _0x532402=this;return new Promise(function(_0x2c9d06,_0x468ca2){return db[_0x43d0('0x15')]['findAll']({'raw':_0x2c641e[_0x43d0('0x16')]?_0x2c641e[_0x43d0('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2c641e[_0x43d0('0x16')]?_0x2c641e[_0x43d0('0x16')][_0x43d0('0x17')]||null:null,'attributes':_0x2c641e[_0x43d0('0x16')]?_0x2c641e[_0x43d0('0x16')][_0x43d0('0x18')]||null:null,'limit':_0x2c641e[_0x43d0('0x16')]?_0x2c641e[_0x43d0('0x16')][_0x43d0('0x19')]||null:null,'include':_0x2c641e[_0x43d0('0x16')]?_0x2c641e[_0x43d0('0x16')][_0x43d0('0x1a')]?_[_0x43d0('0x1b')](_0x2c641e[_0x43d0('0x16')][_0x43d0('0x1a')],function(_0x48aa18){return{'model':db[_0x48aa18[_0x43d0('0x1c')]],'as':_0x48aa18['as'],'attributes':_0x48aa18[_0x43d0('0x18')],'include':_0x48aa18['include']?_[_0x43d0('0x1b')](_0x48aa18['include'],function(_0x29c111){return{'model':db[_0x29c111[_0x43d0('0x1c')]],'as':_0x29c111['as'],'attributes':_0x29c111['attributes'],'include':_0x29c111[_0x43d0('0x1a')]?_[_0x43d0('0x1b')](_0x29c111['include'],function(_0x12df30){return{'model':db[_0x12df30[_0x43d0('0x1c')]],'as':_0x12df30['as'],'attributes':_0x12df30[_0x43d0('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x447725){logger[_0x43d0('0x13')](_0x43d0('0x1d'),_0x2c641e);logger[_0x43d0('0x1e')](_0x43d0('0x1d'),_0x2c641e,JSON[_0x43d0('0xf')](_0x447725));_0x2c9d06(_0x447725);})[_0x43d0('0x1f')](function(_0x4a3cd4){logger[_0x43d0('0x10')](_0x43d0('0x1d'),_0x4a3cd4[_0x43d0('0x12')],_0x2c641e);_0x468ca2(_0x532402['error'](0x1f4,_0x4a3cd4['message']));});});};exports['ShowFreshsalesAccount']=function(_0x3c1ea3){var _0x2db9dc=this;return new Promise(function(_0x10086b,_0x13e3c9){return db[_0x43d0('0x15')][_0x43d0('0x20')]({'raw':_0x3c1ea3['options']?_0x3c1ea3[_0x43d0('0x16')][_0x43d0('0x21')]===undefined?!![]:![]:!![],'where':_0x3c1ea3[_0x43d0('0x16')]?_0x3c1ea3[_0x43d0('0x16')][_0x43d0('0x17')]||null:null,'attributes':_0x3c1ea3[_0x43d0('0x16')]?_0x3c1ea3[_0x43d0('0x16')][_0x43d0('0x18')]||null:null,'include':_0x3c1ea3[_0x43d0('0x16')]?_0x3c1ea3[_0x43d0('0x16')][_0x43d0('0x1a')]?_['map'](_0x3c1ea3[_0x43d0('0x16')][_0x43d0('0x1a')],function(_0x45ec78){return{'model':db[_0x45ec78[_0x43d0('0x1c')]],'as':_0x45ec78['as'],'attributes':_0x45ec78['attributes'],'include':_0x45ec78[_0x43d0('0x1a')]?_['map'](_0x45ec78[_0x43d0('0x1a')],function(_0x23cc5b){return{'model':db[_0x23cc5b['model']],'as':_0x23cc5b['as'],'attributes':_0x23cc5b[_0x43d0('0x18')],'include':_0x23cc5b[_0x43d0('0x1a')]?_[_0x43d0('0x1b')](_0x23cc5b[_0x43d0('0x1a')],function(_0x154db6){return{'model':db[_0x154db6[_0x43d0('0x1c')]],'as':_0x154db6['as'],'attributes':_0x154db6[_0x43d0('0x18')]};}):[]};}):[]};}):[]:[]})[_0x43d0('0xd')](function(_0x7b7983){logger[_0x43d0('0x13')](_0x43d0('0x22'),_0x3c1ea3);logger['debug'](_0x43d0('0x22'),_0x3c1ea3,JSON[_0x43d0('0xf')](_0x7b7983));_0x10086b(_0x7b7983);})[_0x43d0('0x1f')](function(_0x7891c5){logger[_0x43d0('0x10')](_0x43d0('0x22'),_0x7891c5[_0x43d0('0x12')],_0x3c1ea3);_0x13e3c9(_0x2db9dc[_0x43d0('0x10')](0x1f4,_0x7891c5[_0x43d0('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index a61bb32..065703d 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 _0x8f91=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getFields','create','put','update','destroy','exports','util','path','connect-timeout'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8f91,0x189));var _0x18f9=function(_0x54c320,_0x3a8512){_0x54c320=_0x54c320-0x0;var _0x53816c=_0x8f91[_0x54c320];return _0x53816c;};'use strict';var multer=require('multer');var util=require(_0x18f9('0x0'));var path=require(_0x18f9('0x1'));var timeout=require(_0x18f9('0x2'));var express=require('express');var router=express[_0x18f9('0x3')]();var fs_extra=require(_0x18f9('0x4'));var auth=require(_0x18f9('0x5'));var interaction=require(_0x18f9('0x6'));var config=require(_0x18f9('0x7'));var controller=require(_0x18f9('0x8'));router[_0x18f9('0x9')]('/',auth[_0x18f9('0xa')](),controller['index']);router[_0x18f9('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x18f9('0xb')]);router[_0x18f9('0x9')](_0x18f9('0xc'),auth[_0x18f9('0xa')](),controller[_0x18f9('0xd')]);router[_0x18f9('0x9')](_0x18f9('0xe'),auth['isAuthenticated'](),controller[_0x18f9('0xf')]);router[_0x18f9('0x9')]('/:id/fields',auth[_0x18f9('0xa')](),controller[_0x18f9('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x18f9('0x11')]);router[_0x18f9('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x18f9('0x13')]);router['delete']('/:id',auth[_0x18f9('0xa')](),controller[_0x18f9('0x14')]);module[_0x18f9('0x15')]=router; \ No newline at end of file +var _0xff8e=['update','delete','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','getSubjects','/:id/descriptions','/:id/fields','getFields','create'];(function(_0xa267fd,_0x58b90e){var _0xfd7ec1=function(_0x1b5d3e){while(--_0x1b5d3e){_0xa267fd['push'](_0xa267fd['shift']());}};_0xfd7ec1(++_0x58b90e);}(_0xff8e,0xc0));var _0xeff8=function(_0x4ff7a8,_0x430b72){_0x4ff7a8=_0x4ff7a8-0x0;var _0x444b3d=_0xff8e[_0x4ff7a8];return _0x444b3d;};'use strict';var multer=require(_0xeff8('0x0'));var util=require(_0xeff8('0x1'));var path=require(_0xeff8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xeff8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xeff8('0x4'));var interaction=require(_0xeff8('0x5'));var config=require(_0xeff8('0x6'));var controller=require(_0xeff8('0x7'));router[_0xeff8('0x8')]('/',auth[_0xeff8('0x9')](),controller[_0xeff8('0xa')]);router[_0xeff8('0x8')](_0xeff8('0xb'),auth[_0xeff8('0x9')](),controller[_0xeff8('0xc')]);router[_0xeff8('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xeff8('0xd')]);router[_0xeff8('0x8')](_0xeff8('0xe'),auth[_0xeff8('0x9')](),controller['getDescriptions']);router['get'](_0xeff8('0xf'),auth[_0xeff8('0x9')](),controller[_0xeff8('0x10')]);router['post']('/',auth[_0xeff8('0x9')](),controller[_0xeff8('0x11')]);router['put']('/:id',auth[_0xeff8('0x9')](),controller[_0xeff8('0x12')]);router[_0xeff8('0x13')](_0xeff8('0xb'),auth[_0xeff8('0x9')](),controller['destroy']);module[_0xeff8('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 1a83bd1..2aeda51 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 _0x0b29=['exports','STRING','sequelize'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x0b29,0x1c1));var _0x90b2=function(_0x231cd1,_0x3943d1){_0x231cd1=_0x231cd1-0x0;var _0x10d942=_0x0b29[_0x231cd1];return _0x10d942;};'use strict';var Sequelize=require(_0x90b2('0x0'));module[_0x90b2('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x90b2('0x2')]}}; \ No newline at end of file +var _0xa9ef=['STRING','exports'];(function(_0x267cf4,_0xcbcf72){var _0x4824cf=function(_0x3e53d6){while(--_0x3e53d6){_0x267cf4['push'](_0x267cf4['shift']());}};_0x4824cf(++_0xcbcf72);}(_0xa9ef,0xe9));var _0xfa9e=function(_0x17be35,_0x24728a){_0x17be35=_0x17be35-0x0;var _0x3d3bcc=_0xa9ef[_0x17be35];return _0x3d3bcc;};'use strict';var Sequelize=require('sequelize');module[_0xfa9e('0x0')]={'name':{'type':Sequelize[_0xfa9e('0x1')]},'description':{'type':Sequelize[_0xfa9e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index d00f028..e875f7f 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 _0x5763=['Content-Range','apply','save','then','destroy','error','stack','name','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','update','body','getSubjects','findOne','FreshsalesField','order','getDescriptions','getFields','rimraf','zip-dir','request-promise','bluebird','util','path','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x3ba748,_0x4b8fb9){var _0x5b04e2=function(_0x16bb9e){while(--_0x16bb9e){_0x3ba748['push'](_0x3ba748['shift']());}};_0x5b04e2(++_0x4b8fb9);}(_0x5763,0x153));var _0x3576=function(_0x4f1c81,_0x30a386){_0x4f1c81=_0x4f1c81-0x0;var _0x49dca6=_0x5763[_0x4f1c81];return _0x49dca6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3576('0x0'));var zipdir=require(_0x3576('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3576('0x2'));var moment=require('moment');var BPromise=require(_0x3576('0x3'));var Mustache=require('mustache');var util=require(_0x3576('0x4'));var path=require(_0x3576('0x5'));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(_0x3576('0x6'));var squel=require('squel');var crypto=require(_0x3576('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x3576('0x8'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3576('0x9'));var Redis=require(_0x3576('0xa'));var authService=require(_0x3576('0xb'));var qs=require('../../components/parsers/qs');var as=require(_0x3576('0xc'));var hardwareService=require(_0x3576('0xd'));var logger=require(_0x3576('0xe'))('api');var utils=require('../../config/utils');var config=require(_0x3576('0xf'));var licenseUtil=require('../../config/license/util');var db=require(_0x3576('0x10'))['db'];function respondWithStatusCode(_0x33abc0,_0x40427c){_0x40427c=_0x40427c||0xcc;return function(_0x317f71){if(_0x317f71){return _0x33abc0[_0x3576('0x11')](_0x40427c);}return _0x33abc0[_0x3576('0x12')](_0x40427c)[_0x3576('0x13')]();};}function respondWithResult(_0x561351,_0x3b271a){_0x3b271a=_0x3b271a||0xc8;return function(_0x1e129a){if(_0x1e129a){return _0x561351['status'](_0x3b271a)[_0x3576('0x14')](_0x1e129a);}};}function respondWithFilteredResult(_0x3c35f2,_0x5b155e){return function(_0x3ac68a){if(_0x3ac68a){var _0x29da9c=typeof _0x5b155e[_0x3576('0x15')]===_0x3576('0x16')&&typeof _0x5b155e[_0x3576('0x17')]===_0x3576('0x16');var _0x3f2585=_0x3ac68a[_0x3576('0x18')];var _0x578b23=_0x29da9c?0x0:_0x5b155e[_0x3576('0x15')];var _0x75a76a=_0x29da9c?_0x3ac68a['count']:_0x5b155e[_0x3576('0x15')]+_0x5b155e[_0x3576('0x17')];var _0x3d86ad;if(_0x75a76a>=_0x3f2585){_0x75a76a=_0x3f2585;_0x3d86ad=0xc8;}else{_0x3d86ad=0xce;}_0x3c35f2[_0x3576('0x12')](_0x3d86ad);return _0x3c35f2[_0x3576('0x19')](_0x3576('0x1a'),_0x578b23+'-'+_0x75a76a+'/'+_0x3f2585)[_0x3576('0x14')](_0x3ac68a);}return null;};}function patchUpdates(_0x3ef90b){return function(_0x19237f){try{jsonpatch[_0x3576('0x1b')](_0x19237f,_0x3ef90b,!![]);}catch(_0xa92ab2){return BPromise['reject'](_0xa92ab2);}return _0x19237f[_0x3576('0x1c')]();};}function saveUpdates(_0x443e0f,_0xd21c04){return function(_0x33d2ed){if(_0x33d2ed){return _0x33d2ed['update'](_0x443e0f)[_0x3576('0x1d')](function(_0x4dda37){return _0x4dda37;});}return null;};}function removeEntity(_0x1c3a2d,_0x9a1afc){return function(_0x5ad2f8){if(_0x5ad2f8){return _0x5ad2f8[_0x3576('0x1e')]()[_0x3576('0x1d')](function(){_0x1c3a2d['status'](0xcc)[_0x3576('0x13')]();});}};}function handleEntityNotFound(_0x5210bb,_0x16c7fe){return function(_0x5aa3d9){if(!_0x5aa3d9){_0x5210bb[_0x3576('0x11')](0x194);}return _0x5aa3d9;};}function handleError(_0xc29f0a,_0x2a5116){_0x2a5116=_0x2a5116||0x1f4;return function(_0x4dd88a){logger[_0x3576('0x1f')](_0x4dd88a[_0x3576('0x20')]);if(_0x4dd88a['name']){delete _0x4dd88a[_0x3576('0x21')];}_0xc29f0a[_0x3576('0x12')](_0x2a5116)['send'](_0x4dd88a);};}exports[_0x3576('0x22')]=function(_0x1f9811,_0x756e4a){var _0x5c8460={},_0x38b789={},_0x59567e={'count':0x0,'rows':[]};var _0x330c8c=_[_0x3576('0x23')](db[_0x3576('0x24')][_0x3576('0x25')],function(_0x50cce0){return{'name':_0x50cce0[_0x3576('0x26')],'type':_0x50cce0[_0x3576('0x27')]['key']};});_0x38b789[_0x3576('0x28')]=_[_0x3576('0x23')](_0x330c8c,_0x3576('0x21'));_0x38b789[_0x3576('0x29')]=_[_0x3576('0x2a')](_0x1f9811['query']);_0x38b789[_0x3576('0x2b')]=_['intersection'](_0x38b789[_0x3576('0x28')],_0x38b789[_0x3576('0x29')]);_0x5c8460[_0x3576('0x2c')]=_[_0x3576('0x2d')](_0x38b789['model'],qs['fields'](_0x1f9811['query'][_0x3576('0x2e')]));_0x5c8460[_0x3576('0x2c')]=_0x5c8460['attributes']['length']?_0x5c8460[_0x3576('0x2c')]:_0x38b789[_0x3576('0x28')];if(!_0x1f9811[_0x3576('0x29')][_0x3576('0x2f')](_0x3576('0x30'))){_0x5c8460[_0x3576('0x17')]=qs[_0x3576('0x17')](_0x1f9811['query'][_0x3576('0x17')]);_0x5c8460[_0x3576('0x15')]=qs['offset'](_0x1f9811[_0x3576('0x29')]['offset']);}_0x5c8460['order']=qs['sort'](_0x1f9811['query'][_0x3576('0x31')]);_0x5c8460[_0x3576('0x32')]=qs[_0x3576('0x2b')](_[_0x3576('0x33')](_0x1f9811[_0x3576('0x29')],_0x38b789[_0x3576('0x2b')]),_0x330c8c);if(_0x1f9811['query'][_0x3576('0x34')]){_0x5c8460[_0x3576('0x32')]=_[_0x3576('0x35')](_0x5c8460[_0x3576('0x32')],{'$or':_[_0x3576('0x23')](_0x330c8c,function(_0x4bbe37){if(_0x4bbe37['type']!=='VIRTUAL'){var _0x4a4416={};_0x4a4416[_0x4bbe37[_0x3576('0x21')]]={'$like':'%'+_0x1f9811['query']['filter']+'%'};return _0x4a4416;}})});}_0x5c8460=_['merge']({},_0x5c8460,_0x1f9811['options']);var _0x9aaf86={'where':_0x5c8460['where']};return db[_0x3576('0x24')][_0x3576('0x18')](_0x9aaf86)[_0x3576('0x1d')](function(_0x2b392e){_0x59567e[_0x3576('0x18')]=_0x2b392e;if(_0x1f9811[_0x3576('0x29')][_0x3576('0x36')]){_0x5c8460[_0x3576('0x37')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x3576('0x38')](_0x5c8460);})['then'](function(_0x5ff25a){_0x59567e[_0x3576('0x39')]=_0x5ff25a;return _0x59567e;})[_0x3576('0x1d')](respondWithFilteredResult(_0x756e4a,_0x5c8460))[_0x3576('0x3a')](handleError(_0x756e4a,null));};exports[_0x3576('0x3b')]=function(_0x349609,_0x4347a2){var _0x5acb96={'raw':![],'where':{'id':_0x349609[_0x3576('0x3c')]['id']}},_0x3fc883={};_0x3fc883['model']=_[_0x3576('0x2a')](db[_0x3576('0x24')]['rawAttributes']);_0x3fc883['query']=_[_0x3576('0x2a')](_0x349609['query']);_0x3fc883[_0x3576('0x2b')]=_[_0x3576('0x2d')](_0x3fc883['model'],_0x3fc883[_0x3576('0x29')]);_0x5acb96[_0x3576('0x2c')]=_['intersection'](_0x3fc883[_0x3576('0x28')],qs[_0x3576('0x2e')](_0x349609['query']['fields']));_0x5acb96['attributes']=_0x5acb96[_0x3576('0x2c')][_0x3576('0x3d')]?_0x5acb96[_0x3576('0x2c')]:_0x3fc883[_0x3576('0x28')];if(_0x349609['query'][_0x3576('0x36')]){_0x5acb96['include']=[{'all':!![]}];}_0x5acb96=_[_0x3576('0x35')]({},_0x5acb96,_0x349609[_0x3576('0x3e')]);return db['FreshsalesConfiguration'][_0x3576('0x3f')](_0x5acb96)['then'](handleEntityNotFound(_0x4347a2,null))[_0x3576('0x1d')](respondWithResult(_0x4347a2,null))[_0x3576('0x3a')](handleError(_0x4347a2,null));};exports[_0x3576('0x40')]=function(_0x5a5d17,_0x298c23){return db[_0x3576('0x24')][_0x3576('0x40')](_0x5a5d17['body'],{})[_0x3576('0x1d')](respondWithResult(_0x298c23,0xc9))['catch'](handleError(_0x298c23,null));};exports[_0x3576('0x41')]=function(_0x4a3f29,_0x1ab424){if(_0x4a3f29[_0x3576('0x42')]['id']){delete _0x4a3f29[_0x3576('0x42')]['id'];}return db[_0x3576('0x24')]['find']({'where':{'id':_0x4a3f29[_0x3576('0x3c')]['id']}})['then'](handleEntityNotFound(_0x1ab424,null))[_0x3576('0x1d')](saveUpdates(_0x4a3f29[_0x3576('0x42')],null))['then'](respondWithResult(_0x1ab424,null))[_0x3576('0x3a')](handleError(_0x1ab424,null));};exports[_0x3576('0x1e')]=function(_0x572a24,_0x34a75c){return db[_0x3576('0x24')][_0x3576('0x3f')]({'where':{'id':_0x572a24[_0x3576('0x3c')]['id']}})[_0x3576('0x1d')](handleEntityNotFound(_0x34a75c,null))[_0x3576('0x1d')](removeEntity(_0x34a75c,null))[_0x3576('0x3a')](handleError(_0x34a75c,null));};exports[_0x3576('0x43')]=function(_0x7a2cba,_0x96c0c5,_0x3513be){var _0x24b4c2={};var _0x584f5b={};var _0x1824b1;var _0xfdb5e9;return db[_0x3576('0x24')][_0x3576('0x44')]({'where':{'id':_0x7a2cba[_0x3576('0x3c')]['id']}})['then'](handleEntityNotFound(_0x96c0c5,null))[_0x3576('0x1d')](function(_0x54aacb){if(_0x54aacb){_0x1824b1=_0x54aacb;_0x584f5b[_0x3576('0x28')]=_[_0x3576('0x2a')](db[_0x3576('0x45')][_0x3576('0x25')]);_0x584f5b['query']=_[_0x3576('0x2a')](_0x7a2cba['query']);_0x584f5b[_0x3576('0x2b')]=_['intersection'](_0x584f5b[_0x3576('0x28')],_0x584f5b['query']);_0x24b4c2['attributes']=_['intersection'](_0x584f5b[_0x3576('0x28')],qs['fields'](_0x7a2cba[_0x3576('0x29')][_0x3576('0x2e')]));_0x24b4c2['attributes']=_0x24b4c2[_0x3576('0x2c')]['length']?_0x24b4c2[_0x3576('0x2c')]:_0x584f5b[_0x3576('0x28')];_0x24b4c2[_0x3576('0x46')]=qs[_0x3576('0x31')](_0x7a2cba[_0x3576('0x29')]['sort']);_0x24b4c2[_0x3576('0x32')]=qs[_0x3576('0x2b')](_[_0x3576('0x33')](_0x7a2cba['query'],_0x584f5b[_0x3576('0x2b')]));if(_0x7a2cba[_0x3576('0x29')][_0x3576('0x34')]){_0x24b4c2[_0x3576('0x32')]=_[_0x3576('0x35')](_0x24b4c2[_0x3576('0x32')],{'$or':_['map'](_0x24b4c2[_0x3576('0x2c')],function(_0x55379b){var _0x4be1d0={};_0x4be1d0[_0x55379b]={'$like':'%'+_0x7a2cba[_0x3576('0x29')][_0x3576('0x34')]+'%'};return _0x4be1d0;})});}_0x24b4c2=_[_0x3576('0x35')]({},_0x24b4c2,_0x7a2cba['options']);return _0x1824b1[_0x3576('0x43')](_0x24b4c2);}})[_0x3576('0x1d')](function(_0x343f4a){if(_0x343f4a){_0xfdb5e9=_0x343f4a[_0x3576('0x3d')];if(!_0x7a2cba[_0x3576('0x29')]['hasOwnProperty'](_0x3576('0x30'))){_0x24b4c2[_0x3576('0x17')]=qs[_0x3576('0x17')](_0x7a2cba['query'][_0x3576('0x17')]);_0x24b4c2['offset']=qs[_0x3576('0x15')](_0x7a2cba[_0x3576('0x29')][_0x3576('0x15')]);}return _0x1824b1['getSubjects'](_0x24b4c2);}})['then'](function(_0x4a85ca){if(_0x4a85ca){return _0x4a85ca?{'count':_0xfdb5e9,'rows':_0x4a85ca}:null;}})[_0x3576('0x1d')](respondWithResult(_0x96c0c5,null))[_0x3576('0x3a')](handleError(_0x96c0c5,null));};exports[_0x3576('0x47')]=function(_0x1a782e,_0x595f26,_0x577ca2){var _0x31d5cd={};var _0x1370ea={};var _0x30dd19;var _0x3a979d;return db['FreshsalesConfiguration'][_0x3576('0x44')]({'where':{'id':_0x1a782e['params']['id']}})[_0x3576('0x1d')](handleEntityNotFound(_0x595f26,null))[_0x3576('0x1d')](function(_0x5cd5f8){if(_0x5cd5f8){_0x30dd19=_0x5cd5f8;_0x1370ea[_0x3576('0x28')]=_[_0x3576('0x2a')](db['FreshsalesField']['rawAttributes']);_0x1370ea[_0x3576('0x29')]=_[_0x3576('0x2a')](_0x1a782e[_0x3576('0x29')]);_0x1370ea[_0x3576('0x2b')]=_[_0x3576('0x2d')](_0x1370ea[_0x3576('0x28')],_0x1370ea[_0x3576('0x29')]);_0x31d5cd[_0x3576('0x2c')]=_[_0x3576('0x2d')](_0x1370ea[_0x3576('0x28')],qs['fields'](_0x1a782e[_0x3576('0x29')][_0x3576('0x2e')]));_0x31d5cd[_0x3576('0x2c')]=_0x31d5cd[_0x3576('0x2c')]['length']?_0x31d5cd['attributes']:_0x1370ea[_0x3576('0x28')];_0x31d5cd[_0x3576('0x46')]=qs[_0x3576('0x31')](_0x1a782e[_0x3576('0x29')][_0x3576('0x31')]);_0x31d5cd[_0x3576('0x32')]=qs[_0x3576('0x2b')](_[_0x3576('0x33')](_0x1a782e['query'],_0x1370ea['filters']));if(_0x1a782e['query'][_0x3576('0x34')]){_0x31d5cd[_0x3576('0x32')]=_[_0x3576('0x35')](_0x31d5cd[_0x3576('0x32')],{'$or':_['map'](_0x31d5cd[_0x3576('0x2c')],function(_0x4a4324){var _0x7ef7f0={};_0x7ef7f0[_0x4a4324]={'$like':'%'+_0x1a782e[_0x3576('0x29')][_0x3576('0x34')]+'%'};return _0x7ef7f0;})});}_0x31d5cd=_['merge']({},_0x31d5cd,_0x1a782e[_0x3576('0x3e')]);return _0x30dd19['getDescriptions'](_0x31d5cd);}})[_0x3576('0x1d')](function(_0x122162){if(_0x122162){_0x3a979d=_0x122162['length'];if(!_0x1a782e[_0x3576('0x29')][_0x3576('0x2f')](_0x3576('0x30'))){_0x31d5cd['limit']=qs[_0x3576('0x17')](_0x1a782e[_0x3576('0x29')][_0x3576('0x17')]);_0x31d5cd['offset']=qs[_0x3576('0x15')](_0x1a782e['query'][_0x3576('0x15')]);}return _0x30dd19[_0x3576('0x47')](_0x31d5cd);}})[_0x3576('0x1d')](function(_0x23ffa8){if(_0x23ffa8){return _0x23ffa8?{'count':_0x3a979d,'rows':_0x23ffa8}:null;}})[_0x3576('0x1d')](respondWithResult(_0x595f26,null))[_0x3576('0x3a')](handleError(_0x595f26,null));};exports[_0x3576('0x48')]=function(_0x592285,_0x159559,_0x2ca647){var _0x44928f={};var _0x58d544={};var _0x123590;var _0x5715b7;return db[_0x3576('0x24')][_0x3576('0x44')]({'where':{'id':_0x592285[_0x3576('0x3c')]['id']}})[_0x3576('0x1d')](handleEntityNotFound(_0x159559,null))[_0x3576('0x1d')](function(_0x3e926c){if(_0x3e926c){_0x123590=_0x3e926c;_0x58d544[_0x3576('0x28')]=_[_0x3576('0x2a')](db[_0x3576('0x45')][_0x3576('0x25')]);_0x58d544[_0x3576('0x29')]=_[_0x3576('0x2a')](_0x592285['query']);_0x58d544['filters']=_[_0x3576('0x2d')](_0x58d544[_0x3576('0x28')],_0x58d544[_0x3576('0x29')]);_0x44928f[_0x3576('0x2c')]=_['intersection'](_0x58d544[_0x3576('0x28')],qs[_0x3576('0x2e')](_0x592285['query'][_0x3576('0x2e')]));_0x44928f[_0x3576('0x2c')]=_0x44928f[_0x3576('0x2c')][_0x3576('0x3d')]?_0x44928f[_0x3576('0x2c')]:_0x58d544[_0x3576('0x28')];_0x44928f[_0x3576('0x46')]=qs[_0x3576('0x31')](_0x592285[_0x3576('0x29')][_0x3576('0x31')]);_0x44928f[_0x3576('0x32')]=qs[_0x3576('0x2b')](_['pick'](_0x592285[_0x3576('0x29')],_0x58d544['filters']));if(_0x592285[_0x3576('0x29')][_0x3576('0x34')]){_0x44928f['where']=_[_0x3576('0x35')](_0x44928f[_0x3576('0x32')],{'$or':_['map'](_0x44928f[_0x3576('0x2c')],function(_0x284815){var _0x323340={};_0x323340[_0x284815]={'$like':'%'+_0x592285[_0x3576('0x29')][_0x3576('0x34')]+'%'};return _0x323340;})});}_0x44928f=_[_0x3576('0x35')]({},_0x44928f,_0x592285[_0x3576('0x3e')]);return _0x123590[_0x3576('0x48')](_0x44928f);}})[_0x3576('0x1d')](function(_0x1982ab){if(_0x1982ab){_0x5715b7=_0x1982ab[_0x3576('0x3d')];if(!_0x592285[_0x3576('0x29')]['hasOwnProperty'](_0x3576('0x30'))){_0x44928f[_0x3576('0x17')]=qs[_0x3576('0x17')](_0x592285['query'][_0x3576('0x17')]);_0x44928f[_0x3576('0x15')]=qs[_0x3576('0x15')](_0x592285[_0x3576('0x29')][_0x3576('0x15')]);}return _0x123590[_0x3576('0x48')](_0x44928f);}})[_0x3576('0x1d')](function(_0xc7b16){if(_0xc7b16){return _0xc7b16?{'count':_0x5715b7,'rows':_0xc7b16}:null;}})[_0x3576('0x1d')](respondWithResult(_0x159559,null))['catch'](handleError(_0x159559,null));}; \ No newline at end of file +var _0x8a87=['papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','error','name','map','FreshsalesConfiguration','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','findOne','FreshsalesField','getSubjects','hasOwnProperty','getDescriptions','order','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring'];(function(_0x49ab28,_0xae6e4){var _0x4ec00d=function(_0x2e7bda){while(--_0x2e7bda){_0x49ab28['push'](_0x49ab28['shift']());}};_0x4ec00d(++_0xae6e4);}(_0x8a87,0x192));var _0x78a8=function(_0x1aec02,_0x3a7f22){_0x1aec02=_0x1aec02-0x0;var _0x10a837=_0x8a87[_0x1aec02];return _0x10a837;};'use strict';var emlformat=require(_0x78a8('0x0'));var rimraf=require(_0x78a8('0x1'));var zipdir=require(_0x78a8('0x2'));var jsonpatch=require(_0x78a8('0x3'));var rp=require(_0x78a8('0x4'));var moment=require(_0x78a8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x78a8('0x6'));var util=require(_0x78a8('0x7'));var path=require(_0x78a8('0x8'));var sox=require(_0x78a8('0x9'));var csv=require('to-csv');var ejs=require(_0x78a8('0xa'));var fs=require('fs');var fs_extra=require(_0x78a8('0xb'));var _=require(_0x78a8('0xc'));var squel=require(_0x78a8('0xd'));var crypto=require(_0x78a8('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x78a8('0xf'));var toCsv=require(_0x78a8('0x10'));var querystring=require(_0x78a8('0x11'));var Papa=require(_0x78a8('0x12'));var Redis=require(_0x78a8('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x78a8('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x78a8('0x15'));var logger=require(_0x78a8('0x16'))(_0x78a8('0x17'));var utils=require(_0x78a8('0x18'));var config=require(_0x78a8('0x19'));var licenseUtil=require(_0x78a8('0x1a'));var db=require(_0x78a8('0x1b'))['db'];function respondWithStatusCode(_0x445c82,_0x2d678c){_0x2d678c=_0x2d678c||0xcc;return function(_0x148a0a){if(_0x148a0a){return _0x445c82[_0x78a8('0x1c')](_0x2d678c);}return _0x445c82['status'](_0x2d678c)[_0x78a8('0x1d')]();};}function respondWithResult(_0x28128b,_0x455194){_0x455194=_0x455194||0xc8;return function(_0x34705f){if(_0x34705f){return _0x28128b[_0x78a8('0x1e')](_0x455194)['json'](_0x34705f);}};}function respondWithFilteredResult(_0x1a9ebb,_0x5d8577){return function(_0x3ad70b){if(_0x3ad70b){var _0x50c608=typeof _0x5d8577[_0x78a8('0x1f')]==='undefined'&&typeof _0x5d8577[_0x78a8('0x20')]===_0x78a8('0x21');var _0x4f2070=_0x3ad70b[_0x78a8('0x22')];var _0x381ae1=_0x50c608?0x0:_0x5d8577[_0x78a8('0x1f')];var _0x192cfb=_0x50c608?_0x3ad70b[_0x78a8('0x22')]:_0x5d8577[_0x78a8('0x1f')]+_0x5d8577['limit'];var _0x2b7785;if(_0x192cfb>=_0x4f2070){_0x192cfb=_0x4f2070;_0x2b7785=0xc8;}else{_0x2b7785=0xce;}_0x1a9ebb[_0x78a8('0x1e')](_0x2b7785);return _0x1a9ebb['set'](_0x78a8('0x23'),_0x381ae1+'-'+_0x192cfb+'/'+_0x4f2070)[_0x78a8('0x24')](_0x3ad70b);}return null;};}function patchUpdates(_0x45044d){return function(_0x4399d3){try{jsonpatch[_0x78a8('0x25')](_0x4399d3,_0x45044d,!![]);}catch(_0x38e77e){return BPromise[_0x78a8('0x26')](_0x38e77e);}return _0x4399d3[_0x78a8('0x27')]();};}function saveUpdates(_0x20411d,_0x2f86ba){return function(_0x536cbc){if(_0x536cbc){return _0x536cbc[_0x78a8('0x28')](_0x20411d)[_0x78a8('0x29')](function(_0x3027a2){return _0x3027a2;});}return null;};}function removeEntity(_0xcea3f1,_0x4e56d5){return function(_0x5d55e4){if(_0x5d55e4){return _0x5d55e4[_0x78a8('0x2a')]()[_0x78a8('0x29')](function(){_0xcea3f1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1af065,_0x51c8ca){return function(_0x1ff51c){if(!_0x1ff51c){_0x1af065[_0x78a8('0x1c')](0x194);}return _0x1ff51c;};}function handleError(_0x234f81,_0x1bb1c7){_0x1bb1c7=_0x1bb1c7||0x1f4;return function(_0x9ef52d){logger[_0x78a8('0x2b')](_0x9ef52d['stack']);if(_0x9ef52d['name']){delete _0x9ef52d[_0x78a8('0x2c')];}_0x234f81['status'](_0x1bb1c7)['send'](_0x9ef52d);};}exports['index']=function(_0x14e217,_0x130f45){var _0x416724={},_0x16e19b={},_0x40e629={'count':0x0,'rows':[]};var _0x53140a=_[_0x78a8('0x2d')](db[_0x78a8('0x2e')]['rawAttributes'],function(_0x2b4136){return{'name':_0x2b4136[_0x78a8('0x2f')],'type':_0x2b4136[_0x78a8('0x30')][_0x78a8('0x31')]};});_0x16e19b['model']=_['map'](_0x53140a,_0x78a8('0x2c'));_0x16e19b[_0x78a8('0x32')]=_[_0x78a8('0x33')](_0x14e217[_0x78a8('0x32')]);_0x16e19b[_0x78a8('0x34')]=_[_0x78a8('0x35')](_0x16e19b[_0x78a8('0x36')],_0x16e19b['query']);_0x416724['attributes']=_['intersection'](_0x16e19b[_0x78a8('0x36')],qs['fields'](_0x14e217['query'][_0x78a8('0x37')]));_0x416724[_0x78a8('0x38')]=_0x416724[_0x78a8('0x38')][_0x78a8('0x39')]?_0x416724['attributes']:_0x16e19b[_0x78a8('0x36')];if(!_0x14e217['query']['hasOwnProperty'](_0x78a8('0x3a'))){_0x416724[_0x78a8('0x20')]=qs[_0x78a8('0x20')](_0x14e217[_0x78a8('0x32')]['limit']);_0x416724[_0x78a8('0x1f')]=qs[_0x78a8('0x1f')](_0x14e217[_0x78a8('0x32')][_0x78a8('0x1f')]);}_0x416724['order']=qs[_0x78a8('0x3b')](_0x14e217[_0x78a8('0x32')][_0x78a8('0x3b')]);_0x416724['where']=qs['filters'](_[_0x78a8('0x3c')](_0x14e217[_0x78a8('0x32')],_0x16e19b[_0x78a8('0x34')]),_0x53140a);if(_0x14e217[_0x78a8('0x32')][_0x78a8('0x3d')]){_0x416724[_0x78a8('0x3e')]=_[_0x78a8('0x3f')](_0x416724[_0x78a8('0x3e')],{'$or':_[_0x78a8('0x2d')](_0x53140a,function(_0x424913){if(_0x424913[_0x78a8('0x30')]!==_0x78a8('0x40')){var _0x49a414={};_0x49a414[_0x424913[_0x78a8('0x2c')]]={'$like':'%'+_0x14e217[_0x78a8('0x32')][_0x78a8('0x3d')]+'%'};return _0x49a414;}})});}_0x416724=_[_0x78a8('0x3f')]({},_0x416724,_0x14e217[_0x78a8('0x41')]);var _0xb59e87={'where':_0x416724[_0x78a8('0x3e')]};return db['FreshsalesConfiguration'][_0x78a8('0x22')](_0xb59e87)['then'](function(_0x147439){_0x40e629[_0x78a8('0x22')]=_0x147439;if(_0x14e217[_0x78a8('0x32')][_0x78a8('0x42')]){_0x416724[_0x78a8('0x43')]=[{'all':!![]}];}return db[_0x78a8('0x2e')][_0x78a8('0x44')](_0x416724);})[_0x78a8('0x29')](function(_0x514a76){_0x40e629[_0x78a8('0x45')]=_0x514a76;return _0x40e629;})[_0x78a8('0x29')](respondWithFilteredResult(_0x130f45,_0x416724))[_0x78a8('0x46')](handleError(_0x130f45,null));};exports[_0x78a8('0x47')]=function(_0x416d93,_0x3919bd){var _0x37fb77={'raw':![],'where':{'id':_0x416d93['params']['id']}},_0x120c78={};_0x120c78[_0x78a8('0x36')]=_['keys'](db[_0x78a8('0x2e')][_0x78a8('0x48')]);_0x120c78[_0x78a8('0x32')]=_[_0x78a8('0x33')](_0x416d93['query']);_0x120c78[_0x78a8('0x34')]=_[_0x78a8('0x35')](_0x120c78['model'],_0x120c78['query']);_0x37fb77[_0x78a8('0x38')]=_[_0x78a8('0x35')](_0x120c78[_0x78a8('0x36')],qs[_0x78a8('0x37')](_0x416d93[_0x78a8('0x32')][_0x78a8('0x37')]));_0x37fb77[_0x78a8('0x38')]=_0x37fb77[_0x78a8('0x38')][_0x78a8('0x39')]?_0x37fb77['attributes']:_0x120c78[_0x78a8('0x36')];if(_0x416d93[_0x78a8('0x32')][_0x78a8('0x42')]){_0x37fb77[_0x78a8('0x43')]=[{'all':!![]}];}_0x37fb77=_['merge']({},_0x37fb77,_0x416d93[_0x78a8('0x41')]);return db['FreshsalesConfiguration'][_0x78a8('0x49')](_0x37fb77)['then'](handleEntityNotFound(_0x3919bd,null))[_0x78a8('0x29')](respondWithResult(_0x3919bd,null))['catch'](handleError(_0x3919bd,null));};exports[_0x78a8('0x4a')]=function(_0xfb5193,_0x4ea0be){return db['FreshsalesConfiguration'][_0x78a8('0x4a')](_0xfb5193['body'],{})[_0x78a8('0x29')](respondWithResult(_0x4ea0be,0xc9))[_0x78a8('0x46')](handleError(_0x4ea0be,null));};exports[_0x78a8('0x28')]=function(_0x3127f1,_0x1efa52){if(_0x3127f1['body']['id']){delete _0x3127f1[_0x78a8('0x4b')]['id'];}return db[_0x78a8('0x2e')][_0x78a8('0x49')]({'where':{'id':_0x3127f1[_0x78a8('0x4c')]['id']}})[_0x78a8('0x29')](handleEntityNotFound(_0x1efa52,null))['then'](saveUpdates(_0x3127f1[_0x78a8('0x4b')],null))[_0x78a8('0x29')](respondWithResult(_0x1efa52,null))[_0x78a8('0x46')](handleError(_0x1efa52,null));};exports[_0x78a8('0x2a')]=function(_0x3fcc04,_0x1dd9e9){return db['FreshsalesConfiguration'][_0x78a8('0x49')]({'where':{'id':_0x3fcc04[_0x78a8('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1dd9e9,null))['then'](removeEntity(_0x1dd9e9,null))[_0x78a8('0x46')](handleError(_0x1dd9e9,null));};exports['getSubjects']=function(_0x279f90,_0x29f799,_0x28b229){var _0x1c1836={};var _0x528109={};var _0x3f3a3b;var _0x596000;return db[_0x78a8('0x2e')][_0x78a8('0x4d')]({'where':{'id':_0x279f90[_0x78a8('0x4c')]['id']}})['then'](handleEntityNotFound(_0x29f799,null))[_0x78a8('0x29')](function(_0x1a9595){if(_0x1a9595){_0x3f3a3b=_0x1a9595;_0x528109[_0x78a8('0x36')]=_['keys'](db[_0x78a8('0x4e')][_0x78a8('0x48')]);_0x528109[_0x78a8('0x32')]=_[_0x78a8('0x33')](_0x279f90[_0x78a8('0x32')]);_0x528109[_0x78a8('0x34')]=_[_0x78a8('0x35')](_0x528109[_0x78a8('0x36')],_0x528109[_0x78a8('0x32')]);_0x1c1836['attributes']=_[_0x78a8('0x35')](_0x528109[_0x78a8('0x36')],qs[_0x78a8('0x37')](_0x279f90['query']['fields']));_0x1c1836[_0x78a8('0x38')]=_0x1c1836[_0x78a8('0x38')]['length']?_0x1c1836['attributes']:_0x528109[_0x78a8('0x36')];_0x1c1836['order']=qs['sort'](_0x279f90['query']['sort']);_0x1c1836[_0x78a8('0x3e')]=qs[_0x78a8('0x34')](_['pick'](_0x279f90[_0x78a8('0x32')],_0x528109[_0x78a8('0x34')]));if(_0x279f90['query'][_0x78a8('0x3d')]){_0x1c1836[_0x78a8('0x3e')]=_['merge'](_0x1c1836[_0x78a8('0x3e')],{'$or':_[_0x78a8('0x2d')](_0x1c1836[_0x78a8('0x38')],function(_0xe1a3f0){var _0x288c54={};_0x288c54[_0xe1a3f0]={'$like':'%'+_0x279f90[_0x78a8('0x32')]['filter']+'%'};return _0x288c54;})});}_0x1c1836=_[_0x78a8('0x3f')]({},_0x1c1836,_0x279f90[_0x78a8('0x41')]);return _0x3f3a3b[_0x78a8('0x4f')](_0x1c1836);}})[_0x78a8('0x29')](function(_0x800cdf){if(_0x800cdf){_0x596000=_0x800cdf[_0x78a8('0x39')];if(!_0x279f90['query'][_0x78a8('0x50')]('nolimit')){_0x1c1836[_0x78a8('0x20')]=qs[_0x78a8('0x20')](_0x279f90[_0x78a8('0x32')][_0x78a8('0x20')]);_0x1c1836[_0x78a8('0x1f')]=qs[_0x78a8('0x1f')](_0x279f90[_0x78a8('0x32')][_0x78a8('0x1f')]);}return _0x3f3a3b[_0x78a8('0x4f')](_0x1c1836);}})[_0x78a8('0x29')](function(_0x5d10ee){if(_0x5d10ee){return _0x5d10ee?{'count':_0x596000,'rows':_0x5d10ee}:null;}})[_0x78a8('0x29')](respondWithResult(_0x29f799,null))[_0x78a8('0x46')](handleError(_0x29f799,null));};exports[_0x78a8('0x51')]=function(_0x50222e,_0x24f271,_0x13d213){var _0x1e137c={};var _0x286ec4={};var _0x1fb949;var _0x290166;return db[_0x78a8('0x2e')][_0x78a8('0x4d')]({'where':{'id':_0x50222e[_0x78a8('0x4c')]['id']}})[_0x78a8('0x29')](handleEntityNotFound(_0x24f271,null))[_0x78a8('0x29')](function(_0x110d85){if(_0x110d85){_0x1fb949=_0x110d85;_0x286ec4[_0x78a8('0x36')]=_[_0x78a8('0x33')](db[_0x78a8('0x4e')][_0x78a8('0x48')]);_0x286ec4[_0x78a8('0x32')]=_[_0x78a8('0x33')](_0x50222e['query']);_0x286ec4[_0x78a8('0x34')]=_['intersection'](_0x286ec4[_0x78a8('0x36')],_0x286ec4[_0x78a8('0x32')]);_0x1e137c[_0x78a8('0x38')]=_[_0x78a8('0x35')](_0x286ec4[_0x78a8('0x36')],qs[_0x78a8('0x37')](_0x50222e[_0x78a8('0x32')]['fields']));_0x1e137c[_0x78a8('0x38')]=_0x1e137c[_0x78a8('0x38')][_0x78a8('0x39')]?_0x1e137c[_0x78a8('0x38')]:_0x286ec4['model'];_0x1e137c[_0x78a8('0x52')]=qs[_0x78a8('0x3b')](_0x50222e[_0x78a8('0x32')][_0x78a8('0x3b')]);_0x1e137c['where']=qs[_0x78a8('0x34')](_[_0x78a8('0x3c')](_0x50222e[_0x78a8('0x32')],_0x286ec4[_0x78a8('0x34')]));if(_0x50222e['query'][_0x78a8('0x3d')]){_0x1e137c[_0x78a8('0x3e')]=_[_0x78a8('0x3f')](_0x1e137c[_0x78a8('0x3e')],{'$or':_[_0x78a8('0x2d')](_0x1e137c[_0x78a8('0x38')],function(_0x2fb24a){var _0x1d80f9={};_0x1d80f9[_0x2fb24a]={'$like':'%'+_0x50222e[_0x78a8('0x32')][_0x78a8('0x3d')]+'%'};return _0x1d80f9;})});}_0x1e137c=_[_0x78a8('0x3f')]({},_0x1e137c,_0x50222e[_0x78a8('0x41')]);return _0x1fb949[_0x78a8('0x51')](_0x1e137c);}})[_0x78a8('0x29')](function(_0x157057){if(_0x157057){_0x290166=_0x157057[_0x78a8('0x39')];if(!_0x50222e['query'][_0x78a8('0x50')](_0x78a8('0x3a'))){_0x1e137c['limit']=qs[_0x78a8('0x20')](_0x50222e[_0x78a8('0x32')][_0x78a8('0x20')]);_0x1e137c['offset']=qs[_0x78a8('0x1f')](_0x50222e[_0x78a8('0x32')][_0x78a8('0x1f')]);}return _0x1fb949[_0x78a8('0x51')](_0x1e137c);}})[_0x78a8('0x29')](function(_0x1cc6ce){if(_0x1cc6ce){return _0x1cc6ce?{'count':_0x290166,'rows':_0x1cc6ce}:null;}})[_0x78a8('0x29')](respondWithResult(_0x24f271,null))['catch'](handleError(_0x24f271,null));};exports[_0x78a8('0x53')]=function(_0x45ef29,_0x3badcd,_0x71c5fe){var _0x4e5ac0={};var _0x1b89ba={};var _0x3bc41a;var _0x5e5687;return db['FreshsalesConfiguration'][_0x78a8('0x4d')]({'where':{'id':_0x45ef29[_0x78a8('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3badcd,null))['then'](function(_0x4ab289){if(_0x4ab289){_0x3bc41a=_0x4ab289;_0x1b89ba[_0x78a8('0x36')]=_[_0x78a8('0x33')](db['FreshsalesField'][_0x78a8('0x48')]);_0x1b89ba['query']=_[_0x78a8('0x33')](_0x45ef29[_0x78a8('0x32')]);_0x1b89ba[_0x78a8('0x34')]=_[_0x78a8('0x35')](_0x1b89ba[_0x78a8('0x36')],_0x1b89ba[_0x78a8('0x32')]);_0x4e5ac0[_0x78a8('0x38')]=_['intersection'](_0x1b89ba[_0x78a8('0x36')],qs[_0x78a8('0x37')](_0x45ef29[_0x78a8('0x32')]['fields']));_0x4e5ac0['attributes']=_0x4e5ac0[_0x78a8('0x38')][_0x78a8('0x39')]?_0x4e5ac0[_0x78a8('0x38')]:_0x1b89ba[_0x78a8('0x36')];_0x4e5ac0[_0x78a8('0x52')]=qs[_0x78a8('0x3b')](_0x45ef29['query'][_0x78a8('0x3b')]);_0x4e5ac0[_0x78a8('0x3e')]=qs[_0x78a8('0x34')](_[_0x78a8('0x3c')](_0x45ef29[_0x78a8('0x32')],_0x1b89ba[_0x78a8('0x34')]));if(_0x45ef29['query'][_0x78a8('0x3d')]){_0x4e5ac0[_0x78a8('0x3e')]=_[_0x78a8('0x3f')](_0x4e5ac0[_0x78a8('0x3e')],{'$or':_[_0x78a8('0x2d')](_0x4e5ac0[_0x78a8('0x38')],function(_0x1c08d8){var _0x5783c2={};_0x5783c2[_0x1c08d8]={'$like':'%'+_0x45ef29[_0x78a8('0x32')][_0x78a8('0x3d')]+'%'};return _0x5783c2;})});}_0x4e5ac0=_[_0x78a8('0x3f')]({},_0x4e5ac0,_0x45ef29[_0x78a8('0x41')]);return _0x3bc41a[_0x78a8('0x53')](_0x4e5ac0);}})[_0x78a8('0x29')](function(_0x465a7f){if(_0x465a7f){_0x5e5687=_0x465a7f[_0x78a8('0x39')];if(!_0x45ef29[_0x78a8('0x32')][_0x78a8('0x50')](_0x78a8('0x3a'))){_0x4e5ac0[_0x78a8('0x20')]=qs[_0x78a8('0x20')](_0x45ef29[_0x78a8('0x32')]['limit']);_0x4e5ac0[_0x78a8('0x1f')]=qs[_0x78a8('0x1f')](_0x45ef29[_0x78a8('0x32')]['offset']);}return _0x3bc41a[_0x78a8('0x53')](_0x4e5ac0);}})[_0x78a8('0x29')](function(_0x54b051){if(_0x54b051){return _0x54b051?{'count':_0x5e5687,'rows':_0x54b051}:null;}})[_0x78a8('0x29')](respondWithResult(_0x3badcd,null))[_0x78a8('0x46')](handleError(_0x3badcd,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index ece9c2b..217b976 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 _0x71f8=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesConfiguration.attributes','define','int_freshsales_configurations'];(function(_0x4ae4f7,_0x40bb30){var _0x5aeacd=function(_0x4b67f0){while(--_0x4b67f0){_0x4ae4f7['push'](_0x4ae4f7['shift']());}};_0x5aeacd(++_0x40bb30);}(_0x71f8,0x155));var _0x871f=function(_0xc918c4,_0x54b028){_0xc918c4=_0xc918c4-0x0;var _0x1d2b31=_0x71f8[_0xc918c4];return _0x1d2b31;};'use strict';var _=require(_0x871f('0x0'));var util=require(_0x871f('0x1'));var logger=require(_0x871f('0x2'))('api');var moment=require(_0x871f('0x3'));var BPromise=require(_0x871f('0x4'));var rp=require(_0x871f('0x5'));var fs=require('fs');var path=require(_0x871f('0x6'));var rimraf=require('rimraf');var config=require(_0x871f('0x7'));var attributes=require(_0x871f('0x8'));module['exports']=function(_0x583138,_0x33117c){return _0x583138[_0x871f('0x9')]('FreshsalesConfiguration',attributes,{'tableName':_0x871f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x030e=['FreshsalesConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define'];(function(_0x4232d8,_0x13fd09){var _0x324de2=function(_0x167ad5){while(--_0x167ad5){_0x4232d8['push'](_0x4232d8['shift']());}};_0x324de2(++_0x13fd09);}(_0x030e,0xd3));var _0xe030=function(_0x332abb,_0x150393){_0x332abb=_0x332abb-0x0;var _0x42bf0c=_0x030e[_0x332abb];return _0x42bf0c;};'use strict';var _=require(_0xe030('0x0'));var util=require(_0xe030('0x1'));var logger=require(_0xe030('0x2'))(_0xe030('0x3'));var moment=require(_0xe030('0x4'));var BPromise=require(_0xe030('0x5'));var rp=require(_0xe030('0x6'));var fs=require('fs');var path=require(_0xe030('0x7'));var rimraf=require(_0xe030('0x8'));var config=require(_0xe030('0x9'));var attributes=require(_0xe030('0xa'));module[_0xe030('0xb')]=function(_0x20e38a,_0x24c45f){return _0x20e38a[_0xe030('0xc')](_0xe030('0xd'),attributes,{'tableName':'int_freshsales_configurations','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 41117ec..a0826fb 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 _0x38f3=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','message','info'];(function(_0xc975c8,_0xee0abc){var _0x47259f=function(_0x2eccad){while(--_0x2eccad){_0xc975c8['push'](_0xc975c8['shift']());}};_0x47259f(++_0xee0abc);}(_0x38f3,0x1e4));var _0x338f=function(_0x523adf,_0x3e1620){_0x523adf=_0x523adf-0x0;var _0x283870=_0x38f3[_0x523adf];return _0x283870;};'use strict';var _=require(_0x338f('0x0'));var util=require(_0x338f('0x1'));var moment=require(_0x338f('0x2'));var BPromise=require(_0x338f('0x3'));var rs=require(_0x338f('0x4'));var fs=require('fs');var Redis=require(_0x338f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x338f('0x6'));var logger=require(_0x338f('0x7'))(_0x338f('0x8'));var config=require(_0x338f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x338f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x337b92,_0x41c15b,_0x96576){return new BPromise(function(_0x2e897a,_0x3eceaa){return client[_0x338f('0xb')](_0x337b92,_0x96576)[_0x338f('0xc')](function(_0x2718d8){logger['info'](_0x338f('0xd'),_0x41c15b,_0x338f('0xe'));logger[_0x338f('0xf')](_0x338f('0x10'),_0x41c15b,_0x338f('0xe'),JSON['stringify'](_0x2718d8));if(_0x2718d8[_0x338f('0x11')]){if(_0x2718d8[_0x338f('0x11')]['code']===0x1f4){logger[_0x338f('0x11')](_0x338f('0xd'),_0x41c15b,_0x2718d8[_0x338f('0x11')][_0x338f('0x12')]);return _0x3eceaa(_0x2718d8[_0x338f('0x11')][_0x338f('0x12')]);}logger[_0x338f('0x11')](_0x338f('0xd'),_0x41c15b,_0x2718d8[_0x338f('0x11')]['message']);return _0x2e897a(_0x2718d8['error'][_0x338f('0x12')]);}else{logger[_0x338f('0x13')](_0x338f('0xd'),_0x41c15b,_0x338f('0xe'));_0x2e897a(_0x2718d8['result'][_0x338f('0x12')]);}})[_0x338f('0x14')](function(_0x1064af){logger['error'](_0x338f('0xd'),_0x41c15b,_0x1064af);_0x3eceaa(_0x1064af);});});} \ No newline at end of file +var _0x96f7=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x45357a,_0x4097c5){var _0x566c41=function(_0x6d79b9){while(--_0x6d79b9){_0x45357a['push'](_0x45357a['shift']());}};_0x566c41(++_0x4097c5);}(_0x96f7,0x1cf));var _0x796f=function(_0x150a49,_0x47b070){_0x150a49=_0x150a49-0x0;var _0xe8c345=_0x96f7[_0x150a49];return _0xe8c345;};'use strict';var _=require(_0x796f('0x0'));var util=require(_0x796f('0x1'));var moment=require(_0x796f('0x2'));var BPromise=require(_0x796f('0x3'));var rs=require(_0x796f('0x4'));var fs=require('fs');var Redis=require(_0x796f('0x5'));var db=require(_0x796f('0x6'))['db'];var utils=require(_0x796f('0x7'));var logger=require('../../config/logger')(_0x796f('0x8'));var config=require(_0x796f('0x9'));var jayson=require(_0x796f('0xa'));var client=jayson[_0x796f('0xb')][_0x796f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xc9710f,_0x480ac9,_0x335767){return new BPromise(function(_0x34b4b7,_0x2948f4){return client['request'](_0xc9710f,_0x335767)[_0x796f('0xd')](function(_0x37e834){logger['info'](_0x796f('0xe'),_0x480ac9,_0x796f('0xf'));logger['debug'](_0x796f('0x10'),_0x480ac9,_0x796f('0xf'),JSON[_0x796f('0x11')](_0x37e834));if(_0x37e834[_0x796f('0x12')]){if(_0x37e834['error'][_0x796f('0x13')]===0x1f4){logger[_0x796f('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x480ac9,_0x37e834[_0x796f('0x12')][_0x796f('0x14')]);return _0x2948f4(_0x37e834[_0x796f('0x12')][_0x796f('0x14')]);}logger[_0x796f('0x12')](_0x796f('0xe'),_0x480ac9,_0x37e834[_0x796f('0x12')][_0x796f('0x14')]);return _0x34b4b7(_0x37e834[_0x796f('0x12')][_0x796f('0x14')]);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x480ac9,'request\x20sent');_0x34b4b7(_0x37e834[_0x796f('0x15')][_0x796f('0x14')]);}})['catch'](function(_0x4adf63){logger[_0x796f('0x12')](_0x796f('0xe'),_0x480ac9,_0x4adf63);_0x2948f4(_0x4adf63);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 29fa25b..fc4e86c 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 _0xe0b2=['Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x565c4e,_0x1e77f9){var _0x4a167f=function(_0x537269){while(--_0x537269){_0x565c4e['push'](_0x565c4e['shift']());}};_0x4a167f(++_0x1e77f9);}(_0xe0b2,0xec));var _0x2e0b=function(_0x40aa36,_0x4ee29e){_0x40aa36=_0x40aa36-0x0;var _0x55997b=_0xe0b2[_0x40aa36];return _0x55997b;};'use strict';var multer=require('multer');var util=require(_0x2e0b('0x0'));var path=require(_0x2e0b('0x1'));var timeout=require(_0x2e0b('0x2'));var express=require(_0x2e0b('0x3'));var router=express[_0x2e0b('0x4')]();var fs_extra=require(_0x2e0b('0x5'));var auth=require(_0x2e0b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2e0b('0x7'));var controller=require(_0x2e0b('0x8'));router[_0x2e0b('0x9')]('/',auth[_0x2e0b('0xa')](),controller[_0x2e0b('0xb')]);router[_0x2e0b('0x9')]('/:id',auth[_0x2e0b('0xa')](),controller['show']);router[_0x2e0b('0xc')]('/',auth[_0x2e0b('0xa')](),controller[_0x2e0b('0xd')]);router[_0x2e0b('0xe')](_0x2e0b('0xf'),auth[_0x2e0b('0xa')](),controller[_0x2e0b('0x10')]);router[_0x2e0b('0x11')](_0x2e0b('0xf'),auth['isAuthenticated'](),controller[_0x2e0b('0x12')]);module[_0x2e0b('0x13')]=router; \ No newline at end of file +var _0xed95=['post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','/:id','isAuthenticated','show'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xed95,0xb9));var _0x5ed9=function(_0x97ad3f,_0x2c0db4){_0x97ad3f=_0x97ad3f-0x0;var _0x4b2140=_0xed95[_0x97ad3f];return _0x4b2140;};'use strict';var multer=require(_0x5ed9('0x0'));var util=require(_0x5ed9('0x1'));var path=require(_0x5ed9('0x2'));var timeout=require(_0x5ed9('0x3'));var express=require(_0x5ed9('0x4'));var router=express[_0x5ed9('0x5')]();var fs_extra=require(_0x5ed9('0x6'));var auth=require(_0x5ed9('0x7'));var interaction=require(_0x5ed9('0x8'));var config=require(_0x5ed9('0x9'));var controller=require(_0x5ed9('0xa'));router[_0x5ed9('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5ed9('0xb')](_0x5ed9('0xc'),auth[_0x5ed9('0xd')](),controller[_0x5ed9('0xe')]);router[_0x5ed9('0xf')]('/',auth[_0x5ed9('0xd')](),controller['create']);router['put'](_0x5ed9('0xc'),auth[_0x5ed9('0xd')](),controller[_0x5ed9('0x10')]);router[_0x5ed9('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x5ed9('0x12')]);module[_0x5ed9('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 619f515..8ea16f9 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 _0xe7b7=['sequelize','ENUM','string','keyValue','picklist','STRING','customVariable','BOOLEAN'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xe7b7,0x1b0));var _0x7e7b=function(_0x274aba,_0x3f00ca){_0x274aba=_0x274aba-0x0;var _0x26f551=_0xe7b7[_0x274aba];return _0x26f551;};'use strict';var Sequelize=require(_0x7e7b('0x0'));module['exports']={'type':{'type':Sequelize[_0x7e7b('0x1')](_0x7e7b('0x2'),'variable','customVariable',_0x7e7b('0x3'),_0x7e7b('0x4')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x7e7b('0x5')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0x7e7b('0x6'))},'keyContent':{'type':Sequelize[_0x7e7b('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x7e7b('0x5')]},'customField':{'type':Sequelize[_0x7e7b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7e7b('0x5')]}}; \ No newline at end of file +var _0x9e05=['sequelize','exports','string','variable','customVariable','picklist','STRING','BOOLEAN'];(function(_0x1be203,_0x1a7b77){var _0x569029=function(_0x598396){while(--_0x598396){_0x1be203['push'](_0x1be203['shift']());}};_0x569029(++_0x1a7b77);}(_0x9e05,0x170));var _0x59e0=function(_0x4630b1,_0x4b4f0e){_0x4630b1=_0x4630b1-0x0;var _0x128a65=_0x9e05[_0x4630b1];return _0x128a65;};'use strict';var Sequelize=require(_0x59e0('0x0'));module[_0x59e0('0x1')]={'type':{'type':Sequelize['ENUM'](_0x59e0('0x2'),_0x59e0('0x3'),_0x59e0('0x4'),'keyValue',_0x59e0('0x5')),'defaultValue':_0x59e0('0x2')},'content':{'type':Sequelize[_0x59e0('0x6')]},'key':{'type':Sequelize[_0x59e0('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x59e0('0x3'),_0x59e0('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x59e0('0x6')]},'nameField':{'type':Sequelize[_0x59e0('0x6')]},'customField':{'type':Sequelize[_0x59e0('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x59e0('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 38683dd..fb2125b 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 _0x35e0=['body','eml-format','rimraf','fast-json-patch','moment','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x35e0,0x121));var _0x035e=function(_0x3719ec,_0x4638c2){_0x3719ec=_0x3719ec-0x0;var _0x53af3a=_0x35e0[_0x3719ec];return _0x53af3a;};'use strict';var emlformat=require(_0x035e('0x0'));var rimraf=require(_0x035e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x035e('0x2'));var rp=require('request-promise');var moment=require(_0x035e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x035e('0x4'));var sox=require(_0x035e('0x5'));var csv=require(_0x035e('0x6'));var ejs=require(_0x035e('0x7'));var fs=require('fs');var fs_extra=require(_0x035e('0x8'));var _=require('lodash');var squel=require(_0x035e('0x9'));var crypto=require('crypto');var jsforce=require(_0x035e('0xa'));var deskjs=require(_0x035e('0xb'));var toCsv=require(_0x035e('0x6'));var querystring=require(_0x035e('0xc'));var Papa=require(_0x035e('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x035e('0xe'));var as=require(_0x035e('0xf'));var hardwareService=require(_0x035e('0x10'));var logger=require(_0x035e('0x11'))(_0x035e('0x12'));var utils=require(_0x035e('0x13'));var config=require(_0x035e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x035e('0x15'))['db'];function respondWithStatusCode(_0x419649,_0x151b98){_0x151b98=_0x151b98||0xcc;return function(_0x58750a){if(_0x58750a){return _0x419649['sendStatus'](_0x151b98);}return _0x419649[_0x035e('0x16')](_0x151b98)[_0x035e('0x17')]();};}function respondWithResult(_0x496e1f,_0x1e6026){_0x1e6026=_0x1e6026||0xc8;return function(_0x2024de){if(_0x2024de){return _0x496e1f['status'](_0x1e6026)[_0x035e('0x18')](_0x2024de);}};}function respondWithFilteredResult(_0x83fe12,_0x3e9d06){return function(_0x1174ca){if(_0x1174ca){var _0x1b34dd=typeof _0x3e9d06[_0x035e('0x19')]===_0x035e('0x1a')&&typeof _0x3e9d06[_0x035e('0x1b')]==='undefined';var _0x75a34d=_0x1174ca[_0x035e('0x1c')];var _0x4a63b4=_0x1b34dd?0x0:_0x3e9d06['offset'];var _0x118361=_0x1b34dd?_0x1174ca[_0x035e('0x1c')]:_0x3e9d06[_0x035e('0x19')]+_0x3e9d06[_0x035e('0x1b')];var _0x76dc91;if(_0x118361>=_0x75a34d){_0x118361=_0x75a34d;_0x76dc91=0xc8;}else{_0x76dc91=0xce;}_0x83fe12[_0x035e('0x16')](_0x76dc91);return _0x83fe12[_0x035e('0x1d')](_0x035e('0x1e'),_0x4a63b4+'-'+_0x118361+'/'+_0x75a34d)[_0x035e('0x18')](_0x1174ca);}return null;};}function patchUpdates(_0x220f3e){return function(_0x16a783){try{jsonpatch['apply'](_0x16a783,_0x220f3e,!![]);}catch(_0x23ab29){return BPromise[_0x035e('0x1f')](_0x23ab29);}return _0x16a783[_0x035e('0x20')]();};}function saveUpdates(_0x1185b7,_0x4692cb){return function(_0x3d17ae){if(_0x3d17ae){return _0x3d17ae[_0x035e('0x21')](_0x1185b7)[_0x035e('0x22')](function(_0x491e5a){return _0x491e5a;});}return null;};}function removeEntity(_0x30f09e,_0x571488){return function(_0x23f2c0){if(_0x23f2c0){return _0x23f2c0[_0x035e('0x23')]()[_0x035e('0x22')](function(){_0x30f09e[_0x035e('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d6130,_0x4065f6){return function(_0x38a82a){if(!_0x38a82a){_0x2d6130[_0x035e('0x24')](0x194);}return _0x38a82a;};}function handleError(_0x2a8529,_0x548d72){_0x548d72=_0x548d72||0x1f4;return function(_0x444f6d){logger[_0x035e('0x25')](_0x444f6d[_0x035e('0x26')]);if(_0x444f6d['name']){delete _0x444f6d[_0x035e('0x27')];}_0x2a8529[_0x035e('0x16')](_0x548d72)[_0x035e('0x28')](_0x444f6d);};}exports[_0x035e('0x29')]=function(_0x367f73,_0x4fb4e9){var _0x31794d={},_0x34fa1f={},_0x59dc18={'count':0x0,'rows':[]};var _0x4f5784=_[_0x035e('0x2a')](db[_0x035e('0x2b')][_0x035e('0x2c')],function(_0x2cfd1d){return{'name':_0x2cfd1d[_0x035e('0x2d')],'type':_0x2cfd1d[_0x035e('0x2e')]['key']};});_0x34fa1f[_0x035e('0x2f')]=_[_0x035e('0x2a')](_0x4f5784,_0x035e('0x27'));_0x34fa1f['query']=_[_0x035e('0x30')](_0x367f73[_0x035e('0x31')]);_0x34fa1f[_0x035e('0x32')]=_[_0x035e('0x33')](_0x34fa1f[_0x035e('0x2f')],_0x34fa1f['query']);_0x31794d[_0x035e('0x34')]=_[_0x035e('0x33')](_0x34fa1f[_0x035e('0x2f')],qs[_0x035e('0x35')](_0x367f73[_0x035e('0x31')][_0x035e('0x35')]));_0x31794d[_0x035e('0x34')]=_0x31794d[_0x035e('0x34')][_0x035e('0x36')]?_0x31794d['attributes']:_0x34fa1f['model'];if(!_0x367f73[_0x035e('0x31')]['hasOwnProperty']('nolimit')){_0x31794d[_0x035e('0x1b')]=qs[_0x035e('0x1b')](_0x367f73['query']['limit']);_0x31794d['offset']=qs[_0x035e('0x19')](_0x367f73[_0x035e('0x31')][_0x035e('0x19')]);}_0x31794d[_0x035e('0x37')]=qs[_0x035e('0x38')](_0x367f73[_0x035e('0x31')]['sort']);_0x31794d[_0x035e('0x39')]=qs[_0x035e('0x32')](_[_0x035e('0x3a')](_0x367f73[_0x035e('0x31')],_0x34fa1f[_0x035e('0x32')]),_0x4f5784);if(_0x367f73[_0x035e('0x31')][_0x035e('0x3b')]){_0x31794d[_0x035e('0x39')]=_[_0x035e('0x3c')](_0x31794d[_0x035e('0x39')],{'$or':_[_0x035e('0x2a')](_0x4f5784,function(_0x42707a){if(_0x42707a[_0x035e('0x2e')]!==_0x035e('0x3d')){var _0x28be7e={};_0x28be7e[_0x42707a[_0x035e('0x27')]]={'$like':'%'+_0x367f73['query'][_0x035e('0x3b')]+'%'};return _0x28be7e;}})});}_0x31794d=_[_0x035e('0x3c')]({},_0x31794d,_0x367f73[_0x035e('0x3e')]);var _0x2273be={'where':_0x31794d['where']};return db[_0x035e('0x2b')]['count'](_0x2273be)[_0x035e('0x22')](function(_0x5c2571){_0x59dc18['count']=_0x5c2571;if(_0x367f73['query'][_0x035e('0x3f')]){_0x31794d[_0x035e('0x40')]=[{'all':!![]}];}return db['FreshsalesField'][_0x035e('0x41')](_0x31794d);})[_0x035e('0x22')](function(_0x2076f9){_0x59dc18['rows']=_0x2076f9;return _0x59dc18;})[_0x035e('0x22')](respondWithFilteredResult(_0x4fb4e9,_0x31794d))[_0x035e('0x42')](handleError(_0x4fb4e9,null));};exports[_0x035e('0x43')]=function(_0x3c5e75,_0x24fa69){var _0x334758={'raw':!![],'where':{'id':_0x3c5e75[_0x035e('0x44')]['id']}},_0x41baf8={};_0x41baf8[_0x035e('0x2f')]=_[_0x035e('0x30')](db[_0x035e('0x2b')][_0x035e('0x2c')]);_0x41baf8['query']=_[_0x035e('0x30')](_0x3c5e75[_0x035e('0x31')]);_0x41baf8[_0x035e('0x32')]=_[_0x035e('0x33')](_0x41baf8['model'],_0x41baf8[_0x035e('0x31')]);_0x334758[_0x035e('0x34')]=_[_0x035e('0x33')](_0x41baf8['model'],qs[_0x035e('0x35')](_0x3c5e75[_0x035e('0x31')][_0x035e('0x35')]));_0x334758['attributes']=_0x334758['attributes']['length']?_0x334758[_0x035e('0x34')]:_0x41baf8['model'];if(_0x3c5e75[_0x035e('0x31')][_0x035e('0x3f')]){_0x334758['include']=[{'all':!![]}];}_0x334758=_['merge']({},_0x334758,_0x3c5e75[_0x035e('0x3e')]);return db[_0x035e('0x2b')][_0x035e('0x45')](_0x334758)[_0x035e('0x22')](handleEntityNotFound(_0x24fa69,null))[_0x035e('0x22')](respondWithResult(_0x24fa69,null))[_0x035e('0x42')](handleError(_0x24fa69,null));};exports[_0x035e('0x46')]=function(_0x4a98f5,_0xc9aa6a){return db[_0x035e('0x2b')][_0x035e('0x46')](_0x4a98f5[_0x035e('0x47')],{})[_0x035e('0x22')](respondWithResult(_0xc9aa6a,0xc9))[_0x035e('0x42')](handleError(_0xc9aa6a,null));};exports['update']=function(_0x283d68,_0x4fc15f){if(_0x283d68[_0x035e('0x47')]['id']){delete _0x283d68[_0x035e('0x47')]['id'];}return db[_0x035e('0x2b')][_0x035e('0x45')]({'where':{'id':_0x283d68['params']['id']}})['then'](handleEntityNotFound(_0x4fc15f,null))[_0x035e('0x22')](saveUpdates(_0x283d68[_0x035e('0x47')],null))[_0x035e('0x22')](respondWithResult(_0x4fc15f,null))[_0x035e('0x42')](handleError(_0x4fc15f,null));};exports[_0x035e('0x23')]=function(_0x3cea2d,_0x5a80db){return db[_0x035e('0x2b')][_0x035e('0x45')]({'where':{'id':_0x3cea2d[_0x035e('0x44')]['id']}})[_0x035e('0x22')](handleEntityNotFound(_0x5a80db,null))['then'](removeEntity(_0x5a80db,null))['catch'](handleError(_0x5a80db,null));}; \ No newline at end of file +var _0x628b=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','../../components/auth/service'];(function(_0x2113fa,_0x4694a7){var _0x588c4a=function(_0x267f0f){while(--_0x267f0f){_0x2113fa['push'](_0x2113fa['shift']());}};_0x588c4a(++_0x4694a7);}(_0x628b,0x8c));var _0xb628=function(_0x224a72,_0x207894){_0x224a72=_0x224a72-0x0;var _0x2d185a=_0x628b[_0x224a72];return _0x2d185a;};'use strict';var emlformat=require(_0xb628('0x0'));var rimraf=require(_0xb628('0x1'));var zipdir=require(_0xb628('0x2'));var jsonpatch=require(_0xb628('0x3'));var rp=require(_0xb628('0x4'));var moment=require(_0xb628('0x5'));var BPromise=require(_0xb628('0x6'));var Mustache=require(_0xb628('0x7'));var util=require(_0xb628('0x8'));var path=require(_0xb628('0x9'));var sox=require(_0xb628('0xa'));var csv=require(_0xb628('0xb'));var ejs=require(_0xb628('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb628('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb628('0xe'));var deskjs=require(_0xb628('0xf'));var toCsv=require(_0xb628('0xb'));var querystring=require(_0xb628('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb628('0x11'));var qs=require(_0xb628('0x12'));var as=require(_0xb628('0x13'));var hardwareService=require(_0xb628('0x14'));var logger=require(_0xb628('0x15'))(_0xb628('0x16'));var utils=require(_0xb628('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a337f,_0x43a886){_0x43a886=_0x43a886||0xcc;return function(_0x40161e){if(_0x40161e){return _0x2a337f[_0xb628('0x18')](_0x43a886);}return _0x2a337f[_0xb628('0x19')](_0x43a886)[_0xb628('0x1a')]();};}function respondWithResult(_0x4161b1,_0x1e8837){_0x1e8837=_0x1e8837||0xc8;return function(_0x15bac5){if(_0x15bac5){return _0x4161b1[_0xb628('0x19')](_0x1e8837)['json'](_0x15bac5);}};}function respondWithFilteredResult(_0x12c6ac,_0x4b4903){return function(_0x2d9746){if(_0x2d9746){var _0x56bf6a=typeof _0x4b4903['offset']===_0xb628('0x1b')&&typeof _0x4b4903[_0xb628('0x1c')]===_0xb628('0x1b');var _0x3455c1=_0x2d9746[_0xb628('0x1d')];var _0x3f0c98=_0x56bf6a?0x0:_0x4b4903[_0xb628('0x1e')];var _0x591092=_0x56bf6a?_0x2d9746['count']:_0x4b4903[_0xb628('0x1e')]+_0x4b4903['limit'];var _0xef16f9;if(_0x591092>=_0x3455c1){_0x591092=_0x3455c1;_0xef16f9=0xc8;}else{_0xef16f9=0xce;}_0x12c6ac[_0xb628('0x19')](_0xef16f9);return _0x12c6ac[_0xb628('0x1f')](_0xb628('0x20'),_0x3f0c98+'-'+_0x591092+'/'+_0x3455c1)[_0xb628('0x21')](_0x2d9746);}return null;};}function patchUpdates(_0x376878){return function(_0x1ce5ae){try{jsonpatch[_0xb628('0x22')](_0x1ce5ae,_0x376878,!![]);}catch(_0x468fd5){return BPromise[_0xb628('0x23')](_0x468fd5);}return _0x1ce5ae[_0xb628('0x24')]();};}function saveUpdates(_0x902e59,_0x1b7c6f){return function(_0x2c144f){if(_0x2c144f){return _0x2c144f['update'](_0x902e59)[_0xb628('0x25')](function(_0x3a5bb0){return _0x3a5bb0;});}return null;};}function removeEntity(_0x51e37a,_0x4f76b8){return function(_0x17f401){if(_0x17f401){return _0x17f401[_0xb628('0x26')]()['then'](function(){_0x51e37a['status'](0xcc)[_0xb628('0x1a')]();});}};}function handleEntityNotFound(_0x22341d,_0x32f7b9){return function(_0x44737e){if(!_0x44737e){_0x22341d['sendStatus'](0x194);}return _0x44737e;};}function handleError(_0x5629ed,_0x265504){_0x265504=_0x265504||0x1f4;return function(_0x2560ce){logger[_0xb628('0x27')](_0x2560ce[_0xb628('0x28')]);if(_0x2560ce[_0xb628('0x29')]){delete _0x2560ce[_0xb628('0x29')];}_0x5629ed[_0xb628('0x19')](_0x265504)[_0xb628('0x2a')](_0x2560ce);};}exports[_0xb628('0x2b')]=function(_0xf9a449,_0x495d8e){var _0x5822f2={},_0x25117f={},_0x484253={'count':0x0,'rows':[]};var _0x2cdfee=_[_0xb628('0x2c')](db[_0xb628('0x2d')][_0xb628('0x2e')],function(_0x208232){return{'name':_0x208232[_0xb628('0x2f')],'type':_0x208232[_0xb628('0x30')][_0xb628('0x31')]};});_0x25117f[_0xb628('0x32')]=_['map'](_0x2cdfee,_0xb628('0x29'));_0x25117f[_0xb628('0x33')]=_[_0xb628('0x34')](_0xf9a449[_0xb628('0x33')]);_0x25117f[_0xb628('0x35')]=_[_0xb628('0x36')](_0x25117f[_0xb628('0x32')],_0x25117f[_0xb628('0x33')]);_0x5822f2['attributes']=_[_0xb628('0x36')](_0x25117f[_0xb628('0x32')],qs[_0xb628('0x37')](_0xf9a449['query'][_0xb628('0x37')]));_0x5822f2[_0xb628('0x38')]=_0x5822f2[_0xb628('0x38')]['length']?_0x5822f2['attributes']:_0x25117f[_0xb628('0x32')];if(!_0xf9a449['query'][_0xb628('0x39')](_0xb628('0x3a'))){_0x5822f2[_0xb628('0x1c')]=qs[_0xb628('0x1c')](_0xf9a449[_0xb628('0x33')]['limit']);_0x5822f2[_0xb628('0x1e')]=qs[_0xb628('0x1e')](_0xf9a449['query']['offset']);}_0x5822f2[_0xb628('0x3b')]=qs[_0xb628('0x3c')](_0xf9a449[_0xb628('0x33')][_0xb628('0x3c')]);_0x5822f2[_0xb628('0x3d')]=qs['filters'](_[_0xb628('0x3e')](_0xf9a449[_0xb628('0x33')],_0x25117f[_0xb628('0x35')]),_0x2cdfee);if(_0xf9a449[_0xb628('0x33')][_0xb628('0x3f')]){_0x5822f2['where']=_[_0xb628('0x40')](_0x5822f2[_0xb628('0x3d')],{'$or':_[_0xb628('0x2c')](_0x2cdfee,function(_0x2efc33){if(_0x2efc33['type']!==_0xb628('0x41')){var _0x313c74={};_0x313c74[_0x2efc33[_0xb628('0x29')]]={'$like':'%'+_0xf9a449[_0xb628('0x33')][_0xb628('0x3f')]+'%'};return _0x313c74;}})});}_0x5822f2=_[_0xb628('0x40')]({},_0x5822f2,_0xf9a449[_0xb628('0x42')]);var _0xb3094b={'where':_0x5822f2[_0xb628('0x3d')]};return db[_0xb628('0x2d')][_0xb628('0x1d')](_0xb3094b)[_0xb628('0x25')](function(_0x1f2a85){_0x484253[_0xb628('0x1d')]=_0x1f2a85;if(_0xf9a449[_0xb628('0x33')][_0xb628('0x43')]){_0x5822f2[_0xb628('0x44')]=[{'all':!![]}];}return db[_0xb628('0x2d')][_0xb628('0x45')](_0x5822f2);})[_0xb628('0x25')](function(_0x5a9a4c){_0x484253[_0xb628('0x46')]=_0x5a9a4c;return _0x484253;})[_0xb628('0x25')](respondWithFilteredResult(_0x495d8e,_0x5822f2))['catch'](handleError(_0x495d8e,null));};exports[_0xb628('0x47')]=function(_0x45d872,_0x3da5fc){var _0x5c414d={'raw':!![],'where':{'id':_0x45d872[_0xb628('0x48')]['id']}},_0xc68f84={};_0xc68f84[_0xb628('0x32')]=_[_0xb628('0x34')](db[_0xb628('0x2d')][_0xb628('0x2e')]);_0xc68f84[_0xb628('0x33')]=_[_0xb628('0x34')](_0x45d872[_0xb628('0x33')]);_0xc68f84[_0xb628('0x35')]=_[_0xb628('0x36')](_0xc68f84[_0xb628('0x32')],_0xc68f84[_0xb628('0x33')]);_0x5c414d[_0xb628('0x38')]=_[_0xb628('0x36')](_0xc68f84[_0xb628('0x32')],qs[_0xb628('0x37')](_0x45d872[_0xb628('0x33')][_0xb628('0x37')]));_0x5c414d[_0xb628('0x38')]=_0x5c414d[_0xb628('0x38')][_0xb628('0x49')]?_0x5c414d[_0xb628('0x38')]:_0xc68f84[_0xb628('0x32')];if(_0x45d872[_0xb628('0x33')][_0xb628('0x43')]){_0x5c414d[_0xb628('0x44')]=[{'all':!![]}];}_0x5c414d=_['merge']({},_0x5c414d,_0x45d872['options']);return db[_0xb628('0x2d')][_0xb628('0x4a')](_0x5c414d)['then'](handleEntityNotFound(_0x3da5fc,null))[_0xb628('0x25')](respondWithResult(_0x3da5fc,null))[_0xb628('0x4b')](handleError(_0x3da5fc,null));};exports[_0xb628('0x4c')]=function(_0x56e96f,_0x3b3c65){return db[_0xb628('0x2d')]['create'](_0x56e96f[_0xb628('0x4d')],{})[_0xb628('0x25')](respondWithResult(_0x3b3c65,0xc9))['catch'](handleError(_0x3b3c65,null));};exports[_0xb628('0x4e')]=function(_0x36c42b,_0x390428){if(_0x36c42b[_0xb628('0x4d')]['id']){delete _0x36c42b[_0xb628('0x4d')]['id'];}return db[_0xb628('0x2d')][_0xb628('0x4a')]({'where':{'id':_0x36c42b[_0xb628('0x48')]['id']}})[_0xb628('0x25')](handleEntityNotFound(_0x390428,null))[_0xb628('0x25')](saveUpdates(_0x36c42b[_0xb628('0x4d')],null))[_0xb628('0x25')](respondWithResult(_0x390428,null))[_0xb628('0x4b')](handleError(_0x390428,null));};exports['destroy']=function(_0x735839,_0x44e0cc){return db['FreshsalesField'][_0xb628('0x4a')]({'where':{'id':_0x735839['params']['id']}})[_0xb628('0x25')](handleEntityNotFound(_0x44e0cc,null))[_0xb628('0x25')](removeEntity(_0x44e0cc,null))['catch'](handleError(_0x44e0cc,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index aa43918..ef5baa5 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 _0x13eb=['lodash','util','api','moment','request-promise','path','rimraf','exports','define','FreshsalesField','int_freshsales_fields','idField','FieldId'];(function(_0x5ac7f6,_0x10b1df){var _0x502beb=function(_0x5dbc85){while(--_0x5dbc85){_0x5ac7f6['push'](_0x5ac7f6['shift']());}};_0x502beb(++_0x10b1df);}(_0x13eb,0x8f));var _0xb13e=function(_0x3aa5cf,_0x4879b3){_0x3aa5cf=_0x3aa5cf-0x0;var _0x22854a=_0x13eb[_0x3aa5cf];return _0x22854a;};'use strict';var _=require(_0xb13e('0x0'));var util=require(_0xb13e('0x1'));var logger=require('../../config/logger')(_0xb13e('0x2'));var moment=require(_0xb13e('0x3'));var BPromise=require('bluebird');var rp=require(_0xb13e('0x4'));var fs=require('fs');var path=require(_0xb13e('0x5'));var rimraf=require(_0xb13e('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshsalesField.attributes');module[_0xb13e('0x7')]=function(_0xaadc20,_0x382048){return _0xaadc20[_0xb13e('0x8')](_0xb13e('0x9'),attributes,{'tableName':_0xb13e('0xa'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xb13e('0xb'),_0xb13e('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe61a=['freshsales_unique_index','FieldId','lodash','util','api','bluebird','request-promise','path','../../config/environment','./intFreshsalesField.attributes','define','FreshsalesField','int_freshsales_fields'];(function(_0x3f99a8,_0x160bf7){var _0x25c907=function(_0x4f5dd0){while(--_0x4f5dd0){_0x3f99a8['push'](_0x3f99a8['shift']());}};_0x25c907(++_0x160bf7);}(_0xe61a,0x120));var _0xae61=function(_0x450dcd,_0x54236f){_0x450dcd=_0x450dcd-0x0;var _0x3d6cec=_0xe61a[_0x450dcd];return _0x3d6cec;};'use strict';var _=require(_0xae61('0x0'));var util=require(_0xae61('0x1'));var logger=require('../../config/logger')(_0xae61('0x2'));var moment=require('moment');var BPromise=require(_0xae61('0x3'));var rp=require(_0xae61('0x4'));var fs=require('fs');var path=require(_0xae61('0x5'));var rimraf=require('rimraf');var config=require(_0xae61('0x6'));var attributes=require(_0xae61('0x7'));module['exports']=function(_0x4e92f8,_0xb9dcc8){return _0x4e92f8[_0xae61('0x8')](_0xae61('0x9'),attributes,{'tableName':_0xae61('0xa'),'paranoid':![],'indexes':[{'name':_0xae61('0xb'),'fields':['idField',_0xae61('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 1f1702f..88c7e04 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 _0x5d58=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0xf077cb,_0x11cfa6){var _0x5549d9=function(_0x131d90){while(--_0x131d90){_0xf077cb['push'](_0xf077cb['shift']());}};_0x5549d9(++_0x11cfa6);}(_0x5d58,0x187));var _0x85d5=function(_0x30dc89,_0x3b065c){_0x30dc89=_0x30dc89-0x0;var _0xc3e4ff=_0x5d58[_0x30dc89];return _0xc3e4ff;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x85d5('0x0'));var db=require(_0x85d5('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x85d5('0x2'))(_0x85d5('0x3'));var config=require('../../config/environment');var jayson=require(_0x85d5('0x4'));var client=jayson[_0x85d5('0x5')][_0x85d5('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x46e7b4,_0x5f47ec,_0x98c963){return new BPromise(function(_0x3fecca,_0x4ca293){return client[_0x85d5('0x7')](_0x46e7b4,_0x98c963)['then'](function(_0x1098be){logger[_0x85d5('0x8')](_0x85d5('0x9'),_0x5f47ec,'request\x20sent');logger['debug']('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x5f47ec,_0x85d5('0xa'),JSON[_0x85d5('0xb')](_0x1098be));if(_0x1098be[_0x85d5('0xc')]){if(_0x1098be[_0x85d5('0xc')][_0x85d5('0xd')]===0x1f4){logger[_0x85d5('0xc')](_0x85d5('0x9'),_0x5f47ec,_0x1098be['error']['message']);return _0x4ca293(_0x1098be['error'][_0x85d5('0xe')]);}logger[_0x85d5('0xc')](_0x85d5('0x9'),_0x5f47ec,_0x1098be[_0x85d5('0xc')][_0x85d5('0xe')]);return _0x3fecca(_0x1098be[_0x85d5('0xc')][_0x85d5('0xe')]);}else{logger['info'](_0x85d5('0x9'),_0x5f47ec,_0x85d5('0xa'));_0x3fecca(_0x1098be[_0x85d5('0xf')][_0x85d5('0xe')]);}})[_0x85d5('0x10')](function(_0x3dc83c){logger[_0x85d5('0xc')](_0x85d5('0x9'),_0x5f47ec,_0x3dc83c);_0x4ca293(_0x3dc83c);});});} \ No newline at end of file +var _0x4c60=['client','http','request','then','debug','request\x20sent','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/environment','jayson/promise'];(function(_0x205461,_0x27aa8b){var _0x17de41=function(_0x4f6f4f){while(--_0x4f6f4f){_0x205461['push'](_0x205461['shift']());}};_0x17de41(++_0x27aa8b);}(_0x4c60,0xc1));var _0x04c6=function(_0x3bfd51,_0x3b689f){_0x3bfd51=_0x3bfd51-0x0;var _0x6a85f5=_0x4c60[_0x3bfd51];return _0x6a85f5;};'use strict';var _=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var moment=require(_0x04c6('0x2'));var BPromise=require(_0x04c6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x04c6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x04c6('0x5'));var jayson=require(_0x04c6('0x6'));var client=jayson[_0x04c6('0x7')][_0x04c6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b9041,_0x39be2d,_0x8f9b13){return new BPromise(function(_0x530a48,_0x2a4b51){return client[_0x04c6('0x9')](_0x2b9041,_0x8f9b13)[_0x04c6('0xa')](function(_0x30b901){logger['info']('FreshsalesField,\x20%s,\x20%s',_0x39be2d,'request\x20sent');logger[_0x04c6('0xb')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x39be2d,_0x04c6('0xc'),JSON[_0x04c6('0xd')](_0x30b901));if(_0x30b901['error']){if(_0x30b901[_0x04c6('0xe')][_0x04c6('0xf')]===0x1f4){logger[_0x04c6('0xe')](_0x04c6('0x10'),_0x39be2d,_0x30b901['error'][_0x04c6('0x11')]);return _0x2a4b51(_0x30b901[_0x04c6('0xe')][_0x04c6('0x11')]);}logger['error'](_0x04c6('0x10'),_0x39be2d,_0x30b901[_0x04c6('0xe')][_0x04c6('0x11')]);return _0x530a48(_0x30b901[_0x04c6('0xe')][_0x04c6('0x11')]);}else{logger[_0x04c6('0x12')](_0x04c6('0x10'),_0x39be2d,_0x04c6('0xc'));_0x530a48(_0x30b901['result'][_0x04c6('0x11')]);}})[_0x04c6('0x13')](function(_0x382e58){logger[_0x04c6('0xe')](_0x04c6('0x10'),_0x39be2d,_0x382e58);_0x2a4b51(_0x382e58);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 9444079..8033cb5 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x2779f1,_0x615476){var _0x1b9d92=function(_0x398788){while(--_0x398788){_0x2779f1['push'](_0x2779f1['shift']());}};_0x1b9d92(++_0x615476);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x4edb5b,_0x2e32f4){var _0x86407=function(_0x17be7b){while(--_0x17be7b){_0x4edb5b['push'](_0x4edb5b['shift']());}};_0x86407(++_0x2e32f4);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 2831fbd..e7cd694 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 _0xa8f3=['username','ENUM','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x4cc3c9,_0xb82262){var _0x3d76d4=function(_0x834b7a){while(--_0x834b7a){_0x4cc3c9['push'](_0x4cc3c9['shift']());}};_0x3d76d4(++_0xb82262);}(_0xa8f3,0xc1));var _0x3a8f=function(_0x1b5512,_0x5309ab){_0x1b5512=_0x1b5512-0x0;var _0x1d121a=_0xa8f3[_0x1b5512];return _0x1d121a;};'use strict';var Sequelize=require(_0x3a8f('0x0'));module[_0x3a8f('0x1')]={'name':{'type':Sequelize[_0x3a8f('0x2')]},'description':{'type':Sequelize[_0x3a8f('0x2')]},'username':{'type':Sequelize[_0x3a8f('0x2')],'unique':_0x3a8f('0x3')},'remoteUri':{'type':Sequelize[_0x3a8f('0x2')]},'password':{'type':Sequelize[_0x3a8f('0x2')]},'clientId':{'type':Sequelize[_0x3a8f('0x2')]},'clientSecret':{'type':Sequelize[_0x3a8f('0x2')]},'securityToken':{'type':Sequelize[_0x3a8f('0x2')]},'serverUrl':{'type':Sequelize[_0x3a8f('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3a8f('0x4')](_0x3a8f('0x5'),_0x3a8f('0x6')),'defaultValue':_0x3a8f('0x5')}}; \ No newline at end of file +var _0xebc0=['exports','STRING','username','integrationTab','sequelize'];(function(_0x133cb7,_0x1d4b28){var _0x5798e8=function(_0x52e79d){while(--_0x52e79d){_0x133cb7['push'](_0x133cb7['shift']());}};_0x5798e8(++_0x1d4b28);}(_0xebc0,0xe5));var _0x0ebc=function(_0x5b170b,_0x153f7e){_0x5b170b=_0x5b170b-0x0;var _0x59ab54=_0xebc0[_0x5b170b];return _0x59ab54;};'use strict';var Sequelize=require(_0x0ebc('0x0'));module[_0x0ebc('0x1')]={'name':{'type':Sequelize[_0x0ebc('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x0ebc('0x2')],'unique':_0x0ebc('0x3')},'remoteUri':{'type':Sequelize[_0x0ebc('0x2')]},'password':{'type':Sequelize[_0x0ebc('0x2')]},'clientId':{'type':Sequelize[_0x0ebc('0x2')]},'clientSecret':{'type':Sequelize[_0x0ebc('0x2')]},'securityToken':{'type':Sequelize[_0x0ebc('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0ebc('0x4'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index ad2df1e..e5f4a51 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 _0x230d=['picklistValues','value','True','true','False','false','test','getFields','stringify','send','statusCode','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','index','map','SalesforceAccount','fieldName','type','query','keys','intersection','model','attributes','fields','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','params','rawAttributes','length','find','create','body','getConfigurations','findOne','SalesforceConfiguration','pick','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','Task','remoteUri','clientId','username','password','securityToken','substring','lastIndexOf','Connection','clientSecret','login','concat','isNil','ticketType','sobject','describe','OwnerId','IsRecurrence','Description','string','int','picklist','boolean','email','textarea','remove','includes','label','custom'];(function(_0x3bb9e3,_0x1fb1c4){var _0x381aa0=function(_0xb56b49){while(--_0xb56b49){_0x3bb9e3['push'](_0x3bb9e3['shift']());}};_0x381aa0(++_0x1fb1c4);}(_0x230d,0x83));var _0xd230=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x230d[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd230('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd230('0x1'));var moment=require('moment');var BPromise=require(_0xd230('0x2'));var Mustache=require('mustache');var util=require(_0xd230('0x3'));var path=require(_0xd230('0x4'));var sox=require(_0xd230('0x5'));var csv=require(_0xd230('0x6'));var ejs=require(_0xd230('0x7'));var fs=require('fs');var fs_extra=require(_0xd230('0x8'));var _=require(_0xd230('0x9'));var squel=require(_0xd230('0xa'));var crypto=require(_0xd230('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd230('0xc'));var Papa=require(_0xd230('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd230('0xe'));var as=require(_0xd230('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd230('0x10'))('api');var utils=require(_0xd230('0x11'));var config=require(_0xd230('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xd230('0x13'))['db'];var integrations=require(_0xd230('0x14'));function respondWithStatusCode(_0x514ec3,_0xcb22c7){_0xcb22c7=_0xcb22c7||0xcc;return function(_0x424c37){if(_0x424c37){return _0x514ec3[_0xd230('0x15')](_0xcb22c7);}return _0x514ec3[_0xd230('0x16')](_0xcb22c7)[_0xd230('0x17')]();};}function respondWithResult(_0x1efac6,_0x2e147c){_0x2e147c=_0x2e147c||0xc8;return function(_0x4d4094){if(_0x4d4094){return _0x1efac6[_0xd230('0x16')](_0x2e147c)['json'](_0x4d4094);}};}function respondWithFilteredResult(_0x294f53,_0x1709d8){return function(_0x5776c0){if(_0x5776c0){var _0x135ca3=typeof _0x1709d8[_0xd230('0x18')]===_0xd230('0x19')&&typeof _0x1709d8[_0xd230('0x1a')]===_0xd230('0x19');var _0x1808f3=_0x5776c0[_0xd230('0x1b')];var _0x27d2ee=_0x135ca3?0x0:_0x1709d8[_0xd230('0x18')];var _0x2996c7=_0x135ca3?_0x5776c0[_0xd230('0x1b')]:_0x1709d8[_0xd230('0x18')]+_0x1709d8['limit'];var _0x31cbd4;if(_0x2996c7>=_0x1808f3){_0x2996c7=_0x1808f3;_0x31cbd4=0xc8;}else{_0x31cbd4=0xce;}_0x294f53[_0xd230('0x16')](_0x31cbd4);return _0x294f53[_0xd230('0x1c')](_0xd230('0x1d'),_0x27d2ee+'-'+_0x2996c7+'/'+_0x1808f3)[_0xd230('0x1e')](_0x5776c0);}return null;};}function patchUpdates(_0x3a2595){return function(_0x398b98){try{jsonpatch['apply'](_0x398b98,_0x3a2595,!![]);}catch(_0x22f915){return BPromise[_0xd230('0x1f')](_0x22f915);}return _0x398b98[_0xd230('0x20')]();};}function saveUpdates(_0x1d61c1,_0x54ed8c){return function(_0x531ef1){if(_0x531ef1){return _0x531ef1[_0xd230('0x21')](_0x1d61c1)[_0xd230('0x22')](function(_0x858754){return _0x858754;});}return null;};}function removeEntity(_0x369023,_0x5026b2){return function(_0x14eeb7){if(_0x14eeb7){return _0x14eeb7[_0xd230('0x23')]()[_0xd230('0x22')](function(){_0x369023[_0xd230('0x16')](0xcc)[_0xd230('0x17')]();});}};}function handleEntityNotFound(_0x309168,_0x190aa5){return function(_0x310430){if(!_0x310430){_0x309168[_0xd230('0x15')](0x194);}return _0x310430;};}function handleError(_0x2a75ab,_0x1a408f){_0x1a408f=_0x1a408f||0x1f4;return function(_0x3251c1){logger[_0xd230('0x24')](_0x3251c1[_0xd230('0x25')]);if(_0x3251c1[_0xd230('0x26')]){delete _0x3251c1[_0xd230('0x26')];}_0x2a75ab[_0xd230('0x16')](_0x1a408f)['send'](_0x3251c1);};}exports[_0xd230('0x27')]=function(_0x457a75,_0x127b71){var _0x388bb5={},_0x54744e={},_0x5ea980={'count':0x0,'rows':[]};var _0xc4d9cb=_[_0xd230('0x28')](db[_0xd230('0x29')]['rawAttributes'],function(_0x4ce702){return{'name':_0x4ce702[_0xd230('0x2a')],'type':_0x4ce702[_0xd230('0x2b')]['key']};});_0x54744e['model']=_[_0xd230('0x28')](_0xc4d9cb,'name');_0x54744e[_0xd230('0x2c')]=_[_0xd230('0x2d')](_0x457a75['query']);_0x54744e['filters']=_[_0xd230('0x2e')](_0x54744e[_0xd230('0x2f')],_0x54744e['query']);_0x388bb5[_0xd230('0x30')]=_[_0xd230('0x2e')](_0x54744e[_0xd230('0x2f')],qs[_0xd230('0x31')](_0x457a75[_0xd230('0x2c')][_0xd230('0x31')]));_0x388bb5[_0xd230('0x30')]=_0x388bb5[_0xd230('0x30')]['length']?_0x388bb5[_0xd230('0x30')]:_0x54744e[_0xd230('0x2f')];if(!_0x457a75[_0xd230('0x2c')]['hasOwnProperty']('nolimit')){_0x388bb5[_0xd230('0x1a')]=qs[_0xd230('0x1a')](_0x457a75[_0xd230('0x2c')][_0xd230('0x1a')]);_0x388bb5[_0xd230('0x18')]=qs[_0xd230('0x18')](_0x457a75[_0xd230('0x2c')][_0xd230('0x18')]);}_0x388bb5[_0xd230('0x32')]=qs[_0xd230('0x33')](_0x457a75[_0xd230('0x2c')]['sort']);_0x388bb5['where']=qs[_0xd230('0x34')](_['pick'](_0x457a75[_0xd230('0x2c')],_0x54744e['filters']),_0xc4d9cb);if(_0x457a75[_0xd230('0x2c')][_0xd230('0x35')]){_0x388bb5[_0xd230('0x36')]=_['merge'](_0x388bb5[_0xd230('0x36')],{'$or':_[_0xd230('0x28')](_0xc4d9cb,function(_0x9b8108){if(_0x9b8108['type']!==_0xd230('0x37')){var _0x3801f7={};_0x3801f7[_0x9b8108['name']]={'$like':'%'+_0x457a75[_0xd230('0x2c')][_0xd230('0x35')]+'%'};return _0x3801f7;}})});}_0x388bb5=_[_0xd230('0x38')]({},_0x388bb5,_0x457a75[_0xd230('0x39')]);var _0x4f8d83={'where':_0x388bb5['where']};return db[_0xd230('0x29')]['count'](_0x4f8d83)['then'](function(_0xb18cf1){_0x5ea980['count']=_0xb18cf1;if(_0x457a75['query'][_0xd230('0x3a')]){_0x388bb5[_0xd230('0x3b')]=[{'all':!![]}];}return db[_0xd230('0x29')]['findAll'](_0x388bb5);})[_0xd230('0x22')](function(_0x33bb03){_0x5ea980[_0xd230('0x3c')]=_0x33bb03;return _0x5ea980;})[_0xd230('0x22')](respondWithFilteredResult(_0x127b71,_0x388bb5))[_0xd230('0x3d')](handleError(_0x127b71,null));};exports['show']=function(_0x58ce6d,_0x688703){var _0x3dff3d={'raw':![],'where':{'id':_0x58ce6d[_0xd230('0x3e')]['id']}},_0x34fe04={};_0x34fe04[_0xd230('0x2f')]=_[_0xd230('0x2d')](db[_0xd230('0x29')][_0xd230('0x3f')]);_0x34fe04['query']=_[_0xd230('0x2d')](_0x58ce6d[_0xd230('0x2c')]);_0x34fe04['filters']=_[_0xd230('0x2e')](_0x34fe04[_0xd230('0x2f')],_0x34fe04[_0xd230('0x2c')]);_0x3dff3d[_0xd230('0x30')]=_[_0xd230('0x2e')](_0x34fe04[_0xd230('0x2f')],qs[_0xd230('0x31')](_0x58ce6d[_0xd230('0x2c')][_0xd230('0x31')]));_0x3dff3d['attributes']=_0x3dff3d[_0xd230('0x30')][_0xd230('0x40')]?_0x3dff3d[_0xd230('0x30')]:_0x34fe04[_0xd230('0x2f')];if(_0x58ce6d['query']['includeAll']){_0x3dff3d['include']=[{'all':!![]}];}_0x3dff3d=_[_0xd230('0x38')]({},_0x3dff3d,_0x58ce6d[_0xd230('0x39')]);return db[_0xd230('0x29')][_0xd230('0x41')](_0x3dff3d)[_0xd230('0x22')](handleEntityNotFound(_0x688703,null))[_0xd230('0x22')](respondWithResult(_0x688703,null))[_0xd230('0x3d')](handleError(_0x688703,null));};exports[_0xd230('0x42')]=function(_0x18dbb1,_0x423c88){return db[_0xd230('0x29')][_0xd230('0x42')](_0x18dbb1[_0xd230('0x43')],{})['then'](respondWithResult(_0x423c88,0xc9))[_0xd230('0x3d')](handleError(_0x423c88,null));};exports[_0xd230('0x21')]=function(_0x437c24,_0x76a69c){if(_0x437c24[_0xd230('0x43')]['id']){delete _0x437c24[_0xd230('0x43')]['id'];}return db[_0xd230('0x29')][_0xd230('0x41')]({'where':{'id':_0x437c24[_0xd230('0x3e')]['id']}})['then'](handleEntityNotFound(_0x76a69c,null))[_0xd230('0x22')](saveUpdates(_0x437c24[_0xd230('0x43')],null))['then'](respondWithResult(_0x76a69c,null))[_0xd230('0x3d')](handleError(_0x76a69c,null));};exports['destroy']=function(_0x2842d9,_0x4feaba){return db['SalesforceAccount'][_0xd230('0x41')]({'where':{'id':_0x2842d9[_0xd230('0x3e')]['id']}})[_0xd230('0x22')](handleEntityNotFound(_0x4feaba,null))[_0xd230('0x22')](removeEntity(_0x4feaba,null))[_0xd230('0x3d')](handleError(_0x4feaba,null));};exports[_0xd230('0x44')]=function(_0x314d11,_0xc8b910,_0x1cb4b9){var _0x21b5e9={};var _0x17eb7b={};var _0x46fc40;var _0x1a23a4;return db[_0xd230('0x29')][_0xd230('0x45')]({'where':{'id':_0x314d11[_0xd230('0x3e')]['id']}})[_0xd230('0x22')](handleEntityNotFound(_0xc8b910,null))[_0xd230('0x22')](function(_0x223340){if(_0x223340){_0x46fc40=_0x223340;_0x17eb7b['model']=_[_0xd230('0x2d')](db[_0xd230('0x46')][_0xd230('0x3f')]);_0x17eb7b[_0xd230('0x2c')]=_['keys'](_0x314d11[_0xd230('0x2c')]);_0x17eb7b[_0xd230('0x34')]=_[_0xd230('0x2e')](_0x17eb7b[_0xd230('0x2f')],_0x17eb7b[_0xd230('0x2c')]);_0x21b5e9['attributes']=_[_0xd230('0x2e')](_0x17eb7b[_0xd230('0x2f')],qs[_0xd230('0x31')](_0x314d11['query'][_0xd230('0x31')]));_0x21b5e9[_0xd230('0x30')]=_0x21b5e9['attributes'][_0xd230('0x40')]?_0x21b5e9[_0xd230('0x30')]:_0x17eb7b[_0xd230('0x2f')];_0x21b5e9[_0xd230('0x32')]=qs['sort'](_0x314d11[_0xd230('0x2c')][_0xd230('0x33')]);_0x21b5e9[_0xd230('0x36')]=qs['filters'](_[_0xd230('0x47')](_0x314d11[_0xd230('0x2c')],_0x17eb7b[_0xd230('0x34')]));if(_0x314d11['query']['filter']){_0x21b5e9['where']=_[_0xd230('0x38')](_0x21b5e9[_0xd230('0x36')],{'$or':_[_0xd230('0x28')](_0x21b5e9['attributes'],function(_0xb584d2){var _0x59ae25={};_0x59ae25[_0xb584d2]={'$like':'%'+_0x314d11['query']['filter']+'%'};return _0x59ae25;})});}_0x21b5e9=_[_0xd230('0x38')]({},_0x21b5e9,_0x314d11[_0xd230('0x39')]);return _0x46fc40[_0xd230('0x44')](_0x21b5e9);}})[_0xd230('0x22')](function(_0x9a5eb1){if(_0x9a5eb1){_0x1a23a4=_0x9a5eb1[_0xd230('0x40')];if(!_0x314d11[_0xd230('0x2c')]['hasOwnProperty'](_0xd230('0x48'))){_0x21b5e9[_0xd230('0x1a')]=qs[_0xd230('0x1a')](_0x314d11[_0xd230('0x2c')]['limit']);_0x21b5e9['offset']=qs[_0xd230('0x18')](_0x314d11['query']['offset']);}return _0x46fc40[_0xd230('0x44')](_0x21b5e9);}})[_0xd230('0x22')](function(_0x129959){if(_0x129959){return _0x129959?{'count':_0x1a23a4,'rows':_0x129959}:null;}})['then'](respondWithResult(_0xc8b910,null))[_0xd230('0x3d')](handleError(_0xc8b910,null));};exports[_0xd230('0x49')]=function(_0x4faba7,_0x5a1462,_0x5cb977){if(_0x4faba7[_0xd230('0x43')]['id']){delete _0x4faba7[_0xd230('0x43')]['id'];}return db[_0xd230('0x29')][_0xd230('0x45')]({'where':{'id':_0x4faba7[_0xd230('0x3e')]['id']}})[_0xd230('0x22')](handleEntityNotFound(_0x5a1462,null))[_0xd230('0x22')](function(_0x2bbec7){if(_0x2bbec7){_0x4faba7[_0xd230('0x43')]['AccountId']=_0x2bbec7['id'];_0x4faba7[_0xd230('0x43')][_0xd230('0x4a')]=integrations[_0xd230('0x4b')](_0x4faba7[_0xd230('0x43')][_0xd230('0x4c')],_0x4faba7['body'][_0xd230('0x2b')]);_0x4faba7[_0xd230('0x43')][_0xd230('0x4d')]=integrations[_0xd230('0x4e')](_0x4faba7['body'][_0xd230('0x4c')],_0x4faba7[_0xd230('0x43')][_0xd230('0x2b')]);return db[_0xd230('0x46')][_0xd230('0x42')](_0x4faba7['body'],{'include':[{'model':db[_0xd230('0x4f')],'as':_0xd230('0x4a')},{'model':db[_0xd230('0x4f')],'as':_0xd230('0x4d')}]});}return null;})['then'](respondWithResult(_0x5a1462,null))['catch'](handleError(_0x5a1462,null));};exports['getFields']=function(_0x437520,_0x1bf6a0,_0x5907d0){var _0x5b5f5a;var _0x3b9ec0='';var _0x535f80=_0xd230('0x50');return db[_0xd230('0x29')][_0xd230('0x45')]({'where':{'id':_0x437520['params']['id']},'attributes':['id',_0xd230('0x51'),_0xd230('0x52'),'clientSecret',_0xd230('0x53'),_0xd230('0x54'),_0xd230('0x55')]})[_0xd230('0x22')](handleEntityNotFound(_0x1bf6a0,null))[_0xd230('0x22')](function(_0x3a4926){if(_0x3a4926){_0x3b9ec0=_0x3a4926['remoteUri'];var _0x5f55bf=_0x3b9ec0['slice'](-0x1);if(_0x5f55bf==='/'){_0x3b9ec0=_0x3b9ec0[_0xd230('0x56')](0x0,_0x3b9ec0[_0xd230('0x57')](_0x5f55bf));}_0x5b5f5a=new jsforce[(_0xd230('0x58'))]({'oauth2':{'loginUrl':_0x3b9ec0,'clientId':_0x3a4926[_0xd230('0x52')],'clientSecret':_0x3a4926[_0xd230('0x59')]}});return _0x5b5f5a[_0xd230('0x5a')](_0x3a4926[_0xd230('0x53')],_0x3a4926[_0xd230('0x54')][_0xd230('0x5b')](_0x3a4926[_0xd230('0x55')]));}})[_0xd230('0x22')](function(_0x42047){if(_0x42047){if(!_[_0xd230('0x5c')](_0x437520['query'][_0xd230('0x5d')])){_0x535f80=_0x437520[_0xd230('0x2c')][_0xd230('0x5d')];}return _0x5b5f5a[_0xd230('0x5e')](_0x535f80)[_0xd230('0x5f')]();}})[_0xd230('0x22')](function(_0x53e8d0){var _0x12f4da=[_0xd230('0x60'),'ActivityDate','IsReminderSet',_0xd230('0x61'),'Subject',_0xd230('0x62')];var _0x1a7318=[_0xd230('0x63'),_0xd230('0x64'),_0xd230('0x65'),_0xd230('0x66'),_0xd230('0x67'),_0xd230('0x68'),'phone'];if(_0x53e8d0){_[_0xd230('0x69')](_0x53e8d0[_0xd230('0x31')],function(_0x5f4054){return _0x12f4da['includes'](_0x5f4054[_0xd230('0x26')])||!_0x1a7318[_0xd230('0x6a')](_0x5f4054[_0xd230('0x2b')]);});return{'count':_0x53e8d0[_0xd230('0x31')]['length'],'rows':_['map'](_0x53e8d0[_0xd230('0x31')],function(_0x35fc1a){return{'id':_0x35fc1a[_0xd230('0x26')],'name':_0x35fc1a[_0xd230('0x6b')],'custom':_0x35fc1a[_0xd230('0x6c')],'options':_0x35fc1a[_0xd230('0x6d')]['length']>0x0?_[_0xd230('0x28')](_0x35fc1a[_0xd230('0x6d')],function(_0x106d40){return{'name':_0x106d40[_0xd230('0x6b')],'value':_0x106d40[_0xd230('0x6e')]};}):_0x35fc1a[_0xd230('0x2b')]==_0xd230('0x66')?[{'name':_0xd230('0x6f'),'value':_0xd230('0x70')},{'name':_0xd230('0x71'),'value':_0xd230('0x72')}]:[]};})};}})['then'](respondWithResult(_0x1bf6a0,null))[_0xd230('0x3d')](function(_0x235645){var _0x183f4e=_0x437520[_0xd230('0x2c')][_0xd230('0x73')]?0x1f4:_0x235645['statusCode']||0x1f4;logger[_0xd230('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0xd230('0x74'),_0x183f4e,JSON[_0xd230('0x75')](_0x235645));delete _0x235645[_0xd230('0x26')];if(_0x183f4e===0x191){_0x183f4e=0x190;}_0x1bf6a0[_0xd230('0x16')](_0x183f4e)[_0xd230('0x76')](_0x437520[_0xd230('0x2c')][_0xd230('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x235645[_0xd230('0x77')]}:_0x235645);});}; \ No newline at end of file +var _0xf1ad=['moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','undefined','limit','count','offset','set','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','index','SalesforceAccount','type','key','model','map','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','findAll','catch','show','keys','rawAttributes','intersection','find','create','body','params','getConfigurations','findOne','SalesforceConfiguration','filter','length','addConfiguration','AccountId','getSubjects','channel','Descriptions','SalesforceField','clientId','clientSecret','username','password','securityToken','remoteUri','substring','lastIndexOf','Connection','login','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','boolean','textarea','phone','includes','label','custom','picklistValues','value','True','False','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3a7161,_0x3f0d55){var _0x57cf47=function(_0x2bc1c9){while(--_0x2bc1c9){_0x3a7161['push'](_0x3a7161['shift']());}};_0x57cf47(++_0x3f0d55);}(_0xf1ad,0x71));var _0xdf1a=function(_0x303b0b,_0x2a17f9){_0x303b0b=_0x303b0b-0x0;var _0x2a5da9=_0xf1ad[_0x303b0b];return _0x2a5da9;};'use strict';var emlformat=require(_0xdf1a('0x0'));var rimraf=require(_0xdf1a('0x1'));var zipdir=require(_0xdf1a('0x2'));var jsonpatch=require(_0xdf1a('0x3'));var rp=require(_0xdf1a('0x4'));var moment=require(_0xdf1a('0x5'));var BPromise=require(_0xdf1a('0x6'));var Mustache=require(_0xdf1a('0x7'));var util=require(_0xdf1a('0x8'));var path=require(_0xdf1a('0x9'));var sox=require(_0xdf1a('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdf1a('0xb'));var _=require(_0xdf1a('0xc'));var squel=require(_0xdf1a('0xd'));var crypto=require(_0xdf1a('0xe'));var jsforce=require(_0xdf1a('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdf1a('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdf1a('0x11'));var hardwareService=require(_0xdf1a('0x12'));var logger=require('../../config/logger')(_0xdf1a('0x13'));var utils=require(_0xdf1a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xdf1a('0x15'));var db=require(_0xdf1a('0x16'))['db'];var integrations=require(_0xdf1a('0x17'));function respondWithStatusCode(_0x1ee1d6,_0x443c07){_0x443c07=_0x443c07||0xcc;return function(_0x7ec516){if(_0x7ec516){return _0x1ee1d6['sendStatus'](_0x443c07);}return _0x1ee1d6[_0xdf1a('0x18')](_0x443c07)[_0xdf1a('0x19')]();};}function respondWithResult(_0x288732,_0x522522){_0x522522=_0x522522||0xc8;return function(_0x3ac6ca){if(_0x3ac6ca){return _0x288732[_0xdf1a('0x18')](_0x522522)[_0xdf1a('0x1a')](_0x3ac6ca);}};}function respondWithFilteredResult(_0x309ef7,_0x13b80e){return function(_0x4c8165){if(_0x4c8165){var _0x4e5e56=typeof _0x13b80e['offset']===_0xdf1a('0x1b')&&typeof _0x13b80e[_0xdf1a('0x1c')]===_0xdf1a('0x1b');var _0x389a14=_0x4c8165['count'];var _0x3a30f2=_0x4e5e56?0x0:_0x13b80e['offset'];var _0x32ad5b=_0x4e5e56?_0x4c8165[_0xdf1a('0x1d')]:_0x13b80e[_0xdf1a('0x1e')]+_0x13b80e[_0xdf1a('0x1c')];var _0x52efe9;if(_0x32ad5b>=_0x389a14){_0x32ad5b=_0x389a14;_0x52efe9=0xc8;}else{_0x52efe9=0xce;}_0x309ef7[_0xdf1a('0x18')](_0x52efe9);return _0x309ef7[_0xdf1a('0x1f')]('Content-Range',_0x3a30f2+'-'+_0x32ad5b+'/'+_0x389a14)[_0xdf1a('0x1a')](_0x4c8165);}return null;};}function patchUpdates(_0x32329b){return function(_0x58597a){try{jsonpatch[_0xdf1a('0x20')](_0x58597a,_0x32329b,!![]);}catch(_0x5a0e3e){return BPromise[_0xdf1a('0x21')](_0x5a0e3e);}return _0x58597a['save']();};}function saveUpdates(_0x572488,_0x55a53c){return function(_0x53ebe4){if(_0x53ebe4){return _0x53ebe4[_0xdf1a('0x22')](_0x572488)['then'](function(_0xbacc5a){return _0xbacc5a;});}return null;};}function removeEntity(_0x56ed5f,_0x5f1515){return function(_0x5301f9){if(_0x5301f9){return _0x5301f9[_0xdf1a('0x23')]()[_0xdf1a('0x24')](function(){_0x56ed5f[_0xdf1a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48d9c2,_0x40205c){return function(_0x5e7e79){if(!_0x5e7e79){_0x48d9c2[_0xdf1a('0x25')](0x194);}return _0x5e7e79;};}function handleError(_0x369c78,_0x27a7d1){_0x27a7d1=_0x27a7d1||0x1f4;return function(_0x149beb){logger[_0xdf1a('0x26')](_0x149beb[_0xdf1a('0x27')]);if(_0x149beb['name']){delete _0x149beb[_0xdf1a('0x28')];}_0x369c78[_0xdf1a('0x18')](_0x27a7d1)[_0xdf1a('0x29')](_0x149beb);};}exports[_0xdf1a('0x2a')]=function(_0x3d820d,_0x57630b){var _0x49f2fb={},_0x1b35b8={},_0xf7cb7e={'count':0x0,'rows':[]};var _0x3286bf=_['map'](db[_0xdf1a('0x2b')]['rawAttributes'],function(_0xe941fa){return{'name':_0xe941fa['fieldName'],'type':_0xe941fa[_0xdf1a('0x2c')][_0xdf1a('0x2d')]};});_0x1b35b8[_0xdf1a('0x2e')]=_[_0xdf1a('0x2f')](_0x3286bf,_0xdf1a('0x28'));_0x1b35b8[_0xdf1a('0x30')]=_['keys'](_0x3d820d[_0xdf1a('0x30')]);_0x1b35b8[_0xdf1a('0x31')]=_['intersection'](_0x1b35b8[_0xdf1a('0x2e')],_0x1b35b8[_0xdf1a('0x30')]);_0x49f2fb[_0xdf1a('0x32')]=_['intersection'](_0x1b35b8[_0xdf1a('0x2e')],qs[_0xdf1a('0x33')](_0x3d820d[_0xdf1a('0x30')]['fields']));_0x49f2fb[_0xdf1a('0x32')]=_0x49f2fb[_0xdf1a('0x32')]['length']?_0x49f2fb[_0xdf1a('0x32')]:_0x1b35b8[_0xdf1a('0x2e')];if(!_0x3d820d['query'][_0xdf1a('0x34')](_0xdf1a('0x35'))){_0x49f2fb['limit']=qs[_0xdf1a('0x1c')](_0x3d820d[_0xdf1a('0x30')]['limit']);_0x49f2fb[_0xdf1a('0x1e')]=qs[_0xdf1a('0x1e')](_0x3d820d['query'][_0xdf1a('0x1e')]);}_0x49f2fb[_0xdf1a('0x36')]=qs[_0xdf1a('0x37')](_0x3d820d[_0xdf1a('0x30')]['sort']);_0x49f2fb[_0xdf1a('0x38')]=qs[_0xdf1a('0x31')](_[_0xdf1a('0x39')](_0x3d820d[_0xdf1a('0x30')],_0x1b35b8[_0xdf1a('0x31')]),_0x3286bf);if(_0x3d820d[_0xdf1a('0x30')]['filter']){_0x49f2fb[_0xdf1a('0x38')]=_[_0xdf1a('0x3a')](_0x49f2fb[_0xdf1a('0x38')],{'$or':_[_0xdf1a('0x2f')](_0x3286bf,function(_0x2eb76e){if(_0x2eb76e[_0xdf1a('0x2c')]!=='VIRTUAL'){var _0x44d319={};_0x44d319[_0x2eb76e[_0xdf1a('0x28')]]={'$like':'%'+_0x3d820d[_0xdf1a('0x30')]['filter']+'%'};return _0x44d319;}})});}_0x49f2fb=_[_0xdf1a('0x3a')]({},_0x49f2fb,_0x3d820d[_0xdf1a('0x3b')]);var _0x5a2f16={'where':_0x49f2fb['where']};return db[_0xdf1a('0x2b')][_0xdf1a('0x1d')](_0x5a2f16)[_0xdf1a('0x24')](function(_0x1f5ec0){_0xf7cb7e[_0xdf1a('0x1d')]=_0x1f5ec0;if(_0x3d820d[_0xdf1a('0x30')][_0xdf1a('0x3c')]){_0x49f2fb['include']=[{'all':!![]}];}return db[_0xdf1a('0x2b')][_0xdf1a('0x3d')](_0x49f2fb);})[_0xdf1a('0x24')](function(_0x4d2dd7){_0xf7cb7e['rows']=_0x4d2dd7;return _0xf7cb7e;})[_0xdf1a('0x24')](respondWithFilteredResult(_0x57630b,_0x49f2fb))[_0xdf1a('0x3e')](handleError(_0x57630b,null));};exports[_0xdf1a('0x3f')]=function(_0x436ea7,_0x48458f){var _0x171701={'raw':![],'where':{'id':_0x436ea7['params']['id']}},_0xdcfd1c={};_0xdcfd1c[_0xdf1a('0x2e')]=_[_0xdf1a('0x40')](db[_0xdf1a('0x2b')][_0xdf1a('0x41')]);_0xdcfd1c[_0xdf1a('0x30')]=_[_0xdf1a('0x40')](_0x436ea7[_0xdf1a('0x30')]);_0xdcfd1c[_0xdf1a('0x31')]=_['intersection'](_0xdcfd1c[_0xdf1a('0x2e')],_0xdcfd1c['query']);_0x171701['attributes']=_[_0xdf1a('0x42')](_0xdcfd1c[_0xdf1a('0x2e')],qs[_0xdf1a('0x33')](_0x436ea7['query'][_0xdf1a('0x33')]));_0x171701[_0xdf1a('0x32')]=_0x171701[_0xdf1a('0x32')]['length']?_0x171701[_0xdf1a('0x32')]:_0xdcfd1c[_0xdf1a('0x2e')];if(_0x436ea7[_0xdf1a('0x30')][_0xdf1a('0x3c')]){_0x171701['include']=[{'all':!![]}];}_0x171701=_['merge']({},_0x171701,_0x436ea7[_0xdf1a('0x3b')]);return db[_0xdf1a('0x2b')][_0xdf1a('0x43')](_0x171701)[_0xdf1a('0x24')](handleEntityNotFound(_0x48458f,null))[_0xdf1a('0x24')](respondWithResult(_0x48458f,null))['catch'](handleError(_0x48458f,null));};exports[_0xdf1a('0x44')]=function(_0x54a3dd,_0x2d13ac){return db['SalesforceAccount'][_0xdf1a('0x44')](_0x54a3dd[_0xdf1a('0x45')],{})['then'](respondWithResult(_0x2d13ac,0xc9))[_0xdf1a('0x3e')](handleError(_0x2d13ac,null));};exports[_0xdf1a('0x22')]=function(_0x6970cb,_0x1f196d){if(_0x6970cb[_0xdf1a('0x45')]['id']){delete _0x6970cb[_0xdf1a('0x45')]['id'];}return db[_0xdf1a('0x2b')][_0xdf1a('0x43')]({'where':{'id':_0x6970cb[_0xdf1a('0x46')]['id']}})[_0xdf1a('0x24')](handleEntityNotFound(_0x1f196d,null))[_0xdf1a('0x24')](saveUpdates(_0x6970cb['body'],null))['then'](respondWithResult(_0x1f196d,null))[_0xdf1a('0x3e')](handleError(_0x1f196d,null));};exports['destroy']=function(_0xc1e75,_0x18a01a){return db['SalesforceAccount'][_0xdf1a('0x43')]({'where':{'id':_0xc1e75[_0xdf1a('0x46')]['id']}})['then'](handleEntityNotFound(_0x18a01a,null))[_0xdf1a('0x24')](removeEntity(_0x18a01a,null))[_0xdf1a('0x3e')](handleError(_0x18a01a,null));};exports[_0xdf1a('0x47')]=function(_0x540b19,_0x23775b,_0x2c3368){var _0x42712a={};var _0x4aedc3={};var _0x487dd6;var _0x557d8b;return db[_0xdf1a('0x2b')][_0xdf1a('0x48')]({'where':{'id':_0x540b19[_0xdf1a('0x46')]['id']}})[_0xdf1a('0x24')](handleEntityNotFound(_0x23775b,null))[_0xdf1a('0x24')](function(_0x4f79f6){if(_0x4f79f6){_0x487dd6=_0x4f79f6;_0x4aedc3[_0xdf1a('0x2e')]=_['keys'](db[_0xdf1a('0x49')]['rawAttributes']);_0x4aedc3[_0xdf1a('0x30')]=_[_0xdf1a('0x40')](_0x540b19['query']);_0x4aedc3[_0xdf1a('0x31')]=_[_0xdf1a('0x42')](_0x4aedc3[_0xdf1a('0x2e')],_0x4aedc3['query']);_0x42712a[_0xdf1a('0x32')]=_[_0xdf1a('0x42')](_0x4aedc3[_0xdf1a('0x2e')],qs[_0xdf1a('0x33')](_0x540b19['query']['fields']));_0x42712a[_0xdf1a('0x32')]=_0x42712a['attributes']['length']?_0x42712a[_0xdf1a('0x32')]:_0x4aedc3[_0xdf1a('0x2e')];_0x42712a[_0xdf1a('0x36')]=qs[_0xdf1a('0x37')](_0x540b19[_0xdf1a('0x30')][_0xdf1a('0x37')]);_0x42712a[_0xdf1a('0x38')]=qs[_0xdf1a('0x31')](_[_0xdf1a('0x39')](_0x540b19[_0xdf1a('0x30')],_0x4aedc3['filters']));if(_0x540b19[_0xdf1a('0x30')][_0xdf1a('0x4a')]){_0x42712a[_0xdf1a('0x38')]=_['merge'](_0x42712a[_0xdf1a('0x38')],{'$or':_[_0xdf1a('0x2f')](_0x42712a[_0xdf1a('0x32')],function(_0x3c9bd5){var _0x41de22={};_0x41de22[_0x3c9bd5]={'$like':'%'+_0x540b19[_0xdf1a('0x30')][_0xdf1a('0x4a')]+'%'};return _0x41de22;})});}_0x42712a=_[_0xdf1a('0x3a')]({},_0x42712a,_0x540b19['options']);return _0x487dd6[_0xdf1a('0x47')](_0x42712a);}})[_0xdf1a('0x24')](function(_0x330757){if(_0x330757){_0x557d8b=_0x330757[_0xdf1a('0x4b')];if(!_0x540b19['query'][_0xdf1a('0x34')](_0xdf1a('0x35'))){_0x42712a['limit']=qs[_0xdf1a('0x1c')](_0x540b19['query'][_0xdf1a('0x1c')]);_0x42712a[_0xdf1a('0x1e')]=qs[_0xdf1a('0x1e')](_0x540b19['query'][_0xdf1a('0x1e')]);}return _0x487dd6[_0xdf1a('0x47')](_0x42712a);}})[_0xdf1a('0x24')](function(_0xa7c9a1){if(_0xa7c9a1){return _0xa7c9a1?{'count':_0x557d8b,'rows':_0xa7c9a1}:null;}})[_0xdf1a('0x24')](respondWithResult(_0x23775b,null))['catch'](handleError(_0x23775b,null));};exports[_0xdf1a('0x4c')]=function(_0xb0db33,_0x10566e,_0x25342c){if(_0xb0db33['body']['id']){delete _0xb0db33[_0xdf1a('0x45')]['id'];}return db[_0xdf1a('0x2b')]['findOne']({'where':{'id':_0xb0db33['params']['id']}})[_0xdf1a('0x24')](handleEntityNotFound(_0x10566e,null))[_0xdf1a('0x24')](function(_0x4d46d4){if(_0x4d46d4){_0xb0db33[_0xdf1a('0x45')][_0xdf1a('0x4d')]=_0x4d46d4['id'];_0xb0db33['body']['Subjects']=integrations[_0xdf1a('0x4e')](_0xb0db33[_0xdf1a('0x45')][_0xdf1a('0x4f')],_0xb0db33['body'][_0xdf1a('0x2c')]);_0xb0db33[_0xdf1a('0x45')][_0xdf1a('0x50')]=integrations['getDescriptions'](_0xb0db33[_0xdf1a('0x45')][_0xdf1a('0x4f')],_0xb0db33[_0xdf1a('0x45')][_0xdf1a('0x2c')]);return db[_0xdf1a('0x49')][_0xdf1a('0x44')](_0xb0db33[_0xdf1a('0x45')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0xdf1a('0x51')],'as':_0xdf1a('0x50')}]});}return null;})[_0xdf1a('0x24')](respondWithResult(_0x10566e,null))[_0xdf1a('0x3e')](handleError(_0x10566e,null));};exports['getFields']=function(_0x20563b,_0x5294aa,_0x5aa120){var _0x1fc5c5;var _0x2d79b2='';var _0x25cfc4='Task';return db[_0xdf1a('0x2b')][_0xdf1a('0x48')]({'where':{'id':_0x20563b[_0xdf1a('0x46')]['id']},'attributes':['id','remoteUri',_0xdf1a('0x52'),_0xdf1a('0x53'),_0xdf1a('0x54'),_0xdf1a('0x55'),_0xdf1a('0x56')]})[_0xdf1a('0x24')](handleEntityNotFound(_0x5294aa,null))[_0xdf1a('0x24')](function(_0x2aaa00){if(_0x2aaa00){_0x2d79b2=_0x2aaa00[_0xdf1a('0x57')];var _0x2cd439=_0x2d79b2['slice'](-0x1);if(_0x2cd439==='/'){_0x2d79b2=_0x2d79b2[_0xdf1a('0x58')](0x0,_0x2d79b2[_0xdf1a('0x59')](_0x2cd439));}_0x1fc5c5=new jsforce[(_0xdf1a('0x5a'))]({'oauth2':{'loginUrl':_0x2d79b2,'clientId':_0x2aaa00[_0xdf1a('0x52')],'clientSecret':_0x2aaa00[_0xdf1a('0x53')]}});return _0x1fc5c5[_0xdf1a('0x5b')](_0x2aaa00[_0xdf1a('0x54')],_0x2aaa00[_0xdf1a('0x55')]['concat'](_0x2aaa00[_0xdf1a('0x56')]));}})[_0xdf1a('0x24')](function(_0x4d0a7e){if(_0x4d0a7e){if(!_['isNil'](_0x20563b[_0xdf1a('0x30')]['ticketType'])){_0x25cfc4=_0x20563b[_0xdf1a('0x30')][_0xdf1a('0x5c')];}return _0x1fc5c5[_0xdf1a('0x5d')](_0x25cfc4)[_0xdf1a('0x5e')]();}})[_0xdf1a('0x24')](function(_0x57a0f1){var _0x1fdd4b=[_0xdf1a('0x5f'),_0xdf1a('0x60'),_0xdf1a('0x61'),_0xdf1a('0x62'),_0xdf1a('0x63'),_0xdf1a('0x64')];var _0x50acb7=[_0xdf1a('0x65'),_0xdf1a('0x66'),'picklist',_0xdf1a('0x67'),'email',_0xdf1a('0x68'),_0xdf1a('0x69')];if(_0x57a0f1){_['remove'](_0x57a0f1[_0xdf1a('0x33')],function(_0x1f097e){return _0x1fdd4b[_0xdf1a('0x6a')](_0x1f097e[_0xdf1a('0x28')])||!_0x50acb7[_0xdf1a('0x6a')](_0x1f097e[_0xdf1a('0x2c')]);});return{'count':_0x57a0f1[_0xdf1a('0x33')][_0xdf1a('0x4b')],'rows':_[_0xdf1a('0x2f')](_0x57a0f1['fields'],function(_0x5229ba){return{'id':_0x5229ba[_0xdf1a('0x28')],'name':_0x5229ba[_0xdf1a('0x6b')],'custom':_0x5229ba[_0xdf1a('0x6c')],'options':_0x5229ba[_0xdf1a('0x6d')]['length']>0x0?_[_0xdf1a('0x2f')](_0x5229ba[_0xdf1a('0x6d')],function(_0x402f3a){return{'name':_0x402f3a[_0xdf1a('0x6b')],'value':_0x402f3a[_0xdf1a('0x6e')]};}):_0x5229ba['type']==_0xdf1a('0x67')?[{'name':_0xdf1a('0x6f'),'value':'true'},{'name':_0xdf1a('0x70'),'value':'false'}]:[]};})};}})[_0xdf1a('0x24')](respondWithResult(_0x5294aa,null))['catch'](function(_0x22cc57){var _0x375076=_0x20563b['query'][_0xdf1a('0x71')]?0x1f4:_0x22cc57[_0xdf1a('0x72')]||0x1f4;logger[_0xdf1a('0x26')](_0xdf1a('0x73'),_0xdf1a('0x74'),_0x375076,JSON[_0xdf1a('0x75')](_0x22cc57));delete _0x22cc57[_0xdf1a('0x28')];if(_0x375076===0x191){_0x375076=0x190;}_0x5294aa[_0xdf1a('0x18')](_0x375076)[_0xdf1a('0x29')](_0x20563b[_0xdf1a('0x30')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x22cc57[_0xdf1a('0x72')]}:_0x22cc57);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 6cae6b7..e229a93 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 _0xaee0=['SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x1cee8c,_0x361c32){var _0x3800dc=function(_0x4d0d79){while(--_0x4d0d79){_0x1cee8c['push'](_0x1cee8c['shift']());}};_0x3800dc(++_0x361c32);}(_0xaee0,0x17b));var _0x0aee=function(_0xd91aea,_0x90202d){_0xd91aea=_0xd91aea-0x0;var _0xed7cb0=_0xaee0[_0xd91aea];return _0xed7cb0;};'use strict';var _=require(_0x0aee('0x0'));var util=require(_0x0aee('0x1'));var logger=require(_0x0aee('0x2'))(_0x0aee('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0aee('0x4'));var fs=require('fs');var path=require(_0x0aee('0x5'));var rimraf=require('rimraf');var config=require(_0x0aee('0x6'));var attributes=require(_0x0aee('0x7'));var integrations=require(_0x0aee('0x8'));module[_0x0aee('0x9')]=function(_0x686229,_0x5a09cd){return _0x686229[_0x0aee('0xa')](_0x0aee('0xb'),attributes,{'tableName':_0x0aee('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34ea=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','define','SalesforceAccount','lodash'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x34ea,0xa8));var _0xa34e=function(_0x5bd1ec,_0x28650f){_0x5bd1ec=_0x5bd1ec-0x0;var _0x126912=_0x34ea[_0x5bd1ec];return _0x126912;};'use strict';var _=require(_0xa34e('0x0'));var util=require(_0xa34e('0x1'));var logger=require(_0xa34e('0x2'))(_0xa34e('0x3'));var moment=require(_0xa34e('0x4'));var BPromise=require(_0xa34e('0x5'));var rp=require(_0xa34e('0x6'));var fs=require('fs');var path=require(_0xa34e('0x7'));var rimraf=require(_0xa34e('0x8'));var config=require(_0xa34e('0x9'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xa34e('0xa'));module['exports']=function(_0x56a595,_0x27dad6){return _0x56a595[_0xa34e('0xb')](_0xa34e('0xc'),attributes,{'tableName':'int_salesforce_accounts','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 34ddeb1..4d29da0 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 _0x674f=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetSalesforceAccount','options','raw','where','attributes','limit','include','map','model','ShowSalesforceAccount','lodash','moment','bluebird','randomstring'];(function(_0x3c51d4,_0x36ba53){var _0x53c45f=function(_0x3d6683){while(--_0x3d6683){_0x3c51d4['push'](_0x3c51d4['shift']());}};_0x53c45f(++_0x36ba53);}(_0x674f,0x167));var _0xf674=function(_0x111693,_0x28d614){_0x111693=_0x111693-0x0;var _0x1be2f3=_0x674f[_0x111693];return _0x1be2f3;};'use strict';var _=require(_0xf674('0x0'));var util=require('util');var moment=require(_0xf674('0x1'));var BPromise=require(_0xf674('0x2'));var rs=require(_0xf674('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf674('0x4'))['db'];var utils=require(_0xf674('0x5'));var logger=require(_0xf674('0x6'))(_0xf674('0x7'));var config=require(_0xf674('0x8'));var jayson=require(_0xf674('0x9'));var client=jayson[_0xf674('0xa')][_0xf674('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b3b0e,_0x3d559e,_0x27afe2){return new BPromise(function(_0x408dee,_0x4607c5){return client[_0xf674('0xc')](_0x2b3b0e,_0x27afe2)[_0xf674('0xd')](function(_0x3df446){logger[_0xf674('0xe')](_0xf674('0xf'),_0x3d559e,'request\x20sent');logger[_0xf674('0x10')](_0xf674('0x11'),_0x3d559e,'request\x20sent',JSON[_0xf674('0x12')](_0x3df446));if(_0x3df446[_0xf674('0x13')]){if(_0x3df446[_0xf674('0x13')]['code']===0x1f4){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x3d559e,_0x3df446[_0xf674('0x13')][_0xf674('0x14')]);return _0x4607c5(_0x3df446[_0xf674('0x13')][_0xf674('0x14')]);}logger[_0xf674('0x13')](_0xf674('0xf'),_0x3d559e,_0x3df446['error'][_0xf674('0x14')]);return _0x408dee(_0x3df446[_0xf674('0x13')][_0xf674('0x14')]);}else{logger['info'](_0xf674('0xf'),_0x3d559e,'request\x20sent');_0x408dee(_0x3df446[_0xf674('0x15')][_0xf674('0x14')]);}})[_0xf674('0x16')](function(_0x30a85f){logger[_0xf674('0x13')](_0xf674('0xf'),_0x3d559e,_0x30a85f);_0x4607c5(_0x30a85f);});});}exports[_0xf674('0x17')]=function(_0x4b502b){var _0x5c6bc3=this;return new Promise(function(_0x2c4b1c,_0x48178f){return db['SalesforceAccount']['findAll']({'raw':_0x4b502b[_0xf674('0x18')]?_0x4b502b[_0xf674('0x18')][_0xf674('0x19')]===undefined?!![]:![]:!![],'where':_0x4b502b[_0xf674('0x18')]?_0x4b502b[_0xf674('0x18')][_0xf674('0x1a')]||null:null,'attributes':_0x4b502b[_0xf674('0x18')]?_0x4b502b[_0xf674('0x18')][_0xf674('0x1b')]||null:null,'limit':_0x4b502b[_0xf674('0x18')]?_0x4b502b[_0xf674('0x18')][_0xf674('0x1c')]||null:null,'include':_0x4b502b[_0xf674('0x18')]?_0x4b502b[_0xf674('0x18')][_0xf674('0x1d')]?_[_0xf674('0x1e')](_0x4b502b[_0xf674('0x18')][_0xf674('0x1d')],function(_0x12a1d6){return{'model':db[_0x12a1d6['model']],'as':_0x12a1d6['as'],'attributes':_0x12a1d6[_0xf674('0x1b')],'include':_0x12a1d6[_0xf674('0x1d')]?_['map'](_0x12a1d6[_0xf674('0x1d')],function(_0xafba4c){return{'model':db[_0xafba4c[_0xf674('0x1f')]],'as':_0xafba4c['as'],'attributes':_0xafba4c[_0xf674('0x1b')],'include':_0xafba4c[_0xf674('0x1d')]?_[_0xf674('0x1e')](_0xafba4c[_0xf674('0x1d')],function(_0x4a23ad){return{'model':db[_0x4a23ad['model']],'as':_0x4a23ad['as'],'attributes':_0x4a23ad[_0xf674('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf674('0xd')](function(_0xc4a26){logger[_0xf674('0xe')](_0xf674('0x17'),_0x4b502b);logger[_0xf674('0x10')]('GetSalesforceAccount',_0x4b502b,JSON[_0xf674('0x12')](_0xc4a26));_0x2c4b1c(_0xc4a26);})['catch'](function(_0x44d5c){logger[_0xf674('0x13')]('GetSalesforceAccount',_0x44d5c['message'],_0x4b502b);_0x48178f(_0x5c6bc3[_0xf674('0x13')](0x1f4,_0x44d5c[_0xf674('0x14')]));});});};exports[_0xf674('0x20')]=function(_0x33156a){var _0x4e2ff5=this;return new Promise(function(_0x368bca,_0x336828){return db['SalesforceAccount']['find']({'raw':_0x33156a[_0xf674('0x18')]?_0x33156a[_0xf674('0x18')][_0xf674('0x19')]===undefined?!![]:![]:!![],'where':_0x33156a[_0xf674('0x18')]?_0x33156a['options'][_0xf674('0x1a')]||null:null,'attributes':_0x33156a['options']?_0x33156a[_0xf674('0x18')]['attributes']||null:null,'include':_0x33156a[_0xf674('0x18')]?_0x33156a[_0xf674('0x18')][_0xf674('0x1d')]?_[_0xf674('0x1e')](_0x33156a[_0xf674('0x18')][_0xf674('0x1d')],function(_0x32e9e7){return{'model':db[_0x32e9e7[_0xf674('0x1f')]],'as':_0x32e9e7['as'],'attributes':_0x32e9e7[_0xf674('0x1b')],'include':_0x32e9e7[_0xf674('0x1d')]?_[_0xf674('0x1e')](_0x32e9e7[_0xf674('0x1d')],function(_0x4e1168){return{'model':db[_0x4e1168[_0xf674('0x1f')]],'as':_0x4e1168['as'],'attributes':_0x4e1168[_0xf674('0x1b')],'include':_0x4e1168['include']?_[_0xf674('0x1e')](_0x4e1168[_0xf674('0x1d')],function(_0x4fc60e){return{'model':db[_0x4fc60e[_0xf674('0x1f')]],'as':_0x4fc60e['as'],'attributes':_0x4fc60e[_0xf674('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf674('0xd')](function(_0x3ee2d){logger[_0xf674('0xe')](_0xf674('0x20'),_0x33156a);logger[_0xf674('0x10')]('ShowSalesforceAccount',_0x33156a,JSON[_0xf674('0x12')](_0x3ee2d));_0x368bca(_0x3ee2d);})[_0xf674('0x16')](function(_0x441234){logger[_0xf674('0x13')]('ShowSalesforceAccount',_0x441234[_0xf674('0x14')],_0x33156a);_0x336828(_0x4e2ff5[_0xf674('0x13')](0x1f4,_0x441234[_0xf674('0x14')]));});});}; \ No newline at end of file +var _0x7c1a=['request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','SalesforceAccount','findAll','options','raw','where','attributes','limit','map','include','model','GetSalesforceAccount','debug','stringify','ShowSalesforceAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x7c1a,0x159));var _0xa7c1=function(_0x1e965a,_0x5163f3){_0x1e965a=_0x1e965a-0x0;var _0x7e75cf=_0x7c1a[_0x1e965a];return _0x7e75cf;};'use strict';var _=require(_0xa7c1('0x0'));var util=require(_0xa7c1('0x1'));var moment=require(_0xa7c1('0x2'));var BPromise=require(_0xa7c1('0x3'));var rs=require(_0xa7c1('0x4'));var fs=require('fs');var Redis=require(_0xa7c1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa7c1('0x6'));var logger=require(_0xa7c1('0x7'))('rpc');var config=require(_0xa7c1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa7c1('0x9')][_0xa7c1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3dcfe3,_0x300db9,_0x4fc287){return new BPromise(function(_0x4f97c0,_0x117323){return client[_0xa7c1('0xb')](_0x3dcfe3,_0x4fc287)[_0xa7c1('0xc')](function(_0x5bc155){logger[_0xa7c1('0xd')](_0xa7c1('0xe'),_0x300db9,_0xa7c1('0xf'));logger['debug'](_0xa7c1('0x10'),_0x300db9,_0xa7c1('0xf'),JSON['stringify'](_0x5bc155));if(_0x5bc155[_0xa7c1('0x11')]){if(_0x5bc155[_0xa7c1('0x11')]['code']===0x1f4){logger[_0xa7c1('0x11')](_0xa7c1('0xe'),_0x300db9,_0x5bc155[_0xa7c1('0x11')][_0xa7c1('0x12')]);return _0x117323(_0x5bc155[_0xa7c1('0x11')][_0xa7c1('0x12')]);}logger[_0xa7c1('0x11')](_0xa7c1('0xe'),_0x300db9,_0x5bc155[_0xa7c1('0x11')][_0xa7c1('0x12')]);return _0x4f97c0(_0x5bc155[_0xa7c1('0x11')][_0xa7c1('0x12')]);}else{logger[_0xa7c1('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x300db9,_0xa7c1('0xf'));_0x4f97c0(_0x5bc155[_0xa7c1('0x13')][_0xa7c1('0x12')]);}})[_0xa7c1('0x14')](function(_0x84244a){logger['error'](_0xa7c1('0xe'),_0x300db9,_0x84244a);_0x117323(_0x84244a);});});}exports['GetSalesforceAccount']=function(_0x440251){var _0x337db4=this;return new Promise(function(_0x5dc8e3,_0x2e23f8){return db[_0xa7c1('0x15')][_0xa7c1('0x16')]({'raw':_0x440251['options']?_0x440251[_0xa7c1('0x17')][_0xa7c1('0x18')]===undefined?!![]:![]:!![],'where':_0x440251[_0xa7c1('0x17')]?_0x440251[_0xa7c1('0x17')][_0xa7c1('0x19')]||null:null,'attributes':_0x440251[_0xa7c1('0x17')]?_0x440251[_0xa7c1('0x17')][_0xa7c1('0x1a')]||null:null,'limit':_0x440251[_0xa7c1('0x17')]?_0x440251['options'][_0xa7c1('0x1b')]||null:null,'include':_0x440251[_0xa7c1('0x17')]?_0x440251[_0xa7c1('0x17')]['include']?_[_0xa7c1('0x1c')](_0x440251[_0xa7c1('0x17')][_0xa7c1('0x1d')],function(_0x2dc42b){return{'model':db[_0x2dc42b[_0xa7c1('0x1e')]],'as':_0x2dc42b['as'],'attributes':_0x2dc42b[_0xa7c1('0x1a')],'include':_0x2dc42b[_0xa7c1('0x1d')]?_['map'](_0x2dc42b['include'],function(_0x48280a){return{'model':db[_0x48280a[_0xa7c1('0x1e')]],'as':_0x48280a['as'],'attributes':_0x48280a[_0xa7c1('0x1a')],'include':_0x48280a[_0xa7c1('0x1d')]?_[_0xa7c1('0x1c')](_0x48280a[_0xa7c1('0x1d')],function(_0x5d62cb){return{'model':db[_0x5d62cb['model']],'as':_0x5d62cb['as'],'attributes':_0x5d62cb[_0xa7c1('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa7c1('0xc')](function(_0xc60f7c){logger['info'](_0xa7c1('0x1f'),_0x440251);logger[_0xa7c1('0x20')](_0xa7c1('0x1f'),_0x440251,JSON[_0xa7c1('0x21')](_0xc60f7c));_0x5dc8e3(_0xc60f7c);})[_0xa7c1('0x14')](function(_0x1cc05c){logger[_0xa7c1('0x11')](_0xa7c1('0x1f'),_0x1cc05c[_0xa7c1('0x12')],_0x440251);_0x2e23f8(_0x337db4[_0xa7c1('0x11')](0x1f4,_0x1cc05c['message']));});});};exports[_0xa7c1('0x22')]=function(_0x924b93){var _0x2a5d5c=this;return new Promise(function(_0x40ad2b,_0x216fd5){return db[_0xa7c1('0x15')][_0xa7c1('0x23')]({'raw':_0x924b93[_0xa7c1('0x17')]?_0x924b93[_0xa7c1('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x924b93[_0xa7c1('0x17')]?_0x924b93[_0xa7c1('0x17')][_0xa7c1('0x19')]||null:null,'attributes':_0x924b93[_0xa7c1('0x17')]?_0x924b93['options']['attributes']||null:null,'include':_0x924b93[_0xa7c1('0x17')]?_0x924b93[_0xa7c1('0x17')][_0xa7c1('0x1d')]?_['map'](_0x924b93['options'][_0xa7c1('0x1d')],function(_0x3ee051){return{'model':db[_0x3ee051['model']],'as':_0x3ee051['as'],'attributes':_0x3ee051[_0xa7c1('0x1a')],'include':_0x3ee051['include']?_[_0xa7c1('0x1c')](_0x3ee051['include'],function(_0x46bdb1){return{'model':db[_0x46bdb1[_0xa7c1('0x1e')]],'as':_0x46bdb1['as'],'attributes':_0x46bdb1['attributes'],'include':_0x46bdb1['include']?_[_0xa7c1('0x1c')](_0x46bdb1[_0xa7c1('0x1d')],function(_0x3acd7b){return{'model':db[_0x3acd7b[_0xa7c1('0x1e')]],'as':_0x3acd7b['as'],'attributes':_0x3acd7b[_0xa7c1('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa7c1('0xc')](function(_0x2bac7c){logger['info'](_0xa7c1('0x22'),_0x924b93);logger[_0xa7c1('0x20')](_0xa7c1('0x22'),_0x924b93,JSON[_0xa7c1('0x21')](_0x2bac7c));_0x40ad2b(_0x2bac7c);})[_0xa7c1('0x14')](function(_0x396748){logger['error'](_0xa7c1('0x22'),_0x396748[_0xa7c1('0x12')],_0x924b93);_0x216fd5(_0x2a5d5c[_0xa7c1('0x11')](0x1f4,_0x396748[_0xa7c1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 77d458f..35e5342 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3438cf,_0x73b174){_0x3438cf=_0x3438cf-0x0;var _0x278698=_0x0b0e[_0x3438cf];return _0x278698;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file +var _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x9e27f,_0x4c0553){var _0x1246c8=function(_0x1204f0){while(--_0x1204f0){_0x9e27f['push'](_0x9e27f['shift']());}};_0x1246c8(++_0x4c0553);}(_0xadb5,0xad));var _0x5adb=function(_0x2a031b,_0x379f1a){_0x2a031b=_0x2a031b-0x0;var _0x102e07=_0xadb5[_0x2a031b];return _0x102e07;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 6d10eeb..25c2aca 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 _0x8fa5=['sequelize','exports','STRING','Task','ENUM','contact','account_contact_lead','account','contact_lead','nothing','lead'];(function(_0x54d80e,_0x19661e){var _0x9b8de3=function(_0xdcf68c){while(--_0xdcf68c){_0x54d80e['push'](_0x54d80e['shift']());}};_0x9b8de3(++_0x19661e);}(_0x8fa5,0xb0));var _0x58fa=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8fa5[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x58fa('0x0'));module[_0x58fa('0x1')]={'name':{'type':Sequelize[_0x58fa('0x2')]},'description':{'type':Sequelize[_0x58fa('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x58fa('0x3'),'Case'),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x58fa('0x4')]('contact_lead',_0x58fa('0x5'),'lead',_0x58fa('0x6'),_0x58fa('0x7')),'defaultValue':_0x58fa('0x8')},'moduleCreate':{'type':Sequelize[_0x58fa('0x4')](_0x58fa('0x9'),_0x58fa('0x5'),_0x58fa('0xa'),'account'),'defaultValue':_0x58fa('0xa')},'leadId':{'type':Sequelize[_0x58fa('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x58fa('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x58fa('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x58fa('0x2')]}}; \ No newline at end of file +var _0xc8d5=['account_contact_lead','account','nothing','STRING','sequelize','exports','Task','ENUM','contact_lead','contact','lead'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc8d5,0xa9));var _0x5c8d=function(_0xa141fa,_0x18ee3b){_0xa141fa=_0xa141fa-0x0;var _0x3a8a65=_0xc8d5[_0xa141fa];return _0x3a8a65;};'use strict';var Sequelize=require(_0x5c8d('0x0'));module[_0x5c8d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x5c8d('0x2'),'Case'),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x5c8d('0x3')](_0x5c8d('0x4'),_0x5c8d('0x5'),_0x5c8d('0x6'),_0x5c8d('0x7'),_0x5c8d('0x8')),'defaultValue':_0x5c8d('0x4')},'moduleCreate':{'type':Sequelize[_0x5c8d('0x3')](_0x5c8d('0x9'),_0x5c8d('0x5'),_0x5c8d('0x6'),_0x5c8d('0x8')),'defaultValue':_0x5c8d('0x6')},'leadId':{'type':Sequelize[_0x5c8d('0xa')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x5c8d('0xa')]},'additionalSearchLead':{'type':Sequelize[_0x5c8d('0xa')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 8a61560..d94722f 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 _0x7bae=['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/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','index','map','SalesforceConfiguration','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','type','merge','options','includeAll','include','catch','show','params','keys','find','create','body','destroy','getFields','findOne','SalesforceField','pick','nolimit','getSubjects','getDescriptions','zip-dir','fast-json-patch','moment','mustache','util'];(function(_0x119e54,_0x57ec00){var _0x1188e2=function(_0x1fbe6c){while(--_0x1fbe6c){_0x119e54['push'](_0x119e54['shift']());}};_0x1188e2(++_0x57ec00);}(_0x7bae,0x13b));var _0xe7ba=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0x7bae[_0x21aec3];return _0x288bbc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe7ba('0x0'));var jsonpatch=require(_0xe7ba('0x1'));var rp=require('request-promise');var moment=require(_0xe7ba('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe7ba('0x3'));var util=require(_0xe7ba('0x4'));var path=require(_0xe7ba('0x5'));var sox=require(_0xe7ba('0x6'));var csv=require(_0xe7ba('0x7'));var ejs=require(_0xe7ba('0x8'));var fs=require('fs');var fs_extra=require(_0xe7ba('0x9'));var _=require(_0xe7ba('0xa'));var squel=require(_0xe7ba('0xb'));var crypto=require(_0xe7ba('0xc'));var jsforce=require(_0xe7ba('0xd'));var deskjs=require(_0xe7ba('0xe'));var toCsv=require(_0xe7ba('0x7'));var querystring=require(_0xe7ba('0xf'));var Papa=require('papaparse');var Redis=require(_0xe7ba('0x10'));var authService=require(_0xe7ba('0x11'));var qs=require(_0xe7ba('0x12'));var as=require(_0xe7ba('0x13'));var hardwareService=require(_0xe7ba('0x14'));var logger=require(_0xe7ba('0x15'))(_0xe7ba('0x16'));var utils=require(_0xe7ba('0x17'));var config=require(_0xe7ba('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe7ba('0x19'))['db'];function respondWithStatusCode(_0x588c8b,_0x602b1){_0x602b1=_0x602b1||0xcc;return function(_0x45229c){if(_0x45229c){return _0x588c8b[_0xe7ba('0x1a')](_0x602b1);}return _0x588c8b[_0xe7ba('0x1b')](_0x602b1)[_0xe7ba('0x1c')]();};}function respondWithResult(_0x41369f,_0x561dbb){_0x561dbb=_0x561dbb||0xc8;return function(_0x561c48){if(_0x561c48){return _0x41369f[_0xe7ba('0x1b')](_0x561dbb)[_0xe7ba('0x1d')](_0x561c48);}};}function respondWithFilteredResult(_0x359f6f,_0x5d1d03){return function(_0x4390e3){if(_0x4390e3){var _0x4b20fd=typeof _0x5d1d03['offset']==='undefined'&&typeof _0x5d1d03[_0xe7ba('0x1e')]==='undefined';var _0x41a773=_0x4390e3['count'];var _0x4e3021=_0x4b20fd?0x0:_0x5d1d03['offset'];var _0x3f326a=_0x4b20fd?_0x4390e3[_0xe7ba('0x1f')]:_0x5d1d03[_0xe7ba('0x20')]+_0x5d1d03[_0xe7ba('0x1e')];var _0x1c8b5b;if(_0x3f326a>=_0x41a773){_0x3f326a=_0x41a773;_0x1c8b5b=0xc8;}else{_0x1c8b5b=0xce;}_0x359f6f['status'](_0x1c8b5b);return _0x359f6f[_0xe7ba('0x21')](_0xe7ba('0x22'),_0x4e3021+'-'+_0x3f326a+'/'+_0x41a773)[_0xe7ba('0x1d')](_0x4390e3);}return null;};}function patchUpdates(_0x136ec6){return function(_0x4aaf35){try{jsonpatch[_0xe7ba('0x23')](_0x4aaf35,_0x136ec6,!![]);}catch(_0x2936b7){return BPromise['reject'](_0x2936b7);}return _0x4aaf35[_0xe7ba('0x24')]();};}function saveUpdates(_0x4514e8,_0x27c882){return function(_0x7ab9e4){if(_0x7ab9e4){return _0x7ab9e4[_0xe7ba('0x25')](_0x4514e8)[_0xe7ba('0x26')](function(_0x293b14){return _0x293b14;});}return null;};}function removeEntity(_0x2b29f0,_0x41cbd9){return function(_0xa72f1c){if(_0xa72f1c){return _0xa72f1c['destroy']()['then'](function(){_0x2b29f0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4363a8,_0x576513){return function(_0x4ecc0d){if(!_0x4ecc0d){_0x4363a8['sendStatus'](0x194);}return _0x4ecc0d;};}function handleError(_0x255def,_0x32cc00){_0x32cc00=_0x32cc00||0x1f4;return function(_0xe32862){logger[_0xe7ba('0x27')](_0xe32862[_0xe7ba('0x28')]);if(_0xe32862[_0xe7ba('0x29')]){delete _0xe32862[_0xe7ba('0x29')];}_0x255def[_0xe7ba('0x1b')](_0x32cc00)['send'](_0xe32862);};}exports[_0xe7ba('0x2a')]=function(_0x48c869,_0x102925){var _0x92fe7={},_0x369451={},_0x4bf5f9={'count':0x0,'rows':[]};var _0x587c7d=_[_0xe7ba('0x2b')](db[_0xe7ba('0x2c')][_0xe7ba('0x2d')],function(_0x20b6cd){return{'name':_0x20b6cd[_0xe7ba('0x2e')],'type':_0x20b6cd['type'][_0xe7ba('0x2f')]};});_0x369451[_0xe7ba('0x30')]=_['map'](_0x587c7d,_0xe7ba('0x29'));_0x369451['query']=_['keys'](_0x48c869[_0xe7ba('0x31')]);_0x369451[_0xe7ba('0x32')]=_[_0xe7ba('0x33')](_0x369451['model'],_0x369451[_0xe7ba('0x31')]);_0x92fe7['attributes']=_[_0xe7ba('0x33')](_0x369451[_0xe7ba('0x30')],qs[_0xe7ba('0x34')](_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x34')]));_0x92fe7['attributes']=_0x92fe7[_0xe7ba('0x35')][_0xe7ba('0x36')]?_0x92fe7['attributes']:_0x369451[_0xe7ba('0x30')];if(!_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x37')]('nolimit')){_0x92fe7[_0xe7ba('0x1e')]=qs[_0xe7ba('0x1e')](_0x48c869['query'][_0xe7ba('0x1e')]);_0x92fe7[_0xe7ba('0x20')]=qs[_0xe7ba('0x20')](_0x48c869['query'][_0xe7ba('0x20')]);}_0x92fe7[_0xe7ba('0x38')]=qs['sort'](_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x39')]);_0x92fe7[_0xe7ba('0x3a')]=qs['filters'](_['pick'](_0x48c869[_0xe7ba('0x31')],_0x369451[_0xe7ba('0x32')]),_0x587c7d);if(_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x3b')]){_0x92fe7[_0xe7ba('0x3a')]=_['merge'](_0x92fe7[_0xe7ba('0x3a')],{'$or':_[_0xe7ba('0x2b')](_0x587c7d,function(_0x3139a6){if(_0x3139a6[_0xe7ba('0x3c')]!=='VIRTUAL'){var _0xe67917={};_0xe67917[_0x3139a6[_0xe7ba('0x29')]]={'$like':'%'+_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x3b')]+'%'};return _0xe67917;}})});}_0x92fe7=_[_0xe7ba('0x3d')]({},_0x92fe7,_0x48c869[_0xe7ba('0x3e')]);var _0x124cc4={'where':_0x92fe7['where']};return db[_0xe7ba('0x2c')][_0xe7ba('0x1f')](_0x124cc4)[_0xe7ba('0x26')](function(_0x401b0a){_0x4bf5f9[_0xe7ba('0x1f')]=_0x401b0a;if(_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x3f')]){_0x92fe7[_0xe7ba('0x40')]=[{'all':!![]}];}return db[_0xe7ba('0x2c')]['findAll'](_0x92fe7);})[_0xe7ba('0x26')](function(_0x417734){_0x4bf5f9['rows']=_0x417734;return _0x4bf5f9;})['then'](respondWithFilteredResult(_0x102925,_0x92fe7))[_0xe7ba('0x41')](handleError(_0x102925,null));};exports[_0xe7ba('0x42')]=function(_0x368af2,_0x5589c4){var _0x249e1d={'raw':![],'where':{'id':_0x368af2[_0xe7ba('0x43')]['id']}},_0x82246e={};_0x82246e[_0xe7ba('0x30')]=_[_0xe7ba('0x44')](db['SalesforceConfiguration'][_0xe7ba('0x2d')]);_0x82246e['query']=_[_0xe7ba('0x44')](_0x368af2[_0xe7ba('0x31')]);_0x82246e[_0xe7ba('0x32')]=_[_0xe7ba('0x33')](_0x82246e[_0xe7ba('0x30')],_0x82246e[_0xe7ba('0x31')]);_0x249e1d[_0xe7ba('0x35')]=_[_0xe7ba('0x33')](_0x82246e['model'],qs[_0xe7ba('0x34')](_0x368af2[_0xe7ba('0x31')][_0xe7ba('0x34')]));_0x249e1d[_0xe7ba('0x35')]=_0x249e1d[_0xe7ba('0x35')][_0xe7ba('0x36')]?_0x249e1d[_0xe7ba('0x35')]:_0x82246e[_0xe7ba('0x30')];if(_0x368af2[_0xe7ba('0x31')][_0xe7ba('0x3f')]){_0x249e1d['include']=[{'all':!![]}];}_0x249e1d=_[_0xe7ba('0x3d')]({},_0x249e1d,_0x368af2['options']);return db[_0xe7ba('0x2c')][_0xe7ba('0x45')](_0x249e1d)[_0xe7ba('0x26')](handleEntityNotFound(_0x5589c4,null))[_0xe7ba('0x26')](respondWithResult(_0x5589c4,null))[_0xe7ba('0x41')](handleError(_0x5589c4,null));};exports[_0xe7ba('0x46')]=function(_0x48ae57,_0x271592){return db[_0xe7ba('0x2c')][_0xe7ba('0x46')](_0x48ae57[_0xe7ba('0x47')],{})[_0xe7ba('0x26')](respondWithResult(_0x271592,0xc9))[_0xe7ba('0x41')](handleError(_0x271592,null));};exports[_0xe7ba('0x25')]=function(_0x266ace,_0x272cb9){if(_0x266ace[_0xe7ba('0x47')]['id']){delete _0x266ace[_0xe7ba('0x47')]['id'];}return db['SalesforceConfiguration'][_0xe7ba('0x45')]({'where':{'id':_0x266ace[_0xe7ba('0x43')]['id']}})[_0xe7ba('0x26')](handleEntityNotFound(_0x272cb9,null))[_0xe7ba('0x26')](saveUpdates(_0x266ace[_0xe7ba('0x47')],null))[_0xe7ba('0x26')](respondWithResult(_0x272cb9,null))['catch'](handleError(_0x272cb9,null));};exports[_0xe7ba('0x48')]=function(_0x3ee828,_0x520477){return db[_0xe7ba('0x2c')][_0xe7ba('0x45')]({'where':{'id':_0x3ee828[_0xe7ba('0x43')]['id']}})[_0xe7ba('0x26')](handleEntityNotFound(_0x520477,null))['then'](removeEntity(_0x520477,null))['catch'](handleError(_0x520477,null));};exports[_0xe7ba('0x49')]=function(_0x2cfdc3,_0x285743,_0x5af106){var _0x1d4e16={};var _0x365573={};var _0x377877;var _0x45bcbd;return db[_0xe7ba('0x2c')][_0xe7ba('0x4a')]({'where':{'id':_0x2cfdc3[_0xe7ba('0x43')]['id']}})['then'](handleEntityNotFound(_0x285743,null))[_0xe7ba('0x26')](function(_0x419d16){if(_0x419d16){_0x377877=_0x419d16;_0x365573[_0xe7ba('0x30')]=_['keys'](db[_0xe7ba('0x4b')][_0xe7ba('0x2d')]);_0x365573['query']=_[_0xe7ba('0x44')](_0x2cfdc3[_0xe7ba('0x31')]);_0x365573['filters']=_[_0xe7ba('0x33')](_0x365573['model'],_0x365573[_0xe7ba('0x31')]);_0x1d4e16[_0xe7ba('0x35')]=_[_0xe7ba('0x33')](_0x365573['model'],qs[_0xe7ba('0x34')](_0x2cfdc3[_0xe7ba('0x31')][_0xe7ba('0x34')]));_0x1d4e16[_0xe7ba('0x35')]=_0x1d4e16[_0xe7ba('0x35')]['length']?_0x1d4e16[_0xe7ba('0x35')]:_0x365573[_0xe7ba('0x30')];_0x1d4e16[_0xe7ba('0x38')]=qs[_0xe7ba('0x39')](_0x2cfdc3[_0xe7ba('0x31')]['sort']);_0x1d4e16[_0xe7ba('0x3a')]=qs[_0xe7ba('0x32')](_[_0xe7ba('0x4c')](_0x2cfdc3[_0xe7ba('0x31')],_0x365573['filters']));if(_0x2cfdc3[_0xe7ba('0x31')][_0xe7ba('0x3b')]){_0x1d4e16[_0xe7ba('0x3a')]=_[_0xe7ba('0x3d')](_0x1d4e16[_0xe7ba('0x3a')],{'$or':_[_0xe7ba('0x2b')](_0x1d4e16['attributes'],function(_0x1599e3){var _0x103762={};_0x103762[_0x1599e3]={'$like':'%'+_0x2cfdc3[_0xe7ba('0x31')]['filter']+'%'};return _0x103762;})});}_0x1d4e16=_[_0xe7ba('0x3d')]({},_0x1d4e16,_0x2cfdc3[_0xe7ba('0x3e')]);return _0x377877[_0xe7ba('0x49')](_0x1d4e16);}})[_0xe7ba('0x26')](function(_0x45fb0f){if(_0x45fb0f){_0x45bcbd=_0x45fb0f[_0xe7ba('0x36')];if(!_0x2cfdc3[_0xe7ba('0x31')][_0xe7ba('0x37')](_0xe7ba('0x4d'))){_0x1d4e16[_0xe7ba('0x1e')]=qs[_0xe7ba('0x1e')](_0x2cfdc3[_0xe7ba('0x31')]['limit']);_0x1d4e16[_0xe7ba('0x20')]=qs[_0xe7ba('0x20')](_0x2cfdc3[_0xe7ba('0x31')]['offset']);}return _0x377877[_0xe7ba('0x49')](_0x1d4e16);}})['then'](function(_0x466529){if(_0x466529){return _0x466529?{'count':_0x45bcbd,'rows':_0x466529}:null;}})[_0xe7ba('0x26')](respondWithResult(_0x285743,null))[_0xe7ba('0x41')](handleError(_0x285743,null));};exports['getSubjects']=function(_0x5ca033,_0x46d06e,_0x2812af){var _0x2c052b={};var _0x4de4c9={};var _0x3ba4fd;var _0x6866ef;return db[_0xe7ba('0x2c')][_0xe7ba('0x4a')]({'where':{'id':_0x5ca033[_0xe7ba('0x43')]['id']}})['then'](handleEntityNotFound(_0x46d06e,null))[_0xe7ba('0x26')](function(_0x205537){if(_0x205537){_0x3ba4fd=_0x205537;_0x4de4c9[_0xe7ba('0x30')]=_['keys'](db[_0xe7ba('0x4b')][_0xe7ba('0x2d')]);_0x4de4c9[_0xe7ba('0x31')]=_[_0xe7ba('0x44')](_0x5ca033[_0xe7ba('0x31')]);_0x4de4c9[_0xe7ba('0x32')]=_[_0xe7ba('0x33')](_0x4de4c9[_0xe7ba('0x30')],_0x4de4c9[_0xe7ba('0x31')]);_0x2c052b[_0xe7ba('0x35')]=_['intersection'](_0x4de4c9[_0xe7ba('0x30')],qs[_0xe7ba('0x34')](_0x5ca033[_0xe7ba('0x31')][_0xe7ba('0x34')]));_0x2c052b['attributes']=_0x2c052b['attributes'][_0xe7ba('0x36')]?_0x2c052b[_0xe7ba('0x35')]:_0x4de4c9[_0xe7ba('0x30')];_0x2c052b['order']=qs['sort'](_0x5ca033['query'][_0xe7ba('0x39')]);_0x2c052b[_0xe7ba('0x3a')]=qs['filters'](_[_0xe7ba('0x4c')](_0x5ca033['query'],_0x4de4c9[_0xe7ba('0x32')]));if(_0x5ca033['query'][_0xe7ba('0x3b')]){_0x2c052b['where']=_['merge'](_0x2c052b[_0xe7ba('0x3a')],{'$or':_[_0xe7ba('0x2b')](_0x2c052b[_0xe7ba('0x35')],function(_0x2b96e9){var _0x157d41={};_0x157d41[_0x2b96e9]={'$like':'%'+_0x5ca033[_0xe7ba('0x31')]['filter']+'%'};return _0x157d41;})});}_0x2c052b=_['merge']({},_0x2c052b,_0x5ca033[_0xe7ba('0x3e')]);return _0x3ba4fd[_0xe7ba('0x4e')](_0x2c052b);}})[_0xe7ba('0x26')](function(_0x2e6e90){if(_0x2e6e90){_0x6866ef=_0x2e6e90[_0xe7ba('0x36')];if(!_0x5ca033[_0xe7ba('0x31')][_0xe7ba('0x37')](_0xe7ba('0x4d'))){_0x2c052b[_0xe7ba('0x1e')]=qs[_0xe7ba('0x1e')](_0x5ca033[_0xe7ba('0x31')][_0xe7ba('0x1e')]);_0x2c052b[_0xe7ba('0x20')]=qs[_0xe7ba('0x20')](_0x5ca033[_0xe7ba('0x31')]['offset']);}return _0x3ba4fd[_0xe7ba('0x4e')](_0x2c052b);}})[_0xe7ba('0x26')](function(_0x5e16f1){if(_0x5e16f1){return _0x5e16f1?{'count':_0x6866ef,'rows':_0x5e16f1}:null;}})[_0xe7ba('0x26')](respondWithResult(_0x46d06e,null))[_0xe7ba('0x41')](handleError(_0x46d06e,null));};exports[_0xe7ba('0x4f')]=function(_0x2471c8,_0x11ca03,_0x2044db){var _0x24c94a={};var _0x418831={};var _0x14dc58;var _0x5a1372;return db[_0xe7ba('0x2c')]['findOne']({'where':{'id':_0x2471c8[_0xe7ba('0x43')]['id']}})[_0xe7ba('0x26')](handleEntityNotFound(_0x11ca03,null))[_0xe7ba('0x26')](function(_0x53187a){if(_0x53187a){_0x14dc58=_0x53187a;_0x418831[_0xe7ba('0x30')]=_[_0xe7ba('0x44')](db[_0xe7ba('0x4b')][_0xe7ba('0x2d')]);_0x418831['query']=_[_0xe7ba('0x44')](_0x2471c8[_0xe7ba('0x31')]);_0x418831[_0xe7ba('0x32')]=_[_0xe7ba('0x33')](_0x418831['model'],_0x418831[_0xe7ba('0x31')]);_0x24c94a[_0xe7ba('0x35')]=_[_0xe7ba('0x33')](_0x418831[_0xe7ba('0x30')],qs[_0xe7ba('0x34')](_0x2471c8['query']['fields']));_0x24c94a['attributes']=_0x24c94a[_0xe7ba('0x35')][_0xe7ba('0x36')]?_0x24c94a[_0xe7ba('0x35')]:_0x418831[_0xe7ba('0x30')];_0x24c94a[_0xe7ba('0x38')]=qs[_0xe7ba('0x39')](_0x2471c8['query'][_0xe7ba('0x39')]);_0x24c94a['where']=qs[_0xe7ba('0x32')](_[_0xe7ba('0x4c')](_0x2471c8[_0xe7ba('0x31')],_0x418831[_0xe7ba('0x32')]));if(_0x2471c8[_0xe7ba('0x31')][_0xe7ba('0x3b')]){_0x24c94a['where']=_[_0xe7ba('0x3d')](_0x24c94a[_0xe7ba('0x3a')],{'$or':_[_0xe7ba('0x2b')](_0x24c94a[_0xe7ba('0x35')],function(_0x1d3035){var _0x5e70d9={};_0x5e70d9[_0x1d3035]={'$like':'%'+_0x2471c8[_0xe7ba('0x31')]['filter']+'%'};return _0x5e70d9;})});}_0x24c94a=_[_0xe7ba('0x3d')]({},_0x24c94a,_0x2471c8[_0xe7ba('0x3e')]);return _0x14dc58[_0xe7ba('0x4f')](_0x24c94a);}})[_0xe7ba('0x26')](function(_0x43322f){if(_0x43322f){_0x5a1372=_0x43322f[_0xe7ba('0x36')];if(!_0x2471c8[_0xe7ba('0x31')][_0xe7ba('0x37')](_0xe7ba('0x4d'))){_0x24c94a[_0xe7ba('0x1e')]=qs[_0xe7ba('0x1e')](_0x2471c8[_0xe7ba('0x31')][_0xe7ba('0x1e')]);_0x24c94a[_0xe7ba('0x20')]=qs[_0xe7ba('0x20')](_0x2471c8[_0xe7ba('0x31')][_0xe7ba('0x20')]);}return _0x14dc58[_0xe7ba('0x4f')](_0x24c94a);}})[_0xe7ba('0x26')](function(_0x1b39b7){if(_0x1b39b7){return _0x1b39b7?{'count':_0x5a1372,'rows':_0x1b39b7}:null;}})[_0xe7ba('0x26')](respondWithResult(_0x11ca03,null))[_0xe7ba('0x41')](handleError(_0x11ca03,null));}; \ No newline at end of file +var _0x5693=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','update','then','destroy','error','name','index','map','SalesforceConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filter','type','VIRTUAL','options','count','includeAll','include','rows','show','params','catch','create','body','find','getFields','findOne','sort','SalesforceField','pick','merge','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x3d93aa,_0x48da03){var _0x3ac67c=function(_0x18c0f1){while(--_0x18c0f1){_0x3d93aa['push'](_0x3d93aa['shift']());}};_0x3ac67c(++_0x48da03);}(_0x5693,0x1d2));var _0x3569=function(_0x79544e,_0x592c7e){_0x79544e=_0x79544e-0x0;var _0x5b553b=_0x5693[_0x79544e];return _0x5b553b;};'use strict';var emlformat=require(_0x3569('0x0'));var rimraf=require(_0x3569('0x1'));var zipdir=require(_0x3569('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3569('0x3'));var moment=require(_0x3569('0x4'));var BPromise=require(_0x3569('0x5'));var Mustache=require('mustache');var util=require(_0x3569('0x6'));var path=require(_0x3569('0x7'));var sox=require('sox');var csv=require(_0x3569('0x8'));var ejs=require(_0x3569('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3569('0xa'));var squel=require(_0x3569('0xb'));var crypto=require(_0x3569('0xc'));var jsforce=require(_0x3569('0xd'));var deskjs=require(_0x3569('0xe'));var toCsv=require(_0x3569('0x8'));var querystring=require(_0x3569('0xf'));var Papa=require(_0x3569('0x10'));var Redis=require(_0x3569('0x11'));var authService=require(_0x3569('0x12'));var qs=require(_0x3569('0x13'));var as=require(_0x3569('0x14'));var hardwareService=require(_0x3569('0x15'));var logger=require('../../config/logger')(_0x3569('0x16'));var utils=require('../../config/utils');var config=require(_0x3569('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3569('0x18'))['db'];function respondWithStatusCode(_0x1f2ba3,_0x14a3ac){_0x14a3ac=_0x14a3ac||0xcc;return function(_0x449312){if(_0x449312){return _0x1f2ba3[_0x3569('0x19')](_0x14a3ac);}return _0x1f2ba3[_0x3569('0x1a')](_0x14a3ac)[_0x3569('0x1b')]();};}function respondWithResult(_0x9aae69,_0x394df2){_0x394df2=_0x394df2||0xc8;return function(_0x16dc27){if(_0x16dc27){return _0x9aae69[_0x3569('0x1a')](_0x394df2)[_0x3569('0x1c')](_0x16dc27);}};}function respondWithFilteredResult(_0x521adc,_0x1ea429){return function(_0x2f6e52){if(_0x2f6e52){var _0x41ff9f=typeof _0x1ea429[_0x3569('0x1d')]===_0x3569('0x1e')&&typeof _0x1ea429['limit']===_0x3569('0x1e');var _0x2a3a7c=_0x2f6e52['count'];var _0x764f7b=_0x41ff9f?0x0:_0x1ea429[_0x3569('0x1d')];var _0xf470f8=_0x41ff9f?_0x2f6e52['count']:_0x1ea429[_0x3569('0x1d')]+_0x1ea429[_0x3569('0x1f')];var _0x5c2be2;if(_0xf470f8>=_0x2a3a7c){_0xf470f8=_0x2a3a7c;_0x5c2be2=0xc8;}else{_0x5c2be2=0xce;}_0x521adc[_0x3569('0x1a')](_0x5c2be2);return _0x521adc[_0x3569('0x20')]('Content-Range',_0x764f7b+'-'+_0xf470f8+'/'+_0x2a3a7c)[_0x3569('0x1c')](_0x2f6e52);}return null;};}function patchUpdates(_0x4da8b4){return function(_0x2f5fd0){try{jsonpatch[_0x3569('0x21')](_0x2f5fd0,_0x4da8b4,!![]);}catch(_0x21b9e2){return BPromise[_0x3569('0x22')](_0x21b9e2);}return _0x2f5fd0['save']();};}function saveUpdates(_0x673ed,_0x1ed5ee){return function(_0x4fa62f){if(_0x4fa62f){return _0x4fa62f[_0x3569('0x23')](_0x673ed)[_0x3569('0x24')](function(_0xac83b2){return _0xac83b2;});}return null;};}function removeEntity(_0xbdd5aa,_0x32be9a){return function(_0x3ade23){if(_0x3ade23){return _0x3ade23[_0x3569('0x25')]()[_0x3569('0x24')](function(){_0xbdd5aa[_0x3569('0x1a')](0xcc)[_0x3569('0x1b')]();});}};}function handleEntityNotFound(_0x5e9716,_0xffaed0){return function(_0x108d1b){if(!_0x108d1b){_0x5e9716[_0x3569('0x19')](0x194);}return _0x108d1b;};}function handleError(_0xc7a793,_0x38be77){_0x38be77=_0x38be77||0x1f4;return function(_0x3d8191){logger[_0x3569('0x26')](_0x3d8191['stack']);if(_0x3d8191[_0x3569('0x27')]){delete _0x3d8191[_0x3569('0x27')];}_0xc7a793[_0x3569('0x1a')](_0x38be77)['send'](_0x3d8191);};}exports[_0x3569('0x28')]=function(_0xb60778,_0x292cd9){var _0x34339d={},_0x37eecd={},_0x1ed4e1={'count':0x0,'rows':[]};var _0x3000ff=_[_0x3569('0x29')](db[_0x3569('0x2a')][_0x3569('0x2b')],function(_0x35c896){return{'name':_0x35c896[_0x3569('0x2c')],'type':_0x35c896['type'][_0x3569('0x2d')]};});_0x37eecd[_0x3569('0x2e')]=_['map'](_0x3000ff,_0x3569('0x27'));_0x37eecd[_0x3569('0x2f')]=_[_0x3569('0x30')](_0xb60778[_0x3569('0x2f')]);_0x37eecd[_0x3569('0x31')]=_[_0x3569('0x32')](_0x37eecd[_0x3569('0x2e')],_0x37eecd[_0x3569('0x2f')]);_0x34339d['attributes']=_[_0x3569('0x32')](_0x37eecd[_0x3569('0x2e')],qs[_0x3569('0x33')](_0xb60778[_0x3569('0x2f')][_0x3569('0x33')]));_0x34339d[_0x3569('0x34')]=_0x34339d['attributes'][_0x3569('0x35')]?_0x34339d[_0x3569('0x34')]:_0x37eecd[_0x3569('0x2e')];if(!_0xb60778[_0x3569('0x2f')][_0x3569('0x36')](_0x3569('0x37'))){_0x34339d[_0x3569('0x1f')]=qs[_0x3569('0x1f')](_0xb60778['query'][_0x3569('0x1f')]);_0x34339d[_0x3569('0x1d')]=qs['offset'](_0xb60778['query'][_0x3569('0x1d')]);}_0x34339d[_0x3569('0x38')]=qs['sort'](_0xb60778[_0x3569('0x2f')]['sort']);_0x34339d[_0x3569('0x39')]=qs[_0x3569('0x31')](_['pick'](_0xb60778[_0x3569('0x2f')],_0x37eecd[_0x3569('0x31')]),_0x3000ff);if(_0xb60778[_0x3569('0x2f')][_0x3569('0x3a')]){_0x34339d[_0x3569('0x39')]=_['merge'](_0x34339d[_0x3569('0x39')],{'$or':_[_0x3569('0x29')](_0x3000ff,function(_0x1356cb){if(_0x1356cb[_0x3569('0x3b')]!==_0x3569('0x3c')){var _0x59254f={};_0x59254f[_0x1356cb[_0x3569('0x27')]]={'$like':'%'+_0xb60778[_0x3569('0x2f')][_0x3569('0x3a')]+'%'};return _0x59254f;}})});}_0x34339d=_['merge']({},_0x34339d,_0xb60778[_0x3569('0x3d')]);var _0x25017f={'where':_0x34339d[_0x3569('0x39')]};return db[_0x3569('0x2a')]['count'](_0x25017f)[_0x3569('0x24')](function(_0x5896f8){_0x1ed4e1[_0x3569('0x3e')]=_0x5896f8;if(_0xb60778['query'][_0x3569('0x3f')]){_0x34339d[_0x3569('0x40')]=[{'all':!![]}];}return db[_0x3569('0x2a')]['findAll'](_0x34339d);})[_0x3569('0x24')](function(_0x3ef191){_0x1ed4e1[_0x3569('0x41')]=_0x3ef191;return _0x1ed4e1;})[_0x3569('0x24')](respondWithFilteredResult(_0x292cd9,_0x34339d))['catch'](handleError(_0x292cd9,null));};exports[_0x3569('0x42')]=function(_0x38d88a,_0x5d3b36){var _0x163d33={'raw':![],'where':{'id':_0x38d88a[_0x3569('0x43')]['id']}},_0x562a74={};_0x562a74[_0x3569('0x2e')]=_['keys'](db[_0x3569('0x2a')][_0x3569('0x2b')]);_0x562a74[_0x3569('0x2f')]=_[_0x3569('0x30')](_0x38d88a[_0x3569('0x2f')]);_0x562a74[_0x3569('0x31')]=_[_0x3569('0x32')](_0x562a74['model'],_0x562a74[_0x3569('0x2f')]);_0x163d33[_0x3569('0x34')]=_[_0x3569('0x32')](_0x562a74[_0x3569('0x2e')],qs[_0x3569('0x33')](_0x38d88a[_0x3569('0x2f')][_0x3569('0x33')]));_0x163d33[_0x3569('0x34')]=_0x163d33[_0x3569('0x34')][_0x3569('0x35')]?_0x163d33[_0x3569('0x34')]:_0x562a74[_0x3569('0x2e')];if(_0x38d88a[_0x3569('0x2f')][_0x3569('0x3f')]){_0x163d33[_0x3569('0x40')]=[{'all':!![]}];}_0x163d33=_['merge']({},_0x163d33,_0x38d88a['options']);return db[_0x3569('0x2a')]['find'](_0x163d33)[_0x3569('0x24')](handleEntityNotFound(_0x5d3b36,null))['then'](respondWithResult(_0x5d3b36,null))[_0x3569('0x44')](handleError(_0x5d3b36,null));};exports[_0x3569('0x45')]=function(_0x25bccd,_0x5539bc){return db[_0x3569('0x2a')][_0x3569('0x45')](_0x25bccd[_0x3569('0x46')],{})[_0x3569('0x24')](respondWithResult(_0x5539bc,0xc9))['catch'](handleError(_0x5539bc,null));};exports[_0x3569('0x23')]=function(_0x1797f0,_0x5d33c3){if(_0x1797f0[_0x3569('0x46')]['id']){delete _0x1797f0[_0x3569('0x46')]['id'];}return db[_0x3569('0x2a')][_0x3569('0x47')]({'where':{'id':_0x1797f0['params']['id']}})[_0x3569('0x24')](handleEntityNotFound(_0x5d33c3,null))[_0x3569('0x24')](saveUpdates(_0x1797f0[_0x3569('0x46')],null))[_0x3569('0x24')](respondWithResult(_0x5d33c3,null))[_0x3569('0x44')](handleError(_0x5d33c3,null));};exports[_0x3569('0x25')]=function(_0x4df51f,_0xaef405){return db[_0x3569('0x2a')][_0x3569('0x47')]({'where':{'id':_0x4df51f[_0x3569('0x43')]['id']}})['then'](handleEntityNotFound(_0xaef405,null))['then'](removeEntity(_0xaef405,null))[_0x3569('0x44')](handleError(_0xaef405,null));};exports[_0x3569('0x48')]=function(_0x55b87c,_0x1936bd,_0x23db65){var _0x56b099={};var _0x49289e={};var _0x1e562c;var _0x1671fd;return db[_0x3569('0x2a')][_0x3569('0x49')]({'where':{'id':_0x55b87c[_0x3569('0x43')]['id']}})[_0x3569('0x24')](handleEntityNotFound(_0x1936bd,null))[_0x3569('0x24')](function(_0x1ec7a0){if(_0x1ec7a0){_0x1e562c=_0x1ec7a0;_0x49289e['model']=_['keys'](db['SalesforceField'][_0x3569('0x2b')]);_0x49289e[_0x3569('0x2f')]=_[_0x3569('0x30')](_0x55b87c[_0x3569('0x2f')]);_0x49289e[_0x3569('0x31')]=_[_0x3569('0x32')](_0x49289e[_0x3569('0x2e')],_0x49289e[_0x3569('0x2f')]);_0x56b099[_0x3569('0x34')]=_['intersection'](_0x49289e['model'],qs[_0x3569('0x33')](_0x55b87c['query'][_0x3569('0x33')]));_0x56b099[_0x3569('0x34')]=_0x56b099[_0x3569('0x34')]['length']?_0x56b099[_0x3569('0x34')]:_0x49289e['model'];_0x56b099[_0x3569('0x38')]=qs[_0x3569('0x4a')](_0x55b87c[_0x3569('0x2f')][_0x3569('0x4a')]);_0x56b099[_0x3569('0x39')]=qs[_0x3569('0x31')](_['pick'](_0x55b87c[_0x3569('0x2f')],_0x49289e[_0x3569('0x31')]));if(_0x55b87c[_0x3569('0x2f')]['filter']){_0x56b099[_0x3569('0x39')]=_['merge'](_0x56b099['where'],{'$or':_[_0x3569('0x29')](_0x56b099[_0x3569('0x34')],function(_0x33d2c1){var _0x25c29b={};_0x25c29b[_0x33d2c1]={'$like':'%'+_0x55b87c[_0x3569('0x2f')][_0x3569('0x3a')]+'%'};return _0x25c29b;})});}_0x56b099=_['merge']({},_0x56b099,_0x55b87c['options']);return _0x1e562c[_0x3569('0x48')](_0x56b099);}})[_0x3569('0x24')](function(_0x3ca595){if(_0x3ca595){_0x1671fd=_0x3ca595[_0x3569('0x35')];if(!_0x55b87c[_0x3569('0x2f')][_0x3569('0x36')]('nolimit')){_0x56b099[_0x3569('0x1f')]=qs[_0x3569('0x1f')](_0x55b87c[_0x3569('0x2f')][_0x3569('0x1f')]);_0x56b099['offset']=qs[_0x3569('0x1d')](_0x55b87c[_0x3569('0x2f')][_0x3569('0x1d')]);}return _0x1e562c[_0x3569('0x48')](_0x56b099);}})[_0x3569('0x24')](function(_0xf82df5){if(_0xf82df5){return _0xf82df5?{'count':_0x1671fd,'rows':_0xf82df5}:null;}})['then'](respondWithResult(_0x1936bd,null))[_0x3569('0x44')](handleError(_0x1936bd,null));};exports['getSubjects']=function(_0x1cc036,_0x5cf5bb,_0x14b00d){var _0x33d657={};var _0x57253c={};var _0xe90ebf;var _0x2f7d7d;return db[_0x3569('0x2a')]['findOne']({'where':{'id':_0x1cc036[_0x3569('0x43')]['id']}})[_0x3569('0x24')](handleEntityNotFound(_0x5cf5bb,null))[_0x3569('0x24')](function(_0x864eec){if(_0x864eec){_0xe90ebf=_0x864eec;_0x57253c[_0x3569('0x2e')]=_[_0x3569('0x30')](db[_0x3569('0x4b')]['rawAttributes']);_0x57253c['query']=_[_0x3569('0x30')](_0x1cc036[_0x3569('0x2f')]);_0x57253c[_0x3569('0x31')]=_[_0x3569('0x32')](_0x57253c[_0x3569('0x2e')],_0x57253c[_0x3569('0x2f')]);_0x33d657[_0x3569('0x34')]=_[_0x3569('0x32')](_0x57253c[_0x3569('0x2e')],qs[_0x3569('0x33')](_0x1cc036['query'][_0x3569('0x33')]));_0x33d657[_0x3569('0x34')]=_0x33d657[_0x3569('0x34')][_0x3569('0x35')]?_0x33d657[_0x3569('0x34')]:_0x57253c[_0x3569('0x2e')];_0x33d657['order']=qs[_0x3569('0x4a')](_0x1cc036['query'][_0x3569('0x4a')]);_0x33d657['where']=qs[_0x3569('0x31')](_[_0x3569('0x4c')](_0x1cc036['query'],_0x57253c[_0x3569('0x31')]));if(_0x1cc036[_0x3569('0x2f')][_0x3569('0x3a')]){_0x33d657['where']=_[_0x3569('0x4d')](_0x33d657[_0x3569('0x39')],{'$or':_['map'](_0x33d657[_0x3569('0x34')],function(_0x1ef1e7){var _0x3025d7={};_0x3025d7[_0x1ef1e7]={'$like':'%'+_0x1cc036[_0x3569('0x2f')][_0x3569('0x3a')]+'%'};return _0x3025d7;})});}_0x33d657=_['merge']({},_0x33d657,_0x1cc036['options']);return _0xe90ebf[_0x3569('0x4e')](_0x33d657);}})[_0x3569('0x24')](function(_0xd8a7b9){if(_0xd8a7b9){_0x2f7d7d=_0xd8a7b9['length'];if(!_0x1cc036['query'][_0x3569('0x36')](_0x3569('0x37'))){_0x33d657[_0x3569('0x1f')]=qs[_0x3569('0x1f')](_0x1cc036['query'][_0x3569('0x1f')]);_0x33d657['offset']=qs['offset'](_0x1cc036[_0x3569('0x2f')][_0x3569('0x1d')]);}return _0xe90ebf[_0x3569('0x4e')](_0x33d657);}})[_0x3569('0x24')](function(_0xf1e54f){if(_0xf1e54f){return _0xf1e54f?{'count':_0x2f7d7d,'rows':_0xf1e54f}:null;}})[_0x3569('0x24')](respondWithResult(_0x5cf5bb,null))[_0x3569('0x44')](handleError(_0x5cf5bb,null));};exports['getDescriptions']=function(_0x3014e5,_0x54ca24,_0x58ebb6){var _0x435bfe={};var _0x5eec4f={};var _0xca7272;var _0x304d9d;return db[_0x3569('0x2a')][_0x3569('0x49')]({'where':{'id':_0x3014e5[_0x3569('0x43')]['id']}})[_0x3569('0x24')](handleEntityNotFound(_0x54ca24,null))[_0x3569('0x24')](function(_0x1e6559){if(_0x1e6559){_0xca7272=_0x1e6559;_0x5eec4f[_0x3569('0x2e')]=_['keys'](db[_0x3569('0x4b')][_0x3569('0x2b')]);_0x5eec4f['query']=_[_0x3569('0x30')](_0x3014e5[_0x3569('0x2f')]);_0x5eec4f[_0x3569('0x31')]=_[_0x3569('0x32')](_0x5eec4f[_0x3569('0x2e')],_0x5eec4f[_0x3569('0x2f')]);_0x435bfe[_0x3569('0x34')]=_[_0x3569('0x32')](_0x5eec4f[_0x3569('0x2e')],qs[_0x3569('0x33')](_0x3014e5[_0x3569('0x2f')][_0x3569('0x33')]));_0x435bfe['attributes']=_0x435bfe[_0x3569('0x34')]['length']?_0x435bfe[_0x3569('0x34')]:_0x5eec4f['model'];_0x435bfe['order']=qs[_0x3569('0x4a')](_0x3014e5[_0x3569('0x2f')][_0x3569('0x4a')]);_0x435bfe['where']=qs[_0x3569('0x31')](_[_0x3569('0x4c')](_0x3014e5[_0x3569('0x2f')],_0x5eec4f['filters']));if(_0x3014e5[_0x3569('0x2f')][_0x3569('0x3a')]){_0x435bfe['where']=_[_0x3569('0x4d')](_0x435bfe[_0x3569('0x39')],{'$or':_[_0x3569('0x29')](_0x435bfe['attributes'],function(_0x4d37d1){var _0x5b8843={};_0x5b8843[_0x4d37d1]={'$like':'%'+_0x3014e5[_0x3569('0x2f')][_0x3569('0x3a')]+'%'};return _0x5b8843;})});}_0x435bfe=_[_0x3569('0x4d')]({},_0x435bfe,_0x3014e5[_0x3569('0x3d')]);return _0xca7272[_0x3569('0x4f')](_0x435bfe);}})['then'](function(_0x2daaa9){if(_0x2daaa9){_0x304d9d=_0x2daaa9[_0x3569('0x35')];if(!_0x3014e5[_0x3569('0x2f')][_0x3569('0x36')]('nolimit')){_0x435bfe[_0x3569('0x1f')]=qs['limit'](_0x3014e5[_0x3569('0x2f')][_0x3569('0x1f')]);_0x435bfe['offset']=qs[_0x3569('0x1d')](_0x3014e5[_0x3569('0x2f')][_0x3569('0x1d')]);}return _0xca7272['getDescriptions'](_0x435bfe);}})['then'](function(_0x361ff8){if(_0x361ff8){return _0x361ff8?{'count':_0x304d9d,'rows':_0x361ff8}:null;}})[_0x3569('0x24')](respondWithResult(_0x54ca24,null))[_0x3569('0x44')](handleError(_0x54ca24,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index fbd82ef..c451303 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 _0xdb9e=['int_salesforce_configurations','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration'];(function(_0x16d24f,_0x4686a5){var _0x3beec6=function(_0x552ae0){while(--_0x552ae0){_0x16d24f['push'](_0x16d24f['shift']());}};_0x3beec6(++_0x4686a5);}(_0xdb9e,0x12c));var _0xedb9=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xdb9e[_0x432682];return _0x463d05;};'use strict';var _=require(_0xedb9('0x0'));var util=require(_0xedb9('0x1'));var logger=require('../../config/logger')(_0xedb9('0x2'));var moment=require(_0xedb9('0x3'));var BPromise=require(_0xedb9('0x4'));var rp=require(_0xedb9('0x5'));var fs=require('fs');var path=require(_0xedb9('0x6'));var rimraf=require(_0xedb9('0x7'));var config=require(_0xedb9('0x8'));var attributes=require(_0xedb9('0x9'));module[_0xedb9('0xa')]=function(_0x159a7c,_0x23943b){return _0x159a7c['define'](_0xedb9('0xb'),attributes,{'tableName':_0xedb9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa063=['path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x5f0225,_0x52631a){var _0x2cef4b=function(_0x5a29c6){while(--_0x5a29c6){_0x5f0225['push'](_0x5f0225['shift']());}};_0x2cef4b(++_0x52631a);}(_0xa063,0x125));var _0x3a06=function(_0x576778,_0x17bb1f){_0x576778=_0x576778-0x0;var _0x2fb51f=_0xa063[_0x576778];return _0x2fb51f;};'use strict';var _=require(_0x3a06('0x0'));var util=require(_0x3a06('0x1'));var logger=require(_0x3a06('0x2'))(_0x3a06('0x3'));var moment=require(_0x3a06('0x4'));var BPromise=require('bluebird');var rp=require(_0x3a06('0x5'));var fs=require('fs');var path=require(_0x3a06('0x6'));var rimraf=require(_0x3a06('0x7'));var config=require(_0x3a06('0x8'));var attributes=require(_0x3a06('0x9'));module[_0x3a06('0xa')]=function(_0x1afb93,_0x2a92d0){return _0x1afb93['define'](_0x3a06('0xb'),attributes,{'tableName':_0x3a06('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 8553ac0..2035c1c 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 _0xb5da=['debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x18adcd,_0x2932af){var _0xf6cb6f=function(_0x101210){while(--_0x101210){_0x18adcd['push'](_0x18adcd['shift']());}};_0xf6cb6f(++_0x2932af);}(_0xb5da,0xd7));var _0xab5d=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xb5da[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0xab5d('0x0'));var moment=require(_0xab5d('0x1'));var BPromise=require(_0xab5d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab5d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xab5d('0x4'))(_0xab5d('0x5'));var config=require(_0xab5d('0x6'));var jayson=require(_0xab5d('0x7'));var client=jayson[_0xab5d('0x8')][_0xab5d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x484a35,_0x353579,_0x535359){return new BPromise(function(_0x420e47,_0x369e85){return client['request'](_0x484a35,_0x535359)['then'](function(_0x461801){logger[_0xab5d('0xa')](_0xab5d('0xb'),_0x353579,_0xab5d('0xc'));logger[_0xab5d('0xd')](_0xab5d('0xe'),_0x353579,_0xab5d('0xc'),JSON[_0xab5d('0xf')](_0x461801));if(_0x461801['error']){if(_0x461801[_0xab5d('0x10')][_0xab5d('0x11')]===0x1f4){logger[_0xab5d('0x10')](_0xab5d('0xb'),_0x353579,_0x461801[_0xab5d('0x10')]['message']);return _0x369e85(_0x461801[_0xab5d('0x10')][_0xab5d('0x12')]);}logger[_0xab5d('0x10')](_0xab5d('0xb'),_0x353579,_0x461801[_0xab5d('0x10')][_0xab5d('0x12')]);return _0x420e47(_0x461801['error'][_0xab5d('0x12')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x353579,'request\x20sent');_0x420e47(_0x461801['result'][_0xab5d('0x12')]);}})['catch'](function(_0x290b17){logger[_0xab5d('0x10')](_0xab5d('0xb'),_0x353579,_0x290b17);_0x369e85(_0x290b17);});});} \ No newline at end of file +var _0x2fec=['../../config/logger','../../config/environment','jayson/promise','client','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x49deb6,_0x24fac1){var _0x5815a6=function(_0x5500e5){while(--_0x5500e5){_0x49deb6['push'](_0x49deb6['shift']());}};_0x5815a6(++_0x24fac1);}(_0x2fec,0x13e));var _0xc2fe=function(_0x2c0c0c,_0x471e08){_0x2c0c0c=_0x2c0c0c-0x0;var _0x56a90e=_0x2fec[_0x2c0c0c];return _0x56a90e;};'use strict';var _=require('lodash');var util=require(_0xc2fe('0x0'));var moment=require(_0xc2fe('0x1'));var BPromise=require(_0xc2fe('0x2'));var rs=require(_0xc2fe('0x3'));var fs=require('fs');var Redis=require(_0xc2fe('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc2fe('0x5'))('rpc');var config=require(_0xc2fe('0x6'));var jayson=require(_0xc2fe('0x7'));var client=jayson[_0xc2fe('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x493dcb,_0xbccc84,_0x486550){return new BPromise(function(_0x472235,_0x5dd602){return client['request'](_0x493dcb,_0x486550)[_0xc2fe('0x9')](function(_0x2b2cf7){logger['info'](_0xc2fe('0xa'),_0xbccc84,_0xc2fe('0xb'));logger['debug'](_0xc2fe('0xc'),_0xbccc84,_0xc2fe('0xb'),JSON[_0xc2fe('0xd')](_0x2b2cf7));if(_0x2b2cf7[_0xc2fe('0xe')]){if(_0x2b2cf7[_0xc2fe('0xe')][_0xc2fe('0xf')]===0x1f4){logger[_0xc2fe('0xe')](_0xc2fe('0xa'),_0xbccc84,_0x2b2cf7[_0xc2fe('0xe')][_0xc2fe('0x10')]);return _0x5dd602(_0x2b2cf7[_0xc2fe('0xe')][_0xc2fe('0x10')]);}logger[_0xc2fe('0xe')](_0xc2fe('0xa'),_0xbccc84,_0x2b2cf7['error'][_0xc2fe('0x10')]);return _0x472235(_0x2b2cf7[_0xc2fe('0xe')][_0xc2fe('0x10')]);}else{logger[_0xc2fe('0x11')](_0xc2fe('0xa'),_0xbccc84,_0xc2fe('0xb'));_0x472235(_0x2b2cf7['result'][_0xc2fe('0x10')]);}})[_0xc2fe('0x12')](function(_0x18a7f3){logger[_0xc2fe('0xe')](_0xc2fe('0xa'),_0xbccc84,_0x18a7f3);_0x5dd602(_0x18a7f3);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 29242ef..174096a 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 _0xa510=['get','index','/:id','show','post','isAuthenticated','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller'];(function(_0x42cc54,_0x35d95a){var _0x4461c=function(_0x4f7d6e){while(--_0x4f7d6e){_0x42cc54['push'](_0x42cc54['shift']());}};_0x4461c(++_0x35d95a);}(_0xa510,0x73));var _0x0a51=function(_0xa64eb7,_0x1053b2){_0xa64eb7=_0xa64eb7-0x0;var _0x10b7f7=_0xa510[_0xa64eb7];return _0x10b7f7;};'use strict';var multer=require(_0x0a51('0x0'));var util=require(_0x0a51('0x1'));var path=require(_0x0a51('0x2'));var timeout=require(_0x0a51('0x3'));var express=require(_0x0a51('0x4'));var router=express[_0x0a51('0x5')]();var fs_extra=require(_0x0a51('0x6'));var auth=require(_0x0a51('0x7'));var interaction=require(_0x0a51('0x8'));var config=require(_0x0a51('0x9'));var controller=require(_0x0a51('0xa'));router[_0x0a51('0xb')]('/',auth['isAuthenticated'](),controller[_0x0a51('0xc')]);router['get'](_0x0a51('0xd'),auth['isAuthenticated'](),controller[_0x0a51('0xe')]);router[_0x0a51('0xf')]('/',auth[_0x0a51('0x10')](),controller[_0x0a51('0x11')]);router['put'](_0x0a51('0xd'),auth[_0x0a51('0x10')](),controller[_0x0a51('0x12')]);router[_0x0a51('0x13')](_0x0a51('0xd'),auth[_0x0a51('0x10')](),controller['destroy']);module[_0x0a51('0x14')]=router; \ No newline at end of file +var _0xeb55=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0xb7a459,_0xc13228){var _0x104ab5=function(_0x186a0e){while(--_0x186a0e){_0xb7a459['push'](_0xb7a459['shift']());}};_0x104ab5(++_0xc13228);}(_0xeb55,0x18d));var _0x5eb5=function(_0x2e600a,_0x170b49){_0x2e600a=_0x2e600a-0x0;var _0x22a269=_0xeb55[_0x2e600a];return _0x22a269;};'use strict';var multer=require(_0x5eb5('0x0'));var util=require(_0x5eb5('0x1'));var path=require(_0x5eb5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x5eb5('0x3'));var auth=require(_0x5eb5('0x4'));var interaction=require(_0x5eb5('0x5'));var config=require(_0x5eb5('0x6'));var controller=require(_0x5eb5('0x7'));router[_0x5eb5('0x8')]('/',auth[_0x5eb5('0x9')](),controller[_0x5eb5('0xa')]);router['get'](_0x5eb5('0xb'),auth[_0x5eb5('0x9')](),controller[_0x5eb5('0xc')]);router[_0x5eb5('0xd')]('/',auth[_0x5eb5('0x9')](),controller[_0x5eb5('0xe')]);router[_0x5eb5('0xf')](_0x5eb5('0xb'),auth['isAuthenticated'](),controller[_0x5eb5('0x10')]);router[_0x5eb5('0x11')](_0x5eb5('0xb'),auth[_0x5eb5('0x9')](),controller[_0x5eb5('0x12')]);module[_0x5eb5('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 92f557c..a5dc6cc 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 _0x61c2=['variable','customVariable','picklist','string','STRING','sequelize','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x61c2,0xd7));var _0x261c=function(_0x1e24e3,_0x2b5c76){_0x1e24e3=_0x1e24e3-0x0;var _0x4b8b84=_0x61c2[_0x1e24e3];return _0x4b8b84;};'use strict';var Sequelize=require(_0x261c('0x0'));module['exports']={'type':{'type':Sequelize[_0x261c('0x1')]('string',_0x261c('0x2'),_0x261c('0x3'),'keyValue',_0x261c('0x4')),'defaultValue':_0x261c('0x5')},'content':{'type':Sequelize[_0x261c('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x261c('0x1')]('string','variable',_0x261c('0x3'))},'keyContent':{'type':Sequelize[_0x261c('0x6')]},'idField':{'type':Sequelize[_0x261c('0x6')]},'variableName':{'type':Sequelize[_0x261c('0x6')]}}; \ No newline at end of file +var _0x516c=['customVariable','sequelize','ENUM','string','variable','keyValue','picklist','STRING'];(function(_0x3b5f25,_0x253d54){var _0x3da074=function(_0x2efe7e){while(--_0x2efe7e){_0x3b5f25['push'](_0x3b5f25['shift']());}};_0x3da074(++_0x253d54);}(_0x516c,0x181));var _0xc516=function(_0x50ed6e,_0x4d74e9){_0x50ed6e=_0x50ed6e-0x0;var _0x265350=_0x516c[_0x50ed6e];return _0x265350;};'use strict';var Sequelize=require(_0xc516('0x0'));module['exports']={'type':{'type':Sequelize[_0xc516('0x1')](_0xc516('0x2'),_0xc516('0x3'),'customVariable',_0xc516('0x4'),_0xc516('0x5')),'defaultValue':_0xc516('0x2')},'content':{'type':Sequelize[_0xc516('0x6')]},'key':{'type':Sequelize[_0xc516('0x6')]},'keyType':{'type':Sequelize[_0xc516('0x1')](_0xc516('0x2'),'variable',_0xc516('0x7'))},'keyContent':{'type':Sequelize[_0xc516('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 66aa589..9bc6511 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 _0x0f4f=['request-promise','moment','bluebird','mustache','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','error','stack','index','map','SalesforceField','rawAttributes','type','key','model','name','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','destroy','rimraf','zip-dir','fast-json-patch'];(function(_0x1551af,_0x5223c3){var _0xd8eb82=function(_0x4b133a){while(--_0x4b133a){_0x1551af['push'](_0x1551af['shift']());}};_0xd8eb82(++_0x5223c3);}(_0x0f4f,0x16a));var _0xf0f4=function(_0x27a4e0,_0x4816f5){_0x27a4e0=_0x27a4e0-0x0;var _0x2b57c7=_0x0f4f[_0x27a4e0];return _0x2b57c7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf0f4('0x0'));var zipdir=require(_0xf0f4('0x1'));var jsonpatch=require(_0xf0f4('0x2'));var rp=require(_0xf0f4('0x3'));var moment=require(_0xf0f4('0x4'));var BPromise=require(_0xf0f4('0x5'));var Mustache=require(_0xf0f4('0x6'));var util=require('util');var path=require(_0xf0f4('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf0f4('0x8'));var fs=require('fs');var fs_extra=require(_0xf0f4('0x9'));var _=require('lodash');var squel=require(_0xf0f4('0xa'));var crypto=require(_0xf0f4('0xb'));var jsforce=require(_0xf0f4('0xc'));var deskjs=require(_0xf0f4('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf0f4('0xe'));var Redis=require(_0xf0f4('0xf'));var authService=require(_0xf0f4('0x10'));var qs=require(_0xf0f4('0x11'));var as=require(_0xf0f4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf0f4('0x13'));var config=require(_0xf0f4('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xf0f4('0x15'))['db'];function respondWithStatusCode(_0x5793a2,_0x408d60){_0x408d60=_0x408d60||0xcc;return function(_0x5b9313){if(_0x5b9313){return _0x5793a2[_0xf0f4('0x16')](_0x408d60);}return _0x5793a2[_0xf0f4('0x17')](_0x408d60)[_0xf0f4('0x18')]();};}function respondWithResult(_0x4a29c,_0x33b2b3){_0x33b2b3=_0x33b2b3||0xc8;return function(_0x2c2878){if(_0x2c2878){return _0x4a29c[_0xf0f4('0x17')](_0x33b2b3)['json'](_0x2c2878);}};}function respondWithFilteredResult(_0x2d263e,_0x3f988f){return function(_0x39557a){if(_0x39557a){var _0x1882eb=typeof _0x3f988f['offset']===_0xf0f4('0x19')&&typeof _0x3f988f[_0xf0f4('0x1a')]===_0xf0f4('0x19');var _0x31f5a6=_0x39557a[_0xf0f4('0x1b')];var _0x3797c8=_0x1882eb?0x0:_0x3f988f[_0xf0f4('0x1c')];var _0x32ca78=_0x1882eb?_0x39557a[_0xf0f4('0x1b')]:_0x3f988f[_0xf0f4('0x1c')]+_0x3f988f[_0xf0f4('0x1a')];var _0x38090e;if(_0x32ca78>=_0x31f5a6){_0x32ca78=_0x31f5a6;_0x38090e=0xc8;}else{_0x38090e=0xce;}_0x2d263e['status'](_0x38090e);return _0x2d263e[_0xf0f4('0x1d')](_0xf0f4('0x1e'),_0x3797c8+'-'+_0x32ca78+'/'+_0x31f5a6)[_0xf0f4('0x1f')](_0x39557a);}return null;};}function patchUpdates(_0x57abfe){return function(_0x1df188){try{jsonpatch[_0xf0f4('0x20')](_0x1df188,_0x57abfe,!![]);}catch(_0x3f6476){return BPromise[_0xf0f4('0x21')](_0x3f6476);}return _0x1df188[_0xf0f4('0x22')]();};}function saveUpdates(_0x2af4d9,_0x10a5ae){return function(_0x3db898){if(_0x3db898){return _0x3db898[_0xf0f4('0x23')](_0x2af4d9)[_0xf0f4('0x24')](function(_0x216df6){return _0x216df6;});}return null;};}function removeEntity(_0x4c6ea4,_0x1f72d2){return function(_0x4ecaef){if(_0x4ecaef){return _0x4ecaef['destroy']()[_0xf0f4('0x24')](function(){_0x4c6ea4['status'](0xcc)[_0xf0f4('0x18')]();});}};}function handleEntityNotFound(_0x49dcaf,_0x41b87c){return function(_0xde4fe3){if(!_0xde4fe3){_0x49dcaf[_0xf0f4('0x16')](0x194);}return _0xde4fe3;};}function handleError(_0x4c39ea,_0x146c52){_0x146c52=_0x146c52||0x1f4;return function(_0x267a8a){logger[_0xf0f4('0x25')](_0x267a8a[_0xf0f4('0x26')]);if(_0x267a8a['name']){delete _0x267a8a['name'];}_0x4c39ea[_0xf0f4('0x17')](_0x146c52)['send'](_0x267a8a);};}exports[_0xf0f4('0x27')]=function(_0x4eb2ae,_0x5de0ef){var _0x5afa51={},_0x8be116={},_0x5355c4={'count':0x0,'rows':[]};var _0x1a81e2=_[_0xf0f4('0x28')](db[_0xf0f4('0x29')][_0xf0f4('0x2a')],function(_0x1e3b18){return{'name':_0x1e3b18['fieldName'],'type':_0x1e3b18[_0xf0f4('0x2b')][_0xf0f4('0x2c')]};});_0x8be116[_0xf0f4('0x2d')]=_['map'](_0x1a81e2,_0xf0f4('0x2e'));_0x8be116[_0xf0f4('0x2f')]=_['keys'](_0x4eb2ae[_0xf0f4('0x2f')]);_0x8be116[_0xf0f4('0x30')]=_['intersection'](_0x8be116['model'],_0x8be116['query']);_0x5afa51[_0xf0f4('0x31')]=_[_0xf0f4('0x32')](_0x8be116[_0xf0f4('0x2d')],qs[_0xf0f4('0x33')](_0x4eb2ae[_0xf0f4('0x2f')][_0xf0f4('0x33')]));_0x5afa51[_0xf0f4('0x31')]=_0x5afa51[_0xf0f4('0x31')]['length']?_0x5afa51[_0xf0f4('0x31')]:_0x8be116[_0xf0f4('0x2d')];if(!_0x4eb2ae[_0xf0f4('0x2f')][_0xf0f4('0x34')](_0xf0f4('0x35'))){_0x5afa51[_0xf0f4('0x1a')]=qs[_0xf0f4('0x1a')](_0x4eb2ae[_0xf0f4('0x2f')][_0xf0f4('0x1a')]);_0x5afa51[_0xf0f4('0x1c')]=qs[_0xf0f4('0x1c')](_0x4eb2ae['query']['offset']);}_0x5afa51[_0xf0f4('0x36')]=qs[_0xf0f4('0x37')](_0x4eb2ae[_0xf0f4('0x2f')]['sort']);_0x5afa51[_0xf0f4('0x38')]=qs[_0xf0f4('0x30')](_[_0xf0f4('0x39')](_0x4eb2ae[_0xf0f4('0x2f')],_0x8be116['filters']),_0x1a81e2);if(_0x4eb2ae[_0xf0f4('0x2f')][_0xf0f4('0x3a')]){_0x5afa51[_0xf0f4('0x38')]=_['merge'](_0x5afa51['where'],{'$or':_[_0xf0f4('0x28')](_0x1a81e2,function(_0xbd89c2){if(_0xbd89c2[_0xf0f4('0x2b')]!=='VIRTUAL'){var _0x12ff05={};_0x12ff05[_0xbd89c2[_0xf0f4('0x2e')]]={'$like':'%'+_0x4eb2ae[_0xf0f4('0x2f')][_0xf0f4('0x3a')]+'%'};return _0x12ff05;}})});}_0x5afa51=_[_0xf0f4('0x3b')]({},_0x5afa51,_0x4eb2ae[_0xf0f4('0x3c')]);var _0x3d6908={'where':_0x5afa51[_0xf0f4('0x38')]};return db[_0xf0f4('0x29')][_0xf0f4('0x1b')](_0x3d6908)[_0xf0f4('0x24')](function(_0x3eadd8){_0x5355c4['count']=_0x3eadd8;if(_0x4eb2ae[_0xf0f4('0x2f')][_0xf0f4('0x3d')]){_0x5afa51[_0xf0f4('0x3e')]=[{'all':!![]}];}return db[_0xf0f4('0x29')][_0xf0f4('0x3f')](_0x5afa51);})['then'](function(_0x9b0a7){_0x5355c4[_0xf0f4('0x40')]=_0x9b0a7;return _0x5355c4;})[_0xf0f4('0x24')](respondWithFilteredResult(_0x5de0ef,_0x5afa51))[_0xf0f4('0x41')](handleError(_0x5de0ef,null));};exports['show']=function(_0x570ab5,_0x5dc427){var _0x4e2a69={'raw':!![],'where':{'id':_0x570ab5[_0xf0f4('0x42')]['id']}},_0x162221={};_0x162221['model']=_[_0xf0f4('0x43')](db[_0xf0f4('0x29')][_0xf0f4('0x2a')]);_0x162221[_0xf0f4('0x2f')]=_[_0xf0f4('0x43')](_0x570ab5['query']);_0x162221[_0xf0f4('0x30')]=_[_0xf0f4('0x32')](_0x162221[_0xf0f4('0x2d')],_0x162221[_0xf0f4('0x2f')]);_0x4e2a69[_0xf0f4('0x31')]=_[_0xf0f4('0x32')](_0x162221['model'],qs[_0xf0f4('0x33')](_0x570ab5[_0xf0f4('0x2f')][_0xf0f4('0x33')]));_0x4e2a69[_0xf0f4('0x31')]=_0x4e2a69[_0xf0f4('0x31')][_0xf0f4('0x44')]?_0x4e2a69['attributes']:_0x162221[_0xf0f4('0x2d')];if(_0x570ab5[_0xf0f4('0x2f')][_0xf0f4('0x3d')]){_0x4e2a69[_0xf0f4('0x3e')]=[{'all':!![]}];}_0x4e2a69=_['merge']({},_0x4e2a69,_0x570ab5[_0xf0f4('0x3c')]);return db[_0xf0f4('0x29')][_0xf0f4('0x45')](_0x4e2a69)[_0xf0f4('0x24')](handleEntityNotFound(_0x5dc427,null))[_0xf0f4('0x24')](respondWithResult(_0x5dc427,null))[_0xf0f4('0x41')](handleError(_0x5dc427,null));};exports[_0xf0f4('0x46')]=function(_0x231210,_0x2b3df6){return db[_0xf0f4('0x29')][_0xf0f4('0x46')](_0x231210[_0xf0f4('0x47')],{})[_0xf0f4('0x24')](respondWithResult(_0x2b3df6,0xc9))[_0xf0f4('0x41')](handleError(_0x2b3df6,null));};exports[_0xf0f4('0x23')]=function(_0x4cd904,_0x2c65b8){if(_0x4cd904[_0xf0f4('0x47')]['id']){delete _0x4cd904[_0xf0f4('0x47')]['id'];}return db['SalesforceField'][_0xf0f4('0x45')]({'where':{'id':_0x4cd904[_0xf0f4('0x42')]['id']}})[_0xf0f4('0x24')](handleEntityNotFound(_0x2c65b8,null))[_0xf0f4('0x24')](saveUpdates(_0x4cd904['body'],null))['then'](respondWithResult(_0x2c65b8,null))[_0xf0f4('0x41')](handleError(_0x2c65b8,null));};exports[_0xf0f4('0x48')]=function(_0x51e14f,_0x1eee02){return db['SalesforceField'][_0xf0f4('0x45')]({'where':{'id':_0x51e14f[_0xf0f4('0x42')]['id']}})[_0xf0f4('0x24')](handleEntityNotFound(_0x1eee02,null))[_0xf0f4('0x24')](removeEntity(_0x1eee02,null))[_0xf0f4('0x41')](handleError(_0x1eee02,null));}; \ No newline at end of file +var _0x3791=['show','params','options','create','body','find','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','filter','SalesforceField','includeAll','include','catch'];(function(_0x2fbd3a,_0x229b5f){var _0x5ebdfc=function(_0x18c375){while(--_0x18c375){_0x2fbd3a['push'](_0x2fbd3a['shift']());}};_0x5ebdfc(++_0x229b5f);}(_0x3791,0x116));var _0x1379=function(_0x44382b,_0x33d986){_0x44382b=_0x44382b-0x0;var _0x2e1897=_0x3791[_0x44382b];return _0x2e1897;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1379('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1379('0x1'));var moment=require(_0x1379('0x2'));var BPromise=require(_0x1379('0x3'));var Mustache=require('mustache');var util=require(_0x1379('0x4'));var path=require(_0x1379('0x5'));var sox=require(_0x1379('0x6'));var csv=require('to-csv');var ejs=require(_0x1379('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1379('0x8'));var squel=require(_0x1379('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1379('0xa'));var Papa=require(_0x1379('0xb'));var Redis=require('ioredis');var authService=require(_0x1379('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x1379('0xd'));var hardwareService=require(_0x1379('0xe'));var logger=require('../../config/logger')(_0x1379('0xf'));var utils=require(_0x1379('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x1379('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x317d48,_0x591ec5){_0x591ec5=_0x591ec5||0xcc;return function(_0x5bf1de){if(_0x5bf1de){return _0x317d48[_0x1379('0x12')](_0x591ec5);}return _0x317d48['status'](_0x591ec5)[_0x1379('0x13')]();};}function respondWithResult(_0x4fe36e,_0x2a4f11){_0x2a4f11=_0x2a4f11||0xc8;return function(_0x3c299b){if(_0x3c299b){return _0x4fe36e['status'](_0x2a4f11)[_0x1379('0x14')](_0x3c299b);}};}function respondWithFilteredResult(_0x442255,_0x533f34){return function(_0x8db598){if(_0x8db598){var _0x4ec387=typeof _0x533f34[_0x1379('0x15')]==='undefined'&&typeof _0x533f34[_0x1379('0x16')]===_0x1379('0x17');var _0x553c64=_0x8db598[_0x1379('0x18')];var _0x54fa5d=_0x4ec387?0x0:_0x533f34['offset'];var _0x1e1ba4=_0x4ec387?_0x8db598['count']:_0x533f34[_0x1379('0x15')]+_0x533f34[_0x1379('0x16')];var _0x846023;if(_0x1e1ba4>=_0x553c64){_0x1e1ba4=_0x553c64;_0x846023=0xc8;}else{_0x846023=0xce;}_0x442255[_0x1379('0x19')](_0x846023);return _0x442255[_0x1379('0x1a')](_0x1379('0x1b'),_0x54fa5d+'-'+_0x1e1ba4+'/'+_0x553c64)[_0x1379('0x14')](_0x8db598);}return null;};}function patchUpdates(_0x2d2ee9){return function(_0xac358b){try{jsonpatch['apply'](_0xac358b,_0x2d2ee9,!![]);}catch(_0x817643){return BPromise[_0x1379('0x1c')](_0x817643);}return _0xac358b[_0x1379('0x1d')]();};}function saveUpdates(_0xc0504,_0xa3d2a8){return function(_0x2b3aa8){if(_0x2b3aa8){return _0x2b3aa8[_0x1379('0x1e')](_0xc0504)[_0x1379('0x1f')](function(_0x4208a1){return _0x4208a1;});}return null;};}function removeEntity(_0x462670,_0x252cde){return function(_0x9277a9){if(_0x9277a9){return _0x9277a9[_0x1379('0x20')]()[_0x1379('0x1f')](function(){_0x462670['status'](0xcc)[_0x1379('0x13')]();});}};}function handleEntityNotFound(_0x4a7687,_0x145b5e){return function(_0x38f399){if(!_0x38f399){_0x4a7687[_0x1379('0x12')](0x194);}return _0x38f399;};}function handleError(_0x5ad989,_0x55ed19){_0x55ed19=_0x55ed19||0x1f4;return function(_0x359603){logger[_0x1379('0x21')](_0x359603[_0x1379('0x22')]);if(_0x359603['name']){delete _0x359603[_0x1379('0x23')];}_0x5ad989[_0x1379('0x19')](_0x55ed19)[_0x1379('0x24')](_0x359603);};}exports[_0x1379('0x25')]=function(_0xcc1035,_0x587686){var _0x5570a3={},_0x4859d0={},_0x441942={'count':0x0,'rows':[]};var _0x19617e=_[_0x1379('0x26')](db['SalesforceField'][_0x1379('0x27')],function(_0x1567c0){return{'name':_0x1567c0[_0x1379('0x28')],'type':_0x1567c0[_0x1379('0x29')][_0x1379('0x2a')]};});_0x4859d0[_0x1379('0x2b')]=_[_0x1379('0x26')](_0x19617e,_0x1379('0x23'));_0x4859d0[_0x1379('0x2c')]=_[_0x1379('0x2d')](_0xcc1035[_0x1379('0x2c')]);_0x4859d0['filters']=_[_0x1379('0x2e')](_0x4859d0[_0x1379('0x2b')],_0x4859d0['query']);_0x5570a3[_0x1379('0x2f')]=_[_0x1379('0x2e')](_0x4859d0[_0x1379('0x2b')],qs['fields'](_0xcc1035[_0x1379('0x2c')][_0x1379('0x30')]));_0x5570a3[_0x1379('0x2f')]=_0x5570a3['attributes'][_0x1379('0x31')]?_0x5570a3['attributes']:_0x4859d0['model'];if(!_0xcc1035[_0x1379('0x2c')][_0x1379('0x32')]('nolimit')){_0x5570a3[_0x1379('0x16')]=qs['limit'](_0xcc1035[_0x1379('0x2c')][_0x1379('0x16')]);_0x5570a3['offset']=qs[_0x1379('0x15')](_0xcc1035['query']['offset']);}_0x5570a3[_0x1379('0x33')]=qs[_0x1379('0x34')](_0xcc1035[_0x1379('0x2c')][_0x1379('0x34')]);_0x5570a3[_0x1379('0x35')]=qs[_0x1379('0x36')](_[_0x1379('0x37')](_0xcc1035[_0x1379('0x2c')],_0x4859d0[_0x1379('0x36')]),_0x19617e);if(_0xcc1035[_0x1379('0x2c')]['filter']){_0x5570a3[_0x1379('0x35')]=_[_0x1379('0x38')](_0x5570a3['where'],{'$or':_['map'](_0x19617e,function(_0x56ca0a){if(_0x56ca0a[_0x1379('0x29')]!=='VIRTUAL'){var _0x174f89={};_0x174f89[_0x56ca0a['name']]={'$like':'%'+_0xcc1035[_0x1379('0x2c')][_0x1379('0x39')]+'%'};return _0x174f89;}})});}_0x5570a3=_['merge']({},_0x5570a3,_0xcc1035['options']);var _0x5430d4={'where':_0x5570a3[_0x1379('0x35')]};return db[_0x1379('0x3a')][_0x1379('0x18')](_0x5430d4)[_0x1379('0x1f')](function(_0x167a98){_0x441942[_0x1379('0x18')]=_0x167a98;if(_0xcc1035[_0x1379('0x2c')][_0x1379('0x3b')]){_0x5570a3[_0x1379('0x3c')]=[{'all':!![]}];}return db[_0x1379('0x3a')]['findAll'](_0x5570a3);})[_0x1379('0x1f')](function(_0x3dc168){_0x441942['rows']=_0x3dc168;return _0x441942;})[_0x1379('0x1f')](respondWithFilteredResult(_0x587686,_0x5570a3))[_0x1379('0x3d')](handleError(_0x587686,null));};exports[_0x1379('0x3e')]=function(_0x1d659f,_0x55db7b){var _0x1e76b7={'raw':!![],'where':{'id':_0x1d659f[_0x1379('0x3f')]['id']}},_0x4eacdd={};_0x4eacdd[_0x1379('0x2b')]=_[_0x1379('0x2d')](db[_0x1379('0x3a')]['rawAttributes']);_0x4eacdd['query']=_[_0x1379('0x2d')](_0x1d659f['query']);_0x4eacdd[_0x1379('0x36')]=_[_0x1379('0x2e')](_0x4eacdd[_0x1379('0x2b')],_0x4eacdd[_0x1379('0x2c')]);_0x1e76b7[_0x1379('0x2f')]=_[_0x1379('0x2e')](_0x4eacdd[_0x1379('0x2b')],qs[_0x1379('0x30')](_0x1d659f[_0x1379('0x2c')][_0x1379('0x30')]));_0x1e76b7['attributes']=_0x1e76b7[_0x1379('0x2f')][_0x1379('0x31')]?_0x1e76b7[_0x1379('0x2f')]:_0x4eacdd[_0x1379('0x2b')];if(_0x1d659f[_0x1379('0x2c')]['includeAll']){_0x1e76b7['include']=[{'all':!![]}];}_0x1e76b7=_[_0x1379('0x38')]({},_0x1e76b7,_0x1d659f[_0x1379('0x40')]);return db['SalesforceField']['find'](_0x1e76b7)[_0x1379('0x1f')](handleEntityNotFound(_0x55db7b,null))[_0x1379('0x1f')](respondWithResult(_0x55db7b,null))[_0x1379('0x3d')](handleError(_0x55db7b,null));};exports[_0x1379('0x41')]=function(_0x2edc6d,_0x63921a){return db[_0x1379('0x3a')][_0x1379('0x41')](_0x2edc6d[_0x1379('0x42')],{})['then'](respondWithResult(_0x63921a,0xc9))[_0x1379('0x3d')](handleError(_0x63921a,null));};exports[_0x1379('0x1e')]=function(_0x1e1001,_0x267017){if(_0x1e1001[_0x1379('0x42')]['id']){delete _0x1e1001[_0x1379('0x42')]['id'];}return db[_0x1379('0x3a')][_0x1379('0x43')]({'where':{'id':_0x1e1001['params']['id']}})[_0x1379('0x1f')](handleEntityNotFound(_0x267017,null))['then'](saveUpdates(_0x1e1001[_0x1379('0x42')],null))[_0x1379('0x1f')](respondWithResult(_0x267017,null))[_0x1379('0x3d')](handleError(_0x267017,null));};exports['destroy']=function(_0x4a3dcc,_0x24ceac){return db[_0x1379('0x3a')][_0x1379('0x43')]({'where':{'id':_0x4a3dcc[_0x1379('0x3f')]['id']}})['then'](handleEntityNotFound(_0x24ceac,null))['then'](removeEntity(_0x24ceac,null))['catch'](handleError(_0x24ceac,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index b59f039..f8be33a 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 _0x59f2=['path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','salesforce_unique_index','FieldId','lodash','util','../../config/logger','moment','request-promise'];(function(_0x205e86,_0x548873){var _0x397322=function(_0x2104f3){while(--_0x2104f3){_0x205e86['push'](_0x205e86['shift']());}};_0x397322(++_0x548873);}(_0x59f2,0x105));var _0x259f=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x59f2[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0x259f('0x0'));var util=require(_0x259f('0x1'));var logger=require(_0x259f('0x2'))('api');var moment=require(_0x259f('0x3'));var BPromise=require('bluebird');var rp=require(_0x259f('0x4'));var fs=require('fs');var path=require(_0x259f('0x5'));var rimraf=require(_0x259f('0x6'));var config=require(_0x259f('0x7'));var attributes=require(_0x259f('0x8'));module[_0x259f('0x9')]=function(_0x269d13,_0x182677){return _0x269d13[_0x259f('0xa')](_0x259f('0xb'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x259f('0xc'),'fields':['idField',_0x259f('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x685e=['path','rimraf','./intSalesforceField.attributes','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x685e,0x18e));var _0xe685=function(_0x561f25,_0x2d95c1){_0x561f25=_0x561f25-0x0;var _0x150e4c=_0x685e[_0x561f25];return _0x150e4c;};'use strict';var _=require(_0xe685('0x0'));var util=require(_0xe685('0x1'));var logger=require(_0xe685('0x2'))(_0xe685('0x3'));var moment=require(_0xe685('0x4'));var BPromise=require(_0xe685('0x5'));var rp=require(_0xe685('0x6'));var fs=require('fs');var path=require(_0xe685('0x7'));var rimraf=require(_0xe685('0x8'));var config=require('../../config/environment');var attributes=require(_0xe685('0x9'));module['exports']=function(_0x1c1e2e,_0x23c8d1){return _0x1c1e2e['define'](_0xe685('0xa'),attributes,{'tableName':_0xe685('0xb'),'paranoid':![],'indexes':[{'name':_0xe685('0xc'),'fields':[_0xe685('0xd'),_0xe685('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 18571e5..99b6f4d 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 _0xf75b=['code','error','message','info','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x4e80bf,_0x53f81a){var _0x280e8e=function(_0x2f10bb){while(--_0x2f10bb){_0x4e80bf['push'](_0x4e80bf['shift']());}};_0x280e8e(++_0x53f81a);}(_0xf75b,0x194));var _0xbf75=function(_0x5e5cab,_0x4d862){_0x5e5cab=_0x5e5cab-0x0;var _0x1cc14e=_0xf75b[_0x5e5cab];return _0x1cc14e;};'use strict';var _=require(_0xbf75('0x0'));var util=require(_0xbf75('0x1'));var moment=require(_0xbf75('0x2'));var BPromise=require('bluebird');var rs=require(_0xbf75('0x3'));var fs=require('fs');var Redis=require(_0xbf75('0x4'));var db=require(_0xbf75('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbf75('0x6'));var config=require(_0xbf75('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbf75('0x8')][_0xbf75('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ced77,_0x27bf68,_0x5e29af){return new BPromise(function(_0x3880f8,_0x329487){return client[_0xbf75('0xa')](_0x5ced77,_0x5e29af)[_0xbf75('0xb')](function(_0xb4c970){logger['info'](_0xbf75('0xc'),_0x27bf68,_0xbf75('0xd'));logger[_0xbf75('0xe')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x27bf68,_0xbf75('0xd'),JSON[_0xbf75('0xf')](_0xb4c970));if(_0xb4c970['error']){if(_0xb4c970['error'][_0xbf75('0x10')]===0x1f4){logger[_0xbf75('0x11')](_0xbf75('0xc'),_0x27bf68,_0xb4c970[_0xbf75('0x11')][_0xbf75('0x12')]);return _0x329487(_0xb4c970[_0xbf75('0x11')][_0xbf75('0x12')]);}logger[_0xbf75('0x11')]('SalesforceField,\x20%s,\x20%s',_0x27bf68,_0xb4c970['error'][_0xbf75('0x12')]);return _0x3880f8(_0xb4c970[_0xbf75('0x11')][_0xbf75('0x12')]);}else{logger[_0xbf75('0x13')](_0xbf75('0xc'),_0x27bf68,'request\x20sent');_0x3880f8(_0xb4c970['result'][_0xbf75('0x12')]);}})['catch'](function(_0x34b01e){logger[_0xbf75('0x11')](_0xbf75('0xc'),_0x27bf68,_0x34b01e);_0x329487(_0x34b01e);});});} \ No newline at end of file +var _0x4820=['rpc','../../config/environment','jayson/promise','client','request','then','info','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x225789,_0x44e8fb){var _0x7006b1=function(_0x1bef7d){while(--_0x1bef7d){_0x225789['push'](_0x225789['shift']());}};_0x7006b1(++_0x44e8fb);}(_0x4820,0x1dd));var _0x0482=function(_0x422404,_0x4e025f){_0x422404=_0x422404-0x0;var _0x46f0e5=_0x4820[_0x422404];return _0x46f0e5;};'use strict';var _=require(_0x0482('0x0'));var util=require(_0x0482('0x1'));var moment=require(_0x0482('0x2'));var BPromise=require('bluebird');var rs=require(_0x0482('0x3'));var fs=require('fs');var Redis=require(_0x0482('0x4'));var db=require(_0x0482('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0482('0x6'))(_0x0482('0x7'));var config=require(_0x0482('0x8'));var jayson=require(_0x0482('0x9'));var client=jayson[_0x0482('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d8f9a,_0x1984cf,_0x4722be){return new BPromise(function(_0x3e61f5,_0x32a9f9){return client[_0x0482('0xb')](_0x2d8f9a,_0x4722be)[_0x0482('0xc')](function(_0x3380b3){logger[_0x0482('0xd')](_0x0482('0xe'),_0x1984cf,'request\x20sent');logger[_0x0482('0xf')](_0x0482('0x10'),_0x1984cf,'request\x20sent',JSON['stringify'](_0x3380b3));if(_0x3380b3[_0x0482('0x11')]){if(_0x3380b3[_0x0482('0x11')]['code']===0x1f4){logger['error'](_0x0482('0xe'),_0x1984cf,_0x3380b3['error'][_0x0482('0x12')]);return _0x32a9f9(_0x3380b3[_0x0482('0x11')]['message']);}logger[_0x0482('0x11')](_0x0482('0xe'),_0x1984cf,_0x3380b3[_0x0482('0x11')][_0x0482('0x12')]);return _0x3e61f5(_0x3380b3[_0x0482('0x11')][_0x0482('0x12')]);}else{logger[_0x0482('0xd')](_0x0482('0xe'),_0x1984cf,_0x0482('0x13'));_0x3e61f5(_0x3380b3[_0x0482('0x14')][_0x0482('0x12')]);}})[_0x0482('0x15')](function(_0xc652b5){logger[_0x0482('0x11')](_0x0482('0xe'),_0x1984cf,_0xc652b5);_0x32a9f9(_0xc652b5);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 50e763e..ed60f20 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 _0x05d9=['put','update','delete','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./intServicenowAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','create'];(function(_0x25b856,_0xfb945f){var _0x35bc3a=function(_0x20255a){while(--_0x20255a){_0x25b856['push'](_0x25b856['shift']());}};_0x35bc3a(++_0xfb945f);}(_0x05d9,0xc1));var _0x905d=function(_0x4f079a,_0x1ddbfb){_0x4f079a=_0x4f079a-0x0;var _0x4a1af7=_0x05d9[_0x4f079a];return _0x4a1af7;};'use strict';var multer=require(_0x905d('0x0'));var util=require(_0x905d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x905d('0x2'));var router=express[_0x905d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x905d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x905d('0x5'));var controller=require(_0x905d('0x6'));router[_0x905d('0x7')]('/',auth['isAuthenticated'](),controller[_0x905d('0x8')]);router[_0x905d('0x7')](_0x905d('0x9'),auth[_0x905d('0xa')](),controller[_0x905d('0xb')]);router[_0x905d('0x7')](_0x905d('0xc'),auth[_0x905d('0xa')](),controller[_0x905d('0xd')]);router[_0x905d('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0x905d('0xe')]);router[_0x905d('0xf')]('/',auth[_0x905d('0xa')](),controller[_0x905d('0x10')]);router[_0x905d('0xf')](_0x905d('0xc'),auth[_0x905d('0xa')](),controller['addConfiguration']);router[_0x905d('0x11')](_0x905d('0x9'),auth[_0x905d('0xa')](),controller[_0x905d('0x12')]);router[_0x905d('0x13')]('/:id',auth[_0x905d('0xa')](),controller['destroy']);module[_0x905d('0x14')]=router; \ No newline at end of file +var _0x3dc8=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','index','get','/:id','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','update','delete','destroy','exports','util','path'];(function(_0x29e35f,_0x4859ef){var _0x266b74=function(_0xc09e1){while(--_0xc09e1){_0x29e35f['push'](_0x29e35f['shift']());}};_0x266b74(++_0x4859ef);}(_0x3dc8,0x148));var _0x83dc=function(_0x3ea8c1,_0x3e0a18){_0x3ea8c1=_0x3ea8c1-0x0;var _0x26d45b=_0x3dc8[_0x3ea8c1];return _0x26d45b;};'use strict';var multer=require('multer');var util=require(_0x83dc('0x0'));var path=require(_0x83dc('0x1'));var timeout=require('connect-timeout');var express=require(_0x83dc('0x2'));var router=express[_0x83dc('0x3')]();var fs_extra=require(_0x83dc('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x83dc('0x5'));var config=require(_0x83dc('0x6'));var controller=require(_0x83dc('0x7'));router['get']('/',auth[_0x83dc('0x8')](),controller[_0x83dc('0x9')]);router[_0x83dc('0xa')](_0x83dc('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x83dc('0xa')](_0x83dc('0xc'),auth['isAuthenticated'](),controller[_0x83dc('0xd')]);router[_0x83dc('0xa')]('/:id/fields',auth[_0x83dc('0x8')](),controller[_0x83dc('0xe')]);router[_0x83dc('0xf')]('/',auth[_0x83dc('0x8')](),controller['create']);router[_0x83dc('0xf')]('/:id/configurations',auth[_0x83dc('0x8')](),controller[_0x83dc('0x10')]);router[_0x83dc('0x11')]('/:id',auth[_0x83dc('0x8')](),controller[_0x83dc('0x12')]);router[_0x83dc('0x13')](_0x83dc('0xb'),auth['isAuthenticated'](),controller[_0x83dc('0x14')]);module[_0x83dc('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 6b0ad81..2a64554 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 _0x6003=['sequelize','exports','STRING','username','remoteUri'];(function(_0x3d0d8e,_0x30b3f9){var _0x163d8a=function(_0x4d58f4){while(--_0x4d58f4){_0x3d0d8e['push'](_0x3d0d8e['shift']());}};_0x163d8a(++_0x30b3f9);}(_0x6003,0x11d));var _0x3600=function(_0x3968a2,_0x5f4113){_0x3968a2=_0x3968a2-0x0;var _0xa77777=_0x6003[_0x3968a2];return _0xa77777;};'use strict';var Sequelize=require(_0x3600('0x0'));module[_0x3600('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3600('0x2')]},'username':{'type':Sequelize[_0x3600('0x2')],'unique':_0x3600('0x3')},'password':{'type':Sequelize[_0x3600('0x2')]},'email':{'type':Sequelize[_0x3600('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x3600('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x7899=['STRING','username','remoteUri','sequelize','exports'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x7899,0xe4));var _0x9789=function(_0x2eec1f,_0x1b9987){_0x2eec1f=_0x2eec1f-0x0;var _0x543075=_0x7899[_0x2eec1f];return _0x543075;};'use strict';var Sequelize=require(_0x9789('0x0'));module[_0x9789('0x1')]={'name':{'type':Sequelize[_0x9789('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x9789('0x2')],'unique':_0x9789('0x3')},'password':{'type':Sequelize[_0x9789('0x2')]},'email':{'type':Sequelize[_0x9789('0x2')]},'remoteUri':{'type':Sequelize[_0x9789('0x2')],'unique':_0x9789('0x4')},'serverUrl':{'type':Sequelize[_0x9789('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 3a104a5..916fb21 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 _0x6303=['opened_by','sys_created_on','sys_domain','state','sys_created_by','closed_at','delivery_plan','impact','active','work_notes_list','priority','rfc','time_worked','expected_start','opened_at','business_duration','group_list','reopened_time','resolved_at','caller_id','approval_set','work_notes','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','activity_due','severity','sla_due','approval','comments_and_work_notes','sys_mod_count','sys_tags','escalation','upon_approval','correlation_id','location','findOne','password','email','remoteUri','serverUrl','slice','lastIndexOf','format','%s/api/now/table/','username','GET','incident?sysparm_display_value=all','result','remove','includes','internalType','push','all','log','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','concat','test','stack','Wrong\x20credentials','statusCode','boolean','True','true','sys_choice?sysparm_query=name=incident^element=','forEach','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','then','sendStatus','error','name','send','index','map','ServicenowAccount','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','include','findAll','rows','catch','show','keys','includeAll','find','create','body','params','destroy','getConfigurations','ServicenowConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','ServicenowField','made_sla','hold_reason','knowledge','subcategory','close_code','notify','category','parent','caused_by','watch_list','upon_reject','child_incidents','number','resolved_by'];(function(_0x29f286,_0x4cea30){var _0x31a53c=function(_0x2c1f24){while(--_0x2c1f24){_0x29f286['push'](_0x29f286['shift']());}};_0x31a53c(++_0x4cea30);}(_0x6303,0x1b9));var _0x3630=function(_0x4f3ad9,_0x428b72){_0x4f3ad9=_0x4f3ad9-0x0;var _0xfe42cd=_0x6303[_0x4f3ad9];return _0xfe42cd;};'use strict';var emlformat=require(_0x3630('0x0'));var rimraf=require(_0x3630('0x1'));var zipdir=require(_0x3630('0x2'));var jsonpatch=require(_0x3630('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3630('0x4'));var Mustache=require(_0x3630('0x5'));var util=require(_0x3630('0x6'));var path=require(_0x3630('0x7'));var sox=require(_0x3630('0x8'));var csv=require(_0x3630('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3630('0xa'));var _=require(_0x3630('0xb'));var squel=require('squel');var crypto=require(_0x3630('0xc'));var jsforce=require(_0x3630('0xd'));var deskjs=require(_0x3630('0xe'));var toCsv=require(_0x3630('0x9'));var querystring=require('querystring');var Papa=require(_0x3630('0xf'));var Redis=require(_0x3630('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3630('0x11'));var as=require(_0x3630('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3630('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3630('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1882f7,_0x3a5493){_0x3a5493=_0x3a5493||0xcc;return function(_0x1cdd78){if(_0x1cdd78){return _0x1882f7['sendStatus'](_0x3a5493);}return _0x1882f7[_0x3630('0x15')](_0x3a5493)[_0x3630('0x16')]();};}function respondWithResult(_0xe4644,_0x29d6e1){_0x29d6e1=_0x29d6e1||0xc8;return function(_0x3f84e2){if(_0x3f84e2){return _0xe4644[_0x3630('0x15')](_0x29d6e1)[_0x3630('0x17')](_0x3f84e2);}};}function respondWithFilteredResult(_0x5f153e,_0x49091b){return function(_0x3b206e){if(_0x3b206e){var _0x4c2dfc=typeof _0x49091b[_0x3630('0x18')]===_0x3630('0x19')&&typeof _0x49091b['limit']==='undefined';var _0x59de08=_0x3b206e['count'];var _0x518cb8=_0x4c2dfc?0x0:_0x49091b[_0x3630('0x18')];var _0x2f12f5=_0x4c2dfc?_0x3b206e[_0x3630('0x1a')]:_0x49091b[_0x3630('0x18')]+_0x49091b['limit'];var _0x268e71;if(_0x2f12f5>=_0x59de08){_0x2f12f5=_0x59de08;_0x268e71=0xc8;}else{_0x268e71=0xce;}_0x5f153e['status'](_0x268e71);return _0x5f153e[_0x3630('0x1b')](_0x3630('0x1c'),_0x518cb8+'-'+_0x2f12f5+'/'+_0x59de08)['json'](_0x3b206e);}return null;};}function patchUpdates(_0x4675df){return function(_0x3bc8cd){try{jsonpatch['apply'](_0x3bc8cd,_0x4675df,!![]);}catch(_0x5eac1f){return BPromise[_0x3630('0x1d')](_0x5eac1f);}return _0x3bc8cd[_0x3630('0x1e')]();};}function saveUpdates(_0x444921,_0x444f30){return function(_0x307984){if(_0x307984){return _0x307984[_0x3630('0x1f')](_0x444921)['then'](function(_0x496b35){return _0x496b35;});}return null;};}function removeEntity(_0x57c268,_0x19ad51){return function(_0x52c2b1){if(_0x52c2b1){return _0x52c2b1['destroy']()[_0x3630('0x20')](function(){_0x57c268['status'](0xcc)[_0x3630('0x16')]();});}};}function handleEntityNotFound(_0x110b88,_0x5eed2d){return function(_0x2cc13b){if(!_0x2cc13b){_0x110b88[_0x3630('0x21')](0x194);}return _0x2cc13b;};}function handleError(_0x80bd4d,_0x19b9cc){_0x19b9cc=_0x19b9cc||0x1f4;return function(_0x1548c2){logger[_0x3630('0x22')](_0x1548c2['stack']);if(_0x1548c2[_0x3630('0x23')]){delete _0x1548c2[_0x3630('0x23')];}_0x80bd4d[_0x3630('0x15')](_0x19b9cc)[_0x3630('0x24')](_0x1548c2);};}exports[_0x3630('0x25')]=function(_0x2d6624,_0x280d10){var _0x24a4c2={},_0x1be8f8={},_0x4993d6={'count':0x0,'rows':[]};var _0x1b1c61=_[_0x3630('0x26')](db[_0x3630('0x27')][_0x3630('0x28')],function(_0x1b70b0){return{'name':_0x1b70b0['fieldName'],'type':_0x1b70b0['type']['key']};});_0x1be8f8[_0x3630('0x29')]=_[_0x3630('0x26')](_0x1b1c61,'name');_0x1be8f8[_0x3630('0x2a')]=_['keys'](_0x2d6624[_0x3630('0x2a')]);_0x1be8f8[_0x3630('0x2b')]=_[_0x3630('0x2c')](_0x1be8f8[_0x3630('0x29')],_0x1be8f8['query']);_0x24a4c2[_0x3630('0x2d')]=_[_0x3630('0x2c')](_0x1be8f8['model'],qs['fields'](_0x2d6624[_0x3630('0x2a')][_0x3630('0x2e')]));_0x24a4c2[_0x3630('0x2d')]=_0x24a4c2['attributes'][_0x3630('0x2f')]?_0x24a4c2['attributes']:_0x1be8f8[_0x3630('0x29')];if(!_0x2d6624[_0x3630('0x2a')][_0x3630('0x30')]('nolimit')){_0x24a4c2[_0x3630('0x31')]=qs[_0x3630('0x31')](_0x2d6624[_0x3630('0x2a')][_0x3630('0x31')]);_0x24a4c2[_0x3630('0x18')]=qs['offset'](_0x2d6624[_0x3630('0x2a')][_0x3630('0x18')]);}_0x24a4c2[_0x3630('0x32')]=qs[_0x3630('0x33')](_0x2d6624['query'][_0x3630('0x33')]);_0x24a4c2['where']=qs[_0x3630('0x2b')](_[_0x3630('0x34')](_0x2d6624['query'],_0x1be8f8['filters']),_0x1b1c61);if(_0x2d6624[_0x3630('0x2a')][_0x3630('0x35')]){_0x24a4c2['where']=_[_0x3630('0x36')](_0x24a4c2[_0x3630('0x37')],{'$or':_['map'](_0x1b1c61,function(_0x204d16){if(_0x204d16[_0x3630('0x38')]!==_0x3630('0x39')){var _0x38b8d3={};_0x38b8d3[_0x204d16['name']]={'$like':'%'+_0x2d6624['query']['filter']+'%'};return _0x38b8d3;}})});}_0x24a4c2=_[_0x3630('0x36')]({},_0x24a4c2,_0x2d6624[_0x3630('0x3a')]);var _0x48d102={'where':_0x24a4c2['where']};return db['ServicenowAccount'][_0x3630('0x1a')](_0x48d102)[_0x3630('0x20')](function(_0x13ab01){_0x4993d6[_0x3630('0x1a')]=_0x13ab01;if(_0x2d6624[_0x3630('0x2a')]['includeAll']){_0x24a4c2[_0x3630('0x3b')]=[{'all':!![]}];}return db[_0x3630('0x27')][_0x3630('0x3c')](_0x24a4c2);})[_0x3630('0x20')](function(_0x51b9e2){_0x4993d6[_0x3630('0x3d')]=_0x51b9e2;return _0x4993d6;})[_0x3630('0x20')](respondWithFilteredResult(_0x280d10,_0x24a4c2))[_0x3630('0x3e')](handleError(_0x280d10,null));};exports[_0x3630('0x3f')]=function(_0x3de0cb,_0xf73991){var _0x28f7c4={'raw':![],'where':{'id':_0x3de0cb['params']['id']}},_0x574d72={};_0x574d72[_0x3630('0x29')]=_[_0x3630('0x40')](db[_0x3630('0x27')]['rawAttributes']);_0x574d72[_0x3630('0x2a')]=_[_0x3630('0x40')](_0x3de0cb[_0x3630('0x2a')]);_0x574d72[_0x3630('0x2b')]=_[_0x3630('0x2c')](_0x574d72['model'],_0x574d72[_0x3630('0x2a')]);_0x28f7c4[_0x3630('0x2d')]=_[_0x3630('0x2c')](_0x574d72[_0x3630('0x29')],qs[_0x3630('0x2e')](_0x3de0cb['query']['fields']));_0x28f7c4[_0x3630('0x2d')]=_0x28f7c4['attributes'][_0x3630('0x2f')]?_0x28f7c4[_0x3630('0x2d')]:_0x574d72[_0x3630('0x29')];if(_0x3de0cb[_0x3630('0x2a')][_0x3630('0x41')]){_0x28f7c4['include']=[{'all':!![]}];}_0x28f7c4=_['merge']({},_0x28f7c4,_0x3de0cb[_0x3630('0x3a')]);return db[_0x3630('0x27')][_0x3630('0x42')](_0x28f7c4)[_0x3630('0x20')](handleEntityNotFound(_0xf73991,null))[_0x3630('0x20')](respondWithResult(_0xf73991,null))[_0x3630('0x3e')](handleError(_0xf73991,null));};exports[_0x3630('0x43')]=function(_0x3cbfb7,_0x3e0bf1){return db[_0x3630('0x27')]['create'](_0x3cbfb7[_0x3630('0x44')],{})[_0x3630('0x20')](respondWithResult(_0x3e0bf1,0xc9))[_0x3630('0x3e')](handleError(_0x3e0bf1,null));};exports[_0x3630('0x1f')]=function(_0xfba76c,_0x395095){if(_0xfba76c[_0x3630('0x44')]['id']){delete _0xfba76c['body']['id'];}return db[_0x3630('0x27')][_0x3630('0x42')]({'where':{'id':_0xfba76c[_0x3630('0x45')]['id']}})[_0x3630('0x20')](handleEntityNotFound(_0x395095,null))[_0x3630('0x20')](saveUpdates(_0xfba76c[_0x3630('0x44')],null))[_0x3630('0x20')](respondWithResult(_0x395095,null))['catch'](handleError(_0x395095,null));};exports[_0x3630('0x46')]=function(_0x18a124,_0x482790){return db[_0x3630('0x27')][_0x3630('0x42')]({'where':{'id':_0x18a124[_0x3630('0x45')]['id']}})[_0x3630('0x20')](handleEntityNotFound(_0x482790,null))[_0x3630('0x20')](removeEntity(_0x482790,null))[_0x3630('0x3e')](handleError(_0x482790,null));};exports[_0x3630('0x47')]=function(_0x131bf6,_0x2ac86d,_0x358116){var _0x553f0a={};var _0x293440={};var _0x5e2047;var _0x1ee01e;return db[_0x3630('0x27')]['findOne']({'where':{'id':_0x131bf6['params']['id']}})[_0x3630('0x20')](handleEntityNotFound(_0x2ac86d,null))[_0x3630('0x20')](function(_0x597d27){if(_0x597d27){_0x5e2047=_0x597d27;_0x293440[_0x3630('0x29')]=_[_0x3630('0x40')](db[_0x3630('0x48')][_0x3630('0x28')]);_0x293440[_0x3630('0x2a')]=_[_0x3630('0x40')](_0x131bf6[_0x3630('0x2a')]);_0x293440['filters']=_[_0x3630('0x2c')](_0x293440['model'],_0x293440[_0x3630('0x2a')]);_0x553f0a['attributes']=_[_0x3630('0x2c')](_0x293440[_0x3630('0x29')],qs[_0x3630('0x2e')](_0x131bf6['query']['fields']));_0x553f0a['attributes']=_0x553f0a['attributes'][_0x3630('0x2f')]?_0x553f0a[_0x3630('0x2d')]:_0x293440['model'];_0x553f0a[_0x3630('0x32')]=qs['sort'](_0x131bf6[_0x3630('0x2a')]['sort']);_0x553f0a[_0x3630('0x37')]=qs[_0x3630('0x2b')](_[_0x3630('0x34')](_0x131bf6[_0x3630('0x2a')],_0x293440[_0x3630('0x2b')]));if(_0x131bf6[_0x3630('0x2a')]['filter']){_0x553f0a[_0x3630('0x37')]=_[_0x3630('0x36')](_0x553f0a['where'],{'$or':_[_0x3630('0x26')](_0x553f0a['attributes'],function(_0x4db45c){var _0x4499b7={};_0x4499b7[_0x4db45c]={'$like':'%'+_0x131bf6[_0x3630('0x2a')][_0x3630('0x35')]+'%'};return _0x4499b7;})});}_0x553f0a=_['merge']({},_0x553f0a,_0x131bf6[_0x3630('0x3a')]);return _0x5e2047['getConfigurations'](_0x553f0a);}})[_0x3630('0x20')](function(_0x25e5ba){if(_0x25e5ba){_0x1ee01e=_0x25e5ba[_0x3630('0x2f')];if(!_0x131bf6['query'][_0x3630('0x30')]('nolimit')){_0x553f0a[_0x3630('0x31')]=qs[_0x3630('0x31')](_0x131bf6[_0x3630('0x2a')]['limit']);_0x553f0a[_0x3630('0x18')]=qs[_0x3630('0x18')](_0x131bf6[_0x3630('0x2a')][_0x3630('0x18')]);}return _0x5e2047[_0x3630('0x47')](_0x553f0a);}})[_0x3630('0x20')](function(_0x574cc7){if(_0x574cc7){return _0x574cc7?{'count':_0x1ee01e,'rows':_0x574cc7}:null;}})[_0x3630('0x20')](respondWithResult(_0x2ac86d,null))[_0x3630('0x3e')](handleError(_0x2ac86d,null));};exports[_0x3630('0x49')]=function(_0x37e606,_0x5eb159,_0x13147c){if(_0x37e606[_0x3630('0x44')]['id']){delete _0x37e606[_0x3630('0x44')]['id'];}return db[_0x3630('0x27')]['findOne']({'where':{'id':_0x37e606[_0x3630('0x45')]['id']}})['then'](handleEntityNotFound(_0x5eb159,null))[_0x3630('0x20')](function(_0xe43644){if(_0xe43644){_0x37e606['body'][_0x3630('0x4a')]=_0xe43644['id'];_0x37e606[_0x3630('0x44')]['Subjects']=integrations[_0x3630('0x4b')](_0x37e606['body'][_0x3630('0x4c')],_0x37e606[_0x3630('0x44')][_0x3630('0x38')]);_0x37e606['body'][_0x3630('0x4d')]=integrations['getDescriptions'](_0x37e606[_0x3630('0x44')][_0x3630('0x4c')],_0x37e606[_0x3630('0x44')][_0x3630('0x38')]);return db[_0x3630('0x48')][_0x3630('0x43')](_0x37e606[_0x3630('0x44')],{'include':[{'model':db['ServicenowField'],'as':'Subjects'},{'model':db[_0x3630('0x4e')],'as':_0x3630('0x4d')}]});}return null;})[_0x3630('0x20')](respondWithResult(_0x5eb159,null))[_0x3630('0x3e')](handleError(_0x5eb159,null));};exports['getFields']=function(_0x3be4cf,_0x21f0d5,_0x3bbd6a){var _0x5ddfae=[_0x3630('0x4f'),_0x3630('0x50'),_0x3630('0x51'),_0x3630('0x52'),_0x3630('0x53'),_0x3630('0x54'),'incident_state','severity',_0x3630('0x55')];var _0x14ca9f=[_0x3630('0x56'),'made_sla',_0x3630('0x57'),_0x3630('0x58'),_0x3630('0x59'),'sys_updated_on',_0x3630('0x5a'),_0x3630('0x50'),'approval_history',_0x3630('0x5b'),_0x3630('0x5c'),'sys_updated_by',_0x3630('0x5d'),'user_input',_0x3630('0x5e'),_0x3630('0x5f'),_0x3630('0x60'),_0x3630('0x61'),_0x3630('0x51'),_0x3630('0x32'),'calendar_stc',_0x3630('0x62'),'cmdb_ci',_0x3630('0x63'),_0x3630('0x64'),_0x3630('0x65'),_0x3630('0x66'),'business_service',_0x3630('0x67'),'sys_domain_path',_0x3630('0x68'),_0x3630('0x69'),_0x3630('0x6a'),_0x3630('0x6b'),_0x3630('0x6c'),_0x3630('0x6d'),'work_end',_0x3630('0x6e'),_0x3630('0x6f'),_0x3630('0x70'),_0x3630('0x71'),_0x3630('0x52'),_0x3630('0x72'),'short_description',_0x3630('0x53'),_0x3630('0x73'),_0x3630('0x74'),_0x3630('0x75'),_0x3630('0x76'),_0x3630('0x77'),_0x3630('0x78'),_0x3630('0x79'),_0x3630('0x7a'),_0x3630('0x54'),_0x3630('0x7b'),_0x3630('0x7c'),_0x3630('0x7d'),_0x3630('0x7e'),_0x3630('0x7f'),_0x3630('0x80'),_0x3630('0x81'),_0x3630('0x82'),'incident_state',_0x3630('0x83'),_0x3630('0x84'),_0x3630('0x85'),'reassignment_count',_0x3630('0x86'),'assigned_to',_0x3630('0x87'),'comments',_0x3630('0x88'),_0x3630('0x89'),_0x3630('0x8a'),'due_date',_0x3630('0x8b'),'reopen_count',_0x3630('0x8c'),_0x3630('0x8d'),_0x3630('0x8e'),_0x3630('0x8f'),_0x3630('0x90'),_0x3630('0x55')];var _0x28b6ed='';var _0x510a8e='';var _0x1a21ce=[];var _0xe9e908='';var _0x2ee502='';var _0x30db5f=[];var _0x5df5d2='';var _0x3c8b00='';var _0x5a1756={};var _0x2c1b40='';return db[_0x3630('0x27')][_0x3630('0x91')]({'where':{'id':_0x3be4cf[_0x3630('0x45')]['id']},'attributes':['id','username',_0x3630('0x92'),_0x3630('0x93'),_0x3630('0x94'),_0x3630('0x95')]})[_0x3630('0x20')](handleEntityNotFound(_0x21f0d5,null))['then'](function(_0x59321d){if(_0x59321d){_0x2c1b40=_0x59321d['remoteUri'];var _0x1cd09b=_0x2c1b40[_0x3630('0x96')](-0x1);if(_0x1cd09b==='/'){_0x2c1b40=_0x2c1b40['substring'](0x0,_0x2c1b40[_0x3630('0x97')](_0x1cd09b));}_0x3c8b00=util[_0x3630('0x98')]('%s/api/now/doc/table/schema/',_0x2c1b40);_0x5df5d2=util['format'](_0x3630('0x99'),_0x2c1b40);_0x5a1756={'user':_0x59321d[_0x3630('0x9a')],'pass':_0x59321d[_0x3630('0x92')]};var _0x45baff={'method':_0x3630('0x9b'),'uri':_0x3c8b00+_0x3630('0x9c'),'auth':_0x5a1756,'json':!![]};return rp(_0x45baff);}})[_0x3630('0x20')](function(_0x2274c5){if(_0x2274c5[_0x3630('0x9d')][_0x3630('0x2f')]>0x0){_0x28b6ed=_0x2274c5[_0x3630('0x9d')];}console['log']('incident\x20table\x20objects',_0x28b6ed);_0x30db5f=[];_0x510a8e=Object['assign']([],_0x28b6ed);_[_0x3630('0x9e')](_0x510a8e,function(_0x18ffb8){return!_0x5ddfae[_0x3630('0x9f')](_0x18ffb8[_0x3630('0x23')]);});_0x510a8e['forEach'](function(_0x33f0fc){var _0x477878=createFieldObject(_0x5df5d2,_0x5a1756,_0x33f0fc[_0x3630('0xa0')],_0x33f0fc[_0x3630('0x23')],_0x33f0fc['label'],![]);_0x30db5f[_0x3630('0xa1')](_0x477878);});return Promise[_0x3630('0xa2')](_0x30db5f);})[_0x3630('0x20')](function(_0x1965b8){_0x1a21ce=_0x1965b8;_0xe9e908=Object['assign']([],_0x28b6ed);console[_0x3630('0xa3')]('TCL:\x20_object',_0x28b6ed);_[_0x3630('0x9e')](_0xe9e908,function(_0x4a5c4f){return _0x14ca9f[_0x3630('0x9f')](_0x4a5c4f['name']);});console[_0x3630('0xa3')](_0x3630('0xa4'),_0xe9e908);_0x30db5f=[];_0xe9e908['forEach'](function(_0x18eab6){var _0x131e9d=createFieldObject(_0x5df5d2,_0x5a1756,_0x18eab6[_0x3630('0xa0')],_0x18eab6[_0x3630('0x23')],_0x18eab6[_0x3630('0xa5')],!![]);_0x30db5f['push'](_0x131e9d);});return Promise[_0x3630('0xa2')](_0x30db5f);})['then'](function(_0x533dfd){_0x2ee502=_0x533dfd;var _0x53316c=_0x1a21ce[_0x3630('0xa6')](_0x2ee502);return{'count':_0x53316c['length'],'rows':_0x53316c};})['then'](respondWithResult(_0x21f0d5,null))[_0x3630('0x3e')](function(_0x40dada){console[_0x3630('0xa3')]('ServiceNow\x20error:\x20'+_0x40dada);var _0x5073b3=_0x3be4cf[_0x3630('0x2a')][_0x3630('0xa7')]?0x1f4:_0x40dada['statusCode']||0x1f4;logger[_0x3630('0x22')](_0x40dada[_0x3630('0xa8')]);delete _0x40dada[_0x3630('0x23')];if(_0x5073b3===0x191){_0x5073b3=0x190;}_0x21f0d5['status'](_0x5073b3)[_0x3630('0x24')](_0x3be4cf[_0x3630('0x2a')][_0x3630('0xa7')]?{'message':_0x3630('0xa9'),'statusCode':_0x40dada[_0x3630('0xaa')]}:_0x40dada);});};function createFieldObject(_0x44ccd0,_0x5e8b22,_0x2fd5f9,_0x3af0ef,_0x297f8d,_0x32f607){return new Promise(function(_0xbd0e2d,_0x5ede6d){var _0x38cefa={'id':_0x3af0ef,'name':_0x297f8d,'custom':_0x32f607};if(_0x2fd5f9===_0x3630('0xab')){_0x38cefa[_0x3630('0x3a')]=[{'name':_0x3630('0xac'),'value':_0x3630('0xad')},{'name':'False','value':'false'}];_0xbd0e2d(_0x38cefa);}else{var _0x46715d={'method':_0x3630('0x9b'),'uri':_0x44ccd0+_0x3630('0xae')+_0x3af0ef,'auth':_0x5e8b22,'json':!![]};return rp(_0x46715d)[_0x3630('0x20')](function(_0x547a04){var _0x3559f3=[];if(_0x547a04[_0x3630('0x9d')][_0x3630('0x2f')]>0x0){_0x547a04[_0x3630('0x9d')][_0x3630('0xaf')](function(_0x2dd0ff){if(_0x2dd0ff[_0x3630('0xb0')]==='false'){var _0x473673={'name':_0x2dd0ff[_0x3630('0xa5')],'value':_0x2dd0ff[_0x3630('0xb1')]};_0x3559f3[_0x3630('0xa1')](_0x473673);}});}_0x38cefa[_0x3630('0x3a')]=_0x3559f3;if(_0x38cefa[_0x3630('0x3a')][_0x3630('0x2f')]>0x0){_0xbd0e2d(_0x38cefa);}else{if(_0x32f607==![]){_0xbd0e2d();}else{_0xbd0e2d(_0x38cefa);}}});}});} \ No newline at end of file +var _0xa4cb=['../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','limit','count','offset','set','json','apply','reject','save','error','stack','name','send','map','ServicenowAccount','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','then','rows','catch','params','intersection','create','update','body','find','destroy','getConfigurations','ServicenowConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','incident_state','severity','category','parent','caused_by','watch_list','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_domain','state','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','work_end','approval_set','work_notes','short_description','delivery_task','assignment_group','additional_assignee_list','description','calendar_duration','notify','sys_class_name','close_notes','follow_up','parent_incident','sys_id','contact_type','problem_id','reassignment_count','activity_due','comments','approval','due_date','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','password','email','remoteUri','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','username','GET','result','assign','forEach','internalType','label','push','all','log','TCL:\x20_object','includes','concat','ServiceNow\x20error:\x20','test','statusCode','boolean','true','False','sys_choice?sysparm_query=name=incident^element=','false','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis'];(function(_0x36d09a,_0x4cd6c3){var _0x1a4b8a=function(_0x2f3a04){while(--_0x2f3a04){_0x36d09a['push'](_0x36d09a['shift']());}};_0x1a4b8a(++_0x4cd6c3);}(_0xa4cb,0x154));var _0xba4c=function(_0x52efc7,_0x5ae099){_0x52efc7=_0x52efc7-0x0;var _0x23c956=_0xa4cb[_0x52efc7];return _0x23c956;};'use strict';var emlformat=require(_0xba4c('0x0'));var rimraf=require(_0xba4c('0x1'));var zipdir=require(_0xba4c('0x2'));var jsonpatch=require(_0xba4c('0x3'));var rp=require(_0xba4c('0x4'));var moment=require(_0xba4c('0x5'));var BPromise=require(_0xba4c('0x6'));var Mustache=require(_0xba4c('0x7'));var util=require(_0xba4c('0x8'));var path=require(_0xba4c('0x9'));var sox=require(_0xba4c('0xa'));var csv=require(_0xba4c('0xb'));var ejs=require(_0xba4c('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xba4c('0xd'));var squel=require(_0xba4c('0xe'));var crypto=require('crypto');var jsforce=require(_0xba4c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xba4c('0xb'));var querystring=require('querystring');var Papa=require(_0xba4c('0x10'));var Redis=require(_0xba4c('0x11'));var authService=require(_0xba4c('0x12'));var qs=require(_0xba4c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xba4c('0x14'));var utils=require(_0xba4c('0x15'));var config=require(_0xba4c('0x16'));var licenseUtil=require(_0xba4c('0x17'));var db=require(_0xba4c('0x18'))['db'];var integrations=require(_0xba4c('0x19'));function respondWithStatusCode(_0x3db2b1,_0xe6b68b){_0xe6b68b=_0xe6b68b||0xcc;return function(_0x447c14){if(_0x447c14){return _0x3db2b1[_0xba4c('0x1a')](_0xe6b68b);}return _0x3db2b1['status'](_0xe6b68b)[_0xba4c('0x1b')]();};}function respondWithResult(_0x324483,_0x1a05fd){_0x1a05fd=_0x1a05fd||0xc8;return function(_0x324619){if(_0x324619){return _0x324483[_0xba4c('0x1c')](_0x1a05fd)['json'](_0x324619);}};}function respondWithFilteredResult(_0x37a8ee,_0x1c6b45){return function(_0x4b94b2){if(_0x4b94b2){var _0x1b8e20=typeof _0x1c6b45['offset']==='undefined'&&typeof _0x1c6b45[_0xba4c('0x1d')]==='undefined';var _0x142150=_0x4b94b2[_0xba4c('0x1e')];var _0xcdda0f=_0x1b8e20?0x0:_0x1c6b45[_0xba4c('0x1f')];var _0x26c6bd=_0x1b8e20?_0x4b94b2['count']:_0x1c6b45[_0xba4c('0x1f')]+_0x1c6b45[_0xba4c('0x1d')];var _0x32a212;if(_0x26c6bd>=_0x142150){_0x26c6bd=_0x142150;_0x32a212=0xc8;}else{_0x32a212=0xce;}_0x37a8ee[_0xba4c('0x1c')](_0x32a212);return _0x37a8ee[_0xba4c('0x20')]('Content-Range',_0xcdda0f+'-'+_0x26c6bd+'/'+_0x142150)[_0xba4c('0x21')](_0x4b94b2);}return null;};}function patchUpdates(_0x321c60){return function(_0x141b66){try{jsonpatch[_0xba4c('0x22')](_0x141b66,_0x321c60,!![]);}catch(_0x25b7a1){return BPromise[_0xba4c('0x23')](_0x25b7a1);}return _0x141b66[_0xba4c('0x24')]();};}function saveUpdates(_0x488594,_0x389836){return function(_0x3fd023){if(_0x3fd023){return _0x3fd023['update'](_0x488594)['then'](function(_0xd35aa8){return _0xd35aa8;});}return null;};}function removeEntity(_0x14b9e8,_0x820157){return function(_0x750a55){if(_0x750a55){return _0x750a55['destroy']()['then'](function(){_0x14b9e8[_0xba4c('0x1c')](0xcc)[_0xba4c('0x1b')]();});}};}function handleEntityNotFound(_0x401e71,_0x26fc44){return function(_0x3e680d){if(!_0x3e680d){_0x401e71[_0xba4c('0x1a')](0x194);}return _0x3e680d;};}function handleError(_0x1f825e,_0x13df78){_0x13df78=_0x13df78||0x1f4;return function(_0x46cb35){logger[_0xba4c('0x25')](_0x46cb35[_0xba4c('0x26')]);if(_0x46cb35[_0xba4c('0x27')]){delete _0x46cb35[_0xba4c('0x27')];}_0x1f825e[_0xba4c('0x1c')](_0x13df78)[_0xba4c('0x28')](_0x46cb35);};}exports['index']=function(_0x5415d5,_0x58a858){var _0x32d85d={},_0x3e8cc5={},_0x170f37={'count':0x0,'rows':[]};var _0xec246e=_[_0xba4c('0x29')](db[_0xba4c('0x2a')][_0xba4c('0x2b')],function(_0x2ddd16){return{'name':_0x2ddd16[_0xba4c('0x2c')],'type':_0x2ddd16['type'][_0xba4c('0x2d')]};});_0x3e8cc5[_0xba4c('0x2e')]=_[_0xba4c('0x29')](_0xec246e,'name');_0x3e8cc5[_0xba4c('0x2f')]=_[_0xba4c('0x30')](_0x5415d5['query']);_0x3e8cc5[_0xba4c('0x31')]=_['intersection'](_0x3e8cc5[_0xba4c('0x2e')],_0x3e8cc5[_0xba4c('0x2f')]);_0x32d85d[_0xba4c('0x32')]=_['intersection'](_0x3e8cc5[_0xba4c('0x2e')],qs[_0xba4c('0x33')](_0x5415d5[_0xba4c('0x2f')][_0xba4c('0x33')]));_0x32d85d['attributes']=_0x32d85d[_0xba4c('0x32')][_0xba4c('0x34')]?_0x32d85d[_0xba4c('0x32')]:_0x3e8cc5['model'];if(!_0x5415d5['query'][_0xba4c('0x35')](_0xba4c('0x36'))){_0x32d85d[_0xba4c('0x1d')]=qs[_0xba4c('0x1d')](_0x5415d5[_0xba4c('0x2f')][_0xba4c('0x1d')]);_0x32d85d['offset']=qs[_0xba4c('0x1f')](_0x5415d5[_0xba4c('0x2f')][_0xba4c('0x1f')]);}_0x32d85d[_0xba4c('0x37')]=qs['sort'](_0x5415d5[_0xba4c('0x2f')][_0xba4c('0x38')]);_0x32d85d[_0xba4c('0x39')]=qs[_0xba4c('0x31')](_[_0xba4c('0x3a')](_0x5415d5[_0xba4c('0x2f')],_0x3e8cc5[_0xba4c('0x31')]),_0xec246e);if(_0x5415d5[_0xba4c('0x2f')]['filter']){_0x32d85d['where']=_[_0xba4c('0x3b')](_0x32d85d[_0xba4c('0x39')],{'$or':_['map'](_0xec246e,function(_0x29e86c){if(_0x29e86c[_0xba4c('0x3c')]!==_0xba4c('0x3d')){var _0x26335a={};_0x26335a[_0x29e86c[_0xba4c('0x27')]]={'$like':'%'+_0x5415d5['query'][_0xba4c('0x3e')]+'%'};return _0x26335a;}})});}_0x32d85d=_[_0xba4c('0x3b')]({},_0x32d85d,_0x5415d5[_0xba4c('0x3f')]);var _0x4ee0d6={'where':_0x32d85d[_0xba4c('0x39')]};return db['ServicenowAccount'][_0xba4c('0x1e')](_0x4ee0d6)['then'](function(_0x357c6d){_0x170f37['count']=_0x357c6d;if(_0x5415d5['query'][_0xba4c('0x40')]){_0x32d85d[_0xba4c('0x41')]=[{'all':!![]}];}return db[_0xba4c('0x2a')][_0xba4c('0x42')](_0x32d85d);})[_0xba4c('0x43')](function(_0x4f89a3){_0x170f37[_0xba4c('0x44')]=_0x4f89a3;return _0x170f37;})[_0xba4c('0x43')](respondWithFilteredResult(_0x58a858,_0x32d85d))[_0xba4c('0x45')](handleError(_0x58a858,null));};exports['show']=function(_0x48fdae,_0x3b40fb){var _0x2e3bb3={'raw':![],'where':{'id':_0x48fdae[_0xba4c('0x46')]['id']}},_0x2ac1f1={};_0x2ac1f1[_0xba4c('0x2e')]=_['keys'](db[_0xba4c('0x2a')][_0xba4c('0x2b')]);_0x2ac1f1[_0xba4c('0x2f')]=_[_0xba4c('0x30')](_0x48fdae[_0xba4c('0x2f')]);_0x2ac1f1[_0xba4c('0x31')]=_[_0xba4c('0x47')](_0x2ac1f1[_0xba4c('0x2e')],_0x2ac1f1[_0xba4c('0x2f')]);_0x2e3bb3[_0xba4c('0x32')]=_[_0xba4c('0x47')](_0x2ac1f1['model'],qs[_0xba4c('0x33')](_0x48fdae['query']['fields']));_0x2e3bb3[_0xba4c('0x32')]=_0x2e3bb3[_0xba4c('0x32')][_0xba4c('0x34')]?_0x2e3bb3[_0xba4c('0x32')]:_0x2ac1f1[_0xba4c('0x2e')];if(_0x48fdae['query'][_0xba4c('0x40')]){_0x2e3bb3[_0xba4c('0x41')]=[{'all':!![]}];}_0x2e3bb3=_['merge']({},_0x2e3bb3,_0x48fdae[_0xba4c('0x3f')]);return db[_0xba4c('0x2a')]['find'](_0x2e3bb3)[_0xba4c('0x43')](handleEntityNotFound(_0x3b40fb,null))[_0xba4c('0x43')](respondWithResult(_0x3b40fb,null))[_0xba4c('0x45')](handleError(_0x3b40fb,null));};exports[_0xba4c('0x48')]=function(_0x32fc37,_0x4c663d){return db[_0xba4c('0x2a')][_0xba4c('0x48')](_0x32fc37['body'],{})['then'](respondWithResult(_0x4c663d,0xc9))[_0xba4c('0x45')](handleError(_0x4c663d,null));};exports[_0xba4c('0x49')]=function(_0x4bcbac,_0x22ef00){if(_0x4bcbac[_0xba4c('0x4a')]['id']){delete _0x4bcbac['body']['id'];}return db[_0xba4c('0x2a')][_0xba4c('0x4b')]({'where':{'id':_0x4bcbac['params']['id']}})[_0xba4c('0x43')](handleEntityNotFound(_0x22ef00,null))[_0xba4c('0x43')](saveUpdates(_0x4bcbac[_0xba4c('0x4a')],null))[_0xba4c('0x43')](respondWithResult(_0x22ef00,null))[_0xba4c('0x45')](handleError(_0x22ef00,null));};exports[_0xba4c('0x4c')]=function(_0x22a864,_0x4ecb5d){return db[_0xba4c('0x2a')][_0xba4c('0x4b')]({'where':{'id':_0x22a864[_0xba4c('0x46')]['id']}})[_0xba4c('0x43')](handleEntityNotFound(_0x4ecb5d,null))[_0xba4c('0x43')](removeEntity(_0x4ecb5d,null))[_0xba4c('0x45')](handleError(_0x4ecb5d,null));};exports[_0xba4c('0x4d')]=function(_0x18c027,_0x241acf,_0x2148b4){var _0x5b7ff5={};var _0x22a767={};var _0x139650;var _0xb609fa;return db[_0xba4c('0x2a')]['findOne']({'where':{'id':_0x18c027['params']['id']}})[_0xba4c('0x43')](handleEntityNotFound(_0x241acf,null))['then'](function(_0x1d7b55){if(_0x1d7b55){_0x139650=_0x1d7b55;_0x22a767['model']=_[_0xba4c('0x30')](db[_0xba4c('0x4e')][_0xba4c('0x2b')]);_0x22a767['query']=_[_0xba4c('0x30')](_0x18c027['query']);_0x22a767[_0xba4c('0x31')]=_[_0xba4c('0x47')](_0x22a767['model'],_0x22a767[_0xba4c('0x2f')]);_0x5b7ff5['attributes']=_[_0xba4c('0x47')](_0x22a767[_0xba4c('0x2e')],qs['fields'](_0x18c027[_0xba4c('0x2f')][_0xba4c('0x33')]));_0x5b7ff5[_0xba4c('0x32')]=_0x5b7ff5['attributes'][_0xba4c('0x34')]?_0x5b7ff5[_0xba4c('0x32')]:_0x22a767['model'];_0x5b7ff5[_0xba4c('0x37')]=qs[_0xba4c('0x38')](_0x18c027['query'][_0xba4c('0x38')]);_0x5b7ff5[_0xba4c('0x39')]=qs[_0xba4c('0x31')](_[_0xba4c('0x3a')](_0x18c027[_0xba4c('0x2f')],_0x22a767[_0xba4c('0x31')]));if(_0x18c027[_0xba4c('0x2f')][_0xba4c('0x3e')]){_0x5b7ff5[_0xba4c('0x39')]=_['merge'](_0x5b7ff5[_0xba4c('0x39')],{'$or':_[_0xba4c('0x29')](_0x5b7ff5[_0xba4c('0x32')],function(_0x2bb06c){var _0xed2126={};_0xed2126[_0x2bb06c]={'$like':'%'+_0x18c027[_0xba4c('0x2f')]['filter']+'%'};return _0xed2126;})});}_0x5b7ff5=_[_0xba4c('0x3b')]({},_0x5b7ff5,_0x18c027[_0xba4c('0x3f')]);return _0x139650[_0xba4c('0x4d')](_0x5b7ff5);}})[_0xba4c('0x43')](function(_0x415f97){if(_0x415f97){_0xb609fa=_0x415f97[_0xba4c('0x34')];if(!_0x18c027[_0xba4c('0x2f')][_0xba4c('0x35')](_0xba4c('0x36'))){_0x5b7ff5['limit']=qs[_0xba4c('0x1d')](_0x18c027[_0xba4c('0x2f')]['limit']);_0x5b7ff5['offset']=qs[_0xba4c('0x1f')](_0x18c027[_0xba4c('0x2f')][_0xba4c('0x1f')]);}return _0x139650['getConfigurations'](_0x5b7ff5);}})[_0xba4c('0x43')](function(_0x1783c0){if(_0x1783c0){return _0x1783c0?{'count':_0xb609fa,'rows':_0x1783c0}:null;}})[_0xba4c('0x43')](respondWithResult(_0x241acf,null))[_0xba4c('0x45')](handleError(_0x241acf,null));};exports[_0xba4c('0x4f')]=function(_0x4bc76f,_0xe8af8e,_0x2ed3bf){if(_0x4bc76f['body']['id']){delete _0x4bc76f['body']['id'];}return db[_0xba4c('0x2a')]['findOne']({'where':{'id':_0x4bc76f[_0xba4c('0x46')]['id']}})[_0xba4c('0x43')](handleEntityNotFound(_0xe8af8e,null))[_0xba4c('0x43')](function(_0xb0d56a){if(_0xb0d56a){_0x4bc76f[_0xba4c('0x4a')][_0xba4c('0x50')]=_0xb0d56a['id'];_0x4bc76f[_0xba4c('0x4a')][_0xba4c('0x51')]=integrations[_0xba4c('0x52')](_0x4bc76f[_0xba4c('0x4a')][_0xba4c('0x53')],_0x4bc76f[_0xba4c('0x4a')]['type']);_0x4bc76f[_0xba4c('0x4a')][_0xba4c('0x54')]=integrations[_0xba4c('0x55')](_0x4bc76f[_0xba4c('0x4a')][_0xba4c('0x53')],_0x4bc76f[_0xba4c('0x4a')][_0xba4c('0x3c')]);return db[_0xba4c('0x4e')]['create'](_0x4bc76f['body'],{'include':[{'model':db[_0xba4c('0x56')],'as':_0xba4c('0x51')},{'model':db[_0xba4c('0x56')],'as':'Descriptions'}]});}return null;})[_0xba4c('0x43')](respondWithResult(_0xe8af8e,null))[_0xba4c('0x45')](handleError(_0xe8af8e,null));};exports[_0xba4c('0x57')]=function(_0x396b55,_0x3bfd76,_0x831bc7){var _0x54441b=[_0xba4c('0x58'),_0xba4c('0x59'),_0xba4c('0x5a'),_0xba4c('0x5b'),_0xba4c('0x5c'),'notify',_0xba4c('0x5d'),_0xba4c('0x5e'),_0xba4c('0x5f')];var _0x173ad6=[_0xba4c('0x60'),_0xba4c('0x58'),_0xba4c('0x61'),_0xba4c('0x62'),'upon_reject','sys_updated_on',_0xba4c('0x63'),_0xba4c('0x59'),_0xba4c('0x64'),_0xba4c('0x65'),_0xba4c('0x66'),_0xba4c('0x67'),_0xba4c('0x68'),_0xba4c('0x69'),'sys_created_on',_0xba4c('0x6a'),_0xba4c('0x6b'),'sys_created_by',_0xba4c('0x5a'),_0xba4c('0x37'),_0xba4c('0x6c'),_0xba4c('0x6d'),_0xba4c('0x6e'),_0xba4c('0x6f'),_0xba4c('0x70'),_0xba4c('0x71'),_0xba4c('0x72'),_0xba4c('0x73'),'priority',_0xba4c('0x74'),_0xba4c('0x75'),_0xba4c('0x76'),_0xba4c('0x77'),_0xba4c('0x78'),_0xba4c('0x79'),'group_list',_0xba4c('0x7a'),'reopened_time','resolved_at','caller_id',_0xba4c('0x7b'),_0xba4c('0x5b'),_0xba4c('0x7c'),_0xba4c('0x7d'),_0xba4c('0x5c'),'correlation_display',_0xba4c('0x7e'),'work_start',_0xba4c('0x7f'),'business_stc',_0xba4c('0x80'),_0xba4c('0x81'),_0xba4c('0x82'),_0xba4c('0x83'),_0xba4c('0x84'),_0xba4c('0x85'),'closed_by',_0xba4c('0x86'),_0xba4c('0x87'),_0xba4c('0x88'),_0xba4c('0x89'),'reopened_by',_0xba4c('0x5d'),'urgency',_0xba4c('0x8a'),'company',_0xba4c('0x8b'),_0xba4c('0x8c'),'assigned_to','severity',_0xba4c('0x8d'),'sla_due',_0xba4c('0x8e'),'comments_and_work_notes',_0xba4c('0x8f'),_0xba4c('0x90'),_0xba4c('0x91'),_0xba4c('0x92'),_0xba4c('0x93'),'upon_approval',_0xba4c('0x94'),'location',_0xba4c('0x5f')];var _0x3319fa='';var _0x27a808='';var _0x374fd5=[];var _0x3c5523='';var _0xe566c9='';var _0x1f6e21=[];var _0x1c397e='';var _0x1f9b81='';var _0x45d8b4={};var _0x34bd28='';return db['ServicenowAccount']['findOne']({'where':{'id':_0x396b55[_0xba4c('0x46')]['id']},'attributes':['id','username',_0xba4c('0x95'),_0xba4c('0x96'),'remoteUri','serverUrl']})['then'](handleEntityNotFound(_0x3bfd76,null))['then'](function(_0x4e75d9){if(_0x4e75d9){_0x34bd28=_0x4e75d9[_0xba4c('0x97')];var _0x39fb16=_0x34bd28[_0xba4c('0x98')](-0x1);if(_0x39fb16==='/'){_0x34bd28=_0x34bd28[_0xba4c('0x99')](0x0,_0x34bd28[_0xba4c('0x9a')](_0x39fb16));}_0x1f9b81=util['format'](_0xba4c('0x9b'),_0x34bd28);_0x1c397e=util[_0xba4c('0x9c')]('%s/api/now/table/',_0x34bd28);_0x45d8b4={'user':_0x4e75d9[_0xba4c('0x9d')],'pass':_0x4e75d9[_0xba4c('0x95')]};var _0x3f5341={'method':_0xba4c('0x9e'),'uri':_0x1f9b81+'incident?sysparm_display_value=all','auth':_0x45d8b4,'json':!![]};return rp(_0x3f5341);}})[_0xba4c('0x43')](function(_0xf3830c){if(_0xf3830c[_0xba4c('0x9f')]['length']>0x0){_0x3319fa=_0xf3830c['result'];}console['log']('incident\x20table\x20objects',_0x3319fa);_0x1f6e21=[];_0x27a808=Object[_0xba4c('0xa0')]([],_0x3319fa);_['remove'](_0x27a808,function(_0x52e3fc){return!_0x54441b['includes'](_0x52e3fc[_0xba4c('0x27')]);});_0x27a808[_0xba4c('0xa1')](function(_0x1cdd16){var _0x51c9ab=createFieldObject(_0x1c397e,_0x45d8b4,_0x1cdd16[_0xba4c('0xa2')],_0x1cdd16[_0xba4c('0x27')],_0x1cdd16[_0xba4c('0xa3')],![]);_0x1f6e21[_0xba4c('0xa4')](_0x51c9ab);});return Promise[_0xba4c('0xa5')](_0x1f6e21);})[_0xba4c('0x43')](function(_0x435bd7){_0x374fd5=_0x435bd7;_0x3c5523=Object[_0xba4c('0xa0')]([],_0x3319fa);console[_0xba4c('0xa6')](_0xba4c('0xa7'),_0x3319fa);_['remove'](_0x3c5523,function(_0xcfe5ce){return _0x173ad6[_0xba4c('0xa8')](_0xcfe5ce[_0xba4c('0x27')]);});console['log']('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x3c5523);_0x1f6e21=[];_0x3c5523[_0xba4c('0xa1')](function(_0xb0647e){var _0x17a9c6=createFieldObject(_0x1c397e,_0x45d8b4,_0xb0647e[_0xba4c('0xa2')],_0xb0647e['name'],_0xb0647e['label'],!![]);_0x1f6e21[_0xba4c('0xa4')](_0x17a9c6);});return Promise['all'](_0x1f6e21);})[_0xba4c('0x43')](function(_0x5b2ac7){_0xe566c9=_0x5b2ac7;var _0x54203f=_0x374fd5[_0xba4c('0xa9')](_0xe566c9);return{'count':_0x54203f['length'],'rows':_0x54203f};})[_0xba4c('0x43')](respondWithResult(_0x3bfd76,null))[_0xba4c('0x45')](function(_0x32018c){console[_0xba4c('0xa6')](_0xba4c('0xaa')+_0x32018c);var _0x564a79=_0x396b55[_0xba4c('0x2f')][_0xba4c('0xab')]?0x1f4:_0x32018c[_0xba4c('0xac')]||0x1f4;logger['error'](_0x32018c[_0xba4c('0x26')]);delete _0x32018c[_0xba4c('0x27')];if(_0x564a79===0x191){_0x564a79=0x190;}_0x3bfd76[_0xba4c('0x1c')](_0x564a79)['send'](_0x396b55[_0xba4c('0x2f')][_0xba4c('0xab')]?{'message':'Wrong\x20credentials','statusCode':_0x32018c[_0xba4c('0xac')]}:_0x32018c);});};function createFieldObject(_0x2d2d04,_0x13b8bf,_0x581119,_0x2ee58a,_0x24b949,_0x3ba856){return new Promise(function(_0x4e35a4,_0x22c259){var _0x5001c0={'id':_0x2ee58a,'name':_0x24b949,'custom':_0x3ba856};if(_0x581119===_0xba4c('0xad')){_0x5001c0[_0xba4c('0x3f')]=[{'name':'True','value':_0xba4c('0xae')},{'name':_0xba4c('0xaf'),'value':'false'}];_0x4e35a4(_0x5001c0);}else{var _0x4bb44c={'method':_0xba4c('0x9e'),'uri':_0x2d2d04+_0xba4c('0xb0')+_0x2ee58a,'auth':_0x13b8bf,'json':!![]};return rp(_0x4bb44c)[_0xba4c('0x43')](function(_0x1d78fd){var _0x4231e9=[];if(_0x1d78fd[_0xba4c('0x9f')]['length']>0x0){_0x1d78fd[_0xba4c('0x9f')][_0xba4c('0xa1')](function(_0x4a692a){if(_0x4a692a['inactive']===_0xba4c('0xb1')){var _0xc4af4b={'name':_0x4a692a['label'],'value':_0x4a692a[_0xba4c('0xb2')]};_0x4231e9[_0xba4c('0xa4')](_0xc4af4b);}});}_0x5001c0[_0xba4c('0x3f')]=_0x4231e9;if(_0x5001c0['options']['length']>0x0){_0x4e35a4(_0x5001c0);}else{if(_0x3ba856==![]){_0x4e35a4();}else{_0x4e35a4(_0x5001c0);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index aefbae1..2e13af2 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 _0x90b1=['define','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x90b1,0x1bb));var _0x190b=function(_0x2cba12,_0x14460a){_0x2cba12=_0x2cba12-0x0;var _0x25935a=_0x90b1[_0x2cba12];return _0x25935a;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var logger=require(_0x190b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x190b('0x3'));var rp=require(_0x190b('0x4'));var fs=require('fs');var path=require(_0x190b('0x5'));var rimraf=require(_0x190b('0x6'));var config=require('../../config/environment');var attributes=require('./intServicenowAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x27ff8c,_0x34a689){return _0x27ff8c[_0x190b('0x7')](_0x190b('0x8'),attributes,{'tableName':_0x190b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc97=['request-promise','path','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','int_servicenow_accounts','lodash','util','../../config/logger','moment'];(function(_0x4b09cb,_0x284ef9){var _0x4b27ad=function(_0x326000){while(--_0x326000){_0x4b09cb['push'](_0x4b09cb['shift']());}};_0x4b27ad(++_0x284ef9);}(_0xdc97,0x13b));var _0x7dc9=function(_0x348f7b,_0x523850){_0x348f7b=_0x348f7b-0x0;var _0x429ed0=_0xdc97[_0x348f7b];return _0x429ed0;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var logger=require(_0x7dc9('0x2'))('api');var moment=require(_0x7dc9('0x3'));var BPromise=require('bluebird');var rp=require(_0x7dc9('0x4'));var fs=require('fs');var path=require(_0x7dc9('0x5'));var rimraf=require('rimraf');var config=require(_0x7dc9('0x6'));var attributes=require(_0x7dc9('0x7'));var integrations=require(_0x7dc9('0x8'));module[_0x7dc9('0x9')]=function(_0x589f02,_0x2636ef){return _0x589f02['define']('ServicenowAccount',attributes,{'tableName':_0x7dc9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index aef080e..e5cba5a 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 _0xe48b=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetServicenowAccount','findAll','options','raw','where','attributes','limit','include','model','map','stringify','ServicenowAccount','find','ShowServicenowAccount','util'];(function(_0x2c17eb,_0x39b2e5){var _0x1735da=function(_0xfe75fb){while(--_0xfe75fb){_0x2c17eb['push'](_0x2c17eb['shift']());}};_0x1735da(++_0x39b2e5);}(_0xe48b,0xd7));var _0xbe48=function(_0x54c32e,_0x2f4e49){_0x54c32e=_0x54c32e-0x0;var _0x37efed=_0xe48b[_0x54c32e];return _0x37efed;};'use strict';var _=require('lodash');var util=require(_0xbe48('0x0'));var moment=require(_0xbe48('0x1'));var BPromise=require(_0xbe48('0x2'));var rs=require(_0xbe48('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbe48('0x4'));var logger=require(_0xbe48('0x5'))(_0xbe48('0x6'));var config=require(_0xbe48('0x7'));var jayson=require(_0xbe48('0x8'));var client=jayson['client'][_0xbe48('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd33200,_0x6ec882,_0x297bb4){return new BPromise(function(_0x3f22ce,_0x223775){return client[_0xbe48('0xa')](_0xd33200,_0x297bb4)[_0xbe48('0xb')](function(_0x4f3aa0){logger[_0xbe48('0xc')](_0xbe48('0xd'),_0x6ec882,_0xbe48('0xe'));logger[_0xbe48('0xf')](_0xbe48('0x10'),_0x6ec882,'request\x20sent',JSON['stringify'](_0x4f3aa0));if(_0x4f3aa0[_0xbe48('0x11')]){if(_0x4f3aa0[_0xbe48('0x11')][_0xbe48('0x12')]===0x1f4){logger[_0xbe48('0x11')](_0xbe48('0xd'),_0x6ec882,_0x4f3aa0[_0xbe48('0x11')][_0xbe48('0x13')]);return _0x223775(_0x4f3aa0[_0xbe48('0x11')][_0xbe48('0x13')]);}logger[_0xbe48('0x11')](_0xbe48('0xd'),_0x6ec882,_0x4f3aa0[_0xbe48('0x11')][_0xbe48('0x13')]);return _0x3f22ce(_0x4f3aa0['error'][_0xbe48('0x13')]);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x6ec882,'request\x20sent');_0x3f22ce(_0x4f3aa0[_0xbe48('0x14')][_0xbe48('0x13')]);}})[_0xbe48('0x15')](function(_0x5ec9ab){logger[_0xbe48('0x11')](_0xbe48('0xd'),_0x6ec882,_0x5ec9ab);_0x223775(_0x5ec9ab);});});}exports[_0xbe48('0x16')]=function(_0x14d6cb){var _0x265a36=this;return new Promise(function(_0x1955bc,_0x5ca9b0){return db['ServicenowAccount'][_0xbe48('0x17')]({'raw':_0x14d6cb[_0xbe48('0x18')]?_0x14d6cb[_0xbe48('0x18')][_0xbe48('0x19')]===undefined?!![]:![]:!![],'where':_0x14d6cb['options']?_0x14d6cb[_0xbe48('0x18')][_0xbe48('0x1a')]||null:null,'attributes':_0x14d6cb[_0xbe48('0x18')]?_0x14d6cb[_0xbe48('0x18')][_0xbe48('0x1b')]||null:null,'limit':_0x14d6cb[_0xbe48('0x18')]?_0x14d6cb[_0xbe48('0x18')][_0xbe48('0x1c')]||null:null,'include':_0x14d6cb[_0xbe48('0x18')]?_0x14d6cb[_0xbe48('0x18')]['include']?_['map'](_0x14d6cb[_0xbe48('0x18')][_0xbe48('0x1d')],function(_0x476785){return{'model':db[_0x476785[_0xbe48('0x1e')]],'as':_0x476785['as'],'attributes':_0x476785[_0xbe48('0x1b')],'include':_0x476785[_0xbe48('0x1d')]?_['map'](_0x476785[_0xbe48('0x1d')],function(_0x1dc3d4){return{'model':db[_0x1dc3d4['model']],'as':_0x1dc3d4['as'],'attributes':_0x1dc3d4[_0xbe48('0x1b')],'include':_0x1dc3d4['include']?_[_0xbe48('0x1f')](_0x1dc3d4[_0xbe48('0x1d')],function(_0x46eef6){return{'model':db[_0x46eef6[_0xbe48('0x1e')]],'as':_0x46eef6['as'],'attributes':_0x46eef6[_0xbe48('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbe48('0xb')](function(_0x1e0ab7){logger[_0xbe48('0xc')](_0xbe48('0x16'),_0x14d6cb);logger[_0xbe48('0xf')](_0xbe48('0x16'),_0x14d6cb,JSON[_0xbe48('0x20')](_0x1e0ab7));_0x1955bc(_0x1e0ab7);})[_0xbe48('0x15')](function(_0x3f39e9){logger[_0xbe48('0x11')](_0xbe48('0x16'),_0x3f39e9[_0xbe48('0x13')],_0x14d6cb);_0x5ca9b0(_0x265a36['error'](0x1f4,_0x3f39e9['message']));});});};exports['ShowServicenowAccount']=function(_0x2fbac8){var _0x30fa4b=this;return new Promise(function(_0x3d52fa,_0x180568){return db[_0xbe48('0x21')][_0xbe48('0x22')]({'raw':_0x2fbac8[_0xbe48('0x18')]?_0x2fbac8['options'][_0xbe48('0x19')]===undefined?!![]:![]:!![],'where':_0x2fbac8[_0xbe48('0x18')]?_0x2fbac8['options']['where']||null:null,'attributes':_0x2fbac8[_0xbe48('0x18')]?_0x2fbac8[_0xbe48('0x18')][_0xbe48('0x1b')]||null:null,'include':_0x2fbac8[_0xbe48('0x18')]?_0x2fbac8['options'][_0xbe48('0x1d')]?_['map'](_0x2fbac8[_0xbe48('0x18')]['include'],function(_0x2bf7ae){return{'model':db[_0x2bf7ae[_0xbe48('0x1e')]],'as':_0x2bf7ae['as'],'attributes':_0x2bf7ae[_0xbe48('0x1b')],'include':_0x2bf7ae[_0xbe48('0x1d')]?_['map'](_0x2bf7ae[_0xbe48('0x1d')],function(_0x258e9a){return{'model':db[_0x258e9a[_0xbe48('0x1e')]],'as':_0x258e9a['as'],'attributes':_0x258e9a[_0xbe48('0x1b')],'include':_0x258e9a['include']?_[_0xbe48('0x1f')](_0x258e9a[_0xbe48('0x1d')],function(_0x3bf51f){return{'model':db[_0x3bf51f[_0xbe48('0x1e')]],'as':_0x3bf51f['as'],'attributes':_0x3bf51f[_0xbe48('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x49ea84){logger[_0xbe48('0xc')]('ShowServicenowAccount',_0x2fbac8);logger[_0xbe48('0xf')](_0xbe48('0x23'),_0x2fbac8,JSON[_0xbe48('0x20')](_0x49ea84));_0x3d52fa(_0x49ea84);})[_0xbe48('0x15')](function(_0x432159){logger[_0xbe48('0x11')](_0xbe48('0x23'),_0x432159[_0xbe48('0x13')],_0x2fbac8);_0x180568(_0x30fa4b['error'](0x1f4,_0x432159['message']));});});}; \ No newline at end of file +var _0xa393=['then','ServicenowAccount,\x20%s,\x20%s','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','catch','GetServicenowAccount','ServicenowAccount','findAll','options','where','attributes','limit','include','map','model','debug','stringify','ShowServicenowAccount','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0xfbd2bd,_0x5d7fd0){var _0x1e00c6=function(_0x111a2a){while(--_0x111a2a){_0xfbd2bd['push'](_0xfbd2bd['shift']());}};_0x1e00c6(++_0x5d7fd0);}(_0xa393,0xba));var _0x3a39=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0xa393[_0x22f8ab];return _0x2a70e5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3a39('0x0'));var BPromise=require(_0x3a39('0x1'));var rs=require(_0x3a39('0x2'));var fs=require('fs');var Redis=require(_0x3a39('0x3'));var db=require(_0x3a39('0x4'))['db'];var utils=require(_0x3a39('0x5'));var logger=require(_0x3a39('0x6'))(_0x3a39('0x7'));var config=require(_0x3a39('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3a39('0x9')][_0x3a39('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a23cf,_0x38792c,_0x3053d7){return new BPromise(function(_0x277520,_0x2f7e16){return client[_0x3a39('0xb')](_0x4a23cf,_0x3053d7)[_0x3a39('0xc')](function(_0x1fb02a){logger['info'](_0x3a39('0xd'),_0x38792c,'request\x20sent');logger['debug'](_0x3a39('0xe'),_0x38792c,_0x3a39('0xf'),JSON['stringify'](_0x1fb02a));if(_0x1fb02a['error']){if(_0x1fb02a[_0x3a39('0x10')]['code']===0x1f4){logger[_0x3a39('0x10')](_0x3a39('0xd'),_0x38792c,_0x1fb02a[_0x3a39('0x10')]['message']);return _0x2f7e16(_0x1fb02a[_0x3a39('0x10')]['message']);}logger[_0x3a39('0x10')](_0x3a39('0xd'),_0x38792c,_0x1fb02a[_0x3a39('0x10')][_0x3a39('0x11')]);return _0x277520(_0x1fb02a['error'][_0x3a39('0x11')]);}else{logger[_0x3a39('0x12')](_0x3a39('0xd'),_0x38792c,_0x3a39('0xf'));_0x277520(_0x1fb02a['result']['message']);}})[_0x3a39('0x13')](function(_0x516a4a){logger[_0x3a39('0x10')](_0x3a39('0xd'),_0x38792c,_0x516a4a);_0x2f7e16(_0x516a4a);});});}exports[_0x3a39('0x14')]=function(_0x32ebcd){var _0x1fc030=this;return new Promise(function(_0x6a5c3f,_0x3d9d4e){return db[_0x3a39('0x15')][_0x3a39('0x16')]({'raw':_0x32ebcd[_0x3a39('0x17')]?_0x32ebcd[_0x3a39('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x32ebcd['options']?_0x32ebcd[_0x3a39('0x17')][_0x3a39('0x18')]||null:null,'attributes':_0x32ebcd[_0x3a39('0x17')]?_0x32ebcd[_0x3a39('0x17')][_0x3a39('0x19')]||null:null,'limit':_0x32ebcd['options']?_0x32ebcd[_0x3a39('0x17')][_0x3a39('0x1a')]||null:null,'include':_0x32ebcd[_0x3a39('0x17')]?_0x32ebcd[_0x3a39('0x17')][_0x3a39('0x1b')]?_[_0x3a39('0x1c')](_0x32ebcd[_0x3a39('0x17')]['include'],function(_0x132efb){return{'model':db[_0x132efb[_0x3a39('0x1d')]],'as':_0x132efb['as'],'attributes':_0x132efb[_0x3a39('0x19')],'include':_0x132efb[_0x3a39('0x1b')]?_[_0x3a39('0x1c')](_0x132efb[_0x3a39('0x1b')],function(_0x3cc7ab){return{'model':db[_0x3cc7ab['model']],'as':_0x3cc7ab['as'],'attributes':_0x3cc7ab['attributes'],'include':_0x3cc7ab[_0x3a39('0x1b')]?_[_0x3a39('0x1c')](_0x3cc7ab[_0x3a39('0x1b')],function(_0x2b5437){return{'model':db[_0x2b5437[_0x3a39('0x1d')]],'as':_0x2b5437['as'],'attributes':_0x2b5437[_0x3a39('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3a39('0xc')](function(_0x1dbd15){logger[_0x3a39('0x12')](_0x3a39('0x14'),_0x32ebcd);logger[_0x3a39('0x1e')]('GetServicenowAccount',_0x32ebcd,JSON[_0x3a39('0x1f')](_0x1dbd15));_0x6a5c3f(_0x1dbd15);})['catch'](function(_0x1b1734){logger[_0x3a39('0x10')]('GetServicenowAccount',_0x1b1734[_0x3a39('0x11')],_0x32ebcd);_0x3d9d4e(_0x1fc030['error'](0x1f4,_0x1b1734[_0x3a39('0x11')]));});});};exports[_0x3a39('0x20')]=function(_0x19fabf){var _0x54086c=this;return new Promise(function(_0x20851f,_0x9606e8){return db[_0x3a39('0x15')]['find']({'raw':_0x19fabf[_0x3a39('0x17')]?_0x19fabf['options']['raw']===undefined?!![]:![]:!![],'where':_0x19fabf[_0x3a39('0x17')]?_0x19fabf['options']['where']||null:null,'attributes':_0x19fabf[_0x3a39('0x17')]?_0x19fabf['options'][_0x3a39('0x19')]||null:null,'include':_0x19fabf[_0x3a39('0x17')]?_0x19fabf[_0x3a39('0x17')][_0x3a39('0x1b')]?_[_0x3a39('0x1c')](_0x19fabf[_0x3a39('0x17')][_0x3a39('0x1b')],function(_0x2db95f){return{'model':db[_0x2db95f[_0x3a39('0x1d')]],'as':_0x2db95f['as'],'attributes':_0x2db95f[_0x3a39('0x19')],'include':_0x2db95f[_0x3a39('0x1b')]?_[_0x3a39('0x1c')](_0x2db95f[_0x3a39('0x1b')],function(_0x56639a){return{'model':db[_0x56639a['model']],'as':_0x56639a['as'],'attributes':_0x56639a[_0x3a39('0x19')],'include':_0x56639a[_0x3a39('0x1b')]?_[_0x3a39('0x1c')](_0x56639a[_0x3a39('0x1b')],function(_0x4a986d){return{'model':db[_0x4a986d[_0x3a39('0x1d')]],'as':_0x4a986d['as'],'attributes':_0x4a986d[_0x3a39('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c1638){logger[_0x3a39('0x12')](_0x3a39('0x20'),_0x19fabf);logger[_0x3a39('0x1e')](_0x3a39('0x20'),_0x19fabf,JSON[_0x3a39('0x1f')](_0x5c1638));_0x20851f(_0x5c1638);})[_0x3a39('0x13')](function(_0x154665){logger[_0x3a39('0x10')](_0x3a39('0x20'),_0x154665['message'],_0x19fabf);_0x9606e8(_0x54086c[_0x3a39('0x10')](0x1f4,_0x154665[_0x3a39('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index d1dfb7f..d69c491 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 _0x8994=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','getSubjects','getDescriptions','post','create','put','delete'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8994,0x179));var _0x4899=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x8994[_0x255d5b];return _0x3e141a;};'use strict';var multer=require(_0x4899('0x0'));var util=require('util');var path=require(_0x4899('0x1'));var timeout=require(_0x4899('0x2'));var express=require(_0x4899('0x3'));var router=express[_0x4899('0x4')]();var fs_extra=require(_0x4899('0x5'));var auth=require(_0x4899('0x6'));var interaction=require(_0x4899('0x7'));var config=require(_0x4899('0x8'));var controller=require(_0x4899('0x9'));router['get']('/',auth[_0x4899('0xa')](),controller[_0x4899('0xb')]);router[_0x4899('0xc')](_0x4899('0xd'),auth[_0x4899('0xa')](),controller[_0x4899('0xe')]);router[_0x4899('0xc')](_0x4899('0xf'),auth['isAuthenticated'](),controller[_0x4899('0x10')]);router[_0x4899('0xc')]('/:id/subjects',auth[_0x4899('0xa')](),controller[_0x4899('0x11')]);router[_0x4899('0xc')]('/:id/descriptions',auth[_0x4899('0xa')](),controller[_0x4899('0x12')]);router[_0x4899('0x13')]('/',auth[_0x4899('0xa')](),controller[_0x4899('0x14')]);router[_0x4899('0x15')]('/:id',auth[_0x4899('0xa')](),controller['update']);router[_0x4899('0x16')](_0x4899('0xd'),auth[_0x4899('0xa')](),controller[_0x4899('0x17')]);module[_0x4899('0x18')]=router; \ No newline at end of file +var _0x4341=['/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','index'];(function(_0x59803c,_0x1a17b8){var _0x321d9b=function(_0x4875dd){while(--_0x4875dd){_0x59803c['push'](_0x59803c['shift']());}};_0x321d9b(++_0x1a17b8);}(_0x4341,0x116));var _0x1434=function(_0x253804,_0x4101e2){_0x253804=_0x253804-0x0;var _0x26cb31=_0x4341[_0x253804];return _0x26cb31;};'use strict';var multer=require(_0x1434('0x0'));var util=require(_0x1434('0x1'));var path=require(_0x1434('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1434('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1434('0x4'));var interaction=require(_0x1434('0x5'));var config=require('../../config/environment');var controller=require(_0x1434('0x6'));router[_0x1434('0x7')]('/',auth[_0x1434('0x8')](),controller[_0x1434('0x9')]);router[_0x1434('0x7')](_0x1434('0xa'),auth[_0x1434('0x8')](),controller[_0x1434('0xb')]);router[_0x1434('0x7')](_0x1434('0xc'),auth[_0x1434('0x8')](),controller[_0x1434('0xd')]);router[_0x1434('0x7')](_0x1434('0xe'),auth[_0x1434('0x8')](),controller[_0x1434('0xf')]);router[_0x1434('0x7')](_0x1434('0x10'),auth['isAuthenticated'](),controller[_0x1434('0x11')]);router[_0x1434('0x12')]('/',auth['isAuthenticated'](),controller[_0x1434('0x13')]);router['put']('/:id',auth[_0x1434('0x8')](),controller[_0x1434('0x14')]);router[_0x1434('0x15')](_0x1434('0xa'),auth[_0x1434('0x8')](),controller[_0x1434('0x16')]);module[_0x1434('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 76bc9fb..0412851 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 _0x8128=['sequelize','exports','STRING'];(function(_0x599afe,_0x16f1a4){var _0x2b3893=function(_0x306e12){while(--_0x306e12){_0x599afe['push'](_0x599afe['shift']());}};_0x2b3893(++_0x16f1a4);}(_0x8128,0x132));var _0x8812=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x8128[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x8812('0x0'));module[_0x8812('0x1')]={'name':{'type':Sequelize[_0x8812('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x36d3=['sequelize'];(function(_0x1f0c44,_0x4c8055){var _0x1e2285=function(_0x25fc0f){while(--_0x25fc0f){_0x1f0c44['push'](_0x1f0c44['shift']());}};_0x1e2285(++_0x4c8055);}(_0x36d3,0x6a));var _0x336d=function(_0x3b0b1b,_0x1ea926){_0x3b0b1b=_0x3b0b1b-0x0;var _0xb15331=_0x36d3[_0x3b0b1b];return _0xb15331;};'use strict';var Sequelize=require(_0x336d('0x0'));module['exports']={'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 12aca5a..8566b81 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 _0xe3a9=['rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','status','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','order','sort','where','VIRTUAL','filter','options','include','findAll','rows','catch','length','includeAll','merge','find','create','update','body','params','getFields','findOne','ServicenowField','pick','getSubjects','getDescriptions','nolimit'];(function(_0x67b075,_0x43557d){var _0x39d030=function(_0x4f25e1){while(--_0x4f25e1){_0x67b075['push'](_0x67b075['shift']());}};_0x39d030(++_0x43557d);}(_0xe3a9,0xa2));var _0x9e3a=function(_0x15797a,_0x16274f){_0x15797a=_0x15797a-0x0;var _0x3e2618=_0xe3a9[_0x15797a];return _0x3e2618;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9e3a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9e3a('0x1'));var rp=require(_0x9e3a('0x2'));var moment=require(_0x9e3a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9e3a('0x4'));var util=require(_0x9e3a('0x5'));var path=require(_0x9e3a('0x6'));var sox=require('sox');var csv=require(_0x9e3a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9e3a('0x8'));var _=require('lodash');var squel=require(_0x9e3a('0x9'));var crypto=require(_0x9e3a('0xa'));var jsforce=require(_0x9e3a('0xb'));var deskjs=require(_0x9e3a('0xc'));var toCsv=require(_0x9e3a('0x7'));var querystring=require(_0x9e3a('0xd'));var Papa=require(_0x9e3a('0xe'));var Redis=require(_0x9e3a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9e3a('0x10'));var as=require(_0x9e3a('0x11'));var hardwareService=require(_0x9e3a('0x12'));var logger=require(_0x9e3a('0x13'))('api');var utils=require(_0x9e3a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9e3a('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34c384,_0x58976d){_0x58976d=_0x58976d||0xcc;return function(_0x527ad8){if(_0x527ad8){return _0x34c384[_0x9e3a('0x16')](_0x58976d);}return _0x34c384['status'](_0x58976d)['end']();};}function respondWithResult(_0x31ef32,_0x36df46){_0x36df46=_0x36df46||0xc8;return function(_0x13e67b){if(_0x13e67b){return _0x31ef32['status'](_0x36df46)[_0x9e3a('0x17')](_0x13e67b);}};}function respondWithFilteredResult(_0x1d0048,_0x488e7a){return function(_0x4c5512){if(_0x4c5512){var _0x4fbded=typeof _0x488e7a[_0x9e3a('0x18')]===_0x9e3a('0x19')&&typeof _0x488e7a['limit']===_0x9e3a('0x19');var _0x481da9=_0x4c5512['count'];var _0x4687b4=_0x4fbded?0x0:_0x488e7a[_0x9e3a('0x18')];var _0x9b0a23=_0x4fbded?_0x4c5512[_0x9e3a('0x1a')]:_0x488e7a[_0x9e3a('0x18')]+_0x488e7a[_0x9e3a('0x1b')];var _0xeaaaa5;if(_0x9b0a23>=_0x481da9){_0x9b0a23=_0x481da9;_0xeaaaa5=0xc8;}else{_0xeaaaa5=0xce;}_0x1d0048['status'](_0xeaaaa5);return _0x1d0048[_0x9e3a('0x1c')](_0x9e3a('0x1d'),_0x4687b4+'-'+_0x9b0a23+'/'+_0x481da9)[_0x9e3a('0x17')](_0x4c5512);}return null;};}function patchUpdates(_0x43afee){return function(_0x28b6eb){try{jsonpatch[_0x9e3a('0x1e')](_0x28b6eb,_0x43afee,!![]);}catch(_0x1a979a){return BPromise[_0x9e3a('0x1f')](_0x1a979a);}return _0x28b6eb[_0x9e3a('0x20')]();};}function saveUpdates(_0x41bc10,_0xad4d3b){return function(_0xf3b331){if(_0xf3b331){return _0xf3b331['update'](_0x41bc10)[_0x9e3a('0x21')](function(_0x45d627){return _0x45d627;});}return null;};}function removeEntity(_0x2e35d5,_0x4224e1){return function(_0x495234){if(_0x495234){return _0x495234[_0x9e3a('0x22')]()[_0x9e3a('0x21')](function(){_0x2e35d5['status'](0xcc)[_0x9e3a('0x23')]();});}};}function handleEntityNotFound(_0x15bb8c,_0x556f7f){return function(_0x5591ca){if(!_0x5591ca){_0x15bb8c[_0x9e3a('0x16')](0x194);}return _0x5591ca;};}function handleError(_0x67d676,_0x2e627c){_0x2e627c=_0x2e627c||0x1f4;return function(_0xfc2bb){logger[_0x9e3a('0x24')](_0xfc2bb[_0x9e3a('0x25')]);if(_0xfc2bb['name']){delete _0xfc2bb[_0x9e3a('0x26')];}_0x67d676[_0x9e3a('0x27')](_0x2e627c)[_0x9e3a('0x28')](_0xfc2bb);};}exports[_0x9e3a('0x29')]=function(_0x558ffa,_0x294963){var _0x3b9571={},_0x4ad5c0={},_0x5bdfe8={'count':0x0,'rows':[]};var _0x4055a1=_[_0x9e3a('0x2a')](db[_0x9e3a('0x2b')][_0x9e3a('0x2c')],function(_0x54f3c4){return{'name':_0x54f3c4[_0x9e3a('0x2d')],'type':_0x54f3c4[_0x9e3a('0x2e')][_0x9e3a('0x2f')]};});_0x4ad5c0[_0x9e3a('0x30')]=_['map'](_0x4055a1,_0x9e3a('0x26'));_0x4ad5c0['query']=_[_0x9e3a('0x31')](_0x558ffa['query']);_0x4ad5c0[_0x9e3a('0x32')]=_[_0x9e3a('0x33')](_0x4ad5c0[_0x9e3a('0x30')],_0x4ad5c0[_0x9e3a('0x34')]);_0x3b9571[_0x9e3a('0x35')]=_[_0x9e3a('0x33')](_0x4ad5c0[_0x9e3a('0x30')],qs[_0x9e3a('0x36')](_0x558ffa['query'][_0x9e3a('0x36')]));_0x3b9571[_0x9e3a('0x35')]=_0x3b9571[_0x9e3a('0x35')]['length']?_0x3b9571['attributes']:_0x4ad5c0[_0x9e3a('0x30')];if(!_0x558ffa[_0x9e3a('0x34')][_0x9e3a('0x37')]('nolimit')){_0x3b9571[_0x9e3a('0x1b')]=qs[_0x9e3a('0x1b')](_0x558ffa[_0x9e3a('0x34')][_0x9e3a('0x1b')]);_0x3b9571[_0x9e3a('0x18')]=qs[_0x9e3a('0x18')](_0x558ffa[_0x9e3a('0x34')]['offset']);}_0x3b9571[_0x9e3a('0x38')]=qs[_0x9e3a('0x39')](_0x558ffa[_0x9e3a('0x34')]['sort']);_0x3b9571[_0x9e3a('0x3a')]=qs['filters'](_['pick'](_0x558ffa['query'],_0x4ad5c0[_0x9e3a('0x32')]),_0x4055a1);if(_0x558ffa[_0x9e3a('0x34')]['filter']){_0x3b9571[_0x9e3a('0x3a')]=_['merge'](_0x3b9571[_0x9e3a('0x3a')],{'$or':_['map'](_0x4055a1,function(_0x3a1cc1){if(_0x3a1cc1[_0x9e3a('0x2e')]!==_0x9e3a('0x3b')){var _0xf63a2d={};_0xf63a2d[_0x3a1cc1[_0x9e3a('0x26')]]={'$like':'%'+_0x558ffa[_0x9e3a('0x34')][_0x9e3a('0x3c')]+'%'};return _0xf63a2d;}})});}_0x3b9571=_['merge']({},_0x3b9571,_0x558ffa[_0x9e3a('0x3d')]);var _0x16fe17={'where':_0x3b9571['where']};return db[_0x9e3a('0x2b')]['count'](_0x16fe17)[_0x9e3a('0x21')](function(_0x59753a){_0x5bdfe8['count']=_0x59753a;if(_0x558ffa['query']['includeAll']){_0x3b9571[_0x9e3a('0x3e')]=[{'all':!![]}];}return db[_0x9e3a('0x2b')][_0x9e3a('0x3f')](_0x3b9571);})[_0x9e3a('0x21')](function(_0x380729){_0x5bdfe8[_0x9e3a('0x40')]=_0x380729;return _0x5bdfe8;})['then'](respondWithFilteredResult(_0x294963,_0x3b9571))[_0x9e3a('0x41')](handleError(_0x294963,null));};exports['show']=function(_0x3393f1,_0xa8d892){var _0x4ae55c={'raw':![],'where':{'id':_0x3393f1['params']['id']}},_0x4199ff={};_0x4199ff[_0x9e3a('0x30')]=_['keys'](db[_0x9e3a('0x2b')]['rawAttributes']);_0x4199ff[_0x9e3a('0x34')]=_[_0x9e3a('0x31')](_0x3393f1[_0x9e3a('0x34')]);_0x4199ff[_0x9e3a('0x32')]=_[_0x9e3a('0x33')](_0x4199ff[_0x9e3a('0x30')],_0x4199ff[_0x9e3a('0x34')]);_0x4ae55c[_0x9e3a('0x35')]=_['intersection'](_0x4199ff[_0x9e3a('0x30')],qs['fields'](_0x3393f1['query']['fields']));_0x4ae55c[_0x9e3a('0x35')]=_0x4ae55c[_0x9e3a('0x35')][_0x9e3a('0x42')]?_0x4ae55c[_0x9e3a('0x35')]:_0x4199ff[_0x9e3a('0x30')];if(_0x3393f1['query'][_0x9e3a('0x43')]){_0x4ae55c[_0x9e3a('0x3e')]=[{'all':!![]}];}_0x4ae55c=_[_0x9e3a('0x44')]({},_0x4ae55c,_0x3393f1['options']);return db[_0x9e3a('0x2b')][_0x9e3a('0x45')](_0x4ae55c)[_0x9e3a('0x21')](handleEntityNotFound(_0xa8d892,null))['then'](respondWithResult(_0xa8d892,null))[_0x9e3a('0x41')](handleError(_0xa8d892,null));};exports[_0x9e3a('0x46')]=function(_0x43fe9f,_0x1a3f22){return db[_0x9e3a('0x2b')][_0x9e3a('0x46')](_0x43fe9f['body'],{})[_0x9e3a('0x21')](respondWithResult(_0x1a3f22,0xc9))[_0x9e3a('0x41')](handleError(_0x1a3f22,null));};exports[_0x9e3a('0x47')]=function(_0x18e5f7,_0xe6c519){if(_0x18e5f7[_0x9e3a('0x48')]['id']){delete _0x18e5f7['body']['id'];}return db[_0x9e3a('0x2b')]['find']({'where':{'id':_0x18e5f7[_0x9e3a('0x49')]['id']}})[_0x9e3a('0x21')](handleEntityNotFound(_0xe6c519,null))[_0x9e3a('0x21')](saveUpdates(_0x18e5f7[_0x9e3a('0x48')],null))['then'](respondWithResult(_0xe6c519,null))[_0x9e3a('0x41')](handleError(_0xe6c519,null));};exports[_0x9e3a('0x22')]=function(_0x10010a,_0x1295f2){return db[_0x9e3a('0x2b')][_0x9e3a('0x45')]({'where':{'id':_0x10010a['params']['id']}})[_0x9e3a('0x21')](handleEntityNotFound(_0x1295f2,null))[_0x9e3a('0x21')](removeEntity(_0x1295f2,null))['catch'](handleError(_0x1295f2,null));};exports[_0x9e3a('0x4a')]=function(_0x28dbda,_0x529971,_0x3ebca6){var _0x518922={};var _0x467ad9={};var _0xdcf8e6;var _0x2970a7;return db[_0x9e3a('0x2b')][_0x9e3a('0x4b')]({'where':{'id':_0x28dbda[_0x9e3a('0x49')]['id']}})[_0x9e3a('0x21')](handleEntityNotFound(_0x529971,null))['then'](function(_0x7366cc){if(_0x7366cc){_0xdcf8e6=_0x7366cc;_0x467ad9[_0x9e3a('0x30')]=_[_0x9e3a('0x31')](db[_0x9e3a('0x4c')][_0x9e3a('0x2c')]);_0x467ad9[_0x9e3a('0x34')]=_[_0x9e3a('0x31')](_0x28dbda[_0x9e3a('0x34')]);_0x467ad9['filters']=_[_0x9e3a('0x33')](_0x467ad9[_0x9e3a('0x30')],_0x467ad9[_0x9e3a('0x34')]);_0x518922['attributes']=_[_0x9e3a('0x33')](_0x467ad9['model'],qs[_0x9e3a('0x36')](_0x28dbda['query'][_0x9e3a('0x36')]));_0x518922[_0x9e3a('0x35')]=_0x518922['attributes'][_0x9e3a('0x42')]?_0x518922[_0x9e3a('0x35')]:_0x467ad9[_0x9e3a('0x30')];_0x518922[_0x9e3a('0x38')]=qs[_0x9e3a('0x39')](_0x28dbda[_0x9e3a('0x34')][_0x9e3a('0x39')]);_0x518922[_0x9e3a('0x3a')]=qs[_0x9e3a('0x32')](_[_0x9e3a('0x4d')](_0x28dbda['query'],_0x467ad9['filters']));if(_0x28dbda[_0x9e3a('0x34')][_0x9e3a('0x3c')]){_0x518922[_0x9e3a('0x3a')]=_[_0x9e3a('0x44')](_0x518922[_0x9e3a('0x3a')],{'$or':_[_0x9e3a('0x2a')](_0x518922['attributes'],function(_0x424232){var _0x2a5518={};_0x2a5518[_0x424232]={'$like':'%'+_0x28dbda[_0x9e3a('0x34')][_0x9e3a('0x3c')]+'%'};return _0x2a5518;})});}_0x518922=_['merge']({},_0x518922,_0x28dbda[_0x9e3a('0x3d')]);return _0xdcf8e6[_0x9e3a('0x4a')](_0x518922);}})[_0x9e3a('0x21')](function(_0x1c4cb3){if(_0x1c4cb3){_0x2970a7=_0x1c4cb3[_0x9e3a('0x42')];if(!_0x28dbda[_0x9e3a('0x34')][_0x9e3a('0x37')]('nolimit')){_0x518922[_0x9e3a('0x1b')]=qs[_0x9e3a('0x1b')](_0x28dbda['query']['limit']);_0x518922['offset']=qs[_0x9e3a('0x18')](_0x28dbda[_0x9e3a('0x34')]['offset']);}return _0xdcf8e6[_0x9e3a('0x4a')](_0x518922);}})[_0x9e3a('0x21')](function(_0x161199){if(_0x161199){return _0x161199?{'count':_0x2970a7,'rows':_0x161199}:null;}})[_0x9e3a('0x21')](respondWithResult(_0x529971,null))['catch'](handleError(_0x529971,null));};exports['getSubjects']=function(_0x5425a9,_0x3e36c6,_0x1584b7){var _0x20e4a5={};var _0x82c25c={};var _0x1e99bd;var _0x34631f;return db[_0x9e3a('0x2b')][_0x9e3a('0x4b')]({'where':{'id':_0x5425a9['params']['id']}})[_0x9e3a('0x21')](handleEntityNotFound(_0x3e36c6,null))[_0x9e3a('0x21')](function(_0x1150f5){if(_0x1150f5){_0x1e99bd=_0x1150f5;_0x82c25c[_0x9e3a('0x30')]=_[_0x9e3a('0x31')](db[_0x9e3a('0x4c')][_0x9e3a('0x2c')]);_0x82c25c[_0x9e3a('0x34')]=_[_0x9e3a('0x31')](_0x5425a9[_0x9e3a('0x34')]);_0x82c25c['filters']=_['intersection'](_0x82c25c[_0x9e3a('0x30')],_0x82c25c['query']);_0x20e4a5[_0x9e3a('0x35')]=_['intersection'](_0x82c25c[_0x9e3a('0x30')],qs['fields'](_0x5425a9[_0x9e3a('0x34')][_0x9e3a('0x36')]));_0x20e4a5[_0x9e3a('0x35')]=_0x20e4a5[_0x9e3a('0x35')]['length']?_0x20e4a5[_0x9e3a('0x35')]:_0x82c25c[_0x9e3a('0x30')];_0x20e4a5['order']=qs['sort'](_0x5425a9[_0x9e3a('0x34')][_0x9e3a('0x39')]);_0x20e4a5[_0x9e3a('0x3a')]=qs[_0x9e3a('0x32')](_[_0x9e3a('0x4d')](_0x5425a9[_0x9e3a('0x34')],_0x82c25c[_0x9e3a('0x32')]));if(_0x5425a9[_0x9e3a('0x34')][_0x9e3a('0x3c')]){_0x20e4a5[_0x9e3a('0x3a')]=_[_0x9e3a('0x44')](_0x20e4a5[_0x9e3a('0x3a')],{'$or':_['map'](_0x20e4a5[_0x9e3a('0x35')],function(_0x4e9ac8){var _0x100081={};_0x100081[_0x4e9ac8]={'$like':'%'+_0x5425a9['query'][_0x9e3a('0x3c')]+'%'};return _0x100081;})});}_0x20e4a5=_[_0x9e3a('0x44')]({},_0x20e4a5,_0x5425a9[_0x9e3a('0x3d')]);return _0x1e99bd[_0x9e3a('0x4e')](_0x20e4a5);}})['then'](function(_0x21e513){if(_0x21e513){_0x34631f=_0x21e513[_0x9e3a('0x42')];if(!_0x5425a9[_0x9e3a('0x34')][_0x9e3a('0x37')]('nolimit')){_0x20e4a5[_0x9e3a('0x1b')]=qs[_0x9e3a('0x1b')](_0x5425a9[_0x9e3a('0x34')][_0x9e3a('0x1b')]);_0x20e4a5['offset']=qs[_0x9e3a('0x18')](_0x5425a9[_0x9e3a('0x34')][_0x9e3a('0x18')]);}return _0x1e99bd['getSubjects'](_0x20e4a5);}})['then'](function(_0x5c4793){if(_0x5c4793){return _0x5c4793?{'count':_0x34631f,'rows':_0x5c4793}:null;}})['then'](respondWithResult(_0x3e36c6,null))[_0x9e3a('0x41')](handleError(_0x3e36c6,null));};exports[_0x9e3a('0x4f')]=function(_0x329a3c,_0x259b7f,_0x1f1436){var _0x215125={};var _0x4cf495={};var _0x52411f;var _0x50ee21;return db[_0x9e3a('0x2b')][_0x9e3a('0x4b')]({'where':{'id':_0x329a3c[_0x9e3a('0x49')]['id']}})[_0x9e3a('0x21')](handleEntityNotFound(_0x259b7f,null))['then'](function(_0x4805f5){if(_0x4805f5){_0x52411f=_0x4805f5;_0x4cf495['model']=_[_0x9e3a('0x31')](db[_0x9e3a('0x4c')][_0x9e3a('0x2c')]);_0x4cf495[_0x9e3a('0x34')]=_[_0x9e3a('0x31')](_0x329a3c[_0x9e3a('0x34')]);_0x4cf495['filters']=_[_0x9e3a('0x33')](_0x4cf495['model'],_0x4cf495['query']);_0x215125[_0x9e3a('0x35')]=_['intersection'](_0x4cf495['model'],qs[_0x9e3a('0x36')](_0x329a3c['query'][_0x9e3a('0x36')]));_0x215125[_0x9e3a('0x35')]=_0x215125[_0x9e3a('0x35')][_0x9e3a('0x42')]?_0x215125[_0x9e3a('0x35')]:_0x4cf495[_0x9e3a('0x30')];_0x215125[_0x9e3a('0x38')]=qs[_0x9e3a('0x39')](_0x329a3c[_0x9e3a('0x34')]['sort']);_0x215125[_0x9e3a('0x3a')]=qs[_0x9e3a('0x32')](_[_0x9e3a('0x4d')](_0x329a3c['query'],_0x4cf495['filters']));if(_0x329a3c[_0x9e3a('0x34')][_0x9e3a('0x3c')]){_0x215125[_0x9e3a('0x3a')]=_['merge'](_0x215125[_0x9e3a('0x3a')],{'$or':_[_0x9e3a('0x2a')](_0x215125[_0x9e3a('0x35')],function(_0x260780){var _0x343988={};_0x343988[_0x260780]={'$like':'%'+_0x329a3c['query'][_0x9e3a('0x3c')]+'%'};return _0x343988;})});}_0x215125=_['merge']({},_0x215125,_0x329a3c[_0x9e3a('0x3d')]);return _0x52411f[_0x9e3a('0x4f')](_0x215125);}})[_0x9e3a('0x21')](function(_0x21b6ba){if(_0x21b6ba){_0x50ee21=_0x21b6ba[_0x9e3a('0x42')];if(!_0x329a3c[_0x9e3a('0x34')][_0x9e3a('0x37')](_0x9e3a('0x50'))){_0x215125[_0x9e3a('0x1b')]=qs['limit'](_0x329a3c[_0x9e3a('0x34')][_0x9e3a('0x1b')]);_0x215125[_0x9e3a('0x18')]=qs[_0x9e3a('0x18')](_0x329a3c['query'][_0x9e3a('0x18')]);}return _0x52411f[_0x9e3a('0x4f')](_0x215125);}})[_0x9e3a('0x21')](function(_0x5dac87){if(_0x5dac87){return _0x5dac87?{'count':_0x50ee21,'rows':_0x5dac87}:null;}})[_0x9e3a('0x21')](respondWithResult(_0x259b7f,null))[_0x9e3a('0x41')](handleError(_0x259b7f,null));}; \ No newline at end of file +var _0x4ba8=['send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','then','includeAll','findAll','catch','show','params','find','create','body','getFields','ServicenowField','pick','hasOwnProperty','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name'];(function(_0x1a9eb8,_0x32c795){var _0xe8be84=function(_0x2350b6){while(--_0x2350b6){_0x1a9eb8['push'](_0x1a9eb8['shift']());}};_0xe8be84(++_0x32c795);}(_0x4ba8,0x78));var _0x84ba=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4ba8[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x84ba('0x0'));var rimraf=require(_0x84ba('0x1'));var zipdir=require(_0x84ba('0x2'));var jsonpatch=require(_0x84ba('0x3'));var rp=require(_0x84ba('0x4'));var moment=require(_0x84ba('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x84ba('0x6'));var sox=require(_0x84ba('0x7'));var csv=require(_0x84ba('0x8'));var ejs=require(_0x84ba('0x9'));var fs=require('fs');var fs_extra=require(_0x84ba('0xa'));var _=require('lodash');var squel=require(_0x84ba('0xb'));var crypto=require(_0x84ba('0xc'));var jsforce=require(_0x84ba('0xd'));var deskjs=require(_0x84ba('0xe'));var toCsv=require(_0x84ba('0x8'));var querystring=require(_0x84ba('0xf'));var Papa=require(_0x84ba('0x10'));var Redis=require(_0x84ba('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x84ba('0x12'));var hardwareService=require(_0x84ba('0x13'));var logger=require(_0x84ba('0x14'))(_0x84ba('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x84ba('0x16'));var db=require(_0x84ba('0x17'))['db'];function respondWithStatusCode(_0x22e090,_0x594f9b){_0x594f9b=_0x594f9b||0xcc;return function(_0xedd306){if(_0xedd306){return _0x22e090[_0x84ba('0x18')](_0x594f9b);}return _0x22e090['status'](_0x594f9b)[_0x84ba('0x19')]();};}function respondWithResult(_0x49da66,_0x397074){_0x397074=_0x397074||0xc8;return function(_0x2644f5){if(_0x2644f5){return _0x49da66[_0x84ba('0x1a')](_0x397074)[_0x84ba('0x1b')](_0x2644f5);}};}function respondWithFilteredResult(_0x1bc9f2,_0x2b8fa9){return function(_0x152319){if(_0x152319){var _0x251f1a=typeof _0x2b8fa9[_0x84ba('0x1c')]===_0x84ba('0x1d')&&typeof _0x2b8fa9[_0x84ba('0x1e')]==='undefined';var _0x38a439=_0x152319[_0x84ba('0x1f')];var _0x20c32d=_0x251f1a?0x0:_0x2b8fa9[_0x84ba('0x1c')];var _0x1b085b=_0x251f1a?_0x152319['count']:_0x2b8fa9['offset']+_0x2b8fa9[_0x84ba('0x1e')];var _0x4dcecd;if(_0x1b085b>=_0x38a439){_0x1b085b=_0x38a439;_0x4dcecd=0xc8;}else{_0x4dcecd=0xce;}_0x1bc9f2['status'](_0x4dcecd);return _0x1bc9f2[_0x84ba('0x20')](_0x84ba('0x21'),_0x20c32d+'-'+_0x1b085b+'/'+_0x38a439)[_0x84ba('0x1b')](_0x152319);}return null;};}function patchUpdates(_0x60c78d){return function(_0x876ba2){try{jsonpatch[_0x84ba('0x22')](_0x876ba2,_0x60c78d,!![]);}catch(_0xb3e098){return BPromise[_0x84ba('0x23')](_0xb3e098);}return _0x876ba2[_0x84ba('0x24')]();};}function saveUpdates(_0x54f9b7,_0x1e489a){return function(_0x169fd8){if(_0x169fd8){return _0x169fd8[_0x84ba('0x25')](_0x54f9b7)['then'](function(_0x47cbda){return _0x47cbda;});}return null;};}function removeEntity(_0x4b12f0,_0x12ffcc){return function(_0x4fd6a2){if(_0x4fd6a2){return _0x4fd6a2[_0x84ba('0x26')]()['then'](function(){_0x4b12f0[_0x84ba('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58620e,_0x4d7b91){return function(_0x537dc4){if(!_0x537dc4){_0x58620e['sendStatus'](0x194);}return _0x537dc4;};}function handleError(_0x3441bc,_0x1c701a){_0x1c701a=_0x1c701a||0x1f4;return function(_0x5bb333){logger[_0x84ba('0x27')](_0x5bb333[_0x84ba('0x28')]);if(_0x5bb333[_0x84ba('0x29')]){delete _0x5bb333[_0x84ba('0x29')];}_0x3441bc[_0x84ba('0x1a')](_0x1c701a)[_0x84ba('0x2a')](_0x5bb333);};}exports[_0x84ba('0x2b')]=function(_0x25cf2c,_0x474d1c){var _0x56c47a={},_0x1c340d={},_0x2cf29d={'count':0x0,'rows':[]};var _0x3f4a16=_[_0x84ba('0x2c')](db[_0x84ba('0x2d')][_0x84ba('0x2e')],function(_0x5b2849){return{'name':_0x5b2849[_0x84ba('0x2f')],'type':_0x5b2849[_0x84ba('0x30')]['key']};});_0x1c340d[_0x84ba('0x31')]=_[_0x84ba('0x2c')](_0x3f4a16,_0x84ba('0x29'));_0x1c340d[_0x84ba('0x32')]=_[_0x84ba('0x33')](_0x25cf2c[_0x84ba('0x32')]);_0x1c340d['filters']=_[_0x84ba('0x34')](_0x1c340d[_0x84ba('0x31')],_0x1c340d[_0x84ba('0x32')]);_0x56c47a[_0x84ba('0x35')]=_['intersection'](_0x1c340d['model'],qs[_0x84ba('0x36')](_0x25cf2c['query']['fields']));_0x56c47a['attributes']=_0x56c47a['attributes'][_0x84ba('0x37')]?_0x56c47a[_0x84ba('0x35')]:_0x1c340d['model'];if(!_0x25cf2c[_0x84ba('0x32')]['hasOwnProperty'](_0x84ba('0x38'))){_0x56c47a[_0x84ba('0x1e')]=qs[_0x84ba('0x1e')](_0x25cf2c['query'][_0x84ba('0x1e')]);_0x56c47a[_0x84ba('0x1c')]=qs['offset'](_0x25cf2c[_0x84ba('0x32')][_0x84ba('0x1c')]);}_0x56c47a[_0x84ba('0x39')]=qs[_0x84ba('0x3a')](_0x25cf2c['query'][_0x84ba('0x3a')]);_0x56c47a[_0x84ba('0x3b')]=qs[_0x84ba('0x3c')](_['pick'](_0x25cf2c[_0x84ba('0x32')],_0x1c340d['filters']),_0x3f4a16);if(_0x25cf2c[_0x84ba('0x32')][_0x84ba('0x3d')]){_0x56c47a['where']=_[_0x84ba('0x3e')](_0x56c47a[_0x84ba('0x3b')],{'$or':_[_0x84ba('0x2c')](_0x3f4a16,function(_0xe7e93b){if(_0xe7e93b[_0x84ba('0x30')]!==_0x84ba('0x3f')){var _0xf37473={};_0xf37473[_0xe7e93b[_0x84ba('0x29')]]={'$like':'%'+_0x25cf2c[_0x84ba('0x32')][_0x84ba('0x3d')]+'%'};return _0xf37473;}})});}_0x56c47a=_[_0x84ba('0x3e')]({},_0x56c47a,_0x25cf2c[_0x84ba('0x40')]);var _0x4028ff={'where':_0x56c47a['where']};return db[_0x84ba('0x2d')][_0x84ba('0x1f')](_0x4028ff)[_0x84ba('0x41')](function(_0x202270){_0x2cf29d[_0x84ba('0x1f')]=_0x202270;if(_0x25cf2c[_0x84ba('0x32')][_0x84ba('0x42')]){_0x56c47a['include']=[{'all':!![]}];}return db[_0x84ba('0x2d')][_0x84ba('0x43')](_0x56c47a);})[_0x84ba('0x41')](function(_0x561af5){_0x2cf29d['rows']=_0x561af5;return _0x2cf29d;})[_0x84ba('0x41')](respondWithFilteredResult(_0x474d1c,_0x56c47a))[_0x84ba('0x44')](handleError(_0x474d1c,null));};exports[_0x84ba('0x45')]=function(_0x36dab4,_0x4b7b60){var _0x42a112={'raw':![],'where':{'id':_0x36dab4[_0x84ba('0x46')]['id']}},_0x449a93={};_0x449a93[_0x84ba('0x31')]=_[_0x84ba('0x33')](db[_0x84ba('0x2d')]['rawAttributes']);_0x449a93['query']=_[_0x84ba('0x33')](_0x36dab4[_0x84ba('0x32')]);_0x449a93['filters']=_[_0x84ba('0x34')](_0x449a93[_0x84ba('0x31')],_0x449a93['query']);_0x42a112[_0x84ba('0x35')]=_[_0x84ba('0x34')](_0x449a93[_0x84ba('0x31')],qs['fields'](_0x36dab4['query'][_0x84ba('0x36')]));_0x42a112[_0x84ba('0x35')]=_0x42a112['attributes'][_0x84ba('0x37')]?_0x42a112['attributes']:_0x449a93[_0x84ba('0x31')];if(_0x36dab4[_0x84ba('0x32')][_0x84ba('0x42')]){_0x42a112['include']=[{'all':!![]}];}_0x42a112=_[_0x84ba('0x3e')]({},_0x42a112,_0x36dab4[_0x84ba('0x40')]);return db[_0x84ba('0x2d')][_0x84ba('0x47')](_0x42a112)['then'](handleEntityNotFound(_0x4b7b60,null))[_0x84ba('0x41')](respondWithResult(_0x4b7b60,null))['catch'](handleError(_0x4b7b60,null));};exports['create']=function(_0x3311f0,_0x44d92f){return db['ServicenowConfiguration'][_0x84ba('0x48')](_0x3311f0[_0x84ba('0x49')],{})[_0x84ba('0x41')](respondWithResult(_0x44d92f,0xc9))[_0x84ba('0x44')](handleError(_0x44d92f,null));};exports[_0x84ba('0x25')]=function(_0x31e353,_0x57fd08){if(_0x31e353['body']['id']){delete _0x31e353[_0x84ba('0x49')]['id'];}return db['ServicenowConfiguration']['find']({'where':{'id':_0x31e353['params']['id']}})['then'](handleEntityNotFound(_0x57fd08,null))[_0x84ba('0x41')](saveUpdates(_0x31e353[_0x84ba('0x49')],null))['then'](respondWithResult(_0x57fd08,null))[_0x84ba('0x44')](handleError(_0x57fd08,null));};exports[_0x84ba('0x26')]=function(_0x2d1503,_0xdc5466){return db[_0x84ba('0x2d')][_0x84ba('0x47')]({'where':{'id':_0x2d1503[_0x84ba('0x46')]['id']}})[_0x84ba('0x41')](handleEntityNotFound(_0xdc5466,null))['then'](removeEntity(_0xdc5466,null))[_0x84ba('0x44')](handleError(_0xdc5466,null));};exports[_0x84ba('0x4a')]=function(_0x193403,_0x2335f3,_0x2f4d6d){var _0x4edf5a={};var _0x223708={};var _0x39e309;var _0x249c9b;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x193403[_0x84ba('0x46')]['id']}})['then'](handleEntityNotFound(_0x2335f3,null))['then'](function(_0x21dbe0){if(_0x21dbe0){_0x39e309=_0x21dbe0;_0x223708[_0x84ba('0x31')]=_[_0x84ba('0x33')](db[_0x84ba('0x4b')][_0x84ba('0x2e')]);_0x223708[_0x84ba('0x32')]=_[_0x84ba('0x33')](_0x193403[_0x84ba('0x32')]);_0x223708[_0x84ba('0x3c')]=_['intersection'](_0x223708[_0x84ba('0x31')],_0x223708[_0x84ba('0x32')]);_0x4edf5a[_0x84ba('0x35')]=_[_0x84ba('0x34')](_0x223708['model'],qs['fields'](_0x193403['query']['fields']));_0x4edf5a[_0x84ba('0x35')]=_0x4edf5a['attributes'][_0x84ba('0x37')]?_0x4edf5a['attributes']:_0x223708[_0x84ba('0x31')];_0x4edf5a[_0x84ba('0x39')]=qs[_0x84ba('0x3a')](_0x193403['query'][_0x84ba('0x3a')]);_0x4edf5a[_0x84ba('0x3b')]=qs['filters'](_[_0x84ba('0x4c')](_0x193403[_0x84ba('0x32')],_0x223708[_0x84ba('0x3c')]));if(_0x193403[_0x84ba('0x32')][_0x84ba('0x3d')]){_0x4edf5a[_0x84ba('0x3b')]=_[_0x84ba('0x3e')](_0x4edf5a['where'],{'$or':_[_0x84ba('0x2c')](_0x4edf5a[_0x84ba('0x35')],function(_0x2d887a){var _0x56cac0={};_0x56cac0[_0x2d887a]={'$like':'%'+_0x193403[_0x84ba('0x32')][_0x84ba('0x3d')]+'%'};return _0x56cac0;})});}_0x4edf5a=_[_0x84ba('0x3e')]({},_0x4edf5a,_0x193403[_0x84ba('0x40')]);return _0x39e309[_0x84ba('0x4a')](_0x4edf5a);}})[_0x84ba('0x41')](function(_0xb4e932){if(_0xb4e932){_0x249c9b=_0xb4e932[_0x84ba('0x37')];if(!_0x193403['query'][_0x84ba('0x4d')](_0x84ba('0x38'))){_0x4edf5a['limit']=qs[_0x84ba('0x1e')](_0x193403[_0x84ba('0x32')][_0x84ba('0x1e')]);_0x4edf5a[_0x84ba('0x1c')]=qs[_0x84ba('0x1c')](_0x193403[_0x84ba('0x32')][_0x84ba('0x1c')]);}return _0x39e309[_0x84ba('0x4a')](_0x4edf5a);}})[_0x84ba('0x41')](function(_0x2d2b0b){if(_0x2d2b0b){return _0x2d2b0b?{'count':_0x249c9b,'rows':_0x2d2b0b}:null;}})[_0x84ba('0x41')](respondWithResult(_0x2335f3,null))[_0x84ba('0x44')](handleError(_0x2335f3,null));};exports[_0x84ba('0x4e')]=function(_0x526d1d,_0x2b91c0,_0x2db307){var _0x2d0687={};var _0xd6d740={};var _0x55a015;var _0x4c5bb7;return db[_0x84ba('0x2d')][_0x84ba('0x4f')]({'where':{'id':_0x526d1d[_0x84ba('0x46')]['id']}})[_0x84ba('0x41')](handleEntityNotFound(_0x2b91c0,null))[_0x84ba('0x41')](function(_0x2e9bc2){if(_0x2e9bc2){_0x55a015=_0x2e9bc2;_0xd6d740['model']=_[_0x84ba('0x33')](db['ServicenowField'][_0x84ba('0x2e')]);_0xd6d740[_0x84ba('0x32')]=_[_0x84ba('0x33')](_0x526d1d[_0x84ba('0x32')]);_0xd6d740[_0x84ba('0x3c')]=_[_0x84ba('0x34')](_0xd6d740[_0x84ba('0x31')],_0xd6d740[_0x84ba('0x32')]);_0x2d0687[_0x84ba('0x35')]=_[_0x84ba('0x34')](_0xd6d740['model'],qs[_0x84ba('0x36')](_0x526d1d['query'][_0x84ba('0x36')]));_0x2d0687[_0x84ba('0x35')]=_0x2d0687[_0x84ba('0x35')][_0x84ba('0x37')]?_0x2d0687[_0x84ba('0x35')]:_0xd6d740[_0x84ba('0x31')];_0x2d0687['order']=qs['sort'](_0x526d1d[_0x84ba('0x32')][_0x84ba('0x3a')]);_0x2d0687[_0x84ba('0x3b')]=qs[_0x84ba('0x3c')](_['pick'](_0x526d1d['query'],_0xd6d740[_0x84ba('0x3c')]));if(_0x526d1d['query'][_0x84ba('0x3d')]){_0x2d0687[_0x84ba('0x3b')]=_['merge'](_0x2d0687[_0x84ba('0x3b')],{'$or':_[_0x84ba('0x2c')](_0x2d0687[_0x84ba('0x35')],function(_0x178403){var _0x468dec={};_0x468dec[_0x178403]={'$like':'%'+_0x526d1d[_0x84ba('0x32')][_0x84ba('0x3d')]+'%'};return _0x468dec;})});}_0x2d0687=_['merge']({},_0x2d0687,_0x526d1d['options']);return _0x55a015[_0x84ba('0x4e')](_0x2d0687);}})[_0x84ba('0x41')](function(_0x3d403d){if(_0x3d403d){_0x4c5bb7=_0x3d403d[_0x84ba('0x37')];if(!_0x526d1d['query']['hasOwnProperty']('nolimit')){_0x2d0687['limit']=qs[_0x84ba('0x1e')](_0x526d1d['query'][_0x84ba('0x1e')]);_0x2d0687[_0x84ba('0x1c')]=qs[_0x84ba('0x1c')](_0x526d1d[_0x84ba('0x32')][_0x84ba('0x1c')]);}return _0x55a015[_0x84ba('0x4e')](_0x2d0687);}})[_0x84ba('0x41')](function(_0xa1b795){if(_0xa1b795){return _0xa1b795?{'count':_0x4c5bb7,'rows':_0xa1b795}:null;}})[_0x84ba('0x41')](respondWithResult(_0x2b91c0,null))['catch'](handleError(_0x2b91c0,null));};exports['getDescriptions']=function(_0xc2d068,_0x592502,_0x37b0ff){var _0x4c3a74={};var _0x1e8016={};var _0x392c3a;var _0x12c933;return db[_0x84ba('0x2d')][_0x84ba('0x4f')]({'where':{'id':_0xc2d068[_0x84ba('0x46')]['id']}})[_0x84ba('0x41')](handleEntityNotFound(_0x592502,null))[_0x84ba('0x41')](function(_0x3e2d45){if(_0x3e2d45){_0x392c3a=_0x3e2d45;_0x1e8016[_0x84ba('0x31')]=_[_0x84ba('0x33')](db[_0x84ba('0x4b')]['rawAttributes']);_0x1e8016[_0x84ba('0x32')]=_[_0x84ba('0x33')](_0xc2d068['query']);_0x1e8016[_0x84ba('0x3c')]=_['intersection'](_0x1e8016[_0x84ba('0x31')],_0x1e8016[_0x84ba('0x32')]);_0x4c3a74[_0x84ba('0x35')]=_[_0x84ba('0x34')](_0x1e8016[_0x84ba('0x31')],qs['fields'](_0xc2d068[_0x84ba('0x32')][_0x84ba('0x36')]));_0x4c3a74[_0x84ba('0x35')]=_0x4c3a74[_0x84ba('0x35')][_0x84ba('0x37')]?_0x4c3a74[_0x84ba('0x35')]:_0x1e8016[_0x84ba('0x31')];_0x4c3a74[_0x84ba('0x39')]=qs[_0x84ba('0x3a')](_0xc2d068[_0x84ba('0x32')][_0x84ba('0x3a')]);_0x4c3a74[_0x84ba('0x3b')]=qs[_0x84ba('0x3c')](_[_0x84ba('0x4c')](_0xc2d068['query'],_0x1e8016[_0x84ba('0x3c')]));if(_0xc2d068[_0x84ba('0x32')][_0x84ba('0x3d')]){_0x4c3a74['where']=_[_0x84ba('0x3e')](_0x4c3a74['where'],{'$or':_[_0x84ba('0x2c')](_0x4c3a74['attributes'],function(_0x159221){var _0x26323c={};_0x26323c[_0x159221]={'$like':'%'+_0xc2d068[_0x84ba('0x32')][_0x84ba('0x3d')]+'%'};return _0x26323c;})});}_0x4c3a74=_[_0x84ba('0x3e')]({},_0x4c3a74,_0xc2d068['options']);return _0x392c3a[_0x84ba('0x50')](_0x4c3a74);}})['then'](function(_0x22dc59){if(_0x22dc59){_0x12c933=_0x22dc59[_0x84ba('0x37')];if(!_0xc2d068['query'][_0x84ba('0x4d')](_0x84ba('0x38'))){_0x4c3a74[_0x84ba('0x1e')]=qs[_0x84ba('0x1e')](_0xc2d068[_0x84ba('0x32')][_0x84ba('0x1e')]);_0x4c3a74[_0x84ba('0x1c')]=qs[_0x84ba('0x1c')](_0xc2d068[_0x84ba('0x32')][_0x84ba('0x1c')]);}return _0x392c3a['getDescriptions'](_0x4c3a74);}})[_0x84ba('0x41')](function(_0xc0c0d0){if(_0xc0c0d0){return _0xc0c0d0?{'count':_0x12c933,'rows':_0xc0c0d0}:null;}})[_0x84ba('0x41')](respondWithResult(_0x592502,null))[_0x84ba('0x44')](handleError(_0x592502,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 6337da7..2795889 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 _0x0ffc=['./intServicenowConfiguration.attributes','exports','define','int_servicenow_configurations','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x1a6bde,_0x3e8809){var _0x490911=function(_0x1da913){while(--_0x1da913){_0x1a6bde['push'](_0x1a6bde['shift']());}};_0x490911(++_0x3e8809);}(_0x0ffc,0x9e));var _0xc0ff=function(_0x230513,_0x3c7ea1){_0x230513=_0x230513-0x0;var _0x316f48=_0x0ffc[_0x230513];return _0x316f48;};'use strict';var _=require('lodash');var util=require(_0xc0ff('0x0'));var logger=require(_0xc0ff('0x1'))('api');var moment=require(_0xc0ff('0x2'));var BPromise=require('bluebird');var rp=require(_0xc0ff('0x3'));var fs=require('fs');var path=require(_0xc0ff('0x4'));var rimraf=require(_0xc0ff('0x5'));var config=require(_0xc0ff('0x6'));var attributes=require(_0xc0ff('0x7'));module[_0xc0ff('0x8')]=function(_0x2fe7a2,_0x1b69a1){return _0x2fe7a2[_0xc0ff('0x9')]('ServicenowConfiguration',attributes,{'tableName':_0xc0ff('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x47d6=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','lodash','util','../../config/logger'];(function(_0x1c3735,_0x2605cd){var _0x102e6a=function(_0x506ba1){while(--_0x506ba1){_0x1c3735['push'](_0x1c3735['shift']());}};_0x102e6a(++_0x2605cd);}(_0x47d6,0x13f));var _0x647d=function(_0x37c938,_0x297836){_0x37c938=_0x37c938-0x0;var _0x1fdbd6=_0x47d6[_0x37c938];return _0x1fdbd6;};'use strict';var _=require(_0x647d('0x0'));var util=require(_0x647d('0x1'));var logger=require(_0x647d('0x2'))(_0x647d('0x3'));var moment=require(_0x647d('0x4'));var BPromise=require(_0x647d('0x5'));var rp=require(_0x647d('0x6'));var fs=require('fs');var path=require(_0x647d('0x7'));var rimraf=require(_0x647d('0x8'));var config=require(_0x647d('0x9'));var attributes=require(_0x647d('0xa'));module[_0x647d('0xb')]=function(_0x8a0753,_0x8ffe2b){return _0x8a0753[_0x647d('0xc')](_0x647d('0xd'),attributes,{'tableName':'int_servicenow_configurations','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 b82a5df..4a1915c 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 _0x3893=['request','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x19c99e,_0xef87c){var _0x4bbfd7=function(_0x3b1f81){while(--_0x3b1f81){_0x19c99e['push'](_0x19c99e['shift']());}};_0x4bbfd7(++_0xef87c);}(_0x3893,0x1f0));var _0x3389=function(_0x27062d,_0x24b179){_0x27062d=_0x27062d-0x0;var _0x4f1478=_0x3893[_0x27062d];return _0x4f1478;};'use strict';var _=require(_0x3389('0x0'));var util=require(_0x3389('0x1'));var moment=require(_0x3389('0x2'));var BPromise=require(_0x3389('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3389('0x4'))['db'];var utils=require(_0x3389('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3389('0x6'));var jayson=require(_0x3389('0x7'));var client=jayson[_0x3389('0x8')][_0x3389('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c1afb,_0x4c0b55,_0x44a66b){return new BPromise(function(_0x193417,_0x4a330f){return client[_0x3389('0xa')](_0x4c1afb,_0x44a66b)[_0x3389('0xb')](function(_0x2b8a91){logger['info'](_0x3389('0xc'),_0x4c0b55,_0x3389('0xd'));logger[_0x3389('0xe')](_0x3389('0xf'),_0x4c0b55,_0x3389('0xd'),JSON[_0x3389('0x10')](_0x2b8a91));if(_0x2b8a91[_0x3389('0x11')]){if(_0x2b8a91['error'][_0x3389('0x12')]===0x1f4){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x4c0b55,_0x2b8a91[_0x3389('0x11')]['message']);return _0x4a330f(_0x2b8a91['error']['message']);}logger[_0x3389('0x11')](_0x3389('0xc'),_0x4c0b55,_0x2b8a91['error'][_0x3389('0x13')]);return _0x193417(_0x2b8a91[_0x3389('0x11')]['message']);}else{logger[_0x3389('0x14')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4c0b55,_0x3389('0xd'));_0x193417(_0x2b8a91[_0x3389('0x15')][_0x3389('0x13')]);}})[_0x3389('0x16')](function(_0x456707){logger[_0x3389('0x11')](_0x3389('0xc'),_0x4c0b55,_0x456707);_0x4a330f(_0x456707);});});} \ No newline at end of file +var _0xe4a6=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x422672,_0x4af79c){var _0x1ae61d=function(_0x40a2ce){while(--_0x40a2ce){_0x422672['push'](_0x422672['shift']());}};_0x1ae61d(++_0x4af79c);}(_0xe4a6,0x17c));var _0x6e4a=function(_0x1ba88a,_0x30b1d8){_0x1ba88a=_0x1ba88a-0x0;var _0x5d0fe7=_0xe4a6[_0x1ba88a];return _0x5d0fe7;};'use strict';var _=require(_0x6e4a('0x0'));var util=require(_0x6e4a('0x1'));var moment=require('moment');var BPromise=require(_0x6e4a('0x2'));var rs=require(_0x6e4a('0x3'));var fs=require('fs');var Redis=require(_0x6e4a('0x4'));var db=require(_0x6e4a('0x5'))['db'];var utils=require(_0x6e4a('0x6'));var logger=require(_0x6e4a('0x7'))(_0x6e4a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6e4a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39610a,_0x2b9c78,_0x7096f5){return new BPromise(function(_0xdb4e6,_0x10c454){return client['request'](_0x39610a,_0x7096f5)['then'](function(_0x2f7dff){logger[_0x6e4a('0xa')](_0x6e4a('0xb'),_0x2b9c78,_0x6e4a('0xc'));logger['debug'](_0x6e4a('0xd'),_0x2b9c78,_0x6e4a('0xc'),JSON['stringify'](_0x2f7dff));if(_0x2f7dff[_0x6e4a('0xe')]){if(_0x2f7dff[_0x6e4a('0xe')][_0x6e4a('0xf')]===0x1f4){logger[_0x6e4a('0xe')](_0x6e4a('0xb'),_0x2b9c78,_0x2f7dff[_0x6e4a('0xe')][_0x6e4a('0x10')]);return _0x10c454(_0x2f7dff[_0x6e4a('0xe')]['message']);}logger[_0x6e4a('0xe')](_0x6e4a('0xb'),_0x2b9c78,_0x2f7dff['error'][_0x6e4a('0x10')]);return _0xdb4e6(_0x2f7dff[_0x6e4a('0xe')]['message']);}else{logger[_0x6e4a('0xa')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2b9c78,_0x6e4a('0xc'));_0xdb4e6(_0x2f7dff[_0x6e4a('0x11')]['message']);}})[_0x6e4a('0x12')](function(_0x4dc72b){logger[_0x6e4a('0xe')](_0x6e4a('0xb'),_0x2b9c78,_0x4dc72b);_0x10c454(_0x4dc72b);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 31af446..933be4c 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 _0x8a64=['isAuthenticated','/:id','show','put','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','get'];(function(_0x26887c,_0x5c88ab){var _0x3a778d=function(_0x3ad25c){while(--_0x3ad25c){_0x26887c['push'](_0x26887c['shift']());}};_0x3a778d(++_0x5c88ab);}(_0x8a64,0x67));var _0x48a6=function(_0x491268,_0xaabdf3){_0x491268=_0x491268-0x0;var _0x4342dc=_0x8a64[_0x491268];return _0x4342dc;};'use strict';var multer=require('multer');var util=require(_0x48a6('0x0'));var path=require('path');var timeout=require(_0x48a6('0x1'));var express=require(_0x48a6('0x2'));var router=express[_0x48a6('0x3')]();var fs_extra=require(_0x48a6('0x4'));var auth=require(_0x48a6('0x5'));var interaction=require(_0x48a6('0x6'));var config=require('../../config/environment');var controller=require(_0x48a6('0x7'));router[_0x48a6('0x8')]('/',auth[_0x48a6('0x9')](),controller['index']);router[_0x48a6('0x8')](_0x48a6('0xa'),auth[_0x48a6('0x9')](),controller[_0x48a6('0xb')]);router['post']('/',auth[_0x48a6('0x9')](),controller['create']);router[_0x48a6('0xc')](_0x48a6('0xa'),auth[_0x48a6('0x9')](),controller['update']);router[_0x48a6('0xd')](_0x48a6('0xa'),auth[_0x48a6('0x9')](),controller[_0x48a6('0xe')]);module[_0x48a6('0xf')]=router; \ No newline at end of file +var _0x5ef4=['show','post','create','put','update','delete','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id'];(function(_0x3d16a7,_0x523b59){var _0x4fefcc=function(_0x2058b4){while(--_0x2058b4){_0x3d16a7['push'](_0x3d16a7['shift']());}};_0x4fefcc(++_0x523b59);}(_0x5ef4,0x1bc));var _0x45ef=function(_0x55d22f,_0x515956){_0x55d22f=_0x55d22f-0x0;var _0x57999e=_0x5ef4[_0x55d22f];return _0x57999e;};'use strict';var multer=require(_0x45ef('0x0'));var util=require(_0x45ef('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x45ef('0x2'));var router=express[_0x45ef('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x45ef('0x4'));var interaction=require(_0x45ef('0x5'));var config=require(_0x45ef('0x6'));var controller=require(_0x45ef('0x7'));router[_0x45ef('0x8')]('/',auth[_0x45ef('0x9')](),controller[_0x45ef('0xa')]);router['get'](_0x45ef('0xb'),auth[_0x45ef('0x9')](),controller[_0x45ef('0xc')]);router[_0x45ef('0xd')]('/',auth[_0x45ef('0x9')](),controller[_0x45ef('0xe')]);router[_0x45ef('0xf')](_0x45ef('0xb'),auth[_0x45ef('0x9')](),controller[_0x45ef('0x10')]);router[_0x45ef('0x11')](_0x45ef('0xb'),auth[_0x45ef('0x9')](),controller['destroy']);module[_0x45ef('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 6e12ce5..d5bb135 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 _0xd499=['string','variable','customVariable','STRING','sequelize','exports','ENUM'];(function(_0x1c67fc,_0x3c6c3e){var _0x54414c=function(_0x4ef80d){while(--_0x4ef80d){_0x1c67fc['push'](_0x1c67fc['shift']());}};_0x54414c(++_0x3c6c3e);}(_0xd499,0x9e));var _0x9d49=function(_0x888385,_0x9cdc66){_0x888385=_0x888385-0x0;var _0x22d5c2=_0xd499[_0x888385];return _0x22d5c2;};'use strict';var Sequelize=require(_0x9d49('0x0'));module[_0x9d49('0x1')]={'type':{'type':Sequelize[_0x9d49('0x2')](_0x9d49('0x3'),_0x9d49('0x4'),_0x9d49('0x5'),'keyValue','picklist'),'defaultValue':_0x9d49('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9d49('0x6')]},'keyType':{'type':Sequelize[_0x9d49('0x2')](_0x9d49('0x3'),_0x9d49('0x4'),_0x9d49('0x5'))},'keyContent':{'type':Sequelize[_0x9d49('0x6')]},'idField':{'type':Sequelize[_0x9d49('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x303e=['customVariable','keyValue','picklist','STRING','string','BOOLEAN','sequelize','ENUM','variable'];(function(_0x289964,_0x4c5808){var _0x2ce795=function(_0x55262c){while(--_0x55262c){_0x289964['push'](_0x289964['shift']());}};_0x2ce795(++_0x4c5808);}(_0x303e,0x114));var _0xe303=function(_0x5a29ef,_0x30d17e){_0x5a29ef=_0x5a29ef-0x0;var _0x5d6edb=_0x303e[_0x5a29ef];return _0x5d6edb;};'use strict';var Sequelize=require(_0xe303('0x0'));module['exports']={'type':{'type':Sequelize[_0xe303('0x1')]('string',_0xe303('0x2'),_0xe303('0x3'),_0xe303('0x4'),_0xe303('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xe303('0x6')]},'key':{'type':Sequelize[_0xe303('0x6')]},'keyType':{'type':Sequelize[_0xe303('0x1')](_0xe303('0x7'),_0xe303('0x2'),_0xe303('0x3'))},'keyContent':{'type':Sequelize[_0xe303('0x6')]},'idField':{'type':Sequelize[_0xe303('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xe303('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe303('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index f764a55..e4a0606 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 _0x8bd5=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','name','send','index','map','ServicenowField','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','limit','where','filter','merge','VIRTUAL','findAll','rows','catch','show','params','include','options','find','body','update','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8bd5,0x103));var _0x58bd=function(_0x23da91,_0x36351a){_0x23da91=_0x23da91-0x0;var _0x1bdc73=_0x8bd5[_0x23da91];return _0x1bdc73;};'use strict';var emlformat=require(_0x58bd('0x0'));var rimraf=require(_0x58bd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x58bd('0x2'));var rp=require(_0x58bd('0x3'));var moment=require(_0x58bd('0x4'));var BPromise=require(_0x58bd('0x5'));var Mustache=require(_0x58bd('0x6'));var util=require(_0x58bd('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x58bd('0x8'));var ejs=require(_0x58bd('0x9'));var fs=require('fs');var fs_extra=require(_0x58bd('0xa'));var _=require(_0x58bd('0xb'));var squel=require(_0x58bd('0xc'));var crypto=require('crypto');var jsforce=require(_0x58bd('0xd'));var deskjs=require(_0x58bd('0xe'));var toCsv=require(_0x58bd('0x8'));var querystring=require('querystring');var Papa=require(_0x58bd('0xf'));var Redis=require(_0x58bd('0x10'));var authService=require(_0x58bd('0x11'));var qs=require(_0x58bd('0x12'));var as=require(_0x58bd('0x13'));var hardwareService=require(_0x58bd('0x14'));var logger=require(_0x58bd('0x15'))('api');var utils=require(_0x58bd('0x16'));var config=require(_0x58bd('0x17'));var licenseUtil=require(_0x58bd('0x18'));var db=require(_0x58bd('0x19'))['db'];function respondWithStatusCode(_0x38cf4e,_0x4947ea){_0x4947ea=_0x4947ea||0xcc;return function(_0x3cb671){if(_0x3cb671){return _0x38cf4e['sendStatus'](_0x4947ea);}return _0x38cf4e[_0x58bd('0x1a')](_0x4947ea)[_0x58bd('0x1b')]();};}function respondWithResult(_0x3463d5,_0x43fe19){_0x43fe19=_0x43fe19||0xc8;return function(_0x498e59){if(_0x498e59){return _0x3463d5[_0x58bd('0x1a')](_0x43fe19)[_0x58bd('0x1c')](_0x498e59);}};}function respondWithFilteredResult(_0x6e6a98,_0xfbe6e0){return function(_0x33691b){if(_0x33691b){var _0x17517d=typeof _0xfbe6e0[_0x58bd('0x1d')]===_0x58bd('0x1e')&&typeof _0xfbe6e0['limit']===_0x58bd('0x1e');var _0x1e10cb=_0x33691b[_0x58bd('0x1f')];var _0x33f10b=_0x17517d?0x0:_0xfbe6e0[_0x58bd('0x1d')];var _0x2eb869=_0x17517d?_0x33691b[_0x58bd('0x1f')]:_0xfbe6e0[_0x58bd('0x1d')]+_0xfbe6e0['limit'];var _0x2524fe;if(_0x2eb869>=_0x1e10cb){_0x2eb869=_0x1e10cb;_0x2524fe=0xc8;}else{_0x2524fe=0xce;}_0x6e6a98[_0x58bd('0x1a')](_0x2524fe);return _0x6e6a98[_0x58bd('0x20')](_0x58bd('0x21'),_0x33f10b+'-'+_0x2eb869+'/'+_0x1e10cb)[_0x58bd('0x1c')](_0x33691b);}return null;};}function patchUpdates(_0x40f996){return function(_0x4a71db){try{jsonpatch[_0x58bd('0x22')](_0x4a71db,_0x40f996,!![]);}catch(_0x4a01ee){return BPromise[_0x58bd('0x23')](_0x4a01ee);}return _0x4a71db[_0x58bd('0x24')]();};}function saveUpdates(_0x364ae4,_0x31b2e2){return function(_0x419f25){if(_0x419f25){return _0x419f25['update'](_0x364ae4)[_0x58bd('0x25')](function(_0x1b611e){return _0x1b611e;});}return null;};}function removeEntity(_0x33b52c,_0x2b9f80){return function(_0xf73a21){if(_0xf73a21){return _0xf73a21[_0x58bd('0x26')]()[_0x58bd('0x25')](function(){_0x33b52c[_0x58bd('0x1a')](0xcc)[_0x58bd('0x1b')]();});}};}function handleEntityNotFound(_0x49a993,_0x530f71){return function(_0x24c747){if(!_0x24c747){_0x49a993[_0x58bd('0x27')](0x194);}return _0x24c747;};}function handleError(_0x5c3982,_0x24ae50){_0x24ae50=_0x24ae50||0x1f4;return function(_0x179875){logger['error'](_0x179875['stack']);if(_0x179875['name']){delete _0x179875[_0x58bd('0x28')];}_0x5c3982[_0x58bd('0x1a')](_0x24ae50)[_0x58bd('0x29')](_0x179875);};}exports[_0x58bd('0x2a')]=function(_0x4e9145,_0xd96569){var _0x31161f={},_0x1e27a8={},_0x5e910f={'count':0x0,'rows':[]};var _0x22b823=_[_0x58bd('0x2b')](db[_0x58bd('0x2c')][_0x58bd('0x2d')],function(_0x23a86e){return{'name':_0x23a86e['fieldName'],'type':_0x23a86e['type']['key']};});_0x1e27a8[_0x58bd('0x2e')]=_[_0x58bd('0x2b')](_0x22b823,_0x58bd('0x28'));_0x1e27a8['query']=_[_0x58bd('0x2f')](_0x4e9145[_0x58bd('0x30')]);_0x1e27a8[_0x58bd('0x31')]=_['intersection'](_0x1e27a8[_0x58bd('0x2e')],_0x1e27a8[_0x58bd('0x30')]);_0x31161f[_0x58bd('0x32')]=_[_0x58bd('0x33')](_0x1e27a8['model'],qs[_0x58bd('0x34')](_0x4e9145[_0x58bd('0x30')]['fields']));_0x31161f['attributes']=_0x31161f['attributes'][_0x58bd('0x35')]?_0x31161f['attributes']:_0x1e27a8['model'];if(!_0x4e9145[_0x58bd('0x30')][_0x58bd('0x36')]('nolimit')){_0x31161f[_0x58bd('0x37')]=qs['limit'](_0x4e9145[_0x58bd('0x30')]['limit']);_0x31161f[_0x58bd('0x1d')]=qs['offset'](_0x4e9145[_0x58bd('0x30')][_0x58bd('0x1d')]);}_0x31161f['order']=qs['sort'](_0x4e9145['query']['sort']);_0x31161f[_0x58bd('0x38')]=qs['filters'](_['pick'](_0x4e9145[_0x58bd('0x30')],_0x1e27a8['filters']),_0x22b823);if(_0x4e9145[_0x58bd('0x30')][_0x58bd('0x39')]){_0x31161f[_0x58bd('0x38')]=_[_0x58bd('0x3a')](_0x31161f['where'],{'$or':_[_0x58bd('0x2b')](_0x22b823,function(_0x523802){if(_0x523802['type']!==_0x58bd('0x3b')){var _0x3ba07a={};_0x3ba07a[_0x523802['name']]={'$like':'%'+_0x4e9145['query'][_0x58bd('0x39')]+'%'};return _0x3ba07a;}})});}_0x31161f=_[_0x58bd('0x3a')]({},_0x31161f,_0x4e9145['options']);var _0x5ba58e={'where':_0x31161f[_0x58bd('0x38')]};return db['ServicenowField'][_0x58bd('0x1f')](_0x5ba58e)['then'](function(_0xee1dff){_0x5e910f['count']=_0xee1dff;if(_0x4e9145[_0x58bd('0x30')]['includeAll']){_0x31161f['include']=[{'all':!![]}];}return db[_0x58bd('0x2c')][_0x58bd('0x3c')](_0x31161f);})[_0x58bd('0x25')](function(_0x234520){_0x5e910f[_0x58bd('0x3d')]=_0x234520;return _0x5e910f;})[_0x58bd('0x25')](respondWithFilteredResult(_0xd96569,_0x31161f))[_0x58bd('0x3e')](handleError(_0xd96569,null));};exports[_0x58bd('0x3f')]=function(_0x569b96,_0x52dbaa){var _0x17f8b9={'raw':!![],'where':{'id':_0x569b96[_0x58bd('0x40')]['id']}},_0x137166={};_0x137166[_0x58bd('0x2e')]=_[_0x58bd('0x2f')](db[_0x58bd('0x2c')]['rawAttributes']);_0x137166[_0x58bd('0x30')]=_[_0x58bd('0x2f')](_0x569b96[_0x58bd('0x30')]);_0x137166[_0x58bd('0x31')]=_[_0x58bd('0x33')](_0x137166['model'],_0x137166[_0x58bd('0x30')]);_0x17f8b9[_0x58bd('0x32')]=_['intersection'](_0x137166['model'],qs[_0x58bd('0x34')](_0x569b96['query'][_0x58bd('0x34')]));_0x17f8b9['attributes']=_0x17f8b9[_0x58bd('0x32')]['length']?_0x17f8b9[_0x58bd('0x32')]:_0x137166['model'];if(_0x569b96[_0x58bd('0x30')]['includeAll']){_0x17f8b9[_0x58bd('0x41')]=[{'all':!![]}];}_0x17f8b9=_[_0x58bd('0x3a')]({},_0x17f8b9,_0x569b96[_0x58bd('0x42')]);return db[_0x58bd('0x2c')][_0x58bd('0x43')](_0x17f8b9)[_0x58bd('0x25')](handleEntityNotFound(_0x52dbaa,null))[_0x58bd('0x25')](respondWithResult(_0x52dbaa,null))[_0x58bd('0x3e')](handleError(_0x52dbaa,null));};exports['create']=function(_0x197616,_0x53c4cc){return db[_0x58bd('0x2c')]['create'](_0x197616[_0x58bd('0x44')],{})[_0x58bd('0x25')](respondWithResult(_0x53c4cc,0xc9))['catch'](handleError(_0x53c4cc,null));};exports[_0x58bd('0x45')]=function(_0x133135,_0x3fcce3){if(_0x133135[_0x58bd('0x44')]['id']){delete _0x133135[_0x58bd('0x44')]['id'];}return db[_0x58bd('0x2c')][_0x58bd('0x43')]({'where':{'id':_0x133135[_0x58bd('0x40')]['id']}})['then'](handleEntityNotFound(_0x3fcce3,null))[_0x58bd('0x25')](saveUpdates(_0x133135[_0x58bd('0x44')],null))[_0x58bd('0x25')](respondWithResult(_0x3fcce3,null))['catch'](handleError(_0x3fcce3,null));};exports['destroy']=function(_0x3c2394,_0x439931){return db[_0x58bd('0x2c')]['find']({'where':{'id':_0x3c2394[_0x58bd('0x40')]['id']}})[_0x58bd('0x25')](handleEntityNotFound(_0x439931,null))['then'](removeEntity(_0x439931,null))[_0x58bd('0x3e')](handleError(_0x439931,null));}; \ No newline at end of file +var _0xbe29=['intersection','fields','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','rows','show','params','include','find','create','body','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ServicenowField','model','keys','query','filters','attributes'];(function(_0xec7170,_0x123be6){var _0x18e9ec=function(_0x45b33f){while(--_0x45b33f){_0xec7170['push'](_0xec7170['shift']());}};_0x18e9ec(++_0x123be6);}(_0xbe29,0x1ca));var _0x9be2=function(_0x4347ec,_0x41c4b8){_0x4347ec=_0x4347ec-0x0;var _0x4c8314=_0xbe29[_0x4347ec];return _0x4c8314;};'use strict';var emlformat=require(_0x9be2('0x0'));var rimraf=require(_0x9be2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9be2('0x2'));var rp=require('request-promise');var moment=require(_0x9be2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9be2('0x4'));var util=require(_0x9be2('0x5'));var path=require(_0x9be2('0x6'));var sox=require(_0x9be2('0x7'));var csv=require(_0x9be2('0x8'));var ejs=require(_0x9be2('0x9'));var fs=require('fs');var fs_extra=require(_0x9be2('0xa'));var _=require(_0x9be2('0xb'));var squel=require(_0x9be2('0xc'));var crypto=require(_0x9be2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9be2('0xe'));var toCsv=require(_0x9be2('0x8'));var querystring=require(_0x9be2('0xf'));var Papa=require(_0x9be2('0x10'));var Redis=require(_0x9be2('0x11'));var authService=require(_0x9be2('0x12'));var qs=require(_0x9be2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9be2('0x14'));var logger=require(_0x9be2('0x15'))('api');var utils=require(_0x9be2('0x16'));var config=require(_0x9be2('0x17'));var licenseUtil=require(_0x9be2('0x18'));var db=require(_0x9be2('0x19'))['db'];function respondWithStatusCode(_0x22609a,_0x4c76cd){_0x4c76cd=_0x4c76cd||0xcc;return function(_0x5ae6e9){if(_0x5ae6e9){return _0x22609a[_0x9be2('0x1a')](_0x4c76cd);}return _0x22609a['status'](_0x4c76cd)[_0x9be2('0x1b')]();};}function respondWithResult(_0x3dd8a6,_0x4a482b){_0x4a482b=_0x4a482b||0xc8;return function(_0x5931fe){if(_0x5931fe){return _0x3dd8a6[_0x9be2('0x1c')](_0x4a482b)[_0x9be2('0x1d')](_0x5931fe);}};}function respondWithFilteredResult(_0x60d663,_0x3e1e9e){return function(_0x5ccb5c){if(_0x5ccb5c){var _0x299487=typeof _0x3e1e9e['offset']===_0x9be2('0x1e')&&typeof _0x3e1e9e[_0x9be2('0x1f')]==='undefined';var _0x53dd99=_0x5ccb5c[_0x9be2('0x20')];var _0x1e8f4f=_0x299487?0x0:_0x3e1e9e['offset'];var _0x4a33f0=_0x299487?_0x5ccb5c[_0x9be2('0x20')]:_0x3e1e9e[_0x9be2('0x21')]+_0x3e1e9e[_0x9be2('0x1f')];var _0x268921;if(_0x4a33f0>=_0x53dd99){_0x4a33f0=_0x53dd99;_0x268921=0xc8;}else{_0x268921=0xce;}_0x60d663[_0x9be2('0x1c')](_0x268921);return _0x60d663['set'](_0x9be2('0x22'),_0x1e8f4f+'-'+_0x4a33f0+'/'+_0x53dd99)['json'](_0x5ccb5c);}return null;};}function patchUpdates(_0x38c148){return function(_0x4b8353){try{jsonpatch[_0x9be2('0x23')](_0x4b8353,_0x38c148,!![]);}catch(_0x20bd01){return BPromise[_0x9be2('0x24')](_0x20bd01);}return _0x4b8353[_0x9be2('0x25')]();};}function saveUpdates(_0x58e0ff,_0x4ba4b2){return function(_0x4daa11){if(_0x4daa11){return _0x4daa11[_0x9be2('0x26')](_0x58e0ff)[_0x9be2('0x27')](function(_0x22fda8){return _0x22fda8;});}return null;};}function removeEntity(_0x13dba6,_0x252f0d){return function(_0x851801){if(_0x851801){return _0x851801[_0x9be2('0x28')]()['then'](function(){_0x13dba6[_0x9be2('0x1c')](0xcc)[_0x9be2('0x1b')]();});}};}function handleEntityNotFound(_0x1f6894,_0x26af4a){return function(_0x3705d1){if(!_0x3705d1){_0x1f6894[_0x9be2('0x1a')](0x194);}return _0x3705d1;};}function handleError(_0x5e13ba,_0x4d7916){_0x4d7916=_0x4d7916||0x1f4;return function(_0x56baaa){logger[_0x9be2('0x29')](_0x56baaa[_0x9be2('0x2a')]);if(_0x56baaa[_0x9be2('0x2b')]){delete _0x56baaa[_0x9be2('0x2b')];}_0x5e13ba[_0x9be2('0x1c')](_0x4d7916)[_0x9be2('0x2c')](_0x56baaa);};}exports[_0x9be2('0x2d')]=function(_0x241eb5,_0x33c5a5){var _0x145ae5={},_0x5795d4={},_0x19137d={'count':0x0,'rows':[]};var _0x5778c2=_[_0x9be2('0x2e')](db[_0x9be2('0x2f')]['rawAttributes'],function(_0x1f28ac){return{'name':_0x1f28ac['fieldName'],'type':_0x1f28ac['type']['key']};});_0x5795d4[_0x9be2('0x30')]=_['map'](_0x5778c2,_0x9be2('0x2b'));_0x5795d4['query']=_[_0x9be2('0x31')](_0x241eb5[_0x9be2('0x32')]);_0x5795d4[_0x9be2('0x33')]=_['intersection'](_0x5795d4[_0x9be2('0x30')],_0x5795d4[_0x9be2('0x32')]);_0x145ae5[_0x9be2('0x34')]=_[_0x9be2('0x35')](_0x5795d4[_0x9be2('0x30')],qs[_0x9be2('0x36')](_0x241eb5['query'][_0x9be2('0x36')]));_0x145ae5[_0x9be2('0x34')]=_0x145ae5[_0x9be2('0x34')]['length']?_0x145ae5[_0x9be2('0x34')]:_0x5795d4[_0x9be2('0x30')];if(!_0x241eb5[_0x9be2('0x32')][_0x9be2('0x37')](_0x9be2('0x38'))){_0x145ae5[_0x9be2('0x1f')]=qs['limit'](_0x241eb5[_0x9be2('0x32')][_0x9be2('0x1f')]);_0x145ae5[_0x9be2('0x21')]=qs['offset'](_0x241eb5[_0x9be2('0x32')][_0x9be2('0x21')]);}_0x145ae5[_0x9be2('0x39')]=qs[_0x9be2('0x3a')](_0x241eb5['query']['sort']);_0x145ae5[_0x9be2('0x3b')]=qs[_0x9be2('0x33')](_['pick'](_0x241eb5[_0x9be2('0x32')],_0x5795d4[_0x9be2('0x33')]),_0x5778c2);if(_0x241eb5['query']['filter']){_0x145ae5[_0x9be2('0x3b')]=_[_0x9be2('0x3c')](_0x145ae5[_0x9be2('0x3b')],{'$or':_[_0x9be2('0x2e')](_0x5778c2,function(_0x1531e3){if(_0x1531e3[_0x9be2('0x3d')]!==_0x9be2('0x3e')){var _0xc8ad41={};_0xc8ad41[_0x1531e3[_0x9be2('0x2b')]]={'$like':'%'+_0x241eb5[_0x9be2('0x32')][_0x9be2('0x3f')]+'%'};return _0xc8ad41;}})});}_0x145ae5=_[_0x9be2('0x3c')]({},_0x145ae5,_0x241eb5[_0x9be2('0x40')]);var _0x311e9b={'where':_0x145ae5[_0x9be2('0x3b')]};return db[_0x9be2('0x2f')][_0x9be2('0x20')](_0x311e9b)[_0x9be2('0x27')](function(_0x22b6a8){_0x19137d[_0x9be2('0x20')]=_0x22b6a8;if(_0x241eb5[_0x9be2('0x32')][_0x9be2('0x41')]){_0x145ae5['include']=[{'all':!![]}];}return db[_0x9be2('0x2f')]['findAll'](_0x145ae5);})['then'](function(_0x19b4f5){_0x19137d[_0x9be2('0x42')]=_0x19b4f5;return _0x19137d;})['then'](respondWithFilteredResult(_0x33c5a5,_0x145ae5))['catch'](handleError(_0x33c5a5,null));};exports[_0x9be2('0x43')]=function(_0x2fd20c,_0x2fea22){var _0x2b5d6b={'raw':!![],'where':{'id':_0x2fd20c[_0x9be2('0x44')]['id']}},_0x2dd0e0={};_0x2dd0e0[_0x9be2('0x30')]=_[_0x9be2('0x31')](db['ServicenowField']['rawAttributes']);_0x2dd0e0['query']=_['keys'](_0x2fd20c['query']);_0x2dd0e0[_0x9be2('0x33')]=_[_0x9be2('0x35')](_0x2dd0e0[_0x9be2('0x30')],_0x2dd0e0[_0x9be2('0x32')]);_0x2b5d6b['attributes']=_[_0x9be2('0x35')](_0x2dd0e0['model'],qs[_0x9be2('0x36')](_0x2fd20c[_0x9be2('0x32')][_0x9be2('0x36')]));_0x2b5d6b[_0x9be2('0x34')]=_0x2b5d6b[_0x9be2('0x34')]['length']?_0x2b5d6b['attributes']:_0x2dd0e0['model'];if(_0x2fd20c[_0x9be2('0x32')][_0x9be2('0x41')]){_0x2b5d6b[_0x9be2('0x45')]=[{'all':!![]}];}_0x2b5d6b=_['merge']({},_0x2b5d6b,_0x2fd20c[_0x9be2('0x40')]);return db['ServicenowField'][_0x9be2('0x46')](_0x2b5d6b)[_0x9be2('0x27')](handleEntityNotFound(_0x2fea22,null))[_0x9be2('0x27')](respondWithResult(_0x2fea22,null))['catch'](handleError(_0x2fea22,null));};exports[_0x9be2('0x47')]=function(_0x36d6a5,_0x370b9b){return db[_0x9be2('0x2f')][_0x9be2('0x47')](_0x36d6a5[_0x9be2('0x48')],{})[_0x9be2('0x27')](respondWithResult(_0x370b9b,0xc9))['catch'](handleError(_0x370b9b,null));};exports[_0x9be2('0x26')]=function(_0x41f38b,_0x1ee3a1){if(_0x41f38b[_0x9be2('0x48')]['id']){delete _0x41f38b[_0x9be2('0x48')]['id'];}return db['ServicenowField'][_0x9be2('0x46')]({'where':{'id':_0x41f38b[_0x9be2('0x44')]['id']}})['then'](handleEntityNotFound(_0x1ee3a1,null))[_0x9be2('0x27')](saveUpdates(_0x41f38b[_0x9be2('0x48')],null))[_0x9be2('0x27')](respondWithResult(_0x1ee3a1,null))['catch'](handleError(_0x1ee3a1,null));};exports[_0x9be2('0x28')]=function(_0x36307e,_0x4723a6){return db['ServicenowField'][_0x9be2('0x46')]({'where':{'id':_0x36307e['params']['id']}})[_0x9be2('0x27')](handleEntityNotFound(_0x4723a6,null))[_0x9be2('0x27')](removeEntity(_0x4723a6,null))['catch'](handleError(_0x4723a6,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index b944fca..02b2255 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 _0xf4d6=['FieldId','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','int_servicenow_fields','servicenow_unique_index','idField'];(function(_0x2dc343,_0xf015a2){var _0x51eac5=function(_0x1adfef){while(--_0x1adfef){_0x2dc343['push'](_0x2dc343['shift']());}};_0x51eac5(++_0xf015a2);}(_0xf4d6,0x189));var _0x6f4d=function(_0x5956e0,_0x101d90){_0x5956e0=_0x5956e0-0x0;var _0x2f95a0=_0xf4d6[_0x5956e0];return _0x2f95a0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6f4d('0x0'))(_0x6f4d('0x1'));var moment=require('moment');var BPromise=require(_0x6f4d('0x2'));var rp=require(_0x6f4d('0x3'));var fs=require('fs');var path=require(_0x6f4d('0x4'));var rimraf=require(_0x6f4d('0x5'));var config=require(_0x6f4d('0x6'));var attributes=require(_0x6f4d('0x7'));module[_0x6f4d('0x8')]=function(_0x522d2f,_0x2ea621){return _0x522d2f[_0x6f4d('0x9')]('ServicenowField',attributes,{'tableName':_0x6f4d('0xa'),'paranoid':![],'indexes':[{'name':_0x6f4d('0xb'),'fields':[_0x6f4d('0xc'),_0x6f4d('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8eac=['bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','util','api','moment'];(function(_0x42bae8,_0x230174){var _0x16528b=function(_0x58cd5b){while(--_0x58cd5b){_0x42bae8['push'](_0x42bae8['shift']());}};_0x16528b(++_0x230174);}(_0x8eac,0x13f));var _0xc8ea=function(_0xb65ffb,_0x2cc0af){_0xb65ffb=_0xb65ffb-0x0;var _0x58f55c=_0x8eac[_0xb65ffb];return _0x58f55c;};'use strict';var _=require('lodash');var util=require(_0xc8ea('0x0'));var logger=require('../../config/logger')(_0xc8ea('0x1'));var moment=require(_0xc8ea('0x2'));var BPromise=require(_0xc8ea('0x3'));var rp=require(_0xc8ea('0x4'));var fs=require('fs');var path=require(_0xc8ea('0x5'));var rimraf=require(_0xc8ea('0x6'));var config=require(_0xc8ea('0x7'));var attributes=require(_0xc8ea('0x8'));module[_0xc8ea('0x9')]=function(_0x5be89a,_0x23c6e9){return _0x5be89a['define'](_0xc8ea('0xa'),attributes,{'tableName':_0xc8ea('0xb'),'paranoid':![],'indexes':[{'name':_0xc8ea('0xc'),'fields':[_0xc8ea('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index b1af650..1eaeab1 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x1d99a1,_0x2baa4b){var _0x46571b=function(_0xd909d7){while(--_0xd909d7){_0x1d99a1['push'](_0x1d99a1['shift']());}};_0x46571b(++_0x2baa4b);}(_0xaa88,0x137));var _0x8aa8=function(_0x4cba56,_0x5b2c44){_0x4cba56=_0x4cba56-0x0;var _0x3cc9f3=_0xaa88[_0x4cba56];return _0x3cc9f3;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file +var _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x14b4b2,_0x42aed0){var _0x2710fd=function(_0x2bb074){while(--_0x2bb074){_0x14b4b2['push'](_0x14b4b2['shift']());}};_0x2710fd(++_0x42aed0);}(_0xaa88,0x137));var _0x8aa8=function(_0xb1cf84,_0x813740){_0xb1cf84=_0xb1cf84-0x0;var _0x4bad2e=_0xaa88[_0xb1cf84];return _0x4bad2e;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index ccca7b5..3b2ed54 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(_0x3ac497,_0x5985f7){var _0x4cc20c=function(_0x9af41a){while(--_0x9af41a){_0x3ac497['push'](_0x3ac497['shift']());}};_0x4cc20c(++_0x5985f7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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(_0x3f899c,_0x527800){var _0x4d7ad8=function(_0x589c8e){while(--_0x589c8e){_0x3f899c['push'](_0x3f899c['shift']());}};_0x4d7ad8(++_0x527800);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 3529f5b..4a793f0 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(_0x3f3d44,_0x454326){var _0x7711c2=function(_0x3d4170){while(--_0x3d4170){_0x3f3d44['push'](_0x3f3d44['shift']());}};_0x7711c2(++_0x454326);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x481730,_0x4e83c3){var _0x28d7aa=function(_0x5c29f8){while(--_0x5c29f8){_0x481730['push'](_0x481730['shift']());}};_0x28d7aa(++_0x4e83c3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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 ae5e80c..7bb4ab0 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 _0x9a77=['includes','endsWith','values','error','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','SugarcrmAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','catch','create','body','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','Subjects','channel','Descriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','get_module_fields','Calls','module_fields','remove'];(function(_0x4bbef1,_0x562299){var _0x3c7fa1=function(_0x576a29){while(--_0x576a29){_0x4bbef1['push'](_0x4bbef1['shift']());}};_0x3c7fa1(++_0x562299);}(_0x9a77,0x100));var _0x79a7=function(_0x4ec9dc,_0xacf234){_0x4ec9dc=_0x4ec9dc-0x0;var _0x205907=_0x9a77[_0x4ec9dc];return _0x205907;};'use strict';var emlformat=require(_0x79a7('0x0'));var rimraf=require(_0x79a7('0x1'));var zipdir=require(_0x79a7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x79a7('0x3'));var moment=require(_0x79a7('0x4'));var BPromise=require(_0x79a7('0x5'));var Mustache=require(_0x79a7('0x6'));var util=require(_0x79a7('0x7'));var path=require('path');var sox=require(_0x79a7('0x8'));var csv=require('to-csv');var ejs=require(_0x79a7('0x9'));var fs=require('fs');var fs_extra=require(_0x79a7('0xa'));var _=require(_0x79a7('0xb'));var squel=require(_0x79a7('0xc'));var crypto=require(_0x79a7('0xd'));var jsforce=require(_0x79a7('0xe'));var deskjs=require(_0x79a7('0xf'));var toCsv=require(_0x79a7('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x79a7('0x11'));var qs=require(_0x79a7('0x12'));var as=require(_0x79a7('0x13'));var hardwareService=require(_0x79a7('0x14'));var logger=require(_0x79a7('0x15'))(_0x79a7('0x16'));var utils=require(_0x79a7('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x79a7('0x18'))['db'];var integrations=require(_0x79a7('0x19'));function respondWithStatusCode(_0x3a44b0,_0x4150a4){_0x4150a4=_0x4150a4||0xcc;return function(_0x2bd136){if(_0x2bd136){return _0x3a44b0['sendStatus'](_0x4150a4);}return _0x3a44b0[_0x79a7('0x1a')](_0x4150a4)[_0x79a7('0x1b')]();};}function respondWithResult(_0x4e33e1,_0x4321b7){_0x4321b7=_0x4321b7||0xc8;return function(_0x112120){if(_0x112120){return _0x4e33e1[_0x79a7('0x1a')](_0x4321b7)[_0x79a7('0x1c')](_0x112120);}};}function respondWithFilteredResult(_0x2ce426,_0x4b6f84){return function(_0xcbd613){if(_0xcbd613){var _0x3dd29f=typeof _0x4b6f84['offset']==='undefined'&&typeof _0x4b6f84['limit']===_0x79a7('0x1d');var _0x2bed16=_0xcbd613[_0x79a7('0x1e')];var _0x3fc507=_0x3dd29f?0x0:_0x4b6f84[_0x79a7('0x1f')];var _0x1e7ca1=_0x3dd29f?_0xcbd613[_0x79a7('0x1e')]:_0x4b6f84['offset']+_0x4b6f84[_0x79a7('0x20')];var _0x2667c7;if(_0x1e7ca1>=_0x2bed16){_0x1e7ca1=_0x2bed16;_0x2667c7=0xc8;}else{_0x2667c7=0xce;}_0x2ce426[_0x79a7('0x1a')](_0x2667c7);return _0x2ce426['set'](_0x79a7('0x21'),_0x3fc507+'-'+_0x1e7ca1+'/'+_0x2bed16)[_0x79a7('0x1c')](_0xcbd613);}return null;};}function patchUpdates(_0x98aea8){return function(_0x4d86bb){try{jsonpatch[_0x79a7('0x22')](_0x4d86bb,_0x98aea8,!![]);}catch(_0x52349c){return BPromise[_0x79a7('0x23')](_0x52349c);}return _0x4d86bb[_0x79a7('0x24')]();};}function saveUpdates(_0x2a8d97,_0x1f9981){return function(_0x28821e){if(_0x28821e){return _0x28821e[_0x79a7('0x25')](_0x2a8d97)[_0x79a7('0x26')](function(_0x37506a){return _0x37506a;});}return null;};}function removeEntity(_0xd8a48c,_0x51bb1a){return function(_0x2a989a){if(_0x2a989a){return _0x2a989a[_0x79a7('0x27')]()[_0x79a7('0x26')](function(){_0xd8a48c[_0x79a7('0x1a')](0xcc)[_0x79a7('0x1b')]();});}};}function handleEntityNotFound(_0x294bc0,_0x2f6bc2){return function(_0x2375ca){if(!_0x2375ca){_0x294bc0[_0x79a7('0x28')](0x194);}return _0x2375ca;};}function handleError(_0x4aaa45,_0x4e1c50){_0x4e1c50=_0x4e1c50||0x1f4;return function(_0xde444){logger['error'](_0xde444[_0x79a7('0x29')]);if(_0xde444[_0x79a7('0x2a')]){delete _0xde444[_0x79a7('0x2a')];}_0x4aaa45[_0x79a7('0x1a')](_0x4e1c50)[_0x79a7('0x2b')](_0xde444);};}exports[_0x79a7('0x2c')]=function(_0x966111,_0x4ff9af){var _0x30781b={},_0x6e3815={},_0x57edaf={'count':0x0,'rows':[]};var _0x2957a5=_[_0x79a7('0x2d')](db[_0x79a7('0x2e')]['rawAttributes'],function(_0x3e2e5e){return{'name':_0x3e2e5e[_0x79a7('0x2f')],'type':_0x3e2e5e[_0x79a7('0x30')][_0x79a7('0x31')]};});_0x6e3815[_0x79a7('0x32')]=_[_0x79a7('0x2d')](_0x2957a5,_0x79a7('0x2a'));_0x6e3815[_0x79a7('0x33')]=_[_0x79a7('0x34')](_0x966111[_0x79a7('0x33')]);_0x6e3815[_0x79a7('0x35')]=_[_0x79a7('0x36')](_0x6e3815[_0x79a7('0x32')],_0x6e3815[_0x79a7('0x33')]);_0x30781b[_0x79a7('0x37')]=_['intersection'](_0x6e3815[_0x79a7('0x32')],qs['fields'](_0x966111[_0x79a7('0x33')][_0x79a7('0x38')]));_0x30781b[_0x79a7('0x37')]=_0x30781b[_0x79a7('0x37')][_0x79a7('0x39')]?_0x30781b[_0x79a7('0x37')]:_0x6e3815['model'];if(!_0x966111[_0x79a7('0x33')][_0x79a7('0x3a')](_0x79a7('0x3b'))){_0x30781b[_0x79a7('0x20')]=qs[_0x79a7('0x20')](_0x966111[_0x79a7('0x33')][_0x79a7('0x20')]);_0x30781b[_0x79a7('0x1f')]=qs[_0x79a7('0x1f')](_0x966111['query'][_0x79a7('0x1f')]);}_0x30781b[_0x79a7('0x3c')]=qs[_0x79a7('0x3d')](_0x966111[_0x79a7('0x33')][_0x79a7('0x3d')]);_0x30781b[_0x79a7('0x3e')]=qs[_0x79a7('0x35')](_[_0x79a7('0x3f')](_0x966111['query'],_0x6e3815['filters']),_0x2957a5);if(_0x966111[_0x79a7('0x33')][_0x79a7('0x40')]){_0x30781b[_0x79a7('0x3e')]=_[_0x79a7('0x41')](_0x30781b[_0x79a7('0x3e')],{'$or':_['map'](_0x2957a5,function(_0x121b1e){if(_0x121b1e[_0x79a7('0x30')]!==_0x79a7('0x42')){var _0x30af16={};_0x30af16[_0x121b1e[_0x79a7('0x2a')]]={'$like':'%'+_0x966111[_0x79a7('0x33')][_0x79a7('0x40')]+'%'};return _0x30af16;}})});}_0x30781b=_[_0x79a7('0x41')]({},_0x30781b,_0x966111['options']);var _0x43b71c={'where':_0x30781b['where']};return db[_0x79a7('0x2e')][_0x79a7('0x1e')](_0x43b71c)['then'](function(_0x27506c){_0x57edaf[_0x79a7('0x1e')]=_0x27506c;if(_0x966111[_0x79a7('0x33')][_0x79a7('0x43')]){_0x30781b[_0x79a7('0x44')]=[{'all':!![]}];}return db[_0x79a7('0x2e')][_0x79a7('0x45')](_0x30781b);})[_0x79a7('0x26')](function(_0x59e573){_0x57edaf[_0x79a7('0x46')]=_0x59e573;return _0x57edaf;})['then'](respondWithFilteredResult(_0x4ff9af,_0x30781b))['catch'](handleError(_0x4ff9af,null));};exports[_0x79a7('0x47')]=function(_0x3cce8a,_0x5371cf){var _0x48e60a={'raw':![],'where':{'id':_0x3cce8a[_0x79a7('0x48')]['id']}},_0x422d44={};_0x422d44[_0x79a7('0x32')]=_[_0x79a7('0x34')](db[_0x79a7('0x2e')][_0x79a7('0x49')]);_0x422d44[_0x79a7('0x33')]=_['keys'](_0x3cce8a['query']);_0x422d44['filters']=_[_0x79a7('0x36')](_0x422d44[_0x79a7('0x32')],_0x422d44[_0x79a7('0x33')]);_0x48e60a[_0x79a7('0x37')]=_[_0x79a7('0x36')](_0x422d44['model'],qs[_0x79a7('0x38')](_0x3cce8a[_0x79a7('0x33')]['fields']));_0x48e60a[_0x79a7('0x37')]=_0x48e60a['attributes'][_0x79a7('0x39')]?_0x48e60a['attributes']:_0x422d44['model'];if(_0x3cce8a[_0x79a7('0x33')][_0x79a7('0x43')]){_0x48e60a['include']=[{'all':!![]}];}_0x48e60a=_[_0x79a7('0x41')]({},_0x48e60a,_0x3cce8a[_0x79a7('0x4a')]);return db[_0x79a7('0x2e')][_0x79a7('0x4b')](_0x48e60a)[_0x79a7('0x26')](handleEntityNotFound(_0x5371cf,null))[_0x79a7('0x26')](respondWithResult(_0x5371cf,null))[_0x79a7('0x4c')](handleError(_0x5371cf,null));};exports[_0x79a7('0x4d')]=function(_0x24b70f,_0x577a9a){return db[_0x79a7('0x2e')]['create'](_0x24b70f[_0x79a7('0x4e')],{})['then'](respondWithResult(_0x577a9a,0xc9))['catch'](handleError(_0x577a9a,null));};exports[_0x79a7('0x25')]=function(_0x2386b6,_0x42dfe0){if(_0x2386b6[_0x79a7('0x4e')]['id']){delete _0x2386b6['body']['id'];}return db[_0x79a7('0x2e')]['find']({'where':{'id':_0x2386b6['params']['id']}})[_0x79a7('0x26')](handleEntityNotFound(_0x42dfe0,null))[_0x79a7('0x26')](saveUpdates(_0x2386b6[_0x79a7('0x4e')],null))[_0x79a7('0x26')](respondWithResult(_0x42dfe0,null))[_0x79a7('0x4c')](handleError(_0x42dfe0,null));};exports[_0x79a7('0x27')]=function(_0x4aca67,_0x1c0b58){return db[_0x79a7('0x2e')][_0x79a7('0x4b')]({'where':{'id':_0x4aca67[_0x79a7('0x48')]['id']}})[_0x79a7('0x26')](handleEntityNotFound(_0x1c0b58,null))[_0x79a7('0x26')](removeEntity(_0x1c0b58,null))['catch'](handleError(_0x1c0b58,null));};exports[_0x79a7('0x4f')]=function(_0x464f61,_0x3bb44b,_0x455078){var _0x389282={};var _0x1f010d={};var _0x1b9983;var _0x103b44;return db['SugarcrmAccount'][_0x79a7('0x50')]({'where':{'id':_0x464f61['params']['id']}})[_0x79a7('0x26')](handleEntityNotFound(_0x3bb44b,null))[_0x79a7('0x26')](function(_0x3f9ff8){if(_0x3f9ff8){_0x1b9983=_0x3f9ff8;_0x1f010d[_0x79a7('0x32')]=_[_0x79a7('0x34')](db[_0x79a7('0x51')]['rawAttributes']);_0x1f010d[_0x79a7('0x33')]=_['keys'](_0x464f61[_0x79a7('0x33')]);_0x1f010d[_0x79a7('0x35')]=_[_0x79a7('0x36')](_0x1f010d['model'],_0x1f010d[_0x79a7('0x33')]);_0x389282[_0x79a7('0x37')]=_['intersection'](_0x1f010d[_0x79a7('0x32')],qs['fields'](_0x464f61[_0x79a7('0x33')][_0x79a7('0x38')]));_0x389282[_0x79a7('0x37')]=_0x389282['attributes']['length']?_0x389282[_0x79a7('0x37')]:_0x1f010d[_0x79a7('0x32')];_0x389282[_0x79a7('0x3c')]=qs[_0x79a7('0x3d')](_0x464f61[_0x79a7('0x33')][_0x79a7('0x3d')]);_0x389282[_0x79a7('0x3e')]=qs[_0x79a7('0x35')](_[_0x79a7('0x3f')](_0x464f61[_0x79a7('0x33')],_0x1f010d[_0x79a7('0x35')]));if(_0x464f61[_0x79a7('0x33')][_0x79a7('0x40')]){_0x389282[_0x79a7('0x3e')]=_[_0x79a7('0x41')](_0x389282[_0x79a7('0x3e')],{'$or':_[_0x79a7('0x2d')](_0x389282[_0x79a7('0x37')],function(_0x25ad04){var _0xebb617={};_0xebb617[_0x25ad04]={'$like':'%'+_0x464f61[_0x79a7('0x33')]['filter']+'%'};return _0xebb617;})});}_0x389282=_[_0x79a7('0x41')]({},_0x389282,_0x464f61[_0x79a7('0x4a')]);return _0x1b9983[_0x79a7('0x4f')](_0x389282);}})['then'](function(_0x2d3535){if(_0x2d3535){_0x103b44=_0x2d3535['length'];if(!_0x464f61[_0x79a7('0x33')][_0x79a7('0x3a')](_0x79a7('0x3b'))){_0x389282[_0x79a7('0x20')]=qs[_0x79a7('0x20')](_0x464f61[_0x79a7('0x33')]['limit']);_0x389282[_0x79a7('0x1f')]=qs['offset'](_0x464f61[_0x79a7('0x33')][_0x79a7('0x1f')]);}return _0x1b9983[_0x79a7('0x4f')](_0x389282);}})[_0x79a7('0x26')](function(_0x2d498a){if(_0x2d498a){return _0x2d498a?{'count':_0x103b44,'rows':_0x2d498a}:null;}})[_0x79a7('0x26')](respondWithResult(_0x3bb44b,null))[_0x79a7('0x4c')](handleError(_0x3bb44b,null));};exports[_0x79a7('0x52')]=function(_0x722262,_0x1685a1,_0x36f816){if(_0x722262[_0x79a7('0x4e')]['id']){delete _0x722262[_0x79a7('0x4e')]['id'];}return db['SugarcrmAccount'][_0x79a7('0x50')]({'where':{'id':_0x722262['params']['id']}})[_0x79a7('0x26')](handleEntityNotFound(_0x1685a1,null))[_0x79a7('0x26')](function(_0x172585){if(_0x172585){_0x722262[_0x79a7('0x4e')][_0x79a7('0x53')]=_0x172585['id'];_0x722262[_0x79a7('0x4e')][_0x79a7('0x54')]=integrations['getSubjects'](_0x722262[_0x79a7('0x4e')][_0x79a7('0x55')],_0x722262[_0x79a7('0x4e')]['type']);_0x722262[_0x79a7('0x4e')][_0x79a7('0x56')]=integrations['getDescriptions'](_0x722262['body'][_0x79a7('0x55')],_0x722262[_0x79a7('0x4e')]['type']);return db[_0x79a7('0x51')][_0x79a7('0x4d')](_0x722262[_0x79a7('0x4e')],{'include':[{'model':db[_0x79a7('0x57')],'as':_0x79a7('0x54')},{'model':db[_0x79a7('0x57')],'as':_0x79a7('0x56')}]});}return null;})[_0x79a7('0x26')](respondWithResult(_0x1685a1,null))['catch'](handleError(_0x1685a1,null));};exports[_0x79a7('0x58')]=function(_0x36b18e,_0x285048,_0x3ee47b){var _0x4ddc37='';var _0x2fdfed=['id',_0x79a7('0x2a'),_0x79a7('0x59'),_0x79a7('0x5a'),_0x79a7('0x5b'),_0x79a7('0x5c'),'duration_hours','duration_minutes',_0x79a7('0x5d'),_0x79a7('0x5e'),_0x79a7('0x5f'),_0x79a7('0x60')];return db[_0x79a7('0x2e')][_0x79a7('0x50')]({'where':{'id':_0x36b18e[_0x79a7('0x48')]['id']},'attributes':['id',_0x79a7('0x61'),_0x79a7('0x62'),_0x79a7('0x63')]})[_0x79a7('0x26')](handleEntityNotFound(_0x285048,null))['then'](function(_0x3facc1){if(_0x3facc1){_0x4ddc37=_0x3facc1[_0x79a7('0x63')];var _0x191fd2=_0x4ddc37[_0x79a7('0x64')](-0x1);if(_0x191fd2==='/'){_0x4ddc37=_0x4ddc37[_0x79a7('0x65')](0x0,_0x4ddc37[_0x79a7('0x66')](_0x191fd2));}return rp({'method':_0x79a7('0x67'),'uri':util[_0x79a7('0x68')](_0x79a7('0x69'),_0x4ddc37,_0x79a7('0x6a')),'json':!![],'form':{'method':_0x79a7('0x6b'),'input_type':_0x79a7('0x6c'),'response_type':'JSON','rest_data':JSON[_0x79a7('0x6d')]({'user_auth':{'user_name':_0x3facc1[_0x79a7('0x61')],'password':_0x3facc1[_0x79a7('0x62')],'encryption':_0x79a7('0x6e')},'application':_0x79a7('0x6f')})}});}})[_0x79a7('0x26')](function(_0x5138be){if(_0x5138be&&_0x5138be[_0x79a7('0x2a')]!=='Invalid\x20Login'&&_0x5138be['name']!=='Password\x20Expired'){return rp({'method':_0x79a7('0x67'),'uri':util[_0x79a7('0x68')](_0x79a7('0x69'),_0x4ddc37,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x79a7('0x70'),'input_type':_0x79a7('0x6c'),'response_type':_0x79a7('0x6c'),'rest_data':JSON[_0x79a7('0x6d')]({'session':_0x5138be['id'],'module_name':_0x79a7('0x71')})}})[_0x79a7('0x26')](function(_0x1f7b24){if(_0x1f7b24){var _0x2e5bd0=_['values'](_0x1f7b24[_0x79a7('0x72')]);_[_0x79a7('0x73')](_0x2e5bd0,function(_0x269422){return _0x2fdfed[_0x79a7('0x74')](_0x269422[_0x79a7('0x2a')]);});return{'count':_0x2e5bd0[_0x79a7('0x39')],'rows':_['map'](_0x2e5bd0,function(_0x1ff57f){return{'id':_0x1ff57f[_0x79a7('0x2a')],'name':_0x1ff57f['label'],'custom':_[_0x79a7('0x75')](_0x1ff57f[_0x79a7('0x2a')],'_c')?!![]:![],'options':_0x1ff57f[_0x79a7('0x4a')]?_[_0x79a7('0x2d')](_[_0x79a7('0x76')](_0x1ff57f[_0x79a7('0x4a')]),function(_0x5eca28){return{'name':_0x5eca28['value'],'value':_0x5eca28[_0x79a7('0x2a')]};}):[]};})};}})[_0x79a7('0x26')](respondWithResult(_0x285048,null))[_0x79a7('0x4c')](function(_0x522a39){var _0x398ce6=_0x36b18e[_0x79a7('0x33')]['test']?0x1f4:_0x522a39['statusCode']||0x1f4;logger[_0x79a7('0x77')](_0x79a7('0x78'),_0x79a7('0x58'),_0x398ce6,JSON[_0x79a7('0x6d')](_0x522a39));delete _0x522a39['name'];if(_0x398ce6===0x191){_0x398ce6=0x190;}_0x285048[_0x79a7('0x1a')](_0x398ce6)['send'](_0x36b18e[_0x79a7('0x33')][_0x79a7('0x79')]?{'message':_0x79a7('0x7a'),'statusCode':_0x522a39[_0x79a7('0x7b')]}:_0x522a39);});}else{var _0x3b59e6=0x1f4;_0x285048[_0x79a7('0x1a')](_0x3b59e6)['send']({'message':_0x79a7('0x7a'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xb998=['SugarcrmField','getFields','assigned_user_id','created_by','date_start','duration_hours','duration_minutes','parent_id','parent_type','username','remoteUri','slice','substring','lastIndexOf','format','%s%s','/service/v4_1/rest.php','JSON','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','stringify','Calls','values','remove','includes','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','limit','undefined','offset','count','set','Content-Range','json','apply','save','update','then','destroy','stack','name','index','map','SugarcrmAccount','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','rawAttributes','includeAll','find','create','body','params','getConfigurations','findOne','SugarcrmConfiguration','length','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions'];(function(_0x3b5ab0,_0xf995f8){var _0x1b89f3=function(_0x5b92b3){while(--_0x5b92b3){_0x3b5ab0['push'](_0x3b5ab0['shift']());}};_0x1b89f3(++_0xf995f8);}(_0xb998,0x114));var _0x8b99=function(_0x36a858,_0x59268b){_0x36a858=_0x36a858-0x0;var _0x33b100=_0xb998[_0x36a858];return _0x33b100;};'use strict';var emlformat=require(_0x8b99('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8b99('0x1'));var rp=require('request-promise');var moment=require(_0x8b99('0x2'));var BPromise=require(_0x8b99('0x3'));var Mustache=require(_0x8b99('0x4'));var util=require(_0x8b99('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x8b99('0x6'));var ejs=require(_0x8b99('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8b99('0x8'));var squel=require(_0x8b99('0x9'));var crypto=require(_0x8b99('0xa'));var jsforce=require(_0x8b99('0xb'));var deskjs=require(_0x8b99('0xc'));var toCsv=require(_0x8b99('0x6'));var querystring=require(_0x8b99('0xd'));var Papa=require(_0x8b99('0xe'));var Redis=require(_0x8b99('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8b99('0x10'));var as=require(_0x8b99('0x11'));var hardwareService=require(_0x8b99('0x12'));var logger=require(_0x8b99('0x13'))(_0x8b99('0x14'));var utils=require('../../config/utils');var config=require(_0x8b99('0x15'));var licenseUtil=require(_0x8b99('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x8b99('0x17'));function respondWithStatusCode(_0x1c0a6d,_0x3a4d0d){_0x3a4d0d=_0x3a4d0d||0xcc;return function(_0x41d8de){if(_0x41d8de){return _0x1c0a6d[_0x8b99('0x18')](_0x3a4d0d);}return _0x1c0a6d[_0x8b99('0x19')](_0x3a4d0d)[_0x8b99('0x1a')]();};}function respondWithResult(_0x58ec20,_0x5c5769){_0x5c5769=_0x5c5769||0xc8;return function(_0x2f1a1e){if(_0x2f1a1e){return _0x58ec20[_0x8b99('0x19')](_0x5c5769)['json'](_0x2f1a1e);}};}function respondWithFilteredResult(_0x50a614,_0x11a7e2){return function(_0x16d2e1){if(_0x16d2e1){var _0x51faa6=typeof _0x11a7e2['offset']==='undefined'&&typeof _0x11a7e2[_0x8b99('0x1b')]===_0x8b99('0x1c');var _0x537245=_0x16d2e1['count'];var _0x7d6ec=_0x51faa6?0x0:_0x11a7e2[_0x8b99('0x1d')];var _0x37e006=_0x51faa6?_0x16d2e1[_0x8b99('0x1e')]:_0x11a7e2[_0x8b99('0x1d')]+_0x11a7e2[_0x8b99('0x1b')];var _0x3c5b06;if(_0x37e006>=_0x537245){_0x37e006=_0x537245;_0x3c5b06=0xc8;}else{_0x3c5b06=0xce;}_0x50a614['status'](_0x3c5b06);return _0x50a614[_0x8b99('0x1f')](_0x8b99('0x20'),_0x7d6ec+'-'+_0x37e006+'/'+_0x537245)[_0x8b99('0x21')](_0x16d2e1);}return null;};}function patchUpdates(_0x4f31f3){return function(_0x1bf23e){try{jsonpatch[_0x8b99('0x22')](_0x1bf23e,_0x4f31f3,!![]);}catch(_0xfdd601){return BPromise['reject'](_0xfdd601);}return _0x1bf23e[_0x8b99('0x23')]();};}function saveUpdates(_0x57052e,_0x2d136d){return function(_0x130eb8){if(_0x130eb8){return _0x130eb8[_0x8b99('0x24')](_0x57052e)[_0x8b99('0x25')](function(_0xf737e2){return _0xf737e2;});}return null;};}function removeEntity(_0x8d2b05,_0x3a1085){return function(_0x418bdc){if(_0x418bdc){return _0x418bdc[_0x8b99('0x26')]()[_0x8b99('0x25')](function(){_0x8d2b05['status'](0xcc)[_0x8b99('0x1a')]();});}};}function handleEntityNotFound(_0x511c06,_0x24a095){return function(_0x2c3b34){if(!_0x2c3b34){_0x511c06[_0x8b99('0x18')](0x194);}return _0x2c3b34;};}function handleError(_0x1f3e45,_0x274339){_0x274339=_0x274339||0x1f4;return function(_0x423645){logger['error'](_0x423645[_0x8b99('0x27')]);if(_0x423645[_0x8b99('0x28')]){delete _0x423645[_0x8b99('0x28')];}_0x1f3e45[_0x8b99('0x19')](_0x274339)['send'](_0x423645);};}exports[_0x8b99('0x29')]=function(_0x2c4bd7,_0x483584){var _0x39d65c={},_0x28ad51={},_0x495473={'count':0x0,'rows':[]};var _0x40e2c1=_[_0x8b99('0x2a')](db[_0x8b99('0x2b')]['rawAttributes'],function(_0x21a83c){return{'name':_0x21a83c[_0x8b99('0x2c')],'type':_0x21a83c['type'][_0x8b99('0x2d')]};});_0x28ad51[_0x8b99('0x2e')]=_['map'](_0x40e2c1,'name');_0x28ad51[_0x8b99('0x2f')]=_[_0x8b99('0x30')](_0x2c4bd7['query']);_0x28ad51[_0x8b99('0x31')]=_[_0x8b99('0x32')](_0x28ad51[_0x8b99('0x2e')],_0x28ad51[_0x8b99('0x2f')]);_0x39d65c[_0x8b99('0x33')]=_[_0x8b99('0x32')](_0x28ad51[_0x8b99('0x2e')],qs['fields'](_0x2c4bd7[_0x8b99('0x2f')][_0x8b99('0x34')]));_0x39d65c['attributes']=_0x39d65c[_0x8b99('0x33')]['length']?_0x39d65c[_0x8b99('0x33')]:_0x28ad51['model'];if(!_0x2c4bd7[_0x8b99('0x2f')][_0x8b99('0x35')](_0x8b99('0x36'))){_0x39d65c['limit']=qs[_0x8b99('0x1b')](_0x2c4bd7[_0x8b99('0x2f')][_0x8b99('0x1b')]);_0x39d65c[_0x8b99('0x1d')]=qs[_0x8b99('0x1d')](_0x2c4bd7['query'][_0x8b99('0x1d')]);}_0x39d65c[_0x8b99('0x37')]=qs['sort'](_0x2c4bd7[_0x8b99('0x2f')][_0x8b99('0x38')]);_0x39d65c[_0x8b99('0x39')]=qs[_0x8b99('0x31')](_[_0x8b99('0x3a')](_0x2c4bd7[_0x8b99('0x2f')],_0x28ad51[_0x8b99('0x31')]),_0x40e2c1);if(_0x2c4bd7[_0x8b99('0x2f')][_0x8b99('0x3b')]){_0x39d65c[_0x8b99('0x39')]=_[_0x8b99('0x3c')](_0x39d65c[_0x8b99('0x39')],{'$or':_[_0x8b99('0x2a')](_0x40e2c1,function(_0x136f8c){if(_0x136f8c[_0x8b99('0x3d')]!==_0x8b99('0x3e')){var _0xcc9a69={};_0xcc9a69[_0x136f8c['name']]={'$like':'%'+_0x2c4bd7[_0x8b99('0x2f')][_0x8b99('0x3b')]+'%'};return _0xcc9a69;}})});}_0x39d65c=_['merge']({},_0x39d65c,_0x2c4bd7[_0x8b99('0x3f')]);var _0xb4c29a={'where':_0x39d65c['where']};return db[_0x8b99('0x2b')][_0x8b99('0x1e')](_0xb4c29a)['then'](function(_0x55f07f){_0x495473[_0x8b99('0x1e')]=_0x55f07f;if(_0x2c4bd7[_0x8b99('0x2f')]['includeAll']){_0x39d65c[_0x8b99('0x40')]=[{'all':!![]}];}return db[_0x8b99('0x2b')][_0x8b99('0x41')](_0x39d65c);})[_0x8b99('0x25')](function(_0x523635){_0x495473[_0x8b99('0x42')]=_0x523635;return _0x495473;})[_0x8b99('0x25')](respondWithFilteredResult(_0x483584,_0x39d65c))[_0x8b99('0x43')](handleError(_0x483584,null));};exports['show']=function(_0x5d7331,_0x720a50){var _0x423fee={'raw':![],'where':{'id':_0x5d7331['params']['id']}},_0x374c19={};_0x374c19[_0x8b99('0x2e')]=_['keys'](db[_0x8b99('0x2b')][_0x8b99('0x44')]);_0x374c19['query']=_['keys'](_0x5d7331[_0x8b99('0x2f')]);_0x374c19[_0x8b99('0x31')]=_['intersection'](_0x374c19[_0x8b99('0x2e')],_0x374c19[_0x8b99('0x2f')]);_0x423fee['attributes']=_[_0x8b99('0x32')](_0x374c19[_0x8b99('0x2e')],qs[_0x8b99('0x34')](_0x5d7331['query']['fields']));_0x423fee[_0x8b99('0x33')]=_0x423fee[_0x8b99('0x33')]['length']?_0x423fee[_0x8b99('0x33')]:_0x374c19[_0x8b99('0x2e')];if(_0x5d7331[_0x8b99('0x2f')][_0x8b99('0x45')]){_0x423fee['include']=[{'all':!![]}];}_0x423fee=_[_0x8b99('0x3c')]({},_0x423fee,_0x5d7331['options']);return db['SugarcrmAccount'][_0x8b99('0x46')](_0x423fee)[_0x8b99('0x25')](handleEntityNotFound(_0x720a50,null))[_0x8b99('0x25')](respondWithResult(_0x720a50,null))[_0x8b99('0x43')](handleError(_0x720a50,null));};exports[_0x8b99('0x47')]=function(_0x1d0756,_0x4df780){return db[_0x8b99('0x2b')][_0x8b99('0x47')](_0x1d0756['body'],{})['then'](respondWithResult(_0x4df780,0xc9))[_0x8b99('0x43')](handleError(_0x4df780,null));};exports[_0x8b99('0x24')]=function(_0x112f41,_0x331b33){if(_0x112f41[_0x8b99('0x48')]['id']){delete _0x112f41[_0x8b99('0x48')]['id'];}return db['SugarcrmAccount']['find']({'where':{'id':_0x112f41['params']['id']}})[_0x8b99('0x25')](handleEntityNotFound(_0x331b33,null))['then'](saveUpdates(_0x112f41[_0x8b99('0x48')],null))['then'](respondWithResult(_0x331b33,null))[_0x8b99('0x43')](handleError(_0x331b33,null));};exports['destroy']=function(_0x3063a8,_0x28422e){return db[_0x8b99('0x2b')][_0x8b99('0x46')]({'where':{'id':_0x3063a8[_0x8b99('0x49')]['id']}})[_0x8b99('0x25')](handleEntityNotFound(_0x28422e,null))[_0x8b99('0x25')](removeEntity(_0x28422e,null))[_0x8b99('0x43')](handleError(_0x28422e,null));};exports[_0x8b99('0x4a')]=function(_0x1baf9c,_0x3867d1,_0x15cb35){var _0x561225={};var _0x2274ab={};var _0x4c83c3;var _0x477092;return db[_0x8b99('0x2b')][_0x8b99('0x4b')]({'where':{'id':_0x1baf9c[_0x8b99('0x49')]['id']}})[_0x8b99('0x25')](handleEntityNotFound(_0x3867d1,null))[_0x8b99('0x25')](function(_0x361c54){if(_0x361c54){_0x4c83c3=_0x361c54;_0x2274ab[_0x8b99('0x2e')]=_[_0x8b99('0x30')](db[_0x8b99('0x4c')][_0x8b99('0x44')]);_0x2274ab['query']=_['keys'](_0x1baf9c[_0x8b99('0x2f')]);_0x2274ab[_0x8b99('0x31')]=_[_0x8b99('0x32')](_0x2274ab[_0x8b99('0x2e')],_0x2274ab[_0x8b99('0x2f')]);_0x561225[_0x8b99('0x33')]=_[_0x8b99('0x32')](_0x2274ab[_0x8b99('0x2e')],qs[_0x8b99('0x34')](_0x1baf9c[_0x8b99('0x2f')][_0x8b99('0x34')]));_0x561225[_0x8b99('0x33')]=_0x561225[_0x8b99('0x33')]['length']?_0x561225[_0x8b99('0x33')]:_0x2274ab[_0x8b99('0x2e')];_0x561225[_0x8b99('0x37')]=qs['sort'](_0x1baf9c[_0x8b99('0x2f')][_0x8b99('0x38')]);_0x561225[_0x8b99('0x39')]=qs[_0x8b99('0x31')](_[_0x8b99('0x3a')](_0x1baf9c[_0x8b99('0x2f')],_0x2274ab[_0x8b99('0x31')]));if(_0x1baf9c[_0x8b99('0x2f')]['filter']){_0x561225['where']=_[_0x8b99('0x3c')](_0x561225[_0x8b99('0x39')],{'$or':_[_0x8b99('0x2a')](_0x561225[_0x8b99('0x33')],function(_0x20e8d6){var _0x3de6f6={};_0x3de6f6[_0x20e8d6]={'$like':'%'+_0x1baf9c[_0x8b99('0x2f')][_0x8b99('0x3b')]+'%'};return _0x3de6f6;})});}_0x561225=_[_0x8b99('0x3c')]({},_0x561225,_0x1baf9c['options']);return _0x4c83c3[_0x8b99('0x4a')](_0x561225);}})['then'](function(_0x50dd72){if(_0x50dd72){_0x477092=_0x50dd72[_0x8b99('0x4d')];if(!_0x1baf9c[_0x8b99('0x2f')][_0x8b99('0x35')]('nolimit')){_0x561225[_0x8b99('0x1b')]=qs[_0x8b99('0x1b')](_0x1baf9c[_0x8b99('0x2f')]['limit']);_0x561225[_0x8b99('0x1d')]=qs[_0x8b99('0x1d')](_0x1baf9c[_0x8b99('0x2f')][_0x8b99('0x1d')]);}return _0x4c83c3[_0x8b99('0x4a')](_0x561225);}})[_0x8b99('0x25')](function(_0x5c993d){if(_0x5c993d){return _0x5c993d?{'count':_0x477092,'rows':_0x5c993d}:null;}})[_0x8b99('0x25')](respondWithResult(_0x3867d1,null))[_0x8b99('0x43')](handleError(_0x3867d1,null));};exports[_0x8b99('0x4e')]=function(_0x18b380,_0xc3a066,_0x4f9af8){if(_0x18b380['body']['id']){delete _0x18b380[_0x8b99('0x48')]['id'];}return db['SugarcrmAccount'][_0x8b99('0x4b')]({'where':{'id':_0x18b380[_0x8b99('0x49')]['id']}})[_0x8b99('0x25')](handleEntityNotFound(_0xc3a066,null))[_0x8b99('0x25')](function(_0x526e87){if(_0x526e87){_0x18b380[_0x8b99('0x48')][_0x8b99('0x4f')]=_0x526e87['id'];_0x18b380[_0x8b99('0x48')][_0x8b99('0x50')]=integrations[_0x8b99('0x51')](_0x18b380[_0x8b99('0x48')][_0x8b99('0x52')],_0x18b380[_0x8b99('0x48')][_0x8b99('0x3d')]);_0x18b380[_0x8b99('0x48')][_0x8b99('0x53')]=integrations['getDescriptions'](_0x18b380[_0x8b99('0x48')][_0x8b99('0x52')],_0x18b380[_0x8b99('0x48')][_0x8b99('0x3d')]);return db[_0x8b99('0x4c')][_0x8b99('0x47')](_0x18b380[_0x8b99('0x48')],{'include':[{'model':db['SugarcrmField'],'as':_0x8b99('0x50')},{'model':db[_0x8b99('0x54')],'as':_0x8b99('0x53')}]});}return null;})['then'](respondWithResult(_0xc3a066,null))['catch'](handleError(_0xc3a066,null));};exports[_0x8b99('0x55')]=function(_0x15a6e1,_0x178831,_0x4b2e4d){var _0x5f451d='';var _0x14711b=['id','name',_0x8b99('0x56'),_0x8b99('0x57'),'description',_0x8b99('0x58'),_0x8b99('0x59'),_0x8b99('0x5a'),_0x8b99('0x5b'),_0x8b99('0x5c'),'parent_name','direction'];return db[_0x8b99('0x2b')][_0x8b99('0x4b')]({'where':{'id':_0x15a6e1[_0x8b99('0x49')]['id']},'attributes':['id',_0x8b99('0x5d'),'password',_0x8b99('0x5e')]})[_0x8b99('0x25')](handleEntityNotFound(_0x178831,null))['then'](function(_0x57378){if(_0x57378){_0x5f451d=_0x57378[_0x8b99('0x5e')];var _0x5b08af=_0x5f451d[_0x8b99('0x5f')](-0x1);if(_0x5b08af==='/'){_0x5f451d=_0x5f451d[_0x8b99('0x60')](0x0,_0x5f451d[_0x8b99('0x61')](_0x5b08af));}return rp({'method':'POST','uri':util[_0x8b99('0x62')](_0x8b99('0x63'),_0x5f451d,_0x8b99('0x64')),'json':!![],'form':{'method':'login','input_type':_0x8b99('0x65'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x57378[_0x8b99('0x5d')],'password':_0x57378[_0x8b99('0x66')],'encryption':_0x8b99('0x67')},'application':_0x8b99('0x68')})}});}})[_0x8b99('0x25')](function(_0x10a269){if(_0x10a269&&_0x10a269[_0x8b99('0x28')]!==_0x8b99('0x69')&&_0x10a269[_0x8b99('0x28')]!==_0x8b99('0x6a')){return rp({'method':_0x8b99('0x6b'),'uri':util['format'](_0x8b99('0x63'),_0x5f451d,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'get_module_fields','input_type':_0x8b99('0x65'),'response_type':'JSON','rest_data':JSON[_0x8b99('0x6c')]({'session':_0x10a269['id'],'module_name':_0x8b99('0x6d')})}})[_0x8b99('0x25')](function(_0x4efbae){if(_0x4efbae){var _0x12abc2=_[_0x8b99('0x6e')](_0x4efbae['module_fields']);_[_0x8b99('0x6f')](_0x12abc2,function(_0x3b56bb){return _0x14711b[_0x8b99('0x70')](_0x3b56bb[_0x8b99('0x28')]);});return{'count':_0x12abc2[_0x8b99('0x4d')],'rows':_[_0x8b99('0x2a')](_0x12abc2,function(_0x31e574){return{'id':_0x31e574['name'],'name':_0x31e574['label'],'custom':_[_0x8b99('0x71')](_0x31e574['name'],'_c')?!![]:![],'options':_0x31e574[_0x8b99('0x3f')]?_['map'](_[_0x8b99('0x6e')](_0x31e574[_0x8b99('0x3f')]),function(_0x13330d){return{'name':_0x13330d[_0x8b99('0x72')],'value':_0x13330d[_0x8b99('0x28')]};}):[]};})};}})[_0x8b99('0x25')](respondWithResult(_0x178831,null))[_0x8b99('0x43')](function(_0x359668){var _0xd38dbc=_0x15a6e1['query'][_0x8b99('0x73')]?0x1f4:_0x359668[_0x8b99('0x74')]||0x1f4;logger['error'](_0x8b99('0x75'),_0x8b99('0x55'),_0xd38dbc,JSON['stringify'](_0x359668));delete _0x359668[_0x8b99('0x28')];if(_0xd38dbc===0x191){_0xd38dbc=0x190;}_0x178831['status'](_0xd38dbc)[_0x8b99('0x76')](_0x15a6e1[_0x8b99('0x2f')][_0x8b99('0x73')]?{'message':_0x8b99('0x77'),'statusCode':_0x359668['statusCode']}:_0x359668);});}else{var _0x15c469=0x1f4;_0x178831[_0x8b99('0x19')](_0x15c469)[_0x8b99('0x76')]({'message':_0x8b99('0x77'),'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 f38e4a5..fdf3f50 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 _0x6eb9=['define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x3cdf6a,_0x18e467){var _0x3b3337=function(_0xa838c9){while(--_0xa838c9){_0x3cdf6a['push'](_0x3cdf6a['shift']());}};_0x3b3337(++_0x18e467);}(_0x6eb9,0x1ed));var _0x96eb=function(_0x1f45e5,_0x568b84){_0x1f45e5=_0x1f45e5-0x0;var _0xcb83ff=_0x6eb9[_0x1f45e5];return _0xcb83ff;};'use strict';var _=require(_0x96eb('0x0'));var util=require(_0x96eb('0x1'));var logger=require('../../config/logger')(_0x96eb('0x2'));var moment=require(_0x96eb('0x3'));var BPromise=require('bluebird');var rp=require(_0x96eb('0x4'));var fs=require('fs');var path=require(_0x96eb('0x5'));var rimraf=require(_0x96eb('0x6'));var config=require(_0x96eb('0x7'));var attributes=require(_0x96eb('0x8'));var integrations=require(_0x96eb('0x9'));module[_0x96eb('0xa')]=function(_0x32842d,_0x1321c4){return _0x32842d[_0x96eb('0xb')](_0x96eb('0xc'),attributes,{'tableName':_0x96eb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9072=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x9072,0x169));var _0x2907=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9072[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2907('0x0'));var util=require(_0x2907('0x1'));var logger=require(_0x2907('0x2'))(_0x2907('0x3'));var moment=require(_0x2907('0x4'));var BPromise=require(_0x2907('0x5'));var rp=require(_0x2907('0x6'));var fs=require('fs');var path=require(_0x2907('0x7'));var rimraf=require(_0x2907('0x8'));var config=require(_0x2907('0x9'));var attributes=require(_0x2907('0xa'));var integrations=require(_0x2907('0xb'));module['exports']=function(_0x4c0b1c,_0x15d1a0){return _0x4c0b1c['define'](_0x2907('0xc'),attributes,{'tableName':_0x2907('0xd'),'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 938245d..3ced710 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 _0x4bb8=['find','ShowSugarcrmAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','options','raw','where','limit','include','map','model','attributes'];(function(_0xae2bfe,_0x2f45b9){var _0x167f73=function(_0x571f45){while(--_0x571f45){_0xae2bfe['push'](_0xae2bfe['shift']());}};_0x167f73(++_0x2f45b9);}(_0x4bb8,0xd4));var _0x84bb=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x4bb8[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x84bb('0x0'));var util=require('util');var moment=require(_0x84bb('0x1'));var BPromise=require(_0x84bb('0x2'));var rs=require(_0x84bb('0x3'));var fs=require('fs');var Redis=require(_0x84bb('0x4'));var db=require(_0x84bb('0x5'))['db'];var utils=require(_0x84bb('0x6'));var logger=require(_0x84bb('0x7'))(_0x84bb('0x8'));var config=require(_0x84bb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x84bb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x139bd8,_0xa4599a,_0x2340d1){return new BPromise(function(_0x2e6873,_0x27fb6a){return client['request'](_0x139bd8,_0x2340d1)[_0x84bb('0xb')](function(_0xb0b4da){logger[_0x84bb('0xc')](_0x84bb('0xd'),_0xa4599a,_0x84bb('0xe'));logger[_0x84bb('0xf')](_0x84bb('0x10'),_0xa4599a,_0x84bb('0xe'),JSON[_0x84bb('0x11')](_0xb0b4da));if(_0xb0b4da['error']){if(_0xb0b4da[_0x84bb('0x12')][_0x84bb('0x13')]===0x1f4){logger[_0x84bb('0x12')](_0x84bb('0xd'),_0xa4599a,_0xb0b4da[_0x84bb('0x12')]['message']);return _0x27fb6a(_0xb0b4da[_0x84bb('0x12')][_0x84bb('0x14')]);}logger[_0x84bb('0x12')](_0x84bb('0xd'),_0xa4599a,_0xb0b4da[_0x84bb('0x12')][_0x84bb('0x14')]);return _0x2e6873(_0xb0b4da[_0x84bb('0x12')][_0x84bb('0x14')]);}else{logger[_0x84bb('0xc')](_0x84bb('0xd'),_0xa4599a,_0x84bb('0xe'));_0x2e6873(_0xb0b4da[_0x84bb('0x15')][_0x84bb('0x14')]);}})[_0x84bb('0x16')](function(_0x59dc4a){logger[_0x84bb('0x12')](_0x84bb('0xd'),_0xa4599a,_0x59dc4a);_0x27fb6a(_0x59dc4a);});});}exports[_0x84bb('0x17')]=function(_0x4720d7){var _0x31d142=this;return new Promise(function(_0x5abbe8,_0x364f61){return db[_0x84bb('0x18')]['findAll']({'raw':_0x4720d7[_0x84bb('0x19')]?_0x4720d7[_0x84bb('0x19')][_0x84bb('0x1a')]===undefined?!![]:![]:!![],'where':_0x4720d7[_0x84bb('0x19')]?_0x4720d7['options'][_0x84bb('0x1b')]||null:null,'attributes':_0x4720d7['options']?_0x4720d7[_0x84bb('0x19')]['attributes']||null:null,'limit':_0x4720d7[_0x84bb('0x19')]?_0x4720d7[_0x84bb('0x19')][_0x84bb('0x1c')]||null:null,'include':_0x4720d7[_0x84bb('0x19')]?_0x4720d7['options'][_0x84bb('0x1d')]?_[_0x84bb('0x1e')](_0x4720d7[_0x84bb('0x19')][_0x84bb('0x1d')],function(_0x3cb548){return{'model':db[_0x3cb548[_0x84bb('0x1f')]],'as':_0x3cb548['as'],'attributes':_0x3cb548['attributes'],'include':_0x3cb548['include']?_[_0x84bb('0x1e')](_0x3cb548[_0x84bb('0x1d')],function(_0x2e48da){return{'model':db[_0x2e48da['model']],'as':_0x2e48da['as'],'attributes':_0x2e48da[_0x84bb('0x20')],'include':_0x2e48da[_0x84bb('0x1d')]?_['map'](_0x2e48da[_0x84bb('0x1d')],function(_0x318319){return{'model':db[_0x318319[_0x84bb('0x1f')]],'as':_0x318319['as'],'attributes':_0x318319[_0x84bb('0x20')]};}):[]};}):[]};}):[]:[]})[_0x84bb('0xb')](function(_0x5772d8){logger[_0x84bb('0xc')](_0x84bb('0x17'),_0x4720d7);logger['debug'](_0x84bb('0x17'),_0x4720d7,JSON[_0x84bb('0x11')](_0x5772d8));_0x5abbe8(_0x5772d8);})['catch'](function(_0x407e05){logger[_0x84bb('0x12')](_0x84bb('0x17'),_0x407e05[_0x84bb('0x14')],_0x4720d7);_0x364f61(_0x31d142['error'](0x1f4,_0x407e05['message']));});});};exports['ShowSugarcrmAccount']=function(_0x15cbfa){var _0xdbfea9=this;return new Promise(function(_0x1474cb,_0x1ef4a5){return db['SugarcrmAccount'][_0x84bb('0x21')]({'raw':_0x15cbfa['options']?_0x15cbfa['options'][_0x84bb('0x1a')]===undefined?!![]:![]:!![],'where':_0x15cbfa['options']?_0x15cbfa['options'][_0x84bb('0x1b')]||null:null,'attributes':_0x15cbfa[_0x84bb('0x19')]?_0x15cbfa[_0x84bb('0x19')][_0x84bb('0x20')]||null:null,'include':_0x15cbfa['options']?_0x15cbfa['options']['include']?_[_0x84bb('0x1e')](_0x15cbfa[_0x84bb('0x19')][_0x84bb('0x1d')],function(_0x5ef674){return{'model':db[_0x5ef674[_0x84bb('0x1f')]],'as':_0x5ef674['as'],'attributes':_0x5ef674[_0x84bb('0x20')],'include':_0x5ef674[_0x84bb('0x1d')]?_['map'](_0x5ef674[_0x84bb('0x1d')],function(_0x1ebe3d){return{'model':db[_0x1ebe3d[_0x84bb('0x1f')]],'as':_0x1ebe3d['as'],'attributes':_0x1ebe3d[_0x84bb('0x20')],'include':_0x1ebe3d[_0x84bb('0x1d')]?_[_0x84bb('0x1e')](_0x1ebe3d[_0x84bb('0x1d')],function(_0x37b069){return{'model':db[_0x37b069[_0x84bb('0x1f')]],'as':_0x37b069['as'],'attributes':_0x37b069[_0x84bb('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf49252){logger[_0x84bb('0xc')](_0x84bb('0x22'),_0x15cbfa);logger[_0x84bb('0xf')](_0x84bb('0x22'),_0x15cbfa,JSON[_0x84bb('0x11')](_0xf49252));_0x1474cb(_0xf49252);})[_0x84bb('0x16')](function(_0x182e06){logger[_0x84bb('0x12')](_0x84bb('0x22'),_0x182e06[_0x84bb('0x14')],_0x15cbfa);_0x1ef4a5(_0xdbfea9[_0x84bb('0x12')](0x1f4,_0x182e06[_0x84bb('0x14')]));});});}; \ No newline at end of file +var _0xaf1b=['options','raw','where','attributes','include','model','map','then','debug','ShowSugarcrmAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetSugarcrmAccount','SugarcrmAccount'];(function(_0x577da1,_0x3ea086){var _0x5a5a6e=function(_0x371459){while(--_0x371459){_0x577da1['push'](_0x577da1['shift']());}};_0x5a5a6e(++_0x3ea086);}(_0xaf1b,0x1f4));var _0xbaf1=function(_0x555fd0,_0x2c6596){_0x555fd0=_0x555fd0-0x0;var _0xaa6595=_0xaf1b[_0x555fd0];return _0xaa6595;};'use strict';var _=require(_0xbaf1('0x0'));var util=require(_0xbaf1('0x1'));var moment=require(_0xbaf1('0x2'));var BPromise=require(_0xbaf1('0x3'));var rs=require(_0xbaf1('0x4'));var fs=require('fs');var Redis=require(_0xbaf1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbaf1('0x6'));var logger=require(_0xbaf1('0x7'))(_0xbaf1('0x8'));var config=require(_0xbaf1('0x9'));var jayson=require(_0xbaf1('0xa'));var client=jayson[_0xbaf1('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19e0b4,_0xf6443c,_0x2d7014){return new BPromise(function(_0x4bd8bc,_0x56bf4d){return client[_0xbaf1('0xc')](_0x19e0b4,_0x2d7014)['then'](function(_0x406426){logger[_0xbaf1('0xd')](_0xbaf1('0xe'),_0xf6443c,_0xbaf1('0xf'));logger['debug'](_0xbaf1('0x10'),_0xf6443c,_0xbaf1('0xf'),JSON[_0xbaf1('0x11')](_0x406426));if(_0x406426['error']){if(_0x406426['error'][_0xbaf1('0x12')]===0x1f4){logger['error'](_0xbaf1('0xe'),_0xf6443c,_0x406426[_0xbaf1('0x13')][_0xbaf1('0x14')]);return _0x56bf4d(_0x406426[_0xbaf1('0x13')]['message']);}logger[_0xbaf1('0x13')](_0xbaf1('0xe'),_0xf6443c,_0x406426['error'][_0xbaf1('0x14')]);return _0x4bd8bc(_0x406426['error'][_0xbaf1('0x14')]);}else{logger[_0xbaf1('0xd')](_0xbaf1('0xe'),_0xf6443c,_0xbaf1('0xf'));_0x4bd8bc(_0x406426[_0xbaf1('0x15')]['message']);}})[_0xbaf1('0x16')](function(_0x293aeb){logger[_0xbaf1('0x13')](_0xbaf1('0xe'),_0xf6443c,_0x293aeb);_0x56bf4d(_0x293aeb);});});}exports[_0xbaf1('0x17')]=function(_0x56c38f){var _0x68dd1a=this;return new Promise(function(_0x54b4bb,_0x3362cc){return db[_0xbaf1('0x18')]['findAll']({'raw':_0x56c38f[_0xbaf1('0x19')]?_0x56c38f[_0xbaf1('0x19')][_0xbaf1('0x1a')]===undefined?!![]:![]:!![],'where':_0x56c38f['options']?_0x56c38f[_0xbaf1('0x19')][_0xbaf1('0x1b')]||null:null,'attributes':_0x56c38f[_0xbaf1('0x19')]?_0x56c38f[_0xbaf1('0x19')][_0xbaf1('0x1c')]||null:null,'limit':_0x56c38f['options']?_0x56c38f['options']['limit']||null:null,'include':_0x56c38f[_0xbaf1('0x19')]?_0x56c38f['options'][_0xbaf1('0x1d')]?_['map'](_0x56c38f[_0xbaf1('0x19')][_0xbaf1('0x1d')],function(_0x597200){return{'model':db[_0x597200[_0xbaf1('0x1e')]],'as':_0x597200['as'],'attributes':_0x597200[_0xbaf1('0x1c')],'include':_0x597200[_0xbaf1('0x1d')]?_[_0xbaf1('0x1f')](_0x597200[_0xbaf1('0x1d')],function(_0x5ddc39){return{'model':db[_0x5ddc39[_0xbaf1('0x1e')]],'as':_0x5ddc39['as'],'attributes':_0x5ddc39['attributes'],'include':_0x5ddc39[_0xbaf1('0x1d')]?_[_0xbaf1('0x1f')](_0x5ddc39['include'],function(_0x129fd2){return{'model':db[_0x129fd2[_0xbaf1('0x1e')]],'as':_0x129fd2['as'],'attributes':_0x129fd2[_0xbaf1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xbaf1('0x20')](function(_0x5f23d9){logger[_0xbaf1('0xd')]('GetSugarcrmAccount',_0x56c38f);logger[_0xbaf1('0x21')](_0xbaf1('0x17'),_0x56c38f,JSON[_0xbaf1('0x11')](_0x5f23d9));_0x54b4bb(_0x5f23d9);})[_0xbaf1('0x16')](function(_0x38e734){logger[_0xbaf1('0x13')](_0xbaf1('0x17'),_0x38e734['message'],_0x56c38f);_0x3362cc(_0x68dd1a[_0xbaf1('0x13')](0x1f4,_0x38e734[_0xbaf1('0x14')]));});});};exports['ShowSugarcrmAccount']=function(_0x1fabc8){var _0x41ab87=this;return new Promise(function(_0x5e0fd9,_0x499215){return db[_0xbaf1('0x18')]['find']({'raw':_0x1fabc8['options']?_0x1fabc8[_0xbaf1('0x19')][_0xbaf1('0x1a')]===undefined?!![]:![]:!![],'where':_0x1fabc8[_0xbaf1('0x19')]?_0x1fabc8[_0xbaf1('0x19')]['where']||null:null,'attributes':_0x1fabc8[_0xbaf1('0x19')]?_0x1fabc8[_0xbaf1('0x19')][_0xbaf1('0x1c')]||null:null,'include':_0x1fabc8[_0xbaf1('0x19')]?_0x1fabc8[_0xbaf1('0x19')][_0xbaf1('0x1d')]?_[_0xbaf1('0x1f')](_0x1fabc8[_0xbaf1('0x19')][_0xbaf1('0x1d')],function(_0x334a1d){return{'model':db[_0x334a1d[_0xbaf1('0x1e')]],'as':_0x334a1d['as'],'attributes':_0x334a1d['attributes'],'include':_0x334a1d[_0xbaf1('0x1d')]?_['map'](_0x334a1d['include'],function(_0x46b083){return{'model':db[_0x46b083[_0xbaf1('0x1e')]],'as':_0x46b083['as'],'attributes':_0x46b083[_0xbaf1('0x1c')],'include':_0x46b083[_0xbaf1('0x1d')]?_['map'](_0x46b083[_0xbaf1('0x1d')],function(_0x4b11a2){return{'model':db[_0x4b11a2[_0xbaf1('0x1e')]],'as':_0x4b11a2['as'],'attributes':_0x4b11a2[_0xbaf1('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e21c2){logger[_0xbaf1('0xd')]('ShowSugarcrmAccount',_0x1fabc8);logger[_0xbaf1('0x21')]('ShowSugarcrmAccount',_0x1fabc8,JSON[_0xbaf1('0x11')](_0x2e21c2));_0x5e0fd9(_0x2e21c2);})[_0xbaf1('0x16')](function(_0x583bbc){logger[_0xbaf1('0x13')](_0xbaf1('0x22'),_0x583bbc[_0xbaf1('0x14')],_0x1fabc8);_0x499215(_0x41ab87[_0xbaf1('0x13')](0x1f4,_0x583bbc[_0xbaf1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 37e2a49..85521b9 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 _0x88d9=['get','/:id','/:id/fields','getFields','/:id/subjects','isAuthenticated','getDescriptions','put','update','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','index'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x88d9,0x15e));var _0x988d=function(_0x32687b,_0x5a9d8c){_0x32687b=_0x32687b-0x0;var _0x47a37f=_0x88d9[_0x32687b];return _0x47a37f;};'use strict';var multer=require('multer');var util=require(_0x988d('0x0'));var path=require(_0x988d('0x1'));var timeout=require(_0x988d('0x2'));var express=require(_0x988d('0x3'));var router=express[_0x988d('0x4')]();var fs_extra=require(_0x988d('0x5'));var auth=require(_0x988d('0x6'));var interaction=require(_0x988d('0x7'));var config=require('../../config/environment');var controller=require(_0x988d('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x988d('0x9')]);router[_0x988d('0xa')](_0x988d('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x988d('0xa')](_0x988d('0xc'),auth['isAuthenticated'](),controller[_0x988d('0xd')]);router[_0x988d('0xa')](_0x988d('0xe'),auth[_0x988d('0xf')](),controller['getSubjects']);router[_0x988d('0xa')]('/:id/descriptions',auth[_0x988d('0xf')](),controller[_0x988d('0x10')]);router['post']('/',auth[_0x988d('0xf')](),controller['create']);router[_0x988d('0x11')]('/:id',auth[_0x988d('0xf')](),controller[_0x988d('0x12')]);router['delete'](_0x988d('0xb'),auth['isAuthenticated'](),controller[_0x988d('0x13')]);module['exports']=router; \ No newline at end of file +var _0x3e2a=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','/:id/descriptions','post','create','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x8afdd0,_0x548ad1){var _0x3de7ac=function(_0x2dc2c4){while(--_0x2dc2c4){_0x8afdd0['push'](_0x8afdd0['shift']());}};_0x3de7ac(++_0x548ad1);}(_0x3e2a,0x10c));var _0xa3e2=function(_0xe9e1a,_0x3b0917){_0xe9e1a=_0xe9e1a-0x0;var _0x1f2005=_0x3e2a[_0xe9e1a];return _0x1f2005;};'use strict';var multer=require(_0xa3e2('0x0'));var util=require(_0xa3e2('0x1'));var path=require(_0xa3e2('0x2'));var timeout=require(_0xa3e2('0x3'));var express=require(_0xa3e2('0x4'));var router=express[_0xa3e2('0x5')]();var fs_extra=require(_0xa3e2('0x6'));var auth=require(_0xa3e2('0x7'));var interaction=require(_0xa3e2('0x8'));var config=require('../../config/environment');var controller=require(_0xa3e2('0x9'));router['get']('/',auth[_0xa3e2('0xa')](),controller[_0xa3e2('0xb')]);router[_0xa3e2('0xc')](_0xa3e2('0xd'),auth[_0xa3e2('0xa')](),controller['show']);router[_0xa3e2('0xc')](_0xa3e2('0xe'),auth['isAuthenticated'](),controller[_0xa3e2('0xf')]);router[_0xa3e2('0xc')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xa3e2('0xc')](_0xa3e2('0x10'),auth[_0xa3e2('0xa')](),controller['getDescriptions']);router[_0xa3e2('0x11')]('/',auth[_0xa3e2('0xa')](),controller[_0xa3e2('0x12')]);router['put'](_0xa3e2('0xd'),auth[_0xa3e2('0xa')](),controller['update']);router[_0xa3e2('0x13')](_0xa3e2('0xd'),auth['isAuthenticated'](),controller[_0xa3e2('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index c5008bf..54028d4 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 _0xa0f1=['exports','STRING'];(function(_0x22d7e6,_0xa620e7){var _0x72bc58=function(_0x2c75f6){while(--_0x2c75f6){_0x22d7e6['push'](_0x22d7e6['shift']());}};_0x72bc58(++_0xa620e7);}(_0xa0f1,0xae));var _0x1a0f=function(_0x14e077,_0x2fdb43){_0x14e077=_0x14e077-0x0;var _0xf7f0e5=_0xa0f1[_0x14e077];return _0xf7f0e5;};'use strict';var Sequelize=require('sequelize');module[_0x1a0f('0x0')]={'name':{'type':Sequelize[_0x1a0f('0x1')]},'description':{'type':Sequelize[_0x1a0f('0x1')]}}; \ No newline at end of file +var _0xe673=['exports'];(function(_0x69d55,_0x1dda1e){var _0x38c82e=function(_0x1a1260){while(--_0x1a1260){_0x69d55['push'](_0x69d55['shift']());}};_0x38c82e(++_0x1dda1e);}(_0xe673,0x156));var _0x3e67=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe673[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require('sequelize');module[_0x3e67('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index f498a0c..86c51eb 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 _0x4c26=['catch','create','body','update','find','params','getFields','SugarcrmField','getSubjects','findOne','getDescriptions','pick','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','query','keys','attributes','intersection','model','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','include','findAll','show','length'];(function(_0x307086,_0x3bfe4e){var _0x699043=function(_0x1a7677){while(--_0x1a7677){_0x307086['push'](_0x307086['shift']());}};_0x699043(++_0x3bfe4e);}(_0x4c26,0x1a1));var _0x64c2=function(_0x528570,_0x133134){_0x528570=_0x528570-0x0;var _0x2280fe=_0x4c26[_0x528570];return _0x2280fe;};'use strict';var emlformat=require(_0x64c2('0x0'));var rimraf=require(_0x64c2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x64c2('0x2'));var rp=require(_0x64c2('0x3'));var moment=require(_0x64c2('0x4'));var BPromise=require(_0x64c2('0x5'));var Mustache=require(_0x64c2('0x6'));var util=require(_0x64c2('0x7'));var path=require(_0x64c2('0x8'));var sox=require(_0x64c2('0x9'));var csv=require(_0x64c2('0xa'));var ejs=require(_0x64c2('0xb'));var fs=require('fs');var fs_extra=require(_0x64c2('0xc'));var _=require(_0x64c2('0xd'));var squel=require('squel');var crypto=require(_0x64c2('0xe'));var jsforce=require(_0x64c2('0xf'));var deskjs=require(_0x64c2('0x10'));var toCsv=require(_0x64c2('0xa'));var querystring=require(_0x64c2('0x11'));var Papa=require(_0x64c2('0x12'));var Redis=require('ioredis');var authService=require(_0x64c2('0x13'));var qs=require(_0x64c2('0x14'));var as=require(_0x64c2('0x15'));var hardwareService=require(_0x64c2('0x16'));var logger=require(_0x64c2('0x17'))(_0x64c2('0x18'));var utils=require(_0x64c2('0x19'));var config=require(_0x64c2('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5edc0d,_0x209654){_0x209654=_0x209654||0xcc;return function(_0x3346be){if(_0x3346be){return _0x5edc0d['sendStatus'](_0x209654);}return _0x5edc0d['status'](_0x209654)[_0x64c2('0x1b')]();};}function respondWithResult(_0x477070,_0x21c31e){_0x21c31e=_0x21c31e||0xc8;return function(_0x45f3f2){if(_0x45f3f2){return _0x477070[_0x64c2('0x1c')](_0x21c31e)[_0x64c2('0x1d')](_0x45f3f2);}};}function respondWithFilteredResult(_0x127790,_0x325d9e){return function(_0x54195b){if(_0x54195b){var _0x4f0fbc=typeof _0x325d9e[_0x64c2('0x1e')]===_0x64c2('0x1f')&&typeof _0x325d9e[_0x64c2('0x20')]===_0x64c2('0x1f');var _0x332582=_0x54195b[_0x64c2('0x21')];var _0x1fe812=_0x4f0fbc?0x0:_0x325d9e[_0x64c2('0x1e')];var _0x299b92=_0x4f0fbc?_0x54195b[_0x64c2('0x21')]:_0x325d9e[_0x64c2('0x1e')]+_0x325d9e[_0x64c2('0x20')];var _0x9feb38;if(_0x299b92>=_0x332582){_0x299b92=_0x332582;_0x9feb38=0xc8;}else{_0x9feb38=0xce;}_0x127790[_0x64c2('0x1c')](_0x9feb38);return _0x127790[_0x64c2('0x22')](_0x64c2('0x23'),_0x1fe812+'-'+_0x299b92+'/'+_0x332582)[_0x64c2('0x1d')](_0x54195b);}return null;};}function patchUpdates(_0xc5af24){return function(_0x343e1e){try{jsonpatch[_0x64c2('0x24')](_0x343e1e,_0xc5af24,!![]);}catch(_0x4031c2){return BPromise['reject'](_0x4031c2);}return _0x343e1e[_0x64c2('0x25')]();};}function saveUpdates(_0x346985,_0x3956c1){return function(_0x58f71d){if(_0x58f71d){return _0x58f71d['update'](_0x346985)[_0x64c2('0x26')](function(_0x2da89f){return _0x2da89f;});}return null;};}function removeEntity(_0x43f624,_0xab6659){return function(_0x16cd5c){if(_0x16cd5c){return _0x16cd5c[_0x64c2('0x27')]()['then'](function(){_0x43f624[_0x64c2('0x1c')](0xcc)[_0x64c2('0x1b')]();});}};}function handleEntityNotFound(_0x24897d,_0x329145){return function(_0x16d736){if(!_0x16d736){_0x24897d[_0x64c2('0x28')](0x194);}return _0x16d736;};}function handleError(_0x215237,_0xf52d88){_0xf52d88=_0xf52d88||0x1f4;return function(_0x20c593){logger['error'](_0x20c593['stack']);if(_0x20c593[_0x64c2('0x29')]){delete _0x20c593[_0x64c2('0x29')];}_0x215237[_0x64c2('0x1c')](_0xf52d88)[_0x64c2('0x2a')](_0x20c593);};}exports[_0x64c2('0x2b')]=function(_0x36701f,_0x560931){var _0x3c9d84={},_0x46ffd5={},_0x2564c3={'count':0x0,'rows':[]};var _0x365f8b=_[_0x64c2('0x2c')](db[_0x64c2('0x2d')][_0x64c2('0x2e')],function(_0x298be7){return{'name':_0x298be7[_0x64c2('0x2f')],'type':_0x298be7['type']['key']};});_0x46ffd5['model']=_[_0x64c2('0x2c')](_0x365f8b,_0x64c2('0x29'));_0x46ffd5[_0x64c2('0x30')]=_[_0x64c2('0x31')](_0x36701f[_0x64c2('0x30')]);_0x46ffd5['filters']=_['intersection'](_0x46ffd5['model'],_0x46ffd5[_0x64c2('0x30')]);_0x3c9d84[_0x64c2('0x32')]=_[_0x64c2('0x33')](_0x46ffd5[_0x64c2('0x34')],qs[_0x64c2('0x35')](_0x36701f[_0x64c2('0x30')][_0x64c2('0x35')]));_0x3c9d84[_0x64c2('0x32')]=_0x3c9d84['attributes']['length']?_0x3c9d84[_0x64c2('0x32')]:_0x46ffd5[_0x64c2('0x34')];if(!_0x36701f[_0x64c2('0x30')][_0x64c2('0x36')](_0x64c2('0x37'))){_0x3c9d84[_0x64c2('0x20')]=qs[_0x64c2('0x20')](_0x36701f['query'][_0x64c2('0x20')]);_0x3c9d84[_0x64c2('0x1e')]=qs[_0x64c2('0x1e')](_0x36701f[_0x64c2('0x30')][_0x64c2('0x1e')]);}_0x3c9d84[_0x64c2('0x38')]=qs[_0x64c2('0x39')](_0x36701f[_0x64c2('0x30')][_0x64c2('0x39')]);_0x3c9d84[_0x64c2('0x3a')]=qs[_0x64c2('0x3b')](_['pick'](_0x36701f[_0x64c2('0x30')],_0x46ffd5[_0x64c2('0x3b')]),_0x365f8b);if(_0x36701f[_0x64c2('0x30')][_0x64c2('0x3c')]){_0x3c9d84[_0x64c2('0x3a')]=_[_0x64c2('0x3d')](_0x3c9d84[_0x64c2('0x3a')],{'$or':_[_0x64c2('0x2c')](_0x365f8b,function(_0x469737){if(_0x469737[_0x64c2('0x3e')]!==_0x64c2('0x3f')){var _0x2c8316={};_0x2c8316[_0x469737[_0x64c2('0x29')]]={'$like':'%'+_0x36701f[_0x64c2('0x30')][_0x64c2('0x3c')]+'%'};return _0x2c8316;}})});}_0x3c9d84=_['merge']({},_0x3c9d84,_0x36701f[_0x64c2('0x40')]);var _0x3d2351={'where':_0x3c9d84[_0x64c2('0x3a')]};return db[_0x64c2('0x2d')]['count'](_0x3d2351)[_0x64c2('0x26')](function(_0x1a295c){_0x2564c3[_0x64c2('0x21')]=_0x1a295c;if(_0x36701f[_0x64c2('0x30')]['includeAll']){_0x3c9d84[_0x64c2('0x41')]=[{'all':!![]}];}return db[_0x64c2('0x2d')][_0x64c2('0x42')](_0x3c9d84);})['then'](function(_0x19380c){_0x2564c3['rows']=_0x19380c;return _0x2564c3;})['then'](respondWithFilteredResult(_0x560931,_0x3c9d84))['catch'](handleError(_0x560931,null));};exports[_0x64c2('0x43')]=function(_0x474d8b,_0x32c1b2){var _0x3abae7={'raw':![],'where':{'id':_0x474d8b['params']['id']}},_0x25aef2={};_0x25aef2[_0x64c2('0x34')]=_[_0x64c2('0x31')](db[_0x64c2('0x2d')][_0x64c2('0x2e')]);_0x25aef2['query']=_[_0x64c2('0x31')](_0x474d8b[_0x64c2('0x30')]);_0x25aef2[_0x64c2('0x3b')]=_[_0x64c2('0x33')](_0x25aef2[_0x64c2('0x34')],_0x25aef2[_0x64c2('0x30')]);_0x3abae7[_0x64c2('0x32')]=_[_0x64c2('0x33')](_0x25aef2['model'],qs[_0x64c2('0x35')](_0x474d8b[_0x64c2('0x30')]['fields']));_0x3abae7[_0x64c2('0x32')]=_0x3abae7['attributes'][_0x64c2('0x44')]?_0x3abae7[_0x64c2('0x32')]:_0x25aef2[_0x64c2('0x34')];if(_0x474d8b[_0x64c2('0x30')]['includeAll']){_0x3abae7[_0x64c2('0x41')]=[{'all':!![]}];}_0x3abae7=_['merge']({},_0x3abae7,_0x474d8b[_0x64c2('0x40')]);return db[_0x64c2('0x2d')]['find'](_0x3abae7)['then'](handleEntityNotFound(_0x32c1b2,null))[_0x64c2('0x26')](respondWithResult(_0x32c1b2,null))[_0x64c2('0x45')](handleError(_0x32c1b2,null));};exports[_0x64c2('0x46')]=function(_0x2b12ae,_0x1633e8){return db[_0x64c2('0x2d')][_0x64c2('0x46')](_0x2b12ae[_0x64c2('0x47')],{})[_0x64c2('0x26')](respondWithResult(_0x1633e8,0xc9))[_0x64c2('0x45')](handleError(_0x1633e8,null));};exports[_0x64c2('0x48')]=function(_0x230e2e,_0x1bbb7e){if(_0x230e2e[_0x64c2('0x47')]['id']){delete _0x230e2e[_0x64c2('0x47')]['id'];}return db[_0x64c2('0x2d')][_0x64c2('0x49')]({'where':{'id':_0x230e2e[_0x64c2('0x4a')]['id']}})[_0x64c2('0x26')](handleEntityNotFound(_0x1bbb7e,null))[_0x64c2('0x26')](saveUpdates(_0x230e2e[_0x64c2('0x47')],null))[_0x64c2('0x26')](respondWithResult(_0x1bbb7e,null))['catch'](handleError(_0x1bbb7e,null));};exports[_0x64c2('0x27')]=function(_0x331a0d,_0xff50b4){return db[_0x64c2('0x2d')][_0x64c2('0x49')]({'where':{'id':_0x331a0d['params']['id']}})[_0x64c2('0x26')](handleEntityNotFound(_0xff50b4,null))[_0x64c2('0x26')](removeEntity(_0xff50b4,null))['catch'](handleError(_0xff50b4,null));};exports[_0x64c2('0x4b')]=function(_0x120ed5,_0x484662,_0x51916c){var _0x37a6f4={};var _0x11b31b={};var _0x331760;var _0x599d55;return db[_0x64c2('0x2d')]['findOne']({'where':{'id':_0x120ed5['params']['id']}})['then'](handleEntityNotFound(_0x484662,null))[_0x64c2('0x26')](function(_0x51f694){if(_0x51f694){_0x331760=_0x51f694;_0x11b31b['model']=_['keys'](db[_0x64c2('0x4c')][_0x64c2('0x2e')]);_0x11b31b[_0x64c2('0x30')]=_[_0x64c2('0x31')](_0x120ed5[_0x64c2('0x30')]);_0x11b31b[_0x64c2('0x3b')]=_['intersection'](_0x11b31b['model'],_0x11b31b['query']);_0x37a6f4[_0x64c2('0x32')]=_[_0x64c2('0x33')](_0x11b31b[_0x64c2('0x34')],qs[_0x64c2('0x35')](_0x120ed5[_0x64c2('0x30')][_0x64c2('0x35')]));_0x37a6f4[_0x64c2('0x32')]=_0x37a6f4[_0x64c2('0x32')][_0x64c2('0x44')]?_0x37a6f4['attributes']:_0x11b31b[_0x64c2('0x34')];_0x37a6f4[_0x64c2('0x38')]=qs[_0x64c2('0x39')](_0x120ed5[_0x64c2('0x30')]['sort']);_0x37a6f4[_0x64c2('0x3a')]=qs[_0x64c2('0x3b')](_['pick'](_0x120ed5['query'],_0x11b31b['filters']));if(_0x120ed5[_0x64c2('0x30')]['filter']){_0x37a6f4[_0x64c2('0x3a')]=_['merge'](_0x37a6f4['where'],{'$or':_[_0x64c2('0x2c')](_0x37a6f4[_0x64c2('0x32')],function(_0x342b2b){var _0x4d5ef4={};_0x4d5ef4[_0x342b2b]={'$like':'%'+_0x120ed5['query'][_0x64c2('0x3c')]+'%'};return _0x4d5ef4;})});}_0x37a6f4=_['merge']({},_0x37a6f4,_0x120ed5[_0x64c2('0x40')]);return _0x331760[_0x64c2('0x4b')](_0x37a6f4);}})[_0x64c2('0x26')](function(_0x1ea233){if(_0x1ea233){_0x599d55=_0x1ea233[_0x64c2('0x44')];if(!_0x120ed5[_0x64c2('0x30')]['hasOwnProperty'](_0x64c2('0x37'))){_0x37a6f4['limit']=qs[_0x64c2('0x20')](_0x120ed5[_0x64c2('0x30')][_0x64c2('0x20')]);_0x37a6f4[_0x64c2('0x1e')]=qs[_0x64c2('0x1e')](_0x120ed5[_0x64c2('0x30')][_0x64c2('0x1e')]);}return _0x331760[_0x64c2('0x4b')](_0x37a6f4);}})[_0x64c2('0x26')](function(_0x35df57){if(_0x35df57){return _0x35df57?{'count':_0x599d55,'rows':_0x35df57}:null;}})[_0x64c2('0x26')](respondWithResult(_0x484662,null))['catch'](handleError(_0x484662,null));};exports[_0x64c2('0x4d')]=function(_0x3de804,_0x300342,_0x36820b){var _0x378a77={};var _0x284dea={};var _0x206771;var _0x12ffe4;return db['SugarcrmConfiguration'][_0x64c2('0x4e')]({'where':{'id':_0x3de804[_0x64c2('0x4a')]['id']}})['then'](handleEntityNotFound(_0x300342,null))[_0x64c2('0x26')](function(_0x16e451){if(_0x16e451){_0x206771=_0x16e451;_0x284dea['model']=_[_0x64c2('0x31')](db[_0x64c2('0x4c')][_0x64c2('0x2e')]);_0x284dea[_0x64c2('0x30')]=_[_0x64c2('0x31')](_0x3de804[_0x64c2('0x30')]);_0x284dea[_0x64c2('0x3b')]=_[_0x64c2('0x33')](_0x284dea['model'],_0x284dea['query']);_0x378a77['attributes']=_['intersection'](_0x284dea['model'],qs[_0x64c2('0x35')](_0x3de804['query']['fields']));_0x378a77[_0x64c2('0x32')]=_0x378a77[_0x64c2('0x32')][_0x64c2('0x44')]?_0x378a77[_0x64c2('0x32')]:_0x284dea['model'];_0x378a77[_0x64c2('0x38')]=qs[_0x64c2('0x39')](_0x3de804['query'][_0x64c2('0x39')]);_0x378a77['where']=qs[_0x64c2('0x3b')](_['pick'](_0x3de804[_0x64c2('0x30')],_0x284dea[_0x64c2('0x3b')]));if(_0x3de804[_0x64c2('0x30')]['filter']){_0x378a77[_0x64c2('0x3a')]=_[_0x64c2('0x3d')](_0x378a77['where'],{'$or':_[_0x64c2('0x2c')](_0x378a77[_0x64c2('0x32')],function(_0x18c7a7){var _0x21aeba={};_0x21aeba[_0x18c7a7]={'$like':'%'+_0x3de804[_0x64c2('0x30')][_0x64c2('0x3c')]+'%'};return _0x21aeba;})});}_0x378a77=_[_0x64c2('0x3d')]({},_0x378a77,_0x3de804['options']);return _0x206771[_0x64c2('0x4d')](_0x378a77);}})[_0x64c2('0x26')](function(_0x14da3d){if(_0x14da3d){_0x12ffe4=_0x14da3d['length'];if(!_0x3de804[_0x64c2('0x30')][_0x64c2('0x36')](_0x64c2('0x37'))){_0x378a77[_0x64c2('0x20')]=qs['limit'](_0x3de804[_0x64c2('0x30')][_0x64c2('0x20')]);_0x378a77['offset']=qs['offset'](_0x3de804['query'][_0x64c2('0x1e')]);}return _0x206771[_0x64c2('0x4d')](_0x378a77);}})[_0x64c2('0x26')](function(_0x4a12ff){if(_0x4a12ff){return _0x4a12ff?{'count':_0x12ffe4,'rows':_0x4a12ff}:null;}})[_0x64c2('0x26')](respondWithResult(_0x300342,null))[_0x64c2('0x45')](handleError(_0x300342,null));};exports[_0x64c2('0x4f')]=function(_0x1a15b5,_0x67780,_0x1cbfa8){var _0x41be7d={};var _0x86a55f={};var _0x1d4f58;var _0x57195d;return db[_0x64c2('0x2d')][_0x64c2('0x4e')]({'where':{'id':_0x1a15b5['params']['id']}})[_0x64c2('0x26')](handleEntityNotFound(_0x67780,null))[_0x64c2('0x26')](function(_0x13b8eb){if(_0x13b8eb){_0x1d4f58=_0x13b8eb;_0x86a55f[_0x64c2('0x34')]=_[_0x64c2('0x31')](db[_0x64c2('0x4c')][_0x64c2('0x2e')]);_0x86a55f['query']=_[_0x64c2('0x31')](_0x1a15b5['query']);_0x86a55f[_0x64c2('0x3b')]=_['intersection'](_0x86a55f[_0x64c2('0x34')],_0x86a55f['query']);_0x41be7d[_0x64c2('0x32')]=_[_0x64c2('0x33')](_0x86a55f[_0x64c2('0x34')],qs[_0x64c2('0x35')](_0x1a15b5[_0x64c2('0x30')]['fields']));_0x41be7d[_0x64c2('0x32')]=_0x41be7d[_0x64c2('0x32')]['length']?_0x41be7d[_0x64c2('0x32')]:_0x86a55f[_0x64c2('0x34')];_0x41be7d[_0x64c2('0x38')]=qs[_0x64c2('0x39')](_0x1a15b5['query'][_0x64c2('0x39')]);_0x41be7d['where']=qs[_0x64c2('0x3b')](_[_0x64c2('0x50')](_0x1a15b5['query'],_0x86a55f[_0x64c2('0x3b')]));if(_0x1a15b5[_0x64c2('0x30')][_0x64c2('0x3c')]){_0x41be7d[_0x64c2('0x3a')]=_['merge'](_0x41be7d['where'],{'$or':_[_0x64c2('0x2c')](_0x41be7d[_0x64c2('0x32')],function(_0x17b641){var _0x54c466={};_0x54c466[_0x17b641]={'$like':'%'+_0x1a15b5[_0x64c2('0x30')][_0x64c2('0x3c')]+'%'};return _0x54c466;})});}_0x41be7d=_[_0x64c2('0x3d')]({},_0x41be7d,_0x1a15b5['options']);return _0x1d4f58[_0x64c2('0x4f')](_0x41be7d);}})[_0x64c2('0x26')](function(_0x299322){if(_0x299322){_0x57195d=_0x299322[_0x64c2('0x44')];if(!_0x1a15b5[_0x64c2('0x30')][_0x64c2('0x36')](_0x64c2('0x37'))){_0x41be7d[_0x64c2('0x20')]=qs[_0x64c2('0x20')](_0x1a15b5[_0x64c2('0x30')][_0x64c2('0x20')]);_0x41be7d[_0x64c2('0x1e')]=qs[_0x64c2('0x1e')](_0x1a15b5[_0x64c2('0x30')][_0x64c2('0x1e')]);}return _0x1d4f58[_0x64c2('0x4f')](_0x41be7d);}})[_0x64c2('0x26')](function(_0x1067d8){if(_0x1067d8){return _0x1067d8?{'count':_0x57195d,'rows':_0x1067d8}:null;}})[_0x64c2('0x26')](respondWithResult(_0x67780,null))[_0x64c2('0x45')](handleError(_0x67780,null));}; \ No newline at end of file +var _0x243f=['bluebird','util','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','create','body','getFields','findOne','order','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x251751,_0x113a01){var _0x53ee2d=function(_0x361b44){while(--_0x361b44){_0x251751['push'](_0x251751['shift']());}};_0x53ee2d(++_0x113a01);}(_0x243f,0x185));var _0xf243=function(_0x377f50,_0x5589ba){_0x377f50=_0x377f50-0x0;var _0x14a9d2=_0x243f[_0x377f50];return _0x14a9d2;};'use strict';var emlformat=require(_0xf243('0x0'));var rimraf=require(_0xf243('0x1'));var zipdir=require(_0xf243('0x2'));var jsonpatch=require(_0xf243('0x3'));var rp=require(_0xf243('0x4'));var moment=require(_0xf243('0x5'));var BPromise=require(_0xf243('0x6'));var Mustache=require('mustache');var util=require(_0xf243('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf243('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf243('0x9'));var squel=require(_0xf243('0xa'));var crypto=require(_0xf243('0xb'));var jsforce=require(_0xf243('0xc'));var deskjs=require(_0xf243('0xd'));var toCsv=require(_0xf243('0xe'));var querystring=require(_0xf243('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf243('0x10'));var as=require(_0xf243('0x11'));var hardwareService=require(_0xf243('0x12'));var logger=require('../../config/logger')(_0xf243('0x13'));var utils=require(_0xf243('0x14'));var config=require(_0xf243('0x15'));var licenseUtil=require(_0xf243('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a9c71,_0x297edf){_0x297edf=_0x297edf||0xcc;return function(_0x5a47da){if(_0x5a47da){return _0x1a9c71[_0xf243('0x17')](_0x297edf);}return _0x1a9c71['status'](_0x297edf)[_0xf243('0x18')]();};}function respondWithResult(_0x40f27d,_0x74b6f6){_0x74b6f6=_0x74b6f6||0xc8;return function(_0x2cf789){if(_0x2cf789){return _0x40f27d[_0xf243('0x19')](_0x74b6f6)[_0xf243('0x1a')](_0x2cf789);}};}function respondWithFilteredResult(_0x2bb828,_0x5bdd88){return function(_0x15c386){if(_0x15c386){var _0x4ee0b8=typeof _0x5bdd88['offset']==='undefined'&&typeof _0x5bdd88[_0xf243('0x1b')]===_0xf243('0x1c');var _0x2a7950=_0x15c386[_0xf243('0x1d')];var _0x3a89b6=_0x4ee0b8?0x0:_0x5bdd88[_0xf243('0x1e')];var _0x119c4a=_0x4ee0b8?_0x15c386[_0xf243('0x1d')]:_0x5bdd88[_0xf243('0x1e')]+_0x5bdd88[_0xf243('0x1b')];var _0x3fcc31;if(_0x119c4a>=_0x2a7950){_0x119c4a=_0x2a7950;_0x3fcc31=0xc8;}else{_0x3fcc31=0xce;}_0x2bb828[_0xf243('0x19')](_0x3fcc31);return _0x2bb828[_0xf243('0x1f')](_0xf243('0x20'),_0x3a89b6+'-'+_0x119c4a+'/'+_0x2a7950)[_0xf243('0x1a')](_0x15c386);}return null;};}function patchUpdates(_0x8b7a1b){return function(_0xce4b40){try{jsonpatch[_0xf243('0x21')](_0xce4b40,_0x8b7a1b,!![]);}catch(_0x75c422){return BPromise['reject'](_0x75c422);}return _0xce4b40['save']();};}function saveUpdates(_0x2ded2c,_0x518c09){return function(_0x30d540){if(_0x30d540){return _0x30d540[_0xf243('0x22')](_0x2ded2c)[_0xf243('0x23')](function(_0x397918){return _0x397918;});}return null;};}function removeEntity(_0x4da784,_0x5329d8){return function(_0xfb598){if(_0xfb598){return _0xfb598[_0xf243('0x24')]()[_0xf243('0x23')](function(){_0x4da784[_0xf243('0x19')](0xcc)[_0xf243('0x18')]();});}};}function handleEntityNotFound(_0x2a6a81,_0x3fa57c){return function(_0x38f84a){if(!_0x38f84a){_0x2a6a81[_0xf243('0x17')](0x194);}return _0x38f84a;};}function handleError(_0x4fe035,_0x58b5a0){_0x58b5a0=_0x58b5a0||0x1f4;return function(_0x525350){logger[_0xf243('0x25')](_0x525350[_0xf243('0x26')]);if(_0x525350['name']){delete _0x525350[_0xf243('0x27')];}_0x4fe035[_0xf243('0x19')](_0x58b5a0)[_0xf243('0x28')](_0x525350);};}exports[_0xf243('0x29')]=function(_0x1bbfc9,_0x9df574){var _0x12f809={},_0xe88db0={},_0x449f5f={'count':0x0,'rows':[]};var _0x319a2c=_[_0xf243('0x2a')](db[_0xf243('0x2b')][_0xf243('0x2c')],function(_0x49238e){return{'name':_0x49238e[_0xf243('0x2d')],'type':_0x49238e[_0xf243('0x2e')][_0xf243('0x2f')]};});_0xe88db0[_0xf243('0x30')]=_[_0xf243('0x2a')](_0x319a2c,_0xf243('0x27'));_0xe88db0[_0xf243('0x31')]=_[_0xf243('0x32')](_0x1bbfc9['query']);_0xe88db0['filters']=_[_0xf243('0x33')](_0xe88db0[_0xf243('0x30')],_0xe88db0[_0xf243('0x31')]);_0x12f809[_0xf243('0x34')]=_[_0xf243('0x33')](_0xe88db0[_0xf243('0x30')],qs['fields'](_0x1bbfc9[_0xf243('0x31')][_0xf243('0x35')]));_0x12f809[_0xf243('0x34')]=_0x12f809[_0xf243('0x34')][_0xf243('0x36')]?_0x12f809[_0xf243('0x34')]:_0xe88db0[_0xf243('0x30')];if(!_0x1bbfc9[_0xf243('0x31')][_0xf243('0x37')](_0xf243('0x38'))){_0x12f809[_0xf243('0x1b')]=qs['limit'](_0x1bbfc9[_0xf243('0x31')][_0xf243('0x1b')]);_0x12f809[_0xf243('0x1e')]=qs[_0xf243('0x1e')](_0x1bbfc9[_0xf243('0x31')]['offset']);}_0x12f809['order']=qs['sort'](_0x1bbfc9['query'][_0xf243('0x39')]);_0x12f809[_0xf243('0x3a')]=qs[_0xf243('0x3b')](_['pick'](_0x1bbfc9[_0xf243('0x31')],_0xe88db0[_0xf243('0x3b')]),_0x319a2c);if(_0x1bbfc9[_0xf243('0x31')][_0xf243('0x3c')]){_0x12f809[_0xf243('0x3a')]=_[_0xf243('0x3d')](_0x12f809[_0xf243('0x3a')],{'$or':_[_0xf243('0x2a')](_0x319a2c,function(_0x595d77){if(_0x595d77[_0xf243('0x2e')]!==_0xf243('0x3e')){var _0x16e0fe={};_0x16e0fe[_0x595d77[_0xf243('0x27')]]={'$like':'%'+_0x1bbfc9[_0xf243('0x31')][_0xf243('0x3c')]+'%'};return _0x16e0fe;}})});}_0x12f809=_['merge']({},_0x12f809,_0x1bbfc9[_0xf243('0x3f')]);var _0x104783={'where':_0x12f809[_0xf243('0x3a')]};return db[_0xf243('0x2b')][_0xf243('0x1d')](_0x104783)['then'](function(_0x196d05){_0x449f5f['count']=_0x196d05;if(_0x1bbfc9[_0xf243('0x31')][_0xf243('0x40')]){_0x12f809[_0xf243('0x41')]=[{'all':!![]}];}return db['SugarcrmConfiguration']['findAll'](_0x12f809);})[_0xf243('0x23')](function(_0x7cfc38){_0x449f5f[_0xf243('0x42')]=_0x7cfc38;return _0x449f5f;})[_0xf243('0x23')](respondWithFilteredResult(_0x9df574,_0x12f809))['catch'](handleError(_0x9df574,null));};exports[_0xf243('0x43')]=function(_0x376265,_0x23d241){var _0x4e0f6a={'raw':![],'where':{'id':_0x376265[_0xf243('0x44')]['id']}},_0x5cce1a={};_0x5cce1a['model']=_[_0xf243('0x32')](db[_0xf243('0x2b')][_0xf243('0x2c')]);_0x5cce1a[_0xf243('0x31')]=_[_0xf243('0x32')](_0x376265[_0xf243('0x31')]);_0x5cce1a[_0xf243('0x3b')]=_['intersection'](_0x5cce1a[_0xf243('0x30')],_0x5cce1a[_0xf243('0x31')]);_0x4e0f6a['attributes']=_[_0xf243('0x33')](_0x5cce1a['model'],qs[_0xf243('0x35')](_0x376265[_0xf243('0x31')][_0xf243('0x35')]));_0x4e0f6a['attributes']=_0x4e0f6a[_0xf243('0x34')]['length']?_0x4e0f6a[_0xf243('0x34')]:_0x5cce1a[_0xf243('0x30')];if(_0x376265['query'][_0xf243('0x40')]){_0x4e0f6a[_0xf243('0x41')]=[{'all':!![]}];}_0x4e0f6a=_[_0xf243('0x3d')]({},_0x4e0f6a,_0x376265['options']);return db[_0xf243('0x2b')][_0xf243('0x45')](_0x4e0f6a)[_0xf243('0x23')](handleEntityNotFound(_0x23d241,null))[_0xf243('0x23')](respondWithResult(_0x23d241,null))[_0xf243('0x46')](handleError(_0x23d241,null));};exports[_0xf243('0x47')]=function(_0xde7c83,_0x137c39){return db[_0xf243('0x2b')][_0xf243('0x47')](_0xde7c83[_0xf243('0x48')],{})[_0xf243('0x23')](respondWithResult(_0x137c39,0xc9))[_0xf243('0x46')](handleError(_0x137c39,null));};exports[_0xf243('0x22')]=function(_0x6bde11,_0x4346e5){if(_0x6bde11[_0xf243('0x48')]['id']){delete _0x6bde11[_0xf243('0x48')]['id'];}return db[_0xf243('0x2b')][_0xf243('0x45')]({'where':{'id':_0x6bde11['params']['id']}})[_0xf243('0x23')](handleEntityNotFound(_0x4346e5,null))[_0xf243('0x23')](saveUpdates(_0x6bde11[_0xf243('0x48')],null))[_0xf243('0x23')](respondWithResult(_0x4346e5,null))[_0xf243('0x46')](handleError(_0x4346e5,null));};exports['destroy']=function(_0x5927e6,_0x56c916){return db['SugarcrmConfiguration'][_0xf243('0x45')]({'where':{'id':_0x5927e6[_0xf243('0x44')]['id']}})['then'](handleEntityNotFound(_0x56c916,null))['then'](removeEntity(_0x56c916,null))[_0xf243('0x46')](handleError(_0x56c916,null));};exports[_0xf243('0x49')]=function(_0x28806e,_0x32ef28,_0x151932){var _0x4e6480={};var _0x41775f={};var _0x2953ca;var _0x275501;return db[_0xf243('0x2b')][_0xf243('0x4a')]({'where':{'id':_0x28806e[_0xf243('0x44')]['id']}})[_0xf243('0x23')](handleEntityNotFound(_0x32ef28,null))[_0xf243('0x23')](function(_0xe4ec30){if(_0xe4ec30){_0x2953ca=_0xe4ec30;_0x41775f['model']=_[_0xf243('0x32')](db['SugarcrmField'][_0xf243('0x2c')]);_0x41775f[_0xf243('0x31')]=_['keys'](_0x28806e[_0xf243('0x31')]);_0x41775f[_0xf243('0x3b')]=_[_0xf243('0x33')](_0x41775f[_0xf243('0x30')],_0x41775f[_0xf243('0x31')]);_0x4e6480[_0xf243('0x34')]=_[_0xf243('0x33')](_0x41775f[_0xf243('0x30')],qs[_0xf243('0x35')](_0x28806e['query'][_0xf243('0x35')]));_0x4e6480[_0xf243('0x34')]=_0x4e6480[_0xf243('0x34')][_0xf243('0x36')]?_0x4e6480[_0xf243('0x34')]:_0x41775f[_0xf243('0x30')];_0x4e6480[_0xf243('0x4b')]=qs['sort'](_0x28806e[_0xf243('0x31')][_0xf243('0x39')]);_0x4e6480[_0xf243('0x3a')]=qs[_0xf243('0x3b')](_[_0xf243('0x4c')](_0x28806e[_0xf243('0x31')],_0x41775f['filters']));if(_0x28806e[_0xf243('0x31')]['filter']){_0x4e6480[_0xf243('0x3a')]=_[_0xf243('0x3d')](_0x4e6480[_0xf243('0x3a')],{'$or':_[_0xf243('0x2a')](_0x4e6480['attributes'],function(_0x29d055){var _0x5c7578={};_0x5c7578[_0x29d055]={'$like':'%'+_0x28806e[_0xf243('0x31')][_0xf243('0x3c')]+'%'};return _0x5c7578;})});}_0x4e6480=_[_0xf243('0x3d')]({},_0x4e6480,_0x28806e[_0xf243('0x3f')]);return _0x2953ca[_0xf243('0x49')](_0x4e6480);}})['then'](function(_0x44d8e0){if(_0x44d8e0){_0x275501=_0x44d8e0['length'];if(!_0x28806e[_0xf243('0x31')][_0xf243('0x37')](_0xf243('0x38'))){_0x4e6480[_0xf243('0x1b')]=qs['limit'](_0x28806e[_0xf243('0x31')]['limit']);_0x4e6480[_0xf243('0x1e')]=qs[_0xf243('0x1e')](_0x28806e[_0xf243('0x31')][_0xf243('0x1e')]);}return _0x2953ca['getFields'](_0x4e6480);}})[_0xf243('0x23')](function(_0x566f9c){if(_0x566f9c){return _0x566f9c?{'count':_0x275501,'rows':_0x566f9c}:null;}})[_0xf243('0x23')](respondWithResult(_0x32ef28,null))[_0xf243('0x46')](handleError(_0x32ef28,null));};exports[_0xf243('0x4d')]=function(_0x1b22e2,_0x1814ef,_0x40f121){var _0x20472c={};var _0x3dafc9={};var _0x39c770;var _0x439444;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x1b22e2[_0xf243('0x44')]['id']}})[_0xf243('0x23')](handleEntityNotFound(_0x1814ef,null))[_0xf243('0x23')](function(_0x26d9ec){if(_0x26d9ec){_0x39c770=_0x26d9ec;_0x3dafc9[_0xf243('0x30')]=_[_0xf243('0x32')](db['SugarcrmField'][_0xf243('0x2c')]);_0x3dafc9[_0xf243('0x31')]=_[_0xf243('0x32')](_0x1b22e2[_0xf243('0x31')]);_0x3dafc9[_0xf243('0x3b')]=_['intersection'](_0x3dafc9['model'],_0x3dafc9[_0xf243('0x31')]);_0x20472c[_0xf243('0x34')]=_['intersection'](_0x3dafc9[_0xf243('0x30')],qs[_0xf243('0x35')](_0x1b22e2[_0xf243('0x31')]['fields']));_0x20472c[_0xf243('0x34')]=_0x20472c['attributes'][_0xf243('0x36')]?_0x20472c['attributes']:_0x3dafc9[_0xf243('0x30')];_0x20472c[_0xf243('0x4b')]=qs[_0xf243('0x39')](_0x1b22e2[_0xf243('0x31')][_0xf243('0x39')]);_0x20472c['where']=qs[_0xf243('0x3b')](_[_0xf243('0x4c')](_0x1b22e2['query'],_0x3dafc9[_0xf243('0x3b')]));if(_0x1b22e2[_0xf243('0x31')][_0xf243('0x3c')]){_0x20472c[_0xf243('0x3a')]=_[_0xf243('0x3d')](_0x20472c[_0xf243('0x3a')],{'$or':_['map'](_0x20472c[_0xf243('0x34')],function(_0x4a65d2){var _0x310b9f={};_0x310b9f[_0x4a65d2]={'$like':'%'+_0x1b22e2[_0xf243('0x31')]['filter']+'%'};return _0x310b9f;})});}_0x20472c=_['merge']({},_0x20472c,_0x1b22e2[_0xf243('0x3f')]);return _0x39c770['getSubjects'](_0x20472c);}})[_0xf243('0x23')](function(_0x401a0e){if(_0x401a0e){_0x439444=_0x401a0e[_0xf243('0x36')];if(!_0x1b22e2['query'][_0xf243('0x37')](_0xf243('0x38'))){_0x20472c[_0xf243('0x1b')]=qs[_0xf243('0x1b')](_0x1b22e2[_0xf243('0x31')][_0xf243('0x1b')]);_0x20472c[_0xf243('0x1e')]=qs[_0xf243('0x1e')](_0x1b22e2[_0xf243('0x31')][_0xf243('0x1e')]);}return _0x39c770[_0xf243('0x4d')](_0x20472c);}})[_0xf243('0x23')](function(_0x3a568b){if(_0x3a568b){return _0x3a568b?{'count':_0x439444,'rows':_0x3a568b}:null;}})['then'](respondWithResult(_0x1814ef,null))[_0xf243('0x46')](handleError(_0x1814ef,null));};exports[_0xf243('0x4e')]=function(_0x34011b,_0x4ab7c5,_0x4c3a49){var _0x334ddb={};var _0x1b11b7={};var _0x52b4b4;var _0x9749c;return db['SugarcrmConfiguration'][_0xf243('0x4a')]({'where':{'id':_0x34011b['params']['id']}})['then'](handleEntityNotFound(_0x4ab7c5,null))[_0xf243('0x23')](function(_0x499387){if(_0x499387){_0x52b4b4=_0x499387;_0x1b11b7['model']=_[_0xf243('0x32')](db['SugarcrmField'][_0xf243('0x2c')]);_0x1b11b7[_0xf243('0x31')]=_[_0xf243('0x32')](_0x34011b['query']);_0x1b11b7[_0xf243('0x3b')]=_[_0xf243('0x33')](_0x1b11b7[_0xf243('0x30')],_0x1b11b7['query']);_0x334ddb[_0xf243('0x34')]=_['intersection'](_0x1b11b7[_0xf243('0x30')],qs['fields'](_0x34011b['query'][_0xf243('0x35')]));_0x334ddb['attributes']=_0x334ddb[_0xf243('0x34')][_0xf243('0x36')]?_0x334ddb[_0xf243('0x34')]:_0x1b11b7[_0xf243('0x30')];_0x334ddb[_0xf243('0x4b')]=qs['sort'](_0x34011b[_0xf243('0x31')][_0xf243('0x39')]);_0x334ddb[_0xf243('0x3a')]=qs[_0xf243('0x3b')](_[_0xf243('0x4c')](_0x34011b[_0xf243('0x31')],_0x1b11b7[_0xf243('0x3b')]));if(_0x34011b['query']['filter']){_0x334ddb['where']=_[_0xf243('0x3d')](_0x334ddb[_0xf243('0x3a')],{'$or':_['map'](_0x334ddb[_0xf243('0x34')],function(_0x5816d6){var _0x4ca76c={};_0x4ca76c[_0x5816d6]={'$like':'%'+_0x34011b[_0xf243('0x31')][_0xf243('0x3c')]+'%'};return _0x4ca76c;})});}_0x334ddb=_[_0xf243('0x3d')]({},_0x334ddb,_0x34011b[_0xf243('0x3f')]);return _0x52b4b4[_0xf243('0x4e')](_0x334ddb);}})[_0xf243('0x23')](function(_0x55f8d9){if(_0x55f8d9){_0x9749c=_0x55f8d9['length'];if(!_0x34011b[_0xf243('0x31')][_0xf243('0x37')](_0xf243('0x38'))){_0x334ddb[_0xf243('0x1b')]=qs[_0xf243('0x1b')](_0x34011b[_0xf243('0x31')][_0xf243('0x1b')]);_0x334ddb['offset']=qs[_0xf243('0x1e')](_0x34011b[_0xf243('0x31')]['offset']);}return _0x52b4b4[_0xf243('0x4e')](_0x334ddb);}})[_0xf243('0x23')](function(_0x4869f3){if(_0x4869f3){return _0x4869f3?{'count':_0x9749c,'rows':_0x4869f3}:null;}})[_0xf243('0x23')](respondWithResult(_0x4ab7c5,null))[_0xf243('0x46')](handleError(_0x4ab7c5,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 0bf1c87..862b325 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 _0x1c7f=['path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','../../config/logger','api','moment','request-promise'];(function(_0x4157cf,_0x3ff907){var _0x3dacbe=function(_0x503dc3){while(--_0x503dc3){_0x4157cf['push'](_0x4157cf['shift']());}};_0x3dacbe(++_0x3ff907);}(_0x1c7f,0xa3));var _0xf1c7=function(_0x6d6a66,_0x2924af){_0x6d6a66=_0x6d6a66-0x0;var _0x11eb6e=_0x1c7f[_0x6d6a66];return _0x11eb6e;};'use strict';var _=require(_0xf1c7('0x0'));var util=require('util');var logger=require(_0xf1c7('0x1'))(_0xf1c7('0x2'));var moment=require(_0xf1c7('0x3'));var BPromise=require('bluebird');var rp=require(_0xf1c7('0x4'));var fs=require('fs');var path=require(_0xf1c7('0x5'));var rimraf=require(_0xf1c7('0x6'));var config=require(_0xf1c7('0x7'));var attributes=require(_0xf1c7('0x8'));module[_0xf1c7('0x9')]=function(_0x58793a,_0x593bdf){return _0x58793a['define'](_0xf1c7('0xa'),attributes,{'tableName':_0xf1c7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4620=['path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x4320e6,_0x2f2a66){var _0x4e3f34=function(_0x2f81d0){while(--_0x2f81d0){_0x4320e6['push'](_0x4320e6['shift']());}};_0x4e3f34(++_0x2f2a66);}(_0x4620,0x1e7));var _0x0462=function(_0x56e4e7,_0x1db098){_0x56e4e7=_0x56e4e7-0x0;var _0x383618=_0x4620[_0x56e4e7];return _0x383618;};'use strict';var _=require(_0x0462('0x0'));var util=require(_0x0462('0x1'));var logger=require(_0x0462('0x2'))(_0x0462('0x3'));var moment=require(_0x0462('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0462('0x5'));var rimraf=require(_0x0462('0x6'));var config=require(_0x0462('0x7'));var attributes=require(_0x0462('0x8'));module['exports']=function(_0x55f13d,_0x1d07f5){return _0x55f13d[_0x0462('0x9')](_0x0462('0xa'),attributes,{'tableName':_0x0462('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 2edac5c..6ab35bb 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 _0xbd9d=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xbd9d,0x97));var _0xdbd9=function(_0xf97b7c,_0x2f40e5){_0xf97b7c=_0xf97b7c-0x0;var _0x14adb2=_0xbd9d[_0xf97b7c];return _0x14adb2;};'use strict';var _=require(_0xdbd9('0x0'));var util=require('util');var moment=require(_0xdbd9('0x1'));var BPromise=require(_0xdbd9('0x2'));var rs=require(_0xdbd9('0x3'));var fs=require('fs');var Redis=require(_0xdbd9('0x4'));var db=require(_0xdbd9('0x5'))['db'];var utils=require(_0xdbd9('0x6'));var logger=require(_0xdbd9('0x7'))(_0xdbd9('0x8'));var config=require(_0xdbd9('0x9'));var jayson=require(_0xdbd9('0xa'));var client=jayson[_0xdbd9('0xb')][_0xdbd9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5ebffd,_0x268f70,_0x2ad1c5){return new BPromise(function(_0x12d0c4,_0x2734d8){return client[_0xdbd9('0xd')](_0x5ebffd,_0x2ad1c5)[_0xdbd9('0xe')](function(_0x2f0438){logger[_0xdbd9('0xf')](_0xdbd9('0x10'),_0x268f70,_0xdbd9('0x11'));logger[_0xdbd9('0x12')](_0xdbd9('0x13'),_0x268f70,_0xdbd9('0x11'),JSON['stringify'](_0x2f0438));if(_0x2f0438['error']){if(_0x2f0438['error'][_0xdbd9('0x14')]===0x1f4){logger[_0xdbd9('0x15')](_0xdbd9('0x10'),_0x268f70,_0x2f0438['error'][_0xdbd9('0x16')]);return _0x2734d8(_0x2f0438[_0xdbd9('0x15')][_0xdbd9('0x16')]);}logger['error'](_0xdbd9('0x10'),_0x268f70,_0x2f0438[_0xdbd9('0x15')][_0xdbd9('0x16')]);return _0x12d0c4(_0x2f0438[_0xdbd9('0x15')][_0xdbd9('0x16')]);}else{logger[_0xdbd9('0xf')](_0xdbd9('0x10'),_0x268f70,_0xdbd9('0x11'));_0x12d0c4(_0x2f0438[_0xdbd9('0x17')][_0xdbd9('0x16')]);}})[_0xdbd9('0x18')](function(_0x2b8e50){logger[_0xdbd9('0x15')](_0xdbd9('0x10'),_0x268f70,_0x2b8e50);_0x2734d8(_0x2b8e50);});});} \ No newline at end of file +var _0x8ec6=['client','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3d5995,_0x5a2cfa){var _0x4ee0b4=function(_0x272b07){while(--_0x272b07){_0x3d5995['push'](_0x3d5995['shift']());}};_0x4ee0b4(++_0x5a2cfa);}(_0x8ec6,0x12e));var _0x68ec=function(_0xf51075,_0x117516){_0xf51075=_0xf51075-0x0;var _0x50b863=_0x8ec6[_0xf51075];return _0x50b863;};'use strict';var _=require(_0x68ec('0x0'));var util=require(_0x68ec('0x1'));var moment=require(_0x68ec('0x2'));var BPromise=require(_0x68ec('0x3'));var rs=require(_0x68ec('0x4'));var fs=require('fs');var Redis=require(_0x68ec('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x68ec('0x6'));var logger=require(_0x68ec('0x7'))(_0x68ec('0x8'));var config=require(_0x68ec('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x68ec('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fdf6e,_0x322a28,_0x53d119){return new BPromise(function(_0x423337,_0x53acb4){return client[_0x68ec('0xb')](_0x4fdf6e,_0x53d119)[_0x68ec('0xc')](function(_0x514b85){logger['info'](_0x68ec('0xd'),_0x322a28,_0x68ec('0xe'));logger[_0x68ec('0xf')](_0x68ec('0x10'),_0x322a28,_0x68ec('0xe'),JSON[_0x68ec('0x11')](_0x514b85));if(_0x514b85[_0x68ec('0x12')]){if(_0x514b85[_0x68ec('0x12')][_0x68ec('0x13')]===0x1f4){logger[_0x68ec('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x322a28,_0x514b85[_0x68ec('0x12')][_0x68ec('0x14')]);return _0x53acb4(_0x514b85['error'][_0x68ec('0x14')]);}logger[_0x68ec('0x12')](_0x68ec('0xd'),_0x322a28,_0x514b85[_0x68ec('0x12')][_0x68ec('0x14')]);return _0x423337(_0x514b85['error'][_0x68ec('0x14')]);}else{logger[_0x68ec('0x15')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x322a28,_0x68ec('0xe'));_0x423337(_0x514b85[_0x68ec('0x16')][_0x68ec('0x14')]);}})[_0x68ec('0x17')](function(_0xc258fc){logger[_0x68ec('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x322a28,_0xc258fc);_0x53acb4(_0xc258fc);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 2d91ad5..b6da23e 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 _0xadb9=['/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x340b84,_0x8ea918){var _0x3a07bf=function(_0x47e4e6){while(--_0x47e4e6){_0x340b84['push'](_0x340b84['shift']());}};_0x3a07bf(++_0x8ea918);}(_0xadb9,0x9b));var _0x9adb=function(_0x38b4de,_0x3b2b10){_0x38b4de=_0x38b4de-0x0;var _0x54f3dc=_0xadb9[_0x38b4de];return _0x54f3dc;};'use strict';var multer=require(_0x9adb('0x0'));var util=require(_0x9adb('0x1'));var path=require(_0x9adb('0x2'));var timeout=require(_0x9adb('0x3'));var express=require(_0x9adb('0x4'));var router=express[_0x9adb('0x5')]();var fs_extra=require(_0x9adb('0x6'));var auth=require(_0x9adb('0x7'));var interaction=require(_0x9adb('0x8'));var config=require(_0x9adb('0x9'));var controller=require('./intSugarcrmField.controller');router[_0x9adb('0xa')]('/',auth[_0x9adb('0xb')](),controller[_0x9adb('0xc')]);router[_0x9adb('0xa')](_0x9adb('0xd'),auth[_0x9adb('0xb')](),controller[_0x9adb('0xe')]);router[_0x9adb('0xf')]('/',auth[_0x9adb('0xb')](),controller[_0x9adb('0x10')]);router[_0x9adb('0x11')](_0x9adb('0xd'),auth['isAuthenticated'](),controller[_0x9adb('0x12')]);router[_0x9adb('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x9adb('0x14')]);module['exports']=router; \ No newline at end of file +var _0x8c8a=['fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x1ee9a1,_0x5f1434){var _0x21270f=function(_0x303251){while(--_0x303251){_0x1ee9a1['push'](_0x1ee9a1['shift']());}};_0x21270f(++_0x5f1434);}(_0x8c8a,0x18b));var _0xa8c8=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x8c8a[_0x5bd426];return _0x23a7eb;};'use strict';var multer=require(_0xa8c8('0x0'));var util=require(_0xa8c8('0x1'));var path=require('path');var timeout=require(_0xa8c8('0x2'));var express=require(_0xa8c8('0x3'));var router=express[_0xa8c8('0x4')]();var fs_extra=require(_0xa8c8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa8c8('0x6'));var config=require(_0xa8c8('0x7'));var controller=require(_0xa8c8('0x8'));router[_0xa8c8('0x9')]('/',auth[_0xa8c8('0xa')](),controller[_0xa8c8('0xb')]);router[_0xa8c8('0x9')](_0xa8c8('0xc'),auth['isAuthenticated'](),controller[_0xa8c8('0xd')]);router[_0xa8c8('0xe')]('/',auth[_0xa8c8('0xa')](),controller[_0xa8c8('0xf')]);router[_0xa8c8('0x10')](_0xa8c8('0xc'),auth[_0xa8c8('0xa')](),controller[_0xa8c8('0x11')]);router['delete'](_0xa8c8('0xc'),auth['isAuthenticated'](),controller[_0xa8c8('0x12')]);module[_0xa8c8('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index ea4c54d..29e960a 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 _0xb8b9=['STRING','ENUM','string','BOOLEAN','sequelize','exports','variable','customVariable','keyValue'];(function(_0x3c296a,_0x555723){var _0x1e3084=function(_0x5ce748){while(--_0x5ce748){_0x3c296a['push'](_0x3c296a['shift']());}};_0x1e3084(++_0x555723);}(_0xb8b9,0xee));var _0x9b8b=function(_0x401c6c,_0x33807d){_0x401c6c=_0x401c6c-0x0;var _0x50ab21=_0xb8b9[_0x401c6c];return _0x50ab21;};'use strict';var Sequelize=require(_0x9b8b('0x0'));module[_0x9b8b('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x9b8b('0x2'),_0x9b8b('0x3'),_0x9b8b('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x9b8b('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9b8b('0x6')](_0x9b8b('0x7'),_0x9b8b('0x2'),_0x9b8b('0x3'))},'keyContent':{'type':Sequelize[_0x9b8b('0x5')]},'idField':{'type':Sequelize[_0x9b8b('0x5')]},'nameField':{'type':Sequelize[_0x9b8b('0x5')]},'customField':{'type':Sequelize[_0x9b8b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x518d=['sequelize','ENUM','string','variable','keyValue','picklist','STRING','customVariable','BOOLEAN'];(function(_0x4e6b47,_0x148be6){var _0x2d6e38=function(_0x5cf4ed){while(--_0x5cf4ed){_0x4e6b47['push'](_0x4e6b47['shift']());}};_0x2d6e38(++_0x148be6);}(_0x518d,0x1b0));var _0xd518=function(_0x5d93a9,_0x27e75d){_0x5d93a9=_0x5d93a9-0x0;var _0x35dcb6=_0x518d[_0x5d93a9];return _0x35dcb6;};'use strict';var Sequelize=require(_0xd518('0x0'));module['exports']={'type':{'type':Sequelize[_0xd518('0x1')](_0xd518('0x2'),_0xd518('0x3'),'customVariable',_0xd518('0x4'),_0xd518('0x5')),'defaultValue':_0xd518('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xd518('0x6')]},'keyType':{'type':Sequelize[_0xd518('0x1')]('string',_0xd518('0x3'),_0xd518('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xd518('0x6')]},'nameField':{'type':Sequelize[_0xd518('0x6')]},'customField':{'type':Sequelize[_0xd518('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd518('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index aea21bd..edd4d11 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 _0x11da=['hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','include','findAll','show','params','length','includeAll','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','SugarcrmField','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields'];(function(_0x315aea,_0x318a80){var _0x4a4bdb=function(_0x7c049c){while(--_0x7c049c){_0x315aea['push'](_0x315aea['shift']());}};_0x4a4bdb(++_0x318a80);}(_0x11da,0xf0));var _0xa11d=function(_0x2777d8,_0x17e2e0){_0x2777d8=_0x2777d8-0x0;var _0x29cba8=_0x11da[_0x2777d8];return _0x29cba8;};'use strict';var emlformat=require(_0xa11d('0x0'));var rimraf=require(_0xa11d('0x1'));var zipdir=require(_0xa11d('0x2'));var jsonpatch=require(_0xa11d('0x3'));var rp=require('request-promise');var moment=require(_0xa11d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa11d('0x5'));var util=require(_0xa11d('0x6'));var path=require(_0xa11d('0x7'));var sox=require(_0xa11d('0x8'));var csv=require(_0xa11d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa11d('0xa'));var _=require('lodash');var squel=require(_0xa11d('0xb'));var crypto=require(_0xa11d('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa11d('0x9'));var querystring=require(_0xa11d('0xd'));var Papa=require(_0xa11d('0xe'));var Redis=require(_0xa11d('0xf'));var authService=require(_0xa11d('0x10'));var qs=require(_0xa11d('0x11'));var as=require(_0xa11d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa11d('0x13'));var config=require(_0xa11d('0x14'));var licenseUtil=require(_0xa11d('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4920ac,_0x583f2c){_0x583f2c=_0x583f2c||0xcc;return function(_0x1b5f27){if(_0x1b5f27){return _0x4920ac[_0xa11d('0x16')](_0x583f2c);}return _0x4920ac[_0xa11d('0x17')](_0x583f2c)[_0xa11d('0x18')]();};}function respondWithResult(_0xf9cc5a,_0x2da207){_0x2da207=_0x2da207||0xc8;return function(_0xa49229){if(_0xa49229){return _0xf9cc5a[_0xa11d('0x17')](_0x2da207)[_0xa11d('0x19')](_0xa49229);}};}function respondWithFilteredResult(_0x1b513c,_0x79af13){return function(_0x4bfd52){if(_0x4bfd52){var _0x3e7349=typeof _0x79af13[_0xa11d('0x1a')]===_0xa11d('0x1b')&&typeof _0x79af13[_0xa11d('0x1c')]===_0xa11d('0x1b');var _0x367395=_0x4bfd52[_0xa11d('0x1d')];var _0x41c1d4=_0x3e7349?0x0:_0x79af13[_0xa11d('0x1a')];var _0x476637=_0x3e7349?_0x4bfd52[_0xa11d('0x1d')]:_0x79af13[_0xa11d('0x1a')]+_0x79af13[_0xa11d('0x1c')];var _0x3c50dd;if(_0x476637>=_0x367395){_0x476637=_0x367395;_0x3c50dd=0xc8;}else{_0x3c50dd=0xce;}_0x1b513c[_0xa11d('0x17')](_0x3c50dd);return _0x1b513c[_0xa11d('0x1e')](_0xa11d('0x1f'),_0x41c1d4+'-'+_0x476637+'/'+_0x367395)[_0xa11d('0x19')](_0x4bfd52);}return null;};}function patchUpdates(_0x2c33db){return function(_0x3ff5f6){try{jsonpatch[_0xa11d('0x20')](_0x3ff5f6,_0x2c33db,!![]);}catch(_0x58ebcf){return BPromise[_0xa11d('0x21')](_0x58ebcf);}return _0x3ff5f6['save']();};}function saveUpdates(_0x3c6c43,_0x287fb7){return function(_0x3f2eb5){if(_0x3f2eb5){return _0x3f2eb5[_0xa11d('0x22')](_0x3c6c43)[_0xa11d('0x23')](function(_0x2395bb){return _0x2395bb;});}return null;};}function removeEntity(_0x4365a7,_0x52ad55){return function(_0x4abc90){if(_0x4abc90){return _0x4abc90[_0xa11d('0x24')]()[_0xa11d('0x23')](function(){_0x4365a7[_0xa11d('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c83d4,_0x392fa8){return function(_0x10f73d){if(!_0x10f73d){_0x3c83d4['sendStatus'](0x194);}return _0x10f73d;};}function handleError(_0x314655,_0x29a9b4){_0x29a9b4=_0x29a9b4||0x1f4;return function(_0x2e39fa){logger[_0xa11d('0x25')](_0x2e39fa[_0xa11d('0x26')]);if(_0x2e39fa[_0xa11d('0x27')]){delete _0x2e39fa[_0xa11d('0x27')];}_0x314655['status'](_0x29a9b4)['send'](_0x2e39fa);};}exports[_0xa11d('0x28')]=function(_0x3ac756,_0x13a563){var _0xaa0945={},_0x5e1403={},_0x5aa3f4={'count':0x0,'rows':[]};var _0x3d00d2=_[_0xa11d('0x29')](db[_0xa11d('0x2a')][_0xa11d('0x2b')],function(_0x95f782){return{'name':_0x95f782[_0xa11d('0x2c')],'type':_0x95f782['type'][_0xa11d('0x2d')]};});_0x5e1403[_0xa11d('0x2e')]=_[_0xa11d('0x29')](_0x3d00d2,_0xa11d('0x27'));_0x5e1403[_0xa11d('0x2f')]=_[_0xa11d('0x30')](_0x3ac756[_0xa11d('0x2f')]);_0x5e1403['filters']=_[_0xa11d('0x31')](_0x5e1403['model'],_0x5e1403[_0xa11d('0x2f')]);_0xaa0945[_0xa11d('0x32')]=_['intersection'](_0x5e1403['model'],qs[_0xa11d('0x33')](_0x3ac756['query']['fields']));_0xaa0945[_0xa11d('0x32')]=_0xaa0945['attributes']['length']?_0xaa0945[_0xa11d('0x32')]:_0x5e1403[_0xa11d('0x2e')];if(!_0x3ac756[_0xa11d('0x2f')][_0xa11d('0x34')](_0xa11d('0x35'))){_0xaa0945[_0xa11d('0x1c')]=qs[_0xa11d('0x1c')](_0x3ac756[_0xa11d('0x2f')]['limit']);_0xaa0945[_0xa11d('0x1a')]=qs['offset'](_0x3ac756[_0xa11d('0x2f')][_0xa11d('0x1a')]);}_0xaa0945[_0xa11d('0x36')]=qs[_0xa11d('0x37')](_0x3ac756['query'][_0xa11d('0x37')]);_0xaa0945[_0xa11d('0x38')]=qs[_0xa11d('0x39')](_[_0xa11d('0x3a')](_0x3ac756['query'],_0x5e1403[_0xa11d('0x39')]),_0x3d00d2);if(_0x3ac756[_0xa11d('0x2f')][_0xa11d('0x3b')]){_0xaa0945[_0xa11d('0x38')]=_[_0xa11d('0x3c')](_0xaa0945['where'],{'$or':_[_0xa11d('0x29')](_0x3d00d2,function(_0x3c9e3a){if(_0x3c9e3a[_0xa11d('0x3d')]!==_0xa11d('0x3e')){var _0x3e5a01={};_0x3e5a01[_0x3c9e3a['name']]={'$like':'%'+_0x3ac756['query']['filter']+'%'};return _0x3e5a01;}})});}_0xaa0945=_[_0xa11d('0x3c')]({},_0xaa0945,_0x3ac756[_0xa11d('0x3f')]);var _0x181c0b={'where':_0xaa0945['where']};return db['SugarcrmField'][_0xa11d('0x1d')](_0x181c0b)['then'](function(_0x150f9b){_0x5aa3f4[_0xa11d('0x1d')]=_0x150f9b;if(_0x3ac756[_0xa11d('0x2f')]['includeAll']){_0xaa0945[_0xa11d('0x40')]=[{'all':!![]}];}return db[_0xa11d('0x2a')][_0xa11d('0x41')](_0xaa0945);})[_0xa11d('0x23')](function(_0xed1239){_0x5aa3f4['rows']=_0xed1239;return _0x5aa3f4;})[_0xa11d('0x23')](respondWithFilteredResult(_0x13a563,_0xaa0945))['catch'](handleError(_0x13a563,null));};exports[_0xa11d('0x42')]=function(_0x1f0ce2,_0x371cbe){var _0x133bcf={'raw':!![],'where':{'id':_0x1f0ce2[_0xa11d('0x43')]['id']}},_0x52040c={};_0x52040c[_0xa11d('0x2e')]=_['keys'](db[_0xa11d('0x2a')]['rawAttributes']);_0x52040c['query']=_[_0xa11d('0x30')](_0x1f0ce2[_0xa11d('0x2f')]);_0x52040c['filters']=_[_0xa11d('0x31')](_0x52040c[_0xa11d('0x2e')],_0x52040c[_0xa11d('0x2f')]);_0x133bcf['attributes']=_[_0xa11d('0x31')](_0x52040c[_0xa11d('0x2e')],qs[_0xa11d('0x33')](_0x1f0ce2['query'][_0xa11d('0x33')]));_0x133bcf[_0xa11d('0x32')]=_0x133bcf[_0xa11d('0x32')][_0xa11d('0x44')]?_0x133bcf['attributes']:_0x52040c[_0xa11d('0x2e')];if(_0x1f0ce2['query'][_0xa11d('0x45')]){_0x133bcf[_0xa11d('0x40')]=[{'all':!![]}];}_0x133bcf=_[_0xa11d('0x3c')]({},_0x133bcf,_0x1f0ce2[_0xa11d('0x3f')]);return db[_0xa11d('0x2a')][_0xa11d('0x46')](_0x133bcf)['then'](handleEntityNotFound(_0x371cbe,null))[_0xa11d('0x23')](respondWithResult(_0x371cbe,null))[_0xa11d('0x47')](handleError(_0x371cbe,null));};exports['create']=function(_0x267677,_0x3044aa){return db['SugarcrmField']['create'](_0x267677[_0xa11d('0x48')],{})[_0xa11d('0x23')](respondWithResult(_0x3044aa,0xc9))[_0xa11d('0x47')](handleError(_0x3044aa,null));};exports[_0xa11d('0x22')]=function(_0x4ded72,_0x3f9d6a){if(_0x4ded72[_0xa11d('0x48')]['id']){delete _0x4ded72['body']['id'];}return db[_0xa11d('0x2a')][_0xa11d('0x46')]({'where':{'id':_0x4ded72['params']['id']}})[_0xa11d('0x23')](handleEntityNotFound(_0x3f9d6a,null))[_0xa11d('0x23')](saveUpdates(_0x4ded72['body'],null))[_0xa11d('0x23')](respondWithResult(_0x3f9d6a,null))[_0xa11d('0x47')](handleError(_0x3f9d6a,null));};exports[_0xa11d('0x24')]=function(_0x1c0dc5,_0x320b8e){return db['SugarcrmField'][_0xa11d('0x46')]({'where':{'id':_0x1c0dc5[_0xa11d('0x43')]['id']}})['then'](handleEntityNotFound(_0x320b8e,null))[_0xa11d('0x23')](removeEntity(_0x320b8e,null))[_0xa11d('0x47')](handleError(_0x320b8e,null));}; \ No newline at end of file +var _0x5620=['VIRTUAL','merge','options','SugarcrmField','include','findAll','rows','show','params','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','stack','send','index','map','fieldName','type','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter'];(function(_0x18da77,_0x3976ac){var _0x25c82b=function(_0x1a2a9f){while(--_0x1a2a9f){_0x18da77['push'](_0x18da77['shift']());}};_0x25c82b(++_0x3976ac);}(_0x5620,0xa2));var _0x0562=function(_0x4aa662,_0x1cc90c){_0x4aa662=_0x4aa662-0x0;var _0x336478=_0x5620[_0x4aa662];return _0x336478;};'use strict';var emlformat=require(_0x0562('0x0'));var rimraf=require(_0x0562('0x1'));var zipdir=require(_0x0562('0x2'));var jsonpatch=require(_0x0562('0x3'));var rp=require(_0x0562('0x4'));var moment=require(_0x0562('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0562('0x6'));var util=require(_0x0562('0x7'));var path=require('path');var sox=require(_0x0562('0x8'));var csv=require(_0x0562('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0562('0xa'));var _=require(_0x0562('0xb'));var squel=require(_0x0562('0xc'));var crypto=require('crypto');var jsforce=require(_0x0562('0xd'));var deskjs=require(_0x0562('0xe'));var toCsv=require(_0x0562('0x9'));var querystring=require(_0x0562('0xf'));var Papa=require(_0x0562('0x10'));var Redis=require(_0x0562('0x11'));var authService=require(_0x0562('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0562('0x13'));var hardwareService=require(_0x0562('0x14'));var logger=require(_0x0562('0x15'))('api');var utils=require(_0x0562('0x16'));var config=require(_0x0562('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0562('0x18'))['db'];function respondWithStatusCode(_0x131379,_0x1a380b){_0x1a380b=_0x1a380b||0xcc;return function(_0x29f71d){if(_0x29f71d){return _0x131379[_0x0562('0x19')](_0x1a380b);}return _0x131379[_0x0562('0x1a')](_0x1a380b)[_0x0562('0x1b')]();};}function respondWithResult(_0x7abdab,_0x5e5440){_0x5e5440=_0x5e5440||0xc8;return function(_0x5a7089){if(_0x5a7089){return _0x7abdab['status'](_0x5e5440)[_0x0562('0x1c')](_0x5a7089);}};}function respondWithFilteredResult(_0x4c81fd,_0x4fa890){return function(_0x248263){if(_0x248263){var _0x3009c4=typeof _0x4fa890[_0x0562('0x1d')]===_0x0562('0x1e')&&typeof _0x4fa890[_0x0562('0x1f')]===_0x0562('0x1e');var _0x3dd53e=_0x248263['count'];var _0x43a79c=_0x3009c4?0x0:_0x4fa890[_0x0562('0x1d')];var _0x3bf7c0=_0x3009c4?_0x248263[_0x0562('0x20')]:_0x4fa890[_0x0562('0x1d')]+_0x4fa890[_0x0562('0x1f')];var _0x76d82f;if(_0x3bf7c0>=_0x3dd53e){_0x3bf7c0=_0x3dd53e;_0x76d82f=0xc8;}else{_0x76d82f=0xce;}_0x4c81fd[_0x0562('0x1a')](_0x76d82f);return _0x4c81fd[_0x0562('0x21')](_0x0562('0x22'),_0x43a79c+'-'+_0x3bf7c0+'/'+_0x3dd53e)[_0x0562('0x1c')](_0x248263);}return null;};}function patchUpdates(_0x34e0e4){return function(_0x2bc974){try{jsonpatch['apply'](_0x2bc974,_0x34e0e4,!![]);}catch(_0x57f351){return BPromise[_0x0562('0x23')](_0x57f351);}return _0x2bc974['save']();};}function saveUpdates(_0x547dce,_0x4ed4f8){return function(_0x6d6c30){if(_0x6d6c30){return _0x6d6c30[_0x0562('0x24')](_0x547dce)[_0x0562('0x25')](function(_0x1b9ec7){return _0x1b9ec7;});}return null;};}function removeEntity(_0x3ee522,_0x5a6063){return function(_0x2f87ab){if(_0x2f87ab){return _0x2f87ab[_0x0562('0x26')]()[_0x0562('0x25')](function(){_0x3ee522[_0x0562('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ecfe3,_0xc266d2){return function(_0x4c639e){if(!_0x4c639e){_0x2ecfe3[_0x0562('0x19')](0x194);}return _0x4c639e;};}function handleError(_0x403cf8,_0x201bb4){_0x201bb4=_0x201bb4||0x1f4;return function(_0x5eacf0){logger['error'](_0x5eacf0[_0x0562('0x27')]);if(_0x5eacf0['name']){delete _0x5eacf0['name'];}_0x403cf8['status'](_0x201bb4)[_0x0562('0x28')](_0x5eacf0);};}exports[_0x0562('0x29')]=function(_0x20926e,_0x429752){var _0x1ebec1={},_0x3fa3c4={},_0x115a32={'count':0x0,'rows':[]};var _0x473377=_[_0x0562('0x2a')](db['SugarcrmField']['rawAttributes'],function(_0x46217d){return{'name':_0x46217d[_0x0562('0x2b')],'type':_0x46217d[_0x0562('0x2c')]['key']};});_0x3fa3c4['model']=_[_0x0562('0x2a')](_0x473377,_0x0562('0x2d'));_0x3fa3c4[_0x0562('0x2e')]=_[_0x0562('0x2f')](_0x20926e[_0x0562('0x2e')]);_0x3fa3c4[_0x0562('0x30')]=_[_0x0562('0x31')](_0x3fa3c4[_0x0562('0x32')],_0x3fa3c4[_0x0562('0x2e')]);_0x1ebec1[_0x0562('0x33')]=_[_0x0562('0x31')](_0x3fa3c4[_0x0562('0x32')],qs[_0x0562('0x34')](_0x20926e['query'][_0x0562('0x34')]));_0x1ebec1[_0x0562('0x33')]=_0x1ebec1[_0x0562('0x33')][_0x0562('0x35')]?_0x1ebec1['attributes']:_0x3fa3c4[_0x0562('0x32')];if(!_0x20926e[_0x0562('0x2e')][_0x0562('0x36')](_0x0562('0x37'))){_0x1ebec1[_0x0562('0x1f')]=qs[_0x0562('0x1f')](_0x20926e[_0x0562('0x2e')][_0x0562('0x1f')]);_0x1ebec1[_0x0562('0x1d')]=qs['offset'](_0x20926e[_0x0562('0x2e')]['offset']);}_0x1ebec1['order']=qs[_0x0562('0x38')](_0x20926e[_0x0562('0x2e')][_0x0562('0x38')]);_0x1ebec1[_0x0562('0x39')]=qs[_0x0562('0x30')](_[_0x0562('0x3a')](_0x20926e[_0x0562('0x2e')],_0x3fa3c4[_0x0562('0x30')]),_0x473377);if(_0x20926e[_0x0562('0x2e')][_0x0562('0x3b')]){_0x1ebec1[_0x0562('0x39')]=_['merge'](_0x1ebec1[_0x0562('0x39')],{'$or':_['map'](_0x473377,function(_0x5c3727){if(_0x5c3727[_0x0562('0x2c')]!==_0x0562('0x3c')){var _0x1de521={};_0x1de521[_0x5c3727[_0x0562('0x2d')]]={'$like':'%'+_0x20926e[_0x0562('0x2e')]['filter']+'%'};return _0x1de521;}})});}_0x1ebec1=_[_0x0562('0x3d')]({},_0x1ebec1,_0x20926e[_0x0562('0x3e')]);var _0x15d3cd={'where':_0x1ebec1['where']};return db[_0x0562('0x3f')][_0x0562('0x20')](_0x15d3cd)[_0x0562('0x25')](function(_0x1c6156){_0x115a32['count']=_0x1c6156;if(_0x20926e[_0x0562('0x2e')]['includeAll']){_0x1ebec1[_0x0562('0x40')]=[{'all':!![]}];}return db[_0x0562('0x3f')][_0x0562('0x41')](_0x1ebec1);})[_0x0562('0x25')](function(_0x57c627){_0x115a32[_0x0562('0x42')]=_0x57c627;return _0x115a32;})[_0x0562('0x25')](respondWithFilteredResult(_0x429752,_0x1ebec1))['catch'](handleError(_0x429752,null));};exports[_0x0562('0x43')]=function(_0x26404b,_0x1a9158){var _0x3f2eb5={'raw':!![],'where':{'id':_0x26404b[_0x0562('0x44')]['id']}},_0x11ad3c={};_0x11ad3c[_0x0562('0x32')]=_[_0x0562('0x2f')](db[_0x0562('0x3f')]['rawAttributes']);_0x11ad3c[_0x0562('0x2e')]=_[_0x0562('0x2f')](_0x26404b[_0x0562('0x2e')]);_0x11ad3c[_0x0562('0x30')]=_[_0x0562('0x31')](_0x11ad3c[_0x0562('0x32')],_0x11ad3c[_0x0562('0x2e')]);_0x3f2eb5['attributes']=_['intersection'](_0x11ad3c[_0x0562('0x32')],qs['fields'](_0x26404b[_0x0562('0x2e')]['fields']));_0x3f2eb5[_0x0562('0x33')]=_0x3f2eb5[_0x0562('0x33')][_0x0562('0x35')]?_0x3f2eb5['attributes']:_0x11ad3c[_0x0562('0x32')];if(_0x26404b[_0x0562('0x2e')][_0x0562('0x45')]){_0x3f2eb5[_0x0562('0x40')]=[{'all':!![]}];}_0x3f2eb5=_[_0x0562('0x3d')]({},_0x3f2eb5,_0x26404b[_0x0562('0x3e')]);return db[_0x0562('0x3f')][_0x0562('0x46')](_0x3f2eb5)[_0x0562('0x25')](handleEntityNotFound(_0x1a9158,null))['then'](respondWithResult(_0x1a9158,null))[_0x0562('0x47')](handleError(_0x1a9158,null));};exports[_0x0562('0x48')]=function(_0x17a084,_0x85e574){return db[_0x0562('0x3f')]['create'](_0x17a084['body'],{})[_0x0562('0x25')](respondWithResult(_0x85e574,0xc9))[_0x0562('0x47')](handleError(_0x85e574,null));};exports[_0x0562('0x24')]=function(_0x149312,_0x3625af){if(_0x149312[_0x0562('0x49')]['id']){delete _0x149312[_0x0562('0x49')]['id'];}return db[_0x0562('0x3f')]['find']({'where':{'id':_0x149312[_0x0562('0x44')]['id']}})[_0x0562('0x25')](handleEntityNotFound(_0x3625af,null))[_0x0562('0x25')](saveUpdates(_0x149312[_0x0562('0x49')],null))['then'](respondWithResult(_0x3625af,null))['catch'](handleError(_0x3625af,null));};exports['destroy']=function(_0x135dc4,_0x1c60f5){return db['SugarcrmField']['find']({'where':{'id':_0x135dc4[_0x0562('0x44')]['id']}})[_0x0562('0x25')](handleEntityNotFound(_0x1c60f5,null))[_0x0562('0x25')](removeEntity(_0x1c60f5,null))['catch'](handleError(_0x1c60f5,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 96ffcd0..b07ce04 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 _0x1a45=['FieldId','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField'];(function(_0xa29277,_0x19fef3){var _0x5e68cf=function(_0x149cc7){while(--_0x149cc7){_0xa29277['push'](_0xa29277['shift']());}};_0x5e68cf(++_0x19fef3);}(_0x1a45,0x15f));var _0x51a4=function(_0x37582c,_0x546083){_0x37582c=_0x37582c-0x0;var _0x594acf=_0x1a45[_0x37582c];return _0x594acf;};'use strict';var _=require('lodash');var util=require(_0x51a4('0x0'));var logger=require(_0x51a4('0x1'))(_0x51a4('0x2'));var moment=require(_0x51a4('0x3'));var BPromise=require(_0x51a4('0x4'));var rp=require(_0x51a4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x51a4('0x6'));var attributes=require('./intSugarcrmField.attributes');module[_0x51a4('0x7')]=function(_0x489cb5,_0x459d06){return _0x489cb5[_0x51a4('0x8')](_0x51a4('0x9'),attributes,{'tableName':_0x51a4('0xa'),'paranoid':![],'indexes':[{'name':_0x51a4('0xb'),'fields':[_0x51a4('0xc'),_0x51a4('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2eed=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','SugarcrmField','int_sugarcrm_fields','idField','FieldId','util','../../config/logger','api'];(function(_0x21bfc8,_0x2a67d2){var _0x2029c0=function(_0x637d60){while(--_0x637d60){_0x21bfc8['push'](_0x21bfc8['shift']());}};_0x2029c0(++_0x2a67d2);}(_0x2eed,0x123));var _0xd2ee=function(_0x246377,_0x53641b){_0x246377=_0x246377-0x0;var _0x3ae808=_0x2eed[_0x246377];return _0x3ae808;};'use strict';var _=require('lodash');var util=require(_0xd2ee('0x0'));var logger=require(_0xd2ee('0x1'))(_0xd2ee('0x2'));var moment=require(_0xd2ee('0x3'));var BPromise=require(_0xd2ee('0x4'));var rp=require(_0xd2ee('0x5'));var fs=require('fs');var path=require(_0xd2ee('0x6'));var rimraf=require(_0xd2ee('0x7'));var config=require(_0xd2ee('0x8'));var attributes=require(_0xd2ee('0x9'));module['exports']=function(_0x71901e,_0x41c667){return _0x71901e['define'](_0xd2ee('0xa'),attributes,{'tableName':_0xd2ee('0xb'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xd2ee('0xc'),_0xd2ee('0xd')],'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 761985c..d47c946 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 _0xcbd7=['info','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmField,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x207ddb,_0x465a39){var _0x1e4a06=function(_0x5e4a75){while(--_0x5e4a75){_0x207ddb['push'](_0x207ddb['shift']());}};_0x1e4a06(++_0x465a39);}(_0xcbd7,0xfb));var _0x7cbd=function(_0x485be8,_0x57d5e9){_0x485be8=_0x485be8-0x0;var _0x40e11f=_0xcbd7[_0x485be8];return _0x40e11f;};'use strict';var _=require(_0x7cbd('0x0'));var util=require('util');var moment=require(_0x7cbd('0x1'));var BPromise=require(_0x7cbd('0x2'));var rs=require(_0x7cbd('0x3'));var fs=require('fs');var Redis=require(_0x7cbd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7cbd('0x5'));var logger=require(_0x7cbd('0x6'))(_0x7cbd('0x7'));var config=require(_0x7cbd('0x8'));var jayson=require(_0x7cbd('0x9'));var client=jayson[_0x7cbd('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f5d4e,_0x369b37,_0x52d829){return new BPromise(function(_0x276d6b,_0x454411){return client[_0x7cbd('0xb')](_0x3f5d4e,_0x52d829)[_0x7cbd('0xc')](function(_0x2d5060){logger[_0x7cbd('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x369b37,_0x7cbd('0xe'));logger[_0x7cbd('0xf')](_0x7cbd('0x10'),_0x369b37,_0x7cbd('0xe'),JSON[_0x7cbd('0x11')](_0x2d5060));if(_0x2d5060['error']){if(_0x2d5060[_0x7cbd('0x12')]['code']===0x1f4){logger['error'](_0x7cbd('0x13'),_0x369b37,_0x2d5060[_0x7cbd('0x12')][_0x7cbd('0x14')]);return _0x454411(_0x2d5060[_0x7cbd('0x12')][_0x7cbd('0x14')]);}logger[_0x7cbd('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x369b37,_0x2d5060[_0x7cbd('0x12')][_0x7cbd('0x14')]);return _0x276d6b(_0x2d5060[_0x7cbd('0x12')][_0x7cbd('0x14')]);}else{logger[_0x7cbd('0xd')](_0x7cbd('0x13'),_0x369b37,_0x7cbd('0xe'));_0x276d6b(_0x2d5060[_0x7cbd('0x15')]['message']);}})['catch'](function(_0x275364){logger[_0x7cbd('0x12')](_0x7cbd('0x13'),_0x369b37,_0x275364);_0x454411(_0x275364);});});} \ No newline at end of file +var _0xa61f=['SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x335eca,_0x23bee1){var _0x4a9e78=function(_0x5ef1ec){while(--_0x5ef1ec){_0x335eca['push'](_0x335eca['shift']());}};_0x4a9e78(++_0x23bee1);}(_0xa61f,0x172));var _0xfa61=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa61f[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0xfa61('0x0'));var moment=require(_0xfa61('0x1'));var BPromise=require(_0xfa61('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa61('0x3'));var db=require(_0xfa61('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfa61('0x5'))(_0xfa61('0x6'));var config=require(_0xfa61('0x7'));var jayson=require(_0xfa61('0x8'));var client=jayson[_0xfa61('0x9')][_0xfa61('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2dc6db,_0x4679f9,_0x96493){return new BPromise(function(_0x1b433f,_0x260947){return client[_0xfa61('0xb')](_0x2dc6db,_0x96493)[_0xfa61('0xc')](function(_0x4e9a13){logger[_0xfa61('0xd')](_0xfa61('0xe'),_0x4679f9,_0xfa61('0xf'));logger[_0xfa61('0x10')](_0xfa61('0x11'),_0x4679f9,_0xfa61('0xf'),JSON[_0xfa61('0x12')](_0x4e9a13));if(_0x4e9a13[_0xfa61('0x13')]){if(_0x4e9a13[_0xfa61('0x13')][_0xfa61('0x14')]===0x1f4){logger[_0xfa61('0x13')](_0xfa61('0xe'),_0x4679f9,_0x4e9a13['error'][_0xfa61('0x15')]);return _0x260947(_0x4e9a13[_0xfa61('0x13')][_0xfa61('0x15')]);}logger['error'](_0xfa61('0xe'),_0x4679f9,_0x4e9a13[_0xfa61('0x13')][_0xfa61('0x15')]);return _0x1b433f(_0x4e9a13['error'][_0xfa61('0x15')]);}else{logger['info'](_0xfa61('0xe'),_0x4679f9,_0xfa61('0xf'));_0x1b433f(_0x4e9a13[_0xfa61('0x16')][_0xfa61('0x15')]);}})[_0xfa61('0x17')](function(_0x5e2c1b){logger[_0xfa61('0x13')](_0xfa61('0xe'),_0x4679f9,_0x5e2c1b);_0x260947(_0x5e2c1b);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index c2bcc05..a754f45 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 _0x740a=['addConfiguration','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','getConfigurations','/:id/fields','post','/:id/configurations'];(function(_0x1b0652,_0x8f6d5f){var _0x475ce0=function(_0x26abee){while(--_0x26abee){_0x1b0652['push'](_0x1b0652['shift']());}};_0x475ce0(++_0x8f6d5f);}(_0x740a,0x175));var _0xa740=function(_0x4dac5a,_0x37d35b){_0x4dac5a=_0x4dac5a-0x0;var _0x3efaa0=_0x740a[_0x4dac5a];return _0x3efaa0;};'use strict';var multer=require(_0xa740('0x0'));var util=require(_0xa740('0x1'));var path=require(_0xa740('0x2'));var timeout=require(_0xa740('0x3'));var express=require(_0xa740('0x4'));var router=express[_0xa740('0x5')]();var fs_extra=require(_0xa740('0x6'));var auth=require(_0xa740('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xa740('0x8'));var controller=require('./intVtigerAccount.controller');router['get']('/',auth[_0xa740('0x9')](),controller[_0xa740('0xa')]);router[_0xa740('0xb')](_0xa740('0xc'),auth[_0xa740('0x9')](),controller[_0xa740('0xd')]);router[_0xa740('0xb')]('/:id/configurations',auth[_0xa740('0x9')](),controller[_0xa740('0xe')]);router[_0xa740('0xb')](_0xa740('0xf'),auth[_0xa740('0x9')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xa740('0x10')](_0xa740('0x11'),auth[_0xa740('0x9')](),controller[_0xa740('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xa740('0x13')]);router[_0xa740('0x14')](_0xa740('0xc'),auth[_0xa740('0x9')](),controller[_0xa740('0x15')]);module[_0xa740('0x16')]=router; \ No newline at end of file +var _0x9ca8=['/:id/fields','post','create','addConfiguration','put','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations'];(function(_0x33663a,_0x39e660){var _0x501ef7=function(_0x4e6c87){while(--_0x4e6c87){_0x33663a['push'](_0x33663a['shift']());}};_0x501ef7(++_0x39e660);}(_0x9ca8,0x123));var _0x89ca=function(_0x10852d,_0x4cdcc6){_0x10852d=_0x10852d-0x0;var _0x13a8d6=_0x9ca8[_0x10852d];return _0x13a8d6;};'use strict';var multer=require('multer');var util=require(_0x89ca('0x0'));var path=require('path');var timeout=require(_0x89ca('0x1'));var express=require(_0x89ca('0x2'));var router=express[_0x89ca('0x3')]();var fs_extra=require(_0x89ca('0x4'));var auth=require(_0x89ca('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x89ca('0x6'));var controller=require(_0x89ca('0x7'));router[_0x89ca('0x8')]('/',auth[_0x89ca('0x9')](),controller[_0x89ca('0xa')]);router[_0x89ca('0x8')](_0x89ca('0xb'),auth[_0x89ca('0x9')](),controller['show']);router['get'](_0x89ca('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x89ca('0x8')](_0x89ca('0xd'),auth[_0x89ca('0x9')](),controller['getFields']);router[_0x89ca('0xe')]('/',auth[_0x89ca('0x9')](),controller[_0x89ca('0xf')]);router[_0x89ca('0xe')](_0x89ca('0xc'),auth[_0x89ca('0x9')](),controller[_0x89ca('0x10')]);router[_0x89ca('0x11')](_0x89ca('0xb'),auth[_0x89ca('0x9')](),controller['update']);router['delete'](_0x89ca('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x89ca('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index bf726bc..562e0c3 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 _0x74e4=['HelpDesk','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x74e4,0x91));var _0x474e=function(_0x3f3c17,_0x29adbb){_0x3f3c17=_0x3f3c17-0x0;var _0x23b31d=_0x74e4[_0x3f3c17];return _0x23b31d;};'use strict';var Sequelize=require(_0x474e('0x0'));module[_0x474e('0x1')]={'name':{'type':Sequelize[_0x474e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x474e('0x2')]},'username':{'type':Sequelize[_0x474e('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x474e('0x2')],'allowNull':![],'defaultValue':_0x474e('0x3')},'remoteUri':{'type':Sequelize[_0x474e('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x474e('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x06af=['exports','STRING','HelpDesk','sequelize'];(function(_0x2d2ec8,_0x3f04b1){var _0x30e4e9=function(_0x2fc3d6){while(--_0x2fc3d6){_0x2d2ec8['push'](_0x2d2ec8['shift']());}};_0x30e4e9(++_0x3f04b1);}(_0x06af,0x123));var _0xf06a=function(_0x1e691f,_0x275b60){_0x1e691f=_0x1e691f-0x0;var _0x51c7e8=_0x06af[_0x1e691f];return _0x51c7e8;};'use strict';var Sequelize=require(_0xf06a('0x0'));module[_0xf06a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xf06a('0x2')]},'username':{'type':Sequelize[_0xf06a('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xf06a('0x2')],'allowNull':![],'defaultValue':_0xf06a('0x3')},'remoteUri':{'type':Sequelize[_0xf06a('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xf06a('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xf06a('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index e6a91b6..aa89bb1 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 _0xe02b=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','undefined','count','offset','limit','set','json','apply','reject','save','update','then','destroy','end','sendStatus','error','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','sort','filter','merge','where','options','rows','catch','show','params','keys','includeAll','include','find','create','body','getConfigurations','VtigerConfiguration','order','pick','hasOwnProperty','nolimit','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','VtigerField','md5','getFields','findOne','username','description','serverUrl','accessKey','remoteUri','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','result','sessionName','reference','remove','editable','label','startsWith','cf_','picklist','picklistValues','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x1ad53c,_0x13ebf8){var _0x33afe4=function(_0x2fa995){while(--_0x2fa995){_0x1ad53c['push'](_0x1ad53c['shift']());}};_0x33afe4(++_0x13ebf8);}(_0xe02b,0x15c));var _0xbe02=function(_0x44053d,_0x33b5c4){_0x44053d=_0x44053d-0x0;var _0x345f76=_0xe02b[_0x44053d];return _0x345f76;};'use strict';var emlformat=require(_0xbe02('0x0'));var rimraf=require(_0xbe02('0x1'));var zipdir=require(_0xbe02('0x2'));var jsonpatch=require(_0xbe02('0x3'));var rp=require(_0xbe02('0x4'));var moment=require(_0xbe02('0x5'));var BPromise=require(_0xbe02('0x6'));var Mustache=require(_0xbe02('0x7'));var util=require(_0xbe02('0x8'));var path=require(_0xbe02('0x9'));var sox=require(_0xbe02('0xa'));var csv=require(_0xbe02('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbe02('0xc'));var _=require('lodash');var squel=require(_0xbe02('0xd'));var crypto=require(_0xbe02('0xe'));var jsforce=require(_0xbe02('0xf'));var deskjs=require(_0xbe02('0x10'));var toCsv=require(_0xbe02('0xb'));var querystring=require('querystring');var Papa=require(_0xbe02('0x11'));var Redis=require(_0xbe02('0x12'));var authService=require(_0xbe02('0x13'));var qs=require(_0xbe02('0x14'));var as=require(_0xbe02('0x15'));var hardwareService=require(_0xbe02('0x16'));var logger=require(_0xbe02('0x17'))(_0xbe02('0x18'));var utils=require(_0xbe02('0x19'));var config=require(_0xbe02('0x1a'));var licenseUtil=require(_0xbe02('0x1b'));var db=require(_0xbe02('0x1c'))['db'];var integrations=require(_0xbe02('0x1d'));function respondWithStatusCode(_0xce99d7,_0x1ca2a3){_0x1ca2a3=_0x1ca2a3||0xcc;return function(_0x27e493){if(_0x27e493){return _0xce99d7['sendStatus'](_0x1ca2a3);}return _0xce99d7[_0xbe02('0x1e')](_0x1ca2a3)['end']();};}function respondWithResult(_0x3b82e4,_0x2cb2e2){_0x2cb2e2=_0x2cb2e2||0xc8;return function(_0x2a9576){if(_0x2a9576){return _0x3b82e4[_0xbe02('0x1e')](_0x2cb2e2)['json'](_0x2a9576);}};}function respondWithFilteredResult(_0x405597,_0x91cae3){return function(_0x31d7b6){if(_0x31d7b6){var _0x545c3d=typeof _0x91cae3['offset']===_0xbe02('0x1f')&&typeof _0x91cae3['limit']===_0xbe02('0x1f');var _0x3710a1=_0x31d7b6[_0xbe02('0x20')];var _0x40b9b2=_0x545c3d?0x0:_0x91cae3[_0xbe02('0x21')];var _0x1c9b7c=_0x545c3d?_0x31d7b6[_0xbe02('0x20')]:_0x91cae3[_0xbe02('0x21')]+_0x91cae3[_0xbe02('0x22')];var _0x221012;if(_0x1c9b7c>=_0x3710a1){_0x1c9b7c=_0x3710a1;_0x221012=0xc8;}else{_0x221012=0xce;}_0x405597['status'](_0x221012);return _0x405597[_0xbe02('0x23')]('Content-Range',_0x40b9b2+'-'+_0x1c9b7c+'/'+_0x3710a1)[_0xbe02('0x24')](_0x31d7b6);}return null;};}function patchUpdates(_0x245c22){return function(_0x1477b0){try{jsonpatch[_0xbe02('0x25')](_0x1477b0,_0x245c22,!![]);}catch(_0x29cedc){return BPromise[_0xbe02('0x26')](_0x29cedc);}return _0x1477b0[_0xbe02('0x27')]();};}function saveUpdates(_0x578856,_0xeaa08e){return function(_0xb57f32){if(_0xb57f32){return _0xb57f32[_0xbe02('0x28')](_0x578856)[_0xbe02('0x29')](function(_0x5ae446){return _0x5ae446;});}return null;};}function removeEntity(_0x450b61,_0x411f8f){return function(_0x278ce1){if(_0x278ce1){return _0x278ce1[_0xbe02('0x2a')]()[_0xbe02('0x29')](function(){_0x450b61[_0xbe02('0x1e')](0xcc)[_0xbe02('0x2b')]();});}};}function handleEntityNotFound(_0x21e1a8,_0x38e725){return function(_0x33a3dd){if(!_0x33a3dd){_0x21e1a8[_0xbe02('0x2c')](0x194);}return _0x33a3dd;};}function handleError(_0x17202a,_0x39c61f){_0x39c61f=_0x39c61f||0x1f4;return function(_0x4b5d3e){logger[_0xbe02('0x2d')](_0x4b5d3e['stack']);if(_0x4b5d3e[_0xbe02('0x2e')]){delete _0x4b5d3e[_0xbe02('0x2e')];}_0x17202a[_0xbe02('0x1e')](_0x39c61f)[_0xbe02('0x2f')](_0x4b5d3e);};}exports[_0xbe02('0x30')]=function(_0x569422,_0xb996e7){var _0x39bd71={},_0x10a2ce={},_0x72e365={'count':0x0,'rows':[]};var _0x418682=_[_0xbe02('0x31')](db[_0xbe02('0x32')][_0xbe02('0x33')],function(_0x48efe2){return{'name':_0x48efe2[_0xbe02('0x34')],'type':_0x48efe2[_0xbe02('0x35')][_0xbe02('0x36')]};});_0x10a2ce['model']=_['map'](_0x418682,_0xbe02('0x2e'));_0x10a2ce[_0xbe02('0x37')]=_['keys'](_0x569422['query']);_0x10a2ce[_0xbe02('0x38')]=_[_0xbe02('0x39')](_0x10a2ce[_0xbe02('0x3a')],_0x10a2ce[_0xbe02('0x37')]);_0x39bd71[_0xbe02('0x3b')]=_[_0xbe02('0x39')](_0x10a2ce[_0xbe02('0x3a')],qs[_0xbe02('0x3c')](_0x569422['query'][_0xbe02('0x3c')]));_0x39bd71[_0xbe02('0x3b')]=_0x39bd71[_0xbe02('0x3b')][_0xbe02('0x3d')]?_0x39bd71[_0xbe02('0x3b')]:_0x10a2ce[_0xbe02('0x3a')];if(!_0x569422['query']['hasOwnProperty']('nolimit')){_0x39bd71[_0xbe02('0x22')]=qs[_0xbe02('0x22')](_0x569422[_0xbe02('0x37')][_0xbe02('0x22')]);_0x39bd71[_0xbe02('0x21')]=qs['offset'](_0x569422[_0xbe02('0x37')][_0xbe02('0x21')]);}_0x39bd71['order']=qs[_0xbe02('0x3e')](_0x569422[_0xbe02('0x37')][_0xbe02('0x3e')]);_0x39bd71['where']=qs[_0xbe02('0x38')](_['pick'](_0x569422[_0xbe02('0x37')],_0x10a2ce[_0xbe02('0x38')]),_0x418682);if(_0x569422[_0xbe02('0x37')][_0xbe02('0x3f')]){_0x39bd71['where']=_[_0xbe02('0x40')](_0x39bd71[_0xbe02('0x41')],{'$or':_['map'](_0x418682,function(_0x4248be){if(_0x4248be[_0xbe02('0x35')]!=='VIRTUAL'){var _0x33e7e4={};_0x33e7e4[_0x4248be[_0xbe02('0x2e')]]={'$like':'%'+_0x569422[_0xbe02('0x37')][_0xbe02('0x3f')]+'%'};return _0x33e7e4;}})});}_0x39bd71=_[_0xbe02('0x40')]({},_0x39bd71,_0x569422[_0xbe02('0x42')]);var _0x28ced0={'where':_0x39bd71[_0xbe02('0x41')]};return db[_0xbe02('0x32')]['count'](_0x28ced0)['then'](function(_0x509461){_0x72e365[_0xbe02('0x20')]=_0x509461;if(_0x569422[_0xbe02('0x37')]['includeAll']){_0x39bd71['include']=[{'all':!![]}];}return db[_0xbe02('0x32')]['findAll'](_0x39bd71);})[_0xbe02('0x29')](function(_0x12ac3e){_0x72e365[_0xbe02('0x43')]=_0x12ac3e;return _0x72e365;})[_0xbe02('0x29')](respondWithFilteredResult(_0xb996e7,_0x39bd71))[_0xbe02('0x44')](handleError(_0xb996e7,null));};exports[_0xbe02('0x45')]=function(_0x2445bd,_0x408558){var _0x12edb7={'raw':![],'where':{'id':_0x2445bd[_0xbe02('0x46')]['id']}},_0xa51d8c={};_0xa51d8c[_0xbe02('0x3a')]=_['keys'](db['VtigerAccount'][_0xbe02('0x33')]);_0xa51d8c[_0xbe02('0x37')]=_[_0xbe02('0x47')](_0x2445bd['query']);_0xa51d8c[_0xbe02('0x38')]=_[_0xbe02('0x39')](_0xa51d8c[_0xbe02('0x3a')],_0xa51d8c[_0xbe02('0x37')]);_0x12edb7[_0xbe02('0x3b')]=_[_0xbe02('0x39')](_0xa51d8c['model'],qs[_0xbe02('0x3c')](_0x2445bd[_0xbe02('0x37')]['fields']));_0x12edb7[_0xbe02('0x3b')]=_0x12edb7[_0xbe02('0x3b')]['length']?_0x12edb7[_0xbe02('0x3b')]:_0xa51d8c[_0xbe02('0x3a')];if(_0x2445bd[_0xbe02('0x37')][_0xbe02('0x48')]){_0x12edb7[_0xbe02('0x49')]=[{'all':!![]}];}_0x12edb7=_[_0xbe02('0x40')]({},_0x12edb7,_0x2445bd[_0xbe02('0x42')]);return db['VtigerAccount'][_0xbe02('0x4a')](_0x12edb7)[_0xbe02('0x29')](handleEntityNotFound(_0x408558,null))[_0xbe02('0x29')](respondWithResult(_0x408558,null))[_0xbe02('0x44')](handleError(_0x408558,null));};exports[_0xbe02('0x4b')]=function(_0x52ed90,_0x9cc995){return db['VtigerAccount'][_0xbe02('0x4b')](_0x52ed90[_0xbe02('0x4c')],{})[_0xbe02('0x29')](respondWithResult(_0x9cc995,0xc9))[_0xbe02('0x44')](handleError(_0x9cc995,null));};exports['update']=function(_0x2c60cf,_0x375bc2){if(_0x2c60cf[_0xbe02('0x4c')]['id']){delete _0x2c60cf[_0xbe02('0x4c')]['id'];}return db[_0xbe02('0x32')]['find']({'where':{'id':_0x2c60cf[_0xbe02('0x46')]['id']}})[_0xbe02('0x29')](handleEntityNotFound(_0x375bc2,null))['then'](saveUpdates(_0x2c60cf[_0xbe02('0x4c')],null))[_0xbe02('0x29')](respondWithResult(_0x375bc2,null))[_0xbe02('0x44')](handleError(_0x375bc2,null));};exports[_0xbe02('0x2a')]=function(_0x47de59,_0x2c17a7){return db[_0xbe02('0x32')][_0xbe02('0x4a')]({'where':{'id':_0x47de59[_0xbe02('0x46')]['id']}})[_0xbe02('0x29')](handleEntityNotFound(_0x2c17a7,null))[_0xbe02('0x29')](removeEntity(_0x2c17a7,null))[_0xbe02('0x44')](handleError(_0x2c17a7,null));};exports[_0xbe02('0x4d')]=function(_0x1e1940,_0x10a533,_0x371278){var _0x47cee1={};var _0x53ecf4={};var _0x40e87d;var _0x7c6674;return db[_0xbe02('0x32')]['findOne']({'where':{'id':_0x1e1940['params']['id']}})[_0xbe02('0x29')](handleEntityNotFound(_0x10a533,null))[_0xbe02('0x29')](function(_0x52272a){if(_0x52272a){_0x40e87d=_0x52272a;_0x53ecf4[_0xbe02('0x3a')]=_[_0xbe02('0x47')](db[_0xbe02('0x4e')][_0xbe02('0x33')]);_0x53ecf4['query']=_[_0xbe02('0x47')](_0x1e1940[_0xbe02('0x37')]);_0x53ecf4['filters']=_[_0xbe02('0x39')](_0x53ecf4[_0xbe02('0x3a')],_0x53ecf4[_0xbe02('0x37')]);_0x47cee1[_0xbe02('0x3b')]=_[_0xbe02('0x39')](_0x53ecf4[_0xbe02('0x3a')],qs['fields'](_0x1e1940[_0xbe02('0x37')]['fields']));_0x47cee1[_0xbe02('0x3b')]=_0x47cee1[_0xbe02('0x3b')][_0xbe02('0x3d')]?_0x47cee1[_0xbe02('0x3b')]:_0x53ecf4[_0xbe02('0x3a')];_0x47cee1[_0xbe02('0x4f')]=qs[_0xbe02('0x3e')](_0x1e1940[_0xbe02('0x37')]['sort']);_0x47cee1[_0xbe02('0x41')]=qs['filters'](_[_0xbe02('0x50')](_0x1e1940[_0xbe02('0x37')],_0x53ecf4[_0xbe02('0x38')]));if(_0x1e1940[_0xbe02('0x37')][_0xbe02('0x3f')]){_0x47cee1[_0xbe02('0x41')]=_['merge'](_0x47cee1[_0xbe02('0x41')],{'$or':_[_0xbe02('0x31')](_0x47cee1['attributes'],function(_0x3648b7){var _0x1dc5df={};_0x1dc5df[_0x3648b7]={'$like':'%'+_0x1e1940['query'][_0xbe02('0x3f')]+'%'};return _0x1dc5df;})});}_0x47cee1=_[_0xbe02('0x40')]({},_0x47cee1,_0x1e1940[_0xbe02('0x42')]);return _0x40e87d[_0xbe02('0x4d')](_0x47cee1);}})[_0xbe02('0x29')](function(_0x2e831e){if(_0x2e831e){_0x7c6674=_0x2e831e[_0xbe02('0x3d')];if(!_0x1e1940['query'][_0xbe02('0x51')](_0xbe02('0x52'))){_0x47cee1[_0xbe02('0x22')]=qs['limit'](_0x1e1940[_0xbe02('0x37')][_0xbe02('0x22')]);_0x47cee1[_0xbe02('0x21')]=qs[_0xbe02('0x21')](_0x1e1940['query'][_0xbe02('0x21')]);}return _0x40e87d[_0xbe02('0x4d')](_0x47cee1);}})[_0xbe02('0x29')](function(_0x508801){if(_0x508801){return _0x508801?{'count':_0x7c6674,'rows':_0x508801}:null;}})[_0xbe02('0x29')](respondWithResult(_0x10a533,null))['catch'](handleError(_0x10a533,null));};exports['addConfiguration']=function(_0x3b1d3b,_0x15488d,_0x2a33c9){if(_0x3b1d3b['body']['id']){delete _0x3b1d3b[_0xbe02('0x4c')]['id'];}return db['VtigerAccount']['findOne']({'where':{'id':_0x3b1d3b['params']['id']}})['then'](handleEntityNotFound(_0x15488d,null))[_0xbe02('0x29')](function(_0x9d388d){if(_0x9d388d){_0x3b1d3b['body'][_0xbe02('0x53')]=_0x9d388d['id'];_0x3b1d3b[_0xbe02('0x4c')][_0xbe02('0x54')]=integrations[_0xbe02('0x55')](_0x3b1d3b[_0xbe02('0x4c')]['channel'],_0x3b1d3b[_0xbe02('0x4c')][_0xbe02('0x35')]);_0x3b1d3b['body'][_0xbe02('0x56')]=integrations[_0xbe02('0x57')](_0x3b1d3b[_0xbe02('0x4c')][_0xbe02('0x58')],_0x3b1d3b[_0xbe02('0x4c')][_0xbe02('0x35')]);return db[_0xbe02('0x4e')][_0xbe02('0x4b')](_0x3b1d3b['body'],{'include':[{'model':db[_0xbe02('0x59')],'as':_0xbe02('0x54')},{'model':db[_0xbe02('0x59')],'as':'Descriptions'}]});}return null;})[_0xbe02('0x29')](respondWithResult(_0x15488d,null))[_0xbe02('0x44')](handleError(_0x15488d,null));};var md5=require(_0xbe02('0x5a'));exports[_0xbe02('0x5b')]=function(_0x11f59d,_0x29b39c,_0x6a1264){var _0x342406=null;var _0x248c7d=null;var _0x4b5436=null;var _0x2b7195=null;var _0x3aef91='';return db[_0xbe02('0x32')][_0xbe02('0x5c')]({'where':{'id':_0x11f59d[_0xbe02('0x46')]['id']},'attributes':['id','name',_0xbe02('0x5d'),_0xbe02('0x5e'),'moduleName','remoteUri',_0xbe02('0x5f'),_0xbe02('0x60')]})['then'](handleEntityNotFound(_0x29b39c,null))[_0xbe02('0x29')](function(_0x99759e){if(_0x99759e){_0x342406=_0x99759e['username'];_0x248c7d=_0x99759e[_0xbe02('0x60')];_0x4b5436=_0x99759e['moduleName'];_0x3aef91=_0x99759e[_0xbe02('0x61')];var _0x3782f4=_0x3aef91[_0xbe02('0x62')](-0x1);if(_0x3782f4==='/'){_0x3aef91=_0x3aef91[_0xbe02('0x63')](0x0,_0x3aef91[_0xbe02('0x64')](_0x3782f4));}_0x2b7195=util[_0xbe02('0x65')](_0xbe02('0x66'),_0x3aef91);var _0x13a583={'method':_0xbe02('0x67'),'uri':_0x2b7195,'qs':{'operation':_0xbe02('0x68'),'username':_0x99759e[_0xbe02('0x5d')]},'json':!![]};return rp(_0x13a583);}})[_0xbe02('0x29')](function(_0x29e479){if(_0x29e479[_0xbe02('0x69')]){var _0x33f44c={'method':_0xbe02('0x6a'),'uri':_0x2b7195,'form':{'operation':'login','username':_0x342406,'accessKey':md5(_0x29e479[_0xbe02('0x6b')]['token']+_0x248c7d)},'json':!![]};return rp(_0x33f44c);}})['then'](function(_0x532198){if(_0x532198[_0xbe02('0x69')]){var _0x353b22={'method':_0xbe02('0x67'),'uri':_0x2b7195,'qs':{'operation':'describe','username':_0x342406,'sessionName':_0x532198[_0xbe02('0x6b')][_0xbe02('0x6c')],'elementType':_0x4b5436},'json':!![]};return rp(_0x353b22);}})[_0xbe02('0x29')](function(_0x12cfb9){if(_0x12cfb9['success']){var _0x5c8cdd=['autogenerated',_0xbe02('0x6d'),'owner'];_[_0xbe02('0x6e')](_0x12cfb9[_0xbe02('0x6b')][_0xbe02('0x3c')],function(_0x35dc36){return _0x5c8cdd['includes'](_0x35dc36[_0xbe02('0x35')]['name']);});_[_0xbe02('0x6e')](_0x12cfb9['result'][_0xbe02('0x3c')],function(_0x321e9e){return _0x321e9e[_0xbe02('0x6f')]==='false';});return{'count':_0x12cfb9[_0xbe02('0x6b')][_0xbe02('0x3c')][_0xbe02('0x3d')],'rows':_['map'](_0x12cfb9[_0xbe02('0x6b')][_0xbe02('0x3c')],function(_0x474898){return{'id':_0x474898[_0xbe02('0x2e')],'name':_0x474898[_0xbe02('0x70')],'custom':_[_0xbe02('0x71')](_0x474898[_0xbe02('0x2e')],_0xbe02('0x72'))?!![]:![],'options':_0x474898[_0xbe02('0x35')][_0xbe02('0x2e')]===_0xbe02('0x73')&&_0x474898[_0xbe02('0x35')][_0xbe02('0x74')][_0xbe02('0x3d')]>0x0?_[_0xbe02('0x31')](_0x474898['type'][_0xbe02('0x74')],function(_0x56079b){return{'name':_0x56079b['label'],'value':_0x56079b[_0xbe02('0x75')]};}):[]};})};}})['then'](respondWithResult(_0x29b39c,null))['catch'](function(_0x1f95b6){console['log']('vTiger\x20error:\x20'+_0x1f95b6);var _0x180ece=_0x11f59d[_0xbe02('0x37')][_0xbe02('0x76')]?0x1f4:_0x1f95b6[_0xbe02('0x77')]||0x1f4;logger[_0xbe02('0x2d')](_0xbe02('0x78'),'getFields',_0x180ece,JSON[_0xbe02('0x79')](_0x1f95b6));delete _0x1f95b6[_0xbe02('0x2e')];if(_0x180ece===0x191){_0x180ece=0x190;}_0x29b39c[_0xbe02('0x1e')](_0x180ece)[_0xbe02('0x2f')](_0x11f59d[_0xbe02('0x37')][_0xbe02('0x76')]?{'message':_0xbe02('0x7a'),'statusCode':_0x1f95b6['statusCode']}:_0x1f95b6);});}; \ No newline at end of file +var _0xac44=['index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','VtigerAccount','findAll','rows','catch','keys','find','create','body','params','findOne','VtigerConfiguration','getConfigurations','limit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','GET','getchallenge','success','POST','token','describe','result','autogenerated','reference','remove','editable','false','cf_','picklist','picklistValues','value','vTiger\x20error:\x20','test','statusCode','error','stringify','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','end','stack','name','send'];(function(_0x15caa5,_0x206c67){var _0x1200c7=function(_0x209813){while(--_0x209813){_0x15caa5['push'](_0x15caa5['shift']());}};_0x1200c7(++_0x206c67);}(_0xac44,0xc9));var _0x4ac4=function(_0x2977b2,_0x46417e){_0x2977b2=_0x2977b2-0x0;var _0x410e76=_0xac44[_0x2977b2];return _0x410e76;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4ac4('0x0'));var zipdir=require(_0x4ac4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4ac4('0x2'));var moment=require(_0x4ac4('0x3'));var BPromise=require(_0x4ac4('0x4'));var Mustache=require(_0x4ac4('0x5'));var util=require('util');var path=require(_0x4ac4('0x6'));var sox=require('sox');var csv=require(_0x4ac4('0x7'));var ejs=require(_0x4ac4('0x8'));var fs=require('fs');var fs_extra=require(_0x4ac4('0x9'));var _=require(_0x4ac4('0xa'));var squel=require(_0x4ac4('0xb'));var crypto=require(_0x4ac4('0xc'));var jsforce=require(_0x4ac4('0xd'));var deskjs=require(_0x4ac4('0xe'));var toCsv=require(_0x4ac4('0x7'));var querystring=require(_0x4ac4('0xf'));var Papa=require(_0x4ac4('0x10'));var Redis=require(_0x4ac4('0x11'));var authService=require(_0x4ac4('0x12'));var qs=require(_0x4ac4('0x13'));var as=require(_0x4ac4('0x14'));var hardwareService=require(_0x4ac4('0x15'));var logger=require(_0x4ac4('0x16'))(_0x4ac4('0x17'));var utils=require(_0x4ac4('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x4ac4('0x19'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1c0d39,_0x112bc7){_0x112bc7=_0x112bc7||0xcc;return function(_0x9a617e){if(_0x9a617e){return _0x1c0d39[_0x4ac4('0x1a')](_0x112bc7);}return _0x1c0d39[_0x4ac4('0x1b')](_0x112bc7)['end']();};}function respondWithResult(_0x226a92,_0x39cbdb){_0x39cbdb=_0x39cbdb||0xc8;return function(_0x3edb70){if(_0x3edb70){return _0x226a92[_0x4ac4('0x1b')](_0x39cbdb)[_0x4ac4('0x1c')](_0x3edb70);}};}function respondWithFilteredResult(_0x4de2d9,_0x30956c){return function(_0x4a6441){if(_0x4a6441){var _0x184734=typeof _0x30956c[_0x4ac4('0x1d')]===_0x4ac4('0x1e')&&typeof _0x30956c['limit']===_0x4ac4('0x1e');var _0x2fb133=_0x4a6441[_0x4ac4('0x1f')];var _0x43a9d4=_0x184734?0x0:_0x30956c[_0x4ac4('0x1d')];var _0x49f202=_0x184734?_0x4a6441[_0x4ac4('0x1f')]:_0x30956c[_0x4ac4('0x1d')]+_0x30956c['limit'];var _0x3524e7;if(_0x49f202>=_0x2fb133){_0x49f202=_0x2fb133;_0x3524e7=0xc8;}else{_0x3524e7=0xce;}_0x4de2d9[_0x4ac4('0x1b')](_0x3524e7);return _0x4de2d9[_0x4ac4('0x20')]('Content-Range',_0x43a9d4+'-'+_0x49f202+'/'+_0x2fb133)['json'](_0x4a6441);}return null;};}function patchUpdates(_0x33d385){return function(_0x54320c){try{jsonpatch[_0x4ac4('0x21')](_0x54320c,_0x33d385,!![]);}catch(_0x19e7e7){return BPromise[_0x4ac4('0x22')](_0x19e7e7);}return _0x54320c[_0x4ac4('0x23')]();};}function saveUpdates(_0x2a23a7,_0x22cbe9){return function(_0x34bb1a){if(_0x34bb1a){return _0x34bb1a[_0x4ac4('0x24')](_0x2a23a7)[_0x4ac4('0x25')](function(_0x445e37){return _0x445e37;});}return null;};}function removeEntity(_0x5efaff,_0x1bd8b0){return function(_0x482260){if(_0x482260){return _0x482260[_0x4ac4('0x26')]()[_0x4ac4('0x25')](function(){_0x5efaff['status'](0xcc)[_0x4ac4('0x27')]();});}};}function handleEntityNotFound(_0x4c6293,_0x41aac7){return function(_0x1e8169){if(!_0x1e8169){_0x4c6293[_0x4ac4('0x1a')](0x194);}return _0x1e8169;};}function handleError(_0x5162a5,_0x245e5e){_0x245e5e=_0x245e5e||0x1f4;return function(_0x3dc5de){logger['error'](_0x3dc5de[_0x4ac4('0x28')]);if(_0x3dc5de[_0x4ac4('0x29')]){delete _0x3dc5de[_0x4ac4('0x29')];}_0x5162a5['status'](_0x245e5e)[_0x4ac4('0x2a')](_0x3dc5de);};}exports[_0x4ac4('0x2b')]=function(_0xb9ee6d,_0x1ee504){var _0x2aa166={},_0x5683da={},_0x5c4006={'count':0x0,'rows':[]};var _0x380588=_[_0x4ac4('0x2c')](db['VtigerAccount'][_0x4ac4('0x2d')],function(_0x267787){return{'name':_0x267787[_0x4ac4('0x2e')],'type':_0x267787[_0x4ac4('0x2f')][_0x4ac4('0x30')]};});_0x5683da['model']=_['map'](_0x380588,_0x4ac4('0x29'));_0x5683da[_0x4ac4('0x31')]=_['keys'](_0xb9ee6d[_0x4ac4('0x31')]);_0x5683da[_0x4ac4('0x32')]=_[_0x4ac4('0x33')](_0x5683da[_0x4ac4('0x34')],_0x5683da['query']);_0x2aa166[_0x4ac4('0x35')]=_[_0x4ac4('0x33')](_0x5683da['model'],qs[_0x4ac4('0x36')](_0xb9ee6d[_0x4ac4('0x31')][_0x4ac4('0x36')]));_0x2aa166['attributes']=_0x2aa166[_0x4ac4('0x35')][_0x4ac4('0x37')]?_0x2aa166[_0x4ac4('0x35')]:_0x5683da[_0x4ac4('0x34')];if(!_0xb9ee6d[_0x4ac4('0x31')][_0x4ac4('0x38')](_0x4ac4('0x39'))){_0x2aa166['limit']=qs['limit'](_0xb9ee6d[_0x4ac4('0x31')]['limit']);_0x2aa166[_0x4ac4('0x1d')]=qs[_0x4ac4('0x1d')](_0xb9ee6d[_0x4ac4('0x31')]['offset']);}_0x2aa166[_0x4ac4('0x3a')]=qs[_0x4ac4('0x3b')](_0xb9ee6d[_0x4ac4('0x31')][_0x4ac4('0x3b')]);_0x2aa166[_0x4ac4('0x3c')]=qs['filters'](_[_0x4ac4('0x3d')](_0xb9ee6d[_0x4ac4('0x31')],_0x5683da[_0x4ac4('0x32')]),_0x380588);if(_0xb9ee6d['query']['filter']){_0x2aa166[_0x4ac4('0x3c')]=_[_0x4ac4('0x3e')](_0x2aa166[_0x4ac4('0x3c')],{'$or':_[_0x4ac4('0x2c')](_0x380588,function(_0x1037a1){if(_0x1037a1[_0x4ac4('0x2f')]!==_0x4ac4('0x3f')){var _0x110755={};_0x110755[_0x1037a1[_0x4ac4('0x29')]]={'$like':'%'+_0xb9ee6d[_0x4ac4('0x31')][_0x4ac4('0x40')]+'%'};return _0x110755;}})});}_0x2aa166=_[_0x4ac4('0x3e')]({},_0x2aa166,_0xb9ee6d[_0x4ac4('0x41')]);var _0xfcf577={'where':_0x2aa166['where']};return db['VtigerAccount'][_0x4ac4('0x1f')](_0xfcf577)[_0x4ac4('0x25')](function(_0x2fb11f){_0x5c4006[_0x4ac4('0x1f')]=_0x2fb11f;if(_0xb9ee6d['query'][_0x4ac4('0x42')]){_0x2aa166[_0x4ac4('0x43')]=[{'all':!![]}];}return db[_0x4ac4('0x44')][_0x4ac4('0x45')](_0x2aa166);})['then'](function(_0x2d1731){_0x5c4006[_0x4ac4('0x46')]=_0x2d1731;return _0x5c4006;})[_0x4ac4('0x25')](respondWithFilteredResult(_0x1ee504,_0x2aa166))[_0x4ac4('0x47')](handleError(_0x1ee504,null));};exports['show']=function(_0x3e3749,_0x189623){var _0x1f1889={'raw':![],'where':{'id':_0x3e3749['params']['id']}},_0x96802c={};_0x96802c[_0x4ac4('0x34')]=_[_0x4ac4('0x48')](db['VtigerAccount']['rawAttributes']);_0x96802c[_0x4ac4('0x31')]=_[_0x4ac4('0x48')](_0x3e3749['query']);_0x96802c[_0x4ac4('0x32')]=_[_0x4ac4('0x33')](_0x96802c[_0x4ac4('0x34')],_0x96802c[_0x4ac4('0x31')]);_0x1f1889[_0x4ac4('0x35')]=_[_0x4ac4('0x33')](_0x96802c[_0x4ac4('0x34')],qs['fields'](_0x3e3749[_0x4ac4('0x31')]['fields']));_0x1f1889[_0x4ac4('0x35')]=_0x1f1889['attributes'][_0x4ac4('0x37')]?_0x1f1889[_0x4ac4('0x35')]:_0x96802c[_0x4ac4('0x34')];if(_0x3e3749['query'][_0x4ac4('0x42')]){_0x1f1889[_0x4ac4('0x43')]=[{'all':!![]}];}_0x1f1889=_[_0x4ac4('0x3e')]({},_0x1f1889,_0x3e3749['options']);return db['VtigerAccount'][_0x4ac4('0x49')](_0x1f1889)[_0x4ac4('0x25')](handleEntityNotFound(_0x189623,null))[_0x4ac4('0x25')](respondWithResult(_0x189623,null))[_0x4ac4('0x47')](handleError(_0x189623,null));};exports[_0x4ac4('0x4a')]=function(_0x259a53,_0x34e968){return db[_0x4ac4('0x44')][_0x4ac4('0x4a')](_0x259a53[_0x4ac4('0x4b')],{})[_0x4ac4('0x25')](respondWithResult(_0x34e968,0xc9))['catch'](handleError(_0x34e968,null));};exports[_0x4ac4('0x24')]=function(_0x52b2b2,_0x589c6d){if(_0x52b2b2['body']['id']){delete _0x52b2b2[_0x4ac4('0x4b')]['id'];}return db[_0x4ac4('0x44')][_0x4ac4('0x49')]({'where':{'id':_0x52b2b2['params']['id']}})['then'](handleEntityNotFound(_0x589c6d,null))['then'](saveUpdates(_0x52b2b2[_0x4ac4('0x4b')],null))[_0x4ac4('0x25')](respondWithResult(_0x589c6d,null))[_0x4ac4('0x47')](handleError(_0x589c6d,null));};exports['destroy']=function(_0x5bcbf1,_0x39ac9e){return db[_0x4ac4('0x44')]['find']({'where':{'id':_0x5bcbf1[_0x4ac4('0x4c')]['id']}})[_0x4ac4('0x25')](handleEntityNotFound(_0x39ac9e,null))[_0x4ac4('0x25')](removeEntity(_0x39ac9e,null))[_0x4ac4('0x47')](handleError(_0x39ac9e,null));};exports['getConfigurations']=function(_0xff15c,_0x1d9261,_0x4a4b8e){var _0x1bb8c0={};var _0x4f4544={};var _0x352542;var _0x28588e;return db[_0x4ac4('0x44')][_0x4ac4('0x4d')]({'where':{'id':_0xff15c['params']['id']}})[_0x4ac4('0x25')](handleEntityNotFound(_0x1d9261,null))[_0x4ac4('0x25')](function(_0x2aca7c){if(_0x2aca7c){_0x352542=_0x2aca7c;_0x4f4544['model']=_[_0x4ac4('0x48')](db[_0x4ac4('0x4e')]['rawAttributes']);_0x4f4544[_0x4ac4('0x31')]=_[_0x4ac4('0x48')](_0xff15c[_0x4ac4('0x31')]);_0x4f4544['filters']=_['intersection'](_0x4f4544['model'],_0x4f4544[_0x4ac4('0x31')]);_0x1bb8c0[_0x4ac4('0x35')]=_[_0x4ac4('0x33')](_0x4f4544['model'],qs[_0x4ac4('0x36')](_0xff15c[_0x4ac4('0x31')]['fields']));_0x1bb8c0[_0x4ac4('0x35')]=_0x1bb8c0[_0x4ac4('0x35')][_0x4ac4('0x37')]?_0x1bb8c0[_0x4ac4('0x35')]:_0x4f4544[_0x4ac4('0x34')];_0x1bb8c0['order']=qs[_0x4ac4('0x3b')](_0xff15c[_0x4ac4('0x31')][_0x4ac4('0x3b')]);_0x1bb8c0['where']=qs['filters'](_['pick'](_0xff15c[_0x4ac4('0x31')],_0x4f4544[_0x4ac4('0x32')]));if(_0xff15c['query'][_0x4ac4('0x40')]){_0x1bb8c0[_0x4ac4('0x3c')]=_['merge'](_0x1bb8c0[_0x4ac4('0x3c')],{'$or':_[_0x4ac4('0x2c')](_0x1bb8c0[_0x4ac4('0x35')],function(_0x1e3cd3){var _0x1be187={};_0x1be187[_0x1e3cd3]={'$like':'%'+_0xff15c['query']['filter']+'%'};return _0x1be187;})});}_0x1bb8c0=_['merge']({},_0x1bb8c0,_0xff15c[_0x4ac4('0x41')]);return _0x352542[_0x4ac4('0x4f')](_0x1bb8c0);}})[_0x4ac4('0x25')](function(_0x208cb9){if(_0x208cb9){_0x28588e=_0x208cb9[_0x4ac4('0x37')];if(!_0xff15c[_0x4ac4('0x31')][_0x4ac4('0x38')]('nolimit')){_0x1bb8c0['limit']=qs[_0x4ac4('0x50')](_0xff15c[_0x4ac4('0x31')]['limit']);_0x1bb8c0[_0x4ac4('0x1d')]=qs[_0x4ac4('0x1d')](_0xff15c[_0x4ac4('0x31')][_0x4ac4('0x1d')]);}return _0x352542[_0x4ac4('0x4f')](_0x1bb8c0);}})[_0x4ac4('0x25')](function(_0x7b9afb){if(_0x7b9afb){return _0x7b9afb?{'count':_0x28588e,'rows':_0x7b9afb}:null;}})[_0x4ac4('0x25')](respondWithResult(_0x1d9261,null))['catch'](handleError(_0x1d9261,null));};exports[_0x4ac4('0x51')]=function(_0x26998b,_0x556ea0,_0x53d190){if(_0x26998b[_0x4ac4('0x4b')]['id']){delete _0x26998b[_0x4ac4('0x4b')]['id'];}return db[_0x4ac4('0x44')][_0x4ac4('0x4d')]({'where':{'id':_0x26998b[_0x4ac4('0x4c')]['id']}})[_0x4ac4('0x25')](handleEntityNotFound(_0x556ea0,null))[_0x4ac4('0x25')](function(_0x269770){if(_0x269770){_0x26998b[_0x4ac4('0x4b')][_0x4ac4('0x52')]=_0x269770['id'];_0x26998b[_0x4ac4('0x4b')][_0x4ac4('0x53')]=integrations[_0x4ac4('0x54')](_0x26998b[_0x4ac4('0x4b')]['channel'],_0x26998b[_0x4ac4('0x4b')][_0x4ac4('0x2f')]);_0x26998b['body'][_0x4ac4('0x55')]=integrations[_0x4ac4('0x56')](_0x26998b['body'][_0x4ac4('0x57')],_0x26998b['body'][_0x4ac4('0x2f')]);return db[_0x4ac4('0x4e')][_0x4ac4('0x4a')](_0x26998b['body'],{'include':[{'model':db['VtigerField'],'as':_0x4ac4('0x53')},{'model':db[_0x4ac4('0x58')],'as':_0x4ac4('0x55')}]});}return null;})[_0x4ac4('0x25')](respondWithResult(_0x556ea0,null))[_0x4ac4('0x47')](handleError(_0x556ea0,null));};var md5=require(_0x4ac4('0x59'));exports[_0x4ac4('0x5a')]=function(_0x3906e6,_0x35638b,_0x409c14){var _0x4a2ced=null;var _0x12384a=null;var _0x1a7425=null;var _0xdb05cf=null;var _0x47ed5e='';return db['VtigerAccount'][_0x4ac4('0x4d')]({'where':{'id':_0x3906e6[_0x4ac4('0x4c')]['id']},'attributes':['id',_0x4ac4('0x29'),_0x4ac4('0x5b'),_0x4ac4('0x5c'),_0x4ac4('0x5d'),_0x4ac4('0x5e'),_0x4ac4('0x5f'),_0x4ac4('0x60')]})['then'](handleEntityNotFound(_0x35638b,null))[_0x4ac4('0x25')](function(_0x415ca9){if(_0x415ca9){_0x4a2ced=_0x415ca9['username'];_0x12384a=_0x415ca9[_0x4ac4('0x60')];_0x1a7425=_0x415ca9[_0x4ac4('0x5d')];_0x47ed5e=_0x415ca9['remoteUri'];var _0x44a7ca=_0x47ed5e[_0x4ac4('0x61')](-0x1);if(_0x44a7ca==='/'){_0x47ed5e=_0x47ed5e[_0x4ac4('0x62')](0x0,_0x47ed5e[_0x4ac4('0x63')](_0x44a7ca));}_0xdb05cf=util['format']('%s/webservice.php',_0x47ed5e);var _0x47bd97={'method':_0x4ac4('0x64'),'uri':_0xdb05cf,'qs':{'operation':_0x4ac4('0x65'),'username':_0x415ca9[_0x4ac4('0x5b')]},'json':!![]};return rp(_0x47bd97);}})['then'](function(_0x45c32a){if(_0x45c32a[_0x4ac4('0x66')]){var _0x49b912={'method':_0x4ac4('0x67'),'uri':_0xdb05cf,'form':{'operation':'login','username':_0x4a2ced,'accessKey':md5(_0x45c32a['result'][_0x4ac4('0x68')]+_0x12384a)},'json':!![]};return rp(_0x49b912);}})['then'](function(_0x14c310){if(_0x14c310[_0x4ac4('0x66')]){var _0x391533={'method':_0x4ac4('0x64'),'uri':_0xdb05cf,'qs':{'operation':_0x4ac4('0x69'),'username':_0x4a2ced,'sessionName':_0x14c310[_0x4ac4('0x6a')]['sessionName'],'elementType':_0x1a7425},'json':!![]};return rp(_0x391533);}})[_0x4ac4('0x25')](function(_0x3557b8){if(_0x3557b8['success']){var _0x3b45d1=[_0x4ac4('0x6b'),_0x4ac4('0x6c'),'owner'];_[_0x4ac4('0x6d')](_0x3557b8[_0x4ac4('0x6a')][_0x4ac4('0x36')],function(_0x30478a){return _0x3b45d1['includes'](_0x30478a[_0x4ac4('0x2f')][_0x4ac4('0x29')]);});_[_0x4ac4('0x6d')](_0x3557b8[_0x4ac4('0x6a')][_0x4ac4('0x36')],function(_0x10dada){return _0x10dada[_0x4ac4('0x6e')]===_0x4ac4('0x6f');});return{'count':_0x3557b8[_0x4ac4('0x6a')][_0x4ac4('0x36')][_0x4ac4('0x37')],'rows':_[_0x4ac4('0x2c')](_0x3557b8[_0x4ac4('0x6a')]['fields'],function(_0x3607ed){return{'id':_0x3607ed[_0x4ac4('0x29')],'name':_0x3607ed['label'],'custom':_['startsWith'](_0x3607ed[_0x4ac4('0x29')],_0x4ac4('0x70'))?!![]:![],'options':_0x3607ed[_0x4ac4('0x2f')][_0x4ac4('0x29')]===_0x4ac4('0x71')&&_0x3607ed[_0x4ac4('0x2f')][_0x4ac4('0x72')]['length']>0x0?_[_0x4ac4('0x2c')](_0x3607ed[_0x4ac4('0x2f')][_0x4ac4('0x72')],function(_0x402ee5){return{'name':_0x402ee5['label'],'value':_0x402ee5[_0x4ac4('0x73')]};}):[]};})};}})[_0x4ac4('0x25')](respondWithResult(_0x35638b,null))[_0x4ac4('0x47')](function(_0x451919){console['log'](_0x4ac4('0x74')+_0x451919);var _0xea20d5=_0x3906e6[_0x4ac4('0x31')][_0x4ac4('0x75')]?0x1f4:_0x451919[_0x4ac4('0x76')]||0x1f4;logger[_0x4ac4('0x77')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0xea20d5,JSON[_0x4ac4('0x78')](_0x451919));delete _0x451919['name'];if(_0xea20d5===0x191){_0xea20d5=0x190;}_0x35638b[_0x4ac4('0x1b')](_0xea20d5)[_0x4ac4('0x2a')](_0x3906e6['query'][_0x4ac4('0x75')]?{'message':_0x4ac4('0x79'),'statusCode':_0x451919['statusCode']}:_0x451919);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 36e7bc0..f290ab4 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 _0x7a6d=['moment','bluebird','path','../../config/environment','./intVtigerAccount.attributes','exports','define','VtigerAccount','lodash','../../config/logger','api'];(function(_0x43c355,_0x469b9a){var _0xbf9e1c=function(_0x200617){while(--_0x200617){_0x43c355['push'](_0x43c355['shift']());}};_0xbf9e1c(++_0x469b9a);}(_0x7a6d,0xb8));var _0xd7a6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7a6d[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xd7a6('0x0'));var util=require('util');var logger=require(_0xd7a6('0x1'))(_0xd7a6('0x2'));var moment=require(_0xd7a6('0x3'));var BPromise=require(_0xd7a6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd7a6('0x5'));var rimraf=require('rimraf');var config=require(_0xd7a6('0x6'));var attributes=require(_0xd7a6('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xd7a6('0x8')]=function(_0x3946a4,_0x2ab60f){return _0x3946a4[_0xd7a6('0x9')](_0xd7a6('0xa'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x452d=['rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','VtigerAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x123d24,_0x49c7dc){var _0x4402de=function(_0x3c903a){while(--_0x3c903a){_0x123d24['push'](_0x123d24['shift']());}};_0x4402de(++_0x49c7dc);}(_0x452d,0x92));var _0xd452=function(_0x32b286,_0x444a3d){_0x32b286=_0x32b286-0x0;var _0x1d0dbb=_0x452d[_0x32b286];return _0x1d0dbb;};'use strict';var _=require(_0xd452('0x0'));var util=require(_0xd452('0x1'));var logger=require(_0xd452('0x2'))(_0xd452('0x3'));var moment=require(_0xd452('0x4'));var BPromise=require(_0xd452('0x5'));var rp=require(_0xd452('0x6'));var fs=require('fs');var path=require(_0xd452('0x7'));var rimraf=require(_0xd452('0x8'));var config=require(_0xd452('0x9'));var attributes=require(_0xd452('0xa'));var integrations=require(_0xd452('0xb'));module[_0xd452('0xc')]=function(_0xe9d5d5,_0x4d2c48){return _0xe9d5d5['define'](_0xd452('0xd'),attributes,{'tableName':'int_vtiger_accounts','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 efb6653..a371144 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 _0x7334=['code','message','request\x20sent','result','GetVtigerAccount','findAll','options','raw','where','attributes','limit','include','map','model','VtigerAccount','find','ShowVtigerAccount','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7334,0x184));var _0x4733=function(_0x3158f5,_0x437b1d){_0x3158f5=_0x3158f5-0x0;var _0x933c55=_0x7334[_0x3158f5];return _0x933c55;};'use strict';var _=require(_0x4733('0x0'));var util=require(_0x4733('0x1'));var moment=require(_0x4733('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4733('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4733('0x4'));var logger=require(_0x4733('0x5'))(_0x4733('0x6'));var config=require(_0x4733('0x7'));var jayson=require(_0x4733('0x8'));var client=jayson[_0x4733('0x9')][_0x4733('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x283754,_0x12cafa,_0x43d95c){return new BPromise(function(_0x8257cf,_0x3562b7){return client[_0x4733('0xb')](_0x283754,_0x43d95c)[_0x4733('0xc')](function(_0x2d5fde){logger[_0x4733('0xd')](_0x4733('0xe'),_0x12cafa,'request\x20sent');logger[_0x4733('0xf')](_0x4733('0x10'),_0x12cafa,'request\x20sent',JSON[_0x4733('0x11')](_0x2d5fde));if(_0x2d5fde['error']){if(_0x2d5fde[_0x4733('0x12')][_0x4733('0x13')]===0x1f4){logger[_0x4733('0x12')](_0x4733('0xe'),_0x12cafa,_0x2d5fde[_0x4733('0x12')][_0x4733('0x14')]);return _0x3562b7(_0x2d5fde[_0x4733('0x12')]['message']);}logger[_0x4733('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x12cafa,_0x2d5fde[_0x4733('0x12')][_0x4733('0x14')]);return _0x8257cf(_0x2d5fde[_0x4733('0x12')][_0x4733('0x14')]);}else{logger[_0x4733('0xd')](_0x4733('0xe'),_0x12cafa,_0x4733('0x15'));_0x8257cf(_0x2d5fde[_0x4733('0x16')][_0x4733('0x14')]);}})['catch'](function(_0x2c0031){logger[_0x4733('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x12cafa,_0x2c0031);_0x3562b7(_0x2c0031);});});}exports[_0x4733('0x17')]=function(_0x1d2fb6){var _0x2aa223=this;return new Promise(function(_0x384e0c,_0x579f67){return db['VtigerAccount'][_0x4733('0x18')]({'raw':_0x1d2fb6[_0x4733('0x19')]?_0x1d2fb6['options'][_0x4733('0x1a')]===undefined?!![]:![]:!![],'where':_0x1d2fb6[_0x4733('0x19')]?_0x1d2fb6[_0x4733('0x19')][_0x4733('0x1b')]||null:null,'attributes':_0x1d2fb6['options']?_0x1d2fb6[_0x4733('0x19')][_0x4733('0x1c')]||null:null,'limit':_0x1d2fb6['options']?_0x1d2fb6[_0x4733('0x19')][_0x4733('0x1d')]||null:null,'include':_0x1d2fb6['options']?_0x1d2fb6[_0x4733('0x19')][_0x4733('0x1e')]?_[_0x4733('0x1f')](_0x1d2fb6[_0x4733('0x19')][_0x4733('0x1e')],function(_0x24db74){return{'model':db[_0x24db74[_0x4733('0x20')]],'as':_0x24db74['as'],'attributes':_0x24db74[_0x4733('0x1c')],'include':_0x24db74['include']?_[_0x4733('0x1f')](_0x24db74[_0x4733('0x1e')],function(_0x7884e5){return{'model':db[_0x7884e5[_0x4733('0x20')]],'as':_0x7884e5['as'],'attributes':_0x7884e5[_0x4733('0x1c')],'include':_0x7884e5[_0x4733('0x1e')]?_[_0x4733('0x1f')](_0x7884e5[_0x4733('0x1e')],function(_0x13bc12){return{'model':db[_0x13bc12[_0x4733('0x20')]],'as':_0x13bc12['as'],'attributes':_0x13bc12['attributes']};}):[]};}):[]};}):[]:[]})[_0x4733('0xc')](function(_0x4c91bc){logger['info'](_0x4733('0x17'),_0x1d2fb6);logger['debug'](_0x4733('0x17'),_0x1d2fb6,JSON['stringify'](_0x4c91bc));_0x384e0c(_0x4c91bc);})['catch'](function(_0x517c73){logger[_0x4733('0x12')](_0x4733('0x17'),_0x517c73[_0x4733('0x14')],_0x1d2fb6);_0x579f67(_0x2aa223[_0x4733('0x12')](0x1f4,_0x517c73['message']));});});};exports['ShowVtigerAccount']=function(_0x50f67e){var _0x2b2757=this;return new Promise(function(_0x56872b,_0x5a4814){return db[_0x4733('0x21')][_0x4733('0x22')]({'raw':_0x50f67e[_0x4733('0x19')]?_0x50f67e['options']['raw']===undefined?!![]:![]:!![],'where':_0x50f67e[_0x4733('0x19')]?_0x50f67e[_0x4733('0x19')][_0x4733('0x1b')]||null:null,'attributes':_0x50f67e[_0x4733('0x19')]?_0x50f67e[_0x4733('0x19')]['attributes']||null:null,'include':_0x50f67e[_0x4733('0x19')]?_0x50f67e[_0x4733('0x19')][_0x4733('0x1e')]?_[_0x4733('0x1f')](_0x50f67e[_0x4733('0x19')]['include'],function(_0x570bc6){return{'model':db[_0x570bc6[_0x4733('0x20')]],'as':_0x570bc6['as'],'attributes':_0x570bc6[_0x4733('0x1c')],'include':_0x570bc6[_0x4733('0x1e')]?_[_0x4733('0x1f')](_0x570bc6[_0x4733('0x1e')],function(_0x5e31c8){return{'model':db[_0x5e31c8[_0x4733('0x20')]],'as':_0x5e31c8['as'],'attributes':_0x5e31c8[_0x4733('0x1c')],'include':_0x5e31c8[_0x4733('0x1e')]?_['map'](_0x5e31c8[_0x4733('0x1e')],function(_0x10a5e9){return{'model':db[_0x10a5e9[_0x4733('0x20')]],'as':_0x10a5e9['as'],'attributes':_0x10a5e9[_0x4733('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4733('0xc')](function(_0x311c1d){logger[_0x4733('0xd')](_0x4733('0x23'),_0x50f67e);logger['debug'](_0x4733('0x23'),_0x50f67e,JSON['stringify'](_0x311c1d));_0x56872b(_0x311c1d);})[_0x4733('0x24')](function(_0x29db03){logger[_0x4733('0x12')](_0x4733('0x23'),_0x29db03[_0x4733('0x14')],_0x50f67e);_0x5a4814(_0x2b2757[_0x4733('0x12')](0x1f4,_0x29db03[_0x4733('0x14')]));});});}; \ No newline at end of file +var _0x6cb4=['where','attributes','limit','include','map','model','then','GetVtigerAccount','find','ShowVtigerAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','info','request\x20sent','debug','stringify','error','VtigerAccount,\x20%s,\x20%s','message','result','catch','VtigerAccount','findAll','options','raw'];(function(_0x2c95ad,_0x1c47b4){var _0x4a5294=function(_0x1a3901){while(--_0x1a3901){_0x2c95ad['push'](_0x2c95ad['shift']());}};_0x4a5294(++_0x1c47b4);}(_0x6cb4,0xff));var _0x46cb=function(_0x2d5a7e,_0x2c6c6d){_0x2d5a7e=_0x2d5a7e-0x0;var _0x2e2454=_0x6cb4[_0x2d5a7e];return _0x2e2454;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var moment=require(_0x46cb('0x2'));var BPromise=require(_0x46cb('0x3'));var rs=require(_0x46cb('0x4'));var fs=require('fs');var Redis=require(_0x46cb('0x5'));var db=require(_0x46cb('0x6'))['db'];var utils=require(_0x46cb('0x7'));var logger=require(_0x46cb('0x8'))('rpc');var config=require(_0x46cb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x46cb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11262d,_0x148d0f,_0x31b35b){return new BPromise(function(_0x2d6c29,_0x24b4f5){return client[_0x46cb('0xb')](_0x11262d,_0x31b35b)['then'](function(_0x3d7663){logger[_0x46cb('0xc')]('VtigerAccount,\x20%s,\x20%s',_0x148d0f,_0x46cb('0xd'));logger[_0x46cb('0xe')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x148d0f,_0x46cb('0xd'),JSON[_0x46cb('0xf')](_0x3d7663));if(_0x3d7663['error']){if(_0x3d7663['error']['code']===0x1f4){logger[_0x46cb('0x10')](_0x46cb('0x11'),_0x148d0f,_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);return _0x24b4f5(_0x3d7663['error'][_0x46cb('0x12')]);}logger[_0x46cb('0x10')](_0x46cb('0x11'),_0x148d0f,_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);return _0x2d6c29(_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);}else{logger[_0x46cb('0xc')](_0x46cb('0x11'),_0x148d0f,_0x46cb('0xd'));_0x2d6c29(_0x3d7663[_0x46cb('0x13')]['message']);}})[_0x46cb('0x14')](function(_0x5796d2){logger[_0x46cb('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x148d0f,_0x5796d2);_0x24b4f5(_0x5796d2);});});}exports['GetVtigerAccount']=function(_0x4e3454){var _0x1b6646=this;return new Promise(function(_0x1f2891,_0x4df1f0){return db[_0x46cb('0x15')][_0x46cb('0x16')]({'raw':_0x4e3454[_0x46cb('0x17')]?_0x4e3454[_0x46cb('0x17')][_0x46cb('0x18')]===undefined?!![]:![]:!![],'where':_0x4e3454[_0x46cb('0x17')]?_0x4e3454[_0x46cb('0x17')][_0x46cb('0x19')]||null:null,'attributes':_0x4e3454[_0x46cb('0x17')]?_0x4e3454[_0x46cb('0x17')][_0x46cb('0x1a')]||null:null,'limit':_0x4e3454[_0x46cb('0x17')]?_0x4e3454[_0x46cb('0x17')][_0x46cb('0x1b')]||null:null,'include':_0x4e3454[_0x46cb('0x17')]?_0x4e3454[_0x46cb('0x17')][_0x46cb('0x1c')]?_[_0x46cb('0x1d')](_0x4e3454[_0x46cb('0x17')][_0x46cb('0x1c')],function(_0xadcad6){return{'model':db[_0xadcad6[_0x46cb('0x1e')]],'as':_0xadcad6['as'],'attributes':_0xadcad6['attributes'],'include':_0xadcad6['include']?_[_0x46cb('0x1d')](_0xadcad6[_0x46cb('0x1c')],function(_0x2711ac){return{'model':db[_0x2711ac[_0x46cb('0x1e')]],'as':_0x2711ac['as'],'attributes':_0x2711ac[_0x46cb('0x1a')],'include':_0x2711ac['include']?_[_0x46cb('0x1d')](_0x2711ac['include'],function(_0x495886){return{'model':db[_0x495886['model']],'as':_0x495886['as'],'attributes':_0x495886[_0x46cb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x46cb('0x1f')](function(_0x2242e7){logger[_0x46cb('0xc')](_0x46cb('0x20'),_0x4e3454);logger[_0x46cb('0xe')](_0x46cb('0x20'),_0x4e3454,JSON[_0x46cb('0xf')](_0x2242e7));_0x1f2891(_0x2242e7);})[_0x46cb('0x14')](function(_0x12e01e){logger[_0x46cb('0x10')]('GetVtigerAccount',_0x12e01e[_0x46cb('0x12')],_0x4e3454);_0x4df1f0(_0x1b6646[_0x46cb('0x10')](0x1f4,_0x12e01e['message']));});});};exports['ShowVtigerAccount']=function(_0x15f5cf){var _0x5cbb22=this;return new Promise(function(_0x27c22d,_0x6f7953){return db[_0x46cb('0x15')][_0x46cb('0x21')]({'raw':_0x15f5cf[_0x46cb('0x17')]?_0x15f5cf[_0x46cb('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x15f5cf[_0x46cb('0x17')]?_0x15f5cf['options'][_0x46cb('0x19')]||null:null,'attributes':_0x15f5cf[_0x46cb('0x17')]?_0x15f5cf['options'][_0x46cb('0x1a')]||null:null,'include':_0x15f5cf[_0x46cb('0x17')]?_0x15f5cf[_0x46cb('0x17')][_0x46cb('0x1c')]?_[_0x46cb('0x1d')](_0x15f5cf['options'][_0x46cb('0x1c')],function(_0x49f80a){return{'model':db[_0x49f80a[_0x46cb('0x1e')]],'as':_0x49f80a['as'],'attributes':_0x49f80a[_0x46cb('0x1a')],'include':_0x49f80a[_0x46cb('0x1c')]?_['map'](_0x49f80a[_0x46cb('0x1c')],function(_0x4290c){return{'model':db[_0x4290c['model']],'as':_0x4290c['as'],'attributes':_0x4290c[_0x46cb('0x1a')],'include':_0x4290c[_0x46cb('0x1c')]?_[_0x46cb('0x1d')](_0x4290c[_0x46cb('0x1c')],function(_0x25be2d){return{'model':db[_0x25be2d[_0x46cb('0x1e')]],'as':_0x25be2d['as'],'attributes':_0x25be2d[_0x46cb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x46cb('0x1f')](function(_0x19e0ad){logger[_0x46cb('0xc')](_0x46cb('0x22'),_0x15f5cf);logger['debug']('ShowVtigerAccount',_0x15f5cf,JSON['stringify'](_0x19e0ad));_0x27c22d(_0x19e0ad);})[_0x46cb('0x14')](function(_0xf8aaec){logger[_0x46cb('0x10')](_0x46cb('0x22'),_0xf8aaec[_0x46cb('0x12')],_0x15f5cf);_0x6f7953(_0x5cbb22[_0x46cb('0x10')](0x1f4,_0xf8aaec['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 6fe2cb7..c03e62b 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 _0x9067=['create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','get','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','/:id/descriptions','post'];(function(_0x530a2a,_0x2bc00c){var _0x227ae6=function(_0x3c60fe){while(--_0x3c60fe){_0x530a2a['push'](_0x530a2a['shift']());}};_0x227ae6(++_0x2bc00c);}(_0x9067,0x123));var _0x7906=function(_0x2b7f6a,_0x92cc50){_0x2b7f6a=_0x2b7f6a-0x0;var _0x2c1908=_0x9067[_0x2b7f6a];return _0x2c1908;};'use strict';var multer=require(_0x7906('0x0'));var util=require('util');var path=require(_0x7906('0x1'));var timeout=require(_0x7906('0x2'));var express=require(_0x7906('0x3'));var router=express[_0x7906('0x4')]();var fs_extra=require(_0x7906('0x5'));var auth=require(_0x7906('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7906('0x7'));var controller=require(_0x7906('0x8'));router[_0x7906('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x7906('0xa'),auth[_0x7906('0xb')](),controller['show']);router[_0x7906('0x9')](_0x7906('0xc'),auth[_0x7906('0xb')](),controller[_0x7906('0xd')]);router[_0x7906('0x9')](_0x7906('0xe'),auth[_0x7906('0xb')](),controller['getSubjects']);router[_0x7906('0x9')](_0x7906('0xf'),auth[_0x7906('0xb')](),controller['getDescriptions']);router[_0x7906('0x10')]('/',auth['isAuthenticated'](),controller[_0x7906('0x11')]);router[_0x7906('0x12')](_0x7906('0xa'),auth[_0x7906('0xb')](),controller[_0x7906('0x13')]);router[_0x7906('0x14')](_0x7906('0xa'),auth[_0x7906('0xb')](),controller[_0x7906('0x15')]);module['exports']=router; \ No newline at end of file +var _0x5abe=['create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x339b9b,_0x3568a8){var _0x576a88=function(_0x276c08){while(--_0x276c08){_0x339b9b['push'](_0x339b9b['shift']());}};_0x576a88(++_0x3568a8);}(_0x5abe,0x1bd));var _0xe5ab=function(_0x1a97ec,_0x8c7430){_0x1a97ec=_0x1a97ec-0x0;var _0x7631ee=_0x5abe[_0x1a97ec];return _0x7631ee;};'use strict';var multer=require(_0xe5ab('0x0'));var util=require('util');var path=require(_0xe5ab('0x1'));var timeout=require(_0xe5ab('0x2'));var express=require(_0xe5ab('0x3'));var router=express[_0xe5ab('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe5ab('0x5'));var config=require(_0xe5ab('0x6'));var controller=require(_0xe5ab('0x7'));router[_0xe5ab('0x8')]('/',auth[_0xe5ab('0x9')](),controller[_0xe5ab('0xa')]);router[_0xe5ab('0x8')](_0xe5ab('0xb'),auth[_0xe5ab('0x9')](),controller['show']);router['get'](_0xe5ab('0xc'),auth['isAuthenticated'](),controller[_0xe5ab('0xd')]);router[_0xe5ab('0x8')](_0xe5ab('0xe'),auth['isAuthenticated'](),controller[_0xe5ab('0xf')]);router[_0xe5ab('0x8')]('/:id/descriptions',auth[_0xe5ab('0x9')](),controller[_0xe5ab('0x10')]);router['post']('/',auth[_0xe5ab('0x9')](),controller[_0xe5ab('0x11')]);router[_0xe5ab('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xe5ab('0x13')]('/:id',auth[_0xe5ab('0x9')](),controller[_0xe5ab('0x14')]);module[_0xe5ab('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 5cfff7a..9c0ad6a 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 _0xc5a4=['exports','STRING'];(function(_0x459ee0,_0x1e950d){var _0x1b87c8=function(_0x377855){while(--_0x377855){_0x459ee0['push'](_0x459ee0['shift']());}};_0x1b87c8(++_0x1e950d);}(_0xc5a4,0x110));var _0x4c5a=function(_0x4667cb,_0x4ed013){_0x4667cb=_0x4667cb-0x0;var _0x251f84=_0xc5a4[_0x4667cb];return _0x251f84;};'use strict';var Sequelize=require('sequelize');module[_0x4c5a('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4c5a('0x1')]}}; \ No newline at end of file +var _0x3ac0=['sequelize','STRING'];(function(_0x4f15b9,_0x577f60){var _0x23fa7e=function(_0x7fe191){while(--_0x7fe191){_0x4f15b9['push'](_0x4f15b9['shift']());}};_0x23fa7e(++_0x577f60);}(_0x3ac0,0x10e));var _0x03ac=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x3ac0[_0x40bffc];return _0x3007e9;};'use strict';var Sequelize=require(_0x03ac('0x0'));module['exports']={'name':{'type':Sequelize[_0x03ac('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 5e901d9..c5a3442 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 _0xc521=['fields','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','options','includeAll','include','findAll','show','params','length','merge','find','create','body','update','catch','getFields','findOne','VtigerField','getSubjects','pick','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','stack','name','send','index','VtigerConfiguration','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes'];(function(_0x1db199,_0xa982d6){var _0x2c31d6=function(_0x1e78cc){while(--_0x1e78cc){_0x1db199['push'](_0x1db199['shift']());}};_0x2c31d6(++_0xa982d6);}(_0xc521,0xbd));var _0x1c52=function(_0x53e9f4,_0xf70bbb){_0x53e9f4=_0x53e9f4-0x0;var _0x144fd5=_0xc521[_0x53e9f4];return _0x144fd5;};'use strict';var emlformat=require(_0x1c52('0x0'));var rimraf=require(_0x1c52('0x1'));var zipdir=require(_0x1c52('0x2'));var jsonpatch=require(_0x1c52('0x3'));var rp=require(_0x1c52('0x4'));var moment=require(_0x1c52('0x5'));var BPromise=require(_0x1c52('0x6'));var Mustache=require(_0x1c52('0x7'));var util=require(_0x1c52('0x8'));var path=require(_0x1c52('0x9'));var sox=require(_0x1c52('0xa'));var csv=require('to-csv');var ejs=require(_0x1c52('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1c52('0xc'));var squel=require(_0x1c52('0xd'));var crypto=require('crypto');var jsforce=require(_0x1c52('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1c52('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1c52('0x10'));var as=require(_0x1c52('0x11'));var hardwareService=require(_0x1c52('0x12'));var logger=require('../../config/logger')(_0x1c52('0x13'));var utils=require(_0x1c52('0x14'));var config=require(_0x1c52('0x15'));var licenseUtil=require(_0x1c52('0x16'));var db=require(_0x1c52('0x17'))['db'];function respondWithStatusCode(_0x2e16ed,_0x37e74d){_0x37e74d=_0x37e74d||0xcc;return function(_0x3a8acd){if(_0x3a8acd){return _0x2e16ed[_0x1c52('0x18')](_0x37e74d);}return _0x2e16ed[_0x1c52('0x19')](_0x37e74d)[_0x1c52('0x1a')]();};}function respondWithResult(_0x5a6ea6,_0x21b551){_0x21b551=_0x21b551||0xc8;return function(_0x55fe2a){if(_0x55fe2a){return _0x5a6ea6['status'](_0x21b551)[_0x1c52('0x1b')](_0x55fe2a);}};}function respondWithFilteredResult(_0x5503cf,_0x2dad2b){return function(_0x48dfdc){if(_0x48dfdc){var _0x2c20e7=typeof _0x2dad2b[_0x1c52('0x1c')]===_0x1c52('0x1d')&&typeof _0x2dad2b['limit']===_0x1c52('0x1d');var _0x32ab9d=_0x48dfdc['count'];var _0x6e496c=_0x2c20e7?0x0:_0x2dad2b[_0x1c52('0x1c')];var _0x41c808=_0x2c20e7?_0x48dfdc[_0x1c52('0x1e')]:_0x2dad2b[_0x1c52('0x1c')]+_0x2dad2b[_0x1c52('0x1f')];var _0x50d1be;if(_0x41c808>=_0x32ab9d){_0x41c808=_0x32ab9d;_0x50d1be=0xc8;}else{_0x50d1be=0xce;}_0x5503cf[_0x1c52('0x19')](_0x50d1be);return _0x5503cf[_0x1c52('0x20')](_0x1c52('0x21'),_0x6e496c+'-'+_0x41c808+'/'+_0x32ab9d)[_0x1c52('0x1b')](_0x48dfdc);}return null;};}function patchUpdates(_0x530f57){return function(_0x162afb){try{jsonpatch[_0x1c52('0x22')](_0x162afb,_0x530f57,!![]);}catch(_0x56c797){return BPromise['reject'](_0x56c797);}return _0x162afb[_0x1c52('0x23')]();};}function saveUpdates(_0xfdcc8,_0x148616){return function(_0x20a5fa){if(_0x20a5fa){return _0x20a5fa['update'](_0xfdcc8)[_0x1c52('0x24')](function(_0x5dc3e9){return _0x5dc3e9;});}return null;};}function removeEntity(_0x1f1288,_0x16eafb){return function(_0x287bda){if(_0x287bda){return _0x287bda[_0x1c52('0x25')]()['then'](function(){_0x1f1288['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ffb50,_0x5df405){return function(_0x2fa6d7){if(!_0x2fa6d7){_0x3ffb50[_0x1c52('0x18')](0x194);}return _0x2fa6d7;};}function handleError(_0x2ee79d,_0x219cc0){_0x219cc0=_0x219cc0||0x1f4;return function(_0x17ff45){logger['error'](_0x17ff45[_0x1c52('0x26')]);if(_0x17ff45[_0x1c52('0x27')]){delete _0x17ff45[_0x1c52('0x27')];}_0x2ee79d['status'](_0x219cc0)[_0x1c52('0x28')](_0x17ff45);};}exports[_0x1c52('0x29')]=function(_0x4815b8,_0x5d1a0b){var _0x42db2c={},_0x10dded={},_0xbf96a2={'count':0x0,'rows':[]};var _0x5d43a3=_['map'](db[_0x1c52('0x2a')][_0x1c52('0x2b')],function(_0xfcbfcb){return{'name':_0xfcbfcb[_0x1c52('0x2c')],'type':_0xfcbfcb[_0x1c52('0x2d')][_0x1c52('0x2e')]};});_0x10dded['model']=_[_0x1c52('0x2f')](_0x5d43a3,_0x1c52('0x27'));_0x10dded[_0x1c52('0x30')]=_[_0x1c52('0x31')](_0x4815b8[_0x1c52('0x30')]);_0x10dded[_0x1c52('0x32')]=_[_0x1c52('0x33')](_0x10dded[_0x1c52('0x34')],_0x10dded[_0x1c52('0x30')]);_0x42db2c[_0x1c52('0x35')]=_[_0x1c52('0x33')](_0x10dded[_0x1c52('0x34')],qs['fields'](_0x4815b8['query'][_0x1c52('0x36')]));_0x42db2c['attributes']=_0x42db2c[_0x1c52('0x35')]['length']?_0x42db2c[_0x1c52('0x35')]:_0x10dded[_0x1c52('0x34')];if(!_0x4815b8['query'][_0x1c52('0x37')](_0x1c52('0x38'))){_0x42db2c[_0x1c52('0x1f')]=qs['limit'](_0x4815b8['query'][_0x1c52('0x1f')]);_0x42db2c[_0x1c52('0x1c')]=qs[_0x1c52('0x1c')](_0x4815b8[_0x1c52('0x30')][_0x1c52('0x1c')]);}_0x42db2c[_0x1c52('0x39')]=qs[_0x1c52('0x3a')](_0x4815b8[_0x1c52('0x30')][_0x1c52('0x3a')]);_0x42db2c['where']=qs[_0x1c52('0x32')](_['pick'](_0x4815b8['query'],_0x10dded['filters']),_0x5d43a3);if(_0x4815b8['query'][_0x1c52('0x3b')]){_0x42db2c['where']=_['merge'](_0x42db2c[_0x1c52('0x3c')],{'$or':_['map'](_0x5d43a3,function(_0x1f696f){if(_0x1f696f[_0x1c52('0x2d')]!==_0x1c52('0x3d')){var _0x9755ab={};_0x9755ab[_0x1f696f['name']]={'$like':'%'+_0x4815b8[_0x1c52('0x30')]['filter']+'%'};return _0x9755ab;}})});}_0x42db2c=_['merge']({},_0x42db2c,_0x4815b8[_0x1c52('0x3e')]);var _0x485c28={'where':_0x42db2c[_0x1c52('0x3c')]};return db[_0x1c52('0x2a')]['count'](_0x485c28)[_0x1c52('0x24')](function(_0x4221dd){_0xbf96a2['count']=_0x4221dd;if(_0x4815b8[_0x1c52('0x30')][_0x1c52('0x3f')]){_0x42db2c[_0x1c52('0x40')]=[{'all':!![]}];}return db[_0x1c52('0x2a')][_0x1c52('0x41')](_0x42db2c);})[_0x1c52('0x24')](function(_0x34f0c4){_0xbf96a2['rows']=_0x34f0c4;return _0xbf96a2;})[_0x1c52('0x24')](respondWithFilteredResult(_0x5d1a0b,_0x42db2c))['catch'](handleError(_0x5d1a0b,null));};exports[_0x1c52('0x42')]=function(_0x4327a1,_0x450c2a){var _0x2d7c77={'raw':![],'where':{'id':_0x4327a1[_0x1c52('0x43')]['id']}},_0xd1cd3b={};_0xd1cd3b['model']=_[_0x1c52('0x31')](db[_0x1c52('0x2a')][_0x1c52('0x2b')]);_0xd1cd3b[_0x1c52('0x30')]=_[_0x1c52('0x31')](_0x4327a1[_0x1c52('0x30')]);_0xd1cd3b[_0x1c52('0x32')]=_[_0x1c52('0x33')](_0xd1cd3b[_0x1c52('0x34')],_0xd1cd3b[_0x1c52('0x30')]);_0x2d7c77['attributes']=_[_0x1c52('0x33')](_0xd1cd3b['model'],qs[_0x1c52('0x36')](_0x4327a1[_0x1c52('0x30')]['fields']));_0x2d7c77[_0x1c52('0x35')]=_0x2d7c77[_0x1c52('0x35')][_0x1c52('0x44')]?_0x2d7c77[_0x1c52('0x35')]:_0xd1cd3b[_0x1c52('0x34')];if(_0x4327a1['query'][_0x1c52('0x3f')]){_0x2d7c77['include']=[{'all':!![]}];}_0x2d7c77=_[_0x1c52('0x45')]({},_0x2d7c77,_0x4327a1['options']);return db[_0x1c52('0x2a')][_0x1c52('0x46')](_0x2d7c77)['then'](handleEntityNotFound(_0x450c2a,null))[_0x1c52('0x24')](respondWithResult(_0x450c2a,null))['catch'](handleError(_0x450c2a,null));};exports['create']=function(_0x16dbee,_0xba3090){return db[_0x1c52('0x2a')][_0x1c52('0x47')](_0x16dbee[_0x1c52('0x48')],{})[_0x1c52('0x24')](respondWithResult(_0xba3090,0xc9))['catch'](handleError(_0xba3090,null));};exports[_0x1c52('0x49')]=function(_0x58a032,_0x498f3c){if(_0x58a032[_0x1c52('0x48')]['id']){delete _0x58a032[_0x1c52('0x48')]['id'];}return db[_0x1c52('0x2a')][_0x1c52('0x46')]({'where':{'id':_0x58a032[_0x1c52('0x43')]['id']}})[_0x1c52('0x24')](handleEntityNotFound(_0x498f3c,null))[_0x1c52('0x24')](saveUpdates(_0x58a032[_0x1c52('0x48')],null))[_0x1c52('0x24')](respondWithResult(_0x498f3c,null))[_0x1c52('0x4a')](handleError(_0x498f3c,null));};exports[_0x1c52('0x25')]=function(_0x500b2d,_0x5404c9){return db['VtigerConfiguration'][_0x1c52('0x46')]({'where':{'id':_0x500b2d[_0x1c52('0x43')]['id']}})[_0x1c52('0x24')](handleEntityNotFound(_0x5404c9,null))[_0x1c52('0x24')](removeEntity(_0x5404c9,null))[_0x1c52('0x4a')](handleError(_0x5404c9,null));};exports[_0x1c52('0x4b')]=function(_0x4f33d8,_0x2ad7e3,_0x3417be){var _0x27dbb6={};var _0x394af3={};var _0x3d2280;var _0x4ebc85;return db['VtigerConfiguration'][_0x1c52('0x4c')]({'where':{'id':_0x4f33d8[_0x1c52('0x43')]['id']}})[_0x1c52('0x24')](handleEntityNotFound(_0x2ad7e3,null))[_0x1c52('0x24')](function(_0x5216f1){if(_0x5216f1){_0x3d2280=_0x5216f1;_0x394af3['model']=_[_0x1c52('0x31')](db[_0x1c52('0x4d')][_0x1c52('0x2b')]);_0x394af3[_0x1c52('0x30')]=_[_0x1c52('0x31')](_0x4f33d8['query']);_0x394af3[_0x1c52('0x32')]=_[_0x1c52('0x33')](_0x394af3['model'],_0x394af3[_0x1c52('0x30')]);_0x27dbb6[_0x1c52('0x35')]=_[_0x1c52('0x33')](_0x394af3['model'],qs[_0x1c52('0x36')](_0x4f33d8[_0x1c52('0x30')][_0x1c52('0x36')]));_0x27dbb6[_0x1c52('0x35')]=_0x27dbb6[_0x1c52('0x35')][_0x1c52('0x44')]?_0x27dbb6[_0x1c52('0x35')]:_0x394af3[_0x1c52('0x34')];_0x27dbb6[_0x1c52('0x39')]=qs[_0x1c52('0x3a')](_0x4f33d8[_0x1c52('0x30')]['sort']);_0x27dbb6['where']=qs[_0x1c52('0x32')](_['pick'](_0x4f33d8['query'],_0x394af3[_0x1c52('0x32')]));if(_0x4f33d8[_0x1c52('0x30')][_0x1c52('0x3b')]){_0x27dbb6[_0x1c52('0x3c')]=_['merge'](_0x27dbb6[_0x1c52('0x3c')],{'$or':_[_0x1c52('0x2f')](_0x27dbb6[_0x1c52('0x35')],function(_0x1571ed){var _0x4a5f94={};_0x4a5f94[_0x1571ed]={'$like':'%'+_0x4f33d8[_0x1c52('0x30')]['filter']+'%'};return _0x4a5f94;})});}_0x27dbb6=_['merge']({},_0x27dbb6,_0x4f33d8['options']);return _0x3d2280[_0x1c52('0x4b')](_0x27dbb6);}})[_0x1c52('0x24')](function(_0x4b9f9a){if(_0x4b9f9a){_0x4ebc85=_0x4b9f9a[_0x1c52('0x44')];if(!_0x4f33d8[_0x1c52('0x30')][_0x1c52('0x37')]('nolimit')){_0x27dbb6[_0x1c52('0x1f')]=qs[_0x1c52('0x1f')](_0x4f33d8[_0x1c52('0x30')][_0x1c52('0x1f')]);_0x27dbb6['offset']=qs[_0x1c52('0x1c')](_0x4f33d8['query']['offset']);}return _0x3d2280['getFields'](_0x27dbb6);}})['then'](function(_0x45207d){if(_0x45207d){return _0x45207d?{'count':_0x4ebc85,'rows':_0x45207d}:null;}})['then'](respondWithResult(_0x2ad7e3,null))[_0x1c52('0x4a')](handleError(_0x2ad7e3,null));};exports['getSubjects']=function(_0xe612db,_0x49454c,_0x4cc5c2){var _0xbeb2d6={};var _0x292e45={};var _0x1b4bf7;var _0x568ebf;return db['VtigerConfiguration'][_0x1c52('0x4c')]({'where':{'id':_0xe612db[_0x1c52('0x43')]['id']}})[_0x1c52('0x24')](handleEntityNotFound(_0x49454c,null))[_0x1c52('0x24')](function(_0x353541){if(_0x353541){_0x1b4bf7=_0x353541;_0x292e45['model']=_[_0x1c52('0x31')](db[_0x1c52('0x4d')][_0x1c52('0x2b')]);_0x292e45[_0x1c52('0x30')]=_['keys'](_0xe612db[_0x1c52('0x30')]);_0x292e45['filters']=_[_0x1c52('0x33')](_0x292e45[_0x1c52('0x34')],_0x292e45[_0x1c52('0x30')]);_0xbeb2d6[_0x1c52('0x35')]=_[_0x1c52('0x33')](_0x292e45[_0x1c52('0x34')],qs[_0x1c52('0x36')](_0xe612db[_0x1c52('0x30')]['fields']));_0xbeb2d6[_0x1c52('0x35')]=_0xbeb2d6[_0x1c52('0x35')][_0x1c52('0x44')]?_0xbeb2d6[_0x1c52('0x35')]:_0x292e45['model'];_0xbeb2d6[_0x1c52('0x39')]=qs[_0x1c52('0x3a')](_0xe612db[_0x1c52('0x30')][_0x1c52('0x3a')]);_0xbeb2d6[_0x1c52('0x3c')]=qs[_0x1c52('0x32')](_['pick'](_0xe612db[_0x1c52('0x30')],_0x292e45[_0x1c52('0x32')]));if(_0xe612db['query'][_0x1c52('0x3b')]){_0xbeb2d6[_0x1c52('0x3c')]=_['merge'](_0xbeb2d6[_0x1c52('0x3c')],{'$or':_[_0x1c52('0x2f')](_0xbeb2d6[_0x1c52('0x35')],function(_0x454dcd){var _0x4f62d3={};_0x4f62d3[_0x454dcd]={'$like':'%'+_0xe612db[_0x1c52('0x30')][_0x1c52('0x3b')]+'%'};return _0x4f62d3;})});}_0xbeb2d6=_[_0x1c52('0x45')]({},_0xbeb2d6,_0xe612db[_0x1c52('0x3e')]);return _0x1b4bf7[_0x1c52('0x4e')](_0xbeb2d6);}})['then'](function(_0x955f9c){if(_0x955f9c){_0x568ebf=_0x955f9c[_0x1c52('0x44')];if(!_0xe612db['query'][_0x1c52('0x37')]('nolimit')){_0xbeb2d6[_0x1c52('0x1f')]=qs[_0x1c52('0x1f')](_0xe612db['query'][_0x1c52('0x1f')]);_0xbeb2d6[_0x1c52('0x1c')]=qs['offset'](_0xe612db[_0x1c52('0x30')][_0x1c52('0x1c')]);}return _0x1b4bf7['getSubjects'](_0xbeb2d6);}})[_0x1c52('0x24')](function(_0x144a86){if(_0x144a86){return _0x144a86?{'count':_0x568ebf,'rows':_0x144a86}:null;}})[_0x1c52('0x24')](respondWithResult(_0x49454c,null))[_0x1c52('0x4a')](handleError(_0x49454c,null));};exports['getDescriptions']=function(_0x379f4e,_0x39a3d2,_0x21c25b){var _0x3df9ab={};var _0x3cd64f={};var _0x18f0cd;var _0x505c85;return db[_0x1c52('0x2a')][_0x1c52('0x4c')]({'where':{'id':_0x379f4e['params']['id']}})[_0x1c52('0x24')](handleEntityNotFound(_0x39a3d2,null))[_0x1c52('0x24')](function(_0x5081b2){if(_0x5081b2){_0x18f0cd=_0x5081b2;_0x3cd64f['model']=_['keys'](db[_0x1c52('0x4d')][_0x1c52('0x2b')]);_0x3cd64f[_0x1c52('0x30')]=_[_0x1c52('0x31')](_0x379f4e['query']);_0x3cd64f[_0x1c52('0x32')]=_['intersection'](_0x3cd64f['model'],_0x3cd64f['query']);_0x3df9ab['attributes']=_[_0x1c52('0x33')](_0x3cd64f[_0x1c52('0x34')],qs[_0x1c52('0x36')](_0x379f4e[_0x1c52('0x30')][_0x1c52('0x36')]));_0x3df9ab[_0x1c52('0x35')]=_0x3df9ab[_0x1c52('0x35')][_0x1c52('0x44')]?_0x3df9ab[_0x1c52('0x35')]:_0x3cd64f[_0x1c52('0x34')];_0x3df9ab[_0x1c52('0x39')]=qs[_0x1c52('0x3a')](_0x379f4e[_0x1c52('0x30')][_0x1c52('0x3a')]);_0x3df9ab[_0x1c52('0x3c')]=qs['filters'](_[_0x1c52('0x4f')](_0x379f4e[_0x1c52('0x30')],_0x3cd64f['filters']));if(_0x379f4e['query'][_0x1c52('0x3b')]){_0x3df9ab[_0x1c52('0x3c')]=_[_0x1c52('0x45')](_0x3df9ab[_0x1c52('0x3c')],{'$or':_[_0x1c52('0x2f')](_0x3df9ab['attributes'],function(_0x218a48){var _0x5c9d4b={};_0x5c9d4b[_0x218a48]={'$like':'%'+_0x379f4e[_0x1c52('0x30')][_0x1c52('0x3b')]+'%'};return _0x5c9d4b;})});}_0x3df9ab=_[_0x1c52('0x45')]({},_0x3df9ab,_0x379f4e[_0x1c52('0x3e')]);return _0x18f0cd[_0x1c52('0x50')](_0x3df9ab);}})[_0x1c52('0x24')](function(_0x14c3cd){if(_0x14c3cd){_0x505c85=_0x14c3cd[_0x1c52('0x44')];if(!_0x379f4e[_0x1c52('0x30')][_0x1c52('0x37')]('nolimit')){_0x3df9ab[_0x1c52('0x1f')]=qs[_0x1c52('0x1f')](_0x379f4e[_0x1c52('0x30')]['limit']);_0x3df9ab[_0x1c52('0x1c')]=qs[_0x1c52('0x1c')](_0x379f4e[_0x1c52('0x30')][_0x1c52('0x1c')]);}return _0x18f0cd[_0x1c52('0x50')](_0x3df9ab);}})[_0x1c52('0x24')](function(_0x1334dd){if(_0x1334dd){return _0x1334dd?{'count':_0x505c85,'rows':_0x1334dd}:null;}})[_0x1c52('0x24')](respondWithResult(_0x39a3d2,null))[_0x1c52('0x4a')](handleError(_0x39a3d2,null));}; \ No newline at end of file +var _0xefbb=['offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','VtigerConfiguration','include','findAll','rows','catch','params','length','find','create','body','findOne','VtigerField','options','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','fs-extra','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json'];(function(_0x242dfd,_0x46bbb8){var _0x4005f7=function(_0x4b77c9){while(--_0x4b77c9){_0x242dfd['push'](_0x242dfd['shift']());}};_0x4005f7(++_0x46bbb8);}(_0xefbb,0x11b));var _0xbefb=function(_0x50b903,_0x5bddf5){_0x50b903=_0x50b903-0x0;var _0x9a105d=_0xefbb[_0x50b903];return _0x9a105d;};'use strict';var emlformat=require(_0xbefb('0x0'));var rimraf=require(_0xbefb('0x1'));var zipdir=require(_0xbefb('0x2'));var jsonpatch=require(_0xbefb('0x3'));var rp=require(_0xbefb('0x4'));var moment=require('moment');var BPromise=require(_0xbefb('0x5'));var Mustache=require(_0xbefb('0x6'));var util=require(_0xbefb('0x7'));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(_0xbefb('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbefb('0x9'));var toCsv=require(_0xbefb('0xa'));var querystring=require(_0xbefb('0xb'));var Papa=require(_0xbefb('0xc'));var Redis=require(_0xbefb('0xd'));var authService=require(_0xbefb('0xe'));var qs=require(_0xbefb('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbefb('0x10'));var logger=require('../../config/logger')(_0xbefb('0x11'));var utils=require(_0xbefb('0x12'));var config=require(_0xbefb('0x13'));var licenseUtil=require(_0xbefb('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17e171,_0x26a956){_0x26a956=_0x26a956||0xcc;return function(_0x1be587){if(_0x1be587){return _0x17e171[_0xbefb('0x15')](_0x26a956);}return _0x17e171[_0xbefb('0x16')](_0x26a956)[_0xbefb('0x17')]();};}function respondWithResult(_0x1605c6,_0x468611){_0x468611=_0x468611||0xc8;return function(_0x46e0d2){if(_0x46e0d2){return _0x1605c6[_0xbefb('0x16')](_0x468611)[_0xbefb('0x18')](_0x46e0d2);}};}function respondWithFilteredResult(_0xb6e1ee,_0x3b466a){return function(_0x3092fd){if(_0x3092fd){var _0x552f44=typeof _0x3b466a[_0xbefb('0x19')]==='undefined'&&typeof _0x3b466a[_0xbefb('0x1a')]===_0xbefb('0x1b');var _0x422be1=_0x3092fd[_0xbefb('0x1c')];var _0x1ad15a=_0x552f44?0x0:_0x3b466a['offset'];var _0x53b462=_0x552f44?_0x3092fd[_0xbefb('0x1c')]:_0x3b466a[_0xbefb('0x19')]+_0x3b466a[_0xbefb('0x1a')];var _0x41af49;if(_0x53b462>=_0x422be1){_0x53b462=_0x422be1;_0x41af49=0xc8;}else{_0x41af49=0xce;}_0xb6e1ee[_0xbefb('0x16')](_0x41af49);return _0xb6e1ee[_0xbefb('0x1d')](_0xbefb('0x1e'),_0x1ad15a+'-'+_0x53b462+'/'+_0x422be1)[_0xbefb('0x18')](_0x3092fd);}return null;};}function patchUpdates(_0x186f1b){return function(_0x4a42c7){try{jsonpatch[_0xbefb('0x1f')](_0x4a42c7,_0x186f1b,!![]);}catch(_0x3c9198){return BPromise['reject'](_0x3c9198);}return _0x4a42c7[_0xbefb('0x20')]();};}function saveUpdates(_0x595e82,_0x38c0db){return function(_0x586a61){if(_0x586a61){return _0x586a61[_0xbefb('0x21')](_0x595e82)[_0xbefb('0x22')](function(_0x3188a8){return _0x3188a8;});}return null;};}function removeEntity(_0x19ae01,_0xfae7ee){return function(_0x24fa00){if(_0x24fa00){return _0x24fa00[_0xbefb('0x23')]()['then'](function(){_0x19ae01[_0xbefb('0x16')](0xcc)[_0xbefb('0x17')]();});}};}function handleEntityNotFound(_0x18e47c,_0x175a52){return function(_0x3c68b5){if(!_0x3c68b5){_0x18e47c['sendStatus'](0x194);}return _0x3c68b5;};}function handleError(_0x1b9e9d,_0x716c80){_0x716c80=_0x716c80||0x1f4;return function(_0x38daf3){logger[_0xbefb('0x24')](_0x38daf3[_0xbefb('0x25')]);if(_0x38daf3[_0xbefb('0x26')]){delete _0x38daf3[_0xbefb('0x26')];}_0x1b9e9d[_0xbefb('0x16')](_0x716c80)[_0xbefb('0x27')](_0x38daf3);};}exports[_0xbefb('0x28')]=function(_0x2c313b,_0x2539bc){var _0x5b4baf={},_0x338f72={},_0x5beee0={'count':0x0,'rows':[]};var _0x46d4f3=_['map'](db['VtigerConfiguration'][_0xbefb('0x29')],function(_0x264a18){return{'name':_0x264a18['fieldName'],'type':_0x264a18[_0xbefb('0x2a')][_0xbefb('0x2b')]};});_0x338f72[_0xbefb('0x2c')]=_[_0xbefb('0x2d')](_0x46d4f3,_0xbefb('0x26'));_0x338f72[_0xbefb('0x2e')]=_[_0xbefb('0x2f')](_0x2c313b[_0xbefb('0x2e')]);_0x338f72[_0xbefb('0x30')]=_['intersection'](_0x338f72[_0xbefb('0x2c')],_0x338f72[_0xbefb('0x2e')]);_0x5b4baf[_0xbefb('0x31')]=_[_0xbefb('0x32')](_0x338f72['model'],qs['fields'](_0x2c313b['query'][_0xbefb('0x33')]));_0x5b4baf[_0xbefb('0x31')]=_0x5b4baf[_0xbefb('0x31')]['length']?_0x5b4baf['attributes']:_0x338f72['model'];if(!_0x2c313b[_0xbefb('0x2e')][_0xbefb('0x34')](_0xbefb('0x35'))){_0x5b4baf[_0xbefb('0x1a')]=qs['limit'](_0x2c313b[_0xbefb('0x2e')][_0xbefb('0x1a')]);_0x5b4baf[_0xbefb('0x19')]=qs['offset'](_0x2c313b[_0xbefb('0x2e')]['offset']);}_0x5b4baf[_0xbefb('0x36')]=qs[_0xbefb('0x37')](_0x2c313b[_0xbefb('0x2e')][_0xbefb('0x37')]);_0x5b4baf[_0xbefb('0x38')]=qs['filters'](_[_0xbefb('0x39')](_0x2c313b[_0xbefb('0x2e')],_0x338f72[_0xbefb('0x30')]),_0x46d4f3);if(_0x2c313b['query'][_0xbefb('0x3a')]){_0x5b4baf[_0xbefb('0x38')]=_[_0xbefb('0x3b')](_0x5b4baf[_0xbefb('0x38')],{'$or':_[_0xbefb('0x2d')](_0x46d4f3,function(_0x3848f7){if(_0x3848f7[_0xbefb('0x2a')]!==_0xbefb('0x3c')){var _0x234118={};_0x234118[_0x3848f7['name']]={'$like':'%'+_0x2c313b[_0xbefb('0x2e')][_0xbefb('0x3a')]+'%'};return _0x234118;}})});}_0x5b4baf=_['merge']({},_0x5b4baf,_0x2c313b['options']);var _0x39929d={'where':_0x5b4baf[_0xbefb('0x38')]};return db[_0xbefb('0x3d')][_0xbefb('0x1c')](_0x39929d)[_0xbefb('0x22')](function(_0x1ef53a){_0x5beee0[_0xbefb('0x1c')]=_0x1ef53a;if(_0x2c313b[_0xbefb('0x2e')]['includeAll']){_0x5b4baf[_0xbefb('0x3e')]=[{'all':!![]}];}return db[_0xbefb('0x3d')][_0xbefb('0x3f')](_0x5b4baf);})[_0xbefb('0x22')](function(_0x5e2250){_0x5beee0[_0xbefb('0x40')]=_0x5e2250;return _0x5beee0;})['then'](respondWithFilteredResult(_0x2539bc,_0x5b4baf))[_0xbefb('0x41')](handleError(_0x2539bc,null));};exports['show']=function(_0x5ad55b,_0x480251){var _0xf13a71={'raw':![],'where':{'id':_0x5ad55b[_0xbefb('0x42')]['id']}},_0x10fbff={};_0x10fbff[_0xbefb('0x2c')]=_[_0xbefb('0x2f')](db[_0xbefb('0x3d')][_0xbefb('0x29')]);_0x10fbff[_0xbefb('0x2e')]=_[_0xbefb('0x2f')](_0x5ad55b[_0xbefb('0x2e')]);_0x10fbff[_0xbefb('0x30')]=_[_0xbefb('0x32')](_0x10fbff[_0xbefb('0x2c')],_0x10fbff[_0xbefb('0x2e')]);_0xf13a71['attributes']=_[_0xbefb('0x32')](_0x10fbff['model'],qs[_0xbefb('0x33')](_0x5ad55b[_0xbefb('0x2e')][_0xbefb('0x33')]));_0xf13a71['attributes']=_0xf13a71[_0xbefb('0x31')][_0xbefb('0x43')]?_0xf13a71[_0xbefb('0x31')]:_0x10fbff[_0xbefb('0x2c')];if(_0x5ad55b[_0xbefb('0x2e')]['includeAll']){_0xf13a71[_0xbefb('0x3e')]=[{'all':!![]}];}_0xf13a71=_[_0xbefb('0x3b')]({},_0xf13a71,_0x5ad55b['options']);return db['VtigerConfiguration'][_0xbefb('0x44')](_0xf13a71)['then'](handleEntityNotFound(_0x480251,null))['then'](respondWithResult(_0x480251,null))[_0xbefb('0x41')](handleError(_0x480251,null));};exports[_0xbefb('0x45')]=function(_0x5ca673,_0x1ecbe8){return db[_0xbefb('0x3d')][_0xbefb('0x45')](_0x5ca673[_0xbefb('0x46')],{})[_0xbefb('0x22')](respondWithResult(_0x1ecbe8,0xc9))[_0xbefb('0x41')](handleError(_0x1ecbe8,null));};exports[_0xbefb('0x21')]=function(_0x2cfbfa,_0x2a0c86){if(_0x2cfbfa[_0xbefb('0x46')]['id']){delete _0x2cfbfa['body']['id'];}return db[_0xbefb('0x3d')][_0xbefb('0x44')]({'where':{'id':_0x2cfbfa['params']['id']}})[_0xbefb('0x22')](handleEntityNotFound(_0x2a0c86,null))[_0xbefb('0x22')](saveUpdates(_0x2cfbfa[_0xbefb('0x46')],null))['then'](respondWithResult(_0x2a0c86,null))['catch'](handleError(_0x2a0c86,null));};exports[_0xbefb('0x23')]=function(_0x509377,_0x2d46dc){return db[_0xbefb('0x3d')]['find']({'where':{'id':_0x509377[_0xbefb('0x42')]['id']}})[_0xbefb('0x22')](handleEntityNotFound(_0x2d46dc,null))[_0xbefb('0x22')](removeEntity(_0x2d46dc,null))[_0xbefb('0x41')](handleError(_0x2d46dc,null));};exports['getFields']=function(_0x3c28a2,_0x27b65e,_0x323b23){var _0x2651b1={};var _0x55e73a={};var _0x3134f4;var _0x313ccc;return db[_0xbefb('0x3d')][_0xbefb('0x47')]({'where':{'id':_0x3c28a2[_0xbefb('0x42')]['id']}})[_0xbefb('0x22')](handleEntityNotFound(_0x27b65e,null))[_0xbefb('0x22')](function(_0x2cbd85){if(_0x2cbd85){_0x3134f4=_0x2cbd85;_0x55e73a[_0xbefb('0x2c')]=_[_0xbefb('0x2f')](db[_0xbefb('0x48')][_0xbefb('0x29')]);_0x55e73a[_0xbefb('0x2e')]=_[_0xbefb('0x2f')](_0x3c28a2['query']);_0x55e73a['filters']=_[_0xbefb('0x32')](_0x55e73a[_0xbefb('0x2c')],_0x55e73a[_0xbefb('0x2e')]);_0x2651b1[_0xbefb('0x31')]=_[_0xbefb('0x32')](_0x55e73a[_0xbefb('0x2c')],qs[_0xbefb('0x33')](_0x3c28a2[_0xbefb('0x2e')][_0xbefb('0x33')]));_0x2651b1['attributes']=_0x2651b1[_0xbefb('0x31')][_0xbefb('0x43')]?_0x2651b1[_0xbefb('0x31')]:_0x55e73a[_0xbefb('0x2c')];_0x2651b1[_0xbefb('0x36')]=qs[_0xbefb('0x37')](_0x3c28a2[_0xbefb('0x2e')][_0xbefb('0x37')]);_0x2651b1[_0xbefb('0x38')]=qs[_0xbefb('0x30')](_['pick'](_0x3c28a2['query'],_0x55e73a['filters']));if(_0x3c28a2[_0xbefb('0x2e')]['filter']){_0x2651b1[_0xbefb('0x38')]=_[_0xbefb('0x3b')](_0x2651b1['where'],{'$or':_[_0xbefb('0x2d')](_0x2651b1[_0xbefb('0x31')],function(_0x38dd34){var _0x551cf2={};_0x551cf2[_0x38dd34]={'$like':'%'+_0x3c28a2[_0xbefb('0x2e')][_0xbefb('0x3a')]+'%'};return _0x551cf2;})});}_0x2651b1=_[_0xbefb('0x3b')]({},_0x2651b1,_0x3c28a2[_0xbefb('0x49')]);return _0x3134f4[_0xbefb('0x4a')](_0x2651b1);}})[_0xbefb('0x22')](function(_0x3270fb){if(_0x3270fb){_0x313ccc=_0x3270fb[_0xbefb('0x43')];if(!_0x3c28a2[_0xbefb('0x2e')][_0xbefb('0x34')](_0xbefb('0x35'))){_0x2651b1[_0xbefb('0x1a')]=qs[_0xbefb('0x1a')](_0x3c28a2[_0xbefb('0x2e')][_0xbefb('0x1a')]);_0x2651b1[_0xbefb('0x19')]=qs[_0xbefb('0x19')](_0x3c28a2[_0xbefb('0x2e')]['offset']);}return _0x3134f4['getFields'](_0x2651b1);}})[_0xbefb('0x22')](function(_0x342f02){if(_0x342f02){return _0x342f02?{'count':_0x313ccc,'rows':_0x342f02}:null;}})[_0xbefb('0x22')](respondWithResult(_0x27b65e,null))[_0xbefb('0x41')](handleError(_0x27b65e,null));};exports[_0xbefb('0x4b')]=function(_0x2ad655,_0x560c98,_0x52d8e9){var _0x2a4c38={};var _0x14c0fb={};var _0x1fc89e;var _0x1265eb;return db['VtigerConfiguration'][_0xbefb('0x47')]({'where':{'id':_0x2ad655[_0xbefb('0x42')]['id']}})[_0xbefb('0x22')](handleEntityNotFound(_0x560c98,null))[_0xbefb('0x22')](function(_0x591dd7){if(_0x591dd7){_0x1fc89e=_0x591dd7;_0x14c0fb[_0xbefb('0x2c')]=_[_0xbefb('0x2f')](db[_0xbefb('0x48')][_0xbefb('0x29')]);_0x14c0fb['query']=_[_0xbefb('0x2f')](_0x2ad655['query']);_0x14c0fb[_0xbefb('0x30')]=_['intersection'](_0x14c0fb['model'],_0x14c0fb[_0xbefb('0x2e')]);_0x2a4c38['attributes']=_[_0xbefb('0x32')](_0x14c0fb[_0xbefb('0x2c')],qs[_0xbefb('0x33')](_0x2ad655['query']['fields']));_0x2a4c38[_0xbefb('0x31')]=_0x2a4c38[_0xbefb('0x31')]['length']?_0x2a4c38[_0xbefb('0x31')]:_0x14c0fb['model'];_0x2a4c38['order']=qs[_0xbefb('0x37')](_0x2ad655[_0xbefb('0x2e')][_0xbefb('0x37')]);_0x2a4c38[_0xbefb('0x38')]=qs[_0xbefb('0x30')](_['pick'](_0x2ad655[_0xbefb('0x2e')],_0x14c0fb[_0xbefb('0x30')]));if(_0x2ad655[_0xbefb('0x2e')][_0xbefb('0x3a')]){_0x2a4c38[_0xbefb('0x38')]=_[_0xbefb('0x3b')](_0x2a4c38[_0xbefb('0x38')],{'$or':_['map'](_0x2a4c38[_0xbefb('0x31')],function(_0x59a765){var _0x169fe9={};_0x169fe9[_0x59a765]={'$like':'%'+_0x2ad655[_0xbefb('0x2e')][_0xbefb('0x3a')]+'%'};return _0x169fe9;})});}_0x2a4c38=_[_0xbefb('0x3b')]({},_0x2a4c38,_0x2ad655[_0xbefb('0x49')]);return _0x1fc89e[_0xbefb('0x4b')](_0x2a4c38);}})[_0xbefb('0x22')](function(_0x1e17a3){if(_0x1e17a3){_0x1265eb=_0x1e17a3[_0xbefb('0x43')];if(!_0x2ad655[_0xbefb('0x2e')][_0xbefb('0x34')](_0xbefb('0x35'))){_0x2a4c38[_0xbefb('0x1a')]=qs[_0xbefb('0x1a')](_0x2ad655[_0xbefb('0x2e')][_0xbefb('0x1a')]);_0x2a4c38[_0xbefb('0x19')]=qs[_0xbefb('0x19')](_0x2ad655['query'][_0xbefb('0x19')]);}return _0x1fc89e[_0xbefb('0x4b')](_0x2a4c38);}})[_0xbefb('0x22')](function(_0x528124){if(_0x528124){return _0x528124?{'count':_0x1265eb,'rows':_0x528124}:null;}})[_0xbefb('0x22')](respondWithResult(_0x560c98,null))['catch'](handleError(_0x560c98,null));};exports[_0xbefb('0x4c')]=function(_0x24d1ea,_0x43f4ca,_0x4d9945){var _0x1a2bfe={};var _0x424e37={};var _0x101d4c;var _0x2a3f5e;return db[_0xbefb('0x3d')]['findOne']({'where':{'id':_0x24d1ea[_0xbefb('0x42')]['id']}})[_0xbefb('0x22')](handleEntityNotFound(_0x43f4ca,null))[_0xbefb('0x22')](function(_0x5294e8){if(_0x5294e8){_0x101d4c=_0x5294e8;_0x424e37[_0xbefb('0x2c')]=_[_0xbefb('0x2f')](db['VtigerField']['rawAttributes']);_0x424e37[_0xbefb('0x2e')]=_['keys'](_0x24d1ea[_0xbefb('0x2e')]);_0x424e37[_0xbefb('0x30')]=_[_0xbefb('0x32')](_0x424e37[_0xbefb('0x2c')],_0x424e37[_0xbefb('0x2e')]);_0x1a2bfe[_0xbefb('0x31')]=_[_0xbefb('0x32')](_0x424e37['model'],qs[_0xbefb('0x33')](_0x24d1ea[_0xbefb('0x2e')][_0xbefb('0x33')]));_0x1a2bfe['attributes']=_0x1a2bfe['attributes'][_0xbefb('0x43')]?_0x1a2bfe[_0xbefb('0x31')]:_0x424e37['model'];_0x1a2bfe[_0xbefb('0x36')]=qs[_0xbefb('0x37')](_0x24d1ea[_0xbefb('0x2e')][_0xbefb('0x37')]);_0x1a2bfe['where']=qs[_0xbefb('0x30')](_[_0xbefb('0x39')](_0x24d1ea[_0xbefb('0x2e')],_0x424e37[_0xbefb('0x30')]));if(_0x24d1ea['query'][_0xbefb('0x3a')]){_0x1a2bfe[_0xbefb('0x38')]=_[_0xbefb('0x3b')](_0x1a2bfe[_0xbefb('0x38')],{'$or':_[_0xbefb('0x2d')](_0x1a2bfe['attributes'],function(_0x514b6e){var _0x5c4c70={};_0x5c4c70[_0x514b6e]={'$like':'%'+_0x24d1ea[_0xbefb('0x2e')][_0xbefb('0x3a')]+'%'};return _0x5c4c70;})});}_0x1a2bfe=_[_0xbefb('0x3b')]({},_0x1a2bfe,_0x24d1ea[_0xbefb('0x49')]);return _0x101d4c[_0xbefb('0x4c')](_0x1a2bfe);}})[_0xbefb('0x22')](function(_0x3499e0){if(_0x3499e0){_0x2a3f5e=_0x3499e0[_0xbefb('0x43')];if(!_0x24d1ea[_0xbefb('0x2e')][_0xbefb('0x34')](_0xbefb('0x35'))){_0x1a2bfe[_0xbefb('0x1a')]=qs['limit'](_0x24d1ea[_0xbefb('0x2e')][_0xbefb('0x1a')]);_0x1a2bfe['offset']=qs[_0xbefb('0x19')](_0x24d1ea['query'][_0xbefb('0x19')]);}return _0x101d4c['getDescriptions'](_0x1a2bfe);}})['then'](function(_0x3def28){if(_0x3def28){return _0x3def28?{'count':_0x2a3f5e,'rows':_0x3def28}:null;}})[_0xbefb('0x22')](respondWithResult(_0x43f4ca,null))['catch'](handleError(_0x43f4ca,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 7c8e16c..e4b14ff 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 _0x29fa=['moment','path','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','util'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x29fa,0x15e));var _0xa29f=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x29fa[_0x199572];return _0x13cfa3;};'use strict';var _=require('lodash');var util=require(_0xa29f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa29f('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa29f('0x2'));var rimraf=require('rimraf');var config=require(_0xa29f('0x3'));var attributes=require(_0xa29f('0x4'));module[_0xa29f('0x5')]=function(_0x21e823,_0x44d7a4){return _0x21e823[_0xa29f('0x6')](_0xa29f('0x7'),attributes,{'tableName':_0xa29f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f4a=['rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x2f4a,0x1f1));var _0xa2f4=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x2f4a[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0xa2f4('0x0'));var util=require(_0xa2f4('0x1'));var logger=require(_0xa2f4('0x2'))(_0xa2f4('0x3'));var moment=require(_0xa2f4('0x4'));var BPromise=require(_0xa2f4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2f4('0x6'));var rimraf=require(_0xa2f4('0x7'));var config=require(_0xa2f4('0x8'));var attributes=require(_0xa2f4('0x9'));module[_0xa2f4('0xa')]=function(_0xade479,_0x38111a){return _0xade479['define']('VtigerConfiguration',attributes,{'tableName':_0xa2f4('0xb'),'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 10b5ec1..a5718a0 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 _0x3e5b=['VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','request\x20sent','debug'];(function(_0x2bab5a,_0x12f8a1){var _0x5931ea=function(_0x3a2d54){while(--_0x3a2d54){_0x2bab5a['push'](_0x2bab5a['shift']());}};_0x5931ea(++_0x12f8a1);}(_0x3e5b,0x141));var _0xb3e5=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x3e5b[_0x432682];return _0x463d05;};'use strict';var _=require(_0xb3e5('0x0'));var util=require(_0xb3e5('0x1'));var moment=require(_0xb3e5('0x2'));var BPromise=require(_0xb3e5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb3e5('0x4'));var db=require(_0xb3e5('0x5'))['db'];var utils=require(_0xb3e5('0x6'));var logger=require(_0xb3e5('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb3e5('0x8'));var client=jayson[_0xb3e5('0x9')][_0xb3e5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2dc72e,_0x3b8dfc,_0x3d84e4){return new BPromise(function(_0x4f7b1b,_0x52d458){return client[_0xb3e5('0xb')](_0x2dc72e,_0x3d84e4)[_0xb3e5('0xc')](function(_0x3cbd8f){logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x3b8dfc,_0xb3e5('0xd'));logger[_0xb3e5('0xe')](_0xb3e5('0xf'),_0x3b8dfc,_0xb3e5('0xd'),JSON[_0xb3e5('0x10')](_0x3cbd8f));if(_0x3cbd8f[_0xb3e5('0x11')]){if(_0x3cbd8f['error'][_0xb3e5('0x12')]===0x1f4){logger[_0xb3e5('0x11')](_0xb3e5('0x13'),_0x3b8dfc,_0x3cbd8f['error'][_0xb3e5('0x14')]);return _0x52d458(_0x3cbd8f[_0xb3e5('0x11')][_0xb3e5('0x14')]);}logger[_0xb3e5('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x3b8dfc,_0x3cbd8f[_0xb3e5('0x11')]['message']);return _0x4f7b1b(_0x3cbd8f['error'][_0xb3e5('0x14')]);}else{logger[_0xb3e5('0x15')](_0xb3e5('0x13'),_0x3b8dfc,_0xb3e5('0xd'));_0x4f7b1b(_0x3cbd8f[_0xb3e5('0x16')][_0xb3e5('0x14')]);}})[_0xb3e5('0x17')](function(_0x57fcc){logger[_0xb3e5('0x11')](_0xb3e5('0x13'),_0x3b8dfc,_0x57fcc);_0x52d458(_0x57fcc);});});} \ No newline at end of file +var _0x4f1f=['message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error'];(function(_0x2b64c2,_0x604583){var _0x51ba1e=function(_0x29a22f){while(--_0x29a22f){_0x2b64c2['push'](_0x2b64c2['shift']());}};_0x51ba1e(++_0x604583);}(_0x4f1f,0x117));var _0xf4f1=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4f1f[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require(_0xf4f1('0x0'));var moment=require(_0xf4f1('0x1'));var BPromise=require('bluebird');var rs=require(_0xf4f1('0x2'));var fs=require('fs');var Redis=require(_0xf4f1('0x3'));var db=require(_0xf4f1('0x4'))['db'];var utils=require(_0xf4f1('0x5'));var logger=require(_0xf4f1('0x6'))(_0xf4f1('0x7'));var config=require(_0xf4f1('0x8'));var jayson=require(_0xf4f1('0x9'));var client=jayson[_0xf4f1('0xa')][_0xf4f1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d5546,_0x35c1cd,_0x3fa4b3){return new BPromise(function(_0x33531f,_0x1cc7bb){return client[_0xf4f1('0xc')](_0x4d5546,_0x3fa4b3)[_0xf4f1('0xd')](function(_0x4e0786){logger[_0xf4f1('0xe')](_0xf4f1('0xf'),_0x35c1cd,_0xf4f1('0x10'));logger[_0xf4f1('0x11')](_0xf4f1('0x12'),_0x35c1cd,'request\x20sent',JSON['stringify'](_0x4e0786));if(_0x4e0786['error']){if(_0x4e0786['error']['code']===0x1f4){logger[_0xf4f1('0x13')](_0xf4f1('0xf'),_0x35c1cd,_0x4e0786['error'][_0xf4f1('0x14')]);return _0x1cc7bb(_0x4e0786[_0xf4f1('0x13')][_0xf4f1('0x14')]);}logger[_0xf4f1('0x13')](_0xf4f1('0xf'),_0x35c1cd,_0x4e0786['error'][_0xf4f1('0x14')]);return _0x33531f(_0x4e0786[_0xf4f1('0x13')][_0xf4f1('0x14')]);}else{logger[_0xf4f1('0xe')](_0xf4f1('0xf'),_0x35c1cd,_0xf4f1('0x10'));_0x33531f(_0x4e0786[_0xf4f1('0x15')]['message']);}})[_0xf4f1('0x16')](function(_0x4851db){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x35c1cd,_0x4851db);_0x1cc7bb(_0x4851db);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 4f75379..35e2eba 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 _0xa1d2=['update','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','isAuthenticated','index','get','/:id','post','put'];(function(_0x24da57,_0x3771d7){var _0x370d75=function(_0x36afc2){while(--_0x36afc2){_0x24da57['push'](_0x24da57['shift']());}};_0x370d75(++_0x3771d7);}(_0xa1d2,0x166));var _0x2a1d=function(_0x58399c,_0x98c8d6){_0x58399c=_0x58399c-0x0;var _0x363450=_0xa1d2[_0x58399c];return _0x363450;};'use strict';var multer=require('multer');var util=require(_0x2a1d('0x0'));var path=require(_0x2a1d('0x1'));var timeout=require(_0x2a1d('0x2'));var express=require(_0x2a1d('0x3'));var router=express[_0x2a1d('0x4')]();var fs_extra=require(_0x2a1d('0x5'));var auth=require(_0x2a1d('0x6'));var interaction=require(_0x2a1d('0x7'));var config=require(_0x2a1d('0x8'));var controller=require(_0x2a1d('0x9'));router['get']('/',auth[_0x2a1d('0xa')](),controller[_0x2a1d('0xb')]);router[_0x2a1d('0xc')](_0x2a1d('0xd'),auth[_0x2a1d('0xa')](),controller['show']);router[_0x2a1d('0xe')]('/',auth[_0x2a1d('0xa')](),controller['create']);router[_0x2a1d('0xf')](_0x2a1d('0xd'),auth[_0x2a1d('0xa')](),controller[_0x2a1d('0x10')]);router['delete'](_0x2a1d('0xd'),auth[_0x2a1d('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1823=['get','isAuthenticated','index','show','post','create','put','/:id','destroy','exports','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1e9752,_0x100ced){var _0x3d2527=function(_0x1c7659){while(--_0x1c7659){_0x1e9752['push'](_0x1e9752['shift']());}};_0x3d2527(++_0x100ced);}(_0x1823,0x12a));var _0x3182=function(_0x5b84ff,_0x47e637){_0x5b84ff=_0x5b84ff-0x0;var _0xf145d9=_0x1823[_0x5b84ff];return _0xf145d9;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x3182('0x0'));var express=require('express');var router=express[_0x3182('0x1')]();var fs_extra=require(_0x3182('0x2'));var auth=require(_0x3182('0x3'));var interaction=require(_0x3182('0x4'));var config=require(_0x3182('0x5'));var controller=require('./intVtigerField.controller');router[_0x3182('0x6')]('/',auth[_0x3182('0x7')](),controller[_0x3182('0x8')]);router[_0x3182('0x6')]('/:id',auth[_0x3182('0x7')](),controller[_0x3182('0x9')]);router[_0x3182('0xa')]('/',auth[_0x3182('0x7')](),controller[_0x3182('0xb')]);router[_0x3182('0xc')]('/:id',auth[_0x3182('0x7')](),controller['update']);router['delete'](_0x3182('0xd'),auth[_0x3182('0x7')](),controller[_0x3182('0xe')]);module[_0x3182('0xf')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index f9b37b2..72d9cd6 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 _0x3239=['sequelize','exports','ENUM','string','variable','customVariable','picklist','STRING'];(function(_0x489a8b,_0x3f5089){var _0x111357=function(_0x4e0ed9){while(--_0x4e0ed9){_0x489a8b['push'](_0x489a8b['shift']());}};_0x111357(++_0x3f5089);}(_0x3239,0x70));var _0x9323=function(_0x29331a,_0x16c26d){_0x29331a=_0x29331a-0x0;var _0x4a9b3f=_0x3239[_0x29331a];return _0x4a9b3f;};'use strict';var Sequelize=require(_0x9323('0x0'));module[_0x9323('0x1')]={'type':{'type':Sequelize[_0x9323('0x2')](_0x9323('0x3'),_0x9323('0x4'),_0x9323('0x5'),'keyValue',_0x9323('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9323('0x2')]('string',_0x9323('0x4'),_0x9323('0x5'))},'keyContent':{'type':Sequelize[_0x9323('0x7')]},'idField':{'type':Sequelize[_0x9323('0x7')]},'nameField':{'type':Sequelize[_0x9323('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9323('0x7')]}}; \ No newline at end of file +var _0x1a4f=['STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','keyValue'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x1a4f,0x15b));var _0xf1a4=function(_0x367b36,_0x1db097){_0x367b36=_0x367b36-0x0;var _0x4b9382=_0x1a4f[_0x367b36];return _0x4b9382;};'use strict';var Sequelize=require(_0xf1a4('0x0'));module[_0xf1a4('0x1')]={'type':{'type':Sequelize[_0xf1a4('0x2')](_0xf1a4('0x3'),'variable','customVariable',_0xf1a4('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xf1a4('0x5')]},'keyType':{'type':Sequelize[_0xf1a4('0x2')]('string',_0xf1a4('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0xf1a4('0x5')]},'idField':{'type':Sequelize[_0xf1a4('0x5')]},'nameField':{'type':Sequelize[_0xf1a4('0x5')]},'customField':{'type':Sequelize[_0xf1a4('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf1a4('0x5')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 83566c4..e8f64d0 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 _0x330b=['lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','offset','undefined','limit','count','status','json','apply','reject','save','update','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','VtigerField','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x58b354,_0x24ca13){var _0x5502b6=function(_0x51ee3c){while(--_0x51ee3c){_0x58b354['push'](_0x58b354['shift']());}};_0x5502b6(++_0x24ca13);}(_0x330b,0x11b));var _0xb330=function(_0x11cd30,_0x58b742){_0x11cd30=_0x11cd30-0x0;var _0x1954c0=_0x330b[_0x11cd30];return _0x1954c0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb330('0x0'));var zipdir=require(_0xb330('0x1'));var jsonpatch=require(_0xb330('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb330('0x3'));var path=require(_0xb330('0x4'));var sox=require(_0xb330('0x5'));var csv=require(_0xb330('0x6'));var ejs=require(_0xb330('0x7'));var fs=require('fs');var fs_extra=require(_0xb330('0x8'));var _=require(_0xb330('0x9'));var squel=require(_0xb330('0xa'));var crypto=require('crypto');var jsforce=require(_0xb330('0xb'));var deskjs=require(_0xb330('0xc'));var toCsv=require(_0xb330('0x6'));var querystring=require(_0xb330('0xd'));var Papa=require(_0xb330('0xe'));var Redis=require(_0xb330('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb330('0x10'));var hardwareService=require(_0xb330('0x11'));var logger=require(_0xb330('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb330('0x13'));var db=require(_0xb330('0x14'))['db'];function respondWithStatusCode(_0x14c215,_0xe5498a){_0xe5498a=_0xe5498a||0xcc;return function(_0x545f8b){if(_0x545f8b){return _0x14c215[_0xb330('0x15')](_0xe5498a);}return _0x14c215['status'](_0xe5498a)['end']();};}function respondWithResult(_0x181b10,_0x189bed){_0x189bed=_0x189bed||0xc8;return function(_0x1277a2){if(_0x1277a2){return _0x181b10['status'](_0x189bed)['json'](_0x1277a2);}};}function respondWithFilteredResult(_0x1d70c5,_0x5e97bd){return function(_0x543883){if(_0x543883){var _0x297c9d=typeof _0x5e97bd[_0xb330('0x16')]===_0xb330('0x17')&&typeof _0x5e97bd[_0xb330('0x18')]===_0xb330('0x17');var _0x97c9f5=_0x543883[_0xb330('0x19')];var _0x5df5c6=_0x297c9d?0x0:_0x5e97bd['offset'];var _0x1f231c=_0x297c9d?_0x543883[_0xb330('0x19')]:_0x5e97bd[_0xb330('0x16')]+_0x5e97bd[_0xb330('0x18')];var _0x5e5acc;if(_0x1f231c>=_0x97c9f5){_0x1f231c=_0x97c9f5;_0x5e5acc=0xc8;}else{_0x5e5acc=0xce;}_0x1d70c5[_0xb330('0x1a')](_0x5e5acc);return _0x1d70c5['set']('Content-Range',_0x5df5c6+'-'+_0x1f231c+'/'+_0x97c9f5)[_0xb330('0x1b')](_0x543883);}return null;};}function patchUpdates(_0x3f4689){return function(_0x332e64){try{jsonpatch[_0xb330('0x1c')](_0x332e64,_0x3f4689,!![]);}catch(_0x3c54e0){return BPromise[_0xb330('0x1d')](_0x3c54e0);}return _0x332e64[_0xb330('0x1e')]();};}function saveUpdates(_0x430b1c,_0x3a01d9){return function(_0x5b2358){if(_0x5b2358){return _0x5b2358[_0xb330('0x1f')](_0x430b1c)[_0xb330('0x20')](function(_0x2b52f0){return _0x2b52f0;});}return null;};}function removeEntity(_0x811a26,_0xcf4513){return function(_0x23fd19){if(_0x23fd19){return _0x23fd19['destroy']()[_0xb330('0x20')](function(){_0x811a26[_0xb330('0x1a')](0xcc)[_0xb330('0x21')]();});}};}function handleEntityNotFound(_0x209063,_0x1ed44a){return function(_0x576284){if(!_0x576284){_0x209063['sendStatus'](0x194);}return _0x576284;};}function handleError(_0x1316cd,_0x4b1f2f){_0x4b1f2f=_0x4b1f2f||0x1f4;return function(_0xc31713){logger[_0xb330('0x22')](_0xc31713[_0xb330('0x23')]);if(_0xc31713[_0xb330('0x24')]){delete _0xc31713[_0xb330('0x24')];}_0x1316cd[_0xb330('0x1a')](_0x4b1f2f)[_0xb330('0x25')](_0xc31713);};}exports[_0xb330('0x26')]=function(_0x3a3023,_0x47683f){var _0x5bee41={},_0x586b8a={},_0x3cf271={'count':0x0,'rows':[]};var _0x34be0e=_[_0xb330('0x27')](db['VtigerField'][_0xb330('0x28')],function(_0x5a180e){return{'name':_0x5a180e[_0xb330('0x29')],'type':_0x5a180e['type']['key']};});_0x586b8a[_0xb330('0x2a')]=_[_0xb330('0x27')](_0x34be0e,_0xb330('0x24'));_0x586b8a[_0xb330('0x2b')]=_[_0xb330('0x2c')](_0x3a3023[_0xb330('0x2b')]);_0x586b8a[_0xb330('0x2d')]=_[_0xb330('0x2e')](_0x586b8a[_0xb330('0x2a')],_0x586b8a[_0xb330('0x2b')]);_0x5bee41[_0xb330('0x2f')]=_[_0xb330('0x2e')](_0x586b8a[_0xb330('0x2a')],qs[_0xb330('0x30')](_0x3a3023[_0xb330('0x2b')][_0xb330('0x30')]));_0x5bee41[_0xb330('0x2f')]=_0x5bee41[_0xb330('0x2f')][_0xb330('0x31')]?_0x5bee41[_0xb330('0x2f')]:_0x586b8a[_0xb330('0x2a')];if(!_0x3a3023[_0xb330('0x2b')][_0xb330('0x32')](_0xb330('0x33'))){_0x5bee41[_0xb330('0x18')]=qs[_0xb330('0x18')](_0x3a3023[_0xb330('0x2b')][_0xb330('0x18')]);_0x5bee41['offset']=qs[_0xb330('0x16')](_0x3a3023[_0xb330('0x2b')][_0xb330('0x16')]);}_0x5bee41[_0xb330('0x34')]=qs['sort'](_0x3a3023[_0xb330('0x2b')][_0xb330('0x35')]);_0x5bee41[_0xb330('0x36')]=qs[_0xb330('0x2d')](_[_0xb330('0x37')](_0x3a3023[_0xb330('0x2b')],_0x586b8a[_0xb330('0x2d')]),_0x34be0e);if(_0x3a3023[_0xb330('0x2b')][_0xb330('0x38')]){_0x5bee41[_0xb330('0x36')]=_[_0xb330('0x39')](_0x5bee41['where'],{'$or':_[_0xb330('0x27')](_0x34be0e,function(_0x103cb3){if(_0x103cb3[_0xb330('0x3a')]!==_0xb330('0x3b')){var _0x2a810d={};_0x2a810d[_0x103cb3['name']]={'$like':'%'+_0x3a3023[_0xb330('0x2b')]['filter']+'%'};return _0x2a810d;}})});}_0x5bee41=_['merge']({},_0x5bee41,_0x3a3023[_0xb330('0x3c')]);var _0x1eef97={'where':_0x5bee41[_0xb330('0x36')]};return db[_0xb330('0x3d')][_0xb330('0x19')](_0x1eef97)['then'](function(_0x47a926){_0x3cf271[_0xb330('0x19')]=_0x47a926;if(_0x3a3023[_0xb330('0x2b')][_0xb330('0x3e')]){_0x5bee41[_0xb330('0x3f')]=[{'all':!![]}];}return db[_0xb330('0x3d')][_0xb330('0x40')](_0x5bee41);})[_0xb330('0x20')](function(_0x5351e7){_0x3cf271[_0xb330('0x41')]=_0x5351e7;return _0x3cf271;})['then'](respondWithFilteredResult(_0x47683f,_0x5bee41))[_0xb330('0x42')](handleError(_0x47683f,null));};exports[_0xb330('0x43')]=function(_0x44de76,_0x535f77){var _0x53d319={'raw':!![],'where':{'id':_0x44de76[_0xb330('0x44')]['id']}},_0x251e45={};_0x251e45[_0xb330('0x2a')]=_[_0xb330('0x2c')](db[_0xb330('0x3d')][_0xb330('0x28')]);_0x251e45[_0xb330('0x2b')]=_[_0xb330('0x2c')](_0x44de76[_0xb330('0x2b')]);_0x251e45[_0xb330('0x2d')]=_['intersection'](_0x251e45[_0xb330('0x2a')],_0x251e45['query']);_0x53d319['attributes']=_[_0xb330('0x2e')](_0x251e45[_0xb330('0x2a')],qs[_0xb330('0x30')](_0x44de76[_0xb330('0x2b')][_0xb330('0x30')]));_0x53d319[_0xb330('0x2f')]=_0x53d319[_0xb330('0x2f')][_0xb330('0x31')]?_0x53d319[_0xb330('0x2f')]:_0x251e45[_0xb330('0x2a')];if(_0x44de76[_0xb330('0x2b')][_0xb330('0x3e')]){_0x53d319['include']=[{'all':!![]}];}_0x53d319=_[_0xb330('0x39')]({},_0x53d319,_0x44de76[_0xb330('0x3c')]);return db[_0xb330('0x3d')][_0xb330('0x45')](_0x53d319)['then'](handleEntityNotFound(_0x535f77,null))['then'](respondWithResult(_0x535f77,null))[_0xb330('0x42')](handleError(_0x535f77,null));};exports[_0xb330('0x46')]=function(_0x210412,_0x16025e){return db[_0xb330('0x3d')]['create'](_0x210412['body'],{})[_0xb330('0x20')](respondWithResult(_0x16025e,0xc9))['catch'](handleError(_0x16025e,null));};exports[_0xb330('0x1f')]=function(_0xcfae27,_0x528116){if(_0xcfae27[_0xb330('0x47')]['id']){delete _0xcfae27[_0xb330('0x47')]['id'];}return db[_0xb330('0x3d')]['find']({'where':{'id':_0xcfae27['params']['id']}})[_0xb330('0x20')](handleEntityNotFound(_0x528116,null))['then'](saveUpdates(_0xcfae27[_0xb330('0x47')],null))[_0xb330('0x20')](respondWithResult(_0x528116,null))[_0xb330('0x42')](handleError(_0x528116,null));};exports[_0xb330('0x48')]=function(_0x25c71a,_0xf8087b){return db[_0xb330('0x3d')][_0xb330('0x45')]({'where':{'id':_0x25c71a[_0xb330('0x44')]['id']}})[_0xb330('0x20')](handleEntityNotFound(_0xf8087b,null))['then'](removeEntity(_0xf8087b,null))['catch'](handleError(_0xf8087b,null));}; \ No newline at end of file +var _0xf845=['find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','VtigerField','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf845,0x13f));var _0x5f84=function(_0x4758b3,_0x4b9cf8){_0x4758b3=_0x4758b3-0x0;var _0x3110d4=_0xf845[_0x4758b3];return _0x3110d4;};'use strict';var emlformat=require(_0x5f84('0x0'));var rimraf=require(_0x5f84('0x1'));var zipdir=require(_0x5f84('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5f84('0x3'));var moment=require(_0x5f84('0x4'));var BPromise=require(_0x5f84('0x5'));var Mustache=require(_0x5f84('0x6'));var util=require('util');var path=require(_0x5f84('0x7'));var sox=require(_0x5f84('0x8'));var csv=require(_0x5f84('0x9'));var ejs=require(_0x5f84('0xa'));var fs=require('fs');var fs_extra=require(_0x5f84('0xb'));var _=require(_0x5f84('0xc'));var squel=require(_0x5f84('0xd'));var crypto=require(_0x5f84('0xe'));var jsforce=require(_0x5f84('0xf'));var deskjs=require(_0x5f84('0x10'));var toCsv=require(_0x5f84('0x9'));var querystring=require('querystring');var Papa=require(_0x5f84('0x11'));var Redis=require(_0x5f84('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5f84('0x13'));var as=require(_0x5f84('0x14'));var hardwareService=require(_0x5f84('0x15'));var logger=require(_0x5f84('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x5f84('0x17'));var licenseUtil=require(_0x5f84('0x18'));var db=require(_0x5f84('0x19'))['db'];function respondWithStatusCode(_0x441b80,_0x1ee1b5){_0x1ee1b5=_0x1ee1b5||0xcc;return function(_0x14e350){if(_0x14e350){return _0x441b80[_0x5f84('0x1a')](_0x1ee1b5);}return _0x441b80['status'](_0x1ee1b5)[_0x5f84('0x1b')]();};}function respondWithResult(_0x5a8169,_0x4dae04){_0x4dae04=_0x4dae04||0xc8;return function(_0x4cfb06){if(_0x4cfb06){return _0x5a8169['status'](_0x4dae04)[_0x5f84('0x1c')](_0x4cfb06);}};}function respondWithFilteredResult(_0x4a0688,_0x7fc5b6){return function(_0x14ea3c){if(_0x14ea3c){var _0x4f4e19=typeof _0x7fc5b6[_0x5f84('0x1d')]==='undefined'&&typeof _0x7fc5b6['limit']===_0x5f84('0x1e');var _0x5cc13c=_0x14ea3c[_0x5f84('0x1f')];var _0x3c5da1=_0x4f4e19?0x0:_0x7fc5b6[_0x5f84('0x1d')];var _0x4d5632=_0x4f4e19?_0x14ea3c[_0x5f84('0x1f')]:_0x7fc5b6['offset']+_0x7fc5b6[_0x5f84('0x20')];var _0x1faa8d;if(_0x4d5632>=_0x5cc13c){_0x4d5632=_0x5cc13c;_0x1faa8d=0xc8;}else{_0x1faa8d=0xce;}_0x4a0688[_0x5f84('0x21')](_0x1faa8d);return _0x4a0688[_0x5f84('0x22')](_0x5f84('0x23'),_0x3c5da1+'-'+_0x4d5632+'/'+_0x5cc13c)[_0x5f84('0x1c')](_0x14ea3c);}return null;};}function patchUpdates(_0x168140){return function(_0x40b3f1){try{jsonpatch[_0x5f84('0x24')](_0x40b3f1,_0x168140,!![]);}catch(_0x27a66c){return BPromise[_0x5f84('0x25')](_0x27a66c);}return _0x40b3f1[_0x5f84('0x26')]();};}function saveUpdates(_0x36621a,_0x5b0356){return function(_0x27f3b7){if(_0x27f3b7){return _0x27f3b7[_0x5f84('0x27')](_0x36621a)[_0x5f84('0x28')](function(_0xf46304){return _0xf46304;});}return null;};}function removeEntity(_0x5dceb6,_0x5bd038){return function(_0x245c8d){if(_0x245c8d){return _0x245c8d[_0x5f84('0x29')]()[_0x5f84('0x28')](function(){_0x5dceb6[_0x5f84('0x21')](0xcc)[_0x5f84('0x1b')]();});}};}function handleEntityNotFound(_0x5e7fe2,_0x1e409f){return function(_0x39d687){if(!_0x39d687){_0x5e7fe2[_0x5f84('0x1a')](0x194);}return _0x39d687;};}function handleError(_0x2f7e3f,_0x27c508){_0x27c508=_0x27c508||0x1f4;return function(_0x13a1cc){logger[_0x5f84('0x2a')](_0x13a1cc[_0x5f84('0x2b')]);if(_0x13a1cc[_0x5f84('0x2c')]){delete _0x13a1cc['name'];}_0x2f7e3f['status'](_0x27c508)[_0x5f84('0x2d')](_0x13a1cc);};}exports[_0x5f84('0x2e')]=function(_0x296c53,_0x1a0dfe){var _0x42f84f={},_0x3d0983={},_0x36a41b={'count':0x0,'rows':[]};var _0x294176=_['map'](db[_0x5f84('0x2f')][_0x5f84('0x30')],function(_0xc8f06f){return{'name':_0xc8f06f[_0x5f84('0x31')],'type':_0xc8f06f[_0x5f84('0x32')]['key']};});_0x3d0983[_0x5f84('0x33')]=_[_0x5f84('0x34')](_0x294176,'name');_0x3d0983[_0x5f84('0x35')]=_[_0x5f84('0x36')](_0x296c53['query']);_0x3d0983[_0x5f84('0x37')]=_['intersection'](_0x3d0983[_0x5f84('0x33')],_0x3d0983[_0x5f84('0x35')]);_0x42f84f[_0x5f84('0x38')]=_[_0x5f84('0x39')](_0x3d0983[_0x5f84('0x33')],qs[_0x5f84('0x3a')](_0x296c53[_0x5f84('0x35')][_0x5f84('0x3a')]));_0x42f84f['attributes']=_0x42f84f[_0x5f84('0x38')][_0x5f84('0x3b')]?_0x42f84f['attributes']:_0x3d0983[_0x5f84('0x33')];if(!_0x296c53[_0x5f84('0x35')][_0x5f84('0x3c')](_0x5f84('0x3d'))){_0x42f84f[_0x5f84('0x20')]=qs[_0x5f84('0x20')](_0x296c53[_0x5f84('0x35')][_0x5f84('0x20')]);_0x42f84f['offset']=qs[_0x5f84('0x1d')](_0x296c53[_0x5f84('0x35')][_0x5f84('0x1d')]);}_0x42f84f[_0x5f84('0x3e')]=qs[_0x5f84('0x3f')](_0x296c53[_0x5f84('0x35')][_0x5f84('0x3f')]);_0x42f84f[_0x5f84('0x40')]=qs[_0x5f84('0x37')](_[_0x5f84('0x41')](_0x296c53[_0x5f84('0x35')],_0x3d0983['filters']),_0x294176);if(_0x296c53[_0x5f84('0x35')]['filter']){_0x42f84f['where']=_[_0x5f84('0x42')](_0x42f84f['where'],{'$or':_[_0x5f84('0x34')](_0x294176,function(_0x62dea){if(_0x62dea[_0x5f84('0x32')]!==_0x5f84('0x43')){var _0x499395={};_0x499395[_0x62dea['name']]={'$like':'%'+_0x296c53[_0x5f84('0x35')][_0x5f84('0x44')]+'%'};return _0x499395;}})});}_0x42f84f=_[_0x5f84('0x42')]({},_0x42f84f,_0x296c53[_0x5f84('0x45')]);var _0x3ff908={'where':_0x42f84f[_0x5f84('0x40')]};return db[_0x5f84('0x2f')]['count'](_0x3ff908)['then'](function(_0x3b7490){_0x36a41b[_0x5f84('0x1f')]=_0x3b7490;if(_0x296c53[_0x5f84('0x35')][_0x5f84('0x46')]){_0x42f84f['include']=[{'all':!![]}];}return db[_0x5f84('0x2f')][_0x5f84('0x47')](_0x42f84f);})[_0x5f84('0x28')](function(_0x309b74){_0x36a41b[_0x5f84('0x48')]=_0x309b74;return _0x36a41b;})[_0x5f84('0x28')](respondWithFilteredResult(_0x1a0dfe,_0x42f84f))[_0x5f84('0x49')](handleError(_0x1a0dfe,null));};exports[_0x5f84('0x4a')]=function(_0x24daf1,_0x3bd74f){var _0x157102={'raw':!![],'where':{'id':_0x24daf1[_0x5f84('0x4b')]['id']}},_0x447447={};_0x447447[_0x5f84('0x33')]=_[_0x5f84('0x36')](db[_0x5f84('0x2f')][_0x5f84('0x30')]);_0x447447[_0x5f84('0x35')]=_[_0x5f84('0x36')](_0x24daf1[_0x5f84('0x35')]);_0x447447['filters']=_[_0x5f84('0x39')](_0x447447[_0x5f84('0x33')],_0x447447[_0x5f84('0x35')]);_0x157102['attributes']=_[_0x5f84('0x39')](_0x447447['model'],qs[_0x5f84('0x3a')](_0x24daf1['query']['fields']));_0x157102[_0x5f84('0x38')]=_0x157102[_0x5f84('0x38')][_0x5f84('0x3b')]?_0x157102[_0x5f84('0x38')]:_0x447447[_0x5f84('0x33')];if(_0x24daf1[_0x5f84('0x35')]['includeAll']){_0x157102['include']=[{'all':!![]}];}_0x157102=_[_0x5f84('0x42')]({},_0x157102,_0x24daf1[_0x5f84('0x45')]);return db[_0x5f84('0x2f')][_0x5f84('0x4c')](_0x157102)[_0x5f84('0x28')](handleEntityNotFound(_0x3bd74f,null))[_0x5f84('0x28')](respondWithResult(_0x3bd74f,null))['catch'](handleError(_0x3bd74f,null));};exports[_0x5f84('0x4d')]=function(_0x2d4cdf,_0xa67c6){return db['VtigerField']['create'](_0x2d4cdf[_0x5f84('0x4e')],{})['then'](respondWithResult(_0xa67c6,0xc9))[_0x5f84('0x49')](handleError(_0xa67c6,null));};exports['update']=function(_0x311643,_0x574ad5){if(_0x311643[_0x5f84('0x4e')]['id']){delete _0x311643['body']['id'];}return db[_0x5f84('0x2f')][_0x5f84('0x4c')]({'where':{'id':_0x311643[_0x5f84('0x4b')]['id']}})[_0x5f84('0x28')](handleEntityNotFound(_0x574ad5,null))['then'](saveUpdates(_0x311643[_0x5f84('0x4e')],null))[_0x5f84('0x28')](respondWithResult(_0x574ad5,null))[_0x5f84('0x49')](handleError(_0x574ad5,null));};exports['destroy']=function(_0x3a1398,_0xe1279d){return db[_0x5f84('0x2f')]['find']({'where':{'id':_0x3a1398['params']['id']}})['then'](handleEntityNotFound(_0xe1279d,null))[_0x5f84('0x28')](removeEntity(_0xe1279d,null))[_0x5f84('0x49')](handleError(_0xe1279d,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index d9f9f64..ceaa184 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 _0xdcd0=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VtigerField','idField','FieldId'];(function(_0x4477f6,_0x786920){var _0x2de580=function(_0x4f95b1){while(--_0x4f95b1){_0x4477f6['push'](_0x4477f6['shift']());}};_0x2de580(++_0x786920);}(_0xdcd0,0x1b2));var _0x0dcd=function(_0x3a3b31,_0x5853a6){_0x3a3b31=_0x3a3b31-0x0;var _0xdf6e2e=_0xdcd0[_0x3a3b31];return _0xdf6e2e;};'use strict';var _=require(_0x0dcd('0x0'));var util=require('util');var logger=require(_0x0dcd('0x1'))(_0x0dcd('0x2'));var moment=require(_0x0dcd('0x3'));var BPromise=require(_0x0dcd('0x4'));var rp=require(_0x0dcd('0x5'));var fs=require('fs');var path=require(_0x0dcd('0x6'));var rimraf=require(_0x0dcd('0x7'));var config=require(_0x0dcd('0x8'));var attributes=require('./intVtigerField.attributes');module[_0x0dcd('0x9')]=function(_0x52f86e,_0x17e6cc){return _0x52f86e[_0x0dcd('0xa')](_0x0dcd('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x0dcd('0xc'),_0x0dcd('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x812c=['request-promise','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util','api','moment','bluebird'];(function(_0x2a3685,_0x3d2981){var _0x240b39=function(_0x1836ad){while(--_0x1836ad){_0x2a3685['push'](_0x2a3685['shift']());}};_0x240b39(++_0x3d2981);}(_0x812c,0x109));var _0xc812=function(_0x184759,_0x1cc38a){_0x184759=_0x184759-0x0;var _0xf26d5f=_0x812c[_0x184759];return _0xf26d5f;};'use strict';var _=require(_0xc812('0x0'));var util=require(_0xc812('0x1'));var logger=require('../../config/logger')(_0xc812('0x2'));var moment=require(_0xc812('0x3'));var BPromise=require(_0xc812('0x4'));var rp=require(_0xc812('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc812('0x6'));var attributes=require(_0xc812('0x7'));module[_0xc812('0x8')]=function(_0x4586eb,_0xee816f){return _0x4586eb[_0xc812('0x9')](_0xc812('0xa'),attributes,{'tableName':_0xc812('0xb'),'paranoid':![],'indexes':[{'name':_0xc812('0xc'),'fields':[_0xc812('0xd'),_0xc812('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index b39d1c4..7c2e873 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 _0xdc69=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x574f11,_0x2fd016){var _0x4da58c=function(_0x186541){while(--_0x186541){_0x574f11['push'](_0x574f11['shift']());}};_0x4da58c(++_0x2fd016);}(_0xdc69,0x177));var _0x9dc6=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xdc69[_0x16d10f];return _0x50c823;};'use strict';var _=require(_0x9dc6('0x0'));var util=require(_0x9dc6('0x1'));var moment=require(_0x9dc6('0x2'));var BPromise=require(_0x9dc6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9dc6('0x4'));var db=require(_0x9dc6('0x5'))['db'];var utils=require(_0x9dc6('0x6'));var logger=require(_0x9dc6('0x7'))(_0x9dc6('0x8'));var config=require(_0x9dc6('0x9'));var jayson=require(_0x9dc6('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x9bfd44,_0x444146,_0x1ee8bc){return new BPromise(function(_0x4de5a1,_0x5d5062){return client['request'](_0x9bfd44,_0x1ee8bc)[_0x9dc6('0xb')](function(_0x15fb60){logger[_0x9dc6('0xc')](_0x9dc6('0xd'),_0x444146,_0x9dc6('0xe'));logger[_0x9dc6('0xf')](_0x9dc6('0x10'),_0x444146,_0x9dc6('0xe'),JSON[_0x9dc6('0x11')](_0x15fb60));if(_0x15fb60[_0x9dc6('0x12')]){if(_0x15fb60['error'][_0x9dc6('0x13')]===0x1f4){logger['error'](_0x9dc6('0xd'),_0x444146,_0x15fb60[_0x9dc6('0x12')][_0x9dc6('0x14')]);return _0x5d5062(_0x15fb60[_0x9dc6('0x12')][_0x9dc6('0x14')]);}logger[_0x9dc6('0x12')](_0x9dc6('0xd'),_0x444146,_0x15fb60[_0x9dc6('0x12')][_0x9dc6('0x14')]);return _0x4de5a1(_0x15fb60[_0x9dc6('0x12')][_0x9dc6('0x14')]);}else{logger[_0x9dc6('0xc')]('VtigerField,\x20%s,\x20%s',_0x444146,_0x9dc6('0xe'));_0x4de5a1(_0x15fb60['result'][_0x9dc6('0x14')]);}})[_0x9dc6('0x15')](function(_0x2c8db7){logger[_0x9dc6('0x12')](_0x9dc6('0xd'),_0x444146,_0x2c8db7);_0x5d5062(_0x2c8db7);});});} \ No newline at end of file +var _0xe380=['info','VtigerField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','request','then'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xe380,0x73));var _0x0e38=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xe380[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0x0e38('0x0'));var util=require(_0x0e38('0x1'));var moment=require('moment');var BPromise=require(_0x0e38('0x2'));var rs=require(_0x0e38('0x3'));var fs=require('fs');var Redis=require(_0x0e38('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0e38('0x5'));var logger=require(_0x0e38('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0e38('0x7'));var client=jayson['client'][_0x0e38('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x280436,_0x56c27e,_0x24ec34){return new BPromise(function(_0x4630e2,_0x15e3af){return client[_0x0e38('0x9')](_0x280436,_0x24ec34)[_0x0e38('0xa')](function(_0x140a4e){logger[_0x0e38('0xb')](_0x0e38('0xc'),_0x56c27e,'request\x20sent');logger[_0x0e38('0xd')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x56c27e,_0x0e38('0xe'),JSON[_0x0e38('0xf')](_0x140a4e));if(_0x140a4e['error']){if(_0x140a4e[_0x0e38('0x10')][_0x0e38('0x11')]===0x1f4){logger[_0x0e38('0x10')](_0x0e38('0xc'),_0x56c27e,_0x140a4e[_0x0e38('0x10')][_0x0e38('0x12')]);return _0x15e3af(_0x140a4e[_0x0e38('0x10')]['message']);}logger[_0x0e38('0x10')](_0x0e38('0xc'),_0x56c27e,_0x140a4e[_0x0e38('0x10')][_0x0e38('0x12')]);return _0x4630e2(_0x140a4e['error']['message']);}else{logger[_0x0e38('0xb')](_0x0e38('0xc'),_0x56c27e,_0x0e38('0xe'));_0x4630e2(_0x140a4e[_0x0e38('0x13')][_0x0e38('0x12')]);}})[_0x0e38('0x14')](function(_0x378de6){logger[_0x0e38('0x10')](_0x0e38('0xc'),_0x56c27e,_0x378de6);_0x15e3af(_0x378de6);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index b7ffc27..acdf83b 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 _0x43b7=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','isAuthenticated','getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration','/:id','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x4e1d2d,_0x5a44e1){var _0x520f96=function(_0x432d2d){while(--_0x432d2d){_0x4e1d2d['push'](_0x4e1d2d['shift']());}};_0x520f96(++_0x5a44e1);}(_0x43b7,0x1df));var _0x743b=function(_0x13bbd5,_0x268be6){_0x13bbd5=_0x13bbd5-0x0;var _0x4c5dbb=_0x43b7[_0x13bbd5];return _0x4c5dbb;};'use strict';var multer=require(_0x743b('0x0'));var util=require(_0x743b('0x1'));var path=require(_0x743b('0x2'));var timeout=require(_0x743b('0x3'));var express=require(_0x743b('0x4'));var router=express['Router']();var fs_extra=require(_0x743b('0x5'));var auth=require(_0x743b('0x6'));var interaction=require(_0x743b('0x7'));var config=require(_0x743b('0x8'));var controller=require('./intZendeskAccount.controller');router[_0x743b('0x9')]('/',auth['isAuthenticated'](),controller[_0x743b('0xa')]);router[_0x743b('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x743b('0xb')]);router[_0x743b('0x9')]('/:id/configurations',auth[_0x743b('0xc')](),controller[_0x743b('0xd')]);router[_0x743b('0x9')](_0x743b('0xe'),auth[_0x743b('0xc')](),controller[_0x743b('0xf')]);router[_0x743b('0x10')]('/',auth[_0x743b('0xc')](),controller['create']);router[_0x743b('0x10')](_0x743b('0x11'),auth[_0x743b('0xc')](),controller[_0x743b('0x12')]);router['put'](_0x743b('0x13'),auth[_0x743b('0xc')](),controller[_0x743b('0x14')]);router[_0x743b('0x15')]('/:id',auth[_0x743b('0xc')](),controller[_0x743b('0x16')]);module['exports']=router; \ No newline at end of file +var _0x0ef2=['update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','/:id/configurations','/:id/fields','getFields','create','post','put'];(function(_0xaba410,_0x11680e){var _0x10cd03=function(_0x3f57e2){while(--_0x3f57e2){_0xaba410['push'](_0xaba410['shift']());}};_0x10cd03(++_0x11680e);}(_0x0ef2,0x114));var _0x20ef=function(_0xd299c3,_0x4ba0f1){_0xd299c3=_0xd299c3-0x0;var _0x376574=_0x0ef2[_0xd299c3];return _0x376574;};'use strict';var multer=require(_0x20ef('0x0'));var util=require(_0x20ef('0x1'));var path=require('path');var timeout=require(_0x20ef('0x2'));var express=require(_0x20ef('0x3'));var router=express[_0x20ef('0x4')]();var fs_extra=require(_0x20ef('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x20ef('0x6'));var config=require(_0x20ef('0x7'));var controller=require('./intZendeskAccount.controller');router[_0x20ef('0x8')]('/',auth['isAuthenticated'](),controller[_0x20ef('0x9')]);router[_0x20ef('0x8')](_0x20ef('0xa'),auth[_0x20ef('0xb')](),controller['show']);router[_0x20ef('0x8')](_0x20ef('0xc'),auth[_0x20ef('0xb')](),controller['getConfigurations']);router['get'](_0x20ef('0xd'),auth[_0x20ef('0xb')](),controller[_0x20ef('0xe')]);router['post']('/',auth[_0x20ef('0xb')](),controller[_0x20ef('0xf')]);router[_0x20ef('0x10')](_0x20ef('0xc'),auth[_0x20ef('0xb')](),controller['addConfiguration']);router[_0x20ef('0x11')](_0x20ef('0xa'),auth[_0x20ef('0xb')](),controller[_0x20ef('0x12')]);router[_0x20ef('0x13')](_0x20ef('0xa'),auth[_0x20ef('0xb')](),controller['destroy']);module[_0x20ef('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 4047520..041dc77 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 _0x583c=['exports','STRING','username','remoteUri','ENUM','token','password','newTab','integrationTab','sequelize'];(function(_0x3f2e4c,_0x4011e2){var _0x17c85f=function(_0x32b788){while(--_0x32b788){_0x3f2e4c['push'](_0x3f2e4c['shift']());}};_0x17c85f(++_0x4011e2);}(_0x583c,0x12b));var _0xc583=function(_0x189c9e,_0x1c3b55){_0x189c9e=_0x189c9e-0x0;var _0x3f38ca=_0x583c[_0x189c9e];return _0x3f38ca;};'use strict';var Sequelize=require(_0xc583('0x0'));module[_0xc583('0x1')]={'name':{'type':Sequelize[_0xc583('0x2')]},'description':{'type':Sequelize[_0xc583('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xc583('0x3')},'password':{'type':Sequelize[_0xc583('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xc583('0x4')},'authType':{'type':Sequelize[_0xc583('0x5')]('password',_0xc583('0x6')),'defaultValue':_0xc583('0x7')},'serverUrl':{'type':Sequelize[_0xc583('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc583('0x5')]('integrationTab',_0xc583('0x8')),'defaultValue':_0xc583('0x9')}}; \ No newline at end of file +var _0x4351=['remoteUri','ENUM','password','token','integrationTab','sequelize','exports','STRING','username'];(function(_0x295455,_0x7c9df4){var _0x26f359=function(_0x177aa9){while(--_0x177aa9){_0x295455['push'](_0x295455['shift']());}};_0x26f359(++_0x7c9df4);}(_0x4351,0x1b5));var _0x1435=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x4351[_0x42245d];return _0x4b211a;};'use strict';var Sequelize=require(_0x1435('0x0'));module[_0x1435('0x1')]={'name':{'type':Sequelize[_0x1435('0x2')]},'description':{'type':Sequelize[_0x1435('0x2')]},'username':{'type':Sequelize[_0x1435('0x2')],'unique':_0x1435('0x3')},'password':{'type':Sequelize[_0x1435('0x2')]},'token':{'type':Sequelize[_0x1435('0x2')]},'remoteUri':{'type':Sequelize[_0x1435('0x2')],'unique':_0x1435('0x4')},'authType':{'type':Sequelize[_0x1435('0x5')](_0x1435('0x6'),_0x1435('0x7')),'defaultValue':_0x1435('0x6')},'serverUrl':{'type':Sequelize[_0x1435('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x1435('0x8'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 49ddb43..a53e92f 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 _0xdb94=['query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','find','create','body','params','destroy','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','getFields','password','authType','remoteUri','slice','substring','%s/%s','ticket_fields','format','%s:%s','username','toString','base64','token','Basic\x20%s','Sequelize','includes','position','title','system_field_options','custom_field_options','test','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','end','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','key','model'];(function(_0x44784c,_0x4498c1){var _0x4bbfb1=function(_0x5d5ef7){while(--_0x5d5ef7){_0x44784c['push'](_0x44784c['shift']());}};_0x4bbfb1(++_0x4498c1);}(_0xdb94,0xab));var _0x4db9=function(_0x3e82bc,_0x2652f2){_0x3e82bc=_0x3e82bc-0x0;var _0x53d8d0=_0xdb94[_0x3e82bc];return _0x53d8d0;};'use strict';var emlformat=require(_0x4db9('0x0'));var rimraf=require(_0x4db9('0x1'));var zipdir=require(_0x4db9('0x2'));var jsonpatch=require(_0x4db9('0x3'));var rp=require(_0x4db9('0x4'));var moment=require('moment');var BPromise=require(_0x4db9('0x5'));var Mustache=require(_0x4db9('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4db9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4db9('0x8'));var _=require('lodash');var squel=require(_0x4db9('0x9'));var crypto=require('crypto');var jsforce=require(_0x4db9('0xa'));var deskjs=require(_0x4db9('0xb'));var toCsv=require(_0x4db9('0xc'));var querystring=require(_0x4db9('0xd'));var Papa=require(_0x4db9('0xe'));var Redis=require(_0x4db9('0xf'));var authService=require(_0x4db9('0x10'));var qs=require(_0x4db9('0x11'));var as=require(_0x4db9('0x12'));var hardwareService=require(_0x4db9('0x13'));var logger=require(_0x4db9('0x14'))('api');var utils=require(_0x4db9('0x15'));var config=require(_0x4db9('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x4db9('0x17'));function respondWithStatusCode(_0x5e644c,_0x571685){_0x571685=_0x571685||0xcc;return function(_0x34fc7d){if(_0x34fc7d){return _0x5e644c[_0x4db9('0x18')](_0x571685);}return _0x5e644c['status'](_0x571685)[_0x4db9('0x19')]();};}function respondWithResult(_0x1f9638,_0x452896){_0x452896=_0x452896||0xc8;return function(_0x22667c){if(_0x22667c){return _0x1f9638['status'](_0x452896)['json'](_0x22667c);}};}function respondWithFilteredResult(_0x102274,_0x34de1a){return function(_0x4a037f){if(_0x4a037f){var _0xadc104=typeof _0x34de1a[_0x4db9('0x1a')]==='undefined'&&typeof _0x34de1a['limit']===_0x4db9('0x1b');var _0x143b88=_0x4a037f[_0x4db9('0x1c')];var _0xa693c4=_0xadc104?0x0:_0x34de1a[_0x4db9('0x1a')];var _0x55494a=_0xadc104?_0x4a037f[_0x4db9('0x1c')]:_0x34de1a[_0x4db9('0x1a')]+_0x34de1a[_0x4db9('0x1d')];var _0x5e3b36;if(_0x55494a>=_0x143b88){_0x55494a=_0x143b88;_0x5e3b36=0xc8;}else{_0x5e3b36=0xce;}_0x102274[_0x4db9('0x1e')](_0x5e3b36);return _0x102274[_0x4db9('0x1f')](_0x4db9('0x20'),_0xa693c4+'-'+_0x55494a+'/'+_0x143b88)['json'](_0x4a037f);}return null;};}function patchUpdates(_0x46b522){return function(_0x2e8f95){try{jsonpatch[_0x4db9('0x21')](_0x2e8f95,_0x46b522,!![]);}catch(_0x46fc3d){return BPromise[_0x4db9('0x22')](_0x46fc3d);}return _0x2e8f95[_0x4db9('0x23')]();};}function saveUpdates(_0x3585d5,_0x5aef3b){return function(_0x4ceb0c){if(_0x4ceb0c){return _0x4ceb0c[_0x4db9('0x24')](_0x3585d5)[_0x4db9('0x25')](function(_0x319475){return _0x319475;});}return null;};}function removeEntity(_0x4aaa84,_0x213daa){return function(_0xdac966){if(_0xdac966){return _0xdac966['destroy']()[_0x4db9('0x25')](function(){_0x4aaa84[_0x4db9('0x1e')](0xcc)[_0x4db9('0x19')]();});}};}function handleEntityNotFound(_0x4dbb1b,_0x3c8237){return function(_0xd250c5){if(!_0xd250c5){_0x4dbb1b[_0x4db9('0x18')](0x194);}return _0xd250c5;};}function handleError(_0x2d330e,_0x3f9f7e){_0x3f9f7e=_0x3f9f7e||0x1f4;return function(_0x385e22){logger[_0x4db9('0x26')](_0x385e22[_0x4db9('0x27')]);if(_0x385e22[_0x4db9('0x28')]){delete _0x385e22[_0x4db9('0x28')];}_0x2d330e[_0x4db9('0x1e')](_0x3f9f7e)[_0x4db9('0x29')](_0x385e22);};}exports[_0x4db9('0x2a')]=function(_0x20f133,_0x583861){var _0x5031fe={},_0x3951b2={},_0x331279={'count':0x0,'rows':[]};var _0x119371=_[_0x4db9('0x2b')](db[_0x4db9('0x2c')][_0x4db9('0x2d')],function(_0x4dc946){return{'name':_0x4dc946[_0x4db9('0x2e')],'type':_0x4dc946['type'][_0x4db9('0x2f')]};});_0x3951b2[_0x4db9('0x30')]=_[_0x4db9('0x2b')](_0x119371,_0x4db9('0x28'));_0x3951b2[_0x4db9('0x31')]=_['keys'](_0x20f133['query']);_0x3951b2[_0x4db9('0x32')]=_['intersection'](_0x3951b2[_0x4db9('0x30')],_0x3951b2[_0x4db9('0x31')]);_0x5031fe['attributes']=_[_0x4db9('0x33')](_0x3951b2[_0x4db9('0x30')],qs[_0x4db9('0x34')](_0x20f133['query'][_0x4db9('0x34')]));_0x5031fe['attributes']=_0x5031fe[_0x4db9('0x35')][_0x4db9('0x36')]?_0x5031fe[_0x4db9('0x35')]:_0x3951b2['model'];if(!_0x20f133['query'][_0x4db9('0x37')](_0x4db9('0x38'))){_0x5031fe[_0x4db9('0x1d')]=qs[_0x4db9('0x1d')](_0x20f133[_0x4db9('0x31')][_0x4db9('0x1d')]);_0x5031fe[_0x4db9('0x1a')]=qs[_0x4db9('0x1a')](_0x20f133[_0x4db9('0x31')]['offset']);}_0x5031fe[_0x4db9('0x39')]=qs[_0x4db9('0x3a')](_0x20f133[_0x4db9('0x31')][_0x4db9('0x3a')]);_0x5031fe['where']=qs[_0x4db9('0x32')](_[_0x4db9('0x3b')](_0x20f133[_0x4db9('0x31')],_0x3951b2['filters']),_0x119371);if(_0x20f133[_0x4db9('0x31')][_0x4db9('0x3c')]){_0x5031fe[_0x4db9('0x3d')]=_[_0x4db9('0x3e')](_0x5031fe['where'],{'$or':_['map'](_0x119371,function(_0x41da52){if(_0x41da52[_0x4db9('0x3f')]!==_0x4db9('0x40')){var _0x8bc540={};_0x8bc540[_0x41da52[_0x4db9('0x28')]]={'$like':'%'+_0x20f133['query'][_0x4db9('0x3c')]+'%'};return _0x8bc540;}})});}_0x5031fe=_[_0x4db9('0x3e')]({},_0x5031fe,_0x20f133[_0x4db9('0x41')]);var _0x367c4c={'where':_0x5031fe[_0x4db9('0x3d')]};return db['ZendeskAccount'][_0x4db9('0x1c')](_0x367c4c)[_0x4db9('0x25')](function(_0x38a727){_0x331279['count']=_0x38a727;if(_0x20f133[_0x4db9('0x31')][_0x4db9('0x42')]){_0x5031fe[_0x4db9('0x43')]=[{'all':!![]}];}return db[_0x4db9('0x2c')][_0x4db9('0x44')](_0x5031fe);})[_0x4db9('0x25')](function(_0x412aab){_0x331279[_0x4db9('0x45')]=_0x412aab;return _0x331279;})[_0x4db9('0x25')](respondWithFilteredResult(_0x583861,_0x5031fe))[_0x4db9('0x46')](handleError(_0x583861,null));};exports['show']=function(_0x56bd68,_0x48aaf5){var _0x22a021={'raw':![],'where':{'id':_0x56bd68['params']['id']}},_0x28a3ef={};_0x28a3ef[_0x4db9('0x30')]=_[_0x4db9('0x47')](db['ZendeskAccount']['rawAttributes']);_0x28a3ef[_0x4db9('0x31')]=_['keys'](_0x56bd68[_0x4db9('0x31')]);_0x28a3ef[_0x4db9('0x32')]=_['intersection'](_0x28a3ef[_0x4db9('0x30')],_0x28a3ef[_0x4db9('0x31')]);_0x22a021['attributes']=_[_0x4db9('0x33')](_0x28a3ef[_0x4db9('0x30')],qs[_0x4db9('0x34')](_0x56bd68['query']['fields']));_0x22a021[_0x4db9('0x35')]=_0x22a021[_0x4db9('0x35')][_0x4db9('0x36')]?_0x22a021[_0x4db9('0x35')]:_0x28a3ef[_0x4db9('0x30')];if(_0x56bd68[_0x4db9('0x31')][_0x4db9('0x42')]){_0x22a021[_0x4db9('0x43')]=[{'all':!![]}];}_0x22a021=_[_0x4db9('0x3e')]({},_0x22a021,_0x56bd68[_0x4db9('0x41')]);return db[_0x4db9('0x2c')][_0x4db9('0x48')](_0x22a021)[_0x4db9('0x25')](handleEntityNotFound(_0x48aaf5,null))['then'](respondWithResult(_0x48aaf5,null))[_0x4db9('0x46')](handleError(_0x48aaf5,null));};exports[_0x4db9('0x49')]=function(_0x3852f0,_0xba27c0){return db[_0x4db9('0x2c')][_0x4db9('0x49')](_0x3852f0[_0x4db9('0x4a')],{})[_0x4db9('0x25')](respondWithResult(_0xba27c0,0xc9))[_0x4db9('0x46')](handleError(_0xba27c0,null));};exports[_0x4db9('0x24')]=function(_0x10dccb,_0x49ea0c){if(_0x10dccb['body']['id']){delete _0x10dccb[_0x4db9('0x4a')]['id'];}return db[_0x4db9('0x2c')][_0x4db9('0x48')]({'where':{'id':_0x10dccb[_0x4db9('0x4b')]['id']}})[_0x4db9('0x25')](handleEntityNotFound(_0x49ea0c,null))[_0x4db9('0x25')](saveUpdates(_0x10dccb[_0x4db9('0x4a')],null))[_0x4db9('0x25')](respondWithResult(_0x49ea0c,null))['catch'](handleError(_0x49ea0c,null));};exports[_0x4db9('0x4c')]=function(_0xcb832e,_0x121225){return db[_0x4db9('0x2c')][_0x4db9('0x48')]({'where':{'id':_0xcb832e[_0x4db9('0x4b')]['id']}})[_0x4db9('0x25')](handleEntityNotFound(_0x121225,null))[_0x4db9('0x25')](removeEntity(_0x121225,null))['catch'](handleError(_0x121225,null));};exports[_0x4db9('0x4d')]=function(_0xd6701a,_0x216696,_0x3a1f0e){var _0x15486f={};var _0x2d7fa2={};var _0x4e88c2;var _0x188663;return db['ZendeskAccount'][_0x4db9('0x4e')]({'where':{'id':_0xd6701a['params']['id']}})['then'](handleEntityNotFound(_0x216696,null))[_0x4db9('0x25')](function(_0x5996f2){if(_0x5996f2){_0x4e88c2=_0x5996f2;_0x2d7fa2[_0x4db9('0x30')]=_[_0x4db9('0x47')](db[_0x4db9('0x4f')][_0x4db9('0x2d')]);_0x2d7fa2['query']=_[_0x4db9('0x47')](_0xd6701a['query']);_0x2d7fa2[_0x4db9('0x32')]=_[_0x4db9('0x33')](_0x2d7fa2['model'],_0x2d7fa2[_0x4db9('0x31')]);_0x15486f['attributes']=_[_0x4db9('0x33')](_0x2d7fa2[_0x4db9('0x30')],qs[_0x4db9('0x34')](_0xd6701a[_0x4db9('0x31')][_0x4db9('0x34')]));_0x15486f[_0x4db9('0x35')]=_0x15486f[_0x4db9('0x35')][_0x4db9('0x36')]?_0x15486f[_0x4db9('0x35')]:_0x2d7fa2[_0x4db9('0x30')];_0x15486f[_0x4db9('0x39')]=qs[_0x4db9('0x3a')](_0xd6701a[_0x4db9('0x31')][_0x4db9('0x3a')]);_0x15486f[_0x4db9('0x3d')]=qs['filters'](_[_0x4db9('0x3b')](_0xd6701a[_0x4db9('0x31')],_0x2d7fa2['filters']));if(_0xd6701a[_0x4db9('0x31')][_0x4db9('0x3c')]){_0x15486f[_0x4db9('0x3d')]=_[_0x4db9('0x3e')](_0x15486f[_0x4db9('0x3d')],{'$or':_[_0x4db9('0x2b')](_0x15486f[_0x4db9('0x35')],function(_0x355083){var _0x215538={};_0x215538[_0x355083]={'$like':'%'+_0xd6701a['query']['filter']+'%'};return _0x215538;})});}_0x15486f=_[_0x4db9('0x3e')]({},_0x15486f,_0xd6701a[_0x4db9('0x41')]);return _0x4e88c2[_0x4db9('0x4d')](_0x15486f);}})[_0x4db9('0x25')](function(_0x35e822){if(_0x35e822){_0x188663=_0x35e822[_0x4db9('0x36')];if(!_0xd6701a[_0x4db9('0x31')][_0x4db9('0x37')](_0x4db9('0x38'))){_0x15486f[_0x4db9('0x1d')]=qs['limit'](_0xd6701a[_0x4db9('0x31')]['limit']);_0x15486f['offset']=qs['offset'](_0xd6701a['query'][_0x4db9('0x1a')]);}return _0x4e88c2['getConfigurations'](_0x15486f);}})['then'](function(_0x7aea3a){if(_0x7aea3a){return _0x7aea3a?{'count':_0x188663,'rows':_0x7aea3a}:null;}})[_0x4db9('0x25')](respondWithResult(_0x216696,null))[_0x4db9('0x46')](handleError(_0x216696,null));};exports[_0x4db9('0x50')]=function(_0x2d91d9,_0x3e833d,_0xaea8ff){if(_0x2d91d9[_0x4db9('0x4a')]['id']){delete _0x2d91d9[_0x4db9('0x4a')]['id'];}return db[_0x4db9('0x2c')][_0x4db9('0x4e')]({'where':{'id':_0x2d91d9[_0x4db9('0x4b')]['id']}})[_0x4db9('0x25')](handleEntityNotFound(_0x3e833d,null))[_0x4db9('0x25')](function(_0xd84c6c){if(_0xd84c6c){_0x2d91d9[_0x4db9('0x4a')]['AccountId']=_0xd84c6c['id'];_0x2d91d9['body']['Subjects']=integrations[_0x4db9('0x51')](_0x2d91d9['body'][_0x4db9('0x52')],_0x2d91d9[_0x4db9('0x4a')][_0x4db9('0x3f')]);_0x2d91d9['body']['Descriptions']=integrations[_0x4db9('0x53')](_0x2d91d9['body'][_0x4db9('0x52')],_0x2d91d9[_0x4db9('0x4a')][_0x4db9('0x3f')]);return db[_0x4db9('0x4f')][_0x4db9('0x49')](_0x2d91d9['body'],{'include':[{'model':db[_0x4db9('0x54')],'as':'Subjects'},{'model':db[_0x4db9('0x54')],'as':_0x4db9('0x55')}]});}return null;})[_0x4db9('0x25')](respondWithResult(_0x3e833d,null))[_0x4db9('0x46')](handleError(_0x3e833d,null));};exports[_0x4db9('0x56')]=function(_0x543d35,_0x524d82,_0x3901b5){var _0xd8a34='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x543d35[_0x4db9('0x4b')]['id']},'attributes':['id','username',_0x4db9('0x57'),'token',_0x4db9('0x58'),_0x4db9('0x59')]})['then'](handleEntityNotFound(_0x524d82,null))['then'](function(_0x3de95c){if(_0x3de95c){_0xd8a34=_0x3de95c[_0x4db9('0x59')];var _0x294111=_0xd8a34[_0x4db9('0x5a')](-0x1);if(_0x294111==='/'){_0xd8a34=_0xd8a34[_0x4db9('0x5b')](0x0,_0xd8a34['lastIndexOf'](_0x294111));}var _0x593497={'method':'GET','uri':util['format'](_0x4db9('0x5c'),_0xd8a34,_0x4db9('0x5d')),'json':!![]};switch(_0x3de95c[_0x4db9('0x58')]){case _0x4db9('0x57'):_0x593497['headers']={'Authorization':util[_0x4db9('0x5e')]('Basic\x20%s',new Buffer(util[_0x4db9('0x5e')](_0x4db9('0x5f'),_0x3de95c[_0x4db9('0x60')],_0x3de95c[_0x4db9('0x57')]))[_0x4db9('0x61')](_0x4db9('0x62')))};break;case _0x4db9('0x63'):_0x593497['headers']={'Authorization':util[_0x4db9('0x5e')](_0x4db9('0x64'),new Buffer(util[_0x4db9('0x5e')]('%s/token:%s',_0x3de95c[_0x4db9('0x60')],_0x3de95c[_0x4db9('0x63')]))['toString']('base64'))};break;default:throw new db[(_0x4db9('0x65'))]['ValidationError']('Unknown\x20authentication\x20type');}return rp(_0x593497);}})[_0x4db9('0x25')](function(_0x30ba05){if(_0x30ba05){var _0x190e38=['subject','description','group','assignee'];_['remove'](_0x30ba05[_0x4db9('0x5d')],function(_0x3f4cb6){return _0x190e38[_0x4db9('0x66')](_0x3f4cb6[_0x4db9('0x3f')]);});return{'count':_0x30ba05[_0x4db9('0x5d')][_0x4db9('0x36')],'rows':_[_0x4db9('0x2b')](_0x30ba05[_0x4db9('0x5d')],function(_0x4c5be0){return{'id':_0x4c5be0['id'],'name':_0x4c5be0[_0x4db9('0x67')]>0x7?_0x4c5be0[_0x4db9('0x68')]:_0x4c5be0[_0x4db9('0x3f')],'custom':_0x4c5be0[_0x4db9('0x67')]>0x7?!![]:![],'options':_0x4c5be0[_0x4db9('0x69')]?_0x4c5be0[_0x4db9('0x69')]:_0x4c5be0[_0x4db9('0x6a')]?_0x4c5be0[_0x4db9('0x6a')]:[]};})};}})['then'](respondWithResult(_0x524d82,null))[_0x4db9('0x46')](function(_0x4a7e8b){var _0x17bbcb=_0x543d35[_0x4db9('0x31')][_0x4db9('0x6b')]?0x1f4:_0x4a7e8b[_0x4db9('0x6c')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x4db9('0x56'),_0x17bbcb,JSON['stringify'](_0x4a7e8b));delete _0x4a7e8b[_0x4db9('0x28')];if(_0x17bbcb===0x191){_0x17bbcb=0x190;}_0x524d82[_0x4db9('0x1e')](_0x17bbcb)[_0x4db9('0x29')](_0x543d35[_0x4db9('0x31')][_0x4db9('0x6b')]?{'message':_0x4db9('0x6d'),'statusCode':_0x4a7e8b[_0x4db9('0x6c')]}:_0x4a7e8b);});}; \ No newline at end of file +var _0xd64b=['undefined','count','Content-Range','apply','update','then','stack','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','name','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','rows','catch','show','params','keys','includeAll','include','merge','options','find','create','body','destroy','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','ZendeskField','Descriptions','getFields','username','password','token','remoteUri','substring','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','toString','base64','Sequelize','ValidationError','subject','description','assignee','remove','position','title','system_field_options','custom_field_options','test','statusCode','error','stringify','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit'];(function(_0x36e9e2,_0x119d20){var _0x38dd39=function(_0x209875){while(--_0x209875){_0x36e9e2['push'](_0x36e9e2['shift']());}};_0x38dd39(++_0x119d20);}(_0xd64b,0xc1));var _0xbd64=function(_0x14ec54,_0x2d5098){_0x14ec54=_0x14ec54-0x0;var _0x2f8c0e=_0xd64b[_0x14ec54];return _0x2f8c0e;};'use strict';var emlformat=require(_0xbd64('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbd64('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbd64('0x2'));var moment=require(_0xbd64('0x3'));var BPromise=require(_0xbd64('0x4'));var Mustache=require(_0xbd64('0x5'));var util=require(_0xbd64('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbd64('0x7'));var _=require(_0xbd64('0x8'));var squel=require(_0xbd64('0x9'));var crypto=require(_0xbd64('0xa'));var jsforce=require(_0xbd64('0xb'));var deskjs=require(_0xbd64('0xc'));var toCsv=require(_0xbd64('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbd64('0xe'));var authService=require(_0xbd64('0xf'));var qs=require(_0xbd64('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd64('0x11'));var logger=require(_0xbd64('0x12'))(_0xbd64('0x13'));var utils=require(_0xbd64('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xbd64('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0xbd64('0x16'));function respondWithStatusCode(_0x2729d8,_0x3a941c){_0x3a941c=_0x3a941c||0xcc;return function(_0x2183e2){if(_0x2183e2){return _0x2729d8[_0xbd64('0x17')](_0x3a941c);}return _0x2729d8[_0xbd64('0x18')](_0x3a941c)[_0xbd64('0x19')]();};}function respondWithResult(_0x269e2f,_0x2b5808){_0x2b5808=_0x2b5808||0xc8;return function(_0x4ae471){if(_0x4ae471){return _0x269e2f[_0xbd64('0x18')](_0x2b5808)[_0xbd64('0x1a')](_0x4ae471);}};}function respondWithFilteredResult(_0x3ff550,_0x32fd34){return function(_0x29fc16){if(_0x29fc16){var _0x49a914=typeof _0x32fd34[_0xbd64('0x1b')]==='undefined'&&typeof _0x32fd34[_0xbd64('0x1c')]===_0xbd64('0x1d');var _0x3aef70=_0x29fc16[_0xbd64('0x1e')];var _0x17d015=_0x49a914?0x0:_0x32fd34[_0xbd64('0x1b')];var _0xa5491d=_0x49a914?_0x29fc16[_0xbd64('0x1e')]:_0x32fd34['offset']+_0x32fd34[_0xbd64('0x1c')];var _0x1f618b;if(_0xa5491d>=_0x3aef70){_0xa5491d=_0x3aef70;_0x1f618b=0xc8;}else{_0x1f618b=0xce;}_0x3ff550['status'](_0x1f618b);return _0x3ff550['set'](_0xbd64('0x1f'),_0x17d015+'-'+_0xa5491d+'/'+_0x3aef70)[_0xbd64('0x1a')](_0x29fc16);}return null;};}function patchUpdates(_0x196d21){return function(_0x39e2eb){try{jsonpatch[_0xbd64('0x20')](_0x39e2eb,_0x196d21,!![]);}catch(_0x816e00){return BPromise['reject'](_0x816e00);}return _0x39e2eb['save']();};}function saveUpdates(_0x6038f,_0x41f2f){return function(_0x12f67b){if(_0x12f67b){return _0x12f67b[_0xbd64('0x21')](_0x6038f)['then'](function(_0x51d118){return _0x51d118;});}return null;};}function removeEntity(_0x28497c,_0x4afaff){return function(_0x46ab38){if(_0x46ab38){return _0x46ab38['destroy']()[_0xbd64('0x22')](function(){_0x28497c[_0xbd64('0x18')](0xcc)[_0xbd64('0x19')]();});}};}function handleEntityNotFound(_0x2d0993,_0x5ae417){return function(_0x9d0fb8){if(!_0x9d0fb8){_0x2d0993[_0xbd64('0x17')](0x194);}return _0x9d0fb8;};}function handleError(_0x13f527,_0x2a44d0){_0x2a44d0=_0x2a44d0||0x1f4;return function(_0x4d1563){logger['error'](_0x4d1563[_0xbd64('0x23')]);if(_0x4d1563['name']){delete _0x4d1563['name'];}_0x13f527[_0xbd64('0x18')](_0x2a44d0)['send'](_0x4d1563);};}exports[_0xbd64('0x24')]=function(_0x5300e8,_0x28199c){var _0x5d8c35={},_0x1db9f3={},_0x3c0eaf={'count':0x0,'rows':[]};var _0x3be63a=_[_0xbd64('0x25')](db[_0xbd64('0x26')][_0xbd64('0x27')],function(_0x4ed44a){return{'name':_0x4ed44a[_0xbd64('0x28')],'type':_0x4ed44a[_0xbd64('0x29')][_0xbd64('0x2a')]};});_0x1db9f3[_0xbd64('0x2b')]=_[_0xbd64('0x25')](_0x3be63a,_0xbd64('0x2c'));_0x1db9f3['query']=_['keys'](_0x5300e8[_0xbd64('0x2d')]);_0x1db9f3['filters']=_[_0xbd64('0x2e')](_0x1db9f3[_0xbd64('0x2b')],_0x1db9f3['query']);_0x5d8c35['attributes']=_[_0xbd64('0x2e')](_0x1db9f3['model'],qs['fields'](_0x5300e8[_0xbd64('0x2d')][_0xbd64('0x2f')]));_0x5d8c35[_0xbd64('0x30')]=_0x5d8c35['attributes'][_0xbd64('0x31')]?_0x5d8c35['attributes']:_0x1db9f3[_0xbd64('0x2b')];if(!_0x5300e8[_0xbd64('0x2d')][_0xbd64('0x32')](_0xbd64('0x33'))){_0x5d8c35[_0xbd64('0x1c')]=qs[_0xbd64('0x1c')](_0x5300e8['query']['limit']);_0x5d8c35[_0xbd64('0x1b')]=qs[_0xbd64('0x1b')](_0x5300e8[_0xbd64('0x2d')][_0xbd64('0x1b')]);}_0x5d8c35[_0xbd64('0x34')]=qs[_0xbd64('0x35')](_0x5300e8['query']['sort']);_0x5d8c35[_0xbd64('0x36')]=qs[_0xbd64('0x37')](_[_0xbd64('0x38')](_0x5300e8['query'],_0x1db9f3['filters']),_0x3be63a);if(_0x5300e8[_0xbd64('0x2d')]['filter']){_0x5d8c35[_0xbd64('0x36')]=_['merge'](_0x5d8c35[_0xbd64('0x36')],{'$or':_[_0xbd64('0x25')](_0x3be63a,function(_0x550221){if(_0x550221[_0xbd64('0x29')]!=='VIRTUAL'){var _0x534091={};_0x534091[_0x550221[_0xbd64('0x2c')]]={'$like':'%'+_0x5300e8[_0xbd64('0x2d')][_0xbd64('0x39')]+'%'};return _0x534091;}})});}_0x5d8c35=_['merge']({},_0x5d8c35,_0x5300e8['options']);var _0x5d6bcf={'where':_0x5d8c35[_0xbd64('0x36')]};return db[_0xbd64('0x26')]['count'](_0x5d6bcf)[_0xbd64('0x22')](function(_0x34b19a){_0x3c0eaf[_0xbd64('0x1e')]=_0x34b19a;if(_0x5300e8[_0xbd64('0x2d')]['includeAll']){_0x5d8c35['include']=[{'all':!![]}];}return db[_0xbd64('0x26')]['findAll'](_0x5d8c35);})['then'](function(_0x231fa6){_0x3c0eaf[_0xbd64('0x3a')]=_0x231fa6;return _0x3c0eaf;})[_0xbd64('0x22')](respondWithFilteredResult(_0x28199c,_0x5d8c35))[_0xbd64('0x3b')](handleError(_0x28199c,null));};exports[_0xbd64('0x3c')]=function(_0x3155b3,_0x247775){var _0x762380={'raw':![],'where':{'id':_0x3155b3[_0xbd64('0x3d')]['id']}},_0x4870fd={};_0x4870fd[_0xbd64('0x2b')]=_['keys'](db[_0xbd64('0x26')][_0xbd64('0x27')]);_0x4870fd[_0xbd64('0x2d')]=_[_0xbd64('0x3e')](_0x3155b3[_0xbd64('0x2d')]);_0x4870fd[_0xbd64('0x37')]=_[_0xbd64('0x2e')](_0x4870fd['model'],_0x4870fd[_0xbd64('0x2d')]);_0x762380['attributes']=_[_0xbd64('0x2e')](_0x4870fd['model'],qs[_0xbd64('0x2f')](_0x3155b3[_0xbd64('0x2d')][_0xbd64('0x2f')]));_0x762380['attributes']=_0x762380[_0xbd64('0x30')]['length']?_0x762380['attributes']:_0x4870fd['model'];if(_0x3155b3[_0xbd64('0x2d')][_0xbd64('0x3f')]){_0x762380[_0xbd64('0x40')]=[{'all':!![]}];}_0x762380=_[_0xbd64('0x41')]({},_0x762380,_0x3155b3[_0xbd64('0x42')]);return db[_0xbd64('0x26')][_0xbd64('0x43')](_0x762380)['then'](handleEntityNotFound(_0x247775,null))[_0xbd64('0x22')](respondWithResult(_0x247775,null))[_0xbd64('0x3b')](handleError(_0x247775,null));};exports[_0xbd64('0x44')]=function(_0x4e5efe,_0x105bee){return db[_0xbd64('0x26')][_0xbd64('0x44')](_0x4e5efe[_0xbd64('0x45')],{})[_0xbd64('0x22')](respondWithResult(_0x105bee,0xc9))['catch'](handleError(_0x105bee,null));};exports[_0xbd64('0x21')]=function(_0x1a9ec8,_0x2a8011){if(_0x1a9ec8[_0xbd64('0x45')]['id']){delete _0x1a9ec8['body']['id'];}return db['ZendeskAccount'][_0xbd64('0x43')]({'where':{'id':_0x1a9ec8[_0xbd64('0x3d')]['id']}})[_0xbd64('0x22')](handleEntityNotFound(_0x2a8011,null))[_0xbd64('0x22')](saveUpdates(_0x1a9ec8[_0xbd64('0x45')],null))[_0xbd64('0x22')](respondWithResult(_0x2a8011,null))[_0xbd64('0x3b')](handleError(_0x2a8011,null));};exports[_0xbd64('0x46')]=function(_0x460158,_0x2709b2){return db[_0xbd64('0x26')][_0xbd64('0x43')]({'where':{'id':_0x460158[_0xbd64('0x3d')]['id']}})[_0xbd64('0x22')](handleEntityNotFound(_0x2709b2,null))[_0xbd64('0x22')](removeEntity(_0x2709b2,null))['catch'](handleError(_0x2709b2,null));};exports[_0xbd64('0x47')]=function(_0x4952db,_0x5ede67,_0x552c95){var _0x4aa662={};var _0xced0ca={};var _0x2f56df;var _0x5480f5;return db[_0xbd64('0x26')][_0xbd64('0x48')]({'where':{'id':_0x4952db[_0xbd64('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5ede67,null))[_0xbd64('0x22')](function(_0x371bad){if(_0x371bad){_0x2f56df=_0x371bad;_0xced0ca[_0xbd64('0x2b')]=_[_0xbd64('0x3e')](db[_0xbd64('0x49')][_0xbd64('0x27')]);_0xced0ca['query']=_['keys'](_0x4952db['query']);_0xced0ca[_0xbd64('0x37')]=_[_0xbd64('0x2e')](_0xced0ca[_0xbd64('0x2b')],_0xced0ca[_0xbd64('0x2d')]);_0x4aa662['attributes']=_[_0xbd64('0x2e')](_0xced0ca[_0xbd64('0x2b')],qs[_0xbd64('0x2f')](_0x4952db[_0xbd64('0x2d')][_0xbd64('0x2f')]));_0x4aa662[_0xbd64('0x30')]=_0x4aa662['attributes'][_0xbd64('0x31')]?_0x4aa662[_0xbd64('0x30')]:_0xced0ca[_0xbd64('0x2b')];_0x4aa662[_0xbd64('0x34')]=qs[_0xbd64('0x35')](_0x4952db[_0xbd64('0x2d')][_0xbd64('0x35')]);_0x4aa662[_0xbd64('0x36')]=qs[_0xbd64('0x37')](_[_0xbd64('0x38')](_0x4952db[_0xbd64('0x2d')],_0xced0ca[_0xbd64('0x37')]));if(_0x4952db['query']['filter']){_0x4aa662[_0xbd64('0x36')]=_[_0xbd64('0x41')](_0x4aa662['where'],{'$or':_['map'](_0x4aa662[_0xbd64('0x30')],function(_0x12bc56){var _0x49051a={};_0x49051a[_0x12bc56]={'$like':'%'+_0x4952db[_0xbd64('0x2d')][_0xbd64('0x39')]+'%'};return _0x49051a;})});}_0x4aa662=_[_0xbd64('0x41')]({},_0x4aa662,_0x4952db[_0xbd64('0x42')]);return _0x2f56df[_0xbd64('0x47')](_0x4aa662);}})[_0xbd64('0x22')](function(_0x2d788){if(_0x2d788){_0x5480f5=_0x2d788[_0xbd64('0x31')];if(!_0x4952db[_0xbd64('0x2d')]['hasOwnProperty'](_0xbd64('0x33'))){_0x4aa662[_0xbd64('0x1c')]=qs[_0xbd64('0x1c')](_0x4952db['query'][_0xbd64('0x1c')]);_0x4aa662[_0xbd64('0x1b')]=qs['offset'](_0x4952db[_0xbd64('0x2d')][_0xbd64('0x1b')]);}return _0x2f56df[_0xbd64('0x47')](_0x4aa662);}})[_0xbd64('0x22')](function(_0x3615bc){if(_0x3615bc){return _0x3615bc?{'count':_0x5480f5,'rows':_0x3615bc}:null;}})[_0xbd64('0x22')](respondWithResult(_0x5ede67,null))['catch'](handleError(_0x5ede67,null));};exports[_0xbd64('0x4a')]=function(_0x1f3bd0,_0xc57eb1,_0x28d899){if(_0x1f3bd0['body']['id']){delete _0x1f3bd0[_0xbd64('0x45')]['id'];}return db[_0xbd64('0x26')]['findOne']({'where':{'id':_0x1f3bd0[_0xbd64('0x3d')]['id']}})['then'](handleEntityNotFound(_0xc57eb1,null))[_0xbd64('0x22')](function(_0x10e269){if(_0x10e269){_0x1f3bd0[_0xbd64('0x45')][_0xbd64('0x4b')]=_0x10e269['id'];_0x1f3bd0['body'][_0xbd64('0x4c')]=integrations[_0xbd64('0x4d')](_0x1f3bd0[_0xbd64('0x45')][_0xbd64('0x4e')],_0x1f3bd0[_0xbd64('0x45')][_0xbd64('0x29')]);_0x1f3bd0['body']['Descriptions']=integrations['getDescriptions'](_0x1f3bd0[_0xbd64('0x45')][_0xbd64('0x4e')],_0x1f3bd0[_0xbd64('0x45')][_0xbd64('0x29')]);return db[_0xbd64('0x49')][_0xbd64('0x44')](_0x1f3bd0['body'],{'include':[{'model':db[_0xbd64('0x4f')],'as':_0xbd64('0x4c')},{'model':db[_0xbd64('0x4f')],'as':_0xbd64('0x50')}]});}return null;})[_0xbd64('0x22')](respondWithResult(_0xc57eb1,null))[_0xbd64('0x3b')](handleError(_0xc57eb1,null));};exports[_0xbd64('0x51')]=function(_0x3d7e47,_0x301f42,_0x18e724){var _0x32e611='';return db[_0xbd64('0x26')]['findOne']({'where':{'id':_0x3d7e47['params']['id']},'attributes':['id',_0xbd64('0x52'),_0xbd64('0x53'),_0xbd64('0x54'),'authType',_0xbd64('0x55')]})['then'](handleEntityNotFound(_0x301f42,null))[_0xbd64('0x22')](function(_0x36ebb5){if(_0x36ebb5){_0x32e611=_0x36ebb5[_0xbd64('0x55')];var _0x819774=_0x32e611['slice'](-0x1);if(_0x819774==='/'){_0x32e611=_0x32e611[_0xbd64('0x56')](0x0,_0x32e611['lastIndexOf'](_0x819774));}var _0x14f79e={'method':_0xbd64('0x57'),'uri':util[_0xbd64('0x58')](_0xbd64('0x59'),_0x32e611,_0xbd64('0x5a')),'json':!![]};switch(_0x36ebb5['authType']){case _0xbd64('0x53'):_0x14f79e[_0xbd64('0x5b')]={'Authorization':util['format'](_0xbd64('0x5c'),new Buffer(util[_0xbd64('0x58')](_0xbd64('0x5d'),_0x36ebb5[_0xbd64('0x52')],_0x36ebb5['password']))[_0xbd64('0x5e')]('base64'))};break;case _0xbd64('0x54'):_0x14f79e[_0xbd64('0x5b')]={'Authorization':util[_0xbd64('0x58')]('Basic\x20%s',new Buffer(util['format']('%s/token:%s',_0x36ebb5['username'],_0x36ebb5[_0xbd64('0x54')]))[_0xbd64('0x5e')](_0xbd64('0x5f')))};break;default:throw new db[(_0xbd64('0x60'))][(_0xbd64('0x61'))]('Unknown\x20authentication\x20type');}return rp(_0x14f79e);}})[_0xbd64('0x22')](function(_0x23de71){if(_0x23de71){var _0xac13e6=[_0xbd64('0x62'),_0xbd64('0x63'),'group',_0xbd64('0x64')];_[_0xbd64('0x65')](_0x23de71[_0xbd64('0x5a')],function(_0x808467){return _0xac13e6['includes'](_0x808467['type']);});return{'count':_0x23de71[_0xbd64('0x5a')][_0xbd64('0x31')],'rows':_[_0xbd64('0x25')](_0x23de71[_0xbd64('0x5a')],function(_0x18b0f0){return{'id':_0x18b0f0['id'],'name':_0x18b0f0[_0xbd64('0x66')]>0x7?_0x18b0f0[_0xbd64('0x67')]:_0x18b0f0[_0xbd64('0x29')],'custom':_0x18b0f0['position']>0x7?!![]:![],'options':_0x18b0f0[_0xbd64('0x68')]?_0x18b0f0['system_field_options']:_0x18b0f0[_0xbd64('0x69')]?_0x18b0f0[_0xbd64('0x69')]:[]};})};}})[_0xbd64('0x22')](respondWithResult(_0x301f42,null))['catch'](function(_0x15b625){var _0x5c30f9=_0x3d7e47['query'][_0xbd64('0x6a')]?0x1f4:_0x15b625[_0xbd64('0x6b')]||0x1f4;logger[_0xbd64('0x6c')]('getFields,\x20%s,\x20%s,\x20%s',_0xbd64('0x51'),_0x5c30f9,JSON[_0xbd64('0x6d')](_0x15b625));delete _0x15b625[_0xbd64('0x2c')];if(_0x5c30f9===0x191){_0x5c30f9=0x190;}_0x301f42[_0xbd64('0x18')](_0x5c30f9)['send'](_0x3d7e47[_0xbd64('0x2d')][_0xbd64('0x6a')]?{'message':_0xbd64('0x6e'),'statusCode':_0x15b625[_0xbd64('0x6b')]}:_0x15b625);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 0e8cf41..512d297 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 _0x1c26=['path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','int_zendesk_accounts','lodash','util','api','moment','bluebird','request-promise'];(function(_0x4084eb,_0x30c6ad){var _0x4c1f1c=function(_0x1ca12e){while(--_0x1ca12e){_0x4084eb['push'](_0x4084eb['shift']());}};_0x4c1f1c(++_0x30c6ad);}(_0x1c26,0xca));var _0x61c2=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1c26[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x61c2('0x0'));var util=require(_0x61c2('0x1'));var logger=require('../../config/logger')(_0x61c2('0x2'));var moment=require(_0x61c2('0x3'));var BPromise=require(_0x61c2('0x4'));var rp=require(_0x61c2('0x5'));var fs=require('fs');var path=require(_0x61c2('0x6'));var rimraf=require('rimraf');var config=require(_0x61c2('0x7'));var attributes=require(_0x61c2('0x8'));var integrations=require(_0x61c2('0x9'));module[_0x61c2('0xa')]=function(_0x2b4f55,_0x429230){return _0x2b4f55[_0x61c2('0xb')]('ZendeskAccount',attributes,{'tableName':_0x61c2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x697f=['../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','./intZendeskAccount.attributes'];(function(_0x411583,_0x46558a){var _0x49be05=function(_0x1bfa28){while(--_0x1bfa28){_0x411583['push'](_0x411583['shift']());}};_0x49be05(++_0x46558a);}(_0x697f,0x13d));var _0xf697=function(_0x1ca415,_0x19759c){_0x1ca415=_0x1ca415-0x0;var _0x3e60ce=_0x697f[_0x1ca415];return _0x3e60ce;};'use strict';var _=require(_0xf697('0x0'));var util=require(_0xf697('0x1'));var logger=require(_0xf697('0x2'))(_0xf697('0x3'));var moment=require(_0xf697('0x4'));var BPromise=require(_0xf697('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(_0xf697('0x6'));var integrations=require(_0xf697('0x7'));module[_0xf697('0x8')]=function(_0x492116,_0x1c86bc){return _0x492116[_0xf697('0x9')](_0xf697('0xa'),attributes,{'tableName':_0xf697('0xb'),'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 08daeb5..4ee2e05 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 _0x64c7=['../../mysqldb','../../config/utils','jayson/promise','client','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','ShowZendeskAccount','find','lodash','util','moment','bluebird','ioredis'];(function(_0x40c19f,_0x125d91){var _0x4f4c7d=function(_0x40efbc){while(--_0x40efbc){_0x40c19f['push'](_0x40c19f['shift']());}};_0x4f4c7d(++_0x125d91);}(_0x64c7,0x1b5));var _0x764c=function(_0x53b8e0,_0x55d46e){_0x53b8e0=_0x53b8e0-0x0;var _0x10630c=_0x64c7[_0x53b8e0];return _0x10630c;};'use strict';var _=require(_0x764c('0x0'));var util=require(_0x764c('0x1'));var moment=require(_0x764c('0x2'));var BPromise=require(_0x764c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x764c('0x4'));var db=require(_0x764c('0x5'))['db'];var utils=require(_0x764c('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x764c('0x7'));var client=jayson[_0x764c('0x8')][_0x764c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e3fc5,_0x18269d,_0x8dd5b1){return new BPromise(function(_0x319cd8,_0x404bcb){return client[_0x764c('0xa')](_0x3e3fc5,_0x8dd5b1)['then'](function(_0xecf754){logger[_0x764c('0xb')](_0x764c('0xc'),_0x18269d,_0x764c('0xd'));logger[_0x764c('0xe')](_0x764c('0xf'),_0x18269d,'request\x20sent',JSON[_0x764c('0x10')](_0xecf754));if(_0xecf754['error']){if(_0xecf754[_0x764c('0x11')]['code']===0x1f4){logger[_0x764c('0x11')](_0x764c('0xc'),_0x18269d,_0xecf754[_0x764c('0x11')][_0x764c('0x12')]);return _0x404bcb(_0xecf754[_0x764c('0x11')]['message']);}logger[_0x764c('0x11')](_0x764c('0xc'),_0x18269d,_0xecf754[_0x764c('0x11')][_0x764c('0x12')]);return _0x319cd8(_0xecf754[_0x764c('0x11')][_0x764c('0x12')]);}else{logger[_0x764c('0xb')]('ZendeskAccount,\x20%s,\x20%s',_0x18269d,_0x764c('0xd'));_0x319cd8(_0xecf754['result']['message']);}})[_0x764c('0x13')](function(_0x338e87){logger['error'](_0x764c('0xc'),_0x18269d,_0x338e87);_0x404bcb(_0x338e87);});});}exports[_0x764c('0x14')]=function(_0x4043f8){var _0x228232=this;return new Promise(function(_0x36ef46,_0x5ae500){return db[_0x764c('0x15')][_0x764c('0x16')]({'raw':_0x4043f8[_0x764c('0x17')]?_0x4043f8[_0x764c('0x17')][_0x764c('0x18')]===undefined?!![]:![]:!![],'where':_0x4043f8[_0x764c('0x17')]?_0x4043f8['options'][_0x764c('0x19')]||null:null,'attributes':_0x4043f8[_0x764c('0x17')]?_0x4043f8[_0x764c('0x17')][_0x764c('0x1a')]||null:null,'limit':_0x4043f8['options']?_0x4043f8[_0x764c('0x17')][_0x764c('0x1b')]||null:null,'include':_0x4043f8['options']?_0x4043f8[_0x764c('0x17')]['include']?_[_0x764c('0x1c')](_0x4043f8[_0x764c('0x17')][_0x764c('0x1d')],function(_0x49e76d){return{'model':db[_0x49e76d[_0x764c('0x1e')]],'as':_0x49e76d['as'],'attributes':_0x49e76d[_0x764c('0x1a')],'include':_0x49e76d[_0x764c('0x1d')]?_[_0x764c('0x1c')](_0x49e76d[_0x764c('0x1d')],function(_0x39f154){return{'model':db[_0x39f154['model']],'as':_0x39f154['as'],'attributes':_0x39f154[_0x764c('0x1a')],'include':_0x39f154[_0x764c('0x1d')]?_[_0x764c('0x1c')](_0x39f154[_0x764c('0x1d')],function(_0x4ffff8){return{'model':db[_0x4ffff8[_0x764c('0x1e')]],'as':_0x4ffff8['as'],'attributes':_0x4ffff8[_0x764c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x764c('0x1f')](function(_0x22726b){logger['info'](_0x764c('0x14'),_0x4043f8);logger[_0x764c('0xe')]('GetZendeskAccount',_0x4043f8,JSON[_0x764c('0x10')](_0x22726b));_0x36ef46(_0x22726b);})[_0x764c('0x13')](function(_0x5c6978){logger[_0x764c('0x11')]('GetZendeskAccount',_0x5c6978[_0x764c('0x12')],_0x4043f8);_0x5ae500(_0x228232[_0x764c('0x11')](0x1f4,_0x5c6978['message']));});});};exports[_0x764c('0x20')]=function(_0x4b8a49){var _0x1612ef=this;return new Promise(function(_0x2a8e9b,_0x38717f){return db[_0x764c('0x15')][_0x764c('0x21')]({'raw':_0x4b8a49['options']?_0x4b8a49[_0x764c('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4b8a49[_0x764c('0x17')]?_0x4b8a49[_0x764c('0x17')][_0x764c('0x19')]||null:null,'attributes':_0x4b8a49[_0x764c('0x17')]?_0x4b8a49[_0x764c('0x17')][_0x764c('0x1a')]||null:null,'include':_0x4b8a49['options']?_0x4b8a49[_0x764c('0x17')]['include']?_[_0x764c('0x1c')](_0x4b8a49[_0x764c('0x17')]['include'],function(_0x512540){return{'model':db[_0x512540['model']],'as':_0x512540['as'],'attributes':_0x512540['attributes'],'include':_0x512540[_0x764c('0x1d')]?_[_0x764c('0x1c')](_0x512540[_0x764c('0x1d')],function(_0x1b8f08){return{'model':db[_0x1b8f08[_0x764c('0x1e')]],'as':_0x1b8f08['as'],'attributes':_0x1b8f08['attributes'],'include':_0x1b8f08[_0x764c('0x1d')]?_['map'](_0x1b8f08['include'],function(_0x5e6fd3){return{'model':db[_0x5e6fd3[_0x764c('0x1e')]],'as':_0x5e6fd3['as'],'attributes':_0x5e6fd3[_0x764c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x764c('0x1f')](function(_0x2dc15e){logger[_0x764c('0xb')](_0x764c('0x20'),_0x4b8a49);logger[_0x764c('0xe')]('ShowZendeskAccount',_0x4b8a49,JSON['stringify'](_0x2dc15e));_0x2a8e9b(_0x2dc15e);})[_0x764c('0x13')](function(_0x375f09){logger['error'](_0x764c('0x20'),_0x375f09[_0x764c('0x12')],_0x4b8a49);_0x38717f(_0x1612ef['error'](0x1f4,_0x375f09[_0x764c('0x12')]));});});}; \ No newline at end of file +var _0x5570=['jayson/promise','client','http','then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','map','include','model','ShowZendeskAccount','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x56e32e,_0x9eb2f6){var _0x2a757b=function(_0x50b7bc){while(--_0x50b7bc){_0x56e32e['push'](_0x56e32e['shift']());}};_0x2a757b(++_0x9eb2f6);}(_0x5570,0x122));var _0x0557=function(_0x2a3653,_0x2b5804){_0x2a3653=_0x2a3653-0x0;var _0x2d9e61=_0x5570[_0x2a3653];return _0x2d9e61;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0557('0x0'));var BPromise=require(_0x0557('0x1'));var rs=require(_0x0557('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0557('0x3'))['db'];var utils=require(_0x0557('0x4'));var logger=require('../../config/logger')(_0x0557('0x5'));var config=require(_0x0557('0x6'));var jayson=require(_0x0557('0x7'));var client=jayson[_0x0557('0x8')][_0x0557('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17bd51,_0x168641,_0x3afc9d){return new BPromise(function(_0x13b56e,_0x28a84a){return client['request'](_0x17bd51,_0x3afc9d)[_0x0557('0xa')](function(_0x50e0e9){logger[_0x0557('0xb')](_0x0557('0xc'),_0x168641,'request\x20sent');logger[_0x0557('0xd')](_0x0557('0xe'),_0x168641,_0x0557('0xf'),JSON[_0x0557('0x10')](_0x50e0e9));if(_0x50e0e9[_0x0557('0x11')]){if(_0x50e0e9[_0x0557('0x11')][_0x0557('0x12')]===0x1f4){logger[_0x0557('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x168641,_0x50e0e9[_0x0557('0x11')][_0x0557('0x13')]);return _0x28a84a(_0x50e0e9[_0x0557('0x11')]['message']);}logger[_0x0557('0x11')](_0x0557('0xc'),_0x168641,_0x50e0e9[_0x0557('0x11')][_0x0557('0x13')]);return _0x13b56e(_0x50e0e9[_0x0557('0x11')]['message']);}else{logger[_0x0557('0xb')]('ZendeskAccount,\x20%s,\x20%s',_0x168641,_0x0557('0xf'));_0x13b56e(_0x50e0e9[_0x0557('0x14')][_0x0557('0x13')]);}})[_0x0557('0x15')](function(_0xdc727a){logger['error'](_0x0557('0xc'),_0x168641,_0xdc727a);_0x28a84a(_0xdc727a);});});}exports[_0x0557('0x16')]=function(_0x2dff77){var _0x24c4ec=this;return new Promise(function(_0x5a1e34,_0xfb871){return db[_0x0557('0x17')][_0x0557('0x18')]({'raw':_0x2dff77[_0x0557('0x19')]?_0x2dff77[_0x0557('0x19')][_0x0557('0x1a')]===undefined?!![]:![]:!![],'where':_0x2dff77[_0x0557('0x19')]?_0x2dff77[_0x0557('0x19')][_0x0557('0x1b')]||null:null,'attributes':_0x2dff77['options']?_0x2dff77[_0x0557('0x19')][_0x0557('0x1c')]||null:null,'limit':_0x2dff77['options']?_0x2dff77[_0x0557('0x19')]['limit']||null:null,'include':_0x2dff77[_0x0557('0x19')]?_0x2dff77['options']['include']?_[_0x0557('0x1d')](_0x2dff77[_0x0557('0x19')][_0x0557('0x1e')],function(_0x1f0d05){return{'model':db[_0x1f0d05[_0x0557('0x1f')]],'as':_0x1f0d05['as'],'attributes':_0x1f0d05[_0x0557('0x1c')],'include':_0x1f0d05['include']?_[_0x0557('0x1d')](_0x1f0d05['include'],function(_0x5982d0){return{'model':db[_0x5982d0[_0x0557('0x1f')]],'as':_0x5982d0['as'],'attributes':_0x5982d0[_0x0557('0x1c')],'include':_0x5982d0[_0x0557('0x1e')]?_[_0x0557('0x1d')](_0x5982d0[_0x0557('0x1e')],function(_0x542649){return{'model':db[_0x542649[_0x0557('0x1f')]],'as':_0x542649['as'],'attributes':_0x542649[_0x0557('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0557('0xa')](function(_0x46e68d){logger[_0x0557('0xb')](_0x0557('0x16'),_0x2dff77);logger[_0x0557('0xd')](_0x0557('0x16'),_0x2dff77,JSON[_0x0557('0x10')](_0x46e68d));_0x5a1e34(_0x46e68d);})['catch'](function(_0x459220){logger[_0x0557('0x11')](_0x0557('0x16'),_0x459220[_0x0557('0x13')],_0x2dff77);_0xfb871(_0x24c4ec[_0x0557('0x11')](0x1f4,_0x459220[_0x0557('0x13')]));});});};exports[_0x0557('0x20')]=function(_0x475780){var _0x4921da=this;return new Promise(function(_0xb15b1e,_0xa46515){return db['ZendeskAccount']['find']({'raw':_0x475780[_0x0557('0x19')]?_0x475780[_0x0557('0x19')][_0x0557('0x1a')]===undefined?!![]:![]:!![],'where':_0x475780[_0x0557('0x19')]?_0x475780[_0x0557('0x19')]['where']||null:null,'attributes':_0x475780[_0x0557('0x19')]?_0x475780[_0x0557('0x19')][_0x0557('0x1c')]||null:null,'include':_0x475780[_0x0557('0x19')]?_0x475780[_0x0557('0x19')][_0x0557('0x1e')]?_[_0x0557('0x1d')](_0x475780[_0x0557('0x19')]['include'],function(_0x3b141e){return{'model':db[_0x3b141e[_0x0557('0x1f')]],'as':_0x3b141e['as'],'attributes':_0x3b141e[_0x0557('0x1c')],'include':_0x3b141e['include']?_[_0x0557('0x1d')](_0x3b141e[_0x0557('0x1e')],function(_0x452a15){return{'model':db[_0x452a15[_0x0557('0x1f')]],'as':_0x452a15['as'],'attributes':_0x452a15[_0x0557('0x1c')],'include':_0x452a15[_0x0557('0x1e')]?_[_0x0557('0x1d')](_0x452a15['include'],function(_0x398e19){return{'model':db[_0x398e19['model']],'as':_0x398e19['as'],'attributes':_0x398e19[_0x0557('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0557('0xa')](function(_0x3acd4c){logger[_0x0557('0xb')](_0x0557('0x20'),_0x475780);logger[_0x0557('0xd')](_0x0557('0x20'),_0x475780,JSON['stringify'](_0x3acd4c));_0xb15b1e(_0x3acd4c);})[_0x0557('0x15')](function(_0x358a5b){logger[_0x0557('0x11')](_0x0557('0x20'),_0x358a5b[_0x0557('0x13')],_0x475780);_0xa46515(_0x4921da[_0x0557('0x11')](0x1f4,_0x358a5b['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 9e340c4..493cc14 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 _0xda3f=['../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','post','create','put','destroy','exports','util','path','fs-extra','../../components/interaction/service'];(function(_0x570e5f,_0xb5ec32){var _0x4f8f39=function(_0xd43103){while(--_0xd43103){_0x570e5f['push'](_0x570e5f['shift']());}};_0x4f8f39(++_0xb5ec32);}(_0xda3f,0xec));var _0xfda3=function(_0x12fa4b,_0x551df9){_0x12fa4b=_0x12fa4b-0x0;var _0x1805c8=_0xda3f[_0x12fa4b];return _0x1805c8;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./intZendeskConfiguration.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x5')](_0xfda3('0x9'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0x5')](_0xfda3('0xb'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0x5')]('/:id/descriptions',auth[_0xfda3('0x6')](),controller[_0xfda3('0xd')]);router[_0xfda3('0x5')](_0xfda3('0xe'),auth[_0xfda3('0x6')](),controller['getTags']);router[_0xfda3('0xf')]('/',auth['isAuthenticated'](),controller[_0xfda3('0x10')]);router[_0xfda3('0xf')]('/:id/tags',auth['isAuthenticated'](),controller['setTags']);router[_0xfda3('0x11')](_0xfda3('0x7'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x12')]);module[_0xfda3('0x13')]=router; \ No newline at end of file +var _0xb688=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','update','exports','util'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0xb688,0xcf));var _0x8b68=function(_0x36573a,_0x2f1d5b){_0x36573a=_0x36573a-0x0;var _0x39e4ef=_0xb688[_0x36573a];return _0x39e4ef;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var fs_extra=require(_0x8b68('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var controller=require(_0x8b68('0x8'));router[_0x8b68('0x9')]('/',auth['isAuthenticated'](),controller[_0x8b68('0xa')]);router['get'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xd')]);router[_0x8b68('0x9')](_0x8b68('0xe'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xf')]);router[_0x8b68('0x9')](_0x8b68('0x10'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x11')]);router[_0x8b68('0x9')](_0x8b68('0x12'),auth['isAuthenticated'](),controller[_0x8b68('0x13')]);router[_0x8b68('0x9')](_0x8b68('0x14'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x15')]);router[_0x8b68('0x16')]('/',auth[_0x8b68('0xc')](),controller[_0x8b68('0x17')]);router[_0x8b68('0x16')]('/:id/tags',auth[_0x8b68('0xc')](),controller['setTags']);router['put'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x18')]);router['delete']('/:id',auth[_0x8b68('0xc')](),controller['destroy']);module[_0x8b68('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 42d36c6..69a9ab5 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 _0x4ec0=['exports','STRING'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x4ec0,0x194));var _0x04ec=function(_0xb481af,_0x1f7f6c){_0xb481af=_0xb481af-0x0;var _0xbc8d44=_0x4ec0[_0xb481af];return _0xbc8d44;};'use strict';var Sequelize=require('sequelize');module[_0x04ec('0x0')]={'name':{'type':Sequelize[_0x04ec('0x1')]},'description':{'type':Sequelize[_0x04ec('0x1')]}}; \ No newline at end of file +var _0x7a68=['STRING','sequelize'];(function(_0x7b217b,_0x35acb4){var _0x26bd3e=function(_0xaf401b){while(--_0xaf401b){_0x7b217b['push'](_0x7b217b['shift']());}};_0x26bd3e(++_0x35acb4);}(_0x7a68,0xab));var _0x87a6=function(_0x4545e9,_0x156fbc){_0x4545e9=_0x4545e9-0x0;var _0x2e47da=_0x7a68[_0x4545e9];return _0x2e47da;};'use strict';var Sequelize=require(_0x87a6('0x0'));module['exports']={'name':{'type':Sequelize[_0x87a6('0x1')]},'description':{'type':Sequelize[_0x87a6('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 73c111e..4897b63 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 _0x87fc=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','catch','show','params','fields','find','create','body','getFields','findOne','ZendeskField','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x223461,_0x2bca70){var _0x4dbe0a=function(_0x3c3cb6){while(--_0x3c3cb6){_0x223461['push'](_0x223461['shift']());}};_0x4dbe0a(++_0x2bca70);}(_0x87fc,0x13e));var _0xc87f=function(_0x151569,_0x3b7f73){_0x151569=_0x151569-0x0;var _0x2ae4ca=_0x87fc[_0x151569];return _0x2ae4ca;};'use strict';var emlformat=require(_0xc87f('0x0'));var rimraf=require(_0xc87f('0x1'));var zipdir=require(_0xc87f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc87f('0x3'));var moment=require(_0xc87f('0x4'));var BPromise=require(_0xc87f('0x5'));var Mustache=require(_0xc87f('0x6'));var util=require(_0xc87f('0x7'));var path=require(_0xc87f('0x8'));var sox=require(_0xc87f('0x9'));var csv=require(_0xc87f('0xa'));var ejs=require(_0xc87f('0xb'));var fs=require('fs');var fs_extra=require(_0xc87f('0xc'));var _=require(_0xc87f('0xd'));var squel=require('squel');var crypto=require(_0xc87f('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc87f('0xa'));var querystring=require(_0xc87f('0xf'));var Papa=require(_0xc87f('0x10'));var Redis=require(_0xc87f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc87f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc87f('0x13'));var logger=require(_0xc87f('0x14'))(_0xc87f('0x15'));var utils=require('../../config/utils');var config=require(_0xc87f('0x16'));var licenseUtil=require(_0xc87f('0x17'));var db=require(_0xc87f('0x18'))['db'];function respondWithStatusCode(_0x197d2a,_0x17d4f6){_0x17d4f6=_0x17d4f6||0xcc;return function(_0x851a58){if(_0x851a58){return _0x197d2a[_0xc87f('0x19')](_0x17d4f6);}return _0x197d2a[_0xc87f('0x1a')](_0x17d4f6)[_0xc87f('0x1b')]();};}function respondWithResult(_0x4f0fa0,_0x361666){_0x361666=_0x361666||0xc8;return function(_0x91bd44){if(_0x91bd44){return _0x4f0fa0[_0xc87f('0x1a')](_0x361666)[_0xc87f('0x1c')](_0x91bd44);}};}function respondWithFilteredResult(_0x5ebafe,_0x1d0958){return function(_0x5d308d){if(_0x5d308d){var _0x1b45e9=typeof _0x1d0958[_0xc87f('0x1d')]===_0xc87f('0x1e')&&typeof _0x1d0958[_0xc87f('0x1f')]===_0xc87f('0x1e');var _0x109c1c=_0x5d308d[_0xc87f('0x20')];var _0x2e2b3d=_0x1b45e9?0x0:_0x1d0958[_0xc87f('0x1d')];var _0x5a6f00=_0x1b45e9?_0x5d308d[_0xc87f('0x20')]:_0x1d0958[_0xc87f('0x1d')]+_0x1d0958[_0xc87f('0x1f')];var _0x876b85;if(_0x5a6f00>=_0x109c1c){_0x5a6f00=_0x109c1c;_0x876b85=0xc8;}else{_0x876b85=0xce;}_0x5ebafe[_0xc87f('0x1a')](_0x876b85);return _0x5ebafe[_0xc87f('0x21')](_0xc87f('0x22'),_0x2e2b3d+'-'+_0x5a6f00+'/'+_0x109c1c)[_0xc87f('0x1c')](_0x5d308d);}return null;};}function patchUpdates(_0x4a7ba3){return function(_0x469964){try{jsonpatch[_0xc87f('0x23')](_0x469964,_0x4a7ba3,!![]);}catch(_0x16409f){return BPromise[_0xc87f('0x24')](_0x16409f);}return _0x469964[_0xc87f('0x25')]();};}function saveUpdates(_0x29b4bd,_0xe5ce01){return function(_0x1f1e46){if(_0x1f1e46){return _0x1f1e46[_0xc87f('0x26')](_0x29b4bd)[_0xc87f('0x27')](function(_0x472749){return _0x472749;});}return null;};}function removeEntity(_0x42cc4d,_0x2f9b61){return function(_0x30af16){if(_0x30af16){return _0x30af16[_0xc87f('0x28')]()['then'](function(){_0x42cc4d['status'](0xcc)[_0xc87f('0x1b')]();});}};}function handleEntityNotFound(_0x48c6d6,_0x5096cd){return function(_0x2f85ce){if(!_0x2f85ce){_0x48c6d6[_0xc87f('0x19')](0x194);}return _0x2f85ce;};}function handleError(_0x513959,_0x942f47){_0x942f47=_0x942f47||0x1f4;return function(_0x2e1e7d){logger[_0xc87f('0x29')](_0x2e1e7d[_0xc87f('0x2a')]);if(_0x2e1e7d[_0xc87f('0x2b')]){delete _0x2e1e7d['name'];}_0x513959[_0xc87f('0x1a')](_0x942f47)[_0xc87f('0x2c')](_0x2e1e7d);};}exports[_0xc87f('0x2d')]=function(_0x29906f,_0x5b0572){var _0x1790f3={},_0x39fea5={},_0x55980d={'count':0x0,'rows':[]};var _0x2cb9ed=_[_0xc87f('0x2e')](db[_0xc87f('0x2f')][_0xc87f('0x30')],function(_0x5ac9c6){return{'name':_0x5ac9c6['fieldName'],'type':_0x5ac9c6[_0xc87f('0x31')][_0xc87f('0x32')]};});_0x39fea5[_0xc87f('0x33')]=_[_0xc87f('0x2e')](_0x2cb9ed,_0xc87f('0x2b'));_0x39fea5[_0xc87f('0x34')]=_[_0xc87f('0x35')](_0x29906f[_0xc87f('0x34')]);_0x39fea5[_0xc87f('0x36')]=_[_0xc87f('0x37')](_0x39fea5[_0xc87f('0x33')],_0x39fea5[_0xc87f('0x34')]);_0x1790f3[_0xc87f('0x38')]=_[_0xc87f('0x37')](_0x39fea5[_0xc87f('0x33')],qs['fields'](_0x29906f[_0xc87f('0x34')]['fields']));_0x1790f3[_0xc87f('0x38')]=_0x1790f3[_0xc87f('0x38')][_0xc87f('0x39')]?_0x1790f3['attributes']:_0x39fea5[_0xc87f('0x33')];if(!_0x29906f[_0xc87f('0x34')][_0xc87f('0x3a')](_0xc87f('0x3b'))){_0x1790f3['limit']=qs[_0xc87f('0x1f')](_0x29906f['query'][_0xc87f('0x1f')]);_0x1790f3[_0xc87f('0x1d')]=qs[_0xc87f('0x1d')](_0x29906f[_0xc87f('0x34')][_0xc87f('0x1d')]);}_0x1790f3[_0xc87f('0x3c')]=qs[_0xc87f('0x3d')](_0x29906f[_0xc87f('0x34')][_0xc87f('0x3d')]);_0x1790f3[_0xc87f('0x3e')]=qs['filters'](_[_0xc87f('0x3f')](_0x29906f['query'],_0x39fea5[_0xc87f('0x36')]),_0x2cb9ed);if(_0x29906f[_0xc87f('0x34')]['filter']){_0x1790f3['where']=_[_0xc87f('0x40')](_0x1790f3[_0xc87f('0x3e')],{'$or':_[_0xc87f('0x2e')](_0x2cb9ed,function(_0x111677){if(_0x111677[_0xc87f('0x31')]!=='VIRTUAL'){var _0x42b999={};_0x42b999[_0x111677['name']]={'$like':'%'+_0x29906f['query'][_0xc87f('0x41')]+'%'};return _0x42b999;}})});}_0x1790f3=_['merge']({},_0x1790f3,_0x29906f[_0xc87f('0x42')]);var _0x10431a={'where':_0x1790f3[_0xc87f('0x3e')]};return db[_0xc87f('0x2f')][_0xc87f('0x20')](_0x10431a)[_0xc87f('0x27')](function(_0x45ce6f){_0x55980d[_0xc87f('0x20')]=_0x45ce6f;if(_0x29906f[_0xc87f('0x34')][_0xc87f('0x43')]){_0x1790f3[_0xc87f('0x44')]=[{'all':!![]}];}return db[_0xc87f('0x2f')][_0xc87f('0x45')](_0x1790f3);})[_0xc87f('0x27')](function(_0x45a7fa){_0x55980d['rows']=_0x45a7fa;return _0x55980d;})[_0xc87f('0x27')](respondWithFilteredResult(_0x5b0572,_0x1790f3))[_0xc87f('0x46')](handleError(_0x5b0572,null));};exports[_0xc87f('0x47')]=function(_0x340e76,_0x343c33){var _0xf5365={'raw':![],'where':{'id':_0x340e76[_0xc87f('0x48')]['id']}},_0x5a4985={};_0x5a4985[_0xc87f('0x33')]=_[_0xc87f('0x35')](db[_0xc87f('0x2f')][_0xc87f('0x30')]);_0x5a4985[_0xc87f('0x34')]=_[_0xc87f('0x35')](_0x340e76['query']);_0x5a4985[_0xc87f('0x36')]=_['intersection'](_0x5a4985[_0xc87f('0x33')],_0x5a4985[_0xc87f('0x34')]);_0xf5365['attributes']=_[_0xc87f('0x37')](_0x5a4985['model'],qs['fields'](_0x340e76['query'][_0xc87f('0x49')]));_0xf5365['attributes']=_0xf5365['attributes'][_0xc87f('0x39')]?_0xf5365[_0xc87f('0x38')]:_0x5a4985[_0xc87f('0x33')];if(_0x340e76[_0xc87f('0x34')]['includeAll']){_0xf5365['include']=[{'all':!![]}];}_0xf5365=_[_0xc87f('0x40')]({},_0xf5365,_0x340e76[_0xc87f('0x42')]);return db[_0xc87f('0x2f')][_0xc87f('0x4a')](_0xf5365)['then'](handleEntityNotFound(_0x343c33,null))['then'](respondWithResult(_0x343c33,null))[_0xc87f('0x46')](handleError(_0x343c33,null));};exports[_0xc87f('0x4b')]=function(_0x1e1e8d,_0x34cdcd){return db[_0xc87f('0x2f')]['create'](_0x1e1e8d[_0xc87f('0x4c')],{})[_0xc87f('0x27')](respondWithResult(_0x34cdcd,0xc9))[_0xc87f('0x46')](handleError(_0x34cdcd,null));};exports[_0xc87f('0x26')]=function(_0x239418,_0x3b3694){if(_0x239418[_0xc87f('0x4c')]['id']){delete _0x239418[_0xc87f('0x4c')]['id'];}return db[_0xc87f('0x2f')]['find']({'where':{'id':_0x239418['params']['id']}})['then'](handleEntityNotFound(_0x3b3694,null))[_0xc87f('0x27')](saveUpdates(_0x239418['body'],null))[_0xc87f('0x27')](respondWithResult(_0x3b3694,null))[_0xc87f('0x46')](handleError(_0x3b3694,null));};exports[_0xc87f('0x28')]=function(_0x2bbff4,_0x586676){return db[_0xc87f('0x2f')]['find']({'where':{'id':_0x2bbff4[_0xc87f('0x48')]['id']}})[_0xc87f('0x27')](handleEntityNotFound(_0x586676,null))[_0xc87f('0x27')](removeEntity(_0x586676,null))[_0xc87f('0x46')](handleError(_0x586676,null));};exports[_0xc87f('0x4d')]=function(_0x546ec1,_0x9b02f7,_0x5aa9cb){var _0x3a8fae={};var _0x4c1bbd={};var _0x19699b;var _0x1e4942;return db['ZendeskConfiguration'][_0xc87f('0x4e')]({'where':{'id':_0x546ec1['params']['id']}})['then'](handleEntityNotFound(_0x9b02f7,null))[_0xc87f('0x27')](function(_0x5770f0){if(_0x5770f0){_0x19699b=_0x5770f0;_0x4c1bbd[_0xc87f('0x33')]=_['keys'](db[_0xc87f('0x4f')][_0xc87f('0x30')]);_0x4c1bbd[_0xc87f('0x34')]=_['keys'](_0x546ec1['query']);_0x4c1bbd[_0xc87f('0x36')]=_[_0xc87f('0x37')](_0x4c1bbd['model'],_0x4c1bbd[_0xc87f('0x34')]);_0x3a8fae[_0xc87f('0x38')]=_['intersection'](_0x4c1bbd[_0xc87f('0x33')],qs[_0xc87f('0x49')](_0x546ec1[_0xc87f('0x34')][_0xc87f('0x49')]));_0x3a8fae[_0xc87f('0x38')]=_0x3a8fae[_0xc87f('0x38')]['length']?_0x3a8fae[_0xc87f('0x38')]:_0x4c1bbd['model'];_0x3a8fae[_0xc87f('0x3c')]=qs[_0xc87f('0x3d')](_0x546ec1['query'][_0xc87f('0x3d')]);_0x3a8fae['where']=qs[_0xc87f('0x36')](_[_0xc87f('0x3f')](_0x546ec1[_0xc87f('0x34')],_0x4c1bbd[_0xc87f('0x36')]));if(_0x546ec1[_0xc87f('0x34')][_0xc87f('0x41')]){_0x3a8fae[_0xc87f('0x3e')]=_[_0xc87f('0x40')](_0x3a8fae['where'],{'$or':_['map'](_0x3a8fae[_0xc87f('0x38')],function(_0x2b27b4){var _0x2db8b7={};_0x2db8b7[_0x2b27b4]={'$like':'%'+_0x546ec1[_0xc87f('0x34')]['filter']+'%'};return _0x2db8b7;})});}_0x3a8fae=_[_0xc87f('0x40')]({},_0x3a8fae,_0x546ec1[_0xc87f('0x42')]);return _0x19699b[_0xc87f('0x4d')](_0x3a8fae);}})[_0xc87f('0x27')](function(_0x2fb6b4){if(_0x2fb6b4){_0x1e4942=_0x2fb6b4[_0xc87f('0x39')];if(!_0x546ec1[_0xc87f('0x34')][_0xc87f('0x3a')](_0xc87f('0x3b'))){_0x3a8fae[_0xc87f('0x1f')]=qs[_0xc87f('0x1f')](_0x546ec1[_0xc87f('0x34')][_0xc87f('0x1f')]);_0x3a8fae[_0xc87f('0x1d')]=qs[_0xc87f('0x1d')](_0x546ec1[_0xc87f('0x34')][_0xc87f('0x1d')]);}return _0x19699b[_0xc87f('0x4d')](_0x3a8fae);}})['then'](function(_0x3671c2){if(_0x3671c2){return _0x3671c2?{'count':_0x1e4942,'rows':_0x3671c2}:null;}})[_0xc87f('0x27')](respondWithResult(_0x9b02f7,null))[_0xc87f('0x46')](handleError(_0x9b02f7,null));};exports['getSubjects']=function(_0x231f54,_0x248a20,_0x22a98e){var _0x3387de={};var _0x2371d0={};var _0x1cb528;var _0x324327;return db[_0xc87f('0x2f')][_0xc87f('0x4e')]({'where':{'id':_0x231f54[_0xc87f('0x48')]['id']}})['then'](handleEntityNotFound(_0x248a20,null))[_0xc87f('0x27')](function(_0x36ad7a){if(_0x36ad7a){_0x1cb528=_0x36ad7a;_0x2371d0[_0xc87f('0x33')]=_[_0xc87f('0x35')](db['ZendeskField'][_0xc87f('0x30')]);_0x2371d0[_0xc87f('0x34')]=_[_0xc87f('0x35')](_0x231f54[_0xc87f('0x34')]);_0x2371d0[_0xc87f('0x36')]=_[_0xc87f('0x37')](_0x2371d0[_0xc87f('0x33')],_0x2371d0['query']);_0x3387de[_0xc87f('0x38')]=_[_0xc87f('0x37')](_0x2371d0[_0xc87f('0x33')],qs[_0xc87f('0x49')](_0x231f54[_0xc87f('0x34')][_0xc87f('0x49')]));_0x3387de[_0xc87f('0x38')]=_0x3387de[_0xc87f('0x38')][_0xc87f('0x39')]?_0x3387de[_0xc87f('0x38')]:_0x2371d0['model'];_0x3387de[_0xc87f('0x3c')]=qs[_0xc87f('0x3d')](_0x231f54[_0xc87f('0x34')][_0xc87f('0x3d')]);_0x3387de[_0xc87f('0x3e')]=qs[_0xc87f('0x36')](_[_0xc87f('0x3f')](_0x231f54[_0xc87f('0x34')],_0x2371d0[_0xc87f('0x36')]));if(_0x231f54['query'][_0xc87f('0x41')]){_0x3387de[_0xc87f('0x3e')]=_[_0xc87f('0x40')](_0x3387de[_0xc87f('0x3e')],{'$or':_[_0xc87f('0x2e')](_0x3387de[_0xc87f('0x38')],function(_0x2d20d5){var _0x177f02={};_0x177f02[_0x2d20d5]={'$like':'%'+_0x231f54[_0xc87f('0x34')]['filter']+'%'};return _0x177f02;})});}_0x3387de=_[_0xc87f('0x40')]({},_0x3387de,_0x231f54['options']);return _0x1cb528['getSubjects'](_0x3387de);}})[_0xc87f('0x27')](function(_0x27cfd8){if(_0x27cfd8){_0x324327=_0x27cfd8[_0xc87f('0x39')];if(!_0x231f54['query'][_0xc87f('0x3a')](_0xc87f('0x3b'))){_0x3387de[_0xc87f('0x1f')]=qs[_0xc87f('0x1f')](_0x231f54['query'][_0xc87f('0x1f')]);_0x3387de[_0xc87f('0x1d')]=qs[_0xc87f('0x1d')](_0x231f54[_0xc87f('0x34')][_0xc87f('0x1d')]);}return _0x1cb528['getSubjects'](_0x3387de);}})[_0xc87f('0x27')](function(_0x2a7221){if(_0x2a7221){return _0x2a7221?{'count':_0x324327,'rows':_0x2a7221}:null;}})[_0xc87f('0x27')](respondWithResult(_0x248a20,null))['catch'](handleError(_0x248a20,null));};exports['getDescriptions']=function(_0x44e86e,_0x1f1c22,_0x52cfd3){var _0x4a6656={};var _0x251314={};var _0x1a7904;var _0x333798;return db['ZendeskConfiguration'][_0xc87f('0x4e')]({'where':{'id':_0x44e86e[_0xc87f('0x48')]['id']}})[_0xc87f('0x27')](handleEntityNotFound(_0x1f1c22,null))[_0xc87f('0x27')](function(_0x17748b){if(_0x17748b){_0x1a7904=_0x17748b;_0x251314['model']=_['keys'](db[_0xc87f('0x4f')][_0xc87f('0x30')]);_0x251314[_0xc87f('0x34')]=_[_0xc87f('0x35')](_0x44e86e[_0xc87f('0x34')]);_0x251314[_0xc87f('0x36')]=_[_0xc87f('0x37')](_0x251314[_0xc87f('0x33')],_0x251314[_0xc87f('0x34')]);_0x4a6656[_0xc87f('0x38')]=_[_0xc87f('0x37')](_0x251314[_0xc87f('0x33')],qs['fields'](_0x44e86e[_0xc87f('0x34')][_0xc87f('0x49')]));_0x4a6656['attributes']=_0x4a6656['attributes']['length']?_0x4a6656[_0xc87f('0x38')]:_0x251314['model'];_0x4a6656['order']=qs[_0xc87f('0x3d')](_0x44e86e['query'][_0xc87f('0x3d')]);_0x4a6656[_0xc87f('0x3e')]=qs[_0xc87f('0x36')](_[_0xc87f('0x3f')](_0x44e86e[_0xc87f('0x34')],_0x251314[_0xc87f('0x36')]));if(_0x44e86e['query'][_0xc87f('0x41')]){_0x4a6656[_0xc87f('0x3e')]=_['merge'](_0x4a6656[_0xc87f('0x3e')],{'$or':_['map'](_0x4a6656[_0xc87f('0x38')],function(_0x2f63bb){var _0x353c98={};_0x353c98[_0x2f63bb]={'$like':'%'+_0x44e86e[_0xc87f('0x34')][_0xc87f('0x41')]+'%'};return _0x353c98;})});}_0x4a6656=_[_0xc87f('0x40')]({},_0x4a6656,_0x44e86e[_0xc87f('0x42')]);return _0x1a7904[_0xc87f('0x50')](_0x4a6656);}})['then'](function(_0x1c0132){if(_0x1c0132){_0x333798=_0x1c0132[_0xc87f('0x39')];if(!_0x44e86e[_0xc87f('0x34')][_0xc87f('0x3a')](_0xc87f('0x3b'))){_0x4a6656['limit']=qs[_0xc87f('0x1f')](_0x44e86e[_0xc87f('0x34')][_0xc87f('0x1f')]);_0x4a6656['offset']=qs['offset'](_0x44e86e[_0xc87f('0x34')][_0xc87f('0x1d')]);}return _0x1a7904['getDescriptions'](_0x4a6656);}})[_0xc87f('0x27')](function(_0x116dec){if(_0x116dec){return _0x116dec?{'count':_0x333798,'rows':_0x116dec}:null;}})[_0xc87f('0x27')](respondWithResult(_0x1f1c22,null))[_0xc87f('0x46')](handleError(_0x1f1c22,null));};exports[_0xc87f('0x51')]=function(_0x3fadb2,_0x39d03a,_0x4290e7){var _0x488f99={};var _0x1fe02c={};var _0x2babe2;var _0xa2d49d;return db[_0xc87f('0x2f')]['findOne']({'where':{'id':_0x3fadb2[_0xc87f('0x48')]['id']}})[_0xc87f('0x27')](handleEntityNotFound(_0x39d03a,null))['then'](function(_0xf31aaa){if(_0xf31aaa){_0x2babe2=_0xf31aaa;_0x1fe02c[_0xc87f('0x33')]=_[_0xc87f('0x35')](db[_0xc87f('0x52')][_0xc87f('0x30')]);_0x1fe02c[_0xc87f('0x34')]=_[_0xc87f('0x35')](_0x3fadb2[_0xc87f('0x34')]);_0x1fe02c[_0xc87f('0x36')]=_['intersection'](_0x1fe02c['model'],_0x1fe02c[_0xc87f('0x34')]);_0x488f99[_0xc87f('0x38')]=_['intersection'](_0x1fe02c['model'],qs[_0xc87f('0x49')](_0x3fadb2[_0xc87f('0x34')]['fields']));_0x488f99['attributes']=_0x488f99['attributes']['length']?_0x488f99[_0xc87f('0x38')]:_0x1fe02c['model'];_0x488f99[_0xc87f('0x3c')]=qs['sort'](_0x3fadb2[_0xc87f('0x34')][_0xc87f('0x3d')]);_0x488f99[_0xc87f('0x3e')]=qs[_0xc87f('0x36')](_[_0xc87f('0x3f')](_0x3fadb2[_0xc87f('0x34')],_0x1fe02c[_0xc87f('0x36')]));if(_0x3fadb2[_0xc87f('0x34')][_0xc87f('0x41')]){_0x488f99['where']=_[_0xc87f('0x40')](_0x488f99[_0xc87f('0x3e')],{'$or':_[_0xc87f('0x2e')](_0x488f99[_0xc87f('0x38')],function(_0x1ad8f4){var _0x2a3aba={};_0x2a3aba[_0x1ad8f4]={'$like':'%'+_0x3fadb2[_0xc87f('0x34')][_0xc87f('0x41')]+'%'};return _0x2a3aba;})});}_0x488f99=_[_0xc87f('0x40')]({},_0x488f99,_0x3fadb2[_0xc87f('0x42')]);return _0x2babe2[_0xc87f('0x51')](_0x488f99);}})[_0xc87f('0x27')](function(_0x57b133){if(_0x57b133){_0xa2d49d=_0x57b133['length'];if(!_0x3fadb2['query']['hasOwnProperty'](_0xc87f('0x3b'))){_0x488f99[_0xc87f('0x1f')]=qs['limit'](_0x3fadb2['query'][_0xc87f('0x1f')]);_0x488f99[_0xc87f('0x1d')]=qs[_0xc87f('0x1d')](_0x3fadb2['query'][_0xc87f('0x1d')]);}return _0x2babe2['getTags'](_0x488f99);}})[_0xc87f('0x27')](function(_0x1eefba){if(_0x1eefba){return _0x1eefba?{'count':_0xa2d49d,'rows':_0x1eefba}:null;}})[_0xc87f('0x27')](respondWithResult(_0x39d03a,null))[_0xc87f('0x46')](handleError(_0x39d03a,null));};exports[_0xc87f('0x53')]=function(_0x4f5d17,_0x4bd516,_0x191b8a){if(_0x4f5d17[_0xc87f('0x4c')]['id']){delete _0x4f5d17[_0xc87f('0x4c')]['id'];}return db['ZendeskConfiguration'][_0xc87f('0x4e')]({'where':{'id':_0x4f5d17[_0xc87f('0x48')]['id']}})[_0xc87f('0x27')](handleEntityNotFound(_0x4bd516,null))[_0xc87f('0x27')](function(_0x304071){if(_0x304071){return _0x304071[_0xc87f('0x53')](_0x4f5d17[_0xc87f('0x4c')][_0xc87f('0x54')]||[]);}return null;})[_0xc87f('0x27')](respondWithResult(_0x4bd516,null))[_0xc87f('0x46')](handleError(_0x4bd516,null));}; \ No newline at end of file +var _0x06d5=['create','body','getFields','findOne','ZendeskField','order','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','ZendeskConfiguration','includeAll','catch','show','params','keys','include','find'];(function(_0xa92afe,_0x4996a8){var _0x1951c9=function(_0xd345f2){while(--_0xd345f2){_0xa92afe['push'](_0xa92afe['shift']());}};_0x1951c9(++_0x4996a8);}(_0x06d5,0x19c));var _0x506d=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x06d5[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0x506d('0x0'));var rimraf=require(_0x506d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x506d('0x2'));var rp=require(_0x506d('0x3'));var moment=require(_0x506d('0x4'));var BPromise=require(_0x506d('0x5'));var Mustache=require(_0x506d('0x6'));var util=require(_0x506d('0x7'));var path=require(_0x506d('0x8'));var sox=require('sox');var csv=require(_0x506d('0x9'));var ejs=require(_0x506d('0xa'));var fs=require('fs');var fs_extra=require(_0x506d('0xb'));var _=require(_0x506d('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x506d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x506d('0x9'));var querystring=require(_0x506d('0xe'));var Papa=require(_0x506d('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x506d('0x10'));var hardwareService=require(_0x506d('0x11'));var logger=require('../../config/logger')(_0x506d('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x506d('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e2329,_0x24974d){_0x24974d=_0x24974d||0xcc;return function(_0x4859c4){if(_0x4859c4){return _0x2e2329[_0x506d('0x14')](_0x24974d);}return _0x2e2329[_0x506d('0x15')](_0x24974d)[_0x506d('0x16')]();};}function respondWithResult(_0x3bb0c7,_0xdb3631){_0xdb3631=_0xdb3631||0xc8;return function(_0x5542f0){if(_0x5542f0){return _0x3bb0c7[_0x506d('0x15')](_0xdb3631)[_0x506d('0x17')](_0x5542f0);}};}function respondWithFilteredResult(_0x382fcd,_0x752978){return function(_0x33a129){if(_0x33a129){var _0x44a006=typeof _0x752978[_0x506d('0x18')]===_0x506d('0x19')&&typeof _0x752978[_0x506d('0x1a')]===_0x506d('0x19');var _0x2b6a5a=_0x33a129[_0x506d('0x1b')];var _0x1a67a0=_0x44a006?0x0:_0x752978[_0x506d('0x18')];var _0x38e016=_0x44a006?_0x33a129['count']:_0x752978['offset']+_0x752978['limit'];var _0x39a1d3;if(_0x38e016>=_0x2b6a5a){_0x38e016=_0x2b6a5a;_0x39a1d3=0xc8;}else{_0x39a1d3=0xce;}_0x382fcd[_0x506d('0x15')](_0x39a1d3);return _0x382fcd[_0x506d('0x1c')](_0x506d('0x1d'),_0x1a67a0+'-'+_0x38e016+'/'+_0x2b6a5a)[_0x506d('0x17')](_0x33a129);}return null;};}function patchUpdates(_0x42fbe5){return function(_0x136b7f){try{jsonpatch[_0x506d('0x1e')](_0x136b7f,_0x42fbe5,!![]);}catch(_0x595908){return BPromise[_0x506d('0x1f')](_0x595908);}return _0x136b7f[_0x506d('0x20')]();};}function saveUpdates(_0x130e29,_0x5469b3){return function(_0x4a614f){if(_0x4a614f){return _0x4a614f[_0x506d('0x21')](_0x130e29)[_0x506d('0x22')](function(_0x158f73){return _0x158f73;});}return null;};}function removeEntity(_0x4c299b,_0x42905a){return function(_0x5a0702){if(_0x5a0702){return _0x5a0702[_0x506d('0x23')]()[_0x506d('0x22')](function(){_0x4c299b[_0x506d('0x15')](0xcc)[_0x506d('0x16')]();});}};}function handleEntityNotFound(_0xd677d0,_0xb33047){return function(_0x46a2f3){if(!_0x46a2f3){_0xd677d0[_0x506d('0x14')](0x194);}return _0x46a2f3;};}function handleError(_0x2ff6ee,_0x5d92d0){_0x5d92d0=_0x5d92d0||0x1f4;return function(_0x3f19a5){logger['error'](_0x3f19a5['stack']);if(_0x3f19a5[_0x506d('0x24')]){delete _0x3f19a5[_0x506d('0x24')];}_0x2ff6ee[_0x506d('0x15')](_0x5d92d0)[_0x506d('0x25')](_0x3f19a5);};}exports[_0x506d('0x26')]=function(_0x435464,_0x592ea2){var _0xd63daf={},_0x340cfc={},_0x16c654={'count':0x0,'rows':[]};var _0x5234fd=_[_0x506d('0x27')](db['ZendeskConfiguration'][_0x506d('0x28')],function(_0x2c24e9){return{'name':_0x2c24e9[_0x506d('0x29')],'type':_0x2c24e9[_0x506d('0x2a')][_0x506d('0x2b')]};});_0x340cfc['model']=_['map'](_0x5234fd,_0x506d('0x24'));_0x340cfc[_0x506d('0x2c')]=_['keys'](_0x435464[_0x506d('0x2c')]);_0x340cfc[_0x506d('0x2d')]=_[_0x506d('0x2e')](_0x340cfc['model'],_0x340cfc[_0x506d('0x2c')]);_0xd63daf['attributes']=_[_0x506d('0x2e')](_0x340cfc[_0x506d('0x2f')],qs[_0x506d('0x30')](_0x435464[_0x506d('0x2c')][_0x506d('0x30')]));_0xd63daf[_0x506d('0x31')]=_0xd63daf[_0x506d('0x31')][_0x506d('0x32')]?_0xd63daf[_0x506d('0x31')]:_0x340cfc[_0x506d('0x2f')];if(!_0x435464['query'][_0x506d('0x33')](_0x506d('0x34'))){_0xd63daf[_0x506d('0x1a')]=qs[_0x506d('0x1a')](_0x435464[_0x506d('0x2c')][_0x506d('0x1a')]);_0xd63daf[_0x506d('0x18')]=qs['offset'](_0x435464['query'][_0x506d('0x18')]);}_0xd63daf['order']=qs[_0x506d('0x35')](_0x435464[_0x506d('0x2c')][_0x506d('0x35')]);_0xd63daf[_0x506d('0x36')]=qs[_0x506d('0x2d')](_[_0x506d('0x37')](_0x435464[_0x506d('0x2c')],_0x340cfc[_0x506d('0x2d')]),_0x5234fd);if(_0x435464[_0x506d('0x2c')][_0x506d('0x38')]){_0xd63daf['where']=_[_0x506d('0x39')](_0xd63daf[_0x506d('0x36')],{'$or':_[_0x506d('0x27')](_0x5234fd,function(_0x31e0bf){if(_0x31e0bf[_0x506d('0x2a')]!==_0x506d('0x3a')){var _0x5858c4={};_0x5858c4[_0x31e0bf['name']]={'$like':'%'+_0x435464[_0x506d('0x2c')]['filter']+'%'};return _0x5858c4;}})});}_0xd63daf=_[_0x506d('0x39')]({},_0xd63daf,_0x435464[_0x506d('0x3b')]);var _0x51102a={'where':_0xd63daf[_0x506d('0x36')]};return db[_0x506d('0x3c')][_0x506d('0x1b')](_0x51102a)[_0x506d('0x22')](function(_0x464bc1){_0x16c654[_0x506d('0x1b')]=_0x464bc1;if(_0x435464[_0x506d('0x2c')][_0x506d('0x3d')]){_0xd63daf['include']=[{'all':!![]}];}return db[_0x506d('0x3c')]['findAll'](_0xd63daf);})[_0x506d('0x22')](function(_0x5ebb59){_0x16c654['rows']=_0x5ebb59;return _0x16c654;})['then'](respondWithFilteredResult(_0x592ea2,_0xd63daf))[_0x506d('0x3e')](handleError(_0x592ea2,null));};exports[_0x506d('0x3f')]=function(_0x4aeaf6,_0x46ee4c){var _0x685179={'raw':![],'where':{'id':_0x4aeaf6[_0x506d('0x40')]['id']}},_0x400401={};_0x400401[_0x506d('0x2f')]=_[_0x506d('0x41')](db[_0x506d('0x3c')]['rawAttributes']);_0x400401['query']=_[_0x506d('0x41')](_0x4aeaf6['query']);_0x400401['filters']=_[_0x506d('0x2e')](_0x400401[_0x506d('0x2f')],_0x400401[_0x506d('0x2c')]);_0x685179['attributes']=_[_0x506d('0x2e')](_0x400401[_0x506d('0x2f')],qs['fields'](_0x4aeaf6[_0x506d('0x2c')][_0x506d('0x30')]));_0x685179[_0x506d('0x31')]=_0x685179[_0x506d('0x31')][_0x506d('0x32')]?_0x685179[_0x506d('0x31')]:_0x400401['model'];if(_0x4aeaf6[_0x506d('0x2c')][_0x506d('0x3d')]){_0x685179[_0x506d('0x42')]=[{'all':!![]}];}_0x685179=_[_0x506d('0x39')]({},_0x685179,_0x4aeaf6[_0x506d('0x3b')]);return db['ZendeskConfiguration'][_0x506d('0x43')](_0x685179)[_0x506d('0x22')](handleEntityNotFound(_0x46ee4c,null))[_0x506d('0x22')](respondWithResult(_0x46ee4c,null))['catch'](handleError(_0x46ee4c,null));};exports['create']=function(_0x274f46,_0x14eefa){return db[_0x506d('0x3c')][_0x506d('0x44')](_0x274f46[_0x506d('0x45')],{})[_0x506d('0x22')](respondWithResult(_0x14eefa,0xc9))[_0x506d('0x3e')](handleError(_0x14eefa,null));};exports[_0x506d('0x21')]=function(_0x23ba5b,_0xd5469b){if(_0x23ba5b[_0x506d('0x45')]['id']){delete _0x23ba5b[_0x506d('0x45')]['id'];}return db[_0x506d('0x3c')][_0x506d('0x43')]({'where':{'id':_0x23ba5b['params']['id']}})[_0x506d('0x22')](handleEntityNotFound(_0xd5469b,null))[_0x506d('0x22')](saveUpdates(_0x23ba5b[_0x506d('0x45')],null))[_0x506d('0x22')](respondWithResult(_0xd5469b,null))[_0x506d('0x3e')](handleError(_0xd5469b,null));};exports[_0x506d('0x23')]=function(_0x468c2f,_0x5a9065){return db[_0x506d('0x3c')][_0x506d('0x43')]({'where':{'id':_0x468c2f[_0x506d('0x40')]['id']}})['then'](handleEntityNotFound(_0x5a9065,null))[_0x506d('0x22')](removeEntity(_0x5a9065,null))[_0x506d('0x3e')](handleError(_0x5a9065,null));};exports[_0x506d('0x46')]=function(_0x48cedb,_0x51a051,_0x3e5971){var _0x2e4f96={};var _0x54767e={};var _0x2dd6ac;var _0x2b53ba;return db[_0x506d('0x3c')][_0x506d('0x47')]({'where':{'id':_0x48cedb[_0x506d('0x40')]['id']}})[_0x506d('0x22')](handleEntityNotFound(_0x51a051,null))[_0x506d('0x22')](function(_0x5bdae4){if(_0x5bdae4){_0x2dd6ac=_0x5bdae4;_0x54767e[_0x506d('0x2f')]=_[_0x506d('0x41')](db[_0x506d('0x48')]['rawAttributes']);_0x54767e[_0x506d('0x2c')]=_['keys'](_0x48cedb[_0x506d('0x2c')]);_0x54767e['filters']=_['intersection'](_0x54767e['model'],_0x54767e[_0x506d('0x2c')]);_0x2e4f96['attributes']=_[_0x506d('0x2e')](_0x54767e[_0x506d('0x2f')],qs[_0x506d('0x30')](_0x48cedb[_0x506d('0x2c')][_0x506d('0x30')]));_0x2e4f96[_0x506d('0x31')]=_0x2e4f96[_0x506d('0x31')][_0x506d('0x32')]?_0x2e4f96[_0x506d('0x31')]:_0x54767e['model'];_0x2e4f96[_0x506d('0x49')]=qs[_0x506d('0x35')](_0x48cedb[_0x506d('0x2c')]['sort']);_0x2e4f96[_0x506d('0x36')]=qs['filters'](_[_0x506d('0x37')](_0x48cedb['query'],_0x54767e[_0x506d('0x2d')]));if(_0x48cedb[_0x506d('0x2c')][_0x506d('0x38')]){_0x2e4f96[_0x506d('0x36')]=_[_0x506d('0x39')](_0x2e4f96[_0x506d('0x36')],{'$or':_['map'](_0x2e4f96[_0x506d('0x31')],function(_0x4a64e2){var _0x5f5b2b={};_0x5f5b2b[_0x4a64e2]={'$like':'%'+_0x48cedb[_0x506d('0x2c')]['filter']+'%'};return _0x5f5b2b;})});}_0x2e4f96=_[_0x506d('0x39')]({},_0x2e4f96,_0x48cedb['options']);return _0x2dd6ac['getFields'](_0x2e4f96);}})[_0x506d('0x22')](function(_0x4c7d3f){if(_0x4c7d3f){_0x2b53ba=_0x4c7d3f[_0x506d('0x32')];if(!_0x48cedb[_0x506d('0x2c')]['hasOwnProperty'](_0x506d('0x34'))){_0x2e4f96['limit']=qs[_0x506d('0x1a')](_0x48cedb[_0x506d('0x2c')][_0x506d('0x1a')]);_0x2e4f96[_0x506d('0x18')]=qs[_0x506d('0x18')](_0x48cedb['query'][_0x506d('0x18')]);}return _0x2dd6ac[_0x506d('0x46')](_0x2e4f96);}})[_0x506d('0x22')](function(_0x298ea6){if(_0x298ea6){return _0x298ea6?{'count':_0x2b53ba,'rows':_0x298ea6}:null;}})['then'](respondWithResult(_0x51a051,null))[_0x506d('0x3e')](handleError(_0x51a051,null));};exports['getSubjects']=function(_0x738ebf,_0x44dcec,_0x2e0183){var _0x31088c={};var _0x3db7cf={};var _0x3d05c5;var _0x3658b0;return db[_0x506d('0x3c')][_0x506d('0x47')]({'where':{'id':_0x738ebf[_0x506d('0x40')]['id']}})['then'](handleEntityNotFound(_0x44dcec,null))[_0x506d('0x22')](function(_0x13e841){if(_0x13e841){_0x3d05c5=_0x13e841;_0x3db7cf[_0x506d('0x2f')]=_[_0x506d('0x41')](db[_0x506d('0x48')][_0x506d('0x28')]);_0x3db7cf[_0x506d('0x2c')]=_[_0x506d('0x41')](_0x738ebf['query']);_0x3db7cf['filters']=_[_0x506d('0x2e')](_0x3db7cf[_0x506d('0x2f')],_0x3db7cf['query']);_0x31088c[_0x506d('0x31')]=_['intersection'](_0x3db7cf['model'],qs[_0x506d('0x30')](_0x738ebf[_0x506d('0x2c')]['fields']));_0x31088c[_0x506d('0x31')]=_0x31088c[_0x506d('0x31')][_0x506d('0x32')]?_0x31088c[_0x506d('0x31')]:_0x3db7cf[_0x506d('0x2f')];_0x31088c[_0x506d('0x49')]=qs[_0x506d('0x35')](_0x738ebf['query'][_0x506d('0x35')]);_0x31088c['where']=qs['filters'](_[_0x506d('0x37')](_0x738ebf['query'],_0x3db7cf[_0x506d('0x2d')]));if(_0x738ebf['query'][_0x506d('0x38')]){_0x31088c[_0x506d('0x36')]=_[_0x506d('0x39')](_0x31088c[_0x506d('0x36')],{'$or':_[_0x506d('0x27')](_0x31088c[_0x506d('0x31')],function(_0x2f2d39){var _0x2bd9d6={};_0x2bd9d6[_0x2f2d39]={'$like':'%'+_0x738ebf[_0x506d('0x2c')]['filter']+'%'};return _0x2bd9d6;})});}_0x31088c=_[_0x506d('0x39')]({},_0x31088c,_0x738ebf['options']);return _0x3d05c5[_0x506d('0x4a')](_0x31088c);}})[_0x506d('0x22')](function(_0x5bd2b6){if(_0x5bd2b6){_0x3658b0=_0x5bd2b6[_0x506d('0x32')];if(!_0x738ebf[_0x506d('0x2c')]['hasOwnProperty'](_0x506d('0x34'))){_0x31088c[_0x506d('0x1a')]=qs[_0x506d('0x1a')](_0x738ebf[_0x506d('0x2c')][_0x506d('0x1a')]);_0x31088c[_0x506d('0x18')]=qs[_0x506d('0x18')](_0x738ebf[_0x506d('0x2c')][_0x506d('0x18')]);}return _0x3d05c5[_0x506d('0x4a')](_0x31088c);}})[_0x506d('0x22')](function(_0x2e4df5){if(_0x2e4df5){return _0x2e4df5?{'count':_0x3658b0,'rows':_0x2e4df5}:null;}})[_0x506d('0x22')](respondWithResult(_0x44dcec,null))[_0x506d('0x3e')](handleError(_0x44dcec,null));};exports['getDescriptions']=function(_0x370931,_0x157755,_0x2eb21d){var _0xe2e181={};var _0x19ea7a={};var _0x166fc5;var _0x48afc9;return db[_0x506d('0x3c')][_0x506d('0x47')]({'where':{'id':_0x370931['params']['id']}})['then'](handleEntityNotFound(_0x157755,null))[_0x506d('0x22')](function(_0x3ee3a7){if(_0x3ee3a7){_0x166fc5=_0x3ee3a7;_0x19ea7a['model']=_[_0x506d('0x41')](db['ZendeskField'][_0x506d('0x28')]);_0x19ea7a[_0x506d('0x2c')]=_[_0x506d('0x41')](_0x370931[_0x506d('0x2c')]);_0x19ea7a['filters']=_[_0x506d('0x2e')](_0x19ea7a[_0x506d('0x2f')],_0x19ea7a[_0x506d('0x2c')]);_0xe2e181['attributes']=_['intersection'](_0x19ea7a['model'],qs[_0x506d('0x30')](_0x370931[_0x506d('0x2c')][_0x506d('0x30')]));_0xe2e181['attributes']=_0xe2e181[_0x506d('0x31')][_0x506d('0x32')]?_0xe2e181['attributes']:_0x19ea7a[_0x506d('0x2f')];_0xe2e181['order']=qs[_0x506d('0x35')](_0x370931[_0x506d('0x2c')][_0x506d('0x35')]);_0xe2e181['where']=qs[_0x506d('0x2d')](_[_0x506d('0x37')](_0x370931[_0x506d('0x2c')],_0x19ea7a['filters']));if(_0x370931['query']['filter']){_0xe2e181['where']=_['merge'](_0xe2e181[_0x506d('0x36')],{'$or':_[_0x506d('0x27')](_0xe2e181['attributes'],function(_0xc4829f){var _0x3354e3={};_0x3354e3[_0xc4829f]={'$like':'%'+_0x370931[_0x506d('0x2c')][_0x506d('0x38')]+'%'};return _0x3354e3;})});}_0xe2e181=_['merge']({},_0xe2e181,_0x370931[_0x506d('0x3b')]);return _0x166fc5['getDescriptions'](_0xe2e181);}})['then'](function(_0x1dcb50){if(_0x1dcb50){_0x48afc9=_0x1dcb50[_0x506d('0x32')];if(!_0x370931['query']['hasOwnProperty']('nolimit')){_0xe2e181[_0x506d('0x1a')]=qs['limit'](_0x370931[_0x506d('0x2c')][_0x506d('0x1a')]);_0xe2e181[_0x506d('0x18')]=qs['offset'](_0x370931['query'][_0x506d('0x18')]);}return _0x166fc5[_0x506d('0x4b')](_0xe2e181);}})[_0x506d('0x22')](function(_0x37ed96){if(_0x37ed96){return _0x37ed96?{'count':_0x48afc9,'rows':_0x37ed96}:null;}})['then'](respondWithResult(_0x157755,null))[_0x506d('0x3e')](handleError(_0x157755,null));};exports[_0x506d('0x4c')]=function(_0xf87277,_0x1531f5,_0x23b729){var _0x427bdf={};var _0xe03bde={};var _0x447f28;var _0xd07b3e;return db[_0x506d('0x3c')][_0x506d('0x47')]({'where':{'id':_0xf87277[_0x506d('0x40')]['id']}})['then'](handleEntityNotFound(_0x1531f5,null))[_0x506d('0x22')](function(_0x582714){if(_0x582714){_0x447f28=_0x582714;_0xe03bde[_0x506d('0x2f')]=_[_0x506d('0x41')](db[_0x506d('0x4d')]['rawAttributes']);_0xe03bde[_0x506d('0x2c')]=_['keys'](_0xf87277[_0x506d('0x2c')]);_0xe03bde[_0x506d('0x2d')]=_[_0x506d('0x2e')](_0xe03bde[_0x506d('0x2f')],_0xe03bde[_0x506d('0x2c')]);_0x427bdf[_0x506d('0x31')]=_['intersection'](_0xe03bde[_0x506d('0x2f')],qs[_0x506d('0x30')](_0xf87277[_0x506d('0x2c')]['fields']));_0x427bdf['attributes']=_0x427bdf[_0x506d('0x31')][_0x506d('0x32')]?_0x427bdf[_0x506d('0x31')]:_0xe03bde[_0x506d('0x2f')];_0x427bdf[_0x506d('0x49')]=qs[_0x506d('0x35')](_0xf87277['query'][_0x506d('0x35')]);_0x427bdf[_0x506d('0x36')]=qs[_0x506d('0x2d')](_[_0x506d('0x37')](_0xf87277['query'],_0xe03bde[_0x506d('0x2d')]));if(_0xf87277[_0x506d('0x2c')][_0x506d('0x38')]){_0x427bdf[_0x506d('0x36')]=_[_0x506d('0x39')](_0x427bdf['where'],{'$or':_[_0x506d('0x27')](_0x427bdf['attributes'],function(_0xe604b6){var _0x535ff2={};_0x535ff2[_0xe604b6]={'$like':'%'+_0xf87277[_0x506d('0x2c')]['filter']+'%'};return _0x535ff2;})});}_0x427bdf=_['merge']({},_0x427bdf,_0xf87277[_0x506d('0x3b')]);return _0x447f28[_0x506d('0x4c')](_0x427bdf);}})[_0x506d('0x22')](function(_0x21121d){if(_0x21121d){_0xd07b3e=_0x21121d['length'];if(!_0xf87277[_0x506d('0x2c')][_0x506d('0x33')](_0x506d('0x34'))){_0x427bdf[_0x506d('0x1a')]=qs[_0x506d('0x1a')](_0xf87277['query'][_0x506d('0x1a')]);_0x427bdf[_0x506d('0x18')]=qs['offset'](_0xf87277[_0x506d('0x2c')][_0x506d('0x18')]);}return _0x447f28[_0x506d('0x4c')](_0x427bdf);}})['then'](function(_0x587b07){if(_0x587b07){return _0x587b07?{'count':_0xd07b3e,'rows':_0x587b07}:null;}})[_0x506d('0x22')](respondWithResult(_0x1531f5,null))[_0x506d('0x3e')](handleError(_0x1531f5,null));};exports[_0x506d('0x4e')]=function(_0x17ce88,_0x3911dd,_0x2f2919){if(_0x17ce88['body']['id']){delete _0x17ce88[_0x506d('0x45')]['id'];}return db[_0x506d('0x3c')]['findOne']({'where':{'id':_0x17ce88[_0x506d('0x40')]['id']}})['then'](handleEntityNotFound(_0x3911dd,null))[_0x506d('0x22')](function(_0xe9fad7){if(_0xe9fad7){return _0xe9fad7['setTags'](_0x17ce88['body'][_0x506d('0x4f')]||[]);}return null;})[_0x506d('0x22')](respondWithResult(_0x3911dd,null))[_0x506d('0x3e')](handleError(_0x3911dd,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 530237e..1267615 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 _0xbbbc=['request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x233810,_0xda56c7){_0x233810=_0x233810-0x0;var _0x4a58d1=_0xbbbc[_0x233810];return _0x4a58d1;};'use strict';var _=require(_0xcbbb('0x0'));var util=require(_0xcbbb('0x1'));var logger=require(_0xcbbb('0x2'))(_0xcbbb('0x3'));var moment=require(_0xcbbb('0x4'));var BPromise=require(_0xcbbb('0x5'));var rp=require(_0xcbbb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcbbb('0x7'));var config=require(_0xcbbb('0x8'));var attributes=require(_0xcbbb('0x9'));module[_0xcbbb('0xa')]=function(_0x43ff05,_0x4978a9){return _0x43ff05[_0xcbbb('0xb')](_0xcbbb('0xc'),attributes,{'tableName':_0xcbbb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b0e=['path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x4eb70e,_0x4db517){var _0x4662f0=function(_0x3261c3){while(--_0x3261c3){_0x4eb70e['push'](_0x4eb70e['shift']());}};_0x4662f0(++_0x4db517);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2b4448,_0x5bcc69){_0x2b4448=_0x2b4448-0x0;var _0xb4b465=_0x0b0e[_0x2b4448];return _0xb4b465;};'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')]('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 83f2ef9..ab38657 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 _0x30c6=['error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','stringify'];(function(_0xa3d957,_0x5cefc3){var _0x1f2f67=function(_0x53424c){while(--_0x53424c){_0xa3d957['push'](_0xa3d957['shift']());}};_0x1f2f67(++_0x5cefc3);}(_0x30c6,0x17b));var _0x630c=function(_0x47d6d2,_0x6b4efe){_0x47d6d2=_0x47d6d2-0x0;var _0x2535fa=_0x30c6[_0x47d6d2];return _0x2535fa;};'use strict';var _=require(_0x630c('0x0'));var util=require(_0x630c('0x1'));var moment=require(_0x630c('0x2'));var BPromise=require(_0x630c('0x3'));var rs=require(_0x630c('0x4'));var fs=require('fs');var Redis=require(_0x630c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x630c('0x6'));var logger=require(_0x630c('0x7'))(_0x630c('0x8'));var config=require(_0x630c('0x9'));var jayson=require(_0x630c('0xa'));var client=jayson[_0x630c('0xb')][_0x630c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x49c593,_0x46dfe9,_0x1f9e0b){return new BPromise(function(_0x1cac4f,_0x3bc62b){return client[_0x630c('0xd')](_0x49c593,_0x1f9e0b)['then'](function(_0xd67d03){logger[_0x630c('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x46dfe9,_0x630c('0xf'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x46dfe9,'request\x20sent',JSON[_0x630c('0x10')](_0xd67d03));if(_0xd67d03[_0x630c('0x11')]){if(_0xd67d03['error'][_0x630c('0x12')]===0x1f4){logger[_0x630c('0x11')](_0x630c('0x13'),_0x46dfe9,_0xd67d03[_0x630c('0x11')][_0x630c('0x14')]);return _0x3bc62b(_0xd67d03[_0x630c('0x11')]['message']);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x46dfe9,_0xd67d03[_0x630c('0x11')]['message']);return _0x1cac4f(_0xd67d03['error'][_0x630c('0x14')]);}else{logger[_0x630c('0xe')](_0x630c('0x13'),_0x46dfe9,'request\x20sent');_0x1cac4f(_0xd67d03[_0x630c('0x15')]['message']);}})['catch'](function(_0x3c69a0){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x46dfe9,_0x3c69a0);_0x3bc62b(_0x3c69a0);});});} \ No newline at end of file +var _0xa299=['debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x77538f,_0x3a6649){var _0x27c63f=function(_0x2176f6){while(--_0x2176f6){_0x77538f['push'](_0x77538f['shift']());}};_0x27c63f(++_0x3a6649);}(_0xa299,0xe3));var _0x9a29=function(_0x3cdcd1,_0x30c965){_0x3cdcd1=_0x3cdcd1-0x0;var _0x5ef8bb=_0xa299[_0x3cdcd1];return _0x5ef8bb;};'use strict';var _=require(_0x9a29('0x0'));var util=require(_0x9a29('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9a29('0x2'));var fs=require('fs');var Redis=require(_0x9a29('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9a29('0x4'));var logger=require(_0x9a29('0x5'))(_0x9a29('0x6'));var config=require('../../config/environment');var jayson=require(_0x9a29('0x7'));var client=jayson[_0x9a29('0x8')][_0x9a29('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ef3ba,_0x183775,_0x58954f){return new BPromise(function(_0x34f2e6,_0x291afa){return client[_0x9a29('0xa')](_0x3ef3ba,_0x58954f)[_0x9a29('0xb')](function(_0x2186e9){logger[_0x9a29('0xc')](_0x9a29('0xd'),_0x183775,_0x9a29('0xe'));logger[_0x9a29('0xf')](_0x9a29('0x10'),_0x183775,'request\x20sent',JSON[_0x9a29('0x11')](_0x2186e9));if(_0x2186e9[_0x9a29('0x12')]){if(_0x2186e9[_0x9a29('0x12')]['code']===0x1f4){logger[_0x9a29('0x12')](_0x9a29('0xd'),_0x183775,_0x2186e9['error']['message']);return _0x291afa(_0x2186e9[_0x9a29('0x12')][_0x9a29('0x13')]);}logger[_0x9a29('0x12')](_0x9a29('0xd'),_0x183775,_0x2186e9[_0x9a29('0x12')][_0x9a29('0x13')]);return _0x34f2e6(_0x2186e9[_0x9a29('0x12')][_0x9a29('0x13')]);}else{logger[_0x9a29('0xc')](_0x9a29('0xd'),_0x183775,_0x9a29('0xe'));_0x34f2e6(_0x2186e9[_0x9a29('0x14')][_0x9a29('0x13')]);}})[_0x9a29('0x15')](function(_0x2a941e){logger[_0x9a29('0x12')](_0x9a29('0xd'),_0x183775,_0x2a941e);_0x291afa(_0x2a941e);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 980ef52..06d6f2a 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 _0xdee6=['destroy','exports','multer','util','path','connect-timeout','express','Router','./intZendeskField.controller','isAuthenticated','index','get','/:id','show','create','update'];(function(_0x3358ba,_0x24c5fc){var _0x296e73=function(_0x843ff3){while(--_0x843ff3){_0x3358ba['push'](_0x3358ba['shift']());}};_0x296e73(++_0x24c5fc);}(_0xdee6,0x92));var _0x6dee=function(_0x85b608,_0x2fa2b4){_0x85b608=_0x85b608-0x0;var _0x42a190=_0xdee6[_0x85b608];return _0x42a190;};'use strict';var multer=require(_0x6dee('0x0'));var util=require(_0x6dee('0x1'));var path=require(_0x6dee('0x2'));var timeout=require(_0x6dee('0x3'));var express=require(_0x6dee('0x4'));var router=express[_0x6dee('0x5')]();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(_0x6dee('0x6'));router['get']('/',auth[_0x6dee('0x7')](),controller[_0x6dee('0x8')]);router[_0x6dee('0x9')](_0x6dee('0xa'),auth['isAuthenticated'](),controller[_0x6dee('0xb')]);router['post']('/',auth[_0x6dee('0x7')](),controller[_0x6dee('0xc')]);router['put']('/:id',auth[_0x6dee('0x7')](),controller[_0x6dee('0xd')]);router['delete']('/:id',auth[_0x6dee('0x7')](),controller[_0x6dee('0xe')]);module[_0x6dee('0xf')]=router; \ No newline at end of file +var _0x09c9=['index','isAuthenticated','show','post','put','/:id','update','exports','util','express','../../components/interaction/service','get'];(function(_0x542b5c,_0x53f81a){var _0x4ffc81=function(_0xe584ec){while(--_0xe584ec){_0x542b5c['push'](_0x542b5c['shift']());}};_0x4ffc81(++_0x53f81a);}(_0x09c9,0xbc));var _0x909c=function(_0x2670b8,_0x3444f8){_0x2670b8=_0x2670b8-0x0;var _0x3581fd=_0x09c9[_0x2670b8];return _0x3581fd;};'use strict';var multer=require('multer');var util=require(_0x909c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x909c('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x909c('0x2'));var config=require('../../config/environment');var controller=require('./intZendeskField.controller');router[_0x909c('0x3')]('/',auth['isAuthenticated'](),controller[_0x909c('0x4')]);router[_0x909c('0x3')]('/:id',auth[_0x909c('0x5')](),controller[_0x909c('0x6')]);router[_0x909c('0x7')]('/',auth[_0x909c('0x5')](),controller['create']);router[_0x909c('0x8')](_0x909c('0x9'),auth[_0x909c('0x5')](),controller[_0x909c('0xa')]);router['delete'](_0x909c('0x9'),auth[_0x909c('0x5')](),controller['destroy']);module[_0x909c('0xb')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 22ae854..6107f59 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 _0x1c55=['customVariable','BOOLEAN','exports','ENUM','variable','keyValue','picklist','string','STRING'];(function(_0x4e5552,_0x19ec4e){var _0x60a338=function(_0x40c70e){while(--_0x40c70e){_0x4e5552['push'](_0x4e5552['shift']());}};_0x60a338(++_0x19ec4e);}(_0x1c55,0x1a0));var _0x51c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c55[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x51c5('0x0')]={'type':{'type':Sequelize[_0x51c5('0x1')]('string',_0x51c5('0x2'),'customVariable',_0x51c5('0x3'),_0x51c5('0x4')),'defaultValue':_0x51c5('0x5')},'content':{'type':Sequelize[_0x51c5('0x6')]},'key':{'type':Sequelize[_0x51c5('0x6')]},'keyType':{'type':Sequelize[_0x51c5('0x1')](_0x51c5('0x5'),_0x51c5('0x2'),_0x51c5('0x7'))},'keyContent':{'type':Sequelize[_0x51c5('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x51c5('0x6')]},'customField':{'type':Sequelize[_0x51c5('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x51c5('0x6')]}}; \ No newline at end of file +var _0x479a=['ENUM','string','keyValue','picklist','STRING','variable','customVariable','BOOLEAN','sequelize','exports'];(function(_0x5d72c8,_0x85e2e1){var _0x3abc9e=function(_0x1311b){while(--_0x1311b){_0x5d72c8['push'](_0x5d72c8['shift']());}};_0x3abc9e(++_0x85e2e1);}(_0x479a,0x120));var _0xa479=function(_0x3a3147,_0x5a79e5){_0x3a3147=_0x3a3147-0x0;var _0x486138=_0x479a[_0x3a3147];return _0x486138;};'use strict';var Sequelize=require(_0xa479('0x0'));module[_0xa479('0x1')]={'type':{'type':Sequelize[_0xa479('0x2')](_0xa479('0x3'),'variable','customVariable',_0xa479('0x4'),_0xa479('0x5')),'defaultValue':_0xa479('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa479('0x6')]},'keyType':{'type':Sequelize[_0xa479('0x2')](_0xa479('0x3'),_0xa479('0x7'),_0xa479('0x8'))},'keyContent':{'type':Sequelize[_0xa479('0x6')]},'idField':{'type':Sequelize[_0xa479('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xa479('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index cf0ed21..ed1a971 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 _0x9726=['update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','count','include','ZendeskField','findAll','rows','show','params','includeAll','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','set','json','reject','save'];(function(_0x4358f5,_0x5b1ac6){var _0x4d8104=function(_0x1d4aee){while(--_0x1d4aee){_0x4358f5['push'](_0x4358f5['shift']());}};_0x4d8104(++_0x5b1ac6);}(_0x9726,0xbe));var _0x6972=function(_0x5f348d,_0x3cc857){_0x5f348d=_0x5f348d-0x0;var _0x26d087=_0x9726[_0x5f348d];return _0x26d087;};'use strict';var emlformat=require(_0x6972('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6972('0x1'));var jsonpatch=require(_0x6972('0x2'));var rp=require(_0x6972('0x3'));var moment=require(_0x6972('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6972('0x5'));var util=require(_0x6972('0x6'));var path=require('path');var sox=require(_0x6972('0x7'));var csv=require(_0x6972('0x8'));var ejs=require(_0x6972('0x9'));var fs=require('fs');var fs_extra=require(_0x6972('0xa'));var _=require(_0x6972('0xb'));var squel=require('squel');var crypto=require(_0x6972('0xc'));var jsforce=require(_0x6972('0xd'));var deskjs=require(_0x6972('0xe'));var toCsv=require(_0x6972('0x8'));var querystring=require(_0x6972('0xf'));var Papa=require(_0x6972('0x10'));var Redis=require(_0x6972('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6972('0x12'));var as=require(_0x6972('0x13'));var hardwareService=require(_0x6972('0x14'));var logger=require(_0x6972('0x15'))(_0x6972('0x16'));var utils=require('../../config/utils');var config=require(_0x6972('0x17'));var licenseUtil=require(_0x6972('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b3be0,_0x2e1740){_0x2e1740=_0x2e1740||0xcc;return function(_0x5be7f8){if(_0x5be7f8){return _0x1b3be0[_0x6972('0x19')](_0x2e1740);}return _0x1b3be0['status'](_0x2e1740)[_0x6972('0x1a')]();};}function respondWithResult(_0x1353ca,_0x1d09f1){_0x1d09f1=_0x1d09f1||0xc8;return function(_0x5950e6){if(_0x5950e6){return _0x1353ca[_0x6972('0x1b')](_0x1d09f1)['json'](_0x5950e6);}};}function respondWithFilteredResult(_0x1ee51e,_0x90332e){return function(_0x478101){if(_0x478101){var _0x27da0f=typeof _0x90332e[_0x6972('0x1c')]===_0x6972('0x1d')&&typeof _0x90332e['limit']===_0x6972('0x1d');var _0x3cb84f=_0x478101['count'];var _0x2b359f=_0x27da0f?0x0:_0x90332e[_0x6972('0x1c')];var _0x1cea75=_0x27da0f?_0x478101['count']:_0x90332e[_0x6972('0x1c')]+_0x90332e[_0x6972('0x1e')];var _0x5a5204;if(_0x1cea75>=_0x3cb84f){_0x1cea75=_0x3cb84f;_0x5a5204=0xc8;}else{_0x5a5204=0xce;}_0x1ee51e[_0x6972('0x1b')](_0x5a5204);return _0x1ee51e[_0x6972('0x1f')]('Content-Range',_0x2b359f+'-'+_0x1cea75+'/'+_0x3cb84f)[_0x6972('0x20')](_0x478101);}return null;};}function patchUpdates(_0x3fabe4){return function(_0x1347c5){try{jsonpatch['apply'](_0x1347c5,_0x3fabe4,!![]);}catch(_0x5c4693){return BPromise[_0x6972('0x21')](_0x5c4693);}return _0x1347c5[_0x6972('0x22')]();};}function saveUpdates(_0x45e631,_0x53a214){return function(_0x2e6120){if(_0x2e6120){return _0x2e6120[_0x6972('0x23')](_0x45e631)[_0x6972('0x24')](function(_0x6c07b5){return _0x6c07b5;});}return null;};}function removeEntity(_0x1498d6,_0x9c92ba){return function(_0x1c09c0){if(_0x1c09c0){return _0x1c09c0[_0x6972('0x25')]()['then'](function(){_0x1498d6[_0x6972('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31bb70,_0x1b31b3){return function(_0x3f042d){if(!_0x3f042d){_0x31bb70[_0x6972('0x19')](0x194);}return _0x3f042d;};}function handleError(_0x25bad9,_0x857b07){_0x857b07=_0x857b07||0x1f4;return function(_0x261a6f){logger[_0x6972('0x26')](_0x261a6f[_0x6972('0x27')]);if(_0x261a6f['name']){delete _0x261a6f[_0x6972('0x28')];}_0x25bad9[_0x6972('0x1b')](_0x857b07)['send'](_0x261a6f);};}exports[_0x6972('0x29')]=function(_0x2276bf,_0x198aa1){var _0x380ae5={},_0x40261b={},_0x247a38={'count':0x0,'rows':[]};var _0x415f13=_[_0x6972('0x2a')](db['ZendeskField'][_0x6972('0x2b')],function(_0x43150b){return{'name':_0x43150b[_0x6972('0x2c')],'type':_0x43150b[_0x6972('0x2d')][_0x6972('0x2e')]};});_0x40261b[_0x6972('0x2f')]=_['map'](_0x415f13,'name');_0x40261b[_0x6972('0x30')]=_[_0x6972('0x31')](_0x2276bf[_0x6972('0x30')]);_0x40261b[_0x6972('0x32')]=_[_0x6972('0x33')](_0x40261b['model'],_0x40261b[_0x6972('0x30')]);_0x380ae5[_0x6972('0x34')]=_[_0x6972('0x33')](_0x40261b[_0x6972('0x2f')],qs[_0x6972('0x35')](_0x2276bf[_0x6972('0x30')]['fields']));_0x380ae5['attributes']=_0x380ae5[_0x6972('0x34')][_0x6972('0x36')]?_0x380ae5[_0x6972('0x34')]:_0x40261b[_0x6972('0x2f')];if(!_0x2276bf[_0x6972('0x30')]['hasOwnProperty'](_0x6972('0x37'))){_0x380ae5['limit']=qs[_0x6972('0x1e')](_0x2276bf[_0x6972('0x30')][_0x6972('0x1e')]);_0x380ae5[_0x6972('0x1c')]=qs[_0x6972('0x1c')](_0x2276bf[_0x6972('0x30')][_0x6972('0x1c')]);}_0x380ae5['order']=qs[_0x6972('0x38')](_0x2276bf[_0x6972('0x30')][_0x6972('0x38')]);_0x380ae5['where']=qs[_0x6972('0x32')](_[_0x6972('0x39')](_0x2276bf[_0x6972('0x30')],_0x40261b[_0x6972('0x32')]),_0x415f13);if(_0x2276bf['query']['filter']){_0x380ae5[_0x6972('0x3a')]=_[_0x6972('0x3b')](_0x380ae5[_0x6972('0x3a')],{'$or':_['map'](_0x415f13,function(_0x47c7f5){if(_0x47c7f5[_0x6972('0x2d')]!==_0x6972('0x3c')){var _0x39546c={};_0x39546c[_0x47c7f5[_0x6972('0x28')]]={'$like':'%'+_0x2276bf[_0x6972('0x30')][_0x6972('0x3d')]+'%'};return _0x39546c;}})});}_0x380ae5=_[_0x6972('0x3b')]({},_0x380ae5,_0x2276bf[_0x6972('0x3e')]);var _0x35b3ce={'where':_0x380ae5['where']};return db['ZendeskField'][_0x6972('0x3f')](_0x35b3ce)['then'](function(_0x2ac5b3){_0x247a38['count']=_0x2ac5b3;if(_0x2276bf[_0x6972('0x30')]['includeAll']){_0x380ae5[_0x6972('0x40')]=[{'all':!![]}];}return db[_0x6972('0x41')][_0x6972('0x42')](_0x380ae5);})[_0x6972('0x24')](function(_0x35bf89){_0x247a38[_0x6972('0x43')]=_0x35bf89;return _0x247a38;})['then'](respondWithFilteredResult(_0x198aa1,_0x380ae5))['catch'](handleError(_0x198aa1,null));};exports[_0x6972('0x44')]=function(_0x278d27,_0x128ab3){var _0x39d0a1={'raw':!![],'where':{'id':_0x278d27[_0x6972('0x45')]['id']}},_0x1e37cd={};_0x1e37cd['model']=_[_0x6972('0x31')](db[_0x6972('0x41')][_0x6972('0x2b')]);_0x1e37cd[_0x6972('0x30')]=_[_0x6972('0x31')](_0x278d27['query']);_0x1e37cd[_0x6972('0x32')]=_[_0x6972('0x33')](_0x1e37cd[_0x6972('0x2f')],_0x1e37cd[_0x6972('0x30')]);_0x39d0a1[_0x6972('0x34')]=_[_0x6972('0x33')](_0x1e37cd[_0x6972('0x2f')],qs['fields'](_0x278d27['query'][_0x6972('0x35')]));_0x39d0a1['attributes']=_0x39d0a1[_0x6972('0x34')][_0x6972('0x36')]?_0x39d0a1['attributes']:_0x1e37cd['model'];if(_0x278d27[_0x6972('0x30')][_0x6972('0x46')]){_0x39d0a1['include']=[{'all':!![]}];}_0x39d0a1=_[_0x6972('0x3b')]({},_0x39d0a1,_0x278d27[_0x6972('0x3e')]);return db[_0x6972('0x41')][_0x6972('0x47')](_0x39d0a1)[_0x6972('0x24')](handleEntityNotFound(_0x128ab3,null))[_0x6972('0x24')](respondWithResult(_0x128ab3,null))[_0x6972('0x48')](handleError(_0x128ab3,null));};exports[_0x6972('0x49')]=function(_0x110e43,_0x5bd077){return db[_0x6972('0x41')][_0x6972('0x49')](_0x110e43[_0x6972('0x4a')],{})['then'](respondWithResult(_0x5bd077,0xc9))[_0x6972('0x48')](handleError(_0x5bd077,null));};exports[_0x6972('0x23')]=function(_0x382d2e,_0x420ccd){if(_0x382d2e[_0x6972('0x4a')]['id']){delete _0x382d2e[_0x6972('0x4a')]['id'];}return db[_0x6972('0x41')][_0x6972('0x47')]({'where':{'id':_0x382d2e[_0x6972('0x45')]['id']}})[_0x6972('0x24')](handleEntityNotFound(_0x420ccd,null))['then'](saveUpdates(_0x382d2e['body'],null))['then'](respondWithResult(_0x420ccd,null))[_0x6972('0x48')](handleError(_0x420ccd,null));};exports[_0x6972('0x25')]=function(_0x3371bb,_0x490004){return db[_0x6972('0x41')][_0x6972('0x47')]({'where':{'id':_0x3371bb[_0x6972('0x45')]['id']}})[_0x6972('0x24')](handleEntityNotFound(_0x490004,null))['then'](removeEntity(_0x490004,null))['catch'](handleError(_0x490004,null));}; \ No newline at end of file +var _0x7a72=['where','pick','VIRTUAL','filter','merge','options','ZendeskField','includeAll','findAll','rows','catch','show','params','keys','intersection','fields','include','create','update','body','rimraf','zip-dir','request-promise','bluebird','util','sox','ejs','fs-extra','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','filters','model','attributes','nolimit','limit','order','sort'];(function(_0xae9bf0,_0x5e763a){var _0x3013bb=function(_0x5726e4){while(--_0x5726e4){_0xae9bf0['push'](_0xae9bf0['shift']());}};_0x3013bb(++_0x5e763a);}(_0x7a72,0x1be));var _0x27a7=function(_0xbe0297,_0xb42e40){_0xbe0297=_0xbe0297-0x0;var _0x252ee1=_0x7a72[_0xbe0297];return _0x252ee1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x27a7('0x0'));var zipdir=require(_0x27a7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x27a7('0x2'));var moment=require('moment');var BPromise=require(_0x27a7('0x3'));var Mustache=require('mustache');var util=require(_0x27a7('0x4'));var path=require('path');var sox=require(_0x27a7('0x5'));var csv=require('to-csv');var ejs=require(_0x27a7('0x6'));var fs=require('fs');var fs_extra=require(_0x27a7('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x27a7('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x27a7('0x9'));var toCsv=require(_0x27a7('0xa'));var querystring=require(_0x27a7('0xb'));var Papa=require(_0x27a7('0xc'));var Redis=require('ioredis');var authService=require(_0x27a7('0xd'));var qs=require(_0x27a7('0xe'));var as=require(_0x27a7('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x27a7('0x10'))(_0x27a7('0x11'));var utils=require('../../config/utils');var config=require(_0x27a7('0x12'));var licenseUtil=require(_0x27a7('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22a0d0,_0x36343f){_0x36343f=_0x36343f||0xcc;return function(_0x10c24a){if(_0x10c24a){return _0x22a0d0[_0x27a7('0x14')](_0x36343f);}return _0x22a0d0[_0x27a7('0x15')](_0x36343f)[_0x27a7('0x16')]();};}function respondWithResult(_0x4948ec,_0x4d3bfb){_0x4d3bfb=_0x4d3bfb||0xc8;return function(_0x33881a){if(_0x33881a){return _0x4948ec['status'](_0x4d3bfb)[_0x27a7('0x17')](_0x33881a);}};}function respondWithFilteredResult(_0x560929,_0x1b2c5a){return function(_0x455bbe){if(_0x455bbe){var _0xcd9791=typeof _0x1b2c5a[_0x27a7('0x18')]==='undefined'&&typeof _0x1b2c5a['limit']===_0x27a7('0x19');var _0x432080=_0x455bbe['count'];var _0x41074f=_0xcd9791?0x0:_0x1b2c5a[_0x27a7('0x18')];var _0xaf0c9e=_0xcd9791?_0x455bbe[_0x27a7('0x1a')]:_0x1b2c5a[_0x27a7('0x18')]+_0x1b2c5a['limit'];var _0x113e8a;if(_0xaf0c9e>=_0x432080){_0xaf0c9e=_0x432080;_0x113e8a=0xc8;}else{_0x113e8a=0xce;}_0x560929['status'](_0x113e8a);return _0x560929[_0x27a7('0x1b')](_0x27a7('0x1c'),_0x41074f+'-'+_0xaf0c9e+'/'+_0x432080)['json'](_0x455bbe);}return null;};}function patchUpdates(_0x32c6c6){return function(_0x4a1077){try{jsonpatch[_0x27a7('0x1d')](_0x4a1077,_0x32c6c6,!![]);}catch(_0x5d5031){return BPromise[_0x27a7('0x1e')](_0x5d5031);}return _0x4a1077[_0x27a7('0x1f')]();};}function saveUpdates(_0x1ce3f6,_0x1a00c4){return function(_0x47b93c){if(_0x47b93c){return _0x47b93c['update'](_0x1ce3f6)[_0x27a7('0x20')](function(_0xde9e67){return _0xde9e67;});}return null;};}function removeEntity(_0x32cb91,_0x5bf3d7){return function(_0x2540e5){if(_0x2540e5){return _0x2540e5[_0x27a7('0x21')]()[_0x27a7('0x20')](function(){_0x32cb91[_0x27a7('0x15')](0xcc)[_0x27a7('0x16')]();});}};}function handleEntityNotFound(_0x1b5128,_0x39781f){return function(_0x2c77ae){if(!_0x2c77ae){_0x1b5128[_0x27a7('0x14')](0x194);}return _0x2c77ae;};}function handleError(_0x33cda5,_0x1f2a7f){_0x1f2a7f=_0x1f2a7f||0x1f4;return function(_0x517b8f){logger[_0x27a7('0x22')](_0x517b8f[_0x27a7('0x23')]);if(_0x517b8f[_0x27a7('0x24')]){delete _0x517b8f[_0x27a7('0x24')];}_0x33cda5[_0x27a7('0x15')](_0x1f2a7f)[_0x27a7('0x25')](_0x517b8f);};}exports[_0x27a7('0x26')]=function(_0x36e669,_0x7fafc2){var _0x11b0fb={},_0x3b8471={},_0x4a61a7={'count':0x0,'rows':[]};var _0x81e614=_[_0x27a7('0x27')](db['ZendeskField'][_0x27a7('0x28')],function(_0x4dee69){return{'name':_0x4dee69[_0x27a7('0x29')],'type':_0x4dee69[_0x27a7('0x2a')]['key']};});_0x3b8471['model']=_[_0x27a7('0x27')](_0x81e614,_0x27a7('0x24'));_0x3b8471[_0x27a7('0x2b')]=_['keys'](_0x36e669[_0x27a7('0x2b')]);_0x3b8471[_0x27a7('0x2c')]=_['intersection'](_0x3b8471[_0x27a7('0x2d')],_0x3b8471[_0x27a7('0x2b')]);_0x11b0fb['attributes']=_['intersection'](_0x3b8471[_0x27a7('0x2d')],qs['fields'](_0x36e669['query']['fields']));_0x11b0fb['attributes']=_0x11b0fb[_0x27a7('0x2e')]['length']?_0x11b0fb[_0x27a7('0x2e')]:_0x3b8471[_0x27a7('0x2d')];if(!_0x36e669['query']['hasOwnProperty'](_0x27a7('0x2f'))){_0x11b0fb['limit']=qs[_0x27a7('0x30')](_0x36e669['query'][_0x27a7('0x30')]);_0x11b0fb[_0x27a7('0x18')]=qs[_0x27a7('0x18')](_0x36e669[_0x27a7('0x2b')]['offset']);}_0x11b0fb[_0x27a7('0x31')]=qs[_0x27a7('0x32')](_0x36e669['query'][_0x27a7('0x32')]);_0x11b0fb[_0x27a7('0x33')]=qs[_0x27a7('0x2c')](_[_0x27a7('0x34')](_0x36e669[_0x27a7('0x2b')],_0x3b8471['filters']),_0x81e614);if(_0x36e669[_0x27a7('0x2b')]['filter']){_0x11b0fb[_0x27a7('0x33')]=_['merge'](_0x11b0fb[_0x27a7('0x33')],{'$or':_[_0x27a7('0x27')](_0x81e614,function(_0xe311a1){if(_0xe311a1[_0x27a7('0x2a')]!==_0x27a7('0x35')){var _0x59e06d={};_0x59e06d[_0xe311a1[_0x27a7('0x24')]]={'$like':'%'+_0x36e669[_0x27a7('0x2b')][_0x27a7('0x36')]+'%'};return _0x59e06d;}})});}_0x11b0fb=_[_0x27a7('0x37')]({},_0x11b0fb,_0x36e669[_0x27a7('0x38')]);var _0x161abe={'where':_0x11b0fb[_0x27a7('0x33')]};return db[_0x27a7('0x39')][_0x27a7('0x1a')](_0x161abe)['then'](function(_0x5af7bc){_0x4a61a7[_0x27a7('0x1a')]=_0x5af7bc;if(_0x36e669[_0x27a7('0x2b')][_0x27a7('0x3a')]){_0x11b0fb['include']=[{'all':!![]}];}return db[_0x27a7('0x39')][_0x27a7('0x3b')](_0x11b0fb);})[_0x27a7('0x20')](function(_0x166729){_0x4a61a7[_0x27a7('0x3c')]=_0x166729;return _0x4a61a7;})['then'](respondWithFilteredResult(_0x7fafc2,_0x11b0fb))[_0x27a7('0x3d')](handleError(_0x7fafc2,null));};exports[_0x27a7('0x3e')]=function(_0x1914b8,_0x583a9e){var _0x106386={'raw':!![],'where':{'id':_0x1914b8[_0x27a7('0x3f')]['id']}},_0xcad175={};_0xcad175[_0x27a7('0x2d')]=_[_0x27a7('0x40')](db[_0x27a7('0x39')][_0x27a7('0x28')]);_0xcad175['query']=_[_0x27a7('0x40')](_0x1914b8[_0x27a7('0x2b')]);_0xcad175[_0x27a7('0x2c')]=_[_0x27a7('0x41')](_0xcad175[_0x27a7('0x2d')],_0xcad175['query']);_0x106386[_0x27a7('0x2e')]=_['intersection'](_0xcad175[_0x27a7('0x2d')],qs[_0x27a7('0x42')](_0x1914b8['query'][_0x27a7('0x42')]));_0x106386[_0x27a7('0x2e')]=_0x106386['attributes']['length']?_0x106386[_0x27a7('0x2e')]:_0xcad175[_0x27a7('0x2d')];if(_0x1914b8[_0x27a7('0x2b')][_0x27a7('0x3a')]){_0x106386[_0x27a7('0x43')]=[{'all':!![]}];}_0x106386=_['merge']({},_0x106386,_0x1914b8['options']);return db[_0x27a7('0x39')]['find'](_0x106386)[_0x27a7('0x20')](handleEntityNotFound(_0x583a9e,null))[_0x27a7('0x20')](respondWithResult(_0x583a9e,null))[_0x27a7('0x3d')](handleError(_0x583a9e,null));};exports[_0x27a7('0x44')]=function(_0x282128,_0x6b5ef1){return db['ZendeskField'][_0x27a7('0x44')](_0x282128['body'],{})[_0x27a7('0x20')](respondWithResult(_0x6b5ef1,0xc9))[_0x27a7('0x3d')](handleError(_0x6b5ef1,null));};exports[_0x27a7('0x45')]=function(_0x294156,_0x4cacc5){if(_0x294156['body']['id']){delete _0x294156['body']['id'];}return db[_0x27a7('0x39')]['find']({'where':{'id':_0x294156[_0x27a7('0x3f')]['id']}})[_0x27a7('0x20')](handleEntityNotFound(_0x4cacc5,null))['then'](saveUpdates(_0x294156[_0x27a7('0x46')],null))[_0x27a7('0x20')](respondWithResult(_0x4cacc5,null))['catch'](handleError(_0x4cacc5,null));};exports[_0x27a7('0x21')]=function(_0x5018ce,_0x62d922){return db[_0x27a7('0x39')]['find']({'where':{'id':_0x5018ce['params']['id']}})[_0x27a7('0x20')](handleEntityNotFound(_0x62d922,null))[_0x27a7('0x20')](removeEntity(_0x62d922,null))[_0x27a7('0x3d')](handleError(_0x62d922,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index dc4fed0..a2eae4c 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 _0x7d0b=['define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./intZendeskField.attributes'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7d0b,0x1c6));var _0xb7d0=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x7d0b[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xb7d0('0x0'));var util=require(_0xb7d0('0x1'));var logger=require(_0xb7d0('0x2'))('api');var moment=require(_0xb7d0('0x3'));var BPromise=require(_0xb7d0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb7d0('0x5'));var config=require(_0xb7d0('0x6'));var attributes=require(_0xb7d0('0x7'));module['exports']=function(_0x30e23a,_0x5e78e8){return _0x30e23a[_0xb7d0('0x8')](_0xb7d0('0x9'),attributes,{'tableName':_0xb7d0('0xa'),'paranoid':![],'indexes':[{'name':_0xb7d0('0xb'),'fields':[_0xb7d0('0xc'),_0xb7d0('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5c9c=['lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./intZendeskField.attributes','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId'];(function(_0x3a9410,_0x57092c){var _0x1a5316=function(_0x24e667){while(--_0x24e667){_0x3a9410['push'](_0x3a9410['shift']());}};_0x1a5316(++_0x57092c);}(_0x5c9c,0x1a4));var _0xc5c9=function(_0x272d33,_0x13cb2f){_0x272d33=_0x272d33-0x0;var _0x2b38f7=_0x5c9c[_0x272d33];return _0x2b38f7;};'use strict';var _=require(_0xc5c9('0x0'));var util=require(_0xc5c9('0x1'));var logger=require(_0xc5c9('0x2'))(_0xc5c9('0x3'));var moment=require(_0xc5c9('0x4'));var BPromise=require('bluebird');var rp=require(_0xc5c9('0x5'));var fs=require('fs');var path=require(_0xc5c9('0x6'));var rimraf=require('rimraf');var config=require(_0xc5c9('0x7'));var attributes=require(_0xc5c9('0x8'));module['exports']=function(_0xe17ee9,_0x507f35){return _0xe17ee9[_0xc5c9('0x9')](_0xc5c9('0xa'),attributes,{'tableName':_0xc5c9('0xb'),'paranoid':![],'indexes':[{'name':_0xc5c9('0xc'),'fields':[_0xc5c9('0xd'),_0xc5c9('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 132c7b9..e4ef59b 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 _0x5f7e=['error','code','ZendeskField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x56ba14,_0x4bb357){var _0x56baaa=function(_0x5823b4){while(--_0x5823b4){_0x56ba14['push'](_0x56ba14['shift']());}};_0x56baaa(++_0x4bb357);}(_0x5f7e,0xf6));var _0xe5f7=function(_0x725a4c,_0x102507){_0x725a4c=_0x725a4c-0x0;var _0x37b2cc=_0x5f7e[_0x725a4c];return _0x37b2cc;};'use strict';var _=require(_0xe5f7('0x0'));var util=require(_0xe5f7('0x1'));var moment=require(_0xe5f7('0x2'));var BPromise=require(_0xe5f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe5f7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe5f7('0x5'));var logger=require(_0xe5f7('0x6'))(_0xe5f7('0x7'));var config=require(_0xe5f7('0x8'));var jayson=require(_0xe5f7('0x9'));var client=jayson[_0xe5f7('0xa')][_0xe5f7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e237c,_0x876d88,_0x395843){return new BPromise(function(_0x562316,_0x3d8912){return client[_0xe5f7('0xc')](_0x3e237c,_0x395843)['then'](function(_0x3305ac){logger[_0xe5f7('0xd')]('ZendeskField,\x20%s,\x20%s',_0x876d88,_0xe5f7('0xe'));logger[_0xe5f7('0xf')](_0xe5f7('0x10'),_0x876d88,_0xe5f7('0xe'),JSON[_0xe5f7('0x11')](_0x3305ac));if(_0x3305ac[_0xe5f7('0x12')]){if(_0x3305ac[_0xe5f7('0x12')][_0xe5f7('0x13')]===0x1f4){logger['error'](_0xe5f7('0x14'),_0x876d88,_0x3305ac['error'][_0xe5f7('0x15')]);return _0x3d8912(_0x3305ac[_0xe5f7('0x12')][_0xe5f7('0x15')]);}logger[_0xe5f7('0x12')]('ZendeskField,\x20%s,\x20%s',_0x876d88,_0x3305ac[_0xe5f7('0x12')]['message']);return _0x562316(_0x3305ac[_0xe5f7('0x12')][_0xe5f7('0x15')]);}else{logger[_0xe5f7('0xd')](_0xe5f7('0x14'),_0x876d88,_0xe5f7('0xe'));_0x562316(_0x3305ac[_0xe5f7('0x16')][_0xe5f7('0x15')]);}})[_0xe5f7('0x17')](function(_0x25e98f){logger['error'](_0xe5f7('0x14'),_0x876d88,_0x25e98f);_0x3d8912(_0x25e98f);});});} \ No newline at end of file +var _0x3dd9=['client','http','then','info','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskField,\x20%s,\x20%s','message','catch','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x2e69fb,_0x4359e3){var _0x4d2404=function(_0x5667b5){while(--_0x5667b5){_0x2e69fb['push'](_0x2e69fb['shift']());}};_0x4d2404(++_0x4359e3);}(_0x3dd9,0x1f0));var _0x93dd=function(_0x3b661d,_0x1680f9){_0x3b661d=_0x3b661d-0x0;var _0x3feb5e=_0x3dd9[_0x3b661d];return _0x3feb5e;};'use strict';var _=require('lodash');var util=require(_0x93dd('0x0'));var moment=require(_0x93dd('0x1'));var BPromise=require('bluebird');var rs=require(_0x93dd('0x2'));var fs=require('fs');var Redis=require(_0x93dd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x93dd('0x4'));var logger=require('../../config/logger')(_0x93dd('0x5'));var config=require(_0x93dd('0x6'));var jayson=require(_0x93dd('0x7'));var client=jayson[_0x93dd('0x8')][_0x93dd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53c99c,_0x1d86ed,_0x169ab7){return new BPromise(function(_0x172a30,_0x8ecc18){return client['request'](_0x53c99c,_0x169ab7)[_0x93dd('0xa')](function(_0x420539){logger[_0x93dd('0xb')]('ZendeskField,\x20%s,\x20%s',_0x1d86ed,_0x93dd('0xc'));logger[_0x93dd('0xd')](_0x93dd('0xe'),_0x1d86ed,_0x93dd('0xc'),JSON[_0x93dd('0xf')](_0x420539));if(_0x420539[_0x93dd('0x10')]){if(_0x420539[_0x93dd('0x10')][_0x93dd('0x11')]===0x1f4){logger[_0x93dd('0x10')](_0x93dd('0x12'),_0x1d86ed,_0x420539[_0x93dd('0x10')]['message']);return _0x8ecc18(_0x420539[_0x93dd('0x10')]['message']);}logger[_0x93dd('0x10')]('ZendeskField,\x20%s,\x20%s',_0x1d86ed,_0x420539[_0x93dd('0x10')][_0x93dd('0x13')]);return _0x172a30(_0x420539['error']['message']);}else{logger[_0x93dd('0xb')](_0x93dd('0x12'),_0x1d86ed,_0x93dd('0xc'));_0x172a30(_0x420539['result'][_0x93dd('0x13')]);}})[_0x93dd('0x14')](function(_0x94e563){logger[_0x93dd('0x10')](_0x93dd('0x12'),_0x1d86ed,_0x94e563);_0x8ecc18(_0x94e563);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 80ee93b..c9889b8 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 _0x8d2f=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','index','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','create','put','update','delete','/:id'];(function(_0x363b81,_0x81e6ca){var _0x1d92fb=function(_0x129644){while(--_0x129644){_0x363b81['push'](_0x363b81['shift']());}};_0x1d92fb(++_0x81e6ca);}(_0x8d2f,0x8c));var _0xf8d2=function(_0x50bc27,_0x2b4f1b){_0x50bc27=_0x50bc27-0x0;var _0xb75d73=_0x8d2f[_0x50bc27];return _0xb75d73;};'use strict';var multer=require(_0xf8d2('0x0'));var util=require(_0xf8d2('0x1'));var path=require('path');var timeout=require(_0xf8d2('0x2'));var express=require(_0xf8d2('0x3'));var router=express[_0xf8d2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf8d2('0x5'));var config=require(_0xf8d2('0x6'));var controller=require(_0xf8d2('0x7'));router[_0xf8d2('0x8')]('/',auth['isAuthenticated'](),controller[_0xf8d2('0x9')]);router[_0xf8d2('0x8')]('/:id',auth[_0xf8d2('0xa')](),controller[_0xf8d2('0xb')]);router[_0xf8d2('0x8')](_0xf8d2('0xc'),auth[_0xf8d2('0xa')](),controller[_0xf8d2('0xd')]);router[_0xf8d2('0x8')](_0xf8d2('0xe'),auth[_0xf8d2('0xa')](),controller['getFields']);router[_0xf8d2('0xf')]('/',auth[_0xf8d2('0xa')](),controller[_0xf8d2('0x10')]);router[_0xf8d2('0xf')](_0xf8d2('0xc'),auth[_0xf8d2('0xa')](),controller['addConfiguration']);router[_0xf8d2('0x11')]('/:id',auth[_0xf8d2('0xa')](),controller[_0xf8d2('0x12')]);router[_0xf8d2('0x13')](_0xf8d2('0x14'),auth[_0xf8d2('0xa')](),controller[_0xf8d2('0x15')]);module[_0xf8d2('0x16')]=router; \ No newline at end of file +var _0x1cad=['addConfiguration','put','update','delete','/:id','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','index','isAuthenticated','getFields','post','create'];(function(_0x1a7853,_0x5574d7){var _0x2ab301=function(_0x147295){while(--_0x147295){_0x1a7853['push'](_0x1a7853['shift']());}};_0x2ab301(++_0x5574d7);}(_0x1cad,0x84));var _0xd1ca=function(_0x19c323,_0x3f12e2){_0x19c323=_0x19c323-0x0;var _0x741903=_0x1cad[_0x19c323];return _0x741903;};'use strict';var multer=require('multer');var util=require(_0xd1ca('0x0'));var path=require(_0xd1ca('0x1'));var timeout=require('connect-timeout');var express=require(_0xd1ca('0x2'));var router=express[_0xd1ca('0x3')]();var fs_extra=require(_0xd1ca('0x4'));var auth=require(_0xd1ca('0x5'));var interaction=require(_0xd1ca('0x6'));var config=require(_0xd1ca('0x7'));var controller=require(_0xd1ca('0x8'));router[_0xd1ca('0x9')]('/',auth['isAuthenticated'](),controller[_0xd1ca('0xa')]);router[_0xd1ca('0x9')]('/:id',auth[_0xd1ca('0xb')](),controller['show']);router[_0xd1ca('0x9')]('/:id/configurations',auth[_0xd1ca('0xb')](),controller['getConfigurations']);router[_0xd1ca('0x9')]('/:id/fields',auth[_0xd1ca('0xb')](),controller[_0xd1ca('0xc')]);router[_0xd1ca('0xd')]('/',auth[_0xd1ca('0xb')](),controller[_0xd1ca('0xe')]);router[_0xd1ca('0xd')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xd1ca('0xf')]);router[_0xd1ca('0x10')]('/:id',auth[_0xd1ca('0xb')](),controller[_0xd1ca('0x11')]);router[_0xd1ca('0x12')](_0xd1ca('0x13'),auth[_0xd1ca('0xb')](),controller[_0xd1ca('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 c7c60ba..cde30f2 100644 --- a/server/api/intZohoAccount/intZohoAccount.attributes.js +++ b/server/api/intZohoAccount/intZohoAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x22fb=['STRING'];(function(_0x50b268,_0x12a991){var _0x4ca0ea=function(_0x24caf1){while(--_0x24caf1){_0x50b268['push'](_0x50b268['shift']());}};_0x4ca0ea(++_0x12a991);}(_0x22fb,0x192));var _0xb22f=function(_0xd387d9,_0x4577d3){_0xd387d9=_0xd387d9-0x0;var _0x414d99=_0x22fb[_0xd387d9];return _0x414d99;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb22f('0x0')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xb22f('0x0')]},'zone':{'type':Sequelize[_0xb22f('0x0')]},'clientId':{'type':Sequelize[_0xb22f('0x0')]},'clientSecret':{'type':Sequelize[_0xb22f('0x0')]},'serverUrl':{'type':Sequelize[_0xb22f('0x0')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0xb22f('0x0')]}}; \ No newline at end of file +var _0x6c76=['STRING','sequelize','exports'];(function(_0x371d18,_0xe0a948){var _0x43e2b4=function(_0x21ac78){while(--_0x21ac78){_0x371d18['push'](_0x371d18['shift']());}};_0x43e2b4(++_0xe0a948);}(_0x6c76,0x184));var _0x66c7=function(_0x515e0f,_0x41c828){_0x515e0f=_0x515e0f-0x0;var _0x1fe5fd=_0x6c76[_0x515e0f];return _0x1fe5fd;};'use strict';var Sequelize=require(_0x66c7('0x0'));module[_0x66c7('0x1')]={'name':{'type':Sequelize[_0x66c7('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x66c7('0x2')]},'zone':{'type':Sequelize[_0x66c7('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x66c7('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x66c7('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 58d5889..d6c3f4e 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 _0x1847=['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','../../components/integrations/configuration','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','ZohoAccount','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','update','findOne','ZohoConfiguration','length','sort','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','getFields','serverUrl','code','refreshToken','host','zoho.eu','com','slice','substring','lastIndexOf','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','message','Owner','Subject','WhoId','Call_Result','Call_Start_Time','Call_Type','remove','api_name','system_mandatory','push','display_label','picklist','pick_list_values','statusCode','stringify','test','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x1e500e,_0x2c9d74){var _0x10dc5e=function(_0x354423){while(--_0x354423){_0x1e500e['push'](_0x1e500e['shift']());}};_0x10dc5e(++_0x2c9d74);}(_0x1847,0x76));var _0x7184=function(_0x4e3ffa,_0x82c4ba){_0x4e3ffa=_0x4e3ffa-0x0;var _0x556d3c=_0x1847[_0x4e3ffa];return _0x556d3c;};'use strict';var emlformat=require(_0x7184('0x0'));var rimraf=require(_0x7184('0x1'));var zipdir=require(_0x7184('0x2'));var jsonpatch=require(_0x7184('0x3'));var rp=require('request-promise');var moment=require(_0x7184('0x4'));var BPromise=require(_0x7184('0x5'));var Mustache=require(_0x7184('0x6'));var util=require(_0x7184('0x7'));var path=require(_0x7184('0x8'));var sox=require(_0x7184('0x9'));var csv=require(_0x7184('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7184('0xb'));var _=require(_0x7184('0xc'));var squel=require(_0x7184('0xd'));var crypto=require(_0x7184('0xe'));var jsforce=require(_0x7184('0xf'));var deskjs=require(_0x7184('0x10'));var toCsv=require(_0x7184('0xa'));var querystring=require(_0x7184('0x11'));var Papa=require(_0x7184('0x12'));var Redis=require('ioredis');var authService=require(_0x7184('0x13'));var qs=require(_0x7184('0x14'));var as=require(_0x7184('0x15'));var hardwareService=require(_0x7184('0x16'));var logger=require(_0x7184('0x17'))(_0x7184('0x18'));var utils=require(_0x7184('0x19'));var config=require(_0x7184('0x1a'));var licenseUtil=require(_0x7184('0x1b'));var db=require(_0x7184('0x1c'))['db'];var integrations=require(_0x7184('0x1d'));function respondWithStatusCode(_0x3891af,_0x4db5bb){_0x4db5bb=_0x4db5bb||0xcc;return function(_0x2c9cb1){if(_0x2c9cb1){return _0x3891af['sendStatus'](_0x4db5bb);}return _0x3891af[_0x7184('0x1e')](_0x4db5bb)[_0x7184('0x1f')]();};}function respondWithResult(_0x1b2390,_0x24c197){_0x24c197=_0x24c197||0xc8;return function(_0x406789){if(_0x406789){return _0x1b2390[_0x7184('0x1e')](_0x24c197)[_0x7184('0x20')](_0x406789);}};}function respondWithFilteredResult(_0x293897,_0x5938c3){return function(_0x3702f7){if(_0x3702f7){var _0x295c5a=typeof _0x5938c3[_0x7184('0x21')]==='undefined'&&typeof _0x5938c3[_0x7184('0x22')]===_0x7184('0x23');var _0x7b61ea=_0x3702f7['count'];var _0x4495ac=_0x295c5a?0x0:_0x5938c3[_0x7184('0x21')];var _0x52ecde=_0x295c5a?_0x3702f7[_0x7184('0x24')]:_0x5938c3['offset']+_0x5938c3[_0x7184('0x22')];var _0x1065e0;if(_0x52ecde>=_0x7b61ea){_0x52ecde=_0x7b61ea;_0x1065e0=0xc8;}else{_0x1065e0=0xce;}_0x293897['status'](_0x1065e0);return _0x293897[_0x7184('0x25')](_0x7184('0x26'),_0x4495ac+'-'+_0x52ecde+'/'+_0x7b61ea)[_0x7184('0x20')](_0x3702f7);}return null;};}function patchUpdates(_0x3e0263){return function(_0x56d835){try{jsonpatch['apply'](_0x56d835,_0x3e0263,!![]);}catch(_0x3cf05d){return BPromise[_0x7184('0x27')](_0x3cf05d);}return _0x56d835[_0x7184('0x28')]();};}function saveUpdates(_0xf05137,_0x262191){return function(_0x4d0139){if(_0x4d0139){return _0x4d0139['update'](_0xf05137)[_0x7184('0x29')](function(_0x173c70){return _0x173c70;});}return null;};}function removeEntity(_0x2826a7,_0x4476cb){return function(_0x14371f){if(_0x14371f){return _0x14371f[_0x7184('0x2a')]()[_0x7184('0x29')](function(){_0x2826a7[_0x7184('0x1e')](0xcc)[_0x7184('0x1f')]();});}};}function handleEntityNotFound(_0x1b1620,_0x1bc7de){return function(_0x22401b){if(!_0x22401b){_0x1b1620[_0x7184('0x2b')](0x194);}return _0x22401b;};}function handleError(_0x31ce6d,_0x246ff7){_0x246ff7=_0x246ff7||0x1f4;return function(_0x2271a4){logger[_0x7184('0x2c')](_0x2271a4[_0x7184('0x2d')]);if(_0x2271a4[_0x7184('0x2e')]){delete _0x2271a4[_0x7184('0x2e')];}_0x31ce6d[_0x7184('0x1e')](_0x246ff7)[_0x7184('0x2f')](_0x2271a4);};}exports[_0x7184('0x30')]=function(_0x4954ef,_0x1cd98f){var _0x37f2ca={},_0x942b44={},_0x257b96={'count':0x0,'rows':[]};var _0x180061=_[_0x7184('0x31')](db[_0x7184('0x32')]['rawAttributes'],function(_0x4c78c1){return{'name':_0x4c78c1['fieldName'],'type':_0x4c78c1[_0x7184('0x33')][_0x7184('0x34')]};});_0x942b44[_0x7184('0x35')]=_[_0x7184('0x31')](_0x180061,'name');_0x942b44['query']=_[_0x7184('0x36')](_0x4954ef[_0x7184('0x37')]);_0x942b44[_0x7184('0x38')]=_[_0x7184('0x39')](_0x942b44[_0x7184('0x35')],_0x942b44[_0x7184('0x37')]);_0x37f2ca[_0x7184('0x3a')]=_[_0x7184('0x39')](_0x942b44[_0x7184('0x35')],qs[_0x7184('0x3b')](_0x4954ef['query'][_0x7184('0x3b')]));_0x37f2ca['attributes']=_0x37f2ca[_0x7184('0x3a')]['length']?_0x37f2ca['attributes']:_0x942b44[_0x7184('0x35')];if(!_0x4954ef[_0x7184('0x37')][_0x7184('0x3c')]('nolimit')){_0x37f2ca[_0x7184('0x22')]=qs[_0x7184('0x22')](_0x4954ef['query']['limit']);_0x37f2ca[_0x7184('0x21')]=qs[_0x7184('0x21')](_0x4954ef[_0x7184('0x37')][_0x7184('0x21')]);}_0x37f2ca[_0x7184('0x3d')]=qs['sort'](_0x4954ef[_0x7184('0x37')]['sort']);_0x37f2ca[_0x7184('0x3e')]=qs['filters'](_[_0x7184('0x3f')](_0x4954ef[_0x7184('0x37')],_0x942b44['filters']),_0x180061);if(_0x4954ef['query'][_0x7184('0x40')]){_0x37f2ca['where']=_[_0x7184('0x41')](_0x37f2ca[_0x7184('0x3e')],{'$or':_[_0x7184('0x31')](_0x180061,function(_0x19022d){if(_0x19022d[_0x7184('0x33')]!=='VIRTUAL'){var _0x1d18c6={};_0x1d18c6[_0x19022d[_0x7184('0x2e')]]={'$like':'%'+_0x4954ef['query'][_0x7184('0x40')]+'%'};return _0x1d18c6;}})});}_0x37f2ca=_[_0x7184('0x41')]({},_0x37f2ca,_0x4954ef[_0x7184('0x42')]);var _0x1a1fe3={'where':_0x37f2ca[_0x7184('0x3e')]};return db[_0x7184('0x32')][_0x7184('0x24')](_0x1a1fe3)[_0x7184('0x29')](function(_0x5b2b70){_0x257b96[_0x7184('0x24')]=_0x5b2b70;if(_0x4954ef[_0x7184('0x37')][_0x7184('0x43')]){_0x37f2ca[_0x7184('0x44')]=[{'all':!![]}];}return db['ZohoAccount'][_0x7184('0x45')](_0x37f2ca);})[_0x7184('0x29')](function(_0x5ea19f){_0x257b96[_0x7184('0x46')]=_0x5ea19f;return _0x257b96;})[_0x7184('0x29')](respondWithFilteredResult(_0x1cd98f,_0x37f2ca))[_0x7184('0x47')](handleError(_0x1cd98f,null));};exports['show']=function(_0x194482,_0x5531d9){var _0x330fdf={'raw':![],'where':{'id':_0x194482[_0x7184('0x48')]['id']}},_0xc29160={};_0xc29160[_0x7184('0x35')]=_['keys'](db[_0x7184('0x32')][_0x7184('0x49')]);_0xc29160['query']=_[_0x7184('0x36')](_0x194482[_0x7184('0x37')]);_0xc29160[_0x7184('0x38')]=_[_0x7184('0x39')](_0xc29160['model'],_0xc29160['query']);_0x330fdf[_0x7184('0x3a')]=_[_0x7184('0x39')](_0xc29160[_0x7184('0x35')],qs[_0x7184('0x3b')](_0x194482[_0x7184('0x37')][_0x7184('0x3b')]));_0x330fdf[_0x7184('0x3a')]=_0x330fdf[_0x7184('0x3a')]['length']?_0x330fdf[_0x7184('0x3a')]:_0xc29160[_0x7184('0x35')];if(_0x194482[_0x7184('0x37')][_0x7184('0x43')]){_0x330fdf[_0x7184('0x44')]=[{'all':!![]}];}_0x330fdf=_[_0x7184('0x41')]({},_0x330fdf,_0x194482[_0x7184('0x42')]);return db[_0x7184('0x32')][_0x7184('0x4a')](_0x330fdf)[_0x7184('0x29')](handleEntityNotFound(_0x5531d9,null))[_0x7184('0x29')](respondWithResult(_0x5531d9,null))[_0x7184('0x47')](handleError(_0x5531d9,null));};exports[_0x7184('0x4b')]=function(_0x48ed89,_0x5e235f){return db[_0x7184('0x32')][_0x7184('0x4b')](_0x48ed89[_0x7184('0x4c')],{})[_0x7184('0x29')](respondWithResult(_0x5e235f,0xc9))[_0x7184('0x47')](handleError(_0x5e235f,null));};exports[_0x7184('0x4d')]=function(_0x27f67c,_0x29dfe4){if(_0x27f67c[_0x7184('0x4c')]['id']){delete _0x27f67c[_0x7184('0x4c')]['id'];}return db['ZohoAccount'][_0x7184('0x4a')]({'where':{'id':_0x27f67c['params']['id']}})[_0x7184('0x29')](handleEntityNotFound(_0x29dfe4,null))['then'](saveUpdates(_0x27f67c[_0x7184('0x4c')],null))[_0x7184('0x29')](respondWithResult(_0x29dfe4,null))[_0x7184('0x47')](handleError(_0x29dfe4,null));};exports['destroy']=function(_0x2b1694,_0x11e921){return db[_0x7184('0x32')][_0x7184('0x4a')]({'where':{'id':_0x2b1694[_0x7184('0x48')]['id']}})[_0x7184('0x29')](handleEntityNotFound(_0x11e921,null))['then'](removeEntity(_0x11e921,null))[_0x7184('0x47')](handleError(_0x11e921,null));};exports['getConfigurations']=function(_0x57a4ba,_0x38550c,_0x45539c){var _0x1177b2={};var _0x135bc8={};var _0x57b972;var _0xfb8d7d;return db[_0x7184('0x32')][_0x7184('0x4e')]({'where':{'id':_0x57a4ba[_0x7184('0x48')]['id']}})[_0x7184('0x29')](handleEntityNotFound(_0x38550c,null))[_0x7184('0x29')](function(_0x12a24b){if(_0x12a24b){_0x57b972=_0x12a24b;_0x135bc8[_0x7184('0x35')]=_[_0x7184('0x36')](db[_0x7184('0x4f')][_0x7184('0x49')]);_0x135bc8[_0x7184('0x37')]=_[_0x7184('0x36')](_0x57a4ba['query']);_0x135bc8[_0x7184('0x38')]=_[_0x7184('0x39')](_0x135bc8[_0x7184('0x35')],_0x135bc8[_0x7184('0x37')]);_0x1177b2[_0x7184('0x3a')]=_[_0x7184('0x39')](_0x135bc8[_0x7184('0x35')],qs[_0x7184('0x3b')](_0x57a4ba['query'][_0x7184('0x3b')]));_0x1177b2['attributes']=_0x1177b2[_0x7184('0x3a')][_0x7184('0x50')]?_0x1177b2['attributes']:_0x135bc8[_0x7184('0x35')];_0x1177b2[_0x7184('0x3d')]=qs[_0x7184('0x51')](_0x57a4ba[_0x7184('0x37')]['sort']);_0x1177b2[_0x7184('0x3e')]=qs[_0x7184('0x38')](_[_0x7184('0x3f')](_0x57a4ba[_0x7184('0x37')],_0x135bc8[_0x7184('0x38')]));if(_0x57a4ba[_0x7184('0x37')][_0x7184('0x40')]){_0x1177b2['where']=_[_0x7184('0x41')](_0x1177b2[_0x7184('0x3e')],{'$or':_[_0x7184('0x31')](_0x1177b2[_0x7184('0x3a')],function(_0x3797ae){var _0x25b08d={};_0x25b08d[_0x3797ae]={'$like':'%'+_0x57a4ba[_0x7184('0x37')]['filter']+'%'};return _0x25b08d;})});}_0x1177b2=_[_0x7184('0x41')]({},_0x1177b2,_0x57a4ba['options']);return _0x57b972[_0x7184('0x52')](_0x1177b2);}})[_0x7184('0x29')](function(_0x55314f){if(_0x55314f){_0xfb8d7d=_0x55314f[_0x7184('0x50')];if(!_0x57a4ba[_0x7184('0x37')]['hasOwnProperty'](_0x7184('0x53'))){_0x1177b2[_0x7184('0x22')]=qs[_0x7184('0x22')](_0x57a4ba[_0x7184('0x37')]['limit']);_0x1177b2[_0x7184('0x21')]=qs[_0x7184('0x21')](_0x57a4ba[_0x7184('0x37')]['offset']);}return _0x57b972[_0x7184('0x52')](_0x1177b2);}})['then'](function(_0x2328bb){if(_0x2328bb){return _0x2328bb?{'count':_0xfb8d7d,'rows':_0x2328bb}:null;}})[_0x7184('0x29')](respondWithResult(_0x38550c,null))[_0x7184('0x47')](handleError(_0x38550c,null));};exports[_0x7184('0x54')]=function(_0x43f807,_0x38a8ef,_0x4b69b6){if(_0x43f807['body']['id']){delete _0x43f807[_0x7184('0x4c')]['id'];}return db[_0x7184('0x32')][_0x7184('0x4e')]({'where':{'id':_0x43f807[_0x7184('0x48')]['id']}})[_0x7184('0x29')](handleEntityNotFound(_0x38a8ef,null))[_0x7184('0x29')](function(_0x420276){if(_0x420276){_0x43f807[_0x7184('0x4c')][_0x7184('0x55')]=_0x420276['id'];_0x43f807[_0x7184('0x4c')][_0x7184('0x56')]=integrations[_0x7184('0x57')](_0x43f807['body'][_0x7184('0x58')],_0x43f807[_0x7184('0x4c')][_0x7184('0x33')]);_0x43f807[_0x7184('0x4c')]['Descriptions']=integrations[_0x7184('0x59')](_0x43f807[_0x7184('0x4c')][_0x7184('0x58')],_0x43f807[_0x7184('0x4c')][_0x7184('0x33')]);return db[_0x7184('0x4f')][_0x7184('0x4b')](_0x43f807[_0x7184('0x4c')],{'include':[{'model':db['ZohoField'],'as':_0x7184('0x56')},{'model':db[_0x7184('0x5a')],'as':_0x7184('0x5b')}]});}return null;})[_0x7184('0x29')](respondWithResult(_0x38a8ef,null))['catch'](handleError(_0x38a8ef,null));};function getAccessToken(_0x4907f5){return new Promise(function(_0x32d0e7,_0x5ee314){var _0x3fe680;switch(_0x4907f5[_0x7184('0x5c')]){case'US':_0x3fe680=_0x7184('0x5d');break;case'AU':_0x3fe680=_0x7184('0x5e');break;case'EU':_0x3fe680=_0x7184('0x5f');break;case'IN':_0x3fe680=_0x7184('0x60');break;case'CN':_0x3fe680=_0x7184('0x61');break;default:_0x3fe680=_0x7184('0x5f');break;}var _0x35b5a6={'method':_0x7184('0x62'),'uri':_0x3fe680+_0x7184('0x63'),'qs':{'refresh_token':_0x4907f5['refreshToken'],'client_id':_0x4907f5[_0x7184('0x64')],'client_secret':_0x4907f5[_0x7184('0x65')],'grant_type':_0x7184('0x66')},'json':!![]};return rp(_0x35b5a6)[_0x7184('0x29')](function(_0x3f1c8b){if(_0x3f1c8b['access_token']){_0x32d0e7(_0x3f1c8b['access_token']);}else{_0x5ee314('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x7184('0x47')](function(_0x501ac0){_0x5ee314(_0x501ac0);});});}exports[_0x7184('0x67')]=function(_0x29e1b3,_0x192153,_0x23a103){var _0x37fac5,_0x418118,_0x2b563f,_0xea644e,_0x437cf3;return db[_0x7184('0x32')]['findOne']({'where':{'id':_0x29e1b3[_0x7184('0x48')]['id']},'attributes':['id','host','zone',_0x7184('0x64'),_0x7184('0x65'),_0x7184('0x68'),_0x7184('0x69'),_0x7184('0x6a')]})[_0x7184('0x29')](handleEntityNotFound(_0x192153,null))[_0x7184('0x29')](function(_0xb4424b){_0x437cf3=_0xb4424b;_0x37fac5=_0x437cf3[_0x7184('0x6b')];_0x418118=_0x37fac5===_0x7184('0x6c')?'eu':_0x7184('0x6d');_0x2b563f=_0x437cf3[_0x7184('0x68')];var _0x3c436f=_0x2b563f[_0x7184('0x6e')](-0x1);if(_0x3c436f==='/'||_0x3c436f==='\x5c'||_0x3c436f===':'){_0x2b563f=_0x2b563f[_0x7184('0x6f')](0x0,_0x2b563f[_0x7184('0x70')](_0x3c436f));}if(!_0x437cf3['refreshToken']){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x437cf3);})['then'](function(_0x59e96f){if(_0x59e96f){return rp({'method':_0x7184('0x71'),'uri':util['format'](_0x7184('0x72'),_0x418118),'qs':{'module':_0x7184('0x73')},'headers':{'Authorization':_0x7184('0x74')+_0x59e96f},'json':!![]});}})[_0x7184('0x29')](function(_0x430df6){if(_0x430df6){if(_0x430df6['response']&&_0x430df6['response'][_0x7184('0x2c')]){throw new Error(_0x430df6['response']['error'][_0x7184('0x75')]);}var _0x4cb44e=[];var _0x4877b3=[];var _0x4676eb=[_0x7184('0x76'),_0x7184('0x77'),'Description',_0x7184('0x78'),'Call_Duration',_0x7184('0x79'),_0x7184('0x7a'),_0x7184('0x7b')];_0x4877b3=_[_0x7184('0x7c')](_0x430df6['fields'],function(_0x23212e){return _0x4676eb['includes'](_0x23212e[_0x7184('0x7d')]);});for(var _0x3ee3a4=0x0;_0x3ee3a4<_0x4877b3[_0x7184('0x50')];_0x3ee3a4++){if(_0x4877b3[_0x3ee3a4][_0x7184('0x7e')]===![]){_0x4cb44e[_0x7184('0x7f')]({'id':_0x4877b3[_0x3ee3a4]['id'],'name':_0x4877b3[_0x3ee3a4][_0x7184('0x80')],'custom':_0x4877b3[_0x3ee3a4]['custom_field'],'options':_0x4877b3[_0x3ee3a4]['data_type']===_0x7184('0x81')&&_0x4877b3[_0x3ee3a4][_0x7184('0x82')][_0x7184('0x50')]>-0x1?_['map'](_0x4877b3[_0x3ee3a4][_0x7184('0x82')],function(_0xe13795){return{'name':_0xe13795,'value':_0xe13795};}):[]});}}return{'count':_0x4cb44e[_0x7184('0x50')],'rows':_0x4cb44e};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x192153,null))[_0x7184('0x47')](function(_0x104541){var _0x518d35=_0x29e1b3['query']['test']?0x1f4:_0x104541[_0x7184('0x83')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x518d35,JSON[_0x7184('0x84')](_0x104541));delete _0x104541[_0x7184('0x2e')];if(_0x518d35===0x191){_0x518d35=0x190;}_0x192153[_0x7184('0x1e')](_0x518d35)[_0x7184('0x2f')](_0x29e1b3[_0x7184('0x37')][_0x7184('0x85')]?{'message':'Wrong\x20credentials','statusCode':_0x104541[_0x7184('0x83')]}:_0x104541);});}; \ No newline at end of file +var _0x90f8=['Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Result','Call_Type','api_name','push','display_label','custom_field','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','destroy','then','error','name','send','map','fieldName','key','query','keys','filters','model','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','ZohoAccount','includeAll','include','rows','catch','show','rawAttributes','intersection','length','find','create','body','update','params','getConfigurations','findOne','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','type','Descriptions','getDescriptions','ZohoConfiguration','ZohoField','Subjects','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientId','serverUrl','code','zoho.eu','com','slice','substring','lastIndexOf'];(function(_0x2afb49,_0x131943){var _0x62ba62=function(_0x4240da){while(--_0x4240da){_0x2afb49['push'](_0x2afb49['shift']());}};_0x62ba62(++_0x131943);}(_0x90f8,0x9a));var _0x890f=function(_0x61736c,_0x232d6a){_0x61736c=_0x61736c-0x0;var _0x51d1bb=_0x90f8[_0x61736c];return _0x51d1bb;};'use strict';var emlformat=require(_0x890f('0x0'));var rimraf=require(_0x890f('0x1'));var zipdir=require(_0x890f('0x2'));var jsonpatch=require(_0x890f('0x3'));var rp=require(_0x890f('0x4'));var moment=require(_0x890f('0x5'));var BPromise=require(_0x890f('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x890f('0x7'));var sox=require('sox');var csv=require(_0x890f('0x8'));var ejs=require(_0x890f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x890f('0xa'));var crypto=require(_0x890f('0xb'));var jsforce=require(_0x890f('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x890f('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x890f('0xe'));var as=require(_0x890f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x890f('0x10'))(_0x890f('0x11'));var utils=require('../../config/utils');var config=require(_0x890f('0x12'));var licenseUtil=require(_0x890f('0x13'));var db=require(_0x890f('0x14'))['db'];var integrations=require(_0x890f('0x15'));function respondWithStatusCode(_0x26f9a7,_0x48035f){_0x48035f=_0x48035f||0xcc;return function(_0x54d560){if(_0x54d560){return _0x26f9a7[_0x890f('0x16')](_0x48035f);}return _0x26f9a7[_0x890f('0x17')](_0x48035f)[_0x890f('0x18')]();};}function respondWithResult(_0x44a8a0,_0x381f90){_0x381f90=_0x381f90||0xc8;return function(_0x152476){if(_0x152476){return _0x44a8a0[_0x890f('0x17')](_0x381f90)[_0x890f('0x19')](_0x152476);}};}function respondWithFilteredResult(_0x4db63f,_0x4bcf04){return function(_0xd85a7f){if(_0xd85a7f){var _0x450ce5=typeof _0x4bcf04[_0x890f('0x1a')]===_0x890f('0x1b')&&typeof _0x4bcf04[_0x890f('0x1c')]===_0x890f('0x1b');var _0x3e4de1=_0xd85a7f[_0x890f('0x1d')];var _0x1553fb=_0x450ce5?0x0:_0x4bcf04[_0x890f('0x1a')];var _0x3a4a9d=_0x450ce5?_0xd85a7f[_0x890f('0x1d')]:_0x4bcf04[_0x890f('0x1a')]+_0x4bcf04['limit'];var _0x60ca5c;if(_0x3a4a9d>=_0x3e4de1){_0x3a4a9d=_0x3e4de1;_0x60ca5c=0xc8;}else{_0x60ca5c=0xce;}_0x4db63f[_0x890f('0x17')](_0x60ca5c);return _0x4db63f[_0x890f('0x1e')]('Content-Range',_0x1553fb+'-'+_0x3a4a9d+'/'+_0x3e4de1)[_0x890f('0x19')](_0xd85a7f);}return null;};}function patchUpdates(_0xa77c3b){return function(_0x2efb26){try{jsonpatch['apply'](_0x2efb26,_0xa77c3b,!![]);}catch(_0x4ca1ef){return BPromise[_0x890f('0x1f')](_0x4ca1ef);}return _0x2efb26[_0x890f('0x20')]();};}function saveUpdates(_0x4cc170,_0x2d1c3c){return function(_0x175651){if(_0x175651){return _0x175651['update'](_0x4cc170)['then'](function(_0x152f20){return _0x152f20;});}return null;};}function removeEntity(_0x76315b,_0x6e5cb2){return function(_0x5b011d){if(_0x5b011d){return _0x5b011d[_0x890f('0x21')]()[_0x890f('0x22')](function(){_0x76315b[_0x890f('0x17')](0xcc)[_0x890f('0x18')]();});}};}function handleEntityNotFound(_0x4880ac,_0x242307){return function(_0x528a82){if(!_0x528a82){_0x4880ac[_0x890f('0x16')](0x194);}return _0x528a82;};}function handleError(_0x2c06eb,_0x5faee7){_0x5faee7=_0x5faee7||0x1f4;return function(_0x2b2e04){logger[_0x890f('0x23')](_0x2b2e04['stack']);if(_0x2b2e04['name']){delete _0x2b2e04[_0x890f('0x24')];}_0x2c06eb[_0x890f('0x17')](_0x5faee7)[_0x890f('0x25')](_0x2b2e04);};}exports['index']=function(_0x1ed296,_0x27b5f2){var _0x35d950={},_0x20e206={},_0x1bf9ac={'count':0x0,'rows':[]};var _0x2419cf=_[_0x890f('0x26')](db['ZohoAccount']['rawAttributes'],function(_0x2c766a){return{'name':_0x2c766a[_0x890f('0x27')],'type':_0x2c766a['type'][_0x890f('0x28')]};});_0x20e206['model']=_[_0x890f('0x26')](_0x2419cf,_0x890f('0x24'));_0x20e206[_0x890f('0x29')]=_[_0x890f('0x2a')](_0x1ed296[_0x890f('0x29')]);_0x20e206[_0x890f('0x2b')]=_['intersection'](_0x20e206[_0x890f('0x2c')],_0x20e206[_0x890f('0x29')]);_0x35d950[_0x890f('0x2d')]=_['intersection'](_0x20e206[_0x890f('0x2c')],qs[_0x890f('0x2e')](_0x1ed296[_0x890f('0x29')][_0x890f('0x2e')]));_0x35d950[_0x890f('0x2d')]=_0x35d950[_0x890f('0x2d')]['length']?_0x35d950[_0x890f('0x2d')]:_0x20e206[_0x890f('0x2c')];if(!_0x1ed296[_0x890f('0x29')]['hasOwnProperty'](_0x890f('0x2f'))){_0x35d950['limit']=qs[_0x890f('0x1c')](_0x1ed296[_0x890f('0x29')]['limit']);_0x35d950[_0x890f('0x1a')]=qs[_0x890f('0x1a')](_0x1ed296[_0x890f('0x29')][_0x890f('0x1a')]);}_0x35d950[_0x890f('0x30')]=qs[_0x890f('0x31')](_0x1ed296[_0x890f('0x29')][_0x890f('0x31')]);_0x35d950[_0x890f('0x32')]=qs[_0x890f('0x2b')](_[_0x890f('0x33')](_0x1ed296['query'],_0x20e206[_0x890f('0x2b')]),_0x2419cf);if(_0x1ed296[_0x890f('0x29')][_0x890f('0x34')]){_0x35d950['where']=_['merge'](_0x35d950[_0x890f('0x32')],{'$or':_[_0x890f('0x26')](_0x2419cf,function(_0x1dab51){if(_0x1dab51['type']!==_0x890f('0x35')){var _0x106d7f={};_0x106d7f[_0x1dab51[_0x890f('0x24')]]={'$like':'%'+_0x1ed296[_0x890f('0x29')]['filter']+'%'};return _0x106d7f;}})});}_0x35d950=_[_0x890f('0x36')]({},_0x35d950,_0x1ed296[_0x890f('0x37')]);var _0x34cf1a={'where':_0x35d950[_0x890f('0x32')]};return db[_0x890f('0x38')][_0x890f('0x1d')](_0x34cf1a)[_0x890f('0x22')](function(_0x47dee0){_0x1bf9ac[_0x890f('0x1d')]=_0x47dee0;if(_0x1ed296[_0x890f('0x29')][_0x890f('0x39')]){_0x35d950[_0x890f('0x3a')]=[{'all':!![]}];}return db[_0x890f('0x38')]['findAll'](_0x35d950);})[_0x890f('0x22')](function(_0x20e5bf){_0x1bf9ac[_0x890f('0x3b')]=_0x20e5bf;return _0x1bf9ac;})['then'](respondWithFilteredResult(_0x27b5f2,_0x35d950))[_0x890f('0x3c')](handleError(_0x27b5f2,null));};exports[_0x890f('0x3d')]=function(_0x2605dd,_0x406434){var _0x19acd7={'raw':![],'where':{'id':_0x2605dd['params']['id']}},_0x327d3c={};_0x327d3c[_0x890f('0x2c')]=_['keys'](db[_0x890f('0x38')][_0x890f('0x3e')]);_0x327d3c[_0x890f('0x29')]=_[_0x890f('0x2a')](_0x2605dd['query']);_0x327d3c['filters']=_[_0x890f('0x3f')](_0x327d3c[_0x890f('0x2c')],_0x327d3c['query']);_0x19acd7[_0x890f('0x2d')]=_[_0x890f('0x3f')](_0x327d3c['model'],qs[_0x890f('0x2e')](_0x2605dd['query'][_0x890f('0x2e')]));_0x19acd7['attributes']=_0x19acd7[_0x890f('0x2d')][_0x890f('0x40')]?_0x19acd7[_0x890f('0x2d')]:_0x327d3c['model'];if(_0x2605dd[_0x890f('0x29')][_0x890f('0x39')]){_0x19acd7['include']=[{'all':!![]}];}_0x19acd7=_[_0x890f('0x36')]({},_0x19acd7,_0x2605dd[_0x890f('0x37')]);return db[_0x890f('0x38')][_0x890f('0x41')](_0x19acd7)[_0x890f('0x22')](handleEntityNotFound(_0x406434,null))[_0x890f('0x22')](respondWithResult(_0x406434,null))['catch'](handleError(_0x406434,null));};exports['create']=function(_0x379dbb,_0x4fda38){return db[_0x890f('0x38')][_0x890f('0x42')](_0x379dbb[_0x890f('0x43')],{})[_0x890f('0x22')](respondWithResult(_0x4fda38,0xc9))[_0x890f('0x3c')](handleError(_0x4fda38,null));};exports[_0x890f('0x44')]=function(_0x2d62b7,_0x12bc19){if(_0x2d62b7['body']['id']){delete _0x2d62b7[_0x890f('0x43')]['id'];}return db[_0x890f('0x38')][_0x890f('0x41')]({'where':{'id':_0x2d62b7[_0x890f('0x45')]['id']}})['then'](handleEntityNotFound(_0x12bc19,null))['then'](saveUpdates(_0x2d62b7['body'],null))[_0x890f('0x22')](respondWithResult(_0x12bc19,null))[_0x890f('0x3c')](handleError(_0x12bc19,null));};exports[_0x890f('0x21')]=function(_0x1107c1,_0x7d44c3){return db[_0x890f('0x38')][_0x890f('0x41')]({'where':{'id':_0x1107c1[_0x890f('0x45')]['id']}})[_0x890f('0x22')](handleEntityNotFound(_0x7d44c3,null))['then'](removeEntity(_0x7d44c3,null))[_0x890f('0x3c')](handleError(_0x7d44c3,null));};exports[_0x890f('0x46')]=function(_0x2ff39d,_0x1ba713,_0x58332c){var _0x54e4b={};var _0x3d52c1={};var _0x147c45;var _0x501196;return db[_0x890f('0x38')][_0x890f('0x47')]({'where':{'id':_0x2ff39d[_0x890f('0x45')]['id']}})[_0x890f('0x22')](handleEntityNotFound(_0x1ba713,null))[_0x890f('0x22')](function(_0x1a6c2f){if(_0x1a6c2f){_0x147c45=_0x1a6c2f;_0x3d52c1['model']=_[_0x890f('0x2a')](db['ZohoConfiguration'][_0x890f('0x3e')]);_0x3d52c1[_0x890f('0x29')]=_['keys'](_0x2ff39d['query']);_0x3d52c1['filters']=_[_0x890f('0x3f')](_0x3d52c1[_0x890f('0x2c')],_0x3d52c1[_0x890f('0x29')]);_0x54e4b['attributes']=_[_0x890f('0x3f')](_0x3d52c1[_0x890f('0x2c')],qs['fields'](_0x2ff39d[_0x890f('0x29')][_0x890f('0x2e')]));_0x54e4b['attributes']=_0x54e4b[_0x890f('0x2d')][_0x890f('0x40')]?_0x54e4b[_0x890f('0x2d')]:_0x3d52c1[_0x890f('0x2c')];_0x54e4b[_0x890f('0x30')]=qs[_0x890f('0x31')](_0x2ff39d[_0x890f('0x29')][_0x890f('0x31')]);_0x54e4b[_0x890f('0x32')]=qs[_0x890f('0x2b')](_[_0x890f('0x33')](_0x2ff39d[_0x890f('0x29')],_0x3d52c1[_0x890f('0x2b')]));if(_0x2ff39d[_0x890f('0x29')]['filter']){_0x54e4b['where']=_[_0x890f('0x36')](_0x54e4b[_0x890f('0x32')],{'$or':_[_0x890f('0x26')](_0x54e4b['attributes'],function(_0x41c180){var _0x598268={};_0x598268[_0x41c180]={'$like':'%'+_0x2ff39d[_0x890f('0x29')][_0x890f('0x34')]+'%'};return _0x598268;})});}_0x54e4b=_[_0x890f('0x36')]({},_0x54e4b,_0x2ff39d['options']);return _0x147c45[_0x890f('0x46')](_0x54e4b);}})['then'](function(_0x219ba5){if(_0x219ba5){_0x501196=_0x219ba5[_0x890f('0x40')];if(!_0x2ff39d[_0x890f('0x29')][_0x890f('0x48')]('nolimit')){_0x54e4b[_0x890f('0x1c')]=qs[_0x890f('0x1c')](_0x2ff39d[_0x890f('0x29')][_0x890f('0x1c')]);_0x54e4b[_0x890f('0x1a')]=qs[_0x890f('0x1a')](_0x2ff39d[_0x890f('0x29')][_0x890f('0x1a')]);}return _0x147c45[_0x890f('0x46')](_0x54e4b);}})['then'](function(_0x1031dd){if(_0x1031dd){return _0x1031dd?{'count':_0x501196,'rows':_0x1031dd}:null;}})[_0x890f('0x22')](respondWithResult(_0x1ba713,null))[_0x890f('0x3c')](handleError(_0x1ba713,null));};exports[_0x890f('0x49')]=function(_0x1fef31,_0x352008,_0x1a5b9c){if(_0x1fef31['body']['id']){delete _0x1fef31[_0x890f('0x43')]['id'];}return db['ZohoAccount'][_0x890f('0x47')]({'where':{'id':_0x1fef31[_0x890f('0x45')]['id']}})[_0x890f('0x22')](handleEntityNotFound(_0x352008,null))[_0x890f('0x22')](function(_0x5943db){if(_0x5943db){_0x1fef31['body'][_0x890f('0x4a')]=_0x5943db['id'];_0x1fef31[_0x890f('0x43')]['Subjects']=integrations[_0x890f('0x4b')](_0x1fef31[_0x890f('0x43')][_0x890f('0x4c')],_0x1fef31[_0x890f('0x43')][_0x890f('0x4d')]);_0x1fef31[_0x890f('0x43')][_0x890f('0x4e')]=integrations[_0x890f('0x4f')](_0x1fef31['body'][_0x890f('0x4c')],_0x1fef31[_0x890f('0x43')][_0x890f('0x4d')]);return db[_0x890f('0x50')][_0x890f('0x42')](_0x1fef31[_0x890f('0x43')],{'include':[{'model':db[_0x890f('0x51')],'as':_0x890f('0x52')},{'model':db[_0x890f('0x51')],'as':_0x890f('0x4e')}]});}return null;})['then'](respondWithResult(_0x352008,null))[_0x890f('0x3c')](handleError(_0x352008,null));};function getAccessToken(_0x4ee137){return new Promise(function(_0x2bd8e9,_0x5c5c9a){var _0x5666a4;switch(_0x4ee137[_0x890f('0x53')]){case'US':_0x5666a4=_0x890f('0x54');break;case'AU':_0x5666a4=_0x890f('0x55');break;case'EU':_0x5666a4=_0x890f('0x56');break;case'IN':_0x5666a4=_0x890f('0x57');break;case'CN':_0x5666a4=_0x890f('0x58');break;default:_0x5666a4=_0x890f('0x56');break;}var _0x2a0d80={'method':_0x890f('0x59'),'uri':_0x5666a4+_0x890f('0x5a'),'qs':{'refresh_token':_0x4ee137[_0x890f('0x5b')],'client_id':_0x4ee137['clientId'],'client_secret':_0x4ee137[_0x890f('0x5c')],'grant_type':_0x890f('0x5d')},'json':!![]};return rp(_0x2a0d80)[_0x890f('0x22')](function(_0x7c2db9){if(_0x7c2db9[_0x890f('0x5e')]){_0x2bd8e9(_0x7c2db9['access_token']);}else{_0x5c5c9a(_0x890f('0x5f'));}})[_0x890f('0x3c')](function(_0x85c1ab){_0x5c5c9a(_0x85c1ab);});});}exports[_0x890f('0x60')]=function(_0x4c3ca5,_0x5eccc8,_0x26872f){var _0x401570,_0xe65ab2,_0x15228d,_0x3403a5,_0x2b4da4;return db[_0x890f('0x38')][_0x890f('0x47')]({'where':{'id':_0x4c3ca5[_0x890f('0x45')]['id']},'attributes':['id',_0x890f('0x61'),'zone',_0x890f('0x62'),_0x890f('0x5c'),_0x890f('0x63'),_0x890f('0x64'),_0x890f('0x5b')]})[_0x890f('0x22')](handleEntityNotFound(_0x5eccc8,null))[_0x890f('0x22')](function(_0xd4f0ba){_0x2b4da4=_0xd4f0ba;_0x401570=_0x2b4da4['host'];_0xe65ab2=_0x401570===_0x890f('0x65')?'eu':_0x890f('0x66');_0x15228d=_0x2b4da4[_0x890f('0x63')];var _0x3eb488=_0x15228d[_0x890f('0x67')](-0x1);if(_0x3eb488==='/'||_0x3eb488==='\x5c'||_0x3eb488===':'){_0x15228d=_0x15228d[_0x890f('0x68')](0x0,_0x15228d[_0x890f('0x69')](_0x3eb488));}if(!_0x2b4da4['refreshToken']){throw new Error(_0x890f('0x6a'));}return getAccessToken(_0x2b4da4);})[_0x890f('0x22')](function(_0x158ad8){if(_0x158ad8){return rp({'method':_0x890f('0x6b'),'uri':util['format'](_0x890f('0x6c'),_0xe65ab2),'qs':{'module':_0x890f('0x6d')},'headers':{'Authorization':_0x890f('0x6e')+_0x158ad8},'json':!![]});}})['then'](function(_0x21c095){if(_0x21c095){if(_0x21c095[_0x890f('0x6f')]&&_0x21c095[_0x890f('0x6f')][_0x890f('0x23')]){throw new Error(_0x21c095[_0x890f('0x6f')][_0x890f('0x23')][_0x890f('0x70')]);}var _0x53ee2f=[];var _0x46e06d=[];var _0x4e270d=[_0x890f('0x71'),_0x890f('0x72'),_0x890f('0x73'),_0x890f('0x74'),'Call_Duration',_0x890f('0x75'),'Call_Start_Time',_0x890f('0x76')];_0x46e06d=_['remove'](_0x21c095['fields'],function(_0x5493cf){return _0x4e270d['includes'](_0x5493cf[_0x890f('0x77')]);});for(var _0x548832=0x0;_0x548832<_0x46e06d[_0x890f('0x40')];_0x548832++){if(_0x46e06d[_0x548832]['system_mandatory']===![]){_0x53ee2f[_0x890f('0x78')]({'id':_0x46e06d[_0x548832]['id'],'name':_0x46e06d[_0x548832][_0x890f('0x79')],'custom':_0x46e06d[_0x548832][_0x890f('0x7a')],'options':_0x46e06d[_0x548832]['data_type']===_0x890f('0x7b')&&_0x46e06d[_0x548832][_0x890f('0x7c')][_0x890f('0x40')]>-0x1?_[_0x890f('0x26')](_0x46e06d[_0x548832][_0x890f('0x7c')],function(_0x2e3475){return{'name':_0x2e3475,'value':_0x2e3475};}):[]});}}return{'count':_0x53ee2f[_0x890f('0x40')],'rows':_0x53ee2f};}else{return{'count':0x0,'rows':[]};}})[_0x890f('0x22')](respondWithResult(_0x5eccc8,null))[_0x890f('0x3c')](function(_0x39a852){var _0x482bc1=_0x4c3ca5['query'][_0x890f('0x7d')]?0x1f4:_0x39a852[_0x890f('0x7e')]||0x1f4;logger[_0x890f('0x23')](_0x890f('0x7f'),_0x890f('0x60'),_0x482bc1,JSON[_0x890f('0x80')](_0x39a852));delete _0x39a852['name'];if(_0x482bc1===0x191){_0x482bc1=0x190;}_0x5eccc8[_0x890f('0x17')](_0x482bc1)[_0x890f('0x25')](_0x4c3ca5[_0x890f('0x29')][_0x890f('0x7d')]?{'message':_0x890f('0x81'),'statusCode':_0x39a852[_0x890f('0x7e')]}:_0x39a852);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index bbe0de2..2ed6c23 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 _0xd08b=['exports','define','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','parse','refresh_token','refreshToken','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','error','https://accounts.zoho.in','https://accounts.zoho.eu','POST','then','info','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration'];(function(_0x16aed,_0x217104){var _0x17fc32=function(_0x513bee){while(--_0x513bee){_0x16aed['push'](_0x16aed['shift']());}};_0x17fc32(++_0x217104);}(_0xd08b,0x156));var _0xbd08=function(_0x87506e,_0x5680ec){_0x87506e=_0x87506e-0x0;var _0x5496a4=_0xd08b[_0x87506e];return _0x5496a4;};'use strict';var _=require(_0xbd08('0x0'));var util=require(_0xbd08('0x1'));var logger=require(_0xbd08('0x2'))(_0xbd08('0x3'));var moment=require('moment');var BPromise=require(_0xbd08('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd08('0x5'));var rimraf=require(_0xbd08('0x6'));var config=require(_0xbd08('0x7'));var attributes=require(_0xbd08('0x8'));var integrations=require(_0xbd08('0x9'));module[_0xbd08('0xa')]=function(_0x82e3e2,_0x7cdb6f){return _0x82e3e2[_0xbd08('0xb')]('ZohoAccount',attributes,{'tableName':_0xbd08('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1655be,_0x3347f,_0x122d97){if(_0x1655be[_0xbd08('0xd')](_0xbd08('0xe'))||_0x1655be['changed'](_0xbd08('0xf'))||_0x1655be[_0xbd08('0xd')](_0xbd08('0x10'))||_0x1655be[_0xbd08('0xd')](_0xbd08('0x11'))||_0x1655be[_0xbd08('0xd')](_0xbd08('0x12'))||_0x1655be[_0xbd08('0xd')](_0xbd08('0x13'))){var _0x744d2d,_0x4bca43;_0x744d2d=_0x1655be['serverUrl'];var _0x435ed5=_0x744d2d[_0xbd08('0x14')](-0x1);if(_0x435ed5==='/'||_0x435ed5==='\x5c'||_0x435ed5===':'){_0x744d2d=_0x744d2d[_0xbd08('0x15')](0x0,_0x744d2d[_0xbd08('0x16')](_0x435ed5));}switch(_0x1655be[_0xbd08('0xe')]){case'US':_0x4bca43=_0xbd08('0x17');break;case'AU':_0x4bca43=_0xbd08('0x18');break;case'IN':_0x4bca43='https://accounts.zoho.in';break;case'CN':_0x4bca43=_0xbd08('0x19');break;default:_0x4bca43='https://accounts.zoho.eu';break;}var _0x508dd1={'method':'POST','uri':_0x4bca43+_0xbd08('0x1a'),'form':{'grant_type':_0xbd08('0x1b'),'client_id':_0x1655be['clientId'],'client_secret':_0x1655be[_0xbd08('0x11')],'redirect_uri':_0x1655be[_0xbd08('0xf')],'code':_0x1655be[_0xbd08('0x12')]},'headers':{'Content-Type':_0xbd08('0x1c')}};return rp(_0x508dd1)['then'](function(_0x2b3e81){var _0x1bebfe=JSON[_0xbd08('0x1d')](_0x2b3e81);if(_0x1bebfe[_0xbd08('0x1e')]){_0x1655be[_0xbd08('0x1f')]=_0x1bebfe['refresh_token'];logger['info'](util[_0xbd08('0x20')](_0xbd08('0x21'),_0x1655be[_0xbd08('0x22')],_0x1655be['id']));}else{logger['error'](util[_0xbd08('0x20')](_0xbd08('0x23'),_0x1655be[_0xbd08('0x22')],_0x1655be['id']),util[_0xbd08('0x24')](_0x1bebfe,{'showHidden':![],'depth':null}));}return _0x122d97(null,_0x3347f);})[_0xbd08('0x25')](function(_0x26f449){logger[_0xbd08('0x26')](util['format'](_0xbd08('0x23'),_0x1655be[_0xbd08('0x22')],_0x1655be['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x122d97(_0x26f449);});}else{return _0x122d97(null,_0x3347f);}},'beforeUpdate':function(_0x4cecca,_0x573e7f,_0x5e37e8){if(_0x4cecca[_0xbd08('0xd')](_0xbd08('0xe'))||_0x4cecca[_0xbd08('0xd')](_0xbd08('0xf'))||_0x4cecca[_0xbd08('0xd')]('clientId')||_0x4cecca[_0xbd08('0xd')](_0xbd08('0x11'))||_0x4cecca[_0xbd08('0xd')](_0xbd08('0x12'))||_0x4cecca[_0xbd08('0xd')](_0xbd08('0x13'))){var _0x422615,_0x27554a;_0x422615=_0x4cecca[_0xbd08('0xf')];var _0x10ac5a=_0x422615[_0xbd08('0x14')](-0x1);if(_0x10ac5a==='/'||_0x10ac5a==='\x5c'||_0x10ac5a===':'){_0x422615=_0x422615['substring'](0x0,_0x422615[_0xbd08('0x16')](_0x10ac5a));}switch(_0x4cecca[_0xbd08('0xe')]){case'US':_0x27554a='https://accounts.zoho.com';break;case'AU':_0x27554a=_0xbd08('0x18');break;case'IN':_0x27554a=_0xbd08('0x27');break;case'CN':_0x27554a=_0xbd08('0x19');break;default:_0x27554a=_0xbd08('0x28');break;}var _0x208952={'method':_0xbd08('0x29'),'uri':_0x27554a+_0xbd08('0x1a'),'form':{'grant_type':_0xbd08('0x1b'),'client_id':_0x4cecca[_0xbd08('0x10')],'client_secret':_0x4cecca[_0xbd08('0x11')],'redirect_uri':_0x4cecca[_0xbd08('0xf')],'code':_0x4cecca[_0xbd08('0x12')]},'headers':{'Content-Type':_0xbd08('0x1c')}};return rp(_0x208952)[_0xbd08('0x2a')](function(_0x87b6ab){var _0x1a4c79=JSON[_0xbd08('0x1d')](_0x87b6ab);if(_0x1a4c79[_0xbd08('0x1e')]){_0x4cecca[_0xbd08('0x1f')]=_0x1a4c79[_0xbd08('0x1e')];logger[_0xbd08('0x2b')](util[_0xbd08('0x20')](_0xbd08('0x21'),_0x4cecca[_0xbd08('0x22')],_0x4cecca['id']));}else{logger[_0xbd08('0x26')](util[_0xbd08('0x20')](_0xbd08('0x23'),_0x4cecca[_0xbd08('0x22')],_0x4cecca['id']),util['inspect'](_0x1a4c79,{'showHidden':![],'depth':null}));}return _0x5e37e8(null,_0x573e7f);})[_0xbd08('0x25')](function(_0x1687ed){logger['error'](util[_0xbd08('0x20')](_0xbd08('0x23'),_0x4cecca[_0xbd08('0x22')],_0x4cecca['id']),util[_0xbd08('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x5e37e8(_0x1687ed);});}else{return _0x5e37e8(null,_0x573e7f);}}}});}; \ No newline at end of file +var _0x9fa5=['authorization_code','code','application/x-www-form-urlencoded','parse','refresh_token','refreshToken','format','error','name','inspect','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','then','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','catch','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token'];(function(_0x355ce8,_0x5f1d0a){var _0x1db8b8=function(_0x277eb2){while(--_0x277eb2){_0x355ce8['push'](_0x355ce8['shift']());}};_0x1db8b8(++_0x5f1d0a);}(_0x9fa5,0x66));var _0x59fa=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x9fa5[_0x2b10c6];return _0x3789d2;};'use strict';var _=require('lodash');var util=require(_0x59fa('0x0'));var logger=require(_0x59fa('0x1'))(_0x59fa('0x2'));var moment=require(_0x59fa('0x3'));var BPromise=require(_0x59fa('0x4'));var rp=require(_0x59fa('0x5'));var fs=require('fs');var path=require(_0x59fa('0x6'));var rimraf=require('rimraf');var config=require(_0x59fa('0x7'));var attributes=require(_0x59fa('0x8'));var integrations=require(_0x59fa('0x9'));module[_0x59fa('0xa')]=function(_0x2f0132,_0x5c7d10){return _0x2f0132[_0x59fa('0xb')](_0x59fa('0xc'),attributes,{'tableName':_0x59fa('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x34ca2e,_0x6818cb,_0xa81fa7){if(_0x34ca2e[_0x59fa('0xe')](_0x59fa('0xf'))||_0x34ca2e[_0x59fa('0xe')](_0x59fa('0x10'))||_0x34ca2e[_0x59fa('0xe')](_0x59fa('0x11'))||_0x34ca2e['changed'](_0x59fa('0x12'))||_0x34ca2e['changed']('code')||_0x34ca2e[_0x59fa('0xe')](_0x59fa('0x13'))){var _0x26b81b,_0x13efe7;_0x26b81b=_0x34ca2e[_0x59fa('0x10')];var _0x5d7511=_0x26b81b[_0x59fa('0x14')](-0x1);if(_0x5d7511==='/'||_0x5d7511==='\x5c'||_0x5d7511===':'){_0x26b81b=_0x26b81b[_0x59fa('0x15')](0x0,_0x26b81b[_0x59fa('0x16')](_0x5d7511));}switch(_0x34ca2e[_0x59fa('0xf')]){case'US':_0x13efe7=_0x59fa('0x17');break;case'AU':_0x13efe7=_0x59fa('0x18');break;case'IN':_0x13efe7=_0x59fa('0x19');break;case'CN':_0x13efe7=_0x59fa('0x1a');break;default:_0x13efe7=_0x59fa('0x1b');break;}var _0x3c5276={'method':_0x59fa('0x1c'),'uri':_0x13efe7+_0x59fa('0x1d'),'form':{'grant_type':_0x59fa('0x1e'),'client_id':_0x34ca2e[_0x59fa('0x11')],'client_secret':_0x34ca2e['clientSecret'],'redirect_uri':_0x34ca2e['serverUrl'],'code':_0x34ca2e[_0x59fa('0x1f')]},'headers':{'Content-Type':_0x59fa('0x20')}};return rp(_0x3c5276)['then'](function(_0x10cfc1){var _0x1ebd6d=JSON[_0x59fa('0x21')](_0x10cfc1);if(_0x1ebd6d[_0x59fa('0x22')]){_0x34ca2e[_0x59fa('0x23')]=_0x1ebd6d['refresh_token'];logger['info'](util[_0x59fa('0x24')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x34ca2e['name'],_0x34ca2e['id']));}else{logger[_0x59fa('0x25')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x34ca2e[_0x59fa('0x26')],_0x34ca2e['id']),util[_0x59fa('0x27')](_0x1ebd6d,{'showHidden':![],'depth':null}));}return _0xa81fa7(null,_0x6818cb);})['catch'](function(_0x3709ac){logger['error'](util[_0x59fa('0x24')](_0x59fa('0x28'),_0x34ca2e['name'],_0x34ca2e['id']),util[_0x59fa('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0xa81fa7(_0x3709ac);});}else{return _0xa81fa7(null,_0x6818cb);}},'beforeUpdate':function(_0x54c880,_0x17ad68,_0x4fa5b5){if(_0x54c880['changed'](_0x59fa('0xf'))||_0x54c880[_0x59fa('0xe')](_0x59fa('0x10'))||_0x54c880[_0x59fa('0xe')](_0x59fa('0x11'))||_0x54c880[_0x59fa('0xe')](_0x59fa('0x12'))||_0x54c880['changed'](_0x59fa('0x1f'))||_0x54c880[_0x59fa('0xe')]('host')){var _0x11be51,_0x4c2cce;_0x11be51=_0x54c880[_0x59fa('0x10')];var _0x548208=_0x11be51[_0x59fa('0x14')](-0x1);if(_0x548208==='/'||_0x548208==='\x5c'||_0x548208===':'){_0x11be51=_0x11be51[_0x59fa('0x15')](0x0,_0x11be51['lastIndexOf'](_0x548208));}switch(_0x54c880[_0x59fa('0xf')]){case'US':_0x4c2cce=_0x59fa('0x17');break;case'AU':_0x4c2cce=_0x59fa('0x18');break;case'IN':_0x4c2cce=_0x59fa('0x19');break;case'CN':_0x4c2cce=_0x59fa('0x1a');break;default:_0x4c2cce=_0x59fa('0x1b');break;}var _0x1319e7={'method':'POST','uri':_0x4c2cce+_0x59fa('0x1d'),'form':{'grant_type':_0x59fa('0x1e'),'client_id':_0x54c880['clientId'],'client_secret':_0x54c880[_0x59fa('0x12')],'redirect_uri':_0x54c880['serverUrl'],'code':_0x54c880[_0x59fa('0x1f')]},'headers':{'Content-Type':_0x59fa('0x20')}};return rp(_0x1319e7)[_0x59fa('0x29')](function(_0x5d26f1){var _0xec52d3=JSON[_0x59fa('0x21')](_0x5d26f1);if(_0xec52d3['refresh_token']){_0x54c880['refreshToken']=_0xec52d3[_0x59fa('0x22')];logger['info'](util[_0x59fa('0x24')](_0x59fa('0x2a'),_0x54c880['name'],_0x54c880['id']));}else{logger[_0x59fa('0x25')](util['format'](_0x59fa('0x28'),_0x54c880[_0x59fa('0x26')],_0x54c880['id']),util[_0x59fa('0x27')](_0xec52d3,{'showHidden':![],'depth':null}));}return _0x4fa5b5(null,_0x17ad68);})[_0x59fa('0x2b')](function(_0x8199d1){logger[_0x59fa('0x25')](util[_0x59fa('0x24')](_0x59fa('0x28'),_0x54c880[_0x59fa('0x26')],_0x54c880['id']),util[_0x59fa('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x4fa5b5(_0x8199d1);});}else{return _0x4fa5b5(null,_0x17ad68);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 16759a1..cdb2513 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 _0xf777=['debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','info','result','catch','findAll','options','attributes','include','model','map','GetZohoAccount','ShowZohoAccount','ZohoAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','request\x20sent'];(function(_0x414ff1,_0xf0462b){var _0x29c53f=function(_0x1dab72){while(--_0x1dab72){_0x414ff1['push'](_0x414ff1['shift']());}};_0x29c53f(++_0xf0462b);}(_0xf777,0x1e9));var _0x7f77=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf777[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7f77('0x0'));var util=require(_0x7f77('0x1'));var moment=require(_0x7f77('0x2'));var BPromise=require(_0x7f77('0x3'));var rs=require(_0x7f77('0x4'));var fs=require('fs');var Redis=require(_0x7f77('0x5'));var db=require(_0x7f77('0x6'))['db'];var utils=require(_0x7f77('0x7'));var logger=require(_0x7f77('0x8'))('rpc');var config=require(_0x7f77('0x9'));var jayson=require(_0x7f77('0xa'));var client=jayson['client'][_0x7f77('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53df7d,_0x7bfea,_0x598934){return new BPromise(function(_0x87bd54,_0x322466){return client[_0x7f77('0xc')](_0x53df7d,_0x598934)[_0x7f77('0xd')](function(_0xc8bbae){logger['info']('ZohoAccount,\x20%s,\x20%s',_0x7bfea,_0x7f77('0xe'));logger[_0x7f77('0xf')](_0x7f77('0x10'),_0x7bfea,_0x7f77('0xe'),JSON[_0x7f77('0x11')](_0xc8bbae));if(_0xc8bbae['error']){if(_0xc8bbae[_0x7f77('0x12')][_0x7f77('0x13')]===0x1f4){logger[_0x7f77('0x12')](_0x7f77('0x14'),_0x7bfea,_0xc8bbae[_0x7f77('0x12')]['message']);return _0x322466(_0xc8bbae['error'][_0x7f77('0x15')]);}logger[_0x7f77('0x12')](_0x7f77('0x14'),_0x7bfea,_0xc8bbae[_0x7f77('0x12')][_0x7f77('0x15')]);return _0x87bd54(_0xc8bbae[_0x7f77('0x12')][_0x7f77('0x15')]);}else{logger[_0x7f77('0x16')](_0x7f77('0x14'),_0x7bfea,_0x7f77('0xe'));_0x87bd54(_0xc8bbae[_0x7f77('0x17')][_0x7f77('0x15')]);}})[_0x7f77('0x18')](function(_0x3f96e9){logger[_0x7f77('0x12')](_0x7f77('0x14'),_0x7bfea,_0x3f96e9);_0x322466(_0x3f96e9);});});}exports['GetZohoAccount']=function(_0x5b2c85){var _0x32221e=this;return new Promise(function(_0x53ec10,_0x159ef1){return db['ZohoAccount'][_0x7f77('0x19')]({'raw':_0x5b2c85[_0x7f77('0x1a')]?_0x5b2c85[_0x7f77('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5b2c85[_0x7f77('0x1a')]?_0x5b2c85[_0x7f77('0x1a')]['where']||null:null,'attributes':_0x5b2c85[_0x7f77('0x1a')]?_0x5b2c85[_0x7f77('0x1a')][_0x7f77('0x1b')]||null:null,'limit':_0x5b2c85['options']?_0x5b2c85[_0x7f77('0x1a')]['limit']||null:null,'include':_0x5b2c85['options']?_0x5b2c85[_0x7f77('0x1a')][_0x7f77('0x1c')]?_['map'](_0x5b2c85['options'][_0x7f77('0x1c')],function(_0x87e6b6){return{'model':db[_0x87e6b6[_0x7f77('0x1d')]],'as':_0x87e6b6['as'],'attributes':_0x87e6b6['attributes'],'include':_0x87e6b6['include']?_[_0x7f77('0x1e')](_0x87e6b6[_0x7f77('0x1c')],function(_0x303043){return{'model':db[_0x303043[_0x7f77('0x1d')]],'as':_0x303043['as'],'attributes':_0x303043[_0x7f77('0x1b')],'include':_0x303043[_0x7f77('0x1c')]?_['map'](_0x303043[_0x7f77('0x1c')],function(_0x4e38e4){return{'model':db[_0x4e38e4[_0x7f77('0x1d')]],'as':_0x4e38e4['as'],'attributes':_0x4e38e4[_0x7f77('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2bd7e0){logger[_0x7f77('0x16')]('GetZohoAccount',_0x5b2c85);logger[_0x7f77('0xf')]('GetZohoAccount',_0x5b2c85,JSON[_0x7f77('0x11')](_0x2bd7e0));_0x53ec10(_0x2bd7e0);})[_0x7f77('0x18')](function(_0x1bae99){logger[_0x7f77('0x12')](_0x7f77('0x1f'),_0x1bae99[_0x7f77('0x15')],_0x5b2c85);_0x159ef1(_0x32221e[_0x7f77('0x12')](0x1f4,_0x1bae99['message']));});});};exports[_0x7f77('0x20')]=function(_0x26c84c){var _0x19d93f=this;return new Promise(function(_0x41be46,_0x473c5f){return db[_0x7f77('0x21')][_0x7f77('0x22')]({'raw':_0x26c84c['options']?_0x26c84c['options']['raw']===undefined?!![]:![]:!![],'where':_0x26c84c[_0x7f77('0x1a')]?_0x26c84c[_0x7f77('0x1a')][_0x7f77('0x23')]||null:null,'attributes':_0x26c84c[_0x7f77('0x1a')]?_0x26c84c[_0x7f77('0x1a')][_0x7f77('0x1b')]||null:null,'include':_0x26c84c[_0x7f77('0x1a')]?_0x26c84c[_0x7f77('0x1a')][_0x7f77('0x1c')]?_[_0x7f77('0x1e')](_0x26c84c[_0x7f77('0x1a')]['include'],function(_0x2a96f2){return{'model':db[_0x2a96f2[_0x7f77('0x1d')]],'as':_0x2a96f2['as'],'attributes':_0x2a96f2[_0x7f77('0x1b')],'include':_0x2a96f2[_0x7f77('0x1c')]?_[_0x7f77('0x1e')](_0x2a96f2[_0x7f77('0x1c')],function(_0x307a71){return{'model':db[_0x307a71[_0x7f77('0x1d')]],'as':_0x307a71['as'],'attributes':_0x307a71[_0x7f77('0x1b')],'include':_0x307a71[_0x7f77('0x1c')]?_['map'](_0x307a71[_0x7f77('0x1c')],function(_0x57173c){return{'model':db[_0x57173c[_0x7f77('0x1d')]],'as':_0x57173c['as'],'attributes':_0x57173c[_0x7f77('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c4dda){logger[_0x7f77('0x16')](_0x7f77('0x20'),_0x26c84c);logger['debug'](_0x7f77('0x20'),_0x26c84c,JSON['stringify'](_0x5c4dda));_0x41be46(_0x5c4dda);})[_0x7f77('0x18')](function(_0x383001){logger['error'](_0x7f77('0x20'),_0x383001[_0x7f77('0x15')],_0x26c84c);_0x473c5f(_0x19d93f[_0x7f77('0x12')](0x1f4,_0x383001[_0x7f77('0x15')]));});});}; \ No newline at end of file +var _0xa017=['find','then','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','GetZohoAccount','ZohoAccount','options','raw','where','attributes','limit','include','map','model','catch','ShowZohoAccount'];(function(_0x52be4d,_0x1aea51){var _0xa5db0c=function(_0x5be466){while(--_0x5be466){_0x52be4d['push'](_0x52be4d['shift']());}};_0xa5db0c(++_0x1aea51);}(_0xa017,0x1f1));var _0x7a01=function(_0x4d64d0,_0x11d5bb){_0x4d64d0=_0x4d64d0-0x0;var _0x246aa2=_0xa017[_0x4d64d0];return _0x246aa2;};'use strict';var _=require(_0x7a01('0x0'));var util=require(_0x7a01('0x1'));var moment=require(_0x7a01('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a01('0x3'));var db=require(_0x7a01('0x4'))['db'];var utils=require(_0x7a01('0x5'));var logger=require(_0x7a01('0x6'))(_0x7a01('0x7'));var config=require(_0x7a01('0x8'));var jayson=require(_0x7a01('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x154915,_0x2ba0cd,_0x4e5cb2){return new BPromise(function(_0x501506,_0x5eb7eb){return client[_0x7a01('0xa')](_0x154915,_0x4e5cb2)['then'](function(_0x12fd3c){logger[_0x7a01('0xb')](_0x7a01('0xc'),_0x2ba0cd,_0x7a01('0xd'));logger[_0x7a01('0xe')](_0x7a01('0xf'),_0x2ba0cd,_0x7a01('0xd'),JSON['stringify'](_0x12fd3c));if(_0x12fd3c[_0x7a01('0x10')]){if(_0x12fd3c['error'][_0x7a01('0x11')]===0x1f4){logger[_0x7a01('0x10')](_0x7a01('0xc'),_0x2ba0cd,_0x12fd3c['error'][_0x7a01('0x12')]);return _0x5eb7eb(_0x12fd3c[_0x7a01('0x10')][_0x7a01('0x12')]);}logger[_0x7a01('0x10')](_0x7a01('0xc'),_0x2ba0cd,_0x12fd3c[_0x7a01('0x10')][_0x7a01('0x12')]);return _0x501506(_0x12fd3c[_0x7a01('0x10')][_0x7a01('0x12')]);}else{logger[_0x7a01('0xb')](_0x7a01('0xc'),_0x2ba0cd,_0x7a01('0xd'));_0x501506(_0x12fd3c['result']['message']);}})['catch'](function(_0x2ab749){logger['error'](_0x7a01('0xc'),_0x2ba0cd,_0x2ab749);_0x5eb7eb(_0x2ab749);});});}exports[_0x7a01('0x13')]=function(_0x280b49){var _0x489ad9=this;return new Promise(function(_0x21bdd8,_0xd8aef3){return db[_0x7a01('0x14')]['findAll']({'raw':_0x280b49[_0x7a01('0x15')]?_0x280b49[_0x7a01('0x15')][_0x7a01('0x16')]===undefined?!![]:![]:!![],'where':_0x280b49[_0x7a01('0x15')]?_0x280b49[_0x7a01('0x15')][_0x7a01('0x17')]||null:null,'attributes':_0x280b49[_0x7a01('0x15')]?_0x280b49[_0x7a01('0x15')][_0x7a01('0x18')]||null:null,'limit':_0x280b49[_0x7a01('0x15')]?_0x280b49[_0x7a01('0x15')][_0x7a01('0x19')]||null:null,'include':_0x280b49[_0x7a01('0x15')]?_0x280b49[_0x7a01('0x15')][_0x7a01('0x1a')]?_[_0x7a01('0x1b')](_0x280b49['options'][_0x7a01('0x1a')],function(_0x5f04bd){return{'model':db[_0x5f04bd[_0x7a01('0x1c')]],'as':_0x5f04bd['as'],'attributes':_0x5f04bd[_0x7a01('0x18')],'include':_0x5f04bd[_0x7a01('0x1a')]?_[_0x7a01('0x1b')](_0x5f04bd['include'],function(_0x2b647a){return{'model':db[_0x2b647a[_0x7a01('0x1c')]],'as':_0x2b647a['as'],'attributes':_0x2b647a[_0x7a01('0x18')],'include':_0x2b647a[_0x7a01('0x1a')]?_[_0x7a01('0x1b')](_0x2b647a[_0x7a01('0x1a')],function(_0x43a77f){return{'model':db[_0x43a77f[_0x7a01('0x1c')]],'as':_0x43a77f['as'],'attributes':_0x43a77f[_0x7a01('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d5374){logger[_0x7a01('0xb')](_0x7a01('0x13'),_0x280b49);logger[_0x7a01('0xe')](_0x7a01('0x13'),_0x280b49,JSON['stringify'](_0x4d5374));_0x21bdd8(_0x4d5374);})[_0x7a01('0x1d')](function(_0xaf8c9b){logger[_0x7a01('0x10')](_0x7a01('0x13'),_0xaf8c9b[_0x7a01('0x12')],_0x280b49);_0xd8aef3(_0x489ad9[_0x7a01('0x10')](0x1f4,_0xaf8c9b['message']));});});};exports[_0x7a01('0x1e')]=function(_0x541890){var _0xca0c9a=this;return new Promise(function(_0x4d01be,_0x2bbc28){return db['ZohoAccount'][_0x7a01('0x1f')]({'raw':_0x541890['options']?_0x541890[_0x7a01('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x541890['options']?_0x541890[_0x7a01('0x15')][_0x7a01('0x17')]||null:null,'attributes':_0x541890[_0x7a01('0x15')]?_0x541890[_0x7a01('0x15')]['attributes']||null:null,'include':_0x541890[_0x7a01('0x15')]?_0x541890[_0x7a01('0x15')][_0x7a01('0x1a')]?_[_0x7a01('0x1b')](_0x541890[_0x7a01('0x15')][_0x7a01('0x1a')],function(_0x399eb2){return{'model':db[_0x399eb2[_0x7a01('0x1c')]],'as':_0x399eb2['as'],'attributes':_0x399eb2[_0x7a01('0x18')],'include':_0x399eb2[_0x7a01('0x1a')]?_[_0x7a01('0x1b')](_0x399eb2[_0x7a01('0x1a')],function(_0x53d769){return{'model':db[_0x53d769[_0x7a01('0x1c')]],'as':_0x53d769['as'],'attributes':_0x53d769[_0x7a01('0x18')],'include':_0x53d769[_0x7a01('0x1a')]?_[_0x7a01('0x1b')](_0x53d769[_0x7a01('0x1a')],function(_0x5c8846){return{'model':db[_0x5c8846[_0x7a01('0x1c')]],'as':_0x5c8846['as'],'attributes':_0x5c8846[_0x7a01('0x18')]};}):[]};}):[]};}):[]:[]})[_0x7a01('0x20')](function(_0x87c2da){logger[_0x7a01('0xb')](_0x7a01('0x1e'),_0x541890);logger[_0x7a01('0xe')](_0x7a01('0x1e'),_0x541890,JSON['stringify'](_0x87c2da));_0x4d01be(_0x87c2da);})[_0x7a01('0x1d')](function(_0x58040b){logger[_0x7a01('0x10')](_0x7a01('0x1e'),_0x58040b['message'],_0x541890);_0x2bbc28(_0xca0c9a[_0x7a01('0x10')](0x1f4,_0x58040b[_0x7a01('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index dc3df92..8145025 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 _0xf46b=['./intZohoConfiguration.controller','isAuthenticated','index','get','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','/:id','update','delete','destroy','util','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x4a501c,_0x3ff943){var _0x44dc22=function(_0x1f6fc6){while(--_0x1f6fc6){_0x4a501c['push'](_0x4a501c['shift']());}};_0x44dc22(++_0x3ff943);}(_0xf46b,0x13f));var _0xbf46=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xf46b[_0x411017];return _0x2adeea;};'use strict';var multer=require('multer');var util=require(_0xbf46('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xbf46('0x1'));var auth=require(_0xbf46('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xbf46('0x3'));var controller=require(_0xbf46('0x4'));router['get']('/',auth[_0xbf46('0x5')](),controller[_0xbf46('0x6')]);router[_0xbf46('0x7')]('/:id',auth[_0xbf46('0x5')](),controller[_0xbf46('0x8')]);router['get'](_0xbf46('0x9'),auth[_0xbf46('0x5')](),controller[_0xbf46('0xa')]);router[_0xbf46('0x7')](_0xbf46('0xb'),auth[_0xbf46('0x5')](),controller['getSubjects']);router[_0xbf46('0x7')](_0xbf46('0xc'),auth[_0xbf46('0x5')](),controller[_0xbf46('0xd')]);router['post']('/',auth[_0xbf46('0x5')](),controller['create']);router[_0xbf46('0xe')](_0xbf46('0xf'),auth[_0xbf46('0x5')](),controller[_0xbf46('0x10')]);router[_0xbf46('0x11')](_0xbf46('0xf'),auth[_0xbf46('0x5')](),controller[_0xbf46('0x12')]);module['exports']=router; \ No newline at end of file +var _0x3e8f=['util','path','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','/:id/descriptions','post','create','delete','destroy'];(function(_0x34d78,_0x3f9f85){var _0x148ef9=function(_0x543344){while(--_0x543344){_0x34d78['push'](_0x34d78['shift']());}};_0x148ef9(++_0x3f9f85);}(_0x3e8f,0xb4));var _0xf3e8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e8f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xf3e8('0x0'));var path=require(_0xf3e8('0x1'));var timeout=require('connect-timeout');var express=require(_0xf3e8('0x2'));var router=express['Router']();var fs_extra=require(_0xf3e8('0x3'));var auth=require(_0xf3e8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf3e8('0x5'));var controller=require('./intZohoConfiguration.controller');router[_0xf3e8('0x6')]('/',auth[_0xf3e8('0x7')](),controller[_0xf3e8('0x8')]);router['get'](_0xf3e8('0x9'),auth[_0xf3e8('0x7')](),controller[_0xf3e8('0xa')]);router[_0xf3e8('0x6')]('/:id/fields',auth[_0xf3e8('0x7')](),controller[_0xf3e8('0xb')]);router[_0xf3e8('0x6')](_0xf3e8('0xc'),auth[_0xf3e8('0x7')](),controller['getSubjects']);router[_0xf3e8('0x6')](_0xf3e8('0xd'),auth[_0xf3e8('0x7')](),controller['getDescriptions']);router[_0xf3e8('0xe')]('/',auth[_0xf3e8('0x7')](),controller[_0xf3e8('0xf')]);router['put'](_0xf3e8('0x9'),auth[_0xf3e8('0x7')](),controller['update']);router[_0xf3e8('0x10')](_0xf3e8('0x9'),auth[_0xf3e8('0x7')](),controller[_0xf3e8('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index d4a89aa..b7413b0 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 _0xc155=['ENUM','contact_lead','sequelize','exports','STRING','lead','contact','nothing'];(function(_0x3f851c,_0x34f5ec){var _0x3c118b=function(_0xf8f993){while(--_0xf8f993){_0x3f851c['push'](_0x3f851c['shift']());}};_0x3c118b(++_0x34f5ec);}(_0xc155,0x16a));var _0x5c15=function(_0x20685d,_0x19c410){_0x20685d=_0x20685d-0x0;var _0x2446c0=_0xc155[_0x20685d];return _0x2446c0;};'use strict';var Sequelize=require(_0x5c15('0x0'));module[_0x5c15('0x1')]={'name':{'type':Sequelize[_0x5c15('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x5c15('0x3'),_0x5c15('0x4'),_0x5c15('0x5')),'defaultValue':_0x5c15('0x3')},'moduleSearch':{'type':Sequelize[_0x5c15('0x6')](_0x5c15('0x7'),'contact',_0x5c15('0x3')),'defaultValue':_0x5c15('0x7')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3bd3=['lead','contact','nothing','ENUM','contact_lead','STRING','sequelize','exports'];(function(_0x4a1694,_0x385775){var _0x5e5369=function(_0x4023fe){while(--_0x4023fe){_0x4a1694['push'](_0x4a1694['shift']());}};_0x5e5369(++_0x385775);}(_0x3bd3,0x1d6));var _0x33bd=function(_0x554990,_0x37a6f5){_0x554990=_0x554990-0x0;var _0x3ad0fc=_0x3bd3[_0x554990];return _0x3ad0fc;};'use strict';var Sequelize=require(_0x33bd('0x0'));module[_0x33bd('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize['ENUM'](_0x33bd('0x2'),_0x33bd('0x3'),_0x33bd('0x4')),'defaultValue':_0x33bd('0x2')},'moduleSearch':{'type':Sequelize[_0x33bd('0x5')](_0x33bd('0x6'),_0x33bd('0x3'),_0x33bd('0x2')),'defaultValue':_0x33bd('0x6')},'description':{'type':Sequelize[_0x33bd('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 5e3e42a..54a5212 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 _0x77c0=['sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','show','params','keys','length','create','body','catch','find','getFields','ZohoField','order','findOne','getSubjects','nolimit','getDescriptions','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0xbb14db,_0x3ee8c6){var _0x36bed7=function(_0x16c478){while(--_0x16c478){_0xbb14db['push'](_0xbb14db['shift']());}};_0x36bed7(++_0x3ee8c6);}(_0x77c0,0xd6));var _0x077c=function(_0x503f99,_0x515639){_0x503f99=_0x503f99-0x0;var _0x19ffd3=_0x77c0[_0x503f99];return _0x19ffd3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x077c('0x0'));var jsonpatch=require(_0x077c('0x1'));var rp=require(_0x077c('0x2'));var moment=require(_0x077c('0x3'));var BPromise=require(_0x077c('0x4'));var Mustache=require(_0x077c('0x5'));var util=require(_0x077c('0x6'));var path=require(_0x077c('0x7'));var sox=require(_0x077c('0x8'));var csv=require(_0x077c('0x9'));var ejs=require(_0x077c('0xa'));var fs=require('fs');var fs_extra=require(_0x077c('0xb'));var _=require(_0x077c('0xc'));var squel=require(_0x077c('0xd'));var crypto=require(_0x077c('0xe'));var jsforce=require(_0x077c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x077c('0x9'));var querystring=require(_0x077c('0x10'));var Papa=require(_0x077c('0x11'));var Redis=require(_0x077c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x077c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x077c('0x14'));var logger=require(_0x077c('0x15'))(_0x077c('0x16'));var utils=require(_0x077c('0x17'));var config=require(_0x077c('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x077c('0x19'))['db'];function respondWithStatusCode(_0x57f00a,_0xab0fd){_0xab0fd=_0xab0fd||0xcc;return function(_0x83bcd8){if(_0x83bcd8){return _0x57f00a[_0x077c('0x1a')](_0xab0fd);}return _0x57f00a[_0x077c('0x1b')](_0xab0fd)[_0x077c('0x1c')]();};}function respondWithResult(_0x11f81e,_0x502a03){_0x502a03=_0x502a03||0xc8;return function(_0x45b51c){if(_0x45b51c){return _0x11f81e['status'](_0x502a03)[_0x077c('0x1d')](_0x45b51c);}};}function respondWithFilteredResult(_0x28da58,_0x314ad0){return function(_0xc7c2b1){if(_0xc7c2b1){var _0x419668=typeof _0x314ad0[_0x077c('0x1e')]===_0x077c('0x1f')&&typeof _0x314ad0[_0x077c('0x20')]===_0x077c('0x1f');var _0x3dd651=_0xc7c2b1['count'];var _0x3553d2=_0x419668?0x0:_0x314ad0[_0x077c('0x1e')];var _0x58a607=_0x419668?_0xc7c2b1[_0x077c('0x21')]:_0x314ad0['offset']+_0x314ad0['limit'];var _0xd5e5dc;if(_0x58a607>=_0x3dd651){_0x58a607=_0x3dd651;_0xd5e5dc=0xc8;}else{_0xd5e5dc=0xce;}_0x28da58[_0x077c('0x1b')](_0xd5e5dc);return _0x28da58['set'](_0x077c('0x22'),_0x3553d2+'-'+_0x58a607+'/'+_0x3dd651)[_0x077c('0x1d')](_0xc7c2b1);}return null;};}function patchUpdates(_0x4eda98){return function(_0x5cd834){try{jsonpatch[_0x077c('0x23')](_0x5cd834,_0x4eda98,!![]);}catch(_0x8d0636){return BPromise[_0x077c('0x24')](_0x8d0636);}return _0x5cd834['save']();};}function saveUpdates(_0x445d70,_0x2262c4){return function(_0x52ac39){if(_0x52ac39){return _0x52ac39[_0x077c('0x25')](_0x445d70)[_0x077c('0x26')](function(_0xbb2f6){return _0xbb2f6;});}return null;};}function removeEntity(_0x31288c,_0x301f1a){return function(_0x433140){if(_0x433140){return _0x433140[_0x077c('0x27')]()[_0x077c('0x26')](function(){_0x31288c[_0x077c('0x1b')](0xcc)[_0x077c('0x1c')]();});}};}function handleEntityNotFound(_0x32ed07,_0x18e7f9){return function(_0xbb7cec){if(!_0xbb7cec){_0x32ed07[_0x077c('0x1a')](0x194);}return _0xbb7cec;};}function handleError(_0x20b410,_0x38ca3a){_0x38ca3a=_0x38ca3a||0x1f4;return function(_0x3b9939){logger[_0x077c('0x28')](_0x3b9939[_0x077c('0x29')]);if(_0x3b9939[_0x077c('0x2a')]){delete _0x3b9939[_0x077c('0x2a')];}_0x20b410[_0x077c('0x1b')](_0x38ca3a)['send'](_0x3b9939);};}exports['index']=function(_0x279f7f,_0x53b0fd){var _0x5979f8={},_0x3fd8c1={},_0x23236c={'count':0x0,'rows':[]};var _0x42be71=_['map'](db[_0x077c('0x2b')][_0x077c('0x2c')],function(_0x573eec){return{'name':_0x573eec[_0x077c('0x2d')],'type':_0x573eec[_0x077c('0x2e')][_0x077c('0x2f')]};});_0x3fd8c1[_0x077c('0x30')]=_['map'](_0x42be71,_0x077c('0x2a'));_0x3fd8c1[_0x077c('0x31')]=_['keys'](_0x279f7f[_0x077c('0x31')]);_0x3fd8c1[_0x077c('0x32')]=_[_0x077c('0x33')](_0x3fd8c1[_0x077c('0x30')],_0x3fd8c1[_0x077c('0x31')]);_0x5979f8[_0x077c('0x34')]=_[_0x077c('0x33')](_0x3fd8c1['model'],qs[_0x077c('0x35')](_0x279f7f['query'][_0x077c('0x35')]));_0x5979f8[_0x077c('0x34')]=_0x5979f8[_0x077c('0x34')]['length']?_0x5979f8[_0x077c('0x34')]:_0x3fd8c1[_0x077c('0x30')];if(!_0x279f7f[_0x077c('0x31')][_0x077c('0x36')]('nolimit')){_0x5979f8[_0x077c('0x20')]=qs[_0x077c('0x20')](_0x279f7f[_0x077c('0x31')][_0x077c('0x20')]);_0x5979f8['offset']=qs[_0x077c('0x1e')](_0x279f7f[_0x077c('0x31')][_0x077c('0x1e')]);}_0x5979f8['order']=qs['sort'](_0x279f7f[_0x077c('0x31')][_0x077c('0x37')]);_0x5979f8[_0x077c('0x38')]=qs['filters'](_[_0x077c('0x39')](_0x279f7f[_0x077c('0x31')],_0x3fd8c1['filters']),_0x42be71);if(_0x279f7f[_0x077c('0x31')][_0x077c('0x3a')]){_0x5979f8[_0x077c('0x38')]=_[_0x077c('0x3b')](_0x5979f8[_0x077c('0x38')],{'$or':_[_0x077c('0x3c')](_0x42be71,function(_0x4f4807){if(_0x4f4807[_0x077c('0x2e')]!=='VIRTUAL'){var _0x5dcd83={};_0x5dcd83[_0x4f4807[_0x077c('0x2a')]]={'$like':'%'+_0x279f7f['query']['filter']+'%'};return _0x5dcd83;}})});}_0x5979f8=_[_0x077c('0x3b')]({},_0x5979f8,_0x279f7f[_0x077c('0x3d')]);var _0x172c64={'where':_0x5979f8[_0x077c('0x38')]};return db[_0x077c('0x2b')][_0x077c('0x21')](_0x172c64)['then'](function(_0x464797){_0x23236c[_0x077c('0x21')]=_0x464797;if(_0x279f7f[_0x077c('0x31')][_0x077c('0x3e')]){_0x5979f8[_0x077c('0x3f')]=[{'all':!![]}];}return db[_0x077c('0x2b')][_0x077c('0x40')](_0x5979f8);})[_0x077c('0x26')](function(_0xc5f33a){_0x23236c['rows']=_0xc5f33a;return _0x23236c;})[_0x077c('0x26')](respondWithFilteredResult(_0x53b0fd,_0x5979f8))['catch'](handleError(_0x53b0fd,null));};exports[_0x077c('0x41')]=function(_0x13eb83,_0x24d5ee){var _0x4d7a8e={'raw':![],'where':{'id':_0x13eb83[_0x077c('0x42')]['id']}},_0x67fe92={};_0x67fe92[_0x077c('0x30')]=_['keys'](db[_0x077c('0x2b')][_0x077c('0x2c')]);_0x67fe92['query']=_[_0x077c('0x43')](_0x13eb83[_0x077c('0x31')]);_0x67fe92[_0x077c('0x32')]=_['intersection'](_0x67fe92[_0x077c('0x30')],_0x67fe92[_0x077c('0x31')]);_0x4d7a8e[_0x077c('0x34')]=_[_0x077c('0x33')](_0x67fe92[_0x077c('0x30')],qs[_0x077c('0x35')](_0x13eb83['query']['fields']));_0x4d7a8e[_0x077c('0x34')]=_0x4d7a8e[_0x077c('0x34')][_0x077c('0x44')]?_0x4d7a8e[_0x077c('0x34')]:_0x67fe92[_0x077c('0x30')];if(_0x13eb83[_0x077c('0x31')][_0x077c('0x3e')]){_0x4d7a8e[_0x077c('0x3f')]=[{'all':!![]}];}_0x4d7a8e=_[_0x077c('0x3b')]({},_0x4d7a8e,_0x13eb83[_0x077c('0x3d')]);return db[_0x077c('0x2b')]['find'](_0x4d7a8e)['then'](handleEntityNotFound(_0x24d5ee,null))[_0x077c('0x26')](respondWithResult(_0x24d5ee,null))['catch'](handleError(_0x24d5ee,null));};exports[_0x077c('0x45')]=function(_0x4750dc,_0xb75ec){return db[_0x077c('0x2b')][_0x077c('0x45')](_0x4750dc[_0x077c('0x46')],{})[_0x077c('0x26')](respondWithResult(_0xb75ec,0xc9))[_0x077c('0x47')](handleError(_0xb75ec,null));};exports['update']=function(_0x4e474e,_0x277f59){if(_0x4e474e[_0x077c('0x46')]['id']){delete _0x4e474e['body']['id'];}return db[_0x077c('0x2b')][_0x077c('0x48')]({'where':{'id':_0x4e474e['params']['id']}})[_0x077c('0x26')](handleEntityNotFound(_0x277f59,null))[_0x077c('0x26')](saveUpdates(_0x4e474e[_0x077c('0x46')],null))['then'](respondWithResult(_0x277f59,null))[_0x077c('0x47')](handleError(_0x277f59,null));};exports['destroy']=function(_0x56f4fc,_0x2a207e){return db[_0x077c('0x2b')]['find']({'where':{'id':_0x56f4fc[_0x077c('0x42')]['id']}})[_0x077c('0x26')](handleEntityNotFound(_0x2a207e,null))[_0x077c('0x26')](removeEntity(_0x2a207e,null))['catch'](handleError(_0x2a207e,null));};exports[_0x077c('0x49')]=function(_0x4d953c,_0x85c61,_0x51b8b7){var _0x88abad={};var _0x2424be={};var _0x39a830;var _0x11fd8a;return db[_0x077c('0x2b')]['findOne']({'where':{'id':_0x4d953c[_0x077c('0x42')]['id']}})[_0x077c('0x26')](handleEntityNotFound(_0x85c61,null))[_0x077c('0x26')](function(_0x2dd5fa){if(_0x2dd5fa){_0x39a830=_0x2dd5fa;_0x2424be['model']=_[_0x077c('0x43')](db[_0x077c('0x4a')]['rawAttributes']);_0x2424be[_0x077c('0x31')]=_[_0x077c('0x43')](_0x4d953c[_0x077c('0x31')]);_0x2424be[_0x077c('0x32')]=_['intersection'](_0x2424be['model'],_0x2424be['query']);_0x88abad[_0x077c('0x34')]=_[_0x077c('0x33')](_0x2424be['model'],qs[_0x077c('0x35')](_0x4d953c['query']['fields']));_0x88abad[_0x077c('0x34')]=_0x88abad[_0x077c('0x34')][_0x077c('0x44')]?_0x88abad['attributes']:_0x2424be[_0x077c('0x30')];_0x88abad[_0x077c('0x4b')]=qs['sort'](_0x4d953c[_0x077c('0x31')][_0x077c('0x37')]);_0x88abad[_0x077c('0x38')]=qs['filters'](_['pick'](_0x4d953c[_0x077c('0x31')],_0x2424be[_0x077c('0x32')]));if(_0x4d953c[_0x077c('0x31')][_0x077c('0x3a')]){_0x88abad[_0x077c('0x38')]=_[_0x077c('0x3b')](_0x88abad[_0x077c('0x38')],{'$or':_[_0x077c('0x3c')](_0x88abad[_0x077c('0x34')],function(_0x4be201){var _0x6c33cf={};_0x6c33cf[_0x4be201]={'$like':'%'+_0x4d953c[_0x077c('0x31')][_0x077c('0x3a')]+'%'};return _0x6c33cf;})});}_0x88abad=_[_0x077c('0x3b')]({},_0x88abad,_0x4d953c['options']);return _0x39a830[_0x077c('0x49')](_0x88abad);}})[_0x077c('0x26')](function(_0x4bab82){if(_0x4bab82){_0x11fd8a=_0x4bab82[_0x077c('0x44')];if(!_0x4d953c['query'][_0x077c('0x36')]('nolimit')){_0x88abad[_0x077c('0x20')]=qs[_0x077c('0x20')](_0x4d953c[_0x077c('0x31')][_0x077c('0x20')]);_0x88abad['offset']=qs[_0x077c('0x1e')](_0x4d953c['query'][_0x077c('0x1e')]);}return _0x39a830[_0x077c('0x49')](_0x88abad);}})[_0x077c('0x26')](function(_0x55a8e0){if(_0x55a8e0){return _0x55a8e0?{'count':_0x11fd8a,'rows':_0x55a8e0}:null;}})[_0x077c('0x26')](respondWithResult(_0x85c61,null))[_0x077c('0x47')](handleError(_0x85c61,null));};exports['getSubjects']=function(_0x276d9f,_0x49c72e,_0x5c2ccf){var _0x178e0f={};var _0x36b1cb={};var _0x30f24e;var _0xcc3d86;return db[_0x077c('0x2b')][_0x077c('0x4c')]({'where':{'id':_0x276d9f['params']['id']}})[_0x077c('0x26')](handleEntityNotFound(_0x49c72e,null))[_0x077c('0x26')](function(_0x7e821a){if(_0x7e821a){_0x30f24e=_0x7e821a;_0x36b1cb[_0x077c('0x30')]=_['keys'](db['ZohoField'][_0x077c('0x2c')]);_0x36b1cb[_0x077c('0x31')]=_[_0x077c('0x43')](_0x276d9f[_0x077c('0x31')]);_0x36b1cb[_0x077c('0x32')]=_[_0x077c('0x33')](_0x36b1cb[_0x077c('0x30')],_0x36b1cb[_0x077c('0x31')]);_0x178e0f[_0x077c('0x34')]=_[_0x077c('0x33')](_0x36b1cb[_0x077c('0x30')],qs[_0x077c('0x35')](_0x276d9f[_0x077c('0x31')][_0x077c('0x35')]));_0x178e0f['attributes']=_0x178e0f[_0x077c('0x34')][_0x077c('0x44')]?_0x178e0f[_0x077c('0x34')]:_0x36b1cb[_0x077c('0x30')];_0x178e0f[_0x077c('0x4b')]=qs[_0x077c('0x37')](_0x276d9f[_0x077c('0x31')][_0x077c('0x37')]);_0x178e0f['where']=qs[_0x077c('0x32')](_[_0x077c('0x39')](_0x276d9f[_0x077c('0x31')],_0x36b1cb['filters']));if(_0x276d9f[_0x077c('0x31')][_0x077c('0x3a')]){_0x178e0f['where']=_[_0x077c('0x3b')](_0x178e0f[_0x077c('0x38')],{'$or':_[_0x077c('0x3c')](_0x178e0f[_0x077c('0x34')],function(_0x30401d){var _0x52191a={};_0x52191a[_0x30401d]={'$like':'%'+_0x276d9f['query'][_0x077c('0x3a')]+'%'};return _0x52191a;})});}_0x178e0f=_[_0x077c('0x3b')]({},_0x178e0f,_0x276d9f[_0x077c('0x3d')]);return _0x30f24e[_0x077c('0x4d')](_0x178e0f);}})[_0x077c('0x26')](function(_0x2cf126){if(_0x2cf126){_0xcc3d86=_0x2cf126[_0x077c('0x44')];if(!_0x276d9f[_0x077c('0x31')][_0x077c('0x36')](_0x077c('0x4e'))){_0x178e0f['limit']=qs['limit'](_0x276d9f[_0x077c('0x31')][_0x077c('0x20')]);_0x178e0f[_0x077c('0x1e')]=qs[_0x077c('0x1e')](_0x276d9f['query'][_0x077c('0x1e')]);}return _0x30f24e[_0x077c('0x4d')](_0x178e0f);}})['then'](function(_0x1e20b9){if(_0x1e20b9){return _0x1e20b9?{'count':_0xcc3d86,'rows':_0x1e20b9}:null;}})[_0x077c('0x26')](respondWithResult(_0x49c72e,null))[_0x077c('0x47')](handleError(_0x49c72e,null));};exports['getDescriptions']=function(_0x50fb41,_0x4beab1,_0x4a02ae){var _0x477d97={};var _0x40d0f6={};var _0x3a1bbd;var _0x42b9de;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x50fb41[_0x077c('0x42')]['id']}})[_0x077c('0x26')](handleEntityNotFound(_0x4beab1,null))[_0x077c('0x26')](function(_0xc8b30a){if(_0xc8b30a){_0x3a1bbd=_0xc8b30a;_0x40d0f6[_0x077c('0x30')]=_['keys'](db['ZohoField']['rawAttributes']);_0x40d0f6[_0x077c('0x31')]=_[_0x077c('0x43')](_0x50fb41['query']);_0x40d0f6[_0x077c('0x32')]=_[_0x077c('0x33')](_0x40d0f6[_0x077c('0x30')],_0x40d0f6[_0x077c('0x31')]);_0x477d97[_0x077c('0x34')]=_[_0x077c('0x33')](_0x40d0f6[_0x077c('0x30')],qs[_0x077c('0x35')](_0x50fb41['query']['fields']));_0x477d97[_0x077c('0x34')]=_0x477d97['attributes'][_0x077c('0x44')]?_0x477d97['attributes']:_0x40d0f6[_0x077c('0x30')];_0x477d97[_0x077c('0x4b')]=qs[_0x077c('0x37')](_0x50fb41[_0x077c('0x31')][_0x077c('0x37')]);_0x477d97[_0x077c('0x38')]=qs[_0x077c('0x32')](_[_0x077c('0x39')](_0x50fb41[_0x077c('0x31')],_0x40d0f6[_0x077c('0x32')]));if(_0x50fb41['query'][_0x077c('0x3a')]){_0x477d97[_0x077c('0x38')]=_[_0x077c('0x3b')](_0x477d97[_0x077c('0x38')],{'$or':_[_0x077c('0x3c')](_0x477d97['attributes'],function(_0xd57c90){var _0x19e45a={};_0x19e45a[_0xd57c90]={'$like':'%'+_0x50fb41[_0x077c('0x31')]['filter']+'%'};return _0x19e45a;})});}_0x477d97=_[_0x077c('0x3b')]({},_0x477d97,_0x50fb41[_0x077c('0x3d')]);return _0x3a1bbd[_0x077c('0x4f')](_0x477d97);}})[_0x077c('0x26')](function(_0xf3880c){if(_0xf3880c){_0x42b9de=_0xf3880c[_0x077c('0x44')];if(!_0x50fb41[_0x077c('0x31')][_0x077c('0x36')](_0x077c('0x4e'))){_0x477d97[_0x077c('0x20')]=qs['limit'](_0x50fb41[_0x077c('0x31')][_0x077c('0x20')]);_0x477d97['offset']=qs['offset'](_0x50fb41[_0x077c('0x31')]['offset']);}return _0x3a1bbd[_0x077c('0x4f')](_0x477d97);}})[_0x077c('0x26')](function(_0x5c699c){if(_0x5c699c){return _0x5c699c?{'count':_0x42b9de,'rows':_0x5c699c}:null;}})[_0x077c('0x26')](respondWithResult(_0x4beab1,null))['catch'](handleError(_0x4beab1,null));}; \ No newline at end of file +var _0x3dd7=['request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','ZohoConfiguration','rawAttributes','fieldName','key','model','map','query','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','keys','create','body','find','params','getFields','findOne','ZohoField','hasOwnProperty','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch'];(function(_0x18148c,_0x432940){var _0x5ba33e=function(_0x30edca){while(--_0x30edca){_0x18148c['push'](_0x18148c['shift']());}};_0x5ba33e(++_0x432940);}(_0x3dd7,0x14d));var _0x73dd=function(_0xf39cf7,_0x4cfc3f){_0xf39cf7=_0xf39cf7-0x0;var _0x5cb052=_0x3dd7[_0xf39cf7];return _0x5cb052;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x73dd('0x0'));var zipdir=require(_0x73dd('0x1'));var jsonpatch=require(_0x73dd('0x2'));var rp=require(_0x73dd('0x3'));var moment=require(_0x73dd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x73dd('0x5'));var util=require(_0x73dd('0x6'));var path=require(_0x73dd('0x7'));var sox=require(_0x73dd('0x8'));var csv=require('to-csv');var ejs=require(_0x73dd('0x9'));var fs=require('fs');var fs_extra=require(_0x73dd('0xa'));var _=require(_0x73dd('0xb'));var squel=require('squel');var crypto=require(_0x73dd('0xc'));var jsforce=require(_0x73dd('0xd'));var deskjs=require(_0x73dd('0xe'));var toCsv=require(_0x73dd('0xf'));var querystring=require(_0x73dd('0x10'));var Papa=require(_0x73dd('0x11'));var Redis=require(_0x73dd('0x12'));var authService=require(_0x73dd('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x73dd('0x14'));var logger=require(_0x73dd('0x15'))(_0x73dd('0x16'));var utils=require(_0x73dd('0x17'));var config=require(_0x73dd('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x73dd('0x19'))['db'];function respondWithStatusCode(_0x5a5c5b,_0x154d11){_0x154d11=_0x154d11||0xcc;return function(_0x311391){if(_0x311391){return _0x5a5c5b[_0x73dd('0x1a')](_0x154d11);}return _0x5a5c5b[_0x73dd('0x1b')](_0x154d11)[_0x73dd('0x1c')]();};}function respondWithResult(_0x4316bc,_0x2aba59){_0x2aba59=_0x2aba59||0xc8;return function(_0x345445){if(_0x345445){return _0x4316bc[_0x73dd('0x1b')](_0x2aba59)[_0x73dd('0x1d')](_0x345445);}};}function respondWithFilteredResult(_0x5be669,_0x3fd962){return function(_0xc853ff){if(_0xc853ff){var _0x5e38ce=typeof _0x3fd962[_0x73dd('0x1e')]===_0x73dd('0x1f')&&typeof _0x3fd962['limit']==='undefined';var _0x5c0eca=_0xc853ff[_0x73dd('0x20')];var _0x1aedfc=_0x5e38ce?0x0:_0x3fd962[_0x73dd('0x1e')];var _0x43fa15=_0x5e38ce?_0xc853ff['count']:_0x3fd962[_0x73dd('0x1e')]+_0x3fd962['limit'];var _0x18c2b3;if(_0x43fa15>=_0x5c0eca){_0x43fa15=_0x5c0eca;_0x18c2b3=0xc8;}else{_0x18c2b3=0xce;}_0x5be669[_0x73dd('0x1b')](_0x18c2b3);return _0x5be669['set'](_0x73dd('0x21'),_0x1aedfc+'-'+_0x43fa15+'/'+_0x5c0eca)[_0x73dd('0x1d')](_0xc853ff);}return null;};}function patchUpdates(_0x1d4983){return function(_0x455fcd){try{jsonpatch[_0x73dd('0x22')](_0x455fcd,_0x1d4983,!![]);}catch(_0x125414){return BPromise[_0x73dd('0x23')](_0x125414);}return _0x455fcd[_0x73dd('0x24')]();};}function saveUpdates(_0x1289b4,_0x3aa075){return function(_0x5dc013){if(_0x5dc013){return _0x5dc013[_0x73dd('0x25')](_0x1289b4)[_0x73dd('0x26')](function(_0x135ec1){return _0x135ec1;});}return null;};}function removeEntity(_0x2eb2fa,_0x52708e){return function(_0xbea4a6){if(_0xbea4a6){return _0xbea4a6[_0x73dd('0x27')]()[_0x73dd('0x26')](function(){_0x2eb2fa[_0x73dd('0x1b')](0xcc)[_0x73dd('0x1c')]();});}};}function handleEntityNotFound(_0x2da973,_0x2fdf6a){return function(_0x28a1e9){if(!_0x28a1e9){_0x2da973['sendStatus'](0x194);}return _0x28a1e9;};}function handleError(_0xacb6c3,_0x68bc22){_0x68bc22=_0x68bc22||0x1f4;return function(_0x54eaa9){logger[_0x73dd('0x28')](_0x54eaa9[_0x73dd('0x29')]);if(_0x54eaa9[_0x73dd('0x2a')]){delete _0x54eaa9[_0x73dd('0x2a')];}_0xacb6c3[_0x73dd('0x1b')](_0x68bc22)[_0x73dd('0x2b')](_0x54eaa9);};}exports[_0x73dd('0x2c')]=function(_0x34fa9b,_0x2c8a31){var _0x261205={},_0x47c4d4={},_0x56f0f2={'count':0x0,'rows':[]};var _0x4dfca6=_['map'](db[_0x73dd('0x2d')][_0x73dd('0x2e')],function(_0x45bd4e){return{'name':_0x45bd4e[_0x73dd('0x2f')],'type':_0x45bd4e['type'][_0x73dd('0x30')]};});_0x47c4d4[_0x73dd('0x31')]=_[_0x73dd('0x32')](_0x4dfca6,_0x73dd('0x2a'));_0x47c4d4[_0x73dd('0x33')]=_['keys'](_0x34fa9b[_0x73dd('0x33')]);_0x47c4d4[_0x73dd('0x34')]=_['intersection'](_0x47c4d4['model'],_0x47c4d4[_0x73dd('0x33')]);_0x261205[_0x73dd('0x35')]=_[_0x73dd('0x36')](_0x47c4d4[_0x73dd('0x31')],qs[_0x73dd('0x37')](_0x34fa9b['query']['fields']));_0x261205[_0x73dd('0x35')]=_0x261205[_0x73dd('0x35')][_0x73dd('0x38')]?_0x261205[_0x73dd('0x35')]:_0x47c4d4[_0x73dd('0x31')];if(!_0x34fa9b['query']['hasOwnProperty'](_0x73dd('0x39'))){_0x261205[_0x73dd('0x3a')]=qs[_0x73dd('0x3a')](_0x34fa9b[_0x73dd('0x33')]['limit']);_0x261205['offset']=qs[_0x73dd('0x1e')](_0x34fa9b[_0x73dd('0x33')][_0x73dd('0x1e')]);}_0x261205[_0x73dd('0x3b')]=qs[_0x73dd('0x3c')](_0x34fa9b[_0x73dd('0x33')]['sort']);_0x261205[_0x73dd('0x3d')]=qs[_0x73dd('0x34')](_[_0x73dd('0x3e')](_0x34fa9b[_0x73dd('0x33')],_0x47c4d4[_0x73dd('0x34')]),_0x4dfca6);if(_0x34fa9b[_0x73dd('0x33')][_0x73dd('0x3f')]){_0x261205[_0x73dd('0x3d')]=_[_0x73dd('0x40')](_0x261205[_0x73dd('0x3d')],{'$or':_[_0x73dd('0x32')](_0x4dfca6,function(_0x2cdeff){if(_0x2cdeff[_0x73dd('0x41')]!=='VIRTUAL'){var _0xbbc17c={};_0xbbc17c[_0x2cdeff[_0x73dd('0x2a')]]={'$like':'%'+_0x34fa9b[_0x73dd('0x33')][_0x73dd('0x3f')]+'%'};return _0xbbc17c;}})});}_0x261205=_[_0x73dd('0x40')]({},_0x261205,_0x34fa9b[_0x73dd('0x42')]);var _0x25a8f9={'where':_0x261205[_0x73dd('0x3d')]};return db[_0x73dd('0x2d')][_0x73dd('0x20')](_0x25a8f9)[_0x73dd('0x26')](function(_0x13e864){_0x56f0f2[_0x73dd('0x20')]=_0x13e864;if(_0x34fa9b[_0x73dd('0x33')][_0x73dd('0x43')]){_0x261205[_0x73dd('0x44')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0x73dd('0x45')](_0x261205);})[_0x73dd('0x26')](function(_0x17dfb2){_0x56f0f2[_0x73dd('0x46')]=_0x17dfb2;return _0x56f0f2;})['then'](respondWithFilteredResult(_0x2c8a31,_0x261205))[_0x73dd('0x47')](handleError(_0x2c8a31,null));};exports[_0x73dd('0x48')]=function(_0x3694cb,_0x20b5d9){var _0x4ecae4={'raw':![],'where':{'id':_0x3694cb['params']['id']}},_0x71be6d={};_0x71be6d[_0x73dd('0x31')]=_['keys'](db['ZohoConfiguration'][_0x73dd('0x2e')]);_0x71be6d[_0x73dd('0x33')]=_[_0x73dd('0x49')](_0x3694cb[_0x73dd('0x33')]);_0x71be6d['filters']=_[_0x73dd('0x36')](_0x71be6d[_0x73dd('0x31')],_0x71be6d[_0x73dd('0x33')]);_0x4ecae4[_0x73dd('0x35')]=_[_0x73dd('0x36')](_0x71be6d[_0x73dd('0x31')],qs[_0x73dd('0x37')](_0x3694cb['query'][_0x73dd('0x37')]));_0x4ecae4[_0x73dd('0x35')]=_0x4ecae4[_0x73dd('0x35')][_0x73dd('0x38')]?_0x4ecae4[_0x73dd('0x35')]:_0x71be6d[_0x73dd('0x31')];if(_0x3694cb[_0x73dd('0x33')][_0x73dd('0x43')]){_0x4ecae4['include']=[{'all':!![]}];}_0x4ecae4=_['merge']({},_0x4ecae4,_0x3694cb[_0x73dd('0x42')]);return db[_0x73dd('0x2d')]['find'](_0x4ecae4)['then'](handleEntityNotFound(_0x20b5d9,null))['then'](respondWithResult(_0x20b5d9,null))[_0x73dd('0x47')](handleError(_0x20b5d9,null));};exports[_0x73dd('0x4a')]=function(_0x538873,_0x261c32){return db[_0x73dd('0x2d')][_0x73dd('0x4a')](_0x538873['body'],{})[_0x73dd('0x26')](respondWithResult(_0x261c32,0xc9))[_0x73dd('0x47')](handleError(_0x261c32,null));};exports[_0x73dd('0x25')]=function(_0x23e5b1,_0x555892){if(_0x23e5b1[_0x73dd('0x4b')]['id']){delete _0x23e5b1[_0x73dd('0x4b')]['id'];}return db[_0x73dd('0x2d')][_0x73dd('0x4c')]({'where':{'id':_0x23e5b1['params']['id']}})[_0x73dd('0x26')](handleEntityNotFound(_0x555892,null))[_0x73dd('0x26')](saveUpdates(_0x23e5b1[_0x73dd('0x4b')],null))[_0x73dd('0x26')](respondWithResult(_0x555892,null))[_0x73dd('0x47')](handleError(_0x555892,null));};exports['destroy']=function(_0x13355f,_0xf9584e){return db['ZohoConfiguration'][_0x73dd('0x4c')]({'where':{'id':_0x13355f[_0x73dd('0x4d')]['id']}})[_0x73dd('0x26')](handleEntityNotFound(_0xf9584e,null))[_0x73dd('0x26')](removeEntity(_0xf9584e,null))[_0x73dd('0x47')](handleError(_0xf9584e,null));};exports[_0x73dd('0x4e')]=function(_0x189d0,_0x59d359,_0x2546e8){var _0x2c1425={};var _0x496035={};var _0x2917e0;var _0x23a36c;return db[_0x73dd('0x2d')][_0x73dd('0x4f')]({'where':{'id':_0x189d0[_0x73dd('0x4d')]['id']}})[_0x73dd('0x26')](handleEntityNotFound(_0x59d359,null))[_0x73dd('0x26')](function(_0x29053b){if(_0x29053b){_0x2917e0=_0x29053b;_0x496035[_0x73dd('0x31')]=_['keys'](db[_0x73dd('0x50')]['rawAttributes']);_0x496035[_0x73dd('0x33')]=_[_0x73dd('0x49')](_0x189d0['query']);_0x496035['filters']=_[_0x73dd('0x36')](_0x496035['model'],_0x496035['query']);_0x2c1425[_0x73dd('0x35')]=_[_0x73dd('0x36')](_0x496035[_0x73dd('0x31')],qs[_0x73dd('0x37')](_0x189d0[_0x73dd('0x33')][_0x73dd('0x37')]));_0x2c1425[_0x73dd('0x35')]=_0x2c1425['attributes']['length']?_0x2c1425[_0x73dd('0x35')]:_0x496035[_0x73dd('0x31')];_0x2c1425[_0x73dd('0x3b')]=qs[_0x73dd('0x3c')](_0x189d0[_0x73dd('0x33')][_0x73dd('0x3c')]);_0x2c1425[_0x73dd('0x3d')]=qs['filters'](_[_0x73dd('0x3e')](_0x189d0[_0x73dd('0x33')],_0x496035['filters']));if(_0x189d0[_0x73dd('0x33')]['filter']){_0x2c1425['where']=_[_0x73dd('0x40')](_0x2c1425[_0x73dd('0x3d')],{'$or':_[_0x73dd('0x32')](_0x2c1425[_0x73dd('0x35')],function(_0x86a4c0){var _0x1e6c11={};_0x1e6c11[_0x86a4c0]={'$like':'%'+_0x189d0[_0x73dd('0x33')]['filter']+'%'};return _0x1e6c11;})});}_0x2c1425=_[_0x73dd('0x40')]({},_0x2c1425,_0x189d0[_0x73dd('0x42')]);return _0x2917e0[_0x73dd('0x4e')](_0x2c1425);}})[_0x73dd('0x26')](function(_0x124e58){if(_0x124e58){_0x23a36c=_0x124e58[_0x73dd('0x38')];if(!_0x189d0[_0x73dd('0x33')][_0x73dd('0x51')](_0x73dd('0x39'))){_0x2c1425[_0x73dd('0x3a')]=qs[_0x73dd('0x3a')](_0x189d0['query'][_0x73dd('0x3a')]);_0x2c1425[_0x73dd('0x1e')]=qs['offset'](_0x189d0['query']['offset']);}return _0x2917e0[_0x73dd('0x4e')](_0x2c1425);}})[_0x73dd('0x26')](function(_0x59d990){if(_0x59d990){return _0x59d990?{'count':_0x23a36c,'rows':_0x59d990}:null;}})[_0x73dd('0x26')](respondWithResult(_0x59d359,null))[_0x73dd('0x47')](handleError(_0x59d359,null));};exports['getSubjects']=function(_0x33894d,_0x5e6f36,_0x486d49){var _0xef07f={};var _0x54d008={};var _0xcbb698;var _0x14a740;return db['ZohoConfiguration'][_0x73dd('0x4f')]({'where':{'id':_0x33894d[_0x73dd('0x4d')]['id']}})[_0x73dd('0x26')](handleEntityNotFound(_0x5e6f36,null))[_0x73dd('0x26')](function(_0x385b2c){if(_0x385b2c){_0xcbb698=_0x385b2c;_0x54d008[_0x73dd('0x31')]=_[_0x73dd('0x49')](db[_0x73dd('0x50')][_0x73dd('0x2e')]);_0x54d008[_0x73dd('0x33')]=_[_0x73dd('0x49')](_0x33894d[_0x73dd('0x33')]);_0x54d008[_0x73dd('0x34')]=_[_0x73dd('0x36')](_0x54d008[_0x73dd('0x31')],_0x54d008[_0x73dd('0x33')]);_0xef07f[_0x73dd('0x35')]=_[_0x73dd('0x36')](_0x54d008[_0x73dd('0x31')],qs[_0x73dd('0x37')](_0x33894d[_0x73dd('0x33')][_0x73dd('0x37')]));_0xef07f['attributes']=_0xef07f[_0x73dd('0x35')][_0x73dd('0x38')]?_0xef07f[_0x73dd('0x35')]:_0x54d008[_0x73dd('0x31')];_0xef07f['order']=qs[_0x73dd('0x3c')](_0x33894d[_0x73dd('0x33')]['sort']);_0xef07f[_0x73dd('0x3d')]=qs[_0x73dd('0x34')](_[_0x73dd('0x3e')](_0x33894d['query'],_0x54d008[_0x73dd('0x34')]));if(_0x33894d[_0x73dd('0x33')][_0x73dd('0x3f')]){_0xef07f['where']=_[_0x73dd('0x40')](_0xef07f[_0x73dd('0x3d')],{'$or':_[_0x73dd('0x32')](_0xef07f[_0x73dd('0x35')],function(_0x338a57){var _0x4f0fe1={};_0x4f0fe1[_0x338a57]={'$like':'%'+_0x33894d[_0x73dd('0x33')][_0x73dd('0x3f')]+'%'};return _0x4f0fe1;})});}_0xef07f=_[_0x73dd('0x40')]({},_0xef07f,_0x33894d[_0x73dd('0x42')]);return _0xcbb698[_0x73dd('0x52')](_0xef07f);}})[_0x73dd('0x26')](function(_0x117521){if(_0x117521){_0x14a740=_0x117521[_0x73dd('0x38')];if(!_0x33894d[_0x73dd('0x33')][_0x73dd('0x51')](_0x73dd('0x39'))){_0xef07f[_0x73dd('0x3a')]=qs[_0x73dd('0x3a')](_0x33894d[_0x73dd('0x33')][_0x73dd('0x3a')]);_0xef07f[_0x73dd('0x1e')]=qs[_0x73dd('0x1e')](_0x33894d[_0x73dd('0x33')][_0x73dd('0x1e')]);}return _0xcbb698[_0x73dd('0x52')](_0xef07f);}})['then'](function(_0x27e877){if(_0x27e877){return _0x27e877?{'count':_0x14a740,'rows':_0x27e877}:null;}})['then'](respondWithResult(_0x5e6f36,null))[_0x73dd('0x47')](handleError(_0x5e6f36,null));};exports['getDescriptions']=function(_0x314dc0,_0x17c331,_0x42271a){var _0x24a7d9={};var _0x661136={};var _0x4c309b;var _0x591bd;return db['ZohoConfiguration'][_0x73dd('0x4f')]({'where':{'id':_0x314dc0[_0x73dd('0x4d')]['id']}})[_0x73dd('0x26')](handleEntityNotFound(_0x17c331,null))[_0x73dd('0x26')](function(_0x3bdef8){if(_0x3bdef8){_0x4c309b=_0x3bdef8;_0x661136[_0x73dd('0x31')]=_[_0x73dd('0x49')](db[_0x73dd('0x50')][_0x73dd('0x2e')]);_0x661136[_0x73dd('0x33')]=_['keys'](_0x314dc0[_0x73dd('0x33')]);_0x661136['filters']=_[_0x73dd('0x36')](_0x661136[_0x73dd('0x31')],_0x661136[_0x73dd('0x33')]);_0x24a7d9[_0x73dd('0x35')]=_[_0x73dd('0x36')](_0x661136[_0x73dd('0x31')],qs[_0x73dd('0x37')](_0x314dc0['query']['fields']));_0x24a7d9[_0x73dd('0x35')]=_0x24a7d9[_0x73dd('0x35')][_0x73dd('0x38')]?_0x24a7d9[_0x73dd('0x35')]:_0x661136[_0x73dd('0x31')];_0x24a7d9[_0x73dd('0x3b')]=qs[_0x73dd('0x3c')](_0x314dc0[_0x73dd('0x33')]['sort']);_0x24a7d9[_0x73dd('0x3d')]=qs['filters'](_['pick'](_0x314dc0[_0x73dd('0x33')],_0x661136['filters']));if(_0x314dc0[_0x73dd('0x33')]['filter']){_0x24a7d9['where']=_['merge'](_0x24a7d9[_0x73dd('0x3d')],{'$or':_[_0x73dd('0x32')](_0x24a7d9[_0x73dd('0x35')],function(_0x582777){var _0x443df4={};_0x443df4[_0x582777]={'$like':'%'+_0x314dc0[_0x73dd('0x33')][_0x73dd('0x3f')]+'%'};return _0x443df4;})});}_0x24a7d9=_[_0x73dd('0x40')]({},_0x24a7d9,_0x314dc0[_0x73dd('0x42')]);return _0x4c309b[_0x73dd('0x53')](_0x24a7d9);}})['then'](function(_0x592fb6){if(_0x592fb6){_0x591bd=_0x592fb6[_0x73dd('0x38')];if(!_0x314dc0[_0x73dd('0x33')][_0x73dd('0x51')](_0x73dd('0x39'))){_0x24a7d9[_0x73dd('0x3a')]=qs[_0x73dd('0x3a')](_0x314dc0[_0x73dd('0x33')][_0x73dd('0x3a')]);_0x24a7d9[_0x73dd('0x1e')]=qs[_0x73dd('0x1e')](_0x314dc0[_0x73dd('0x33')][_0x73dd('0x1e')]);}return _0x4c309b['getDescriptions'](_0x24a7d9);}})[_0x73dd('0x26')](function(_0x221fbc){if(_0x221fbc){return _0x221fbc?{'count':_0x591bd,'rows':_0x221fbc}:null;}})['then'](respondWithResult(_0x17c331,null))[_0x73dd('0x47')](handleError(_0x17c331,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index cc32874..6ce29a3 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 _0x2921=['../../config/environment','./intZohoConfiguration.attributes','ZohoConfiguration','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x2921,0xe9));var _0x1292=function(_0xd250dc,_0x477475){_0xd250dc=_0xd250dc-0x0;var _0x262281=_0x2921[_0xd250dc];return _0x262281;};'use strict';var _=require('lodash');var util=require(_0x1292('0x0'));var logger=require(_0x1292('0x1'))(_0x1292('0x2'));var moment=require(_0x1292('0x3'));var BPromise=require('bluebird');var rp=require(_0x1292('0x4'));var fs=require('fs');var path=require(_0x1292('0x5'));var rimraf=require(_0x1292('0x6'));var config=require(_0x1292('0x7'));var attributes=require(_0x1292('0x8'));module['exports']=function(_0x1e8608,_0x513240){return _0x1e8608['define'](_0x1292('0x9'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x65e6=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','int_zoho_configurations','util'];(function(_0x2b5513,_0x3fe5cd){var _0x578fd2=function(_0x7a9106){while(--_0x7a9106){_0x2b5513['push'](_0x2b5513['shift']());}};_0x578fd2(++_0x3fe5cd);}(_0x65e6,0xc5));var _0x665e=function(_0x127dd1,_0x13f078){_0x127dd1=_0x127dd1-0x0;var _0x421fd9=_0x65e6[_0x127dd1];return _0x421fd9;};'use strict';var _=require('lodash');var util=require(_0x665e('0x0'));var logger=require(_0x665e('0x1'))('api');var moment=require(_0x665e('0x2'));var BPromise=require(_0x665e('0x3'));var rp=require(_0x665e('0x4'));var fs=require('fs');var path=require(_0x665e('0x5'));var rimraf=require(_0x665e('0x6'));var config=require(_0x665e('0x7'));var attributes=require('./intZohoConfiguration.attributes');module[_0x665e('0x8')]=function(_0x58aed7,_0x1a9629){return _0x58aed7[_0x665e('0x9')]('ZohoConfiguration',attributes,{'tableName':_0x665e('0xa'),'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 c0052ca..0a75e29 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 _0x428d=['info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then'];(function(_0x2a2397,_0x32b017){var _0x1408f8=function(_0x132cb7){while(--_0x132cb7){_0x2a2397['push'](_0x2a2397['shift']());}};_0x1408f8(++_0x32b017);}(_0x428d,0xf1));var _0xd428=function(_0x4c311e,_0x1f7545){_0x4c311e=_0x4c311e-0x0;var _0x3235d4=_0x428d[_0x4c311e];return _0x3235d4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd428('0x0'));var BPromise=require(_0xd428('0x1'));var rs=require(_0xd428('0x2'));var fs=require('fs');var Redis=require(_0xd428('0x3'));var db=require(_0xd428('0x4'))['db'];var utils=require(_0xd428('0x5'));var logger=require(_0xd428('0x6'))(_0xd428('0x7'));var config=require('../../config/environment');var jayson=require(_0xd428('0x8'));var client=jayson['client'][_0xd428('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x161ef7,_0xc31787,_0x4c92c3){return new BPromise(function(_0x27aa2c,_0xbca24a){return client[_0xd428('0xa')](_0x161ef7,_0x4c92c3)[_0xd428('0xb')](function(_0x46e2e0){logger[_0xd428('0xc')](_0xd428('0xd'),_0xc31787,'request\x20sent');logger[_0xd428('0xe')](_0xd428('0xf'),_0xc31787,_0xd428('0x10'),JSON[_0xd428('0x11')](_0x46e2e0));if(_0x46e2e0[_0xd428('0x12')]){if(_0x46e2e0[_0xd428('0x12')][_0xd428('0x13')]===0x1f4){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0xc31787,_0x46e2e0[_0xd428('0x12')][_0xd428('0x14')]);return _0xbca24a(_0x46e2e0[_0xd428('0x12')]['message']);}logger[_0xd428('0x12')](_0xd428('0xd'),_0xc31787,_0x46e2e0['error'][_0xd428('0x14')]);return _0x27aa2c(_0x46e2e0[_0xd428('0x12')]['message']);}else{logger[_0xd428('0xc')](_0xd428('0xd'),_0xc31787,_0xd428('0x10'));_0x27aa2c(_0x46e2e0[_0xd428('0x15')]['message']);}})[_0xd428('0x16')](function(_0x265ac0){logger[_0xd428('0x12')](_0xd428('0xd'),_0xc31787,_0x265ac0);_0xbca24a(_0x265ac0);});});} \ No newline at end of file +var _0x0384=['lodash','util','moment','bluebird','ioredis','../../config/environment','jayson/promise','client','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','result','catch'];(function(_0x84d58b,_0x33da04){var _0x401807=function(_0x4e551a){while(--_0x4e551a){_0x84d58b['push'](_0x84d58b['shift']());}};_0x401807(++_0x33da04);}(_0x0384,0x13b));var _0x4038=function(_0x4de05d,_0x46b6e1){_0x4de05d=_0x4de05d-0x0;var _0x50d860=_0x0384[_0x4de05d];return _0x50d860;};'use strict';var _=require(_0x4038('0x0'));var util=require(_0x4038('0x1'));var moment=require(_0x4038('0x2'));var BPromise=require(_0x4038('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4038('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x4038('0x5'));var jayson=require(_0x4038('0x6'));var client=jayson[_0x4038('0x7')][_0x4038('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3ab2d2,_0x3c192a,_0x4c4388){return new BPromise(function(_0x410f2d,_0x28244f){return client[_0x4038('0x9')](_0x3ab2d2,_0x4c4388)[_0x4038('0xa')](function(_0x4e88ac){logger['info'](_0x4038('0xb'),_0x3c192a,_0x4038('0xc'));logger[_0x4038('0xd')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x3c192a,_0x4038('0xc'),JSON[_0x4038('0xe')](_0x4e88ac));if(_0x4e88ac['error']){if(_0x4e88ac['error'][_0x4038('0xf')]===0x1f4){logger[_0x4038('0x10')](_0x4038('0xb'),_0x3c192a,_0x4e88ac['error'][_0x4038('0x11')]);return _0x28244f(_0x4e88ac[_0x4038('0x10')][_0x4038('0x11')]);}logger['error'](_0x4038('0xb'),_0x3c192a,_0x4e88ac[_0x4038('0x10')][_0x4038('0x11')]);return _0x410f2d(_0x4e88ac[_0x4038('0x10')][_0x4038('0x11')]);}else{logger[_0x4038('0x12')](_0x4038('0xb'),_0x3c192a,_0x4038('0xc'));_0x410f2d(_0x4e88ac[_0x4038('0x13')]['message']);}})[_0x4038('0x14')](function(_0x1338e8){logger[_0x4038('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x3c192a,_0x1338e8);_0x28244f(_0x1338e8);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index be50cd7..3796a63 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 _0xcadb=['/:id','show','post','create','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index'];(function(_0x4cf431,_0x474e10){var _0x297905=function(_0x57887b){while(--_0x57887b){_0x4cf431['push'](_0x4cf431['shift']());}};_0x297905(++_0x474e10);}(_0xcadb,0x138));var _0xbcad=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xcadb[_0x4243a3];return _0x1b2a33;};'use strict';var multer=require(_0xbcad('0x0'));var util=require(_0xbcad('0x1'));var path=require('path');var timeout=require(_0xbcad('0x2'));var express=require(_0xbcad('0x3'));var router=express[_0xbcad('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbcad('0x5'));var config=require(_0xbcad('0x6'));var controller=require(_0xbcad('0x7'));router[_0xbcad('0x8')]('/',auth[_0xbcad('0x9')](),controller[_0xbcad('0xa')]);router[_0xbcad('0x8')](_0xbcad('0xb'),auth[_0xbcad('0x9')](),controller[_0xbcad('0xc')]);router[_0xbcad('0xd')]('/',auth['isAuthenticated'](),controller[_0xbcad('0xe')]);router['put'](_0xbcad('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xbcad('0xf')]);module[_0xbcad('0x10')]=router; \ No newline at end of file +var _0x2305=['post','create','delete','destroy','exports','multer','fs-extra','./intZohoField.controller','index','get','/:id','isAuthenticated','show'];(function(_0x43fb13,_0x30eb18){var _0x1728de=function(_0x4bbf4f){while(--_0x4bbf4f){_0x43fb13['push'](_0x43fb13['shift']());}};_0x1728de(++_0x30eb18);}(_0x2305,0x1e6));var _0x5230=function(_0x5e9a69,_0x40c0ec){_0x5e9a69=_0x5e9a69-0x0;var _0x5979c8=_0x2305[_0x5e9a69];return _0x5979c8;};'use strict';var multer=require(_0x5230('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x5230('0x1'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5230('0x2'));router['get']('/',auth['isAuthenticated'](),controller[_0x5230('0x3')]);router[_0x5230('0x4')](_0x5230('0x5'),auth[_0x5230('0x6')](),controller[_0x5230('0x7')]);router[_0x5230('0x8')]('/',auth[_0x5230('0x6')](),controller[_0x5230('0x9')]);router['put'](_0x5230('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x5230('0xa')](_0x5230('0x5'),auth[_0x5230('0x6')](),controller[_0x5230('0xb')]);module[_0x5230('0xc')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 1a47ad3..fc7a5ba 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 _0xff26=['exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize'];(function(_0x491566,_0x196068){var _0x4a84ba=function(_0x50c1c3){while(--_0x50c1c3){_0x491566['push'](_0x491566['shift']());}};_0x4a84ba(++_0x196068);}(_0xff26,0x1e9));var _0x6ff2=function(_0x1c490a,_0x217f34){_0x1c490a=_0x1c490a-0x0;var _0x1e0b1d=_0xff26[_0x1c490a];return _0x1e0b1d;};'use strict';var Sequelize=require(_0x6ff2('0x0'));module[_0x6ff2('0x1')]={'type':{'type':Sequelize[_0x6ff2('0x2')]('string',_0x6ff2('0x3'),_0x6ff2('0x4'),_0x6ff2('0x5'),_0x6ff2('0x6')),'defaultValue':_0x6ff2('0x7')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6ff2('0x8')]},'keyType':{'type':Sequelize[_0x6ff2('0x2')](_0x6ff2('0x7'),_0x6ff2('0x3'),_0x6ff2('0x4'))},'keyContent':{'type':Sequelize[_0x6ff2('0x8')]},'idField':{'type':Sequelize[_0x6ff2('0x8')]},'nameField':{'type':Sequelize[_0x6ff2('0x8')]},'customField':{'type':Sequelize[_0x6ff2('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4823=['variable','customVariable','keyValue','STRING','sequelize','exports','ENUM','string'];(function(_0x52f159,_0x419d8a){var _0x156799=function(_0xf168e8){while(--_0xf168e8){_0x52f159['push'](_0x52f159['shift']());}};_0x156799(++_0x419d8a);}(_0x4823,0x13c));var _0x3482=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0x4823[_0xc0a3d3];return _0x3386e8;};'use strict';var Sequelize=require(_0x3482('0x0'));module[_0x3482('0x1')]={'type':{'type':Sequelize[_0x3482('0x2')](_0x3482('0x3'),_0x3482('0x4'),_0x3482('0x5'),_0x3482('0x6'),'picklist'),'defaultValue':_0x3482('0x3')},'content':{'type':Sequelize[_0x3482('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3482('0x2')](_0x3482('0x3'),_0x3482('0x4'),_0x3482('0x5'))},'keyContent':{'type':Sequelize[_0x3482('0x7')]},'idField':{'type':Sequelize[_0x3482('0x7')]},'nameField':{'type':Sequelize[_0x3482('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 1fe94c3..9df2651 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 _0xff1e=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','destroy','error','name','send','index','map','ZohoField','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','rimraf','fast-json-patch','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x4327fe,_0x4f8040){var _0x138651=function(_0x418acc){while(--_0x418acc){_0x4327fe['push'](_0x4327fe['shift']());}};_0x138651(++_0x4f8040);}(_0xff1e,0x146));var _0xeff1=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0xff1e[_0x2080a3];return _0x8d7d17;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeff1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeff1('0x1'));var rp=require('request-promise');var moment=require(_0xeff1('0x2'));var BPromise=require(_0xeff1('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xeff1('0x4'));var csv=require(_0xeff1('0x5'));var ejs=require(_0xeff1('0x6'));var fs=require('fs');var fs_extra=require(_0xeff1('0x7'));var _=require(_0xeff1('0x8'));var squel=require(_0xeff1('0x9'));var crypto=require(_0xeff1('0xa'));var jsforce=require(_0xeff1('0xb'));var deskjs=require(_0xeff1('0xc'));var toCsv=require(_0xeff1('0x5'));var querystring=require(_0xeff1('0xd'));var Papa=require('papaparse');var Redis=require(_0xeff1('0xe'));var authService=require(_0xeff1('0xf'));var qs=require(_0xeff1('0x10'));var as=require(_0xeff1('0x11'));var hardwareService=require(_0xeff1('0x12'));var logger=require(_0xeff1('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xeff1('0x14'));var licenseUtil=require(_0xeff1('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3328e9,_0x508112){_0x508112=_0x508112||0xcc;return function(_0x25c7eb){if(_0x25c7eb){return _0x3328e9[_0xeff1('0x16')](_0x508112);}return _0x3328e9[_0xeff1('0x17')](_0x508112)[_0xeff1('0x18')]();};}function respondWithResult(_0x1b2849,_0x549b44){_0x549b44=_0x549b44||0xc8;return function(_0x5cf6d3){if(_0x5cf6d3){return _0x1b2849[_0xeff1('0x17')](_0x549b44)[_0xeff1('0x19')](_0x5cf6d3);}};}function respondWithFilteredResult(_0x57531c,_0x216a35){return function(_0x245891){if(_0x245891){var _0x30ad2c=typeof _0x216a35[_0xeff1('0x1a')]===_0xeff1('0x1b')&&typeof _0x216a35[_0xeff1('0x1c')]==='undefined';var _0x268ea4=_0x245891[_0xeff1('0x1d')];var _0x538292=_0x30ad2c?0x0:_0x216a35['offset'];var _0x3d8f4e=_0x30ad2c?_0x245891[_0xeff1('0x1d')]:_0x216a35[_0xeff1('0x1a')]+_0x216a35['limit'];var _0x5bf742;if(_0x3d8f4e>=_0x268ea4){_0x3d8f4e=_0x268ea4;_0x5bf742=0xc8;}else{_0x5bf742=0xce;}_0x57531c[_0xeff1('0x17')](_0x5bf742);return _0x57531c[_0xeff1('0x1e')]('Content-Range',_0x538292+'-'+_0x3d8f4e+'/'+_0x268ea4)[_0xeff1('0x19')](_0x245891);}return null;};}function patchUpdates(_0x34f5fa){return function(_0x27c3a3){try{jsonpatch['apply'](_0x27c3a3,_0x34f5fa,!![]);}catch(_0x43956a){return BPromise['reject'](_0x43956a);}return _0x27c3a3['save']();};}function saveUpdates(_0x19f585,_0x3c3227){return function(_0x212609){if(_0x212609){return _0x212609[_0xeff1('0x1f')](_0x19f585)[_0xeff1('0x20')](function(_0x48066d){return _0x48066d;});}return null;};}function removeEntity(_0x490ddb,_0x5f3967){return function(_0x453b24){if(_0x453b24){return _0x453b24[_0xeff1('0x21')]()[_0xeff1('0x20')](function(){_0x490ddb[_0xeff1('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f8322,_0x2c4fca){return function(_0x1de5c1){if(!_0x1de5c1){_0x4f8322[_0xeff1('0x16')](0x194);}return _0x1de5c1;};}function handleError(_0x5ac83d,_0x403fb0){_0x403fb0=_0x403fb0||0x1f4;return function(_0x429194){logger[_0xeff1('0x22')](_0x429194['stack']);if(_0x429194[_0xeff1('0x23')]){delete _0x429194['name'];}_0x5ac83d['status'](_0x403fb0)[_0xeff1('0x24')](_0x429194);};}exports[_0xeff1('0x25')]=function(_0x1c38fa,_0x3659f9){var _0x4f272e={},_0xeaa586={},_0x162ae0={'count':0x0,'rows':[]};var _0x2eeca6=_[_0xeff1('0x26')](db[_0xeff1('0x27')][_0xeff1('0x28')],function(_0x26b3dd){return{'name':_0x26b3dd[_0xeff1('0x29')],'type':_0x26b3dd[_0xeff1('0x2a')]['key']};});_0xeaa586[_0xeff1('0x2b')]=_[_0xeff1('0x26')](_0x2eeca6,_0xeff1('0x23'));_0xeaa586['query']=_[_0xeff1('0x2c')](_0x1c38fa[_0xeff1('0x2d')]);_0xeaa586[_0xeff1('0x2e')]=_[_0xeff1('0x2f')](_0xeaa586[_0xeff1('0x2b')],_0xeaa586[_0xeff1('0x2d')]);_0x4f272e[_0xeff1('0x30')]=_[_0xeff1('0x2f')](_0xeaa586['model'],qs[_0xeff1('0x31')](_0x1c38fa[_0xeff1('0x2d')][_0xeff1('0x31')]));_0x4f272e[_0xeff1('0x30')]=_0x4f272e[_0xeff1('0x30')][_0xeff1('0x32')]?_0x4f272e[_0xeff1('0x30')]:_0xeaa586[_0xeff1('0x2b')];if(!_0x1c38fa[_0xeff1('0x2d')][_0xeff1('0x33')]('nolimit')){_0x4f272e[_0xeff1('0x1c')]=qs['limit'](_0x1c38fa[_0xeff1('0x2d')][_0xeff1('0x1c')]);_0x4f272e['offset']=qs['offset'](_0x1c38fa[_0xeff1('0x2d')][_0xeff1('0x1a')]);}_0x4f272e['order']=qs[_0xeff1('0x34')](_0x1c38fa[_0xeff1('0x2d')][_0xeff1('0x34')]);_0x4f272e[_0xeff1('0x35')]=qs['filters'](_[_0xeff1('0x36')](_0x1c38fa[_0xeff1('0x2d')],_0xeaa586[_0xeff1('0x2e')]),_0x2eeca6);if(_0x1c38fa[_0xeff1('0x2d')][_0xeff1('0x37')]){_0x4f272e[_0xeff1('0x35')]=_[_0xeff1('0x38')](_0x4f272e[_0xeff1('0x35')],{'$or':_['map'](_0x2eeca6,function(_0x196445){if(_0x196445['type']!==_0xeff1('0x39')){var _0x578207={};_0x578207[_0x196445['name']]={'$like':'%'+_0x1c38fa['query'][_0xeff1('0x37')]+'%'};return _0x578207;}})});}_0x4f272e=_[_0xeff1('0x38')]({},_0x4f272e,_0x1c38fa[_0xeff1('0x3a')]);var _0x2b6c75={'where':_0x4f272e[_0xeff1('0x35')]};return db['ZohoField'][_0xeff1('0x1d')](_0x2b6c75)[_0xeff1('0x20')](function(_0x3c6dc5){_0x162ae0[_0xeff1('0x1d')]=_0x3c6dc5;if(_0x1c38fa[_0xeff1('0x2d')][_0xeff1('0x3b')]){_0x4f272e[_0xeff1('0x3c')]=[{'all':!![]}];}return db[_0xeff1('0x27')][_0xeff1('0x3d')](_0x4f272e);})[_0xeff1('0x20')](function(_0x81076a){_0x162ae0['rows']=_0x81076a;return _0x162ae0;})[_0xeff1('0x20')](respondWithFilteredResult(_0x3659f9,_0x4f272e))[_0xeff1('0x3e')](handleError(_0x3659f9,null));};exports[_0xeff1('0x3f')]=function(_0x33fb94,_0x32dfe5){var _0x38c7ef={'raw':!![],'where':{'id':_0x33fb94[_0xeff1('0x40')]['id']}},_0x27635d={};_0x27635d['model']=_[_0xeff1('0x2c')](db[_0xeff1('0x27')][_0xeff1('0x28')]);_0x27635d[_0xeff1('0x2d')]=_[_0xeff1('0x2c')](_0x33fb94[_0xeff1('0x2d')]);_0x27635d[_0xeff1('0x2e')]=_['intersection'](_0x27635d[_0xeff1('0x2b')],_0x27635d[_0xeff1('0x2d')]);_0x38c7ef[_0xeff1('0x30')]=_[_0xeff1('0x2f')](_0x27635d[_0xeff1('0x2b')],qs[_0xeff1('0x31')](_0x33fb94[_0xeff1('0x2d')][_0xeff1('0x31')]));_0x38c7ef[_0xeff1('0x30')]=_0x38c7ef[_0xeff1('0x30')][_0xeff1('0x32')]?_0x38c7ef[_0xeff1('0x30')]:_0x27635d[_0xeff1('0x2b')];if(_0x33fb94[_0xeff1('0x2d')][_0xeff1('0x3b')]){_0x38c7ef['include']=[{'all':!![]}];}_0x38c7ef=_[_0xeff1('0x38')]({},_0x38c7ef,_0x33fb94[_0xeff1('0x3a')]);return db[_0xeff1('0x27')][_0xeff1('0x41')](_0x38c7ef)[_0xeff1('0x20')](handleEntityNotFound(_0x32dfe5,null))[_0xeff1('0x20')](respondWithResult(_0x32dfe5,null))[_0xeff1('0x3e')](handleError(_0x32dfe5,null));};exports[_0xeff1('0x42')]=function(_0x46d523,_0x39982a){return db[_0xeff1('0x27')]['create'](_0x46d523['body'],{})[_0xeff1('0x20')](respondWithResult(_0x39982a,0xc9))[_0xeff1('0x3e')](handleError(_0x39982a,null));};exports[_0xeff1('0x1f')]=function(_0x580edd,_0x17fba7){if(_0x580edd[_0xeff1('0x43')]['id']){delete _0x580edd[_0xeff1('0x43')]['id'];}return db[_0xeff1('0x27')][_0xeff1('0x41')]({'where':{'id':_0x580edd[_0xeff1('0x40')]['id']}})[_0xeff1('0x20')](handleEntityNotFound(_0x17fba7,null))[_0xeff1('0x20')](saveUpdates(_0x580edd['body'],null))[_0xeff1('0x20')](respondWithResult(_0x17fba7,null))[_0xeff1('0x3e')](handleError(_0x17fba7,null));};exports[_0xeff1('0x21')]=function(_0xbdfadf,_0x5722a3){return db[_0xeff1('0x27')][_0xeff1('0x41')]({'where':{'id':_0xbdfadf[_0xeff1('0x40')]['id']}})[_0xeff1('0x20')](handleEntityNotFound(_0x5722a3,null))['then'](removeEntity(_0x5722a3,null))[_0xeff1('0x3e')](handleError(_0x5722a3,null));}; \ No newline at end of file +var _0xde44=['body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','name','index','ZohoField','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','pick','where','merge','map','VIRTUAL','filter','options','include','rows','catch','show','params','length','includeAll','create'];(function(_0x47b15f,_0x103e93){var _0x55bf25=function(_0x51fe7f){while(--_0x51fe7f){_0x47b15f['push'](_0x47b15f['shift']());}};_0x55bf25(++_0x103e93);}(_0xde44,0x160));var _0x4de4=function(_0x56192c,_0x504830){_0x56192c=_0x56192c-0x0;var _0x59b180=_0xde44[_0x56192c];return _0x59b180;};'use strict';var emlformat=require(_0x4de4('0x0'));var rimraf=require(_0x4de4('0x1'));var zipdir=require(_0x4de4('0x2'));var jsonpatch=require(_0x4de4('0x3'));var rp=require('request-promise');var moment=require(_0x4de4('0x4'));var BPromise=require(_0x4de4('0x5'));var Mustache=require(_0x4de4('0x6'));var util=require(_0x4de4('0x7'));var path=require(_0x4de4('0x8'));var sox=require('sox');var csv=require(_0x4de4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4de4('0xa'));var _=require(_0x4de4('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4de4('0xc'));var deskjs=require(_0x4de4('0xd'));var toCsv=require(_0x4de4('0x9'));var querystring=require('querystring');var Papa=require(_0x4de4('0xe'));var Redis=require('ioredis');var authService=require(_0x4de4('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4de4('0x10'));var hardwareService=require(_0x4de4('0x11'));var logger=require('../../config/logger')(_0x4de4('0x12'));var utils=require(_0x4de4('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4de4('0x14'))['db'];function respondWithStatusCode(_0xb1dc63,_0x2fc62a){_0x2fc62a=_0x2fc62a||0xcc;return function(_0x4c45f6){if(_0x4c45f6){return _0xb1dc63[_0x4de4('0x15')](_0x2fc62a);}return _0xb1dc63[_0x4de4('0x16')](_0x2fc62a)[_0x4de4('0x17')]();};}function respondWithResult(_0x510c05,_0x2a3513){_0x2a3513=_0x2a3513||0xc8;return function(_0x569f3a){if(_0x569f3a){return _0x510c05[_0x4de4('0x16')](_0x2a3513)[_0x4de4('0x18')](_0x569f3a);}};}function respondWithFilteredResult(_0x1d2729,_0x41ffdf){return function(_0x1af75d){if(_0x1af75d){var _0xd8bc81=typeof _0x41ffdf[_0x4de4('0x19')]===_0x4de4('0x1a')&&typeof _0x41ffdf['limit']===_0x4de4('0x1a');var _0x13a024=_0x1af75d[_0x4de4('0x1b')];var _0x524d02=_0xd8bc81?0x0:_0x41ffdf[_0x4de4('0x19')];var _0x3a0f4a=_0xd8bc81?_0x1af75d[_0x4de4('0x1b')]:_0x41ffdf[_0x4de4('0x19')]+_0x41ffdf[_0x4de4('0x1c')];var _0x3619c6;if(_0x3a0f4a>=_0x13a024){_0x3a0f4a=_0x13a024;_0x3619c6=0xc8;}else{_0x3619c6=0xce;}_0x1d2729[_0x4de4('0x16')](_0x3619c6);return _0x1d2729[_0x4de4('0x1d')](_0x4de4('0x1e'),_0x524d02+'-'+_0x3a0f4a+'/'+_0x13a024)[_0x4de4('0x18')](_0x1af75d);}return null;};}function patchUpdates(_0x1dfb0c){return function(_0x434297){try{jsonpatch[_0x4de4('0x1f')](_0x434297,_0x1dfb0c,!![]);}catch(_0x5e4bf2){return BPromise[_0x4de4('0x20')](_0x5e4bf2);}return _0x434297['save']();};}function saveUpdates(_0x177421,_0x1e4098){return function(_0x17f61f){if(_0x17f61f){return _0x17f61f[_0x4de4('0x21')](_0x177421)[_0x4de4('0x22')](function(_0x443d74){return _0x443d74;});}return null;};}function removeEntity(_0x32c8b3,_0x14aefb){return function(_0x52a43c){if(_0x52a43c){return _0x52a43c[_0x4de4('0x23')]()[_0x4de4('0x22')](function(){_0x32c8b3[_0x4de4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2683ce,_0x45e6c3){return function(_0x1c0b5f){if(!_0x1c0b5f){_0x2683ce[_0x4de4('0x15')](0x194);}return _0x1c0b5f;};}function handleError(_0x4a1cc8,_0x5bb923){_0x5bb923=_0x5bb923||0x1f4;return function(_0x3c5472){logger[_0x4de4('0x24')](_0x3c5472['stack']);if(_0x3c5472['name']){delete _0x3c5472[_0x4de4('0x25')];}_0x4a1cc8['status'](_0x5bb923)['send'](_0x3c5472);};}exports[_0x4de4('0x26')]=function(_0x9c2988,_0x1e3158){var _0x1a1f39={},_0x3205ff={},_0x4e5ee2={'count':0x0,'rows':[]};var _0x50664c=_['map'](db[_0x4de4('0x27')][_0x4de4('0x28')],function(_0x1f37bd){return{'name':_0x1f37bd[_0x4de4('0x29')],'type':_0x1f37bd['type'][_0x4de4('0x2a')]};});_0x3205ff[_0x4de4('0x2b')]=_['map'](_0x50664c,_0x4de4('0x25'));_0x3205ff['query']=_[_0x4de4('0x2c')](_0x9c2988[_0x4de4('0x2d')]);_0x3205ff[_0x4de4('0x2e')]=_[_0x4de4('0x2f')](_0x3205ff[_0x4de4('0x2b')],_0x3205ff['query']);_0x1a1f39[_0x4de4('0x30')]=_['intersection'](_0x3205ff[_0x4de4('0x2b')],qs[_0x4de4('0x31')](_0x9c2988[_0x4de4('0x2d')][_0x4de4('0x31')]));_0x1a1f39[_0x4de4('0x30')]=_0x1a1f39[_0x4de4('0x30')]['length']?_0x1a1f39['attributes']:_0x3205ff[_0x4de4('0x2b')];if(!_0x9c2988['query'][_0x4de4('0x32')](_0x4de4('0x33'))){_0x1a1f39['limit']=qs['limit'](_0x9c2988[_0x4de4('0x2d')][_0x4de4('0x1c')]);_0x1a1f39['offset']=qs[_0x4de4('0x19')](_0x9c2988['query'][_0x4de4('0x19')]);}_0x1a1f39[_0x4de4('0x34')]=qs['sort'](_0x9c2988[_0x4de4('0x2d')]['sort']);_0x1a1f39['where']=qs['filters'](_[_0x4de4('0x35')](_0x9c2988['query'],_0x3205ff['filters']),_0x50664c);if(_0x9c2988[_0x4de4('0x2d')]['filter']){_0x1a1f39[_0x4de4('0x36')]=_[_0x4de4('0x37')](_0x1a1f39[_0x4de4('0x36')],{'$or':_[_0x4de4('0x38')](_0x50664c,function(_0x44b71e){if(_0x44b71e['type']!==_0x4de4('0x39')){var _0x22118e={};_0x22118e[_0x44b71e[_0x4de4('0x25')]]={'$like':'%'+_0x9c2988[_0x4de4('0x2d')][_0x4de4('0x3a')]+'%'};return _0x22118e;}})});}_0x1a1f39=_[_0x4de4('0x37')]({},_0x1a1f39,_0x9c2988[_0x4de4('0x3b')]);var _0x44ca9c={'where':_0x1a1f39[_0x4de4('0x36')]};return db[_0x4de4('0x27')][_0x4de4('0x1b')](_0x44ca9c)[_0x4de4('0x22')](function(_0x507749){_0x4e5ee2[_0x4de4('0x1b')]=_0x507749;if(_0x9c2988[_0x4de4('0x2d')]['includeAll']){_0x1a1f39[_0x4de4('0x3c')]=[{'all':!![]}];}return db[_0x4de4('0x27')]['findAll'](_0x1a1f39);})[_0x4de4('0x22')](function(_0x370bb3){_0x4e5ee2[_0x4de4('0x3d')]=_0x370bb3;return _0x4e5ee2;})['then'](respondWithFilteredResult(_0x1e3158,_0x1a1f39))[_0x4de4('0x3e')](handleError(_0x1e3158,null));};exports[_0x4de4('0x3f')]=function(_0x2a3359,_0x4a7bfd){var _0xeca207={'raw':!![],'where':{'id':_0x2a3359[_0x4de4('0x40')]['id']}},_0x2696ae={};_0x2696ae[_0x4de4('0x2b')]=_[_0x4de4('0x2c')](db[_0x4de4('0x27')][_0x4de4('0x28')]);_0x2696ae[_0x4de4('0x2d')]=_[_0x4de4('0x2c')](_0x2a3359[_0x4de4('0x2d')]);_0x2696ae[_0x4de4('0x2e')]=_[_0x4de4('0x2f')](_0x2696ae[_0x4de4('0x2b')],_0x2696ae[_0x4de4('0x2d')]);_0xeca207['attributes']=_[_0x4de4('0x2f')](_0x2696ae[_0x4de4('0x2b')],qs[_0x4de4('0x31')](_0x2a3359['query'][_0x4de4('0x31')]));_0xeca207[_0x4de4('0x30')]=_0xeca207[_0x4de4('0x30')][_0x4de4('0x41')]?_0xeca207[_0x4de4('0x30')]:_0x2696ae[_0x4de4('0x2b')];if(_0x2a3359[_0x4de4('0x2d')][_0x4de4('0x42')]){_0xeca207[_0x4de4('0x3c')]=[{'all':!![]}];}_0xeca207=_[_0x4de4('0x37')]({},_0xeca207,_0x2a3359[_0x4de4('0x3b')]);return db[_0x4de4('0x27')]['find'](_0xeca207)[_0x4de4('0x22')](handleEntityNotFound(_0x4a7bfd,null))[_0x4de4('0x22')](respondWithResult(_0x4a7bfd,null))[_0x4de4('0x3e')](handleError(_0x4a7bfd,null));};exports[_0x4de4('0x43')]=function(_0x3c663d,_0x219eba){return db['ZohoField'][_0x4de4('0x43')](_0x3c663d['body'],{})[_0x4de4('0x22')](respondWithResult(_0x219eba,0xc9))['catch'](handleError(_0x219eba,null));};exports[_0x4de4('0x21')]=function(_0x5e0d5d,_0x3915e1){if(_0x5e0d5d[_0x4de4('0x44')]['id']){delete _0x5e0d5d[_0x4de4('0x44')]['id'];}return db['ZohoField']['find']({'where':{'id':_0x5e0d5d['params']['id']}})['then'](handleEntityNotFound(_0x3915e1,null))[_0x4de4('0x22')](saveUpdates(_0x5e0d5d[_0x4de4('0x44')],null))[_0x4de4('0x22')](respondWithResult(_0x3915e1,null))[_0x4de4('0x3e')](handleError(_0x3915e1,null));};exports[_0x4de4('0x23')]=function(_0x13b039,_0x15ed7a){return db[_0x4de4('0x27')][_0x4de4('0x45')]({'where':{'id':_0x13b039[_0x4de4('0x40')]['id']}})[_0x4de4('0x22')](handleEntityNotFound(_0x15ed7a,null))[_0x4de4('0x22')](removeEntity(_0x15ed7a,null))[_0x4de4('0x3e')](handleError(_0x15ed7a,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 0923521..1bdbfec 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 _0x27a0=['../../config/logger','api','moment','bluebird','./intZohoField.attributes','exports','define','ZohoField','zoho_unique_index','idField','FieldId','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x27a0,0xbf));var _0x027a=function(_0xecf62f,_0x42688d){_0xecf62f=_0xecf62f-0x0;var _0x5a5f85=_0x27a0[_0xecf62f];return _0x5a5f85;};'use strict';var _=require('lodash');var util=require(_0x027a('0x0'));var logger=require(_0x027a('0x1'))(_0x027a('0x2'));var moment=require(_0x027a('0x3'));var BPromise=require(_0x027a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x027a('0x5'));module[_0x027a('0x6')]=function(_0x137b09,_0x639bec){return _0x137b09[_0x027a('0x7')](_0x027a('0x8'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x027a('0x9'),'fields':[_0x027a('0xa'),_0x027a('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4137=['path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x16de68,_0x33d7ff){var _0x1c277e=function(_0x1d8549){while(--_0x1d8549){_0x16de68['push'](_0x16de68['shift']());}};_0x1c277e(++_0x33d7ff);}(_0x4137,0xf8));var _0x7413=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x4137[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var logger=require(_0x7413('0x2'))(_0x7413('0x3'));var moment=require(_0x7413('0x4'));var BPromise=require(_0x7413('0x5'));var rp=require(_0x7413('0x6'));var fs=require('fs');var path=require(_0x7413('0x7'));var rimraf=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var attributes=require(_0x7413('0xa'));module[_0x7413('0xb')]=function(_0x4fbade,_0xc808cd){return _0x4fbade[_0x7413('0xc')](_0x7413('0xd'),attributes,{'tableName':_0x7413('0xe'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x7413('0xf'),_0x7413('0x10')],'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 83b78a8..db76efc 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 _0x8843=['error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x7b6064,_0x23b8b7){var _0x5109a8=function(_0x42c8e6){while(--_0x42c8e6){_0x7b6064['push'](_0x7b6064['shift']());}};_0x5109a8(++_0x23b8b7);}(_0x8843,0x118));var _0x3884=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x8843[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require(_0x3884('0x0'));var util=require(_0x3884('0x1'));var moment=require(_0x3884('0x2'));var BPromise=require(_0x3884('0x3'));var rs=require(_0x3884('0x4'));var fs=require('fs');var Redis=require(_0x3884('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3884('0x6'))(_0x3884('0x7'));var config=require(_0x3884('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3884('0x9')][_0x3884('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b813b,_0x38f099,_0x432789){return new BPromise(function(_0x18e86b,_0x23b9c7){return client[_0x3884('0xb')](_0x4b813b,_0x432789)[_0x3884('0xc')](function(_0x11f47a){logger[_0x3884('0xd')](_0x3884('0xe'),_0x38f099,_0x3884('0xf'));logger[_0x3884('0x10')](_0x3884('0x11'),_0x38f099,_0x3884('0xf'),JSON[_0x3884('0x12')](_0x11f47a));if(_0x11f47a[_0x3884('0x13')]){if(_0x11f47a['error'][_0x3884('0x14')]===0x1f4){logger[_0x3884('0x13')](_0x3884('0xe'),_0x38f099,_0x11f47a[_0x3884('0x13')]['message']);return _0x23b9c7(_0x11f47a[_0x3884('0x13')]['message']);}logger[_0x3884('0x13')](_0x3884('0xe'),_0x38f099,_0x11f47a[_0x3884('0x13')][_0x3884('0x15')]);return _0x18e86b(_0x11f47a[_0x3884('0x13')]['message']);}else{logger['info'](_0x3884('0xe'),_0x38f099,_0x3884('0xf'));_0x18e86b(_0x11f47a['result'][_0x3884('0x15')]);}})[_0x3884('0x16')](function(_0x1d6325){logger['error'](_0x3884('0xe'),_0x38f099,_0x1d6325);_0x23b9c7(_0x1d6325);});});} \ No newline at end of file +var _0x9d8f=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','randomstring','ioredis'];(function(_0x2b082f,_0xc51aec){var _0x1059a2=function(_0x2a73ba){while(--_0x2a73ba){_0x2b082f['push'](_0x2b082f['shift']());}};_0x1059a2(++_0xc51aec);}(_0x9d8f,0xc2));var _0xf9d8=function(_0x5a80e6,_0x2623f1){_0x5a80e6=_0x5a80e6-0x0;var _0x36e78d=_0x9d8f[_0x5a80e6];return _0x36e78d;};'use strict';var _=require('lodash');var util=require(_0xf9d8('0x0'));var moment=require(_0xf9d8('0x1'));var BPromise=require('bluebird');var rs=require(_0xf9d8('0x2'));var fs=require('fs');var Redis=require(_0xf9d8('0x3'));var db=require(_0xf9d8('0x4'))['db'];var utils=require(_0xf9d8('0x5'));var logger=require(_0xf9d8('0x6'))(_0xf9d8('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf9d8('0x8')][_0xf9d8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ea578,_0x55775c,_0x414813){return new BPromise(function(_0x3dccac,_0x44bb5f){return client[_0xf9d8('0xa')](_0x1ea578,_0x414813)[_0xf9d8('0xb')](function(_0x190e29){logger[_0xf9d8('0xc')](_0xf9d8('0xd'),_0x55775c,_0xf9d8('0xe'));logger[_0xf9d8('0xf')](_0xf9d8('0x10'),_0x55775c,_0xf9d8('0xe'),JSON[_0xf9d8('0x11')](_0x190e29));if(_0x190e29[_0xf9d8('0x12')]){if(_0x190e29[_0xf9d8('0x12')][_0xf9d8('0x13')]===0x1f4){logger[_0xf9d8('0x12')](_0xf9d8('0xd'),_0x55775c,_0x190e29['error'][_0xf9d8('0x14')]);return _0x44bb5f(_0x190e29[_0xf9d8('0x12')]['message']);}logger['error'](_0xf9d8('0xd'),_0x55775c,_0x190e29[_0xf9d8('0x12')][_0xf9d8('0x14')]);return _0x3dccac(_0x190e29[_0xf9d8('0x12')][_0xf9d8('0x14')]);}else{logger[_0xf9d8('0xc')](_0xf9d8('0xd'),_0x55775c,_0xf9d8('0xe'));_0x3dccac(_0x190e29['result']['message']);}})[_0xf9d8('0x15')](function(_0x4b8491){logger[_0xf9d8('0x12')](_0xf9d8('0xd'),_0x55775c,_0x4b8491);_0x44bb5f(_0x4b8491);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index fde68fd..d69817c 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4f4d19,_0x574245){var _0x27a258=function(_0x38da3e){while(--_0x38da3e){_0x4f4d19['push'](_0x4f4d19['shift']());}};_0x27a258(++_0x574245);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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(_0xfe9631,_0x4a43c5){var _0x355a4e=function(_0x47385e){while(--_0x47385e){_0xfe9631['push'](_0xfe9631['shift']());}};_0x355a4e(++_0x4a43c5);}(_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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index cfe28cc..73c7ebe 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 _0x5859=['state','sequelize','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN'];(function(_0x1f5546,_0x1e4cb0){var _0x3afc5f=function(_0x22e456){while(--_0x22e456){_0x1f5546['push'](_0x1f5546['shift']());}};_0x3afc5f(++_0x1e4cb0);}(_0x5859,0xe8));var _0x9585=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x5859[_0x32f7d7];return _0x133d09;};'use strict';var Sequelize=require(_0x9585('0x0'));module['exports']={'name':{'type':Sequelize[_0x9585('0x1')],'allowNull':![],'unique':_0x9585('0x2')},'version':{'type':Sequelize[_0x9585('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x9585('0x1')],'defaultValue':_0x9585('0x3')},'filename':{'type':Sequelize[_0x9585('0x1')]},'path':{'type':Sequelize[_0x9585('0x1')]},'type':{'type':Sequelize[_0x9585('0x1')]},'size':{'type':Sequelize[_0x9585('0x4')]},'active':{'type':Sequelize[_0x9585('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x9585('0x1')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x9585('0x1')],'unique':_0x9585('0x6')},'description':{'type':Sequelize[_0x9585('0x1')]},'title':{'type':Sequelize[_0x9585('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x9585('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x4413=['INTEGER','BOOLEAN','state','exports','STRING','unique_name_and_version','app.js'];(function(_0x4017b0,_0x4347db){var _0x5ed4f7=function(_0x706c26){while(--_0x706c26){_0x4017b0['push'](_0x4017b0['shift']());}};_0x5ed4f7(++_0x4347db);}(_0x4413,0x1b5));var _0x3441=function(_0x15eee8,_0x5dcdb7){_0x15eee8=_0x15eee8-0x0;var _0x5ee03b=_0x4413[_0x15eee8];return _0x5ee03b;};'use strict';var Sequelize=require('sequelize');module[_0x3441('0x0')]={'name':{'type':Sequelize[_0x3441('0x1')],'allowNull':![],'unique':_0x3441('0x2')},'version':{'type':Sequelize[_0x3441('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x3441('0x1')],'defaultValue':_0x3441('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x3441('0x1')]},'type':{'type':Sequelize[_0x3441('0x1')]},'size':{'type':Sequelize[_0x3441('0x4')]},'active':{'type':Sequelize[_0x3441('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x3441('0x1')]},'logo':{'type':Sequelize[_0x3441('0x1')]},'state':{'type':Sequelize[_0x3441('0x1')],'unique':_0x3441('0x6')},'description':{'type':Sequelize[_0x3441('0x1')]},'title':{'type':Sequelize[_0x3441('0x1')]},'remoteUri':{'type':Sequelize[_0x3441('0x1')]},'link':{'type':Sequelize[_0x3441('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index f9dfef1..0808ecb 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 _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(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x5496,0x175));var _0x6549=function(_0xcb39af,_0xdf90d9){_0xcb39af=_0xcb39af-0x0;var _0x430c69=_0x5496[_0xcb39af];return _0x430c69;};'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 +var _0xe3da=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','Integration','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','order','sort','where','pick','map','VIRTUAL','filter','merge','options','count','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse'];(function(_0x29f60e,_0x295358){var _0x587be1=function(_0x15607e){while(--_0x15607e){_0x29f60e['push'](_0x29f60e['shift']());}};_0x587be1(++_0x295358);}(_0xe3da,0x1cd));var _0xae3d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe3da[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0xae3d('0x0'));var rimraf=require(_0xae3d('0x1'));var zipdir=require(_0xae3d('0x2'));var jsonpatch=require(_0xae3d('0x3'));var rp=require(_0xae3d('0x4'));var moment=require(_0xae3d('0x5'));var BPromise=require(_0xae3d('0x6'));var Mustache=require(_0xae3d('0x7'));var util=require(_0xae3d('0x8'));var path=require(_0xae3d('0x9'));var sox=require(_0xae3d('0xa'));var csv=require(_0xae3d('0xb'));var ejs=require(_0xae3d('0xc'));var fs=require('fs');var fs_extra=require(_0xae3d('0xd'));var _=require(_0xae3d('0xe'));var squel=require(_0xae3d('0xf'));var crypto=require('crypto');var jsforce=require(_0xae3d('0x10'));var deskjs=require(_0xae3d('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xae3d('0x12'));var Redis=require(_0xae3d('0x13'));var authService=require(_0xae3d('0x14'));var qs=require(_0xae3d('0x15'));var as=require(_0xae3d('0x16'));var hardwareService=require(_0xae3d('0x17'));var logger=require('../../config/logger')(_0xae3d('0x18'));var utils=require('../../config/utils');var config=require(_0xae3d('0x19'));var licenseUtil=require(_0xae3d('0x1a'));var db=require(_0xae3d('0x1b'))['db'];function respondWithStatusCode(_0x172f7a,_0x48aa74){_0x48aa74=_0x48aa74||0xcc;return function(_0xfb7869){if(_0xfb7869){return _0x172f7a[_0xae3d('0x1c')](_0x48aa74);}return _0x172f7a[_0xae3d('0x1d')](_0x48aa74)[_0xae3d('0x1e')]();};}function respondWithResult(_0x2afdd3,_0x430659){_0x430659=_0x430659||0xc8;return function(_0x31498d){if(_0x31498d){return _0x2afdd3['status'](_0x430659)[_0xae3d('0x1f')](_0x31498d);}};}function respondWithFilteredResult(_0x42f4b4,_0x46295b){return function(_0x230afb){if(_0x230afb){var _0x192c13=typeof _0x46295b[_0xae3d('0x20')]==='undefined'&&typeof _0x46295b[_0xae3d('0x21')]===_0xae3d('0x22');var _0x2e31f1=_0x230afb['count'];var _0x3f8cf9=_0x192c13?0x0:_0x46295b[_0xae3d('0x20')];var _0x558e42=_0x192c13?_0x230afb['count']:_0x46295b[_0xae3d('0x20')]+_0x46295b[_0xae3d('0x21')];var _0x19c44d;if(_0x558e42>=_0x2e31f1){_0x558e42=_0x2e31f1;_0x19c44d=0xc8;}else{_0x19c44d=0xce;}_0x42f4b4[_0xae3d('0x1d')](_0x19c44d);return _0x42f4b4[_0xae3d('0x23')]('Content-Range',_0x3f8cf9+'-'+_0x558e42+'/'+_0x2e31f1)[_0xae3d('0x1f')](_0x230afb);}return null;};}function patchUpdates(_0x48f00e){return function(_0x4a09c2){try{jsonpatch[_0xae3d('0x24')](_0x4a09c2,_0x48f00e,!![]);}catch(_0x1415e8){return BPromise[_0xae3d('0x25')](_0x1415e8);}return _0x4a09c2[_0xae3d('0x26')]();};}function saveUpdates(_0x3e7afc,_0x26c419){return function(_0x155099){if(_0x155099){return _0x155099[_0xae3d('0x27')](_0x3e7afc)[_0xae3d('0x28')](function(_0x300be8){return _0x300be8;});}return null;};}function removeEntity(_0x9bf34a,_0x37f5ff){return function(_0x1b2acb){if(_0x1b2acb){return _0x1b2acb[_0xae3d('0x29')]()[_0xae3d('0x28')](function(){_0x9bf34a[_0xae3d('0x1d')](0xcc)[_0xae3d('0x1e')]();});}};}function handleEntityNotFound(_0x2131e9,_0x1b1217){return function(_0x5d45db){if(!_0x5d45db){_0x2131e9[_0xae3d('0x1c')](0x194);}return _0x5d45db;};}function handleError(_0x185e71,_0xb5940){_0xb5940=_0xb5940||0x1f4;return function(_0x52df0f){logger[_0xae3d('0x2a')](_0x52df0f[_0xae3d('0x2b')]);if(_0x52df0f[_0xae3d('0x2c')]){delete _0x52df0f['name'];}_0x185e71['status'](_0xb5940)[_0xae3d('0x2d')](_0x52df0f);};}exports[_0xae3d('0x2e')]=function(_0x3a5840,_0x3114f9){var _0xb69ec9={},_0x561371={},_0x1d1483={'count':0x0,'rows':[]};var _0x3a2434=_['map'](db[_0xae3d('0x2f')][_0xae3d('0x30')],function(_0x2cf750){return{'name':_0x2cf750[_0xae3d('0x31')],'type':_0x2cf750[_0xae3d('0x32')][_0xae3d('0x33')]};});_0x561371['model']=_['map'](_0x3a2434,'name');_0x561371[_0xae3d('0x34')]=_[_0xae3d('0x35')](_0x3a5840[_0xae3d('0x34')]);_0x561371[_0xae3d('0x36')]=_['intersection'](_0x561371[_0xae3d('0x37')],_0x561371[_0xae3d('0x34')]);_0xb69ec9[_0xae3d('0x38')]=_[_0xae3d('0x39')](_0x561371[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0x3a5840[_0xae3d('0x34')]['fields']));_0xb69ec9[_0xae3d('0x38')]=_0xb69ec9['attributes']['length']?_0xb69ec9[_0xae3d('0x38')]:_0x561371['model'];if(!_0x3a5840[_0xae3d('0x34')]['hasOwnProperty']('nolimit')){_0xb69ec9[_0xae3d('0x21')]=qs[_0xae3d('0x21')](_0x3a5840[_0xae3d('0x34')]['limit']);_0xb69ec9[_0xae3d('0x20')]=qs['offset'](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x20')]);}_0xb69ec9[_0xae3d('0x3b')]=qs[_0xae3d('0x3c')](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x3c')]);_0xb69ec9[_0xae3d('0x3d')]=qs[_0xae3d('0x36')](_[_0xae3d('0x3e')](_0x3a5840[_0xae3d('0x34')],_0x561371[_0xae3d('0x36')]),_0x3a2434);if(_0x3a5840['query']['filter']){_0xb69ec9[_0xae3d('0x3d')]=_['merge'](_0xb69ec9[_0xae3d('0x3d')],{'$or':_[_0xae3d('0x3f')](_0x3a2434,function(_0x1db3c1){if(_0x1db3c1[_0xae3d('0x32')]!==_0xae3d('0x40')){var _0x35db44={};_0x35db44[_0x1db3c1[_0xae3d('0x2c')]]={'$like':'%'+_0x3a5840[_0xae3d('0x34')][_0xae3d('0x41')]+'%'};return _0x35db44;}})});}_0xb69ec9=_[_0xae3d('0x42')]({},_0xb69ec9,_0x3a5840[_0xae3d('0x43')]);var _0x549db8={'where':_0xb69ec9[_0xae3d('0x3d')]};return db[_0xae3d('0x2f')][_0xae3d('0x44')](_0x549db8)['then'](function(_0x4df102){_0x1d1483[_0xae3d('0x44')]=_0x4df102;if(_0x3a5840[_0xae3d('0x34')]['includeAll']){_0xb69ec9[_0xae3d('0x45')]=[{'all':!![]}];}return db[_0xae3d('0x2f')][_0xae3d('0x46')](_0xb69ec9);})[_0xae3d('0x28')](function(_0x436a04){_0x1d1483[_0xae3d('0x47')]=_0x436a04;return _0x1d1483;})['then'](respondWithFilteredResult(_0x3114f9,_0xb69ec9))[_0xae3d('0x48')](handleError(_0x3114f9,null));};exports[_0xae3d('0x49')]=function(_0xce7f34,_0x938811){var _0x1fef90={'raw':![],'where':{'id':_0xce7f34[_0xae3d('0x4a')]['id']}},_0x515220={};_0x515220['model']=_[_0xae3d('0x35')](db[_0xae3d('0x2f')][_0xae3d('0x30')]);_0x515220[_0xae3d('0x34')]=_['keys'](_0xce7f34['query']);_0x515220['filters']=_[_0xae3d('0x39')](_0x515220[_0xae3d('0x37')],_0x515220['query']);_0x1fef90['attributes']=_['intersection'](_0x515220[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0xce7f34[_0xae3d('0x34')][_0xae3d('0x3a')]));_0x1fef90[_0xae3d('0x38')]=_0x1fef90[_0xae3d('0x38')][_0xae3d('0x4b')]?_0x1fef90['attributes']:_0x515220['model'];if(_0xce7f34['query'][_0xae3d('0x4c')]){_0x1fef90['include']=[{'all':!![]}];}_0x1fef90=_[_0xae3d('0x42')]({},_0x1fef90,_0xce7f34[_0xae3d('0x43')]);return db[_0xae3d('0x2f')][_0xae3d('0x4d')](_0x1fef90)[_0xae3d('0x28')](handleEntityNotFound(_0x938811,null))[_0xae3d('0x28')](respondWithResult(_0x938811,null))[_0xae3d('0x48')](handleError(_0x938811,null));};exports[_0xae3d('0x4e')]=function(_0x38f92d,_0x4ed0f9){return db[_0xae3d('0x2f')]['create'](_0x38f92d['body'],{})['then'](respondWithResult(_0x4ed0f9,0xc9))[_0xae3d('0x48')](handleError(_0x4ed0f9,null));};exports[_0xae3d('0x27')]=function(_0x39f213,_0x6fa6c){if(_0x39f213['body']['id']){delete _0x39f213['body']['id'];}return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x39f213[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x6fa6c,null))['then'](saveUpdates(_0x39f213[_0xae3d('0x4f')],null))[_0xae3d('0x28')](respondWithResult(_0x6fa6c,null))[_0xae3d('0x48')](handleError(_0x6fa6c,null));};exports[_0xae3d('0x29')]=function(_0x2a6a24,_0x38ccf1){return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x2a6a24[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x38ccf1,null))[_0xae3d('0x28')](removeEntity(_0x38ccf1,null))[_0xae3d('0x48')](handleError(_0x38ccf1,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index a391e9c..3afc704 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 _0x7493=['lodash','api','bluebird','request-promise','rimraf','../../config/environment','./integration.attributes','define','integrations'];(function(_0x406b43,_0x1d150a){var _0x45df4e=function(_0x1335f6){while(--_0x1335f6){_0x406b43['push'](_0x406b43['shift']());}};_0x45df4e(++_0x1d150a);}(_0x7493,0xbd));var _0x3749=function(_0x9c0817,_0x50058d){_0x9c0817=_0x9c0817-0x0;var _0x396086=_0x7493[_0x9c0817];return _0x396086;};'use strict';var _=require(_0x3749('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3749('0x1'));var moment=require('moment');var BPromise=require(_0x3749('0x2'));var rp=require(_0x3749('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3749('0x4'));var config=require(_0x3749('0x5'));var attributes=require(_0x3749('0x6'));module['exports']=function(_0x2ac2d7,_0x244fad){return _0x2ac2d7[_0x3749('0x7')]('Integration',attributes,{'tableName':_0x3749('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d3e=['exports','Integration','integrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./integration.attributes'];(function(_0x4b3c97,_0x3b6169){var _0x3ac2db=function(_0x547dfe){while(--_0x547dfe){_0x4b3c97['push'](_0x4b3c97['shift']());}};_0x3ac2db(++_0x3b6169);}(_0x4d3e,0x1a3));var _0xe4d3=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x4d3e[_0xbb091];return _0x467a04;};'use strict';var _=require(_0xe4d3('0x0'));var util=require(_0xe4d3('0x1'));var logger=require(_0xe4d3('0x2'))(_0xe4d3('0x3'));var moment=require(_0xe4d3('0x4'));var BPromise=require(_0xe4d3('0x5'));var rp=require(_0xe4d3('0x6'));var fs=require('fs');var path=require(_0xe4d3('0x7'));var rimraf=require('rimraf');var config=require(_0xe4d3('0x8'));var attributes=require(_0xe4d3('0x9'));module[_0xe4d3('0xa')]=function(_0x46f3e6,_0xc437f7){return _0x46f3e6['define'](_0xe4d3('0xb'),attributes,{'tableName':_0xe4d3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index aed9191..3a1a26e 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 _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x22980e,_0xc33177){var _0x3ae52d=function(_0x824e52){while(--_0x824e52){_0x22980e['push'](_0x22980e['shift']());}};_0x3ae52d(++_0xc33177);}(_0x5f66,0x1a0));var _0x65f6=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5f66[_0x122096];return _0x3d1966;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('Integration,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +var _0x7880=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4b229d,_0x50a4dc){var _0xb80d6b=function(_0x1ebd43){while(--_0x1ebd43){_0x4b229d['push'](_0x4b229d['shift']());}};_0xb80d6b(++_0x50a4dc);}(_0x7880,0x1f4));var _0x0788=function(_0x4dce5c,_0x3b7a0a){_0x4dce5c=_0x4dce5c-0x0;var _0x20eece=_0x7880[_0x4dce5c];return _0x20eece;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var moment=require(_0x0788('0x1'));var BPromise=require(_0x0788('0x2'));var rs=require(_0x0788('0x3'));var fs=require('fs');var Redis=require(_0x0788('0x4'));var db=require(_0x0788('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0788('0x6'))(_0x0788('0x7'));var config=require(_0x0788('0x8'));var jayson=require(_0x0788('0x9'));var client=jayson[_0x0788('0xa')][_0x0788('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f9cb8,_0x44bbb5,_0x3c29f3){return new BPromise(function(_0x422f8b,_0x55e48a){return client[_0x0788('0xc')](_0x3f9cb8,_0x3c29f3)['then'](function(_0xabaf81){logger['info'](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));logger[_0x0788('0xf')](_0x0788('0x10'),_0x44bbb5,_0x0788('0xe'),JSON['stringify'](_0xabaf81));if(_0xabaf81[_0x0788('0x11')]){if(_0xabaf81[_0x0788('0x11')][_0x0788('0x12')]===0x1f4){logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')][_0x0788('0x13')]);return _0x55e48a(_0xabaf81['error'][_0x0788('0x13')]);}logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')]['message']);return _0x422f8b(_0xabaf81[_0x0788('0x11')]['message']);}else{logger[_0x0788('0x14')](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));_0x422f8b(_0xabaf81[_0x0788('0x15')][_0x0788('0x13')]);}})[_0x0788('0x16')](function(_0x5e1a29){logger['error'](_0x0788('0xd'),_0x44bbb5,_0x5e1a29);_0x55e48a(_0x5e1a29);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 0d96492..216288f 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 _0xdb28=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','create','put','update'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xdb28,0x106));var _0x8db2=function(_0x4c0954,_0x59e71d){_0x4c0954=_0x4c0954-0x0;var _0x42832a=_0xdb28[_0x4c0954];return _0x42832a;};'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('./integrationReport.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['post']('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0xf')]);router[_0x8db2('0x10')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x11')]);router['delete'](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x12')]);module[_0x8db2('0x13')]=router; \ No newline at end of file +var _0x7a54=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','post','put','update','delete','/:id'];(function(_0x4a53ca,_0x22ddf7){var _0x1673ac=function(_0x93e1cd){while(--_0x93e1cd){_0x4a53ca['push'](_0x4a53ca['shift']());}};_0x1673ac(++_0x22ddf7);}(_0x7a54,0x106));var _0x47a5=function(_0x51b8e7,_0x2620c6){_0x51b8e7=_0x51b8e7-0x0;var _0x3ae08a=_0x7a54[_0x51b8e7];return _0x3ae08a;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0x11'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);module[_0x47a5('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 5d77124..7b7e3a2 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 _0xc034=['TEXT','SENT','SENDING','RECEIVED','FAILED','STRING','INTEGER','BOOLEAN','DATE'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xc034,0x191));var _0x4c03=function(_0x4e88ad,_0x295aec){_0x4e88ad=_0x4e88ad-0x0;var _0x4b9fbd=_0xc034[_0x4e88ad];return _0x4b9fbd;};'use strict';var Sequelize=require('sequelize');module['exports']={'integration':{'type':Sequelize[_0x4c03('0x0')]},'eventChannel':{'type':Sequelize[_0x4c03('0x0')]},'exitStatus':{'type':Sequelize[_0x4c03('0x0')]},'ticketId':{'type':Sequelize[_0x4c03('0x0')]},'integrationId':{'type':Sequelize[_0x4c03('0x1')]},'contacts':{'type':Sequelize[_0x4c03('0x0')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x4c03('0x0')]},'calleridname':{'type':Sequelize[_0x4c03('0x0')]},'queue':{'type':Sequelize[_0x4c03('0x0')]},'interface':{'type':Sequelize[_0x4c03('0x0')]},'membername':{'type':Sequelize[_0x4c03('0x0')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x4c03('0x2')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x4c03('0x3')]},'talktime':{'type':Sequelize[_0x4c03('0x1')]},'agentacw':{'type':Sequelize[_0x4c03('0x2')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4c03('0x1')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x4c03('0x2')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x4c03('0x3')]},'agentdump':{'type':Sequelize[_0x4c03('0x2')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x4c03('0x3')]},'lastevent':{'type':Sequelize[_0x4c03('0x0')]},'channel':{'type':Sequelize[_0x4c03('0x0')]},'channelstate':{'type':Sequelize[_0x4c03('0x1')]},'channelstatedesc':{'type':Sequelize[_0x4c03('0x0')]},'connectedlinenum':{'type':Sequelize[_0x4c03('0x0')]},'connectedlinename':{'type':Sequelize[_0x4c03('0x0')]},'language':{'type':Sequelize[_0x4c03('0x0')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x4c03('0x0')]},'exten':{'type':Sequelize[_0x4c03('0x0')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x4c03('0x0')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x4c03('0x0')]},'destconnectedlinenum':{'type':Sequelize[_0x4c03('0x0')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x4c03('0x0')]},'destaccountcode':{'type':Sequelize[_0x4c03('0x0')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x4c03('0x0')]},'destpriority':{'type':Sequelize[_0x4c03('0x0')]},'destuniqueid':{'type':Sequelize[_0x4c03('0x0')]},'messageId':{'type':Sequelize[_0x4c03('0x0')]},'inReplyTo':{'type':Sequelize[_0x4c03('0x0')]},'subject':{'type':Sequelize[_0x4c03('0x0')]},'from':{'type':Sequelize[_0x4c03('0x0')]},'to':{'type':Sequelize[_0x4c03('0x0')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x4c03('0x4')]},'html':{'type':Sequelize[_0x4c03('0x4')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize['ENUM'](_0x4c03('0x5'),_0x4c03('0x6'),_0x4c03('0x7'),_0x4c03('0x8'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x4c03('0x0')]},'appdata':{'type':Sequelize[_0x4c03('0x0')]},'projectId':{'type':Sequelize[_0x4c03('0x1')]}}; \ No newline at end of file +var _0xe60f=['BOOLEAN','TEXT','ENUM','SENT','FAILED','exports','STRING','INTEGER','DATE'];(function(_0xcd9be0,_0x296129){var _0x556238=function(_0x2383da){while(--_0x2383da){_0xcd9be0['push'](_0xcd9be0['shift']());}};_0x556238(++_0x296129);}(_0xe60f,0xc2));var _0xfe60=function(_0x3aba4b,_0xc075e2){_0x3aba4b=_0x3aba4b-0x0;var _0x1c317f=_0xe60f[_0x3aba4b];return _0x1c317f;};'use strict';var Sequelize=require('sequelize');module[_0xfe60('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0xfe60('0x1')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0xfe60('0x1')]},'integrationId':{'type':Sequelize[_0xfe60('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xfe60('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xfe60('0x1')]},'queue':{'type':Sequelize[_0xfe60('0x1')]},'interface':{'type':Sequelize[_0xfe60('0x1')]},'membername':{'type':Sequelize[_0xfe60('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xfe60('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xfe60('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xfe60('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xfe60('0x2')]},'reason':{'type':Sequelize[_0xfe60('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xfe60('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0xfe60('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xfe60('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xfe60('0x1')]},'language':{'type':Sequelize[_0xfe60('0x1')]},'accountcode':{'type':Sequelize[_0xfe60('0x1')]},'context':{'type':Sequelize[_0xfe60('0x1')]},'exten':{'type':Sequelize[_0xfe60('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xfe60('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xfe60('0x1')]},'destcalleridnum':{'type':Sequelize[_0xfe60('0x1')]},'destcalleridname':{'type':Sequelize[_0xfe60('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xfe60('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xfe60('0x1')]},'destlanguage':{'type':Sequelize[_0xfe60('0x1')]},'destaccountcode':{'type':Sequelize[_0xfe60('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xfe60('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xfe60('0x1')]},'inReplyTo':{'type':Sequelize[_0xfe60('0x1')]},'subject':{'type':Sequelize[_0xfe60('0x1')]},'from':{'type':Sequelize[_0xfe60('0x1')]},'to':{'type':Sequelize[_0xfe60('0x1')]},'cc':{'type':Sequelize[_0xfe60('0x1')]},'attachment':{'type':Sequelize[_0xfe60('0x5')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xfe60('0x5')]},'status':{'type':Sequelize[_0xfe60('0x6')](_0xfe60('0x7'),'SENDING','RECEIVED',_0xfe60('0x8'))},'url':{'type':Sequelize[_0xfe60('0x1')]},'app':{'type':Sequelize[_0xfe60('0x1')]},'appdata':{'type':Sequelize[_0xfe60('0x1')]},'projectId':{'type':Sequelize[_0xfe60('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index dcfeb3d..0e56977 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 _0xff32=['count','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','IntegrationReport','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','update','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit'];(function(_0x12f76e,_0x219602){var _0x34ed1a=function(_0x402e69){while(--_0x402e69){_0x12f76e['push'](_0x12f76e['shift']());}};_0x34ed1a(++_0x219602);}(_0xff32,0x74));var _0x2ff3=function(_0x4782ac,_0x47975f){_0x4782ac=_0x4782ac-0x0;var _0x51f823=_0xff32[_0x4782ac];return _0x51f823;};'use strict';var emlformat=require(_0x2ff3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2ff3('0x1'));var jsonpatch=require(_0x2ff3('0x2'));var rp=require(_0x2ff3('0x3'));var moment=require(_0x2ff3('0x4'));var BPromise=require(_0x2ff3('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2ff3('0x6'));var sox=require(_0x2ff3('0x7'));var csv=require('to-csv');var ejs=require(_0x2ff3('0x8'));var fs=require('fs');var fs_extra=require(_0x2ff3('0x9'));var _=require(_0x2ff3('0xa'));var squel=require(_0x2ff3('0xb'));var crypto=require('crypto');var jsforce=require(_0x2ff3('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2ff3('0xd'));var querystring=require(_0x2ff3('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2ff3('0xf'));var as=require(_0x2ff3('0x10'));var hardwareService=require(_0x2ff3('0x11'));var logger=require('../../config/logger')(_0x2ff3('0x12'));var utils=require(_0x2ff3('0x13'));var config=require(_0x2ff3('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x2ff3('0x15'))['db'];function respondWithStatusCode(_0x1890dd,_0x58f93a){_0x58f93a=_0x58f93a||0xcc;return function(_0x498679){if(_0x498679){return _0x1890dd['sendStatus'](_0x58f93a);}return _0x1890dd[_0x2ff3('0x16')](_0x58f93a)[_0x2ff3('0x17')]();};}function respondWithResult(_0x132448,_0x31e925){_0x31e925=_0x31e925||0xc8;return function(_0x4ec3d8){if(_0x4ec3d8){return _0x132448['status'](_0x31e925)[_0x2ff3('0x18')](_0x4ec3d8);}};}function respondWithFilteredResult(_0x37d7ac,_0x491016){return function(_0xd1ee2b){if(_0xd1ee2b){var _0x44a71f=typeof _0x491016[_0x2ff3('0x19')]===_0x2ff3('0x1a')&&typeof _0x491016[_0x2ff3('0x1b')]===_0x2ff3('0x1a');var _0x237e5c=_0xd1ee2b[_0x2ff3('0x1c')];var _0xcf927=_0x44a71f?0x0:_0x491016[_0x2ff3('0x19')];var _0x4f861a=_0x44a71f?_0xd1ee2b[_0x2ff3('0x1c')]:_0x491016['offset']+_0x491016[_0x2ff3('0x1b')];var _0x2e7e7b;if(_0x4f861a>=_0x237e5c){_0x4f861a=_0x237e5c;_0x2e7e7b=0xc8;}else{_0x2e7e7b=0xce;}_0x37d7ac[_0x2ff3('0x16')](_0x2e7e7b);return _0x37d7ac['set'](_0x2ff3('0x1d'),_0xcf927+'-'+_0x4f861a+'/'+_0x237e5c)[_0x2ff3('0x18')](_0xd1ee2b);}return null;};}function patchUpdates(_0x5dbaa1){return function(_0x1a94e8){try{jsonpatch[_0x2ff3('0x1e')](_0x1a94e8,_0x5dbaa1,!![]);}catch(_0x35b1cb){return BPromise[_0x2ff3('0x1f')](_0x35b1cb);}return _0x1a94e8[_0x2ff3('0x20')]();};}function saveUpdates(_0x5007ce,_0x1850c2){return function(_0x4239a){if(_0x4239a){return _0x4239a['update'](_0x5007ce)[_0x2ff3('0x21')](function(_0x4405b7){return _0x4405b7;});}return null;};}function removeEntity(_0x3c1fce,_0x2f856a){return function(_0x60e7a1){if(_0x60e7a1){return _0x60e7a1[_0x2ff3('0x22')]()[_0x2ff3('0x21')](function(){_0x3c1fce[_0x2ff3('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51da1c,_0x40171d){return function(_0x31a461){if(!_0x31a461){_0x51da1c['sendStatus'](0x194);}return _0x31a461;};}function handleError(_0x8cc16b,_0x5c5f08){_0x5c5f08=_0x5c5f08||0x1f4;return function(_0x3f62d3){logger[_0x2ff3('0x23')](_0x3f62d3[_0x2ff3('0x24')]);if(_0x3f62d3['name']){delete _0x3f62d3[_0x2ff3('0x25')];}_0x8cc16b[_0x2ff3('0x16')](_0x5c5f08)['send'](_0x3f62d3);};}exports[_0x2ff3('0x26')]=function(_0xf6047f,_0xfdcf32){var _0x43a605={},_0x5e2f0f={},_0x2bc5af={'count':0x0,'rows':[]};var _0x1af958=_[_0x2ff3('0x27')](db[_0x2ff3('0x28')]['rawAttributes'],function(_0x44f09f){return{'name':_0x44f09f[_0x2ff3('0x29')],'type':_0x44f09f['type'][_0x2ff3('0x2a')]};});_0x5e2f0f[_0x2ff3('0x2b')]=_['map'](_0x1af958,_0x2ff3('0x25'));_0x5e2f0f[_0x2ff3('0x2c')]=_[_0x2ff3('0x2d')](_0xf6047f['query']);_0x5e2f0f[_0x2ff3('0x2e')]=_['intersection'](_0x5e2f0f[_0x2ff3('0x2b')],_0x5e2f0f[_0x2ff3('0x2c')]);_0x43a605[_0x2ff3('0x2f')]=_[_0x2ff3('0x30')](_0x5e2f0f[_0x2ff3('0x2b')],qs['fields'](_0xf6047f[_0x2ff3('0x2c')][_0x2ff3('0x31')]));_0x43a605[_0x2ff3('0x2f')]=_0x43a605['attributes'][_0x2ff3('0x32')]?_0x43a605[_0x2ff3('0x2f')]:_0x5e2f0f[_0x2ff3('0x2b')];if(!_0xf6047f[_0x2ff3('0x2c')]['hasOwnProperty'](_0x2ff3('0x33'))){_0x43a605[_0x2ff3('0x1b')]=qs['limit'](_0xf6047f['query'][_0x2ff3('0x1b')]);_0x43a605['offset']=qs[_0x2ff3('0x19')](_0xf6047f[_0x2ff3('0x2c')]['offset']);}_0x43a605[_0x2ff3('0x34')]=qs['sort'](_0xf6047f['query']['sort']);_0x43a605[_0x2ff3('0x35')]=qs[_0x2ff3('0x2e')](_[_0x2ff3('0x36')](_0xf6047f[_0x2ff3('0x2c')],_0x5e2f0f[_0x2ff3('0x2e')]),_0x1af958);if(_0xf6047f[_0x2ff3('0x2c')][_0x2ff3('0x37')]){_0x43a605['where']=_[_0x2ff3('0x38')](_0x43a605['where'],{'$or':_['map'](_0x1af958,function(_0x6f43ac){if(_0x6f43ac[_0x2ff3('0x39')]!==_0x2ff3('0x3a')){var _0x2c9e26={};_0x2c9e26[_0x6f43ac[_0x2ff3('0x25')]]={'$like':'%'+_0xf6047f['query'][_0x2ff3('0x37')]+'%'};return _0x2c9e26;}})});}_0x43a605=_['merge']({},_0x43a605,_0xf6047f[_0x2ff3('0x3b')]);var _0x57f857={'where':_0x43a605[_0x2ff3('0x35')]};return db[_0x2ff3('0x28')]['count'](_0x57f857)[_0x2ff3('0x21')](function(_0x1ee81a){_0x2bc5af[_0x2ff3('0x1c')]=_0x1ee81a;if(_0xf6047f[_0x2ff3('0x2c')][_0x2ff3('0x3c')]){_0x43a605[_0x2ff3('0x3d')]=[{'all':!![]}];}return db['IntegrationReport']['findAll'](_0x43a605);})[_0x2ff3('0x21')](function(_0x4adcd6){_0x2bc5af[_0x2ff3('0x3e')]=_0x4adcd6;return _0x2bc5af;})['then'](respondWithFilteredResult(_0xfdcf32,_0x43a605))[_0x2ff3('0x3f')](handleError(_0xfdcf32,null));};exports[_0x2ff3('0x40')]=function(_0x3217e4,_0x424c8e){var _0x112647={'raw':![],'where':{'id':_0x3217e4[_0x2ff3('0x41')]['id']}},_0x4f6efe={};_0x4f6efe[_0x2ff3('0x2b')]=_[_0x2ff3('0x2d')](db[_0x2ff3('0x28')][_0x2ff3('0x42')]);_0x4f6efe[_0x2ff3('0x2c')]=_[_0x2ff3('0x2d')](_0x3217e4['query']);_0x4f6efe[_0x2ff3('0x2e')]=_[_0x2ff3('0x30')](_0x4f6efe[_0x2ff3('0x2b')],_0x4f6efe['query']);_0x112647[_0x2ff3('0x2f')]=_['intersection'](_0x4f6efe[_0x2ff3('0x2b')],qs[_0x2ff3('0x31')](_0x3217e4['query'][_0x2ff3('0x31')]));_0x112647[_0x2ff3('0x2f')]=_0x112647[_0x2ff3('0x2f')][_0x2ff3('0x32')]?_0x112647[_0x2ff3('0x2f')]:_0x4f6efe[_0x2ff3('0x2b')];if(_0x3217e4['query']['includeAll']){_0x112647[_0x2ff3('0x3d')]=[{'all':!![]}];}_0x112647=_[_0x2ff3('0x38')]({},_0x112647,_0x3217e4['options']);return db[_0x2ff3('0x28')][_0x2ff3('0x43')](_0x112647)[_0x2ff3('0x21')](handleEntityNotFound(_0x424c8e,null))[_0x2ff3('0x21')](respondWithResult(_0x424c8e,null))[_0x2ff3('0x3f')](handleError(_0x424c8e,null));};exports[_0x2ff3('0x44')]=function(_0x22e603,_0x3082e2){return db[_0x2ff3('0x28')][_0x2ff3('0x44')](_0x22e603['body'],{})['then'](respondWithResult(_0x3082e2,0xc9))[_0x2ff3('0x3f')](handleError(_0x3082e2,null));};exports[_0x2ff3('0x45')]=function(_0x4d945d,_0x259099){if(_0x4d945d[_0x2ff3('0x46')]['id']){delete _0x4d945d[_0x2ff3('0x46')]['id'];}return db[_0x2ff3('0x28')]['find']({'where':{'id':_0x4d945d['params']['id']}})[_0x2ff3('0x21')](handleEntityNotFound(_0x259099,null))[_0x2ff3('0x21')](saveUpdates(_0x4d945d[_0x2ff3('0x46')],null))['then'](respondWithResult(_0x259099,null))[_0x2ff3('0x3f')](handleError(_0x259099,null));};exports[_0x2ff3('0x22')]=function(_0x3d3cff,_0x46e6ad){return db['IntegrationReport']['find']({'where':{'id':_0x3d3cff[_0x2ff3('0x41')]['id']}})[_0x2ff3('0x21')](handleEntityNotFound(_0x46e6ad,null))['then'](removeEntity(_0x46e6ad,null))[_0x2ff3('0x3f')](handleError(_0x46e6ad,null));};exports[_0x2ff3('0x47')]=function(_0x2dcac6,_0x2e9fcc){return db[_0x2ff3('0x28')]['describe']()['then'](respondWithResult(_0x2e9fcc,null))[_0x2ff3('0x3f')](handleError(_0x2e9fcc,null));}; \ No newline at end of file +var _0xa9be=['then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','IntegrationReport','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update'];(function(_0x5e9962,_0x36a414){var _0x5cb374=function(_0x272588){while(--_0x272588){_0x5e9962['push'](_0x5e9962['shift']());}};_0x5cb374(++_0x36a414);}(_0xa9be,0x198));var _0xea9b=function(_0x19b9cc,_0x46403e){_0x19b9cc=_0x19b9cc-0x0;var _0x4dbc76=_0xa9be[_0x19b9cc];return _0x4dbc76;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xea9b('0x0'));var jsonpatch=require(_0xea9b('0x1'));var rp=require(_0xea9b('0x2'));var moment=require(_0xea9b('0x3'));var BPromise=require(_0xea9b('0x4'));var Mustache=require(_0xea9b('0x5'));var util=require(_0xea9b('0x6'));var path=require(_0xea9b('0x7'));var sox=require(_0xea9b('0x8'));var csv=require('to-csv');var ejs=require(_0xea9b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xea9b('0xa'));var squel=require('squel');var crypto=require(_0xea9b('0xb'));var jsforce=require(_0xea9b('0xc'));var deskjs=require(_0xea9b('0xd'));var toCsv=require(_0xea9b('0xe'));var querystring=require(_0xea9b('0xf'));var Papa=require('papaparse');var Redis=require(_0xea9b('0x10'));var authService=require(_0xea9b('0x11'));var qs=require(_0xea9b('0x12'));var as=require(_0xea9b('0x13'));var hardwareService=require(_0xea9b('0x14'));var logger=require(_0xea9b('0x15'))(_0xea9b('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xea9b('0x17'));var db=require(_0xea9b('0x18'))['db'];function respondWithStatusCode(_0x5b54ef,_0x18a8e5){_0x18a8e5=_0x18a8e5||0xcc;return function(_0x2b928d){if(_0x2b928d){return _0x5b54ef['sendStatus'](_0x18a8e5);}return _0x5b54ef[_0xea9b('0x19')](_0x18a8e5)['end']();};}function respondWithResult(_0x50dac3,_0x37a6d0){_0x37a6d0=_0x37a6d0||0xc8;return function(_0x22bc2e){if(_0x22bc2e){return _0x50dac3[_0xea9b('0x19')](_0x37a6d0)[_0xea9b('0x1a')](_0x22bc2e);}};}function respondWithFilteredResult(_0x1d1f96,_0x4d0ad0){return function(_0x57d000){if(_0x57d000){var _0x98c0eb=typeof _0x4d0ad0[_0xea9b('0x1b')]===_0xea9b('0x1c')&&typeof _0x4d0ad0[_0xea9b('0x1d')]===_0xea9b('0x1c');var _0x32d85f=_0x57d000[_0xea9b('0x1e')];var _0x4545b8=_0x98c0eb?0x0:_0x4d0ad0['offset'];var _0x10a5cb=_0x98c0eb?_0x57d000['count']:_0x4d0ad0[_0xea9b('0x1b')]+_0x4d0ad0['limit'];var _0x5a154d;if(_0x10a5cb>=_0x32d85f){_0x10a5cb=_0x32d85f;_0x5a154d=0xc8;}else{_0x5a154d=0xce;}_0x1d1f96[_0xea9b('0x19')](_0x5a154d);return _0x1d1f96[_0xea9b('0x1f')](_0xea9b('0x20'),_0x4545b8+'-'+_0x10a5cb+'/'+_0x32d85f)[_0xea9b('0x1a')](_0x57d000);}return null;};}function patchUpdates(_0x25a57e){return function(_0xebf3cb){try{jsonpatch['apply'](_0xebf3cb,_0x25a57e,!![]);}catch(_0x1a1f50){return BPromise[_0xea9b('0x21')](_0x1a1f50);}return _0xebf3cb[_0xea9b('0x22')]();};}function saveUpdates(_0x11d731,_0x29154e){return function(_0x3d4b44){if(_0x3d4b44){return _0x3d4b44[_0xea9b('0x23')](_0x11d731)[_0xea9b('0x24')](function(_0x5ba3c3){return _0x5ba3c3;});}return null;};}function removeEntity(_0x43e0db,_0x574224){return function(_0x12e6ee){if(_0x12e6ee){return _0x12e6ee[_0xea9b('0x25')]()[_0xea9b('0x24')](function(){_0x43e0db['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e8e49,_0x43174a){return function(_0x2369d4){if(!_0x2369d4){_0x5e8e49['sendStatus'](0x194);}return _0x2369d4;};}function handleError(_0x31eb71,_0xc43f32){_0xc43f32=_0xc43f32||0x1f4;return function(_0x4a30e4){logger['error'](_0x4a30e4[_0xea9b('0x26')]);if(_0x4a30e4['name']){delete _0x4a30e4[_0xea9b('0x27')];}_0x31eb71['status'](_0xc43f32)[_0xea9b('0x28')](_0x4a30e4);};}exports[_0xea9b('0x29')]=function(_0x4ddd00,_0x568cd3){var _0xa04db5={},_0x4db230={},_0xbbc59={'count':0x0,'rows':[]};var _0xb79294=_[_0xea9b('0x2a')](db['IntegrationReport'][_0xea9b('0x2b')],function(_0x22a01e){return{'name':_0x22a01e[_0xea9b('0x2c')],'type':_0x22a01e[_0xea9b('0x2d')][_0xea9b('0x2e')]};});_0x4db230[_0xea9b('0x2f')]=_['map'](_0xb79294,_0xea9b('0x27'));_0x4db230[_0xea9b('0x30')]=_[_0xea9b('0x31')](_0x4ddd00['query']);_0x4db230[_0xea9b('0x32')]=_[_0xea9b('0x33')](_0x4db230[_0xea9b('0x2f')],_0x4db230[_0xea9b('0x30')]);_0xa04db5[_0xea9b('0x34')]=_[_0xea9b('0x33')](_0x4db230[_0xea9b('0x2f')],qs[_0xea9b('0x35')](_0x4ddd00['query'][_0xea9b('0x35')]));_0xa04db5['attributes']=_0xa04db5[_0xea9b('0x34')][_0xea9b('0x36')]?_0xa04db5[_0xea9b('0x34')]:_0x4db230[_0xea9b('0x2f')];if(!_0x4ddd00[_0xea9b('0x30')][_0xea9b('0x37')](_0xea9b('0x38'))){_0xa04db5[_0xea9b('0x1d')]=qs['limit'](_0x4ddd00['query'][_0xea9b('0x1d')]);_0xa04db5[_0xea9b('0x1b')]=qs['offset'](_0x4ddd00[_0xea9b('0x30')][_0xea9b('0x1b')]);}_0xa04db5['order']=qs[_0xea9b('0x39')](_0x4ddd00[_0xea9b('0x30')][_0xea9b('0x39')]);_0xa04db5[_0xea9b('0x3a')]=qs[_0xea9b('0x32')](_[_0xea9b('0x3b')](_0x4ddd00[_0xea9b('0x30')],_0x4db230[_0xea9b('0x32')]),_0xb79294);if(_0x4ddd00[_0xea9b('0x30')]['filter']){_0xa04db5[_0xea9b('0x3a')]=_[_0xea9b('0x3c')](_0xa04db5[_0xea9b('0x3a')],{'$or':_['map'](_0xb79294,function(_0x39157c){if(_0x39157c[_0xea9b('0x2d')]!=='VIRTUAL'){var _0x43e422={};_0x43e422[_0x39157c[_0xea9b('0x27')]]={'$like':'%'+_0x4ddd00['query'][_0xea9b('0x3d')]+'%'};return _0x43e422;}})});}_0xa04db5=_[_0xea9b('0x3c')]({},_0xa04db5,_0x4ddd00['options']);var _0x3ccf5f={'where':_0xa04db5[_0xea9b('0x3a')]};return db[_0xea9b('0x3e')]['count'](_0x3ccf5f)[_0xea9b('0x24')](function(_0x1ecdde){_0xbbc59['count']=_0x1ecdde;if(_0x4ddd00[_0xea9b('0x30')][_0xea9b('0x3f')]){_0xa04db5[_0xea9b('0x40')]=[{'all':!![]}];}return db[_0xea9b('0x3e')][_0xea9b('0x41')](_0xa04db5);})[_0xea9b('0x24')](function(_0x3b6b32){_0xbbc59[_0xea9b('0x42')]=_0x3b6b32;return _0xbbc59;})[_0xea9b('0x24')](respondWithFilteredResult(_0x568cd3,_0xa04db5))[_0xea9b('0x43')](handleError(_0x568cd3,null));};exports[_0xea9b('0x44')]=function(_0x56b980,_0x20adf0){var _0x359a40={'raw':![],'where':{'id':_0x56b980[_0xea9b('0x45')]['id']}},_0x1c83ce={};_0x1c83ce['model']=_[_0xea9b('0x31')](db[_0xea9b('0x3e')][_0xea9b('0x2b')]);_0x1c83ce[_0xea9b('0x30')]=_[_0xea9b('0x31')](_0x56b980[_0xea9b('0x30')]);_0x1c83ce['filters']=_[_0xea9b('0x33')](_0x1c83ce[_0xea9b('0x2f')],_0x1c83ce['query']);_0x359a40[_0xea9b('0x34')]=_[_0xea9b('0x33')](_0x1c83ce[_0xea9b('0x2f')],qs['fields'](_0x56b980[_0xea9b('0x30')][_0xea9b('0x35')]));_0x359a40[_0xea9b('0x34')]=_0x359a40['attributes'][_0xea9b('0x36')]?_0x359a40[_0xea9b('0x34')]:_0x1c83ce['model'];if(_0x56b980[_0xea9b('0x30')]['includeAll']){_0x359a40[_0xea9b('0x40')]=[{'all':!![]}];}_0x359a40=_[_0xea9b('0x3c')]({},_0x359a40,_0x56b980[_0xea9b('0x46')]);return db[_0xea9b('0x3e')][_0xea9b('0x47')](_0x359a40)[_0xea9b('0x24')](handleEntityNotFound(_0x20adf0,null))[_0xea9b('0x24')](respondWithResult(_0x20adf0,null))[_0xea9b('0x43')](handleError(_0x20adf0,null));};exports[_0xea9b('0x48')]=function(_0x333dfb,_0x381d31){return db['IntegrationReport'][_0xea9b('0x48')](_0x333dfb[_0xea9b('0x49')],{})[_0xea9b('0x24')](respondWithResult(_0x381d31,0xc9))[_0xea9b('0x43')](handleError(_0x381d31,null));};exports[_0xea9b('0x23')]=function(_0xd9200c,_0x5d1a29){if(_0xd9200c[_0xea9b('0x49')]['id']){delete _0xd9200c['body']['id'];}return db['IntegrationReport'][_0xea9b('0x47')]({'where':{'id':_0xd9200c[_0xea9b('0x45')]['id']}})[_0xea9b('0x24')](handleEntityNotFound(_0x5d1a29,null))['then'](saveUpdates(_0xd9200c['body'],null))[_0xea9b('0x24')](respondWithResult(_0x5d1a29,null))[_0xea9b('0x43')](handleError(_0x5d1a29,null));};exports[_0xea9b('0x25')]=function(_0x5de5f1,_0x3f0916){return db[_0xea9b('0x3e')][_0xea9b('0x47')]({'where':{'id':_0x5de5f1[_0xea9b('0x45')]['id']}})[_0xea9b('0x24')](handleEntityNotFound(_0x3f0916,null))[_0xea9b('0x24')](removeEntity(_0x3f0916,null))['catch'](handleError(_0x3f0916,null));};exports['describe']=function(_0x28c861,_0x1ad60f){return db['IntegrationReport']['describe']()['then'](respondWithResult(_0x1ad60f,null))[_0xea9b('0x43')](handleError(_0x1ad60f,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 453790a..9914ef4 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 _0x7fda=['exports','define','report_integration','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./integrationReport.attributes'];(function(_0x2b659a,_0x3b6dc3){var _0x12bfed=function(_0x264f0e){while(--_0x264f0e){_0x2b659a['push'](_0x2b659a['shift']());}};_0x12bfed(++_0x3b6dc3);}(_0x7fda,0x158));var _0xa7fd=function(_0x54eadb,_0x442b96){_0x54eadb=_0x54eadb-0x0;var _0x356645=_0x7fda[_0x54eadb];return _0x356645;};'use strict';var _=require(_0xa7fd('0x0'));var util=require(_0xa7fd('0x1'));var logger=require(_0xa7fd('0x2'))(_0xa7fd('0x3'));var moment=require('moment');var BPromise=require(_0xa7fd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa7fd('0x5'));var rimraf=require('rimraf');var config=require(_0xa7fd('0x6'));var attributes=require(_0xa7fd('0x7'));module[_0xa7fd('0x8')]=function(_0x169d22,_0x8eb16d){return _0x169d22[_0xa7fd('0x9')]('IntegrationReport',attributes,{'tableName':_0xa7fd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9db3=['api','request-promise','path','../../config/environment','exports','report_integration','lodash','util'];(function(_0x4f002a,_0x32cd72){var _0x12db44=function(_0x686960){while(--_0x686960){_0x4f002a['push'](_0x4f002a['shift']());}};_0x12db44(++_0x32cd72);}(_0x9db3,0xde));var _0x39db=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x9db3[_0x11005e];return _0x29338f;};'use strict';var _=require(_0x39db('0x0'));var util=require(_0x39db('0x1'));var logger=require('../../config/logger')(_0x39db('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x39db('0x3'));var fs=require('fs');var path=require(_0x39db('0x4'));var rimraf=require('rimraf');var config=require(_0x39db('0x5'));var attributes=require('./integrationReport.attributes');module[_0x39db('0x6')]=function(_0x38fed5,_0x195cb7){return _0x38fed5['define']('IntegrationReport',attributes,{'tableName':_0x39db('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 304d07f..15d5d7d 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 _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x39780c,_0x5782c9){var _0x53c19b=function(_0x594f01){while(--_0x594f01){_0x39780c['push'](_0x39780c['shift']());}};_0x53c19b(++_0x5782c9);}(_0xf494,0x1c6));var _0x4f49=function(_0x2e97ea,_0x5f5710){_0x2e97ea=_0x2e97ea-0x0;var _0x54b6d8=_0xf494[_0x2e97ea];return _0x54b6d8;};'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 _0xc2c7=['../../config/logger','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xc2c7,0x134));var _0x7c2c=function(_0x5189aa,_0x50f006){_0x5189aa=_0x5189aa-0x0;var _0x1cdf4d=_0xc2c7[_0x5189aa];return _0x1cdf4d;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54f027,_0x4abe93,_0x5a1027){return new BPromise(function(_0x2274cd,_0x29638d){return client[_0x7c2c('0xb')](_0x54f027,_0x5a1027)[_0x7c2c('0xc')](function(_0x279cff){logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x4abe93,_0x7c2c('0xe'),JSON[_0x7c2c('0x11')](_0x279cff));if(_0x279cff[_0x7c2c('0x12')]){if(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x13')]===0x1f4){logger[_0x7c2c('0x12')](_0x7c2c('0xd'),_0x4abe93,_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);return _0x29638d(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}logger[_0x7c2c('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x4abe93,_0x279cff['error'][_0x7c2c('0x14')]);return _0x2274cd(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}else{logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));_0x2274cd(_0x279cff['result'][_0x7c2c('0x14')]);}})['catch'](function(_0x1aa355){logger['error'](_0x7c2c('0xd'),_0x4abe93,_0x1aa355);_0x29638d(_0x1aa355);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 536c91a..087996f 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 _0x0f4d=['/:id/sub_intervals/create_many','addIntervals','put','update','delete','exports','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','/:id','show','getIntervals','create','post','addInterval'];(function(_0x20922b,_0x29d673){var _0x3e889c=function(_0xafefea){while(--_0xafefea){_0x20922b['push'](_0x20922b['shift']());}};_0x3e889c(++_0x29d673);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x5b3328,_0x2dbb76){_0x5b3328=_0x5b3328-0x0;var _0x441b2d=_0x0f4d[_0x5b3328];return _0x441b2d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd0f4('0x0'));var express=require('express');var router=express[_0xd0f4('0x1')]();var fs_extra=require(_0xd0f4('0x2'));var auth=require(_0xd0f4('0x3'));var interaction=require(_0xd0f4('0x4'));var config=require(_0xd0f4('0x5'));var controller=require(_0xd0f4('0x6'));router[_0xd0f4('0x7')]('/',auth[_0xd0f4('0x8')](),controller['index']);router[_0xd0f4('0x7')](_0xd0f4('0x9'),auth['isAuthenticated'](),controller[_0xd0f4('0xa')]);router[_0xd0f4('0x7')]('/:id/sub_intervals',auth[_0xd0f4('0x8')](),controller[_0xd0f4('0xb')]);router['post']('/',auth[_0xd0f4('0x8')](),controller[_0xd0f4('0xc')]);router[_0xd0f4('0xd')]('/:id/sub_intervals',auth['isAuthenticated'](),controller[_0xd0f4('0xe')]);router[_0xd0f4('0xd')](_0xd0f4('0xf'),auth[_0xd0f4('0x8')](),controller[_0xd0f4('0x10')]);router[_0xd0f4('0x11')](_0xd0f4('0x9'),auth['isAuthenticated'](),controller[_0xd0f4('0x12')]);router[_0xd0f4('0x13')]('/:id',auth[_0xd0f4('0x8')](),controller['destroy']);module[_0xd0f4('0x14')]=router; \ No newline at end of file +var _0x20d6=['/:id','show','/:id/sub_intervals','getIntervals','post','create','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x299b58,_0x3195ac){var _0x57d11c=function(_0x4758ba){while(--_0x4758ba){_0x299b58['push'](_0x299b58['shift']());}};_0x57d11c(++_0x3195ac);}(_0x20d6,0x9d));var _0x620d=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x20d6[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x620d('0x0'));var util=require(_0x620d('0x1'));var path=require(_0x620d('0x2'));var timeout=require(_0x620d('0x3'));var express=require(_0x620d('0x4'));var router=express['Router']();var fs_extra=require(_0x620d('0x5'));var auth=require(_0x620d('0x6'));var interaction=require(_0x620d('0x7'));var config=require(_0x620d('0x8'));var controller=require('./interval.controller');router[_0x620d('0x9')]('/',auth[_0x620d('0xa')](),controller['index']);router[_0x620d('0x9')](_0x620d('0xb'),auth[_0x620d('0xa')](),controller[_0x620d('0xc')]);router[_0x620d('0x9')](_0x620d('0xd'),auth[_0x620d('0xa')](),controller[_0x620d('0xe')]);router[_0x620d('0xf')]('/',auth[_0x620d('0xa')](),controller[_0x620d('0x10')]);router[_0x620d('0xf')]('/:id/sub_intervals',auth[_0x620d('0xa')](),controller['addInterval']);router[_0x620d('0xf')](_0x620d('0x11'),auth[_0x620d('0xa')](),controller[_0x620d('0x12')]);router[_0x620d('0x13')](_0x620d('0xb'),auth[_0x620d('0xa')](),controller[_0x620d('0x14')]);router[_0x620d('0x15')]('/:id',auth[_0x620d('0xa')](),controller[_0x620d('0x16')]);module[_0x620d('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 5fbe137..376687f 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 _0xaca3=['sequelize','exports','STRING'];(function(_0x54bc96,_0x20cb68){var _0x4685b9=function(_0x41f797){while(--_0x41f797){_0x54bc96['push'](_0x54bc96['shift']());}};_0x4685b9(++_0x20cb68);}(_0xaca3,0x120));var _0x3aca=function(_0x5136f7,_0x5a954e){_0x5136f7=_0x5136f7-0x0;var _0x4fd434=_0xaca3[_0x5136f7];return _0x4fd434;};'use strict';var Sequelize=require(_0x3aca('0x0'));module[_0x3aca('0x1')]={'name':{'type':Sequelize[_0x3aca('0x2')]},'description':{'type':Sequelize[_0x3aca('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x4c68=['STRING','exports'];(function(_0x33da27,_0x103a77){var _0x5c3dcd=function(_0x45b0df){while(--_0x45b0df){_0x33da27['push'](_0x33da27['shift']());}};_0x5c3dcd(++_0x103a77);}(_0x4c68,0x119));var _0x84c6=function(_0x4da690,_0x12d136){_0x4da690=_0x4da690-0x0;var _0x263c53=_0x4c68[_0x4da690];return _0x263c53;};'use strict';var Sequelize=require('sequelize');module[_0x84c6('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x84c6('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 5e41119..cddc153 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 _0x3329=['role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','addInterval','IntervalId','findOne','getIntervals','addIntervals','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','get','Intervals','stack','name','send','Interval','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','find','create','body','user'];(function(_0x1055d6,_0x2b2cf3){var _0x4dc056=function(_0xcb7d57){while(--_0xcb7d57){_0x1055d6['push'](_0x1055d6['shift']());}};_0x4dc056(++_0x2b2cf3);}(_0x3329,0xbe));var _0x9332=function(_0x445185,_0x5b5ab4){_0x445185=_0x445185-0x0;var _0x2aeacb=_0x3329[_0x445185];return _0x2aeacb;};'use strict';var emlformat=require(_0x9332('0x0'));var rimraf=require(_0x9332('0x1'));var zipdir=require(_0x9332('0x2'));var jsonpatch=require(_0x9332('0x3'));var rp=require(_0x9332('0x4'));var moment=require(_0x9332('0x5'));var BPromise=require(_0x9332('0x6'));var Mustache=require(_0x9332('0x7'));var util=require(_0x9332('0x8'));var path=require(_0x9332('0x9'));var sox=require(_0x9332('0xa'));var csv=require(_0x9332('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9332('0xc'));var _=require(_0x9332('0xd'));var squel=require(_0x9332('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9332('0xf'));var toCsv=require(_0x9332('0xb'));var querystring=require('querystring');var Papa=require(_0x9332('0x10'));var Redis=require('ioredis');var authService=require(_0x9332('0x11'));var qs=require(_0x9332('0x12'));var as=require(_0x9332('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9332('0x14'))(_0x9332('0x15'));var utils=require(_0x9332('0x16'));var config=require(_0x9332('0x17'));var licenseUtil=require(_0x9332('0x18'));var db=require(_0x9332('0x19'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x2a293a,_0x57aed0){_0x57aed0=_0x57aed0||0xcc;return function(_0x1bfddd){if(_0x1bfddd){return _0x2a293a[_0x9332('0x1a')](_0x57aed0);}return _0x2a293a[_0x9332('0x1b')](_0x57aed0)[_0x9332('0x1c')]();};}function respondWithResult(_0x5d8117,_0x1b9966){_0x1b9966=_0x1b9966||0xc8;return function(_0x2f3d40){if(_0x2f3d40){return _0x5d8117[_0x9332('0x1b')](_0x1b9966)[_0x9332('0x1d')](_0x2f3d40);}};}function respondWithFilteredResult(_0x5705c3,_0x8b671e){return function(_0x11c767){if(_0x11c767){var _0x3bb8ee=typeof _0x8b671e[_0x9332('0x1e')]===_0x9332('0x1f')&&typeof _0x8b671e['limit']===_0x9332('0x1f');var _0xf12e5f=_0x11c767['count'];var _0x248b3e=_0x3bb8ee?0x0:_0x8b671e['offset'];var _0x16db8a=_0x3bb8ee?_0x11c767[_0x9332('0x20')]:_0x8b671e[_0x9332('0x1e')]+_0x8b671e[_0x9332('0x21')];var _0x383dc;if(_0x16db8a>=_0xf12e5f){_0x16db8a=_0xf12e5f;_0x383dc=0xc8;}else{_0x383dc=0xce;}_0x5705c3[_0x9332('0x1b')](_0x383dc);return _0x5705c3['set'](_0x9332('0x22'),_0x248b3e+'-'+_0x16db8a+'/'+_0xf12e5f)[_0x9332('0x1d')](_0x11c767);}return null;};}function patchUpdates(_0x259e88){return function(_0x38458b){try{jsonpatch[_0x9332('0x23')](_0x38458b,_0x259e88,!![]);}catch(_0x30c6dc){return BPromise[_0x9332('0x24')](_0x30c6dc);}return _0x38458b[_0x9332('0x25')]();};}function saveUpdates(_0x54ee45,_0xd1a1e7){return function(_0x4e7617){if(_0x4e7617){return _0x4e7617[_0x9332('0x26')](_0x54ee45)[_0x9332('0x27')](function(_0x2eab7a){return _0x2eab7a;});}return null;};}function removeEntity(_0x4d79f6,_0x5b48e0){return function(_0x888863){if(_0x888863){return _0x888863[_0x9332('0x28')]()[_0x9332('0x27')](function(){var _0x28abf8=_0x888863[_0x9332('0x29')]({'plain':!![]});var _0x3ff14a=_0x9332('0x2a');return db['UserProfileResource'][_0x9332('0x28')]({'where':{'type':_0x3ff14a,'resourceId':_0x28abf8['id']}})[_0x9332('0x27')](function(){return _0x888863;});})[_0x9332('0x27')](function(){_0x4d79f6[_0x9332('0x1b')](0xcc)[_0x9332('0x1c')]();});}};}function handleEntityNotFound(_0x373db6,_0x4b8f2a){return function(_0x3eca02){if(!_0x3eca02){_0x373db6['sendStatus'](0x194);}return _0x3eca02;};}function handleError(_0x3d7f78,_0x2bb6ec){_0x2bb6ec=_0x2bb6ec||0x1f4;return function(_0x5c6a03){logger['error'](_0x5c6a03[_0x9332('0x2b')]);if(_0x5c6a03[_0x9332('0x2c')]){delete _0x5c6a03[_0x9332('0x2c')];}_0x3d7f78[_0x9332('0x1b')](_0x2bb6ec)[_0x9332('0x2d')](_0x5c6a03);};}exports['index']=function(_0x41ca77,_0x2cb234){var _0xa4222f={},_0x531b96={},_0x4e1491={'count':0x0,'rows':[]};var _0xe70e7=_['map'](db[_0x9332('0x2e')][_0x9332('0x2f')],function(_0x227a1c){return{'name':_0x227a1c['fieldName'],'type':_0x227a1c[_0x9332('0x30')][_0x9332('0x31')]};});_0x531b96[_0x9332('0x32')]=_[_0x9332('0x33')](_0xe70e7,_0x9332('0x2c'));_0x531b96['query']=_[_0x9332('0x34')](_0x41ca77[_0x9332('0x35')]);_0x531b96[_0x9332('0x36')]=_[_0x9332('0x37')](_0x531b96[_0x9332('0x32')],_0x531b96['query']);_0xa4222f[_0x9332('0x38')]=_[_0x9332('0x37')](_0x531b96[_0x9332('0x32')],qs['fields'](_0x41ca77['query'][_0x9332('0x39')]));_0xa4222f[_0x9332('0x38')]=_0xa4222f[_0x9332('0x38')][_0x9332('0x3a')]?_0xa4222f[_0x9332('0x38')]:_0x531b96['model'];if(!_0x41ca77[_0x9332('0x35')][_0x9332('0x3b')](_0x9332('0x3c'))){_0xa4222f[_0x9332('0x21')]=qs[_0x9332('0x21')](_0x41ca77[_0x9332('0x35')][_0x9332('0x21')]);_0xa4222f['offset']=qs[_0x9332('0x1e')](_0x41ca77[_0x9332('0x35')]['offset']);}_0xa4222f[_0x9332('0x3d')]=qs[_0x9332('0x3e')](_0x41ca77[_0x9332('0x35')][_0x9332('0x3e')]);_0xa4222f[_0x9332('0x3f')]=qs['filters'](_['pick'](_0x41ca77[_0x9332('0x35')],_0x531b96[_0x9332('0x36')]),_0xe70e7);if(_0x41ca77['query'][_0x9332('0x40')]){_0xa4222f['where']=_[_0x9332('0x41')](_0xa4222f[_0x9332('0x3f')],{'$or':_[_0x9332('0x33')](_0xe70e7,function(_0x4d0f39){if(_0x4d0f39['type']!==_0x9332('0x42')){var _0x10923c={};_0x10923c[_0x4d0f39[_0x9332('0x2c')]]={'$like':'%'+_0x41ca77[_0x9332('0x35')][_0x9332('0x40')]+'%'};return _0x10923c;}})});}_0xa4222f=_[_0x9332('0x41')]({},_0xa4222f,_0x41ca77['options']);var _0x46fa4a={'where':_0xa4222f[_0x9332('0x3f')]};return db[_0x9332('0x2e')][_0x9332('0x20')](_0x46fa4a)['then'](function(_0x3bab8c){_0x4e1491[_0x9332('0x20')]=_0x3bab8c;if(_0x41ca77[_0x9332('0x35')][_0x9332('0x43')]){_0xa4222f[_0x9332('0x44')]=[{'all':!![]}];}return db[_0x9332('0x2e')][_0x9332('0x45')](_0xa4222f);})[_0x9332('0x27')](function(_0x54f491){_0x4e1491[_0x9332('0x46')]=_0x54f491;return _0x4e1491;})[_0x9332('0x27')](respondWithFilteredResult(_0x2cb234,_0xa4222f))[_0x9332('0x47')](handleError(_0x2cb234,null));};exports['show']=function(_0x49b055,_0x3df366){var _0x317f0c={'raw':!![],'where':{'id':_0x49b055[_0x9332('0x48')]['id']}},_0x2a5f95={};_0x2a5f95[_0x9332('0x32')]=_[_0x9332('0x34')](db[_0x9332('0x2e')][_0x9332('0x2f')]);_0x2a5f95[_0x9332('0x35')]=_[_0x9332('0x34')](_0x49b055[_0x9332('0x35')]);_0x2a5f95[_0x9332('0x36')]=_[_0x9332('0x37')](_0x2a5f95[_0x9332('0x32')],_0x2a5f95['query']);_0x317f0c['attributes']=_[_0x9332('0x37')](_0x2a5f95[_0x9332('0x32')],qs[_0x9332('0x39')](_0x49b055['query'][_0x9332('0x39')]));_0x317f0c[_0x9332('0x38')]=_0x317f0c[_0x9332('0x38')]['length']?_0x317f0c[_0x9332('0x38')]:_0x2a5f95[_0x9332('0x32')];if(_0x49b055[_0x9332('0x35')]['includeAll']){_0x317f0c[_0x9332('0x44')]=[{'all':!![]}];}_0x317f0c=_[_0x9332('0x41')]({},_0x317f0c,_0x49b055['options']);return db[_0x9332('0x2e')][_0x9332('0x49')](_0x317f0c)[_0x9332('0x27')](handleEntityNotFound(_0x3df366,null))[_0x9332('0x27')](respondWithResult(_0x3df366,null))[_0x9332('0x47')](handleError(_0x3df366,null));};exports[_0x9332('0x4a')]=function(_0x5b89b3,_0x194302){return db['Interval'][_0x9332('0x4a')](_0x5b89b3[_0x9332('0x4b')],{})[_0x9332('0x27')](function(_0x10ae86){var _0x3a4c08=_0x5b89b3[_0x9332('0x4c')][_0x9332('0x29')]({'plain':!![]});if(!_0x3a4c08)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a4c08[_0x9332('0x4d')]===_0x9332('0x4c')){var _0x5ba06f=_0x10ae86['get']({'plain':!![]});var _0x3be197=_0x9332('0x2a');return db[_0x9332('0x4e')][_0x9332('0x49')]({'where':{'name':_0x3be197,'userProfileId':_0x3a4c08[_0x9332('0x4f')]},'raw':!![]})['then'](function(_0x43e587){if(_0x43e587&&_0x43e587[_0x9332('0x50')]===0x0){return db[_0x9332('0x51')][_0x9332('0x4a')]({'name':_0x5ba06f[_0x9332('0x2c')],'resourceId':_0x5ba06f['id'],'type':_0x43e587[_0x9332('0x2c')],'sectionId':_0x43e587['id']},{})['then'](function(){return _0x10ae86;});}else{return _0x10ae86;}})['catch'](function(_0x346339){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x346339);throw _0x346339;});}return _0x10ae86;})[_0x9332('0x27')](respondWithResult(_0x194302,0xc9))[_0x9332('0x47')](handleError(_0x194302,null));};exports[_0x9332('0x26')]=function(_0x2e7ad2,_0xde298b){if(_0x2e7ad2[_0x9332('0x4b')]['id']){delete _0x2e7ad2['body']['id'];}return db[_0x9332('0x2e')][_0x9332('0x49')]({'where':{'id':_0x2e7ad2[_0x9332('0x48')]['id']}})['then'](handleEntityNotFound(_0xde298b,null))[_0x9332('0x27')](saveUpdates(_0x2e7ad2[_0x9332('0x4b')],null))[_0x9332('0x27')](respondWithResult(_0xde298b,null))[_0x9332('0x47')](handleError(_0xde298b,null));};exports[_0x9332('0x28')]=function(_0x35f5b1,_0x4ca93a){return db['Interval']['find']({'where':{'id':_0x35f5b1[_0x9332('0x48')]['id']}})['then'](handleEntityNotFound(_0x4ca93a,null))[_0x9332('0x27')](removeEntity(_0x4ca93a,null))[_0x9332('0x47')](handleError(_0x4ca93a,null));};exports[_0x9332('0x52')]=function(_0x3baa57,_0x35a793,_0x12727f){if(_0x3baa57['body']['id']){delete _0x3baa57[_0x9332('0x4b')]['id'];}return db['Interval'][_0x9332('0x49')]({'where':{'id':_0x3baa57[_0x9332('0x48')]['id']}})[_0x9332('0x27')](handleEntityNotFound(_0x35a793,null))[_0x9332('0x27')](function(_0x1411f1){if(_0x1411f1){_0x3baa57['body'][_0x9332('0x53')]=_0x1411f1['id'];return db[_0x9332('0x2e')]['create'](_0x3baa57[_0x9332('0x4b')]);}})[_0x9332('0x27')](respondWithResult(_0x35a793,null))[_0x9332('0x47')](handleError(_0x35a793,null));};exports['getIntervals']=function(_0x24ec07,_0x401f5a,_0x2c40c4){var _0x200aa0={};var _0xc282a4={};var _0x46e3cf;var _0x45b232;return db[_0x9332('0x2e')][_0x9332('0x54')]({'where':{'id':_0x24ec07[_0x9332('0x48')]['id']}})[_0x9332('0x27')](handleEntityNotFound(_0x401f5a,null))['then'](function(_0x5a7917){if(_0x5a7917){_0x46e3cf=_0x5a7917;_0xc282a4[_0x9332('0x32')]=_['keys'](db[_0x9332('0x2e')][_0x9332('0x2f')]);_0xc282a4[_0x9332('0x35')]=_[_0x9332('0x34')](_0x24ec07[_0x9332('0x35')]);_0xc282a4['filters']=_[_0x9332('0x37')](_0xc282a4[_0x9332('0x32')],_0xc282a4['query']);_0x200aa0[_0x9332('0x38')]=_['intersection'](_0xc282a4[_0x9332('0x32')],qs[_0x9332('0x39')](_0x24ec07[_0x9332('0x35')]['fields']));_0x200aa0[_0x9332('0x38')]=_0x200aa0['attributes'][_0x9332('0x3a')]?_0x200aa0[_0x9332('0x38')]:_0xc282a4[_0x9332('0x32')];_0x200aa0[_0x9332('0x3d')]=qs[_0x9332('0x3e')](_0x24ec07['query']['sort']);_0x200aa0[_0x9332('0x3f')]=qs[_0x9332('0x36')](_['pick'](_0x24ec07[_0x9332('0x35')],_0xc282a4[_0x9332('0x36')]));if(_0x24ec07[_0x9332('0x35')][_0x9332('0x40')]){_0x200aa0[_0x9332('0x3f')]=_['merge'](_0x200aa0[_0x9332('0x3f')],{'$or':_[_0x9332('0x33')](_0x200aa0[_0x9332('0x38')],function(_0x1b1569){var _0x47a486={};_0x47a486[_0x1b1569]={'$like':'%'+_0x24ec07['query'][_0x9332('0x40')]+'%'};return _0x47a486;})});}_0x200aa0=_['merge']({},_0x200aa0,_0x24ec07['options']);return _0x46e3cf[_0x9332('0x55')](_0x200aa0);}})['then'](function(_0x476262){if(_0x476262){_0x45b232=_0x476262[_0x9332('0x3a')];if(!_0x24ec07[_0x9332('0x35')]['hasOwnProperty'](_0x9332('0x3c'))){_0x200aa0[_0x9332('0x21')]=qs['limit'](_0x24ec07[_0x9332('0x35')][_0x9332('0x21')]);_0x200aa0[_0x9332('0x1e')]=qs[_0x9332('0x1e')](_0x24ec07[_0x9332('0x35')][_0x9332('0x1e')]);}return _0x46e3cf[_0x9332('0x55')](_0x200aa0);}})[_0x9332('0x27')](function(_0x4a6cb0){if(_0x4a6cb0){return _0x4a6cb0?{'count':_0x45b232,'rows':_0x4a6cb0}:null;}})[_0x9332('0x27')](respondWithResult(_0x401f5a,null))[_0x9332('0x47')](handleError(_0x401f5a,null));};exports[_0x9332('0x56')]=function(_0x305896,_0x24676b,_0x2851f1){return db[_0x9332('0x2e')]['findOne']({'where':{'id':_0x305896[_0x9332('0x48')]['id']}})[_0x9332('0x27')](handleEntityNotFound(_0x24676b,null))['then'](function(_0x456910){if(_0x456910){return db['sequelize'][_0x9332('0x57')](function(_0x5ee1fc){return db[_0x9332('0x2e')][_0x9332('0x28')]({'where':{'IntervalId':_0x305896[_0x9332('0x48')]['id']},'transaction':_0x5ee1fc})[_0x9332('0x27')](function(_0x113db5){var _0x4d6fa0=_[_0x9332('0x33')](_0x305896['body'],function(_0x20ad53){delete _0x20ad53['id'];_0x20ad53['IntervalId']=_0x305896[_0x9332('0x48')]['id'];return _0x20ad53;});return db[_0x9332('0x2e')][_0x9332('0x58')](_0x4d6fa0,{'transaction':_0x5ee1fc});});})[_0x9332('0x27')](function(){return db[_0x9332('0x2e')][_0x9332('0x45')]({'where':{'IntervalId':_0x305896[_0x9332('0x48')]['id']}});});}})[_0x9332('0x27')](respondWithResult(_0x24676b,null))[_0x9332('0x47')](handleError(_0x24676b,null));}; \ No newline at end of file +var _0xfb69=['addIntervals','sequelize','transaction','bulkCreate','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','Intervals','UserProfileResource','sendStatus','error','name','send','index','map','Interval','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addInterval','IntervalId','getIntervals','findOne','hasOwnProperty'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xfb69,0x67));var _0x9fb6=function(_0x22edd1,_0x2e37ef){_0x22edd1=_0x22edd1-0x0;var _0xf7cbb9=_0xfb69[_0x22edd1];return _0xf7cbb9;};'use strict';var emlformat=require(_0x9fb6('0x0'));var rimraf=require(_0x9fb6('0x1'));var zipdir=require(_0x9fb6('0x2'));var jsonpatch=require(_0x9fb6('0x3'));var rp=require(_0x9fb6('0x4'));var moment=require(_0x9fb6('0x5'));var BPromise=require(_0x9fb6('0x6'));var Mustache=require(_0x9fb6('0x7'));var util=require(_0x9fb6('0x8'));var path=require(_0x9fb6('0x9'));var sox=require(_0x9fb6('0xa'));var csv=require(_0x9fb6('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9fb6('0xc'));var _=require(_0x9fb6('0xd'));var squel=require(_0x9fb6('0xe'));var crypto=require(_0x9fb6('0xf'));var jsforce=require(_0x9fb6('0x10'));var deskjs=require(_0x9fb6('0x11'));var toCsv=require(_0x9fb6('0xb'));var querystring=require(_0x9fb6('0x12'));var Papa=require(_0x9fb6('0x13'));var Redis=require('ioredis');var authService=require(_0x9fb6('0x14'));var qs=require(_0x9fb6('0x15'));var as=require(_0x9fb6('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9fb6('0x17'))('api');var utils=require(_0x9fb6('0x18'));var config=require(_0x9fb6('0x19'));var licenseUtil=require(_0x9fb6('0x1a'));var db=require(_0x9fb6('0x1b'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x3433e6,_0x398e27){_0x398e27=_0x398e27||0xcc;return function(_0x25c720){if(_0x25c720){return _0x3433e6['sendStatus'](_0x398e27);}return _0x3433e6['status'](_0x398e27)[_0x9fb6('0x1c')]();};}function respondWithResult(_0x3b3a4a,_0x42ec5d){_0x42ec5d=_0x42ec5d||0xc8;return function(_0x2bd335){if(_0x2bd335){return _0x3b3a4a[_0x9fb6('0x1d')](_0x42ec5d)[_0x9fb6('0x1e')](_0x2bd335);}};}function respondWithFilteredResult(_0x37d6e9,_0x2ae6d8){return function(_0x8cdf81){if(_0x8cdf81){var _0x2441bf=typeof _0x2ae6d8[_0x9fb6('0x1f')]===_0x9fb6('0x20')&&typeof _0x2ae6d8[_0x9fb6('0x21')]===_0x9fb6('0x20');var _0x5b21d9=_0x8cdf81['count'];var _0x1c8039=_0x2441bf?0x0:_0x2ae6d8['offset'];var _0x10e869=_0x2441bf?_0x8cdf81[_0x9fb6('0x22')]:_0x2ae6d8[_0x9fb6('0x1f')]+_0x2ae6d8['limit'];var _0x582048;if(_0x10e869>=_0x5b21d9){_0x10e869=_0x5b21d9;_0x582048=0xc8;}else{_0x582048=0xce;}_0x37d6e9[_0x9fb6('0x1d')](_0x582048);return _0x37d6e9[_0x9fb6('0x23')]('Content-Range',_0x1c8039+'-'+_0x10e869+'/'+_0x5b21d9)[_0x9fb6('0x1e')](_0x8cdf81);}return null;};}function patchUpdates(_0x592803){return function(_0x1349ad){try{jsonpatch[_0x9fb6('0x24')](_0x1349ad,_0x592803,!![]);}catch(_0x351b80){return BPromise[_0x9fb6('0x25')](_0x351b80);}return _0x1349ad[_0x9fb6('0x26')]();};}function saveUpdates(_0x3fd2cf,_0x1acbdc){return function(_0xa34d5c){if(_0xa34d5c){return _0xa34d5c[_0x9fb6('0x27')](_0x3fd2cf)[_0x9fb6('0x28')](function(_0x1fdea5){return _0x1fdea5;});}return null;};}function removeEntity(_0x80944b,_0xddd88c){return function(_0x447603){if(_0x447603){return _0x447603[_0x9fb6('0x29')]()[_0x9fb6('0x28')](function(){var _0x2988c4=_0x447603['get']({'plain':!![]});var _0x1eb6fa=_0x9fb6('0x2a');return db[_0x9fb6('0x2b')][_0x9fb6('0x29')]({'where':{'type':_0x1eb6fa,'resourceId':_0x2988c4['id']}})[_0x9fb6('0x28')](function(){return _0x447603;});})['then'](function(){_0x80944b[_0x9fb6('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53fb34,_0x6a95e2){return function(_0x56a9be){if(!_0x56a9be){_0x53fb34[_0x9fb6('0x2c')](0x194);}return _0x56a9be;};}function handleError(_0xd57795,_0x1cfa11){_0x1cfa11=_0x1cfa11||0x1f4;return function(_0x56916d){logger[_0x9fb6('0x2d')](_0x56916d['stack']);if(_0x56916d[_0x9fb6('0x2e')]){delete _0x56916d[_0x9fb6('0x2e')];}_0xd57795[_0x9fb6('0x1d')](_0x1cfa11)[_0x9fb6('0x2f')](_0x56916d);};}exports[_0x9fb6('0x30')]=function(_0x381369,_0x229db8){var _0x5c8665={},_0x4acb1c={},_0x346fa1={'count':0x0,'rows':[]};var _0x4b6a35=_[_0x9fb6('0x31')](db[_0x9fb6('0x32')]['rawAttributes'],function(_0x1afe19){return{'name':_0x1afe19[_0x9fb6('0x33')],'type':_0x1afe19[_0x9fb6('0x34')]['key']};});_0x4acb1c[_0x9fb6('0x35')]=_[_0x9fb6('0x31')](_0x4b6a35,_0x9fb6('0x2e'));_0x4acb1c[_0x9fb6('0x36')]=_[_0x9fb6('0x37')](_0x381369[_0x9fb6('0x36')]);_0x4acb1c[_0x9fb6('0x38')]=_['intersection'](_0x4acb1c[_0x9fb6('0x35')],_0x4acb1c['query']);_0x5c8665['attributes']=_[_0x9fb6('0x39')](_0x4acb1c[_0x9fb6('0x35')],qs[_0x9fb6('0x3a')](_0x381369['query'][_0x9fb6('0x3a')]));_0x5c8665[_0x9fb6('0x3b')]=_0x5c8665[_0x9fb6('0x3b')][_0x9fb6('0x3c')]?_0x5c8665[_0x9fb6('0x3b')]:_0x4acb1c['model'];if(!_0x381369[_0x9fb6('0x36')]['hasOwnProperty'](_0x9fb6('0x3d'))){_0x5c8665[_0x9fb6('0x21')]=qs[_0x9fb6('0x21')](_0x381369[_0x9fb6('0x36')][_0x9fb6('0x21')]);_0x5c8665['offset']=qs[_0x9fb6('0x1f')](_0x381369['query'][_0x9fb6('0x1f')]);}_0x5c8665[_0x9fb6('0x3e')]=qs[_0x9fb6('0x3f')](_0x381369[_0x9fb6('0x36')][_0x9fb6('0x3f')]);_0x5c8665['where']=qs['filters'](_[_0x9fb6('0x40')](_0x381369[_0x9fb6('0x36')],_0x4acb1c[_0x9fb6('0x38')]),_0x4b6a35);if(_0x381369[_0x9fb6('0x36')]['filter']){_0x5c8665[_0x9fb6('0x41')]=_[_0x9fb6('0x42')](_0x5c8665[_0x9fb6('0x41')],{'$or':_[_0x9fb6('0x31')](_0x4b6a35,function(_0x3ac0d7){if(_0x3ac0d7[_0x9fb6('0x34')]!==_0x9fb6('0x43')){var _0xbc515={};_0xbc515[_0x3ac0d7[_0x9fb6('0x2e')]]={'$like':'%'+_0x381369['query'][_0x9fb6('0x44')]+'%'};return _0xbc515;}})});}_0x5c8665=_[_0x9fb6('0x42')]({},_0x5c8665,_0x381369[_0x9fb6('0x45')]);var _0x4609dd={'where':_0x5c8665[_0x9fb6('0x41')]};return db[_0x9fb6('0x32')][_0x9fb6('0x22')](_0x4609dd)[_0x9fb6('0x28')](function(_0x2f5a37){_0x346fa1[_0x9fb6('0x22')]=_0x2f5a37;if(_0x381369['query'][_0x9fb6('0x46')]){_0x5c8665[_0x9fb6('0x47')]=[{'all':!![]}];}return db['Interval']['findAll'](_0x5c8665);})[_0x9fb6('0x28')](function(_0x567b75){_0x346fa1[_0x9fb6('0x48')]=_0x567b75;return _0x346fa1;})[_0x9fb6('0x28')](respondWithFilteredResult(_0x229db8,_0x5c8665))[_0x9fb6('0x49')](handleError(_0x229db8,null));};exports[_0x9fb6('0x4a')]=function(_0x3896c5,_0x416b3e){var _0x5eca1d={'raw':!![],'where':{'id':_0x3896c5['params']['id']}},_0x5495b3={};_0x5495b3[_0x9fb6('0x35')]=_[_0x9fb6('0x37')](db['Interval'][_0x9fb6('0x4b')]);_0x5495b3[_0x9fb6('0x36')]=_['keys'](_0x3896c5[_0x9fb6('0x36')]);_0x5495b3[_0x9fb6('0x38')]=_[_0x9fb6('0x39')](_0x5495b3[_0x9fb6('0x35')],_0x5495b3[_0x9fb6('0x36')]);_0x5eca1d['attributes']=_[_0x9fb6('0x39')](_0x5495b3[_0x9fb6('0x35')],qs[_0x9fb6('0x3a')](_0x3896c5[_0x9fb6('0x36')]['fields']));_0x5eca1d['attributes']=_0x5eca1d[_0x9fb6('0x3b')][_0x9fb6('0x3c')]?_0x5eca1d['attributes']:_0x5495b3['model'];if(_0x3896c5[_0x9fb6('0x36')][_0x9fb6('0x46')]){_0x5eca1d['include']=[{'all':!![]}];}_0x5eca1d=_[_0x9fb6('0x42')]({},_0x5eca1d,_0x3896c5[_0x9fb6('0x45')]);return db[_0x9fb6('0x32')][_0x9fb6('0x4c')](_0x5eca1d)[_0x9fb6('0x28')](handleEntityNotFound(_0x416b3e,null))['then'](respondWithResult(_0x416b3e,null))[_0x9fb6('0x49')](handleError(_0x416b3e,null));};exports[_0x9fb6('0x4d')]=function(_0x2df490,_0x2af7da){return db[_0x9fb6('0x32')][_0x9fb6('0x4d')](_0x2df490[_0x9fb6('0x4e')],{})['then'](function(_0x5e1bd3){var _0x3d96d1=_0x2df490[_0x9fb6('0x4f')][_0x9fb6('0x50')]({'plain':!![]});if(!_0x3d96d1)throw new Error(_0x9fb6('0x51'));if(_0x3d96d1[_0x9fb6('0x52')]===_0x9fb6('0x4f')){var _0x18ac52=_0x5e1bd3[_0x9fb6('0x50')]({'plain':!![]});var _0x17502e='Intervals';return db[_0x9fb6('0x53')][_0x9fb6('0x4c')]({'where':{'name':_0x17502e,'userProfileId':_0x3d96d1[_0x9fb6('0x54')]},'raw':!![]})[_0x9fb6('0x28')](function(_0x51362d){if(_0x51362d&&_0x51362d[_0x9fb6('0x55')]===0x0){return db[_0x9fb6('0x2b')][_0x9fb6('0x4d')]({'name':_0x18ac52[_0x9fb6('0x2e')],'resourceId':_0x18ac52['id'],'type':_0x51362d['name'],'sectionId':_0x51362d['id']},{})[_0x9fb6('0x28')](function(){return _0x5e1bd3;});}else{return _0x5e1bd3;}})[_0x9fb6('0x49')](function(_0x7db6dd){logger[_0x9fb6('0x2d')](_0x9fb6('0x56'),_0x7db6dd);throw _0x7db6dd;});}return _0x5e1bd3;})['then'](respondWithResult(_0x2af7da,0xc9))[_0x9fb6('0x49')](handleError(_0x2af7da,null));};exports[_0x9fb6('0x27')]=function(_0x2632e1,_0x279f9f){if(_0x2632e1[_0x9fb6('0x4e')]['id']){delete _0x2632e1[_0x9fb6('0x4e')]['id'];}return db['Interval'][_0x9fb6('0x4c')]({'where':{'id':_0x2632e1[_0x9fb6('0x57')]['id']}})[_0x9fb6('0x28')](handleEntityNotFound(_0x279f9f,null))['then'](saveUpdates(_0x2632e1[_0x9fb6('0x4e')],null))[_0x9fb6('0x28')](respondWithResult(_0x279f9f,null))['catch'](handleError(_0x279f9f,null));};exports[_0x9fb6('0x29')]=function(_0x2e4dc0,_0x695ac1){return db[_0x9fb6('0x32')][_0x9fb6('0x4c')]({'where':{'id':_0x2e4dc0[_0x9fb6('0x57')]['id']}})['then'](handleEntityNotFound(_0x695ac1,null))[_0x9fb6('0x28')](removeEntity(_0x695ac1,null))[_0x9fb6('0x49')](handleError(_0x695ac1,null));};exports[_0x9fb6('0x58')]=function(_0x3f682c,_0x4f5b09,_0x59f58c){if(_0x3f682c[_0x9fb6('0x4e')]['id']){delete _0x3f682c[_0x9fb6('0x4e')]['id'];}return db[_0x9fb6('0x32')]['find']({'where':{'id':_0x3f682c[_0x9fb6('0x57')]['id']}})[_0x9fb6('0x28')](handleEntityNotFound(_0x4f5b09,null))[_0x9fb6('0x28')](function(_0x737963){if(_0x737963){_0x3f682c[_0x9fb6('0x4e')][_0x9fb6('0x59')]=_0x737963['id'];return db['Interval'][_0x9fb6('0x4d')](_0x3f682c['body']);}})[_0x9fb6('0x28')](respondWithResult(_0x4f5b09,null))[_0x9fb6('0x49')](handleError(_0x4f5b09,null));};exports[_0x9fb6('0x5a')]=function(_0x46c473,_0x315cd0,_0xd26d16){var _0x407a61={};var _0x14e34d={};var _0x374080;var _0x2d9dd5;return db['Interval'][_0x9fb6('0x5b')]({'where':{'id':_0x46c473['params']['id']}})[_0x9fb6('0x28')](handleEntityNotFound(_0x315cd0,null))[_0x9fb6('0x28')](function(_0x231995){if(_0x231995){_0x374080=_0x231995;_0x14e34d[_0x9fb6('0x35')]=_[_0x9fb6('0x37')](db[_0x9fb6('0x32')][_0x9fb6('0x4b')]);_0x14e34d['query']=_['keys'](_0x46c473['query']);_0x14e34d[_0x9fb6('0x38')]=_[_0x9fb6('0x39')](_0x14e34d[_0x9fb6('0x35')],_0x14e34d[_0x9fb6('0x36')]);_0x407a61['attributes']=_[_0x9fb6('0x39')](_0x14e34d[_0x9fb6('0x35')],qs['fields'](_0x46c473[_0x9fb6('0x36')]['fields']));_0x407a61[_0x9fb6('0x3b')]=_0x407a61[_0x9fb6('0x3b')]['length']?_0x407a61['attributes']:_0x14e34d['model'];_0x407a61[_0x9fb6('0x3e')]=qs[_0x9fb6('0x3f')](_0x46c473[_0x9fb6('0x36')][_0x9fb6('0x3f')]);_0x407a61['where']=qs['filters'](_[_0x9fb6('0x40')](_0x46c473[_0x9fb6('0x36')],_0x14e34d[_0x9fb6('0x38')]));if(_0x46c473[_0x9fb6('0x36')][_0x9fb6('0x44')]){_0x407a61[_0x9fb6('0x41')]=_['merge'](_0x407a61[_0x9fb6('0x41')],{'$or':_['map'](_0x407a61[_0x9fb6('0x3b')],function(_0x55edd0){var _0x30abc7={};_0x30abc7[_0x55edd0]={'$like':'%'+_0x46c473[_0x9fb6('0x36')]['filter']+'%'};return _0x30abc7;})});}_0x407a61=_['merge']({},_0x407a61,_0x46c473['options']);return _0x374080[_0x9fb6('0x5a')](_0x407a61);}})['then'](function(_0x55dfa0){if(_0x55dfa0){_0x2d9dd5=_0x55dfa0[_0x9fb6('0x3c')];if(!_0x46c473[_0x9fb6('0x36')][_0x9fb6('0x5c')](_0x9fb6('0x3d'))){_0x407a61['limit']=qs['limit'](_0x46c473[_0x9fb6('0x36')]['limit']);_0x407a61[_0x9fb6('0x1f')]=qs[_0x9fb6('0x1f')](_0x46c473[_0x9fb6('0x36')][_0x9fb6('0x1f')]);}return _0x374080[_0x9fb6('0x5a')](_0x407a61);}})[_0x9fb6('0x28')](function(_0x235f17){if(_0x235f17){return _0x235f17?{'count':_0x2d9dd5,'rows':_0x235f17}:null;}})[_0x9fb6('0x28')](respondWithResult(_0x315cd0,null))[_0x9fb6('0x49')](handleError(_0x315cd0,null));};exports[_0x9fb6('0x5d')]=function(_0x20e2ed,_0x2ba33f,_0x2c2bf2){return db[_0x9fb6('0x32')][_0x9fb6('0x5b')]({'where':{'id':_0x20e2ed[_0x9fb6('0x57')]['id']}})[_0x9fb6('0x28')](handleEntityNotFound(_0x2ba33f,null))['then'](function(_0x47c510){if(_0x47c510){return db[_0x9fb6('0x5e')][_0x9fb6('0x5f')](function(_0x77f57d){return db[_0x9fb6('0x32')][_0x9fb6('0x29')]({'where':{'IntervalId':_0x20e2ed[_0x9fb6('0x57')]['id']},'transaction':_0x77f57d})[_0x9fb6('0x28')](function(_0x1443df){var _0x798348=_[_0x9fb6('0x31')](_0x20e2ed[_0x9fb6('0x4e')],function(_0x2130e5){delete _0x2130e5['id'];_0x2130e5[_0x9fb6('0x59')]=_0x20e2ed['params']['id'];return _0x2130e5;});return db[_0x9fb6('0x32')][_0x9fb6('0x60')](_0x798348,{'transaction':_0x77f57d});});})[_0x9fb6('0x28')](function(){return db[_0x9fb6('0x32')][_0x9fb6('0x61')]({'where':{'IntervalId':_0x20e2ed[_0x9fb6('0x57')]['id']}});});}})[_0x9fb6('0x28')](respondWithResult(_0x2ba33f,null))[_0x9fb6('0x49')](handleError(_0x2ba33f,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 492642f..8a70c16 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 _0x261b=['api','request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','lodash','util','../../config/logger'];(function(_0x523da0,_0x50c7aa){var _0x4c75ab=function(_0x2495f8){while(--_0x2495f8){_0x523da0['push'](_0x523da0['shift']());}};_0x4c75ab(++_0x50c7aa);}(_0x261b,0x93));var _0xb261=function(_0x197e21,_0x2120b1){_0x197e21=_0x197e21-0x0;var _0x2b8a8d=_0x261b[_0x197e21];return _0x2b8a8d;};'use strict';var _=require(_0xb261('0x0'));var util=require(_0xb261('0x1'));var logger=require(_0xb261('0x2'))(_0xb261('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb261('0x4'));var fs=require('fs');var path=require(_0xb261('0x5'));var rimraf=require(_0xb261('0x6'));var config=require(_0xb261('0x7'));var attributes=require(_0xb261('0x8'));var extensions=require(_0xb261('0x9'));module[_0xb261('0xa')]=function(_0x3728aa,_0x47e9a7){return _0x3728aa[_0xb261('0xb')](_0xb261('0xc'),attributes,{'tableName':_0xb261('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x361a1e,_0x22d151){extensions[_0xb261('0xe')](_0x3728aa,_0x361a1e);},'afterBulkCreate':function(_0x7baba9,_0x3e1e75,_0x298e0f){_0x298e0f();extensions[_0xb261('0xe')](_0x3728aa,_0x7baba9[0x0]);},'afterUpdate':function(_0x1334a7,_0x393517){extensions[_0xb261('0xe')](_0x3728aa,_0x1334a7);},'afterDestroy':function(_0x2e61ec,_0x37dd5a){extensions[_0xb261('0xe')](_0x3728aa,_0x2e61ec);}}});}; \ No newline at end of file +var _0xa72a=['request-promise','path','rimraf','../../components/extensions/rewrite','exports','define','tools_intervals','rewrite','lodash','../../config/logger','api','moment'];(function(_0x1f60e9,_0x4238c8){var _0x3173ff=function(_0x2d18bf){while(--_0x2d18bf){_0x1f60e9['push'](_0x1f60e9['shift']());}};_0x3173ff(++_0x4238c8);}(_0xa72a,0xc8));var _0xaa72=function(_0x452144,_0x170931){_0x452144=_0x452144-0x0;var _0x37f223=_0xa72a[_0x452144];return _0x37f223;};'use strict';var _=require(_0xaa72('0x0'));var util=require('util');var logger=require(_0xaa72('0x1'))(_0xaa72('0x2'));var moment=require(_0xaa72('0x3'));var BPromise=require('bluebird');var rp=require(_0xaa72('0x4'));var fs=require('fs');var path=require(_0xaa72('0x5'));var rimraf=require(_0xaa72('0x6'));var config=require('../../config/environment');var attributes=require('./interval.attributes');var extensions=require(_0xaa72('0x7'));module[_0xaa72('0x8')]=function(_0x485fb5,_0x592fef){return _0x485fb5[_0xaa72('0x9')]('Interval',attributes,{'tableName':_0xaa72('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x232f90,_0x12f890){extensions['rewrite'](_0x485fb5,_0x232f90);},'afterBulkCreate':function(_0x21aa08,_0x56b1bd,_0x3cc11e){_0x3cc11e();extensions[_0xaa72('0xb')](_0x485fb5,_0x21aa08[0x0]);},'afterUpdate':function(_0x37f37e,_0x40fa9e){extensions[_0xaa72('0xb')](_0x485fb5,_0x37f37e);},'afterDestroy':function(_0x544954,_0x3888ae){extensions['rewrite'](_0x485fb5,_0x544954);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index fc47ad3..80a836c 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(_0x2265da,_0xfbbd2e){var _0x430c2b=function(_0x20d671){while(--_0x20d671){_0x2265da['push'](_0x2265da['shift']());}};_0x430c2b(++_0xfbbd2e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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 594fafd..967089b 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 _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x3d9b04,_0x1e851a){var _0x557936=function(_0x3bf3ae){while(--_0x3bf3ae){_0x3d9b04['push'](_0x3d9b04['shift']());}};_0x557936(++_0x1e851a);}(_0x5f66,0x1a0));var _0x65f6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5f66[_0x21a9d9];return _0x46adce;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('0x5')]=router; \ No newline at end of file +var _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x41cbc3,_0x4a97cd){var _0x554549=function(_0x405ed5){while(--_0x405ed5){_0x41cbc3['push'](_0x41cbc3['shift']());}};_0x554549(++_0x4a97cd);}(_0x2032,0xd9));var _0x2203=function(_0xef6bc7,_0x92ddf0){_0xef6bc7=_0xef6bc7-0x0;var _0x40dd79=_0x2032[_0xef6bc7];return _0x40dd79;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 9931185..8f5bb14 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 _0xc649=['json','parse','write','send','body','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','api','support','3eAmWpBVP0','\x20from\x20','description','stringify','issuetype','customfield_11500','email','fields','customfield_11501','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','Basic\x20','toString','utf8','data','end','status','statusCode'];(function(_0x49597c,_0x4b7c25){var _0x18684a=function(_0xe630d8){while(--_0xe630d8){_0x49597c['push'](_0x49597c['shift']());}};_0x18684a(++_0x4b7c25);}(_0xc649,0xc7));var _0x9c64=function(_0x2eb356,_0x663d13){_0x2eb356=_0x2eb356-0x0;var _0x1a342e=_0xc649[_0x2eb356];return _0x1a342e;};'use strict';var BPromise=require(_0x9c64('0x0'));var https=require(_0x9c64('0x1'));var logger=require('../../config/logger')(_0x9c64('0x2'));var USERNAME=_0x9c64('0x3');var PASSWORD=_0x9c64('0x4');function openIssue(_0x22f791,_0xb1e44f){var _0x7f7d9a={'fields':{'project':{'key':_0x22f791['key']||'MOTGUI'},'summary':(_0x22f791['summary']||'Report')+_0x9c64('0x5')+_0x22f791['ip'],'description':_0x22f791[_0x9c64('0x6')]||JSON[_0x9c64('0x7')](_0x22f791),'issuetype':{'name':_0x22f791[_0x9c64('0x8')]||'Bug'}}};_0x7f7d9a['fields'][_0x9c64('0x9')]=_0x22f791[_0x9c64('0xa')];_0x7f7d9a[_0x9c64('0xb')][_0x9c64('0xc')]=_0x22f791['oldToken'];_0x7f7d9a['fields']['customfield_11502']=_0x22f791[_0x9c64('0xd')];_0x7f7d9a[_0x9c64('0xb')][_0x9c64('0xe')]=_0x22f791[_0x9c64('0xf')];_0x7f7d9a[_0x9c64('0xb')][_0x9c64('0x10')]=_0x22f791[_0x9c64('0x11')];_0x7f7d9a[_0x9c64('0xb')][_0x9c64('0x12')]=_0x22f791['ip'];var _0x3e3193={'host':_0x9c64('0x13'),'port':0x1bb,'path':_0x9c64('0x14'),'method':_0x9c64('0x15'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x9c64('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0x9c64('0x17')]('base64')}};var _0xfc76eb=JSON[_0x9c64('0x7')](_0x7f7d9a);var _0x43eebf=https['request'](_0x3e3193,function(_0x5c1bbd){_0x5c1bbd['setEncoding'](_0x9c64('0x18'));var _0x3de5d1='';_0x5c1bbd['on'](_0x9c64('0x19'),function(_0x51784d){_0x3de5d1+=_0x51784d;});_0x5c1bbd['on'](_0x9c64('0x1a'),function(){if(_0xb1e44f){return _0xb1e44f[_0x9c64('0x1b')](_0x5c1bbd[_0x9c64('0x1c')])[_0x9c64('0x1d')](JSON[_0x9c64('0x1e')](_0x3de5d1));}});});_0x43eebf['on']('error',function(_0x583d95){if(_0xb1e44f){return _0xb1e44f[_0x9c64('0x1b')](0x1f4)[_0x9c64('0x1d')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':'api.jira'}]});}});_0x43eebf[_0x9c64('0x1f')](_0xfc76eb);_0x43eebf[_0x9c64('0x1a')]();}exports['openIssue']=openIssue;exports[_0x9c64('0x20')]=function(_0x19594e,_0x5dc8cc){_0x19594e[_0x9c64('0x21')]['ip']=_0x19594e['headers'][_0x9c64('0x22')]||_0x19594e[_0x9c64('0x23')][_0x9c64('0x24')]||_0x19594e[_0x9c64('0x25')][_0x9c64('0x24')]||_0x19594e[_0x9c64('0x23')][_0x9c64('0x25')][_0x9c64('0x24')];return openIssue(_0x19594e[_0x9c64('0x21')],_0x5dc8cc);}; \ No newline at end of file +var _0xf339=['api.jira','send','headers','x-forwarded-for','connection','socket','remoteAddress','body','../../config/logger','3eAmWpBVP0','key','Report','\x20from\x20','issuetype','Bug','fields','customfield_11500','customfield_11501','oldToken','customfield_11502','newToken','name','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','application/json','Basic\x20','toString','base64','stringify','setEncoding','utf8','data','end','status','statusCode','json','error'];(function(_0x14fdde,_0x46d3bd){var _0x158902=function(_0x1b38d3){while(--_0x1b38d3){_0x14fdde['push'](_0x14fdde['shift']());}};_0x158902(++_0x46d3bd);}(_0xf339,0x1dc));var _0x9f33=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf339[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require('bluebird');var https=require('https');var logger=require(_0x9f33('0x0'))('api');var USERNAME='support';var PASSWORD=_0x9f33('0x1');function openIssue(_0xa96efb,_0x498569){var _0x55a42b={'fields':{'project':{'key':_0xa96efb[_0x9f33('0x2')]||'MOTGUI'},'summary':(_0xa96efb['summary']||_0x9f33('0x3'))+_0x9f33('0x4')+_0xa96efb['ip'],'description':_0xa96efb['description']||JSON['stringify'](_0xa96efb),'issuetype':{'name':_0xa96efb[_0x9f33('0x5')]||_0x9f33('0x6')}}};_0x55a42b[_0x9f33('0x7')][_0x9f33('0x8')]=_0xa96efb['email'];_0x55a42b['fields'][_0x9f33('0x9')]=_0xa96efb[_0x9f33('0xa')];_0x55a42b[_0x9f33('0x7')][_0x9f33('0xb')]=_0xa96efb[_0x9f33('0xc')];_0x55a42b[_0x9f33('0x7')]['customfield_11503']=_0xa96efb[_0x9f33('0xd')];_0x55a42b[_0x9f33('0x7')]['customfield_11504']=_0xa96efb[_0x9f33('0xe')];_0x55a42b[_0x9f33('0x7')][_0x9f33('0xf')]=_0xa96efb['ip'];var _0x3bc073={'host':_0x9f33('0x10'),'port':0x1bb,'path':_0x9f33('0x11'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x9f33('0x12'),'Authorization':_0x9f33('0x13')+new Buffer(USERNAME+':'+PASSWORD)[_0x9f33('0x14')](_0x9f33('0x15'))}};var _0x3f352f=JSON[_0x9f33('0x16')](_0x55a42b);var _0x56ca36=https['request'](_0x3bc073,function(_0x38b71a){_0x38b71a[_0x9f33('0x17')](_0x9f33('0x18'));var _0x519072='';_0x38b71a['on'](_0x9f33('0x19'),function(_0x3265be){_0x519072+=_0x3265be;});_0x38b71a['on'](_0x9f33('0x1a'),function(){if(_0x498569){return _0x498569[_0x9f33('0x1b')](_0x38b71a[_0x9f33('0x1c')])[_0x9f33('0x1d')](JSON['parse'](_0x519072));}});});_0x56ca36['on'](_0x9f33('0x1e'),function(_0x3d6cb9){if(_0x498569){return _0x498569[_0x9f33('0x1b')](0x1f4)[_0x9f33('0x1d')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x9f33('0x1f')}]});}});_0x56ca36['write'](_0x3f352f);_0x56ca36['end']();}exports['openIssue']=openIssue;exports[_0x9f33('0x20')]=function(_0x1252ac,_0x247959){_0x1252ac['body']['ip']=_0x1252ac[_0x9f33('0x21')][_0x9f33('0x22')]||_0x1252ac[_0x9f33('0x23')]['remoteAddress']||_0x1252ac[_0x9f33('0x24')][_0x9f33('0x25')]||_0x1252ac['connection'][_0x9f33('0x24')][_0x9f33('0x25')];return openIssue(_0x1252ac[_0x9f33('0x26')],_0x247959);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 43ccbd7..89ba6dc 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 _0x3c81=['index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated'];(function(_0x12c32c,_0x13af3b){var _0x39b809=function(_0x278d4e){while(--_0x278d4e){_0x12c32c['push'](_0x12c32c['shift']());}};_0x39b809(++_0x13af3b);}(_0x3c81,0x102));var _0x13c8=function(_0x46f759,_0xc2f9f5){_0x46f759=_0x46f759-0x0;var _0xfae389=_0x3c81[_0x46f759];return _0xfae389;};'use strict';var multer=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var path=require('path');var timeout=require(_0x13c8('0x2'));var express=require(_0x13c8('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(_0x13c8('0x4'));var controller=require(_0x13c8('0x5'));router[_0x13c8('0x6')]('/',auth[_0x13c8('0x7')](),controller[_0x13c8('0x8')]);router[_0x13c8('0x6')](_0x13c8('0x9'),auth['isAuthenticated'](),controller[_0x13c8('0xa')]);router['get'](_0x13c8('0xb'),auth[_0x13c8('0x7')](),controller[_0x13c8('0xc')]);router[_0x13c8('0xd')]('/',auth[_0x13c8('0x7')](),controller[_0x13c8('0xe')]);router[_0x13c8('0xf')](_0x13c8('0xb'),auth[_0x13c8('0x7')](),controller[_0x13c8('0x10')]);router[_0x13c8('0x11')](_0x13c8('0xb'),auth[_0x13c8('0x7')](),controller[_0x13c8('0x12')]);module['exports']=router; \ No newline at end of file +var _0xda55=['../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','isAuthenticated','get','/describe','describe','/:id','show','create','put','update','delete','destroy','multer','util','express','Router','fs-extra'];(function(_0x21cb7f,_0x48cd16){var _0x5a079a=function(_0x569a4f){while(--_0x569a4f){_0x21cb7f['push'](_0x21cb7f['shift']());}};_0x5a079a(++_0x48cd16);}(_0xda55,0x6d));var _0x5da5=function(_0x2caa3c,_0x3cc8bc){_0x2caa3c=_0x2caa3c-0x0;var _0x204fe2=_0xda55[_0x2caa3c];return _0x204fe2;};'use strict';var multer=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5da5('0x2'));var router=express[_0x5da5('0x3')]();var fs_extra=require(_0x5da5('0x4'));var auth=require(_0x5da5('0x5'));var interaction=require(_0x5da5('0x6'));var config=require('../../config/environment');var controller=require(_0x5da5('0x7'));router['get']('/',auth[_0x5da5('0x8')](),controller['index']);router[_0x5da5('0x9')](_0x5da5('0xa'),auth[_0x5da5('0x8')](),controller[_0x5da5('0xb')]);router[_0x5da5('0x9')](_0x5da5('0xc'),auth[_0x5da5('0x8')](),controller[_0x5da5('0xd')]);router['post']('/',auth[_0x5da5('0x8')](),controller[_0x5da5('0xe')]);router[_0x5da5('0xf')](_0x5da5('0xc'),auth[_0x5da5('0x8')](),controller[_0x5da5('0x10')]);router[_0x5da5('0x11')]('/:id',auth[_0x5da5('0x8')](),controller[_0x5da5('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 5e61a77..53e64d9 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(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x7a54,0x106));var _0x47a5=function(_0x428291,_0x15433e){_0x428291=_0x428291-0x0;var _0x574bf3=_0x7a54[_0x428291];return _0x574bf3;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x7a54,0x106));var _0x47a5=function(_0x1b0fe7,_0x21cdcd){_0x1b0fe7=_0x1b0fe7-0x0;var _0x216095=_0x7a54[_0x1b0fe7];return _0x216095;};'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 5eb0322..d1a4f8d 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 _0xa786=['stack','name','send','index','JscriptyAnswerReport','rawAttributes','type','key','map','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','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','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','apply','update','then','destroy','end'];(function(_0x1852c8,_0x3e0467){var _0x319e59=function(_0x1e34d7){while(--_0x1e34d7){_0x1852c8['push'](_0x1852c8['shift']());}};_0x319e59(++_0x3e0467);}(_0xa786,0x71));var _0x6a78=function(_0x4d197c,_0x5779c8){_0x4d197c=_0x4d197c-0x0;var _0x394595=_0xa786[_0x4d197c];return _0x394595;};'use strict';var emlformat=require(_0x6a78('0x0'));var rimraf=require(_0x6a78('0x1'));var zipdir=require(_0x6a78('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a78('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6a78('0x4'));var util=require(_0x6a78('0x5'));var path=require(_0x6a78('0x6'));var sox=require(_0x6a78('0x7'));var csv=require(_0x6a78('0x8'));var ejs=require(_0x6a78('0x9'));var fs=require('fs');var fs_extra=require(_0x6a78('0xa'));var _=require('lodash');var squel=require(_0x6a78('0xb'));var crypto=require(_0x6a78('0xc'));var jsforce=require(_0x6a78('0xd'));var deskjs=require(_0x6a78('0xe'));var toCsv=require(_0x6a78('0x8'));var querystring=require(_0x6a78('0xf'));var Papa=require(_0x6a78('0x10'));var Redis=require(_0x6a78('0x11'));var authService=require(_0x6a78('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6a78('0x13'));var hardwareService=require(_0x6a78('0x14'));var logger=require(_0x6a78('0x15'))('api');var utils=require(_0x6a78('0x16'));var config=require(_0x6a78('0x17'));var licenseUtil=require(_0x6a78('0x18'));var db=require(_0x6a78('0x19'))['db'];function respondWithStatusCode(_0x1fd1be,_0x5b633c){_0x5b633c=_0x5b633c||0xcc;return function(_0x24a60a){if(_0x24a60a){return _0x1fd1be[_0x6a78('0x1a')](_0x5b633c);}return _0x1fd1be[_0x6a78('0x1b')](_0x5b633c)['end']();};}function respondWithResult(_0x44c863,_0xecf980){_0xecf980=_0xecf980||0xc8;return function(_0x4c5351){if(_0x4c5351){return _0x44c863[_0x6a78('0x1b')](_0xecf980)[_0x6a78('0x1c')](_0x4c5351);}};}function respondWithFilteredResult(_0xe27467,_0x40ef48){return function(_0x3deede){if(_0x3deede){var _0x36e824=typeof _0x40ef48['offset']===_0x6a78('0x1d')&&typeof _0x40ef48[_0x6a78('0x1e')]===_0x6a78('0x1d');var _0x265f90=_0x3deede['count'];var _0x5e3616=_0x36e824?0x0:_0x40ef48[_0x6a78('0x1f')];var _0x585917=_0x36e824?_0x3deede['count']:_0x40ef48['offset']+_0x40ef48[_0x6a78('0x1e')];var _0xed3863;if(_0x585917>=_0x265f90){_0x585917=_0x265f90;_0xed3863=0xc8;}else{_0xed3863=0xce;}_0xe27467[_0x6a78('0x1b')](_0xed3863);return _0xe27467['set']('Content-Range',_0x5e3616+'-'+_0x585917+'/'+_0x265f90)[_0x6a78('0x1c')](_0x3deede);}return null;};}function patchUpdates(_0x29dec5){return function(_0x356b93){try{jsonpatch[_0x6a78('0x20')](_0x356b93,_0x29dec5,!![]);}catch(_0x5dc3fa){return BPromise['reject'](_0x5dc3fa);}return _0x356b93['save']();};}function saveUpdates(_0xd57884,_0x5869fd){return function(_0xd938cd){if(_0xd938cd){return _0xd938cd[_0x6a78('0x21')](_0xd57884)[_0x6a78('0x22')](function(_0x4b47b6){return _0x4b47b6;});}return null;};}function removeEntity(_0x49f711,_0xa5f42f){return function(_0x89fd2b){if(_0x89fd2b){return _0x89fd2b[_0x6a78('0x23')]()[_0x6a78('0x22')](function(){_0x49f711[_0x6a78('0x1b')](0xcc)[_0x6a78('0x24')]();});}};}function handleEntityNotFound(_0xefaa55,_0x4ea33e){return function(_0x28cbbf){if(!_0x28cbbf){_0xefaa55[_0x6a78('0x1a')](0x194);}return _0x28cbbf;};}function handleError(_0x1e91ad,_0x57a859){_0x57a859=_0x57a859||0x1f4;return function(_0x19860c){logger['error'](_0x19860c[_0x6a78('0x25')]);if(_0x19860c[_0x6a78('0x26')]){delete _0x19860c['name'];}_0x1e91ad[_0x6a78('0x1b')](_0x57a859)[_0x6a78('0x27')](_0x19860c);};}exports[_0x6a78('0x28')]=function(_0x149105,_0x5942c0){var _0x8bc302={},_0x125ca2={},_0x273a73={'count':0x0,'rows':[]};var _0x12e0c5=_['map'](db[_0x6a78('0x29')][_0x6a78('0x2a')],function(_0x3299c2){return{'name':_0x3299c2['fieldName'],'type':_0x3299c2[_0x6a78('0x2b')][_0x6a78('0x2c')]};});_0x125ca2['model']=_[_0x6a78('0x2d')](_0x12e0c5,_0x6a78('0x26'));_0x125ca2[_0x6a78('0x2e')]=_[_0x6a78('0x2f')](_0x149105[_0x6a78('0x2e')]);_0x125ca2['filters']=_[_0x6a78('0x30')](_0x125ca2[_0x6a78('0x31')],_0x125ca2['query']);_0x8bc302[_0x6a78('0x32')]=_[_0x6a78('0x30')](_0x125ca2[_0x6a78('0x31')],qs[_0x6a78('0x33')](_0x149105[_0x6a78('0x2e')][_0x6a78('0x33')]));_0x8bc302['attributes']=_0x8bc302[_0x6a78('0x32')]['length']?_0x8bc302[_0x6a78('0x32')]:_0x125ca2[_0x6a78('0x31')];if(!_0x149105[_0x6a78('0x2e')][_0x6a78('0x34')](_0x6a78('0x35'))){_0x8bc302[_0x6a78('0x1e')]=qs[_0x6a78('0x1e')](_0x149105[_0x6a78('0x2e')][_0x6a78('0x1e')]);_0x8bc302['offset']=qs['offset'](_0x149105[_0x6a78('0x2e')]['offset']);}_0x8bc302[_0x6a78('0x36')]=qs[_0x6a78('0x37')](_0x149105[_0x6a78('0x2e')][_0x6a78('0x37')]);_0x8bc302[_0x6a78('0x38')]=qs[_0x6a78('0x39')](_[_0x6a78('0x3a')](_0x149105[_0x6a78('0x2e')],_0x125ca2['filters']),_0x12e0c5);if(_0x149105[_0x6a78('0x2e')][_0x6a78('0x3b')]){_0x8bc302[_0x6a78('0x38')]=_['merge'](_0x8bc302[_0x6a78('0x38')],{'$or':_['map'](_0x12e0c5,function(_0x310ab2){if(_0x310ab2[_0x6a78('0x2b')]!==_0x6a78('0x3c')){var _0xe180fb={};_0xe180fb[_0x310ab2['name']]={'$like':'%'+_0x149105['query']['filter']+'%'};return _0xe180fb;}})});}_0x8bc302=_[_0x6a78('0x3d')]({},_0x8bc302,_0x149105[_0x6a78('0x3e')]);var _0x48eafa={'where':_0x8bc302[_0x6a78('0x38')]};return db[_0x6a78('0x29')][_0x6a78('0x3f')](_0x48eafa)[_0x6a78('0x22')](function(_0x44d5f7){_0x273a73[_0x6a78('0x3f')]=_0x44d5f7;if(_0x149105['query'][_0x6a78('0x40')]){_0x8bc302[_0x6a78('0x41')]=[{'all':!![]}];}return db[_0x6a78('0x29')][_0x6a78('0x42')](_0x8bc302);})[_0x6a78('0x22')](function(_0x23dcce){_0x273a73[_0x6a78('0x43')]=_0x23dcce;return _0x273a73;})['then'](respondWithFilteredResult(_0x5942c0,_0x8bc302))[_0x6a78('0x44')](handleError(_0x5942c0,null));};exports['show']=function(_0xeddf03,_0x4d3aec){var _0x526f09={'raw':!![],'where':{'id':_0xeddf03[_0x6a78('0x45')]['id']}},_0xc8f3e8={};_0xc8f3e8['model']=_[_0x6a78('0x2f')](db[_0x6a78('0x29')][_0x6a78('0x2a')]);_0xc8f3e8[_0x6a78('0x2e')]=_[_0x6a78('0x2f')](_0xeddf03['query']);_0xc8f3e8['filters']=_[_0x6a78('0x30')](_0xc8f3e8[_0x6a78('0x31')],_0xc8f3e8[_0x6a78('0x2e')]);_0x526f09[_0x6a78('0x32')]=_[_0x6a78('0x30')](_0xc8f3e8[_0x6a78('0x31')],qs[_0x6a78('0x33')](_0xeddf03['query'][_0x6a78('0x33')]));_0x526f09[_0x6a78('0x32')]=_0x526f09['attributes'][_0x6a78('0x46')]?_0x526f09[_0x6a78('0x32')]:_0xc8f3e8[_0x6a78('0x31')];if(_0xeddf03[_0x6a78('0x2e')][_0x6a78('0x40')]){_0x526f09[_0x6a78('0x41')]=[{'all':!![]}];}_0x526f09=_['merge']({},_0x526f09,_0xeddf03[_0x6a78('0x3e')]);return db[_0x6a78('0x29')][_0x6a78('0x47')](_0x526f09)[_0x6a78('0x22')](handleEntityNotFound(_0x4d3aec,null))[_0x6a78('0x22')](respondWithResult(_0x4d3aec,null))['catch'](handleError(_0x4d3aec,null));};exports[_0x6a78('0x48')]=function(_0x59a4c1,_0x1bdd6b){return db[_0x6a78('0x29')]['create'](_0x59a4c1[_0x6a78('0x49')],{})['then'](respondWithResult(_0x1bdd6b,0xc9))[_0x6a78('0x44')](handleError(_0x1bdd6b,null));};exports[_0x6a78('0x21')]=function(_0xe40d18,_0x46c94e){if(_0xe40d18[_0x6a78('0x49')]['id']){delete _0xe40d18['body']['id'];}return db['JscriptyAnswerReport'][_0x6a78('0x47')]({'where':{'id':_0xe40d18[_0x6a78('0x45')]['id']}})[_0x6a78('0x22')](handleEntityNotFound(_0x46c94e,null))[_0x6a78('0x22')](saveUpdates(_0xe40d18['body'],null))[_0x6a78('0x22')](respondWithResult(_0x46c94e,null))[_0x6a78('0x44')](handleError(_0x46c94e,null));};exports[_0x6a78('0x23')]=function(_0x57c0c4,_0x57bd8a){return db[_0x6a78('0x29')]['find']({'where':{'id':_0x57c0c4['params']['id']}})[_0x6a78('0x22')](handleEntityNotFound(_0x57bd8a,null))[_0x6a78('0x22')](removeEntity(_0x57bd8a,null))[_0x6a78('0x44')](handleError(_0x57bd8a,null));};exports[_0x6a78('0x4a')]=function(_0x15ca1a,_0x5a4d6e){return db['JscriptyAnswerReport']['describe']()[_0x6a78('0x22')](respondWithResult(_0x5a4d6e,null))[_0x6a78('0x44')](handleError(_0x5a4d6e,null));}; \ No newline at end of file +var _0x2975=['pick','filter','merge','options','include','findAll','rows','show','params','find','catch','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','reject','update','then','end','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x2975,0x1c5));var _0x5297=function(_0xdc7816,_0x47e8bd){_0xdc7816=_0xdc7816-0x0;var _0x270591=_0x2975[_0xdc7816];return _0x270591;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5297('0x0'));var zipdir=require(_0x5297('0x1'));var jsonpatch=require(_0x5297('0x2'));var rp=require(_0x5297('0x3'));var moment=require(_0x5297('0x4'));var BPromise=require(_0x5297('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x5297('0x6'));var csv=require(_0x5297('0x7'));var ejs=require(_0x5297('0x8'));var fs=require('fs');var fs_extra=require(_0x5297('0x9'));var _=require(_0x5297('0xa'));var squel=require(_0x5297('0xb'));var crypto=require(_0x5297('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5297('0xd'));var toCsv=require(_0x5297('0x7'));var querystring=require(_0x5297('0xe'));var Papa=require(_0x5297('0xf'));var Redis=require(_0x5297('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5297('0x11'));var as=require(_0x5297('0x12'));var hardwareService=require(_0x5297('0x13'));var logger=require('../../config/logger')(_0x5297('0x14'));var utils=require(_0x5297('0x15'));var config=require(_0x5297('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5297('0x17'))['db'];function respondWithStatusCode(_0x21bef8,_0x491fec){_0x491fec=_0x491fec||0xcc;return function(_0x594191){if(_0x594191){return _0x21bef8[_0x5297('0x18')](_0x491fec);}return _0x21bef8[_0x5297('0x19')](_0x491fec)['end']();};}function respondWithResult(_0x7e3417,_0x5b1a97){_0x5b1a97=_0x5b1a97||0xc8;return function(_0x253b83){if(_0x253b83){return _0x7e3417[_0x5297('0x19')](_0x5b1a97)['json'](_0x253b83);}};}function respondWithFilteredResult(_0x96304b,_0x1e5499){return function(_0x15e2e1){if(_0x15e2e1){var _0x40afca=typeof _0x1e5499[_0x5297('0x1a')]===_0x5297('0x1b')&&typeof _0x1e5499[_0x5297('0x1c')]===_0x5297('0x1b');var _0x4ae2fe=_0x15e2e1[_0x5297('0x1d')];var _0x136461=_0x40afca?0x0:_0x1e5499[_0x5297('0x1a')];var _0x38f106=_0x40afca?_0x15e2e1['count']:_0x1e5499[_0x5297('0x1a')]+_0x1e5499[_0x5297('0x1c')];var _0x52286c;if(_0x38f106>=_0x4ae2fe){_0x38f106=_0x4ae2fe;_0x52286c=0xc8;}else{_0x52286c=0xce;}_0x96304b[_0x5297('0x19')](_0x52286c);return _0x96304b['set'](_0x5297('0x1e'),_0x136461+'-'+_0x38f106+'/'+_0x4ae2fe)[_0x5297('0x1f')](_0x15e2e1);}return null;};}function patchUpdates(_0x39b675){return function(_0xc33c){try{jsonpatch['apply'](_0xc33c,_0x39b675,!![]);}catch(_0x43e00e){return BPromise[_0x5297('0x20')](_0x43e00e);}return _0xc33c['save']();};}function saveUpdates(_0x38408e,_0x3ebbc5){return function(_0x56fffa){if(_0x56fffa){return _0x56fffa[_0x5297('0x21')](_0x38408e)[_0x5297('0x22')](function(_0x574899){return _0x574899;});}return null;};}function removeEntity(_0x28df2d,_0x31ffc4){return function(_0x2c0f01){if(_0x2c0f01){return _0x2c0f01['destroy']()['then'](function(){_0x28df2d[_0x5297('0x19')](0xcc)[_0x5297('0x23')]();});}};}function handleEntityNotFound(_0x18fe2a,_0x4e1300){return function(_0x2ca4cc){if(!_0x2ca4cc){_0x18fe2a['sendStatus'](0x194);}return _0x2ca4cc;};}function handleError(_0x515a51,_0x28819d){_0x28819d=_0x28819d||0x1f4;return function(_0x373414){logger[_0x5297('0x24')](_0x373414[_0x5297('0x25')]);if(_0x373414['name']){delete _0x373414[_0x5297('0x26')];}_0x515a51[_0x5297('0x19')](_0x28819d)[_0x5297('0x27')](_0x373414);};}exports[_0x5297('0x28')]=function(_0x3826d2,_0x201181){var _0x248348={},_0x1dee33={},_0x62d992={'count':0x0,'rows':[]};var _0x51d0fd=_[_0x5297('0x29')](db[_0x5297('0x2a')][_0x5297('0x2b')],function(_0x505469){return{'name':_0x505469[_0x5297('0x2c')],'type':_0x505469[_0x5297('0x2d')]['key']};});_0x1dee33[_0x5297('0x2e')]=_[_0x5297('0x29')](_0x51d0fd,_0x5297('0x26'));_0x1dee33[_0x5297('0x2f')]=_[_0x5297('0x30')](_0x3826d2['query']);_0x1dee33[_0x5297('0x31')]=_[_0x5297('0x32')](_0x1dee33[_0x5297('0x2e')],_0x1dee33[_0x5297('0x2f')]);_0x248348['attributes']=_[_0x5297('0x32')](_0x1dee33['model'],qs[_0x5297('0x33')](_0x3826d2[_0x5297('0x2f')]['fields']));_0x248348[_0x5297('0x34')]=_0x248348[_0x5297('0x34')][_0x5297('0x35')]?_0x248348[_0x5297('0x34')]:_0x1dee33['model'];if(!_0x3826d2[_0x5297('0x2f')][_0x5297('0x36')](_0x5297('0x37'))){_0x248348[_0x5297('0x1c')]=qs['limit'](_0x3826d2[_0x5297('0x2f')][_0x5297('0x1c')]);_0x248348[_0x5297('0x1a')]=qs[_0x5297('0x1a')](_0x3826d2[_0x5297('0x2f')][_0x5297('0x1a')]);}_0x248348[_0x5297('0x38')]=qs[_0x5297('0x39')](_0x3826d2[_0x5297('0x2f')][_0x5297('0x39')]);_0x248348['where']=qs[_0x5297('0x31')](_[_0x5297('0x3a')](_0x3826d2[_0x5297('0x2f')],_0x1dee33[_0x5297('0x31')]),_0x51d0fd);if(_0x3826d2[_0x5297('0x2f')][_0x5297('0x3b')]){_0x248348['where']=_[_0x5297('0x3c')](_0x248348['where'],{'$or':_[_0x5297('0x29')](_0x51d0fd,function(_0x3588f0){if(_0x3588f0[_0x5297('0x2d')]!=='VIRTUAL'){var _0x5d0cc3={};_0x5d0cc3[_0x3588f0[_0x5297('0x26')]]={'$like':'%'+_0x3826d2[_0x5297('0x2f')][_0x5297('0x3b')]+'%'};return _0x5d0cc3;}})});}_0x248348=_['merge']({},_0x248348,_0x3826d2[_0x5297('0x3d')]);var _0x49e0ed={'where':_0x248348['where']};return db[_0x5297('0x2a')][_0x5297('0x1d')](_0x49e0ed)[_0x5297('0x22')](function(_0x2095f3){_0x62d992[_0x5297('0x1d')]=_0x2095f3;if(_0x3826d2[_0x5297('0x2f')]['includeAll']){_0x248348[_0x5297('0x3e')]=[{'all':!![]}];}return db[_0x5297('0x2a')][_0x5297('0x3f')](_0x248348);})[_0x5297('0x22')](function(_0x57fd3b){_0x62d992[_0x5297('0x40')]=_0x57fd3b;return _0x62d992;})['then'](respondWithFilteredResult(_0x201181,_0x248348))['catch'](handleError(_0x201181,null));};exports[_0x5297('0x41')]=function(_0x272e8f,_0x51730f){var _0x52d1d6={'raw':!![],'where':{'id':_0x272e8f[_0x5297('0x42')]['id']}},_0x2dc0dd={};_0x2dc0dd['model']=_[_0x5297('0x30')](db['JscriptyAnswerReport'][_0x5297('0x2b')]);_0x2dc0dd[_0x5297('0x2f')]=_[_0x5297('0x30')](_0x272e8f['query']);_0x2dc0dd[_0x5297('0x31')]=_[_0x5297('0x32')](_0x2dc0dd[_0x5297('0x2e')],_0x2dc0dd[_0x5297('0x2f')]);_0x52d1d6['attributes']=_[_0x5297('0x32')](_0x2dc0dd[_0x5297('0x2e')],qs[_0x5297('0x33')](_0x272e8f[_0x5297('0x2f')][_0x5297('0x33')]));_0x52d1d6[_0x5297('0x34')]=_0x52d1d6[_0x5297('0x34')]['length']?_0x52d1d6[_0x5297('0x34')]:_0x2dc0dd['model'];if(_0x272e8f[_0x5297('0x2f')]['includeAll']){_0x52d1d6['include']=[{'all':!![]}];}_0x52d1d6=_[_0x5297('0x3c')]({},_0x52d1d6,_0x272e8f[_0x5297('0x3d')]);return db['JscriptyAnswerReport'][_0x5297('0x43')](_0x52d1d6)[_0x5297('0x22')](handleEntityNotFound(_0x51730f,null))[_0x5297('0x22')](respondWithResult(_0x51730f,null))[_0x5297('0x44')](handleError(_0x51730f,null));};exports[_0x5297('0x45')]=function(_0x163328,_0x5a89fd){return db[_0x5297('0x2a')][_0x5297('0x45')](_0x163328['body'],{})[_0x5297('0x22')](respondWithResult(_0x5a89fd,0xc9))[_0x5297('0x44')](handleError(_0x5a89fd,null));};exports[_0x5297('0x21')]=function(_0x155cbc,_0x5e3fbb){if(_0x155cbc[_0x5297('0x46')]['id']){delete _0x155cbc[_0x5297('0x46')]['id'];}return db[_0x5297('0x2a')][_0x5297('0x43')]({'where':{'id':_0x155cbc['params']['id']}})[_0x5297('0x22')](handleEntityNotFound(_0x5e3fbb,null))[_0x5297('0x22')](saveUpdates(_0x155cbc[_0x5297('0x46')],null))['then'](respondWithResult(_0x5e3fbb,null))[_0x5297('0x44')](handleError(_0x5e3fbb,null));};exports[_0x5297('0x47')]=function(_0x1dd7ce,_0x445e3a){return db[_0x5297('0x2a')]['find']({'where':{'id':_0x1dd7ce[_0x5297('0x42')]['id']}})[_0x5297('0x22')](handleEntityNotFound(_0x445e3a,null))[_0x5297('0x22')](removeEntity(_0x445e3a,null))[_0x5297('0x44')](handleError(_0x445e3a,null));};exports[_0x5297('0x48')]=function(_0x363acb,_0x75c624){return db[_0x5297('0x2a')]['describe']()[_0x5297('0x22')](respondWithResult(_0x75c624,null))[_0x5297('0x44')](handleError(_0x75c624,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index aa0d714..d41cb4e 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 _0x6fc7=['define','JscriptyAnswerReport','report_jscripty_answers','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0xed65d,_0x14aaee){var _0x5035ea=function(_0x1a951e){while(--_0x1a951e){_0xed65d['push'](_0xed65d['shift']());}};_0x5035ea(++_0x14aaee);}(_0x6fc7,0x184));var _0x76fc=function(_0x615cd4,_0x5a3013){_0x615cd4=_0x615cd4-0x0;var _0x5eaeef=_0x6fc7[_0x615cd4];return _0x5eaeef;};'use strict';var _=require('lodash');var util=require(_0x76fc('0x0'));var logger=require('../../config/logger')(_0x76fc('0x1'));var moment=require(_0x76fc('0x2'));var BPromise=require(_0x76fc('0x3'));var rp=require(_0x76fc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x76fc('0x5'));var config=require(_0x76fc('0x6'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x76fc('0x7')]=function(_0x153100,_0x451a06){return _0x153100[_0x76fc('0x8')](_0x76fc('0x9'),attributes,{'tableName':_0x76fc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a3b=['request-promise','path','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','lodash','util','moment','bluebird'];(function(_0x4c8851,_0x795048){var _0x26837c=function(_0x48e7d1){while(--_0x48e7d1){_0x4c8851['push'](_0x4c8851['shift']());}};_0x26837c(++_0x795048);}(_0x8a3b,0x9c));var _0xb8a3=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x8a3b[_0x34bf97];return _0x292719;};'use strict';var _=require(_0xb8a3('0x0'));var util=require(_0xb8a3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb8a3('0x2'));var BPromise=require(_0xb8a3('0x3'));var rp=require(_0xb8a3('0x4'));var fs=require('fs');var path=require(_0xb8a3('0x5'));var rimraf=require('rimraf');var config=require(_0xb8a3('0x6'));var attributes=require(_0xb8a3('0x7'));module[_0xb8a3('0x8')]=function(_0x5d5461,_0x550b4d){return _0x5d5461[_0xb8a3('0x9')]('JscriptyAnswerReport',attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 8b96ccf..86d68a8 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 _0x1979=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x1979,0xd4));var _0x9197=function(_0x3cf5a3,_0x5a4492){_0x3cf5a3=_0x3cf5a3-0x0;var _0x39ba2d=_0x1979[_0x3cf5a3];return _0x39ba2d;};'use strict';var _=require(_0x9197('0x0'));var util=require(_0x9197('0x1'));var moment=require(_0x9197('0x2'));var BPromise=require(_0x9197('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9197('0x4'));var db=require(_0x9197('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9197('0x6'))(_0x9197('0x7'));var config=require(_0x9197('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9197('0x9')][_0x9197('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c8b97,_0x24ed58,_0x1d2a5a){return new BPromise(function(_0x537689,_0x373252){return client[_0x9197('0xb')](_0x2c8b97,_0x1d2a5a)['then'](function(_0x103f2a){logger[_0x9197('0xc')](_0x9197('0xd'),_0x24ed58,_0x9197('0xe'));logger['debug'](_0x9197('0xf'),_0x24ed58,_0x9197('0xe'),JSON['stringify'](_0x103f2a));if(_0x103f2a[_0x9197('0x10')]){if(_0x103f2a[_0x9197('0x10')][_0x9197('0x11')]===0x1f4){logger[_0x9197('0x10')](_0x9197('0xd'),_0x24ed58,_0x103f2a[_0x9197('0x10')][_0x9197('0x12')]);return _0x373252(_0x103f2a[_0x9197('0x10')]['message']);}logger[_0x9197('0x10')](_0x9197('0xd'),_0x24ed58,_0x103f2a[_0x9197('0x10')][_0x9197('0x12')]);return _0x537689(_0x103f2a[_0x9197('0x10')][_0x9197('0x12')]);}else{logger[_0x9197('0xc')](_0x9197('0xd'),_0x24ed58,'request\x20sent');_0x537689(_0x103f2a[_0x9197('0x13')]['message']);}})[_0x9197('0x14')](function(_0x5f709f){logger[_0x9197('0x10')](_0x9197('0xd'),_0x24ed58,_0x5f709f);_0x373252(_0x5f709f);});});} \ No newline at end of file +var _0xf7cf=['info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then'];(function(_0x3a4702,_0x4efc56){var _0x58affa=function(_0x281cd0){while(--_0x281cd0){_0x3a4702['push'](_0x3a4702['shift']());}};_0x58affa(++_0x4efc56);}(_0xf7cf,0xb3));var _0xff7c=function(_0x366ae5,_0x2aebf3){_0x366ae5=_0x366ae5-0x0;var _0x546e69=_0xf7cf[_0x366ae5];return _0x546e69;};'use strict';var _=require(_0xff7c('0x0'));var util=require(_0xff7c('0x1'));var moment=require(_0xff7c('0x2'));var BPromise=require(_0xff7c('0x3'));var rs=require(_0xff7c('0x4'));var fs=require('fs');var Redis=require(_0xff7c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xff7c('0x6'));var logger=require(_0xff7c('0x7'))(_0xff7c('0x8'));var config=require(_0xff7c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xff7c('0xa')][_0xff7c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c6710,_0x42c57b,_0x28159d){return new BPromise(function(_0x1bccbc,_0x564331){return client['request'](_0x2c6710,_0x28159d)[_0xff7c('0xc')](function(_0x23185a){logger[_0xff7c('0xd')](_0xff7c('0xe'),_0x42c57b,_0xff7c('0xf'));logger[_0xff7c('0x10')](_0xff7c('0x11'),_0x42c57b,_0xff7c('0xf'),JSON[_0xff7c('0x12')](_0x23185a));if(_0x23185a[_0xff7c('0x13')]){if(_0x23185a[_0xff7c('0x13')][_0xff7c('0x14')]===0x1f4){logger[_0xff7c('0x13')](_0xff7c('0xe'),_0x42c57b,_0x23185a[_0xff7c('0x13')]['message']);return _0x564331(_0x23185a[_0xff7c('0x13')][_0xff7c('0x15')]);}logger[_0xff7c('0x13')](_0xff7c('0xe'),_0x42c57b,_0x23185a[_0xff7c('0x13')][_0xff7c('0x15')]);return _0x1bccbc(_0x23185a[_0xff7c('0x13')]['message']);}else{logger[_0xff7c('0xd')](_0xff7c('0xe'),_0x42c57b,'request\x20sent');_0x1bccbc(_0x23185a[_0xff7c('0x16')][_0xff7c('0x15')]);}})[_0xff7c('0x17')](function(_0x1e7de9){logger[_0xff7c('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x42c57b,_0x1e7de9);_0x564331(_0x1e7de9);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 700930e..90ac185 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 _0x61a8=['./jscriptyProject.controller','isAuthenticated','get','/:id','getSessions','/:id/answers','getAnswers','/:id/summary','30s','post','create','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x357edb,_0x548d79){var _0x5354c3=function(_0x120c63){while(--_0x120c63){_0x357edb['push'](_0x357edb['shift']());}};_0x5354c3(++_0x548d79);}(_0x61a8,0xdd));var _0x861a=function(_0x114bf1,_0x16ac4a){_0x114bf1=_0x114bf1-0x0;var _0x58072f=_0x61a8[_0x114bf1];return _0x58072f;};'use strict';var multer=require(_0x861a('0x0'));var util=require('util');var path=require(_0x861a('0x1'));var timeout=require(_0x861a('0x2'));var express=require(_0x861a('0x3'));var router=express[_0x861a('0x4')]();var fs_extra=require(_0x861a('0x5'));var auth=require(_0x861a('0x6'));var interaction=require(_0x861a('0x7'));var config=require(_0x861a('0x8'));var controller=require(_0x861a('0x9'));router['get']('/',auth[_0x861a('0xa')](),controller['index']);router[_0x861a('0xb')](_0x861a('0xc'),auth[_0x861a('0xa')](),controller['show']);router[_0x861a('0xb')]('/:id/sessions',auth[_0x861a('0xa')](),controller[_0x861a('0xd')]);router[_0x861a('0xb')](_0x861a('0xe'),auth['isAuthenticated'](),controller[_0x861a('0xf')]);router[_0x861a('0xb')](_0x861a('0x10'),auth[_0x861a('0xa')](),timeout(_0x861a('0x11')),controller['getSummary']);router[_0x861a('0x12')]('/',auth[_0x861a('0xa')](),controller[_0x861a('0x13')]);router['post']('/:id/clone',auth[_0x861a('0xa')](),controller['clone']);router['put'](_0x861a('0xc'),auth[_0x861a('0xa')](),controller[_0x861a('0x14')]);router[_0x861a('0x15')](_0x861a('0xc'),auth[_0x861a('0xa')](),controller[_0x861a('0x16')]);module['exports']=router; \ No newline at end of file +var _0x0d63=['get','isAuthenticated','/:id','getSessions','/:id/answers','getAnswers','30s','getSummary','post','create','clone','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','./jscriptyProject.controller'];(function(_0x46fd21,_0x178321){var _0x35afc8=function(_0x32e53a){while(--_0x32e53a){_0x46fd21['push'](_0x46fd21['shift']());}};_0x35afc8(++_0x178321);}(_0x0d63,0x10d));var _0x30d6=function(_0x3c974f,_0x33a7db){_0x3c974f=_0x3c974f-0x0;var _0x157515=_0x0d63[_0x3c974f];return _0x157515;};'use strict';var multer=require(_0x30d6('0x0'));var util=require(_0x30d6('0x1'));var path=require(_0x30d6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x30d6('0x3')]();var fs_extra=require(_0x30d6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x30d6('0x5'));var config=require('../../config/environment');var controller=require(_0x30d6('0x6'));router[_0x30d6('0x7')]('/',auth[_0x30d6('0x8')](),controller['index']);router[_0x30d6('0x7')](_0x30d6('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x30d6('0x7')]('/:id/sessions',auth['isAuthenticated'](),controller[_0x30d6('0xa')]);router[_0x30d6('0x7')](_0x30d6('0xb'),auth[_0x30d6('0x8')](),controller[_0x30d6('0xc')]);router[_0x30d6('0x7')]('/:id/summary',auth[_0x30d6('0x8')](),timeout(_0x30d6('0xd')),controller[_0x30d6('0xe')]);router[_0x30d6('0xf')]('/',auth[_0x30d6('0x8')](),controller[_0x30d6('0x10')]);router[_0x30d6('0xf')]('/:id/clone',auth[_0x30d6('0x8')](),controller[_0x30d6('0x11')]);router[_0x30d6('0x12')]('/:id',auth[_0x30d6('0x8')](),controller[_0x30d6('0x13')]);router[_0x30d6('0x14')](_0x30d6('0x9'),auth[_0x30d6('0x8')](),controller[_0x30d6('0x15')]);module[_0x30d6('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 85c4944..ae623ec 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 _0x5f51=['STRING','name','long','isObjectLike','formData','isString','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','exports'];(function(_0x1c1518,_0x247a29){var _0x88f76f=function(_0x206576){while(--_0x206576){_0x1c1518['push'](_0x1c1518['shift']());}};_0x88f76f(++_0x247a29);}(_0x5f51,0x1ab));var _0x15f5=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x5f51[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x15f5('0x0'));var _=require('lodash');var util=require('util');module[_0x15f5('0x1')]={'name':{'type':Sequelize[_0x15f5('0x2')],'unique':_0x15f5('0x3')},'description':{'type':Sequelize[_0x15f5('0x2')]},'formData':{'type':Sequelize['TEXT'](_0x15f5('0x4')),'set':function(_0x542670){if(_[_0x15f5('0x5')](_0x542670)){this['setDataValue'](_0x15f5('0x6'),JSON['stringify'](_0x542670));}else if(_[_0x15f5('0x7')](_0x542670)){this[_0x15f5('0x8')](_0x15f5('0x6'),_0x542670);}else{this['setDataValue']('formData',util[_0x15f5('0x9')](_0x15f5('0xa'),this[_0x15f5('0xb')](_0x15f5('0x3'))||'',this[_0x15f5('0xb')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x15f5('0xc')],'defaultValue':![]}}; \ No newline at end of file +var _0xea78=['TEXT','formData','stringify','isString','setDataValue','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','lodash','exports','name','STRING'];(function(_0x10259d,_0x1c3f7e){var _0x48c78e=function(_0x35669f){while(--_0x35669f){_0x10259d['push'](_0x10259d['shift']());}};_0x48c78e(++_0x1c3f7e);}(_0xea78,0xd8));var _0x8ea7=function(_0x872b02,_0x4f4458){_0x872b02=_0x872b02-0x0;var _0x1a6b24=_0xea78[_0x872b02];return _0x1a6b24;};'use strict';var Sequelize=require(_0x8ea7('0x0'));var _=require(_0x8ea7('0x1'));var util=require('util');module[_0x8ea7('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x8ea7('0x3')},'description':{'type':Sequelize[_0x8ea7('0x4')]},'formData':{'type':Sequelize[_0x8ea7('0x5')]('long'),'set':function(_0x2d6ff4){if(_['isObjectLike'](_0x2d6ff4)){this['setDataValue'](_0x8ea7('0x6'),JSON[_0x8ea7('0x7')](_0x2d6ff4));}else if(_[_0x8ea7('0x8')](_0x2d6ff4)){this[_0x8ea7('0x9')](_0x8ea7('0x6'),_0x2d6ff4);}else{this[_0x8ea7('0x9')](_0x8ea7('0x6'),util['format'](_0x8ea7('0xa'),this['getDataValue'](_0x8ea7('0x3'))||'',this[_0x8ea7('0xb')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x8ea7('0xc')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 1481be9..c5fab79 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 _0x52b8=['../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','error','stack','name','send','map','JscriptyProject','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','sort','where','pick','merge','filter','includeAll','include','show','params','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','find','omit','createdAt','updatedAt','role','getSessions','findOne','JscriptySessionReport','nolimit','order','ProjectId','findAll','rows','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','startTime','starttime','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','push','isEmpty','now','writeFileSync','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','download','rimraf','fast-json-patch','request-promise','bluebird','util','to-csv','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x40911a,_0x55ec99){var _0x27e8e3=function(_0x2ba910){while(--_0x2ba910){_0x40911a['push'](_0x40911a['shift']());}};_0x27e8e3(++_0x55ec99);}(_0x52b8,0xd3));var _0x852b=function(_0x520b9c,_0x5e67de){_0x520b9c=_0x520b9c-0x0;var _0xbb852e=_0x52b8[_0x520b9c];return _0xbb852e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x852b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x852b('0x1'));var rp=require(_0x852b('0x2'));var moment=require('moment');var BPromise=require(_0x852b('0x3'));var Mustache=require('mustache');var util=require(_0x852b('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x852b('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x852b('0x6'));var _=require(_0x852b('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x852b('0x8'));var toCsv=require(_0x852b('0x5'));var querystring=require(_0x852b('0x9'));var Papa=require(_0x852b('0xa'));var Redis=require(_0x852b('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x852b('0xc'));var as=require(_0x852b('0xd'));var hardwareService=require(_0x852b('0xe'));var logger=require(_0x852b('0xf'))(_0x852b('0x10'));var utils=require('../../config/utils');var config=require(_0x852b('0x11'));var licenseUtil=require(_0x852b('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4190a1,_0x2f08da){_0x2f08da=_0x2f08da||0xcc;return function(_0x548159){if(_0x548159){return _0x4190a1[_0x852b('0x13')](_0x2f08da);}return _0x4190a1[_0x852b('0x14')](_0x2f08da)[_0x852b('0x15')]();};}function respondWithResult(_0x4ab720,_0x454f35){_0x454f35=_0x454f35||0xc8;return function(_0x35e3f9){if(_0x35e3f9){return _0x4ab720[_0x852b('0x14')](_0x454f35)[_0x852b('0x16')](_0x35e3f9);}};}function respondWithFilteredResult(_0x18c602,_0x41c2f6){return function(_0x21cadf){if(_0x21cadf){var _0x15e51d=typeof _0x41c2f6['offset']==='undefined'&&typeof _0x41c2f6[_0x852b('0x17')]===_0x852b('0x18');var _0x31e624=_0x21cadf['count'];var _0x406a0b=_0x15e51d?0x0:_0x41c2f6[_0x852b('0x19')];var _0x299153=_0x15e51d?_0x21cadf[_0x852b('0x1a')]:_0x41c2f6[_0x852b('0x19')]+_0x41c2f6[_0x852b('0x17')];var _0x2b4886;if(_0x299153>=_0x31e624){_0x299153=_0x31e624;_0x2b4886=0xc8;}else{_0x2b4886=0xce;}_0x18c602[_0x852b('0x14')](_0x2b4886);return _0x18c602[_0x852b('0x1b')](_0x852b('0x1c'),_0x406a0b+'-'+_0x299153+'/'+_0x31e624)[_0x852b('0x16')](_0x21cadf);}return null;};}function patchUpdates(_0x15118e){return function(_0x42e921){try{jsonpatch[_0x852b('0x1d')](_0x42e921,_0x15118e,!![]);}catch(_0x3a99c2){return BPromise[_0x852b('0x1e')](_0x3a99c2);}return _0x42e921[_0x852b('0x1f')]();};}function saveUpdates(_0x3e3560,_0x163cfa){return function(_0x2c0371){if(_0x2c0371){return _0x2c0371[_0x852b('0x20')](_0x3e3560)[_0x852b('0x21')](function(_0x2edafa){return _0x2edafa;});}return null;};}function removeEntity(_0x1fbeae,_0x4a7624){return function(_0x5d948b){if(_0x5d948b){return _0x5d948b[_0x852b('0x22')]()[_0x852b('0x21')](function(){var _0x110e34=_0x5d948b[_0x852b('0x23')]({'plain':!![]});var _0x1e525d=_0x852b('0x24');return db[_0x852b('0x25')][_0x852b('0x22')]({'where':{'type':_0x1e525d,'resourceId':_0x110e34['id']}})[_0x852b('0x21')](function(){return _0x5d948b;});})[_0x852b('0x21')](function(){_0x1fbeae[_0x852b('0x14')](0xcc)[_0x852b('0x15')]();});}};}function handleEntityNotFound(_0x5b586e,_0x4f916c){return function(_0x5f3bd5){if(!_0x5f3bd5){_0x5b586e[_0x852b('0x13')](0x194);}return _0x5f3bd5;};}function handleError(_0xce3709,_0x33967b){_0x33967b=_0x33967b||0x1f4;return function(_0x399b1d){logger[_0x852b('0x26')](_0x399b1d[_0x852b('0x27')]);if(_0x399b1d[_0x852b('0x28')]){delete _0x399b1d[_0x852b('0x28')];}_0xce3709[_0x852b('0x14')](_0x33967b)[_0x852b('0x29')](_0x399b1d);};}exports['index']=function(_0x556bc4,_0x4a6527){var _0x48ae3f={},_0x4ca7ab={},_0x1ceb30={'count':0x0,'rows':[]};var _0x49abaa=_[_0x852b('0x2a')](db[_0x852b('0x2b')][_0x852b('0x2c')],function(_0x16cb7f){return{'name':_0x16cb7f[_0x852b('0x2d')],'type':_0x16cb7f[_0x852b('0x2e')][_0x852b('0x2f')]};});_0x4ca7ab['model']=_[_0x852b('0x2a')](_0x49abaa,_0x852b('0x28'));_0x4ca7ab[_0x852b('0x30')]=_[_0x852b('0x31')](_0x556bc4[_0x852b('0x30')]);_0x4ca7ab[_0x852b('0x32')]=_[_0x852b('0x33')](_0x4ca7ab['model'],_0x4ca7ab[_0x852b('0x30')]);_0x48ae3f[_0x852b('0x34')]=_[_0x852b('0x33')](_0x4ca7ab[_0x852b('0x35')],qs[_0x852b('0x36')](_0x556bc4['query'][_0x852b('0x36')]));_0x48ae3f[_0x852b('0x34')]=_0x48ae3f[_0x852b('0x34')][_0x852b('0x37')]?_0x48ae3f[_0x852b('0x34')]:_0x4ca7ab[_0x852b('0x35')];if(!_0x556bc4['query'][_0x852b('0x38')]('nolimit')){_0x48ae3f['limit']=qs['limit'](_0x556bc4[_0x852b('0x30')][_0x852b('0x17')]);_0x48ae3f['offset']=qs['offset'](_0x556bc4['query'][_0x852b('0x19')]);}_0x48ae3f['order']=qs[_0x852b('0x39')](_0x556bc4[_0x852b('0x30')][_0x852b('0x39')]);_0x48ae3f[_0x852b('0x3a')]=qs[_0x852b('0x32')](_[_0x852b('0x3b')](_0x556bc4[_0x852b('0x30')],_0x4ca7ab[_0x852b('0x32')]),_0x49abaa);if(_0x556bc4[_0x852b('0x30')]['filter']){_0x48ae3f[_0x852b('0x3a')]=_[_0x852b('0x3c')](_0x48ae3f[_0x852b('0x3a')],{'$or':_['map'](_0x49abaa,function(_0x42b27d){if(_0x42b27d[_0x852b('0x2e')]!=='VIRTUAL'){var _0x1f9bba={};_0x1f9bba[_0x42b27d[_0x852b('0x28')]]={'$like':'%'+_0x556bc4[_0x852b('0x30')][_0x852b('0x3d')]+'%'};return _0x1f9bba;}})});}_0x48ae3f=_['merge']({},_0x48ae3f,_0x556bc4['options']);var _0x24e5fa={'where':_0x48ae3f[_0x852b('0x3a')]};return db[_0x852b('0x2b')]['count'](_0x24e5fa)[_0x852b('0x21')](function(_0xaba252){_0x1ceb30[_0x852b('0x1a')]=_0xaba252;if(_0x556bc4['query'][_0x852b('0x3e')]){_0x48ae3f[_0x852b('0x3f')]=[{'all':!![]}];}return db[_0x852b('0x2b')]['findAll'](_0x48ae3f);})['then'](function(_0x148646){_0x1ceb30['rows']=_0x148646;return _0x1ceb30;})['then'](respondWithFilteredResult(_0x4a6527,_0x48ae3f))['catch'](handleError(_0x4a6527,null));};exports[_0x852b('0x40')]=function(_0x557bb9,_0x4d3286){var _0x2725aa={'raw':![],'where':{'id':_0x557bb9[_0x852b('0x41')]['id']}},_0x32f2a8={};_0x32f2a8[_0x852b('0x35')]=_[_0x852b('0x31')](db[_0x852b('0x2b')]['rawAttributes']);_0x32f2a8[_0x852b('0x30')]=_['keys'](_0x557bb9[_0x852b('0x30')]);_0x32f2a8[_0x852b('0x32')]=_[_0x852b('0x33')](_0x32f2a8['model'],_0x32f2a8[_0x852b('0x30')]);_0x2725aa[_0x852b('0x34')]=_[_0x852b('0x33')](_0x32f2a8[_0x852b('0x35')],qs[_0x852b('0x36')](_0x557bb9[_0x852b('0x30')][_0x852b('0x36')]));_0x2725aa[_0x852b('0x34')]=_0x2725aa[_0x852b('0x34')][_0x852b('0x37')]?_0x2725aa[_0x852b('0x34')]:_0x32f2a8[_0x852b('0x35')];if(_0x557bb9[_0x852b('0x30')][_0x852b('0x3e')]){_0x2725aa['include']=[{'all':!![]}];}_0x2725aa=_[_0x852b('0x3c')]({},_0x2725aa,_0x557bb9[_0x852b('0x42')]);return db['JscriptyProject']['find'](_0x2725aa)[_0x852b('0x21')](handleEntityNotFound(_0x4d3286,null))[_0x852b('0x21')](respondWithResult(_0x4d3286,null))[_0x852b('0x43')](handleError(_0x4d3286,null));};exports[_0x852b('0x44')]=function(_0x434bfa,_0x13e498){return db[_0x852b('0x2b')][_0x852b('0x44')](_0x434bfa[_0x852b('0x45')],{})['then'](function(_0x12db22){var _0x2b7929=_0x434bfa[_0x852b('0x46')][_0x852b('0x23')]({'plain':!![]});if(!_0x2b7929)throw new Error(_0x852b('0x47'));if(_0x2b7929['role']===_0x852b('0x46')){var _0x9b1392=_0x12db22['get']({'plain':!![]});var _0x1d53b8=_0x852b('0x24');return db[_0x852b('0x48')]['find']({'where':{'name':_0x1d53b8,'userProfileId':_0x2b7929[_0x852b('0x49')]},'raw':!![]})[_0x852b('0x21')](function(_0x3f6883){if(_0x3f6883&&_0x3f6883[_0x852b('0x4a')]===0x0){return db[_0x852b('0x25')][_0x852b('0x44')]({'name':_0x9b1392['name'],'resourceId':_0x9b1392['id'],'type':_0x3f6883[_0x852b('0x28')],'sectionId':_0x3f6883['id']},{})['then'](function(){return _0x12db22;});}else{return _0x12db22;}})[_0x852b('0x43')](function(_0x3353e6){logger[_0x852b('0x26')](_0x852b('0x4b'),_0x3353e6);throw _0x3353e6;});}return _0x12db22;})[_0x852b('0x21')](respondWithResult(_0x13e498,0xc9))[_0x852b('0x43')](handleError(_0x13e498,null));};exports[_0x852b('0x4c')]=function(_0x4af1db,_0x67cab7){var _0x9e69ca={'where':{'id':_0x4af1db[_0x852b('0x41')]['id']}},_0x52b409={};_0x52b409[_0x852b('0x35')]=_[_0x852b('0x31')](db[_0x852b('0x2b')][_0x852b('0x2c')]);_0x9e69ca['attributes']=_[_0x852b('0x33')](_0x52b409[_0x852b('0x35')],qs[_0x852b('0x36')](_0x4af1db[_0x852b('0x30')][_0x852b('0x36')]));_0x9e69ca[_0x852b('0x34')]=_0x9e69ca[_0x852b('0x34')][_0x852b('0x37')]?_0x9e69ca[_0x852b('0x34')]:_0x52b409[_0x852b('0x35')];if(_0x4af1db[_0x852b('0x30')]['includeAll']){_0x9e69ca[_0x852b('0x3f')]=[{'all':!![]}];}_0x9e69ca=_[_0x852b('0x3c')]({},_0x9e69ca,_0x4af1db[_0x852b('0x42')]);return db['JscriptyProject'][_0x852b('0x4d')](_0x9e69ca)[_0x852b('0x21')](handleEntityNotFound(_0x67cab7,null))[_0x852b('0x21')](function(_0x3a8631){if(_0x3a8631){var _0xe925b5=_0x3a8631[_0x852b('0x23')]({'plain':!![]});_0xe925b5=qs[_0x852b('0x4e')](_0xe925b5,['id',_0x852b('0x4f'),_0x852b('0x50')]);_0x4af1db[_0x852b('0x45')]=_[_0x852b('0x4e')](_0x4af1db[_0x852b('0x45')],['id',_0x852b('0x4f'),_0x852b('0x50')]);return db[_0x852b('0x2b')][_0x852b('0x44')](_[_0x852b('0x3c')](_0xe925b5,_0x4af1db[_0x852b('0x45')]),{'include':_0x4af1db[_0x852b('0x30')]['includeAll']?[{'all':!![]}]:undefined})[_0x852b('0x21')](function(_0x2cefba){var _0x4896a6=_0x4af1db[_0x852b('0x46')][_0x852b('0x23')]({'plain':!![]});if(!_0x4896a6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4896a6[_0x852b('0x51')]==='user'){var _0x5e4480=_0x2cefba[_0x852b('0x23')]({'plain':!![]});var _0x1008af=_0x852b('0x24');return db[_0x852b('0x48')][_0x852b('0x4d')]({'where':{'name':_0x1008af,'userProfileId':_0x4896a6[_0x852b('0x49')]},'raw':!![]})[_0x852b('0x21')](function(_0x45ca30){if(_0x45ca30&&_0x45ca30[_0x852b('0x4a')]===0x0){return db['UserProfileResource'][_0x852b('0x44')]({'name':_0x5e4480['name'],'resourceId':_0x5e4480['id'],'type':_0x45ca30[_0x852b('0x28')],'sectionId':_0x45ca30['id']},{})['then'](function(){return _0x2cefba;});}else{return _0x2cefba;}})[_0x852b('0x43')](function(_0x459c9c){logger['error'](_0x852b('0x4b'),_0x459c9c);throw _0x459c9c;});}return _0x2cefba;});}})[_0x852b('0x21')](respondWithResult(_0x67cab7,0xc9))[_0x852b('0x43')](handleError(_0x67cab7,null));};exports[_0x852b('0x20')]=function(_0x10a8a9,_0x4bbbbd){if(_0x10a8a9[_0x852b('0x45')]['id']){delete _0x10a8a9[_0x852b('0x45')]['id'];}return db['JscriptyProject'][_0x852b('0x4d')]({'where':{'id':_0x10a8a9[_0x852b('0x41')]['id']}})[_0x852b('0x21')](handleEntityNotFound(_0x4bbbbd,null))[_0x852b('0x21')](saveUpdates(_0x10a8a9[_0x852b('0x45')],null))[_0x852b('0x21')](respondWithResult(_0x4bbbbd,null))[_0x852b('0x43')](handleError(_0x4bbbbd,null));};exports['destroy']=function(_0x563199,_0x1fc0f6){return db[_0x852b('0x2b')][_0x852b('0x4d')]({'where':{'id':_0x563199['params']['id']}})[_0x852b('0x21')](handleEntityNotFound(_0x1fc0f6,null))[_0x852b('0x21')](removeEntity(_0x1fc0f6,null))['catch'](handleError(_0x1fc0f6,null));};exports[_0x852b('0x52')]=function(_0x51f72d,_0x481516,_0x33ed4e){var _0x588cca={'raw':!![],'where':{}};var _0x3f85a6={};var _0x46eb6c={'count':0x0,'rows':[]};return db[_0x852b('0x2b')][_0x852b('0x53')]({'where':{'id':_0x51f72d[_0x852b('0x41')]['id']}})[_0x852b('0x21')](handleEntityNotFound(_0x481516,null))[_0x852b('0x21')](function(_0x241efd){if(_0x241efd){_0x3f85a6[_0x852b('0x35')]=_[_0x852b('0x31')](db[_0x852b('0x54')][_0x852b('0x2c')]);_0x3f85a6[_0x852b('0x30')]=_[_0x852b('0x31')](_0x51f72d[_0x852b('0x30')]);_0x3f85a6[_0x852b('0x32')]=_['intersection'](_0x3f85a6[_0x852b('0x35')],_0x3f85a6[_0x852b('0x30')]);_0x588cca['attributes']=_[_0x852b('0x33')](_0x3f85a6['model'],qs['fields'](_0x51f72d[_0x852b('0x30')]['fields']));_0x588cca[_0x852b('0x34')]=_0x588cca[_0x852b('0x34')][_0x852b('0x37')]?_0x588cca[_0x852b('0x34')]:_0x3f85a6[_0x852b('0x35')];if(!_0x51f72d[_0x852b('0x30')]['hasOwnProperty'](_0x852b('0x55'))){_0x588cca[_0x852b('0x17')]=qs[_0x852b('0x17')](_0x51f72d[_0x852b('0x30')][_0x852b('0x17')]);_0x588cca[_0x852b('0x19')]=qs['offset'](_0x51f72d[_0x852b('0x30')][_0x852b('0x19')]);}_0x588cca[_0x852b('0x56')]=qs[_0x852b('0x39')](_0x51f72d[_0x852b('0x30')][_0x852b('0x39')]);_0x588cca['where']=qs[_0x852b('0x32')](_[_0x852b('0x3b')](_0x51f72d[_0x852b('0x30')],_0x3f85a6[_0x852b('0x32')]));_0x588cca[_0x852b('0x3a')][_0x852b('0x57')]=_0x241efd['id'];if(_0x51f72d[_0x852b('0x30')][_0x852b('0x3d')]){_0x588cca[_0x852b('0x3a')]=_['merge'](_0x588cca[_0x852b('0x3a')],{'$or':_[_0x852b('0x2a')](_0x588cca['attributes'],function(_0x220ad5){var _0xbcd620={};_0xbcd620[_0x220ad5]={'$like':'%'+_0x51f72d[_0x852b('0x30')][_0x852b('0x3d')]+'%'};return _0xbcd620;})});}_0x588cca=_[_0x852b('0x3c')]({},_0x588cca,_0x51f72d[_0x852b('0x42')]);return db[_0x852b('0x54')][_0x852b('0x1a')]({'where':_0x588cca[_0x852b('0x3a')]})[_0x852b('0x21')](function(_0x1cd09c){_0x46eb6c[_0x852b('0x1a')]=_0x1cd09c;if(_0x51f72d[_0x852b('0x30')][_0x852b('0x3e')]){_0x588cca[_0x852b('0x3f')]=[{'all':!![]}];}return db[_0x852b('0x54')][_0x852b('0x58')](_0x588cca);})['then'](function(_0x3c44cd){_0x46eb6c[_0x852b('0x59')]=_0x3c44cd;return _0x46eb6c;});}})[_0x852b('0x21')](respondWithFilteredResult(_0x481516,_0x588cca))[_0x852b('0x43')](handleError(_0x481516,null));};exports[_0x852b('0x5a')]=function(_0xd4ee47,_0x5c0c8d,_0x31f12e){var _0x147494={'raw':!![],'where':{}};var _0x13e566={};var _0x5bb0ef={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x852b('0x53')]({'where':{'id':_0xd4ee47['params']['id']}})[_0x852b('0x21')](handleEntityNotFound(_0x5c0c8d,null))[_0x852b('0x21')](function(_0x4665eb){if(_0x4665eb){_0x13e566['model']=_[_0x852b('0x31')](db['JscriptyAnswerReport'][_0x852b('0x2c')]);_0x13e566['query']=_[_0x852b('0x31')](_0xd4ee47['query']);_0x13e566[_0x852b('0x32')]=_[_0x852b('0x33')](_0x13e566[_0x852b('0x35')],_0x13e566[_0x852b('0x30')]);_0x147494['attributes']=_[_0x852b('0x33')](_0x13e566['model'],qs[_0x852b('0x36')](_0xd4ee47[_0x852b('0x30')][_0x852b('0x36')]));_0x147494['attributes']=_0x147494[_0x852b('0x34')]['length']?_0x147494[_0x852b('0x34')]:_0x13e566[_0x852b('0x35')];if(!_0xd4ee47[_0x852b('0x30')][_0x852b('0x38')]('nolimit')){_0x147494['limit']=qs[_0x852b('0x17')](_0xd4ee47[_0x852b('0x30')][_0x852b('0x17')]);_0x147494['offset']=qs['offset'](_0xd4ee47[_0x852b('0x30')][_0x852b('0x19')]);}_0x147494['order']=qs[_0x852b('0x39')](_0xd4ee47[_0x852b('0x30')][_0x852b('0x39')]);_0x147494[_0x852b('0x3a')]=qs[_0x852b('0x32')](_[_0x852b('0x3b')](_0xd4ee47['query'],_0x13e566[_0x852b('0x32')]));_0x147494[_0x852b('0x3a')][_0x852b('0x57')]=_0x4665eb['id'];if(_0xd4ee47['query'][_0x852b('0x3d')]){_0x147494[_0x852b('0x3a')]=_['merge'](_0x147494[_0x852b('0x3a')],{'$or':_[_0x852b('0x2a')](_0x147494[_0x852b('0x34')],function(_0x1e71df){var _0x3f1400={};_0x3f1400[_0x1e71df]={'$like':'%'+_0xd4ee47[_0x852b('0x30')]['filter']+'%'};return _0x3f1400;})});}_0x147494=_[_0x852b('0x3c')]({},_0x147494,_0xd4ee47[_0x852b('0x42')]);return db[_0x852b('0x5b')][_0x852b('0x1a')]({'where':_0x147494[_0x852b('0x3a')]})['then'](function(_0x4d36a5){_0x5bb0ef[_0x852b('0x1a')]=_0x4d36a5;if(_0xd4ee47[_0x852b('0x30')][_0x852b('0x3e')]){_0x147494[_0x852b('0x3f')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x852b('0x58')](_0x147494);})['then'](function(_0x3bdb59){_0x5bb0ef[_0x852b('0x59')]=_0x3bdb59;return _0x5bb0ef;});}})['then'](respondWithFilteredResult(_0x5c0c8d,_0x147494))[_0x852b('0x43')](handleError(_0x5c0c8d,null));};function char(_0x2c647e){return _0x852b('0x5c')===typeof _0x2c647e?String[_0x852b('0x5d')][_0x852b('0x1d')](null,arguments):_0x2c647e;}function needsEncapsulation(_0x56a350){return!!_0x56a350&&(_0x56a350[_0x852b('0x5e')]()[_0x852b('0x5f')](char(0xd))>=0x0||_0x56a350[_0x852b('0x5e')]()[_0x852b('0x5f')](char(0xa))>=0x0||_0x56a350[_0x852b('0x5e')]()['indexOf'](char(0x2c))>=0x0||_0x56a350['toString']()[_0x852b('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x5bbfad){var _0x4e9de6=char(0x22),_0x2fae3a='\x5c'+char(0x22),_0x341644=_0x5bbfad[_0x852b('0x5e')]()[_0x852b('0x60')](new RegExp(_0x4e9de6,'g'),_0x2fae3a);return _0x4e9de6+_0x341644+_0x4e9de6;}exports['getSummary']=function(_0xf8888,_0x1253e2,_0x59a01c){var _0x254563,_0x29b9e1;var _0x28ba2e={'where':{'ProjectId':_0xf8888[_0x852b('0x41')]['id']}};if(_0xf8888[_0x852b('0x30')][_0x852b('0x61')]){_0x28ba2e[_0x852b('0x3a')][_0x852b('0x62')]=JSON['parse'](_0xf8888[_0x852b('0x30')][_0x852b('0x61')]);}return db[_0x852b('0x54')][_0x852b('0x58')](_0x28ba2e)[_0x852b('0x21')](handleEntityNotFound(_0x1253e2,null))[_0x852b('0x21')](function(_0x2dd6b4){if(_0x2dd6b4){_0x254563=_0x2dd6b4;return db['JscriptyQuestionReport'][_0x852b('0x58')]({'where':{'SessionId':{'$in':_[_0x852b('0x2a')](_0x254563,'id')},'ProjectId':_0xf8888[_0x852b('0x41')]['id']},'order':_0x852b('0x63')});}})['then'](handleEntityNotFound(_0x1253e2,null))['then'](function(_0x2076a8){if(_0x2076a8){_0x29b9e1=_0x2076a8;var _0x24b1f0={};for(var _0x4aefd9=0x0,_0x14946e=_0x29b9e1[_0x852b('0x37')];_0x4aefd9<_0x14946e;_0x4aefd9++){if(!_0x24b1f0[_0x852b('0x38')](_0x29b9e1[_0x4aefd9][_0x852b('0x64')])){_0x24b1f0[_0x29b9e1[_0x4aefd9]['questionId']]=needsEncapsulation(_0x29b9e1[_0x4aefd9]['question'])?encapsulate(_0x29b9e1[_0x4aefd9][_0x852b('0x65')]):_0x29b9e1[_0x4aefd9][_0x852b('0x65')];}}var _0x2c328a=[],_0x1f08ff={};for(var _0x53cf78=0x0,_0x4d942c=_0x254563[_0x852b('0x37')];_0x53cf78<_0x4d942c;_0x53cf78++){_0x1f08ff={'ProjectId':_0xf8888['params']['id'],'SessionId':_0x254563[_0x53cf78]['id'],'StartTime':moment(_0x254563[_0x53cf78][_0x852b('0x62')])[_0x852b('0x66')](_0x852b('0x67'))};for(var _0x15693a=0x0,_0x2184cc=_0x29b9e1['length'];_0x15693a<_0x2184cc;_0x15693a++){if(_0x29b9e1[_0x15693a][_0x852b('0x68')]==_0x254563[_0x53cf78]['id']&&_0x24b1f0[_0x852b('0x38')](_0x29b9e1[_0x15693a]['questionId'])){_0x1f08ff[_0x24b1f0[_0x29b9e1[_0x15693a]['questionId']]]=_0x29b9e1[_0x15693a]['answer'];}}for(var _0x130e19 in _0x24b1f0){if(!_0x1f08ff[_0x852b('0x38')](_0x24b1f0[_0x130e19])){_0x1f08ff[_0x24b1f0[_0x130e19]]=null;}}_0x2c328a[_0x852b('0x69')](_0x1f08ff);}return _0x2c328a;}})['then'](function(_0x1143e9){if(!_[_0x852b('0x6a')](_0x1143e9)){var _0x24fa41=toCsv(_0x1143e9);var _0x1a36b4=Date[_0x852b('0x6b')]();fs[_0x852b('0x6c')](util[_0x852b('0x66')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0xf8888['params']['id'],_0x1a36b4),_0x24fa41);_0x1253e2[_0x852b('0x6d')](_0x852b('0x6e'),'attachment;\x20filename='+util[_0x852b('0x66')](_0x852b('0x6f'),_0xf8888[_0x852b('0x41')]['id'],_0x1a36b4));_0x1253e2[_0x852b('0x6d')]('Content-type','text/csv');return _0x1253e2[_0x852b('0x70')](util[_0x852b('0x66')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0xf8888[_0x852b('0x41')]['id'],_0x1a36b4));}else{return _0x1253e2[_0x852b('0x13')](0xcc);}})['catch'](handleError(_0x1253e2,null));}; \ No newline at end of file +var _0xd48a=['omit','createdAt','updatedAt','getSessions','findOne','hasOwnProperty','pick','ProjectId','JscriptySessionReport','rows','getAnswers','JscriptyAnswerReport','fromCharCode','apply','toString','indexOf','replace','getSummary','startTime','starttime','parse','-createdAt','questionId','question','format','SessionId','answer','push','isEmpty','now','writeFileSync','setHeader','Content-type','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','undefined','limit','offset','count','Content-Range','reject','save','update','then','destroy','get','Projects','UserProfileResource','sendStatus','error','name','send','index','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','JscriptyProject','findAll','show','params','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','keys'];(function(_0x20ea3b,_0x3bd9b1){var _0x27845d=function(_0x47c4c8){while(--_0x47c4c8){_0x20ea3b['push'](_0x20ea3b['shift']());}};_0x27845d(++_0x3bd9b1);}(_0xd48a,0x96));var _0xad48=function(_0x3b53cc,_0x2790f3){_0x3b53cc=_0x3b53cc-0x0;var _0xef37e1=_0xd48a[_0x3b53cc];return _0xef37e1;};'use strict';var emlformat=require(_0xad48('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xad48('0x1'));var jsonpatch=require(_0xad48('0x2'));var rp=require(_0xad48('0x3'));var moment=require(_0xad48('0x4'));var BPromise=require(_0xad48('0x5'));var Mustache=require(_0xad48('0x6'));var util=require('util');var path=require(_0xad48('0x7'));var sox=require(_0xad48('0x8'));var csv=require('to-csv');var ejs=require(_0xad48('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xad48('0xa'));var jsforce=require(_0xad48('0xb'));var deskjs=require(_0xad48('0xc'));var toCsv=require(_0xad48('0xd'));var querystring=require(_0xad48('0xe'));var Papa=require(_0xad48('0xf'));var Redis=require(_0xad48('0x10'));var authService=require(_0xad48('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xad48('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xad48('0x13'))(_0xad48('0x14'));var utils=require('../../config/utils');var config=require(_0xad48('0x15'));var licenseUtil=require(_0xad48('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e93f6,_0x1b25f1){_0x1b25f1=_0x1b25f1||0xcc;return function(_0x3fafa0){if(_0x3fafa0){return _0x5e93f6['sendStatus'](_0x1b25f1);}return _0x5e93f6[_0xad48('0x17')](_0x1b25f1)[_0xad48('0x18')]();};}function respondWithResult(_0x57ca5a,_0x2a2236){_0x2a2236=_0x2a2236||0xc8;return function(_0xb798e0){if(_0xb798e0){return _0x57ca5a[_0xad48('0x17')](_0x2a2236)[_0xad48('0x19')](_0xb798e0);}};}function respondWithFilteredResult(_0x47ecce,_0x98d233){return function(_0x54a20f){if(_0x54a20f){var _0x562d95=typeof _0x98d233['offset']===_0xad48('0x1a')&&typeof _0x98d233[_0xad48('0x1b')]===_0xad48('0x1a');var _0xd5df14=_0x54a20f['count'];var _0xb42bde=_0x562d95?0x0:_0x98d233[_0xad48('0x1c')];var _0x44543f=_0x562d95?_0x54a20f[_0xad48('0x1d')]:_0x98d233['offset']+_0x98d233['limit'];var _0xdbbe36;if(_0x44543f>=_0xd5df14){_0x44543f=_0xd5df14;_0xdbbe36=0xc8;}else{_0xdbbe36=0xce;}_0x47ecce[_0xad48('0x17')](_0xdbbe36);return _0x47ecce['set'](_0xad48('0x1e'),_0xb42bde+'-'+_0x44543f+'/'+_0xd5df14)[_0xad48('0x19')](_0x54a20f);}return null;};}function patchUpdates(_0x1014cc){return function(_0x467e7a){try{jsonpatch['apply'](_0x467e7a,_0x1014cc,!![]);}catch(_0x3b63ae){return BPromise[_0xad48('0x1f')](_0x3b63ae);}return _0x467e7a[_0xad48('0x20')]();};}function saveUpdates(_0x49869b,_0x4280a4){return function(_0x3832fb){if(_0x3832fb){return _0x3832fb[_0xad48('0x21')](_0x49869b)[_0xad48('0x22')](function(_0x441612){return _0x441612;});}return null;};}function removeEntity(_0x4e0af4,_0x17c80){return function(_0x38f31d){if(_0x38f31d){return _0x38f31d[_0xad48('0x23')]()[_0xad48('0x22')](function(){var _0x3a4f01=_0x38f31d[_0xad48('0x24')]({'plain':!![]});var _0x1aace0=_0xad48('0x25');return db[_0xad48('0x26')]['destroy']({'where':{'type':_0x1aace0,'resourceId':_0x3a4f01['id']}})[_0xad48('0x22')](function(){return _0x38f31d;});})[_0xad48('0x22')](function(){_0x4e0af4[_0xad48('0x17')](0xcc)[_0xad48('0x18')]();});}};}function handleEntityNotFound(_0x48a021,_0x1e454f){return function(_0x136750){if(!_0x136750){_0x48a021[_0xad48('0x27')](0x194);}return _0x136750;};}function handleError(_0x551af6,_0x2c9f05){_0x2c9f05=_0x2c9f05||0x1f4;return function(_0x4158c3){logger[_0xad48('0x28')](_0x4158c3['stack']);if(_0x4158c3[_0xad48('0x29')]){delete _0x4158c3['name'];}_0x551af6[_0xad48('0x17')](_0x2c9f05)[_0xad48('0x2a')](_0x4158c3);};}exports[_0xad48('0x2b')]=function(_0x3cdb31,_0xf4c77f){var _0x4ea044={},_0x1ef71a={},_0x21e773={'count':0x0,'rows':[]};var _0x131971=_['map'](db['JscriptyProject'][_0xad48('0x2c')],function(_0x10956f){return{'name':_0x10956f['fieldName'],'type':_0x10956f[_0xad48('0x2d')][_0xad48('0x2e')]};});_0x1ef71a[_0xad48('0x2f')]=_[_0xad48('0x30')](_0x131971,'name');_0x1ef71a[_0xad48('0x31')]=_['keys'](_0x3cdb31[_0xad48('0x31')]);_0x1ef71a[_0xad48('0x32')]=_[_0xad48('0x33')](_0x1ef71a['model'],_0x1ef71a[_0xad48('0x31')]);_0x4ea044[_0xad48('0x34')]=_['intersection'](_0x1ef71a[_0xad48('0x2f')],qs[_0xad48('0x35')](_0x3cdb31[_0xad48('0x31')][_0xad48('0x35')]));_0x4ea044[_0xad48('0x34')]=_0x4ea044[_0xad48('0x34')]['length']?_0x4ea044[_0xad48('0x34')]:_0x1ef71a[_0xad48('0x2f')];if(!_0x3cdb31[_0xad48('0x31')]['hasOwnProperty'](_0xad48('0x36'))){_0x4ea044[_0xad48('0x1b')]=qs[_0xad48('0x1b')](_0x3cdb31[_0xad48('0x31')]['limit']);_0x4ea044['offset']=qs[_0xad48('0x1c')](_0x3cdb31['query'][_0xad48('0x1c')]);}_0x4ea044[_0xad48('0x37')]=qs[_0xad48('0x38')](_0x3cdb31[_0xad48('0x31')][_0xad48('0x38')]);_0x4ea044['where']=qs[_0xad48('0x32')](_['pick'](_0x3cdb31[_0xad48('0x31')],_0x1ef71a[_0xad48('0x32')]),_0x131971);if(_0x3cdb31[_0xad48('0x31')][_0xad48('0x39')]){_0x4ea044[_0xad48('0x3a')]=_[_0xad48('0x3b')](_0x4ea044[_0xad48('0x3a')],{'$or':_['map'](_0x131971,function(_0x1f31d1){if(_0x1f31d1[_0xad48('0x2d')]!==_0xad48('0x3c')){var _0x4b74fe={};_0x4b74fe[_0x1f31d1[_0xad48('0x29')]]={'$like':'%'+_0x3cdb31['query'][_0xad48('0x39')]+'%'};return _0x4b74fe;}})});}_0x4ea044=_['merge']({},_0x4ea044,_0x3cdb31[_0xad48('0x3d')]);var _0xf5bbe5={'where':_0x4ea044[_0xad48('0x3a')]};return db['JscriptyProject'][_0xad48('0x1d')](_0xf5bbe5)[_0xad48('0x22')](function(_0x56cce3){_0x21e773['count']=_0x56cce3;if(_0x3cdb31[_0xad48('0x31')][_0xad48('0x3e')]){_0x4ea044[_0xad48('0x3f')]=[{'all':!![]}];}return db[_0xad48('0x40')][_0xad48('0x41')](_0x4ea044);})[_0xad48('0x22')](function(_0x5bdb78){_0x21e773['rows']=_0x5bdb78;return _0x21e773;})[_0xad48('0x22')](respondWithFilteredResult(_0xf4c77f,_0x4ea044))['catch'](handleError(_0xf4c77f,null));};exports[_0xad48('0x42')]=function(_0x2b8450,_0x1346e7){var _0x2c5dbd={'raw':![],'where':{'id':_0x2b8450[_0xad48('0x43')]['id']}},_0x35efd8={};_0x35efd8['model']=_['keys'](db[_0xad48('0x40')][_0xad48('0x2c')]);_0x35efd8[_0xad48('0x31')]=_['keys'](_0x2b8450[_0xad48('0x31')]);_0x35efd8['filters']=_[_0xad48('0x33')](_0x35efd8[_0xad48('0x2f')],_0x35efd8[_0xad48('0x31')]);_0x2c5dbd[_0xad48('0x34')]=_[_0xad48('0x33')](_0x35efd8['model'],qs[_0xad48('0x35')](_0x2b8450[_0xad48('0x31')]['fields']));_0x2c5dbd[_0xad48('0x34')]=_0x2c5dbd[_0xad48('0x34')][_0xad48('0x44')]?_0x2c5dbd['attributes']:_0x35efd8['model'];if(_0x2b8450['query'][_0xad48('0x3e')]){_0x2c5dbd['include']=[{'all':!![]}];}_0x2c5dbd=_[_0xad48('0x3b')]({},_0x2c5dbd,_0x2b8450[_0xad48('0x3d')]);return db[_0xad48('0x40')][_0xad48('0x45')](_0x2c5dbd)[_0xad48('0x22')](handleEntityNotFound(_0x1346e7,null))[_0xad48('0x22')](respondWithResult(_0x1346e7,null))[_0xad48('0x46')](handleError(_0x1346e7,null));};exports[_0xad48('0x47')]=function(_0x3556fa,_0x4a3124){return db[_0xad48('0x40')]['create'](_0x3556fa[_0xad48('0x48')],{})[_0xad48('0x22')](function(_0x4924a0){var _0x3b48ac=_0x3556fa[_0xad48('0x49')][_0xad48('0x24')]({'plain':!![]});if(!_0x3b48ac)throw new Error(_0xad48('0x4a'));if(_0x3b48ac[_0xad48('0x4b')]===_0xad48('0x49')){var _0x245a53=_0x4924a0[_0xad48('0x24')]({'plain':!![]});var _0x408c92=_0xad48('0x25');return db[_0xad48('0x4c')][_0xad48('0x45')]({'where':{'name':_0x408c92,'userProfileId':_0x3b48ac[_0xad48('0x4d')]},'raw':!![]})[_0xad48('0x22')](function(_0x15591b){if(_0x15591b&&_0x15591b[_0xad48('0x4e')]===0x0){return db['UserProfileResource'][_0xad48('0x47')]({'name':_0x245a53[_0xad48('0x29')],'resourceId':_0x245a53['id'],'type':_0x15591b['name'],'sectionId':_0x15591b['id']},{})['then'](function(){return _0x4924a0;});}else{return _0x4924a0;}})[_0xad48('0x46')](function(_0x120742){logger['error'](_0xad48('0x4f'),_0x120742);throw _0x120742;});}return _0x4924a0;})[_0xad48('0x22')](respondWithResult(_0x4a3124,0xc9))[_0xad48('0x46')](handleError(_0x4a3124,null));};exports[_0xad48('0x50')]=function(_0xd77f01,_0x4930d9){var _0x168935={'where':{'id':_0xd77f01['params']['id']}},_0x543f00={};_0x543f00[_0xad48('0x2f')]=_[_0xad48('0x51')](db[_0xad48('0x40')][_0xad48('0x2c')]);_0x168935['attributes']=_[_0xad48('0x33')](_0x543f00[_0xad48('0x2f')],qs[_0xad48('0x35')](_0xd77f01[_0xad48('0x31')][_0xad48('0x35')]));_0x168935[_0xad48('0x34')]=_0x168935['attributes'][_0xad48('0x44')]?_0x168935[_0xad48('0x34')]:_0x543f00[_0xad48('0x2f')];if(_0xd77f01['query']['includeAll']){_0x168935[_0xad48('0x3f')]=[{'all':!![]}];}_0x168935=_[_0xad48('0x3b')]({},_0x168935,_0xd77f01[_0xad48('0x3d')]);return db[_0xad48('0x40')][_0xad48('0x45')](_0x168935)['then'](handleEntityNotFound(_0x4930d9,null))[_0xad48('0x22')](function(_0x3cad70){if(_0x3cad70){var _0x28a2f3=_0x3cad70[_0xad48('0x24')]({'plain':!![]});_0x28a2f3=qs[_0xad48('0x52')](_0x28a2f3,['id',_0xad48('0x53'),_0xad48('0x54')]);_0xd77f01[_0xad48('0x48')]=_[_0xad48('0x52')](_0xd77f01[_0xad48('0x48')],['id',_0xad48('0x53'),_0xad48('0x54')]);return db[_0xad48('0x40')][_0xad48('0x47')](_[_0xad48('0x3b')](_0x28a2f3,_0xd77f01[_0xad48('0x48')]),{'include':_0xd77f01[_0xad48('0x31')][_0xad48('0x3e')]?[{'all':!![]}]:undefined})['then'](function(_0x2730ec){var _0x24d69c=_0xd77f01[_0xad48('0x49')][_0xad48('0x24')]({'plain':!![]});if(!_0x24d69c)throw new Error(_0xad48('0x4a'));if(_0x24d69c[_0xad48('0x4b')]==='user'){var _0x387439=_0x2730ec[_0xad48('0x24')]({'plain':!![]});var _0x1b0ed2='Projects';return db[_0xad48('0x4c')][_0xad48('0x45')]({'where':{'name':_0x1b0ed2,'userProfileId':_0x24d69c[_0xad48('0x4d')]},'raw':!![]})[_0xad48('0x22')](function(_0x20e473){if(_0x20e473&&_0x20e473['autoAssociation']===0x0){return db[_0xad48('0x26')][_0xad48('0x47')]({'name':_0x387439['name'],'resourceId':_0x387439['id'],'type':_0x20e473['name'],'sectionId':_0x20e473['id']},{})[_0xad48('0x22')](function(){return _0x2730ec;});}else{return _0x2730ec;}})[_0xad48('0x46')](function(_0x401f88){logger['error'](_0xad48('0x4f'),_0x401f88);throw _0x401f88;});}return _0x2730ec;});}})[_0xad48('0x22')](respondWithResult(_0x4930d9,0xc9))[_0xad48('0x46')](handleError(_0x4930d9,null));};exports[_0xad48('0x21')]=function(_0xa57351,_0x433726){if(_0xa57351['body']['id']){delete _0xa57351['body']['id'];}return db[_0xad48('0x40')][_0xad48('0x45')]({'where':{'id':_0xa57351[_0xad48('0x43')]['id']}})[_0xad48('0x22')](handleEntityNotFound(_0x433726,null))[_0xad48('0x22')](saveUpdates(_0xa57351['body'],null))[_0xad48('0x22')](respondWithResult(_0x433726,null))[_0xad48('0x46')](handleError(_0x433726,null));};exports['destroy']=function(_0x496615,_0x50e2e4){return db[_0xad48('0x40')]['find']({'where':{'id':_0x496615[_0xad48('0x43')]['id']}})['then'](handleEntityNotFound(_0x50e2e4,null))[_0xad48('0x22')](removeEntity(_0x50e2e4,null))['catch'](handleError(_0x50e2e4,null));};exports[_0xad48('0x55')]=function(_0x3d4e0f,_0x3cfdea,_0x33ea21){var _0x5e6fa8={'raw':!![],'where':{}};var _0x1c4caf={};var _0x2bb857={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xad48('0x56')]({'where':{'id':_0x3d4e0f[_0xad48('0x43')]['id']}})[_0xad48('0x22')](handleEntityNotFound(_0x3cfdea,null))[_0xad48('0x22')](function(_0x133bec){if(_0x133bec){_0x1c4caf[_0xad48('0x2f')]=_[_0xad48('0x51')](db['JscriptySessionReport'][_0xad48('0x2c')]);_0x1c4caf[_0xad48('0x31')]=_[_0xad48('0x51')](_0x3d4e0f[_0xad48('0x31')]);_0x1c4caf[_0xad48('0x32')]=_['intersection'](_0x1c4caf[_0xad48('0x2f')],_0x1c4caf['query']);_0x5e6fa8[_0xad48('0x34')]=_[_0xad48('0x33')](_0x1c4caf[_0xad48('0x2f')],qs[_0xad48('0x35')](_0x3d4e0f[_0xad48('0x31')][_0xad48('0x35')]));_0x5e6fa8['attributes']=_0x5e6fa8[_0xad48('0x34')][_0xad48('0x44')]?_0x5e6fa8[_0xad48('0x34')]:_0x1c4caf['model'];if(!_0x3d4e0f['query'][_0xad48('0x57')]('nolimit')){_0x5e6fa8[_0xad48('0x1b')]=qs[_0xad48('0x1b')](_0x3d4e0f[_0xad48('0x31')][_0xad48('0x1b')]);_0x5e6fa8[_0xad48('0x1c')]=qs[_0xad48('0x1c')](_0x3d4e0f[_0xad48('0x31')][_0xad48('0x1c')]);}_0x5e6fa8['order']=qs['sort'](_0x3d4e0f[_0xad48('0x31')][_0xad48('0x38')]);_0x5e6fa8[_0xad48('0x3a')]=qs['filters'](_[_0xad48('0x58')](_0x3d4e0f[_0xad48('0x31')],_0x1c4caf[_0xad48('0x32')]));_0x5e6fa8[_0xad48('0x3a')][_0xad48('0x59')]=_0x133bec['id'];if(_0x3d4e0f[_0xad48('0x31')]['filter']){_0x5e6fa8[_0xad48('0x3a')]=_['merge'](_0x5e6fa8['where'],{'$or':_['map'](_0x5e6fa8['attributes'],function(_0x1ed9aa){var _0x3ecf4c={};_0x3ecf4c[_0x1ed9aa]={'$like':'%'+_0x3d4e0f[_0xad48('0x31')][_0xad48('0x39')]+'%'};return _0x3ecf4c;})});}_0x5e6fa8=_[_0xad48('0x3b')]({},_0x5e6fa8,_0x3d4e0f[_0xad48('0x3d')]);return db['JscriptySessionReport']['count']({'where':_0x5e6fa8[_0xad48('0x3a')]})[_0xad48('0x22')](function(_0x142d36){_0x2bb857[_0xad48('0x1d')]=_0x142d36;if(_0x3d4e0f[_0xad48('0x31')]['includeAll']){_0x5e6fa8['include']=[{'all':!![]}];}return db[_0xad48('0x5a')][_0xad48('0x41')](_0x5e6fa8);})[_0xad48('0x22')](function(_0x208493){_0x2bb857[_0xad48('0x5b')]=_0x208493;return _0x2bb857;});}})[_0xad48('0x22')](respondWithFilteredResult(_0x3cfdea,_0x5e6fa8))[_0xad48('0x46')](handleError(_0x3cfdea,null));};exports[_0xad48('0x5c')]=function(_0x58f5c7,_0x2c3d92,_0x669e34){var _0x353bc4={'raw':!![],'where':{}};var _0x1610a4={};var _0xc8dc39={'count':0x0,'rows':[]};return db[_0xad48('0x40')][_0xad48('0x56')]({'where':{'id':_0x58f5c7[_0xad48('0x43')]['id']}})[_0xad48('0x22')](handleEntityNotFound(_0x2c3d92,null))[_0xad48('0x22')](function(_0x306828){if(_0x306828){_0x1610a4[_0xad48('0x2f')]=_[_0xad48('0x51')](db['JscriptyAnswerReport'][_0xad48('0x2c')]);_0x1610a4[_0xad48('0x31')]=_[_0xad48('0x51')](_0x58f5c7[_0xad48('0x31')]);_0x1610a4[_0xad48('0x32')]=_[_0xad48('0x33')](_0x1610a4[_0xad48('0x2f')],_0x1610a4[_0xad48('0x31')]);_0x353bc4[_0xad48('0x34')]=_['intersection'](_0x1610a4[_0xad48('0x2f')],qs[_0xad48('0x35')](_0x58f5c7[_0xad48('0x31')][_0xad48('0x35')]));_0x353bc4[_0xad48('0x34')]=_0x353bc4[_0xad48('0x34')]['length']?_0x353bc4['attributes']:_0x1610a4[_0xad48('0x2f')];if(!_0x58f5c7[_0xad48('0x31')]['hasOwnProperty'](_0xad48('0x36'))){_0x353bc4['limit']=qs[_0xad48('0x1b')](_0x58f5c7[_0xad48('0x31')][_0xad48('0x1b')]);_0x353bc4['offset']=qs['offset'](_0x58f5c7[_0xad48('0x31')][_0xad48('0x1c')]);}_0x353bc4[_0xad48('0x37')]=qs['sort'](_0x58f5c7['query']['sort']);_0x353bc4['where']=qs[_0xad48('0x32')](_[_0xad48('0x58')](_0x58f5c7[_0xad48('0x31')],_0x1610a4[_0xad48('0x32')]));_0x353bc4[_0xad48('0x3a')][_0xad48('0x59')]=_0x306828['id'];if(_0x58f5c7[_0xad48('0x31')]['filter']){_0x353bc4[_0xad48('0x3a')]=_[_0xad48('0x3b')](_0x353bc4[_0xad48('0x3a')],{'$or':_['map'](_0x353bc4[_0xad48('0x34')],function(_0x41664d){var _0x48585c={};_0x48585c[_0x41664d]={'$like':'%'+_0x58f5c7[_0xad48('0x31')][_0xad48('0x39')]+'%'};return _0x48585c;})});}_0x353bc4=_[_0xad48('0x3b')]({},_0x353bc4,_0x58f5c7[_0xad48('0x3d')]);return db[_0xad48('0x5d')][_0xad48('0x1d')]({'where':_0x353bc4[_0xad48('0x3a')]})[_0xad48('0x22')](function(_0x1deaff){_0xc8dc39['count']=_0x1deaff;if(_0x58f5c7[_0xad48('0x31')]['includeAll']){_0x353bc4[_0xad48('0x3f')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xad48('0x41')](_0x353bc4);})[_0xad48('0x22')](function(_0x273023){_0xc8dc39[_0xad48('0x5b')]=_0x273023;return _0xc8dc39;});}})[_0xad48('0x22')](respondWithFilteredResult(_0x2c3d92,_0x353bc4))[_0xad48('0x46')](handleError(_0x2c3d92,null));};function char(_0x424335){return'number'===typeof _0x424335?String[_0xad48('0x5e')][_0xad48('0x5f')](null,arguments):_0x424335;}function needsEncapsulation(_0x1f15f1){return!!_0x1f15f1&&(_0x1f15f1[_0xad48('0x60')]()[_0xad48('0x61')](char(0xd))>=0x0||_0x1f15f1['toString']()[_0xad48('0x61')](char(0xa))>=0x0||_0x1f15f1['toString']()['indexOf'](char(0x2c))>=0x0||_0x1f15f1['toString']()[_0xad48('0x61')](char(0x22))>=0x0);}function encapsulate(_0x74d68f){var _0x1ca911=char(0x22),_0x233b08='\x5c'+char(0x22),_0x1945c9=_0x74d68f[_0xad48('0x60')]()[_0xad48('0x62')](new RegExp(_0x1ca911,'g'),_0x233b08);return _0x1ca911+_0x1945c9+_0x1ca911;}exports[_0xad48('0x63')]=function(_0x10324e,_0x1b35e4,_0x439d46){var _0x1c0090,_0x30f5ba;var _0x52fb11={'where':{'ProjectId':_0x10324e[_0xad48('0x43')]['id']}};if(_0x10324e[_0xad48('0x31')][_0xad48('0x64')]){_0x52fb11[_0xad48('0x3a')][_0xad48('0x65')]=JSON[_0xad48('0x66')](_0x10324e[_0xad48('0x31')][_0xad48('0x64')]);}return db[_0xad48('0x5a')]['findAll'](_0x52fb11)[_0xad48('0x22')](handleEntityNotFound(_0x1b35e4,null))['then'](function(_0x54d0ea){if(_0x54d0ea){_0x1c0090=_0x54d0ea;return db['JscriptyQuestionReport'][_0xad48('0x41')]({'where':{'SessionId':{'$in':_[_0xad48('0x30')](_0x1c0090,'id')},'ProjectId':_0x10324e[_0xad48('0x43')]['id']},'order':_0xad48('0x67')});}})[_0xad48('0x22')](handleEntityNotFound(_0x1b35e4,null))[_0xad48('0x22')](function(_0x1e5b77){if(_0x1e5b77){_0x30f5ba=_0x1e5b77;var _0x448c06={};for(var _0x235665=0x0,_0x566b68=_0x30f5ba[_0xad48('0x44')];_0x235665<_0x566b68;_0x235665++){if(!_0x448c06[_0xad48('0x57')](_0x30f5ba[_0x235665][_0xad48('0x68')])){_0x448c06[_0x30f5ba[_0x235665][_0xad48('0x68')]]=needsEncapsulation(_0x30f5ba[_0x235665][_0xad48('0x69')])?encapsulate(_0x30f5ba[_0x235665][_0xad48('0x69')]):_0x30f5ba[_0x235665]['question'];}}var _0x14b8a8=[],_0x9dc768={};for(var _0x135c0f=0x0,_0x2d8818=_0x1c0090['length'];_0x135c0f<_0x2d8818;_0x135c0f++){_0x9dc768={'ProjectId':_0x10324e[_0xad48('0x43')]['id'],'SessionId':_0x1c0090[_0x135c0f]['id'],'StartTime':moment(_0x1c0090[_0x135c0f]['starttime'])[_0xad48('0x6a')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x32d976=0x0,_0x4e2c7a=_0x30f5ba['length'];_0x32d976<_0x4e2c7a;_0x32d976++){if(_0x30f5ba[_0x32d976][_0xad48('0x6b')]==_0x1c0090[_0x135c0f]['id']&&_0x448c06[_0xad48('0x57')](_0x30f5ba[_0x32d976][_0xad48('0x68')])){_0x9dc768[_0x448c06[_0x30f5ba[_0x32d976]['questionId']]]=_0x30f5ba[_0x32d976][_0xad48('0x6c')];}}for(var _0x4403a8 in _0x448c06){if(!_0x9dc768['hasOwnProperty'](_0x448c06[_0x4403a8])){_0x9dc768[_0x448c06[_0x4403a8]]=null;}}_0x14b8a8[_0xad48('0x6d')](_0x9dc768);}return _0x14b8a8;}})[_0xad48('0x22')](function(_0x3ae46f){if(!_[_0xad48('0x6e')](_0x3ae46f)){var _0x39dff2=toCsv(_0x3ae46f);var _0x4070ee=Date[_0xad48('0x6f')]();fs[_0xad48('0x70')](util[_0xad48('0x6a')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x10324e[_0xad48('0x43')]['id'],_0x4070ee),_0x39dff2);_0x1b35e4[_0xad48('0x71')]('Content-disposition','attachment;\x20filename='+util[_0xad48('0x6a')]('Jscripty_Project_%d_Summary_%s.csv',_0x10324e[_0xad48('0x43')]['id'],_0x4070ee));_0x1b35e4['setHeader'](_0xad48('0x72'),'text/csv');return _0x1b35e4['download'](util[_0xad48('0x6a')](_0xad48('0x73'),_0x10324e['params']['id'],_0x4070ee));}else{return _0x1b35e4[_0xad48('0x27')](0xcc);}})['catch'](handleError(_0x1b35e4,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 4a0c694..41eb655 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 _0x3edc=['jscripty_projects','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x3edc,0x1ae));var _0xc3ed=function(_0x38eb22,_0x458a8c){_0x38eb22=_0x38eb22-0x0;var _0x49553e=_0x3edc[_0x38eb22];return _0x49553e;};'use strict';var _=require(_0xc3ed('0x0'));var util=require(_0xc3ed('0x1'));var logger=require(_0xc3ed('0x2'))(_0xc3ed('0x3'));var moment=require(_0xc3ed('0x4'));var BPromise=require('bluebird');var rp=require(_0xc3ed('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc3ed('0x6'));var config=require(_0xc3ed('0x7'));var attributes=require(_0xc3ed('0x8'));module[_0xc3ed('0x9')]=function(_0x3f8468,_0x50b95c){return _0x3f8468[_0xc3ed('0xa')](_0xc3ed('0xb'),attributes,{'tableName':_0xc3ed('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x83d3=['define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x5e7123,_0x2e5a1c){var _0x59ce97=function(_0x5b035a){while(--_0x5b035a){_0x5e7123['push'](_0x5e7123['shift']());}};_0x59ce97(++_0x2e5a1c);}(_0x83d3,0x17c));var _0x383d=function(_0x1f20c1,_0x350567){_0x1f20c1=_0x1f20c1-0x0;var _0x548c58=_0x83d3[_0x1f20c1];return _0x548c58;};'use strict';var _=require(_0x383d('0x0'));var util=require(_0x383d('0x1'));var logger=require(_0x383d('0x2'))(_0x383d('0x3'));var moment=require(_0x383d('0x4'));var BPromise=require('bluebird');var rp=require(_0x383d('0x5'));var fs=require('fs');var path=require(_0x383d('0x6'));var rimraf=require(_0x383d('0x7'));var config=require(_0x383d('0x8'));var attributes=require('./jscriptyProject.attributes');module[_0x383d('0x9')]=function(_0x4f3c10,_0x50eaff){return _0x4f3c10[_0x383d('0xa')](_0x383d('0xb'),attributes,{'tableName':_0x383d('0xc'),'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 431bf2c..947a9c3 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x3add10,_0x457d16){var _0x2da348=function(_0x1fcaa9){while(--_0x1fcaa9){_0x3add10['push'](_0x3add10['shift']());}};_0x2da348(++_0x457d16);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file +var _0x9bde=['code','message','JscriptyProject,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x476a70,_0x44659d){var _0x2efcba=function(_0x4f91a5){while(--_0x4f91a5){_0x476a70['push'](_0x476a70['shift']());}};_0x2efcba(++_0x44659d);}(_0x9bde,0xe1));var _0xe9bd=function(_0x58766a,_0x35f510){_0x58766a=_0x58766a-0x0;var _0x5602b5=_0x9bde[_0x58766a];return _0x5602b5;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 8930eda..68f1420 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 _0x2ad7=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','/describe','describe','show','post','put','/:id','update','delete','exports','multer','util','connect-timeout'];(function(_0x2b8884,_0x308ab8){var _0x2049c8=function(_0x425355){while(--_0x425355){_0x2b8884['push'](_0x2b8884['shift']());}};_0x2049c8(++_0x308ab8);}(_0x2ad7,0x179));var _0x72ad=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x2ad7[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x72ad('0x0'));var util=require(_0x72ad('0x1'));var path=require('path');var timeout=require(_0x72ad('0x2'));var express=require(_0x72ad('0x3'));var router=express['Router']();var fs_extra=require(_0x72ad('0x4'));var auth=require(_0x72ad('0x5'));var interaction=require(_0x72ad('0x6'));var config=require(_0x72ad('0x7'));var controller=require(_0x72ad('0x8'));router[_0x72ad('0x9')]('/',auth[_0x72ad('0xa')](),controller['index']);router[_0x72ad('0x9')](_0x72ad('0xb'),auth[_0x72ad('0xa')](),controller[_0x72ad('0xc')]);router['get']('/:id',auth[_0x72ad('0xa')](),controller[_0x72ad('0xd')]);router[_0x72ad('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x72ad('0xf')](_0x72ad('0x10'),auth[_0x72ad('0xa')](),controller[_0x72ad('0x11')]);router[_0x72ad('0x12')](_0x72ad('0x10'),auth[_0x72ad('0xa')](),controller['destroy']);module[_0x72ad('0x13')]=router; \ No newline at end of file +var _0xf6db=['index','/describe','describe','show','post','create','put','/:id','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated'];(function(_0x18811d,_0x3e3763){var _0x2c627c=function(_0x2ac018){while(--_0x2ac018){_0x18811d['push'](_0x18811d['shift']());}};_0x2c627c(++_0x3e3763);}(_0xf6db,0x74));var _0xbf6d=function(_0x2bc400,_0x27208f){_0x2bc400=_0x2bc400-0x0;var _0x36ab53=_0xf6db[_0x2bc400];return _0x36ab53;};'use strict';var multer=require(_0xbf6d('0x0'));var util=require('util');var path=require(_0xbf6d('0x1'));var timeout=require('connect-timeout');var express=require(_0xbf6d('0x2'));var router=express['Router']();var fs_extra=require(_0xbf6d('0x3'));var auth=require(_0xbf6d('0x4'));var interaction=require(_0xbf6d('0x5'));var config=require(_0xbf6d('0x6'));var controller=require(_0xbf6d('0x7'));router[_0xbf6d('0x8')]('/',auth[_0xbf6d('0x9')](),controller[_0xbf6d('0xa')]);router['get'](_0xbf6d('0xb'),auth[_0xbf6d('0x9')](),controller[_0xbf6d('0xc')]);router['get']('/:id',auth[_0xbf6d('0x9')](),controller[_0xbf6d('0xd')]);router[_0xbf6d('0xe')]('/',auth['isAuthenticated'](),controller[_0xbf6d('0xf')]);router[_0xbf6d('0x10')](_0xbf6d('0x11'),auth[_0xbf6d('0x9')](),controller['update']);router[_0xbf6d('0x12')](_0xbf6d('0x11'),auth[_0xbf6d('0x9')](),controller[_0xbf6d('0x13')]);module[_0xbf6d('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 0a5e907..3d16864 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(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x7a54,0x106));var _0x47a5=function(_0x255c3c,_0x565674){_0x255c3c=_0x255c3c-0x0;var _0x2931e2=_0x7a54[_0x255c3c];return _0x2931e2;};'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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7a54,0x106));var _0x47a5=function(_0x4c08ed,_0x2e8013){_0x4c08ed=_0x4c08ed-0x0;var _0x427957=_0x7a54[_0x4c08ed];return _0x427957;};'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 523f6e9..55dce3c 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 _0x9557=['set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','includeAll','include','findAll','rows','catch','show','params','length','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count'];(function(_0x3a831f,_0x31c8a4){var _0x26786c=function(_0x33cbdf){while(--_0x33cbdf){_0x3a831f['push'](_0x3a831f['shift']());}};_0x26786c(++_0x31c8a4);}(_0x9557,0x159));var _0x7955=function(_0xda3439,_0x5b30a9){_0xda3439=_0xda3439-0x0;var _0x2cba9d=_0x9557[_0xda3439];return _0x2cba9d;};'use strict';var emlformat=require(_0x7955('0x0'));var rimraf=require(_0x7955('0x1'));var zipdir=require(_0x7955('0x2'));var jsonpatch=require(_0x7955('0x3'));var rp=require(_0x7955('0x4'));var moment=require(_0x7955('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7955('0x6'));var util=require(_0x7955('0x7'));var path=require(_0x7955('0x8'));var sox=require('sox');var csv=require(_0x7955('0x9'));var ejs=require(_0x7955('0xa'));var fs=require('fs');var fs_extra=require(_0x7955('0xb'));var _=require(_0x7955('0xc'));var squel=require(_0x7955('0xd'));var crypto=require(_0x7955('0xe'));var jsforce=require(_0x7955('0xf'));var deskjs=require(_0x7955('0x10'));var toCsv=require(_0x7955('0x9'));var querystring=require(_0x7955('0x11'));var Papa=require(_0x7955('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7955('0x13'));var as=require(_0x7955('0x14'));var hardwareService=require(_0x7955('0x15'));var logger=require(_0x7955('0x16'))(_0x7955('0x17'));var utils=require(_0x7955('0x18'));var config=require(_0x7955('0x19'));var licenseUtil=require(_0x7955('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58cbfc,_0x3d8cbe){_0x3d8cbe=_0x3d8cbe||0xcc;return function(_0x444be5){if(_0x444be5){return _0x58cbfc[_0x7955('0x1b')](_0x3d8cbe);}return _0x58cbfc[_0x7955('0x1c')](_0x3d8cbe)[_0x7955('0x1d')]();};}function respondWithResult(_0x26c146,_0x1c7633){_0x1c7633=_0x1c7633||0xc8;return function(_0x59ec8a){if(_0x59ec8a){return _0x26c146[_0x7955('0x1c')](_0x1c7633)[_0x7955('0x1e')](_0x59ec8a);}};}function respondWithFilteredResult(_0x1d2c1c,_0x39ba92){return function(_0x2ea175){if(_0x2ea175){var _0x121ab5=typeof _0x39ba92[_0x7955('0x1f')]==='undefined'&&typeof _0x39ba92[_0x7955('0x20')]===_0x7955('0x21');var _0x41f81e=_0x2ea175['count'];var _0x5b3f51=_0x121ab5?0x0:_0x39ba92[_0x7955('0x1f')];var _0x5dc63d=_0x121ab5?_0x2ea175[_0x7955('0x22')]:_0x39ba92[_0x7955('0x1f')]+_0x39ba92[_0x7955('0x20')];var _0x5a31c1;if(_0x5dc63d>=_0x41f81e){_0x5dc63d=_0x41f81e;_0x5a31c1=0xc8;}else{_0x5a31c1=0xce;}_0x1d2c1c['status'](_0x5a31c1);return _0x1d2c1c[_0x7955('0x23')](_0x7955('0x24'),_0x5b3f51+'-'+_0x5dc63d+'/'+_0x41f81e)[_0x7955('0x1e')](_0x2ea175);}return null;};}function patchUpdates(_0x1e0e0a){return function(_0x90bfbf){try{jsonpatch[_0x7955('0x25')](_0x90bfbf,_0x1e0e0a,!![]);}catch(_0x4c4ebc){return BPromise[_0x7955('0x26')](_0x4c4ebc);}return _0x90bfbf['save']();};}function saveUpdates(_0xc46c95,_0x5939c7){return function(_0x1786d3){if(_0x1786d3){return _0x1786d3[_0x7955('0x27')](_0xc46c95)[_0x7955('0x28')](function(_0x2a8d1f){return _0x2a8d1f;});}return null;};}function removeEntity(_0x90c0fb,_0x5a620f){return function(_0x75c728){if(_0x75c728){return _0x75c728[_0x7955('0x29')]()[_0x7955('0x28')](function(){_0x90c0fb['status'](0xcc)[_0x7955('0x1d')]();});}};}function handleEntityNotFound(_0xf7d5c4,_0x39f2d5){return function(_0x5d007a){if(!_0x5d007a){_0xf7d5c4[_0x7955('0x1b')](0x194);}return _0x5d007a;};}function handleError(_0x2a0440,_0x5b32d3){_0x5b32d3=_0x5b32d3||0x1f4;return function(_0x4ee0fb){logger[_0x7955('0x2a')](_0x4ee0fb[_0x7955('0x2b')]);if(_0x4ee0fb[_0x7955('0x2c')]){delete _0x4ee0fb['name'];}_0x2a0440[_0x7955('0x1c')](_0x5b32d3)[_0x7955('0x2d')](_0x4ee0fb);};}exports['index']=function(_0x4153d4,_0xae77f){var _0x31bb3a={},_0x15232a={},_0x4f1f87={'count':0x0,'rows':[]};var _0x3e1bb0=_[_0x7955('0x2e')](db[_0x7955('0x2f')][_0x7955('0x30')],function(_0x4baca8){return{'name':_0x4baca8[_0x7955('0x31')],'type':_0x4baca8[_0x7955('0x32')][_0x7955('0x33')]};});_0x15232a[_0x7955('0x34')]=_[_0x7955('0x2e')](_0x3e1bb0,_0x7955('0x2c'));_0x15232a['query']=_[_0x7955('0x35')](_0x4153d4[_0x7955('0x36')]);_0x15232a[_0x7955('0x37')]=_[_0x7955('0x38')](_0x15232a[_0x7955('0x34')],_0x15232a[_0x7955('0x36')]);_0x31bb3a[_0x7955('0x39')]=_['intersection'](_0x15232a[_0x7955('0x34')],qs['fields'](_0x4153d4[_0x7955('0x36')][_0x7955('0x3a')]));_0x31bb3a[_0x7955('0x39')]=_0x31bb3a[_0x7955('0x39')]['length']?_0x31bb3a[_0x7955('0x39')]:_0x15232a[_0x7955('0x34')];if(!_0x4153d4[_0x7955('0x36')][_0x7955('0x3b')](_0x7955('0x3c'))){_0x31bb3a['limit']=qs['limit'](_0x4153d4['query'][_0x7955('0x20')]);_0x31bb3a[_0x7955('0x1f')]=qs[_0x7955('0x1f')](_0x4153d4[_0x7955('0x36')][_0x7955('0x1f')]);}_0x31bb3a['order']=qs[_0x7955('0x3d')](_0x4153d4[_0x7955('0x36')][_0x7955('0x3d')]);_0x31bb3a[_0x7955('0x3e')]=qs[_0x7955('0x37')](_[_0x7955('0x3f')](_0x4153d4[_0x7955('0x36')],_0x15232a[_0x7955('0x37')]),_0x3e1bb0);if(_0x4153d4['query'][_0x7955('0x40')]){_0x31bb3a[_0x7955('0x3e')]=_['merge'](_0x31bb3a[_0x7955('0x3e')],{'$or':_['map'](_0x3e1bb0,function(_0x3af3fa){if(_0x3af3fa['type']!=='VIRTUAL'){var _0x21a4b0={};_0x21a4b0[_0x3af3fa[_0x7955('0x2c')]]={'$like':'%'+_0x4153d4[_0x7955('0x36')][_0x7955('0x40')]+'%'};return _0x21a4b0;}})});}_0x31bb3a=_['merge']({},_0x31bb3a,_0x4153d4['options']);var _0xfc6624={'where':_0x31bb3a[_0x7955('0x3e')]};return db[_0x7955('0x2f')]['count'](_0xfc6624)[_0x7955('0x28')](function(_0x414cb3){_0x4f1f87['count']=_0x414cb3;if(_0x4153d4[_0x7955('0x36')][_0x7955('0x41')]){_0x31bb3a[_0x7955('0x42')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x7955('0x43')](_0x31bb3a);})['then'](function(_0x159602){_0x4f1f87[_0x7955('0x44')]=_0x159602;return _0x4f1f87;})[_0x7955('0x28')](respondWithFilteredResult(_0xae77f,_0x31bb3a))[_0x7955('0x45')](handleError(_0xae77f,null));};exports[_0x7955('0x46')]=function(_0x52b5ab,_0x1d084f){var _0x3faa27={'raw':!![],'where':{'id':_0x52b5ab[_0x7955('0x47')]['id']}},_0x1326dc={};_0x1326dc[_0x7955('0x34')]=_['keys'](db['JscriptyQuestionReport'][_0x7955('0x30')]);_0x1326dc[_0x7955('0x36')]=_[_0x7955('0x35')](_0x52b5ab[_0x7955('0x36')]);_0x1326dc[_0x7955('0x37')]=_[_0x7955('0x38')](_0x1326dc[_0x7955('0x34')],_0x1326dc[_0x7955('0x36')]);_0x3faa27['attributes']=_['intersection'](_0x1326dc['model'],qs[_0x7955('0x3a')](_0x52b5ab[_0x7955('0x36')][_0x7955('0x3a')]));_0x3faa27['attributes']=_0x3faa27[_0x7955('0x39')][_0x7955('0x48')]?_0x3faa27[_0x7955('0x39')]:_0x1326dc[_0x7955('0x34')];if(_0x52b5ab[_0x7955('0x36')]['includeAll']){_0x3faa27[_0x7955('0x42')]=[{'all':!![]}];}_0x3faa27=_['merge']({},_0x3faa27,_0x52b5ab['options']);return db[_0x7955('0x2f')][_0x7955('0x49')](_0x3faa27)[_0x7955('0x28')](handleEntityNotFound(_0x1d084f,null))[_0x7955('0x28')](respondWithResult(_0x1d084f,null))[_0x7955('0x45')](handleError(_0x1d084f,null));};exports['create']=function(_0x222ba6,_0x22672d){return db[_0x7955('0x2f')]['create'](_0x222ba6[_0x7955('0x4a')],{})['then'](respondWithResult(_0x22672d,0xc9))[_0x7955('0x45')](handleError(_0x22672d,null));};exports[_0x7955('0x27')]=function(_0x4a5014,_0x49cdb4){if(_0x4a5014[_0x7955('0x4a')]['id']){delete _0x4a5014[_0x7955('0x4a')]['id'];}return db[_0x7955('0x2f')][_0x7955('0x49')]({'where':{'id':_0x4a5014[_0x7955('0x47')]['id']}})['then'](handleEntityNotFound(_0x49cdb4,null))[_0x7955('0x28')](saveUpdates(_0x4a5014[_0x7955('0x4a')],null))['then'](respondWithResult(_0x49cdb4,null))[_0x7955('0x45')](handleError(_0x49cdb4,null));};exports['destroy']=function(_0x4cd05a,_0x4abb6e){return db[_0x7955('0x2f')][_0x7955('0x49')]({'where':{'id':_0x4cd05a['params']['id']}})[_0x7955('0x28')](handleEntityNotFound(_0x4abb6e,null))[_0x7955('0x28')](removeEntity(_0x4abb6e,null))[_0x7955('0x45')](handleError(_0x4abb6e,null));};exports['describe']=function(_0x22fe4f,_0x8ca192){return db[_0x7955('0x2f')][_0x7955('0x4b')]()[_0x7955('0x28')](respondWithResult(_0x8ca192,null))['catch'](handleError(_0x8ca192,null));}; \ No newline at end of file +var _0x5aa3=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','where','pick','filter','VIRTUAL','include','findAll','rows','show','params','includeAll','options','find','create','body','catch','destroy','eml-format','zip-dir'];(function(_0x3330b8,_0x19b32a){var _0x191799=function(_0xb95e53){while(--_0xb95e53){_0x3330b8['push'](_0x3330b8['shift']());}};_0x191799(++_0x19b32a);}(_0x5aa3,0x1ba));var _0x35aa=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x5aa3[_0x49b207];return _0x2dc8fa;};'use strict';var emlformat=require(_0x35aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x35aa('0x1'));var jsonpatch=require(_0x35aa('0x2'));var rp=require(_0x35aa('0x3'));var moment=require(_0x35aa('0x4'));var BPromise=require(_0x35aa('0x5'));var Mustache=require(_0x35aa('0x6'));var util=require(_0x35aa('0x7'));var path=require(_0x35aa('0x8'));var sox=require(_0x35aa('0x9'));var csv=require(_0x35aa('0xa'));var ejs=require(_0x35aa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x35aa('0xc'));var crypto=require('crypto');var jsforce=require(_0x35aa('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x35aa('0xa'));var querystring=require('querystring');var Papa=require(_0x35aa('0xe'));var Redis=require(_0x35aa('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x35aa('0x10'));var hardwareService=require(_0x35aa('0x11'));var logger=require(_0x35aa('0x12'))(_0x35aa('0x13'));var utils=require(_0x35aa('0x14'));var config=require(_0x35aa('0x15'));var licenseUtil=require(_0x35aa('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x491f91,_0x549445){_0x549445=_0x549445||0xcc;return function(_0x559c3a){if(_0x559c3a){return _0x491f91[_0x35aa('0x17')](_0x549445);}return _0x491f91[_0x35aa('0x18')](_0x549445)[_0x35aa('0x19')]();};}function respondWithResult(_0x5babfc,_0x49c9a7){_0x49c9a7=_0x49c9a7||0xc8;return function(_0x44bb5c){if(_0x44bb5c){return _0x5babfc[_0x35aa('0x18')](_0x49c9a7)[_0x35aa('0x1a')](_0x44bb5c);}};}function respondWithFilteredResult(_0x301ca1,_0x3a6303){return function(_0x4bd2f5){if(_0x4bd2f5){var _0x14a131=typeof _0x3a6303[_0x35aa('0x1b')]===_0x35aa('0x1c')&&typeof _0x3a6303['limit']===_0x35aa('0x1c');var _0x2fc408=_0x4bd2f5['count'];var _0x575662=_0x14a131?0x0:_0x3a6303['offset'];var _0x4f664c=_0x14a131?_0x4bd2f5[_0x35aa('0x1d')]:_0x3a6303[_0x35aa('0x1b')]+_0x3a6303['limit'];var _0xa3068c;if(_0x4f664c>=_0x2fc408){_0x4f664c=_0x2fc408;_0xa3068c=0xc8;}else{_0xa3068c=0xce;}_0x301ca1[_0x35aa('0x18')](_0xa3068c);return _0x301ca1[_0x35aa('0x1e')](_0x35aa('0x1f'),_0x575662+'-'+_0x4f664c+'/'+_0x2fc408)[_0x35aa('0x1a')](_0x4bd2f5);}return null;};}function patchUpdates(_0xd29a5f){return function(_0x34ec73){try{jsonpatch[_0x35aa('0x20')](_0x34ec73,_0xd29a5f,!![]);}catch(_0x4709c4){return BPromise[_0x35aa('0x21')](_0x4709c4);}return _0x34ec73['save']();};}function saveUpdates(_0x22a834,_0x57310d){return function(_0x90248a){if(_0x90248a){return _0x90248a[_0x35aa('0x22')](_0x22a834)[_0x35aa('0x23')](function(_0x219aa3){return _0x219aa3;});}return null;};}function removeEntity(_0x264156,_0x581d5a){return function(_0x4621bc){if(_0x4621bc){return _0x4621bc['destroy']()[_0x35aa('0x23')](function(){_0x264156['status'](0xcc)[_0x35aa('0x19')]();});}};}function handleEntityNotFound(_0x1ca2f2,_0x77add4){return function(_0x3754ac){if(!_0x3754ac){_0x1ca2f2['sendStatus'](0x194);}return _0x3754ac;};}function handleError(_0x16b2d0,_0x28906b){_0x28906b=_0x28906b||0x1f4;return function(_0xf4897b){logger[_0x35aa('0x24')](_0xf4897b[_0x35aa('0x25')]);if(_0xf4897b[_0x35aa('0x26')]){delete _0xf4897b[_0x35aa('0x26')];}_0x16b2d0[_0x35aa('0x18')](_0x28906b)[_0x35aa('0x27')](_0xf4897b);};}exports[_0x35aa('0x28')]=function(_0x4b610b,_0x5f03a6){var _0x2de83a={},_0x3d6dd1={},_0x28e3d3={'count':0x0,'rows':[]};var _0x195a34=_[_0x35aa('0x29')](db[_0x35aa('0x2a')][_0x35aa('0x2b')],function(_0x3fc915){return{'name':_0x3fc915[_0x35aa('0x2c')],'type':_0x3fc915[_0x35aa('0x2d')][_0x35aa('0x2e')]};});_0x3d6dd1[_0x35aa('0x2f')]=_['map'](_0x195a34,_0x35aa('0x26'));_0x3d6dd1['query']=_[_0x35aa('0x30')](_0x4b610b[_0x35aa('0x31')]);_0x3d6dd1[_0x35aa('0x32')]=_[_0x35aa('0x33')](_0x3d6dd1[_0x35aa('0x2f')],_0x3d6dd1['query']);_0x2de83a['attributes']=_['intersection'](_0x3d6dd1[_0x35aa('0x2f')],qs[_0x35aa('0x34')](_0x4b610b[_0x35aa('0x31')][_0x35aa('0x34')]));_0x2de83a[_0x35aa('0x35')]=_0x2de83a[_0x35aa('0x35')][_0x35aa('0x36')]?_0x2de83a['attributes']:_0x3d6dd1[_0x35aa('0x2f')];if(!_0x4b610b['query'][_0x35aa('0x37')]('nolimit')){_0x2de83a[_0x35aa('0x38')]=qs['limit'](_0x4b610b[_0x35aa('0x31')][_0x35aa('0x38')]);_0x2de83a['offset']=qs[_0x35aa('0x1b')](_0x4b610b[_0x35aa('0x31')][_0x35aa('0x1b')]);}_0x2de83a['order']=qs['sort'](_0x4b610b[_0x35aa('0x31')][_0x35aa('0x39')]);_0x2de83a[_0x35aa('0x3a')]=qs['filters'](_[_0x35aa('0x3b')](_0x4b610b[_0x35aa('0x31')],_0x3d6dd1[_0x35aa('0x32')]),_0x195a34);if(_0x4b610b[_0x35aa('0x31')][_0x35aa('0x3c')]){_0x2de83a['where']=_['merge'](_0x2de83a[_0x35aa('0x3a')],{'$or':_[_0x35aa('0x29')](_0x195a34,function(_0x9e0a49){if(_0x9e0a49[_0x35aa('0x2d')]!==_0x35aa('0x3d')){var _0xa6335e={};_0xa6335e[_0x9e0a49[_0x35aa('0x26')]]={'$like':'%'+_0x4b610b[_0x35aa('0x31')][_0x35aa('0x3c')]+'%'};return _0xa6335e;}})});}_0x2de83a=_['merge']({},_0x2de83a,_0x4b610b['options']);var _0x2bd418={'where':_0x2de83a[_0x35aa('0x3a')]};return db['JscriptyQuestionReport'][_0x35aa('0x1d')](_0x2bd418)[_0x35aa('0x23')](function(_0x4fa8e9){_0x28e3d3[_0x35aa('0x1d')]=_0x4fa8e9;if(_0x4b610b[_0x35aa('0x31')]['includeAll']){_0x2de83a[_0x35aa('0x3e')]=[{'all':!![]}];}return db[_0x35aa('0x2a')][_0x35aa('0x3f')](_0x2de83a);})[_0x35aa('0x23')](function(_0x198aa2){_0x28e3d3[_0x35aa('0x40')]=_0x198aa2;return _0x28e3d3;})['then'](respondWithFilteredResult(_0x5f03a6,_0x2de83a))['catch'](handleError(_0x5f03a6,null));};exports[_0x35aa('0x41')]=function(_0x2a1223,_0x51ea84){var _0x4acbd8={'raw':!![],'where':{'id':_0x2a1223[_0x35aa('0x42')]['id']}},_0x90aa2c={};_0x90aa2c[_0x35aa('0x2f')]=_['keys'](db['JscriptyQuestionReport'][_0x35aa('0x2b')]);_0x90aa2c[_0x35aa('0x31')]=_['keys'](_0x2a1223[_0x35aa('0x31')]);_0x90aa2c[_0x35aa('0x32')]=_[_0x35aa('0x33')](_0x90aa2c[_0x35aa('0x2f')],_0x90aa2c[_0x35aa('0x31')]);_0x4acbd8['attributes']=_[_0x35aa('0x33')](_0x90aa2c[_0x35aa('0x2f')],qs[_0x35aa('0x34')](_0x2a1223['query'][_0x35aa('0x34')]));_0x4acbd8['attributes']=_0x4acbd8[_0x35aa('0x35')][_0x35aa('0x36')]?_0x4acbd8[_0x35aa('0x35')]:_0x90aa2c[_0x35aa('0x2f')];if(_0x2a1223[_0x35aa('0x31')][_0x35aa('0x43')]){_0x4acbd8['include']=[{'all':!![]}];}_0x4acbd8=_['merge']({},_0x4acbd8,_0x2a1223[_0x35aa('0x44')]);return db[_0x35aa('0x2a')][_0x35aa('0x45')](_0x4acbd8)[_0x35aa('0x23')](handleEntityNotFound(_0x51ea84,null))[_0x35aa('0x23')](respondWithResult(_0x51ea84,null))['catch'](handleError(_0x51ea84,null));};exports[_0x35aa('0x46')]=function(_0x323fe2,_0x45406c){return db[_0x35aa('0x2a')][_0x35aa('0x46')](_0x323fe2[_0x35aa('0x47')],{})[_0x35aa('0x23')](respondWithResult(_0x45406c,0xc9))['catch'](handleError(_0x45406c,null));};exports[_0x35aa('0x22')]=function(_0x953cb,_0x251ab3){if(_0x953cb['body']['id']){delete _0x953cb[_0x35aa('0x47')]['id'];}return db[_0x35aa('0x2a')][_0x35aa('0x45')]({'where':{'id':_0x953cb[_0x35aa('0x42')]['id']}})[_0x35aa('0x23')](handleEntityNotFound(_0x251ab3,null))[_0x35aa('0x23')](saveUpdates(_0x953cb['body'],null))['then'](respondWithResult(_0x251ab3,null))[_0x35aa('0x48')](handleError(_0x251ab3,null));};exports[_0x35aa('0x49')]=function(_0x189875,_0x18b4c0){return db['JscriptyQuestionReport'][_0x35aa('0x45')]({'where':{'id':_0x189875[_0x35aa('0x42')]['id']}})['then'](handleEntityNotFound(_0x18b4c0,null))[_0x35aa('0x23')](removeEntity(_0x18b4c0,null))[_0x35aa('0x48')](handleError(_0x18b4c0,null));};exports['describe']=function(_0x1b586d,_0x46f1b9){return db[_0x35aa('0x2a')]['describe']()['then'](respondWithResult(_0x46f1b9,null))[_0x35aa('0x48')](handleError(_0x46f1b9,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 71dc09a..6c0ed96 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 _0x536a=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions'];(function(_0x3801e2,_0x275cd5){var _0xe49c8f=function(_0x3241ac){while(--_0x3241ac){_0x3801e2['push'](_0x3801e2['shift']());}};_0xe49c8f(++_0x275cd5);}(_0x536a,0x14a));var _0xa536=function(_0x5cf7b7,_0x45fa03){_0x5cf7b7=_0x5cf7b7-0x0;var _0x55a49f=_0x536a[_0x5cf7b7];return _0x55a49f;};'use strict';var _=require(_0xa536('0x0'));var util=require(_0xa536('0x1'));var logger=require(_0xa536('0x2'))(_0xa536('0x3'));var moment=require(_0xa536('0x4'));var BPromise=require(_0xa536('0x5'));var rp=require(_0xa536('0x6'));var fs=require('fs');var path=require(_0xa536('0x7'));var rimraf=require(_0xa536('0x8'));var config=require(_0xa536('0x9'));var attributes=require(_0xa536('0xa'));module[_0xa536('0xb')]=function(_0x4c9520,_0x3ef2fd){return _0x4c9520[_0xa536('0xc')](_0xa536('0xd'),attributes,{'tableName':_0xa536('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc3cf=['bluebird','request-promise','path','rimraf','./jscriptyQuestionReport.attributes','exports','define','lodash','util','../../config/logger','moment'];(function(_0x208acf,_0x405c66){var _0x4437b1=function(_0x41715f){while(--_0x41715f){_0x208acf['push'](_0x208acf['shift']());}};_0x4437b1(++_0x405c66);}(_0xc3cf,0x1d5));var _0xfc3c=function(_0x11c8bd,_0x23c893){_0x11c8bd=_0x11c8bd-0x0;var _0x14a45b=_0xc3cf[_0x11c8bd];return _0x14a45b;};'use strict';var _=require(_0xfc3c('0x0'));var util=require(_0xfc3c('0x1'));var logger=require(_0xfc3c('0x2'))('api');var moment=require(_0xfc3c('0x3'));var BPromise=require(_0xfc3c('0x4'));var rp=require(_0xfc3c('0x5'));var fs=require('fs');var path=require(_0xfc3c('0x6'));var rimraf=require(_0xfc3c('0x7'));var config=require('../../config/environment');var attributes=require(_0xfc3c('0x8'));module[_0xfc3c('0x9')]=function(_0x37ccb1,_0x8b0bb3){return _0x37ccb1[_0xfc3c('0xa')]('JscriptyQuestionReport',attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 0fc2e7a..ea9e404 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 _0x913f=['info','JscriptyQuestionReport,\x20%s,\x20%s','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x913f,0x139));var _0xf913=function(_0x2bb11,_0x549e38){_0x2bb11=_0x2bb11-0x0;var _0x536f5d=_0x913f[_0x2bb11];return _0x536f5d;};'use strict';var _=require('lodash');var util=require(_0xf913('0x0'));var moment=require('moment');var BPromise=require(_0xf913('0x1'));var rs=require(_0xf913('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf913('0x3'));var logger=require(_0xf913('0x4'))('rpc');var config=require(_0xf913('0x5'));var jayson=require(_0xf913('0x6'));var client=jayson[_0xf913('0x7')][_0xf913('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2300e9,_0x10afd4,_0x397816){return new BPromise(function(_0x47565a,_0x38902e){return client['request'](_0x2300e9,_0x397816)[_0xf913('0x9')](function(_0x1e4d37){logger[_0xf913('0xa')](_0xf913('0xb'),_0x10afd4,'request\x20sent');logger['debug'](_0xf913('0xc'),_0x10afd4,_0xf913('0xd'),JSON[_0xf913('0xe')](_0x1e4d37));if(_0x1e4d37[_0xf913('0xf')]){if(_0x1e4d37['error'][_0xf913('0x10')]===0x1f4){logger[_0xf913('0xf')](_0xf913('0xb'),_0x10afd4,_0x1e4d37[_0xf913('0xf')][_0xf913('0x11')]);return _0x38902e(_0x1e4d37[_0xf913('0xf')][_0xf913('0x11')]);}logger['error'](_0xf913('0xb'),_0x10afd4,_0x1e4d37[_0xf913('0xf')]['message']);return _0x47565a(_0x1e4d37[_0xf913('0xf')][_0xf913('0x11')]);}else{logger[_0xf913('0xa')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x10afd4,_0xf913('0xd'));_0x47565a(_0x1e4d37[_0xf913('0x12')]['message']);}})['catch'](function(_0x573c5c){logger[_0xf913('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x10afd4,_0x573c5c);_0x38902e(_0x573c5c);});});} \ No newline at end of file +var _0x93b9=['moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util'];(function(_0x801c45,_0x83ca28){var _0x146717=function(_0x30f0d9){while(--_0x30f0d9){_0x801c45['push'](_0x801c45['shift']());}};_0x146717(++_0x83ca28);}(_0x93b9,0x7d));var _0x993b=function(_0x52c4e9,_0x5412d0){_0x52c4e9=_0x52c4e9-0x0;var _0x252a03=_0x93b9[_0x52c4e9];return _0x252a03;};'use strict';var _=require('lodash');var util=require(_0x993b('0x0'));var moment=require(_0x993b('0x1'));var BPromise=require('bluebird');var rs=require(_0x993b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x993b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x993b('0x4'))('rpc');var config=require(_0x993b('0x5'));var jayson=require(_0x993b('0x6'));var client=jayson[_0x993b('0x7')][_0x993b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x440aef,_0x29b4a1,_0x3e1248){return new BPromise(function(_0x22e9df,_0x1f2739){return client[_0x993b('0x9')](_0x440aef,_0x3e1248)[_0x993b('0xa')](function(_0x5177ed){logger['info'](_0x993b('0xb'),_0x29b4a1,_0x993b('0xc'));logger[_0x993b('0xd')](_0x993b('0xe'),_0x29b4a1,'request\x20sent',JSON['stringify'](_0x5177ed));if(_0x5177ed[_0x993b('0xf')]){if(_0x5177ed[_0x993b('0xf')][_0x993b('0x10')]===0x1f4){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x29b4a1,_0x5177ed[_0x993b('0xf')][_0x993b('0x11')]);return _0x1f2739(_0x5177ed[_0x993b('0xf')][_0x993b('0x11')]);}logger[_0x993b('0xf')](_0x993b('0xb'),_0x29b4a1,_0x5177ed[_0x993b('0xf')][_0x993b('0x11')]);return _0x22e9df(_0x5177ed[_0x993b('0xf')][_0x993b('0x11')]);}else{logger[_0x993b('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x29b4a1,_0x993b('0xc'));_0x22e9df(_0x5177ed[_0x993b('0x13')][_0x993b('0x11')]);}})[_0x993b('0x14')](function(_0x1e99ec){logger[_0x993b('0xf')](_0x993b('0xb'),_0x29b4a1,_0x1e99ec);_0x1f2739(_0x1e99ec);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index cb048f8..c921641 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 _0x7c71=['delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','/describe','isAuthenticated','describe','show','/:id/questions','getQuestions','post','put','/:id','update'];(function(_0x4dccf2,_0x5cfcd7){var _0x12640e=function(_0x1fb2c7){while(--_0x1fb2c7){_0x4dccf2['push'](_0x4dccf2['shift']());}};_0x12640e(++_0x5cfcd7);}(_0x7c71,0x10b));var _0x17c7=function(_0x117f4c,_0x36a9b1){_0x117f4c=_0x117f4c-0x0;var _0x2b24e9=_0x7c71[_0x117f4c];return _0x2b24e9;};'use strict';var multer=require(_0x17c7('0x0'));var util=require('util');var path=require(_0x17c7('0x1'));var timeout=require(_0x17c7('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x17c7('0x3'));var auth=require(_0x17c7('0x4'));var interaction=require(_0x17c7('0x5'));var config=require(_0x17c7('0x6'));var controller=require(_0x17c7('0x7'));router[_0x17c7('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x17c7('0x8')](_0x17c7('0x9'),auth[_0x17c7('0xa')](),controller[_0x17c7('0xb')]);router[_0x17c7('0x8')]('/:id',auth[_0x17c7('0xa')](),controller[_0x17c7('0xc')]);router['get'](_0x17c7('0xd'),auth[_0x17c7('0xa')](),controller[_0x17c7('0xe')]);router[_0x17c7('0xf')]('/',auth[_0x17c7('0xa')](),controller['create']);router[_0x17c7('0x10')](_0x17c7('0x11'),auth['isAuthenticated'](),controller[_0x17c7('0x12')]);router[_0x17c7('0x13')](_0x17c7('0x11'),auth[_0x17c7('0xa')](),controller[_0x17c7('0x14')]);module[_0x17c7('0x15')]=router; \ No newline at end of file +var _0x0b7b=['../../config/environment','./jscriptySessionReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/questions','getQuestions','post','create','update','delete','destroy','exports','util','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x50daaa,_0x4a6a9b){var _0x4521a1=function(_0x19c94f){while(--_0x19c94f){_0x50daaa['push'](_0x50daaa['shift']());}};_0x4521a1(++_0x4a6a9b);}(_0x0b7b,0x7a));var _0xb0b7=function(_0x57d475,_0x48f44c){_0x57d475=_0x57d475-0x0;var _0x5b74e1=_0x0b7b[_0x57d475];return _0x5b74e1;};'use strict';var multer=require('multer');var util=require(_0xb0b7('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb0b7('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0xb0b7('0x2'));var interaction=require(_0xb0b7('0x3'));var config=require(_0xb0b7('0x4'));var controller=require(_0xb0b7('0x5'));router[_0xb0b7('0x6')]('/',auth['isAuthenticated'](),controller[_0xb0b7('0x7')]);router['get'](_0xb0b7('0x8'),auth[_0xb0b7('0x9')](),controller[_0xb0b7('0xa')]);router[_0xb0b7('0x6')](_0xb0b7('0xb'),auth[_0xb0b7('0x9')](),controller[_0xb0b7('0xc')]);router[_0xb0b7('0x6')](_0xb0b7('0xd'),auth[_0xb0b7('0x9')](),controller[_0xb0b7('0xe')]);router[_0xb0b7('0xf')]('/',auth[_0xb0b7('0x9')](),controller[_0xb0b7('0x10')]);router['put'](_0xb0b7('0xb'),auth[_0xb0b7('0x9')](),controller[_0xb0b7('0x11')]);router[_0xb0b7('0x12')](_0xb0b7('0xb'),auth[_0xb0b7('0x9')](),controller[_0xb0b7('0x13')]);module[_0xb0b7('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index a05c958..6c74126 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 _0xcb0a=['YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue','starttime','endtime'];(function(_0x5ca31c,_0x362a4c){var _0x1796d2=function(_0x489673){while(--_0x489673){_0x5ca31c['push'](_0x5ca31c['shift']());}};_0x1796d2(++_0x362a4c);}(_0xcb0a,0x1cf));var _0xacb0=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xcb0a[_0x21a9d9];return _0x46adce;};'use strict';var moment=require(_0xacb0('0x0'));var Sequelize=require(_0xacb0('0x1'));module[_0xacb0('0x2')]={'starttime':{'type':Sequelize[_0xacb0('0x3')],'set':function(_0x3d84ba){this[_0xacb0('0x4')](_0xacb0('0x5'),_0x3d84ba);this[_0xacb0('0x4')](_0xacb0('0x6'),moment()['format'](_0xacb0('0x7')));}},'endtime':{'type':Sequelize[_0xacb0('0x3')]},'membername':{'type':Sequelize[_0xacb0('0x8')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xacb0('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0xacb0('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0xd0e8=['BOOLEAN','moment','DATE','setDataValue','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING'];(function(_0x48b4f9,_0xbbe897){var _0x30dda9=function(_0xddc3b6){while(--_0xddc3b6){_0x48b4f9['push'](_0x48b4f9['shift']());}};_0x30dda9(++_0xbbe897);}(_0xd0e8,0xf6));var _0x8d0e=function(_0x5f7eca,_0xe789f2){_0x5f7eca=_0x5f7eca-0x0;var _0x3836e6=_0xd0e8[_0x5f7eca];return _0x3836e6;};'use strict';var moment=require(_0x8d0e('0x0'));var Sequelize=require('sequelize');module['exports']={'starttime':{'type':Sequelize[_0x8d0e('0x1')],'set':function(_0x1deab6){this[_0x8d0e('0x2')]('starttime',_0x1deab6);this[_0x8d0e('0x2')](_0x8d0e('0x3'),moment()['format'](_0x8d0e('0x4')));}},'endtime':{'type':Sequelize[_0x8d0e('0x1')]},'membername':{'type':Sequelize[_0x8d0e('0x5')]},'projectname':{'type':Sequelize[_0x8d0e('0x5')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x8d0e('0x5')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x8d0e('0x5')]},'completed':{'type':Sequelize[_0x8d0e('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index b8ac072..ad570fd 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 _0xe973=['catch','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','save','update','then','destroy','stack','name','send','map','JscriptySessionReport','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body'];(function(_0x2ba6a2,_0x3ff1d4){var _0xc416da=function(_0x21a54a){while(--_0x21a54a){_0x2ba6a2['push'](_0x2ba6a2['shift']());}};_0xc416da(++_0x3ff1d4);}(_0xe973,0x1e0));var _0x3e97=function(_0x41328c,_0x51f21a){_0x41328c=_0x41328c-0x0;var _0x3cedc4=_0xe973[_0x41328c];return _0x3cedc4;};'use strict';var emlformat=require(_0x3e97('0x0'));var rimraf=require(_0x3e97('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3e97('0x2'));var rp=require('request-promise');var moment=require(_0x3e97('0x3'));var BPromise=require(_0x3e97('0x4'));var Mustache=require('mustache');var util=require(_0x3e97('0x5'));var path=require(_0x3e97('0x6'));var sox=require(_0x3e97('0x7'));var csv=require(_0x3e97('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e97('0x9'));var _=require(_0x3e97('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3e97('0xb'));var deskjs=require(_0x3e97('0xc'));var toCsv=require(_0x3e97('0x8'));var querystring=require(_0x3e97('0xd'));var Papa=require(_0x3e97('0xe'));var Redis=require(_0x3e97('0xf'));var authService=require(_0x3e97('0x10'));var qs=require(_0x3e97('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e97('0x12'));var logger=require(_0x3e97('0x13'))(_0x3e97('0x14'));var utils=require(_0x3e97('0x15'));var config=require(_0x3e97('0x16'));var licenseUtil=require(_0x3e97('0x17'));var db=require(_0x3e97('0x18'))['db'];function respondWithStatusCode(_0x24e785,_0x3a7828){_0x3a7828=_0x3a7828||0xcc;return function(_0x296a35){if(_0x296a35){return _0x24e785[_0x3e97('0x19')](_0x3a7828);}return _0x24e785[_0x3e97('0x1a')](_0x3a7828)[_0x3e97('0x1b')]();};}function respondWithResult(_0x4e81a1,_0xf8730c){_0xf8730c=_0xf8730c||0xc8;return function(_0x2ef525){if(_0x2ef525){return _0x4e81a1[_0x3e97('0x1a')](_0xf8730c)[_0x3e97('0x1c')](_0x2ef525);}};}function respondWithFilteredResult(_0x55df06,_0x15e6e0){return function(_0x51db54){if(_0x51db54){var _0x20c0c3=typeof _0x15e6e0[_0x3e97('0x1d')]==='undefined'&&typeof _0x15e6e0[_0x3e97('0x1e')]===_0x3e97('0x1f');var _0x5da37a=_0x51db54[_0x3e97('0x20')];var _0x12ee34=_0x20c0c3?0x0:_0x15e6e0[_0x3e97('0x1d')];var _0x382928=_0x20c0c3?_0x51db54[_0x3e97('0x20')]:_0x15e6e0['offset']+_0x15e6e0[_0x3e97('0x1e')];var _0x5b8c28;if(_0x382928>=_0x5da37a){_0x382928=_0x5da37a;_0x5b8c28=0xc8;}else{_0x5b8c28=0xce;}_0x55df06['status'](_0x5b8c28);return _0x55df06[_0x3e97('0x21')]('Content-Range',_0x12ee34+'-'+_0x382928+'/'+_0x5da37a)['json'](_0x51db54);}return null;};}function patchUpdates(_0x5b1da5){return function(_0x251b7f){try{jsonpatch['apply'](_0x251b7f,_0x5b1da5,!![]);}catch(_0x2eebc2){return BPromise['reject'](_0x2eebc2);}return _0x251b7f[_0x3e97('0x22')]();};}function saveUpdates(_0x90955d,_0x23507b){return function(_0x53584a){if(_0x53584a){return _0x53584a[_0x3e97('0x23')](_0x90955d)[_0x3e97('0x24')](function(_0x526349){return _0x526349;});}return null;};}function removeEntity(_0xc4e809,_0x4a112e){return function(_0x206598){if(_0x206598){return _0x206598[_0x3e97('0x25')]()[_0x3e97('0x24')](function(){_0xc4e809['status'](0xcc)[_0x3e97('0x1b')]();});}};}function handleEntityNotFound(_0x4b8f05,_0x219bdd){return function(_0x1bd4ca){if(!_0x1bd4ca){_0x4b8f05[_0x3e97('0x19')](0x194);}return _0x1bd4ca;};}function handleError(_0x404cf6,_0x2dce9f){_0x2dce9f=_0x2dce9f||0x1f4;return function(_0x46039e){logger['error'](_0x46039e[_0x3e97('0x26')]);if(_0x46039e[_0x3e97('0x27')]){delete _0x46039e[_0x3e97('0x27')];}_0x404cf6[_0x3e97('0x1a')](_0x2dce9f)[_0x3e97('0x28')](_0x46039e);};}exports['index']=function(_0x418243,_0x5a8e34){var _0x5bb71d={},_0x1f326d={},_0x1819eb={'count':0x0,'rows':[]};var _0x5973c4=_[_0x3e97('0x29')](db[_0x3e97('0x2a')][_0x3e97('0x2b')],function(_0x2514d2){return{'name':_0x2514d2['fieldName'],'type':_0x2514d2[_0x3e97('0x2c')][_0x3e97('0x2d')]};});_0x1f326d['model']=_[_0x3e97('0x29')](_0x5973c4,_0x3e97('0x27'));_0x1f326d[_0x3e97('0x2e')]=_[_0x3e97('0x2f')](_0x418243[_0x3e97('0x2e')]);_0x1f326d[_0x3e97('0x30')]=_[_0x3e97('0x31')](_0x1f326d[_0x3e97('0x32')],_0x1f326d['query']);_0x5bb71d[_0x3e97('0x33')]=_[_0x3e97('0x31')](_0x1f326d['model'],qs['fields'](_0x418243['query'][_0x3e97('0x34')]));_0x5bb71d[_0x3e97('0x33')]=_0x5bb71d['attributes'][_0x3e97('0x35')]?_0x5bb71d[_0x3e97('0x33')]:_0x1f326d[_0x3e97('0x32')];if(!_0x418243[_0x3e97('0x2e')][_0x3e97('0x36')](_0x3e97('0x37'))){_0x5bb71d['limit']=qs[_0x3e97('0x1e')](_0x418243[_0x3e97('0x2e')][_0x3e97('0x1e')]);_0x5bb71d[_0x3e97('0x1d')]=qs[_0x3e97('0x1d')](_0x418243[_0x3e97('0x2e')]['offset']);}_0x5bb71d[_0x3e97('0x38')]=qs[_0x3e97('0x39')](_0x418243[_0x3e97('0x2e')][_0x3e97('0x39')]);_0x5bb71d[_0x3e97('0x3a')]=qs[_0x3e97('0x30')](_[_0x3e97('0x3b')](_0x418243['query'],_0x1f326d[_0x3e97('0x30')]),_0x5973c4);if(_0x418243[_0x3e97('0x2e')][_0x3e97('0x3c')]){_0x5bb71d[_0x3e97('0x3a')]=_[_0x3e97('0x3d')](_0x5bb71d[_0x3e97('0x3a')],{'$or':_[_0x3e97('0x29')](_0x5973c4,function(_0x184ad5){if(_0x184ad5[_0x3e97('0x2c')]!==_0x3e97('0x3e')){var _0x4bde36={};_0x4bde36[_0x184ad5['name']]={'$like':'%'+_0x418243[_0x3e97('0x2e')]['filter']+'%'};return _0x4bde36;}})});}_0x5bb71d=_[_0x3e97('0x3d')]({},_0x5bb71d,_0x418243[_0x3e97('0x3f')]);var _0x3eb1a0={'where':_0x5bb71d[_0x3e97('0x3a')]};return db['JscriptySessionReport'][_0x3e97('0x20')](_0x3eb1a0)[_0x3e97('0x24')](function(_0x37b96a){_0x1819eb['count']=_0x37b96a;if(_0x418243[_0x3e97('0x2e')][_0x3e97('0x40')]){_0x5bb71d[_0x3e97('0x41')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x3e97('0x42')](_0x5bb71d);})[_0x3e97('0x24')](function(_0x53a409){_0x1819eb[_0x3e97('0x43')]=_0x53a409;return _0x1819eb;})[_0x3e97('0x24')](respondWithFilteredResult(_0x5a8e34,_0x5bb71d))['catch'](handleError(_0x5a8e34,null));};exports[_0x3e97('0x44')]=function(_0x567985,_0x5148f1){var _0x14236a={'raw':!![],'where':{'id':_0x567985[_0x3e97('0x45')]['id']}},_0x1b7abf={};_0x1b7abf[_0x3e97('0x32')]=_[_0x3e97('0x2f')](db[_0x3e97('0x2a')]['rawAttributes']);_0x1b7abf['query']=_['keys'](_0x567985['query']);_0x1b7abf['filters']=_[_0x3e97('0x31')](_0x1b7abf[_0x3e97('0x32')],_0x1b7abf[_0x3e97('0x2e')]);_0x14236a[_0x3e97('0x33')]=_[_0x3e97('0x31')](_0x1b7abf[_0x3e97('0x32')],qs[_0x3e97('0x34')](_0x567985[_0x3e97('0x2e')]['fields']));_0x14236a['attributes']=_0x14236a[_0x3e97('0x33')][_0x3e97('0x35')]?_0x14236a[_0x3e97('0x33')]:_0x1b7abf[_0x3e97('0x32')];if(_0x567985['query']['includeAll']){_0x14236a[_0x3e97('0x41')]=[{'all':!![]}];}_0x14236a=_[_0x3e97('0x3d')]({},_0x14236a,_0x567985[_0x3e97('0x3f')]);return db[_0x3e97('0x2a')][_0x3e97('0x46')](_0x14236a)[_0x3e97('0x24')](handleEntityNotFound(_0x5148f1,null))[_0x3e97('0x24')](respondWithResult(_0x5148f1,null))['catch'](handleError(_0x5148f1,null));};exports[_0x3e97('0x47')]=function(_0x423f4e,_0x9eda2c){return db['JscriptySessionReport'][_0x3e97('0x47')](_0x423f4e[_0x3e97('0x48')],{})[_0x3e97('0x24')](respondWithResult(_0x9eda2c,0xc9))[_0x3e97('0x49')](handleError(_0x9eda2c,null));};exports['update']=function(_0x3f9bad,_0x2e82d0){if(_0x3f9bad[_0x3e97('0x48')]['id']){delete _0x3f9bad['body']['id'];}return db[_0x3e97('0x2a')][_0x3e97('0x46')]({'where':{'id':_0x3f9bad[_0x3e97('0x45')]['id']}})['then'](handleEntityNotFound(_0x2e82d0,null))[_0x3e97('0x24')](saveUpdates(_0x3f9bad[_0x3e97('0x48')],null))[_0x3e97('0x24')](respondWithResult(_0x2e82d0,null))['catch'](handleError(_0x2e82d0,null));};exports[_0x3e97('0x25')]=function(_0x364ccc,_0xdb801d){return db[_0x3e97('0x2a')][_0x3e97('0x46')]({'where':{'id':_0x364ccc[_0x3e97('0x45')]['id']}})[_0x3e97('0x24')](handleEntityNotFound(_0xdb801d,null))[_0x3e97('0x24')](removeEntity(_0xdb801d,null))[_0x3e97('0x49')](handleError(_0xdb801d,null));};exports['describe']=function(_0x30dfd7,_0x293e33){return db[_0x3e97('0x2a')][_0x3e97('0x4a')]()[_0x3e97('0x24')](respondWithResult(_0x293e33,null))[_0x3e97('0x49')](handleError(_0x293e33,null));};exports[_0x3e97('0x4b')]=function(_0x29609a,_0x54d5fd,_0xf607e7){var _0x2086ce={'raw':!![],'where':{}};var _0x22cf54={};var _0xa7c19c={'count':0x0,'rows':[]};return db[_0x3e97('0x2a')][_0x3e97('0x4c')]({'where':{'id':_0x29609a[_0x3e97('0x45')]['id']}})['then'](handleEntityNotFound(_0x54d5fd,null))[_0x3e97('0x24')](function(_0x36e0f4){if(_0x36e0f4){_0x22cf54[_0x3e97('0x32')]=_[_0x3e97('0x2f')](db[_0x3e97('0x4d')][_0x3e97('0x2b')]);_0x22cf54[_0x3e97('0x2e')]=_[_0x3e97('0x2f')](_0x29609a[_0x3e97('0x2e')]);_0x22cf54[_0x3e97('0x30')]=_[_0x3e97('0x31')](_0x22cf54[_0x3e97('0x32')],_0x22cf54[_0x3e97('0x2e')]);_0x2086ce[_0x3e97('0x33')]=_[_0x3e97('0x31')](_0x22cf54[_0x3e97('0x32')],qs[_0x3e97('0x34')](_0x29609a[_0x3e97('0x2e')][_0x3e97('0x34')]));_0x2086ce[_0x3e97('0x33')]=_0x2086ce[_0x3e97('0x33')][_0x3e97('0x35')]?_0x2086ce[_0x3e97('0x33')]:_0x22cf54[_0x3e97('0x32')];if(!_0x29609a[_0x3e97('0x2e')][_0x3e97('0x36')]('nolimit')){_0x2086ce['limit']=qs[_0x3e97('0x1e')](_0x29609a[_0x3e97('0x2e')][_0x3e97('0x1e')]);_0x2086ce[_0x3e97('0x1d')]=qs['offset'](_0x29609a[_0x3e97('0x2e')]['offset']);}_0x2086ce[_0x3e97('0x38')]=qs[_0x3e97('0x39')](_0x29609a[_0x3e97('0x2e')][_0x3e97('0x39')]);_0x2086ce[_0x3e97('0x3a')]=qs[_0x3e97('0x30')](_[_0x3e97('0x3b')](_0x29609a[_0x3e97('0x2e')],_0x22cf54['filters']));_0x2086ce[_0x3e97('0x3a')][_0x3e97('0x4e')]=_0x36e0f4['id'];if(_0x29609a[_0x3e97('0x2e')][_0x3e97('0x3c')]){_0x2086ce['where']=_[_0x3e97('0x3d')](_0x2086ce[_0x3e97('0x3a')],{'$or':_[_0x3e97('0x29')](_0x2086ce[_0x3e97('0x33')],function(_0x4e5983){var _0x54d3f2={};_0x54d3f2[_0x4e5983]={'$like':'%'+_0x29609a[_0x3e97('0x2e')][_0x3e97('0x3c')]+'%'};return _0x54d3f2;})});}_0x2086ce=_[_0x3e97('0x3d')]({},_0x2086ce,_0x29609a[_0x3e97('0x3f')]);return db[_0x3e97('0x4d')]['count']({'where':_0x2086ce[_0x3e97('0x3a')]})[_0x3e97('0x24')](function(_0x408d50){_0xa7c19c[_0x3e97('0x20')]=_0x408d50;if(_0x29609a[_0x3e97('0x2e')][_0x3e97('0x40')]){_0x2086ce[_0x3e97('0x41')]=[{'all':!![]}];}return db[_0x3e97('0x4d')][_0x3e97('0x42')](_0x2086ce);})[_0x3e97('0x24')](function(_0x51a971){_0xa7c19c[_0x3e97('0x43')]=_0x51a971;return _0xa7c19c;});}})[_0x3e97('0x24')](respondWithFilteredResult(_0x54d5fd,_0x2086ce))[_0x3e97('0x49')](handleError(_0x54d5fd,null));}; \ No newline at end of file +var _0x5321=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','save','then','destroy','end','name','send','index','JscriptySessionReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','order','SessionId','eml-format','zip-dir','fast-json-patch'];(function(_0x526a17,_0x2e3d03){var _0x2ca9c4=function(_0x3c4bf4){while(--_0x3c4bf4){_0x526a17['push'](_0x526a17['shift']());}};_0x2ca9c4(++_0x2e3d03);}(_0x5321,0x12d));var _0x1532=function(_0x145ae3,_0x166a63){_0x145ae3=_0x145ae3-0x0;var _0x4efcb6=_0x5321[_0x145ae3];return _0x4efcb6;};'use strict';var emlformat=require(_0x1532('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1532('0x1'));var jsonpatch=require(_0x1532('0x2'));var rp=require('request-promise');var moment=require(_0x1532('0x3'));var BPromise=require(_0x1532('0x4'));var Mustache=require(_0x1532('0x5'));var util=require(_0x1532('0x6'));var path=require(_0x1532('0x7'));var sox=require(_0x1532('0x8'));var csv=require(_0x1532('0x9'));var ejs=require(_0x1532('0xa'));var fs=require('fs');var fs_extra=require(_0x1532('0xb'));var _=require('lodash');var squel=require(_0x1532('0xc'));var crypto=require(_0x1532('0xd'));var jsforce=require(_0x1532('0xe'));var deskjs=require(_0x1532('0xf'));var toCsv=require(_0x1532('0x9'));var querystring=require(_0x1532('0x10'));var Papa=require('papaparse');var Redis=require(_0x1532('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1532('0x12'));var as=require(_0x1532('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1532('0x14'));var utils=require('../../config/utils');var config=require(_0x1532('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x1532('0x16'))['db'];function respondWithStatusCode(_0x499410,_0x170307){_0x170307=_0x170307||0xcc;return function(_0x4e4afd){if(_0x4e4afd){return _0x499410[_0x1532('0x17')](_0x170307);}return _0x499410[_0x1532('0x18')](_0x170307)['end']();};}function respondWithResult(_0x1a0c99,_0x8688b6){_0x8688b6=_0x8688b6||0xc8;return function(_0x42f677){if(_0x42f677){return _0x1a0c99[_0x1532('0x18')](_0x8688b6)[_0x1532('0x19')](_0x42f677);}};}function respondWithFilteredResult(_0x41d708,_0x5b30bb){return function(_0x1dd250){if(_0x1dd250){var _0x3d4e8c=typeof _0x5b30bb[_0x1532('0x1a')]===_0x1532('0x1b')&&typeof _0x5b30bb[_0x1532('0x1c')]===_0x1532('0x1b');var _0x181c50=_0x1dd250['count'];var _0x1e6263=_0x3d4e8c?0x0:_0x5b30bb[_0x1532('0x1a')];var _0x5a47f7=_0x3d4e8c?_0x1dd250[_0x1532('0x1d')]:_0x5b30bb[_0x1532('0x1a')]+_0x5b30bb[_0x1532('0x1c')];var _0x4e228b;if(_0x5a47f7>=_0x181c50){_0x5a47f7=_0x181c50;_0x4e228b=0xc8;}else{_0x4e228b=0xce;}_0x41d708[_0x1532('0x18')](_0x4e228b);return _0x41d708['set']('Content-Range',_0x1e6263+'-'+_0x5a47f7+'/'+_0x181c50)[_0x1532('0x19')](_0x1dd250);}return null;};}function patchUpdates(_0x4f31ab){return function(_0x2f964a){try{jsonpatch[_0x1532('0x1e')](_0x2f964a,_0x4f31ab,!![]);}catch(_0x42a0b1){return BPromise['reject'](_0x42a0b1);}return _0x2f964a[_0x1532('0x1f')]();};}function saveUpdates(_0x3034b3,_0x576bf6){return function(_0x1d070d){if(_0x1d070d){return _0x1d070d['update'](_0x3034b3)[_0x1532('0x20')](function(_0x11a0d5){return _0x11a0d5;});}return null;};}function removeEntity(_0x4353c8,_0x4ce468){return function(_0x2590c0){if(_0x2590c0){return _0x2590c0[_0x1532('0x21')]()[_0x1532('0x20')](function(){_0x4353c8[_0x1532('0x18')](0xcc)[_0x1532('0x22')]();});}};}function handleEntityNotFound(_0x30263a,_0x448cbf){return function(_0x4d7eca){if(!_0x4d7eca){_0x30263a[_0x1532('0x17')](0x194);}return _0x4d7eca;};}function handleError(_0x2d8d84,_0x56b8be){_0x56b8be=_0x56b8be||0x1f4;return function(_0x194bc3){logger['error'](_0x194bc3['stack']);if(_0x194bc3[_0x1532('0x23')]){delete _0x194bc3[_0x1532('0x23')];}_0x2d8d84[_0x1532('0x18')](_0x56b8be)[_0x1532('0x24')](_0x194bc3);};}exports[_0x1532('0x25')]=function(_0x4564ef,_0x409dda){var _0x5373f4={},_0x2f328c={},_0x157753={'count':0x0,'rows':[]};var _0x28ce81=_['map'](db[_0x1532('0x26')][_0x1532('0x27')],function(_0xf0ed0d){return{'name':_0xf0ed0d[_0x1532('0x28')],'type':_0xf0ed0d[_0x1532('0x29')][_0x1532('0x2a')]};});_0x2f328c[_0x1532('0x2b')]=_[_0x1532('0x2c')](_0x28ce81,_0x1532('0x23'));_0x2f328c[_0x1532('0x2d')]=_[_0x1532('0x2e')](_0x4564ef[_0x1532('0x2d')]);_0x2f328c[_0x1532('0x2f')]=_['intersection'](_0x2f328c['model'],_0x2f328c[_0x1532('0x2d')]);_0x5373f4[_0x1532('0x30')]=_[_0x1532('0x31')](_0x2f328c[_0x1532('0x2b')],qs[_0x1532('0x32')](_0x4564ef['query'][_0x1532('0x32')]));_0x5373f4['attributes']=_0x5373f4[_0x1532('0x30')][_0x1532('0x33')]?_0x5373f4[_0x1532('0x30')]:_0x2f328c['model'];if(!_0x4564ef['query'][_0x1532('0x34')](_0x1532('0x35'))){_0x5373f4[_0x1532('0x1c')]=qs[_0x1532('0x1c')](_0x4564ef[_0x1532('0x2d')][_0x1532('0x1c')]);_0x5373f4['offset']=qs[_0x1532('0x1a')](_0x4564ef[_0x1532('0x2d')][_0x1532('0x1a')]);}_0x5373f4['order']=qs[_0x1532('0x36')](_0x4564ef[_0x1532('0x2d')][_0x1532('0x36')]);_0x5373f4[_0x1532('0x37')]=qs['filters'](_[_0x1532('0x38')](_0x4564ef[_0x1532('0x2d')],_0x2f328c[_0x1532('0x2f')]),_0x28ce81);if(_0x4564ef[_0x1532('0x2d')][_0x1532('0x39')]){_0x5373f4['where']=_[_0x1532('0x3a')](_0x5373f4[_0x1532('0x37')],{'$or':_['map'](_0x28ce81,function(_0x205d1f){if(_0x205d1f[_0x1532('0x29')]!==_0x1532('0x3b')){var _0x40e779={};_0x40e779[_0x205d1f[_0x1532('0x23')]]={'$like':'%'+_0x4564ef[_0x1532('0x2d')][_0x1532('0x39')]+'%'};return _0x40e779;}})});}_0x5373f4=_[_0x1532('0x3a')]({},_0x5373f4,_0x4564ef['options']);var _0x4713e1={'where':_0x5373f4[_0x1532('0x37')]};return db[_0x1532('0x26')][_0x1532('0x1d')](_0x4713e1)['then'](function(_0x4ebf90){_0x157753[_0x1532('0x1d')]=_0x4ebf90;if(_0x4564ef[_0x1532('0x2d')][_0x1532('0x3c')]){_0x5373f4[_0x1532('0x3d')]=[{'all':!![]}];}return db[_0x1532('0x26')][_0x1532('0x3e')](_0x5373f4);})[_0x1532('0x20')](function(_0x77c572){_0x157753[_0x1532('0x3f')]=_0x77c572;return _0x157753;})['then'](respondWithFilteredResult(_0x409dda,_0x5373f4))[_0x1532('0x40')](handleError(_0x409dda,null));};exports['show']=function(_0x2d5465,_0x35de91){var _0x29d13d={'raw':!![],'where':{'id':_0x2d5465[_0x1532('0x41')]['id']}},_0x434fc1={};_0x434fc1[_0x1532('0x2b')]=_[_0x1532('0x2e')](db[_0x1532('0x26')][_0x1532('0x27')]);_0x434fc1[_0x1532('0x2d')]=_[_0x1532('0x2e')](_0x2d5465[_0x1532('0x2d')]);_0x434fc1[_0x1532('0x2f')]=_['intersection'](_0x434fc1['model'],_0x434fc1['query']);_0x29d13d[_0x1532('0x30')]=_[_0x1532('0x31')](_0x434fc1[_0x1532('0x2b')],qs[_0x1532('0x32')](_0x2d5465[_0x1532('0x2d')][_0x1532('0x32')]));_0x29d13d['attributes']=_0x29d13d[_0x1532('0x30')]['length']?_0x29d13d['attributes']:_0x434fc1['model'];if(_0x2d5465[_0x1532('0x2d')][_0x1532('0x3c')]){_0x29d13d[_0x1532('0x3d')]=[{'all':!![]}];}_0x29d13d=_[_0x1532('0x3a')]({},_0x29d13d,_0x2d5465[_0x1532('0x42')]);return db[_0x1532('0x26')][_0x1532('0x43')](_0x29d13d)[_0x1532('0x20')](handleEntityNotFound(_0x35de91,null))['then'](respondWithResult(_0x35de91,null))[_0x1532('0x40')](handleError(_0x35de91,null));};exports[_0x1532('0x44')]=function(_0x25f80a,_0x491be1){return db[_0x1532('0x26')][_0x1532('0x44')](_0x25f80a[_0x1532('0x45')],{})[_0x1532('0x20')](respondWithResult(_0x491be1,0xc9))[_0x1532('0x40')](handleError(_0x491be1,null));};exports['update']=function(_0x159966,_0x434b17){if(_0x159966[_0x1532('0x45')]['id']){delete _0x159966[_0x1532('0x45')]['id'];}return db[_0x1532('0x26')]['find']({'where':{'id':_0x159966[_0x1532('0x41')]['id']}})['then'](handleEntityNotFound(_0x434b17,null))[_0x1532('0x20')](saveUpdates(_0x159966[_0x1532('0x45')],null))['then'](respondWithResult(_0x434b17,null))['catch'](handleError(_0x434b17,null));};exports[_0x1532('0x21')]=function(_0x42ac52,_0x5ec369){return db['JscriptySessionReport'][_0x1532('0x43')]({'where':{'id':_0x42ac52['params']['id']}})['then'](handleEntityNotFound(_0x5ec369,null))[_0x1532('0x20')](removeEntity(_0x5ec369,null))[_0x1532('0x40')](handleError(_0x5ec369,null));};exports[_0x1532('0x46')]=function(_0x585d31,_0x52cc54){return db[_0x1532('0x26')][_0x1532('0x46')]()[_0x1532('0x20')](respondWithResult(_0x52cc54,null))[_0x1532('0x40')](handleError(_0x52cc54,null));};exports[_0x1532('0x47')]=function(_0x3a5359,_0x4d28ce,_0x327d71){var _0x2c0ba9={'raw':!![],'where':{}};var _0x418e19={};var _0x9e4a4b={'count':0x0,'rows':[]};return db[_0x1532('0x26')][_0x1532('0x48')]({'where':{'id':_0x3a5359[_0x1532('0x41')]['id']}})[_0x1532('0x20')](handleEntityNotFound(_0x4d28ce,null))['then'](function(_0x2144e6){if(_0x2144e6){_0x418e19[_0x1532('0x2b')]=_['keys'](db[_0x1532('0x49')][_0x1532('0x27')]);_0x418e19[_0x1532('0x2d')]=_['keys'](_0x3a5359[_0x1532('0x2d')]);_0x418e19['filters']=_['intersection'](_0x418e19[_0x1532('0x2b')],_0x418e19[_0x1532('0x2d')]);_0x2c0ba9[_0x1532('0x30')]=_[_0x1532('0x31')](_0x418e19['model'],qs['fields'](_0x3a5359['query']['fields']));_0x2c0ba9['attributes']=_0x2c0ba9[_0x1532('0x30')]['length']?_0x2c0ba9['attributes']:_0x418e19[_0x1532('0x2b')];if(!_0x3a5359['query']['hasOwnProperty']('nolimit')){_0x2c0ba9[_0x1532('0x1c')]=qs[_0x1532('0x1c')](_0x3a5359['query'][_0x1532('0x1c')]);_0x2c0ba9['offset']=qs[_0x1532('0x1a')](_0x3a5359[_0x1532('0x2d')][_0x1532('0x1a')]);}_0x2c0ba9[_0x1532('0x4a')]=qs['sort'](_0x3a5359[_0x1532('0x2d')][_0x1532('0x36')]);_0x2c0ba9[_0x1532('0x37')]=qs[_0x1532('0x2f')](_[_0x1532('0x38')](_0x3a5359[_0x1532('0x2d')],_0x418e19['filters']));_0x2c0ba9['where'][_0x1532('0x4b')]=_0x2144e6['id'];if(_0x3a5359['query'][_0x1532('0x39')]){_0x2c0ba9['where']=_[_0x1532('0x3a')](_0x2c0ba9[_0x1532('0x37')],{'$or':_[_0x1532('0x2c')](_0x2c0ba9[_0x1532('0x30')],function(_0x5ea2de){var _0x1e06ec={};_0x1e06ec[_0x5ea2de]={'$like':'%'+_0x3a5359[_0x1532('0x2d')][_0x1532('0x39')]+'%'};return _0x1e06ec;})});}_0x2c0ba9=_['merge']({},_0x2c0ba9,_0x3a5359[_0x1532('0x42')]);return db['JscriptyQuestionReport'][_0x1532('0x1d')]({'where':_0x2c0ba9['where']})[_0x1532('0x20')](function(_0x345c8e){_0x9e4a4b[_0x1532('0x1d')]=_0x345c8e;if(_0x3a5359[_0x1532('0x2d')][_0x1532('0x3c')]){_0x2c0ba9[_0x1532('0x3d')]=[{'all':!![]}];}return db[_0x1532('0x49')][_0x1532('0x3e')](_0x2c0ba9);})['then'](function(_0x59972f){_0x9e4a4b[_0x1532('0x3f')]=_0x59972f;return _0x9e4a4b;});}})['then'](respondWithFilteredResult(_0x4d28ce,_0x2c0ba9))[_0x1532('0x40')](handleError(_0x4d28ce,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 7659045..028fa96 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 _0x3f8a=['rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x1e27ea,_0x31b76a){var _0x35f6df=function(_0x3fc481){while(--_0x3fc481){_0x1e27ea['push'](_0x1e27ea['shift']());}};_0x35f6df(++_0x31b76a);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x1ce929,_0x4c0a6e){_0x1ce929=_0x1ce929-0x0;var _0x3506bd=_0x3f8a[_0x1ce929];return _0x3506bd;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var logger=require(_0xa3f8('0x2'))(_0xa3f8('0x3'));var moment=require('moment');var BPromise=require(_0xa3f8('0x4'));var rp=require(_0xa3f8('0x5'));var fs=require('fs');var path=require(_0xa3f8('0x6'));var rimraf=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var attributes=require(_0xa3f8('0x9'));module[_0xa3f8('0xa')]=function(_0x471464,_0x1f160a){return _0x471464[_0xa3f8('0xb')](_0xa3f8('0xc'),attributes,{'tableName':_0xa3f8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c60=['define','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','api','bluebird','./jscriptySessionReport.attributes','exports'];(function(_0x268279,_0x1b15bc){var _0x2b94ba=function(_0x4fa220){while(--_0x4fa220){_0x268279['push'](_0x268279['shift']());}};_0x2b94ba(++_0x1b15bc);}(_0x4c60,0xc1));var _0x04c6=function(_0x3b4f37,_0x5b6ec1){_0x3b4f37=_0x3b4f37-0x0;var _0x257142=_0x4c60[_0x3b4f37];return _0x257142;};'use strict';var _=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var logger=require(_0x04c6('0x2'))(_0x04c6('0x3'));var moment=require('moment');var BPromise=require(_0x04c6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x04c6('0x5'));module[_0x04c6('0x6')]=function(_0x2054da,_0x12bd5d){return _0x2054da[_0x04c6('0x7')](_0x04c6('0x8'),attributes,{'tableName':_0x04c6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index f49a127..75f6e6a 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 _0x2542=['info','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x148f20,_0x2701e6){var _0x5f56ac=function(_0xd9bddc){while(--_0xd9bddc){_0x148f20['push'](_0x148f20['shift']());}};_0x5f56ac(++_0x2701e6);}(_0x2542,0x169));var _0x2254=function(_0x56df16,_0x4a11eb){_0x56df16=_0x56df16-0x0;var _0x54eb68=_0x2542[_0x56df16];return _0x54eb68;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});} \ No newline at end of file +var _0x6a55=['JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','randomstring','../../config/utils','rpc','jayson/promise','client','http','then','info'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x6a55,0xdb));var _0x56a5=function(_0x3fa7d3,_0x37f83c){_0x3fa7d3=_0x3fa7d3-0x0;var _0x4c51bd=_0x6a55[_0x3fa7d3];return _0x4c51bd;};'use strict';var _=require(_0x56a5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x56a5('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x56a5('0x2'));var logger=require('../../config/logger')(_0x56a5('0x3'));var config=require('../../config/environment');var jayson=require(_0x56a5('0x4'));var client=jayson[_0x56a5('0x5')][_0x56a5('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x293ea1,_0x444c65,_0x2272d9){return new BPromise(function(_0x2b8f57,_0x387dcb){return client['request'](_0x293ea1,_0x2272d9)[_0x56a5('0x7')](function(_0xf15490){logger[_0x56a5('0x8')](_0x56a5('0x9'),_0x444c65,_0x56a5('0xa'));logger[_0x56a5('0xb')](_0x56a5('0xc'),_0x444c65,_0x56a5('0xa'),JSON[_0x56a5('0xd')](_0xf15490));if(_0xf15490['error']){if(_0xf15490['error'][_0x56a5('0xe')]===0x1f4){logger[_0x56a5('0xf')](_0x56a5('0x9'),_0x444c65,_0xf15490[_0x56a5('0xf')][_0x56a5('0x10')]);return _0x387dcb(_0xf15490[_0x56a5('0xf')]['message']);}logger['error'](_0x56a5('0x9'),_0x444c65,_0xf15490[_0x56a5('0xf')][_0x56a5('0x10')]);return _0x2b8f57(_0xf15490[_0x56a5('0xf')][_0x56a5('0x10')]);}else{logger[_0x56a5('0x8')](_0x56a5('0x9'),_0x444c65,'request\x20sent');_0x2b8f57(_0xf15490[_0x56a5('0x11')]['message']);}})[_0x56a5('0x12')](function(_0x51d031){logger[_0x56a5('0xf')](_0x56a5('0x9'),_0x444c65,_0x51d031);_0x387dcb(_0x51d031);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index c2414f8..f040130 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 _0x8375=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','put','/:id','update','exports','util','path'];(function(_0x42ca5e,_0x45d149){var _0x273cf2=function(_0x3afeca){while(--_0x3afeca){_0x42ca5e['push'](_0x42ca5e['shift']());}};_0x273cf2(++_0x45d149);}(_0x8375,0x132));var _0x5837=function(_0x35866a,_0x3f3bc1){_0x35866a=_0x35866a-0x0;var _0x5de49a=_0x8375[_0x35866a];return _0x5de49a;};'use strict';var multer=require('multer');var util=require(_0x5837('0x0'));var path=require(_0x5837('0x1'));var timeout=require(_0x5837('0x2'));var express=require(_0x5837('0x3'));var router=express[_0x5837('0x4')]();var fs_extra=require(_0x5837('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5837('0x6'));var config=require(_0x5837('0x7'));var controller=require('./license.controller');router[_0x5837('0x8')]('/',controller[_0x5837('0x9')]);router[_0x5837('0xa')](_0x5837('0xb'),auth['isAuthenticated'](),controller[_0x5837('0xc')]);module[_0x5837('0xd')]=router; \ No newline at end of file +var _0x1670=['multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','put','/:id','isAuthenticated','update','exports'];(function(_0x17e455,_0x21a56b){var _0x4cd511=function(_0x239105){while(--_0x239105){_0x17e455['push'](_0x17e455['shift']());}};_0x4cd511(++_0x21a56b);}(_0x1670,0x9a));var _0x0167=function(_0x1d5691,_0x6042b5){_0x1d5691=_0x1d5691-0x0;var _0x579db8=_0x1670[_0x1d5691];return _0x579db8;};'use strict';var multer=require(_0x0167('0x0'));var util=require(_0x0167('0x1'));var path=require('path');var timeout=require(_0x0167('0x2'));var express=require('express');var router=express[_0x0167('0x3')]();var fs_extra=require(_0x0167('0x4'));var auth=require(_0x0167('0x5'));var interaction=require(_0x0167('0x6'));var config=require('../../config/environment');var controller=require('./license.controller');router[_0x0167('0x7')]('/',controller[_0x0167('0x8')]);router[_0x0167('0x9')](_0x0167('0xa'),auth[_0x0167('0xb')](),controller[_0x0167('0xc')]);module[_0x0167('0xd')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 731448a..38239da 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 _0xc27d=['INTEGER','TEXT','STRING'];(function(_0x2841ce,_0x615087){var _0xd0dc1d=function(_0x13d64b){while(--_0x13d64b){_0x2841ce['push'](_0x2841ce['shift']());}};_0xd0dc1d(++_0x615087);}(_0xc27d,0x160));var _0xdc27=function(_0x525f73,_0x5cf7e6){_0x525f73=_0x525f73-0x0;var _0xbc7f27=_0xc27d[_0x525f73];return _0xbc7f27;};'use strict';var Sequelize=require('sequelize');module['exports']={'license':{'type':Sequelize[_0xdc27('0x0')]},'data1':{'type':Sequelize[_0xdc27('0x1')]},'data2':{'type':Sequelize[_0xdc27('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0xdc27('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xab8b=['INTEGER','sequelize','exports','TEXT','STRING'];(function(_0x2e5260,_0x452a43){var _0x48dee2=function(_0x7996d2){while(--_0x7996d2){_0x2e5260['push'](_0x2e5260['shift']());}};_0x48dee2(++_0x452a43);}(_0xab8b,0xb0));var _0xbab8=function(_0x352575,_0x218823){_0x352575=_0x352575-0x0;var _0x10e02d=_0xab8b[_0x352575];return _0x10e02d;};'use strict';var Sequelize=require(_0xbab8('0x0'));module[_0xbab8('0x1')]={'license':{'type':Sequelize[_0xbab8('0x2')]},'data1':{'type':Sequelize[_0xbab8('0x3')]},'data2':{'type':Sequelize[_0xbab8('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xbab8('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 66bd8fe..7b1b39d 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 _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(_0x31d509,_0x453f80){var _0x267d88=function(_0x59d8a5){while(--_0x59d8a5){_0x31d509['push'](_0x31d509['shift']());}};_0x267d88(++_0x453f80);}(_0x1261,0x144));var _0x1126=function(_0x2b9ac8,_0xf820cb){_0x2b9ac8=_0x2b9ac8-0x0;var _0x3ceea9=_0x1261[_0x2b9ac8];return _0x3ceea9;};'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 +var _0xabce=['status','end','json','limit','count','offset','Content-Range','apply','reject','save','update','then','sendStatus','error','name','send','model','keys','License','rawAttributes','query','intersection','attributes','fields','merge','getLicense','catch','find','get','body','demo','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x1f6637,_0x1bc94f){var _0x135e84=function(_0x399f6d){while(--_0x399f6d){_0x1f6637['push'](_0x1f6637['shift']());}};_0x135e84(++_0x1bc94f);}(_0xabce,0x103));var _0xeabc=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xabce[_0x5b561d];return _0x431060;};'use strict';var emlformat=require(_0xeabc('0x0'));var rimraf=require(_0xeabc('0x1'));var zipdir=require(_0xeabc('0x2'));var jsonpatch=require(_0xeabc('0x3'));var rp=require(_0xeabc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeabc('0x5'));var util=require(_0xeabc('0x6'));var path=require(_0xeabc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeabc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];function respondWithStatusCode(_0x3fd0b5,_0x36a92e){_0x36a92e=_0x36a92e||0xcc;return function(_0xcfbf06){if(_0xcfbf06){return _0x3fd0b5['sendStatus'](_0x36a92e);}return _0x3fd0b5[_0xeabc('0x1a')](_0x36a92e)[_0xeabc('0x1b')]();};}function respondWithResult(_0x3251c6,_0x55f0de){_0x55f0de=_0x55f0de||0xc8;return function(_0x5f4ee8){if(_0x5f4ee8){return _0x3251c6[_0xeabc('0x1a')](_0x55f0de)[_0xeabc('0x1c')](_0x5f4ee8);}};}function respondWithFilteredResult(_0x326bac,_0x53d5cb){return function(_0xf913d7){if(_0xf913d7){var _0x638976=typeof _0x53d5cb['offset']==='undefined'&&typeof _0x53d5cb[_0xeabc('0x1d')]==='undefined';var _0x3d0e21=_0xf913d7[_0xeabc('0x1e')];var _0x58a3c0=_0x638976?0x0:_0x53d5cb[_0xeabc('0x1f')];var _0x31dd53=_0x638976?_0xf913d7[_0xeabc('0x1e')]:_0x53d5cb[_0xeabc('0x1f')]+_0x53d5cb[_0xeabc('0x1d')];var _0x5d92e5;if(_0x31dd53>=_0x3d0e21){_0x31dd53=_0x3d0e21;_0x5d92e5=0xc8;}else{_0x5d92e5=0xce;}_0x326bac[_0xeabc('0x1a')](_0x5d92e5);return _0x326bac['set'](_0xeabc('0x20'),_0x58a3c0+'-'+_0x31dd53+'/'+_0x3d0e21)[_0xeabc('0x1c')](_0xf913d7);}return null;};}function patchUpdates(_0x502947){return function(_0x28063a){try{jsonpatch[_0xeabc('0x21')](_0x28063a,_0x502947,!![]);}catch(_0x254590){return BPromise[_0xeabc('0x22')](_0x254590);}return _0x28063a[_0xeabc('0x23')]();};}function saveUpdates(_0x4e99a4,_0xecdbf){return function(_0x10c675){if(_0x10c675){return _0x10c675[_0xeabc('0x24')](_0x4e99a4)['then'](function(_0x457f27){return _0x457f27;});}return null;};}function removeEntity(_0x3854d2,_0x214953){return function(_0x319119){if(_0x319119){return _0x319119['destroy']()[_0xeabc('0x25')](function(){_0x3854d2['status'](0xcc)[_0xeabc('0x1b')]();});}};}function handleEntityNotFound(_0x4d4e29,_0x811f0d){return function(_0x12acbd){if(!_0x12acbd){_0x4d4e29[_0xeabc('0x26')](0x194);}return _0x12acbd;};}function handleError(_0x3f194e,_0x3a1a04){_0x3a1a04=_0x3a1a04||0x1f4;return function(_0x137293){logger[_0xeabc('0x27')](_0x137293['stack']);if(_0x137293['name']){delete _0x137293[_0xeabc('0x28')];}_0x3f194e['status'](_0x3a1a04)[_0xeabc('0x29')](_0x137293);};}var utilLicense=require(_0xeabc('0x18'));exports['index']=function(_0x2163e6,_0x38572d){var _0x2b568f={'raw':!![],'where':{'id':0x1}},_0x2f8633={};_0x2f8633[_0xeabc('0x2a')]=_[_0xeabc('0x2b')](db[_0xeabc('0x2c')][_0xeabc('0x2d')]);_0x2f8633[_0xeabc('0x2e')]=_['keys'](_0x2163e6[_0xeabc('0x2e')]);_0x2f8633['filters']=_[_0xeabc('0x2f')](_0x2f8633[_0xeabc('0x2a')],_0x2f8633[_0xeabc('0x2e')]);_0x2b568f[_0xeabc('0x30')]=_[_0xeabc('0x2f')](_0x2f8633[_0xeabc('0x2a')],qs[_0xeabc('0x31')](_0x2163e6['query'][_0xeabc('0x31')]));_0x2b568f[_0xeabc('0x30')]=_0x2b568f[_0xeabc('0x30')]['length']?_0x2b568f[_0xeabc('0x30')]:_0x2f8633[_0xeabc('0x2a')];_0x2b568f=_[_0xeabc('0x32')]({},_0x2b568f,_0x2163e6['options']);return utilLicense[_0xeabc('0x33')](_0x2b568f)[_0xeabc('0x25')](respondWithResult(_0x38572d,null))[_0xeabc('0x34')](handleError(_0x38572d,null));};exports['update']=function(_0xf98c7c,_0x286203){if(_0xf98c7c['body']['id']){delete _0xf98c7c['body']['id'];}return db[_0xeabc('0x2c')][_0xeabc('0x35')]({'where':{'id':_0xf98c7c['params']['id']}})[_0xeabc('0x25')](handleEntityNotFound(_0x286203,null))[_0xeabc('0x25')](function(_0x3edee7){var _0x10434e=_0x3edee7[_0xeabc('0x36')]({'plain':!![]});return utilLicense['checkLicense'](_0x10434e,_0xf98c7c[_0xeabc('0x37')]['key']);})[_0xeabc('0x25')](function(_0x2bda29){if(!_0x2bda29[_0xeabc('0x38')]){return saveUpdates(_0xf98c7c['body'],null);}return _0x2bda29;})['then'](respondWithResult(_0x286203,null))[_0xeabc('0x34')](handleError(_0x286203,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 69d2744..f36fa74 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 _0xaeaa=['path','rimraf','../../config/environment','./license.attributes','exports','define','License','util','../../config/logger','api','moment','bluebird'];(function(_0x20ba7c,_0x30c3b8){var _0x32a3f9=function(_0x5539ef){while(--_0x5539ef){_0x20ba7c['push'](_0x20ba7c['shift']());}};_0x32a3f9(++_0x30c3b8);}(_0xaeaa,0xdf));var _0xaaea=function(_0x3c74c7,_0x3517f3){_0x3c74c7=_0x3c74c7-0x0;var _0x17912a=_0xaeaa[_0x3c74c7];return _0x17912a;};'use strict';var _=require('lodash');var util=require(_0xaaea('0x0'));var logger=require(_0xaaea('0x1'))(_0xaaea('0x2'));var moment=require(_0xaaea('0x3'));var BPromise=require(_0xaaea('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaaea('0x5'));var rimraf=require(_0xaaea('0x6'));var config=require(_0xaaea('0x7'));var attributes=require(_0xaaea('0x8'));module[_0xaaea('0x9')]=function(_0x5a8c1f,_0x53f274){return _0x5a8c1f[_0xaaea('0xa')](_0xaaea('0xb'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf600=['util','../../config/logger','bluebird','request-promise','path','../../config/environment','./license.attributes','exports','define','license','lodash'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf600,0x175));var _0x0f60=function(_0x72a79c,_0xab9eed){_0x72a79c=_0x72a79c-0x0;var _0x11c8fd=_0xf600[_0x72a79c];return _0x11c8fd;};'use strict';var _=require(_0x0f60('0x0'));var util=require(_0x0f60('0x1'));var logger=require(_0x0f60('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0f60('0x3'));var rp=require(_0x0f60('0x4'));var fs=require('fs');var path=require(_0x0f60('0x5'));var rimraf=require('rimraf');var config=require(_0x0f60('0x6'));var attributes=require(_0x0f60('0x7'));module[_0x0f60('0x8')]=function(_0x5afb63,_0x476dd6){return _0x5afb63[_0x0f60('0x9')]('License',attributes,{'tableName':_0x0f60('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index c402867..cf6d054 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 _0x92d9=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x92d9,0xf7));var _0x992d=function(_0x38a913,_0x4270e6){_0x38a913=_0x38a913-0x0;var _0x120cc8=_0x92d9[_0x38a913];return _0x120cc8;};'use strict';var _=require(_0x992d('0x0'));var util=require(_0x992d('0x1'));var moment=require(_0x992d('0x2'));var BPromise=require(_0x992d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x992d('0x4'));var db=require(_0x992d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x992d('0x6'))(_0x992d('0x7'));var config=require(_0x992d('0x8'));var jayson=require(_0x992d('0x9'));var client=jayson['client'][_0x992d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e5f73,_0x11dc97,_0x244ab3){return new BPromise(function(_0xd822a8,_0x365472){return client[_0x992d('0xb')](_0x3e5f73,_0x244ab3)[_0x992d('0xc')](function(_0x21a742){logger['info'](_0x992d('0xd'),_0x11dc97,_0x992d('0xe'));logger['debug'](_0x992d('0xf'),_0x11dc97,_0x992d('0xe'),JSON[_0x992d('0x10')](_0x21a742));if(_0x21a742[_0x992d('0x11')]){if(_0x21a742['error'][_0x992d('0x12')]===0x1f4){logger[_0x992d('0x11')](_0x992d('0xd'),_0x11dc97,_0x21a742[_0x992d('0x11')][_0x992d('0x13')]);return _0x365472(_0x21a742['error'][_0x992d('0x13')]);}logger[_0x992d('0x11')](_0x992d('0xd'),_0x11dc97,_0x21a742[_0x992d('0x11')][_0x992d('0x13')]);return _0xd822a8(_0x21a742[_0x992d('0x11')][_0x992d('0x13')]);}else{logger[_0x992d('0x14')](_0x992d('0xd'),_0x11dc97,'request\x20sent');_0xd822a8(_0x21a742[_0x992d('0x15')]['message']);}})[_0x992d('0x16')](function(_0x105ccd){logger[_0x992d('0x11')]('License,\x20%s,\x20%s',_0x11dc97,_0x105ccd);_0x365472(_0x105ccd);});});} \ No newline at end of file +var _0xa050=['error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x458b0,_0x15f01d){var _0x294e1f=function(_0x39b297){while(--_0x39b297){_0x458b0['push'](_0x458b0['shift']());}};_0x294e1f(++_0x15f01d);}(_0xa050,0x18a));var _0x0a05=function(_0x305e82,_0x26322e){_0x305e82=_0x305e82-0x0;var _0x5488d4=_0xa050[_0x305e82];return _0x5488d4;};'use strict';var _=require(_0x0a05('0x0'));var util=require(_0x0a05('0x1'));var moment=require('moment');var BPromise=require(_0x0a05('0x2'));var rs=require(_0x0a05('0x3'));var fs=require('fs');var Redis=require(_0x0a05('0x4'));var db=require(_0x0a05('0x5'))['db'];var utils=require(_0x0a05('0x6'));var logger=require(_0x0a05('0x7'))(_0x0a05('0x8'));var config=require(_0x0a05('0x9'));var jayson=require(_0x0a05('0xa'));var client=jayson[_0x0a05('0xb')][_0x0a05('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x10ea89,_0x634e8,_0x59231d){return new BPromise(function(_0x22d8ea,_0x211eb8){return client['request'](_0x10ea89,_0x59231d)[_0x0a05('0xd')](function(_0x4bb4e9){logger[_0x0a05('0xe')](_0x0a05('0xf'),_0x634e8,_0x0a05('0x10'));logger[_0x0a05('0x11')](_0x0a05('0x12'),_0x634e8,_0x0a05('0x10'),JSON[_0x0a05('0x13')](_0x4bb4e9));if(_0x4bb4e9[_0x0a05('0x14')]){if(_0x4bb4e9[_0x0a05('0x14')]['code']===0x1f4){logger[_0x0a05('0x14')](_0x0a05('0xf'),_0x634e8,_0x4bb4e9[_0x0a05('0x14')][_0x0a05('0x15')]);return _0x211eb8(_0x4bb4e9[_0x0a05('0x14')][_0x0a05('0x15')]);}logger[_0x0a05('0x14')]('License,\x20%s,\x20%s',_0x634e8,_0x4bb4e9[_0x0a05('0x14')][_0x0a05('0x15')]);return _0x22d8ea(_0x4bb4e9['error'][_0x0a05('0x15')]);}else{logger[_0x0a05('0xe')](_0x0a05('0xf'),_0x634e8,_0x0a05('0x10'));_0x22d8ea(_0x4bb4e9['result'][_0x0a05('0x15')]);}})[_0x0a05('0x16')](function(_0x3b81ab){logger[_0x0a05('0x14')](_0x0a05('0xf'),_0x634e8,_0x3b81ab);_0x211eb8(_0x3b81ab);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index cd3cbf4..d15683f 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 _0x0769=['removeAnswers','removeImap','removeSmtp','/:id/users','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/verify','getAgents','post','addDisposition','addAnswer','create','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete'];(function(_0x1bad01,_0x415f3){var _0x284928=function(_0xa39caa){while(--_0xa39caa){_0x1bad01['push'](_0x1bad01['shift']());}};_0x284928(++_0x415f3);}(_0x0769,0x118));var _0x9076=function(_0xcf581b,_0x4359dd){_0xcf581b=_0xcf581b-0x0;var _0x4f454d=_0x0769[_0xcf581b];return _0x4f454d;};'use strict';var multer=require(_0x9076('0x0'));var util=require(_0x9076('0x1'));var path=require(_0x9076('0x2'));var timeout=require('connect-timeout');var express=require(_0x9076('0x3'));var router=express['Router']();var fs_extra=require(_0x9076('0x4'));var auth=require(_0x9076('0x5'));var interaction=require(_0x9076('0x6'));var config=require(_0x9076('0x7'));var controller=require(_0x9076('0x8'));router[_0x9076('0x9')]('/',auth[_0x9076('0xa')](),controller[_0x9076('0xb')]);router[_0x9076('0x9')](_0x9076('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x9076('0x9')](_0x9076('0xd'),auth['isAuthenticated'](),controller[_0x9076('0xe')]);router['get'](_0x9076('0xf'),auth['isAuthenticated'](),controller[_0x9076('0x10')]);router['get'](_0x9076('0x11'),auth['isAuthenticated'](),controller[_0x9076('0x12')]);router[_0x9076('0x9')](_0x9076('0x13'),auth['isAuthenticated'](),controller['getImap']);router['get'](_0x9076('0x14'),auth[_0x9076('0xa')](),controller[_0x9076('0x15')]);router[_0x9076('0x9')](_0x9076('0x16'),auth['isAuthenticated'](),controller[_0x9076('0x17')]);router[_0x9076('0x9')](_0x9076('0x18'),auth['isAuthenticated'](),controller[_0x9076('0x19')]);router['get'](_0x9076('0x1a'),auth[_0x9076('0xa')](),controller['getMessages']);router[_0x9076('0x9')](_0x9076('0x1b'),auth['isAuthenticated'](),controller['verifySmtp']);router[_0x9076('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0x9076('0x1c')]);router[_0x9076('0x1d')]('/:id/dispositions',auth[_0x9076('0xa')](),controller[_0x9076('0x1e')]);router['post'](_0x9076('0x11'),auth[_0x9076('0xa')](),controller[_0x9076('0x1f')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9076('0x20')]);router['post']('/:id/in_servers',auth[_0x9076('0xa')](),controller['addImap']);router['post'](_0x9076('0x14'),auth[_0x9076('0xa')](),controller[_0x9076('0x21')]);router[_0x9076('0x1d')](_0x9076('0x16'),auth['isAuthenticated'](),controller[_0x9076('0x22')]);router['post']('/:id/applications',auth[_0x9076('0xa')](),controller[_0x9076('0x23')]);router[_0x9076('0x1d')](_0x9076('0x24'),auth[_0x9076('0xa')](),controller[_0x9076('0x25')]);router[_0x9076('0x1d')]('/:id/users',auth[_0x9076('0xa')](),controller[_0x9076('0x26')]);router[_0x9076('0x27')](_0x9076('0xd'),auth[_0x9076('0xa')](),controller[_0x9076('0x28')]);router[_0x9076('0x29')](_0x9076('0xf'),auth[_0x9076('0xa')](),controller['removeDispositions']);router[_0x9076('0x29')](_0x9076('0x11'),auth[_0x9076('0xa')](),controller[_0x9076('0x2a')]);router[_0x9076('0x29')](_0x9076('0x13'),auth['isAuthenticated'](),controller[_0x9076('0x2b')]);router[_0x9076('0x29')](_0x9076('0x14'),auth['isAuthenticated'](),controller[_0x9076('0x2c')]);router[_0x9076('0x29')]('/:id',auth[_0x9076('0xa')](),controller['destroy']);router[_0x9076('0x29')](_0x9076('0x2d'),auth[_0x9076('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x99da=['removeSmtp','destroy','removeAgents','exports','util','path','express','Router','../../config/environment','./mailAccount.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','/:id/canned_answers','addAnswer','create','addImap','/:id/out_servers','addSmtp','addInteraction','/:id/send','addAgents','put','delete','removeDispositions','removeAnswers','removeImap'];(function(_0x54a216,_0x531662){var _0x346a84=function(_0x54f2a6){while(--_0x54f2a6){_0x54a216['push'](_0x54a216['shift']());}};_0x346a84(++_0x531662);}(_0x99da,0x16c));var _0xa99d=function(_0x22c393,_0x1f2389){_0x22c393=_0x22c393-0x0;var _0x161580=_0x99da[_0x22c393];return _0x161580;};'use strict';var multer=require('multer');var util=require(_0xa99d('0x0'));var path=require(_0xa99d('0x1'));var timeout=require('connect-timeout');var express=require(_0xa99d('0x2'));var router=express[_0xa99d('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa99d('0x4'));var controller=require(_0xa99d('0x5'));router['get']('/',auth[_0xa99d('0x6')](),controller[_0xa99d('0x7')]);router[_0xa99d('0x8')](_0xa99d('0x9'),auth['isAuthenticated'](),controller[_0xa99d('0xa')]);router['get'](_0xa99d('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xa99d('0x8')](_0xa99d('0xc'),auth[_0xa99d('0x6')](),controller[_0xa99d('0xd')]);router[_0xa99d('0x8')]('/:id/canned_answers',auth[_0xa99d('0x6')](),controller[_0xa99d('0xe')]);router['get'](_0xa99d('0xf'),auth[_0xa99d('0x6')](),controller['getImap']);router[_0xa99d('0x8')]('/:id/out_servers',auth[_0xa99d('0x6')](),controller['getSmtp']);router['get'](_0xa99d('0x10'),auth[_0xa99d('0x6')](),controller[_0xa99d('0x11')]);router['get'](_0xa99d('0x12'),auth[_0xa99d('0x6')](),controller[_0xa99d('0x13')]);router[_0xa99d('0x8')](_0xa99d('0x14'),auth[_0xa99d('0x6')](),controller[_0xa99d('0x15')]);router[_0xa99d('0x8')](_0xa99d('0x16'),auth[_0xa99d('0x6')](),controller[_0xa99d('0x17')]);router[_0xa99d('0x8')](_0xa99d('0x18'),auth[_0xa99d('0x6')](),controller[_0xa99d('0x19')]);router[_0xa99d('0x1a')](_0xa99d('0xc'),auth[_0xa99d('0x6')](),controller['addDisposition']);router['post'](_0xa99d('0x1b'),auth[_0xa99d('0x6')](),controller[_0xa99d('0x1c')]);router[_0xa99d('0x1a')]('/',auth[_0xa99d('0x6')](),controller[_0xa99d('0x1d')]);router['post']('/:id/in_servers',auth[_0xa99d('0x6')](),controller[_0xa99d('0x1e')]);router[_0xa99d('0x1a')](_0xa99d('0x1f'),auth[_0xa99d('0x6')](),controller[_0xa99d('0x20')]);router[_0xa99d('0x1a')](_0xa99d('0x10'),auth[_0xa99d('0x6')](),controller[_0xa99d('0x21')]);router[_0xa99d('0x1a')]('/:id/applications',auth[_0xa99d('0x6')](),controller['addApplications']);router['post'](_0xa99d('0x22'),auth['isAuthenticated'](),controller['send']);router[_0xa99d('0x1a')](_0xa99d('0x18'),auth['isAuthenticated'](),controller[_0xa99d('0x23')]);router[_0xa99d('0x24')]('/:id',auth[_0xa99d('0x6')](),controller['update']);router[_0xa99d('0x25')](_0xa99d('0xc'),auth['isAuthenticated'](),controller[_0xa99d('0x26')]);router[_0xa99d('0x25')](_0xa99d('0x1b'),auth[_0xa99d('0x6')](),controller[_0xa99d('0x27')]);router['delete'](_0xa99d('0xf'),auth[_0xa99d('0x6')](),controller[_0xa99d('0x28')]);router[_0xa99d('0x25')]('/:id/out_servers',auth[_0xa99d('0x6')](),controller[_0xa99d('0x29')]);router[_0xa99d('0x25')](_0xa99d('0xb'),auth[_0xa99d('0x6')](),controller[_0xa99d('0x2a')]);router[_0xa99d('0x25')](_0xa99d('0x18'),auth['isAuthenticated'](),controller[_0xa99d('0x2b')]);module[_0xa99d('0x2c')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 853651a..cf164a0 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 _0x55ca=['Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','TEXT'];(function(_0x11e30d,_0x5584aa){var _0x2d4e29=function(_0x2486ce){while(--_0x2486ce){_0x11e30d['push'](_0x11e30d['shift']());}};_0x2d4e29(++_0x5584aa);}(_0x55ca,0x126));var _0xa55c=function(_0x21a0c5,_0x586032){_0x21a0c5=_0x21a0c5-0x0;var _0x13d439=_0x55ca[_0x21a0c5];return _0x13d439;};'use strict';var Sequelize=require(_0xa55c('0x0'));module[_0xa55c('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xa55c('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xa55c('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0xa55c('0x4')]},'markAsUnread':{'type':Sequelize[_0xa55c('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xa55c('0x2')],'allowNull':![],'defaultValue':_0xa55c('0x5')},'fontSize':{'type':Sequelize[_0xa55c('0x6')](0x2)[_0xa55c('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xa55c('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0xa55c('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa55c('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa55c('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa55c('0x6')],'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[_0xa55c('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xa55c('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xa55c('0x3')],'defaultValue':![],'comment':_0xa55c('0x9'),'set':function(_0x31646d){if(!_0x31646d)this[_0xa55c('0xa')](_0xa55c('0xb'),null);this[_0xa55c('0xa')](_0xa55c('0xc'),_0x31646d);}}}; \ No newline at end of file +var _0x4c4e=['setDataValue','mandatoryDisposition','sequelize','STRING','BOOLEAN','TEXT','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','mandatoryDispositionPauseId'];(function(_0x41d902,_0x29d0b){var _0x360fb1=function(_0x2517ae){while(--_0x2517ae){_0x41d902['push'](_0x41d902['shift']());}};_0x360fb1(++_0x29d0b);}(_0x4c4e,0x152));var _0xe4c4=function(_0x243f37,_0x40d523){_0x243f37=_0x243f37-0x0;var _0x3fbb9d=_0x4c4e[_0x243f37];return _0x3fbb9d;};'use strict';var Sequelize=require(_0xe4c4('0x0'));module['exports']={'description':{'type':Sequelize[_0xe4c4('0x1')]},'name':{'type':Sequelize[_0xe4c4('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0xe4c4('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xe4c4('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xe4c4('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0xe4c4('0x3')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xe4c4('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xe4c4('0x4')](0x2)[_0xe4c4('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xe4c4('0x3')],'defaultValue':function(){return _0xe4c4('0x6');}},'notificationSound':{'type':Sequelize[_0xe4c4('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe4c4('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe4c4('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe4c4('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe4c4('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe4c4('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0xe4c4('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xe4c4('0x2')],'defaultValue':![],'comment':_0xe4c4('0x8'),'set':function(_0x2f4d5f){if(!_0x2f4d5f)this['setDataValue'](_0xe4c4('0x9'),null);this[_0xe4c4('0xa')](_0xe4c4('0xb'),_0x2f4d5f);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index c1bc34a..ddce8a7 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 _0x0269=['order','where','type','filter','merge','MailAccount','include','rows','show','Smtp','Pause','intersection','length','includeAll','options','find','body','params','describe','MailAccountId','getDispositions','findOne','rawAttributes','sort','pick','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findAll','removeAnswers','create','ListId','isNil','active','cservice','cauthentication','user','cuser','pass','cpassword','authentication','host','port','service','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','Tag','Tags','tag','sequelize','transaction','Transaction','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','true','split','List','Contacts','updatedAt','email','attachments','join','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','messageId','from','attach','out','Interaction','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','destroy','get','MailAccounts','UserProfileResource','stack','name','send','index','MailServerIn','Imap','MailServerOut','mandatoryDispositionPause','fieldName','key','model','map','query','keys','filters','fields','attributes','hasOwnProperty','nolimit'];(function(_0x212bc0,_0x68928d){var _0x4b8360=function(_0x45b477){while(--_0x45b477){_0x212bc0['push'](_0x212bc0['shift']());}};_0x4b8360(++_0x68928d);}(_0x0269,0x135));var _0x9026=function(_0x544176,_0x4e6ccd){_0x544176=_0x544176-0x0;var _0x47ae6e=_0x0269[_0x544176];return _0x47ae6e;};'use strict';var emlformat=require(_0x9026('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9026('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9026('0x2'));var moment=require('moment');var BPromise=require(_0x9026('0x3'));var Mustache=require(_0x9026('0x4'));var util=require(_0x9026('0x5'));var path=require(_0x9026('0x6'));var sox=require('sox');var csv=require(_0x9026('0x7'));var ejs=require(_0x9026('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9026('0x9'));var crypto=require(_0x9026('0xa'));var jsforce=require(_0x9026('0xb'));var deskjs=require(_0x9026('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9026('0xd'));var Papa=require(_0x9026('0xe'));var htmlToText=require(_0x9026('0xf'));var juice=require('juice');var Redis=require(_0x9026('0x10'));var authService=require(_0x9026('0x11'));var qs=require(_0x9026('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9026('0x13'));var logger=require('../../config/logger')(_0x9026('0x14'));var utils=require(_0x9026('0x15'));var config=require(_0x9026('0x16'));var licenseUtil=require(_0x9026('0x17'));var db=require(_0x9026('0x18'))['db'];config[_0x9026('0x19')]=_[_0x9026('0x1a')](config['redis'],{'host':_0x9026('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9026('0x19')]));require(_0x9026('0x1c'))[_0x9026('0x1d')](socket);var jayson=require(_0x9026('0x1e'));var client=jayson[_0x9026('0x1f')][_0x9026('0x20')]({'port':0x232b});function respondWithRpcPromise(_0x142465,_0x1eb679,_0x5d5053,_0x401438){return new BPromise(function(_0x2b9834,_0x50328c){var _0xc68011=_0x401438||client;return _0xc68011[_0x9026('0x21')](_0x142465,_0x5d5053)[_0x9026('0x22')](function(_0x4e37d0){logger[_0x9026('0x23')](_0x9026('0x24'),_0x1eb679,_0x9026('0x25'));logger[_0x9026('0x26')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x1eb679,_0x9026('0x25'),JSON['stringify'](_0x4e37d0));if(_0x4e37d0[_0x9026('0x27')]){if(_0x4e37d0['error'][_0x9026('0x28')]===0x1f4){logger[_0x9026('0x27')](_0x9026('0x24'),_0x1eb679,_0x4e37d0[_0x9026('0x27')][_0x9026('0x29')]);return _0x50328c(_0x4e37d0[_0x9026('0x27')][_0x9026('0x29')]);}logger[_0x9026('0x27')](_0x9026('0x24'),_0x1eb679,_0x4e37d0['error']['message']);return _0x2b9834(_0x4e37d0[_0x9026('0x27')][_0x9026('0x29')]);}else{logger[_0x9026('0x23')](_0x9026('0x24'),_0x1eb679,_0x9026('0x25'));_0x2b9834(_0x4e37d0[_0x9026('0x2a')][_0x9026('0x29')]);}})[_0x9026('0x2b')](function(_0x775596){logger[_0x9026('0x27')](_0x9026('0x24'),_0x1eb679,_0x775596);_0x50328c(_0x775596);});});}function respondWithStatusCode(_0x106de3,_0x38fd9c){_0x38fd9c=_0x38fd9c||0xcc;return function(_0x2ace13){if(_0x2ace13){return _0x106de3[_0x9026('0x2c')](_0x38fd9c);}return _0x106de3[_0x9026('0x2d')](_0x38fd9c)[_0x9026('0x2e')]();};}function respondWithResult(_0x9c5f39,_0x2fae98){_0x2fae98=_0x2fae98||0xc8;return function(_0x5d2b12){if(_0x5d2b12){return _0x9c5f39[_0x9026('0x2d')](_0x2fae98)[_0x9026('0x2f')](_0x5d2b12);}};}function respondWithFilteredResult(_0x30c988,_0x103ce7){return function(_0x17dc25){if(_0x17dc25){var _0x3cead8=typeof _0x103ce7[_0x9026('0x30')]===_0x9026('0x31')&&typeof _0x103ce7[_0x9026('0x32')]===_0x9026('0x31');var _0x24fa55=_0x17dc25['count'];var _0x1cf21f=_0x3cead8?0x0:_0x103ce7[_0x9026('0x30')];var _0x3b5bfd=_0x3cead8?_0x17dc25[_0x9026('0x33')]:_0x103ce7[_0x9026('0x30')]+_0x103ce7[_0x9026('0x32')];var _0x275f2a;if(_0x3b5bfd>=_0x24fa55){_0x3b5bfd=_0x24fa55;_0x275f2a=0xc8;}else{_0x275f2a=0xce;}_0x30c988['status'](_0x275f2a);return _0x30c988[_0x9026('0x34')]('Content-Range',_0x1cf21f+'-'+_0x3b5bfd+'/'+_0x24fa55)[_0x9026('0x2f')](_0x17dc25);}return null;};}function patchUpdates(_0x473d93){return function(_0x1b26ae){try{jsonpatch[_0x9026('0x35')](_0x1b26ae,_0x473d93,!![]);}catch(_0x1f48bb){return BPromise[_0x9026('0x36')](_0x1f48bb);}return _0x1b26ae['save']();};}function saveUpdates(_0x3ecaa4,_0x4167fd){return function(_0x1c608a){if(_0x1c608a){return _0x1c608a[_0x9026('0x37')](_0x3ecaa4)['then'](function(_0x1da1d1){return _0x1da1d1;});}return null;};}function removeEntity(_0x1bc7fc,_0x49680d){return function(_0x45e924){if(_0x45e924){return _0x45e924[_0x9026('0x38')]()[_0x9026('0x22')](function(){var _0xe63aad=_0x45e924[_0x9026('0x39')]({'plain':!![]});var _0x7943af=_0x9026('0x3a');return db[_0x9026('0x3b')]['destroy']({'where':{'type':_0x7943af,'resourceId':_0xe63aad['id']}})[_0x9026('0x22')](function(){return _0x45e924;});})[_0x9026('0x22')](function(){_0x1bc7fc['status'](0xcc)[_0x9026('0x2e')]();});}};}function handleEntityNotFound(_0x1de27c,_0xf5085e){return function(_0xf44a47){if(!_0xf44a47){_0x1de27c[_0x9026('0x2c')](0x194);}return _0xf44a47;};}function handleError(_0x240f8a,_0x30414){_0x30414=_0x30414||0x1f4;return function(_0x13c084){logger['error'](_0x13c084[_0x9026('0x3c')]);if(_0x13c084[_0x9026('0x3d')]){delete _0x13c084[_0x9026('0x3d')];}_0x240f8a[_0x9026('0x2d')](_0x30414)[_0x9026('0x3e')](_0x13c084);};}exports[_0x9026('0x3f')]=function(_0x2f826f,_0x4c950e){var _0x20d1fe={'include':[{'model':db[_0x9026('0x40')],'as':_0x9026('0x41')},{'model':db[_0x9026('0x42')],'as':'Smtp'},{'model':db['Pause'],'as':_0x9026('0x43')}]},_0x4cf794={},_0x3b4fcd={'count':0x0,'rows':[]};var _0x1bf0df=_['map'](db['MailAccount']['rawAttributes'],function(_0x18272e){return{'name':_0x18272e[_0x9026('0x44')],'type':_0x18272e['type'][_0x9026('0x45')]};});_0x4cf794[_0x9026('0x46')]=_[_0x9026('0x47')](_0x1bf0df,_0x9026('0x3d'));_0x4cf794[_0x9026('0x48')]=_[_0x9026('0x49')](_0x2f826f[_0x9026('0x48')]);_0x4cf794[_0x9026('0x4a')]=_['intersection'](_0x4cf794[_0x9026('0x46')],_0x4cf794[_0x9026('0x48')]);_0x20d1fe['attributes']=_['intersection'](_0x4cf794['model'],qs[_0x9026('0x4b')](_0x2f826f[_0x9026('0x48')][_0x9026('0x4b')]));_0x20d1fe[_0x9026('0x4c')]=_0x20d1fe[_0x9026('0x4c')]['length']?_0x20d1fe[_0x9026('0x4c')]:_0x4cf794['model'];if(!_0x2f826f[_0x9026('0x48')][_0x9026('0x4d')](_0x9026('0x4e'))){_0x20d1fe[_0x9026('0x32')]=qs['limit'](_0x2f826f['query'][_0x9026('0x32')]);_0x20d1fe[_0x9026('0x30')]=qs[_0x9026('0x30')](_0x2f826f[_0x9026('0x48')][_0x9026('0x30')]);}_0x20d1fe[_0x9026('0x4f')]=qs['sort'](_0x2f826f[_0x9026('0x48')]['sort']);_0x20d1fe[_0x9026('0x50')]=qs[_0x9026('0x4a')](_['pick'](_0x2f826f[_0x9026('0x48')],_0x4cf794['filters']),_0x1bf0df);if(_0x2f826f[_0x9026('0x48')]['filter']){_0x20d1fe[_0x9026('0x50')]=_['merge'](_0x20d1fe['where'],{'$or':_[_0x9026('0x47')](_0x1bf0df,function(_0x30389f){if(_0x30389f[_0x9026('0x51')]!=='VIRTUAL'){var _0x3a4c72={};_0x3a4c72[_0x30389f[_0x9026('0x3d')]]={'$like':'%'+_0x2f826f[_0x9026('0x48')][_0x9026('0x52')]+'%'};return _0x3a4c72;}})});}_0x20d1fe=_[_0x9026('0x53')]({},_0x20d1fe,_0x2f826f['options']);var _0x22591b={'where':_0x20d1fe[_0x9026('0x50')]};return db[_0x9026('0x54')][_0x9026('0x33')](_0x22591b)[_0x9026('0x22')](function(_0x16e09d){_0x3b4fcd['count']=_0x16e09d;if(_0x2f826f[_0x9026('0x48')]['includeAll']){_0x20d1fe[_0x9026('0x55')]=[{'all':!![]}];}return db[_0x9026('0x54')]['findAll'](_0x20d1fe);})[_0x9026('0x22')](function(_0x324350){_0x3b4fcd[_0x9026('0x56')]=_0x324350;return _0x3b4fcd;})[_0x9026('0x22')](respondWithFilteredResult(_0x4c950e,_0x20d1fe))[_0x9026('0x2b')](handleError(_0x4c950e,null));};exports[_0x9026('0x57')]=function(_0x2d038c,_0x3c338e){var _0x140925={'raw':![],'where':{'id':_0x2d038c['params']['id']},'include':[{'model':db[_0x9026('0x40')],'as':_0x9026('0x41')},{'model':db['MailServerOut'],'as':_0x9026('0x58')},{'model':db[_0x9026('0x59')],'as':_0x9026('0x43')}]},_0x3d5add={};_0x3d5add[_0x9026('0x46')]=_[_0x9026('0x49')](db[_0x9026('0x54')]['rawAttributes']);_0x3d5add[_0x9026('0x48')]=_['keys'](_0x2d038c[_0x9026('0x48')]);_0x3d5add[_0x9026('0x4a')]=_[_0x9026('0x5a')](_0x3d5add['model'],_0x3d5add['query']);_0x140925[_0x9026('0x4c')]=_[_0x9026('0x5a')](_0x3d5add[_0x9026('0x46')],qs[_0x9026('0x4b')](_0x2d038c[_0x9026('0x48')][_0x9026('0x4b')]));_0x140925[_0x9026('0x4c')]=_0x140925[_0x9026('0x4c')][_0x9026('0x5b')]?_0x140925[_0x9026('0x4c')]:_0x3d5add['model'];if(_0x2d038c['query'][_0x9026('0x5c')]){_0x140925[_0x9026('0x55')]=[{'all':!![]}];}_0x140925=_[_0x9026('0x53')]({},_0x140925,_0x2d038c[_0x9026('0x5d')]);return db[_0x9026('0x54')][_0x9026('0x5e')](_0x140925)[_0x9026('0x22')](handleEntityNotFound(_0x3c338e,null))['then'](respondWithResult(_0x3c338e,null))[_0x9026('0x2b')](handleError(_0x3c338e,null));};exports['update']=function(_0x2cdcd9,_0x2983a4){if(_0x2cdcd9['body']['id']){delete _0x2cdcd9[_0x9026('0x5f')]['id'];}return db[_0x9026('0x54')][_0x9026('0x5e')]({'where':{'id':_0x2cdcd9[_0x9026('0x60')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x9026('0x41')},{'model':db[_0x9026('0x42')],'as':'Smtp'},{'model':db['Pause'],'as':_0x9026('0x43')}]})['then'](handleEntityNotFound(_0x2983a4,null))[_0x9026('0x22')](saveUpdates(_0x2cdcd9[_0x9026('0x5f')],null))['then'](function(_0x10cd97){if(_0x10cd97&&_0x2cdcd9[_0x9026('0x5f')][_0x9026('0x41')]){return db[_0x9026('0x40')][_0x9026('0x37')](_0x2cdcd9[_0x9026('0x5f')][_0x9026('0x41')],{'where':{'MailAccountId':_0x10cd97['id']}})[_0x9026('0x22')](function(){return _0x10cd97;});}return _0x10cd97;})['then'](function(_0x2d126a){if(_0x2d126a&&_0x2cdcd9[_0x9026('0x5f')][_0x9026('0x58')]){return db[_0x9026('0x42')][_0x9026('0x37')](_0x2cdcd9[_0x9026('0x5f')][_0x9026('0x58')],{'where':{'MailAccountId':_0x2d126a['id']}})[_0x9026('0x22')](function(){return _0x2d126a;});}return _0x2d126a;})[_0x9026('0x22')](respondWithResult(_0x2983a4,null))[_0x9026('0x2b')](handleError(_0x2983a4,null));};exports['describe']=function(_0x23c380,_0x5ea8b9){return db['MailAccount'][_0x9026('0x61')]()[_0x9026('0x22')](respondWithResult(_0x5ea8b9,null))[_0x9026('0x2b')](handleError(_0x5ea8b9,null));};exports['addDisposition']=function(_0x405880,_0x56837e,_0x1e125b){if(_0x405880[_0x9026('0x5f')]['id']){delete _0x405880['body']['id'];}return db[_0x9026('0x54')]['find']({'where':{'id':_0x405880[_0x9026('0x60')]['id']}})[_0x9026('0x22')](handleEntityNotFound(_0x56837e,null))[_0x9026('0x22')](function(_0x33a27d){if(_0x33a27d){_0x405880[_0x9026('0x5f')][_0x9026('0x62')]=_0x33a27d['id'];return db['Disposition']['create'](_0x405880[_0x9026('0x5f')]);}})[_0x9026('0x22')](respondWithResult(_0x56837e,null))[_0x9026('0x2b')](handleError(_0x56837e,null));};exports[_0x9026('0x63')]=function(_0x1c19e3,_0x200959,_0x55d3f5){var _0x115c39={'raw':![],'where':{}};var _0x1dd8d1={};var _0x3b429f={'count':0x0,'rows':[]};return db['MailAccount'][_0x9026('0x64')]({'where':{'id':_0x1c19e3[_0x9026('0x60')]['id']}})[_0x9026('0x22')](handleEntityNotFound(_0x200959,null))[_0x9026('0x22')](function(_0x19de68){if(_0x19de68){_0x1dd8d1[_0x9026('0x46')]=_['keys'](db['Disposition'][_0x9026('0x65')]);_0x1dd8d1[_0x9026('0x48')]=_[_0x9026('0x49')](_0x1c19e3['query']);_0x1dd8d1[_0x9026('0x4a')]=_['intersection'](_0x1dd8d1[_0x9026('0x46')],_0x1dd8d1[_0x9026('0x48')]);_0x115c39[_0x9026('0x4c')]=_[_0x9026('0x5a')](_0x1dd8d1[_0x9026('0x46')],qs['fields'](_0x1c19e3[_0x9026('0x48')][_0x9026('0x4b')]));_0x115c39[_0x9026('0x4c')]=_0x115c39[_0x9026('0x4c')][_0x9026('0x5b')]?_0x115c39['attributes']:_0x1dd8d1[_0x9026('0x46')];if(!_0x1c19e3['query'][_0x9026('0x4d')]('nolimit')){_0x115c39['limit']=qs[_0x9026('0x32')](_0x1c19e3['query'][_0x9026('0x32')]);_0x115c39[_0x9026('0x30')]=qs[_0x9026('0x30')](_0x1c19e3[_0x9026('0x48')][_0x9026('0x30')]);}_0x115c39[_0x9026('0x4f')]=qs[_0x9026('0x66')](_0x1c19e3['query']['sort']);_0x115c39[_0x9026('0x50')]=qs[_0x9026('0x4a')](_[_0x9026('0x67')](_0x1c19e3['query'],_0x1dd8d1[_0x9026('0x4a')]));_0x115c39[_0x9026('0x50')][_0x9026('0x62')]=_0x19de68['id'];if(_0x1c19e3['query'][_0x9026('0x52')]){_0x115c39[_0x9026('0x50')]=_[_0x9026('0x53')](_0x115c39[_0x9026('0x50')],{'$or':_[_0x9026('0x47')](_0x115c39[_0x9026('0x4c')],function(_0x5da133){var _0x19f6ba={};_0x19f6ba[_0x5da133]={'$like':'%'+_0x1c19e3['query'][_0x9026('0x52')]+'%'};return _0x19f6ba;})});}_0x115c39=_['merge']({},_0x115c39,_0x1c19e3[_0x9026('0x5d')]);return db[_0x9026('0x68')][_0x9026('0x33')]({'where':_0x115c39[_0x9026('0x50')]})[_0x9026('0x22')](function(_0xe448d8){_0x3b429f[_0x9026('0x33')]=_0xe448d8;if(_0x1c19e3[_0x9026('0x48')][_0x9026('0x5c')]){_0x115c39[_0x9026('0x55')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x115c39);})['then'](function(_0x582f99){_0x3b429f['rows']=_0x582f99;return _0x3b429f;});}})[_0x9026('0x22')](respondWithFilteredResult(_0x200959,_0x115c39))[_0x9026('0x2b')](handleError(_0x200959,null));};exports[_0x9026('0x69')]=function(_0x3980fb,_0x46d10c,_0x4e5d5b){return db[_0x9026('0x54')][_0x9026('0x5e')]({'where':{'id':_0x3980fb[_0x9026('0x60')]['id']}})[_0x9026('0x22')](handleEntityNotFound(_0x46d10c,null))[_0x9026('0x22')](function(_0x3e391b){if(_0x3e391b){return _0x3e391b[_0x9026('0x69')](_0x3980fb[_0x9026('0x48')][_0x9026('0x6a')]);}})[_0x9026('0x22')](respondWithStatusCode(_0x46d10c,null))[_0x9026('0x2b')](handleError(_0x46d10c,null));};exports[_0x9026('0x6b')]=function(_0x47f264,_0x3ba9cd,_0x1158b4){if(_0x47f264[_0x9026('0x5f')]['id']){delete _0x47f264[_0x9026('0x5f')]['id'];}return db[_0x9026('0x54')]['find']({'where':{'id':_0x47f264[_0x9026('0x60')]['id']}})['then'](handleEntityNotFound(_0x3ba9cd,null))[_0x9026('0x22')](function(_0x20155c){if(_0x20155c){_0x47f264[_0x9026('0x5f')][_0x9026('0x62')]=_0x20155c['id'];return db[_0x9026('0x6c')]['create'](_0x47f264[_0x9026('0x5f')]);}})[_0x9026('0x22')](respondWithResult(_0x3ba9cd,null))[_0x9026('0x2b')](handleError(_0x3ba9cd,null));};exports[_0x9026('0x6d')]=function(_0x5021b1,_0x4eb377,_0x176564){var _0x2345b3={'raw':![],'where':{}};var _0x5ac92f={};var _0x530e6b={'count':0x0,'rows':[]};return db[_0x9026('0x54')]['findOne']({'where':{'id':_0x5021b1[_0x9026('0x60')]['id']}})[_0x9026('0x22')](handleEntityNotFound(_0x4eb377,null))[_0x9026('0x22')](function(_0x4b4769){if(_0x4b4769){_0x5ac92f[_0x9026('0x46')]=_[_0x9026('0x49')](db[_0x9026('0x6c')][_0x9026('0x65')]);_0x5ac92f[_0x9026('0x48')]=_[_0x9026('0x49')](_0x5021b1[_0x9026('0x48')]);_0x5ac92f['filters']=_[_0x9026('0x5a')](_0x5ac92f[_0x9026('0x46')],_0x5ac92f['query']);_0x2345b3[_0x9026('0x4c')]=_[_0x9026('0x5a')](_0x5ac92f[_0x9026('0x46')],qs[_0x9026('0x4b')](_0x5021b1[_0x9026('0x48')][_0x9026('0x4b')]));_0x2345b3['attributes']=_0x2345b3[_0x9026('0x4c')][_0x9026('0x5b')]?_0x2345b3['attributes']:_0x5ac92f[_0x9026('0x46')];if(!_0x5021b1[_0x9026('0x48')]['hasOwnProperty'](_0x9026('0x4e'))){_0x2345b3['limit']=qs['limit'](_0x5021b1['query'][_0x9026('0x32')]);_0x2345b3[_0x9026('0x30')]=qs['offset'](_0x5021b1[_0x9026('0x48')][_0x9026('0x30')]);}_0x2345b3[_0x9026('0x4f')]=qs['sort'](_0x5021b1[_0x9026('0x48')][_0x9026('0x66')]);_0x2345b3[_0x9026('0x50')]=qs['filters'](_['pick'](_0x5021b1[_0x9026('0x48')],_0x5ac92f[_0x9026('0x4a')]));_0x2345b3[_0x9026('0x50')][_0x9026('0x62')]=_0x4b4769['id'];if(_0x5021b1[_0x9026('0x48')][_0x9026('0x52')]){_0x2345b3[_0x9026('0x50')]=_['merge'](_0x2345b3[_0x9026('0x50')],{'$or':_['map'](_0x2345b3[_0x9026('0x4c')],function(_0x4d2842){var _0x1e9150={};_0x1e9150[_0x4d2842]={'$like':'%'+_0x5021b1[_0x9026('0x48')]['filter']+'%'};return _0x1e9150;})});}_0x2345b3=_['merge']({},_0x2345b3,_0x5021b1[_0x9026('0x5d')]);return db[_0x9026('0x6c')]['count']({'where':_0x2345b3[_0x9026('0x50')]})[_0x9026('0x22')](function(_0x4ddb20){_0x530e6b['count']=_0x4ddb20;if(_0x5021b1['query']['includeAll']){_0x2345b3['include']=[{'all':!![]}];}return db[_0x9026('0x6c')][_0x9026('0x6e')](_0x2345b3);})[_0x9026('0x22')](function(_0xf8fc35){_0x530e6b[_0x9026('0x56')]=_0xf8fc35;return _0x530e6b;});}})[_0x9026('0x22')](respondWithFilteredResult(_0x4eb377,_0x2345b3))[_0x9026('0x2b')](handleError(_0x4eb377,null));};exports['removeAnswers']=function(_0xa6756c,_0x8f6cf6,_0x455e69){return db[_0x9026('0x54')][_0x9026('0x5e')]({'where':{'id':_0xa6756c[_0x9026('0x60')]['id']}})['then'](handleEntityNotFound(_0x8f6cf6,null))[_0x9026('0x22')](function(_0x18a0b4){if(_0x18a0b4){return _0x18a0b4[_0x9026('0x6f')](_0xa6756c[_0x9026('0x48')][_0x9026('0x6a')]);}})[_0x9026('0x22')](respondWithStatusCode(_0x8f6cf6,null))['catch'](handleError(_0x8f6cf6,null));};exports[_0x9026('0x70')]=function(_0x11956d,_0xa0c1e5){var _0x27ae0f={'name':_0x11956d['body']['name'],'key':_0x11956d[_0x9026('0x5f')]['key'],'email':_0x11956d['body']['email'],'ListId':_0x11956d[_0x9026('0x5f')][_0x9026('0x71')],'active':!_[_0x9026('0x72')](_0x11956d[_0x9026('0x5f')]['active'])?_0x11956d[_0x9026('0x5f')][_0x9026('0x73')]:!![],'description':_0x11956d[_0x9026('0x5f')]['description']||null,'Imap':{},'Smtp':{}};if(_[_0x9026('0x72')](_0x11956d[_0x9026('0x5f')][_0x9026('0x74')])){if(_0x11956d[_0x9026('0x5f')][_0x9026('0x75')]){_0x27ae0f[_0x9026('0x41')][_0x9026('0x76')]=_0x27ae0f['Smtp'][_0x9026('0x76')]=_0x11956d[_0x9026('0x5f')][_0x9026('0x77')];_0x27ae0f[_0x9026('0x41')]['password']=_0x27ae0f[_0x9026('0x58')][_0x9026('0x78')]=_0x11956d[_0x9026('0x5f')][_0x9026('0x79')];}else{_0x27ae0f[_0x9026('0x41')][_0x9026('0x7a')]=_0x27ae0f[_0x9026('0x58')][_0x9026('0x7a')]=![];}_0x27ae0f[_0x9026('0x41')]['host']=_0x11956d[_0x9026('0x5f')]['Imap'][_0x9026('0x7b')];_0x27ae0f[_0x9026('0x41')][_0x9026('0x7c')]=_0x11956d[_0x9026('0x5f')][_0x9026('0x41')][_0x9026('0x7c')];_0x27ae0f[_0x9026('0x58')][_0x9026('0x7b')]=_0x11956d[_0x9026('0x5f')][_0x9026('0x58')][_0x9026('0x7b')];_0x27ae0f[_0x9026('0x58')][_0x9026('0x7c')]=_0x11956d[_0x9026('0x5f')][_0x9026('0x58')][_0x9026('0x7c')];}else{_0x27ae0f[_0x9026('0x41')]['service']=_0x27ae0f['Smtp'][_0x9026('0x7d')]=_0x11956d['body'][_0x9026('0x74')];_0x27ae0f['Imap']['user']=_0x27ae0f[_0x9026('0x58')][_0x9026('0x76')]=_0x11956d['body'][_0x9026('0x77')];_0x27ae0f['Imap']['password']=_0x27ae0f[_0x9026('0x58')][_0x9026('0x78')]=_0x11956d[_0x9026('0x5f')][_0x9026('0x79')];}return db[_0x9026('0x54')]['create'](_0x27ae0f,{'include':[{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x9026('0x40')],'as':_0x9026('0x41')}]})[_0x9026('0x22')](function(_0x520aa5){var _0x46a0ec=_0x11956d[_0x9026('0x76')]['get']({'plain':!![]});if(!_0x46a0ec)throw new Error(_0x9026('0x7e'));if(_0x46a0ec[_0x9026('0x7f')]==='user'){var _0x355474=_0x520aa5[_0x9026('0x39')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':'MailAccounts','userProfileId':_0x46a0ec[_0x9026('0x80')]},'raw':!![]})[_0x9026('0x22')](function(_0x17abb8){if(_0x17abb8&&_0x17abb8[_0x9026('0x81')]===0x0){return db[_0x9026('0x3b')]['create']({'name':_0x355474[_0x9026('0x3d')],'resourceId':_0x355474['id'],'type':_0x17abb8[_0x9026('0x3d')],'sectionId':_0x17abb8['id']},{})[_0x9026('0x22')](function(){return _0x520aa5;});}else{return _0x520aa5;}})['catch'](function(_0x1528cf){logger[_0x9026('0x27')](_0x9026('0x82'),_0x1528cf);throw _0x1528cf;});}return _0x520aa5;})[_0x9026('0x22')](respondWithResult(_0xa0c1e5,0xc9))[_0x9026('0x2b')](handleError(_0xa0c1e5,null));};exports['getImap']=function(_0x17200f,_0x215e25,_0x1ca0f4){return db[_0x9026('0x54')]['findOne']({'where':{'id':_0x17200f[_0x9026('0x60')]['id']}})[_0x9026('0x22')](handleEntityNotFound(_0x215e25,null))[_0x9026('0x22')](function(_0xea7c41){if(_0xea7c41){return _0xea7c41[_0x9026('0x83')]();}return null;})[_0x9026('0x22')](respondWithResult(_0x215e25,null))[_0x9026('0x2b')](handleError(_0x215e25,null));};exports['addImap']=function(_0x3e4afc,_0x45dd97,_0x3d99c0){if(_0x3e4afc[_0x9026('0x5f')]['id']){delete _0x3e4afc[_0x9026('0x5f')]['id'];}return db[_0x9026('0x54')][_0x9026('0x5e')]({'where':{'id':_0x3e4afc[_0x9026('0x60')]['id']}})[_0x9026('0x22')](handleEntityNotFound(_0x45dd97,null))[_0x9026('0x22')](function(_0x2db94e){if(_0x2db94e){_0x3e4afc['body'][_0x9026('0x62')]=_0x2db94e['id'];return db[_0x9026('0x40')]['create'](_0x3e4afc[_0x9026('0x5f')]);}})[_0x9026('0x22')](respondWithResult(_0x45dd97,null))[_0x9026('0x2b')](handleError(_0x45dd97,null));};exports[_0x9026('0x84')]=function(_0x17e665,_0x40403b,_0x355f3a){return db[_0x9026('0x54')][_0x9026('0x64')]({'where':{'id':_0x17e665[_0x9026('0x60')]['id']}})[_0x9026('0x22')](handleEntityNotFound(_0x40403b,null))['then'](function(_0x1a4edb){if(_0x1a4edb){return _0x1a4edb[_0x9026('0x85')](null);}return null;})[_0x9026('0x22')](respondWithStatusCode(_0x40403b,null))[_0x9026('0x2b')](handleError(_0x40403b,null));};exports['getSmtp']=function(_0xc3a0a7,_0x1f389e,_0x2ce6b9){return db[_0x9026('0x54')]['findOne']({'where':{'id':_0xc3a0a7[_0x9026('0x60')]['id']}})[_0x9026('0x22')](handleEntityNotFound(_0x1f389e,null))[_0x9026('0x22')](function(_0x39166b){if(_0x39166b){return _0x39166b['getSmtp']();}return null;})[_0x9026('0x22')](respondWithResult(_0x1f389e,null))['catch'](handleError(_0x1f389e,null));};exports['addSmtp']=function(_0xea616d,_0x527ff7,_0x3d33b7){if(_0xea616d[_0x9026('0x5f')]['id']){delete _0xea616d[_0x9026('0x5f')]['id'];}return db[_0x9026('0x54')][_0x9026('0x5e')]({'where':{'id':_0xea616d[_0x9026('0x60')]['id']}})[_0x9026('0x22')](handleEntityNotFound(_0x527ff7,null))['then'](function(_0x4f4873){if(_0x4f4873){_0xea616d[_0x9026('0x5f')][_0x9026('0x62')]=_0x4f4873['id'];return db[_0x9026('0x42')][_0x9026('0x70')](_0xea616d['body']);}})[_0x9026('0x22')](respondWithResult(_0x527ff7,null))[_0x9026('0x2b')](handleError(_0x527ff7,null));};exports[_0x9026('0x86')]=function(_0x46f8f7,_0x434f75,_0x1e2c65){return db['MailAccount'][_0x9026('0x64')]({'where':{'id':_0x46f8f7[_0x9026('0x60')]['id']}})[_0x9026('0x22')](handleEntityNotFound(_0x434f75,null))['then'](function(_0x1e64c6){if(_0x1e64c6){return _0x1e64c6[_0x9026('0x87')](null);}return null;})['then'](respondWithStatusCode(_0x434f75,null))[_0x9026('0x2b')](handleError(_0x434f75,null));};exports[_0x9026('0x88')]=function(_0x6fb5f8,_0x1089a1,_0x635f78){return db[_0x9026('0x89')][_0x9026('0x5e')]({'where':{'id':_0x6fb5f8['params']['id']}})[_0x9026('0x22')](handleEntityNotFound(_0x1089a1,null))[_0x9026('0x22')](function(_0x433950){if(_0x433950){return _0x433950[_0x9026('0x88')](_0x6fb5f8[_0x9026('0x5f')][_0x9026('0x6a')],_[_0x9026('0x8a')](_0x6fb5f8[_0x9026('0x5f')],[_0x9026('0x6a'),'id'])||{});}})['then'](respondWithResult(_0x1089a1,null))[_0x9026('0x2b')](handleError(_0x1089a1,null));};exports[_0x9026('0x8b')]=function(_0x7419b2,_0x2b72d1,_0x176d6e){var _0x2a7091={'raw':![],'where':{}};var _0x37bd30={};var _0x2e6bbb={'count':0x0,'rows':[]};return db[_0x9026('0x54')][_0x9026('0x64')]({'where':{'id':_0x7419b2[_0x9026('0x60')]['id']}})[_0x9026('0x22')](handleEntityNotFound(_0x2b72d1,null))[_0x9026('0x22')](function(_0x527488){if(_0x527488){_0x37bd30['model']=_[_0x9026('0x49')](db[_0x9026('0x89')]['rawAttributes']);_0x37bd30[_0x9026('0x48')]=_[_0x9026('0x49')](_0x7419b2[_0x9026('0x48')]);_0x37bd30['filters']=_[_0x9026('0x5a')](_0x37bd30[_0x9026('0x46')],_0x37bd30[_0x9026('0x48')]);_0x2a7091[_0x9026('0x4c')]=_[_0x9026('0x5a')](_0x37bd30[_0x9026('0x46')],qs['fields'](_0x7419b2[_0x9026('0x48')][_0x9026('0x4b')]));_0x2a7091[_0x9026('0x4c')]=_0x2a7091[_0x9026('0x4c')][_0x9026('0x5b')]?_0x2a7091['attributes']:_0x37bd30['model'];if(!_0x7419b2[_0x9026('0x48')][_0x9026('0x4d')]('nolimit')){_0x2a7091['limit']=qs[_0x9026('0x32')](_0x7419b2[_0x9026('0x48')][_0x9026('0x32')]);_0x2a7091[_0x9026('0x30')]=qs[_0x9026('0x30')](_0x7419b2['query'][_0x9026('0x30')]);}_0x2a7091['order']=qs[_0x9026('0x66')](_0x7419b2[_0x9026('0x48')]['sort']);_0x2a7091[_0x9026('0x50')]=qs[_0x9026('0x4a')](_[_0x9026('0x67')](_0x7419b2[_0x9026('0x48')],_0x37bd30[_0x9026('0x4a')]));_0x2a7091[_0x9026('0x50')][_0x9026('0x62')]=_0x527488['id'];if(_0x7419b2[_0x9026('0x48')][_0x9026('0x52')]){_0x2a7091[_0x9026('0x50')]=_[_0x9026('0x53')](_0x2a7091[_0x9026('0x50')],{'$or':_['map'](_0x2a7091[_0x9026('0x4c')],function(_0x13f202){var _0x417869={};_0x417869[_0x13f202]={'$like':'%'+_0x7419b2['query'][_0x9026('0x52')]+'%'};return _0x417869;})});}_0x2a7091=_['merge']({},_0x2a7091,_0x7419b2[_0x9026('0x5d')]);return db[_0x9026('0x89')][_0x9026('0x33')]({'where':_0x2a7091[_0x9026('0x50')]})[_0x9026('0x22')](function(_0x1e73cb){_0x2e6bbb[_0x9026('0x33')]=_0x1e73cb;if(_0x7419b2[_0x9026('0x48')][_0x9026('0x5c')]){_0x2a7091[_0x9026('0x55')]=[{'model':db[_0x9026('0x8c')],'as':_0x9026('0x8d'),'required':![]},{'model':db[_0x9026('0x8e')],'as':_0x9026('0x8f'),'attributes':[_0x9026('0x3d'),_0x9026('0x90'),'internal'],'required':![]},{'model':db[_0x9026('0x91')],'as':_0x9026('0x92'),'attributes':['id','name','color'],'where':_0x7419b2['query'][_0x9026('0x93')]?{'id':_0x7419b2['query'][_0x9026('0x93')]}:undefined,'required':_0x7419b2['query'][_0x9026('0x93')]?!![]:![]}];}return db[_0x9026('0x89')][_0x9026('0x6e')](_0x2a7091);})[_0x9026('0x22')](function(_0x34187d){_0x2e6bbb[_0x9026('0x56')]=_0x34187d;return _0x2e6bbb;});}})[_0x9026('0x22')](respondWithFilteredResult(_0x2b72d1,_0x2a7091))['catch'](handleError(_0x2b72d1,null));};exports['addApplications']=function addApplications(_0x2abf19,_0x500f62){var _0x4fd9c0=_0x2abf19['params']['id'];var _0x1fd096=_0x2abf19[_0x9026('0x5f')];var _0x4c8fb2=0xc8;var _0x5a1f19=null;return db[_0x9026('0x94')][_0x9026('0x95')]({'isolationLevel':db[_0x9026('0x94')][_0x9026('0x96')]['ISOLATION_LEVELS'][_0x9026('0x97')]},function(_0x29c159){return db[_0x9026('0x54')]['findOne']({'where':{'id':_0x4fd9c0},'transaction':_0x29c159})['then'](function(_0x1e07ce){if(_0x1e07ce){return db[_0x9026('0x98')]['destroy']({'where':{'MailAccountId':_0x4fd9c0},'transaction':_0x29c159})[_0x9026('0x22')](function(){var _0x3a61cd=_[_0x9026('0x47')](_0x1fd096,function(_0x404061){_0x404061['MailAccountId']=_0x4fd9c0;return _0x404061;});return db[_0x9026('0x98')][_0x9026('0x99')](_0x3a61cd,{'transaction':_0x29c159});});}else{_0x4c8fb2=0x194;_0x5a1f19=[];}});})[_0x9026('0x22')](function(){if(_0x4c8fb2!==0x194){return db[_0x9026('0x98')][_0x9026('0x9a')]({'where':{'MailAccountId':_0x4fd9c0},'order':_0x9026('0x9b')})[_0x9026('0x22')](function(_0x55a60b){_0x5a1f19=_0x55a60b;});}})['catch'](function(_0x6e2a16){_0x4c8fb2=0x1f4;logger[_0x9026('0x27')](_0x6e2a16['stack']);if(_0x6e2a16[_0x9026('0x3d')]){delete _0x6e2a16[_0x9026('0x3d')];}_0x5a1f19=_0x6e2a16;})[_0x9026('0x9c')](function(){if(_0x5a1f19===null){_0x500f62[_0x9026('0x2c')](_0x4c8fb2);}else{if(_0x4c8fb2===0x1f4){_0x500f62['status'](_0x4c8fb2)[_0x9026('0x3e')](_0x5a1f19);}else{_0x500f62[_0x9026('0x2d')](_0x4c8fb2)[_0x9026('0x2f')](_0x5a1f19);}}});};exports['getApplications']=function(_0x26e613,_0x10cdfe,_0x4711a7){var _0x172e01={};var _0x312f9e={};var _0x2e5573;var _0xfa3432;return db['MailAccount'][_0x9026('0x64')]({'where':{'id':_0x26e613['params']['id']}})[_0x9026('0x22')](handleEntityNotFound(_0x10cdfe,null))[_0x9026('0x22')](function(_0x140df3){if(_0x140df3){_0x2e5573=_0x140df3;_0x312f9e[_0x9026('0x46')]=_['keys'](db[_0x9026('0x98')][_0x9026('0x65')]);_0x312f9e[_0x9026('0x48')]=_[_0x9026('0x49')](_0x26e613[_0x9026('0x48')]);_0x312f9e['filters']=_[_0x9026('0x5a')](_0x312f9e['model'],_0x312f9e[_0x9026('0x48')]);_0x172e01[_0x9026('0x4c')]=_[_0x9026('0x5a')](_0x312f9e[_0x9026('0x46')],qs['fields'](_0x26e613[_0x9026('0x48')][_0x9026('0x4b')]));_0x172e01[_0x9026('0x4c')]=_0x172e01[_0x9026('0x4c')]['length']?_0x172e01['attributes']:_0x312f9e[_0x9026('0x46')];_0x172e01[_0x9026('0x4f')]=qs[_0x9026('0x66')](_0x26e613['query'][_0x9026('0x66')]);_0x172e01['where']=qs[_0x9026('0x4a')](_['pick'](_0x26e613[_0x9026('0x48')],_0x312f9e['filters']));if(_0x26e613[_0x9026('0x48')][_0x9026('0x52')]){_0x172e01[_0x9026('0x50')]=_[_0x9026('0x53')](_0x172e01[_0x9026('0x50')],{'$or':_[_0x9026('0x47')](_0x172e01[_0x9026('0x4c')],function(_0x5c773f){var _0x21fefc={};_0x21fefc[_0x5c773f]={'$like':'%'+_0x26e613[_0x9026('0x48')]['filter']+'%'};return _0x21fefc;})});}_0x172e01=_[_0x9026('0x53')]({},_0x172e01,_0x26e613['options']);return _0x2e5573['getApplications'](_0x172e01);}})[_0x9026('0x22')](function(_0x45577f){if(_0x45577f){_0xfa3432=_0x45577f[_0x9026('0x5b')];if(!_0x26e613['query'][_0x9026('0x4d')](_0x9026('0x4e'))){_0x172e01['limit']=qs[_0x9026('0x32')](_0x26e613[_0x9026('0x48')][_0x9026('0x32')]);_0x172e01['offset']=qs[_0x9026('0x30')](_0x26e613[_0x9026('0x48')]['offset']);}return _0x2e5573[_0x9026('0x9d')](_0x172e01);}})[_0x9026('0x22')](function(_0x18b177){if(_0x18b177){return _0x18b177?{'count':_0xfa3432,'rows':_0x18b177}:null;}})['then'](respondWithResult(_0x10cdfe,null))['catch'](handleError(_0x10cdfe,null));};exports[_0x9026('0x9e')]=function(_0x3b6dbf,_0x28083d,_0x158b41){var _0x1d6f58={'raw':!![],'where':{}};var _0x48cb50={};var _0x91c87={'count':0x0,'rows':[]};return db[_0x9026('0x54')][_0x9026('0x64')]({'where':{'id':_0x3b6dbf[_0x9026('0x60')]['id']}})[_0x9026('0x22')](handleEntityNotFound(_0x28083d,null))[_0x9026('0x22')](function(_0x25e849){if(_0x25e849){_0x48cb50[_0x9026('0x46')]=_[_0x9026('0x49')](db[_0x9026('0x9f')][_0x9026('0x65')]);_0x48cb50[_0x9026('0x48')]=_['keys'](_0x3b6dbf[_0x9026('0x48')]);_0x48cb50[_0x9026('0x4a')]=_[_0x9026('0x5a')](_0x48cb50[_0x9026('0x46')],_0x48cb50[_0x9026('0x48')]);_0x1d6f58[_0x9026('0x4c')]=_[_0x9026('0x5a')](_0x48cb50[_0x9026('0x46')],qs['fields'](_0x3b6dbf[_0x9026('0x48')][_0x9026('0x4b')]));_0x1d6f58[_0x9026('0x4c')]=_0x1d6f58[_0x9026('0x4c')][_0x9026('0x5b')]?_0x1d6f58[_0x9026('0x4c')]:_0x48cb50['model'];if(!_0x3b6dbf[_0x9026('0x48')][_0x9026('0x4d')](_0x9026('0x4e'))){_0x1d6f58['limit']=qs[_0x9026('0x32')](_0x3b6dbf[_0x9026('0x48')][_0x9026('0x32')]);_0x1d6f58[_0x9026('0x30')]=qs[_0x9026('0x30')](_0x3b6dbf[_0x9026('0x48')][_0x9026('0x30')]);}_0x1d6f58[_0x9026('0x4f')]=qs['sort'](_0x3b6dbf[_0x9026('0x48')]['sort']);_0x1d6f58[_0x9026('0x50')]=qs[_0x9026('0x4a')](_[_0x9026('0x67')](_0x3b6dbf['query'],_0x48cb50[_0x9026('0x4a')]));_0x1d6f58[_0x9026('0x50')][_0x9026('0x62')]=_0x25e849['id'];if(_0x3b6dbf[_0x9026('0x48')][_0x9026('0x52')]){_0x1d6f58[_0x9026('0x50')]=_[_0x9026('0x53')](_0x1d6f58[_0x9026('0x50')],{'$or':_[_0x9026('0x47')](_0x1d6f58['attributes'],function(_0x5e6e38){var _0x140e1e={};_0x140e1e[_0x5e6e38]={'$like':'%'+_0x3b6dbf[_0x9026('0x48')]['filter']+'%'};return _0x140e1e;})});}if(_0x3b6dbf[_0x9026('0x48')][_0x9026('0xa0')]){var _0x64923=_0x3b6dbf[_0x9026('0x48')]['$gte']['split'](',');var _0x5380ee={};_0x5380ee[_0x64923[0x0]]={'$gte':moment(_0x64923[0x1])[_0x9026('0xa1')](_0x9026('0xa2'))};_0x1d6f58[_0x9026('0x50')]=_[_0x9026('0x53')](_0x1d6f58[_0x9026('0x50')],_0x5380ee);}_0x1d6f58=_[_0x9026('0x53')]({},_0x1d6f58,_0x3b6dbf[_0x9026('0x5d')]);return db[_0x9026('0x9f')]['count']({'where':_0x1d6f58['where']})[_0x9026('0x22')](function(_0x5cb78f){_0x91c87[_0x9026('0x33')]=_0x5cb78f;if(_0x3b6dbf[_0x9026('0x48')][_0x9026('0x5c')]){_0x1d6f58[_0x9026('0x55')]=[{'all':!![]}];}return db[_0x9026('0x9f')][_0x9026('0x6e')](_0x1d6f58);})[_0x9026('0x22')](function(_0x2ac623){if(_0x3b6dbf[_0x9026('0x48')]['inlineCss']===_0x9026('0xa3')){for(var _0x47cb69=0x0;_0x47cb69<_0x2ac623['length'];_0x47cb69++){_0x2ac623[_0x47cb69][_0x9026('0x5f')]=juice(_0x2ac623[_0x47cb69][_0x9026('0x5f')]);}}_0x91c87[_0x9026('0x56')]=_0x2ac623;return _0x91c87;});}})[_0x9026('0x22')](respondWithFilteredResult(_0x28083d,_0x1d6f58))[_0x9026('0x2b')](handleError(_0x28083d,null));};exports[_0x9026('0x3e')]=function(_0x4dd3f3,_0x422674,_0x4b2529){var _0x1c247a,_0x4e5d52={},_0x23ddfe;if(_0x4dd3f3[_0x9026('0x5f')]['to']){_0x23ddfe=_0x4dd3f3['body']['to'][_0x9026('0xa4')](',')[0x0];}return db[_0x9026('0x54')][_0x9026('0x5e')]({'where':{'id':_0x4dd3f3[_0x9026('0x60')]['id']},'include':[{'model':db['CmList'],'as':_0x9026('0xa5'),'include':[{'model':db['CmContact'],'as':_0x9026('0xa6'),'where':{'email':_0x23ddfe},'limit':0x1,'order':[[_0x9026('0xa7'),'DESC']]}]},{'model':db[_0x9026('0x42')],'as':_0x9026('0x58'),'raw':!![]}]})['then'](handleEntityNotFound(_0x422674,null))[_0x9026('0x22')](function(_0x172a7e){if(_0x172a7e){_0x1c247a=_0x172a7e;if(_0x172a7e[_0x9026('0x58')]){if(_['isNil'](_0x4dd3f3[_0x9026('0x5f')]['from'])){_0x4dd3f3[_0x9026('0x5f')]['from']=util[_0x9026('0xa1')]('%s\x20<%s>',_0x172a7e[_0x9026('0x3d')],_0x172a7e[_0x9026('0xa8')]||_0x172a7e[_0x9026('0x58')]['user']);}if(_0x4dd3f3['body'][_0x9026('0xa9')]&&_0x4dd3f3[_0x9026('0x5f')][_0x9026('0xa9')][_0x9026('0x5b')]){for(var _0x3b7451=0x0;_0x3b7451<_0x4dd3f3['body']['attachments'][_0x9026('0x5b')];_0x3b7451+=0x1){_0x4dd3f3['body'][_0x9026('0xa9')][_0x3b7451]={'filename':_0x4dd3f3[_0x9026('0x5f')][_0x9026('0xa9')][_0x3b7451]['name'],'path':path[_0x9026('0xaa')](config['root'],_0x9026('0xab'),_0x4dd3f3[_0x9026('0x5f')]['attachments'][_0x3b7451][_0x9026('0xac')])};}}var _0x259cdf={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x172a7e[_0x9026('0x58')][_0x9026('0x7d')])){if(_0x172a7e[_0x9026('0x58')]['authentication']){_0x259cdf[_0x9026('0xad')]={'user':_0x172a7e[_0x9026('0x58')][_0x9026('0x76')],'pass':_0x172a7e[_0x9026('0x58')]['pass']};}_0x259cdf['host']=_0x172a7e[_0x9026('0x58')][_0x9026('0x7b')];_0x259cdf[_0x9026('0x7c')]=_0x172a7e[_0x9026('0x58')][_0x9026('0x7c')];_0x259cdf['secure']=_0x172a7e[_0x9026('0x58')][_0x9026('0xae')];}else{_0x259cdf['service']=_0x172a7e[_0x9026('0x58')][_0x9026('0x7d')];_0x259cdf[_0x9026('0xad')]={'user':_0x172a7e['Smtp'][_0x9026('0x76')],'pass':_0x172a7e[_0x9026('0x58')][_0x9026('0x78')]};}return respondWithRpcPromise(_0x9026('0xaf'),_0x9026('0xb0'),{'account':_0x259cdf,'message':_0x4dd3f3[_0x9026('0x5f')]});}else{throw new Error('List\x20not\x20found');}}})[_0x9026('0x22')](function(_0x2dad19){if(_0x2dad19){_0x4e5d52=_0x2dad19;if(_0x1c247a[_0x9026('0xa5')]){if(_0x1c247a['List'][_0x9026('0xa6')][_0x9026('0x5b')]){return _0x1c247a[_0x9026('0xa5')][_0x9026('0xa6')][0x0];}else{return db[_0x9026('0x8c')][_0x9026('0x70')](_[_0x9026('0x1a')](_0x4dd3f3['body'],{'firstName':_0x4dd3f3[_0x9026('0x5f')]['to'],'email':_0x4dd3f3[_0x9026('0x5f')]['to'],'phone':_0x4dd3f3[_0x9026('0x5f')]['to'],'ListId':_0x1c247a['ListId']}));}}else{throw new Error(_0x9026('0xb1'));}}})[_0x9026('0x22')](function(_0x262f8e){if(_0x262f8e){var _0x1cfe6d={'UserId':_0x4dd3f3[_0x9026('0x76')]['id'],'ContactId':_0x262f8e['id'],'MailAccountId':_0x1c247a['id'],'inReplyTo':_0x4e5d52[_0x9026('0xb2')],'to':_0x4dd3f3[_0x9026('0x5f')][_0x9026('0xb3')],'cc':_0x4dd3f3['body']['cc'],'subject':_0x4dd3f3[_0x9026('0x5f')]['subject'],'attach':_0x4dd3f3[_0x9026('0x5f')][_0x9026('0xb4')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x9026('0xa1')](_0x9026('0xa2')),'lastMsgDirection':_0x9026('0xb5'),'Messages':[_['merge'](_0x4dd3f3[_0x9026('0x5f')],{'messageId':_0x4e5d52['messageId'],'sentAt':moment()['format'](_0x9026('0xa2')),'read':!![],'MailAccountId':_0x1c247a['id'],'UserId':_0x4dd3f3[_0x9026('0x76')]['id'],'ContactId':_0x262f8e['id']})]};if(_0x4dd3f3[_0x9026('0x5f')]['Interaction']){_0x1cfe6d=_[_0x9026('0x53')](_0x1cfe6d,_0x4dd3f3[_0x9026('0x5f')][_0x9026('0xb6')]);}return db['MailInteraction']['create'](_0x1cfe6d,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});}})[_0x9026('0x22')](respondWithResult(_0x422674,null))[_0x9026('0x2b')](handleError(_0x422674,null));};exports[_0x9026('0xb7')]=function(_0x1240cf,_0x422df8,_0x462bd3){return db[_0x9026('0x54')]['find']({'where':{'id':_0x1240cf[_0x9026('0x60')]['id']},'include':[{'model':db[_0x9026('0x42')],'as':_0x9026('0x58'),'raw':!![]}]})[_0x9026('0x22')](handleEntityNotFound(_0x422df8,null))[_0x9026('0x22')](function(_0x804343){if(_0x804343&&_0x804343[_0x9026('0x58')]){var _0x1f9429={'id':_0x804343['id'],'tls':{'rejectUnauthorized':![]}};if(_0x804343[_0x9026('0x58')][_0x9026('0x7d')]){_0x1f9429['service']=_0x804343[_0x9026('0x58')][_0x9026('0x7d')];}else{_0x1f9429[_0x9026('0x7b')]=_0x804343['Smtp'][_0x9026('0x7b')];_0x1f9429[_0x9026('0x7c')]=_0x804343[_0x9026('0x58')]['port'];_0x1f9429[_0x9026('0xae')]=_0x804343['Smtp']['secure'];}if(_0x804343[_0x9026('0x58')]['authentication']){_0x1f9429[_0x9026('0xad')]={'user':_0x804343[_0x9026('0x58')][_0x9026('0x76')],'pass':_0x804343['Smtp'][_0x9026('0x78')]};}return respondWithRpcPromise(_0x9026('0xb8'),_0x9026('0xb7'),{'account':_0x1f9429});}})[_0x9026('0x22')](respondWithResult(_0x422df8,null))[_0x9026('0x2b')](handleError(_0x422df8,null));};exports[_0x9026('0x38')]=function(_0x460a13,_0x10ad2b){return db[_0x9026('0x54')][_0x9026('0x5e')]({'where':{'id':_0x460a13[_0x9026('0x60')]['id']}})['then'](handleEntityNotFound(_0x10ad2b,null))[_0x9026('0x22')](function(_0x282437){if(_0x282437&&_0x282437['service']){throw new db[(_0x9026('0xb9'))]['ValidationError'](_0x9026('0xba'));}return _0x282437;})[_0x9026('0x22')](removeEntity(_0x10ad2b,null))[_0x9026('0x2b')](handleError(_0x10ad2b,null));};exports[_0x9026('0xbb')]=function(_0x339e49,_0x2ee6c4,_0x2d5cf2){return db['MailAccount'][_0x9026('0x5e')]({'where':{'id':_0x339e49['params']['id']}})[_0x9026('0x22')](handleEntityNotFound(_0x2ee6c4,null))[_0x9026('0x22')](function(_0x16a8eb){if(_0x16a8eb){return _0x16a8eb[_0x9026('0xbb')](_0x339e49[_0x9026('0x5f')][_0x9026('0x6a')],_[_0x9026('0x8a')](_0x339e49['body'],[_0x9026('0x6a'),'id'])||{})[_0x9026('0xbc')](function(_0x1c67ab){for(var _0x176d97=0x0;_0x176d97<_0x339e49[_0x9026('0x5f')][_0x9026('0x6a')][_0x9026('0x5b')];_0x176d97+=0x1){socket[_0x9026('0xbd')](_0x9026('0xbe'),{'UserId':Number(_0x339e49[_0x9026('0x5f')][_0x9026('0x6a')][_0x176d97]),'MailAccountId':Number(_0x339e49[_0x9026('0x60')]['id'])});}return _0x1c67ab;});}})[_0x9026('0x22')](respondWithResult(_0x2ee6c4,null))[_0x9026('0x2b')](handleError(_0x2ee6c4,null));};exports[_0x9026('0xbf')]=function(_0xe746fd,_0x1163d1,_0x3134be){return db['MailAccount']['find']({'where':{'id':_0xe746fd[_0x9026('0x60')]['id']}})[_0x9026('0x22')](handleEntityNotFound(_0x1163d1,null))['then'](function(_0x2acbe1){if(_0x2acbe1){return _0x2acbe1[_0x9026('0xbf')](_0xe746fd[_0x9026('0x48')]['ids'])['then'](function(){if(_['isArray'](_0xe746fd[_0x9026('0x48')][_0x9026('0x6a')])){for(var _0x5df099=0x0;_0x5df099<_0xe746fd[_0x9026('0x48')][_0x9026('0x6a')]['length'];_0x5df099+=0x1){socket['emit'](_0x9026('0xc0'),{'UserId':Number(_0xe746fd[_0x9026('0x48')][_0x9026('0x6a')][_0x5df099]),'MailAccountId':Number(_0xe746fd[_0x9026('0x60')]['id'])});}}else{socket['emit'](_0x9026('0xc0'),{'UserId':Number(_0xe746fd['query'][_0x9026('0x6a')]),'MailAccountId':Number(_0xe746fd[_0x9026('0x60')]['id'])});}});}})[_0x9026('0x22')](respondWithStatusCode(_0x1163d1,null))[_0x9026('0x2b')](handleError(_0x1163d1,null));};exports[_0x9026('0xc1')]=function(_0x2bba51,_0x1923d8,_0x690d5d){var _0x335b68={};var _0x22de67={};var _0x120fe0;var _0x52a782;return db[_0x9026('0x54')][_0x9026('0x64')]({'where':{'id':_0x2bba51[_0x9026('0x60')]['id']}})[_0x9026('0x22')](handleEntityNotFound(_0x1923d8,null))[_0x9026('0x22')](function(_0x4b9d10){if(_0x4b9d10){_0x120fe0=_0x4b9d10;_0x22de67['model']=_[_0x9026('0x49')](db[_0x9026('0x8e')]['rawAttributes']);_0x22de67[_0x9026('0x48')]=_[_0x9026('0x49')](_0x2bba51[_0x9026('0x48')]);_0x22de67[_0x9026('0x4a')]=_['intersection'](_0x22de67[_0x9026('0x46')],_0x22de67['query']);_0x335b68[_0x9026('0x4c')]=_[_0x9026('0x5a')](_0x22de67[_0x9026('0x46')],qs[_0x9026('0x4b')](_0x2bba51[_0x9026('0x48')]['fields']));_0x335b68[_0x9026('0x4c')]=_0x335b68[_0x9026('0x4c')]['length']?_0x335b68[_0x9026('0x4c')]:_0x22de67[_0x9026('0x46')];_0x335b68[_0x9026('0x4f')]=qs[_0x9026('0x66')](_0x2bba51[_0x9026('0x48')][_0x9026('0x66')]);_0x335b68[_0x9026('0x50')]=qs[_0x9026('0x4a')](_[_0x9026('0x67')](_0x2bba51[_0x9026('0x48')],_0x22de67[_0x9026('0x4a')]));if(_0x2bba51[_0x9026('0x48')][_0x9026('0x52')]){_0x335b68[_0x9026('0x50')]=_[_0x9026('0x53')](_0x335b68[_0x9026('0x50')],{'$or':_[_0x9026('0x47')](_0x335b68[_0x9026('0x4c')],function(_0x476ae3){var _0x4d1a79={};_0x4d1a79[_0x476ae3]={'$like':'%'+_0x2bba51[_0x9026('0x48')][_0x9026('0x52')]+'%'};return _0x4d1a79;})});}_0x335b68=_[_0x9026('0x53')]({},_0x335b68,_0x2bba51[_0x9026('0x5d')]);return _0x120fe0['getAgents'](_0x335b68);}})['then'](function(_0x52ec18){if(_0x52ec18){_0x52a782=_0x52ec18[_0x9026('0x5b')];if(!_0x2bba51['query'][_0x9026('0x4d')](_0x9026('0x4e'))){_0x335b68[_0x9026('0x32')]=qs[_0x9026('0x32')](_0x2bba51['query'][_0x9026('0x32')]);_0x335b68[_0x9026('0x30')]=qs[_0x9026('0x30')](_0x2bba51[_0x9026('0x48')][_0x9026('0x30')]);}return _0x120fe0[_0x9026('0xc1')](_0x335b68);}})[_0x9026('0x22')](function(_0x313cc3){if(_0x313cc3){return _0x313cc3?{'count':_0x52a782,'rows':_0x313cc3}:null;}})[_0x9026('0x22')](respondWithResult(_0x1923d8,null))[_0x9026('0x2b')](handleError(_0x1923d8,null));}; \ No newline at end of file +var _0x5433=['then','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','MailAccounts','UserProfileResource','name','MailServerIn','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','VIRTUAL','merge','includeAll','include','rows','params','Imap','MailServerOut','Smtp','keys','body','find','describe','MailAccountId','Disposition','create','getDispositions','findOne','sort','pick','options','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','email','isNil','active','description','cauthentication','user','cuser','password','authentication','host','port','service','cservice','pass','cpassword','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','send','getApplications','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','CmList','List','Contacts','DESC','from','format','attachments','join','server/files/attachments','basename','auth','secure','sendMail','List\x20not\x20found','ListId','attach','messageId','Messages','verifySmtp','Sequelize','ValidationError','addAgents','spread','emit','removeAgents','isArray','userMailAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','html-to-text','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./mailAccount.socket','jayson/promise','client','http','request'];(function(_0xe98395,_0x2b7f88){var _0xe4a8d5=function(_0x1b5d33){while(--_0x1b5d33){_0xe98395['push'](_0xe98395['shift']());}};_0xe4a8d5(++_0x2b7f88);}(_0x5433,0x9f));var _0x3543=function(_0x107aac,_0xfc188b){_0x107aac=_0x107aac-0x0;var _0x3e4f70=_0x5433[_0x107aac];return _0x3e4f70;};'use strict';var emlformat=require(_0x3543('0x0'));var rimraf=require(_0x3543('0x1'));var zipdir=require(_0x3543('0x2'));var jsonpatch=require(_0x3543('0x3'));var rp=require(_0x3543('0x4'));var moment=require(_0x3543('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3543('0x6'));var util=require(_0x3543('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x3543('0x8'));var ejs=require(_0x3543('0x9'));var fs=require('fs');var fs_extra=require(_0x3543('0xa'));var _=require(_0x3543('0xb'));var squel=require('squel');var crypto=require(_0x3543('0xc'));var jsforce=require(_0x3543('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3543('0x8'));var querystring=require(_0x3543('0xe'));var Papa=require(_0x3543('0xf'));var htmlToText=require(_0x3543('0x10'));var juice=require('juice');var Redis=require(_0x3543('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3543('0x12'));var as=require(_0x3543('0x13'));var hardwareService=require(_0x3543('0x14'));var logger=require(_0x3543('0x15'))(_0x3543('0x16'));var utils=require(_0x3543('0x17'));var config=require(_0x3543('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x3543('0x19')]=_['defaults'](config[_0x3543('0x19')],{'host':_0x3543('0x1a'),'port':0x18eb});var socket=require(_0x3543('0x1b'))(new Redis(config['redis']));require(_0x3543('0x1c'))['register'](socket);var jayson=require(_0x3543('0x1d'));var client=jayson[_0x3543('0x1e')][_0x3543('0x1f')]({'port':0x232b});function respondWithRpcPromise(_0x1a1f7d,_0x4eccfb,_0x545e65,_0x39b8f2){return new BPromise(function(_0xb315bb,_0x50abb5){var _0x1fc1bc=_0x39b8f2||client;return _0x1fc1bc[_0x3543('0x20')](_0x1a1f7d,_0x545e65)[_0x3543('0x21')](function(_0x3ccf05){logger['info'](_0x3543('0x22'),_0x4eccfb,'request\x20sent');logger[_0x3543('0x23')](_0x3543('0x24'),_0x4eccfb,'request\x20sent',JSON[_0x3543('0x25')](_0x3ccf05));if(_0x3ccf05[_0x3543('0x26')]){if(_0x3ccf05[_0x3543('0x26')][_0x3543('0x27')]===0x1f4){logger[_0x3543('0x26')](_0x3543('0x22'),_0x4eccfb,_0x3ccf05[_0x3543('0x26')][_0x3543('0x28')]);return _0x50abb5(_0x3ccf05['error'][_0x3543('0x28')]);}logger[_0x3543('0x26')]('MailAccount,\x20%s,\x20%s',_0x4eccfb,_0x3ccf05[_0x3543('0x26')][_0x3543('0x28')]);return _0xb315bb(_0x3ccf05[_0x3543('0x26')][_0x3543('0x28')]);}else{logger[_0x3543('0x29')]('MailAccount,\x20%s,\x20%s',_0x4eccfb,_0x3543('0x2a'));_0xb315bb(_0x3ccf05[_0x3543('0x2b')][_0x3543('0x28')]);}})[_0x3543('0x2c')](function(_0x4e3e49){logger[_0x3543('0x26')](_0x3543('0x22'),_0x4eccfb,_0x4e3e49);_0x50abb5(_0x4e3e49);});});}function respondWithStatusCode(_0x317aa5,_0x1e2936){_0x1e2936=_0x1e2936||0xcc;return function(_0x3dce24){if(_0x3dce24){return _0x317aa5['sendStatus'](_0x1e2936);}return _0x317aa5[_0x3543('0x2d')](_0x1e2936)[_0x3543('0x2e')]();};}function respondWithResult(_0x37c1ba,_0x19c4c6){_0x19c4c6=_0x19c4c6||0xc8;return function(_0x5183a9){if(_0x5183a9){return _0x37c1ba['status'](_0x19c4c6)[_0x3543('0x2f')](_0x5183a9);}};}function respondWithFilteredResult(_0x564ff3,_0x473d0e){return function(_0x490ef0){if(_0x490ef0){var _0x48a480=typeof _0x473d0e[_0x3543('0x30')]===_0x3543('0x31')&&typeof _0x473d0e[_0x3543('0x32')]==='undefined';var _0x1a0e80=_0x490ef0[_0x3543('0x33')];var _0x41548=_0x48a480?0x0:_0x473d0e[_0x3543('0x30')];var _0x37231c=_0x48a480?_0x490ef0[_0x3543('0x33')]:_0x473d0e[_0x3543('0x30')]+_0x473d0e[_0x3543('0x32')];var _0x3dce56;if(_0x37231c>=_0x1a0e80){_0x37231c=_0x1a0e80;_0x3dce56=0xc8;}else{_0x3dce56=0xce;}_0x564ff3['status'](_0x3dce56);return _0x564ff3['set'](_0x3543('0x34'),_0x41548+'-'+_0x37231c+'/'+_0x1a0e80)[_0x3543('0x2f')](_0x490ef0);}return null;};}function patchUpdates(_0xa56fdb){return function(_0x460852){try{jsonpatch[_0x3543('0x35')](_0x460852,_0xa56fdb,!![]);}catch(_0x4416c4){return BPromise[_0x3543('0x36')](_0x4416c4);}return _0x460852[_0x3543('0x37')]();};}function saveUpdates(_0x14ec0a,_0xe663ba){return function(_0x326395){if(_0x326395){return _0x326395[_0x3543('0x38')](_0x14ec0a)[_0x3543('0x21')](function(_0xd493d6){return _0xd493d6;});}return null;};}function removeEntity(_0x146e85,_0x164ef8){return function(_0x995b78){if(_0x995b78){return _0x995b78[_0x3543('0x39')]()['then'](function(){var _0x178e13=_0x995b78['get']({'plain':!![]});var _0x1e5f57=_0x3543('0x3a');return db[_0x3543('0x3b')][_0x3543('0x39')]({'where':{'type':_0x1e5f57,'resourceId':_0x178e13['id']}})[_0x3543('0x21')](function(){return _0x995b78;});})['then'](function(){_0x146e85[_0x3543('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d7c8,_0x32cbe2){return function(_0x462b45){if(!_0x462b45){_0x4d7c8['sendStatus'](0x194);}return _0x462b45;};}function handleError(_0x32b570,_0x65f5d1){_0x65f5d1=_0x65f5d1||0x1f4;return function(_0x2bfead){logger[_0x3543('0x26')](_0x2bfead['stack']);if(_0x2bfead[_0x3543('0x3c')]){delete _0x2bfead['name'];}_0x32b570[_0x3543('0x2d')](_0x65f5d1)['send'](_0x2bfead);};}exports['index']=function(_0x559d30,_0x210c16){var _0x1177c={'include':[{'model':db[_0x3543('0x3d')],'as':'Imap'},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x3543('0x3e')],'as':_0x3543('0x3f')}]},_0x4de35b={},_0x344c6b={'count':0x0,'rows':[]};var _0x489ffb=_['map'](db[_0x3543('0x40')][_0x3543('0x41')],function(_0x58be7c){return{'name':_0x58be7c['fieldName'],'type':_0x58be7c[_0x3543('0x42')][_0x3543('0x43')]};});_0x4de35b[_0x3543('0x44')]=_[_0x3543('0x45')](_0x489ffb,'name');_0x4de35b['query']=_['keys'](_0x559d30[_0x3543('0x46')]);_0x4de35b[_0x3543('0x47')]=_[_0x3543('0x48')](_0x4de35b['model'],_0x4de35b['query']);_0x1177c[_0x3543('0x49')]=_[_0x3543('0x48')](_0x4de35b[_0x3543('0x44')],qs[_0x3543('0x4a')](_0x559d30[_0x3543('0x46')][_0x3543('0x4a')]));_0x1177c[_0x3543('0x49')]=_0x1177c[_0x3543('0x49')][_0x3543('0x4b')]?_0x1177c[_0x3543('0x49')]:_0x4de35b[_0x3543('0x44')];if(!_0x559d30['query'][_0x3543('0x4c')](_0x3543('0x4d'))){_0x1177c[_0x3543('0x32')]=qs[_0x3543('0x32')](_0x559d30[_0x3543('0x46')][_0x3543('0x32')]);_0x1177c[_0x3543('0x30')]=qs[_0x3543('0x30')](_0x559d30['query'][_0x3543('0x30')]);}_0x1177c[_0x3543('0x4e')]=qs['sort'](_0x559d30['query']['sort']);_0x1177c[_0x3543('0x4f')]=qs['filters'](_['pick'](_0x559d30[_0x3543('0x46')],_0x4de35b[_0x3543('0x47')]),_0x489ffb);if(_0x559d30[_0x3543('0x46')][_0x3543('0x50')]){_0x1177c[_0x3543('0x4f')]=_['merge'](_0x1177c['where'],{'$or':_['map'](_0x489ffb,function(_0x4c00f8){if(_0x4c00f8[_0x3543('0x42')]!==_0x3543('0x51')){var _0x13e0f2={};_0x13e0f2[_0x4c00f8[_0x3543('0x3c')]]={'$like':'%'+_0x559d30[_0x3543('0x46')]['filter']+'%'};return _0x13e0f2;}})});}_0x1177c=_[_0x3543('0x52')]({},_0x1177c,_0x559d30['options']);var _0x10becf={'where':_0x1177c['where']};return db[_0x3543('0x40')][_0x3543('0x33')](_0x10becf)[_0x3543('0x21')](function(_0x370a7b){_0x344c6b[_0x3543('0x33')]=_0x370a7b;if(_0x559d30[_0x3543('0x46')][_0x3543('0x53')]){_0x1177c[_0x3543('0x54')]=[{'all':!![]}];}return db[_0x3543('0x40')]['findAll'](_0x1177c);})[_0x3543('0x21')](function(_0x51c3b7){_0x344c6b[_0x3543('0x55')]=_0x51c3b7;return _0x344c6b;})['then'](respondWithFilteredResult(_0x210c16,_0x1177c))['catch'](handleError(_0x210c16,null));};exports['show']=function(_0x28db9d,_0xc97ce){var _0x397870={'raw':![],'where':{'id':_0x28db9d[_0x3543('0x56')]['id']},'include':[{'model':db[_0x3543('0x3d')],'as':_0x3543('0x57')},{'model':db[_0x3543('0x58')],'as':_0x3543('0x59')},{'model':db[_0x3543('0x3e')],'as':'mandatoryDispositionPause'}]},_0x1acc20={};_0x1acc20[_0x3543('0x44')]=_['keys'](db[_0x3543('0x40')][_0x3543('0x41')]);_0x1acc20[_0x3543('0x46')]=_[_0x3543('0x5a')](_0x28db9d[_0x3543('0x46')]);_0x1acc20['filters']=_[_0x3543('0x48')](_0x1acc20[_0x3543('0x44')],_0x1acc20['query']);_0x397870[_0x3543('0x49')]=_['intersection'](_0x1acc20['model'],qs[_0x3543('0x4a')](_0x28db9d[_0x3543('0x46')][_0x3543('0x4a')]));_0x397870[_0x3543('0x49')]=_0x397870[_0x3543('0x49')][_0x3543('0x4b')]?_0x397870[_0x3543('0x49')]:_0x1acc20['model'];if(_0x28db9d['query'][_0x3543('0x53')]){_0x397870[_0x3543('0x54')]=[{'all':!![]}];}_0x397870=_['merge']({},_0x397870,_0x28db9d['options']);return db[_0x3543('0x40')]['find'](_0x397870)['then'](handleEntityNotFound(_0xc97ce,null))[_0x3543('0x21')](respondWithResult(_0xc97ce,null))[_0x3543('0x2c')](handleError(_0xc97ce,null));};exports['update']=function(_0x4b21b7,_0x3da85a){if(_0x4b21b7[_0x3543('0x5b')]['id']){delete _0x4b21b7['body']['id'];}return db[_0x3543('0x40')][_0x3543('0x5c')]({'where':{'id':_0x4b21b7[_0x3543('0x56')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x3543('0x58')],'as':_0x3543('0x59')},{'model':db['Pause'],'as':_0x3543('0x3f')}]})[_0x3543('0x21')](handleEntityNotFound(_0x3da85a,null))[_0x3543('0x21')](saveUpdates(_0x4b21b7[_0x3543('0x5b')],null))[_0x3543('0x21')](function(_0x5d5bf9){if(_0x5d5bf9&&_0x4b21b7[_0x3543('0x5b')]['Imap']){return db['MailServerIn'][_0x3543('0x38')](_0x4b21b7[_0x3543('0x5b')][_0x3543('0x57')],{'where':{'MailAccountId':_0x5d5bf9['id']}})[_0x3543('0x21')](function(){return _0x5d5bf9;});}return _0x5d5bf9;})['then'](function(_0x1894ef){if(_0x1894ef&&_0x4b21b7[_0x3543('0x5b')][_0x3543('0x59')]){return db[_0x3543('0x58')][_0x3543('0x38')](_0x4b21b7['body'][_0x3543('0x59')],{'where':{'MailAccountId':_0x1894ef['id']}})[_0x3543('0x21')](function(){return _0x1894ef;});}return _0x1894ef;})[_0x3543('0x21')](respondWithResult(_0x3da85a,null))[_0x3543('0x2c')](handleError(_0x3da85a,null));};exports[_0x3543('0x5d')]=function(_0x49755a,_0x4a6e10){return db[_0x3543('0x40')][_0x3543('0x5d')]()[_0x3543('0x21')](respondWithResult(_0x4a6e10,null))[_0x3543('0x2c')](handleError(_0x4a6e10,null));};exports['addDisposition']=function(_0xc48328,_0x529e2c,_0x2c6581){if(_0xc48328[_0x3543('0x5b')]['id']){delete _0xc48328[_0x3543('0x5b')]['id'];}return db[_0x3543('0x40')][_0x3543('0x5c')]({'where':{'id':_0xc48328[_0x3543('0x56')]['id']}})[_0x3543('0x21')](handleEntityNotFound(_0x529e2c,null))[_0x3543('0x21')](function(_0x57f676){if(_0x57f676){_0xc48328[_0x3543('0x5b')][_0x3543('0x5e')]=_0x57f676['id'];return db[_0x3543('0x5f')][_0x3543('0x60')](_0xc48328[_0x3543('0x5b')]);}})[_0x3543('0x21')](respondWithResult(_0x529e2c,null))['catch'](handleError(_0x529e2c,null));};exports[_0x3543('0x61')]=function(_0x54ac94,_0x158c04,_0x33b17a){var _0xde71f5={'raw':![],'where':{}};var _0xfbb93e={};var _0x3b60a6={'count':0x0,'rows':[]};return db[_0x3543('0x40')][_0x3543('0x62')]({'where':{'id':_0x54ac94[_0x3543('0x56')]['id']}})[_0x3543('0x21')](handleEntityNotFound(_0x158c04,null))[_0x3543('0x21')](function(_0x529139){if(_0x529139){_0xfbb93e[_0x3543('0x44')]=_['keys'](db[_0x3543('0x5f')]['rawAttributes']);_0xfbb93e[_0x3543('0x46')]=_[_0x3543('0x5a')](_0x54ac94[_0x3543('0x46')]);_0xfbb93e['filters']=_[_0x3543('0x48')](_0xfbb93e[_0x3543('0x44')],_0xfbb93e['query']);_0xde71f5[_0x3543('0x49')]=_[_0x3543('0x48')](_0xfbb93e[_0x3543('0x44')],qs[_0x3543('0x4a')](_0x54ac94[_0x3543('0x46')][_0x3543('0x4a')]));_0xde71f5['attributes']=_0xde71f5[_0x3543('0x49')][_0x3543('0x4b')]?_0xde71f5['attributes']:_0xfbb93e[_0x3543('0x44')];if(!_0x54ac94[_0x3543('0x46')][_0x3543('0x4c')](_0x3543('0x4d'))){_0xde71f5[_0x3543('0x32')]=qs['limit'](_0x54ac94[_0x3543('0x46')][_0x3543('0x32')]);_0xde71f5[_0x3543('0x30')]=qs[_0x3543('0x30')](_0x54ac94['query'][_0x3543('0x30')]);}_0xde71f5[_0x3543('0x4e')]=qs[_0x3543('0x63')](_0x54ac94[_0x3543('0x46')][_0x3543('0x63')]);_0xde71f5['where']=qs[_0x3543('0x47')](_[_0x3543('0x64')](_0x54ac94['query'],_0xfbb93e[_0x3543('0x47')]));_0xde71f5[_0x3543('0x4f')][_0x3543('0x5e')]=_0x529139['id'];if(_0x54ac94[_0x3543('0x46')][_0x3543('0x50')]){_0xde71f5[_0x3543('0x4f')]=_[_0x3543('0x52')](_0xde71f5[_0x3543('0x4f')],{'$or':_['map'](_0xde71f5[_0x3543('0x49')],function(_0x5f453f){var _0x5ca08b={};_0x5ca08b[_0x5f453f]={'$like':'%'+_0x54ac94[_0x3543('0x46')][_0x3543('0x50')]+'%'};return _0x5ca08b;})});}_0xde71f5=_['merge']({},_0xde71f5,_0x54ac94[_0x3543('0x65')]);return db['Disposition'][_0x3543('0x33')]({'where':_0xde71f5[_0x3543('0x4f')]})['then'](function(_0x5a3894){_0x3b60a6['count']=_0x5a3894;if(_0x54ac94['query'][_0x3543('0x53')]){_0xde71f5['include']=[{'all':!![]}];}return db[_0x3543('0x5f')][_0x3543('0x66')](_0xde71f5);})[_0x3543('0x21')](function(_0x5a015a){_0x3b60a6[_0x3543('0x55')]=_0x5a015a;return _0x3b60a6;});}})[_0x3543('0x21')](respondWithFilteredResult(_0x158c04,_0xde71f5))['catch'](handleError(_0x158c04,null));};exports[_0x3543('0x67')]=function(_0x4054a1,_0x328a56,_0x50acdf){return db['MailAccount'][_0x3543('0x5c')]({'where':{'id':_0x4054a1[_0x3543('0x56')]['id']}})[_0x3543('0x21')](handleEntityNotFound(_0x328a56,null))[_0x3543('0x21')](function(_0x2caa07){if(_0x2caa07){return _0x2caa07[_0x3543('0x67')](_0x4054a1['query'][_0x3543('0x68')]);}})[_0x3543('0x21')](respondWithStatusCode(_0x328a56,null))[_0x3543('0x2c')](handleError(_0x328a56,null));};exports[_0x3543('0x69')]=function(_0x1fb05d,_0x42ed50,_0x3f4b59){if(_0x1fb05d[_0x3543('0x5b')]['id']){delete _0x1fb05d[_0x3543('0x5b')]['id'];}return db['MailAccount'][_0x3543('0x5c')]({'where':{'id':_0x1fb05d[_0x3543('0x56')]['id']}})['then'](handleEntityNotFound(_0x42ed50,null))[_0x3543('0x21')](function(_0x11146b){if(_0x11146b){_0x1fb05d['body'][_0x3543('0x5e')]=_0x11146b['id'];return db[_0x3543('0x6a')]['create'](_0x1fb05d['body']);}})[_0x3543('0x21')](respondWithResult(_0x42ed50,null))[_0x3543('0x2c')](handleError(_0x42ed50,null));};exports[_0x3543('0x6b')]=function(_0x1a7079,_0x3dec45,_0x3fb076){var _0x2fc627={'raw':![],'where':{}};var _0x16c692={};var _0x4c1f44={'count':0x0,'rows':[]};return db[_0x3543('0x40')]['findOne']({'where':{'id':_0x1a7079[_0x3543('0x56')]['id']}})[_0x3543('0x21')](handleEntityNotFound(_0x3dec45,null))[_0x3543('0x21')](function(_0x54b179){if(_0x54b179){_0x16c692[_0x3543('0x44')]=_[_0x3543('0x5a')](db['CannedAnswer']['rawAttributes']);_0x16c692['query']=_[_0x3543('0x5a')](_0x1a7079[_0x3543('0x46')]);_0x16c692[_0x3543('0x47')]=_['intersection'](_0x16c692['model'],_0x16c692[_0x3543('0x46')]);_0x2fc627[_0x3543('0x49')]=_['intersection'](_0x16c692['model'],qs['fields'](_0x1a7079[_0x3543('0x46')][_0x3543('0x4a')]));_0x2fc627[_0x3543('0x49')]=_0x2fc627[_0x3543('0x49')]['length']?_0x2fc627[_0x3543('0x49')]:_0x16c692[_0x3543('0x44')];if(!_0x1a7079[_0x3543('0x46')][_0x3543('0x4c')](_0x3543('0x4d'))){_0x2fc627['limit']=qs['limit'](_0x1a7079[_0x3543('0x46')][_0x3543('0x32')]);_0x2fc627['offset']=qs[_0x3543('0x30')](_0x1a7079[_0x3543('0x46')][_0x3543('0x30')]);}_0x2fc627[_0x3543('0x4e')]=qs[_0x3543('0x63')](_0x1a7079['query'][_0x3543('0x63')]);_0x2fc627[_0x3543('0x4f')]=qs[_0x3543('0x47')](_[_0x3543('0x64')](_0x1a7079[_0x3543('0x46')],_0x16c692[_0x3543('0x47')]));_0x2fc627[_0x3543('0x4f')]['MailAccountId']=_0x54b179['id'];if(_0x1a7079[_0x3543('0x46')][_0x3543('0x50')]){_0x2fc627[_0x3543('0x4f')]=_[_0x3543('0x52')](_0x2fc627[_0x3543('0x4f')],{'$or':_[_0x3543('0x45')](_0x2fc627[_0x3543('0x49')],function(_0x2bcc91){var _0x528e16={};_0x528e16[_0x2bcc91]={'$like':'%'+_0x1a7079[_0x3543('0x46')][_0x3543('0x50')]+'%'};return _0x528e16;})});}_0x2fc627=_['merge']({},_0x2fc627,_0x1a7079['options']);return db[_0x3543('0x6a')][_0x3543('0x33')]({'where':_0x2fc627[_0x3543('0x4f')]})[_0x3543('0x21')](function(_0xa03e39){_0x4c1f44[_0x3543('0x33')]=_0xa03e39;if(_0x1a7079['query'][_0x3543('0x53')]){_0x2fc627['include']=[{'all':!![]}];}return db[_0x3543('0x6a')][_0x3543('0x66')](_0x2fc627);})[_0x3543('0x21')](function(_0x30027f){_0x4c1f44[_0x3543('0x55')]=_0x30027f;return _0x4c1f44;});}})[_0x3543('0x21')](respondWithFilteredResult(_0x3dec45,_0x2fc627))[_0x3543('0x2c')](handleError(_0x3dec45,null));};exports['removeAnswers']=function(_0xa7149c,_0x5672bc,_0x4db881){return db[_0x3543('0x40')][_0x3543('0x5c')]({'where':{'id':_0xa7149c[_0x3543('0x56')]['id']}})['then'](handleEntityNotFound(_0x5672bc,null))[_0x3543('0x21')](function(_0x1b060f){if(_0x1b060f){return _0x1b060f['removeAnswers'](_0xa7149c[_0x3543('0x46')]['ids']);}})[_0x3543('0x21')](respondWithStatusCode(_0x5672bc,null))['catch'](handleError(_0x5672bc,null));};exports['create']=function(_0x140808,_0x103c54){var _0x254e66={'name':_0x140808[_0x3543('0x5b')][_0x3543('0x3c')],'key':_0x140808[_0x3543('0x5b')][_0x3543('0x43')],'email':_0x140808[_0x3543('0x5b')][_0x3543('0x6c')],'ListId':_0x140808[_0x3543('0x5b')]['ListId'],'active':!_[_0x3543('0x6d')](_0x140808[_0x3543('0x5b')][_0x3543('0x6e')])?_0x140808[_0x3543('0x5b')]['active']:!![],'description':_0x140808[_0x3543('0x5b')][_0x3543('0x6f')]||null,'Imap':{},'Smtp':{}};if(_[_0x3543('0x6d')](_0x140808['body']['cservice'])){if(_0x140808[_0x3543('0x5b')][_0x3543('0x70')]){_0x254e66[_0x3543('0x57')]['user']=_0x254e66[_0x3543('0x59')][_0x3543('0x71')]=_0x140808[_0x3543('0x5b')][_0x3543('0x72')];_0x254e66['Imap'][_0x3543('0x73')]=_0x254e66['Smtp']['pass']=_0x140808['body']['cpassword'];}else{_0x254e66[_0x3543('0x57')][_0x3543('0x74')]=_0x254e66[_0x3543('0x59')][_0x3543('0x74')]=![];}_0x254e66['Imap']['host']=_0x140808['body'][_0x3543('0x57')][_0x3543('0x75')];_0x254e66[_0x3543('0x57')][_0x3543('0x76')]=_0x140808[_0x3543('0x5b')][_0x3543('0x57')][_0x3543('0x76')];_0x254e66[_0x3543('0x59')]['host']=_0x140808['body'][_0x3543('0x59')][_0x3543('0x75')];_0x254e66[_0x3543('0x59')]['port']=_0x140808[_0x3543('0x5b')][_0x3543('0x59')][_0x3543('0x76')];}else{_0x254e66[_0x3543('0x57')]['service']=_0x254e66[_0x3543('0x59')][_0x3543('0x77')]=_0x140808[_0x3543('0x5b')][_0x3543('0x78')];_0x254e66[_0x3543('0x57')][_0x3543('0x71')]=_0x254e66[_0x3543('0x59')][_0x3543('0x71')]=_0x140808['body'][_0x3543('0x72')];_0x254e66[_0x3543('0x57')]['password']=_0x254e66[_0x3543('0x59')][_0x3543('0x79')]=_0x140808[_0x3543('0x5b')][_0x3543('0x7a')];}return db[_0x3543('0x40')]['create'](_0x254e66,{'include':[{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x3543('0x3d')],'as':_0x3543('0x57')}]})[_0x3543('0x21')](function(_0x54b91f){var _0x1e70ea=_0x140808[_0x3543('0x71')][_0x3543('0x7b')]({'plain':!![]});if(!_0x1e70ea)throw new Error(_0x3543('0x7c'));if(_0x1e70ea['role']===_0x3543('0x71')){var _0x2fea26=_0x54b91f[_0x3543('0x7b')]({'plain':!![]});return db[_0x3543('0x7d')]['find']({'where':{'name':_0x3543('0x3a'),'userProfileId':_0x1e70ea[_0x3543('0x7e')]},'raw':!![]})[_0x3543('0x21')](function(_0x7d3538){if(_0x7d3538&&_0x7d3538[_0x3543('0x7f')]===0x0){return db['UserProfileResource']['create']({'name':_0x2fea26[_0x3543('0x3c')],'resourceId':_0x2fea26['id'],'type':_0x7d3538[_0x3543('0x3c')],'sectionId':_0x7d3538['id']},{})[_0x3543('0x21')](function(){return _0x54b91f;});}else{return _0x54b91f;}})[_0x3543('0x2c')](function(_0x7cc6fa){logger[_0x3543('0x26')](_0x3543('0x80'),_0x7cc6fa);throw _0x7cc6fa;});}return _0x54b91f;})[_0x3543('0x21')](respondWithResult(_0x103c54,0xc9))[_0x3543('0x2c')](handleError(_0x103c54,null));};exports[_0x3543('0x81')]=function(_0x4c2e09,_0x2620c0,_0x17a5e9){return db[_0x3543('0x40')][_0x3543('0x62')]({'where':{'id':_0x4c2e09[_0x3543('0x56')]['id']}})[_0x3543('0x21')](handleEntityNotFound(_0x2620c0,null))[_0x3543('0x21')](function(_0x157d41){if(_0x157d41){return _0x157d41[_0x3543('0x81')]();}return null;})['then'](respondWithResult(_0x2620c0,null))['catch'](handleError(_0x2620c0,null));};exports['addImap']=function(_0x1e12bc,_0x1e1592,_0x84996d){if(_0x1e12bc[_0x3543('0x5b')]['id']){delete _0x1e12bc[_0x3543('0x5b')]['id'];}return db[_0x3543('0x40')][_0x3543('0x5c')]({'where':{'id':_0x1e12bc[_0x3543('0x56')]['id']}})[_0x3543('0x21')](handleEntityNotFound(_0x1e1592,null))[_0x3543('0x21')](function(_0x3b62ee){if(_0x3b62ee){_0x1e12bc[_0x3543('0x5b')][_0x3543('0x5e')]=_0x3b62ee['id'];return db[_0x3543('0x3d')][_0x3543('0x60')](_0x1e12bc[_0x3543('0x5b')]);}})[_0x3543('0x21')](respondWithResult(_0x1e1592,null))[_0x3543('0x2c')](handleError(_0x1e1592,null));};exports['removeImap']=function(_0xccfb55,_0x33a1fb,_0x59095f){return db[_0x3543('0x40')][_0x3543('0x62')]({'where':{'id':_0xccfb55[_0x3543('0x56')]['id']}})[_0x3543('0x21')](handleEntityNotFound(_0x33a1fb,null))[_0x3543('0x21')](function(_0x5ea096){if(_0x5ea096){return _0x5ea096[_0x3543('0x82')](null);}return null;})[_0x3543('0x21')](respondWithStatusCode(_0x33a1fb,null))[_0x3543('0x2c')](handleError(_0x33a1fb,null));};exports[_0x3543('0x83')]=function(_0x4dc168,_0xd62c75,_0x3f60b7){return db[_0x3543('0x40')][_0x3543('0x62')]({'where':{'id':_0x4dc168[_0x3543('0x56')]['id']}})[_0x3543('0x21')](handleEntityNotFound(_0xd62c75,null))[_0x3543('0x21')](function(_0x328479){if(_0x328479){return _0x328479[_0x3543('0x83')]();}return null;})[_0x3543('0x21')](respondWithResult(_0xd62c75,null))[_0x3543('0x2c')](handleError(_0xd62c75,null));};exports[_0x3543('0x84')]=function(_0x4eea13,_0x525819,_0x5e9a0a){if(_0x4eea13['body']['id']){delete _0x4eea13['body']['id'];}return db[_0x3543('0x40')][_0x3543('0x5c')]({'where':{'id':_0x4eea13['params']['id']}})[_0x3543('0x21')](handleEntityNotFound(_0x525819,null))['then'](function(_0x23d49a){if(_0x23d49a){_0x4eea13[_0x3543('0x5b')]['MailAccountId']=_0x23d49a['id'];return db[_0x3543('0x58')]['create'](_0x4eea13[_0x3543('0x5b')]);}})[_0x3543('0x21')](respondWithResult(_0x525819,null))['catch'](handleError(_0x525819,null));};exports[_0x3543('0x85')]=function(_0x16ba0b,_0x48a931,_0x42908d){return db[_0x3543('0x40')]['findOne']({'where':{'id':_0x16ba0b[_0x3543('0x56')]['id']}})[_0x3543('0x21')](handleEntityNotFound(_0x48a931,null))['then'](function(_0x569b5d){if(_0x569b5d){return _0x569b5d[_0x3543('0x86')](null);}return null;})[_0x3543('0x21')](respondWithStatusCode(_0x48a931,null))['catch'](handleError(_0x48a931,null));};exports[_0x3543('0x87')]=function(_0x5213bd,_0x2c4459,_0x351636){return db[_0x3543('0x88')][_0x3543('0x5c')]({'where':{'id':_0x5213bd[_0x3543('0x56')]['id']}})['then'](handleEntityNotFound(_0x2c4459,null))['then'](function(_0x402d93){if(_0x402d93){return _0x402d93[_0x3543('0x87')](_0x5213bd[_0x3543('0x5b')][_0x3543('0x68')],_[_0x3543('0x89')](_0x5213bd[_0x3543('0x5b')],[_0x3543('0x68'),'id'])||{});}})[_0x3543('0x21')](respondWithResult(_0x2c4459,null))['catch'](handleError(_0x2c4459,null));};exports[_0x3543('0x8a')]=function(_0x4d553f,_0x4ab81d,_0x51c6d2){var _0x2dbea5={'raw':![],'where':{}};var _0x75c0b={};var _0x48882c={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x4d553f[_0x3543('0x56')]['id']}})['then'](handleEntityNotFound(_0x4ab81d,null))['then'](function(_0x512c2c){if(_0x512c2c){_0x75c0b[_0x3543('0x44')]=_[_0x3543('0x5a')](db[_0x3543('0x88')][_0x3543('0x41')]);_0x75c0b[_0x3543('0x46')]=_[_0x3543('0x5a')](_0x4d553f[_0x3543('0x46')]);_0x75c0b[_0x3543('0x47')]=_['intersection'](_0x75c0b['model'],_0x75c0b[_0x3543('0x46')]);_0x2dbea5[_0x3543('0x49')]=_[_0x3543('0x48')](_0x75c0b[_0x3543('0x44')],qs['fields'](_0x4d553f[_0x3543('0x46')][_0x3543('0x4a')]));_0x2dbea5[_0x3543('0x49')]=_0x2dbea5[_0x3543('0x49')][_0x3543('0x4b')]?_0x2dbea5['attributes']:_0x75c0b[_0x3543('0x44')];if(!_0x4d553f[_0x3543('0x46')][_0x3543('0x4c')](_0x3543('0x4d'))){_0x2dbea5['limit']=qs[_0x3543('0x32')](_0x4d553f['query'][_0x3543('0x32')]);_0x2dbea5[_0x3543('0x30')]=qs[_0x3543('0x30')](_0x4d553f['query'][_0x3543('0x30')]);}_0x2dbea5[_0x3543('0x4e')]=qs[_0x3543('0x63')](_0x4d553f['query'][_0x3543('0x63')]);_0x2dbea5[_0x3543('0x4f')]=qs[_0x3543('0x47')](_[_0x3543('0x64')](_0x4d553f[_0x3543('0x46')],_0x75c0b['filters']));_0x2dbea5[_0x3543('0x4f')][_0x3543('0x5e')]=_0x512c2c['id'];if(_0x4d553f[_0x3543('0x46')][_0x3543('0x50')]){_0x2dbea5[_0x3543('0x4f')]=_[_0x3543('0x52')](_0x2dbea5[_0x3543('0x4f')],{'$or':_[_0x3543('0x45')](_0x2dbea5[_0x3543('0x49')],function(_0x358de9){var _0x30daf6={};_0x30daf6[_0x358de9]={'$like':'%'+_0x4d553f[_0x3543('0x46')][_0x3543('0x50')]+'%'};return _0x30daf6;})});}_0x2dbea5=_['merge']({},_0x2dbea5,_0x4d553f['options']);return db[_0x3543('0x88')][_0x3543('0x33')]({'where':_0x2dbea5[_0x3543('0x4f')]})[_0x3543('0x21')](function(_0x312abf){_0x48882c[_0x3543('0x33')]=_0x312abf;if(_0x4d553f['query']['includeAll']){_0x2dbea5[_0x3543('0x54')]=[{'model':db[_0x3543('0x8b')],'as':_0x3543('0x8c'),'required':![]},{'model':db[_0x3543('0x8d')],'as':_0x3543('0x8e'),'attributes':['name',_0x3543('0x8f'),_0x3543('0x90')],'required':![]},{'model':db[_0x3543('0x91')],'as':_0x3543('0x92'),'attributes':['id',_0x3543('0x3c'),_0x3543('0x93')],'where':_0x4d553f[_0x3543('0x46')][_0x3543('0x94')]?{'id':_0x4d553f[_0x3543('0x46')][_0x3543('0x94')]}:undefined,'required':_0x4d553f[_0x3543('0x46')]['tag']?!![]:![]}];}return db[_0x3543('0x88')][_0x3543('0x66')](_0x2dbea5);})['then'](function(_0x28dcc7){_0x48882c[_0x3543('0x55')]=_0x28dcc7;return _0x48882c;});}})[_0x3543('0x21')](respondWithFilteredResult(_0x4ab81d,_0x2dbea5))[_0x3543('0x2c')](handleError(_0x4ab81d,null));};exports[_0x3543('0x95')]=function addApplications(_0x598b60,_0x1216c4){var _0x1952e7=_0x598b60[_0x3543('0x56')]['id'];var _0x29e806=_0x598b60[_0x3543('0x5b')];var _0x3bc9cb=0xc8;var _0x2952a7=null;return db['sequelize']['transaction']({'isolationLevel':db['sequelize']['Transaction'][_0x3543('0x96')][_0x3543('0x97')]},function(_0x4cfe38){return db[_0x3543('0x40')][_0x3543('0x62')]({'where':{'id':_0x1952e7},'transaction':_0x4cfe38})[_0x3543('0x21')](function(_0x1df034){if(_0x1df034){return db[_0x3543('0x98')]['destroy']({'where':{'MailAccountId':_0x1952e7},'transaction':_0x4cfe38})[_0x3543('0x21')](function(){var _0x4fd1ac=_[_0x3543('0x45')](_0x29e806,function(_0xf6790a){_0xf6790a[_0x3543('0x5e')]=_0x1952e7;return _0xf6790a;});return db[_0x3543('0x98')][_0x3543('0x99')](_0x4fd1ac,{'transaction':_0x4cfe38});});}else{_0x3bc9cb=0x194;_0x2952a7=[];}});})[_0x3543('0x21')](function(){if(_0x3bc9cb!==0x194){return db[_0x3543('0x98')][_0x3543('0x9a')]({'where':{'MailAccountId':_0x1952e7},'order':'priority'})[_0x3543('0x21')](function(_0x1c2595){_0x2952a7=_0x1c2595;});}})[_0x3543('0x2c')](function(_0x32ba9d){_0x3bc9cb=0x1f4;logger[_0x3543('0x26')](_0x32ba9d['stack']);if(_0x32ba9d[_0x3543('0x3c')]){delete _0x32ba9d[_0x3543('0x3c')];}_0x2952a7=_0x32ba9d;})['finally'](function(){if(_0x2952a7===null){_0x1216c4['sendStatus'](_0x3bc9cb);}else{if(_0x3bc9cb===0x1f4){_0x1216c4[_0x3543('0x2d')](_0x3bc9cb)[_0x3543('0x9b')](_0x2952a7);}else{_0x1216c4[_0x3543('0x2d')](_0x3bc9cb)[_0x3543('0x2f')](_0x2952a7);}}});};exports['getApplications']=function(_0x43187d,_0x552563,_0x473996){var _0x53bbc0={};var _0x4478d3={};var _0x102c96;var _0x3e8c9b;return db[_0x3543('0x40')][_0x3543('0x62')]({'where':{'id':_0x43187d['params']['id']}})[_0x3543('0x21')](handleEntityNotFound(_0x552563,null))[_0x3543('0x21')](function(_0x3c356a){if(_0x3c356a){_0x102c96=_0x3c356a;_0x4478d3[_0x3543('0x44')]=_['keys'](db[_0x3543('0x98')]['rawAttributes']);_0x4478d3['query']=_['keys'](_0x43187d[_0x3543('0x46')]);_0x4478d3[_0x3543('0x47')]=_[_0x3543('0x48')](_0x4478d3[_0x3543('0x44')],_0x4478d3[_0x3543('0x46')]);_0x53bbc0[_0x3543('0x49')]=_[_0x3543('0x48')](_0x4478d3['model'],qs[_0x3543('0x4a')](_0x43187d['query']['fields']));_0x53bbc0[_0x3543('0x49')]=_0x53bbc0[_0x3543('0x49')][_0x3543('0x4b')]?_0x53bbc0[_0x3543('0x49')]:_0x4478d3[_0x3543('0x44')];_0x53bbc0[_0x3543('0x4e')]=qs['sort'](_0x43187d[_0x3543('0x46')]['sort']);_0x53bbc0[_0x3543('0x4f')]=qs[_0x3543('0x47')](_[_0x3543('0x64')](_0x43187d[_0x3543('0x46')],_0x4478d3['filters']));if(_0x43187d[_0x3543('0x46')][_0x3543('0x50')]){_0x53bbc0[_0x3543('0x4f')]=_[_0x3543('0x52')](_0x53bbc0[_0x3543('0x4f')],{'$or':_[_0x3543('0x45')](_0x53bbc0[_0x3543('0x49')],function(_0x58c0ec){var _0x4e7785={};_0x4e7785[_0x58c0ec]={'$like':'%'+_0x43187d['query'][_0x3543('0x50')]+'%'};return _0x4e7785;})});}_0x53bbc0=_[_0x3543('0x52')]({},_0x53bbc0,_0x43187d[_0x3543('0x65')]);return _0x102c96['getApplications'](_0x53bbc0);}})[_0x3543('0x21')](function(_0x27d1e2){if(_0x27d1e2){_0x3e8c9b=_0x27d1e2[_0x3543('0x4b')];if(!_0x43187d['query']['hasOwnProperty'](_0x3543('0x4d'))){_0x53bbc0[_0x3543('0x32')]=qs[_0x3543('0x32')](_0x43187d[_0x3543('0x46')][_0x3543('0x32')]);_0x53bbc0['offset']=qs[_0x3543('0x30')](_0x43187d['query'][_0x3543('0x30')]);}return _0x102c96[_0x3543('0x9c')](_0x53bbc0);}})[_0x3543('0x21')](function(_0x59a530){if(_0x59a530){return _0x59a530?{'count':_0x3e8c9b,'rows':_0x59a530}:null;}})['then'](respondWithResult(_0x552563,null))['catch'](handleError(_0x552563,null));};exports[_0x3543('0x9d')]=function(_0x26a732,_0xecbab8,_0x3feab8){var _0x5ee050={'raw':!![],'where':{}};var _0x5656ae={};var _0x3a193b={'count':0x0,'rows':[]};return db[_0x3543('0x40')][_0x3543('0x62')]({'where':{'id':_0x26a732[_0x3543('0x56')]['id']}})[_0x3543('0x21')](handleEntityNotFound(_0xecbab8,null))[_0x3543('0x21')](function(_0x5c5231){if(_0x5c5231){_0x5656ae[_0x3543('0x44')]=_['keys'](db['MailMessage'][_0x3543('0x41')]);_0x5656ae['query']=_[_0x3543('0x5a')](_0x26a732[_0x3543('0x46')]);_0x5656ae[_0x3543('0x47')]=_[_0x3543('0x48')](_0x5656ae[_0x3543('0x44')],_0x5656ae[_0x3543('0x46')]);_0x5ee050['attributes']=_['intersection'](_0x5656ae['model'],qs[_0x3543('0x4a')](_0x26a732['query']['fields']));_0x5ee050[_0x3543('0x49')]=_0x5ee050[_0x3543('0x49')][_0x3543('0x4b')]?_0x5ee050[_0x3543('0x49')]:_0x5656ae[_0x3543('0x44')];if(!_0x26a732[_0x3543('0x46')][_0x3543('0x4c')]('nolimit')){_0x5ee050[_0x3543('0x32')]=qs[_0x3543('0x32')](_0x26a732['query'][_0x3543('0x32')]);_0x5ee050[_0x3543('0x30')]=qs[_0x3543('0x30')](_0x26a732[_0x3543('0x46')]['offset']);}_0x5ee050[_0x3543('0x4e')]=qs[_0x3543('0x63')](_0x26a732[_0x3543('0x46')][_0x3543('0x63')]);_0x5ee050['where']=qs[_0x3543('0x47')](_[_0x3543('0x64')](_0x26a732['query'],_0x5656ae[_0x3543('0x47')]));_0x5ee050[_0x3543('0x4f')][_0x3543('0x5e')]=_0x5c5231['id'];if(_0x26a732[_0x3543('0x46')][_0x3543('0x50')]){_0x5ee050[_0x3543('0x4f')]=_['merge'](_0x5ee050[_0x3543('0x4f')],{'$or':_[_0x3543('0x45')](_0x5ee050[_0x3543('0x49')],function(_0x8c1079){var _0x148485={};_0x148485[_0x8c1079]={'$like':'%'+_0x26a732[_0x3543('0x46')][_0x3543('0x50')]+'%'};return _0x148485;})});}if(_0x26a732[_0x3543('0x46')][_0x3543('0x9e')]){var _0x17aa9a=_0x26a732[_0x3543('0x46')][_0x3543('0x9e')][_0x3543('0x9f')](',');var _0x47863b={};_0x47863b[_0x17aa9a[0x0]]={'$gte':moment(_0x17aa9a[0x1])['format'](_0x3543('0xa0'))};_0x5ee050[_0x3543('0x4f')]=_[_0x3543('0x52')](_0x5ee050['where'],_0x47863b);}_0x5ee050=_[_0x3543('0x52')]({},_0x5ee050,_0x26a732[_0x3543('0x65')]);return db['MailMessage'][_0x3543('0x33')]({'where':_0x5ee050[_0x3543('0x4f')]})[_0x3543('0x21')](function(_0x354153){_0x3a193b['count']=_0x354153;if(_0x26a732[_0x3543('0x46')][_0x3543('0x53')]){_0x5ee050[_0x3543('0x54')]=[{'all':!![]}];}return db[_0x3543('0xa1')][_0x3543('0x66')](_0x5ee050);})[_0x3543('0x21')](function(_0x4d7283){if(_0x26a732[_0x3543('0x46')][_0x3543('0xa2')]===_0x3543('0xa3')){for(var _0x39fb30=0x0;_0x39fb30<_0x4d7283['length'];_0x39fb30++){_0x4d7283[_0x39fb30][_0x3543('0x5b')]=juice(_0x4d7283[_0x39fb30]['body']);}}_0x3a193b[_0x3543('0x55')]=_0x4d7283;return _0x3a193b;});}})[_0x3543('0x21')](respondWithFilteredResult(_0xecbab8,_0x5ee050))['catch'](handleError(_0xecbab8,null));};exports['send']=function(_0x75d706,_0x21837d,_0x31f08a){var _0x1b8d98,_0x1ebf7f={},_0x139045;if(_0x75d706['body']['to']){_0x139045=_0x75d706[_0x3543('0x5b')]['to'][_0x3543('0x9f')](',')[0x0];}return db['MailAccount'][_0x3543('0x5c')]({'where':{'id':_0x75d706['params']['id']},'include':[{'model':db[_0x3543('0xa4')],'as':_0x3543('0xa5'),'include':[{'model':db[_0x3543('0x8b')],'as':_0x3543('0xa6'),'where':{'email':_0x139045},'limit':0x1,'order':[['updatedAt',_0x3543('0xa7')]]}]},{'model':db[_0x3543('0x58')],'as':_0x3543('0x59'),'raw':!![]}]})[_0x3543('0x21')](handleEntityNotFound(_0x21837d,null))[_0x3543('0x21')](function(_0x5430a2){if(_0x5430a2){_0x1b8d98=_0x5430a2;if(_0x5430a2[_0x3543('0x59')]){if(_[_0x3543('0x6d')](_0x75d706[_0x3543('0x5b')][_0x3543('0xa8')])){_0x75d706[_0x3543('0x5b')]['from']=util[_0x3543('0xa9')]('%s\x20<%s>',_0x5430a2[_0x3543('0x3c')],_0x5430a2[_0x3543('0x6c')]||_0x5430a2[_0x3543('0x59')]['user']);}if(_0x75d706[_0x3543('0x5b')][_0x3543('0xaa')]&&_0x75d706[_0x3543('0x5b')][_0x3543('0xaa')][_0x3543('0x4b')]){for(var _0x4489fb=0x0;_0x4489fb<_0x75d706[_0x3543('0x5b')][_0x3543('0xaa')][_0x3543('0x4b')];_0x4489fb+=0x1){_0x75d706[_0x3543('0x5b')][_0x3543('0xaa')][_0x4489fb]={'filename':_0x75d706[_0x3543('0x5b')][_0x3543('0xaa')][_0x4489fb][_0x3543('0x3c')],'path':path[_0x3543('0xab')](config['root'],_0x3543('0xac'),_0x75d706[_0x3543('0x5b')][_0x3543('0xaa')][_0x4489fb][_0x3543('0xad')])};}}var _0x9d61d9={'tls':{'rejectUnauthorized':![]}};if(_[_0x3543('0x6d')](_0x5430a2['Smtp'][_0x3543('0x77')])){if(_0x5430a2[_0x3543('0x59')][_0x3543('0x74')]){_0x9d61d9[_0x3543('0xae')]={'user':_0x5430a2[_0x3543('0x59')]['user'],'pass':_0x5430a2[_0x3543('0x59')][_0x3543('0x79')]};}_0x9d61d9['host']=_0x5430a2['Smtp'][_0x3543('0x75')];_0x9d61d9[_0x3543('0x76')]=_0x5430a2[_0x3543('0x59')][_0x3543('0x76')];_0x9d61d9[_0x3543('0xaf')]=_0x5430a2[_0x3543('0x59')][_0x3543('0xaf')];}else{_0x9d61d9[_0x3543('0x77')]=_0x5430a2[_0x3543('0x59')]['service'];_0x9d61d9[_0x3543('0xae')]={'user':_0x5430a2[_0x3543('0x59')][_0x3543('0x71')],'pass':_0x5430a2[_0x3543('0x59')][_0x3543('0x79')]};}return respondWithRpcPromise('SendMail',_0x3543('0xb0'),{'account':_0x9d61d9,'message':_0x75d706[_0x3543('0x5b')]});}else{throw new Error(_0x3543('0xb1'));}}})[_0x3543('0x21')](function(_0x39eaef){if(_0x39eaef){_0x1ebf7f=_0x39eaef;if(_0x1b8d98[_0x3543('0xa5')]){if(_0x1b8d98[_0x3543('0xa5')][_0x3543('0xa6')]['length']){return _0x1b8d98[_0x3543('0xa5')][_0x3543('0xa6')][0x0];}else{return db['CmContact']['create'](_['defaults'](_0x75d706['body'],{'firstName':_0x75d706['body']['to'],'email':_0x75d706['body']['to'],'phone':_0x75d706[_0x3543('0x5b')]['to'],'ListId':_0x1b8d98[_0x3543('0xb2')]}));}}else{throw new Error(_0x3543('0xb1'));}}})[_0x3543('0x21')](function(_0x8fc48a){if(_0x8fc48a){var _0x56bde7={'UserId':_0x75d706[_0x3543('0x71')]['id'],'ContactId':_0x8fc48a['id'],'MailAccountId':_0x1b8d98['id'],'inReplyTo':_0x1ebf7f['messageId'],'to':_0x75d706[_0x3543('0x5b')][_0x3543('0xa8')],'cc':_0x75d706[_0x3543('0x5b')]['cc'],'subject':_0x75d706[_0x3543('0x5b')]['subject'],'attach':_0x75d706[_0x3543('0x5b')][_0x3543('0xb3')],'firstMsgDirection':'out','lastMsgAt':moment()['format'](_0x3543('0xa0')),'lastMsgDirection':'out','Messages':[_[_0x3543('0x52')](_0x75d706[_0x3543('0x5b')],{'messageId':_0x1ebf7f[_0x3543('0xb4')],'sentAt':moment()['format'](_0x3543('0xa0')),'read':!![],'MailAccountId':_0x1b8d98['id'],'UserId':_0x75d706[_0x3543('0x71')]['id'],'ContactId':_0x8fc48a['id']})]};if(_0x75d706[_0x3543('0x5b')]['Interaction']){_0x56bde7=_[_0x3543('0x52')](_0x56bde7,_0x75d706[_0x3543('0x5b')]['Interaction']);}return db[_0x3543('0x88')][_0x3543('0x60')](_0x56bde7,{'include':[{'model':db[_0x3543('0xa1')],'as':_0x3543('0xb5')}]});}})['then'](respondWithResult(_0x21837d,null))['catch'](handleError(_0x21837d,null));};exports[_0x3543('0xb6')]=function(_0x3373cf,_0xdc7438,_0x18494a){return db[_0x3543('0x40')][_0x3543('0x5c')]({'where':{'id':_0x3373cf[_0x3543('0x56')]['id']},'include':[{'model':db[_0x3543('0x58')],'as':'Smtp','raw':!![]}]})[_0x3543('0x21')](handleEntityNotFound(_0xdc7438,null))[_0x3543('0x21')](function(_0x52932c){if(_0x52932c&&_0x52932c[_0x3543('0x59')]){var _0x164388={'id':_0x52932c['id'],'tls':{'rejectUnauthorized':![]}};if(_0x52932c[_0x3543('0x59')][_0x3543('0x77')]){_0x164388[_0x3543('0x77')]=_0x52932c[_0x3543('0x59')][_0x3543('0x77')];}else{_0x164388[_0x3543('0x75')]=_0x52932c[_0x3543('0x59')][_0x3543('0x75')];_0x164388['port']=_0x52932c['Smtp'][_0x3543('0x76')];_0x164388['secure']=_0x52932c['Smtp'][_0x3543('0xaf')];}if(_0x52932c[_0x3543('0x59')][_0x3543('0x74')]){_0x164388[_0x3543('0xae')]={'user':_0x52932c[_0x3543('0x59')][_0x3543('0x71')],'pass':_0x52932c[_0x3543('0x59')]['pass']};}return respondWithRpcPromise('VerifySmtp',_0x3543('0xb6'),{'account':_0x164388});}})['then'](respondWithResult(_0xdc7438,null))[_0x3543('0x2c')](handleError(_0xdc7438,null));};exports[_0x3543('0x39')]=function(_0x598ca1,_0x4283ad){return db[_0x3543('0x40')]['find']({'where':{'id':_0x598ca1[_0x3543('0x56')]['id']}})[_0x3543('0x21')](handleEntityNotFound(_0x4283ad,null))[_0x3543('0x21')](function(_0x57ed53){if(_0x57ed53&&_0x57ed53[_0x3543('0x77')]){throw new db[(_0x3543('0xb7'))][(_0x3543('0xb8'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x57ed53;})[_0x3543('0x21')](removeEntity(_0x4283ad,null))['catch'](handleError(_0x4283ad,null));};exports[_0x3543('0xb9')]=function(_0x78205d,_0x59c6c7,_0x39b060){return db[_0x3543('0x40')]['find']({'where':{'id':_0x78205d[_0x3543('0x56')]['id']}})[_0x3543('0x21')](handleEntityNotFound(_0x59c6c7,null))[_0x3543('0x21')](function(_0x2c3f94){if(_0x2c3f94){return _0x2c3f94[_0x3543('0xb9')](_0x78205d[_0x3543('0x5b')][_0x3543('0x68')],_[_0x3543('0x89')](_0x78205d[_0x3543('0x5b')],[_0x3543('0x68'),'id'])||{})[_0x3543('0xba')](function(_0x5c0fdd){for(var _0x1b1a3f=0x0;_0x1b1a3f<_0x78205d[_0x3543('0x5b')][_0x3543('0x68')]['length'];_0x1b1a3f+=0x1){socket[_0x3543('0xbb')]('userMailAccount:save',{'UserId':Number(_0x78205d[_0x3543('0x5b')][_0x3543('0x68')][_0x1b1a3f]),'MailAccountId':Number(_0x78205d[_0x3543('0x56')]['id'])});}return _0x5c0fdd;});}})['then'](respondWithResult(_0x59c6c7,null))[_0x3543('0x2c')](handleError(_0x59c6c7,null));};exports[_0x3543('0xbc')]=function(_0x2ead73,_0x54887e,_0x52b820){return db[_0x3543('0x40')][_0x3543('0x5c')]({'where':{'id':_0x2ead73[_0x3543('0x56')]['id']}})[_0x3543('0x21')](handleEntityNotFound(_0x54887e,null))[_0x3543('0x21')](function(_0x36266c){if(_0x36266c){return _0x36266c[_0x3543('0xbc')](_0x2ead73[_0x3543('0x46')]['ids'])[_0x3543('0x21')](function(){if(_[_0x3543('0xbd')](_0x2ead73[_0x3543('0x46')]['ids'])){for(var _0x1433c3=0x0;_0x1433c3<_0x2ead73[_0x3543('0x46')]['ids'][_0x3543('0x4b')];_0x1433c3+=0x1){socket['emit']('userMailAccount:remove',{'UserId':Number(_0x2ead73[_0x3543('0x46')][_0x3543('0x68')][_0x1433c3]),'MailAccountId':Number(_0x2ead73['params']['id'])});}}else{socket[_0x3543('0xbb')](_0x3543('0xbe'),{'UserId':Number(_0x2ead73['query'][_0x3543('0x68')]),'MailAccountId':Number(_0x2ead73['params']['id'])});}});}})['then'](respondWithStatusCode(_0x54887e,null))[_0x3543('0x2c')](handleError(_0x54887e,null));};exports[_0x3543('0xbf')]=function(_0x4329de,_0x481b1b,_0x320b78){var _0x46d9ff={};var _0x572d42={};var _0x4ff291;var _0x1d3005;return db['MailAccount'][_0x3543('0x62')]({'where':{'id':_0x4329de[_0x3543('0x56')]['id']}})[_0x3543('0x21')](handleEntityNotFound(_0x481b1b,null))['then'](function(_0x498a39){if(_0x498a39){_0x4ff291=_0x498a39;_0x572d42['model']=_[_0x3543('0x5a')](db[_0x3543('0x8d')]['rawAttributes']);_0x572d42['query']=_['keys'](_0x4329de['query']);_0x572d42[_0x3543('0x47')]=_[_0x3543('0x48')](_0x572d42[_0x3543('0x44')],_0x572d42[_0x3543('0x46')]);_0x46d9ff[_0x3543('0x49')]=_[_0x3543('0x48')](_0x572d42[_0x3543('0x44')],qs[_0x3543('0x4a')](_0x4329de[_0x3543('0x46')][_0x3543('0x4a')]));_0x46d9ff[_0x3543('0x49')]=_0x46d9ff[_0x3543('0x49')][_0x3543('0x4b')]?_0x46d9ff[_0x3543('0x49')]:_0x572d42[_0x3543('0x44')];_0x46d9ff['order']=qs[_0x3543('0x63')](_0x4329de['query'][_0x3543('0x63')]);_0x46d9ff['where']=qs[_0x3543('0x47')](_[_0x3543('0x64')](_0x4329de[_0x3543('0x46')],_0x572d42[_0x3543('0x47')]));if(_0x4329de[_0x3543('0x46')][_0x3543('0x50')]){_0x46d9ff[_0x3543('0x4f')]=_[_0x3543('0x52')](_0x46d9ff[_0x3543('0x4f')],{'$or':_['map'](_0x46d9ff['attributes'],function(_0x5e7e09){var _0x39a5da={};_0x39a5da[_0x5e7e09]={'$like':'%'+_0x4329de['query'][_0x3543('0x50')]+'%'};return _0x39a5da;})});}_0x46d9ff=_[_0x3543('0x52')]({},_0x46d9ff,_0x4329de[_0x3543('0x65')]);return _0x4ff291[_0x3543('0xbf')](_0x46d9ff);}})[_0x3543('0x21')](function(_0x1f98a5){if(_0x1f98a5){_0x1d3005=_0x1f98a5['length'];if(!_0x4329de[_0x3543('0x46')][_0x3543('0x4c')](_0x3543('0x4d'))){_0x46d9ff[_0x3543('0x32')]=qs[_0x3543('0x32')](_0x4329de[_0x3543('0x46')][_0x3543('0x32')]);_0x46d9ff[_0x3543('0x30')]=qs['offset'](_0x4329de[_0x3543('0x46')][_0x3543('0x30')]);}return _0x4ff291[_0x3543('0xbf')](_0x46d9ff);}})['then'](function(_0x8d60e3){if(_0x8d60e3){return _0x8d60e3?{'count':_0x1d3005,'rows':_0x8d60e3}:null;}})['then'](respondWithResult(_0x481b1b,null))[_0x3543('0x2c')](handleError(_0x481b1b,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index b9134d3..4a4e291 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 _0xf06c=['../../mysqldb','MailAccount','setMaxListeners','save','remove','emit','hook','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf06c,0xc7));var _0xcf06=function(_0x57850b,_0x40c735){_0x57850b=_0x57850b-0x0;var _0x399b17=_0xf06c[_0x57850b];return _0x399b17;};'use strict';var EventEmitter=require(_0xcf06('0x0'));var MailAccount=require(_0xcf06('0x1'))['db'][_0xcf06('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xcf06('0x3')](0x0);var events={'afterCreate':_0xcf06('0x4'),'afterUpdate':'update','afterDestroy':_0xcf06('0x5')};function emitEvent(_0x2b98f4){return function(_0x1d0c26,_0x49218b,_0x171d05){MailAccountEvents[_0xcf06('0x6')](_0x2b98f4+':'+_0x1d0c26['id'],_0x1d0c26);MailAccountEvents[_0xcf06('0x6')](_0x2b98f4,_0x1d0c26);_0x171d05(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0xcf06('0x7')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0xcf8c=['events','../../mysqldb','MailAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x3e8578,_0x445a8b){var _0x3b122a=function(_0x26109f){while(--_0x26109f){_0x3e8578['push'](_0x3e8578['shift']());}};_0x3b122a(++_0x445a8b);}(_0xcf8c,0xf0));var _0xccf8=function(_0x525079,_0x110c9c){_0x525079=_0x525079-0x0;var _0x593027=_0xcf8c[_0x525079];return _0x593027;};'use strict';var EventEmitter=require(_0xccf8('0x0'));var MailAccount=require(_0xccf8('0x1'))['db'][_0xccf8('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xccf8('0x3')](0x0);var events={'afterCreate':_0xccf8('0x4'),'afterUpdate':_0xccf8('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5b367a){return function(_0x3729ca,_0x2f3755,_0x419c86){MailAccountEvents[_0xccf8('0x6')](_0x5b367a+':'+_0x3729ca['id'],_0x3729ca);MailAccountEvents[_0xccf8('0x6')](_0x5b367a,_0x3729ca);_0x419c86(null);};}for(var e in events){if(events[_0xccf8('0x7')](e)){var event=events[e];MailAccount[_0xccf8('0x8')](e,emitEvent(event));}}module[_0xccf8('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index a5f2fe4..5713b40 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 _0x56d7=['mail_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports','define','MailAccount'];(function(_0x94135c,_0xcc868c){var _0x151b19=function(_0x413a1d){while(--_0x413a1d){_0x94135c['push'](_0x94135c['shift']());}};_0x151b19(++_0xcc868c);}(_0x56d7,0x10b));var _0x756d=function(_0xa40219,_0x21027e){_0xa40219=_0xa40219-0x0;var _0x391974=_0x56d7[_0xa40219];return _0x391974;};'use strict';var _=require(_0x756d('0x0'));var util=require('util');var logger=require(_0x756d('0x1'))(_0x756d('0x2'));var moment=require(_0x756d('0x3'));var BPromise=require(_0x756d('0x4'));var rp=require(_0x756d('0x5'));var fs=require('fs');var path=require(_0x756d('0x6'));var rimraf=require(_0x756d('0x7'));var config=require(_0x756d('0x8'));var attributes=require(_0x756d('0x9'));module[_0x756d('0xa')]=function(_0x376dd5,_0x508fb3){return _0x376dd5[_0x756d('0xb')](_0x756d('0xc'),attributes,{'tableName':_0x756d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd59c=['mail_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports','define','MailAccount'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd59c,0x1a5));var _0xcd59=function(_0x1e08e0,_0x250757){_0x1e08e0=_0x1e08e0-0x0;var _0x57aa70=_0xd59c[_0x1e08e0];return _0x57aa70;};'use strict';var _=require('lodash');var util=require(_0xcd59('0x0'));var logger=require(_0xcd59('0x1'))(_0xcd59('0x2'));var moment=require(_0xcd59('0x3'));var BPromise=require(_0xcd59('0x4'));var rp=require(_0xcd59('0x5'));var fs=require('fs');var path=require(_0xcd59('0x6'));var rimraf=require(_0xcd59('0x7'));var config=require(_0xcd59('0x8'));var attributes=require(_0xcd59('0x9'));module[_0xcd59('0xa')]=function(_0x5ed185,_0x591188){return _0x5ed185[_0xcd59('0xb')](_0xcd59('0xc'),attributes,{'tableName':_0xcd59('0xd'),'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 a2fd5f3..2cc11fb 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 _0xe6b5=['options','raw','where','attributes','limit','model','map','include','ShowMailAccount','find','mail','difference','keys','rawAttributes','createdAt','updatedAt','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','MailAccount','CmList','List','CmContact','Contacts','Applications','Smtp','get','account','omit','applications','asc','autoclose','push','length','close','*,*,*,*','create','List\x20not\x20found','contact','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','Messages','inReplyTo','Contact\x20not\x20found','spread','subject','interaction','MailMessage','attachments','originTo','originCc','bcc','ChatWebsiteId','Attachment','Attachments','User','name','UserId','unshift','agent','Start','startRouting','lodash','util','moment','bluebird','ioredis','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','findAll'];(function(_0x10af41,_0x4df19f){var _0x33794c=function(_0x23996){while(--_0x23996){_0x10af41['push'](_0x10af41['shift']());}};_0x33794c(++_0x4df19f);}(_0xe6b5,0x1d6));var _0x5e6b=function(_0x1aa2ac,_0x3aca83){_0x1aa2ac=_0x1aa2ac-0x0;var _0x242bae=_0xe6b5[_0x1aa2ac];return _0x242bae;};'use strict';var _=require(_0x5e6b('0x0'));var util=require(_0x5e6b('0x1'));var moment=require(_0x5e6b('0x2'));var BPromise=require(_0x5e6b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5e6b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5e6b('0x5'));var config=require(_0x5e6b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5e6b('0x7')][_0x5e6b('0x8')]({'port':0x232c});config[_0x5e6b('0x9')]=_[_0x5e6b('0xa')](config[_0x5e6b('0x9')],{'host':_0x5e6b('0xb'),'port':0x18eb});var socket=require(_0x5e6b('0xc'))(new Redis(config['redis']));require(_0x5e6b('0xd'))[_0x5e6b('0xe')](socket);function respondWithRpcPromise(_0x2b5ee2,_0x4e631c,_0x3b648f){return new BPromise(function(_0x72caab,_0x4cdd7e){return client[_0x5e6b('0xf')](_0x2b5ee2,_0x3b648f)[_0x5e6b('0x10')](function(_0x141e1e){logger[_0x5e6b('0x11')](_0x5e6b('0x12'),_0x4e631c,_0x5e6b('0x13'));logger[_0x5e6b('0x14')](_0x5e6b('0x15'),_0x4e631c,'request\x20sent',JSON[_0x5e6b('0x16')](_0x141e1e));if(_0x141e1e[_0x5e6b('0x17')]){if(_0x141e1e[_0x5e6b('0x17')][_0x5e6b('0x18')]===0x1f4){logger[_0x5e6b('0x17')](_0x5e6b('0x12'),_0x4e631c,_0x141e1e['error'][_0x5e6b('0x19')]);return _0x4cdd7e(_0x141e1e['error']['message']);}logger[_0x5e6b('0x17')](_0x5e6b('0x12'),_0x4e631c,_0x141e1e['error']['message']);return _0x72caab(_0x141e1e[_0x5e6b('0x17')][_0x5e6b('0x19')]);}else{logger[_0x5e6b('0x11')](_0x5e6b('0x12'),_0x4e631c,_0x5e6b('0x13'));_0x72caab(_0x141e1e[_0x5e6b('0x1a')][_0x5e6b('0x19')]);}})[_0x5e6b('0x1b')](function(_0x2e7507){logger[_0x5e6b('0x17')](_0x5e6b('0x12'),_0x4e631c,_0x2e7507);_0x4cdd7e(_0x2e7507);});});}exports[_0x5e6b('0x1c')]=function(_0x11e0ff){var _0x2a174e=this;return new Promise(function(_0x159843,_0x254705){return db['MailAccount'][_0x5e6b('0x1d')]({'raw':_0x11e0ff[_0x5e6b('0x1e')]?_0x11e0ff[_0x5e6b('0x1e')][_0x5e6b('0x1f')]===undefined?!![]:![]:!![],'where':_0x11e0ff['options']?_0x11e0ff[_0x5e6b('0x1e')][_0x5e6b('0x20')]||null:null,'attributes':_0x11e0ff[_0x5e6b('0x1e')]?_0x11e0ff[_0x5e6b('0x1e')][_0x5e6b('0x21')]||null:null,'limit':_0x11e0ff['options']?_0x11e0ff[_0x5e6b('0x1e')][_0x5e6b('0x22')]||null:null,'include':_0x11e0ff[_0x5e6b('0x1e')]?_0x11e0ff[_0x5e6b('0x1e')]['include']?_['map'](_0x11e0ff['options']['include'],function(_0x10e761){return{'model':db[_0x10e761[_0x5e6b('0x23')]],'as':_0x10e761['as'],'attributes':_0x10e761['attributes'],'include':_0x10e761['include']?_[_0x5e6b('0x24')](_0x10e761['include'],function(_0x59223e){return{'model':db[_0x59223e[_0x5e6b('0x23')]],'as':_0x59223e['as'],'attributes':_0x59223e[_0x5e6b('0x21')],'include':_0x59223e[_0x5e6b('0x25')]?_['map'](_0x59223e[_0x5e6b('0x25')],function(_0xcd1652){return{'model':db[_0xcd1652[_0x5e6b('0x23')]],'as':_0xcd1652['as'],'attributes':_0xcd1652[_0x5e6b('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5e6b('0x10')](function(_0x46acca){logger[_0x5e6b('0x11')](_0x5e6b('0x1c'),_0x11e0ff);logger[_0x5e6b('0x14')]('GetMailAccount',_0x11e0ff,JSON[_0x5e6b('0x16')](_0x46acca));_0x159843(_0x46acca);})[_0x5e6b('0x1b')](function(_0x501a40){logger[_0x5e6b('0x17')](_0x5e6b('0x1c'),_0x501a40['message'],_0x11e0ff);_0x254705(_0x2a174e[_0x5e6b('0x17')](0x1f4,_0x501a40[_0x5e6b('0x19')]));});});};exports[_0x5e6b('0x26')]=function(_0x387e7f){var _0x22ace3=this;return new Promise(function(_0x236aa4,_0x53d516){return db['MailAccount'][_0x5e6b('0x27')]({'raw':_0x387e7f[_0x5e6b('0x1e')]?_0x387e7f[_0x5e6b('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x387e7f['options']?_0x387e7f[_0x5e6b('0x1e')]['where']||null:null,'attributes':_0x387e7f[_0x5e6b('0x1e')]?_0x387e7f[_0x5e6b('0x1e')][_0x5e6b('0x21')]||null:null,'include':_0x387e7f[_0x5e6b('0x1e')]?_0x387e7f[_0x5e6b('0x1e')]['include']?_[_0x5e6b('0x24')](_0x387e7f[_0x5e6b('0x1e')]['include'],function(_0x3cbb85){return{'model':db[_0x3cbb85[_0x5e6b('0x23')]],'as':_0x3cbb85['as'],'attributes':_0x3cbb85[_0x5e6b('0x21')],'include':_0x3cbb85[_0x5e6b('0x25')]?_[_0x5e6b('0x24')](_0x3cbb85[_0x5e6b('0x25')],function(_0x553b48){return{'model':db[_0x553b48[_0x5e6b('0x23')]],'as':_0x553b48['as'],'attributes':_0x553b48[_0x5e6b('0x21')],'include':_0x553b48[_0x5e6b('0x25')]?_[_0x5e6b('0x24')](_0x553b48[_0x5e6b('0x25')],function(_0x2d5b52){return{'model':db[_0x2d5b52['model']],'as':_0x2d5b52['as'],'attributes':_0x2d5b52[_0x5e6b('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5e6b('0x10')](function(_0x17cf13){logger[_0x5e6b('0x11')]('ShowMailAccount',_0x387e7f);logger[_0x5e6b('0x14')](_0x5e6b('0x26'),_0x387e7f,JSON[_0x5e6b('0x16')](_0x17cf13));_0x236aa4(_0x17cf13);})[_0x5e6b('0x1b')](function(_0x2208fa){logger[_0x5e6b('0x17')]('ShowMailAccount',_0x2208fa['message'],_0x387e7f);_0x53d516(_0x22ace3[_0x5e6b('0x17')](0x1f4,_0x2208fa[_0x5e6b('0x19')]));});});};exports['NotifyMailAccount']=function(_0xbb0f2b){var _0x636ebc=this;return new Promise(function(_0x2f69f6,_0x1302bc){var _0x496415={'body':_0xbb0f2b['body'],'channel':_0x5e6b('0x28')};var _0x1eeade=_[_0x5e6b('0x29')](_[_0x5e6b('0x2a')](db['CmContact'][_0x5e6b('0x2b')]),[_0x5e6b('0x2c'),_0x5e6b('0x2d'),'CompanyId','ListId']);var _0x3fe9ad=![];if(_0xbb0f2b[_0x5e6b('0x2e')]['id']){delete _0xbb0f2b[_0x5e6b('0x2e')]['id'];}if(_[_0x5e6b('0x2f')](_0xbb0f2b[_0x5e6b('0x2e')][_0x5e6b('0x30')])){return _0x1302bc(_0x636ebc[_0x5e6b('0x17')](0x1f4,_0x5e6b('0x31')));}if(_['isNil'](_0xbb0f2b[_0x5e6b('0x2e')][_0x5e6b('0x2e')])||_0xbb0f2b[_0x5e6b('0x2e')][_0x5e6b('0x2e')]===''){return _0x1302bc(_0x636ebc[_0x5e6b('0x17')](0x1f4,_0x5e6b('0x32')));}if(_[_0x5e6b('0x2f')](_0xbb0f2b['body']['mapKey'])){return _0x1302bc(_0x636ebc[_0x5e6b('0x17')](0x1f4,_0x5e6b('0x33')+_0x1eeade));}if(!_[_0x5e6b('0x34')](_0x1eeade,_0xbb0f2b[_0x5e6b('0x2e')][_0x5e6b('0x35')])){return _0x1302bc(_0x636ebc[_0x5e6b('0x17')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1eeade));}var _0x168ed2={};_0x168ed2[_0xbb0f2b['body'][_0x5e6b('0x35')]]=_0xbb0f2b[_0x5e6b('0x2e')]['from'];return db[_0x5e6b('0x36')]['find']({'where':{'id':_0xbb0f2b['account']['id']},'include':[{'model':db[_0x5e6b('0x37')],'as':_0x5e6b('0x38'),'include':[{'model':db[_0x5e6b('0x39')],'as':_0x5e6b('0x3a'),'where':_0x168ed2,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['MailApplication'],'as':_0x5e6b('0x3b')},{'model':db['MailServerOut'],'as':_0x5e6b('0x3c')}]})[_0x5e6b('0x10')](function(_0x3958a6){if(_0x3958a6&&_0x3958a6[_0x5e6b('0x38')]){var _0x5d670e=_0x3958a6[_0x5e6b('0x3d')]({'plain':!![]});_0x496415[_0x5e6b('0x3e')]=_[_0x5e6b('0x3f')](_0x5d670e,[_0x5e6b('0x3b'),_0x5e6b('0x38')]);_0x496415[_0x5e6b('0x40')]=_0x5d670e[_0x5e6b('0x3b')];_0x496415['list']=_0x5d670e[_0x5e6b('0x38')];_0x496415[_0x5e6b('0x40')]=_['orderBy'](_0x496415[_0x5e6b('0x40')],['priority'],[_0x5e6b('0x41')]);if(_0x496415[_0x5e6b('0x3e')]&&_0x496415[_0x5e6b('0x3e')][_0x5e6b('0x42')]){_0x496415[_0x5e6b('0x40')][_0x5e6b('0x43')]({'id':0x0,'priority':_0x496415['applications'][_0x5e6b('0x44')]+0x1,'app':_0x5e6b('0x45'),'appdata':_0x5e6b('0x42'),'interval':_0x5e6b('0x46')});}if(_0x496415['account']['Applications']){delete _0x496415[_0x5e6b('0x3e')][_0x5e6b('0x3b')];}if(_0x496415['account'][_0x5e6b('0x38')]){delete _0x496415[_0x5e6b('0x3e')][_0x5e6b('0x38')];}if(_0x5d670e['List'][_0x5e6b('0x3a')][_0x5e6b('0x44')]){return _0x5d670e[_0x5e6b('0x38')][_0x5e6b('0x3a')][0x0];}var _0x1bfbb8=_[_0x5e6b('0xa')](_0xbb0f2b[_0x5e6b('0x2e')],{'firstName':_0xbb0f2b['body'][_0x5e6b('0x30')],'ListId':_0x5d670e['ListId']});_0x1bfbb8[_0xbb0f2b[_0x5e6b('0x2e')][_0x5e6b('0x35')]]=_0xbb0f2b[_0x5e6b('0x2e')][_0x5e6b('0x30')];return db[_0x5e6b('0x39')][_0x5e6b('0x47')](_0x1bfbb8);}else{throw new Error(_0x5e6b('0x48'));}})[_0x5e6b('0x10')](function(_0x12dc2b){_0x496415[_0x5e6b('0x49')]=_0x12dc2b;if(_0x12dc2b){if(!_0xbb0f2b[_0x5e6b('0x2e')][_0x5e6b('0x19')][_0x5e6b('0x4a')]){_0xbb0f2b[_0x5e6b('0x2e')][_0x5e6b('0x19')]['messageId']=rs[_0x5e6b('0x4b')]()+'\x20'+_0xbb0f2b['body'][_0x5e6b('0x19')][_0x5e6b('0x30')];}var _0x320db3={'ContactId':_0x12dc2b['id'],'MailAccountId':_0xbb0f2b['account']['id'],'inReplyTo':_0xbb0f2b[_0x5e6b('0x2e')]['message'][_0x5e6b('0x4a')],'to':_0xbb0f2b[_0x5e6b('0x2e')][_0x5e6b('0x19')][_0x5e6b('0x30')],'cc':_0xbb0f2b['body'][_0x5e6b('0x19')]['cc'],'subject':_0xbb0f2b['body']['message']['subject'],'attach':_0xbb0f2b[_0x5e6b('0x2e')][_0x5e6b('0x19')][_0x5e6b('0x4c')],'lastMsgAt':moment()[_0x5e6b('0x4d')](_0x5e6b('0x4e')),'lastMsgDirection':'in'};return db['MailInteraction'][_0x5e6b('0x27')]({'where':{'closed':![],'MailAccountId':_0xbb0f2b['account']['id']},'include':[{'model':db['MailMessage'],'as':_0x5e6b('0x4f'),'attributes':['messageId'],'where':{'messageId':_0xbb0f2b[_0x5e6b('0x2e')][_0x5e6b('0x19')][_0x5e6b('0x50')]}}]})['then'](function(_0x184e29){if(_0x184e29){return[_0x184e29,![]];}return db['MailInteraction'][_0x5e6b('0x47')](_0x320db3)[_0x5e6b('0x10')](function(_0x1db412){return[_0x1db412,!![]];});});}else{throw new Error(_0x5e6b('0x51'));}})[_0x5e6b('0x52')](function(_0x3e1add,_0x57a429){if(_0x3e1add){_0x3fe9ad=_0x57a429;if(!_0x57a429){return _0x3e1add['update']({'inReplyTo':_0xbb0f2b[_0x5e6b('0x2e')][_0x5e6b('0x19')]['messageId'],'to':_0xbb0f2b['body'][_0x5e6b('0x19')][_0x5e6b('0x30')],'cc':_0xbb0f2b[_0x5e6b('0x2e')][_0x5e6b('0x19')]['cc'],'subject':_0xbb0f2b[_0x5e6b('0x2e')][_0x5e6b('0x19')][_0x5e6b('0x53')],'attach':_0x3e1add[_0x5e6b('0x4c')]?_0x3e1add[_0x5e6b('0x4c')]:_0xbb0f2b['body'][_0x5e6b('0x19')][_0x5e6b('0x4c')],'substatus':null,'substatusAt':moment()[_0x5e6b('0x4d')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x5e6b('0x4d')](_0x5e6b('0x4e')),'lastMsgDirection':'in'});}else{return _0x3e1add;}}})[_0x5e6b('0x10')](function(_0xeda072){_0x496415[_0x5e6b('0x54')]=_0xeda072[_0x5e6b('0x3d')]({'plain':!![]});_0x496415[_0x5e6b('0x54')]['created']=_0x3fe9ad;return db[_0x5e6b('0x55')]['create']({'body':_0xbb0f2b[_0x5e6b('0x2e')][_0x5e6b('0x2e')],'MailAccountId':_0xbb0f2b[_0x5e6b('0x3e')]['id'],'MailInteractionId':_0xeda072['id'],'direction':'in','ContactId':_0x496415[_0x5e6b('0x49')]['id'],'messageId':_0xbb0f2b['body'][_0x5e6b('0x19')][_0x5e6b('0x4a')],'from':_0xbb0f2b[_0x5e6b('0x2e')]['message'][_0x5e6b('0x30')],'to':_0xbb0f2b[_0x5e6b('0x2e')][_0x5e6b('0x19')]['to'],'cc':_0xbb0f2b[_0x5e6b('0x2e')]['message']['cc'],'subject':_0xbb0f2b[_0x5e6b('0x2e')]['message'][_0x5e6b('0x53')],'attach':_0xbb0f2b['body'][_0x5e6b('0x19')]['attach'],'Attachments':_0xbb0f2b[_0x5e6b('0x2e')][_0x5e6b('0x19')][_0x5e6b('0x56')],'originTo':_0xbb0f2b['body'][_0x5e6b('0x19')][_0x5e6b('0x57')],'originCc':_0xbb0f2b['body'][_0x5e6b('0x19')][_0x5e6b('0x58')],'bcc':_0xbb0f2b['body'][_0x5e6b('0x19')][_0x5e6b('0x59')],'ChatWebsiteId':_0xbb0f2b['body'][_0x5e6b('0x19')][_0x5e6b('0x5a')]||null,'originChannel':_0xbb0f2b[_0x5e6b('0x2e')][_0x5e6b('0x19')]['originChannel']||'Email','ChatOfflineMessageId':_0xbb0f2b[_0x5e6b('0x2e')]['message']['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x5e6b('0x5b')],'as':_0x5e6b('0x5c')}]});})[_0x5e6b('0x10')](function(_0x247ad1){_0x496415[_0x5e6b('0x19')]=_0x247ad1;if(_0x496415[_0x5e6b('0x54')]['UserId']){return db[_0x5e6b('0x5d')]['find']({'attributes':['id',_0x5e6b('0x5e')],'where':{'id':_0x496415[_0x5e6b('0x54')][_0x5e6b('0x5f')]}})[_0x5e6b('0x10')](function(_0x53f2dc){if(_0x53f2dc){_0x496415[_0x5e6b('0x40')][_0x5e6b('0x60')]({'id':0x0,'priority':0x0,'app':_0x5e6b('0x61'),'appdata':_0x53f2dc[_0x5e6b('0x5e')]+','+(_0x496415[_0x5e6b('0x3e')]['waitForTheAssignedAgent']||0xa),'interval':_0x5e6b('0x46')});}return respondWithRpcPromise(_0x5e6b('0x62'),_0x5e6b('0x63'),_0x496415);});}return respondWithRpcPromise('Start',_0x5e6b('0x63'),_0x496415);})[_0x5e6b('0x10')](function(_0x24b715){_0x2f69f6(_0x24b715);})[_0x5e6b('0x1b')](function(_0x443382){_0x1302bc(_0x636ebc[_0x5e6b('0x17')](0x1f4,_0x443382[_0x5e6b('0x19')]));});});}; \ No newline at end of file +var _0xe8d8=['MailApplication','Applications','MailServerOut','Smtp','get','applications','list','orderBy','asc','autoclose','push','length','*,*,*,*','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','spread','update','interaction','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachments','UserId','User','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','register','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailAccount','findAll','options','where','attributes','limit','map','model','include','GetMailAccount','ShowMailAccount','find','NotifyMailAccount','mail','difference','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','body','from','isNil','mapKey','account','List','Contacts','DESC'];(function(_0x275dfa,_0x2dcb93){var _0xad82f5=function(_0x2bd81f){while(--_0x2bd81f){_0x275dfa['push'](_0x275dfa['shift']());}};_0xad82f5(++_0x2dcb93);}(_0xe8d8,0xf7));var _0x8e8d=function(_0x23c9a7,_0x498d1b){_0x23c9a7=_0x23c9a7-0x0;var _0x1573c4=_0xe8d8[_0x23c9a7];return _0x1573c4;};'use strict';var _=require(_0x8e8d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8e8d('0x1'));var fs=require('fs');var Redis=require(_0x8e8d('0x2'));var db=require(_0x8e8d('0x3'))['db'];var utils=require(_0x8e8d('0x4'));var logger=require(_0x8e8d('0x5'))(_0x8e8d('0x6'));var config=require(_0x8e8d('0x7'));var jayson=require(_0x8e8d('0x8'));var client=jayson['client'][_0x8e8d('0x9')]({'port':0x232c});config['redis']=_[_0x8e8d('0xa')](config[_0x8e8d('0xb')],{'host':_0x8e8d('0xc'),'port':0x18eb});var socket=require(_0x8e8d('0xd'))(new Redis(config['redis']));require('./mailAccount.socket')[_0x8e8d('0xe')](socket);function respondWithRpcPromise(_0x167c04,_0x347d6e,_0x36b096){return new BPromise(function(_0x32b196,_0x25b999){return client['request'](_0x167c04,_0x36b096)[_0x8e8d('0xf')](function(_0x244a70){logger[_0x8e8d('0x10')](_0x8e8d('0x11'),_0x347d6e,_0x8e8d('0x12'));logger[_0x8e8d('0x13')](_0x8e8d('0x14'),_0x347d6e,_0x8e8d('0x12'),JSON[_0x8e8d('0x15')](_0x244a70));if(_0x244a70[_0x8e8d('0x16')]){if(_0x244a70[_0x8e8d('0x16')][_0x8e8d('0x17')]===0x1f4){logger[_0x8e8d('0x16')](_0x8e8d('0x11'),_0x347d6e,_0x244a70[_0x8e8d('0x16')]['message']);return _0x25b999(_0x244a70[_0x8e8d('0x16')][_0x8e8d('0x18')]);}logger[_0x8e8d('0x16')]('MailAccount,\x20%s,\x20%s',_0x347d6e,_0x244a70[_0x8e8d('0x16')][_0x8e8d('0x18')]);return _0x32b196(_0x244a70[_0x8e8d('0x16')][_0x8e8d('0x18')]);}else{logger['info'](_0x8e8d('0x11'),_0x347d6e,'request\x20sent');_0x32b196(_0x244a70[_0x8e8d('0x19')][_0x8e8d('0x18')]);}})[_0x8e8d('0x1a')](function(_0x359a94){logger[_0x8e8d('0x16')](_0x8e8d('0x11'),_0x347d6e,_0x359a94);_0x25b999(_0x359a94);});});}exports['GetMailAccount']=function(_0x35ad95){var _0x217686=this;return new Promise(function(_0x1760f3,_0x5d31cb){return db[_0x8e8d('0x1b')][_0x8e8d('0x1c')]({'raw':_0x35ad95[_0x8e8d('0x1d')]?_0x35ad95['options']['raw']===undefined?!![]:![]:!![],'where':_0x35ad95['options']?_0x35ad95[_0x8e8d('0x1d')][_0x8e8d('0x1e')]||null:null,'attributes':_0x35ad95[_0x8e8d('0x1d')]?_0x35ad95[_0x8e8d('0x1d')][_0x8e8d('0x1f')]||null:null,'limit':_0x35ad95[_0x8e8d('0x1d')]?_0x35ad95[_0x8e8d('0x1d')][_0x8e8d('0x20')]||null:null,'include':_0x35ad95[_0x8e8d('0x1d')]?_0x35ad95[_0x8e8d('0x1d')]['include']?_[_0x8e8d('0x21')](_0x35ad95[_0x8e8d('0x1d')]['include'],function(_0x66ad58){return{'model':db[_0x66ad58[_0x8e8d('0x22')]],'as':_0x66ad58['as'],'attributes':_0x66ad58[_0x8e8d('0x1f')],'include':_0x66ad58[_0x8e8d('0x23')]?_['map'](_0x66ad58[_0x8e8d('0x23')],function(_0x5987e6){return{'model':db[_0x5987e6[_0x8e8d('0x22')]],'as':_0x5987e6['as'],'attributes':_0x5987e6['attributes'],'include':_0x5987e6['include']?_[_0x8e8d('0x21')](_0x5987e6[_0x8e8d('0x23')],function(_0x44bd07){return{'model':db[_0x44bd07[_0x8e8d('0x22')]],'as':_0x44bd07['as'],'attributes':_0x44bd07['attributes']};}):[]};}):[]};}):[]:[]})[_0x8e8d('0xf')](function(_0xba3600){logger[_0x8e8d('0x10')](_0x8e8d('0x24'),_0x35ad95);logger['debug'](_0x8e8d('0x24'),_0x35ad95,JSON[_0x8e8d('0x15')](_0xba3600));_0x1760f3(_0xba3600);})[_0x8e8d('0x1a')](function(_0x21eb0c){logger[_0x8e8d('0x16')](_0x8e8d('0x24'),_0x21eb0c[_0x8e8d('0x18')],_0x35ad95);_0x5d31cb(_0x217686['error'](0x1f4,_0x21eb0c[_0x8e8d('0x18')]));});});};exports[_0x8e8d('0x25')]=function(_0x4bcacc){var _0x3d530c=this;return new Promise(function(_0x41e66e,_0x5b3b54){return db[_0x8e8d('0x1b')][_0x8e8d('0x26')]({'raw':_0x4bcacc[_0x8e8d('0x1d')]?_0x4bcacc['options']['raw']===undefined?!![]:![]:!![],'where':_0x4bcacc[_0x8e8d('0x1d')]?_0x4bcacc[_0x8e8d('0x1d')]['where']||null:null,'attributes':_0x4bcacc[_0x8e8d('0x1d')]?_0x4bcacc[_0x8e8d('0x1d')][_0x8e8d('0x1f')]||null:null,'include':_0x4bcacc[_0x8e8d('0x1d')]?_0x4bcacc['options'][_0x8e8d('0x23')]?_[_0x8e8d('0x21')](_0x4bcacc[_0x8e8d('0x1d')][_0x8e8d('0x23')],function(_0x10d179){return{'model':db[_0x10d179['model']],'as':_0x10d179['as'],'attributes':_0x10d179[_0x8e8d('0x1f')],'include':_0x10d179['include']?_[_0x8e8d('0x21')](_0x10d179['include'],function(_0x2c97c5){return{'model':db[_0x2c97c5[_0x8e8d('0x22')]],'as':_0x2c97c5['as'],'attributes':_0x2c97c5[_0x8e8d('0x1f')],'include':_0x2c97c5[_0x8e8d('0x23')]?_[_0x8e8d('0x21')](_0x2c97c5[_0x8e8d('0x23')],function(_0x2bbc98){return{'model':db[_0x2bbc98[_0x8e8d('0x22')]],'as':_0x2bbc98['as'],'attributes':_0x2bbc98['attributes']};}):[]};}):[]};}):[]:[]})[_0x8e8d('0xf')](function(_0x180ea9){logger[_0x8e8d('0x10')]('ShowMailAccount',_0x4bcacc);logger[_0x8e8d('0x13')](_0x8e8d('0x25'),_0x4bcacc,JSON['stringify'](_0x180ea9));_0x41e66e(_0x180ea9);})['catch'](function(_0x46a8a9){logger[_0x8e8d('0x16')](_0x8e8d('0x25'),_0x46a8a9['message'],_0x4bcacc);_0x5b3b54(_0x3d530c['error'](0x1f4,_0x46a8a9['message']));});});};exports[_0x8e8d('0x27')]=function(_0x5b3309){var _0x212bc4=this;return new Promise(function(_0x288e62,_0x21b0cc){var _0x2416d8={'body':_0x5b3309['body'],'channel':_0x8e8d('0x28')};var _0x5cab07=_[_0x8e8d('0x29')](_['keys'](db[_0x8e8d('0x2a')][_0x8e8d('0x2b')]),[_0x8e8d('0x2c'),_0x8e8d('0x2d'),_0x8e8d('0x2e'),_0x8e8d('0x2f')]);var _0x4e755c=![];if(_0x5b3309[_0x8e8d('0x30')]['id']){delete _0x5b3309[_0x8e8d('0x30')]['id'];}if(_['isNil'](_0x5b3309[_0x8e8d('0x30')][_0x8e8d('0x31')])){return _0x21b0cc(_0x212bc4[_0x8e8d('0x16')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x8e8d('0x32')](_0x5b3309[_0x8e8d('0x30')]['body'])||_0x5b3309['body'][_0x8e8d('0x30')]===''){return _0x21b0cc(_0x212bc4['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x8e8d('0x32')](_0x5b3309['body'][_0x8e8d('0x33')])){return _0x21b0cc(_0x212bc4[_0x8e8d('0x16')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5cab07));}if(!_['includes'](_0x5cab07,_0x5b3309[_0x8e8d('0x30')][_0x8e8d('0x33')])){return _0x21b0cc(_0x212bc4[_0x8e8d('0x16')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5cab07));}var _0x13f6f0={};_0x13f6f0[_0x5b3309[_0x8e8d('0x30')][_0x8e8d('0x33')]]=_0x5b3309['body'][_0x8e8d('0x31')];return db[_0x8e8d('0x1b')][_0x8e8d('0x26')]({'where':{'id':_0x5b3309[_0x8e8d('0x34')]['id']},'include':[{'model':db['CmList'],'as':_0x8e8d('0x35'),'include':[{'model':db[_0x8e8d('0x2a')],'as':_0x8e8d('0x36'),'where':_0x13f6f0,'limit':0x1,'order':[[_0x8e8d('0x2d'),_0x8e8d('0x37')]]}]},{'model':db[_0x8e8d('0x38')],'as':_0x8e8d('0x39')},{'model':db[_0x8e8d('0x3a')],'as':_0x8e8d('0x3b')}]})[_0x8e8d('0xf')](function(_0x430f75){if(_0x430f75&&_0x430f75[_0x8e8d('0x35')]){var _0x116d60=_0x430f75[_0x8e8d('0x3c')]({'plain':!![]});_0x2416d8[_0x8e8d('0x34')]=_['omit'](_0x116d60,[_0x8e8d('0x39'),_0x8e8d('0x35')]);_0x2416d8[_0x8e8d('0x3d')]=_0x116d60[_0x8e8d('0x39')];_0x2416d8[_0x8e8d('0x3e')]=_0x116d60[_0x8e8d('0x35')];_0x2416d8[_0x8e8d('0x3d')]=_[_0x8e8d('0x3f')](_0x2416d8[_0x8e8d('0x3d')],['priority'],[_0x8e8d('0x40')]);if(_0x2416d8[_0x8e8d('0x34')]&&_0x2416d8[_0x8e8d('0x34')][_0x8e8d('0x41')]){_0x2416d8[_0x8e8d('0x3d')][_0x8e8d('0x42')]({'id':0x0,'priority':_0x2416d8[_0x8e8d('0x3d')][_0x8e8d('0x43')]+0x1,'app':'close','appdata':_0x8e8d('0x41'),'interval':_0x8e8d('0x44')});}if(_0x2416d8['account'][_0x8e8d('0x39')]){delete _0x2416d8[_0x8e8d('0x34')][_0x8e8d('0x39')];}if(_0x2416d8['account'][_0x8e8d('0x35')]){delete _0x2416d8[_0x8e8d('0x34')][_0x8e8d('0x35')];}if(_0x116d60['List'][_0x8e8d('0x36')][_0x8e8d('0x43')]){return _0x116d60['List'][_0x8e8d('0x36')][0x0];}var _0x493f3b=_[_0x8e8d('0xa')](_0x5b3309[_0x8e8d('0x30')],{'firstName':_0x5b3309['body'][_0x8e8d('0x31')],'ListId':_0x116d60['ListId']});_0x493f3b[_0x5b3309[_0x8e8d('0x30')]['mapKey']]=_0x5b3309[_0x8e8d('0x30')][_0x8e8d('0x31')];return db['CmContact'][_0x8e8d('0x45')](_0x493f3b);}else{throw new Error(_0x8e8d('0x46'));}})[_0x8e8d('0xf')](function(_0x5d6eb3){_0x2416d8[_0x8e8d('0x47')]=_0x5d6eb3;if(_0x5d6eb3){if(!_0x5b3309[_0x8e8d('0x30')][_0x8e8d('0x18')][_0x8e8d('0x48')]){_0x5b3309['body'][_0x8e8d('0x18')][_0x8e8d('0x48')]=rs[_0x8e8d('0x49')]()+'\x20'+_0x5b3309[_0x8e8d('0x30')][_0x8e8d('0x18')]['from'];}var _0x30696e={'ContactId':_0x5d6eb3['id'],'MailAccountId':_0x5b3309[_0x8e8d('0x34')]['id'],'inReplyTo':_0x5b3309['body']['message'][_0x8e8d('0x48')],'to':_0x5b3309[_0x8e8d('0x30')]['message']['from'],'cc':_0x5b3309['body'][_0x8e8d('0x18')]['cc'],'subject':_0x5b3309[_0x8e8d('0x30')][_0x8e8d('0x18')][_0x8e8d('0x4a')],'attach':_0x5b3309[_0x8e8d('0x30')][_0x8e8d('0x18')][_0x8e8d('0x4b')],'lastMsgAt':moment()[_0x8e8d('0x4c')](_0x8e8d('0x4d')),'lastMsgDirection':'in'};return db[_0x8e8d('0x4e')][_0x8e8d('0x26')]({'where':{'closed':![],'MailAccountId':_0x5b3309['account']['id']},'include':[{'model':db[_0x8e8d('0x4f')],'as':_0x8e8d('0x50'),'attributes':[_0x8e8d('0x48')],'where':{'messageId':_0x5b3309['body'][_0x8e8d('0x18')][_0x8e8d('0x51')]}}]})[_0x8e8d('0xf')](function(_0x2d38a0){if(_0x2d38a0){return[_0x2d38a0,![]];}return db[_0x8e8d('0x4e')][_0x8e8d('0x45')](_0x30696e)[_0x8e8d('0xf')](function(_0xe0718){return[_0xe0718,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x8e8d('0x52')](function(_0x150de4,_0x517cc3){if(_0x150de4){_0x4e755c=_0x517cc3;if(!_0x517cc3){return _0x150de4[_0x8e8d('0x53')]({'inReplyTo':_0x5b3309[_0x8e8d('0x30')][_0x8e8d('0x18')][_0x8e8d('0x48')],'to':_0x5b3309[_0x8e8d('0x30')][_0x8e8d('0x18')][_0x8e8d('0x31')],'cc':_0x5b3309[_0x8e8d('0x30')][_0x8e8d('0x18')]['cc'],'subject':_0x5b3309[_0x8e8d('0x30')][_0x8e8d('0x18')][_0x8e8d('0x4a')],'attach':_0x150de4['attach']?_0x150de4[_0x8e8d('0x4b')]:_0x5b3309['body']['message'][_0x8e8d('0x4b')],'substatus':null,'substatusAt':moment()['format'](_0x8e8d('0x4d')),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x150de4;}}})['then'](function(_0x42bff5){_0x2416d8[_0x8e8d('0x54')]=_0x42bff5[_0x8e8d('0x3c')]({'plain':!![]});_0x2416d8['interaction']['created']=_0x4e755c;return db[_0x8e8d('0x4f')][_0x8e8d('0x45')]({'body':_0x5b3309[_0x8e8d('0x30')][_0x8e8d('0x30')],'MailAccountId':_0x5b3309[_0x8e8d('0x34')]['id'],'MailInteractionId':_0x42bff5['id'],'direction':'in','ContactId':_0x2416d8[_0x8e8d('0x47')]['id'],'messageId':_0x5b3309[_0x8e8d('0x30')]['message'][_0x8e8d('0x48')],'from':_0x5b3309[_0x8e8d('0x30')][_0x8e8d('0x18')][_0x8e8d('0x31')],'to':_0x5b3309['body'][_0x8e8d('0x18')]['to'],'cc':_0x5b3309[_0x8e8d('0x30')][_0x8e8d('0x18')]['cc'],'subject':_0x5b3309[_0x8e8d('0x30')]['message'][_0x8e8d('0x4a')],'attach':_0x5b3309[_0x8e8d('0x30')]['message']['attach'],'Attachments':_0x5b3309[_0x8e8d('0x30')][_0x8e8d('0x18')][_0x8e8d('0x55')],'originTo':_0x5b3309[_0x8e8d('0x30')][_0x8e8d('0x18')][_0x8e8d('0x56')],'originCc':_0x5b3309[_0x8e8d('0x30')][_0x8e8d('0x18')][_0x8e8d('0x57')],'bcc':_0x5b3309[_0x8e8d('0x30')][_0x8e8d('0x18')][_0x8e8d('0x58')],'ChatWebsiteId':_0x5b3309['body'][_0x8e8d('0x18')][_0x8e8d('0x59')]||null,'originChannel':_0x5b3309['body'][_0x8e8d('0x18')][_0x8e8d('0x5a')]||_0x8e8d('0x5b'),'ChatOfflineMessageId':_0x5b3309[_0x8e8d('0x30')][_0x8e8d('0x18')][_0x8e8d('0x5c')]||null},{'include':[{'model':db['Attachment'],'as':_0x8e8d('0x5d')}]});})[_0x8e8d('0xf')](function(_0x131f36){_0x2416d8['message']=_0x131f36;if(_0x2416d8['interaction'][_0x8e8d('0x5e')]){return db[_0x8e8d('0x5f')][_0x8e8d('0x26')]({'attributes':['id',_0x8e8d('0x60')],'where':{'id':_0x2416d8['interaction'][_0x8e8d('0x5e')]}})[_0x8e8d('0xf')](function(_0x265e8c){if(_0x265e8c){_0x2416d8[_0x8e8d('0x3d')]['unshift']({'id':0x0,'priority':0x0,'app':_0x8e8d('0x61'),'appdata':_0x265e8c[_0x8e8d('0x60')]+','+(_0x2416d8[_0x8e8d('0x34')][_0x8e8d('0x62')]||0xa),'interval':_0x8e8d('0x44')});}return respondWithRpcPromise(_0x8e8d('0x63'),_0x8e8d('0x64'),_0x2416d8);});}return respondWithRpcPromise(_0x8e8d('0x63'),'startRouting',_0x2416d8);})[_0x8e8d('0xf')](function(_0x38974c){_0x288e62(_0x38974c);})[_0x8e8d('0x1a')](function(_0x196cd9){_0x21b0cc(_0x212bc4['error'](0x1f4,_0x196cd9[_0x8e8d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 9ab7d0f..28d1daf 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 _0xc9d7=['mailAccount:','./mailAccount.events','save','remove','update','emit','removeListener','register'];(function(_0x1bc9c0,_0x262a29){var _0x5c8753=function(_0x21ea9e){while(--_0x21ea9e){_0x1bc9c0['push'](_0x1bc9c0['shift']());}};_0x5c8753(++_0x262a29);}(_0xc9d7,0x149));var _0x7c9d=function(_0x47cfa0,_0x176b87){_0x47cfa0=_0x47cfa0-0x0;var _0x386b1d=_0xc9d7[_0x47cfa0];return _0x386b1d;};'use strict';var MailAccountEvents=require(_0x7c9d('0x0'));var events=[_0x7c9d('0x1'),_0x7c9d('0x2'),_0x7c9d('0x3')];function createListener(_0x20d43d,_0x3a0f54){return function(_0x54109e){_0x3a0f54[_0x7c9d('0x4')](_0x20d43d,_0x54109e);};}function removeListener(_0x36a6fd,_0x1eacf2){return function(){MailAccountEvents[_0x7c9d('0x5')](_0x36a6fd,_0x1eacf2);};}exports[_0x7c9d('0x6')]=function(_0x22c204){for(var _0x18b838=0x0,_0x3ed3d0=events['length'];_0x18b838<_0x3ed3d0;_0x18b838++){var _0x1cf4a8=events[_0x18b838];var _0x4f7e2d=createListener(_0x7c9d('0x7')+_0x1cf4a8,_0x22c204);MailAccountEvents['on'](_0x1cf4a8,_0x4f7e2d);}}; \ No newline at end of file +var _0x7200=['emit','removeListener','register','mailAccount:','./mailAccount.events','remove'];(function(_0x2f8f01,_0x5dcd60){var _0x53091a=function(_0x2a81da){while(--_0x2a81da){_0x2f8f01['push'](_0x2f8f01['shift']());}};_0x53091a(++_0x5dcd60);}(_0x7200,0x1a8));var _0x0720=function(_0x7299bd,_0x543ab8){_0x7299bd=_0x7299bd-0x0;var _0x10052d=_0x7200[_0x7299bd];return _0x10052d;};'use strict';var MailAccountEvents=require(_0x0720('0x0'));var events=['save',_0x0720('0x1'),'update'];function createListener(_0x21296b,_0xe70aeb){return function(_0x240630){_0xe70aeb[_0x0720('0x2')](_0x21296b,_0x240630);};}function removeListener(_0x51fc7f,_0x358aa9){return function(){MailAccountEvents[_0x0720('0x3')](_0x51fc7f,_0x358aa9);};}exports[_0x0720('0x4')]=function(_0x18d9a4){for(var _0x2d006b=0x0,_0x322d9f=events['length'];_0x2d006b<_0x322d9f;_0x2d006b++){var _0x361507=events[_0x2d006b];var _0x3327c3=createListener(_0x0720('0x5')+_0x361507,_0x18d9a4);MailAccountEvents['on'](_0x361507,_0x3327c3);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index d101f65..e5d6688 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 _0xeba3=['destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./mailApplication.controller','get','/:id','isAuthenticated','show','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeba3,0x119));var _0x3eba=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xeba3[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0x3eba('0x0'));var util=require(_0x3eba('0x1'));var path=require(_0x3eba('0x2'));var timeout=require(_0x3eba('0x3'));var express=require('express');var router=express[_0x3eba('0x4')]();var fs_extra=require(_0x3eba('0x5'));var auth=require(_0x3eba('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3eba('0x7'));router[_0x3eba('0x8')](_0x3eba('0x9'),auth[_0x3eba('0xa')](),controller[_0x3eba('0xb')]);router['put'](_0x3eba('0x9'),auth[_0x3eba('0xa')](),controller['update']);router[_0x3eba('0xc')](_0x3eba('0x9'),auth[_0x3eba('0xa')](),controller[_0x3eba('0xd')]);module['exports']=router; \ No newline at end of file +var _0x7dbe=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','exports'];(function(_0x4bde35,_0x398075){var _0x5d831d=function(_0x32be18){while(--_0x32be18){_0x4bde35['push'](_0x4bde35['shift']());}};_0x5d831d(++_0x398075);}(_0x7dbe,0x1ed));var _0xe7db=function(_0x39b111,_0x40cdcd){_0x39b111=_0x39b111-0x0;var _0x5d5951=_0x7dbe[_0x39b111];return _0x5d5951;};'use strict';var multer=require('multer');var util=require(_0xe7db('0x0'));var path=require(_0xe7db('0x1'));var timeout=require(_0xe7db('0x2'));var express=require(_0xe7db('0x3'));var router=express['Router']();var fs_extra=require(_0xe7db('0x4'));var auth=require(_0xe7db('0x5'));var interaction=require(_0xe7db('0x6'));var config=require(_0xe7db('0x7'));var controller=require(_0xe7db('0x8'));router[_0xe7db('0x9')](_0xe7db('0xa'),auth[_0xe7db('0xb')](),controller[_0xe7db('0xc')]);router[_0xe7db('0xd')](_0xe7db('0xa'),auth[_0xe7db('0xb')](),controller[_0xe7db('0xe')]);router[_0xe7db('0xf')](_0xe7db('0xa'),auth[_0xe7db('0xb')](),controller['destroy']);module[_0xe7db('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 5148e51..5cac44b 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 _0x956c=['STRING','sequelize','exports','INTEGER','noop','TEXT'];(function(_0x1aa44d,_0x115f30){var _0x5541c4=function(_0x4d9919){while(--_0x4d9919){_0x1aa44d['push'](_0x1aa44d['shift']());}};_0x5541c4(++_0x115f30);}(_0x956c,0x1d5));var _0xc956=function(_0x35be42,_0x3e8b16){_0x35be42=_0x35be42-0x0;var _0x1dbfd8=_0x956c[_0x35be42];return _0x1dbfd8;};'use strict';var Sequelize=require(_0xc956('0x0'));module[_0xc956('0x1')]={'priority':{'type':Sequelize[_0xc956('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc956('0x3')},'appdata':{'type':Sequelize[_0xc956('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xc956('0x5')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xfa87=['exports','STRING','*,*,*,*','sequelize'];(function(_0x57d3d9,_0x2d605b){var _0x46730c=function(_0x1e7019){while(--_0x1e7019){_0x57d3d9['push'](_0x57d3d9['shift']());}};_0x46730c(++_0x2d605b);}(_0xfa87,0x19f));var _0x7fa8=function(_0x498396,_0x395c9a){_0x498396=_0x498396-0x0;var _0x1b0fbd=_0xfa87[_0x498396];return _0x1b0fbd;};'use strict';var Sequelize=require(_0x7fa8('0x0'));module[_0x7fa8('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x7fa8('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x7fa8('0x2')]},'interval':{'type':Sequelize[_0x7fa8('0x2')],'defaultValue':_0x7fa8('0x3')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 05d5374..1183c76 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 _0xa9e0=['includeAll','merge','options','find','catch','body','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','show','params','model','MailApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length'];(function(_0x4e6e4a,_0x27bfc4){var _0x54e7ff=function(_0x3b14e1){while(--_0x3b14e1){_0x4e6e4a['push'](_0x4e6e4a['shift']());}};_0x54e7ff(++_0x27bfc4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={'raw':!![],'where':{'id':_0x25fba9[_0x0a9e('0x28')]['id']}},_0x1538a4={};_0x1538a4[_0x0a9e('0x29')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x25fba9['query']);_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],_0x1538a4[_0x0a9e('0x2c')]);_0x140511[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],qs[_0x0a9e('0x31')](_0x25fba9[_0x0a9e('0x2c')]['fields']));_0x140511[_0x0a9e('0x30')]=_0x140511['attributes'][_0x0a9e('0x32')]?_0x140511[_0x0a9e('0x30')]:_0x1538a4[_0x0a9e('0x29')];if(_0x25fba9[_0x0a9e('0x2c')][_0x0a9e('0x33')]){_0x140511['include']=[{'all':!![]}];}_0x140511=_[_0x0a9e('0x34')]({},_0x140511,_0x25fba9[_0x0a9e('0x35')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x36')](_0x140511)[_0x0a9e('0x22')](handleEntityNotFound(_0x14433c,null))[_0x0a9e('0x22')](respondWithResult(_0x14433c,null))[_0x0a9e('0x37')](handleError(_0x14433c,null));};exports[_0x0a9e('0x21')]=function(_0x5583a4,_0x44295a){if(_0x5583a4['body']['id']){delete _0x5583a4[_0x0a9e('0x38')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x36')]({'where':{'id':_0x5583a4[_0x0a9e('0x28')]['id']}})['then'](handleEntityNotFound(_0x44295a,null))[_0x0a9e('0x22')](saveUpdates(_0x5583a4[_0x0a9e('0x38')],null))[_0x0a9e('0x22')](respondWithResult(_0x44295a,null))[_0x0a9e('0x37')](handleError(_0x44295a,null));};exports['destroy']=function(_0x54135e,_0x1e8694){return db['MailApplication'][_0x0a9e('0x36')]({'where':{'id':_0x54135e[_0x0a9e('0x28')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1e8694,null))[_0x0a9e('0x22')](removeEntity(_0x1e8694,null))['catch'](handleError(_0x1e8694,null));}; \ No newline at end of file +var _0x9bde=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','error','name','send','show','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','params','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x1082ab,_0x133d5b){var _0x2de4cf=function(_0x551eb1){while(--_0x551eb1){_0x1082ab['push'](_0x1082ab['shift']());}};_0x2de4cf(++_0x133d5b);}(_0x9bde,0xe1));var _0xe9bd=function(_0x320df9,_0x283c52){_0x320df9=_0x320df9-0x0;var _0x43fef4=_0x9bde[_0x320df9];return _0x43fef4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x5e022a,_0x2c1d98){_0x2c1d98=_0x2c1d98||0xcc;return function(_0x4ac319){if(_0x4ac319){return _0x5e022a[_0xe9bd('0x19')](_0x2c1d98);}return _0x5e022a[_0xe9bd('0x1a')](_0x2c1d98)[_0xe9bd('0x1b')]();};}function respondWithResult(_0x51109f,_0x47ba5e){_0x47ba5e=_0x47ba5e||0xc8;return function(_0x46a95e){if(_0x46a95e){return _0x51109f[_0xe9bd('0x1a')](_0x47ba5e)[_0xe9bd('0x1c')](_0x46a95e);}};}function respondWithFilteredResult(_0x46a59b,_0x3360bd){return function(_0x389e7b){if(_0x389e7b){var _0x45a9f2=typeof _0x3360bd['offset']===_0xe9bd('0x1d')&&typeof _0x3360bd[_0xe9bd('0x1e')]===_0xe9bd('0x1d');var _0x494b27=_0x389e7b[_0xe9bd('0x1f')];var _0x3bae08=_0x45a9f2?0x0:_0x3360bd[_0xe9bd('0x20')];var _0x330733=_0x45a9f2?_0x389e7b['count']:_0x3360bd[_0xe9bd('0x20')]+_0x3360bd['limit'];var _0xc6b661;if(_0x330733>=_0x494b27){_0x330733=_0x494b27;_0xc6b661=0xc8;}else{_0xc6b661=0xce;}_0x46a59b['status'](_0xc6b661);return _0x46a59b[_0xe9bd('0x21')](_0xe9bd('0x22'),_0x3bae08+'-'+_0x330733+'/'+_0x494b27)[_0xe9bd('0x1c')](_0x389e7b);}return null;};}function patchUpdates(_0x3dda13){return function(_0x1acb82){try{jsonpatch[_0xe9bd('0x23')](_0x1acb82,_0x3dda13,!![]);}catch(_0x6593ce){return BPromise['reject'](_0x6593ce);}return _0x1acb82[_0xe9bd('0x24')]();};}function saveUpdates(_0x28cd17,_0x4ecaf5){return function(_0x37aec1){if(_0x37aec1){return _0x37aec1['update'](_0x28cd17)[_0xe9bd('0x25')](function(_0x1b9cc9){return _0x1b9cc9;});}return null;};}function removeEntity(_0x36f8c0,_0xf02209){return function(_0x5bc4bf){if(_0x5bc4bf){return _0x5bc4bf[_0xe9bd('0x26')]()[_0xe9bd('0x25')](function(){_0x36f8c0[_0xe9bd('0x1a')](0xcc)[_0xe9bd('0x1b')]();});}};}function handleEntityNotFound(_0x2641be,_0xb52d45){return function(_0x399f3c){if(!_0x399f3c){_0x2641be[_0xe9bd('0x19')](0x194);}return _0x399f3c;};}function handleError(_0x1ae889,_0x5987af){_0x5987af=_0x5987af||0x1f4;return function(_0x3c211a){logger[_0xe9bd('0x27')](_0x3c211a['stack']);if(_0x3c211a[_0xe9bd('0x28')]){delete _0x3c211a[_0xe9bd('0x28')];}_0x1ae889[_0xe9bd('0x1a')](_0x5987af)[_0xe9bd('0x29')](_0x3c211a);};}exports[_0xe9bd('0x2a')]=function(_0x183601,_0x519f48){var _0x5b7f1d={'raw':!![],'where':{'id':_0x183601['params']['id']}},_0x1de54c={};_0x1de54c[_0xe9bd('0x2b')]=_[_0xe9bd('0x2c')](db[_0xe9bd('0x2d')][_0xe9bd('0x2e')]);_0x1de54c[_0xe9bd('0x2f')]=_['keys'](_0x183601['query']);_0x1de54c[_0xe9bd('0x30')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],_0x1de54c[_0xe9bd('0x2f')]);_0x5b7f1d[_0xe9bd('0x32')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],qs[_0xe9bd('0x33')](_0x183601[_0xe9bd('0x2f')]['fields']));_0x5b7f1d[_0xe9bd('0x32')]=_0x5b7f1d[_0xe9bd('0x32')][_0xe9bd('0x34')]?_0x5b7f1d['attributes']:_0x1de54c['model'];if(_0x183601[_0xe9bd('0x2f')][_0xe9bd('0x35')]){_0x5b7f1d[_0xe9bd('0x36')]=[{'all':!![]}];}_0x5b7f1d=_[_0xe9bd('0x37')]({},_0x5b7f1d,_0x183601[_0xe9bd('0x38')]);return db[_0xe9bd('0x2d')][_0xe9bd('0x39')](_0x5b7f1d)[_0xe9bd('0x25')](handleEntityNotFound(_0x519f48,null))[_0xe9bd('0x25')](respondWithResult(_0x519f48,null))[_0xe9bd('0x3a')](handleError(_0x519f48,null));};exports[_0xe9bd('0x3b')]=function(_0x549dd1,_0x2ad46e){if(_0x549dd1[_0xe9bd('0x3c')]['id']){delete _0x549dd1[_0xe9bd('0x3c')]['id'];}return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x549dd1[_0xe9bd('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2ad46e,null))[_0xe9bd('0x25')](saveUpdates(_0x549dd1[_0xe9bd('0x3c')],null))['then'](respondWithResult(_0x2ad46e,null))[_0xe9bd('0x3a')](handleError(_0x2ad46e,null));};exports[_0xe9bd('0x26')]=function(_0x4c7d47,_0x4b1da0){return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x4c7d47['params']['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x4b1da0,null))[_0xe9bd('0x25')](removeEntity(_0x4b1da0,null))[_0xe9bd('0x3a')](handleError(_0x4b1da0,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 2d32be7..565f1f9 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 _0x9668=['utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','request-promise','path','rimraf','../../config/environment','define','MailApplication'];(function(_0x19b140,_0x2d11aa){var _0x1f32ac=function(_0x3df05c){while(--_0x3df05c){_0x19b140['push'](_0x19b140['shift']());}};_0x1f32ac(++_0x2d11aa);}(_0x9668,0x136));var _0x8966=function(_0x4229d3,_0x4b4f29){_0x4229d3=_0x4229d3-0x0;var _0x89ce0e=_0x9668[_0x4229d3];return _0x89ce0e;};'use strict';var _=require('lodash');var util=require(_0x8966('0x0'));var logger=require('../../config/logger')(_0x8966('0x1'));var moment=require('moment');var BPromise=require(_0x8966('0x2'));var rp=require(_0x8966('0x3'));var fs=require('fs');var path=require(_0x8966('0x4'));var rimraf=require(_0x8966('0x5'));var config=require(_0x8966('0x6'));var attributes=require('./mailApplication.attributes');module['exports']=function(_0xefc1af,_0x1a0164){return _0xefc1af[_0x8966('0x7')](_0x8966('0x8'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8966('0x9'),'collate':_0x8966('0xa')});}; \ No newline at end of file +var _0x1ec1=['bluebird','request-promise','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4_unicode_ci','util','moment'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x1ec1,0x11e));var _0x11ec=function(_0x1ac126,_0x1e6cca){_0x1ac126=_0x1ac126-0x0;var _0x55cadb=_0x1ec1[_0x1ac126];return _0x55cadb;};'use strict';var _=require('lodash');var util=require(_0x11ec('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x11ec('0x1'));var BPromise=require(_0x11ec('0x2'));var rp=require(_0x11ec('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x11ec('0x4'));var config=require(_0x11ec('0x5'));var attributes=require(_0x11ec('0x6'));module[_0x11ec('0x7')]=function(_0x523af0,_0x1c4e6c){return _0x523af0[_0x11ec('0x8')](_0x11ec('0x9'),attributes,{'tableName':_0x11ec('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x11ec('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 699f96b..578517e 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 _0x4590=['debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','MailApplication','update','options','raw','attributes','limit','UpdateMailApplication','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','MailApplication,\x20%s,\x20%s'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4590,0x184));var _0x0459=function(_0x375961,_0x211a76){_0x375961=_0x375961-0x0;var _0x50f35a=_0x4590[_0x375961];return _0x50f35a;};'use strict';var _=require(_0x0459('0x0'));var util=require(_0x0459('0x1'));var moment=require(_0x0459('0x2'));var BPromise=require(_0x0459('0x3'));var rs=require(_0x0459('0x4'));var fs=require('fs');var Redis=require(_0x0459('0x5'));var db=require(_0x0459('0x6'))['db'];var utils=require(_0x0459('0x7'));var logger=require(_0x0459('0x8'))(_0x0459('0x9'));var config=require(_0x0459('0xa'));var jayson=require(_0x0459('0xb'));var client=jayson['client'][_0x0459('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x32d1b3,_0x127880,_0x3dd199){return new BPromise(function(_0x5b7c3a,_0x569cdf){return client['request'](_0x32d1b3,_0x3dd199)[_0x0459('0xd')](function(_0x33748d){logger['info'](_0x0459('0xe'),_0x127880,'request\x20sent');logger[_0x0459('0xf')](_0x0459('0x10'),_0x127880,_0x0459('0x11'),JSON[_0x0459('0x12')](_0x33748d));if(_0x33748d['error']){if(_0x33748d[_0x0459('0x13')]['code']===0x1f4){logger['error']('MailApplication,\x20%s,\x20%s',_0x127880,_0x33748d[_0x0459('0x13')]['message']);return _0x569cdf(_0x33748d[_0x0459('0x13')][_0x0459('0x14')]);}logger[_0x0459('0x13')](_0x0459('0xe'),_0x127880,_0x33748d['error']['message']);return _0x5b7c3a(_0x33748d['error']['message']);}else{logger[_0x0459('0x15')](_0x0459('0xe'),_0x127880,_0x0459('0x11'));_0x5b7c3a(_0x33748d[_0x0459('0x16')][_0x0459('0x14')]);}})['catch'](function(_0x33ff61){logger[_0x0459('0x13')](_0x0459('0xe'),_0x127880,_0x33ff61);_0x569cdf(_0x33ff61);});});}exports['UpdateMailApplication']=function(_0x4caf7d){var _0x30ea54=this;return new Promise(function(_0x119e88,_0x780510){return db[_0x0459('0x17')][_0x0459('0x18')](_0x4caf7d['body'],{'raw':_0x4caf7d[_0x0459('0x19')]?_0x4caf7d[_0x0459('0x19')][_0x0459('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4caf7d[_0x0459('0x19')]?_0x4caf7d[_0x0459('0x19')]['where']||null:null,'attributes':_0x4caf7d['options']?_0x4caf7d[_0x0459('0x19')][_0x0459('0x1b')]||null:null,'limit':_0x4caf7d[_0x0459('0x19')]?_0x4caf7d[_0x0459('0x19')][_0x0459('0x1c')]||null:null})[_0x0459('0xd')](function(_0x4fd33b){logger['info']('UpdateMailApplication',_0x4caf7d);logger[_0x0459('0xf')](_0x0459('0x1d'),_0x4caf7d,JSON['stringify'](_0x4fd33b));_0x119e88(_0x4fd33b);})[_0x0459('0x1e')](function(_0x47cb00){logger[_0x0459('0x13')]('UpdateMailApplication',_0x47cb00[_0x0459('0x14')],_0x4caf7d);_0x780510(_0x30ea54[_0x0459('0x13')](0x1f4,_0x47cb00[_0x0459('0x14')]));});});}; \ No newline at end of file +var _0x73ae=['moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','MailApplication,\x20%s,\x20%s','message','info','result','catch','UpdateMailApplication','body','options','raw','where','attributes','debug','util'];(function(_0x2c7769,_0x44c14e){var _0x3cabc8=function(_0x6269c7){while(--_0x6269c7){_0x2c7769['push'](_0x2c7769['shift']());}};_0x3cabc8(++_0x44c14e);}(_0x73ae,0x1bf));var _0xe73a=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x73ae[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require('lodash');var util=require(_0xe73a('0x0'));var moment=require(_0xe73a('0x1'));var BPromise=require(_0xe73a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe73a('0x3'));var db=require(_0xe73a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe73a('0x5'));var config=require(_0xe73a('0x6'));var jayson=require(_0xe73a('0x7'));var client=jayson[_0xe73a('0x8')][_0xe73a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1020de,_0x45180b,_0xf6808d){return new BPromise(function(_0x27ac4e,_0xbc56c9){return client[_0xe73a('0xa')](_0x1020de,_0xf6808d)[_0xe73a('0xb')](function(_0x5b0fe2){logger['info']('MailApplication,\x20%s,\x20%s',_0x45180b,_0xe73a('0xc'));logger['debug'](_0xe73a('0xd'),_0x45180b,'request\x20sent',JSON[_0xe73a('0xe')](_0x5b0fe2));if(_0x5b0fe2[_0xe73a('0xf')]){if(_0x5b0fe2[_0xe73a('0xf')]['code']===0x1f4){logger['error'](_0xe73a('0x10'),_0x45180b,_0x5b0fe2['error'][_0xe73a('0x11')]);return _0xbc56c9(_0x5b0fe2[_0xe73a('0xf')][_0xe73a('0x11')]);}logger[_0xe73a('0xf')](_0xe73a('0x10'),_0x45180b,_0x5b0fe2[_0xe73a('0xf')][_0xe73a('0x11')]);return _0x27ac4e(_0x5b0fe2[_0xe73a('0xf')][_0xe73a('0x11')]);}else{logger[_0xe73a('0x12')]('MailApplication,\x20%s,\x20%s',_0x45180b,_0xe73a('0xc'));_0x27ac4e(_0x5b0fe2[_0xe73a('0x13')][_0xe73a('0x11')]);}})[_0xe73a('0x14')](function(_0x32d6be){logger[_0xe73a('0xf')]('MailApplication,\x20%s,\x20%s',_0x45180b,_0x32d6be);_0xbc56c9(_0x32d6be);});});}exports[_0xe73a('0x15')]=function(_0x2aebf8){var _0x4d279b=this;return new Promise(function(_0x23de6f,_0x4ac509){return db['MailApplication']['update'](_0x2aebf8[_0xe73a('0x16')],{'raw':_0x2aebf8[_0xe73a('0x17')]?_0x2aebf8[_0xe73a('0x17')][_0xe73a('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2aebf8[_0xe73a('0x17')]?_0x2aebf8[_0xe73a('0x17')][_0xe73a('0x19')]||null:null,'attributes':_0x2aebf8[_0xe73a('0x17')]?_0x2aebf8['options'][_0xe73a('0x1a')]||null:null,'limit':_0x2aebf8['options']?_0x2aebf8[_0xe73a('0x17')]['limit']||null:null})[_0xe73a('0xb')](function(_0x47e316){logger[_0xe73a('0x12')](_0xe73a('0x15'),_0x2aebf8);logger[_0xe73a('0x1b')](_0xe73a('0x15'),_0x2aebf8,JSON['stringify'](_0x47e316));_0x23de6f(_0x47e316);})[_0xe73a('0x14')](function(_0x2a86ff){logger[_0xe73a('0xf')](_0xe73a('0x15'),_0x2a86ff[_0xe73a('0x11')],_0x2aebf8);_0x4ac509(_0x4d279b['error'](0x1f4,_0x2a86ff[_0xe73a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 50465cd..9c7c4e5 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 _0x10e0=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','download','post','create','/:id/messages','addMessage','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','express'];(function(_0x5551df,_0x13d188){var _0x2e3d36=function(_0x4c71a6){while(--_0x4c71a6){_0x5551df['push'](_0x5551df['shift']());}};_0x2e3d36(++_0x13d188);}(_0x10e0,0x1bf));var _0x010e=function(_0x31d4a7,_0x135a21){_0x31d4a7=_0x31d4a7-0x0;var _0x12b3c6=_0x10e0[_0x31d4a7];return _0x12b3c6;};'use strict';var express=require(_0x010e('0x0'));var router=express['Router']();var auth=require(_0x010e('0x1'));var interaction=require(_0x010e('0x2'));var controller=require('./mailInteraction.controller');router[_0x010e('0x3')]('/',auth[_0x010e('0x4')](),controller[_0x010e('0x5')]);router[_0x010e('0x3')](_0x010e('0x6'),auth[_0x010e('0x4')](),controller[_0x010e('0x7')]);router[_0x010e('0x3')](_0x010e('0x8'),auth[_0x010e('0x4')](),controller[_0x010e('0x9')]);router[_0x010e('0x3')]('/:id/messages',auth['isAuthenticated'](),controller[_0x010e('0xa')]);router['get']('/:id/download',auth[_0x010e('0x4')](),controller[_0x010e('0xb')]);router[_0x010e('0xc')]('/',auth['isAuthenticated'](),controller[_0x010e('0xd')]);router[_0x010e('0xc')](_0x010e('0xe'),auth[_0x010e('0x4')](),controller[_0x010e('0xf')]);router[_0x010e('0xc')]('/:id/tags',auth[_0x010e('0x4')](),interaction[_0x010e('0x10')](_0x010e('0x11'),_0x010e('0x12')),controller[_0x010e('0x13')]);router[_0x010e('0x14')]('/:id',auth[_0x010e('0x4')](),interaction['tracked'](_0x010e('0x11'),_0x010e('0x15')),controller[_0x010e('0x16')]);router[_0x010e('0x17')]('/:id',auth['isAuthenticated'](),interaction[_0x010e('0x10')](_0x010e('0x11'),_0x010e('0x18')),controller[_0x010e('0x19')]);router['delete']('/:id/tags',auth[_0x010e('0x4')](),controller[_0x010e('0x1a')]);module[_0x010e('0x1b')]=router; \ No newline at end of file +var _0x3692=['addMessage','tracked','mail','mailinteraction:addtags','addTags','put','update','delete','mailinteraction:destroy','destroy','removeTags','exports','Router','../../components/auth/service','./mailInteraction.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','post'];(function(_0x5df276,_0x213082){var _0x50b0ae=function(_0x30e1f4){while(--_0x30e1f4){_0x5df276['push'](_0x5df276['shift']());}};_0x50b0ae(++_0x213082);}(_0x3692,0xfc));var _0x2369=function(_0x359dcf,_0x5786cf){_0x359dcf=_0x359dcf-0x0;var _0x25a5c5=_0x3692[_0x359dcf];return _0x25a5c5;};'use strict';var express=require('express');var router=express[_0x2369('0x0')]();var auth=require(_0x2369('0x1'));var interaction=require('../../components/interaction/service');var controller=require(_0x2369('0x2'));router[_0x2369('0x3')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2369('0x4'),auth[_0x2369('0x5')](),controller[_0x2369('0x6')]);router['get'](_0x2369('0x7'),auth[_0x2369('0x5')](),controller[_0x2369('0x8')]);router['get'](_0x2369('0x9'),auth['isAuthenticated'](),controller[_0x2369('0xa')]);router['get']('/:id/download',auth[_0x2369('0x5')](),controller['download']);router['post']('/',auth[_0x2369('0x5')](),controller['create']);router[_0x2369('0xb')]('/:id/messages',auth[_0x2369('0x5')](),controller[_0x2369('0xc')]);router[_0x2369('0xb')]('/:id/tags',auth[_0x2369('0x5')](),interaction[_0x2369('0xd')](_0x2369('0xe'),_0x2369('0xf')),controller[_0x2369('0x10')]);router[_0x2369('0x11')](_0x2369('0x7'),auth['isAuthenticated'](),interaction[_0x2369('0xd')](_0x2369('0xe'),'mailinteraction:update'),controller[_0x2369('0x12')]);router[_0x2369('0x13')](_0x2369('0x7'),auth[_0x2369('0x5')](),interaction[_0x2369('0xd')](_0x2369('0xe'),_0x2369('0x14')),controller[_0x2369('0x15')]);router[_0x2369('0x13')]('/:id/tags',auth[_0x2369('0x5')](),controller[_0x2369('0x16')]);module[_0x2369('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 158fb3d..607ad2a 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 _0xf0e5=['DATE','STRING','TEXT','long','BOOLEAN','out','ENUM','sequelize','iconv','exports'];(function(_0x47d93e,_0x440eed){var _0xa468e7=function(_0x690781){while(--_0x690781){_0x47d93e['push'](_0x47d93e['shift']());}};_0xa468e7(++_0x440eed);}(_0xf0e5,0x133));var _0x5f0e=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xf0e5[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require(_0x5f0e('0x0'));var iconv=require(_0x5f0e('0x1'));module[_0x5f0e('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5f0e('0x3')]},'disposition':{'type':Sequelize[_0x5f0e('0x4')]},'secondDisposition':{'type':Sequelize[_0x5f0e('0x4')]},'thirdDisposition':{'type':Sequelize[_0x5f0e('0x4')]},'note':{'type':Sequelize[_0x5f0e('0x4')]},'inReplyTo':{'type':Sequelize[_0x5f0e('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x5f0e('0x5')](_0x5f0e('0x6'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x5f0e('0x7')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x5f0e('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x5f0e('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x5f0e('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5f0e('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x5f0e('0x9')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x5f0e('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x9b69=['BOOLEAN','DATE','STRING','long','TEXT','ENUM','out','sequelize','iconv','exports'];(function(_0x4a0a70,_0x37aade){var _0x54f151=function(_0x431e03){while(--_0x431e03){_0x4a0a70['push'](_0x4a0a70['shift']());}};_0x54f151(++_0x37aade);}(_0x9b69,0x183));var _0x99b6=function(_0x582583,_0x3e4cf4){_0x582583=_0x582583-0x0;var _0x4fd510=_0x9b69[_0x582583];return _0x4fd510;};'use strict';var Sequelize=require(_0x99b6('0x0'));var iconv=require(_0x99b6('0x1'));module[_0x99b6('0x2')]={'closed':{'type':Sequelize[_0x99b6('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x99b6('0x4')]},'disposition':{'type':Sequelize[_0x99b6('0x5')]},'secondDisposition':{'type':Sequelize[_0x99b6('0x5')]},'thirdDisposition':{'type':Sequelize[_0x99b6('0x5')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x99b6('0x5')](0x1fe)},'to':{'type':Sequelize[_0x99b6('0x5')]},'cc':{'type':Sequelize['TEXT'](_0x99b6('0x6'))},'subject':{'type':Sequelize[_0x99b6('0x7')]()},'attach':{'type':Sequelize[_0x99b6('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x99b6('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x99b6('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x99b6('0x8')]('in',_0x99b6('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x99b6('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x99b6('0x8')]('in',_0x99b6('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x99b6('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index b558504..d0e0480 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 _0xab0e=['attachments','format','transcript-%d-%s.zip','Attachment','Attachments','Messages','subject','get','mkdirSync','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','readFileSync','build','writeFileSync','unlinkSync','eml-format','zip-dir','moment','bluebird','util','path','lodash','squel','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','update','then','name','fullname','Tags','TagIds','split','forEach','push','MailMessage','out','plainBody','-id','trimStart','catch','map','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','select','field','color','from','tools_tags','u.id','ui.MailInteractionId','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','o.id\x20=\x20i.UserId','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\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','type','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','keys','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20>\x200','tag','isArray','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','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','merge','MailInteraction','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.MailInteractionId\x20IN\x20?','MailInteractionId','Setting','enableEmailPreview','all','rows','show','rawAttributes','includeAll','include','options','create','body','params','describe','addMessage','ids','omit','getMessages','nolimit','findAll','inlineCss','true','addTags','spread','Tag','emit','removeTags','unix','join','root','server','files','tmp'];(function(_0x50dd66,_0x47add2){var _0x197f56=function(_0x57dcef){while(--_0x57dcef){_0x50dd66['push'](_0x50dd66['shift']());}};_0x197f56(++_0x47add2);}(_0xab0e,0x1e9));var _0xeab0=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xab0e[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0xeab0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeab0('0x1'));var moment=require(_0xeab0('0x2'));var BPromise=require(_0xeab0('0x3'));var util=require(_0xeab0('0x4'));var path=require(_0xeab0('0x5'));var fs=require('fs');var _=require(_0xeab0('0x6'));var squel=require(_0xeab0('0x7'));var juice=require(_0xeab0('0x8'));var Redis=require(_0xeab0('0x9'));var qs=require(_0xeab0('0xa'));var as=require(_0xeab0('0xb'));var logger=require(_0xeab0('0xc'))(_0xeab0('0xd'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var htmlEntities=require(_0xeab0('0xe'));config[_0xeab0('0xf')]=_[_0xeab0('0x10')](config[_0xeab0('0xf')],{'host':_0xeab0('0x11'),'port':0x18eb});var socket=require(_0xeab0('0x12'))(new Redis(config[_0xeab0('0xf')]));require(_0xeab0('0x13'))[_0xeab0('0x14')](socket);function respondWithStatusCode(_0x13d1d5,_0x273950){_0x273950=_0x273950||0xcc;return function(_0x19f965){if(_0x19f965){return _0x13d1d5[_0xeab0('0x15')](_0x273950);}return _0x13d1d5['status'](_0x273950)[_0xeab0('0x16')]();};}function respondWithResult(_0x224dc1,_0x53de6a){_0x53de6a=_0x53de6a||0xc8;return function(_0x1a646d){if(_0x1a646d){return _0x224dc1[_0xeab0('0x17')](_0x53de6a)[_0xeab0('0x18')](_0x1a646d);}};}function respondWithFilteredResult(_0x2a9eb3,_0x45a5b9){return function(_0x1bed13){if(_0x1bed13){var _0x31bcf4=typeof _0x45a5b9['offset']===_0xeab0('0x19')&&typeof _0x45a5b9[_0xeab0('0x1a')]===_0xeab0('0x19');var _0x261e75=_0x1bed13[_0xeab0('0x1b')];var _0x3a090f=_0x31bcf4?0x0:_0x45a5b9[_0xeab0('0x1c')];var _0x4aea4d=_0x31bcf4?_0x1bed13['count']:_0x45a5b9[_0xeab0('0x1c')]+_0x45a5b9['limit'];var _0xf1cbb1;if(_0x4aea4d>=_0x261e75){_0x4aea4d=_0x261e75;_0xf1cbb1=0xc8;}else{_0xf1cbb1=0xce;}_0x2a9eb3[_0xeab0('0x17')](_0xf1cbb1);return _0x2a9eb3[_0xeab0('0x1d')](_0xeab0('0x1e'),_0x3a090f+'-'+_0x4aea4d+'/'+_0x261e75)[_0xeab0('0x18')](_0x1bed13);}return null;};}function saveUpdates(_0x512730){return function(_0x1ce5ea){if(_0x1ce5ea){return _0x1ce5ea[_0xeab0('0x1f')](_0x512730)[_0xeab0('0x20')](function(_0x2e7c46){return _0x2e7c46;});}return null;};}function removeEntity(_0x1a6566){return function(_0x3abac1){if(_0x3abac1){return _0x3abac1['destroy']()['then'](function(){_0x1a6566['status'](0xcc)[_0xeab0('0x16')]();});}};}function handleEntityNotFound(_0x51c7dc){return function(_0x3eda2b){if(!_0x3eda2b){_0x51c7dc[_0xeab0('0x15')](0x194);}return _0x3eda2b;};}function handleError(_0x3102e1,_0x5e954f){_0x5e954f=_0x5e954f||0x1f4;return function(_0x1b9b43){logger['error'](_0x1b9b43['stack']);if(_0x1b9b43[_0xeab0('0x21')]){delete _0x1b9b43['name'];}_0x3102e1[_0xeab0('0x17')](_0x5e954f)['send'](_0x1b9b43);};}function getInteractionUsers(_0x4d21aa,_0x23efa6){return new BPromise(function(_0xe811d7,_0x426aea){try{if(_0x23efa6[_0x4d21aa['id']]){_0x4d21aa['Users']=_['map'](_0x23efa6[_0x4d21aa['id']],function(_0x3634b3){return{'id':_0x3634b3['id'],'fullname':_0x3634b3[_0xeab0('0x22')]};});}}catch(_0x3e3e0c){_0x426aea(_0x3e3e0c);}_0xe811d7(_0x4d21aa);});}function getInteractionTags(_0x205c52,_0xb5fc75){return new BPromise(function(_0x2a6371,_0x14389a){try{if(_0x205c52['TagIds']){_0x205c52[_0xeab0('0x23')]=[];_0x205c52[_0xeab0('0x24')][_0xeab0('0x25')](',')[_0xeab0('0x26')](function(_0x3b173c){_0x205c52[_0xeab0('0x23')][_0xeab0('0x27')](_0xb5fc75[_0x3b173c]);});}delete _0x205c52[_0xeab0('0x24')];}catch(_0x54536a){_0x14389a(_0x54536a);}_0x2a6371(_0x205c52);});}function getLastMessageText(_0x41a9da){return new BPromise(function(_0x1d3f62,_0x2d4cc3){return db[_0xeab0('0x28')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x41a9da['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xeab0('0x29')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xeab0('0x2a')],'order':_0xeab0('0x2b'),'raw':!![]})[_0xeab0('0x20')](function(_0x25946d){if(_0x25946d&&_0x25946d[_0xeab0('0x2a')]){_0x41a9da['lastMsgText']=_[_0xeab0('0x2c')](_0x25946d['plainBody']);}_0x1d3f62(_0x41a9da);})[_0xeab0('0x2d')](function(_0x42cab2){_0x2d4cc3(_0x42cab2);});});}function updateMailInteraction(_0x3e82e9,_0x248bab,_0x560a26,_0x5139e2){return new BPromise(function(_0x570bcb,_0x35f1f2){return getInteractionUsers(_0x3e82e9,_0x560a26)['then'](function(_0x5e349d){return getInteractionTags(_0x5e349d,_0x248bab);})['then'](function(_0x5eb800){if(_0x5139e2){_0x570bcb(getLastMessageText(_0x5eb800));}else{_0x570bcb(_0x5eb800);}})[_0xeab0('0x2d')](function(_0x26a994){_0x35f1f2(_0x26a994);});});}exports['index']=function(_0xba0661,_0xb81afa){var _0x51ed8f={},_0x23039a={},_0x5692f5={'count':0x0,'rows':[]};var _0x25dfa6=_[_0xeab0('0x2e')](db['MailInteraction']['rawAttributes'],function(_0x4efb52){return{'name':_0x4efb52['fieldName'],'type':_0x4efb52['type'][_0xeab0('0x2f')]};});_0x23039a[_0xeab0('0x30')]=_[_0xeab0('0x2e')](_0x25dfa6,_0xeab0('0x21'));_0x23039a[_0xeab0('0x31')]=_['keys'](_0xba0661['query']);_0x23039a[_0xeab0('0x32')]=_['intersection'](_0x23039a[_0xeab0('0x30')],_0x23039a['query']);_0x51ed8f[_0xeab0('0x33')]=_[_0xeab0('0x34')](_0x23039a[_0xeab0('0x30')],qs[_0xeab0('0x35')](_0xba0661[_0xeab0('0x31')]['fields']));_0x51ed8f[_0xeab0('0x33')]=_0x51ed8f['attributes'][_0xeab0('0x36')]?_0x51ed8f[_0xeab0('0x33')]:_0x23039a[_0xeab0('0x30')];if(!_0xba0661[_0xeab0('0x31')][_0xeab0('0x37')]('nolimit')){_0x51ed8f[_0xeab0('0x1a')]=qs['limit'](_0xba0661['query'][_0xeab0('0x1a')]);_0x51ed8f[_0xeab0('0x1c')]=qs[_0xeab0('0x1c')](_0xba0661[_0xeab0('0x31')]['offset']);}_0x51ed8f['order']=qs[_0xeab0('0x38')](_0xba0661[_0xeab0('0x31')][_0xeab0('0x38')]);_0x51ed8f[_0xeab0('0x39')]=qs[_0xeab0('0x32')](_[_0xeab0('0x3a')](_0xba0661[_0xeab0('0x31')],_0x23039a['filters']),_0x25dfa6);var _0x50bc12=[];var _0x2aaab8=squel[_0xeab0('0x3b')]()[_0xeab0('0x3c')]('id')['field'](_0xeab0('0x21'))[_0xeab0('0x3c')](_0xeab0('0x3d'))[_0xeab0('0x3e')](_0xeab0('0x3f'));var _0x33a315=squel[_0xeab0('0x3b')]()[_0xeab0('0x3c')](_0xeab0('0x40'))[_0xeab0('0x3c')]('u.fullname')[_0xeab0('0x3c')](_0xeab0('0x41'))['from'](_0xeab0('0x42'),'ui')['left_join'](_0xeab0('0x43'),'u',_0xeab0('0x44'));var _0x24ea24=squel['select']()[_0xeab0('0x3e')](_0xeab0('0x45'),'i')[_0xeab0('0x46')](_0xeab0('0x47'),'c',_0xeab0('0x48'))['left_join'](_0xeab0('0x43'),'o',_0xeab0('0x49'))['left_join']('mail_accounts','a','a.id\x20=\x20i.MailAccountId')[_0xeab0('0x46')]('mail_messages','me',_0xeab0('0x4a'))['left_join']('mail_interaction_has_tags','it',_0xeab0('0x4b'))[_0xeab0('0x46')](_0xeab0('0x3f'),'t',_0xeab0('0x4c'));var _0x1ed1f9=squel[_0xeab0('0x4d')]();var _0x3e9d06=[];var _0x3b3fe6=squel[_0xeab0('0x4d')]();var _0x8e31e2;if(_0xba0661['query'][_0xeab0('0x4e')]){_0x8e31e2=as[_0xeab0('0x4f')](_0xba0661[_0xeab0('0x31')][_0xeab0('0x4e')]);var _0x5cfdfa=_0x8e31e2[_0xeab0('0x50')];for(var _0x26fd14=0x0;_0x26fd14<_0x8e31e2['conditions']['length'];_0x26fd14++){var _0x58e342=_0x8e31e2[_0xeab0('0x51')][_0x26fd14];var _0x578231='i';var _0x3fbbf9=_[_0xeab0('0x52')](_0x25dfa6,['name',_0x58e342[_0xeab0('0x3c')]]);if(!_0x3fbbf9){switch(_0x58e342[_0xeab0('0x3c')]){case _0xeab0('0x53'):if(_0x58e342[_0xeab0('0x54')]==0x1){_0x24ea24['having']('`'+_0x58e342[_0xeab0('0x3c')]+'`\x20=\x200');}else{_0x24ea24['having']('`'+_0x58e342['field']+_0xeab0('0x55'));}break;case _0xeab0('0x56'):if(_0x58e342[_0xeab0('0x57')]===_0xeab0('0x58')){if(_0x58e342[_0xeab0('0x54')][_0xeab0('0x25')]('\x20')[_0xeab0('0x36')]>0x1){_0x1ed1f9[_0x5cfdfa](_0xeab0('0x59'),qs[_0xeab0('0x5a')](_0x58e342['value']),null);}else{var _0x50eccf='%'+_0x58e342[_0xeab0('0x54')]+'%';_0x1ed1f9[_0x5cfdfa](_0xeab0('0x5b'),_0x50eccf,_0x50eccf,_0x50eccf);}}else{_0x3fbbf9=_[_0xeab0('0x52')](_0x25dfa6,[_0xeab0('0x21'),_0xeab0('0x5c')]);_0x58e342[_0xeab0('0x3c')]=_0xeab0('0x5c');_0x2d9f86=as[_0xeab0('0x5d')](_0x578231,_0x3fbbf9[_0xeab0('0x5e')],_0x58e342);_0x1ed1f9[_0x5cfdfa](_0x2d9f86[_0xeab0('0x5f')],_0x2d9f86[_0xeab0('0x54')][_0xeab0('0x60')],_0x2d9f86[_0xeab0('0x54')][_0xeab0('0x16')]);}break;case'Tag':var _0x51cd76=_0x58e342['value'][_0xeab0('0x25')](',')[_0xeab0('0x2e')](function(_0x4045a7){return Number(_0x4045a7);});_0x51cd76[_0xeab0('0x26')](function(_0x5c3342){_0x3b3fe6['or'](_0xeab0('0x61'),'%,'+_0x5c3342+',%');});_0x3e9d06=_[_0xeab0('0x62')](_0x3e9d06,_0x51cd76);break;case _0xeab0('0x63'):if(_0x58e342[_0xeab0('0x57')]===_0xeab0('0x58')){_0x1ed1f9[_0x5cfdfa](_0xeab0('0x64'),'%'+_0x58e342['value']+'%',null);}else{_0x3fbbf9=_[_0xeab0('0x52')](_0x25dfa6,[_0xeab0('0x21'),_0xeab0('0x65')]);_0x58e342[_0xeab0('0x3c')]='UserId';_0x2d9f86=as[_0xeab0('0x5d')](_0x578231,_0x3fbbf9[_0xeab0('0x5e')],_0x58e342);_0x1ed1f9[_0x5cfdfa](_0x2d9f86[_0xeab0('0x5f')],_0x2d9f86[_0xeab0('0x54')][_0xeab0('0x60')],_0x2d9f86[_0xeab0('0x54')][_0xeab0('0x16')]);}break;case _0xeab0('0x2a'):_0x2d9f86=as[_0xeab0('0x5d')]('me',null,_0x58e342);_0x1ed1f9[_0x5cfdfa](_0x2d9f86[_0xeab0('0x5f')],_0x2d9f86[_0xeab0('0x54')]['start'],_0x2d9f86['value']['end']);break;}}else{var _0x2d9f86=as[_0xeab0('0x5d')](_0x578231,_0x3fbbf9[_0xeab0('0x5e')],_0x58e342);_0x1ed1f9[_0x5cfdfa](_0x2d9f86[_0xeab0('0x5f')],_0x2d9f86[_0xeab0('0x54')][_0xeab0('0x60')],_0x2d9f86[_0xeab0('0x54')][_0xeab0('0x16')]);}}}else{var _0x199bd5=_(_0xba0661[_0xeab0('0x31')])[_0xeab0('0x66')]()[_0xeab0('0x2e')](function(_0x37a5c4){return _[_0xeab0('0x67')](_0x25dfa6,[_0xeab0('0x21'),_0x37a5c4])?_0x37a5c4:undefined;})[_0xeab0('0x68')]()['value']();if(!_[_0xeab0('0x69')](_0x199bd5)){_0x199bd5[_0xeab0('0x26')](function(_0x302ba9){if(_0x302ba9===_0xeab0('0x6a')){_0x24ea24['where'](_0xeab0('0x6b'),[]['concat'](_0xba0661['query'][_0x302ba9]));}else if(_0x302ba9===_0xeab0('0x6c')){var _0xcabb80=JSON[_0xeab0('0x6d')](_0xba0661['query'][_0x302ba9])[_0xeab0('0x6e')];var _0x4821b3=JSON[_0xeab0('0x6d')](_0xba0661[_0xeab0('0x31')][_0x302ba9])[_0xeab0('0x6f')];_0x24ea24[_0xeab0('0x39')](_0xeab0('0x70'),_0xcabb80,_0x4821b3);}else{if(_0xba0661[_0xeab0('0x31')][_0x302ba9]===_0xeab0('0x71')){_0x24ea24[_0xeab0('0x39')]('i.'+_0x302ba9+_0xeab0('0x72'));}else{_0x24ea24[_0xeab0('0x39')]('i.'+_0x302ba9+_0xeab0('0x73'),_0xba0661[_0xeab0('0x31')][_0x302ba9]);}}});}if(_0xba0661['query']['read']){if(_0xba0661[_0xeab0('0x31')][_0xeab0('0x74')]==0x1){_0x24ea24[_0xeab0('0x75')]('`unreadMessages`\x20=\x200');}else{_0x24ea24[_0xeab0('0x75')](_0xeab0('0x76'));}}if(_0xba0661[_0xeab0('0x31')][_0xeab0('0x77')]){_0x3e9d06=_[_0xeab0('0x78')](_0xba0661[_0xeab0('0x31')][_0xeab0('0x77')])?_0xba0661['query'][_0xeab0('0x77')]:new Array(_0xba0661['query'][_0xeab0('0x77')]);_0x3e9d06[_0xeab0('0x26')](function(_0x4bbb97){_0x3b3fe6['or'](_0xeab0('0x61'),'%,'+_0x4bbb97+',%');});}if(_0xba0661['query'][_0xeab0('0x79')]){var _0x56fb0e=_0xba0661[_0xeab0('0x31')][_0xeab0('0x79')][_0xeab0('0x7a')]('\x5c','\x5c\x5c')[_0xeab0('0x7a')](/'/g,'\x27\x27');if(qs[_0xeab0('0x7b')](_0x56fb0e)){_0x1ed1f9['or'](_0xeab0('0x7c'),_0x56fb0e+'%');}else if(qs['isEmail'](_0x56fb0e)){_0x1ed1f9['or'](_0xeab0('0x7d'),_0x56fb0e+'%');}else{_0x1ed1f9['or'](_0xeab0('0x7e'),qs[_0xeab0('0x5a')](_0x56fb0e))['or'](_0xeab0('0x7f'),qs[_0xeab0('0x5a')](_0x56fb0e));}}}_0x24ea24[_0xeab0('0x39')](_0x1ed1f9);_0x24ea24[_0xeab0('0x80')](_0xeab0('0x81'));var _0x1491d5={'type':db[_0xeab0('0x82')][_0xeab0('0x83')][_0xeab0('0x84')],'raw':!![]};var _0x5c0c79=_0x24ea24[_0xeab0('0x85')]();_0x5c0c79[_0xeab0('0x3c')](_0xeab0('0x81'));_0x5c0c79[_0xeab0('0x3c')](_0xeab0('0x86'),_0xeab0('0x53'));if(_0x51ed8f['order']){_0x51ed8f[_0xeab0('0x87')][_0xeab0('0x26')](function(_0xe36160){var _0x470064=_0xe36160[0x0]===_0xeab0('0x88')?_0xe36160[0x0]:'i.'+_0xe36160[0x0];_0x24ea24['order'](_0x470064,_0xe36160[0x1]===_0xeab0('0x89')?![]:!![]);});}if(!_[_0xeab0('0x69')](_0x3e9d06)){_0x24ea24[_0xeab0('0x75')](_0x3b3fe6);_0x5c0c79[_0xeab0('0x39')](_0xeab0('0x8a'),_0x3e9d06);}BPromise[_0xeab0('0x8b')]()[_0xeab0('0x20')](function(){if(!_0x8e31e2){if(_0xba0661[_0xeab0('0x31')][_0xeab0('0x6a')])return;_0x5c0c79[_0xeab0('0x39')](_0xeab0('0x8c'));_0x24ea24[_0xeab0('0x39')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0xba0661['user'][_0xeab0('0x8d')]!==_0xeab0('0x8e'))return;return _0xba0661[_0xeab0('0x8f')][_0xeab0('0x90')]({'attributes':['id'],'raw':!![]})['then'](function(_0x55e2d8){if(_[_0xeab0('0x69')](_0x55e2d8)){_0x5c0c79[_0xeab0('0x39')]('i.MailAccountId\x20IS\x20NULL');_0x24ea24['where'](_0xeab0('0x91'));}else{_0x5c0c79['where'](_0xeab0('0x6b'),_[_0xeab0('0x2e')](_0x55e2d8,'id'));_0x24ea24[_0xeab0('0x39')](_0xeab0('0x6b'),_[_0xeab0('0x2e')](_0x55e2d8,'id'));}});})[_0xeab0('0x20')](function(){if(_0xba0661[_0xeab0('0x8f')][_0xeab0('0x8d')]===_0xeab0('0x8e')&&!_0x8e31e2&&!_0xba0661['query'][_0xeab0('0x6a')])return[];return db[_0xeab0('0x92')][_0xeab0('0x31')](_0x5c0c79['toString'](),_0x1491d5);})[_0xeab0('0x20')](function(_0x34ff31){_0x5692f5[_0xeab0('0x1b')]=_0x34ff31[_0xeab0('0x36')];if(_0x5692f5[_0xeab0('0x1b')]===0x0)return[];return db[_0xeab0('0x92')][_0xeab0('0x31')](_0x2aaab8[_0xeab0('0x93')](),_0x1491d5)[_0xeab0('0x20')](function(_0x3166ab){_0x50bc12=_['keyBy'](_0x3166ab,'id');_0x1491d5=_[_0xeab0('0x94')](_0x1491d5,{'model':db[_0xeab0('0x95')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xba0661[_0xeab0('0x31')][_0xeab0('0x35')]){_0x51ed8f[_0xeab0('0x33')]['forEach'](function(_0x2f2f60){_0x24ea24['field']('i.'+_0x2f2f60);});}else{_0x24ea24['field'](_0xeab0('0x86'),'unreadMessages');_0x24ea24[_0xeab0('0x3c')](_0xeab0('0x96'),'Account.key');_0x24ea24[_0xeab0('0x3c')](_0xeab0('0x97'),_0xeab0('0x98'));_0x24ea24[_0xeab0('0x3c')]('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');_0x24ea24[_0xeab0('0x3c')](_0xeab0('0x81'));_0x24ea24[_0xeab0('0x3c')](_0xeab0('0x99'));_0x24ea24['field'](_0xeab0('0x9a'));_0x24ea24[_0xeab0('0x3c')](_0xeab0('0x9b'));_0x24ea24['field'](_0xeab0('0x9c'));_0x24ea24[_0xeab0('0x3c')](_0xeab0('0x9d'));_0x24ea24[_0xeab0('0x3c')]('i.lastMsgAt');_0x24ea24[_0xeab0('0x3c')](_0xeab0('0x9e'));_0x24ea24[_0xeab0('0x3c')](_0xeab0('0x9f'));_0x24ea24[_0xeab0('0x3c')](_0xeab0('0xa0'));_0x24ea24[_0xeab0('0x3c')](_0xeab0('0xa1'));_0x24ea24[_0xeab0('0x3c')](_0xeab0('0xa2'));_0x24ea24[_0xeab0('0x3c')](_0xeab0('0xa3'));_0x24ea24[_0xeab0('0x3c')](_0xeab0('0xa4'));_0x24ea24[_0xeab0('0x3c')](_0xeab0('0xa5'));_0x24ea24[_0xeab0('0x3c')]('i.MailAccountId');_0x24ea24[_0xeab0('0x3c')]('i.UserId');_0x24ea24[_0xeab0('0x3c')](_0xeab0('0xa6'),_0xeab0('0xa7'));_0x24ea24[_0xeab0('0x3c')](_0xeab0('0xa8'),'Contact.lastName');_0x24ea24[_0xeab0('0x3c')](_0xeab0('0xa9'),_0xeab0('0xaa'));_0x24ea24[_0xeab0('0x3c')](_0xeab0('0xab'),_0xeab0('0xac'));_0x24ea24['field']('c.mobile',_0xeab0('0xad'));_0x24ea24['field']('c.fax',_0xeab0('0xae'));_0x24ea24['field'](_0xeab0('0xaf'),_0xeab0('0xb0'));_0x24ea24['field'](_0xeab0('0xb1'),_0xeab0('0xb2'));_0x24ea24['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xeab0('0x24'));}if(_0x51ed8f[_0xeab0('0x1a')])_0x24ea24['limit'](_0x51ed8f[_0xeab0('0x1a')]);if(_0x51ed8f[_0xeab0('0x1c')])_0x24ea24[_0xeab0('0x1c')](_0x51ed8f[_0xeab0('0x1c')]);return db[_0xeab0('0x92')][_0xeab0('0x31')](_0x24ea24[_0xeab0('0x93')](),_0x1491d5);})[_0xeab0('0x20')](function(_0x3572cf){if(_0x3572cf['length']>0x0)_0x33a315[_0xeab0('0x39')](_0xeab0('0xb3'),_['map'](_0x3572cf,'id'));return db['sequelize'][_0xeab0('0x31')](_0x33a315[_0xeab0('0x93')](),_0x1491d5)[_0xeab0('0x20')](function(_0x5c5414){var _0x22e2da=_['groupBy'](_0x5c5414,_0xeab0('0xb4'));var _0x121ab0=[];return db[_0xeab0('0xb5')]['findOne']({'attributes':[_0xeab0('0xb6')],'raw':!![]})[_0xeab0('0x20')](function(_0x356473){var _0x469417=_0x356473['enableEmailPreview'];_0x3572cf[_0xeab0('0x26')](function(_0x4d67e9){_0x121ab0['push'](updateMailInteraction(_0x4d67e9,_0x50bc12,_0x22e2da,_0x469417));});return BPromise[_0xeab0('0xb7')](_0x121ab0);});});});})['then'](function(_0x966c9f){_0x5692f5[_0xeab0('0xb8')]=_0x966c9f;return _0x5692f5;})['then'](respondWithFilteredResult(_0xb81afa,_0x51ed8f))['catch'](handleError(_0xb81afa,null));};exports[_0xeab0('0xb9')]=function(_0x432370,_0x48ee88){var _0x353af8={'raw':![],'where':{'id':_0x432370['params']['id']}},_0x34cddb={};_0x34cddb['model']=_['keys'](db['MailInteraction'][_0xeab0('0xba')]);_0x34cddb[_0xeab0('0x31')]=_[_0xeab0('0x66')](_0x432370[_0xeab0('0x31')]);_0x34cddb[_0xeab0('0x32')]=_[_0xeab0('0x34')](_0x34cddb[_0xeab0('0x30')],_0x34cddb[_0xeab0('0x31')]);_0x353af8[_0xeab0('0x33')]=_[_0xeab0('0x34')](_0x34cddb['model'],qs['fields'](_0x432370[_0xeab0('0x31')]['fields']));_0x353af8['attributes']=_0x353af8['attributes'][_0xeab0('0x36')]?_0x353af8['attributes']:_0x34cddb['model'];if(_0x432370['query'][_0xeab0('0xbb')]){_0x353af8[_0xeab0('0xbc')]=[{'all':!![]}];}_0x353af8=_[_0xeab0('0x94')]({},_0x353af8,_0x432370[_0xeab0('0xbd')]);return db[_0xeab0('0x95')]['find'](_0x353af8)[_0xeab0('0x20')](handleEntityNotFound(_0x48ee88,null))[_0xeab0('0x20')](respondWithResult(_0x48ee88,null))[_0xeab0('0x2d')](handleError(_0x48ee88,null));};exports['create']=function(_0x4872fe,_0xa688df){return db['MailInteraction'][_0xeab0('0xbe')](_0x4872fe[_0xeab0('0xbf')],{})[_0xeab0('0x20')](respondWithResult(_0xa688df,0xc9))[_0xeab0('0x2d')](handleError(_0xa688df,null));};exports['update']=function(_0x1bf338,_0x19c5bb){if(_0x1bf338[_0xeab0('0xbf')]['id']){delete _0x1bf338[_0xeab0('0xbf')]['id'];}return db['MailInteraction']['find']({'where':{'id':_0x1bf338[_0xeab0('0xc0')]['id']}})[_0xeab0('0x20')](handleEntityNotFound(_0x19c5bb,null))['then'](saveUpdates(_0x1bf338['body'],null))['then'](respondWithResult(_0x19c5bb,null))['catch'](handleError(_0x19c5bb,null));};exports['destroy']=function(_0xb70231,_0x5e56c1){return db[_0xeab0('0x95')][_0xeab0('0x52')]({'where':{'id':_0xb70231[_0xeab0('0xc0')]['id']}})[_0xeab0('0x20')](handleEntityNotFound(_0x5e56c1,null))[_0xeab0('0x20')](removeEntity(_0x5e56c1,null))[_0xeab0('0x2d')](handleError(_0x5e56c1,null));};exports[_0xeab0('0xc1')]=function(_0x458d41,_0x1b7bb9){return db[_0xeab0('0x95')][_0xeab0('0xc1')]()[_0xeab0('0x20')](respondWithResult(_0x1b7bb9,null))[_0xeab0('0x2d')](handleError(_0x1b7bb9,null));};exports[_0xeab0('0xc2')]=function(_0x3cc906,_0x1801e8){return db[_0xeab0('0x28')]['find']({'where':{'id':_0x3cc906[_0xeab0('0xc0')]['id']}})[_0xeab0('0x20')](handleEntityNotFound(_0x1801e8,null))['then'](function(_0x46bde6){if(_0x46bde6){return _0x46bde6[_0xeab0('0xc2')](_0x3cc906[_0xeab0('0xbf')][_0xeab0('0xc3')],_[_0xeab0('0xc4')](_0x3cc906[_0xeab0('0xbf')],[_0xeab0('0xc3'),'id'])||{});}})[_0xeab0('0x20')](respondWithResult(_0x1801e8,null))[_0xeab0('0x2d')](handleError(_0x1801e8,null));};exports[_0xeab0('0xc5')]=function(_0x31e6ed,_0x45b0de){var _0x459b4c={'raw':![],'where':{}};var _0x58ad7a={};var _0x3e9ec6={'count':0x0,'rows':[]};return db[_0xeab0('0x95')]['findOne']({'where':{'id':_0x31e6ed[_0xeab0('0xc0')]['id']}})[_0xeab0('0x20')](handleEntityNotFound(_0x45b0de,null))[_0xeab0('0x20')](function(_0x4e61e1){if(_0x4e61e1){_0x58ad7a[_0xeab0('0x30')]=_['keys'](db[_0xeab0('0x28')]['rawAttributes']);_0x58ad7a['query']=_[_0xeab0('0x66')](_0x31e6ed['query']);_0x58ad7a['filters']=_[_0xeab0('0x34')](_0x58ad7a[_0xeab0('0x30')],_0x58ad7a['query']);_0x459b4c[_0xeab0('0x33')]=_['intersection'](_0x58ad7a[_0xeab0('0x30')],qs[_0xeab0('0x35')](_0x31e6ed[_0xeab0('0x31')][_0xeab0('0x35')]));_0x459b4c[_0xeab0('0x33')]=_0x459b4c[_0xeab0('0x33')][_0xeab0('0x36')]?_0x459b4c[_0xeab0('0x33')]:_0x58ad7a[_0xeab0('0x30')];if(!_0x31e6ed[_0xeab0('0x31')]['hasOwnProperty'](_0xeab0('0xc6'))){_0x459b4c[_0xeab0('0x1a')]=qs[_0xeab0('0x1a')](_0x31e6ed[_0xeab0('0x31')][_0xeab0('0x1a')]);_0x459b4c[_0xeab0('0x1c')]=qs[_0xeab0('0x1c')](_0x31e6ed[_0xeab0('0x31')][_0xeab0('0x1c')]);}_0x459b4c[_0xeab0('0x87')]=qs[_0xeab0('0x38')](_0x31e6ed['query']['sort']);_0x459b4c[_0xeab0('0x39')]=qs['filters'](_[_0xeab0('0x3a')](_0x31e6ed[_0xeab0('0x31')],_0x58ad7a[_0xeab0('0x32')]));_0x459b4c[_0xeab0('0x39')][_0xeab0('0xb4')]=_0x4e61e1['id'];if(_0x31e6ed[_0xeab0('0x31')][_0xeab0('0x79')]){_0x459b4c[_0xeab0('0x39')]=_[_0xeab0('0x94')](_0x459b4c[_0xeab0('0x39')],{'$or':_[_0xeab0('0x2e')](_0x459b4c['attributes'],function(_0x54ce6f){var _0x124ee9={};_0x124ee9[_0x54ce6f]={'$like':'%'+_0x31e6ed[_0xeab0('0x31')][_0xeab0('0x79')]+'%'};return _0x124ee9;})});}if(_0x31e6ed[_0xeab0('0x31')]['$gte']){var _0x16f279=_0x31e6ed[_0xeab0('0x31')]['$gte'][_0xeab0('0x25')](',');var _0x197a28={};_0x197a28[_0x16f279[0x0]]={'$gte':moment(_0x16f279[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x459b4c[_0xeab0('0x39')]=_[_0xeab0('0x94')](_0x459b4c['where'],_0x197a28);}_0x459b4c=_[_0xeab0('0x94')]({},_0x459b4c,_0x31e6ed[_0xeab0('0xbd')]);return db[_0xeab0('0x28')][_0xeab0('0x1b')]({'where':_0x459b4c[_0xeab0('0x39')]})[_0xeab0('0x20')](function(_0x56c5af){_0x3e9ec6[_0xeab0('0x1b')]=_0x56c5af;if(_0x31e6ed[_0xeab0('0x31')][_0xeab0('0xbb')]){_0x459b4c[_0xeab0('0xbc')]=[{'all':!![]}];}return db[_0xeab0('0x28')][_0xeab0('0xc7')](_0x459b4c);})[_0xeab0('0x20')](function(_0x109ba4){if(_0x31e6ed['query'][_0xeab0('0xc8')]===_0xeab0('0xc9')){for(var _0x371779=0x0;_0x371779<_0x109ba4['length'];_0x371779++){_0x109ba4[_0x371779][_0xeab0('0xbf')]=juice(_0x109ba4[_0x371779][_0xeab0('0xbf')]);}}_0x3e9ec6[_0xeab0('0xb8')]=_0x109ba4;return _0x3e9ec6;});}})['then'](respondWithFilteredResult(_0x45b0de,_0x459b4c))['catch'](handleError(_0x45b0de,null));};exports[_0xeab0('0xca')]=function(_0x3264a0,_0x2e80de){return db[_0xeab0('0x95')][_0xeab0('0x52')]({'where':{'id':_0x3264a0[_0xeab0('0xc0')]['id']}})[_0xeab0('0x20')](handleEntityNotFound(_0x2e80de,null))['then'](function(_0x602ad8){if(_0x602ad8){return _0x602ad8['setTags'](_0x3264a0['body'][_0xeab0('0xc3')],_[_0xeab0('0xc4')](_0x3264a0[_0xeab0('0xbf')],[_0xeab0('0xc3'),'id'])||{})[_0xeab0('0xcb')](function(){return db[_0xeab0('0xcc')][_0xeab0('0xc7')]({'attributes':['id',_0xeab0('0x21'),_0xeab0('0x3d')],'where':{'id':_0x3264a0['body']['ids']}});})[_0xeab0('0x20')](function(_0x1a0c6b){socket[_0xeab0('0xcd')]('mailInteractionTags:save',{'id':Number(_0x3264a0[_0xeab0('0xc0')]['id']),'tags':_0x1a0c6b||[]});return{'id':Number(_0x3264a0['params']['id']),'tags':_0x1a0c6b||[]};});}})[_0xeab0('0x20')](respondWithResult(_0x2e80de,null))[_0xeab0('0x2d')](handleError(_0x2e80de,null));};exports['removeTags']=function(_0xb938c7,_0x3102f3){return db[_0xeab0('0x95')][_0xeab0('0x52')]({'where':{'id':_0xb938c7['params']['id']}})[_0xeab0('0x20')](handleEntityNotFound(_0x3102f3,null))[_0xeab0('0x20')](function(_0x3d3e96){if(_0x3d3e96){return _0x3d3e96[_0xeab0('0xce')](_0xb938c7[_0xeab0('0x31')]['ids']);}})[_0xeab0('0x20')](respondWithStatusCode(_0x3102f3,null))[_0xeab0('0x2d')](handleError(_0x3102f3,null));};exports['download']=function(_0x58b9c3,_0x446d3a){var _0x287705=moment()[_0xeab0('0xcf')]()[_0xeab0('0x93')]();var _0x3146ce=path[_0xeab0('0xd0')](config[_0xeab0('0xd1')],_0xeab0('0xd2'),_0xeab0('0xd3'),_0xeab0('0xd4'));var _0x140415=path[_0xeab0('0xd0')](config['root'],_0xeab0('0xd2'),_0xeab0('0xd3'),_0xeab0('0xd5'));var _0x47d32f=path[_0xeab0('0xd0')](_0x3146ce,_0x287705);var _0x5c46d3=util[_0xeab0('0xd6')](_0xeab0('0xd7'),_0x58b9c3[_0xeab0('0xc0')]['id'],_0x287705);var _0x200e0a=path[_0xeab0('0xd0')](_0x3146ce,_0x5c46d3);var _0x46e5e8=[];if(_0x58b9c3['query'][_0xeab0('0xd5')]){_0x46e5e8[_0xeab0('0x27')]({'model':db[_0xeab0('0xd8')],'as':_0xeab0('0xd9'),'raw':!![]});}var _0x5f2e65=[{'model':db[_0xeab0('0x28')],'as':_0xeab0('0xda'),'attributes':['id','body','from','to','cc','bcc',_0xeab0('0xdb'),_0xeab0('0x6c')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x46e5e8}];return db[_0xeab0('0x95')][_0xeab0('0x52')]({'where':{'id':_0x58b9c3[_0xeab0('0xc0')]['id']},'include':_0x5f2e65})[_0xeab0('0x20')](handleEntityNotFound(_0x446d3a,null))[_0xeab0('0x20')](function(_0x3215c1){if(_0x3215c1&&_0x3215c1['Messages']){var _0x2ebbf8=_0x3215c1[_0xeab0('0xdc')]({'plain':!![]});fs[_0xeab0('0xdd')](_0x47d32f);return BPromise[_0xeab0('0xde')](_0x2ebbf8['Messages'],function(_0x9bd7ca,_0x9306e3){var _0x2f2bdd={'from':_0x9bd7ca[_0xeab0('0x3e')],'to':_0x9bd7ca['to'],'subject':_0x9bd7ca[_0xeab0('0xdb')],'html':htmlEntities[_0xeab0('0xdf')](_0x9bd7ca[_0xeab0('0xbf')]),'headers':{'Date':moment(_0x9bd7ca[_0xeab0('0x6c')])['format'](_0xeab0('0xe0'))},'attachments':[]};if(_0x9bd7ca['cc']){_0x2f2bdd[_0xeab0('0xe1')]['Cc']=_0x9bd7ca['cc'];}if(_0x9bd7ca[_0xeab0('0xe2')]){_0x2f2bdd[_0xeab0('0xe1')][_0xeab0('0xe3')]=_0x9bd7ca[_0xeab0('0xe2')];}return new BPromise(function(_0x28aa67,_0x3eb9fa){if(_0x9bd7ca[_0xeab0('0xd9')]){for(var _0x577155=0x0;_0x577155<_0x9bd7ca['Attachments']['length'];_0x577155++){var _0x1b257a=_0x9bd7ca[_0xeab0('0xd9')][_0x577155];var _0x1e3d41=path['join'](_0x140415,_0x1b257a[_0xeab0('0xe4')]);if(fs[_0xeab0('0xe5')](_0x1e3d41)){_0x2f2bdd[_0xeab0('0xd5')][_0xeab0('0x27')]({'name':_0x1b257a[_0xeab0('0x21')],'contentType':_0x1b257a[_0xeab0('0x5e')],'data':fs[_0xeab0('0xe6')](_0x1e3d41)});}}}emlformat[_0xeab0('0xe7')](_0x2f2bdd,function(_0x445795,_0x254b4e){if(_0x445795)return _0x3eb9fa(_0x445795);fs[_0xeab0('0xe8')](path[_0xeab0('0xd0')](_0x47d32f,util['format']('message%d.eml',_0x9306e3)),_0x254b4e);return _0x28aa67(_0x254b4e);});});})['then'](function(){return new BPromise(function(_0xa2a448,_0x202f9b){zipdir(_0x47d32f,{'saveTo':_0x200e0a},function(_0x2fa56d,_0x156e59){if(_0x2fa56d)return _0x202f9b(_0x2fa56d);return _0xa2a448(_0x156e59);});})[_0xeab0('0x20')](function(){return new BPromise(function(_0x262a05,_0x398713){rimraf(_0x47d32f,function(_0x2e0652){if(_0x2e0652)_0x398713(_0x2e0652);return _0x262a05();});});})[_0xeab0('0x20')](function(){return _0x446d3a['download'](_0x200e0a,_0x5c46d3,function(_0x1fdb3a){if(!_0x1fdb3a)fs[_0xeab0('0xe9')](_0x200e0a);});});});}else{return _0x446d3a['sendStatus'](0xc8);}})[_0xeab0('0x2d')](handleError(_0x446d3a,null));}; \ No newline at end of file +var _0x2a99=['join','server','files','tmp','root','attachments','transcript-%d-%s.zip','Attachment','bcc','subject','Messages','get','mkdirSync','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','existsSync','readFileSync','writeFileSync','message%d.eml','eml-format','rimraf','zip-dir','bluebird','util','path','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','sendStatus','end','json','offset','limit','count','status','set','Content-Range','update','then','destroy','error','name','send','Users','fullname','Tags','TagIds','split','forEach','push','findOne','out','plainBody','lastMsgText','trimStart','catch','index','map','MailInteraction','fieldName','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','select','field','color','from','tools_tags','u.id','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','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','compact','isEmpty','where','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','role','agent','user','i.MailAccountId\x20IN\x20?','toString','sequelize','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.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.UserId','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','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','all','rows','show','keys','rawAttributes','includeAll','options','create','body','params','describe','addMessage','MailMessage','ids','omit','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','emit','mailInteractionTags:save','removeTags','download','unix'];(function(_0x513e3e,_0x5d8cf1){var _0x30cae2=function(_0x62b5ac){while(--_0x62b5ac){_0x513e3e['push'](_0x513e3e['shift']());}};_0x30cae2(++_0x5d8cf1);}(_0x2a99,0xfd));var _0x92a9=function(_0x430a79,_0x17b2af){_0x430a79=_0x430a79-0x0;var _0xda6181=_0x2a99[_0x430a79];return _0xda6181;};'use strict';var emlformat=require(_0x92a9('0x0'));var rimraf=require(_0x92a9('0x1'));var zipdir=require(_0x92a9('0x2'));var moment=require('moment');var BPromise=require(_0x92a9('0x3'));var util=require(_0x92a9('0x4'));var path=require(_0x92a9('0x5'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var juice=require('juice');var Redis=require('ioredis');var qs=require(_0x92a9('0x6'));var as=require(_0x92a9('0x7'));var logger=require('../../config/logger')('api');var config=require(_0x92a9('0x8'));var db=require(_0x92a9('0x9'))['db'];var htmlEntities=require('html-entities');config[_0x92a9('0xa')]=_[_0x92a9('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x92a9('0xc'))(new Redis(config['redis']));require(_0x92a9('0xd'))[_0x92a9('0xe')](socket);function respondWithStatusCode(_0x4ccab1,_0x2c3e41){_0x2c3e41=_0x2c3e41||0xcc;return function(_0x2ef006){if(_0x2ef006){return _0x4ccab1[_0x92a9('0xf')](_0x2c3e41);}return _0x4ccab1['status'](_0x2c3e41)[_0x92a9('0x10')]();};}function respondWithResult(_0x5253db,_0x26a58c){_0x26a58c=_0x26a58c||0xc8;return function(_0x4e8316){if(_0x4e8316){return _0x5253db['status'](_0x26a58c)[_0x92a9('0x11')](_0x4e8316);}};}function respondWithFilteredResult(_0x8e13bc,_0x49a37b){return function(_0x3de9c3){if(_0x3de9c3){var _0x555700=typeof _0x49a37b[_0x92a9('0x12')]==='undefined'&&typeof _0x49a37b[_0x92a9('0x13')]==='undefined';var _0x100565=_0x3de9c3['count'];var _0x57d8ca=_0x555700?0x0:_0x49a37b[_0x92a9('0x12')];var _0x1a40c3=_0x555700?_0x3de9c3[_0x92a9('0x14')]:_0x49a37b[_0x92a9('0x12')]+_0x49a37b['limit'];var _0x1451ca;if(_0x1a40c3>=_0x100565){_0x1a40c3=_0x100565;_0x1451ca=0xc8;}else{_0x1451ca=0xce;}_0x8e13bc[_0x92a9('0x15')](_0x1451ca);return _0x8e13bc[_0x92a9('0x16')](_0x92a9('0x17'),_0x57d8ca+'-'+_0x1a40c3+'/'+_0x100565)[_0x92a9('0x11')](_0x3de9c3);}return null;};}function saveUpdates(_0x3536f7){return function(_0xced12a){if(_0xced12a){return _0xced12a[_0x92a9('0x18')](_0x3536f7)[_0x92a9('0x19')](function(_0x1c133d){return _0x1c133d;});}return null;};}function removeEntity(_0x548bea){return function(_0x11783d){if(_0x11783d){return _0x11783d[_0x92a9('0x1a')]()[_0x92a9('0x19')](function(){_0x548bea['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xe0f48c){return function(_0x2137f4){if(!_0x2137f4){_0xe0f48c[_0x92a9('0xf')](0x194);}return _0x2137f4;};}function handleError(_0x26aea8,_0x16b4be){_0x16b4be=_0x16b4be||0x1f4;return function(_0x293e2e){logger[_0x92a9('0x1b')](_0x293e2e['stack']);if(_0x293e2e[_0x92a9('0x1c')]){delete _0x293e2e['name'];}_0x26aea8[_0x92a9('0x15')](_0x16b4be)[_0x92a9('0x1d')](_0x293e2e);};}function getInteractionUsers(_0x420a41,_0x2c4b0e){return new BPromise(function(_0x3de3d2,_0x55bf38){try{if(_0x2c4b0e[_0x420a41['id']]){_0x420a41[_0x92a9('0x1e')]=_['map'](_0x2c4b0e[_0x420a41['id']],function(_0x4ffa70){return{'id':_0x4ffa70['id'],'fullname':_0x4ffa70[_0x92a9('0x1f')]};});}}catch(_0x4111a1){_0x55bf38(_0x4111a1);}_0x3de3d2(_0x420a41);});}function getInteractionTags(_0x25946e,_0x288c02){return new BPromise(function(_0x10153d,_0x11d907){try{if(_0x25946e['TagIds']){_0x25946e[_0x92a9('0x20')]=[];_0x25946e[_0x92a9('0x21')][_0x92a9('0x22')](',')[_0x92a9('0x23')](function(_0x140b5c){_0x25946e[_0x92a9('0x20')][_0x92a9('0x24')](_0x288c02[_0x140b5c]);});}delete _0x25946e[_0x92a9('0x21')];}catch(_0x5bf9d8){_0x11d907(_0x5bf9d8);}_0x10153d(_0x25946e);});}function getLastMessageText(_0x26a981){return new BPromise(function(_0x4ce8bb,_0x4cb3f3){return db['MailMessage'][_0x92a9('0x25')]({'where':{'$and':[{'MailInteractionId':_0x26a981['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x92a9('0x26')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x92a9('0x27')],'order':'-id','raw':!![]})[_0x92a9('0x19')](function(_0x1936ba){if(_0x1936ba&&_0x1936ba[_0x92a9('0x27')]){_0x26a981[_0x92a9('0x28')]=_[_0x92a9('0x29')](_0x1936ba[_0x92a9('0x27')]);}_0x4ce8bb(_0x26a981);})[_0x92a9('0x2a')](function(_0x4de3f9){_0x4cb3f3(_0x4de3f9);});});}function updateMailInteraction(_0xccbe13,_0x5977bb,_0x59417e,_0x3e37e2){return new BPromise(function(_0x4ff60d,_0x229b62){return getInteractionUsers(_0xccbe13,_0x59417e)[_0x92a9('0x19')](function(_0x5b95d3){return getInteractionTags(_0x5b95d3,_0x5977bb);})[_0x92a9('0x19')](function(_0xa4ecd9){if(_0x3e37e2){_0x4ff60d(getLastMessageText(_0xa4ecd9));}else{_0x4ff60d(_0xa4ecd9);}})[_0x92a9('0x2a')](function(_0x118321){_0x229b62(_0x118321);});});}exports[_0x92a9('0x2b')]=function(_0x5c14b9,_0x23532a){var _0x440b18={},_0x3b0e50={},_0x3ec90f={'count':0x0,'rows':[]};var _0x25a362=_[_0x92a9('0x2c')](db[_0x92a9('0x2d')]['rawAttributes'],function(_0xc81dde){return{'name':_0xc81dde[_0x92a9('0x2e')],'type':_0xc81dde[_0x92a9('0x2f')]['key']};});_0x3b0e50[_0x92a9('0x30')]=_[_0x92a9('0x2c')](_0x25a362,_0x92a9('0x1c'));_0x3b0e50[_0x92a9('0x31')]=_['keys'](_0x5c14b9[_0x92a9('0x31')]);_0x3b0e50[_0x92a9('0x32')]=_[_0x92a9('0x33')](_0x3b0e50[_0x92a9('0x30')],_0x3b0e50[_0x92a9('0x31')]);_0x440b18['attributes']=_[_0x92a9('0x33')](_0x3b0e50[_0x92a9('0x30')],qs[_0x92a9('0x34')](_0x5c14b9[_0x92a9('0x31')][_0x92a9('0x34')]));_0x440b18['attributes']=_0x440b18[_0x92a9('0x35')]['length']?_0x440b18[_0x92a9('0x35')]:_0x3b0e50[_0x92a9('0x30')];if(!_0x5c14b9[_0x92a9('0x31')][_0x92a9('0x36')](_0x92a9('0x37'))){_0x440b18[_0x92a9('0x13')]=qs[_0x92a9('0x13')](_0x5c14b9[_0x92a9('0x31')][_0x92a9('0x13')]);_0x440b18[_0x92a9('0x12')]=qs[_0x92a9('0x12')](_0x5c14b9[_0x92a9('0x31')]['offset']);}_0x440b18[_0x92a9('0x38')]=qs[_0x92a9('0x39')](_0x5c14b9[_0x92a9('0x31')]['sort']);_0x440b18['where']=qs['filters'](_['pick'](_0x5c14b9[_0x92a9('0x31')],_0x3b0e50['filters']),_0x25a362);var _0x1543ec=[];var _0x84fed0=squel[_0x92a9('0x3a')]()[_0x92a9('0x3b')]('id')[_0x92a9('0x3b')](_0x92a9('0x1c'))['field'](_0x92a9('0x3c'))[_0x92a9('0x3d')](_0x92a9('0x3e'));var _0x3b7c5b=squel['select']()[_0x92a9('0x3b')](_0x92a9('0x3f'))['field']('u.fullname')['field'](_0x92a9('0x40'))[_0x92a9('0x3d')](_0x92a9('0x41'),'ui')[_0x92a9('0x42')](_0x92a9('0x43'),'u',_0x92a9('0x44'));var _0x52543f=squel['select']()[_0x92a9('0x3d')]('mail_interactions','i')[_0x92a9('0x42')](_0x92a9('0x45'),'c',_0x92a9('0x46'))[_0x92a9('0x42')](_0x92a9('0x43'),'o',_0x92a9('0x47'))[_0x92a9('0x42')](_0x92a9('0x48'),'a',_0x92a9('0x49'))['left_join'](_0x92a9('0x4a'),'me',_0x92a9('0x4b'))[_0x92a9('0x42')](_0x92a9('0x4c'),'it',_0x92a9('0x4d'))[_0x92a9('0x42')](_0x92a9('0x3e'),'t',_0x92a9('0x4e'));var _0x2658ce=squel[_0x92a9('0x4f')]();var _0x42c668=[];var _0xd6279b=squel[_0x92a9('0x4f')]();var _0x594923;if(_0x5c14b9[_0x92a9('0x31')][_0x92a9('0x50')]){_0x594923=as['parseSearch'](_0x5c14b9[_0x92a9('0x31')]['search']);var _0x4d1435=_0x594923[_0x92a9('0x51')];for(var _0x13bc72=0x0;_0x13bc72<_0x594923[_0x92a9('0x52')][_0x92a9('0x53')];_0x13bc72++){var _0x3e4a18=_0x594923[_0x92a9('0x52')][_0x13bc72];var _0x4b3b30='i';var _0x78cfda=_[_0x92a9('0x54')](_0x25a362,[_0x92a9('0x1c'),_0x3e4a18[_0x92a9('0x3b')]]);if(!_0x78cfda){switch(_0x3e4a18[_0x92a9('0x3b')]){case _0x92a9('0x55'):if(_0x3e4a18[_0x92a9('0x56')]==0x1){_0x52543f[_0x92a9('0x57')]('`'+_0x3e4a18[_0x92a9('0x3b')]+_0x92a9('0x58'));}else{_0x52543f[_0x92a9('0x57')]('`'+_0x3e4a18[_0x92a9('0x3b')]+_0x92a9('0x59'));}break;case _0x92a9('0x5a'):if(_0x3e4a18[_0x92a9('0x5b')]===_0x92a9('0x5c')){if(_0x3e4a18[_0x92a9('0x56')][_0x92a9('0x22')]('\x20')[_0x92a9('0x53')]>0x1){_0x2658ce[_0x4d1435](_0x92a9('0x5d'),qs[_0x92a9('0x5e')](_0x3e4a18['value']),null);}else{var _0x2e1ee6='%'+_0x3e4a18[_0x92a9('0x56')]+'%';_0x2658ce[_0x4d1435](_0x92a9('0x5f'),_0x2e1ee6,_0x2e1ee6,_0x2e1ee6);}}else{_0x78cfda=_[_0x92a9('0x54')](_0x25a362,[_0x92a9('0x1c'),_0x92a9('0x60')]);_0x3e4a18[_0x92a9('0x3b')]=_0x92a9('0x60');_0x569ae3=as[_0x92a9('0x61')](_0x4b3b30,_0x78cfda[_0x92a9('0x2f')],_0x3e4a18);_0x2658ce[_0x4d1435](_0x569ae3[_0x92a9('0x62')],_0x569ae3[_0x92a9('0x56')][_0x92a9('0x63')],_0x569ae3[_0x92a9('0x56')][_0x92a9('0x10')]);}break;case _0x92a9('0x64'):var _0x150e19=_0x3e4a18[_0x92a9('0x56')]['split'](',')[_0x92a9('0x2c')](function(_0x44fca1){return Number(_0x44fca1);});_0x150e19[_0x92a9('0x23')](function(_0x50424a){_0xd6279b['or'](_0x92a9('0x65'),'%,'+_0x50424a+',%');});_0x42c668=_[_0x92a9('0x66')](_0x42c668,_0x150e19);break;case'User':if(_0x3e4a18[_0x92a9('0x5b')]===_0x92a9('0x5c')){_0x2658ce[_0x4d1435](_0x92a9('0x67'),'%'+_0x3e4a18[_0x92a9('0x56')]+'%',null);}else{_0x78cfda=_[_0x92a9('0x54')](_0x25a362,[_0x92a9('0x1c'),_0x92a9('0x68')]);_0x3e4a18[_0x92a9('0x3b')]='UserId';_0x569ae3=as[_0x92a9('0x61')](_0x4b3b30,_0x78cfda['type'],_0x3e4a18);_0x2658ce[_0x4d1435](_0x569ae3[_0x92a9('0x62')],_0x569ae3[_0x92a9('0x56')][_0x92a9('0x63')],_0x569ae3[_0x92a9('0x56')]['end']);}break;case'plainBody':_0x569ae3=as[_0x92a9('0x61')]('me',null,_0x3e4a18);_0x2658ce[_0x4d1435](_0x569ae3[_0x92a9('0x62')],_0x569ae3[_0x92a9('0x56')][_0x92a9('0x63')],_0x569ae3['value'][_0x92a9('0x10')]);break;}}else{var _0x569ae3=as['buildExpression'](_0x4b3b30,_0x78cfda[_0x92a9('0x2f')],_0x3e4a18);_0x2658ce[_0x4d1435](_0x569ae3[_0x92a9('0x62')],_0x569ae3[_0x92a9('0x56')][_0x92a9('0x63')],_0x569ae3[_0x92a9('0x56')]['end']);}}}else{var _0x13a2b7=_(_0x5c14b9['query'])['keys']()[_0x92a9('0x2c')](function(_0x5086ea){return _['some'](_0x25a362,['name',_0x5086ea])?_0x5086ea:undefined;})[_0x92a9('0x69')]()[_0x92a9('0x56')]();if(!_[_0x92a9('0x6a')](_0x13a2b7)){_0x13a2b7[_0x92a9('0x23')](function(_0x37109f){if(_0x37109f==='MailAccountId'){_0x52543f[_0x92a9('0x6b')]('i.MailAccountId\x20IN\x20?',[][_0x92a9('0x6c')](_0x5c14b9[_0x92a9('0x31')][_0x37109f]));}else if(_0x37109f===_0x92a9('0x6d')){var _0x6ce430=JSON[_0x92a9('0x6e')](_0x5c14b9[_0x92a9('0x31')][_0x37109f])[_0x92a9('0x6f')];var _0x2c4389=JSON[_0x92a9('0x6e')](_0x5c14b9[_0x92a9('0x31')][_0x37109f])[_0x92a9('0x70')];_0x52543f[_0x92a9('0x6b')](_0x92a9('0x71'),_0x6ce430,_0x2c4389);}else{if(_0x5c14b9[_0x92a9('0x31')][_0x37109f]===_0x92a9('0x72')){_0x52543f[_0x92a9('0x6b')]('i.'+_0x37109f+_0x92a9('0x73'));}else{_0x52543f[_0x92a9('0x6b')]('i.'+_0x37109f+'\x20=\x20?',_0x5c14b9[_0x92a9('0x31')][_0x37109f]);}}});}if(_0x5c14b9[_0x92a9('0x31')][_0x92a9('0x74')]){if(_0x5c14b9['query']['read']==0x1){_0x52543f[_0x92a9('0x57')]('`unreadMessages`\x20=\x200');}else{_0x52543f[_0x92a9('0x57')](_0x92a9('0x75'));}}if(_0x5c14b9[_0x92a9('0x31')][_0x92a9('0x76')]){_0x42c668=_[_0x92a9('0x77')](_0x5c14b9[_0x92a9('0x31')]['tag'])?_0x5c14b9[_0x92a9('0x31')][_0x92a9('0x76')]:new Array(_0x5c14b9[_0x92a9('0x31')][_0x92a9('0x76')]);_0x42c668[_0x92a9('0x23')](function(_0x4e4d33){_0xd6279b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4e4d33+',%');});}if(_0x5c14b9['query'][_0x92a9('0x78')]){var _0x33e029=_0x5c14b9['query'][_0x92a9('0x78')][_0x92a9('0x79')]('\x5c','\x5c\x5c')[_0x92a9('0x79')](/'/g,'\x27\x27');if(qs[_0x92a9('0x7a')](_0x33e029)){_0x2658ce['or'](_0x92a9('0x7b'),_0x33e029+'%');}else if(qs[_0x92a9('0x7c')](_0x33e029)){_0x2658ce['or'](_0x92a9('0x7d'),_0x33e029+'%');}else{_0x2658ce['or'](_0x92a9('0x7e'),qs[_0x92a9('0x5e')](_0x33e029))['or'](_0x92a9('0x7f'),qs['getFullTextValue'](_0x33e029));}}}_0x52543f[_0x92a9('0x6b')](_0x2658ce);_0x52543f[_0x92a9('0x80')](_0x92a9('0x81'));var _0x466d2d={'type':db['Sequelize'][_0x92a9('0x82')][_0x92a9('0x83')],'raw':!![]};var _0x436a0c=_0x52543f[_0x92a9('0x84')]();_0x436a0c['field'](_0x92a9('0x81'));_0x436a0c['field'](_0x92a9('0x85'),_0x92a9('0x55'));if(_0x440b18[_0x92a9('0x38')]){_0x440b18[_0x92a9('0x38')]['forEach'](function(_0x37c054){var _0x5a7a31=_0x37c054[0x0]===_0x92a9('0x86')?_0x37c054[0x0]:'i.'+_0x37c054[0x0];_0x52543f[_0x92a9('0x38')](_0x5a7a31,_0x37c054[0x1]===_0x92a9('0x87')?![]:!![]);});}if(!_[_0x92a9('0x6a')](_0x42c668)){_0x52543f[_0x92a9('0x57')](_0xd6279b);_0x436a0c[_0x92a9('0x6b')]('t.id\x20IN\x20?',_0x42c668);}BPromise['resolve']()[_0x92a9('0x19')](function(){if(!_0x594923){if(_0x5c14b9[_0x92a9('0x31')][_0x92a9('0x88')])return;_0x436a0c[_0x92a9('0x6b')](_0x92a9('0x89'));_0x52543f['where'](_0x92a9('0x89'));return;}if(_0x5c14b9['user'][_0x92a9('0x8a')]!==_0x92a9('0x8b'))return;return _0x5c14b9[_0x92a9('0x8c')]['getMailAccounts']({'attributes':['id'],'raw':!![]})[_0x92a9('0x19')](function(_0x18c2f8){if(_[_0x92a9('0x6a')](_0x18c2f8)){_0x436a0c[_0x92a9('0x6b')]('i.MailAccountId\x20IS\x20NULL');_0x52543f[_0x92a9('0x6b')]('i.MailAccountId\x20IS\x20NULL');}else{_0x436a0c['where'](_0x92a9('0x8d'),_[_0x92a9('0x2c')](_0x18c2f8,'id'));_0x52543f['where']('i.MailAccountId\x20IN\x20?',_[_0x92a9('0x2c')](_0x18c2f8,'id'));}});})[_0x92a9('0x19')](function(){if(_0x5c14b9[_0x92a9('0x8c')][_0x92a9('0x8a')]===_0x92a9('0x8b')&&!_0x594923&&!_0x5c14b9[_0x92a9('0x31')][_0x92a9('0x88')])return[];return db['sequelize'][_0x92a9('0x31')](_0x436a0c[_0x92a9('0x8e')](),_0x466d2d);})[_0x92a9('0x19')](function(_0x46576a){_0x3ec90f[_0x92a9('0x14')]=_0x46576a['length'];if(_0x3ec90f[_0x92a9('0x14')]===0x0)return[];return db[_0x92a9('0x8f')][_0x92a9('0x31')](_0x84fed0[_0x92a9('0x8e')](),_0x466d2d)['then'](function(_0x27c394){_0x1543ec=_['keyBy'](_0x27c394,'id');_0x466d2d=_[_0x92a9('0x90')](_0x466d2d,{'model':db[_0x92a9('0x2d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5c14b9[_0x92a9('0x31')]['fields']){_0x440b18[_0x92a9('0x35')][_0x92a9('0x23')](function(_0xae324b){_0x52543f[_0x92a9('0x3b')]('i.'+_0xae324b);});}else{_0x52543f['field'](_0x92a9('0x85'),_0x92a9('0x55'));_0x52543f[_0x92a9('0x3b')](_0x92a9('0x91'),_0x92a9('0x92'));_0x52543f[_0x92a9('0x3b')](_0x92a9('0x93'),_0x92a9('0x94'));_0x52543f[_0x92a9('0x3b')](_0x92a9('0x95'),_0x92a9('0x86'));_0x52543f[_0x92a9('0x3b')](_0x92a9('0x81'));_0x52543f[_0x92a9('0x3b')]('i.createdAt');_0x52543f['field']('i.updatedAt');_0x52543f[_0x92a9('0x3b')](_0x92a9('0x96'));_0x52543f[_0x92a9('0x3b')](_0x92a9('0x97'));_0x52543f[_0x92a9('0x3b')](_0x92a9('0x98'));_0x52543f['field'](_0x92a9('0x99'));_0x52543f['field']('i.lastMsgDirection');_0x52543f['field'](_0x92a9('0x9a'));_0x52543f['field'](_0x92a9('0x9b'));_0x52543f[_0x92a9('0x3b')]('i.secondDisposition');_0x52543f['field'](_0x92a9('0x9c'));_0x52543f[_0x92a9('0x3b')](_0x92a9('0x9d'));_0x52543f[_0x92a9('0x3b')](_0x92a9('0x9e'));_0x52543f['field'](_0x92a9('0x9f'));_0x52543f[_0x92a9('0x3b')]('i.MailAccountId');_0x52543f[_0x92a9('0x3b')](_0x92a9('0xa0'));_0x52543f[_0x92a9('0x3b')](_0x92a9('0xa1'),_0x92a9('0xa2'));_0x52543f['field'](_0x92a9('0xa3'),_0x92a9('0xa4'));_0x52543f[_0x92a9('0x3b')](_0x92a9('0xa5'),_0x92a9('0xa6'));_0x52543f['field'](_0x92a9('0xa7'),_0x92a9('0xa8'));_0x52543f[_0x92a9('0x3b')](_0x92a9('0xa9'),_0x92a9('0xaa'));_0x52543f[_0x92a9('0x3b')]('c.fax',_0x92a9('0xab'));_0x52543f[_0x92a9('0x3b')](_0x92a9('0xac'),_0x92a9('0xad'));_0x52543f[_0x92a9('0x3b')](_0x92a9('0xae'),_0x92a9('0xaf'));_0x52543f[_0x92a9('0x3b')](_0x92a9('0xb0'),_0x92a9('0x21'));}if(_0x440b18['limit'])_0x52543f[_0x92a9('0x13')](_0x440b18[_0x92a9('0x13')]);if(_0x440b18[_0x92a9('0x12')])_0x52543f['offset'](_0x440b18['offset']);return db['sequelize'][_0x92a9('0x31')](_0x52543f[_0x92a9('0x8e')](),_0x466d2d);})[_0x92a9('0x19')](function(_0x20bfe9){if(_0x20bfe9[_0x92a9('0x53')]>0x0)_0x3b7c5b[_0x92a9('0x6b')](_0x92a9('0xb1'),_[_0x92a9('0x2c')](_0x20bfe9,'id'));return db[_0x92a9('0x8f')][_0x92a9('0x31')](_0x3b7c5b['toString'](),_0x466d2d)[_0x92a9('0x19')](function(_0x160638){var _0x2ee9b6=_[_0x92a9('0xb2')](_0x160638,_0x92a9('0xb3'));var _0x47ad03=[];return db['Setting'][_0x92a9('0x25')]({'attributes':['enableEmailPreview'],'raw':!![]})[_0x92a9('0x19')](function(_0x37c365){var _0x52f103=_0x37c365['enableEmailPreview'];_0x20bfe9[_0x92a9('0x23')](function(_0x4bf044){_0x47ad03['push'](updateMailInteraction(_0x4bf044,_0x1543ec,_0x2ee9b6,_0x52f103));});return BPromise[_0x92a9('0xb4')](_0x47ad03);});});});})[_0x92a9('0x19')](function(_0x4915cd){_0x3ec90f[_0x92a9('0xb5')]=_0x4915cd;return _0x3ec90f;})[_0x92a9('0x19')](respondWithFilteredResult(_0x23532a,_0x440b18))[_0x92a9('0x2a')](handleError(_0x23532a,null));};exports[_0x92a9('0xb6')]=function(_0x4942ae,_0x178b2b){var _0x2e134b={'raw':![],'where':{'id':_0x4942ae['params']['id']}},_0x510f9d={};_0x510f9d[_0x92a9('0x30')]=_[_0x92a9('0xb7')](db['MailInteraction'][_0x92a9('0xb8')]);_0x510f9d[_0x92a9('0x31')]=_[_0x92a9('0xb7')](_0x4942ae[_0x92a9('0x31')]);_0x510f9d[_0x92a9('0x32')]=_[_0x92a9('0x33')](_0x510f9d[_0x92a9('0x30')],_0x510f9d['query']);_0x2e134b[_0x92a9('0x35')]=_['intersection'](_0x510f9d['model'],qs[_0x92a9('0x34')](_0x4942ae[_0x92a9('0x31')]['fields']));_0x2e134b[_0x92a9('0x35')]=_0x2e134b[_0x92a9('0x35')]['length']?_0x2e134b['attributes']:_0x510f9d[_0x92a9('0x30')];if(_0x4942ae[_0x92a9('0x31')][_0x92a9('0xb9')]){_0x2e134b['include']=[{'all':!![]}];}_0x2e134b=_[_0x92a9('0x90')]({},_0x2e134b,_0x4942ae[_0x92a9('0xba')]);return db['MailInteraction'][_0x92a9('0x54')](_0x2e134b)[_0x92a9('0x19')](handleEntityNotFound(_0x178b2b,null))[_0x92a9('0x19')](respondWithResult(_0x178b2b,null))[_0x92a9('0x2a')](handleError(_0x178b2b,null));};exports[_0x92a9('0xbb')]=function(_0x32d41b,_0x3225df){return db[_0x92a9('0x2d')][_0x92a9('0xbb')](_0x32d41b[_0x92a9('0xbc')],{})[_0x92a9('0x19')](respondWithResult(_0x3225df,0xc9))[_0x92a9('0x2a')](handleError(_0x3225df,null));};exports[_0x92a9('0x18')]=function(_0x3e19b1,_0x37ac30){if(_0x3e19b1['body']['id']){delete _0x3e19b1[_0x92a9('0xbc')]['id'];}return db[_0x92a9('0x2d')]['find']({'where':{'id':_0x3e19b1[_0x92a9('0xbd')]['id']}})[_0x92a9('0x19')](handleEntityNotFound(_0x37ac30,null))[_0x92a9('0x19')](saveUpdates(_0x3e19b1[_0x92a9('0xbc')],null))[_0x92a9('0x19')](respondWithResult(_0x37ac30,null))[_0x92a9('0x2a')](handleError(_0x37ac30,null));};exports[_0x92a9('0x1a')]=function(_0x255559,_0x1e68b9){return db['MailInteraction'][_0x92a9('0x54')]({'where':{'id':_0x255559[_0x92a9('0xbd')]['id']}})[_0x92a9('0x19')](handleEntityNotFound(_0x1e68b9,null))[_0x92a9('0x19')](removeEntity(_0x1e68b9,null))[_0x92a9('0x2a')](handleError(_0x1e68b9,null));};exports[_0x92a9('0xbe')]=function(_0x1d5511,_0x1fac35){return db[_0x92a9('0x2d')][_0x92a9('0xbe')]()[_0x92a9('0x19')](respondWithResult(_0x1fac35,null))[_0x92a9('0x2a')](handleError(_0x1fac35,null));};exports[_0x92a9('0xbf')]=function(_0x14f10a,_0x50e235){return db[_0x92a9('0xc0')][_0x92a9('0x54')]({'where':{'id':_0x14f10a[_0x92a9('0xbd')]['id']}})['then'](handleEntityNotFound(_0x50e235,null))[_0x92a9('0x19')](function(_0x18e503){if(_0x18e503){return _0x18e503[_0x92a9('0xbf')](_0x14f10a[_0x92a9('0xbc')][_0x92a9('0xc1')],_[_0x92a9('0xc2')](_0x14f10a['body'],[_0x92a9('0xc1'),'id'])||{});}})[_0x92a9('0x19')](respondWithResult(_0x50e235,null))[_0x92a9('0x2a')](handleError(_0x50e235,null));};exports[_0x92a9('0xc3')]=function(_0x2ded60,_0x48a344){var _0x4e911b={'raw':![],'where':{}};var _0x643f01={};var _0x2c25c0={'count':0x0,'rows':[]};return db[_0x92a9('0x2d')][_0x92a9('0x25')]({'where':{'id':_0x2ded60['params']['id']}})[_0x92a9('0x19')](handleEntityNotFound(_0x48a344,null))[_0x92a9('0x19')](function(_0x58cf39){if(_0x58cf39){_0x643f01[_0x92a9('0x30')]=_[_0x92a9('0xb7')](db[_0x92a9('0xc0')][_0x92a9('0xb8')]);_0x643f01[_0x92a9('0x31')]=_[_0x92a9('0xb7')](_0x2ded60[_0x92a9('0x31')]);_0x643f01[_0x92a9('0x32')]=_[_0x92a9('0x33')](_0x643f01['model'],_0x643f01['query']);_0x4e911b[_0x92a9('0x35')]=_[_0x92a9('0x33')](_0x643f01['model'],qs['fields'](_0x2ded60[_0x92a9('0x31')][_0x92a9('0x34')]));_0x4e911b[_0x92a9('0x35')]=_0x4e911b[_0x92a9('0x35')][_0x92a9('0x53')]?_0x4e911b[_0x92a9('0x35')]:_0x643f01[_0x92a9('0x30')];if(!_0x2ded60[_0x92a9('0x31')][_0x92a9('0x36')](_0x92a9('0x37'))){_0x4e911b[_0x92a9('0x13')]=qs['limit'](_0x2ded60[_0x92a9('0x31')][_0x92a9('0x13')]);_0x4e911b[_0x92a9('0x12')]=qs['offset'](_0x2ded60[_0x92a9('0x31')]['offset']);}_0x4e911b['order']=qs['sort'](_0x2ded60[_0x92a9('0x31')][_0x92a9('0x39')]);_0x4e911b['where']=qs[_0x92a9('0x32')](_['pick'](_0x2ded60[_0x92a9('0x31')],_0x643f01[_0x92a9('0x32')]));_0x4e911b['where'][_0x92a9('0xb3')]=_0x58cf39['id'];if(_0x2ded60[_0x92a9('0x31')]['filter']){_0x4e911b[_0x92a9('0x6b')]=_[_0x92a9('0x90')](_0x4e911b[_0x92a9('0x6b')],{'$or':_['map'](_0x4e911b[_0x92a9('0x35')],function(_0x5f216f){var _0x472a5a={};_0x472a5a[_0x5f216f]={'$like':'%'+_0x2ded60[_0x92a9('0x31')][_0x92a9('0x78')]+'%'};return _0x472a5a;})});}if(_0x2ded60[_0x92a9('0x31')][_0x92a9('0x6f')]){var _0xb61a6a=_0x2ded60['query'][_0x92a9('0x6f')][_0x92a9('0x22')](',');var _0x2faf8a={};_0x2faf8a[_0xb61a6a[0x0]]={'$gte':moment(_0xb61a6a[0x1])[_0x92a9('0xc4')](_0x92a9('0xc5'))};_0x4e911b['where']=_[_0x92a9('0x90')](_0x4e911b[_0x92a9('0x6b')],_0x2faf8a);}_0x4e911b=_['merge']({},_0x4e911b,_0x2ded60[_0x92a9('0xba')]);return db[_0x92a9('0xc0')][_0x92a9('0x14')]({'where':_0x4e911b[_0x92a9('0x6b')]})['then'](function(_0x1b8f73){_0x2c25c0['count']=_0x1b8f73;if(_0x2ded60[_0x92a9('0x31')][_0x92a9('0xb9')]){_0x4e911b['include']=[{'all':!![]}];}return db[_0x92a9('0xc0')][_0x92a9('0xc6')](_0x4e911b);})['then'](function(_0x1c3310){if(_0x2ded60[_0x92a9('0x31')][_0x92a9('0xc7')]===_0x92a9('0xc8')){for(var _0x5ea764=0x0;_0x5ea764<_0x1c3310[_0x92a9('0x53')];_0x5ea764++){_0x1c3310[_0x5ea764]['body']=juice(_0x1c3310[_0x5ea764][_0x92a9('0xbc')]);}}_0x2c25c0[_0x92a9('0xb5')]=_0x1c3310;return _0x2c25c0;});}})[_0x92a9('0x19')](respondWithFilteredResult(_0x48a344,_0x4e911b))['catch'](handleError(_0x48a344,null));};exports[_0x92a9('0xc9')]=function(_0x16c71b,_0x226411){return db['MailInteraction'][_0x92a9('0x54')]({'where':{'id':_0x16c71b['params']['id']}})[_0x92a9('0x19')](handleEntityNotFound(_0x226411,null))[_0x92a9('0x19')](function(_0xdc94ea){if(_0xdc94ea){return _0xdc94ea['setTags'](_0x16c71b[_0x92a9('0xbc')]['ids'],_['omit'](_0x16c71b[_0x92a9('0xbc')],[_0x92a9('0xc1'),'id'])||{})['spread'](function(){return db[_0x92a9('0x64')]['findAll']({'attributes':['id',_0x92a9('0x1c'),_0x92a9('0x3c')],'where':{'id':_0x16c71b[_0x92a9('0xbc')][_0x92a9('0xc1')]}});})[_0x92a9('0x19')](function(_0x2be08b){socket[_0x92a9('0xca')](_0x92a9('0xcb'),{'id':Number(_0x16c71b[_0x92a9('0xbd')]['id']),'tags':_0x2be08b||[]});return{'id':Number(_0x16c71b[_0x92a9('0xbd')]['id']),'tags':_0x2be08b||[]};});}})[_0x92a9('0x19')](respondWithResult(_0x226411,null))['catch'](handleError(_0x226411,null));};exports['removeTags']=function(_0x5cf378,_0x88ad72){return db[_0x92a9('0x2d')][_0x92a9('0x54')]({'where':{'id':_0x5cf378[_0x92a9('0xbd')]['id']}})[_0x92a9('0x19')](handleEntityNotFound(_0x88ad72,null))['then'](function(_0x4f96ed){if(_0x4f96ed){return _0x4f96ed[_0x92a9('0xcc')](_0x5cf378['query'][_0x92a9('0xc1')]);}})[_0x92a9('0x19')](respondWithStatusCode(_0x88ad72,null))[_0x92a9('0x2a')](handleError(_0x88ad72,null));};exports[_0x92a9('0xcd')]=function(_0x1a5ddc,_0x5a4796){var _0x3fe6c1=moment()[_0x92a9('0xce')]()[_0x92a9('0x8e')]();var _0x39db87=path[_0x92a9('0xcf')](config['root'],_0x92a9('0xd0'),_0x92a9('0xd1'),_0x92a9('0xd2'));var _0x355fc3=path[_0x92a9('0xcf')](config[_0x92a9('0xd3')],_0x92a9('0xd0'),_0x92a9('0xd1'),_0x92a9('0xd4'));var _0x5c0b96=path['join'](_0x39db87,_0x3fe6c1);var _0x3811ae=util['format'](_0x92a9('0xd5'),_0x1a5ddc['params']['id'],_0x3fe6c1);var _0x40c530=path[_0x92a9('0xcf')](_0x39db87,_0x3811ae);var _0x4d2550=[];if(_0x1a5ddc[_0x92a9('0x31')]['attachments']){_0x4d2550[_0x92a9('0x24')]({'model':db[_0x92a9('0xd6')],'as':'Attachments','raw':!![]});}var _0x39f36a=[{'model':db[_0x92a9('0xc0')],'as':'Messages','attributes':['id','body','from','to','cc',_0x92a9('0xd7'),_0x92a9('0xd8'),_0x92a9('0x6d')],'where':{'secret':![]},'order':qs[_0x92a9('0x39')]('id'),'include':_0x4d2550}];return db[_0x92a9('0x2d')]['find']({'where':{'id':_0x1a5ddc['params']['id']},'include':_0x39f36a})['then'](handleEntityNotFound(_0x5a4796,null))[_0x92a9('0x19')](function(_0x339b50){if(_0x339b50&&_0x339b50[_0x92a9('0xd9')]){var _0x14116f=_0x339b50[_0x92a9('0xda')]({'plain':!![]});fs[_0x92a9('0xdb')](_0x5c0b96);return BPromise['each'](_0x14116f[_0x92a9('0xd9')],function(_0x40bcb1,_0x5e703b){var _0x39fe7c={'from':_0x40bcb1[_0x92a9('0x3d')],'to':_0x40bcb1['to'],'subject':_0x40bcb1[_0x92a9('0xd8')],'html':htmlEntities[_0x92a9('0xdc')](_0x40bcb1['body']),'headers':{'Date':moment(_0x40bcb1[_0x92a9('0x6d')])[_0x92a9('0xc4')](_0x92a9('0xdd'))},'attachments':[]};if(_0x40bcb1['cc']){_0x39fe7c['headers']['Cc']=_0x40bcb1['cc'];}if(_0x40bcb1[_0x92a9('0xd7')]){_0x39fe7c[_0x92a9('0xde')][_0x92a9('0xdf')]=_0x40bcb1[_0x92a9('0xd7')];}return new BPromise(function(_0x5b1efb,_0x147a19){if(_0x40bcb1[_0x92a9('0xe0')]){for(var _0x2222a2=0x0;_0x2222a2<_0x40bcb1[_0x92a9('0xe0')][_0x92a9('0x53')];_0x2222a2++){var _0x26c14a=_0x40bcb1[_0x92a9('0xe0')][_0x2222a2];var _0x17f3bc=path[_0x92a9('0xcf')](_0x355fc3,_0x26c14a[_0x92a9('0xe1')]);if(fs[_0x92a9('0xe2')](_0x17f3bc)){_0x39fe7c['attachments']['push']({'name':_0x26c14a[_0x92a9('0x1c')],'contentType':_0x26c14a[_0x92a9('0x2f')],'data':fs[_0x92a9('0xe3')](_0x17f3bc)});}}}emlformat['build'](_0x39fe7c,function(_0x166547,_0xf560d3){if(_0x166547)return _0x147a19(_0x166547);fs[_0x92a9('0xe4')](path[_0x92a9('0xcf')](_0x5c0b96,util[_0x92a9('0xc4')](_0x92a9('0xe5'),_0x5e703b)),_0xf560d3);return _0x5b1efb(_0xf560d3);});});})[_0x92a9('0x19')](function(){return new BPromise(function(_0x4bc8e6,_0x477f59){zipdir(_0x5c0b96,{'saveTo':_0x40c530},function(_0x29fdb9,_0xbdffe9){if(_0x29fdb9)return _0x477f59(_0x29fdb9);return _0x4bc8e6(_0xbdffe9);});})[_0x92a9('0x19')](function(){return new BPromise(function(_0x2f3297,_0x5b0dbc){rimraf(_0x5c0b96,function(_0x4fbcab){if(_0x4fbcab)_0x5b0dbc(_0x4fbcab);return _0x2f3297();});});})[_0x92a9('0x19')](function(){return _0x5a4796[_0x92a9('0xcd')](_0x40c530,_0x3811ae,function(_0x164040){if(!_0x164040)fs['unlinkSync'](_0x40c530);});});});}else{return _0x5a4796[_0x92a9('0xf')](0xc8);}})['catch'](handleError(_0x5a4796,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 27a9127..2d77ad7 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 _0x2d67=['emit','catch','hook','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','findAll'];(function(_0x5a58af,_0x2fd0e0){var _0x40b593=function(_0x354331){while(--_0x354331){_0x5a58af['push'](_0x5a58af['shift']());}};_0x40b593(++_0x2fd0e0);}(_0x2d67,0xc3));var _0x72d6=function(_0x50c16c,_0x43b99e){_0x50c16c=_0x50c16c-0x0;var _0x24dc5f=_0x2d67[_0x50c16c];return _0x24dc5f;};'use strict';var EventEmitter=require(_0x72d6('0x0'));var MailInteraction=require(_0x72d6('0x1'))['db'][_0x72d6('0x2')];var MailMessage=require(_0x72d6('0x1'))['db'][_0x72d6('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x72d6('0x4')](0x0);var events={'afterCreate':_0x72d6('0x5'),'afterUpdate':_0x72d6('0x6'),'afterDestroy':_0x72d6('0x7')};function emitEvent(_0x5c4070){return function(_0x46e469,_0x3260be,_0x4adc62){_0x46e469[_0x72d6('0x8')]({'attributes':['id'],'raw':!![]})[_0x72d6('0x9')](function(_0x36c3cc){_0x46e469[_0x72d6('0xa')](_0x72d6('0xb'),_0x36c3cc['map'](function(_0x32d724){return{'id':_0x32d724['id']};}));return MailMessage[_0x72d6('0xc')]({'where':{'MailInteractionId':_0x46e469['id'],'direction':'in','read':![]},'raw':!![]});})[_0x72d6('0x9')](function(_0x28c60e){_0x46e469['setDataValue']('unreadMessages',_0x28c60e['length']);MailInteractionEvents[_0x72d6('0xd')](_0x5c4070+':'+_0x46e469['id'],_0x46e469);MailInteractionEvents[_0x72d6('0xd')](_0x5c4070,_0x46e469);_0x4adc62(null);})[_0x72d6('0xe')](_0x4adc62(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x72d6('0xf')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x24c5=['then','setDataValue','Users','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','remove','getUsers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x24c5,0xf7));var _0x524c=function(_0x3f6f2f,_0xa6b126){_0x3f6f2f=_0x3f6f2f-0x0;var _0x35b6f6=_0x24c5[_0x3f6f2f];return _0x35b6f6;};'use strict';var EventEmitter=require(_0x524c('0x0'));var MailInteraction=require(_0x524c('0x1'))['db'][_0x524c('0x2')];var MailMessage=require(_0x524c('0x1'))['db'][_0x524c('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x524c('0x4')](0x0);var events={'afterCreate':_0x524c('0x5'),'afterUpdate':'update','afterDestroy':_0x524c('0x6')};function emitEvent(_0x1bf9d7){return function(_0x2dd7e0,_0x4797ca,_0x11edae){_0x2dd7e0[_0x524c('0x7')]({'attributes':['id'],'raw':!![]})[_0x524c('0x8')](function(_0x3e834f){_0x2dd7e0[_0x524c('0x9')](_0x524c('0xa'),_0x3e834f['map'](function(_0x2948f7){return{'id':_0x2948f7['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x2dd7e0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x524c('0x8')](function(_0x14b93f){_0x2dd7e0[_0x524c('0x9')](_0x524c('0xb'),_0x14b93f[_0x524c('0xc')]);MailInteractionEvents[_0x524c('0xd')](_0x1bf9d7+':'+_0x2dd7e0['id'],_0x2dd7e0);MailInteractionEvents[_0x524c('0xd')](_0x1bf9d7,_0x2dd7e0);_0x11edae(null);})[_0x524c('0xe')](_0x11edae(null));};}for(var e in events){if(events[_0x524c('0xf')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x524c('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 37330d0..1606a55 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 _0xefe6=['lodash','util','api','bluebird','request-promise','path','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatusAt','format','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','substatus','models','get','MailMessage','then','catch','utf8mb4','utf8mb4_unicode_ci'];(function(_0x440479,_0x37010a){var _0x60d6d5=function(_0x184f3a){while(--_0x184f3a){_0x440479['push'](_0x440479['shift']());}};_0x60d6d5(++_0x37010a);}(_0xefe6,0x118));var _0x6efe=function(_0x815b87,_0x270652){_0x815b87=_0x815b87-0x0;var _0x398960=_0xefe6[_0x815b87];return _0x398960;};'use strict';var _=require(_0x6efe('0x0'));var util=require(_0x6efe('0x1'));var logger=require('../../config/logger')(_0x6efe('0x2'));var moment=require('moment');var BPromise=require(_0x6efe('0x3'));var rp=require(_0x6efe('0x4'));var fs=require('fs');var path=require(_0x6efe('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6efe('0x6'));module[_0x6efe('0x7')]=function(_0x174738,_0x3ac294){return _0x174738[_0x6efe('0x8')](_0x6efe('0x9'),attributes,{'tableName':_0x6efe('0xa'),'paranoid':![],'indexes':[{'name':_0x6efe('0xb'),'fields':[_0x6efe('0xc'),'to'],'type':_0x6efe('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2bacb9,_0x54880f,_0x567381){if(_0x2bacb9['substatus']){_0x2bacb9[_0x6efe('0xe')]=moment()[_0x6efe('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x2bacb9[_0x6efe('0x10')]){_0x2bacb9[_0x6efe('0x11')]=moment()[_0x6efe('0xf')](_0x6efe('0x12'));}_0x567381(null,_0x54880f);},'beforeUpdate':function(_0xbfc152,_0x47ad8b,_0x53f896){if(_0xbfc152[_0x6efe('0x13')]('substatus')){_0xbfc152['substatusAt']=_0xbfc152[_0x6efe('0x14')]?moment()['format'](_0x6efe('0x12')):null;}if(_0xbfc152[_0x6efe('0x13')](_0x6efe('0x10'))){_0xbfc152[_0x6efe('0x11')]=moment()[_0x6efe('0xf')](_0x6efe('0x12'));_0xbfc152[_0x6efe('0x14')]=null;_0xbfc152['substatusAt']=null;}_0x53f896(null,_0xbfc152);},'afterUpdate':function(_0x473609,_0x46cccc,_0x18a7c1){var _0x4433cd=_0x174738[_0x6efe('0x15')];var _0x4024aa=_0x473609[_0x6efe('0x16')]({'plain':!![]});if(_0x4024aa[_0x6efe('0x10')]){return _0x4433cd[_0x6efe('0x17')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x4024aa['id']}})[_0x6efe('0x18')](function(){_0x18a7c1();})[_0x6efe('0x19')](function(_0x406490){_0x18a7c1(_0x406490);});}else{_0x18a7c1();}}},'charset':_0x6efe('0x1a'),'collate':_0x6efe('0x1b')});}; \ No newline at end of file +var _0x076f=['FULLTEXT','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','format','get','MailMessage','update','then','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions'];(function(_0x5a179a,_0x20f3f7){var _0x4d3201=function(_0x3a1415){while(--_0x3a1415){_0x5a179a['push'](_0x5a179a['shift']());}};_0x4d3201(++_0x20f3f7);}(_0x076f,0x16a));var _0xf076=function(_0x26062f,_0xa31db){_0x26062f=_0x26062f-0x0;var _0x24a445=_0x076f[_0x26062f];return _0x24a445;};'use strict';var _=require(_0xf076('0x0'));var util=require(_0xf076('0x1'));var logger=require(_0xf076('0x2'))(_0xf076('0x3'));var moment=require(_0xf076('0x4'));var BPromise=require(_0xf076('0x5'));var rp=require(_0xf076('0x6'));var fs=require('fs');var path=require(_0xf076('0x7'));var rimraf=require(_0xf076('0x8'));var config=require('../../config/environment');var attributes=require(_0xf076('0x9'));module[_0xf076('0xa')]=function(_0x37e5fc,_0x4677ec){return _0x37e5fc[_0xf076('0xb')](_0xf076('0xc'),attributes,{'tableName':_0xf076('0xd'),'paranoid':![],'indexes':[{'name':_0xf076('0xe'),'fields':['subject','to'],'type':_0xf076('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4e7c40,_0x14da9e,_0x50a2a9){if(_0x4e7c40[_0xf076('0x10')]){_0x4e7c40[_0xf076('0x11')]=moment()['format'](_0xf076('0x12'));}if(_0x4e7c40[_0xf076('0x13')]){_0x4e7c40[_0xf076('0x14')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x50a2a9(null,_0x14da9e);},'beforeUpdate':function(_0x2d0603,_0x2ca55e,_0x1e0699){if(_0x2d0603[_0xf076('0x15')](_0xf076('0x10'))){_0x2d0603[_0xf076('0x11')]=_0x2d0603[_0xf076('0x10')]?moment()[_0xf076('0x16')](_0xf076('0x12')):null;}if(_0x2d0603['changed']('closed')){_0x2d0603[_0xf076('0x14')]=moment()[_0xf076('0x16')](_0xf076('0x12'));_0x2d0603['substatus']=null;_0x2d0603['substatusAt']=null;}_0x1e0699(null,_0x2d0603);},'afterUpdate':function(_0x400f2d,_0x4cc3b2,_0x35ab2c){var _0x5a8fe4=_0x37e5fc['models'];var _0x8bf9f1=_0x400f2d[_0xf076('0x17')]({'plain':!![]});if(_0x8bf9f1[_0xf076('0x13')]){return _0x5a8fe4[_0xf076('0x18')][_0xf076('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0x8bf9f1['id']}})[_0xf076('0x1a')](function(){_0x35ab2c();})['catch'](function(_0x2e0b35){_0x35ab2c(_0x2e0b35);});}else{_0x35ab2c();}}},'charset':_0xf076('0x1b'),'collate':_0xf076('0x1c')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 9a895e0..d008461 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 _0x0b04=['find','addTags','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','request','then','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','UpdateMailInteraction','options','raw','where','limit','stringify','catch','AddTagsToMailInteraction','MailInteraction'];(function(_0x353585,_0x4ddaad){var _0x25f624=function(_0x6bc3da){while(--_0x6bc3da){_0x353585['push'](_0x353585['shift']());}};_0x25f624(++_0x4ddaad);}(_0x0b04,0x164));var _0x40b0=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x0b04[_0x68ee8b];return _0x5148f7;};'use strict';var _=require(_0x40b0('0x0'));var util=require(_0x40b0('0x1'));var moment=require(_0x40b0('0x2'));var BPromise=require('bluebird');var rs=require(_0x40b0('0x3'));var fs=require('fs');var Redis=require(_0x40b0('0x4'));var db=require(_0x40b0('0x5'))['db'];var utils=require(_0x40b0('0x6'));var logger=require(_0x40b0('0x7'))('rpc');var config=require(_0x40b0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x40b0('0x9')][_0x40b0('0xa')]({'port':0x232a});config[_0x40b0('0xb')]=_[_0x40b0('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x40b0('0xd'))(new Redis(config[_0x40b0('0xb')]));require(_0x40b0('0xe'))[_0x40b0('0xf')](socket);function respondWithRpcPromise(_0x42a633,_0xb8289c,_0x303728){return new BPromise(function(_0x1989ae,_0xd9d16a){return client[_0x40b0('0x10')](_0x42a633,_0x303728)[_0x40b0('0x11')](function(_0x520c88){logger['info'](_0x40b0('0x12'),_0xb8289c,'request\x20sent');logger[_0x40b0('0x13')](_0x40b0('0x14'),_0xb8289c,_0x40b0('0x15'),JSON['stringify'](_0x520c88));if(_0x520c88[_0x40b0('0x16')]){if(_0x520c88[_0x40b0('0x16')]['code']===0x1f4){logger[_0x40b0('0x16')]('MailInteraction,\x20%s,\x20%s',_0xb8289c,_0x520c88[_0x40b0('0x16')][_0x40b0('0x17')]);return _0xd9d16a(_0x520c88[_0x40b0('0x16')][_0x40b0('0x17')]);}logger[_0x40b0('0x16')](_0x40b0('0x12'),_0xb8289c,_0x520c88[_0x40b0('0x16')][_0x40b0('0x17')]);return _0x1989ae(_0x520c88['error']['message']);}else{logger[_0x40b0('0x18')]('MailInteraction,\x20%s,\x20%s',_0xb8289c,_0x40b0('0x15'));_0x1989ae(_0x520c88['result'][_0x40b0('0x17')]);}})['catch'](function(_0x12a6a8){logger['error'](_0x40b0('0x12'),_0xb8289c,_0x12a6a8);_0xd9d16a(_0x12a6a8);});});}exports[_0x40b0('0x19')]=function(_0xd63aa7){var _0x3ff080=this;return new Promise(function(_0x7d64bd,_0x3fa917){return db['MailInteraction']['update'](_0xd63aa7['body'],{'raw':_0xd63aa7[_0x40b0('0x1a')]?_0xd63aa7['options'][_0x40b0('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd63aa7[_0x40b0('0x1a')]?_0xd63aa7[_0x40b0('0x1a')][_0x40b0('0x1c')]||null:null,'attributes':_0xd63aa7[_0x40b0('0x1a')]?_0xd63aa7['options']['attributes']||null:null,'limit':_0xd63aa7[_0x40b0('0x1a')]?_0xd63aa7[_0x40b0('0x1a')][_0x40b0('0x1d')]||null:null})[_0x40b0('0x11')](function(_0x2fda4c){logger[_0x40b0('0x18')]('UpdateMailInteraction',_0xd63aa7);logger[_0x40b0('0x13')](_0x40b0('0x19'),_0xd63aa7,JSON[_0x40b0('0x1e')](_0x2fda4c));_0x7d64bd(_0x2fda4c);})[_0x40b0('0x1f')](function(_0xdfcc3b){logger[_0x40b0('0x16')]('UpdateMailInteraction',_0xdfcc3b[_0x40b0('0x17')],_0xd63aa7);_0x3fa917(_0x3ff080['error'](0x1f4,_0xdfcc3b[_0x40b0('0x17')]));});});};exports[_0x40b0('0x20')]=function(_0x3485c4){return new Promise(function(_0x27bf4d,_0x2ef70d){return db[_0x40b0('0x21')][_0x40b0('0x22')]({'where':_0x3485c4['options']?_0x3485c4[_0x40b0('0x1a')]['where']||null:null})['then'](function(_0x1ceef9){if(_0x1ceef9){return _0x1ceef9[_0x40b0('0x23')](_0x3485c4['body'][_0x40b0('0x24')],_['omit'](_0x3485c4['body'],[_0x40b0('0x24'),'id'])||{});}})[_0x40b0('0x25')](function(_0x5967cc){logger['info'](_0x40b0('0x26'),_0x3485c4);logger['debug'](_0x40b0('0x26'),_0x3485c4,JSON[_0x40b0('0x1e')](_0x5967cc));_0x27bf4d(_0x5967cc);})[_0x40b0('0x1f')](function(_0x1d83ea){logger[_0x40b0('0x16')]('AddTags',_0x1d83ea['message'],_0x3485c4);_0x2ef70d(_this[_0x40b0('0x16')](0x1f4,_0x1d83ea[_0x40b0('0x17')]));});});}; \ No newline at end of file +var _0xd177=['debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateMailInteraction','update','options','limit','AddTagsToMailInteraction','MailInteraction','find','where','body','ids','omit','stringify','AddTags','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x1a8a79,_0x57182d){var _0x436f4c=function(_0x4cc5c2){while(--_0x4cc5c2){_0x1a8a79['push'](_0x1a8a79['shift']());}};_0x436f4c(++_0x57182d);}(_0xd177,0x11e));var _0x7d17=function(_0x212e59,_0x5a6bcf){_0x212e59=_0x212e59-0x0;var _0x501b26=_0xd177[_0x212e59];return _0x501b26;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7d17('0x0'));var BPromise=require(_0x7d17('0x1'));var rs=require(_0x7d17('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7d17('0x3'));var logger=require(_0x7d17('0x4'))(_0x7d17('0x5'));var config=require(_0x7d17('0x6'));var jayson=require(_0x7d17('0x7'));var client=jayson['client'][_0x7d17('0x8')]({'port':0x232a});config[_0x7d17('0x9')]=_[_0x7d17('0xa')](config[_0x7d17('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x7d17('0xb'))(new Redis(config['redis']));require(_0x7d17('0xc'))[_0x7d17('0xd')](socket);function respondWithRpcPromise(_0x59cb50,_0x550193,_0x43e92f){return new BPromise(function(_0x552e69,_0x46b53f){return client['request'](_0x59cb50,_0x43e92f)[_0x7d17('0xe')](function(_0x37d71a){logger[_0x7d17('0xf')](_0x7d17('0x10'),_0x550193,_0x7d17('0x11'));logger[_0x7d17('0x12')](_0x7d17('0x13'),_0x550193,_0x7d17('0x11'),JSON['stringify'](_0x37d71a));if(_0x37d71a[_0x7d17('0x14')]){if(_0x37d71a[_0x7d17('0x14')][_0x7d17('0x15')]===0x1f4){logger[_0x7d17('0x14')]('MailInteraction,\x20%s,\x20%s',_0x550193,_0x37d71a['error'][_0x7d17('0x16')]);return _0x46b53f(_0x37d71a[_0x7d17('0x14')]['message']);}logger['error'](_0x7d17('0x10'),_0x550193,_0x37d71a[_0x7d17('0x14')][_0x7d17('0x16')]);return _0x552e69(_0x37d71a[_0x7d17('0x14')][_0x7d17('0x16')]);}else{logger[_0x7d17('0xf')](_0x7d17('0x10'),_0x550193,_0x7d17('0x11'));_0x552e69(_0x37d71a[_0x7d17('0x17')]['message']);}})[_0x7d17('0x18')](function(_0x18b90b){logger['error'](_0x7d17('0x10'),_0x550193,_0x18b90b);_0x46b53f(_0x18b90b);});});}exports[_0x7d17('0x19')]=function(_0x36f4d9){var _0x2c171e=this;return new Promise(function(_0x2688a9,_0x22dd7a){return db['MailInteraction'][_0x7d17('0x1a')](_0x36f4d9['body'],{'raw':_0x36f4d9[_0x7d17('0x1b')]?_0x36f4d9['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36f4d9['options']?_0x36f4d9['options']['where']||null:null,'attributes':_0x36f4d9[_0x7d17('0x1b')]?_0x36f4d9[_0x7d17('0x1b')]['attributes']||null:null,'limit':_0x36f4d9[_0x7d17('0x1b')]?_0x36f4d9['options'][_0x7d17('0x1c')]||null:null})[_0x7d17('0xe')](function(_0x52024a){logger[_0x7d17('0xf')]('UpdateMailInteraction',_0x36f4d9);logger[_0x7d17('0x12')](_0x7d17('0x19'),_0x36f4d9,JSON['stringify'](_0x52024a));_0x2688a9(_0x52024a);})['catch'](function(_0x168b9d){logger['error'](_0x7d17('0x19'),_0x168b9d['message'],_0x36f4d9);_0x22dd7a(_0x2c171e[_0x7d17('0x14')](0x1f4,_0x168b9d[_0x7d17('0x16')]));});});};exports[_0x7d17('0x1d')]=function(_0x1b8f17){return new Promise(function(_0xe6dfb5,_0x606401){return db[_0x7d17('0x1e')][_0x7d17('0x1f')]({'where':_0x1b8f17[_0x7d17('0x1b')]?_0x1b8f17[_0x7d17('0x1b')][_0x7d17('0x20')]||null:null})[_0x7d17('0xe')](function(_0x3fb1bc){if(_0x3fb1bc){return _0x3fb1bc['addTags'](_0x1b8f17[_0x7d17('0x21')][_0x7d17('0x22')],_[_0x7d17('0x23')](_0x1b8f17[_0x7d17('0x21')],[_0x7d17('0x22'),'id'])||{});}})['spread'](function(_0x46aad3){logger[_0x7d17('0xf')]('AddTags',_0x1b8f17);logger[_0x7d17('0x12')]('AddTags',_0x1b8f17,JSON[_0x7d17('0x24')](_0x46aad3));_0xe6dfb5(_0x46aad3);})[_0x7d17('0x18')](function(_0x6e1cbc){logger['error'](_0x7d17('0x25'),_0x6e1cbc[_0x7d17('0x16')],_0x1b8f17);_0x606401(_this[_0x7d17('0x14')](0x1f4,_0x6e1cbc[_0x7d17('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index f1ecdb6..79d19fc 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 _0xcc81=['update','removeListener','register','length','mailInteraction:','./mailInteraction.events','save'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xcc81,0x11d));var _0x1cc8=function(_0x365c0a,_0x26dcb7){_0x365c0a=_0x365c0a-0x0;var _0x19e3e7=_0xcc81[_0x365c0a];return _0x19e3e7;};'use strict';var MailInteractionEvents=require(_0x1cc8('0x0'));var events=[_0x1cc8('0x1'),'remove',_0x1cc8('0x2')];function createListener(_0x53f942,_0x2e4e6f){return function(_0x457c7b){_0x2e4e6f['emit'](_0x53f942,_0x457c7b);};}function removeListener(_0x175f15,_0x45b86d){return function(){MailInteractionEvents[_0x1cc8('0x3')](_0x175f15,_0x45b86d);};}exports[_0x1cc8('0x4')]=function(_0x4e28fa){for(var _0x4f849e=0x0,_0x16b3a6=events[_0x1cc8('0x5')];_0x4f849e<_0x16b3a6;_0x4f849e++){var _0x2dd386=events[_0x4f849e];var _0x3faf0d=createListener(_0x1cc8('0x6')+_0x2dd386,_0x4e28fa);MailInteractionEvents['on'](_0x2dd386,_0x3faf0d);}}; \ No newline at end of file +var _0x9eaf=['./mailInteraction.events','save','remove','update','emit','removeListener','register','length','mailInteraction:'];(function(_0x12877b,_0x8650cf){var _0x3549ff=function(_0x4f96b7){while(--_0x4f96b7){_0x12877b['push'](_0x12877b['shift']());}};_0x3549ff(++_0x8650cf);}(_0x9eaf,0x1b9));var _0xf9ea=function(_0x4b4f89,_0x31eabb){_0x4b4f89=_0x4b4f89-0x0;var _0x3a9c6f=_0x9eaf[_0x4b4f89];return _0x3a9c6f;};'use strict';var MailInteractionEvents=require(_0xf9ea('0x0'));var events=[_0xf9ea('0x1'),_0xf9ea('0x2'),_0xf9ea('0x3')];function createListener(_0x18a486,_0x3be7e0){return function(_0x200915){_0x3be7e0[_0xf9ea('0x4')](_0x18a486,_0x200915);};}function removeListener(_0x361cf3,_0x125a35){return function(){MailInteractionEvents[_0xf9ea('0x5')](_0x361cf3,_0x125a35);};}exports[_0xf9ea('0x6')]=function(_0x46b728){for(var _0x5ba0ff=0x0,_0x2116d8=events[_0xf9ea('0x7')];_0x5ba0ff<_0x2116d8;_0x5ba0ff++){var _0x1207e9=events[_0x5ba0ff];var _0x5678a5=createListener(_0xf9ea('0x8')+_0x1207e9,_0x46b728);MailInteractionEvents['on'](_0x1207e9,_0x5678a5);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 92aa90a..dd2fe83 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 _0xfe57=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','show','download','mailmessage:create','create','put','/:id','update','/:id/reject','reject','destroy','exports','multer','util','express'];(function(_0x33fcbb,_0x291d0f){var _0x2efe40=function(_0x2e9442){while(--_0x2e9442){_0x33fcbb['push'](_0x33fcbb['shift']());}};_0x2efe40(++_0x291d0f);}(_0xfe57,0x195));var _0x7fe5=function(_0x5ecadc,_0x1cf9f1){_0x5ecadc=_0x5ecadc-0x0;var _0x565037=_0xfe57[_0x5ecadc];return _0x565037;};'use strict';var multer=require(_0x7fe5('0x0'));var util=require(_0x7fe5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7fe5('0x2'));var router=express[_0x7fe5('0x3')]();var fs_extra=require(_0x7fe5('0x4'));var auth=require(_0x7fe5('0x5'));var interaction=require(_0x7fe5('0x6'));var config=require(_0x7fe5('0x7'));var controller=require(_0x7fe5('0x8'));router[_0x7fe5('0x9')]('/',auth[_0x7fe5('0xa')](),controller[_0x7fe5('0xb')]);router[_0x7fe5('0x9')](_0x7fe5('0xc'),auth[_0x7fe5('0xa')](),controller['describe']);router[_0x7fe5('0x9')]('/:id',auth[_0x7fe5('0xa')](),controller[_0x7fe5('0xd')]);router['get']('/:id/download',auth[_0x7fe5('0xa')](),controller[_0x7fe5('0xe')]);router['post']('/',auth[_0x7fe5('0xa')](),interaction['tracked']('mail',_0x7fe5('0xf')),controller[_0x7fe5('0x10')]);router[_0x7fe5('0x11')](_0x7fe5('0x12'),auth['isAuthenticated'](),controller[_0x7fe5('0x13')]);router[_0x7fe5('0x11')]('/:id/accept',auth[_0x7fe5('0xa')](),controller['accept']);router[_0x7fe5('0x11')](_0x7fe5('0x14'),auth['isAuthenticated'](),controller[_0x7fe5('0x15')]);router['delete'](_0x7fe5('0x12'),auth[_0x7fe5('0xa')](),controller[_0x7fe5('0x16')]);module[_0x7fe5('0x17')]=router; \ No newline at end of file +var _0x6bc9=['./mailMessage.controller','isAuthenticated','/describe','describe','get','/:id','show','download','post','tracked','mail','mailmessage:create','create','put','/:id/accept','reject','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x349321,_0x5a91d3){var _0x46dee6=function(_0x5e4257){while(--_0x5e4257){_0x349321['push'](_0x349321['shift']());}};_0x46dee6(++_0x5a91d3);}(_0x6bc9,0x1c2));var _0x96bc=function(_0x2136a6,_0x35af63){_0x2136a6=_0x2136a6-0x0;var _0x55b948=_0x6bc9[_0x2136a6];return _0x55b948;};'use strict';var multer=require(_0x96bc('0x0'));var util=require(_0x96bc('0x1'));var path=require('path');var timeout=require(_0x96bc('0x2'));var express=require(_0x96bc('0x3'));var router=express[_0x96bc('0x4')]();var fs_extra=require(_0x96bc('0x5'));var auth=require(_0x96bc('0x6'));var interaction=require(_0x96bc('0x7'));var config=require(_0x96bc('0x8'));var controller=require(_0x96bc('0x9'));router['get']('/',auth[_0x96bc('0xa')](),controller['index']);router['get'](_0x96bc('0xb'),auth['isAuthenticated'](),controller[_0x96bc('0xc')]);router[_0x96bc('0xd')](_0x96bc('0xe'),auth['isAuthenticated'](),controller[_0x96bc('0xf')]);router[_0x96bc('0xd')]('/:id/download',auth[_0x96bc('0xa')](),controller[_0x96bc('0x10')]);router[_0x96bc('0x11')]('/',auth[_0x96bc('0xa')](),interaction[_0x96bc('0x12')](_0x96bc('0x13'),_0x96bc('0x14')),controller[_0x96bc('0x15')]);router[_0x96bc('0x16')]('/:id',auth[_0x96bc('0xa')](),controller['update']);router[_0x96bc('0x16')](_0x96bc('0x17'),auth[_0x96bc('0xa')](),controller['accept']);router[_0x96bc('0x16')]('/:id/reject',auth[_0x96bc('0xa')](),controller[_0x96bc('0x18')]);router['delete']('/:id',auth[_0x96bc('0xa')](),controller[_0x96bc('0x19')]);module[_0x96bc('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 3073564..6d1f425 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 _0x0e95=['DATE','Chat','Email','sequelize','lodash','exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING','INTEGER'];(function(_0x24e2c4,_0x3bf6a8){var _0x56986a=function(_0x55f56b){while(--_0x55f56b){_0x24e2c4['push'](_0x24e2c4['shift']());}};_0x56986a(++_0x3bf6a8);}(_0x0e95,0xb9));var _0x50e9=function(_0x2a9649,_0x5b0063){_0x2a9649=_0x2a9649-0x0;var _0x4ad162=_0x0e95[_0x2a9649];return _0x4ad162;};'use strict';var Sequelize=require(_0x50e9('0x0'));var _=require(_0x50e9('0x1'));module[_0x50e9('0x2')]={'body':{'type':Sequelize[_0x50e9('0x3')](_0x50e9('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x50e9('0x3')](_0x50e9('0x5'))},'read':{'type':Sequelize[_0x50e9('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0x50e9('0x7')]('in',_0x50e9('0x8')),'defaultValue':_0x50e9('0x8'),'allowNull':![]},'messageId':{'type':Sequelize[_0x50e9('0x9')](0x1fe)},'from':{'type':Sequelize[_0x50e9('0x9')]},'to':{'type':Sequelize['TEXT'](_0x50e9('0x4'))},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize[_0x50e9('0x3')](_0x50e9('0x4'))},'subject':{'type':Sequelize[_0x50e9('0x3')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x50e9('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x50e9('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x50e9('0xb')]},'originTo':{'type':Sequelize[_0x50e9('0x3')](_0x50e9('0x4'))},'originCc':{'type':Sequelize[_0x50e9('0x3')]('long')},'originChannel':{'type':Sequelize[_0x50e9('0x7')]('Email',_0x50e9('0xc')),'defaultValue':_0x50e9('0xd'),'allowNull':![]}}; \ No newline at end of file +var _0x490b=['long','medium','BOOLEAN','ENUM','out','STRING','DATE','Email','sequelize','exports','TEXT'];(function(_0x5a3296,_0x5333b0){var _0xf9b749=function(_0x2bb6e6){while(--_0x2bb6e6){_0x5a3296['push'](_0x5a3296['shift']());}};_0xf9b749(++_0x5333b0);}(_0x490b,0x13c));var _0xb490=function(_0x2e2681,_0x4089c1){_0x2e2681=_0x2e2681-0x0;var _0x368a64=_0x490b[_0x2e2681];return _0x368a64;};'use strict';var Sequelize=require(_0xb490('0x0'));var _=require('lodash');module[_0xb490('0x1')]={'body':{'type':Sequelize[_0xb490('0x2')](_0xb490('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xb490('0x2')](_0xb490('0x4'))},'read':{'type':Sequelize[_0xb490('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb490('0x6')]('in',_0xb490('0x7')),'defaultValue':_0xb490('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0xb490('0x8')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xb490('0x2')]('long')},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize['TEXT'](_0xb490('0x3'))},'subject':{'type':Sequelize[_0xb490('0x2')]},'sentAt':{'type':Sequelize[_0xb490('0x9')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xb490('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xb490('0x9')]},'originTo':{'type':Sequelize['TEXT'](_0xb490('0x3'))},'originCc':{'type':Sequelize['TEXT'](_0xb490('0x3'))},'originChannel':{'type':Sequelize[_0xb490('0x6')](_0xb490('0xa'),'Chat'),'defaultValue':_0xb490('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 7c4c7f4..c204e3d 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 _0x4cd9=['request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','message','info','catch','status','json','offset','undefined','count','limit','update','destroy','end','name','send','index','MailMessage','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','show','params','find','body','describe','create','direction','out','secret','split','findOne','MailAccountId','List','CmContact','Contacts','DESC','Smtp','isNil','service','host','port','auth','user','attachments','join','root','server/files/attachments','basename','ListId','List\x20not\x20found','format','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','mail','readAt','UserId','agent','get','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','internal','interface','SIP/%s','channel','event','fromString','EventManager','acceptmessage','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','email','reject','rejectmessage','toString','server','files','message-%s.eml','from','bcc','Attachments','subject','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','push','readFileSync','build','writeFileSync','download','moment','bluebird','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','redis','defaults','localhost','./mailMessage.socket','jayson/promise','client','http'];(function(_0x24e23d,_0x26684a){var _0x14db43=function(_0x23ff5a){while(--_0x23ff5a){_0x24e23d['push'](_0x24e23d['shift']());}};_0x14db43(++_0x26684a);}(_0x4cd9,0x84));var _0x94cd=function(_0x248c76,_0x326ee2){_0x248c76=_0x248c76-0x0;var _0x4f1a01=_0x4cd9[_0x248c76];return _0x4f1a01;};'use strict';var emlformat=require('eml-format');var moment=require(_0x94cd('0x0'));var BPromise=require(_0x94cd('0x1'));var util=require(_0x94cd('0x2'));var path=require(_0x94cd('0x3'));var fs=require('fs');var _=require(_0x94cd('0x4'));var Redis=require(_0x94cd('0x5'));var htmlToText=require(_0x94cd('0x6'));var qs=require(_0x94cd('0x7'));var logger=require(_0x94cd('0x8'))(_0x94cd('0x9'));var interaction_log=require(_0x94cd('0x8'))(_0x94cd('0xa'));var config=require(_0x94cd('0xb'));var db=require('../../mysqldb')['db'];config[_0x94cd('0xc')]=_[_0x94cd('0xd')](config[_0x94cd('0xc')],{'host':_0x94cd('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x94cd('0xc')]));var htmlEntities=require('html-entities');require(_0x94cd('0xf'))['register'](socket);var jayson=require(_0x94cd('0x10'));var client=jayson[_0x94cd('0x11')][_0x94cd('0x12')]({'port':0x232c});var client9003=jayson[_0x94cd('0x11')][_0x94cd('0x12')]({'port':0x232b});var client9002=jayson['client'][_0x94cd('0x12')]({'port':0x232a});function respondWithRpcPromise(_0xbe4ae9,_0x44e1e0,_0x54adf3,_0x2d6abc){return new BPromise(function(_0x403f14,_0x83c407){var _0x286cb5=_0x2d6abc||client;return _0x286cb5[_0x94cd('0x13')](_0xbe4ae9,_0x54adf3)[_0x94cd('0x14')](function(_0x26cdf8){logger['info'](_0x94cd('0x15'),_0x44e1e0,_0x94cd('0x16'));logger[_0x94cd('0x17')](_0x94cd('0x18'),_0x44e1e0,_0x94cd('0x16'),JSON['stringify'](_0x26cdf8));if(_0x26cdf8[_0x94cd('0x19')]){if(_0x26cdf8[_0x94cd('0x19')]['code']===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x44e1e0,_0x26cdf8[_0x94cd('0x19')]['message']);return _0x83c407(_0x26cdf8['error'][_0x94cd('0x1a')]);}logger[_0x94cd('0x19')](_0x94cd('0x15'),_0x44e1e0,_0x26cdf8[_0x94cd('0x19')][_0x94cd('0x1a')]);return _0x403f14(_0x26cdf8['error'][_0x94cd('0x1a')]);}else{logger[_0x94cd('0x1b')](_0x94cd('0x15'),_0x44e1e0,_0x94cd('0x16'));_0x403f14(_0x26cdf8['result'][_0x94cd('0x1a')]);}})[_0x94cd('0x1c')](function(_0x508d70){logger[_0x94cd('0x19')](_0x94cd('0x15'),_0x44e1e0,_0x508d70);_0x83c407(_0x508d70);});});}function respondWithResult(_0x5b6bf4,_0x573e28){_0x573e28=_0x573e28||0xc8;return function(_0x8bf488){if(_0x8bf488){return _0x5b6bf4[_0x94cd('0x1d')](_0x573e28)[_0x94cd('0x1e')](_0x8bf488);}};}function respondWithFilteredResult(_0x290772,_0x5d17aa){return function(_0x21ed7a){if(_0x21ed7a){var _0x3a76b6=typeof _0x5d17aa[_0x94cd('0x1f')]===_0x94cd('0x20')&&typeof _0x5d17aa['limit']===_0x94cd('0x20');var _0x2f53ef=_0x21ed7a[_0x94cd('0x21')];var _0x569430=_0x3a76b6?0x0:_0x5d17aa[_0x94cd('0x1f')];var _0x1b0f47=_0x3a76b6?_0x21ed7a['count']:_0x5d17aa[_0x94cd('0x1f')]+_0x5d17aa[_0x94cd('0x22')];var _0x14da05;if(_0x1b0f47>=_0x2f53ef){_0x1b0f47=_0x2f53ef;_0x14da05=0xc8;}else{_0x14da05=0xce;}_0x290772[_0x94cd('0x1d')](_0x14da05);return _0x290772['set']('Content-Range',_0x569430+'-'+_0x1b0f47+'/'+_0x2f53ef)[_0x94cd('0x1e')](_0x21ed7a);}return null;};}function saveUpdates(_0x142975){return function(_0x2f43f4){if(_0x2f43f4){return _0x2f43f4[_0x94cd('0x23')](_0x142975)[_0x94cd('0x14')](function(_0x488789){return _0x488789;});}return null;};}function removeEntity(_0x59737b){return function(_0x3f21e4){if(_0x3f21e4){return _0x3f21e4[_0x94cd('0x24')]()[_0x94cd('0x14')](function(){_0x59737b[_0x94cd('0x1d')](0xcc)[_0x94cd('0x25')]();});}};}function handleEntityNotFound(_0x46c48c){return function(_0x92f964){if(!_0x92f964){_0x46c48c['sendStatus'](0x194);}return _0x92f964;};}function handleError(_0x2ddc82,_0x15751c){_0x15751c=_0x15751c||0x1f4;return function(_0x3ab5eb){logger[_0x94cd('0x19')](_0x3ab5eb['stack']);if(_0x3ab5eb[_0x94cd('0x26')]){delete _0x3ab5eb[_0x94cd('0x26')];}_0x2ddc82['status'](_0x15751c)[_0x94cd('0x27')](_0x3ab5eb);};}exports[_0x94cd('0x28')]=function(_0x314a8a,_0x5e254c){var _0x19599d={},_0x27af09={},_0x291c40={'count':0x0,'rows':[]};var _0x14f56a=_['map'](db[_0x94cd('0x29')][_0x94cd('0x2a')],function(_0x10cbc3){return{'name':_0x10cbc3[_0x94cd('0x2b')],'type':_0x10cbc3[_0x94cd('0x2c')][_0x94cd('0x2d')]};});_0x27af09['model']=_[_0x94cd('0x2e')](_0x14f56a,'name');_0x27af09[_0x94cd('0x2f')]=_[_0x94cd('0x30')](_0x314a8a[_0x94cd('0x2f')]);_0x27af09['filters']=_[_0x94cd('0x31')](_0x27af09['model'],_0x27af09[_0x94cd('0x2f')]);_0x19599d['attributes']=_[_0x94cd('0x31')](_0x27af09[_0x94cd('0x32')],qs[_0x94cd('0x33')](_0x314a8a['query']['fields']));_0x19599d['attributes']=_0x19599d[_0x94cd('0x34')][_0x94cd('0x35')]?_0x19599d[_0x94cd('0x34')]:_0x27af09[_0x94cd('0x32')];if(!_0x314a8a[_0x94cd('0x2f')]['hasOwnProperty'](_0x94cd('0x36'))){_0x19599d[_0x94cd('0x22')]=qs['limit'](_0x314a8a['query'][_0x94cd('0x22')]);_0x19599d[_0x94cd('0x1f')]=qs[_0x94cd('0x1f')](_0x314a8a[_0x94cd('0x2f')][_0x94cd('0x1f')]);}_0x19599d[_0x94cd('0x37')]=qs[_0x94cd('0x38')](_0x314a8a[_0x94cd('0x2f')]['sort']);_0x19599d[_0x94cd('0x39')]=qs[_0x94cd('0x3a')](_[_0x94cd('0x3b')](_0x314a8a[_0x94cd('0x2f')],_0x27af09['filters']),_0x14f56a);if(_0x314a8a['query'][_0x94cd('0x3c')]){_0x19599d['where']=_[_0x94cd('0x3d')](_0x19599d['where'],{'$or':_['map'](_0x14f56a,function(_0x590a84){if(_0x590a84[_0x94cd('0x2c')]!=='VIRTUAL'){var _0x5ab537={};_0x5ab537[_0x590a84['name']]={'$like':'%'+_0x314a8a[_0x94cd('0x2f')][_0x94cd('0x3c')]+'%'};return _0x5ab537;}})});}_0x19599d=_[_0x94cd('0x3d')]({},_0x19599d,_0x314a8a[_0x94cd('0x3e')]);var _0x1e611c={'where':_0x19599d[_0x94cd('0x39')]};return db[_0x94cd('0x29')][_0x94cd('0x21')](_0x1e611c)[_0x94cd('0x14')](function(_0x2e4ead){_0x291c40[_0x94cd('0x21')]=_0x2e4ead;if(_0x314a8a['query'][_0x94cd('0x3f')]){_0x19599d[_0x94cd('0x40')]=[{'all':!![]}];}return db[_0x94cd('0x29')][_0x94cd('0x41')](_0x19599d);})[_0x94cd('0x14')](function(_0x52cd43){_0x291c40['rows']=_0x52cd43;return _0x291c40;})[_0x94cd('0x14')](respondWithFilteredResult(_0x5e254c,_0x19599d))[_0x94cd('0x1c')](handleError(_0x5e254c,null));};exports[_0x94cd('0x42')]=function(_0x4097f1,_0x207d37){var _0x26babd={'raw':!![],'where':{'id':_0x4097f1[_0x94cd('0x43')]['id']}},_0x2b8b41={};_0x2b8b41[_0x94cd('0x32')]=_['keys'](db[_0x94cd('0x29')]['rawAttributes']);_0x2b8b41['query']=_[_0x94cd('0x30')](_0x4097f1[_0x94cd('0x2f')]);_0x2b8b41[_0x94cd('0x3a')]=_[_0x94cd('0x31')](_0x2b8b41['model'],_0x2b8b41['query']);_0x26babd[_0x94cd('0x34')]=_[_0x94cd('0x31')](_0x2b8b41[_0x94cd('0x32')],qs[_0x94cd('0x33')](_0x4097f1['query'][_0x94cd('0x33')]));_0x26babd['attributes']=_0x26babd['attributes'][_0x94cd('0x35')]?_0x26babd[_0x94cd('0x34')]:_0x2b8b41[_0x94cd('0x32')];if(_0x4097f1[_0x94cd('0x2f')][_0x94cd('0x3f')]){_0x26babd[_0x94cd('0x40')]=[{'all':!![]}];}_0x26babd=_['merge']({},_0x26babd,_0x4097f1[_0x94cd('0x3e')]);return db[_0x94cd('0x29')][_0x94cd('0x44')](_0x26babd)[_0x94cd('0x14')](handleEntityNotFound(_0x207d37,null))[_0x94cd('0x14')](respondWithResult(_0x207d37,null))['catch'](handleError(_0x207d37,null));};exports[_0x94cd('0x23')]=function(_0x2213e9,_0x56a219){if(_0x2213e9['body']['id']){delete _0x2213e9[_0x94cd('0x45')]['id'];}return db[_0x94cd('0x29')][_0x94cd('0x44')]({'where':{'id':_0x2213e9[_0x94cd('0x43')]['id']}})['then'](handleEntityNotFound(_0x56a219,null))['then'](saveUpdates(_0x2213e9[_0x94cd('0x45')],null))[_0x94cd('0x14')](respondWithResult(_0x56a219,null))[_0x94cd('0x1c')](handleError(_0x56a219,null));};exports[_0x94cd('0x24')]=function(_0x42107d,_0x1fa09e){return db['MailMessage']['find']({'where':{'id':_0x42107d[_0x94cd('0x43')]['id']}})[_0x94cd('0x14')](handleEntityNotFound(_0x1fa09e,null))[_0x94cd('0x14')](removeEntity(_0x1fa09e,null))[_0x94cd('0x1c')](handleError(_0x1fa09e,null));};exports['describe']=function(_0x23cbb7,_0x1aaf92){return db[_0x94cd('0x29')][_0x94cd('0x46')]()['then'](respondWithResult(_0x1aaf92,null))[_0x94cd('0x1c')](handleError(_0x1aaf92,null));};exports[_0x94cd('0x47')]=function(_0x13db94,_0x3fcfac){return db['MailMessage'][_0x94cd('0x47')](_0x13db94[_0x94cd('0x45')])[_0x94cd('0x14')](function(_0x4f4c44){if(_0x4f4c44){if(_0x4f4c44[_0x94cd('0x48')]===_0x94cd('0x49')&&!_0x4f4c44[_0x94cd('0x4a')]){var _0x542f8f,_0x41fc21,_0x201afd;if(_0x13db94[_0x94cd('0x45')]['to']){_0x41fc21=_0x13db94['body']['to'][_0x94cd('0x4b')](',')[0x0];}return db['MailAccount'][_0x94cd('0x4c')]({'where':{'id':_0x4f4c44[_0x94cd('0x4d')]},'include':[{'model':db['CmList'],'as':_0x94cd('0x4e'),'include':[{'model':db[_0x94cd('0x4f')],'as':_0x94cd('0x50'),'where':{'email':_0x41fc21},'limit':0x1,'order':[['updatedAt',_0x94cd('0x51')]]}]},{'model':db['MailServerOut'],'as':_0x94cd('0x52'),'raw':!![]}]})[_0x94cd('0x14')](function(_0x5d2f7d){_0x542f8f=_0x5d2f7d;if(_0x542f8f&&_0x542f8f['Smtp']){var _0x55213a={'tls':{'rejectUnauthorized':![]}};if(_[_0x94cd('0x53')](_0x542f8f[_0x94cd('0x52')][_0x94cd('0x54')])){_0x55213a[_0x94cd('0x55')]=_0x542f8f[_0x94cd('0x52')][_0x94cd('0x55')];_0x55213a[_0x94cd('0x56')]=_0x542f8f[_0x94cd('0x52')][_0x94cd('0x56')];_0x55213a['secure']=_0x542f8f[_0x94cd('0x52')]['secure'];if(_0x542f8f[_0x94cd('0x52')]['authentication']){_0x55213a[_0x94cd('0x57')]={'user':_0x542f8f[_0x94cd('0x52')]['user'],'pass':_0x542f8f[_0x94cd('0x52')]['pass']};}}else{_0x55213a[_0x94cd('0x54')]=_0x542f8f[_0x94cd('0x52')][_0x94cd('0x54')];_0x55213a[_0x94cd('0x57')]={'user':_0x542f8f[_0x94cd('0x52')][_0x94cd('0x58')],'pass':_0x542f8f['Smtp']['pass']};_0x55213a['secure']=_0x542f8f[_0x94cd('0x52')]['secure'];}if(_0x13db94[_0x94cd('0x45')][_0x94cd('0x59')]&&_0x13db94[_0x94cd('0x45')][_0x94cd('0x59')]['length']){for(var _0x21533a=0x0;_0x21533a<_0x13db94['body']['attachments'][_0x94cd('0x35')];_0x21533a+=0x1){_0x13db94[_0x94cd('0x45')][_0x94cd('0x59')][_0x21533a]={'filename':_0x13db94[_0x94cd('0x45')][_0x94cd('0x59')][_0x21533a][_0x94cd('0x26')],'path':path[_0x94cd('0x5a')](config[_0x94cd('0x5b')],_0x94cd('0x5c'),_0x13db94[_0x94cd('0x45')]['attachments'][_0x21533a][_0x94cd('0x5d')])};}}_0x201afd={'account':_0x55213a,'message':_0x13db94[_0x94cd('0x45')]};return;}})[_0x94cd('0x14')](function(){if(_0x542f8f[_0x94cd('0x4e')]){if(_0x542f8f[_0x94cd('0x4e')]['Contacts'][_0x94cd('0x35')]){return _0x542f8f['List'][_0x94cd('0x50')][0x0];}else{return db[_0x94cd('0x4f')][_0x94cd('0x47')](_[_0x94cd('0xd')](_0x13db94[_0x94cd('0x45')],{'firstName':_0x13db94[_0x94cd('0x45')]['to'],'email':_0x13db94['body']['to'],'phone':_0x13db94['body']['to'],'ListId':_0x542f8f[_0x94cd('0x5e')]}));}}else{throw new Error(_0x94cd('0x5f'));}})[_0x94cd('0x14')](function(){if(_0x201afd){return respondWithRpcPromise('SendMail','sendMail',_0x201afd,client9003)[_0x94cd('0x14')](function(_0x2a2889){return _0x4f4c44['update']({'read':!![],'messageId':_0x2a2889['messageId'],'sentAt':moment()[_0x94cd('0x60')](_0x94cd('0x61'))});})[_0x94cd('0x1c')](function(_0xea5db8){logger[_0x94cd('0x19')]('%s',JSON[_0x94cd('0x62')](_0xea5db8));return _0x4f4c44;});}return _0x4f4c44;});}return _0x4f4c44;}})[_0x94cd('0x14')](respondWithResult(_0x3fcfac,0xc9))[_0x94cd('0x1c')](handleError(_0x3fcfac,null));};exports[_0x94cd('0x63')]=function(_0x400158,_0x42e9b7){var _0x5e8346={'agent':{},'channel':_0x94cd('0x64')};if(_0x400158[_0x94cd('0x45')]['id']){delete _0x400158['body']['id'];}_0x400158[_0x94cd('0x45')]['read']=!![];_0x400158[_0x94cd('0x45')][_0x94cd('0x65')]=moment()[_0x94cd('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x400158[_0x94cd('0x45')]['UserId']=_0x400158['body'][_0x94cd('0x66')]||_0x400158[_0x94cd('0x58')]['id'];_0x5e8346[_0x94cd('0x67')]['id']=_0x400158[_0x94cd('0x45')]['UserId'];return db[_0x94cd('0x29')]['find']({'where':{'id':_0x400158[_0x94cd('0x43')]['id'],'UserId':null}})[_0x94cd('0x14')](handleEntityNotFound(_0x42e9b7,null))[_0x94cd('0x14')](saveUpdates(_0x400158['body'],null))[_0x94cd('0x14')](function(_0x2316ae){if(_0x2316ae){_0x5e8346['message']=_0x2316ae[_0x94cd('0x68')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x2316ae[_0x94cd('0x69')]}});}return null;})[_0x94cd('0x14')](handleEntityNotFound(_0x42e9b7,null))[_0x94cd('0x14')](function(_0x403292){if(_0x403292){return _0x403292[_0x94cd('0x23')]({'UserId':_0x400158[_0x94cd('0x45')][_0x94cd('0x66')],'read1stAt':_[_0x94cd('0x53')](_0x403292[_0x94cd('0x6a')])?moment()[_0x94cd('0x60')](_0x94cd('0x61')):undefined});}return null;})[_0x94cd('0x14')](function(_0x3a074){if(_0x3a074){_0x5e8346[_0x94cd('0x6b')]=_0x3a074[_0x94cd('0x68')]({'plain':!![]});interaction_log[_0x94cd('0x1b')](_0x94cd('0x6c'),_0x400158['user']['id'],_0x400158[_0x94cd('0x58')][_0x94cd('0x26')],_0x400158[_0x94cd('0x58')][_0x94cd('0x6d')],_0x5e8346[_0x94cd('0x6b')]['id'],_0x400158[_0x94cd('0x45')]?JSON[_0x94cd('0x62')](_0x400158[_0x94cd('0x45')]):_0x94cd('0x6e'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x5e8346);}return null;})['then'](function(_0x65abdc){var _0x2d7a01=_0x94cd('0x6f')+_0x65abdc[_0x94cd('0x1a')][_0x94cd('0x70')];return db[_0x94cd('0x71')]['query'](_0x2d7a01,{'type':db[_0x94cd('0x72')][_0x94cd('0x73')][_0x94cd('0x74')],'raw':!![]})[_0x94cd('0x14')](function(_0x544f0c){return _0x544f0c;});})[_0x94cd('0x14')](function(_0x2ac39c){if(_0x2ac39c){_0x5e8346[_0x94cd('0x1a')]['contact']=_0x2ac39c[0x0];if(!_0x400158[_0x94cd('0x45')][_0x94cd('0x66')])return;return db[_0x94cd('0x75')]['find']({'where':{'id':_0x400158[_0x94cd('0x45')][_0x94cd('0x66')],'role':_0x94cd('0x67')},'attributes':['id','name',_0x94cd('0x76'),'email',_0x94cd('0x77')],'raw':!![]});}return null;})[_0x94cd('0x14')](function(_0x5ea2a9){if(!_0x5ea2a9)return null;_0x5e8346[_0x94cd('0x1a')][_0x94cd('0x67')]=_0x5ea2a9;return _0x5e8346;})[_0x94cd('0x14')](function(_0x1e453c){if(_0x1e453c){if(_0x400158[_0x94cd('0x45')]['manual']){_0x5e8346[_0x94cd('0x1a')][_0x94cd('0x78')]=util['format'](_0x94cd('0x79'),_0x400158[_0x94cd('0x58')][_0x94cd('0x26')]);_0x5e8346[_0x94cd('0x1a')][_0x94cd('0x7a')]=_0x5e8346[_0x94cd('0x7a')];_0x5e8346[_0x94cd('0x1a')]['motionChannel']=_0x5e8346[_0x94cd('0x7a')];_0x5e8346['message'][_0x94cd('0x7b')]=_0x94cd('0x63');_0x5e8346[_0x94cd('0x1a')][_0x94cd('0x45')]=htmlToText[_0x94cd('0x7c')](_0x5e8346[_0x94cd('0x1a')][_0x94cd('0x45')]);return respondWithRpcPromise('EventManager',_0x94cd('0x7d'),{'event':_0x94cd('0x7e'),'message':_0x5e8346['message']},client9002)[_0x94cd('0x14')](function(){return _0x5e8346;});}return _0x5e8346;}return null;})[_0x94cd('0x14')](respondWithResult(_0x42e9b7,null))[_0x94cd('0x1c')](handleError(_0x42e9b7,null));};exports['reject']=function(_0x1b8b4f,_0x3f9a0c){var _0x3fef63={'agent':{},'channel':'mail'};if(_0x1b8b4f['body']['id']){delete _0x1b8b4f[_0x94cd('0x45')]['id'];}_0x1b8b4f[_0x94cd('0x45')][_0x94cd('0x66')]=_0x1b8b4f[_0x94cd('0x45')][_0x94cd('0x66')]||_0x1b8b4f['user']['id'];_0x3fef63['agent']['id']=_0x1b8b4f[_0x94cd('0x45')][_0x94cd('0x66')];return db[_0x94cd('0x29')][_0x94cd('0x44')]({'where':{'id':_0x1b8b4f[_0x94cd('0x43')]['id'],'UserId':null}})[_0x94cd('0x14')](handleEntityNotFound(_0x3f9a0c,null))[_0x94cd('0x14')](function(_0x597030){if(_0x597030){_0x3fef63[_0x94cd('0x1a')]=_0x597030[_0x94cd('0x68')]({'plain':!![]});return db[_0x94cd('0x7f')]['find']({'where':{'id':_0x597030[_0x94cd('0x69')]}});}return null;})[_0x94cd('0x14')](handleEntityNotFound(_0x3f9a0c,null))[_0x94cd('0x14')](function(_0x42908e){if(_0x42908e){_0x3fef63[_0x94cd('0x6b')]=_0x42908e[_0x94cd('0x68')]({'plain':!![]});interaction_log[_0x94cd('0x1b')](_0x94cd('0x80'),_0x1b8b4f[_0x94cd('0x58')]['id'],_0x1b8b4f['user'][_0x94cd('0x26')],_0x1b8b4f[_0x94cd('0x58')][_0x94cd('0x6d')],_0x3fef63[_0x94cd('0x6b')]['id'],_0x1b8b4f[_0x94cd('0x45')]?JSON[_0x94cd('0x62')](_0x1b8b4f[_0x94cd('0x45')]):'null');return respondWithRpcPromise(_0x94cd('0x81'),_0x94cd('0x82'),_0x3fef63);}return null;})[_0x94cd('0x14')](function(_0x510008){var _0x384187='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x510008[_0x94cd('0x1a')]['ContactId'];return db['sequelize'][_0x94cd('0x2f')](_0x384187,{'type':db[_0x94cd('0x72')][_0x94cd('0x73')][_0x94cd('0x74')],'raw':!![]})[_0x94cd('0x14')](function(_0x569b2e){return _0x569b2e;});})['then'](function(_0x5a3a8b){if(_0x5a3a8b){_0x3fef63['message']['contact']=_0x5a3a8b[0x0];if(!_0x1b8b4f['body'][_0x94cd('0x66')])return;return db[_0x94cd('0x75')][_0x94cd('0x44')]({'where':{'id':_0x1b8b4f[_0x94cd('0x45')][_0x94cd('0x66')],'role':_0x94cd('0x67')},'attributes':['id',_0x94cd('0x26'),_0x94cd('0x76'),_0x94cd('0x83'),'internal'],'raw':!![]});}return null;})['then'](function(_0x3e3810){if(!_0x3e3810)return null;_0x3fef63[_0x94cd('0x1a')][_0x94cd('0x67')]=_0x3e3810;return _0x3fef63;})[_0x94cd('0x14')](function(_0x16333a){if(_0x16333a){_0x16333a[_0x94cd('0x1a')][_0x94cd('0x78')]=util['format']('SIP/%s',_0x1b8b4f['user']['name']);_0x16333a[_0x94cd('0x1a')]['channel']=_0x3fef63[_0x94cd('0x7a')];_0x16333a['message']['motionChannel']=_0x3fef63[_0x94cd('0x7a')];_0x16333a[_0x94cd('0x1a')][_0x94cd('0x7b')]=_0x94cd('0x84');_0x16333a[_0x94cd('0x1a')][_0x94cd('0x45')]=htmlToText['fromString'](_0x3fef63[_0x94cd('0x1a')][_0x94cd('0x45')]);respondWithRpcPromise(_0x94cd('0x7d'),'EventManager',{'event':_0x94cd('0x85'),'message':_0x16333a[_0x94cd('0x1a')]},client9002);return _0x3fef63;}return null;})[_0x94cd('0x14')](respondWithResult(_0x3f9a0c,null))[_0x94cd('0x1c')](handleError(_0x3f9a0c,null));};exports['download']=function(_0x4e69f9,_0x436fbc){var _0xe1cc91=moment()['unix']()[_0x94cd('0x86')]();var _0x227541=path[_0x94cd('0x5a')](config['root'],_0x94cd('0x87'),'files','tmp');var _0x23f1db=path[_0x94cd('0x5a')](config['root'],_0x94cd('0x87'),_0x94cd('0x88'),_0x94cd('0x59'));var _0x302f81=util['format'](_0x94cd('0x89'),_0xe1cc91);return db['MailMessage'][_0x94cd('0x44')]({'where':{'id':_0x4e69f9[_0x94cd('0x43')]['id']},'attributes':['id',_0x94cd('0x45'),_0x94cd('0x8a'),'to','cc',_0x94cd('0x8b'),'subject','createdAt'],'include':_0x4e69f9[_0x94cd('0x2f')][_0x94cd('0x59')]?[{'model':db['Attachment'],'as':_0x94cd('0x8c')}]:undefined})['then'](handleEntityNotFound(_0x436fbc,null))[_0x94cd('0x14')](function(_0x2c7cee){if(_0x2c7cee){var _0x4c5edb=_0x2c7cee;var _0x5a88b3={'from':_0x4c5edb['from'],'to':_0x4c5edb['to'],'subject':_0x4c5edb[_0x94cd('0x8d')],'html':htmlEntities[_0x94cd('0x8e')](_0x4c5edb[_0x94cd('0x45')]),'headers':{'Date':moment(_0x4c5edb[_0x94cd('0x8f')])[_0x94cd('0x60')](_0x94cd('0x90'))},'attachments':[]};if(_0x2c7cee['cc']){_0x5a88b3[_0x94cd('0x91')]['Cc']=_0x2c7cee['cc'];}if(_0x2c7cee[_0x94cd('0x8b')]){_0x5a88b3[_0x94cd('0x91')]['Bcc']=_0x2c7cee[_0x94cd('0x8b')];}return new BPromise(function(_0x203c6c,_0x4cfde9){if(_0x2c7cee[_0x94cd('0x8c')]){for(var _0x580008=0x0;_0x580008<_0x2c7cee['Attachments'][_0x94cd('0x35')];_0x580008++){var _0x54214c=_0x2c7cee[_0x94cd('0x8c')][_0x580008];var _0x57620a=path[_0x94cd('0x5a')](_0x23f1db,_0x54214c['basename']);if(fs['existsSync'](_0x57620a)){_0x5a88b3[_0x94cd('0x59')][_0x94cd('0x92')]({'name':_0x54214c[_0x94cd('0x26')],'contentType':_0x54214c[_0x94cd('0x2c')],'data':fs[_0x94cd('0x93')](_0x57620a)});}}}emlformat[_0x94cd('0x94')](_0x5a88b3,function(_0x102f7f,_0x442afa){if(_0x102f7f)return _0x4cfde9(_0x102f7f);fs[_0x94cd('0x95')](path[_0x94cd('0x5a')](_0x227541,_0x302f81),_0x442afa);return _0x203c6c(_0x442afa);});});}})[_0x94cd('0x14')](function(_0x4dbac1){if(_0x4dbac1){return _0x436fbc[_0x94cd('0x96')](path[_0x94cd('0x5a')](_0x227541,_0x302f81),_0x302f81,function(_0x56b168){if(!_0x56b168)fs['unlinkSync'](path['join'](_0x227541,_0x302f81));});}})[_0x94cd('0x1c')](handleError(_0x436fbc,null));}; \ No newline at end of file +var _0x35b0=['redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','http','client','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','json','offset','limit','undefined','count','set','Content-Range','update','status','end','sendStatus','name','index','map','MailMessage','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','keys','includeAll','find','body','params','destroy','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','CmContact','Contacts','updatedAt','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','root','server/files/attachments','List','ListId','List\x20not\x20found','SendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','accept','mail','readAt','format','UserId','agent','get','MailInteraction','MailInteractionId','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','sequelize','SELECT','contact','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','fromString','EventManager','acceptmessage','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','User','email','event','reject','download','unix','toString','files','tmp','join','server','message-%s.eml','from','bcc','createdAt','Attachments','subject','headers','basename','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','bluebird','util','lodash','html-to-text','../../components/parsers/qs','../../config/logger','../../mysqldb'];(function(_0x34f701,_0x37e407){var _0x3e2429=function(_0x20c0c3){while(--_0x20c0c3){_0x34f701['push'](_0x34f701['shift']());}};_0x3e2429(++_0x37e407);}(_0x35b0,0x9d));var _0x035b=function(_0x5d8008,_0x23e45b){_0x5d8008=_0x5d8008-0x0;var _0x583783=_0x35b0[_0x5d8008];return _0x583783;};'use strict';var emlformat=require('eml-format');var moment=require('moment');var BPromise=require(_0x035b('0x0'));var util=require(_0x035b('0x1'));var path=require('path');var fs=require('fs');var _=require(_0x035b('0x2'));var Redis=require('ioredis');var htmlToText=require(_0x035b('0x3'));var qs=require(_0x035b('0x4'));var logger=require(_0x035b('0x5'))('api');var interaction_log=require(_0x035b('0x5'))('mail-interactions');var config=require('../../config/environment');var db=require(_0x035b('0x6'))['db'];config[_0x035b('0x7')]=_[_0x035b('0x8')](config['redis'],{'host':_0x035b('0x9'),'port':0x18eb});var socket=require(_0x035b('0xa'))(new Redis(config[_0x035b('0x7')]));var htmlEntities=require(_0x035b('0xb'));require(_0x035b('0xc'))[_0x035b('0xd')](socket);var jayson=require(_0x035b('0xe'));var client=jayson['client'][_0x035b('0xf')]({'port':0x232c});var client9003=jayson[_0x035b('0x10')][_0x035b('0xf')]({'port':0x232b});var client9002=jayson[_0x035b('0x10')][_0x035b('0xf')]({'port':0x232a});function respondWithRpcPromise(_0xa577d0,_0x3071df,_0x57d1c0,_0x4dd646){return new BPromise(function(_0x28cf16,_0x3d83be){var _0x320ee9=_0x4dd646||client;return _0x320ee9[_0x035b('0x11')](_0xa577d0,_0x57d1c0)[_0x035b('0x12')](function(_0x4b08b3){logger[_0x035b('0x13')](_0x035b('0x14'),_0x3071df,_0x035b('0x15'));logger[_0x035b('0x16')](_0x035b('0x17'),_0x3071df,'request\x20sent',JSON[_0x035b('0x18')](_0x4b08b3));if(_0x4b08b3['error']){if(_0x4b08b3['error'][_0x035b('0x19')]===0x1f4){logger['error'](_0x035b('0x14'),_0x3071df,_0x4b08b3[_0x035b('0x1a')]['message']);return _0x3d83be(_0x4b08b3[_0x035b('0x1a')][_0x035b('0x1b')]);}logger[_0x035b('0x1a')](_0x035b('0x14'),_0x3071df,_0x4b08b3[_0x035b('0x1a')][_0x035b('0x1b')]);return _0x28cf16(_0x4b08b3[_0x035b('0x1a')][_0x035b('0x1b')]);}else{logger['info'](_0x035b('0x14'),_0x3071df,'request\x20sent');_0x28cf16(_0x4b08b3[_0x035b('0x1c')][_0x035b('0x1b')]);}})[_0x035b('0x1d')](function(_0x28377b){logger[_0x035b('0x1a')](_0x035b('0x14'),_0x3071df,_0x28377b);_0x3d83be(_0x28377b);});});}function respondWithResult(_0x316c31,_0x3cf12d){_0x3cf12d=_0x3cf12d||0xc8;return function(_0x50067a){if(_0x50067a){return _0x316c31['status'](_0x3cf12d)[_0x035b('0x1e')](_0x50067a);}};}function respondWithFilteredResult(_0x7845df,_0x3756fc){return function(_0x4b963c){if(_0x4b963c){var _0x419265=typeof _0x3756fc[_0x035b('0x1f')]==='undefined'&&typeof _0x3756fc[_0x035b('0x20')]===_0x035b('0x21');var _0x45fcdf=_0x4b963c[_0x035b('0x22')];var _0x3c70b4=_0x419265?0x0:_0x3756fc[_0x035b('0x1f')];var _0xb365ce=_0x419265?_0x4b963c[_0x035b('0x22')]:_0x3756fc['offset']+_0x3756fc[_0x035b('0x20')];var _0x42fedc;if(_0xb365ce>=_0x45fcdf){_0xb365ce=_0x45fcdf;_0x42fedc=0xc8;}else{_0x42fedc=0xce;}_0x7845df['status'](_0x42fedc);return _0x7845df[_0x035b('0x23')](_0x035b('0x24'),_0x3c70b4+'-'+_0xb365ce+'/'+_0x45fcdf)[_0x035b('0x1e')](_0x4b963c);}return null;};}function saveUpdates(_0x47cfcc){return function(_0x25360c){if(_0x25360c){return _0x25360c[_0x035b('0x25')](_0x47cfcc)[_0x035b('0x12')](function(_0x5f15bc){return _0x5f15bc;});}return null;};}function removeEntity(_0x36d877){return function(_0x277e19){if(_0x277e19){return _0x277e19['destroy']()[_0x035b('0x12')](function(){_0x36d877[_0x035b('0x26')](0xcc)[_0x035b('0x27')]();});}};}function handleEntityNotFound(_0x1b4fe7){return function(_0x2ef6df){if(!_0x2ef6df){_0x1b4fe7[_0x035b('0x28')](0x194);}return _0x2ef6df;};}function handleError(_0x35fec3,_0x2d3990){_0x2d3990=_0x2d3990||0x1f4;return function(_0x650213){logger[_0x035b('0x1a')](_0x650213['stack']);if(_0x650213[_0x035b('0x29')]){delete _0x650213[_0x035b('0x29')];}_0x35fec3[_0x035b('0x26')](_0x2d3990)['send'](_0x650213);};}exports[_0x035b('0x2a')]=function(_0x532750,_0x40a9a1){var _0x4b3461={},_0x74dc55={},_0x17465c={'count':0x0,'rows':[]};var _0x19ce75=_[_0x035b('0x2b')](db[_0x035b('0x2c')][_0x035b('0x2d')],function(_0x202dce){return{'name':_0x202dce['fieldName'],'type':_0x202dce[_0x035b('0x2e')]['key']};});_0x74dc55[_0x035b('0x2f')]=_[_0x035b('0x2b')](_0x19ce75,_0x035b('0x29'));_0x74dc55['query']=_['keys'](_0x532750[_0x035b('0x30')]);_0x74dc55[_0x035b('0x31')]=_[_0x035b('0x32')](_0x74dc55[_0x035b('0x2f')],_0x74dc55[_0x035b('0x30')]);_0x4b3461[_0x035b('0x33')]=_[_0x035b('0x32')](_0x74dc55[_0x035b('0x2f')],qs[_0x035b('0x34')](_0x532750[_0x035b('0x30')][_0x035b('0x34')]));_0x4b3461['attributes']=_0x4b3461[_0x035b('0x33')][_0x035b('0x35')]?_0x4b3461['attributes']:_0x74dc55[_0x035b('0x2f')];if(!_0x532750[_0x035b('0x30')][_0x035b('0x36')](_0x035b('0x37'))){_0x4b3461[_0x035b('0x20')]=qs['limit'](_0x532750[_0x035b('0x30')][_0x035b('0x20')]);_0x4b3461['offset']=qs['offset'](_0x532750['query'][_0x035b('0x1f')]);}_0x4b3461['order']=qs[_0x035b('0x38')](_0x532750[_0x035b('0x30')]['sort']);_0x4b3461['where']=qs[_0x035b('0x31')](_['pick'](_0x532750[_0x035b('0x30')],_0x74dc55[_0x035b('0x31')]),_0x19ce75);if(_0x532750[_0x035b('0x30')][_0x035b('0x39')]){_0x4b3461[_0x035b('0x3a')]=_[_0x035b('0x3b')](_0x4b3461[_0x035b('0x3a')],{'$or':_['map'](_0x19ce75,function(_0x100f8a){if(_0x100f8a[_0x035b('0x2e')]!==_0x035b('0x3c')){var _0x258f07={};_0x258f07[_0x100f8a[_0x035b('0x29')]]={'$like':'%'+_0x532750[_0x035b('0x30')][_0x035b('0x39')]+'%'};return _0x258f07;}})});}_0x4b3461=_[_0x035b('0x3b')]({},_0x4b3461,_0x532750[_0x035b('0x3d')]);var _0x4cfd6d={'where':_0x4b3461[_0x035b('0x3a')]};return db['MailMessage'][_0x035b('0x22')](_0x4cfd6d)[_0x035b('0x12')](function(_0x3f606e){_0x17465c['count']=_0x3f606e;if(_0x532750[_0x035b('0x30')]['includeAll']){_0x4b3461[_0x035b('0x3e')]=[{'all':!![]}];}return db[_0x035b('0x2c')][_0x035b('0x3f')](_0x4b3461);})[_0x035b('0x12')](function(_0x55c59c){_0x17465c[_0x035b('0x40')]=_0x55c59c;return _0x17465c;})[_0x035b('0x12')](respondWithFilteredResult(_0x40a9a1,_0x4b3461))[_0x035b('0x1d')](handleError(_0x40a9a1,null));};exports[_0x035b('0x41')]=function(_0x330d7c,_0x3600b0){var _0x5032fe={'raw':!![],'where':{'id':_0x330d7c['params']['id']}},_0x702f20={};_0x702f20[_0x035b('0x2f')]=_[_0x035b('0x42')](db[_0x035b('0x2c')][_0x035b('0x2d')]);_0x702f20['query']=_[_0x035b('0x42')](_0x330d7c[_0x035b('0x30')]);_0x702f20[_0x035b('0x31')]=_[_0x035b('0x32')](_0x702f20[_0x035b('0x2f')],_0x702f20[_0x035b('0x30')]);_0x5032fe['attributes']=_[_0x035b('0x32')](_0x702f20[_0x035b('0x2f')],qs[_0x035b('0x34')](_0x330d7c[_0x035b('0x30')][_0x035b('0x34')]));_0x5032fe[_0x035b('0x33')]=_0x5032fe[_0x035b('0x33')][_0x035b('0x35')]?_0x5032fe['attributes']:_0x702f20['model'];if(_0x330d7c[_0x035b('0x30')][_0x035b('0x43')]){_0x5032fe[_0x035b('0x3e')]=[{'all':!![]}];}_0x5032fe=_[_0x035b('0x3b')]({},_0x5032fe,_0x330d7c['options']);return db[_0x035b('0x2c')][_0x035b('0x44')](_0x5032fe)[_0x035b('0x12')](handleEntityNotFound(_0x3600b0,null))[_0x035b('0x12')](respondWithResult(_0x3600b0,null))[_0x035b('0x1d')](handleError(_0x3600b0,null));};exports['update']=function(_0x558593,_0x122570){if(_0x558593[_0x035b('0x45')]['id']){delete _0x558593['body']['id'];}return db[_0x035b('0x2c')][_0x035b('0x44')]({'where':{'id':_0x558593[_0x035b('0x46')]['id']}})[_0x035b('0x12')](handleEntityNotFound(_0x122570,null))[_0x035b('0x12')](saveUpdates(_0x558593[_0x035b('0x45')],null))['then'](respondWithResult(_0x122570,null))['catch'](handleError(_0x122570,null));};exports[_0x035b('0x47')]=function(_0x212c6d,_0x1c49a7){return db[_0x035b('0x2c')][_0x035b('0x44')]({'where':{'id':_0x212c6d[_0x035b('0x46')]['id']}})['then'](handleEntityNotFound(_0x1c49a7,null))[_0x035b('0x12')](removeEntity(_0x1c49a7,null))[_0x035b('0x1d')](handleError(_0x1c49a7,null));};exports[_0x035b('0x48')]=function(_0x2d14dc,_0x3f2a96){return db[_0x035b('0x2c')][_0x035b('0x48')]()['then'](respondWithResult(_0x3f2a96,null))['catch'](handleError(_0x3f2a96,null));};exports[_0x035b('0x49')]=function(_0x424f42,_0x407f18){return db[_0x035b('0x2c')][_0x035b('0x49')](_0x424f42[_0x035b('0x45')])[_0x035b('0x12')](function(_0x37dff7){if(_0x37dff7){if(_0x37dff7[_0x035b('0x4a')]===_0x035b('0x4b')&&!_0x37dff7[_0x035b('0x4c')]){var _0x331326,_0x3b8353,_0x516746;if(_0x424f42[_0x035b('0x45')]['to']){_0x3b8353=_0x424f42['body']['to'][_0x035b('0x4d')](',')[0x0];}return db[_0x035b('0x4e')][_0x035b('0x4f')]({'where':{'id':_0x37dff7[_0x035b('0x50')]},'include':[{'model':db[_0x035b('0x51')],'as':'List','include':[{'model':db[_0x035b('0x52')],'as':_0x035b('0x53'),'where':{'email':_0x3b8353},'limit':0x1,'order':[[_0x035b('0x54'),'DESC']]}]},{'model':db[_0x035b('0x55')],'as':_0x035b('0x56'),'raw':!![]}]})[_0x035b('0x12')](function(_0x1e3a5b){_0x331326=_0x1e3a5b;if(_0x331326&&_0x331326[_0x035b('0x56')]){var _0x474388={'tls':{'rejectUnauthorized':![]}};if(_[_0x035b('0x57')](_0x331326[_0x035b('0x56')][_0x035b('0x58')])){_0x474388['host']=_0x331326[_0x035b('0x56')][_0x035b('0x59')];_0x474388[_0x035b('0x5a')]=_0x331326['Smtp']['port'];_0x474388['secure']=_0x331326['Smtp'][_0x035b('0x5b')];if(_0x331326[_0x035b('0x56')][_0x035b('0x5c')]){_0x474388[_0x035b('0x5d')]={'user':_0x331326[_0x035b('0x56')][_0x035b('0x5e')],'pass':_0x331326[_0x035b('0x56')][_0x035b('0x5f')]};}}else{_0x474388[_0x035b('0x58')]=_0x331326[_0x035b('0x56')][_0x035b('0x58')];_0x474388['auth']={'user':_0x331326[_0x035b('0x56')][_0x035b('0x5e')],'pass':_0x331326[_0x035b('0x56')][_0x035b('0x5f')]};_0x474388[_0x035b('0x5b')]=_0x331326[_0x035b('0x56')][_0x035b('0x5b')];}if(_0x424f42[_0x035b('0x45')][_0x035b('0x60')]&&_0x424f42['body'][_0x035b('0x60')][_0x035b('0x35')]){for(var _0xc5bd60=0x0;_0xc5bd60<_0x424f42[_0x035b('0x45')][_0x035b('0x60')][_0x035b('0x35')];_0xc5bd60+=0x1){_0x424f42['body']['attachments'][_0xc5bd60]={'filename':_0x424f42[_0x035b('0x45')]['attachments'][_0xc5bd60][_0x035b('0x29')],'path':path['join'](config[_0x035b('0x61')],_0x035b('0x62'),_0x424f42[_0x035b('0x45')][_0x035b('0x60')][_0xc5bd60]['basename'])};}}_0x516746={'account':_0x474388,'message':_0x424f42[_0x035b('0x45')]};return;}})['then'](function(){if(_0x331326[_0x035b('0x63')]){if(_0x331326[_0x035b('0x63')][_0x035b('0x53')][_0x035b('0x35')]){return _0x331326['List'][_0x035b('0x53')][0x0];}else{return db[_0x035b('0x52')][_0x035b('0x49')](_[_0x035b('0x8')](_0x424f42[_0x035b('0x45')],{'firstName':_0x424f42[_0x035b('0x45')]['to'],'email':_0x424f42[_0x035b('0x45')]['to'],'phone':_0x424f42[_0x035b('0x45')]['to'],'ListId':_0x331326[_0x035b('0x64')]}));}}else{throw new Error(_0x035b('0x65'));}})[_0x035b('0x12')](function(){if(_0x516746){return respondWithRpcPromise(_0x035b('0x66'),'sendMail',_0x516746,client9003)[_0x035b('0x12')](function(_0x9254aa){return _0x37dff7[_0x035b('0x25')]({'read':!![],'messageId':_0x9254aa[_0x035b('0x67')],'sentAt':moment()['format'](_0x035b('0x68'))});})['catch'](function(_0x143b33){logger[_0x035b('0x1a')]('%s',JSON['stringify'](_0x143b33));return _0x37dff7;});}return _0x37dff7;});}return _0x37dff7;}})['then'](respondWithResult(_0x407f18,0xc9))[_0x035b('0x1d')](handleError(_0x407f18,null));};exports[_0x035b('0x69')]=function(_0x521a4e,_0x2197dc){var _0x31a789={'agent':{},'channel':_0x035b('0x6a')};if(_0x521a4e[_0x035b('0x45')]['id']){delete _0x521a4e[_0x035b('0x45')]['id'];}_0x521a4e['body']['read']=!![];_0x521a4e[_0x035b('0x45')][_0x035b('0x6b')]=moment()[_0x035b('0x6c')](_0x035b('0x68'));_0x521a4e['body'][_0x035b('0x6d')]=_0x521a4e['body']['UserId']||_0x521a4e[_0x035b('0x5e')]['id'];_0x31a789[_0x035b('0x6e')]['id']=_0x521a4e[_0x035b('0x45')][_0x035b('0x6d')];return db[_0x035b('0x2c')][_0x035b('0x44')]({'where':{'id':_0x521a4e[_0x035b('0x46')]['id'],'UserId':null}})[_0x035b('0x12')](handleEntityNotFound(_0x2197dc,null))['then'](saveUpdates(_0x521a4e[_0x035b('0x45')],null))[_0x035b('0x12')](function(_0x4bc875){if(_0x4bc875){_0x31a789[_0x035b('0x1b')]=_0x4bc875[_0x035b('0x6f')]({'plain':!![]});return db[_0x035b('0x70')][_0x035b('0x44')]({'where':{'id':_0x4bc875[_0x035b('0x71')]}});}return null;})[_0x035b('0x12')](handleEntityNotFound(_0x2197dc,null))[_0x035b('0x12')](function(_0x35c014){if(_0x35c014){return _0x35c014[_0x035b('0x25')]({'UserId':_0x521a4e[_0x035b('0x45')][_0x035b('0x6d')],'read1stAt':_['isNil'](_0x35c014[_0x035b('0x72')])?moment()[_0x035b('0x6c')](_0x035b('0x68')):undefined});}return null;})[_0x035b('0x12')](function(_0x104a61){if(_0x104a61){_0x31a789['interaction']=_0x104a61['get']({'plain':!![]});interaction_log['info'](_0x035b('0x73'),_0x521a4e['user']['id'],_0x521a4e['user']['name'],_0x521a4e['user'][_0x035b('0x74')],_0x31a789[_0x035b('0x75')]['id'],_0x521a4e[_0x035b('0x45')]?JSON[_0x035b('0x18')](_0x521a4e['body']):_0x035b('0x76'));return respondWithRpcPromise(_0x035b('0x77'),_0x035b('0x78'),_0x31a789);}return null;})[_0x035b('0x12')](function(_0x3b4d84){var _0x4f20c8='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3b4d84[_0x035b('0x1b')]['ContactId'];return db[_0x035b('0x79')][_0x035b('0x30')](_0x4f20c8,{'type':db['Sequelize']['QueryTypes'][_0x035b('0x7a')],'raw':!![]})['then'](function(_0xa4c8e4){return _0xa4c8e4;});})[_0x035b('0x12')](function(_0x3391df){if(_0x3391df){_0x31a789['message'][_0x035b('0x7b')]=_0x3391df[0x0];if(!_0x521a4e['body'][_0x035b('0x6d')])return;return db['User']['find']({'where':{'id':_0x521a4e[_0x035b('0x45')]['UserId'],'role':'agent'},'attributes':['id',_0x035b('0x29'),_0x035b('0x7c'),'email',_0x035b('0x7d')],'raw':!![]});}return null;})[_0x035b('0x12')](function(_0xabbe77){if(!_0xabbe77)return null;_0x31a789['message'][_0x035b('0x6e')]=_0xabbe77;return _0x31a789;})[_0x035b('0x12')](function(_0x3f6114){if(_0x3f6114){if(_0x521a4e[_0x035b('0x45')][_0x035b('0x7e')]){_0x31a789[_0x035b('0x1b')][_0x035b('0x7f')]=util[_0x035b('0x6c')](_0x035b('0x80'),_0x521a4e[_0x035b('0x5e')]['name']);_0x31a789['message'][_0x035b('0x81')]=_0x31a789[_0x035b('0x81')];_0x31a789['message'][_0x035b('0x82')]=_0x31a789['channel'];_0x31a789[_0x035b('0x1b')]['event']=_0x035b('0x69');_0x31a789[_0x035b('0x1b')]['body']=htmlToText[_0x035b('0x83')](_0x31a789[_0x035b('0x1b')]['body']);return respondWithRpcPromise(_0x035b('0x84'),_0x035b('0x84'),{'event':_0x035b('0x85'),'message':_0x31a789['message']},client9002)[_0x035b('0x12')](function(){return _0x31a789;});}return _0x31a789;}return null;})[_0x035b('0x12')](respondWithResult(_0x2197dc,null))[_0x035b('0x1d')](handleError(_0x2197dc,null));};exports['reject']=function(_0x1a6223,_0x6e180e){var _0xd96046={'agent':{},'channel':_0x035b('0x6a')};if(_0x1a6223[_0x035b('0x45')]['id']){delete _0x1a6223[_0x035b('0x45')]['id'];}_0x1a6223['body'][_0x035b('0x6d')]=_0x1a6223[_0x035b('0x45')][_0x035b('0x6d')]||_0x1a6223[_0x035b('0x5e')]['id'];_0xd96046['agent']['id']=_0x1a6223['body'][_0x035b('0x6d')];return db['MailMessage'][_0x035b('0x44')]({'where':{'id':_0x1a6223[_0x035b('0x46')]['id'],'UserId':null}})[_0x035b('0x12')](handleEntityNotFound(_0x6e180e,null))[_0x035b('0x12')](function(_0x105134){if(_0x105134){_0xd96046['message']=_0x105134[_0x035b('0x6f')]({'plain':!![]});return db['MailInteraction'][_0x035b('0x44')]({'where':{'id':_0x105134[_0x035b('0x71')]}});}return null;})['then'](handleEntityNotFound(_0x6e180e,null))[_0x035b('0x12')](function(_0x398174){if(_0x398174){_0xd96046['interaction']=_0x398174[_0x035b('0x6f')]({'plain':!![]});interaction_log[_0x035b('0x13')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1a6223[_0x035b('0x5e')]['id'],_0x1a6223[_0x035b('0x5e')][_0x035b('0x29')],_0x1a6223[_0x035b('0x5e')][_0x035b('0x74')],_0xd96046[_0x035b('0x75')]['id'],_0x1a6223[_0x035b('0x45')]?JSON['stringify'](_0x1a6223[_0x035b('0x45')]):_0x035b('0x76'));return respondWithRpcPromise(_0x035b('0x86'),_0x035b('0x87'),_0xd96046);}return null;})['then'](function(_0x1a0f5e){var _0x5986fc=_0x035b('0x88')+_0x1a0f5e[_0x035b('0x1b')][_0x035b('0x89')];return db[_0x035b('0x79')]['query'](_0x5986fc,{'type':db['Sequelize'][_0x035b('0x8a')][_0x035b('0x7a')],'raw':!![]})[_0x035b('0x12')](function(_0x2020bb){return _0x2020bb;});})[_0x035b('0x12')](function(_0x302a8b){if(_0x302a8b){_0xd96046[_0x035b('0x1b')]['contact']=_0x302a8b[0x0];if(!_0x1a6223['body'][_0x035b('0x6d')])return;return db[_0x035b('0x8b')][_0x035b('0x44')]({'where':{'id':_0x1a6223[_0x035b('0x45')][_0x035b('0x6d')],'role':_0x035b('0x6e')},'attributes':['id',_0x035b('0x29'),_0x035b('0x7c'),_0x035b('0x8c'),_0x035b('0x7d')],'raw':!![]});}return null;})[_0x035b('0x12')](function(_0x2092b9){if(!_0x2092b9)return null;_0xd96046[_0x035b('0x1b')][_0x035b('0x6e')]=_0x2092b9;return _0xd96046;})[_0x035b('0x12')](function(_0x19fdae){if(_0x19fdae){_0x19fdae[_0x035b('0x1b')]['interface']=util['format'](_0x035b('0x80'),_0x1a6223[_0x035b('0x5e')][_0x035b('0x29')]);_0x19fdae[_0x035b('0x1b')][_0x035b('0x81')]=_0xd96046[_0x035b('0x81')];_0x19fdae[_0x035b('0x1b')]['motionChannel']=_0xd96046['channel'];_0x19fdae['message'][_0x035b('0x8d')]=_0x035b('0x8e');_0x19fdae[_0x035b('0x1b')][_0x035b('0x45')]=htmlToText[_0x035b('0x83')](_0xd96046[_0x035b('0x1b')][_0x035b('0x45')]);respondWithRpcPromise(_0x035b('0x84'),_0x035b('0x84'),{'event':'rejectmessage','message':_0x19fdae['message']},client9002);return _0xd96046;}return null;})[_0x035b('0x12')](respondWithResult(_0x6e180e,null))[_0x035b('0x1d')](handleError(_0x6e180e,null));};exports[_0x035b('0x8f')]=function(_0x4d1df0,_0x3d6f41){var _0x56ac02=moment()[_0x035b('0x90')]()[_0x035b('0x91')]();var _0xb35a18=path['join'](config['root'],'server',_0x035b('0x92'),_0x035b('0x93'));var _0x4d9a7b=path[_0x035b('0x94')](config[_0x035b('0x61')],_0x035b('0x95'),_0x035b('0x92'),'attachments');var _0x57853b=util[_0x035b('0x6c')](_0x035b('0x96'),_0x56ac02);return db[_0x035b('0x2c')][_0x035b('0x44')]({'where':{'id':_0x4d1df0[_0x035b('0x46')]['id']},'attributes':['id','body',_0x035b('0x97'),'to','cc',_0x035b('0x98'),'subject',_0x035b('0x99')],'include':_0x4d1df0[_0x035b('0x30')][_0x035b('0x60')]?[{'model':db['Attachment'],'as':_0x035b('0x9a')}]:undefined})[_0x035b('0x12')](handleEntityNotFound(_0x3d6f41,null))[_0x035b('0x12')](function(_0x5e53be){if(_0x5e53be){var _0x43307b=_0x5e53be;var _0x1ef534={'from':_0x43307b[_0x035b('0x97')],'to':_0x43307b['to'],'subject':_0x43307b[_0x035b('0x9b')],'html':htmlEntities['decode'](_0x43307b[_0x035b('0x45')]),'headers':{'Date':moment(_0x43307b[_0x035b('0x99')])[_0x035b('0x6c')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x5e53be['cc']){_0x1ef534[_0x035b('0x9c')]['Cc']=_0x5e53be['cc'];}if(_0x5e53be[_0x035b('0x98')]){_0x1ef534[_0x035b('0x9c')]['Bcc']=_0x5e53be[_0x035b('0x98')];}return new BPromise(function(_0xce644e,_0xc12635){if(_0x5e53be[_0x035b('0x9a')]){for(var _0x3e3f55=0x0;_0x3e3f55<_0x5e53be[_0x035b('0x9a')]['length'];_0x3e3f55++){var _0x56a640=_0x5e53be[_0x035b('0x9a')][_0x3e3f55];var _0x136b1c=path[_0x035b('0x94')](_0x4d9a7b,_0x56a640[_0x035b('0x9d')]);if(fs[_0x035b('0x9e')](_0x136b1c)){_0x1ef534[_0x035b('0x60')][_0x035b('0x9f')]({'name':_0x56a640[_0x035b('0x29')],'contentType':_0x56a640['type'],'data':fs[_0x035b('0xa0')](_0x136b1c)});}}}emlformat[_0x035b('0xa1')](_0x1ef534,function(_0x3066c7,_0x5694ce){if(_0x3066c7)return _0xc12635(_0x3066c7);fs[_0x035b('0xa2')](path[_0x035b('0x94')](_0xb35a18,_0x57853b),_0x5694ce);return _0xce644e(_0x5694ce);});});}})[_0x035b('0x12')](function(_0x5158cc){if(_0x5158cc){return _0x3d6f41[_0x035b('0x8f')](path['join'](_0xb35a18,_0x57853b),_0x57853b,function(_0x5b4c21){if(!_0x5b4c21)fs[_0x035b('0xa3')](path[_0x035b('0x94')](_0xb35a18,_0x57853b));});}})[_0x035b('0x1d')](handleError(_0x3d6f41,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index f61cbe4..9f2fc97 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 _0x7cb7=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners'];(function(_0x4c8bd9,_0x51232c){var _0xa498e4=function(_0x4f6296){while(--_0x4f6296){_0x4c8bd9['push'](_0x4c8bd9['shift']());}};_0xa498e4(++_0x51232c);}(_0x7cb7,0x1f0));var _0x77cb=function(_0x102a8a,_0x400e01){_0x102a8a=_0x102a8a-0x0;var _0x6697d1=_0x7cb7[_0x102a8a];return _0x6697d1;};'use strict';var EventEmitter=require(_0x77cb('0x0'));var MailMessage=require(_0x77cb('0x1'))['db'][_0x77cb('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x77cb('0x3')](0x0);var events={'afterCreate':_0x77cb('0x4'),'afterUpdate':'update','afterDestroy':_0x77cb('0x5')};function emitEvent(_0x230849){return function(_0x2064bb,_0x548069,_0x5d88cf){MailMessageEvents[_0x77cb('0x6')](_0x230849+':'+_0x2064bb['id'],_0x2064bb);MailMessageEvents[_0x77cb('0x6')](_0x230849,_0x2064bb);_0x5d88cf(null);};}for(var e in events){if(events[_0x77cb('0x7')](e)){var event=events[e];MailMessage[_0x77cb('0x8')](e,emitEvent(event));}}module[_0x77cb('0x9')]=MailMessageEvents; \ No newline at end of file +var _0x0fdc=['events','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3ffe3f,_0x464d70){var _0x130c0b=function(_0x4d137e){while(--_0x4d137e){_0x3ffe3f['push'](_0x3ffe3f['shift']());}};_0x130c0b(++_0x464d70);}(_0x0fdc,0x70));var _0xc0fd=function(_0x277f9a,_0x3956f1){_0x277f9a=_0x277f9a-0x0;var _0x162dca=_0x0fdc[_0x277f9a];return _0x162dca;};'use strict';var EventEmitter=require(_0xc0fd('0x0'));var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xc0fd('0x1')](0x0);var events={'afterCreate':_0xc0fd('0x2'),'afterUpdate':'update','afterDestroy':_0xc0fd('0x3')};function emitEvent(_0x5183c9){return function(_0x5989a3,_0x510a1c,_0x5bb582){MailMessageEvents[_0xc0fd('0x4')](_0x5183c9+':'+_0x5989a3['id'],_0x5989a3);MailMessageEvents['emit'](_0x5183c9,_0x5989a3);_0x5bb582(null);};}for(var e in events){if(events[_0xc0fd('0x5')](e)){var event=events[e];MailMessage[_0xc0fd('0x6')](e,emitEvent(event));}}module[_0xc0fd('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 24beb73..08c10cb 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 _0x47e3=['MailInteractionId','then','createdAt','toLowerCase','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','secret','UserId','MailInteraction'];(function(_0x1ef62a,_0x40db43){var _0x5861ba=function(_0x1034ee){while(--_0x1034ee){_0x1ef62a['push'](_0x1ef62a['shift']());}};_0x5861ba(++_0x40db43);}(_0x47e3,0xc6));var _0x347e=function(_0x5eb9b5,_0x34ab97){_0x5eb9b5=_0x5eb9b5-0x0;var _0x77b3c0=_0x47e3[_0x5eb9b5];return _0x77b3c0;};'use strict';var _=require(_0x347e('0x0'));var util=require(_0x347e('0x1'));var logger=require(_0x347e('0x2'))(_0x347e('0x3'));var moment=require('moment');var BPromise=require(_0x347e('0x4'));var rp=require(_0x347e('0x5'));var htmlToText=require(_0x347e('0x6'));var fs=require('fs');var path=require(_0x347e('0x7'));var rimraf=require(_0x347e('0x8'));var config=require(_0x347e('0x9'));var attributes=require(_0x347e('0xa'));module['exports']=function(_0x308f0e,_0x4e91c9){return _0x308f0e[_0x347e('0xb')](_0x347e('0xc'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x347e('0xd'),'fields':[_0x347e('0xd')]},{'name':_0x347e('0xe'),'fields':[_0x347e('0xf'),_0x347e('0x10')],'type':_0x347e('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5cb0ba,_0x3e472f,_0xd336f3){if(_0x5cb0ba[_0x347e('0x12')]){_0x5cb0ba['plainBody']=htmlToText[_0x347e('0x13')](_0x5cb0ba[_0x347e('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xd336f3(null,_0x3e472f);},'afterCreate':function(_0x642718,_0x7a02bf,_0x19dba5){var _0x2b1e15=_0x308f0e[_0x347e('0x14')];var _0xd4df9a=_0x642718[_0x347e('0x15')]({'plain':!![]});if(_0xd4df9a[_0x347e('0x16')]['toLowerCase']()==='in'||_0xd4df9a[_0x347e('0x16')]['toLowerCase']()==='out'&&!_0xd4df9a[_0x347e('0x17')]&&!_['isNil'](_0xd4df9a[_0x347e('0x18')])){_0x2b1e15[_0x347e('0x19')]['findOne']({'where':{'id':_0xd4df9a[_0x347e('0x1a')]}})[_0x347e('0x1b')](function(_0x442727){if(_0x442727){_0x442727['update']({'lastMsgAt':_0xd4df9a[_0x347e('0x1c')],'lastMsgDirection':_0xd4df9a[_0x347e('0x16')][_0x347e('0x1d')]()});}})['catch'](function(_0x5239c8){console[_0x347e('0x1e')](_0x5239c8);});}_0x19dba5();}},'charset':'utf8mb4','collate':_0x347e('0x1f')});}; \ No newline at end of file +var _0xb760=['out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','html-to-text','rimraf','../../config/environment','./mailMessage.attributes','define','MailMessage','mail_messages','messageId','fti_mail_messages','FULLTEXT','body','models','get','direction','toLowerCase'];(function(_0x28303b,_0x228b66){var _0x37c44e=function(_0x5946f4){while(--_0x5946f4){_0x28303b['push'](_0x28303b['shift']());}};_0x37c44e(++_0x228b66);}(_0xb760,0x90));var _0x0b76=function(_0x4b58bb,_0x4df916){_0x4b58bb=_0x4b58bb-0x0;var _0x3c920d=_0xb760[_0x4b58bb];return _0x3c920d;};'use strict';var _=require(_0x0b76('0x0'));var util=require(_0x0b76('0x1'));var logger=require(_0x0b76('0x2'))(_0x0b76('0x3'));var moment=require('moment');var BPromise=require(_0x0b76('0x4'));var rp=require(_0x0b76('0x5'));var htmlToText=require(_0x0b76('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0b76('0x7'));var config=require(_0x0b76('0x8'));var attributes=require(_0x0b76('0x9'));module['exports']=function(_0x2b5575,_0xe39d5e){return _0x2b5575[_0x0b76('0xa')](_0x0b76('0xb'),attributes,{'tableName':_0x0b76('0xc'),'paranoid':![],'indexes':[{'name':_0x0b76('0xd'),'fields':[_0x0b76('0xd')]},{'name':_0x0b76('0xe'),'fields':['plainBody','subject'],'type':_0x0b76('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2600fc,_0x34762b,_0x3555d8){if(_0x2600fc['body']){_0x2600fc['plainBody']=htmlToText['fromString'](_0x2600fc[_0x0b76('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x3555d8(null,_0x34762b);},'afterCreate':function(_0x30afba,_0x1f89a4,_0x537a7d){var _0x4fa5e8=_0x2b5575[_0x0b76('0x11')];var _0x349277=_0x30afba[_0x0b76('0x12')]({'plain':!![]});if(_0x349277[_0x0b76('0x13')][_0x0b76('0x14')]()==='in'||_0x349277['direction']['toLowerCase']()===_0x0b76('0x15')&&!_0x349277[_0x0b76('0x16')]&&!_[_0x0b76('0x17')](_0x349277[_0x0b76('0x18')])){_0x4fa5e8[_0x0b76('0x19')][_0x0b76('0x1a')]({'where':{'id':_0x349277[_0x0b76('0x1b')]}})['then'](function(_0x260657){if(_0x260657){_0x260657[_0x0b76('0x1c')]({'lastMsgAt':_0x349277['createdAt'],'lastMsgDirection':_0x349277[_0x0b76('0x13')][_0x0b76('0x14')]()});}})[_0x0b76('0x1d')](function(_0x4b975d){console[_0x0b76('0x1e')](_0x4b975d);});}_0x537a7d();}},'charset':_0x0b76('0x1f'),'collate':_0x0b76('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 98b9b3d..262ee74 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 _0xd824=['request\x20sent','stringify','error','code','message','MailMessage,\x20%s,\x20%s','result','CreateMailMessage','MailMessage','create','body','options','raw','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','defaults','redis','localhost','then','info','debug','MailMessage,\x20%s,\x20%s,\x20%s'];(function(_0x3115f6,_0x3a8d79){var _0x2cd0bd=function(_0x21fba6){while(--_0x21fba6){_0x3115f6['push'](_0x3115f6['shift']());}};_0x2cd0bd(++_0x3a8d79);}(_0xd824,0xc2));var _0x4d82=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xd824[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x4d82('0x0'));var util=require(_0x4d82('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4d82('0x2'));var fs=require('fs');var Redis=require(_0x4d82('0x3'));var db=require(_0x4d82('0x4'))['db'];var utils=require(_0x4d82('0x5'));var logger=require(_0x4d82('0x6'))(_0x4d82('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4d82('0x8')]['http']({'port':0x232a});config['redis']=_[_0x4d82('0x9')](config[_0x4d82('0xa')],{'host':_0x4d82('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4d82('0xa')]));require('./mailMessage.socket')['register'](socket);function respondWithRpcPromise(_0x580bbd,_0x27b777,_0x392f17){return new BPromise(function(_0x480c05,_0x318d1d){return client['request'](_0x580bbd,_0x392f17)[_0x4d82('0xc')](function(_0x303645){logger[_0x4d82('0xd')]('MailMessage,\x20%s,\x20%s',_0x27b777,'request\x20sent');logger[_0x4d82('0xe')](_0x4d82('0xf'),_0x27b777,_0x4d82('0x10'),JSON[_0x4d82('0x11')](_0x303645));if(_0x303645['error']){if(_0x303645[_0x4d82('0x12')][_0x4d82('0x13')]===0x1f4){logger[_0x4d82('0x12')]('MailMessage,\x20%s,\x20%s',_0x27b777,_0x303645[_0x4d82('0x12')]['message']);return _0x318d1d(_0x303645[_0x4d82('0x12')]['message']);}logger[_0x4d82('0x12')]('MailMessage,\x20%s,\x20%s',_0x27b777,_0x303645[_0x4d82('0x12')][_0x4d82('0x14')]);return _0x480c05(_0x303645[_0x4d82('0x12')][_0x4d82('0x14')]);}else{logger[_0x4d82('0xd')](_0x4d82('0x15'),_0x27b777,_0x4d82('0x10'));_0x480c05(_0x303645[_0x4d82('0x16')][_0x4d82('0x14')]);}})['catch'](function(_0x2919b0){logger[_0x4d82('0x12')](_0x4d82('0x15'),_0x27b777,_0x2919b0);_0x318d1d(_0x2919b0);});});}exports[_0x4d82('0x17')]=function(_0xe6260){var _0xd5f47=this;return new Promise(function(_0x1a513d,_0x64669c){return db[_0x4d82('0x18')][_0x4d82('0x19')](_0xe6260[_0x4d82('0x1a')],{'raw':_0xe6260['options']?_0xe6260[_0x4d82('0x1b')][_0x4d82('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x1a419f){logger[_0x4d82('0xd')](_0x4d82('0x17'),_0xe6260);logger[_0x4d82('0xe')](_0x4d82('0x17'),_0xe6260,JSON[_0x4d82('0x11')](_0x1a419f));_0x1a513d(_0x1a419f);})[_0x4d82('0x1d')](function(_0x462258){logger[_0x4d82('0x12')](_0x4d82('0x17'),_0x462258[_0x4d82('0x14')],_0xe6260);_0x64669c(_0xd5f47[_0x4d82('0x12')](0x1f4,_0x462258[_0x4d82('0x14')]));});});}; \ No newline at end of file +var _0xef0f=['code','message','result','catch','CreateMailMessage','create','options','debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x135602,_0x144a86){var _0x38329a=function(_0x2871bd){while(--_0x2871bd){_0x135602['push'](_0x135602['shift']());}};_0x38329a(++_0x144a86);}(_0xef0f,0x168));var _0xfef0=function(_0x53a955,_0x267e36){_0x53a955=_0x53a955-0x0;var _0x5bf53f=_0xef0f[_0x53a955];return _0x5bf53f;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var moment=require(_0xfef0('0x1'));var BPromise=require(_0xfef0('0x2'));var rs=require(_0xfef0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfef0('0x4'))['db'];var utils=require(_0xfef0('0x5'));var logger=require(_0xfef0('0x6'))('rpc');var config=require(_0xfef0('0x7'));var jayson=require(_0xfef0('0x8'));var client=jayson[_0xfef0('0x9')][_0xfef0('0xa')]({'port':0x232a});config[_0xfef0('0xb')]=_[_0xfef0('0xc')](config['redis'],{'host':_0xfef0('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfef0('0xb')]));require(_0xfef0('0xe'))[_0xfef0('0xf')](socket);function respondWithRpcPromise(_0x2d42dc,_0x334e74,_0x402dff){return new BPromise(function(_0xc177db,_0x4bd6f2){return client[_0xfef0('0x10')](_0x2d42dc,_0x402dff)[_0xfef0('0x11')](function(_0x410234){logger[_0xfef0('0x12')](_0xfef0('0x13'),_0x334e74,_0xfef0('0x14'));logger['debug'](_0xfef0('0x15'),_0x334e74,_0xfef0('0x14'),JSON[_0xfef0('0x16')](_0x410234));if(_0x410234[_0xfef0('0x17')]){if(_0x410234[_0xfef0('0x17')][_0xfef0('0x18')]===0x1f4){logger[_0xfef0('0x17')]('MailMessage,\x20%s,\x20%s',_0x334e74,_0x410234[_0xfef0('0x17')]['message']);return _0x4bd6f2(_0x410234['error']['message']);}logger[_0xfef0('0x17')](_0xfef0('0x13'),_0x334e74,_0x410234[_0xfef0('0x17')][_0xfef0('0x19')]);return _0xc177db(_0x410234[_0xfef0('0x17')][_0xfef0('0x19')]);}else{logger[_0xfef0('0x12')](_0xfef0('0x13'),_0x334e74,'request\x20sent');_0xc177db(_0x410234[_0xfef0('0x1a')][_0xfef0('0x19')]);}})[_0xfef0('0x1b')](function(_0x39f9d3){logger[_0xfef0('0x17')]('MailMessage,\x20%s,\x20%s',_0x334e74,_0x39f9d3);_0x4bd6f2(_0x39f9d3);});});}exports[_0xfef0('0x1c')]=function(_0x4e24de){var _0x20826b=this;return new Promise(function(_0x1a0aa0,_0x28dee1){return db['MailMessage'][_0xfef0('0x1d')](_0x4e24de['body'],{'raw':_0x4e24de[_0xfef0('0x1e')]?_0x4e24de[_0xfef0('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4b8b22){logger[_0xfef0('0x12')]('CreateMailMessage',_0x4e24de);logger[_0xfef0('0x1f')](_0xfef0('0x1c'),_0x4e24de,JSON[_0xfef0('0x16')](_0x4b8b22));_0x1a0aa0(_0x4b8b22);})[_0xfef0('0x1b')](function(_0x249fe4){logger[_0xfef0('0x17')]('CreateMailMessage',_0x249fe4['message'],_0x4e24de);_0x28dee1(_0x20826b[_0xfef0('0x17')](0x1f4,_0x249fe4[_0xfef0('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index f758f84..425e9fe 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 _0x24ab=['length','mailMessage:','./mailMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x4c7c25,_0x1e16a8){var _0x297619=function(_0x453f76){while(--_0x453f76){_0x4c7c25['push'](_0x4c7c25['shift']());}};_0x297619(++_0x1e16a8);}(_0x24ab,0x1c4));var _0xb24a=function(_0x4f733d,_0x273d4f){_0x4f733d=_0x4f733d-0x0;var _0x11e1e1=_0x24ab[_0x4f733d];return _0x11e1e1;};'use strict';var MailMessageEvents=require(_0xb24a('0x0'));var events=[_0xb24a('0x1'),_0xb24a('0x2'),_0xb24a('0x3')];function createListener(_0xb27cd6,_0x11c2ff){return function(_0xa6d0b9){_0x11c2ff[_0xb24a('0x4')](_0xb27cd6,_0xa6d0b9);};}function removeListener(_0x494109,_0x1d309e){return function(){MailMessageEvents[_0xb24a('0x5')](_0x494109,_0x1d309e);};}exports[_0xb24a('0x6')]=function(_0x11a6b9){for(var _0x1b3e7c=0x0,_0x3f6389=events[_0xb24a('0x7')];_0x1b3e7c<_0x3f6389;_0x1b3e7c++){var _0x10394a=events[_0x1b3e7c];var _0x588d0e=createListener(_0xb24a('0x8')+_0x10394a,_0x11a6b9);MailMessageEvents['on'](_0x10394a,_0x588d0e);}}; \ No newline at end of file +var _0x8f7d=['./mailMessage.events','save','update','removeListener','register','length','mailMessage:'];(function(_0x2da1f9,_0x5e4269){var _0x22ef92=function(_0x1a152a){while(--_0x1a152a){_0x2da1f9['push'](_0x2da1f9['shift']());}};_0x22ef92(++_0x5e4269);}(_0x8f7d,0xf5));var _0xd8f7=function(_0x44e18b,_0x1280a0){_0x44e18b=_0x44e18b-0x0;var _0x5cbe7c=_0x8f7d[_0x44e18b];return _0x5cbe7c;};'use strict';var MailMessageEvents=require(_0xd8f7('0x0'));var events=[_0xd8f7('0x1'),'remove',_0xd8f7('0x2')];function createListener(_0x4a4401,_0x52384d){return function(_0x2600d2){_0x52384d['emit'](_0x4a4401,_0x2600d2);};}function removeListener(_0x9558b6,_0x338be3){return function(){MailMessageEvents[_0xd8f7('0x3')](_0x9558b6,_0x338be3);};}exports[_0xd8f7('0x4')]=function(_0x524a2e){for(var _0x4090c9=0x0,_0x2907df=events[_0xd8f7('0x5')];_0x4090c9<_0x2907df;_0x4090c9++){var _0xeaa837=events[_0x4090c9];var _0xa61f07=createListener(_0xd8f7('0x6')+_0xeaa837,_0x524a2e);MailMessageEvents['on'](_0xeaa837,_0xa61f07);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index a69d801..7c5f53e 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 _0xd349=['../../config/environment','./mailQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','put','update','destroy','delete','removeAgents','exports','util','path','connect-timeout','express','../../components/interaction/service'];(function(_0xe8ccb4,_0x50c183){var _0x2df646=function(_0x3a89fe){while(--_0x3a89fe){_0xe8ccb4['push'](_0xe8ccb4['shift']());}};_0x2df646(++_0x50c183);}(_0xd349,0x1f3));var _0x9d34=function(_0x521b4e,_0x38b1c8){_0x521b4e=_0x521b4e-0x0;var _0xd4469a=_0xd349[_0x521b4e];return _0xd4469a;};'use strict';var multer=require('multer');var util=require(_0x9d34('0x0'));var path=require(_0x9d34('0x1'));var timeout=require(_0x9d34('0x2'));var express=require(_0x9d34('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9d34('0x4'));var config=require(_0x9d34('0x5'));var controller=require(_0x9d34('0x6'));router[_0x9d34('0x7')]('/',auth[_0x9d34('0x8')](),controller[_0x9d34('0x9')]);router[_0x9d34('0x7')]('/describe',auth[_0x9d34('0x8')](),controller[_0x9d34('0xa')]);router['get'](_0x9d34('0xb'),auth[_0x9d34('0x8')](),controller[_0x9d34('0xc')]);router[_0x9d34('0x7')](_0x9d34('0xd'),auth[_0x9d34('0x8')](),controller[_0x9d34('0xe')]);router['get']('/:id/teams',auth[_0x9d34('0x8')](),controller[_0x9d34('0xf')]);router[_0x9d34('0x7')](_0x9d34('0x10'),auth[_0x9d34('0x8')](),controller[_0x9d34('0x11')]);router[_0x9d34('0x12')]('/',auth[_0x9d34('0x8')](),controller['create']);router[_0x9d34('0x12')](_0x9d34('0x13'),auth[_0x9d34('0x8')](),controller[_0x9d34('0x14')]);router[_0x9d34('0x12')](_0x9d34('0x10'),auth[_0x9d34('0x8')](),controller[_0x9d34('0x15')]);router[_0x9d34('0x16')]('/:id',auth[_0x9d34('0x8')](),controller[_0x9d34('0x17')]);router['delete'](_0x9d34('0xb'),auth['isAuthenticated'](),controller[_0x9d34('0x18')]);router['delete'](_0x9d34('0x13'),auth[_0x9d34('0x8')](),controller['removeTeams']);router[_0x9d34('0x19')](_0x9d34('0x10'),auth[_0x9d34('0x8')](),controller[_0x9d34('0x1a')]);module[_0x9d34('0x1b')]=router; \ No newline at end of file +var _0x7dd7=['show','/:id/members','getMembers','/:id/teams','/:id/users','post','create','addTeams','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id'];(function(_0x37e4da,_0xdb7166){var _0x4687d0=function(_0x2e9da3){while(--_0x2e9da3){_0x37e4da['push'](_0x37e4da['shift']());}};_0x4687d0(++_0xdb7166);}(_0x7dd7,0x138));var _0x77dd=function(_0x42020e,_0x4b92fb){_0x42020e=_0x42020e-0x0;var _0x561551=_0x7dd7[_0x42020e];return _0x561551;};'use strict';var multer=require(_0x77dd('0x0'));var util=require(_0x77dd('0x1'));var path=require(_0x77dd('0x2'));var timeout=require(_0x77dd('0x3'));var express=require('express');var router=express[_0x77dd('0x4')]();var fs_extra=require(_0x77dd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x77dd('0x6'));var config=require(_0x77dd('0x7'));var controller=require('./mailQueue.controller');router[_0x77dd('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x77dd('0x9'),auth[_0x77dd('0xa')](),controller[_0x77dd('0xb')]);router['get'](_0x77dd('0xc'),auth[_0x77dd('0xa')](),controller[_0x77dd('0xd')]);router['get'](_0x77dd('0xe'),auth['isAuthenticated'](),controller[_0x77dd('0xf')]);router['get'](_0x77dd('0x10'),auth[_0x77dd('0xa')](),controller['getTeams']);router[_0x77dd('0x8')](_0x77dd('0x11'),auth[_0x77dd('0xa')](),controller['getAgents']);router[_0x77dd('0x12')]('/',auth['isAuthenticated'](),controller[_0x77dd('0x13')]);router[_0x77dd('0x12')]('/:id/teams',auth[_0x77dd('0xa')](),controller[_0x77dd('0x14')]);router[_0x77dd('0x12')](_0x77dd('0x11'),auth[_0x77dd('0xa')](),controller['addAgents']);router['put'](_0x77dd('0xc'),auth[_0x77dd('0xa')](),controller['update']);router[_0x77dd('0x15')](_0x77dd('0xc'),auth[_0x77dd('0xa')](),controller[_0x77dd('0x16')]);router['delete']('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router[_0x77dd('0x15')](_0x77dd('0x11'),auth['isAuthenticated'](),controller[_0x77dd('0x17')]);module[_0x77dd('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index ab82e70..aca6a2b 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 _0xe443=['beepall','exports','STRING','name','INTEGER','ENUM'];(function(_0xd9d7dd,_0x46f65a){var _0x1e1daf=function(_0x104dae){while(--_0x104dae){_0xd9d7dd['push'](_0xd9d7dd['shift']());}};_0x1e1daf(++_0x46f65a);}(_0xe443,0x169));var _0x3e44=function(_0x409f62,_0x502c73){_0x409f62=_0x409f62-0x0;var _0x1cd1fd=_0xe443[_0x409f62];return _0x1cd1fd;};'use strict';var Sequelize=require('sequelize');module[_0x3e44('0x0')]={'name':{'type':Sequelize[_0x3e44('0x1')],'unique':_0x3e44('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x3e44('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3e44('0x4')]('rrmemory',_0x3e44('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x93d4=['exports','STRING','ENUM','rrmemory','beepall','roundrobin'];(function(_0x7a869e,_0x8c2563){var _0x3c67df=function(_0x4b86c8){while(--_0x4b86c8){_0x7a869e['push'](_0x7a869e['shift']());}};_0x3c67df(++_0x8c2563);}(_0x93d4,0xea));var _0x493d=function(_0xc9bd1f,_0x25e95d){_0xc9bd1f=_0xc9bd1f-0x0;var _0x56ed12=_0x93d4[_0xc9bd1f];return _0x56ed12;};'use strict';var Sequelize=require('sequelize');module[_0x493d('0x0')]={'name':{'type':Sequelize[_0x493d('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x493d('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x493d('0x2')](_0x493d('0x3'),_0x493d('0x4'),_0x493d('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index f998c62..f813ab9 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 _0x5a8c=['User','UserId','agent','mailPause','updatedAt','createdAt','count','format','%s/%s','SIP','getTeams','findOne','Team','Agents','online','voicePause','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','all','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','ids','omit','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','MailQueue','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserMailQueue','MailQueueId'];(function(_0x8ab9cc,_0x121050){var _0x2fdf29=function(_0x370778){while(--_0x370778){_0x8ab9cc['push'](_0x8ab9cc['shift']());}};_0x2fdf29(++_0x121050);}(_0x5a8c,0x1da));var _0xc5a8=function(_0x5db8a7,_0x215802){_0x5db8a7=_0x5db8a7-0x0;var _0x2f243f=_0x5a8c[_0x5db8a7];return _0x2f243f;};'use strict';var emlformat=require(_0xc5a8('0x0'));var rimraf=require(_0xc5a8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc5a8('0x2'));var rp=require(_0xc5a8('0x3'));var moment=require(_0xc5a8('0x4'));var BPromise=require(_0xc5a8('0x5'));var Mustache=require('mustache');var util=require(_0xc5a8('0x6'));var path=require(_0xc5a8('0x7'));var sox=require('sox');var csv=require(_0xc5a8('0x8'));var ejs=require(_0xc5a8('0x9'));var fs=require('fs');var fs_extra=require(_0xc5a8('0xa'));var _=require(_0xc5a8('0xb'));var squel=require(_0xc5a8('0xc'));var crypto=require(_0xc5a8('0xd'));var jsforce=require(_0xc5a8('0xe'));var deskjs=require(_0xc5a8('0xf'));var toCsv=require(_0xc5a8('0x8'));var querystring=require(_0xc5a8('0x10'));var Papa=require(_0xc5a8('0x11'));var Redis=require('ioredis');var authService=require(_0xc5a8('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc5a8('0x13'));var hardwareService=require(_0xc5a8('0x14'));var logger=require(_0xc5a8('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xc5a8('0x16'));var licenseUtil=require(_0xc5a8('0x17'));var db=require(_0xc5a8('0x18'))['db'];config[_0xc5a8('0x19')]=_[_0xc5a8('0x1a')](config['redis'],{'host':_0xc5a8('0x1b'),'port':0x18eb});var socket=require(_0xc5a8('0x1c'))(new Redis(config[_0xc5a8('0x19')]));require(_0xc5a8('0x1d'))[_0xc5a8('0x1e')](socket);function respondWithStatusCode(_0x219823,_0x365df5){_0x365df5=_0x365df5||0xcc;return function(_0x26d87c){if(_0x26d87c){return _0x219823[_0xc5a8('0x1f')](_0x365df5);}return _0x219823[_0xc5a8('0x20')](_0x365df5)[_0xc5a8('0x21')]();};}function respondWithResult(_0x443376,_0x393e1c){_0x393e1c=_0x393e1c||0xc8;return function(_0x1cb591){if(_0x1cb591){return _0x443376[_0xc5a8('0x20')](_0x393e1c)[_0xc5a8('0x22')](_0x1cb591);}};}function respondWithFilteredResult(_0x22b230,_0x2fb8eb){return function(_0x506c10){if(_0x506c10){var _0x134589=typeof _0x2fb8eb[_0xc5a8('0x23')]===_0xc5a8('0x24')&&typeof _0x2fb8eb[_0xc5a8('0x25')]==='undefined';var _0x326baf=_0x506c10['count'];var _0x36cc16=_0x134589?0x0:_0x2fb8eb[_0xc5a8('0x23')];var _0x35ac5a=_0x134589?_0x506c10['count']:_0x2fb8eb['offset']+_0x2fb8eb['limit'];var _0x332ee2;if(_0x35ac5a>=_0x326baf){_0x35ac5a=_0x326baf;_0x332ee2=0xc8;}else{_0x332ee2=0xce;}_0x22b230[_0xc5a8('0x20')](_0x332ee2);return _0x22b230[_0xc5a8('0x26')](_0xc5a8('0x27'),_0x36cc16+'-'+_0x35ac5a+'/'+_0x326baf)['json'](_0x506c10);}return null;};}function patchUpdates(_0x1a8662){return function(_0x8b6473){try{jsonpatch[_0xc5a8('0x28')](_0x8b6473,_0x1a8662,!![]);}catch(_0x36d2c6){return BPromise['reject'](_0x36d2c6);}return _0x8b6473[_0xc5a8('0x29')]();};}function saveUpdates(_0x4865dd,_0x25e56d){return function(_0x4616ec){if(_0x4616ec){return _0x4616ec[_0xc5a8('0x2a')](_0x4865dd)[_0xc5a8('0x2b')](function(_0x5c8705){return _0x5c8705;});}return null;};}function removeEntity(_0x3448c1,_0x459694){return function(_0x208333){if(_0x208333){return _0x208333[_0xc5a8('0x2c')]()[_0xc5a8('0x2b')](function(){var _0x1a49ad=_0x208333[_0xc5a8('0x2d')]({'plain':!![]});var _0x165ee0='MailQueues';return db[_0xc5a8('0x2e')]['destroy']({'where':{'type':_0x165ee0,'resourceId':_0x1a49ad['id']}})[_0xc5a8('0x2b')](function(){return _0x208333;});})['then'](function(){_0x3448c1[_0xc5a8('0x20')](0xcc)[_0xc5a8('0x21')]();});}};}function handleEntityNotFound(_0x505b27,_0x10569a){return function(_0x2aa6d6){if(!_0x2aa6d6){_0x505b27[_0xc5a8('0x1f')](0x194);}return _0x2aa6d6;};}function handleError(_0x2102c7,_0xa7f8f2){_0xa7f8f2=_0xa7f8f2||0x1f4;return function(_0x2d7fae){logger[_0xc5a8('0x2f')](_0x2d7fae[_0xc5a8('0x30')]);if(_0x2d7fae[_0xc5a8('0x31')]){delete _0x2d7fae[_0xc5a8('0x31')];}_0x2102c7[_0xc5a8('0x20')](_0xa7f8f2)[_0xc5a8('0x32')](_0x2d7fae);};}exports[_0xc5a8('0x33')]=function(_0x3c1b7c,_0x434d67){var _0x25ebbd={},_0x702dba={},_0x11a820={'count':0x0,'rows':[]};var _0x450e89=_[_0xc5a8('0x34')](db[_0xc5a8('0x35')][_0xc5a8('0x36')],function(_0x2906f4){return{'name':_0x2906f4['fieldName'],'type':_0x2906f4['type'][_0xc5a8('0x37')]};});_0x702dba[_0xc5a8('0x38')]=_[_0xc5a8('0x34')](_0x450e89,'name');_0x702dba[_0xc5a8('0x39')]=_[_0xc5a8('0x3a')](_0x3c1b7c[_0xc5a8('0x39')]);_0x702dba[_0xc5a8('0x3b')]=_['intersection'](_0x702dba['model'],_0x702dba['query']);_0x25ebbd[_0xc5a8('0x3c')]=_[_0xc5a8('0x3d')](_0x702dba[_0xc5a8('0x38')],qs[_0xc5a8('0x3e')](_0x3c1b7c[_0xc5a8('0x39')]['fields']));_0x25ebbd[_0xc5a8('0x3c')]=_0x25ebbd[_0xc5a8('0x3c')]['length']?_0x25ebbd[_0xc5a8('0x3c')]:_0x702dba['model'];if(!_0x3c1b7c[_0xc5a8('0x39')][_0xc5a8('0x3f')](_0xc5a8('0x40'))){_0x25ebbd[_0xc5a8('0x25')]=qs[_0xc5a8('0x25')](_0x3c1b7c[_0xc5a8('0x39')]['limit']);_0x25ebbd[_0xc5a8('0x23')]=qs[_0xc5a8('0x23')](_0x3c1b7c[_0xc5a8('0x39')][_0xc5a8('0x23')]);}_0x25ebbd[_0xc5a8('0x41')]=qs[_0xc5a8('0x42')](_0x3c1b7c[_0xc5a8('0x39')][_0xc5a8('0x42')]);_0x25ebbd['where']=qs[_0xc5a8('0x3b')](_[_0xc5a8('0x43')](_0x3c1b7c[_0xc5a8('0x39')],_0x702dba[_0xc5a8('0x3b')]),_0x450e89);if(_0x3c1b7c['query'][_0xc5a8('0x44')]){_0x25ebbd['where']=_[_0xc5a8('0x45')](_0x25ebbd[_0xc5a8('0x46')],{'$or':_[_0xc5a8('0x34')](_0x450e89,function(_0x521f76){if(_0x521f76[_0xc5a8('0x47')]!==_0xc5a8('0x48')){var _0x1a8423={};_0x1a8423[_0x521f76['name']]={'$like':'%'+_0x3c1b7c['query']['filter']+'%'};return _0x1a8423;}})});}_0x25ebbd=_[_0xc5a8('0x45')]({},_0x25ebbd,_0x3c1b7c[_0xc5a8('0x49')]);var _0xfa8f3b={'where':_0x25ebbd['where']};return db[_0xc5a8('0x35')]['count'](_0xfa8f3b)['then'](function(_0x5b2284){_0x11a820['count']=_0x5b2284;if(_0x3c1b7c['query']['includeAll']){_0x25ebbd[_0xc5a8('0x4a')]=[{'all':!![]}];}return db[_0xc5a8('0x35')][_0xc5a8('0x4b')](_0x25ebbd);})[_0xc5a8('0x2b')](function(_0x922cc4){_0x11a820[_0xc5a8('0x4c')]=_0x922cc4;return _0x11a820;})[_0xc5a8('0x2b')](respondWithFilteredResult(_0x434d67,_0x25ebbd))[_0xc5a8('0x4d')](handleError(_0x434d67,null));};exports[_0xc5a8('0x4e')]=function(_0x4c5755,_0x1a16ef){var _0x3cd62f={'raw':!![],'where':{'id':_0x4c5755[_0xc5a8('0x4f')]['id']}},_0x18a655={};_0x18a655['model']=_[_0xc5a8('0x3a')](db[_0xc5a8('0x35')][_0xc5a8('0x36')]);_0x18a655[_0xc5a8('0x39')]=_['keys'](_0x4c5755['query']);_0x18a655[_0xc5a8('0x3b')]=_[_0xc5a8('0x3d')](_0x18a655[_0xc5a8('0x38')],_0x18a655['query']);_0x3cd62f[_0xc5a8('0x3c')]=_[_0xc5a8('0x3d')](_0x18a655[_0xc5a8('0x38')],qs[_0xc5a8('0x3e')](_0x4c5755[_0xc5a8('0x39')]['fields']));_0x3cd62f[_0xc5a8('0x3c')]=_0x3cd62f['attributes'][_0xc5a8('0x50')]?_0x3cd62f[_0xc5a8('0x3c')]:_0x18a655['model'];if(_0x4c5755['query'][_0xc5a8('0x51')]){_0x3cd62f[_0xc5a8('0x4a')]=[{'all':!![]}];}_0x3cd62f=_['merge']({},_0x3cd62f,_0x4c5755['options']);return db[_0xc5a8('0x35')][_0xc5a8('0x52')](_0x3cd62f)[_0xc5a8('0x2b')](handleEntityNotFound(_0x1a16ef,null))[_0xc5a8('0x2b')](respondWithResult(_0x1a16ef,null))[_0xc5a8('0x4d')](handleError(_0x1a16ef,null));};exports[_0xc5a8('0x53')]=function(_0x594d7a,_0x534136){return db['MailQueue']['create'](_0x594d7a[_0xc5a8('0x54')],{})[_0xc5a8('0x2b')](function(_0x796f8a){var _0x4a930c=_0x594d7a['user'][_0xc5a8('0x2d')]({'plain':!![]});if(!_0x4a930c)throw new Error(_0xc5a8('0x55'));if(_0x4a930c['role']==='user'){var _0x65798f=_0x796f8a[_0xc5a8('0x2d')]({'plain':!![]});var _0xa227dd='MailQueues';return db[_0xc5a8('0x56')][_0xc5a8('0x52')]({'where':{'name':_0xa227dd,'userProfileId':_0x4a930c[_0xc5a8('0x57')]},'raw':!![]})[_0xc5a8('0x2b')](function(_0x3be874){if(_0x3be874&&_0x3be874[_0xc5a8('0x58')]===0x0){return db['UserProfileResource'][_0xc5a8('0x53')]({'name':_0x65798f[_0xc5a8('0x31')],'resourceId':_0x65798f['id'],'type':_0x3be874[_0xc5a8('0x31')],'sectionId':_0x3be874['id']},{})['then'](function(){return _0x796f8a;});}else{return _0x796f8a;}})[_0xc5a8('0x4d')](function(_0x86f7cc){logger[_0xc5a8('0x2f')](_0xc5a8('0x59'),_0x86f7cc);throw _0x86f7cc;});}return _0x796f8a;})[_0xc5a8('0x2b')](respondWithResult(_0x534136,0xc9))[_0xc5a8('0x4d')](handleError(_0x534136,null));};exports[_0xc5a8('0x2a')]=function(_0x2a8e77,_0x10250c){if(_0x2a8e77[_0xc5a8('0x54')]['id']){delete _0x2a8e77['body']['id'];}return db['MailQueue'][_0xc5a8('0x52')]({'where':{'id':_0x2a8e77[_0xc5a8('0x4f')]['id']}})[_0xc5a8('0x2b')](handleEntityNotFound(_0x10250c,null))[_0xc5a8('0x2b')](saveUpdates(_0x2a8e77[_0xc5a8('0x54')],null))['then'](respondWithResult(_0x10250c,null))[_0xc5a8('0x4d')](handleError(_0x10250c,null));};exports[_0xc5a8('0x2c')]=function(_0x567f10,_0x15f177){return db[_0xc5a8('0x35')][_0xc5a8('0x52')]({'where':{'id':_0x567f10[_0xc5a8('0x4f')]['id']}})[_0xc5a8('0x2b')](handleEntityNotFound(_0x15f177,null))[_0xc5a8('0x2b')](removeEntity(_0x15f177,null))[_0xc5a8('0x4d')](handleError(_0x15f177,null));};exports['describe']=function(_0x3ba2b1,_0x53b074){return db[_0xc5a8('0x35')][_0xc5a8('0x5a')]()[_0xc5a8('0x2b')](respondWithResult(_0x53b074,null))[_0xc5a8('0x4d')](handleError(_0x53b074,null));};exports[_0xc5a8('0x5b')]=function(_0x2570d6,_0x561985,_0x3a3986){var _0x1d911c={'raw':!![],'where':{}},_0x423b7e={},_0x22bfc3;return db['MailQueue']['findOne']({'where':{'id':_0x2570d6['params']['id']}})[_0xc5a8('0x2b')](handleEntityNotFound(_0x561985,null))['then'](function(_0x58c900){if(_0x58c900){_0x22bfc3=_0x58c900['get']({'plain':!![]});_0x423b7e[_0xc5a8('0x38')]=_[_0xc5a8('0x3a')](db[_0xc5a8('0x5c')][_0xc5a8('0x36')]);_0x423b7e['query']=_[_0xc5a8('0x3a')](_0x2570d6['query']);_0x423b7e[_0xc5a8('0x3b')]=_[_0xc5a8('0x3d')](_0x423b7e['model'],_0x423b7e[_0xc5a8('0x39')]);_0x1d911c[_0xc5a8('0x3c')]=_['intersection'](_0x423b7e[_0xc5a8('0x38')],qs[_0xc5a8('0x3e')](_0x2570d6[_0xc5a8('0x39')][_0xc5a8('0x3e')]));_0x1d911c[_0xc5a8('0x3c')]=_0x1d911c[_0xc5a8('0x3c')][_0xc5a8('0x50')]?_0x1d911c[_0xc5a8('0x3c')]:_0x423b7e[_0xc5a8('0x38')];if(!_0x2570d6[_0xc5a8('0x39')][_0xc5a8('0x3f')](_0xc5a8('0x40'))){_0x1d911c[_0xc5a8('0x25')]=qs[_0xc5a8('0x25')](_0x2570d6[_0xc5a8('0x39')]['limit']);_0x1d911c[_0xc5a8('0x23')]=qs[_0xc5a8('0x23')](_0x2570d6['query'][_0xc5a8('0x23')]);}_0x1d911c[_0xc5a8('0x41')]=qs[_0xc5a8('0x42')](_0x2570d6['query'][_0xc5a8('0x42')]);_0x1d911c['where']=qs['filters'](_['pick'](_0x2570d6[_0xc5a8('0x39')],_0x423b7e[_0xc5a8('0x3b')]));_0x1d911c[_0xc5a8('0x46')][_0xc5a8('0x5d')]=_0x58c900['id'];if(_0x2570d6[_0xc5a8('0x39')][_0xc5a8('0x44')]){_0x1d911c[_0xc5a8('0x46')]=_[_0xc5a8('0x45')](_0x1d911c['where'],{'$or':_[_0xc5a8('0x34')](_0x1d911c['attributes'],function(_0x3418b0){var _0x553463={};_0x553463[_0x3418b0]={'$like':'%'+_0x2570d6[_0xc5a8('0x39')]['filter']+'%'};return _0x553463;})});}_0x1d911c=_['merge']({},_0x1d911c,_0x2570d6[_0xc5a8('0x49')]);return db[_0xc5a8('0x5c')]['findAll'](_0x1d911c);}})['then'](function(_0x23a5aa){if(_0x23a5aa){return db[_0xc5a8('0x5e')]['findAndCountAll']({'where':{'id':_['map'](_0x23a5aa,_0xc5a8('0x5f')),'role':_0xc5a8('0x60')},'attributes':['id',_0xc5a8('0x31'),_0xc5a8('0x61'),_0xc5a8('0x62'),_0xc5a8('0x63')]});}})[_0xc5a8('0x2b')](function(_0x1f7699){if(_0x1f7699){return{'count':_0x1f7699[_0xc5a8('0x64')],'rows':_['map'](_0x1f7699[_0xc5a8('0x4c')],function(_0x358b68){return{'membername':_0x358b68[_0xc5a8('0x31')],'UserId':_0x358b68['id'],'queue_name':_0x22bfc3[_0xc5a8('0x31')],'MailQueueId':_0x22bfc3['id'],'interface':util[_0xc5a8('0x65')](_0xc5a8('0x66'),_0xc5a8('0x67'),_0x358b68[_0xc5a8('0x31')]),'penalty':0x0,'paused':_0x358b68[_0xc5a8('0x61')],'createdAt':_0x358b68[_0xc5a8('0x63')],'updatedAt':_0x358b68['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x561985,_0x1d911c))[_0xc5a8('0x4d')](handleError(_0x561985,null));};exports[_0xc5a8('0x68')]=function(_0x374f7e,_0x5d3012,_0x25cbcb){var _0x3f5200={};var _0x3fd9d9={};var _0x5a4f99;var _0x510a99;return db[_0xc5a8('0x35')][_0xc5a8('0x69')]({'where':{'id':_0x374f7e[_0xc5a8('0x4f')]['id']}})[_0xc5a8('0x2b')](handleEntityNotFound(_0x5d3012,null))['then'](function(_0x1edc2a){if(_0x1edc2a){_0x5a4f99=_0x1edc2a;_0x3fd9d9[_0xc5a8('0x38')]=_[_0xc5a8('0x3a')](db[_0xc5a8('0x6a')][_0xc5a8('0x36')]);_0x3fd9d9['query']=_[_0xc5a8('0x3a')](_0x374f7e[_0xc5a8('0x39')]);_0x3fd9d9[_0xc5a8('0x3b')]=_['intersection'](_0x3fd9d9['model'],_0x3fd9d9[_0xc5a8('0x39')]);_0x3f5200['attributes']=_[_0xc5a8('0x3d')](_0x3fd9d9[_0xc5a8('0x38')],qs[_0xc5a8('0x3e')](_0x374f7e[_0xc5a8('0x39')][_0xc5a8('0x3e')]));_0x3f5200[_0xc5a8('0x3c')]=_0x3f5200[_0xc5a8('0x3c')]['length']?_0x3f5200[_0xc5a8('0x3c')]:_0x3fd9d9['model'];_0x3f5200[_0xc5a8('0x41')]=qs[_0xc5a8('0x42')](_0x374f7e[_0xc5a8('0x39')]['sort']);_0x3f5200[_0xc5a8('0x46')]=qs[_0xc5a8('0x3b')](_['pick'](_0x374f7e['query'],_0x3fd9d9[_0xc5a8('0x3b')]));if(_0x374f7e[_0xc5a8('0x39')][_0xc5a8('0x44')]){_0x3f5200[_0xc5a8('0x46')]=_[_0xc5a8('0x45')](_0x3f5200['where'],{'$or':_[_0xc5a8('0x34')](_0x3f5200[_0xc5a8('0x3c')],function(_0x465150){var _0x35708b={};_0x35708b[_0x465150]={'$like':'%'+_0x374f7e[_0xc5a8('0x39')][_0xc5a8('0x44')]+'%'};return _0x35708b;})});}_0x3f5200=_[_0xc5a8('0x45')]({},_0x3f5200,_0x374f7e[_0xc5a8('0x49')]);return _0x5a4f99[_0xc5a8('0x68')](_0x3f5200);}})[_0xc5a8('0x2b')](function(_0x470c9f){if(_0x470c9f){_0x510a99=_0x470c9f['length'];if(!_0x374f7e['query'][_0xc5a8('0x3f')]('nolimit')){_0x3f5200['limit']=qs[_0xc5a8('0x25')](_0x374f7e[_0xc5a8('0x39')][_0xc5a8('0x25')]);_0x3f5200[_0xc5a8('0x23')]=qs[_0xc5a8('0x23')](_0x374f7e[_0xc5a8('0x39')][_0xc5a8('0x23')]);}return _0x5a4f99[_0xc5a8('0x68')](_0x3f5200);}})[_0xc5a8('0x2b')](function(_0x350e34){if(_0x350e34){return _0x350e34?{'count':_0x510a99,'rows':_0x350e34}:null;}})[_0xc5a8('0x2b')](respondWithResult(_0x5d3012,null))[_0xc5a8('0x4d')](handleError(_0x5d3012,null));};exports['addTeams']=function(_0x2b6452,_0x58d1c2,_0x3d5c19){var _0x442da0=_0x2b6452[_0xc5a8('0x54')]['ids'];return db[_0xc5a8('0x6a')][_0xc5a8('0x4b')]({'where':{'id':_0x442da0},'attributes':['id'],'include':[{'model':db[_0xc5a8('0x5e')],'as':_0xc5a8('0x6b'),'attributes':['id',_0xc5a8('0x31'),_0xc5a8('0x6c'),_0xc5a8('0x6d'),'interface'],'raw':!![]}]})[_0xc5a8('0x2b')](function(_0x4c4a40){if(_0x4c4a40){var _0x451212=_[_0xc5a8('0x6e')](_0x4c4a40,function(_0x357879){var _0x583020=_0x357879[_0xc5a8('0x2d')]({'plain':!![]});return _0x583020[_0xc5a8('0x6b')];});return db[_0xc5a8('0x35')]['find']({'where':{'id':_0x2b6452['params']['id']}})['then'](function(_0x10d6b1){return db[_0xc5a8('0x6f')][_0xc5a8('0x70')](function(_0x4a4699){return _0x10d6b1[_0xc5a8('0x71')](_0x442da0,{'transaction':_0x4a4699})[_0xc5a8('0x2b')](function(){return BPromise[_0xc5a8('0x72')](_0x451212,function(_0x1b1e7c){return db[_0xc5a8('0x5c')][_0xc5a8('0x73')]({'where':{'UserId':_0x1b1e7c['id'],'MailQueueId':_0x2b6452[_0xc5a8('0x4f')]['id']},'transaction':_0x4a4699});});})[_0xc5a8('0x2b')](function(){_0x451212[_0xc5a8('0x74')](function(_0x2b552e){socket[_0xc5a8('0x75')](_0xc5a8('0x76'),{'UserId':_0x2b552e['id'],'MailQueueId':_0x10d6b1['id']});});});});});}})[_0xc5a8('0x2b')](respondWithStatusCode(_0x58d1c2,null))[_0xc5a8('0x4d')](handleError(_0x58d1c2,null));};exports[_0xc5a8('0x77')]=function(_0x496776,_0x1efa66,_0x8b52e9){return db[_0xc5a8('0x6a')][_0xc5a8('0x4b')]({'where':{'id':_0x496776[_0xc5a8('0x39')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc5a8('0x2b')](handleEntityNotFound(_0x1efa66,null))[_0xc5a8('0x2b')](function(_0x2df4c8){var _0x468285=_[_0xc5a8('0x34')](_0x2df4c8,'id');var _0x3eac0d=[];var _0x2569ba=[];var _0x115485=squel[_0xc5a8('0x78')]();_0x115485[_0xc5a8('0x79')](_0xc5a8('0x7a'))['from']('team_has_mail_queues','tq')['join'](_0xc5a8('0x7b'),'ut',_0xc5a8('0x7c'))[_0xc5a8('0x46')](_0xc5a8('0x7d'),_0x496776['params']['id']);for(var _0x3a967a=0x0;_0x3a967a<_0x2df4c8[_0xc5a8('0x50')];_0x3a967a+=0x1){let _0x5480ee=_0x2df4c8[_0x3a967a];for(var _0x5e4c82=0x0;_0x5e4c82<_0x5480ee['Agents'][_0xc5a8('0x50')];_0x5e4c82+=0x1){let _0x37f115=_0x5480ee[_0xc5a8('0x6b')][_0x5e4c82];var _0x26dd09=_0x115485[_0xc5a8('0x7e')]();_0x26dd09['where']('ut.UserId\x20=\x20?',_0x37f115['id']);_0x2569ba['push'](db['sequelize'][_0xc5a8('0x39')](_0x26dd09[_0xc5a8('0x7f')](),{'type':db[_0xc5a8('0x6f')][_0xc5a8('0x80')][_0xc5a8('0x81')]})[_0xc5a8('0x2b')](function(_0x347e89){if(_0x347e89[_0xc5a8('0x50')]===0x1){return _0x37f115['id'];}else{var _0x30101a=_['every'](_['map'](_0x347e89,'TeamId'),function(_0x49cb46){return _['includes'](_0x468285,_0x49cb46);});if(_0x30101a){return _0x37f115['id'];}}}));}}return BPromise[_0xc5a8('0x82')](_0x2569ba)[_0xc5a8('0x2b')](function(_0x236200){_0x3eac0d=_(_0x3eac0d)['union'](_0x236200)[_0xc5a8('0x83')]()[_0xc5a8('0x84')]();return db[_0xc5a8('0x35')]['find']({'where':{'id':_0x496776[_0xc5a8('0x4f')]['id']}})[_0xc5a8('0x2b')](function(_0x29c0fe){return db[_0xc5a8('0x6f')][_0xc5a8('0x70')](function(_0x2f8302){return _0x29c0fe['removeTeams'](_0x496776['query']['ids'],{'transaction':_0x2f8302})['then'](function(){if(!_[_0xc5a8('0x85')](_0x3eac0d)){return _0x29c0fe[_0xc5a8('0x86')](_0x3eac0d,{'transaction':_0x2f8302});}})[_0xc5a8('0x2b')](function(){_0x3eac0d['forEach'](function(_0x5b26a9){socket[_0xc5a8('0x75')](_0xc5a8('0x87'),{'UserId':_0x5b26a9,'MailQueueId':_0x29c0fe['id']});});});});});});})[_0xc5a8('0x2b')](respondWithStatusCode(_0x1efa66,null))['catch'](handleError(_0x1efa66,null));};exports['addAgents']=function(_0x1f7c09,_0x30bb1a,_0x4d868e){return db[_0xc5a8('0x35')][_0xc5a8('0x52')]({'where':{'id':_0x1f7c09[_0xc5a8('0x4f')]['id']}})[_0xc5a8('0x2b')](handleEntityNotFound(_0x30bb1a,null))[_0xc5a8('0x2b')](function(_0x41e5f6){if(_0x41e5f6){return _0x41e5f6[_0xc5a8('0x88')](_0x1f7c09[_0xc5a8('0x54')][_0xc5a8('0x89')],_[_0xc5a8('0x8a')](_0x1f7c09[_0xc5a8('0x54')],[_0xc5a8('0x89'),'id'])||{})[_0xc5a8('0x8b')](function(_0x3e9645){for(var _0x49e87f=0x0;_0x49e87f<_0x1f7c09[_0xc5a8('0x54')]['ids'][_0xc5a8('0x50')];_0x49e87f+=0x1){socket[_0xc5a8('0x75')](_0xc5a8('0x76'),{'UserId':Number(_0x1f7c09[_0xc5a8('0x54')][_0xc5a8('0x89')][_0x49e87f]),'MailQueueId':Number(_0x1f7c09[_0xc5a8('0x4f')]['id'])});}return _0x3e9645;});}})[_0xc5a8('0x2b')](respondWithResult(_0x30bb1a,null))['catch'](handleError(_0x30bb1a,null));};exports['removeAgents']=function(_0x59a74f,_0x54b003,_0x5b8053){return db[_0xc5a8('0x35')][_0xc5a8('0x52')]({'where':{'id':_0x59a74f[_0xc5a8('0x4f')]['id']}})[_0xc5a8('0x2b')](handleEntityNotFound(_0x54b003,null))[_0xc5a8('0x2b')](function(_0x524016){if(_0x524016){return _0x524016[_0xc5a8('0x86')](_0x59a74f['query'][_0xc5a8('0x89')])[_0xc5a8('0x2b')](function(){if(_[_0xc5a8('0x8c')](_0x59a74f['query'][_0xc5a8('0x89')])){for(var _0x16c1a1=0x0;_0x16c1a1<_0x59a74f['query'][_0xc5a8('0x89')][_0xc5a8('0x50')];_0x16c1a1+=0x1){socket[_0xc5a8('0x75')](_0xc5a8('0x87'),{'UserId':Number(_0x59a74f[_0xc5a8('0x39')]['ids'][_0x16c1a1]),'MailQueueId':Number(_0x59a74f['params']['id'])});}}else{socket[_0xc5a8('0x75')](_0xc5a8('0x87'),{'UserId':Number(_0x59a74f[_0xc5a8('0x39')][_0xc5a8('0x89')]),'MailQueueId':Number(_0x59a74f[_0xc5a8('0x4f')]['id'])});}});}})[_0xc5a8('0x2b')](respondWithStatusCode(_0x54b003,null))[_0xc5a8('0x4d')](handleError(_0x54b003,null));};exports[_0xc5a8('0x8d')]=function(_0x47c50e,_0x693602,_0x4a85fa){var _0x5280e4={};var _0x378a26={};var _0x42fa60;var _0x3fa9ea;return db[_0xc5a8('0x35')][_0xc5a8('0x69')]({'where':{'id':_0x47c50e[_0xc5a8('0x4f')]['id']}})['then'](handleEntityNotFound(_0x693602,null))[_0xc5a8('0x2b')](function(_0x537435){if(_0x537435){_0x42fa60=_0x537435;_0x378a26[_0xc5a8('0x38')]=_[_0xc5a8('0x3a')](db[_0xc5a8('0x5e')]['rawAttributes']);_0x378a26[_0xc5a8('0x39')]=_['keys'](_0x47c50e[_0xc5a8('0x39')]);_0x378a26[_0xc5a8('0x3b')]=_[_0xc5a8('0x3d')](_0x378a26[_0xc5a8('0x38')],_0x378a26[_0xc5a8('0x39')]);_0x5280e4[_0xc5a8('0x3c')]=_[_0xc5a8('0x3d')](_0x378a26[_0xc5a8('0x38')],qs[_0xc5a8('0x3e')](_0x47c50e[_0xc5a8('0x39')][_0xc5a8('0x3e')]));_0x5280e4['attributes']=_0x5280e4[_0xc5a8('0x3c')][_0xc5a8('0x50')]?_0x5280e4[_0xc5a8('0x3c')]:_0x378a26[_0xc5a8('0x38')];_0x5280e4['order']=qs[_0xc5a8('0x42')](_0x47c50e['query'][_0xc5a8('0x42')]);_0x5280e4[_0xc5a8('0x46')]=qs[_0xc5a8('0x3b')](_[_0xc5a8('0x43')](_0x47c50e[_0xc5a8('0x39')],_0x378a26[_0xc5a8('0x3b')]));if(_0x47c50e[_0xc5a8('0x39')]['filter']){_0x5280e4[_0xc5a8('0x46')]=_[_0xc5a8('0x45')](_0x5280e4['where'],{'$or':_[_0xc5a8('0x34')](_0x5280e4[_0xc5a8('0x3c')],function(_0x2dc6fe){var _0x1177bb={};_0x1177bb[_0x2dc6fe]={'$like':'%'+_0x47c50e[_0xc5a8('0x39')][_0xc5a8('0x44')]+'%'};return _0x1177bb;})});}_0x5280e4=_[_0xc5a8('0x45')]({},_0x5280e4,_0x47c50e[_0xc5a8('0x49')]);return _0x42fa60['getAgents'](_0x5280e4);}})[_0xc5a8('0x2b')](function(_0x3ab220){if(_0x3ab220){_0x3fa9ea=_0x3ab220['length'];if(!_0x47c50e[_0xc5a8('0x39')]['hasOwnProperty'](_0xc5a8('0x40'))){_0x5280e4[_0xc5a8('0x25')]=qs[_0xc5a8('0x25')](_0x47c50e['query'][_0xc5a8('0x25')]);_0x5280e4[_0xc5a8('0x23')]=qs['offset'](_0x47c50e['query'][_0xc5a8('0x23')]);}return _0x42fa60[_0xc5a8('0x8d')](_0x5280e4);}})[_0xc5a8('0x2b')](function(_0x3d5307){if(_0x3d5307){return _0x3d5307?{'count':_0x3fa9ea,'rows':_0x3d5307}:null;}})[_0xc5a8('0x2b')](respondWithResult(_0x693602,null))[_0xc5a8('0x4d')](handleError(_0x693602,null));}; \ No newline at end of file +var _0xb88f=['sequelize','findOrCreate','forEach','removeTeams','select','field','from','team_has_mail_queues','join','user_has_teams','MailQueueId\x20=\x20?','clone','SELECT','every','TeamId','includes','all','compact','value','transaction','emit','userMailQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','status','undefined','limit','count','offset','Content-Range','json','reject','save','then','destroy','get','UserProfileResource','sendStatus','stack','index','map','MailQueue','rawAttributes','type','model','name','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','MailQueues','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','findOne','UserMailQueue','order','MailQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','%s/%s','SIP','mailPause','getTeams','Team','hasOwnProperty','addTeams','ids','Agents','online','interface','flatMap'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb88f,0x124));var _0xfb88=function(_0x2b5b44,_0x17189c){_0x2b5b44=_0x2b5b44-0x0;var _0x32cb66=_0xb88f[_0x2b5b44];return _0x32cb66;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfb88('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfb88('0x1'));var rp=require('request-promise');var moment=require(_0xfb88('0x2'));var BPromise=require(_0xfb88('0x3'));var Mustache=require(_0xfb88('0x4'));var util=require(_0xfb88('0x5'));var path=require(_0xfb88('0x6'));var sox=require('sox');var csv=require(_0xfb88('0x7'));var ejs=require(_0xfb88('0x8'));var fs=require('fs');var fs_extra=require(_0xfb88('0x9'));var _=require('lodash');var squel=require(_0xfb88('0xa'));var crypto=require('crypto');var jsforce=require(_0xfb88('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfb88('0xc'));var Papa=require(_0xfb88('0xd'));var Redis=require(_0xfb88('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfb88('0xf'));var hardwareService=require(_0xfb88('0x10'));var logger=require(_0xfb88('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfb88('0x12'));var db=require(_0xfb88('0x13'))['db'];config[_0xfb88('0x14')]=_[_0xfb88('0x15')](config[_0xfb88('0x14')],{'host':_0xfb88('0x16'),'port':0x18eb});var socket=require(_0xfb88('0x17'))(new Redis(config['redis']));require(_0xfb88('0x18'))[_0xfb88('0x19')](socket);function respondWithStatusCode(_0x7f226f,_0x1afae6){_0x1afae6=_0x1afae6||0xcc;return function(_0x5a8025){if(_0x5a8025){return _0x7f226f['sendStatus'](_0x1afae6);}return _0x7f226f[_0xfb88('0x1a')](_0x1afae6)['end']();};}function respondWithResult(_0x2d99c6,_0x1088e4){_0x1088e4=_0x1088e4||0xc8;return function(_0x1a9286){if(_0x1a9286){return _0x2d99c6[_0xfb88('0x1a')](_0x1088e4)['json'](_0x1a9286);}};}function respondWithFilteredResult(_0x2d95cc,_0x33c14e){return function(_0x3ce04c){if(_0x3ce04c){var _0x4e1458=typeof _0x33c14e['offset']===_0xfb88('0x1b')&&typeof _0x33c14e[_0xfb88('0x1c')]==='undefined';var _0x486d90=_0x3ce04c[_0xfb88('0x1d')];var _0x4d2166=_0x4e1458?0x0:_0x33c14e['offset'];var _0x2e97ae=_0x4e1458?_0x3ce04c[_0xfb88('0x1d')]:_0x33c14e[_0xfb88('0x1e')]+_0x33c14e[_0xfb88('0x1c')];var _0x117987;if(_0x2e97ae>=_0x486d90){_0x2e97ae=_0x486d90;_0x117987=0xc8;}else{_0x117987=0xce;}_0x2d95cc[_0xfb88('0x1a')](_0x117987);return _0x2d95cc['set'](_0xfb88('0x1f'),_0x4d2166+'-'+_0x2e97ae+'/'+_0x486d90)[_0xfb88('0x20')](_0x3ce04c);}return null;};}function patchUpdates(_0x40c4a3){return function(_0x5a5d51){try{jsonpatch['apply'](_0x5a5d51,_0x40c4a3,!![]);}catch(_0x5ce9ef){return BPromise[_0xfb88('0x21')](_0x5ce9ef);}return _0x5a5d51[_0xfb88('0x22')]();};}function saveUpdates(_0x630942,_0x5ef6b5){return function(_0x2503c6){if(_0x2503c6){return _0x2503c6['update'](_0x630942)[_0xfb88('0x23')](function(_0x50151e){return _0x50151e;});}return null;};}function removeEntity(_0x331fba,_0x3d185a){return function(_0x26f8fc){if(_0x26f8fc){return _0x26f8fc[_0xfb88('0x24')]()['then'](function(){var _0x3d67a3=_0x26f8fc[_0xfb88('0x25')]({'plain':!![]});var _0x215aa0='MailQueues';return db[_0xfb88('0x26')][_0xfb88('0x24')]({'where':{'type':_0x215aa0,'resourceId':_0x3d67a3['id']}})[_0xfb88('0x23')](function(){return _0x26f8fc;});})[_0xfb88('0x23')](function(){_0x331fba[_0xfb88('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59b0f8,_0x5c3ec1){return function(_0x5e6837){if(!_0x5e6837){_0x59b0f8[_0xfb88('0x27')](0x194);}return _0x5e6837;};}function handleError(_0x179a95,_0x186ad0){_0x186ad0=_0x186ad0||0x1f4;return function(_0x4c3a97){logger['error'](_0x4c3a97[_0xfb88('0x28')]);if(_0x4c3a97['name']){delete _0x4c3a97['name'];}_0x179a95['status'](_0x186ad0)['send'](_0x4c3a97);};}exports[_0xfb88('0x29')]=function(_0x403e4e,_0x931fe4){var _0x32eecc={},_0x14fa3d={},_0x431f6d={'count':0x0,'rows':[]};var _0x3e1005=_[_0xfb88('0x2a')](db[_0xfb88('0x2b')][_0xfb88('0x2c')],function(_0x35acad){return{'name':_0x35acad['fieldName'],'type':_0x35acad[_0xfb88('0x2d')]['key']};});_0x14fa3d[_0xfb88('0x2e')]=_['map'](_0x3e1005,_0xfb88('0x2f'));_0x14fa3d[_0xfb88('0x30')]=_[_0xfb88('0x31')](_0x403e4e['query']);_0x14fa3d[_0xfb88('0x32')]=_['intersection'](_0x14fa3d['model'],_0x14fa3d[_0xfb88('0x30')]);_0x32eecc[_0xfb88('0x33')]=_[_0xfb88('0x34')](_0x14fa3d['model'],qs[_0xfb88('0x35')](_0x403e4e[_0xfb88('0x30')][_0xfb88('0x35')]));_0x32eecc[_0xfb88('0x33')]=_0x32eecc[_0xfb88('0x33')][_0xfb88('0x36')]?_0x32eecc[_0xfb88('0x33')]:_0x14fa3d[_0xfb88('0x2e')];if(!_0x403e4e['query']['hasOwnProperty'](_0xfb88('0x37'))){_0x32eecc[_0xfb88('0x1c')]=qs['limit'](_0x403e4e['query']['limit']);_0x32eecc['offset']=qs[_0xfb88('0x1e')](_0x403e4e[_0xfb88('0x30')][_0xfb88('0x1e')]);}_0x32eecc['order']=qs['sort'](_0x403e4e[_0xfb88('0x30')][_0xfb88('0x38')]);_0x32eecc[_0xfb88('0x39')]=qs['filters'](_[_0xfb88('0x3a')](_0x403e4e[_0xfb88('0x30')],_0x14fa3d[_0xfb88('0x32')]),_0x3e1005);if(_0x403e4e[_0xfb88('0x30')][_0xfb88('0x3b')]){_0x32eecc[_0xfb88('0x39')]=_[_0xfb88('0x3c')](_0x32eecc[_0xfb88('0x39')],{'$or':_[_0xfb88('0x2a')](_0x3e1005,function(_0x57d4ef){if(_0x57d4ef[_0xfb88('0x2d')]!==_0xfb88('0x3d')){var _0x1d5a29={};_0x1d5a29[_0x57d4ef[_0xfb88('0x2f')]]={'$like':'%'+_0x403e4e[_0xfb88('0x30')][_0xfb88('0x3b')]+'%'};return _0x1d5a29;}})});}_0x32eecc=_['merge']({},_0x32eecc,_0x403e4e[_0xfb88('0x3e')]);var _0x4442a0={'where':_0x32eecc['where']};return db[_0xfb88('0x2b')][_0xfb88('0x1d')](_0x4442a0)['then'](function(_0x299029){_0x431f6d[_0xfb88('0x1d')]=_0x299029;if(_0x403e4e[_0xfb88('0x30')]['includeAll']){_0x32eecc[_0xfb88('0x3f')]=[{'all':!![]}];}return db[_0xfb88('0x2b')][_0xfb88('0x40')](_0x32eecc);})[_0xfb88('0x23')](function(_0x527401){_0x431f6d[_0xfb88('0x41')]=_0x527401;return _0x431f6d;})[_0xfb88('0x23')](respondWithFilteredResult(_0x931fe4,_0x32eecc))[_0xfb88('0x42')](handleError(_0x931fe4,null));};exports['show']=function(_0x552959,_0x4eb21c){var _0x1a9d55={'raw':!![],'where':{'id':_0x552959[_0xfb88('0x43')]['id']}},_0x176d2d={};_0x176d2d[_0xfb88('0x2e')]=_[_0xfb88('0x31')](db[_0xfb88('0x2b')][_0xfb88('0x2c')]);_0x176d2d['query']=_['keys'](_0x552959[_0xfb88('0x30')]);_0x176d2d[_0xfb88('0x32')]=_[_0xfb88('0x34')](_0x176d2d[_0xfb88('0x2e')],_0x176d2d['query']);_0x1a9d55[_0xfb88('0x33')]=_[_0xfb88('0x34')](_0x176d2d[_0xfb88('0x2e')],qs[_0xfb88('0x35')](_0x552959[_0xfb88('0x30')][_0xfb88('0x35')]));_0x1a9d55[_0xfb88('0x33')]=_0x1a9d55[_0xfb88('0x33')][_0xfb88('0x36')]?_0x1a9d55[_0xfb88('0x33')]:_0x176d2d[_0xfb88('0x2e')];if(_0x552959['query'][_0xfb88('0x44')]){_0x1a9d55[_0xfb88('0x3f')]=[{'all':!![]}];}_0x1a9d55=_['merge']({},_0x1a9d55,_0x552959['options']);return db[_0xfb88('0x2b')][_0xfb88('0x45')](_0x1a9d55)['then'](handleEntityNotFound(_0x4eb21c,null))[_0xfb88('0x23')](respondWithResult(_0x4eb21c,null))[_0xfb88('0x42')](handleError(_0x4eb21c,null));};exports[_0xfb88('0x46')]=function(_0x1c6647,_0x5b3e75){return db[_0xfb88('0x2b')]['create'](_0x1c6647['body'],{})[_0xfb88('0x23')](function(_0x53bff1){var _0x13ebda=_0x1c6647[_0xfb88('0x47')][_0xfb88('0x25')]({'plain':!![]});if(!_0x13ebda)throw new Error(_0xfb88('0x48'));if(_0x13ebda['role']===_0xfb88('0x47')){var _0x3c14d8=_0x53bff1[_0xfb88('0x25')]({'plain':!![]});var _0x4cec1b=_0xfb88('0x49');return db[_0xfb88('0x4a')]['find']({'where':{'name':_0x4cec1b,'userProfileId':_0x13ebda['userProfileId']},'raw':!![]})[_0xfb88('0x23')](function(_0x262119){if(_0x262119&&_0x262119[_0xfb88('0x4b')]===0x0){return db[_0xfb88('0x26')][_0xfb88('0x46')]({'name':_0x3c14d8['name'],'resourceId':_0x3c14d8['id'],'type':_0x262119[_0xfb88('0x2f')],'sectionId':_0x262119['id']},{})[_0xfb88('0x23')](function(){return _0x53bff1;});}else{return _0x53bff1;}})['catch'](function(_0x24f76e){logger[_0xfb88('0x4c')](_0xfb88('0x4d'),_0x24f76e);throw _0x24f76e;});}return _0x53bff1;})['then'](respondWithResult(_0x5b3e75,0xc9))[_0xfb88('0x42')](handleError(_0x5b3e75,null));};exports[_0xfb88('0x4e')]=function(_0x27c85d,_0x371eed){if(_0x27c85d[_0xfb88('0x4f')]['id']){delete _0x27c85d['body']['id'];}return db[_0xfb88('0x2b')]['find']({'where':{'id':_0x27c85d['params']['id']}})[_0xfb88('0x23')](handleEntityNotFound(_0x371eed,null))[_0xfb88('0x23')](saveUpdates(_0x27c85d['body'],null))[_0xfb88('0x23')](respondWithResult(_0x371eed,null))[_0xfb88('0x42')](handleError(_0x371eed,null));};exports[_0xfb88('0x24')]=function(_0x1a03f8,_0x2d3844){return db[_0xfb88('0x2b')][_0xfb88('0x45')]({'where':{'id':_0x1a03f8[_0xfb88('0x43')]['id']}})[_0xfb88('0x23')](handleEntityNotFound(_0x2d3844,null))['then'](removeEntity(_0x2d3844,null))[_0xfb88('0x42')](handleError(_0x2d3844,null));};exports[_0xfb88('0x50')]=function(_0x4f981e,_0x2b81cb){return db[_0xfb88('0x2b')][_0xfb88('0x50')]()['then'](respondWithResult(_0x2b81cb,null))['catch'](handleError(_0x2b81cb,null));};exports[_0xfb88('0x51')]=function(_0x506709,_0x44bf7c,_0x22788f){var _0x4673be={'raw':!![],'where':{}},_0x2fa68d={},_0x59d9fe;return db[_0xfb88('0x2b')][_0xfb88('0x52')]({'where':{'id':_0x506709[_0xfb88('0x43')]['id']}})[_0xfb88('0x23')](handleEntityNotFound(_0x44bf7c,null))['then'](function(_0x38b14a){if(_0x38b14a){_0x59d9fe=_0x38b14a[_0xfb88('0x25')]({'plain':!![]});_0x2fa68d[_0xfb88('0x2e')]=_['keys'](db[_0xfb88('0x53')][_0xfb88('0x2c')]);_0x2fa68d['query']=_[_0xfb88('0x31')](_0x506709['query']);_0x2fa68d['filters']=_['intersection'](_0x2fa68d['model'],_0x2fa68d['query']);_0x4673be['attributes']=_[_0xfb88('0x34')](_0x2fa68d[_0xfb88('0x2e')],qs[_0xfb88('0x35')](_0x506709[_0xfb88('0x30')][_0xfb88('0x35')]));_0x4673be['attributes']=_0x4673be['attributes'][_0xfb88('0x36')]?_0x4673be[_0xfb88('0x33')]:_0x2fa68d[_0xfb88('0x2e')];if(!_0x506709[_0xfb88('0x30')]['hasOwnProperty'](_0xfb88('0x37'))){_0x4673be['limit']=qs[_0xfb88('0x1c')](_0x506709[_0xfb88('0x30')]['limit']);_0x4673be[_0xfb88('0x1e')]=qs[_0xfb88('0x1e')](_0x506709[_0xfb88('0x30')]['offset']);}_0x4673be[_0xfb88('0x54')]=qs['sort'](_0x506709[_0xfb88('0x30')][_0xfb88('0x38')]);_0x4673be[_0xfb88('0x39')]=qs[_0xfb88('0x32')](_[_0xfb88('0x3a')](_0x506709[_0xfb88('0x30')],_0x2fa68d[_0xfb88('0x32')]));_0x4673be[_0xfb88('0x39')][_0xfb88('0x55')]=_0x38b14a['id'];if(_0x506709[_0xfb88('0x30')]['filter']){_0x4673be[_0xfb88('0x39')]=_[_0xfb88('0x3c')](_0x4673be[_0xfb88('0x39')],{'$or':_[_0xfb88('0x2a')](_0x4673be[_0xfb88('0x33')],function(_0x3267b7){var _0x85e107={};_0x85e107[_0x3267b7]={'$like':'%'+_0x506709[_0xfb88('0x30')][_0xfb88('0x3b')]+'%'};return _0x85e107;})});}_0x4673be=_[_0xfb88('0x3c')]({},_0x4673be,_0x506709[_0xfb88('0x3e')]);return db['UserMailQueue']['findAll'](_0x4673be);}})[_0xfb88('0x23')](function(_0x45c1fe){if(_0x45c1fe){return db[_0xfb88('0x56')][_0xfb88('0x57')]({'where':{'id':_[_0xfb88('0x2a')](_0x45c1fe,_0xfb88('0x58')),'role':_0xfb88('0x59')},'attributes':['id',_0xfb88('0x2f'),'mailPause',_0xfb88('0x5a'),_0xfb88('0x5b')]});}})[_0xfb88('0x23')](function(_0x155481){if(_0x155481){return{'count':_0x155481['count'],'rows':_[_0xfb88('0x2a')](_0x155481[_0xfb88('0x41')],function(_0x222ccc){return{'membername':_0x222ccc['name'],'UserId':_0x222ccc['id'],'queue_name':_0x59d9fe['name'],'MailQueueId':_0x59d9fe['id'],'interface':util['format'](_0xfb88('0x5c'),_0xfb88('0x5d'),_0x222ccc['name']),'penalty':0x0,'paused':_0x222ccc[_0xfb88('0x5e')],'createdAt':_0x222ccc[_0xfb88('0x5b')],'updatedAt':_0x222ccc['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xfb88('0x23')](respondWithFilteredResult(_0x44bf7c,_0x4673be))[_0xfb88('0x42')](handleError(_0x44bf7c,null));};exports[_0xfb88('0x5f')]=function(_0x2573cf,_0x150de4,_0x466c7d){var _0x3ca016={};var _0x4ff439={};var _0x1c2ab6;var _0x3a354c;return db[_0xfb88('0x2b')]['findOne']({'where':{'id':_0x2573cf[_0xfb88('0x43')]['id']}})[_0xfb88('0x23')](handleEntityNotFound(_0x150de4,null))[_0xfb88('0x23')](function(_0x213836){if(_0x213836){_0x1c2ab6=_0x213836;_0x4ff439['model']=_['keys'](db[_0xfb88('0x60')]['rawAttributes']);_0x4ff439[_0xfb88('0x30')]=_[_0xfb88('0x31')](_0x2573cf[_0xfb88('0x30')]);_0x4ff439[_0xfb88('0x32')]=_[_0xfb88('0x34')](_0x4ff439[_0xfb88('0x2e')],_0x4ff439[_0xfb88('0x30')]);_0x3ca016[_0xfb88('0x33')]=_[_0xfb88('0x34')](_0x4ff439['model'],qs[_0xfb88('0x35')](_0x2573cf[_0xfb88('0x30')][_0xfb88('0x35')]));_0x3ca016[_0xfb88('0x33')]=_0x3ca016[_0xfb88('0x33')][_0xfb88('0x36')]?_0x3ca016['attributes']:_0x4ff439[_0xfb88('0x2e')];_0x3ca016['order']=qs[_0xfb88('0x38')](_0x2573cf[_0xfb88('0x30')][_0xfb88('0x38')]);_0x3ca016[_0xfb88('0x39')]=qs['filters'](_['pick'](_0x2573cf['query'],_0x4ff439[_0xfb88('0x32')]));if(_0x2573cf[_0xfb88('0x30')][_0xfb88('0x3b')]){_0x3ca016[_0xfb88('0x39')]=_[_0xfb88('0x3c')](_0x3ca016[_0xfb88('0x39')],{'$or':_[_0xfb88('0x2a')](_0x3ca016[_0xfb88('0x33')],function(_0x3aa5f6){var _0xbe5582={};_0xbe5582[_0x3aa5f6]={'$like':'%'+_0x2573cf[_0xfb88('0x30')][_0xfb88('0x3b')]+'%'};return _0xbe5582;})});}_0x3ca016=_['merge']({},_0x3ca016,_0x2573cf[_0xfb88('0x3e')]);return _0x1c2ab6['getTeams'](_0x3ca016);}})[_0xfb88('0x23')](function(_0x5bb93c){if(_0x5bb93c){_0x3a354c=_0x5bb93c[_0xfb88('0x36')];if(!_0x2573cf[_0xfb88('0x30')][_0xfb88('0x61')](_0xfb88('0x37'))){_0x3ca016[_0xfb88('0x1c')]=qs[_0xfb88('0x1c')](_0x2573cf[_0xfb88('0x30')][_0xfb88('0x1c')]);_0x3ca016[_0xfb88('0x1e')]=qs[_0xfb88('0x1e')](_0x2573cf['query'][_0xfb88('0x1e')]);}return _0x1c2ab6[_0xfb88('0x5f')](_0x3ca016);}})[_0xfb88('0x23')](function(_0x98f9bb){if(_0x98f9bb){return _0x98f9bb?{'count':_0x3a354c,'rows':_0x98f9bb}:null;}})[_0xfb88('0x23')](respondWithResult(_0x150de4,null))[_0xfb88('0x42')](handleError(_0x150de4,null));};exports[_0xfb88('0x62')]=function(_0x5ed516,_0xe7b8e4,_0x26797b){var _0x3744c8=_0x5ed516[_0xfb88('0x4f')][_0xfb88('0x63')];return db[_0xfb88('0x60')][_0xfb88('0x40')]({'where':{'id':_0x3744c8},'attributes':['id'],'include':[{'model':db[_0xfb88('0x56')],'as':_0xfb88('0x64'),'attributes':['id',_0xfb88('0x2f'),_0xfb88('0x65'),'voicePause',_0xfb88('0x66')],'raw':!![]}]})[_0xfb88('0x23')](function(_0x4f679d){if(_0x4f679d){var _0x2d2ae4=_[_0xfb88('0x67')](_0x4f679d,function(_0xa6de85){var _0x5b2452=_0xa6de85[_0xfb88('0x25')]({'plain':!![]});return _0x5b2452['Agents'];});return db[_0xfb88('0x2b')][_0xfb88('0x45')]({'where':{'id':_0x5ed516['params']['id']}})[_0xfb88('0x23')](function(_0x5435d6){return db[_0xfb88('0x68')]['transaction'](function(_0x14cc65){return _0x5435d6[_0xfb88('0x62')](_0x3744c8,{'transaction':_0x14cc65})['then'](function(){return BPromise['each'](_0x2d2ae4,function(_0x731d45){return db['UserMailQueue'][_0xfb88('0x69')]({'where':{'UserId':_0x731d45['id'],'MailQueueId':_0x5ed516[_0xfb88('0x43')]['id']},'transaction':_0x14cc65});});})[_0xfb88('0x23')](function(){_0x2d2ae4[_0xfb88('0x6a')](function(_0x3e9974){socket['emit']('userMailQueue:save',{'UserId':_0x3e9974['id'],'MailQueueId':_0x5435d6['id']});});});});});}})['then'](respondWithStatusCode(_0xe7b8e4,null))[_0xfb88('0x42')](handleError(_0xe7b8e4,null));};exports[_0xfb88('0x6b')]=function(_0x5241d1,_0x5e6aad,_0x30ff07){return db[_0xfb88('0x60')][_0xfb88('0x40')]({'where':{'id':_0x5241d1[_0xfb88('0x30')][_0xfb88('0x63')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xfb88('0x23')](handleEntityNotFound(_0x5e6aad,null))[_0xfb88('0x23')](function(_0xa7de9c){var _0x5050fa=_['map'](_0xa7de9c,'id');var _0x1a45d9=[];var _0x56b746=[];var _0x5efb50=squel[_0xfb88('0x6c')]();_0x5efb50[_0xfb88('0x6d')]('tq.TeamId')[_0xfb88('0x6e')](_0xfb88('0x6f'),'tq')[_0xfb88('0x70')](_0xfb88('0x71'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xfb88('0x72'),_0x5241d1[_0xfb88('0x43')]['id']);for(var _0x136692=0x0;_0x136692<_0xa7de9c[_0xfb88('0x36')];_0x136692+=0x1){let _0x16603b=_0xa7de9c[_0x136692];for(var _0x560b95=0x0;_0x560b95<_0x16603b[_0xfb88('0x64')]['length'];_0x560b95+=0x1){let _0x3928f1=_0x16603b[_0xfb88('0x64')][_0x560b95];var _0x42d6f6=_0x5efb50[_0xfb88('0x73')]();_0x42d6f6[_0xfb88('0x39')]('ut.UserId\x20=\x20?',_0x3928f1['id']);_0x56b746['push'](db[_0xfb88('0x68')]['query'](_0x42d6f6['toString'](),{'type':db[_0xfb88('0x68')]['QueryTypes'][_0xfb88('0x74')]})[_0xfb88('0x23')](function(_0x1103fb){if(_0x1103fb[_0xfb88('0x36')]===0x1){return _0x3928f1['id'];}else{var _0x19fd0e=_[_0xfb88('0x75')](_[_0xfb88('0x2a')](_0x1103fb,_0xfb88('0x76')),function(_0x11da28){return _[_0xfb88('0x77')](_0x5050fa,_0x11da28);});if(_0x19fd0e){return _0x3928f1['id'];}}}));}}return BPromise[_0xfb88('0x78')](_0x56b746)[_0xfb88('0x23')](function(_0x32b9b3){_0x1a45d9=_(_0x1a45d9)['union'](_0x32b9b3)[_0xfb88('0x79')]()[_0xfb88('0x7a')]();return db[_0xfb88('0x2b')][_0xfb88('0x45')]({'where':{'id':_0x5241d1['params']['id']}})[_0xfb88('0x23')](function(_0x38b3e5){return db[_0xfb88('0x68')][_0xfb88('0x7b')](function(_0x180d92){return _0x38b3e5[_0xfb88('0x6b')](_0x5241d1[_0xfb88('0x30')]['ids'],{'transaction':_0x180d92})[_0xfb88('0x23')](function(){if(!_['isEmpty'](_0x1a45d9)){return _0x38b3e5['removeAgents'](_0x1a45d9,{'transaction':_0x180d92});}})[_0xfb88('0x23')](function(){_0x1a45d9[_0xfb88('0x6a')](function(_0x1011a9){socket[_0xfb88('0x7c')](_0xfb88('0x7d'),{'UserId':_0x1011a9,'MailQueueId':_0x38b3e5['id']});});});});});});})[_0xfb88('0x23')](respondWithStatusCode(_0x5e6aad,null))[_0xfb88('0x42')](handleError(_0x5e6aad,null));};exports[_0xfb88('0x7e')]=function(_0x4a9f59,_0x2cc7cd,_0x11787c){return db[_0xfb88('0x2b')]['find']({'where':{'id':_0x4a9f59[_0xfb88('0x43')]['id']}})[_0xfb88('0x23')](handleEntityNotFound(_0x2cc7cd,null))[_0xfb88('0x23')](function(_0x3520e1){if(_0x3520e1){return _0x3520e1[_0xfb88('0x7e')](_0x4a9f59[_0xfb88('0x4f')][_0xfb88('0x63')],_[_0xfb88('0x7f')](_0x4a9f59['body'],[_0xfb88('0x63'),'id'])||{})[_0xfb88('0x80')](function(_0x537d50){for(var _0x785da0=0x0;_0x785da0<_0x4a9f59['body'][_0xfb88('0x63')][_0xfb88('0x36')];_0x785da0+=0x1){socket[_0xfb88('0x7c')]('userMailQueue:save',{'UserId':Number(_0x4a9f59[_0xfb88('0x4f')]['ids'][_0x785da0]),'MailQueueId':Number(_0x4a9f59['params']['id'])});}return _0x537d50;});}})[_0xfb88('0x23')](respondWithResult(_0x2cc7cd,null))[_0xfb88('0x42')](handleError(_0x2cc7cd,null));};exports[_0xfb88('0x81')]=function(_0x243b3a,_0x314cb6,_0x1e13ea){return db['MailQueue'][_0xfb88('0x45')]({'where':{'id':_0x243b3a[_0xfb88('0x43')]['id']}})[_0xfb88('0x23')](handleEntityNotFound(_0x314cb6,null))[_0xfb88('0x23')](function(_0x588cb7){if(_0x588cb7){return _0x588cb7['removeAgents'](_0x243b3a[_0xfb88('0x30')][_0xfb88('0x63')])[_0xfb88('0x23')](function(){if(_[_0xfb88('0x82')](_0x243b3a['query'][_0xfb88('0x63')])){for(var _0x2cd629=0x0;_0x2cd629<_0x243b3a['query'][_0xfb88('0x63')][_0xfb88('0x36')];_0x2cd629+=0x1){socket[_0xfb88('0x7c')](_0xfb88('0x7d'),{'UserId':Number(_0x243b3a['query'][_0xfb88('0x63')][_0x2cd629]),'MailQueueId':Number(_0x243b3a[_0xfb88('0x43')]['id'])});}}else{socket[_0xfb88('0x7c')](_0xfb88('0x7d'),{'UserId':Number(_0x243b3a[_0xfb88('0x30')][_0xfb88('0x63')]),'MailQueueId':Number(_0x243b3a[_0xfb88('0x43')]['id'])});}});}})['then'](respondWithStatusCode(_0x314cb6,null))[_0xfb88('0x42')](handleError(_0x314cb6,null));};exports[_0xfb88('0x83')]=function(_0xda98d,_0x49e7cc,_0x2e453f){var _0x41cd97={};var _0x169a43={};var _0x1b6626;var _0x570f36;return db[_0xfb88('0x2b')][_0xfb88('0x52')]({'where':{'id':_0xda98d[_0xfb88('0x43')]['id']}})[_0xfb88('0x23')](handleEntityNotFound(_0x49e7cc,null))[_0xfb88('0x23')](function(_0x437f5e){if(_0x437f5e){_0x1b6626=_0x437f5e;_0x169a43[_0xfb88('0x2e')]=_[_0xfb88('0x31')](db[_0xfb88('0x56')][_0xfb88('0x2c')]);_0x169a43[_0xfb88('0x30')]=_[_0xfb88('0x31')](_0xda98d[_0xfb88('0x30')]);_0x169a43[_0xfb88('0x32')]=_[_0xfb88('0x34')](_0x169a43[_0xfb88('0x2e')],_0x169a43[_0xfb88('0x30')]);_0x41cd97[_0xfb88('0x33')]=_[_0xfb88('0x34')](_0x169a43[_0xfb88('0x2e')],qs[_0xfb88('0x35')](_0xda98d[_0xfb88('0x30')][_0xfb88('0x35')]));_0x41cd97['attributes']=_0x41cd97['attributes'][_0xfb88('0x36')]?_0x41cd97['attributes']:_0x169a43['model'];_0x41cd97['order']=qs[_0xfb88('0x38')](_0xda98d[_0xfb88('0x30')][_0xfb88('0x38')]);_0x41cd97['where']=qs[_0xfb88('0x32')](_[_0xfb88('0x3a')](_0xda98d['query'],_0x169a43[_0xfb88('0x32')]));if(_0xda98d['query'][_0xfb88('0x3b')]){_0x41cd97['where']=_['merge'](_0x41cd97['where'],{'$or':_[_0xfb88('0x2a')](_0x41cd97[_0xfb88('0x33')],function(_0x2f4552){var _0x54298a={};_0x54298a[_0x2f4552]={'$like':'%'+_0xda98d['query'][_0xfb88('0x3b')]+'%'};return _0x54298a;})});}_0x41cd97=_[_0xfb88('0x3c')]({},_0x41cd97,_0xda98d[_0xfb88('0x3e')]);return _0x1b6626[_0xfb88('0x83')](_0x41cd97);}})[_0xfb88('0x23')](function(_0x7369c6){if(_0x7369c6){_0x570f36=_0x7369c6[_0xfb88('0x36')];if(!_0xda98d['query'][_0xfb88('0x61')]('nolimit')){_0x41cd97[_0xfb88('0x1c')]=qs[_0xfb88('0x1c')](_0xda98d[_0xfb88('0x30')][_0xfb88('0x1c')]);_0x41cd97[_0xfb88('0x1e')]=qs['offset'](_0xda98d[_0xfb88('0x30')][_0xfb88('0x1e')]);}return _0x1b6626[_0xfb88('0x83')](_0x41cd97);}})['then'](function(_0x43f94a){if(_0x43f94a){return _0x43f94a?{'count':_0x570f36,'rows':_0x43f94a}:null;}})[_0xfb88('0x23')](respondWithResult(_0x49e7cc,null))['catch'](handleError(_0x49e7cc,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index f5eb6b0..b275da0 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 _0xfe0a=['hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x3de01a,_0xcc1fd4){var _0x43f31e=function(_0xf8e692){while(--_0xf8e692){_0x3de01a['push'](_0x3de01a['shift']());}};_0x43f31e(++_0xcc1fd4);}(_0xfe0a,0x1c4));var _0xafe0=function(_0x3bffe9,_0x1f4453){_0x3bffe9=_0x3bffe9-0x0;var _0x499f82=_0xfe0a[_0x3bffe9];return _0x499f82;};'use strict';var EventEmitter=require(_0xafe0('0x0'));var MailQueue=require(_0xafe0('0x1'))['db'][_0xafe0('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xafe0('0x3')](0x0);var events={'afterCreate':_0xafe0('0x4'),'afterUpdate':_0xafe0('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4304e9){return function(_0x2d3c59,_0xf3708f,_0x3c9998){MailQueueEvents[_0xafe0('0x6')](_0x4304e9+':'+_0x2d3c59['id'],_0x2d3c59);MailQueueEvents[_0xafe0('0x6')](_0x4304e9,_0x2d3c59);_0x3c9998(null);};}for(var e in events){if(events[_0xafe0('0x7')](e)){var event=events[e];MailQueue[_0xafe0('0x8')](e,emitEvent(event));}}module[_0xafe0('0x9')]=MailQueueEvents; \ No newline at end of file +var _0xab78=['exports','../../mysqldb','MailQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x3102e6,_0x5e7c4a){var _0x22b325=function(_0x527c1b){while(--_0x527c1b){_0x3102e6['push'](_0x3102e6['shift']());}};_0x22b325(++_0x5e7c4a);}(_0xab78,0xe7));var _0x8ab7=function(_0x5d4efd,_0x884216){_0x5d4efd=_0x5d4efd-0x0;var _0x2ecd43=_0xab78[_0x5d4efd];return _0x2ecd43;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x8ab7('0x0'))['db'][_0x8ab7('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x8ab7('0x2')](0x0);var events={'afterCreate':_0x8ab7('0x3'),'afterUpdate':_0x8ab7('0x4'),'afterDestroy':_0x8ab7('0x5')};function emitEvent(_0x162202){return function(_0x329c02,_0x2620c5,_0x3dc19a){MailQueueEvents[_0x8ab7('0x6')](_0x162202+':'+_0x329c02['id'],_0x329c02);MailQueueEvents[_0x8ab7('0x6')](_0x162202,_0x329c02);_0x3dc19a(null);};}for(var e in events){if(events[_0x8ab7('0x7')](e)){var event=events[e];MailQueue[_0x8ab7('0x8')](e,emitEvent(event));}}module[_0x8ab7('0x9')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 0c3ac4e..bb489e0 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 _0x04ec=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','define','mail_queues','lodash','util'];(function(_0x258afb,_0x437096){var _0x1b9124=function(_0x54392d){while(--_0x54392d){_0x258afb['push'](_0x258afb['shift']());}};_0x1b9124(++_0x437096);}(_0x04ec,0x143));var _0xc04e=function(_0x2755fb,_0x5970f1){_0x2755fb=_0x2755fb-0x0;var _0x293f12=_0x04ec[_0x2755fb];return _0x293f12;};'use strict';var _=require(_0xc04e('0x0'));var util=require(_0xc04e('0x1'));var logger=require(_0xc04e('0x2'))(_0xc04e('0x3'));var moment=require(_0xc04e('0x4'));var BPromise=require(_0xc04e('0x5'));var rp=require(_0xc04e('0x6'));var fs=require('fs');var path=require(_0xc04e('0x7'));var rimraf=require(_0xc04e('0x8'));var config=require(_0xc04e('0x9'));var attributes=require(_0xc04e('0xa'));module['exports']=function(_0x468bbb,_0x1467aa){return _0x468bbb[_0xc04e('0xb')]('MailQueue',attributes,{'tableName':_0xc04e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c4a=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','define','MailQueue','mail_queues','lodash'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x6c4a,0x11f));var _0xa6c4=function(_0x42d882,_0x4c574e){_0x42d882=_0x42d882-0x0;var _0x1f1ec1=_0x6c4a[_0x42d882];return _0x1f1ec1;};'use strict';var _=require(_0xa6c4('0x0'));var util=require('util');var logger=require(_0xa6c4('0x1'))(_0xa6c4('0x2'));var moment=require(_0xa6c4('0x3'));var BPromise=require('bluebird');var rp=require(_0xa6c4('0x4'));var fs=require('fs');var path=require(_0xa6c4('0x5'));var rimraf=require(_0xa6c4('0x6'));var config=require(_0xa6c4('0x7'));var attributes=require(_0xa6c4('0x8'));module['exports']=function(_0x283649,_0x1f37f8){return _0x283649[_0xa6c4('0x9')](_0xa6c4('0xa'),attributes,{'tableName':_0xa6c4('0xb'),'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 0d7832a..fbfcf55 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 _0xccd7=['GetMailQueue','debug','where','ShowMailQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','register','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','MailQueue','findAll','options','raw','include','map','attributes','model','then'];(function(_0x2461fb,_0x3bd589){var _0x4e0602=function(_0x6e2f52){while(--_0x6e2f52){_0x2461fb['push'](_0x2461fb['shift']());}};_0x4e0602(++_0x3bd589);}(_0xccd7,0x185));var _0x7ccd=function(_0x3cc05d,_0x4b8f88){_0x3cc05d=_0x3cc05d-0x0;var _0x28b736=_0xccd7[_0x3cc05d];return _0x28b736;};'use strict';var _=require(_0x7ccd('0x0'));var util=require(_0x7ccd('0x1'));var moment=require(_0x7ccd('0x2'));var BPromise=require(_0x7ccd('0x3'));var rs=require(_0x7ccd('0x4'));var fs=require('fs');var Redis=require(_0x7ccd('0x5'));var db=require(_0x7ccd('0x6'))['db'];var utils=require(_0x7ccd('0x7'));var logger=require(_0x7ccd('0x8'))(_0x7ccd('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7ccd('0xa')]['http']({'port':0x232a});config[_0x7ccd('0xb')]=_['defaults'](config[_0x7ccd('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7ccd('0xb')]));require('./mailQueue.socket')[_0x7ccd('0xc')](socket);function respondWithRpcPromise(_0xc47c43,_0x5842b3,_0x343895){return new BPromise(function(_0x3f0c0c,_0x3e3d4d){return client['request'](_0xc47c43,_0x343895)['then'](function(_0x3f4514){logger['info'](_0x7ccd('0xd'),_0x5842b3,_0x7ccd('0xe'));logger['debug'](_0x7ccd('0xf'),_0x5842b3,'request\x20sent',JSON[_0x7ccd('0x10')](_0x3f4514));if(_0x3f4514[_0x7ccd('0x11')]){if(_0x3f4514[_0x7ccd('0x11')][_0x7ccd('0x12')]===0x1f4){logger[_0x7ccd('0x11')](_0x7ccd('0xd'),_0x5842b3,_0x3f4514['error'][_0x7ccd('0x13')]);return _0x3e3d4d(_0x3f4514[_0x7ccd('0x11')][_0x7ccd('0x13')]);}logger[_0x7ccd('0x11')](_0x7ccd('0xd'),_0x5842b3,_0x3f4514[_0x7ccd('0x11')][_0x7ccd('0x13')]);return _0x3f0c0c(_0x3f4514[_0x7ccd('0x11')][_0x7ccd('0x13')]);}else{logger[_0x7ccd('0x14')](_0x7ccd('0xd'),_0x5842b3,'request\x20sent');_0x3f0c0c(_0x3f4514['result']['message']);}})[_0x7ccd('0x15')](function(_0x1bd5ac){logger[_0x7ccd('0x11')](_0x7ccd('0xd'),_0x5842b3,_0x1bd5ac);_0x3e3d4d(_0x1bd5ac);});});}exports['GetMailQueue']=function(_0x4cc443){var _0x4f995a=this;return new Promise(function(_0x2f6ae5,_0x2289ce){return db[_0x7ccd('0x16')][_0x7ccd('0x17')]({'raw':_0x4cc443[_0x7ccd('0x18')]?_0x4cc443['options'][_0x7ccd('0x19')]===undefined?!![]:![]:!![],'where':_0x4cc443[_0x7ccd('0x18')]?_0x4cc443['options']['where']||null:null,'attributes':_0x4cc443[_0x7ccd('0x18')]?_0x4cc443['options']['attributes']||null:null,'limit':_0x4cc443[_0x7ccd('0x18')]?_0x4cc443['options']['limit']||null:null,'include':_0x4cc443['options']?_0x4cc443['options'][_0x7ccd('0x1a')]?_[_0x7ccd('0x1b')](_0x4cc443[_0x7ccd('0x18')]['include'],function(_0x240b75){return{'model':db[_0x240b75['model']],'as':_0x240b75['as'],'attributes':_0x240b75[_0x7ccd('0x1c')],'include':_0x240b75[_0x7ccd('0x1a')]?_[_0x7ccd('0x1b')](_0x240b75['include'],function(_0x397fe6){return{'model':db[_0x397fe6[_0x7ccd('0x1d')]],'as':_0x397fe6['as'],'attributes':_0x397fe6['attributes'],'include':_0x397fe6['include']?_['map'](_0x397fe6['include'],function(_0x42c719){return{'model':db[_0x42c719['model']],'as':_0x42c719['as'],'attributes':_0x42c719['attributes']};}):[]};}):[]};}):[]:[]})[_0x7ccd('0x1e')](function(_0x58bd08){logger[_0x7ccd('0x14')](_0x7ccd('0x1f'),_0x4cc443);logger[_0x7ccd('0x20')]('GetMailQueue',_0x4cc443,JSON['stringify'](_0x58bd08));_0x2f6ae5(_0x58bd08);})[_0x7ccd('0x15')](function(_0x8fe419){logger[_0x7ccd('0x11')](_0x7ccd('0x1f'),_0x8fe419[_0x7ccd('0x13')],_0x4cc443);_0x2289ce(_0x4f995a[_0x7ccd('0x11')](0x1f4,_0x8fe419[_0x7ccd('0x13')]));});});};exports['ShowMailQueue']=function(_0x46e877){var _0x42d884=this;return new Promise(function(_0x1571e6,_0x2b0a14){return db[_0x7ccd('0x16')]['find']({'raw':_0x46e877[_0x7ccd('0x18')]?_0x46e877[_0x7ccd('0x18')][_0x7ccd('0x19')]===undefined?!![]:![]:!![],'where':_0x46e877[_0x7ccd('0x18')]?_0x46e877[_0x7ccd('0x18')][_0x7ccd('0x21')]||null:null,'attributes':_0x46e877[_0x7ccd('0x18')]?_0x46e877[_0x7ccd('0x18')][_0x7ccd('0x1c')]||null:null,'include':_0x46e877['options']?_0x46e877[_0x7ccd('0x18')]['include']?_['map'](_0x46e877[_0x7ccd('0x18')][_0x7ccd('0x1a')],function(_0x4968ca){return{'model':db[_0x4968ca[_0x7ccd('0x1d')]],'as':_0x4968ca['as'],'attributes':_0x4968ca[_0x7ccd('0x1c')],'include':_0x4968ca[_0x7ccd('0x1a')]?_[_0x7ccd('0x1b')](_0x4968ca[_0x7ccd('0x1a')],function(_0x5a6e5b){return{'model':db[_0x5a6e5b[_0x7ccd('0x1d')]],'as':_0x5a6e5b['as'],'attributes':_0x5a6e5b[_0x7ccd('0x1c')],'include':_0x5a6e5b['include']?_[_0x7ccd('0x1b')](_0x5a6e5b[_0x7ccd('0x1a')],function(_0x23a11c){return{'model':db[_0x23a11c[_0x7ccd('0x1d')]],'as':_0x23a11c['as'],'attributes':_0x23a11c[_0x7ccd('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7ccd('0x1e')](function(_0x327315){logger[_0x7ccd('0x14')](_0x7ccd('0x22'),_0x46e877);logger[_0x7ccd('0x20')](_0x7ccd('0x22'),_0x46e877,JSON['stringify'](_0x327315));_0x1571e6(_0x327315);})[_0x7ccd('0x15')](function(_0x11f74c){logger[_0x7ccd('0x11')](_0x7ccd('0x22'),_0x11f74c[_0x7ccd('0x13')],_0x46e877);_0x2b0a14(_0x42d884[_0x7ccd('0x11')](0x1f4,_0x11f74c[_0x7ccd('0x13')]));});});}; \ No newline at end of file +var _0x8029=['attributes','limit','map','include','model','debug','ShowMailQueue','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','register','then','info','MailQueue,\x20%s,\x20%s','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailQueue','MailQueue','findAll','options','raw','where'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x8029,0xf8));var _0x9802=function(_0x5bff5a,_0x50f52c){_0x5bff5a=_0x5bff5a-0x0;var _0x43e466=_0x8029[_0x5bff5a];return _0x43e466;};'use strict';var _=require(_0x9802('0x0'));var util=require(_0x9802('0x1'));var moment=require('moment');var BPromise=require(_0x9802('0x2'));var rs=require(_0x9802('0x3'));var fs=require('fs');var Redis=require(_0x9802('0x4'));var db=require(_0x9802('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9802('0x6'));var config=require(_0x9802('0x7'));var jayson=require(_0x9802('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x9802('0x9')](config[_0x9802('0xa')],{'host':_0x9802('0xb'),'port':0x18eb});var socket=require(_0x9802('0xc'))(new Redis(config['redis']));require(_0x9802('0xd'))[_0x9802('0xe')](socket);function respondWithRpcPromise(_0x4818e2,_0x3aa073,_0x3e3de8){return new BPromise(function(_0x5d963d,_0x4df56e){return client['request'](_0x4818e2,_0x3e3de8)[_0x9802('0xf')](function(_0x45540d){logger[_0x9802('0x10')](_0x9802('0x11'),_0x3aa073,'request\x20sent');logger['debug'](_0x9802('0x12'),_0x3aa073,_0x9802('0x13'),JSON[_0x9802('0x14')](_0x45540d));if(_0x45540d[_0x9802('0x15')]){if(_0x45540d[_0x9802('0x15')][_0x9802('0x16')]===0x1f4){logger[_0x9802('0x15')](_0x9802('0x11'),_0x3aa073,_0x45540d[_0x9802('0x15')][_0x9802('0x17')]);return _0x4df56e(_0x45540d[_0x9802('0x15')][_0x9802('0x17')]);}logger[_0x9802('0x15')]('MailQueue,\x20%s,\x20%s',_0x3aa073,_0x45540d['error'][_0x9802('0x17')]);return _0x5d963d(_0x45540d[_0x9802('0x15')][_0x9802('0x17')]);}else{logger['info'](_0x9802('0x11'),_0x3aa073,_0x9802('0x13'));_0x5d963d(_0x45540d[_0x9802('0x18')][_0x9802('0x17')]);}})[_0x9802('0x19')](function(_0x4e07ed){logger['error'](_0x9802('0x11'),_0x3aa073,_0x4e07ed);_0x4df56e(_0x4e07ed);});});}exports[_0x9802('0x1a')]=function(_0x340c0e){var _0x78d1df=this;return new Promise(function(_0x445a89,_0x567eed){return db[_0x9802('0x1b')][_0x9802('0x1c')]({'raw':_0x340c0e[_0x9802('0x1d')]?_0x340c0e[_0x9802('0x1d')][_0x9802('0x1e')]===undefined?!![]:![]:!![],'where':_0x340c0e[_0x9802('0x1d')]?_0x340c0e[_0x9802('0x1d')][_0x9802('0x1f')]||null:null,'attributes':_0x340c0e[_0x9802('0x1d')]?_0x340c0e[_0x9802('0x1d')][_0x9802('0x20')]||null:null,'limit':_0x340c0e['options']?_0x340c0e['options'][_0x9802('0x21')]||null:null,'include':_0x340c0e['options']?_0x340c0e[_0x9802('0x1d')]['include']?_[_0x9802('0x22')](_0x340c0e['options'][_0x9802('0x23')],function(_0x360413){return{'model':db[_0x360413[_0x9802('0x24')]],'as':_0x360413['as'],'attributes':_0x360413[_0x9802('0x20')],'include':_0x360413[_0x9802('0x23')]?_['map'](_0x360413[_0x9802('0x23')],function(_0x1e12c0){return{'model':db[_0x1e12c0['model']],'as':_0x1e12c0['as'],'attributes':_0x1e12c0[_0x9802('0x20')],'include':_0x1e12c0['include']?_['map'](_0x1e12c0['include'],function(_0x3f10f0){return{'model':db[_0x3f10f0[_0x9802('0x24')]],'as':_0x3f10f0['as'],'attributes':_0x3f10f0[_0x9802('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x575d01){logger[_0x9802('0x10')]('GetMailQueue',_0x340c0e);logger[_0x9802('0x25')]('GetMailQueue',_0x340c0e,JSON[_0x9802('0x14')](_0x575d01));_0x445a89(_0x575d01);})[_0x9802('0x19')](function(_0x158394){logger[_0x9802('0x15')](_0x9802('0x1a'),_0x158394['message'],_0x340c0e);_0x567eed(_0x78d1df[_0x9802('0x15')](0x1f4,_0x158394[_0x9802('0x17')]));});});};exports[_0x9802('0x26')]=function(_0x19e6ba){var _0x200cf2=this;return new Promise(function(_0x23fb6e,_0x60f593){return db[_0x9802('0x1b')][_0x9802('0x27')]({'raw':_0x19e6ba['options']?_0x19e6ba['options'][_0x9802('0x1e')]===undefined?!![]:![]:!![],'where':_0x19e6ba['options']?_0x19e6ba[_0x9802('0x1d')]['where']||null:null,'attributes':_0x19e6ba[_0x9802('0x1d')]?_0x19e6ba[_0x9802('0x1d')]['attributes']||null:null,'include':_0x19e6ba[_0x9802('0x1d')]?_0x19e6ba['options']['include']?_['map'](_0x19e6ba[_0x9802('0x1d')]['include'],function(_0xb796c){return{'model':db[_0xb796c[_0x9802('0x24')]],'as':_0xb796c['as'],'attributes':_0xb796c[_0x9802('0x20')],'include':_0xb796c['include']?_[_0x9802('0x22')](_0xb796c['include'],function(_0x38ac0b){return{'model':db[_0x38ac0b[_0x9802('0x24')]],'as':_0x38ac0b['as'],'attributes':_0x38ac0b[_0x9802('0x20')],'include':_0x38ac0b[_0x9802('0x23')]?_[_0x9802('0x22')](_0x38ac0b['include'],function(_0x5423e1){return{'model':db[_0x5423e1['model']],'as':_0x5423e1['as'],'attributes':_0x5423e1[_0x9802('0x20')]};}):[]};}):[]};}):[]:[]})[_0x9802('0xf')](function(_0x57ffa5){logger[_0x9802('0x10')](_0x9802('0x26'),_0x19e6ba);logger[_0x9802('0x25')](_0x9802('0x26'),_0x19e6ba,JSON['stringify'](_0x57ffa5));_0x23fb6e(_0x57ffa5);})['catch'](function(_0x3e5ef9){logger['error'](_0x9802('0x26'),_0x3e5ef9[_0x9802('0x17')],_0x19e6ba);_0x60f593(_0x200cf2[_0x9802('0x15')](0x1f4,_0x3e5ef9[_0x9802('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 0534695..7d8d5f8 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 _0xa1d0=['./mailQueue.events','remove','emit','removeListener','register','length','mailQueue:'];(function(_0x15721c,_0x4d29c8){var _0x45183e=function(_0x285068){while(--_0x285068){_0x15721c['push'](_0x15721c['shift']());}};_0x45183e(++_0x4d29c8);}(_0xa1d0,0x1a4));var _0x0a1d=function(_0x5a3263,_0x30ffe7){_0x5a3263=_0x5a3263-0x0;var _0x13f78b=_0xa1d0[_0x5a3263];return _0x13f78b;};'use strict';var MailQueueEvents=require(_0x0a1d('0x0'));var events=['save',_0x0a1d('0x1'),'update'];function createListener(_0xfe1b50,_0x1c1b1f){return function(_0x374ec2){_0x1c1b1f[_0x0a1d('0x2')](_0xfe1b50,_0x374ec2);};}function removeListener(_0x15e254,_0x2d2b14){return function(){MailQueueEvents[_0x0a1d('0x3')](_0x15e254,_0x2d2b14);};}exports[_0x0a1d('0x4')]=function(_0x285114){for(var _0x3b5b3c=0x0,_0x79fbcd=events[_0x0a1d('0x5')];_0x3b5b3c<_0x79fbcd;_0x3b5b3c++){var _0x466225=events[_0x3b5b3c];var _0x2aed72=createListener(_0x0a1d('0x6')+_0x466225,_0x285114);MailQueueEvents['on'](_0x466225,_0x2aed72);}}; \ No newline at end of file +var _0xa2bf=['update','emit','removeListener','register','length','mailQueue:','./mailQueue.events','save','remove'];(function(_0x1465c1,_0xa8fd77){var _0x104621=function(_0x2bd254){while(--_0x2bd254){_0x1465c1['push'](_0x1465c1['shift']());}};_0x104621(++_0xa8fd77);}(_0xa2bf,0xa8));var _0xfa2b=function(_0x440317,_0xf16870){_0x440317=_0x440317-0x0;var _0x499264=_0xa2bf[_0x440317];return _0x499264;};'use strict';var MailQueueEvents=require(_0xfa2b('0x0'));var events=[_0xfa2b('0x1'),_0xfa2b('0x2'),_0xfa2b('0x3')];function createListener(_0x4dddd8,_0x687f72){return function(_0x36224b){_0x687f72[_0xfa2b('0x4')](_0x4dddd8,_0x36224b);};}function removeListener(_0x12f91f,_0x1caf86){return function(){MailQueueEvents[_0xfa2b('0x5')](_0x12f91f,_0x1caf86);};}exports[_0xfa2b('0x6')]=function(_0x249860){for(var _0x164a9=0x0,_0x11b198=events[_0xfa2b('0x7')];_0x164a9<_0x11b198;_0x164a9++){var _0x396ef2=events[_0x164a9];var _0xfb9e6e=createListener(_0xfa2b('0x8')+_0x396ef2,_0x249860);MailQueueEvents['on'](_0x396ef2,_0xfb9e6e);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 8e5b761..00bca39 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 _0x2e4f=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update'];(function(_0xc96ce9,_0x39dab2){var _0x4f8966=function(_0x5739ef){while(--_0x5739ef){_0xc96ce9['push'](_0xc96ce9['shift']());}};_0x4f8966(++_0x39dab2);}(_0x2e4f,0xe9));var _0xf2e4=function(_0x585133,_0x2412a1){_0x585133=_0x585133-0x0;var _0x18254a=_0x2e4f[_0x585133];return _0x18254a;};'use strict';var multer=require(_0xf2e4('0x0'));var util=require(_0xf2e4('0x1'));var path=require(_0xf2e4('0x2'));var timeout=require(_0xf2e4('0x3'));var express=require(_0xf2e4('0x4'));var router=express[_0xf2e4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf2e4('0x6'));var interaction=require(_0xf2e4('0x7'));var config=require(_0xf2e4('0x8'));var controller=require(_0xf2e4('0x9'));router[_0xf2e4('0xa')]('/',auth[_0xf2e4('0xb')](),controller['index']);router[_0xf2e4('0xa')](_0xf2e4('0xc'),auth[_0xf2e4('0xb')](),controller[_0xf2e4('0xd')]);router[_0xf2e4('0xa')](_0xf2e4('0xe'),auth[_0xf2e4('0xb')](),controller[_0xf2e4('0xf')]);router[_0xf2e4('0x10')]('/',auth[_0xf2e4('0xb')](),controller[_0xf2e4('0x11')]);router[_0xf2e4('0x12')](_0xf2e4('0xe'),auth['isAuthenticated'](),controller[_0xf2e4('0x13')]);router[_0xf2e4('0x14')]('/:id',auth[_0xf2e4('0xb')](),controller[_0xf2e4('0x15')]);module[_0xf2e4('0x16')]=router; \ No newline at end of file +var _0x0670=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','put','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x54f4bc,_0x145d48){var _0x17aaf6=function(_0x1a957e){while(--_0x1a957e){_0x54f4bc['push'](_0x54f4bc['shift']());}};_0x17aaf6(++_0x145d48);}(_0x0670,0x14a));var _0x0067=function(_0x31147e,_0x2ff5b9){_0x31147e=_0x31147e-0x0;var _0x395bf8=_0x0670[_0x31147e];return _0x395bf8;};'use strict';var multer=require(_0x0067('0x0'));var util=require(_0x0067('0x1'));var path=require(_0x0067('0x2'));var timeout=require(_0x0067('0x3'));var express=require(_0x0067('0x4'));var router=express[_0x0067('0x5')]();var fs_extra=require(_0x0067('0x6'));var auth=require(_0x0067('0x7'));var interaction=require(_0x0067('0x8'));var config=require(_0x0067('0x9'));var controller=require('./mailQueueReport.controller');router[_0x0067('0xa')]('/',auth[_0x0067('0xb')](),controller[_0x0067('0xc')]);router[_0x0067('0xa')](_0x0067('0xd'),auth[_0x0067('0xb')](),controller[_0x0067('0xe')]);router[_0x0067('0xa')](_0x0067('0xf'),auth[_0x0067('0xb')](),controller['show']);router[_0x0067('0x10')]('/',auth[_0x0067('0xb')](),controller['create']);router[_0x0067('0x11')](_0x0067('0xf'),auth['isAuthenticated'](),controller[_0x0067('0x12')]);router[_0x0067('0x13')]('/:id',auth[_0x0067('0xb')](),controller['destroy']);module[_0x0067('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 8a63e16..5e5e1f1 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 _0x496a=['moment','sequelize','exports','STRING','DATE'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x496a,0xe6));var _0xa496=function(_0x40e7f2,_0x182dbb){_0x40e7f2=_0x40e7f2-0x0;var _0xa81717=_0x496a[_0x40e7f2];return _0xa81717;};'use strict';var moment=require(_0xa496('0x0'));var Sequelize=require(_0xa496('0x1'));module[_0xa496('0x2')]={'uniqueid':{'type':Sequelize[_0xa496('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xa496('0x3')]},'joinAt':{'type':Sequelize[_0xa496('0x4')]},'leaveAt':{'type':Sequelize[_0xa496('0x4')]},'acceptAt':{'type':Sequelize[_0xa496('0x4')]},'exitAt':{'type':Sequelize[_0xa496('0x4')]},'reason':{'type':Sequelize[_0xa496('0x3')]}}; \ No newline at end of file +var _0x67de=['STRING','DATE','moment','sequelize','exports'];(function(_0x5e833c,_0x10b747){var _0x1da956=function(_0x4be4aa){while(--_0x4be4aa){_0x5e833c['push'](_0x5e833c['shift']());}};_0x1da956(++_0x10b747);}(_0x67de,0x1ba));var _0xe67d=function(_0x18ff50,_0x861df4){_0x18ff50=_0x18ff50-0x0;var _0x1955fb=_0x67de[_0x18ff50];return _0x1955fb;};'use strict';var moment=require(_0xe67d('0x0'));var Sequelize=require(_0xe67d('0x1'));module[_0xe67d('0x2')]={'uniqueid':{'type':Sequelize[_0xe67d('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xe67d('0x3')]},'joinAt':{'type':Sequelize[_0xe67d('0x4')]},'leaveAt':{'type':Sequelize[_0xe67d('0x4')]},'acceptAt':{'type':Sequelize[_0xe67d('0x4')]},'exitAt':{'type':Sequelize[_0xe67d('0x4')]},'reason':{'type':Sequelize[_0xe67d('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 8bb6ff6..6c88ee1 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 _0x955f=['reject','update','then','destroy','error','name','send','index','map','MailQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply'];(function(_0x1df957,_0x3f01ec){var _0x1e7784=function(_0x377f9f){while(--_0x377f9f){_0x1df957['push'](_0x1df957['shift']());}};_0x1e7784(++_0x3f01ec);}(_0x955f,0x1eb));var _0xf955=function(_0x13fad1,_0x3a9259){_0x13fad1=_0x13fad1-0x0;var _0x4a7f39=_0x955f[_0x13fad1];return _0x4a7f39;};'use strict';var emlformat=require(_0xf955('0x0'));var rimraf=require(_0xf955('0x1'));var zipdir=require(_0xf955('0x2'));var jsonpatch=require(_0xf955('0x3'));var rp=require(_0xf955('0x4'));var moment=require('moment');var BPromise=require(_0xf955('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf955('0x6'));var sox=require('sox');var csv=require(_0xf955('0x7'));var ejs=require(_0xf955('0x8'));var fs=require('fs');var fs_extra=require(_0xf955('0x9'));var _=require('lodash');var squel=require(_0xf955('0xa'));var crypto=require(_0xf955('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf955('0xc'));var toCsv=require(_0xf955('0x7'));var querystring=require(_0xf955('0xd'));var Papa=require(_0xf955('0xe'));var Redis=require(_0xf955('0xf'));var authService=require(_0xf955('0x10'));var qs=require(_0xf955('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf955('0x12'));var logger=require('../../config/logger')(_0xf955('0x13'));var utils=require(_0xf955('0x14'));var config=require(_0xf955('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf955('0x16'))['db'];function respondWithStatusCode(_0x542347,_0x23e0c6){_0x23e0c6=_0x23e0c6||0xcc;return function(_0x50d9a9){if(_0x50d9a9){return _0x542347[_0xf955('0x17')](_0x23e0c6);}return _0x542347[_0xf955('0x18')](_0x23e0c6)[_0xf955('0x19')]();};}function respondWithResult(_0x109bc5,_0x2080c4){_0x2080c4=_0x2080c4||0xc8;return function(_0x341b8c){if(_0x341b8c){return _0x109bc5[_0xf955('0x18')](_0x2080c4)[_0xf955('0x1a')](_0x341b8c);}};}function respondWithFilteredResult(_0x3c6af7,_0x24e75c){return function(_0x5350e4){if(_0x5350e4){var _0xc29b35=typeof _0x24e75c['offset']===_0xf955('0x1b')&&typeof _0x24e75c[_0xf955('0x1c')]===_0xf955('0x1b');var _0x15c07c=_0x5350e4['count'];var _0x5ac6cb=_0xc29b35?0x0:_0x24e75c[_0xf955('0x1d')];var _0xe6de5c=_0xc29b35?_0x5350e4[_0xf955('0x1e')]:_0x24e75c['offset']+_0x24e75c[_0xf955('0x1c')];var _0x3576fa;if(_0xe6de5c>=_0x15c07c){_0xe6de5c=_0x15c07c;_0x3576fa=0xc8;}else{_0x3576fa=0xce;}_0x3c6af7[_0xf955('0x18')](_0x3576fa);return _0x3c6af7[_0xf955('0x1f')](_0xf955('0x20'),_0x5ac6cb+'-'+_0xe6de5c+'/'+_0x15c07c)['json'](_0x5350e4);}return null;};}function patchUpdates(_0x17d86a){return function(_0x3dbbe8){try{jsonpatch[_0xf955('0x21')](_0x3dbbe8,_0x17d86a,!![]);}catch(_0x488d04){return BPromise[_0xf955('0x22')](_0x488d04);}return _0x3dbbe8['save']();};}function saveUpdates(_0x21ae24,_0x43b078){return function(_0x37143d){if(_0x37143d){return _0x37143d[_0xf955('0x23')](_0x21ae24)[_0xf955('0x24')](function(_0x565641){return _0x565641;});}return null;};}function removeEntity(_0x25f4f2,_0x5fab1c){return function(_0x3585c7){if(_0x3585c7){return _0x3585c7[_0xf955('0x25')]()[_0xf955('0x24')](function(){_0x25f4f2[_0xf955('0x18')](0xcc)[_0xf955('0x19')]();});}};}function handleEntityNotFound(_0x552cf3,_0x18f435){return function(_0x1acf33){if(!_0x1acf33){_0x552cf3[_0xf955('0x17')](0x194);}return _0x1acf33;};}function handleError(_0x406632,_0x2dcd55){_0x2dcd55=_0x2dcd55||0x1f4;return function(_0x13a86d){logger[_0xf955('0x26')](_0x13a86d['stack']);if(_0x13a86d[_0xf955('0x27')]){delete _0x13a86d[_0xf955('0x27')];}_0x406632[_0xf955('0x18')](_0x2dcd55)[_0xf955('0x28')](_0x13a86d);};}exports[_0xf955('0x29')]=function(_0x264f6d,_0x4d4af0){var _0x2232a7={},_0x1e5d37={},_0x4ec3e8={'count':0x0,'rows':[]};var _0x256df5=_[_0xf955('0x2a')](db[_0xf955('0x2b')][_0xf955('0x2c')],function(_0x59bfb5){return{'name':_0x59bfb5[_0xf955('0x2d')],'type':_0x59bfb5['type'][_0xf955('0x2e')]};});_0x1e5d37[_0xf955('0x2f')]=_[_0xf955('0x2a')](_0x256df5,_0xf955('0x27'));_0x1e5d37[_0xf955('0x30')]=_[_0xf955('0x31')](_0x264f6d[_0xf955('0x30')]);_0x1e5d37[_0xf955('0x32')]=_['intersection'](_0x1e5d37[_0xf955('0x2f')],_0x1e5d37[_0xf955('0x30')]);_0x2232a7[_0xf955('0x33')]=_[_0xf955('0x34')](_0x1e5d37['model'],qs[_0xf955('0x35')](_0x264f6d[_0xf955('0x30')][_0xf955('0x35')]));_0x2232a7[_0xf955('0x33')]=_0x2232a7[_0xf955('0x33')]['length']?_0x2232a7['attributes']:_0x1e5d37['model'];if(!_0x264f6d[_0xf955('0x30')][_0xf955('0x36')](_0xf955('0x37'))){_0x2232a7[_0xf955('0x1c')]=qs[_0xf955('0x1c')](_0x264f6d[_0xf955('0x30')]['limit']);_0x2232a7[_0xf955('0x1d')]=qs['offset'](_0x264f6d[_0xf955('0x30')][_0xf955('0x1d')]);}_0x2232a7[_0xf955('0x38')]=qs['sort'](_0x264f6d[_0xf955('0x30')]['sort']);_0x2232a7[_0xf955('0x39')]=qs[_0xf955('0x32')](_[_0xf955('0x3a')](_0x264f6d[_0xf955('0x30')],_0x1e5d37['filters']),_0x256df5);if(_0x264f6d[_0xf955('0x30')][_0xf955('0x3b')]){_0x2232a7['where']=_[_0xf955('0x3c')](_0x2232a7[_0xf955('0x39')],{'$or':_[_0xf955('0x2a')](_0x256df5,function(_0x547ed9){if(_0x547ed9[_0xf955('0x3d')]!==_0xf955('0x3e')){var _0x11b7e2={};_0x11b7e2[_0x547ed9['name']]={'$like':'%'+_0x264f6d[_0xf955('0x30')][_0xf955('0x3b')]+'%'};return _0x11b7e2;}})});}_0x2232a7=_[_0xf955('0x3c')]({},_0x2232a7,_0x264f6d[_0xf955('0x3f')]);var _0x2bfbe4={'where':_0x2232a7[_0xf955('0x39')]};return db[_0xf955('0x2b')][_0xf955('0x1e')](_0x2bfbe4)['then'](function(_0x8fa41b){_0x4ec3e8[_0xf955('0x1e')]=_0x8fa41b;if(_0x264f6d[_0xf955('0x30')][_0xf955('0x40')]){_0x2232a7[_0xf955('0x41')]=[{'all':!![]}];}return db[_0xf955('0x2b')][_0xf955('0x42')](_0x2232a7);})[_0xf955('0x24')](function(_0x47651b){_0x4ec3e8[_0xf955('0x43')]=_0x47651b;return _0x4ec3e8;})[_0xf955('0x24')](respondWithFilteredResult(_0x4d4af0,_0x2232a7))[_0xf955('0x44')](handleError(_0x4d4af0,null));};exports[_0xf955('0x45')]=function(_0x159ae3,_0x3557b5){var _0x248f60={'raw':!![],'where':{'id':_0x159ae3[_0xf955('0x46')]['id']}},_0x356ec2={};_0x356ec2[_0xf955('0x2f')]=_['keys'](db[_0xf955('0x2b')][_0xf955('0x2c')]);_0x356ec2[_0xf955('0x30')]=_['keys'](_0x159ae3[_0xf955('0x30')]);_0x356ec2['filters']=_[_0xf955('0x34')](_0x356ec2['model'],_0x356ec2[_0xf955('0x30')]);_0x248f60[_0xf955('0x33')]=_[_0xf955('0x34')](_0x356ec2[_0xf955('0x2f')],qs['fields'](_0x159ae3[_0xf955('0x30')][_0xf955('0x35')]));_0x248f60[_0xf955('0x33')]=_0x248f60['attributes']['length']?_0x248f60[_0xf955('0x33')]:_0x356ec2[_0xf955('0x2f')];if(_0x159ae3[_0xf955('0x30')][_0xf955('0x40')]){_0x248f60['include']=[{'all':!![]}];}_0x248f60=_[_0xf955('0x3c')]({},_0x248f60,_0x159ae3[_0xf955('0x3f')]);return db[_0xf955('0x2b')]['find'](_0x248f60)[_0xf955('0x24')](handleEntityNotFound(_0x3557b5,null))['then'](respondWithResult(_0x3557b5,null))[_0xf955('0x44')](handleError(_0x3557b5,null));};exports[_0xf955('0x47')]=function(_0x2c867f,_0x4dd592){return db[_0xf955('0x2b')][_0xf955('0x47')](_0x2c867f[_0xf955('0x48')],{})[_0xf955('0x24')](respondWithResult(_0x4dd592,0xc9))['catch'](handleError(_0x4dd592,null));};exports[_0xf955('0x23')]=function(_0x4ff0f1,_0x1c6d76){if(_0x4ff0f1[_0xf955('0x48')]['id']){delete _0x4ff0f1[_0xf955('0x48')]['id'];}return db['MailQueueReport'][_0xf955('0x49')]({'where':{'id':_0x4ff0f1['params']['id']}})[_0xf955('0x24')](handleEntityNotFound(_0x1c6d76,null))['then'](saveUpdates(_0x4ff0f1[_0xf955('0x48')],null))['then'](respondWithResult(_0x1c6d76,null))['catch'](handleError(_0x1c6d76,null));};exports[_0xf955('0x25')]=function(_0x45c7fe,_0x4961cc){return db[_0xf955('0x2b')]['find']({'where':{'id':_0x45c7fe['params']['id']}})['then'](handleEntityNotFound(_0x4961cc,null))['then'](removeEntity(_0x4961cc,null))[_0xf955('0x44')](handleError(_0x4961cc,null));};exports[_0xf955('0x4a')]=function(_0x4a7aee,_0x4c4b6d){return db[_0xf955('0x2b')][_0xf955('0x4a')]()[_0xf955('0x24')](respondWithResult(_0x4c4b6d,null))[_0xf955('0x44')](handleError(_0x4c4b6d,null));}; \ No newline at end of file +var _0x8e3f=['save','update','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','merge','filter','options','MailQueueReport','includeAll','include','findAll','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8e3f[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0xf8e3('0x0'));var rimraf=require(_0xf8e3('0x1'));var zipdir=require(_0xf8e3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf8e3('0x3'));var moment=require(_0xf8e3('0x4'));var BPromise=require(_0xf8e3('0x5'));var Mustache=require('mustache');var util=require(_0xf8e3('0x6'));var path=require(_0xf8e3('0x7'));var sox=require('sox');var csv=require(_0xf8e3('0x8'));var ejs=require(_0xf8e3('0x9'));var fs=require('fs');var fs_extra=require(_0xf8e3('0xa'));var _=require(_0xf8e3('0xb'));var squel=require('squel');var crypto=require(_0xf8e3('0xc'));var jsforce=require(_0xf8e3('0xd'));var deskjs=require(_0xf8e3('0xe'));var toCsv=require(_0xf8e3('0x8'));var querystring=require(_0xf8e3('0xf'));var Papa=require(_0xf8e3('0x10'));var Redis=require(_0xf8e3('0x11'));var authService=require(_0xf8e3('0x12'));var qs=require(_0xf8e3('0x13'));var as=require(_0xf8e3('0x14'));var hardwareService=require(_0xf8e3('0x15'));var logger=require(_0xf8e3('0x16'))('api');var utils=require(_0xf8e3('0x17'));var config=require(_0xf8e3('0x18'));var licenseUtil=require(_0xf8e3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40ae02,_0x41f85e){_0x41f85e=_0x41f85e||0xcc;return function(_0x336790){if(_0x336790){return _0x40ae02[_0xf8e3('0x1a')](_0x41f85e);}return _0x40ae02['status'](_0x41f85e)[_0xf8e3('0x1b')]();};}function respondWithResult(_0xa856f5,_0x2fe631){_0x2fe631=_0x2fe631||0xc8;return function(_0x4af736){if(_0x4af736){return _0xa856f5[_0xf8e3('0x1c')](_0x2fe631)['json'](_0x4af736);}};}function respondWithFilteredResult(_0x1ec773,_0x40c196){return function(_0x460629){if(_0x460629){var _0x570ee3=typeof _0x40c196['offset']===_0xf8e3('0x1d')&&typeof _0x40c196[_0xf8e3('0x1e')]===_0xf8e3('0x1d');var _0x3b01ac=_0x460629[_0xf8e3('0x1f')];var _0x11d4cc=_0x570ee3?0x0:_0x40c196[_0xf8e3('0x20')];var _0x2e27e3=_0x570ee3?_0x460629[_0xf8e3('0x1f')]:_0x40c196[_0xf8e3('0x20')]+_0x40c196['limit'];var _0x20cc64;if(_0x2e27e3>=_0x3b01ac){_0x2e27e3=_0x3b01ac;_0x20cc64=0xc8;}else{_0x20cc64=0xce;}_0x1ec773[_0xf8e3('0x1c')](_0x20cc64);return _0x1ec773[_0xf8e3('0x21')](_0xf8e3('0x22'),_0x11d4cc+'-'+_0x2e27e3+'/'+_0x3b01ac)[_0xf8e3('0x23')](_0x460629);}return null;};}function patchUpdates(_0x11c58e){return function(_0x1cae53){try{jsonpatch[_0xf8e3('0x24')](_0x1cae53,_0x11c58e,!![]);}catch(_0x5b99b1){return BPromise[_0xf8e3('0x25')](_0x5b99b1);}return _0x1cae53[_0xf8e3('0x26')]();};}function saveUpdates(_0x3c636d,_0xccbcc0){return function(_0x4a1e5f){if(_0x4a1e5f){return _0x4a1e5f[_0xf8e3('0x27')](_0x3c636d)['then'](function(_0x286059){return _0x286059;});}return null;};}function removeEntity(_0x225a1b,_0x33d526){return function(_0x2dc856){if(_0x2dc856){return _0x2dc856[_0xf8e3('0x28')]()[_0xf8e3('0x29')](function(){_0x225a1b['status'](0xcc)[_0xf8e3('0x1b')]();});}};}function handleEntityNotFound(_0x2fc674,_0x3373ca){return function(_0x417b42){if(!_0x417b42){_0x2fc674[_0xf8e3('0x1a')](0x194);}return _0x417b42;};}function handleError(_0x3b41a1,_0x2963ed){_0x2963ed=_0x2963ed||0x1f4;return function(_0x157a2d){logger['error'](_0x157a2d[_0xf8e3('0x2a')]);if(_0x157a2d[_0xf8e3('0x2b')]){delete _0x157a2d[_0xf8e3('0x2b')];}_0x3b41a1[_0xf8e3('0x1c')](_0x2963ed)[_0xf8e3('0x2c')](_0x157a2d);};}exports[_0xf8e3('0x2d')]=function(_0x16485e,_0xfaf15d){var _0x4f2ae9={},_0x21e1c0={},_0x243e28={'count':0x0,'rows':[]};var _0x492694=_[_0xf8e3('0x2e')](db['MailQueueReport'][_0xf8e3('0x2f')],function(_0x10cf28){return{'name':_0x10cf28[_0xf8e3('0x30')],'type':_0x10cf28[_0xf8e3('0x31')][_0xf8e3('0x32')]};});_0x21e1c0[_0xf8e3('0x33')]=_[_0xf8e3('0x2e')](_0x492694,_0xf8e3('0x2b'));_0x21e1c0['query']=_[_0xf8e3('0x34')](_0x16485e[_0xf8e3('0x35')]);_0x21e1c0['filters']=_['intersection'](_0x21e1c0['model'],_0x21e1c0[_0xf8e3('0x35')]);_0x4f2ae9['attributes']=_[_0xf8e3('0x36')](_0x21e1c0[_0xf8e3('0x33')],qs[_0xf8e3('0x37')](_0x16485e[_0xf8e3('0x35')]['fields']));_0x4f2ae9['attributes']=_0x4f2ae9[_0xf8e3('0x38')][_0xf8e3('0x39')]?_0x4f2ae9[_0xf8e3('0x38')]:_0x21e1c0[_0xf8e3('0x33')];if(!_0x16485e[_0xf8e3('0x35')][_0xf8e3('0x3a')]('nolimit')){_0x4f2ae9[_0xf8e3('0x1e')]=qs['limit'](_0x16485e['query'][_0xf8e3('0x1e')]);_0x4f2ae9[_0xf8e3('0x20')]=qs[_0xf8e3('0x20')](_0x16485e[_0xf8e3('0x35')]['offset']);}_0x4f2ae9['order']=qs[_0xf8e3('0x3b')](_0x16485e[_0xf8e3('0x35')]['sort']);_0x4f2ae9[_0xf8e3('0x3c')]=qs[_0xf8e3('0x3d')](_[_0xf8e3('0x3e')](_0x16485e[_0xf8e3('0x35')],_0x21e1c0['filters']),_0x492694);if(_0x16485e['query']['filter']){_0x4f2ae9[_0xf8e3('0x3c')]=_[_0xf8e3('0x3f')](_0x4f2ae9[_0xf8e3('0x3c')],{'$or':_[_0xf8e3('0x2e')](_0x492694,function(_0x53160a){if(_0x53160a[_0xf8e3('0x31')]!=='VIRTUAL'){var _0x20909b={};_0x20909b[_0x53160a[_0xf8e3('0x2b')]]={'$like':'%'+_0x16485e[_0xf8e3('0x35')][_0xf8e3('0x40')]+'%'};return _0x20909b;}})});}_0x4f2ae9=_[_0xf8e3('0x3f')]({},_0x4f2ae9,_0x16485e[_0xf8e3('0x41')]);var _0x82e778={'where':_0x4f2ae9[_0xf8e3('0x3c')]};return db[_0xf8e3('0x42')]['count'](_0x82e778)[_0xf8e3('0x29')](function(_0x537089){_0x243e28[_0xf8e3('0x1f')]=_0x537089;if(_0x16485e[_0xf8e3('0x35')][_0xf8e3('0x43')]){_0x4f2ae9[_0xf8e3('0x44')]=[{'all':!![]}];}return db[_0xf8e3('0x42')][_0xf8e3('0x45')](_0x4f2ae9);})[_0xf8e3('0x29')](function(_0x2f05b7){_0x243e28['rows']=_0x2f05b7;return _0x243e28;})[_0xf8e3('0x29')](respondWithFilteredResult(_0xfaf15d,_0x4f2ae9))[_0xf8e3('0x46')](handleError(_0xfaf15d,null));};exports[_0xf8e3('0x47')]=function(_0x382dbb,_0x6dd110){var _0xe7fcb9={'raw':!![],'where':{'id':_0x382dbb[_0xf8e3('0x48')]['id']}},_0x792190={};_0x792190['model']=_['keys'](db['MailQueueReport'][_0xf8e3('0x2f')]);_0x792190[_0xf8e3('0x35')]=_['keys'](_0x382dbb[_0xf8e3('0x35')]);_0x792190['filters']=_[_0xf8e3('0x36')](_0x792190[_0xf8e3('0x33')],_0x792190['query']);_0xe7fcb9[_0xf8e3('0x38')]=_['intersection'](_0x792190[_0xf8e3('0x33')],qs[_0xf8e3('0x37')](_0x382dbb['query'][_0xf8e3('0x37')]));_0xe7fcb9[_0xf8e3('0x38')]=_0xe7fcb9[_0xf8e3('0x38')][_0xf8e3('0x39')]?_0xe7fcb9['attributes']:_0x792190['model'];if(_0x382dbb['query'][_0xf8e3('0x43')]){_0xe7fcb9[_0xf8e3('0x44')]=[{'all':!![]}];}_0xe7fcb9=_[_0xf8e3('0x3f')]({},_0xe7fcb9,_0x382dbb['options']);return db[_0xf8e3('0x42')]['find'](_0xe7fcb9)[_0xf8e3('0x29')](handleEntityNotFound(_0x6dd110,null))[_0xf8e3('0x29')](respondWithResult(_0x6dd110,null))['catch'](handleError(_0x6dd110,null));};exports['create']=function(_0x128234,_0x2939e6){return db[_0xf8e3('0x42')][_0xf8e3('0x49')](_0x128234[_0xf8e3('0x4a')],{})[_0xf8e3('0x29')](respondWithResult(_0x2939e6,0xc9))[_0xf8e3('0x46')](handleError(_0x2939e6,null));};exports[_0xf8e3('0x27')]=function(_0xdc2430,_0x81898e){if(_0xdc2430[_0xf8e3('0x4a')]['id']){delete _0xdc2430['body']['id'];}return db[_0xf8e3('0x42')][_0xf8e3('0x4b')]({'where':{'id':_0xdc2430[_0xf8e3('0x48')]['id']}})[_0xf8e3('0x29')](handleEntityNotFound(_0x81898e,null))[_0xf8e3('0x29')](saveUpdates(_0xdc2430[_0xf8e3('0x4a')],null))['then'](respondWithResult(_0x81898e,null))[_0xf8e3('0x46')](handleError(_0x81898e,null));};exports[_0xf8e3('0x28')]=function(_0x39caae,_0x3e60a6){return db[_0xf8e3('0x42')][_0xf8e3('0x4b')]({'where':{'id':_0x39caae['params']['id']}})[_0xf8e3('0x29')](handleEntityNotFound(_0x3e60a6,null))[_0xf8e3('0x29')](removeEntity(_0x3e60a6,null))[_0xf8e3('0x46')](handleError(_0x3e60a6,null));};exports[_0xf8e3('0x4c')]=function(_0x113404,_0x2fef16){return db['MailQueueReport'][_0xf8e3('0x4c')]()[_0xf8e3('0x29')](respondWithResult(_0x2fef16,null))[_0xf8e3('0x46')](handleError(_0x2fef16,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 06ab35b..aef4dcf 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 _0x8084=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid'];(function(_0xfadf1d,_0x1c2861){var _0x113427=function(_0x40fe46){while(--_0x40fe46){_0xfadf1d['push'](_0xfadf1d['shift']());}};_0x113427(++_0x1c2861);}(_0x8084,0x13b));var _0x4808=function(_0x2c81bd,_0x4a86ae){_0x2c81bd=_0x2c81bd-0x0;var _0x4c9a90=_0x8084[_0x2c81bd];return _0x4c9a90;};'use strict';var _=require(_0x4808('0x0'));var util=require(_0x4808('0x1'));var logger=require(_0x4808('0x2'))(_0x4808('0x3'));var moment=require(_0x4808('0x4'));var BPromise=require(_0x4808('0x5'));var rp=require(_0x4808('0x6'));var fs=require('fs');var path=require(_0x4808('0x7'));var rimraf=require(_0x4808('0x8'));var config=require(_0x4808('0x9'));var attributes=require(_0x4808('0xa'));module[_0x4808('0xb')]=function(_0x409ae5,_0x31f3c7){return _0x409ae5[_0x4808('0xc')](_0x4808('0xd'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x4808('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb5be=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util'];(function(_0x45e23f,_0x4e3d26){var _0x4e8234=function(_0x37d5d8){while(--_0x37d5d8){_0x45e23f['push'](_0x45e23f['shift']());}};_0x4e8234(++_0x4e3d26);}(_0xb5be,0x116));var _0xeb5b=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xb5be[_0x4d613c];return _0x301fe3;};'use strict';var _=require(_0xeb5b('0x0'));var util=require(_0xeb5b('0x1'));var logger=require(_0xeb5b('0x2'))(_0xeb5b('0x3'));var moment=require(_0xeb5b('0x4'));var BPromise=require(_0xeb5b('0x5'));var rp=require(_0xeb5b('0x6'));var fs=require('fs');var path=require(_0xeb5b('0x7'));var rimraf=require(_0xeb5b('0x8'));var config=require('../../config/environment');var attributes=require('./mailQueueReport.attributes');module[_0xeb5b('0x9')]=function(_0x169cd0,_0x1c43fd){return _0x169cd0[_0xeb5b('0xa')](_0xeb5b('0xb'),attributes,{'tableName':_0xeb5b('0xc'),'paranoid':![],'indexes':[{'name':_0xeb5b('0xd'),'fields':[_0xeb5b('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 6405f06..0615059 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(_0x42ea7d,_0x7dd28){var _0x5006eb=function(_0x45e16b){while(--_0x45e16b){_0x42ea7d['push'](_0x42ea7d['shift']());}};_0x5006eb(++_0x7dd28);}(_0xdb28,0x106));var _0x8db2=function(_0x480ceb,_0x29da23){_0x480ceb=_0x480ceb-0x0;var _0x39001b=_0xdb28[_0x480ceb];return _0x39001b;};'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 _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x31d49a,_0x39db95){var _0x120cab=function(_0x46e9d5){while(--_0x46e9d5){_0x31d49a['push'](_0x31d49a['shift']());}};_0x120cab(++_0x39db95);}(_0x7a54,0x106));var _0x47a5=function(_0x2b87b8,_0x2b836b){_0x2b87b8=_0x2b87b8-0x0;var _0x3621aa=_0x7a54[_0x2b87b8];return _0x3621aa;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateMailQueueReport']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateMailQueueReport',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index bdb75a8..c28f612 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x145558,_0x306e73){var _0x2b4e8b=function(_0x32d4f3){while(--_0x32d4f3){_0x145558['push'](_0x145558['shift']());}};_0x2b4e8b(++_0x306e73);}(_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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x1df0c4,_0x218406){var _0x4c9b58=function(_0x2990aa){while(--_0x2990aa){_0x1df0c4['push'](_0x1df0c4['shift']());}};_0x4c9b58(++_0x218406);}(_0xedd9,0xfc));var _0x9edd=function(_0x230d14,_0x340efe){_0x230d14=_0x230d14-0x0;var _0x3c1f5a=_0xedd9[_0x230d14];return _0x3c1f5a;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 17206bb..a265d66 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 _0x5423=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5423,0xe3));var _0x3542=function(_0x190926,_0x3e9d46){_0x190926=_0x190926-0x0;var _0x56036f=_0x5423[_0x190926];return _0x56036f;};'use strict';var Sequelize=require(_0x3542('0x0'));module[_0x3542('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x3542('0x2')]},'authentication':{'type':Sequelize[_0x3542('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x3542('0x2')]},'port':{'type':Sequelize[_0x3542('0x4')]},'tls':{'type':Sequelize[_0x3542('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x3542('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x3542('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x3542('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x3542('0x2')]}}; \ No newline at end of file +var _0xf7b4=['BOOLEAN','INTEGER','INBOX','sequelize','STRING'];(function(_0x3cff6f,_0x179de0){var _0x45583d=function(_0x46a9ae){while(--_0x46a9ae){_0x3cff6f['push'](_0x3cff6f['shift']());}};_0x45583d(++_0x179de0);}(_0xf7b4,0x152));var _0x4f7b=function(_0x5c166c,_0x3e6631){_0x5c166c=_0x5c166c-0x0;var _0x15fe1f=_0xf7b4[_0x5c166c];return _0x15fe1f;};'use strict';var Sequelize=require(_0x4f7b('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x4f7b('0x1')]},'authentication':{'type':Sequelize[_0x4f7b('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x4f7b('0x3')]},'tls':{'type':Sequelize[_0x4f7b('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x4f7b('0x1')],'defaultValue':_0x4f7b('0x4')},'connTimeout':{'type':Sequelize[_0x4f7b('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x4f7b('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x4f7b('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 5a90a48..6d9eda9 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 _0x94ba=['./mailServerIn.attributes','MailServerIn','mail_servers_in','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x2cc7a6,_0x4b3290){var _0x34bf25=function(_0x1bfbce){while(--_0x1bfbce){_0x2cc7a6['push'](_0x2cc7a6['shift']());}};_0x34bf25(++_0x4b3290);}(_0x94ba,0xbe));var _0xa94b=function(_0x2b98d4,_0x1de753){_0x2b98d4=_0x2b98d4-0x0;var _0x76ce5b=_0x94ba[_0x2b98d4];return _0x76ce5b;};'use strict';var _=require('lodash');var util=require(_0xa94b('0x0'));var logger=require(_0xa94b('0x1'))(_0xa94b('0x2'));var moment=require(_0xa94b('0x3'));var BPromise=require('bluebird');var rp=require(_0xa94b('0x4'));var fs=require('fs');var path=require(_0xa94b('0x5'));var rimraf=require(_0xa94b('0x6'));var config=require(_0xa94b('0x7'));var attributes=require(_0xa94b('0x8'));module['exports']=function(_0x1976c9,_0x705f60){return _0x1976c9['define'](_0xa94b('0x9'),attributes,{'tableName':_0xa94b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x558d=['lodash','util','api','moment','bluebird','path','rimraf','./mailServerIn.attributes','define','MailServerIn','mail_servers_in'];(function(_0x21331a,_0x57fc48){var _0x325c55=function(_0x770dfa){while(--_0x770dfa){_0x21331a['push'](_0x21331a['shift']());}};_0x325c55(++_0x57fc48);}(_0x558d,0x1a2));var _0xd558=function(_0x164b96,_0x12f735){_0x164b96=_0x164b96-0x0;var _0x5489d9=_0x558d[_0x164b96];return _0x5489d9;};'use strict';var _=require(_0xd558('0x0'));var util=require(_0xd558('0x1'));var logger=require('../../config/logger')(_0xd558('0x2'));var moment=require(_0xd558('0x3'));var BPromise=require(_0xd558('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd558('0x5'));var rimraf=require(_0xd558('0x6'));var config=require('../../config/environment');var attributes=require(_0xd558('0x7'));module['exports']=function(_0x135eee,_0x5c682e){return _0x135eee[_0xd558('0x8')](_0xd558('0x9'),attributes,{'tableName':_0xd558('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 125c8d6..637e412 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 _0xec08=['map','model','attributes','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetMailServerIn','findAll','options','raw','where','include'];(function(_0x797f8,_0x5ecd62){var _0x55e130=function(_0x3e5efa){while(--_0x3e5efa){_0x797f8['push'](_0x797f8['shift']());}};_0x55e130(++_0x5ecd62);}(_0xec08,0xad));var _0x8ec0=function(_0x19f8a1,_0x5ce8eb){_0x19f8a1=_0x19f8a1-0x0;var _0x50fe29=_0xec08[_0x19f8a1];return _0x50fe29;};'use strict';var _=require('lodash');var util=require(_0x8ec0('0x0'));var moment=require('moment');var BPromise=require(_0x8ec0('0x1'));var rs=require(_0x8ec0('0x2'));var fs=require('fs');var Redis=require(_0x8ec0('0x3'));var db=require(_0x8ec0('0x4'))['db'];var utils=require(_0x8ec0('0x5'));var logger=require(_0x8ec0('0x6'))(_0x8ec0('0x7'));var config=require(_0x8ec0('0x8'));var jayson=require(_0x8ec0('0x9'));var client=jayson[_0x8ec0('0xa')][_0x8ec0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe6f4dc,_0x1a021d,_0x1a06c8){return new BPromise(function(_0x590a23,_0x2821eb){return client[_0x8ec0('0xc')](_0xe6f4dc,_0x1a06c8)[_0x8ec0('0xd')](function(_0x1fc9c0){logger[_0x8ec0('0xe')](_0x8ec0('0xf'),_0x1a021d,_0x8ec0('0x10'));logger[_0x8ec0('0x11')](_0x8ec0('0x12'),_0x1a021d,'request\x20sent',JSON[_0x8ec0('0x13')](_0x1fc9c0));if(_0x1fc9c0['error']){if(_0x1fc9c0['error'][_0x8ec0('0x14')]===0x1f4){logger['error'](_0x8ec0('0xf'),_0x1a021d,_0x1fc9c0[_0x8ec0('0x15')][_0x8ec0('0x16')]);return _0x2821eb(_0x1fc9c0['error'][_0x8ec0('0x16')]);}logger[_0x8ec0('0x15')](_0x8ec0('0xf'),_0x1a021d,_0x1fc9c0['error'][_0x8ec0('0x16')]);return _0x590a23(_0x1fc9c0[_0x8ec0('0x15')][_0x8ec0('0x16')]);}else{logger[_0x8ec0('0xe')](_0x8ec0('0xf'),_0x1a021d,_0x8ec0('0x10'));_0x590a23(_0x1fc9c0[_0x8ec0('0x17')][_0x8ec0('0x16')]);}})[_0x8ec0('0x18')](function(_0x26b3a7){logger[_0x8ec0('0x15')](_0x8ec0('0xf'),_0x1a021d,_0x26b3a7);_0x2821eb(_0x26b3a7);});});}exports[_0x8ec0('0x19')]=function(_0x92d98f){var _0x583b7b=this;return new Promise(function(_0x2dfc23,_0x54599d){return db['MailServerIn'][_0x8ec0('0x1a')]({'raw':_0x92d98f['options']?_0x92d98f[_0x8ec0('0x1b')][_0x8ec0('0x1c')]===undefined?!![]:![]:!![],'where':_0x92d98f['options']?_0x92d98f['options'][_0x8ec0('0x1d')]||null:null,'attributes':_0x92d98f['options']?_0x92d98f[_0x8ec0('0x1b')]['attributes']||null:null,'limit':_0x92d98f[_0x8ec0('0x1b')]?_0x92d98f['options']['limit']||null:null,'include':_0x92d98f['options']?_0x92d98f[_0x8ec0('0x1b')][_0x8ec0('0x1e')]?_[_0x8ec0('0x1f')](_0x92d98f[_0x8ec0('0x1b')][_0x8ec0('0x1e')],function(_0x3c150c){return{'model':db[_0x3c150c[_0x8ec0('0x20')]],'as':_0x3c150c['as'],'attributes':_0x3c150c[_0x8ec0('0x21')],'include':_0x3c150c[_0x8ec0('0x1e')]?_[_0x8ec0('0x1f')](_0x3c150c[_0x8ec0('0x1e')],function(_0x5124bd){return{'model':db[_0x5124bd['model']],'as':_0x5124bd['as'],'attributes':_0x5124bd[_0x8ec0('0x21')],'include':_0x5124bd[_0x8ec0('0x1e')]?_[_0x8ec0('0x1f')](_0x5124bd[_0x8ec0('0x1e')],function(_0x448819){return{'model':db[_0x448819[_0x8ec0('0x20')]],'as':_0x448819['as'],'attributes':_0x448819['attributes']};}):[]};}):[]};}):[]:[]})[_0x8ec0('0xd')](function(_0x1ab61c){logger[_0x8ec0('0xe')]('GetMailServerIn',_0x92d98f);logger[_0x8ec0('0x11')]('GetMailServerIn',_0x92d98f,JSON[_0x8ec0('0x13')](_0x1ab61c));_0x2dfc23(_0x1ab61c);})[_0x8ec0('0x18')](function(_0x236c80){logger[_0x8ec0('0x15')](_0x8ec0('0x19'),_0x236c80[_0x8ec0('0x16')],_0x92d98f);_0x54599d(_0x583b7b['error'](0x1f4,_0x236c80[_0x8ec0('0x16')]));});});}; \ No newline at end of file +var _0x2dfb=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetMailServerIn','findAll','options','raw','where','attributes','include','map','model','debug','catch'];(function(_0x51f5d0,_0xb90d1a){var _0x17b622=function(_0x472f57){while(--_0x472f57){_0x51f5d0['push'](_0x51f5d0['shift']());}};_0x17b622(++_0xb90d1a);}(_0x2dfb,0x10e));var _0xb2df=function(_0x45b1ee,_0x246218){_0x45b1ee=_0x45b1ee-0x0;var _0x2c93af=_0x2dfb[_0x45b1ee];return _0x2c93af;};'use strict';var _=require(_0xb2df('0x0'));var util=require(_0xb2df('0x1'));var moment=require('moment');var BPromise=require(_0xb2df('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb2df('0x3'));var db=require(_0xb2df('0x4'))['db'];var utils=require(_0xb2df('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xb2df('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb2df('0x7')][_0xb2df('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2e4ade,_0x3a8b74,_0x203af6){return new BPromise(function(_0x26bd09,_0x43a8c0){return client[_0xb2df('0x9')](_0x2e4ade,_0x203af6)[_0xb2df('0xa')](function(_0x4abd84){logger[_0xb2df('0xb')](_0xb2df('0xc'),_0x3a8b74,'request\x20sent');logger['debug'](_0xb2df('0xd'),_0x3a8b74,_0xb2df('0xe'),JSON[_0xb2df('0xf')](_0x4abd84));if(_0x4abd84[_0xb2df('0x10')]){if(_0x4abd84[_0xb2df('0x10')][_0xb2df('0x11')]===0x1f4){logger[_0xb2df('0x10')](_0xb2df('0xc'),_0x3a8b74,_0x4abd84[_0xb2df('0x10')][_0xb2df('0x12')]);return _0x43a8c0(_0x4abd84[_0xb2df('0x10')][_0xb2df('0x12')]);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x3a8b74,_0x4abd84[_0xb2df('0x10')]['message']);return _0x26bd09(_0x4abd84[_0xb2df('0x10')][_0xb2df('0x12')]);}else{logger[_0xb2df('0xb')]('MailServerIn,\x20%s,\x20%s',_0x3a8b74,_0xb2df('0xe'));_0x26bd09(_0x4abd84['result']['message']);}})['catch'](function(_0x2dbaae){logger[_0xb2df('0x10')]('MailServerIn,\x20%s,\x20%s',_0x3a8b74,_0x2dbaae);_0x43a8c0(_0x2dbaae);});});}exports[_0xb2df('0x13')]=function(_0x37e733){var _0x301635=this;return new Promise(function(_0x327d4a,_0x712d8){return db['MailServerIn'][_0xb2df('0x14')]({'raw':_0x37e733[_0xb2df('0x15')]?_0x37e733[_0xb2df('0x15')][_0xb2df('0x16')]===undefined?!![]:![]:!![],'where':_0x37e733[_0xb2df('0x15')]?_0x37e733[_0xb2df('0x15')][_0xb2df('0x17')]||null:null,'attributes':_0x37e733['options']?_0x37e733[_0xb2df('0x15')][_0xb2df('0x18')]||null:null,'limit':_0x37e733[_0xb2df('0x15')]?_0x37e733[_0xb2df('0x15')]['limit']||null:null,'include':_0x37e733[_0xb2df('0x15')]?_0x37e733[_0xb2df('0x15')][_0xb2df('0x19')]?_[_0xb2df('0x1a')](_0x37e733[_0xb2df('0x15')][_0xb2df('0x19')],function(_0x38094e){return{'model':db[_0x38094e[_0xb2df('0x1b')]],'as':_0x38094e['as'],'attributes':_0x38094e[_0xb2df('0x18')],'include':_0x38094e[_0xb2df('0x19')]?_[_0xb2df('0x1a')](_0x38094e[_0xb2df('0x19')],function(_0x173acd){return{'model':db[_0x173acd[_0xb2df('0x1b')]],'as':_0x173acd['as'],'attributes':_0x173acd[_0xb2df('0x18')],'include':_0x173acd['include']?_[_0xb2df('0x1a')](_0x173acd[_0xb2df('0x19')],function(_0x14ccd3){return{'model':db[_0x14ccd3['model']],'as':_0x14ccd3['as'],'attributes':_0x14ccd3['attributes']};}):[]};}):[]};}):[]:[]})[_0xb2df('0xa')](function(_0x4efab0){logger['info'](_0xb2df('0x13'),_0x37e733);logger[_0xb2df('0x1c')]('GetMailServerIn',_0x37e733,JSON[_0xb2df('0xf')](_0x4efab0));_0x327d4a(_0x4efab0);})[_0xb2df('0x1d')](function(_0x33c9b8){logger[_0xb2df('0x10')]('GetMailServerIn',_0x33c9b8[_0xb2df('0x12')],_0x37e733);_0x712d8(_0x301635[_0xb2df('0x10')](0x1f4,_0x33c9b8[_0xb2df('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index ef9ae1e..617f2ad 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(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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 _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(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index ac994cb..f6fbb5b 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 _0xd052=['BOOLEAN','STRING'];(function(_0x17df5b,_0x4b8907){var _0x15de9f=function(_0x507508){while(--_0x507508){_0x17df5b['push'](_0x17df5b['shift']());}};_0x15de9f(++_0x4b8907);}(_0xd052,0x69));var _0x2d05=function(_0x11d15a,_0x197695){_0x11d15a=_0x11d15a-0x0;var _0x43c231=_0xd052[_0x11d15a];return _0x43c231;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x2d05('0x0')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x2d05('0x0')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x2d05('0x1')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x2d05('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0xb0c3=['STRING','BOOLEAN','sequelize','exports'];(function(_0x131cf6,_0xb48544){var _0x2b2e99=function(_0x5996d1){while(--_0x5996d1){_0x131cf6['push'](_0x131cf6['shift']());}};_0x2b2e99(++_0xb48544);}(_0xb0c3,0x9a));var _0x3b0c=function(_0x185ca0,_0x548954){_0x185ca0=_0x185ca0-0x0;var _0x40f97c=_0xb0c3[_0x185ca0];return _0x40f97c;};'use strict';var Sequelize=require(_0x3b0c('0x0'));module[_0x3b0c('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x3b0c('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x3b0c('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x3b0c('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index d61b297..715dadf 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 _0x18db=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','options','MailServerOut','includeAll','include','findAll','rows','catch','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x333d03,_0x3555c5){var _0x4f1032=function(_0x344ae4){while(--_0x344ae4){_0x333d03['push'](_0x333d03['shift']());}};_0x4f1032(++_0x3555c5);}(_0x18db,0xc9));var _0xb18d=function(_0x9d088a,_0x4d6f3c){_0x9d088a=_0x9d088a-0x0;var _0x1685a7=_0x18db[_0x9d088a];return _0x1685a7;};'use strict';var emlformat=require(_0xb18d('0x0'));var rimraf=require(_0xb18d('0x1'));var zipdir=require(_0xb18d('0x2'));var jsonpatch=require(_0xb18d('0x3'));var rp=require(_0xb18d('0x4'));var moment=require(_0xb18d('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb18d('0x6'));var path=require(_0xb18d('0x7'));var sox=require(_0xb18d('0x8'));var csv=require(_0xb18d('0x9'));var ejs=require(_0xb18d('0xa'));var fs=require('fs');var fs_extra=require(_0xb18d('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb18d('0xc'));var jsforce=require(_0xb18d('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb18d('0xe'));var Redis=require(_0xb18d('0xf'));var authService=require(_0xb18d('0x10'));var qs=require(_0xb18d('0x11'));var as=require(_0xb18d('0x12'));var hardwareService=require(_0xb18d('0x13'));var logger=require('../../config/logger')(_0xb18d('0x14'));var utils=require(_0xb18d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb18d('0x16'));var db=require(_0xb18d('0x17'))['db'];function respondWithStatusCode(_0x497b80,_0x1bc5c3){_0x1bc5c3=_0x1bc5c3||0xcc;return function(_0xfafe7b){if(_0xfafe7b){return _0x497b80[_0xb18d('0x18')](_0x1bc5c3);}return _0x497b80[_0xb18d('0x19')](_0x1bc5c3)['end']();};}function respondWithResult(_0x45fe01,_0x55666f){_0x55666f=_0x55666f||0xc8;return function(_0x49705b){if(_0x49705b){return _0x45fe01[_0xb18d('0x19')](_0x55666f)[_0xb18d('0x1a')](_0x49705b);}};}function respondWithFilteredResult(_0x176f10,_0x3589a7){return function(_0x566a83){if(_0x566a83){var _0x49c7da=typeof _0x3589a7['offset']===_0xb18d('0x1b')&&typeof _0x3589a7[_0xb18d('0x1c')]==='undefined';var _0x2dbdef=_0x566a83['count'];var _0x4b0e24=_0x49c7da?0x0:_0x3589a7[_0xb18d('0x1d')];var _0x5ab0ad=_0x49c7da?_0x566a83[_0xb18d('0x1e')]:_0x3589a7[_0xb18d('0x1d')]+_0x3589a7['limit'];var _0x3ee483;if(_0x5ab0ad>=_0x2dbdef){_0x5ab0ad=_0x2dbdef;_0x3ee483=0xc8;}else{_0x3ee483=0xce;}_0x176f10['status'](_0x3ee483);return _0x176f10['set']('Content-Range',_0x4b0e24+'-'+_0x5ab0ad+'/'+_0x2dbdef)['json'](_0x566a83);}return null;};}function patchUpdates(_0x1f6277){return function(_0x44e554){try{jsonpatch[_0xb18d('0x1f')](_0x44e554,_0x1f6277,!![]);}catch(_0x4e358c){return BPromise[_0xb18d('0x20')](_0x4e358c);}return _0x44e554[_0xb18d('0x21')]();};}function saveUpdates(_0x17fb30,_0x5e3c77){return function(_0x33992f){if(_0x33992f){return _0x33992f[_0xb18d('0x22')](_0x17fb30)[_0xb18d('0x23')](function(_0x5e0a7d){return _0x5e0a7d;});}return null;};}function removeEntity(_0x141766,_0x282880){return function(_0x46b68d){if(_0x46b68d){return _0x46b68d[_0xb18d('0x24')]()[_0xb18d('0x23')](function(){_0x141766[_0xb18d('0x19')](0xcc)[_0xb18d('0x25')]();});}};}function handleEntityNotFound(_0x488de6,_0x32c90f){return function(_0x2d2a84){if(!_0x2d2a84){_0x488de6[_0xb18d('0x18')](0x194);}return _0x2d2a84;};}function handleError(_0x3da344,_0x34e435){_0x34e435=_0x34e435||0x1f4;return function(_0x5df15){logger[_0xb18d('0x26')](_0x5df15[_0xb18d('0x27')]);if(_0x5df15[_0xb18d('0x28')]){delete _0x5df15['name'];}_0x3da344[_0xb18d('0x19')](_0x34e435)[_0xb18d('0x29')](_0x5df15);};}exports[_0xb18d('0x2a')]=function(_0x17a95f,_0x5c59ca){var _0xcea06={},_0x36e4d2={},_0x2d9c88={'count':0x0,'rows':[]};var _0x40d442=_[_0xb18d('0x2b')](db['MailServerOut'][_0xb18d('0x2c')],function(_0x4635d8){return{'name':_0x4635d8[_0xb18d('0x2d')],'type':_0x4635d8[_0xb18d('0x2e')]['key']};});_0x36e4d2[_0xb18d('0x2f')]=_[_0xb18d('0x2b')](_0x40d442,_0xb18d('0x28'));_0x36e4d2[_0xb18d('0x30')]=_[_0xb18d('0x31')](_0x17a95f[_0xb18d('0x30')]);_0x36e4d2['filters']=_[_0xb18d('0x32')](_0x36e4d2[_0xb18d('0x2f')],_0x36e4d2[_0xb18d('0x30')]);_0xcea06[_0xb18d('0x33')]=_[_0xb18d('0x32')](_0x36e4d2[_0xb18d('0x2f')],qs[_0xb18d('0x34')](_0x17a95f[_0xb18d('0x30')]['fields']));_0xcea06['attributes']=_0xcea06[_0xb18d('0x33')][_0xb18d('0x35')]?_0xcea06[_0xb18d('0x33')]:_0x36e4d2[_0xb18d('0x2f')];if(!_0x17a95f[_0xb18d('0x30')][_0xb18d('0x36')](_0xb18d('0x37'))){_0xcea06['limit']=qs[_0xb18d('0x1c')](_0x17a95f['query'][_0xb18d('0x1c')]);_0xcea06['offset']=qs[_0xb18d('0x1d')](_0x17a95f[_0xb18d('0x30')][_0xb18d('0x1d')]);}_0xcea06[_0xb18d('0x38')]=qs[_0xb18d('0x39')](_0x17a95f[_0xb18d('0x30')][_0xb18d('0x39')]);_0xcea06['where']=qs['filters'](_['pick'](_0x17a95f[_0xb18d('0x30')],_0x36e4d2[_0xb18d('0x3a')]),_0x40d442);if(_0x17a95f[_0xb18d('0x30')][_0xb18d('0x3b')]){_0xcea06[_0xb18d('0x3c')]=_[_0xb18d('0x3d')](_0xcea06[_0xb18d('0x3c')],{'$or':_[_0xb18d('0x2b')](_0x40d442,function(_0x2c2d11){if(_0x2c2d11[_0xb18d('0x2e')]!=='VIRTUAL'){var _0x932d35={};_0x932d35[_0x2c2d11[_0xb18d('0x28')]]={'$like':'%'+_0x17a95f[_0xb18d('0x30')]['filter']+'%'};return _0x932d35;}})});}_0xcea06=_[_0xb18d('0x3d')]({},_0xcea06,_0x17a95f[_0xb18d('0x3e')]);var _0xc58782={'where':_0xcea06[_0xb18d('0x3c')]};return db[_0xb18d('0x3f')]['count'](_0xc58782)[_0xb18d('0x23')](function(_0x32ad6c){_0x2d9c88[_0xb18d('0x1e')]=_0x32ad6c;if(_0x17a95f['query'][_0xb18d('0x40')]){_0xcea06[_0xb18d('0x41')]=[{'all':!![]}];}return db['MailServerOut'][_0xb18d('0x42')](_0xcea06);})['then'](function(_0x19b71a){_0x2d9c88[_0xb18d('0x43')]=_0x19b71a;return _0x2d9c88;})[_0xb18d('0x23')](respondWithFilteredResult(_0x5c59ca,_0xcea06))[_0xb18d('0x44')](handleError(_0x5c59ca,null));};exports['show']=function(_0x5d90fd,_0x4b9efc){var _0x23b53f={'raw':!![],'where':{'id':_0x5d90fd[_0xb18d('0x45')]['id']}},_0x2887e7={};_0x2887e7[_0xb18d('0x2f')]=_['keys'](db['MailServerOut'][_0xb18d('0x2c')]);_0x2887e7[_0xb18d('0x30')]=_[_0xb18d('0x31')](_0x5d90fd['query']);_0x2887e7[_0xb18d('0x3a')]=_['intersection'](_0x2887e7[_0xb18d('0x2f')],_0x2887e7[_0xb18d('0x30')]);_0x23b53f['attributes']=_[_0xb18d('0x32')](_0x2887e7[_0xb18d('0x2f')],qs[_0xb18d('0x34')](_0x5d90fd['query']['fields']));_0x23b53f[_0xb18d('0x33')]=_0x23b53f[_0xb18d('0x33')][_0xb18d('0x35')]?_0x23b53f['attributes']:_0x2887e7[_0xb18d('0x2f')];if(_0x5d90fd[_0xb18d('0x30')][_0xb18d('0x40')]){_0x23b53f['include']=[{'all':!![]}];}_0x23b53f=_[_0xb18d('0x3d')]({},_0x23b53f,_0x5d90fd['options']);return db[_0xb18d('0x3f')][_0xb18d('0x46')](_0x23b53f)[_0xb18d('0x23')](handleEntityNotFound(_0x4b9efc,null))[_0xb18d('0x23')](respondWithResult(_0x4b9efc,null))[_0xb18d('0x44')](handleError(_0x4b9efc,null));};exports['create']=function(_0x19ed14,_0x276195){return db['MailServerOut'][_0xb18d('0x47')](_0x19ed14['body'],{})[_0xb18d('0x23')](respondWithResult(_0x276195,0xc9))[_0xb18d('0x44')](handleError(_0x276195,null));};exports['update']=function(_0x485156,_0xccd762){if(_0x485156['body']['id']){delete _0x485156[_0xb18d('0x48')]['id'];}return db[_0xb18d('0x3f')]['find']({'where':{'id':_0x485156[_0xb18d('0x45')]['id']}})[_0xb18d('0x23')](handleEntityNotFound(_0xccd762,null))[_0xb18d('0x23')](saveUpdates(_0x485156[_0xb18d('0x48')],null))[_0xb18d('0x23')](respondWithResult(_0xccd762,null))[_0xb18d('0x44')](handleError(_0xccd762,null));};exports[_0xb18d('0x24')]=function(_0x14b148,_0x1477cf){return db['MailServerOut']['find']({'where':{'id':_0x14b148[_0xb18d('0x45')]['id']}})[_0xb18d('0x23')](handleEntityNotFound(_0x1477cf,null))[_0xb18d('0x23')](removeEntity(_0x1477cf,null))[_0xb18d('0x44')](handleError(_0x1477cf,null));}; \ No newline at end of file +var _0x3c72=['includeAll','findAll','rows','catch','show','params','length','include','find','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','intersection','fields','attributes','hasOwnProperty','limit','sort','where','filters','pick','filter','merge','VIRTUAL','options','MailServerOut'];(function(_0x2136f7,_0x5b49a1){var _0x4c5dea=function(_0x18a9c6){while(--_0x18a9c6){_0x2136f7['push'](_0x2136f7['shift']());}};_0x4c5dea(++_0x5b49a1);}(_0x3c72,0x182));var _0x23c7=function(_0x20dc5a,_0x5c9e8d){_0x20dc5a=_0x20dc5a-0x0;var _0x8f038=_0x3c72[_0x20dc5a];return _0x8f038;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x23c7('0x0'));var jsonpatch=require(_0x23c7('0x1'));var rp=require(_0x23c7('0x2'));var moment=require(_0x23c7('0x3'));var BPromise=require(_0x23c7('0x4'));var Mustache=require(_0x23c7('0x5'));var util=require(_0x23c7('0x6'));var path=require(_0x23c7('0x7'));var sox=require(_0x23c7('0x8'));var csv=require(_0x23c7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x23c7('0xa'));var crypto=require(_0x23c7('0xb'));var jsforce=require(_0x23c7('0xc'));var deskjs=require(_0x23c7('0xd'));var toCsv=require(_0x23c7('0x9'));var querystring=require('querystring');var Papa=require(_0x23c7('0xe'));var Redis=require(_0x23c7('0xf'));var authService=require(_0x23c7('0x10'));var qs=require(_0x23c7('0x11'));var as=require(_0x23c7('0x12'));var hardwareService=require(_0x23c7('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x23c7('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x23c7('0x15'));var db=require(_0x23c7('0x16'))['db'];function respondWithStatusCode(_0x1313ca,_0x3ac4f1){_0x3ac4f1=_0x3ac4f1||0xcc;return function(_0x4f10a5){if(_0x4f10a5){return _0x1313ca[_0x23c7('0x17')](_0x3ac4f1);}return _0x1313ca[_0x23c7('0x18')](_0x3ac4f1)[_0x23c7('0x19')]();};}function respondWithResult(_0x1a9fdb,_0x5d5221){_0x5d5221=_0x5d5221||0xc8;return function(_0x9d3641){if(_0x9d3641){return _0x1a9fdb[_0x23c7('0x18')](_0x5d5221)['json'](_0x9d3641);}};}function respondWithFilteredResult(_0x3ce8b,_0x3e7549){return function(_0x47bcf4){if(_0x47bcf4){var _0x5c3ad6=typeof _0x3e7549[_0x23c7('0x1a')]===_0x23c7('0x1b')&&typeof _0x3e7549['limit']===_0x23c7('0x1b');var _0x3b0631=_0x47bcf4['count'];var _0x850e84=_0x5c3ad6?0x0:_0x3e7549[_0x23c7('0x1a')];var _0x2c34e3=_0x5c3ad6?_0x47bcf4[_0x23c7('0x1c')]:_0x3e7549[_0x23c7('0x1a')]+_0x3e7549['limit'];var _0x1fe88e;if(_0x2c34e3>=_0x3b0631){_0x2c34e3=_0x3b0631;_0x1fe88e=0xc8;}else{_0x1fe88e=0xce;}_0x3ce8b[_0x23c7('0x18')](_0x1fe88e);return _0x3ce8b[_0x23c7('0x1d')](_0x23c7('0x1e'),_0x850e84+'-'+_0x2c34e3+'/'+_0x3b0631)[_0x23c7('0x1f')](_0x47bcf4);}return null;};}function patchUpdates(_0x541740){return function(_0x1930f1){try{jsonpatch[_0x23c7('0x20')](_0x1930f1,_0x541740,!![]);}catch(_0x4db5bc){return BPromise[_0x23c7('0x21')](_0x4db5bc);}return _0x1930f1[_0x23c7('0x22')]();};}function saveUpdates(_0x1e6c53,_0xc07680){return function(_0x592244){if(_0x592244){return _0x592244[_0x23c7('0x23')](_0x1e6c53)['then'](function(_0x25551c){return _0x25551c;});}return null;};}function removeEntity(_0x38c2c7,_0x4890fd){return function(_0x267758){if(_0x267758){return _0x267758[_0x23c7('0x24')]()[_0x23c7('0x25')](function(){_0x38c2c7[_0x23c7('0x18')](0xcc)[_0x23c7('0x19')]();});}};}function handleEntityNotFound(_0x266e01,_0x13ab39){return function(_0x4d9173){if(!_0x4d9173){_0x266e01[_0x23c7('0x17')](0x194);}return _0x4d9173;};}function handleError(_0xd8d51c,_0x3ca7b0){_0x3ca7b0=_0x3ca7b0||0x1f4;return function(_0x474dcc){logger[_0x23c7('0x26')](_0x474dcc[_0x23c7('0x27')]);if(_0x474dcc[_0x23c7('0x28')]){delete _0x474dcc['name'];}_0xd8d51c['status'](_0x3ca7b0)[_0x23c7('0x29')](_0x474dcc);};}exports[_0x23c7('0x2a')]=function(_0x3b775a,_0x5dd5a0){var _0x144def={},_0x1b624f={},_0x1c2aeb={'count':0x0,'rows':[]};var _0x55554b=_[_0x23c7('0x2b')](db['MailServerOut'][_0x23c7('0x2c')],function(_0x8aae){return{'name':_0x8aae[_0x23c7('0x2d')],'type':_0x8aae[_0x23c7('0x2e')]['key']};});_0x1b624f[_0x23c7('0x2f')]=_[_0x23c7('0x2b')](_0x55554b,_0x23c7('0x28'));_0x1b624f['query']=_[_0x23c7('0x30')](_0x3b775a[_0x23c7('0x31')]);_0x1b624f['filters']=_[_0x23c7('0x32')](_0x1b624f['model'],_0x1b624f[_0x23c7('0x31')]);_0x144def['attributes']=_['intersection'](_0x1b624f[_0x23c7('0x2f')],qs[_0x23c7('0x33')](_0x3b775a[_0x23c7('0x31')][_0x23c7('0x33')]));_0x144def[_0x23c7('0x34')]=_0x144def[_0x23c7('0x34')]['length']?_0x144def[_0x23c7('0x34')]:_0x1b624f[_0x23c7('0x2f')];if(!_0x3b775a[_0x23c7('0x31')][_0x23c7('0x35')]('nolimit')){_0x144def['limit']=qs[_0x23c7('0x36')](_0x3b775a[_0x23c7('0x31')]['limit']);_0x144def['offset']=qs[_0x23c7('0x1a')](_0x3b775a[_0x23c7('0x31')][_0x23c7('0x1a')]);}_0x144def['order']=qs[_0x23c7('0x37')](_0x3b775a[_0x23c7('0x31')][_0x23c7('0x37')]);_0x144def[_0x23c7('0x38')]=qs[_0x23c7('0x39')](_[_0x23c7('0x3a')](_0x3b775a[_0x23c7('0x31')],_0x1b624f[_0x23c7('0x39')]),_0x55554b);if(_0x3b775a[_0x23c7('0x31')][_0x23c7('0x3b')]){_0x144def[_0x23c7('0x38')]=_[_0x23c7('0x3c')](_0x144def[_0x23c7('0x38')],{'$or':_[_0x23c7('0x2b')](_0x55554b,function(_0x30de8b){if(_0x30de8b[_0x23c7('0x2e')]!==_0x23c7('0x3d')){var _0x5995b3={};_0x5995b3[_0x30de8b[_0x23c7('0x28')]]={'$like':'%'+_0x3b775a[_0x23c7('0x31')]['filter']+'%'};return _0x5995b3;}})});}_0x144def=_[_0x23c7('0x3c')]({},_0x144def,_0x3b775a[_0x23c7('0x3e')]);var _0x253446={'where':_0x144def[_0x23c7('0x38')]};return db[_0x23c7('0x3f')][_0x23c7('0x1c')](_0x253446)[_0x23c7('0x25')](function(_0x4a2c9e){_0x1c2aeb[_0x23c7('0x1c')]=_0x4a2c9e;if(_0x3b775a[_0x23c7('0x31')][_0x23c7('0x40')]){_0x144def['include']=[{'all':!![]}];}return db['MailServerOut'][_0x23c7('0x41')](_0x144def);})[_0x23c7('0x25')](function(_0x182492){_0x1c2aeb[_0x23c7('0x42')]=_0x182492;return _0x1c2aeb;})[_0x23c7('0x25')](respondWithFilteredResult(_0x5dd5a0,_0x144def))[_0x23c7('0x43')](handleError(_0x5dd5a0,null));};exports[_0x23c7('0x44')]=function(_0x895b92,_0x234db5){var _0x2aa2fa={'raw':!![],'where':{'id':_0x895b92[_0x23c7('0x45')]['id']}},_0x896317={};_0x896317['model']=_[_0x23c7('0x30')](db[_0x23c7('0x3f')]['rawAttributes']);_0x896317[_0x23c7('0x31')]=_[_0x23c7('0x30')](_0x895b92[_0x23c7('0x31')]);_0x896317[_0x23c7('0x39')]=_[_0x23c7('0x32')](_0x896317[_0x23c7('0x2f')],_0x896317[_0x23c7('0x31')]);_0x2aa2fa[_0x23c7('0x34')]=_[_0x23c7('0x32')](_0x896317['model'],qs[_0x23c7('0x33')](_0x895b92[_0x23c7('0x31')][_0x23c7('0x33')]));_0x2aa2fa[_0x23c7('0x34')]=_0x2aa2fa['attributes'][_0x23c7('0x46')]?_0x2aa2fa['attributes']:_0x896317[_0x23c7('0x2f')];if(_0x895b92['query'][_0x23c7('0x40')]){_0x2aa2fa[_0x23c7('0x47')]=[{'all':!![]}];}_0x2aa2fa=_['merge']({},_0x2aa2fa,_0x895b92[_0x23c7('0x3e')]);return db['MailServerOut'][_0x23c7('0x48')](_0x2aa2fa)[_0x23c7('0x25')](handleEntityNotFound(_0x234db5,null))[_0x23c7('0x25')](respondWithResult(_0x234db5,null))['catch'](handleError(_0x234db5,null));};exports['create']=function(_0x8b80a4,_0x4cc3bb){return db[_0x23c7('0x3f')][_0x23c7('0x49')](_0x8b80a4['body'],{})[_0x23c7('0x25')](respondWithResult(_0x4cc3bb,0xc9))[_0x23c7('0x43')](handleError(_0x4cc3bb,null));};exports[_0x23c7('0x23')]=function(_0x998477,_0x3f3851){if(_0x998477['body']['id']){delete _0x998477[_0x23c7('0x4a')]['id'];}return db['MailServerOut'][_0x23c7('0x48')]({'where':{'id':_0x998477[_0x23c7('0x45')]['id']}})[_0x23c7('0x25')](handleEntityNotFound(_0x3f3851,null))[_0x23c7('0x25')](saveUpdates(_0x998477['body'],null))[_0x23c7('0x25')](respondWithResult(_0x3f3851,null))['catch'](handleError(_0x3f3851,null));};exports[_0x23c7('0x24')]=function(_0x307f89,_0x38b345){return db['MailServerOut'][_0x23c7('0x48')]({'where':{'id':_0x307f89['params']['id']}})[_0x23c7('0x25')](handleEntityNotFound(_0x38b345,null))[_0x23c7('0x25')](removeEntity(_0x38b345,null))[_0x23c7('0x43')](handleError(_0x38b345,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index ead8aff..8341195 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 _0xf94a=['./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x1585eb,_0x3d2a17){var _0x2eec66=function(_0x58fbad){while(--_0x58fbad){_0x1585eb['push'](_0x1585eb['shift']());}};_0x2eec66(++_0x3d2a17);}(_0xf94a,0x123));var _0xaf94=function(_0x1ce882,_0x483860){_0x1ce882=_0x1ce882-0x0;var _0x41f84a=_0xf94a[_0x1ce882];return _0x41f84a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xaf94('0x0'))(_0xaf94('0x1'));var moment=require('moment');var BPromise=require(_0xaf94('0x2'));var rp=require(_0xaf94('0x3'));var fs=require('fs');var path=require(_0xaf94('0x4'));var rimraf=require('rimraf');var config=require(_0xaf94('0x5'));var attributes=require(_0xaf94('0x6'));module[_0xaf94('0x7')]=function(_0x446d7b,_0x346613){return _0x446d7b[_0xaf94('0x8')](_0xaf94('0x9'),attributes,{'tableName':_0xaf94('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x37c2=['../../config/environment','./mailServerOut.attributes','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x20d042,_0x352363){var _0x13c524=function(_0x3d549e){while(--_0x3d549e){_0x20d042['push'](_0x20d042['shift']());}};_0x13c524(++_0x352363);}(_0x37c2,0x1b2));var _0x237c=function(_0x56b1b0,_0x200023){_0x56b1b0=_0x56b1b0-0x0;var _0x154270=_0x37c2[_0x56b1b0];return _0x154270;};'use strict';var _=require(_0x237c('0x0'));var util=require(_0x237c('0x1'));var logger=require(_0x237c('0x2'))(_0x237c('0x3'));var moment=require(_0x237c('0x4'));var BPromise=require(_0x237c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x237c('0x6'));var rimraf=require(_0x237c('0x7'));var config=require(_0x237c('0x8'));var attributes=require(_0x237c('0x9'));module['exports']=function(_0x395379,_0x22eaa0){return _0x395379[_0x237c('0xa')](_0x237c('0xb'),attributes,{'tableName':_0x237c('0xc'),'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 9b4317e..3c8727b 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x4591fa,_0x44a777){var _0xd03e1e=function(_0x11d589){while(--_0x11d589){_0x4591fa['push'](_0x4591fa['shift']());}};_0xd03e1e(++_0x44a777);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xc4aa[_0x3511d3];return _0x5d6321;};'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')]('MailServerOut,\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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0xeb729a,_0x5d09df){var _0x2b71e9=function(_0x3580b4){while(--_0x3580b4){_0xeb729a['push'](_0xeb729a['shift']());}};_0x2b71e9(++_0x5d09df);}(_0xadb5,0xad));var _0x5adb=function(_0xbcb952,_0x803e8b){_0xbcb952=_0xbcb952-0x0;var _0x7a1208=_0xadb5[_0xbcb952];return _0x7a1208;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 6d56625..ea6b991 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 _0xa058=['create','update','delete','exports','multer','util','path','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post'];(function(_0x105698,_0x3771cc){var _0x13d8d4=function(_0x1e7de1){while(--_0x1e7de1){_0x105698['push'](_0x105698['shift']());}};_0x13d8d4(++_0x3771cc);}(_0xa058,0x100));var _0x8a05=function(_0x314a8c,_0x1c2e8d){_0x314a8c=_0x314a8c-0x0;var _0x1d4607=_0xa058[_0x314a8c];return _0x1d4607;};'use strict';var multer=require(_0x8a05('0x0'));var util=require(_0x8a05('0x1'));var path=require(_0x8a05('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x8a05('0x3'));var auth=require(_0x8a05('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8a05('0x5'));var controller=require('./mailSubstatus.controller');router['get']('/',auth[_0x8a05('0x6')](),controller[_0x8a05('0x7')]);router[_0x8a05('0x8')](_0x8a05('0x9'),auth[_0x8a05('0x6')](),controller[_0x8a05('0xa')]);router['get'](_0x8a05('0xb'),auth[_0x8a05('0x6')](),controller[_0x8a05('0xc')]);router[_0x8a05('0xd')]('/',auth[_0x8a05('0x6')](),controller[_0x8a05('0xe')]);router['put'](_0x8a05('0xb'),auth[_0x8a05('0x6')](),controller[_0x8a05('0xf')]);router[_0x8a05('0x10')](_0x8a05('0xb'),auth[_0x8a05('0x6')](),controller['destroy']);module[_0x8a05('0x11')]=router; \ No newline at end of file +var _0x5c03=['post','create','update','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','describe','/:id','isAuthenticated','show'];(function(_0x173f10,_0x35db61){var _0x53142d=function(_0x37bbef){while(--_0x37bbef){_0x173f10['push'](_0x173f10['shift']());}};_0x53142d(++_0x35db61);}(_0x5c03,0x193));var _0x35c0=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x5c03[_0x50aa2e];return _0x5e07f0;};'use strict';var multer=require('multer');var util=require(_0x35c0('0x0'));var path=require(_0x35c0('0x1'));var timeout=require('connect-timeout');var express=require(_0x35c0('0x2'));var router=express[_0x35c0('0x3')]();var fs_extra=require(_0x35c0('0x4'));var auth=require(_0x35c0('0x5'));var interaction=require(_0x35c0('0x6'));var config=require(_0x35c0('0x7'));var controller=require('./mailSubstatus.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x35c0('0x8')]);router[_0x35c0('0x9')](_0x35c0('0xa'),auth['isAuthenticated'](),controller[_0x35c0('0xb')]);router[_0x35c0('0x9')](_0x35c0('0xc'),auth[_0x35c0('0xd')](),controller[_0x35c0('0xe')]);router[_0x35c0('0xf')]('/',auth[_0x35c0('0xd')](),controller[_0x35c0('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x35c0('0x11')]);router['delete'](_0x35c0('0xc'),auth[_0x35c0('0xd')](),controller['destroy']);module[_0x35c0('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index f98d45c..ecb937f 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 _0x6eed=['exports','STRING','name','sequelize'];(function(_0x1ea5e2,_0x382cec){var _0x39380c=function(_0x27893b){while(--_0x27893b){_0x1ea5e2['push'](_0x1ea5e2['shift']());}};_0x39380c(++_0x382cec);}(_0x6eed,0xff));var _0xd6ee=function(_0x3b1457,_0x5b6b0c){_0x3b1457=_0x3b1457-0x0;var _0x333553=_0x6eed[_0x3b1457];return _0x333553;};'use strict';var Sequelize=require(_0xd6ee('0x0'));module[_0xd6ee('0x1')]={'name':{'type':Sequelize[_0xd6ee('0x2')],'unique':_0xd6ee('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd6ee('0x2')]}}; \ No newline at end of file +var _0x6eed=['exports','STRING','name','sequelize'];(function(_0x4d6bfd,_0x8d79ff){var _0x243a46=function(_0x3883b1){while(--_0x3883b1){_0x4d6bfd['push'](_0x4d6bfd['shift']());}};_0x243a46(++_0x8d79ff);}(_0x6eed,0xff));var _0xd6ee=function(_0x40a85a,_0x5393c8){_0x40a85a=_0x40a85a-0x0;var _0x4c1213=_0x6eed[_0x40a85a];return _0x4c1213;};'use strict';var Sequelize=require(_0xd6ee('0x0'));module[_0xd6ee('0x1')]={'name':{'type':Sequelize[_0xd6ee('0x2')],'unique':_0xd6ee('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd6ee('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 21f1c84..bd710c3 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 _0x3795=['length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','includeAll','find','body','params','eml-format','rimraf','fast-json-patch','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','MailSubstatus','rawAttributes','fieldName','type','key','map','query','keys','intersection','attributes','model','fields'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3795,0x13c));var _0x5379=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x3795[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0x5379('0x0'));var rimraf=require(_0x5379('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5379('0x2'));var rp=require('request-promise');var moment=require(_0x5379('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5379('0x4'));var util=require(_0x5379('0x5'));var path=require('path');var sox=require(_0x5379('0x6'));var csv=require(_0x5379('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5379('0x8'));var _=require(_0x5379('0x9'));var squel=require(_0x5379('0xa'));var crypto=require(_0x5379('0xb'));var jsforce=require(_0x5379('0xc'));var deskjs=require(_0x5379('0xd'));var toCsv=require(_0x5379('0x7'));var querystring=require(_0x5379('0xe'));var Papa=require('papaparse');var Redis=require(_0x5379('0xf'));var authService=require(_0x5379('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5379('0x11'));var hardwareService=require(_0x5379('0x12'));var logger=require('../../config/logger')(_0x5379('0x13'));var utils=require('../../config/utils');var config=require(_0x5379('0x14'));var licenseUtil=require(_0x5379('0x15'));var db=require(_0x5379('0x16'))['db'];function respondWithStatusCode(_0x48fb01,_0x3f636d){_0x3f636d=_0x3f636d||0xcc;return function(_0x568656){if(_0x568656){return _0x48fb01[_0x5379('0x17')](_0x3f636d);}return _0x48fb01[_0x5379('0x18')](_0x3f636d)['end']();};}function respondWithResult(_0x23f9a8,_0x63b399){_0x63b399=_0x63b399||0xc8;return function(_0x3435c8){if(_0x3435c8){return _0x23f9a8[_0x5379('0x18')](_0x63b399)[_0x5379('0x19')](_0x3435c8);}};}function respondWithFilteredResult(_0xabdac3,_0x47c9e5){return function(_0x5a8a94){if(_0x5a8a94){var _0x9252d1=typeof _0x47c9e5['offset']===_0x5379('0x1a')&&typeof _0x47c9e5[_0x5379('0x1b')]===_0x5379('0x1a');var _0x4fe8ab=_0x5a8a94[_0x5379('0x1c')];var _0x3e295d=_0x9252d1?0x0:_0x47c9e5[_0x5379('0x1d')];var _0x157f78=_0x9252d1?_0x5a8a94[_0x5379('0x1c')]:_0x47c9e5[_0x5379('0x1d')]+_0x47c9e5[_0x5379('0x1b')];var _0x2d5aeb;if(_0x157f78>=_0x4fe8ab){_0x157f78=_0x4fe8ab;_0x2d5aeb=0xc8;}else{_0x2d5aeb=0xce;}_0xabdac3[_0x5379('0x18')](_0x2d5aeb);return _0xabdac3['set'](_0x5379('0x1e'),_0x3e295d+'-'+_0x157f78+'/'+_0x4fe8ab)[_0x5379('0x19')](_0x5a8a94);}return null;};}function patchUpdates(_0x4f00ff){return function(_0x2b6ecb){try{jsonpatch[_0x5379('0x1f')](_0x2b6ecb,_0x4f00ff,!![]);}catch(_0x5cffe3){return BPromise[_0x5379('0x20')](_0x5cffe3);}return _0x2b6ecb[_0x5379('0x21')]();};}function saveUpdates(_0x2ac32a,_0x1c23b1){return function(_0x4f3c2a){if(_0x4f3c2a){return _0x4f3c2a[_0x5379('0x22')](_0x2ac32a)[_0x5379('0x23')](function(_0x3d2714){return _0x3d2714;});}return null;};}function removeEntity(_0x1c2fe0,_0x329bb1){return function(_0x168ac4){if(_0x168ac4){return _0x168ac4[_0x5379('0x24')]()[_0x5379('0x23')](function(){_0x1c2fe0[_0x5379('0x18')](0xcc)[_0x5379('0x25')]();});}};}function handleEntityNotFound(_0x4aa9fe,_0x41c00d){return function(_0x5eaff4){if(!_0x5eaff4){_0x4aa9fe[_0x5379('0x17')](0x194);}return _0x5eaff4;};}function handleError(_0x1e1823,_0x5ee42a){_0x5ee42a=_0x5ee42a||0x1f4;return function(_0x3336bb){logger['error'](_0x3336bb[_0x5379('0x26')]);if(_0x3336bb['name']){delete _0x3336bb[_0x5379('0x27')];}_0x1e1823[_0x5379('0x18')](_0x5ee42a)[_0x5379('0x28')](_0x3336bb);};}exports[_0x5379('0x29')]=function(_0x3cabaa,_0x5563ec){var _0x29eeb3={},_0x2f5ba7={},_0x3df1b2={'count':0x0,'rows':[]};var _0x569a53=_['map'](db[_0x5379('0x2a')][_0x5379('0x2b')],function(_0x43b5ca){return{'name':_0x43b5ca[_0x5379('0x2c')],'type':_0x43b5ca[_0x5379('0x2d')][_0x5379('0x2e')]};});_0x2f5ba7['model']=_[_0x5379('0x2f')](_0x569a53,_0x5379('0x27'));_0x2f5ba7[_0x5379('0x30')]=_[_0x5379('0x31')](_0x3cabaa[_0x5379('0x30')]);_0x2f5ba7['filters']=_[_0x5379('0x32')](_0x2f5ba7['model'],_0x2f5ba7[_0x5379('0x30')]);_0x29eeb3[_0x5379('0x33')]=_['intersection'](_0x2f5ba7[_0x5379('0x34')],qs[_0x5379('0x35')](_0x3cabaa[_0x5379('0x30')][_0x5379('0x35')]));_0x29eeb3[_0x5379('0x33')]=_0x29eeb3[_0x5379('0x33')][_0x5379('0x36')]?_0x29eeb3['attributes']:_0x2f5ba7[_0x5379('0x34')];if(!_0x3cabaa[_0x5379('0x30')][_0x5379('0x37')](_0x5379('0x38'))){_0x29eeb3[_0x5379('0x1b')]=qs[_0x5379('0x1b')](_0x3cabaa['query'][_0x5379('0x1b')]);_0x29eeb3[_0x5379('0x1d')]=qs[_0x5379('0x1d')](_0x3cabaa[_0x5379('0x30')][_0x5379('0x1d')]);}_0x29eeb3[_0x5379('0x39')]=qs['sort'](_0x3cabaa[_0x5379('0x30')][_0x5379('0x3a')]);_0x29eeb3[_0x5379('0x3b')]=qs['filters'](_[_0x5379('0x3c')](_0x3cabaa[_0x5379('0x30')],_0x2f5ba7[_0x5379('0x3d')]),_0x569a53);if(_0x3cabaa[_0x5379('0x30')][_0x5379('0x3e')]){_0x29eeb3[_0x5379('0x3b')]=_[_0x5379('0x3f')](_0x29eeb3[_0x5379('0x3b')],{'$or':_[_0x5379('0x2f')](_0x569a53,function(_0x3e5640){if(_0x3e5640[_0x5379('0x2d')]!==_0x5379('0x40')){var _0x22de2a={};_0x22de2a[_0x3e5640[_0x5379('0x27')]]={'$like':'%'+_0x3cabaa[_0x5379('0x30')]['filter']+'%'};return _0x22de2a;}})});}_0x29eeb3=_['merge']({},_0x29eeb3,_0x3cabaa[_0x5379('0x41')]);var _0x19646e={'where':_0x29eeb3[_0x5379('0x3b')]};return db['MailSubstatus'][_0x5379('0x1c')](_0x19646e)[_0x5379('0x23')](function(_0x2ac644){_0x3df1b2['count']=_0x2ac644;if(_0x3cabaa[_0x5379('0x30')]['includeAll']){_0x29eeb3[_0x5379('0x42')]=[{'all':!![]}];}return db[_0x5379('0x2a')][_0x5379('0x43')](_0x29eeb3);})[_0x5379('0x23')](function(_0x371904){_0x3df1b2[_0x5379('0x44')]=_0x371904;return _0x3df1b2;})['then'](respondWithFilteredResult(_0x5563ec,_0x29eeb3))[_0x5379('0x45')](handleError(_0x5563ec,null));};exports['show']=function(_0x3c4703,_0x40a3c3){var _0x178e77={'raw':!![],'where':{'id':_0x3c4703['params']['id']}},_0xd6b19={};_0xd6b19[_0x5379('0x34')]=_['keys'](db[_0x5379('0x2a')]['rawAttributes']);_0xd6b19[_0x5379('0x30')]=_[_0x5379('0x31')](_0x3c4703[_0x5379('0x30')]);_0xd6b19['filters']=_[_0x5379('0x32')](_0xd6b19[_0x5379('0x34')],_0xd6b19[_0x5379('0x30')]);_0x178e77[_0x5379('0x33')]=_[_0x5379('0x32')](_0xd6b19[_0x5379('0x34')],qs[_0x5379('0x35')](_0x3c4703[_0x5379('0x30')][_0x5379('0x35')]));_0x178e77['attributes']=_0x178e77[_0x5379('0x33')][_0x5379('0x36')]?_0x178e77[_0x5379('0x33')]:_0xd6b19[_0x5379('0x34')];if(_0x3c4703['query'][_0x5379('0x46')]){_0x178e77[_0x5379('0x42')]=[{'all':!![]}];}_0x178e77=_['merge']({},_0x178e77,_0x3c4703[_0x5379('0x41')]);return db['MailSubstatus'][_0x5379('0x47')](_0x178e77)[_0x5379('0x23')](handleEntityNotFound(_0x40a3c3,null))['then'](respondWithResult(_0x40a3c3,null))[_0x5379('0x45')](handleError(_0x40a3c3,null));};exports['create']=function(_0x144d54,_0x5e6d82){return db[_0x5379('0x2a')]['create'](_0x144d54[_0x5379('0x48')],{})[_0x5379('0x23')](respondWithResult(_0x5e6d82,0xc9))['catch'](handleError(_0x5e6d82,null));};exports[_0x5379('0x22')]=function(_0x139c08,_0x1a0733){if(_0x139c08[_0x5379('0x48')]['id']){delete _0x139c08[_0x5379('0x48')]['id'];}return db[_0x5379('0x2a')][_0x5379('0x47')]({'where':{'id':_0x139c08['params']['id']}})[_0x5379('0x23')](handleEntityNotFound(_0x1a0733,null))[_0x5379('0x23')](saveUpdates(_0x139c08['body'],null))[_0x5379('0x23')](respondWithResult(_0x1a0733,null))['catch'](handleError(_0x1a0733,null));};exports[_0x5379('0x24')]=function(_0x13e43a,_0x3b83c3){return db[_0x5379('0x2a')][_0x5379('0x47')]({'where':{'id':_0x13e43a[_0x5379('0x49')]['id']}})[_0x5379('0x23')](handleEntityNotFound(_0x3b83c3,null))[_0x5379('0x23')](removeEntity(_0x3b83c3,null))['catch'](handleError(_0x3b83c3,null));};exports['describe']=function(_0x4a33d1,_0x144ada){return db['MailSubstatus']['describe']()[_0x5379('0x23')](respondWithResult(_0x144ada,null))[_0x5379('0x45')](handleError(_0x144ada,null));}; \ No newline at end of file +var _0xd0bb=['rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','fieldName','type','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','options','MailSubstatus','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','destroy','describe'];(function(_0x199f5c,_0x3927e5){var _0x4be26f=function(_0x45528b){while(--_0x45528b){_0x199f5c['push'](_0x199f5c['shift']());}};_0x4be26f(++_0x3927e5);}(_0xd0bb,0x9c));var _0xbd0b=function(_0x270f18,_0x8155e9){_0x270f18=_0x270f18-0x0;var _0x39d745=_0xd0bb[_0x270f18];return _0x39d745;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbd0b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbd0b('0x1'));var rp=require(_0xbd0b('0x2'));var moment=require(_0xbd0b('0x3'));var BPromise=require(_0xbd0b('0x4'));var Mustache=require(_0xbd0b('0x5'));var util=require(_0xbd0b('0x6'));var path=require(_0xbd0b('0x7'));var sox=require(_0xbd0b('0x8'));var csv=require('to-csv');var ejs=require(_0xbd0b('0x9'));var fs=require('fs');var fs_extra=require(_0xbd0b('0xa'));var _=require(_0xbd0b('0xb'));var squel=require(_0xbd0b('0xc'));var crypto=require(_0xbd0b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbd0b('0xe'));var toCsv=require(_0xbd0b('0xf'));var querystring=require(_0xbd0b('0x10'));var Papa=require('papaparse');var Redis=require(_0xbd0b('0x11'));var authService=require(_0xbd0b('0x12'));var qs=require(_0xbd0b('0x13'));var as=require(_0xbd0b('0x14'));var hardwareService=require(_0xbd0b('0x15'));var logger=require(_0xbd0b('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xbd0b('0x17'));var licenseUtil=require(_0xbd0b('0x18'));var db=require(_0xbd0b('0x19'))['db'];function respondWithStatusCode(_0x5f4403,_0x1ac69a){_0x1ac69a=_0x1ac69a||0xcc;return function(_0x5bfb90){if(_0x5bfb90){return _0x5f4403[_0xbd0b('0x1a')](_0x1ac69a);}return _0x5f4403[_0xbd0b('0x1b')](_0x1ac69a)[_0xbd0b('0x1c')]();};}function respondWithResult(_0x1a32fc,_0x4f3745){_0x4f3745=_0x4f3745||0xc8;return function(_0xf2b56){if(_0xf2b56){return _0x1a32fc[_0xbd0b('0x1b')](_0x4f3745)[_0xbd0b('0x1d')](_0xf2b56);}};}function respondWithFilteredResult(_0x9c45b5,_0xba9648){return function(_0x493ea9){if(_0x493ea9){var _0x40dbac=typeof _0xba9648[_0xbd0b('0x1e')]==='undefined'&&typeof _0xba9648[_0xbd0b('0x1f')]===_0xbd0b('0x20');var _0xff7ca2=_0x493ea9[_0xbd0b('0x21')];var _0x52ca75=_0x40dbac?0x0:_0xba9648['offset'];var _0x51893d=_0x40dbac?_0x493ea9[_0xbd0b('0x21')]:_0xba9648[_0xbd0b('0x1e')]+_0xba9648[_0xbd0b('0x1f')];var _0x316a07;if(_0x51893d>=_0xff7ca2){_0x51893d=_0xff7ca2;_0x316a07=0xc8;}else{_0x316a07=0xce;}_0x9c45b5[_0xbd0b('0x1b')](_0x316a07);return _0x9c45b5[_0xbd0b('0x22')](_0xbd0b('0x23'),_0x52ca75+'-'+_0x51893d+'/'+_0xff7ca2)[_0xbd0b('0x1d')](_0x493ea9);}return null;};}function patchUpdates(_0x483f9e){return function(_0x5f449f){try{jsonpatch[_0xbd0b('0x24')](_0x5f449f,_0x483f9e,!![]);}catch(_0x2acc75){return BPromise[_0xbd0b('0x25')](_0x2acc75);}return _0x5f449f['save']();};}function saveUpdates(_0x408b24,_0x1599de){return function(_0x2be4ad){if(_0x2be4ad){return _0x2be4ad[_0xbd0b('0x26')](_0x408b24)[_0xbd0b('0x27')](function(_0x46495b){return _0x46495b;});}return null;};}function removeEntity(_0x518bc4,_0x46af0c){return function(_0x5d4c56){if(_0x5d4c56){return _0x5d4c56['destroy']()[_0xbd0b('0x27')](function(){_0x518bc4[_0xbd0b('0x1b')](0xcc)[_0xbd0b('0x1c')]();});}};}function handleEntityNotFound(_0x490a33,_0x336c25){return function(_0x531831){if(!_0x531831){_0x490a33[_0xbd0b('0x1a')](0x194);}return _0x531831;};}function handleError(_0x2e9725,_0x328483){_0x328483=_0x328483||0x1f4;return function(_0x43226e){logger[_0xbd0b('0x28')](_0x43226e[_0xbd0b('0x29')]);if(_0x43226e['name']){delete _0x43226e[_0xbd0b('0x2a')];}_0x2e9725[_0xbd0b('0x1b')](_0x328483)[_0xbd0b('0x2b')](_0x43226e);};}exports[_0xbd0b('0x2c')]=function(_0x2c2c0c,_0x3fc038){var _0x1c7649={},_0x5a6ede={},_0x1fdba5={'count':0x0,'rows':[]};var _0x5c0d6a=_[_0xbd0b('0x2d')](db['MailSubstatus']['rawAttributes'],function(_0x162d4d){return{'name':_0x162d4d[_0xbd0b('0x2e')],'type':_0x162d4d[_0xbd0b('0x2f')]['key']};});_0x5a6ede[_0xbd0b('0x30')]=_['map'](_0x5c0d6a,_0xbd0b('0x2a'));_0x5a6ede[_0xbd0b('0x31')]=_[_0xbd0b('0x32')](_0x2c2c0c[_0xbd0b('0x31')]);_0x5a6ede['filters']=_[_0xbd0b('0x33')](_0x5a6ede[_0xbd0b('0x30')],_0x5a6ede['query']);_0x1c7649['attributes']=_['intersection'](_0x5a6ede['model'],qs['fields'](_0x2c2c0c[_0xbd0b('0x31')][_0xbd0b('0x34')]));_0x1c7649['attributes']=_0x1c7649[_0xbd0b('0x35')]['length']?_0x1c7649[_0xbd0b('0x35')]:_0x5a6ede[_0xbd0b('0x30')];if(!_0x2c2c0c[_0xbd0b('0x31')][_0xbd0b('0x36')](_0xbd0b('0x37'))){_0x1c7649[_0xbd0b('0x1f')]=qs[_0xbd0b('0x1f')](_0x2c2c0c[_0xbd0b('0x31')][_0xbd0b('0x1f')]);_0x1c7649[_0xbd0b('0x1e')]=qs[_0xbd0b('0x1e')](_0x2c2c0c['query']['offset']);}_0x1c7649[_0xbd0b('0x38')]=qs['sort'](_0x2c2c0c[_0xbd0b('0x31')]['sort']);_0x1c7649[_0xbd0b('0x39')]=qs[_0xbd0b('0x3a')](_[_0xbd0b('0x3b')](_0x2c2c0c['query'],_0x5a6ede[_0xbd0b('0x3a')]),_0x5c0d6a);if(_0x2c2c0c[_0xbd0b('0x31')][_0xbd0b('0x3c')]){_0x1c7649['where']=_[_0xbd0b('0x3d')](_0x1c7649[_0xbd0b('0x39')],{'$or':_[_0xbd0b('0x2d')](_0x5c0d6a,function(_0x3d5a5c){if(_0x3d5a5c[_0xbd0b('0x2f')]!=='VIRTUAL'){var _0x5052e7={};_0x5052e7[_0x3d5a5c[_0xbd0b('0x2a')]]={'$like':'%'+_0x2c2c0c[_0xbd0b('0x31')][_0xbd0b('0x3c')]+'%'};return _0x5052e7;}})});}_0x1c7649=_[_0xbd0b('0x3d')]({},_0x1c7649,_0x2c2c0c[_0xbd0b('0x3e')]);var _0x181f92={'where':_0x1c7649['where']};return db[_0xbd0b('0x3f')][_0xbd0b('0x21')](_0x181f92)['then'](function(_0x472c4a){_0x1fdba5['count']=_0x472c4a;if(_0x2c2c0c[_0xbd0b('0x31')][_0xbd0b('0x40')]){_0x1c7649[_0xbd0b('0x41')]=[{'all':!![]}];}return db[_0xbd0b('0x3f')][_0xbd0b('0x42')](_0x1c7649);})[_0xbd0b('0x27')](function(_0x20b57c){_0x1fdba5[_0xbd0b('0x43')]=_0x20b57c;return _0x1fdba5;})[_0xbd0b('0x27')](respondWithFilteredResult(_0x3fc038,_0x1c7649))[_0xbd0b('0x44')](handleError(_0x3fc038,null));};exports[_0xbd0b('0x45')]=function(_0x178a80,_0x5252cb){var _0x18fd48={'raw':!![],'where':{'id':_0x178a80[_0xbd0b('0x46')]['id']}},_0x172973={};_0x172973[_0xbd0b('0x30')]=_[_0xbd0b('0x32')](db[_0xbd0b('0x3f')][_0xbd0b('0x47')]);_0x172973[_0xbd0b('0x31')]=_[_0xbd0b('0x32')](_0x178a80[_0xbd0b('0x31')]);_0x172973[_0xbd0b('0x3a')]=_['intersection'](_0x172973[_0xbd0b('0x30')],_0x172973[_0xbd0b('0x31')]);_0x18fd48['attributes']=_['intersection'](_0x172973[_0xbd0b('0x30')],qs[_0xbd0b('0x34')](_0x178a80['query'][_0xbd0b('0x34')]));_0x18fd48[_0xbd0b('0x35')]=_0x18fd48[_0xbd0b('0x35')][_0xbd0b('0x48')]?_0x18fd48[_0xbd0b('0x35')]:_0x172973[_0xbd0b('0x30')];if(_0x178a80['query'][_0xbd0b('0x40')]){_0x18fd48[_0xbd0b('0x41')]=[{'all':!![]}];}_0x18fd48=_[_0xbd0b('0x3d')]({},_0x18fd48,_0x178a80['options']);return db[_0xbd0b('0x3f')][_0xbd0b('0x49')](_0x18fd48)[_0xbd0b('0x27')](handleEntityNotFound(_0x5252cb,null))['then'](respondWithResult(_0x5252cb,null))[_0xbd0b('0x44')](handleError(_0x5252cb,null));};exports[_0xbd0b('0x4a')]=function(_0x1c0ef9,_0x111742){return db[_0xbd0b('0x3f')][_0xbd0b('0x4a')](_0x1c0ef9[_0xbd0b('0x4b')],{})['then'](respondWithResult(_0x111742,0xc9))[_0xbd0b('0x44')](handleError(_0x111742,null));};exports[_0xbd0b('0x26')]=function(_0xa869ac,_0x173b8c){if(_0xa869ac[_0xbd0b('0x4b')]['id']){delete _0xa869ac[_0xbd0b('0x4b')]['id'];}return db[_0xbd0b('0x3f')][_0xbd0b('0x49')]({'where':{'id':_0xa869ac[_0xbd0b('0x46')]['id']}})['then'](handleEntityNotFound(_0x173b8c,null))[_0xbd0b('0x27')](saveUpdates(_0xa869ac[_0xbd0b('0x4b')],null))[_0xbd0b('0x27')](respondWithResult(_0x173b8c,null))[_0xbd0b('0x44')](handleError(_0x173b8c,null));};exports[_0xbd0b('0x4c')]=function(_0x22b22e,_0x506e8e){return db[_0xbd0b('0x3f')]['find']({'where':{'id':_0x22b22e[_0xbd0b('0x46')]['id']}})['then'](handleEntityNotFound(_0x506e8e,null))[_0xbd0b('0x27')](removeEntity(_0x506e8e,null))[_0xbd0b('0x44')](handleError(_0x506e8e,null));};exports[_0xbd0b('0x4d')]=function(_0x13d51e,_0x2ce614){return db[_0xbd0b('0x3f')][_0xbd0b('0x4d')]()['then'](respondWithResult(_0x2ce614,null))['catch'](handleError(_0x2ce614,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index dbfce37..ddd8b55 100644 --- a/server/api/mailSubstatus/mailSubstatus.events.js +++ b/server/api/mailSubstatus/mailSubstatus.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf29b=['hasOwnProperty','exports','../../mysqldb','MailSubstatus','setMaxListeners','update','emit'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xf29b,0x191));var _0xbf29=function(_0x434635,_0x32fee1){_0x434635=_0x434635-0x0;var _0x2f8f95=_0xf29b[_0x434635];return _0x2f8f95;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0xbf29('0x0'))['db'][_0xbf29('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xbf29('0x2')](0x0);var events={'afterUpdate':_0xbf29('0x3')};function emitEvent(_0x5ef3b3){return function(_0x534d90,_0x8ad26b,_0x1712a2){MailSubstatusEvents[_0xbf29('0x4')](_0x5ef3b3+':'+_0x534d90['id'],_0x534d90);MailSubstatusEvents[_0xbf29('0x4')](_0x5ef3b3,_0x534d90);_0x1712a2(null);};}for(var e in events){if(events[_0xbf29('0x5')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0xbf29('0x6')]=MailSubstatusEvents; \ No newline at end of file +var _0x7bdd=['MailSubstatus','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x44929b,_0x18d114){var _0x34a361=function(_0xa3fbe2){while(--_0xa3fbe2){_0x44929b['push'](_0x44929b['shift']());}};_0x34a361(++_0x18d114);}(_0x7bdd,0x172));var _0xd7bd=function(_0x55f11b,_0x1e5088){_0x55f11b=_0x55f11b-0x0;var _0x5f2209=_0x7bdd[_0x55f11b];return _0x5f2209;};'use strict';var EventEmitter=require(_0xd7bd('0x0'));var MailSubstatus=require(_0xd7bd('0x1'))['db'][_0xd7bd('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x34f6e2){return function(_0x3f705b,_0x5337d7,_0x597e09){MailSubstatusEvents[_0xd7bd('0x3')](_0x34f6e2+':'+_0x3f705b['id'],_0x3f705b);MailSubstatusEvents['emit'](_0x34f6e2,_0x3f705b);_0x597e09(null);};}for(var e in events){if(events[_0xd7bd('0x4')](e)){var event=events[e];MailSubstatus[_0xd7bd('0x5')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index aa938e3..b53c92b 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 _0xfb6f=['then','catch','./mailSubstatus.attributes','models','define','update','_previousDataValues','name'];(function(_0x4957f2,_0x3e681e){var _0x547cfe=function(_0x431e3a){while(--_0x431e3a){_0x4957f2['push'](_0x4957f2['shift']());}};_0x547cfe(++_0x3e681e);}(_0xfb6f,0x122));var _0xffb6=function(_0x14fe25,_0x49c90b){_0x14fe25=_0x14fe25-0x0;var _0x1e1709=_0xfb6f[_0x14fe25];return _0x1e1709;};'use strict';var attributes=require(_0xffb6('0x0'));module['exports']=function(_0x50439e){var _0x1de039=_0x50439e[_0xffb6('0x1')];return _0x50439e[_0xffb6('0x2')]('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x3bee71,_0xa1d654,_0x221045){return _0x1de039['Condition'][_0xffb6('0x3')]({'value':_0x3bee71['name']},{'where':{'field':'mailSubstatus','value':_0x3bee71[_0xffb6('0x4')][_0xffb6('0x5')]}})[_0xffb6('0x6')](function(){_0x221045();})[_0xffb6('0x7')](function(_0x50f33d){_0x221045(_0x50f33d);});}}});}; \ No newline at end of file +var _0x8e5e=['MailSubstatus','mail_substatuses','Condition','name','mailSubstatus','then','catch','./mailSubstatus.attributes','exports','models','define'];(function(_0x3c47e9,_0x374112){var _0xc82a99=function(_0x40d7f2){while(--_0x40d7f2){_0x3c47e9['push'](_0x3c47e9['shift']());}};_0xc82a99(++_0x374112);}(_0x8e5e,0x193));var _0xe8e5=function(_0x384e1e,_0xe637b9){_0x384e1e=_0x384e1e-0x0;var _0x14d92c=_0x8e5e[_0x384e1e];return _0x14d92c;};'use strict';var attributes=require(_0xe8e5('0x0'));module[_0xe8e5('0x1')]=function(_0x1398d2){var _0x2ddd77=_0x1398d2[_0xe8e5('0x2')];return _0x1398d2[_0xe8e5('0x3')](_0xe8e5('0x4'),attributes,{'tableName':_0xe8e5('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x3b50f8,_0x49c9ba,_0x21a750){return _0x2ddd77[_0xe8e5('0x6')]['update']({'value':_0x3b50f8[_0xe8e5('0x7')]},{'where':{'field':_0xe8e5('0x8'),'value':_0x3b50f8['_previousDataValues'][_0xe8e5('0x7')]}})[_0xe8e5('0x9')](function(){_0x21a750();})[_0xe8e5('0xa')](function(_0x2da74a){_0x21a750(_0x2da74a);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 0837aa5..219d8d9 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 _0x2008=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x31e5cb,_0x2f5adf){var _0x4170df=function(_0x31c53e){while(--_0x31c53e){_0x31e5cb['push'](_0x31e5cb['shift']());}};_0x4170df(++_0x2f5adf);}(_0x2008,0x76));var _0x8200=function(_0xca1f0e,_0x2713d5){_0xca1f0e=_0xca1f0e-0x0;var _0x35e4ef=_0x2008[_0xca1f0e];return _0x35e4ef;};'use strict';var _=require(_0x8200('0x0'));var util=require(_0x8200('0x1'));var moment=require('moment');var BPromise=require(_0x8200('0x2'));var rs=require(_0x8200('0x3'));var fs=require('fs');var Redis=require(_0x8200('0x4'));var db=require(_0x8200('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8200('0x6'));var config=require(_0x8200('0x7'));var jayson=require(_0x8200('0x8'));var client=jayson[_0x8200('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfde649,_0xb7dc2d,_0x48a1a5){return new BPromise(function(_0x37bbf8,_0x1391fa){return client[_0x8200('0xa')](_0xfde649,_0x48a1a5)[_0x8200('0xb')](function(_0x588075){logger[_0x8200('0xc')](_0x8200('0xd'),_0xb7dc2d,_0x8200('0xe'));logger[_0x8200('0xf')](_0x8200('0x10'),_0xb7dc2d,'request\x20sent',JSON[_0x8200('0x11')](_0x588075));if(_0x588075[_0x8200('0x12')]){if(_0x588075[_0x8200('0x12')][_0x8200('0x13')]===0x1f4){logger[_0x8200('0x12')](_0x8200('0xd'),_0xb7dc2d,_0x588075['error'][_0x8200('0x14')]);return _0x1391fa(_0x588075[_0x8200('0x12')][_0x8200('0x14')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0xb7dc2d,_0x588075[_0x8200('0x12')][_0x8200('0x14')]);return _0x37bbf8(_0x588075[_0x8200('0x12')]['message']);}else{logger['info']('MailSubstatus,\x20%s,\x20%s',_0xb7dc2d,_0x8200('0xe'));_0x37bbf8(_0x588075[_0x8200('0x15')][_0x8200('0x14')]);}})[_0x8200('0x16')](function(_0x490a17){logger[_0x8200('0x12')](_0x8200('0xd'),_0xb7dc2d,_0x490a17);_0x1391fa(_0x490a17);});});} \ No newline at end of file +var _0xeb9d=['error','message','info','result','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5bd265,_0x142494){var _0x3432ef=function(_0x16ae5b){while(--_0x16ae5b){_0x5bd265['push'](_0x5bd265['shift']());}};_0x3432ef(++_0x142494);}(_0xeb9d,0x1a2));var _0xdeb9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xeb9d[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xdeb9('0x0'));var util=require('util');var moment=require(_0xdeb9('0x1'));var BPromise=require('bluebird');var rs=require(_0xdeb9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdeb9('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xdeb9('0x4'))(_0xdeb9('0x5'));var config=require('../../config/environment');var jayson=require(_0xdeb9('0x6'));var client=jayson[_0xdeb9('0x7')][_0xdeb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x40f799,_0x4807d5,_0x28a1dc){return new BPromise(function(_0x499e51,_0x130b7d){return client[_0xdeb9('0x9')](_0x40f799,_0x28a1dc)['then'](function(_0x416080){logger['info'](_0xdeb9('0xa'),_0x4807d5,_0xdeb9('0xb'));logger['debug'](_0xdeb9('0xc'),_0x4807d5,_0xdeb9('0xb'),JSON[_0xdeb9('0xd')](_0x416080));if(_0x416080[_0xdeb9('0xe')]){if(_0x416080[_0xdeb9('0xe')]['code']===0x1f4){logger[_0xdeb9('0xe')](_0xdeb9('0xa'),_0x4807d5,_0x416080[_0xdeb9('0xe')][_0xdeb9('0xf')]);return _0x130b7d(_0x416080[_0xdeb9('0xe')][_0xdeb9('0xf')]);}logger['error'](_0xdeb9('0xa'),_0x4807d5,_0x416080[_0xdeb9('0xe')][_0xdeb9('0xf')]);return _0x499e51(_0x416080[_0xdeb9('0xe')][_0xdeb9('0xf')]);}else{logger[_0xdeb9('0x10')](_0xdeb9('0xa'),_0x4807d5,_0xdeb9('0xb'));_0x499e51(_0x416080[_0xdeb9('0x11')][_0xdeb9('0xf')]);}})['catch'](function(_0x193712){logger[_0xdeb9('0xe')](_0xdeb9('0xa'),_0x4807d5,_0x193712);_0x130b7d(_0x193712);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 8d0d277..169844d 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 _0x8a0f=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x5f397d,_0x40c53b){var _0x34b0f0=function(_0x24b90b){while(--_0x24b90b){_0x5f397d['push'](_0x5f397d['shift']());}};_0x34b0f0(++_0x40c53b);}(_0x8a0f,0x117));var _0xf8a0=function(_0x2bffe1,_0x1ed421){_0x2bffe1=_0x2bffe1-0x0;var _0x569c2b=_0x8a0f[_0x2bffe1];return _0x569c2b;};'use strict';var multer=require(_0xf8a0('0x0'));var util=require(_0xf8a0('0x1'));var path=require(_0xf8a0('0x2'));var timeout=require(_0xf8a0('0x3'));var express=require(_0xf8a0('0x4'));var router=express[_0xf8a0('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf8a0('0x6'));var interaction=require(_0xf8a0('0x7'));var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router[_0xf8a0('0x8')]('/',auth[_0xf8a0('0x9')](),controller[_0xf8a0('0xa')]);router[_0xf8a0('0x8')](_0xf8a0('0xb'),auth[_0xf8a0('0x9')](),controller[_0xf8a0('0xc')]);router[_0xf8a0('0x8')]('/:id',auth[_0xf8a0('0x9')](),controller['show']);router['post']('/',auth[_0xf8a0('0x9')](),controller[_0xf8a0('0xd')]);router[_0xf8a0('0xe')]('/:id',auth[_0xf8a0('0x9')](),controller[_0xf8a0('0xf')]);router[_0xf8a0('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xf8a0('0x11')]);module[_0xf8a0('0x12')]=router; \ No newline at end of file +var _0x066a=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','put','update','delete','destroy','multer','path'];(function(_0x2dbcbb,_0x560e27){var _0x460204=function(_0x13b280){while(--_0x13b280){_0x2dbcbb['push'](_0x2dbcbb['shift']());}};_0x460204(++_0x560e27);}(_0x066a,0x1ec));var _0xa066=function(_0x2350ce,_0x3320bf){_0x2350ce=_0x2350ce-0x0;var _0x37a8ed=_0x066a[_0x2350ce];return _0x37a8ed;};'use strict';var multer=require(_0xa066('0x0'));var util=require('util');var path=require(_0xa066('0x1'));var timeout=require(_0xa066('0x2'));var express=require(_0xa066('0x3'));var router=express[_0xa066('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa066('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa066('0x6'));var controller=require(_0xa066('0x7'));router[_0xa066('0x8')]('/',auth[_0xa066('0x9')](),controller[_0xa066('0xa')]);router[_0xa066('0x8')](_0xa066('0xb'),auth['isAuthenticated'](),controller[_0xa066('0xc')]);router[_0xa066('0x8')](_0xa066('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xa066('0xe')]('/',auth[_0xa066('0x9')](),controller['create']);router[_0xa066('0xf')]('/:id',auth[_0xa066('0x9')](),controller[_0xa066('0x10')]);router[_0xa066('0x11')](_0xa066('0xd'),auth['isAuthenticated'](),controller[_0xa066('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index a1aeb9f..82f82e3 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x10d52f,_0x120b70){var _0x88c386=function(_0xcfb9e9){while(--_0xcfb9e9){_0x10d52f['push'](_0x10d52f['shift']());}};_0x88c386(++_0x120b70);}(_0xedd9,0xfc));var _0x9edd=function(_0x1d9d28,_0x312eac){_0x1d9d28=_0x1d9d28-0x0;var _0x3332d9=_0xedd9[_0x1d9d28];return _0x3332d9;};'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 +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x422be2,_0x1c439e){var _0x1b820e=function(_0x513cc8){while(--_0x513cc8){_0x422be2['push'](_0x422be2['shift']());}};_0x1b820e(++_0x1c439e);}(_0x9bde,0xe1));var _0xe9bd=function(_0x3729b1,_0x511c83){_0x3729b1=_0x3729b1-0x0;var _0x373fa3=_0x9bde[_0x3729b1];return _0x373fa3;};'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/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 331a5f3..be870a7 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 _0xcbc6=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','set','apply','save','destroy','then','sendStatus','error','stack','name','send','index','map','MailTransferReport','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','update','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto'];(function(_0x191f8b,_0x152b69){var _0x33a849=function(_0x3d2e17){while(--_0x3d2e17){_0x191f8b['push'](_0x191f8b['shift']());}};_0x33a849(++_0x152b69);}(_0xcbc6,0x121));var _0x6cbc=function(_0x374d6e,_0x159e2b){_0x374d6e=_0x374d6e-0x0;var _0xb7bcf2=_0xcbc6[_0x374d6e];return _0xb7bcf2;};'use strict';var emlformat=require(_0x6cbc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6cbc('0x1'));var jsonpatch=require(_0x6cbc('0x2'));var rp=require(_0x6cbc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6cbc('0x4'));var util=require('util');var path=require('path');var sox=require(_0x6cbc('0x5'));var csv=require(_0x6cbc('0x6'));var ejs=require(_0x6cbc('0x7'));var fs=require('fs');var fs_extra=require(_0x6cbc('0x8'));var _=require(_0x6cbc('0x9'));var squel=require('squel');var crypto=require(_0x6cbc('0xa'));var jsforce=require(_0x6cbc('0xb'));var deskjs=require(_0x6cbc('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6cbc('0xd'));var Papa=require(_0x6cbc('0xe'));var Redis=require(_0x6cbc('0xf'));var authService=require(_0x6cbc('0x10'));var qs=require(_0x6cbc('0x11'));var as=require(_0x6cbc('0x12'));var hardwareService=require(_0x6cbc('0x13'));var logger=require('../../config/logger')(_0x6cbc('0x14'));var utils=require('../../config/utils');var config=require(_0x6cbc('0x15'));var licenseUtil=require(_0x6cbc('0x16'));var db=require(_0x6cbc('0x17'))['db'];function respondWithStatusCode(_0x2b6f14,_0x28a74e){_0x28a74e=_0x28a74e||0xcc;return function(_0x4c08e0){if(_0x4c08e0){return _0x2b6f14['sendStatus'](_0x28a74e);}return _0x2b6f14[_0x6cbc('0x18')](_0x28a74e)[_0x6cbc('0x19')]();};}function respondWithResult(_0x54ae43,_0xc947b3){_0xc947b3=_0xc947b3||0xc8;return function(_0x3aa12c){if(_0x3aa12c){return _0x54ae43['status'](_0xc947b3)[_0x6cbc('0x1a')](_0x3aa12c);}};}function respondWithFilteredResult(_0x413f10,_0xfdd6e6){return function(_0x533edc){if(_0x533edc){var _0xfa2b45=typeof _0xfdd6e6['offset']==='undefined'&&typeof _0xfdd6e6[_0x6cbc('0x1b')]===_0x6cbc('0x1c');var _0x76b218=_0x533edc[_0x6cbc('0x1d')];var _0xd2e74c=_0xfa2b45?0x0:_0xfdd6e6[_0x6cbc('0x1e')];var _0x5ea813=_0xfa2b45?_0x533edc[_0x6cbc('0x1d')]:_0xfdd6e6['offset']+_0xfdd6e6[_0x6cbc('0x1b')];var _0x2a9307;if(_0x5ea813>=_0x76b218){_0x5ea813=_0x76b218;_0x2a9307=0xc8;}else{_0x2a9307=0xce;}_0x413f10['status'](_0x2a9307);return _0x413f10[_0x6cbc('0x1f')]('Content-Range',_0xd2e74c+'-'+_0x5ea813+'/'+_0x76b218)['json'](_0x533edc);}return null;};}function patchUpdates(_0x1e39e7){return function(_0x49dc38){try{jsonpatch[_0x6cbc('0x20')](_0x49dc38,_0x1e39e7,!![]);}catch(_0x47ed3a){return BPromise['reject'](_0x47ed3a);}return _0x49dc38[_0x6cbc('0x21')]();};}function saveUpdates(_0x5b8689,_0x307bcd){return function(_0x226e56){if(_0x226e56){return _0x226e56['update'](_0x5b8689)['then'](function(_0x7dee51){return _0x7dee51;});}return null;};}function removeEntity(_0x46477b,_0x4270cf){return function(_0x3d8274){if(_0x3d8274){return _0x3d8274[_0x6cbc('0x22')]()[_0x6cbc('0x23')](function(){_0x46477b[_0x6cbc('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12d705,_0x1f15b8){return function(_0x4b84f3){if(!_0x4b84f3){_0x12d705[_0x6cbc('0x24')](0x194);}return _0x4b84f3;};}function handleError(_0x163655,_0x4f78ef){_0x4f78ef=_0x4f78ef||0x1f4;return function(_0x3b4636){logger[_0x6cbc('0x25')](_0x3b4636[_0x6cbc('0x26')]);if(_0x3b4636[_0x6cbc('0x27')]){delete _0x3b4636[_0x6cbc('0x27')];}_0x163655['status'](_0x4f78ef)[_0x6cbc('0x28')](_0x3b4636);};}exports[_0x6cbc('0x29')]=function(_0x213abf,_0x3066b7){var _0x3b0c14={},_0x182df3={},_0x26304d={'count':0x0,'rows':[]};var _0x4fb50d=_[_0x6cbc('0x2a')](db[_0x6cbc('0x2b')]['rawAttributes'],function(_0x57b001){return{'name':_0x57b001['fieldName'],'type':_0x57b001[_0x6cbc('0x2c')][_0x6cbc('0x2d')]};});_0x182df3[_0x6cbc('0x2e')]=_[_0x6cbc('0x2a')](_0x4fb50d,_0x6cbc('0x27'));_0x182df3[_0x6cbc('0x2f')]=_[_0x6cbc('0x30')](_0x213abf['query']);_0x182df3['filters']=_[_0x6cbc('0x31')](_0x182df3[_0x6cbc('0x2e')],_0x182df3[_0x6cbc('0x2f')]);_0x3b0c14[_0x6cbc('0x32')]=_[_0x6cbc('0x31')](_0x182df3[_0x6cbc('0x2e')],qs[_0x6cbc('0x33')](_0x213abf[_0x6cbc('0x2f')][_0x6cbc('0x33')]));_0x3b0c14[_0x6cbc('0x32')]=_0x3b0c14['attributes'][_0x6cbc('0x34')]?_0x3b0c14['attributes']:_0x182df3[_0x6cbc('0x2e')];if(!_0x213abf[_0x6cbc('0x2f')][_0x6cbc('0x35')]('nolimit')){_0x3b0c14[_0x6cbc('0x1b')]=qs[_0x6cbc('0x1b')](_0x213abf[_0x6cbc('0x2f')][_0x6cbc('0x1b')]);_0x3b0c14[_0x6cbc('0x1e')]=qs[_0x6cbc('0x1e')](_0x213abf['query'][_0x6cbc('0x1e')]);}_0x3b0c14['order']=qs[_0x6cbc('0x36')](_0x213abf['query'][_0x6cbc('0x36')]);_0x3b0c14[_0x6cbc('0x37')]=qs[_0x6cbc('0x38')](_[_0x6cbc('0x39')](_0x213abf[_0x6cbc('0x2f')],_0x182df3['filters']),_0x4fb50d);if(_0x213abf[_0x6cbc('0x2f')][_0x6cbc('0x3a')]){_0x3b0c14[_0x6cbc('0x37')]=_[_0x6cbc('0x3b')](_0x3b0c14[_0x6cbc('0x37')],{'$or':_[_0x6cbc('0x2a')](_0x4fb50d,function(_0x145b5b){if(_0x145b5b['type']!==_0x6cbc('0x3c')){var _0x234863={};_0x234863[_0x145b5b[_0x6cbc('0x27')]]={'$like':'%'+_0x213abf['query']['filter']+'%'};return _0x234863;}})});}_0x3b0c14=_['merge']({},_0x3b0c14,_0x213abf[_0x6cbc('0x3d')]);var _0x1aea32={'where':_0x3b0c14[_0x6cbc('0x37')]};return db[_0x6cbc('0x2b')][_0x6cbc('0x1d')](_0x1aea32)[_0x6cbc('0x23')](function(_0x460fc9){_0x26304d['count']=_0x460fc9;if(_0x213abf[_0x6cbc('0x2f')][_0x6cbc('0x3e')]){_0x3b0c14[_0x6cbc('0x3f')]=[{'all':!![]}];}return db['MailTransferReport'][_0x6cbc('0x40')](_0x3b0c14);})['then'](function(_0x3b967f){_0x26304d[_0x6cbc('0x41')]=_0x3b967f;return _0x26304d;})['then'](respondWithFilteredResult(_0x3066b7,_0x3b0c14))[_0x6cbc('0x42')](handleError(_0x3066b7,null));};exports[_0x6cbc('0x43')]=function(_0x3ce202,_0x2ba3a8){var _0x1ad1b={'raw':!![],'where':{'id':_0x3ce202['params']['id']}},_0x4fa073={};_0x4fa073[_0x6cbc('0x2e')]=_[_0x6cbc('0x30')](db[_0x6cbc('0x2b')][_0x6cbc('0x44')]);_0x4fa073[_0x6cbc('0x2f')]=_['keys'](_0x3ce202[_0x6cbc('0x2f')]);_0x4fa073[_0x6cbc('0x38')]=_[_0x6cbc('0x31')](_0x4fa073[_0x6cbc('0x2e')],_0x4fa073[_0x6cbc('0x2f')]);_0x1ad1b[_0x6cbc('0x32')]=_[_0x6cbc('0x31')](_0x4fa073['model'],qs[_0x6cbc('0x33')](_0x3ce202[_0x6cbc('0x2f')][_0x6cbc('0x33')]));_0x1ad1b[_0x6cbc('0x32')]=_0x1ad1b[_0x6cbc('0x32')][_0x6cbc('0x34')]?_0x1ad1b[_0x6cbc('0x32')]:_0x4fa073[_0x6cbc('0x2e')];if(_0x3ce202[_0x6cbc('0x2f')][_0x6cbc('0x3e')]){_0x1ad1b[_0x6cbc('0x3f')]=[{'all':!![]}];}_0x1ad1b=_['merge']({},_0x1ad1b,_0x3ce202[_0x6cbc('0x3d')]);return db['MailTransferReport'][_0x6cbc('0x45')](_0x1ad1b)[_0x6cbc('0x23')](handleEntityNotFound(_0x2ba3a8,null))[_0x6cbc('0x23')](respondWithResult(_0x2ba3a8,null))['catch'](handleError(_0x2ba3a8,null));};exports['create']=function(_0x5087c1,_0x42714f){return db[_0x6cbc('0x2b')][_0x6cbc('0x46')](_0x5087c1[_0x6cbc('0x47')],{})[_0x6cbc('0x23')](respondWithResult(_0x42714f,0xc9))[_0x6cbc('0x42')](handleError(_0x42714f,null));};exports[_0x6cbc('0x48')]=function(_0x275dfd,_0x4deda0){if(_0x275dfd[_0x6cbc('0x47')]['id']){delete _0x275dfd['body']['id'];}return db[_0x6cbc('0x2b')][_0x6cbc('0x45')]({'where':{'id':_0x275dfd[_0x6cbc('0x49')]['id']}})[_0x6cbc('0x23')](handleEntityNotFound(_0x4deda0,null))['then'](saveUpdates(_0x275dfd[_0x6cbc('0x47')],null))[_0x6cbc('0x23')](respondWithResult(_0x4deda0,null))[_0x6cbc('0x42')](handleError(_0x4deda0,null));};exports[_0x6cbc('0x22')]=function(_0x5455d0,_0x41942f){return db[_0x6cbc('0x2b')]['find']({'where':{'id':_0x5455d0['params']['id']}})[_0x6cbc('0x23')](handleEntityNotFound(_0x41942f,null))[_0x6cbc('0x23')](removeEntity(_0x41942f,null))['catch'](handleError(_0x41942f,null));};exports[_0x6cbc('0x4a')]=function(_0x54e62a,_0xa465cf){return db[_0x6cbc('0x2b')]['describe']()[_0x6cbc('0x23')](respondWithResult(_0xa465cf,null))[_0x6cbc('0x42')](handleError(_0xa465cf,null));}; \ No newline at end of file +var _0xd56b=['filters','pick','filter','options','includeAll','include','findAll','rows','length','merge','catch','create','body','update','find','params','describe','eml-format','zip-dir','request-promise','moment','mustache','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','sort','where'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xd56b,0xf8));var _0xbd56=function(_0x3c8cbe,_0x44f876){_0x3c8cbe=_0x3c8cbe-0x0;var _0x14eab8=_0xd56b[_0x3c8cbe];return _0x14eab8;};'use strict';var emlformat=require(_0xbd56('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbd56('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbd56('0x2'));var moment=require(_0xbd56('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbd56('0x4'));var util=require(_0xbd56('0x5'));var path=require(_0xbd56('0x6'));var sox=require(_0xbd56('0x7'));var csv=require(_0xbd56('0x8'));var ejs=require(_0xbd56('0x9'));var fs=require('fs');var fs_extra=require(_0xbd56('0xa'));var _=require(_0xbd56('0xb'));var squel=require('squel');var crypto=require(_0xbd56('0xc'));var jsforce=require(_0xbd56('0xd'));var deskjs=require(_0xbd56('0xe'));var toCsv=require(_0xbd56('0x8'));var querystring=require(_0xbd56('0xf'));var Papa=require(_0xbd56('0x10'));var Redis=require(_0xbd56('0x11'));var authService=require(_0xbd56('0x12'));var qs=require(_0xbd56('0x13'));var as=require(_0xbd56('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbd56('0x15'))(_0xbd56('0x16'));var utils=require(_0xbd56('0x17'));var config=require(_0xbd56('0x18'));var licenseUtil=require(_0xbd56('0x19'));var db=require(_0xbd56('0x1a'))['db'];function respondWithStatusCode(_0x1317ae,_0x1beadf){_0x1beadf=_0x1beadf||0xcc;return function(_0x20a826){if(_0x20a826){return _0x1317ae[_0xbd56('0x1b')](_0x1beadf);}return _0x1317ae[_0xbd56('0x1c')](_0x1beadf)[_0xbd56('0x1d')]();};}function respondWithResult(_0x396071,_0x3875b1){_0x3875b1=_0x3875b1||0xc8;return function(_0x32e02f){if(_0x32e02f){return _0x396071[_0xbd56('0x1c')](_0x3875b1)[_0xbd56('0x1e')](_0x32e02f);}};}function respondWithFilteredResult(_0x5aff1b,_0x374344){return function(_0x3b62c6){if(_0x3b62c6){var _0x52c5e9=typeof _0x374344[_0xbd56('0x1f')]===_0xbd56('0x20')&&typeof _0x374344[_0xbd56('0x21')]===_0xbd56('0x20');var _0x243e19=_0x3b62c6[_0xbd56('0x22')];var _0x347b6e=_0x52c5e9?0x0:_0x374344[_0xbd56('0x1f')];var _0x4e030b=_0x52c5e9?_0x3b62c6[_0xbd56('0x22')]:_0x374344['offset']+_0x374344['limit'];var _0x5d6c2c;if(_0x4e030b>=_0x243e19){_0x4e030b=_0x243e19;_0x5d6c2c=0xc8;}else{_0x5d6c2c=0xce;}_0x5aff1b[_0xbd56('0x1c')](_0x5d6c2c);return _0x5aff1b['set'](_0xbd56('0x23'),_0x347b6e+'-'+_0x4e030b+'/'+_0x243e19)[_0xbd56('0x1e')](_0x3b62c6);}return null;};}function patchUpdates(_0x27479e){return function(_0x42f908){try{jsonpatch[_0xbd56('0x24')](_0x42f908,_0x27479e,!![]);}catch(_0x1df486){return BPromise[_0xbd56('0x25')](_0x1df486);}return _0x42f908[_0xbd56('0x26')]();};}function saveUpdates(_0x4e6ef0,_0x1f8437){return function(_0x3830f1){if(_0x3830f1){return _0x3830f1['update'](_0x4e6ef0)[_0xbd56('0x27')](function(_0x522895){return _0x522895;});}return null;};}function removeEntity(_0x3bdf53,_0x18c9dc){return function(_0x13cd8e){if(_0x13cd8e){return _0x13cd8e[_0xbd56('0x28')]()[_0xbd56('0x27')](function(){_0x3bdf53[_0xbd56('0x1c')](0xcc)[_0xbd56('0x1d')]();});}};}function handleEntityNotFound(_0x5c5765,_0x41a770){return function(_0x40e3f7){if(!_0x40e3f7){_0x5c5765[_0xbd56('0x1b')](0x194);}return _0x40e3f7;};}function handleError(_0x18702d,_0x1aaa73){_0x1aaa73=_0x1aaa73||0x1f4;return function(_0x487881){logger[_0xbd56('0x29')](_0x487881[_0xbd56('0x2a')]);if(_0x487881[_0xbd56('0x2b')]){delete _0x487881['name'];}_0x18702d[_0xbd56('0x1c')](_0x1aaa73)['send'](_0x487881);};}exports[_0xbd56('0x2c')]=function(_0x5e71f1,_0x4b7e04){var _0x1c78f9={},_0x444af1={},_0x46c049={'count':0x0,'rows':[]};var _0x14f326=_[_0xbd56('0x2d')](db[_0xbd56('0x2e')][_0xbd56('0x2f')],function(_0x42864f){return{'name':_0x42864f[_0xbd56('0x30')],'type':_0x42864f[_0xbd56('0x31')][_0xbd56('0x32')]};});_0x444af1[_0xbd56('0x33')]=_[_0xbd56('0x2d')](_0x14f326,'name');_0x444af1['query']=_[_0xbd56('0x34')](_0x5e71f1['query']);_0x444af1['filters']=_['intersection'](_0x444af1['model'],_0x444af1[_0xbd56('0x35')]);_0x1c78f9['attributes']=_[_0xbd56('0x36')](_0x444af1[_0xbd56('0x33')],qs[_0xbd56('0x37')](_0x5e71f1[_0xbd56('0x35')][_0xbd56('0x37')]));_0x1c78f9[_0xbd56('0x38')]=_0x1c78f9[_0xbd56('0x38')]['length']?_0x1c78f9[_0xbd56('0x38')]:_0x444af1['model'];if(!_0x5e71f1[_0xbd56('0x35')][_0xbd56('0x39')]('nolimit')){_0x1c78f9[_0xbd56('0x21')]=qs['limit'](_0x5e71f1[_0xbd56('0x35')][_0xbd56('0x21')]);_0x1c78f9[_0xbd56('0x1f')]=qs[_0xbd56('0x1f')](_0x5e71f1[_0xbd56('0x35')][_0xbd56('0x1f')]);}_0x1c78f9['order']=qs[_0xbd56('0x3a')](_0x5e71f1[_0xbd56('0x35')][_0xbd56('0x3a')]);_0x1c78f9[_0xbd56('0x3b')]=qs[_0xbd56('0x3c')](_[_0xbd56('0x3d')](_0x5e71f1[_0xbd56('0x35')],_0x444af1[_0xbd56('0x3c')]),_0x14f326);if(_0x5e71f1['query'][_0xbd56('0x3e')]){_0x1c78f9[_0xbd56('0x3b')]=_['merge'](_0x1c78f9[_0xbd56('0x3b')],{'$or':_[_0xbd56('0x2d')](_0x14f326,function(_0xa64238){if(_0xa64238[_0xbd56('0x31')]!=='VIRTUAL'){var _0x3b02c0={};_0x3b02c0[_0xa64238[_0xbd56('0x2b')]]={'$like':'%'+_0x5e71f1[_0xbd56('0x35')]['filter']+'%'};return _0x3b02c0;}})});}_0x1c78f9=_['merge']({},_0x1c78f9,_0x5e71f1[_0xbd56('0x3f')]);var _0x1d2aae={'where':_0x1c78f9[_0xbd56('0x3b')]};return db[_0xbd56('0x2e')]['count'](_0x1d2aae)['then'](function(_0x4d2ba7){_0x46c049[_0xbd56('0x22')]=_0x4d2ba7;if(_0x5e71f1[_0xbd56('0x35')][_0xbd56('0x40')]){_0x1c78f9[_0xbd56('0x41')]=[{'all':!![]}];}return db[_0xbd56('0x2e')][_0xbd56('0x42')](_0x1c78f9);})[_0xbd56('0x27')](function(_0x56a70f){_0x46c049[_0xbd56('0x43')]=_0x56a70f;return _0x46c049;})[_0xbd56('0x27')](respondWithFilteredResult(_0x4b7e04,_0x1c78f9))['catch'](handleError(_0x4b7e04,null));};exports['show']=function(_0xf87521,_0x449353){var _0x442046={'raw':!![],'where':{'id':_0xf87521['params']['id']}},_0x2b8372={};_0x2b8372[_0xbd56('0x33')]=_[_0xbd56('0x34')](db[_0xbd56('0x2e')][_0xbd56('0x2f')]);_0x2b8372[_0xbd56('0x35')]=_[_0xbd56('0x34')](_0xf87521[_0xbd56('0x35')]);_0x2b8372[_0xbd56('0x3c')]=_[_0xbd56('0x36')](_0x2b8372['model'],_0x2b8372[_0xbd56('0x35')]);_0x442046[_0xbd56('0x38')]=_['intersection'](_0x2b8372[_0xbd56('0x33')],qs[_0xbd56('0x37')](_0xf87521[_0xbd56('0x35')][_0xbd56('0x37')]));_0x442046[_0xbd56('0x38')]=_0x442046[_0xbd56('0x38')][_0xbd56('0x44')]?_0x442046[_0xbd56('0x38')]:_0x2b8372['model'];if(_0xf87521[_0xbd56('0x35')]['includeAll']){_0x442046[_0xbd56('0x41')]=[{'all':!![]}];}_0x442046=_[_0xbd56('0x45')]({},_0x442046,_0xf87521[_0xbd56('0x3f')]);return db[_0xbd56('0x2e')]['find'](_0x442046)[_0xbd56('0x27')](handleEntityNotFound(_0x449353,null))[_0xbd56('0x27')](respondWithResult(_0x449353,null))[_0xbd56('0x46')](handleError(_0x449353,null));};exports[_0xbd56('0x47')]=function(_0x2a5c31,_0x3348bd){return db['MailTransferReport'][_0xbd56('0x47')](_0x2a5c31[_0xbd56('0x48')],{})['then'](respondWithResult(_0x3348bd,0xc9))[_0xbd56('0x46')](handleError(_0x3348bd,null));};exports[_0xbd56('0x49')]=function(_0x43f269,_0x728e5c){if(_0x43f269[_0xbd56('0x48')]['id']){delete _0x43f269['body']['id'];}return db[_0xbd56('0x2e')][_0xbd56('0x4a')]({'where':{'id':_0x43f269[_0xbd56('0x4b')]['id']}})[_0xbd56('0x27')](handleEntityNotFound(_0x728e5c,null))[_0xbd56('0x27')](saveUpdates(_0x43f269[_0xbd56('0x48')],null))['then'](respondWithResult(_0x728e5c,null))['catch'](handleError(_0x728e5c,null));};exports['destroy']=function(_0x12b779,_0x2c2d0d){return db['MailTransferReport'][_0xbd56('0x4a')]({'where':{'id':_0x12b779['params']['id']}})[_0xbd56('0x27')](handleEntityNotFound(_0x2c2d0d,null))['then'](removeEntity(_0x2c2d0d,null))['catch'](handleError(_0x2c2d0d,null));};exports[_0xbd56('0x4c')]=function(_0x4bcc8b,_0x57c35a){return db[_0xbd56('0x2e')][_0xbd56('0x4c')]()[_0xbd56('0x27')](respondWithResult(_0x57c35a,null))[_0xbd56('0x46')](handleError(_0x57c35a,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 7aa91c4..3939bc5 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 _0xe002=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','uniqueid'];(function(_0xd39959,_0x302d09){var _0x1ff69c=function(_0x17c97f){while(--_0x17c97f){_0xd39959['push'](_0xd39959['shift']());}};_0x1ff69c(++_0x302d09);}(_0xe002,0xf7));var _0x2e00=function(_0x2c534a,_0x18a19e){_0x2c534a=_0x2c534a-0x0;var _0x3f5c99=_0xe002[_0x2c534a];return _0x3f5c99;};'use strict';var _=require(_0x2e00('0x0'));var util=require(_0x2e00('0x1'));var logger=require(_0x2e00('0x2'))('api');var moment=require(_0x2e00('0x3'));var BPromise=require(_0x2e00('0x4'));var rp=require(_0x2e00('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2e00('0x6'));var config=require(_0x2e00('0x7'));var attributes=require(_0x2e00('0x8'));module[_0x2e00('0x9')]=function(_0x3cd8e8,_0x120155){return _0x3cd8e8[_0x2e00('0xa')](_0x2e00('0xb'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x2e00('0xc'),'fields':[_0x2e00('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x514e=['define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes'];(function(_0x5240be,_0x198575){var _0xdfdbe3=function(_0x45be57){while(--_0x45be57){_0x5240be['push'](_0x5240be['shift']());}};_0xdfdbe3(++_0x198575);}(_0x514e,0x146));var _0xe514=function(_0x5e570c,_0x233990){_0x5e570c=_0x5e570c-0x0;var _0xc62527=_0x514e[_0x5e570c];return _0xc62527;};'use strict';var _=require(_0xe514('0x0'));var util=require(_0xe514('0x1'));var logger=require(_0xe514('0x2'))(_0xe514('0x3'));var moment=require('moment');var BPromise=require(_0xe514('0x4'));var rp=require(_0xe514('0x5'));var fs=require('fs');var path=require(_0xe514('0x6'));var rimraf=require(_0xe514('0x7'));var config=require(_0xe514('0x8'));var attributes=require(_0xe514('0x9'));module['exports']=function(_0x46a1d2,_0x12fda1){return _0x46a1d2[_0xe514('0xa')](_0xe514('0xb'),attributes,{'tableName':_0xe514('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe514('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 191129d..66a7a0a 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 _0x328b=['../../config/logger','rpc','jayson/promise','client','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','randomstring','ioredis','../../mysqldb'];(function(_0x3c9e44,_0x2fee15){var _0x17da1f=function(_0x460b7a){while(--_0x460b7a){_0x3c9e44['push'](_0x3c9e44['shift']());}};_0x17da1f(++_0x2fee15);}(_0x328b,0x1ea));var _0xb328=function(_0x4350c2,_0x112f3c){_0x4350c2=_0x4350c2-0x0;var _0x8b6406=_0x328b[_0x4350c2];return _0x8b6406;};'use strict';var _=require(_0xb328('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb328('0x1'));var fs=require('fs');var Redis=require(_0xb328('0x2'));var db=require(_0xb328('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb328('0x4'))(_0xb328('0x5'));var config=require('../../config/environment');var jayson=require(_0xb328('0x6'));var client=jayson[_0xb328('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10b4a1,_0x57135b,_0x4628b8){return new BPromise(function(_0x3d8b4d,_0x4d0706){return client[_0xb328('0x8')](_0x10b4a1,_0x4628b8)[_0xb328('0x9')](function(_0x410746){logger[_0xb328('0xa')](_0xb328('0xb'),_0x57135b,_0xb328('0xc'));logger['debug'](_0xb328('0xd'),_0x57135b,_0xb328('0xc'),JSON[_0xb328('0xe')](_0x410746));if(_0x410746[_0xb328('0xf')]){if(_0x410746[_0xb328('0xf')]['code']===0x1f4){logger['error'](_0xb328('0xb'),_0x57135b,_0x410746[_0xb328('0xf')][_0xb328('0x10')]);return _0x4d0706(_0x410746['error'][_0xb328('0x10')]);}logger[_0xb328('0xf')](_0xb328('0xb'),_0x57135b,_0x410746[_0xb328('0xf')][_0xb328('0x10')]);return _0x3d8b4d(_0x410746[_0xb328('0xf')]['message']);}else{logger[_0xb328('0xa')]('MailTransferReport,\x20%s,\x20%s',_0x57135b,_0xb328('0xc'));_0x3d8b4d(_0x410746[_0xb328('0x11')]['message']);}})[_0xb328('0x12')](function(_0x36dea1){logger[_0xb328('0xf')](_0xb328('0xb'),_0x57135b,_0x36dea1);_0x4d0706(_0x36dea1);});});} \ No newline at end of file +var _0x1eda=['debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','MailTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0xd8a8af,_0x1e93f0){var _0x5b7278=function(_0x458800){while(--_0x458800){_0xd8a8af['push'](_0xd8a8af['shift']());}};_0x5b7278(++_0x1e93f0);}(_0x1eda,0x10a));var _0xa1ed=function(_0x2a3a68,_0x169422){_0x2a3a68=_0x2a3a68-0x0;var _0x16b157=_0x1eda[_0x2a3a68];return _0x16b157;};'use strict';var _=require(_0xa1ed('0x0'));var util=require(_0xa1ed('0x1'));var moment=require('moment');var BPromise=require(_0xa1ed('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa1ed('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa1ed('0x4'));var logger=require(_0xa1ed('0x5'))(_0xa1ed('0x6'));var config=require(_0xa1ed('0x7'));var jayson=require(_0xa1ed('0x8'));var client=jayson['client'][_0xa1ed('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x542def,_0x4f5f4c,_0x21941e){return new BPromise(function(_0x95de26,_0x3dc2b0){return client[_0xa1ed('0xa')](_0x542def,_0x21941e)['then'](function(_0x28ee01){logger[_0xa1ed('0xb')](_0xa1ed('0xc'),_0x4f5f4c,_0xa1ed('0xd'));logger[_0xa1ed('0xe')](_0xa1ed('0xf'),_0x4f5f4c,_0xa1ed('0xd'),JSON['stringify'](_0x28ee01));if(_0x28ee01[_0xa1ed('0x10')]){if(_0x28ee01[_0xa1ed('0x10')][_0xa1ed('0x11')]===0x1f4){logger['error'](_0xa1ed('0xc'),_0x4f5f4c,_0x28ee01[_0xa1ed('0x10')][_0xa1ed('0x12')]);return _0x3dc2b0(_0x28ee01[_0xa1ed('0x10')]['message']);}logger[_0xa1ed('0x10')](_0xa1ed('0xc'),_0x4f5f4c,_0x28ee01['error'][_0xa1ed('0x12')]);return _0x95de26(_0x28ee01[_0xa1ed('0x10')][_0xa1ed('0x12')]);}else{logger[_0xa1ed('0xb')](_0xa1ed('0xc'),_0x4f5f4c,_0xa1ed('0xd'));_0x95de26(_0x28ee01[_0xa1ed('0x13')][_0xa1ed('0x12')]);}})['catch'](function(_0x52d399){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x4f5f4c,_0x52d399);_0x3dc2b0(_0x52d399);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index a96a526..50999a6 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 _0x1e0d=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','isAuthenticated','/describe','describe','get','/:id','show','post','create','put'];(function(_0x113282,_0x3495ab){var _0x33f4c4=function(_0x4e5ff6){while(--_0x4e5ff6){_0x113282['push'](_0x113282['shift']());}};_0x33f4c4(++_0x3495ab);}(_0x1e0d,0x6b));var _0xd1e0=function(_0x84a946,_0x31719b){_0x84a946=_0x84a946-0x0;var _0x207f46=_0x1e0d[_0x84a946];return _0x207f46;};'use strict';var multer=require(_0xd1e0('0x0'));var util=require(_0xd1e0('0x1'));var path=require(_0xd1e0('0x2'));var timeout=require('connect-timeout');var express=require(_0xd1e0('0x3'));var router=express[_0xd1e0('0x4')]();var fs_extra=require(_0xd1e0('0x5'));var auth=require(_0xd1e0('0x6'));var interaction=require(_0xd1e0('0x7'));var config=require(_0xd1e0('0x8'));var controller=require(_0xd1e0('0x9'));router['get']('/',auth[_0xd1e0('0xa')](),controller['index']);router['get'](_0xd1e0('0xb'),auth[_0xd1e0('0xa')](),controller[_0xd1e0('0xc')]);router[_0xd1e0('0xd')](_0xd1e0('0xe'),auth[_0xd1e0('0xa')](),controller[_0xd1e0('0xf')]);router[_0xd1e0('0x10')]('/',auth[_0xd1e0('0xa')](),controller[_0xd1e0('0x11')]);router[_0xd1e0('0x12')]('/:id',auth[_0xd1e0('0xa')](),controller['update']);router['delete']('/:id',auth[_0xd1e0('0xa')](),controller[_0xd1e0('0x13')]);module[_0xd1e0('0x14')]=router; \ No newline at end of file +var _0xf1e0=['connect-timeout','express','Router','fs-extra','get','isAuthenticated','show','post','create','put','/:id','delete','destroy','exports','multer','util','path'];(function(_0x2294bb,_0x3bc4fe){var _0x374942=function(_0x17ee9a){while(--_0x17ee9a){_0x2294bb['push'](_0x2294bb['shift']());}};_0x374942(++_0x3bc4fe);}(_0xf1e0,0x162));var _0x0f1e=function(_0x630942,_0x416196){_0x630942=_0x630942-0x0;var _0x599c57=_0xf1e0[_0x630942];return _0x599c57;};'use strict';var multer=require(_0x0f1e('0x0'));var util=require(_0x0f1e('0x1'));var path=require(_0x0f1e('0x2'));var timeout=require(_0x0f1e('0x3'));var express=require(_0x0f1e('0x4'));var router=express[_0x0f1e('0x5')]();var fs_extra=require(_0x0f1e('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./memberReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x0f1e('0x7')]('/describe',auth[_0x0f1e('0x8')](),controller['describe']);router[_0x0f1e('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x0f1e('0x9')]);router[_0x0f1e('0xa')]('/',auth['isAuthenticated'](),controller[_0x0f1e('0xb')]);router[_0x0f1e('0xc')](_0x0f1e('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0f1e('0xe')](_0x0f1e('0xd'),auth[_0x0f1e('0x8')](),controller[_0x0f1e('0xf')]);module[_0x0f1e('0x10')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 8afff09..1d35d82 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 _0x00c2=['talk:[dial\x20string]','talk:[queue]','INTEGER','STRING','DATE','getDataValue','enterAt','diff','seconds','setDataValue','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]'];(function(_0x4fa1df,_0x5555d9){var _0x1bff8b=function(_0x1d3e4d){while(--_0x1d3e4d){_0x4fa1df['push'](_0x4fa1df['shift']());}};_0x1bff8b(++_0x5555d9);}(_0x00c2,0x78));var _0x200c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x00c2[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'channel':{'type':Sequelize[_0x200c('0x0')]},'membername':{'type':Sequelize[_0x200c('0x0')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x200c('0x0')],'defaultValue':'DEFAULT\x20PAUSE','comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x200c('0x1')],'set':function(_0x25d8ab){var _0x5e11c0=moment(_0x25d8ab);var _0xcf30d2=moment(this[_0x200c('0x2')](_0x200c('0x3')));var _0x47f1cb=_0x5e11c0[_0x200c('0x4')](_0xcf30d2,_0x200c('0x5'));this['setDataValue']('exitAt',_0x25d8ab);this[_0x200c('0x6')]('duration',_0x47f1cb>=0x0?_0x47f1cb:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x200c('0x7')},'data2':{'type':Sequelize['STRING'],'comment':_0x200c('0x8')},'data3':{'type':Sequelize[_0x200c('0x0')],'comment':_0x200c('0x9')},'data4':{'type':Sequelize[_0x200c('0x0')],'comment':_0x200c('0xa')},'data5':{'type':Sequelize[_0x200c('0x0')],'comment':_0x200c('0xb')},'role':{'type':Sequelize[_0x200c('0x0')]},'internal':{'type':Sequelize[_0x200c('0xc')]},'uniqueid':{'type':Sequelize[_0x200c('0x0')]}}; \ No newline at end of file +var _0xf480=['exports','STRING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','moment'];(function(_0x3351bf,_0x1acad8){var _0x535d15=function(_0x22518d){while(--_0x22518d){_0x3351bf['push'](_0x3351bf['shift']());}};_0x535d15(++_0x1acad8);}(_0xf480,0x1ca));var _0x0f48=function(_0xe54280,_0x134bb5){_0xe54280=_0xe54280-0x0;var _0x133eeb=_0xf480[_0xe54280];return _0x133eeb;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0f48('0x0'));module[_0x0f48('0x1')]={'channel':{'type':Sequelize[_0x0f48('0x2')]},'membername':{'type':Sequelize[_0x0f48('0x2')]},'interface':{'type':Sequelize[_0x0f48('0x2')]},'type':{'type':Sequelize[_0x0f48('0x2')],'defaultValue':'DEFAULT\x20PAUSE','comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x0f48('0x3')]},'enterAt':{'type':Sequelize[_0x0f48('0x4')]},'exitAt':{'type':Sequelize[_0x0f48('0x4')],'set':function(_0x34eb4e){var _0xdf8177=moment(_0x34eb4e);var _0xa3dfda=moment(this[_0x0f48('0x5')](_0x0f48('0x6')));var _0x3ee064=_0xdf8177[_0x0f48('0x7')](_0xa3dfda,_0x0f48('0x8'));this[_0x0f48('0x9')](_0x0f48('0xa'),_0x34eb4e);this['setDataValue'](_0x0f48('0xb'),_0x3ee064>=0x0?_0x3ee064:null);}},'data1':{'type':Sequelize[_0x0f48('0x2')],'comment':_0x0f48('0xc')},'data2':{'type':Sequelize['STRING'],'comment':_0x0f48('0xd')},'data3':{'type':Sequelize[_0x0f48('0x2')],'comment':_0x0f48('0xe')},'data4':{'type':Sequelize[_0x0f48('0x2')],'comment':_0x0f48('0xf')},'data5':{'type':Sequelize[_0x0f48('0x2')],'comment':_0x0f48('0x10')},'role':{'type':Sequelize[_0x0f48('0x2')]},'internal':{'type':Sequelize[_0x0f48('0x3')]},'uniqueid':{'type':Sequelize[_0x0f48('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 38aae9b..f2e189f 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x55ca,0x126));var _0xa55c=function(_0x1529a3,_0x529f63){_0x1529a3=_0x1529a3-0x0;var _0x1a0d4b=_0x55ca[_0x1529a3];return _0x1a0d4b;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file +var _0x008c=['destroy','sendStatus','send','index','MemberReport','rawAttributes','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then'];(function(_0x1554bc,_0x2c0225){var _0x2891e6=function(_0x2e4f6d){while(--_0x2e4f6d){_0x1554bc['push'](_0x1554bc['shift']());}};_0x2891e6(++_0x2c0225);}(_0x008c,0x188));var _0xc008=function(_0x15fc07,_0x41cc0c){_0x15fc07=_0x15fc07-0x0;var _0x3d2c0f=_0x008c[_0x15fc07];return _0x3d2c0f;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={},_0x32390d={},_0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x26')][_0xc008('0x27')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x28')]};});_0x32390d[_0xc008('0x29')]=_[_0xc008('0x2a')](_0x2a7d4f,_0xc008('0x2b'));_0x32390d[_0xc008('0x2c')]=_[_0xc008('0x2d')](_0x25eae4[_0xc008('0x2c')]);_0x32390d[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x32390d[_0xc008('0x29')],_0x32390d[_0xc008('0x2c')]);_0x24c14c[_0xc008('0x30')]=_['intersection'](_0x32390d[_0xc008('0x29')],qs[_0xc008('0x31')](_0x25eae4['query'][_0xc008('0x31')]));_0x24c14c[_0xc008('0x30')]=_0x24c14c[_0xc008('0x30')][_0xc008('0x32')]?_0x24c14c[_0xc008('0x30')]:_0x32390d[_0xc008('0x29')];if(!_0x25eae4[_0xc008('0x2c')][_0xc008('0x33')](_0xc008('0x34'))){_0x24c14c['limit']=qs[_0xc008('0x1d')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1d')]);_0x24c14c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1b')]);}_0x24c14c['order']=qs[_0xc008('0x35')](_0x25eae4[_0xc008('0x2c')]['sort']);_0x24c14c[_0xc008('0x36')]=qs[_0xc008('0x2e')](_['pick'](_0x25eae4[_0xc008('0x2c')],_0x32390d[_0xc008('0x2e')]),_0x2a7d4f);if(_0x25eae4[_0xc008('0x2c')]['filter']){_0x24c14c['where']=_['merge'](_0x24c14c[_0xc008('0x36')],{'$or':_['map'](_0x2a7d4f,function(_0x3dd0ac){if(_0x3dd0ac[_0xc008('0x37')]!==_0xc008('0x38')){var _0x440459={};_0x440459[_0x3dd0ac[_0xc008('0x2b')]]={'$like':'%'+_0x25eae4[_0xc008('0x2c')][_0xc008('0x39')]+'%'};return _0x440459;}})});}_0x24c14c=_[_0xc008('0x3a')]({},_0x24c14c,_0x25eae4[_0xc008('0x3b')]);var _0x387dfd={'where':_0x24c14c[_0xc008('0x36')]};return db[_0xc008('0x26')][_0xc008('0x1e')](_0x387dfd)[_0xc008('0x21')](function(_0x4cace5){_0x209591[_0xc008('0x1e')]=_0x4cace5;if(_0x25eae4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x24c14c[_0xc008('0x3d')]=[{'all':!![]}];}return db['MemberReport'][_0xc008('0x3e')](_0x24c14c);})[_0xc008('0x21')](function(_0xc8cb91){_0x209591[_0xc008('0x3f')]=_0xc8cb91;return _0x209591;})[_0xc008('0x21')](respondWithFilteredResult(_0x529961,_0x24c14c))['catch'](handleError(_0x529961,null));};exports[_0xc008('0x40')]=function(_0x3323f4,_0x3794b0){var _0x3e9a99={'raw':!![],'where':{'id':_0x3323f4['params']['id']}},_0x7279e8={};_0x7279e8[_0xc008('0x29')]=_[_0xc008('0x2d')](db[_0xc008('0x26')][_0xc008('0x27')]);_0x7279e8['query']=_[_0xc008('0x2d')](_0x3323f4[_0xc008('0x2c')]);_0x7279e8[_0xc008('0x2e')]=_['intersection'](_0x7279e8[_0xc008('0x29')],_0x7279e8['query']);_0x3e9a99[_0xc008('0x30')]=_['intersection'](_0x7279e8[_0xc008('0x29')],qs[_0xc008('0x31')](_0x3323f4['query'][_0xc008('0x31')]));_0x3e9a99[_0xc008('0x30')]=_0x3e9a99[_0xc008('0x30')]['length']?_0x3e9a99[_0xc008('0x30')]:_0x7279e8[_0xc008('0x29')];if(_0x3323f4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x3e9a99[_0xc008('0x3d')]=[{'all':!![]}];}_0x3e9a99=_[_0xc008('0x3a')]({},_0x3e9a99,_0x3323f4['options']);return db['MemberReport']['find'](_0x3e9a99)[_0xc008('0x21')](handleEntityNotFound(_0x3794b0,null))[_0xc008('0x21')](respondWithResult(_0x3794b0,null))[_0xc008('0x41')](handleError(_0x3794b0,null));};exports[_0xc008('0x42')]=function(_0x25289f,_0x24f6a4){return db[_0xc008('0x26')][_0xc008('0x42')](_0x25289f['body'],{})['then'](respondWithResult(_0x24f6a4,0xc9))['catch'](handleError(_0x24f6a4,null));};exports[_0xc008('0x20')]=function(_0x2651cf,_0x158eae){if(_0x2651cf['body']['id']){delete _0x2651cf[_0xc008('0x43')]['id'];}return db[_0xc008('0x26')][_0xc008('0x44')]({'where':{'id':_0x2651cf[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x158eae,null))[_0xc008('0x21')](saveUpdates(_0x2651cf[_0xc008('0x43')],null))[_0xc008('0x21')](respondWithResult(_0x158eae,null))[_0xc008('0x41')](handleError(_0x158eae,null));};exports[_0xc008('0x22')]=function(_0x52c444,_0x4c63d4){return db[_0xc008('0x26')]['find']({'where':{'id':_0x52c444[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x4c63d4,null))[_0xc008('0x21')](removeEntity(_0x4c63d4,null))['catch'](handleError(_0x4c63d4,null));};exports[_0xc008('0x46')]=function(_0x32b435,_0xee64){return db[_0xc008('0x26')][_0xc008('0x46')]()['then'](respondWithResult(_0xee64,null))[_0xc008('0x41')](handleError(_0xee64,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 6d92d14..17c01f3 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 _0x20ef=['exports','membername_interface','membername','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment'];(function(_0x2d61ac,_0x18ff36){var _0x3f7d3c=function(_0x2ba7e5){while(--_0x2ba7e5){_0x2d61ac['push'](_0x2d61ac['shift']());}};_0x3f7d3c(++_0x18ff36);}(_0x20ef,0x189));var _0xf20e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x20ef[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf20e('0x0'));var util=require(_0xf20e('0x1'));var logger=require(_0xf20e('0x2'))(_0xf20e('0x3'));var moment=require('moment');var BPromise=require(_0xf20e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf20e('0x5'));var config=require(_0xf20e('0x6'));var attributes=require('./memberReport.attributes');module[_0xf20e('0x7')]=function(_0x52ff82,_0x50a0a7){return _0x52ff82['define']('MemberReport',attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0xf20e('0x8'),'fields':[_0xf20e('0x9'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf91e=['moment','bluebird','request-promise','path','rimraf','./memberReport.attributes','exports','define','MemberReport','report_member','membername','lodash','../../config/logger'];(function(_0x587c72,_0x4ec0d4){var _0x5aee9c=function(_0x455d9d){while(--_0x455d9d){_0x587c72['push'](_0x587c72['shift']());}};_0x5aee9c(++_0x4ec0d4);}(_0xf91e,0x73));var _0xef91=function(_0x38ae19,_0x2a0909){_0x38ae19=_0x38ae19-0x0;var _0x3ea9f7=_0xf91e[_0x38ae19];return _0x3ea9f7;};'use strict';var _=require(_0xef91('0x0'));var util=require('util');var logger=require(_0xef91('0x1'))('api');var moment=require(_0xef91('0x2'));var BPromise=require(_0xef91('0x3'));var rp=require(_0xef91('0x4'));var fs=require('fs');var path=require(_0xef91('0x5'));var rimraf=require(_0xef91('0x6'));var config=require('../../config/environment');var attributes=require(_0xef91('0x7'));module[_0xef91('0x8')]=function(_0x5e3ac6,_0x2ad661){return _0x5e3ac6[_0xef91('0x9')](_0xef91('0xa'),attributes,{'tableName':_0xef91('0xb'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0xef91('0xc'),'interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index af3e89b..00b7891 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 _0xacf4=['MemberReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','CreateMemberReport','body','UpdateMemberReport','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','MemberReport,\x20%s,\x20%s','request\x20sent'];(function(_0x17575f,_0x2ac70a){var _0x3741d4=function(_0x13c92c){while(--_0x13c92c){_0x17575f['push'](_0x17575f['shift']());}};_0x3741d4(++_0x2ac70a);}(_0xacf4,0xe7));var _0x4acf=function(_0x1c2f29,_0x5a2668){_0x1c2f29=_0x1c2f29-0x0;var _0x258465=_0xacf4[_0x1c2f29];return _0x258465;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4acf('0x0'));var BPromise=require(_0x4acf('0x1'));var rs=require(_0x4acf('0x2'));var fs=require('fs');var Redis=require(_0x4acf('0x3'));var db=require(_0x4acf('0x4'))['db'];var utils=require(_0x4acf('0x5'));var logger=require(_0x4acf('0x6'))('rpc');var config=require(_0x4acf('0x7'));var jayson=require(_0x4acf('0x8'));var client=jayson['client'][_0x4acf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ba08a,_0x649ad2,_0x45a5a4){return new BPromise(function(_0x25d345,_0x50f5f4){return client['request'](_0x2ba08a,_0x45a5a4)[_0x4acf('0xa')](function(_0x59f559){logger[_0x4acf('0xb')](_0x4acf('0xc'),_0x649ad2,_0x4acf('0xd'));logger['debug'](_0x4acf('0xe'),_0x649ad2,_0x4acf('0xd'),JSON['stringify'](_0x59f559));if(_0x59f559['error']){if(_0x59f559[_0x4acf('0xf')]['code']===0x1f4){logger['error'](_0x4acf('0xc'),_0x649ad2,_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);return _0x50f5f4(_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);}logger[_0x4acf('0xf')](_0x4acf('0xc'),_0x649ad2,_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);return _0x25d345(_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);}else{logger['info'](_0x4acf('0xc'),_0x649ad2,'request\x20sent');_0x25d345(_0x59f559[_0x4acf('0x11')][_0x4acf('0x10')]);}})[_0x4acf('0x12')](function(_0x5d934a){logger['error'](_0x4acf('0xc'),_0x649ad2,_0x5d934a);_0x50f5f4(_0x5d934a);});});}exports[_0x4acf('0x13')]=function(_0x240c00){var _0x4b1d93=this;return new Promise(function(_0x2a678b,_0x137302){return db[_0x4acf('0x14')][_0x4acf('0x15')]({'raw':_0x240c00[_0x4acf('0x16')]?_0x240c00[_0x4acf('0x16')][_0x4acf('0x17')]===undefined?!![]:![]:!![],'where':_0x240c00[_0x4acf('0x16')]?_0x240c00[_0x4acf('0x16')][_0x4acf('0x18')]||null:null,'attributes':_0x240c00[_0x4acf('0x16')]?_0x240c00['options'][_0x4acf('0x19')]||null:null,'limit':_0x240c00[_0x4acf('0x16')]?_0x240c00['options'][_0x4acf('0x1a')]||null:null,'include':_0x240c00[_0x4acf('0x16')]?_0x240c00['options'][_0x4acf('0x1b')]?_[_0x4acf('0x1c')](_0x240c00[_0x4acf('0x16')][_0x4acf('0x1b')],function(_0x53885f){return{'model':db[_0x53885f[_0x4acf('0x1d')]],'as':_0x53885f['as'],'attributes':_0x53885f[_0x4acf('0x19')],'include':_0x53885f['include']?_[_0x4acf('0x1c')](_0x53885f[_0x4acf('0x1b')],function(_0x52a84a){return{'model':db[_0x52a84a[_0x4acf('0x1d')]],'as':_0x52a84a['as'],'attributes':_0x52a84a[_0x4acf('0x19')],'include':_0x52a84a[_0x4acf('0x1b')]?_[_0x4acf('0x1c')](_0x52a84a['include'],function(_0x50236d){return{'model':db[_0x50236d[_0x4acf('0x1d')]],'as':_0x50236d['as'],'attributes':_0x50236d[_0x4acf('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4acf('0xa')](function(_0x42c90c){logger[_0x4acf('0xb')](_0x4acf('0x13'),_0x240c00);logger[_0x4acf('0x1e')](_0x4acf('0x13'),_0x240c00,JSON[_0x4acf('0x1f')](_0x42c90c));_0x2a678b(_0x42c90c);})[_0x4acf('0x12')](function(_0x57989e){logger[_0x4acf('0xf')](_0x4acf('0x13'),_0x57989e[_0x4acf('0x10')],_0x240c00);_0x137302(_0x4b1d93[_0x4acf('0xf')](0x1f4,_0x57989e[_0x4acf('0x10')]));});});};exports[_0x4acf('0x20')]=function(_0x27384c){var _0x5d862f=this;return new Promise(function(_0x337b3c,_0x1d221b){return db[_0x4acf('0x14')]['create'](_0x27384c[_0x4acf('0x21')],{'raw':_0x27384c[_0x4acf('0x16')]?_0x27384c[_0x4acf('0x16')][_0x4acf('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x1dae5){logger[_0x4acf('0xb')](_0x4acf('0x20'),_0x27384c);logger['debug'](_0x4acf('0x20'),_0x27384c,JSON[_0x4acf('0x1f')](_0x1dae5));_0x337b3c(_0x1dae5);})[_0x4acf('0x12')](function(_0x3bb129){logger[_0x4acf('0xf')](_0x4acf('0x20'),_0x3bb129['message'],_0x27384c);_0x1d221b(_0x5d862f[_0x4acf('0xf')](0x1f4,_0x3bb129[_0x4acf('0x10')]));});});};exports['UpdateMemberReport']=function(_0xfd8ab5){var _0x543a37=this;return new Promise(function(_0x4cd020,_0x58aacf){return db['MemberReport']['update'](_0xfd8ab5['body'],{'raw':_0xfd8ab5['options']?_0xfd8ab5[_0x4acf('0x16')][_0x4acf('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfd8ab5['options']?_0xfd8ab5[_0x4acf('0x16')][_0x4acf('0x18')]||null:null,'attributes':_0xfd8ab5[_0x4acf('0x16')]?_0xfd8ab5[_0x4acf('0x16')][_0x4acf('0x19')]||null:null,'limit':_0xfd8ab5[_0x4acf('0x16')]?_0xfd8ab5[_0x4acf('0x16')][_0x4acf('0x1a')]||null:null})[_0x4acf('0xa')](function(_0x372bab){logger['info']('UpdateMemberReport',_0xfd8ab5);logger[_0x4acf('0x1e')](_0x4acf('0x22'),_0xfd8ab5,JSON['stringify'](_0x372bab));_0x4cd020(_0x372bab);})[_0x4acf('0x12')](function(_0x40455d){logger[_0x4acf('0xf')](_0x4acf('0x22'),_0x40455d['message'],_0xfd8ab5);_0x58aacf(_0x543a37['error'](0x1f4,_0x40455d[_0x4acf('0x10')]));});});}; \ No newline at end of file +var _0x3d49=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetMemberReport','MemberReport','findAll','options','where','limit','include','attributes','map','model','catch','CreateMemberReport','create','body','raw','UpdateMemberReport','update','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x22f351,_0x472204){var _0x236acc=function(_0x305871){while(--_0x305871){_0x22f351['push'](_0x22f351['shift']());}};_0x236acc(++_0x472204);}(_0x3d49,0x151));var _0x93d4=function(_0x3eb450,_0x592b0a){_0x3eb450=_0x3eb450-0x0;var _0x2c4cfd=_0x3d49[_0x3eb450];return _0x2c4cfd;};'use strict';var _=require('lodash');var util=require(_0x93d4('0x0'));var moment=require(_0x93d4('0x1'));var BPromise=require(_0x93d4('0x2'));var rs=require(_0x93d4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x93d4('0x4'))['db'];var utils=require(_0x93d4('0x5'));var logger=require(_0x93d4('0x6'))(_0x93d4('0x7'));var config=require(_0x93d4('0x8'));var jayson=require(_0x93d4('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4bee9d,_0x5e2fd9,_0x50c533){return new BPromise(function(_0x4c96b7,_0x1eaf9f){return client[_0x93d4('0xa')](_0x4bee9d,_0x50c533)[_0x93d4('0xb')](function(_0x11bc7a){logger[_0x93d4('0xc')](_0x93d4('0xd'),_0x5e2fd9,_0x93d4('0xe'));logger[_0x93d4('0xf')](_0x93d4('0x10'),_0x5e2fd9,_0x93d4('0xe'),JSON[_0x93d4('0x11')](_0x11bc7a));if(_0x11bc7a[_0x93d4('0x12')]){if(_0x11bc7a['error'][_0x93d4('0x13')]===0x1f4){logger['error'](_0x93d4('0xd'),_0x5e2fd9,_0x11bc7a[_0x93d4('0x12')][_0x93d4('0x14')]);return _0x1eaf9f(_0x11bc7a[_0x93d4('0x12')]['message']);}logger[_0x93d4('0x12')](_0x93d4('0xd'),_0x5e2fd9,_0x11bc7a['error'][_0x93d4('0x14')]);return _0x4c96b7(_0x11bc7a[_0x93d4('0x12')][_0x93d4('0x14')]);}else{logger[_0x93d4('0xc')](_0x93d4('0xd'),_0x5e2fd9,'request\x20sent');_0x4c96b7(_0x11bc7a['result'][_0x93d4('0x14')]);}})['catch'](function(_0x1ffdc5){logger[_0x93d4('0x12')](_0x93d4('0xd'),_0x5e2fd9,_0x1ffdc5);_0x1eaf9f(_0x1ffdc5);});});}exports[_0x93d4('0x15')]=function(_0x19ede1){var _0x266e0a=this;return new Promise(function(_0x56c054,_0x452e98){return db[_0x93d4('0x16')][_0x93d4('0x17')]({'raw':_0x19ede1['options']?_0x19ede1[_0x93d4('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x19ede1[_0x93d4('0x18')]?_0x19ede1[_0x93d4('0x18')][_0x93d4('0x19')]||null:null,'attributes':_0x19ede1[_0x93d4('0x18')]?_0x19ede1[_0x93d4('0x18')]['attributes']||null:null,'limit':_0x19ede1[_0x93d4('0x18')]?_0x19ede1[_0x93d4('0x18')][_0x93d4('0x1a')]||null:null,'include':_0x19ede1[_0x93d4('0x18')]?_0x19ede1[_0x93d4('0x18')][_0x93d4('0x1b')]?_['map'](_0x19ede1[_0x93d4('0x18')][_0x93d4('0x1b')],function(_0x26528e){return{'model':db[_0x26528e['model']],'as':_0x26528e['as'],'attributes':_0x26528e[_0x93d4('0x1c')],'include':_0x26528e['include']?_[_0x93d4('0x1d')](_0x26528e[_0x93d4('0x1b')],function(_0x57989a){return{'model':db[_0x57989a[_0x93d4('0x1e')]],'as':_0x57989a['as'],'attributes':_0x57989a[_0x93d4('0x1c')],'include':_0x57989a[_0x93d4('0x1b')]?_['map'](_0x57989a['include'],function(_0x3cf57f){return{'model':db[_0x3cf57f['model']],'as':_0x3cf57f['as'],'attributes':_0x3cf57f[_0x93d4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x93d4('0xb')](function(_0x4dd4d0){logger['info'](_0x93d4('0x15'),_0x19ede1);logger[_0x93d4('0xf')](_0x93d4('0x15'),_0x19ede1,JSON[_0x93d4('0x11')](_0x4dd4d0));_0x56c054(_0x4dd4d0);})[_0x93d4('0x1f')](function(_0x2cfe55){logger[_0x93d4('0x12')](_0x93d4('0x15'),_0x2cfe55[_0x93d4('0x14')],_0x19ede1);_0x452e98(_0x266e0a['error'](0x1f4,_0x2cfe55[_0x93d4('0x14')]));});});};exports[_0x93d4('0x20')]=function(_0x3d5536){var _0x592876=this;return new Promise(function(_0x1baaac,_0x393b63){return db[_0x93d4('0x16')][_0x93d4('0x21')](_0x3d5536[_0x93d4('0x22')],{'raw':_0x3d5536['options']?_0x3d5536[_0x93d4('0x18')][_0x93d4('0x23')]===undefined?!![]:![]:!![]})[_0x93d4('0xb')](function(_0x543d5e){logger[_0x93d4('0xc')](_0x93d4('0x20'),_0x3d5536);logger[_0x93d4('0xf')](_0x93d4('0x20'),_0x3d5536,JSON[_0x93d4('0x11')](_0x543d5e));_0x1baaac(_0x543d5e);})['catch'](function(_0x2cce08){logger[_0x93d4('0x12')](_0x93d4('0x20'),_0x2cce08[_0x93d4('0x14')],_0x3d5536);_0x393b63(_0x592876[_0x93d4('0x12')](0x1f4,_0x2cce08[_0x93d4('0x14')]));});});};exports[_0x93d4('0x24')]=function(_0x23d3aa){var _0x10daa6=this;return new Promise(function(_0x3efdc3,_0x1c3019){return db['MemberReport'][_0x93d4('0x25')](_0x23d3aa['body'],{'raw':_0x23d3aa['options']?_0x23d3aa['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23d3aa[_0x93d4('0x18')]?_0x23d3aa[_0x93d4('0x18')][_0x93d4('0x19')]||null:null,'attributes':_0x23d3aa[_0x93d4('0x18')]?_0x23d3aa[_0x93d4('0x18')][_0x93d4('0x1c')]||null:null,'limit':_0x23d3aa[_0x93d4('0x18')]?_0x23d3aa[_0x93d4('0x18')]['limit']||null:null})[_0x93d4('0xb')](function(_0x2db0c1){logger[_0x93d4('0xc')](_0x93d4('0x24'),_0x23d3aa);logger[_0x93d4('0xf')](_0x93d4('0x24'),_0x23d3aa,JSON[_0x93d4('0x11')](_0x2db0c1));_0x3efdc3(_0x2db0c1);})[_0x93d4('0x1f')](function(_0xeaca44){logger[_0x93d4('0x12')]('UpdateMemberReport',_0xeaca44['message'],_0x23d3aa);_0x1c3019(_0x10daa6[_0x93d4('0x12')](0x1f4,_0xeaca44[_0x93d4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 857d57b..067adc2 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 _0xe9af=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./migration.controller','index'];(function(_0x46ffdb,_0x33329b){var _0x1f8135=function(_0x543de6){while(--_0x543de6){_0x46ffdb['push'](_0x46ffdb['shift']());}};_0x1f8135(++_0x33329b);}(_0xe9af,0x96));var _0xfe9a=function(_0xe1c453,_0xc2b530){_0xe1c453=_0xe1c453-0x0;var _0xec7cae=_0xe9af[_0xe1c453];return _0xec7cae;};'use strict';var multer=require('multer');var util=require(_0xfe9a('0x0'));var path=require(_0xfe9a('0x1'));var timeout=require(_0xfe9a('0x2'));var express=require(_0xfe9a('0x3'));var router=express[_0xfe9a('0x4')]();var fs_extra=require(_0xfe9a('0x5'));var auth=require(_0xfe9a('0x6'));var interaction=require(_0xfe9a('0x7'));var config=require('../../config/environment');var controller=require(_0xfe9a('0x8'));router['get']('/',controller[_0xfe9a('0x9')]);module['exports']=router; \ No newline at end of file +var _0x66f4=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','exports'];(function(_0x500cdd,_0x41dbf9){var _0x40a9e8=function(_0x29baaf){while(--_0x29baaf){_0x500cdd['push'](_0x500cdd['shift']());}};_0x40a9e8(++_0x41dbf9);}(_0x66f4,0xb4));var _0x466f=function(_0x4a5bbb,_0x269f00){_0x4a5bbb=_0x4a5bbb-0x0;var _0x21197c=_0x66f4[_0x4a5bbb];return _0x21197c;};'use strict';var multer=require('multer');var util=require(_0x466f('0x0'));var path=require(_0x466f('0x1'));var timeout=require(_0x466f('0x2'));var express=require(_0x466f('0x3'));var router=express[_0x466f('0x4')]();var fs_extra=require(_0x466f('0x5'));var auth=require(_0x466f('0x6'));var interaction=require(_0x466f('0x7'));var config=require(_0x466f('0x8'));var controller=require('./migration.controller');router[_0x466f('0x9')]('/',controller[_0x466f('0xa')]);module[_0x466f('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 155443f..4158180 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 _0x6243=['version','sequelize'];(function(_0x214126,_0x25704f){var _0x12a7cc=function(_0x39fb40){while(--_0x39fb40){_0x214126['push'](_0x214126['shift']());}};_0x12a7cc(++_0x25704f);}(_0x6243,0x137));var _0x3624=function(_0x1b6355,_0x1dccc7){_0x1b6355=_0x1b6355-0x0;var _0x344d35=_0x6243[_0x1b6355];return _0x344d35;};'use strict';var Sequelize=require(_0x3624('0x0'));module['exports']={'version':{'type':Sequelize['STRING'],'unique':_0x3624('0x1')}}; \ No newline at end of file +var _0xfd4b=['STRING','version','sequelize'];(function(_0x160248,_0x2a57e6){var _0x4e589d=function(_0x1ba722){while(--_0x1ba722){_0x160248['push'](_0x160248['shift']());}};_0x4e589d(++_0x2a57e6);}(_0xfd4b,0x9e));var _0xbfd4=function(_0x2e700c,_0x2893c2){_0x2e700c=_0x2e700c-0x0;var _0x48054d=_0xfd4b[_0x2e700c];return _0x48054d;};'use strict';var Sequelize=require(_0xbfd4('0x0'));module['exports']={'version':{'type':Sequelize[_0xbfd4('0x1')],'unique':_0xbfd4('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 5bb512d..2a7c6ec 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 _0x3022=['catch','eml-format','zip-dir','fast-json-patch','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','reject','save','update','destroy','then','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','key','query','keys','filters','attributes','model','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll'];(function(_0x3a1dec,_0x1f943f){var _0x60ede0=function(_0x285fd5){while(--_0x285fd5){_0x3a1dec['push'](_0x3a1dec['shift']());}};_0x60ede0(++_0x1f943f);}(_0x3022,0xc1));var _0x2302=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x3022[_0x1694f5];return _0x5b4321;};'use strict';var emlformat=require(_0x2302('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2302('0x1'));var jsonpatch=require(_0x2302('0x2'));var rp=require('request-promise');var moment=require(_0x2302('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2302('0x4'));var path=require(_0x2302('0x5'));var sox=require('sox');var csv=require(_0x2302('0x6'));var ejs=require(_0x2302('0x7'));var fs=require('fs');var fs_extra=require(_0x2302('0x8'));var _=require(_0x2302('0x9'));var squel=require(_0x2302('0xa'));var crypto=require(_0x2302('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2302('0x6'));var querystring=require(_0x2302('0xc'));var Papa=require(_0x2302('0xd'));var Redis=require('ioredis');var authService=require(_0x2302('0xe'));var qs=require(_0x2302('0xf'));var as=require(_0x2302('0x10'));var hardwareService=require(_0x2302('0x11'));var logger=require(_0x2302('0x12'))(_0x2302('0x13'));var utils=require('../../config/utils');var config=require(_0x2302('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x2302('0x15'))['db'];function respondWithStatusCode(_0x4bc169,_0x1d7925){_0x1d7925=_0x1d7925||0xcc;return function(_0x4b4ca2){if(_0x4b4ca2){return _0x4bc169[_0x2302('0x16')](_0x1d7925);}return _0x4bc169[_0x2302('0x17')](_0x1d7925)[_0x2302('0x18')]();};}function respondWithResult(_0x45be16,_0x14dc9d){_0x14dc9d=_0x14dc9d||0xc8;return function(_0x450315){if(_0x450315){return _0x45be16[_0x2302('0x17')](_0x14dc9d)[_0x2302('0x19')](_0x450315);}};}function respondWithFilteredResult(_0x2ae09b,_0x1f6601){return function(_0x55ee81){if(_0x55ee81){var _0x1e0b78=typeof _0x1f6601[_0x2302('0x1a')]==='undefined'&&typeof _0x1f6601[_0x2302('0x1b')]==='undefined';var _0x55c94c=_0x55ee81['count'];var _0x1787d4=_0x1e0b78?0x0:_0x1f6601[_0x2302('0x1a')];var _0x1283d4=_0x1e0b78?_0x55ee81[_0x2302('0x1c')]:_0x1f6601[_0x2302('0x1a')]+_0x1f6601[_0x2302('0x1b')];var _0x1705ec;if(_0x1283d4>=_0x55c94c){_0x1283d4=_0x55c94c;_0x1705ec=0xc8;}else{_0x1705ec=0xce;}_0x2ae09b[_0x2302('0x17')](_0x1705ec);return _0x2ae09b[_0x2302('0x1d')]('Content-Range',_0x1787d4+'-'+_0x1283d4+'/'+_0x55c94c)[_0x2302('0x19')](_0x55ee81);}return null;};}function patchUpdates(_0x3017ec){return function(_0x5baa4e){try{jsonpatch['apply'](_0x5baa4e,_0x3017ec,!![]);}catch(_0x4f8c4b){return BPromise[_0x2302('0x1e')](_0x4f8c4b);}return _0x5baa4e[_0x2302('0x1f')]();};}function saveUpdates(_0x535ffc,_0x11c4cb){return function(_0x37b808){if(_0x37b808){return _0x37b808[_0x2302('0x20')](_0x535ffc)['then'](function(_0x16d221){return _0x16d221;});}return null;};}function removeEntity(_0x501ecb,_0x2c6c5f){return function(_0x54aba8){if(_0x54aba8){return _0x54aba8[_0x2302('0x21')]()[_0x2302('0x22')](function(){_0x501ecb[_0x2302('0x17')](0xcc)[_0x2302('0x18')]();});}};}function handleEntityNotFound(_0x474d5b,_0x1414f1){return function(_0x5c22ca){if(!_0x5c22ca){_0x474d5b['sendStatus'](0x194);}return _0x5c22ca;};}function handleError(_0x38f5af,_0xf1af73){_0xf1af73=_0xf1af73||0x1f4;return function(_0x272067){logger['error'](_0x272067[_0x2302('0x23')]);if(_0x272067[_0x2302('0x24')]){delete _0x272067[_0x2302('0x24')];}_0x38f5af[_0x2302('0x17')](_0xf1af73)[_0x2302('0x25')](_0x272067);};}exports[_0x2302('0x26')]=function(_0x3b3b9a,_0x12462b){var _0x449118={},_0x6755e7={},_0x424492={'count':0x0,'rows':[]};var _0x2db366=_[_0x2302('0x27')](db[_0x2302('0x28')][_0x2302('0x29')],function(_0x43b633){return{'name':_0x43b633[_0x2302('0x2a')],'type':_0x43b633[_0x2302('0x2b')][_0x2302('0x2c')]};});_0x6755e7['model']=_[_0x2302('0x27')](_0x2db366,_0x2302('0x24'));_0x6755e7[_0x2302('0x2d')]=_[_0x2302('0x2e')](_0x3b3b9a[_0x2302('0x2d')]);_0x6755e7[_0x2302('0x2f')]=_['intersection'](_0x6755e7['model'],_0x6755e7[_0x2302('0x2d')]);_0x449118[_0x2302('0x30')]=_['intersection'](_0x6755e7[_0x2302('0x31')],qs['fields'](_0x3b3b9a['query'][_0x2302('0x32')]));_0x449118['attributes']=_0x449118[_0x2302('0x30')][_0x2302('0x33')]?_0x449118['attributes']:_0x6755e7[_0x2302('0x31')];if(!_0x3b3b9a[_0x2302('0x2d')]['hasOwnProperty'](_0x2302('0x34'))){_0x449118['limit']=qs[_0x2302('0x1b')](_0x3b3b9a[_0x2302('0x2d')][_0x2302('0x1b')]);_0x449118[_0x2302('0x1a')]=qs[_0x2302('0x1a')](_0x3b3b9a['query'][_0x2302('0x1a')]);}_0x449118['order']=qs[_0x2302('0x35')](_0x3b3b9a[_0x2302('0x2d')]['sort']);_0x449118[_0x2302('0x36')]=qs[_0x2302('0x2f')](_[_0x2302('0x37')](_0x3b3b9a[_0x2302('0x2d')],_0x6755e7['filters']),_0x2db366);if(_0x3b3b9a[_0x2302('0x2d')][_0x2302('0x38')]){_0x449118['where']=_['merge'](_0x449118[_0x2302('0x36')],{'$or':_[_0x2302('0x27')](_0x2db366,function(_0x8af1e7){if(_0x8af1e7[_0x2302('0x2b')]!==_0x2302('0x39')){var _0x4429ec={};_0x4429ec[_0x8af1e7['name']]={'$like':'%'+_0x3b3b9a[_0x2302('0x2d')]['filter']+'%'};return _0x4429ec;}})});}_0x449118=_[_0x2302('0x3a')]({},_0x449118,_0x3b3b9a[_0x2302('0x3b')]);var _0x2e1fa5={'where':_0x449118[_0x2302('0x36')]};return db[_0x2302('0x28')][_0x2302('0x1c')](_0x2e1fa5)[_0x2302('0x22')](function(_0x68e4fa){_0x424492[_0x2302('0x1c')]=_0x68e4fa;if(_0x3b3b9a[_0x2302('0x2d')][_0x2302('0x3c')]){_0x449118[_0x2302('0x3d')]=[{'all':!![]}];}return db[_0x2302('0x28')][_0x2302('0x3e')](_0x449118);})[_0x2302('0x22')](function(_0x30ed16){_0x424492['rows']=_0x30ed16;return _0x424492;})[_0x2302('0x22')](respondWithFilteredResult(_0x12462b,_0x449118))[_0x2302('0x3f')](handleError(_0x12462b,null));}; \ No newline at end of file +var _0x6a94=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','Migration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','map','VIRTUAL','includeAll','include','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x5b6d38,_0x6be810){var _0x3e29eb=function(_0x3e584e){while(--_0x3e584e){_0x5b6d38['push'](_0x5b6d38['shift']());}};_0x3e29eb(++_0x6be810);}(_0x6a94,0x7f));var _0x46a9=function(_0x441691,_0x29feae){_0x441691=_0x441691-0x0;var _0x19a11d=_0x6a94[_0x441691];return _0x19a11d;};'use strict';var emlformat=require(_0x46a9('0x0'));var rimraf=require(_0x46a9('0x1'));var zipdir=require(_0x46a9('0x2'));var jsonpatch=require(_0x46a9('0x3'));var rp=require('request-promise');var moment=require(_0x46a9('0x4'));var BPromise=require(_0x46a9('0x5'));var Mustache=require(_0x46a9('0x6'));var util=require('util');var path=require('path');var sox=require(_0x46a9('0x7'));var csv=require(_0x46a9('0x8'));var ejs=require(_0x46a9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x46a9('0xa'));var squel=require(_0x46a9('0xb'));var crypto=require(_0x46a9('0xc'));var jsforce=require(_0x46a9('0xd'));var deskjs=require(_0x46a9('0xe'));var toCsv=require('to-csv');var querystring=require(_0x46a9('0xf'));var Papa=require(_0x46a9('0x10'));var Redis=require(_0x46a9('0x11'));var authService=require(_0x46a9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x46a9('0x13'));var hardwareService=require(_0x46a9('0x14'));var logger=require('../../config/logger')(_0x46a9('0x15'));var utils=require(_0x46a9('0x16'));var config=require(_0x46a9('0x17'));var licenseUtil=require(_0x46a9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d7331,_0xf02d12){_0xf02d12=_0xf02d12||0xcc;return function(_0x544a51){if(_0x544a51){return _0x4d7331['sendStatus'](_0xf02d12);}return _0x4d7331[_0x46a9('0x19')](_0xf02d12)[_0x46a9('0x1a')]();};}function respondWithResult(_0x3419d4,_0xdfe81c){_0xdfe81c=_0xdfe81c||0xc8;return function(_0x4baaf7){if(_0x4baaf7){return _0x3419d4[_0x46a9('0x19')](_0xdfe81c)[_0x46a9('0x1b')](_0x4baaf7);}};}function respondWithFilteredResult(_0x233e27,_0x457c69){return function(_0x550d22){if(_0x550d22){var _0x59a0d3=typeof _0x457c69['offset']===_0x46a9('0x1c')&&typeof _0x457c69[_0x46a9('0x1d')]==='undefined';var _0x588f49=_0x550d22[_0x46a9('0x1e')];var _0x5a3205=_0x59a0d3?0x0:_0x457c69['offset'];var _0x6881cf=_0x59a0d3?_0x550d22[_0x46a9('0x1e')]:_0x457c69[_0x46a9('0x1f')]+_0x457c69[_0x46a9('0x1d')];var _0x3af7ce;if(_0x6881cf>=_0x588f49){_0x6881cf=_0x588f49;_0x3af7ce=0xc8;}else{_0x3af7ce=0xce;}_0x233e27['status'](_0x3af7ce);return _0x233e27[_0x46a9('0x20')](_0x46a9('0x21'),_0x5a3205+'-'+_0x6881cf+'/'+_0x588f49)[_0x46a9('0x1b')](_0x550d22);}return null;};}function patchUpdates(_0x352b86){return function(_0x4a530e){try{jsonpatch[_0x46a9('0x22')](_0x4a530e,_0x352b86,!![]);}catch(_0x31b8cb){return BPromise[_0x46a9('0x23')](_0x31b8cb);}return _0x4a530e[_0x46a9('0x24')]();};}function saveUpdates(_0x2125b7,_0x516680){return function(_0x22f047){if(_0x22f047){return _0x22f047[_0x46a9('0x25')](_0x2125b7)[_0x46a9('0x26')](function(_0x1cf610){return _0x1cf610;});}return null;};}function removeEntity(_0x4e38fb,_0x1b8e55){return function(_0xfa9258){if(_0xfa9258){return _0xfa9258[_0x46a9('0x27')]()['then'](function(){_0x4e38fb[_0x46a9('0x19')](0xcc)[_0x46a9('0x1a')]();});}};}function handleEntityNotFound(_0x1c7138,_0x1bb724){return function(_0xf17b25){if(!_0xf17b25){_0x1c7138[_0x46a9('0x28')](0x194);}return _0xf17b25;};}function handleError(_0x136872,_0x3ed869){_0x3ed869=_0x3ed869||0x1f4;return function(_0x34e2e8){logger[_0x46a9('0x29')](_0x34e2e8[_0x46a9('0x2a')]);if(_0x34e2e8[_0x46a9('0x2b')]){delete _0x34e2e8[_0x46a9('0x2b')];}_0x136872['status'](_0x3ed869)[_0x46a9('0x2c')](_0x34e2e8);};}exports[_0x46a9('0x2d')]=function(_0x263ef5,_0x57232a){var _0x4787c0={},_0x5b2740={},_0x475ca2={'count':0x0,'rows':[]};var _0x4f2e26=_['map'](db[_0x46a9('0x2e')][_0x46a9('0x2f')],function(_0x482073){return{'name':_0x482073[_0x46a9('0x30')],'type':_0x482073[_0x46a9('0x31')]['key']};});_0x5b2740[_0x46a9('0x32')]=_['map'](_0x4f2e26,'name');_0x5b2740[_0x46a9('0x33')]=_[_0x46a9('0x34')](_0x263ef5[_0x46a9('0x33')]);_0x5b2740[_0x46a9('0x35')]=_[_0x46a9('0x36')](_0x5b2740[_0x46a9('0x32')],_0x5b2740[_0x46a9('0x33')]);_0x4787c0[_0x46a9('0x37')]=_[_0x46a9('0x36')](_0x5b2740[_0x46a9('0x32')],qs[_0x46a9('0x38')](_0x263ef5['query'][_0x46a9('0x38')]));_0x4787c0[_0x46a9('0x37')]=_0x4787c0[_0x46a9('0x37')][_0x46a9('0x39')]?_0x4787c0[_0x46a9('0x37')]:_0x5b2740[_0x46a9('0x32')];if(!_0x263ef5[_0x46a9('0x33')][_0x46a9('0x3a')]('nolimit')){_0x4787c0[_0x46a9('0x1d')]=qs[_0x46a9('0x1d')](_0x263ef5[_0x46a9('0x33')][_0x46a9('0x1d')]);_0x4787c0[_0x46a9('0x1f')]=qs[_0x46a9('0x1f')](_0x263ef5[_0x46a9('0x33')][_0x46a9('0x1f')]);}_0x4787c0[_0x46a9('0x3b')]=qs['sort'](_0x263ef5[_0x46a9('0x33')][_0x46a9('0x3c')]);_0x4787c0[_0x46a9('0x3d')]=qs[_0x46a9('0x35')](_['pick'](_0x263ef5[_0x46a9('0x33')],_0x5b2740[_0x46a9('0x35')]),_0x4f2e26);if(_0x263ef5[_0x46a9('0x33')][_0x46a9('0x3e')]){_0x4787c0[_0x46a9('0x3d')]=_[_0x46a9('0x3f')](_0x4787c0[_0x46a9('0x3d')],{'$or':_[_0x46a9('0x40')](_0x4f2e26,function(_0x3bf9fa){if(_0x3bf9fa[_0x46a9('0x31')]!==_0x46a9('0x41')){var _0x5a754e={};_0x5a754e[_0x3bf9fa[_0x46a9('0x2b')]]={'$like':'%'+_0x263ef5[_0x46a9('0x33')][_0x46a9('0x3e')]+'%'};return _0x5a754e;}})});}_0x4787c0=_['merge']({},_0x4787c0,_0x263ef5['options']);var _0x527aa6={'where':_0x4787c0['where']};return db[_0x46a9('0x2e')][_0x46a9('0x1e')](_0x527aa6)[_0x46a9('0x26')](function(_0x3f43dd){_0x475ca2[_0x46a9('0x1e')]=_0x3f43dd;if(_0x263ef5[_0x46a9('0x33')][_0x46a9('0x42')]){_0x4787c0[_0x46a9('0x43')]=[{'all':!![]}];}return db[_0x46a9('0x2e')][_0x46a9('0x44')](_0x4787c0);})['then'](function(_0x4f6ba3){_0x475ca2[_0x46a9('0x45')]=_0x4f6ba3;return _0x475ca2;})[_0x46a9('0x26')](respondWithFilteredResult(_0x57232a,_0x4787c0))[_0x46a9('0x46')](handleError(_0x57232a,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index c2e3234..f9b0d8c 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 _0xa1c0=['util','../../config/logger','moment','bluebird','path','rimraf','./migration.attributes','exports','define','Migration','migrations','lodash'];(function(_0x17a208,_0x5302df){var _0x1f7f67=function(_0x47fe19){while(--_0x47fe19){_0x17a208['push'](_0x17a208['shift']());}};_0x1f7f67(++_0x5302df);}(_0xa1c0,0x77));var _0x0a1c=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xa1c0[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x0a1c('0x0'));var util=require(_0x0a1c('0x1'));var logger=require(_0x0a1c('0x2'))('api');var moment=require(_0x0a1c('0x3'));var BPromise=require(_0x0a1c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a1c('0x5'));var rimraf=require(_0x0a1c('0x6'));var config=require('../../config/environment');var attributes=require(_0x0a1c('0x7'));module[_0x0a1c('0x8')]=function(_0xf83237,_0x13424d){return _0xf83237[_0x0a1c('0x9')](_0x0a1c('0xa'),attributes,{'tableName':_0x0a1c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4ee=['../../config/environment','exports','Migration','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x59109f,_0x3bdddd){var _0x39aca7=function(_0x466214){while(--_0x466214){_0x59109f['push'](_0x59109f['shift']());}};_0x39aca7(++_0x3bdddd);}(_0xf4ee,0xae));var _0xef4e=function(_0x1d298c,_0x34ef0a){_0x1d298c=_0x1d298c-0x0;var _0x4aacee=_0xf4ee[_0x1d298c];return _0x4aacee;};'use strict';var _=require(_0xef4e('0x0'));var util=require(_0xef4e('0x1'));var logger=require(_0xef4e('0x2'))('api');var moment=require('moment');var BPromise=require(_0xef4e('0x3'));var rp=require(_0xef4e('0x4'));var fs=require('fs');var path=require(_0xef4e('0x5'));var rimraf=require('rimraf');var config=require(_0xef4e('0x6'));var attributes=require('./migration.attributes');module[_0xef4e('0x7')]=function(_0x13d7a9,_0x221138){return _0x13d7a9['define'](_0xef4e('0x8'),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 50f912a..c0f4049 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 _0xfc75=['rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','Migration,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x459eaf,_0x2e6a6c){var _0x292ce6=function(_0x4ea1a9){while(--_0x4ea1a9){_0x459eaf['push'](_0x459eaf['shift']());}};_0x292ce6(++_0x2e6a6c);}(_0xfc75,0xe1));var _0x5fc7=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xfc75[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x5fc7('0x0'));var util=require(_0x5fc7('0x1'));var moment=require(_0x5fc7('0x2'));var BPromise=require(_0x5fc7('0x3'));var rs=require(_0x5fc7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5fc7('0x5'));var logger=require('../../config/logger')(_0x5fc7('0x6'));var config=require(_0x5fc7('0x7'));var jayson=require(_0x5fc7('0x8'));var client=jayson[_0x5fc7('0x9')][_0x5fc7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x503eaa,_0x2385ad,_0x56f284){return new BPromise(function(_0x1bb845,_0x4828fd){return client['request'](_0x503eaa,_0x56f284)[_0x5fc7('0xb')](function(_0x5d30b9){logger[_0x5fc7('0xc')]('Migration,\x20%s,\x20%s',_0x2385ad,_0x5fc7('0xd'));logger[_0x5fc7('0xe')](_0x5fc7('0xf'),_0x2385ad,'request\x20sent',JSON[_0x5fc7('0x10')](_0x5d30b9));if(_0x5d30b9[_0x5fc7('0x11')]){if(_0x5d30b9[_0x5fc7('0x11')]['code']===0x1f4){logger[_0x5fc7('0x11')](_0x5fc7('0x12'),_0x2385ad,_0x5d30b9[_0x5fc7('0x11')][_0x5fc7('0x13')]);return _0x4828fd(_0x5d30b9['error']['message']);}logger['error']('Migration,\x20%s,\x20%s',_0x2385ad,_0x5d30b9[_0x5fc7('0x11')][_0x5fc7('0x13')]);return _0x1bb845(_0x5d30b9[_0x5fc7('0x11')][_0x5fc7('0x13')]);}else{logger['info'](_0x5fc7('0x12'),_0x2385ad,_0x5fc7('0xd'));_0x1bb845(_0x5d30b9[_0x5fc7('0x14')][_0x5fc7('0x13')]);}})['catch'](function(_0x188101){logger[_0x5fc7('0x11')]('Migration,\x20%s,\x20%s',_0x2385ad,_0x188101);_0x4828fd(_0x188101);});});} \ No newline at end of file +var _0x2182=['debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Migration,\x20%s,\x20%s','request\x20sent'];(function(_0x8540f9,_0x52f37e){var _0x4ebc02=function(_0x374e7d){while(--_0x374e7d){_0x8540f9['push'](_0x8540f9['shift']());}};_0x4ebc02(++_0x52f37e);}(_0x2182,0xea));var _0x2218=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x2182[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x2218('0x0'));var util=require(_0x2218('0x1'));var moment=require(_0x2218('0x2'));var BPromise=require(_0x2218('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2218('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2218('0x5'));var logger=require(_0x2218('0x6'))(_0x2218('0x7'));var config=require(_0x2218('0x8'));var jayson=require(_0x2218('0x9'));var client=jayson[_0x2218('0xa')][_0x2218('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22eab9,_0x142d1d,_0x29e762){return new BPromise(function(_0x4b3bd1,_0x1197d1){return client[_0x2218('0xc')](_0x22eab9,_0x29e762)[_0x2218('0xd')](function(_0x5bd041){logger['info'](_0x2218('0xe'),_0x142d1d,_0x2218('0xf'));logger[_0x2218('0x10')](_0x2218('0x11'),_0x142d1d,'request\x20sent',JSON[_0x2218('0x12')](_0x5bd041));if(_0x5bd041[_0x2218('0x13')]){if(_0x5bd041[_0x2218('0x13')][_0x2218('0x14')]===0x1f4){logger[_0x2218('0x13')]('Migration,\x20%s,\x20%s',_0x142d1d,_0x5bd041[_0x2218('0x13')]['message']);return _0x1197d1(_0x5bd041[_0x2218('0x13')][_0x2218('0x15')]);}logger[_0x2218('0x13')](_0x2218('0xe'),_0x142d1d,_0x5bd041[_0x2218('0x13')][_0x2218('0x15')]);return _0x4b3bd1(_0x5bd041[_0x2218('0x13')][_0x2218('0x15')]);}else{logger[_0x2218('0x16')](_0x2218('0xe'),_0x142d1d,_0x2218('0xf'));_0x4b3bd1(_0x5bd041[_0x2218('0x17')][_0x2218('0x15')]);}})[_0x2218('0x18')](function(_0x21a612){logger[_0x2218('0x13')](_0x2218('0xe'),_0x142d1d,_0x21a612);_0x1197d1(_0x21a612);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 0f8cdcd..445aeb0 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 _0x4cb5=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','index','isAuthenticated','post','create','put','/:id','exports','multer'];(function(_0x5792a0,_0x315c2b){var _0x3fd1dd=function(_0x2bc094){while(--_0x2bc094){_0x5792a0['push'](_0x5792a0['shift']());}};_0x3fd1dd(++_0x315c2b);}(_0x4cb5,0x8f));var _0x54cb=function(_0x569dac,_0x2dbe47){_0x569dac=_0x569dac-0x0;var _0x3d303a=_0x4cb5[_0x569dac];return _0x3d303a;};'use strict';var multer=require(_0x54cb('0x0'));var util=require(_0x54cb('0x1'));var path=require(_0x54cb('0x2'));var timeout=require(_0x54cb('0x3'));var express=require('express');var router=express[_0x54cb('0x4')]();var fs_extra=require(_0x54cb('0x5'));var auth=require(_0x54cb('0x6'));var interaction=require(_0x54cb('0x7'));var config=require(_0x54cb('0x8'));var controller=require(_0x54cb('0x9'));router[_0x54cb('0xa')]('/',auth['isAuthenticated'](),controller[_0x54cb('0xb')]);router[_0x54cb('0xa')]('/:id',auth[_0x54cb('0xc')](),controller['show']);router[_0x54cb('0xd')]('/',auth[_0x54cb('0xc')](),controller[_0x54cb('0xe')]);router[_0x54cb('0xf')](_0x54cb('0x10'),auth[_0x54cb('0xc')](),controller['update']);router['delete'](_0x54cb('0x10'),auth[_0x54cb('0xc')](),controller['destroy']);module[_0x54cb('0x11')]=router; \ No newline at end of file +var _0x4e83=['fs-extra','get','isAuthenticated','/:id','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x377987,_0x56b904){var _0x55473a=function(_0x1376ff){while(--_0x1376ff){_0x377987['push'](_0x377987['shift']());}};_0x55473a(++_0x56b904);}(_0x4e83,0x1ae));var _0x34e8=function(_0xaca348,_0x4d3993){_0xaca348=_0xaca348-0x0;var _0x560057=_0x4e83[_0xaca348];return _0x560057;};'use strict';var multer=require(_0x34e8('0x0'));var util=require('util');var path=require(_0x34e8('0x1'));var timeout=require(_0x34e8('0x2'));var express=require(_0x34e8('0x3'));var router=express[_0x34e8('0x4')]();var fs_extra=require(_0x34e8('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./network.controller');router[_0x34e8('0x6')]('/',auth[_0x34e8('0x7')](),controller['index']);router[_0x34e8('0x6')](_0x34e8('0x8'),auth[_0x34e8('0x7')](),controller['show']);router[_0x34e8('0x9')]('/',auth[_0x34e8('0x7')](),controller[_0x34e8('0xa')]);router['put'](_0x34e8('0x8'),auth[_0x34e8('0x7')](),controller[_0x34e8('0xb')]);router[_0x34e8('0xc')](_0x34e8('0x8'),auth[_0x34e8('0x7')](),controller[_0x34e8('0xd')]);module[_0x34e8('0xe')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index a8b6c82..2f824b2 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 _0x28fa=['turn','STRING','sequelize','exports','ENUM'];(function(_0x29d1e2,_0x2c3789){var _0xc9f067=function(_0x287503){while(--_0x287503){_0x29d1e2['push'](_0x29d1e2['shift']());}};_0xc9f067(++_0x2c3789);}(_0x28fa,0x1b0));var _0xa28f=function(_0xd58e21,_0x36311f){_0xd58e21=_0xd58e21-0x0;var _0x2c4a40=_0x28fa[_0xd58e21];return _0x2c4a40;};'use strict';var Sequelize=require(_0xa28f('0x0'));module[_0xa28f('0x1')]={'type':{'type':Sequelize[_0xa28f('0x2')]('localnet','externip','stun',_0xa28f('0x3'))},'value':{'type':Sequelize[_0xa28f('0x4')]},'username':{'type':Sequelize[_0xa28f('0x4')]},'password':{'type':Sequelize[_0xa28f('0x4')]}}; \ No newline at end of file +var _0xbcc3=['turn','STRING','sequelize','exports','ENUM','localnet','externip','stun'];(function(_0x448c04,_0x38dd03){var _0x2670d3=function(_0x2ed07b){while(--_0x2ed07b){_0x448c04['push'](_0x448c04['shift']());}};_0x2670d3(++_0x38dd03);}(_0xbcc3,0x1ca));var _0x3bcc=function(_0x55fa03,_0xcb96c2){_0x55fa03=_0x55fa03-0x0;var _0x2cd7cd=_0xbcc3[_0x55fa03];return _0x2cd7cd;};'use strict';var Sequelize=require(_0x3bcc('0x0'));module[_0x3bcc('0x1')]={'type':{'type':Sequelize[_0x3bcc('0x2')](_0x3bcc('0x3'),_0x3bcc('0x4'),_0x3bcc('0x5'),_0x3bcc('0x6'))},'value':{'type':Sequelize[_0x3bcc('0x7')]},'username':{'type':Sequelize[_0x3bcc('0x7')]},'password':{'type':Sequelize[_0x3bcc('0x7')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 0476773..a8c3fef 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 _0x0f24=['error','message','result','catch','status','end','json','limit','undefined','count','offset','set','reject','save','update','destroy','sendStatus','name','send','map','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','options','Network','include','rows','params','length','includeAll','find','create','sequelize','transaction','body','toUpperCase','readFileSync','join','root','server/files/templates/stun_multiple.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','utf8','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','findAll','toLowerCase','chan_sip.so','STUN','format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x27638d,_0x4094db){var _0x35da35=function(_0x538095){while(--_0x538095){_0x27638d['push'](_0x27638d['shift']());}};_0x35da35(++_0x4094db);}(_0x0f24,0xac));var _0x40f2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0f24[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x40f2('0x0'));var zipdir=require(_0x40f2('0x1'));var jsonpatch=require(_0x40f2('0x2'));var rp=require(_0x40f2('0x3'));var moment=require(_0x40f2('0x4'));var BPromise=require(_0x40f2('0x5'));var Mustache=require(_0x40f2('0x6'));var util=require('util');var path=require(_0x40f2('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x40f2('0x8'));var fs=require('fs');var fs_extra=require(_0x40f2('0x9'));var _=require(_0x40f2('0xa'));var squel=require(_0x40f2('0xb'));var crypto=require('crypto');var jsforce=require(_0x40f2('0xc'));var deskjs=require(_0x40f2('0xd'));var toCsv=require(_0x40f2('0xe'));var querystring=require('querystring');var Papa=require(_0x40f2('0xf'));var Redis=require(_0x40f2('0x10'));var authService=require(_0x40f2('0x11'));var qs=require(_0x40f2('0x12'));var as=require(_0x40f2('0x13'));var hardwareService=require(_0x40f2('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x40f2('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x40f2('0x16')][_0x40f2('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x199e10,_0x31b4c1,_0x3163b9,_0x99d4e8){return new BPromise(function(_0x3be6a6,_0x43fcd2){var _0x3d3549=_0x99d4e8||client;return _0x3d3549[_0x40f2('0x18')](_0x199e10,_0x3163b9)[_0x40f2('0x19')](function(_0x104f94){logger[_0x40f2('0x1a')](_0x40f2('0x1b'),_0x31b4c1,_0x40f2('0x1c'));logger[_0x40f2('0x1d')](_0x40f2('0x1e'),_0x31b4c1,'request\x20sent',JSON[_0x40f2('0x1f')](_0x104f94));if(_0x104f94[_0x40f2('0x20')]){if(_0x104f94[_0x40f2('0x20')]['code']===0x1f4){logger[_0x40f2('0x20')](_0x40f2('0x1b'),_0x31b4c1,_0x104f94[_0x40f2('0x20')][_0x40f2('0x21')]);return _0x43fcd2(_0x104f94[_0x40f2('0x20')][_0x40f2('0x21')]);}logger[_0x40f2('0x20')]('Network,\x20%s,\x20%s',_0x31b4c1,_0x104f94[_0x40f2('0x20')][_0x40f2('0x21')]);return _0x3be6a6(_0x104f94['error'][_0x40f2('0x21')]);}else{logger['info']('Network,\x20%s,\x20%s',_0x31b4c1,'request\x20sent');_0x3be6a6(_0x104f94[_0x40f2('0x22')][_0x40f2('0x21')]);}})[_0x40f2('0x23')](function(_0x54418d){logger[_0x40f2('0x20')](_0x40f2('0x1b'),_0x31b4c1,_0x54418d);_0x43fcd2(_0x54418d);});});}function respondWithStatusCode(_0x4357aa,_0x580a72){_0x580a72=_0x580a72||0xcc;return function(_0x4cf8a8){if(_0x4cf8a8){return _0x4357aa['sendStatus'](_0x580a72);}return _0x4357aa[_0x40f2('0x24')](_0x580a72)[_0x40f2('0x25')]();};}function respondWithResult(_0x4aaef0,_0x29522d){_0x29522d=_0x29522d||0xc8;return function(_0x5eb5a3){if(_0x5eb5a3){return _0x4aaef0['status'](_0x29522d)[_0x40f2('0x26')](_0x5eb5a3);}};}function respondWithFilteredResult(_0x1bd2d1,_0x414f2f){return function(_0x41afe9){if(_0x41afe9){var _0x190d47=typeof _0x414f2f['offset']==='undefined'&&typeof _0x414f2f[_0x40f2('0x27')]===_0x40f2('0x28');var _0x54aeac=_0x41afe9[_0x40f2('0x29')];var _0x262d2b=_0x190d47?0x0:_0x414f2f[_0x40f2('0x2a')];var _0x3bd0bc=_0x190d47?_0x41afe9[_0x40f2('0x29')]:_0x414f2f[_0x40f2('0x2a')]+_0x414f2f[_0x40f2('0x27')];var _0x13b357;if(_0x3bd0bc>=_0x54aeac){_0x3bd0bc=_0x54aeac;_0x13b357=0xc8;}else{_0x13b357=0xce;}_0x1bd2d1[_0x40f2('0x24')](_0x13b357);return _0x1bd2d1[_0x40f2('0x2b')]('Content-Range',_0x262d2b+'-'+_0x3bd0bc+'/'+_0x54aeac)[_0x40f2('0x26')](_0x41afe9);}return null;};}function patchUpdates(_0x2aa976){return function(_0x22a6f2){try{jsonpatch['apply'](_0x22a6f2,_0x2aa976,!![]);}catch(_0x9be752){return BPromise[_0x40f2('0x2c')](_0x9be752);}return _0x22a6f2[_0x40f2('0x2d')]();};}function saveUpdates(_0x13d105,_0x1e6937){return function(_0x550f1d){if(_0x550f1d){return _0x550f1d[_0x40f2('0x2e')](_0x13d105)['then'](function(_0x234904){return _0x234904;});}return null;};}function removeEntity(_0xd2aa35,_0x7201ac){return function(_0x1cfc46){if(_0x1cfc46){return _0x1cfc46[_0x40f2('0x2f')]()['then'](function(){_0xd2aa35[_0x40f2('0x24')](0xcc)[_0x40f2('0x25')]();});}};}function handleEntityNotFound(_0x1ea5d9,_0x365660){return function(_0x5f0f20){if(!_0x5f0f20){_0x1ea5d9[_0x40f2('0x30')](0x194);}return _0x5f0f20;};}function handleError(_0xdeb00d,_0x57fd77){_0x57fd77=_0x57fd77||0x1f4;return function(_0x11b9dc){logger[_0x40f2('0x20')](_0x11b9dc['stack']);if(_0x11b9dc[_0x40f2('0x31')]){delete _0x11b9dc[_0x40f2('0x31')];}_0xdeb00d[_0x40f2('0x24')](_0x57fd77)[_0x40f2('0x32')](_0x11b9dc);};}exports['index']=function(_0x58c938,_0x117450){var _0x259acf={},_0x44184f={},_0x39ef59={'count':0x0,'rows':[]};var _0x37e03a=_[_0x40f2('0x33')](db['Network'][_0x40f2('0x34')],function(_0x19e11a){return{'name':_0x19e11a[_0x40f2('0x35')],'type':_0x19e11a[_0x40f2('0x36')]['key']};});_0x44184f['model']=_[_0x40f2('0x33')](_0x37e03a,'name');_0x44184f['query']=_[_0x40f2('0x37')](_0x58c938[_0x40f2('0x38')]);_0x44184f[_0x40f2('0x39')]=_[_0x40f2('0x3a')](_0x44184f[_0x40f2('0x3b')],_0x44184f['query']);_0x259acf[_0x40f2('0x3c')]=_[_0x40f2('0x3a')](_0x44184f[_0x40f2('0x3b')],qs[_0x40f2('0x3d')](_0x58c938[_0x40f2('0x38')][_0x40f2('0x3d')]));_0x259acf[_0x40f2('0x3c')]=_0x259acf[_0x40f2('0x3c')]['length']?_0x259acf[_0x40f2('0x3c')]:_0x44184f[_0x40f2('0x3b')];if(!_0x58c938[_0x40f2('0x38')][_0x40f2('0x3e')](_0x40f2('0x3f'))){_0x259acf[_0x40f2('0x27')]=qs[_0x40f2('0x27')](_0x58c938[_0x40f2('0x38')][_0x40f2('0x27')]);_0x259acf[_0x40f2('0x2a')]=qs[_0x40f2('0x2a')](_0x58c938[_0x40f2('0x38')][_0x40f2('0x2a')]);}_0x259acf[_0x40f2('0x40')]=qs[_0x40f2('0x41')](_0x58c938[_0x40f2('0x38')]['sort']);_0x259acf[_0x40f2('0x42')]=qs[_0x40f2('0x39')](_['pick'](_0x58c938[_0x40f2('0x38')],_0x44184f[_0x40f2('0x39')]),_0x37e03a);if(_0x58c938[_0x40f2('0x38')]['filter']){_0x259acf['where']=_['merge'](_0x259acf[_0x40f2('0x42')],{'$or':_[_0x40f2('0x33')](_0x37e03a,function(_0x29b9ee){if(_0x29b9ee[_0x40f2('0x36')]!==_0x40f2('0x43')){var _0x48daaa={};_0x48daaa[_0x29b9ee['name']]={'$like':'%'+_0x58c938[_0x40f2('0x38')][_0x40f2('0x44')]+'%'};return _0x48daaa;}})});}_0x259acf=_['merge']({},_0x259acf,_0x58c938[_0x40f2('0x45')]);var _0x2d4182={'where':_0x259acf[_0x40f2('0x42')]};return db[_0x40f2('0x46')][_0x40f2('0x29')](_0x2d4182)[_0x40f2('0x19')](function(_0x2c97fb){_0x39ef59['count']=_0x2c97fb;if(_0x58c938[_0x40f2('0x38')]['includeAll']){_0x259acf[_0x40f2('0x47')]=[{'all':!![]}];}return db['Network']['findAll'](_0x259acf);})[_0x40f2('0x19')](function(_0x12a7f3){_0x39ef59[_0x40f2('0x48')]=_0x12a7f3;return _0x39ef59;})[_0x40f2('0x19')](respondWithFilteredResult(_0x117450,_0x259acf))[_0x40f2('0x23')](handleError(_0x117450,null));};exports['show']=function(_0x440b6f,_0x6dc28e){var _0x50d15c={'raw':!![],'where':{'id':_0x440b6f[_0x40f2('0x49')]['id']}},_0x4dd948={};_0x4dd948[_0x40f2('0x3b')]=_[_0x40f2('0x37')](db[_0x40f2('0x46')][_0x40f2('0x34')]);_0x4dd948['query']=_['keys'](_0x440b6f[_0x40f2('0x38')]);_0x4dd948[_0x40f2('0x39')]=_[_0x40f2('0x3a')](_0x4dd948[_0x40f2('0x3b')],_0x4dd948['query']);_0x50d15c['attributes']=_['intersection'](_0x4dd948[_0x40f2('0x3b')],qs[_0x40f2('0x3d')](_0x440b6f[_0x40f2('0x38')][_0x40f2('0x3d')]));_0x50d15c[_0x40f2('0x3c')]=_0x50d15c[_0x40f2('0x3c')][_0x40f2('0x4a')]?_0x50d15c['attributes']:_0x4dd948[_0x40f2('0x3b')];if(_0x440b6f[_0x40f2('0x38')][_0x40f2('0x4b')]){_0x50d15c[_0x40f2('0x47')]=[{'all':!![]}];}_0x50d15c=_['merge']({},_0x50d15c,_0x440b6f['options']);return db[_0x40f2('0x46')][_0x40f2('0x4c')](_0x50d15c)['then'](handleEntityNotFound(_0x6dc28e,null))[_0x40f2('0x19')](respondWithResult(_0x6dc28e,null))[_0x40f2('0x23')](handleError(_0x6dc28e,null));};exports[_0x40f2('0x4d')]=function(_0x566f08,_0x33f267,_0x5e131d){var _0x301e06;return db[_0x40f2('0x4e')][_0x40f2('0x4f')](function(_0x560c4b){return db[_0x40f2('0x46')]['create'](_0x566f08[_0x40f2('0x50')],{'raw':!![]})['then'](function(_0x261eb8){_0x301e06=_0x261eb8;return db[_0x40f2('0x46')]['findAll']({'where':{'type':_0x566f08['body'][_0x40f2('0x36')]},'raw':!![]});})[_0x40f2('0x19')](function(_0x4f7806){if(_0x301e06[_0x40f2('0x36')][_0x40f2('0x51')]()=='STUN'){var _0x2499ca=fs[_0x40f2('0x52')](path[_0x40f2('0x53')](config[_0x40f2('0x54')],_0x40f2('0x55')),'utf8');var _0x50bdd9=ejs[_0x40f2('0x56')](_0x2499ca,{'networks':_0x4f7806||[]});fs[_0x40f2('0x57')](_0x40f2('0x58'),_0x50bdd9);return respondWithRpcPromise(_0x40f2('0x59'),_0x40f2('0x4d'),{'module':_0x40f2('0x5a')});}else if(_0x301e06['type'][_0x40f2('0x51')]()==_0x40f2('0x5b')){var _0x17cb75=fs['readFileSync'](path['join'](config[_0x40f2('0x54')],_0x40f2('0x5c')),_0x40f2('0x5d'));var _0x299b9f=ejs[_0x40f2('0x56')](_0x17cb75,{'networks':_0x4f7806||[]});fs[_0x40f2('0x57')](_0x40f2('0x5e'),_0x299b9f);return respondWithRpcPromise(_0x40f2('0x59'),_0x40f2('0x4d'),{'module':_0x40f2('0x5a')});}else{var _0x312875=fs['readFileSync'](path[_0x40f2('0x53')](config[_0x40f2('0x54')],_0x40f2('0x5f')),_0x40f2('0x5d'));var _0x406b44=ejs['render'](_0x312875,{'networks':_0x4f7806||[]});fs['writeFileSync'](util['format'](_0x40f2('0x60'),_0x566f08[_0x40f2('0x50')][_0x40f2('0x36')]['toLowerCase']()),_0x406b44);return respondWithRpcPromise(_0x40f2('0x59'),_0x40f2('0x4d'),{'module':'chan_sip.so'});}return null;})['then'](function(){return _0x301e06;});})[_0x40f2('0x19')](respondWithResult(_0x33f267,0xc9))[_0x40f2('0x23')](handleError(_0x33f267,null));};exports[_0x40f2('0x2e')]=function(_0x14e68b,_0x175b14,_0x5d8602){var _0x39fbaa;return db['sequelize'][_0x40f2('0x4f')](function(_0x32f497){return db[_0x40f2('0x46')][_0x40f2('0x4c')]({'where':{'id':_0x14e68b[_0x40f2('0x49')]['id']}})[_0x40f2('0x19')](handleEntityNotFound(_0x175b14,null))[_0x40f2('0x19')](saveUpdates(_0x14e68b['body'],null))[_0x40f2('0x19')](function(_0x2a3425){if(_0x2a3425){_0x39fbaa=_0x2a3425;return db[_0x40f2('0x46')][_0x40f2('0x61')]({'where':{'type':_0x39fbaa[_0x40f2('0x36')]},'raw':!![]});}return null;})[_0x40f2('0x19')](function(_0x3b9c0d){if(_0x39fbaa[_0x40f2('0x36')][_0x40f2('0x51')]()=='STUN'){var _0x3c8208=fs[_0x40f2('0x52')](path[_0x40f2('0x53')](config[_0x40f2('0x54')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x3e0be2=ejs['render'](_0x3c8208,{'networks':_0x3b9c0d||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x3e0be2);return respondWithRpcPromise(_0x40f2('0x59'),_0x40f2('0x2e'),{'module':_0x40f2('0x5a')});}else if(_0x39fbaa[_0x40f2('0x36')][_0x40f2('0x51')]()==_0x40f2('0x5b')){var _0x487169=fs['readFileSync'](path[_0x40f2('0x53')](config['root'],_0x40f2('0x5c')),_0x40f2('0x5d'));var _0x30f722=ejs['render'](_0x487169,{'networks':_0x3b9c0d||[]});fs['writeFileSync'](_0x40f2('0x5e'),_0x30f722);return respondWithRpcPromise(_0x40f2('0x59'),_0x40f2('0x2e'),{'module':'res_stun_monitor.so'});}else{var _0x265811=fs[_0x40f2('0x52')](path[_0x40f2('0x53')](config[_0x40f2('0x54')],'server/files/templates/network.ejs'),'utf8');var _0x575a14=ejs[_0x40f2('0x56')](_0x265811,{'networks':_0x3b9c0d||[]});fs[_0x40f2('0x57')](util['format'](_0x40f2('0x60'),_0x14e68b['body'][_0x40f2('0x36')][_0x40f2('0x62')]()),_0x575a14);return respondWithRpcPromise(_0x40f2('0x59'),_0x40f2('0x2e'),{'module':_0x40f2('0x63')});}return null;})[_0x40f2('0x19')](function(_0x26fcc7){if(_0x26fcc7){return _0x39fbaa;}return null;});})[_0x40f2('0x19')](respondWithResult(_0x175b14,null))[_0x40f2('0x23')](handleError(_0x175b14,null));};exports['destroy']=function(_0x576c8e,_0x5c27d2,_0x3c42f4){var _0xfb21a4;return db['Network'][_0x40f2('0x4c')]({'where':{'id':_0x576c8e[_0x40f2('0x49')]['id']}})['then'](function(_0x9a50fa){_0xfb21a4=_0x9a50fa;return _0x9a50fa;})[_0x40f2('0x19')](handleEntityNotFound(_0x5c27d2,null))[_0x40f2('0x19')](removeEntity(_0x5c27d2,null))[_0x40f2('0x19')](function(){if(_0xfb21a4){return db[_0x40f2('0x46')][_0x40f2('0x61')]({'where':{'type':_0xfb21a4[_0x40f2('0x36')]},'raw':!![]});}})[_0x40f2('0x19')](function(_0x3390eb){if(_0xfb21a4[_0x40f2('0x36')]['toUpperCase']()==_0x40f2('0x64')){var _0x4ec5bb=fs[_0x40f2('0x52')](path['join'](config['root'],_0x40f2('0x55')),'utf8');var _0x35f2c1=ejs[_0x40f2('0x56')](_0x4ec5bb,{'networks':_0x3390eb||[]});fs[_0x40f2('0x57')](_0x40f2('0x58'),_0x35f2c1);return respondWithRpcPromise('Reload',_0x40f2('0x2f'),{'module':'res_stun_monitor.so'});}else if(_0xfb21a4[_0x40f2('0x36')][_0x40f2('0x51')]()=='TURN'){var _0x34fb60=fs['readFileSync'](path[_0x40f2('0x53')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x40f2('0x5d'));var _0x10365f=ejs[_0x40f2('0x56')](_0x34fb60,{'networks':_0x3390eb||[]});fs[_0x40f2('0x57')](_0x40f2('0x5e'),_0x10365f);return respondWithRpcPromise('Reload','destroy',{'module':_0x40f2('0x5a')});}else{var _0x42eb73=fs[_0x40f2('0x52')](path[_0x40f2('0x53')](config['root'],_0x40f2('0x5f')),_0x40f2('0x5d'));var _0x587fc7=ejs['render'](_0x42eb73,{'networks':_0x3390eb||[]});fs['writeFileSync'](util[_0x40f2('0x65')](_0x40f2('0x60'),_0x576c8e[_0x40f2('0x50')]['type'][_0x40f2('0x62')]()),_0x587fc7);return respondWithRpcPromise(_0x40f2('0x59'),_0x40f2('0x2f'),{'module':'chan_sip.so'});}return null;})['catch'](handleError(_0x5c27d2,null));}; \ No newline at end of file +var _0xee74=['nolimit','order','sort','where','pick','VIRTUAL','filter','includeAll','rows','show','rawAttributes','keys','include','merge','options','find','create','sequelize','body','STUN','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','readFileSync','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','update','transaction','findAll','params','toLowerCase','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','name','send','index','map','Network','fieldName','type','key','model','query','filters','intersection','attributes','fields','length'];(function(_0x24761a,_0x4fe5bd){var _0x205b4e=function(_0x30da60){while(--_0x30da60){_0x24761a['push'](_0x24761a['shift']());}};_0x205b4e(++_0x4fe5bd);}(_0xee74,0x1eb));var _0x4ee7=function(_0x2928e8,_0x423b1c){_0x2928e8=_0x2928e8-0x0;var _0x1d9aaa=_0xee74[_0x2928e8];return _0x1d9aaa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4ee7('0x0'));var zipdir=require(_0x4ee7('0x1'));var jsonpatch=require(_0x4ee7('0x2'));var rp=require(_0x4ee7('0x3'));var moment=require(_0x4ee7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4ee7('0x5'));var util=require(_0x4ee7('0x6'));var path=require(_0x4ee7('0x7'));var sox=require(_0x4ee7('0x8'));var csv=require('to-csv');var ejs=require(_0x4ee7('0x9'));var fs=require('fs');var fs_extra=require(_0x4ee7('0xa'));var _=require(_0x4ee7('0xb'));var squel=require(_0x4ee7('0xc'));var crypto=require(_0x4ee7('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4ee7('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4ee7('0xf'));var Redis=require(_0x4ee7('0x10'));var authService=require(_0x4ee7('0x11'));var qs=require(_0x4ee7('0x12'));var as=require(_0x4ee7('0x13'));var hardwareService=require(_0x4ee7('0x14'));var logger=require(_0x4ee7('0x15'))(_0x4ee7('0x16'));var utils=require('../../config/utils');var config=require(_0x4ee7('0x17'));var licenseUtil=require(_0x4ee7('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x4ee7('0x19'));var client=jayson[_0x4ee7('0x1a')][_0x4ee7('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x328dd2,_0x5f02d3,_0x5cff0b,_0x4682c0){return new BPromise(function(_0x244e3d,_0x3544d0){var _0x8865d0=_0x4682c0||client;return _0x8865d0[_0x4ee7('0x1c')](_0x328dd2,_0x5cff0b)[_0x4ee7('0x1d')](function(_0x1fa756){logger[_0x4ee7('0x1e')](_0x4ee7('0x1f'),_0x5f02d3,'request\x20sent');logger[_0x4ee7('0x20')](_0x4ee7('0x21'),_0x5f02d3,'request\x20sent',JSON[_0x4ee7('0x22')](_0x1fa756));if(_0x1fa756[_0x4ee7('0x23')]){if(_0x1fa756[_0x4ee7('0x23')][_0x4ee7('0x24')]===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0x5f02d3,_0x1fa756[_0x4ee7('0x23')][_0x4ee7('0x25')]);return _0x3544d0(_0x1fa756[_0x4ee7('0x23')]['message']);}logger[_0x4ee7('0x23')](_0x4ee7('0x1f'),_0x5f02d3,_0x1fa756[_0x4ee7('0x23')][_0x4ee7('0x25')]);return _0x244e3d(_0x1fa756[_0x4ee7('0x23')][_0x4ee7('0x25')]);}else{logger[_0x4ee7('0x1e')]('Network,\x20%s,\x20%s',_0x5f02d3,_0x4ee7('0x26'));_0x244e3d(_0x1fa756[_0x4ee7('0x27')][_0x4ee7('0x25')]);}})[_0x4ee7('0x28')](function(_0x191750){logger[_0x4ee7('0x23')](_0x4ee7('0x1f'),_0x5f02d3,_0x191750);_0x3544d0(_0x191750);});});}function respondWithStatusCode(_0x5d504d,_0x56afeb){_0x56afeb=_0x56afeb||0xcc;return function(_0x3bfcf6){if(_0x3bfcf6){return _0x5d504d[_0x4ee7('0x29')](_0x56afeb);}return _0x5d504d[_0x4ee7('0x2a')](_0x56afeb)[_0x4ee7('0x2b')]();};}function respondWithResult(_0x17a67b,_0x28de8f){_0x28de8f=_0x28de8f||0xc8;return function(_0x4b0fab){if(_0x4b0fab){return _0x17a67b[_0x4ee7('0x2a')](_0x28de8f)[_0x4ee7('0x2c')](_0x4b0fab);}};}function respondWithFilteredResult(_0x2a72bf,_0x20b34c){return function(_0x1bbb57){if(_0x1bbb57){var _0x3bdf95=typeof _0x20b34c['offset']===_0x4ee7('0x2d')&&typeof _0x20b34c[_0x4ee7('0x2e')]===_0x4ee7('0x2d');var _0x1db158=_0x1bbb57[_0x4ee7('0x2f')];var _0xe9658a=_0x3bdf95?0x0:_0x20b34c['offset'];var _0x2767f0=_0x3bdf95?_0x1bbb57['count']:_0x20b34c[_0x4ee7('0x30')]+_0x20b34c['limit'];var _0x393457;if(_0x2767f0>=_0x1db158){_0x2767f0=_0x1db158;_0x393457=0xc8;}else{_0x393457=0xce;}_0x2a72bf[_0x4ee7('0x2a')](_0x393457);return _0x2a72bf['set'](_0x4ee7('0x31'),_0xe9658a+'-'+_0x2767f0+'/'+_0x1db158)['json'](_0x1bbb57);}return null;};}function patchUpdates(_0x54c73d){return function(_0xdd1b63){try{jsonpatch[_0x4ee7('0x32')](_0xdd1b63,_0x54c73d,!![]);}catch(_0x1fcf45){return BPromise[_0x4ee7('0x33')](_0x1fcf45);}return _0xdd1b63[_0x4ee7('0x34')]();};}function saveUpdates(_0x5e5d5b,_0x3e13f6){return function(_0x15289d){if(_0x15289d){return _0x15289d['update'](_0x5e5d5b)[_0x4ee7('0x1d')](function(_0x3c7f29){return _0x3c7f29;});}return null;};}function removeEntity(_0x596d6b,_0x27c548){return function(_0x2115df){if(_0x2115df){return _0x2115df[_0x4ee7('0x35')]()[_0x4ee7('0x1d')](function(){_0x596d6b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x43c0ab,_0x5da127){return function(_0x5d0ebf){if(!_0x5d0ebf){_0x43c0ab['sendStatus'](0x194);}return _0x5d0ebf;};}function handleError(_0x190276,_0x721404){_0x721404=_0x721404||0x1f4;return function(_0x39a80f){logger[_0x4ee7('0x23')](_0x39a80f['stack']);if(_0x39a80f[_0x4ee7('0x36')]){delete _0x39a80f[_0x4ee7('0x36')];}_0x190276[_0x4ee7('0x2a')](_0x721404)[_0x4ee7('0x37')](_0x39a80f);};}exports[_0x4ee7('0x38')]=function(_0x3e66e3,_0x34774b){var _0x39d606={},_0x196180={},_0x408568={'count':0x0,'rows':[]};var _0x301315=_[_0x4ee7('0x39')](db[_0x4ee7('0x3a')]['rawAttributes'],function(_0xd9c657){return{'name':_0xd9c657[_0x4ee7('0x3b')],'type':_0xd9c657[_0x4ee7('0x3c')][_0x4ee7('0x3d')]};});_0x196180[_0x4ee7('0x3e')]=_[_0x4ee7('0x39')](_0x301315,_0x4ee7('0x36'));_0x196180[_0x4ee7('0x3f')]=_['keys'](_0x3e66e3[_0x4ee7('0x3f')]);_0x196180[_0x4ee7('0x40')]=_[_0x4ee7('0x41')](_0x196180['model'],_0x196180[_0x4ee7('0x3f')]);_0x39d606[_0x4ee7('0x42')]=_[_0x4ee7('0x41')](_0x196180[_0x4ee7('0x3e')],qs[_0x4ee7('0x43')](_0x3e66e3['query'][_0x4ee7('0x43')]));_0x39d606[_0x4ee7('0x42')]=_0x39d606[_0x4ee7('0x42')][_0x4ee7('0x44')]?_0x39d606[_0x4ee7('0x42')]:_0x196180['model'];if(!_0x3e66e3[_0x4ee7('0x3f')]['hasOwnProperty'](_0x4ee7('0x45'))){_0x39d606[_0x4ee7('0x2e')]=qs[_0x4ee7('0x2e')](_0x3e66e3[_0x4ee7('0x3f')]['limit']);_0x39d606['offset']=qs['offset'](_0x3e66e3[_0x4ee7('0x3f')]['offset']);}_0x39d606[_0x4ee7('0x46')]=qs[_0x4ee7('0x47')](_0x3e66e3[_0x4ee7('0x3f')]['sort']);_0x39d606[_0x4ee7('0x48')]=qs[_0x4ee7('0x40')](_[_0x4ee7('0x49')](_0x3e66e3['query'],_0x196180['filters']),_0x301315);if(_0x3e66e3[_0x4ee7('0x3f')]['filter']){_0x39d606[_0x4ee7('0x48')]=_['merge'](_0x39d606[_0x4ee7('0x48')],{'$or':_[_0x4ee7('0x39')](_0x301315,function(_0x46cfb8){if(_0x46cfb8[_0x4ee7('0x3c')]!==_0x4ee7('0x4a')){var _0x54170f={};_0x54170f[_0x46cfb8[_0x4ee7('0x36')]]={'$like':'%'+_0x3e66e3['query'][_0x4ee7('0x4b')]+'%'};return _0x54170f;}})});}_0x39d606=_['merge']({},_0x39d606,_0x3e66e3['options']);var _0x2daeaf={'where':_0x39d606[_0x4ee7('0x48')]};return db['Network'][_0x4ee7('0x2f')](_0x2daeaf)[_0x4ee7('0x1d')](function(_0x4d3411){_0x408568[_0x4ee7('0x2f')]=_0x4d3411;if(_0x3e66e3[_0x4ee7('0x3f')][_0x4ee7('0x4c')]){_0x39d606['include']=[{'all':!![]}];}return db[_0x4ee7('0x3a')]['findAll'](_0x39d606);})['then'](function(_0x1f4f93){_0x408568[_0x4ee7('0x4d')]=_0x1f4f93;return _0x408568;})[_0x4ee7('0x1d')](respondWithFilteredResult(_0x34774b,_0x39d606))[_0x4ee7('0x28')](handleError(_0x34774b,null));};exports[_0x4ee7('0x4e')]=function(_0x515ff4,_0x36369f){var _0x98dcfb={'raw':!![],'where':{'id':_0x515ff4['params']['id']}},_0x205f72={};_0x205f72[_0x4ee7('0x3e')]=_['keys'](db['Network'][_0x4ee7('0x4f')]);_0x205f72['query']=_[_0x4ee7('0x50')](_0x515ff4[_0x4ee7('0x3f')]);_0x205f72[_0x4ee7('0x40')]=_[_0x4ee7('0x41')](_0x205f72[_0x4ee7('0x3e')],_0x205f72[_0x4ee7('0x3f')]);_0x98dcfb[_0x4ee7('0x42')]=_['intersection'](_0x205f72[_0x4ee7('0x3e')],qs[_0x4ee7('0x43')](_0x515ff4[_0x4ee7('0x3f')][_0x4ee7('0x43')]));_0x98dcfb['attributes']=_0x98dcfb[_0x4ee7('0x42')][_0x4ee7('0x44')]?_0x98dcfb[_0x4ee7('0x42')]:_0x205f72[_0x4ee7('0x3e')];if(_0x515ff4['query'][_0x4ee7('0x4c')]){_0x98dcfb[_0x4ee7('0x51')]=[{'all':!![]}];}_0x98dcfb=_[_0x4ee7('0x52')]({},_0x98dcfb,_0x515ff4[_0x4ee7('0x53')]);return db[_0x4ee7('0x3a')][_0x4ee7('0x54')](_0x98dcfb)[_0x4ee7('0x1d')](handleEntityNotFound(_0x36369f,null))['then'](respondWithResult(_0x36369f,null))[_0x4ee7('0x28')](handleError(_0x36369f,null));};exports[_0x4ee7('0x55')]=function(_0x2773d0,_0x52741f,_0x6ef2e){var _0x1608cc;return db[_0x4ee7('0x56')]['transaction'](function(_0x3ac99d){return db[_0x4ee7('0x3a')][_0x4ee7('0x55')](_0x2773d0[_0x4ee7('0x57')],{'raw':!![]})['then'](function(_0x5a9b88){_0x1608cc=_0x5a9b88;return db[_0x4ee7('0x3a')]['findAll']({'where':{'type':_0x2773d0['body']['type']},'raw':!![]});})[_0x4ee7('0x1d')](function(_0xc1dab5){if(_0x1608cc['type']['toUpperCase']()==_0x4ee7('0x58')){var _0x30df69=fs['readFileSync'](path[_0x4ee7('0x59')](config[_0x4ee7('0x5a')],_0x4ee7('0x5b')),_0x4ee7('0x5c'));var _0x1f9a62=ejs[_0x4ee7('0x5d')](_0x30df69,{'networks':_0xc1dab5||[]});fs[_0x4ee7('0x5e')](_0x4ee7('0x5f'),_0x1f9a62);return respondWithRpcPromise(_0x4ee7('0x60'),_0x4ee7('0x55'),{'module':_0x4ee7('0x61')});}else if(_0x1608cc[_0x4ee7('0x3c')][_0x4ee7('0x62')]()==_0x4ee7('0x63')){var _0x2d1848=fs['readFileSync'](path[_0x4ee7('0x59')](config['root'],_0x4ee7('0x64')),_0x4ee7('0x5c'));var _0x3cdcd4=ejs[_0x4ee7('0x5d')](_0x2d1848,{'networks':_0xc1dab5||[]});fs[_0x4ee7('0x5e')](_0x4ee7('0x65'),_0x3cdcd4);return respondWithRpcPromise('Reload','create',{'module':'res_stun_monitor.so'});}else{var _0x431ddf=fs[_0x4ee7('0x66')](path[_0x4ee7('0x59')](config[_0x4ee7('0x5a')],_0x4ee7('0x67')),_0x4ee7('0x5c'));var _0x3e8bd4=ejs[_0x4ee7('0x5d')](_0x431ddf,{'networks':_0xc1dab5||[]});fs[_0x4ee7('0x5e')](util[_0x4ee7('0x68')](_0x4ee7('0x69'),_0x2773d0[_0x4ee7('0x57')][_0x4ee7('0x3c')]['toLowerCase']()),_0x3e8bd4);return respondWithRpcPromise('Reload','create',{'module':_0x4ee7('0x6a')});}return null;})['then'](function(){return _0x1608cc;});})[_0x4ee7('0x1d')](respondWithResult(_0x52741f,0xc9))[_0x4ee7('0x28')](handleError(_0x52741f,null));};exports[_0x4ee7('0x6b')]=function(_0x45694e,_0x5cef03,_0x39b8ec){var _0x175859;return db[_0x4ee7('0x56')][_0x4ee7('0x6c')](function(_0x298f08){return db[_0x4ee7('0x3a')]['find']({'where':{'id':_0x45694e['params']['id']}})[_0x4ee7('0x1d')](handleEntityNotFound(_0x5cef03,null))[_0x4ee7('0x1d')](saveUpdates(_0x45694e['body'],null))[_0x4ee7('0x1d')](function(_0x335bee){if(_0x335bee){_0x175859=_0x335bee;return db[_0x4ee7('0x3a')][_0x4ee7('0x6d')]({'where':{'type':_0x175859['type']},'raw':!![]});}return null;})[_0x4ee7('0x1d')](function(_0x5d0bf2){if(_0x175859[_0x4ee7('0x3c')]['toUpperCase']()==_0x4ee7('0x58')){var _0x585f5f=fs[_0x4ee7('0x66')](path['join'](config[_0x4ee7('0x5a')],_0x4ee7('0x5b')),_0x4ee7('0x5c'));var _0x3a92b7=ejs[_0x4ee7('0x5d')](_0x585f5f,{'networks':_0x5d0bf2||[]});fs[_0x4ee7('0x5e')](_0x4ee7('0x5f'),_0x3a92b7);return respondWithRpcPromise(_0x4ee7('0x60'),'update',{'module':'res_stun_monitor.so'});}else if(_0x175859[_0x4ee7('0x3c')]['toUpperCase']()==_0x4ee7('0x63')){var _0x10bb17=fs[_0x4ee7('0x66')](path[_0x4ee7('0x59')](config[_0x4ee7('0x5a')],_0x4ee7('0x64')),_0x4ee7('0x5c'));var _0x371e89=ejs[_0x4ee7('0x5d')](_0x10bb17,{'networks':_0x5d0bf2||[]});fs['writeFileSync'](_0x4ee7('0x65'),_0x371e89);return respondWithRpcPromise('Reload',_0x4ee7('0x6b'),{'module':'res_stun_monitor.so'});}else{var _0x4c28cc=fs[_0x4ee7('0x66')](path[_0x4ee7('0x59')](config[_0x4ee7('0x5a')],_0x4ee7('0x67')),_0x4ee7('0x5c'));var _0x2c6d69=ejs[_0x4ee7('0x5d')](_0x4c28cc,{'networks':_0x5d0bf2||[]});fs[_0x4ee7('0x5e')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x45694e[_0x4ee7('0x57')][_0x4ee7('0x3c')]['toLowerCase']()),_0x2c6d69);return respondWithRpcPromise(_0x4ee7('0x60'),'update',{'module':_0x4ee7('0x6a')});}return null;})[_0x4ee7('0x1d')](function(_0x199fde){if(_0x199fde){return _0x175859;}return null;});})[_0x4ee7('0x1d')](respondWithResult(_0x5cef03,null))[_0x4ee7('0x28')](handleError(_0x5cef03,null));};exports[_0x4ee7('0x35')]=function(_0x588b1e,_0x5354a5,_0x467a66){var _0x3e64a3;return db[_0x4ee7('0x3a')][_0x4ee7('0x54')]({'where':{'id':_0x588b1e[_0x4ee7('0x6e')]['id']}})[_0x4ee7('0x1d')](function(_0x2b0469){_0x3e64a3=_0x2b0469;return _0x2b0469;})[_0x4ee7('0x1d')](handleEntityNotFound(_0x5354a5,null))[_0x4ee7('0x1d')](removeEntity(_0x5354a5,null))[_0x4ee7('0x1d')](function(){if(_0x3e64a3){return db[_0x4ee7('0x3a')]['findAll']({'where':{'type':_0x3e64a3[_0x4ee7('0x3c')]},'raw':!![]});}})['then'](function(_0x1bd291){if(_0x3e64a3[_0x4ee7('0x3c')][_0x4ee7('0x62')]()=='STUN'){var _0x86ce63=fs[_0x4ee7('0x66')](path[_0x4ee7('0x59')](config['root'],_0x4ee7('0x5b')),'utf8');var _0x39f11f=ejs[_0x4ee7('0x5d')](_0x86ce63,{'networks':_0x1bd291||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x39f11f);return respondWithRpcPromise('Reload',_0x4ee7('0x35'),{'module':_0x4ee7('0x61')});}else if(_0x3e64a3[_0x4ee7('0x3c')][_0x4ee7('0x62')]()=='TURN'){var _0x4402de=fs[_0x4ee7('0x66')](path[_0x4ee7('0x59')](config[_0x4ee7('0x5a')],_0x4ee7('0x64')),_0x4ee7('0x5c'));var _0x46f47f=ejs[_0x4ee7('0x5d')](_0x4402de,{'networks':_0x1bd291||[]});fs[_0x4ee7('0x5e')]('/etc/asterisk/turn_xcally.conf',_0x46f47f);return respondWithRpcPromise(_0x4ee7('0x60'),_0x4ee7('0x35'),{'module':'res_stun_monitor.so'});}else{var _0x3285e3=fs[_0x4ee7('0x66')](path[_0x4ee7('0x59')](config[_0x4ee7('0x5a')],'server/files/templates/network.ejs'),_0x4ee7('0x5c'));var _0x52af76=ejs[_0x4ee7('0x5d')](_0x3285e3,{'networks':_0x1bd291||[]});fs[_0x4ee7('0x5e')](util['format'](_0x4ee7('0x69'),_0x588b1e[_0x4ee7('0x57')]['type'][_0x4ee7('0x6f')]()),_0x52af76);return respondWithRpcPromise('Reload','destroy',{'module':_0x4ee7('0x6a')});}return null;})[_0x4ee7('0x28')](handleError(_0x5354a5,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index cc3ac44..b58d7f6 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 _0xbc9d=['./network.attributes','exports','define','network','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x14c195,_0x59d195){var _0x17a689=function(_0x2d83ad){while(--_0x2d83ad){_0x14c195['push'](_0x14c195['shift']());}};_0x17a689(++_0x59d195);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x36479c,_0x2af234){_0x36479c=_0x36479c-0x0;var _0x5dafd7=_0xbc9d[_0x36479c];return _0x5dafd7;};'use strict';var _=require(_0xdbc9('0x0'));var util=require(_0xdbc9('0x1'));var logger=require(_0xdbc9('0x2'))(_0xdbc9('0x3'));var moment=require(_0xdbc9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdbc9('0x5'));var config=require(_0xdbc9('0x6'));var attributes=require(_0xdbc9('0x7'));module[_0xdbc9('0x8')]=function(_0x6ab397,_0x7c4c55){return _0x6ab397[_0xdbc9('0x9')]('Network',attributes,{'tableName':_0xdbc9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9aea=['Network','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./network.attributes','exports','define'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x9aea,0xdd));var _0xa9ae=function(_0x5005f9,_0x55999c){_0x5005f9=_0x5005f9-0x0;var _0x79cef3=_0x9aea[_0x5005f9];return _0x79cef3;};'use strict';var _=require(_0xa9ae('0x0'));var util=require('util');var logger=require(_0xa9ae('0x1'))('api');var moment=require(_0xa9ae('0x2'));var BPromise=require(_0xa9ae('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa9ae('0x4'));var rimraf=require(_0xa9ae('0x5'));var config=require(_0xa9ae('0x6'));var attributes=require(_0xa9ae('0x7'));module[_0xa9ae('0x8')]=function(_0x56f942,_0x1aa3b9){return _0x56f942[_0xa9ae('0x9')](_0xa9ae('0xa'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 5dd757c..7e2d80f 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(_0x4332d8,_0x1cfc41){var _0x2cd728=function(_0x1c178a){while(--_0x1c178a){_0x4332d8['push'](_0x4332d8['shift']());}};_0x2cd728(++_0x1cfc41);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x4f05f9,_0x25caa1){_0x4f05f9=_0x4f05f9-0x0;var _0x2dfef8=_0x7a54[_0x4f05f9];return _0x2dfef8;};'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 7fef85f..b40f00d 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 _0x490d=['/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','post','create','/:id/notify','notify','/:id/users','/:id/send','put','update','delete','removeAnswers','removeAgents','exports','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe'];(function(_0x435408,_0x1de146){var _0x6cb836=function(_0x587868){while(--_0x587868){_0x435408['push'](_0x435408['shift']());}};_0x6cb836(++_0x1de146);}(_0x490d,0x135));var _0xd490=function(_0x364530,_0xa1ec23){_0x364530=_0x364530-0x0;var _0x16a232=_0x490d[_0x364530];return _0x16a232;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd490('0x0'));var timeout=require('connect-timeout');var express=require(_0xd490('0x1'));var router=express[_0xd490('0x2')]();var fs_extra=require(_0xd490('0x3'));var auth=require(_0xd490('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd490('0x5'));var controller=require(_0xd490('0x6'));router[_0xd490('0x7')]('/',auth[_0xd490('0x8')](),controller[_0xd490('0x9')]);router['get'](_0xd490('0xa'),auth[_0xd490('0x8')](),controller['describe']);router[_0xd490('0x7')](_0xd490('0xb'),auth['isAuthenticated'](),controller[_0xd490('0xc')]);router[_0xd490('0x7')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xd490('0xd')]);router['get'](_0xd490('0xe'),auth['isAuthenticated'](),controller[_0xd490('0xf')]);router[_0xd490('0x7')](_0xd490('0x10'),auth[_0xd490('0x8')](),controller[_0xd490('0x11')]);router[_0xd490('0x7')](_0xd490('0x12'),auth[_0xd490('0x8')](),controller[_0xd490('0x13')]);router[_0xd490('0x7')]('/:id/users',auth[_0xd490('0x8')](),controller['getAgents']);router[_0xd490('0x14')]('/',auth[_0xd490('0x8')](),controller[_0xd490('0x15')]);router[_0xd490('0x14')]('/:id/dispositions',auth[_0xd490('0x8')](),controller['addDisposition']);router[_0xd490('0x14')](_0xd490('0xe'),auth[_0xd490('0x8')](),controller['addAnswer']);router['post'](_0xd490('0x16'),controller[_0xd490('0x17')]);router['post'](_0xd490('0x10'),auth[_0xd490('0x8')](),controller['addApplications']);router[_0xd490('0x14')](_0xd490('0x18'),auth[_0xd490('0x8')](),controller['addAgents']);router[_0xd490('0x14')](_0xd490('0x19'),auth[_0xd490('0x8')](),controller['send']);router[_0xd490('0x1a')](_0xd490('0xb'),auth[_0xd490('0x8')](),controller[_0xd490('0x1b')]);router[_0xd490('0x1c')](_0xd490('0xb'),auth[_0xd490('0x8')](),controller['destroy']);router[_0xd490('0x1c')]('/:id/dispositions',auth[_0xd490('0x8')](),controller['removeDispositions']);router[_0xd490('0x1c')](_0xd490('0xe'),auth[_0xd490('0x8')](),controller[_0xd490('0x1d')]);router[_0xd490('0x1c')]('/:id/users',auth[_0xd490('0x8')](),controller[_0xd490('0x1e')]);module[_0xd490('0x1f')]=router; \ No newline at end of file +var _0xc2f4=['addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','/:id','delete','destroy','removeAnswers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','/:id/users','getAgents','create','post'];(function(_0x5218c9,_0x15197c){var _0x4ac883=function(_0x2f18b3){while(--_0x2f18b3){_0x5218c9['push'](_0x5218c9['shift']());}};_0x4ac883(++_0x15197c);}(_0xc2f4,0x1bd));var _0x4c2f=function(_0xab2865,_0x32e71e){_0xab2865=_0xab2865-0x0;var _0x31f344=_0xc2f4[_0xab2865];return _0x31f344;};'use strict';var multer=require(_0x4c2f('0x0'));var util=require(_0x4c2f('0x1'));var path=require(_0x4c2f('0x2'));var timeout=require(_0x4c2f('0x3'));var express=require(_0x4c2f('0x4'));var router=express[_0x4c2f('0x5')]();var fs_extra=require(_0x4c2f('0x6'));var auth=require(_0x4c2f('0x7'));var interaction=require(_0x4c2f('0x8'));var config=require(_0x4c2f('0x9'));var controller=require('./openchannelAccount.controller');router[_0x4c2f('0xa')]('/',auth[_0x4c2f('0xb')](),controller['index']);router[_0x4c2f('0xa')](_0x4c2f('0xc'),auth[_0x4c2f('0xb')](),controller['describe']);router[_0x4c2f('0xa')]('/:id',auth[_0x4c2f('0xb')](),controller['show']);router[_0x4c2f('0xa')](_0x4c2f('0xd'),auth['isAuthenticated'](),controller[_0x4c2f('0xe')]);router[_0x4c2f('0xa')](_0x4c2f('0xf'),auth['isAuthenticated'](),controller[_0x4c2f('0x10')]);router[_0x4c2f('0xa')]('/:id/applications',auth[_0x4c2f('0xb')](),controller[_0x4c2f('0x11')]);router[_0x4c2f('0xa')](_0x4c2f('0x12'),auth[_0x4c2f('0xb')](),controller['getInteractions']);router['get'](_0x4c2f('0x13'),auth[_0x4c2f('0xb')](),controller[_0x4c2f('0x14')]);router['post']('/',auth[_0x4c2f('0xb')](),controller[_0x4c2f('0x15')]);router[_0x4c2f('0x16')](_0x4c2f('0xd'),auth[_0x4c2f('0xb')](),controller['addDisposition']);router['post'](_0x4c2f('0xf'),auth[_0x4c2f('0xb')](),controller[_0x4c2f('0x17')]);router[_0x4c2f('0x16')](_0x4c2f('0x18'),controller[_0x4c2f('0x19')]);router[_0x4c2f('0x16')]('/:id/applications',auth[_0x4c2f('0xb')](),controller[_0x4c2f('0x1a')]);router[_0x4c2f('0x16')](_0x4c2f('0x13'),auth['isAuthenticated'](),controller[_0x4c2f('0x1b')]);router['post'](_0x4c2f('0x1c'),auth[_0x4c2f('0xb')](),controller[_0x4c2f('0x1d')]);router[_0x4c2f('0x1e')](_0x4c2f('0x1f'),auth[_0x4c2f('0xb')](),controller['update']);router[_0x4c2f('0x20')]('/:id',auth[_0x4c2f('0xb')](),controller[_0x4c2f('0x21')]);router[_0x4c2f('0x20')](_0x4c2f('0xd'),auth[_0x4c2f('0xb')](),controller['removeDispositions']);router[_0x4c2f('0x20')](_0x4c2f('0xf'),auth[_0x4c2f('0xb')](),controller[_0x4c2f('0x22')]);router[_0x4c2f('0x20')](_0x4c2f('0x13'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x4c2f('0x23')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index d378bbd..c01d9bc 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 _0x6fa7=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','name','STRING','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x452985,_0x1ca4af){var _0x115294=function(_0x38a74d){while(--_0x38a74d){_0x452985['push'](_0x452985['shift']());}};_0x115294(++_0x1ca4af);}(_0x6fa7,0xca));var _0x76fa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6fa7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x76fa('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x76fa('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x76fa('0x2')]},'token':{'type':Sequelize[_0x76fa('0x2')],'defaultValue':function(){return rs[_0x76fa('0x3')]();}},'replyUri':{'type':Sequelize[_0x76fa('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x76fa('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x76fa('0x4');}},'notificationSound':{'type':Sequelize[_0x76fa('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x76fa('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x76fa('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x76fa('0x2')]},'queueTransfer':{'type':Sequelize[_0x76fa('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x76fa('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x76fa('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x76fa('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x76fa('0x5')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x27a110){if(!_0x27a110)this[_0x76fa('0x8')](_0x76fa('0x9'),null);this[_0x76fa('0x8')](_0x76fa('0xa'),_0x27a110);}}}; \ No newline at end of file +var _0xa41d=['STRING','generate','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','sequelize','randomstring','name'];(function(_0x2b9ff0,_0x1d7744){var _0x222cc1=function(_0x2312c9){while(--_0x2312c9){_0x2b9ff0['push'](_0x2b9ff0['shift']());}};_0x222cc1(++_0x1d7744);}(_0xa41d,0x115));var _0xda41=function(_0x10c015,_0x314a5f){_0x10c015=_0x10c015-0x0;var _0x41ebf2=_0xa41d[_0x10c015];return _0x41ebf2;};'use strict';var Sequelize=require(_0xda41('0x0'));var rs=require(_0xda41('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xda41('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xda41('0x3')],'defaultValue':function(){return rs[_0xda41('0x4')]();}},'replyUri':{'type':Sequelize[_0xda41('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'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[_0xda41('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xda41('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xda41('0x3')]},'queueTransfer':{'type':Sequelize[_0xda41('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xda41('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xda41('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xda41('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xda41('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xda41('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x127956){if(!_0x127956)this[_0xda41('0x8')]('mandatoryDispositionPauseId',null);this[_0xda41('0x8')](_0xda41('0x9'),_0x127956);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 967d625..3ece610 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 _0x84ed=['fullname','Tag','Tags','color','tag','rows','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','jayson/promise','client','http','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','OpenchannelAccounts','UserProfileResource','name','send','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','length','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','addDisposition','OpenchannelAccountId','getDispositions','findOne','Disposition','removeDispositions','CannedAnswer','pick','removeAnswers','ids','openchannel','CmContact','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','CmList','Contacts','DESC','OpenchannelApplication','Applications','List','account','list','orderBy','applications','priority','asc','defaults','contact','lastName','threadId','OpenchannelInteraction','externalUrl','spread','firstName','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','forcedOwnership','Start','startRouting','EventManager','notify','addApplications','sequelize','transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','stack','finally','getApplications','getInteractions','Owner'];(function(_0x2cc7ec,_0x258398){var _0x5bccae=function(_0x133c8a){while(--_0x133c8a){_0x2cc7ec['push'](_0x2cc7ec['shift']());}};_0x5bccae(++_0x258398);}(_0x84ed,0xca));var _0xd84e=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x84ed[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0xd84e('0x0'));var rimraf=require(_0xd84e('0x1'));var zipdir=require(_0xd84e('0x2'));var jsonpatch=require(_0xd84e('0x3'));var rp=require(_0xd84e('0x4'));var moment=require(_0xd84e('0x5'));var BPromise=require(_0xd84e('0x6'));var Mustache=require('mustache');var util=require(_0xd84e('0x7'));var path=require('path');var sox=require(_0xd84e('0x8'));var csv=require(_0xd84e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd84e('0xa'));var _=require(_0xd84e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd84e('0xc'));var toCsv=require(_0xd84e('0x9'));var querystring=require(_0xd84e('0xd'));var Papa=require('papaparse');var Redis=require(_0xd84e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd84e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd84e('0x10'))(_0xd84e('0x11'));var utils=require('../../config/utils');var config=require(_0xd84e('0x12'));var licenseUtil=require(_0xd84e('0x13'));var db=require(_0xd84e('0x14'))['db'];config[_0xd84e('0x15')]=_['defaults'](config[_0xd84e('0x15')],{'host':_0xd84e('0x16'),'port':0x18eb});var socket=require(_0xd84e('0x17'))(new Redis(config[_0xd84e('0x15')]));require(_0xd84e('0x18'))['register'](socket);var jayson=require(_0xd84e('0x19'));var client=jayson[_0xd84e('0x1a')][_0xd84e('0x1b')]({'port':0x232c});var client9002=jayson['client'][_0xd84e('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3397c0,_0xe5f59c,_0x544458,_0xbb6a3a){return new BPromise(function(_0x3fc312,_0x3408cf){var _0x4c4e44=_0xbb6a3a||client;return _0x4c4e44['request'](_0x3397c0,_0x544458)[_0xd84e('0x1c')](function(_0x4dd3e4){logger[_0xd84e('0x1d')](_0xd84e('0x1e'),_0xe5f59c,_0xd84e('0x1f'));logger[_0xd84e('0x20')](_0xd84e('0x21'),_0xe5f59c,_0xd84e('0x1f'),JSON[_0xd84e('0x22')](_0x4dd3e4));if(_0x4dd3e4['error']){if(_0x4dd3e4[_0xd84e('0x23')][_0xd84e('0x24')]===0x1f4){logger['error'](_0xd84e('0x1e'),_0xe5f59c,_0x4dd3e4['error'][_0xd84e('0x25')]);return _0x3408cf(_0x4dd3e4['error']['message']);}logger[_0xd84e('0x23')](_0xd84e('0x1e'),_0xe5f59c,_0x4dd3e4[_0xd84e('0x23')][_0xd84e('0x25')]);return _0x3fc312(_0x4dd3e4['error'][_0xd84e('0x25')]);}else{logger[_0xd84e('0x1d')]('OpenchannelAccount,\x20%s,\x20%s',_0xe5f59c,_0xd84e('0x1f'));_0x3fc312(_0x4dd3e4[_0xd84e('0x26')][_0xd84e('0x25')]);}})[_0xd84e('0x27')](function(_0x37bbc4){logger[_0xd84e('0x23')](_0xd84e('0x1e'),_0xe5f59c,_0x37bbc4);_0x3408cf(_0x37bbc4);});});}function respondWithStatusCode(_0x1c5698,_0x456ae7){_0x456ae7=_0x456ae7||0xcc;return function(_0x7b9acd){if(_0x7b9acd){return _0x1c5698[_0xd84e('0x28')](_0x456ae7);}return _0x1c5698['status'](_0x456ae7)[_0xd84e('0x29')]();};}function respondWithResult(_0x59d6bb,_0xd2ffb6){_0xd2ffb6=_0xd2ffb6||0xc8;return function(_0x28da76){if(_0x28da76){return _0x59d6bb[_0xd84e('0x2a')](_0xd2ffb6)[_0xd84e('0x2b')](_0x28da76);}};}function respondWithFilteredResult(_0x289d3d,_0x52d948){return function(_0x5ea4a0){if(_0x5ea4a0){var _0x1433ac=typeof _0x52d948[_0xd84e('0x2c')]===_0xd84e('0x2d')&&typeof _0x52d948[_0xd84e('0x2e')]===_0xd84e('0x2d');var _0x42b83c=_0x5ea4a0['count'];var _0x34da10=_0x1433ac?0x0:_0x52d948['offset'];var _0x482ec0=_0x1433ac?_0x5ea4a0[_0xd84e('0x2f')]:_0x52d948[_0xd84e('0x2c')]+_0x52d948[_0xd84e('0x2e')];var _0x252327;if(_0x482ec0>=_0x42b83c){_0x482ec0=_0x42b83c;_0x252327=0xc8;}else{_0x252327=0xce;}_0x289d3d[_0xd84e('0x2a')](_0x252327);return _0x289d3d[_0xd84e('0x30')](_0xd84e('0x31'),_0x34da10+'-'+_0x482ec0+'/'+_0x42b83c)[_0xd84e('0x2b')](_0x5ea4a0);}return null;};}function patchUpdates(_0x355da2){return function(_0x21f540){try{jsonpatch['apply'](_0x21f540,_0x355da2,!![]);}catch(_0x267ae8){return BPromise[_0xd84e('0x32')](_0x267ae8);}return _0x21f540[_0xd84e('0x33')]();};}function saveUpdates(_0x355b3d,_0x170363){return function(_0x293c03){if(_0x293c03){return _0x293c03[_0xd84e('0x34')](_0x355b3d)[_0xd84e('0x1c')](function(_0x47c877){return _0x47c877;});}return null;};}function removeEntity(_0x1e18b2,_0x2aeec2){return function(_0x4f682b){if(_0x4f682b){return _0x4f682b[_0xd84e('0x35')]()['then'](function(){var _0x180510=_0x4f682b['get']({'plain':!![]});var _0x583445=_0xd84e('0x36');return db[_0xd84e('0x37')]['destroy']({'where':{'type':_0x583445,'resourceId':_0x180510['id']}})[_0xd84e('0x1c')](function(){return _0x4f682b;});})[_0xd84e('0x1c')](function(){_0x1e18b2[_0xd84e('0x2a')](0xcc)[_0xd84e('0x29')]();});}};}function handleEntityNotFound(_0x1dfa03,_0x4a48fe){return function(_0x291b69){if(!_0x291b69){_0x1dfa03['sendStatus'](0x194);}return _0x291b69;};}function handleError(_0x29f7a6,_0x337fb9){_0x337fb9=_0x337fb9||0x1f4;return function(_0x5efb2d){logger[_0xd84e('0x23')](_0x5efb2d['stack']);if(_0x5efb2d['name']){delete _0x5efb2d[_0xd84e('0x38')];}_0x29f7a6[_0xd84e('0x2a')](_0x337fb9)[_0xd84e('0x39')](_0x5efb2d);};}exports['index']=function(_0xa8978e,_0x268d84){var _0x3bfba9={'include':[{'model':db['Pause'],'as':_0xd84e('0x3a')}]},_0x1ee4bd={},_0x3bbffc={'count':0x0,'rows':[]};var _0x3879be=_[_0xd84e('0x3b')](db[_0xd84e('0x3c')][_0xd84e('0x3d')],function(_0xc5685a){return{'name':_0xc5685a[_0xd84e('0x3e')],'type':_0xc5685a[_0xd84e('0x3f')]['key']};});_0x1ee4bd[_0xd84e('0x40')]=_[_0xd84e('0x3b')](_0x3879be,_0xd84e('0x38'));_0x1ee4bd[_0xd84e('0x41')]=_[_0xd84e('0x42')](_0xa8978e['query']);_0x1ee4bd['filters']=_['intersection'](_0x1ee4bd[_0xd84e('0x40')],_0x1ee4bd[_0xd84e('0x41')]);_0x3bfba9[_0xd84e('0x43')]=_[_0xd84e('0x44')](_0x1ee4bd[_0xd84e('0x40')],qs[_0xd84e('0x45')](_0xa8978e['query']['fields']));_0x3bfba9['attributes']=_0x3bfba9[_0xd84e('0x43')]['length']?_0x3bfba9['attributes']:_0x1ee4bd['model'];if(!_0xa8978e[_0xd84e('0x41')][_0xd84e('0x46')](_0xd84e('0x47'))){_0x3bfba9['limit']=qs['limit'](_0xa8978e['query'][_0xd84e('0x2e')]);_0x3bfba9[_0xd84e('0x2c')]=qs[_0xd84e('0x2c')](_0xa8978e[_0xd84e('0x41')][_0xd84e('0x2c')]);}_0x3bfba9[_0xd84e('0x48')]=qs[_0xd84e('0x49')](_0xa8978e[_0xd84e('0x41')][_0xd84e('0x49')]);_0x3bfba9[_0xd84e('0x4a')]=qs[_0xd84e('0x4b')](_['pick'](_0xa8978e[_0xd84e('0x41')],_0x1ee4bd[_0xd84e('0x4b')]),_0x3879be);if(_0xa8978e[_0xd84e('0x41')][_0xd84e('0x4c')]){_0x3bfba9[_0xd84e('0x4a')]=_[_0xd84e('0x4d')](_0x3bfba9['where'],{'$or':_[_0xd84e('0x3b')](_0x3879be,function(_0x2513f3){if(_0x2513f3[_0xd84e('0x3f')]!==_0xd84e('0x4e')){var _0x3b0ee8={};_0x3b0ee8[_0x2513f3[_0xd84e('0x38')]]={'$like':'%'+_0xa8978e[_0xd84e('0x41')][_0xd84e('0x4c')]+'%'};return _0x3b0ee8;}})});}_0x3bfba9=_[_0xd84e('0x4d')]({},_0x3bfba9,_0xa8978e[_0xd84e('0x4f')]);var _0x2bab59={'where':_0x3bfba9['where']};return db[_0xd84e('0x3c')][_0xd84e('0x2f')](_0x2bab59)[_0xd84e('0x1c')](function(_0x270f61){_0x3bbffc['count']=_0x270f61;if(_0xa8978e['query'][_0xd84e('0x50')]){_0x3bfba9[_0xd84e('0x51')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0xd84e('0x52')](_0x3bfba9);})[_0xd84e('0x1c')](function(_0x4ec1ca){_0x3bbffc['rows']=_0x4ec1ca;return _0x3bbffc;})[_0xd84e('0x1c')](respondWithFilteredResult(_0x268d84,_0x3bfba9))['catch'](handleError(_0x268d84,null));};exports[_0xd84e('0x53')]=function(_0x235ae3,_0x1f9c34){var _0x4a0187={'raw':![],'where':{'id':_0x235ae3[_0xd84e('0x54')]['id']},'include':[{'model':db['Pause'],'as':_0xd84e('0x3a')}]},_0x439b9c={};_0x439b9c[_0xd84e('0x40')]=_['keys'](db[_0xd84e('0x3c')][_0xd84e('0x3d')]);_0x439b9c['query']=_[_0xd84e('0x42')](_0x235ae3[_0xd84e('0x41')]);_0x439b9c[_0xd84e('0x4b')]=_[_0xd84e('0x44')](_0x439b9c[_0xd84e('0x40')],_0x439b9c[_0xd84e('0x41')]);_0x4a0187[_0xd84e('0x43')]=_[_0xd84e('0x44')](_0x439b9c[_0xd84e('0x40')],qs[_0xd84e('0x45')](_0x235ae3['query']['fields']));_0x4a0187[_0xd84e('0x43')]=_0x4a0187[_0xd84e('0x43')][_0xd84e('0x55')]?_0x4a0187[_0xd84e('0x43')]:_0x439b9c['model'];if(_0x235ae3[_0xd84e('0x41')][_0xd84e('0x50')]){_0x4a0187['include']=[{'all':!![]}];}_0x4a0187=_['merge']({},_0x4a0187,_0x235ae3[_0xd84e('0x4f')]);return db[_0xd84e('0x3c')][_0xd84e('0x56')](_0x4a0187)[_0xd84e('0x1c')](handleEntityNotFound(_0x1f9c34,null))[_0xd84e('0x1c')](respondWithResult(_0x1f9c34,null))[_0xd84e('0x27')](handleError(_0x1f9c34,null));};exports['create']=function(_0x13237f,_0x28614d){return db[_0xd84e('0x3c')][_0xd84e('0x57')](_0x13237f[_0xd84e('0x58')],{})[_0xd84e('0x1c')](function(_0x1792d4){var _0x2f2a28=_0x13237f[_0xd84e('0x59')][_0xd84e('0x5a')]({'plain':!![]});if(!_0x2f2a28)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f2a28[_0xd84e('0x5b')]===_0xd84e('0x59')){var _0x5b6933=_0x1792d4[_0xd84e('0x5a')]({'plain':!![]});var _0x4bd081='OpenchannelAccounts';return db[_0xd84e('0x5c')][_0xd84e('0x56')]({'where':{'name':_0x4bd081,'userProfileId':_0x2f2a28[_0xd84e('0x5d')]},'raw':!![]})[_0xd84e('0x1c')](function(_0x1565ff){if(_0x1565ff&&_0x1565ff[_0xd84e('0x5e')]===0x0){return db[_0xd84e('0x37')][_0xd84e('0x57')]({'name':_0x5b6933[_0xd84e('0x38')],'resourceId':_0x5b6933['id'],'type':_0x1565ff[_0xd84e('0x38')],'sectionId':_0x1565ff['id']},{})['then'](function(){return _0x1792d4;});}else{return _0x1792d4;}})[_0xd84e('0x27')](function(_0x31bf35){logger[_0xd84e('0x23')](_0xd84e('0x5f'),_0x31bf35);throw _0x31bf35;});}return _0x1792d4;})['then'](respondWithResult(_0x28614d,0xc9))[_0xd84e('0x27')](handleError(_0x28614d,null));};exports[_0xd84e('0x34')]=function(_0x1ec09e,_0x2cbfda){if(_0x1ec09e[_0xd84e('0x58')]['id']){delete _0x1ec09e['body']['id'];}return db['OpenchannelAccount'][_0xd84e('0x56')]({'where':{'id':_0x1ec09e['params']['id']},'include':[{'model':db[_0xd84e('0x60')],'as':_0xd84e('0x3a')}]})[_0xd84e('0x1c')](handleEntityNotFound(_0x2cbfda,null))[_0xd84e('0x1c')](saveUpdates(_0x1ec09e['body'],null))['then'](respondWithResult(_0x2cbfda,null))[_0xd84e('0x27')](handleError(_0x2cbfda,null));};exports['destroy']=function(_0x13e99c,_0x355a3b){return db[_0xd84e('0x3c')][_0xd84e('0x56')]({'where':{'id':_0x13e99c['params']['id']}})[_0xd84e('0x1c')](handleEntityNotFound(_0x355a3b,null))['then'](removeEntity(_0x355a3b,null))[_0xd84e('0x27')](handleError(_0x355a3b,null));};exports[_0xd84e('0x61')]=function(_0x1d7fc6,_0x644107){return db[_0xd84e('0x3c')][_0xd84e('0x61')]()[_0xd84e('0x1c')](respondWithResult(_0x644107,null))[_0xd84e('0x27')](handleError(_0x644107,null));};exports[_0xd84e('0x62')]=function(_0x3f38b1,_0xadfe24,_0x274854){if(_0x3f38b1['body']['id']){delete _0x3f38b1[_0xd84e('0x58')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x3f38b1['params']['id']}})['then'](handleEntityNotFound(_0xadfe24,null))[_0xd84e('0x1c')](function(_0x457a6c){if(_0x457a6c){_0x3f38b1[_0xd84e('0x58')][_0xd84e('0x63')]=_0x457a6c['id'];return db['Disposition']['create'](_0x3f38b1[_0xd84e('0x58')]);}})[_0xd84e('0x1c')](respondWithResult(_0xadfe24,null))[_0xd84e('0x27')](handleError(_0xadfe24,null));};exports[_0xd84e('0x64')]=function(_0x5564d4,_0x15d98a,_0x468c26){var _0x2eebab={'raw':![],'where':{}};var _0x2f8eab={};var _0x16c425={'count':0x0,'rows':[]};return db[_0xd84e('0x3c')][_0xd84e('0x65')]({'where':{'id':_0x5564d4[_0xd84e('0x54')]['id']}})['then'](handleEntityNotFound(_0x15d98a,null))[_0xd84e('0x1c')](function(_0x11f473){if(_0x11f473){_0x2f8eab['model']=_[_0xd84e('0x42')](db[_0xd84e('0x66')]['rawAttributes']);_0x2f8eab[_0xd84e('0x41')]=_['keys'](_0x5564d4[_0xd84e('0x41')]);_0x2f8eab[_0xd84e('0x4b')]=_[_0xd84e('0x44')](_0x2f8eab[_0xd84e('0x40')],_0x2f8eab[_0xd84e('0x41')]);_0x2eebab[_0xd84e('0x43')]=_[_0xd84e('0x44')](_0x2f8eab[_0xd84e('0x40')],qs['fields'](_0x5564d4[_0xd84e('0x41')][_0xd84e('0x45')]));_0x2eebab[_0xd84e('0x43')]=_0x2eebab[_0xd84e('0x43')][_0xd84e('0x55')]?_0x2eebab[_0xd84e('0x43')]:_0x2f8eab[_0xd84e('0x40')];if(!_0x5564d4[_0xd84e('0x41')][_0xd84e('0x46')](_0xd84e('0x47'))){_0x2eebab[_0xd84e('0x2e')]=qs[_0xd84e('0x2e')](_0x5564d4['query'][_0xd84e('0x2e')]);_0x2eebab['offset']=qs[_0xd84e('0x2c')](_0x5564d4[_0xd84e('0x41')][_0xd84e('0x2c')]);}_0x2eebab['order']=qs['sort'](_0x5564d4[_0xd84e('0x41')][_0xd84e('0x49')]);_0x2eebab[_0xd84e('0x4a')]=qs[_0xd84e('0x4b')](_['pick'](_0x5564d4['query'],_0x2f8eab[_0xd84e('0x4b')]));_0x2eebab[_0xd84e('0x4a')][_0xd84e('0x63')]=_0x11f473['id'];if(_0x5564d4[_0xd84e('0x41')][_0xd84e('0x4c')]){_0x2eebab['where']=_[_0xd84e('0x4d')](_0x2eebab[_0xd84e('0x4a')],{'$or':_[_0xd84e('0x3b')](_0x2eebab[_0xd84e('0x43')],function(_0x174ee3){var _0x3ca820={};_0x3ca820[_0x174ee3]={'$like':'%'+_0x5564d4[_0xd84e('0x41')][_0xd84e('0x4c')]+'%'};return _0x3ca820;})});}_0x2eebab=_[_0xd84e('0x4d')]({},_0x2eebab,_0x5564d4[_0xd84e('0x4f')]);return db['Disposition'][_0xd84e('0x2f')]({'where':_0x2eebab[_0xd84e('0x4a')]})[_0xd84e('0x1c')](function(_0x5db2af){_0x16c425[_0xd84e('0x2f')]=_0x5db2af;if(_0x5564d4[_0xd84e('0x41')][_0xd84e('0x50')]){_0x2eebab[_0xd84e('0x51')]=[{'all':!![]}];}return db[_0xd84e('0x66')][_0xd84e('0x52')](_0x2eebab);})['then'](function(_0x353ec7){_0x16c425['rows']=_0x353ec7;return _0x16c425;});}})[_0xd84e('0x1c')](respondWithFilteredResult(_0x15d98a,_0x2eebab))[_0xd84e('0x27')](handleError(_0x15d98a,null));};exports[_0xd84e('0x67')]=function(_0x3d6f12,_0x3fa577,_0x39ef15){return db[_0xd84e('0x3c')][_0xd84e('0x56')]({'where':{'id':_0x3d6f12[_0xd84e('0x54')]['id']}})[_0xd84e('0x1c')](handleEntityNotFound(_0x3fa577,null))['then'](function(_0x235d53){if(_0x235d53){return _0x235d53[_0xd84e('0x67')](_0x3d6f12[_0xd84e('0x41')]['ids']);}})[_0xd84e('0x1c')](respondWithStatusCode(_0x3fa577,null))[_0xd84e('0x27')](handleError(_0x3fa577,null));};exports['addAnswer']=function(_0x477350,_0x2af33c,_0x47bd1d){if(_0x477350['body']['id']){delete _0x477350['body']['id'];}return db[_0xd84e('0x3c')][_0xd84e('0x56')]({'where':{'id':_0x477350[_0xd84e('0x54')]['id']}})['then'](handleEntityNotFound(_0x2af33c,null))[_0xd84e('0x1c')](function(_0x24d4b4){if(_0x24d4b4){_0x477350[_0xd84e('0x58')]['OpenchannelAccountId']=_0x24d4b4['id'];return db[_0xd84e('0x68')][_0xd84e('0x57')](_0x477350[_0xd84e('0x58')]);}})[_0xd84e('0x1c')](respondWithResult(_0x2af33c,null))[_0xd84e('0x27')](handleError(_0x2af33c,null));};exports['getAnswers']=function(_0x3e4a21,_0x505977,_0x4e7ede){var _0x1a54f6={'raw':![],'where':{}};var _0x18376e={};var _0x10b76e={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x3e4a21[_0xd84e('0x54')]['id']}})[_0xd84e('0x1c')](handleEntityNotFound(_0x505977,null))[_0xd84e('0x1c')](function(_0x264763){if(_0x264763){_0x18376e['model']=_[_0xd84e('0x42')](db[_0xd84e('0x68')]['rawAttributes']);_0x18376e[_0xd84e('0x41')]=_['keys'](_0x3e4a21[_0xd84e('0x41')]);_0x18376e['filters']=_[_0xd84e('0x44')](_0x18376e[_0xd84e('0x40')],_0x18376e[_0xd84e('0x41')]);_0x1a54f6[_0xd84e('0x43')]=_[_0xd84e('0x44')](_0x18376e['model'],qs['fields'](_0x3e4a21[_0xd84e('0x41')][_0xd84e('0x45')]));_0x1a54f6[_0xd84e('0x43')]=_0x1a54f6[_0xd84e('0x43')][_0xd84e('0x55')]?_0x1a54f6['attributes']:_0x18376e['model'];if(!_0x3e4a21[_0xd84e('0x41')]['hasOwnProperty']('nolimit')){_0x1a54f6['limit']=qs['limit'](_0x3e4a21[_0xd84e('0x41')][_0xd84e('0x2e')]);_0x1a54f6['offset']=qs['offset'](_0x3e4a21[_0xd84e('0x41')][_0xd84e('0x2c')]);}_0x1a54f6['order']=qs[_0xd84e('0x49')](_0x3e4a21['query'][_0xd84e('0x49')]);_0x1a54f6[_0xd84e('0x4a')]=qs[_0xd84e('0x4b')](_[_0xd84e('0x69')](_0x3e4a21[_0xd84e('0x41')],_0x18376e[_0xd84e('0x4b')]));_0x1a54f6[_0xd84e('0x4a')]['OpenchannelAccountId']=_0x264763['id'];if(_0x3e4a21[_0xd84e('0x41')][_0xd84e('0x4c')]){_0x1a54f6['where']=_['merge'](_0x1a54f6['where'],{'$or':_[_0xd84e('0x3b')](_0x1a54f6[_0xd84e('0x43')],function(_0x492ec3){var _0x5b2ec5={};_0x5b2ec5[_0x492ec3]={'$like':'%'+_0x3e4a21[_0xd84e('0x41')][_0xd84e('0x4c')]+'%'};return _0x5b2ec5;})});}_0x1a54f6=_[_0xd84e('0x4d')]({},_0x1a54f6,_0x3e4a21['options']);return db[_0xd84e('0x68')][_0xd84e('0x2f')]({'where':_0x1a54f6['where']})[_0xd84e('0x1c')](function(_0x254614){_0x10b76e[_0xd84e('0x2f')]=_0x254614;if(_0x3e4a21[_0xd84e('0x41')][_0xd84e('0x50')]){_0x1a54f6['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xd84e('0x52')](_0x1a54f6);})['then'](function(_0x1d2b90){_0x10b76e['rows']=_0x1d2b90;return _0x10b76e;});}})[_0xd84e('0x1c')](respondWithFilteredResult(_0x505977,_0x1a54f6))['catch'](handleError(_0x505977,null));};exports['removeAnswers']=function(_0x410c82,_0x8252b5,_0x1da2d8){return db[_0xd84e('0x3c')][_0xd84e('0x56')]({'where':{'id':_0x410c82[_0xd84e('0x54')]['id']}})[_0xd84e('0x1c')](handleEntityNotFound(_0x8252b5,null))[_0xd84e('0x1c')](function(_0x4ce594){if(_0x4ce594){return _0x4ce594[_0xd84e('0x6a')](_0x410c82[_0xd84e('0x41')][_0xd84e('0x6b')]);}})[_0xd84e('0x1c')](respondWithStatusCode(_0x8252b5,null))['catch'](handleError(_0x8252b5,null));};exports['notify']=function(_0x5cad91,_0x14e23c,_0x2520bf){var _0x34b177={'body':_0x5cad91[_0xd84e('0x58')],'channel':_0xd84e('0x6c')};var _0x28bd60=[];var _0xfbe30b=[];var _0x2aa69e={};var _0x1ed08a=![];return db[_0xd84e('0x6d')][_0xd84e('0x61')]()[_0xd84e('0x1c')](function(_0x3c10a1){if(!_0x3c10a1){throw new db['Sequelize'][(_0xd84e('0x6e'))]('no\x20available\x20attributes');}_0x28bd60=_[_0xd84e('0x6f')](_[_0xd84e('0x42')](_0x3c10a1),[_0xd84e('0x70'),'updatedAt']);_0xfbe30b=_[_0xd84e('0x6f')](_[_0xd84e('0x42')](_0x3c10a1),[_0xd84e('0x70'),_0xd84e('0x71'),_0xd84e('0x72'),_0xd84e('0x73')]);if(_0x5cad91[_0xd84e('0x58')]['id']){delete _0x5cad91[_0xd84e('0x58')]['id'];}if(_[_0xd84e('0x74')](_0x5cad91[_0xd84e('0x58')][_0xd84e('0x75')])){throw new db[(_0xd84e('0x76'))]['ValidationError'](_0xd84e('0x77'));}if(_[_0xd84e('0x74')](_0x5cad91[_0xd84e('0x58')]['body'])||_0x5cad91['body'][_0xd84e('0x58')]===''){throw new db[(_0xd84e('0x76'))][(_0xd84e('0x6e'))](_0xd84e('0x78'));}if(_['isNil'](_0x5cad91[_0xd84e('0x58')][_0xd84e('0x79')])){throw new db['Sequelize'][(_0xd84e('0x6e'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xfbe30b);}if(!_['includes'](_0xfbe30b,_0x5cad91[_0xd84e('0x58')]['mapKey'])){throw new db[(_0xd84e('0x76'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xfbe30b);}_0x2aa69e[_0x5cad91['body'][_0xd84e('0x79')]]=_0x5cad91['body'][_0xd84e('0x75')];})[_0xd84e('0x1c')](function(){return db[_0xd84e('0x3c')][_0xd84e('0x56')]({'where':{'id':_0x5cad91[_0xd84e('0x54')]['id']},'include':[{'model':db[_0xd84e('0x7a')],'as':'List','include':[{'model':db[_0xd84e('0x6d')],'as':_0xd84e('0x7b'),'where':_0x2aa69e,'limit':0x1,'order':[['updatedAt',_0xd84e('0x7c')]]}]},{'model':db[_0xd84e('0x7d')],'as':_0xd84e('0x7e')}]});})[_0xd84e('0x1c')](handleEntityNotFound(_0x14e23c,null))[_0xd84e('0x1c')](function(_0xa87f70){if(_0xa87f70&&_0xa87f70[_0xd84e('0x7f')]){_0x34b177[_0xd84e('0x80')]=_0xa87f70;_0x34b177['applications']=_0xa87f70['Applications'];_0x34b177[_0xd84e('0x81')]=_0xa87f70[_0xd84e('0x7f')];_0x34b177['applications']=_[_0xd84e('0x82')](_0x34b177[_0xd84e('0x83')],[_0xd84e('0x84')],[_0xd84e('0x85')]);if(_0x34b177[_0xd84e('0x80')][_0xd84e('0x7e')]){delete _0x34b177[_0xd84e('0x80')][_0xd84e('0x7e')];}if(_0x34b177[_0xd84e('0x80')]['List']&&_0x34b177[_0xd84e('0x80')][_0xd84e('0x7f')][_0xd84e('0x7b')]['length']){return _0x34b177[_0xd84e('0x80')][_0xd84e('0x7f')]['Contacts'][0x0];}var _0x39492f=_[_0xd84e('0x86')](_0x5cad91['body'],{'firstName':_0x5cad91[_0xd84e('0x58')][_0xd84e('0x75')],'ListId':_0xa87f70['ListId']});_0x39492f[_0x5cad91['body']['mapKey']]=_0x5cad91['body'][_0xd84e('0x75')];return db['CmContact'][_0xd84e('0x57')](_0x39492f,{'fields':_0x28bd60,'raw':!![]});}})[_0xd84e('0x1c')](handleEntityNotFound(_0x14e23c,null))[_0xd84e('0x1c')](function(_0x548f0e){_0x34b177[_0xd84e('0x87')]=_0x548f0e;if(_0x548f0e){var _0x22714f={'ContactId':_0x548f0e['id'],'OpenchannelAccountId':_0x5cad91[_0xd84e('0x54')]['id'],'from':(_0x548f0e['firstName']||'')+'\x20'+(_0x548f0e[_0xd84e('0x88')]||'')};var _0x59e6e3={'OpenchannelAccountId':_0x5cad91['params']['id'],'closed':![]};if(_0x5cad91[_0xd84e('0x58')][_0xd84e('0x89')]){_0x59e6e3['threadId']=_0x5cad91[_0xd84e('0x58')][_0xd84e('0x89')];return db[_0xd84e('0x8a')][_0xd84e('0x56')]({'where':_0x59e6e3})['then'](function(_0x551f8e){if(_0x551f8e){return[_0x551f8e,![]];}_0x22714f['threadId']=_0x5cad91[_0xd84e('0x58')][_0xd84e('0x89')];_0x22714f['externalUrl']=_0x5cad91[_0xd84e('0x58')][_0xd84e('0x8b')];return db[_0xd84e('0x8a')][_0xd84e('0x57')](_0x22714f)[_0xd84e('0x1c')](function(_0x37148d){return[_0x37148d,!![]];});});}else{_0x59e6e3['threadId']=null;}_0x59e6e3['ContactId']=_0x548f0e['id'];return db[_0xd84e('0x8a')][_0xd84e('0x56')]({'where':_0x59e6e3})[_0xd84e('0x1c')](function(_0x36df6b){if(_0x36df6b){return[_0x36df6b,![]];}return db[_0xd84e('0x8a')][_0xd84e('0x57')](_0x22714f)[_0xd84e('0x1c')](function(_0xbf591c){return[_0xbf591c,!![]];});});}})[_0xd84e('0x8c')](function(_0xde6cb2,_0x5c6daa){if(_0xde6cb2){_0x1ed08a=_0x5c6daa;if(!_0x5c6daa){var _0x3410db={'from':(_0x34b177[_0xd84e('0x87')][_0xd84e('0x8d')]||'')+'\x20'+(_0x34b177[_0xd84e('0x87')][_0xd84e('0x88')]||'')};if(_0x5cad91[_0xd84e('0x58')][_0xd84e('0x89')]&&_0x5cad91['body'][_0xd84e('0x8e')]&&_0x5cad91[_0xd84e('0x58')][_0xd84e('0x89')]!=_0x5cad91[_0xd84e('0x58')][_0xd84e('0x8e')]){_0x3410db[_0xd84e('0x89')]=_0x5cad91[_0xd84e('0x58')][_0xd84e('0x8e')];}return _0xde6cb2[_0xd84e('0x34')](_0x3410db);}else{return _0xde6cb2;}}})[_0xd84e('0x1c')](function(_0x1fee45){_0x34b177[_0xd84e('0x8f')]=_0x1fee45[_0xd84e('0x5a')]({'plain':!![]});_0x34b177[_0xd84e('0x8f')][_0xd84e('0x90')]=_0x1ed08a;if(_0x34b177[_0xd84e('0x8f')]['created']){if(_0x34b177[_0xd84e('0x80')][_0xd84e('0x91')]){_0x34b177[_0xd84e('0x83')][_0xd84e('0x92')]({'id':0x0,'priority':_0x34b177[_0xd84e('0x83')][_0xd84e('0x55')]+0x1,'app':_0xd84e('0x93'),'appdata':_0xd84e('0x94'),'interval':_0xd84e('0x95')});}}return db[_0xd84e('0x96')][_0xd84e('0x57')]({'body':_0x5cad91[_0xd84e('0x58')]['body'],'OpenchannelAccountId':_0x5cad91[_0xd84e('0x54')]['id'],'OpenchannelInteractionId':_0x1fee45['id'],'direction':'in','ContactId':_0x34b177[_0xd84e('0x87')]['id'],'AttachmentId':_0x5cad91[_0xd84e('0x58')][_0xd84e('0x97')]});})[_0xd84e('0x1c')](function(_0xbf2275){_0x34b177[_0xd84e('0x25')]=_0xbf2275;if(_0x34b177['interaction'][_0xd84e('0x98')]){return db[_0xd84e('0x99')][_0xd84e('0x56')]({'attributes':['id','name'],'where':{'id':_0x34b177[_0xd84e('0x8f')][_0xd84e('0x98')]}})[_0xd84e('0x1c')](function(_0x1aa469){if(_0x1aa469){_0x34b177[_0xd84e('0x83')][_0xd84e('0x9a')]({'id':0x0,'priority':0x0,'app':_0xd84e('0x9b'),'appdata':_0x1aa469[_0xd84e('0x38')]+','+(_0x34b177[_0xd84e('0x80')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x34b177[_0xd84e('0x9c')]=![];}return respondWithRpcPromise(_0xd84e('0x9d'),'startRouting',_0x34b177);});}return respondWithRpcPromise(_0xd84e('0x9d'),_0xd84e('0x9e'),_0x34b177);})[_0xd84e('0x1c')](function(_0x329f14){respondWithRpcPromise(_0xd84e('0x9f'),_0xd84e('0x9f'),{'event':_0xd84e('0xa0'),'message':_0x329f14},client9002);return _0x329f14;})[_0xd84e('0x1c')](respondWithResult(_0x14e23c,null))[_0xd84e('0x27')](handleError(_0x14e23c,null));};exports[_0xd84e('0xa1')]=function(_0x5e075d,_0x108921){var _0x2fcd63=_0x5e075d[_0xd84e('0x54')]['id'];var _0x167c7b=_0x5e075d[_0xd84e('0x58')];var _0x49b223=0xc8;var _0x51cea7=null;return db[_0xd84e('0xa2')][_0xd84e('0xa3')]({'isolationLevel':db['sequelize']['Transaction'][_0xd84e('0xa4')]['READ_COMMITTED']},function(_0x5ee6ed){return db['OpenchannelAccount']['findOne']({'where':{'id':_0x2fcd63},'transaction':_0x5ee6ed})['then'](function(_0x159987){if(_0x159987){return db[_0xd84e('0x7d')][_0xd84e('0x35')]({'where':{'OpenchannelAccountId':_0x2fcd63},'transaction':_0x5ee6ed})[_0xd84e('0x1c')](function(){var _0x2099f4=_[_0xd84e('0x3b')](_0x167c7b,function(_0x2ddabe){_0x2ddabe['OpenchannelAccountId']=_0x2fcd63;return _0x2ddabe;});return db[_0xd84e('0x7d')][_0xd84e('0xa5')](_0x2099f4,{'transaction':_0x5ee6ed});});}else{_0x49b223=0x194;_0x51cea7=[];}});})[_0xd84e('0x1c')](function(){if(_0x49b223!==0x194){return db[_0xd84e('0x7d')][_0xd84e('0xa6')]({'where':{'OpenchannelAccountId':_0x2fcd63},'order':'priority'})['then'](function(_0x75f9de){_0x51cea7=_0x75f9de;});}})['catch'](function(_0x311aa8){_0x49b223=0x1f4;logger[_0xd84e('0x23')](_0x311aa8[_0xd84e('0xa7')]);if(_0x311aa8[_0xd84e('0x38')]){delete _0x311aa8[_0xd84e('0x38')];}_0x51cea7=_0x311aa8;})[_0xd84e('0xa8')](function(){if(_0x51cea7===null){_0x108921['sendStatus'](_0x49b223);}else{if(_0x49b223===0x1f4){_0x108921[_0xd84e('0x2a')](_0x49b223)['send'](_0x51cea7);}else{_0x108921[_0xd84e('0x2a')](_0x49b223)[_0xd84e('0x2b')](_0x51cea7);}}});};exports['getApplications']=function(_0x53d8ac,_0x186655,_0x4abf65){var _0x2d389e={};var _0x2f3b38={};var _0x57d095;var _0x47f047;return db[_0xd84e('0x3c')][_0xd84e('0x65')]({'where':{'id':_0x53d8ac[_0xd84e('0x54')]['id']}})[_0xd84e('0x1c')](handleEntityNotFound(_0x186655,null))[_0xd84e('0x1c')](function(_0x285a8a){if(_0x285a8a){_0x57d095=_0x285a8a;_0x2f3b38['model']=_[_0xd84e('0x42')](db[_0xd84e('0x7d')][_0xd84e('0x3d')]);_0x2f3b38[_0xd84e('0x41')]=_[_0xd84e('0x42')](_0x53d8ac[_0xd84e('0x41')]);_0x2f3b38['filters']=_['intersection'](_0x2f3b38[_0xd84e('0x40')],_0x2f3b38['query']);_0x2d389e['attributes']=_[_0xd84e('0x44')](_0x2f3b38['model'],qs[_0xd84e('0x45')](_0x53d8ac[_0xd84e('0x41')][_0xd84e('0x45')]));_0x2d389e['attributes']=_0x2d389e[_0xd84e('0x43')]['length']?_0x2d389e['attributes']:_0x2f3b38['model'];_0x2d389e[_0xd84e('0x48')]=qs['sort'](_0x53d8ac[_0xd84e('0x41')]['sort']);_0x2d389e[_0xd84e('0x4a')]=qs[_0xd84e('0x4b')](_[_0xd84e('0x69')](_0x53d8ac[_0xd84e('0x41')],_0x2f3b38[_0xd84e('0x4b')]));if(_0x53d8ac[_0xd84e('0x41')]['filter']){_0x2d389e['where']=_[_0xd84e('0x4d')](_0x2d389e[_0xd84e('0x4a')],{'$or':_[_0xd84e('0x3b')](_0x2d389e[_0xd84e('0x43')],function(_0xf5ea4e){var _0x3de387={};_0x3de387[_0xf5ea4e]={'$like':'%'+_0x53d8ac[_0xd84e('0x41')][_0xd84e('0x4c')]+'%'};return _0x3de387;})});}_0x2d389e=_['merge']({},_0x2d389e,_0x53d8ac[_0xd84e('0x4f')]);return _0x57d095['getApplications'](_0x2d389e);}})[_0xd84e('0x1c')](function(_0x42ecbf){if(_0x42ecbf){_0x47f047=_0x42ecbf[_0xd84e('0x55')];if(!_0x53d8ac['query']['hasOwnProperty'](_0xd84e('0x47'))){_0x2d389e[_0xd84e('0x2e')]=qs['limit'](_0x53d8ac[_0xd84e('0x41')][_0xd84e('0x2e')]);_0x2d389e['offset']=qs['offset'](_0x53d8ac['query'][_0xd84e('0x2c')]);}return _0x57d095[_0xd84e('0xa9')](_0x2d389e);}})['then'](function(_0x38a38d){if(_0x38a38d){return _0x38a38d?{'count':_0x47f047,'rows':_0x38a38d}:null;}})[_0xd84e('0x1c')](respondWithResult(_0x186655,null))[_0xd84e('0x27')](handleError(_0x186655,null));};exports[_0xd84e('0xaa')]=function(_0x2cec23,_0x361b58,_0x106b7f){var _0x1f74f3={'raw':![],'where':{}};var _0x21e104={};var _0x3cd444={'count':0x0,'rows':[]};return db[_0xd84e('0x3c')]['findOne']({'where':{'id':_0x2cec23[_0xd84e('0x54')]['id']}})[_0xd84e('0x1c')](handleEntityNotFound(_0x361b58,null))[_0xd84e('0x1c')](function(_0x448c1f){if(_0x448c1f){_0x21e104[_0xd84e('0x40')]=_[_0xd84e('0x42')](db[_0xd84e('0x8a')][_0xd84e('0x3d')]);_0x21e104['query']=_[_0xd84e('0x42')](_0x2cec23[_0xd84e('0x41')]);_0x21e104['filters']=_[_0xd84e('0x44')](_0x21e104['model'],_0x21e104[_0xd84e('0x41')]);_0x1f74f3['attributes']=_[_0xd84e('0x44')](_0x21e104[_0xd84e('0x40')],qs['fields'](_0x2cec23[_0xd84e('0x41')][_0xd84e('0x45')]));_0x1f74f3[_0xd84e('0x43')]=_0x1f74f3[_0xd84e('0x43')][_0xd84e('0x55')]?_0x1f74f3['attributes']:_0x21e104['model'];if(!_0x2cec23['query'][_0xd84e('0x46')](_0xd84e('0x47'))){_0x1f74f3[_0xd84e('0x2e')]=qs['limit'](_0x2cec23[_0xd84e('0x41')][_0xd84e('0x2e')]);_0x1f74f3['offset']=qs[_0xd84e('0x2c')](_0x2cec23['query'][_0xd84e('0x2c')]);}_0x1f74f3[_0xd84e('0x48')]=qs[_0xd84e('0x49')](_0x2cec23[_0xd84e('0x41')][_0xd84e('0x49')]);_0x1f74f3[_0xd84e('0x4a')]=qs['filters'](_['pick'](_0x2cec23[_0xd84e('0x41')],_0x21e104['filters']));_0x1f74f3[_0xd84e('0x4a')]['OpenchannelAccountId']=_0x448c1f['id'];if(_0x2cec23['query'][_0xd84e('0x4c')]){_0x1f74f3[_0xd84e('0x4a')]=_[_0xd84e('0x4d')](_0x1f74f3['where'],{'$or':_[_0xd84e('0x3b')](_0x1f74f3[_0xd84e('0x43')],function(_0x31cb73){var _0x3c61e9={};_0x3c61e9[_0x31cb73]={'$like':'%'+_0x2cec23[_0xd84e('0x41')][_0xd84e('0x4c')]+'%'};return _0x3c61e9;})});}_0x1f74f3=_['merge']({},_0x1f74f3,_0x2cec23['options']);return db[_0xd84e('0x8a')]['count']({'where':_0x1f74f3[_0xd84e('0x4a')]})['then'](function(_0x2e0dc2){_0x3cd444[_0xd84e('0x2f')]=_0x2e0dc2;if(_0x2cec23[_0xd84e('0x41')][_0xd84e('0x50')]){_0x1f74f3[_0xd84e('0x51')]=[{'model':db[_0xd84e('0x6d')],'as':'Contact','required':![]},{'model':db[_0xd84e('0x99')],'as':_0xd84e('0xab'),'attributes':['name',_0xd84e('0xac'),'internal'],'required':![]},{'model':db[_0xd84e('0xad')],'as':_0xd84e('0xae'),'attributes':['id',_0xd84e('0x38'),_0xd84e('0xaf')],'where':_0x2cec23[_0xd84e('0x41')]['tag']?{'id':_0x2cec23['query'][_0xd84e('0xb0')]}:undefined,'required':_0x2cec23[_0xd84e('0x41')][_0xd84e('0xb0')]?!![]:![]}];}return db[_0xd84e('0x8a')][_0xd84e('0x52')](_0x1f74f3);})['then'](function(_0x163779){_0x3cd444[_0xd84e('0xb1')]=_0x163779;return _0x3cd444;});}})[_0xd84e('0x1c')](respondWithFilteredResult(_0x361b58,_0x1f74f3))[_0xd84e('0x27')](handleError(_0x361b58,null));};exports[_0xd84e('0xb2')]=function(_0x27d68c,_0x155f9a,_0x53695b){return db[_0xd84e('0x3c')][_0xd84e('0x56')]({'where':{'id':_0x27d68c['params']['id']}})[_0xd84e('0x1c')](handleEntityNotFound(_0x155f9a,null))['then'](function(_0x5e26e8){if(_0x5e26e8){return _0x5e26e8[_0xd84e('0xb2')](_0x27d68c[_0xd84e('0x58')][_0xd84e('0x6b')],_['omit'](_0x27d68c[_0xd84e('0x58')],['ids','id'])||{})[_0xd84e('0x8c')](function(_0x211f37){for(var _0x20f31e=0x0;_0x20f31e<_0x27d68c[_0xd84e('0x58')][_0xd84e('0x6b')][_0xd84e('0x55')];_0x20f31e+=0x1){socket[_0xd84e('0xb3')](_0xd84e('0xb4'),{'UserId':Number(_0x27d68c[_0xd84e('0x58')][_0xd84e('0x6b')][_0x20f31e]),'OpenchannelAccountId':Number(_0x27d68c[_0xd84e('0x54')]['id'])});}return _0x211f37;});}})[_0xd84e('0x1c')](respondWithResult(_0x155f9a,null))['catch'](handleError(_0x155f9a,null));};exports[_0xd84e('0xb5')]=function(_0x96cce8,_0x56791c,_0x1cfc00){return db['OpenchannelAccount'][_0xd84e('0x56')]({'where':{'id':_0x96cce8[_0xd84e('0x54')]['id']}})[_0xd84e('0x1c')](handleEntityNotFound(_0x56791c,null))[_0xd84e('0x1c')](function(_0x5feecb){if(_0x5feecb){return _0x5feecb[_0xd84e('0xb5')](_0x96cce8[_0xd84e('0x41')][_0xd84e('0x6b')])[_0xd84e('0x1c')](function(){if(_[_0xd84e('0xb6')](_0x96cce8[_0xd84e('0x41')][_0xd84e('0x6b')])){for(var _0x3f1efe=0x0;_0x3f1efe<_0x96cce8[_0xd84e('0x41')]['ids'][_0xd84e('0x55')];_0x3f1efe+=0x1){socket[_0xd84e('0xb3')](_0xd84e('0xb7'),{'UserId':Number(_0x96cce8[_0xd84e('0x41')][_0xd84e('0x6b')][_0x3f1efe]),'OpenchannelAccountId':Number(_0x96cce8['params']['id'])});}}else{socket[_0xd84e('0xb3')](_0xd84e('0xb7'),{'UserId':Number(_0x96cce8[_0xd84e('0x41')][_0xd84e('0x6b')]),'OpenchannelAccountId':Number(_0x96cce8[_0xd84e('0x54')]['id'])});}});}})[_0xd84e('0x1c')](respondWithStatusCode(_0x56791c,null))['catch'](handleError(_0x56791c,null));};exports[_0xd84e('0xb8')]=function(_0x1cf9c6,_0x3c78d5,_0xc8bb5d){var _0x49eb58={};var _0x2b318d={};var _0x1fa6f1;var _0x574175;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x1cf9c6[_0xd84e('0x54')]['id']}})['then'](handleEntityNotFound(_0x3c78d5,null))['then'](function(_0x1ba12d){if(_0x1ba12d){_0x1fa6f1=_0x1ba12d;_0x2b318d[_0xd84e('0x40')]=_[_0xd84e('0x42')](db[_0xd84e('0x99')][_0xd84e('0x3d')]);_0x2b318d[_0xd84e('0x41')]=_[_0xd84e('0x42')](_0x1cf9c6[_0xd84e('0x41')]);_0x2b318d[_0xd84e('0x4b')]=_[_0xd84e('0x44')](_0x2b318d[_0xd84e('0x40')],_0x2b318d[_0xd84e('0x41')]);_0x49eb58[_0xd84e('0x43')]=_['intersection'](_0x2b318d['model'],qs[_0xd84e('0x45')](_0x1cf9c6[_0xd84e('0x41')]['fields']));_0x49eb58[_0xd84e('0x43')]=_0x49eb58[_0xd84e('0x43')][_0xd84e('0x55')]?_0x49eb58[_0xd84e('0x43')]:_0x2b318d[_0xd84e('0x40')];_0x49eb58[_0xd84e('0x48')]=qs[_0xd84e('0x49')](_0x1cf9c6[_0xd84e('0x41')][_0xd84e('0x49')]);_0x49eb58[_0xd84e('0x4a')]=qs['filters'](_['pick'](_0x1cf9c6[_0xd84e('0x41')],_0x2b318d[_0xd84e('0x4b')]));if(_0x1cf9c6['query'][_0xd84e('0x4c')]){_0x49eb58['where']=_['merge'](_0x49eb58[_0xd84e('0x4a')],{'$or':_[_0xd84e('0x3b')](_0x49eb58[_0xd84e('0x43')],function(_0x56a1de){var _0x3d1055={};_0x3d1055[_0x56a1de]={'$like':'%'+_0x1cf9c6[_0xd84e('0x41')][_0xd84e('0x4c')]+'%'};return _0x3d1055;})});}_0x49eb58=_[_0xd84e('0x4d')]({},_0x49eb58,_0x1cf9c6['options']);return _0x1fa6f1[_0xd84e('0xb8')](_0x49eb58);}})[_0xd84e('0x1c')](function(_0x42d5f4){if(_0x42d5f4){_0x574175=_0x42d5f4[_0xd84e('0x55')];if(!_0x1cf9c6['query'][_0xd84e('0x46')](_0xd84e('0x47'))){_0x49eb58[_0xd84e('0x2e')]=qs['limit'](_0x1cf9c6[_0xd84e('0x41')][_0xd84e('0x2e')]);_0x49eb58[_0xd84e('0x2c')]=qs[_0xd84e('0x2c')](_0x1cf9c6[_0xd84e('0x41')]['offset']);}return _0x1fa6f1[_0xd84e('0xb8')](_0x49eb58);}})[_0xd84e('0x1c')](function(_0xa87ff0){if(_0xa87ff0){return _0xa87ff0?{'count':_0x574175,'rows':_0xa87ff0}:null;}})[_0xd84e('0x1c')](respondWithResult(_0x3c78d5,null))[_0xd84e('0x27')](handleError(_0x3c78d5,null));};exports[_0xd84e('0x39')]=function(_0x1d37ff,_0x171977,_0x26fbab){var _0x446378,_0x3330c3,_0x576f53;if(_['isNil'](_0x1d37ff[_0xd84e('0x58')]['body'])||_0x1d37ff['body']['body']===''){throw new db[(_0xd84e('0x76'))][(_0xd84e('0x6e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x1d37ff[_0xd84e('0x58')]['to'])){}_0x446378=_0x1d37ff[_0xd84e('0x58')]['to'];return db[_0xd84e('0x3c')][_0xd84e('0x65')]({'where':{'id':_0x1d37ff[_0xd84e('0x54')]['id']}})['then'](handleEntityNotFound(_0x171977,null))['then'](function(_0x4c76d5){if(_0x4c76d5){return db['OpenchannelAccount']['find']({'where':{'id':_0x4c76d5['id']},'include':[{'model':db['CmList'],'as':_0xd84e('0x7f'),'include':[{'model':db[_0xd84e('0x6d')],'as':'Contacts','where':{[_0x4c76d5[_0xd84e('0x79')]]:_0x446378},'limit':0x1,'order':[[_0xd84e('0x71'),'DESC']]}]}]})[_0xd84e('0x1c')](handleEntityNotFound(_0x171977,null))[_0xd84e('0x1c')](function(_0x3fd219){if(_0x3fd219&&_0x3fd219[_0xd84e('0x7f')]){_0x3330c3=_0x3fd219[_0xd84e('0x5a')]({'plain':!![]});if(_0x3330c3['List']&&_0x3330c3[_0xd84e('0x7f')][_0xd84e('0x7b')][_0xd84e('0x55')]){return _0x3330c3['List'][_0xd84e('0x7b')][0x0];}return db[_0xd84e('0x6d')][_0xd84e('0x57')](_['defaults'](_0x1d37ff[_0xd84e('0x58')],{'firstName':_0x446378,[_0x3fd219['mapKey']]:_0x446378,'phone':_0x446378,'ListId':_0x3330c3[_0xd84e('0x73')]}));}})[_0xd84e('0x1c')](handleEntityNotFound(_0x171977,null))[_0xd84e('0x1c')](function(_0x2944cc){if(_0x2944cc){_0x576f53=_0x2944cc;return db[_0xd84e('0x8a')][_0xd84e('0x56')]({'where':{'ContactId':_0x576f53['id'],'closed':![],'OpenchannelAccountId':_0x3330c3['id']}})[_0xd84e('0x1c')](function(_0x3435c6){if(_0x3435c6){return[_0x3435c6,![]];}return db['OpenchannelInteraction'][_0xd84e('0x57')]({'UserId':_0x1d37ff[_0xd84e('0x59')]['id'],'ContactId':_0x576f53['id'],'OpenchannelAccountId':_0x3330c3['id'],'lastMsgDirection':'out','Messages':[_['merge'](_0x1d37ff[_0xd84e('0x58')],{'read':![],'body':_0x1d37ff['body'][_0xd84e('0x58')],'OpenchannelAccountId':_0x3330c3['id'],'UserId':_0x1d37ff[_0xd84e('0x59')]['id'],'ContactId':_0x576f53['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0xd84e('0xb9')}]})[_0xd84e('0x1c')](function(_0xc4230){return[_0xc4230,!![]];});});}})[_0xd84e('0x8c')](function(_0xbd132,_0x134140){if(_0x134140){return _0xbd132;}return db[_0xd84e('0x96')]['create'](_[_0xd84e('0x4d')](_0x1d37ff[_0xd84e('0x58')],{'read':![],'body':_0x1d37ff[_0xd84e('0x58')][_0xd84e('0x58')],'OpenchannelAccountId':_0x3330c3['id'],'OpenchannelInteractionId':_0xbd132['id'],'UserId':_0x1d37ff['user']['id'],'ContactId':_0x576f53['id']}))[_0xd84e('0x1c')](function(_0x1d2ebe){_0xbd132[_0xd84e('0xba')]['Messages']=[];_0xbd132[_0xd84e('0xba')][_0xd84e('0xb9')][_0xd84e('0x92')](_0x1d2ebe['dataValues']);return _0xbd132;});});}})[_0xd84e('0x1c')](respondWithResult(_0x171977,null))['catch'](handleError(_0x171977,null));}; \ No newline at end of file +var _0x02bd=['client','http','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','json','undefined','offset','set','Content-Range','apply','update','then','destroy','get','OpenchannelAccounts','UserProfileResource','end','name','index','Pause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filters','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','order','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','List','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','Contacts','ListId','contact','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','firstName','lastName','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','findOne','bulkCreate','findAndCountAll','stack','finally','getApplications','getInteractions','Contact','User','Owner','fullname','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','send','DESC','out','Messages','dataValues','rimraf','zip-dir','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','jayson/promise'];(function(_0x4d2bf0,_0x3c4f1b){var _0x1bf54=function(_0x12392e){while(--_0x12392e){_0x4d2bf0['push'](_0x4d2bf0['shift']());}};_0x1bf54(++_0x3c4f1b);}(_0x02bd,0xa6));var _0xd02b=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x02bd[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd02b('0x0'));var zipdir=require(_0xd02b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd02b('0x2'));var Mustache=require(_0xd02b('0x3'));var util=require(_0xd02b('0x4'));var path=require(_0xd02b('0x5'));var sox=require('sox');var csv=require(_0xd02b('0x6'));var ejs=require(_0xd02b('0x7'));var fs=require('fs');var fs_extra=require(_0xd02b('0x8'));var _=require(_0xd02b('0x9'));var squel=require(_0xd02b('0xa'));var crypto=require('crypto');var jsforce=require(_0xd02b('0xb'));var deskjs=require(_0xd02b('0xc'));var toCsv=require(_0xd02b('0x6'));var querystring=require(_0xd02b('0xd'));var Papa=require(_0xd02b('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd02b('0xf'));var as=require(_0xd02b('0x10'));var hardwareService=require(_0xd02b('0x11'));var logger=require(_0xd02b('0x12'))(_0xd02b('0x13'));var utils=require(_0xd02b('0x14'));var config=require(_0xd02b('0x15'));var licenseUtil=require(_0xd02b('0x16'));var db=require(_0xd02b('0x17'))['db'];config[_0xd02b('0x18')]=_[_0xd02b('0x19')](config['redis'],{'host':_0xd02b('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd02b('0x18')]));require('./openchannelAccount.socket')[_0xd02b('0x1b')](socket);var jayson=require(_0xd02b('0x1c'));var client=jayson[_0xd02b('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0xd02b('0x1d')][_0xd02b('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x8db6d3,_0x5d60b5,_0x511d2d,_0x21270e){return new BPromise(function(_0x2c8a1b,_0x55bdb6){var _0x12fa32=_0x21270e||client;return _0x12fa32[_0xd02b('0x1f')](_0x8db6d3,_0x511d2d)['then'](function(_0x35df04){logger[_0xd02b('0x20')](_0xd02b('0x21'),_0x5d60b5,_0xd02b('0x22'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x5d60b5,_0xd02b('0x22'),JSON[_0xd02b('0x23')](_0x35df04));if(_0x35df04[_0xd02b('0x24')]){if(_0x35df04[_0xd02b('0x24')]['code']===0x1f4){logger[_0xd02b('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x5d60b5,_0x35df04[_0xd02b('0x24')]['message']);return _0x55bdb6(_0x35df04[_0xd02b('0x24')][_0xd02b('0x25')]);}logger['error'](_0xd02b('0x21'),_0x5d60b5,_0x35df04[_0xd02b('0x24')][_0xd02b('0x25')]);return _0x2c8a1b(_0x35df04[_0xd02b('0x24')][_0xd02b('0x25')]);}else{logger['info'](_0xd02b('0x21'),_0x5d60b5,'request\x20sent');_0x2c8a1b(_0x35df04[_0xd02b('0x26')][_0xd02b('0x25')]);}})[_0xd02b('0x27')](function(_0xf109b3){logger[_0xd02b('0x24')](_0xd02b('0x21'),_0x5d60b5,_0xf109b3);_0x55bdb6(_0xf109b3);});});}function respondWithStatusCode(_0xb3df66,_0x1b0c12){_0x1b0c12=_0x1b0c12||0xcc;return function(_0x5698a9){if(_0x5698a9){return _0xb3df66[_0xd02b('0x28')](_0x1b0c12);}return _0xb3df66[_0xd02b('0x29')](_0x1b0c12)['end']();};}function respondWithResult(_0x732821,_0x5d7ef0){_0x5d7ef0=_0x5d7ef0||0xc8;return function(_0x503c81){if(_0x503c81){return _0x732821[_0xd02b('0x29')](_0x5d7ef0)[_0xd02b('0x2a')](_0x503c81);}};}function respondWithFilteredResult(_0x220467,_0x441dc7){return function(_0x247936){if(_0x247936){var _0x5358bd=typeof _0x441dc7['offset']==='undefined'&&typeof _0x441dc7['limit']===_0xd02b('0x2b');var _0x25ba75=_0x247936['count'];var _0x10908b=_0x5358bd?0x0:_0x441dc7[_0xd02b('0x2c')];var _0xdab091=_0x5358bd?_0x247936['count']:_0x441dc7['offset']+_0x441dc7['limit'];var _0x3fb002;if(_0xdab091>=_0x25ba75){_0xdab091=_0x25ba75;_0x3fb002=0xc8;}else{_0x3fb002=0xce;}_0x220467['status'](_0x3fb002);return _0x220467[_0xd02b('0x2d')](_0xd02b('0x2e'),_0x10908b+'-'+_0xdab091+'/'+_0x25ba75)[_0xd02b('0x2a')](_0x247936);}return null;};}function patchUpdates(_0x5f4299){return function(_0x18a107){try{jsonpatch[_0xd02b('0x2f')](_0x18a107,_0x5f4299,!![]);}catch(_0x227dde){return BPromise['reject'](_0x227dde);}return _0x18a107['save']();};}function saveUpdates(_0x5d4bc5,_0x59310e){return function(_0x128c37){if(_0x128c37){return _0x128c37[_0xd02b('0x30')](_0x5d4bc5)[_0xd02b('0x31')](function(_0x225ca0){return _0x225ca0;});}return null;};}function removeEntity(_0x1d1523,_0x3d5a72){return function(_0x14da62){if(_0x14da62){return _0x14da62[_0xd02b('0x32')]()[_0xd02b('0x31')](function(){var _0xc21312=_0x14da62[_0xd02b('0x33')]({'plain':!![]});var _0x5d48dc=_0xd02b('0x34');return db[_0xd02b('0x35')][_0xd02b('0x32')]({'where':{'type':_0x5d48dc,'resourceId':_0xc21312['id']}})[_0xd02b('0x31')](function(){return _0x14da62;});})[_0xd02b('0x31')](function(){_0x1d1523['status'](0xcc)[_0xd02b('0x36')]();});}};}function handleEntityNotFound(_0x2e0ead,_0x5dcb7f){return function(_0x35b106){if(!_0x35b106){_0x2e0ead['sendStatus'](0x194);}return _0x35b106;};}function handleError(_0x4a448c,_0x5b6352){_0x5b6352=_0x5b6352||0x1f4;return function(_0x56d5ac){logger[_0xd02b('0x24')](_0x56d5ac['stack']);if(_0x56d5ac[_0xd02b('0x37')]){delete _0x56d5ac[_0xd02b('0x37')];}_0x4a448c[_0xd02b('0x29')](_0x5b6352)['send'](_0x56d5ac);};}exports[_0xd02b('0x38')]=function(_0x4d4018,_0x43413d){var _0x151d4a={'include':[{'model':db[_0xd02b('0x39')],'as':'mandatoryDispositionPause'}]},_0x213965={},_0x6cbaaf={'count':0x0,'rows':[]};var _0x39ea69=_[_0xd02b('0x3a')](db[_0xd02b('0x3b')][_0xd02b('0x3c')],function(_0x1387fa){return{'name':_0x1387fa[_0xd02b('0x3d')],'type':_0x1387fa[_0xd02b('0x3e')][_0xd02b('0x3f')]};});_0x213965[_0xd02b('0x40')]=_['map'](_0x39ea69,_0xd02b('0x37'));_0x213965['query']=_[_0xd02b('0x41')](_0x4d4018[_0xd02b('0x42')]);_0x213965['filters']=_[_0xd02b('0x43')](_0x213965['model'],_0x213965[_0xd02b('0x42')]);_0x151d4a[_0xd02b('0x44')]=_['intersection'](_0x213965[_0xd02b('0x40')],qs[_0xd02b('0x45')](_0x4d4018['query'][_0xd02b('0x45')]));_0x151d4a[_0xd02b('0x44')]=_0x151d4a[_0xd02b('0x44')][_0xd02b('0x46')]?_0x151d4a[_0xd02b('0x44')]:_0x213965[_0xd02b('0x40')];if(!_0x4d4018[_0xd02b('0x42')][_0xd02b('0x47')](_0xd02b('0x48'))){_0x151d4a[_0xd02b('0x49')]=qs[_0xd02b('0x49')](_0x4d4018[_0xd02b('0x42')][_0xd02b('0x49')]);_0x151d4a[_0xd02b('0x2c')]=qs[_0xd02b('0x2c')](_0x4d4018[_0xd02b('0x42')][_0xd02b('0x2c')]);}_0x151d4a['order']=qs[_0xd02b('0x4a')](_0x4d4018['query'][_0xd02b('0x4a')]);_0x151d4a['where']=qs['filters'](_[_0xd02b('0x4b')](_0x4d4018['query'],_0x213965[_0xd02b('0x4c')]),_0x39ea69);if(_0x4d4018[_0xd02b('0x42')][_0xd02b('0x4d')]){_0x151d4a[_0xd02b('0x4e')]=_[_0xd02b('0x4f')](_0x151d4a[_0xd02b('0x4e')],{'$or':_[_0xd02b('0x3a')](_0x39ea69,function(_0x22db5b){if(_0x22db5b[_0xd02b('0x3e')]!==_0xd02b('0x50')){var _0x180d5f={};_0x180d5f[_0x22db5b[_0xd02b('0x37')]]={'$like':'%'+_0x4d4018[_0xd02b('0x42')]['filter']+'%'};return _0x180d5f;}})});}_0x151d4a=_[_0xd02b('0x4f')]({},_0x151d4a,_0x4d4018[_0xd02b('0x51')]);var _0xcc6d4a={'where':_0x151d4a[_0xd02b('0x4e')]};return db[_0xd02b('0x3b')]['count'](_0xcc6d4a)[_0xd02b('0x31')](function(_0x58db7d){_0x6cbaaf[_0xd02b('0x52')]=_0x58db7d;if(_0x4d4018['query'][_0xd02b('0x53')]){_0x151d4a[_0xd02b('0x54')]=[{'all':!![]}];}return db[_0xd02b('0x3b')][_0xd02b('0x55')](_0x151d4a);})[_0xd02b('0x31')](function(_0x5127b4){_0x6cbaaf[_0xd02b('0x56')]=_0x5127b4;return _0x6cbaaf;})[_0xd02b('0x31')](respondWithFilteredResult(_0x43413d,_0x151d4a))[_0xd02b('0x27')](handleError(_0x43413d,null));};exports[_0xd02b('0x57')]=function(_0x28eefd,_0x44937f){var _0x1f3856={'raw':![],'where':{'id':_0x28eefd[_0xd02b('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0xd02b('0x59')}]},_0x300ebf={};_0x300ebf[_0xd02b('0x40')]=_[_0xd02b('0x41')](db[_0xd02b('0x3b')][_0xd02b('0x3c')]);_0x300ebf[_0xd02b('0x42')]=_['keys'](_0x28eefd[_0xd02b('0x42')]);_0x300ebf[_0xd02b('0x4c')]=_['intersection'](_0x300ebf[_0xd02b('0x40')],_0x300ebf[_0xd02b('0x42')]);_0x1f3856[_0xd02b('0x44')]=_[_0xd02b('0x43')](_0x300ebf[_0xd02b('0x40')],qs[_0xd02b('0x45')](_0x28eefd[_0xd02b('0x42')][_0xd02b('0x45')]));_0x1f3856[_0xd02b('0x44')]=_0x1f3856['attributes'][_0xd02b('0x46')]?_0x1f3856[_0xd02b('0x44')]:_0x300ebf['model'];if(_0x28eefd[_0xd02b('0x42')][_0xd02b('0x53')]){_0x1f3856[_0xd02b('0x54')]=[{'all':!![]}];}_0x1f3856=_[_0xd02b('0x4f')]({},_0x1f3856,_0x28eefd[_0xd02b('0x51')]);return db[_0xd02b('0x3b')][_0xd02b('0x5a')](_0x1f3856)[_0xd02b('0x31')](handleEntityNotFound(_0x44937f,null))[_0xd02b('0x31')](respondWithResult(_0x44937f,null))[_0xd02b('0x27')](handleError(_0x44937f,null));};exports[_0xd02b('0x5b')]=function(_0x48cf79,_0x138226){return db[_0xd02b('0x3b')]['create'](_0x48cf79['body'],{})[_0xd02b('0x31')](function(_0x29efbc){var _0x29e5d3=_0x48cf79[_0xd02b('0x5c')][_0xd02b('0x33')]({'plain':!![]});if(!_0x29e5d3)throw new Error(_0xd02b('0x5d'));if(_0x29e5d3[_0xd02b('0x5e')]===_0xd02b('0x5c')){var _0x157064=_0x29efbc[_0xd02b('0x33')]({'plain':!![]});var _0x54b1d8=_0xd02b('0x34');return db[_0xd02b('0x5f')][_0xd02b('0x5a')]({'where':{'name':_0x54b1d8,'userProfileId':_0x29e5d3[_0xd02b('0x60')]},'raw':!![]})[_0xd02b('0x31')](function(_0x599e3e){if(_0x599e3e&&_0x599e3e[_0xd02b('0x61')]===0x0){return db[_0xd02b('0x35')]['create']({'name':_0x157064[_0xd02b('0x37')],'resourceId':_0x157064['id'],'type':_0x599e3e['name'],'sectionId':_0x599e3e['id']},{})[_0xd02b('0x31')](function(){return _0x29efbc;});}else{return _0x29efbc;}})['catch'](function(_0x50e88a){logger[_0xd02b('0x24')](_0xd02b('0x62'),_0x50e88a);throw _0x50e88a;});}return _0x29efbc;})[_0xd02b('0x31')](respondWithResult(_0x138226,0xc9))[_0xd02b('0x27')](handleError(_0x138226,null));};exports[_0xd02b('0x30')]=function(_0xe82196,_0x1fcdc8){if(_0xe82196['body']['id']){delete _0xe82196[_0xd02b('0x63')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0xe82196[_0xd02b('0x58')]['id']},'include':[{'model':db[_0xd02b('0x39')],'as':_0xd02b('0x59')}]})[_0xd02b('0x31')](handleEntityNotFound(_0x1fcdc8,null))[_0xd02b('0x31')](saveUpdates(_0xe82196[_0xd02b('0x63')],null))[_0xd02b('0x31')](respondWithResult(_0x1fcdc8,null))[_0xd02b('0x27')](handleError(_0x1fcdc8,null));};exports[_0xd02b('0x32')]=function(_0x5a4968,_0x1d9b6e){return db[_0xd02b('0x3b')][_0xd02b('0x5a')]({'where':{'id':_0x5a4968[_0xd02b('0x58')]['id']}})[_0xd02b('0x31')](handleEntityNotFound(_0x1d9b6e,null))[_0xd02b('0x31')](removeEntity(_0x1d9b6e,null))[_0xd02b('0x27')](handleError(_0x1d9b6e,null));};exports[_0xd02b('0x64')]=function(_0x4234b3,_0x43c5e6){return db[_0xd02b('0x3b')][_0xd02b('0x64')]()[_0xd02b('0x31')](respondWithResult(_0x43c5e6,null))['catch'](handleError(_0x43c5e6,null));};exports[_0xd02b('0x65')]=function(_0x44cf10,_0x4a8756,_0x1f168f){if(_0x44cf10[_0xd02b('0x63')]['id']){delete _0x44cf10[_0xd02b('0x63')]['id'];}return db[_0xd02b('0x3b')]['find']({'where':{'id':_0x44cf10[_0xd02b('0x58')]['id']}})[_0xd02b('0x31')](handleEntityNotFound(_0x4a8756,null))[_0xd02b('0x31')](function(_0x155c34){if(_0x155c34){_0x44cf10[_0xd02b('0x63')][_0xd02b('0x66')]=_0x155c34['id'];return db[_0xd02b('0x67')][_0xd02b('0x5b')](_0x44cf10['body']);}})[_0xd02b('0x31')](respondWithResult(_0x4a8756,null))[_0xd02b('0x27')](handleError(_0x4a8756,null));};exports[_0xd02b('0x68')]=function(_0x3ac99d,_0x36d81d,_0x201270){var _0x30c050={'raw':![],'where':{}};var _0xa19c8b={};var _0x50e854={'count':0x0,'rows':[]};return db[_0xd02b('0x3b')]['findOne']({'where':{'id':_0x3ac99d[_0xd02b('0x58')]['id']}})[_0xd02b('0x31')](handleEntityNotFound(_0x36d81d,null))[_0xd02b('0x31')](function(_0x409fc3){if(_0x409fc3){_0xa19c8b['model']=_[_0xd02b('0x41')](db[_0xd02b('0x67')][_0xd02b('0x3c')]);_0xa19c8b['query']=_[_0xd02b('0x41')](_0x3ac99d['query']);_0xa19c8b['filters']=_['intersection'](_0xa19c8b['model'],_0xa19c8b[_0xd02b('0x42')]);_0x30c050[_0xd02b('0x44')]=_[_0xd02b('0x43')](_0xa19c8b[_0xd02b('0x40')],qs[_0xd02b('0x45')](_0x3ac99d[_0xd02b('0x42')]['fields']));_0x30c050[_0xd02b('0x44')]=_0x30c050['attributes']['length']?_0x30c050[_0xd02b('0x44')]:_0xa19c8b[_0xd02b('0x40')];if(!_0x3ac99d[_0xd02b('0x42')]['hasOwnProperty'](_0xd02b('0x48'))){_0x30c050[_0xd02b('0x49')]=qs[_0xd02b('0x49')](_0x3ac99d[_0xd02b('0x42')]['limit']);_0x30c050[_0xd02b('0x2c')]=qs['offset'](_0x3ac99d[_0xd02b('0x42')][_0xd02b('0x2c')]);}_0x30c050[_0xd02b('0x69')]=qs['sort'](_0x3ac99d[_0xd02b('0x42')][_0xd02b('0x4a')]);_0x30c050[_0xd02b('0x4e')]=qs['filters'](_[_0xd02b('0x4b')](_0x3ac99d[_0xd02b('0x42')],_0xa19c8b[_0xd02b('0x4c')]));_0x30c050[_0xd02b('0x4e')][_0xd02b('0x66')]=_0x409fc3['id'];if(_0x3ac99d[_0xd02b('0x42')][_0xd02b('0x4d')]){_0x30c050[_0xd02b('0x4e')]=_['merge'](_0x30c050[_0xd02b('0x4e')],{'$or':_[_0xd02b('0x3a')](_0x30c050['attributes'],function(_0x319c3a){var _0xcd031b={};_0xcd031b[_0x319c3a]={'$like':'%'+_0x3ac99d[_0xd02b('0x42')][_0xd02b('0x4d')]+'%'};return _0xcd031b;})});}_0x30c050=_[_0xd02b('0x4f')]({},_0x30c050,_0x3ac99d[_0xd02b('0x51')]);return db[_0xd02b('0x67')][_0xd02b('0x52')]({'where':_0x30c050[_0xd02b('0x4e')]})[_0xd02b('0x31')](function(_0x4d0b47){_0x50e854[_0xd02b('0x52')]=_0x4d0b47;if(_0x3ac99d['query'][_0xd02b('0x53')]){_0x30c050[_0xd02b('0x54')]=[{'all':!![]}];}return db[_0xd02b('0x67')][_0xd02b('0x55')](_0x30c050);})['then'](function(_0x52b460){_0x50e854[_0xd02b('0x56')]=_0x52b460;return _0x50e854;});}})[_0xd02b('0x31')](respondWithFilteredResult(_0x36d81d,_0x30c050))['catch'](handleError(_0x36d81d,null));};exports['removeDispositions']=function(_0x5b6630,_0x58c0a6,_0x53b91d){return db['OpenchannelAccount'][_0xd02b('0x5a')]({'where':{'id':_0x5b6630[_0xd02b('0x58')]['id']}})[_0xd02b('0x31')](handleEntityNotFound(_0x58c0a6,null))[_0xd02b('0x31')](function(_0x1bc252){if(_0x1bc252){return _0x1bc252[_0xd02b('0x6a')](_0x5b6630['query'][_0xd02b('0x6b')]);}})[_0xd02b('0x31')](respondWithStatusCode(_0x58c0a6,null))[_0xd02b('0x27')](handleError(_0x58c0a6,null));};exports[_0xd02b('0x6c')]=function(_0x551c69,_0x226554,_0x5a1e39){if(_0x551c69[_0xd02b('0x63')]['id']){delete _0x551c69[_0xd02b('0x63')]['id'];}return db[_0xd02b('0x3b')]['find']({'where':{'id':_0x551c69[_0xd02b('0x58')]['id']}})[_0xd02b('0x31')](handleEntityNotFound(_0x226554,null))[_0xd02b('0x31')](function(_0x3d687a){if(_0x3d687a){_0x551c69[_0xd02b('0x63')][_0xd02b('0x66')]=_0x3d687a['id'];return db[_0xd02b('0x6d')][_0xd02b('0x5b')](_0x551c69['body']);}})[_0xd02b('0x31')](respondWithResult(_0x226554,null))[_0xd02b('0x27')](handleError(_0x226554,null));};exports[_0xd02b('0x6e')]=function(_0x1de4c6,_0x38b5ef,_0x504ac4){var _0x5e245e={'raw':![],'where':{}};var _0x359cfa={};var _0x511116={'count':0x0,'rows':[]};return db[_0xd02b('0x3b')]['findOne']({'where':{'id':_0x1de4c6[_0xd02b('0x58')]['id']}})[_0xd02b('0x31')](handleEntityNotFound(_0x38b5ef,null))[_0xd02b('0x31')](function(_0x1d7f42){if(_0x1d7f42){_0x359cfa['model']=_[_0xd02b('0x41')](db[_0xd02b('0x6d')][_0xd02b('0x3c')]);_0x359cfa[_0xd02b('0x42')]=_['keys'](_0x1de4c6[_0xd02b('0x42')]);_0x359cfa[_0xd02b('0x4c')]=_[_0xd02b('0x43')](_0x359cfa[_0xd02b('0x40')],_0x359cfa[_0xd02b('0x42')]);_0x5e245e[_0xd02b('0x44')]=_[_0xd02b('0x43')](_0x359cfa['model'],qs['fields'](_0x1de4c6[_0xd02b('0x42')][_0xd02b('0x45')]));_0x5e245e['attributes']=_0x5e245e[_0xd02b('0x44')][_0xd02b('0x46')]?_0x5e245e[_0xd02b('0x44')]:_0x359cfa['model'];if(!_0x1de4c6[_0xd02b('0x42')][_0xd02b('0x47')](_0xd02b('0x48'))){_0x5e245e[_0xd02b('0x49')]=qs['limit'](_0x1de4c6[_0xd02b('0x42')][_0xd02b('0x49')]);_0x5e245e[_0xd02b('0x2c')]=qs['offset'](_0x1de4c6[_0xd02b('0x42')][_0xd02b('0x2c')]);}_0x5e245e[_0xd02b('0x69')]=qs[_0xd02b('0x4a')](_0x1de4c6['query'][_0xd02b('0x4a')]);_0x5e245e[_0xd02b('0x4e')]=qs['filters'](_[_0xd02b('0x4b')](_0x1de4c6[_0xd02b('0x42')],_0x359cfa[_0xd02b('0x4c')]));_0x5e245e['where'][_0xd02b('0x66')]=_0x1d7f42['id'];if(_0x1de4c6['query'][_0xd02b('0x4d')]){_0x5e245e[_0xd02b('0x4e')]=_[_0xd02b('0x4f')](_0x5e245e[_0xd02b('0x4e')],{'$or':_[_0xd02b('0x3a')](_0x5e245e[_0xd02b('0x44')],function(_0x35fb96){var _0x2c220d={};_0x2c220d[_0x35fb96]={'$like':'%'+_0x1de4c6[_0xd02b('0x42')][_0xd02b('0x4d')]+'%'};return _0x2c220d;})});}_0x5e245e=_[_0xd02b('0x4f')]({},_0x5e245e,_0x1de4c6[_0xd02b('0x51')]);return db[_0xd02b('0x6d')][_0xd02b('0x52')]({'where':_0x5e245e[_0xd02b('0x4e')]})[_0xd02b('0x31')](function(_0xe93449){_0x511116[_0xd02b('0x52')]=_0xe93449;if(_0x1de4c6[_0xd02b('0x42')][_0xd02b('0x53')]){_0x5e245e['include']=[{'all':!![]}];}return db[_0xd02b('0x6d')][_0xd02b('0x55')](_0x5e245e);})[_0xd02b('0x31')](function(_0x3692d8){_0x511116['rows']=_0x3692d8;return _0x511116;});}})[_0xd02b('0x31')](respondWithFilteredResult(_0x38b5ef,_0x5e245e))[_0xd02b('0x27')](handleError(_0x38b5ef,null));};exports[_0xd02b('0x6f')]=function(_0x28d47b,_0x224a55,_0x3ef8f9){return db[_0xd02b('0x3b')][_0xd02b('0x5a')]({'where':{'id':_0x28d47b[_0xd02b('0x58')]['id']}})[_0xd02b('0x31')](handleEntityNotFound(_0x224a55,null))[_0xd02b('0x31')](function(_0x262bf3){if(_0x262bf3){return _0x262bf3[_0xd02b('0x6f')](_0x28d47b[_0xd02b('0x42')][_0xd02b('0x6b')]);}})[_0xd02b('0x31')](respondWithStatusCode(_0x224a55,null))[_0xd02b('0x27')](handleError(_0x224a55,null));};exports[_0xd02b('0x70')]=function(_0x510448,_0x38fb98,_0x48a00c){var _0x234594={'body':_0x510448[_0xd02b('0x63')],'channel':'openchannel'};var _0x3c34c8=[];var _0x2daaf9=[];var _0x1d401e={};var _0x11e5b2=![];return db[_0xd02b('0x71')][_0xd02b('0x64')]()[_0xd02b('0x31')](function(_0x26dc29){if(!_0x26dc29){throw new db[(_0xd02b('0x72'))][(_0xd02b('0x73'))](_0xd02b('0x74'));}_0x3c34c8=_[_0xd02b('0x75')](_[_0xd02b('0x41')](_0x26dc29),[_0xd02b('0x76'),_0xd02b('0x77')]);_0x2daaf9=_[_0xd02b('0x75')](_[_0xd02b('0x41')](_0x26dc29),[_0xd02b('0x76'),_0xd02b('0x77'),_0xd02b('0x78'),'ListId']);if(_0x510448[_0xd02b('0x63')]['id']){delete _0x510448['body']['id'];}if(_['isNil'](_0x510448['body'][_0xd02b('0x79')])){throw new db[(_0xd02b('0x72'))][(_0xd02b('0x73'))](_0xd02b('0x7a'));}if(_[_0xd02b('0x7b')](_0x510448[_0xd02b('0x63')][_0xd02b('0x63')])||_0x510448[_0xd02b('0x63')][_0xd02b('0x63')]===''){throw new db['Sequelize'][(_0xd02b('0x73'))](_0xd02b('0x7c'));}if(_[_0xd02b('0x7b')](_0x510448['body']['mapKey'])){throw new db[(_0xd02b('0x72'))][(_0xd02b('0x73'))](_0xd02b('0x7d')+_0x2daaf9);}if(!_[_0xd02b('0x7e')](_0x2daaf9,_0x510448[_0xd02b('0x63')][_0xd02b('0x7f')])){throw new db[(_0xd02b('0x72'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2daaf9);}_0x1d401e[_0x510448[_0xd02b('0x63')][_0xd02b('0x7f')]]=_0x510448[_0xd02b('0x63')][_0xd02b('0x79')];})['then'](function(){return db[_0xd02b('0x3b')]['find']({'where':{'id':_0x510448[_0xd02b('0x58')]['id']},'include':[{'model':db[_0xd02b('0x80')],'as':_0xd02b('0x81'),'include':[{'model':db[_0xd02b('0x71')],'as':'Contacts','where':_0x1d401e,'limit':0x1,'order':[[_0xd02b('0x77'),'DESC']]}]},{'model':db[_0xd02b('0x82')],'as':_0xd02b('0x83')}]});})['then'](handleEntityNotFound(_0x38fb98,null))[_0xd02b('0x31')](function(_0x17f78b){if(_0x17f78b&&_0x17f78b[_0xd02b('0x81')]){_0x234594[_0xd02b('0x84')]=_0x17f78b;_0x234594[_0xd02b('0x85')]=_0x17f78b[_0xd02b('0x83')];_0x234594[_0xd02b('0x86')]=_0x17f78b[_0xd02b('0x81')];_0x234594[_0xd02b('0x85')]=_[_0xd02b('0x87')](_0x234594[_0xd02b('0x85')],[_0xd02b('0x88')],[_0xd02b('0x89')]);if(_0x234594[_0xd02b('0x84')][_0xd02b('0x83')]){delete _0x234594[_0xd02b('0x84')][_0xd02b('0x83')];}if(_0x234594[_0xd02b('0x84')]['List']&&_0x234594['account'][_0xd02b('0x81')][_0xd02b('0x8a')][_0xd02b('0x46')]){return _0x234594['account'][_0xd02b('0x81')][_0xd02b('0x8a')][0x0];}var _0xde4683=_['defaults'](_0x510448[_0xd02b('0x63')],{'firstName':_0x510448['body'][_0xd02b('0x79')],'ListId':_0x17f78b[_0xd02b('0x8b')]});_0xde4683[_0x510448[_0xd02b('0x63')][_0xd02b('0x7f')]]=_0x510448[_0xd02b('0x63')]['from'];return db[_0xd02b('0x71')][_0xd02b('0x5b')](_0xde4683,{'fields':_0x3c34c8,'raw':!![]});}})[_0xd02b('0x31')](handleEntityNotFound(_0x38fb98,null))[_0xd02b('0x31')](function(_0x3bff3b){_0x234594[_0xd02b('0x8c')]=_0x3bff3b;if(_0x3bff3b){var _0x436fc5={'ContactId':_0x3bff3b['id'],'OpenchannelAccountId':_0x510448['params']['id'],'from':(_0x3bff3b['firstName']||'')+'\x20'+(_0x3bff3b['lastName']||'')};var _0x175f2b={'OpenchannelAccountId':_0x510448[_0xd02b('0x58')]['id'],'closed':![]};if(_0x510448[_0xd02b('0x63')]['threadId']){_0x175f2b[_0xd02b('0x8d')]=_0x510448[_0xd02b('0x63')][_0xd02b('0x8d')];return db['OpenchannelInteraction'][_0xd02b('0x5a')]({'where':_0x175f2b})[_0xd02b('0x31')](function(_0x2dec7d){if(_0x2dec7d){return[_0x2dec7d,![]];}_0x436fc5[_0xd02b('0x8d')]=_0x510448[_0xd02b('0x63')][_0xd02b('0x8d')];_0x436fc5[_0xd02b('0x8e')]=_0x510448[_0xd02b('0x63')]['externalUrl'];return db[_0xd02b('0x8f')]['create'](_0x436fc5)[_0xd02b('0x31')](function(_0xd6f135){return[_0xd6f135,!![]];});});}else{_0x175f2b[_0xd02b('0x8d')]=null;}_0x175f2b[_0xd02b('0x90')]=_0x3bff3b['id'];return db[_0xd02b('0x8f')]['find']({'where':_0x175f2b})['then'](function(_0x440369){if(_0x440369){return[_0x440369,![]];}return db[_0xd02b('0x8f')][_0xd02b('0x5b')](_0x436fc5)[_0xd02b('0x31')](function(_0x31b4c4){return[_0x31b4c4,!![]];});});}})[_0xd02b('0x91')](function(_0x14d68e,_0x42e710){if(_0x14d68e){_0x11e5b2=_0x42e710;if(!_0x42e710){var _0x449888={'from':(_0x234594[_0xd02b('0x8c')][_0xd02b('0x92')]||'')+'\x20'+(_0x234594[_0xd02b('0x8c')][_0xd02b('0x93')]||'')};if(_0x510448[_0xd02b('0x63')]['threadId']&&_0x510448[_0xd02b('0x63')][_0xd02b('0x94')]&&_0x510448[_0xd02b('0x63')][_0xd02b('0x8d')]!=_0x510448[_0xd02b('0x63')][_0xd02b('0x94')]){_0x449888[_0xd02b('0x8d')]=_0x510448[_0xd02b('0x63')][_0xd02b('0x94')];}return _0x14d68e[_0xd02b('0x30')](_0x449888);}else{return _0x14d68e;}}})[_0xd02b('0x31')](function(_0x1a61be){_0x234594[_0xd02b('0x95')]=_0x1a61be['get']({'plain':!![]});_0x234594[_0xd02b('0x95')][_0xd02b('0x96')]=_0x11e5b2;if(_0x234594[_0xd02b('0x95')]['created']){if(_0x234594[_0xd02b('0x84')][_0xd02b('0x97')]){_0x234594[_0xd02b('0x85')][_0xd02b('0x98')]({'id':0x0,'priority':_0x234594[_0xd02b('0x85')]['length']+0x1,'app':_0xd02b('0x99'),'appdata':_0xd02b('0x9a'),'interval':_0xd02b('0x9b')});}}return db[_0xd02b('0x9c')]['create']({'body':_0x510448[_0xd02b('0x63')][_0xd02b('0x63')],'OpenchannelAccountId':_0x510448[_0xd02b('0x58')]['id'],'OpenchannelInteractionId':_0x1a61be['id'],'direction':'in','ContactId':_0x234594[_0xd02b('0x8c')]['id'],'AttachmentId':_0x510448[_0xd02b('0x63')][_0xd02b('0x9d')]});})[_0xd02b('0x31')](function(_0xad4c04){_0x234594['message']=_0xad4c04;if(_0x234594['interaction']['UserId']){return db['User'][_0xd02b('0x5a')]({'attributes':['id','name'],'where':{'id':_0x234594[_0xd02b('0x95')][_0xd02b('0x9e')]}})['then'](function(_0x2cc752){if(_0x2cc752){_0x234594[_0xd02b('0x85')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2cc752[_0xd02b('0x37')]+','+(_0x234594[_0xd02b('0x84')][_0xd02b('0x9f')]||0xa),'interval':'*,*,*,*'});_0x234594[_0xd02b('0xa0')]=![];}return respondWithRpcPromise(_0xd02b('0xa1'),_0xd02b('0xa2'),_0x234594);});}return respondWithRpcPromise(_0xd02b('0xa1'),_0xd02b('0xa2'),_0x234594);})[_0xd02b('0x31')](function(_0x2d136c){respondWithRpcPromise('EventManager',_0xd02b('0xa3'),{'event':_0xd02b('0x70'),'message':_0x2d136c},client9002);return _0x2d136c;})['then'](respondWithResult(_0x38fb98,null))[_0xd02b('0x27')](handleError(_0x38fb98,null));};exports[_0xd02b('0xa4')]=function(_0x228cbf,_0xcb4b4d){var _0x307b99=_0x228cbf[_0xd02b('0x58')]['id'];var _0x494ac6=_0x228cbf[_0xd02b('0x63')];var _0xe7def8=0xc8;var _0x1aecb5=null;return db[_0xd02b('0xa5')][_0xd02b('0xa6')]({'isolationLevel':db[_0xd02b('0xa5')][_0xd02b('0xa7')][_0xd02b('0xa8')]['READ_COMMITTED']},function(_0xf8c92a){return db[_0xd02b('0x3b')][_0xd02b('0xa9')]({'where':{'id':_0x307b99},'transaction':_0xf8c92a})[_0xd02b('0x31')](function(_0x5bd6a9){if(_0x5bd6a9){return db['OpenchannelApplication']['destroy']({'where':{'OpenchannelAccountId':_0x307b99},'transaction':_0xf8c92a})[_0xd02b('0x31')](function(){var _0x253da2=_[_0xd02b('0x3a')](_0x494ac6,function(_0x5a8995){_0x5a8995[_0xd02b('0x66')]=_0x307b99;return _0x5a8995;});return db['OpenchannelApplication'][_0xd02b('0xaa')](_0x253da2,{'transaction':_0xf8c92a});});}else{_0xe7def8=0x194;_0x1aecb5=[];}});})[_0xd02b('0x31')](function(){if(_0xe7def8!==0x194){return db[_0xd02b('0x82')][_0xd02b('0xab')]({'where':{'OpenchannelAccountId':_0x307b99},'order':_0xd02b('0x88')})[_0xd02b('0x31')](function(_0x3b580c){_0x1aecb5=_0x3b580c;});}})[_0xd02b('0x27')](function(_0x3d7bce){_0xe7def8=0x1f4;logger[_0xd02b('0x24')](_0x3d7bce[_0xd02b('0xac')]);if(_0x3d7bce[_0xd02b('0x37')]){delete _0x3d7bce[_0xd02b('0x37')];}_0x1aecb5=_0x3d7bce;})[_0xd02b('0xad')](function(){if(_0x1aecb5===null){_0xcb4b4d[_0xd02b('0x28')](_0xe7def8);}else{if(_0xe7def8===0x1f4){_0xcb4b4d[_0xd02b('0x29')](_0xe7def8)['send'](_0x1aecb5);}else{_0xcb4b4d[_0xd02b('0x29')](_0xe7def8)['json'](_0x1aecb5);}}});};exports[_0xd02b('0xae')]=function(_0x10d222,_0x1d7e5a,_0x473630){var _0x571fde={};var _0x2d3cee={};var _0x130869;var _0x2b9b86;return db[_0xd02b('0x3b')]['findOne']({'where':{'id':_0x10d222[_0xd02b('0x58')]['id']}})['then'](handleEntityNotFound(_0x1d7e5a,null))[_0xd02b('0x31')](function(_0x33bdbf){if(_0x33bdbf){_0x130869=_0x33bdbf;_0x2d3cee[_0xd02b('0x40')]=_[_0xd02b('0x41')](db[_0xd02b('0x82')][_0xd02b('0x3c')]);_0x2d3cee[_0xd02b('0x42')]=_[_0xd02b('0x41')](_0x10d222['query']);_0x2d3cee['filters']=_[_0xd02b('0x43')](_0x2d3cee[_0xd02b('0x40')],_0x2d3cee[_0xd02b('0x42')]);_0x571fde[_0xd02b('0x44')]=_[_0xd02b('0x43')](_0x2d3cee[_0xd02b('0x40')],qs[_0xd02b('0x45')](_0x10d222[_0xd02b('0x42')][_0xd02b('0x45')]));_0x571fde[_0xd02b('0x44')]=_0x571fde[_0xd02b('0x44')][_0xd02b('0x46')]?_0x571fde[_0xd02b('0x44')]:_0x2d3cee['model'];_0x571fde['order']=qs['sort'](_0x10d222['query'][_0xd02b('0x4a')]);_0x571fde[_0xd02b('0x4e')]=qs[_0xd02b('0x4c')](_[_0xd02b('0x4b')](_0x10d222[_0xd02b('0x42')],_0x2d3cee['filters']));if(_0x10d222[_0xd02b('0x42')][_0xd02b('0x4d')]){_0x571fde[_0xd02b('0x4e')]=_[_0xd02b('0x4f')](_0x571fde['where'],{'$or':_['map'](_0x571fde[_0xd02b('0x44')],function(_0x26ee06){var _0xbb5e53={};_0xbb5e53[_0x26ee06]={'$like':'%'+_0x10d222['query'][_0xd02b('0x4d')]+'%'};return _0xbb5e53;})});}_0x571fde=_[_0xd02b('0x4f')]({},_0x571fde,_0x10d222['options']);return _0x130869[_0xd02b('0xae')](_0x571fde);}})[_0xd02b('0x31')](function(_0x1617f7){if(_0x1617f7){_0x2b9b86=_0x1617f7[_0xd02b('0x46')];if(!_0x10d222['query'][_0xd02b('0x47')](_0xd02b('0x48'))){_0x571fde[_0xd02b('0x49')]=qs['limit'](_0x10d222[_0xd02b('0x42')][_0xd02b('0x49')]);_0x571fde['offset']=qs[_0xd02b('0x2c')](_0x10d222[_0xd02b('0x42')][_0xd02b('0x2c')]);}return _0x130869['getApplications'](_0x571fde);}})[_0xd02b('0x31')](function(_0x3f32a9){if(_0x3f32a9){return _0x3f32a9?{'count':_0x2b9b86,'rows':_0x3f32a9}:null;}})[_0xd02b('0x31')](respondWithResult(_0x1d7e5a,null))['catch'](handleError(_0x1d7e5a,null));};exports[_0xd02b('0xaf')]=function(_0x26c98f,_0x229024,_0x16d679){var _0x57bdca={'raw':![],'where':{}};var _0x1585af={};var _0x598c08={'count':0x0,'rows':[]};return db[_0xd02b('0x3b')][_0xd02b('0xa9')]({'where':{'id':_0x26c98f[_0xd02b('0x58')]['id']}})[_0xd02b('0x31')](handleEntityNotFound(_0x229024,null))[_0xd02b('0x31')](function(_0x4c9692){if(_0x4c9692){_0x1585af[_0xd02b('0x40')]=_[_0xd02b('0x41')](db[_0xd02b('0x8f')][_0xd02b('0x3c')]);_0x1585af[_0xd02b('0x42')]=_['keys'](_0x26c98f['query']);_0x1585af[_0xd02b('0x4c')]=_[_0xd02b('0x43')](_0x1585af[_0xd02b('0x40')],_0x1585af['query']);_0x57bdca[_0xd02b('0x44')]=_[_0xd02b('0x43')](_0x1585af[_0xd02b('0x40')],qs['fields'](_0x26c98f['query'][_0xd02b('0x45')]));_0x57bdca[_0xd02b('0x44')]=_0x57bdca[_0xd02b('0x44')][_0xd02b('0x46')]?_0x57bdca['attributes']:_0x1585af[_0xd02b('0x40')];if(!_0x26c98f[_0xd02b('0x42')]['hasOwnProperty']('nolimit')){_0x57bdca[_0xd02b('0x49')]=qs[_0xd02b('0x49')](_0x26c98f[_0xd02b('0x42')][_0xd02b('0x49')]);_0x57bdca[_0xd02b('0x2c')]=qs[_0xd02b('0x2c')](_0x26c98f[_0xd02b('0x42')][_0xd02b('0x2c')]);}_0x57bdca[_0xd02b('0x69')]=qs[_0xd02b('0x4a')](_0x26c98f[_0xd02b('0x42')][_0xd02b('0x4a')]);_0x57bdca['where']=qs[_0xd02b('0x4c')](_[_0xd02b('0x4b')](_0x26c98f[_0xd02b('0x42')],_0x1585af['filters']));_0x57bdca['where'][_0xd02b('0x66')]=_0x4c9692['id'];if(_0x26c98f[_0xd02b('0x42')][_0xd02b('0x4d')]){_0x57bdca[_0xd02b('0x4e')]=_[_0xd02b('0x4f')](_0x57bdca[_0xd02b('0x4e')],{'$or':_[_0xd02b('0x3a')](_0x57bdca[_0xd02b('0x44')],function(_0x1aecd3){var _0x14f9b9={};_0x14f9b9[_0x1aecd3]={'$like':'%'+_0x26c98f[_0xd02b('0x42')][_0xd02b('0x4d')]+'%'};return _0x14f9b9;})});}_0x57bdca=_['merge']({},_0x57bdca,_0x26c98f[_0xd02b('0x51')]);return db[_0xd02b('0x8f')][_0xd02b('0x52')]({'where':_0x57bdca[_0xd02b('0x4e')]})[_0xd02b('0x31')](function(_0x55f47a){_0x598c08['count']=_0x55f47a;if(_0x26c98f[_0xd02b('0x42')][_0xd02b('0x53')]){_0x57bdca[_0xd02b('0x54')]=[{'model':db[_0xd02b('0x71')],'as':_0xd02b('0xb0'),'required':![]},{'model':db[_0xd02b('0xb1')],'as':_0xd02b('0xb2'),'attributes':['name',_0xd02b('0xb3'),'internal'],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xd02b('0x37'),_0xd02b('0xb4')],'where':_0x26c98f[_0xd02b('0x42')][_0xd02b('0xb5')]?{'id':_0x26c98f[_0xd02b('0x42')]['tag']}:undefined,'required':_0x26c98f['query'][_0xd02b('0xb5')]?!![]:![]}];}return db[_0xd02b('0x8f')]['findAll'](_0x57bdca);})['then'](function(_0xfa0449){_0x598c08[_0xd02b('0x56')]=_0xfa0449;return _0x598c08;});}})[_0xd02b('0x31')](respondWithFilteredResult(_0x229024,_0x57bdca))[_0xd02b('0x27')](handleError(_0x229024,null));};exports[_0xd02b('0xb6')]=function(_0x153cfa,_0x316ace,_0x48d879){return db[_0xd02b('0x3b')][_0xd02b('0x5a')]({'where':{'id':_0x153cfa[_0xd02b('0x58')]['id']}})[_0xd02b('0x31')](handleEntityNotFound(_0x316ace,null))[_0xd02b('0x31')](function(_0x2bb269){if(_0x2bb269){return _0x2bb269[_0xd02b('0xb6')](_0x153cfa[_0xd02b('0x63')][_0xd02b('0x6b')],_[_0xd02b('0xb7')](_0x153cfa[_0xd02b('0x63')],[_0xd02b('0x6b'),'id'])||{})['spread'](function(_0x26c8a){for(var _0x2de17e=0x0;_0x2de17e<_0x153cfa[_0xd02b('0x63')]['ids'][_0xd02b('0x46')];_0x2de17e+=0x1){socket[_0xd02b('0xb8')](_0xd02b('0xb9'),{'UserId':Number(_0x153cfa[_0xd02b('0x63')][_0xd02b('0x6b')][_0x2de17e]),'OpenchannelAccountId':Number(_0x153cfa['params']['id'])});}return _0x26c8a;});}})[_0xd02b('0x31')](respondWithResult(_0x316ace,null))[_0xd02b('0x27')](handleError(_0x316ace,null));};exports[_0xd02b('0xba')]=function(_0x33aaa5,_0x34cde9,_0x49a697){return db['OpenchannelAccount'][_0xd02b('0x5a')]({'where':{'id':_0x33aaa5['params']['id']}})[_0xd02b('0x31')](handleEntityNotFound(_0x34cde9,null))[_0xd02b('0x31')](function(_0x27354f){if(_0x27354f){return _0x27354f[_0xd02b('0xba')](_0x33aaa5[_0xd02b('0x42')][_0xd02b('0x6b')])[_0xd02b('0x31')](function(){if(_[_0xd02b('0xbb')](_0x33aaa5[_0xd02b('0x42')][_0xd02b('0x6b')])){for(var _0x173340=0x0;_0x173340<_0x33aaa5[_0xd02b('0x42')][_0xd02b('0x6b')][_0xd02b('0x46')];_0x173340+=0x1){socket['emit'](_0xd02b('0xbc'),{'UserId':Number(_0x33aaa5[_0xd02b('0x42')][_0xd02b('0x6b')][_0x173340]),'OpenchannelAccountId':Number(_0x33aaa5[_0xd02b('0x58')]['id'])});}}else{socket[_0xd02b('0xb8')]('userOpenchannelAccount:remove',{'UserId':Number(_0x33aaa5['query'][_0xd02b('0x6b')]),'OpenchannelAccountId':Number(_0x33aaa5[_0xd02b('0x58')]['id'])});}});}})[_0xd02b('0x31')](respondWithStatusCode(_0x34cde9,null))['catch'](handleError(_0x34cde9,null));};exports[_0xd02b('0xbd')]=function(_0x67acfb,_0x4c4c1b,_0x3aac5f){var _0xb47ae0={};var _0x511e53={};var _0xd95fa7;var _0x2de400;return db[_0xd02b('0x3b')][_0xd02b('0xa9')]({'where':{'id':_0x67acfb['params']['id']}})[_0xd02b('0x31')](handleEntityNotFound(_0x4c4c1b,null))[_0xd02b('0x31')](function(_0x1f56ed){if(_0x1f56ed){_0xd95fa7=_0x1f56ed;_0x511e53[_0xd02b('0x40')]=_['keys'](db['User'][_0xd02b('0x3c')]);_0x511e53[_0xd02b('0x42')]=_['keys'](_0x67acfb['query']);_0x511e53['filters']=_[_0xd02b('0x43')](_0x511e53[_0xd02b('0x40')],_0x511e53[_0xd02b('0x42')]);_0xb47ae0[_0xd02b('0x44')]=_['intersection'](_0x511e53[_0xd02b('0x40')],qs[_0xd02b('0x45')](_0x67acfb[_0xd02b('0x42')][_0xd02b('0x45')]));_0xb47ae0[_0xd02b('0x44')]=_0xb47ae0['attributes'][_0xd02b('0x46')]?_0xb47ae0[_0xd02b('0x44')]:_0x511e53[_0xd02b('0x40')];_0xb47ae0[_0xd02b('0x69')]=qs[_0xd02b('0x4a')](_0x67acfb[_0xd02b('0x42')][_0xd02b('0x4a')]);_0xb47ae0['where']=qs['filters'](_[_0xd02b('0x4b')](_0x67acfb[_0xd02b('0x42')],_0x511e53['filters']));if(_0x67acfb[_0xd02b('0x42')][_0xd02b('0x4d')]){_0xb47ae0[_0xd02b('0x4e')]=_[_0xd02b('0x4f')](_0xb47ae0[_0xd02b('0x4e')],{'$or':_['map'](_0xb47ae0[_0xd02b('0x44')],function(_0x2101ef){var _0xfb3743={};_0xfb3743[_0x2101ef]={'$like':'%'+_0x67acfb[_0xd02b('0x42')][_0xd02b('0x4d')]+'%'};return _0xfb3743;})});}_0xb47ae0=_[_0xd02b('0x4f')]({},_0xb47ae0,_0x67acfb[_0xd02b('0x51')]);return _0xd95fa7['getAgents'](_0xb47ae0);}})[_0xd02b('0x31')](function(_0x1469ab){if(_0x1469ab){_0x2de400=_0x1469ab[_0xd02b('0x46')];if(!_0x67acfb[_0xd02b('0x42')][_0xd02b('0x47')](_0xd02b('0x48'))){_0xb47ae0[_0xd02b('0x49')]=qs[_0xd02b('0x49')](_0x67acfb['query']['limit']);_0xb47ae0[_0xd02b('0x2c')]=qs[_0xd02b('0x2c')](_0x67acfb['query'][_0xd02b('0x2c')]);}return _0xd95fa7[_0xd02b('0xbd')](_0xb47ae0);}})['then'](function(_0x593a13){if(_0x593a13){return _0x593a13?{'count':_0x2de400,'rows':_0x593a13}:null;}})['then'](respondWithResult(_0x4c4c1b,null))[_0xd02b('0x27')](handleError(_0x4c4c1b,null));};exports[_0xd02b('0xbe')]=function(_0x1c2520,_0x509284,_0x1897a0){var _0x584493,_0x48334a,_0x4a9fec;if(_[_0xd02b('0x7b')](_0x1c2520['body']['body'])||_0x1c2520[_0xd02b('0x63')]['body']===''){throw new db[(_0xd02b('0x72'))]['ValidationError'](_0xd02b('0x7c'));}if(_[_0xd02b('0x7b')](_0x1c2520[_0xd02b('0x63')]['to'])){}_0x584493=_0x1c2520[_0xd02b('0x63')]['to'];return db[_0xd02b('0x3b')][_0xd02b('0xa9')]({'where':{'id':_0x1c2520['params']['id']}})['then'](handleEntityNotFound(_0x509284,null))[_0xd02b('0x31')](function(_0x2c5ac4){if(_0x2c5ac4){return db['OpenchannelAccount']['find']({'where':{'id':_0x2c5ac4['id']},'include':[{'model':db['CmList'],'as':_0xd02b('0x81'),'include':[{'model':db[_0xd02b('0x71')],'as':_0xd02b('0x8a'),'where':{[_0x2c5ac4[_0xd02b('0x7f')]]:_0x584493},'limit':0x1,'order':[[_0xd02b('0x77'),_0xd02b('0xbf')]]}]}]})[_0xd02b('0x31')](handleEntityNotFound(_0x509284,null))['then'](function(_0x52784d){if(_0x52784d&&_0x52784d[_0xd02b('0x81')]){_0x48334a=_0x52784d[_0xd02b('0x33')]({'plain':!![]});if(_0x48334a[_0xd02b('0x81')]&&_0x48334a[_0xd02b('0x81')][_0xd02b('0x8a')][_0xd02b('0x46')]){return _0x48334a[_0xd02b('0x81')][_0xd02b('0x8a')][0x0];}return db[_0xd02b('0x71')][_0xd02b('0x5b')](_[_0xd02b('0x19')](_0x1c2520[_0xd02b('0x63')],{'firstName':_0x584493,[_0x52784d[_0xd02b('0x7f')]]:_0x584493,'phone':_0x584493,'ListId':_0x48334a[_0xd02b('0x8b')]}));}})[_0xd02b('0x31')](handleEntityNotFound(_0x509284,null))[_0xd02b('0x31')](function(_0x3d3e41){if(_0x3d3e41){_0x4a9fec=_0x3d3e41;return db[_0xd02b('0x8f')][_0xd02b('0x5a')]({'where':{'ContactId':_0x4a9fec['id'],'closed':![],'OpenchannelAccountId':_0x48334a['id']}})[_0xd02b('0x31')](function(_0x323212){if(_0x323212){return[_0x323212,![]];}return db[_0xd02b('0x8f')]['create']({'UserId':_0x1c2520[_0xd02b('0x5c')]['id'],'ContactId':_0x4a9fec['id'],'OpenchannelAccountId':_0x48334a['id'],'lastMsgDirection':_0xd02b('0xc0'),'Messages':[_['merge'](_0x1c2520[_0xd02b('0x63')],{'read':![],'body':_0x1c2520['body'][_0xd02b('0x63')],'OpenchannelAccountId':_0x48334a['id'],'UserId':_0x1c2520['user']['id'],'ContactId':_0x4a9fec['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0xd02b('0xc1')}]})[_0xd02b('0x31')](function(_0x5046ec){return[_0x5046ec,!![]];});});}})[_0xd02b('0x91')](function(_0x14f66b,_0x5cc96){if(_0x5cc96){return _0x14f66b;}return db[_0xd02b('0x9c')][_0xd02b('0x5b')](_[_0xd02b('0x4f')](_0x1c2520[_0xd02b('0x63')],{'read':![],'body':_0x1c2520[_0xd02b('0x63')][_0xd02b('0x63')],'OpenchannelAccountId':_0x48334a['id'],'OpenchannelInteractionId':_0x14f66b['id'],'UserId':_0x1c2520[_0xd02b('0x5c')]['id'],'ContactId':_0x4a9fec['id']}))[_0xd02b('0x31')](function(_0x2b5d11){_0x14f66b[_0xd02b('0xc2')]['Messages']=[];_0x14f66b[_0xd02b('0xc2')][_0xd02b('0xc1')]['push'](_0x2b5d11[_0xd02b('0xc2')]);return _0x14f66b;});});}})[_0xd02b('0x31')](respondWithResult(_0x509284,null))[_0xd02b('0x27')](handleError(_0x509284,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 26ae3fe..9e9ad87 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 _0x6324=['hasOwnProperty','hook','events','../../mysqldb','OpenchannelAccount','setMaxListeners','update','emit'];(function(_0x3dc0da,_0x256ed3){var _0x4a4bdf=function(_0x102e78){while(--_0x102e78){_0x3dc0da['push'](_0x3dc0da['shift']());}};_0x4a4bdf(++_0x256ed3);}(_0x6324,0x142));var _0x4632=function(_0x2afccc,_0x443a1a){_0x2afccc=_0x2afccc-0x0;var _0x485666=_0x6324[_0x2afccc];return _0x485666;};'use strict';var EventEmitter=require(_0x4632('0x0'));var OpenchannelAccount=require(_0x4632('0x1'))['db'][_0x4632('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x4632('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4632('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3bea40){return function(_0x54c200,_0x13b218,_0x592e39){OpenchannelAccountEvents[_0x4632('0x5')](_0x3bea40+':'+_0x54c200['id'],_0x54c200);OpenchannelAccountEvents[_0x4632('0x5')](_0x3bea40,_0x54c200);_0x592e39(null);};}for(var e in events){if(events[_0x4632('0x6')](e)){var event=events[e];OpenchannelAccount[_0x4632('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0xf109=['OpenchannelAccount','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x17a33e,_0x1b38fe){var _0x4801d0=function(_0x23fb6a){while(--_0x23fb6a){_0x17a33e['push'](_0x17a33e['shift']());}};_0x4801d0(++_0x1b38fe);}(_0xf109,0xce));var _0x9f10=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xf109[_0x5a776b];return _0xbbef59;};'use strict';var EventEmitter=require(_0x9f10('0x0'));var OpenchannelAccount=require(_0x9f10('0x1'))['db'][_0x9f10('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x9f10('0x3')};function emitEvent(_0x74f517){return function(_0x74d0ee,_0x26f01c,_0x4027f4){OpenchannelAccountEvents[_0x9f10('0x4')](_0x74f517+':'+_0x74d0ee['id'],_0x74d0ee);OpenchannelAccountEvents[_0x9f10('0x4')](_0x74f517,_0x74d0ee);_0x4027f4(null);};}for(var e in events){if(events[_0x9f10('0x5')](e)){var event=events[e];OpenchannelAccount[_0x9f10('0x6')](e,emitEvent(event));}}module[_0x9f10('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index c7d6773..24d548d 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(_0x2c92ab,_0x3d17d0){var _0x5bbb7b=function(_0x347330){while(--_0x347330){_0x2c92ab['push'](_0x2c92ab['shift']());}};_0x5bbb7b(++_0x3d17d0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x298da6,_0x3e5b3a){var _0x5ead15=function(_0x24efe5){while(--_0x24efe5){_0x298da6['push'](_0x298da6['shift']());}};_0x5ead15(++_0x3e5b3a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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 3cb3b4d..2e96128 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 _0x94df=['register','request','then','info','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelAccount.socket'];(function(_0x7cb10c,_0x2fcc3a){var _0x11df59=function(_0x75305f){while(--_0x75305f){_0x7cb10c['push'](_0x7cb10c['shift']());}};_0x11df59(++_0x2fcc3a);}(_0x94df,0xa3));var _0xf94d=function(_0x2e56be,_0x4ee223){_0x2e56be=_0x2e56be-0x0;var _0x4cb795=_0x94df[_0x2e56be];return _0x4cb795;};'use strict';var _=require(_0xf94d('0x0'));var util=require(_0xf94d('0x1'));var moment=require(_0xf94d('0x2'));var BPromise=require(_0xf94d('0x3'));var rs=require(_0xf94d('0x4'));var fs=require('fs');var Redis=require(_0xf94d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf94d('0x6'));var logger=require(_0xf94d('0x7'))(_0xf94d('0x8'));var config=require(_0xf94d('0x9'));var jayson=require(_0xf94d('0xa'));var client=jayson[_0xf94d('0xb')][_0xf94d('0xc')]({'port':0x232a});config[_0xf94d('0xd')]=_[_0xf94d('0xe')](config[_0xf94d('0xd')],{'host':_0xf94d('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf94d('0xd')]));require(_0xf94d('0x10'))[_0xf94d('0x11')](socket);function respondWithRpcPromise(_0x1bde05,_0xdaa8d6,_0x45739c){return new BPromise(function(_0x47efc6,_0x25c68e){return client[_0xf94d('0x12')](_0x1bde05,_0x45739c)[_0xf94d('0x13')](function(_0x19b1de){logger[_0xf94d('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0xdaa8d6,'request\x20sent');logger[_0xf94d('0x15')](_0xf94d('0x16'),_0xdaa8d6,_0xf94d('0x17'),JSON[_0xf94d('0x18')](_0x19b1de));if(_0x19b1de[_0xf94d('0x19')]){if(_0x19b1de[_0xf94d('0x19')]['code']===0x1f4){logger[_0xf94d('0x19')](_0xf94d('0x1a'),_0xdaa8d6,_0x19b1de[_0xf94d('0x19')][_0xf94d('0x1b')]);return _0x25c68e(_0x19b1de[_0xf94d('0x19')][_0xf94d('0x1b')]);}logger[_0xf94d('0x19')](_0xf94d('0x1a'),_0xdaa8d6,_0x19b1de['error'][_0xf94d('0x1b')]);return _0x47efc6(_0x19b1de['error'][_0xf94d('0x1b')]);}else{logger['info'](_0xf94d('0x1a'),_0xdaa8d6,'request\x20sent');_0x47efc6(_0x19b1de[_0xf94d('0x1c')][_0xf94d('0x1b')]);}})[_0xf94d('0x1d')](function(_0x349de5){logger['error'](_0xf94d('0x1a'),_0xdaa8d6,_0x349de5);_0x25c68e(_0x349de5);});});} \ No newline at end of file +var _0xb921=['socket.io-emitter','./openchannelAccount.socket','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x5ab238,_0x4ddda9){var _0x236db6=function(_0x5f1f3f){while(--_0x5f1f3f){_0x5ab238['push'](_0x5ab238['shift']());}};_0x236db6(++_0x4ddda9);}(_0xb921,0x16a));var _0x1b92=function(_0x2fcd62,_0x57bf42){_0x2fcd62=_0x2fcd62-0x0;var _0x2580f5=_0xb921[_0x2fcd62];return _0x2580f5;};'use strict';var _=require(_0x1b92('0x0'));var util=require(_0x1b92('0x1'));var moment=require(_0x1b92('0x2'));var BPromise=require(_0x1b92('0x3'));var rs=require(_0x1b92('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1b92('0x5'));var logger=require(_0x1b92('0x6'))(_0x1b92('0x7'));var config=require(_0x1b92('0x8'));var jayson=require(_0x1b92('0x9'));var client=jayson[_0x1b92('0xa')][_0x1b92('0xb')]({'port':0x232a});config[_0x1b92('0xc')]=_[_0x1b92('0xd')](config[_0x1b92('0xc')],{'host':_0x1b92('0xe'),'port':0x18eb});var socket=require(_0x1b92('0xf'))(new Redis(config[_0x1b92('0xc')]));require(_0x1b92('0x10'))[_0x1b92('0x11')](socket);function respondWithRpcPromise(_0x4c8e30,_0x31e314,_0x1e5802){return new BPromise(function(_0x154b6d,_0x146d68){return client[_0x1b92('0x12')](_0x4c8e30,_0x1e5802)[_0x1b92('0x13')](function(_0x3deaf4){logger['info'](_0x1b92('0x14'),_0x31e314,_0x1b92('0x15'));logger['debug'](_0x1b92('0x16'),_0x31e314,_0x1b92('0x15'),JSON[_0x1b92('0x17')](_0x3deaf4));if(_0x3deaf4[_0x1b92('0x18')]){if(_0x3deaf4[_0x1b92('0x18')][_0x1b92('0x19')]===0x1f4){logger[_0x1b92('0x18')]('OpenchannelAccount,\x20%s,\x20%s',_0x31e314,_0x3deaf4[_0x1b92('0x18')]['message']);return _0x146d68(_0x3deaf4[_0x1b92('0x18')]['message']);}logger[_0x1b92('0x18')]('OpenchannelAccount,\x20%s,\x20%s',_0x31e314,_0x3deaf4[_0x1b92('0x18')][_0x1b92('0x1a')]);return _0x154b6d(_0x3deaf4[_0x1b92('0x18')]['message']);}else{logger[_0x1b92('0x1b')](_0x1b92('0x14'),_0x31e314,_0x1b92('0x15'));_0x154b6d(_0x3deaf4[_0x1b92('0x1c')][_0x1b92('0x1a')]);}})['catch'](function(_0x4024bf){logger[_0x1b92('0x18')](_0x1b92('0x14'),_0x31e314,_0x4024bf);_0x146d68(_0x4024bf);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index a4af040..83d3fc3 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 _0x24cf=['openchannelAccount:','remove','update','removeListener','register','length'];(function(_0x393b35,_0x100c91){var _0x193566=function(_0x488114){while(--_0x488114){_0x393b35['push'](_0x393b35['shift']());}};_0x193566(++_0x100c91);}(_0x24cf,0x1d5));var _0xf24c=function(_0x35ff55,_0xae92c3){_0x35ff55=_0x35ff55-0x0;var _0x42904c=_0x24cf[_0x35ff55];return _0x42904c;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0xf24c('0x0'),_0xf24c('0x1')];function createListener(_0x227c22,_0x40675a){return function(_0x45f945){_0x40675a['emit'](_0x227c22,_0x45f945);};}function removeListener(_0x3cfc01,_0x417bb2){return function(){OpenchannelAccountEvents[_0xf24c('0x2')](_0x3cfc01,_0x417bb2);};}exports[_0xf24c('0x3')]=function(_0x5c4ebc){for(var _0x4983e2=0x0,_0x5104bd=events[_0xf24c('0x4')];_0x4983e2<_0x5104bd;_0x4983e2++){var _0x596e81=events[_0x4983e2];var _0x3b7cf1=createListener(_0xf24c('0x5')+_0x596e81,_0x5c4ebc);OpenchannelAccountEvents['on'](_0x596e81,_0x3b7cf1);}}; \ No newline at end of file +var _0xd5b6=['removeListener','register','length','./openchannelAccount.events','save','remove','update','emit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd5b6,0x73));var _0x6d5b=function(_0x34beaa,_0x459f7e){_0x34beaa=_0x34beaa-0x0;var _0x1d6f58=_0xd5b6[_0x34beaa];return _0x1d6f58;};'use strict';var OpenchannelAccountEvents=require(_0x6d5b('0x0'));var events=[_0x6d5b('0x1'),_0x6d5b('0x2'),_0x6d5b('0x3')];function createListener(_0x406106,_0x3d9bc9){return function(_0x162442){_0x3d9bc9[_0x6d5b('0x4')](_0x406106,_0x162442);};}function removeListener(_0x558202,_0x2735ab){return function(){OpenchannelAccountEvents[_0x6d5b('0x5')](_0x558202,_0x2735ab);};}exports[_0x6d5b('0x6')]=function(_0x4935ef){for(var _0x1c2490=0x0,_0x3e722d=events[_0x6d5b('0x7')];_0x1c2490<_0x3e722d;_0x1c2490++){var _0x3cdc91=events[_0x1c2490];var _0x5b57cb=createListener('openchannelAccount:'+_0x3cdc91,_0x4935ef);OpenchannelAccountEvents['on'](_0x3cdc91,_0x5b57cb);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 4aba473..c1bbe70 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 _0x0355=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util'];(function(_0x2da092,_0x430c99){var _0x4c3185=function(_0xbfc117){while(--_0xbfc117){_0x2da092['push'](_0x2da092['shift']());}};_0x4c3185(++_0x430c99);}(_0x0355,0xee));var _0x5035=function(_0x477a02,_0x42f7fb){_0x477a02=_0x477a02-0x0;var _0x5467dc=_0x0355[_0x477a02];return _0x5467dc;};'use strict';var multer=require(_0x5035('0x0'));var util=require(_0x5035('0x1'));var path=require(_0x5035('0x2'));var timeout=require(_0x5035('0x3'));var express=require(_0x5035('0x4'));var router=express['Router']();var fs_extra=require(_0x5035('0x5'));var auth=require(_0x5035('0x6'));var interaction=require(_0x5035('0x7'));var config=require(_0x5035('0x8'));var controller=require('./openchannelApplication.controller');router[_0x5035('0x9')]('/',auth[_0x5035('0xa')](),controller[_0x5035('0xb')]);router[_0x5035('0x9')](_0x5035('0xc'),auth[_0x5035('0xa')](),controller[_0x5035('0xd')]);router[_0x5035('0xe')]('/',auth[_0x5035('0xa')](),controller[_0x5035('0xf')]);router['put'](_0x5035('0xc'),auth[_0x5035('0xa')](),controller[_0x5035('0x10')]);router[_0x5035('0x11')](_0x5035('0xc'),auth[_0x5035('0xa')](),controller[_0x5035('0x12')]);module[_0x5035('0x13')]=router; \ No newline at end of file +var _0x6d68=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','post','create','put','update','delete','destroy','exports'];(function(_0x31d7be,_0x59b13c){var _0x3066d4=function(_0xf10e7c){while(--_0xf10e7c){_0x31d7be['push'](_0x31d7be['shift']());}};_0x3066d4(++_0x59b13c);}(_0x6d68,0x104));var _0x86d6=function(_0x26cfe2,_0x1212a2){_0x26cfe2=_0x26cfe2-0x0;var _0x5b0ad8=_0x6d68[_0x26cfe2];return _0x5b0ad8;};'use strict';var multer=require(_0x86d6('0x0'));var util=require(_0x86d6('0x1'));var path=require(_0x86d6('0x2'));var timeout=require(_0x86d6('0x3'));var express=require(_0x86d6('0x4'));var router=express[_0x86d6('0x5')]();var fs_extra=require(_0x86d6('0x6'));var auth=require(_0x86d6('0x7'));var interaction=require(_0x86d6('0x8'));var config=require('../../config/environment');var controller=require('./openchannelApplication.controller');router['get']('/',auth[_0x86d6('0x9')](),controller[_0x86d6('0xa')]);router[_0x86d6('0xb')](_0x86d6('0xc'),auth[_0x86d6('0x9')](),controller['show']);router[_0x86d6('0xd')]('/',auth[_0x86d6('0x9')](),controller[_0x86d6('0xe')]);router[_0x86d6('0xf')](_0x86d6('0xc'),auth[_0x86d6('0x9')](),controller[_0x86d6('0x10')]);router[_0x86d6('0x11')](_0x86d6('0xc'),auth[_0x86d6('0x9')](),controller[_0x86d6('0x12')]);module[_0x86d6('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 0051dba..7a1ebb9 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 _0x498e=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x40bc01,_0x22a9a9){var _0x42365b=function(_0x2d3d88){while(--_0x2d3d88){_0x40bc01['push'](_0x40bc01['shift']());}};_0x42365b(++_0x22a9a9);}(_0x498e,0x7a));var _0xe498=function(_0x2e6eb0,_0x3325b7){_0x2e6eb0=_0x2e6eb0-0x0;var _0x10e554=_0x498e[_0x2e6eb0];return _0x10e554;};'use strict';var Sequelize=require(_0xe498('0x0'));module[_0xe498('0x1')]={'priority':{'type':Sequelize[_0xe498('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xe498('0x3')],'allowNull':![],'defaultValue':_0xe498('0x4')},'appdata':{'type':Sequelize[_0xe498('0x5')]()},'description':{'type':Sequelize[_0xe498('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xe498('0x6')}}; \ No newline at end of file +var _0x2b09=['INTEGER','STRING','noop','*,*,*,*','sequelize','exports'];(function(_0x53f798,_0x38bdff){var _0x1ae35e=function(_0x4b7dfb){while(--_0x4b7dfb){_0x53f798['push'](_0x53f798['shift']());}};_0x1ae35e(++_0x38bdff);}(_0x2b09,0x160));var _0x92b0=function(_0x3db1e1,_0x48b40a){_0x3db1e1=_0x3db1e1-0x0;var _0x472fa9=_0x2b09[_0x3db1e1];return _0x472fa9;};'use strict';var Sequelize=require(_0x92b0('0x0'));module[_0x92b0('0x1')]={'priority':{'type':Sequelize[_0x92b0('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x92b0('0x3')],'allowNull':![],'defaultValue':_0x92b0('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x92b0('0x3')]},'interval':{'type':Sequelize[_0x92b0('0x3')],'defaultValue':_0x92b0('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index d7f3ec5..bb246cf 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 _0x6968=['error','stack','name','send','map','OpenchannelApplication','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','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','../../config/license/util','status','end','json','offset','count','limit','set','apply','reject','save','update','then'];(function(_0x43c48c,_0x287e91){var _0x595280=function(_0x3d373f){while(--_0x3d373f){_0x43c48c['push'](_0x43c48c['shift']());}};_0x595280(++_0x287e91);}(_0x6968,0x1e0));var _0x8696=function(_0x277fda,_0x57df6e){_0x277fda=_0x277fda-0x0;var _0x34475a=_0x6968[_0x277fda];return _0x34475a;};'use strict';var emlformat=require(_0x8696('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8696('0x1'));var rp=require(_0x8696('0x2'));var moment=require(_0x8696('0x3'));var BPromise=require(_0x8696('0x4'));var Mustache=require('mustache');var util=require(_0x8696('0x5'));var path=require(_0x8696('0x6'));var sox=require(_0x8696('0x7'));var csv=require('to-csv');var ejs=require(_0x8696('0x8'));var fs=require('fs');var fs_extra=require(_0x8696('0x9'));var _=require(_0x8696('0xa'));var squel=require(_0x8696('0xb'));var crypto=require(_0x8696('0xc'));var jsforce=require(_0x8696('0xd'));var deskjs=require(_0x8696('0xe'));var toCsv=require(_0x8696('0xf'));var querystring=require(_0x8696('0x10'));var Papa=require(_0x8696('0x11'));var Redis=require('ioredis');var authService=require(_0x8696('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8696('0x13'));var hardwareService=require(_0x8696('0x14'));var logger=require(_0x8696('0x15'))(_0x8696('0x16'));var utils=require(_0x8696('0x17'));var config=require(_0x8696('0x18'));var licenseUtil=require(_0x8696('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2836e4,_0x333576){_0x333576=_0x333576||0xcc;return function(_0x31f7f1){if(_0x31f7f1){return _0x2836e4['sendStatus'](_0x333576);}return _0x2836e4[_0x8696('0x1a')](_0x333576)[_0x8696('0x1b')]();};}function respondWithResult(_0x52613b,_0x5e0da9){_0x5e0da9=_0x5e0da9||0xc8;return function(_0x145d5a){if(_0x145d5a){return _0x52613b[_0x8696('0x1a')](_0x5e0da9)[_0x8696('0x1c')](_0x145d5a);}};}function respondWithFilteredResult(_0x24e4f9,_0x43b932){return function(_0x14e3f5){if(_0x14e3f5){var _0xdcfb7e=typeof _0x43b932[_0x8696('0x1d')]==='undefined'&&typeof _0x43b932['limit']==='undefined';var _0x547250=_0x14e3f5[_0x8696('0x1e')];var _0x546f93=_0xdcfb7e?0x0:_0x43b932[_0x8696('0x1d')];var _0x3f04b1=_0xdcfb7e?_0x14e3f5[_0x8696('0x1e')]:_0x43b932[_0x8696('0x1d')]+_0x43b932[_0x8696('0x1f')];var _0x3a50be;if(_0x3f04b1>=_0x547250){_0x3f04b1=_0x547250;_0x3a50be=0xc8;}else{_0x3a50be=0xce;}_0x24e4f9[_0x8696('0x1a')](_0x3a50be);return _0x24e4f9[_0x8696('0x20')]('Content-Range',_0x546f93+'-'+_0x3f04b1+'/'+_0x547250)[_0x8696('0x1c')](_0x14e3f5);}return null;};}function patchUpdates(_0x497e7f){return function(_0x541132){try{jsonpatch[_0x8696('0x21')](_0x541132,_0x497e7f,!![]);}catch(_0x552039){return BPromise[_0x8696('0x22')](_0x552039);}return _0x541132[_0x8696('0x23')]();};}function saveUpdates(_0x7fad4,_0x5b74a6){return function(_0x38ccec){if(_0x38ccec){return _0x38ccec[_0x8696('0x24')](_0x7fad4)[_0x8696('0x25')](function(_0x54b47c){return _0x54b47c;});}return null;};}function removeEntity(_0x4a291b,_0x1c897a){return function(_0x40ea53){if(_0x40ea53){return _0x40ea53['destroy']()[_0x8696('0x25')](function(){_0x4a291b['status'](0xcc)[_0x8696('0x1b')]();});}};}function handleEntityNotFound(_0x1b5cdb,_0x50c47f){return function(_0x186105){if(!_0x186105){_0x1b5cdb['sendStatus'](0x194);}return _0x186105;};}function handleError(_0x204d1d,_0x41a4e3){_0x41a4e3=_0x41a4e3||0x1f4;return function(_0x901ca2){logger[_0x8696('0x26')](_0x901ca2[_0x8696('0x27')]);if(_0x901ca2[_0x8696('0x28')]){delete _0x901ca2[_0x8696('0x28')];}_0x204d1d[_0x8696('0x1a')](_0x41a4e3)[_0x8696('0x29')](_0x901ca2);};}exports['index']=function(_0x5b8aba,_0x2e37d0){var _0xfbafeb={},_0x265695={},_0x4bf421={'count':0x0,'rows':[]};var _0x26523f=_[_0x8696('0x2a')](db[_0x8696('0x2b')][_0x8696('0x2c')],function(_0x4064ae){return{'name':_0x4064ae['fieldName'],'type':_0x4064ae[_0x8696('0x2d')][_0x8696('0x2e')]};});_0x265695[_0x8696('0x2f')]=_[_0x8696('0x2a')](_0x26523f,_0x8696('0x28'));_0x265695[_0x8696('0x30')]=_[_0x8696('0x31')](_0x5b8aba[_0x8696('0x30')]);_0x265695[_0x8696('0x32')]=_[_0x8696('0x33')](_0x265695['model'],_0x265695[_0x8696('0x30')]);_0xfbafeb[_0x8696('0x34')]=_['intersection'](_0x265695[_0x8696('0x2f')],qs[_0x8696('0x35')](_0x5b8aba[_0x8696('0x30')][_0x8696('0x35')]));_0xfbafeb[_0x8696('0x34')]=_0xfbafeb['attributes'][_0x8696('0x36')]?_0xfbafeb[_0x8696('0x34')]:_0x265695['model'];if(!_0x5b8aba['query'][_0x8696('0x37')](_0x8696('0x38'))){_0xfbafeb[_0x8696('0x1f')]=qs[_0x8696('0x1f')](_0x5b8aba[_0x8696('0x30')][_0x8696('0x1f')]);_0xfbafeb[_0x8696('0x1d')]=qs[_0x8696('0x1d')](_0x5b8aba[_0x8696('0x30')][_0x8696('0x1d')]);}_0xfbafeb['order']=qs['sort'](_0x5b8aba[_0x8696('0x30')][_0x8696('0x39')]);_0xfbafeb[_0x8696('0x3a')]=qs[_0x8696('0x32')](_[_0x8696('0x3b')](_0x5b8aba[_0x8696('0x30')],_0x265695[_0x8696('0x32')]),_0x26523f);if(_0x5b8aba[_0x8696('0x30')][_0x8696('0x3c')]){_0xfbafeb[_0x8696('0x3a')]=_[_0x8696('0x3d')](_0xfbafeb[_0x8696('0x3a')],{'$or':_['map'](_0x26523f,function(_0x53a4e7){if(_0x53a4e7['type']!==_0x8696('0x3e')){var _0x592d1a={};_0x592d1a[_0x53a4e7['name']]={'$like':'%'+_0x5b8aba[_0x8696('0x30')][_0x8696('0x3c')]+'%'};return _0x592d1a;}})});}_0xfbafeb=_['merge']({},_0xfbafeb,_0x5b8aba[_0x8696('0x3f')]);var _0x379d7e={'where':_0xfbafeb[_0x8696('0x3a')]};return db[_0x8696('0x2b')]['count'](_0x379d7e)['then'](function(_0x290f95){_0x4bf421[_0x8696('0x1e')]=_0x290f95;if(_0x5b8aba['query']['includeAll']){_0xfbafeb[_0x8696('0x40')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x8696('0x41')](_0xfbafeb);})[_0x8696('0x25')](function(_0x238e4d){_0x4bf421[_0x8696('0x42')]=_0x238e4d;return _0x4bf421;})[_0x8696('0x25')](respondWithFilteredResult(_0x2e37d0,_0xfbafeb))[_0x8696('0x43')](handleError(_0x2e37d0,null));};exports[_0x8696('0x44')]=function(_0x411100,_0x2b30c0){var _0x2d26dd={'raw':!![],'where':{'id':_0x411100[_0x8696('0x45')]['id']}},_0x454f0c={};_0x454f0c[_0x8696('0x2f')]=_[_0x8696('0x31')](db[_0x8696('0x2b')]['rawAttributes']);_0x454f0c[_0x8696('0x30')]=_[_0x8696('0x31')](_0x411100[_0x8696('0x30')]);_0x454f0c[_0x8696('0x32')]=_[_0x8696('0x33')](_0x454f0c[_0x8696('0x2f')],_0x454f0c[_0x8696('0x30')]);_0x2d26dd['attributes']=_[_0x8696('0x33')](_0x454f0c['model'],qs[_0x8696('0x35')](_0x411100[_0x8696('0x30')]['fields']));_0x2d26dd[_0x8696('0x34')]=_0x2d26dd[_0x8696('0x34')]['length']?_0x2d26dd[_0x8696('0x34')]:_0x454f0c[_0x8696('0x2f')];if(_0x411100['query'][_0x8696('0x46')]){_0x2d26dd[_0x8696('0x40')]=[{'all':!![]}];}_0x2d26dd=_[_0x8696('0x3d')]({},_0x2d26dd,_0x411100[_0x8696('0x3f')]);return db[_0x8696('0x2b')][_0x8696('0x47')](_0x2d26dd)[_0x8696('0x25')](handleEntityNotFound(_0x2b30c0,null))[_0x8696('0x25')](respondWithResult(_0x2b30c0,null))[_0x8696('0x43')](handleError(_0x2b30c0,null));};exports[_0x8696('0x48')]=function(_0x55c373,_0x5aae3a){return db['OpenchannelApplication']['create'](_0x55c373[_0x8696('0x49')],{})['then'](respondWithResult(_0x5aae3a,0xc9))['catch'](handleError(_0x5aae3a,null));};exports[_0x8696('0x24')]=function(_0x4b40f7,_0x1bb822){if(_0x4b40f7[_0x8696('0x49')]['id']){delete _0x4b40f7[_0x8696('0x49')]['id'];}return db[_0x8696('0x2b')][_0x8696('0x47')]({'where':{'id':_0x4b40f7['params']['id']}})[_0x8696('0x25')](handleEntityNotFound(_0x1bb822,null))[_0x8696('0x25')](saveUpdates(_0x4b40f7['body'],null))[_0x8696('0x25')](respondWithResult(_0x1bb822,null))[_0x8696('0x43')](handleError(_0x1bb822,null));};exports['destroy']=function(_0x4e28b9,_0x51f082){return db['OpenchannelApplication'][_0x8696('0x47')]({'where':{'id':_0x4e28b9['params']['id']}})[_0x8696('0x25')](handleEntityNotFound(_0x51f082,null))[_0x8696('0x25')](removeEntity(_0x51f082,null))[_0x8696('0x43')](handleError(_0x51f082,null));}; \ No newline at end of file +var _0xaa8c=['fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes'];(function(_0x1a8dc5,_0x48d9e8){var _0x2a700c=function(_0x2c33fc){while(--_0x2c33fc){_0x1a8dc5['push'](_0x1a8dc5['shift']());}};_0x2a700c(++_0x48d9e8);}(_0xaa8c,0x14f));var _0xcaa8=function(_0x329485,_0x4f7e0d){_0x329485=_0x329485-0x0;var _0x3dd0bb=_0xaa8c[_0x329485];return _0x3dd0bb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcaa8('0x0'));var zipdir=require(_0xcaa8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcaa8('0x2'));var moment=require(_0xcaa8('0x3'));var BPromise=require(_0xcaa8('0x4'));var Mustache=require(_0xcaa8('0x5'));var util=require(_0xcaa8('0x6'));var path=require(_0xcaa8('0x7'));var sox=require(_0xcaa8('0x8'));var csv=require(_0xcaa8('0x9'));var ejs=require(_0xcaa8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xcaa8('0xb'));var crypto=require(_0xcaa8('0xc'));var jsforce=require(_0xcaa8('0xd'));var deskjs=require(_0xcaa8('0xe'));var toCsv=require(_0xcaa8('0x9'));var querystring=require(_0xcaa8('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcaa8('0x10'));var as=require(_0xcaa8('0x11'));var hardwareService=require(_0xcaa8('0x12'));var logger=require(_0xcaa8('0x13'))('api');var utils=require(_0xcaa8('0x14'));var config=require(_0xcaa8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xcaa8('0x16'))['db'];function respondWithStatusCode(_0x421543,_0x5dcc51){_0x5dcc51=_0x5dcc51||0xcc;return function(_0x266abb){if(_0x266abb){return _0x421543[_0xcaa8('0x17')](_0x5dcc51);}return _0x421543['status'](_0x5dcc51)['end']();};}function respondWithResult(_0x47b116,_0x1a7539){_0x1a7539=_0x1a7539||0xc8;return function(_0x567df4){if(_0x567df4){return _0x47b116[_0xcaa8('0x18')](_0x1a7539)[_0xcaa8('0x19')](_0x567df4);}};}function respondWithFilteredResult(_0x458ed9,_0x264fb6){return function(_0x4c06d9){if(_0x4c06d9){var _0x4553d8=typeof _0x264fb6['offset']===_0xcaa8('0x1a')&&typeof _0x264fb6['limit']===_0xcaa8('0x1a');var _0x1f0088=_0x4c06d9[_0xcaa8('0x1b')];var _0x4776c4=_0x4553d8?0x0:_0x264fb6[_0xcaa8('0x1c')];var _0x3df664=_0x4553d8?_0x4c06d9[_0xcaa8('0x1b')]:_0x264fb6[_0xcaa8('0x1c')]+_0x264fb6['limit'];var _0x188b66;if(_0x3df664>=_0x1f0088){_0x3df664=_0x1f0088;_0x188b66=0xc8;}else{_0x188b66=0xce;}_0x458ed9[_0xcaa8('0x18')](_0x188b66);return _0x458ed9[_0xcaa8('0x1d')](_0xcaa8('0x1e'),_0x4776c4+'-'+_0x3df664+'/'+_0x1f0088)[_0xcaa8('0x19')](_0x4c06d9);}return null;};}function patchUpdates(_0x925a22){return function(_0x3320cc){try{jsonpatch[_0xcaa8('0x1f')](_0x3320cc,_0x925a22,!![]);}catch(_0x54f84d){return BPromise[_0xcaa8('0x20')](_0x54f84d);}return _0x3320cc[_0xcaa8('0x21')]();};}function saveUpdates(_0x195705,_0x4bb951){return function(_0x5199b8){if(_0x5199b8){return _0x5199b8['update'](_0x195705)[_0xcaa8('0x22')](function(_0x36879a){return _0x36879a;});}return null;};}function removeEntity(_0x1b8f88,_0x4c4aff){return function(_0x1167bd){if(_0x1167bd){return _0x1167bd[_0xcaa8('0x23')]()[_0xcaa8('0x22')](function(){_0x1b8f88['status'](0xcc)[_0xcaa8('0x24')]();});}};}function handleEntityNotFound(_0x289f3d,_0x281a90){return function(_0x43c128){if(!_0x43c128){_0x289f3d[_0xcaa8('0x17')](0x194);}return _0x43c128;};}function handleError(_0x36c373,_0x2565dd){_0x2565dd=_0x2565dd||0x1f4;return function(_0xb8064e){logger[_0xcaa8('0x25')](_0xb8064e[_0xcaa8('0x26')]);if(_0xb8064e[_0xcaa8('0x27')]){delete _0xb8064e[_0xcaa8('0x27')];}_0x36c373['status'](_0x2565dd)[_0xcaa8('0x28')](_0xb8064e);};}exports[_0xcaa8('0x29')]=function(_0x531d37,_0x17f68c){var _0x2738b3={},_0x301507={},_0x2bdad3={'count':0x0,'rows':[]};var _0x22a88f=_[_0xcaa8('0x2a')](db[_0xcaa8('0x2b')][_0xcaa8('0x2c')],function(_0x78adb1){return{'name':_0x78adb1[_0xcaa8('0x2d')],'type':_0x78adb1[_0xcaa8('0x2e')][_0xcaa8('0x2f')]};});_0x301507[_0xcaa8('0x30')]=_[_0xcaa8('0x2a')](_0x22a88f,'name');_0x301507[_0xcaa8('0x31')]=_[_0xcaa8('0x32')](_0x531d37[_0xcaa8('0x31')]);_0x301507[_0xcaa8('0x33')]=_[_0xcaa8('0x34')](_0x301507[_0xcaa8('0x30')],_0x301507[_0xcaa8('0x31')]);_0x2738b3[_0xcaa8('0x35')]=_['intersection'](_0x301507[_0xcaa8('0x30')],qs[_0xcaa8('0x36')](_0x531d37['query']['fields']));_0x2738b3['attributes']=_0x2738b3[_0xcaa8('0x35')][_0xcaa8('0x37')]?_0x2738b3[_0xcaa8('0x35')]:_0x301507[_0xcaa8('0x30')];if(!_0x531d37[_0xcaa8('0x31')][_0xcaa8('0x38')]('nolimit')){_0x2738b3[_0xcaa8('0x39')]=qs[_0xcaa8('0x39')](_0x531d37[_0xcaa8('0x31')][_0xcaa8('0x39')]);_0x2738b3[_0xcaa8('0x1c')]=qs[_0xcaa8('0x1c')](_0x531d37[_0xcaa8('0x31')]['offset']);}_0x2738b3['order']=qs['sort'](_0x531d37[_0xcaa8('0x31')][_0xcaa8('0x3a')]);_0x2738b3[_0xcaa8('0x3b')]=qs['filters'](_[_0xcaa8('0x3c')](_0x531d37['query'],_0x301507[_0xcaa8('0x33')]),_0x22a88f);if(_0x531d37[_0xcaa8('0x31')][_0xcaa8('0x3d')]){_0x2738b3[_0xcaa8('0x3b')]=_['merge'](_0x2738b3[_0xcaa8('0x3b')],{'$or':_[_0xcaa8('0x2a')](_0x22a88f,function(_0x16516d){if(_0x16516d[_0xcaa8('0x2e')]!==_0xcaa8('0x3e')){var _0xc7e89c={};_0xc7e89c[_0x16516d[_0xcaa8('0x27')]]={'$like':'%'+_0x531d37[_0xcaa8('0x31')]['filter']+'%'};return _0xc7e89c;}})});}_0x2738b3=_[_0xcaa8('0x3f')]({},_0x2738b3,_0x531d37[_0xcaa8('0x40')]);var _0x6882a0={'where':_0x2738b3[_0xcaa8('0x3b')]};return db[_0xcaa8('0x2b')][_0xcaa8('0x1b')](_0x6882a0)[_0xcaa8('0x22')](function(_0x3e6a8a){_0x2bdad3[_0xcaa8('0x1b')]=_0x3e6a8a;if(_0x531d37['query'][_0xcaa8('0x41')]){_0x2738b3[_0xcaa8('0x42')]=[{'all':!![]}];}return db[_0xcaa8('0x2b')][_0xcaa8('0x43')](_0x2738b3);})[_0xcaa8('0x22')](function(_0x536d21){_0x2bdad3[_0xcaa8('0x44')]=_0x536d21;return _0x2bdad3;})[_0xcaa8('0x22')](respondWithFilteredResult(_0x17f68c,_0x2738b3))[_0xcaa8('0x45')](handleError(_0x17f68c,null));};exports[_0xcaa8('0x46')]=function(_0x33b7ca,_0x5a3260){var _0xed42c4={'raw':!![],'where':{'id':_0x33b7ca[_0xcaa8('0x47')]['id']}},_0x4b25b0={};_0x4b25b0[_0xcaa8('0x30')]=_[_0xcaa8('0x32')](db[_0xcaa8('0x2b')]['rawAttributes']);_0x4b25b0[_0xcaa8('0x31')]=_[_0xcaa8('0x32')](_0x33b7ca[_0xcaa8('0x31')]);_0x4b25b0['filters']=_['intersection'](_0x4b25b0['model'],_0x4b25b0[_0xcaa8('0x31')]);_0xed42c4[_0xcaa8('0x35')]=_[_0xcaa8('0x34')](_0x4b25b0[_0xcaa8('0x30')],qs[_0xcaa8('0x36')](_0x33b7ca[_0xcaa8('0x31')][_0xcaa8('0x36')]));_0xed42c4['attributes']=_0xed42c4[_0xcaa8('0x35')][_0xcaa8('0x37')]?_0xed42c4[_0xcaa8('0x35')]:_0x4b25b0['model'];if(_0x33b7ca[_0xcaa8('0x31')][_0xcaa8('0x41')]){_0xed42c4[_0xcaa8('0x42')]=[{'all':!![]}];}_0xed42c4=_['merge']({},_0xed42c4,_0x33b7ca[_0xcaa8('0x40')]);return db['OpenchannelApplication']['find'](_0xed42c4)[_0xcaa8('0x22')](handleEntityNotFound(_0x5a3260,null))[_0xcaa8('0x22')](respondWithResult(_0x5a3260,null))['catch'](handleError(_0x5a3260,null));};exports[_0xcaa8('0x48')]=function(_0x25bde5,_0x18e3f4){return db[_0xcaa8('0x2b')][_0xcaa8('0x48')](_0x25bde5[_0xcaa8('0x49')],{})[_0xcaa8('0x22')](respondWithResult(_0x18e3f4,0xc9))['catch'](handleError(_0x18e3f4,null));};exports[_0xcaa8('0x4a')]=function(_0x2989db,_0x39a5f7){if(_0x2989db[_0xcaa8('0x49')]['id']){delete _0x2989db['body']['id'];}return db[_0xcaa8('0x2b')][_0xcaa8('0x4b')]({'where':{'id':_0x2989db[_0xcaa8('0x47')]['id']}})[_0xcaa8('0x22')](handleEntityNotFound(_0x39a5f7,null))[_0xcaa8('0x22')](saveUpdates(_0x2989db[_0xcaa8('0x49')],null))[_0xcaa8('0x22')](respondWithResult(_0x39a5f7,null))[_0xcaa8('0x45')](handleError(_0x39a5f7,null));};exports[_0xcaa8('0x23')]=function(_0x7d804c,_0x3f3fd4){return db[_0xcaa8('0x2b')][_0xcaa8('0x4b')]({'where':{'id':_0x7d804c[_0xcaa8('0x47')]['id']}})['then'](handleEntityNotFound(_0x3f3fd4,null))[_0xcaa8('0x22')](removeEntity(_0x3f3fd4,null))['catch'](handleError(_0x3f3fd4,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 4ce7de5..bfefb6b 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 _0xc9d3=['./openchannelApplication.attributes','exports','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x300c19,_0x709d87){var _0x52ccab=function(_0x27bf6e){while(--_0x27bf6e){_0x300c19['push'](_0x300c19['shift']());}};_0x52ccab(++_0x709d87);}(_0xc9d3,0xca));var _0x3c9d=function(_0x591fb9,_0x3a72f8){_0x591fb9=_0x591fb9-0x0;var _0x43fd8c=_0xc9d3[_0x591fb9];return _0x43fd8c;};'use strict';var _=require(_0x3c9d('0x0'));var util=require(_0x3c9d('0x1'));var logger=require(_0x3c9d('0x2'))(_0x3c9d('0x3'));var moment=require('moment');var BPromise=require(_0x3c9d('0x4'));var rp=require(_0x3c9d('0x5'));var fs=require('fs');var path=require(_0x3c9d('0x6'));var rimraf=require(_0x3c9d('0x7'));var config=require('../../config/environment');var attributes=require(_0x3c9d('0x8'));module[_0x3c9d('0x9')]=function(_0x2efd34,_0x2bcd11){return _0x2efd34[_0x3c9d('0xa')](_0x3c9d('0xb'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3c9d('0xc'),'collate':_0x3c9d('0xd')});}; \ No newline at end of file +var _0x1c38=['bluebird','rimraf','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment'];(function(_0x275555,_0x13b512){var _0x419208=function(_0x38bf13){while(--_0x38bf13){_0x275555['push'](_0x275555['shift']());}};_0x419208(++_0x13b512);}(_0x1c38,0x19c));var _0x81c3=function(_0xe480f0,_0x4c0dc1){_0xe480f0=_0xe480f0-0x0;var _0x57b198=_0x1c38[_0xe480f0];return _0x57b198;};'use strict';var _=require(_0x81c3('0x0'));var util=require(_0x81c3('0x1'));var logger=require(_0x81c3('0x2'))('api');var moment=require(_0x81c3('0x3'));var BPromise=require(_0x81c3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x81c3('0x5'));var config=require('../../config/environment');var attributes=require(_0x81c3('0x6'));module[_0x81c3('0x7')]=function(_0x482719,_0x52d616){return _0x482719[_0x81c3('0x8')](_0x81c3('0x9'),attributes,{'tableName':_0x81c3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x81c3('0xb'),'collate':_0x81c3('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 03c06f2..3d4a17d 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 _0xc53d=['rpc','../../config/environment','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','catch','OpenchannelApplication','update','body','options','raw','where','then','UpdateOpenchannelApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5a7c5c,_0xf93bc2){var _0x169c40=function(_0x4c7e1c){while(--_0x4c7e1c){_0x5a7c5c['push'](_0x5a7c5c['shift']());}};_0x169c40(++_0xf93bc2);}(_0xc53d,0xe8));var _0xdc53=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc53d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdc53('0x0'));var util=require(_0xdc53('0x1'));var moment=require(_0xdc53('0x2'));var BPromise=require(_0xdc53('0x3'));var rs=require(_0xdc53('0x4'));var fs=require('fs');var Redis=require(_0xdc53('0x5'));var db=require(_0xdc53('0x6'))['db'];var utils=require(_0xdc53('0x7'));var logger=require('../../config/logger')(_0xdc53('0x8'));var config=require(_0xdc53('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdc53('0xa')][_0xdc53('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d04f7,_0x481e9d,_0xed854a){return new BPromise(function(_0x49c82a,_0x4ffe1b){return client[_0xdc53('0xc')](_0x2d04f7,_0xed854a)['then'](function(_0x306bdb){logger[_0xdc53('0xd')](_0xdc53('0xe'),_0x481e9d,_0xdc53('0xf'));logger[_0xdc53('0x10')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x481e9d,'request\x20sent',JSON['stringify'](_0x306bdb));if(_0x306bdb['error']){if(_0x306bdb['error'][_0xdc53('0x11')]===0x1f4){logger[_0xdc53('0x12')](_0xdc53('0xe'),_0x481e9d,_0x306bdb[_0xdc53('0x12')][_0xdc53('0x13')]);return _0x4ffe1b(_0x306bdb[_0xdc53('0x12')][_0xdc53('0x13')]);}logger[_0xdc53('0x12')](_0xdc53('0xe'),_0x481e9d,_0x306bdb['error'][_0xdc53('0x13')]);return _0x49c82a(_0x306bdb['error'][_0xdc53('0x13')]);}else{logger[_0xdc53('0xd')](_0xdc53('0xe'),_0x481e9d,_0xdc53('0xf'));_0x49c82a(_0x306bdb[_0xdc53('0x14')]['message']);}})[_0xdc53('0x15')](function(_0x301fc7){logger[_0xdc53('0x12')](_0xdc53('0xe'),_0x481e9d,_0x301fc7);_0x4ffe1b(_0x301fc7);});});}exports['UpdateOpenchannelApplication']=function(_0x1d7131){var _0x38448d=this;return new Promise(function(_0x46a3bb,_0x4d5a0d){return db[_0xdc53('0x16')][_0xdc53('0x17')](_0x1d7131[_0xdc53('0x18')],{'raw':_0x1d7131[_0xdc53('0x19')]?_0x1d7131[_0xdc53('0x19')][_0xdc53('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d7131[_0xdc53('0x19')]?_0x1d7131[_0xdc53('0x19')][_0xdc53('0x1b')]||null:null,'attributes':_0x1d7131[_0xdc53('0x19')]?_0x1d7131[_0xdc53('0x19')]['attributes']||null:null,'limit':_0x1d7131['options']?_0x1d7131[_0xdc53('0x19')]['limit']||null:null})[_0xdc53('0x1c')](function(_0x2906da){logger[_0xdc53('0xd')](_0xdc53('0x1d'),_0x1d7131);logger['debug']('UpdateOpenchannelApplication',_0x1d7131,JSON['stringify'](_0x2906da));_0x46a3bb(_0x2906da);})['catch'](function(_0x3e455b){logger[_0xdc53('0x12')]('UpdateOpenchannelApplication',_0x3e455b[_0xdc53('0x13')],_0x1d7131);_0x4d5a0d(_0x38448d[_0xdc53('0x12')](0x1f4,_0x3e455b[_0xdc53('0x13')]));});});}; \ No newline at end of file +var _0x48a7=['where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','http','request','then','info','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelApplication,\x20%s,\x20%s','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw'];(function(_0x14a0a0,_0x45d0cf){var _0x56b651=function(_0x1fae09){while(--_0x1fae09){_0x14a0a0['push'](_0x14a0a0['shift']());}};_0x56b651(++_0x45d0cf);}(_0x48a7,0x1a7));var _0x748a=function(_0x13d1e6,_0x4b42ef){_0x13d1e6=_0x13d1e6-0x0;var _0x18d9ae=_0x48a7[_0x13d1e6];return _0x18d9ae;};'use strict';var _=require(_0x748a('0x0'));var util=require('util');var moment=require(_0x748a('0x1'));var BPromise=require(_0x748a('0x2'));var rs=require(_0x748a('0x3'));var fs=require('fs');var Redis=require(_0x748a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x748a('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x748a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x748a('0x7')][_0x748a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2efd1c,_0x3b035c,_0x21df86){return new BPromise(function(_0x2b225c,_0x30bfc6){return client[_0x748a('0x9')](_0x2efd1c,_0x21df86)[_0x748a('0xa')](function(_0x341ff2){logger[_0x748a('0xb')]('OpenchannelApplication,\x20%s,\x20%s',_0x3b035c,_0x748a('0xc'));logger[_0x748a('0xd')](_0x748a('0xe'),_0x3b035c,_0x748a('0xc'),JSON[_0x748a('0xf')](_0x341ff2));if(_0x341ff2[_0x748a('0x10')]){if(_0x341ff2[_0x748a('0x10')][_0x748a('0x11')]===0x1f4){logger[_0x748a('0x10')]('OpenchannelApplication,\x20%s,\x20%s',_0x3b035c,_0x341ff2[_0x748a('0x10')][_0x748a('0x12')]);return _0x30bfc6(_0x341ff2[_0x748a('0x10')]['message']);}logger[_0x748a('0x10')](_0x748a('0x13'),_0x3b035c,_0x341ff2[_0x748a('0x10')][_0x748a('0x12')]);return _0x2b225c(_0x341ff2[_0x748a('0x10')][_0x748a('0x12')]);}else{logger[_0x748a('0xb')]('OpenchannelApplication,\x20%s,\x20%s',_0x3b035c,_0x748a('0xc'));_0x2b225c(_0x341ff2['result'][_0x748a('0x12')]);}})[_0x748a('0x14')](function(_0x3bd27a){logger[_0x748a('0x10')](_0x748a('0x13'),_0x3b035c,_0x3bd27a);_0x30bfc6(_0x3bd27a);});});}exports[_0x748a('0x15')]=function(_0x1c2515){var _0x4f1eb3=this;return new Promise(function(_0x22e00b,_0x66cc2a){return db[_0x748a('0x16')][_0x748a('0x17')](_0x1c2515[_0x748a('0x18')],{'raw':_0x1c2515[_0x748a('0x19')]?_0x1c2515[_0x748a('0x19')][_0x748a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c2515['options']?_0x1c2515[_0x748a('0x19')][_0x748a('0x1b')]||null:null,'attributes':_0x1c2515[_0x748a('0x19')]?_0x1c2515['options'][_0x748a('0x1c')]||null:null,'limit':_0x1c2515['options']?_0x1c2515[_0x748a('0x19')][_0x748a('0x1d')]||null:null})[_0x748a('0xa')](function(_0x4dc874){logger[_0x748a('0xb')]('UpdateOpenchannelApplication',_0x1c2515);logger['debug'](_0x748a('0x15'),_0x1c2515,JSON[_0x748a('0xf')](_0x4dc874));_0x22e00b(_0x4dc874);})[_0x748a('0x14')](function(_0xd9abe3){logger[_0x748a('0x10')]('UpdateOpenchannelApplication',_0xd9abe3[_0x748a('0x12')],_0x1c2515);_0x66cc2a(_0x4f1eb3[_0x748a('0x10')](0x1f4,_0xd9abe3[_0x748a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index a1e019b..a84357d 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 _0x69b9=['/:id','getMessages','/:id/download','download','post','create','/:id/messages','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x227edc,_0x455d6c){var _0x40d08f=function(_0x555dbc){while(--_0x555dbc){_0x227edc['push'](_0x227edc['shift']());}};_0x40d08f(++_0x455d6c);}(_0x69b9,0x199));var _0x969b=function(_0x2eb64c,_0x2bd1a4){_0x2eb64c=_0x2eb64c-0x0;var _0x46ff02=_0x69b9[_0x2eb64c];return _0x46ff02;};'use strict';var multer=require(_0x969b('0x0'));var util=require(_0x969b('0x1'));var path=require('path');var timeout=require(_0x969b('0x2'));var express=require(_0x969b('0x3'));var router=express[_0x969b('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(_0x969b('0x5'));router[_0x969b('0x6')]('/',auth[_0x969b('0x7')](),controller[_0x969b('0x8')]);router['get'](_0x969b('0x9'),auth[_0x969b('0x7')](),controller[_0x969b('0xa')]);router[_0x969b('0x6')](_0x969b('0xb'),auth[_0x969b('0x7')](),controller['show']);router['get']('/:id/messages',auth[_0x969b('0x7')](),controller[_0x969b('0xc')]);router[_0x969b('0x6')](_0x969b('0xd'),auth[_0x969b('0x7')](),controller[_0x969b('0xe')]);router[_0x969b('0xf')]('/',auth['isAuthenticated'](),controller[_0x969b('0x10')]);router['post'](_0x969b('0x11'),auth[_0x969b('0x7')](),controller['addMessage']);router[_0x969b('0xf')](_0x969b('0x12'),auth['isAuthenticated'](),interaction[_0x969b('0x13')](_0x969b('0x14'),_0x969b('0x15')),controller[_0x969b('0x16')]);router['put'](_0x969b('0xb'),auth[_0x969b('0x7')](),interaction['tracked'](_0x969b('0x14'),_0x969b('0x17')),controller[_0x969b('0x18')]);router[_0x969b('0x19')](_0x969b('0xb'),auth[_0x969b('0x7')](),interaction[_0x969b('0x13')]('openchannel',_0x969b('0x1a')),controller[_0x969b('0x1b')]);router['delete']('/:id/tags',auth['isAuthenticated'](),controller[_0x969b('0x1c')]);module[_0x969b('0x1d')]=router; \ No newline at end of file +var _0x0d02=['/:id/download','download','post','/:id/messages','addMessage','/:id/tags','tracked','openchannel','put','openchannelinteraction:update','update','openchannelinteraction:destroy','delete','removeTags','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages'];(function(_0x59a5ac,_0x572105){var _0x530973=function(_0x5dd169){while(--_0x5dd169){_0x59a5ac['push'](_0x59a5ac['shift']());}};_0x530973(++_0x572105);}(_0x0d02,0xc9));var _0x20d0=function(_0x5cba54,_0x3ffc5d){_0x5cba54=_0x5cba54-0x0;var _0x36f210=_0x0d02[_0x5cba54];return _0x36f210;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x20d0('0x0'));var timeout=require('connect-timeout');var express=require(_0x20d0('0x1'));var router=express[_0x20d0('0x2')]();var fs_extra=require(_0x20d0('0x3'));var auth=require(_0x20d0('0x4'));var interaction=require(_0x20d0('0x5'));var config=require(_0x20d0('0x6'));var controller=require(_0x20d0('0x7'));router[_0x20d0('0x8')]('/',auth[_0x20d0('0x9')](),controller[_0x20d0('0xa')]);router['get'](_0x20d0('0xb'),auth[_0x20d0('0x9')](),controller[_0x20d0('0xc')]);router[_0x20d0('0x8')](_0x20d0('0xd'),auth['isAuthenticated'](),controller[_0x20d0('0xe')]);router[_0x20d0('0x8')]('/:id/messages',auth[_0x20d0('0x9')](),controller[_0x20d0('0xf')]);router[_0x20d0('0x8')](_0x20d0('0x10'),auth[_0x20d0('0x9')](),controller[_0x20d0('0x11')]);router[_0x20d0('0x12')]('/',auth[_0x20d0('0x9')](),controller['create']);router[_0x20d0('0x12')](_0x20d0('0x13'),auth[_0x20d0('0x9')](),controller[_0x20d0('0x14')]);router[_0x20d0('0x12')](_0x20d0('0x15'),auth[_0x20d0('0x9')](),interaction[_0x20d0('0x16')](_0x20d0('0x17'),'openchannelinteraction:addtags'),controller['addTags']);router[_0x20d0('0x18')]('/:id',auth[_0x20d0('0x9')](),interaction[_0x20d0('0x16')]('openchannel',_0x20d0('0x19')),controller[_0x20d0('0x1a')]);router['delete'](_0x20d0('0xd'),auth['isAuthenticated'](),interaction[_0x20d0('0x16')]('openchannel',_0x20d0('0x1b')),controller['destroy']);router[_0x20d0('0x1c')]('/:id/tags',auth['isAuthenticated'](),controller[_0x20d0('0x1d')]);module[_0x20d0('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 2b3bde8..786e6da 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 _0x8406=['BOOLEAN','DATE','STRING','out','sequelize','exports'];(function(_0x5ad771,_0x34186f){var _0x5b5dce=function(_0x5ad0fb){while(--_0x5ad0fb){_0x5ad771['push'](_0x5ad771['shift']());}};_0x5b5dce(++_0x34186f);}(_0x8406,0x10c));var _0x6840=function(_0x4a31b1,_0x29c20a){_0x4a31b1=_0x4a31b1-0x0;var _0x42da76=_0x8406[_0x4a31b1];return _0x42da76;};'use strict';var Sequelize=require(_0x6840('0x0'));module[_0x6840('0x1')]={'closed':{'type':Sequelize[_0x6840('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6840('0x3')]},'disposition':{'type':Sequelize[_0x6840('0x4')]},'secondDisposition':{'type':Sequelize[_0x6840('0x4')]},'thirdDisposition':{'type':Sequelize[_0x6840('0x4')]},'note':{'type':Sequelize[_0x6840('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x6840('0x4')]},'externalUrl':{'type':Sequelize[_0x6840('0x4')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x6840('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x6840('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x6840('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x9489=['STRING','ENUM','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x40392b,_0x55047b){var _0x5cead8=function(_0x106a73){while(--_0x106a73){_0x40392b['push'](_0x40392b['shift']());}};_0x5cead8(++_0x55047b);}(_0x9489,0xb2));var _0x9948=function(_0x4ef4d4,_0x131cda){_0x4ef4d4=_0x4ef4d4-0x0;var _0xd62bc7=_0x9489[_0x4ef4d4];return _0xd62bc7;};'use strict';var Sequelize=require(_0x9948('0x0'));module[_0x9948('0x1')]={'closed':{'type':Sequelize[_0x9948('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9948('0x3')]},'disposition':{'type':Sequelize[_0x9948('0x4')]},'secondDisposition':{'type':Sequelize[_0x9948('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x9948('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x9948('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x9948('0x5')]('in',_0x9948('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x9948('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x9948('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index ea0ebee..1c255d1 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 _0x9298=['u.id','u.fullname','user_has_openchannel_interactions','left_join','users','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','body','buildExpression','some','compact','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','i.from\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','isEmpty','i.OpenchannelAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','Owner.internal','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','params','rawAttributes','intersection','include','merge','options','create','destroy','describe','addMessage','OpenchannelMessage','ids','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','omit','spread','Tag','emit','openchannelInteractionTags:save','removeTags','download','unix','root','tmp','join','server','files','attachments','transcript-%d-%s.zip','fullname','CmContact','lastName','Attachment','Messages','createdAt','direction','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','closed','closedAt','disposition','threadId','Public','Private','basename','existsSync','createReadStream','pipe','out','System','firstName','renderFile','views','downloadInteraction.ejs','.pdf','log','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','end','error','name','send','Users','map','TagIds','Tags','forEach','push','catch','index','OpenchannelInteraction','fieldName','type','keys','query','filters','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','field','color','from','tools_tags','select'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x9298,0x193));var _0x8929=function(_0xcf89af,_0x59ba17){_0xcf89af=_0xcf89af-0x0;var _0x24a9b7=_0x9298[_0xcf89af];return _0x24a9b7;};'use strict';var emlformat=require(_0x8929('0x0'));var rimraf=require(_0x8929('0x1'));var zipdir=require(_0x8929('0x2'));var jsonpatch=require(_0x8929('0x3'));var rp=require(_0x8929('0x4'));var moment=require(_0x8929('0x5'));var BPromise=require(_0x8929('0x6'));var Mustache=require('mustache');var util=require(_0x8929('0x7'));var path=require(_0x8929('0x8'));var sox=require(_0x8929('0x9'));var csv=require(_0x8929('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8929('0xb'));var _=require('lodash');var squel=require(_0x8929('0xc'));var crypto=require('crypto');var jsforce=require(_0x8929('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8929('0xa'));var querystring=require(_0x8929('0xe'));var Papa=require(_0x8929('0xf'));var Redis=require(_0x8929('0x10'));var authService=require(_0x8929('0x11'));var qs=require(_0x8929('0x12'));var as=require(_0x8929('0x13'));var pdf=require(_0x8929('0x14'));var hardwareService=require(_0x8929('0x15'));var logger=require(_0x8929('0x16'))(_0x8929('0x17'));var utils=require(_0x8929('0x18'));var config=require(_0x8929('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x8929('0x1a'))['db'];config[_0x8929('0x1b')]=_[_0x8929('0x1c')](config[_0x8929('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x8929('0x1d'))(new Redis(config['redis']));require('./openchannelInteraction.socket')['register'](socket);function respondWithStatusCode(_0x3226af,_0x28df03){_0x28df03=_0x28df03||0xcc;return function(_0xff634c){if(_0xff634c){return _0x3226af[_0x8929('0x1e')](_0x28df03);}return _0x3226af[_0x8929('0x1f')](_0x28df03)['end']();};}function respondWithResult(_0x1340ae,_0x4c94bc){_0x4c94bc=_0x4c94bc||0xc8;return function(_0x26c874){if(_0x26c874){return _0x1340ae[_0x8929('0x1f')](_0x4c94bc)[_0x8929('0x20')](_0x26c874);}};}function respondWithFilteredResult(_0x12647a,_0x15e4a6){return function(_0x5876f2){if(_0x5876f2){var _0x2bfe1f=typeof _0x15e4a6[_0x8929('0x21')]===_0x8929('0x22')&&typeof _0x15e4a6[_0x8929('0x23')]===_0x8929('0x22');var _0x17edf4=_0x5876f2[_0x8929('0x24')];var _0x2aefd0=_0x2bfe1f?0x0:_0x15e4a6[_0x8929('0x21')];var _0x92c9fe=_0x2bfe1f?_0x5876f2[_0x8929('0x24')]:_0x15e4a6[_0x8929('0x21')]+_0x15e4a6['limit'];var _0x1c0e44;if(_0x92c9fe>=_0x17edf4){_0x92c9fe=_0x17edf4;_0x1c0e44=0xc8;}else{_0x1c0e44=0xce;}_0x12647a['status'](_0x1c0e44);return _0x12647a[_0x8929('0x25')](_0x8929('0x26'),_0x2aefd0+'-'+_0x92c9fe+'/'+_0x17edf4)[_0x8929('0x20')](_0x5876f2);}return null;};}function patchUpdates(_0x1ba372){return function(_0x491ffa){try{jsonpatch['apply'](_0x491ffa,_0x1ba372,!![]);}catch(_0x505b78){return BPromise[_0x8929('0x27')](_0x505b78);}return _0x491ffa[_0x8929('0x28')]();};}function saveUpdates(_0x5038f5,_0x459977){return function(_0x3469e8){if(_0x3469e8){return _0x3469e8[_0x8929('0x29')](_0x5038f5)[_0x8929('0x2a')](function(_0x4bbd1f){return _0x4bbd1f;});}return null;};}function removeEntity(_0x8cb16c,_0x5830f9){return function(_0x456fc5){if(_0x456fc5){return _0x456fc5['destroy']()['then'](function(){_0x8cb16c['status'](0xcc)[_0x8929('0x2b')]();});}};}function handleEntityNotFound(_0xad1e5c,_0x4c5c9b){return function(_0xc0f3de){if(!_0xc0f3de){_0xad1e5c[_0x8929('0x1e')](0x194);}return _0xc0f3de;};}function handleError(_0x583c17,_0x62c560){_0x62c560=_0x62c560||0x1f4;return function(_0x24ba2a){logger[_0x8929('0x2c')](_0x24ba2a['stack']);if(_0x24ba2a[_0x8929('0x2d')]){delete _0x24ba2a[_0x8929('0x2d')];}_0x583c17[_0x8929('0x1f')](_0x62c560)[_0x8929('0x2e')](_0x24ba2a);};}function getInteractionUsers(_0x1aa46f,_0x483988){return new BPromise(function(_0x561399,_0x7057d2){try{if(_0x483988[_0x1aa46f['id']]){_0x1aa46f[_0x8929('0x2f')]=_[_0x8929('0x30')](_0x483988[_0x1aa46f['id']],function(_0x1ee20a){return{'id':_0x1ee20a['id'],'fullname':_0x1ee20a['fullname']};});}}catch(_0x2b0ba8){_0x7057d2(_0x2b0ba8);}_0x561399(_0x1aa46f);});}function getInteractionTags(_0x3cbb19,_0x5d5df8){return new BPromise(function(_0x5c3e46,_0x4ccc44){try{if(_0x3cbb19[_0x8929('0x31')]){_0x3cbb19[_0x8929('0x32')]=[];_0x3cbb19[_0x8929('0x31')]['split'](',')[_0x8929('0x33')](function(_0x16d107){_0x3cbb19[_0x8929('0x32')][_0x8929('0x34')](_0x5d5df8[_0x16d107]);});}delete _0x3cbb19[_0x8929('0x31')];}catch(_0x417f56){_0x4ccc44(_0x417f56);}_0x5c3e46(_0x3cbb19);});}function updateOpenchannelInteraction(_0x63fed1,_0x4411cd,_0x210afc){return new BPromise(function(_0x199a11,_0x393479){return getInteractionUsers(_0x63fed1,_0x210afc)['then'](function(_0x55004f){return getInteractionTags(_0x55004f,_0x4411cd);})[_0x8929('0x2a')](function(_0x4c759a){_0x199a11(_0x4c759a);})[_0x8929('0x35')](function(_0x4ea674){_0x393479(_0x4ea674);});});}exports[_0x8929('0x36')]=function(_0x3bd4d0,_0x1ece80){var _0x47871d={},_0xa0e88e={},_0x1d7d70={'count':0x0,'rows':[]};var _0x2f09a1=_[_0x8929('0x30')](db[_0x8929('0x37')]['rawAttributes'],function(_0x17519c){return{'name':_0x17519c[_0x8929('0x38')],'type':_0x17519c[_0x8929('0x39')]['key']};});_0xa0e88e['model']=_[_0x8929('0x30')](_0x2f09a1,_0x8929('0x2d'));_0xa0e88e['query']=_[_0x8929('0x3a')](_0x3bd4d0[_0x8929('0x3b')]);_0xa0e88e[_0x8929('0x3c')]=_['intersection'](_0xa0e88e[_0x8929('0x3d')],_0xa0e88e[_0x8929('0x3b')]);_0x47871d['attributes']=_['intersection'](_0xa0e88e[_0x8929('0x3d')],qs[_0x8929('0x3e')](_0x3bd4d0[_0x8929('0x3b')][_0x8929('0x3e')]));_0x47871d[_0x8929('0x3f')]=_0x47871d[_0x8929('0x3f')]['length']?_0x47871d[_0x8929('0x3f')]:_0xa0e88e[_0x8929('0x3d')];if(!_0x3bd4d0[_0x8929('0x3b')][_0x8929('0x40')](_0x8929('0x41'))){_0x47871d[_0x8929('0x23')]=qs[_0x8929('0x23')](_0x3bd4d0['query'][_0x8929('0x23')]);_0x47871d[_0x8929('0x21')]=qs[_0x8929('0x21')](_0x3bd4d0['query'][_0x8929('0x21')]);}_0x47871d[_0x8929('0x42')]=qs[_0x8929('0x43')](_0x3bd4d0[_0x8929('0x3b')][_0x8929('0x43')]);_0x47871d[_0x8929('0x44')]=qs[_0x8929('0x3c')](_[_0x8929('0x45')](_0x3bd4d0[_0x8929('0x3b')],_0xa0e88e[_0x8929('0x3c')]),_0x2f09a1);var _0x53ad49=[];var _0x816091=squel['select']()[_0x8929('0x46')]('id')[_0x8929('0x46')](_0x8929('0x2d'))[_0x8929('0x46')](_0x8929('0x47'))[_0x8929('0x48')](_0x8929('0x49'));var _0x39e15c=squel[_0x8929('0x4a')]()['field'](_0x8929('0x4b'))[_0x8929('0x46')](_0x8929('0x4c'))[_0x8929('0x46')]('ui.OpenchannelInteractionId')[_0x8929('0x48')](_0x8929('0x4d'),'ui')[_0x8929('0x4e')](_0x8929('0x4f'),'u','u.id\x20=\x20ui.UserId');var _0x5d9d7c=squel[_0x8929('0x4a')]()[_0x8929('0x48')](_0x8929('0x50'),'i')[_0x8929('0x4e')](_0x8929('0x51'),'c',_0x8929('0x52'))['left_join'](_0x8929('0x4f'),'o','o.id\x20=\x20i.UserId')[_0x8929('0x4e')](_0x8929('0x53'),'a',_0x8929('0x54'))[_0x8929('0x4e')](_0x8929('0x55'),'me',_0x8929('0x56'))[_0x8929('0x4e')](_0x8929('0x57'),'it',_0x8929('0x58'))['left_join'](_0x8929('0x49'),'t',_0x8929('0x59'));var _0x475a84=squel['expr']();var _0x680f95=[];var _0x123941=squel['expr']();var _0x428894;if(_0x3bd4d0[_0x8929('0x3b')][_0x8929('0x5a')]){_0x428894=as[_0x8929('0x5b')](_0x3bd4d0[_0x8929('0x3b')][_0x8929('0x5a')]);var _0x1562f7=_0x428894[_0x8929('0x5c')];for(var _0x478a68=0x0;_0x478a68<_0x428894[_0x8929('0x5d')][_0x8929('0x5e')];_0x478a68++){var _0xcbf5b7=_0x428894['conditions'][_0x478a68];var _0xf9e5f5='i';var _0x4daf25=_[_0x8929('0x5f')](_0x2f09a1,[_0x8929('0x2d'),_0xcbf5b7['field']]);if(!_0x4daf25){switch(_0xcbf5b7['field']){case _0x8929('0x60'):if(_0xcbf5b7[_0x8929('0x61')]==0x1){_0x5d9d7c[_0x8929('0x62')]('`'+_0xcbf5b7[_0x8929('0x46')]+_0x8929('0x63'));}else{_0x5d9d7c['having']('`'+_0xcbf5b7[_0x8929('0x46')]+_0x8929('0x64'));}break;case _0x8929('0x65'):if(_0xcbf5b7[_0x8929('0x66')]===_0x8929('0x67')){if(_0xcbf5b7[_0x8929('0x61')][_0x8929('0x68')]('\x20')[_0x8929('0x5e')]>0x1){_0x475a84[_0x1562f7]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0xcbf5b7[_0x8929('0x61')]),null);}else{var _0x11317d='%'+_0xcbf5b7[_0x8929('0x61')]+'%';_0x475a84[_0x1562f7](_0x8929('0x69'),_0x11317d,_0x11317d,_0x11317d);}}else{_0x4daf25=_[_0x8929('0x5f')](_0x2f09a1,[_0x8929('0x2d'),_0x8929('0x6a')]);_0xcbf5b7[_0x8929('0x46')]=_0x8929('0x6a');_0x52c48f=as['buildExpression'](_0xf9e5f5,_0x4daf25[_0x8929('0x39')],_0xcbf5b7);_0x475a84[_0x1562f7](_0x52c48f[_0x8929('0x6b')],_0x52c48f[_0x8929('0x61')][_0x8929('0x6c')],_0x52c48f['value'][_0x8929('0x2b')]);}break;case'Tag':var _0x1894ea=_0xcbf5b7[_0x8929('0x61')][_0x8929('0x68')](',')['map'](function(_0x2d0e6d){return Number(_0x2d0e6d);});_0x1894ea[_0x8929('0x33')](function(_0xc32a1b){_0x123941['or'](_0x8929('0x6d'),'%,'+_0xc32a1b+',%');});_0x680f95=_[_0x8929('0x6e')](_0x680f95,_0x1894ea);break;case _0x8929('0x6f'):if(_0xcbf5b7[_0x8929('0x66')]===_0x8929('0x67')){_0x475a84[_0x1562f7]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0xcbf5b7[_0x8929('0x61')]+'%',null);}else{_0x4daf25=_[_0x8929('0x5f')](_0x2f09a1,['name',_0x8929('0x70')]);_0xcbf5b7[_0x8929('0x46')]=_0x8929('0x70');_0x52c48f=as['buildExpression'](_0xf9e5f5,_0x4daf25[_0x8929('0x39')],_0xcbf5b7);_0x475a84[_0x1562f7](_0x52c48f[_0x8929('0x6b')],_0x52c48f[_0x8929('0x61')][_0x8929('0x6c')],_0x52c48f[_0x8929('0x61')][_0x8929('0x2b')]);}break;case _0x8929('0x71'):_0x52c48f=as[_0x8929('0x72')]('me',null,_0xcbf5b7);_0x475a84[_0x1562f7](_0x52c48f[_0x8929('0x6b')],_0x52c48f[_0x8929('0x61')][_0x8929('0x6c')],_0x52c48f[_0x8929('0x61')][_0x8929('0x2b')]);break;}}else{var _0x52c48f=as[_0x8929('0x72')](_0xf9e5f5,_0x4daf25[_0x8929('0x39')],_0xcbf5b7);_0x475a84[_0x1562f7](_0x52c48f[_0x8929('0x6b')],_0x52c48f[_0x8929('0x61')]['start'],_0x52c48f['value']['end']);}}}else{var _0x218302=_(_0x3bd4d0[_0x8929('0x3b')])[_0x8929('0x3a')]()[_0x8929('0x30')](function(_0x6ca829){return _[_0x8929('0x73')](_0x2f09a1,[_0x8929('0x2d'),_0x6ca829])?_0x6ca829:undefined;})[_0x8929('0x74')]()[_0x8929('0x61')]();if(!_['isEmpty'](_0x218302)){_0x218302[_0x8929('0x33')](function(_0x5dbd30){if(_0x5dbd30===_0x8929('0x75')){_0x5d9d7c[_0x8929('0x44')](_0x8929('0x76'),[][_0x8929('0x77')](_0x3bd4d0['query'][_0x5dbd30]));}else if(_0x5dbd30==='createdAt'){var _0x119553=JSON['parse'](_0x3bd4d0[_0x8929('0x3b')][_0x5dbd30])[_0x8929('0x78')];var _0x139b45=JSON[_0x8929('0x79')](_0x3bd4d0[_0x8929('0x3b')][_0x5dbd30])[_0x8929('0x7a')];_0x5d9d7c[_0x8929('0x44')](_0x8929('0x7b'),_0x119553,_0x139b45);}else{if(_0x3bd4d0[_0x8929('0x3b')][_0x5dbd30]===_0x8929('0x7c')){_0x5d9d7c[_0x8929('0x44')]('i.'+_0x5dbd30+'\x20IS\x20NULL');}else{_0x5d9d7c[_0x8929('0x44')]('i.'+_0x5dbd30+'\x20=\x20?',_0x3bd4d0[_0x8929('0x3b')][_0x5dbd30]);}}});}if(_0x3bd4d0['query'][_0x8929('0x7d')]){if(_0x3bd4d0[_0x8929('0x3b')][_0x8929('0x7d')]==0x1){_0x5d9d7c[_0x8929('0x62')](_0x8929('0x7e'));}else{_0x5d9d7c[_0x8929('0x62')](_0x8929('0x7f'));}}if(_0x3bd4d0['query'][_0x8929('0x80')]){_0x680f95=_['isArray'](_0x3bd4d0[_0x8929('0x3b')]['tag'])?_0x3bd4d0['query'][_0x8929('0x80')]:new Array(_0x3bd4d0[_0x8929('0x3b')][_0x8929('0x80')]);_0x680f95['forEach'](function(_0x4495da){_0x123941['or'](_0x8929('0x6d'),'%,'+_0x4495da+',%');});}if(_0x3bd4d0[_0x8929('0x3b')]['filter']){var _0x2b980d=_0x3bd4d0[_0x8929('0x3b')][_0x8929('0x81')][_0x8929('0x82')]('\x5c','\x5c\x5c')[_0x8929('0x82')](/'/g,'\x27\x27');if(qs[_0x8929('0x83')](_0x2b980d)){_0x475a84['or']('i.id\x20LIKE\x20?',_0x2b980d+'%');}else{_0x475a84['or'](_0x8929('0x84'),qs[_0x8929('0x85')](_0x2b980d))['or'](_0x8929('0x86'),_0x2b980d+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x2b980d+'%');}}}_0x5d9d7c[_0x8929('0x44')](_0x475a84);_0x5d9d7c[_0x8929('0x87')](_0x8929('0x88'));var _0x2b0554={'type':db[_0x8929('0x89')][_0x8929('0x8a')][_0x8929('0x8b')],'raw':!![]};var _0x248ca1=_0x5d9d7c['clone']();_0x248ca1[_0x8929('0x46')]('i.id');_0x248ca1['field'](_0x8929('0x8c'),_0x8929('0x60'));if(_0x47871d[_0x8929('0x42')]){_0x47871d[_0x8929('0x42')][_0x8929('0x33')](function(_0x490a0d){var _0x380bbf=_0x490a0d[0x0]===_0x8929('0x8d')?_0x490a0d[0x0]:'i.'+_0x490a0d[0x0];_0x5d9d7c[_0x8929('0x42')](_0x380bbf,_0x490a0d[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x680f95)){_0x5d9d7c[_0x8929('0x62')](_0x123941);_0x248ca1[_0x8929('0x44')]('t.id\x20IN\x20?',_0x680f95);}BPromise[_0x8929('0x8e')]()['then'](function(){if(!_0x428894){if(_0x3bd4d0['query']['OpenchannelAccountId'])return;_0x248ca1[_0x8929('0x44')](_0x8929('0x8f'));_0x5d9d7c[_0x8929('0x44')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x3bd4d0[_0x8929('0x90')]['role']!=='agent')return;return _0x3bd4d0['user'][_0x8929('0x91')]({'attributes':['id'],'raw':!![]})['then'](function(_0x160529){if(_[_0x8929('0x92')](_0x160529)){_0x248ca1[_0x8929('0x44')](_0x8929('0x93'));_0x5d9d7c[_0x8929('0x44')](_0x8929('0x93'));}else{_0x248ca1[_0x8929('0x44')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x8929('0x30')](_0x160529,'id'));_0x5d9d7c[_0x8929('0x44')](_0x8929('0x76'),_[_0x8929('0x30')](_0x160529,'id'));}});})['then'](function(){if(_0x3bd4d0[_0x8929('0x90')][_0x8929('0x94')]==='agent'&&!_0x428894&&!_0x3bd4d0[_0x8929('0x3b')][_0x8929('0x75')])return[];return db[_0x8929('0x95')][_0x8929('0x3b')](_0x248ca1[_0x8929('0x96')](),_0x2b0554);})[_0x8929('0x2a')](function(_0x220c9a){_0x1d7d70[_0x8929('0x24')]=_0x220c9a[_0x8929('0x5e')];if(_0x1d7d70[_0x8929('0x24')]===0x0)return[];return db[_0x8929('0x95')]['query'](_0x816091[_0x8929('0x96')](),_0x2b0554)[_0x8929('0x2a')](function(_0x2dd6b7){_0x53ad49=_[_0x8929('0x97')](_0x2dd6b7,'id');_0x2b0554=_['merge'](_0x2b0554,{'model':db[_0x8929('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3bd4d0[_0x8929('0x3b')][_0x8929('0x3e')]){_0x47871d['attributes']['forEach'](function(_0x568809){_0x5d9d7c[_0x8929('0x46')]('i.'+_0x568809);});}else{_0x5d9d7c[_0x8929('0x46')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x8929('0x60'));_0x5d9d7c['field']('a.key',_0x8929('0x98'));_0x5d9d7c[_0x8929('0x46')](_0x8929('0x99'),_0x8929('0x9a'));_0x5d9d7c[_0x8929('0x46')](_0x8929('0x9b'),_0x8929('0x8d'));_0x5d9d7c[_0x8929('0x46')]('i.*');_0x5d9d7c['field'](_0x8929('0x9c'),_0x8929('0x9d'));_0x5d9d7c[_0x8929('0x46')](_0x8929('0x9e'),_0x8929('0x9f'));_0x5d9d7c[_0x8929('0x46')](_0x8929('0xa0'),_0x8929('0xa1'));_0x5d9d7c[_0x8929('0x46')]('c.phone',_0x8929('0xa2'));_0x5d9d7c[_0x8929('0x46')](_0x8929('0xa3'),_0x8929('0xa4'));_0x5d9d7c[_0x8929('0x46')]('c.fax','Contact.fax');_0x5d9d7c[_0x8929('0x46')](_0x8929('0xa5'),_0x8929('0xa6'));_0x5d9d7c[_0x8929('0x46')]('o.internal',_0x8929('0xa7'));_0x5d9d7c[_0x8929('0x46')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x47871d[_0x8929('0x23')])_0x5d9d7c[_0x8929('0x23')](_0x47871d[_0x8929('0x23')]);if(_0x47871d[_0x8929('0x21')])_0x5d9d7c[_0x8929('0x21')](_0x47871d['offset']);return db[_0x8929('0x95')][_0x8929('0x3b')](_0x5d9d7c[_0x8929('0x96')](),_0x2b0554);})['then'](function(_0x5d5c7d){if(_0x5d5c7d['length']>0x0)_0x39e15c[_0x8929('0x44')](_0x8929('0xa8'),_[_0x8929('0x30')](_0x5d5c7d,'id'));return db['sequelize'][_0x8929('0x3b')](_0x39e15c[_0x8929('0x96')](),_0x2b0554)['then'](function(_0x413821){var _0x3f6c9f=_[_0x8929('0xa9')](_0x413821,_0x8929('0xaa'));var _0x53d120=[];_0x5d5c7d[_0x8929('0x33')](function(_0x4d33ad){_0x53d120[_0x8929('0x34')](updateOpenchannelInteraction(_0x4d33ad,_0x53ad49,_0x3f6c9f));});return BPromise[_0x8929('0xab')](_0x53d120);});});})['then'](function(_0x531341){_0x1d7d70[_0x8929('0xac')]=_0x531341;return _0x1d7d70;})[_0x8929('0x2a')](respondWithFilteredResult(_0x1ece80,_0x47871d))['catch'](handleError(_0x1ece80,null));};exports['show']=function(_0x4c5021,_0x42dd05){var _0x253134={};if(_0x4c5021['query'][_0x8929('0x39')]&&_0x4c5021[_0x8929('0x3b')][_0x8929('0x39')]==='from'){_0x253134[_0x8929('0x48')]=_0x4c5021[_0x8929('0xad')]['id'];}else{_0x253134['id']=_0x4c5021['params']['id'];}var _0x24354b={'raw':![],'where':_0x253134},_0x2eade5={};_0x2eade5['model']=_[_0x8929('0x3a')](db[_0x8929('0x37')][_0x8929('0xae')]);_0x2eade5['query']=_[_0x8929('0x3a')](_0x4c5021['query']);_0x2eade5[_0x8929('0x3c')]=_[_0x8929('0xaf')](_0x2eade5['model'],_0x2eade5[_0x8929('0x3b')]);_0x24354b[_0x8929('0x3f')]=_[_0x8929('0xaf')](_0x2eade5['model'],qs['fields'](_0x4c5021[_0x8929('0x3b')][_0x8929('0x3e')]));_0x24354b['attributes']=_0x24354b[_0x8929('0x3f')][_0x8929('0x5e')]?_0x24354b[_0x8929('0x3f')]:_0x2eade5['model'];if(_0x4c5021[_0x8929('0x3b')]['includeAll']){_0x24354b[_0x8929('0xb0')]=[{'all':!![]}];}_0x24354b=_[_0x8929('0xb1')]({},_0x24354b,_0x4c5021[_0x8929('0xb2')]);return db[_0x8929('0x37')][_0x8929('0x5f')](_0x24354b)[_0x8929('0x2a')](handleEntityNotFound(_0x42dd05,null))[_0x8929('0x2a')](respondWithResult(_0x42dd05,null))[_0x8929('0x35')](handleError(_0x42dd05,null));};exports['create']=function(_0x317148,_0xcab89c){return db['OpenchannelInteraction'][_0x8929('0xb3')](_0x317148[_0x8929('0x71')],{})[_0x8929('0x2a')](respondWithResult(_0xcab89c,0xc9))['catch'](handleError(_0xcab89c,null));};exports[_0x8929('0x29')]=function(_0x284ab1,_0x474cc0){if(_0x284ab1['body']['id']){delete _0x284ab1[_0x8929('0x71')]['id'];}return db[_0x8929('0x37')]['find']({'where':{'id':_0x284ab1[_0x8929('0xad')]['id']}})[_0x8929('0x2a')](handleEntityNotFound(_0x474cc0,null))[_0x8929('0x2a')](saveUpdates(_0x284ab1['body'],null))[_0x8929('0x2a')](respondWithResult(_0x474cc0,null))[_0x8929('0x35')](handleError(_0x474cc0,null));};exports[_0x8929('0xb4')]=function(_0x532820,_0x17f9ed){return db[_0x8929('0x37')][_0x8929('0x5f')]({'where':{'id':_0x532820[_0x8929('0xad')]['id']}})['then'](handleEntityNotFound(_0x17f9ed,null))[_0x8929('0x2a')](removeEntity(_0x17f9ed,null))[_0x8929('0x35')](handleError(_0x17f9ed,null));};exports[_0x8929('0xb5')]=function(_0x950aea,_0x2afc5a){return db[_0x8929('0x37')]['describe']()[_0x8929('0x2a')](respondWithResult(_0x2afc5a,null))['catch'](handleError(_0x2afc5a,null));};exports[_0x8929('0xb6')]=function(_0x5926ab,_0x4cf276,_0x2ce60b){return db[_0x8929('0xb7')][_0x8929('0x5f')]({'where':{'id':_0x5926ab[_0x8929('0xad')]['id']}})['then'](handleEntityNotFound(_0x4cf276,null))[_0x8929('0x2a')](function(_0x21be1e){if(_0x21be1e){return _0x21be1e[_0x8929('0xb6')](_0x5926ab[_0x8929('0x71')]['ids'],_['omit'](_0x5926ab['body'],[_0x8929('0xb8'),'id'])||{});}})[_0x8929('0x2a')](respondWithResult(_0x4cf276,null))['catch'](handleError(_0x4cf276,null));};exports['getMessages']=function(_0x372894,_0x1ec451,_0x23ea59){var _0x2afc75={'raw':![],'where':{}};var _0x434fa3={};var _0x58999b={'count':0x0,'rows':[]};return db[_0x8929('0x37')]['findOne']({'where':{'id':_0x372894['params']['id']}})[_0x8929('0x2a')](handleEntityNotFound(_0x1ec451,null))[_0x8929('0x2a')](function(_0x5116c5){if(_0x5116c5){_0x434fa3[_0x8929('0x3d')]=_[_0x8929('0x3a')](db[_0x8929('0xb7')]['rawAttributes']);_0x434fa3[_0x8929('0x3b')]=_['keys'](_0x372894[_0x8929('0x3b')]);_0x434fa3[_0x8929('0x3c')]=_[_0x8929('0xaf')](_0x434fa3[_0x8929('0x3d')],_0x434fa3[_0x8929('0x3b')]);_0x2afc75['attributes']=_[_0x8929('0xaf')](_0x434fa3[_0x8929('0x3d')],qs[_0x8929('0x3e')](_0x372894[_0x8929('0x3b')][_0x8929('0x3e')]));_0x2afc75['attributes']=_0x2afc75[_0x8929('0x3f')][_0x8929('0x5e')]?_0x2afc75[_0x8929('0x3f')]:_0x434fa3[_0x8929('0x3d')];if(!_0x372894[_0x8929('0x3b')]['hasOwnProperty'](_0x8929('0x41'))){_0x2afc75[_0x8929('0x23')]=qs[_0x8929('0x23')](_0x372894[_0x8929('0x3b')][_0x8929('0x23')]);_0x2afc75[_0x8929('0x21')]=qs[_0x8929('0x21')](_0x372894[_0x8929('0x3b')][_0x8929('0x21')]);}_0x2afc75['order']=qs[_0x8929('0x43')](_0x372894[_0x8929('0x3b')][_0x8929('0x43')]);_0x2afc75[_0x8929('0x44')]=qs['filters'](_[_0x8929('0x45')](_0x372894[_0x8929('0x3b')],_0x434fa3[_0x8929('0x3c')]));_0x2afc75[_0x8929('0x44')][_0x8929('0xaa')]=_0x5116c5['id'];if(_0x372894[_0x8929('0x3b')]['filter']){_0x2afc75[_0x8929('0x44')]=_[_0x8929('0xb1')](_0x2afc75[_0x8929('0x44')],{'$or':_[_0x8929('0x30')](_0x2afc75['attributes'],function(_0x5c3809){var _0x28e090={};_0x28e090[_0x5c3809]={'$like':'%'+_0x372894[_0x8929('0x3b')][_0x8929('0x81')]+'%'};return _0x28e090;})});}if(_0x372894['query'][_0x8929('0x78')]){var _0x28a791=_0x372894[_0x8929('0x3b')][_0x8929('0x78')]['split'](',');var _0xdabee7={};_0xdabee7[_0x28a791[0x0]]={'$gte':moment(_0x28a791[0x1])[_0x8929('0xb9')](_0x8929('0xba'))};_0x2afc75[_0x8929('0x44')]=_[_0x8929('0xb1')](_0x2afc75['where'],_0xdabee7);}_0x2afc75=_[_0x8929('0xb1')]({},_0x2afc75,_0x372894[_0x8929('0xb2')]);return db[_0x8929('0xb7')]['count']({'where':_0x2afc75[_0x8929('0x44')]})[_0x8929('0x2a')](function(_0x55de85){_0x58999b['count']=_0x55de85;if(_0x372894[_0x8929('0x3b')][_0x8929('0xbb')]){_0x2afc75[_0x8929('0xb0')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x8929('0xbc')](_0x2afc75);})[_0x8929('0x2a')](function(_0x1824bf){_0x58999b['rows']=_0x1824bf;return _0x58999b;});}})[_0x8929('0x2a')](respondWithFilteredResult(_0x1ec451,_0x2afc75))['catch'](handleError(_0x1ec451,null));};exports[_0x8929('0xbd')]=function(_0x2e71c1,_0x5d45ef,_0x391423){return db[_0x8929('0x37')][_0x8929('0x5f')]({'where':{'id':_0x2e71c1[_0x8929('0xad')]['id']}})[_0x8929('0x2a')](handleEntityNotFound(_0x5d45ef,null))[_0x8929('0x2a')](function(_0xf810f1){if(_0xf810f1){return _0xf810f1[_0x8929('0xbe')](_0x2e71c1[_0x8929('0x71')][_0x8929('0xb8')],_[_0x8929('0xbf')](_0x2e71c1[_0x8929('0x71')],[_0x8929('0xb8'),'id'])||{})[_0x8929('0xc0')](function(){return db[_0x8929('0xc1')][_0x8929('0xbc')]({'attributes':['id',_0x8929('0x2d'),'color'],'where':{'id':_0x2e71c1[_0x8929('0x71')][_0x8929('0xb8')]}});})[_0x8929('0x2a')](function(_0x42fd3d){socket[_0x8929('0xc2')](_0x8929('0xc3'),{'id':Number(_0x2e71c1[_0x8929('0xad')]['id']),'tags':_0x42fd3d||[]});return{'id':Number(_0x2e71c1[_0x8929('0xad')]['id']),'tags':_0x42fd3d||[]};});}})[_0x8929('0x2a')](respondWithResult(_0x5d45ef,null))[_0x8929('0x35')](handleError(_0x5d45ef,null));};exports[_0x8929('0xc4')]=function(_0x4ef614,_0x38a76c,_0x510ece){return db[_0x8929('0x37')]['find']({'where':{'id':_0x4ef614[_0x8929('0xad')]['id']}})[_0x8929('0x2a')](handleEntityNotFound(_0x38a76c,null))[_0x8929('0x2a')](function(_0x1ab84f){if(_0x1ab84f){return _0x1ab84f[_0x8929('0xc4')](_0x4ef614[_0x8929('0x3b')][_0x8929('0xb8')]);}})[_0x8929('0x2a')](respondWithStatusCode(_0x38a76c,null))['catch'](handleError(_0x38a76c,null));};exports[_0x8929('0xc5')]=function(_0x4429c8,_0x45d509){var _0x5e02c5=moment()[_0x8929('0xc6')]()[_0x8929('0x96')]();var _0x562871=path['join'](config[_0x8929('0xc7')],'server','files',_0x8929('0xc8'));var _0x3cd1c7=path[_0x8929('0xc9')](config[_0x8929('0xc7')],_0x8929('0xca'),_0x8929('0xcb'),_0x8929('0xcc'));var _0x5e0c6e=path[_0x8929('0xc9')](_0x562871,_0x5e02c5);var _0x54413a=util[_0x8929('0xb9')](_0x8929('0xcd'),_0x4429c8[_0x8929('0xad')]['id'],_0x5e02c5);var _0x5870d2=path[_0x8929('0xc9')](_0x562871,_0x54413a);var _0x3fd475=[];_0x3fd475[_0x8929('0x34')]({'model':db[_0x8929('0x6f')],'as':_0x8929('0x6f'),'attributes':['id',_0x8929('0xce')],'raw':!![]});_0x3fd475[_0x8929('0x34')]({'model':db[_0x8929('0xcf')],'as':_0x8929('0x65'),'attributes':['id','firstName',_0x8929('0xd0')],'raw':!![]});if(_0x4429c8[_0x8929('0x3b')][_0x8929('0xcc')]){_0x3fd475[_0x8929('0x34')]({'model':db[_0x8929('0xd1')],'as':'Attachment','raw':!![]});}var _0x4bbb01=[{'model':db['OpenchannelMessage'],'as':_0x8929('0xd2'),'attributes':['id','body',_0x8929('0xd3'),_0x8929('0xd4'),_0x8929('0xd5'),_0x8929('0x7d')],'include':_0x3fd475}];_0x4bbb01[_0x8929('0x34')]({'model':db[_0x8929('0xd6')],'as':_0x8929('0xd7'),'attributes':['id','name']});_0x4bbb01[_0x8929('0x34')]({'model':db[_0x8929('0x6f')],'as':_0x8929('0xd8'),'attributes':['id',_0x8929('0xce')]});return db[_0x8929('0x37')][_0x8929('0x5f')]({'where':{'id':_0x4429c8[_0x8929('0xad')]['id']},'include':_0x4bbb01})[_0x8929('0x2a')](handleEntityNotFound(_0x45d509,null))['then'](function(_0xf15b0b){if(_0xf15b0b){var _0x3a104f=_0xf15b0b[_0x8929('0xd9')]({'plain':!![]});fs[_0x8929('0xda')](_0x5e0c6e);var _0x4ba465={'channel':_0x8929('0xdb'),'account':_0x3a104f[_0x8929('0xd7')][_0x8929('0x2d')],'agent':_0x3a104f[_0x8929('0xd8')]?_0x3a104f[_0x8929('0xd8')][_0x8929('0xce')]:_0x8929('0xdc'),'createdAt':moment(_0x3a104f[_0x8929('0xd3')])['format'](_0x8929('0xba'))[_0x8929('0x96')](),'closedAt':_0x3a104f[_0x8929('0xdd')]?moment(_0x3a104f[_0x8929('0xde')])[_0x8929('0xb9')](_0x8929('0xba'))[_0x8929('0x96')]():'','disposition':_0x3a104f[_0x8929('0xdf')],'visibility':_0x3a104f[_0x8929('0xe0')]?_0x8929('0xe1'):_0x8929('0xe2'),'messages':_(_0x3a104f[_0x8929('0xd2')])[_0x8929('0x81')]({'secret':![]})['map'](function(_0x1dcbd6){if(_0x1dcbd6[_0x8929('0xd1')]){var _0x11b88f=path[_0x8929('0xc9')](_0x3cd1c7,_0x1dcbd6[_0x8929('0xd1')][_0x8929('0xe3')]);if(fs[_0x8929('0xe4')](_0x11b88f)){fs[_0x8929('0xe5')](_0x11b88f)[_0x8929('0xe6')](fs['createWriteStream'](path['join'](_0x5e0c6e,_0x1dcbd6['Attachment'][_0x8929('0xe3')])));}}return{'date':moment(_0x1dcbd6[_0x8929('0xd3')])[_0x8929('0xb9')](_0x8929('0xba'))[_0x8929('0x96')](),'sender':_0x1dcbd6[_0x8929('0xd4')]===_0x8929('0xe7')?_0x1dcbd6[_0x8929('0x6f')]?_0x1dcbd6[_0x8929('0x6f')][_0x8929('0xce')]:_0x8929('0xe8'):_0x1dcbd6[_0x8929('0x65')][_0x8929('0xe9')]+(_0x1dcbd6[_0x8929('0x65')][_0x8929('0xd0')]?'\x20'+_0x1dcbd6[_0x8929('0x65')]['lastName']:''),'body':_0x1dcbd6[_0x8929('0xd1')]?_0x1dcbd6[_0x8929('0xd1')][_0x8929('0xe3')]:_0x1dcbd6[_0x8929('0x71')],'direction':_0x1dcbd6[_0x8929('0xd4')]===_0x8929('0xe7')?'A':'C','secret':_0x1dcbd6[_0x8929('0xd5')],'read':_0x1dcbd6[_0x8929('0x7d')],'attachment':_0x1dcbd6[_0x8929('0xd1')]};})[_0x8929('0x61')]()};return ejs[_0x8929('0xea')](path[_0x8929('0xc9')](config[_0x8929('0xc7')],_0x8929('0xca'),_0x8929('0xeb'),_0x8929('0xec')),{'interaction':_0x4ba465})[_0x8929('0x2a')](function(_0x124a9c){var _0x2f4615=path[_0x8929('0xc9')](_0x5e0c6e,'transcript-'+_0x3a104f['id']+'-'+_0x5e02c5+_0x8929('0xed'));var _0x543238={'path':_0x2f4615,'channel':_0x8929('0xdb'),'interactionId':_0x3a104f['id']};return pdf['createPdfFromHTML'](_0x124a9c,_0x543238);})[_0x8929('0x2a')](function(){return new BPromise(function(_0x2bd482,_0x20a493){zipdir(_0x5e0c6e,{'saveTo':_0x5870d2},function(_0x13495b,_0x23654f){if(_0x13495b)return _0x20a493(_0x13495b);return _0x2bd482(_0x23654f);});})[_0x8929('0x2a')](function(){return new BPromise(function(_0x472298,_0x38f5b0){rimraf(_0x5e0c6e,function(_0x46b24e){if(_0x46b24e)_0x38f5b0(_0x46b24e);return _0x472298();});});})['then'](function(){return _0x45d509[_0x8929('0xc5')](_0x5870d2,_0x54413a,function(_0x14a749){if(_0x14a749){console[_0x8929('0xee')]('err',_0x14a749);}else{fs['unlinkSync'](_0x5870d2);}});});});}else{return _0x45d509['sendStatus'](0xc8);}})[_0x8929('0x35')](handleError(_0x45d509,null));}; \ No newline at end of file +var _0xf133=['where','select','field','color','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','left_join','users','openchannel_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','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?','find','ContactId','buildExpression','type','start','Tag','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','compact','isEmpty','forEach','OpenchannelAccountId','concat','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','group','Sequelize','QueryTypes','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','toString','length','sequelize','keyBy','merge','OpenchannelInteraction','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','all','rows','show','params','includeAll','include','create','body','describe','addMessage','OpenchannelMessage','ids','omit','hasOwnProperty','pick','OpenchannelInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','emit','removeTags','unix','join','root','server','files','tmp','transcript-%d-%s.zip','CmContact','firstName','lastName','attachments','Attachment','Messages','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','closed','closedAt','Public','Private','basename','createReadStream','pipe','createWriteStream','direction','out','System','views','downloadInteraction.ejs','download','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','reject','save','update','sendStatus','error','stack','name','Users','map','fullname','TagIds','split','Tags','push','then','catch','index','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort'];(function(_0x10fae2,_0x389018){var _0x7bf995=function(_0x3576f9){while(--_0x3576f9){_0x10fae2['push'](_0x10fae2['shift']());}};_0x7bf995(++_0x389018);}(_0xf133,0x18c));var _0x3f13=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xf133[_0x2235bf];return _0x4c3a64;};'use strict';var emlformat=require(_0x3f13('0x0'));var rimraf=require(_0x3f13('0x1'));var zipdir=require(_0x3f13('0x2'));var jsonpatch=require(_0x3f13('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3f13('0x4'));var Mustache=require(_0x3f13('0x5'));var util=require('util');var path=require(_0x3f13('0x6'));var sox=require('sox');var csv=require(_0x3f13('0x7'));var ejs=require(_0x3f13('0x8'));var fs=require('fs');var fs_extra=require(_0x3f13('0x9'));var _=require(_0x3f13('0xa'));var squel=require(_0x3f13('0xb'));var crypto=require(_0x3f13('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3f13('0xd'));var toCsv=require(_0x3f13('0x7'));var querystring=require(_0x3f13('0xe'));var Papa=require('papaparse');var Redis=require(_0x3f13('0xf'));var authService=require(_0x3f13('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3f13('0x11'));var pdf=require(_0x3f13('0x12'));var hardwareService=require(_0x3f13('0x13'));var logger=require(_0x3f13('0x14'))(_0x3f13('0x15'));var utils=require('../../config/utils');var config=require(_0x3f13('0x16'));var licenseUtil=require(_0x3f13('0x17'));var db=require(_0x3f13('0x18'))['db'];config[_0x3f13('0x19')]=_[_0x3f13('0x1a')](config['redis'],{'host':_0x3f13('0x1b'),'port':0x18eb});var socket=require(_0x3f13('0x1c'))(new Redis(config[_0x3f13('0x19')]));require('./openchannelInteraction.socket')[_0x3f13('0x1d')](socket);function respondWithStatusCode(_0x3e0af2,_0x1a87eb){_0x1a87eb=_0x1a87eb||0xcc;return function(_0x5d80d1){if(_0x5d80d1){return _0x3e0af2['sendStatus'](_0x1a87eb);}return _0x3e0af2[_0x3f13('0x1e')](_0x1a87eb)[_0x3f13('0x1f')]();};}function respondWithResult(_0x5612aa,_0x7cd02a){_0x7cd02a=_0x7cd02a||0xc8;return function(_0x237bc8){if(_0x237bc8){return _0x5612aa[_0x3f13('0x1e')](_0x7cd02a)[_0x3f13('0x20')](_0x237bc8);}};}function respondWithFilteredResult(_0x1806e6,_0x4daa9d){return function(_0x3cbe36){if(_0x3cbe36){var _0x14b9f1=typeof _0x4daa9d[_0x3f13('0x21')]===_0x3f13('0x22')&&typeof _0x4daa9d[_0x3f13('0x23')]===_0x3f13('0x22');var _0x2972b0=_0x3cbe36[_0x3f13('0x24')];var _0x19b1da=_0x14b9f1?0x0:_0x4daa9d[_0x3f13('0x21')];var _0x18b282=_0x14b9f1?_0x3cbe36[_0x3f13('0x24')]:_0x4daa9d[_0x3f13('0x21')]+_0x4daa9d[_0x3f13('0x23')];var _0x509ee5;if(_0x18b282>=_0x2972b0){_0x18b282=_0x2972b0;_0x509ee5=0xc8;}else{_0x509ee5=0xce;}_0x1806e6['status'](_0x509ee5);return _0x1806e6[_0x3f13('0x25')]('Content-Range',_0x19b1da+'-'+_0x18b282+'/'+_0x2972b0)[_0x3f13('0x20')](_0x3cbe36);}return null;};}function patchUpdates(_0x2b62b0){return function(_0x3afab6){try{jsonpatch['apply'](_0x3afab6,_0x2b62b0,!![]);}catch(_0x46fbaa){return BPromise[_0x3f13('0x26')](_0x46fbaa);}return _0x3afab6[_0x3f13('0x27')]();};}function saveUpdates(_0x412ea5,_0x1ac320){return function(_0x4ba7b2){if(_0x4ba7b2){return _0x4ba7b2[_0x3f13('0x28')](_0x412ea5)['then'](function(_0x5df9b1){return _0x5df9b1;});}return null;};}function removeEntity(_0x51fe40,_0x4638c5){return function(_0x4e42f9){if(_0x4e42f9){return _0x4e42f9['destroy']()['then'](function(){_0x51fe40[_0x3f13('0x1e')](0xcc)[_0x3f13('0x1f')]();});}};}function handleEntityNotFound(_0x5bb577,_0x10e707){return function(_0x1f335c){if(!_0x1f335c){_0x5bb577[_0x3f13('0x29')](0x194);}return _0x1f335c;};}function handleError(_0x55f9d5,_0x1ecb16){_0x1ecb16=_0x1ecb16||0x1f4;return function(_0x233932){logger[_0x3f13('0x2a')](_0x233932[_0x3f13('0x2b')]);if(_0x233932[_0x3f13('0x2c')]){delete _0x233932[_0x3f13('0x2c')];}_0x55f9d5[_0x3f13('0x1e')](_0x1ecb16)['send'](_0x233932);};}function getInteractionUsers(_0x1a1483,_0x247057){return new BPromise(function(_0x149550,_0x3bf14f){try{if(_0x247057[_0x1a1483['id']]){_0x1a1483[_0x3f13('0x2d')]=_[_0x3f13('0x2e')](_0x247057[_0x1a1483['id']],function(_0x5054f1){return{'id':_0x5054f1['id'],'fullname':_0x5054f1[_0x3f13('0x2f')]};});}}catch(_0x2272c1){_0x3bf14f(_0x2272c1);}_0x149550(_0x1a1483);});}function getInteractionTags(_0xf9dbc1,_0x199aba){return new BPromise(function(_0x4677e3,_0x4df664){try{if(_0xf9dbc1[_0x3f13('0x30')]){_0xf9dbc1['Tags']=[];_0xf9dbc1['TagIds'][_0x3f13('0x31')](',')['forEach'](function(_0x35c321){_0xf9dbc1[_0x3f13('0x32')][_0x3f13('0x33')](_0x199aba[_0x35c321]);});}delete _0xf9dbc1[_0x3f13('0x30')];}catch(_0x2ffa96){_0x4df664(_0x2ffa96);}_0x4677e3(_0xf9dbc1);});}function updateOpenchannelInteraction(_0x56b71b,_0x2c36c4,_0x489dc6){return new BPromise(function(_0x624ef7,_0x5c3457){return getInteractionUsers(_0x56b71b,_0x489dc6)[_0x3f13('0x34')](function(_0x21cecf){return getInteractionTags(_0x21cecf,_0x2c36c4);})[_0x3f13('0x34')](function(_0x2f0f0a){_0x624ef7(_0x2f0f0a);})[_0x3f13('0x35')](function(_0x37c5f8){_0x5c3457(_0x37c5f8);});});}exports[_0x3f13('0x36')]=function(_0x4bf18a,_0x141315){var _0x2bda31={},_0x393314={},_0x318679={'count':0x0,'rows':[]};var _0x58f424=_[_0x3f13('0x2e')](db['OpenchannelInteraction'][_0x3f13('0x37')],function(_0x3b2ed8){return{'name':_0x3b2ed8[_0x3f13('0x38')],'type':_0x3b2ed8['type'][_0x3f13('0x39')]};});_0x393314[_0x3f13('0x3a')]=_[_0x3f13('0x2e')](_0x58f424,_0x3f13('0x2c'));_0x393314['query']=_[_0x3f13('0x3b')](_0x4bf18a[_0x3f13('0x3c')]);_0x393314[_0x3f13('0x3d')]=_[_0x3f13('0x3e')](_0x393314[_0x3f13('0x3a')],_0x393314[_0x3f13('0x3c')]);_0x2bda31[_0x3f13('0x3f')]=_[_0x3f13('0x3e')](_0x393314[_0x3f13('0x3a')],qs['fields'](_0x4bf18a[_0x3f13('0x3c')][_0x3f13('0x40')]));_0x2bda31[_0x3f13('0x3f')]=_0x2bda31['attributes']['length']?_0x2bda31[_0x3f13('0x3f')]:_0x393314[_0x3f13('0x3a')];if(!_0x4bf18a[_0x3f13('0x3c')]['hasOwnProperty'](_0x3f13('0x41'))){_0x2bda31[_0x3f13('0x23')]=qs[_0x3f13('0x23')](_0x4bf18a['query'][_0x3f13('0x23')]);_0x2bda31['offset']=qs['offset'](_0x4bf18a[_0x3f13('0x3c')][_0x3f13('0x21')]);}_0x2bda31[_0x3f13('0x42')]=qs[_0x3f13('0x43')](_0x4bf18a[_0x3f13('0x3c')][_0x3f13('0x43')]);_0x2bda31[_0x3f13('0x44')]=qs[_0x3f13('0x3d')](_['pick'](_0x4bf18a[_0x3f13('0x3c')],_0x393314[_0x3f13('0x3d')]),_0x58f424);var _0x108d31=[];var _0x1cd28e=squel[_0x3f13('0x45')]()[_0x3f13('0x46')]('id')[_0x3f13('0x46')](_0x3f13('0x2c'))['field'](_0x3f13('0x47'))[_0x3f13('0x48')](_0x3f13('0x49'));var _0x1b183a=squel[_0x3f13('0x45')]()[_0x3f13('0x46')](_0x3f13('0x4a'))['field'](_0x3f13('0x4b'))[_0x3f13('0x46')](_0x3f13('0x4c'))[_0x3f13('0x48')]('user_has_openchannel_interactions','ui')[_0x3f13('0x4d')](_0x3f13('0x4e'),'u','u.id\x20=\x20ui.UserId');var _0x402eb6=squel[_0x3f13('0x45')]()[_0x3f13('0x48')](_0x3f13('0x4f'),'i')[_0x3f13('0x4d')]('cm_contacts','c',_0x3f13('0x50'))['left_join'](_0x3f13('0x4e'),'o',_0x3f13('0x51'))['left_join']('openchannel_accounts','a','a.id\x20=\x20i.OpenchannelAccountId')['left_join']('openchannel_messages','me',_0x3f13('0x52'))['left_join'](_0x3f13('0x53'),'it',_0x3f13('0x54'))[_0x3f13('0x4d')](_0x3f13('0x49'),'t',_0x3f13('0x55'));var _0x503f75=squel['expr']();var _0x465c10=[];var _0x3251b9=squel[_0x3f13('0x56')]();var _0x31f178;if(_0x4bf18a[_0x3f13('0x3c')][_0x3f13('0x57')]){_0x31f178=as[_0x3f13('0x58')](_0x4bf18a['query'][_0x3f13('0x57')]);var _0x1b63f7=_0x31f178[_0x3f13('0x59')];for(var _0x383c59=0x0;_0x383c59<_0x31f178[_0x3f13('0x5a')]['length'];_0x383c59++){var _0x2b5fd9=_0x31f178[_0x3f13('0x5a')][_0x383c59];var _0x37b508='i';var _0x172243=_['find'](_0x58f424,[_0x3f13('0x2c'),_0x2b5fd9['field']]);if(!_0x172243){switch(_0x2b5fd9[_0x3f13('0x46')]){case _0x3f13('0x5b'):if(_0x2b5fd9[_0x3f13('0x5c')]==0x1){_0x402eb6[_0x3f13('0x5d')]('`'+_0x2b5fd9[_0x3f13('0x46')]+_0x3f13('0x5e'));}else{_0x402eb6[_0x3f13('0x5d')]('`'+_0x2b5fd9[_0x3f13('0x46')]+'`\x20>\x200');}break;case _0x3f13('0x5f'):if(_0x2b5fd9[_0x3f13('0x60')]===_0x3f13('0x61')){if(_0x2b5fd9[_0x3f13('0x5c')][_0x3f13('0x31')]('\x20')['length']>0x1){_0x503f75[_0x1b63f7](_0x3f13('0x62'),qs[_0x3f13('0x63')](_0x2b5fd9[_0x3f13('0x5c')]),null);}else{var _0x206f13='%'+_0x2b5fd9['value']+'%';_0x503f75[_0x1b63f7](_0x3f13('0x64'),_0x206f13,_0x206f13,_0x206f13);}}else{_0x172243=_[_0x3f13('0x65')](_0x58f424,[_0x3f13('0x2c'),_0x3f13('0x66')]);_0x2b5fd9[_0x3f13('0x46')]=_0x3f13('0x66');_0xc73f63=as[_0x3f13('0x67')](_0x37b508,_0x172243[_0x3f13('0x68')],_0x2b5fd9);_0x503f75[_0x1b63f7](_0xc73f63['text'],_0xc73f63[_0x3f13('0x5c')][_0x3f13('0x69')],_0xc73f63['value'][_0x3f13('0x1f')]);}break;case _0x3f13('0x6a'):var _0x1594f3=_0x2b5fd9[_0x3f13('0x5c')][_0x3f13('0x31')](',')[_0x3f13('0x2e')](function(_0x22f311){return Number(_0x22f311);});_0x1594f3['forEach'](function(_0x464ea1){_0x3251b9['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x464ea1+',%');});_0x465c10=_['union'](_0x465c10,_0x1594f3);break;case _0x3f13('0x6b'):if(_0x2b5fd9[_0x3f13('0x60')]==='$substring'){_0x503f75[_0x1b63f7](_0x3f13('0x6c'),'%'+_0x2b5fd9[_0x3f13('0x5c')]+'%',null);}else{_0x172243=_[_0x3f13('0x65')](_0x58f424,[_0x3f13('0x2c'),_0x3f13('0x6d')]);_0x2b5fd9[_0x3f13('0x46')]='UserId';_0xc73f63=as[_0x3f13('0x67')](_0x37b508,_0x172243[_0x3f13('0x68')],_0x2b5fd9);_0x503f75[_0x1b63f7](_0xc73f63[_0x3f13('0x6e')],_0xc73f63['value'][_0x3f13('0x69')],_0xc73f63[_0x3f13('0x5c')]['end']);}break;case'body':_0xc73f63=as[_0x3f13('0x67')]('me',null,_0x2b5fd9);_0x503f75[_0x1b63f7](_0xc73f63[_0x3f13('0x6e')],_0xc73f63['value'][_0x3f13('0x69')],_0xc73f63[_0x3f13('0x5c')][_0x3f13('0x1f')]);break;}}else{var _0xc73f63=as[_0x3f13('0x67')](_0x37b508,_0x172243[_0x3f13('0x68')],_0x2b5fd9);_0x503f75[_0x1b63f7](_0xc73f63['text'],_0xc73f63[_0x3f13('0x5c')]['start'],_0xc73f63[_0x3f13('0x5c')][_0x3f13('0x1f')]);}}}else{var _0x4d2e57=_(_0x4bf18a[_0x3f13('0x3c')])[_0x3f13('0x3b')]()['map'](function(_0x4ba588){return _['some'](_0x58f424,[_0x3f13('0x2c'),_0x4ba588])?_0x4ba588:undefined;})[_0x3f13('0x6f')]()['value']();if(!_[_0x3f13('0x70')](_0x4d2e57)){_0x4d2e57[_0x3f13('0x71')](function(_0x17f481){if(_0x17f481===_0x3f13('0x72')){_0x402eb6[_0x3f13('0x44')]('i.OpenchannelAccountId\x20IN\x20?',[][_0x3f13('0x73')](_0x4bf18a[_0x3f13('0x3c')][_0x17f481]));}else if(_0x17f481===_0x3f13('0x74')){var _0x1bbf02=JSON['parse'](_0x4bf18a['query'][_0x17f481])[_0x3f13('0x75')];var _0x320009=JSON[_0x3f13('0x76')](_0x4bf18a[_0x3f13('0x3c')][_0x17f481])['$lte'];_0x402eb6[_0x3f13('0x44')](_0x3f13('0x77'),_0x1bbf02,_0x320009);}else{if(_0x4bf18a[_0x3f13('0x3c')][_0x17f481]===_0x3f13('0x78')){_0x402eb6[_0x3f13('0x44')]('i.'+_0x17f481+_0x3f13('0x79'));}else{_0x402eb6[_0x3f13('0x44')]('i.'+_0x17f481+_0x3f13('0x7a'),_0x4bf18a[_0x3f13('0x3c')][_0x17f481]);}}});}if(_0x4bf18a[_0x3f13('0x3c')][_0x3f13('0x7b')]){if(_0x4bf18a[_0x3f13('0x3c')]['read']==0x1){_0x402eb6['having'](_0x3f13('0x7c'));}else{_0x402eb6[_0x3f13('0x5d')](_0x3f13('0x7d'));}}if(_0x4bf18a['query'][_0x3f13('0x7e')]){_0x465c10=_[_0x3f13('0x7f')](_0x4bf18a[_0x3f13('0x3c')][_0x3f13('0x7e')])?_0x4bf18a[_0x3f13('0x3c')][_0x3f13('0x7e')]:new Array(_0x4bf18a['query'][_0x3f13('0x7e')]);_0x465c10[_0x3f13('0x71')](function(_0xee746f){_0x3251b9['or'](_0x3f13('0x80'),'%,'+_0xee746f+',%');});}if(_0x4bf18a[_0x3f13('0x3c')][_0x3f13('0x81')]){var _0x41a645=_0x4bf18a[_0x3f13('0x3c')][_0x3f13('0x81')][_0x3f13('0x82')]('\x5c','\x5c\x5c')[_0x3f13('0x82')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x41a645)){_0x503f75['or'](_0x3f13('0x83'),_0x41a645+'%');}else{_0x503f75['or'](_0x3f13('0x84'),qs[_0x3f13('0x63')](_0x41a645))['or'](_0x3f13('0x85'),_0x41a645+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x41a645+'%');}}}_0x402eb6[_0x3f13('0x44')](_0x503f75);_0x402eb6[_0x3f13('0x86')]('i.id');var _0x40643a={'type':db[_0x3f13('0x87')][_0x3f13('0x88')]['SELECT'],'raw':!![]};var _0x3c5fc4=_0x402eb6['clone']();_0x3c5fc4[_0x3f13('0x46')](_0x3f13('0x89'));_0x3c5fc4[_0x3f13('0x46')](_0x3f13('0x8a'),_0x3f13('0x5b'));if(_0x2bda31[_0x3f13('0x42')]){_0x2bda31[_0x3f13('0x42')][_0x3f13('0x71')](function(_0x2f2921){var _0x4590e8=_0x2f2921[0x0]===_0x3f13('0x8b')?_0x2f2921[0x0]:'i.'+_0x2f2921[0x0];_0x402eb6[_0x3f13('0x42')](_0x4590e8,_0x2f2921[0x1]===_0x3f13('0x8c')?![]:!![]);});}if(!_[_0x3f13('0x70')](_0x465c10)){_0x402eb6['having'](_0x3251b9);_0x3c5fc4[_0x3f13('0x44')](_0x3f13('0x8d'),_0x465c10);}BPromise[_0x3f13('0x8e')]()['then'](function(){if(!_0x31f178){if(_0x4bf18a['query'][_0x3f13('0x72')])return;_0x3c5fc4[_0x3f13('0x44')](_0x3f13('0x8f'));_0x402eb6['where'](_0x3f13('0x8f'));return;}if(_0x4bf18a['user'][_0x3f13('0x90')]!==_0x3f13('0x91'))return;return _0x4bf18a[_0x3f13('0x92')][_0x3f13('0x93')]({'attributes':['id'],'raw':!![]})[_0x3f13('0x34')](function(_0x3957d7){if(_[_0x3f13('0x70')](_0x3957d7)){_0x3c5fc4[_0x3f13('0x44')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x402eb6[_0x3f13('0x44')](_0x3f13('0x94'));}else{_0x3c5fc4[_0x3f13('0x44')](_0x3f13('0x95'),_[_0x3f13('0x2e')](_0x3957d7,'id'));_0x402eb6[_0x3f13('0x44')](_0x3f13('0x95'),_[_0x3f13('0x2e')](_0x3957d7,'id'));}});})[_0x3f13('0x34')](function(){if(_0x4bf18a[_0x3f13('0x92')]['role']===_0x3f13('0x91')&&!_0x31f178&&!_0x4bf18a[_0x3f13('0x3c')][_0x3f13('0x72')])return[];return db['sequelize'][_0x3f13('0x3c')](_0x3c5fc4[_0x3f13('0x96')](),_0x40643a);})[_0x3f13('0x34')](function(_0xe1cb9f){_0x318679[_0x3f13('0x24')]=_0xe1cb9f[_0x3f13('0x97')];if(_0x318679['count']===0x0)return[];return db[_0x3f13('0x98')]['query'](_0x1cd28e[_0x3f13('0x96')](),_0x40643a)['then'](function(_0x32326b){_0x108d31=_[_0x3f13('0x99')](_0x32326b,'id');_0x40643a=_[_0x3f13('0x9a')](_0x40643a,{'model':db[_0x3f13('0x9b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4bf18a[_0x3f13('0x3c')][_0x3f13('0x40')]){_0x2bda31[_0x3f13('0x3f')]['forEach'](function(_0x154abb){_0x402eb6[_0x3f13('0x46')]('i.'+_0x154abb);});}else{_0x402eb6[_0x3f13('0x46')](_0x3f13('0x8a'),_0x3f13('0x5b'));_0x402eb6['field']('a.key','Account.key');_0x402eb6[_0x3f13('0x46')]('a.mandatoryDisposition',_0x3f13('0x9c'));_0x402eb6[_0x3f13('0x46')]('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',_0x3f13('0x8b'));_0x402eb6[_0x3f13('0x46')](_0x3f13('0x9d'));_0x402eb6[_0x3f13('0x46')]('c.firstName',_0x3f13('0x9e'));_0x402eb6[_0x3f13('0x46')](_0x3f13('0x9f'),_0x3f13('0xa0'));_0x402eb6['field'](_0x3f13('0xa1'),_0x3f13('0xa2'));_0x402eb6['field'](_0x3f13('0xa3'),_0x3f13('0xa4'));_0x402eb6['field'](_0x3f13('0xa5'),_0x3f13('0xa6'));_0x402eb6[_0x3f13('0x46')](_0x3f13('0xa7'),_0x3f13('0xa8'));_0x402eb6[_0x3f13('0x46')](_0x3f13('0xa9'),_0x3f13('0xaa'));_0x402eb6[_0x3f13('0x46')]('o.internal','Owner.internal');_0x402eb6['field'](_0x3f13('0xab'),_0x3f13('0x30'));}if(_0x2bda31[_0x3f13('0x23')])_0x402eb6['limit'](_0x2bda31[_0x3f13('0x23')]);if(_0x2bda31[_0x3f13('0x21')])_0x402eb6[_0x3f13('0x21')](_0x2bda31[_0x3f13('0x21')]);return db['sequelize']['query'](_0x402eb6['toString'](),_0x40643a);})[_0x3f13('0x34')](function(_0x4f1d13){if(_0x4f1d13[_0x3f13('0x97')]>0x0)_0x1b183a[_0x3f13('0x44')]('ui.OpenchannelInteractionId\x20IN\x20?',_[_0x3f13('0x2e')](_0x4f1d13,'id'));return db['sequelize'][_0x3f13('0x3c')](_0x1b183a[_0x3f13('0x96')](),_0x40643a)[_0x3f13('0x34')](function(_0x2e0965){var _0x5ad018=_[_0x3f13('0xac')](_0x2e0965,'OpenchannelInteractionId');var _0xcb4f64=[];_0x4f1d13[_0x3f13('0x71')](function(_0x8fcdef){_0xcb4f64[_0x3f13('0x33')](updateOpenchannelInteraction(_0x8fcdef,_0x108d31,_0x5ad018));});return BPromise[_0x3f13('0xad')](_0xcb4f64);});});})['then'](function(_0xfd9232){_0x318679[_0x3f13('0xae')]=_0xfd9232;return _0x318679;})[_0x3f13('0x34')](respondWithFilteredResult(_0x141315,_0x2bda31))['catch'](handleError(_0x141315,null));};exports[_0x3f13('0xaf')]=function(_0x3729af,_0x483eb6){var _0xc5164d={};if(_0x3729af[_0x3f13('0x3c')][_0x3f13('0x68')]&&_0x3729af[_0x3f13('0x3c')][_0x3f13('0x68')]===_0x3f13('0x48')){_0xc5164d['from']=_0x3729af[_0x3f13('0xb0')]['id'];}else{_0xc5164d['id']=_0x3729af[_0x3f13('0xb0')]['id'];}var _0x732be2={'raw':![],'where':_0xc5164d},_0x46da54={};_0x46da54[_0x3f13('0x3a')]=_[_0x3f13('0x3b')](db['OpenchannelInteraction']['rawAttributes']);_0x46da54['query']=_[_0x3f13('0x3b')](_0x3729af[_0x3f13('0x3c')]);_0x46da54[_0x3f13('0x3d')]=_[_0x3f13('0x3e')](_0x46da54[_0x3f13('0x3a')],_0x46da54[_0x3f13('0x3c')]);_0x732be2[_0x3f13('0x3f')]=_[_0x3f13('0x3e')](_0x46da54[_0x3f13('0x3a')],qs[_0x3f13('0x40')](_0x3729af[_0x3f13('0x3c')]['fields']));_0x732be2[_0x3f13('0x3f')]=_0x732be2[_0x3f13('0x3f')][_0x3f13('0x97')]?_0x732be2[_0x3f13('0x3f')]:_0x46da54[_0x3f13('0x3a')];if(_0x3729af[_0x3f13('0x3c')][_0x3f13('0xb1')]){_0x732be2[_0x3f13('0xb2')]=[{'all':!![]}];}_0x732be2=_[_0x3f13('0x9a')]({},_0x732be2,_0x3729af['options']);return db['OpenchannelInteraction'][_0x3f13('0x65')](_0x732be2)[_0x3f13('0x34')](handleEntityNotFound(_0x483eb6,null))[_0x3f13('0x34')](respondWithResult(_0x483eb6,null))[_0x3f13('0x35')](handleError(_0x483eb6,null));};exports[_0x3f13('0xb3')]=function(_0x773774,_0x5b97bb){return db[_0x3f13('0x9b')]['create'](_0x773774[_0x3f13('0xb4')],{})[_0x3f13('0x34')](respondWithResult(_0x5b97bb,0xc9))[_0x3f13('0x35')](handleError(_0x5b97bb,null));};exports['update']=function(_0x4da323,_0x3aafa3){if(_0x4da323['body']['id']){delete _0x4da323[_0x3f13('0xb4')]['id'];}return db[_0x3f13('0x9b')][_0x3f13('0x65')]({'where':{'id':_0x4da323[_0x3f13('0xb0')]['id']}})['then'](handleEntityNotFound(_0x3aafa3,null))[_0x3f13('0x34')](saveUpdates(_0x4da323[_0x3f13('0xb4')],null))['then'](respondWithResult(_0x3aafa3,null))['catch'](handleError(_0x3aafa3,null));};exports['destroy']=function(_0x2adcaa,_0xe62ebf){return db[_0x3f13('0x9b')][_0x3f13('0x65')]({'where':{'id':_0x2adcaa[_0x3f13('0xb0')]['id']}})['then'](handleEntityNotFound(_0xe62ebf,null))[_0x3f13('0x34')](removeEntity(_0xe62ebf,null))['catch'](handleError(_0xe62ebf,null));};exports[_0x3f13('0xb5')]=function(_0x3788ac,_0x538ccc){return db[_0x3f13('0x9b')]['describe']()[_0x3f13('0x34')](respondWithResult(_0x538ccc,null))[_0x3f13('0x35')](handleError(_0x538ccc,null));};exports[_0x3f13('0xb6')]=function(_0x2eadd7,_0x51c6c0,_0x2bcea1){return db[_0x3f13('0xb7')][_0x3f13('0x65')]({'where':{'id':_0x2eadd7['params']['id']}})[_0x3f13('0x34')](handleEntityNotFound(_0x51c6c0,null))[_0x3f13('0x34')](function(_0x3ff2db){if(_0x3ff2db){return _0x3ff2db[_0x3f13('0xb6')](_0x2eadd7[_0x3f13('0xb4')][_0x3f13('0xb8')],_[_0x3f13('0xb9')](_0x2eadd7[_0x3f13('0xb4')],[_0x3f13('0xb8'),'id'])||{});}})[_0x3f13('0x34')](respondWithResult(_0x51c6c0,null))['catch'](handleError(_0x51c6c0,null));};exports['getMessages']=function(_0x4d02b2,_0x5474ac,_0x25d7f9){var _0x2061b9={'raw':![],'where':{}};var _0x3c179a={};var _0x592e51={'count':0x0,'rows':[]};return db[_0x3f13('0x9b')]['findOne']({'where':{'id':_0x4d02b2['params']['id']}})['then'](handleEntityNotFound(_0x5474ac,null))['then'](function(_0xe58fcf){if(_0xe58fcf){_0x3c179a[_0x3f13('0x3a')]=_[_0x3f13('0x3b')](db[_0x3f13('0xb7')]['rawAttributes']);_0x3c179a[_0x3f13('0x3c')]=_[_0x3f13('0x3b')](_0x4d02b2[_0x3f13('0x3c')]);_0x3c179a['filters']=_[_0x3f13('0x3e')](_0x3c179a['model'],_0x3c179a[_0x3f13('0x3c')]);_0x2061b9[_0x3f13('0x3f')]=_[_0x3f13('0x3e')](_0x3c179a['model'],qs[_0x3f13('0x40')](_0x4d02b2[_0x3f13('0x3c')][_0x3f13('0x40')]));_0x2061b9[_0x3f13('0x3f')]=_0x2061b9['attributes'][_0x3f13('0x97')]?_0x2061b9[_0x3f13('0x3f')]:_0x3c179a[_0x3f13('0x3a')];if(!_0x4d02b2[_0x3f13('0x3c')][_0x3f13('0xba')](_0x3f13('0x41'))){_0x2061b9[_0x3f13('0x23')]=qs[_0x3f13('0x23')](_0x4d02b2['query'][_0x3f13('0x23')]);_0x2061b9['offset']=qs['offset'](_0x4d02b2[_0x3f13('0x3c')][_0x3f13('0x21')]);}_0x2061b9['order']=qs['sort'](_0x4d02b2[_0x3f13('0x3c')]['sort']);_0x2061b9['where']=qs[_0x3f13('0x3d')](_[_0x3f13('0xbb')](_0x4d02b2[_0x3f13('0x3c')],_0x3c179a['filters']));_0x2061b9[_0x3f13('0x44')][_0x3f13('0xbc')]=_0xe58fcf['id'];if(_0x4d02b2[_0x3f13('0x3c')]['filter']){_0x2061b9[_0x3f13('0x44')]=_['merge'](_0x2061b9[_0x3f13('0x44')],{'$or':_['map'](_0x2061b9[_0x3f13('0x3f')],function(_0x30d3a2){var _0x337e10={};_0x337e10[_0x30d3a2]={'$like':'%'+_0x4d02b2['query'][_0x3f13('0x81')]+'%'};return _0x337e10;})});}if(_0x4d02b2[_0x3f13('0x3c')][_0x3f13('0x75')]){var _0x2e3a8d=_0x4d02b2[_0x3f13('0x3c')][_0x3f13('0x75')][_0x3f13('0x31')](',');var _0x2b3611={};_0x2b3611[_0x2e3a8d[0x0]]={'$gte':moment(_0x2e3a8d[0x1])[_0x3f13('0xbd')](_0x3f13('0xbe'))};_0x2061b9[_0x3f13('0x44')]=_[_0x3f13('0x9a')](_0x2061b9[_0x3f13('0x44')],_0x2b3611);}_0x2061b9=_[_0x3f13('0x9a')]({},_0x2061b9,_0x4d02b2['options']);return db[_0x3f13('0xb7')][_0x3f13('0x24')]({'where':_0x2061b9['where']})['then'](function(_0x4d721b){_0x592e51[_0x3f13('0x24')]=_0x4d721b;if(_0x4d02b2[_0x3f13('0x3c')][_0x3f13('0xb1')]){_0x2061b9[_0x3f13('0xb2')]=[{'all':!![]}];}return db[_0x3f13('0xb7')]['findAll'](_0x2061b9);})[_0x3f13('0x34')](function(_0x1c08f9){_0x592e51['rows']=_0x1c08f9;return _0x592e51;});}})[_0x3f13('0x34')](respondWithFilteredResult(_0x5474ac,_0x2061b9))[_0x3f13('0x35')](handleError(_0x5474ac,null));};exports[_0x3f13('0xbf')]=function(_0x368f87,_0x1affc2,_0x134044){return db['OpenchannelInteraction'][_0x3f13('0x65')]({'where':{'id':_0x368f87[_0x3f13('0xb0')]['id']}})['then'](handleEntityNotFound(_0x1affc2,null))[_0x3f13('0x34')](function(_0x361390){if(_0x361390){return _0x361390[_0x3f13('0xc0')](_0x368f87[_0x3f13('0xb4')]['ids'],_[_0x3f13('0xb9')](_0x368f87[_0x3f13('0xb4')],[_0x3f13('0xb8'),'id'])||{})['spread'](function(){return db[_0x3f13('0x6a')]['findAll']({'attributes':['id',_0x3f13('0x2c'),_0x3f13('0x47')],'where':{'id':_0x368f87['body'][_0x3f13('0xb8')]}});})[_0x3f13('0x34')](function(_0x591561){socket[_0x3f13('0xc1')]('openchannelInteractionTags:save',{'id':Number(_0x368f87[_0x3f13('0xb0')]['id']),'tags':_0x591561||[]});return{'id':Number(_0x368f87[_0x3f13('0xb0')]['id']),'tags':_0x591561||[]};});}})[_0x3f13('0x34')](respondWithResult(_0x1affc2,null))[_0x3f13('0x35')](handleError(_0x1affc2,null));};exports[_0x3f13('0xc2')]=function(_0x1507a5,_0x14c389,_0x8197a){return db[_0x3f13('0x9b')][_0x3f13('0x65')]({'where':{'id':_0x1507a5[_0x3f13('0xb0')]['id']}})[_0x3f13('0x34')](handleEntityNotFound(_0x14c389,null))['then'](function(_0x3deb1d){if(_0x3deb1d){return _0x3deb1d[_0x3f13('0xc2')](_0x1507a5[_0x3f13('0x3c')][_0x3f13('0xb8')]);}})[_0x3f13('0x34')](respondWithStatusCode(_0x14c389,null))[_0x3f13('0x35')](handleError(_0x14c389,null));};exports['download']=function(_0x3c8684,_0xf73bba){var _0x194366=moment()[_0x3f13('0xc3')]()[_0x3f13('0x96')]();var _0x138903=path[_0x3f13('0xc4')](config[_0x3f13('0xc5')],_0x3f13('0xc6'),_0x3f13('0xc7'),_0x3f13('0xc8'));var _0x57d6df=path[_0x3f13('0xc4')](config['root'],'server','files','attachments');var _0x9ac79f=path[_0x3f13('0xc4')](_0x138903,_0x194366);var _0x2417bc=util[_0x3f13('0xbd')](_0x3f13('0xc9'),_0x3c8684[_0x3f13('0xb0')]['id'],_0x194366);var _0xfa3faa=path[_0x3f13('0xc4')](_0x138903,_0x2417bc);var _0x46bfcc=[];_0x46bfcc[_0x3f13('0x33')]({'model':db[_0x3f13('0x6b')],'as':'User','attributes':['id',_0x3f13('0x2f')],'raw':!![]});_0x46bfcc[_0x3f13('0x33')]({'model':db[_0x3f13('0xca')],'as':_0x3f13('0x5f'),'attributes':['id',_0x3f13('0xcb'),_0x3f13('0xcc')],'raw':!![]});if(_0x3c8684[_0x3f13('0x3c')][_0x3f13('0xcd')]){_0x46bfcc[_0x3f13('0x33')]({'model':db[_0x3f13('0xce')],'as':'Attachment','raw':!![]});}var _0x32db36=[{'model':db[_0x3f13('0xb7')],'as':_0x3f13('0xcf'),'attributes':['id','body','createdAt','direction',_0x3f13('0xd0'),_0x3f13('0x7b')],'include':_0x46bfcc}];_0x32db36[_0x3f13('0x33')]({'model':db[_0x3f13('0xd1')],'as':_0x3f13('0xd2'),'attributes':['id',_0x3f13('0x2c')]});_0x32db36[_0x3f13('0x33')]({'model':db[_0x3f13('0x6b')],'as':_0x3f13('0xd3'),'attributes':['id','fullname']});return db[_0x3f13('0x9b')][_0x3f13('0x65')]({'where':{'id':_0x3c8684[_0x3f13('0xb0')]['id']},'include':_0x32db36})['then'](handleEntityNotFound(_0xf73bba,null))['then'](function(_0x10cc6e){if(_0x10cc6e){var _0x43d479=_0x10cc6e[_0x3f13('0xd4')]({'plain':!![]});fs[_0x3f13('0xd5')](_0x9ac79f);var _0xbd9ad3={'channel':_0x3f13('0xd6'),'account':_0x43d479['Account'][_0x3f13('0x2c')],'agent':_0x43d479['Owner']?_0x43d479[_0x3f13('0xd3')][_0x3f13('0x2f')]:_0x3f13('0xd7'),'createdAt':moment(_0x43d479[_0x3f13('0x74')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x3f13('0x96')](),'closedAt':_0x43d479[_0x3f13('0xd8')]?moment(_0x43d479[_0x3f13('0xd9')])[_0x3f13('0xbd')](_0x3f13('0xbe'))[_0x3f13('0x96')]():'','disposition':_0x43d479['disposition'],'visibility':_0x43d479['threadId']?_0x3f13('0xda'):_0x3f13('0xdb'),'messages':_(_0x43d479['Messages'])[_0x3f13('0x81')]({'secret':![]})[_0x3f13('0x2e')](function(_0x3165e1){if(_0x3165e1[_0x3f13('0xce')]){var _0x463051=path[_0x3f13('0xc4')](_0x57d6df,_0x3165e1[_0x3f13('0xce')][_0x3f13('0xdc')]);if(fs['existsSync'](_0x463051)){fs[_0x3f13('0xdd')](_0x463051)[_0x3f13('0xde')](fs[_0x3f13('0xdf')](path['join'](_0x9ac79f,_0x3165e1[_0x3f13('0xce')]['basename'])));}}return{'date':moment(_0x3165e1[_0x3f13('0x74')])['format'](_0x3f13('0xbe'))[_0x3f13('0x96')](),'sender':_0x3165e1[_0x3f13('0xe0')]===_0x3f13('0xe1')?_0x3165e1[_0x3f13('0x6b')]?_0x3165e1[_0x3f13('0x6b')][_0x3f13('0x2f')]:_0x3f13('0xe2'):_0x3165e1['Contact']['firstName']+(_0x3165e1[_0x3f13('0x5f')][_0x3f13('0xcc')]?'\x20'+_0x3165e1[_0x3f13('0x5f')]['lastName']:''),'body':_0x3165e1[_0x3f13('0xce')]?_0x3165e1[_0x3f13('0xce')]['basename']:_0x3165e1['body'],'direction':_0x3165e1[_0x3f13('0xe0')]===_0x3f13('0xe1')?'A':'C','secret':_0x3165e1[_0x3f13('0xd0')],'read':_0x3165e1[_0x3f13('0x7b')],'attachment':_0x3165e1[_0x3f13('0xce')]};})[_0x3f13('0x5c')]()};return ejs['renderFile'](path[_0x3f13('0xc4')](config[_0x3f13('0xc5')],_0x3f13('0xc6'),_0x3f13('0xe3'),_0x3f13('0xe4')),{'interaction':_0xbd9ad3})[_0x3f13('0x34')](function(_0xefdaf6){var _0x32f88a=path[_0x3f13('0xc4')](_0x9ac79f,'transcript-'+_0x43d479['id']+'-'+_0x194366+'.pdf');var _0x27610c={'path':_0x32f88a,'channel':'Openchannel','interactionId':_0x43d479['id']};return pdf['createPdfFromHTML'](_0xefdaf6,_0x27610c);})[_0x3f13('0x34')](function(){return new BPromise(function(_0x1bfbbf,_0x8147a4){zipdir(_0x9ac79f,{'saveTo':_0xfa3faa},function(_0x55febb,_0x38d5d3){if(_0x55febb)return _0x8147a4(_0x55febb);return _0x1bfbbf(_0x38d5d3);});})['then'](function(){return new BPromise(function(_0x1e59c7,_0x25046a){rimraf(_0x9ac79f,function(_0x378873){if(_0x378873)_0x25046a(_0x378873);return _0x1e59c7();});});})['then'](function(){return _0xf73bba[_0x3f13('0xe5')](_0xfa3faa,_0x2417bc,function(_0x11532b){if(_0x11532b){console['log'](_0x3f13('0xe6'),_0x11532b);}else{fs[_0x3f13('0xe7')](_0xfa3faa);}});});});}else{return _0xf73bba[_0x3f13('0x29')](0xc8);}})[_0x3f13('0x35')](handleError(_0xf73bba,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index caa425d..fffc073 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 _0xf854=['setDataValue','map','unreadMessages','emit','catch','hasOwnProperty','exports','events','OpenchannelInteraction','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then'];(function(_0x5ee6d6,_0x28cd9c){var _0x22fc33=function(_0x10ee1d){while(--_0x10ee1d){_0x5ee6d6['push'](_0x5ee6d6['shift']());}};_0x22fc33(++_0x28cd9c);}(_0xf854,0x117));var _0x4f85=function(_0x4e1583,_0xc667b7){_0x4e1583=_0x4e1583-0x0;var _0x17358e=_0xf854[_0x4e1583];return _0x17358e;};'use strict';var EventEmitter=require(_0x4f85('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x4f85('0x1')];var OpenchannelMessage=require(_0x4f85('0x2'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x4f85('0x3')](0x0);var events={'afterCreate':_0x4f85('0x4'),'afterUpdate':_0x4f85('0x5'),'afterDestroy':_0x4f85('0x6')};function emitEvent(_0xe6a4c1){return function(_0x54cb2b,_0x53d5de,_0x5a0eff){_0x54cb2b[_0x4f85('0x7')]({'attributes':['id'],'raw':!![]})[_0x4f85('0x8')](function(_0x24c3ea){_0x54cb2b[_0x4f85('0x9')]('Users',_0x24c3ea[_0x4f85('0xa')](function(_0x585cac){return{'id':_0x585cac['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x54cb2b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4f85('0x8')](function(_0x1130a8){_0x54cb2b[_0x4f85('0x9')](_0x4f85('0xb'),_0x1130a8['length']);OpenchannelInteractionEvents[_0x4f85('0xc')](_0xe6a4c1+':'+_0x54cb2b['id'],_0x54cb2b);OpenchannelInteractionEvents[_0x4f85('0xc')](_0xe6a4c1,_0x54cb2b);_0x5a0eff(null);})[_0x4f85('0xd')](_0x5a0eff(null));};}for(var e in events){if(events[_0x4f85('0xe')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x4f85('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x0ee8=['unreadMessages','length','emit','catch','hook','../../mysqldb','update','getUsers','then','setDataValue','Users','map'];(function(_0x37ee3a,_0x5dfa20){var _0x397964=function(_0x5c24ba){while(--_0x5c24ba){_0x37ee3a['push'](_0x37ee3a['shift']());}};_0x397964(++_0x5dfa20);}(_0x0ee8,0x1cd));var _0x80ee=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x0ee8[_0x8c43de];return _0xa6591b;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x80ee('0x0'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x80ee('0x1'),'afterDestroy':'remove'};function emitEvent(_0xd3be55){return function(_0x4f1453,_0x36cffc,_0x26597b){_0x4f1453[_0x80ee('0x2')]({'attributes':['id'],'raw':!![]})[_0x80ee('0x3')](function(_0x567f57){_0x4f1453[_0x80ee('0x4')](_0x80ee('0x5'),_0x567f57[_0x80ee('0x6')](function(_0x5204b0){return{'id':_0x5204b0['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x4f1453['id'],'direction':'in','read':![]},'raw':!![]});})[_0x80ee('0x3')](function(_0x339c80){_0x4f1453[_0x80ee('0x4')](_0x80ee('0x7'),_0x339c80[_0x80ee('0x8')]);OpenchannelInteractionEvents[_0x80ee('0x9')](_0xd3be55+':'+_0x4f1453['id'],_0x4f1453);OpenchannelInteractionEvents[_0x80ee('0x9')](_0xd3be55,_0x4f1453);_0x26597b(null);})[_0x80ee('0xa')](_0x26597b(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x80ee('0xb')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 2679c6f..7301343 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 _0x003c=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','path','../../config/environment','./openchannelInteraction.attributes','exports','OpenchannelInteraction','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format'];(function(_0x1c4b0f,_0xf620de){var _0x436ccb=function(_0x22d716){while(--_0x22d716){_0x1c4b0f['push'](_0x1c4b0f['shift']());}};_0x436ccb(++_0xf620de);}(_0x003c,0x161));var _0xc003=function(_0x359e3f,_0x308b08){_0x359e3f=_0x359e3f-0x0;var _0x34e948=_0x003c[_0x359e3f];return _0x34e948;};'use strict';var _=require(_0xc003('0x0'));var util=require(_0xc003('0x1'));var logger=require(_0xc003('0x2'))('api');var moment=require(_0xc003('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc003('0x4'));var rimraf=require('rimraf');var config=require(_0xc003('0x5'));var attributes=require(_0xc003('0x6'));module[_0xc003('0x7')]=function(_0x4ae3ea,_0x20eb1b){return _0x4ae3ea['define'](_0xc003('0x8'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc003('0x9'),'collate':_0xc003('0xa'),'hooks':{'beforeUpdate':function(_0x7ccf0,_0x4a28c6,_0x4703ad){if(_0x7ccf0[_0xc003('0xb')](_0xc003('0xc'))){_0x7ccf0[_0xc003('0xd')]=moment()[_0xc003('0xe')](_0xc003('0xf'));}_0x4703ad(null,_0x7ccf0);}}});}; \ No newline at end of file +var _0x6a44=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./openchannelInteraction.attributes','exports','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x2493f7,_0x49c670){var _0x594ab2=function(_0x344ec2){while(--_0x344ec2){_0x2493f7['push'](_0x2493f7['shift']());}};_0x594ab2(++_0x49c670);}(_0x6a44,0x7f));var _0x46a4=function(_0xa7e6e9,_0x50dde1){_0xa7e6e9=_0xa7e6e9-0x0;var _0x52ca98=_0x6a44[_0xa7e6e9];return _0x52ca98;};'use strict';var _=require(_0x46a4('0x0'));var util=require('util');var logger=require(_0x46a4('0x1'))(_0x46a4('0x2'));var moment=require(_0x46a4('0x3'));var BPromise=require(_0x46a4('0x4'));var rp=require(_0x46a4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x46a4('0x6'));var attributes=require(_0x46a4('0x7'));module[_0x46a4('0x8')]=function(_0xa29c4d,_0x2b53eb){return _0xa29c4d['define'](_0x46a4('0x9'),attributes,{'tableName':_0x46a4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x46a4('0xb'),'collate':_0x46a4('0xc'),'hooks':{'beforeUpdate':function(_0x51c83e,_0x515f1a,_0x9955ea){if(_0x51c83e[_0x46a4('0xd')]('closed')){_0x51c83e[_0x46a4('0xe')]=moment()['format'](_0x46a4('0xf'));}_0x9955ea(null,_0x51c83e);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index e699f00..aa84690 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 _0x17fc=['message','OpenchannelInteraction','update','body','options','attributes','limit','stringify','catch','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','find','where','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','localhost','socket.io-emitter','redis','then','info','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','OpenchannelInteraction,\x20%s,\x20%s'];(function(_0x2aff19,_0x29ab61){var _0x674350=function(_0x500f9f){while(--_0x500f9f){_0x2aff19['push'](_0x2aff19['shift']());}};_0x674350(++_0x29ab61);}(_0x17fc,0x18c));var _0xc17f=function(_0x14f051,_0xb0a25d){_0x14f051=_0x14f051-0x0;var _0x6f0bb2=_0x17fc[_0x14f051];return _0x6f0bb2;};'use strict';var _=require(_0xc17f('0x0'));var util=require(_0xc17f('0x1'));var moment=require(_0xc17f('0x2'));var BPromise=require(_0xc17f('0x3'));var rs=require(_0xc17f('0x4'));var fs=require('fs');var Redis=require(_0xc17f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc17f('0x6'))(_0xc17f('0x7'));var config=require(_0xc17f('0x8'));var jayson=require(_0xc17f('0x9'));var client=jayson[_0xc17f('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xc17f('0xb'),'port':0x18eb});var socket=require(_0xc17f('0xc'))(new Redis(config[_0xc17f('0xd')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x1ac9c9,_0x5d0bd4,_0x4a0940){return new BPromise(function(_0x2d209b,_0x44ec27){return client['request'](_0x1ac9c9,_0x4a0940)[_0xc17f('0xe')](function(_0x4f4bb8){logger[_0xc17f('0xf')]('OpenchannelInteraction,\x20%s,\x20%s',_0x5d0bd4,_0xc17f('0x10'));logger[_0xc17f('0x11')](_0xc17f('0x12'),_0x5d0bd4,_0xc17f('0x10'),JSON['stringify'](_0x4f4bb8));if(_0x4f4bb8[_0xc17f('0x13')]){if(_0x4f4bb8[_0xc17f('0x13')][_0xc17f('0x14')]===0x1f4){logger[_0xc17f('0x13')](_0xc17f('0x15'),_0x5d0bd4,_0x4f4bb8['error'][_0xc17f('0x16')]);return _0x44ec27(_0x4f4bb8[_0xc17f('0x13')][_0xc17f('0x16')]);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x5d0bd4,_0x4f4bb8[_0xc17f('0x13')][_0xc17f('0x16')]);return _0x2d209b(_0x4f4bb8[_0xc17f('0x13')]['message']);}else{logger[_0xc17f('0xf')](_0xc17f('0x15'),_0x5d0bd4,_0xc17f('0x10'));_0x2d209b(_0x4f4bb8['result'][_0xc17f('0x16')]);}})['catch'](function(_0x5ad6c4){logger[_0xc17f('0x13')](_0xc17f('0x15'),_0x5d0bd4,_0x5ad6c4);_0x44ec27(_0x5ad6c4);});});}exports['UpdateOpenchannelInteraction']=function(_0x16d9ca){var _0x36d5e2=this;return new Promise(function(_0x11350c,_0x45f0d5){return db[_0xc17f('0x17')][_0xc17f('0x18')](_0x16d9ca[_0xc17f('0x19')],{'raw':_0x16d9ca['options']?_0x16d9ca[_0xc17f('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16d9ca[_0xc17f('0x1a')]?_0x16d9ca[_0xc17f('0x1a')]['where']||null:null,'attributes':_0x16d9ca['options']?_0x16d9ca[_0xc17f('0x1a')][_0xc17f('0x1b')]||null:null,'limit':_0x16d9ca[_0xc17f('0x1a')]?_0x16d9ca[_0xc17f('0x1a')][_0xc17f('0x1c')]||null:null})['then'](function(_0x29d3d6){logger[_0xc17f('0xf')]('UpdateOpenchannelInteraction',_0x16d9ca);logger[_0xc17f('0x11')]('UpdateOpenchannelInteraction',_0x16d9ca,JSON[_0xc17f('0x1d')](_0x29d3d6));_0x11350c(_0x29d3d6);})[_0xc17f('0x1e')](function(_0x4b1acd){logger[_0xc17f('0x13')](_0xc17f('0x1f'),_0x4b1acd['message'],_0x16d9ca);_0x45f0d5(_0x36d5e2[_0xc17f('0x13')](0x1f4,_0x4b1acd[_0xc17f('0x16')]));});});};exports[_0xc17f('0x20')]=function(_0x12578e){return new Promise(function(_0x5d7385,_0x1ee089){return db['OpenchannelInteraction'][_0xc17f('0x21')]({'where':_0x12578e[_0xc17f('0x1a')]?_0x12578e['options'][_0xc17f('0x22')]||null:null})['then'](function(_0x52e679){if(_0x52e679){return _0x52e679['addTags'](_0x12578e[_0xc17f('0x19')][_0xc17f('0x23')],_['omit'](_0x12578e['body'],[_0xc17f('0x23'),'id'])||{});}})[_0xc17f('0x24')](function(_0x5cc53f){logger[_0xc17f('0xf')](_0xc17f('0x25'),_0x12578e);logger[_0xc17f('0x11')](_0xc17f('0x25'),_0x12578e,JSON[_0xc17f('0x1d')](_0x5cc53f));_0x5d7385(_0x5cc53f);})[_0xc17f('0x1e')](function(_0x4c2544){logger[_0xc17f('0x13')](_0xc17f('0x25'),_0x4c2544['message'],_0x12578e);_0x1ee089(_this[_0xc17f('0x13')](0x1f4,_0x4c2544[_0xc17f('0x16')]));});});}; \ No newline at end of file +var _0x0f7a=['then','catch','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','addTags','ids','omit','AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','UpdateOpenchannelInteraction','update','body','options','raw','where','attributes'];(function(_0xc45b9e,_0x40022d){var _0x35a945=function(_0x12472b){while(--_0x12472b){_0xc45b9e['push'](_0xc45b9e['shift']());}};_0x35a945(++_0x40022d);}(_0x0f7a,0xea));var _0xa0f7=function(_0x2b1b15,_0x3b5ec8){_0x2b1b15=_0x2b1b15-0x0;var _0x395892=_0x0f7a[_0x2b1b15];return _0x395892;};'use strict';var _=require(_0xa0f7('0x0'));var util=require(_0xa0f7('0x1'));var moment=require(_0xa0f7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa0f7('0x3'));var db=require(_0xa0f7('0x4'))['db'];var utils=require(_0xa0f7('0x5'));var logger=require(_0xa0f7('0x6'))(_0xa0f7('0x7'));var config=require(_0xa0f7('0x8'));var jayson=require(_0xa0f7('0x9'));var client=jayson[_0xa0f7('0xa')][_0xa0f7('0xb')]({'port':0x232a});config[_0xa0f7('0xc')]=_[_0xa0f7('0xd')](config[_0xa0f7('0xc')],{'host':_0xa0f7('0xe'),'port':0x18eb});var socket=require(_0xa0f7('0xf'))(new Redis(config[_0xa0f7('0xc')]));require(_0xa0f7('0x10'))[_0xa0f7('0x11')](socket);function respondWithRpcPromise(_0x2bc313,_0x244e32,_0x56bf39){return new BPromise(function(_0x5d1174,_0x4a9a5b){return client[_0xa0f7('0x12')](_0x2bc313,_0x56bf39)['then'](function(_0xdeff83){logger[_0xa0f7('0x13')](_0xa0f7('0x14'),_0x244e32,'request\x20sent');logger[_0xa0f7('0x15')](_0xa0f7('0x16'),_0x244e32,_0xa0f7('0x17'),JSON[_0xa0f7('0x18')](_0xdeff83));if(_0xdeff83[_0xa0f7('0x19')]){if(_0xdeff83['error'][_0xa0f7('0x1a')]===0x1f4){logger[_0xa0f7('0x19')](_0xa0f7('0x14'),_0x244e32,_0xdeff83[_0xa0f7('0x19')][_0xa0f7('0x1b')]);return _0x4a9a5b(_0xdeff83[_0xa0f7('0x19')][_0xa0f7('0x1b')]);}logger[_0xa0f7('0x19')]('OpenchannelInteraction,\x20%s,\x20%s',_0x244e32,_0xdeff83[_0xa0f7('0x19')]['message']);return _0x5d1174(_0xdeff83[_0xa0f7('0x19')]['message']);}else{logger[_0xa0f7('0x13')](_0xa0f7('0x14'),_0x244e32,_0xa0f7('0x17'));_0x5d1174(_0xdeff83[_0xa0f7('0x1c')][_0xa0f7('0x1b')]);}})['catch'](function(_0x2f7367){logger[_0xa0f7('0x19')](_0xa0f7('0x14'),_0x244e32,_0x2f7367);_0x4a9a5b(_0x2f7367);});});}exports[_0xa0f7('0x1d')]=function(_0x26951d){var _0x576a19=this;return new Promise(function(_0x4597ce,_0x493122){return db['OpenchannelInteraction'][_0xa0f7('0x1e')](_0x26951d[_0xa0f7('0x1f')],{'raw':_0x26951d[_0xa0f7('0x20')]?_0x26951d[_0xa0f7('0x20')][_0xa0f7('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26951d[_0xa0f7('0x20')]?_0x26951d[_0xa0f7('0x20')][_0xa0f7('0x22')]||null:null,'attributes':_0x26951d[_0xa0f7('0x20')]?_0x26951d[_0xa0f7('0x20')][_0xa0f7('0x23')]||null:null,'limit':_0x26951d[_0xa0f7('0x20')]?_0x26951d[_0xa0f7('0x20')]['limit']||null:null})[_0xa0f7('0x24')](function(_0x269d78){logger['info'](_0xa0f7('0x1d'),_0x26951d);logger[_0xa0f7('0x15')](_0xa0f7('0x1d'),_0x26951d,JSON[_0xa0f7('0x18')](_0x269d78));_0x4597ce(_0x269d78);})[_0xa0f7('0x25')](function(_0x42a334){logger[_0xa0f7('0x19')]('UpdateOpenchannelInteraction',_0x42a334[_0xa0f7('0x1b')],_0x26951d);_0x493122(_0x576a19[_0xa0f7('0x19')](0x1f4,_0x42a334[_0xa0f7('0x1b')]));});});};exports[_0xa0f7('0x26')]=function(_0x25f67e){return new Promise(function(_0x345227,_0x440bfd){return db[_0xa0f7('0x27')][_0xa0f7('0x28')]({'where':_0x25f67e[_0xa0f7('0x20')]?_0x25f67e[_0xa0f7('0x20')][_0xa0f7('0x22')]||null:null})['then'](function(_0xfca665){if(_0xfca665){return _0xfca665[_0xa0f7('0x29')](_0x25f67e[_0xa0f7('0x1f')][_0xa0f7('0x2a')],_[_0xa0f7('0x2b')](_0x25f67e['body'],[_0xa0f7('0x2a'),'id'])||{});}})['spread'](function(_0x185c21){logger[_0xa0f7('0x13')](_0xa0f7('0x2c'),_0x25f67e);logger[_0xa0f7('0x15')](_0xa0f7('0x2c'),_0x25f67e,JSON[_0xa0f7('0x18')](_0x185c21));_0x345227(_0x185c21);})[_0xa0f7('0x25')](function(_0xd85feb){logger[_0xa0f7('0x19')](_0xa0f7('0x2c'),_0xd85feb['message'],_0x25f67e);_0x440bfd(_this[_0xa0f7('0x19')](0x1f4,_0xd85feb[_0xa0f7('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index dfb50e8..4acc6bc 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 _0x81d0=['register','length','openchannelInteraction:','./openchannelInteraction.events','save','update','removeListener'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x81d0,0x1d1));var _0x081d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x81d0[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelInteractionEvents=require(_0x081d('0x0'));var events=[_0x081d('0x1'),'remove',_0x081d('0x2')];function createListener(_0x499f78,_0x2b8101){return function(_0x246db0){_0x2b8101['emit'](_0x499f78,_0x246db0);};}function removeListener(_0xd22ce3,_0x707e7a){return function(){OpenchannelInteractionEvents[_0x081d('0x3')](_0xd22ce3,_0x707e7a);};}exports[_0x081d('0x4')]=function(_0x85e8b3){for(var _0x4dbebc=0x0,_0x451843=events[_0x081d('0x5')];_0x4dbebc<_0x451843;_0x4dbebc++){var _0x54fe86=events[_0x4dbebc];var _0x520b26=createListener(_0x081d('0x6')+_0x54fe86,_0x85e8b3);OpenchannelInteractionEvents['on'](_0x54fe86,_0x520b26);}}; \ No newline at end of file +var _0xff31=['openchannelInteraction:','./openchannelInteraction.events','save','remove','update','register','length'];(function(_0x133cd0,_0x5b448e){var _0x46738c=function(_0x1ac793){while(--_0x1ac793){_0x133cd0['push'](_0x133cd0['shift']());}};_0x46738c(++_0x5b448e);}(_0xff31,0x135));var _0x1ff3=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xff31[_0x5447fd];return _0x15b28a;};'use strict';var OpenchannelInteractionEvents=require(_0x1ff3('0x0'));var events=[_0x1ff3('0x1'),_0x1ff3('0x2'),_0x1ff3('0x3')];function createListener(_0x39cc48,_0x36ce82){return function(_0x550099){_0x36ce82['emit'](_0x39cc48,_0x550099);};}function removeListener(_0x3c2311,_0x4fd5a6){return function(){OpenchannelInteractionEvents['removeListener'](_0x3c2311,_0x4fd5a6);};}exports[_0x1ff3('0x4')]=function(_0x568f52){for(var _0x4b9d4b=0x0,_0x53d7b5=events[_0x1ff3('0x5')];_0x4b9d4b<_0x53d7b5;_0x4b9d4b++){var _0x47f0e3=events[_0x4b9d4b];var _0x144d60=createListener(_0x1ff3('0x6')+_0x47f0e3,_0x568f52);OpenchannelInteractionEvents['on'](_0x47f0e3,_0x144d60);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index aec7bfe..0d6e0e3 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x385ed5,_0x449f76){var _0x27f199=function(_0x47d08f){while(--_0x47d08f){_0x385ed5['push'](_0x385ed5['shift']());}};_0x27f199(++_0x449f76);}(_0x9c44,0x178));var _0x49c4=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x28089e,_0x530f8a){var _0x46a73c=function(_0x461513){while(--_0x461513){_0x28089e['push'](_0x28089e['shift']());}};_0x46a73c(++_0x530f8a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./openchannelMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index aef8d08..4c27446 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 _0x2884=['STRING','sequelize','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0xb44b5f,_0x32e306){var _0x58633d=function(_0x5171b6){while(--_0x5171b6){_0xb44b5f['push'](_0xb44b5f['shift']());}};_0x58633d(++_0x32e306);}(_0x2884,0x1eb));var _0x4288=function(_0x41075d,_0x112862){_0x41075d=_0x41075d-0x0;var _0x11f102=_0x2884[_0x41075d];return _0x11f102;};'use strict';var Sequelize=require(_0x4288('0x0'));module['exports']={'body':{'type':Sequelize[_0x4288('0x1')](_0x4288('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x4288('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x4288('0x4')]('in',_0x4288('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x4288('0x6')]},'providerResponse':{'type':Sequelize[_0x4288('0x1')]}}; \ No newline at end of file +var _0xab95=['DATE','sequelize','exports','TEXT','BOOLEAN','out'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0xab95,0x1d5));var _0x5ab9=function(_0x87a700,_0x366a16){_0x87a700=_0x87a700-0x0;var _0x22c82b=_0xab95[_0x87a700];return _0x22c82b;};'use strict';var Sequelize=require(_0x5ab9('0x0'));module[_0x5ab9('0x1')]={'body':{'type':Sequelize[_0x5ab9('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x5ab9('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x5ab9('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x5ab9('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x5ab9('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x5ab9('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index e6e0644..49d26ee 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 _0xcd6a=['merge','type','VIRTUAL','filter','options','OpenchannelMessage','includeAll','findAll','rows','catch','show','params','include','find','body','destroy','describe','openchannel-interactions','accept','openchannel','read','readAt','format','UserId','user','get','OpenchannelInteraction','OpenchannelInteractionId','update','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','contact','User','agent','email','internal','interface','SIP/%s','channel','motionChannel','EventManager','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','SELECT','rejectmessage','eml-format','fast-json-patch','request-promise','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','register','client','http','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','then','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x2b2a8a,_0x2fe2b8){var _0x37ae21=function(_0x4becd9){while(--_0x4becd9){_0x2b2a8a['push'](_0x2b2a8a['shift']());}};_0x37ae21(++_0x2fe2b8);}(_0xcd6a,0x138));var _0xacd6=function(_0x1bd625,_0x3b2e7d){_0x1bd625=_0x1bd625-0x0;var _0x1333f0=_0xcd6a[_0x1bd625];return _0x1333f0;};'use strict';var emlformat=require(_0xacd6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xacd6('0x1'));var rp=require(_0xacd6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xacd6('0x3'));var util=require('util');var path=require('path');var sox=require(_0xacd6('0x4'));var csv=require('to-csv');var ejs=require(_0xacd6('0x5'));var fs=require('fs');var fs_extra=require(_0xacd6('0x6'));var _=require(_0xacd6('0x7'));var squel=require(_0xacd6('0x8'));var crypto=require(_0xacd6('0x9'));var jsforce=require(_0xacd6('0xa'));var deskjs=require(_0xacd6('0xb'));var toCsv=require(_0xacd6('0xc'));var querystring=require(_0xacd6('0xd'));var Papa=require('papaparse');var Redis=require(_0xacd6('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xacd6('0xf'));var as=require(_0xacd6('0x10'));var hardwareService=require(_0xacd6('0x11'));var logger=require(_0xacd6('0x12'))(_0xacd6('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xacd6('0x14'))['db'];config[_0xacd6('0x15')]=_['defaults'](config[_0xacd6('0x15')],{'host':_0xacd6('0x16'),'port':0x18eb});var socket=require(_0xacd6('0x17'))(new Redis(config[_0xacd6('0x15')]));require('./openchannelMessage.socket')[_0xacd6('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0xacd6('0x19')][_0xacd6('0x1a')]({'port':0x232c});var client9002=jayson[_0xacd6('0x19')][_0xacd6('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4beb03,_0x119278,_0x31a538,_0x2bdc3c){return new BPromise(function(_0x3b433c,_0x24f34d){var _0x173d8e=_0x2bdc3c||client;return _0x173d8e[_0xacd6('0x1b')](_0x4beb03,_0x31a538)['then'](function(_0x2c6866){logger[_0xacd6('0x1c')](_0xacd6('0x1d'),_0x119278,_0xacd6('0x1e'));logger['debug'](_0xacd6('0x1f'),_0x119278,_0xacd6('0x1e'),JSON[_0xacd6('0x20')](_0x2c6866));if(_0x2c6866[_0xacd6('0x21')]){if(_0x2c6866[_0xacd6('0x21')][_0xacd6('0x22')]===0x1f4){logger['error'](_0xacd6('0x1d'),_0x119278,_0x2c6866[_0xacd6('0x21')][_0xacd6('0x23')]);return _0x24f34d(_0x2c6866[_0xacd6('0x21')]['message']);}logger[_0xacd6('0x21')](_0xacd6('0x1d'),_0x119278,_0x2c6866[_0xacd6('0x21')][_0xacd6('0x23')]);return _0x3b433c(_0x2c6866['error'][_0xacd6('0x23')]);}else{logger['info'](_0xacd6('0x1d'),_0x119278,_0xacd6('0x1e'));_0x3b433c(_0x2c6866[_0xacd6('0x24')][_0xacd6('0x23')]);}})['catch'](function(_0x5aa33c){logger[_0xacd6('0x21')](_0xacd6('0x1d'),_0x119278,_0x5aa33c);_0x24f34d(_0x5aa33c);});});}function respondWithStatusCode(_0x62abb6,_0x420b50){_0x420b50=_0x420b50||0xcc;return function(_0x279a8c){if(_0x279a8c){return _0x62abb6[_0xacd6('0x25')](_0x420b50);}return _0x62abb6[_0xacd6('0x26')](_0x420b50)[_0xacd6('0x27')]();};}function respondWithResult(_0x854f10,_0x32b9ae){_0x32b9ae=_0x32b9ae||0xc8;return function(_0x34b504){if(_0x34b504){return _0x854f10[_0xacd6('0x26')](_0x32b9ae)[_0xacd6('0x28')](_0x34b504);}};}function respondWithFilteredResult(_0x17af03,_0x146515){return function(_0x1287fa){if(_0x1287fa){var _0x29341d=typeof _0x146515['offset']===_0xacd6('0x29')&&typeof _0x146515[_0xacd6('0x2a')]===_0xacd6('0x29');var _0x1107df=_0x1287fa[_0xacd6('0x2b')];var _0x38ddfe=_0x29341d?0x0:_0x146515[_0xacd6('0x2c')];var _0x569f83=_0x29341d?_0x1287fa[_0xacd6('0x2b')]:_0x146515[_0xacd6('0x2c')]+_0x146515['limit'];var _0x2165e6;if(_0x569f83>=_0x1107df){_0x569f83=_0x1107df;_0x2165e6=0xc8;}else{_0x2165e6=0xce;}_0x17af03[_0xacd6('0x26')](_0x2165e6);return _0x17af03['set'](_0xacd6('0x2d'),_0x38ddfe+'-'+_0x569f83+'/'+_0x1107df)[_0xacd6('0x28')](_0x1287fa);}return null;};}function patchUpdates(_0x2d8059){return function(_0x9a5ffb){try{jsonpatch[_0xacd6('0x2e')](_0x9a5ffb,_0x2d8059,!![]);}catch(_0x1ca02d){return BPromise[_0xacd6('0x2f')](_0x1ca02d);}return _0x9a5ffb[_0xacd6('0x30')]();};}function saveUpdates(_0x2be0b6,_0x4b7ddc){return function(_0x293407){if(_0x293407){return _0x293407['update'](_0x2be0b6)['then'](function(_0x282d12){return _0x282d12;});}return null;};}function removeEntity(_0x59b099,_0x24e43d){return function(_0x33fcfe){if(_0x33fcfe){return _0x33fcfe['destroy']()[_0xacd6('0x31')](function(){_0x59b099[_0xacd6('0x26')](0xcc)[_0xacd6('0x27')]();});}};}function handleEntityNotFound(_0x164ceb,_0x2e6332){return function(_0x40c325){if(!_0x40c325){_0x164ceb[_0xacd6('0x25')](0x194);}return _0x40c325;};}function handleError(_0x40cfbd,_0x2507dd){_0x2507dd=_0x2507dd||0x1f4;return function(_0x122447){logger[_0xacd6('0x21')](_0x122447[_0xacd6('0x32')]);if(_0x122447['name']){delete _0x122447[_0xacd6('0x33')];}_0x40cfbd['status'](_0x2507dd)[_0xacd6('0x34')](_0x122447);};}exports[_0xacd6('0x35')]=function(_0x24f8f0,_0x1f3a55){var _0x54ac15={},_0x4be40b={},_0x41051f={'count':0x0,'rows':[]};var _0x127307=_[_0xacd6('0x36')](db['OpenchannelMessage'][_0xacd6('0x37')],function(_0x88ec03){return{'name':_0x88ec03[_0xacd6('0x38')],'type':_0x88ec03['type'][_0xacd6('0x39')]};});_0x4be40b['model']=_['map'](_0x127307,_0xacd6('0x33'));_0x4be40b[_0xacd6('0x3a')]=_[_0xacd6('0x3b')](_0x24f8f0[_0xacd6('0x3a')]);_0x4be40b[_0xacd6('0x3c')]=_[_0xacd6('0x3d')](_0x4be40b[_0xacd6('0x3e')],_0x4be40b[_0xacd6('0x3a')]);_0x54ac15[_0xacd6('0x3f')]=_[_0xacd6('0x3d')](_0x4be40b[_0xacd6('0x3e')],qs[_0xacd6('0x40')](_0x24f8f0[_0xacd6('0x3a')][_0xacd6('0x40')]));_0x54ac15[_0xacd6('0x3f')]=_0x54ac15[_0xacd6('0x3f')][_0xacd6('0x41')]?_0x54ac15[_0xacd6('0x3f')]:_0x4be40b[_0xacd6('0x3e')];if(!_0x24f8f0['query'][_0xacd6('0x42')](_0xacd6('0x43'))){_0x54ac15[_0xacd6('0x2a')]=qs[_0xacd6('0x2a')](_0x24f8f0[_0xacd6('0x3a')][_0xacd6('0x2a')]);_0x54ac15[_0xacd6('0x2c')]=qs['offset'](_0x24f8f0[_0xacd6('0x3a')]['offset']);}_0x54ac15[_0xacd6('0x44')]=qs[_0xacd6('0x45')](_0x24f8f0[_0xacd6('0x3a')]['sort']);_0x54ac15[_0xacd6('0x46')]=qs[_0xacd6('0x3c')](_[_0xacd6('0x47')](_0x24f8f0['query'],_0x4be40b['filters']),_0x127307);if(_0x24f8f0[_0xacd6('0x3a')]['filter']){_0x54ac15[_0xacd6('0x46')]=_[_0xacd6('0x48')](_0x54ac15[_0xacd6('0x46')],{'$or':_[_0xacd6('0x36')](_0x127307,function(_0x1fcac0){if(_0x1fcac0[_0xacd6('0x49')]!==_0xacd6('0x4a')){var _0x210b6f={};_0x210b6f[_0x1fcac0[_0xacd6('0x33')]]={'$like':'%'+_0x24f8f0['query'][_0xacd6('0x4b')]+'%'};return _0x210b6f;}})});}_0x54ac15=_['merge']({},_0x54ac15,_0x24f8f0[_0xacd6('0x4c')]);var _0x337975={'where':_0x54ac15['where']};return db[_0xacd6('0x4d')][_0xacd6('0x2b')](_0x337975)[_0xacd6('0x31')](function(_0x543311){_0x41051f[_0xacd6('0x2b')]=_0x543311;if(_0x24f8f0[_0xacd6('0x3a')][_0xacd6('0x4e')]){_0x54ac15['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0xacd6('0x4f')](_0x54ac15);})[_0xacd6('0x31')](function(_0x2d1430){_0x41051f[_0xacd6('0x50')]=_0x2d1430;return _0x41051f;})['then'](respondWithFilteredResult(_0x1f3a55,_0x54ac15))[_0xacd6('0x51')](handleError(_0x1f3a55,null));};exports[_0xacd6('0x52')]=function(_0xf947b9,_0x396f75){var _0x1a3414={'raw':!![],'where':{'id':_0xf947b9[_0xacd6('0x53')]['id']}},_0x203760={};_0x203760[_0xacd6('0x3e')]=_[_0xacd6('0x3b')](db[_0xacd6('0x4d')][_0xacd6('0x37')]);_0x203760[_0xacd6('0x3a')]=_[_0xacd6('0x3b')](_0xf947b9[_0xacd6('0x3a')]);_0x203760[_0xacd6('0x3c')]=_[_0xacd6('0x3d')](_0x203760['model'],_0x203760[_0xacd6('0x3a')]);_0x1a3414['attributes']=_[_0xacd6('0x3d')](_0x203760[_0xacd6('0x3e')],qs[_0xacd6('0x40')](_0xf947b9['query'][_0xacd6('0x40')]));_0x1a3414['attributes']=_0x1a3414[_0xacd6('0x3f')][_0xacd6('0x41')]?_0x1a3414['attributes']:_0x203760['model'];if(_0xf947b9[_0xacd6('0x3a')][_0xacd6('0x4e')]){_0x1a3414[_0xacd6('0x54')]=[{'all':!![]}];}_0x1a3414=_[_0xacd6('0x48')]({},_0x1a3414,_0xf947b9[_0xacd6('0x4c')]);return db[_0xacd6('0x4d')][_0xacd6('0x55')](_0x1a3414)[_0xacd6('0x31')](handleEntityNotFound(_0x396f75,null))['then'](respondWithResult(_0x396f75,null))[_0xacd6('0x51')](handleError(_0x396f75,null));};exports['create']=function(_0x58f636,_0x55b42d){return db['OpenchannelMessage']['create'](_0x58f636['body'],{})[_0xacd6('0x31')](respondWithResult(_0x55b42d,0xc9))[_0xacd6('0x51')](handleError(_0x55b42d,null));};exports['update']=function(_0x590cad,_0x4218e5){if(_0x590cad[_0xacd6('0x56')]['id']){delete _0x590cad[_0xacd6('0x56')]['id'];}return db[_0xacd6('0x4d')][_0xacd6('0x55')]({'where':{'id':_0x590cad[_0xacd6('0x53')]['id']}})[_0xacd6('0x31')](handleEntityNotFound(_0x4218e5,null))[_0xacd6('0x31')](saveUpdates(_0x590cad['body'],null))['then'](respondWithResult(_0x4218e5,null))['catch'](handleError(_0x4218e5,null));};exports[_0xacd6('0x57')]=function(_0x44e524,_0x5c5537){return db[_0xacd6('0x4d')][_0xacd6('0x55')]({'where':{'id':_0x44e524[_0xacd6('0x53')]['id']}})[_0xacd6('0x31')](handleEntityNotFound(_0x5c5537,null))[_0xacd6('0x31')](removeEntity(_0x5c5537,null))['catch'](handleError(_0x5c5537,null));};exports[_0xacd6('0x58')]=function(_0x301ac1,_0x1789b0){return db['OpenchannelMessage']['describe']()['then'](respondWithResult(_0x1789b0,null))[_0xacd6('0x51')](handleError(_0x1789b0,null));};var interaction_log=require(_0xacd6('0x12'))(_0xacd6('0x59'));exports[_0xacd6('0x5a')]=function(_0x33f06f,_0x7a80e6,_0x580ef2){var _0x1e99fb={'agent':{},'channel':_0xacd6('0x5b')};if(_0x33f06f[_0xacd6('0x56')]['id']){delete _0x33f06f[_0xacd6('0x56')]['id'];}_0x33f06f['body'][_0xacd6('0x5c')]=!![];_0x33f06f[_0xacd6('0x56')][_0xacd6('0x5d')]=moment()[_0xacd6('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x33f06f[_0xacd6('0x56')]['UserId']=_0x33f06f[_0xacd6('0x56')][_0xacd6('0x5f')]||_0x33f06f[_0xacd6('0x60')]['id'];_0x1e99fb['agent']['id']=_0x33f06f['body'][_0xacd6('0x5f')];return db['OpenchannelMessage'][_0xacd6('0x55')]({'where':{'id':_0x33f06f[_0xacd6('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x7a80e6,null))[_0xacd6('0x31')](saveUpdates(_0x33f06f[_0xacd6('0x56')],null))[_0xacd6('0x31')](function(_0x14c18f){if(_0x14c18f){_0x1e99fb[_0xacd6('0x23')]=_0x14c18f[_0xacd6('0x61')]({'plain':!![]});return db[_0xacd6('0x62')][_0xacd6('0x55')]({'where':{'id':_0x14c18f[_0xacd6('0x63')]}});}return null;})[_0xacd6('0x31')](handleEntityNotFound(_0x7a80e6,null))[_0xacd6('0x31')](function(_0x42e22c){if(_0x42e22c){return _0x42e22c[_0xacd6('0x64')]({'UserId':_0x33f06f[_0xacd6('0x56')][_0xacd6('0x5f')],'read1stAt':_[_0xacd6('0x65')](_0x42e22c[_0xacd6('0x66')])?moment()[_0xacd6('0x5e')](_0xacd6('0x67')):undefined});}return null;})[_0xacd6('0x31')](function(_0x3ae6ae){if(_0x3ae6ae){_0x1e99fb['interaction']=_0x3ae6ae['get']({'plain':!![]});interaction_log[_0xacd6('0x1c')](_0xacd6('0x68'),_0x33f06f[_0xacd6('0x60')]['id'],_0x33f06f[_0xacd6('0x60')][_0xacd6('0x33')],_0x33f06f[_0xacd6('0x60')][_0xacd6('0x69')],_0x1e99fb[_0xacd6('0x6a')]['id'],_0x33f06f['body']?JSON[_0xacd6('0x20')](_0x33f06f[_0xacd6('0x56')]):_0xacd6('0x6b'));return respondWithRpcPromise(_0xacd6('0x6c'),'acceptMessage',_0x1e99fb);}return null;})[_0xacd6('0x31')](function(_0x4e7033){var _0x2999ae=_0xacd6('0x6d')+_0x4e7033[_0xacd6('0x23')]['ContactId'];return db['sequelize'][_0xacd6('0x3a')](_0x2999ae,{'type':db[_0xacd6('0x6e')][_0xacd6('0x6f')]['SELECT'],'raw':!![]})[_0xacd6('0x31')](function(_0x27cea5){return _0x27cea5;});})[_0xacd6('0x31')](function(_0x12b92d){if(_0x12b92d){_0x1e99fb[_0xacd6('0x23')][_0xacd6('0x70')]=_0x12b92d[0x0];if(!_0x33f06f[_0xacd6('0x56')]['UserId'])return;return db[_0xacd6('0x71')][_0xacd6('0x55')]({'where':{'id':_0x33f06f[_0xacd6('0x56')][_0xacd6('0x5f')],'role':_0xacd6('0x72')},'attributes':['id',_0xacd6('0x33'),'fullname',_0xacd6('0x73'),_0xacd6('0x74')],'raw':!![]});}return null;})[_0xacd6('0x31')](function(_0x12e274){if(!_0x12e274)return null;_0x1e99fb[_0xacd6('0x23')][_0xacd6('0x72')]=_0x12e274;return _0x1e99fb;})[_0xacd6('0x31')](function(_0x5399ff){if(_0x5399ff){if(_0x33f06f[_0xacd6('0x56')]['manual']){_0x1e99fb[_0xacd6('0x23')][_0xacd6('0x75')]=util[_0xacd6('0x5e')](_0xacd6('0x76'),_0x33f06f[_0xacd6('0x60')][_0xacd6('0x33')]);_0x1e99fb[_0xacd6('0x23')][_0xacd6('0x77')]=_0x1e99fb[_0xacd6('0x77')];_0x1e99fb[_0xacd6('0x23')][_0xacd6('0x78')]=_0x1e99fb['channel'];_0x1e99fb['message']['event']=_0xacd6('0x5a');return respondWithRpcPromise(_0xacd6('0x79'),'EventManager',{'event':'acceptmessage','message':_0x1e99fb[_0xacd6('0x23')]},client9002)[_0xacd6('0x31')](function(){return _0x1e99fb;});}return _0x1e99fb;}return null;})[_0xacd6('0x31')](respondWithResult(_0x7a80e6,null))[_0xacd6('0x51')](handleError(_0x7a80e6,null));};var interaction_log=require(_0xacd6('0x12'))('openchannel-interactions');exports[_0xacd6('0x2f')]=function(_0x4dd8b4,_0x5d4817,_0x336495){var _0x5541ec={'agent':{},'channel':_0xacd6('0x5b')};if(_0x4dd8b4['body']['id']){delete _0x4dd8b4[_0xacd6('0x56')]['id'];}_0x4dd8b4[_0xacd6('0x56')][_0xacd6('0x5f')]=_0x4dd8b4[_0xacd6('0x56')][_0xacd6('0x5f')]||_0x4dd8b4[_0xacd6('0x60')]['id'];_0x5541ec['agent']['id']=_0x4dd8b4['body'][_0xacd6('0x5f')];return db[_0xacd6('0x4d')][_0xacd6('0x55')]({'where':{'id':_0x4dd8b4[_0xacd6('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5d4817,null))[_0xacd6('0x31')](function(_0x516fd9){if(_0x516fd9){_0x5541ec[_0xacd6('0x23')]=_0x516fd9['get']({'plain':!![]});return db[_0xacd6('0x62')][_0xacd6('0x55')]({'where':{'id':_0x516fd9[_0xacd6('0x63')]}});}return null;})[_0xacd6('0x31')](handleEntityNotFound(_0x5d4817,null))['then'](function(_0x45a775){if(_0x45a775){_0x5541ec[_0xacd6('0x6a')]=_0x45a775['get']({'plain':!![]});interaction_log[_0xacd6('0x1c')](_0xacd6('0x7a'),_0x4dd8b4[_0xacd6('0x60')]['id'],_0x4dd8b4[_0xacd6('0x60')]['name'],_0x4dd8b4[_0xacd6('0x60')][_0xacd6('0x69')],_0x5541ec[_0xacd6('0x6a')]['id'],_0x4dd8b4[_0xacd6('0x56')]?JSON[_0xacd6('0x20')](_0x4dd8b4['body']):_0xacd6('0x6b'));return respondWithRpcPromise(_0xacd6('0x7b'),_0xacd6('0x7c'),_0x5541ec);}return null;})[_0xacd6('0x31')](function(_0x4b6f9f){var _0x34f4f8=_0xacd6('0x6d')+_0x4b6f9f[_0xacd6('0x23')][_0xacd6('0x7d')];return db['sequelize'][_0xacd6('0x3a')](_0x34f4f8,{'type':db[_0xacd6('0x6e')][_0xacd6('0x6f')][_0xacd6('0x7e')],'raw':!![]})[_0xacd6('0x31')](function(_0x1c074b){return _0x1c074b;});})[_0xacd6('0x31')](function(_0x3f569b){if(_0x3f569b){_0x5541ec[_0xacd6('0x23')][_0xacd6('0x70')]=_0x3f569b[0x0];if(!_0x4dd8b4[_0xacd6('0x56')]['UserId'])return;return db[_0xacd6('0x71')][_0xacd6('0x55')]({'where':{'id':_0x4dd8b4[_0xacd6('0x56')]['UserId'],'role':_0xacd6('0x72')},'attributes':['id',_0xacd6('0x33'),'fullname',_0xacd6('0x73'),_0xacd6('0x74')],'raw':!![]});}return null;})[_0xacd6('0x31')](function(_0x3d45e2){if(!_0x3d45e2)return null;_0x5541ec[_0xacd6('0x23')][_0xacd6('0x72')]=_0x3d45e2;return _0x5541ec;})[_0xacd6('0x31')](function(_0x188ce3){if(_0x188ce3){_0x188ce3[_0xacd6('0x23')][_0xacd6('0x75')]=util[_0xacd6('0x5e')]('SIP/%s',_0x4dd8b4['user'][_0xacd6('0x33')]);_0x188ce3[_0xacd6('0x23')]['channel']=_0x5541ec['channel'];_0x188ce3[_0xacd6('0x23')][_0xacd6('0x78')]=_0x5541ec[_0xacd6('0x77')];_0x188ce3[_0xacd6('0x23')]['event']=_0xacd6('0x2f');respondWithRpcPromise(_0xacd6('0x79'),'EventManager',{'event':_0xacd6('0x7f'),'message':_0x188ce3['message']},client9002);return _0x5541ec;}return null;})[_0xacd6('0x31')](respondWithResult(_0x5d4817,null))[_0xacd6('0x51')](handleError(_0x5d4817,null));}; \ No newline at end of file +var _0xf375=['read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','manual','channel','motionChannel','event','EventManager','acceptmessage','openchannel','OpenchannelInteraction','OpenchannelInteractionId','stringify','null','RejectMessage','email','interface','rejectmessage','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','sendStatus','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','includeAll','include','findAll','rows','show','params','keys','find','create','body','describe','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','isNil'];(function(_0x7ab7c2,_0x314efb){var _0x74ee2a=function(_0x4bc70b){while(--_0x4bc70b){_0x7ab7c2['push'](_0x7ab7c2['shift']());}};_0x74ee2a(++_0x314efb);}(_0xf375,0x19f));var _0x5f37=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xf375[_0x432682];return _0x463d05;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5f37('0x0'));var rp=require(_0x5f37('0x1'));var moment=require(_0x5f37('0x2'));var BPromise=require(_0x5f37('0x3'));var Mustache=require(_0x5f37('0x4'));var util=require(_0x5f37('0x5'));var path=require(_0x5f37('0x6'));var sox=require(_0x5f37('0x7'));var csv=require(_0x5f37('0x8'));var ejs=require(_0x5f37('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(_0x5f37('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x5f37('0x8'));var querystring=require('querystring');var Papa=require(_0x5f37('0xb'));var Redis=require(_0x5f37('0xc'));var authService=require(_0x5f37('0xd'));var qs=require(_0x5f37('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5f37('0xf'));var logger=require('../../config/logger')(_0x5f37('0x10'));var utils=require(_0x5f37('0x11'));var config=require(_0x5f37('0x12'));var licenseUtil=require(_0x5f37('0x13'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x5f37('0x14')](config[_0x5f37('0x15')],{'host':_0x5f37('0x16'),'port':0x18eb});var socket=require(_0x5f37('0x17'))(new Redis(config['redis']));require('./openchannelMessage.socket')[_0x5f37('0x18')](socket);var jayson=require(_0x5f37('0x19'));var client=jayson[_0x5f37('0x1a')][_0x5f37('0x1b')]({'port':0x232c});var client9002=jayson[_0x5f37('0x1a')][_0x5f37('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x38e605,_0x3743be,_0x5ed808,_0x338933){return new BPromise(function(_0x698b46,_0x2c13ff){var _0x55c64c=_0x338933||client;return _0x55c64c[_0x5f37('0x1c')](_0x38e605,_0x5ed808)[_0x5f37('0x1d')](function(_0x926c1e){logger[_0x5f37('0x1e')](_0x5f37('0x1f'),_0x3743be,'request\x20sent');logger[_0x5f37('0x20')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x3743be,_0x5f37('0x21'),JSON['stringify'](_0x926c1e));if(_0x926c1e[_0x5f37('0x22')]){if(_0x926c1e[_0x5f37('0x22')]['code']===0x1f4){logger[_0x5f37('0x22')](_0x5f37('0x1f'),_0x3743be,_0x926c1e[_0x5f37('0x22')][_0x5f37('0x23')]);return _0x2c13ff(_0x926c1e[_0x5f37('0x22')][_0x5f37('0x23')]);}logger[_0x5f37('0x22')](_0x5f37('0x1f'),_0x3743be,_0x926c1e[_0x5f37('0x22')][_0x5f37('0x23')]);return _0x698b46(_0x926c1e[_0x5f37('0x22')][_0x5f37('0x23')]);}else{logger[_0x5f37('0x1e')](_0x5f37('0x1f'),_0x3743be,'request\x20sent');_0x698b46(_0x926c1e[_0x5f37('0x24')][_0x5f37('0x23')]);}})[_0x5f37('0x25')](function(_0x15f90e){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x3743be,_0x15f90e);_0x2c13ff(_0x15f90e);});});}function respondWithStatusCode(_0x47aa25,_0x4f5bdc){_0x4f5bdc=_0x4f5bdc||0xcc;return function(_0x190c48){if(_0x190c48){return _0x47aa25[_0x5f37('0x26')](_0x4f5bdc);}return _0x47aa25['status'](_0x4f5bdc)['end']();};}function respondWithResult(_0x4f8510,_0x4ec974){_0x4ec974=_0x4ec974||0xc8;return function(_0x30faf1){if(_0x30faf1){return _0x4f8510['status'](_0x4ec974)[_0x5f37('0x27')](_0x30faf1);}};}function respondWithFilteredResult(_0x5468ba,_0x193bfc){return function(_0x3133a5){if(_0x3133a5){var _0x343b76=typeof _0x193bfc[_0x5f37('0x28')]===_0x5f37('0x29')&&typeof _0x193bfc['limit']==='undefined';var _0x4bd717=_0x3133a5['count'];var _0x4d6713=_0x343b76?0x0:_0x193bfc['offset'];var _0x271e22=_0x343b76?_0x3133a5[_0x5f37('0x2a')]:_0x193bfc[_0x5f37('0x28')]+_0x193bfc[_0x5f37('0x2b')];var _0x53d666;if(_0x271e22>=_0x4bd717){_0x271e22=_0x4bd717;_0x53d666=0xc8;}else{_0x53d666=0xce;}_0x5468ba[_0x5f37('0x2c')](_0x53d666);return _0x5468ba[_0x5f37('0x2d')](_0x5f37('0x2e'),_0x4d6713+'-'+_0x271e22+'/'+_0x4bd717)[_0x5f37('0x27')](_0x3133a5);}return null;};}function patchUpdates(_0x53f1f2){return function(_0x1cc09a){try{jsonpatch[_0x5f37('0x2f')](_0x1cc09a,_0x53f1f2,!![]);}catch(_0x302e2c){return BPromise[_0x5f37('0x30')](_0x302e2c);}return _0x1cc09a[_0x5f37('0x31')]();};}function saveUpdates(_0x198183,_0x38b888){return function(_0x39cdfc){if(_0x39cdfc){return _0x39cdfc[_0x5f37('0x32')](_0x198183)[_0x5f37('0x1d')](function(_0x1c5e2b){return _0x1c5e2b;});}return null;};}function removeEntity(_0x3e7b8b,_0x286e8d){return function(_0x18c808){if(_0x18c808){return _0x18c808[_0x5f37('0x33')]()[_0x5f37('0x1d')](function(){_0x3e7b8b[_0x5f37('0x2c')](0xcc)[_0x5f37('0x34')]();});}};}function handleEntityNotFound(_0x132a31,_0x265ef2){return function(_0x5f3058){if(!_0x5f3058){_0x132a31[_0x5f37('0x26')](0x194);}return _0x5f3058;};}function handleError(_0x3c4346,_0xb21ee8){_0xb21ee8=_0xb21ee8||0x1f4;return function(_0x538ad8){logger[_0x5f37('0x22')](_0x538ad8[_0x5f37('0x35')]);if(_0x538ad8[_0x5f37('0x36')]){delete _0x538ad8[_0x5f37('0x36')];}_0x3c4346[_0x5f37('0x2c')](_0xb21ee8)[_0x5f37('0x37')](_0x538ad8);};}exports[_0x5f37('0x38')]=function(_0x3e41fc,_0x401eff){var _0x4c0dc4={},_0x5efcfa={},_0x17917a={'count':0x0,'rows':[]};var _0x26ff23=_[_0x5f37('0x39')](db[_0x5f37('0x3a')][_0x5f37('0x3b')],function(_0x5de503){return{'name':_0x5de503[_0x5f37('0x3c')],'type':_0x5de503[_0x5f37('0x3d')][_0x5f37('0x3e')]};});_0x5efcfa[_0x5f37('0x3f')]=_[_0x5f37('0x39')](_0x26ff23,_0x5f37('0x36'));_0x5efcfa[_0x5f37('0x40')]=_['keys'](_0x3e41fc['query']);_0x5efcfa[_0x5f37('0x41')]=_['intersection'](_0x5efcfa['model'],_0x5efcfa[_0x5f37('0x40')]);_0x4c0dc4[_0x5f37('0x42')]=_[_0x5f37('0x43')](_0x5efcfa[_0x5f37('0x3f')],qs['fields'](_0x3e41fc[_0x5f37('0x40')][_0x5f37('0x44')]));_0x4c0dc4['attributes']=_0x4c0dc4[_0x5f37('0x42')][_0x5f37('0x45')]?_0x4c0dc4[_0x5f37('0x42')]:_0x5efcfa[_0x5f37('0x3f')];if(!_0x3e41fc[_0x5f37('0x40')][_0x5f37('0x46')](_0x5f37('0x47'))){_0x4c0dc4['limit']=qs['limit'](_0x3e41fc[_0x5f37('0x40')]['limit']);_0x4c0dc4['offset']=qs[_0x5f37('0x28')](_0x3e41fc[_0x5f37('0x40')][_0x5f37('0x28')]);}_0x4c0dc4['order']=qs[_0x5f37('0x48')](_0x3e41fc[_0x5f37('0x40')]['sort']);_0x4c0dc4[_0x5f37('0x49')]=qs[_0x5f37('0x41')](_['pick'](_0x3e41fc['query'],_0x5efcfa[_0x5f37('0x41')]),_0x26ff23);if(_0x3e41fc['query'][_0x5f37('0x4a')]){_0x4c0dc4[_0x5f37('0x49')]=_[_0x5f37('0x4b')](_0x4c0dc4[_0x5f37('0x49')],{'$or':_['map'](_0x26ff23,function(_0x684f87){if(_0x684f87['type']!=='VIRTUAL'){var _0x4b19c3={};_0x4b19c3[_0x684f87['name']]={'$like':'%'+_0x3e41fc[_0x5f37('0x40')][_0x5f37('0x4a')]+'%'};return _0x4b19c3;}})});}_0x4c0dc4=_[_0x5f37('0x4b')]({},_0x4c0dc4,_0x3e41fc['options']);var _0x32e0c0={'where':_0x4c0dc4[_0x5f37('0x49')]};return db[_0x5f37('0x3a')][_0x5f37('0x2a')](_0x32e0c0)[_0x5f37('0x1d')](function(_0xaf15ae){_0x17917a[_0x5f37('0x2a')]=_0xaf15ae;if(_0x3e41fc[_0x5f37('0x40')][_0x5f37('0x4c')]){_0x4c0dc4[_0x5f37('0x4d')]=[{'all':!![]}];}return db[_0x5f37('0x3a')][_0x5f37('0x4e')](_0x4c0dc4);})[_0x5f37('0x1d')](function(_0x5a064d){_0x17917a[_0x5f37('0x4f')]=_0x5a064d;return _0x17917a;})['then'](respondWithFilteredResult(_0x401eff,_0x4c0dc4))[_0x5f37('0x25')](handleError(_0x401eff,null));};exports[_0x5f37('0x50')]=function(_0x508f8c,_0x1ff20f){var _0x3ecb14={'raw':!![],'where':{'id':_0x508f8c[_0x5f37('0x51')]['id']}},_0x181ffb={};_0x181ffb[_0x5f37('0x3f')]=_[_0x5f37('0x52')](db[_0x5f37('0x3a')][_0x5f37('0x3b')]);_0x181ffb[_0x5f37('0x40')]=_[_0x5f37('0x52')](_0x508f8c[_0x5f37('0x40')]);_0x181ffb[_0x5f37('0x41')]=_[_0x5f37('0x43')](_0x181ffb[_0x5f37('0x3f')],_0x181ffb[_0x5f37('0x40')]);_0x3ecb14['attributes']=_[_0x5f37('0x43')](_0x181ffb[_0x5f37('0x3f')],qs['fields'](_0x508f8c[_0x5f37('0x40')][_0x5f37('0x44')]));_0x3ecb14['attributes']=_0x3ecb14[_0x5f37('0x42')]['length']?_0x3ecb14[_0x5f37('0x42')]:_0x181ffb[_0x5f37('0x3f')];if(_0x508f8c[_0x5f37('0x40')][_0x5f37('0x4c')]){_0x3ecb14[_0x5f37('0x4d')]=[{'all':!![]}];}_0x3ecb14=_[_0x5f37('0x4b')]({},_0x3ecb14,_0x508f8c['options']);return db[_0x5f37('0x3a')][_0x5f37('0x53')](_0x3ecb14)[_0x5f37('0x1d')](handleEntityNotFound(_0x1ff20f,null))[_0x5f37('0x1d')](respondWithResult(_0x1ff20f,null))[_0x5f37('0x25')](handleError(_0x1ff20f,null));};exports[_0x5f37('0x54')]=function(_0x9b6ed7,_0x532c3d){return db[_0x5f37('0x3a')][_0x5f37('0x54')](_0x9b6ed7[_0x5f37('0x55')],{})[_0x5f37('0x1d')](respondWithResult(_0x532c3d,0xc9))[_0x5f37('0x25')](handleError(_0x532c3d,null));};exports['update']=function(_0x3d81ce,_0x13a5fd){if(_0x3d81ce[_0x5f37('0x55')]['id']){delete _0x3d81ce[_0x5f37('0x55')]['id'];}return db[_0x5f37('0x3a')]['find']({'where':{'id':_0x3d81ce['params']['id']}})[_0x5f37('0x1d')](handleEntityNotFound(_0x13a5fd,null))[_0x5f37('0x1d')](saveUpdates(_0x3d81ce[_0x5f37('0x55')],null))[_0x5f37('0x1d')](respondWithResult(_0x13a5fd,null))[_0x5f37('0x25')](handleError(_0x13a5fd,null));};exports[_0x5f37('0x33')]=function(_0x4ca1bc,_0x4b6b66){return db[_0x5f37('0x3a')]['find']({'where':{'id':_0x4ca1bc[_0x5f37('0x51')]['id']}})[_0x5f37('0x1d')](handleEntityNotFound(_0x4b6b66,null))[_0x5f37('0x1d')](removeEntity(_0x4b6b66,null))[_0x5f37('0x25')](handleError(_0x4b6b66,null));};exports[_0x5f37('0x56')]=function(_0x562119,_0x4001a7){return db[_0x5f37('0x3a')]['describe']()[_0x5f37('0x1d')](respondWithResult(_0x4001a7,null))['catch'](handleError(_0x4001a7,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports[_0x5f37('0x57')]=function(_0x2cd3fc,_0x3e5a31,_0x5c5590){var _0x33065d={'agent':{},'channel':'openchannel'};if(_0x2cd3fc[_0x5f37('0x55')]['id']){delete _0x2cd3fc['body']['id'];}_0x2cd3fc['body'][_0x5f37('0x58')]=!![];_0x2cd3fc[_0x5f37('0x55')][_0x5f37('0x59')]=moment()[_0x5f37('0x5a')](_0x5f37('0x5b'));_0x2cd3fc[_0x5f37('0x55')][_0x5f37('0x5c')]=_0x2cd3fc[_0x5f37('0x55')]['UserId']||_0x2cd3fc[_0x5f37('0x5d')]['id'];_0x33065d[_0x5f37('0x5e')]['id']=_0x2cd3fc[_0x5f37('0x55')][_0x5f37('0x5c')];return db[_0x5f37('0x3a')][_0x5f37('0x53')]({'where':{'id':_0x2cd3fc[_0x5f37('0x51')]['id'],'UserId':null}})[_0x5f37('0x1d')](handleEntityNotFound(_0x3e5a31,null))[_0x5f37('0x1d')](saveUpdates(_0x2cd3fc[_0x5f37('0x55')],null))[_0x5f37('0x1d')](function(_0x1c0aba){if(_0x1c0aba){_0x33065d[_0x5f37('0x23')]=_0x1c0aba[_0x5f37('0x5f')]({'plain':!![]});return db['OpenchannelInteraction'][_0x5f37('0x53')]({'where':{'id':_0x1c0aba['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x3e5a31,null))['then'](function(_0x5bb9b3){if(_0x5bb9b3){return _0x5bb9b3[_0x5f37('0x32')]({'UserId':_0x2cd3fc[_0x5f37('0x55')][_0x5f37('0x5c')],'read1stAt':_[_0x5f37('0x60')](_0x5bb9b3[_0x5f37('0x61')])?moment()[_0x5f37('0x5a')](_0x5f37('0x5b')):undefined});}return null;})[_0x5f37('0x1d')](function(_0x82fd32){if(_0x82fd32){_0x33065d[_0x5f37('0x62')]=_0x82fd32[_0x5f37('0x5f')]({'plain':!![]});interaction_log[_0x5f37('0x1e')](_0x5f37('0x63'),_0x2cd3fc[_0x5f37('0x5d')]['id'],_0x2cd3fc[_0x5f37('0x5d')][_0x5f37('0x36')],_0x2cd3fc[_0x5f37('0x5d')][_0x5f37('0x64')],_0x33065d['interaction']['id'],_0x2cd3fc[_0x5f37('0x55')]?JSON['stringify'](_0x2cd3fc[_0x5f37('0x55')]):'null');return respondWithRpcPromise(_0x5f37('0x65'),_0x5f37('0x66'),_0x33065d);}return null;})[_0x5f37('0x1d')](function(_0x33d8a1){var _0x130b73=_0x5f37('0x67')+_0x33d8a1[_0x5f37('0x23')][_0x5f37('0x68')];return db[_0x5f37('0x69')][_0x5f37('0x40')](_0x130b73,{'type':db[_0x5f37('0x6a')][_0x5f37('0x6b')][_0x5f37('0x6c')],'raw':!![]})[_0x5f37('0x1d')](function(_0x345b2c){return _0x345b2c;});})['then'](function(_0x3b0a46){if(_0x3b0a46){_0x33065d['message'][_0x5f37('0x6d')]=_0x3b0a46[0x0];if(!_0x2cd3fc[_0x5f37('0x55')]['UserId'])return;return db[_0x5f37('0x6e')][_0x5f37('0x53')]({'where':{'id':_0x2cd3fc['body'][_0x5f37('0x5c')],'role':_0x5f37('0x5e')},'attributes':['id','name',_0x5f37('0x6f'),'email',_0x5f37('0x70')],'raw':!![]});}return null;})[_0x5f37('0x1d')](function(_0x549114){if(!_0x549114)return null;_0x33065d[_0x5f37('0x23')]['agent']=_0x549114;return _0x33065d;})[_0x5f37('0x1d')](function(_0x2c26d0){if(_0x2c26d0){if(_0x2cd3fc[_0x5f37('0x55')][_0x5f37('0x71')]){_0x33065d[_0x5f37('0x23')]['interface']=util[_0x5f37('0x5a')]('SIP/%s',_0x2cd3fc[_0x5f37('0x5d')]['name']);_0x33065d[_0x5f37('0x23')]['channel']=_0x33065d[_0x5f37('0x72')];_0x33065d[_0x5f37('0x23')][_0x5f37('0x73')]=_0x33065d['channel'];_0x33065d['message'][_0x5f37('0x74')]=_0x5f37('0x57');return respondWithRpcPromise(_0x5f37('0x75'),'EventManager',{'event':_0x5f37('0x76'),'message':_0x33065d[_0x5f37('0x23')]},client9002)[_0x5f37('0x1d')](function(){return _0x33065d;});}return _0x33065d;}return null;})[_0x5f37('0x1d')](respondWithResult(_0x3e5a31,null))[_0x5f37('0x25')](handleError(_0x3e5a31,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports[_0x5f37('0x30')]=function(_0x5e0473,_0x4a6581,_0x40bf44){var _0x318f6a={'agent':{},'channel':_0x5f37('0x77')};if(_0x5e0473[_0x5f37('0x55')]['id']){delete _0x5e0473[_0x5f37('0x55')]['id'];}_0x5e0473[_0x5f37('0x55')][_0x5f37('0x5c')]=_0x5e0473['body'][_0x5f37('0x5c')]||_0x5e0473[_0x5f37('0x5d')]['id'];_0x318f6a['agent']['id']=_0x5e0473[_0x5f37('0x55')][_0x5f37('0x5c')];return db[_0x5f37('0x3a')]['find']({'where':{'id':_0x5e0473[_0x5f37('0x51')]['id'],'UserId':null}})[_0x5f37('0x1d')](handleEntityNotFound(_0x4a6581,null))[_0x5f37('0x1d')](function(_0xf991e4){if(_0xf991e4){_0x318f6a['message']=_0xf991e4[_0x5f37('0x5f')]({'plain':!![]});return db[_0x5f37('0x78')][_0x5f37('0x53')]({'where':{'id':_0xf991e4[_0x5f37('0x79')]}});}return null;})[_0x5f37('0x1d')](handleEntityNotFound(_0x4a6581,null))[_0x5f37('0x1d')](function(_0x2cc202){if(_0x2cc202){_0x318f6a[_0x5f37('0x62')]=_0x2cc202['get']({'plain':!![]});interaction_log[_0x5f37('0x1e')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5e0473[_0x5f37('0x5d')]['id'],_0x5e0473[_0x5f37('0x5d')][_0x5f37('0x36')],_0x5e0473[_0x5f37('0x5d')]['role'],_0x318f6a[_0x5f37('0x62')]['id'],_0x5e0473['body']?JSON[_0x5f37('0x7a')](_0x5e0473[_0x5f37('0x55')]):_0x5f37('0x7b'));return respondWithRpcPromise(_0x5f37('0x7c'),'rejectMessage',_0x318f6a);}return null;})['then'](function(_0x3cf5ce){var _0x82f7a9=_0x5f37('0x67')+_0x3cf5ce[_0x5f37('0x23')][_0x5f37('0x68')];return db[_0x5f37('0x69')][_0x5f37('0x40')](_0x82f7a9,{'type':db[_0x5f37('0x6a')][_0x5f37('0x6b')][_0x5f37('0x6c')],'raw':!![]})[_0x5f37('0x1d')](function(_0x46a9f6){return _0x46a9f6;});})[_0x5f37('0x1d')](function(_0x344f44){if(_0x344f44){_0x318f6a[_0x5f37('0x23')][_0x5f37('0x6d')]=_0x344f44[0x0];if(!_0x5e0473[_0x5f37('0x55')][_0x5f37('0x5c')])return;return db[_0x5f37('0x6e')][_0x5f37('0x53')]({'where':{'id':_0x5e0473['body']['UserId'],'role':'agent'},'attributes':['id',_0x5f37('0x36'),_0x5f37('0x6f'),_0x5f37('0x7d'),_0x5f37('0x70')],'raw':!![]});}return null;})['then'](function(_0x230068){if(!_0x230068)return null;_0x318f6a['message'][_0x5f37('0x5e')]=_0x230068;return _0x318f6a;})[_0x5f37('0x1d')](function(_0x5aaf37){if(_0x5aaf37){_0x5aaf37['message'][_0x5f37('0x7e')]=util[_0x5f37('0x5a')]('SIP/%s',_0x5e0473[_0x5f37('0x5d')]['name']);_0x5aaf37[_0x5f37('0x23')][_0x5f37('0x72')]=_0x318f6a[_0x5f37('0x72')];_0x5aaf37[_0x5f37('0x23')]['motionChannel']=_0x318f6a[_0x5f37('0x72')];_0x5aaf37[_0x5f37('0x23')][_0x5f37('0x74')]=_0x5f37('0x30');respondWithRpcPromise(_0x5f37('0x75'),_0x5f37('0x75'),{'event':_0x5f37('0x7f'),'message':_0x5aaf37['message']},client9002);return _0x318f6a;}return null;})[_0x5f37('0x1d')](respondWithResult(_0x4a6581,null))['catch'](handleError(_0x4a6581,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index b870a3a..1733dae 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 _0xcfec=['exports','events','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x4e07d9,_0x15d276){var _0x508643=function(_0x145846){while(--_0x145846){_0x4e07d9['push'](_0x4e07d9['shift']());}};_0x508643(++_0x15d276);}(_0xcfec,0x169));var _0xccfe=function(_0x41a7d4,_0x409980){_0x41a7d4=_0x41a7d4-0x0;var _0x496a94=_0xcfec[_0x41a7d4];return _0x496a94;};'use strict';var EventEmitter=require(_0xccfe('0x0'));var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xccfe('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xccfe('0x2'),'afterDestroy':'remove'};function emitEvent(_0x22293b){return function(_0x462470,_0x3c8729,_0x2a5db9){OpenchannelMessageEvents[_0xccfe('0x3')](_0x22293b+':'+_0x462470['id'],_0x462470);OpenchannelMessageEvents[_0xccfe('0x3')](_0x22293b,_0x462470);_0x2a5db9(null);};}for(var e in events){if(events[_0xccfe('0x4')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0xccfe('0x5')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x8c2a=['../../mysqldb','OpenchannelMessage','save','remove','emit','hook','events'];(function(_0x210a19,_0x35d3b7){var _0x54fb21=function(_0x463db5){while(--_0x463db5){_0x210a19['push'](_0x210a19['shift']());}};_0x54fb21(++_0x35d3b7);}(_0x8c2a,0xae));var _0xa8c2=function(_0x45598f,_0x1649ec){_0x45598f=_0x45598f-0x0;var _0x517e2b=_0x8c2a[_0x45598f];return _0x517e2b;};'use strict';var EventEmitter=require(_0xa8c2('0x0'));var OpenchannelMessage=require(_0xa8c2('0x1'))['db'][_0xa8c2('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa8c2('0x3'),'afterUpdate':'update','afterDestroy':_0xa8c2('0x4')};function emitEvent(_0x1b1e7a){return function(_0x5aa59,_0x56d3f2,_0x4329ef){OpenchannelMessageEvents[_0xa8c2('0x5')](_0x1b1e7a+':'+_0x5aa59['id'],_0x5aa59);OpenchannelMessageEvents['emit'](_0x1b1e7a,_0x5aa59);_0x4329ef(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xa8c2('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index c80b9b2..dd92591 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 _0xefda=['request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','then','update','createdAt','catch','error','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','OpenchannelInteractionId','CmContact','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','length','omit','POST','method','GET','format','threadId','inspect','finally','utf8mb4','lodash','api','moment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xefda,0x96));var _0xaefd=function(_0x42eb4f,_0x3e1a17){_0x42eb4f=_0x42eb4f-0x0;var _0xb03f52=_0xefda[_0x42eb4f];return _0xb03f52;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaefd('0x1'));var moment=require(_0xaefd('0x2'));var BPromise=require('bluebird');var rp=require(_0xaefd('0x3'));var fs=require('fs');var path=require(_0xaefd('0x4'));var rimraf=require(_0xaefd('0x5'));var config=require(_0xaefd('0x6'));var attributes=require(_0xaefd('0x7'));module[_0xaefd('0x8')]=function(_0x497258,_0x3677ea){return _0x497258[_0xaefd('0x9')](_0xaefd('0xa'),attributes,{'tableName':_0xaefd('0xb'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0xaefd('0xc')],'type':_0xaefd('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x463ce7,_0x4d44ed,_0x48a255){var _0x54a3b1=_0x497258[_0xaefd('0xe')];var _0x16b36e=_0x463ce7[_0xaefd('0xf')]({'plain':!![]});if(_0x16b36e[_0xaefd('0x10')][_0xaefd('0x11')]()==='in'||_0x16b36e[_0xaefd('0x10')][_0xaefd('0x11')]()===_0xaefd('0x12')&&!_0x16b36e[_0xaefd('0x13')]&&!_[_0xaefd('0x14')](_0x16b36e[_0xaefd('0x15')])){_0x54a3b1['OpenchannelInteraction'][_0xaefd('0x16')]({'where':{'id':_0x16b36e['OpenchannelInteractionId']}})[_0xaefd('0x17')](function(_0x1725af){if(_0x1725af){_0x1725af[_0xaefd('0x18')]({'lastMsgAt':_0x16b36e[_0xaefd('0x19')],'lastMsgDirection':_0x16b36e['direction'][_0xaefd('0x11')]()});}})[_0xaefd('0x1a')](function(_0x41f345){console[_0xaefd('0x1b')](_0x41f345);});}if(_0x16b36e[_0xaefd('0x10')]===_0xaefd('0x12')&&!_0x16b36e[_0xaefd('0x13')]){var _0x23d736;_0x54a3b1['CmContact'][_0xaefd('0x1c')]()[_0xaefd('0x17')](function(_0x9748f4){return _0x54a3b1[_0xaefd('0x1d')][_0xaefd('0x1e')]({'where':{'id':_0x16b36e[_0xaefd('0x1f')]},'include':[{'model':_0x54a3b1['OpenchannelInteraction'],'as':_0xaefd('0x20'),'where':{'id':_0x16b36e[_0xaefd('0x21')]},'limit':0x1,'include':[{'model':_0x54a3b1[_0xaefd('0x22')],'as':_0xaefd('0x23'),'attributes':_[_0xaefd('0x24')](_0x9748f4)}]}]});})[_0xaefd('0x17')](function(_0x5282ed){_0x23d736=_0x5282ed[_0xaefd('0xf')]({'plain':!![]});if(_0x23d736&&_0x23d736[_0xaefd('0x25')]){logger[_0xaefd('0x26')](_0xaefd('0x27'),_0xaefd('0x28'),util['format']('Forwarding\x20message\x20%d\x20to\x20%s',_0x16b36e['id'],_0x23d736['replyUri']));if(_0x23d736[_0xaefd('0x20')]&&_0x23d736[_0xaefd('0x20')][_0xaefd('0x29')]){_0x16b36e['Interaction']=_[_0xaefd('0x2a')](_0x23d736['Interactions'][0x0],_0xaefd('0x23'));_0x16b36e[_0xaefd('0x23')]=_0x23d736[_0xaefd('0x20')][0x0]['Contact'];}var _0x4d44ed={'method':_0xaefd('0x2b'),'uri':encodeURI(_0x23d736[_0xaefd('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4d44ed[_0xaefd('0x2c')]){case _0xaefd('0x2d'):_0x4d44ed['qs']=_0x16b36e;break;case'POST':_0x4d44ed[_0xaefd('0xc')]=_0x16b36e;break;}return rp(_0x4d44ed)['then'](function(_0x810bf){logger[_0xaefd('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0xaefd('0x28'),util[_0xaefd('0x2e')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x16b36e['id'],_0x23d736[_0xaefd('0x25')]));if(_0x810bf[_0xaefd('0xc')][_0xaefd('0x2f')]&&_0x810bf['body'][_0xaefd('0x2f')]!=_0x16b36e['Interaction'][_0xaefd('0x2f')]){return _0x54a3b1['OpenchannelInteraction']['update']({'threadId':_0x810bf[_0xaefd('0xc')][_0xaefd('0x2f')]},{'logging':!![],'where':{'id':_0x16b36e['Interaction']['id']}});}else{return;}})['then'](function(){return _0x463ce7['update']({'read':!![]});})[_0xaefd('0x1a')](function(_0x280eab){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0xaefd('0x28'),util[_0xaefd('0x30')](_0x280eab,{'showHidden':![],'depth':null}));_0x48a255();});}else{_0x48a255();}})[_0xaefd('0x31')](function(){_0x48a255();});}else{_0x48a255();}}},'charset':_0xaefd('0x32'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9ffd=['OpenchannelAccountId','Interactions','Contact','keys','replyUri','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','GET','POST','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','threadId','update','error','inspect','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','createdAt','catch','CmContact','describe','OpenchannelAccount','find'];(function(_0xfa566,_0x38c498){var _0x2a57f1=function(_0x378d31){while(--_0x378d31){_0xfa566['push'](_0xfa566['shift']());}};_0x2a57f1(++_0x38c498);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x430684,_0x4ba26c){_0x430684=_0x430684-0x0;var _0x2adc96=_0x9ffd[_0x430684];return _0x2adc96;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var logger=require(_0xd9ff('0x2'))('api');var moment=require(_0xd9ff('0x3'));var BPromise=require(_0xd9ff('0x4'));var rp=require(_0xd9ff('0x5'));var fs=require('fs');var path=require(_0xd9ff('0x6'));var rimraf=require('rimraf');var config=require(_0xd9ff('0x7'));var attributes=require(_0xd9ff('0x8'));module['exports']=function(_0x3aa26b,_0x2982c3){return _0x3aa26b[_0xd9ff('0x9')](_0xd9ff('0xa'),attributes,{'tableName':_0xd9ff('0xb'),'paranoid':![],'indexes':[{'name':_0xd9ff('0xc'),'fields':[_0xd9ff('0xd')],'type':_0xd9ff('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x977487,_0x58e728,_0x54a555){var _0x567f79=_0x3aa26b['models'];var _0x2355ab=_0x977487[_0xd9ff('0xf')]({'plain':!![]});if(_0x2355ab[_0xd9ff('0x10')][_0xd9ff('0x11')]()==='in'||_0x2355ab[_0xd9ff('0x10')][_0xd9ff('0x11')]()===_0xd9ff('0x12')&&!_0x2355ab[_0xd9ff('0x13')]&&!_['isNil'](_0x2355ab['UserId'])){_0x567f79[_0xd9ff('0x14')][_0xd9ff('0x15')]({'where':{'id':_0x2355ab[_0xd9ff('0x16')]}})[_0xd9ff('0x17')](function(_0x12c39a){if(_0x12c39a){_0x12c39a['update']({'lastMsgAt':_0x2355ab[_0xd9ff('0x18')],'lastMsgDirection':_0x2355ab[_0xd9ff('0x10')]['toLowerCase']()});}})[_0xd9ff('0x19')](function(_0x5db010){console['error'](_0x5db010);});}if(_0x2355ab['direction']==='out'&&!_0x2355ab[_0xd9ff('0x13')]){var _0x4f9d6d;_0x567f79[_0xd9ff('0x1a')][_0xd9ff('0x1b')]()[_0xd9ff('0x17')](function(_0x3afd19){return _0x567f79[_0xd9ff('0x1c')][_0xd9ff('0x1d')]({'where':{'id':_0x2355ab[_0xd9ff('0x1e')]},'include':[{'model':_0x567f79[_0xd9ff('0x14')],'as':_0xd9ff('0x1f'),'where':{'id':_0x2355ab[_0xd9ff('0x16')]},'limit':0x1,'include':[{'model':_0x567f79[_0xd9ff('0x1a')],'as':_0xd9ff('0x20'),'attributes':_[_0xd9ff('0x21')](_0x3afd19)}]}]});})['then'](function(_0x4cf8ec){_0x4f9d6d=_0x4cf8ec[_0xd9ff('0xf')]({'plain':!![]});if(_0x4f9d6d&&_0x4f9d6d[_0xd9ff('0x22')]){logger['info']('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util['format'](_0xd9ff('0x23'),_0x2355ab['id'],_0x4f9d6d['replyUri']));if(_0x4f9d6d[_0xd9ff('0x1f')]&&_0x4f9d6d[_0xd9ff('0x1f')][_0xd9ff('0x24')]){_0x2355ab[_0xd9ff('0x25')]=_[_0xd9ff('0x26')](_0x4f9d6d[_0xd9ff('0x1f')][0x0],'Contact');_0x2355ab['Contact']=_0x4f9d6d[_0xd9ff('0x1f')][0x0]['Contact'];}var _0x58e728={'method':'POST','uri':encodeURI(_0x4f9d6d[_0xd9ff('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x58e728['method']){case _0xd9ff('0x27'):_0x58e728['qs']=_0x2355ab;break;case _0xd9ff('0x28'):_0x58e728[_0xd9ff('0xd')]=_0x2355ab;break;}return rp(_0x58e728)[_0xd9ff('0x17')](function(_0x5d685e){logger[_0xd9ff('0x29')](_0xd9ff('0x2a'),_0xd9ff('0x2b'),util[_0xd9ff('0x2c')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x2355ab['id'],_0x4f9d6d[_0xd9ff('0x22')]));if(_0x5d685e[_0xd9ff('0xd')][_0xd9ff('0x2d')]&&_0x5d685e[_0xd9ff('0xd')][_0xd9ff('0x2d')]!=_0x2355ab[_0xd9ff('0x25')][_0xd9ff('0x2d')]){return _0x567f79[_0xd9ff('0x14')][_0xd9ff('0x2e')]({'threadId':_0x5d685e['body'][_0xd9ff('0x2d')]},{'logging':!![],'where':{'id':_0x2355ab['Interaction']['id']}});}else{return;}})[_0xd9ff('0x17')](function(){return _0x977487[_0xd9ff('0x2e')]({'read':!![]});})[_0xd9ff('0x19')](function(_0x552d08){logger[_0xd9ff('0x2f')](_0xd9ff('0x2a'),_0xd9ff('0x2b'),util[_0xd9ff('0x30')](_0x552d08,{'showHidden':![],'depth':null}));_0x54a555();});}else{_0x54a555();}})['finally'](function(){_0x54a555();});}else{_0x54a555();}}},'charset':_0xd9ff('0x31'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 4825229..c5530f7 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['message','result','OpenchannelMessage','create','body','options','CreateOpenchannelMessage','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x5a9dbc,_0x33bf95){var _0x5e9022=function(_0x40e3cd){while(--_0x40e3cd){_0x5a9dbc['push'](_0x5a9dbc['shift']());}};_0x5e9022(++_0x33bf95);}(_0x0b0e,0x187));var _0xe0b0=function(_0x55b460,_0x497077){_0x55b460=_0x55b460-0x0;var _0x3ac537=_0x0b0e[_0x55b460];return _0x3ac537;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});config[_0xe0b0('0xc')]=_['defaults'](config['redis'],{'host':_0xe0b0('0xd'),'port':0x18eb});var socket=require(_0xe0b0('0xe'))(new Redis(config[_0xe0b0('0xc')]));require(_0xe0b0('0xf'))['register'](socket);function respondWithRpcPromise(_0x338e7c,_0x1dd3b8,_0x553d4f){return new BPromise(function(_0x1fef28,_0x2f32b6){return client['request'](_0x338e7c,_0x553d4f)[_0xe0b0('0x10')](function(_0x2cdad2){logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0xe0b0('0x12'));logger[_0xe0b0('0x13')](_0xe0b0('0x14'),_0x1dd3b8,_0xe0b0('0x12'),JSON[_0xe0b0('0x15')](_0x2cdad2));if(_0x2cdad2['error']){if(_0x2cdad2[_0xe0b0('0x16')][_0xe0b0('0x17')]===0x1f4){logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2[_0xe0b0('0x16')]['message']);return _0x2f32b6(_0x2cdad2[_0xe0b0('0x16')]['message']);}logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2['error'][_0xe0b0('0x19')]);return _0x1fef28(_0x2cdad2['error'][_0xe0b0('0x19')]);}else{logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,'request\x20sent');_0x1fef28(_0x2cdad2[_0xe0b0('0x1a')]['message']);}})['catch'](function(_0x4bce65){logger[_0xe0b0('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0x4bce65);_0x2f32b6(_0x4bce65);});});}exports['CreateOpenchannelMessage']=function(_0x10cde1){var _0x59dff5=this;return new Promise(function(_0x472286,_0x5dba2f){return db[_0xe0b0('0x1b')][_0xe0b0('0x1c')](_0x10cde1[_0xe0b0('0x1d')],{'raw':_0x10cde1[_0xe0b0('0x1e')]?_0x10cde1[_0xe0b0('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2fa820){logger['info'](_0xe0b0('0x1f'),_0x10cde1);logger[_0xe0b0('0x13')]('CreateOpenchannelMessage',_0x10cde1,JSON[_0xe0b0('0x15')](_0x2fa820));_0x472286(_0x2fa820);})['catch'](function(_0x2208d0){logger['error'](_0xe0b0('0x1f'),_0x2208d0['message'],_0x10cde1);_0x5dba2f(_0x59dff5[_0xe0b0('0x16')](0x1f4,_0x2208d0['message']));});});}; \ No newline at end of file +var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x30143b,_0x24af71){var _0x3084bb=function(_0x2d5848){while(--_0x2d5848){_0x30143b['push'](_0x30143b['shift']());}};_0x3084bb(++_0x24af71);}(_0x5f2f,0x73));var _0xf5f2=function(_0xfae78e,_0x28a7c3){_0xfae78e=_0xfae78e-0x0;var _0x3bc63a=_0x5f2f[_0xfae78e];return _0x3bc63a;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 2eb4150..55ed5a0 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 _0xcec8=['update','removeListener','length','openchannelMessage:','save','remove'];(function(_0x499383,_0x3c8539){var _0x226f60=function(_0x3de644){while(--_0x3de644){_0x499383['push'](_0x499383['shift']());}};_0x226f60(++_0x3c8539);}(_0xcec8,0x10c));var _0x8cec=function(_0x506d83,_0x1899e9){_0x506d83=_0x506d83-0x0;var _0x335e8b=_0xcec8[_0x506d83];return _0x335e8b;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x8cec('0x0'),_0x8cec('0x1'),_0x8cec('0x2')];function createListener(_0x225ccc,_0x5c8916){return function(_0x424650){_0x5c8916['emit'](_0x225ccc,_0x424650);};}function removeListener(_0x3063a5,_0x18dcea){return function(){OpenchannelMessageEvents[_0x8cec('0x3')](_0x3063a5,_0x18dcea);};}exports['register']=function(_0x21f154){for(var _0xc37d1a=0x0,_0x4f45b5=events[_0x8cec('0x4')];_0xc37d1a<_0x4f45b5;_0xc37d1a++){var _0x380d3e=events[_0xc37d1a];var _0x5083cb=createListener(_0x8cec('0x5')+_0x380d3e,_0x21f154);OpenchannelMessageEvents['on'](_0x380d3e,_0x5083cb);}}; \ No newline at end of file +var _0x39c7=['update','removeListener','openchannelMessage:','save','remove'];(function(_0x1ea025,_0x4efb1b){var _0x2c3040=function(_0x3e7d2c){while(--_0x3e7d2c){_0x1ea025['push'](_0x1ea025['shift']());}};_0x2c3040(++_0x4efb1b);}(_0x39c7,0x85));var _0x739c=function(_0x4f4eeb,_0x49438b){_0x4f4eeb=_0x4f4eeb-0x0;var _0x387115=_0x39c7[_0x4f4eeb];return _0x387115;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x739c('0x0'),_0x739c('0x1'),_0x739c('0x2')];function createListener(_0x25fdf5,_0xfadce8){return function(_0x18d787){_0xfadce8['emit'](_0x25fdf5,_0x18d787);};}function removeListener(_0x11c0a6,_0xff8215){return function(){OpenchannelMessageEvents[_0x739c('0x3')](_0x11c0a6,_0xff8215);};}exports['register']=function(_0x4c5030){for(var _0x1923d9=0x0,_0x3c0af1=events['length'];_0x1923d9<_0x3c0af1;_0x1923d9++){var _0x480159=events[_0x1923d9];var _0x27c5a4=createListener(_0x739c('0x4')+_0x480159,_0x4c5030);OpenchannelMessageEvents['on'](_0x480159,_0x27c5a4);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index efa8f66..0162d2e 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 _0x84ab=['index','/describe','describe','/:id','show','getMembers','getTeams','/:id/users','getAgents','post','create','addAgents','put','delete','destroy','/:id/teams','removeTeams','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated'];(function(_0x4e8f1a,_0x1c1d77){var _0xf1beb0=function(_0x22e544){while(--_0x22e544){_0x4e8f1a['push'](_0x4e8f1a['shift']());}};_0xf1beb0(++_0x1c1d77);}(_0x84ab,0xe9));var _0xb84a=function(_0x2b152a,_0x3dd988){_0x2b152a=_0x2b152a-0x0;var _0x2ad4c7=_0x84ab[_0x2b152a];return _0x2ad4c7;};'use strict';var multer=require('multer');var util=require(_0xb84a('0x0'));var path=require(_0xb84a('0x1'));var timeout=require('connect-timeout');var express=require(_0xb84a('0x2'));var router=express[_0xb84a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb84a('0x4'));var interaction=require(_0xb84a('0x5'));var config=require(_0xb84a('0x6'));var controller=require(_0xb84a('0x7'));router[_0xb84a('0x8')]('/',auth[_0xb84a('0x9')](),controller[_0xb84a('0xa')]);router[_0xb84a('0x8')](_0xb84a('0xb'),auth[_0xb84a('0x9')](),controller[_0xb84a('0xc')]);router[_0xb84a('0x8')](_0xb84a('0xd'),auth[_0xb84a('0x9')](),controller[_0xb84a('0xe')]);router['get']('/:id/members',auth[_0xb84a('0x9')](),controller[_0xb84a('0xf')]);router['get']('/:id/teams',auth['isAuthenticated'](),controller[_0xb84a('0x10')]);router[_0xb84a('0x8')](_0xb84a('0x11'),auth[_0xb84a('0x9')](),controller[_0xb84a('0x12')]);router[_0xb84a('0x13')]('/',auth[_0xb84a('0x9')](),controller[_0xb84a('0x14')]);router[_0xb84a('0x13')]('/:id/teams',auth[_0xb84a('0x9')](),controller['addTeams']);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xb84a('0x15')]);router[_0xb84a('0x16')](_0xb84a('0xd'),auth[_0xb84a('0x9')](),controller['update']);router[_0xb84a('0x17')](_0xb84a('0xd'),auth['isAuthenticated'](),controller[_0xb84a('0x18')]);router[_0xb84a('0x17')](_0xb84a('0x19'),auth['isAuthenticated'](),controller[_0xb84a('0x1a')]);router['delete'](_0xb84a('0x11'),auth[_0xb84a('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xda8d=['describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','put','update','delete','destroy','removeAgents','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe'];(function(_0x193ea7,_0x3574d1){var _0xf76c1f=function(_0x3f46d0){while(--_0x3f46d0){_0x193ea7['push'](_0x193ea7['shift']());}};_0xf76c1f(++_0x3574d1);}(_0xda8d,0x143));var _0xdda8=function(_0x2b3e7e,_0x37c887){_0x2b3e7e=_0x2b3e7e-0x0;var _0x1e24b2=_0xda8d[_0x2b3e7e];return _0x1e24b2;};'use strict';var multer=require(_0xdda8('0x0'));var util=require(_0xdda8('0x1'));var path=require(_0xdda8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdda8('0x3')]();var fs_extra=require(_0xdda8('0x4'));var auth=require(_0xdda8('0x5'));var interaction=require(_0xdda8('0x6'));var config=require(_0xdda8('0x7'));var controller=require(_0xdda8('0x8'));router[_0xdda8('0x9')]('/',auth[_0xdda8('0xa')](),controller[_0xdda8('0xb')]);router[_0xdda8('0x9')](_0xdda8('0xc'),auth[_0xdda8('0xa')](),controller[_0xdda8('0xd')]);router[_0xdda8('0x9')](_0xdda8('0xe'),auth[_0xdda8('0xa')](),controller[_0xdda8('0xf')]);router[_0xdda8('0x9')](_0xdda8('0x10'),auth[_0xdda8('0xa')](),controller['getMembers']);router[_0xdda8('0x9')](_0xdda8('0x11'),auth['isAuthenticated'](),controller[_0xdda8('0x12')]);router[_0xdda8('0x9')](_0xdda8('0x13'),auth[_0xdda8('0xa')](),controller[_0xdda8('0x14')]);router[_0xdda8('0x15')]('/',auth['isAuthenticated'](),controller[_0xdda8('0x16')]);router[_0xdda8('0x15')](_0xdda8('0x11'),auth[_0xdda8('0xa')](),controller['addTeams']);router[_0xdda8('0x15')](_0xdda8('0x13'),auth['isAuthenticated'](),controller['addAgents']);router[_0xdda8('0x17')](_0xdda8('0xe'),auth[_0xdda8('0xa')](),controller[_0xdda8('0x18')]);router[_0xdda8('0x19')](_0xdda8('0xe'),auth['isAuthenticated'](),controller[_0xdda8('0x1a')]);router[_0xdda8('0x19')]('/:id/teams',auth[_0xdda8('0xa')](),controller['removeTeams']);router[_0xdda8('0x19')](_0xdda8('0x13'),auth[_0xdda8('0xa')](),controller[_0xdda8('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 58e01d5..6c080ca 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 _0xb317=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','STRING'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xb317,0xd7));var _0x7b31=function(_0x13b734,_0x300f56){_0x13b734=_0x13b734-0x0;var _0x53a44c=_0xb317[_0x13b734];return _0x53a44c;};'use strict';var Sequelize=require(_0x7b31('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7b31('0x1')]},'timeout':{'type':Sequelize[_0x7b31('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7b31('0x3')](_0x7b31('0x4'),_0x7b31('0x5'),_0x7b31('0x6'))}}; \ No newline at end of file +var _0x0e9d=['INTEGER','ENUM','rrmemory','beepall','exports','name','STRING'];(function(_0x1e7610,_0x199b21){var _0x182458=function(_0x43d9a5){while(--_0x43d9a5){_0x1e7610['push'](_0x1e7610['shift']());}};_0x182458(++_0x199b21);}(_0x0e9d,0xdd));var _0xd0e9=function(_0x7491af,_0x2f0e66){_0x7491af=_0x7491af-0x0;var _0x55c193=_0x0e9d[_0x7491af];return _0x55c193;};'use strict';var Sequelize=require('sequelize');module[_0xd0e9('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xd0e9('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd0e9('0x2')]},'timeout':{'type':Sequelize[_0xd0e9('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd0e9('0x4')](_0xd0e9('0x5'),_0xd0e9('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index bc3ff6f..1a35666 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 _0xa040=['addAgents','omit','spread','removeAgents','getAgents','zip-dir','moment','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelQueue.socket','sendStatus','json','offset','undefined','limit','count','status','set','apply','reject','save','then','destroy','OpenchannelQueues','UserProfileResource','stack','name','send','index','map','OpenchannelQueue','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','filter','UserOpenchannelQueue','User','findAndCountAll','updatedAt','createdAt','format','%s/%s','openchannelPause','getTeams','findOne','Team','rawAttributes','order','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','userOpenchannelQueue:remove'];(function(_0x5cee8b,_0x3d1aeb){var _0x57b59a=function(_0x3d1505){while(--_0x3d1505){_0x5cee8b['push'](_0x5cee8b['shift']());}};_0x57b59a(++_0x3d1aeb);}(_0xa040,0x115));var _0x0a04=function(_0x1fba04,_0xe8d364){_0x1fba04=_0x1fba04-0x0;var _0x57ecff=_0xa040[_0x1fba04];return _0x57ecff;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0a04('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a04('0x1'));var BPromise=require(_0x0a04('0x2'));var Mustache=require(_0x0a04('0x3'));var util=require(_0x0a04('0x4'));var path=require('path');var sox=require(_0x0a04('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a04('0x6'));var _=require(_0x0a04('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0a04('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a04('0x9'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0a04('0xa'));var hardwareService=require(_0x0a04('0xb'));var logger=require(_0x0a04('0xc'))(_0x0a04('0xd'));var utils=require(_0x0a04('0xe'));var config=require(_0x0a04('0xf'));var licenseUtil=require(_0x0a04('0x10'));var db=require(_0x0a04('0x11'))['db'];config[_0x0a04('0x12')]=_[_0x0a04('0x13')](config[_0x0a04('0x12')],{'host':_0x0a04('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a04('0x12')]));require(_0x0a04('0x15'))['register'](socket);function respondWithStatusCode(_0x149c26,_0x594de4){_0x594de4=_0x594de4||0xcc;return function(_0x5cc6e3){if(_0x5cc6e3){return _0x149c26[_0x0a04('0x16')](_0x594de4);}return _0x149c26['status'](_0x594de4)['end']();};}function respondWithResult(_0x1ee0a9,_0x44206f){_0x44206f=_0x44206f||0xc8;return function(_0x5d3d0b){if(_0x5d3d0b){return _0x1ee0a9['status'](_0x44206f)[_0x0a04('0x17')](_0x5d3d0b);}};}function respondWithFilteredResult(_0x278a71,_0x51d518){return function(_0x2c9e94){if(_0x2c9e94){var _0xa2141d=typeof _0x51d518[_0x0a04('0x18')]===_0x0a04('0x19')&&typeof _0x51d518[_0x0a04('0x1a')]===_0x0a04('0x19');var _0x393b9d=_0x2c9e94[_0x0a04('0x1b')];var _0x47c4d0=_0xa2141d?0x0:_0x51d518['offset'];var _0x32fa7e=_0xa2141d?_0x2c9e94[_0x0a04('0x1b')]:_0x51d518['offset']+_0x51d518[_0x0a04('0x1a')];var _0x1f7046;if(_0x32fa7e>=_0x393b9d){_0x32fa7e=_0x393b9d;_0x1f7046=0xc8;}else{_0x1f7046=0xce;}_0x278a71[_0x0a04('0x1c')](_0x1f7046);return _0x278a71[_0x0a04('0x1d')]('Content-Range',_0x47c4d0+'-'+_0x32fa7e+'/'+_0x393b9d)[_0x0a04('0x17')](_0x2c9e94);}return null;};}function patchUpdates(_0x2f6f9b){return function(_0xc26680){try{jsonpatch[_0x0a04('0x1e')](_0xc26680,_0x2f6f9b,!![]);}catch(_0x34ea89){return BPromise[_0x0a04('0x1f')](_0x34ea89);}return _0xc26680[_0x0a04('0x20')]();};}function saveUpdates(_0x2d81c6,_0x20cbb0){return function(_0x2f8f2c){if(_0x2f8f2c){return _0x2f8f2c['update'](_0x2d81c6)[_0x0a04('0x21')](function(_0x3519aa){return _0x3519aa;});}return null;};}function removeEntity(_0x1dbf81,_0x3d5390){return function(_0x2ad46b){if(_0x2ad46b){return _0x2ad46b[_0x0a04('0x22')]()[_0x0a04('0x21')](function(){var _0x564541=_0x2ad46b['get']({'plain':!![]});var _0x5be240=_0x0a04('0x23');return db[_0x0a04('0x24')][_0x0a04('0x22')]({'where':{'type':_0x5be240,'resourceId':_0x564541['id']}})[_0x0a04('0x21')](function(){return _0x2ad46b;});})[_0x0a04('0x21')](function(){_0x1dbf81[_0x0a04('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x598d80,_0x75ac1c){return function(_0xcf2383){if(!_0xcf2383){_0x598d80[_0x0a04('0x16')](0x194);}return _0xcf2383;};}function handleError(_0xfe86b2,_0x485e50){_0x485e50=_0x485e50||0x1f4;return function(_0x54baa2){logger['error'](_0x54baa2[_0x0a04('0x25')]);if(_0x54baa2[_0x0a04('0x26')]){delete _0x54baa2[_0x0a04('0x26')];}_0xfe86b2[_0x0a04('0x1c')](_0x485e50)[_0x0a04('0x27')](_0x54baa2);};}exports[_0x0a04('0x28')]=function(_0x3a0a97,_0x3f3da7){var _0x413343={},_0x2fef43={},_0x169bfa={'count':0x0,'rows':[]};var _0x451e04=_[_0x0a04('0x29')](db[_0x0a04('0x2a')]['rawAttributes'],function(_0x574a58){return{'name':_0x574a58['fieldName'],'type':_0x574a58[_0x0a04('0x2b')][_0x0a04('0x2c')]};});_0x2fef43[_0x0a04('0x2d')]=_[_0x0a04('0x29')](_0x451e04,'name');_0x2fef43[_0x0a04('0x2e')]=_[_0x0a04('0x2f')](_0x3a0a97['query']);_0x2fef43[_0x0a04('0x30')]=_[_0x0a04('0x31')](_0x2fef43[_0x0a04('0x2d')],_0x2fef43[_0x0a04('0x2e')]);_0x413343['attributes']=_[_0x0a04('0x31')](_0x2fef43[_0x0a04('0x2d')],qs[_0x0a04('0x32')](_0x3a0a97[_0x0a04('0x2e')][_0x0a04('0x32')]));_0x413343[_0x0a04('0x33')]=_0x413343[_0x0a04('0x33')][_0x0a04('0x34')]?_0x413343[_0x0a04('0x33')]:_0x2fef43['model'];if(!_0x3a0a97[_0x0a04('0x2e')][_0x0a04('0x35')](_0x0a04('0x36'))){_0x413343[_0x0a04('0x1a')]=qs[_0x0a04('0x1a')](_0x3a0a97[_0x0a04('0x2e')][_0x0a04('0x1a')]);_0x413343[_0x0a04('0x18')]=qs[_0x0a04('0x18')](_0x3a0a97[_0x0a04('0x2e')][_0x0a04('0x18')]);}_0x413343['order']=qs[_0x0a04('0x37')](_0x3a0a97['query']['sort']);_0x413343[_0x0a04('0x38')]=qs[_0x0a04('0x30')](_[_0x0a04('0x39')](_0x3a0a97[_0x0a04('0x2e')],_0x2fef43[_0x0a04('0x30')]),_0x451e04);if(_0x3a0a97[_0x0a04('0x2e')]['filter']){_0x413343['where']=_[_0x0a04('0x3a')](_0x413343[_0x0a04('0x38')],{'$or':_['map'](_0x451e04,function(_0x273fad){if(_0x273fad[_0x0a04('0x2b')]!==_0x0a04('0x3b')){var _0x2240cd={};_0x2240cd[_0x273fad[_0x0a04('0x26')]]={'$like':'%'+_0x3a0a97[_0x0a04('0x2e')]['filter']+'%'};return _0x2240cd;}})});}_0x413343=_[_0x0a04('0x3a')]({},_0x413343,_0x3a0a97[_0x0a04('0x3c')]);var _0x138001={'where':_0x413343[_0x0a04('0x38')]};return db[_0x0a04('0x2a')][_0x0a04('0x1b')](_0x138001)[_0x0a04('0x21')](function(_0x10e84d){_0x169bfa['count']=_0x10e84d;if(_0x3a0a97[_0x0a04('0x2e')][_0x0a04('0x3d')]){_0x413343[_0x0a04('0x3e')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0x0a04('0x3f')](_0x413343);})['then'](function(_0x3cb1fd){_0x169bfa[_0x0a04('0x40')]=_0x3cb1fd;return _0x169bfa;})[_0x0a04('0x21')](respondWithFilteredResult(_0x3f3da7,_0x413343))['catch'](handleError(_0x3f3da7,null));};exports[_0x0a04('0x41')]=function(_0x28c310,_0x14f02f){var _0x2b151b={'raw':!![],'where':{'id':_0x28c310[_0x0a04('0x42')]['id']}},_0x12f580={};_0x12f580['model']=_['keys'](db[_0x0a04('0x2a')]['rawAttributes']);_0x12f580[_0x0a04('0x2e')]=_['keys'](_0x28c310[_0x0a04('0x2e')]);_0x12f580[_0x0a04('0x30')]=_[_0x0a04('0x31')](_0x12f580[_0x0a04('0x2d')],_0x12f580['query']);_0x2b151b[_0x0a04('0x33')]=_[_0x0a04('0x31')](_0x12f580['model'],qs[_0x0a04('0x32')](_0x28c310[_0x0a04('0x2e')]['fields']));_0x2b151b[_0x0a04('0x33')]=_0x2b151b[_0x0a04('0x33')][_0x0a04('0x34')]?_0x2b151b[_0x0a04('0x33')]:_0x12f580['model'];if(_0x28c310[_0x0a04('0x2e')]['includeAll']){_0x2b151b[_0x0a04('0x3e')]=[{'all':!![]}];}_0x2b151b=_[_0x0a04('0x3a')]({},_0x2b151b,_0x28c310[_0x0a04('0x3c')]);return db[_0x0a04('0x2a')][_0x0a04('0x43')](_0x2b151b)[_0x0a04('0x21')](handleEntityNotFound(_0x14f02f,null))['then'](respondWithResult(_0x14f02f,null))[_0x0a04('0x44')](handleError(_0x14f02f,null));};exports['create']=function(_0x4ae760,_0x340946){return db[_0x0a04('0x2a')][_0x0a04('0x45')](_0x4ae760[_0x0a04('0x46')],{})[_0x0a04('0x21')](function(_0x11ea20){var _0xb53b9f=_0x4ae760['user'][_0x0a04('0x47')]({'plain':!![]});if(!_0xb53b9f)throw new Error(_0x0a04('0x48'));if(_0xb53b9f[_0x0a04('0x49')]===_0x0a04('0x4a')){var _0x5ec054=_0x11ea20[_0x0a04('0x47')]({'plain':!![]});var _0x5a49d7=_0x0a04('0x23');return db[_0x0a04('0x4b')][_0x0a04('0x43')]({'where':{'name':_0x5a49d7,'userProfileId':_0xb53b9f[_0x0a04('0x4c')]},'raw':!![]})[_0x0a04('0x21')](function(_0x28b85a){if(_0x28b85a&&_0x28b85a['autoAssociation']===0x0){return db[_0x0a04('0x24')][_0x0a04('0x45')]({'name':_0x5ec054[_0x0a04('0x26')],'resourceId':_0x5ec054['id'],'type':_0x28b85a[_0x0a04('0x26')],'sectionId':_0x28b85a['id']},{})[_0x0a04('0x21')](function(){return _0x11ea20;});}else{return _0x11ea20;}})[_0x0a04('0x44')](function(_0x2b40bf){logger[_0x0a04('0x4d')](_0x0a04('0x4e'),_0x2b40bf);throw _0x2b40bf;});}return _0x11ea20;})[_0x0a04('0x21')](respondWithResult(_0x340946,0xc9))[_0x0a04('0x44')](handleError(_0x340946,null));};exports[_0x0a04('0x4f')]=function(_0x3c57a7,_0x4046f4){if(_0x3c57a7['body']['id']){delete _0x3c57a7['body']['id'];}return db[_0x0a04('0x2a')][_0x0a04('0x43')]({'where':{'id':_0x3c57a7[_0x0a04('0x42')]['id']}})[_0x0a04('0x21')](handleEntityNotFound(_0x4046f4,null))[_0x0a04('0x21')](saveUpdates(_0x3c57a7['body'],null))[_0x0a04('0x21')](respondWithResult(_0x4046f4,null))['catch'](handleError(_0x4046f4,null));};exports[_0x0a04('0x22')]=function(_0x4f1c1d,_0x3e65b1){return db[_0x0a04('0x2a')]['find']({'where':{'id':_0x4f1c1d['params']['id']}})[_0x0a04('0x21')](handleEntityNotFound(_0x3e65b1,null))['then'](removeEntity(_0x3e65b1,null))['catch'](handleError(_0x3e65b1,null));};exports[_0x0a04('0x50')]=function(_0x19fd8c,_0x32d708){return db[_0x0a04('0x2a')][_0x0a04('0x50')]()['then'](respondWithResult(_0x32d708,null))['catch'](handleError(_0x32d708,null));};exports[_0x0a04('0x51')]=function(_0x116b21,_0x25396f,_0x19cb87){var _0x1e5936={'raw':!![],'where':{}},_0x1ea339={},_0x24e13c;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x116b21[_0x0a04('0x42')]['id']}})[_0x0a04('0x21')](handleEntityNotFound(_0x25396f,null))[_0x0a04('0x21')](function(_0x47fd59){if(_0x47fd59){_0x24e13c=_0x47fd59[_0x0a04('0x47')]({'plain':!![]});_0x1ea339[_0x0a04('0x2d')]=_[_0x0a04('0x2f')](db['UserOpenchannelQueue']['rawAttributes']);_0x1ea339[_0x0a04('0x2e')]=_[_0x0a04('0x2f')](_0x116b21[_0x0a04('0x2e')]);_0x1ea339[_0x0a04('0x30')]=_[_0x0a04('0x31')](_0x1ea339[_0x0a04('0x2d')],_0x1ea339[_0x0a04('0x2e')]);_0x1e5936[_0x0a04('0x33')]=_[_0x0a04('0x31')](_0x1ea339[_0x0a04('0x2d')],qs[_0x0a04('0x32')](_0x116b21[_0x0a04('0x2e')]['fields']));_0x1e5936[_0x0a04('0x33')]=_0x1e5936[_0x0a04('0x33')][_0x0a04('0x34')]?_0x1e5936[_0x0a04('0x33')]:_0x1ea339[_0x0a04('0x2d')];if(!_0x116b21[_0x0a04('0x2e')][_0x0a04('0x35')](_0x0a04('0x36'))){_0x1e5936['limit']=qs['limit'](_0x116b21[_0x0a04('0x2e')]['limit']);_0x1e5936['offset']=qs['offset'](_0x116b21[_0x0a04('0x2e')][_0x0a04('0x18')]);}_0x1e5936['order']=qs[_0x0a04('0x37')](_0x116b21[_0x0a04('0x2e')][_0x0a04('0x37')]);_0x1e5936[_0x0a04('0x38')]=qs['filters'](_['pick'](_0x116b21[_0x0a04('0x2e')],_0x1ea339[_0x0a04('0x30')]));_0x1e5936['where']['OpenchannelQueueId']=_0x47fd59['id'];if(_0x116b21[_0x0a04('0x2e')][_0x0a04('0x52')]){_0x1e5936[_0x0a04('0x38')]=_[_0x0a04('0x3a')](_0x1e5936['where'],{'$or':_['map'](_0x1e5936['attributes'],function(_0x5b1938){var _0x505a5e={};_0x505a5e[_0x5b1938]={'$like':'%'+_0x116b21[_0x0a04('0x2e')][_0x0a04('0x52')]+'%'};return _0x505a5e;})});}_0x1e5936=_['merge']({},_0x1e5936,_0x116b21[_0x0a04('0x3c')]);return db[_0x0a04('0x53')][_0x0a04('0x3f')](_0x1e5936);}})[_0x0a04('0x21')](function(_0xc48899){if(_0xc48899){return db[_0x0a04('0x54')][_0x0a04('0x55')]({'where':{'id':_[_0x0a04('0x29')](_0xc48899,'UserId'),'role':'agent'},'attributes':['id','name','openchannelPause',_0x0a04('0x56'),_0x0a04('0x57')]});}})[_0x0a04('0x21')](function(_0x5be553){if(_0x5be553){return{'count':_0x5be553['count'],'rows':_[_0x0a04('0x29')](_0x5be553['rows'],function(_0x5df6b6){return{'membername':_0x5df6b6[_0x0a04('0x26')],'UserId':_0x5df6b6['id'],'queue_name':_0x24e13c[_0x0a04('0x26')],'OpenchannelQueueId':_0x24e13c['id'],'interface':util[_0x0a04('0x58')](_0x0a04('0x59'),'SIP',_0x5df6b6[_0x0a04('0x26')]),'penalty':0x0,'paused':_0x5df6b6[_0x0a04('0x5a')],'createdAt':_0x5df6b6[_0x0a04('0x57')],'updatedAt':_0x5df6b6[_0x0a04('0x56')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0a04('0x21')](respondWithFilteredResult(_0x25396f,_0x1e5936))['catch'](handleError(_0x25396f,null));};exports[_0x0a04('0x5b')]=function(_0x5f3160,_0x508076,_0x239bf4){var _0x4a6acd={};var _0x389278={};var _0x1eb7a7;var _0x267a1c;return db[_0x0a04('0x2a')][_0x0a04('0x5c')]({'where':{'id':_0x5f3160[_0x0a04('0x42')]['id']}})['then'](handleEntityNotFound(_0x508076,null))[_0x0a04('0x21')](function(_0x20c37a){if(_0x20c37a){_0x1eb7a7=_0x20c37a;_0x389278[_0x0a04('0x2d')]=_[_0x0a04('0x2f')](db[_0x0a04('0x5d')][_0x0a04('0x5e')]);_0x389278[_0x0a04('0x2e')]=_[_0x0a04('0x2f')](_0x5f3160[_0x0a04('0x2e')]);_0x389278[_0x0a04('0x30')]=_[_0x0a04('0x31')](_0x389278['model'],_0x389278['query']);_0x4a6acd[_0x0a04('0x33')]=_[_0x0a04('0x31')](_0x389278[_0x0a04('0x2d')],qs[_0x0a04('0x32')](_0x5f3160['query']['fields']));_0x4a6acd[_0x0a04('0x33')]=_0x4a6acd['attributes'][_0x0a04('0x34')]?_0x4a6acd[_0x0a04('0x33')]:_0x389278[_0x0a04('0x2d')];_0x4a6acd[_0x0a04('0x5f')]=qs[_0x0a04('0x37')](_0x5f3160[_0x0a04('0x2e')]['sort']);_0x4a6acd[_0x0a04('0x38')]=qs[_0x0a04('0x30')](_[_0x0a04('0x39')](_0x5f3160['query'],_0x389278['filters']));if(_0x5f3160[_0x0a04('0x2e')][_0x0a04('0x52')]){_0x4a6acd[_0x0a04('0x38')]=_[_0x0a04('0x3a')](_0x4a6acd[_0x0a04('0x38')],{'$or':_[_0x0a04('0x29')](_0x4a6acd[_0x0a04('0x33')],function(_0x2e8ed5){var _0x51b3f8={};_0x51b3f8[_0x2e8ed5]={'$like':'%'+_0x5f3160[_0x0a04('0x2e')]['filter']+'%'};return _0x51b3f8;})});}_0x4a6acd=_[_0x0a04('0x3a')]({},_0x4a6acd,_0x5f3160[_0x0a04('0x3c')]);return _0x1eb7a7[_0x0a04('0x5b')](_0x4a6acd);}})[_0x0a04('0x21')](function(_0x5b5255){if(_0x5b5255){_0x267a1c=_0x5b5255[_0x0a04('0x34')];if(!_0x5f3160[_0x0a04('0x2e')][_0x0a04('0x35')](_0x0a04('0x36'))){_0x4a6acd[_0x0a04('0x1a')]=qs[_0x0a04('0x1a')](_0x5f3160[_0x0a04('0x2e')][_0x0a04('0x1a')]);_0x4a6acd[_0x0a04('0x18')]=qs[_0x0a04('0x18')](_0x5f3160[_0x0a04('0x2e')]['offset']);}return _0x1eb7a7['getTeams'](_0x4a6acd);}})[_0x0a04('0x21')](function(_0x73cce3){if(_0x73cce3){return _0x73cce3?{'count':_0x267a1c,'rows':_0x73cce3}:null;}})[_0x0a04('0x21')](respondWithResult(_0x508076,null))['catch'](handleError(_0x508076,null));};exports[_0x0a04('0x60')]=function(_0x122212,_0x213841,_0xa675f9){var _0x3a47c6=_0x122212[_0x0a04('0x46')][_0x0a04('0x61')];return db[_0x0a04('0x5d')][_0x0a04('0x3f')]({'where':{'id':_0x3a47c6},'attributes':['id'],'include':[{'model':db[_0x0a04('0x54')],'as':_0x0a04('0x62'),'attributes':['id',_0x0a04('0x26'),_0x0a04('0x63'),_0x0a04('0x64'),_0x0a04('0x65')],'raw':!![]}]})['then'](function(_0x3a2f9c){if(_0x3a2f9c){var _0x4265d5=_['flatMap'](_0x3a2f9c,function(_0x3bfa85){var _0x4e6d11=_0x3bfa85[_0x0a04('0x47')]({'plain':!![]});return _0x4e6d11[_0x0a04('0x62')];});return db[_0x0a04('0x2a')]['find']({'where':{'id':_0x122212[_0x0a04('0x42')]['id']}})[_0x0a04('0x21')](function(_0x2db251){return db[_0x0a04('0x66')][_0x0a04('0x67')](function(_0x527a32){return _0x2db251[_0x0a04('0x60')](_0x3a47c6,{'transaction':_0x527a32})[_0x0a04('0x21')](function(){return BPromise[_0x0a04('0x68')](_0x4265d5,function(_0x4c0def){return db[_0x0a04('0x53')][_0x0a04('0x69')]({'where':{'UserId':_0x4c0def['id'],'OpenchannelQueueId':_0x122212[_0x0a04('0x42')]['id']},'transaction':_0x527a32});});})[_0x0a04('0x21')](function(){_0x4265d5[_0x0a04('0x6a')](function(_0xa78c8a){socket[_0x0a04('0x6b')](_0x0a04('0x6c'),{'UserId':_0xa78c8a['id'],'OpenchannelQueueId':_0x2db251['id']});});});});});}})['then'](respondWithStatusCode(_0x213841,null))['catch'](handleError(_0x213841,null));};exports[_0x0a04('0x6d')]=function(_0x4f5b7e,_0x2b4025,_0xf5b0fc){return db[_0x0a04('0x5d')]['findAll']({'where':{'id':_0x4f5b7e[_0x0a04('0x2e')][_0x0a04('0x61')]},'attributes':['id'],'include':[{'model':db[_0x0a04('0x54')],'as':_0x0a04('0x62'),'attributes':['id'],'raw':!![]}]})[_0x0a04('0x21')](handleEntityNotFound(_0x2b4025,null))[_0x0a04('0x21')](function(_0x2bc08f){var _0x175dba=_[_0x0a04('0x29')](_0x2bc08f,'id');var _0x4743cd=[];var _0x1ad433=[];var _0x4bce83=squel['select']();_0x4bce83[_0x0a04('0x6e')](_0x0a04('0x6f'))[_0x0a04('0x70')](_0x0a04('0x71'),'tq')[_0x0a04('0x72')](_0x0a04('0x73'),'ut',_0x0a04('0x74'))[_0x0a04('0x38')]('OpenchannelQueueId\x20=\x20?',_0x4f5b7e[_0x0a04('0x42')]['id']);for(var _0x156b13=0x0;_0x156b13<_0x2bc08f['length'];_0x156b13+=0x1){let _0x5a3ac1=_0x2bc08f[_0x156b13];for(var _0x185006=0x0;_0x185006<_0x5a3ac1[_0x0a04('0x62')][_0x0a04('0x34')];_0x185006+=0x1){let _0x55ead3=_0x5a3ac1[_0x0a04('0x62')][_0x185006];var _0x365669=_0x4bce83[_0x0a04('0x75')]();_0x365669[_0x0a04('0x38')]('ut.UserId\x20=\x20?',_0x55ead3['id']);_0x1ad433[_0x0a04('0x76')](db['sequelize'][_0x0a04('0x2e')](_0x365669[_0x0a04('0x77')](),{'type':db['sequelize'][_0x0a04('0x78')][_0x0a04('0x79')]})[_0x0a04('0x21')](function(_0x98ab3d){if(_0x98ab3d[_0x0a04('0x34')]===0x1){return _0x55ead3['id'];}else{var _0x573c61=_[_0x0a04('0x7a')](_[_0x0a04('0x29')](_0x98ab3d,_0x0a04('0x7b')),function(_0x341be5){return _[_0x0a04('0x7c')](_0x175dba,_0x341be5);});if(_0x573c61){return _0x55ead3['id'];}}}));}}return BPromise[_0x0a04('0x7d')](_0x1ad433)[_0x0a04('0x21')](function(_0x584cf7){_0x4743cd=_(_0x4743cd)[_0x0a04('0x7e')](_0x584cf7)[_0x0a04('0x7f')]()[_0x0a04('0x80')]();return db[_0x0a04('0x2a')]['find']({'where':{'id':_0x4f5b7e['params']['id']}})[_0x0a04('0x21')](function(_0x254aaf){return db[_0x0a04('0x66')][_0x0a04('0x67')](function(_0xc78c44){return _0x254aaf['removeTeams'](_0x4f5b7e[_0x0a04('0x2e')][_0x0a04('0x61')],{'transaction':_0xc78c44})[_0x0a04('0x21')](function(){if(!_[_0x0a04('0x81')](_0x4743cd)){return _0x254aaf['removeAgents'](_0x4743cd,{'transaction':_0xc78c44});}})[_0x0a04('0x21')](function(){_0x4743cd[_0x0a04('0x6a')](function(_0x6d2c12){socket['emit'](_0x0a04('0x82'),{'UserId':_0x6d2c12,'OpenchannelQueueId':_0x254aaf['id']});});});});});});})['then'](respondWithStatusCode(_0x2b4025,null))[_0x0a04('0x44')](handleError(_0x2b4025,null));};exports[_0x0a04('0x83')]=function(_0x540292,_0x4d09b0,_0x267f3d){return db[_0x0a04('0x2a')][_0x0a04('0x43')]({'where':{'id':_0x540292[_0x0a04('0x42')]['id']}})[_0x0a04('0x21')](handleEntityNotFound(_0x4d09b0,null))['then'](function(_0x578865){if(_0x578865){return _0x578865[_0x0a04('0x83')](_0x540292[_0x0a04('0x46')][_0x0a04('0x61')],_[_0x0a04('0x84')](_0x540292[_0x0a04('0x46')],['ids','id'])||{})[_0x0a04('0x85')](function(_0x1e6786){for(var _0x3a2605=0x0;_0x3a2605<_0x540292[_0x0a04('0x46')][_0x0a04('0x61')][_0x0a04('0x34')];_0x3a2605+=0x1){socket['emit'](_0x0a04('0x6c'),{'UserId':Number(_0x540292['body'][_0x0a04('0x61')][_0x3a2605]),'OpenchannelQueueId':Number(_0x540292['params']['id'])});}return _0x1e6786;});}})[_0x0a04('0x21')](respondWithResult(_0x4d09b0,null))['catch'](handleError(_0x4d09b0,null));};exports[_0x0a04('0x86')]=function(_0xcfd5bb,_0x3f4111,_0x26173a){return db[_0x0a04('0x2a')][_0x0a04('0x43')]({'where':{'id':_0xcfd5bb[_0x0a04('0x42')]['id']}})[_0x0a04('0x21')](handleEntityNotFound(_0x3f4111,null))['then'](function(_0x955512){if(_0x955512){return _0x955512[_0x0a04('0x86')](_0xcfd5bb[_0x0a04('0x2e')]['ids'])['then'](function(){if(_['isArray'](_0xcfd5bb[_0x0a04('0x2e')][_0x0a04('0x61')])){for(var _0x4e242e=0x0;_0x4e242e<_0xcfd5bb[_0x0a04('0x2e')][_0x0a04('0x61')][_0x0a04('0x34')];_0x4e242e+=0x1){socket[_0x0a04('0x6b')](_0x0a04('0x82'),{'UserId':Number(_0xcfd5bb[_0x0a04('0x2e')][_0x0a04('0x61')][_0x4e242e]),'OpenchannelQueueId':Number(_0xcfd5bb[_0x0a04('0x42')]['id'])});}}else{socket[_0x0a04('0x6b')](_0x0a04('0x82'),{'UserId':Number(_0xcfd5bb['query'][_0x0a04('0x61')]),'OpenchannelQueueId':Number(_0xcfd5bb[_0x0a04('0x42')]['id'])});}});}})[_0x0a04('0x21')](respondWithStatusCode(_0x3f4111,null))['catch'](handleError(_0x3f4111,null));};exports[_0x0a04('0x87')]=function(_0x30df01,_0x457498,_0x4f8aaf){var _0x148b86={};var _0x57e408={};var _0x444797;var _0x13a11f;return db[_0x0a04('0x2a')][_0x0a04('0x5c')]({'where':{'id':_0x30df01[_0x0a04('0x42')]['id']}})[_0x0a04('0x21')](handleEntityNotFound(_0x457498,null))['then'](function(_0x1b57c2){if(_0x1b57c2){_0x444797=_0x1b57c2;_0x57e408[_0x0a04('0x2d')]=_[_0x0a04('0x2f')](db['User'][_0x0a04('0x5e')]);_0x57e408[_0x0a04('0x2e')]=_['keys'](_0x30df01[_0x0a04('0x2e')]);_0x57e408[_0x0a04('0x30')]=_[_0x0a04('0x31')](_0x57e408['model'],_0x57e408[_0x0a04('0x2e')]);_0x148b86['attributes']=_[_0x0a04('0x31')](_0x57e408[_0x0a04('0x2d')],qs[_0x0a04('0x32')](_0x30df01['query'][_0x0a04('0x32')]));_0x148b86[_0x0a04('0x33')]=_0x148b86[_0x0a04('0x33')]['length']?_0x148b86[_0x0a04('0x33')]:_0x57e408[_0x0a04('0x2d')];_0x148b86[_0x0a04('0x5f')]=qs[_0x0a04('0x37')](_0x30df01['query'][_0x0a04('0x37')]);_0x148b86[_0x0a04('0x38')]=qs[_0x0a04('0x30')](_['pick'](_0x30df01[_0x0a04('0x2e')],_0x57e408[_0x0a04('0x30')]));if(_0x30df01[_0x0a04('0x2e')]['filter']){_0x148b86[_0x0a04('0x38')]=_['merge'](_0x148b86['where'],{'$or':_[_0x0a04('0x29')](_0x148b86['attributes'],function(_0x3a8b37){var _0x1e3cd3={};_0x1e3cd3[_0x3a8b37]={'$like':'%'+_0x30df01[_0x0a04('0x2e')][_0x0a04('0x52')]+'%'};return _0x1e3cd3;})});}_0x148b86=_[_0x0a04('0x3a')]({},_0x148b86,_0x30df01['options']);return _0x444797[_0x0a04('0x87')](_0x148b86);}})[_0x0a04('0x21')](function(_0x91d2ca){if(_0x91d2ca){_0x13a11f=_0x91d2ca[_0x0a04('0x34')];if(!_0x30df01[_0x0a04('0x2e')][_0x0a04('0x35')](_0x0a04('0x36'))){_0x148b86[_0x0a04('0x1a')]=qs[_0x0a04('0x1a')](_0x30df01[_0x0a04('0x2e')]['limit']);_0x148b86['offset']=qs['offset'](_0x30df01[_0x0a04('0x2e')]['offset']);}return _0x444797[_0x0a04('0x87')](_0x148b86);}})[_0x0a04('0x21')](function(_0x1c0f62){if(_0x1c0f62){return _0x1c0f62?{'count':_0x13a11f,'rows':_0x1c0f62}:null;}})[_0x0a04('0x21')](respondWithResult(_0x457498,null))['catch'](handleError(_0x457498,null));}; \ No newline at end of file +var _0xc9bc=['limit','Content-Range','json','apply','reject','update','then','destroy','UserProfileResource','sendStatus','error','stack','name','send','OpenchannelQueue','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','include','rows','catch','show','params','keys','rawAttributes','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','UserProfileSection','userProfileId','autoAssociation','getMembers','UserOpenchannelQueue','OpenchannelQueueId','findAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','getTeams','findOne','addTeams','User','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','ids','field','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','userOpenchannelQueue:remove','addAgents','spread','removeAgents','getAgents','eml-format','rimraf','zip-dir','request-promise','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','end','status','offset','undefined','count'];(function(_0x50bff9,_0x478430){var _0x23556b=function(_0x1406f4){while(--_0x1406f4){_0x50bff9['push'](_0x50bff9['shift']());}};_0x23556b(++_0x478430);}(_0xc9bc,0x185));var _0xcc9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc9bc[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xcc9b('0x0'));var rimraf=require(_0xcc9b('0x1'));var zipdir=require(_0xcc9b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcc9b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcc9b('0x4'));var path=require(_0xcc9b('0x5'));var sox=require(_0xcc9b('0x6'));var csv=require(_0xcc9b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcc9b('0x8'));var _=require(_0xcc9b('0x9'));var squel=require(_0xcc9b('0xa'));var crypto=require(_0xcc9b('0xb'));var jsforce=require(_0xcc9b('0xc'));var deskjs=require(_0xcc9b('0xd'));var toCsv=require('to-csv');var querystring=require(_0xcc9b('0xe'));var Papa=require(_0xcc9b('0xf'));var Redis=require(_0xcc9b('0x10'));var authService=require(_0xcc9b('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcc9b('0x12'));var logger=require(_0xcc9b('0x13'))('api');var utils=require(_0xcc9b('0x14'));var config=require(_0xcc9b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xcc9b('0x16'))['db'];config[_0xcc9b('0x17')]=_[_0xcc9b('0x18')](config[_0xcc9b('0x17')],{'host':_0xcc9b('0x19'),'port':0x18eb});var socket=require(_0xcc9b('0x1a'))(new Redis(config[_0xcc9b('0x17')]));require(_0xcc9b('0x1b'))[_0xcc9b('0x1c')](socket);function respondWithStatusCode(_0x5dfa44,_0x3daa6c){_0x3daa6c=_0x3daa6c||0xcc;return function(_0x49b7ee){if(_0x49b7ee){return _0x5dfa44['sendStatus'](_0x3daa6c);}return _0x5dfa44['status'](_0x3daa6c)[_0xcc9b('0x1d')]();};}function respondWithResult(_0x576d49,_0x8a484){_0x8a484=_0x8a484||0xc8;return function(_0x54fdf5){if(_0x54fdf5){return _0x576d49[_0xcc9b('0x1e')](_0x8a484)['json'](_0x54fdf5);}};}function respondWithFilteredResult(_0x42e21c,_0x32da7d){return function(_0x5d81e3){if(_0x5d81e3){var _0x51ef55=typeof _0x32da7d[_0xcc9b('0x1f')]==='undefined'&&typeof _0x32da7d['limit']===_0xcc9b('0x20');var _0x47bff3=_0x5d81e3[_0xcc9b('0x21')];var _0x413f15=_0x51ef55?0x0:_0x32da7d[_0xcc9b('0x1f')];var _0xb14fb=_0x51ef55?_0x5d81e3[_0xcc9b('0x21')]:_0x32da7d['offset']+_0x32da7d[_0xcc9b('0x22')];var _0xc25526;if(_0xb14fb>=_0x47bff3){_0xb14fb=_0x47bff3;_0xc25526=0xc8;}else{_0xc25526=0xce;}_0x42e21c['status'](_0xc25526);return _0x42e21c['set'](_0xcc9b('0x23'),_0x413f15+'-'+_0xb14fb+'/'+_0x47bff3)[_0xcc9b('0x24')](_0x5d81e3);}return null;};}function patchUpdates(_0xac784e){return function(_0x380136){try{jsonpatch[_0xcc9b('0x25')](_0x380136,_0xac784e,!![]);}catch(_0x391d03){return BPromise[_0xcc9b('0x26')](_0x391d03);}return _0x380136['save']();};}function saveUpdates(_0x3ed0a0,_0x1ab253){return function(_0x210d77){if(_0x210d77){return _0x210d77[_0xcc9b('0x27')](_0x3ed0a0)[_0xcc9b('0x28')](function(_0x5ab59d){return _0x5ab59d;});}return null;};}function removeEntity(_0x54c2c2,_0x542e78){return function(_0x17cb5d){if(_0x17cb5d){return _0x17cb5d[_0xcc9b('0x29')]()[_0xcc9b('0x28')](function(){var _0x344325=_0x17cb5d['get']({'plain':!![]});var _0x990793='OpenchannelQueues';return db[_0xcc9b('0x2a')]['destroy']({'where':{'type':_0x990793,'resourceId':_0x344325['id']}})[_0xcc9b('0x28')](function(){return _0x17cb5d;});})[_0xcc9b('0x28')](function(){_0x54c2c2[_0xcc9b('0x1e')](0xcc)[_0xcc9b('0x1d')]();});}};}function handleEntityNotFound(_0x382ae9,_0x29744a){return function(_0x3aaadf){if(!_0x3aaadf){_0x382ae9[_0xcc9b('0x2b')](0x194);}return _0x3aaadf;};}function handleError(_0x381beb,_0x568a96){_0x568a96=_0x568a96||0x1f4;return function(_0x2cdef5){logger[_0xcc9b('0x2c')](_0x2cdef5[_0xcc9b('0x2d')]);if(_0x2cdef5[_0xcc9b('0x2e')]){delete _0x2cdef5[_0xcc9b('0x2e')];}_0x381beb[_0xcc9b('0x1e')](_0x568a96)[_0xcc9b('0x2f')](_0x2cdef5);};}exports['index']=function(_0x3318ac,_0x226308){var _0x563cd7={},_0x3d88c5={},_0x3ddefe={'count':0x0,'rows':[]};var _0x9e6bf9=_['map'](db[_0xcc9b('0x30')]['rawAttributes'],function(_0x3997b6){return{'name':_0x3997b6[_0xcc9b('0x31')],'type':_0x3997b6[_0xcc9b('0x32')][_0xcc9b('0x33')]};});_0x3d88c5[_0xcc9b('0x34')]=_['map'](_0x9e6bf9,_0xcc9b('0x2e'));_0x3d88c5['query']=_['keys'](_0x3318ac[_0xcc9b('0x35')]);_0x3d88c5[_0xcc9b('0x36')]=_[_0xcc9b('0x37')](_0x3d88c5[_0xcc9b('0x34')],_0x3d88c5[_0xcc9b('0x35')]);_0x563cd7[_0xcc9b('0x38')]=_['intersection'](_0x3d88c5[_0xcc9b('0x34')],qs[_0xcc9b('0x39')](_0x3318ac['query'][_0xcc9b('0x39')]));_0x563cd7[_0xcc9b('0x38')]=_0x563cd7[_0xcc9b('0x38')][_0xcc9b('0x3a')]?_0x563cd7['attributes']:_0x3d88c5[_0xcc9b('0x34')];if(!_0x3318ac[_0xcc9b('0x35')][_0xcc9b('0x3b')](_0xcc9b('0x3c'))){_0x563cd7[_0xcc9b('0x22')]=qs[_0xcc9b('0x22')](_0x3318ac['query'][_0xcc9b('0x22')]);_0x563cd7['offset']=qs['offset'](_0x3318ac[_0xcc9b('0x35')]['offset']);}_0x563cd7[_0xcc9b('0x3d')]=qs[_0xcc9b('0x3e')](_0x3318ac[_0xcc9b('0x35')][_0xcc9b('0x3e')]);_0x563cd7[_0xcc9b('0x3f')]=qs[_0xcc9b('0x36')](_[_0xcc9b('0x40')](_0x3318ac[_0xcc9b('0x35')],_0x3d88c5[_0xcc9b('0x36')]),_0x9e6bf9);if(_0x3318ac[_0xcc9b('0x35')][_0xcc9b('0x41')]){_0x563cd7[_0xcc9b('0x3f')]=_[_0xcc9b('0x42')](_0x563cd7[_0xcc9b('0x3f')],{'$or':_[_0xcc9b('0x43')](_0x9e6bf9,function(_0x868226){if(_0x868226[_0xcc9b('0x32')]!==_0xcc9b('0x44')){var _0x2d2c7e={};_0x2d2c7e[_0x868226[_0xcc9b('0x2e')]]={'$like':'%'+_0x3318ac[_0xcc9b('0x35')][_0xcc9b('0x41')]+'%'};return _0x2d2c7e;}})});}_0x563cd7=_[_0xcc9b('0x42')]({},_0x563cd7,_0x3318ac['options']);var _0x56def0={'where':_0x563cd7[_0xcc9b('0x3f')]};return db[_0xcc9b('0x30')][_0xcc9b('0x21')](_0x56def0)['then'](function(_0x3c99da){_0x3ddefe[_0xcc9b('0x21')]=_0x3c99da;if(_0x3318ac[_0xcc9b('0x35')][_0xcc9b('0x45')]){_0x563cd7[_0xcc9b('0x46')]=[{'all':!![]}];}return db[_0xcc9b('0x30')]['findAll'](_0x563cd7);})[_0xcc9b('0x28')](function(_0x146aa1){_0x3ddefe[_0xcc9b('0x47')]=_0x146aa1;return _0x3ddefe;})[_0xcc9b('0x28')](respondWithFilteredResult(_0x226308,_0x563cd7))[_0xcc9b('0x48')](handleError(_0x226308,null));};exports[_0xcc9b('0x49')]=function(_0x57f167,_0x2ac83c){var _0xc9a2e9={'raw':!![],'where':{'id':_0x57f167[_0xcc9b('0x4a')]['id']}},_0x56df0a={};_0x56df0a[_0xcc9b('0x34')]=_[_0xcc9b('0x4b')](db[_0xcc9b('0x30')][_0xcc9b('0x4c')]);_0x56df0a[_0xcc9b('0x35')]=_['keys'](_0x57f167[_0xcc9b('0x35')]);_0x56df0a[_0xcc9b('0x36')]=_[_0xcc9b('0x37')](_0x56df0a[_0xcc9b('0x34')],_0x56df0a[_0xcc9b('0x35')]);_0xc9a2e9['attributes']=_['intersection'](_0x56df0a[_0xcc9b('0x34')],qs[_0xcc9b('0x39')](_0x57f167[_0xcc9b('0x35')][_0xcc9b('0x39')]));_0xc9a2e9['attributes']=_0xc9a2e9['attributes']['length']?_0xc9a2e9[_0xcc9b('0x38')]:_0x56df0a[_0xcc9b('0x34')];if(_0x57f167[_0xcc9b('0x35')][_0xcc9b('0x45')]){_0xc9a2e9[_0xcc9b('0x46')]=[{'all':!![]}];}_0xc9a2e9=_[_0xcc9b('0x42')]({},_0xc9a2e9,_0x57f167[_0xcc9b('0x4d')]);return db[_0xcc9b('0x30')][_0xcc9b('0x4e')](_0xc9a2e9)[_0xcc9b('0x28')](handleEntityNotFound(_0x2ac83c,null))[_0xcc9b('0x28')](respondWithResult(_0x2ac83c,null))[_0xcc9b('0x48')](handleError(_0x2ac83c,null));};exports[_0xcc9b('0x4f')]=function(_0xc6918c,_0x1e092a){return db[_0xcc9b('0x30')][_0xcc9b('0x4f')](_0xc6918c[_0xcc9b('0x50')],{})[_0xcc9b('0x28')](function(_0x19bf5b){var _0x2f7abc=_0xc6918c[_0xcc9b('0x51')][_0xcc9b('0x52')]({'plain':!![]});if(!_0x2f7abc)throw new Error(_0xcc9b('0x53'));if(_0x2f7abc[_0xcc9b('0x54')]===_0xcc9b('0x51')){var _0x1de976=_0x19bf5b[_0xcc9b('0x52')]({'plain':!![]});var _0x27bbb4=_0xcc9b('0x55');return db[_0xcc9b('0x56')][_0xcc9b('0x4e')]({'where':{'name':_0x27bbb4,'userProfileId':_0x2f7abc[_0xcc9b('0x57')]},'raw':!![]})[_0xcc9b('0x28')](function(_0x2a67ff){if(_0x2a67ff&&_0x2a67ff[_0xcc9b('0x58')]===0x0){return db['UserProfileResource'][_0xcc9b('0x4f')]({'name':_0x1de976[_0xcc9b('0x2e')],'resourceId':_0x1de976['id'],'type':_0x2a67ff[_0xcc9b('0x2e')],'sectionId':_0x2a67ff['id']},{})[_0xcc9b('0x28')](function(){return _0x19bf5b;});}else{return _0x19bf5b;}})[_0xcc9b('0x48')](function(_0x261c6b){logger[_0xcc9b('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x261c6b);throw _0x261c6b;});}return _0x19bf5b;})[_0xcc9b('0x28')](respondWithResult(_0x1e092a,0xc9))[_0xcc9b('0x48')](handleError(_0x1e092a,null));};exports[_0xcc9b('0x27')]=function(_0x189b31,_0x4a1530){if(_0x189b31[_0xcc9b('0x50')]['id']){delete _0x189b31[_0xcc9b('0x50')]['id'];}return db[_0xcc9b('0x30')][_0xcc9b('0x4e')]({'where':{'id':_0x189b31['params']['id']}})['then'](handleEntityNotFound(_0x4a1530,null))[_0xcc9b('0x28')](saveUpdates(_0x189b31[_0xcc9b('0x50')],null))['then'](respondWithResult(_0x4a1530,null))['catch'](handleError(_0x4a1530,null));};exports[_0xcc9b('0x29')]=function(_0x2864d7,_0x4b60bb){return db[_0xcc9b('0x30')][_0xcc9b('0x4e')]({'where':{'id':_0x2864d7[_0xcc9b('0x4a')]['id']}})[_0xcc9b('0x28')](handleEntityNotFound(_0x4b60bb,null))['then'](removeEntity(_0x4b60bb,null))['catch'](handleError(_0x4b60bb,null));};exports['describe']=function(_0x25a811,_0x16f278){return db[_0xcc9b('0x30')]['describe']()['then'](respondWithResult(_0x16f278,null))[_0xcc9b('0x48')](handleError(_0x16f278,null));};exports[_0xcc9b('0x59')]=function(_0x146e98,_0x2890fa,_0x444051){var _0x19cfdc={'raw':!![],'where':{}},_0x1e8dea={},_0xaf5f1e;return db[_0xcc9b('0x30')]['findOne']({'where':{'id':_0x146e98[_0xcc9b('0x4a')]['id']}})[_0xcc9b('0x28')](handleEntityNotFound(_0x2890fa,null))[_0xcc9b('0x28')](function(_0x33a2ad){if(_0x33a2ad){_0xaf5f1e=_0x33a2ad['get']({'plain':!![]});_0x1e8dea[_0xcc9b('0x34')]=_['keys'](db[_0xcc9b('0x5a')][_0xcc9b('0x4c')]);_0x1e8dea[_0xcc9b('0x35')]=_['keys'](_0x146e98[_0xcc9b('0x35')]);_0x1e8dea['filters']=_[_0xcc9b('0x37')](_0x1e8dea['model'],_0x1e8dea[_0xcc9b('0x35')]);_0x19cfdc[_0xcc9b('0x38')]=_[_0xcc9b('0x37')](_0x1e8dea[_0xcc9b('0x34')],qs[_0xcc9b('0x39')](_0x146e98[_0xcc9b('0x35')][_0xcc9b('0x39')]));_0x19cfdc['attributes']=_0x19cfdc[_0xcc9b('0x38')][_0xcc9b('0x3a')]?_0x19cfdc[_0xcc9b('0x38')]:_0x1e8dea[_0xcc9b('0x34')];if(!_0x146e98[_0xcc9b('0x35')][_0xcc9b('0x3b')](_0xcc9b('0x3c'))){_0x19cfdc[_0xcc9b('0x22')]=qs[_0xcc9b('0x22')](_0x146e98['query'][_0xcc9b('0x22')]);_0x19cfdc['offset']=qs[_0xcc9b('0x1f')](_0x146e98[_0xcc9b('0x35')][_0xcc9b('0x1f')]);}_0x19cfdc[_0xcc9b('0x3d')]=qs[_0xcc9b('0x3e')](_0x146e98[_0xcc9b('0x35')][_0xcc9b('0x3e')]);_0x19cfdc['where']=qs[_0xcc9b('0x36')](_[_0xcc9b('0x40')](_0x146e98[_0xcc9b('0x35')],_0x1e8dea[_0xcc9b('0x36')]));_0x19cfdc[_0xcc9b('0x3f')][_0xcc9b('0x5b')]=_0x33a2ad['id'];if(_0x146e98['query'][_0xcc9b('0x41')]){_0x19cfdc[_0xcc9b('0x3f')]=_[_0xcc9b('0x42')](_0x19cfdc[_0xcc9b('0x3f')],{'$or':_['map'](_0x19cfdc[_0xcc9b('0x38')],function(_0x5218a9){var _0x3aa17d={};_0x3aa17d[_0x5218a9]={'$like':'%'+_0x146e98[_0xcc9b('0x35')][_0xcc9b('0x41')]+'%'};return _0x3aa17d;})});}_0x19cfdc=_[_0xcc9b('0x42')]({},_0x19cfdc,_0x146e98['options']);return db[_0xcc9b('0x5a')][_0xcc9b('0x5c')](_0x19cfdc);}})[_0xcc9b('0x28')](function(_0x1f1ff1){if(_0x1f1ff1){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0x1f1ff1,_0xcc9b('0x5d')),'role':_0xcc9b('0x5e')},'attributes':['id','name',_0xcc9b('0x5f'),_0xcc9b('0x60'),_0xcc9b('0x61')]});}})[_0xcc9b('0x28')](function(_0x42cd4b){if(_0x42cd4b){return{'count':_0x42cd4b[_0xcc9b('0x21')],'rows':_[_0xcc9b('0x43')](_0x42cd4b[_0xcc9b('0x47')],function(_0x3b9b90){return{'membername':_0x3b9b90[_0xcc9b('0x2e')],'UserId':_0x3b9b90['id'],'queue_name':_0xaf5f1e[_0xcc9b('0x2e')],'OpenchannelQueueId':_0xaf5f1e['id'],'interface':util[_0xcc9b('0x62')](_0xcc9b('0x63'),'SIP',_0x3b9b90[_0xcc9b('0x2e')]),'penalty':0x0,'paused':_0x3b9b90[_0xcc9b('0x5f')],'createdAt':_0x3b9b90[_0xcc9b('0x61')],'updatedAt':_0x3b9b90['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2890fa,_0x19cfdc))[_0xcc9b('0x48')](handleError(_0x2890fa,null));};exports[_0xcc9b('0x64')]=function(_0x2811dd,_0x1d4053,_0x34ebd5){var _0x10ed3b={};var _0x57ddcf={};var _0x455619;var _0x38fce2;return db[_0xcc9b('0x30')][_0xcc9b('0x65')]({'where':{'id':_0x2811dd[_0xcc9b('0x4a')]['id']}})[_0xcc9b('0x28')](handleEntityNotFound(_0x1d4053,null))['then'](function(_0x4c7988){if(_0x4c7988){_0x455619=_0x4c7988;_0x57ddcf['model']=_['keys'](db['Team']['rawAttributes']);_0x57ddcf['query']=_[_0xcc9b('0x4b')](_0x2811dd[_0xcc9b('0x35')]);_0x57ddcf['filters']=_[_0xcc9b('0x37')](_0x57ddcf[_0xcc9b('0x34')],_0x57ddcf[_0xcc9b('0x35')]);_0x10ed3b[_0xcc9b('0x38')]=_['intersection'](_0x57ddcf['model'],qs['fields'](_0x2811dd[_0xcc9b('0x35')][_0xcc9b('0x39')]));_0x10ed3b[_0xcc9b('0x38')]=_0x10ed3b[_0xcc9b('0x38')][_0xcc9b('0x3a')]?_0x10ed3b['attributes']:_0x57ddcf[_0xcc9b('0x34')];_0x10ed3b[_0xcc9b('0x3d')]=qs[_0xcc9b('0x3e')](_0x2811dd['query'][_0xcc9b('0x3e')]);_0x10ed3b[_0xcc9b('0x3f')]=qs[_0xcc9b('0x36')](_[_0xcc9b('0x40')](_0x2811dd[_0xcc9b('0x35')],_0x57ddcf[_0xcc9b('0x36')]));if(_0x2811dd[_0xcc9b('0x35')]['filter']){_0x10ed3b[_0xcc9b('0x3f')]=_[_0xcc9b('0x42')](_0x10ed3b[_0xcc9b('0x3f')],{'$or':_[_0xcc9b('0x43')](_0x10ed3b[_0xcc9b('0x38')],function(_0x531f22){var _0x23285f={};_0x23285f[_0x531f22]={'$like':'%'+_0x2811dd['query']['filter']+'%'};return _0x23285f;})});}_0x10ed3b=_[_0xcc9b('0x42')]({},_0x10ed3b,_0x2811dd[_0xcc9b('0x4d')]);return _0x455619[_0xcc9b('0x64')](_0x10ed3b);}})[_0xcc9b('0x28')](function(_0x44c597){if(_0x44c597){_0x38fce2=_0x44c597[_0xcc9b('0x3a')];if(!_0x2811dd[_0xcc9b('0x35')][_0xcc9b('0x3b')](_0xcc9b('0x3c'))){_0x10ed3b[_0xcc9b('0x22')]=qs['limit'](_0x2811dd['query'][_0xcc9b('0x22')]);_0x10ed3b[_0xcc9b('0x1f')]=qs[_0xcc9b('0x1f')](_0x2811dd[_0xcc9b('0x35')]['offset']);}return _0x455619[_0xcc9b('0x64')](_0x10ed3b);}})[_0xcc9b('0x28')](function(_0x4fdd7d){if(_0x4fdd7d){return _0x4fdd7d?{'count':_0x38fce2,'rows':_0x4fdd7d}:null;}})['then'](respondWithResult(_0x1d4053,null))['catch'](handleError(_0x1d4053,null));};exports[_0xcc9b('0x66')]=function(_0x149a72,_0x214c5c,_0x349958){var _0x1c978=_0x149a72[_0xcc9b('0x50')]['ids'];return db['Team'][_0xcc9b('0x5c')]({'where':{'id':_0x1c978},'attributes':['id'],'include':[{'model':db[_0xcc9b('0x67')],'as':'Agents','attributes':['id','name',_0xcc9b('0x68'),_0xcc9b('0x69'),_0xcc9b('0x6a')],'raw':!![]}]})[_0xcc9b('0x28')](function(_0x3073ca){if(_0x3073ca){var _0x3e0ea2=_[_0xcc9b('0x6b')](_0x3073ca,function(_0x3f5519){var _0x2390d1=_0x3f5519['get']({'plain':!![]});return _0x2390d1[_0xcc9b('0x6c')];});return db['OpenchannelQueue'][_0xcc9b('0x4e')]({'where':{'id':_0x149a72[_0xcc9b('0x4a')]['id']}})['then'](function(_0x326432){return db[_0xcc9b('0x6d')][_0xcc9b('0x6e')](function(_0x4a821c){return _0x326432[_0xcc9b('0x66')](_0x1c978,{'transaction':_0x4a821c})[_0xcc9b('0x28')](function(){return BPromise[_0xcc9b('0x6f')](_0x3e0ea2,function(_0xc8c2e8){return db[_0xcc9b('0x5a')][_0xcc9b('0x70')]({'where':{'UserId':_0xc8c2e8['id'],'OpenchannelQueueId':_0x149a72[_0xcc9b('0x4a')]['id']},'transaction':_0x4a821c});});})['then'](function(){_0x3e0ea2[_0xcc9b('0x71')](function(_0x55f9e9){socket[_0xcc9b('0x72')](_0xcc9b('0x73'),{'UserId':_0x55f9e9['id'],'OpenchannelQueueId':_0x326432['id']});});});});});}})[_0xcc9b('0x28')](respondWithStatusCode(_0x214c5c,null))[_0xcc9b('0x48')](handleError(_0x214c5c,null));};exports['removeTeams']=function(_0x5e3462,_0x177240,_0x4cf3a3){return db['Team']['findAll']({'where':{'id':_0x5e3462[_0xcc9b('0x35')][_0xcc9b('0x74')]},'attributes':['id'],'include':[{'model':db[_0xcc9b('0x67')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xcc9b('0x28')](handleEntityNotFound(_0x177240,null))[_0xcc9b('0x28')](function(_0x3a67a1){var _0x3448a9=_[_0xcc9b('0x43')](_0x3a67a1,'id');var _0x10ed4a=[];var _0x3dee10=[];var _0x39bee7=squel['select']();_0x39bee7[_0xcc9b('0x75')]('tq.TeamId')[_0xcc9b('0x76')](_0xcc9b('0x77'),'tq')[_0xcc9b('0x78')]('user_has_teams','ut',_0xcc9b('0x79'))['where'](_0xcc9b('0x7a'),_0x5e3462['params']['id']);for(var _0x5a52fc=0x0;_0x5a52fc<_0x3a67a1['length'];_0x5a52fc+=0x1){let _0x2c89f7=_0x3a67a1[_0x5a52fc];for(var _0x9c4d2e=0x0;_0x9c4d2e<_0x2c89f7['Agents'][_0xcc9b('0x3a')];_0x9c4d2e+=0x1){let _0x23f3e2=_0x2c89f7[_0xcc9b('0x6c')][_0x9c4d2e];var _0xc7d874=_0x39bee7[_0xcc9b('0x7b')]();_0xc7d874[_0xcc9b('0x3f')](_0xcc9b('0x7c'),_0x23f3e2['id']);_0x3dee10['push'](db[_0xcc9b('0x6d')][_0xcc9b('0x35')](_0xc7d874[_0xcc9b('0x7d')](),{'type':db[_0xcc9b('0x6d')][_0xcc9b('0x7e')][_0xcc9b('0x7f')]})[_0xcc9b('0x28')](function(_0x4a4735){if(_0x4a4735[_0xcc9b('0x3a')]===0x1){return _0x23f3e2['id'];}else{var _0x4a1cc1=_[_0xcc9b('0x80')](_[_0xcc9b('0x43')](_0x4a4735,_0xcc9b('0x81')),function(_0x232747){return _[_0xcc9b('0x82')](_0x3448a9,_0x232747);});if(_0x4a1cc1){return _0x23f3e2['id'];}}}));}}return BPromise[_0xcc9b('0x83')](_0x3dee10)[_0xcc9b('0x28')](function(_0x19ee2c){_0x10ed4a=_(_0x10ed4a)[_0xcc9b('0x84')](_0x19ee2c)[_0xcc9b('0x85')]()[_0xcc9b('0x86')]();return db[_0xcc9b('0x30')]['find']({'where':{'id':_0x5e3462[_0xcc9b('0x4a')]['id']}})[_0xcc9b('0x28')](function(_0xad1cee){return db[_0xcc9b('0x6d')]['transaction'](function(_0x2972e0){return _0xad1cee['removeTeams'](_0x5e3462[_0xcc9b('0x35')][_0xcc9b('0x74')],{'transaction':_0x2972e0})[_0xcc9b('0x28')](function(){if(!_[_0xcc9b('0x87')](_0x10ed4a)){return _0xad1cee['removeAgents'](_0x10ed4a,{'transaction':_0x2972e0});}})[_0xcc9b('0x28')](function(){_0x10ed4a[_0xcc9b('0x71')](function(_0x201148){socket[_0xcc9b('0x72')](_0xcc9b('0x88'),{'UserId':_0x201148,'OpenchannelQueueId':_0xad1cee['id']});});});});});});})[_0xcc9b('0x28')](respondWithStatusCode(_0x177240,null))['catch'](handleError(_0x177240,null));};exports[_0xcc9b('0x89')]=function(_0x165653,_0x5ac486,_0x3fc04a){return db['OpenchannelQueue']['find']({'where':{'id':_0x165653[_0xcc9b('0x4a')]['id']}})[_0xcc9b('0x28')](handleEntityNotFound(_0x5ac486,null))['then'](function(_0x1c66e7){if(_0x1c66e7){return _0x1c66e7['addAgents'](_0x165653['body'][_0xcc9b('0x74')],_['omit'](_0x165653[_0xcc9b('0x50')],[_0xcc9b('0x74'),'id'])||{})[_0xcc9b('0x8a')](function(_0x12f8e4){for(var _0x159865=0x0;_0x159865<_0x165653[_0xcc9b('0x50')][_0xcc9b('0x74')]['length'];_0x159865+=0x1){socket[_0xcc9b('0x72')](_0xcc9b('0x73'),{'UserId':Number(_0x165653[_0xcc9b('0x50')][_0xcc9b('0x74')][_0x159865]),'OpenchannelQueueId':Number(_0x165653[_0xcc9b('0x4a')]['id'])});}return _0x12f8e4;});}})[_0xcc9b('0x28')](respondWithResult(_0x5ac486,null))[_0xcc9b('0x48')](handleError(_0x5ac486,null));};exports[_0xcc9b('0x8b')]=function(_0x2d68f0,_0x413b02,_0x218b76){return db['OpenchannelQueue'][_0xcc9b('0x4e')]({'where':{'id':_0x2d68f0[_0xcc9b('0x4a')]['id']}})[_0xcc9b('0x28')](handleEntityNotFound(_0x413b02,null))[_0xcc9b('0x28')](function(_0x39469a){if(_0x39469a){return _0x39469a[_0xcc9b('0x8b')](_0x2d68f0[_0xcc9b('0x35')][_0xcc9b('0x74')])[_0xcc9b('0x28')](function(){if(_['isArray'](_0x2d68f0[_0xcc9b('0x35')][_0xcc9b('0x74')])){for(var _0x32332c=0x0;_0x32332c<_0x2d68f0['query']['ids'][_0xcc9b('0x3a')];_0x32332c+=0x1){socket[_0xcc9b('0x72')]('userOpenchannelQueue:remove',{'UserId':Number(_0x2d68f0[_0xcc9b('0x35')][_0xcc9b('0x74')][_0x32332c]),'OpenchannelQueueId':Number(_0x2d68f0[_0xcc9b('0x4a')]['id'])});}}else{socket[_0xcc9b('0x72')](_0xcc9b('0x88'),{'UserId':Number(_0x2d68f0[_0xcc9b('0x35')]['ids']),'OpenchannelQueueId':Number(_0x2d68f0[_0xcc9b('0x4a')]['id'])});}});}})[_0xcc9b('0x28')](respondWithStatusCode(_0x413b02,null))[_0xcc9b('0x48')](handleError(_0x413b02,null));};exports[_0xcc9b('0x8c')]=function(_0x8516d8,_0x3a0cb2,_0x5b3a39){var _0x3e5ada={};var _0x5d6c11={};var _0x4c282a;var _0x4c9445;return db[_0xcc9b('0x30')]['findOne']({'where':{'id':_0x8516d8[_0xcc9b('0x4a')]['id']}})[_0xcc9b('0x28')](handleEntityNotFound(_0x3a0cb2,null))[_0xcc9b('0x28')](function(_0x3799c7){if(_0x3799c7){_0x4c282a=_0x3799c7;_0x5d6c11[_0xcc9b('0x34')]=_['keys'](db[_0xcc9b('0x67')][_0xcc9b('0x4c')]);_0x5d6c11[_0xcc9b('0x35')]=_[_0xcc9b('0x4b')](_0x8516d8[_0xcc9b('0x35')]);_0x5d6c11['filters']=_[_0xcc9b('0x37')](_0x5d6c11[_0xcc9b('0x34')],_0x5d6c11[_0xcc9b('0x35')]);_0x3e5ada[_0xcc9b('0x38')]=_[_0xcc9b('0x37')](_0x5d6c11[_0xcc9b('0x34')],qs[_0xcc9b('0x39')](_0x8516d8[_0xcc9b('0x35')]['fields']));_0x3e5ada[_0xcc9b('0x38')]=_0x3e5ada['attributes'][_0xcc9b('0x3a')]?_0x3e5ada[_0xcc9b('0x38')]:_0x5d6c11['model'];_0x3e5ada[_0xcc9b('0x3d')]=qs[_0xcc9b('0x3e')](_0x8516d8[_0xcc9b('0x35')]['sort']);_0x3e5ada[_0xcc9b('0x3f')]=qs[_0xcc9b('0x36')](_['pick'](_0x8516d8[_0xcc9b('0x35')],_0x5d6c11[_0xcc9b('0x36')]));if(_0x8516d8['query']['filter']){_0x3e5ada[_0xcc9b('0x3f')]=_['merge'](_0x3e5ada[_0xcc9b('0x3f')],{'$or':_[_0xcc9b('0x43')](_0x3e5ada[_0xcc9b('0x38')],function(_0x3054cb){var _0x527555={};_0x527555[_0x3054cb]={'$like':'%'+_0x8516d8[_0xcc9b('0x35')][_0xcc9b('0x41')]+'%'};return _0x527555;})});}_0x3e5ada=_['merge']({},_0x3e5ada,_0x8516d8[_0xcc9b('0x4d')]);return _0x4c282a[_0xcc9b('0x8c')](_0x3e5ada);}})[_0xcc9b('0x28')](function(_0x52e0e0){if(_0x52e0e0){_0x4c9445=_0x52e0e0[_0xcc9b('0x3a')];if(!_0x8516d8['query'][_0xcc9b('0x3b')]('nolimit')){_0x3e5ada['limit']=qs[_0xcc9b('0x22')](_0x8516d8[_0xcc9b('0x35')][_0xcc9b('0x22')]);_0x3e5ada[_0xcc9b('0x1f')]=qs[_0xcc9b('0x1f')](_0x8516d8[_0xcc9b('0x35')][_0xcc9b('0x1f')]);}return _0x4c282a[_0xcc9b('0x8c')](_0x3e5ada);}})['then'](function(_0x30de41){if(_0x30de41){return _0x30de41?{'count':_0x4c9445,'rows':_0x30de41}:null;}})[_0xcc9b('0x28')](respondWithResult(_0x3a0cb2,null))[_0xcc9b('0x48')](handleError(_0x3a0cb2,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index dcd42d2..ceec50e 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 _0x0223=['emit','hasOwnProperty','hook','OpenchannelQueue','update','remove'];(function(_0xd323b2,_0x40369a){var _0xb63fee=function(_0x4100f6){while(--_0x4100f6){_0xd323b2['push'](_0xd323b2['shift']());}};_0xb63fee(++_0x40369a);}(_0x0223,0x81));var _0x3022=function(_0x4ae506,_0x5a97ed){_0x4ae506=_0x4ae506-0x0;var _0x18e3a1=_0x0223[_0x4ae506];return _0x18e3a1;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require('../../mysqldb')['db'][_0x3022('0x0')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x3022('0x1'),'afterDestroy':_0x3022('0x2')};function emitEvent(_0x3e6cdf){return function(_0x4b191d,_0xf1701,_0x8feba4){OpenchannelQueueEvents[_0x3022('0x3')](_0x3e6cdf+':'+_0x4b191d['id'],_0x4b191d);OpenchannelQueueEvents[_0x3022('0x3')](_0x3e6cdf,_0x4b191d);_0x8feba4(null);};}for(var e in events){if(events[_0x3022('0x4')](e)){var event=events[e];OpenchannelQueue[_0x3022('0x5')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0xfb9f=['hasOwnProperty','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','remove','emit'];(function(_0x51cf40,_0x37369a){var _0x3ebdca=function(_0x31bf87){while(--_0x31bf87){_0x51cf40['push'](_0x51cf40['shift']());}};_0x3ebdca(++_0x37369a);}(_0xfb9f,0x1cd));var _0xffb9=function(_0x160da8,_0x2f2e01){_0x160da8=_0x160da8-0x0;var _0x54cf75=_0xfb9f[_0x160da8];return _0x54cf75;};'use strict';var EventEmitter=require(_0xffb9('0x0'));var OpenchannelQueue=require(_0xffb9('0x1'))['db'][_0xffb9('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xffb9('0x3')](0x0);var events={'afterCreate':_0xffb9('0x4'),'afterUpdate':'update','afterDestroy':_0xffb9('0x5')};function emitEvent(_0x21260a){return function(_0x577e1a,_0x21fdea,_0x4236f0){OpenchannelQueueEvents[_0xffb9('0x6')](_0x21260a+':'+_0x577e1a['id'],_0x577e1a);OpenchannelQueueEvents['emit'](_0x21260a,_0x577e1a);_0x4236f0(null);};}for(var e in events){if(events[_0xffb9('0x7')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0xffb9('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 3ce4efb..43086aa 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 _0x1b22=['OpenchannelQueue','openchannel_queues','lodash','util','api','request-promise','path','rimraf','define'];(function(_0x19d717,_0x57d7b0){var _0x2b327b=function(_0x3dd04c){while(--_0x3dd04c){_0x19d717['push'](_0x19d717['shift']());}};_0x2b327b(++_0x57d7b0);}(_0x1b22,0xa4));var _0x21b2=function(_0x5ea60d,_0xf1b6f3){_0x5ea60d=_0x5ea60d-0x0;var _0x1d14eb=_0x1b22[_0x5ea60d];return _0x1d14eb;};'use strict';var _=require(_0x21b2('0x0'));var util=require(_0x21b2('0x1'));var logger=require('../../config/logger')(_0x21b2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x21b2('0x3'));var fs=require('fs');var path=require(_0x21b2('0x4'));var rimraf=require(_0x21b2('0x5'));var config=require('../../config/environment');var attributes=require('./openchannelQueue.attributes');module['exports']=function(_0x3387bc,_0x4ed421){return _0x3387bc[_0x21b2('0x6')](_0x21b2('0x7'),attributes,{'tableName':_0x21b2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2a8=['openchannel_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','define'];(function(_0x35d8ab,_0x41f966){var _0x425f16=function(_0x564f14){while(--_0x564f14){_0x35d8ab['push'](_0x35d8ab['shift']());}};_0x425f16(++_0x41f966);}(_0xf2a8,0x15d));var _0x8f2a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf2a8[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x8f2a('0x0'));var util=require(_0x8f2a('0x1'));var logger=require(_0x8f2a('0x2'))(_0x8f2a('0x3'));var moment=require('moment');var BPromise=require(_0x8f2a('0x4'));var rp=require(_0x8f2a('0x5'));var fs=require('fs');var path=require(_0x8f2a('0x6'));var rimraf=require(_0x8f2a('0x7'));var config=require(_0x8f2a('0x8'));var attributes=require(_0x8f2a('0x9'));module['exports']=function(_0x43df33,_0x32ea26){return _0x43df33[_0x8f2a('0xa')]('OpenchannelQueue',attributes,{'tableName':_0x8f2a('0xb'),'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 e39c6f2..d8c1435 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 _0xa309=['OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','OpenchannelQueue,\x20%s,\x20%s','info','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','limit','include','map','attributes','model','then','stringify','ShowOpenchannelQueue','raw','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','request\x20sent','debug'];(function(_0x34c0f1,_0x52ee0c){var _0xabef14=function(_0x27f20a){while(--_0x27f20a){_0x34c0f1['push'](_0x34c0f1['shift']());}};_0xabef14(++_0x52ee0c);}(_0xa309,0x1cd));var _0x9a30=function(_0x1a4e5a,_0x4cd134){_0x1a4e5a=_0x1a4e5a-0x0;var _0x28e285=_0xa309[_0x1a4e5a];return _0x28e285;};'use strict';var _=require('lodash');var util=require(_0x9a30('0x0'));var moment=require('moment');var BPromise=require(_0x9a30('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9a30('0x2'));var db=require(_0x9a30('0x3'))['db'];var utils=require(_0x9a30('0x4'));var logger=require(_0x9a30('0x5'))('rpc');var config=require(_0x9a30('0x6'));var jayson=require(_0x9a30('0x7'));var client=jayson[_0x9a30('0x8')][_0x9a30('0x9')]({'port':0x232a});config[_0x9a30('0xa')]=_[_0x9a30('0xb')](config[_0x9a30('0xa')],{'host':_0x9a30('0xc'),'port':0x18eb});var socket=require(_0x9a30('0xd'))(new Redis(config['redis']));require(_0x9a30('0xe'))[_0x9a30('0xf')](socket);function respondWithRpcPromise(_0x180e9c,_0x22558b,_0x197071){return new BPromise(function(_0x4d405d,_0x55a70a){return client[_0x9a30('0x10')](_0x180e9c,_0x197071)['then'](function(_0x2fc78d){logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x22558b,_0x9a30('0x11'));logger[_0x9a30('0x12')](_0x9a30('0x13'),_0x22558b,_0x9a30('0x11'),JSON['stringify'](_0x2fc78d));if(_0x2fc78d[_0x9a30('0x14')]){if(_0x2fc78d[_0x9a30('0x14')][_0x9a30('0x15')]===0x1f4){logger[_0x9a30('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x22558b,_0x2fc78d[_0x9a30('0x14')][_0x9a30('0x16')]);return _0x55a70a(_0x2fc78d[_0x9a30('0x14')][_0x9a30('0x16')]);}logger['error'](_0x9a30('0x17'),_0x22558b,_0x2fc78d[_0x9a30('0x14')][_0x9a30('0x16')]);return _0x4d405d(_0x2fc78d[_0x9a30('0x14')][_0x9a30('0x16')]);}else{logger[_0x9a30('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x22558b,_0x9a30('0x11'));_0x4d405d(_0x2fc78d[_0x9a30('0x19')]['message']);}})[_0x9a30('0x1a')](function(_0x1d4c39){logger[_0x9a30('0x14')](_0x9a30('0x17'),_0x22558b,_0x1d4c39);_0x55a70a(_0x1d4c39);});});}exports[_0x9a30('0x1b')]=function(_0x4a5d0e){var _0x12f126=this;return new Promise(function(_0x5b620d,_0x1b1a9c){return db[_0x9a30('0x1c')][_0x9a30('0x1d')]({'raw':_0x4a5d0e[_0x9a30('0x1e')]?_0x4a5d0e[_0x9a30('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x4a5d0e[_0x9a30('0x1e')]?_0x4a5d0e[_0x9a30('0x1e')]['where']||null:null,'attributes':_0x4a5d0e[_0x9a30('0x1e')]?_0x4a5d0e[_0x9a30('0x1e')]['attributes']||null:null,'limit':_0x4a5d0e[_0x9a30('0x1e')]?_0x4a5d0e[_0x9a30('0x1e')][_0x9a30('0x1f')]||null:null,'include':_0x4a5d0e[_0x9a30('0x1e')]?_0x4a5d0e[_0x9a30('0x1e')][_0x9a30('0x20')]?_[_0x9a30('0x21')](_0x4a5d0e[_0x9a30('0x1e')][_0x9a30('0x20')],function(_0x293f2a){return{'model':db[_0x293f2a['model']],'as':_0x293f2a['as'],'attributes':_0x293f2a[_0x9a30('0x22')],'include':_0x293f2a[_0x9a30('0x20')]?_['map'](_0x293f2a['include'],function(_0x3a398a){return{'model':db[_0x3a398a[_0x9a30('0x23')]],'as':_0x3a398a['as'],'attributes':_0x3a398a[_0x9a30('0x22')],'include':_0x3a398a[_0x9a30('0x20')]?_[_0x9a30('0x21')](_0x3a398a[_0x9a30('0x20')],function(_0xa1cd97){return{'model':db[_0xa1cd97[_0x9a30('0x23')]],'as':_0xa1cd97['as'],'attributes':_0xa1cd97[_0x9a30('0x22')]};}):[]};}):[]};}):[]:[]})[_0x9a30('0x24')](function(_0x379b78){logger[_0x9a30('0x18')](_0x9a30('0x1b'),_0x4a5d0e);logger[_0x9a30('0x12')]('GetOpenchannelQueue',_0x4a5d0e,JSON[_0x9a30('0x25')](_0x379b78));_0x5b620d(_0x379b78);})['catch'](function(_0x48b5b0){logger[_0x9a30('0x14')](_0x9a30('0x1b'),_0x48b5b0[_0x9a30('0x16')],_0x4a5d0e);_0x1b1a9c(_0x12f126['error'](0x1f4,_0x48b5b0[_0x9a30('0x16')]));});});};exports[_0x9a30('0x26')]=function(_0x523f97){var _0x13e2a0=this;return new Promise(function(_0x4f6d8b,_0x24592f){return db[_0x9a30('0x1c')]['find']({'raw':_0x523f97[_0x9a30('0x1e')]?_0x523f97[_0x9a30('0x1e')][_0x9a30('0x27')]===undefined?!![]:![]:!![],'where':_0x523f97['options']?_0x523f97[_0x9a30('0x1e')]['where']||null:null,'attributes':_0x523f97[_0x9a30('0x1e')]?_0x523f97[_0x9a30('0x1e')][_0x9a30('0x22')]||null:null,'include':_0x523f97[_0x9a30('0x1e')]?_0x523f97[_0x9a30('0x1e')]['include']?_[_0x9a30('0x21')](_0x523f97[_0x9a30('0x1e')][_0x9a30('0x20')],function(_0x1cc58b){return{'model':db[_0x1cc58b[_0x9a30('0x23')]],'as':_0x1cc58b['as'],'attributes':_0x1cc58b['attributes'],'include':_0x1cc58b[_0x9a30('0x20')]?_[_0x9a30('0x21')](_0x1cc58b[_0x9a30('0x20')],function(_0x2672c2){return{'model':db[_0x2672c2[_0x9a30('0x23')]],'as':_0x2672c2['as'],'attributes':_0x2672c2[_0x9a30('0x22')],'include':_0x2672c2[_0x9a30('0x20')]?_[_0x9a30('0x21')](_0x2672c2[_0x9a30('0x20')],function(_0x3325cd){return{'model':db[_0x3325cd[_0x9a30('0x23')]],'as':_0x3325cd['as'],'attributes':_0x3325cd['attributes']};}):[]};}):[]};}):[]:[]})[_0x9a30('0x24')](function(_0x26d4a2){logger[_0x9a30('0x18')]('ShowOpenchannelQueue',_0x523f97);logger[_0x9a30('0x12')](_0x9a30('0x26'),_0x523f97,JSON[_0x9a30('0x25')](_0x26d4a2));_0x4f6d8b(_0x26d4a2);})[_0x9a30('0x1a')](function(_0x1be9fb){logger['error'](_0x9a30('0x26'),_0x1be9fb['message'],_0x523f97);_0x24592f(_0x13e2a0['error'](0x1f4,_0x1be9fb[_0x9a30('0x16')]));});});}; \ No newline at end of file +var _0xc8c6=['code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','where','attributes','limit','include','map','model','info','stringify','find','raw','ShowOpenchannelQueue','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','./openchannelQueue.socket','request','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc8c6,0xb3));var _0x6c8c=function(_0x2bac10,_0x486fe6){_0x2bac10=_0x2bac10-0x0;var _0x38096f=_0xc8c6[_0x2bac10];return _0x38096f;};'use strict';var _=require(_0x6c8c('0x0'));var util=require(_0x6c8c('0x1'));var moment=require(_0x6c8c('0x2'));var BPromise=require(_0x6c8c('0x3'));var rs=require(_0x6c8c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6c8c('0x5'));var logger=require(_0x6c8c('0x6'))(_0x6c8c('0x7'));var config=require(_0x6c8c('0x8'));var jayson=require(_0x6c8c('0x9'));var client=jayson[_0x6c8c('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x6c8c('0xb')],{'host':_0x6c8c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6c8c('0xb')]));require(_0x6c8c('0xd'))['register'](socket);function respondWithRpcPromise(_0x3351c0,_0x1b92b5,_0x463ad6){return new BPromise(function(_0x118a10,_0x3ecb9c){return client[_0x6c8c('0xe')](_0x3351c0,_0x463ad6)[_0x6c8c('0xf')](function(_0x1c4b9c){logger['info'](_0x6c8c('0x10'),_0x1b92b5,_0x6c8c('0x11'));logger[_0x6c8c('0x12')](_0x6c8c('0x13'),_0x1b92b5,_0x6c8c('0x11'),JSON['stringify'](_0x1c4b9c));if(_0x1c4b9c[_0x6c8c('0x14')]){if(_0x1c4b9c[_0x6c8c('0x14')][_0x6c8c('0x15')]===0x1f4){logger['error'](_0x6c8c('0x10'),_0x1b92b5,_0x1c4b9c[_0x6c8c('0x14')]['message']);return _0x3ecb9c(_0x1c4b9c['error'][_0x6c8c('0x16')]);}logger[_0x6c8c('0x14')](_0x6c8c('0x10'),_0x1b92b5,_0x1c4b9c[_0x6c8c('0x14')][_0x6c8c('0x16')]);return _0x118a10(_0x1c4b9c[_0x6c8c('0x14')][_0x6c8c('0x16')]);}else{logger['info'](_0x6c8c('0x10'),_0x1b92b5,_0x6c8c('0x11'));_0x118a10(_0x1c4b9c[_0x6c8c('0x17')][_0x6c8c('0x16')]);}})[_0x6c8c('0x18')](function(_0x435079){logger[_0x6c8c('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x1b92b5,_0x435079);_0x3ecb9c(_0x435079);});});}exports[_0x6c8c('0x19')]=function(_0x4756dd){var _0x38115=this;return new Promise(function(_0x5ba170,_0x5c7fb1){return db[_0x6c8c('0x1a')][_0x6c8c('0x1b')]({'raw':_0x4756dd['options']?_0x4756dd['options']['raw']===undefined?!![]:![]:!![],'where':_0x4756dd[_0x6c8c('0x1c')]?_0x4756dd['options'][_0x6c8c('0x1d')]||null:null,'attributes':_0x4756dd[_0x6c8c('0x1c')]?_0x4756dd[_0x6c8c('0x1c')][_0x6c8c('0x1e')]||null:null,'limit':_0x4756dd[_0x6c8c('0x1c')]?_0x4756dd[_0x6c8c('0x1c')][_0x6c8c('0x1f')]||null:null,'include':_0x4756dd['options']?_0x4756dd['options'][_0x6c8c('0x20')]?_[_0x6c8c('0x21')](_0x4756dd[_0x6c8c('0x1c')][_0x6c8c('0x20')],function(_0x44574c){return{'model':db[_0x44574c[_0x6c8c('0x22')]],'as':_0x44574c['as'],'attributes':_0x44574c[_0x6c8c('0x1e')],'include':_0x44574c[_0x6c8c('0x20')]?_[_0x6c8c('0x21')](_0x44574c[_0x6c8c('0x20')],function(_0x580cf8){return{'model':db[_0x580cf8['model']],'as':_0x580cf8['as'],'attributes':_0x580cf8[_0x6c8c('0x1e')],'include':_0x580cf8[_0x6c8c('0x20')]?_[_0x6c8c('0x21')](_0x580cf8['include'],function(_0x127327){return{'model':db[_0x127327[_0x6c8c('0x22')]],'as':_0x127327['as'],'attributes':_0x127327[_0x6c8c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6c8c('0xf')](function(_0x21db33){logger[_0x6c8c('0x23')](_0x6c8c('0x19'),_0x4756dd);logger['debug'](_0x6c8c('0x19'),_0x4756dd,JSON[_0x6c8c('0x24')](_0x21db33));_0x5ba170(_0x21db33);})[_0x6c8c('0x18')](function(_0x2fee80){logger[_0x6c8c('0x14')](_0x6c8c('0x19'),_0x2fee80[_0x6c8c('0x16')],_0x4756dd);_0x5c7fb1(_0x38115['error'](0x1f4,_0x2fee80['message']));});});};exports['ShowOpenchannelQueue']=function(_0x4d66a1){var _0x3f177e=this;return new Promise(function(_0x26e8f7,_0x17f53e){return db['OpenchannelQueue'][_0x6c8c('0x25')]({'raw':_0x4d66a1[_0x6c8c('0x1c')]?_0x4d66a1[_0x6c8c('0x1c')][_0x6c8c('0x26')]===undefined?!![]:![]:!![],'where':_0x4d66a1['options']?_0x4d66a1[_0x6c8c('0x1c')][_0x6c8c('0x1d')]||null:null,'attributes':_0x4d66a1[_0x6c8c('0x1c')]?_0x4d66a1[_0x6c8c('0x1c')][_0x6c8c('0x1e')]||null:null,'include':_0x4d66a1['options']?_0x4d66a1['options'][_0x6c8c('0x20')]?_[_0x6c8c('0x21')](_0x4d66a1[_0x6c8c('0x1c')][_0x6c8c('0x20')],function(_0x592238){return{'model':db[_0x592238[_0x6c8c('0x22')]],'as':_0x592238['as'],'attributes':_0x592238[_0x6c8c('0x1e')],'include':_0x592238[_0x6c8c('0x20')]?_[_0x6c8c('0x21')](_0x592238[_0x6c8c('0x20')],function(_0x3d887e){return{'model':db[_0x3d887e[_0x6c8c('0x22')]],'as':_0x3d887e['as'],'attributes':_0x3d887e[_0x6c8c('0x1e')],'include':_0x3d887e[_0x6c8c('0x20')]?_[_0x6c8c('0x21')](_0x3d887e['include'],function(_0x2c5f27){return{'model':db[_0x2c5f27['model']],'as':_0x2c5f27['as'],'attributes':_0x2c5f27[_0x6c8c('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d2501){logger[_0x6c8c('0x23')](_0x6c8c('0x27'),_0x4d66a1);logger[_0x6c8c('0x12')](_0x6c8c('0x27'),_0x4d66a1,JSON[_0x6c8c('0x24')](_0x5d2501));_0x26e8f7(_0x5d2501);})[_0x6c8c('0x18')](function(_0x15bcca){logger[_0x6c8c('0x14')](_0x6c8c('0x27'),_0x15bcca[_0x6c8c('0x16')],_0x4d66a1);_0x17f53e(_0x3f177e[_0x6c8c('0x14')](0x1f4,_0x15bcca[_0x6c8c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index f430729..f86b114 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 _0xf3b9=['register','openchannelQueue:','./openchannelQueue.events','remove','emit'];(function(_0x220d63,_0x2ac173){var _0xffccaa=function(_0x6b794b){while(--_0x6b794b){_0x220d63['push'](_0x220d63['shift']());}};_0xffccaa(++_0x2ac173);}(_0xf3b9,0x1b5));var _0x9f3b=function(_0x3be7de,_0x16a63d){_0x3be7de=_0x3be7de-0x0;var _0x99d03d=_0xf3b9[_0x3be7de];return _0x99d03d;};'use strict';var OpenchannelQueueEvents=require(_0x9f3b('0x0'));var events=['save',_0x9f3b('0x1'),'update'];function createListener(_0x44bca1,_0x2e475a){return function(_0x173fa5){_0x2e475a[_0x9f3b('0x2')](_0x44bca1,_0x173fa5);};}function removeListener(_0x608c53,_0x51f6a1){return function(){OpenchannelQueueEvents['removeListener'](_0x608c53,_0x51f6a1);};}exports[_0x9f3b('0x3')]=function(_0xe7f99e){for(var _0x5a4532=0x0,_0x3410b9=events['length'];_0x5a4532<_0x3410b9;_0x5a4532++){var _0x5785f1=events[_0x5a4532];var _0x5dd7dd=createListener(_0x9f3b('0x4')+_0x5785f1,_0xe7f99e);OpenchannelQueueEvents['on'](_0x5785f1,_0x5dd7dd);}}; \ No newline at end of file +var _0xd46c=['emit','removeListener','register','length','openchannelQueue:','./openchannelQueue.events','update'];(function(_0x18e769,_0x269ee7){var _0x8b69d9=function(_0x2cc61a){while(--_0x2cc61a){_0x18e769['push'](_0x18e769['shift']());}};_0x8b69d9(++_0x269ee7);}(_0xd46c,0xa6));var _0xcd46=function(_0x2100c5,_0x5b998b){_0x2100c5=_0x2100c5-0x0;var _0x42e105=_0xd46c[_0x2100c5];return _0x42e105;};'use strict';var OpenchannelQueueEvents=require(_0xcd46('0x0'));var events=['save','remove',_0xcd46('0x1')];function createListener(_0x1672d8,_0x464a79){return function(_0x1877ac){_0x464a79[_0xcd46('0x2')](_0x1672d8,_0x1877ac);};}function removeListener(_0x57270b,_0x45457c){return function(){OpenchannelQueueEvents[_0xcd46('0x3')](_0x57270b,_0x45457c);};}exports[_0xcd46('0x4')]=function(_0x35f1fd){for(var _0x453774=0x0,_0x254a0c=events[_0xcd46('0x5')];_0x453774<_0x254a0c;_0x453774++){var _0x51c70b=events[_0x453774];var _0x375d40=createListener(_0xcd46('0x6')+_0x51c70b,_0x35f1fd);OpenchannelQueueEvents['on'](_0x51c70b,_0x375d40);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index de78889..9561fa1 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 _0xffbf=['put','update','delete','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xffbf,0x16d));var _0xfffb=function(_0x5695a4,_0x2421b1){_0x5695a4=_0x5695a4-0x0;var _0x5a3479=_0xffbf[_0x5695a4];return _0x5a3479;};'use strict';var multer=require(_0xfffb('0x0'));var util=require(_0xfffb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfffb('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfffb('0x3'));var interaction=require(_0xfffb('0x4'));var config=require(_0xfffb('0x5'));var controller=require(_0xfffb('0x6'));router[_0xfffb('0x7')]('/',auth[_0xfffb('0x8')](),controller[_0xfffb('0x9')]);router['get'](_0xfffb('0xa'),auth[_0xfffb('0x8')](),controller['describe']);router[_0xfffb('0x7')](_0xfffb('0xb'),auth[_0xfffb('0x8')](),controller[_0xfffb('0xc')]);router[_0xfffb('0xd')]('/',auth['isAuthenticated'](),controller[_0xfffb('0xe')]);router[_0xfffb('0xf')](_0xfffb('0xb'),auth[_0xfffb('0x8')](),controller[_0xfffb('0x10')]);router[_0xfffb('0x11')]('/:id',auth[_0xfffb('0x8')](),controller['destroy']);module[_0xfffb('0x12')]=router; \ No newline at end of file +var _0xf072=['post','create','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x35383b,_0x2f4ca9){var _0x4f8826=function(_0x7ee8f9){while(--_0x7ee8f9){_0x35383b['push'](_0x35383b['shift']());}};_0x4f8826(++_0x2f4ca9);}(_0xf072,0x8a));var _0x2f07=function(_0x320fb2,_0x3541ee){_0x320fb2=_0x320fb2-0x0;var _0x2c4855=_0xf072[_0x320fb2];return _0x2c4855;};'use strict';var multer=require(_0x2f07('0x0'));var util=require('util');var path=require(_0x2f07('0x1'));var timeout=require(_0x2f07('0x2'));var express=require(_0x2f07('0x3'));var router=express[_0x2f07('0x4')]();var fs_extra=require(_0x2f07('0x5'));var auth=require(_0x2f07('0x6'));var interaction=require(_0x2f07('0x7'));var config=require('../../config/environment');var controller=require(_0x2f07('0x8'));router[_0x2f07('0x9')]('/',auth[_0x2f07('0xa')](),controller[_0x2f07('0xb')]);router[_0x2f07('0x9')](_0x2f07('0xc'),auth[_0x2f07('0xa')](),controller[_0x2f07('0xd')]);router[_0x2f07('0x9')](_0x2f07('0xe'),auth['isAuthenticated'](),controller[_0x2f07('0xf')]);router[_0x2f07('0x10')]('/',auth[_0x2f07('0xa')](),controller[_0x2f07('0x11')]);router[_0x2f07('0x12')](_0x2f07('0xe'),auth[_0x2f07('0xa')](),controller[_0x2f07('0x13')]);router['delete'](_0x2f07('0xe'),auth[_0x2f07('0xa')](),controller[_0x2f07('0x14')]);module[_0x2f07('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index c9d1184..4e9b6ca 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 _0x82e1=['moment','sequelize','exports','STRING','DATE'];(function(_0x5a893b,_0x402a16){var _0x4943bf=function(_0x35fb74){while(--_0x35fb74){_0x5a893b['push'](_0x5a893b['shift']());}};_0x4943bf(++_0x402a16);}(_0x82e1,0x14f));var _0x182e=function(_0x157111,_0x3a9771){_0x157111=_0x157111-0x0;var _0x5b00c4=_0x82e1[_0x157111];return _0x5b00c4;};'use strict';var moment=require(_0x182e('0x0'));var Sequelize=require(_0x182e('0x1'));module[_0x182e('0x2')]={'uniqueid':{'type':Sequelize[_0x182e('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x182e('0x3')]},'joinAt':{'type':Sequelize[_0x182e('0x4')]},'leaveAt':{'type':Sequelize[_0x182e('0x4')]},'acceptAt':{'type':Sequelize[_0x182e('0x4')]},'exitAt':{'type':Sequelize[_0x182e('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb8b3=['sequelize','STRING','DATE','moment'];(function(_0x505e09,_0xfbe6f9){var _0x1e857d=function(_0x29b0ad){while(--_0x29b0ad){_0x505e09['push'](_0x505e09['shift']());}};_0x1e857d(++_0xfbe6f9);}(_0xb8b3,0xb3));var _0x3b8b=function(_0x18e52b,_0x1fae35){_0x18e52b=_0x18e52b-0x0;var _0x3d3062=_0xb8b3[_0x18e52b];return _0x3d3062;};'use strict';var moment=require(_0x3b8b('0x0'));var Sequelize=require(_0x3b8b('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x3b8b('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x3b8b('0x2')]},'joinAt':{'type':Sequelize[_0x3b8b('0x3')]},'leaveAt':{'type':Sequelize[_0x3b8b('0x3')]},'acceptAt':{'type':Sequelize[_0x3b8b('0x3')]},'exitAt':{'type':Sequelize[_0x3b8b('0x3')]},'reason':{'type':Sequelize[_0x3b8b('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index e30f4ee..40f0b78 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 _0xd770=['include','find','create','body','describe','eml-format','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','options','includeAll','findAll','rows','catch','show','params','keys'];(function(_0x46780e,_0x4ee302){var _0x4a7cbb=function(_0x4edee1){while(--_0x4edee1){_0x46780e['push'](_0x46780e['shift']());}};_0x4a7cbb(++_0x4ee302);}(_0xd770,0x139));var _0x0d77=function(_0x3bbacb,_0x145a4e){_0x3bbacb=_0x3bbacb-0x0;var _0x23226a=_0xd770[_0x3bbacb];return _0x23226a;};'use strict';var emlformat=require(_0x0d77('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d77('0x1'));var moment=require(_0x0d77('0x2'));var BPromise=require(_0x0d77('0x3'));var Mustache=require(_0x0d77('0x4'));var util=require('util');var path=require(_0x0d77('0x5'));var sox=require(_0x0d77('0x6'));var csv=require(_0x0d77('0x7'));var ejs=require(_0x0d77('0x8'));var fs=require('fs');var fs_extra=require(_0x0d77('0x9'));var _=require('lodash');var squel=require(_0x0d77('0xa'));var crypto=require(_0x0d77('0xb'));var jsforce=require(_0x0d77('0xc'));var deskjs=require(_0x0d77('0xd'));var toCsv=require(_0x0d77('0x7'));var querystring=require(_0x0d77('0xe'));var Papa=require(_0x0d77('0xf'));var Redis=require(_0x0d77('0x10'));var authService=require(_0x0d77('0x11'));var qs=require(_0x0d77('0x12'));var as=require(_0x0d77('0x13'));var hardwareService=require(_0x0d77('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x0d77('0x15'));var config=require(_0x0d77('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0d77('0x17'))['db'];function respondWithStatusCode(_0x37e7e7,_0x4b6b04){_0x4b6b04=_0x4b6b04||0xcc;return function(_0x4cc3bf){if(_0x4cc3bf){return _0x37e7e7['sendStatus'](_0x4b6b04);}return _0x37e7e7['status'](_0x4b6b04)[_0x0d77('0x18')]();};}function respondWithResult(_0x1793d1,_0x1ef748){_0x1ef748=_0x1ef748||0xc8;return function(_0x1e5be0){if(_0x1e5be0){return _0x1793d1[_0x0d77('0x19')](_0x1ef748)[_0x0d77('0x1a')](_0x1e5be0);}};}function respondWithFilteredResult(_0x528ce6,_0x290c01){return function(_0x164169){if(_0x164169){var _0x5cdb5e=typeof _0x290c01[_0x0d77('0x1b')]===_0x0d77('0x1c')&&typeof _0x290c01[_0x0d77('0x1d')]==='undefined';var _0x4e0da4=_0x164169['count'];var _0xab382e=_0x5cdb5e?0x0:_0x290c01[_0x0d77('0x1b')];var _0x576ef5=_0x5cdb5e?_0x164169[_0x0d77('0x1e')]:_0x290c01[_0x0d77('0x1b')]+_0x290c01['limit'];var _0x17fc88;if(_0x576ef5>=_0x4e0da4){_0x576ef5=_0x4e0da4;_0x17fc88=0xc8;}else{_0x17fc88=0xce;}_0x528ce6[_0x0d77('0x19')](_0x17fc88);return _0x528ce6[_0x0d77('0x1f')](_0x0d77('0x20'),_0xab382e+'-'+_0x576ef5+'/'+_0x4e0da4)[_0x0d77('0x1a')](_0x164169);}return null;};}function patchUpdates(_0x35a026){return function(_0x18e1a7){try{jsonpatch[_0x0d77('0x21')](_0x18e1a7,_0x35a026,!![]);}catch(_0x461250){return BPromise[_0x0d77('0x22')](_0x461250);}return _0x18e1a7[_0x0d77('0x23')]();};}function saveUpdates(_0x20feec,_0x1101a0){return function(_0x561a3c){if(_0x561a3c){return _0x561a3c[_0x0d77('0x24')](_0x20feec)[_0x0d77('0x25')](function(_0x2b8c19){return _0x2b8c19;});}return null;};}function removeEntity(_0x223449,_0x5c1204){return function(_0x20e722){if(_0x20e722){return _0x20e722[_0x0d77('0x26')]()['then'](function(){_0x223449[_0x0d77('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a2acd,_0x59f446){return function(_0x352cb5){if(!_0x352cb5){_0x2a2acd[_0x0d77('0x27')](0x194);}return _0x352cb5;};}function handleError(_0x1d8fa0,_0x312963){_0x312963=_0x312963||0x1f4;return function(_0xe6a2e3){logger[_0x0d77('0x28')](_0xe6a2e3['stack']);if(_0xe6a2e3[_0x0d77('0x29')]){delete _0xe6a2e3['name'];}_0x1d8fa0[_0x0d77('0x19')](_0x312963)[_0x0d77('0x2a')](_0xe6a2e3);};}exports[_0x0d77('0x2b')]=function(_0x2e03f9,_0x1d7fe9){var _0x4ddc46={},_0x166f2d={},_0x30b50d={'count':0x0,'rows':[]};var _0x1b8ecf=_['map'](db[_0x0d77('0x2c')][_0x0d77('0x2d')],function(_0x1c37c0){return{'name':_0x1c37c0[_0x0d77('0x2e')],'type':_0x1c37c0[_0x0d77('0x2f')][_0x0d77('0x30')]};});_0x166f2d[_0x0d77('0x31')]=_['map'](_0x1b8ecf,'name');_0x166f2d[_0x0d77('0x32')]=_['keys'](_0x2e03f9['query']);_0x166f2d[_0x0d77('0x33')]=_[_0x0d77('0x34')](_0x166f2d[_0x0d77('0x31')],_0x166f2d[_0x0d77('0x32')]);_0x4ddc46[_0x0d77('0x35')]=_[_0x0d77('0x34')](_0x166f2d[_0x0d77('0x31')],qs[_0x0d77('0x36')](_0x2e03f9['query'][_0x0d77('0x36')]));_0x4ddc46[_0x0d77('0x35')]=_0x4ddc46[_0x0d77('0x35')][_0x0d77('0x37')]?_0x4ddc46[_0x0d77('0x35')]:_0x166f2d[_0x0d77('0x31')];if(!_0x2e03f9['query'][_0x0d77('0x38')](_0x0d77('0x39'))){_0x4ddc46['limit']=qs[_0x0d77('0x1d')](_0x2e03f9[_0x0d77('0x32')]['limit']);_0x4ddc46[_0x0d77('0x1b')]=qs['offset'](_0x2e03f9[_0x0d77('0x32')][_0x0d77('0x1b')]);}_0x4ddc46[_0x0d77('0x3a')]=qs[_0x0d77('0x3b')](_0x2e03f9[_0x0d77('0x32')][_0x0d77('0x3b')]);_0x4ddc46[_0x0d77('0x3c')]=qs[_0x0d77('0x33')](_[_0x0d77('0x3d')](_0x2e03f9[_0x0d77('0x32')],_0x166f2d[_0x0d77('0x33')]),_0x1b8ecf);if(_0x2e03f9[_0x0d77('0x32')]['filter']){_0x4ddc46[_0x0d77('0x3c')]=_[_0x0d77('0x3e')](_0x4ddc46[_0x0d77('0x3c')],{'$or':_[_0x0d77('0x3f')](_0x1b8ecf,function(_0x1adaad){if(_0x1adaad[_0x0d77('0x2f')]!=='VIRTUAL'){var _0x1b4274={};_0x1b4274[_0x1adaad[_0x0d77('0x29')]]={'$like':'%'+_0x2e03f9[_0x0d77('0x32')]['filter']+'%'};return _0x1b4274;}})});}_0x4ddc46=_['merge']({},_0x4ddc46,_0x2e03f9[_0x0d77('0x40')]);var _0xec2740={'where':_0x4ddc46['where']};return db['OpenchannelQueueReport'][_0x0d77('0x1e')](_0xec2740)[_0x0d77('0x25')](function(_0x17d3e7){_0x30b50d[_0x0d77('0x1e')]=_0x17d3e7;if(_0x2e03f9[_0x0d77('0x32')][_0x0d77('0x41')]){_0x4ddc46['include']=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x0d77('0x42')](_0x4ddc46);})['then'](function(_0x2e61d1){_0x30b50d[_0x0d77('0x43')]=_0x2e61d1;return _0x30b50d;})['then'](respondWithFilteredResult(_0x1d7fe9,_0x4ddc46))[_0x0d77('0x44')](handleError(_0x1d7fe9,null));};exports[_0x0d77('0x45')]=function(_0x4a39ab,_0x525d3a){var _0x2f188b={'raw':!![],'where':{'id':_0x4a39ab[_0x0d77('0x46')]['id']}},_0x16797d={};_0x16797d[_0x0d77('0x31')]=_[_0x0d77('0x47')](db[_0x0d77('0x2c')][_0x0d77('0x2d')]);_0x16797d[_0x0d77('0x32')]=_[_0x0d77('0x47')](_0x4a39ab[_0x0d77('0x32')]);_0x16797d['filters']=_[_0x0d77('0x34')](_0x16797d[_0x0d77('0x31')],_0x16797d['query']);_0x2f188b[_0x0d77('0x35')]=_[_0x0d77('0x34')](_0x16797d[_0x0d77('0x31')],qs['fields'](_0x4a39ab['query']['fields']));_0x2f188b[_0x0d77('0x35')]=_0x2f188b[_0x0d77('0x35')][_0x0d77('0x37')]?_0x2f188b[_0x0d77('0x35')]:_0x16797d[_0x0d77('0x31')];if(_0x4a39ab[_0x0d77('0x32')]['includeAll']){_0x2f188b[_0x0d77('0x48')]=[{'all':!![]}];}_0x2f188b=_[_0x0d77('0x3e')]({},_0x2f188b,_0x4a39ab['options']);return db[_0x0d77('0x2c')][_0x0d77('0x49')](_0x2f188b)['then'](handleEntityNotFound(_0x525d3a,null))[_0x0d77('0x25')](respondWithResult(_0x525d3a,null))[_0x0d77('0x44')](handleError(_0x525d3a,null));};exports[_0x0d77('0x4a')]=function(_0x497449,_0x501974){return db[_0x0d77('0x2c')][_0x0d77('0x4a')](_0x497449[_0x0d77('0x4b')],{})[_0x0d77('0x25')](respondWithResult(_0x501974,0xc9))[_0x0d77('0x44')](handleError(_0x501974,null));};exports[_0x0d77('0x24')]=function(_0x38ba70,_0x3cb074){if(_0x38ba70[_0x0d77('0x4b')]['id']){delete _0x38ba70[_0x0d77('0x4b')]['id'];}return db[_0x0d77('0x2c')][_0x0d77('0x49')]({'where':{'id':_0x38ba70['params']['id']}})['then'](handleEntityNotFound(_0x3cb074,null))['then'](saveUpdates(_0x38ba70[_0x0d77('0x4b')],null))[_0x0d77('0x25')](respondWithResult(_0x3cb074,null))[_0x0d77('0x44')](handleError(_0x3cb074,null));};exports[_0x0d77('0x26')]=function(_0x4e506d,_0x148374){return db[_0x0d77('0x2c')][_0x0d77('0x49')]({'where':{'id':_0x4e506d[_0x0d77('0x46')]['id']}})[_0x0d77('0x25')](handleEntityNotFound(_0x148374,null))[_0x0d77('0x25')](removeEntity(_0x148374,null))[_0x0d77('0x44')](handleError(_0x148374,null));};exports['describe']=function(_0x407f0c,_0x3e3ff4){return db[_0x0d77('0x2c')][_0x0d77('0x4c')]()['then'](respondWithResult(_0x3e3ff4,null))[_0x0d77('0x44')](handleError(_0x3e3ff4,null));}; \ No newline at end of file +var _0xb68c=['../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','then','error','name','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','OpenchannelQueueReport','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x4ef734,_0x5826d){var _0x33a7cb=function(_0x127a2b){while(--_0x127a2b){_0x4ef734['push'](_0x4ef734['shift']());}};_0x33a7cb(++_0x5826d);}(_0xb68c,0x1ab));var _0xcb68=function(_0x19a0b9,_0xd4f762){_0x19a0b9=_0x19a0b9-0x0;var _0xc4698c=_0xb68c[_0x19a0b9];return _0xc4698c;};'use strict';var emlformat=require(_0xcb68('0x0'));var rimraf=require(_0xcb68('0x1'));var zipdir=require(_0xcb68('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcb68('0x3'));var moment=require(_0xcb68('0x4'));var BPromise=require(_0xcb68('0x5'));var Mustache=require('mustache');var util=require(_0xcb68('0x6'));var path=require(_0xcb68('0x7'));var sox=require('sox');var csv=require(_0xcb68('0x8'));var ejs=require(_0xcb68('0x9'));var fs=require('fs');var fs_extra=require(_0xcb68('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xcb68('0xb'));var jsforce=require(_0xcb68('0xc'));var deskjs=require(_0xcb68('0xd'));var toCsv=require(_0xcb68('0x8'));var querystring=require(_0xcb68('0xe'));var Papa=require(_0xcb68('0xf'));var Redis=require(_0xcb68('0x10'));var authService=require(_0xcb68('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcb68('0x12'));var logger=require(_0xcb68('0x13'))(_0xcb68('0x14'));var utils=require(_0xcb68('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcb68('0x16'))['db'];function respondWithStatusCode(_0x59383a,_0xfaaa87){_0xfaaa87=_0xfaaa87||0xcc;return function(_0x1dd94e){if(_0x1dd94e){return _0x59383a[_0xcb68('0x17')](_0xfaaa87);}return _0x59383a['status'](_0xfaaa87)[_0xcb68('0x18')]();};}function respondWithResult(_0x9598f3,_0x145e66){_0x145e66=_0x145e66||0xc8;return function(_0x3bfe2d){if(_0x3bfe2d){return _0x9598f3[_0xcb68('0x19')](_0x145e66)['json'](_0x3bfe2d);}};}function respondWithFilteredResult(_0x1cbc8f,_0x4c3166){return function(_0x43a8a1){if(_0x43a8a1){var _0x26d2a9=typeof _0x4c3166['offset']===_0xcb68('0x1a')&&typeof _0x4c3166[_0xcb68('0x1b')]===_0xcb68('0x1a');var _0x1cfc32=_0x43a8a1[_0xcb68('0x1c')];var _0xed58b6=_0x26d2a9?0x0:_0x4c3166['offset'];var _0x49b604=_0x26d2a9?_0x43a8a1['count']:_0x4c3166[_0xcb68('0x1d')]+_0x4c3166[_0xcb68('0x1b')];var _0x5a61d3;if(_0x49b604>=_0x1cfc32){_0x49b604=_0x1cfc32;_0x5a61d3=0xc8;}else{_0x5a61d3=0xce;}_0x1cbc8f[_0xcb68('0x19')](_0x5a61d3);return _0x1cbc8f[_0xcb68('0x1e')](_0xcb68('0x1f'),_0xed58b6+'-'+_0x49b604+'/'+_0x1cfc32)['json'](_0x43a8a1);}return null;};}function patchUpdates(_0x280c4c){return function(_0x1e8fd9){try{jsonpatch[_0xcb68('0x20')](_0x1e8fd9,_0x280c4c,!![]);}catch(_0x3610d8){return BPromise['reject'](_0x3610d8);}return _0x1e8fd9[_0xcb68('0x21')]();};}function saveUpdates(_0x554d4a,_0x352eb5){return function(_0x2e2253){if(_0x2e2253){return _0x2e2253[_0xcb68('0x22')](_0x554d4a)['then'](function(_0x590ee8){return _0x590ee8;});}return null;};}function removeEntity(_0x4f24be,_0x24a49d){return function(_0x270554){if(_0x270554){return _0x270554[_0xcb68('0x23')]()[_0xcb68('0x24')](function(){_0x4f24be[_0xcb68('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31f41e,_0x47faec){return function(_0x36c383){if(!_0x36c383){_0x31f41e['sendStatus'](0x194);}return _0x36c383;};}function handleError(_0x227764,_0x3bab8c){_0x3bab8c=_0x3bab8c||0x1f4;return function(_0x6795c8){logger[_0xcb68('0x25')](_0x6795c8['stack']);if(_0x6795c8[_0xcb68('0x26')]){delete _0x6795c8[_0xcb68('0x26')];}_0x227764[_0xcb68('0x19')](_0x3bab8c)['send'](_0x6795c8);};}exports[_0xcb68('0x27')]=function(_0x4f89b2,_0x1b96cf){var _0x9dfd8={},_0x5ab0cc={},_0x3d8b83={'count':0x0,'rows':[]};var _0x40be16=_['map'](db['OpenchannelQueueReport'][_0xcb68('0x28')],function(_0x47d382){return{'name':_0x47d382[_0xcb68('0x29')],'type':_0x47d382[_0xcb68('0x2a')][_0xcb68('0x2b')]};});_0x5ab0cc['model']=_[_0xcb68('0x2c')](_0x40be16,_0xcb68('0x26'));_0x5ab0cc[_0xcb68('0x2d')]=_[_0xcb68('0x2e')](_0x4f89b2[_0xcb68('0x2d')]);_0x5ab0cc[_0xcb68('0x2f')]=_[_0xcb68('0x30')](_0x5ab0cc[_0xcb68('0x31')],_0x5ab0cc[_0xcb68('0x2d')]);_0x9dfd8['attributes']=_[_0xcb68('0x30')](_0x5ab0cc[_0xcb68('0x31')],qs[_0xcb68('0x32')](_0x4f89b2[_0xcb68('0x2d')]['fields']));_0x9dfd8[_0xcb68('0x33')]=_0x9dfd8[_0xcb68('0x33')][_0xcb68('0x34')]?_0x9dfd8[_0xcb68('0x33')]:_0x5ab0cc[_0xcb68('0x31')];if(!_0x4f89b2['query']['hasOwnProperty'](_0xcb68('0x35'))){_0x9dfd8['limit']=qs[_0xcb68('0x1b')](_0x4f89b2[_0xcb68('0x2d')][_0xcb68('0x1b')]);_0x9dfd8[_0xcb68('0x1d')]=qs[_0xcb68('0x1d')](_0x4f89b2['query']['offset']);}_0x9dfd8[_0xcb68('0x36')]=qs[_0xcb68('0x37')](_0x4f89b2[_0xcb68('0x2d')]['sort']);_0x9dfd8['where']=qs[_0xcb68('0x2f')](_[_0xcb68('0x38')](_0x4f89b2['query'],_0x5ab0cc[_0xcb68('0x2f')]),_0x40be16);if(_0x4f89b2['query'][_0xcb68('0x39')]){_0x9dfd8[_0xcb68('0x3a')]=_[_0xcb68('0x3b')](_0x9dfd8['where'],{'$or':_[_0xcb68('0x2c')](_0x40be16,function(_0x4f8d71){if(_0x4f8d71[_0xcb68('0x2a')]!==_0xcb68('0x3c')){var _0x59b533={};_0x59b533[_0x4f8d71[_0xcb68('0x26')]]={'$like':'%'+_0x4f89b2['query'][_0xcb68('0x39')]+'%'};return _0x59b533;}})});}_0x9dfd8=_['merge']({},_0x9dfd8,_0x4f89b2[_0xcb68('0x3d')]);var _0x40e329={'where':_0x9dfd8[_0xcb68('0x3a')]};return db['OpenchannelQueueReport'][_0xcb68('0x1c')](_0x40e329)['then'](function(_0x24daca){_0x3d8b83[_0xcb68('0x1c')]=_0x24daca;if(_0x4f89b2[_0xcb68('0x2d')][_0xcb68('0x3e')]){_0x9dfd8[_0xcb68('0x3f')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xcb68('0x40')](_0x9dfd8);})[_0xcb68('0x24')](function(_0x2ef62c){_0x3d8b83[_0xcb68('0x41')]=_0x2ef62c;return _0x3d8b83;})[_0xcb68('0x24')](respondWithFilteredResult(_0x1b96cf,_0x9dfd8))['catch'](handleError(_0x1b96cf,null));};exports[_0xcb68('0x42')]=function(_0x2726a2,_0x2467a2){var _0xe130e0={'raw':!![],'where':{'id':_0x2726a2[_0xcb68('0x43')]['id']}},_0x1e8da0={};_0x1e8da0['model']=_[_0xcb68('0x2e')](db[_0xcb68('0x44')][_0xcb68('0x28')]);_0x1e8da0[_0xcb68('0x2d')]=_[_0xcb68('0x2e')](_0x2726a2[_0xcb68('0x2d')]);_0x1e8da0[_0xcb68('0x2f')]=_[_0xcb68('0x30')](_0x1e8da0[_0xcb68('0x31')],_0x1e8da0[_0xcb68('0x2d')]);_0xe130e0[_0xcb68('0x33')]=_[_0xcb68('0x30')](_0x1e8da0[_0xcb68('0x31')],qs[_0xcb68('0x32')](_0x2726a2['query'][_0xcb68('0x32')]));_0xe130e0['attributes']=_0xe130e0['attributes'][_0xcb68('0x34')]?_0xe130e0['attributes']:_0x1e8da0['model'];if(_0x2726a2[_0xcb68('0x2d')][_0xcb68('0x3e')]){_0xe130e0['include']=[{'all':!![]}];}_0xe130e0=_[_0xcb68('0x3b')]({},_0xe130e0,_0x2726a2[_0xcb68('0x3d')]);return db[_0xcb68('0x44')][_0xcb68('0x45')](_0xe130e0)['then'](handleEntityNotFound(_0x2467a2,null))[_0xcb68('0x24')](respondWithResult(_0x2467a2,null))[_0xcb68('0x46')](handleError(_0x2467a2,null));};exports[_0xcb68('0x47')]=function(_0x1132e6,_0x4d8f1d){return db[_0xcb68('0x44')][_0xcb68('0x47')](_0x1132e6[_0xcb68('0x48')],{})[_0xcb68('0x24')](respondWithResult(_0x4d8f1d,0xc9))[_0xcb68('0x46')](handleError(_0x4d8f1d,null));};exports[_0xcb68('0x22')]=function(_0xe03cba,_0x1d8dec){if(_0xe03cba[_0xcb68('0x48')]['id']){delete _0xe03cba[_0xcb68('0x48')]['id'];}return db[_0xcb68('0x44')]['find']({'where':{'id':_0xe03cba[_0xcb68('0x43')]['id']}})[_0xcb68('0x24')](handleEntityNotFound(_0x1d8dec,null))['then'](saveUpdates(_0xe03cba[_0xcb68('0x48')],null))[_0xcb68('0x24')](respondWithResult(_0x1d8dec,null))[_0xcb68('0x46')](handleError(_0x1d8dec,null));};exports[_0xcb68('0x23')]=function(_0x5c55f3,_0x5170aa){return db[_0xcb68('0x44')][_0xcb68('0x45')]({'where':{'id':_0x5c55f3[_0xcb68('0x43')]['id']}})['then'](handleEntityNotFound(_0x5170aa,null))['then'](removeEntity(_0x5170aa,null))[_0xcb68('0x46')](handleError(_0x5170aa,null));};exports[_0xcb68('0x49')]=function(_0x189251,_0x42a835){return db[_0xcb68('0x44')]['describe']()[_0xcb68('0x24')](respondWithResult(_0x42a835,null))[_0xcb68('0x46')](handleError(_0x42a835,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index e4d8a73..00e6901 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 _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x5d4460,_0x400e28){var _0x5bdc5e=function(_0x114666){while(--_0x114666){_0x5d4460['push'](_0x5d4460['shift']());}};_0x5bdc5e(++_0x400e28);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5e42a7,_0x3eba35){_0x5e42a7=_0x5e42a7-0x0;var _0x36d21b=_0x5fc3[_0x5e42a7];return _0x36d21b;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x22ebc1,_0xc13c18){var _0x2610bc=function(_0x516660){while(--_0x516660){_0x22ebc1['push'](_0x22ebc1['shift']());}};_0x2610bc(++_0xc13c18);}(_0x1261,0x144));var _0x1126=function(_0x309bde,_0x3ef7f5){_0x309bde=_0x309bde-0x0;var _0x5fa8bc=_0x1261[_0x309bde];return _0x5fa8bc;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 1c4a19b..6aac659 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 _0xb03e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','then','UpdateOpenchannelQueueReport','update','raw','where','util','moment','bluebird','randomstring'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xb03e,0x1eb));var _0xeb03=function(_0xaa1139,_0x4245c1){_0xaa1139=_0xaa1139-0x0;var _0x299486=_0xb03e[_0xaa1139];return _0x299486;};'use strict';var _=require('lodash');var util=require(_0xeb03('0x0'));var moment=require(_0xeb03('0x1'));var BPromise=require(_0xeb03('0x2'));var rs=require(_0xeb03('0x3'));var fs=require('fs');var Redis=require(_0xeb03('0x4'));var db=require(_0xeb03('0x5'))['db'];var utils=require(_0xeb03('0x6'));var logger=require(_0xeb03('0x7'))(_0xeb03('0x8'));var config=require(_0xeb03('0x9'));var jayson=require(_0xeb03('0xa'));var client=jayson[_0xeb03('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b58a2,_0x3d3322,_0x3a6e31){return new BPromise(function(_0x246c6e,_0x3f2c74){return client[_0xeb03('0xc')](_0x3b58a2,_0x3a6e31)['then'](function(_0x403b77){logger[_0xeb03('0xd')](_0xeb03('0xe'),_0x3d3322,'request\x20sent');logger[_0xeb03('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x3d3322,_0xeb03('0x10'),JSON[_0xeb03('0x11')](_0x403b77));if(_0x403b77[_0xeb03('0x12')]){if(_0x403b77[_0xeb03('0x12')][_0xeb03('0x13')]===0x1f4){logger[_0xeb03('0x12')](_0xeb03('0xe'),_0x3d3322,_0x403b77[_0xeb03('0x12')][_0xeb03('0x14')]);return _0x3f2c74(_0x403b77[_0xeb03('0x12')][_0xeb03('0x14')]);}logger[_0xeb03('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3d3322,_0x403b77[_0xeb03('0x12')][_0xeb03('0x14')]);return _0x246c6e(_0x403b77[_0xeb03('0x12')][_0xeb03('0x14')]);}else{logger['info'](_0xeb03('0xe'),_0x3d3322,_0xeb03('0x10'));_0x246c6e(_0x403b77[_0xeb03('0x15')]['message']);}})[_0xeb03('0x16')](function(_0x46dd1b){logger[_0xeb03('0x12')](_0xeb03('0xe'),_0x3d3322,_0x46dd1b);_0x3f2c74(_0x46dd1b);});});}exports[_0xeb03('0x17')]=function(_0x1b4cbd){var _0x167a33=this;return new Promise(function(_0x8d6725,_0x177f9c){return db[_0xeb03('0x18')][_0xeb03('0x19')](_0x1b4cbd[_0xeb03('0x1a')],{'raw':_0x1b4cbd[_0xeb03('0x1b')]?_0x1b4cbd[_0xeb03('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xeb03('0x1c')](function(_0x3855dd){logger[_0xeb03('0xd')](_0xeb03('0x17'),_0x1b4cbd);logger[_0xeb03('0xf')](_0xeb03('0x17'),_0x1b4cbd,JSON[_0xeb03('0x11')](_0x3855dd));_0x8d6725(_0x3855dd);})[_0xeb03('0x16')](function(_0x3c3d09){logger['error'](_0xeb03('0x17'),_0x3c3d09[_0xeb03('0x14')],_0x1b4cbd);_0x177f9c(_0x167a33[_0xeb03('0x12')](0x1f4,_0x3c3d09[_0xeb03('0x14')]));});});};exports[_0xeb03('0x1d')]=function(_0x5dcda3){var _0x638353=this;return new Promise(function(_0x406864,_0x16cd4){return db[_0xeb03('0x18')][_0xeb03('0x1e')](_0x5dcda3[_0xeb03('0x1a')],{'raw':_0x5dcda3[_0xeb03('0x1b')]?_0x5dcda3[_0xeb03('0x1b')][_0xeb03('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5dcda3['options']?_0x5dcda3[_0xeb03('0x1b')][_0xeb03('0x20')]||null:null,'attributes':_0x5dcda3[_0xeb03('0x1b')]?_0x5dcda3[_0xeb03('0x1b')]['attributes']||null:null,'limit':_0x5dcda3['options']?_0x5dcda3[_0xeb03('0x1b')]['limit']||null:null})[_0xeb03('0x1c')](function(_0x8bd544){logger[_0xeb03('0xd')]('UpdateOpenchannelQueueReport',_0x5dcda3);logger[_0xeb03('0xf')]('UpdateOpenchannelQueueReport',_0x5dcda3,JSON['stringify'](_0x8bd544));_0x406864(_0x8bd544);})['catch'](function(_0x538d19){logger[_0xeb03('0x12')](_0xeb03('0x1d'),_0x538d19['message'],_0x5dcda3);_0x16cd4(_0x638353['error'](0x1f4,_0x538d19['message']));});});}; \ No newline at end of file +var _0x5c00=['catch','CreateOpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','where','attributes','limit','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x122eea,_0x11a661){var _0x33a347=function(_0x1ebb61){while(--_0x1ebb61){_0x122eea['push'](_0x122eea['shift']());}};_0x33a347(++_0x11a661);}(_0x5c00,0x17e));var _0x05c0=function(_0x1d5e54,_0x5115e6){_0x1d5e54=_0x1d5e54-0x0;var _0x420d64=_0x5c00[_0x1d5e54];return _0x420d64;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var moment=require(_0x05c0('0x2'));var BPromise=require('bluebird');var rs=require(_0x05c0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05c0('0x4'))['db'];var utils=require(_0x05c0('0x5'));var logger=require(_0x05c0('0x6'))(_0x05c0('0x7'));var config=require('../../config/environment');var jayson=require(_0x05c0('0x8'));var client=jayson[_0x05c0('0x9')][_0x05c0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27dc10,_0x5b9f09,_0x3a3b1b){return new BPromise(function(_0x34eb5f,_0x3ad5b7){return client['request'](_0x27dc10,_0x3a3b1b)[_0x05c0('0xb')](function(_0x32cdfa){logger[_0x05c0('0xc')](_0x05c0('0xd'),_0x5b9f09,_0x05c0('0xe'));logger[_0x05c0('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x5b9f09,'request\x20sent',JSON[_0x05c0('0x10')](_0x32cdfa));if(_0x32cdfa['error']){if(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x12')]===0x1f4){logger[_0x05c0('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x5b9f09,_0x32cdfa[_0x05c0('0x11')]['message']);return _0x3ad5b7(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);}logger[_0x05c0('0x11')](_0x05c0('0xd'),_0x5b9f09,_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);return _0x34eb5f(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);}else{logger['info'](_0x05c0('0xd'),_0x5b9f09,_0x05c0('0xe'));_0x34eb5f(_0x32cdfa[_0x05c0('0x14')][_0x05c0('0x13')]);}})[_0x05c0('0x15')](function(_0x40153e){logger[_0x05c0('0x11')](_0x05c0('0xd'),_0x5b9f09,_0x40153e);_0x3ad5b7(_0x40153e);});});}exports[_0x05c0('0x16')]=function(_0x521cbd){var _0x422401=this;return new Promise(function(_0x1230e5,_0x4613c0){return db['OpenchannelQueueReport'][_0x05c0('0x17')](_0x521cbd[_0x05c0('0x18')],{'raw':_0x521cbd[_0x05c0('0x19')]?_0x521cbd[_0x05c0('0x19')][_0x05c0('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x407c1f){logger[_0x05c0('0xc')]('CreateOpenchannelQueueReport',_0x521cbd);logger['debug']('CreateOpenchannelQueueReport',_0x521cbd,JSON[_0x05c0('0x10')](_0x407c1f));_0x1230e5(_0x407c1f);})[_0x05c0('0x15')](function(_0x83f29){logger[_0x05c0('0x11')](_0x05c0('0x16'),_0x83f29[_0x05c0('0x13')],_0x521cbd);_0x4613c0(_0x422401[_0x05c0('0x11')](0x1f4,_0x83f29['message']));});});};exports[_0x05c0('0x1b')]=function(_0x1abbf3){var _0x4ba978=this;return new Promise(function(_0x530966,_0x4da6d6){return db['OpenchannelQueueReport']['update'](_0x1abbf3[_0x05c0('0x18')],{'raw':_0x1abbf3[_0x05c0('0x19')]?_0x1abbf3['options'][_0x05c0('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1abbf3[_0x05c0('0x19')]?_0x1abbf3[_0x05c0('0x19')][_0x05c0('0x1c')]||null:null,'attributes':_0x1abbf3['options']?_0x1abbf3[_0x05c0('0x19')][_0x05c0('0x1d')]||null:null,'limit':_0x1abbf3[_0x05c0('0x19')]?_0x1abbf3[_0x05c0('0x19')][_0x05c0('0x1e')]||null:null})[_0x05c0('0xb')](function(_0x57886b){logger['info'](_0x05c0('0x1b'),_0x1abbf3);logger[_0x05c0('0xf')](_0x05c0('0x1b'),_0x1abbf3,JSON[_0x05c0('0x10')](_0x57886b));_0x530966(_0x57886b);})[_0x05c0('0x15')](function(_0x1e00c5){logger[_0x05c0('0x11')](_0x05c0('0x1b'),_0x1e00c5[_0x05c0('0x13')],_0x1abbf3);_0x4da6d6(_0x4ba978[_0x05c0('0x11')](0x1f4,_0x1e00c5[_0x05c0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 980fb3f..5c87395 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 _0x179d=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','index','/describe','isAuthenticated','/:id','show','put','update','delete','destroy','multer','path','connect-timeout'];(function(_0x4dfa53,_0x51df97){var _0x36936a=function(_0x38a901){while(--_0x38a901){_0x4dfa53['push'](_0x4dfa53['shift']());}};_0x36936a(++_0x51df97);}(_0x179d,0x19f));var _0xd179=function(_0x1f87c3,_0x241830){_0x1f87c3=_0x1f87c3-0x0;var _0x4640fc=_0x179d[_0x1f87c3];return _0x4640fc;};'use strict';var multer=require(_0xd179('0x0'));var util=require('util');var path=require(_0xd179('0x1'));var timeout=require(_0xd179('0x2'));var express=require('express');var router=express[_0xd179('0x3')]();var fs_extra=require(_0xd179('0x4'));var auth=require(_0xd179('0x5'));var interaction=require(_0xd179('0x6'));var config=require(_0xd179('0x7'));var controller=require(_0xd179('0x8'));router[_0xd179('0x9')]('/',auth['isAuthenticated'](),controller[_0xd179('0xa')]);router[_0xd179('0x9')](_0xd179('0xb'),auth[_0xd179('0xc')](),controller['describe']);router[_0xd179('0x9')](_0xd179('0xd'),auth['isAuthenticated'](),controller[_0xd179('0xe')]);router['post']('/',auth[_0xd179('0xc')](),controller['create']);router[_0xd179('0xf')](_0xd179('0xd'),auth['isAuthenticated'](),controller[_0xd179('0x10')]);router[_0xd179('0x11')](_0xd179('0xd'),auth['isAuthenticated'](),controller[_0xd179('0x12')]);module['exports']=router; \ No newline at end of file +var _0xcec2=['multer','util','path','Router','fs-extra','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','destroy','exports'];(function(_0x25fe12,_0x4552db){var _0x2700c3=function(_0x3f8b55){while(--_0x3f8b55){_0x25fe12['push'](_0x25fe12['shift']());}};_0x2700c3(++_0x4552db);}(_0xcec2,0x17c));var _0x2cec=function(_0x2d4c6e,_0x6920ad){_0x2d4c6e=_0x2d4c6e-0x0;var _0x5e9b34=_0xcec2[_0x2d4c6e];return _0x5e9b34;};'use strict';var multer=require(_0x2cec('0x0'));var util=require(_0x2cec('0x1'));var path=require(_0x2cec('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2cec('0x3')]();var fs_extra=require(_0x2cec('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2cec('0x5'));var controller=require(_0x2cec('0x6'));router[_0x2cec('0x7')]('/',auth[_0x2cec('0x8')](),controller['index']);router[_0x2cec('0x7')](_0x2cec('0x9'),auth[_0x2cec('0x8')](),controller[_0x2cec('0xa')]);router[_0x2cec('0x7')](_0x2cec('0xb'),auth[_0x2cec('0x8')](),controller[_0x2cec('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2cec('0xd')]);router[_0x2cec('0xe')](_0x2cec('0xb'),auth[_0x2cec('0x8')](),controller[_0x2cec('0xf')]);router[_0x2cec('0x10')](_0x2cec('0xb'),auth[_0x2cec('0x8')](),controller[_0x2cec('0x11')]);module[_0x2cec('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index d60ec83..59c1188 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x39d85d,_0x328aef){var _0x55af0f=function(_0x7d8dc){while(--_0x7d8dc){_0x39d85d['push'](_0x39d85d['shift']());}};_0x55af0f(++_0x328aef);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x25248b,_0x3c8491){_0x25248b=_0x25248b-0x0;var _0x509939=_0xf3cd[_0x25248b];return _0x509939;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x5229bb,_0x4b17f5){var _0x15db9b=function(_0x2fb343){while(--_0x2fb343){_0x5229bb['push'](_0x5229bb['shift']());}};_0x15db9b(++_0x4b17f5);}(_0x54ef,0x112));var _0xf54e=function(_0x268ccd,_0x985124){_0x268ccd=_0x268ccd-0x0;var _0x1cb66f=_0x54ef[_0x268ccd];return _0x1cb66f;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 150f362..d69f959 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 _0x824d=['jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','undefined','limit','offset','set','Content-Range','reject','save','then','destroy','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','catch','show','params','find','create','body','update','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto'];(function(_0x26f1c4,_0x2bbc6a){var _0x393a70=function(_0xb8257d){while(--_0xb8257d){_0x26f1c4['push'](_0x26f1c4['shift']());}};_0x393a70(++_0x2bbc6a);}(_0x824d,0xc3));var _0xd824=function(_0x4c5724,_0x11afa9){_0x4c5724=_0x4c5724-0x0;var _0x4a6b98=_0x824d[_0x4c5724];return _0x4a6b98;};'use strict';var emlformat=require(_0xd824('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd824('0x1'));var jsonpatch=require(_0xd824('0x2'));var rp=require(_0xd824('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd824('0x4'));var util=require(_0xd824('0x5'));var path=require(_0xd824('0x6'));var sox=require('sox');var csv=require(_0xd824('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd824('0x8'));var _=require(_0xd824('0x9'));var squel=require(_0xd824('0xa'));var crypto=require(_0xd824('0xb'));var jsforce=require(_0xd824('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd824('0x7'));var querystring=require(_0xd824('0xd'));var Papa=require(_0xd824('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd824('0xf'));var as=require(_0xd824('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd824('0x11'))(_0xd824('0x12'));var utils=require(_0xd824('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd824('0x14'))['db'];function respondWithStatusCode(_0xdb8a27,_0x5a838a){_0x5a838a=_0x5a838a||0xcc;return function(_0x661720){if(_0x661720){return _0xdb8a27[_0xd824('0x15')](_0x5a838a);}return _0xdb8a27[_0xd824('0x16')](_0x5a838a)['end']();};}function respondWithResult(_0x1b618e,_0x490f80){_0x490f80=_0x490f80||0xc8;return function(_0x3e81ab){if(_0x3e81ab){return _0x1b618e['status'](_0x490f80)[_0xd824('0x17')](_0x3e81ab);}};}function respondWithFilteredResult(_0x4196a0,_0x3f0a5e){return function(_0x2d7717){if(_0x2d7717){var _0x4fd8d1=typeof _0x3f0a5e['offset']===_0xd824('0x18')&&typeof _0x3f0a5e[_0xd824('0x19')]==='undefined';var _0x5e27b3=_0x2d7717['count'];var _0x42fcd1=_0x4fd8d1?0x0:_0x3f0a5e[_0xd824('0x1a')];var _0x3ffeb4=_0x4fd8d1?_0x2d7717['count']:_0x3f0a5e[_0xd824('0x1a')]+_0x3f0a5e[_0xd824('0x19')];var _0x1e6c45;if(_0x3ffeb4>=_0x5e27b3){_0x3ffeb4=_0x5e27b3;_0x1e6c45=0xc8;}else{_0x1e6c45=0xce;}_0x4196a0[_0xd824('0x16')](_0x1e6c45);return _0x4196a0[_0xd824('0x1b')](_0xd824('0x1c'),_0x42fcd1+'-'+_0x3ffeb4+'/'+_0x5e27b3)['json'](_0x2d7717);}return null;};}function patchUpdates(_0x2ca474){return function(_0x221b05){try{jsonpatch['apply'](_0x221b05,_0x2ca474,!![]);}catch(_0x39c8cb){return BPromise[_0xd824('0x1d')](_0x39c8cb);}return _0x221b05[_0xd824('0x1e')]();};}function saveUpdates(_0x423dc5,_0x2c343d){return function(_0xf075a0){if(_0xf075a0){return _0xf075a0['update'](_0x423dc5)[_0xd824('0x1f')](function(_0x338ab7){return _0x338ab7;});}return null;};}function removeEntity(_0x4338c0,_0x13963d){return function(_0x1d10e7){if(_0x1d10e7){return _0x1d10e7[_0xd824('0x20')]()[_0xd824('0x1f')](function(){_0x4338c0[_0xd824('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x159bef,_0x58e7cb){return function(_0x5cc06e){if(!_0x5cc06e){_0x159bef['sendStatus'](0x194);}return _0x5cc06e;};}function handleError(_0x3b03f4,_0x1a125){_0x1a125=_0x1a125||0x1f4;return function(_0x1281c3){logger['error'](_0x1281c3[_0xd824('0x21')]);if(_0x1281c3['name']){delete _0x1281c3[_0xd824('0x22')];}_0x3b03f4[_0xd824('0x16')](_0x1a125)[_0xd824('0x23')](_0x1281c3);};}exports[_0xd824('0x24')]=function(_0x23b0f3,_0x5e5c60){var _0x132e6e={},_0x2e7080={},_0x3ab3ab={'count':0x0,'rows':[]};var _0x1b36ea=_[_0xd824('0x25')](db[_0xd824('0x26')][_0xd824('0x27')],function(_0x3638b2){return{'name':_0x3638b2[_0xd824('0x28')],'type':_0x3638b2[_0xd824('0x29')]['key']};});_0x2e7080[_0xd824('0x2a')]=_['map'](_0x1b36ea,_0xd824('0x22'));_0x2e7080[_0xd824('0x2b')]=_[_0xd824('0x2c')](_0x23b0f3[_0xd824('0x2b')]);_0x2e7080[_0xd824('0x2d')]=_[_0xd824('0x2e')](_0x2e7080[_0xd824('0x2a')],_0x2e7080['query']);_0x132e6e[_0xd824('0x2f')]=_['intersection'](_0x2e7080[_0xd824('0x2a')],qs[_0xd824('0x30')](_0x23b0f3[_0xd824('0x2b')][_0xd824('0x30')]));_0x132e6e[_0xd824('0x2f')]=_0x132e6e[_0xd824('0x2f')][_0xd824('0x31')]?_0x132e6e['attributes']:_0x2e7080[_0xd824('0x2a')];if(!_0x23b0f3['query']['hasOwnProperty'](_0xd824('0x32'))){_0x132e6e[_0xd824('0x19')]=qs['limit'](_0x23b0f3[_0xd824('0x2b')]['limit']);_0x132e6e[_0xd824('0x1a')]=qs[_0xd824('0x1a')](_0x23b0f3[_0xd824('0x2b')][_0xd824('0x1a')]);}_0x132e6e[_0xd824('0x33')]=qs['sort'](_0x23b0f3['query']['sort']);_0x132e6e[_0xd824('0x34')]=qs[_0xd824('0x2d')](_[_0xd824('0x35')](_0x23b0f3['query'],_0x2e7080[_0xd824('0x2d')]),_0x1b36ea);if(_0x23b0f3[_0xd824('0x2b')]['filter']){_0x132e6e[_0xd824('0x34')]=_[_0xd824('0x36')](_0x132e6e[_0xd824('0x34')],{'$or':_[_0xd824('0x25')](_0x1b36ea,function(_0x2914aa){if(_0x2914aa['type']!==_0xd824('0x37')){var _0x285ff6={};_0x285ff6[_0x2914aa[_0xd824('0x22')]]={'$like':'%'+_0x23b0f3[_0xd824('0x2b')][_0xd824('0x38')]+'%'};return _0x285ff6;}})});}_0x132e6e=_[_0xd824('0x36')]({},_0x132e6e,_0x23b0f3[_0xd824('0x39')]);var _0x218e37={'where':_0x132e6e[_0xd824('0x34')]};return db[_0xd824('0x26')][_0xd824('0x3a')](_0x218e37)[_0xd824('0x1f')](function(_0x283827){_0x3ab3ab[_0xd824('0x3a')]=_0x283827;if(_0x23b0f3[_0xd824('0x2b')][_0xd824('0x3b')]){_0x132e6e[_0xd824('0x3c')]=[{'all':!![]}];}return db[_0xd824('0x26')]['findAll'](_0x132e6e);})[_0xd824('0x1f')](function(_0x4d441e){_0x3ab3ab['rows']=_0x4d441e;return _0x3ab3ab;})[_0xd824('0x1f')](respondWithFilteredResult(_0x5e5c60,_0x132e6e))[_0xd824('0x3d')](handleError(_0x5e5c60,null));};exports[_0xd824('0x3e')]=function(_0x5705a0,_0x464b96){var _0x40fc03={'raw':!![],'where':{'id':_0x5705a0[_0xd824('0x3f')]['id']}},_0x151f0e={};_0x151f0e[_0xd824('0x2a')]=_['keys'](db[_0xd824('0x26')][_0xd824('0x27')]);_0x151f0e[_0xd824('0x2b')]=_[_0xd824('0x2c')](_0x5705a0['query']);_0x151f0e[_0xd824('0x2d')]=_[_0xd824('0x2e')](_0x151f0e[_0xd824('0x2a')],_0x151f0e[_0xd824('0x2b')]);_0x40fc03['attributes']=_[_0xd824('0x2e')](_0x151f0e[_0xd824('0x2a')],qs[_0xd824('0x30')](_0x5705a0[_0xd824('0x2b')]['fields']));_0x40fc03[_0xd824('0x2f')]=_0x40fc03[_0xd824('0x2f')][_0xd824('0x31')]?_0x40fc03['attributes']:_0x151f0e[_0xd824('0x2a')];if(_0x5705a0['query'][_0xd824('0x3b')]){_0x40fc03[_0xd824('0x3c')]=[{'all':!![]}];}_0x40fc03=_['merge']({},_0x40fc03,_0x5705a0[_0xd824('0x39')]);return db[_0xd824('0x26')][_0xd824('0x40')](_0x40fc03)[_0xd824('0x1f')](handleEntityNotFound(_0x464b96,null))[_0xd824('0x1f')](respondWithResult(_0x464b96,null))[_0xd824('0x3d')](handleError(_0x464b96,null));};exports[_0xd824('0x41')]=function(_0x488ff0,_0x5eefe2){return db[_0xd824('0x26')][_0xd824('0x41')](_0x488ff0[_0xd824('0x42')],{})[_0xd824('0x1f')](respondWithResult(_0x5eefe2,0xc9))[_0xd824('0x3d')](handleError(_0x5eefe2,null));};exports[_0xd824('0x43')]=function(_0x1080de,_0x594676){if(_0x1080de[_0xd824('0x42')]['id']){delete _0x1080de['body']['id'];}return db['OpenchannelTransferReport'][_0xd824('0x40')]({'where':{'id':_0x1080de[_0xd824('0x3f')]['id']}})['then'](handleEntityNotFound(_0x594676,null))['then'](saveUpdates(_0x1080de[_0xd824('0x42')],null))[_0xd824('0x1f')](respondWithResult(_0x594676,null))[_0xd824('0x3d')](handleError(_0x594676,null));};exports[_0xd824('0x20')]=function(_0xb51839,_0x38cb68){return db['OpenchannelTransferReport'][_0xd824('0x40')]({'where':{'id':_0xb51839['params']['id']}})['then'](handleEntityNotFound(_0x38cb68,null))[_0xd824('0x1f')](removeEntity(_0x38cb68,null))[_0xd824('0x3d')](handleError(_0x38cb68,null));};exports[_0xd824('0x44')]=function(_0x175f84,_0x490a4a){return db['OpenchannelTransferReport'][_0xd824('0x44')]()['then'](respondWithResult(_0x490a4a,null))['catch'](handleError(_0x490a4a,null));}; \ No newline at end of file +var _0x94e7=['../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','OpenchannelTransferReport','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','rawAttributes','catch','create','body','destroy','find','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x3ebb69,_0x3e612e){var _0x421e59=function(_0x5a8c66){while(--_0x5a8c66){_0x3ebb69['push'](_0x3ebb69['shift']());}};_0x421e59(++_0x3e612e);}(_0x94e7,0x118));var _0x794e=function(_0x521590,_0x48dead){_0x521590=_0x521590-0x0;var _0x4d612d=_0x94e7[_0x521590];return _0x4d612d;};'use strict';var emlformat=require(_0x794e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x794e('0x1'));var rp=require(_0x794e('0x2'));var moment=require(_0x794e('0x3'));var BPromise=require(_0x794e('0x4'));var Mustache=require(_0x794e('0x5'));var util=require('util');var path=require(_0x794e('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x794e('0x7'));var fs=require('fs');var fs_extra=require(_0x794e('0x8'));var _=require(_0x794e('0x9'));var squel=require(_0x794e('0xa'));var crypto=require(_0x794e('0xb'));var jsforce=require(_0x794e('0xc'));var deskjs=require(_0x794e('0xd'));var toCsv=require(_0x794e('0xe'));var querystring=require('querystring');var Papa=require(_0x794e('0xf'));var Redis=require(_0x794e('0x10'));var authService=require(_0x794e('0x11'));var qs=require(_0x794e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x794e('0x13'));var logger=require(_0x794e('0x14'))(_0x794e('0x15'));var utils=require(_0x794e('0x16'));var config=require(_0x794e('0x17'));var licenseUtil=require(_0x794e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32f7aa,_0x679a7c){_0x679a7c=_0x679a7c||0xcc;return function(_0x508d57){if(_0x508d57){return _0x32f7aa[_0x794e('0x19')](_0x679a7c);}return _0x32f7aa[_0x794e('0x1a')](_0x679a7c)[_0x794e('0x1b')]();};}function respondWithResult(_0x328b2f,_0x1dd714){_0x1dd714=_0x1dd714||0xc8;return function(_0x5ee2e7){if(_0x5ee2e7){return _0x328b2f['status'](_0x1dd714)[_0x794e('0x1c')](_0x5ee2e7);}};}function respondWithFilteredResult(_0x3b581a,_0x3f1cce){return function(_0x2743f3){if(_0x2743f3){var _0x4dc7a9=typeof _0x3f1cce[_0x794e('0x1d')]===_0x794e('0x1e')&&typeof _0x3f1cce[_0x794e('0x1f')]==='undefined';var _0x4c4585=_0x2743f3[_0x794e('0x20')];var _0x16ac89=_0x4dc7a9?0x0:_0x3f1cce[_0x794e('0x1d')];var _0x58b597=_0x4dc7a9?_0x2743f3[_0x794e('0x20')]:_0x3f1cce[_0x794e('0x1d')]+_0x3f1cce[_0x794e('0x1f')];var _0x5b0ba6;if(_0x58b597>=_0x4c4585){_0x58b597=_0x4c4585;_0x5b0ba6=0xc8;}else{_0x5b0ba6=0xce;}_0x3b581a[_0x794e('0x1a')](_0x5b0ba6);return _0x3b581a['set'](_0x794e('0x21'),_0x16ac89+'-'+_0x58b597+'/'+_0x4c4585)['json'](_0x2743f3);}return null;};}function patchUpdates(_0x2f005e){return function(_0x4c5993){try{jsonpatch[_0x794e('0x22')](_0x4c5993,_0x2f005e,!![]);}catch(_0x2ab263){return BPromise[_0x794e('0x23')](_0x2ab263);}return _0x4c5993[_0x794e('0x24')]();};}function saveUpdates(_0x1c0711,_0x2b5bea){return function(_0x23e8b1){if(_0x23e8b1){return _0x23e8b1[_0x794e('0x25')](_0x1c0711)[_0x794e('0x26')](function(_0x45cd3c){return _0x45cd3c;});}return null;};}function removeEntity(_0x588f6e,_0x5e7aae){return function(_0x2247c7){if(_0x2247c7){return _0x2247c7['destroy']()['then'](function(){_0x588f6e[_0x794e('0x1a')](0xcc)[_0x794e('0x1b')]();});}};}function handleEntityNotFound(_0x13eba1,_0x59bca6){return function(_0x3ea9f6){if(!_0x3ea9f6){_0x13eba1['sendStatus'](0x194);}return _0x3ea9f6;};}function handleError(_0x489c85,_0x4a20d8){_0x4a20d8=_0x4a20d8||0x1f4;return function(_0x170cc2){logger[_0x794e('0x27')](_0x170cc2[_0x794e('0x28')]);if(_0x170cc2[_0x794e('0x29')]){delete _0x170cc2[_0x794e('0x29')];}_0x489c85[_0x794e('0x1a')](_0x4a20d8)['send'](_0x170cc2);};}exports[_0x794e('0x2a')]=function(_0x67246a,_0x9fb047){var _0x3ea959={},_0x8b91fe={},_0xa56cea={'count':0x0,'rows':[]};var _0x528e4d=_[_0x794e('0x2b')](db[_0x794e('0x2c')]['rawAttributes'],function(_0x4aac2a){return{'name':_0x4aac2a[_0x794e('0x2d')],'type':_0x4aac2a[_0x794e('0x2e')][_0x794e('0x2f')]};});_0x8b91fe['model']=_[_0x794e('0x2b')](_0x528e4d,'name');_0x8b91fe[_0x794e('0x30')]=_['keys'](_0x67246a[_0x794e('0x30')]);_0x8b91fe[_0x794e('0x31')]=_[_0x794e('0x32')](_0x8b91fe['model'],_0x8b91fe[_0x794e('0x30')]);_0x3ea959[_0x794e('0x33')]=_['intersection'](_0x8b91fe[_0x794e('0x34')],qs[_0x794e('0x35')](_0x67246a[_0x794e('0x30')]['fields']));_0x3ea959['attributes']=_0x3ea959[_0x794e('0x33')][_0x794e('0x36')]?_0x3ea959[_0x794e('0x33')]:_0x8b91fe[_0x794e('0x34')];if(!_0x67246a['query'][_0x794e('0x37')](_0x794e('0x38'))){_0x3ea959[_0x794e('0x1f')]=qs[_0x794e('0x1f')](_0x67246a[_0x794e('0x30')][_0x794e('0x1f')]);_0x3ea959['offset']=qs[_0x794e('0x1d')](_0x67246a[_0x794e('0x30')][_0x794e('0x1d')]);}_0x3ea959['order']=qs[_0x794e('0x39')](_0x67246a[_0x794e('0x30')]['sort']);_0x3ea959['where']=qs[_0x794e('0x31')](_[_0x794e('0x3a')](_0x67246a[_0x794e('0x30')],_0x8b91fe[_0x794e('0x31')]),_0x528e4d);if(_0x67246a[_0x794e('0x30')][_0x794e('0x3b')]){_0x3ea959[_0x794e('0x3c')]=_['merge'](_0x3ea959['where'],{'$or':_[_0x794e('0x2b')](_0x528e4d,function(_0x52458f){if(_0x52458f['type']!==_0x794e('0x3d')){var _0x2238d0={};_0x2238d0[_0x52458f['name']]={'$like':'%'+_0x67246a[_0x794e('0x30')][_0x794e('0x3b')]+'%'};return _0x2238d0;}})});}_0x3ea959=_['merge']({},_0x3ea959,_0x67246a[_0x794e('0x3e')]);var _0x36a515={'where':_0x3ea959[_0x794e('0x3c')]};return db['OpenchannelTransferReport'][_0x794e('0x20')](_0x36a515)[_0x794e('0x26')](function(_0x23bbc6){_0xa56cea[_0x794e('0x20')]=_0x23bbc6;if(_0x67246a[_0x794e('0x30')][_0x794e('0x3f')]){_0x3ea959[_0x794e('0x40')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x794e('0x41')](_0x3ea959);})[_0x794e('0x26')](function(_0x55f26b){_0xa56cea[_0x794e('0x42')]=_0x55f26b;return _0xa56cea;})[_0x794e('0x26')](respondWithFilteredResult(_0x9fb047,_0x3ea959))['catch'](handleError(_0x9fb047,null));};exports['show']=function(_0x3cce13,_0x2abfdf){var _0x1f2563={'raw':!![],'where':{'id':_0x3cce13[_0x794e('0x43')]['id']}},_0x3dba66={};_0x3dba66[_0x794e('0x34')]=_[_0x794e('0x44')](db[_0x794e('0x2c')][_0x794e('0x45')]);_0x3dba66[_0x794e('0x30')]=_[_0x794e('0x44')](_0x3cce13[_0x794e('0x30')]);_0x3dba66[_0x794e('0x31')]=_['intersection'](_0x3dba66['model'],_0x3dba66[_0x794e('0x30')]);_0x1f2563[_0x794e('0x33')]=_['intersection'](_0x3dba66['model'],qs[_0x794e('0x35')](_0x3cce13[_0x794e('0x30')]['fields']));_0x1f2563[_0x794e('0x33')]=_0x1f2563[_0x794e('0x33')][_0x794e('0x36')]?_0x1f2563[_0x794e('0x33')]:_0x3dba66[_0x794e('0x34')];if(_0x3cce13[_0x794e('0x30')][_0x794e('0x3f')]){_0x1f2563[_0x794e('0x40')]=[{'all':!![]}];}_0x1f2563=_['merge']({},_0x1f2563,_0x3cce13['options']);return db[_0x794e('0x2c')]['find'](_0x1f2563)['then'](handleEntityNotFound(_0x2abfdf,null))[_0x794e('0x26')](respondWithResult(_0x2abfdf,null))[_0x794e('0x46')](handleError(_0x2abfdf,null));};exports[_0x794e('0x47')]=function(_0x5d4abb,_0x591eea){return db[_0x794e('0x2c')][_0x794e('0x47')](_0x5d4abb[_0x794e('0x48')],{})['then'](respondWithResult(_0x591eea,0xc9))[_0x794e('0x46')](handleError(_0x591eea,null));};exports[_0x794e('0x25')]=function(_0x342982,_0x1fcc23){if(_0x342982[_0x794e('0x48')]['id']){delete _0x342982[_0x794e('0x48')]['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x342982['params']['id']}})[_0x794e('0x26')](handleEntityNotFound(_0x1fcc23,null))[_0x794e('0x26')](saveUpdates(_0x342982[_0x794e('0x48')],null))[_0x794e('0x26')](respondWithResult(_0x1fcc23,null))[_0x794e('0x46')](handleError(_0x1fcc23,null));};exports[_0x794e('0x49')]=function(_0x55641f,_0x1afd17){return db['OpenchannelTransferReport'][_0x794e('0x4a')]({'where':{'id':_0x55641f[_0x794e('0x43')]['id']}})[_0x794e('0x26')](handleEntityNotFound(_0x1afd17,null))['then'](removeEntity(_0x1afd17,null))['catch'](handleError(_0x1afd17,null));};exports['describe']=function(_0x242c26,_0x4bf2b5){return db[_0x794e('0x2c')][_0x794e('0x4b')]()[_0x794e('0x26')](respondWithResult(_0x4bf2b5,null))[_0x794e('0x46')](handleError(_0x4bf2b5,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 0c4931d..9906d6b 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 _0x1e86=['api','bluebird','request-promise','path','../../config/environment','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x466e68,_0x52866a){var _0xf7fd40=function(_0x18d422){while(--_0x18d422){_0x466e68['push'](_0x466e68['shift']());}};_0xf7fd40(++_0x52866a);}(_0x1e86,0x65));var _0x61e8=function(_0xbb374a,_0x327744){_0xbb374a=_0xbb374a-0x0;var _0x1c0d2b=_0x1e86[_0xbb374a];return _0x1c0d2b;};'use strict';var _=require(_0x61e8('0x0'));var util=require(_0x61e8('0x1'));var logger=require(_0x61e8('0x2'))(_0x61e8('0x3'));var moment=require('moment');var BPromise=require(_0x61e8('0x4'));var rp=require(_0x61e8('0x5'));var fs=require('fs');var path=require(_0x61e8('0x6'));var rimraf=require('rimraf');var config=require(_0x61e8('0x7'));var attributes=require(_0x61e8('0x8'));module[_0x61e8('0x9')]=function(_0x5375d6,_0x3ec6ba){return _0x5375d6['define'](_0x61e8('0xa'),attributes,{'tableName':_0x61e8('0xb'),'paranoid':![],'indexes':[{'name':_0x61e8('0xc'),'fields':[_0x61e8('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2310=['bluebird','request-promise','path','rimraf','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','api','moment'];(function(_0x3b77f0,_0x22d102){var _0x1edcca=function(_0x3d3fdd){while(--_0x3d3fdd){_0x3b77f0['push'](_0x3b77f0['shift']());}};_0x1edcca(++_0x22d102);}(_0x2310,0x1b7));var _0x0231=function(_0x377660,_0x5c7b44){_0x377660=_0x377660-0x0;var _0x175286=_0x2310[_0x377660];return _0x175286;};'use strict';var _=require(_0x0231('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0231('0x1'));var moment=require(_0x0231('0x2'));var BPromise=require(_0x0231('0x3'));var rp=require(_0x0231('0x4'));var fs=require('fs');var path=require(_0x0231('0x5'));var rimraf=require(_0x0231('0x6'));var config=require('../../config/environment');var attributes=require(_0x0231('0x7'));module[_0x0231('0x8')]=function(_0x3d5276,_0x47ec1f){return _0x3d5276[_0x0231('0x9')](_0x0231('0xa'),attributes,{'tableName':_0x0231('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0231('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 b351488..472ad73 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 _0x8a8b=['error','code','message','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2681f8,_0x1b7e26){var _0x194258=function(_0x3e5373){while(--_0x3e5373){_0x2681f8['push'](_0x2681f8['shift']());}};_0x194258(++_0x1b7e26);}(_0x8a8b,0xae));var _0xb8a8=function(_0xc74ed1,_0xf85b2e){_0xc74ed1=_0xc74ed1-0x0;var _0x168aba=_0x8a8b[_0xc74ed1];return _0x168aba;};'use strict';var _=require(_0xb8a8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb8a8('0x1'));var rs=require(_0xb8a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb8a8('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb8a8('0x4'))('rpc');var config=require(_0xb8a8('0x5'));var jayson=require(_0xb8a8('0x6'));var client=jayson[_0xb8a8('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37e48d,_0x59cf56,_0x32d542){return new BPromise(function(_0x4c46e9,_0x79cb4a){return client[_0xb8a8('0x8')](_0x37e48d,_0x32d542)[_0xb8a8('0x9')](function(_0x5b1515){logger[_0xb8a8('0xa')](_0xb8a8('0xb'),_0x59cf56,_0xb8a8('0xc'));logger[_0xb8a8('0xd')](_0xb8a8('0xe'),_0x59cf56,_0xb8a8('0xc'),JSON[_0xb8a8('0xf')](_0x5b1515));if(_0x5b1515[_0xb8a8('0x10')]){if(_0x5b1515[_0xb8a8('0x10')][_0xb8a8('0x11')]===0x1f4){logger[_0xb8a8('0x10')](_0xb8a8('0xb'),_0x59cf56,_0x5b1515[_0xb8a8('0x10')]['message']);return _0x79cb4a(_0x5b1515[_0xb8a8('0x10')][_0xb8a8('0x12')]);}logger[_0xb8a8('0x10')](_0xb8a8('0xb'),_0x59cf56,_0x5b1515[_0xb8a8('0x10')][_0xb8a8('0x12')]);return _0x4c46e9(_0x5b1515[_0xb8a8('0x10')][_0xb8a8('0x12')]);}else{logger[_0xb8a8('0xa')](_0xb8a8('0xb'),_0x59cf56,_0xb8a8('0xc'));_0x4c46e9(_0x5b1515['result'][_0xb8a8('0x12')]);}})['catch'](function(_0x9bd9af){logger[_0xb8a8('0x10')](_0xb8a8('0xb'),_0x59cf56,_0x9bd9af);_0x79cb4a(_0x9bd9af);});});} \ No newline at end of file +var _0x6bdc=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6bdc,0x14e));var _0xc6bd=function(_0x2f55fa,_0xaba7bb){_0x2f55fa=_0x2f55fa-0x0;var _0x4d98d2=_0x6bdc[_0x2f55fa];return _0x4d98d2;};'use strict';var _=require(_0xc6bd('0x0'));var util=require(_0xc6bd('0x1'));var moment=require(_0xc6bd('0x2'));var BPromise=require(_0xc6bd('0x3'));var rs=require(_0xc6bd('0x4'));var fs=require('fs');var Redis=require(_0xc6bd('0x5'));var db=require(_0xc6bd('0x6'))['db'];var utils=require(_0xc6bd('0x7'));var logger=require(_0xc6bd('0x8'))(_0xc6bd('0x9'));var config=require('../../config/environment');var jayson=require(_0xc6bd('0xa'));var client=jayson[_0xc6bd('0xb')][_0xc6bd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3f5327,_0x2c1c68,_0x8bd379){return new BPromise(function(_0x5ca385,_0x374067){return client[_0xc6bd('0xd')](_0x3f5327,_0x8bd379)[_0xc6bd('0xe')](function(_0x5e92e8){logger['info'](_0xc6bd('0xf'),_0x2c1c68,'request\x20sent');logger[_0xc6bd('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x2c1c68,_0xc6bd('0x11'),JSON[_0xc6bd('0x12')](_0x5e92e8));if(_0x5e92e8[_0xc6bd('0x13')]){if(_0x5e92e8[_0xc6bd('0x13')][_0xc6bd('0x14')]===0x1f4){logger[_0xc6bd('0x13')](_0xc6bd('0xf'),_0x2c1c68,_0x5e92e8[_0xc6bd('0x13')][_0xc6bd('0x15')]);return _0x374067(_0x5e92e8[_0xc6bd('0x13')][_0xc6bd('0x15')]);}logger[_0xc6bd('0x13')](_0xc6bd('0xf'),_0x2c1c68,_0x5e92e8[_0xc6bd('0x13')]['message']);return _0x5ca385(_0x5e92e8[_0xc6bd('0x13')]['message']);}else{logger['info'](_0xc6bd('0xf'),_0x2c1c68,_0xc6bd('0x11'));_0x5ca385(_0x5e92e8[_0xc6bd('0x16')][_0xc6bd('0x15')]);}})[_0xc6bd('0x17')](function(_0x5795bc){logger['error'](_0xc6bd('0xf'),_0x2c1c68,_0x5795bc);_0x374067(_0x5795bc);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 211a520..5ccba0d 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 _0x6df6=['./pause.controller','isAuthenticated','index','get','/:id','show','create','put','update','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x152999,_0x1dd83b){var _0x32ef67=function(_0xe8dc18){while(--_0xe8dc18){_0x152999['push'](_0x152999['shift']());}};_0x32ef67(++_0x1dd83b);}(_0x6df6,0xb6));var _0x66df=function(_0x3b0912,_0x39d739){_0x3b0912=_0x3b0912-0x0;var _0xa8f339=_0x6df6[_0x3b0912];return _0xa8f339;};'use strict';var multer=require('multer');var util=require(_0x66df('0x0'));var path=require(_0x66df('0x1'));var timeout=require(_0x66df('0x2'));var express=require(_0x66df('0x3'));var router=express['Router']();var fs_extra=require(_0x66df('0x4'));var auth=require(_0x66df('0x5'));var interaction=require(_0x66df('0x6'));var config=require(_0x66df('0x7'));var controller=require(_0x66df('0x8'));router['get']('/',auth[_0x66df('0x9')](),controller[_0x66df('0xa')]);router[_0x66df('0xb')](_0x66df('0xc'),auth[_0x66df('0x9')](),controller[_0x66df('0xd')]);router['post']('/',auth[_0x66df('0x9')](),controller[_0x66df('0xe')]);router[_0x66df('0xf')](_0x66df('0xc'),auth['isAuthenticated'](),controller[_0x66df('0x10')]);router['delete'](_0x66df('0xc'),auth[_0x66df('0x9')](),controller[_0x66df('0x11')]);module[_0x66df('0x12')]=router; \ No newline at end of file +var _0xbac2=['util','connect-timeout','express','fs-extra','../../components/interaction/service','./pause.controller','get','isAuthenticated','show','post','/:id','update','delete','destroy','exports','multer'];(function(_0x4b6a01,_0x386039){var _0xc374a3=function(_0x49791b){while(--_0x49791b){_0x4b6a01['push'](_0x4b6a01['shift']());}};_0xc374a3(++_0x386039);}(_0xbac2,0x17f));var _0x2bac=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbac2[_0x432682];return _0x463d05;};'use strict';var multer=require(_0x2bac('0x0'));var util=require(_0x2bac('0x1'));var path=require('path');var timeout=require(_0x2bac('0x2'));var express=require(_0x2bac('0x3'));var router=express['Router']();var fs_extra=require(_0x2bac('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2bac('0x5'));var config=require('../../config/environment');var controller=require(_0x2bac('0x6'));router[_0x2bac('0x7')]('/',auth[_0x2bac('0x8')](),controller['index']);router[_0x2bac('0x7')]('/:id',auth[_0x2bac('0x8')](),controller[_0x2bac('0x9')]);router[_0x2bac('0xa')]('/',auth[_0x2bac('0x8')](),controller['create']);router['put'](_0x2bac('0xb'),auth['isAuthenticated'](),controller[_0x2bac('0xc')]);router[_0x2bac('0xd')](_0x2bac('0xb'),auth[_0x2bac('0x8')](),controller[_0x2bac('0xe')]);module[_0x2bac('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 2fa8465..807ddfd 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 _0x89fd=['name','sequelize','exports','STRING'];(function(_0x53ac4b,_0x1bd3bd){var _0xd69c19=function(_0x4f3e92){while(--_0x4f3e92){_0x53ac4b['push'](_0x53ac4b['shift']());}};_0xd69c19(++_0x1bd3bd);}(_0x89fd,0x1bd));var _0xd89f=function(_0x2b10df,_0x483832){_0x2b10df=_0x2b10df-0x0;var _0x117d10=_0x89fd[_0x2b10df];return _0x117d10;};'use strict';var Sequelize=require(_0xd89f('0x0'));module[_0xd89f('0x1')]={'name':{'type':Sequelize[_0xd89f('0x2')],'unique':_0xd89f('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xd89f('0x2')]}}; \ No newline at end of file +var _0x9e7d=['sequelize','STRING','name'];(function(_0x3eb752,_0x3b79b9){var _0xe73d9e=function(_0x3e3460){while(--_0x3e3460){_0x3eb752['push'](_0x3eb752['shift']());}};_0xe73d9e(++_0x3b79b9);}(_0x9e7d,0x117));var _0xd9e7=function(_0x8eb9d,_0x320ee6){_0x8eb9d=_0x8eb9d-0x0;var _0x28c28=_0x9e7d[_0x8eb9d];return _0x28c28;};'use strict';var Sequelize=require(_0xd9e7('0x0'));module['exports']={'name':{'type':Sequelize[_0xd9e7('0x1')],'unique':_0xd9e7('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xd9e7('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 6adc96d..87da227 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 _0xe2ae=['UserProfileResource','error','name','send','index','Pause','fieldName','key','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','type','includeAll','include','findAll','rows','show','params','keys','rawAttributes','intersection','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','Pauses'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xe2ae,0x121));var _0xee2a=function(_0x136160,_0x5af277){_0x136160=_0x136160-0x0;var _0x41e34c=_0xe2ae[_0x136160];return _0x41e34c;};'use strict';var emlformat=require(_0xee2a('0x0'));var rimraf=require(_0xee2a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xee2a('0x2'));var rp=require(_0xee2a('0x3'));var moment=require(_0xee2a('0x4'));var BPromise=require(_0xee2a('0x5'));var Mustache=require(_0xee2a('0x6'));var util=require('util');var path=require(_0xee2a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xee2a('0x8'));var fs=require('fs');var fs_extra=require(_0xee2a('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xee2a('0xa'));var jsforce=require(_0xee2a('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xee2a('0xc'));var Papa=require(_0xee2a('0xd'));var Redis=require(_0xee2a('0xe'));var authService=require(_0xee2a('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee2a('0x10'));var logger=require(_0xee2a('0x11'))('api');var utils=require(_0xee2a('0x12'));var config=require(_0xee2a('0x13'));var licenseUtil=require(_0xee2a('0x14'));var db=require(_0xee2a('0x15'))['db'];function respondWithStatusCode(_0x4958bf,_0x22c207){_0x22c207=_0x22c207||0xcc;return function(_0x30f3f1){if(_0x30f3f1){return _0x4958bf[_0xee2a('0x16')](_0x22c207);}return _0x4958bf['status'](_0x22c207)[_0xee2a('0x17')]();};}function respondWithResult(_0x577166,_0x54cf7d){_0x54cf7d=_0x54cf7d||0xc8;return function(_0x5106e6){if(_0x5106e6){return _0x577166[_0xee2a('0x18')](_0x54cf7d)[_0xee2a('0x19')](_0x5106e6);}};}function respondWithFilteredResult(_0x5f06dd,_0x386b89){return function(_0x2d1cc1){if(_0x2d1cc1){var _0x40d1ac=typeof _0x386b89[_0xee2a('0x1a')]==='undefined'&&typeof _0x386b89[_0xee2a('0x1b')]===_0xee2a('0x1c');var _0x3913f0=_0x2d1cc1[_0xee2a('0x1d')];var _0x535c27=_0x40d1ac?0x0:_0x386b89['offset'];var _0x443c8a=_0x40d1ac?_0x2d1cc1[_0xee2a('0x1d')]:_0x386b89[_0xee2a('0x1a')]+_0x386b89[_0xee2a('0x1b')];var _0x3ca1f3;if(_0x443c8a>=_0x3913f0){_0x443c8a=_0x3913f0;_0x3ca1f3=0xc8;}else{_0x3ca1f3=0xce;}_0x5f06dd[_0xee2a('0x18')](_0x3ca1f3);return _0x5f06dd[_0xee2a('0x1e')]('Content-Range',_0x535c27+'-'+_0x443c8a+'/'+_0x3913f0)[_0xee2a('0x19')](_0x2d1cc1);}return null;};}function patchUpdates(_0x5b7f02){return function(_0x237484){try{jsonpatch[_0xee2a('0x1f')](_0x237484,_0x5b7f02,!![]);}catch(_0x37b94a){return BPromise[_0xee2a('0x20')](_0x37b94a);}return _0x237484[_0xee2a('0x21')]();};}function saveUpdates(_0x5bd6ef,_0x2d782b){return function(_0x1219d8){if(_0x1219d8){return _0x1219d8[_0xee2a('0x22')](_0x5bd6ef)[_0xee2a('0x23')](function(_0x2b6b1b){return _0x2b6b1b;});}return null;};}function removeEntity(_0x498b76,_0x312b5b){return function(_0x3fa2b6){if(_0x3fa2b6){return _0x3fa2b6[_0xee2a('0x24')]()['then'](function(){var _0x5660fc=_0x3fa2b6[_0xee2a('0x25')]({'plain':!![]});var _0x4ce46d=_0xee2a('0x26');return db[_0xee2a('0x27')][_0xee2a('0x24')]({'where':{'type':_0x4ce46d,'resourceId':_0x5660fc['id']}})['then'](function(){return _0x3fa2b6;});})['then'](function(){_0x498b76[_0xee2a('0x18')](0xcc)[_0xee2a('0x17')]();});}};}function handleEntityNotFound(_0x13c9ae,_0x3cc798){return function(_0x542ef2){if(!_0x542ef2){_0x13c9ae[_0xee2a('0x16')](0x194);}return _0x542ef2;};}function handleError(_0x601f38,_0x23a42e){_0x23a42e=_0x23a42e||0x1f4;return function(_0x5ba7a1){logger[_0xee2a('0x28')](_0x5ba7a1['stack']);if(_0x5ba7a1[_0xee2a('0x29')]){delete _0x5ba7a1[_0xee2a('0x29')];}_0x601f38['status'](_0x23a42e)[_0xee2a('0x2a')](_0x5ba7a1);};}exports[_0xee2a('0x2b')]=function(_0x5a684c,_0x2d2d41){var _0x46262e={},_0x13a01a={},_0x34fe7e={'count':0x0,'rows':[]};var _0x326b6b=_['map'](db[_0xee2a('0x2c')]['rawAttributes'],function(_0x1588ca){return{'name':_0x1588ca[_0xee2a('0x2d')],'type':_0x1588ca['type'][_0xee2a('0x2e')]};});_0x13a01a[_0xee2a('0x2f')]=_['map'](_0x326b6b,_0xee2a('0x29'));_0x13a01a['query']=_['keys'](_0x5a684c[_0xee2a('0x30')]);_0x13a01a['filters']=_['intersection'](_0x13a01a[_0xee2a('0x2f')],_0x13a01a['query']);_0x46262e[_0xee2a('0x31')]=_['intersection'](_0x13a01a['model'],qs['fields'](_0x5a684c['query'][_0xee2a('0x32')]));_0x46262e[_0xee2a('0x31')]=_0x46262e[_0xee2a('0x31')][_0xee2a('0x33')]?_0x46262e['attributes']:_0x13a01a['model'];if(!_0x5a684c[_0xee2a('0x30')][_0xee2a('0x34')](_0xee2a('0x35'))){_0x46262e[_0xee2a('0x1b')]=qs[_0xee2a('0x1b')](_0x5a684c[_0xee2a('0x30')][_0xee2a('0x1b')]);_0x46262e[_0xee2a('0x1a')]=qs['offset'](_0x5a684c['query'][_0xee2a('0x1a')]);}_0x46262e[_0xee2a('0x36')]=qs[_0xee2a('0x37')](_0x5a684c[_0xee2a('0x30')]['sort']);_0x46262e[_0xee2a('0x38')]=qs[_0xee2a('0x39')](_[_0xee2a('0x3a')](_0x5a684c['query'],_0x13a01a[_0xee2a('0x39')]),_0x326b6b);if(_0x5a684c[_0xee2a('0x30')][_0xee2a('0x3b')]){_0x46262e[_0xee2a('0x38')]=_[_0xee2a('0x3c')](_0x46262e[_0xee2a('0x38')],{'$or':_[_0xee2a('0x3d')](_0x326b6b,function(_0x40b090){if(_0x40b090[_0xee2a('0x3e')]!=='VIRTUAL'){var _0x2c3447={};_0x2c3447[_0x40b090['name']]={'$like':'%'+_0x5a684c[_0xee2a('0x30')][_0xee2a('0x3b')]+'%'};return _0x2c3447;}})});}_0x46262e=_['merge']({},_0x46262e,_0x5a684c['options']);var _0x65b3f5={'where':_0x46262e[_0xee2a('0x38')]};return db[_0xee2a('0x2c')][_0xee2a('0x1d')](_0x65b3f5)['then'](function(_0xdc5771){_0x34fe7e['count']=_0xdc5771;if(_0x5a684c['query'][_0xee2a('0x3f')]){_0x46262e[_0xee2a('0x40')]=[{'all':!![]}];}return db[_0xee2a('0x2c')][_0xee2a('0x41')](_0x46262e);})[_0xee2a('0x23')](function(_0xe1d28){_0x34fe7e[_0xee2a('0x42')]=_0xe1d28;return _0x34fe7e;})[_0xee2a('0x23')](respondWithFilteredResult(_0x2d2d41,_0x46262e))['catch'](handleError(_0x2d2d41,null));};exports[_0xee2a('0x43')]=function(_0x3e46e7,_0x2b8251){var _0x1f5101={'raw':!![],'where':{'id':_0x3e46e7[_0xee2a('0x44')]['id']}},_0x56e2e0={};_0x56e2e0[_0xee2a('0x2f')]=_[_0xee2a('0x45')](db[_0xee2a('0x2c')][_0xee2a('0x46')]);_0x56e2e0[_0xee2a('0x30')]=_['keys'](_0x3e46e7['query']);_0x56e2e0[_0xee2a('0x39')]=_[_0xee2a('0x47')](_0x56e2e0[_0xee2a('0x2f')],_0x56e2e0['query']);_0x1f5101['attributes']=_[_0xee2a('0x47')](_0x56e2e0['model'],qs[_0xee2a('0x32')](_0x3e46e7[_0xee2a('0x30')][_0xee2a('0x32')]));_0x1f5101[_0xee2a('0x31')]=_0x1f5101[_0xee2a('0x31')][_0xee2a('0x33')]?_0x1f5101['attributes']:_0x56e2e0[_0xee2a('0x2f')];if(_0x3e46e7[_0xee2a('0x30')][_0xee2a('0x3f')]){_0x1f5101[_0xee2a('0x40')]=[{'all':!![]}];}_0x1f5101=_[_0xee2a('0x3c')]({},_0x1f5101,_0x3e46e7[_0xee2a('0x48')]);return db[_0xee2a('0x2c')]['find'](_0x1f5101)[_0xee2a('0x23')](handleEntityNotFound(_0x2b8251,null))[_0xee2a('0x23')](respondWithResult(_0x2b8251,null))['catch'](handleError(_0x2b8251,null));};exports[_0xee2a('0x49')]=function(_0x1264d3,_0x4b8fad){return db[_0xee2a('0x2c')][_0xee2a('0x49')](_0x1264d3[_0xee2a('0x4a')],{})['then'](function(_0x8c2574){var _0x23cfb5=_0x1264d3[_0xee2a('0x4b')][_0xee2a('0x25')]({'plain':!![]});if(!_0x23cfb5)throw new Error(_0xee2a('0x4c'));if(_0x23cfb5[_0xee2a('0x4d')]===_0xee2a('0x4b')){var _0xa87713=_0x8c2574['get']({'plain':!![]});var _0x532a98='Pauses';return db['UserProfileSection'][_0xee2a('0x4e')]({'where':{'name':_0x532a98,'userProfileId':_0x23cfb5[_0xee2a('0x4f')]},'raw':!![]})[_0xee2a('0x23')](function(_0x45fb9f){if(_0x45fb9f&&_0x45fb9f[_0xee2a('0x50')]===0x0){return db[_0xee2a('0x27')][_0xee2a('0x49')]({'name':_0xa87713['name'],'resourceId':_0xa87713['id'],'type':_0x45fb9f[_0xee2a('0x29')],'sectionId':_0x45fb9f['id']},{})[_0xee2a('0x23')](function(){return _0x8c2574;});}else{return _0x8c2574;}})[_0xee2a('0x51')](function(_0x27ff17){logger[_0xee2a('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x27ff17);throw _0x27ff17;});}return _0x8c2574;})[_0xee2a('0x23')](respondWithResult(_0x4b8fad,0xc9))[_0xee2a('0x51')](handleError(_0x4b8fad,null));};exports[_0xee2a('0x22')]=function(_0x3008b1,_0x55e7fc){if(_0x3008b1[_0xee2a('0x4a')]['id']){delete _0x3008b1[_0xee2a('0x4a')]['id'];}return db['Pause'][_0xee2a('0x4e')]({'where':{'id':_0x3008b1[_0xee2a('0x44')]['id']}})['then'](handleEntityNotFound(_0x55e7fc,null))[_0xee2a('0x23')](saveUpdates(_0x3008b1[_0xee2a('0x4a')],null))['then'](respondWithResult(_0x55e7fc,null))[_0xee2a('0x51')](handleError(_0x55e7fc,null));};exports[_0xee2a('0x24')]=function(_0x25e127,_0x345a81){return db[_0xee2a('0x2c')][_0xee2a('0x4e')]({'where':{'id':_0x25e127[_0xee2a('0x44')]['id']}})['then'](handleEntityNotFound(_0x345a81,null))['then'](removeEntity(_0x345a81,null))[_0xee2a('0x51')](handleError(_0x345a81,null));}; \ No newline at end of file +var _0xee91=['reject','save','then','get','Pauses','destroy','error','name','send','index','map','Pause','rawAttributes','type','model','keys','filters','intersection','query','fields','attributes','length','nolimit','order','sort','where','pick','merge','filter','options','include','rows','catch','show','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x2fe4d9,_0x3ae749){var _0x30bc86=function(_0x10efe5){while(--_0x10efe5){_0x2fe4d9['push'](_0x2fe4d9['shift']());}};_0x30bc86(++_0x3ae749);}(_0xee91,0xca));var _0x1ee9=function(_0x31c49c,_0x15859e){_0x31c49c=_0x31c49c-0x0;var _0x3983eb=_0xee91[_0x31c49c];return _0x3983eb;};'use strict';var emlformat=require(_0x1ee9('0x0'));var rimraf=require(_0x1ee9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1ee9('0x2'));var rp=require(_0x1ee9('0x3'));var moment=require(_0x1ee9('0x4'));var BPromise=require(_0x1ee9('0x5'));var Mustache=require(_0x1ee9('0x6'));var util=require(_0x1ee9('0x7'));var path=require('path');var sox=require(_0x1ee9('0x8'));var csv=require(_0x1ee9('0x9'));var ejs=require(_0x1ee9('0xa'));var fs=require('fs');var fs_extra=require(_0x1ee9('0xb'));var _=require(_0x1ee9('0xc'));var squel=require(_0x1ee9('0xd'));var crypto=require('crypto');var jsforce=require(_0x1ee9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1ee9('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1ee9('0xf'));var hardwareService=require(_0x1ee9('0x10'));var logger=require('../../config/logger')(_0x1ee9('0x11'));var utils=require(_0x1ee9('0x12'));var config=require(_0x1ee9('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x1ee9('0x14'))['db'];function respondWithStatusCode(_0x4ee622,_0x4f16a6){_0x4f16a6=_0x4f16a6||0xcc;return function(_0x5cebfb){if(_0x5cebfb){return _0x4ee622[_0x1ee9('0x15')](_0x4f16a6);}return _0x4ee622[_0x1ee9('0x16')](_0x4f16a6)[_0x1ee9('0x17')]();};}function respondWithResult(_0x35e48c,_0xbec271){_0xbec271=_0xbec271||0xc8;return function(_0x202fe6){if(_0x202fe6){return _0x35e48c[_0x1ee9('0x16')](_0xbec271)[_0x1ee9('0x18')](_0x202fe6);}};}function respondWithFilteredResult(_0x2e4eb3,_0xff4ce){return function(_0x53503a){if(_0x53503a){var _0x155d35=typeof _0xff4ce[_0x1ee9('0x19')]===_0x1ee9('0x1a')&&typeof _0xff4ce[_0x1ee9('0x1b')]===_0x1ee9('0x1a');var _0x350b1e=_0x53503a[_0x1ee9('0x1c')];var _0x14ad32=_0x155d35?0x0:_0xff4ce[_0x1ee9('0x19')];var _0x4fc471=_0x155d35?_0x53503a[_0x1ee9('0x1c')]:_0xff4ce[_0x1ee9('0x19')]+_0xff4ce[_0x1ee9('0x1b')];var _0x38fc41;if(_0x4fc471>=_0x350b1e){_0x4fc471=_0x350b1e;_0x38fc41=0xc8;}else{_0x38fc41=0xce;}_0x2e4eb3[_0x1ee9('0x16')](_0x38fc41);return _0x2e4eb3[_0x1ee9('0x1d')](_0x1ee9('0x1e'),_0x14ad32+'-'+_0x4fc471+'/'+_0x350b1e)['json'](_0x53503a);}return null;};}function patchUpdates(_0x2b15e4){return function(_0x2f84f6){try{jsonpatch[_0x1ee9('0x1f')](_0x2f84f6,_0x2b15e4,!![]);}catch(_0x3b27f9){return BPromise[_0x1ee9('0x20')](_0x3b27f9);}return _0x2f84f6[_0x1ee9('0x21')]();};}function saveUpdates(_0x21aa17,_0x21522c){return function(_0x1a96a4){if(_0x1a96a4){return _0x1a96a4['update'](_0x21aa17)[_0x1ee9('0x22')](function(_0x231d67){return _0x231d67;});}return null;};}function removeEntity(_0x19f2d0,_0x1d3a69){return function(_0x26f038){if(_0x26f038){return _0x26f038['destroy']()[_0x1ee9('0x22')](function(){var _0x518bbd=_0x26f038[_0x1ee9('0x23')]({'plain':!![]});var _0x3eb307=_0x1ee9('0x24');return db['UserProfileResource'][_0x1ee9('0x25')]({'where':{'type':_0x3eb307,'resourceId':_0x518bbd['id']}})['then'](function(){return _0x26f038;});})['then'](function(){_0x19f2d0[_0x1ee9('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31c8a2,_0x1192e1){return function(_0x287fb5){if(!_0x287fb5){_0x31c8a2[_0x1ee9('0x15')](0x194);}return _0x287fb5;};}function handleError(_0x71dd6c,_0x2a1b8c){_0x2a1b8c=_0x2a1b8c||0x1f4;return function(_0x27443f){logger[_0x1ee9('0x26')](_0x27443f['stack']);if(_0x27443f[_0x1ee9('0x27')]){delete _0x27443f[_0x1ee9('0x27')];}_0x71dd6c[_0x1ee9('0x16')](_0x2a1b8c)[_0x1ee9('0x28')](_0x27443f);};}exports[_0x1ee9('0x29')]=function(_0x9afce0,_0xacb0d7){var _0x34b5a7={},_0x42110d={},_0x40de72={'count':0x0,'rows':[]};var _0x196d98=_[_0x1ee9('0x2a')](db[_0x1ee9('0x2b')][_0x1ee9('0x2c')],function(_0x34cb13){return{'name':_0x34cb13['fieldName'],'type':_0x34cb13[_0x1ee9('0x2d')]['key']};});_0x42110d[_0x1ee9('0x2e')]=_[_0x1ee9('0x2a')](_0x196d98,_0x1ee9('0x27'));_0x42110d['query']=_[_0x1ee9('0x2f')](_0x9afce0['query']);_0x42110d[_0x1ee9('0x30')]=_[_0x1ee9('0x31')](_0x42110d[_0x1ee9('0x2e')],_0x42110d[_0x1ee9('0x32')]);_0x34b5a7['attributes']=_['intersection'](_0x42110d['model'],qs[_0x1ee9('0x33')](_0x9afce0[_0x1ee9('0x32')][_0x1ee9('0x33')]));_0x34b5a7['attributes']=_0x34b5a7[_0x1ee9('0x34')][_0x1ee9('0x35')]?_0x34b5a7['attributes']:_0x42110d[_0x1ee9('0x2e')];if(!_0x9afce0[_0x1ee9('0x32')]['hasOwnProperty'](_0x1ee9('0x36'))){_0x34b5a7[_0x1ee9('0x1b')]=qs['limit'](_0x9afce0[_0x1ee9('0x32')][_0x1ee9('0x1b')]);_0x34b5a7[_0x1ee9('0x19')]=qs[_0x1ee9('0x19')](_0x9afce0[_0x1ee9('0x32')][_0x1ee9('0x19')]);}_0x34b5a7[_0x1ee9('0x37')]=qs[_0x1ee9('0x38')](_0x9afce0['query'][_0x1ee9('0x38')]);_0x34b5a7[_0x1ee9('0x39')]=qs[_0x1ee9('0x30')](_[_0x1ee9('0x3a')](_0x9afce0[_0x1ee9('0x32')],_0x42110d['filters']),_0x196d98);if(_0x9afce0[_0x1ee9('0x32')]['filter']){_0x34b5a7[_0x1ee9('0x39')]=_[_0x1ee9('0x3b')](_0x34b5a7['where'],{'$or':_['map'](_0x196d98,function(_0xa5676f){if(_0xa5676f['type']!=='VIRTUAL'){var _0x449c73={};_0x449c73[_0xa5676f['name']]={'$like':'%'+_0x9afce0[_0x1ee9('0x32')][_0x1ee9('0x3c')]+'%'};return _0x449c73;}})});}_0x34b5a7=_[_0x1ee9('0x3b')]({},_0x34b5a7,_0x9afce0[_0x1ee9('0x3d')]);var _0x50429f={'where':_0x34b5a7['where']};return db[_0x1ee9('0x2b')][_0x1ee9('0x1c')](_0x50429f)['then'](function(_0x27049d){_0x40de72[_0x1ee9('0x1c')]=_0x27049d;if(_0x9afce0[_0x1ee9('0x32')]['includeAll']){_0x34b5a7[_0x1ee9('0x3e')]=[{'all':!![]}];}return db['Pause']['findAll'](_0x34b5a7);})[_0x1ee9('0x22')](function(_0x403887){_0x40de72[_0x1ee9('0x3f')]=_0x403887;return _0x40de72;})['then'](respondWithFilteredResult(_0xacb0d7,_0x34b5a7))[_0x1ee9('0x40')](handleError(_0xacb0d7,null));};exports[_0x1ee9('0x41')]=function(_0x1fbc3c,_0x316bf2){var _0x316ca1={'raw':!![],'where':{'id':_0x1fbc3c['params']['id']}},_0x31ece9={};_0x31ece9['model']=_[_0x1ee9('0x2f')](db[_0x1ee9('0x2b')][_0x1ee9('0x2c')]);_0x31ece9['query']=_['keys'](_0x1fbc3c['query']);_0x31ece9[_0x1ee9('0x30')]=_[_0x1ee9('0x31')](_0x31ece9[_0x1ee9('0x2e')],_0x31ece9[_0x1ee9('0x32')]);_0x316ca1['attributes']=_[_0x1ee9('0x31')](_0x31ece9['model'],qs[_0x1ee9('0x33')](_0x1fbc3c[_0x1ee9('0x32')][_0x1ee9('0x33')]));_0x316ca1[_0x1ee9('0x34')]=_0x316ca1[_0x1ee9('0x34')][_0x1ee9('0x35')]?_0x316ca1['attributes']:_0x31ece9[_0x1ee9('0x2e')];if(_0x1fbc3c[_0x1ee9('0x32')]['includeAll']){_0x316ca1[_0x1ee9('0x3e')]=[{'all':!![]}];}_0x316ca1=_['merge']({},_0x316ca1,_0x1fbc3c[_0x1ee9('0x3d')]);return db[_0x1ee9('0x2b')]['find'](_0x316ca1)[_0x1ee9('0x22')](handleEntityNotFound(_0x316bf2,null))['then'](respondWithResult(_0x316bf2,null))[_0x1ee9('0x40')](handleError(_0x316bf2,null));};exports[_0x1ee9('0x42')]=function(_0x487037,_0x593788){return db['Pause'][_0x1ee9('0x42')](_0x487037[_0x1ee9('0x43')],{})['then'](function(_0x8f17af){var _0x7205e2=_0x487037[_0x1ee9('0x44')][_0x1ee9('0x23')]({'plain':!![]});if(!_0x7205e2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x7205e2[_0x1ee9('0x45')]===_0x1ee9('0x44')){var _0x5013fd=_0x8f17af[_0x1ee9('0x23')]({'plain':!![]});var _0x3e449e=_0x1ee9('0x24');return db[_0x1ee9('0x46')][_0x1ee9('0x47')]({'where':{'name':_0x3e449e,'userProfileId':_0x7205e2[_0x1ee9('0x48')]},'raw':!![]})[_0x1ee9('0x22')](function(_0x2df866){if(_0x2df866&&_0x2df866[_0x1ee9('0x49')]===0x0){return db[_0x1ee9('0x4a')]['create']({'name':_0x5013fd[_0x1ee9('0x27')],'resourceId':_0x5013fd['id'],'type':_0x2df866[_0x1ee9('0x27')],'sectionId':_0x2df866['id']},{})['then'](function(){return _0x8f17af;});}else{return _0x8f17af;}})[_0x1ee9('0x40')](function(_0x1befdd){logger[_0x1ee9('0x26')](_0x1ee9('0x4b'),_0x1befdd);throw _0x1befdd;});}return _0x8f17af;})[_0x1ee9('0x22')](respondWithResult(_0x593788,0xc9))[_0x1ee9('0x40')](handleError(_0x593788,null));};exports[_0x1ee9('0x4c')]=function(_0x4c9869,_0x5d0069){if(_0x4c9869[_0x1ee9('0x43')]['id']){delete _0x4c9869['body']['id'];}return db[_0x1ee9('0x2b')]['find']({'where':{'id':_0x4c9869[_0x1ee9('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5d0069,null))[_0x1ee9('0x22')](saveUpdates(_0x4c9869[_0x1ee9('0x43')],null))[_0x1ee9('0x22')](respondWithResult(_0x5d0069,null))[_0x1ee9('0x40')](handleError(_0x5d0069,null));};exports['destroy']=function(_0x22af3e,_0x2784e7){return db[_0x1ee9('0x2b')][_0x1ee9('0x47')]({'where':{'id':_0x22af3e[_0x1ee9('0x4d')]['id']}})[_0x1ee9('0x22')](handleEntityNotFound(_0x2784e7,null))[_0x1ee9('0x22')](removeEntity(_0x2784e7,null))[_0x1ee9('0x40')](handleError(_0x2784e7,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 54c6d78..292b2f9 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 _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x174af8,_0x4416b5){_0x174af8=_0x174af8-0x0;var _0x56b0a1=_0x7fbe[_0x174af8];return _0x56b0a1;};'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 +var _0x1cb9=['./pause.attributes','exports','define','Pause','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x5aecca,_0x4fae78){var _0x48c9e4=function(_0x366d24){while(--_0x366d24){_0x5aecca['push'](_0x5aecca['shift']());}};_0x48c9e4(++_0x4fae78);}(_0x1cb9,0x14e));var _0x91cb=function(_0x2f6b23,_0xb1261a){_0x2f6b23=_0x2f6b23-0x0;var _0x5c708b=_0x1cb9[_0x2f6b23];return _0x5c708b;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 8cbc328..b795204 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x36839a,_0x118059){var _0xbf8e4d=function(_0x53c53b){while(--_0x53c53b){_0x36839a['push'](_0x36839a['shift']());}};_0xbf8e4d(++_0x118059);}(_0x7a54,0x106));var _0x47a5=function(_0xeca420,_0x37e756){_0xeca420=_0xeca420-0x0;var _0x13b83d=_0x7a54[_0xeca420];return _0x13b83d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x1c316b,_0x2052f3){var _0x475891=function(_0x609e29){while(--_0x609e29){_0x1c316b['push'](_0x1c316b['shift']());}};_0x475891(++_0x2052f3);}(_0x7a54,0x106));var _0x47a5=function(_0x5a251e,_0x4d39b9){_0x5a251e=_0x5a251e-0x0;var _0x28be68=_0x7a54[_0x5a251e];return _0x28be68;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index b5a6f89..332c771 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 _0x008c=['/:id','/:id/download','join','root','server/files/plugins','originalname','format','basename','extname','now','single','file','upload','post','update','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','webhookGet'];(function(_0x14b9da,_0x45fe0b){var _0x5e1924=function(_0x7f0f0f){while(--_0x7f0f0f){_0x14b9da['push'](_0x14b9da['shift']());}};_0x5e1924(++_0x45fe0b);}(_0x008c,0x188));var _0xc008=function(_0xf93076,_0x1acb30){_0xf93076=_0xf93076-0x0;var _0x33d1da=_0x008c[_0xf93076];return _0x33d1da;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/webhook',controller[_0xc008('0xd')]);router['get'](_0xc008('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xc008('0xa')](_0xc008('0xf'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1eacfa,_0xc881aa,_0x5b2004){_0x5b2004(null,path[_0xc008('0x10')](config[_0xc008('0x11')],_0xc008('0x12')));},'filename':function(_0x2a5b4e,_0x9ffa93,_0x1819c6){_0x9ffa93[_0xc008('0x13')]=_0x9ffa93['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1819c6(null,util[_0xc008('0x14')]('%s-%s%s',path[_0xc008('0x15')](_0x9ffa93[_0xc008('0x13')],path[_0xc008('0x16')](_0x9ffa93[_0xc008('0x13')])),Date[_0xc008('0x17')](),path['extname'](_0x9ffa93['originalname'])));}})});router['post']('/',upload[_0xc008('0x18')](_0xc008('0x19')),controller[_0xc008('0x1a')]);router[_0xc008('0x1b')]('/webhook',controller['webhookPost']);router['put']('/:id',auth[_0xc008('0xb')](),controller[_0xc008('0x1c')]);router['delete'](_0xc008('0xe'),auth['isAuthenticated'](),controller['delete']);module['exports']=router; \ No newline at end of file +var _0xb458=['show','/:id/download','diskStorage','server/files/plugins','originalname','replace','format','%s-%s%s','basename','now','extname','post','single','file','upload','webhookPost','put','/:id','update','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','index','get','/webhook','webhookGet','isAuthenticated'];(function(_0x321b95,_0x4e5f27){var _0x230e79=function(_0x39b0a5){while(--_0x39b0a5){_0x321b95['push'](_0x321b95['shift']());}};_0x230e79(++_0x4e5f27);}(_0xb458,0x103));var _0x8b45=function(_0x4d6298,_0x502f6b){_0x4d6298=_0x4d6298-0x0;var _0x57ccf0=_0xb458[_0x4d6298];return _0x57ccf0;};'use strict';var multer=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var path=require(_0x8b45('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8b45('0x3')]();var fs_extra=require(_0x8b45('0x4'));var auth=require(_0x8b45('0x5'));var interaction=require(_0x8b45('0x6'));var config=require('../../config/environment');var controller=require(_0x8b45('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x8b45('0x8')]);router[_0x8b45('0x9')](_0x8b45('0xa'),controller[_0x8b45('0xb')]);router[_0x8b45('0x9')]('/:id',auth[_0x8b45('0xc')](),controller[_0x8b45('0xd')]);router[_0x8b45('0x9')](_0x8b45('0xe'),auth[_0x8b45('0xc')](),controller['download']);var upload=multer({'storage':multer[_0x8b45('0xf')]({'destination':function(_0x7cc49b,_0x57faf9,_0x5316af){_0x5316af(null,path['join'](config['root'],_0x8b45('0x10')));},'filename':function(_0x285728,_0x37c220,_0x52c4db){_0x37c220[_0x8b45('0x11')]=_0x37c220[_0x8b45('0x11')][_0x8b45('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x52c4db(null,util[_0x8b45('0x13')](_0x8b45('0x14'),path[_0x8b45('0x15')](_0x37c220['originalname'],path['extname'](_0x37c220[_0x8b45('0x11')])),Date[_0x8b45('0x16')](),path[_0x8b45('0x17')](_0x37c220[_0x8b45('0x11')])));}})});router[_0x8b45('0x18')]('/',upload[_0x8b45('0x19')](_0x8b45('0x1a')),controller[_0x8b45('0x1b')]);router[_0x8b45('0x18')](_0x8b45('0xa'),controller[_0x8b45('0x1c')]);router[_0x8b45('0x1d')](_0x8b45('0x1e'),auth[_0x8b45('0xc')](),controller[_0x8b45('0x1f')]);router[_0x8b45('0x20')](_0x8b45('0x1e'),auth[_0x8b45('0xc')](),controller['delete']);module[_0x8b45('0x21')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index d138a67..21b2f87 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 _0xb925=['adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM'];(function(_0x21ce97,_0x10dbe9){var _0x10ad5e=function(_0x568e92){while(--_0x568e92){_0x21ce97['push'](_0x21ce97['shift']());}};_0x10ad5e(++_0x10dbe9);}(_0xb925,0x155));var _0x5b92=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xb925[_0x278e3c];return _0x3e2d9b;};'use strict';var Sequelize=require(_0x5b92('0x0'));module['exports']={'name':{'type':Sequelize[_0x5b92('0x1')]},'type':{'type':Sequelize['ENUM'](_0x5b92('0x2'),_0x5b92('0x3'))},'description':{'type':Sequelize[_0x5b92('0x4')]},'version':{'type':Sequelize[_0x5b92('0x4')]},'path':{'type':Sequelize[_0x5b92('0x1')],'comment':_0x5b92('0x5')},'active':{'type':Sequelize[_0x5b92('0x6')],'defaultValue':0x0,'comment':_0x5b92('0x7')},'sidebar':{'type':Sequelize[_0x5b92('0x8')](_0x5b92('0x9'),_0x5b92('0xa'),_0x5b92('0xb'),_0x5b92('0xc')),'defaultValue':'always','comment':_0x5b92('0xd')},'icon':{'type':Sequelize[_0x5b92('0x1')]},'adminUrl':{'type':Sequelize[_0x5b92('0x1')]},'agentUrl':{'type':Sequelize[_0x5b92('0x1')]},'scriptName':{'type':Sequelize[_0x5b92('0x1')]},'scriptPath':{'type':Sequelize[_0x5b92('0x1')]}}; \ No newline at end of file +var _0x1cf8=['adminOnly','always','sequelize','exports','STRING','script','TEXT','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x1cf8,0x160));var _0x81cf=function(_0x2f1753,_0x458f6d){_0x2f1753=_0x2f1753-0x0;var _0x56a164=_0x1cf8[_0x2f1753];return _0x56a164;};'use strict';var Sequelize=require(_0x81cf('0x0'));module[_0x81cf('0x1')]={'name':{'type':Sequelize[_0x81cf('0x2')]},'type':{'type':Sequelize['ENUM']('html',_0x81cf('0x3'))},'description':{'type':Sequelize[_0x81cf('0x4')]},'version':{'type':Sequelize[_0x81cf('0x4')]},'path':{'type':Sequelize[_0x81cf('0x2')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x81cf('0x5')],'defaultValue':0x0,'comment':_0x81cf('0x6')},'sidebar':{'type':Sequelize[_0x81cf('0x7')](_0x81cf('0x8'),'agentOnly','always','never'),'defaultValue':_0x81cf('0x9'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x81cf('0x2')]},'adminUrl':{'type':Sequelize[_0x81cf('0x2')]},'agentUrl':{'type':Sequelize[_0x81cf('0x2')]},'scriptName':{'type':Sequelize[_0x81cf('0x2')]},'scriptPath':{'type':Sequelize[_0x81cf('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 4240b02..64b98b3 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 _0x63fc=['ejs','jsforce','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','Plugin','includeAll','include','findAll','rows','catch','show','find','download','path','join','root','server/files/plugins','%s.zip','createWriteStream','warning','code','ENOENT','error','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','glob','**/*','dirname','basename','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','format','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','manifest.json','readFileSync','parse','undefined','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','html','test','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','plugins','create','body','userProfileId','role','user','Plugins','autoAssociation','Zip\x20archive\x20removed','params','webhookGet','resolve','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','port','encoding','method','%s%s','headers','content-length','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','content-type','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv'];(function(_0x295314,_0x17b250){var _0x584b0c=function(_0x51cc84){while(--_0x51cc84){_0x295314['push'](_0x295314['shift']());}};_0x584b0c(++_0x17b250);}(_0x63fc,0xa6));var _0xc63f=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x63fc[_0x2283dc];return _0x16db90;};'use strict';var emlformat=require(_0xc63f('0x0'));var rimraf=require(_0xc63f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc63f('0x2'));var moment=require(_0xc63f('0x3'));var BPromise=require(_0xc63f('0x4'));var Mustache=require(_0xc63f('0x5'));var util=require(_0xc63f('0x6'));var path=require('path');var sox=require(_0xc63f('0x7'));var csv=require(_0xc63f('0x8'));var ejs=require(_0xc63f('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(_0xc63f('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xc63f('0x8'));var querystring=require('querystring');var Papa=require(_0xc63f('0xb'));var extract=require(_0xc63f('0xc'));var rimraf=require(_0xc63f('0x1'));var archiver=require(_0xc63f('0xd'));var Redis=require(_0xc63f('0xe'));var authService=require(_0xc63f('0xf'));var qs=require(_0xc63f('0x10'));var as=require(_0xc63f('0x11'));var hardwareService=require(_0xc63f('0x12'));var logger=require(_0xc63f('0x13'))(_0xc63f('0x14'));var utils=require(_0xc63f('0x15'));var config=require(_0xc63f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc63f('0x17'))['db'];config['redis']=_[_0xc63f('0x18')](config[_0xc63f('0x19')],{'host':_0xc63f('0x1a'),'port':0x18eb});var socket=require(_0xc63f('0x1b'))(new Redis(config[_0xc63f('0x19')]));require(_0xc63f('0x1c'))[_0xc63f('0x1d')](socket);function respondWithStatusCode(_0x3196d5,_0x5b3983){_0x5b3983=_0x5b3983||0xcc;return function(_0x475c5d){if(_0x475c5d){return _0x3196d5[_0xc63f('0x1e')](_0x5b3983);}return _0x3196d5[_0xc63f('0x1f')](_0x5b3983)['end']();};}function respondWithResult(_0x2fbacb,_0x45b120){_0x45b120=_0x45b120||0xc8;return function(_0x8701c0){if(_0x8701c0){return _0x2fbacb[_0xc63f('0x1f')](_0x45b120)[_0xc63f('0x20')](_0x8701c0);}};}function respondWithFilteredResult(_0x59918c,_0x1a0256){return function(_0x1b486b){if(_0x1b486b){var _0x1477fc=typeof _0x1a0256[_0xc63f('0x21')]==='undefined'&&typeof _0x1a0256[_0xc63f('0x22')]==='undefined';var _0x44fa77=_0x1b486b['count'];var _0x3517c4=_0x1477fc?0x0:_0x1a0256[_0xc63f('0x21')];var _0x4d79d3=_0x1477fc?_0x1b486b[_0xc63f('0x23')]:_0x1a0256[_0xc63f('0x21')]+_0x1a0256[_0xc63f('0x22')];var _0x40138b;if(_0x4d79d3>=_0x44fa77){_0x4d79d3=_0x44fa77;_0x40138b=0xc8;}else{_0x40138b=0xce;}_0x59918c['status'](_0x40138b);return _0x59918c[_0xc63f('0x24')](_0xc63f('0x25'),_0x3517c4+'-'+_0x4d79d3+'/'+_0x44fa77)[_0xc63f('0x20')](_0x1b486b);}return null;};}function patchUpdates(_0x1b906e){return function(_0x34bcee){try{jsonpatch[_0xc63f('0x26')](_0x34bcee,_0x1b906e,!![]);}catch(_0x224c13){return BPromise[_0xc63f('0x27')](_0x224c13);}return _0x34bcee[_0xc63f('0x28')]();};}function saveUpdates(_0x9ddf05,_0x239aa1){return function(_0x1b0e7e){if(_0x1b0e7e){return _0x1b0e7e[_0xc63f('0x29')](_0x9ddf05)[_0xc63f('0x2a')](function(_0x3fba6e){return _0x3fba6e;});}return null;};}function removeEntity(_0x17ee98,_0x3989ad){return function(_0x13cdda){if(_0x13cdda){return _0x13cdda[_0xc63f('0x2b')]()[_0xc63f('0x2a')](function(){var _0x52abc4=_0x13cdda[_0xc63f('0x2c')]({'plain':!![]});var _0xc5f659='Plugins';return db[_0xc63f('0x2d')][_0xc63f('0x2b')]({'where':{'type':_0xc5f659,'resourceId':_0x52abc4['id']}})[_0xc63f('0x2a')](function(){return _0x13cdda;});})[_0xc63f('0x2a')](function(){_0x17ee98[_0xc63f('0x1f')](0xcc)[_0xc63f('0x2e')]();});}};}function handleEntityNotFound(_0x187a12,_0x17ed1b){return function(_0x2b62d1){if(!_0x2b62d1){_0x187a12[_0xc63f('0x1e')](0x194);}return _0x2b62d1;};}function handleError(_0x594cbe,_0xd970ff){_0xd970ff=_0xd970ff||0x1f4;return function(_0x2cd3c9){logger['error'](_0x2cd3c9[_0xc63f('0x2f')]);if(_0x2cd3c9['name']){delete _0x2cd3c9[_0xc63f('0x30')];}_0x594cbe[_0xc63f('0x1f')](_0xd970ff)[_0xc63f('0x31')](_0x2cd3c9);};}exports[_0xc63f('0x32')]=function(_0x6c3aea,_0x5c8640){var _0x3a6a80={},_0x11cc2c={},_0x283b1e={'count':0x0,'rows':[]};var _0x2e0a37=_[_0xc63f('0x33')](db['Plugin'][_0xc63f('0x34')],function(_0xe67bda){return{'name':_0xe67bda[_0xc63f('0x35')],'type':_0xe67bda['type'][_0xc63f('0x36')]};});_0x11cc2c[_0xc63f('0x37')]=_[_0xc63f('0x33')](_0x2e0a37,_0xc63f('0x30'));_0x11cc2c[_0xc63f('0x38')]=_[_0xc63f('0x39')](_0x6c3aea['query']);_0x11cc2c[_0xc63f('0x3a')]=_[_0xc63f('0x3b')](_0x11cc2c[_0xc63f('0x37')],_0x11cc2c['query']);_0x3a6a80[_0xc63f('0x3c')]=_[_0xc63f('0x3b')](_0x11cc2c['model'],qs['fields'](_0x6c3aea[_0xc63f('0x38')][_0xc63f('0x3d')]));_0x3a6a80[_0xc63f('0x3c')]=_0x3a6a80[_0xc63f('0x3c')][_0xc63f('0x3e')]?_0x3a6a80['attributes']:_0x11cc2c[_0xc63f('0x37')];if(!_0x6c3aea[_0xc63f('0x38')][_0xc63f('0x3f')](_0xc63f('0x40'))){_0x3a6a80[_0xc63f('0x22')]=qs[_0xc63f('0x22')](_0x6c3aea[_0xc63f('0x38')][_0xc63f('0x22')]);_0x3a6a80[_0xc63f('0x21')]=qs['offset'](_0x6c3aea['query'][_0xc63f('0x21')]);}_0x3a6a80[_0xc63f('0x41')]=qs['sort'](_0x6c3aea['query'][_0xc63f('0x42')]);_0x3a6a80['where']=qs[_0xc63f('0x3a')](_[_0xc63f('0x43')](_0x6c3aea[_0xc63f('0x38')],_0x11cc2c[_0xc63f('0x3a')]),_0x2e0a37);if(_0x6c3aea['query'][_0xc63f('0x44')]){_0x3a6a80['where']=_[_0xc63f('0x45')](_0x3a6a80[_0xc63f('0x46')],{'$or':_['map'](_0x2e0a37,function(_0x430689){if(_0x430689[_0xc63f('0x47')]!==_0xc63f('0x48')){var _0x3e53a3={};_0x3e53a3[_0x430689[_0xc63f('0x30')]]={'$like':'%'+_0x6c3aea[_0xc63f('0x38')]['filter']+'%'};return _0x3e53a3;}})});}_0x3a6a80=_[_0xc63f('0x45')]({},_0x3a6a80,_0x6c3aea[_0xc63f('0x49')]);var _0xf07583={'where':_0x3a6a80['where']};return db[_0xc63f('0x4a')]['count'](_0xf07583)['then'](function(_0x2994e8){_0x283b1e[_0xc63f('0x23')]=_0x2994e8;if(_0x6c3aea[_0xc63f('0x38')][_0xc63f('0x4b')]){_0x3a6a80[_0xc63f('0x4c')]=[{'all':!![]}];}return db[_0xc63f('0x4a')][_0xc63f('0x4d')](_0x3a6a80);})[_0xc63f('0x2a')](function(_0xea1174){_0x283b1e[_0xc63f('0x4e')]=_0xea1174;return _0x283b1e;})[_0xc63f('0x2a')](respondWithFilteredResult(_0x5c8640,_0x3a6a80))[_0xc63f('0x4f')](handleError(_0x5c8640,null));};exports[_0xc63f('0x50')]=function(_0x40f9cc,_0x5b6b23){var _0x24c093={'raw':!![],'where':{'id':_0x40f9cc['params']['id']}},_0x56a6b9={};_0x56a6b9[_0xc63f('0x37')]=_[_0xc63f('0x39')](db[_0xc63f('0x4a')]['rawAttributes']);_0x56a6b9[_0xc63f('0x38')]=_[_0xc63f('0x39')](_0x40f9cc[_0xc63f('0x38')]);_0x56a6b9['filters']=_[_0xc63f('0x3b')](_0x56a6b9['model'],_0x56a6b9['query']);_0x24c093[_0xc63f('0x3c')]=_[_0xc63f('0x3b')](_0x56a6b9[_0xc63f('0x37')],qs[_0xc63f('0x3d')](_0x40f9cc[_0xc63f('0x38')][_0xc63f('0x3d')]));_0x24c093[_0xc63f('0x3c')]=_0x24c093[_0xc63f('0x3c')][_0xc63f('0x3e')]?_0x24c093[_0xc63f('0x3c')]:_0x56a6b9[_0xc63f('0x37')];if(_0x40f9cc['query'][_0xc63f('0x4b')]){_0x24c093['include']=[{'all':!![]}];}_0x24c093=_[_0xc63f('0x45')]({},_0x24c093,_0x40f9cc[_0xc63f('0x49')]);return db['Plugin'][_0xc63f('0x51')](_0x24c093)[_0xc63f('0x2a')](handleEntityNotFound(_0x5b6b23,null))['then'](respondWithResult(_0x5b6b23,null))['catch'](handleError(_0x5b6b23,null));};exports[_0xc63f('0x52')]=function(_0x3ca8bc,_0x329924,_0x44d260){return db[_0xc63f('0x4a')][_0xc63f('0x51')]({'where':{'id':_0x3ca8bc['params']['id']},'attributes':[_0xc63f('0x30'),_0xc63f('0x53')],'raw':!![]})['then'](handleEntityNotFound(_0x329924,null))[_0xc63f('0x2a')](function(_0x5e7f3c){if(_0x5e7f3c){var _0x16c48d=path[_0xc63f('0x54')](config[_0xc63f('0x55')],_0xc63f('0x56'),util['format'](_0xc63f('0x57'),path['basename'](_0x5e7f3c[_0xc63f('0x53')])));var _0x22c4ed=fs[_0xc63f('0x58')](_0x16c48d);var _0x513d37=archiver('zip',{'zlib':{'level':0x9}});_0x513d37['on'](_0xc63f('0x59'),function(_0x2b311e){if(_0x2b311e[_0xc63f('0x5a')]===_0xc63f('0x5b')){logger[_0xc63f('0x5c')](_0x2b311e);}else{throw new db['Sequelize'][(_0xc63f('0x5d'))](_0xc63f('0x5e'));}});_0x513d37['on']('error',function(_0x1977d5){throw new db[(_0xc63f('0x5f'))][(_0xc63f('0x5d'))](_0xc63f('0x5e'));});_0x513d37['pipe'](_0x22c4ed);_0x513d37[_0xc63f('0x60')](_0xc63f('0x61'),{'cwd':path[_0xc63f('0x54')](config[_0xc63f('0x55')],_0xc63f('0x56'),path[_0xc63f('0x62')](_0x5e7f3c[_0xc63f('0x53')])),'ignore':[path[_0xc63f('0x54')](path[_0xc63f('0x63')](_0x5e7f3c['path']),_0xc63f('0x64')),path[_0xc63f('0x54')](path['basename'](_0x5e7f3c[_0xc63f('0x53')]),_0xc63f('0x65'))],'nodir':!![]})[_0xc63f('0x66')]();_0x22c4ed['on'](_0xc63f('0x67'),function(){if(!fs[_0xc63f('0x68')](_0x16c48d)){throw new db[(_0xc63f('0x5f'))]['Error'](_0xc63f('0x69'));}return _0x329924['download'](_0x16c48d,util[_0xc63f('0x6a')](_0xc63f('0x57'),path[_0xc63f('0x63')](_0x5e7f3c['path'])),function(_0x470a9e){if(_0x470a9e){throw new db['Sequelize'][(_0xc63f('0x5d'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xc63f('0x6b')](_0x16c48d);logger[_0xc63f('0x6c')](_0xc63f('0x6d'));logger['info'](_0xc63f('0x6e'));});});}return null;})[_0xc63f('0x4f')](handleError(_0x329924,null));};exports['upload']=function(_0x25cac3,_0x1cf363,_0x532d29){var _0x2ea0ba=path[_0xc63f('0x63')](_0x25cac3[_0xc63f('0x6f')][_0xc63f('0x70')],path[_0xc63f('0x71')](_0x25cac3['file'][_0xc63f('0x70')]));var _0x14994b=path[_0xc63f('0x54')](config[_0xc63f('0x55')],'server/files/plugins',_0x25cac3[_0xc63f('0x6f')][_0xc63f('0x70')]);var _0x1240d7=path['join'](config[_0xc63f('0x55')],_0xc63f('0x56'),_0x2ea0ba);logger[_0xc63f('0x6c')](_0xc63f('0x72'),_0x14994b);logger['info'](_0xc63f('0x73'),_0x1240d7);try{fs[_0xc63f('0x74')](_0x14994b,parseInt(_0xc63f('0x75'),0x8));extract(_0x14994b,{'dir':_0x1240d7},function(_0x4e9973){if(_0x4e9973){logger[_0xc63f('0x5c')](_0x4e9973);handleError(_0x4e9973,!![]);};var _0x1d9146=fs[_0xc63f('0x76')](_0x1240d7);if(_0x1d9146[_0xc63f('0x3e')]>0x1){removeReferences(_0x14994b,_0x1240d7);logger[_0xc63f('0x5c')]('Invalid\x20plugin\x20structure');return _0x532d29(new Error(_0xc63f('0x77')));}var _0x1eb3ff=fs['lstatSync'](path[_0xc63f('0x54')](_0x1240d7,_0x1d9146[0x0]));if(_0x1eb3ff[_0xc63f('0x78')]()){removeReferences(_0x14994b,_0x1240d7);logger[_0xc63f('0x5c')](_0xc63f('0x77'));return _0x532d29(new Error(_0xc63f('0x77')));}if(_0x1eb3ff[_0xc63f('0x79')]()){var _0x13d412=fs['readdirSync'](path[_0xc63f('0x54')](_0x1240d7,_0x1d9146[0x0]));if(_0x13d412[_0xc63f('0x3e')]===0x0){removeReferences(_0x14994b,_0x1240d7);logger[_0xc63f('0x5c')](_0xc63f('0x77'));return _0x532d29(new Error(_0xc63f('0x77')));}var _0x1ae538=_0x13d412['some'](function(_0x58397d){return _0x58397d===_0xc63f('0x7a');});if(!_0x1ae538){return _0x532d29(new Error('Plugin\x20manifest\x20missing'));}var _0xb8eb5=fs[_0xc63f('0x7b')](path['join'](_0x1240d7,_0x1d9146[0x0],_0xc63f('0x7a')));var _0x5b47ed=JSON[_0xc63f('0x7c')](_0xb8eb5);if(_0xc63f('0x7d')==typeof _0x5b47ed[_0xc63f('0x30')]){return _0x532d29(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xc63f('0x7d')==typeof _0x5b47ed[_0xc63f('0x47')]){return _0x532d29(new Error(_0xc63f('0x7e')));}if('undefined'==typeof _0x5b47ed[_0xc63f('0x7f')]){return _0x532d29(new Error(_0xc63f('0x80')));}if('undefined'==typeof _0x5b47ed[_0xc63f('0x81')]){return _0x532d29(new Error(_0xc63f('0x82')));}if(_0x5b47ed[_0xc63f('0x47')]==='html'){if(_0xc63f('0x7d')==typeof _0x5b47ed['parameters'][_0xc63f('0x83')]){return _0x532d29(new Error(_0xc63f('0x84')));}if(_0xc63f('0x7d')==typeof _0x5b47ed[_0xc63f('0x81')][_0xc63f('0x83')][_0xc63f('0x85')]&&_0xc63f('0x7d')==typeof _0x5b47ed['parameters'][_0xc63f('0x83')][_0xc63f('0x86')]){return _0x532d29(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x5b47ed[_0xc63f('0x47')]===_0xc63f('0x87')){if(_0xc63f('0x7d')==typeof _0x5b47ed[_0xc63f('0x81')][_0xc63f('0x88')]){return _0x532d29(new Error(_0xc63f('0x89')));}if(_0xc63f('0x7d')==typeof _0x5b47ed[_0xc63f('0x81')][_0xc63f('0x8a')]){return _0x532d29(new Error(_0xc63f('0x8b')));}}else{return _0x532d29(new Error(_0xc63f('0x8c')));}var _0x3a21f9=_0x5b47ed['name'];var _0x5b21e6=_0x5b47ed[_0xc63f('0x8d')];var _0x1dd31b=_0x5b47ed[_0xc63f('0x47')];var _0x5ee200=_0x5b47ed[_0xc63f('0x8e')]?_0x5b47ed['sidebar']:'always';var _0x54d4ee=_0x5b47ed[_0xc63f('0x8f')]?_0x5b47ed[_0xc63f('0x8f')]:_0xc63f('0x90');var _0x297bb8='';var _0x5895fa='';var _0x3b5866='';var _0x3bb2c5='';var _0x3cc7de=_0x5b47ed[_0xc63f('0x7f')];if(_0x1dd31b===_0xc63f('0x91')){if(_0xc63f('0x7d')!=typeof _0x5b47ed[_0xc63f('0x81')][_0xc63f('0x83')]['admin']){var _0x3609d1=_0x5b47ed[_0xc63f('0x81')][_0xc63f('0x83')][_0xc63f('0x85')];if(!/^(f|ht)tps?:\/\//i[_0xc63f('0x92')](_0x3609d1)){_0x297bb8=path[_0xc63f('0x54')]('plugins',_0x2ea0ba,_0x1d9146[0x0],_0x3609d1);}else{_0x297bb8=_0x3609d1;}}else{logger[_0xc63f('0x6c')](_0xc63f('0x93'));}if(_0xc63f('0x7d')!=typeof _0x5b47ed[_0xc63f('0x81')][_0xc63f('0x83')][_0xc63f('0x86')]){var _0x13e386=_0x5b47ed[_0xc63f('0x81')][_0xc63f('0x83')][_0xc63f('0x86')];if(!/^(f|ht)tps?:\/\//i['test'](_0x13e386)){_0x5895fa=path[_0xc63f('0x54')]('plugins',_0x2ea0ba,_0x1d9146[0x0],_0x13e386);}else{_0x5895fa=_0x13e386;}}else{logger[_0xc63f('0x6c')](_0xc63f('0x94'));}}else if(_0x1dd31b==='script'){_0x3b5866=_0x5b47ed['parameters']['scriptName'];_0x3bb2c5=_0x5b47ed[_0xc63f('0x81')][_0xc63f('0x8a')];if(_0xc63f('0x7d')!=typeof _0x5b47ed[_0xc63f('0x81')][_0xc63f('0x83')]){if('undefined'!=typeof _0x5b47ed['parameters'][_0xc63f('0x83')][_0xc63f('0x85')]){var _0x3609d1=_0x5b47ed[_0xc63f('0x81')]['views'][_0xc63f('0x85')];if(!/^(f|ht)tps?:\/\//i[_0xc63f('0x92')](_0x3609d1)){_0x297bb8=path[_0xc63f('0x54')](_0xc63f('0x95'),_0x2ea0ba,_0x1d9146[0x0],_0x3609d1);}else{_0x297bb8=_0x3609d1;}}if(_0xc63f('0x7d')!=typeof _0x5b47ed[_0xc63f('0x81')]['views']['agent']){var _0x13e386=_0x5b47ed[_0xc63f('0x81')][_0xc63f('0x83')][_0xc63f('0x86')];if(!/^(f|ht)tps?:\/\//i[_0xc63f('0x92')](_0x13e386)){_0x5895fa=path['join'](_0xc63f('0x95'),_0x2ea0ba,_0x1d9146[0x0],_0x13e386);}else{_0x5895fa=_0x13e386;}}}}var _0x507e1c={'name':_0x3a21f9,'description':_0x5b21e6,'path':path[_0xc63f('0x54')](_0x2ea0ba,_0x1d9146[0x0]),'type':_0x1dd31b,'sidebar':_0x5ee200,'icon':_0x54d4ee,'adminUrl':_0x297bb8,'agentUrl':_0x5895fa,'scriptName':_0x3b5866,'scriptPath':_0x3bb2c5,'version':_0x3cc7de};removeReferences(_0x14994b,null);return db[_0xc63f('0x4a')][_0xc63f('0x96')](_0x507e1c)[_0xc63f('0x2a')](function(_0x50e31a){var _0x1dc6bb={'role':_0x25cac3[_0xc63f('0x97')]['role'],'userProfileId':_0x25cac3[_0xc63f('0x97')][_0xc63f('0x98')]};if(!_0x1dc6bb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1dc6bb[_0xc63f('0x99')]===_0xc63f('0x9a')){var _0x506064=_0x50e31a[_0xc63f('0x2c')]({'plain':!![]});return db['UserProfileSection'][_0xc63f('0x51')]({'where':{'name':_0xc63f('0x9b'),'userProfileId':_0x1dc6bb[_0xc63f('0x98')]},'raw':!![]})[_0xc63f('0x2a')](function(_0x1b91f3){if(_0x1b91f3&&_0x1b91f3[_0xc63f('0x9c')]===0x0){return db['UserProfileResource']['create']({'name':_0x506064[_0xc63f('0x30')],'resourceId':_0x506064['id'],'type':_0x1b91f3[_0xc63f('0x30')],'sectionId':_0x1b91f3['id']},{})['then'](function(){return _0x50e31a;});}else{return _0x50e31a;}})[_0xc63f('0x4f')](function(_0x4e712e){logger[_0xc63f('0x5c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e712e);throw _0x4e712e;});}return _0x50e31a;})[_0xc63f('0x2a')](respondWithResult(_0x1cf363,null))[_0xc63f('0x4f')](handleError(_0x1cf363,null));}});}catch(_0x289898){_0x1cf363[_0xc63f('0x1f')](0x1f4)[_0xc63f('0x31')](_0x289898);}};function removeReferences(_0x24664d,_0x3b1413){try{if(_0x24664d){fs[_0xc63f('0x6b')](_0x24664d);logger[_0xc63f('0x6c')](_0xc63f('0x9d'));}if(_0x3b1413){rimraf(_0x3b1413,function(){});logger[_0xc63f('0x6c')]('Extracted\x20folder\x20removed');}}catch(_0x160485){logger[_0xc63f('0x5c')](_0x160485);}}exports['update']=function(_0x2305e5,_0x1d830e,_0x382e7c){return db[_0xc63f('0x4a')]['find']({'where':{'id':_0x2305e5[_0xc63f('0x9e')]['id']}})[_0xc63f('0x2a')](handleEntityNotFound(_0x1d830e,null))[_0xc63f('0x2a')](saveUpdates(_0x2305e5[_0xc63f('0x97')],null))['then'](respondWithResult(_0x1d830e,null))[_0xc63f('0x4f')](handleError(_0x1d830e,null));};exports['delete']=function(_0x1af7ab,_0x524ea8,_0x634156){return db[_0xc63f('0x4a')][_0xc63f('0x51')]({'where':{'id':_0x1af7ab[_0xc63f('0x9e')]['id']}})[_0xc63f('0x2a')](function(_0x18c8e0){if(_0x18c8e0){return _0x18c8e0[_0xc63f('0x2b')]();}})[_0xc63f('0x2a')](function(_0x2f12fc){rimraf(path['join'](config['root'],'server/files/plugins',path[_0xc63f('0x62')](_0x2f12fc[_0xc63f('0x53')])),function(){});return _0x2f12fc;})[_0xc63f('0x2a')](handleEntityNotFound(_0x524ea8,null))[_0xc63f('0x2a')](respondWithStatusCode(_0x524ea8,null))[_0xc63f('0x4f')](handleError(_0x524ea8,null));};exports[_0xc63f('0x9f')]=function(_0x13abc7,_0x2b9b47,_0x452bda){return BPromise[_0xc63f('0xa0')]()[_0xc63f('0x2a')](function(){if(!_0x13abc7[_0xc63f('0x38')][_0xc63f('0x53')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x13abc7['query']['port']){throw new Error(_0xc63f('0xa1'));}var _0x372a53=_0x13abc7[_0xc63f('0x38')][_0xc63f('0xa2')]?_0x13abc7['query'][_0xc63f('0xa2')]+':'+_0x13abc7[_0xc63f('0x38')]['port']:_0xc63f('0xa3')+_0x13abc7[_0xc63f('0x38')][_0xc63f('0xa4')];var _0x2ba256=_0x13abc7['query'][_0xc63f('0x20')]?_0x13abc7['query']['json']:!![];var _0x467243=_0x13abc7[_0xc63f('0x38')][_0xc63f('0xa5')]?_0x13abc7[_0xc63f('0x38')]['encoding']:null;var _0x3b4c7e={'method':_0x13abc7[_0xc63f('0xa6')],'uri':util[_0xc63f('0x6a')](_0xc63f('0xa7'),_0x372a53,_0x13abc7[_0xc63f('0x38')][_0xc63f('0x53')]),'json':_0x2ba256,'resolveWithFullResponse':!![],'encoding':_0x467243,'qs':_0x13abc7['query']};if(_0x13abc7['headers']){_0x3b4c7e[_0xc63f('0xa8')]=_0x13abc7[_0xc63f('0xa8')];if(_0x3b4c7e[_0xc63f('0xa8')][_0xc63f('0xa9')]){delete _0x3b4c7e[_0xc63f('0xa8')][_0xc63f('0xa9')];}}if(_0x3b4c7e['headers']['content-type']){delete _0x3b4c7e[_0xc63f('0xa8')]['content-type'];}return rp(_0x3b4c7e);})['then'](function(_0x3524a6){if(_0x3524a6){_0x2b9b47['set'](_0x3524a6[_0xc63f('0xa8')]);logger['info'](_0x3524a6[_0xc63f('0x97')]);if(_[_0xc63f('0xaa')](_0x13abc7['query'][_0xc63f('0x53')],_0xc63f('0x52'))&&_0x3524a6[_0xc63f('0xab')]==0x1f4){return _0x2b9b47[_0xc63f('0x1e')](_0x3524a6[_0xc63f('0xab')]);}else{return _0x2b9b47[_0xc63f('0x1f')](_0x3524a6['statusCode'])['send'](_0x3524a6['body']);}}else{return _0x2b9b47[_0xc63f('0x1e')](0xc8);}})[_0xc63f('0x4f')](handleError(_0x2b9b47,null));};exports[_0xc63f('0xac')]=function(_0x3e2f32,_0x5ec68,_0x3b8af9){return BPromise[_0xc63f('0xa0')]()['then'](function(){if(!_0x3e2f32['query'][_0xc63f('0x53')]){throw new Error(_0xc63f('0xad'));}if(!_0x3e2f32['query']['port']){throw new Error(_0xc63f('0xa1'));}var _0x1e7aaa=_0x3e2f32[_0xc63f('0x38')][_0xc63f('0xa2')]?_0x3e2f32[_0xc63f('0x38')][_0xc63f('0xa2')]+':'+_0x3e2f32[_0xc63f('0x38')][_0xc63f('0xa4')]:_0xc63f('0xa3')+_0x3e2f32[_0xc63f('0x38')][_0xc63f('0xa4')];var _0x1712fc=_0x3e2f32[_0xc63f('0x38')]['json']?_0x3e2f32[_0xc63f('0x38')][_0xc63f('0x20')]:!![];var _0x3348fc=_0x3e2f32[_0xc63f('0x38')][_0xc63f('0xa5')]?_0x3e2f32['query'][_0xc63f('0xa5')]:null;var _0xbaa84f={'method':_0x3e2f32[_0xc63f('0xa6')],'uri':util['format'](_0xc63f('0xa7'),_0x1e7aaa,_0x3e2f32[_0xc63f('0x38')][_0xc63f('0x53')]),'json':_0x1712fc,'resolveWithFullResponse':!![],'encoding':_0x3348fc,'body':_0x3e2f32['body']};if(_0x3e2f32[_0xc63f('0xa8')]){_0xbaa84f[_0xc63f('0xa8')]=_0x3e2f32['headers'];if(_0xbaa84f['headers'][_0xc63f('0xa9')]){delete _0xbaa84f[_0xc63f('0xa8')][_0xc63f('0xa9')];}}if(_0xbaa84f[_0xc63f('0xa8')][_0xc63f('0xae')]){delete _0xbaa84f[_0xc63f('0xa8')][_0xc63f('0xae')];}return rp(_0xbaa84f);})[_0xc63f('0x2a')](function(_0x5678cf){if(_0x5678cf){_0x5ec68[_0xc63f('0x24')](_0x5678cf['headers']);logger[_0xc63f('0x6c')](_0x5678cf['body']);return _0x5ec68[_0xc63f('0x1f')](_0x5678cf[_0xc63f('0xab')])[_0xc63f('0x31')](_0x5678cf[_0xc63f('0x97')]);}else{return _0x5ec68['sendStatus'](0xc8);}})['catch'](handleError(_0x5ec68,null));}; \ No newline at end of file +var _0xc707=['role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','send','Extracted\x20folder\x20removed','update','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','\x27PORT\x27\x20parameter\x20not\x20specified','method','eml-format','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','then','destroy','UserProfileResource','error','stack','name','index','map','fieldName','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','Plugin','findAll','rows','catch','show','params','rawAttributes','fields','includeAll','include','find','download','join','server/files/plugins','format','%s.zip','basename','warning','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Sequelize','unlinkSync','info','Download\x20completed','file','filename','extname','root','Plugin\x20upload\x20filepath:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','some','manifest.json','parse','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','icon-apps','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','script','create','body'];(function(_0x216b9a,_0x24724e){var _0x3b19b9=function(_0x8b994d){while(--_0x8b994d){_0x216b9a['push'](_0x216b9a['shift']());}};_0x3b19b9(++_0x24724e);}(_0xc707,0xbe));var _0x7c70=function(_0x1c36a8,_0x49c835){_0x1c36a8=_0x1c36a8-0x0;var _0xb622c5=_0xc707[_0x1c36a8];return _0xb622c5;};'use strict';var emlformat=require(_0x7c70('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7c70('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7c70('0x2'));var moment=require(_0x7c70('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7c70('0x4'));var util=require(_0x7c70('0x5'));var path=require(_0x7c70('0x6'));var sox=require('sox');var csv=require(_0x7c70('0x7'));var ejs=require(_0x7c70('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7c70('0x9'));var squel=require(_0x7c70('0xa'));var crypto=require(_0x7c70('0xb'));var jsforce=require(_0x7c70('0xc'));var deskjs=require(_0x7c70('0xd'));var toCsv=require(_0x7c70('0x7'));var querystring=require('querystring');var Papa=require(_0x7c70('0xe'));var extract=require(_0x7c70('0xf'));var rimraf=require('rimraf');var archiver=require(_0x7c70('0x10'));var Redis=require(_0x7c70('0x11'));var authService=require(_0x7c70('0x12'));var qs=require(_0x7c70('0x13'));var as=require(_0x7c70('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7c70('0x15'))(_0x7c70('0x16'));var utils=require(_0x7c70('0x17'));var config=require(_0x7c70('0x18'));var licenseUtil=require(_0x7c70('0x19'));var db=require(_0x7c70('0x1a'))['db'];config['redis']=_[_0x7c70('0x1b')](config['redis'],{'host':_0x7c70('0x1c'),'port':0x18eb});var socket=require(_0x7c70('0x1d'))(new Redis(config['redis']));require('./plugin.socket')[_0x7c70('0x1e')](socket);function respondWithStatusCode(_0x40f427,_0x307082){_0x307082=_0x307082||0xcc;return function(_0x3b8ae2){if(_0x3b8ae2){return _0x40f427[_0x7c70('0x1f')](_0x307082);}return _0x40f427[_0x7c70('0x20')](_0x307082)[_0x7c70('0x21')]();};}function respondWithResult(_0x5613d5,_0x449845){_0x449845=_0x449845||0xc8;return function(_0x5892ca){if(_0x5892ca){return _0x5613d5[_0x7c70('0x20')](_0x449845)[_0x7c70('0x22')](_0x5892ca);}};}function respondWithFilteredResult(_0x5abcc2,_0x2ac102){return function(_0x523243){if(_0x523243){var _0x8a7a38=typeof _0x2ac102[_0x7c70('0x23')]==='undefined'&&typeof _0x2ac102[_0x7c70('0x24')]===_0x7c70('0x25');var _0x42c831=_0x523243[_0x7c70('0x26')];var _0x23fa04=_0x8a7a38?0x0:_0x2ac102['offset'];var _0x286e5c=_0x8a7a38?_0x523243[_0x7c70('0x26')]:_0x2ac102[_0x7c70('0x23')]+_0x2ac102[_0x7c70('0x24')];var _0x5b2f57;if(_0x286e5c>=_0x42c831){_0x286e5c=_0x42c831;_0x5b2f57=0xc8;}else{_0x5b2f57=0xce;}_0x5abcc2[_0x7c70('0x20')](_0x5b2f57);return _0x5abcc2[_0x7c70('0x27')]('Content-Range',_0x23fa04+'-'+_0x286e5c+'/'+_0x42c831)[_0x7c70('0x22')](_0x523243);}return null;};}function patchUpdates(_0x3fc7f3){return function(_0x1f1991){try{jsonpatch[_0x7c70('0x28')](_0x1f1991,_0x3fc7f3,!![]);}catch(_0x52913d){return BPromise[_0x7c70('0x29')](_0x52913d);}return _0x1f1991[_0x7c70('0x2a')]();};}function saveUpdates(_0x5ea396,_0x17db21){return function(_0x2a4062){if(_0x2a4062){return _0x2a4062['update'](_0x5ea396)[_0x7c70('0x2b')](function(_0x242287){return _0x242287;});}return null;};}function removeEntity(_0x2407ca,_0x155ddb){return function(_0x592be4){if(_0x592be4){return _0x592be4[_0x7c70('0x2c')]()[_0x7c70('0x2b')](function(){var _0x377e5c=_0x592be4['get']({'plain':!![]});var _0x514256='Plugins';return db[_0x7c70('0x2d')]['destroy']({'where':{'type':_0x514256,'resourceId':_0x377e5c['id']}})[_0x7c70('0x2b')](function(){return _0x592be4;});})['then'](function(){_0x2407ca[_0x7c70('0x20')](0xcc)[_0x7c70('0x21')]();});}};}function handleEntityNotFound(_0x522a68,_0x5c3c74){return function(_0x4b67a2){if(!_0x4b67a2){_0x522a68['sendStatus'](0x194);}return _0x4b67a2;};}function handleError(_0x29444b,_0x54f9f0){_0x54f9f0=_0x54f9f0||0x1f4;return function(_0x1a11af){logger[_0x7c70('0x2e')](_0x1a11af[_0x7c70('0x2f')]);if(_0x1a11af[_0x7c70('0x30')]){delete _0x1a11af['name'];}_0x29444b[_0x7c70('0x20')](_0x54f9f0)['send'](_0x1a11af);};}exports[_0x7c70('0x31')]=function(_0x492964,_0x4ed05a){var _0x37aa8c={},_0x2d625a={},_0x71b15a={'count':0x0,'rows':[]};var _0x3e7bba=_[_0x7c70('0x32')](db['Plugin']['rawAttributes'],function(_0x255460){return{'name':_0x255460[_0x7c70('0x33')],'type':_0x255460['type']['key']};});_0x2d625a[_0x7c70('0x34')]=_['map'](_0x3e7bba,_0x7c70('0x30'));_0x2d625a[_0x7c70('0x35')]=_[_0x7c70('0x36')](_0x492964['query']);_0x2d625a['filters']=_[_0x7c70('0x37')](_0x2d625a[_0x7c70('0x34')],_0x2d625a[_0x7c70('0x35')]);_0x37aa8c[_0x7c70('0x38')]=_['intersection'](_0x2d625a[_0x7c70('0x34')],qs['fields'](_0x492964[_0x7c70('0x35')]['fields']));_0x37aa8c['attributes']=_0x37aa8c[_0x7c70('0x38')][_0x7c70('0x39')]?_0x37aa8c[_0x7c70('0x38')]:_0x2d625a['model'];if(!_0x492964['query'][_0x7c70('0x3a')](_0x7c70('0x3b'))){_0x37aa8c['limit']=qs[_0x7c70('0x24')](_0x492964[_0x7c70('0x35')][_0x7c70('0x24')]);_0x37aa8c[_0x7c70('0x23')]=qs[_0x7c70('0x23')](_0x492964[_0x7c70('0x35')][_0x7c70('0x23')]);}_0x37aa8c[_0x7c70('0x3c')]=qs[_0x7c70('0x3d')](_0x492964[_0x7c70('0x35')][_0x7c70('0x3d')]);_0x37aa8c[_0x7c70('0x3e')]=qs[_0x7c70('0x3f')](_['pick'](_0x492964['query'],_0x2d625a[_0x7c70('0x3f')]),_0x3e7bba);if(_0x492964[_0x7c70('0x35')][_0x7c70('0x40')]){_0x37aa8c[_0x7c70('0x3e')]=_[_0x7c70('0x41')](_0x37aa8c[_0x7c70('0x3e')],{'$or':_[_0x7c70('0x32')](_0x3e7bba,function(_0x4a6fb3){if(_0x4a6fb3[_0x7c70('0x42')]!==_0x7c70('0x43')){var _0x36bb67={};_0x36bb67[_0x4a6fb3[_0x7c70('0x30')]]={'$like':'%'+_0x492964[_0x7c70('0x35')][_0x7c70('0x40')]+'%'};return _0x36bb67;}})});}_0x37aa8c=_[_0x7c70('0x41')]({},_0x37aa8c,_0x492964[_0x7c70('0x44')]);var _0x5872c2={'where':_0x37aa8c['where']};return db[_0x7c70('0x45')][_0x7c70('0x26')](_0x5872c2)[_0x7c70('0x2b')](function(_0x135b84){_0x71b15a[_0x7c70('0x26')]=_0x135b84;if(_0x492964[_0x7c70('0x35')]['includeAll']){_0x37aa8c['include']=[{'all':!![]}];}return db[_0x7c70('0x45')][_0x7c70('0x46')](_0x37aa8c);})['then'](function(_0x303c2e){_0x71b15a[_0x7c70('0x47')]=_0x303c2e;return _0x71b15a;})['then'](respondWithFilteredResult(_0x4ed05a,_0x37aa8c))[_0x7c70('0x48')](handleError(_0x4ed05a,null));};exports[_0x7c70('0x49')]=function(_0x278fec,_0x568feb){var _0x440c98={'raw':!![],'where':{'id':_0x278fec[_0x7c70('0x4a')]['id']}},_0x59a0f2={};_0x59a0f2[_0x7c70('0x34')]=_[_0x7c70('0x36')](db[_0x7c70('0x45')][_0x7c70('0x4b')]);_0x59a0f2['query']=_['keys'](_0x278fec[_0x7c70('0x35')]);_0x59a0f2[_0x7c70('0x3f')]=_[_0x7c70('0x37')](_0x59a0f2['model'],_0x59a0f2[_0x7c70('0x35')]);_0x440c98[_0x7c70('0x38')]=_[_0x7c70('0x37')](_0x59a0f2[_0x7c70('0x34')],qs[_0x7c70('0x4c')](_0x278fec[_0x7c70('0x35')][_0x7c70('0x4c')]));_0x440c98[_0x7c70('0x38')]=_0x440c98['attributes']['length']?_0x440c98['attributes']:_0x59a0f2[_0x7c70('0x34')];if(_0x278fec[_0x7c70('0x35')][_0x7c70('0x4d')]){_0x440c98[_0x7c70('0x4e')]=[{'all':!![]}];}_0x440c98=_['merge']({},_0x440c98,_0x278fec[_0x7c70('0x44')]);return db[_0x7c70('0x45')][_0x7c70('0x4f')](_0x440c98)[_0x7c70('0x2b')](handleEntityNotFound(_0x568feb,null))[_0x7c70('0x2b')](respondWithResult(_0x568feb,null))['catch'](handleError(_0x568feb,null));};exports[_0x7c70('0x50')]=function(_0x191fa6,_0xaabce9,_0x20e178){return db[_0x7c70('0x45')][_0x7c70('0x4f')]({'where':{'id':_0x191fa6[_0x7c70('0x4a')]['id']},'attributes':['name',_0x7c70('0x6')],'raw':!![]})['then'](handleEntityNotFound(_0xaabce9,null))[_0x7c70('0x2b')](function(_0x2a7fb1){if(_0x2a7fb1){var _0x57f980=path[_0x7c70('0x51')](config['root'],_0x7c70('0x52'),util[_0x7c70('0x53')](_0x7c70('0x54'),path[_0x7c70('0x55')](_0x2a7fb1[_0x7c70('0x6')])));var _0x4d48e9=fs['createWriteStream'](_0x57f980);var _0x398029=archiver('zip',{'zlib':{'level':0x9}});_0x398029['on'](_0x7c70('0x56'),function(_0x274aba){if(_0x274aba[_0x7c70('0x57')]===_0x7c70('0x58')){logger[_0x7c70('0x2e')](_0x274aba);}else{throw new db['Sequelize'][(_0x7c70('0x59'))](_0x7c70('0x5a'));}});_0x398029['on'](_0x7c70('0x2e'),function(_0x35a167){throw new db['Sequelize'][(_0x7c70('0x59'))](_0x7c70('0x5a'));});_0x398029[_0x7c70('0x5b')](_0x4d48e9);_0x398029[_0x7c70('0x5c')](_0x7c70('0x5d'),{'cwd':path[_0x7c70('0x51')](config['root'],'server/files/plugins',path[_0x7c70('0x5e')](_0x2a7fb1['path'])),'ignore':[path[_0x7c70('0x51')](path[_0x7c70('0x55')](_0x2a7fb1[_0x7c70('0x6')]),_0x7c70('0x5f')),path[_0x7c70('0x51')](path[_0x7c70('0x55')](_0x2a7fb1['path']),_0x7c70('0x60'))],'nodir':!![]})[_0x7c70('0x61')]();_0x4d48e9['on'](_0x7c70('0x62'),function(){if(!fs[_0x7c70('0x63')](_0x57f980)){throw new db[(_0x7c70('0x64'))][(_0x7c70('0x59'))]('Plugin\x20not\x20found');}return _0xaabce9[_0x7c70('0x50')](_0x57f980,util[_0x7c70('0x53')](_0x7c70('0x54'),path['basename'](_0x2a7fb1[_0x7c70('0x6')])),function(_0x2286c4){if(_0x2286c4){throw new db[(_0x7c70('0x64'))][(_0x7c70('0x59'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x7c70('0x65')](_0x57f980);logger[_0x7c70('0x66')](_0x7c70('0x67'));logger[_0x7c70('0x66')]('Temporary\x20file\x20removed');});});}return null;})[_0x7c70('0x48')](handleError(_0xaabce9,null));};exports['upload']=function(_0x52297b,_0x33b2e6,_0x32ad71){var _0xc3db9f=path[_0x7c70('0x55')](_0x52297b[_0x7c70('0x68')][_0x7c70('0x69')],path[_0x7c70('0x6a')](_0x52297b[_0x7c70('0x68')]['filename']));var _0x2e768e=path['join'](config[_0x7c70('0x6b')],'server/files/plugins',_0x52297b['file'][_0x7c70('0x69')]);var _0x9c4879=path[_0x7c70('0x51')](config[_0x7c70('0x6b')],'server/files/plugins',_0xc3db9f);logger[_0x7c70('0x66')](_0x7c70('0x6c'),_0x2e768e);logger[_0x7c70('0x66')]('Plugin\x20upload\x20destination:\x20%s',_0x9c4879);try{fs[_0x7c70('0x6d')](_0x2e768e,parseInt('0777',0x8));extract(_0x2e768e,{'dir':_0x9c4879},function(_0x40e493){if(_0x40e493){logger[_0x7c70('0x2e')](_0x40e493);handleError(_0x40e493,!![]);};var _0x177655=fs[_0x7c70('0x6e')](_0x9c4879);if(_0x177655[_0x7c70('0x39')]>0x1){removeReferences(_0x2e768e,_0x9c4879);logger[_0x7c70('0x2e')](_0x7c70('0x6f'));return _0x32ad71(new Error(_0x7c70('0x6f')));}var _0x299105=fs['lstatSync'](path[_0x7c70('0x51')](_0x9c4879,_0x177655[0x0]));if(_0x299105[_0x7c70('0x70')]()){removeReferences(_0x2e768e,_0x9c4879);logger[_0x7c70('0x2e')]('Invalid\x20plugin\x20structure');return _0x32ad71(new Error('Invalid\x20plugin\x20structure'));}if(_0x299105[_0x7c70('0x71')]()){var _0x153090=fs[_0x7c70('0x6e')](path[_0x7c70('0x51')](_0x9c4879,_0x177655[0x0]));if(_0x153090[_0x7c70('0x39')]===0x0){removeReferences(_0x2e768e,_0x9c4879);logger[_0x7c70('0x2e')](_0x7c70('0x6f'));return _0x32ad71(new Error('Invalid\x20plugin\x20structure'));}var _0xdd3b4e=_0x153090[_0x7c70('0x72')](function(_0x585de0){return _0x585de0===_0x7c70('0x73');});if(!_0xdd3b4e){return _0x32ad71(new Error('Plugin\x20manifest\x20missing'));}var _0x16c7e0=fs['readFileSync'](path[_0x7c70('0x51')](_0x9c4879,_0x177655[0x0],'manifest.json'));var _0x3118bb=JSON[_0x7c70('0x74')](_0x16c7e0);if(_0x7c70('0x25')==typeof _0x3118bb[_0x7c70('0x30')]){return _0x32ad71(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x7c70('0x25')==typeof _0x3118bb['type']){return _0x32ad71(new Error(_0x7c70('0x75')));}if('undefined'==typeof _0x3118bb[_0x7c70('0x76')]){return _0x32ad71(new Error(_0x7c70('0x77')));}if(_0x7c70('0x25')==typeof _0x3118bb['parameters']){return _0x32ad71(new Error(_0x7c70('0x78')));}if(_0x3118bb[_0x7c70('0x42')]===_0x7c70('0x79')){if(_0x7c70('0x25')==typeof _0x3118bb[_0x7c70('0x7a')]['views']){return _0x32ad71(new Error(_0x7c70('0x7b')));}if(_0x7c70('0x25')==typeof _0x3118bb[_0x7c70('0x7a')][_0x7c70('0x7c')][_0x7c70('0x7d')]&&'undefined'==typeof _0x3118bb[_0x7c70('0x7a')][_0x7c70('0x7c')][_0x7c70('0x7e')]){return _0x32ad71(new Error(_0x7c70('0x7f')));}}else if(_0x3118bb[_0x7c70('0x42')]==='script'){if(_0x7c70('0x25')==typeof _0x3118bb[_0x7c70('0x7a')]['scriptName']){return _0x32ad71(new Error(_0x7c70('0x80')));}if('undefined'==typeof _0x3118bb[_0x7c70('0x7a')][_0x7c70('0x81')]){return _0x32ad71(new Error(_0x7c70('0x82')));}}else{return _0x32ad71(new Error(_0x7c70('0x83')));}var _0x1391d4=_0x3118bb['name'];var _0x51f1af=_0x3118bb['description'];var _0x2e2049=_0x3118bb[_0x7c70('0x42')];var _0x1293bd=_0x3118bb[_0x7c70('0x84')]?_0x3118bb[_0x7c70('0x84')]:'always';var _0x51a683=_0x3118bb['icon']?_0x3118bb['icon']:_0x7c70('0x85');var _0x4e9c93='';var _0x4940df='';var _0x20d58b='';var _0x200517='';var _0x20ee86=_0x3118bb[_0x7c70('0x76')];if(_0x2e2049===_0x7c70('0x79')){if('undefined'!=typeof _0x3118bb[_0x7c70('0x7a')][_0x7c70('0x7c')][_0x7c70('0x7d')]){var _0x19b6ad=_0x3118bb[_0x7c70('0x7a')][_0x7c70('0x7c')][_0x7c70('0x7d')];if(!/^(f|ht)tps?:\/\//i['test'](_0x19b6ad)){_0x4e9c93=path[_0x7c70('0x51')](_0x7c70('0x86'),_0xc3db9f,_0x177655[0x0],_0x19b6ad);}else{_0x4e9c93=_0x19b6ad;}}else{logger[_0x7c70('0x66')](_0x7c70('0x87'));}if(_0x7c70('0x25')!=typeof _0x3118bb[_0x7c70('0x7a')][_0x7c70('0x7c')]['agent']){var _0x510f08=_0x3118bb['parameters']['views'][_0x7c70('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x7c70('0x88')](_0x510f08)){_0x4940df=path[_0x7c70('0x51')](_0x7c70('0x86'),_0xc3db9f,_0x177655[0x0],_0x510f08);}else{_0x4940df=_0x510f08;}}else{logger[_0x7c70('0x66')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x2e2049===_0x7c70('0x89')){_0x20d58b=_0x3118bb[_0x7c70('0x7a')]['scriptName'];_0x200517=_0x3118bb['parameters'][_0x7c70('0x81')];if(_0x7c70('0x25')!=typeof _0x3118bb['parameters'][_0x7c70('0x7c')]){if(_0x7c70('0x25')!=typeof _0x3118bb[_0x7c70('0x7a')][_0x7c70('0x7c')]['admin']){var _0x19b6ad=_0x3118bb['parameters']['views'][_0x7c70('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x7c70('0x88')](_0x19b6ad)){_0x4e9c93=path['join'](_0x7c70('0x86'),_0xc3db9f,_0x177655[0x0],_0x19b6ad);}else{_0x4e9c93=_0x19b6ad;}}if(_0x7c70('0x25')!=typeof _0x3118bb[_0x7c70('0x7a')][_0x7c70('0x7c')][_0x7c70('0x7e')]){var _0x510f08=_0x3118bb[_0x7c70('0x7a')][_0x7c70('0x7c')][_0x7c70('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x7c70('0x88')](_0x510f08)){_0x4940df=path[_0x7c70('0x51')](_0x7c70('0x86'),_0xc3db9f,_0x177655[0x0],_0x510f08);}else{_0x4940df=_0x510f08;}}}}var _0x2da34e={'name':_0x1391d4,'description':_0x51f1af,'path':path[_0x7c70('0x51')](_0xc3db9f,_0x177655[0x0]),'type':_0x2e2049,'sidebar':_0x1293bd,'icon':_0x51a683,'adminUrl':_0x4e9c93,'agentUrl':_0x4940df,'scriptName':_0x20d58b,'scriptPath':_0x200517,'version':_0x20ee86};removeReferences(_0x2e768e,null);return db[_0x7c70('0x45')][_0x7c70('0x8a')](_0x2da34e)['then'](function(_0x58e02b){var _0x2c7364={'role':_0x52297b[_0x7c70('0x8b')][_0x7c70('0x8c')],'userProfileId':_0x52297b['body'][_0x7c70('0x8d')]};if(!_0x2c7364)throw new Error(_0x7c70('0x8e'));if(_0x2c7364['role']===_0x7c70('0x8f')){var _0x361503=_0x58e02b['get']({'plain':!![]});return db[_0x7c70('0x90')][_0x7c70('0x4f')]({'where':{'name':'Plugins','userProfileId':_0x2c7364['userProfileId']},'raw':!![]})[_0x7c70('0x2b')](function(_0x4d55fe){if(_0x4d55fe&&_0x4d55fe[_0x7c70('0x91')]===0x0){return db[_0x7c70('0x2d')][_0x7c70('0x8a')]({'name':_0x361503[_0x7c70('0x30')],'resourceId':_0x361503['id'],'type':_0x4d55fe[_0x7c70('0x30')],'sectionId':_0x4d55fe['id']},{})[_0x7c70('0x2b')](function(){return _0x58e02b;});}else{return _0x58e02b;}})['catch'](function(_0x39e7f4){logger[_0x7c70('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x39e7f4);throw _0x39e7f4;});}return _0x58e02b;})['then'](respondWithResult(_0x33b2e6,null))[_0x7c70('0x48')](handleError(_0x33b2e6,null));}});}catch(_0x5211ec){_0x33b2e6[_0x7c70('0x20')](0x1f4)[_0x7c70('0x92')](_0x5211ec);}};function removeReferences(_0x1d8d83,_0x27efbf){try{if(_0x1d8d83){fs[_0x7c70('0x65')](_0x1d8d83);logger['info']('Zip\x20archive\x20removed');}if(_0x27efbf){rimraf(_0x27efbf,function(){});logger[_0x7c70('0x66')](_0x7c70('0x93'));}}catch(_0x2fd8a6){logger['error'](_0x2fd8a6);}}exports[_0x7c70('0x94')]=function(_0x32510d,_0x2692de,_0x5ab9d8){return db[_0x7c70('0x45')]['find']({'where':{'id':_0x32510d['params']['id']}})[_0x7c70('0x2b')](handleEntityNotFound(_0x2692de,null))[_0x7c70('0x2b')](saveUpdates(_0x32510d[_0x7c70('0x8b')],null))[_0x7c70('0x2b')](respondWithResult(_0x2692de,null))[_0x7c70('0x48')](handleError(_0x2692de,null));};exports[_0x7c70('0x95')]=function(_0x522a92,_0x1e04e5,_0x5cfd01){return db['Plugin'][_0x7c70('0x4f')]({'where':{'id':_0x522a92[_0x7c70('0x4a')]['id']}})['then'](function(_0x7e023f){if(_0x7e023f){return _0x7e023f[_0x7c70('0x2c')]();}})[_0x7c70('0x2b')](function(_0x138666){rimraf(path[_0x7c70('0x51')](config[_0x7c70('0x6b')],_0x7c70('0x52'),path[_0x7c70('0x5e')](_0x138666[_0x7c70('0x6')])),function(){});return _0x138666;})[_0x7c70('0x2b')](handleEntityNotFound(_0x1e04e5,null))[_0x7c70('0x2b')](respondWithStatusCode(_0x1e04e5,null))[_0x7c70('0x48')](handleError(_0x1e04e5,null));};exports[_0x7c70('0x96')]=function(_0x31077a,_0x2779f9,_0x4d65f3){return BPromise[_0x7c70('0x97')]()['then'](function(){if(!_0x31077a[_0x7c70('0x35')][_0x7c70('0x6')]){throw new Error(_0x7c70('0x98'));}if(!_0x31077a['query'][_0x7c70('0x99')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x189a67=_0x31077a[_0x7c70('0x35')][_0x7c70('0x9a')]?_0x31077a['query'][_0x7c70('0x9a')]+':'+_0x31077a[_0x7c70('0x35')][_0x7c70('0x99')]:_0x7c70('0x9b')+_0x31077a[_0x7c70('0x35')]['port'];var _0x25f83b=_0x31077a['query']['json']?_0x31077a[_0x7c70('0x35')]['json']:!![];var _0xe14bd3=_0x31077a[_0x7c70('0x35')]['encoding']?_0x31077a[_0x7c70('0x35')][_0x7c70('0x9c')]:null;var _0x484437={'method':_0x31077a['method'],'uri':util[_0x7c70('0x53')](_0x7c70('0x9d'),_0x189a67,_0x31077a[_0x7c70('0x35')][_0x7c70('0x6')]),'json':_0x25f83b,'resolveWithFullResponse':!![],'encoding':_0xe14bd3,'qs':_0x31077a[_0x7c70('0x35')]};if(_0x31077a[_0x7c70('0x9e')]){_0x484437[_0x7c70('0x9e')]=_0x31077a[_0x7c70('0x9e')];if(_0x484437[_0x7c70('0x9e')]['content-length']){delete _0x484437[_0x7c70('0x9e')][_0x7c70('0x9f')];}}if(_0x484437[_0x7c70('0x9e')][_0x7c70('0xa0')]){delete _0x484437['headers']['content-type'];}return rp(_0x484437);})[_0x7c70('0x2b')](function(_0xb1e4cd){if(_0xb1e4cd){_0x2779f9[_0x7c70('0x27')](_0xb1e4cd['headers']);logger[_0x7c70('0x66')](_0xb1e4cd[_0x7c70('0x8b')]);if(_[_0x7c70('0xa1')](_0x31077a[_0x7c70('0x35')][_0x7c70('0x6')],_0x7c70('0x50'))&&_0xb1e4cd[_0x7c70('0xa2')]==0x1f4){return _0x2779f9[_0x7c70('0x1f')](_0xb1e4cd['statusCode']);}else{return _0x2779f9[_0x7c70('0x20')](_0xb1e4cd[_0x7c70('0xa2')])['send'](_0xb1e4cd[_0x7c70('0x8b')]);}}else{return _0x2779f9[_0x7c70('0x1f')](0xc8);}})[_0x7c70('0x48')](handleError(_0x2779f9,null));};exports['webhookPost']=function(_0xe71791,_0x58549e,_0x447650){return BPromise[_0x7c70('0x97')]()['then'](function(){if(!_0xe71791[_0x7c70('0x35')][_0x7c70('0x6')]){throw new Error(_0x7c70('0x98'));}if(!_0xe71791[_0x7c70('0x35')][_0x7c70('0x99')]){throw new Error(_0x7c70('0xa3'));}var _0x176e3a=_0xe71791[_0x7c70('0x35')][_0x7c70('0x9a')]?_0xe71791[_0x7c70('0x35')][_0x7c70('0x9a')]+':'+_0xe71791[_0x7c70('0x35')][_0x7c70('0x99')]:_0x7c70('0x9b')+_0xe71791[_0x7c70('0x35')][_0x7c70('0x99')];var _0x37fc13=_0xe71791[_0x7c70('0x35')][_0x7c70('0x22')]?_0xe71791[_0x7c70('0x35')][_0x7c70('0x22')]:!![];var _0x1c4ef8=_0xe71791['query'][_0x7c70('0x9c')]?_0xe71791[_0x7c70('0x35')]['encoding']:null;var _0xec66ef={'method':_0xe71791[_0x7c70('0xa4')],'uri':util[_0x7c70('0x53')](_0x7c70('0x9d'),_0x176e3a,_0xe71791['query'][_0x7c70('0x6')]),'json':_0x37fc13,'resolveWithFullResponse':!![],'encoding':_0x1c4ef8,'body':_0xe71791[_0x7c70('0x8b')]};if(_0xe71791[_0x7c70('0x9e')]){_0xec66ef['headers']=_0xe71791[_0x7c70('0x9e')];if(_0xec66ef[_0x7c70('0x9e')][_0x7c70('0x9f')]){delete _0xec66ef[_0x7c70('0x9e')][_0x7c70('0x9f')];}}if(_0xec66ef['headers'][_0x7c70('0xa0')]){delete _0xec66ef[_0x7c70('0x9e')][_0x7c70('0xa0')];}return rp(_0xec66ef);})[_0x7c70('0x2b')](function(_0x261d2a){if(_0x261d2a){_0x58549e[_0x7c70('0x27')](_0x261d2a[_0x7c70('0x9e')]);logger[_0x7c70('0x66')](_0x261d2a[_0x7c70('0x8b')]);return _0x58549e[_0x7c70('0x20')](_0x261d2a['statusCode'])[_0x7c70('0x92')](_0x261d2a[_0x7c70('0x8b')]);}else{return _0x58549e[_0x7c70('0x1f')](0xc8);}})[_0x7c70('0x48')](handleError(_0x58549e,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 5a55697..a7aa032 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 _0x80c3=['events','setMaxListeners','update','remove','emit','hook','exports'];(function(_0x4b609d,_0x5176f0){var _0x4c36d4=function(_0x25f10d){while(--_0x25f10d){_0x4b609d['push'](_0x4b609d['shift']());}};_0x4c36d4(++_0x5176f0);}(_0x80c3,0x18f));var _0x380c=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x80c3[_0x491a7f];return _0x3d8f44;};'use strict';var EventEmitter=require(_0x380c('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x380c('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x380c('0x2'),'afterDestroy':_0x380c('0x3')};function emitEvent(_0x24728a){return function(_0x52fd7e,_0x565a08,_0x553158){PluginEvents[_0x380c('0x4')](_0x24728a+':'+_0x52fd7e['id'],_0x52fd7e);PluginEvents['emit'](_0x24728a,_0x52fd7e);_0x553158(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x380c('0x5')](e,emitEvent(event));}}module[_0x380c('0x6')]=PluginEvents; \ No newline at end of file +var _0x7dee=['remove','emit','hasOwnProperty','hook','exports','events','Plugin','save','update'];(function(_0x37ffc6,_0x251b7f){var _0x47faac=function(_0x2c8090){while(--_0x2c8090){_0x37ffc6['push'](_0x37ffc6['shift']());}};_0x47faac(++_0x251b7f);}(_0x7dee,0xb0));var _0xe7de=function(_0x50f7ac,_0x13c3fe){_0x50f7ac=_0x50f7ac-0x0;var _0x577434=_0x7dee[_0x50f7ac];return _0x577434;};'use strict';var EventEmitter=require(_0xe7de('0x0'));var Plugin=require('../../mysqldb')['db'][_0xe7de('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe7de('0x2'),'afterUpdate':_0xe7de('0x3'),'afterDestroy':_0xe7de('0x4')};function emitEvent(_0x168aff){return function(_0x4b846b,_0x12be83,_0x544df8){PluginEvents[_0xe7de('0x5')](_0x168aff+':'+_0x4b846b['id'],_0x4b846b);PluginEvents[_0xe7de('0x5')](_0x168aff,_0x4b846b);_0x544df8(null);};}for(var e in events){if(events[_0xe7de('0x6')](e)){var event=events[e];Plugin[_0xe7de('0x7')](e,emitEvent(event));}}module[_0xe7de('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index cdb6c52..953f667 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 _0x567f=['rimraf','../../config/environment','./plugin.attributes','exports','plugins','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x5d0e7b,_0x541ed1){var _0x400159=function(_0x4c582a){while(--_0x4c582a){_0x5d0e7b['push'](_0x5d0e7b['shift']());}};_0x400159(++_0x541ed1);}(_0x567f,0x123));var _0xf567=function(_0x1b4912,_0x3e8bb9){_0x1b4912=_0x1b4912-0x0;var _0x48cac5=_0x567f[_0x1b4912];return _0x48cac5;};'use strict';var _=require(_0xf567('0x0'));var util=require(_0xf567('0x1'));var logger=require(_0xf567('0x2'))('api');var moment=require(_0xf567('0x3'));var BPromise=require(_0xf567('0x4'));var rp=require(_0xf567('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf567('0x6'));var config=require(_0xf567('0x7'));var attributes=require(_0xf567('0x8'));module[_0xf567('0x9')]=function(_0x52cf79,_0x28c81f){return _0x52cf79['define']('Plugin',attributes,{'tableName':_0xf567('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc788=['api','moment','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','lodash','util'];(function(_0x536609,_0x5c04af){var _0x1f5983=function(_0x3bd1c8){while(--_0x3bd1c8){_0x536609['push'](_0x536609['shift']());}};_0x1f5983(++_0x5c04af);}(_0xc788,0x82));var _0x8c78=function(_0x58fa7f,_0x4ed6e3){_0x58fa7f=_0x58fa7f-0x0;var _0x526007=_0xc788[_0x58fa7f];return _0x526007;};'use strict';var _=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var logger=require('../../config/logger')(_0x8c78('0x2'));var moment=require(_0x8c78('0x3'));var BPromise=require('bluebird');var rp=require(_0x8c78('0x4'));var fs=require('fs');var path=require(_0x8c78('0x5'));var rimraf=require(_0x8c78('0x6'));var config=require(_0x8c78('0x7'));var attributes=require(_0x8c78('0x8'));module[_0x8c78('0x9')]=function(_0x46ddf4,_0x528247){return _0x46ddf4[_0x8c78('0xa')](_0x8c78('0xb'),attributes,{'tableName':'plugins','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 5bd3857..65774d2 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 _0xba1b=['then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreatePlugin','Plugin','create','body','options','raw','util','moment','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request'];(function(_0x23bcf2,_0x1c6764){var _0x16dff4=function(_0x585464){while(--_0x585464){_0x23bcf2['push'](_0x23bcf2['shift']());}};_0x16dff4(++_0x1c6764);}(_0xba1b,0x1d1));var _0xbba1=function(_0x51f64a,_0x14307e){_0x51f64a=_0x51f64a-0x0;var _0x41be2b=_0xba1b[_0x51f64a];return _0x41be2b;};'use strict';var _=require('lodash');var util=require(_0xbba1('0x0'));var moment=require(_0xbba1('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbba1('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbba1('0x3'));var config=require(_0xbba1('0x4'));var jayson=require(_0xbba1('0x5'));var client=jayson[_0xbba1('0x6')][_0xbba1('0x7')]({'port':0x232a});config[_0xbba1('0x8')]=_[_0xbba1('0x9')](config[_0xbba1('0x8')],{'host':_0xbba1('0xa'),'port':0x18eb});var socket=require(_0xbba1('0xb'))(new Redis(config[_0xbba1('0x8')]));require(_0xbba1('0xc'))[_0xbba1('0xd')](socket);function respondWithRpcPromise(_0x20d0cf,_0x1a8e81,_0x6ce23a){return new BPromise(function(_0x4dbb4a,_0x4227d4){return client[_0xbba1('0xe')](_0x20d0cf,_0x6ce23a)[_0xbba1('0xf')](function(_0x32bfaa){logger[_0xbba1('0x10')](_0xbba1('0x11'),_0x1a8e81,_0xbba1('0x12'));logger[_0xbba1('0x13')](_0xbba1('0x14'),_0x1a8e81,_0xbba1('0x12'),JSON[_0xbba1('0x15')](_0x32bfaa));if(_0x32bfaa[_0xbba1('0x16')]){if(_0x32bfaa[_0xbba1('0x16')]['code']===0x1f4){logger[_0xbba1('0x16')](_0xbba1('0x11'),_0x1a8e81,_0x32bfaa['error']['message']);return _0x4227d4(_0x32bfaa[_0xbba1('0x16')][_0xbba1('0x17')]);}logger[_0xbba1('0x16')](_0xbba1('0x11'),_0x1a8e81,_0x32bfaa[_0xbba1('0x16')][_0xbba1('0x17')]);return _0x4dbb4a(_0x32bfaa[_0xbba1('0x16')]['message']);}else{logger[_0xbba1('0x10')]('Plugin,\x20%s,\x20%s',_0x1a8e81,_0xbba1('0x12'));_0x4dbb4a(_0x32bfaa[_0xbba1('0x18')][_0xbba1('0x17')]);}})[_0xbba1('0x19')](function(_0x57b5a2){logger[_0xbba1('0x16')]('Plugin,\x20%s,\x20%s',_0x1a8e81,_0x57b5a2);_0x4227d4(_0x57b5a2);});});}exports[_0xbba1('0x1a')]=function(_0x4527b9){var _0x8183ac=this;return new Promise(function(_0x194725,_0xda95d3){return db[_0xbba1('0x1b')][_0xbba1('0x1c')](_0x4527b9[_0xbba1('0x1d')],{'raw':_0x4527b9[_0xbba1('0x1e')]?_0x4527b9[_0xbba1('0x1e')][_0xbba1('0x1f')]===undefined?!![]:![]:!![]})[_0xbba1('0xf')](function(_0x29115c){logger[_0xbba1('0x10')](_0xbba1('0x1a'),_0x4527b9);logger[_0xbba1('0x13')](_0xbba1('0x1a'),_0x4527b9,JSON[_0xbba1('0x15')](_0x29115c));_0x194725(_0x29115c);})['catch'](function(_0x2853c4){logger[_0xbba1('0x16')]('CreatePlugin',_0x2853c4['message'],_0x4527b9);_0xda95d3(_0x8183ac[_0xbba1('0x16')](0x1f4,_0x2853c4[_0xbba1('0x17')]));});});}; \ No newline at end of file +var _0x92f1=['redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','create','body','options','raw','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x92f1,0x1a3));var _0x192f=function(_0x1e2b7f,_0x4ed0b1){_0x1e2b7f=_0x1e2b7f-0x0;var _0x49eca0=_0x92f1[_0x1e2b7f];return _0x49eca0;};'use strict';var _=require(_0x192f('0x0'));var util=require(_0x192f('0x1'));var moment=require(_0x192f('0x2'));var BPromise=require(_0x192f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x192f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x192f('0x5'));var logger=require('../../config/logger')(_0x192f('0x6'));var config=require('../../config/environment');var jayson=require(_0x192f('0x7'));var client=jayson[_0x192f('0x8')][_0x192f('0x9')]({'port':0x232a});config[_0x192f('0xa')]=_[_0x192f('0xb')](config[_0x192f('0xa')],{'host':_0x192f('0xc'),'port':0x18eb});var socket=require(_0x192f('0xd'))(new Redis(config['redis']));require(_0x192f('0xe'))[_0x192f('0xf')](socket);function respondWithRpcPromise(_0x1759f6,_0x2d0d64,_0xc27bba){return new BPromise(function(_0x3e7d00,_0x196c8a){return client['request'](_0x1759f6,_0xc27bba)[_0x192f('0x10')](function(_0x1d9f87){logger[_0x192f('0x11')](_0x192f('0x12'),_0x2d0d64,_0x192f('0x13'));logger[_0x192f('0x14')](_0x192f('0x15'),_0x2d0d64,_0x192f('0x13'),JSON[_0x192f('0x16')](_0x1d9f87));if(_0x1d9f87[_0x192f('0x17')]){if(_0x1d9f87[_0x192f('0x17')][_0x192f('0x18')]===0x1f4){logger[_0x192f('0x17')](_0x192f('0x12'),_0x2d0d64,_0x1d9f87['error']['message']);return _0x196c8a(_0x1d9f87['error'][_0x192f('0x19')]);}logger['error'](_0x192f('0x12'),_0x2d0d64,_0x1d9f87[_0x192f('0x17')][_0x192f('0x19')]);return _0x3e7d00(_0x1d9f87['error']['message']);}else{logger[_0x192f('0x11')]('Plugin,\x20%s,\x20%s',_0x2d0d64,_0x192f('0x13'));_0x3e7d00(_0x1d9f87[_0x192f('0x1a')][_0x192f('0x19')]);}})[_0x192f('0x1b')](function(_0x218cb5){logger[_0x192f('0x17')](_0x192f('0x12'),_0x2d0d64,_0x218cb5);_0x196c8a(_0x218cb5);});});}exports[_0x192f('0x1c')]=function(_0x5d0fd9){var _0x495986=this;return new Promise(function(_0x2112a5,_0x41f45a){return db['Plugin'][_0x192f('0x1d')](_0x5d0fd9[_0x192f('0x1e')],{'raw':_0x5d0fd9[_0x192f('0x1f')]?_0x5d0fd9[_0x192f('0x1f')][_0x192f('0x20')]===undefined?!![]:![]:!![]})[_0x192f('0x10')](function(_0x298911){logger[_0x192f('0x11')]('CreatePlugin',_0x5d0fd9);logger[_0x192f('0x14')](_0x192f('0x1c'),_0x5d0fd9,JSON[_0x192f('0x16')](_0x298911));_0x2112a5(_0x298911);})[_0x192f('0x1b')](function(_0x27dc01){logger[_0x192f('0x17')](_0x192f('0x1c'),_0x27dc01['message'],_0x5d0fd9);_0x41f45a(_0x495986[_0x192f('0x17')](0x1f4,_0x27dc01[_0x192f('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 6bf3ec9..0a4e19e 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 _0x4fb9=['removeListener','register','length','save','emit'];(function(_0x12424e,_0x583e0e){var _0x262777=function(_0x17369a){while(--_0x17369a){_0x12424e['push'](_0x12424e['shift']());}};_0x262777(++_0x583e0e);}(_0x4fb9,0xda));var _0x94fb=function(_0x22b2b1,_0x37aa47){_0x22b2b1=_0x22b2b1-0x0;var _0x5b6fa5=_0x4fb9[_0x22b2b1];return _0x5b6fa5;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x94fb('0x0'),'remove','update'];function createListener(_0x1aff75,_0x2c669d){return function(_0x172ded){_0x2c669d[_0x94fb('0x1')](_0x1aff75,_0x172ded);};}function removeListener(_0x3c090e,_0x485393){return function(){PluginEvents[_0x94fb('0x2')](_0x3c090e,_0x485393);};}exports[_0x94fb('0x3')]=function(_0x1aeb85){for(var _0x70f721=0x0,_0x5cce33=events[_0x94fb('0x4')];_0x70f721<_0x5cce33;_0x70f721++){var _0x27458c=events[_0x70f721];var _0x1382aa=createListener('plugin:'+_0x27458c,_0x1aeb85);PluginEvents['on'](_0x27458c,_0x1382aa);}}; \ No newline at end of file +var _0xa8fa=['emit','removeListener','register','length','plugin:','save'];(function(_0x1eb42c,_0x35c7b7){var _0x5df39a=function(_0x281a17){while(--_0x281a17){_0x1eb42c['push'](_0x1eb42c['shift']());}};_0x5df39a(++_0x35c7b7);}(_0xa8fa,0x18b));var _0xaa8f=function(_0x46a3e8,_0x2e1b35){_0x46a3e8=_0x46a3e8-0x0;var _0xf1442e=_0xa8fa[_0x46a3e8];return _0xf1442e;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xaa8f('0x0'),'remove','update'];function createListener(_0x2de228,_0x3771e2){return function(_0x55e918){_0x3771e2[_0xaa8f('0x1')](_0x2de228,_0x55e918);};}function removeListener(_0x3b263c,_0x4ef9ad){return function(){PluginEvents[_0xaa8f('0x2')](_0x3b263c,_0x4ef9ad);};}exports[_0xaa8f('0x3')]=function(_0x4cd2f2){for(var _0x5eee24=0x0,_0x20c059=events[_0xaa8f('0x4')];_0x5eee24<_0x20c059;_0x5eee24++){var _0x4202d8=events[_0x5eee24];var _0xae7dc0=createListener(_0xaa8f('0x5')+_0x4202d8,_0x4cd2f2);PluginEvents['on'](_0x4202d8,_0xae7dc0);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index d964996..6322809 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(_0xc625a,_0x4f8ceb){var _0x2d4677=function(_0x3947f3){while(--_0x3947f3){_0xc625a['push'](_0xc625a['shift']());}};_0x2d4677(++_0x4f8ceb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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(_0x41823a,_0x4c292b){var _0x23d2f2=function(_0x34f726){while(--_0x34f726){_0x41823a['push'](_0x41823a['shift']());}};_0x23d2f2(++_0x4c292b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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 36f7e65..0421d8b 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 _0x2f68=['dump','Unknown\x20id','../../config/pm2','../../config/logger','api','path','exec','sendStatus','status','error','name','send','npm\x20install','info','index','list','then','reject','express','motion2','length','catch','show','describe','params','create','body','join','../../files/plugins','chdir','dirname','start','Missing\x20name\x20and/or\x20path','restart','stop','Unknown\x20status','destroy','delete'];(function(_0x51432d,_0x5f16d9){var _0x1f9737=function(_0x1a30f9){while(--_0x1a30f9){_0x51432d['push'](_0x51432d['shift']());}};_0x1f9737(++_0x5f16d9);}(_0x2f68,0x9a));var _0x82f6=function(_0x2d2a44,_0x33851d){_0x2d2a44=_0x2d2a44-0x0;var _0x2da3c4=_0x2f68[_0x2d2a44];return _0x2da3c4;};'use strict';var _=require('lodash');var pm2=require(_0x82f6('0x0'));var logger=require(_0x82f6('0x1'))(_0x82f6('0x2'));var path=require(_0x82f6('0x3'));var exec=require('child_process')[_0x82f6('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x2a06dc,_0x2ab73d){return function(_0x5dad09){if(!_0x5dad09){_0x2a06dc[_0x82f6('0x5')](0x194);;}return _0x5dad09;};}function respondWithResult(_0x2c4302,_0x542737){_0x542737=_0x542737||0xc8;return function(_0x5a8089){if(_0x5a8089){return _0x2c4302[_0x82f6('0x6')](_0x542737)['json'](_0x5a8089);}return null;};}function handleError(_0x5daa3c,_0x864400){_0x864400=_0x864400||0x1f4;return function(_0xbd30d5){logger[_0x82f6('0x7')](_0xbd30d5['stack']);if(_0xbd30d5[_0x82f6('0x8')]){delete _0xbd30d5[_0x82f6('0x8')];}_0x5daa3c['status'](_0x864400)[_0x82f6('0x9')](_0xbd30d5);};}function execChildProcess(){return new BPromise(function(_0x1eec2f,_0x3f8320){exec(_0x82f6('0xa'),function(_0x1a68c4,_0x34bd7c,_0x4c870e){logger[_0x82f6('0xb')](_0x34bd7c);logger[_0x82f6('0xb')](_0x4c870e);if(_0x1a68c4){logger['error'](_0x1a68c4);return _0x3f8320(_0x1a68c4);}return _0x1eec2f(_0x34bd7c);});});}exports[_0x82f6('0xc')]=function(_0x1f8bf5,_0x397527){return pm2[_0x82f6('0xd')]()[_0x82f6('0xe')](function(_0xa00275){if(_0xa00275){var _0x115c7b=_[_0x82f6('0xf')](_0xa00275,function(_0x1e7cbc){return _0x1e7cbc['name']===_0x82f6('0x10')||_0x1e7cbc['name']===_0x82f6('0x11');});return{'rows':_0x115c7b,'count':_0x115c7b[_0x82f6('0x12')]};}return null;})[_0x82f6('0xe')](respondWithResult(_0x397527,null))[_0x82f6('0x13')](handleError(_0x397527,null));};exports[_0x82f6('0x14')]=function(_0x2326ae,_0x326378){return pm2[_0x82f6('0x15')](_0x2326ae[_0x82f6('0x16')]['id'])[_0x82f6('0xe')](respondWithResult(_0x326378,null))[_0x82f6('0xe')](handleEntityNotFound(_0x326378,null))[_0x82f6('0x13')](handleError(_0x326378,null));};exports[_0x82f6('0x17')]=function(_0x4fe226,_0x3a8269){if(_0x4fe226['body'][_0x82f6('0x8')]&&_0x4fe226[_0x82f6('0x18')]['script']){var _0x2b03ad=path[_0x82f6('0x19')](__dirname,_0x82f6('0x1a'),_0x4fe226[_0x82f6('0x18')]['script']);var _0xdc4dea=process['cwd']();process[_0x82f6('0x1b')](path[_0x82f6('0x1c')](_0x2b03ad));return execChildProcess()['then'](function(_0x516deb){process[_0x82f6('0x1b')](_0xdc4dea);return pm2[_0x82f6('0x1d')]({'name':_0x4fe226['body']['name'],'script':_0x2b03ad});})[_0x82f6('0xe')](function(_0x31face){pm2['dump']();return _0x31face[0x0];})[_0x82f6('0xe')](respondWithResult(_0x3a8269,0xc9))[_0x82f6('0x13')](handleError(_0x3a8269,null));}else{return _0x3a8269['status'](0x1f4)['send']({'message':_0x82f6('0x1e')});}};exports['update']=function(_0x469b6b,_0x5a6d69){if(_0x469b6b['body']['id']){delete _0x469b6b[_0x82f6('0x18')]['id'];}var _0x15c9b7={'online':_0x82f6('0x1f'),'stopped':_0x82f6('0x20')};if(_0x15c9b7['hasOwnProperty'](_0x469b6b[_0x82f6('0x18')][_0x82f6('0x6')])){return pm2[_0x15c9b7[_0x469b6b[_0x82f6('0x18')][_0x82f6('0x6')]]](_0x469b6b[_0x82f6('0x16')]['id'])[_0x82f6('0xe')](respondWithResult(_0x5a6d69,0xc8))[_0x82f6('0x13')](handleError(_0x5a6d69,null));}else{return _0x5a6d69[_0x82f6('0x6')](0x1f4)[_0x82f6('0x9')]({'message':_0x82f6('0x21')});}};exports[_0x82f6('0x22')]=function(_0x20d1c5,_0x6ce179){if(_0x20d1c5[_0x82f6('0x18')]['id']){delete _0x20d1c5['body']['id'];}if(_0x20d1c5[_0x82f6('0x16')]['id']){return pm2[_0x82f6('0x23')](_0x20d1c5[_0x82f6('0x16')]['id'])['then'](function(_0x36f37a){pm2[_0x82f6('0x24')]();return _0x36f37a[0x0];})[_0x82f6('0xe')](respondWithResult(_0x6ce179,null))[_0x82f6('0x13')](handleError(_0x6ce179,null));}else{return _0x6ce179[_0x82f6('0x6')](0x1f4)[_0x82f6('0x9')]({'message':_0x82f6('0x25')});}}; \ No newline at end of file +var _0x57f8=['error','name','npm\x20install','info','index','list','express','length','then','catch','show','describe','params','body','script','../../files/plugins','cwd','chdir','dirname','dump','send','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json'];(function(_0x5d77fb,_0x2616e8){var _0x270181=function(_0x3ab093){while(--_0x3ab093){_0x5d77fb['push'](_0x5d77fb['shift']());}};_0x270181(++_0x2616e8);}(_0x57f8,0x198));var _0x857f=function(_0x48c998,_0x37d255){_0x48c998=_0x48c998-0x0;var _0x59c2a2=_0x57f8[_0x48c998];return _0x59c2a2;};'use strict';var _=require('lodash');var pm2=require(_0x857f('0x0'));var logger=require(_0x857f('0x1'))(_0x857f('0x2'));var path=require(_0x857f('0x3'));var exec=require(_0x857f('0x4'))[_0x857f('0x5')];var BPromise=require(_0x857f('0x6'));function handleEntityNotFound(_0x6f054b,_0x318050){return function(_0xced48e){if(!_0xced48e){_0x6f054b[_0x857f('0x7')](0x194);;}return _0xced48e;};}function respondWithResult(_0x369c40,_0x5d22e4){_0x5d22e4=_0x5d22e4||0xc8;return function(_0x8380e8){if(_0x8380e8){return _0x369c40[_0x857f('0x8')](_0x5d22e4)[_0x857f('0x9')](_0x8380e8);}return null;};}function handleError(_0x577fc3,_0x5f6a66){_0x5f6a66=_0x5f6a66||0x1f4;return function(_0x135855){logger[_0x857f('0xa')](_0x135855['stack']);if(_0x135855[_0x857f('0xb')]){delete _0x135855[_0x857f('0xb')];}_0x577fc3[_0x857f('0x8')](_0x5f6a66)['send'](_0x135855);};}function execChildProcess(){return new BPromise(function(_0xefee53,_0x360827){exec(_0x857f('0xc'),function(_0x11adfd,_0x268f9d,_0x3eb530){logger[_0x857f('0xd')](_0x268f9d);logger['info'](_0x3eb530);if(_0x11adfd){logger[_0x857f('0xa')](_0x11adfd);return _0x360827(_0x11adfd);}return _0xefee53(_0x268f9d);});});}exports[_0x857f('0xe')]=function(_0x373333,_0x2caf29){return pm2[_0x857f('0xf')]()['then'](function(_0x4bc590){if(_0x4bc590){var _0x3b09d9=_['reject'](_0x4bc590,function(_0x1fafbe){return _0x1fafbe['name']===_0x857f('0x10')||_0x1fafbe[_0x857f('0xb')]==='motion2';});return{'rows':_0x3b09d9,'count':_0x3b09d9[_0x857f('0x11')]};}return null;})[_0x857f('0x12')](respondWithResult(_0x2caf29,null))[_0x857f('0x13')](handleError(_0x2caf29,null));};exports[_0x857f('0x14')]=function(_0x279e74,_0x38a3c2){return pm2[_0x857f('0x15')](_0x279e74[_0x857f('0x16')]['id'])[_0x857f('0x12')](respondWithResult(_0x38a3c2,null))[_0x857f('0x12')](handleEntityNotFound(_0x38a3c2,null))[_0x857f('0x13')](handleError(_0x38a3c2,null));};exports['create']=function(_0x1729d8,_0x1e8fd4){if(_0x1729d8['body'][_0x857f('0xb')]&&_0x1729d8[_0x857f('0x17')][_0x857f('0x18')]){var _0x484035=path['join'](__dirname,_0x857f('0x19'),_0x1729d8[_0x857f('0x17')][_0x857f('0x18')]);var _0x4fa031=process[_0x857f('0x1a')]();process[_0x857f('0x1b')](path[_0x857f('0x1c')](_0x484035));return execChildProcess()['then'](function(_0x1961ea){process[_0x857f('0x1b')](_0x4fa031);return pm2['start']({'name':_0x1729d8[_0x857f('0x17')][_0x857f('0xb')],'script':_0x484035});})[_0x857f('0x12')](function(_0x44ff23){pm2[_0x857f('0x1d')]();return _0x44ff23[0x0];})[_0x857f('0x12')](respondWithResult(_0x1e8fd4,0xc9))[_0x857f('0x13')](handleError(_0x1e8fd4,null));}else{return _0x1e8fd4[_0x857f('0x8')](0x1f4)[_0x857f('0x1e')]({'message':_0x857f('0x1f')});}};exports[_0x857f('0x20')]=function(_0x4782ab,_0x250731){if(_0x4782ab[_0x857f('0x17')]['id']){delete _0x4782ab['body']['id'];}var _0x17e415={'online':_0x857f('0x21'),'stopped':_0x857f('0x22')};if(_0x17e415[_0x857f('0x23')](_0x4782ab['body'][_0x857f('0x8')])){return pm2[_0x17e415[_0x4782ab['body'][_0x857f('0x8')]]](_0x4782ab[_0x857f('0x16')]['id'])[_0x857f('0x12')](respondWithResult(_0x250731,0xc8))[_0x857f('0x13')](handleError(_0x250731,null));}else{return _0x250731[_0x857f('0x8')](0x1f4)[_0x857f('0x1e')]({'message':_0x857f('0x24')});}};exports[_0x857f('0x25')]=function(_0x17e7b6,_0x41f832){if(_0x17e7b6[_0x857f('0x17')]['id']){delete _0x17e7b6[_0x857f('0x17')]['id'];}if(_0x17e7b6[_0x857f('0x16')]['id']){return pm2['delete'](_0x17e7b6[_0x857f('0x16')]['id'])[_0x857f('0x12')](function(_0x55e69f){pm2[_0x857f('0x1d')]();return _0x55e69f[0x0];})[_0x857f('0x12')](respondWithResult(_0x41f832,null))['catch'](handleError(_0x41f832,null));}else{return _0x41f832[_0x857f('0x8')](0x1f4)[_0x857f('0x1e')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 9acc493..25cffbb 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 _0x4e7e=['isAuthenticated','getQueues','exports','express','./realtime.controller','get','/agents','getAgents','/queues'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x4e7e,0x1b3));var _0xe4e7=function(_0x45eac6,_0x461853){_0x45eac6=_0x45eac6-0x0;var _0x3ae9af=_0x4e7e[_0x45eac6];return _0x3ae9af;};'use strict';var express=require(_0xe4e7('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xe4e7('0x1'));router[_0xe4e7('0x2')](_0xe4e7('0x3'),auth['isAuthenticated'](),controller[_0xe4e7('0x4')]);router[_0xe4e7('0x2')](_0xe4e7('0x5'),auth[_0xe4e7('0x6')](),controller[_0xe4e7('0x7')]);module[_0xe4e7('0x8')]=router; \ No newline at end of file +var _0x8c53=['express','Router','get','/agents','isAuthenticated','getAgents','getQueues','exports'];(function(_0x1621f3,_0x251dc5){var _0x39afba=function(_0x18dce5){while(--_0x18dce5){_0x1621f3['push'](_0x1621f3['shift']());}};_0x39afba(++_0x251dc5);}(_0x8c53,0x178));var _0x38c5=function(_0xac46,_0x461cc8){_0xac46=_0xac46-0x0;var _0x3d9a99=_0x8c53[_0xac46];return _0x3d9a99;};'use strict';var express=require(_0x38c5('0x0'));var router=express[_0x38c5('0x1')]();var auth=require('../../components/auth/service');var controller=require('./realtime.controller');router[_0x38c5('0x2')](_0x38c5('0x3'),auth[_0x38c5('0x4')](),controller[_0x38c5('0x5')]);router[_0x38c5('0x2')]('/queues',auth['isAuthenticated'](),controller[_0x38c5('0x6')]);module[_0x38c5('0x7')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 0aef8dd..fc8b3e3 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 _0x2b51=['outbound','pTalking','find','queue','length','some','connectedlinenum','internal','toString','talking','getMembers','UserId','online','voiceStatus','loggedInDb','push','User','Queue','Pause','idle','unknown','ringing','isNil','chatPause','faxPause','whatsappPause','filter','every','chatStatus','faxStatus','openchannelStatus','smsStatus','whatsappStatus','*pause','userpic','lastLoginAt','lastPauseAt','pauseType','address','openchannelPause','mailPause','voicePause','mailCapacity','smsCapacity','faxCapacity','chatCurrentCapacity','faxCurrentCapacity','mailStatus','chatStatusTime','openchannelStatusTime','smsStatusTime','whatsappStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','map','fieldName','type','key','query','role','agent','raw','user','nolimit','getResources','rows','pick','globalStatus','globalStatusFilter','pauseTypeFilter','getQueues','chat','openchannel','fax','whatsapp','resolve','includes','channel','toLowerCase','Invalid\x20channel','getOptions','QueueCampaigns','findAndCountAll','all','util','lodash','jayson/promise','../../components/parsers/qs','api','../../mysqldb','client','http','offset','undefined','count','limit','set','json','error','name','status','request','Agents','then','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','voice','startCase','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','catch','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','waiting','paused','originated','message','dialActive','dialMethod','startPredictive','startProgressive','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','get','agents','busy'];(function(_0x5e4a64,_0x2323f9){var _0x130b02=function(_0x534bbb){while(--_0x534bbb){_0x5e4a64['push'](_0x5e4a64['shift']());}};_0x130b02(++_0x2323f9);}(_0x2b51,0xe7));var _0x12b5=function(_0x10eeb1,_0x11b1dd){_0x10eeb1=_0x10eeb1-0x0;var _0x3827a9=_0x2b51[_0x10eeb1];return _0x3827a9;};'use strict';var util=require(_0x12b5('0x0'));var _=require(_0x12b5('0x1'));var jayson=require(_0x12b5('0x2'));var qs=require(_0x12b5('0x3'));var logger=require('../../config/logger')(_0x12b5('0x4'));var db=require(_0x12b5('0x5'))['db'];var amiClient=jayson[_0x12b5('0x6')][_0x12b5('0x7')]({'port':0x232a});var routingClient=jayson['client'][_0x12b5('0x7')]({'port':0x232c});function respondWithFilteredResult(_0xde8f02,_0x55136a){return function(_0x173204){if(_0x173204){var _0x5efae3=typeof _0x55136a[_0x12b5('0x8')]===_0x12b5('0x9')&&typeof _0x55136a['limit']==='undefined';var _0xcbd05=_0x173204['count'];var _0x348d0f=_0x5efae3?0x0:_0x55136a[_0x12b5('0x8')];var _0x4cd90f=_0x5efae3?_0x173204[_0x12b5('0xa')]:_0x55136a[_0x12b5('0x8')]+_0x55136a[_0x12b5('0xb')];var _0x40a7e7;if(_0x4cd90f>=_0xcbd05){_0x4cd90f=_0xcbd05;_0x40a7e7=0xc8;}else{_0x40a7e7=0xce;}_0xde8f02['status'](_0x40a7e7);return _0xde8f02[_0x12b5('0xc')]('Content-Range',_0x348d0f+'-'+_0x4cd90f+'/'+_0xcbd05)[_0x12b5('0xd')](_0x173204);}return null;};}function handleError(_0x4109f2,_0x147da7){_0x147da7=_0x147da7||0x1f4;return function(_0x3b82ab){logger[_0x12b5('0xe')](_0x3b82ab['stack']);if(_0x3b82ab[_0x12b5('0xf')]){delete _0x3b82ab[_0x12b5('0xf')];}_0x4109f2[_0x12b5('0x10')](_0x147da7)['send'](_0x3b82ab);};}function getRealtimeAgents(){return new Promise(function(_0xf9b8bc,_0x9b123b){return amiClient[_0x12b5('0x11')](_0x12b5('0x12'),{})[_0x12b5('0x13')](function(_0x2da51b){if(_0x2da51b['error'])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');var _0x11eec4=_0x2da51b[_0x12b5('0x14')];return routingClient[_0x12b5('0x11')]('Agents',{})[_0x12b5('0x13')](function(_0xe1a0e3){if(_0xe1a0e3[_0x12b5('0xe')])throw new Error(_0x12b5('0x15'));var _0x23476a=_0xe1a0e3[_0x12b5('0x14')];return _0xf9b8bc(_[_0x12b5('0x16')]({},_0x11eec4,_0x23476a));});})['catch'](function(_0x26990d){_0x9b123b(_0x26990d);});});}function getRealtimeQueues(_0x59aa6a,_0x29815b){return new Promise(function(_0x199116,_0x4108a4){var _0x538c62=_0x29815b===_0x12b5('0x17')?amiClient:routingClient;return _0x538c62[_0x12b5('0x11')](_[_0x12b5('0x18')](_0x29815b)+_0x12b5('0x19'),_0x59aa6a)[_0x12b5('0x13')](function(_0x23c1a4){if(_0x23c1a4[_0x12b5('0xe')])throw new Error(util[_0x12b5('0x1a')](_0x12b5('0x1b'),_0x29815b));return _0x199116(_0x23c1a4[_0x12b5('0x14')]);})[_0x12b5('0x1c')](function(_0xd882dc){_0x4108a4(_0xd882dc);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x16c4b3,_0x576b58){return amiClient[_0x12b5('0x11')](_0x12b5('0x1d'),{})[_0x12b5('0x13')](function(_0x5bbeed){if(_0x5bbeed[_0x12b5('0xe')])throw new Error(_0x12b5('0x1e'));return _0x16c4b3(_0x5bbeed[_0x12b5('0x14')]);})['catch'](function(_0x2cf178){_0x576b58(_0x2cf178);});});}function initializeQueues(_0x530822,_0x8f37b9,_0x1c2da9,_0x35c9ff){var _0x2047d7=[_0x12b5('0x1f'),_0x12b5('0x20'),_0x12b5('0x21'),'talking',_0x12b5('0x22')];if(_0x1c2da9==='voice'&&_0x35c9ff==='outbound'){_0x2047d7['push']('pTalking',_0x12b5('0x23'),_0x12b5('0x24'),_0x12b5('0x25'),_0x12b5('0x26'),'Trunk',_0x12b5('0x27'),_0x12b5('0x28'),'erlangCalls',_0x12b5('0x29'),_0x12b5('0x2a'),_0x12b5('0x2b'),'dialPredictiveInterval',_0x12b5('0x2c'),_0x12b5('0x2d'),_0x12b5('0x2e'),'predictiveIntervalTotalCalls',_0x12b5('0x2f'),_0x12b5('0x30'),_0x12b5('0x31'),_0x12b5('0x32'),_0x12b5('0x33'));}return _0x530822['map'](function(_0x3a9474){var _0x5ec68e=_0x3a9474[_0x12b5('0x34')]({'plain':!![]});_0x5ec68e[_0x12b5('0x35')]=[];_0x5ec68e[_0x12b5('0x22')]=0x0;_0x5ec68e['loggedInDb']=0x0;_0x5ec68e[_0x12b5('0x1f')]=0x0;_0x5ec68e[_0x12b5('0x20')]=0x0;_0x5ec68e[_0x12b5('0x21')]=0x0;if(_0x1c2da9==='voice'){_0x5ec68e['talking']=0x0;_0x5ec68e[_0x12b5('0x36')]=0x0;if(_0x35c9ff===_0x12b5('0x37')){_0x5ec68e[_0x12b5('0x38')]=0x0;_0x5ec68e['originated']=0x0;}}var _0x4e7c03=_[_0x12b5('0x39')](_0x8f37b9,['id',_0x5ec68e['id']]);if(_0x4e7c03)_[_0x12b5('0x16')](_0x5ec68e,_['pick'](_0x4e7c03,_0x2047d7));return _0x5ec68e;});}function updateAgentVoiceStatus(_0x32f858,_0x140221,_0x28a9cc){var _0x5b8da6=_['filter'](_0x28a9cc,[_0x12b5('0x3a'),_0x140221[_0x12b5('0xf')]]);if(_0x5b8da6[_0x12b5('0x3b')]===0x0)return _0x32f858[_0x12b5('0x36')]=!![];if(_[_0x12b5('0x3c')](_0x5b8da6,[_0x12b5('0x3d'),_0x32f858[_0x12b5('0x3e')][_0x12b5('0x3f')]()]))return _0x32f858[_0x12b5('0x40')]=!![];if(!_0x32f858[_0x12b5('0x40')])return _0x32f858['busy']=!![];}function getVoiceQueueAgents(_0x5c331e,_0x2dee9a,_0x408bf2,_0x523025){var _0x1631ba=_[_0x12b5('0x39')](_0x2dee9a,['id',_0x5c331e['id']]);if(!_0x1631ba)return _0x5c331e;return _0x1631ba[_0x12b5('0x41')]({'raw':!![]})[_0x12b5('0x13')](function(_0x340896){for(var _0x6449f7=0x0;_0x6449f7<_0x340896[_0x12b5('0x3b')];_0x6449f7++){var _0x441225=_[_0x12b5('0x39')](_0x408bf2,['id',_0x340896[_0x6449f7]['UserId']]);if(!_0x441225){_0x441225={'id':_0x340896[_0x6449f7][_0x12b5('0x42')],'name':_0x340896[_0x6449f7]['UserId'],'accountcode':'','online':![]};}var _0x2948fb={'id':_0x441225['id'],'name':_0x441225[_0x12b5('0xf')],'internal':_0x441225['accountcode'],'online':Boolean(_0x441225[_0x12b5('0x43')]),'paused':Boolean(_0x340896[_0x6449f7][_0x12b5('0x22')])};if(_0x441225[_0x12b5('0x44')]===_0x12b5('0x40'))updateAgentVoiceStatus(_0x2948fb,_0x5c331e,_0x523025);if(_0x2948fb[_0x12b5('0x43')])_0x5c331e[_0x12b5('0x45')]++;if(_0x2948fb[_0x12b5('0x36')])_0x5c331e[_0x12b5('0x36')]++;if(_0x2948fb['paused']&&!_0x2948fb[_0x12b5('0x36')]&&!_0x2948fb[_0x12b5('0x40')])_0x5c331e[_0x12b5('0x22')]++;_0x5c331e[_0x12b5('0x35')][_0x12b5('0x46')](_0x2948fb);}return _0x5c331e;});}function getQueueAgents(_0x1bf785,_0x7914c1,_0x5350b4){var _0x9e4aa5=_0x12b5('0x47')+_[_0x12b5('0x18')](_0x5350b4)+_0x12b5('0x48');var _0x4613bd=_0x5350b4+_0x12b5('0x49');return db[_0x9e4aa5]['findAll']({'where':{[_[_0x12b5('0x18')](_0x5350b4)+'QueueId']:_0x1bf785['id']},'raw':!![]})[_0x12b5('0x13')](function(_0x546145){for(var _0x1dedc4=0x0;_0x1dedc4<_0x546145[_0x12b5('0x3b')];_0x1dedc4++){var _0x5e7bfa=_[_0x12b5('0x39')](_0x7914c1,['id',_0x546145[_0x1dedc4][_0x12b5('0x42')]]);if(!_0x5e7bfa){_0x5e7bfa={'id':_0x546145[_0x1dedc4][_0x12b5('0x42')],'name':_0x546145[_0x1dedc4][_0x12b5('0x42')],'online':![],['pauseField']:![]};}var _0xa00764={'id':_0x5e7bfa['id'],'name':_0x5e7bfa['name'],'online':Boolean(_0x5e7bfa['online']),'paused':Boolean(_0x5e7bfa[_0x4613bd])};if(_0xa00764[_0x12b5('0x43')])_0x1bf785[_0x12b5('0x45')]++;_0x1bf785[_0x12b5('0x35')][_0x12b5('0x46')](_0xa00764);}return _0x1bf785;});}function isIdle(_0x5e2f4e){return _0x5e2f4e===_0x12b5('0x4a')||_0x5e2f4e===_0x12b5('0x4b')||_0x5e2f4e==='unavailable'||_0x5e2f4e===_0x12b5('0x4c')||_[_0x12b5('0x4d')](_0x5e2f4e);}function isAgentPaused(_0x15d5ad,_0x4c51aa){var _0x18bf6f=[_0x15d5ad[_0x12b5('0x4e')],_0x15d5ad[_0x12b5('0x4f')],_0x15d5ad['mailPause'],_0x15d5ad['openchannelPause'],_0x15d5ad['smsPause'],_0x15d5ad['voicePause'],_0x15d5ad[_0x12b5('0x50')]];if(!_0x4c51aa)return _['every'](_0x18bf6f);var _0x2c9c86=_[_0x12b5('0x51')](_0x18bf6f);return _0x2c9c86['length']>0x0&&_0x2c9c86['length']<_0x18bf6f[_0x12b5('0x3b')]?!![]:![];}function isAgentIdle(_0x3f7d05){if(_0x3f7d05[_0x12b5('0x44')]!=='idle'&&_0x3f7d05['voicePause']){_0x3f7d05[_0x12b5('0x44')]='pause';return![];}return _[_0x12b5('0x52')]([_0x3f7d05[_0x12b5('0x53')],_0x3f7d05[_0x12b5('0x54')],_0x3f7d05['mailStatus'],_0x3f7d05[_0x12b5('0x55')],_0x3f7d05[_0x12b5('0x56')],_0x3f7d05['voiceStatus'],_0x3f7d05[_0x12b5('0x57')]],isIdle);}function getAgentStatus(_0x4ce15c){var _0x1e5a94=_0x12b5('0x4b');if(isAgentPaused(_0x4ce15c))_0x1e5a94='pause';else if(isAgentPaused(_0x4ce15c,!![]))_0x1e5a94=_0x12b5('0x58');else if(isAgentIdle(_0x4ce15c))_0x1e5a94=_0x12b5('0x4a');else _0x1e5a94=_0x12b5('0x36');return _0x1e5a94;}exports['getAgents']=function(_0xe2fcc7,_0x16b235){var _0x1a4040={'count':0x0,'rows':[]},_0x57f9de={},_0x22c785,_0x544910,_0x51a2ff=[_0x12b5('0x59'),_0x12b5('0x43'),_0x12b5('0x5a'),_0x12b5('0x5b'),_0x12b5('0x5c'),_0x12b5('0x5b'),_0x12b5('0x3e'),_0x12b5('0x5d'),_0x12b5('0x4e'),_0x12b5('0x5e'),_0x12b5('0x5f'),'smsPause',_0x12b5('0x50'),_0x12b5('0x4f'),_0x12b5('0x60'),'chatCapacity','openchannelCapacity',_0x12b5('0x61'),_0x12b5('0x62'),'whatsappCapacity',_0x12b5('0x63'),_0x12b5('0x64'),'openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity',_0x12b5('0x65'),_0x12b5('0x53'),'openchannelStatus',_0x12b5('0x66'),'smsStatus',_0x12b5('0x57'),_0x12b5('0x54'),_0x12b5('0x44'),_0x12b5('0x67'),_0x12b5('0x68'),'mailStatusTime',_0x12b5('0x69'),_0x12b5('0x6a'),'faxStatusTime',_0x12b5('0x6b'),_0x12b5('0x3a'),_0x12b5('0x6c'),_0x12b5('0x6d'),_0x12b5('0x6e'),_0x12b5('0x6f'),_0x12b5('0x70')],_0x238822=['chatPause',_0x12b5('0x5e'),'mailPause','smsPause',_0x12b5('0x50'),_0x12b5('0x4f'),_0x12b5('0x60'),_0x12b5('0x43')];Promise['resolve']()[_0x12b5('0x13')](function(){var _0x2b6509=_[_0x12b5('0x71')](db['User']['rawAttributes'],function(_0x3d5574){return{'name':_0x3d5574[_0x12b5('0x72')],'type':_0x3d5574[_0x12b5('0x73')][_0x12b5('0x74')]};});_0xe2fcc7[_0x12b5('0x75')][_0x12b5('0x76')]=_0x12b5('0x77');_0xe2fcc7[_0x12b5('0x75')][_0x12b5('0x43')]=!![];_0x57f9de=qs['getOptions'](_0x2b6509,_0xe2fcc7);_0x57f9de[_0x12b5('0x78')]=!![];if(_0xe2fcc7['user']['role']===_0x12b5('0x79')){var _0x1882f3={'params':{'id':_0xe2fcc7['user']['userProfileId']},'query':{'section':_0x12b5('0x12'),'role':_0x12b5('0x77'),'online':!![],'nolimit':_0xe2fcc7[_0x12b5('0x75')][_0x12b5('0x7a')],'sort':_0xe2fcc7[_0x12b5('0x75')]['sort'],'filter':_0xe2fcc7['query'][_0x12b5('0x51')]},'raw':!![]};return db['UserProfile'][_0x12b5('0x7b')](_0x1882f3);}return db[_0x12b5('0x47')]['findAndCountAll'](_0x57f9de);})[_0x12b5('0x13')](function(_0x6ac455){_0x1a4040[_0x12b5('0xa')]=_0x6ac455['count'];_0x22c785=_0x6ac455[_0x12b5('0x7c')];return getRealtimeAgents();})['then'](function(_0x429450){_0x544910=_0x429450['rows'];return _0x22c785['map'](function(_0x454ab2){var _0x2339de=_[_0x12b5('0x39')](_0x544910,['id',_0x454ab2['id']]);if(_0x2339de)_[_0x12b5('0x16')](_0x454ab2,_[_0x12b5('0x7d')](_['omit'](_0x2339de,_0x238822),_0x51a2ff));_0x454ab2[_0x12b5('0x7e')]=getAgentStatus(_0x454ab2);return _0x454ab2;});})[_0x12b5('0x13')](function(_0x4ca767){if(_0xe2fcc7[_0x12b5('0x75')][_0x12b5('0x7f')]){var _0x193755=_[_0x12b5('0x51')](_0x4ca767,[_0x12b5('0x7e'),_0xe2fcc7[_0x12b5('0x75')][_0x12b5('0x7f')]]);if(_0xe2fcc7[_0x12b5('0x75')][_0x12b5('0x80')]){_0x193755=_[_0x12b5('0x51')](_0x193755,['pauseType',_0xe2fcc7[_0x12b5('0x75')]['pauseTypeFilter']]);}}_0x1a4040['rows']=_0x193755||_0x4ca767;return _0x1a4040;})[_0x12b5('0x13')](respondWithFilteredResult(_0x16b235,_0x57f9de))[_0x12b5('0x1c')](handleError(_0x16b235,null));};exports[_0x12b5('0x81')]=function(_0x324b58,_0x275275){var _0x150c9b=['mail',_0x12b5('0x82'),'sms',_0x12b5('0x83'),_0x12b5('0x84'),_0x12b5('0x85'),_0x12b5('0x17')];var _0x33defc={'count':0x0,'rows':[]},_0x42b3f4={},_0x44ac34,_0x1b4600,_0x2f6029,_0x4156b3,_0x1126ab;Promise[_0x12b5('0x86')]()[_0x12b5('0x13')](function(){if(_0x324b58[_0x12b5('0x75')]['channel']){if(!_[_0x12b5('0x87')](_0x150c9b,_0x324b58[_0x12b5('0x75')][_0x12b5('0x88')][_0x12b5('0x89')]()))throw new Error(_0x12b5('0x8a'));_0x44ac34=_0x324b58[_0x12b5('0x75')]['channel'][_0x12b5('0x89')]();}var _0x44b89c=_[_0x12b5('0x18')](_0x44ac34)+_0x12b5('0x48');var _0x42c945=_[_0x12b5('0x71')](db[_0x44b89c]['rawAttributes'],function(_0x22232e){return{'name':_0x22232e['fieldName'],'type':_0x22232e[_0x12b5('0x73')][_0x12b5('0x74')]};});_0x42b3f4=qs[_0x12b5('0x8b')](_0x42c945,_0x324b58);if(_0x324b58['user'][_0x12b5('0x76')]==='user'){var _0x484cd2={'params':{'id':_0x324b58[_0x12b5('0x79')]['userProfileId']},'query':{'section':_0x44ac34===_0x12b5('0x17')&&_0x324b58[_0x12b5('0x75')][_0x12b5('0x73')]===_0x12b5('0x37')?_0x12b5('0x8c'):_[_0x12b5('0x18')](_0x44ac34)+_0x12b5('0x19'),'type':_0x324b58[_0x12b5('0x75')]['type'],'nolimit':!![],'sort':_0x12b5('0xf'),'filter':_0x324b58[_0x12b5('0x75')]['filter']}};return db['UserProfile']['getResources'](_0x484cd2);}return db[_0x44b89c][_0x12b5('0x8d')](_0x42b3f4);})[_0x12b5('0x13')](function(_0x2553e1){_0x33defc[_0x12b5('0xa')]=_0x2553e1[_0x12b5('0xa')];_0x1b4600=_0x2553e1[_0x12b5('0x7c')];return getRealtimeQueues(_0x324b58,_0x44ac34);})[_0x12b5('0x13')](function(_0x196f46){_0x4156b3=_0x196f46[_0x12b5('0x7c')];return getRealtimeAgents();})[_0x12b5('0x13')](function(_0x318190){_0x2f6029=_0x318190[_0x12b5('0x7c')];if(_0x44ac34!=_0x12b5('0x17'))return;return getRealtimeVoiceQueueChannels();})[_0x12b5('0x13')](function(_0x7edd7e){_0x1126ab=_0x7edd7e?_0x7edd7e['rows']:[];return initializeQueues(_0x1b4600,_0x4156b3,_0x44ac34,_0x324b58['query'][_0x12b5('0x73')]);})[_0x12b5('0x13')](function(_0x1d109e){var _0x441772=_0x1d109e[_0x12b5('0x71')](function(_0x17dfe7){if(_0x44ac34==='voice')return getVoiceQueueAgents(_0x17dfe7,_0x1b4600,_0x2f6029,_0x1126ab);else return getQueueAgents(_0x17dfe7,_0x2f6029,_0x44ac34);});return Promise[_0x12b5('0x8e')](_0x441772);})[_0x12b5('0x13')](function(_0x9f3cad){_0x33defc[_0x12b5('0x7c')]=_0x9f3cad;return _0x33defc;})[_0x12b5('0x13')](respondWithFilteredResult(_0x275275,_0x42b3f4))[_0x12b5('0x1c')](handleError(_0x275275,null));}; \ No newline at end of file +var _0xceee=['Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','waiting','talking','paused','outbound','push','pTalking','originated','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','map','agents','loggedInDb','busy','queue','some','connectedlinenum','toString','find','getMembers','length','accountcode','voiceStatus','online','User','Pause','findAll','QueueId','UserId','unavailable','ringing','isNil','chatPause','faxPause','openchannelPause','smsPause','voicePause','whatsappPause','every','idle','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','unknown','*pause','getAgents','lastLoginAt','lastPauseAt','pauseType','address','mailPause','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','routealias','resolve','fieldName','type','key','query','role','agent','getOptions','raw','userProfileId','sort','filter','UserProfile','getResources','findAndCountAll','count','rows','omit','globalStatusFilter','globalStatus','pauseTypeFilter','getQueues','mail','chat','sms','openchannel','fax','whatsapp','channel','includes','Invalid\x20channel','toLowerCase','Queue','user','QueueCampaigns','util','jayson/promise','../../components/parsers/qs','../../config/logger','api','client','http','undefined','offset','limit','status','set','json','error','stack','name','send','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','voice','startCase'];(function(_0x3c8790,_0x2d776f){var _0x4d9e38=function(_0x5632d3){while(--_0x5632d3){_0x3c8790['push'](_0x3c8790['shift']());}};_0x4d9e38(++_0x2d776f);}(_0xceee,0x1bf));var _0xecee=function(_0x42655e,_0x52eb2){_0x42655e=_0x42655e-0x0;var _0x3d3300=_0xceee[_0x42655e];return _0x3d3300;};'use strict';var util=require(_0xecee('0x0'));var _=require('lodash');var jayson=require(_0xecee('0x1'));var qs=require(_0xecee('0x2'));var logger=require(_0xecee('0x3'))(_0xecee('0x4'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0xecee('0x5')]['http']({'port':0x232a});var routingClient=jayson[_0xecee('0x5')][_0xecee('0x6')]({'port':0x232c});function respondWithFilteredResult(_0x32f549,_0x397e61){return function(_0xf11835){if(_0xf11835){var _0x4e384a=typeof _0x397e61['offset']===_0xecee('0x7')&&typeof _0x397e61['limit']===_0xecee('0x7');var _0x3014e4=_0xf11835['count'];var _0xc6f7d8=_0x4e384a?0x0:_0x397e61[_0xecee('0x8')];var _0x2fbfaa=_0x4e384a?_0xf11835['count']:_0x397e61['offset']+_0x397e61[_0xecee('0x9')];var _0x56ff00;if(_0x2fbfaa>=_0x3014e4){_0x2fbfaa=_0x3014e4;_0x56ff00=0xc8;}else{_0x56ff00=0xce;}_0x32f549[_0xecee('0xa')](_0x56ff00);return _0x32f549[_0xecee('0xb')]('Content-Range',_0xc6f7d8+'-'+_0x2fbfaa+'/'+_0x3014e4)[_0xecee('0xc')](_0xf11835);}return null;};}function handleError(_0x2b263,_0x5a33bf){_0x5a33bf=_0x5a33bf||0x1f4;return function(_0x38de11){logger[_0xecee('0xd')](_0x38de11[_0xecee('0xe')]);if(_0x38de11[_0xecee('0xf')]){delete _0x38de11[_0xecee('0xf')];}_0x2b263['status'](_0x5a33bf)[_0xecee('0x10')](_0x38de11);};}function getRealtimeAgents(){return new Promise(function(_0x44b58e,_0x53288a){return amiClient[_0xecee('0x11')](_0xecee('0x12'),{})[_0xecee('0x13')](function(_0x2d432d){if(_0x2d432d['error'])throw new Error(_0xecee('0x14'));var _0x8ef31=_0x2d432d[_0xecee('0x15')];return routingClient[_0xecee('0x11')](_0xecee('0x12'),{})[_0xecee('0x13')](function(_0x3ac8ba){if(_0x3ac8ba[_0xecee('0xd')])throw new Error(_0xecee('0x16'));var _0x5b419c=_0x3ac8ba[_0xecee('0x15')];return _0x44b58e(_[_0xecee('0x17')]({},_0x8ef31,_0x5b419c));});})[_0xecee('0x18')](function(_0x5d5a26){_0x53288a(_0x5d5a26);});});}function getRealtimeQueues(_0x57781b,_0x15ac49){return new Promise(function(_0x31cf13,_0x50ab31){var _0x54e139=_0x15ac49===_0xecee('0x19')?amiClient:routingClient;return _0x54e139[_0xecee('0x11')](_[_0xecee('0x1a')](_0x15ac49)+_0xecee('0x1b'),_0x57781b)[_0xecee('0x13')](function(_0x18ed86){if(_0x18ed86[_0xecee('0xd')])throw new Error(util[_0xecee('0x1c')](_0xecee('0x1d'),_0x15ac49));return _0x31cf13(_0x18ed86['result']);})[_0xecee('0x18')](function(_0x1903ad){_0x50ab31(_0x1903ad);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x1b8e07,_0x350989){return amiClient[_0xecee('0x11')](_0xecee('0x1e'),{})[_0xecee('0x13')](function(_0x72bed7){if(_0x72bed7[_0xecee('0xd')])throw new Error(_0xecee('0x1f'));return _0x1b8e07(_0x72bed7[_0xecee('0x15')]);})[_0xecee('0x18')](function(_0x1dfa6f){_0x350989(_0x1dfa6f);});});}function initializeQueues(_0xd5ff5d,_0x47caff,_0x4470b5,_0x3e38e8){var _0x4fe36f=[_0xecee('0x20'),_0xecee('0x21'),_0xecee('0x22'),_0xecee('0x23'),_0xecee('0x24')];if(_0x4470b5===_0xecee('0x19')&&_0x3e38e8===_0xecee('0x25')){_0x4fe36f[_0xecee('0x26')](_0xecee('0x27'),_0xecee('0x28'),_0xecee('0x29'),_0xecee('0x2a'),_0xecee('0x2b'),_0xecee('0x2c'),_0xecee('0x2d'),_0xecee('0x2e'),_0xecee('0x2f'),_0xecee('0x30'),_0xecee('0x31'),'erlangBusyFactor',_0xecee('0x32'),_0xecee('0x33'),_0xecee('0x34'),_0xecee('0x35'),'predictiveIntervalTotalCalls',_0xecee('0x36'),_0xecee('0x37'),_0xecee('0x38'),'predictiveIntervalAvgHoldtime',_0xecee('0x39'));}return _0xd5ff5d[_0xecee('0x3a')](function(_0x135586){var _0x35b2ad=_0x135586['get']({'plain':!![]});_0x35b2ad[_0xecee('0x3b')]=[];_0x35b2ad[_0xecee('0x24')]=0x0;_0x35b2ad[_0xecee('0x3c')]=0x0;_0x35b2ad[_0xecee('0x20')]=0x0;_0x35b2ad[_0xecee('0x21')]=0x0;_0x35b2ad['waiting']=0x0;if(_0x4470b5===_0xecee('0x19')){_0x35b2ad[_0xecee('0x23')]=0x0;_0x35b2ad[_0xecee('0x3d')]=0x0;if(_0x3e38e8==='outbound'){_0x35b2ad[_0xecee('0x27')]=0x0;_0x35b2ad[_0xecee('0x28')]=0x0;}}var _0x1f0c66=_['find'](_0x47caff,['id',_0x35b2ad['id']]);if(_0x1f0c66)_[_0xecee('0x17')](_0x35b2ad,_['pick'](_0x1f0c66,_0x4fe36f));return _0x35b2ad;});}function updateAgentVoiceStatus(_0x1087f3,_0xf17792,_0x4d0ba8){var _0x1dc985=_['filter'](_0x4d0ba8,[_0xecee('0x3e'),_0xf17792['name']]);if(_0x1dc985['length']===0x0)return _0x1087f3[_0xecee('0x3d')]=!![];if(_[_0xecee('0x3f')](_0x1dc985,[_0xecee('0x40'),_0x1087f3['internal'][_0xecee('0x41')]()]))return _0x1087f3[_0xecee('0x23')]=!![];if(!_0x1087f3[_0xecee('0x23')])return _0x1087f3[_0xecee('0x3d')]=!![];}function getVoiceQueueAgents(_0x385b91,_0x30b43b,_0x4945db,_0x5ef0d4){var _0x475124=_[_0xecee('0x42')](_0x30b43b,['id',_0x385b91['id']]);if(!_0x475124)return _0x385b91;return _0x475124[_0xecee('0x43')]({'raw':!![]})['then'](function(_0x24621c){for(var _0x599c8a=0x0;_0x599c8a<_0x24621c[_0xecee('0x44')];_0x599c8a++){var _0x59edf8=_[_0xecee('0x42')](_0x4945db,['id',_0x24621c[_0x599c8a]['UserId']]);if(!_0x59edf8){_0x59edf8={'id':_0x24621c[_0x599c8a]['UserId'],'name':_0x24621c[_0x599c8a]['UserId'],'accountcode':'','online':![]};}var _0x3d2591={'id':_0x59edf8['id'],'name':_0x59edf8[_0xecee('0xf')],'internal':_0x59edf8[_0xecee('0x45')],'online':Boolean(_0x59edf8['online']),'paused':Boolean(_0x24621c[_0x599c8a][_0xecee('0x24')])};if(_0x59edf8[_0xecee('0x46')]==='talking')updateAgentVoiceStatus(_0x3d2591,_0x385b91,_0x5ef0d4);if(_0x3d2591[_0xecee('0x47')])_0x385b91['loggedInDb']++;if(_0x3d2591[_0xecee('0x3d')])_0x385b91[_0xecee('0x3d')]++;if(_0x3d2591[_0xecee('0x24')]&&!_0x3d2591[_0xecee('0x3d')]&&!_0x3d2591[_0xecee('0x23')])_0x385b91[_0xecee('0x24')]++;_0x385b91[_0xecee('0x3b')][_0xecee('0x26')](_0x3d2591);}return _0x385b91;});}function getQueueAgents(_0xe5e526,_0x3a7034,_0xb2e642){var _0x3119f4=_0xecee('0x48')+_[_0xecee('0x1a')](_0xb2e642)+'Queue';var _0xb69ffc=_0xb2e642+_0xecee('0x49');return db[_0x3119f4][_0xecee('0x4a')]({'where':{[_['startCase'](_0xb2e642)+_0xecee('0x4b')]:_0xe5e526['id']},'raw':!![]})[_0xecee('0x13')](function(_0x11f744){for(var _0x228a96=0x0;_0x228a96<_0x11f744[_0xecee('0x44')];_0x228a96++){var _0x549028=_['find'](_0x3a7034,['id',_0x11f744[_0x228a96][_0xecee('0x4c')]]);if(!_0x549028){_0x549028={'id':_0x11f744[_0x228a96][_0xecee('0x4c')],'name':_0x11f744[_0x228a96]['UserId'],'online':![],['pauseField']:![]};}var _0x4812d7={'id':_0x549028['id'],'name':_0x549028[_0xecee('0xf')],'online':Boolean(_0x549028['online']),'paused':Boolean(_0x549028[_0xb69ffc])};if(_0x4812d7[_0xecee('0x47')])_0xe5e526['loggedInDb']++;_0xe5e526[_0xecee('0x3b')]['push'](_0x4812d7);}return _0xe5e526;});}function isIdle(_0x8d4f29){return _0x8d4f29==='idle'||_0x8d4f29==='unknown'||_0x8d4f29===_0xecee('0x4d')||_0x8d4f29===_0xecee('0x4e')||_[_0xecee('0x4f')](_0x8d4f29);}function isAgentPaused(_0x41cdbf,_0x2a1018){var _0x2e1ac3=[_0x41cdbf[_0xecee('0x50')],_0x41cdbf[_0xecee('0x51')],_0x41cdbf['mailPause'],_0x41cdbf[_0xecee('0x52')],_0x41cdbf[_0xecee('0x53')],_0x41cdbf[_0xecee('0x54')],_0x41cdbf[_0xecee('0x55')]];if(!_0x2a1018)return _[_0xecee('0x56')](_0x2e1ac3);var _0x22cd39=_['filter'](_0x2e1ac3);return _0x22cd39[_0xecee('0x44')]>0x0&&_0x22cd39[_0xecee('0x44')]<_0x2e1ac3[_0xecee('0x44')]?!![]:![];}function isAgentIdle(_0x2458f2){if(_0x2458f2['voiceStatus']!==_0xecee('0x57')&&_0x2458f2['voicePause']){_0x2458f2[_0xecee('0x46')]=_0xecee('0x58');return![];}return _['every']([_0x2458f2[_0xecee('0x59')],_0x2458f2[_0xecee('0x5a')],_0x2458f2[_0xecee('0x5b')],_0x2458f2[_0xecee('0x5c')],_0x2458f2[_0xecee('0x5d')],_0x2458f2[_0xecee('0x46')],_0x2458f2[_0xecee('0x5e')]],isIdle);}function getAgentStatus(_0x4a333f){var _0x4fa89d=_0xecee('0x5f');if(isAgentPaused(_0x4a333f))_0x4fa89d=_0xecee('0x58');else if(isAgentPaused(_0x4a333f,!![]))_0x4fa89d=_0xecee('0x60');else if(isAgentIdle(_0x4a333f))_0x4fa89d=_0xecee('0x57');else _0x4fa89d=_0xecee('0x3d');return _0x4fa89d;}exports[_0xecee('0x61')]=function(_0x5132a7,_0x5c22f7){var _0x49ca1f={'count':0x0,'rows':[]},_0x2d833e={},_0x267702,_0x19c42c,_0x85f84e=['userpic',_0xecee('0x47'),_0xecee('0x62'),_0xecee('0x63'),_0xecee('0x64'),'lastPauseAt','internal',_0xecee('0x65'),_0xecee('0x50'),_0xecee('0x52'),_0xecee('0x66'),_0xecee('0x53'),'whatsappPause',_0xecee('0x51'),_0xecee('0x54'),_0xecee('0x67'),_0xecee('0x68'),_0xecee('0x69'),_0xecee('0x6a'),_0xecee('0x6b'),_0xecee('0x6c'),_0xecee('0x6d'),_0xecee('0x6e'),_0xecee('0x6f'),'smsCurrentCapacity','whatsappCurrentCapacity',_0xecee('0x70'),_0xecee('0x59'),_0xecee('0x5c'),_0xecee('0x5b'),'smsStatus','whatsappStatus',_0xecee('0x5a'),'voiceStatus',_0xecee('0x71'),_0xecee('0x72'),_0xecee('0x73'),_0xecee('0x74'),_0xecee('0x75'),'faxStatusTime',_0xecee('0x76'),_0xecee('0x3e'),_0xecee('0x77'),_0xecee('0x78'),_0xecee('0x79'),'phoneBarEnableAutomaticScreenRecording',_0xecee('0x7a')],_0x5b5947=[_0xecee('0x50'),_0xecee('0x52'),_0xecee('0x66'),_0xecee('0x53'),_0xecee('0x55'),_0xecee('0x51'),_0xecee('0x54'),_0xecee('0x47')];Promise[_0xecee('0x7b')]()[_0xecee('0x13')](function(){var _0x164d1a=_[_0xecee('0x3a')](db[_0xecee('0x48')]['rawAttributes'],function(_0x3f6b8f){return{'name':_0x3f6b8f[_0xecee('0x7c')],'type':_0x3f6b8f[_0xecee('0x7d')][_0xecee('0x7e')]};});_0x5132a7[_0xecee('0x7f')][_0xecee('0x80')]=_0xecee('0x81');_0x5132a7['query'][_0xecee('0x47')]=!![];_0x2d833e=qs[_0xecee('0x82')](_0x164d1a,_0x5132a7);_0x2d833e[_0xecee('0x83')]=!![];if(_0x5132a7['user']['role']==='user'){var _0x5e7f41={'params':{'id':_0x5132a7['user'][_0xecee('0x84')]},'query':{'section':'Agents','role':'agent','online':!![],'nolimit':_0x5132a7[_0xecee('0x7f')]['nolimit'],'sort':_0x5132a7['query'][_0xecee('0x85')],'filter':_0x5132a7['query'][_0xecee('0x86')]},'raw':!![]};return db[_0xecee('0x87')][_0xecee('0x88')](_0x5e7f41);}return db[_0xecee('0x48')][_0xecee('0x89')](_0x2d833e);})[_0xecee('0x13')](function(_0x11e3a0){_0x49ca1f[_0xecee('0x8a')]=_0x11e3a0[_0xecee('0x8a')];_0x267702=_0x11e3a0[_0xecee('0x8b')];return getRealtimeAgents();})[_0xecee('0x13')](function(_0xc6426d){_0x19c42c=_0xc6426d[_0xecee('0x8b')];return _0x267702[_0xecee('0x3a')](function(_0x39629f){var _0x2ef542=_[_0xecee('0x42')](_0x19c42c,['id',_0x39629f['id']]);if(_0x2ef542)_[_0xecee('0x17')](_0x39629f,_['pick'](_[_0xecee('0x8c')](_0x2ef542,_0x5b5947),_0x85f84e));_0x39629f['globalStatus']=getAgentStatus(_0x39629f);return _0x39629f;});})['then'](function(_0x67708d){if(_0x5132a7[_0xecee('0x7f')][_0xecee('0x8d')]){var _0x337bad=_[_0xecee('0x86')](_0x67708d,[_0xecee('0x8e'),_0x5132a7[_0xecee('0x7f')]['globalStatusFilter']]);if(_0x5132a7[_0xecee('0x7f')][_0xecee('0x8f')]){_0x337bad=_[_0xecee('0x86')](_0x337bad,[_0xecee('0x64'),_0x5132a7[_0xecee('0x7f')][_0xecee('0x8f')]]);}}_0x49ca1f[_0xecee('0x8b')]=_0x337bad||_0x67708d;return _0x49ca1f;})[_0xecee('0x13')](respondWithFilteredResult(_0x5c22f7,_0x2d833e))['catch'](handleError(_0x5c22f7,null));};exports[_0xecee('0x90')]=function(_0x3c37f6,_0x33a734){var _0x1a7a7f=[_0xecee('0x91'),_0xecee('0x92'),_0xecee('0x93'),_0xecee('0x94'),_0xecee('0x95'),_0xecee('0x96'),_0xecee('0x19')];var _0x2bc760={'count':0x0,'rows':[]},_0x3bb68a={},_0x394b17,_0x5473f0,_0x1f5a2b,_0x3fb3be,_0x91eb28;Promise[_0xecee('0x7b')]()['then'](function(){if(_0x3c37f6[_0xecee('0x7f')][_0xecee('0x97')]){if(!_[_0xecee('0x98')](_0x1a7a7f,_0x3c37f6[_0xecee('0x7f')][_0xecee('0x97')]['toLowerCase']()))throw new Error(_0xecee('0x99'));_0x394b17=_0x3c37f6[_0xecee('0x7f')][_0xecee('0x97')][_0xecee('0x9a')]();}var _0x3dc203=_[_0xecee('0x1a')](_0x394b17)+_0xecee('0x9b');var _0x1b9adc=_[_0xecee('0x3a')](db[_0x3dc203]['rawAttributes'],function(_0x19a190){return{'name':_0x19a190['fieldName'],'type':_0x19a190[_0xecee('0x7d')][_0xecee('0x7e')]};});_0x3bb68a=qs[_0xecee('0x82')](_0x1b9adc,_0x3c37f6);if(_0x3c37f6[_0xecee('0x9c')][_0xecee('0x80')]==='user'){var _0x5c2c2a={'params':{'id':_0x3c37f6['user'][_0xecee('0x84')]},'query':{'section':_0x394b17===_0xecee('0x19')&&_0x3c37f6['query'][_0xecee('0x7d')]===_0xecee('0x25')?_0xecee('0x9d'):_[_0xecee('0x1a')](_0x394b17)+_0xecee('0x1b'),'type':_0x3c37f6[_0xecee('0x7f')][_0xecee('0x7d')],'nolimit':!![],'sort':'name','filter':_0x3c37f6['query'][_0xecee('0x86')]}};return db[_0xecee('0x87')]['getResources'](_0x5c2c2a);}return db[_0x3dc203][_0xecee('0x89')](_0x3bb68a);})[_0xecee('0x13')](function(_0x237f76){_0x2bc760['count']=_0x237f76['count'];_0x5473f0=_0x237f76[_0xecee('0x8b')];return getRealtimeQueues(_0x3c37f6,_0x394b17);})[_0xecee('0x13')](function(_0x4cc4e9){_0x3fb3be=_0x4cc4e9[_0xecee('0x8b')];return getRealtimeAgents();})[_0xecee('0x13')](function(_0x27bca0){_0x1f5a2b=_0x27bca0['rows'];if(_0x394b17!=_0xecee('0x19'))return;return getRealtimeVoiceQueueChannels();})['then'](function(_0xe2c29a){_0x91eb28=_0xe2c29a?_0xe2c29a[_0xecee('0x8b')]:[];return initializeQueues(_0x5473f0,_0x3fb3be,_0x394b17,_0x3c37f6[_0xecee('0x7f')][_0xecee('0x7d')]);})[_0xecee('0x13')](function(_0x1eccc7){var _0x8f19d5=_0x1eccc7[_0xecee('0x3a')](function(_0x372775){if(_0x394b17===_0xecee('0x19'))return getVoiceQueueAgents(_0x372775,_0x5473f0,_0x1f5a2b,_0x91eb28);else return getQueueAgents(_0x372775,_0x1f5a2b,_0x394b17);});return Promise['all'](_0x8f19d5);})['then'](function(_0x2f0ac1){_0x2bc760[_0xecee('0x8b')]=_0x2f0ac1;return _0x2bc760;})[_0xecee('0x13')](respondWithFilteredResult(_0x33a734,_0x3bb68a))[_0xecee('0x18')](handleError(_0x33a734,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 914fa62..50fa00c 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x198b3d,_0x4ecfbb){var _0x3b7520=function(_0x3c25c6){while(--_0x3c25c6){_0x198b3d['push'](_0x198b3d['shift']());}};_0x3b7520(++_0x4ecfbb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x323c59,_0x2fa7f5){var _0x4b2831=function(_0x11c3b3){while(--_0x11c3b3){_0x323c59['push'](_0x323c59['shift']());}};_0x4b2831(++_0x2fa7f5);}(_0x9c44,0x178));var _0x49c4=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x9c44[_0x18ab2a];return _0x16dcee;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 38bc7c3..2f90e01 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 _0xd86a=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x587dd0,_0x273922){var _0x56f153=function(_0x27fb33){while(--_0x27fb33){_0x587dd0['push'](_0x587dd0['shift']());}};_0x56f153(++_0x273922);}(_0xd86a,0xf3));var _0xad86=function(_0x3e6d5d,_0x264c7a){_0x3e6d5d=_0x3e6d5d-0x0;var _0x238923=_0xd86a[_0x3e6d5d];return _0x238923;};'use strict';var Sequelize=require(_0xad86('0x0'));module[_0xad86('0x1')]={'state':{'type':Sequelize[_0xad86('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0xad86('0x3')]},'starttime':{'type':Sequelize[_0xad86('0x4')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xad86('0x3')]},'campaigntype':{'type':Sequelize[_0xad86('0x3')]},'membername':{'type':Sequelize[_0xad86('0x3')]}}; \ No newline at end of file +var _0x8375=['INTEGER','DATE','STRING','sequelize','exports'];(function(_0x55677b,_0x3e5655){var _0x104b88=function(_0x78d34f){while(--_0x78d34f){_0x55677b['push'](_0x55677b['shift']());}};_0x104b88(++_0x3e5655);}(_0x8375,0xa8));var _0x5837=function(_0x4d7f24,_0x563e32){_0x4d7f24=_0x4d7f24-0x0;var _0x3f3e29=_0x8375[_0x4d7f24];return _0x3f3e29;};'use strict';var Sequelize=require(_0x5837('0x0'));module[_0x5837('0x1')]={'state':{'type':Sequelize[_0x5837('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x5837('0x3')]},'uniqueid':{'type':Sequelize[_0x5837('0x4')]},'starttime':{'type':Sequelize[_0x5837('0x3')]},'responsetime':{'type':Sequelize[_0x5837('0x3')]},'ringtime':{'type':Sequelize[_0x5837('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x5837('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x5837('0x4')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index a6f687c..d8cb8d7 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 _0x643c=['./reportAgentPreview.attributes','define','ReportAgentPreview','report_agent_preview','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x5f07aa,_0x57a49d){var _0x380eda=function(_0x5e12b9){while(--_0x5e12b9){_0x5f07aa['push'](_0x5f07aa['shift']());}};_0x380eda(++_0x57a49d);}(_0x643c,0xf4));var _0xc643=function(_0x466161,_0x29cc00){_0x466161=_0x466161-0x0;var _0x2f9c1d=_0x643c[_0x466161];return _0x2f9c1d;};'use strict';var _=require(_0xc643('0x0'));var util=require(_0xc643('0x1'));var logger=require('../../config/logger')(_0xc643('0x2'));var moment=require(_0xc643('0x3'));var BPromise=require(_0xc643('0x4'));var rp=require(_0xc643('0x5'));var fs=require('fs');var path=require(_0xc643('0x6'));var rimraf=require('rimraf');var config=require(_0xc643('0x7'));var attributes=require(_0xc643('0x8'));module['exports']=function(_0xa71be1,_0x1b7002){return _0xa71be1[_0xc643('0x9')](_0xc643('0xa'),attributes,{'tableName':_0xc643('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae4f=['util','api','moment','request-promise','rimraf','../../config/environment','exports','define','ReportAgentPreview'];(function(_0x173252,_0x491c7b){var _0x527280=function(_0x4637ef){while(--_0x4637ef){_0x173252['push'](_0x173252['shift']());}};_0x527280(++_0x491c7b);}(_0xae4f,0x117));var _0xfae4=function(_0x5b2779,_0x5a46d6){_0x5b2779=_0x5b2779-0x0;var _0x51fe86=_0xae4f[_0x5b2779];return _0x51fe86;};'use strict';var _=require('lodash');var util=require(_0xfae4('0x0'));var logger=require('../../config/logger')(_0xfae4('0x1'));var moment=require(_0xfae4('0x2'));var BPromise=require('bluebird');var rp=require(_0xfae4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfae4('0x4'));var config=require(_0xfae4('0x5'));var attributes=require('./reportAgentPreview.attributes');module[_0xfae4('0x6')]=function(_0x20d245,_0x1c0b93){return _0x20d245[_0xfae4('0x7')](_0xfae4('0x8'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index ee2b0fb..19c3645 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 _0xde9c=['error','message','info','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1013ff,_0x5218ad){var _0xc00260=function(_0x42e511){while(--_0x42e511){_0x1013ff['push'](_0x1013ff['shift']());}};_0xc00260(++_0x5218ad);}(_0xde9c,0x167));var _0xcde9=function(_0x878c27,_0xfb68a8){_0x878c27=_0x878c27-0x0;var _0x29771b=_0xde9c[_0x878c27];return _0x29771b;};'use strict';var _=require(_0xcde9('0x0'));var util=require(_0xcde9('0x1'));var moment=require('moment');var BPromise=require(_0xcde9('0x2'));var rs=require(_0xcde9('0x3'));var fs=require('fs');var Redis=require(_0xcde9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcde9('0x5'));var logger=require(_0xcde9('0x6'))('rpc');var config=require(_0xcde9('0x7'));var jayson=require(_0xcde9('0x8'));var client=jayson[_0xcde9('0x9')][_0xcde9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52462e,_0x1fbb8c,_0x48ca4d){return new BPromise(function(_0x1a51e2,_0x124be5){return client[_0xcde9('0xb')](_0x52462e,_0x48ca4d)[_0xcde9('0xc')](function(_0xc7339f){logger['info'](_0xcde9('0xd'),_0x1fbb8c,_0xcde9('0xe'));logger[_0xcde9('0xf')](_0xcde9('0x10'),_0x1fbb8c,_0xcde9('0xe'),JSON[_0xcde9('0x11')](_0xc7339f));if(_0xc7339f[_0xcde9('0x12')]){if(_0xc7339f[_0xcde9('0x12')]['code']===0x1f4){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x1fbb8c,_0xc7339f[_0xcde9('0x12')][_0xcde9('0x13')]);return _0x124be5(_0xc7339f['error'][_0xcde9('0x13')]);}logger[_0xcde9('0x12')](_0xcde9('0xd'),_0x1fbb8c,_0xc7339f['error'][_0xcde9('0x13')]);return _0x1a51e2(_0xc7339f[_0xcde9('0x12')][_0xcde9('0x13')]);}else{logger[_0xcde9('0x14')]('ReportAgentPreview,\x20%s,\x20%s',_0x1fbb8c,'request\x20sent');_0x1a51e2(_0xc7339f[_0xcde9('0x15')][_0xcde9('0x13')]);}})[_0xcde9('0x16')](function(_0x52f5ca){logger[_0xcde9('0x12')](_0xcde9('0xd'),_0x1fbb8c,_0x52f5ca);_0x124be5(_0x52f5ca);});});}exports[_0xcde9('0x17')]=function(_0x4e1275){var _0x3aa967=this;return new Promise(function(_0x5bd2cb,_0x3acf1c){return db[_0xcde9('0x18')][_0xcde9('0x19')](_0x4e1275[_0xcde9('0x1a')],{'raw':_0x4e1275[_0xcde9('0x1b')]?_0x4e1275['options'][_0xcde9('0x1c')]===undefined?!![]:![]:!![]})[_0xcde9('0xc')](function(_0xcc67a0){logger['info'](_0xcde9('0x17'),_0x4e1275);logger[_0xcde9('0xf')](_0xcde9('0x17'),_0x4e1275,JSON['stringify'](_0xcc67a0));_0x5bd2cb(_0xcc67a0);})[_0xcde9('0x16')](function(_0x4b45a1){logger[_0xcde9('0x12')](_0xcde9('0x17'),_0x4b45a1[_0xcde9('0x13')],_0x4e1275);_0x3acf1c(_0x3aa967['error'](0x1f4,_0x4b45a1[_0xcde9('0x13')]));});});}; \ No newline at end of file +var _0x3acf=['ReportAgentPreview','create','body','options','raw','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','stringify','error','code','message','result','catch','ReportAgentPreview,\x20%s,\x20%s','CreateReportAgentPreview'];(function(_0x14756e,_0xdf6fd7){var _0x2f3f12=function(_0x343f73){while(--_0x343f73){_0x14756e['push'](_0x14756e['shift']());}};_0x2f3f12(++_0xdf6fd7);}(_0x3acf,0x1bf));var _0xf3ac=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x3acf[_0x3c4737];return _0x2bb926;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf3ac('0x0'));var BPromise=require(_0xf3ac('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf3ac('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xf3ac('0x3'));var logger=require(_0xf3ac('0x4'))(_0xf3ac('0x5'));var config=require(_0xf3ac('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf3ac('0x7')][_0xf3ac('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x216aef,_0x422510,_0x9e7bd9){return new BPromise(function(_0x2afbad,_0x16620d){return client['request'](_0x216aef,_0x9e7bd9)[_0xf3ac('0x9')](function(_0x2b803c){logger[_0xf3ac('0xa')]('ReportAgentPreview,\x20%s,\x20%s',_0x422510,_0xf3ac('0xb'));logger[_0xf3ac('0xc')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x422510,_0xf3ac('0xb'),JSON[_0xf3ac('0xd')](_0x2b803c));if(_0x2b803c[_0xf3ac('0xe')]){if(_0x2b803c['error'][_0xf3ac('0xf')]===0x1f4){logger[_0xf3ac('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x422510,_0x2b803c[_0xf3ac('0xe')][_0xf3ac('0x10')]);return _0x16620d(_0x2b803c['error'][_0xf3ac('0x10')]);}logger[_0xf3ac('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x422510,_0x2b803c[_0xf3ac('0xe')][_0xf3ac('0x10')]);return _0x2afbad(_0x2b803c[_0xf3ac('0xe')][_0xf3ac('0x10')]);}else{logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x422510,_0xf3ac('0xb'));_0x2afbad(_0x2b803c[_0xf3ac('0x11')][_0xf3ac('0x10')]);}})[_0xf3ac('0x12')](function(_0x1a1bd5){logger[_0xf3ac('0xe')](_0xf3ac('0x13'),_0x422510,_0x1a1bd5);_0x16620d(_0x1a1bd5);});});}exports[_0xf3ac('0x14')]=function(_0x506110){var _0x2f3208=this;return new Promise(function(_0x1f76a9,_0x58c709){return db[_0xf3ac('0x15')][_0xf3ac('0x16')](_0x506110[_0xf3ac('0x17')],{'raw':_0x506110[_0xf3ac('0x18')]?_0x506110[_0xf3ac('0x18')][_0xf3ac('0x19')]===undefined?!![]:![]:!![]})[_0xf3ac('0x9')](function(_0x4d2af5){logger[_0xf3ac('0xa')](_0xf3ac('0x14'),_0x506110);logger['debug']('CreateReportAgentPreview',_0x506110,JSON[_0xf3ac('0xd')](_0x4d2af5));_0x1f76a9(_0x4d2af5);})[_0xf3ac('0x12')](function(_0x3b5643){logger[_0xf3ac('0xe')](_0xf3ac('0x14'),_0x3b5643[_0xf3ac('0x10')],_0x506110);_0x58c709(_0x2f3208[_0xf3ac('0xe')](0x1f4,_0x3b5643[_0xf3ac('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index ab445c6..43806e6 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 _0x72d7=['queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','get','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','isAuthenticated','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/whatsapp/queues','/fax/queues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','/trunks','trunks','/campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify'];(function(_0x24431a,_0x52459a){var _0x454ec7=function(_0x34cd60){while(--_0x34cd60){_0x24431a['push'](_0x24431a['shift']());}};_0x454ec7(++_0x52459a);}(_0x72d7,0x19b));var _0x772d=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x72d7[_0x3c2a69];return _0x596bc8;};'use strict';var multer=require(_0x772d('0x0'));var util=require(_0x772d('0x1'));var path=require(_0x772d('0x2'));var express=require(_0x772d('0x3'));var router=express[_0x772d('0x4')]();var auth=require(_0x772d('0x5'));var controller=require('./rpc.controller');router[_0x772d('0x6')]('/voice/channels',auth['isAuthenticated'](),controller[_0x772d('0x7')]);router[_0x772d('0x6')](_0x772d('0x8'),auth['isAuthenticated'](),controller[_0x772d('0x9')]);router[_0x772d('0x6')](_0x772d('0xa'),auth[_0x772d('0xb')](),controller[_0x772d('0xc')]);router[_0x772d('0x6')](_0x772d('0xd'),auth['isAuthenticated'](),controller[_0x772d('0xe')]);router['get']('/chat/queues',auth['isAuthenticated'](),controller[_0x772d('0xf')]);router[_0x772d('0x6')](_0x772d('0x10'),auth[_0x772d('0xb')](),controller[_0x772d('0x11')]);router[_0x772d('0x6')](_0x772d('0x12'),auth[_0x772d('0xb')](),controller['mailAccounts']);router[_0x772d('0x6')](_0x772d('0x13'),auth[_0x772d('0xb')](),controller[_0x772d('0x14')]);router[_0x772d('0x6')]('/sms/queues',auth[_0x772d('0xb')](),controller['smsQueues']);router['get'](_0x772d('0x15'),auth[_0x772d('0xb')](),controller['whatsappQueues']);router[_0x772d('0x6')](_0x772d('0x16'),auth[_0x772d('0xb')](),controller['faxQueues']);router[_0x772d('0x6')](_0x772d('0x17'),auth[_0x772d('0xb')](),controller['voiceQueuesPreview']);router[_0x772d('0x6')](_0x772d('0x18'),auth[_0x772d('0xb')](),controller[_0x772d('0x19')]);router['get']('/voice/queues/channels/:uniqueid',auth[_0x772d('0xb')](),controller[_0x772d('0x1a')]);router[_0x772d('0x6')](_0x772d('0x1b'),auth[_0x772d('0xb')](),controller['voiceQueuesChannelHangup']);router['get'](_0x772d('0x1c'),auth['isAuthenticated'](),controller[_0x772d('0x1d')]);router['get']('/voice/queues/:id',auth[_0x772d('0xb')](),controller[_0x772d('0x1e')]);router[_0x772d('0x1f')]('/voice/queues/:id',auth[_0x772d('0xb')](),controller[_0x772d('0x20')]);router[_0x772d('0x6')](_0x772d('0x21'),auth[_0x772d('0xb')](),controller[_0x772d('0x22')]);router[_0x772d('0x6')](_0x772d('0x23'),auth['isAuthenticated'](),controller[_0x772d('0x24')]);router[_0x772d('0x6')](_0x772d('0x25'),auth[_0x772d('0xb')](),controller[_0x772d('0x26')]);router[_0x772d('0x1f')](_0x772d('0x27'),auth['isAuthenticated'](),controller[_0x772d('0x28')]);router[_0x772d('0x6')](_0x772d('0x29'),auth['isAuthenticated'](),controller['telephones']);router[_0x772d('0x6')](_0x772d('0x2a'),auth[_0x772d('0xb')](),controller[_0x772d('0x2b')]);router[_0x772d('0x6')](_0x772d('0x2c'),auth[_0x772d('0xb')](),controller['campaigns']);router[_0x772d('0x6')]('/fax/accounts',auth[_0x772d('0xb')](),controller[_0x772d('0x2d')]);router[_0x772d('0x6')](_0x772d('0x2e'),auth[_0x772d('0xb')](),controller[_0x772d('0x2f')]);router[_0x772d('0x6')](_0x772d('0x30'),auth[_0x772d('0xb')](),controller[_0x772d('0x31')]);router[_0x772d('0x6')]('/openchannel/queues/waitinginteractions',auth[_0x772d('0xb')](),controller['openchannelQueuesWaitingInteractions']);router[_0x772d('0x6')](_0x772d('0x32'),auth[_0x772d('0xb')](),controller[_0x772d('0x33')]);router[_0x772d('0x6')]('/sms/queues/waitinginteractions',auth[_0x772d('0xb')](),controller['smsQueuesWaitingInteractions']);router['get'](_0x772d('0x34'),auth[_0x772d('0xb')](),controller[_0x772d('0x35')]);router['get']('/fax/queues/waitinginteractions',auth[_0x772d('0xb')](),controller[_0x772d('0x36')]);router[_0x772d('0x37')](_0x772d('0x38'),auth[_0x772d('0xb')](),controller[_0x772d('0x39')](_0x772d('0x3a')));router[_0x772d('0x6')](_0x772d('0x3b'),auth[_0x772d('0xb')](),controller[_0x772d('0x3c')]);router[_0x772d('0x37')](_0x772d('0x3d'),auth[_0x772d('0xb')](),controller['queueNotify']('chat'));router[_0x772d('0x6')]('/chat/queues/:id',auth[_0x772d('0xb')](),controller[_0x772d('0x3e')]);router['post'](_0x772d('0x3f'),auth[_0x772d('0xb')](),controller['queueNotify'](_0x772d('0x40')));router[_0x772d('0x6')](_0x772d('0x41'),auth[_0x772d('0xb')](),controller[_0x772d('0x42')]);router['post']('/openchannel/queues/:id/notify',auth[_0x772d('0xb')](),controller[_0x772d('0x39')](_0x772d('0x43')));router['get']('/openchannel/queues/:id',auth[_0x772d('0xb')](),controller[_0x772d('0x44')]);router[_0x772d('0x37')](_0x772d('0x45'),auth[_0x772d('0xb')](),controller['queueNotify'](_0x772d('0x46')));router[_0x772d('0x37')](_0x772d('0x47'),auth[_0x772d('0xb')](),controller['queueNotify']('whatsapp'));router['get'](_0x772d('0x48'),auth[_0x772d('0xb')](),controller[_0x772d('0x49')]);router[_0x772d('0x6')](_0x772d('0x4a'),auth[_0x772d('0xb')](),controller['showWhatsappQueues']);router[_0x772d('0x37')](_0x772d('0x4b'),auth[_0x772d('0xb')](),controller[_0x772d('0x4c')]);module[_0x772d('0x4d')]=router; \ No newline at end of file +var _0x5a8f=['fax','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','path','Router','../../components/auth/service','get','/voice/channels','isAuthenticated','voiceChannels','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','trunks','campaigns','/fax/accounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','showMailQueues','post','/chat/queues/:id/notify','chat','/chat/queues/:id','/fax/queues/:id/notify'];(function(_0x1477f5,_0x5477ff){var _0x140a7a=function(_0x406478){while(--_0x406478){_0x1477f5['push'](_0x1477f5['shift']());}};_0x140a7a(++_0x5477ff);}(_0x5a8f,0x19d));var _0xf5a8=function(_0x4c4d9c,_0x5bd0eb){_0x4c4d9c=_0x4c4d9c-0x0;var _0x5063fb=_0x5a8f[_0x4c4d9c];return _0x5063fb;};'use strict';var multer=require(_0xf5a8('0x0'));var util=require(_0xf5a8('0x1'));var path=require(_0xf5a8('0x2'));var express=require('express');var router=express[_0xf5a8('0x3')]();var auth=require(_0xf5a8('0x4'));var controller=require('./rpc.controller');router[_0xf5a8('0x5')](_0xf5a8('0x6'),auth[_0xf5a8('0x7')](),controller[_0xf5a8('0x8')]);router[_0xf5a8('0x5')]('/voice/channels/:uniqueid/mixmonitor',auth[_0xf5a8('0x7')](),controller[_0xf5a8('0x9')]);router[_0xf5a8('0x5')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0xf5a8('0x7')](),controller[_0xf5a8('0xa')]);router[_0xf5a8('0x5')](_0xf5a8('0xb'),auth[_0xf5a8('0x7')](),controller[_0xf5a8('0xc')]);router[_0xf5a8('0x5')](_0xf5a8('0xd'),auth[_0xf5a8('0x7')](),controller[_0xf5a8('0xe')]);router['get'](_0xf5a8('0xf'),auth[_0xf5a8('0x7')](),controller[_0xf5a8('0x10')]);router[_0xf5a8('0x5')](_0xf5a8('0x11'),auth[_0xf5a8('0x7')](),controller[_0xf5a8('0x12')]);router[_0xf5a8('0x5')](_0xf5a8('0x13'),auth[_0xf5a8('0x7')](),controller[_0xf5a8('0x14')]);router[_0xf5a8('0x5')](_0xf5a8('0x15'),auth[_0xf5a8('0x7')](),controller[_0xf5a8('0x16')]);router[_0xf5a8('0x5')](_0xf5a8('0x17'),auth[_0xf5a8('0x7')](),controller['whatsappQueues']);router['get'](_0xf5a8('0x18'),auth[_0xf5a8('0x7')](),controller[_0xf5a8('0x19')]);router[_0xf5a8('0x5')](_0xf5a8('0x1a'),auth[_0xf5a8('0x7')](),controller[_0xf5a8('0x1b')]);router[_0xf5a8('0x5')](_0xf5a8('0x1c'),auth[_0xf5a8('0x7')](),controller[_0xf5a8('0x1d')]);router[_0xf5a8('0x5')](_0xf5a8('0x1e'),auth[_0xf5a8('0x7')](),controller['voiceQueuesChannel']);router[_0xf5a8('0x5')](_0xf5a8('0x1f'),auth[_0xf5a8('0x7')](),controller['voiceQueuesChannelHangup']);router['get'](_0xf5a8('0x20'),auth[_0xf5a8('0x7')](),controller['voiceQueuesChannelRedirect']);router[_0xf5a8('0x5')](_0xf5a8('0x21'),auth['isAuthenticated'](),controller[_0xf5a8('0x22')]);router[_0xf5a8('0x23')](_0xf5a8('0x21'),auth['isAuthenticated'](),controller[_0xf5a8('0x24')]);router[_0xf5a8('0x5')](_0xf5a8('0x25'),auth[_0xf5a8('0x7')](),controller[_0xf5a8('0x26')]);router[_0xf5a8('0x5')]('/outbound/channels',auth[_0xf5a8('0x7')](),controller['outboundChannels']);router['get'](_0xf5a8('0x27'),auth[_0xf5a8('0x7')](),controller[_0xf5a8('0x28')]);router['put'](_0xf5a8('0x29'),auth['isAuthenticated'](),controller[_0xf5a8('0x2a')]);router[_0xf5a8('0x5')](_0xf5a8('0x2b'),auth[_0xf5a8('0x7')](),controller['telephones']);router[_0xf5a8('0x5')]('/trunks',auth[_0xf5a8('0x7')](),controller[_0xf5a8('0x2c')]);router[_0xf5a8('0x5')]('/campaigns',auth[_0xf5a8('0x7')](),controller[_0xf5a8('0x2d')]);router['get'](_0xf5a8('0x2e'),auth[_0xf5a8('0x7')](),controller['faxAccounts']);router[_0xf5a8('0x5')](_0xf5a8('0x2f'),auth[_0xf5a8('0x7')](),controller['chatQueuesWaitingInteractions']);router['get'](_0xf5a8('0x30'),auth['isAuthenticated'](),controller[_0xf5a8('0x31')]);router[_0xf5a8('0x5')](_0xf5a8('0x32'),auth[_0xf5a8('0x7')](),controller[_0xf5a8('0x33')]);router[_0xf5a8('0x5')](_0xf5a8('0x34'),auth['isAuthenticated'](),controller[_0xf5a8('0x35')]);router[_0xf5a8('0x5')](_0xf5a8('0x36'),auth['isAuthenticated'](),controller[_0xf5a8('0x37')]);router['get'](_0xf5a8('0x38'),auth[_0xf5a8('0x7')](),controller['whatsappQueuesWaitingInteractions']);router[_0xf5a8('0x5')](_0xf5a8('0x39'),auth[_0xf5a8('0x7')](),controller[_0xf5a8('0x3a')]);router['post'](_0xf5a8('0x3b'),auth[_0xf5a8('0x7')](),controller[_0xf5a8('0x3c')]('mail'));router[_0xf5a8('0x5')]('/mail/queues/:id',auth[_0xf5a8('0x7')](),controller[_0xf5a8('0x3d')]);router[_0xf5a8('0x3e')](_0xf5a8('0x3f'),auth[_0xf5a8('0x7')](),controller[_0xf5a8('0x3c')](_0xf5a8('0x40')));router[_0xf5a8('0x5')](_0xf5a8('0x41'),auth[_0xf5a8('0x7')](),controller['showChatQueues']);router[_0xf5a8('0x3e')](_0xf5a8('0x42'),auth[_0xf5a8('0x7')](),controller[_0xf5a8('0x3c')](_0xf5a8('0x43')));router[_0xf5a8('0x5')]('/fax/queues/:id',auth[_0xf5a8('0x7')](),controller['showFaxQueues']);router[_0xf5a8('0x3e')](_0xf5a8('0x44'),auth['isAuthenticated'](),controller['queueNotify'](_0xf5a8('0x45')));router['get'](_0xf5a8('0x46'),auth[_0xf5a8('0x7')](),controller[_0xf5a8('0x47')]);router[_0xf5a8('0x3e')]('/sms/queues/:id/notify',auth['isAuthenticated'](),controller[_0xf5a8('0x3c')]('sms'));router[_0xf5a8('0x3e')](_0xf5a8('0x48'),auth[_0xf5a8('0x7')](),controller[_0xf5a8('0x3c')](_0xf5a8('0x49')));router[_0xf5a8('0x5')](_0xf5a8('0x4a'),auth['isAuthenticated'](),controller[_0xf5a8('0x4b')]);router[_0xf5a8('0x5')](_0xf5a8('0x4c'),auth[_0xf5a8('0x7')](),controller[_0xf5a8('0x4d')]);router[_0xf5a8('0x3e')](_0xf5a8('0x4e'),auth['isAuthenticated'](),controller[_0xf5a8('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 b0bc700..9c2f9fa 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 _0xabce=['InteractionId','From','QueueId','TransferReport','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Agent\x20not\x20found','update','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','jayson/promise','client','http','request','then','error','code','message','result','catch','json','sendStatus','stack','name','status','send','isNil','rows','find','voiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','OutboundChannels','Agents','agentCapacity','interaction','MemberReport','findAll','user','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','agent','internal','AgentCapacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','FaxAccounts','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','value','indexOf','queue_id','filter','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','queue','MessageId'];(function(_0x5a3604,_0x3d15b5){var _0x17ce7e=function(_0x1ccff8){while(--_0x1ccff8){_0x5a3604['push'](_0x5a3604['shift']());}};_0x17ce7e(++_0x3d15b5);}(_0xabce,0x103));var _0xeabc=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xabce[_0x1ddedd];return _0xa3e1ac;};'use strict';var BPromise=require(_0xeabc('0x0'));var moment=require(_0xeabc('0x1'));var _=require(_0xeabc('0x2'));var util=require(_0xeabc('0x3'));var db=require(_0xeabc('0x4'))['db'];var logger=require('../../config/logger')('api');var jayson=require(_0xeabc('0x5'));var amiClient=jayson[_0xeabc('0x6')][_0xeabc('0x7')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0xeabc('0x6')]['http']({'port':0x232c});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){var _0x5d59d5=_0x3bdc29?_0x3bdc29:amiClient;return _0x5d59d5[_0xeabc('0x8')](_0x229ba4,_0x52ede8)[_0xeabc('0x9')](function(_0x2f73e9){if(_0x2f73e9[_0xeabc('0xa')]){if(_0x2f73e9[_0xeabc('0xa')][_0xeabc('0xb')]===0x1f4){return _0x8434c5(_0x2f73e9[_0xeabc('0xa')][_0xeabc('0xc')]);}return _0x9417af(_0x2f73e9[_0xeabc('0xa')][_0xeabc('0xc')]);}else{_0x9417af(_0x2f73e9[_0xeabc('0xd')]);}})[_0xeabc('0xe')](function(_0x435ea7){_0x8434c5(_0x435ea7);});});}function respondWithResult(_0x3fd0b5,_0x36a92e){_0x36a92e=_0x36a92e||0xc8;return function(_0xcfbf06){if(_0xcfbf06){return _0x3fd0b5['status'](_0x36a92e)[_0xeabc('0xf')](_0xcfbf06);}return _0x3fd0b5[_0xeabc('0x10')](0x194);};}function handleError(_0x3251c6,_0x55f0de){_0x55f0de=_0x55f0de||0x1f4;return function(_0x5f4ee8){logger[_0xeabc('0xa')](_0x5f4ee8[_0xeabc('0x11')]);if(_0x5f4ee8[_0xeabc('0x12')]){delete _0x5f4ee8['name'];}_0x3251c6[_0xeabc('0x13')](_0x55f0de)[_0xeabc('0x14')](_0x5f4ee8);};}function findById(_0x49f2d8){return function(_0x53fe28){if(!_[_0xeabc('0x15')](_0x49f2d8)&&!_['isNil'](_0x53fe28)&&!_[_0xeabc('0x15')](_0x53fe28[_0xeabc('0x16')])){return _[_0xeabc('0x17')](_0x53fe28[_0xeabc('0x16')],function(_0x31dd53){return _0x31dd53['id']==_0x49f2d8;});}return null;};}exports[_0xeabc('0x18')]=function(_0x384be5,_0x5e30ee){return respondWithRpcPromise('VoiceChannels',_0x384be5[_0xeabc('0x19')])['then'](respondWithResult(_0x5e30ee,null))[_0xeabc('0xe')](handleError(_0x5e30ee,null));};exports[_0xeabc('0x1a')]=function(_0x502947,_0x28063a){return respondWithRpcPromise(_0xeabc('0x1b'),_[_0xeabc('0x1c')](_0x502947[_0xeabc('0x19')],_0x502947[_0xeabc('0x1d')]))['then'](respondWithResult(_0x28063a,null))[_0xeabc('0xe')](handleError(_0x28063a,null));};exports[_0xeabc('0x1e')]=function(_0x91ab00,_0x5bdd57){return respondWithRpcPromise(_0xeabc('0x1f'),_[_0xeabc('0x1c')](_0x91ab00[_0xeabc('0x19')],_0x91ab00[_0xeabc('0x1d')]))['then'](respondWithResult(_0x5bdd57,null))[_0xeabc('0xe')](handleError(_0x5bdd57,null));};exports['voiceQueues']=function(_0x27dbaf,_0x4d4e29){return respondWithRpcPromise(_0xeabc('0x20'),_0x27dbaf[_0xeabc('0x19')])[_0xeabc('0x9')](respondWithResult(_0x4d4e29,null))[_0xeabc('0xe')](handleError(_0x4d4e29,null));};exports[_0xeabc('0x21')]=function(_0x137293,_0x131722){return respondWithRpcPromise('VoiceQueues',_0x137293['query'])[_0xeabc('0x9')](findById(_0x137293['params']['id']))[_0xeabc('0x9')](respondWithResult(_0x131722,null))[_0xeabc('0xe')](handleError(_0x131722,null));};exports['updateVoiceQueue']=function(_0x2163e6,_0x38572d){return respondWithRpcPromise(_0xeabc('0x22'),_[_0xeabc('0x1c')](_0x2163e6[_0xeabc('0x23')],_0x2163e6[_0xeabc('0x1d')]))[_0xeabc('0x9')](respondWithResult(_0x38572d,null))[_0xeabc('0xe')](handleError(_0x38572d,null));};exports[_0xeabc('0x24')]=function(_0x5ebb86,_0x5b34dd){return respondWithRpcPromise('VoiceQueuesPreview',_[_0xeabc('0x1c')](_0x5ebb86[_0xeabc('0x19')],_0x5ebb86[_0xeabc('0x1d')]))[_0xeabc('0x9')](respondWithResult(_0x5b34dd,null))[_0xeabc('0xe')](handleError(_0x5b34dd,null));};exports[_0xeabc('0x25')]=function(_0x61c0af,_0x545d7f){return respondWithRpcPromise(_0xeabc('0x26'),_0x61c0af[_0xeabc('0x19')])[_0xeabc('0x9')](respondWithResult(_0x545d7f,null))['catch'](handleError(_0x545d7f,null));};exports[_0xeabc('0x27')]=function(_0x3777c1,_0x4492fd){return respondWithRpcPromise('VoiceQueuesChannel',_[_0xeabc('0x1c')](_0x3777c1[_0xeabc('0x19')],_0x3777c1[_0xeabc('0x1d')]))['then'](respondWithResult(_0x4492fd,null))[_0xeabc('0xe')](handleError(_0x4492fd,null));};exports[_0xeabc('0x28')]=function(_0x5d9acf,_0x50cca2){return respondWithRpcPromise(_0xeabc('0x29'),_[_0xeabc('0x1c')](_0x5d9acf['query'],_0x5d9acf[_0xeabc('0x1d')]))[_0xeabc('0x9')](respondWithResult(_0x50cca2,null))[_0xeabc('0xe')](handleError(_0x50cca2,null));};exports[_0xeabc('0x2a')]=function(_0x34057c,_0x4b7923){return respondWithRpcPromise(_0xeabc('0x2b'),_['merge'](_0x34057c[_0xeabc('0x19')],_0x34057c[_0xeabc('0x1d')]))[_0xeabc('0x9')](respondWithResult(_0x4b7923,null))['catch'](handleError(_0x4b7923,null));};exports['outbound']=function(_0x452580,_0x560d4a){return respondWithRpcPromise(_0xeabc('0x2c'),_0x452580['query'])['then'](respondWithResult(_0x560d4a,null))['catch'](handleError(_0x560d4a,null));};exports['outboundChannels']=function(_0x1e222a,_0x593588){return respondWithRpcPromise(_0xeabc('0x2d'),_0x1e222a[_0xeabc('0x19')])['then'](respondWithResult(_0x593588,null))[_0xeabc('0xe')](handleError(_0x593588,null));};exports['agents']=function(_0x3d48f4,_0x58aafe){var _0xbd7f03;return respondWithRpcPromise(_0xeabc('0x2e'),_0x3d48f4[_0xeabc('0x19')])['then'](function(_0x5a00d0){_0xbd7f03=_0x5a00d0;return respondWithRpcPromise('Agents',_0x3d48f4[_0xeabc('0x19')],routingClient);})[_0xeabc('0x9')](function(_0xafa59b){return _['merge']({},_0xafa59b,_0xbd7f03);})['then'](respondWithResult(_0x58aafe,null))[_0xeabc('0xe')](handleError(_0x58aafe,null));};exports[_0xeabc('0x2f')]=function(_0x5e9cb3,_0xc6af4d){if(_0x5e9cb3['body']&&_0x5e9cb3[_0xeabc('0x23')]['interaction']&&_0x5e9cb3['user']&&_0x5e9cb3['user'][_0xeabc('0x12')]){for(var _0x37c926 in _0x5e9cb3[_0xeabc('0x23')][_0xeabc('0x30')]){if(_0x5e9cb3['body'][_0xeabc('0x30')]['hasOwnProperty'](_0x37c926)){db[_0xeabc('0x31')][_0xeabc('0x32')]({'where':{'channel':_0x37c926,'membername':_0x5e9cb3[_0xeabc('0x33')][_0xeabc('0x12')],'type':_0xeabc('0x34'),'exitAt':null,'uniqueid':_0x5e9cb3['body']['interaction'][_0x37c926]&&_0x5e9cb3[_0xeabc('0x23')]['interaction'][_0x37c926][_0xeabc('0x35')]?{'$notIn':_0x5e9cb3[_0xeabc('0x23')]['interaction'][_0x37c926]}:{'$ne':null}}})[_0xeabc('0x9')](function(_0x2b3c28){var _0x459c98=moment()[_0xeabc('0x36')](_0xeabc('0x37'));for(var _0xcaa5b9=0x0,_0x2003a7=_0x2b3c28['length'];_0xcaa5b9<_0x2003a7;_0xcaa5b9+=0x1){_0x2b3c28[_0xcaa5b9][_0xeabc('0x38')]({'exitAt':_0x459c98});}});for(var _0x2c85f0=0x0;_0x2c85f0<_0x5e9cb3[_0xeabc('0x23')][_0xeabc('0x30')][_0x37c926][_0xeabc('0x35')];_0x2c85f0+=0x1){db[_0xeabc('0x31')][_0xeabc('0x39')]({'where':{'channel':_0x37c926,'membername':_0x5e9cb3[_0xeabc('0x33')][_0xeabc('0x12')],'type':_0xeabc('0x34'),'uniqueid':_0x5e9cb3['body'][_0xeabc('0x30')][_0x37c926][_0x2c85f0],'exitAt':null},'defaults':{'channel':_0x37c926,'membername':_0x5e9cb3[_0xeabc('0x33')][_0xeabc('0x12')],'interface':_[_0xeabc('0x15')](_0x5e9cb3[_0xeabc('0x33')][_0xeabc('0x3a')])?util[_0xeabc('0x36')]('SIP/%s',_0x5e9cb3[_0xeabc('0x33')][_0xeabc('0x12')]):_0x5e9cb3[_0xeabc('0x33')][_0xeabc('0x3a')],'type':_0xeabc('0x34'),'enterAt':moment()['format'](_0xeabc('0x37')),'role':_0xeabc('0x3b'),'internal':_0x5e9cb3[_0xeabc('0x33')][_0xeabc('0x3c')],'uniqueid':_0x5e9cb3['body'][_0xeabc('0x30')][_0x37c926][_0x2c85f0]}});}}}}return respondWithRpcPromise(_0xeabc('0x3d'),{'id':_0x5e9cb3['params']['id'],'capacity':_0x5e9cb3[_0xeabc('0x23')]['capacity']},routingClient)[_0xeabc('0x9')](respondWithResult(_0xc6af4d,null))['catch'](handleError(_0xc6af4d,null));};exports[_0xeabc('0x3e')]=function(_0x2ec94c,_0x38f988){return respondWithRpcPromise(_0xeabc('0x3f'),_0x2ec94c[_0xeabc('0x19')])[_0xeabc('0x9')](respondWithResult(_0x38f988,null))[_0xeabc('0xe')](handleError(_0x38f988,null));};exports[_0xeabc('0x40')]=function(_0x31aedf,_0x6423f3){return respondWithRpcPromise('Trunks',_0x31aedf[_0xeabc('0x19')])[_0xeabc('0x9')](respondWithResult(_0x6423f3,null))[_0xeabc('0xe')](handleError(_0x6423f3,null));};exports[_0xeabc('0x41')]=function(_0x555d6b,_0x1cef45){return respondWithRpcPromise(_0xeabc('0x42'),_0x555d6b[_0xeabc('0x19')])[_0xeabc('0x9')](respondWithResult(_0x1cef45,null))['catch'](handleError(_0x1cef45,null));};exports[_0xeabc('0x43')]=function(_0x1c7679,_0x3a1b84){return respondWithRpcPromise(_0xeabc('0x44'),_0x1c7679[_0xeabc('0x19')],routingClient)[_0xeabc('0x9')](respondWithResult(_0x3a1b84,null))[_0xeabc('0xe')](handleError(_0x3a1b84,null));};exports[_0xeabc('0x45')]=function(_0x17acf8,_0x58ab08){return respondWithRpcPromise(_0xeabc('0x44'),_0x17acf8['query'],routingClient)['then'](findById(_0x17acf8['params']['id']))[_0xeabc('0x9')](respondWithResult(_0x58ab08,null))[_0xeabc('0xe')](handleError(_0x58ab08,null));};exports[_0xeabc('0x46')]=function(_0xb35103,_0xe89728){return respondWithRpcPromise(_0xeabc('0x47'),_0xb35103['query'],routingClient)[_0xeabc('0x9')](respondWithResult(_0xe89728,null))[_0xeabc('0xe')](handleError(_0xe89728,null));};exports[_0xeabc('0x48')]=function(_0x104c1e,_0x2ddc53){return respondWithRpcPromise(_0xeabc('0x47'),_0x104c1e[_0xeabc('0x19')],routingClient)[_0xeabc('0x9')](findById(_0x104c1e['params']['id']))['then'](respondWithResult(_0x2ddc53,null))[_0xeabc('0xe')](handleError(_0x2ddc53,null));};exports[_0xeabc('0x49')]=function(_0x2c0894,_0x4b3794){return respondWithRpcPromise(_0xeabc('0x4a'),_0x2c0894['query'],mailClient)['then'](respondWithResult(_0x4b3794,null))[_0xeabc('0xe')](handleError(_0x4b3794,null));};exports[_0xeabc('0x4b')]=function(_0x13f04f,_0x4f5451){return respondWithRpcPromise(_0xeabc('0x4c'),_0x13f04f[_0xeabc('0x19')],routingClient)['then'](respondWithResult(_0x4f5451,null))[_0xeabc('0xe')](handleError(_0x4f5451,null));};exports[_0xeabc('0x4d')]=function(_0x321a90,_0x7697f7){return respondWithRpcPromise(_0xeabc('0x4c'),_0x321a90[_0xeabc('0x19')],routingClient)['then'](findById(_0x321a90[_0xeabc('0x1d')]['id']))[_0xeabc('0x9')](respondWithResult(_0x7697f7,null))[_0xeabc('0xe')](handleError(_0x7697f7,null));};exports[_0xeabc('0x4e')]=function(_0x1b61a8,_0x19faa4){return respondWithRpcPromise(_0xeabc('0x4f'),_0x1b61a8[_0xeabc('0x19')],routingClient)[_0xeabc('0x9')](respondWithResult(_0x19faa4,null))['catch'](handleError(_0x19faa4,null));};exports[_0xeabc('0x50')]=function(_0x590439,_0x404846){return respondWithRpcPromise(_0xeabc('0x4f'),_0x590439[_0xeabc('0x19')],routingClient)[_0xeabc('0x9')](findById(_0x590439[_0xeabc('0x1d')]['id']))[_0xeabc('0x9')](respondWithResult(_0x404846,null))[_0xeabc('0xe')](handleError(_0x404846,null));};exports[_0xeabc('0x51')]=function(_0x5d4bc2,_0x24d0e5){return respondWithRpcPromise('WhatsappQueues',_0x5d4bc2[_0xeabc('0x19')],routingClient)[_0xeabc('0x9')](respondWithResult(_0x24d0e5,null))[_0xeabc('0xe')](handleError(_0x24d0e5,null));};exports[_0xeabc('0x52')]=function(_0x5b4430,_0x12fd48){return respondWithRpcPromise('WhatsappQueues',_0x5b4430['query'],routingClient)[_0xeabc('0x9')](findById(_0x5b4430[_0xeabc('0x1d')]['id']))[_0xeabc('0x9')](respondWithResult(_0x12fd48,null))[_0xeabc('0xe')](handleError(_0x12fd48,null));};exports['faxQueues']=function(_0x51a0c7,_0x2e712e){return respondWithRpcPromise('FaxQueues',_0x51a0c7['query'],routingClient)[_0xeabc('0x9')](respondWithResult(_0x2e712e,null))['catch'](handleError(_0x2e712e,null));};exports['showFaxQueues']=function(_0xa44f2d,_0x1c84b5){return respondWithRpcPromise('FaxQueues',_0xa44f2d['query'],routingClient)[_0xeabc('0x9')](findById(_0xa44f2d['params']['id']))[_0xeabc('0x9')](respondWithResult(_0x1c84b5,null))[_0xeabc('0xe')](handleError(_0x1c84b5,null));};exports['faxAccounts']=function(_0x5d6477,_0x24365a){return respondWithRpcPromise(_0xeabc('0x53'),_0x5d6477[_0xeabc('0x19')])[_0xeabc('0x9')](respondWithResult(_0x24365a,null))[_0xeabc('0xe')](handleError(_0x24365a,null));};exports['chatQueuesWaitingInteractions']=function(_0x53f578,_0x391cae){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x53f578[_0xeabc('0x19')],routingClient)['then'](respondWithResult(_0x391cae,null))[_0xeabc('0xe')](handleError(_0x391cae,null));};exports['mailQueuesWaitingInteractions']=function(_0x1fdaba,_0x53ac31){return respondWithRpcPromise(_0xeabc('0x54'),_0x1fdaba[_0xeabc('0x19')],routingClient)[_0xeabc('0x9')](respondWithResult(_0x53ac31,null))[_0xeabc('0xe')](handleError(_0x53ac31,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x6ee7cf,_0x4fa682){return respondWithRpcPromise(_0xeabc('0x55'),_0x6ee7cf[_0xeabc('0x19')],routingClient)[_0xeabc('0x9')](respondWithResult(_0x4fa682,null))[_0xeabc('0xe')](handleError(_0x4fa682,null));};exports[_0xeabc('0x56')]=function(_0x5c1ab2,_0x239350){return respondWithRpcPromise(_0xeabc('0x55'),_0x5c1ab2[_0xeabc('0x19')],routingClient)[_0xeabc('0x9')](function(_0x5427c8){if(_0x5c1ab2[_0xeabc('0x19')][_0xeabc('0x57')]!==undefined){var _0xe60b11=_(_0x5427c8[_0xeabc('0x16')])['filter']([_0x5c1ab2[_0xeabc('0x19')][_0xeabc('0x57')],_0x5c1ab2[_0xeabc('0x1d')]['id']])[_0xeabc('0x58')]('queue_id')['uniq']()[_0xeabc('0x59')]();return _0x5427c8['rows']['filter'](function(_0x3271b6){return _0xe60b11[_0xeabc('0x5a')](_0x3271b6[_0xeabc('0x5b')])>-0x1;});}else{return _0x5427c8['rows'][_0xeabc('0x5c')](function(_0x403b18){return _0x403b18['queue_id']===parseInt(_0x5c1ab2[_0xeabc('0x1d')]['id']);});}})[_0xeabc('0x9')](respondWithResult(_0x239350,null))[_0xeabc('0xe')](handleError(_0x239350,null));};exports[_0xeabc('0x5d')]=function(_0x2ece2c,_0x4bf9d8){return respondWithRpcPromise(_0xeabc('0x5e'),_0x2ece2c['query'],routingClient)['then'](respondWithResult(_0x4bf9d8,null))['catch'](handleError(_0x4bf9d8,null));};exports[_0xeabc('0x5f')]=function(_0x1c8a51,_0x1b6e9e){return respondWithRpcPromise(_0xeabc('0x60'),_0x1c8a51[_0xeabc('0x19')],routingClient)['then'](respondWithResult(_0x1b6e9e,null))[_0xeabc('0xe')](handleError(_0x1b6e9e,null));};exports['faxQueuesWaitingInteractions']=function(_0x1795fe,_0x2f95c7){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x1795fe[_0xeabc('0x19')],routingClient)['then'](respondWithResult(_0x2f95c7,null))['catch'](handleError(_0x2f95c7,null));};exports[_0xeabc('0x61')]=function(_0xa5c4ca){return function(_0x439a48,_0x3acb88){var _0x3c6a49,_0x4dfc4b;var _0x399735=_[_0xeabc('0x62')](_0xa5c4ca);var _0x33e5fb=_0xa5c4ca===_0xeabc('0x63')?_0xeabc('0x64'):_0xeabc('0x65');return db[_0x399735+_0xeabc('0x66')][_0xeabc('0x67')]({'raw':!![],'where':{'id':_0x439a48[_0xeabc('0x1d')]['id']}})[_0xeabc('0x9')](function(_0x522c6e){if(_[_0xeabc('0x15')](_0x522c6e)){throw new Error(_0x399735+_0xeabc('0x68'));}_0x3c6a49=_0x522c6e;return db[_0x399735+_0xeabc('0x69')]['findOne']({'where':{'id':_0x439a48['body'][_0xeabc('0x6a')]},'include':[{'model':db[_0x399735+_0xeabc('0x6b')],'as':_0xeabc('0x6b')},{'model':db[_0x399735+_0x33e5fb],'as':_0xeabc('0x65')}]});})[_0xeabc('0x9')](function(_0x5f5a47){if(_[_0xeabc('0x15')](_0x5f5a47)){throw new Error(_0x399735+'\x20Message\x20not\x20found');}_0x4dfc4b=_0x5f5a47;return _0x5f5a47['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xeabc('0x9')](function(){var _0x302e94={'uniqueid':_0xa5c4ca+'.'+_0x4dfc4b['id']+'.'+_0x4dfc4b['Interaction']['id'],'FromUserId':_0x439a48[_0xeabc('0x33')]['id'],'type':_0xeabc('0x6c')};_0x302e94[_0x399735+_0xeabc('0x6d')]=_0x4dfc4b['id'];_0x302e94[_0x399735+_0xeabc('0x6e')]=_0x4dfc4b[_0xeabc('0x6b')]['id'];_0x302e94[_0xeabc('0x6f')+_0x399735+_0x33e5fb+'Id']=_0x4dfc4b[_0xeabc('0x65')]['id'];_0x302e94['To'+_0x399735+_0xeabc('0x70')]=_0x3c6a49['id'];return db[_0x399735+_0xeabc('0x71')][_0xeabc('0x72')](_0x302e94);})[_0xeabc('0x9')](function(){return respondWithRpcPromise('Start',{'channel':_0xa5c4ca,'interaction':_0x4dfc4b[_0xeabc('0x6b')],'message':_0x4dfc4b,'account':_0x4dfc4b['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xeabc('0x6c'),'appdata':_0x3c6a49[_0xeabc('0x12')]+','+(_0x4dfc4b[_0xeabc('0x65')][_0xeabc('0x73')]||0x12c),'interval':_0xeabc('0x74')}]},routingClient);})[_0xeabc('0x9')](respondWithResult(_0x3acb88,null))[_0xeabc('0xe')](handleError(_0x3acb88,null));};};exports[_0xeabc('0x75')]=function(_0xb85c3d,_0x156e20){var _0x42e92b,_0x5d471f;if(_[_0xeabc('0x15')](_0xb85c3d[_0xeabc('0x23')][_0xeabc('0x76')])){throw new Error(_0xeabc('0x77'));}var _0x5b00d6=_0xb85c3d[_0xeabc('0x23')][_0xeabc('0x76')];var _0x580661=_[_0xeabc('0x62')](_0x5b00d6);var _0x22ef88=_0x5b00d6==='chat'?'Website':'Account';return db['User'][_0xeabc('0x67')]({'raw':!![],'where':{'id':_0xb85c3d[_0xeabc('0x1d')]['id'],'role':_0xeabc('0x3b')}})[_0xeabc('0x9')](function(_0x1d8dca){if(_[_0xeabc('0x15')](_0x1d8dca)){throw new Error(_0xeabc('0x78'));}_0x42e92b=_0x1d8dca;return db[_0x580661+_0xeabc('0x69')][_0xeabc('0x67')]({'where':{'id':_0xb85c3d[_0xeabc('0x23')]['messageId']},'include':[{'model':db[_0x580661+_0xeabc('0x6b')],'as':_0xeabc('0x6b')},{'model':db[_0x580661+_0x22ef88],'as':'Account'}]});})[_0xeabc('0x9')](function(_0x32063c){if(_[_0xeabc('0x15')](_0x32063c)){throw new Error(_0x580661+'\x20Message\x20not\x20found');}_0x5d471f=_0x32063c;return _0x32063c[_0xeabc('0x79')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x425e5c={'uniqueid':_0x5b00d6+'.'+_0x5d471f['id']+'.'+_0x5d471f[_0xeabc('0x6b')]['id'],'FromUserId':_0xb85c3d[_0xeabc('0x33')]['id'],'type':_0xeabc('0x6c'),'ToUserId':_0x42e92b['id']};_0x425e5c[_0x580661+_0xeabc('0x6d')]=_0x5d471f['id'];_0x425e5c[_0x580661+'InteractionId']=_0x5d471f['Interaction']['id'];_0x425e5c['From'+_0x580661+_0x22ef88+'Id']=_0x5d471f['Account']['id'];return db[_0x580661+_0xeabc('0x71')][_0xeabc('0x72')](_0x425e5c);})[_0xeabc('0x9')](function(){return respondWithRpcPromise('Start',{'channel':_0x5b00d6,'interaction':_0x5d471f[_0xeabc('0x6b')],'message':_0x5d471f,'account':_0x5d471f[_0xeabc('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0xeabc('0x3b'),'appdata':_0x42e92b[_0xeabc('0x12')]+','+(_0x5d471f[_0xeabc('0x65')][_0xeabc('0x7a')]||0x12c),'interval':_0xeabc('0x74')}]},routingClient);})[_0xeabc('0x9')](respondWithResult(_0x156e20,null))[_0xeabc('0xe')](handleError(_0x156e20,null));}; \ No newline at end of file +var _0x038b=['\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','MessageId','InteractionId','From','QueueId','TransferReport','create','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','User','Agent\x20not\x20found','update','Start','agentTransferTimeout','moment','lodash','util','../../config/logger','jayson/promise','client','http','request','error','message','result','catch','status','json','sendStatus','name','send','isNil','rows','find','voiceChannels','VoiceChannels','then','voiceChannelMixMonitor','merge','query','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','OutboundChannels','agents','agentCapacity','interaction','user','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','agent','internal','capacity','telephones','Telephones','trunks','Trunks','campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','showOpenchannelQueues','OpenchannelQueues','SmsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne'];(function(_0x1824af,_0x3bf2d2){var _0x3bb61e=function(_0x52ef8f){while(--_0x52ef8f){_0x1824af['push'](_0x1824af['shift']());}};_0x3bb61e(++_0x3bf2d2);}(_0x038b,0x114));var _0xb038=function(_0x39398,_0x2b6cf2){_0x39398=_0x39398-0x0;var _0x4706f3=_0x038b[_0x39398];return _0x4706f3;};'use strict';var BPromise=require('bluebird');var moment=require(_0xb038('0x0'));var _=require(_0xb038('0x1'));var util=require(_0xb038('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xb038('0x3'))('api');var jayson=require(_0xb038('0x4'));var amiClient=jayson[_0xb038('0x5')]['http']({'port':0x232a});var mailClient=jayson[_0xb038('0x5')][_0xb038('0x6')]({'port':0x232b});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x2e3e64,_0x1b077a,_0x1534a9){return new BPromise(function(_0x4b4085,_0x48a4d7){var _0x462e8f=_0x1534a9?_0x1534a9:amiClient;return _0x462e8f[_0xb038('0x7')](_0x2e3e64,_0x1b077a)['then'](function(_0x53bcc0){if(_0x53bcc0[_0xb038('0x8')]){if(_0x53bcc0[_0xb038('0x8')]['code']===0x1f4){return _0x48a4d7(_0x53bcc0[_0xb038('0x8')][_0xb038('0x9')]);}return _0x4b4085(_0x53bcc0[_0xb038('0x8')][_0xb038('0x9')]);}else{_0x4b4085(_0x53bcc0[_0xb038('0xa')]);}})[_0xb038('0xb')](function(_0x1e6474){_0x48a4d7(_0x1e6474);});});}function respondWithResult(_0x439751,_0x16e4a3){_0x16e4a3=_0x16e4a3||0xc8;return function(_0x57acd8){if(_0x57acd8){return _0x439751[_0xb038('0xc')](_0x16e4a3)[_0xb038('0xd')](_0x57acd8);}return _0x439751[_0xb038('0xe')](0x194);};}function handleError(_0x3cc717,_0x3a71a6){_0x3a71a6=_0x3a71a6||0x1f4;return function(_0x13acc7){logger[_0xb038('0x8')](_0x13acc7['stack']);if(_0x13acc7[_0xb038('0xf')]){delete _0x13acc7[_0xb038('0xf')];}_0x3cc717[_0xb038('0xc')](_0x3a71a6)[_0xb038('0x10')](_0x13acc7);};}function findById(_0xdef213){return function(_0x2b4173){if(!_['isNil'](_0xdef213)&&!_[_0xb038('0x11')](_0x2b4173)&&!_[_0xb038('0x11')](_0x2b4173[_0xb038('0x12')])){return _[_0xb038('0x13')](_0x2b4173['rows'],function(_0x49b237){return _0x49b237['id']==_0xdef213;});}return null;};}exports[_0xb038('0x14')]=function(_0x3f48e6,_0x3e06ef){return respondWithRpcPromise(_0xb038('0x15'),_0x3f48e6['query'])[_0xb038('0x16')](respondWithResult(_0x3e06ef,null))[_0xb038('0xb')](handleError(_0x3e06ef,null));};exports[_0xb038('0x17')]=function(_0x33a377,_0xc6cd61){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xb038('0x18')](_0x33a377[_0xb038('0x19')],_0x33a377[_0xb038('0x1a')]))[_0xb038('0x16')](respondWithResult(_0xc6cd61,null))['catch'](handleError(_0xc6cd61,null));};exports[_0xb038('0x1b')]=function(_0x1b7505,_0x4bbf38){return respondWithRpcPromise(_0xb038('0x1c'),_[_0xb038('0x18')](_0x1b7505['query'],_0x1b7505[_0xb038('0x1a')]))['then'](respondWithResult(_0x4bbf38,null))[_0xb038('0xb')](handleError(_0x4bbf38,null));};exports[_0xb038('0x1d')]=function(_0x27ff21,_0x1df7c4){return respondWithRpcPromise(_0xb038('0x1e'),_0x27ff21[_0xb038('0x19')])[_0xb038('0x16')](respondWithResult(_0x1df7c4,null))['catch'](handleError(_0x1df7c4,null));};exports[_0xb038('0x1f')]=function(_0x33cf3c,_0x226631){return respondWithRpcPromise('VoiceQueues',_0x33cf3c[_0xb038('0x19')])[_0xb038('0x16')](findById(_0x33cf3c[_0xb038('0x1a')]['id']))['then'](respondWithResult(_0x226631,null))[_0xb038('0xb')](handleError(_0x226631,null));};exports[_0xb038('0x20')]=function(_0x28a6a9,_0x12b3b6){return respondWithRpcPromise(_0xb038('0x21'),_['merge'](_0x28a6a9[_0xb038('0x22')],_0x28a6a9[_0xb038('0x1a')]))[_0xb038('0x16')](respondWithResult(_0x12b3b6,null))[_0xb038('0xb')](handleError(_0x12b3b6,null));};exports[_0xb038('0x23')]=function(_0xbc8958,_0x29a0d7){return respondWithRpcPromise(_0xb038('0x24'),_[_0xb038('0x18')](_0xbc8958[_0xb038('0x19')],_0xbc8958[_0xb038('0x1a')]))[_0xb038('0x16')](respondWithResult(_0x29a0d7,null))[_0xb038('0xb')](handleError(_0x29a0d7,null));};exports['voiceQueuesChannels']=function(_0x1d807a,_0x598554){return respondWithRpcPromise(_0xb038('0x25'),_0x1d807a[_0xb038('0x19')])[_0xb038('0x16')](respondWithResult(_0x598554,null))[_0xb038('0xb')](handleError(_0x598554,null));};exports[_0xb038('0x26')]=function(_0x424b81,_0x3a393d){return respondWithRpcPromise(_0xb038('0x27'),_[_0xb038('0x18')](_0x424b81[_0xb038('0x19')],_0x424b81['params']))[_0xb038('0x16')](respondWithResult(_0x3a393d,null))[_0xb038('0xb')](handleError(_0x3a393d,null));};exports[_0xb038('0x28')]=function(_0x560342,_0x51e649){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0xb038('0x18')](_0x560342[_0xb038('0x19')],_0x560342[_0xb038('0x1a')]))[_0xb038('0x16')](respondWithResult(_0x51e649,null))[_0xb038('0xb')](handleError(_0x51e649,null));};exports[_0xb038('0x29')]=function(_0x48f777,_0x16abea){return respondWithRpcPromise(_0xb038('0x2a'),_[_0xb038('0x18')](_0x48f777[_0xb038('0x19')],_0x48f777['params']))[_0xb038('0x16')](respondWithResult(_0x16abea,null))[_0xb038('0xb')](handleError(_0x16abea,null));};exports['outbound']=function(_0x5cb40c,_0x26c769){return respondWithRpcPromise(_0xb038('0x2b'),_0x5cb40c[_0xb038('0x19')])[_0xb038('0x16')](respondWithResult(_0x26c769,null))[_0xb038('0xb')](handleError(_0x26c769,null));};exports['outboundChannels']=function(_0x404f82,_0x125d2a){return respondWithRpcPromise(_0xb038('0x2c'),_0x404f82[_0xb038('0x19')])['then'](respondWithResult(_0x125d2a,null))[_0xb038('0xb')](handleError(_0x125d2a,null));};exports[_0xb038('0x2d')]=function(_0x7d2f79,_0x573426){var _0x412d71;return respondWithRpcPromise('Agents',_0x7d2f79[_0xb038('0x19')])[_0xb038('0x16')](function(_0x3ac1db){_0x412d71=_0x3ac1db;return respondWithRpcPromise('Agents',_0x7d2f79[_0xb038('0x19')],routingClient);})[_0xb038('0x16')](function(_0x4e0533){return _['merge']({},_0x4e0533,_0x412d71);})[_0xb038('0x16')](respondWithResult(_0x573426,null))[_0xb038('0xb')](handleError(_0x573426,null));};exports[_0xb038('0x2e')]=function(_0x3c291e,_0x5ad462){if(_0x3c291e[_0xb038('0x22')]&&_0x3c291e[_0xb038('0x22')][_0xb038('0x2f')]&&_0x3c291e[_0xb038('0x30')]&&_0x3c291e['user'][_0xb038('0xf')]){for(var _0x269c7d in _0x3c291e['body'][_0xb038('0x2f')]){if(_0x3c291e[_0xb038('0x22')][_0xb038('0x2f')]['hasOwnProperty'](_0x269c7d)){db[_0xb038('0x31')][_0xb038('0x32')]({'where':{'channel':_0x269c7d,'membername':_0x3c291e['user']['name'],'type':_0xb038('0x33'),'exitAt':null,'uniqueid':_0x3c291e[_0xb038('0x22')][_0xb038('0x2f')][_0x269c7d]&&_0x3c291e[_0xb038('0x22')][_0xb038('0x2f')][_0x269c7d][_0xb038('0x34')]?{'$notIn':_0x3c291e[_0xb038('0x22')][_0xb038('0x2f')][_0x269c7d]}:{'$ne':null}}})['then'](function(_0x5f0d9d){var _0x5e8383=moment()[_0xb038('0x35')](_0xb038('0x36'));for(var _0x52f0b8=0x0,_0x46a724=_0x5f0d9d[_0xb038('0x34')];_0x52f0b8<_0x46a724;_0x52f0b8+=0x1){_0x5f0d9d[_0x52f0b8][_0xb038('0x37')]({'exitAt':_0x5e8383});}});for(var _0x5f24cd=0x0;_0x5f24cd<_0x3c291e[_0xb038('0x22')]['interaction'][_0x269c7d]['length'];_0x5f24cd+=0x1){db[_0xb038('0x31')][_0xb038('0x38')]({'where':{'channel':_0x269c7d,'membername':_0x3c291e[_0xb038('0x30')][_0xb038('0xf')],'type':_0xb038('0x33'),'uniqueid':_0x3c291e[_0xb038('0x22')][_0xb038('0x2f')][_0x269c7d][_0x5f24cd],'exitAt':null},'defaults':{'channel':_0x269c7d,'membername':_0x3c291e[_0xb038('0x30')][_0xb038('0xf')],'interface':_[_0xb038('0x11')](_0x3c291e['user'][_0xb038('0x39')])?util[_0xb038('0x35')]('SIP/%s',_0x3c291e[_0xb038('0x30')][_0xb038('0xf')]):_0x3c291e['user'][_0xb038('0x39')],'type':_0xb038('0x33'),'enterAt':moment()[_0xb038('0x35')](_0xb038('0x36')),'role':_0xb038('0x3a'),'internal':_0x3c291e[_0xb038('0x30')][_0xb038('0x3b')],'uniqueid':_0x3c291e[_0xb038('0x22')][_0xb038('0x2f')][_0x269c7d][_0x5f24cd]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3c291e[_0xb038('0x1a')]['id'],'capacity':_0x3c291e[_0xb038('0x22')][_0xb038('0x3c')]},routingClient)[_0xb038('0x16')](respondWithResult(_0x5ad462,null))[_0xb038('0xb')](handleError(_0x5ad462,null));};exports[_0xb038('0x3d')]=function(_0x591077,_0x1f4997){return respondWithRpcPromise(_0xb038('0x3e'),_0x591077[_0xb038('0x19')])[_0xb038('0x16')](respondWithResult(_0x1f4997,null))[_0xb038('0xb')](handleError(_0x1f4997,null));};exports[_0xb038('0x3f')]=function(_0xd7a862,_0x5b82f4){return respondWithRpcPromise(_0xb038('0x40'),_0xd7a862['query'])[_0xb038('0x16')](respondWithResult(_0x5b82f4,null))[_0xb038('0xb')](handleError(_0x5b82f4,null));};exports[_0xb038('0x41')]=function(_0x998fe3,_0x1518c4){return respondWithRpcPromise('Campaigns',_0x998fe3['query'])['then'](respondWithResult(_0x1518c4,null))[_0xb038('0xb')](handleError(_0x1518c4,null));};exports[_0xb038('0x42')]=function(_0x276fac,_0x218368){return respondWithRpcPromise(_0xb038('0x43'),_0x276fac[_0xb038('0x19')],routingClient)['then'](respondWithResult(_0x218368,null))[_0xb038('0xb')](handleError(_0x218368,null));};exports[_0xb038('0x44')]=function(_0x5b2cbb,_0x5b27d3){return respondWithRpcPromise(_0xb038('0x43'),_0x5b2cbb['query'],routingClient)[_0xb038('0x16')](findById(_0x5b2cbb['params']['id']))[_0xb038('0x16')](respondWithResult(_0x5b27d3,null))[_0xb038('0xb')](handleError(_0x5b27d3,null));};exports[_0xb038('0x45')]=function(_0x4300e9,_0x4ee38b){return respondWithRpcPromise(_0xb038('0x46'),_0x4300e9[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x4ee38b,null))[_0xb038('0xb')](handleError(_0x4ee38b,null));};exports[_0xb038('0x47')]=function(_0x1246c8,_0x14a553){return respondWithRpcPromise(_0xb038('0x46'),_0x1246c8[_0xb038('0x19')],routingClient)[_0xb038('0x16')](findById(_0x1246c8[_0xb038('0x1a')]['id']))[_0xb038('0x16')](respondWithResult(_0x14a553,null))['catch'](handleError(_0x14a553,null));};exports[_0xb038('0x48')]=function(_0x2fc38d,_0x438e7e){return respondWithRpcPromise(_0xb038('0x49'),_0x2fc38d[_0xb038('0x19')],mailClient)['then'](respondWithResult(_0x438e7e,null))[_0xb038('0xb')](handleError(_0x438e7e,null));};exports['openchannelQueues']=function(_0xfb3ce6,_0x170a7e){return respondWithRpcPromise('OpenchannelQueues',_0xfb3ce6[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x170a7e,null))[_0xb038('0xb')](handleError(_0x170a7e,null));};exports[_0xb038('0x4a')]=function(_0x120cc7,_0x2f01c0){return respondWithRpcPromise(_0xb038('0x4b'),_0x120cc7[_0xb038('0x19')],routingClient)[_0xb038('0x16')](findById(_0x120cc7[_0xb038('0x1a')]['id']))['then'](respondWithResult(_0x2f01c0,null))[_0xb038('0xb')](handleError(_0x2f01c0,null));};exports['smsQueues']=function(_0x189894,_0x37e445){return respondWithRpcPromise(_0xb038('0x4c'),_0x189894[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x37e445,null))[_0xb038('0xb')](handleError(_0x37e445,null));};exports[_0xb038('0x4d')]=function(_0x4c23b2,_0x572ad4){return respondWithRpcPromise(_0xb038('0x4c'),_0x4c23b2[_0xb038('0x19')],routingClient)[_0xb038('0x16')](findById(_0x4c23b2['params']['id']))['then'](respondWithResult(_0x572ad4,null))[_0xb038('0xb')](handleError(_0x572ad4,null));};exports['whatsappQueues']=function(_0x35da9e,_0x50e078){return respondWithRpcPromise(_0xb038('0x4e'),_0x35da9e['query'],routingClient)[_0xb038('0x16')](respondWithResult(_0x50e078,null))[_0xb038('0xb')](handleError(_0x50e078,null));};exports[_0xb038('0x4f')]=function(_0x112d77,_0x2c57b9){return respondWithRpcPromise(_0xb038('0x4e'),_0x112d77['query'],routingClient)['then'](findById(_0x112d77[_0xb038('0x1a')]['id']))['then'](respondWithResult(_0x2c57b9,null))[_0xb038('0xb')](handleError(_0x2c57b9,null));};exports[_0xb038('0x50')]=function(_0x2f4650,_0x538690){return respondWithRpcPromise(_0xb038('0x51'),_0x2f4650['query'],routingClient)[_0xb038('0x16')](respondWithResult(_0x538690,null))[_0xb038('0xb')](handleError(_0x538690,null));};exports[_0xb038('0x52')]=function(_0x4a417a,_0x40abb7){return respondWithRpcPromise(_0xb038('0x51'),_0x4a417a[_0xb038('0x19')],routingClient)[_0xb038('0x16')](findById(_0x4a417a[_0xb038('0x1a')]['id']))['then'](respondWithResult(_0x40abb7,null))['catch'](handleError(_0x40abb7,null));};exports['faxAccounts']=function(_0x609caf,_0x4efa0f){return respondWithRpcPromise(_0xb038('0x53'),_0x609caf['query'])[_0xb038('0x16')](respondWithResult(_0x4efa0f,null))[_0xb038('0xb')](handleError(_0x4efa0f,null));};exports[_0xb038('0x54')]=function(_0x1294d7,_0x7c8d01){return respondWithRpcPromise(_0xb038('0x55'),_0x1294d7[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x7c8d01,null))[_0xb038('0xb')](handleError(_0x7c8d01,null));};exports[_0xb038('0x56')]=function(_0x1db407,_0x1a5cf6){return respondWithRpcPromise(_0xb038('0x57'),_0x1db407[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x1a5cf6,null))[_0xb038('0xb')](handleError(_0x1a5cf6,null));};exports[_0xb038('0x58')]=function(_0x123e31,_0x1f9a30){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x123e31[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x1f9a30,null))[_0xb038('0xb')](handleError(_0x1f9a30,null));};exports[_0xb038('0x59')]=function(_0xdaacfe,_0x5ead21){return respondWithRpcPromise(_0xb038('0x5a'),_0xdaacfe[_0xb038('0x19')],routingClient)[_0xb038('0x16')](function(_0x80d720){if(_0xdaacfe[_0xb038('0x19')][_0xb038('0x5b')]!==undefined){var _0x2acbf6=_(_0x80d720[_0xb038('0x12')])[_0xb038('0x5c')]([_0xdaacfe['query']['type'],_0xdaacfe[_0xb038('0x1a')]['id']])['map'](_0xb038('0x5d'))['uniq']()['value']();return _0x80d720['rows'][_0xb038('0x5c')](function(_0x463ae6){return _0x2acbf6['indexOf'](_0x463ae6[_0xb038('0x5d')])>-0x1;});}else{return _0x80d720[_0xb038('0x12')][_0xb038('0x5c')](function(_0x31ccf7){return _0x31ccf7[_0xb038('0x5d')]===parseInt(_0xdaacfe[_0xb038('0x1a')]['id']);});}})[_0xb038('0x16')](respondWithResult(_0x5ead21,null))[_0xb038('0xb')](handleError(_0x5ead21,null));};exports[_0xb038('0x5e')]=function(_0xde487d,_0x4b15b7){return respondWithRpcPromise(_0xb038('0x5f'),_0xde487d[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x4b15b7,null))[_0xb038('0xb')](handleError(_0x4b15b7,null));};exports[_0xb038('0x60')]=function(_0x222e90,_0x425854){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x222e90[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x425854,null))[_0xb038('0xb')](handleError(_0x425854,null));};exports['faxQueuesWaitingInteractions']=function(_0x551fcc,_0x2adf3b){return respondWithRpcPromise(_0xb038('0x61'),_0x551fcc[_0xb038('0x19')],routingClient)['then'](respondWithResult(_0x2adf3b,null))[_0xb038('0xb')](handleError(_0x2adf3b,null));};exports[_0xb038('0x62')]=function(_0x5b003a){return function(_0x2e6db4,_0x1d5640){var _0x240d06,_0x2a41c8;var _0x24f810=_[_0xb038('0x63')](_0x5b003a);var _0x1ea747=_0x5b003a===_0xb038('0x64')?_0xb038('0x65'):_0xb038('0x66');return db[_0x24f810+_0xb038('0x67')][_0xb038('0x68')]({'raw':!![],'where':{'id':_0x2e6db4[_0xb038('0x1a')]['id']}})[_0xb038('0x16')](function(_0x5d1410){if(_[_0xb038('0x11')](_0x5d1410)){throw new Error(_0x24f810+_0xb038('0x69'));}_0x240d06=_0x5d1410;return db[_0x24f810+_0xb038('0x6a')][_0xb038('0x68')]({'where':{'id':_0x2e6db4[_0xb038('0x22')][_0xb038('0x6b')]},'include':[{'model':db[_0x24f810+_0xb038('0x6c')],'as':_0xb038('0x6c')},{'model':db[_0x24f810+_0x1ea747],'as':'Account'}]});})[_0xb038('0x16')](function(_0x3e01ce){if(_['isNil'](_0x3e01ce)){throw new Error(_0x24f810+_0xb038('0x6d'));}_0x2a41c8=_0x3e01ce;return _0x3e01ce['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x38a4d3={'uniqueid':_0x5b003a+'.'+_0x2a41c8['id']+'.'+_0x2a41c8['Interaction']['id'],'FromUserId':_0x2e6db4[_0xb038('0x30')]['id'],'type':'queue'};_0x38a4d3[_0x24f810+_0xb038('0x6e')]=_0x2a41c8['id'];_0x38a4d3[_0x24f810+_0xb038('0x6f')]=_0x2a41c8[_0xb038('0x6c')]['id'];_0x38a4d3[_0xb038('0x70')+_0x24f810+_0x1ea747+'Id']=_0x2a41c8[_0xb038('0x66')]['id'];_0x38a4d3['To'+_0x24f810+_0xb038('0x71')]=_0x240d06['id'];return db[_0x24f810+_0xb038('0x72')][_0xb038('0x73')](_0x38a4d3);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x5b003a,'interaction':_0x2a41c8[_0xb038('0x6c')],'message':_0x2a41c8,'account':_0x2a41c8[_0xb038('0x66')],'applications':[{'id':0x0,'priority':0x1,'app':_0xb038('0x74'),'appdata':_0x240d06[_0xb038('0xf')]+','+(_0x2a41c8['Account'][_0xb038('0x75')]||0x12c),'interval':_0xb038('0x76')}]},routingClient);})[_0xb038('0x16')](respondWithResult(_0x1d5640,null))[_0xb038('0xb')](handleError(_0x1d5640,null));};};exports[_0xb038('0x77')]=function(_0x139ffa,_0x208cdd){var _0x2ee9bd,_0x32ee35;if(_[_0xb038('0x11')](_0x139ffa['body']['channel'])){throw new Error(_0xb038('0x78'));}var _0xb7f025=_0x139ffa[_0xb038('0x22')][_0xb038('0x79')];var _0x3ee569=_[_0xb038('0x63')](_0xb7f025);var _0x3e129d=_0xb7f025==='chat'?_0xb038('0x65'):_0xb038('0x66');return db[_0xb038('0x7a')][_0xb038('0x68')]({'raw':!![],'where':{'id':_0x139ffa[_0xb038('0x1a')]['id'],'role':_0xb038('0x3a')}})['then'](function(_0x451fe5){if(_[_0xb038('0x11')](_0x451fe5)){throw new Error(_0xb038('0x7b'));}_0x2ee9bd=_0x451fe5;return db[_0x3ee569+_0xb038('0x6a')][_0xb038('0x68')]({'where':{'id':_0x139ffa[_0xb038('0x22')][_0xb038('0x6b')]},'include':[{'model':db[_0x3ee569+_0xb038('0x6c')],'as':_0xb038('0x6c')},{'model':db[_0x3ee569+_0x3e129d],'as':_0xb038('0x66')}]});})[_0xb038('0x16')](function(_0x22e0bd){if(_[_0xb038('0x11')](_0x22e0bd)){throw new Error(_0x3ee569+_0xb038('0x6d'));}_0x32ee35=_0x22e0bd;return _0x22e0bd[_0xb038('0x7c')]({'read':0x0,'readAt':null,'UserId':null});})[_0xb038('0x16')](function(){var _0x5448e3={'uniqueid':_0xb7f025+'.'+_0x32ee35['id']+'.'+_0x32ee35['Interaction']['id'],'FromUserId':_0x139ffa[_0xb038('0x30')]['id'],'type':_0xb038('0x74'),'ToUserId':_0x2ee9bd['id']};_0x5448e3[_0x3ee569+_0xb038('0x6e')]=_0x32ee35['id'];_0x5448e3[_0x3ee569+'InteractionId']=_0x32ee35[_0xb038('0x6c')]['id'];_0x5448e3[_0xb038('0x70')+_0x3ee569+_0x3e129d+'Id']=_0x32ee35[_0xb038('0x66')]['id'];return db[_0x3ee569+_0xb038('0x72')]['create'](_0x5448e3);})['then'](function(){return respondWithRpcPromise(_0xb038('0x7d'),{'channel':_0xb7f025,'interaction':_0x32ee35[_0xb038('0x6c')],'message':_0x32ee35,'account':_0x32ee35['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xb038('0x3a'),'appdata':_0x2ee9bd[_0xb038('0xf')]+','+(_0x32ee35[_0xb038('0x66')][_0xb038('0x7e')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xb038('0x16')](respondWithResult(_0x208cdd,null))[_0xb038('0xb')](handleError(_0x208cdd,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index e276314..e5658b0 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 _0xa885=['create','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show','run','post'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xa885,0xed));var _0x5a88=function(_0x2cbb6c,_0x4ea39c){_0x2cbb6c=_0x2cbb6c-0x0;var _0x11c22f=_0xa885[_0x2cbb6c];return _0x11c22f;};'use strict';var multer=require(_0x5a88('0x0'));var util=require(_0x5a88('0x1'));var path=require(_0x5a88('0x2'));var timeout=require(_0x5a88('0x3'));var express=require('express');var router=express[_0x5a88('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5a88('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5a88('0x6'));var controller=require(_0x5a88('0x7'));router[_0x5a88('0x8')]('/',auth[_0x5a88('0x9')](),controller[_0x5a88('0xa')]);router[_0x5a88('0x8')](_0x5a88('0xb'),auth['isAuthenticated'](),controller[_0x5a88('0xc')]);router[_0x5a88('0x8')]('/:id/run',auth['isAuthenticated'](),controller[_0x5a88('0xd')]);router[_0x5a88('0xe')]('/',auth[_0x5a88('0x9')](),controller[_0x5a88('0xf')]);router['put']('/:id',auth[_0x5a88('0x9')](),controller['update']);router['delete'](_0x5a88('0xb'),auth[_0x5a88('0x9')](),controller[_0x5a88('0x10')]);module[_0x5a88('0x11')]=router; \ No newline at end of file +var _0x833e=['put','destroy','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./schedule.controller','get','index','/:id','isAuthenticated','run','post','create'];(function(_0x56d8e8,_0x3eb015){var _0x2ce702=function(_0x4df5c5){while(--_0x4df5c5){_0x56d8e8['push'](_0x56d8e8['shift']());}};_0x2ce702(++_0x3eb015);}(_0x833e,0x178));var _0xe833=function(_0x1af06d,_0x4aa8af){_0x1af06d=_0x1af06d-0x0;var _0x3117be=_0x833e[_0x1af06d];return _0x3117be;};'use strict';var multer=require(_0xe833('0x0'));var util=require('util');var path=require(_0xe833('0x1'));var timeout=require('connect-timeout');var express=require(_0xe833('0x2'));var router=express[_0xe833('0x3')]();var fs_extra=require(_0xe833('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe833('0x5'));var config=require(_0xe833('0x6'));var controller=require(_0xe833('0x7'));router[_0xe833('0x8')]('/',auth['isAuthenticated'](),controller[_0xe833('0x9')]);router[_0xe833('0x8')](_0xe833('0xa'),auth[_0xe833('0xb')](),controller['show']);router[_0xe833('0x8')]('/:id/run',auth['isAuthenticated'](),controller[_0xe833('0xc')]);router[_0xe833('0xd')]('/',auth[_0xe833('0xb')](),controller[_0xe833('0xe')]);router[_0xe833('0xf')](_0xe833('0xa'),auth[_0xe833('0xb')](),controller['update']);router['delete'](_0xe833('0xa'),auth[_0xe833('0xb')](),controller[_0xe833('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 51923ca..616419e 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 _0x0479=['BOOLEAN','DATE','ENUM','years','quarters','months','weeks','days','minutes','csv','pdf','xlsx','custom','default','TEXT','sequelize','exports','STRING'];(function(_0x3d94bc,_0x27ebe1){var _0x27b66b=function(_0x5d490c){while(--_0x5d490c){_0x3d94bc['push'](_0x3d94bc['shift']());}};_0x27b66b(++_0x27ebe1);}(_0x0479,0xf9));var _0x9047=function(_0x5c97e1,_0x4b08ab){_0x5c97e1=_0x5c97e1-0x0;var _0x51aac8=_0x0479[_0x5c97e1];return _0x51aac8;};'use strict';var Sequelize=require(_0x9047('0x0'));module[_0x9047('0x1')]={'name':{'type':Sequelize[_0x9047('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x9047('0x2')]},'active':{'type':Sequelize[_0x9047('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x9047('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x9047('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x9047('0x5')](_0x9047('0x6'),_0x9047('0x7'),_0x9047('0x8'),_0x9047('0x9'),_0x9047('0xa'),'hours',_0x9047('0xb')),'allowNull':![],'defaultValue':_0x9047('0xa')},'output':{'type':Sequelize[_0x9047('0x5')](_0x9047('0xc'),_0x9047('0xd'),_0x9047('0xe')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM'](_0x9047('0xf'),_0x9047('0x10')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x9047('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x9047('0x2')]},'cc':{'type':Sequelize[_0x9047('0x11')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x9047('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x88df=['hours','minutes','csv','xlsx','custom','default','TEXT','sequelize','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','quarters','months','weeks','days'];(function(_0x4dce1f,_0x201548){var _0x45673a=function(_0x537a43){while(--_0x537a43){_0x4dce1f['push'](_0x4dce1f['shift']());}};_0x45673a(++_0x201548);}(_0x88df,0x6d));var _0xf88d=function(_0x4c831c,_0x53fd9c){_0x4c831c=_0x4c831c-0x0;var _0x44b349=_0x88df[_0x4c831c];return _0x44b349;};'use strict';var Sequelize=require(_0xf88d('0x0'));module['exports']={'name':{'type':Sequelize[_0xf88d('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xf88d('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf88d('0x2')},'startAt':{'type':Sequelize[_0xf88d('0x3')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xf88d('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xf88d('0x5')]('years',_0xf88d('0x6'),_0xf88d('0x7'),_0xf88d('0x8'),_0xf88d('0x9'),_0xf88d('0xa'),_0xf88d('0xb')),'allowNull':![],'defaultValue':_0xf88d('0x9')},'output':{'type':Sequelize[_0xf88d('0x5')](_0xf88d('0xc'),'pdf',_0xf88d('0xd')),'allowNull':![],'defaultValue':_0xf88d('0xc')},'type':{'type':Sequelize[_0xf88d('0x5')](_0xf88d('0xe'),_0xf88d('0xf')),'allowNull':![],'defaultValue':_0xf88d('0xe')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xf88d('0x1')]},'cc':{'type':Sequelize[_0xf88d('0x10')]},'bcc':{'type':Sequelize[_0xf88d('0x10')]},'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 da0cdc6..851fdcb 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 _0x6644=['Content-Range','apply','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','send','map','Schedule','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','run','../../config/schedule','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../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'];(function(_0x14b85f,_0x2bcd87){var _0xafd45=function(_0x54f7ed){while(--_0x54f7ed){_0x14b85f['push'](_0x14b85f['shift']());}};_0xafd45(++_0x2bcd87);}(_0x6644,0xde));var _0x4664=function(_0x28e94e,_0x62c50c){_0x28e94e=_0x28e94e-0x0;var _0x11ba23=_0x6644[_0x28e94e];return _0x11ba23;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4664('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4664('0x1'));var moment=require(_0x4664('0x2'));var BPromise=require(_0x4664('0x3'));var Mustache=require(_0x4664('0x4'));var util=require(_0x4664('0x5'));var path=require('path');var sox=require(_0x4664('0x6'));var csv=require('to-csv');var ejs=require(_0x4664('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4664('0x8'));var squel=require('squel');var crypto=require(_0x4664('0x9'));var jsforce=require(_0x4664('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x4664('0xb'));var querystring=require(_0x4664('0xc'));var Papa=require(_0x4664('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4664('0xe'));var as=require(_0x4664('0xf'));var hardwareService=require(_0x4664('0x10'));var logger=require(_0x4664('0x11'))(_0x4664('0x12'));var utils=require(_0x4664('0x13'));var config=require(_0x4664('0x14'));var licenseUtil=require(_0x4664('0x15'));var db=require(_0x4664('0x16'))['db'];function respondWithStatusCode(_0x2e083d,_0x3f8449){_0x3f8449=_0x3f8449||0xcc;return function(_0x1a316d){if(_0x1a316d){return _0x2e083d[_0x4664('0x17')](_0x3f8449);}return _0x2e083d['status'](_0x3f8449)['end']();};}function respondWithResult(_0x5b966a,_0x508d95){_0x508d95=_0x508d95||0xc8;return function(_0x226810){if(_0x226810){return _0x5b966a[_0x4664('0x18')](_0x508d95)[_0x4664('0x19')](_0x226810);}};}function respondWithFilteredResult(_0x114a2a,_0x5d8595){return function(_0x24ef61){if(_0x24ef61){var _0xc4dc61=typeof _0x5d8595[_0x4664('0x1a')]===_0x4664('0x1b')&&typeof _0x5d8595[_0x4664('0x1c')]===_0x4664('0x1b');var _0x2388c6=_0x24ef61[_0x4664('0x1d')];var _0x4fdd6b=_0xc4dc61?0x0:_0x5d8595[_0x4664('0x1a')];var _0x44e851=_0xc4dc61?_0x24ef61['count']:_0x5d8595[_0x4664('0x1a')]+_0x5d8595[_0x4664('0x1c')];var _0xf1ea19;if(_0x44e851>=_0x2388c6){_0x44e851=_0x2388c6;_0xf1ea19=0xc8;}else{_0xf1ea19=0xce;}_0x114a2a[_0x4664('0x18')](_0xf1ea19);return _0x114a2a['set'](_0x4664('0x1e'),_0x4fdd6b+'-'+_0x44e851+'/'+_0x2388c6)[_0x4664('0x19')](_0x24ef61);}return null;};}function patchUpdates(_0x206706){return function(_0xbaf96b){try{jsonpatch[_0x4664('0x1f')](_0xbaf96b,_0x206706,!![]);}catch(_0x37c08c){return BPromise[_0x4664('0x20')](_0x37c08c);}return _0xbaf96b[_0x4664('0x21')]();};}function saveUpdates(_0x5129b4,_0xd69d74){return function(_0x1ab0ad){if(_0x1ab0ad){return _0x1ab0ad[_0x4664('0x22')](_0x5129b4)[_0x4664('0x23')](function(_0x4c4757){return _0x4c4757;});}return null;};}function removeEntity(_0x464c73,_0x69d863){return function(_0x1b1de2){if(_0x1b1de2){return _0x1b1de2[_0x4664('0x24')]()[_0x4664('0x23')](function(){var _0x30df71=_0x1b1de2[_0x4664('0x25')]({'plain':!![]});var _0x218cc8=_0x4664('0x26');return db[_0x4664('0x27')][_0x4664('0x24')]({'where':{'type':_0x218cc8,'resourceId':_0x30df71['id']}})[_0x4664('0x23')](function(){return _0x1b1de2;});})[_0x4664('0x23')](function(){_0x464c73[_0x4664('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7eb3f8,_0x571b63){return function(_0x26d4cc){if(!_0x26d4cc){_0x7eb3f8[_0x4664('0x17')](0x194);}return _0x26d4cc;};}function handleError(_0x30b5ba,_0x5ece44){_0x5ece44=_0x5ece44||0x1f4;return function(_0x3c93c9){logger[_0x4664('0x28')](_0x3c93c9[_0x4664('0x29')]);if(_0x3c93c9[_0x4664('0x2a')]){delete _0x3c93c9[_0x4664('0x2a')];}_0x30b5ba['status'](_0x5ece44)[_0x4664('0x2b')](_0x3c93c9);};}exports['index']=function(_0x582c25,_0x525a86){var _0x27ec8d={},_0x5e9c43={},_0x25a607={'count':0x0,'rows':[]};var _0x152ed1=_[_0x4664('0x2c')](db[_0x4664('0x2d')]['rawAttributes'],function(_0x4c3e74){return{'name':_0x4c3e74[_0x4664('0x2e')],'type':_0x4c3e74[_0x4664('0x2f')]['key']};});_0x5e9c43['model']=_[_0x4664('0x2c')](_0x152ed1,'name');_0x5e9c43[_0x4664('0x30')]=_[_0x4664('0x31')](_0x582c25[_0x4664('0x30')]);_0x5e9c43[_0x4664('0x32')]=_[_0x4664('0x33')](_0x5e9c43[_0x4664('0x34')],_0x5e9c43['query']);_0x27ec8d[_0x4664('0x35')]=_['intersection'](_0x5e9c43['model'],qs[_0x4664('0x36')](_0x582c25[_0x4664('0x30')][_0x4664('0x36')]));_0x27ec8d['attributes']=_0x27ec8d[_0x4664('0x35')][_0x4664('0x37')]?_0x27ec8d[_0x4664('0x35')]:_0x5e9c43[_0x4664('0x34')];if(!_0x582c25[_0x4664('0x30')][_0x4664('0x38')](_0x4664('0x39'))){_0x27ec8d['limit']=qs['limit'](_0x582c25[_0x4664('0x30')]['limit']);_0x27ec8d[_0x4664('0x1a')]=qs['offset'](_0x582c25['query']['offset']);}_0x27ec8d[_0x4664('0x3a')]=qs['sort'](_0x582c25[_0x4664('0x30')][_0x4664('0x3b')]);_0x27ec8d[_0x4664('0x3c')]=qs[_0x4664('0x32')](_[_0x4664('0x3d')](_0x582c25['query'],_0x5e9c43[_0x4664('0x32')]),_0x152ed1);if(_0x582c25[_0x4664('0x30')][_0x4664('0x3e')]){_0x27ec8d[_0x4664('0x3c')]=_['merge'](_0x27ec8d[_0x4664('0x3c')],{'$or':_['map'](_0x152ed1,function(_0x12a693){if(_0x12a693['type']!==_0x4664('0x3f')){var _0x228f4a={};_0x228f4a[_0x12a693[_0x4664('0x2a')]]={'$like':'%'+_0x582c25[_0x4664('0x30')][_0x4664('0x3e')]+'%'};return _0x228f4a;}})});}_0x27ec8d=_[_0x4664('0x40')]({},_0x27ec8d,_0x582c25[_0x4664('0x41')]);var _0x18f5ba={'where':_0x27ec8d[_0x4664('0x3c')]};return db[_0x4664('0x2d')][_0x4664('0x1d')](_0x18f5ba)['then'](function(_0x36c408){_0x25a607[_0x4664('0x1d')]=_0x36c408;if(_0x582c25[_0x4664('0x30')]['includeAll']){_0x27ec8d[_0x4664('0x42')]=[{'all':!![]}];}return db[_0x4664('0x2d')][_0x4664('0x43')](_0x27ec8d);})['then'](function(_0x521ac4){_0x25a607[_0x4664('0x44')]=_0x521ac4;return _0x25a607;})['then'](respondWithFilteredResult(_0x525a86,_0x27ec8d))[_0x4664('0x45')](handleError(_0x525a86,null));};exports[_0x4664('0x46')]=function(_0x17be28,_0x1eee93){var _0x26f197={'raw':![],'where':{'id':_0x17be28[_0x4664('0x47')]['id']}},_0xef3694={};_0xef3694[_0x4664('0x34')]=_['keys'](db[_0x4664('0x2d')][_0x4664('0x48')]);_0xef3694[_0x4664('0x30')]=_[_0x4664('0x31')](_0x17be28[_0x4664('0x30')]);_0xef3694['filters']=_[_0x4664('0x33')](_0xef3694[_0x4664('0x34')],_0xef3694['query']);_0x26f197[_0x4664('0x35')]=_[_0x4664('0x33')](_0xef3694['model'],qs[_0x4664('0x36')](_0x17be28[_0x4664('0x30')][_0x4664('0x36')]));_0x26f197[_0x4664('0x35')]=_0x26f197['attributes'][_0x4664('0x37')]?_0x26f197[_0x4664('0x35')]:_0xef3694[_0x4664('0x34')];if(_0x17be28[_0x4664('0x30')][_0x4664('0x49')]){_0x26f197[_0x4664('0x42')]=[{'all':!![]}];}_0x26f197=_[_0x4664('0x40')]({},_0x26f197,_0x17be28[_0x4664('0x41')]);return db[_0x4664('0x2d')][_0x4664('0x4a')](_0x26f197)['then'](handleEntityNotFound(_0x1eee93,null))[_0x4664('0x23')](respondWithResult(_0x1eee93,null))['catch'](handleError(_0x1eee93,null));};exports[_0x4664('0x4b')]=function(_0x132d2c,_0x2f5ca3){return db[_0x4664('0x2d')][_0x4664('0x4b')](_0x132d2c[_0x4664('0x4c')],{})['then'](function(_0x1aae0b){var _0x5c0754=_0x132d2c['user'][_0x4664('0x25')]({'plain':!![]});if(!_0x5c0754)throw new Error(_0x4664('0x4d'));if(_0x5c0754['role']===_0x4664('0x4e')){var _0x404ae1=_0x1aae0b[_0x4664('0x25')]({'plain':!![]});var _0x35d009='Scheduler';return db[_0x4664('0x4f')][_0x4664('0x4a')]({'where':{'name':_0x35d009,'userProfileId':_0x5c0754[_0x4664('0x50')]},'raw':!![]})['then'](function(_0x369d50){if(_0x369d50&&_0x369d50[_0x4664('0x51')]===0x0){return db[_0x4664('0x27')][_0x4664('0x4b')]({'name':_0x404ae1['name'],'resourceId':_0x404ae1['id'],'type':_0x369d50[_0x4664('0x2a')],'sectionId':_0x369d50['id']},{})[_0x4664('0x23')](function(){return _0x1aae0b;});}else{return _0x1aae0b;}})[_0x4664('0x45')](function(_0x3a356a){logger[_0x4664('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a356a);throw _0x3a356a;});}return _0x1aae0b;})[_0x4664('0x23')](respondWithResult(_0x2f5ca3,0xc9))[_0x4664('0x45')](handleError(_0x2f5ca3,null));};exports[_0x4664('0x22')]=function(_0x4d3215,_0x5a11ab){if(_0x4d3215[_0x4664('0x4c')]['id']){delete _0x4d3215['body']['id'];}return db[_0x4664('0x2d')][_0x4664('0x4a')]({'where':{'id':_0x4d3215[_0x4664('0x47')]['id']}})[_0x4664('0x23')](handleEntityNotFound(_0x5a11ab,null))['then'](saveUpdates(_0x4d3215[_0x4664('0x4c')],null))['then'](respondWithResult(_0x5a11ab,null))[_0x4664('0x45')](handleError(_0x5a11ab,null));};exports[_0x4664('0x24')]=function(_0x1fe4a7,_0x28a904){return db['Schedule'][_0x4664('0x4a')]({'where':{'id':_0x1fe4a7[_0x4664('0x47')]['id']}})[_0x4664('0x23')](handleEntityNotFound(_0x28a904,null))[_0x4664('0x23')](removeEntity(_0x28a904,null))[_0x4664('0x45')](handleError(_0x28a904,null));};exports[_0x4664('0x52')]=function(_0x33f738,_0x1e3b38,_0xf20391){var _0x46bd3d=require(_0x4664('0x53'));return db[_0x4664('0x2d')][_0x4664('0x4a')]({'where':{'id':_0x33f738[_0x4664('0x47')]['id']},'raw':!![]})[_0x4664('0x23')](handleEntityNotFound(_0x1e3b38,null))[_0x4664('0x23')](function(){_0x46bd3d[_0x4664('0x52')](_0x33f738[_0x4664('0x47')]['id']);})[_0x4664('0x23')](respondWithStatusCode(_0x1e3b38,null))['catch'](handleError(_0x1e3b38,null));}; \ No newline at end of file +var _0x5d29=['eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','Schedule','includeAll','include','findAll','rows','catch','show','params','fields','length','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','../../config/schedule'];(function(_0x2741a6,_0x422c87){var _0x51b0e8=function(_0xc10778){while(--_0xc10778){_0x2741a6['push'](_0x2741a6['shift']());}};_0x51b0e8(++_0x422c87);}(_0x5d29,0x1b8));var _0x95d2=function(_0x3c46ca,_0x10d2e9){_0x3c46ca=_0x3c46ca-0x0;var _0x3e3ee3=_0x5d29[_0x3c46ca];return _0x3e3ee3;};'use strict';var emlformat=require(_0x95d2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x95d2('0x1'));var rp=require(_0x95d2('0x2'));var moment=require(_0x95d2('0x3'));var BPromise=require(_0x95d2('0x4'));var Mustache=require(_0x95d2('0x5'));var util=require(_0x95d2('0x6'));var path=require(_0x95d2('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x95d2('0x8'));var fs=require('fs');var fs_extra=require(_0x95d2('0x9'));var _=require(_0x95d2('0xa'));var squel=require('squel');var crypto=require(_0x95d2('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x95d2('0xc'));var toCsv=require(_0x95d2('0xd'));var querystring=require(_0x95d2('0xe'));var Papa=require(_0x95d2('0xf'));var Redis=require(_0x95d2('0x10'));var authService=require(_0x95d2('0x11'));var qs=require(_0x95d2('0x12'));var as=require(_0x95d2('0x13'));var hardwareService=require(_0x95d2('0x14'));var logger=require(_0x95d2('0x15'))(_0x95d2('0x16'));var utils=require(_0x95d2('0x17'));var config=require(_0x95d2('0x18'));var licenseUtil=require(_0x95d2('0x19'));var db=require(_0x95d2('0x1a'))['db'];function respondWithStatusCode(_0x6a401c,_0x3f817f){_0x3f817f=_0x3f817f||0xcc;return function(_0x272f30){if(_0x272f30){return _0x6a401c[_0x95d2('0x1b')](_0x3f817f);}return _0x6a401c[_0x95d2('0x1c')](_0x3f817f)[_0x95d2('0x1d')]();};}function respondWithResult(_0x31a928,_0x473f88){_0x473f88=_0x473f88||0xc8;return function(_0x1adc9e){if(_0x1adc9e){return _0x31a928[_0x95d2('0x1c')](_0x473f88)[_0x95d2('0x1e')](_0x1adc9e);}};}function respondWithFilteredResult(_0x2e50df,_0x3aac7e){return function(_0x375299){if(_0x375299){var _0x10dfc5=typeof _0x3aac7e[_0x95d2('0x1f')]===_0x95d2('0x20')&&typeof _0x3aac7e['limit']==='undefined';var _0x20c028=_0x375299['count'];var _0x4e0cc1=_0x10dfc5?0x0:_0x3aac7e[_0x95d2('0x1f')];var _0x48514a=_0x10dfc5?_0x375299[_0x95d2('0x21')]:_0x3aac7e[_0x95d2('0x1f')]+_0x3aac7e[_0x95d2('0x22')];var _0x5cc78c;if(_0x48514a>=_0x20c028){_0x48514a=_0x20c028;_0x5cc78c=0xc8;}else{_0x5cc78c=0xce;}_0x2e50df[_0x95d2('0x1c')](_0x5cc78c);return _0x2e50df[_0x95d2('0x23')](_0x95d2('0x24'),_0x4e0cc1+'-'+_0x48514a+'/'+_0x20c028)['json'](_0x375299);}return null;};}function patchUpdates(_0xfa4fce){return function(_0x320323){try{jsonpatch[_0x95d2('0x25')](_0x320323,_0xfa4fce,!![]);}catch(_0x128470){return BPromise[_0x95d2('0x26')](_0x128470);}return _0x320323['save']();};}function saveUpdates(_0x31cf5b,_0x2f1ae2){return function(_0x3f659b){if(_0x3f659b){return _0x3f659b[_0x95d2('0x27')](_0x31cf5b)[_0x95d2('0x28')](function(_0x547bd5){return _0x547bd5;});}return null;};}function removeEntity(_0x5d4bb4,_0x131ba4){return function(_0x589398){if(_0x589398){return _0x589398[_0x95d2('0x29')]()[_0x95d2('0x28')](function(){var _0x483737=_0x589398['get']({'plain':!![]});var _0x5f3251='Scheduler';return db[_0x95d2('0x2a')][_0x95d2('0x29')]({'where':{'type':_0x5f3251,'resourceId':_0x483737['id']}})[_0x95d2('0x28')](function(){return _0x589398;});})[_0x95d2('0x28')](function(){_0x5d4bb4[_0x95d2('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50b2b4,_0x33cd3e){return function(_0x4fa211){if(!_0x4fa211){_0x50b2b4[_0x95d2('0x1b')](0x194);}return _0x4fa211;};}function handleError(_0x4f2475,_0x4ca65f){_0x4ca65f=_0x4ca65f||0x1f4;return function(_0x13fc81){logger[_0x95d2('0x2b')](_0x13fc81[_0x95d2('0x2c')]);if(_0x13fc81['name']){delete _0x13fc81[_0x95d2('0x2d')];}_0x4f2475[_0x95d2('0x1c')](_0x4ca65f)[_0x95d2('0x2e')](_0x13fc81);};}exports[_0x95d2('0x2f')]=function(_0xd3c33a,_0x14e6ce){var _0x33f6aa={},_0x331a0c={},_0x5a6cd1={'count':0x0,'rows':[]};var _0x1900af=_[_0x95d2('0x30')](db['Schedule'][_0x95d2('0x31')],function(_0x15462e){return{'name':_0x15462e[_0x95d2('0x32')],'type':_0x15462e[_0x95d2('0x33')]['key']};});_0x331a0c['model']=_[_0x95d2('0x30')](_0x1900af,_0x95d2('0x2d'));_0x331a0c[_0x95d2('0x34')]=_[_0x95d2('0x35')](_0xd3c33a[_0x95d2('0x34')]);_0x331a0c[_0x95d2('0x36')]=_[_0x95d2('0x37')](_0x331a0c[_0x95d2('0x38')],_0x331a0c[_0x95d2('0x34')]);_0x33f6aa[_0x95d2('0x39')]=_[_0x95d2('0x37')](_0x331a0c[_0x95d2('0x38')],qs['fields'](_0xd3c33a[_0x95d2('0x34')]['fields']));_0x33f6aa[_0x95d2('0x39')]=_0x33f6aa[_0x95d2('0x39')]['length']?_0x33f6aa['attributes']:_0x331a0c['model'];if(!_0xd3c33a[_0x95d2('0x34')][_0x95d2('0x3a')](_0x95d2('0x3b'))){_0x33f6aa[_0x95d2('0x22')]=qs[_0x95d2('0x22')](_0xd3c33a[_0x95d2('0x34')][_0x95d2('0x22')]);_0x33f6aa['offset']=qs[_0x95d2('0x1f')](_0xd3c33a[_0x95d2('0x34')][_0x95d2('0x1f')]);}_0x33f6aa[_0x95d2('0x3c')]=qs['sort'](_0xd3c33a[_0x95d2('0x34')][_0x95d2('0x3d')]);_0x33f6aa['where']=qs[_0x95d2('0x36')](_['pick'](_0xd3c33a['query'],_0x331a0c[_0x95d2('0x36')]),_0x1900af);if(_0xd3c33a[_0x95d2('0x34')][_0x95d2('0x3e')]){_0x33f6aa[_0x95d2('0x3f')]=_[_0x95d2('0x40')](_0x33f6aa['where'],{'$or':_[_0x95d2('0x30')](_0x1900af,function(_0x2bc5b3){if(_0x2bc5b3['type']!==_0x95d2('0x41')){var _0x54094c={};_0x54094c[_0x2bc5b3[_0x95d2('0x2d')]]={'$like':'%'+_0xd3c33a[_0x95d2('0x34')][_0x95d2('0x3e')]+'%'};return _0x54094c;}})});}_0x33f6aa=_[_0x95d2('0x40')]({},_0x33f6aa,_0xd3c33a['options']);var _0x2034a8={'where':_0x33f6aa[_0x95d2('0x3f')]};return db[_0x95d2('0x42')]['count'](_0x2034a8)['then'](function(_0x469656){_0x5a6cd1[_0x95d2('0x21')]=_0x469656;if(_0xd3c33a[_0x95d2('0x34')][_0x95d2('0x43')]){_0x33f6aa[_0x95d2('0x44')]=[{'all':!![]}];}return db[_0x95d2('0x42')][_0x95d2('0x45')](_0x33f6aa);})[_0x95d2('0x28')](function(_0x173913){_0x5a6cd1[_0x95d2('0x46')]=_0x173913;return _0x5a6cd1;})['then'](respondWithFilteredResult(_0x14e6ce,_0x33f6aa))[_0x95d2('0x47')](handleError(_0x14e6ce,null));};exports[_0x95d2('0x48')]=function(_0x396a18,_0x4e2be5){var _0x3f6d9d={'raw':![],'where':{'id':_0x396a18[_0x95d2('0x49')]['id']}},_0x127b48={};_0x127b48[_0x95d2('0x38')]=_[_0x95d2('0x35')](db[_0x95d2('0x42')][_0x95d2('0x31')]);_0x127b48[_0x95d2('0x34')]=_[_0x95d2('0x35')](_0x396a18['query']);_0x127b48['filters']=_[_0x95d2('0x37')](_0x127b48[_0x95d2('0x38')],_0x127b48[_0x95d2('0x34')]);_0x3f6d9d[_0x95d2('0x39')]=_[_0x95d2('0x37')](_0x127b48[_0x95d2('0x38')],qs[_0x95d2('0x4a')](_0x396a18[_0x95d2('0x34')][_0x95d2('0x4a')]));_0x3f6d9d[_0x95d2('0x39')]=_0x3f6d9d[_0x95d2('0x39')][_0x95d2('0x4b')]?_0x3f6d9d[_0x95d2('0x39')]:_0x127b48[_0x95d2('0x38')];if(_0x396a18[_0x95d2('0x34')][_0x95d2('0x43')]){_0x3f6d9d[_0x95d2('0x44')]=[{'all':!![]}];}_0x3f6d9d=_['merge']({},_0x3f6d9d,_0x396a18[_0x95d2('0x4c')]);return db[_0x95d2('0x42')][_0x95d2('0x4d')](_0x3f6d9d)[_0x95d2('0x28')](handleEntityNotFound(_0x4e2be5,null))['then'](respondWithResult(_0x4e2be5,null))[_0x95d2('0x47')](handleError(_0x4e2be5,null));};exports[_0x95d2('0x4e')]=function(_0x7aa17e,_0x464cd7){return db[_0x95d2('0x42')]['create'](_0x7aa17e['body'],{})[_0x95d2('0x28')](function(_0x463170){var _0x25b6ef=_0x7aa17e[_0x95d2('0x4f')]['get']({'plain':!![]});if(!_0x25b6ef)throw new Error(_0x95d2('0x50'));if(_0x25b6ef['role']==='user'){var _0x48011d=_0x463170[_0x95d2('0x51')]({'plain':!![]});var _0x5dcda7='Scheduler';return db[_0x95d2('0x52')][_0x95d2('0x4d')]({'where':{'name':_0x5dcda7,'userProfileId':_0x25b6ef[_0x95d2('0x53')]},'raw':!![]})[_0x95d2('0x28')](function(_0x2991e6){if(_0x2991e6&&_0x2991e6['autoAssociation']===0x0){return db[_0x95d2('0x2a')]['create']({'name':_0x48011d[_0x95d2('0x2d')],'resourceId':_0x48011d['id'],'type':_0x2991e6['name'],'sectionId':_0x2991e6['id']},{})[_0x95d2('0x28')](function(){return _0x463170;});}else{return _0x463170;}})[_0x95d2('0x47')](function(_0xaa1927){logger['error'](_0x95d2('0x54'),_0xaa1927);throw _0xaa1927;});}return _0x463170;})[_0x95d2('0x28')](respondWithResult(_0x464cd7,0xc9))[_0x95d2('0x47')](handleError(_0x464cd7,null));};exports[_0x95d2('0x27')]=function(_0x29c78b,_0x40d45c){if(_0x29c78b[_0x95d2('0x55')]['id']){delete _0x29c78b[_0x95d2('0x55')]['id'];}return db[_0x95d2('0x42')]['find']({'where':{'id':_0x29c78b[_0x95d2('0x49')]['id']}})['then'](handleEntityNotFound(_0x40d45c,null))['then'](saveUpdates(_0x29c78b[_0x95d2('0x55')],null))['then'](respondWithResult(_0x40d45c,null))[_0x95d2('0x47')](handleError(_0x40d45c,null));};exports[_0x95d2('0x29')]=function(_0x15d048,_0x1e44a1){return db['Schedule'][_0x95d2('0x4d')]({'where':{'id':_0x15d048['params']['id']}})['then'](handleEntityNotFound(_0x1e44a1,null))[_0x95d2('0x28')](removeEntity(_0x1e44a1,null))[_0x95d2('0x47')](handleError(_0x1e44a1,null));};exports[_0x95d2('0x56')]=function(_0x38ad54,_0x539565,_0x2330c3){var _0x2c2ae7=require(_0x95d2('0x57'));return db[_0x95d2('0x42')][_0x95d2('0x4d')]({'where':{'id':_0x38ad54['params']['id']},'raw':!![]})[_0x95d2('0x28')](handleEntityNotFound(_0x539565,null))[_0x95d2('0x28')](function(){_0x2c2ae7[_0x95d2('0x56')](_0x38ad54['params']['id']);})['then'](respondWithStatusCode(_0x539565,null))['catch'](handleError(_0x539565,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 0bb4d6b..6d4a121 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 _0x0e4f=['path','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x572e09,_0x34fc03){var _0x4c3cb9=function(_0x506d93){while(--_0x506d93){_0x572e09['push'](_0x572e09['shift']());}};_0x4c3cb9(++_0x34fc03);}(_0x0e4f,0x173));var _0xf0e4=function(_0x318668,_0x4a5fa9){_0x318668=_0x318668-0x0;var _0x6c7c46=_0x0e4f[_0x318668];return _0x6c7c46;};'use strict';var _=require('lodash');var util=require(_0xf0e4('0x0'));var logger=require(_0xf0e4('0x1'))(_0xf0e4('0x2'));var moment=require(_0xf0e4('0x3'));var BPromise=require(_0xf0e4('0x4'));var rp=require(_0xf0e4('0x5'));var fs=require('fs');var path=require(_0xf0e4('0x6'));var rimraf=require('rimraf');var config=require(_0xf0e4('0x7'));var attributes=require(_0xf0e4('0x8'));module[_0xf0e4('0x9')]=function(_0x538ced,_0x31bfaf){return _0x538ced[_0xf0e4('0xa')](_0xf0e4('0xb'),attributes,{'tableName':_0xf0e4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd9e7=['request-promise','path','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','../../config/logger','api','bluebird'];(function(_0x97c6ea,_0x4cffce){var _0x2d7f50=function(_0x54010e){while(--_0x54010e){_0x97c6ea['push'](_0x97c6ea['shift']());}};_0x2d7f50(++_0x4cffce);}(_0xd9e7,0xa1));var _0x7d9e=function(_0x5466ab,_0x227b13){_0x5466ab=_0x5466ab-0x0;var _0x40751a=_0xd9e7[_0x5466ab];return _0x40751a;};'use strict';var _=require(_0x7d9e('0x0'));var util=require('util');var logger=require(_0x7d9e('0x1'))(_0x7d9e('0x2'));var moment=require('moment');var BPromise=require(_0x7d9e('0x3'));var rp=require(_0x7d9e('0x4'));var fs=require('fs');var path=require(_0x7d9e('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7d9e('0x6'));module[_0x7d9e('0x7')]=function(_0x531ff2,_0x113d0f){return _0x531ff2[_0x7d9e('0x8')](_0x7d9e('0x9'),attributes,{'tableName':_0x7d9e('0xa'),'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 5207324..5d22773 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 _0xff31=['request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0x1757c8,_0x4aa781){var _0x3059f1=function(_0xb9d7f){while(--_0xb9d7f){_0x1757c8['push'](_0x1757c8['shift']());}};_0x3059f1(++_0x4aa781);}(_0xff31,0x101));var _0x1ff3=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xff31[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require('lodash');var util=require(_0x1ff3('0x0'));var moment=require(_0x1ff3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1ff3('0x2'));var db=require(_0x1ff3('0x3'))['db'];var utils=require(_0x1ff3('0x4'));var logger=require(_0x1ff3('0x5'))('rpc');var config=require(_0x1ff3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1ff3('0x7')][_0x1ff3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x938623,_0x39e7ad,_0x33d8fd){return new BPromise(function(_0xed889e,_0x3ba09f){return client[_0x1ff3('0x9')](_0x938623,_0x33d8fd)[_0x1ff3('0xa')](function(_0x428169){logger[_0x1ff3('0xb')](_0x1ff3('0xc'),_0x39e7ad,_0x1ff3('0xd'));logger[_0x1ff3('0xe')](_0x1ff3('0xf'),_0x39e7ad,_0x1ff3('0xd'),JSON[_0x1ff3('0x10')](_0x428169));if(_0x428169['error']){if(_0x428169[_0x1ff3('0x11')]['code']===0x1f4){logger[_0x1ff3('0x11')]('Schedule,\x20%s,\x20%s',_0x39e7ad,_0x428169['error']['message']);return _0x3ba09f(_0x428169[_0x1ff3('0x11')][_0x1ff3('0x12')]);}logger[_0x1ff3('0x11')]('Schedule,\x20%s,\x20%s',_0x39e7ad,_0x428169[_0x1ff3('0x11')]['message']);return _0xed889e(_0x428169['error'][_0x1ff3('0x12')]);}else{logger['info'](_0x1ff3('0xc'),_0x39e7ad,_0x1ff3('0xd'));_0xed889e(_0x428169['result'][_0x1ff3('0x12')]);}})['catch'](function(_0x2bb637){logger[_0x1ff3('0x11')](_0x1ff3('0xc'),_0x39e7ad,_0x2bb637);_0x3ba09f(_0x2bb637);});});} \ No newline at end of file +var _0x4d25=['client','http','request','then','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x28ae5f,_0x47f293){var _0x1e269e=function(_0x518f5a){while(--_0x518f5a){_0x28ae5f['push'](_0x28ae5f['shift']());}};_0x1e269e(++_0x47f293);}(_0x4d25,0xbf));var _0x54d2=function(_0x252f4b,_0x98ef20){_0x252f4b=_0x252f4b-0x0;var _0x2c4920=_0x4d25[_0x252f4b];return _0x2c4920;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x54d2('0x0'));var BPromise=require(_0x54d2('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x54d2('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x54d2('0x3'));var logger=require(_0x54d2('0x4'))(_0x54d2('0x5'));var config=require(_0x54d2('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x54d2('0x7')][_0x54d2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x256d6d,_0x1476a4,_0x5a422e){return new BPromise(function(_0x56ecf8,_0x28a0da){return client[_0x54d2('0x9')](_0x256d6d,_0x5a422e)[_0x54d2('0xa')](function(_0x4dda1b){logger['info'](_0x54d2('0xb'),_0x1476a4,_0x54d2('0xc'));logger[_0x54d2('0xd')](_0x54d2('0xe'),_0x1476a4,'request\x20sent',JSON[_0x54d2('0xf')](_0x4dda1b));if(_0x4dda1b[_0x54d2('0x10')]){if(_0x4dda1b[_0x54d2('0x10')][_0x54d2('0x11')]===0x1f4){logger[_0x54d2('0x10')]('Schedule,\x20%s,\x20%s',_0x1476a4,_0x4dda1b[_0x54d2('0x10')]['message']);return _0x28a0da(_0x4dda1b[_0x54d2('0x10')][_0x54d2('0x12')]);}logger[_0x54d2('0x10')](_0x54d2('0xb'),_0x1476a4,_0x4dda1b[_0x54d2('0x10')][_0x54d2('0x12')]);return _0x56ecf8(_0x4dda1b[_0x54d2('0x10')][_0x54d2('0x12')]);}else{logger[_0x54d2('0x13')](_0x54d2('0xb'),_0x1476a4,_0x54d2('0xc'));_0x56ecf8(_0x4dda1b[_0x54d2('0x14')][_0x54d2('0x12')]);}})[_0x54d2('0x15')](function(_0x464b0c){logger[_0x54d2('0x10')](_0x54d2('0xb'),_0x1476a4,_0x464b0c);_0x28a0da(_0x464b0c);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index c771b76..ee7ab84 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 _0xaf30=['get','/describe','describe','/:id','show','/:id/download','download','post','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','isAuthenticated','index'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xaf30,0x1ab));var _0x0af3=function(_0x474c66,_0xbce925){_0x474c66=_0x474c66-0x0;var _0xcbd9bf=_0xaf30[_0x474c66];return _0xcbd9bf;};'use strict';var multer=require('multer');var util=require(_0x0af3('0x0'));var path=require('path');var timeout=require(_0x0af3('0x1'));var express=require(_0x0af3('0x2'));var router=express[_0x0af3('0x3')]();var fs_extra=require(_0x0af3('0x4'));var auth=require(_0x0af3('0x5'));var interaction=require(_0x0af3('0x6'));var config=require('../../config/environment');var controller=require(_0x0af3('0x7'));router['get']('/',auth[_0x0af3('0x8')](),controller[_0x0af3('0x9')]);router[_0x0af3('0xa')](_0x0af3('0xb'),auth[_0x0af3('0x8')](),controller[_0x0af3('0xc')]);router[_0x0af3('0xa')](_0x0af3('0xd'),auth[_0x0af3('0x8')](),controller[_0x0af3('0xe')]);router[_0x0af3('0xa')](_0x0af3('0xf'),auth[_0x0af3('0x8')](),controller[_0x0af3('0x10')]);router[_0x0af3('0x11')]('/',auth[_0x0af3('0x8')](),controller['create']);router[_0x0af3('0x12')](_0x0af3('0xd'),auth['isAuthenticated'](),controller[_0x0af3('0x13')]);router[_0x0af3('0x14')](_0x0af3('0xd'),auth[_0x0af3('0x8')](),controller[_0x0af3('0x15')]);module[_0x0af3('0x16')]=router; \ No newline at end of file +var _0x86f0=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','index','/describe','isAuthenticated','describe','/:id/download','delete','exports'];(function(_0x4563c1,_0x348ecb){var _0x45015f=function(_0x291510){while(--_0x291510){_0x4563c1['push'](_0x4563c1['shift']());}};_0x45015f(++_0x348ecb);}(_0x86f0,0x121));var _0x086f=function(_0x2822a0,_0x36626f){_0x2822a0=_0x2822a0-0x0;var _0x1648d5=_0x86f0[_0x2822a0];return _0x1648d5;};'use strict';var multer=require('multer');var util=require(_0x086f('0x0'));var path=require(_0x086f('0x1'));var timeout=require(_0x086f('0x2'));var express=require(_0x086f('0x3'));var router=express['Router']();var fs_extra=require(_0x086f('0x4'));var auth=require(_0x086f('0x5'));var interaction=require(_0x086f('0x6'));var config=require(_0x086f('0x7'));var controller=require(_0x086f('0x8'));router[_0x086f('0x9')]('/',auth['isAuthenticated'](),controller[_0x086f('0xa')]);router[_0x086f('0x9')](_0x086f('0xb'),auth[_0x086f('0xc')](),controller[_0x086f('0xd')]);router[_0x086f('0x9')]('/:id',auth[_0x086f('0xc')](),controller['show']);router['get'](_0x086f('0xe'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x086f('0xc')](),controller['create']);router['put']('/:id',auth[_0x086f('0xc')](),controller['update']);router[_0x086f('0xf')]('/:id',auth[_0x086f('0xc')](),controller['destroy']);module[_0x086f('0x10')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 0adce07..fec1ba1 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 _0xbb59=['MM-DD-YYYY\x20HH:mm','toString','sequelize','moment','path','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','closedAt','duration','DATE','format'];(function(_0x592eaa,_0x26d920){var _0x502849=function(_0x21fcfb){while(--_0x21fcfb){_0x592eaa['push'](_0x592eaa['shift']());}};_0x502849(++_0x26d920);}(_0xbb59,0xec));var _0x9bb5=function(_0x323e03,_0x5f2e0a){_0x323e03=_0x323e03-0x0;var _0x39fac3=_0xbb59[_0x323e03];return _0x39fac3;};'use strict';var Sequelize=require(_0x9bb5('0x0'));var moment=require(_0x9bb5('0x1'));var path=require(_0x9bb5('0x2'));var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize[_0x9bb5('0x3')],'get':function(){return this[_0x9bb5('0x4')](_0x9bb5('0x5'))?path[_0x9bb5('0x6')](this[_0x9bb5('0x4')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0x9bb5('0x7')]},'channel':{'type':Sequelize[_0x9bb5('0x7')]},'value':{'type':Sequelize[_0x9bb5('0x7')],'set':function(_0x2df722){var _0xe362e0=_0x2df722[_0x9bb5('0x8')](/\\/g,'/');this[_0x9bb5('0x9')](_0x9bb5('0x5'),_0xe362e0);}},'rating':{'type':Sequelize[_0x9bb5('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x9bb5('0xa')],'set':function(_0x2fdbcb){this[_0x9bb5('0x9')](_0x9bb5('0xb'),moment()['subtract'](_0x2fdbcb,'ms'));this[_0x9bb5('0x9')](_0x9bb5('0xc'),moment());this[_0x9bb5('0x9')](_0x9bb5('0xd'),_0x2fdbcb);}},'startedAt':{'type':Sequelize[_0x9bb5('0xe')],'get':function(){return moment(this[_0x9bb5('0x4')](_0x9bb5('0xb')))[_0x9bb5('0xf')](_0x9bb5('0x10'))[_0x9bb5('0x11')]();}},'closedAt':{'type':Sequelize[_0x9bb5('0xe')],'get':function(){return moment(this[_0x9bb5('0x4')](_0x9bb5('0xc')))[_0x9bb5('0xf')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'createdAt':{'type':Sequelize[_0x9bb5('0xe')],'get':function(){return moment(this['getDataValue']('createdAt'))[_0x9bb5('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x9bb5('0x11')]();}},'updatedAt':{'type':Sequelize[_0x9bb5('0xe')],'get':function(){return moment(this[_0x9bb5('0x4')]('updatedAt'))[_0x9bb5('0xf')](_0x9bb5('0x10'))[_0x9bb5('0x11')]();}}}; \ No newline at end of file +var _0x8f25=['updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt'];(function(_0x34ad96,_0x53e38e){var _0x18f92a=function(_0x422394){while(--_0x422394){_0x34ad96['push'](_0x34ad96['shift']());}};_0x18f92a(++_0x53e38e);}(_0x8f25,0x14b));var _0x58f2=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x8f25[_0xae7c2f];return _0x5d7001;};'use strict';var Sequelize=require(_0x58f2('0x0'));var moment=require(_0x58f2('0x1'));var path=require(_0x58f2('0x2'));var config=require(_0x58f2('0x3'));module[_0x58f2('0x4')]={'format':{'type':Sequelize[_0x58f2('0x5')],'get':function(){return this['getDataValue']('value')?path['extname'](this[_0x58f2('0x6')](_0x58f2('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0x58f2('0x8')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x58f2('0x8')],'set':function(_0x26f94f){var _0x3d5efe=_0x26f94f[_0x58f2('0x9')](/\\/g,'/');this[_0x58f2('0xa')](_0x58f2('0x7'),_0x3d5efe);}},'rating':{'type':Sequelize[_0x58f2('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x58f2('0xb')],'set':function(_0x4b56c1){this[_0x58f2('0xa')](_0x58f2('0xc'),moment()[_0x58f2('0xd')](_0x4b56c1,'ms'));this[_0x58f2('0xa')](_0x58f2('0xe'),moment());this['setDataValue'](_0x58f2('0xf'),_0x4b56c1);}},'startedAt':{'type':Sequelize[_0x58f2('0x10')],'get':function(){return moment(this[_0x58f2('0x6')]('startedAt'))[_0x58f2('0x11')](_0x58f2('0x12'))['toString']();}},'closedAt':{'type':Sequelize[_0x58f2('0x10')],'get':function(){return moment(this[_0x58f2('0x6')]('closedAt'))[_0x58f2('0x11')](_0x58f2('0x12'))[_0x58f2('0x13')]();}},'createdAt':{'type':Sequelize[_0x58f2('0x10')],'get':function(){return moment(this[_0x58f2('0x6')](_0x58f2('0x14')))[_0x58f2('0x11')](_0x58f2('0x12'))[_0x58f2('0x13')]();}},'updatedAt':{'type':Sequelize[_0x58f2('0x10')],'get':function(){return moment(this[_0x58f2('0x6')](_0x58f2('0x15')))['format'](_0x58f2('0x12'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 3ed3063..cb6bf39 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 _0xe14b=['include','findAll','catch','show','fields','length','includeAll','find','create','body','duration','closedAt','value','params','describe','download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','save','update','then','error','stack','name','send','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options'];(function(_0x11bf8d,_0x5d0f6b){var _0x4e3242=function(_0x2609ce){while(--_0x2609ce){_0x11bf8d['push'](_0x11bf8d['shift']());}};_0x4e3242(++_0x5d0f6b);}(_0xe14b,0x93));var _0xbe14=function(_0x4a09b,_0x196d4b){_0x4a09b=_0x4a09b-0x0;var _0x561171=_0xe14b[_0x4a09b];return _0x561171;};'use strict';var emlformat=require(_0xbe14('0x0'));var rimraf=require(_0xbe14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbe14('0x2'));var moment=require(_0xbe14('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbe14('0x4'));var util=require('util');var path=require('path');var sox=require(_0xbe14('0x5'));var csv=require(_0xbe14('0x6'));var ejs=require(_0xbe14('0x7'));var fs=require('fs');var fs_extra=require(_0xbe14('0x8'));var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];function respondWithStatusCode(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xcc;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0x16')](_0x3b898d);}return _0x27792f[_0xbe14('0x17')](_0x3b898d)[_0xbe14('0x18')]();};}function respondWithResult(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xc8;return function(_0x813399){if(_0x813399){return _0x1e4826['status'](_0x33fd54)['json'](_0x813399);}};}function respondWithFilteredResult(_0x3f58f5,_0x3dc4a9){return function(_0xf4ac9){if(_0xf4ac9){var _0x37ce4e=typeof _0x3dc4a9['offset']===_0xbe14('0x19')&&typeof _0x3dc4a9[_0xbe14('0x1a')]===_0xbe14('0x19');var _0x123ede=_0xf4ac9[_0xbe14('0x1b')];var _0x29ab73=_0x37ce4e?0x0:_0x3dc4a9[_0xbe14('0x1c')];var _0x5ea1f8=_0x37ce4e?_0xf4ac9[_0xbe14('0x1b')]:_0x3dc4a9[_0xbe14('0x1c')]+_0x3dc4a9[_0xbe14('0x1a')];var _0x433459;if(_0x5ea1f8>=_0x123ede){_0x5ea1f8=_0x123ede;_0x433459=0xc8;}else{_0x433459=0xce;}_0x3f58f5[_0xbe14('0x17')](_0x433459);return _0x3f58f5[_0xbe14('0x1d')]('Content-Range',_0x29ab73+'-'+_0x5ea1f8+'/'+_0x123ede)[_0xbe14('0x1e')](_0xf4ac9);}return null;};}function patchUpdates(_0x4a1bbd){return function(_0x417c8d){try{jsonpatch[_0xbe14('0x1f')](_0x417c8d,_0x4a1bbd,!![]);}catch(_0x188ec4){return BPromise['reject'](_0x188ec4);}return _0x417c8d[_0xbe14('0x20')]();};}function saveUpdates(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x21')](_0x56d845)['then'](function(_0x274018){return _0x274018;});}return null;};}function removeEntity(_0x3d3608,_0x505dbd){return function(_0x2da350){if(_0x2da350){return _0x2da350['destroy']()[_0xbe14('0x22')](function(){_0x3d3608['status'](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x5fa043,_0x1ee9c1){return function(_0x39cc81){if(!_0x39cc81){_0x5fa043[_0xbe14('0x16')](0x194);}return _0x39cc81;};}function handleError(_0x2703f5,_0x55d001){_0x55d001=_0x55d001||0x1f4;return function(_0x1822e0){logger[_0xbe14('0x23')](_0x1822e0[_0xbe14('0x24')]);if(_0x1822e0[_0xbe14('0x25')]){delete _0x1822e0['name'];}_0x2703f5[_0xbe14('0x17')](_0x55d001)[_0xbe14('0x26')](_0x1822e0);};}exports['index']=function(_0x3c3613,_0x3b3e84){var _0x1c7cc7={},_0x19252f={},_0x34d648={'count':0x0,'rows':[]};var _0x36d4b2=_[_0xbe14('0x27')](db[_0xbe14('0x28')][_0xbe14('0x29')],function(_0x16a159){return{'name':_0x16a159[_0xbe14('0x2a')],'type':_0x16a159[_0xbe14('0x2b')][_0xbe14('0x2c')]};});_0x19252f[_0xbe14('0x2d')]=_[_0xbe14('0x2e')](_[_0xbe14('0x27')](_0x36d4b2,_0xbe14('0x25')),[_0xbe14('0x2f')]);_0x19252f[_0xbe14('0x30')]=_[_0xbe14('0x31')](_0x3c3613['query']);_0x19252f[_0xbe14('0x32')]=_['intersection'](_0x19252f['model'],_0x19252f[_0xbe14('0x30')]);_0x1c7cc7['attributes']=_[_0xbe14('0x33')](_0x19252f[_0xbe14('0x2d')],qs['fields'](_0x3c3613['query']['fields']));_0x1c7cc7[_0xbe14('0x34')]=_0x1c7cc7[_0xbe14('0x34')]['length']?_0x1c7cc7[_0xbe14('0x34')]:_0x19252f[_0xbe14('0x2d')];if(!_0x3c3613[_0xbe14('0x30')][_0xbe14('0x35')](_0xbe14('0x36'))){_0x1c7cc7['limit']=qs['limit'](_0x3c3613[_0xbe14('0x30')]['limit']);_0x1c7cc7['offset']=qs['offset'](_0x3c3613[_0xbe14('0x30')][_0xbe14('0x1c')]);}_0x1c7cc7[_0xbe14('0x37')]=qs[_0xbe14('0x38')](_0x3c3613[_0xbe14('0x30')][_0xbe14('0x38')]);_0x1c7cc7[_0xbe14('0x39')]=qs[_0xbe14('0x32')](_[_0xbe14('0x3a')](_0x3c3613[_0xbe14('0x30')],_0x19252f[_0xbe14('0x32')]),_0x36d4b2);if(_0x3c3613[_0xbe14('0x30')]['filter']){_0x1c7cc7['where']=_[_0xbe14('0x3b')](_0x1c7cc7[_0xbe14('0x39')],{'$or':_[_0xbe14('0x27')](_0x36d4b2,function(_0x520e09){if(_0x520e09[_0xbe14('0x2b')]!==_0xbe14('0x3c')){var _0xeda70e={};_0xeda70e[_0x520e09[_0xbe14('0x25')]]={'$like':'%'+_0x3c3613[_0xbe14('0x30')][_0xbe14('0x3d')]+'%'};return _0xeda70e;}})});}_0x1c7cc7=_[_0xbe14('0x3b')]({},_0x1c7cc7,_0x3c3613[_0xbe14('0x3e')]);var _0x1b2608={'where':_0x1c7cc7['where']};return db[_0xbe14('0x28')][_0xbe14('0x1b')](_0x1b2608)[_0xbe14('0x22')](function(_0x1b3118){_0x34d648[_0xbe14('0x1b')]=_0x1b3118;if(_0x3c3613[_0xbe14('0x30')]['includeAll']){_0x1c7cc7[_0xbe14('0x3f')]=[{'all':!![]}];}return db[_0xbe14('0x28')][_0xbe14('0x40')](_0x1c7cc7);})[_0xbe14('0x22')](function(_0x5cf713){_0x34d648['rows']=_0x5cf713;return _0x34d648;})[_0xbe14('0x22')](respondWithFilteredResult(_0x3b3e84,_0x1c7cc7))[_0xbe14('0x41')](handleError(_0x3b3e84,null));};exports[_0xbe14('0x42')]=function(_0x51c859,_0x5d5318){var _0x6b6aa8={'raw':![],'where':{'id':_0x51c859['params']['id']}},_0x59ae4d={};_0x59ae4d[_0xbe14('0x2d')]=_[_0xbe14('0x31')](db[_0xbe14('0x28')]['rawAttributes']);_0x59ae4d['query']=_['keys'](_0x51c859[_0xbe14('0x30')]);_0x59ae4d[_0xbe14('0x32')]=_[_0xbe14('0x33')](_0x59ae4d['model'],_0x59ae4d[_0xbe14('0x30')]);_0x6b6aa8[_0xbe14('0x34')]=_[_0xbe14('0x33')](_0x59ae4d[_0xbe14('0x2d')],qs['fields'](_0x51c859['query'][_0xbe14('0x43')]));_0x6b6aa8[_0xbe14('0x34')]=_0x6b6aa8[_0xbe14('0x34')][_0xbe14('0x44')]?_0x6b6aa8[_0xbe14('0x34')]:_0x59ae4d['model'];if(_0x51c859['query'][_0xbe14('0x45')]){_0x6b6aa8[_0xbe14('0x3f')]=[{'all':!![]}];}_0x6b6aa8=_[_0xbe14('0x3b')]({},_0x6b6aa8,_0x51c859[_0xbe14('0x3e')]);return db['ScreenRecording'][_0xbe14('0x46')](_0x6b6aa8)[_0xbe14('0x22')](handleEntityNotFound(_0x5d5318,null))['then'](respondWithResult(_0x5d5318,null))[_0xbe14('0x41')](handleError(_0x5d5318,null));};exports[_0xbe14('0x47')]=function(_0x2d6ee8,_0x36c20c){return db['ScreenRecording']['create'](_0x2d6ee8[_0xbe14('0x48')],{})[_0xbe14('0x22')](respondWithResult(_0x36c20c,0xc9))['catch'](handleError(_0x36c20c,null));};exports['update']=function(_0xca8cdb,_0x5d3726){if(_0xca8cdb[_0xbe14('0x48')]['id']){delete _0xca8cdb[_0xbe14('0x48')]['id'];}delete _0xca8cdb[_0xbe14('0x48')][_0xbe14('0x49')];delete _0xca8cdb[_0xbe14('0x48')]['createdAt'];delete _0xca8cdb[_0xbe14('0x48')][_0xbe14('0x4a')];delete _0xca8cdb[_0xbe14('0x48')][_0xbe14('0x4b')];return db[_0xbe14('0x28')]['find']({'where':{'id':_0xca8cdb[_0xbe14('0x4c')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x5d3726,null))[_0xbe14('0x22')](saveUpdates(_0xca8cdb[_0xbe14('0x48')],null))[_0xbe14('0x22')](respondWithResult(_0x5d3726,null))[_0xbe14('0x41')](handleError(_0x5d3726,null));};exports['describe']=function(_0x5aeea9,_0x3a49f7){return db[_0xbe14('0x28')][_0xbe14('0x4d')]()['then'](respondWithResult(_0x3a49f7,null))['catch'](handleError(_0x3a49f7,null));};exports[_0xbe14('0x4e')]=function(_0x134878,_0x50d78f,_0x339a86){var _0x32496a=require('../../components/encryptor');var _0x28f995=![];var _0x4a40d2={};if(_0x134878[_0xbe14('0x30')][_0xbe14('0x2b')]&&_0x134878[_0xbe14('0x30')]['type']===_0xbe14('0x4f')){_0x4a40d2[_0xbe14('0x4f')]=_0x134878['params']['id'];}else{_0x4a40d2['id']=_0x134878[_0xbe14('0x4c')]['id'];}return db[_0xbe14('0x28')][_0xbe14('0x46')]({'where':_0x4a40d2,'attributes':['id',_0xbe14('0x4b')],'raw':!![]})[_0xbe14('0x22')](handleEntityNotFound(_0x50d78f,null))['then'](function(_0x42a346){if(_0x42a346){var _0x34cd66=path[_0xbe14('0x50')](config[_0xbe14('0x51')],_0xbe14('0x52'),_0x42a346[_0xbe14('0x4b')]);var _0x1dd6c7=util['format'](_0xbe14('0x53'),_0x34cd66);if(fs[_0xbe14('0x54')](_0x1dd6c7)){_0x28f995=!![];return _0x32496a[_0xbe14('0x55')](_0x1dd6c7,_0x34cd66,config[_0xbe14('0x56')][_0xbe14('0x57')])[_0xbe14('0x22')](function(){return _0x42a346;});}return _0x42a346;}})[_0xbe14('0x22')](function(_0x32df3c){if(_0x32df3c){var _0x285b6e=path[_0xbe14('0x50')](config[_0xbe14('0x51')],'server/files/screen_recordings',_0x32df3c['value']);if(!fs['existsSync'](_0x285b6e)){throw new db[(_0xbe14('0x58'))][(_0xbe14('0x59'))](_0xbe14('0x5a'));}if(_0x32df3c[_0xbe14('0x5b')]){return _0x50d78f[_0xbe14('0x4e')](_0x285b6e,_0x32df3c[_0xbe14('0x5b')]+path[_0xbe14('0x5c')](_0x285b6e),function(){if(_0x28f995){fs[_0xbe14('0x5d')](_0x285b6e);}});}else{return _0x50d78f[_0xbe14('0x4e')](_0x285b6e,function(_0x451b0b){if(_0x28f995){fs[_0xbe14('0x5d')](_0x285b6e);}});}}})[_0xbe14('0x41')](function(_0x2088e4){if(_0x2088e4[_0xbe14('0x5e')]===_0xbe14('0x5a')){_0x50d78f[_0xbe14('0x17')](0x194)[_0xbe14('0x26')](_0xbe14('0x5f'));}else{return handleError(_0x50d78f,null);}});};exports[_0xbe14('0x60')]=function(_0x1a945b,_0x5f394c){return db[_0xbe14('0x28')][_0xbe14('0x46')]({'where':{'id':_0x1a945b[_0xbe14('0x4c')]['id']}})[_0xbe14('0x22')](function(_0x3ee6b7){if(_[_0xbe14('0x61')](_0x3ee6b7)){throw new ReferenceError(_0xbe14('0x62'));}return _0x3ee6b7;})[_0xbe14('0x22')](function(_0x23cb36){var _0x100d43=path['join'](config[_0xbe14('0x51')],_0xbe14('0x52'),_0x23cb36[_0xbe14('0x4b')]);logger[_0xbe14('0x63')](_0xbe14('0x64'),_0x100d43);if(!_['isNil'](_0x23cb36[_0xbe14('0x4b')])&&fs[_0xbe14('0x54')](_0x100d43)){logger[_0xbe14('0x63')](_0xbe14('0x65')+_0x100d43+_0xbe14('0x66'));fs['unlinkSync'](_0x100d43);}_0x100d43=_0x100d43+_0xbe14('0x67');if(!_[_0xbe14('0x61')](_0x23cb36[_0xbe14('0x4b')])&&fs[_0xbe14('0x54')](_0x100d43)){logger[_0xbe14('0x63')](_0xbe14('0x65')+_0x100d43+_0xbe14('0x66'));fs[_0xbe14('0x68')](_0x100d43);}return _0x23cb36;})['then'](function(_0x1bb588){if(!_0x1bb588)throw new InternalError();return _0x1bb588[_0xbe14('0x60')]();})[_0xbe14('0x22')](function(){_0x5f394c[_0xbe14('0x17')](0xcc)[_0xbe14('0x18')]();})[_0xbe14('0x41')](handleError(_0x5f394c,null));}; \ No newline at end of file +var _0xed1f=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','ScreenRecording','rawAttributes','fieldName','type','key','differenceBy','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','show','params','merge','options','catch','create','body','duration','createdAt','closedAt','value','find','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','format','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','filename','extname','unlink','message','ScreenRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','eml-format','rimraf'];(function(_0x2b08c4,_0x321a22){var _0xc7406e=function(_0x1bea3a){while(--_0x1bea3a){_0x2b08c4['push'](_0x2b08c4['shift']());}};_0xc7406e(++_0x321a22);}(_0xed1f,0x6a));var _0xfed1=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xed1f[_0x2112d4];return _0x434972;};'use strict';var emlformat=require(_0xfed1('0x0'));var rimraf=require(_0xfed1('0x1'));var zipdir=require(_0xfed1('0x2'));var jsonpatch=require(_0xfed1('0x3'));var rp=require(_0xfed1('0x4'));var moment=require(_0xfed1('0x5'));var BPromise=require(_0xfed1('0x6'));var Mustache=require(_0xfed1('0x7'));var util=require(_0xfed1('0x8'));var path=require(_0xfed1('0x9'));var sox=require(_0xfed1('0xa'));var csv=require(_0xfed1('0xb'));var ejs=require(_0xfed1('0xc'));var fs=require('fs');var fs_extra=require(_0xfed1('0xd'));var _=require(_0xfed1('0xe'));var squel=require(_0xfed1('0xf'));var crypto=require(_0xfed1('0x10'));var jsforce=require(_0xfed1('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xfed1('0xb'));var querystring=require(_0xfed1('0x12'));var Papa=require('papaparse');var Redis=require(_0xfed1('0x13'));var authService=require(_0xfed1('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xfed1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfed1('0x16'))(_0xfed1('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfed1('0x18'));var db=require(_0xfed1('0x19'))['db'];function respondWithStatusCode(_0x569a6e,_0x17f4fe){_0x17f4fe=_0x17f4fe||0xcc;return function(_0x5a3469){if(_0x5a3469){return _0x569a6e['sendStatus'](_0x17f4fe);}return _0x569a6e[_0xfed1('0x1a')](_0x17f4fe)[_0xfed1('0x1b')]();};}function respondWithResult(_0x532537,_0x2dde3a){_0x2dde3a=_0x2dde3a||0xc8;return function(_0x5b9455){if(_0x5b9455){return _0x532537['status'](_0x2dde3a)[_0xfed1('0x1c')](_0x5b9455);}};}function respondWithFilteredResult(_0x39aa0c,_0x1fbb7a){return function(_0x123c46){if(_0x123c46){var _0x582e67=typeof _0x1fbb7a[_0xfed1('0x1d')]==='undefined'&&typeof _0x1fbb7a[_0xfed1('0x1e')]===_0xfed1('0x1f');var _0x489a0f=_0x123c46[_0xfed1('0x20')];var _0xa72a20=_0x582e67?0x0:_0x1fbb7a['offset'];var _0x59509b=_0x582e67?_0x123c46['count']:_0x1fbb7a[_0xfed1('0x1d')]+_0x1fbb7a['limit'];var _0x201f18;if(_0x59509b>=_0x489a0f){_0x59509b=_0x489a0f;_0x201f18=0xc8;}else{_0x201f18=0xce;}_0x39aa0c[_0xfed1('0x1a')](_0x201f18);return _0x39aa0c['set'](_0xfed1('0x21'),_0xa72a20+'-'+_0x59509b+'/'+_0x489a0f)[_0xfed1('0x1c')](_0x123c46);}return null;};}function patchUpdates(_0x59ee9d){return function(_0x3ce944){try{jsonpatch[_0xfed1('0x22')](_0x3ce944,_0x59ee9d,!![]);}catch(_0xff4842){return BPromise[_0xfed1('0x23')](_0xff4842);}return _0x3ce944['save']();};}function saveUpdates(_0x203cec,_0x59333e){return function(_0x446558){if(_0x446558){return _0x446558[_0xfed1('0x24')](_0x203cec)[_0xfed1('0x25')](function(_0x532ec2){return _0x532ec2;});}return null;};}function removeEntity(_0x41d22c,_0x594917){return function(_0x460555){if(_0x460555){return _0x460555[_0xfed1('0x26')]()[_0xfed1('0x25')](function(){_0x41d22c[_0xfed1('0x1a')](0xcc)[_0xfed1('0x1b')]();});}};}function handleEntityNotFound(_0x1199b7,_0x527fc7){return function(_0x465ce6){if(!_0x465ce6){_0x1199b7[_0xfed1('0x27')](0x194);}return _0x465ce6;};}function handleError(_0x49072b,_0x1d6c72){_0x1d6c72=_0x1d6c72||0x1f4;return function(_0x2b9dd2){logger[_0xfed1('0x28')](_0x2b9dd2[_0xfed1('0x29')]);if(_0x2b9dd2[_0xfed1('0x2a')]){delete _0x2b9dd2[_0xfed1('0x2a')];}_0x49072b['status'](_0x1d6c72)[_0xfed1('0x2b')](_0x2b9dd2);};}exports['index']=function(_0x3106ee,_0x4e5249){var _0x53b0c9={},_0x1cec64={},_0x42c950={'count':0x0,'rows':[]};var _0x2d334e=_['map'](db[_0xfed1('0x2c')][_0xfed1('0x2d')],function(_0x13f414){return{'name':_0x13f414[_0xfed1('0x2e')],'type':_0x13f414[_0xfed1('0x2f')][_0xfed1('0x30')]};});_0x1cec64['model']=_[_0xfed1('0x31')](_[_0xfed1('0x32')](_0x2d334e,'name'),['format']);_0x1cec64[_0xfed1('0x33')]=_[_0xfed1('0x34')](_0x3106ee[_0xfed1('0x33')]);_0x1cec64[_0xfed1('0x35')]=_[_0xfed1('0x36')](_0x1cec64['model'],_0x1cec64[_0xfed1('0x33')]);_0x53b0c9[_0xfed1('0x37')]=_[_0xfed1('0x36')](_0x1cec64[_0xfed1('0x38')],qs[_0xfed1('0x39')](_0x3106ee['query'][_0xfed1('0x39')]));_0x53b0c9['attributes']=_0x53b0c9[_0xfed1('0x37')][_0xfed1('0x3a')]?_0x53b0c9[_0xfed1('0x37')]:_0x1cec64[_0xfed1('0x38')];if(!_0x3106ee[_0xfed1('0x33')][_0xfed1('0x3b')](_0xfed1('0x3c'))){_0x53b0c9[_0xfed1('0x1e')]=qs['limit'](_0x3106ee[_0xfed1('0x33')][_0xfed1('0x1e')]);_0x53b0c9[_0xfed1('0x1d')]=qs[_0xfed1('0x1d')](_0x3106ee['query']['offset']);}_0x53b0c9[_0xfed1('0x3d')]=qs[_0xfed1('0x3e')](_0x3106ee[_0xfed1('0x33')][_0xfed1('0x3e')]);_0x53b0c9[_0xfed1('0x3f')]=qs[_0xfed1('0x35')](_[_0xfed1('0x40')](_0x3106ee[_0xfed1('0x33')],_0x1cec64['filters']),_0x2d334e);if(_0x3106ee['query'][_0xfed1('0x41')]){_0x53b0c9[_0xfed1('0x3f')]=_['merge'](_0x53b0c9[_0xfed1('0x3f')],{'$or':_[_0xfed1('0x32')](_0x2d334e,function(_0x3b0973){if(_0x3b0973[_0xfed1('0x2f')]!==_0xfed1('0x42')){var _0x31ffeb={};_0x31ffeb[_0x3b0973[_0xfed1('0x2a')]]={'$like':'%'+_0x3106ee[_0xfed1('0x33')][_0xfed1('0x41')]+'%'};return _0x31ffeb;}})});}_0x53b0c9=_['merge']({},_0x53b0c9,_0x3106ee['options']);var _0x5598dc={'where':_0x53b0c9[_0xfed1('0x3f')]};return db[_0xfed1('0x2c')][_0xfed1('0x20')](_0x5598dc)['then'](function(_0x3454e6){_0x42c950['count']=_0x3454e6;if(_0x3106ee[_0xfed1('0x33')][_0xfed1('0x43')]){_0x53b0c9[_0xfed1('0x44')]=[{'all':!![]}];}return db['ScreenRecording'][_0xfed1('0x45')](_0x53b0c9);})[_0xfed1('0x25')](function(_0x422433){_0x42c950['rows']=_0x422433;return _0x42c950;})[_0xfed1('0x25')](respondWithFilteredResult(_0x4e5249,_0x53b0c9))['catch'](handleError(_0x4e5249,null));};exports[_0xfed1('0x46')]=function(_0xf1f739,_0x229fc7){var _0x13c087={'raw':![],'where':{'id':_0xf1f739[_0xfed1('0x47')]['id']}},_0x1bfbe8={};_0x1bfbe8[_0xfed1('0x38')]=_[_0xfed1('0x34')](db[_0xfed1('0x2c')]['rawAttributes']);_0x1bfbe8[_0xfed1('0x33')]=_[_0xfed1('0x34')](_0xf1f739[_0xfed1('0x33')]);_0x1bfbe8['filters']=_['intersection'](_0x1bfbe8[_0xfed1('0x38')],_0x1bfbe8[_0xfed1('0x33')]);_0x13c087[_0xfed1('0x37')]=_[_0xfed1('0x36')](_0x1bfbe8[_0xfed1('0x38')],qs[_0xfed1('0x39')](_0xf1f739[_0xfed1('0x33')][_0xfed1('0x39')]));_0x13c087[_0xfed1('0x37')]=_0x13c087[_0xfed1('0x37')][_0xfed1('0x3a')]?_0x13c087[_0xfed1('0x37')]:_0x1bfbe8['model'];if(_0xf1f739[_0xfed1('0x33')][_0xfed1('0x43')]){_0x13c087[_0xfed1('0x44')]=[{'all':!![]}];}_0x13c087=_[_0xfed1('0x48')]({},_0x13c087,_0xf1f739[_0xfed1('0x49')]);return db[_0xfed1('0x2c')]['find'](_0x13c087)[_0xfed1('0x25')](handleEntityNotFound(_0x229fc7,null))[_0xfed1('0x25')](respondWithResult(_0x229fc7,null))[_0xfed1('0x4a')](handleError(_0x229fc7,null));};exports['create']=function(_0x22874a,_0x10f98d){return db[_0xfed1('0x2c')][_0xfed1('0x4b')](_0x22874a['body'],{})[_0xfed1('0x25')](respondWithResult(_0x10f98d,0xc9))[_0xfed1('0x4a')](handleError(_0x10f98d,null));};exports[_0xfed1('0x24')]=function(_0x42761f,_0x14745e){if(_0x42761f[_0xfed1('0x4c')]['id']){delete _0x42761f[_0xfed1('0x4c')]['id'];}delete _0x42761f[_0xfed1('0x4c')][_0xfed1('0x4d')];delete _0x42761f[_0xfed1('0x4c')][_0xfed1('0x4e')];delete _0x42761f[_0xfed1('0x4c')][_0xfed1('0x4f')];delete _0x42761f[_0xfed1('0x4c')][_0xfed1('0x50')];return db[_0xfed1('0x2c')][_0xfed1('0x51')]({'where':{'id':_0x42761f[_0xfed1('0x47')]['id']}})['then'](handleEntityNotFound(_0x14745e,null))['then'](saveUpdates(_0x42761f[_0xfed1('0x4c')],null))[_0xfed1('0x25')](respondWithResult(_0x14745e,null))[_0xfed1('0x4a')](handleError(_0x14745e,null));};exports[_0xfed1('0x52')]=function(_0x5da599,_0x3c2534){return db[_0xfed1('0x2c')]['describe']()['then'](respondWithResult(_0x3c2534,null))['catch'](handleError(_0x3c2534,null));};exports[_0xfed1('0x53')]=function(_0x1aaa3d,_0x15e90f,_0x1d8ef2){var _0x2665c8=require(_0xfed1('0x54'));var _0x1a9f22=![];var _0x144102={};if(_0x1aaa3d[_0xfed1('0x33')][_0xfed1('0x2f')]&&_0x1aaa3d['query']['type']===_0xfed1('0x55')){_0x144102[_0xfed1('0x55')]=_0x1aaa3d[_0xfed1('0x47')]['id'];}else{_0x144102['id']=_0x1aaa3d[_0xfed1('0x47')]['id'];}return db[_0xfed1('0x2c')][_0xfed1('0x51')]({'where':_0x144102,'attributes':['id',_0xfed1('0x50')],'raw':!![]})[_0xfed1('0x25')](handleEntityNotFound(_0x15e90f,null))[_0xfed1('0x25')](function(_0x427fa6){if(_0x427fa6){var _0xbd49dc=path[_0xfed1('0x56')](config[_0xfed1('0x57')],_0xfed1('0x58'),_0x427fa6[_0xfed1('0x50')]);var _0x3a7a42=util[_0xfed1('0x59')]('%s.cypher',_0xbd49dc);if(fs['existsSync'](_0x3a7a42)){_0x1a9f22=!![];return _0x2665c8[_0xfed1('0x5a')](_0x3a7a42,_0xbd49dc,config[_0xfed1('0x5b')][_0xfed1('0x5c')])[_0xfed1('0x25')](function(){return _0x427fa6;});}return _0x427fa6;}})[_0xfed1('0x25')](function(_0x41a22a){if(_0x41a22a){var _0x2ccdc3=path[_0xfed1('0x56')](config[_0xfed1('0x57')],_0xfed1('0x58'),_0x41a22a[_0xfed1('0x50')]);if(!fs[_0xfed1('0x5d')](_0x2ccdc3)){throw new db[(_0xfed1('0x5e'))][(_0xfed1('0x5f'))]('ScreenRecording\x20not\x20found');}if(_0x41a22a[_0xfed1('0x60')]){return _0x15e90f['download'](_0x2ccdc3,_0x41a22a['filename']+path[_0xfed1('0x61')](_0x2ccdc3),function(){if(_0x1a9f22){fs['unlink'](_0x2ccdc3);}});}else{return _0x15e90f[_0xfed1('0x53')](_0x2ccdc3,function(_0x5acc45){if(_0x1a9f22){fs[_0xfed1('0x62')](_0x2ccdc3);}});}}})[_0xfed1('0x4a')](function(_0x53f0ab){if(_0x53f0ab[_0xfed1('0x63')]===_0xfed1('0x64')){_0x15e90f['status'](0x194)[_0xfed1('0x2b')](_0xfed1('0x65'));}else{return handleError(_0x15e90f,null);}});};exports[_0xfed1('0x26')]=function(_0x2f37b9,_0x59a23a){return db[_0xfed1('0x2c')][_0xfed1('0x51')]({'where':{'id':_0x2f37b9[_0xfed1('0x47')]['id']}})[_0xfed1('0x25')](function(_0x23347a){if(_[_0xfed1('0x66')](_0x23347a)){throw new ReferenceError(_0xfed1('0x67'));}return _0x23347a;})[_0xfed1('0x25')](function(_0x5c043d){var _0x2d66ec=path[_0xfed1('0x56')](config[_0xfed1('0x57')],_0xfed1('0x58'),_0x5c043d[_0xfed1('0x50')]);logger[_0xfed1('0x68')]('cancellazione\x20fisica\x20documento\x20%s',_0x2d66ec);if(!_['isNil'](_0x5c043d['value'])&&fs[_0xfed1('0x5d')](_0x2d66ec)){logger[_0xfed1('0x68')](_0xfed1('0x69')+_0x2d66ec+_0xfed1('0x6a'));fs['unlinkSync'](_0x2d66ec);}_0x2d66ec=_0x2d66ec+_0xfed1('0x6b');if(!_['isNil'](_0x5c043d[_0xfed1('0x50')])&&fs[_0xfed1('0x5d')](_0x2d66ec)){logger[_0xfed1('0x68')](_0xfed1('0x69')+_0x2d66ec+_0xfed1('0x6a'));fs['unlinkSync'](_0x2d66ec);}return _0x5c043d;})[_0xfed1('0x25')](function(_0x6b74cb){if(!_0x6b74cb)throw new InternalError();return _0x6b74cb[_0xfed1('0x26')]();})['then'](function(){_0x59a23a[_0xfed1('0x1a')](0xcc)[_0xfed1('0x1b')]();})[_0xfed1('0x4a')](handleError(_0x59a23a,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index cd76327..e3b0e97 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 _0x6aed=['bluebird','path','rimraf','../../config/environment','./screenRecording.attributes','define','screen_recordings','lodash','api','moment'];(function(_0x10df9c,_0x577cf6){var _0x4cd508=function(_0x4fe9a5){while(--_0x4fe9a5){_0x10df9c['push'](_0x10df9c['shift']());}};_0x4cd508(++_0x577cf6);}(_0x6aed,0x7f));var _0xd6ae=function(_0x26d0ab,_0x4f9146){_0x26d0ab=_0x26d0ab-0x0;var _0x301083=_0x6aed[_0x26d0ab];return _0x301083;};'use strict';var _=require(_0xd6ae('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd6ae('0x1'));var moment=require(_0xd6ae('0x2'));var BPromise=require(_0xd6ae('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd6ae('0x4'));var rimraf=require(_0xd6ae('0x5'));var config=require(_0xd6ae('0x6'));var attributes=require(_0xd6ae('0x7'));module['exports']=function(_0x30bc64,_0x2e8187){return _0x30bc64[_0xd6ae('0x8')]('ScreenRecording',attributes,{'tableName':_0xd6ae('0x9'),'paranoid':![],'indexes':[{'name':'interactionid','fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd65a=['api','request-promise','path','../../config/environment','define','ScreenRecording','screen_recordings','interactionid'];(function(_0x4063a4,_0x19d730){var _0x17908d=function(_0x3ce714){while(--_0x3ce714){_0x4063a4['push'](_0x4063a4['shift']());}};_0x17908d(++_0x19d730);}(_0xd65a,0x140));var _0xad65=function(_0x334713,_0x5e6776){_0x334713=_0x334713-0x0;var _0x376838=_0xd65a[_0x334713];return _0x376838;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xad65('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xad65('0x1'));var fs=require('fs');var path=require(_0xad65('0x2'));var rimraf=require('rimraf');var config=require(_0xad65('0x3'));var attributes=require('./screenRecording.attributes');module['exports']=function(_0x796261,_0x5c217a){return _0x796261[_0xad65('0x4')](_0xad65('0x5'),attributes,{'tableName':_0xad65('0x6'),'paranoid':![],'indexes':[{'name':_0xad65('0x7'),'fields':[_0xad65('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 37494a5..3fc3dd5 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 _0x92ac=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','error','code','message','catch'];(function(_0x2facd4,_0x16961c){var _0x5e8642=function(_0x25941b){while(--_0x25941b){_0x2facd4['push'](_0x2facd4['shift']());}};_0x5e8642(++_0x16961c);}(_0x92ac,0x11e));var _0xc92a=function(_0x1e1965,_0x55785c){_0x1e1965=_0x1e1965-0x0;var _0x1a2e96=_0x92ac[_0x1e1965];return _0x1a2e96;};'use strict';var _=require(_0xc92a('0x0'));var util=require(_0xc92a('0x1'));var moment=require('moment');var BPromise=require(_0xc92a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc92a('0x3'));var db=require(_0xc92a('0x4'))['db'];var utils=require(_0xc92a('0x5'));var logger=require(_0xc92a('0x6'))(_0xc92a('0x7'));var config=require(_0xc92a('0x8'));var jayson=require(_0xc92a('0x9'));var client=jayson['client'][_0xc92a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55657e,_0xcb22d7,_0x769b9b){return new BPromise(function(_0xca3f13,_0x4ccf83){return client[_0xc92a('0xb')](_0x55657e,_0x769b9b)[_0xc92a('0xc')](function(_0x5b6bb6){logger[_0xc92a('0xd')](_0xc92a('0xe'),_0xcb22d7,_0xc92a('0xf'));logger[_0xc92a('0x10')](_0xc92a('0x11'),_0xcb22d7,_0xc92a('0xf'),JSON['stringify'](_0x5b6bb6));if(_0x5b6bb6[_0xc92a('0x12')]){if(_0x5b6bb6['error'][_0xc92a('0x13')]===0x1f4){logger[_0xc92a('0x12')](_0xc92a('0xe'),_0xcb22d7,_0x5b6bb6['error'][_0xc92a('0x14')]);return _0x4ccf83(_0x5b6bb6[_0xc92a('0x12')][_0xc92a('0x14')]);}logger[_0xc92a('0x12')](_0xc92a('0xe'),_0xcb22d7,_0x5b6bb6[_0xc92a('0x12')]['message']);return _0xca3f13(_0x5b6bb6[_0xc92a('0x12')][_0xc92a('0x14')]);}else{logger[_0xc92a('0xd')](_0xc92a('0xe'),_0xcb22d7,_0xc92a('0xf'));_0xca3f13(_0x5b6bb6['result'][_0xc92a('0x14')]);}})[_0xc92a('0x15')](function(_0x5f11fc){logger[_0xc92a('0x12')]('ScreenRecording,\x20%s,\x20%s',_0xcb22d7,_0x5f11fc);_0x4ccf83(_0x5f11fc);});});} \ No newline at end of file +var _0x5956=['../../config/environment','jayson/promise','client','request','ScreenRecording,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x43608c,_0x29b597){var _0x2001a2=function(_0x2e4e03){while(--_0x2e4e03){_0x43608c['push'](_0x43608c['shift']());}};_0x2001a2(++_0x29b597);}(_0x5956,0x19b));var _0x6595=function(_0x20fa14,_0x2f0234){_0x20fa14=_0x20fa14-0x0;var _0x161aa0=_0x5956[_0x20fa14];return _0x161aa0;};'use strict';var _=require(_0x6595('0x0'));var util=require(_0x6595('0x1'));var moment=require('moment');var BPromise=require(_0x6595('0x2'));var rs=require(_0x6595('0x3'));var fs=require('fs');var Redis=require(_0x6595('0x4'));var db=require(_0x6595('0x5'))['db'];var utils=require(_0x6595('0x6'));var logger=require(_0x6595('0x7'))(_0x6595('0x8'));var config=require(_0x6595('0x9'));var jayson=require(_0x6595('0xa'));var client=jayson[_0x6595('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x182ea3,_0x222c46,_0x3ac45a){return new BPromise(function(_0x4e121f,_0x4ff2f9){return client[_0x6595('0xc')](_0x182ea3,_0x3ac45a)['then'](function(_0x4b8561){logger['info'](_0x6595('0xd'),_0x222c46,_0x6595('0xe'));logger['debug']('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x222c46,'request\x20sent',JSON[_0x6595('0xf')](_0x4b8561));if(_0x4b8561[_0x6595('0x10')]){if(_0x4b8561[_0x6595('0x10')][_0x6595('0x11')]===0x1f4){logger[_0x6595('0x10')]('ScreenRecording,\x20%s,\x20%s',_0x222c46,_0x4b8561[_0x6595('0x10')][_0x6595('0x12')]);return _0x4ff2f9(_0x4b8561[_0x6595('0x10')][_0x6595('0x12')]);}logger['error'](_0x6595('0xd'),_0x222c46,_0x4b8561[_0x6595('0x10')]['message']);return _0x4e121f(_0x4b8561[_0x6595('0x10')][_0x6595('0x12')]);}else{logger[_0x6595('0x13')](_0x6595('0xd'),_0x222c46,'request\x20sent');_0x4e121f(_0x4b8561[_0x6595('0x14')][_0x6595('0x12')]);}})['catch'](function(_0x54c43f){logger[_0x6595('0x10')](_0x6595('0xd'),_0x222c46,_0x54c43f);_0x4ff2f9(_0x54c43f);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 9a2daab..635b327 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 _0x2032=['diskStorage','addLogoLogin','root','format','favicon','single','addFavicon','put','update','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','join','%s%s','logo','extname','originalname','post','file','addLogo'];(function(_0x15ac15,_0x47481f){var _0x42bee2=function(_0x3140df){while(--_0x3140df){_0x15ac15['push'](_0x15ac15['shift']());}};_0x42bee2(++_0x47481f);}(_0x2032,0x16a));var _0x2203=function(_0x48bfbb,_0x1be48c){_0x48bfbb=_0x48bfbb-0x0;var _0x1c2c34=_0x2032[_0x48bfbb];return _0x1c2c34;};'use strict';var multer=require(_0x2203('0x0'));var util=require(_0x2203('0x1'));var path=require(_0x2203('0x2'));var timeout=require(_0x2203('0x3'));var express=require(_0x2203('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2203('0x5'));var interaction=require(_0x2203('0x6'));var config=require(_0x2203('0x7'));var controller=require(_0x2203('0x8'));router[_0x2203('0x9')]('/',auth[_0x2203('0xa')](),controller[_0x2203('0xb')]);router[_0x2203('0x9')](_0x2203('0xc'),controller[_0x2203('0xd')]);router[_0x2203('0x9')](_0x2203('0xe'),controller[_0x2203('0xf')]);router['get'](_0x2203('0x10'),controller[_0x2203('0x11')]);router[_0x2203('0x9')](_0x2203('0x12'),controller[_0x2203('0x13')]);router[_0x2203('0x9')](_0x2203('0x14'),controller[_0x2203('0x15')]);router[_0x2203('0x9')](_0x2203('0x16'),controller[_0x2203('0x17')]);router['get'](_0x2203('0x18'),controller[_0x2203('0x19')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1925eb,_0x33aa5f,_0x256da2){_0x256da2(null,path[_0x2203('0x1a')](config['root'],'server/files/images/logos/'));},'filename':function(_0x32f2c1,_0x52f020,_0x3ae951){_0x3ae951(null,util['format'](_0x2203('0x1b'),_0x2203('0x1c'),path[_0x2203('0x1d')](_0x52f020[_0x2203('0x1e')])));}})});router[_0x2203('0x1f')](_0x2203('0x10'),upload['single'](_0x2203('0x20')),controller[_0x2203('0x21')]);var upload=multer({'storage':multer[_0x2203('0x22')]({'destination':function(_0x5e7b89,_0x27588b,_0x338854){_0x338854(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0xbea4b5,_0x221949,_0x1f95ae){_0x1f95ae(null,util['format'](_0x2203('0x1b'),'logologin',path['extname'](_0x221949[_0x2203('0x1e')])));}})});router[_0x2203('0x1f')](_0x2203('0x12'),upload['single'](_0x2203('0x20')),controller[_0x2203('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3092eb,_0x1acad3,_0x3ecf15){_0x3ecf15(null,path[_0x2203('0x1a')](config[_0x2203('0x24')],'server/files/images/logos/'));},'filename':function(_0x52eff6,_0x479969,_0x5432ac){_0x5432ac(null,util[_0x2203('0x25')](_0x2203('0x1b'),'preferred',path[_0x2203('0x1d')](_0x479969[_0x2203('0x1e')])));}})});router[_0x2203('0x1f')](_0x2203('0x16'),upload['single']('file'),controller['addPreferred']);var upload=multer({'storage':multer[_0x2203('0x22')]({'destination':function(_0x5e0456,_0x1d6436,_0x31244d){_0x31244d(null,path[_0x2203('0x1a')](config[_0x2203('0x24')],'server/files/images/logos/'));},'filename':function(_0x47ecc2,_0x312302,_0x1f142f){_0x1f142f(null,util[_0x2203('0x25')](_0x2203('0x1b'),_0x2203('0x26'),path['extname'](_0x312302[_0x2203('0x1e')])));}})});router[_0x2203('0x1f')](_0x2203('0x18'),upload[_0x2203('0x27')](_0x2203('0x20')),controller[_0x2203('0x28')]);router[_0x2203('0x29')]('/:id',auth[_0x2203('0xa')](),controller[_0x2203('0x2a')]);module[_0x2203('0x2b')]=router; \ No newline at end of file +var _0xd4d0=['isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','root','%s%s','extname','originalname','post','single','join','server/files/images/logos/','logologin','format','preferred','file','addPreferred','addFavicon','put','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./setting.controller','get'];(function(_0x1d9803,_0x2a46c4){var _0x252490=function(_0x3b49eb){while(--_0x3b49eb){_0x1d9803['push'](_0x1d9803['shift']());}};_0x252490(++_0x2a46c4);}(_0xd4d0,0x6d));var _0x0d4d=function(_0x3136d0,_0x50bb50){_0x3136d0=_0x3136d0-0x0;var _0x27a560=_0xd4d0[_0x3136d0];return _0x27a560;};'use strict';var multer=require(_0x0d4d('0x0'));var util=require('util');var path=require(_0x0d4d('0x1'));var timeout=require(_0x0d4d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0d4d('0x3'));var auth=require(_0x0d4d('0x4'));var interaction=require(_0x0d4d('0x5'));var config=require('../../config/environment');var controller=require(_0x0d4d('0x6'));router[_0x0d4d('0x7')]('/',auth[_0x0d4d('0x8')](),controller[_0x0d4d('0x9')]);router[_0x0d4d('0x7')](_0x0d4d('0xa'),controller[_0x0d4d('0xb')]);router['get'](_0x0d4d('0xc'),controller[_0x0d4d('0xd')]);router[_0x0d4d('0x7')](_0x0d4d('0xe'),controller['getLogo']);router[_0x0d4d('0x7')](_0x0d4d('0xf'),controller[_0x0d4d('0x10')]);router[_0x0d4d('0x7')](_0x0d4d('0x11'),controller['gdpr']);router['get'](_0x0d4d('0x12'),controller[_0x0d4d('0x13')]);router[_0x0d4d('0x7')](_0x0d4d('0x14'),controller[_0x0d4d('0x15')]);var upload=multer({'storage':multer[_0x0d4d('0x16')]({'destination':function(_0x49f2e0,_0x5bf45e,_0x469833){_0x469833(null,path['join'](config[_0x0d4d('0x17')],'server/files/images/logos/'));},'filename':function(_0x691728,_0x3952bc,_0x4abf96){_0x4abf96(null,util['format'](_0x0d4d('0x18'),'logo',path[_0x0d4d('0x19')](_0x3952bc[_0x0d4d('0x1a')])));}})});router[_0x0d4d('0x1b')]('/:id/logo',upload[_0x0d4d('0x1c')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x0d4d('0x16')]({'destination':function(_0x3db02d,_0x32ff15,_0x27fbfe){_0x27fbfe(null,path[_0x0d4d('0x1d')](config[_0x0d4d('0x17')],_0x0d4d('0x1e')));},'filename':function(_0x1e121a,_0x1d1b82,_0xeef7a3){_0xeef7a3(null,util['format'](_0x0d4d('0x18'),_0x0d4d('0x1f'),path[_0x0d4d('0x19')](_0x1d1b82[_0x0d4d('0x1a')])));}})});router[_0x0d4d('0x1b')](_0x0d4d('0xf'),upload[_0x0d4d('0x1c')]('file'),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2447b7,_0x26749b,_0x213ae1){_0x213ae1(null,path['join'](config[_0x0d4d('0x17')],'server/files/images/logos/'));},'filename':function(_0x31beb8,_0x2a5026,_0x268e11){_0x268e11(null,util[_0x0d4d('0x20')]('%s%s',_0x0d4d('0x21'),path['extname'](_0x2a5026[_0x0d4d('0x1a')])));}})});router[_0x0d4d('0x1b')](_0x0d4d('0x12'),upload[_0x0d4d('0x1c')](_0x0d4d('0x22')),controller[_0x0d4d('0x23')]);var upload=multer({'storage':multer[_0x0d4d('0x16')]({'destination':function(_0x18b01a,_0x5abfe3,_0x34fb53){_0x34fb53(null,path[_0x0d4d('0x1d')](config['root'],_0x0d4d('0x1e')));},'filename':function(_0x26a827,_0x24e5a8,_0xa819c2){_0xa819c2(null,util[_0x0d4d('0x20')]('%s%s','favicon',path[_0x0d4d('0x19')](_0x24e5a8['originalname'])));}})});router[_0x0d4d('0x1b')](_0x0d4d('0x14'),upload[_0x0d4d('0x1c')](_0x0d4d('0x22')),controller[_0x0d4d('0x24')]);router[_0x0d4d('0x25')](_0x0d4d('0xc'),auth['isAuthenticated'](),controller['update']);module[_0x0d4d('0x26')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 3310703..8e036a5 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 _0x8409=['/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','exports','INTEGER','min_internal','min_mailbox','STRING'];(function(_0x2b8cf7,_0x4c8d1d){var _0x5a96ad=function(_0x2a8e02){while(--_0x2a8e02){_0x2b8cf7['push'](_0x2b8cf7['shift']());}};_0x5a96ad(++_0x4c8d1d);}(_0x8409,0x1a9));var _0x9840=function(_0x508a0a,_0x3ed316){_0x508a0a=_0x508a0a-0x0;var _0x4acf06=_0x8409[_0x508a0a];return _0x4acf06;};'use strict';var Sequelize=require('sequelize');module[_0x9840('0x0')]={'min_internal':{'type':Sequelize[_0x9840('0x1')](0xb),'unique':_0x9840('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x9840('0x1')](0xb),'unique':_0x9840('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x9840('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x9840('0x4')],'defaultValue':_0x9840('0x5')},'logo':{'type':Sequelize[_0x9840('0x4')]},'defaultLogo':{'type':Sequelize[_0x9840('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x9840('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x9840('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x9840('0x4')]},'turnaddr':{'type':Sequelize[_0x9840('0x4')]},'turnusername':{'type':Sequelize[_0x9840('0x4')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x9840('0x4')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x9840('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x9840('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x9840('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x9840('0x4')],'defaultValue':_0x9840('0x7')},'enableEmailPreview':{'type':Sequelize[_0x9840('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x9840('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x9840('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x9840('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x9840('0x4')],'defaultValue':_0x9840('0x8')},'chatTimeout':{'type':Sequelize[_0x9840('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x9840('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x9840('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x9840('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x9840('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x9840('0x4')]},'defaultFavicon':{'type':Sequelize[_0x9840('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x9840('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x9840('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x9840('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x9840('0x4')]},'sentiment':{'type':Sequelize[_0x9840('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x9840('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x9840('0x1')]},'sentimentRegion':{'type':Sequelize[_0x9840('0x4')]},'language':{'type':Sequelize[_0x9840('0x4')]},'bucket':{'type':Sequelize[_0x9840('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x9840('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x9840('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x9840('0x1')](0x2)[_0x9840('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x9840('0x1')](0x2)[_0x9840('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)[_0x9840('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x9840('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x9840('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x9840('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x9840('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x9840('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x9840('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x9840('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x9840('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x9840('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x9840('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x2b86=['INTEGER','min_internal','/var/opt/motion2/server/files/sounds/converted','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2b86,0x16f));var _0x62b8=function(_0x555266,_0x760c98){_0x555266=_0x555266-0x0;var _0x41ddcb=_0x2b86[_0x555266];return _0x41ddcb;};'use strict';var Sequelize=require('sequelize');module[_0x62b8('0x0')]={'min_internal':{'type':Sequelize[_0x62b8('0x1')](0xb),'unique':_0x62b8('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x62b8('0x1')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x62b8('0x3')},'logo':{'type':Sequelize[_0x62b8('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x62b8('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x62b8('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x62b8('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x62b8('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x62b8('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x62b8('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x62b8('0x4')]},'turnaddr':{'type':Sequelize[_0x62b8('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0x62b8('0x4')]},'pageTitle':{'type':Sequelize[_0x62b8('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x62b8('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x62b8('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x62b8('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x62b8('0x6')},'enableEmailPreview':{'type':Sequelize[_0x62b8('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0x62b8('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x62b8('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x62b8('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x62b8('0x4')]},'defaultPreferred':{'type':Sequelize[_0x62b8('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x62b8('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x62b8('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x62b8('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x62b8('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x62b8('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x62b8('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x62b8('0x1')]},'transcribeRegion':{'type':Sequelize[_0x62b8('0x4')]},'sentiment':{'type':Sequelize[_0x62b8('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x62b8('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x62b8('0x1')]},'sentimentRegion':{'type':Sequelize[_0x62b8('0x4')]},'language':{'type':Sequelize[_0x62b8('0x4')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x62b8('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x62b8('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x62b8('0x1')](0x2)[_0x62b8('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)[_0x62b8('0x7')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x62b8('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0x62b8('0x7')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x62b8('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x62b8('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x62b8('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x62b8('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x62b8('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x62b8('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x62b8('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 8e20be0..807a299 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 _0x9b60=['download','gdpr','securePassword','addPreferred','default_preferred.png','addFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','json','offset','undefined','count','limit','apply','reject','update','end','stack','name','send','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','Setting','findAll','show','params','keys','rawAttributes','include','find','body','file','filename','loginLogo','server/files/images/logos','getLicense','logo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','existsSync','join','toLower','root','default','default_logo.svg','Sequelize','ValidationError','upperFirst','getLogoLogin','defaultPreferred','custom','default_loginLogo.svg','\x20not\x20found'];(function(_0x5bb3ef,_0x1269f6){var _0x1c1c17=function(_0xaf3ecb){while(--_0xaf3ecb){_0x5bb3ef['push'](_0x5bb3ef['shift']());}};_0x1c1c17(++_0x1269f6);}(_0x9b60,0x174));var _0x09b6=function(_0x538f9f,_0x31210d){_0x538f9f=_0x538f9f-0x0;var _0x4c9ff9=_0x9b60[_0x538f9f];return _0x4c9ff9;};'use strict';var emlformat=require(_0x09b6('0x0'));var rimraf=require(_0x09b6('0x1'));var zipdir=require(_0x09b6('0x2'));var jsonpatch=require(_0x09b6('0x3'));var rp=require(_0x09b6('0x4'));var moment=require(_0x09b6('0x5'));var BPromise=require(_0x09b6('0x6'));var Mustache=require(_0x09b6('0x7'));var util=require('util');var path=require('path');var sox=require(_0x09b6('0x8'));var csv=require(_0x09b6('0x9'));var ejs=require(_0x09b6('0xa'));var fs=require('fs');var fs_extra=require(_0x09b6('0xb'));var _=require(_0x09b6('0xc'));var squel=require(_0x09b6('0xd'));var crypto=require(_0x09b6('0xe'));var jsforce=require(_0x09b6('0xf'));var deskjs=require(_0x09b6('0x10'));var toCsv=require(_0x09b6('0x9'));var querystring=require(_0x09b6('0x11'));var Papa=require(_0x09b6('0x12'));var Redis=require(_0x09b6('0x13'));var authService=require(_0x09b6('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x09b6('0x15'));var hardwareService=require(_0x09b6('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x09b6('0x17'));var config=require(_0x09b6('0x18'));var licenseUtil=require(_0x09b6('0x19'));var db=require(_0x09b6('0x1a'))['db'];var jayson=require(_0x09b6('0x1b'));var client=jayson['client'][_0x09b6('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2ac1a0,_0x25e3b6,_0x4b7352,_0x53d356){return new BPromise(function(_0x51a10f,_0xf630f2){var _0x3818d5=_0x53d356||client;return _0x3818d5[_0x09b6('0x1d')](_0x2ac1a0,_0x4b7352)[_0x09b6('0x1e')](function(_0x785343){logger['info'](_0x09b6('0x1f'),_0x25e3b6,_0x09b6('0x20'));logger[_0x09b6('0x21')](_0x09b6('0x22'),_0x25e3b6,_0x09b6('0x20'),JSON['stringify'](_0x785343));if(_0x785343[_0x09b6('0x23')]){if(_0x785343[_0x09b6('0x23')][_0x09b6('0x24')]===0x1f4){logger[_0x09b6('0x23')](_0x09b6('0x1f'),_0x25e3b6,_0x785343['error'][_0x09b6('0x25')]);return _0xf630f2(_0x785343[_0x09b6('0x23')][_0x09b6('0x25')]);}logger[_0x09b6('0x23')](_0x09b6('0x1f'),_0x25e3b6,_0x785343[_0x09b6('0x23')]['message']);return _0x51a10f(_0x785343[_0x09b6('0x23')]['message']);}else{logger[_0x09b6('0x26')](_0x09b6('0x1f'),_0x25e3b6,'request\x20sent');_0x51a10f(_0x785343[_0x09b6('0x27')]['message']);}})[_0x09b6('0x28')](function(_0x700746){logger[_0x09b6('0x23')](_0x09b6('0x1f'),_0x25e3b6,_0x700746);_0xf630f2(_0x700746);});});}function respondWithStatusCode(_0x2f3d61,_0x557cdf){_0x557cdf=_0x557cdf||0xcc;return function(_0x430ec0){if(_0x430ec0){return _0x2f3d61[_0x09b6('0x29')](_0x557cdf);}return _0x2f3d61[_0x09b6('0x2a')](_0x557cdf)['end']();};}function respondWithResult(_0x31226c,_0xb2747f){_0xb2747f=_0xb2747f||0xc8;return function(_0x11d52c){if(_0x11d52c){return _0x31226c[_0x09b6('0x2a')](_0xb2747f)[_0x09b6('0x2b')](_0x11d52c);}};}function respondWithFilteredResult(_0x2bff9f,_0x22474e){return function(_0x348cdb){if(_0x348cdb){var _0x578d73=typeof _0x22474e[_0x09b6('0x2c')]==='undefined'&&typeof _0x22474e['limit']===_0x09b6('0x2d');var _0xd35847=_0x348cdb[_0x09b6('0x2e')];var _0x1c558f=_0x578d73?0x0:_0x22474e[_0x09b6('0x2c')];var _0x28aa08=_0x578d73?_0x348cdb[_0x09b6('0x2e')]:_0x22474e['offset']+_0x22474e[_0x09b6('0x2f')];var _0x3e9fba;if(_0x28aa08>=_0xd35847){_0x28aa08=_0xd35847;_0x3e9fba=0xc8;}else{_0x3e9fba=0xce;}_0x2bff9f[_0x09b6('0x2a')](_0x3e9fba);return _0x2bff9f['set']('Content-Range',_0x1c558f+'-'+_0x28aa08+'/'+_0xd35847)[_0x09b6('0x2b')](_0x348cdb);}return null;};}function patchUpdates(_0x2d9ec4){return function(_0x1bc3b5){try{jsonpatch[_0x09b6('0x30')](_0x1bc3b5,_0x2d9ec4,!![]);}catch(_0x11309b){return BPromise[_0x09b6('0x31')](_0x11309b);}return _0x1bc3b5['save']();};}function saveUpdates(_0x38847f,_0x262c3d){return function(_0x457be7){if(_0x457be7){return _0x457be7[_0x09b6('0x32')](_0x38847f)[_0x09b6('0x1e')](function(_0x2c6465){return _0x2c6465;});}return null;};}function removeEntity(_0x19b9c9,_0x58e4a6){return function(_0x1d8fcf){if(_0x1d8fcf){return _0x1d8fcf['destroy']()[_0x09b6('0x1e')](function(){_0x19b9c9['status'](0xcc)[_0x09b6('0x33')]();});}};}function handleEntityNotFound(_0x33f68c,_0x282efa){return function(_0x4a2e83){if(!_0x4a2e83){_0x33f68c[_0x09b6('0x29')](0x194);}return _0x4a2e83;};}function handleError(_0x1eefa0,_0x72d38b){_0x72d38b=_0x72d38b||0x1f4;return function(_0x4a95d3){logger['error'](_0x4a95d3[_0x09b6('0x34')]);if(_0x4a95d3[_0x09b6('0x35')]){delete _0x4a95d3[_0x09b6('0x35')];}_0x1eefa0[_0x09b6('0x2a')](_0x72d38b)[_0x09b6('0x36')](_0x4a95d3);};}exports['index']=function(_0x40e7cb,_0x1ff6d7){var _0x4d5396={},_0x459e5c={},_0xabccd1={'count':0x0,'rows':[]};var _0x1df249=_['map'](db['Setting']['rawAttributes'],function(_0x15a70){return{'name':_0x15a70[_0x09b6('0x37')],'type':_0x15a70[_0x09b6('0x38')][_0x09b6('0x39')]};});_0x459e5c[_0x09b6('0x3a')]=_['map'](_0x1df249,_0x09b6('0x35'));_0x459e5c[_0x09b6('0x3b')]=_['keys'](_0x40e7cb['query']);_0x459e5c[_0x09b6('0x3c')]=_[_0x09b6('0x3d')](_0x459e5c['model'],_0x459e5c[_0x09b6('0x3b')]);_0x4d5396[_0x09b6('0x3e')]=_['intersection'](_0x459e5c[_0x09b6('0x3a')],qs[_0x09b6('0x3f')](_0x40e7cb['query'][_0x09b6('0x3f')]));_0x4d5396[_0x09b6('0x3e')]=_0x4d5396['attributes'][_0x09b6('0x40')]?_0x4d5396[_0x09b6('0x3e')]:_0x459e5c['model'];if(!_0x40e7cb[_0x09b6('0x3b')][_0x09b6('0x41')](_0x09b6('0x42'))){_0x4d5396[_0x09b6('0x2f')]=qs['limit'](_0x40e7cb['query'][_0x09b6('0x2f')]);_0x4d5396[_0x09b6('0x2c')]=qs['offset'](_0x40e7cb[_0x09b6('0x3b')]['offset']);}_0x4d5396[_0x09b6('0x43')]=qs[_0x09b6('0x44')](_0x40e7cb[_0x09b6('0x3b')][_0x09b6('0x44')]);_0x4d5396[_0x09b6('0x45')]=qs[_0x09b6('0x3c')](_[_0x09b6('0x46')](_0x40e7cb[_0x09b6('0x3b')],_0x459e5c[_0x09b6('0x3c')]),_0x1df249);if(_0x40e7cb[_0x09b6('0x3b')][_0x09b6('0x47')]){_0x4d5396[_0x09b6('0x45')]=_[_0x09b6('0x48')](_0x4d5396[_0x09b6('0x45')],{'$or':_['map'](_0x1df249,function(_0xc3affc){if(_0xc3affc[_0x09b6('0x38')]!=='VIRTUAL'){var _0x5e417e={};_0x5e417e[_0xc3affc['name']]={'$like':'%'+_0x40e7cb['query'][_0x09b6('0x47')]+'%'};return _0x5e417e;}})});}_0x4d5396=_['merge']({},_0x4d5396,_0x40e7cb[_0x09b6('0x49')]);var _0xbb41fc={'where':_0x4d5396[_0x09b6('0x45')]};return db[_0x09b6('0x4a')][_0x09b6('0x2e')](_0xbb41fc)[_0x09b6('0x1e')](function(_0x5a834e){_0xabccd1['count']=_0x5a834e;if(_0x40e7cb['query']['includeAll']){_0x4d5396['include']=[{'all':!![]}];}return db['Setting'][_0x09b6('0x4b')](_0x4d5396);})[_0x09b6('0x1e')](function(_0x3fff30){_0xabccd1['rows']=_0x3fff30;return _0xabccd1;})[_0x09b6('0x1e')](respondWithFilteredResult(_0x1ff6d7,_0x4d5396))[_0x09b6('0x28')](handleError(_0x1ff6d7,null));};exports[_0x09b6('0x4c')]=function(_0x16b945,_0x47783b){var _0x9c2249={'raw':![],'where':{'id':_0x16b945[_0x09b6('0x4d')]['id']}},_0x5a3f68={};_0x5a3f68[_0x09b6('0x3a')]=_[_0x09b6('0x4e')](db[_0x09b6('0x4a')][_0x09b6('0x4f')]);_0x5a3f68[_0x09b6('0x3b')]=_['keys'](_0x16b945[_0x09b6('0x3b')]);_0x5a3f68[_0x09b6('0x3c')]=_[_0x09b6('0x3d')](_0x5a3f68[_0x09b6('0x3a')],_0x5a3f68[_0x09b6('0x3b')]);_0x9c2249[_0x09b6('0x3e')]=_[_0x09b6('0x3d')](_0x5a3f68['model'],qs[_0x09b6('0x3f')](_0x16b945['query'][_0x09b6('0x3f')]));_0x9c2249['attributes']=_0x9c2249[_0x09b6('0x3e')][_0x09b6('0x40')]?_0x9c2249['attributes']:_0x5a3f68['model'];if(_0x16b945[_0x09b6('0x3b')]['includeAll']){_0x9c2249[_0x09b6('0x50')]=[{'all':!![]}];}_0x9c2249=_['merge']({},_0x9c2249,_0x16b945[_0x09b6('0x49')]);return db['Setting'][_0x09b6('0x51')](_0x9c2249)[_0x09b6('0x1e')](handleEntityNotFound(_0x47783b,null))[_0x09b6('0x1e')](respondWithResult(_0x47783b,null))[_0x09b6('0x28')](handleError(_0x47783b,null));};exports[_0x09b6('0x32')]=function(_0x54020c,_0x55cdc8){if(_0x54020c[_0x09b6('0x52')]['id']){delete _0x54020c[_0x09b6('0x52')]['id'];}return db[_0x09b6('0x4a')][_0x09b6('0x51')]({'where':{'id':_0x54020c['params']['id']}})[_0x09b6('0x1e')](handleEntityNotFound(_0x55cdc8,null))[_0x09b6('0x1e')](saveUpdates(_0x54020c[_0x09b6('0x52')],null))[_0x09b6('0x1e')](respondWithResult(_0x55cdc8,null))[_0x09b6('0x28')](handleError(_0x55cdc8,null));};exports['addLogo']=function(_0x16d261,_0x483595,_0x4aae12){if(_0x16d261[_0x09b6('0x53')]&&_0x16d261[_0x09b6('0x53')]['filename']){_0x16d261[_0x09b6('0x52')]['logo']=_0x16d261[_0x09b6('0x53')][_0x09b6('0x54')];}return db[_0x09b6('0x4a')][_0x09b6('0x51')]({'where':{'id':_0x16d261['params']['id']}})[_0x09b6('0x1e')](handleEntityNotFound(_0x483595,null))[_0x09b6('0x1e')](saveUpdates(_0x16d261[_0x09b6('0x52')],null))['then'](respondWithResult(_0x483595,null))[_0x09b6('0x28')](handleError(_0x483595,null));};exports['addLogoLogin']=function(_0x3c308a,_0x149b47,_0x19eaf7){if(_0x3c308a['file']&&_0x3c308a[_0x09b6('0x53')][_0x09b6('0x54')]){_0x3c308a[_0x09b6('0x52')][_0x09b6('0x55')]=_0x3c308a[_0x09b6('0x53')]['filename'];}return db['Setting'][_0x09b6('0x51')]({'where':{'id':_0x3c308a[_0x09b6('0x4d')]['id']}})['then'](handleEntityNotFound(_0x149b47,null))[_0x09b6('0x1e')](saveUpdates(_0x3c308a['body'],null))[_0x09b6('0x1e')](respondWithResult(_0x149b47,null))[_0x09b6('0x28')](handleError(_0x149b47,null));};var utilLicense=require(_0x09b6('0x19'));exports['getLogo']=function(_0x254bf1,_0x37514f,_0x1bec8a){var _0x31b79e=_0x09b6('0x56');var _0x434434={'custom':![]};return utilLicense[_0x09b6('0x57')]()[_0x09b6('0x1e')](function(_0x5a2509){if(_0x5a2509){_0x434434=_0x5a2509;}return db[_0x09b6('0x4a')]['find']({'where':{'id':_0x254bf1[_0x09b6('0x4d')]['id']},'attributes':[_0x09b6('0x58'),_0x09b6('0x55'),_0x09b6('0x59'),_0x09b6('0x5a'),_0x09b6('0x5b'),_0x09b6('0x5c'),'defaultPreferred',_0x09b6('0x5d')],'raw':!![]});})[_0x09b6('0x1e')](handleEntityNotFound(_0x37514f,null))[_0x09b6('0x1e')](function(_0x33009a){if(_0x33009a){var _0x1d98e5=_0x33009a[_0x09b6('0x58')]&&fs[_0x09b6('0x5e')](path[_0x09b6('0x5f')](config['root'],_0x31b79e,_[_0x09b6('0x60')](_0x33009a[_0x09b6('0x58')])))?path[_0x09b6('0x5f')](config[_0x09b6('0x61')],_0x31b79e,_[_0x09b6('0x60')](_0x33009a[_0x09b6('0x58')])):path['join'](config['root'],_0x31b79e,_[_0x09b6('0x60')]('default_logo.svg'));var _0x1671ea=_0x09b6('0x62')+_['upperFirst']('logo');if(_0x33009a[_0x1671ea]||!_0x434434['custom']){_0x1d98e5=path['join'](config['root'],_0x31b79e,_[_0x09b6('0x60')](_0x09b6('0x63')));}if(!fs[_0x09b6('0x5e')](_0x1d98e5)){throw new db[(_0x09b6('0x64'))][(_0x09b6('0x65'))](_[_0x09b6('0x66')]('logo')+'\x20not\x20found');}return _0x37514f['download'](_0x1d98e5);}})[_0x09b6('0x28')](handleError(_0x37514f,null));};var utilLicense=require('../../config/license/util');exports[_0x09b6('0x67')]=function(_0x3ba18f,_0x4ea827,_0x50303e){var _0xe4e31f=_0x09b6('0x56');var _0x569c7b={'custom':![]};return utilLicense[_0x09b6('0x57')]()[_0x09b6('0x1e')](function(_0x26423e){if(_0x26423e){_0x569c7b=_0x26423e;}return db['Setting']['find']({'where':{'id':_0x3ba18f[_0x09b6('0x4d')]['id']},'attributes':[_0x09b6('0x58'),'loginLogo',_0x09b6('0x59'),_0x09b6('0x5a'),_0x09b6('0x5b'),_0x09b6('0x5c'),_0x09b6('0x68'),'defaultFavicon'],'raw':!![]});})[_0x09b6('0x1e')](handleEntityNotFound(_0x4ea827,null))[_0x09b6('0x1e')](function(_0x3fc4d8){if(_0x3fc4d8){var _0x3d9aae=_0x3fc4d8[_0x09b6('0x55')]&&fs[_0x09b6('0x5e')](path[_0x09b6('0x5f')](config[_0x09b6('0x61')],_0xe4e31f,_[_0x09b6('0x60')](_0x3fc4d8[_0x09b6('0x55')])))?path[_0x09b6('0x5f')](config['root'],_0xe4e31f,_[_0x09b6('0x60')](_0x3fc4d8['loginLogo'])):path[_0x09b6('0x5f')](config[_0x09b6('0x61')],_0xe4e31f,_[_0x09b6('0x60')]('default_loginLogo.svg'));var _0x32e5da=_0x09b6('0x62')+_[_0x09b6('0x66')](_0x09b6('0x55'));if(_0x3fc4d8[_0x32e5da]||!_0x569c7b[_0x09b6('0x69')]){_0x3d9aae=path[_0x09b6('0x5f')](config[_0x09b6('0x61')],_0xe4e31f,_[_0x09b6('0x60')](_0x09b6('0x6a')));}if(!fs[_0x09b6('0x5e')](_0x3d9aae)){throw new db[(_0x09b6('0x64'))][(_0x09b6('0x65'))](_[_0x09b6('0x66')](_0x09b6('0x55'))+_0x09b6('0x6b'));}return _0x4ea827[_0x09b6('0x6c')](_0x3d9aae);}})['catch'](handleError(_0x4ea827,null));};exports[_0x09b6('0x6d')]=function(_0x4f9338,_0x583c59){return db[_0x09b6('0x4a')][_0x09b6('0x51')]({'where':{'id':_0x4f9338['params']['id']},'attributes':[_0x09b6('0x6e')]})[_0x09b6('0x1e')](respondWithResult(_0x583c59,null))[_0x09b6('0x28')](handleError(_0x583c59,null));};exports[_0x09b6('0x6f')]=function(_0x2b0bb8,_0x36d21b,_0x3be17a){if(_0x2b0bb8[_0x09b6('0x53')]&&_0x2b0bb8[_0x09b6('0x53')][_0x09b6('0x54')]){_0x2b0bb8[_0x09b6('0x52')][_0x09b6('0x59')]=_0x2b0bb8[_0x09b6('0x53')]['filename'];}return db[_0x09b6('0x4a')][_0x09b6('0x51')]({'where':{'id':_0x2b0bb8['params']['id']}})['then'](handleEntityNotFound(_0x36d21b,null))[_0x09b6('0x1e')](saveUpdates(_0x2b0bb8[_0x09b6('0x52')],null))['then'](respondWithResult(_0x36d21b,null))['catch'](handleError(_0x36d21b,null));};var utilLicense=require('../../config/license/util');exports['getPreferred']=function(_0x2b5dd3,_0x11560f,_0x275045){var _0x458fc6=_0x09b6('0x56');var _0x30b0ff={'custom':![]};return utilLicense[_0x09b6('0x57')]()[_0x09b6('0x1e')](function(_0x3c4cb4){if(_0x3c4cb4){_0x30b0ff=_0x3c4cb4;}return db[_0x09b6('0x4a')]['find']({'where':{'id':_0x2b5dd3['params']['id']},'attributes':['logo','loginLogo',_0x09b6('0x59'),'favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x09b6('0x1e')](handleEntityNotFound(_0x11560f,null))['then'](function(_0xe0a911){if(_0xe0a911){var _0x6037fa=_0xe0a911[_0x09b6('0x59')]&&fs['existsSync'](path['join'](config[_0x09b6('0x61')],_0x458fc6,_[_0x09b6('0x60')](_0xe0a911[_0x09b6('0x59')])))?path['join'](config['root'],_0x458fc6,_[_0x09b6('0x60')](_0xe0a911[_0x09b6('0x59')])):path[_0x09b6('0x5f')](config['root'],_0x458fc6,_['toLower'](_0x09b6('0x70')));var _0x2709b9=_0x09b6('0x62')+_[_0x09b6('0x66')]('preferred');if(_0xe0a911[_0x2709b9]||!_0x30b0ff['custom']||!_0x30b0ff[_0x09b6('0x59')]){_0x6037fa=path[_0x09b6('0x5f')](config['root'],_0x458fc6,_[_0x09b6('0x60')]('default_preferred.png'));}if(!fs[_0x09b6('0x5e')](_0x6037fa)){throw new db[(_0x09b6('0x64'))][(_0x09b6('0x65'))](_['upperFirst'](_0x09b6('0x59'))+_0x09b6('0x6b'));}return _0x11560f[_0x09b6('0x6c')](_0x6037fa);}})['catch'](handleError(_0x11560f,null));};exports[_0x09b6('0x71')]=function(_0x2b8dab,_0x5f5403,_0x5d6714){if(_0x2b8dab[_0x09b6('0x53')]&&_0x2b8dab[_0x09b6('0x53')]['filename']){_0x2b8dab[_0x09b6('0x52')][_0x09b6('0x5a')]=_0x2b8dab[_0x09b6('0x53')][_0x09b6('0x54')];}return db['Setting'][_0x09b6('0x51')]({'where':{'id':_0x2b8dab[_0x09b6('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5f5403,null))['then'](saveUpdates(_0x2b8dab[_0x09b6('0x52')],null))['then'](respondWithResult(_0x5f5403,null))[_0x09b6('0x28')](handleError(_0x5f5403,null));};var utilLicense=require(_0x09b6('0x19'));exports['getFavicon']=function(_0x17e281,_0x3a1c69,_0x3dfd8b){var _0x5db262=_0x09b6('0x56');var _0x42e016={'custom':![]};return utilLicense[_0x09b6('0x57')]()[_0x09b6('0x1e')](function(_0x58a18f){if(_0x58a18f){_0x42e016=_0x58a18f;}return db[_0x09b6('0x4a')][_0x09b6('0x51')]({'where':{'id':_0x17e281['params']['id']},'attributes':['logo',_0x09b6('0x55'),_0x09b6('0x59'),_0x09b6('0x5a'),'defaultLogo',_0x09b6('0x5c'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x09b6('0x1e')](handleEntityNotFound(_0x3a1c69,null))[_0x09b6('0x1e')](function(_0x208131){if(_0x208131){var _0x2825bc=_0x208131[_0x09b6('0x5a')]&&fs[_0x09b6('0x5e')](path['join'](config[_0x09b6('0x61')],_0x5db262,_[_0x09b6('0x60')](_0x208131[_0x09b6('0x5a')])))?path[_0x09b6('0x5f')](config['root'],_0x5db262,_[_0x09b6('0x60')](_0x208131[_0x09b6('0x5a')])):path[_0x09b6('0x5f')](config[_0x09b6('0x61')],_0x5db262,_['toLower'](_0x09b6('0x72')));var _0x2029dd='default'+_[_0x09b6('0x66')](_0x09b6('0x5a'));if(_0x208131[_0x2029dd]||!_0x42e016[_0x09b6('0x69')]){_0x2825bc=path[_0x09b6('0x5f')](config[_0x09b6('0x61')],_0x5db262,_[_0x09b6('0x60')](_0x09b6('0x72')));}if(!fs[_0x09b6('0x5e')](_0x2825bc)){throw new db[(_0x09b6('0x64'))]['ValidationError'](_[_0x09b6('0x66')]('favicon')+_0x09b6('0x6b'));}return _0x3a1c69[_0x09b6('0x6c')](_0x2825bc);}})[_0x09b6('0x28')](handleError(_0x3a1c69,null));};exports[_0x09b6('0x73')]=function(_0x4ed8ea,_0x39da49){var _0x462346={'offset':moment()[_0x09b6('0x74')]()};_0x462346[_0x09b6('0x75')]=moment()[_0x09b6('0x74')](_0x462346['offset'])[_0x09b6('0x76')](_0x09b6('0x77'));return _0x39da49[_0x09b6('0x2a')](0xc8)['send'](_0x462346);}; \ No newline at end of file +var _0x2fbc=['join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','download','default_loginLogo.svg','ValidationError','\x20not\x20found','gdpr','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','then','Setting,\x20%s,\x20%s','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','stack','name','index','map','Setting','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','length','find','catch','update','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync'];(function(_0x5227dd,_0x22b0b9){var _0x59a68b=function(_0x58aa8a){while(--_0x58aa8a){_0x5227dd['push'](_0x5227dd['shift']());}};_0x59a68b(++_0x22b0b9);}(_0x2fbc,0x106));var _0xc2fb=function(_0x120d30,_0x1d577c){_0x120d30=_0x120d30-0x0;var _0x39d979=_0x2fbc[_0x120d30];return _0x39d979;};'use strict';var emlformat=require(_0xc2fb('0x0'));var rimraf=require(_0xc2fb('0x1'));var zipdir=require(_0xc2fb('0x2'));var jsonpatch=require(_0xc2fb('0x3'));var rp=require(_0xc2fb('0x4'));var moment=require(_0xc2fb('0x5'));var BPromise=require(_0xc2fb('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc2fb('0x7'));var sox=require(_0xc2fb('0x8'));var csv=require('to-csv');var ejs=require(_0xc2fb('0x9'));var fs=require('fs');var fs_extra=require(_0xc2fb('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc2fb('0xb'));var jsforce=require(_0xc2fb('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc2fb('0xd'));var querystring=require(_0xc2fb('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc2fb('0xf'));var hardwareService=require(_0xc2fb('0x10'));var logger=require(_0xc2fb('0x11'))(_0xc2fb('0x12'));var utils=require('../../config/utils');var config=require(_0xc2fb('0x13'));var licenseUtil=require(_0xc2fb('0x14'));var db=require(_0xc2fb('0x15'))['db'];var jayson=require(_0xc2fb('0x16'));var client=jayson['client'][_0xc2fb('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x4e4487,_0x1bbd15,_0x557490,_0x2d0ca4){return new BPromise(function(_0xe6addf,_0x4c6d81){var _0x142ba0=_0x2d0ca4||client;return _0x142ba0['request'](_0x4e4487,_0x557490)[_0xc2fb('0x18')](function(_0x3a2273){logger['info'](_0xc2fb('0x19'),_0x1bbd15,'request\x20sent');logger['debug'](_0xc2fb('0x1a'),_0x1bbd15,_0xc2fb('0x1b'),JSON[_0xc2fb('0x1c')](_0x3a2273));if(_0x3a2273[_0xc2fb('0x1d')]){if(_0x3a2273['error']['code']===0x1f4){logger[_0xc2fb('0x1d')]('Setting,\x20%s,\x20%s',_0x1bbd15,_0x3a2273[_0xc2fb('0x1d')][_0xc2fb('0x1e')]);return _0x4c6d81(_0x3a2273[_0xc2fb('0x1d')][_0xc2fb('0x1e')]);}logger[_0xc2fb('0x1d')](_0xc2fb('0x19'),_0x1bbd15,_0x3a2273[_0xc2fb('0x1d')][_0xc2fb('0x1e')]);return _0xe6addf(_0x3a2273['error'][_0xc2fb('0x1e')]);}else{logger[_0xc2fb('0x1f')](_0xc2fb('0x19'),_0x1bbd15,_0xc2fb('0x1b'));_0xe6addf(_0x3a2273[_0xc2fb('0x20')][_0xc2fb('0x1e')]);}})['catch'](function(_0x3d2b61){logger['error'](_0xc2fb('0x19'),_0x1bbd15,_0x3d2b61);_0x4c6d81(_0x3d2b61);});});}function respondWithStatusCode(_0x21d81e,_0x5ef9fd){_0x5ef9fd=_0x5ef9fd||0xcc;return function(_0x5e5c82){if(_0x5e5c82){return _0x21d81e[_0xc2fb('0x21')](_0x5ef9fd);}return _0x21d81e['status'](_0x5ef9fd)[_0xc2fb('0x22')]();};}function respondWithResult(_0x2fc618,_0x3ae918){_0x3ae918=_0x3ae918||0xc8;return function(_0x537660){if(_0x537660){return _0x2fc618[_0xc2fb('0x23')](_0x3ae918)[_0xc2fb('0x24')](_0x537660);}};}function respondWithFilteredResult(_0xe3d52e,_0xf0ae2f){return function(_0x1a5c5b){if(_0x1a5c5b){var _0x57ba14=typeof _0xf0ae2f[_0xc2fb('0x25')]===_0xc2fb('0x26')&&typeof _0xf0ae2f[_0xc2fb('0x27')]===_0xc2fb('0x26');var _0x3d0ab2=_0x1a5c5b[_0xc2fb('0x28')];var _0xdf46e8=_0x57ba14?0x0:_0xf0ae2f[_0xc2fb('0x25')];var _0x31bc4d=_0x57ba14?_0x1a5c5b[_0xc2fb('0x28')]:_0xf0ae2f[_0xc2fb('0x25')]+_0xf0ae2f[_0xc2fb('0x27')];var _0x335a3d;if(_0x31bc4d>=_0x3d0ab2){_0x31bc4d=_0x3d0ab2;_0x335a3d=0xc8;}else{_0x335a3d=0xce;}_0xe3d52e['status'](_0x335a3d);return _0xe3d52e[_0xc2fb('0x29')](_0xc2fb('0x2a'),_0xdf46e8+'-'+_0x31bc4d+'/'+_0x3d0ab2)[_0xc2fb('0x24')](_0x1a5c5b);}return null;};}function patchUpdates(_0x2d9f03){return function(_0x3f2f10){try{jsonpatch[_0xc2fb('0x2b')](_0x3f2f10,_0x2d9f03,!![]);}catch(_0x3a9b3a){return BPromise[_0xc2fb('0x2c')](_0x3a9b3a);}return _0x3f2f10[_0xc2fb('0x2d')]();};}function saveUpdates(_0x13e3ed,_0x4746e7){return function(_0x50d947){if(_0x50d947){return _0x50d947['update'](_0x13e3ed)[_0xc2fb('0x18')](function(_0x1357e9){return _0x1357e9;});}return null;};}function removeEntity(_0x4145f4,_0x2e786d){return function(_0x20e9f3){if(_0x20e9f3){return _0x20e9f3[_0xc2fb('0x2e')]()[_0xc2fb('0x18')](function(){_0x4145f4['status'](0xcc)[_0xc2fb('0x22')]();});}};}function handleEntityNotFound(_0x5c0bca,_0x5d0b31){return function(_0x26f88a){if(!_0x26f88a){_0x5c0bca[_0xc2fb('0x21')](0x194);}return _0x26f88a;};}function handleError(_0x3e59d3,_0x41a796){_0x41a796=_0x41a796||0x1f4;return function(_0x24c2f5){logger[_0xc2fb('0x1d')](_0x24c2f5[_0xc2fb('0x2f')]);if(_0x24c2f5['name']){delete _0x24c2f5[_0xc2fb('0x30')];}_0x3e59d3[_0xc2fb('0x23')](_0x41a796)['send'](_0x24c2f5);};}exports[_0xc2fb('0x31')]=function(_0x3a5732,_0x2cb499){var _0x4310e9={},_0x2c941a={},_0x22991b={'count':0x0,'rows':[]};var _0x5753f0=_[_0xc2fb('0x32')](db[_0xc2fb('0x33')][_0xc2fb('0x34')],function(_0x588564){return{'name':_0x588564[_0xc2fb('0x35')],'type':_0x588564[_0xc2fb('0x36')][_0xc2fb('0x37')]};});_0x2c941a['model']=_[_0xc2fb('0x32')](_0x5753f0,_0xc2fb('0x30'));_0x2c941a[_0xc2fb('0x38')]=_['keys'](_0x3a5732[_0xc2fb('0x38')]);_0x2c941a['filters']=_[_0xc2fb('0x39')](_0x2c941a[_0xc2fb('0x3a')],_0x2c941a['query']);_0x4310e9['attributes']=_[_0xc2fb('0x39')](_0x2c941a[_0xc2fb('0x3a')],qs[_0xc2fb('0x3b')](_0x3a5732['query'][_0xc2fb('0x3b')]));_0x4310e9[_0xc2fb('0x3c')]=_0x4310e9[_0xc2fb('0x3c')]['length']?_0x4310e9[_0xc2fb('0x3c')]:_0x2c941a[_0xc2fb('0x3a')];if(!_0x3a5732[_0xc2fb('0x38')]['hasOwnProperty'](_0xc2fb('0x3d'))){_0x4310e9['limit']=qs[_0xc2fb('0x27')](_0x3a5732['query'][_0xc2fb('0x27')]);_0x4310e9['offset']=qs['offset'](_0x3a5732[_0xc2fb('0x38')]['offset']);}_0x4310e9[_0xc2fb('0x3e')]=qs[_0xc2fb('0x3f')](_0x3a5732[_0xc2fb('0x38')][_0xc2fb('0x3f')]);_0x4310e9[_0xc2fb('0x40')]=qs['filters'](_[_0xc2fb('0x41')](_0x3a5732[_0xc2fb('0x38')],_0x2c941a[_0xc2fb('0x42')]),_0x5753f0);if(_0x3a5732[_0xc2fb('0x38')][_0xc2fb('0x43')]){_0x4310e9[_0xc2fb('0x40')]=_[_0xc2fb('0x44')](_0x4310e9[_0xc2fb('0x40')],{'$or':_[_0xc2fb('0x32')](_0x5753f0,function(_0x1d872d){if(_0x1d872d[_0xc2fb('0x36')]!==_0xc2fb('0x45')){var _0x217152={};_0x217152[_0x1d872d[_0xc2fb('0x30')]]={'$like':'%'+_0x3a5732[_0xc2fb('0x38')][_0xc2fb('0x43')]+'%'};return _0x217152;}})});}_0x4310e9=_[_0xc2fb('0x44')]({},_0x4310e9,_0x3a5732[_0xc2fb('0x46')]);var _0x53b153={'where':_0x4310e9['where']};return db['Setting'][_0xc2fb('0x28')](_0x53b153)[_0xc2fb('0x18')](function(_0x3ce5e4){_0x22991b['count']=_0x3ce5e4;if(_0x3a5732[_0xc2fb('0x38')][_0xc2fb('0x47')]){_0x4310e9[_0xc2fb('0x48')]=[{'all':!![]}];}return db[_0xc2fb('0x33')][_0xc2fb('0x49')](_0x4310e9);})[_0xc2fb('0x18')](function(_0xc71f28){_0x22991b[_0xc2fb('0x4a')]=_0xc71f28;return _0x22991b;})['then'](respondWithFilteredResult(_0x2cb499,_0x4310e9))['catch'](handleError(_0x2cb499,null));};exports['show']=function(_0x2eb1ad,_0x129928){var _0x565008={'raw':![],'where':{'id':_0x2eb1ad[_0xc2fb('0x4b')]['id']}},_0x22ae2b={};_0x22ae2b['model']=_[_0xc2fb('0x4c')](db['Setting'][_0xc2fb('0x34')]);_0x22ae2b['query']=_[_0xc2fb('0x4c')](_0x2eb1ad[_0xc2fb('0x38')]);_0x22ae2b['filters']=_[_0xc2fb('0x39')](_0x22ae2b[_0xc2fb('0x3a')],_0x22ae2b[_0xc2fb('0x38')]);_0x565008['attributes']=_[_0xc2fb('0x39')](_0x22ae2b[_0xc2fb('0x3a')],qs[_0xc2fb('0x3b')](_0x2eb1ad[_0xc2fb('0x38')][_0xc2fb('0x3b')]));_0x565008['attributes']=_0x565008[_0xc2fb('0x3c')][_0xc2fb('0x4d')]?_0x565008['attributes']:_0x22ae2b[_0xc2fb('0x3a')];if(_0x2eb1ad[_0xc2fb('0x38')][_0xc2fb('0x47')]){_0x565008[_0xc2fb('0x48')]=[{'all':!![]}];}_0x565008=_['merge']({},_0x565008,_0x2eb1ad[_0xc2fb('0x46')]);return db[_0xc2fb('0x33')][_0xc2fb('0x4e')](_0x565008)['then'](handleEntityNotFound(_0x129928,null))[_0xc2fb('0x18')](respondWithResult(_0x129928,null))[_0xc2fb('0x4f')](handleError(_0x129928,null));};exports[_0xc2fb('0x50')]=function(_0x1b043a,_0x52c6f6){if(_0x1b043a[_0xc2fb('0x51')]['id']){delete _0x1b043a['body']['id'];}return db[_0xc2fb('0x33')]['find']({'where':{'id':_0x1b043a[_0xc2fb('0x4b')]['id']}})[_0xc2fb('0x18')](handleEntityNotFound(_0x52c6f6,null))[_0xc2fb('0x18')](saveUpdates(_0x1b043a[_0xc2fb('0x51')],null))[_0xc2fb('0x18')](respondWithResult(_0x52c6f6,null))['catch'](handleError(_0x52c6f6,null));};exports[_0xc2fb('0x52')]=function(_0x126ba7,_0x4398f1,_0x337fdf){if(_0x126ba7[_0xc2fb('0x53')]&&_0x126ba7[_0xc2fb('0x53')][_0xc2fb('0x54')]){_0x126ba7[_0xc2fb('0x51')][_0xc2fb('0x55')]=_0x126ba7[_0xc2fb('0x53')]['filename'];}return db['Setting']['find']({'where':{'id':_0x126ba7['params']['id']}})[_0xc2fb('0x18')](handleEntityNotFound(_0x4398f1,null))[_0xc2fb('0x18')](saveUpdates(_0x126ba7[_0xc2fb('0x51')],null))[_0xc2fb('0x18')](respondWithResult(_0x4398f1,null))[_0xc2fb('0x4f')](handleError(_0x4398f1,null));};exports[_0xc2fb('0x56')]=function(_0x13a480,_0x15e1fa,_0x406aa1){if(_0x13a480[_0xc2fb('0x53')]&&_0x13a480[_0xc2fb('0x53')]['filename']){_0x13a480[_0xc2fb('0x51')][_0xc2fb('0x57')]=_0x13a480['file'][_0xc2fb('0x54')];}return db[_0xc2fb('0x33')][_0xc2fb('0x4e')]({'where':{'id':_0x13a480[_0xc2fb('0x4b')]['id']}})[_0xc2fb('0x18')](handleEntityNotFound(_0x15e1fa,null))['then'](saveUpdates(_0x13a480[_0xc2fb('0x51')],null))[_0xc2fb('0x18')](respondWithResult(_0x15e1fa,null))[_0xc2fb('0x4f')](handleError(_0x15e1fa,null));};var utilLicense=require(_0xc2fb('0x14'));exports[_0xc2fb('0x58')]=function(_0x29cbed,_0x234375,_0x46f1a6){var _0xec8803=_0xc2fb('0x59');var _0x3db8c6={'custom':![]};return utilLicense[_0xc2fb('0x5a')]()[_0xc2fb('0x18')](function(_0x5763be){if(_0x5763be){_0x3db8c6=_0x5763be;}return db[_0xc2fb('0x33')][_0xc2fb('0x4e')]({'where':{'id':_0x29cbed['params']['id']},'attributes':[_0xc2fb('0x55'),_0xc2fb('0x57'),_0xc2fb('0x5b'),_0xc2fb('0x5c'),_0xc2fb('0x5d'),_0xc2fb('0x5e'),_0xc2fb('0x5f'),_0xc2fb('0x60')],'raw':!![]});})[_0xc2fb('0x18')](handleEntityNotFound(_0x234375,null))[_0xc2fb('0x18')](function(_0x706c0e){if(_0x706c0e){var _0x4da093=_0x706c0e[_0xc2fb('0x55')]&&fs[_0xc2fb('0x61')](path[_0xc2fb('0x62')](config[_0xc2fb('0x63')],_0xec8803,_['toLower'](_0x706c0e[_0xc2fb('0x55')])))?path[_0xc2fb('0x62')](config[_0xc2fb('0x63')],_0xec8803,_[_0xc2fb('0x64')](_0x706c0e['logo'])):path['join'](config[_0xc2fb('0x63')],_0xec8803,_[_0xc2fb('0x64')](_0xc2fb('0x65')));var _0x47b8a6=_0xc2fb('0x66')+_[_0xc2fb('0x67')](_0xc2fb('0x55'));if(_0x706c0e[_0x47b8a6]||!_0x3db8c6[_0xc2fb('0x68')]){_0x4da093=path['join'](config[_0xc2fb('0x63')],_0xec8803,_[_0xc2fb('0x64')](_0xc2fb('0x65')));}if(!fs[_0xc2fb('0x61')](_0x4da093)){throw new db[(_0xc2fb('0x69'))]['ValidationError'](_[_0xc2fb('0x67')]('logo')+'\x20not\x20found');}return _0x234375[_0xc2fb('0x6a')](_0x4da093);}})[_0xc2fb('0x4f')](handleError(_0x234375,null));};var utilLicense=require(_0xc2fb('0x14'));exports['getLogoLogin']=function(_0x2ba0d1,_0x385206,_0x40f944){var _0x5b5478='server/files/images/logos';var _0x5eb914={'custom':![]};return utilLicense[_0xc2fb('0x5a')]()[_0xc2fb('0x18')](function(_0x2a9945){if(_0x2a9945){_0x5eb914=_0x2a9945;}return db[_0xc2fb('0x33')][_0xc2fb('0x4e')]({'where':{'id':_0x2ba0d1[_0xc2fb('0x4b')]['id']},'attributes':[_0xc2fb('0x55'),'loginLogo',_0xc2fb('0x5b'),'favicon',_0xc2fb('0x5d'),_0xc2fb('0x5e'),_0xc2fb('0x5f'),_0xc2fb('0x60')],'raw':!![]});})[_0xc2fb('0x18')](handleEntityNotFound(_0x385206,null))[_0xc2fb('0x18')](function(_0x12a538){if(_0x12a538){var _0x22f892=_0x12a538[_0xc2fb('0x57')]&&fs[_0xc2fb('0x61')](path['join'](config[_0xc2fb('0x63')],_0x5b5478,_[_0xc2fb('0x64')](_0x12a538['loginLogo'])))?path[_0xc2fb('0x62')](config[_0xc2fb('0x63')],_0x5b5478,_[_0xc2fb('0x64')](_0x12a538[_0xc2fb('0x57')])):path[_0xc2fb('0x62')](config['root'],_0x5b5478,_[_0xc2fb('0x64')](_0xc2fb('0x6b')));var _0x20e4a8='default'+_['upperFirst'](_0xc2fb('0x57'));if(_0x12a538[_0x20e4a8]||!_0x5eb914[_0xc2fb('0x68')]){_0x22f892=path[_0xc2fb('0x62')](config['root'],_0x5b5478,_['toLower']('default_loginLogo.svg'));}if(!fs[_0xc2fb('0x61')](_0x22f892)){throw new db['Sequelize'][(_0xc2fb('0x6c'))](_['upperFirst'](_0xc2fb('0x57'))+_0xc2fb('0x6d'));}return _0x385206[_0xc2fb('0x6a')](_0x22f892);}})['catch'](handleError(_0x385206,null));};exports[_0xc2fb('0x6e')]=function(_0x35d272,_0x2761cd){return db['Setting']['find']({'where':{'id':_0x35d272[_0xc2fb('0x4b')]['id']},'attributes':['securePassword']})[_0xc2fb('0x18')](respondWithResult(_0x2761cd,null))[_0xc2fb('0x4f')](handleError(_0x2761cd,null));};exports['addPreferred']=function(_0x25df44,_0xd6ee15,_0x20e8b8){if(_0x25df44['file']&&_0x25df44[_0xc2fb('0x53')][_0xc2fb('0x54')]){_0x25df44[_0xc2fb('0x51')][_0xc2fb('0x5b')]=_0x25df44[_0xc2fb('0x53')][_0xc2fb('0x54')];}return db[_0xc2fb('0x33')][_0xc2fb('0x4e')]({'where':{'id':_0x25df44[_0xc2fb('0x4b')]['id']}})['then'](handleEntityNotFound(_0xd6ee15,null))[_0xc2fb('0x18')](saveUpdates(_0x25df44[_0xc2fb('0x51')],null))[_0xc2fb('0x18')](respondWithResult(_0xd6ee15,null))[_0xc2fb('0x4f')](handleError(_0xd6ee15,null));};var utilLicense=require(_0xc2fb('0x14'));exports['getPreferred']=function(_0x21fdbe,_0x1cd31c,_0x1c8962){var _0x516895=_0xc2fb('0x59');var _0x32bca3={'custom':![]};return utilLicense[_0xc2fb('0x5a')]()[_0xc2fb('0x18')](function(_0x3762bf){if(_0x3762bf){_0x32bca3=_0x3762bf;}return db[_0xc2fb('0x33')]['find']({'where':{'id':_0x21fdbe[_0xc2fb('0x4b')]['id']},'attributes':[_0xc2fb('0x55'),_0xc2fb('0x57'),_0xc2fb('0x5b'),'favicon',_0xc2fb('0x5d'),_0xc2fb('0x5e'),'defaultPreferred',_0xc2fb('0x60')],'raw':!![]});})[_0xc2fb('0x18')](handleEntityNotFound(_0x1cd31c,null))[_0xc2fb('0x18')](function(_0x5366b3){if(_0x5366b3){var _0x54fc54=_0x5366b3[_0xc2fb('0x5b')]&&fs[_0xc2fb('0x61')](path['join'](config[_0xc2fb('0x63')],_0x516895,_['toLower'](_0x5366b3[_0xc2fb('0x5b')])))?path['join'](config[_0xc2fb('0x63')],_0x516895,_[_0xc2fb('0x64')](_0x5366b3[_0xc2fb('0x5b')])):path[_0xc2fb('0x62')](config['root'],_0x516895,_[_0xc2fb('0x64')](_0xc2fb('0x6f')));var _0x1d79fb=_0xc2fb('0x66')+_[_0xc2fb('0x67')](_0xc2fb('0x5b'));if(_0x5366b3[_0x1d79fb]||!_0x32bca3[_0xc2fb('0x68')]||!_0x32bca3[_0xc2fb('0x5b')]){_0x54fc54=path[_0xc2fb('0x62')](config[_0xc2fb('0x63')],_0x516895,_[_0xc2fb('0x64')](_0xc2fb('0x6f')));}if(!fs['existsSync'](_0x54fc54)){throw new db[(_0xc2fb('0x69'))][(_0xc2fb('0x6c'))](_[_0xc2fb('0x67')](_0xc2fb('0x5b'))+_0xc2fb('0x6d'));}return _0x1cd31c['download'](_0x54fc54);}})[_0xc2fb('0x4f')](handleError(_0x1cd31c,null));};exports[_0xc2fb('0x70')]=function(_0x3b57a0,_0x2cdb9e,_0x518fab){if(_0x3b57a0[_0xc2fb('0x53')]&&_0x3b57a0['file']['filename']){_0x3b57a0[_0xc2fb('0x51')][_0xc2fb('0x5c')]=_0x3b57a0['file'][_0xc2fb('0x54')];}return db['Setting'][_0xc2fb('0x4e')]({'where':{'id':_0x3b57a0['params']['id']}})[_0xc2fb('0x18')](handleEntityNotFound(_0x2cdb9e,null))[_0xc2fb('0x18')](saveUpdates(_0x3b57a0[_0xc2fb('0x51')],null))[_0xc2fb('0x18')](respondWithResult(_0x2cdb9e,null))[_0xc2fb('0x4f')](handleError(_0x2cdb9e,null));};var utilLicense=require('../../config/license/util');exports[_0xc2fb('0x71')]=function(_0xb03865,_0x4c95e9,_0x4ddd09){var _0x10f208=_0xc2fb('0x59');var _0x58ee57={'custom':![]};return utilLicense[_0xc2fb('0x5a')]()[_0xc2fb('0x18')](function(_0x1ad856){if(_0x1ad856){_0x58ee57=_0x1ad856;}return db['Setting'][_0xc2fb('0x4e')]({'where':{'id':_0xb03865[_0xc2fb('0x4b')]['id']},'attributes':[_0xc2fb('0x55'),_0xc2fb('0x57'),_0xc2fb('0x5b'),_0xc2fb('0x5c'),_0xc2fb('0x5d'),_0xc2fb('0x5e'),_0xc2fb('0x5f'),'defaultFavicon'],'raw':!![]});})[_0xc2fb('0x18')](handleEntityNotFound(_0x4c95e9,null))['then'](function(_0x2975a2){if(_0x2975a2){var _0x20e30f=_0x2975a2[_0xc2fb('0x5c')]&&fs[_0xc2fb('0x61')](path[_0xc2fb('0x62')](config[_0xc2fb('0x63')],_0x10f208,_['toLower'](_0x2975a2[_0xc2fb('0x5c')])))?path[_0xc2fb('0x62')](config[_0xc2fb('0x63')],_0x10f208,_[_0xc2fb('0x64')](_0x2975a2[_0xc2fb('0x5c')])):path[_0xc2fb('0x62')](config[_0xc2fb('0x63')],_0x10f208,_[_0xc2fb('0x64')](_0xc2fb('0x72')));var _0x2e5bdc=_0xc2fb('0x66')+_[_0xc2fb('0x67')]('favicon');if(_0x2975a2[_0x2e5bdc]||!_0x58ee57[_0xc2fb('0x68')]){_0x20e30f=path[_0xc2fb('0x62')](config[_0xc2fb('0x63')],_0x10f208,_[_0xc2fb('0x64')]('default_favicon.ico'));}if(!fs[_0xc2fb('0x61')](_0x20e30f)){throw new db[(_0xc2fb('0x69'))][(_0xc2fb('0x6c'))](_[_0xc2fb('0x67')](_0xc2fb('0x5c'))+'\x20not\x20found');}return _0x4c95e9[_0xc2fb('0x6a')](_0x20e30f);}})[_0xc2fb('0x4f')](handleError(_0x4c95e9,null));};exports[_0xc2fb('0x73')]=function(_0x26d6e2,_0x16812e){var _0x41b2b4={'offset':moment()[_0xc2fb('0x74')]()};_0x41b2b4[_0xc2fb('0x75')]=moment()[_0xc2fb('0x74')](_0x41b2b4['offset'])[_0xc2fb('0x76')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x16812e[_0xc2fb('0x23')](0xc8)[_0xc2fb('0x77')](_0x41b2b4);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 19c3bea..cf751ee 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 272947e..e73dcf7 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 _0xa71c=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','Setting,\x20%s,\x20%s','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','Setting','find','options','raw','where','attributes','include','map','model','then','debug','ShowSetting','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xa71c,0x144));var _0xca71=function(_0x4384d6,_0x3357ef){_0x4384d6=_0x4384d6-0x0;var _0x2115d4=_0xa71c[_0x4384d6];return _0x2115d4;};'use strict';var _=require(_0xca71('0x0'));var util=require(_0xca71('0x1'));var moment=require(_0xca71('0x2'));var BPromise=require(_0xca71('0x3'));var rs=require(_0xca71('0x4'));var fs=require('fs');var Redis=require(_0xca71('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xca71('0x6'));var logger=require(_0xca71('0x7'))('rpc');var config=require(_0xca71('0x8'));var jayson=require(_0xca71('0x9'));var client=jayson[_0xca71('0xa')][_0xca71('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf08230,_0x422cb3,_0x47caf7){return new BPromise(function(_0x332546,_0x2efca1){return client['request'](_0xf08230,_0x47caf7)['then'](function(_0x222afc){logger[_0xca71('0xc')](_0xca71('0xd'),_0x422cb3,'request\x20sent');logger['debug'](_0xca71('0xe'),_0x422cb3,_0xca71('0xf'),JSON[_0xca71('0x10')](_0x222afc));if(_0x222afc[_0xca71('0x11')]){if(_0x222afc[_0xca71('0x11')][_0xca71('0x12')]===0x1f4){logger[_0xca71('0x11')](_0xca71('0xd'),_0x422cb3,_0x222afc[_0xca71('0x11')][_0xca71('0x13')]);return _0x2efca1(_0x222afc[_0xca71('0x11')][_0xca71('0x13')]);}logger[_0xca71('0x11')](_0xca71('0xd'),_0x422cb3,_0x222afc[_0xca71('0x11')]['message']);return _0x332546(_0x222afc['error'][_0xca71('0x13')]);}else{logger[_0xca71('0xc')](_0xca71('0xd'),_0x422cb3,_0xca71('0xf'));_0x332546(_0x222afc['result'][_0xca71('0x13')]);}})['catch'](function(_0x1519b7){logger[_0xca71('0x11')](_0xca71('0xd'),_0x422cb3,_0x1519b7);_0x2efca1(_0x1519b7);});});}exports['ShowSetting']=function(_0x540c7e){var _0x38273d=this;return new Promise(function(_0x127427,_0x21216e){return db[_0xca71('0x14')][_0xca71('0x15')]({'raw':_0x540c7e[_0xca71('0x16')]?_0x540c7e[_0xca71('0x16')][_0xca71('0x17')]===undefined?!![]:![]:!![],'where':_0x540c7e[_0xca71('0x16')]?_0x540c7e[_0xca71('0x16')][_0xca71('0x18')]||null:null,'attributes':_0x540c7e['options']?_0x540c7e['options'][_0xca71('0x19')]||null:null,'include':_0x540c7e['options']?_0x540c7e['options'][_0xca71('0x1a')]?_[_0xca71('0x1b')](_0x540c7e[_0xca71('0x16')][_0xca71('0x1a')],function(_0x1e5c15){return{'model':db[_0x1e5c15[_0xca71('0x1c')]],'as':_0x1e5c15['as'],'attributes':_0x1e5c15[_0xca71('0x19')],'include':_0x1e5c15[_0xca71('0x1a')]?_['map'](_0x1e5c15[_0xca71('0x1a')],function(_0xd9d2b7){return{'model':db[_0xd9d2b7[_0xca71('0x1c')]],'as':_0xd9d2b7['as'],'attributes':_0xd9d2b7['attributes'],'include':_0xd9d2b7['include']?_[_0xca71('0x1b')](_0xd9d2b7[_0xca71('0x1a')],function(_0x3ed622){return{'model':db[_0x3ed622['model']],'as':_0x3ed622['as'],'attributes':_0x3ed622[_0xca71('0x19')]};}):[]};}):[]};}):[]:[]})[_0xca71('0x1d')](function(_0x6964c2){logger[_0xca71('0xc')]('ShowSetting',_0x540c7e);logger[_0xca71('0x1e')](_0xca71('0x1f'),_0x540c7e,JSON[_0xca71('0x10')](_0x6964c2));_0x127427(_0x6964c2);})[_0xca71('0x20')](function(_0x469f4d){logger[_0xca71('0x11')]('ShowSetting',_0x469f4d[_0xca71('0x13')],_0x540c7e);_0x21216e(_0x38273d[_0xca71('0x11')](0x1f4,_0x469f4d[_0xca71('0x13')]));});});}; \ No newline at end of file +var _0x9256=['jayson/promise','request','then','info','debug','request\x20sent','error','Setting,\x20%s,\x20%s','message','ShowSetting','Setting','find','options','raw','where','include','map','model','attributes','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x36b712,_0x52525b){var _0xa7deb4=function(_0x369af0){while(--_0x369af0){_0x36b712['push'](_0x36b712['shift']());}};_0xa7deb4(++_0x52525b);}(_0x9256,0x19c));var _0x6925=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9256[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6925('0x0'));var util=require('util');var moment=require(_0x6925('0x1'));var BPromise=require(_0x6925('0x2'));var rs=require(_0x6925('0x3'));var fs=require('fs');var Redis=require(_0x6925('0x4'));var db=require(_0x6925('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6925('0x6'))('rpc');var config=require(_0x6925('0x7'));var jayson=require(_0x6925('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x22689f,_0x5277de,_0x348198){return new BPromise(function(_0x4de567,_0x59874e){return client[_0x6925('0x9')](_0x22689f,_0x348198)[_0x6925('0xa')](function(_0x282dd6){logger[_0x6925('0xb')]('Setting,\x20%s,\x20%s',_0x5277de,'request\x20sent');logger[_0x6925('0xc')]('Setting,\x20%s,\x20%s,\x20%s',_0x5277de,_0x6925('0xd'),JSON['stringify'](_0x282dd6));if(_0x282dd6['error']){if(_0x282dd6[_0x6925('0xe')]['code']===0x1f4){logger[_0x6925('0xe')](_0x6925('0xf'),_0x5277de,_0x282dd6[_0x6925('0xe')][_0x6925('0x10')]);return _0x59874e(_0x282dd6['error']['message']);}logger[_0x6925('0xe')](_0x6925('0xf'),_0x5277de,_0x282dd6['error'][_0x6925('0x10')]);return _0x4de567(_0x282dd6[_0x6925('0xe')][_0x6925('0x10')]);}else{logger[_0x6925('0xb')](_0x6925('0xf'),_0x5277de,'request\x20sent');_0x4de567(_0x282dd6['result'][_0x6925('0x10')]);}})['catch'](function(_0x3080f8){logger['error']('Setting,\x20%s,\x20%s',_0x5277de,_0x3080f8);_0x59874e(_0x3080f8);});});}exports[_0x6925('0x11')]=function(_0xbb215){var _0x1e624e=this;return new Promise(function(_0x229147,_0x4cbd9b){return db[_0x6925('0x12')][_0x6925('0x13')]({'raw':_0xbb215[_0x6925('0x14')]?_0xbb215[_0x6925('0x14')][_0x6925('0x15')]===undefined?!![]:![]:!![],'where':_0xbb215['options']?_0xbb215[_0x6925('0x14')][_0x6925('0x16')]||null:null,'attributes':_0xbb215[_0x6925('0x14')]?_0xbb215[_0x6925('0x14')]['attributes']||null:null,'include':_0xbb215[_0x6925('0x14')]?_0xbb215[_0x6925('0x14')][_0x6925('0x17')]?_[_0x6925('0x18')](_0xbb215[_0x6925('0x14')][_0x6925('0x17')],function(_0x584fe3){return{'model':db[_0x584fe3[_0x6925('0x19')]],'as':_0x584fe3['as'],'attributes':_0x584fe3['attributes'],'include':_0x584fe3['include']?_[_0x6925('0x18')](_0x584fe3[_0x6925('0x17')],function(_0x5ee690){return{'model':db[_0x5ee690[_0x6925('0x19')]],'as':_0x5ee690['as'],'attributes':_0x5ee690[_0x6925('0x1a')],'include':_0x5ee690[_0x6925('0x17')]?_['map'](_0x5ee690[_0x6925('0x17')],function(_0x3df6a6){return{'model':db[_0x3df6a6[_0x6925('0x19')]],'as':_0x3df6a6['as'],'attributes':_0x3df6a6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x859498){logger[_0x6925('0xb')](_0x6925('0x11'),_0xbb215);logger[_0x6925('0xc')](_0x6925('0x11'),_0xbb215,JSON[_0x6925('0x1b')](_0x859498));_0x229147(_0x859498);})['catch'](function(_0x47ff51){logger['error']('ShowSetting',_0x47ff51[_0x6925('0x10')],_0xbb215);_0x4cbd9b(_0x1e624e[_0x6925('0xe')](0x1f4,_0x47ff51[_0x6925('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 2bd5c2f..894ddf0 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 _0x814b=['/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/send','status','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated'];(function(_0x4be730,_0x341fe4){var _0x54bbe5=function(_0x57aba7){while(--_0x57aba7){_0x4be730['push'](_0x4be730['shift']());}};_0x54bbe5(++_0x341fe4);}(_0x814b,0x1a2));var _0xb814=function(_0x4687df,_0x12099c){_0x4687df=_0x4687df-0x0;var _0x32eaef=_0x814b[_0x4687df];return _0x32eaef;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0xa')](_0xb814('0x16'),auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0xa')](_0xb814('0x18'),controller[_0xb814('0x19')]);router[_0xb814('0xa')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router[_0xb814('0x1c')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x1e')]);router['post'](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x1f')]);router[_0xb814('0x1c')]('/:id/notify',controller['notify']);router['post'](_0xb814('0x14'),auth['isAuthenticated'](),controller['addApplications']);router[_0xb814('0x1c')](_0xb814('0x20'),auth[_0xb814('0xb')](),controller['send']);router[_0xb814('0x1c')]('/:id/status',controller[_0xb814('0x21')]);router[_0xb814('0x1c')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x22')]);router[_0xb814('0x23')](_0xb814('0xe'),auth['isAuthenticated'](),controller[_0xb814('0x24')]);router['delete'](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x25')]);router[_0xb814('0x26')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x27')]);router['delete'](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x28')]);router[_0xb814('0x26')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x29')]);module[_0xb814('0x2a')]=router; \ No newline at end of file +var _0x6aa7=['create','addDisposition','addAnswer','addApplications','/:id/send','send','status','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','/:id/users','getAgents','post'];(function(_0x56f57d,_0x1c7496){var _0xb19632=function(_0x3c30a5){while(--_0x3c30a5){_0x56f57d['push'](_0x56f57d['shift']());}};_0xb19632(++_0x1c7496);}(_0x6aa7,0x178));var _0x76aa=function(_0x366984,_0x29ca60){_0x366984=_0x366984-0x0;var _0x521e42=_0x6aa7[_0x366984];return _0x521e42;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x76aa('0x5'));var interaction=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var controller=require('./smsAccount.controller');router['get']('/',auth[_0x76aa('0x8')](),controller['index']);router[_0x76aa('0x9')](_0x76aa('0xa'),auth[_0x76aa('0x8')](),controller['describe']);router[_0x76aa('0x9')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller['show']);router[_0x76aa('0x9')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xd')]);router[_0x76aa('0x9')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xf')]);router[_0x76aa('0x9')](_0x76aa('0x10'),auth['isAuthenticated'](),controller[_0x76aa('0x11')]);router['get'](_0x76aa('0x12'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x13')]);router[_0x76aa('0x9')](_0x76aa('0x14'),controller['statusGet']);router['get'](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x16')]);router[_0x76aa('0x17')]('/',auth['isAuthenticated'](),controller[_0x76aa('0x18')]);router['post'](_0x76aa('0xc'),auth['isAuthenticated'](),controller[_0x76aa('0x19')]);router[_0x76aa('0x17')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1a')]);router[_0x76aa('0x17')]('/:id/notify',controller['notify']);router[_0x76aa('0x17')](_0x76aa('0x10'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1b')]);router[_0x76aa('0x17')](_0x76aa('0x1c'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1d')]);router[_0x76aa('0x17')]('/:id/status',controller[_0x76aa('0x1e')]);router[_0x76aa('0x17')](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x1f')]);router[_0x76aa('0x20')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x21')]);router[_0x76aa('0x22')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x23')]);router[_0x76aa('0x22')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x24')]);router['delete'](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x25')]);router[_0x76aa('0x22')](_0x76aa('0x15'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x26')]);module[_0x76aa('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index e988f6b..014a779 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 _0x1921=['infobip','intelepeer','ENUM','BOOLEAN','INTEGER','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','skebby','connectel','clicksend','plivo','bandwidth','csc'];(function(_0x355937,_0x11cc6a){var _0x5c0400=function(_0x574e79){while(--_0x574e79){_0x355937['push'](_0x355937['shift']());}};_0x5c0400(++_0x11cc6a);}(_0x1921,0xb1));var _0x1192=function(_0x3bbd1c,_0x411b1d){_0x3bbd1c=_0x3bbd1c-0x0;var _0x415044=_0x1921[_0x3bbd1c];return _0x415044;};'use strict';var Sequelize=require(_0x1192('0x0'));var rs=require(_0x1192('0x1'));module[_0x1192('0x2')]={'name':{'type':Sequelize[_0x1192('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x1192('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x1192('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x1192('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM']('twilio',_0x1192('0x4'),_0x1192('0x5'),_0x1192('0x6'),_0x1192('0x7'),'clickatell',_0x1192('0x8'),_0x1192('0x9'),_0x1192('0xa'),_0x1192('0xb'))},'accountSid':{'type':Sequelize[_0x1192('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x1192('0x3')]},'smsMethod':{'type':Sequelize[_0x1192('0xc')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x1192('0x3')]},'apiKey':{'type':Sequelize[_0x1192('0x3')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x1192('0x3')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x1192('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x1192('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1192('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1192('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1192('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1192('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1192('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1192('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x1192('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1192('0xe')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x44cad5){if(!_0x44cad5)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x1192('0xf')](_0x1192('0x10'),_0x44cad5);}}}; \ No newline at end of file +var _0x79ec=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','randomstring','exports','STRING','name','generate','ENUM','skebby','connectel','clicksend','clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN'];(function(_0x4e7b46,_0x1e5718){var _0x309599=function(_0x549658){while(--_0x549658){_0x4e7b46['push'](_0x4e7b46['shift']());}};_0x309599(++_0x1e5718);}(_0x79ec,0x193));var _0xc79e=function(_0x46a634,_0x439b70){_0x46a634=_0x46a634-0x0;var _0x42007a=_0x79ec[_0x46a634];return _0x42007a;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xc79e('0x0'));module[_0xc79e('0x1')]={'name':{'type':Sequelize[_0xc79e('0x2')],'unique':_0xc79e('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xc79e('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xc79e('0x2')],'defaultValue':function(){return rs[_0xc79e('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc79e('0x5')]('twilio',_0xc79e('0x6'),_0xc79e('0x7'),_0xc79e('0x8'),'plivo',_0xc79e('0x9'),_0xc79e('0xa'),_0xc79e('0xb'),_0xc79e('0xc'),_0xc79e('0xd'))},'accountSid':{'type':Sequelize[_0xc79e('0x2')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xc79e('0x2')]},'smsMethod':{'type':Sequelize[_0xc79e('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xc79e('0x2')]},'password':{'type':Sequelize[_0xc79e('0x2')]},'apiKey':{'type':Sequelize[_0xc79e('0x2')]},'applicationId':{'type':Sequelize[_0xc79e('0x2')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xc79e('0x2')]},'deliveryReport':{'type':Sequelize[_0xc79e('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0xc79e('0x2')]},'notificationTemplate':{'type':Sequelize[_0xc79e('0xf')],'defaultValue':function(){return _0xc79e('0x10');}},'notificationSound':{'type':Sequelize[_0xc79e('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc79e('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc79e('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc79e('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xc79e('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc79e('0x11')],'comment':_0xc79e('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xc79e('0x13'),'set':function(_0x26cc27){if(!_0x26cc27)this[_0xc79e('0x14')]('mandatoryDispositionPauseId',null);this[_0xc79e('0x14')](_0xc79e('0x15'),_0x26cc27);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 030bdc0..aa0b439 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 _0xdfc3=['List','out','SmsMessage','Messages','dataValues','debug','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','update','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','csc','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','getAgents','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','http','request','then','info','request\x20sent','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','get','SmsAccounts','UserProfileResource','destroy','stack','name','send','mandatoryDispositionPause','SmsAccount','rawAttributes','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','Pause','keys','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','describe','addDisposition','SmsAccountId','Disposition','getDispositions','includeAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','options','removeAnswers','notify','sms','SmsApplication','account','orderBy','priority','Applications','Sequelize','ValidationError','createdAt','updatedAt','difference','CompanyId','ListId','mobile','twilio','From','Body','messageId','MessageSid','skebby','from','sender','text','connectel','clicksend','message_id','plivo','Text','infobip','results','originatingAddress','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','Contacts','DESC','list','omit','CmContact','SmsInteraction','spread','interaction','push','applications','close','unmanaged','created','AttachmentId','User','UserId','unshift','agent','*,*,*,*','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','\x0a','addApplications','sequelize','ISOLATION_LEVELS','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tags','tag','body\x20is\x20mandatory\x20and\x20not\x20empty'];(function(_0x54bac5,_0x8d3a16){var _0xc15971=function(_0x254653){while(--_0x254653){_0x54bac5['push'](_0x54bac5['shift']());}};_0xc15971(++_0x8d3a16);}(_0xdfc3,0x1e1));var _0x3dfc=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xdfc3[_0x1589dd];return _0x1bddd1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3dfc('0x0'));var jsonpatch=require(_0x3dfc('0x1'));var rp=require('request-promise');var moment=require(_0x3dfc('0x2'));var BPromise=require(_0x3dfc('0x3'));var Mustache=require(_0x3dfc('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x3dfc('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3dfc('0x6'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3dfc('0x7'));var deskjs=require(_0x3dfc('0x8'));var toCsv=require(_0x3dfc('0x5'));var querystring=require(_0x3dfc('0x9'));var Papa=require(_0x3dfc('0xa'));var Redis=require(_0x3dfc('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x3dfc('0xc'));var as=require(_0x3dfc('0xd'));var hardwareService=require(_0x3dfc('0xe'));var logger=require(_0x3dfc('0xf'))(_0x3dfc('0x10'));var utils=require(_0x3dfc('0x11'));var config=require(_0x3dfc('0x12'));var licenseUtil=require(_0x3dfc('0x13'));var db=require('../../mysqldb')['db'];config[_0x3dfc('0x14')]=_[_0x3dfc('0x15')](config[_0x3dfc('0x14')],{'host':_0x3dfc('0x16'),'port':0x18eb});var socket=require(_0x3dfc('0x17'))(new Redis(config['redis']));require(_0x3dfc('0x18'))[_0x3dfc('0x19')](socket);var jayson=require(_0x3dfc('0x1a'));var client=jayson['client'][_0x3dfc('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x368822,_0xbd7337,_0x3065a5,_0x5a0183){return new BPromise(function(_0x533f7e,_0x71e2df){var _0x1685c4=_0x5a0183||client;return _0x1685c4[_0x3dfc('0x1c')](_0x368822,_0x3065a5)[_0x3dfc('0x1d')](function(_0x55f52b){logger[_0x3dfc('0x1e')]('SmsAccount,\x20%s,\x20%s',_0xbd7337,_0x3dfc('0x1f'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xbd7337,_0x3dfc('0x1f'),JSON[_0x3dfc('0x20')](_0x55f52b));if(_0x55f52b[_0x3dfc('0x21')]){if(_0x55f52b[_0x3dfc('0x21')][_0x3dfc('0x22')]===0x1f4){logger[_0x3dfc('0x21')](_0x3dfc('0x23'),_0xbd7337,_0x55f52b[_0x3dfc('0x21')][_0x3dfc('0x24')]);return _0x71e2df(_0x55f52b[_0x3dfc('0x21')][_0x3dfc('0x24')]);}logger[_0x3dfc('0x21')](_0x3dfc('0x23'),_0xbd7337,_0x55f52b[_0x3dfc('0x21')][_0x3dfc('0x24')]);return _0x533f7e(_0x55f52b['error'][_0x3dfc('0x24')]);}else{logger[_0x3dfc('0x1e')](_0x3dfc('0x23'),_0xbd7337,_0x3dfc('0x1f'));_0x533f7e(_0x55f52b[_0x3dfc('0x25')][_0x3dfc('0x24')]);}})[_0x3dfc('0x26')](function(_0x19ef52){logger['error'](_0x3dfc('0x23'),_0xbd7337,_0x19ef52);_0x71e2df(_0x19ef52);});});}function respondWithStatusCode(_0xab2681,_0x29fa3b){_0x29fa3b=_0x29fa3b||0xcc;return function(_0x144053){if(_0x144053){return _0xab2681[_0x3dfc('0x27')](_0x29fa3b);}return _0xab2681[_0x3dfc('0x28')](_0x29fa3b)[_0x3dfc('0x29')]();};}function respondWithResult(_0x403560,_0x3cb1f6){_0x3cb1f6=_0x3cb1f6||0xc8;return function(_0x59e98a){if(_0x59e98a){return _0x403560[_0x3dfc('0x28')](_0x3cb1f6)['json'](_0x59e98a);}};}function respondWithFilteredResult(_0x385f20,_0xad5d72){return function(_0x1584c6){if(_0x1584c6){var _0x530038=typeof _0xad5d72[_0x3dfc('0x2a')]===_0x3dfc('0x2b')&&typeof _0xad5d72[_0x3dfc('0x2c')]==='undefined';var _0x3d82e4=_0x1584c6[_0x3dfc('0x2d')];var _0x1ccc8c=_0x530038?0x0:_0xad5d72[_0x3dfc('0x2a')];var _0x5389c1=_0x530038?_0x1584c6[_0x3dfc('0x2d')]:_0xad5d72[_0x3dfc('0x2a')]+_0xad5d72['limit'];var _0x2f1f14;if(_0x5389c1>=_0x3d82e4){_0x5389c1=_0x3d82e4;_0x2f1f14=0xc8;}else{_0x2f1f14=0xce;}_0x385f20[_0x3dfc('0x28')](_0x2f1f14);return _0x385f20[_0x3dfc('0x2e')](_0x3dfc('0x2f'),_0x1ccc8c+'-'+_0x5389c1+'/'+_0x3d82e4)[_0x3dfc('0x30')](_0x1584c6);}return null;};}function patchUpdates(_0x116b8a){return function(_0x2fad0c){try{jsonpatch['apply'](_0x2fad0c,_0x116b8a,!![]);}catch(_0x17fcb2){return BPromise[_0x3dfc('0x31')](_0x17fcb2);}return _0x2fad0c[_0x3dfc('0x32')]();};}function saveUpdates(_0xc1c43c,_0x1d5d5f){return function(_0xc9b728){if(_0xc9b728){return _0xc9b728['update'](_0xc1c43c)['then'](function(_0x467ddf){return _0x467ddf;});}return null;};}function removeEntity(_0xa51a7e,_0x55bf65){return function(_0x4b0794){if(_0x4b0794){return _0x4b0794['destroy']()[_0x3dfc('0x1d')](function(){var _0x25c23a=_0x4b0794[_0x3dfc('0x33')]({'plain':!![]});var _0x16abbd=_0x3dfc('0x34');return db[_0x3dfc('0x35')][_0x3dfc('0x36')]({'where':{'type':_0x16abbd,'resourceId':_0x25c23a['id']}})['then'](function(){return _0x4b0794;});})[_0x3dfc('0x1d')](function(){_0xa51a7e[_0x3dfc('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25ec68,_0x2933e2){return function(_0xaaee5d){if(!_0xaaee5d){_0x25ec68[_0x3dfc('0x27')](0x194);}return _0xaaee5d;};}function handleError(_0x34fbeb,_0x3cca8d){_0x3cca8d=_0x3cca8d||0x1f4;return function(_0xce85c6){logger[_0x3dfc('0x21')](_0xce85c6[_0x3dfc('0x37')]);if(_0xce85c6[_0x3dfc('0x38')]){delete _0xce85c6[_0x3dfc('0x38')];}_0x34fbeb[_0x3dfc('0x28')](_0x3cca8d)[_0x3dfc('0x39')](_0xce85c6);};}exports['index']=function(_0x1f7ec6,_0x49f600){var _0x499d48={'include':[{'model':db['Pause'],'as':_0x3dfc('0x3a')}]},_0x1c3aa3={},_0x38850f={'count':0x0,'rows':[]};var _0x2eb7e5=_['map'](db[_0x3dfc('0x3b')][_0x3dfc('0x3c')],function(_0x35cb1c){return{'name':_0x35cb1c['fieldName'],'type':_0x35cb1c[_0x3dfc('0x3d')][_0x3dfc('0x3e')]};});_0x1c3aa3[_0x3dfc('0x3f')]=_[_0x3dfc('0x40')](_0x2eb7e5,_0x3dfc('0x38'));_0x1c3aa3['query']=_['keys'](_0x1f7ec6[_0x3dfc('0x41')]);_0x1c3aa3[_0x3dfc('0x42')]=_['intersection'](_0x1c3aa3[_0x3dfc('0x3f')],_0x1c3aa3['query']);_0x499d48[_0x3dfc('0x43')]=_[_0x3dfc('0x44')](_0x1c3aa3[_0x3dfc('0x3f')],qs[_0x3dfc('0x45')](_0x1f7ec6['query'][_0x3dfc('0x45')]));_0x499d48[_0x3dfc('0x43')]=_0x499d48['attributes'][_0x3dfc('0x46')]?_0x499d48[_0x3dfc('0x43')]:_0x1c3aa3['model'];if(!_0x1f7ec6[_0x3dfc('0x41')][_0x3dfc('0x47')](_0x3dfc('0x48'))){_0x499d48[_0x3dfc('0x2c')]=qs[_0x3dfc('0x2c')](_0x1f7ec6[_0x3dfc('0x41')][_0x3dfc('0x2c')]);_0x499d48['offset']=qs[_0x3dfc('0x2a')](_0x1f7ec6['query'][_0x3dfc('0x2a')]);}_0x499d48[_0x3dfc('0x49')]=qs['sort'](_0x1f7ec6[_0x3dfc('0x41')][_0x3dfc('0x4a')]);_0x499d48[_0x3dfc('0x4b')]=qs[_0x3dfc('0x42')](_[_0x3dfc('0x4c')](_0x1f7ec6[_0x3dfc('0x41')],_0x1c3aa3[_0x3dfc('0x42')]),_0x2eb7e5);if(_0x1f7ec6[_0x3dfc('0x41')][_0x3dfc('0x4d')]){_0x499d48[_0x3dfc('0x4b')]=_[_0x3dfc('0x4e')](_0x499d48[_0x3dfc('0x4b')],{'$or':_['map'](_0x2eb7e5,function(_0x573906){if(_0x573906[_0x3dfc('0x3d')]!==_0x3dfc('0x4f')){var _0x24d9bc={};_0x24d9bc[_0x573906[_0x3dfc('0x38')]]={'$like':'%'+_0x1f7ec6[_0x3dfc('0x41')][_0x3dfc('0x4d')]+'%'};return _0x24d9bc;}})});}_0x499d48=_['merge']({},_0x499d48,_0x1f7ec6['options']);var _0x3111e7={'where':_0x499d48[_0x3dfc('0x4b')]};return db[_0x3dfc('0x3b')][_0x3dfc('0x2d')](_0x3111e7)['then'](function(_0x338fb9){_0x38850f[_0x3dfc('0x2d')]=_0x338fb9;if(_0x1f7ec6[_0x3dfc('0x41')]['includeAll']){_0x499d48[_0x3dfc('0x50')]=[{'all':!![]}];}return db['SmsAccount'][_0x3dfc('0x51')](_0x499d48);})[_0x3dfc('0x1d')](function(_0x4b92f4){_0x38850f[_0x3dfc('0x52')]=_0x4b92f4;return _0x38850f;})[_0x3dfc('0x1d')](respondWithFilteredResult(_0x49f600,_0x499d48))[_0x3dfc('0x26')](handleError(_0x49f600,null));};exports['show']=function(_0x21c4d8,_0x121313){var _0x27ab0c={'raw':![],'where':{'id':_0x21c4d8['params']['id']},'include':[{'model':db[_0x3dfc('0x53')],'as':_0x3dfc('0x3a')}]},_0x39b2cf={};_0x39b2cf[_0x3dfc('0x3f')]=_[_0x3dfc('0x54')](db[_0x3dfc('0x3b')][_0x3dfc('0x3c')]);_0x39b2cf[_0x3dfc('0x41')]=_[_0x3dfc('0x54')](_0x21c4d8[_0x3dfc('0x41')]);_0x39b2cf[_0x3dfc('0x42')]=_[_0x3dfc('0x44')](_0x39b2cf[_0x3dfc('0x3f')],_0x39b2cf['query']);_0x27ab0c[_0x3dfc('0x43')]=_[_0x3dfc('0x44')](_0x39b2cf[_0x3dfc('0x3f')],qs[_0x3dfc('0x45')](_0x21c4d8[_0x3dfc('0x41')][_0x3dfc('0x45')]));_0x27ab0c[_0x3dfc('0x43')]=_0x27ab0c['attributes'][_0x3dfc('0x46')]?_0x27ab0c['attributes']:_0x39b2cf[_0x3dfc('0x3f')];if(_0x21c4d8['query']['includeAll']){_0x27ab0c[_0x3dfc('0x50')]=[{'all':!![]}];}_0x27ab0c=_[_0x3dfc('0x4e')]({},_0x27ab0c,_0x21c4d8['options']);return db[_0x3dfc('0x3b')][_0x3dfc('0x55')](_0x27ab0c)[_0x3dfc('0x1d')](handleEntityNotFound(_0x121313,null))['then'](respondWithResult(_0x121313,null))[_0x3dfc('0x26')](handleError(_0x121313,null));};exports[_0x3dfc('0x56')]=function(_0x44d12,_0x2a53bd){return db[_0x3dfc('0x3b')]['create'](_0x44d12[_0x3dfc('0x57')],{})[_0x3dfc('0x1d')](function(_0x357328){var _0x3ee2f7=_0x44d12[_0x3dfc('0x58')]['get']({'plain':!![]});if(!_0x3ee2f7)throw new Error(_0x3dfc('0x59'));if(_0x3ee2f7[_0x3dfc('0x5a')]==='user'){var _0x59f628=_0x357328[_0x3dfc('0x33')]({'plain':!![]});var _0x11658a=_0x3dfc('0x34');return db[_0x3dfc('0x5b')]['find']({'where':{'name':_0x11658a,'userProfileId':_0x3ee2f7[_0x3dfc('0x5c')]},'raw':!![]})[_0x3dfc('0x1d')](function(_0x5add15){if(_0x5add15&&_0x5add15[_0x3dfc('0x5d')]===0x0){return db['UserProfileResource'][_0x3dfc('0x56')]({'name':_0x59f628['name'],'resourceId':_0x59f628['id'],'type':_0x5add15['name'],'sectionId':_0x5add15['id']},{})[_0x3dfc('0x1d')](function(){return _0x357328;});}else{return _0x357328;}})['catch'](function(_0x1bd225){logger['error'](_0x3dfc('0x5e'),_0x1bd225);throw _0x1bd225;});}return _0x357328;})['then'](respondWithResult(_0x2a53bd,0xc9))['catch'](handleError(_0x2a53bd,null));};exports['update']=function(_0x56b3b5,_0x22e549){if(_0x56b3b5[_0x3dfc('0x57')]['id']){delete _0x56b3b5[_0x3dfc('0x57')]['id'];}return db[_0x3dfc('0x3b')][_0x3dfc('0x55')]({'where':{'id':_0x56b3b5[_0x3dfc('0x5f')]['id']},'include':[{'model':db['Pause'],'as':_0x3dfc('0x3a')}]})[_0x3dfc('0x1d')](handleEntityNotFound(_0x22e549,null))['then'](saveUpdates(_0x56b3b5[_0x3dfc('0x57')],null))[_0x3dfc('0x1d')](respondWithResult(_0x22e549,null))[_0x3dfc('0x26')](handleError(_0x22e549,null));};exports[_0x3dfc('0x36')]=function(_0x3182dd,_0x3ee93c){return db[_0x3dfc('0x3b')]['find']({'where':{'id':_0x3182dd['params']['id']}})['then'](handleEntityNotFound(_0x3ee93c,null))[_0x3dfc('0x1d')](removeEntity(_0x3ee93c,null))[_0x3dfc('0x26')](handleError(_0x3ee93c,null));};exports[_0x3dfc('0x60')]=function(_0x1afe37,_0x456f86){return db[_0x3dfc('0x3b')]['describe']()[_0x3dfc('0x1d')](respondWithResult(_0x456f86,null))[_0x3dfc('0x26')](handleError(_0x456f86,null));};exports[_0x3dfc('0x61')]=function(_0x4ad794,_0x26d6a6,_0x454f57){if(_0x4ad794[_0x3dfc('0x57')]['id']){delete _0x4ad794['body']['id'];}return db[_0x3dfc('0x3b')][_0x3dfc('0x55')]({'where':{'id':_0x4ad794['params']['id']}})[_0x3dfc('0x1d')](handleEntityNotFound(_0x26d6a6,null))[_0x3dfc('0x1d')](function(_0x16f918){if(_0x16f918){_0x4ad794['body'][_0x3dfc('0x62')]=_0x16f918['id'];return db[_0x3dfc('0x63')][_0x3dfc('0x56')](_0x4ad794[_0x3dfc('0x57')]);}})['then'](respondWithResult(_0x26d6a6,null))[_0x3dfc('0x26')](handleError(_0x26d6a6,null));};exports[_0x3dfc('0x64')]=function(_0x544fd0,_0x161274,_0x115585){var _0x1759bd={'raw':![],'where':{}};var _0x44bb7f={};var _0xafd328={'count':0x0,'rows':[]};return db[_0x3dfc('0x3b')]['findOne']({'where':{'id':_0x544fd0['params']['id']}})[_0x3dfc('0x1d')](handleEntityNotFound(_0x161274,null))[_0x3dfc('0x1d')](function(_0x37e427){if(_0x37e427){_0x44bb7f[_0x3dfc('0x3f')]=_['keys'](db[_0x3dfc('0x63')]['rawAttributes']);_0x44bb7f[_0x3dfc('0x41')]=_[_0x3dfc('0x54')](_0x544fd0[_0x3dfc('0x41')]);_0x44bb7f['filters']=_['intersection'](_0x44bb7f[_0x3dfc('0x3f')],_0x44bb7f['query']);_0x1759bd[_0x3dfc('0x43')]=_[_0x3dfc('0x44')](_0x44bb7f[_0x3dfc('0x3f')],qs[_0x3dfc('0x45')](_0x544fd0[_0x3dfc('0x41')]['fields']));_0x1759bd[_0x3dfc('0x43')]=_0x1759bd[_0x3dfc('0x43')][_0x3dfc('0x46')]?_0x1759bd[_0x3dfc('0x43')]:_0x44bb7f[_0x3dfc('0x3f')];if(!_0x544fd0['query'][_0x3dfc('0x47')](_0x3dfc('0x48'))){_0x1759bd['limit']=qs['limit'](_0x544fd0[_0x3dfc('0x41')][_0x3dfc('0x2c')]);_0x1759bd[_0x3dfc('0x2a')]=qs['offset'](_0x544fd0[_0x3dfc('0x41')][_0x3dfc('0x2a')]);}_0x1759bd[_0x3dfc('0x49')]=qs[_0x3dfc('0x4a')](_0x544fd0[_0x3dfc('0x41')]['sort']);_0x1759bd['where']=qs['filters'](_[_0x3dfc('0x4c')](_0x544fd0[_0x3dfc('0x41')],_0x44bb7f['filters']));_0x1759bd[_0x3dfc('0x4b')]['SmsAccountId']=_0x37e427['id'];if(_0x544fd0['query']['filter']){_0x1759bd[_0x3dfc('0x4b')]=_[_0x3dfc('0x4e')](_0x1759bd[_0x3dfc('0x4b')],{'$or':_[_0x3dfc('0x40')](_0x1759bd['attributes'],function(_0x892eb9){var _0x4fb67a={};_0x4fb67a[_0x892eb9]={'$like':'%'+_0x544fd0[_0x3dfc('0x41')]['filter']+'%'};return _0x4fb67a;})});}_0x1759bd=_['merge']({},_0x1759bd,_0x544fd0['options']);return db[_0x3dfc('0x63')][_0x3dfc('0x2d')]({'where':_0x1759bd[_0x3dfc('0x4b')]})[_0x3dfc('0x1d')](function(_0x4d9da9){_0xafd328[_0x3dfc('0x2d')]=_0x4d9da9;if(_0x544fd0[_0x3dfc('0x41')][_0x3dfc('0x65')]){_0x1759bd['include']=[{'all':!![]}];}return db[_0x3dfc('0x63')][_0x3dfc('0x51')](_0x1759bd);})['then'](function(_0x4f98c1){_0xafd328['rows']=_0x4f98c1;return _0xafd328;});}})['then'](respondWithFilteredResult(_0x161274,_0x1759bd))[_0x3dfc('0x26')](handleError(_0x161274,null));};exports[_0x3dfc('0x66')]=function(_0x1eaa5e,_0x4d3620,_0x4ad1f9){return db[_0x3dfc('0x3b')][_0x3dfc('0x55')]({'where':{'id':_0x1eaa5e[_0x3dfc('0x5f')]['id']}})[_0x3dfc('0x1d')](handleEntityNotFound(_0x4d3620,null))[_0x3dfc('0x1d')](function(_0xc4fd6f){if(_0xc4fd6f){return _0xc4fd6f[_0x3dfc('0x66')](_0x1eaa5e[_0x3dfc('0x41')][_0x3dfc('0x67')]);}})[_0x3dfc('0x1d')](respondWithStatusCode(_0x4d3620,null))[_0x3dfc('0x26')](handleError(_0x4d3620,null));};exports[_0x3dfc('0x68')]=function(_0x47036e,_0x5333e8,_0x41c96d){if(_0x47036e[_0x3dfc('0x57')]['id']){delete _0x47036e[_0x3dfc('0x57')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x47036e[_0x3dfc('0x5f')]['id']}})[_0x3dfc('0x1d')](handleEntityNotFound(_0x5333e8,null))['then'](function(_0x12f84e){if(_0x12f84e){_0x47036e[_0x3dfc('0x57')]['SmsAccountId']=_0x12f84e['id'];return db[_0x3dfc('0x69')]['create'](_0x47036e[_0x3dfc('0x57')]);}})['then'](respondWithResult(_0x5333e8,null))[_0x3dfc('0x26')](handleError(_0x5333e8,null));};exports[_0x3dfc('0x6a')]=function(_0x1e573f,_0x461697,_0x56686a){var _0x2328d4={'raw':![],'where':{}};var _0xf8618c={};var _0x2adadf={'count':0x0,'rows':[]};return db[_0x3dfc('0x3b')][_0x3dfc('0x6b')]({'where':{'id':_0x1e573f['params']['id']}})[_0x3dfc('0x1d')](handleEntityNotFound(_0x461697,null))[_0x3dfc('0x1d')](function(_0x4b5af7){if(_0x4b5af7){_0xf8618c[_0x3dfc('0x3f')]=_[_0x3dfc('0x54')](db['CannedAnswer'][_0x3dfc('0x3c')]);_0xf8618c['query']=_[_0x3dfc('0x54')](_0x1e573f['query']);_0xf8618c[_0x3dfc('0x42')]=_[_0x3dfc('0x44')](_0xf8618c[_0x3dfc('0x3f')],_0xf8618c['query']);_0x2328d4[_0x3dfc('0x43')]=_[_0x3dfc('0x44')](_0xf8618c[_0x3dfc('0x3f')],qs[_0x3dfc('0x45')](_0x1e573f[_0x3dfc('0x41')][_0x3dfc('0x45')]));_0x2328d4[_0x3dfc('0x43')]=_0x2328d4[_0x3dfc('0x43')][_0x3dfc('0x46')]?_0x2328d4['attributes']:_0xf8618c[_0x3dfc('0x3f')];if(!_0x1e573f['query']['hasOwnProperty'](_0x3dfc('0x48'))){_0x2328d4[_0x3dfc('0x2c')]=qs[_0x3dfc('0x2c')](_0x1e573f[_0x3dfc('0x41')]['limit']);_0x2328d4[_0x3dfc('0x2a')]=qs[_0x3dfc('0x2a')](_0x1e573f[_0x3dfc('0x41')][_0x3dfc('0x2a')]);}_0x2328d4[_0x3dfc('0x49')]=qs[_0x3dfc('0x4a')](_0x1e573f[_0x3dfc('0x41')][_0x3dfc('0x4a')]);_0x2328d4[_0x3dfc('0x4b')]=qs['filters'](_['pick'](_0x1e573f[_0x3dfc('0x41')],_0xf8618c[_0x3dfc('0x42')]));_0x2328d4[_0x3dfc('0x4b')][_0x3dfc('0x62')]=_0x4b5af7['id'];if(_0x1e573f[_0x3dfc('0x41')][_0x3dfc('0x4d')]){_0x2328d4[_0x3dfc('0x4b')]=_[_0x3dfc('0x4e')](_0x2328d4[_0x3dfc('0x4b')],{'$or':_[_0x3dfc('0x40')](_0x2328d4['attributes'],function(_0x432047){var _0x5857d4={};_0x5857d4[_0x432047]={'$like':'%'+_0x1e573f['query']['filter']+'%'};return _0x5857d4;})});}_0x2328d4=_[_0x3dfc('0x4e')]({},_0x2328d4,_0x1e573f[_0x3dfc('0x6c')]);return db[_0x3dfc('0x69')][_0x3dfc('0x2d')]({'where':_0x2328d4['where']})[_0x3dfc('0x1d')](function(_0x48b616){_0x2adadf[_0x3dfc('0x2d')]=_0x48b616;if(_0x1e573f[_0x3dfc('0x41')][_0x3dfc('0x65')]){_0x2328d4[_0x3dfc('0x50')]=[{'all':!![]}];}return db[_0x3dfc('0x69')][_0x3dfc('0x51')](_0x2328d4);})[_0x3dfc('0x1d')](function(_0x4172c5){_0x2adadf[_0x3dfc('0x52')]=_0x4172c5;return _0x2adadf;});}})[_0x3dfc('0x1d')](respondWithFilteredResult(_0x461697,_0x2328d4))['catch'](handleError(_0x461697,null));};exports[_0x3dfc('0x6d')]=function(_0x63f04e,_0x4eaff2,_0x578091){return db['SmsAccount']['find']({'where':{'id':_0x63f04e['params']['id']}})[_0x3dfc('0x1d')](handleEntityNotFound(_0x4eaff2,null))[_0x3dfc('0x1d')](function(_0x2d095f){if(_0x2d095f){return _0x2d095f[_0x3dfc('0x6d')](_0x63f04e[_0x3dfc('0x41')]['ids']);}})[_0x3dfc('0x1d')](respondWithStatusCode(_0x4eaff2,null))[_0x3dfc('0x26')](handleError(_0x4eaff2,null));};exports[_0x3dfc('0x6e')]=function(_0x5de9da,_0x2a16a8,_0x4532f4){var _0x4388d4={'channel':_0x3dfc('0x6f')};var _0x53d426=[];var _0x2111c2=[];var _0x5b5af6={};return db[_0x3dfc('0x3b')]['find']({'where':{'id':_0x5de9da[_0x3dfc('0x5f')]['id']},'include':[{'model':db[_0x3dfc('0x70')],'as':'Applications'}]})[_0x3dfc('0x1d')](handleEntityNotFound(_0x2a16a8,null))['then'](function(_0x4a56c4){_0x4388d4[_0x3dfc('0x71')]=_0x4a56c4;_0x4388d4['applications']=_[_0x3dfc('0x72')](_0x4a56c4['Applications'],[_0x3dfc('0x73')],['asc']);if(_0x4388d4[_0x3dfc('0x71')][_0x3dfc('0x74')]){delete _0x4388d4[_0x3dfc('0x71')]['Applications'];}return db['CmContact'][_0x3dfc('0x60')]();})[_0x3dfc('0x1d')](function(_0x398dd4){if(!_0x398dd4){throw new db[(_0x3dfc('0x75'))][(_0x3dfc('0x76'))]('no\x20available\x20attributes');}_0x53d426=_['difference'](_[_0x3dfc('0x54')](_0x398dd4),[_0x3dfc('0x77'),_0x3dfc('0x78')]);_0x2111c2=_[_0x3dfc('0x79')](_[_0x3dfc('0x54')](_0x398dd4),['createdAt',_0x3dfc('0x78'),_0x3dfc('0x7a'),_0x3dfc('0x7b')]);_0x4388d4['body']={'mapKey':_0x3dfc('0x7c')};if(_0x4388d4['account'][_0x3dfc('0x3d')]){switch(_0x4388d4[_0x3dfc('0x71')][_0x3dfc('0x3d')]){case _0x3dfc('0x7d'):_0x4388d4['body']['from']=_0x5de9da[_0x3dfc('0x57')][_0x3dfc('0x7e')];_0x4388d4[_0x3dfc('0x57')][_0x3dfc('0x57')]=_0x5de9da['body'][_0x3dfc('0x7f')];_0x4388d4[_0x3dfc('0x57')][_0x3dfc('0x80')]=_0x5de9da['body'][_0x3dfc('0x81')];break;case _0x3dfc('0x82'):_0x4388d4[_0x3dfc('0x57')][_0x3dfc('0x83')]='+'+_0x5de9da[_0x3dfc('0x57')][_0x3dfc('0x84')];_0x4388d4['body'][_0x3dfc('0x57')]=_0x5de9da['body'][_0x3dfc('0x85')];break;case _0x3dfc('0x86'):_0x4388d4[_0x3dfc('0x57')][_0x3dfc('0x83')]=_0x5de9da['body'][_0x3dfc('0x83')];_0x4388d4[_0x3dfc('0x57')][_0x3dfc('0x57')]=_0x5de9da[_0x3dfc('0x57')]['message'];break;case _0x3dfc('0x87'):_0x4388d4[_0x3dfc('0x57')]['from']=_0x5de9da[_0x3dfc('0x57')][_0x3dfc('0x83')];_0x4388d4[_0x3dfc('0x57')]['body']=_0x5de9da['body'][_0x3dfc('0x57')];_0x4388d4[_0x3dfc('0x57')][_0x3dfc('0x80')]=_0x5de9da[_0x3dfc('0x57')][_0x3dfc('0x88')];break;case _0x3dfc('0x89'):_0x4388d4[_0x3dfc('0x57')]['from']=_0x5de9da[_0x3dfc('0x57')][_0x3dfc('0x7e')];_0x4388d4['body']['body']=_0x5de9da[_0x3dfc('0x57')][_0x3dfc('0x8a')];_0x4388d4[_0x3dfc('0x57')][_0x3dfc('0x80')]=_0x5de9da[_0x3dfc('0x57')]['MessageUUID'];break;case _0x3dfc('0x8b'):_0x4388d4['body'][_0x3dfc('0x83')]='+'+_0x5de9da[_0x3dfc('0x57')][_0x3dfc('0x8c')][0x0][_0x3dfc('0x83')];_0x4388d4[_0x3dfc('0x57')][_0x3dfc('0x57')]=_0x5de9da[_0x3dfc('0x57')][_0x3dfc('0x8c')][0x0][_0x3dfc('0x85')];_0x4388d4[_0x3dfc('0x57')]['messageId']=_0x5de9da['body']['results'][0x0]['messageId'];break;case'csc':_0x4388d4[_0x3dfc('0x57')]['from']=_0x5de9da['body'][_0x3dfc('0x8d')];_0x4388d4[_0x3dfc('0x57')][_0x3dfc('0x57')]=_0x5de9da[_0x3dfc('0x57')]['segmentedMessage'][_0x3dfc('0x24')];break;case _0x3dfc('0x8e'):_0x4388d4[_0x3dfc('0x57')]['from']=_0x5de9da[_0x3dfc('0x57')][_0x3dfc('0x8f')];_0x4388d4[_0x3dfc('0x57')]['body']=_0x5de9da[_0x3dfc('0x57')][_0x3dfc('0x85')];_0x4388d4[_0x3dfc('0x57')][_0x3dfc('0x80')]=_0x5de9da[_0x3dfc('0x57')][_0x3dfc('0x90')];break;case _0x3dfc('0x91'):_0x4388d4[_0x3dfc('0x57')][_0x3dfc('0x80')]=_0x5de9da['body'][0x0][_0x3dfc('0x24')]['id'];_0x4388d4['body'][_0x3dfc('0x83')]=_0x5de9da['body'][0x0][_0x3dfc('0x24')][_0x3dfc('0x83')];_0x4388d4['body']['body']=_0x5de9da[_0x3dfc('0x57')][0x0][_0x3dfc('0x24')][_0x3dfc('0x85')];break;case _0x3dfc('0x92'):_0x4388d4['body']['from']=_0x5de9da['body'][_0x3dfc('0x83')];_0x4388d4[_0x3dfc('0x57')][_0x3dfc('0x57')]=_0x5de9da['body'][_0x3dfc('0x24')];_0x4388d4[_0x3dfc('0x57')][_0x3dfc('0x80')]=_0x5de9da['body'][_0x3dfc('0x93')];break;}}if(_0x4388d4[_0x3dfc('0x57')]['id']){delete _0x4388d4[_0x3dfc('0x57')]['id'];}if(_[_0x3dfc('0x94')](_0x4388d4[_0x3dfc('0x57')][_0x3dfc('0x83')])){throw new db[(_0x3dfc('0x75'))][(_0x3dfc('0x76'))](_0x3dfc('0x95'));}if(_[_0x3dfc('0x94')](_0x4388d4[_0x3dfc('0x57')][_0x3dfc('0x57')])||_0x4388d4[_0x3dfc('0x57')][_0x3dfc('0x57')]===''){throw new db[(_0x3dfc('0x75'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x3dfc('0x94')](_0x4388d4[_0x3dfc('0x57')]['mapKey'])){throw new db[(_0x3dfc('0x75'))]['ValidationError'](_0x3dfc('0x96')+_0x2111c2);}if(!_[_0x3dfc('0x97')](_0x2111c2,_0x4388d4['body'][_0x3dfc('0x98')])){throw new db[(_0x3dfc('0x75'))][(_0x3dfc('0x76'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2111c2);}_0x5b5af6[_0x4388d4['body'][_0x3dfc('0x98')]]=_0x4388d4['body'][_0x3dfc('0x83')];return db[_0x3dfc('0x99')][_0x3dfc('0x55')]({'where':{'id':_0x4388d4[_0x3dfc('0x71')]['ListId']},'include':[{'model':db['CmContact'],'as':_0x3dfc('0x9a'),'where':_0x5b5af6,'limit':0x1,'order':[['updatedAt',_0x3dfc('0x9b')]]}]});})['then'](handleEntityNotFound(_0x2a16a8,null))[_0x3dfc('0x1d')](function(_0x38f980){if(_0x38f980){_0x4388d4[_0x3dfc('0x9c')]=_[_0x3dfc('0x9d')](_0x38f980,['Contacts']);if(_0x38f980['Contacts'][_0x3dfc('0x46')]){return _0x38f980['Contacts'][0x0];}var _0x4c4060=_[_0x3dfc('0x15')](_0x4388d4[_0x3dfc('0x57')],{'firstName':_0x4388d4['body'][_0x3dfc('0x83')],'ListId':_0x38f980['id']});_0x4c4060[_0x4388d4['body'][_0x3dfc('0x98')]]=_0x4388d4[_0x3dfc('0x57')]['from'];return db[_0x3dfc('0x9e')][_0x3dfc('0x56')](_0x4c4060,{'fields':_0x53d426,'raw':!![]});}})[_0x3dfc('0x1d')](handleEntityNotFound(_0x2a16a8,null))[_0x3dfc('0x1d')](function(_0x4d1721){if(_0x4d1721){_0x4388d4['contact']=_0x4d1721;var _0x2dffe5={'ContactId':_0x4d1721['id'],'phone':_0x4388d4[_0x3dfc('0x57')][_0x3dfc('0x83')],'SmsAccountId':_0x5de9da[_0x3dfc('0x5f')]['id']};var _0x20d179={'ContactId':_0x4d1721['id'],'SmsAccountId':_0x5de9da[_0x3dfc('0x5f')]['id'],'closed':![]};return db[_0x3dfc('0x9f')][_0x3dfc('0x55')]({'where':_0x20d179})['then'](function(_0x4a0147){if(_0x4a0147){return[_0x4a0147,![]];}return db[_0x3dfc('0x9f')][_0x3dfc('0x56')](_0x2dffe5)[_0x3dfc('0x1d')](function(_0x1f0314){return[_0x1f0314,!![]];});});}})[_0x3dfc('0xa0')](function(_0x2adc93,_0x2d3fa7){_0x4388d4['interaction']=_0x2adc93[_0x3dfc('0x33')]({'plain':!![]});_0x4388d4[_0x3dfc('0xa1')]['created']=![];if(_0x2d3fa7){if(_0x4388d4[_0x3dfc('0x71')]['autoclose']){_0x4388d4['applications'][_0x3dfc('0xa2')]({'id':0x0,'priority':_0x4388d4[_0x3dfc('0xa3')][_0x3dfc('0x46')]+0x1,'app':_0x3dfc('0xa4'),'appdata':_0x3dfc('0xa5'),'interval':'*,*,*,*'});}_0x4388d4['interaction'][_0x3dfc('0xa6')]=!![];}return db['SmsMessage']['create']({'phone':_0x4388d4['body']['from'],'messageId':_0x4388d4[_0x3dfc('0x57')][_0x3dfc('0x80')],'body':_0x4388d4[_0x3dfc('0x57')]['body'],'SmsAccountId':_0x5de9da['params']['id'],'SmsInteractionId':_0x2adc93['id'],'direction':'in','ContactId':_0x2adc93['ContactId'],'AttachmentId':_0x4388d4[_0x3dfc('0x57')][_0x3dfc('0xa7')]});})['then'](function(_0x5f7bb){_0x4388d4[_0x3dfc('0x24')]=_0x5f7bb;if(_0x4388d4[_0x3dfc('0xa1')]['UserId']){return db[_0x3dfc('0xa8')][_0x3dfc('0x55')]({'attributes':['id',_0x3dfc('0x38')],'where':{'id':_0x4388d4[_0x3dfc('0xa1')][_0x3dfc('0xa9')]}})[_0x3dfc('0x1d')](function(_0x4a239d){if(_0x4a239d){_0x4388d4[_0x3dfc('0xa3')][_0x3dfc('0xaa')]({'id':0x0,'priority':0x0,'app':_0x3dfc('0xab'),'appdata':_0x4a239d['name']+','+(_0x4388d4[_0x3dfc('0x71')]['waitForTheAssignedAgent']||0xa),'interval':_0x3dfc('0xac')});}return respondWithRpcPromise(_0x3dfc('0xad'),_0x3dfc('0xae'),_0x4388d4);});}return respondWithRpcPromise(_0x3dfc('0xad'),_0x3dfc('0xae'),_0x4388d4);})[_0x3dfc('0x1d')](function(_0x3528cd){if(_0x3528cd){var _0x215047=0xc8;var _0x2ab700=_0x3dfc('0xaf');logger[_0x3dfc('0x1e')](_0x3dfc('0xb0'),_0x2ab700,_0x215047,_0x3dfc('0xb1'));logger['debug'](_0x3dfc('0xb2'),_0x2ab700,_0x215047,_0x3dfc('0xb1'),JSON[_0x3dfc('0x20')](_0x3528cd));if(_0x4388d4[_0x3dfc('0x71')][_0x3dfc('0x3d')]===_0x3dfc('0x7d')){return _0x2a16a8[_0x3dfc('0x28')](_0x215047)['set']('Content-Type','text/xml')[_0x3dfc('0x39')](_0x3dfc('0xb3'));}else{return _0x2a16a8['status'](_0x215047)[_0x3dfc('0x30')](_0x3528cd);}}})['catch'](handleError(_0x2a16a8,null));};exports[_0x3dfc('0xb4')]=function(_0x13d350,_0x57ae9b){var _0x4be679=_0x13d350[_0x3dfc('0x5f')]['id'];var _0x93e316=_0x13d350[_0x3dfc('0x57')];var _0x3d1a3c=0xc8;var _0x28d340=null;return db[_0x3dfc('0xb5')]['transaction']({'isolationLevel':db[_0x3dfc('0xb5')]['Transaction'][_0x3dfc('0xb6')]['READ_COMMITTED']},function(_0x2887cf){return db[_0x3dfc('0x3b')][_0x3dfc('0x6b')]({'where':{'id':_0x4be679},'transaction':_0x2887cf})[_0x3dfc('0x1d')](function(_0x27ab2e){if(_0x27ab2e){return db[_0x3dfc('0x70')][_0x3dfc('0x36')]({'where':{'SmsAccountId':_0x4be679},'transaction':_0x2887cf})['then'](function(){var _0x52ef0c=_['map'](_0x93e316,function(_0x13230d){_0x13230d[_0x3dfc('0x62')]=_0x4be679;return _0x13230d;});return db[_0x3dfc('0x70')]['bulkCreate'](_0x52ef0c,{'transaction':_0x2887cf});});}else{_0x3d1a3c=0x194;_0x28d340=[];}});})[_0x3dfc('0x1d')](function(){if(_0x3d1a3c!==0x194){return db[_0x3dfc('0x70')][_0x3dfc('0xb7')]({'where':{'SmsAccountId':_0x4be679},'order':_0x3dfc('0x73')})['then'](function(_0x55b222){_0x28d340=_0x55b222;});}})[_0x3dfc('0x26')](function(_0x3e946d){_0x3d1a3c=0x1f4;logger[_0x3dfc('0x21')](_0x3e946d[_0x3dfc('0x37')]);if(_0x3e946d[_0x3dfc('0x38')]){delete _0x3e946d[_0x3dfc('0x38')];}_0x28d340=_0x3e946d;})[_0x3dfc('0xb8')](function(){if(_0x28d340===null){_0x57ae9b['sendStatus'](_0x3d1a3c);}else{if(_0x3d1a3c===0x1f4){_0x57ae9b[_0x3dfc('0x28')](_0x3d1a3c)[_0x3dfc('0x39')](_0x28d340);}else{_0x57ae9b['status'](_0x3d1a3c)[_0x3dfc('0x30')](_0x28d340);}}});};exports[_0x3dfc('0xb9')]=function(_0x5d852d,_0x297924,_0x37e1d7){var _0x21fb9a={};var _0x3a49c6={};var _0x4b1c8f;var _0x730690;return db[_0x3dfc('0x3b')]['findOne']({'where':{'id':_0x5d852d[_0x3dfc('0x5f')]['id']}})[_0x3dfc('0x1d')](handleEntityNotFound(_0x297924,null))[_0x3dfc('0x1d')](function(_0x2587d1){if(_0x2587d1){_0x4b1c8f=_0x2587d1;_0x3a49c6[_0x3dfc('0x3f')]=_[_0x3dfc('0x54')](db[_0x3dfc('0x70')][_0x3dfc('0x3c')]);_0x3a49c6[_0x3dfc('0x41')]=_['keys'](_0x5d852d[_0x3dfc('0x41')]);_0x3a49c6[_0x3dfc('0x42')]=_[_0x3dfc('0x44')](_0x3a49c6['model'],_0x3a49c6[_0x3dfc('0x41')]);_0x21fb9a['attributes']=_[_0x3dfc('0x44')](_0x3a49c6[_0x3dfc('0x3f')],qs[_0x3dfc('0x45')](_0x5d852d[_0x3dfc('0x41')][_0x3dfc('0x45')]));_0x21fb9a[_0x3dfc('0x43')]=_0x21fb9a[_0x3dfc('0x43')]['length']?_0x21fb9a['attributes']:_0x3a49c6[_0x3dfc('0x3f')];_0x21fb9a[_0x3dfc('0x49')]=qs['sort'](_0x5d852d[_0x3dfc('0x41')]['sort']);_0x21fb9a[_0x3dfc('0x4b')]=qs[_0x3dfc('0x42')](_[_0x3dfc('0x4c')](_0x5d852d[_0x3dfc('0x41')],_0x3a49c6[_0x3dfc('0x42')]));if(_0x5d852d[_0x3dfc('0x41')][_0x3dfc('0x4d')]){_0x21fb9a['where']=_[_0x3dfc('0x4e')](_0x21fb9a[_0x3dfc('0x4b')],{'$or':_[_0x3dfc('0x40')](_0x21fb9a[_0x3dfc('0x43')],function(_0x408ddb){var _0x2cf1db={};_0x2cf1db[_0x408ddb]={'$like':'%'+_0x5d852d[_0x3dfc('0x41')][_0x3dfc('0x4d')]+'%'};return _0x2cf1db;})});}_0x21fb9a=_[_0x3dfc('0x4e')]({},_0x21fb9a,_0x5d852d[_0x3dfc('0x6c')]);return _0x4b1c8f[_0x3dfc('0xb9')](_0x21fb9a);}})[_0x3dfc('0x1d')](function(_0x385a99){if(_0x385a99){_0x730690=_0x385a99['length'];if(!_0x5d852d[_0x3dfc('0x41')][_0x3dfc('0x47')](_0x3dfc('0x48'))){_0x21fb9a[_0x3dfc('0x2c')]=qs[_0x3dfc('0x2c')](_0x5d852d[_0x3dfc('0x41')]['limit']);_0x21fb9a[_0x3dfc('0x2a')]=qs['offset'](_0x5d852d[_0x3dfc('0x41')][_0x3dfc('0x2a')]);}return _0x4b1c8f[_0x3dfc('0xb9')](_0x21fb9a);}})[_0x3dfc('0x1d')](function(_0x4f1378){if(_0x4f1378){return _0x4f1378?{'count':_0x730690,'rows':_0x4f1378}:null;}})[_0x3dfc('0x1d')](respondWithResult(_0x297924,null))[_0x3dfc('0x26')](handleError(_0x297924,null));};exports[_0x3dfc('0xba')]=function(_0x256d4a,_0x116b1e,_0x5a69b5){var _0x217c7d={'raw':![],'where':{}};var _0x482dbe={};var _0x27205b={'count':0x0,'rows':[]};return db[_0x3dfc('0x3b')][_0x3dfc('0x6b')]({'where':{'id':_0x256d4a[_0x3dfc('0x5f')]['id']}})[_0x3dfc('0x1d')](handleEntityNotFound(_0x116b1e,null))[_0x3dfc('0x1d')](function(_0x5253f5){if(_0x5253f5){_0x482dbe['model']=_[_0x3dfc('0x54')](db[_0x3dfc('0x9f')][_0x3dfc('0x3c')]);_0x482dbe[_0x3dfc('0x41')]=_['keys'](_0x256d4a[_0x3dfc('0x41')]);_0x482dbe[_0x3dfc('0x42')]=_[_0x3dfc('0x44')](_0x482dbe[_0x3dfc('0x3f')],_0x482dbe['query']);_0x217c7d[_0x3dfc('0x43')]=_['intersection'](_0x482dbe[_0x3dfc('0x3f')],qs[_0x3dfc('0x45')](_0x256d4a[_0x3dfc('0x41')][_0x3dfc('0x45')]));_0x217c7d['attributes']=_0x217c7d['attributes'][_0x3dfc('0x46')]?_0x217c7d['attributes']:_0x482dbe[_0x3dfc('0x3f')];if(!_0x256d4a['query']['hasOwnProperty']('nolimit')){_0x217c7d[_0x3dfc('0x2c')]=qs[_0x3dfc('0x2c')](_0x256d4a[_0x3dfc('0x41')][_0x3dfc('0x2c')]);_0x217c7d['offset']=qs[_0x3dfc('0x2a')](_0x256d4a[_0x3dfc('0x41')][_0x3dfc('0x2a')]);}_0x217c7d['order']=qs[_0x3dfc('0x4a')](_0x256d4a[_0x3dfc('0x41')][_0x3dfc('0x4a')]);_0x217c7d[_0x3dfc('0x4b')]=qs[_0x3dfc('0x42')](_[_0x3dfc('0x4c')](_0x256d4a[_0x3dfc('0x41')],_0x482dbe[_0x3dfc('0x42')]));_0x217c7d[_0x3dfc('0x4b')]['SmsAccountId']=_0x5253f5['id'];if(_0x256d4a['query'][_0x3dfc('0x4d')]){_0x217c7d[_0x3dfc('0x4b')]=_[_0x3dfc('0x4e')](_0x217c7d[_0x3dfc('0x4b')],{'$or':_[_0x3dfc('0x40')](_0x217c7d[_0x3dfc('0x43')],function(_0x3da2fa){var _0xe7a6d8={};_0xe7a6d8[_0x3da2fa]={'$like':'%'+_0x256d4a[_0x3dfc('0x41')]['filter']+'%'};return _0xe7a6d8;})});}_0x217c7d=_['merge']({},_0x217c7d,_0x256d4a[_0x3dfc('0x6c')]);return db[_0x3dfc('0x9f')][_0x3dfc('0x2d')]({'where':_0x217c7d['where']})['then'](function(_0x21286c){_0x27205b['count']=_0x21286c;if(_0x256d4a[_0x3dfc('0x41')][_0x3dfc('0x65')]){_0x217c7d[_0x3dfc('0x50')]=[{'model':db[_0x3dfc('0x9e')],'as':_0x3dfc('0xbb'),'required':![]},{'model':db[_0x3dfc('0xa8')],'as':_0x3dfc('0xbc'),'attributes':[_0x3dfc('0x38'),_0x3dfc('0xbd'),_0x3dfc('0xbe')],'required':![]},{'model':db['Tag'],'as':_0x3dfc('0xbf'),'attributes':['id',_0x3dfc('0x38'),'color'],'where':_0x256d4a['query'][_0x3dfc('0xc0')]?{'id':_0x256d4a[_0x3dfc('0x41')][_0x3dfc('0xc0')]}:undefined,'required':_0x256d4a[_0x3dfc('0x41')][_0x3dfc('0xc0')]?!![]:![]}];}return db[_0x3dfc('0x9f')]['findAll'](_0x217c7d);})[_0x3dfc('0x1d')](function(_0x32ec7d){_0x27205b['rows']=_0x32ec7d;return _0x27205b;});}})[_0x3dfc('0x1d')](respondWithFilteredResult(_0x116b1e,_0x217c7d))['catch'](handleError(_0x116b1e,null));};exports[_0x3dfc('0x39')]=function(_0x136692,_0xbc3495,_0x3d34cc){var _0x59e193,_0xf23d62,_0x115a7b;if(_[_0x3dfc('0x94')](_0x136692['body']['body'])||_0x136692[_0x3dfc('0x57')][_0x3dfc('0x57')]===''){throw new db[(_0x3dfc('0x75'))][(_0x3dfc('0x76'))](_0x3dfc('0xc1'));}if(_[_0x3dfc('0x94')](_0x136692[_0x3dfc('0x57')]['to'])){throw new db['Sequelize'][(_0x3dfc('0x76'))]('to\x20is\x20mandatory');}_0x59e193=_0x136692[_0x3dfc('0x57')]['to'];return db[_0x3dfc('0x3b')][_0x3dfc('0x55')]({'where':{'id':_0x136692[_0x3dfc('0x5f')]['id']},'include':[{'model':db[_0x3dfc('0x99')],'as':'List','include':[{'model':db[_0x3dfc('0x9e')],'as':_0x3dfc('0x9a'),'where':{'mobile':_0x59e193},'limit':0x1,'order':[[_0x3dfc('0x78'),'DESC']]}]}]})['then'](handleEntityNotFound(_0xbc3495,null))[_0x3dfc('0x1d')](function(_0x513f80){if(_0x513f80&&_0x513f80[_0x3dfc('0xc2')]){_0xf23d62=_0x513f80['get']({'plain':!![]});if(_0xf23d62[_0x3dfc('0xc2')]&&_0xf23d62[_0x3dfc('0xc2')][_0x3dfc('0x9a')]['length']){return _0xf23d62[_0x3dfc('0xc2')][_0x3dfc('0x9a')][0x0];}return db[_0x3dfc('0x9e')][_0x3dfc('0x56')](_[_0x3dfc('0x15')](_0x136692[_0x3dfc('0x57')],{'firstName':_0x59e193,'mobile':_0x59e193,'phone':_0x59e193,'ListId':_0xf23d62[_0x3dfc('0x7b')]}));}})[_0x3dfc('0x1d')](handleEntityNotFound(_0xbc3495,null))['then'](function(_0x3abf74){if(_0x3abf74){_0x115a7b=_0x3abf74;return db[_0x3dfc('0x9f')][_0x3dfc('0x55')]({'where':{'ContactId':_0x115a7b['id'],'closed':![],'SmsAccountId':_0xf23d62['id']}})[_0x3dfc('0x1d')](function(_0x4499f3){if(_0x4499f3){return[_0x4499f3,![]];}return db[_0x3dfc('0x9f')][_0x3dfc('0x56')]({'UserId':_0x136692['user']['id'],'ContactId':_0x115a7b['id'],'SmsAccountId':_0xf23d62['id'],'phone':_0x59e193,'firstMsgDirection':_0x3dfc('0xc3'),'Messages':[_[_0x3dfc('0x4e')](_0x136692[_0x3dfc('0x57')],{'read':![],'body':_0x136692['body'][_0x3dfc('0x57')],'phone':_0x59e193,'SmsAccountId':_0xf23d62['id'],'UserId':_0x136692[_0x3dfc('0x58')]['id'],'ContactId':_0x115a7b['id']})]},{'include':[{'model':db[_0x3dfc('0xc4')],'as':_0x3dfc('0xc5')}]})[_0x3dfc('0x1d')](function(_0xfcecf0){return[_0xfcecf0,!![]];});});}})[_0x3dfc('0xa0')](function(_0x1a3950,_0xc21d13){if(_0xc21d13){return _0x1a3950;}return db['SmsMessage']['create'](_[_0x3dfc('0x4e')](_0x136692['body'],{'read':![],'body':_0x136692[_0x3dfc('0x57')][_0x3dfc('0x57')],'phone':_0x59e193,'SmsAccountId':_0xf23d62['id'],'SmsInteractionId':_0x1a3950['id'],'UserId':_0x136692['user']['id'],'ContactId':_0x115a7b['id']}))['then'](function(_0x140012){_0x1a3950['dataValues'][_0x3dfc('0xc5')]=[];_0x1a3950[_0x3dfc('0xc6')]['Messages']['push'](_0x140012[_0x3dfc('0xc6')]);return _0x1a3950;});})[_0x3dfc('0x1d')](respondWithResult(_0xbc3495,null))[_0x3dfc('0x26')](handleError(_0xbc3495,null));};exports[_0x3dfc('0x28')]=function(_0x218cfb,_0x56fa46,_0x12712d){if(_0x218cfb[_0x3dfc('0x57')]['id']){delete _0x218cfb[_0x3dfc('0x57')]['id'];}var _0x3f1716,_0x9bc9d,_0x55da79;return db[_0x3dfc('0x3b')][_0x3dfc('0x55')]({'where':{'id':_0x218cfb[_0x3dfc('0x5f')]['id']}})['then'](handleEntityNotFound(_0x56fa46,null))[_0x3dfc('0x1d')](function(_0x25afee){if(_0x25afee){_0x55da79=_0x25afee;logger[_0x3dfc('0xc7')](_0x3dfc('0xb0'),_0x3dfc('0x28'),_0x3dfc('0xc8'),_0x25afee[_0x3dfc('0x3d')],util[_0x3dfc('0xc9')](_0x218cfb[_0x3dfc('0x57')],{'showHidden':![],'depth':null}));switch(_0x25afee[_0x3dfc('0x3d')]){case _0x3dfc('0x82'):if(_0x218cfb['body'][_0x3dfc('0xca')]&&_0x218cfb[_0x3dfc('0x57')][_0x3dfc('0x28')]){_0x9bc9d=_0x218cfb[_0x3dfc('0x57')][_0x3dfc('0x28')];return db[_0x3dfc('0xc4')][_0x3dfc('0x55')]({'where':{'messageId':_0x218cfb[_0x3dfc('0x57')][_0x3dfc('0xca')]}});}break;case'connectel':if(_0x218cfb[_0x3dfc('0x57')][_0x3dfc('0xcb')]&&_0x218cfb[_0x3dfc('0x57')][_0x3dfc('0xcc')]){_0x9bc9d=_0x218cfb['body'][_0x3dfc('0xcc')];return db[_0x3dfc('0xc4')][_0x3dfc('0x55')]({'where':{'messageId':_0x218cfb[_0x3dfc('0x57')][_0x3dfc('0xcb')]}});}break;case _0x3dfc('0x87'):if(_0x218cfb[_0x3dfc('0x57')][_0x3dfc('0x88')]&&_0x218cfb[_0x3dfc('0x57')][_0x3dfc('0xcd')]){_0x9bc9d=_0x218cfb[_0x3dfc('0x57')][_0x3dfc('0xcd')];return db[_0x3dfc('0xc4')]['find']({'where':{'messageId':_0x218cfb[_0x3dfc('0x57')][_0x3dfc('0x88')]}});}break;case _0x3dfc('0x8b'):var _0x7eede=_0x218cfb[_0x3dfc('0x57')][_0x3dfc('0x8c')][0x0];if(_0x7eede[_0x3dfc('0x80')]&&_0x7eede[_0x3dfc('0x28')][_0x3dfc('0xce')]===_0x3dfc('0xcf')){_0x9bc9d=_0x7eede[_0x3dfc('0x28')]['groupName'];return db['SmsMessage'][_0x3dfc('0x55')]({'where':{'messageId':_0x7eede[_0x3dfc('0x80')]}});}break;case _0x3dfc('0x8e'):if(_0x218cfb[_0x3dfc('0x57')][_0x3dfc('0x80')]&&_0x218cfb[_0x3dfc('0x57')]['status']){_0x9bc9d=_0x218cfb[_0x3dfc('0x57')][_0x3dfc('0x28')];return db['SmsMessage'][_0x3dfc('0x55')]({'where':{'messageId':_0x218cfb[_0x3dfc('0x57')][_0x3dfc('0x80')]}});}break;case _0x3dfc('0x91'):if(_0x218cfb[_0x3dfc('0x57')][0x0][_0x3dfc('0x24')]['id']){_0x9bc9d=_0x218cfb[_0x3dfc('0x57')][0x0]['type'];return db[_0x3dfc('0xc4')][_0x3dfc('0x55')]({'where':{'messageId':_0x218cfb[_0x3dfc('0x57')][0x0][_0x3dfc('0x24')]['id']}});}break;case _0x3dfc('0x92'):if(_0x218cfb[_0x3dfc('0x57')]['redif']&&_0x218cfb['body'][_0x3dfc('0x28')]){_0x9bc9d=_0x218cfb['body']['status'];return db[_0x3dfc('0xc4')][_0x3dfc('0x55')]({'where':{'messageId':_0x218cfb['body'][_0x3dfc('0xd0')]}});}break;}}})[_0x3dfc('0x1d')](handleEntityNotFound(_0x56fa46,null))[_0x3dfc('0x1d')](function(_0x3a189b){if(_0x3a189b){_0x3f1716=_0x3a189b;switch(_0x55da79[_0x3dfc('0x3d')]){case'skebby':if(_0x9bc9d==='DELIVERED'){return _0x3f1716[_0x3dfc('0xd1')]({'read':!![]});}else{logger[_0x3dfc('0x21')](_0x3dfc('0xb0'),_0x3dfc('0x28'),_0x3dfc('0x82'),util[_0x3dfc('0xc9')](_0x218cfb['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x9bc9d==='1'){return _0x3f1716[_0x3dfc('0xd1')]({'read':!![]});}else{logger['error'](_0x3dfc('0xb0'),'status',_0x3dfc('0x82'),util[_0x3dfc('0xc9')](_0x218cfb[_0x3dfc('0x57')],{'showHidden':![],'depth':null}));}break;case _0x3dfc('0x87'):if(!_0x218cfb[_0x3dfc('0x57')][_0x3dfc('0xd2')]&&_0x9bc9d>=0xc8&&_0x9bc9d<=0xce){return _0x3f1716[_0x3dfc('0xd1')]({'read':!![]});}else{logger[_0x3dfc('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3dfc('0x28'),_0x3dfc('0x87'),util[_0x3dfc('0xc9')](_0x218cfb[_0x3dfc('0x57')],{'showHidden':![],'depth':null}));}break;case _0x3dfc('0x8b'):var _0x1621f2=_0x218cfb[_0x3dfc('0x57')][_0x3dfc('0x8c')][0x0];if(_0x1621f2[_0x3dfc('0x28')]['groupName']===_0x3dfc('0xcf')){return _0x3f1716[_0x3dfc('0xd1')]({'read':!![]});}else{logger[_0x3dfc('0x21')](_0x3dfc('0xb0'),_0x3dfc('0x28'),_0x3dfc('0x8b'),util[_0x3dfc('0xc9')](_0x218cfb[_0x3dfc('0x57')],{'showHidden':![],'depth':null}));}break;case _0x3dfc('0x8e'):if(_0x9bc9d==_0x3dfc('0xd3')||_0x9bc9d==_0x3dfc('0xd4')){return _0x3f1716[_0x3dfc('0xd1')]({'read':!![]});}else{logger[_0x3dfc('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3dfc('0x28'),_0x3dfc('0x8e'),util['inspect'](_0x218cfb[_0x3dfc('0x57')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x9bc9d==_0x3dfc('0xd5')){return _0x3f1716['update']({'read':!![]});}else{logger[_0x3dfc('0x21')](_0x3dfc('0xb0'),_0x3dfc('0x28'),_0x3dfc('0x91'),util['inspect'](_0x218cfb[_0x3dfc('0x57')],{'showHidden':![],'depth':null}));}break;case _0x3dfc('0x92'):if(_0x9bc9d===_0x3dfc('0xd6')||_0x9bc9d===_0x3dfc('0xd7')){return _0x3f1716['update']({'read':!![]});}else{logger[_0x3dfc('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3dfc('0x28'),'intelepeer',util['inspect'](_0x218cfb[_0x3dfc('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x3f1716;}})[_0x3dfc('0x1d')](respondWithResult(_0x56fa46,null))['catch'](handleError(_0x56fa46,null));};exports[_0x3dfc('0xd8')]=function(_0x258c63,_0x12918f,_0x53fca1){var _0x21e64b,_0x509012,_0x5f2719;return db[_0x3dfc('0x3b')][_0x3dfc('0x55')]({'where':{'id':_0x258c63[_0x3dfc('0x5f')]['id']}})[_0x3dfc('0x1d')](handleEntityNotFound(_0x12918f,null))['then'](function(_0x453d0e){if(_0x453d0e){_0x5f2719=_0x453d0e;logger['debug'](_0x3dfc('0xb0'),'status',_0x3dfc('0xc8'),_0x453d0e[_0x3dfc('0x3d')],util[_0x3dfc('0xc9')](_0x258c63[_0x3dfc('0x41')],{'showHidden':![],'depth':null}));switch(_0x453d0e['type']){case _0x3dfc('0xd9'):if(_0x258c63['query'][_0x3dfc('0xda')]&&_0x258c63[_0x3dfc('0x41')][_0x3dfc('0xdb')]){_0x509012=_0x258c63[_0x3dfc('0x41')]['state'];return db['SmsMessage'][_0x3dfc('0x55')]({'where':{'messageId':_0x258c63['query']['message-id']}});}break;}}})[_0x3dfc('0x1d')](handleEntityNotFound(_0x12918f,null))[_0x3dfc('0x1d')](function(_0xe2b1f3){if(_0xe2b1f3){_0x21e64b=_0xe2b1f3;switch(_0x5f2719[_0x3dfc('0x3d')]){case _0x3dfc('0xd9'):if(_0x509012==='2'||_0x509012==='6'){return _0x21e64b[_0x3dfc('0xd1')]({'read':!![]});}else{logger[_0x3dfc('0x21')](_0x3dfc('0xb0'),_0x3dfc('0x28'),_0x3dfc('0xd9'),util[_0x3dfc('0xc9')](_0x258c63[_0x3dfc('0x41')],{'showHidden':![],'depth':null}));};break;}return _0x21e64b;}})[_0x3dfc('0x1d')](respondWithResult(_0x12918f,null))[_0x3dfc('0x26')](handleError(_0x12918f,null));};exports[_0x3dfc('0xdc')]=function(_0x3c5f98,_0x5456a8,_0x5e4107){return db[_0x3dfc('0x3b')][_0x3dfc('0x55')]({'where':{'id':_0x3c5f98[_0x3dfc('0x5f')]['id']}})[_0x3dfc('0x1d')](handleEntityNotFound(_0x5456a8,null))['then'](function(_0x3f802a){if(_0x3f802a){return _0x3f802a[_0x3dfc('0xdc')](_0x3c5f98[_0x3dfc('0x57')][_0x3dfc('0x67')],_['omit'](_0x3c5f98[_0x3dfc('0x57')],[_0x3dfc('0x67'),'id'])||{})[_0x3dfc('0xa0')](function(_0xbfbb7a){for(var _0x4c62b8=0x0;_0x4c62b8<_0x3c5f98[_0x3dfc('0x57')][_0x3dfc('0x67')][_0x3dfc('0x46')];_0x4c62b8+=0x1){socket[_0x3dfc('0xdd')](_0x3dfc('0xde'),{'UserId':Number(_0x3c5f98[_0x3dfc('0x57')][_0x3dfc('0x67')][_0x4c62b8]),'SmsAccountId':Number(_0x3c5f98[_0x3dfc('0x5f')]['id'])});}return _0xbfbb7a;});}})['then'](respondWithResult(_0x5456a8,null))[_0x3dfc('0x26')](handleError(_0x5456a8,null));};exports[_0x3dfc('0xdf')]=function(_0x4cc0b9,_0x553183,_0x3d68f3){return db[_0x3dfc('0x3b')][_0x3dfc('0x55')]({'where':{'id':_0x4cc0b9[_0x3dfc('0x5f')]['id']}})['then'](handleEntityNotFound(_0x553183,null))[_0x3dfc('0x1d')](function(_0x352811){if(_0x352811){return _0x352811[_0x3dfc('0xdf')](_0x4cc0b9['query'][_0x3dfc('0x67')])['then'](function(){if(_['isArray'](_0x4cc0b9[_0x3dfc('0x41')][_0x3dfc('0x67')])){for(var _0x3c3edb=0x0;_0x3c3edb<_0x4cc0b9[_0x3dfc('0x41')][_0x3dfc('0x67')]['length'];_0x3c3edb+=0x1){socket[_0x3dfc('0xdd')]('userSmsAccount:remove',{'UserId':Number(_0x4cc0b9[_0x3dfc('0x41')][_0x3dfc('0x67')][_0x3c3edb]),'SmsAccountId':Number(_0x4cc0b9[_0x3dfc('0x5f')]['id'])});}}else{socket[_0x3dfc('0xdd')]('userSmsAccount:remove',{'UserId':Number(_0x4cc0b9[_0x3dfc('0x41')][_0x3dfc('0x67')]),'SmsAccountId':Number(_0x4cc0b9[_0x3dfc('0x5f')]['id'])});}});}})[_0x3dfc('0x1d')](respondWithStatusCode(_0x553183,null))['catch'](handleError(_0x553183,null));};exports[_0x3dfc('0xe0')]=function(_0x2f8205,_0x166f28,_0x5d42db){var _0x34eed0={};var _0x5848f4={};var _0x37aee5;var _0x198093;return db[_0x3dfc('0x3b')][_0x3dfc('0x6b')]({'where':{'id':_0x2f8205[_0x3dfc('0x5f')]['id']}})[_0x3dfc('0x1d')](handleEntityNotFound(_0x166f28,null))[_0x3dfc('0x1d')](function(_0x162603){if(_0x162603){_0x37aee5=_0x162603;_0x5848f4[_0x3dfc('0x3f')]=_['keys'](db[_0x3dfc('0xa8')][_0x3dfc('0x3c')]);_0x5848f4[_0x3dfc('0x41')]=_['keys'](_0x2f8205[_0x3dfc('0x41')]);_0x5848f4[_0x3dfc('0x42')]=_[_0x3dfc('0x44')](_0x5848f4[_0x3dfc('0x3f')],_0x5848f4[_0x3dfc('0x41')]);_0x34eed0['attributes']=_[_0x3dfc('0x44')](_0x5848f4[_0x3dfc('0x3f')],qs[_0x3dfc('0x45')](_0x2f8205[_0x3dfc('0x41')]['fields']));_0x34eed0[_0x3dfc('0x43')]=_0x34eed0['attributes'][_0x3dfc('0x46')]?_0x34eed0['attributes']:_0x5848f4[_0x3dfc('0x3f')];_0x34eed0[_0x3dfc('0x49')]=qs[_0x3dfc('0x4a')](_0x2f8205[_0x3dfc('0x41')][_0x3dfc('0x4a')]);_0x34eed0['where']=qs[_0x3dfc('0x42')](_[_0x3dfc('0x4c')](_0x2f8205[_0x3dfc('0x41')],_0x5848f4[_0x3dfc('0x42')]));if(_0x2f8205[_0x3dfc('0x41')]['filter']){_0x34eed0[_0x3dfc('0x4b')]=_['merge'](_0x34eed0['where'],{'$or':_['map'](_0x34eed0['attributes'],function(_0x5c9e39){var _0x11767d={};_0x11767d[_0x5c9e39]={'$like':'%'+_0x2f8205[_0x3dfc('0x41')][_0x3dfc('0x4d')]+'%'};return _0x11767d;})});}_0x34eed0=_[_0x3dfc('0x4e')]({},_0x34eed0,_0x2f8205[_0x3dfc('0x6c')]);return _0x37aee5[_0x3dfc('0xe0')](_0x34eed0);}})[_0x3dfc('0x1d')](function(_0x4a5124){if(_0x4a5124){_0x198093=_0x4a5124[_0x3dfc('0x46')];if(!_0x2f8205[_0x3dfc('0x41')][_0x3dfc('0x47')](_0x3dfc('0x48'))){_0x34eed0[_0x3dfc('0x2c')]=qs[_0x3dfc('0x2c')](_0x2f8205[_0x3dfc('0x41')]['limit']);_0x34eed0['offset']=qs[_0x3dfc('0x2a')](_0x2f8205[_0x3dfc('0x41')][_0x3dfc('0x2a')]);}return _0x37aee5[_0x3dfc('0xe0')](_0x34eed0);}})[_0x3dfc('0x1d')](function(_0x427a86){if(_0x427a86){return _0x427a86?{'count':_0x198093,'rows':_0x427a86}:null;}})[_0x3dfc('0x1d')](respondWithResult(_0x166f28,null))[_0x3dfc('0x26')](handleError(_0x166f28,null));}; \ No newline at end of file +var _0x1e8f=['addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','client','http','request','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','SmsAccount,\x20%s,\x20%s','message','catch','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','get','SmsAccounts','UserProfileResource','name','send','Pause','rawAttributes','type','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','SmsAccount','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','addDisposition','SmsAccountId','Disposition','getDispositions','pick','ids','addAnswer','CannedAnswer','removeAnswers','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','sender','text','connectel','message_id','MessageUUID','infobip','results','csc','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','ValidationError','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','DESC','list','omit','Contacts','defaults','CmContact','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','waitForTheAssignedAgent','startRouting','Start','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','bulkCreate','findAndCountAll','stack','getApplications','getInteractions','Owner','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','CmList','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','clicksend','status_code','groupName','DELIVERED','redif','skebby','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1e8f,0xe8));var _0xf1e8=function(_0xdbf751,_0x5530ba){_0xdbf751=_0xdbf751-0x0;var _0x577219=_0x1e8f[_0xdbf751];return _0x577219;};'use strict';var emlformat=require(_0xf1e8('0x0'));var rimraf=require(_0xf1e8('0x1'));var zipdir=require(_0xf1e8('0x2'));var jsonpatch=require(_0xf1e8('0x3'));var rp=require(_0xf1e8('0x4'));var moment=require(_0xf1e8('0x5'));var BPromise=require(_0xf1e8('0x6'));var Mustache=require(_0xf1e8('0x7'));var util=require(_0xf1e8('0x8'));var path=require(_0xf1e8('0x9'));var sox=require('sox');var csv=require(_0xf1e8('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf1e8('0xb'));var _=require(_0xf1e8('0xc'));var squel=require('squel');var crypto=require(_0xf1e8('0xd'));var jsforce=require(_0xf1e8('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf1e8('0xa'));var querystring=require(_0xf1e8('0xf'));var Papa=require(_0xf1e8('0x10'));var Redis=require('ioredis');var authService=require(_0xf1e8('0x11'));var qs=require(_0xf1e8('0x12'));var as=require(_0xf1e8('0x13'));var hardwareService=require(_0xf1e8('0x14'));var logger=require(_0xf1e8('0x15'))(_0xf1e8('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf1e8('0x17'))['db'];config['redis']=_['defaults'](config[_0xf1e8('0x18')],{'host':_0xf1e8('0x19'),'port':0x18eb});var socket=require(_0xf1e8('0x1a'))(new Redis(config[_0xf1e8('0x18')]));require(_0xf1e8('0x1b'))['register'](socket);var jayson=require(_0xf1e8('0x1c'));var client=jayson[_0xf1e8('0x1d')][_0xf1e8('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x213d62,_0x50da79,_0x2c539c,_0x1f1be0){return new BPromise(function(_0xe5efef,_0x362bc3){var _0x17b724=_0x1f1be0||client;return _0x17b724[_0xf1e8('0x1f')](_0x213d62,_0x2c539c)[_0xf1e8('0x20')](function(_0x20d97c){logger[_0xf1e8('0x21')]('SmsAccount,\x20%s,\x20%s',_0x50da79,_0xf1e8('0x22'));logger[_0xf1e8('0x23')](_0xf1e8('0x24'),_0x50da79,_0xf1e8('0x22'),JSON['stringify'](_0x20d97c));if(_0x20d97c[_0xf1e8('0x25')]){if(_0x20d97c['error']['code']===0x1f4){logger[_0xf1e8('0x25')](_0xf1e8('0x26'),_0x50da79,_0x20d97c[_0xf1e8('0x25')][_0xf1e8('0x27')]);return _0x362bc3(_0x20d97c[_0xf1e8('0x25')]['message']);}logger[_0xf1e8('0x25')](_0xf1e8('0x26'),_0x50da79,_0x20d97c[_0xf1e8('0x25')][_0xf1e8('0x27')]);return _0xe5efef(_0x20d97c[_0xf1e8('0x25')][_0xf1e8('0x27')]);}else{logger[_0xf1e8('0x21')](_0xf1e8('0x26'),_0x50da79,_0xf1e8('0x22'));_0xe5efef(_0x20d97c['result'][_0xf1e8('0x27')]);}})[_0xf1e8('0x28')](function(_0x4b6a0f){logger[_0xf1e8('0x25')]('SmsAccount,\x20%s,\x20%s',_0x50da79,_0x4b6a0f);_0x362bc3(_0x4b6a0f);});});}function respondWithStatusCode(_0xe851c9,_0x2e8e47){_0x2e8e47=_0x2e8e47||0xcc;return function(_0x39d53f){if(_0x39d53f){return _0xe851c9[_0xf1e8('0x29')](_0x2e8e47);}return _0xe851c9['status'](_0x2e8e47)[_0xf1e8('0x2a')]();};}function respondWithResult(_0x5c6096,_0x948ff2){_0x948ff2=_0x948ff2||0xc8;return function(_0x1a7f71){if(_0x1a7f71){return _0x5c6096[_0xf1e8('0x2b')](_0x948ff2)['json'](_0x1a7f71);}};}function respondWithFilteredResult(_0x337405,_0x22471a){return function(_0x3a6a2f){if(_0x3a6a2f){var _0x4bf36c=typeof _0x22471a[_0xf1e8('0x2c')]===_0xf1e8('0x2d')&&typeof _0x22471a['limit']===_0xf1e8('0x2d');var _0x1d551b=_0x3a6a2f[_0xf1e8('0x2e')];var _0x2b45a3=_0x4bf36c?0x0:_0x22471a[_0xf1e8('0x2c')];var _0x11d18e=_0x4bf36c?_0x3a6a2f['count']:_0x22471a[_0xf1e8('0x2c')]+_0x22471a[_0xf1e8('0x2f')];var _0x1fe184;if(_0x11d18e>=_0x1d551b){_0x11d18e=_0x1d551b;_0x1fe184=0xc8;}else{_0x1fe184=0xce;}_0x337405[_0xf1e8('0x2b')](_0x1fe184);return _0x337405[_0xf1e8('0x30')](_0xf1e8('0x31'),_0x2b45a3+'-'+_0x11d18e+'/'+_0x1d551b)[_0xf1e8('0x32')](_0x3a6a2f);}return null;};}function patchUpdates(_0x4123f1){return function(_0x4327ac){try{jsonpatch[_0xf1e8('0x33')](_0x4327ac,_0x4123f1,!![]);}catch(_0x1fff5a){return BPromise[_0xf1e8('0x34')](_0x1fff5a);}return _0x4327ac[_0xf1e8('0x35')]();};}function saveUpdates(_0x19bb25,_0x2aaff8){return function(_0xbff5dd){if(_0xbff5dd){return _0xbff5dd[_0xf1e8('0x36')](_0x19bb25)[_0xf1e8('0x20')](function(_0x2d0226){return _0x2d0226;});}return null;};}function removeEntity(_0x1159a2,_0x55c092){return function(_0x263ecc){if(_0x263ecc){return _0x263ecc['destroy']()[_0xf1e8('0x20')](function(){var _0x843dc8=_0x263ecc[_0xf1e8('0x37')]({'plain':!![]});var _0x10d0e3=_0xf1e8('0x38');return db[_0xf1e8('0x39')]['destroy']({'where':{'type':_0x10d0e3,'resourceId':_0x843dc8['id']}})[_0xf1e8('0x20')](function(){return _0x263ecc;});})[_0xf1e8('0x20')](function(){_0x1159a2[_0xf1e8('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3238b0,_0x346f2c){return function(_0x41077c){if(!_0x41077c){_0x3238b0[_0xf1e8('0x29')](0x194);}return _0x41077c;};}function handleError(_0x28f2a9,_0x4d29aa){_0x4d29aa=_0x4d29aa||0x1f4;return function(_0x1396d4){logger[_0xf1e8('0x25')](_0x1396d4['stack']);if(_0x1396d4[_0xf1e8('0x3a')]){delete _0x1396d4[_0xf1e8('0x3a')];}_0x28f2a9[_0xf1e8('0x2b')](_0x4d29aa)[_0xf1e8('0x3b')](_0x1396d4);};}exports['index']=function(_0x3491d2,_0x3e410f){var _0x556047={'include':[{'model':db[_0xf1e8('0x3c')],'as':'mandatoryDispositionPause'}]},_0xebfeac={},_0x5cf72d={'count':0x0,'rows':[]};var _0x108ed8=_['map'](db['SmsAccount'][_0xf1e8('0x3d')],function(_0x49d48c){return{'name':_0x49d48c['fieldName'],'type':_0x49d48c[_0xf1e8('0x3e')]['key']};});_0xebfeac['model']=_[_0xf1e8('0x3f')](_0x108ed8,_0xf1e8('0x3a'));_0xebfeac[_0xf1e8('0x40')]=_[_0xf1e8('0x41')](_0x3491d2[_0xf1e8('0x40')]);_0xebfeac[_0xf1e8('0x42')]=_['intersection'](_0xebfeac[_0xf1e8('0x43')],_0xebfeac[_0xf1e8('0x40')]);_0x556047[_0xf1e8('0x44')]=_[_0xf1e8('0x45')](_0xebfeac[_0xf1e8('0x43')],qs[_0xf1e8('0x46')](_0x3491d2['query']['fields']));_0x556047[_0xf1e8('0x44')]=_0x556047[_0xf1e8('0x44')][_0xf1e8('0x47')]?_0x556047[_0xf1e8('0x44')]:_0xebfeac[_0xf1e8('0x43')];if(!_0x3491d2[_0xf1e8('0x40')][_0xf1e8('0x48')](_0xf1e8('0x49'))){_0x556047['limit']=qs[_0xf1e8('0x2f')](_0x3491d2[_0xf1e8('0x40')][_0xf1e8('0x2f')]);_0x556047[_0xf1e8('0x2c')]=qs[_0xf1e8('0x2c')](_0x3491d2[_0xf1e8('0x40')][_0xf1e8('0x2c')]);}_0x556047[_0xf1e8('0x4a')]=qs[_0xf1e8('0x4b')](_0x3491d2['query']['sort']);_0x556047[_0xf1e8('0x4c')]=qs[_0xf1e8('0x42')](_['pick'](_0x3491d2[_0xf1e8('0x40')],_0xebfeac['filters']),_0x108ed8);if(_0x3491d2['query'][_0xf1e8('0x4d')]){_0x556047[_0xf1e8('0x4c')]=_[_0xf1e8('0x4e')](_0x556047['where'],{'$or':_[_0xf1e8('0x3f')](_0x108ed8,function(_0x31c7a3){if(_0x31c7a3[_0xf1e8('0x3e')]!==_0xf1e8('0x4f')){var _0x317ff8={};_0x317ff8[_0x31c7a3[_0xf1e8('0x3a')]]={'$like':'%'+_0x3491d2[_0xf1e8('0x40')][_0xf1e8('0x4d')]+'%'};return _0x317ff8;}})});}_0x556047=_[_0xf1e8('0x4e')]({},_0x556047,_0x3491d2[_0xf1e8('0x50')]);var _0x543126={'where':_0x556047[_0xf1e8('0x4c')]};return db[_0xf1e8('0x51')][_0xf1e8('0x2e')](_0x543126)[_0xf1e8('0x20')](function(_0x56b8db){_0x5cf72d[_0xf1e8('0x2e')]=_0x56b8db;if(_0x3491d2['query'][_0xf1e8('0x52')]){_0x556047[_0xf1e8('0x53')]=[{'all':!![]}];}return db[_0xf1e8('0x51')][_0xf1e8('0x54')](_0x556047);})[_0xf1e8('0x20')](function(_0x49f658){_0x5cf72d[_0xf1e8('0x55')]=_0x49f658;return _0x5cf72d;})['then'](respondWithFilteredResult(_0x3e410f,_0x556047))[_0xf1e8('0x28')](handleError(_0x3e410f,null));};exports[_0xf1e8('0x56')]=function(_0x21530d,_0xc9b38f){var _0x24f332={'raw':![],'where':{'id':_0x21530d[_0xf1e8('0x57')]['id']},'include':[{'model':db[_0xf1e8('0x3c')],'as':_0xf1e8('0x58')}]},_0x6983e3={};_0x6983e3[_0xf1e8('0x43')]=_[_0xf1e8('0x41')](db[_0xf1e8('0x51')][_0xf1e8('0x3d')]);_0x6983e3[_0xf1e8('0x40')]=_[_0xf1e8('0x41')](_0x21530d['query']);_0x6983e3['filters']=_[_0xf1e8('0x45')](_0x6983e3[_0xf1e8('0x43')],_0x6983e3[_0xf1e8('0x40')]);_0x24f332[_0xf1e8('0x44')]=_['intersection'](_0x6983e3[_0xf1e8('0x43')],qs['fields'](_0x21530d['query']['fields']));_0x24f332[_0xf1e8('0x44')]=_0x24f332['attributes'][_0xf1e8('0x47')]?_0x24f332[_0xf1e8('0x44')]:_0x6983e3[_0xf1e8('0x43')];if(_0x21530d[_0xf1e8('0x40')][_0xf1e8('0x52')]){_0x24f332[_0xf1e8('0x53')]=[{'all':!![]}];}_0x24f332=_[_0xf1e8('0x4e')]({},_0x24f332,_0x21530d[_0xf1e8('0x50')]);return db[_0xf1e8('0x51')]['find'](_0x24f332)[_0xf1e8('0x20')](handleEntityNotFound(_0xc9b38f,null))['then'](respondWithResult(_0xc9b38f,null))['catch'](handleError(_0xc9b38f,null));};exports[_0xf1e8('0x59')]=function(_0x77e3ac,_0x13b620){return db[_0xf1e8('0x51')]['create'](_0x77e3ac[_0xf1e8('0x5a')],{})[_0xf1e8('0x20')](function(_0x484cc6){var _0x3993bb=_0x77e3ac[_0xf1e8('0x5b')][_0xf1e8('0x37')]({'plain':!![]});if(!_0x3993bb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3993bb[_0xf1e8('0x5c')]===_0xf1e8('0x5b')){var _0x196e95=_0x484cc6[_0xf1e8('0x37')]({'plain':!![]});var _0x48d3ea=_0xf1e8('0x38');return db[_0xf1e8('0x5d')][_0xf1e8('0x5e')]({'where':{'name':_0x48d3ea,'userProfileId':_0x3993bb[_0xf1e8('0x5f')]},'raw':!![]})['then'](function(_0x2846a1){if(_0x2846a1&&_0x2846a1[_0xf1e8('0x60')]===0x0){return db[_0xf1e8('0x39')][_0xf1e8('0x59')]({'name':_0x196e95[_0xf1e8('0x3a')],'resourceId':_0x196e95['id'],'type':_0x2846a1[_0xf1e8('0x3a')],'sectionId':_0x2846a1['id']},{})[_0xf1e8('0x20')](function(){return _0x484cc6;});}else{return _0x484cc6;}})['catch'](function(_0x4a0eac){logger[_0xf1e8('0x25')](_0xf1e8('0x61'),_0x4a0eac);throw _0x4a0eac;});}return _0x484cc6;})[_0xf1e8('0x20')](respondWithResult(_0x13b620,0xc9))[_0xf1e8('0x28')](handleError(_0x13b620,null));};exports[_0xf1e8('0x36')]=function(_0x325dc5,_0x2a8037){if(_0x325dc5[_0xf1e8('0x5a')]['id']){delete _0x325dc5[_0xf1e8('0x5a')]['id'];}return db[_0xf1e8('0x51')]['find']({'where':{'id':_0x325dc5[_0xf1e8('0x57')]['id']},'include':[{'model':db[_0xf1e8('0x3c')],'as':_0xf1e8('0x58')}]})[_0xf1e8('0x20')](handleEntityNotFound(_0x2a8037,null))['then'](saveUpdates(_0x325dc5['body'],null))[_0xf1e8('0x20')](respondWithResult(_0x2a8037,null))['catch'](handleError(_0x2a8037,null));};exports[_0xf1e8('0x62')]=function(_0xdb2923,_0x376660){return db[_0xf1e8('0x51')][_0xf1e8('0x5e')]({'where':{'id':_0xdb2923[_0xf1e8('0x57')]['id']}})[_0xf1e8('0x20')](handleEntityNotFound(_0x376660,null))[_0xf1e8('0x20')](removeEntity(_0x376660,null))[_0xf1e8('0x28')](handleError(_0x376660,null));};exports[_0xf1e8('0x63')]=function(_0x129601,_0x3b2d7c){return db[_0xf1e8('0x51')]['describe']()[_0xf1e8('0x20')](respondWithResult(_0x3b2d7c,null))[_0xf1e8('0x28')](handleError(_0x3b2d7c,null));};exports[_0xf1e8('0x64')]=function(_0x3c0d04,_0x1b14fa,_0x21b67d){if(_0x3c0d04[_0xf1e8('0x5a')]['id']){delete _0x3c0d04[_0xf1e8('0x5a')]['id'];}return db[_0xf1e8('0x51')][_0xf1e8('0x5e')]({'where':{'id':_0x3c0d04[_0xf1e8('0x57')]['id']}})['then'](handleEntityNotFound(_0x1b14fa,null))[_0xf1e8('0x20')](function(_0x61d109){if(_0x61d109){_0x3c0d04[_0xf1e8('0x5a')][_0xf1e8('0x65')]=_0x61d109['id'];return db[_0xf1e8('0x66')]['create'](_0x3c0d04['body']);}})[_0xf1e8('0x20')](respondWithResult(_0x1b14fa,null))[_0xf1e8('0x28')](handleError(_0x1b14fa,null));};exports[_0xf1e8('0x67')]=function(_0xa75a6c,_0x5cdf59,_0x242a5e){var _0x1815c2={'raw':![],'where':{}};var _0x40e1a8={};var _0x2d0595={'count':0x0,'rows':[]};return db[_0xf1e8('0x51')]['findOne']({'where':{'id':_0xa75a6c['params']['id']}})['then'](handleEntityNotFound(_0x5cdf59,null))[_0xf1e8('0x20')](function(_0x25ff64){if(_0x25ff64){_0x40e1a8[_0xf1e8('0x43')]=_[_0xf1e8('0x41')](db[_0xf1e8('0x66')][_0xf1e8('0x3d')]);_0x40e1a8[_0xf1e8('0x40')]=_['keys'](_0xa75a6c[_0xf1e8('0x40')]);_0x40e1a8[_0xf1e8('0x42')]=_['intersection'](_0x40e1a8[_0xf1e8('0x43')],_0x40e1a8[_0xf1e8('0x40')]);_0x1815c2[_0xf1e8('0x44')]=_[_0xf1e8('0x45')](_0x40e1a8[_0xf1e8('0x43')],qs[_0xf1e8('0x46')](_0xa75a6c[_0xf1e8('0x40')][_0xf1e8('0x46')]));_0x1815c2[_0xf1e8('0x44')]=_0x1815c2[_0xf1e8('0x44')][_0xf1e8('0x47')]?_0x1815c2[_0xf1e8('0x44')]:_0x40e1a8[_0xf1e8('0x43')];if(!_0xa75a6c[_0xf1e8('0x40')][_0xf1e8('0x48')](_0xf1e8('0x49'))){_0x1815c2[_0xf1e8('0x2f')]=qs[_0xf1e8('0x2f')](_0xa75a6c[_0xf1e8('0x40')]['limit']);_0x1815c2[_0xf1e8('0x2c')]=qs[_0xf1e8('0x2c')](_0xa75a6c['query'][_0xf1e8('0x2c')]);}_0x1815c2[_0xf1e8('0x4a')]=qs[_0xf1e8('0x4b')](_0xa75a6c['query'][_0xf1e8('0x4b')]);_0x1815c2[_0xf1e8('0x4c')]=qs[_0xf1e8('0x42')](_[_0xf1e8('0x68')](_0xa75a6c[_0xf1e8('0x40')],_0x40e1a8[_0xf1e8('0x42')]));_0x1815c2[_0xf1e8('0x4c')][_0xf1e8('0x65')]=_0x25ff64['id'];if(_0xa75a6c[_0xf1e8('0x40')][_0xf1e8('0x4d')]){_0x1815c2['where']=_[_0xf1e8('0x4e')](_0x1815c2[_0xf1e8('0x4c')],{'$or':_[_0xf1e8('0x3f')](_0x1815c2[_0xf1e8('0x44')],function(_0x502b1e){var _0x2450c6={};_0x2450c6[_0x502b1e]={'$like':'%'+_0xa75a6c[_0xf1e8('0x40')][_0xf1e8('0x4d')]+'%'};return _0x2450c6;})});}_0x1815c2=_[_0xf1e8('0x4e')]({},_0x1815c2,_0xa75a6c['options']);return db[_0xf1e8('0x66')][_0xf1e8('0x2e')]({'where':_0x1815c2[_0xf1e8('0x4c')]})[_0xf1e8('0x20')](function(_0x1047af){_0x2d0595[_0xf1e8('0x2e')]=_0x1047af;if(_0xa75a6c['query'][_0xf1e8('0x52')]){_0x1815c2[_0xf1e8('0x53')]=[{'all':!![]}];}return db[_0xf1e8('0x66')]['findAll'](_0x1815c2);})[_0xf1e8('0x20')](function(_0x452210){_0x2d0595[_0xf1e8('0x55')]=_0x452210;return _0x2d0595;});}})[_0xf1e8('0x20')](respondWithFilteredResult(_0x5cdf59,_0x1815c2))[_0xf1e8('0x28')](handleError(_0x5cdf59,null));};exports['removeDispositions']=function(_0x5936b0,_0x70e3b1,_0x3230bd){return db[_0xf1e8('0x51')][_0xf1e8('0x5e')]({'where':{'id':_0x5936b0['params']['id']}})[_0xf1e8('0x20')](handleEntityNotFound(_0x70e3b1,null))['then'](function(_0x493d76){if(_0x493d76){return _0x493d76['removeDispositions'](_0x5936b0[_0xf1e8('0x40')][_0xf1e8('0x69')]);}})[_0xf1e8('0x20')](respondWithStatusCode(_0x70e3b1,null))[_0xf1e8('0x28')](handleError(_0x70e3b1,null));};exports[_0xf1e8('0x6a')]=function(_0x480e8b,_0x1d619e,_0xf021d0){if(_0x480e8b['body']['id']){delete _0x480e8b[_0xf1e8('0x5a')]['id'];}return db[_0xf1e8('0x51')][_0xf1e8('0x5e')]({'where':{'id':_0x480e8b[_0xf1e8('0x57')]['id']}})[_0xf1e8('0x20')](handleEntityNotFound(_0x1d619e,null))[_0xf1e8('0x20')](function(_0x3da1a4){if(_0x3da1a4){_0x480e8b['body'][_0xf1e8('0x65')]=_0x3da1a4['id'];return db[_0xf1e8('0x6b')][_0xf1e8('0x59')](_0x480e8b[_0xf1e8('0x5a')]);}})[_0xf1e8('0x20')](respondWithResult(_0x1d619e,null))['catch'](handleError(_0x1d619e,null));};exports['getAnswers']=function(_0x43c453,_0x4a2ca7,_0x5f3829){var _0x342061={'raw':![],'where':{}};var _0x1c9db8={};var _0x4aeffe={'count':0x0,'rows':[]};return db[_0xf1e8('0x51')]['findOne']({'where':{'id':_0x43c453[_0xf1e8('0x57')]['id']}})[_0xf1e8('0x20')](handleEntityNotFound(_0x4a2ca7,null))['then'](function(_0x4038d4){if(_0x4038d4){_0x1c9db8[_0xf1e8('0x43')]=_[_0xf1e8('0x41')](db[_0xf1e8('0x6b')][_0xf1e8('0x3d')]);_0x1c9db8[_0xf1e8('0x40')]=_[_0xf1e8('0x41')](_0x43c453[_0xf1e8('0x40')]);_0x1c9db8['filters']=_[_0xf1e8('0x45')](_0x1c9db8['model'],_0x1c9db8[_0xf1e8('0x40')]);_0x342061[_0xf1e8('0x44')]=_[_0xf1e8('0x45')](_0x1c9db8[_0xf1e8('0x43')],qs['fields'](_0x43c453[_0xf1e8('0x40')][_0xf1e8('0x46')]));_0x342061[_0xf1e8('0x44')]=_0x342061[_0xf1e8('0x44')]['length']?_0x342061[_0xf1e8('0x44')]:_0x1c9db8[_0xf1e8('0x43')];if(!_0x43c453[_0xf1e8('0x40')][_0xf1e8('0x48')]('nolimit')){_0x342061[_0xf1e8('0x2f')]=qs[_0xf1e8('0x2f')](_0x43c453[_0xf1e8('0x40')][_0xf1e8('0x2f')]);_0x342061[_0xf1e8('0x2c')]=qs['offset'](_0x43c453['query'][_0xf1e8('0x2c')]);}_0x342061[_0xf1e8('0x4a')]=qs['sort'](_0x43c453[_0xf1e8('0x40')][_0xf1e8('0x4b')]);_0x342061[_0xf1e8('0x4c')]=qs[_0xf1e8('0x42')](_[_0xf1e8('0x68')](_0x43c453[_0xf1e8('0x40')],_0x1c9db8[_0xf1e8('0x42')]));_0x342061['where'][_0xf1e8('0x65')]=_0x4038d4['id'];if(_0x43c453[_0xf1e8('0x40')][_0xf1e8('0x4d')]){_0x342061[_0xf1e8('0x4c')]=_[_0xf1e8('0x4e')](_0x342061[_0xf1e8('0x4c')],{'$or':_[_0xf1e8('0x3f')](_0x342061[_0xf1e8('0x44')],function(_0x42fac2){var _0x578725={};_0x578725[_0x42fac2]={'$like':'%'+_0x43c453['query'][_0xf1e8('0x4d')]+'%'};return _0x578725;})});}_0x342061=_[_0xf1e8('0x4e')]({},_0x342061,_0x43c453[_0xf1e8('0x50')]);return db[_0xf1e8('0x6b')][_0xf1e8('0x2e')]({'where':_0x342061[_0xf1e8('0x4c')]})['then'](function(_0x4762c5){_0x4aeffe[_0xf1e8('0x2e')]=_0x4762c5;if(_0x43c453[_0xf1e8('0x40')][_0xf1e8('0x52')]){_0x342061[_0xf1e8('0x53')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x342061);})[_0xf1e8('0x20')](function(_0x43d4fd){_0x4aeffe[_0xf1e8('0x55')]=_0x43d4fd;return _0x4aeffe;});}})[_0xf1e8('0x20')](respondWithFilteredResult(_0x4a2ca7,_0x342061))[_0xf1e8('0x28')](handleError(_0x4a2ca7,null));};exports[_0xf1e8('0x6c')]=function(_0x3cab35,_0x1c4c72,_0x1d5262){return db[_0xf1e8('0x51')][_0xf1e8('0x5e')]({'where':{'id':_0x3cab35[_0xf1e8('0x57')]['id']}})[_0xf1e8('0x20')](handleEntityNotFound(_0x1c4c72,null))[_0xf1e8('0x20')](function(_0x3ae2ef){if(_0x3ae2ef){return _0x3ae2ef['removeAnswers'](_0x3cab35['query'][_0xf1e8('0x69')]);}})[_0xf1e8('0x20')](respondWithStatusCode(_0x1c4c72,null))[_0xf1e8('0x28')](handleError(_0x1c4c72,null));};exports['notify']=function(_0x355858,_0x2ab330,_0x2192ab){var _0x39963d={'channel':_0xf1e8('0x6d')};var _0x35fcc6=[];var _0x1a1018=[];var _0x440fe9={};return db[_0xf1e8('0x51')][_0xf1e8('0x5e')]({'where':{'id':_0x355858[_0xf1e8('0x57')]['id']},'include':[{'model':db[_0xf1e8('0x6e')],'as':_0xf1e8('0x6f')}]})['then'](handleEntityNotFound(_0x2ab330,null))[_0xf1e8('0x20')](function(_0x17a34a){_0x39963d[_0xf1e8('0x70')]=_0x17a34a;_0x39963d[_0xf1e8('0x71')]=_[_0xf1e8('0x72')](_0x17a34a[_0xf1e8('0x6f')],[_0xf1e8('0x73')],[_0xf1e8('0x74')]);if(_0x39963d[_0xf1e8('0x70')]['Applications']){delete _0x39963d[_0xf1e8('0x70')]['Applications'];}return db['CmContact'][_0xf1e8('0x63')]();})[_0xf1e8('0x20')](function(_0x51135f){if(!_0x51135f){throw new db[(_0xf1e8('0x75'))]['ValidationError'](_0xf1e8('0x76'));}_0x35fcc6=_[_0xf1e8('0x77')](_['keys'](_0x51135f),[_0xf1e8('0x78'),_0xf1e8('0x79')]);_0x1a1018=_['difference'](_['keys'](_0x51135f),[_0xf1e8('0x78'),'updatedAt',_0xf1e8('0x7a'),_0xf1e8('0x7b')]);_0x39963d[_0xf1e8('0x5a')]={'mapKey':_0xf1e8('0x7c')};if(_0x39963d[_0xf1e8('0x70')]['type']){switch(_0x39963d['account'][_0xf1e8('0x3e')]){case _0xf1e8('0x7d'):_0x39963d[_0xf1e8('0x5a')][_0xf1e8('0x7e')]=_0x355858[_0xf1e8('0x5a')][_0xf1e8('0x7f')];_0x39963d[_0xf1e8('0x5a')][_0xf1e8('0x5a')]=_0x355858[_0xf1e8('0x5a')][_0xf1e8('0x80')];_0x39963d['body'][_0xf1e8('0x81')]=_0x355858[_0xf1e8('0x5a')]['MessageSid'];break;case'skebby':_0x39963d[_0xf1e8('0x5a')][_0xf1e8('0x7e')]='+'+_0x355858['body'][_0xf1e8('0x82')];_0x39963d[_0xf1e8('0x5a')][_0xf1e8('0x5a')]=_0x355858[_0xf1e8('0x5a')][_0xf1e8('0x83')];break;case _0xf1e8('0x84'):_0x39963d[_0xf1e8('0x5a')][_0xf1e8('0x7e')]=_0x355858[_0xf1e8('0x5a')]['from'];_0x39963d[_0xf1e8('0x5a')][_0xf1e8('0x5a')]=_0x355858[_0xf1e8('0x5a')][_0xf1e8('0x27')];break;case'clicksend':_0x39963d[_0xf1e8('0x5a')][_0xf1e8('0x7e')]=_0x355858['body'][_0xf1e8('0x7e')];_0x39963d[_0xf1e8('0x5a')]['body']=_0x355858[_0xf1e8('0x5a')][_0xf1e8('0x5a')];_0x39963d['body'][_0xf1e8('0x81')]=_0x355858['body'][_0xf1e8('0x85')];break;case'plivo':_0x39963d[_0xf1e8('0x5a')]['from']=_0x355858['body'][_0xf1e8('0x7f')];_0x39963d[_0xf1e8('0x5a')]['body']=_0x355858[_0xf1e8('0x5a')]['Text'];_0x39963d[_0xf1e8('0x5a')][_0xf1e8('0x81')]=_0x355858[_0xf1e8('0x5a')][_0xf1e8('0x86')];break;case _0xf1e8('0x87'):_0x39963d[_0xf1e8('0x5a')][_0xf1e8('0x7e')]='+'+_0x355858[_0xf1e8('0x5a')]['results'][0x0]['from'];_0x39963d[_0xf1e8('0x5a')][_0xf1e8('0x5a')]=_0x355858[_0xf1e8('0x5a')][_0xf1e8('0x88')][0x0][_0xf1e8('0x83')];_0x39963d[_0xf1e8('0x5a')][_0xf1e8('0x81')]=_0x355858['body'][_0xf1e8('0x88')][0x0][_0xf1e8('0x81')];break;case _0xf1e8('0x89'):_0x39963d[_0xf1e8('0x5a')][_0xf1e8('0x7e')]=_0x355858[_0xf1e8('0x5a')]['originatingAddress'];_0x39963d[_0xf1e8('0x5a')][_0xf1e8('0x5a')]=_0x355858[_0xf1e8('0x5a')][_0xf1e8('0x8a')][_0xf1e8('0x27')];break;case _0xf1e8('0x8b'):_0x39963d[_0xf1e8('0x5a')]['from']=_0x355858[_0xf1e8('0x5a')][_0xf1e8('0x8c')];_0x39963d[_0xf1e8('0x5a')]['body']=_0x355858[_0xf1e8('0x5a')][_0xf1e8('0x83')];_0x39963d[_0xf1e8('0x5a')][_0xf1e8('0x81')]=_0x355858[_0xf1e8('0x5a')][_0xf1e8('0x8d')];break;case _0xf1e8('0x8e'):_0x39963d['body']['messageId']=_0x355858[_0xf1e8('0x5a')][0x0][_0xf1e8('0x27')]['id'];_0x39963d[_0xf1e8('0x5a')][_0xf1e8('0x7e')]=_0x355858[_0xf1e8('0x5a')][0x0][_0xf1e8('0x27')][_0xf1e8('0x7e')];_0x39963d[_0xf1e8('0x5a')][_0xf1e8('0x5a')]=_0x355858[_0xf1e8('0x5a')][0x0][_0xf1e8('0x27')][_0xf1e8('0x83')];break;case _0xf1e8('0x8f'):_0x39963d['body']['from']=_0x355858[_0xf1e8('0x5a')][_0xf1e8('0x7e')];_0x39963d[_0xf1e8('0x5a')][_0xf1e8('0x5a')]=_0x355858[_0xf1e8('0x5a')]['message'];_0x39963d[_0xf1e8('0x5a')][_0xf1e8('0x81')]=_0x355858['body'][_0xf1e8('0x90')];break;}}if(_0x39963d['body']['id']){delete _0x39963d[_0xf1e8('0x5a')]['id'];}if(_['isNil'](_0x39963d[_0xf1e8('0x5a')][_0xf1e8('0x7e')])){throw new db[(_0xf1e8('0x75'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0xf1e8('0x91')](_0x39963d['body']['body'])||_0x39963d[_0xf1e8('0x5a')][_0xf1e8('0x5a')]===''){throw new db[(_0xf1e8('0x75'))][(_0xf1e8('0x92'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xf1e8('0x91')](_0x39963d[_0xf1e8('0x5a')][_0xf1e8('0x93')])){throw new db[(_0xf1e8('0x75'))][(_0xf1e8('0x92'))](_0xf1e8('0x94')+_0x1a1018);}if(!_[_0xf1e8('0x95')](_0x1a1018,_0x39963d[_0xf1e8('0x5a')][_0xf1e8('0x93')])){throw new db['Sequelize'][(_0xf1e8('0x92'))](_0xf1e8('0x96')+_0x1a1018);}_0x440fe9[_0x39963d[_0xf1e8('0x5a')][_0xf1e8('0x93')]]=_0x39963d[_0xf1e8('0x5a')][_0xf1e8('0x7e')];return db['CmList'][_0xf1e8('0x5e')]({'where':{'id':_0x39963d['account'][_0xf1e8('0x7b')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x440fe9,'limit':0x1,'order':[[_0xf1e8('0x79'),_0xf1e8('0x97')]]}]});})[_0xf1e8('0x20')](handleEntityNotFound(_0x2ab330,null))[_0xf1e8('0x20')](function(_0x25225a){if(_0x25225a){_0x39963d[_0xf1e8('0x98')]=_[_0xf1e8('0x99')](_0x25225a,[_0xf1e8('0x9a')]);if(_0x25225a[_0xf1e8('0x9a')][_0xf1e8('0x47')]){return _0x25225a[_0xf1e8('0x9a')][0x0];}var _0xe24a2c=_[_0xf1e8('0x9b')](_0x39963d['body'],{'firstName':_0x39963d[_0xf1e8('0x5a')][_0xf1e8('0x7e')],'ListId':_0x25225a['id']});_0xe24a2c[_0x39963d[_0xf1e8('0x5a')][_0xf1e8('0x93')]]=_0x39963d[_0xf1e8('0x5a')][_0xf1e8('0x7e')];return db[_0xf1e8('0x9c')][_0xf1e8('0x59')](_0xe24a2c,{'fields':_0x35fcc6,'raw':!![]});}})[_0xf1e8('0x20')](handleEntityNotFound(_0x2ab330,null))[_0xf1e8('0x20')](function(_0x424cd7){if(_0x424cd7){_0x39963d[_0xf1e8('0x9d')]=_0x424cd7;var _0x35833c={'ContactId':_0x424cd7['id'],'phone':_0x39963d[_0xf1e8('0x5a')]['from'],'SmsAccountId':_0x355858[_0xf1e8('0x57')]['id']};var _0x195ef1={'ContactId':_0x424cd7['id'],'SmsAccountId':_0x355858[_0xf1e8('0x57')]['id'],'closed':![]};return db[_0xf1e8('0x9e')][_0xf1e8('0x5e')]({'where':_0x195ef1})[_0xf1e8('0x20')](function(_0x279d1e){if(_0x279d1e){return[_0x279d1e,![]];}return db[_0xf1e8('0x9e')][_0xf1e8('0x59')](_0x35833c)['then'](function(_0x1c0a39){return[_0x1c0a39,!![]];});});}})[_0xf1e8('0x9f')](function(_0x3dcd67,_0x127374){_0x39963d['interaction']=_0x3dcd67['get']({'plain':!![]});_0x39963d[_0xf1e8('0xa0')][_0xf1e8('0xa1')]=![];if(_0x127374){if(_0x39963d[_0xf1e8('0x70')][_0xf1e8('0xa2')]){_0x39963d[_0xf1e8('0x71')][_0xf1e8('0xa3')]({'id':0x0,'priority':_0x39963d[_0xf1e8('0x71')]['length']+0x1,'app':_0xf1e8('0xa4'),'appdata':_0xf1e8('0xa5'),'interval':_0xf1e8('0xa6')});}_0x39963d[_0xf1e8('0xa0')][_0xf1e8('0xa1')]=!![];}return db[_0xf1e8('0xa7')][_0xf1e8('0x59')]({'phone':_0x39963d[_0xf1e8('0x5a')]['from'],'messageId':_0x39963d[_0xf1e8('0x5a')][_0xf1e8('0x81')],'body':_0x39963d[_0xf1e8('0x5a')][_0xf1e8('0x5a')],'SmsAccountId':_0x355858[_0xf1e8('0x57')]['id'],'SmsInteractionId':_0x3dcd67['id'],'direction':'in','ContactId':_0x3dcd67[_0xf1e8('0xa8')],'AttachmentId':_0x39963d[_0xf1e8('0x5a')][_0xf1e8('0xa9')]});})[_0xf1e8('0x20')](function(_0x1255ca){_0x39963d[_0xf1e8('0x27')]=_0x1255ca;if(_0x39963d[_0xf1e8('0xa0')][_0xf1e8('0xaa')]){return db[_0xf1e8('0xab')][_0xf1e8('0x5e')]({'attributes':['id',_0xf1e8('0x3a')],'where':{'id':_0x39963d[_0xf1e8('0xa0')]['UserId']}})[_0xf1e8('0x20')](function(_0x2c1b94){if(_0x2c1b94){_0x39963d['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2c1b94['name']+','+(_0x39963d['account'][_0xf1e8('0xac')]||0xa),'interval':_0xf1e8('0xa6')});}return respondWithRpcPromise('Start',_0xf1e8('0xad'),_0x39963d);});}return respondWithRpcPromise(_0xf1e8('0xae'),_0xf1e8('0xad'),_0x39963d);})[_0xf1e8('0x20')](function(_0x513519){if(_0x513519){var _0x2188d9=0xc8;var _0x540457='receiveMessage';logger[_0xf1e8('0x21')](_0xf1e8('0x24'),_0x540457,_0x2188d9,_0xf1e8('0xaf'));logger[_0xf1e8('0x23')](_0xf1e8('0xb0'),_0x540457,_0x2188d9,_0xf1e8('0xaf'),JSON[_0xf1e8('0xb1')](_0x513519));if(_0x39963d[_0xf1e8('0x70')]['type']===_0xf1e8('0x7d')){return _0x2ab330['status'](_0x2188d9)[_0xf1e8('0x30')](_0xf1e8('0xb2'),_0xf1e8('0xb3'))['send'](_0xf1e8('0xb4'));}else{return _0x2ab330['status'](_0x2188d9)[_0xf1e8('0x32')](_0x513519);}}})[_0xf1e8('0x28')](handleError(_0x2ab330,null));};exports[_0xf1e8('0xb5')]=function(_0x1b05c5,_0x2ff7e0){var _0xc563bd=_0x1b05c5[_0xf1e8('0x57')]['id'];var _0x4e30c8=_0x1b05c5[_0xf1e8('0x5a')];var _0x453453=0xc8;var _0x223213=null;return db[_0xf1e8('0xb6')][_0xf1e8('0xb7')]({'isolationLevel':db['sequelize']['Transaction'][_0xf1e8('0xb8')][_0xf1e8('0xb9')]},function(_0x12030c){return db[_0xf1e8('0x51')][_0xf1e8('0xba')]({'where':{'id':_0xc563bd},'transaction':_0x12030c})[_0xf1e8('0x20')](function(_0x52632f){if(_0x52632f){return db[_0xf1e8('0x6e')][_0xf1e8('0x62')]({'where':{'SmsAccountId':_0xc563bd},'transaction':_0x12030c})[_0xf1e8('0x20')](function(){var _0xba56d8=_['map'](_0x4e30c8,function(_0x2e7c0d){_0x2e7c0d[_0xf1e8('0x65')]=_0xc563bd;return _0x2e7c0d;});return db[_0xf1e8('0x6e')][_0xf1e8('0xbb')](_0xba56d8,{'transaction':_0x12030c});});}else{_0x453453=0x194;_0x223213=[];}});})[_0xf1e8('0x20')](function(){if(_0x453453!==0x194){return db[_0xf1e8('0x6e')][_0xf1e8('0xbc')]({'where':{'SmsAccountId':_0xc563bd},'order':_0xf1e8('0x73')})['then'](function(_0x57d916){_0x223213=_0x57d916;});}})[_0xf1e8('0x28')](function(_0x5a29b3){_0x453453=0x1f4;logger[_0xf1e8('0x25')](_0x5a29b3[_0xf1e8('0xbd')]);if(_0x5a29b3['name']){delete _0x5a29b3['name'];}_0x223213=_0x5a29b3;})['finally'](function(){if(_0x223213===null){_0x2ff7e0['sendStatus'](_0x453453);}else{if(_0x453453===0x1f4){_0x2ff7e0[_0xf1e8('0x2b')](_0x453453)['send'](_0x223213);}else{_0x2ff7e0[_0xf1e8('0x2b')](_0x453453)['json'](_0x223213);}}});};exports[_0xf1e8('0xbe')]=function(_0x419458,_0x355abf,_0x10b5eb){var _0x30282e={};var _0x4891ac={};var _0x16cbdb;var _0x44d1d9;return db[_0xf1e8('0x51')]['findOne']({'where':{'id':_0x419458['params']['id']}})[_0xf1e8('0x20')](handleEntityNotFound(_0x355abf,null))[_0xf1e8('0x20')](function(_0x23156d){if(_0x23156d){_0x16cbdb=_0x23156d;_0x4891ac['model']=_[_0xf1e8('0x41')](db[_0xf1e8('0x6e')][_0xf1e8('0x3d')]);_0x4891ac['query']=_['keys'](_0x419458[_0xf1e8('0x40')]);_0x4891ac[_0xf1e8('0x42')]=_[_0xf1e8('0x45')](_0x4891ac['model'],_0x4891ac[_0xf1e8('0x40')]);_0x30282e[_0xf1e8('0x44')]=_[_0xf1e8('0x45')](_0x4891ac[_0xf1e8('0x43')],qs['fields'](_0x419458[_0xf1e8('0x40')]['fields']));_0x30282e[_0xf1e8('0x44')]=_0x30282e[_0xf1e8('0x44')][_0xf1e8('0x47')]?_0x30282e['attributes']:_0x4891ac[_0xf1e8('0x43')];_0x30282e[_0xf1e8('0x4a')]=qs[_0xf1e8('0x4b')](_0x419458[_0xf1e8('0x40')]['sort']);_0x30282e[_0xf1e8('0x4c')]=qs[_0xf1e8('0x42')](_[_0xf1e8('0x68')](_0x419458[_0xf1e8('0x40')],_0x4891ac[_0xf1e8('0x42')]));if(_0x419458[_0xf1e8('0x40')][_0xf1e8('0x4d')]){_0x30282e['where']=_[_0xf1e8('0x4e')](_0x30282e['where'],{'$or':_[_0xf1e8('0x3f')](_0x30282e[_0xf1e8('0x44')],function(_0x23b482){var _0x318117={};_0x318117[_0x23b482]={'$like':'%'+_0x419458[_0xf1e8('0x40')][_0xf1e8('0x4d')]+'%'};return _0x318117;})});}_0x30282e=_[_0xf1e8('0x4e')]({},_0x30282e,_0x419458[_0xf1e8('0x50')]);return _0x16cbdb[_0xf1e8('0xbe')](_0x30282e);}})['then'](function(_0x552c07){if(_0x552c07){_0x44d1d9=_0x552c07[_0xf1e8('0x47')];if(!_0x419458[_0xf1e8('0x40')][_0xf1e8('0x48')](_0xf1e8('0x49'))){_0x30282e['limit']=qs[_0xf1e8('0x2f')](_0x419458['query'][_0xf1e8('0x2f')]);_0x30282e[_0xf1e8('0x2c')]=qs['offset'](_0x419458[_0xf1e8('0x40')][_0xf1e8('0x2c')]);}return _0x16cbdb['getApplications'](_0x30282e);}})[_0xf1e8('0x20')](function(_0x2bfb53){if(_0x2bfb53){return _0x2bfb53?{'count':_0x44d1d9,'rows':_0x2bfb53}:null;}})[_0xf1e8('0x20')](respondWithResult(_0x355abf,null))[_0xf1e8('0x28')](handleError(_0x355abf,null));};exports[_0xf1e8('0xbf')]=function(_0x3476c5,_0x5bb1f4,_0x49ea59){var _0x44223c={'raw':![],'where':{}};var _0x3c0c89={};var _0x421e07={'count':0x0,'rows':[]};return db[_0xf1e8('0x51')][_0xf1e8('0xba')]({'where':{'id':_0x3476c5[_0xf1e8('0x57')]['id']}})[_0xf1e8('0x20')](handleEntityNotFound(_0x5bb1f4,null))[_0xf1e8('0x20')](function(_0x1f320b){if(_0x1f320b){_0x3c0c89[_0xf1e8('0x43')]=_[_0xf1e8('0x41')](db['SmsInteraction'][_0xf1e8('0x3d')]);_0x3c0c89[_0xf1e8('0x40')]=_[_0xf1e8('0x41')](_0x3476c5['query']);_0x3c0c89[_0xf1e8('0x42')]=_[_0xf1e8('0x45')](_0x3c0c89[_0xf1e8('0x43')],_0x3c0c89[_0xf1e8('0x40')]);_0x44223c[_0xf1e8('0x44')]=_[_0xf1e8('0x45')](_0x3c0c89[_0xf1e8('0x43')],qs[_0xf1e8('0x46')](_0x3476c5['query'][_0xf1e8('0x46')]));_0x44223c[_0xf1e8('0x44')]=_0x44223c[_0xf1e8('0x44')][_0xf1e8('0x47')]?_0x44223c[_0xf1e8('0x44')]:_0x3c0c89[_0xf1e8('0x43')];if(!_0x3476c5[_0xf1e8('0x40')][_0xf1e8('0x48')]('nolimit')){_0x44223c[_0xf1e8('0x2f')]=qs[_0xf1e8('0x2f')](_0x3476c5[_0xf1e8('0x40')][_0xf1e8('0x2f')]);_0x44223c['offset']=qs['offset'](_0x3476c5['query']['offset']);}_0x44223c[_0xf1e8('0x4a')]=qs['sort'](_0x3476c5[_0xf1e8('0x40')]['sort']);_0x44223c[_0xf1e8('0x4c')]=qs[_0xf1e8('0x42')](_[_0xf1e8('0x68')](_0x3476c5[_0xf1e8('0x40')],_0x3c0c89[_0xf1e8('0x42')]));_0x44223c[_0xf1e8('0x4c')][_0xf1e8('0x65')]=_0x1f320b['id'];if(_0x3476c5['query'][_0xf1e8('0x4d')]){_0x44223c[_0xf1e8('0x4c')]=_['merge'](_0x44223c[_0xf1e8('0x4c')],{'$or':_[_0xf1e8('0x3f')](_0x44223c[_0xf1e8('0x44')],function(_0x27e1f6){var _0x18cc60={};_0x18cc60[_0x27e1f6]={'$like':'%'+_0x3476c5[_0xf1e8('0x40')]['filter']+'%'};return _0x18cc60;})});}_0x44223c=_[_0xf1e8('0x4e')]({},_0x44223c,_0x3476c5[_0xf1e8('0x50')]);return db[_0xf1e8('0x9e')][_0xf1e8('0x2e')]({'where':_0x44223c['where']})['then'](function(_0x5baf32){_0x421e07[_0xf1e8('0x2e')]=_0x5baf32;if(_0x3476c5['query']['includeAll']){_0x44223c[_0xf1e8('0x53')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xf1e8('0xab')],'as':_0xf1e8('0xc0'),'attributes':[_0xf1e8('0x3a'),'fullname','internal'],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xf1e8('0x3a'),_0xf1e8('0xc1')],'where':_0x3476c5[_0xf1e8('0x40')]['tag']?{'id':_0x3476c5[_0xf1e8('0x40')][_0xf1e8('0xc2')]}:undefined,'required':_0x3476c5[_0xf1e8('0x40')][_0xf1e8('0xc2')]?!![]:![]}];}return db['SmsInteraction'][_0xf1e8('0x54')](_0x44223c);})['then'](function(_0x41c091){_0x421e07[_0xf1e8('0x55')]=_0x41c091;return _0x421e07;});}})[_0xf1e8('0x20')](respondWithFilteredResult(_0x5bb1f4,_0x44223c))['catch'](handleError(_0x5bb1f4,null));};exports[_0xf1e8('0x3b')]=function(_0x5653a3,_0x235ec4,_0x440050){var _0x5a071d,_0x8d6e9,_0x4b77b0;if(_[_0xf1e8('0x91')](_0x5653a3[_0xf1e8('0x5a')][_0xf1e8('0x5a')])||_0x5653a3[_0xf1e8('0x5a')][_0xf1e8('0x5a')]===''){throw new db[(_0xf1e8('0x75'))][(_0xf1e8('0x92'))](_0xf1e8('0xc3'));}if(_[_0xf1e8('0x91')](_0x5653a3[_0xf1e8('0x5a')]['to'])){throw new db[(_0xf1e8('0x75'))][(_0xf1e8('0x92'))]('to\x20is\x20mandatory');}_0x5a071d=_0x5653a3[_0xf1e8('0x5a')]['to'];return db['SmsAccount'][_0xf1e8('0x5e')]({'where':{'id':_0x5653a3[_0xf1e8('0x57')]['id']},'include':[{'model':db[_0xf1e8('0xc4')],'as':_0xf1e8('0xc5'),'include':[{'model':db[_0xf1e8('0x9c')],'as':_0xf1e8('0x9a'),'where':{'mobile':_0x5a071d},'limit':0x1,'order':[[_0xf1e8('0x79'),'DESC']]}]}]})[_0xf1e8('0x20')](handleEntityNotFound(_0x235ec4,null))['then'](function(_0x1fa1c9){if(_0x1fa1c9&&_0x1fa1c9[_0xf1e8('0xc5')]){_0x8d6e9=_0x1fa1c9[_0xf1e8('0x37')]({'plain':!![]});if(_0x8d6e9[_0xf1e8('0xc5')]&&_0x8d6e9['List'][_0xf1e8('0x9a')][_0xf1e8('0x47')]){return _0x8d6e9[_0xf1e8('0xc5')][_0xf1e8('0x9a')][0x0];}return db[_0xf1e8('0x9c')][_0xf1e8('0x59')](_[_0xf1e8('0x9b')](_0x5653a3[_0xf1e8('0x5a')],{'firstName':_0x5a071d,'mobile':_0x5a071d,'phone':_0x5a071d,'ListId':_0x8d6e9[_0xf1e8('0x7b')]}));}})[_0xf1e8('0x20')](handleEntityNotFound(_0x235ec4,null))[_0xf1e8('0x20')](function(_0x274d10){if(_0x274d10){_0x4b77b0=_0x274d10;return db['SmsInteraction']['find']({'where':{'ContactId':_0x4b77b0['id'],'closed':![],'SmsAccountId':_0x8d6e9['id']}})[_0xf1e8('0x20')](function(_0x31c2c2){if(_0x31c2c2){return[_0x31c2c2,![]];}return db['SmsInteraction'][_0xf1e8('0x59')]({'UserId':_0x5653a3[_0xf1e8('0x5b')]['id'],'ContactId':_0x4b77b0['id'],'SmsAccountId':_0x8d6e9['id'],'phone':_0x5a071d,'firstMsgDirection':_0xf1e8('0xc6'),'Messages':[_[_0xf1e8('0x4e')](_0x5653a3[_0xf1e8('0x5a')],{'read':![],'body':_0x5653a3[_0xf1e8('0x5a')][_0xf1e8('0x5a')],'phone':_0x5a071d,'SmsAccountId':_0x8d6e9['id'],'UserId':_0x5653a3['user']['id'],'ContactId':_0x4b77b0['id']})]},{'include':[{'model':db[_0xf1e8('0xa7')],'as':_0xf1e8('0xc7')}]})[_0xf1e8('0x20')](function(_0x694fb1){return[_0x694fb1,!![]];});});}})[_0xf1e8('0x9f')](function(_0x27d008,_0x13ad1c){if(_0x13ad1c){return _0x27d008;}return db[_0xf1e8('0xa7')]['create'](_[_0xf1e8('0x4e')](_0x5653a3[_0xf1e8('0x5a')],{'read':![],'body':_0x5653a3[_0xf1e8('0x5a')][_0xf1e8('0x5a')],'phone':_0x5a071d,'SmsAccountId':_0x8d6e9['id'],'SmsInteractionId':_0x27d008['id'],'UserId':_0x5653a3['user']['id'],'ContactId':_0x4b77b0['id']}))[_0xf1e8('0x20')](function(_0x52f641){_0x27d008[_0xf1e8('0xc8')][_0xf1e8('0xc7')]=[];_0x27d008['dataValues'][_0xf1e8('0xc7')][_0xf1e8('0xa3')](_0x52f641[_0xf1e8('0xc8')]);return _0x27d008;});})[_0xf1e8('0x20')](respondWithResult(_0x235ec4,null))[_0xf1e8('0x28')](handleError(_0x235ec4,null));};exports[_0xf1e8('0x2b')]=function(_0x18a01a,_0x32e7cd,_0x81e2e){if(_0x18a01a[_0xf1e8('0x5a')]['id']){delete _0x18a01a[_0xf1e8('0x5a')]['id'];}var _0x46fe3b,_0x3dd66f,_0x108e55;return db['SmsAccount'][_0xf1e8('0x5e')]({'where':{'id':_0x18a01a[_0xf1e8('0x57')]['id']}})[_0xf1e8('0x20')](handleEntityNotFound(_0x32e7cd,null))['then'](function(_0x16e915){if(_0x16e915){_0x108e55=_0x16e915;logger[_0xf1e8('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf1e8('0x2b'),_0xf1e8('0xc9'),_0x16e915['type'],util[_0xf1e8('0xca')](_0x18a01a['body'],{'showHidden':![],'depth':null}));switch(_0x16e915[_0xf1e8('0x3e')]){case'skebby':if(_0x18a01a[_0xf1e8('0x5a')][_0xf1e8('0xcb')]&&_0x18a01a[_0xf1e8('0x5a')][_0xf1e8('0x2b')]){_0x3dd66f=_0x18a01a[_0xf1e8('0x5a')][_0xf1e8('0x2b')];return db['SmsMessage'][_0xf1e8('0x5e')]({'where':{'messageId':_0x18a01a['body'][_0xf1e8('0xcb')]}});}break;case _0xf1e8('0x84'):if(_0x18a01a['body'][_0xf1e8('0xcc')]&&_0x18a01a[_0xf1e8('0x5a')][_0xf1e8('0xcd')]){_0x3dd66f=_0x18a01a[_0xf1e8('0x5a')][_0xf1e8('0xcd')];return db['SmsMessage'][_0xf1e8('0x5e')]({'where':{'messageId':_0x18a01a[_0xf1e8('0x5a')][_0xf1e8('0xcc')]}});}break;case _0xf1e8('0xce'):if(_0x18a01a['body'][_0xf1e8('0x85')]&&_0x18a01a[_0xf1e8('0x5a')][_0xf1e8('0xcf')]){_0x3dd66f=_0x18a01a[_0xf1e8('0x5a')][_0xf1e8('0xcf')];return db[_0xf1e8('0xa7')][_0xf1e8('0x5e')]({'where':{'messageId':_0x18a01a[_0xf1e8('0x5a')][_0xf1e8('0x85')]}});}break;case _0xf1e8('0x87'):var _0x584476=_0x18a01a[_0xf1e8('0x5a')][_0xf1e8('0x88')][0x0];if(_0x584476['messageId']&&_0x584476[_0xf1e8('0x2b')][_0xf1e8('0xd0')]===_0xf1e8('0xd1')){_0x3dd66f=_0x584476['status'][_0xf1e8('0xd0')];return db[_0xf1e8('0xa7')]['find']({'where':{'messageId':_0x584476['messageId']}});}break;case _0xf1e8('0x8b'):if(_0x18a01a[_0xf1e8('0x5a')][_0xf1e8('0x81')]&&_0x18a01a[_0xf1e8('0x5a')]['status']){_0x3dd66f=_0x18a01a[_0xf1e8('0x5a')]['status'];return db[_0xf1e8('0xa7')][_0xf1e8('0x5e')]({'where':{'messageId':_0x18a01a['body'][_0xf1e8('0x81')]}});}break;case _0xf1e8('0x8e'):if(_0x18a01a[_0xf1e8('0x5a')][0x0][_0xf1e8('0x27')]['id']){_0x3dd66f=_0x18a01a['body'][0x0][_0xf1e8('0x3e')];return db['SmsMessage'][_0xf1e8('0x5e')]({'where':{'messageId':_0x18a01a[_0xf1e8('0x5a')][0x0][_0xf1e8('0x27')]['id']}});}break;case _0xf1e8('0x8f'):if(_0x18a01a['body'][_0xf1e8('0xd2')]&&_0x18a01a[_0xf1e8('0x5a')]['status']){_0x3dd66f=_0x18a01a['body']['status'];return db[_0xf1e8('0xa7')]['find']({'where':{'messageId':_0x18a01a['body'][_0xf1e8('0xd2')]}});}break;}}})[_0xf1e8('0x20')](handleEntityNotFound(_0x32e7cd,null))['then'](function(_0x2becc4){if(_0x2becc4){_0x46fe3b=_0x2becc4;switch(_0x108e55['type']){case _0xf1e8('0xd3'):if(_0x3dd66f===_0xf1e8('0xd1')){return _0x46fe3b[_0xf1e8('0x36')]({'read':!![]});}else{logger['error'](_0xf1e8('0x24'),'status',_0xf1e8('0xd3'),util[_0xf1e8('0xca')](_0x18a01a[_0xf1e8('0x5a')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x3dd66f==='1'){return _0x46fe3b[_0xf1e8('0x36')]({'read':!![]});}else{logger[_0xf1e8('0x25')](_0xf1e8('0x24'),_0xf1e8('0x2b'),'skebby',util[_0xf1e8('0xca')](_0x18a01a[_0xf1e8('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xf1e8('0xce'):if(!_0x18a01a[_0xf1e8('0x5a')]['error_code']&&_0x3dd66f>=0xc8&&_0x3dd66f<=0xce){return _0x46fe3b[_0xf1e8('0x36')]({'read':!![]});}else{logger[_0xf1e8('0x25')](_0xf1e8('0x24'),_0xf1e8('0x2b'),'clicksend',util['inspect'](_0x18a01a['body'],{'showHidden':![],'depth':null}));}break;case _0xf1e8('0x87'):var _0x5ce61e=_0x18a01a[_0xf1e8('0x5a')]['results'][0x0];if(_0x5ce61e['status'][_0xf1e8('0xd0')]===_0xf1e8('0xd1')){return _0x46fe3b['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf1e8('0x2b'),_0xf1e8('0x87'),util['inspect'](_0x18a01a[_0xf1e8('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xf1e8('0x8b'):if(_0x3dd66f==_0xf1e8('0xd4')||_0x3dd66f==_0xf1e8('0xd5')){return _0x46fe3b[_0xf1e8('0x36')]({'read':!![]});}else{logger[_0xf1e8('0x25')](_0xf1e8('0x24'),_0xf1e8('0x2b'),_0xf1e8('0x8b'),util[_0xf1e8('0xca')](_0x18a01a[_0xf1e8('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xf1e8('0x8e'):if(_0x3dd66f==_0xf1e8('0xd6')){return _0x46fe3b['update']({'read':!![]});}else{logger[_0xf1e8('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf1e8('0x2b'),_0xf1e8('0x8e'),util['inspect'](_0x18a01a[_0xf1e8('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xf1e8('0x8f'):if(_0x3dd66f===_0xf1e8('0xd7')||_0x3dd66f===_0xf1e8('0xd8')){return _0x46fe3b[_0xf1e8('0x36')]({'read':!![]});}else{logger[_0xf1e8('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf1e8('0x2b'),_0xf1e8('0x8f'),util[_0xf1e8('0xca')](_0x18a01a['body'],{'showHidden':![],'depth':null}));}break;}return _0x46fe3b;}})[_0xf1e8('0x20')](respondWithResult(_0x32e7cd,null))[_0xf1e8('0x28')](handleError(_0x32e7cd,null));};exports[_0xf1e8('0xd9')]=function(_0xe7c6ec,_0x386e7e,_0x1ab8ae){var _0x8a1ee9,_0x37fc3a,_0x2f2643;return db['SmsAccount'][_0xf1e8('0x5e')]({'where':{'id':_0xe7c6ec[_0xf1e8('0x57')]['id']}})['then'](handleEntityNotFound(_0x386e7e,null))[_0xf1e8('0x20')](function(_0x6b3aa9){if(_0x6b3aa9){_0x2f2643=_0x6b3aa9;logger[_0xf1e8('0x23')](_0xf1e8('0x24'),_0xf1e8('0x2b'),'received\x20delivery\x20report\x20from',_0x6b3aa9[_0xf1e8('0x3e')],util['inspect'](_0xe7c6ec[_0xf1e8('0x40')],{'showHidden':![],'depth':null}));switch(_0x6b3aa9[_0xf1e8('0x3e')]){case _0xf1e8('0x89'):if(_0xe7c6ec[_0xf1e8('0x40')][_0xf1e8('0xda')]&&_0xe7c6ec[_0xf1e8('0x40')][_0xf1e8('0xdb')]){_0x37fc3a=_0xe7c6ec[_0xf1e8('0x40')]['state'];return db[_0xf1e8('0xa7')][_0xf1e8('0x5e')]({'where':{'messageId':_0xe7c6ec[_0xf1e8('0x40')][_0xf1e8('0xda')]}});}break;}}})[_0xf1e8('0x20')](handleEntityNotFound(_0x386e7e,null))[_0xf1e8('0x20')](function(_0x47fd6f){if(_0x47fd6f){_0x8a1ee9=_0x47fd6f;switch(_0x2f2643[_0xf1e8('0x3e')]){case _0xf1e8('0x89'):if(_0x37fc3a==='2'||_0x37fc3a==='6'){return _0x8a1ee9[_0xf1e8('0x36')]({'read':!![]});}else{logger[_0xf1e8('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf1e8('0x2b'),_0xf1e8('0x89'),util['inspect'](_0xe7c6ec[_0xf1e8('0x40')],{'showHidden':![],'depth':null}));};break;}return _0x8a1ee9;}})[_0xf1e8('0x20')](respondWithResult(_0x386e7e,null))[_0xf1e8('0x28')](handleError(_0x386e7e,null));};exports['addAgents']=function(_0x52bc34,_0x2a6c40,_0x1d02ad){return db[_0xf1e8('0x51')][_0xf1e8('0x5e')]({'where':{'id':_0x52bc34[_0xf1e8('0x57')]['id']}})[_0xf1e8('0x20')](handleEntityNotFound(_0x2a6c40,null))[_0xf1e8('0x20')](function(_0x2f01db){if(_0x2f01db){return _0x2f01db[_0xf1e8('0xdc')](_0x52bc34[_0xf1e8('0x5a')][_0xf1e8('0x69')],_[_0xf1e8('0x99')](_0x52bc34['body'],[_0xf1e8('0x69'),'id'])||{})[_0xf1e8('0x9f')](function(_0xc86673){for(var _0x23e09c=0x0;_0x23e09c<_0x52bc34[_0xf1e8('0x5a')][_0xf1e8('0x69')][_0xf1e8('0x47')];_0x23e09c+=0x1){socket[_0xf1e8('0xdd')](_0xf1e8('0xde'),{'UserId':Number(_0x52bc34[_0xf1e8('0x5a')][_0xf1e8('0x69')][_0x23e09c]),'SmsAccountId':Number(_0x52bc34[_0xf1e8('0x57')]['id'])});}return _0xc86673;});}})[_0xf1e8('0x20')](respondWithResult(_0x2a6c40,null))['catch'](handleError(_0x2a6c40,null));};exports['removeAgents']=function(_0x41d44d,_0x488c5f,_0xcbbcda){return db['SmsAccount'][_0xf1e8('0x5e')]({'where':{'id':_0x41d44d[_0xf1e8('0x57')]['id']}})[_0xf1e8('0x20')](handleEntityNotFound(_0x488c5f,null))[_0xf1e8('0x20')](function(_0x50a15c){if(_0x50a15c){return _0x50a15c[_0xf1e8('0xdf')](_0x41d44d[_0xf1e8('0x40')]['ids'])[_0xf1e8('0x20')](function(){if(_['isArray'](_0x41d44d['query']['ids'])){for(var _0x297692=0x0;_0x297692<_0x41d44d['query'][_0xf1e8('0x69')][_0xf1e8('0x47')];_0x297692+=0x1){socket['emit'](_0xf1e8('0xe0'),{'UserId':Number(_0x41d44d[_0xf1e8('0x40')]['ids'][_0x297692]),'SmsAccountId':Number(_0x41d44d['params']['id'])});}}else{socket['emit'](_0xf1e8('0xe0'),{'UserId':Number(_0x41d44d[_0xf1e8('0x40')][_0xf1e8('0x69')]),'SmsAccountId':Number(_0x41d44d[_0xf1e8('0x57')]['id'])});}});}})[_0xf1e8('0x20')](respondWithStatusCode(_0x488c5f,null))['catch'](handleError(_0x488c5f,null));};exports['getAgents']=function(_0x1bc82f,_0x492698,_0x2c26ce){var _0x52b4a9={};var _0xdf2edb={};var _0x5754c4;var _0x39c21a;return db['SmsAccount'][_0xf1e8('0xba')]({'where':{'id':_0x1bc82f['params']['id']}})[_0xf1e8('0x20')](handleEntityNotFound(_0x492698,null))[_0xf1e8('0x20')](function(_0x1577de){if(_0x1577de){_0x5754c4=_0x1577de;_0xdf2edb['model']=_['keys'](db[_0xf1e8('0xab')][_0xf1e8('0x3d')]);_0xdf2edb[_0xf1e8('0x40')]=_[_0xf1e8('0x41')](_0x1bc82f[_0xf1e8('0x40')]);_0xdf2edb[_0xf1e8('0x42')]=_[_0xf1e8('0x45')](_0xdf2edb['model'],_0xdf2edb[_0xf1e8('0x40')]);_0x52b4a9['attributes']=_[_0xf1e8('0x45')](_0xdf2edb['model'],qs[_0xf1e8('0x46')](_0x1bc82f[_0xf1e8('0x40')][_0xf1e8('0x46')]));_0x52b4a9['attributes']=_0x52b4a9['attributes']['length']?_0x52b4a9[_0xf1e8('0x44')]:_0xdf2edb['model'];_0x52b4a9[_0xf1e8('0x4a')]=qs[_0xf1e8('0x4b')](_0x1bc82f['query'][_0xf1e8('0x4b')]);_0x52b4a9[_0xf1e8('0x4c')]=qs['filters'](_[_0xf1e8('0x68')](_0x1bc82f[_0xf1e8('0x40')],_0xdf2edb[_0xf1e8('0x42')]));if(_0x1bc82f['query']['filter']){_0x52b4a9[_0xf1e8('0x4c')]=_['merge'](_0x52b4a9[_0xf1e8('0x4c')],{'$or':_[_0xf1e8('0x3f')](_0x52b4a9[_0xf1e8('0x44')],function(_0x383b5f){var _0xf9ffcb={};_0xf9ffcb[_0x383b5f]={'$like':'%'+_0x1bc82f['query'][_0xf1e8('0x4d')]+'%'};return _0xf9ffcb;})});}_0x52b4a9=_[_0xf1e8('0x4e')]({},_0x52b4a9,_0x1bc82f[_0xf1e8('0x50')]);return _0x5754c4['getAgents'](_0x52b4a9);}})[_0xf1e8('0x20')](function(_0x2e3b8e){if(_0x2e3b8e){_0x39c21a=_0x2e3b8e[_0xf1e8('0x47')];if(!_0x1bc82f[_0xf1e8('0x40')][_0xf1e8('0x48')](_0xf1e8('0x49'))){_0x52b4a9[_0xf1e8('0x2f')]=qs[_0xf1e8('0x2f')](_0x1bc82f[_0xf1e8('0x40')][_0xf1e8('0x2f')]);_0x52b4a9[_0xf1e8('0x2c')]=qs[_0xf1e8('0x2c')](_0x1bc82f[_0xf1e8('0x40')][_0xf1e8('0x2c')]);}return _0x5754c4[_0xf1e8('0xe1')](_0x52b4a9);}})['then'](function(_0x2a7076){if(_0x2a7076){return _0x2a7076?{'count':_0x39c21a,'rows':_0x2a7076}:null;}})[_0xf1e8('0x20')](respondWithResult(_0x492698,null))[_0xf1e8('0x28')](handleError(_0x492698,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index b3e1a6c..3c0bfac 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 _0xed07=['exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit','hook'];(function(_0x2e78e9,_0x42957c){var _0x35aad4=function(_0x360fa1){while(--_0x360fa1){_0x2e78e9['push'](_0x2e78e9['shift']());}};_0x35aad4(++_0x42957c);}(_0xed07,0x169));var _0x7ed0=function(_0x476969,_0x52d8eb){_0x476969=_0x476969-0x0;var _0x5e95a2=_0xed07[_0x476969];return _0x5e95a2;};'use strict';var EventEmitter=require(_0x7ed0('0x0'));var SmsAccount=require(_0x7ed0('0x1'))['db'][_0x7ed0('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x7ed0('0x3')](0x0);var events={'afterCreate':_0x7ed0('0x4'),'afterUpdate':_0x7ed0('0x5'),'afterDestroy':_0x7ed0('0x6')};function emitEvent(_0x701fc9){return function(_0x1e3b31,_0x111559,_0x20d7b1){SmsAccountEvents['emit'](_0x701fc9+':'+_0x1e3b31['id'],_0x1e3b31);SmsAccountEvents[_0x7ed0('0x7')](_0x701fc9,_0x1e3b31);_0x20d7b1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x7ed0('0x8')](e,emitEvent(event));}}module[_0x7ed0('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0xf485=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','SmsAccount','setMaxListeners','save'];(function(_0x432384,_0x15b54b){var _0x413635=function(_0x16d345){while(--_0x16d345){_0x432384['push'](_0x432384['shift']());}};_0x413635(++_0x15b54b);}(_0xf485,0x113));var _0x5f48=function(_0x244c39,_0x2858db){_0x244c39=_0x244c39-0x0;var _0x50d3ac=_0xf485[_0x244c39];return _0x50d3ac;};'use strict';var EventEmitter=require(_0x5f48('0x0'));var SmsAccount=require(_0x5f48('0x1'))['db'][_0x5f48('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x5f48('0x3')](0x0);var events={'afterCreate':_0x5f48('0x4'),'afterUpdate':_0x5f48('0x5'),'afterDestroy':_0x5f48('0x6')};function emitEvent(_0x1976a4){return function(_0x23e5c4,_0x13860a,_0x28470e){SmsAccountEvents[_0x5f48('0x7')](_0x1976a4+':'+_0x23e5c4['id'],_0x23e5c4);SmsAccountEvents['emit'](_0x1976a4,_0x23e5c4);_0x28470e(null);};}for(var e in events){if(events[_0x5f48('0x8')](e)){var event=events[e];SmsAccount[_0x5f48('0x9')](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 d6b9367..79a9894 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 _0x76aa=['define','SmsAccount','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./smsAccount.attributes'];(function(_0x10852d,_0x4cdcc6){var _0x13a8d6=function(_0x2ece16){while(--_0x2ece16){_0x10852d['push'](_0x10852d['shift']());}};_0x13a8d6(++_0x4cdcc6);}(_0x76aa,0x12b));var _0xa76a=function(_0x44fba2,_0x45ff78){_0x44fba2=_0x44fba2-0x0;var _0x4643ed=_0x76aa[_0x44fba2];return _0x4643ed;};'use strict';var _=require(_0xa76a('0x0'));var util=require(_0xa76a('0x1'));var logger=require(_0xa76a('0x2'))(_0xa76a('0x3'));var moment=require('moment');var BPromise=require(_0xa76a('0x4'));var rp=require(_0xa76a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa76a('0x6'));var config=require(_0xa76a('0x7'));var attributes=require(_0xa76a('0x8'));module['exports']=function(_0x4fa42a,_0x2d4a96){return _0x4fa42a[_0xa76a('0x9')](_0xa76a('0xa'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd5f4=['rimraf','../../config/environment','./smsAccount.attributes','exports','SmsAccount','sms_accounts','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x12bda7,_0x2c63c6){var _0x2d41bd=function(_0x5efe9b){while(--_0x5efe9b){_0x12bda7['push'](_0x12bda7['shift']());}};_0x2d41bd(++_0x2c63c6);}(_0xd5f4,0x192));var _0x4d5f=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xd5f4[_0x342baa];return _0x1208f3;};'use strict';var _=require(_0x4d5f('0x0'));var util=require(_0x4d5f('0x1'));var logger=require(_0x4d5f('0x2'))('api');var moment=require(_0x4d5f('0x3'));var BPromise=require(_0x4d5f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4d5f('0x5'));var rimraf=require(_0x4d5f('0x6'));var config=require(_0x4d5f('0x7'));var attributes=require(_0x4d5f('0x8'));module[_0x4d5f('0x9')]=function(_0x1f4b2d,_0x1f46ca){return _0x1f4b2d['define'](_0x4d5f('0xa'),attributes,{'tableName':_0x4d5f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 7ddace5..5438a38 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 _0x8107=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','ShowSmsAccount','SmsAccount','options','raw','include','map','model','attributes','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8107,0x17a));var _0x7810=function(_0x4cc198,_0x11a598){_0x4cc198=_0x4cc198-0x0;var _0x3e8858=_0x8107[_0x4cc198];return _0x3e8858;};'use strict';var _=require(_0x7810('0x0'));var util=require(_0x7810('0x1'));var moment=require(_0x7810('0x2'));var BPromise=require('bluebird');var rs=require(_0x7810('0x3'));var fs=require('fs');var Redis=require(_0x7810('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7810('0x5'));var logger=require(_0x7810('0x6'))(_0x7810('0x7'));var config=require(_0x7810('0x8'));var jayson=require(_0x7810('0x9'));var client=jayson[_0x7810('0xa')][_0x7810('0xb')]({'port':0x232a});config[_0x7810('0xc')]=_[_0x7810('0xd')](config[_0x7810('0xc')],{'host':_0x7810('0xe'),'port':0x18eb});var socket=require(_0x7810('0xf'))(new Redis(config[_0x7810('0xc')]));require(_0x7810('0x10'))[_0x7810('0x11')](socket);function respondWithRpcPromise(_0x1ddf7a,_0x58d4dd,_0x307087){return new BPromise(function(_0x2076ba,_0x1b236f){return client['request'](_0x1ddf7a,_0x307087)[_0x7810('0x12')](function(_0x21b418){logger[_0x7810('0x13')](_0x7810('0x14'),_0x58d4dd,_0x7810('0x15'));logger[_0x7810('0x16')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x58d4dd,'request\x20sent',JSON[_0x7810('0x17')](_0x21b418));if(_0x21b418[_0x7810('0x18')]){if(_0x21b418[_0x7810('0x18')]['code']===0x1f4){logger[_0x7810('0x18')]('SmsAccount,\x20%s,\x20%s',_0x58d4dd,_0x21b418[_0x7810('0x18')][_0x7810('0x19')]);return _0x1b236f(_0x21b418[_0x7810('0x18')]['message']);}logger['error'](_0x7810('0x14'),_0x58d4dd,_0x21b418[_0x7810('0x18')][_0x7810('0x19')]);return _0x2076ba(_0x21b418[_0x7810('0x18')][_0x7810('0x19')]);}else{logger[_0x7810('0x13')](_0x7810('0x14'),_0x58d4dd,_0x7810('0x15'));_0x2076ba(_0x21b418['result'][_0x7810('0x19')]);}})[_0x7810('0x1a')](function(_0x520a1b){logger['error'](_0x7810('0x14'),_0x58d4dd,_0x520a1b);_0x1b236f(_0x520a1b);});});}exports[_0x7810('0x1b')]=function(_0x3b70ca){var _0x1d03b7=this;return new Promise(function(_0x30d5aa,_0x1b163a){return db[_0x7810('0x1c')]['find']({'raw':_0x3b70ca[_0x7810('0x1d')]?_0x3b70ca['options'][_0x7810('0x1e')]===undefined?!![]:![]:!![],'where':_0x3b70ca[_0x7810('0x1d')]?_0x3b70ca[_0x7810('0x1d')]['where']||null:null,'attributes':_0x3b70ca[_0x7810('0x1d')]?_0x3b70ca['options']['attributes']||null:null,'include':_0x3b70ca[_0x7810('0x1d')]?_0x3b70ca[_0x7810('0x1d')][_0x7810('0x1f')]?_[_0x7810('0x20')](_0x3b70ca['options'][_0x7810('0x1f')],function(_0x59377d){return{'model':db[_0x59377d[_0x7810('0x21')]],'as':_0x59377d['as'],'attributes':_0x59377d[_0x7810('0x22')],'include':_0x59377d[_0x7810('0x1f')]?_[_0x7810('0x20')](_0x59377d[_0x7810('0x1f')],function(_0x181942){return{'model':db[_0x181942[_0x7810('0x21')]],'as':_0x181942['as'],'attributes':_0x181942[_0x7810('0x22')],'include':_0x181942['include']?_[_0x7810('0x20')](_0x181942[_0x7810('0x1f')],function(_0x540aa1){return{'model':db[_0x540aa1['model']],'as':_0x540aa1['as'],'attributes':_0x540aa1['attributes']};}):[]};}):[]};}):[]:[]})[_0x7810('0x12')](function(_0x42a7c7){logger['info'](_0x7810('0x1b'),_0x3b70ca);logger['debug'](_0x7810('0x1b'),_0x3b70ca,JSON['stringify'](_0x42a7c7));_0x30d5aa(_0x42a7c7);})[_0x7810('0x1a')](function(_0x3194af){logger['error'](_0x7810('0x1b'),_0x3194af[_0x7810('0x19')],_0x3b70ca);_0x1b163a(_0x1d03b7[_0x7810('0x18')](0x1f4,_0x3194af[_0x7810('0x19')]));});});}; \ No newline at end of file +var _0x6523=['find','options','raw','where','attributes','include','model','map','stringify','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./smsAccount.socket','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ShowSmsAccount','SmsAccount'];(function(_0x3cbb31,_0x519922){var _0x44a9fd=function(_0x537536){while(--_0x537536){_0x3cbb31['push'](_0x3cbb31['shift']());}};_0x44a9fd(++_0x519922);}(_0x6523,0x95));var _0x3652=function(_0x196ce1,_0x46e836){_0x196ce1=_0x196ce1-0x0;var _0x360a64=_0x6523[_0x196ce1];return _0x360a64;};'use strict';var _=require(_0x3652('0x0'));var util=require(_0x3652('0x1'));var moment=require(_0x3652('0x2'));var BPromise=require(_0x3652('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3652('0x4'));var logger=require(_0x3652('0x5'))(_0x3652('0x6'));var config=require('../../config/environment');var jayson=require(_0x3652('0x7'));var client=jayson[_0x3652('0x8')][_0x3652('0x9')]({'port':0x232a});config[_0x3652('0xa')]=_[_0x3652('0xb')](config['redis'],{'host':_0x3652('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3652('0xa')]));require(_0x3652('0xd'))['register'](socket);function respondWithRpcPromise(_0x35ba27,_0x3d4f05,_0xd768d9){return new BPromise(function(_0x955faa,_0x3aba4a){return client['request'](_0x35ba27,_0xd768d9)[_0x3652('0xe')](function(_0x36869f){logger[_0x3652('0xf')](_0x3652('0x10'),_0x3d4f05,_0x3652('0x11'));logger[_0x3652('0x12')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3d4f05,_0x3652('0x11'),JSON['stringify'](_0x36869f));if(_0x36869f['error']){if(_0x36869f[_0x3652('0x13')][_0x3652('0x14')]===0x1f4){logger[_0x3652('0x13')](_0x3652('0x10'),_0x3d4f05,_0x36869f['error'][_0x3652('0x15')]);return _0x3aba4a(_0x36869f[_0x3652('0x13')]['message']);}logger[_0x3652('0x13')]('SmsAccount,\x20%s,\x20%s',_0x3d4f05,_0x36869f[_0x3652('0x13')][_0x3652('0x15')]);return _0x955faa(_0x36869f[_0x3652('0x13')][_0x3652('0x15')]);}else{logger[_0x3652('0xf')](_0x3652('0x10'),_0x3d4f05,'request\x20sent');_0x955faa(_0x36869f[_0x3652('0x16')][_0x3652('0x15')]);}})[_0x3652('0x17')](function(_0xd2eea0){logger[_0x3652('0x13')](_0x3652('0x10'),_0x3d4f05,_0xd2eea0);_0x3aba4a(_0xd2eea0);});});}exports[_0x3652('0x18')]=function(_0x599222){var _0x5cdc70=this;return new Promise(function(_0x3a564b,_0x674e3){return db[_0x3652('0x19')][_0x3652('0x1a')]({'raw':_0x599222[_0x3652('0x1b')]?_0x599222['options'][_0x3652('0x1c')]===undefined?!![]:![]:!![],'where':_0x599222[_0x3652('0x1b')]?_0x599222[_0x3652('0x1b')][_0x3652('0x1d')]||null:null,'attributes':_0x599222[_0x3652('0x1b')]?_0x599222[_0x3652('0x1b')][_0x3652('0x1e')]||null:null,'include':_0x599222[_0x3652('0x1b')]?_0x599222[_0x3652('0x1b')][_0x3652('0x1f')]?_['map'](_0x599222['options'][_0x3652('0x1f')],function(_0x222c90){return{'model':db[_0x222c90[_0x3652('0x20')]],'as':_0x222c90['as'],'attributes':_0x222c90[_0x3652('0x1e')],'include':_0x222c90[_0x3652('0x1f')]?_[_0x3652('0x21')](_0x222c90['include'],function(_0x145125){return{'model':db[_0x145125['model']],'as':_0x145125['as'],'attributes':_0x145125[_0x3652('0x1e')],'include':_0x145125['include']?_[_0x3652('0x21')](_0x145125[_0x3652('0x1f')],function(_0x8e78f9){return{'model':db[_0x8e78f9[_0x3652('0x20')]],'as':_0x8e78f9['as'],'attributes':_0x8e78f9[_0x3652('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b50f5){logger[_0x3652('0xf')](_0x3652('0x18'),_0x599222);logger['debug'](_0x3652('0x18'),_0x599222,JSON[_0x3652('0x22')](_0x4b50f5));_0x3a564b(_0x4b50f5);})[_0x3652('0x17')](function(_0x458052){logger[_0x3652('0x13')](_0x3652('0x18'),_0x458052['message'],_0x599222);_0x674e3(_0x5cdc70['error'](0x1f4,_0x458052[_0x3652('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 2605e81..acb5705 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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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 a08b1a4..c479e0e 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 _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create'];(function(_0x5c3921,_0x17af42){var _0x28ef1f=function(_0x2b59ad){while(--_0x2b59ad){_0x5c3921['push'](_0x5c3921['shift']());}};_0x28ef1f(++_0x17af42);}(_0x55ca,0x126));var _0xa55c=function(_0x1e2372,_0x2ea876){_0x1e2372=_0x1e2372-0x0;var _0x4cd59b=_0x55ca[_0x1e2372];return _0x4cd59b;};'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 +var _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x36fb15,_0x11922e){var _0x2890fd=function(_0x27cabb){while(--_0x27cabb){_0x36fb15['push'](_0x36fb15['shift']());}};_0x2890fd(++_0x11922e);}(_0x008c,0x188));var _0xc008=function(_0x4b2b3e,_0x720687){_0x4b2b3e=_0x4b2b3e-0x0;var _0x2f59a6=_0x008c[_0x4b2b3e];return _0x2f59a6;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('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 493cc0c..d381843 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 _0x1c19=['*,*,*,*','sequelize','exports','INTEGER','noop','TEXT','STRING'];(function(_0x5ede80,_0x581584){var _0x49c57b=function(_0x204708){while(--_0x204708){_0x5ede80['push'](_0x5ede80['shift']());}};_0x49c57b(++_0x581584);}(_0x1c19,0x1f2));var _0x91c1=function(_0x279ab1,_0x527374){_0x279ab1=_0x279ab1-0x0;var _0x8ba87c=_0x1c19[_0x279ab1];return _0x8ba87c;};'use strict';var Sequelize=require(_0x91c1('0x0'));module[_0x91c1('0x1')]={'priority':{'type':Sequelize[_0x91c1('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x91c1('0x3')},'appdata':{'type':Sequelize[_0x91c1('0x4')]()},'description':{'type':Sequelize[_0x91c1('0x5')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x91c1('0x6')}}; \ No newline at end of file +var _0xa652=['STRING','*,*,*,*','sequelize','exports','INTEGER','TEXT'];(function(_0x4151be,_0x576cdb){var _0x3e09b2=function(_0x49ec36){while(--_0x49ec36){_0x4151be['push'](_0x4151be['shift']());}};_0x3e09b2(++_0x576cdb);}(_0xa652,0xe6));var _0x2a65=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa652[_0x5b561d];return _0x431060;};'use strict';var Sequelize=require(_0x2a65('0x0'));module[_0x2a65('0x1')]={'priority':{'type':Sequelize[_0x2a65('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x2a65('0x3')]()},'description':{'type':Sequelize[_0x2a65('0x4')]},'interval':{'type':Sequelize[_0x2a65('0x4')],'defaultValue':_0x2a65('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 9aba08d..00a64fd 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 _0x2c9d=['key','model','name','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','stack','index','map','SmsApplication','rawAttributes','fieldName','type'];(function(_0x5e2083,_0x5fb1e1){var _0x5d8f83=function(_0x5c2d03){while(--_0x5c2d03){_0x5e2083['push'](_0x5e2083['shift']());}};_0x5d8f83(++_0x5fb1e1);}(_0x2c9d,0x13d));var _0xd2c9=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x2c9d[_0x363ef8];return _0x148822;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd2c9('0x0'));var jsonpatch=require(_0xd2c9('0x1'));var rp=require(_0xd2c9('0x2'));var moment=require('moment');var BPromise=require(_0xd2c9('0x3'));var Mustache=require(_0xd2c9('0x4'));var util=require('util');var path=require('path');var sox=require(_0xd2c9('0x5'));var csv=require(_0xd2c9('0x6'));var ejs=require(_0xd2c9('0x7'));var fs=require('fs');var fs_extra=require(_0xd2c9('0x8'));var _=require(_0xd2c9('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd2c9('0xa'));var deskjs=require(_0xd2c9('0xb'));var toCsv=require(_0xd2c9('0x6'));var querystring=require(_0xd2c9('0xc'));var Papa=require(_0xd2c9('0xd'));var Redis=require(_0xd2c9('0xe'));var authService=require(_0xd2c9('0xf'));var qs=require(_0xd2c9('0x10'));var as=require(_0xd2c9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd2c9('0x12'))(_0xd2c9('0x13'));var utils=require(_0xd2c9('0x14'));var config=require(_0xd2c9('0x15'));var licenseUtil=require(_0xd2c9('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5255fc,_0x61c61a){_0x61c61a=_0x61c61a||0xcc;return function(_0x146034){if(_0x146034){return _0x5255fc[_0xd2c9('0x17')](_0x61c61a);}return _0x5255fc[_0xd2c9('0x18')](_0x61c61a)['end']();};}function respondWithResult(_0x8582c2,_0x2a69b4){_0x2a69b4=_0x2a69b4||0xc8;return function(_0x5910eb){if(_0x5910eb){return _0x8582c2[_0xd2c9('0x18')](_0x2a69b4)[_0xd2c9('0x19')](_0x5910eb);}};}function respondWithFilteredResult(_0x2d2de7,_0x5cb642){return function(_0x17e0bb){if(_0x17e0bb){var _0xd92d5e=typeof _0x5cb642[_0xd2c9('0x1a')]==='undefined'&&typeof _0x5cb642[_0xd2c9('0x1b')]===_0xd2c9('0x1c');var _0x56a4b3=_0x17e0bb['count'];var _0x1bb5c4=_0xd92d5e?0x0:_0x5cb642['offset'];var _0x174d6a=_0xd92d5e?_0x17e0bb[_0xd2c9('0x1d')]:_0x5cb642[_0xd2c9('0x1a')]+_0x5cb642['limit'];var _0x5e661f;if(_0x174d6a>=_0x56a4b3){_0x174d6a=_0x56a4b3;_0x5e661f=0xc8;}else{_0x5e661f=0xce;}_0x2d2de7[_0xd2c9('0x18')](_0x5e661f);return _0x2d2de7['set'](_0xd2c9('0x1e'),_0x1bb5c4+'-'+_0x174d6a+'/'+_0x56a4b3)['json'](_0x17e0bb);}return null;};}function patchUpdates(_0x8e610a){return function(_0x41351d){try{jsonpatch[_0xd2c9('0x1f')](_0x41351d,_0x8e610a,!![]);}catch(_0x3540b4){return BPromise[_0xd2c9('0x20')](_0x3540b4);}return _0x41351d[_0xd2c9('0x21')]();};}function saveUpdates(_0xb54ffa,_0x350248){return function(_0x45cdc4){if(_0x45cdc4){return _0x45cdc4[_0xd2c9('0x22')](_0xb54ffa)[_0xd2c9('0x23')](function(_0x5cf307){return _0x5cf307;});}return null;};}function removeEntity(_0x4e9834,_0x3e36a5){return function(_0x3ec7f4){if(_0x3ec7f4){return _0x3ec7f4['destroy']()['then'](function(){_0x4e9834['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1150c7,_0x8c33e0){return function(_0x4d67d4){if(!_0x4d67d4){_0x1150c7['sendStatus'](0x194);}return _0x4d67d4;};}function handleError(_0x29baee,_0x553213){_0x553213=_0x553213||0x1f4;return function(_0x19c23d){logger['error'](_0x19c23d[_0xd2c9('0x24')]);if(_0x19c23d['name']){delete _0x19c23d['name'];}_0x29baee[_0xd2c9('0x18')](_0x553213)['send'](_0x19c23d);};}exports[_0xd2c9('0x25')]=function(_0x2984a4,_0x51a715){var _0x235957={},_0x20d618={},_0x1f66b6={'count':0x0,'rows':[]};var _0x49513c=_[_0xd2c9('0x26')](db[_0xd2c9('0x27')][_0xd2c9('0x28')],function(_0x294cbf){return{'name':_0x294cbf[_0xd2c9('0x29')],'type':_0x294cbf[_0xd2c9('0x2a')][_0xd2c9('0x2b')]};});_0x20d618[_0xd2c9('0x2c')]=_[_0xd2c9('0x26')](_0x49513c,_0xd2c9('0x2d'));_0x20d618[_0xd2c9('0x2e')]=_['keys'](_0x2984a4['query']);_0x20d618[_0xd2c9('0x2f')]=_[_0xd2c9('0x30')](_0x20d618['model'],_0x20d618[_0xd2c9('0x2e')]);_0x235957[_0xd2c9('0x31')]=_[_0xd2c9('0x30')](_0x20d618[_0xd2c9('0x2c')],qs[_0xd2c9('0x32')](_0x2984a4[_0xd2c9('0x2e')][_0xd2c9('0x32')]));_0x235957[_0xd2c9('0x31')]=_0x235957['attributes'][_0xd2c9('0x33')]?_0x235957[_0xd2c9('0x31')]:_0x20d618[_0xd2c9('0x2c')];if(!_0x2984a4['query']['hasOwnProperty'](_0xd2c9('0x34'))){_0x235957[_0xd2c9('0x1b')]=qs[_0xd2c9('0x1b')](_0x2984a4[_0xd2c9('0x2e')][_0xd2c9('0x1b')]);_0x235957[_0xd2c9('0x1a')]=qs[_0xd2c9('0x1a')](_0x2984a4[_0xd2c9('0x2e')][_0xd2c9('0x1a')]);}_0x235957[_0xd2c9('0x35')]=qs[_0xd2c9('0x36')](_0x2984a4['query'][_0xd2c9('0x36')]);_0x235957[_0xd2c9('0x37')]=qs['filters'](_[_0xd2c9('0x38')](_0x2984a4[_0xd2c9('0x2e')],_0x20d618['filters']),_0x49513c);if(_0x2984a4[_0xd2c9('0x2e')][_0xd2c9('0x39')]){_0x235957[_0xd2c9('0x37')]=_[_0xd2c9('0x3a')](_0x235957['where'],{'$or':_['map'](_0x49513c,function(_0x19d5cf){if(_0x19d5cf['type']!==_0xd2c9('0x3b')){var _0x36fee7={};_0x36fee7[_0x19d5cf[_0xd2c9('0x2d')]]={'$like':'%'+_0x2984a4[_0xd2c9('0x2e')][_0xd2c9('0x39')]+'%'};return _0x36fee7;}})});}_0x235957=_['merge']({},_0x235957,_0x2984a4[_0xd2c9('0x3c')]);var _0x17bb3d={'where':_0x235957[_0xd2c9('0x37')]};return db['SmsApplication'][_0xd2c9('0x1d')](_0x17bb3d)[_0xd2c9('0x23')](function(_0x2edb0b){_0x1f66b6[_0xd2c9('0x1d')]=_0x2edb0b;if(_0x2984a4[_0xd2c9('0x2e')][_0xd2c9('0x3d')]){_0x235957[_0xd2c9('0x3e')]=[{'all':!![]}];}return db[_0xd2c9('0x27')][_0xd2c9('0x3f')](_0x235957);})['then'](function(_0x1d29e6){_0x1f66b6[_0xd2c9('0x40')]=_0x1d29e6;return _0x1f66b6;})[_0xd2c9('0x23')](respondWithFilteredResult(_0x51a715,_0x235957))[_0xd2c9('0x41')](handleError(_0x51a715,null));};exports[_0xd2c9('0x42')]=function(_0x19ba69,_0x4fc3e5){var _0x4793d6={'raw':!![],'where':{'id':_0x19ba69[_0xd2c9('0x43')]['id']}},_0x379e20={};_0x379e20['model']=_[_0xd2c9('0x44')](db[_0xd2c9('0x27')][_0xd2c9('0x28')]);_0x379e20[_0xd2c9('0x2e')]=_[_0xd2c9('0x44')](_0x19ba69['query']);_0x379e20[_0xd2c9('0x2f')]=_['intersection'](_0x379e20['model'],_0x379e20[_0xd2c9('0x2e')]);_0x4793d6['attributes']=_[_0xd2c9('0x30')](_0x379e20[_0xd2c9('0x2c')],qs[_0xd2c9('0x32')](_0x19ba69[_0xd2c9('0x2e')][_0xd2c9('0x32')]));_0x4793d6[_0xd2c9('0x31')]=_0x4793d6[_0xd2c9('0x31')][_0xd2c9('0x33')]?_0x4793d6[_0xd2c9('0x31')]:_0x379e20[_0xd2c9('0x2c')];if(_0x19ba69[_0xd2c9('0x2e')][_0xd2c9('0x3d')]){_0x4793d6['include']=[{'all':!![]}];}_0x4793d6=_['merge']({},_0x4793d6,_0x19ba69[_0xd2c9('0x3c')]);return db[_0xd2c9('0x27')][_0xd2c9('0x45')](_0x4793d6)[_0xd2c9('0x23')](handleEntityNotFound(_0x4fc3e5,null))['then'](respondWithResult(_0x4fc3e5,null))[_0xd2c9('0x41')](handleError(_0x4fc3e5,null));};exports['create']=function(_0x193e6c,_0x118801){return db[_0xd2c9('0x27')][_0xd2c9('0x46')](_0x193e6c[_0xd2c9('0x47')],{})['then'](respondWithResult(_0x118801,0xc9))[_0xd2c9('0x41')](handleError(_0x118801,null));};exports[_0xd2c9('0x22')]=function(_0x7f7b60,_0x527e3f){if(_0x7f7b60[_0xd2c9('0x47')]['id']){delete _0x7f7b60[_0xd2c9('0x47')]['id'];}return db[_0xd2c9('0x27')]['find']({'where':{'id':_0x7f7b60[_0xd2c9('0x43')]['id']}})['then'](handleEntityNotFound(_0x527e3f,null))[_0xd2c9('0x23')](saveUpdates(_0x7f7b60['body'],null))['then'](respondWithResult(_0x527e3f,null))[_0xd2c9('0x41')](handleError(_0x527e3f,null));};exports['destroy']=function(_0x1e8a75,_0x47a88d){return db[_0xd2c9('0x27')][_0xd2c9('0x45')]({'where':{'id':_0x1e8a75[_0xd2c9('0x43')]['id']}})[_0xd2c9('0x23')](handleEntityNotFound(_0x47a88d,null))[_0xd2c9('0x23')](removeEntity(_0x47a88d,null))[_0xd2c9('0x41')](handleError(_0x47a88d,null));}; \ No newline at end of file +var _0x3f6b=['sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','destroy','then','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x26c5f0,_0x301f2d){var _0x12b94a=function(_0x101c5e){while(--_0x101c5e){_0x26c5f0['push'](_0x26c5f0['shift']());}};_0x12b94a(++_0x301f2d);}(_0x3f6b,0x113));var _0xb3f6=function(_0x5fc032,_0x4d20b1){_0x5fc032=_0x5fc032-0x0;var _0x43ff5a=_0x3f6b[_0x5fc032];return _0x43ff5a;};'use strict';var emlformat=require(_0xb3f6('0x0'));var rimraf=require(_0xb3f6('0x1'));var zipdir=require(_0xb3f6('0x2'));var jsonpatch=require(_0xb3f6('0x3'));var rp=require(_0xb3f6('0x4'));var moment=require('moment');var BPromise=require(_0xb3f6('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb3f6('0x6'));var sox=require(_0xb3f6('0x7'));var csv=require('to-csv');var ejs=require(_0xb3f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb3f6('0x9'));var jsforce=require(_0xb3f6('0xa'));var deskjs=require(_0xb3f6('0xb'));var toCsv=require(_0xb3f6('0xc'));var querystring=require(_0xb3f6('0xd'));var Papa=require(_0xb3f6('0xe'));var Redis=require(_0xb3f6('0xf'));var authService=require(_0xb3f6('0x10'));var qs=require(_0xb3f6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb3f6('0x12'));var logger=require(_0xb3f6('0x13'))(_0xb3f6('0x14'));var utils=require(_0xb3f6('0x15'));var config=require(_0xb3f6('0x16'));var licenseUtil=require(_0xb3f6('0x17'));var db=require(_0xb3f6('0x18'))['db'];function respondWithStatusCode(_0x3f1340,_0xff817a){_0xff817a=_0xff817a||0xcc;return function(_0x357175){if(_0x357175){return _0x3f1340[_0xb3f6('0x19')](_0xff817a);}return _0x3f1340[_0xb3f6('0x1a')](_0xff817a)[_0xb3f6('0x1b')]();};}function respondWithResult(_0x3b80f5,_0x53a286){_0x53a286=_0x53a286||0xc8;return function(_0x2f2b8e){if(_0x2f2b8e){return _0x3b80f5[_0xb3f6('0x1a')](_0x53a286)[_0xb3f6('0x1c')](_0x2f2b8e);}};}function respondWithFilteredResult(_0x3f03d2,_0xd41895){return function(_0x210eb4){if(_0x210eb4){var _0x403194=typeof _0xd41895[_0xb3f6('0x1d')]==='undefined'&&typeof _0xd41895[_0xb3f6('0x1e')]===_0xb3f6('0x1f');var _0xdc9a25=_0x210eb4[_0xb3f6('0x20')];var _0x3afd73=_0x403194?0x0:_0xd41895[_0xb3f6('0x1d')];var _0x5c67c7=_0x403194?_0x210eb4[_0xb3f6('0x20')]:_0xd41895[_0xb3f6('0x1d')]+_0xd41895['limit'];var _0x581d19;if(_0x5c67c7>=_0xdc9a25){_0x5c67c7=_0xdc9a25;_0x581d19=0xc8;}else{_0x581d19=0xce;}_0x3f03d2[_0xb3f6('0x1a')](_0x581d19);return _0x3f03d2[_0xb3f6('0x21')]('Content-Range',_0x3afd73+'-'+_0x5c67c7+'/'+_0xdc9a25)[_0xb3f6('0x1c')](_0x210eb4);}return null;};}function patchUpdates(_0x4098db){return function(_0x461d2e){try{jsonpatch[_0xb3f6('0x22')](_0x461d2e,_0x4098db,!![]);}catch(_0x514588){return BPromise[_0xb3f6('0x23')](_0x514588);}return _0x461d2e[_0xb3f6('0x24')]();};}function saveUpdates(_0x56d3ed,_0x4af572){return function(_0x3a6475){if(_0x3a6475){return _0x3a6475['update'](_0x56d3ed)['then'](function(_0x534bcf){return _0x534bcf;});}return null;};}function removeEntity(_0xb03f0a,_0x10641d){return function(_0x15d7dc){if(_0x15d7dc){return _0x15d7dc[_0xb3f6('0x25')]()[_0xb3f6('0x26')](function(){_0xb03f0a[_0xb3f6('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29678f,_0x206b55){return function(_0x475c2a){if(!_0x475c2a){_0x29678f[_0xb3f6('0x19')](0x194);}return _0x475c2a;};}function handleError(_0x23a6ce,_0xb114e9){_0xb114e9=_0xb114e9||0x1f4;return function(_0x181507){logger[_0xb3f6('0x27')](_0x181507[_0xb3f6('0x28')]);if(_0x181507['name']){delete _0x181507[_0xb3f6('0x29')];}_0x23a6ce[_0xb3f6('0x1a')](_0xb114e9)[_0xb3f6('0x2a')](_0x181507);};}exports[_0xb3f6('0x2b')]=function(_0x20ffec,_0x1a1e34){var _0x12660d={},_0x36e193={},_0x18d8e9={'count':0x0,'rows':[]};var _0x4c7699=_[_0xb3f6('0x2c')](db[_0xb3f6('0x2d')][_0xb3f6('0x2e')],function(_0x2bc148){return{'name':_0x2bc148[_0xb3f6('0x2f')],'type':_0x2bc148[_0xb3f6('0x30')][_0xb3f6('0x31')]};});_0x36e193[_0xb3f6('0x32')]=_[_0xb3f6('0x2c')](_0x4c7699,_0xb3f6('0x29'));_0x36e193[_0xb3f6('0x33')]=_[_0xb3f6('0x34')](_0x20ffec[_0xb3f6('0x33')]);_0x36e193[_0xb3f6('0x35')]=_[_0xb3f6('0x36')](_0x36e193['model'],_0x36e193[_0xb3f6('0x33')]);_0x12660d[_0xb3f6('0x37')]=_['intersection'](_0x36e193[_0xb3f6('0x32')],qs['fields'](_0x20ffec[_0xb3f6('0x33')][_0xb3f6('0x38')]));_0x12660d[_0xb3f6('0x37')]=_0x12660d['attributes'][_0xb3f6('0x39')]?_0x12660d[_0xb3f6('0x37')]:_0x36e193[_0xb3f6('0x32')];if(!_0x20ffec[_0xb3f6('0x33')][_0xb3f6('0x3a')](_0xb3f6('0x3b'))){_0x12660d['limit']=qs['limit'](_0x20ffec[_0xb3f6('0x33')][_0xb3f6('0x1e')]);_0x12660d[_0xb3f6('0x1d')]=qs[_0xb3f6('0x1d')](_0x20ffec[_0xb3f6('0x33')]['offset']);}_0x12660d['order']=qs[_0xb3f6('0x3c')](_0x20ffec['query'][_0xb3f6('0x3c')]);_0x12660d['where']=qs['filters'](_[_0xb3f6('0x3d')](_0x20ffec[_0xb3f6('0x33')],_0x36e193[_0xb3f6('0x35')]),_0x4c7699);if(_0x20ffec[_0xb3f6('0x33')][_0xb3f6('0x3e')]){_0x12660d[_0xb3f6('0x3f')]=_[_0xb3f6('0x40')](_0x12660d[_0xb3f6('0x3f')],{'$or':_['map'](_0x4c7699,function(_0x301543){if(_0x301543[_0xb3f6('0x30')]!==_0xb3f6('0x41')){var _0x4ee423={};_0x4ee423[_0x301543[_0xb3f6('0x29')]]={'$like':'%'+_0x20ffec[_0xb3f6('0x33')][_0xb3f6('0x3e')]+'%'};return _0x4ee423;}})});}_0x12660d=_[_0xb3f6('0x40')]({},_0x12660d,_0x20ffec[_0xb3f6('0x42')]);var _0x579f3f={'where':_0x12660d[_0xb3f6('0x3f')]};return db[_0xb3f6('0x2d')]['count'](_0x579f3f)[_0xb3f6('0x26')](function(_0x1d6e79){_0x18d8e9[_0xb3f6('0x20')]=_0x1d6e79;if(_0x20ffec['query'][_0xb3f6('0x43')]){_0x12660d['include']=[{'all':!![]}];}return db[_0xb3f6('0x2d')][_0xb3f6('0x44')](_0x12660d);})['then'](function(_0x1fe919){_0x18d8e9['rows']=_0x1fe919;return _0x18d8e9;})[_0xb3f6('0x26')](respondWithFilteredResult(_0x1a1e34,_0x12660d))[_0xb3f6('0x45')](handleError(_0x1a1e34,null));};exports[_0xb3f6('0x46')]=function(_0x2411f0,_0x53024c){var _0x5de90a={'raw':!![],'where':{'id':_0x2411f0[_0xb3f6('0x47')]['id']}},_0x580bb4={};_0x580bb4['model']=_['keys'](db[_0xb3f6('0x2d')][_0xb3f6('0x2e')]);_0x580bb4[_0xb3f6('0x33')]=_[_0xb3f6('0x34')](_0x2411f0[_0xb3f6('0x33')]);_0x580bb4[_0xb3f6('0x35')]=_[_0xb3f6('0x36')](_0x580bb4[_0xb3f6('0x32')],_0x580bb4[_0xb3f6('0x33')]);_0x5de90a[_0xb3f6('0x37')]=_[_0xb3f6('0x36')](_0x580bb4[_0xb3f6('0x32')],qs[_0xb3f6('0x38')](_0x2411f0[_0xb3f6('0x33')][_0xb3f6('0x38')]));_0x5de90a[_0xb3f6('0x37')]=_0x5de90a[_0xb3f6('0x37')][_0xb3f6('0x39')]?_0x5de90a[_0xb3f6('0x37')]:_0x580bb4[_0xb3f6('0x32')];if(_0x2411f0['query'][_0xb3f6('0x43')]){_0x5de90a['include']=[{'all':!![]}];}_0x5de90a=_['merge']({},_0x5de90a,_0x2411f0[_0xb3f6('0x42')]);return db[_0xb3f6('0x2d')][_0xb3f6('0x48')](_0x5de90a)['then'](handleEntityNotFound(_0x53024c,null))['then'](respondWithResult(_0x53024c,null))[_0xb3f6('0x45')](handleError(_0x53024c,null));};exports[_0xb3f6('0x49')]=function(_0x37d92d,_0x307adf){return db[_0xb3f6('0x2d')][_0xb3f6('0x49')](_0x37d92d[_0xb3f6('0x4a')],{})[_0xb3f6('0x26')](respondWithResult(_0x307adf,0xc9))[_0xb3f6('0x45')](handleError(_0x307adf,null));};exports['update']=function(_0x28a60e,_0x439de4){if(_0x28a60e[_0xb3f6('0x4a')]['id']){delete _0x28a60e[_0xb3f6('0x4a')]['id'];}return db[_0xb3f6('0x2d')]['find']({'where':{'id':_0x28a60e[_0xb3f6('0x47')]['id']}})[_0xb3f6('0x26')](handleEntityNotFound(_0x439de4,null))[_0xb3f6('0x26')](saveUpdates(_0x28a60e['body'],null))[_0xb3f6('0x26')](respondWithResult(_0x439de4,null))[_0xb3f6('0x45')](handleError(_0x439de4,null));};exports['destroy']=function(_0x2d90a6,_0x5e88a2){return db['SmsApplication'][_0xb3f6('0x48')]({'where':{'id':_0x2d90a6['params']['id']}})[_0xb3f6('0x26')](handleEntityNotFound(_0x5e88a2,null))[_0xb3f6('0x26')](removeEntity(_0x5e88a2,null))[_0xb3f6('0x45')](handleError(_0x5e88a2,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 2462fb3..8eca9c2 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 _0xb55a=['./smsApplication.attributes','define','SmsApplication','sms_applications','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x377da0,_0x504061){var _0xdd38a3=function(_0x2d8dfa){while(--_0x2d8dfa){_0x377da0['push'](_0x377da0['shift']());}};_0xdd38a3(++_0x504061);}(_0xb55a,0x184));var _0xab55=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xb55a[_0x5a776b];return _0xbbef59;};'use strict';var _=require(_0xab55('0x0'));var util=require(_0xab55('0x1'));var logger=require('../../config/logger')(_0xab55('0x2'));var moment=require(_0xab55('0x3'));var BPromise=require(_0xab55('0x4'));var rp=require(_0xab55('0x5'));var fs=require('fs');var path=require(_0xab55('0x6'));var rimraf=require(_0xab55('0x7'));var config=require('../../config/environment');var attributes=require(_0xab55('0x8'));module['exports']=function(_0x29258d,_0x487850){return _0x29258d[_0xab55('0x9')](_0xab55('0xa'),attributes,{'tableName':_0xab55('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd29e=['SmsApplication','utf8mb4','util','../../config/logger','api','bluebird','request-promise','path','./smsApplication.attributes','exports','define'];(function(_0x233611,_0x190281){var _0x25c16a=function(_0x352851){while(--_0x352851){_0x233611['push'](_0x233611['shift']());}};_0x25c16a(++_0x190281);}(_0xd29e,0x7b));var _0xed29=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd29e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xed29('0x0'));var logger=require(_0xed29('0x1'))(_0xed29('0x2'));var moment=require('moment');var BPromise=require(_0xed29('0x3'));var rp=require(_0xed29('0x4'));var fs=require('fs');var path=require(_0xed29('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xed29('0x6'));module[_0xed29('0x7')]=function(_0x287610,_0x4907a2){return _0x287610[_0xed29('0x8')](_0xed29('0x9'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xed29('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 06f822d..825389b 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 _0x2d07=['../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2d07,0x13a));var _0x72d0=function(_0x14f458,_0x5dd219){_0x14f458=_0x14f458-0x0;var _0x4ff2da=_0x2d07[_0x14f458];return _0x4ff2da;};'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});function respondWithRpcPromise(_0xdad2db,_0x2a4100,_0x47a826){return new BPromise(function(_0x4f2c34,_0x6d0ff6){return client['request'](_0xdad2db,_0x47a826)['then'](function(_0x5db523){logger[_0x72d0('0xb')](_0x72d0('0xc'),_0x2a4100,_0x72d0('0xd'));logger[_0x72d0('0xe')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x2a4100,'request\x20sent',JSON['stringify'](_0x5db523));if(_0x5db523[_0x72d0('0xf')]){if(_0x5db523[_0x72d0('0xf')][_0x72d0('0x10')]===0x1f4){logger[_0x72d0('0xf')](_0x72d0('0xc'),_0x2a4100,_0x5db523['error'][_0x72d0('0x11')]);return _0x6d0ff6(_0x5db523[_0x72d0('0xf')][_0x72d0('0x11')]);}logger['error'](_0x72d0('0xc'),_0x2a4100,_0x5db523[_0x72d0('0xf')][_0x72d0('0x11')]);return _0x4f2c34(_0x5db523[_0x72d0('0xf')][_0x72d0('0x11')]);}else{logger[_0x72d0('0xb')]('SmsApplication,\x20%s,\x20%s',_0x2a4100,_0x72d0('0xd'));_0x4f2c34(_0x5db523[_0x72d0('0x12')][_0x72d0('0x11')]);}})[_0x72d0('0x13')](function(_0x2a761c){logger[_0x72d0('0xf')](_0x72d0('0xc'),_0x2a4100,_0x2a761c);_0x6d0ff6(_0x2a761c);});});} \ No newline at end of file +var _0x0120=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x416a06,_0x2fad7b){var _0x110631=function(_0x5cd1b1){while(--_0x5cd1b1){_0x416a06['push'](_0x416a06['shift']());}};_0x110631(++_0x2fad7b);}(_0x0120,0x6f));var _0x0012=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x0120[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var moment=require(_0x0012('0x2'));var BPromise=require(_0x0012('0x3'));var rs=require(_0x0012('0x4'));var fs=require('fs');var Redis=require(_0x0012('0x5'));var db=require(_0x0012('0x6'))['db'];var utils=require(_0x0012('0x7'));var logger=require(_0x0012('0x8'))(_0x0012('0x9'));var config=require(_0x0012('0xa'));var jayson=require(_0x0012('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x59980a,_0x95d441,_0x436af8){return new BPromise(function(_0x3d4c64,_0x30176d){return client[_0x0012('0xc')](_0x59980a,_0x436af8)['then'](function(_0x14991f){logger[_0x0012('0xd')](_0x0012('0xe'),_0x95d441,_0x0012('0xf'));logger['debug'](_0x0012('0x10'),_0x95d441,'request\x20sent',JSON[_0x0012('0x11')](_0x14991f));if(_0x14991f[_0x0012('0x12')]){if(_0x14991f[_0x0012('0x12')][_0x0012('0x13')]===0x1f4){logger[_0x0012('0x12')]('SmsApplication,\x20%s,\x20%s',_0x95d441,_0x14991f[_0x0012('0x12')]['message']);return _0x30176d(_0x14991f['error']['message']);}logger['error'](_0x0012('0xe'),_0x95d441,_0x14991f['error'][_0x0012('0x14')]);return _0x3d4c64(_0x14991f[_0x0012('0x12')]['message']);}else{logger[_0x0012('0xd')](_0x0012('0xe'),_0x95d441,_0x0012('0xf'));_0x3d4c64(_0x14991f[_0x0012('0x15')]['message']);}})['catch'](function(_0x1e7fbe){logger[_0x0012('0x12')](_0x0012('0xe'),_0x95d441,_0x1e7fbe);_0x30176d(_0x1e7fbe);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 80078a4..0f9fae8 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 _0x6cb4=['./smsInteraction.controller','isAuthenticated','get','/describe','describe','/:id','show','getMessages','/:id/download','create','post','/:id/messages','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x440cfd,_0x4d34d3){var _0x2a233c=function(_0x4fce38){while(--_0x4fce38){_0x440cfd['push'](_0x440cfd['shift']());}};_0x2a233c(++_0x4d34d3);}(_0x6cb4,0xff));var _0x46cb=function(_0x22c796,_0x2aa3d3){_0x22c796=_0x22c796-0x0;var _0x30db2d=_0x6cb4[_0x22c796];return _0x30db2d;};'use strict';var multer=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var path=require(_0x46cb('0x2'));var timeout=require(_0x46cb('0x3'));var express=require(_0x46cb('0x4'));var router=express[_0x46cb('0x5')]();var fs_extra=require(_0x46cb('0x6'));var auth=require(_0x46cb('0x7'));var interaction=require(_0x46cb('0x8'));var config=require('../../config/environment');var controller=require(_0x46cb('0x9'));router['get']('/',auth[_0x46cb('0xa')](),controller['index']);router[_0x46cb('0xb')](_0x46cb('0xc'),auth[_0x46cb('0xa')](),controller[_0x46cb('0xd')]);router[_0x46cb('0xb')](_0x46cb('0xe'),auth['isAuthenticated'](),controller[_0x46cb('0xf')]);router[_0x46cb('0xb')]('/:id/messages',auth[_0x46cb('0xa')](),controller[_0x46cb('0x10')]);router['get'](_0x46cb('0x11'),auth[_0x46cb('0xa')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x46cb('0x12')]);router[_0x46cb('0x13')](_0x46cb('0x14'),auth[_0x46cb('0xa')](),controller['addMessage']);router[_0x46cb('0x13')](_0x46cb('0x15'),auth[_0x46cb('0xa')](),interaction[_0x46cb('0x16')](_0x46cb('0x17'),_0x46cb('0x18')),controller[_0x46cb('0x19')]);router[_0x46cb('0x1a')](_0x46cb('0xe'),auth[_0x46cb('0xa')](),interaction[_0x46cb('0x16')]('sms',_0x46cb('0x1b')),controller['update']);router[_0x46cb('0x1c')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x46cb('0x17'),_0x46cb('0x1d')),controller[_0x46cb('0x1e')]);router[_0x46cb('0x1c')](_0x46cb('0x15'),auth[_0x46cb('0xa')](),controller[_0x46cb('0x1f')]);module[_0x46cb('0x20')]=router; \ No newline at end of file +var _0xb62e=['removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','isAuthenticated','index','get','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','smsinteraction:addtags','addTags','put','sms','smsinteraction:update','update','delete','smsinteraction:destroy','destroy'];(function(_0x389974,_0x58f1dd){var _0x49b288=function(_0x37cd63){while(--_0x37cd63){_0x389974['push'](_0x389974['shift']());}};_0x49b288(++_0x58f1dd);}(_0xb62e,0x1de));var _0xeb62=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xb62e[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var path=require(_0xeb62('0x2'));var timeout=require(_0xeb62('0x3'));var express=require('express');var router=express[_0xeb62('0x4')]();var fs_extra=require(_0xeb62('0x5'));var auth=require(_0xeb62('0x6'));var interaction=require(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));var controller=require(_0xeb62('0x9'));router['get']('/',auth[_0xeb62('0xa')](),controller[_0xeb62('0xb')]);router[_0xeb62('0xc')]('/describe',auth[_0xeb62('0xa')](),controller[_0xeb62('0xd')]);router[_0xeb62('0xc')](_0xeb62('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xeb62('0xc')](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x10')]);router[_0xeb62('0xc')](_0xeb62('0x11'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x12')]);router[_0xeb62('0x13')]('/',auth[_0xeb62('0xa')](),controller['create']);router[_0xeb62('0x13')](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x14')]);router['post'](_0xeb62('0x15'),auth[_0xeb62('0xa')](),interaction[_0xeb62('0x16')]('sms',_0xeb62('0x17')),controller[_0xeb62('0x18')]);router[_0xeb62('0x19')]('/:id',auth[_0xeb62('0xa')](),interaction[_0xeb62('0x16')](_0xeb62('0x1a'),_0xeb62('0x1b')),controller[_0xeb62('0x1c')]);router[_0xeb62('0x1d')](_0xeb62('0xe'),auth[_0xeb62('0xa')](),interaction[_0xeb62('0x16')](_0xeb62('0x1a'),_0xeb62('0x1e')),controller[_0xeb62('0x1f')]);router[_0xeb62('0x1d')]('/:id/tags',auth[_0xeb62('0xa')](),controller[_0xeb62('0x20')]);module[_0xeb62('0x21')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 09f4727..7a2595e 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 _0xfb65=['STRING','ENUM','out','BOOLEAN','moment','exports','DATE'];(function(_0x41cd5a,_0x30f8d1){var _0x40d4b3=function(_0x4d969c){while(--_0x4d969c){_0x41cd5a['push'](_0x41cd5a['shift']());}};_0x40d4b3(++_0x30f8d1);}(_0xfb65,0x82));var _0x5fb6=function(_0x19f322,_0x5ec05f){_0x19f322=_0x19f322-0x0;var _0x54fbff=_0xfb65[_0x19f322];return _0x54fbff;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5fb6('0x0'));module[_0x5fb6('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5fb6('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x5fb6('0x3')]},'thirdDisposition':{'type':Sequelize[_0x5fb6('0x3')]},'note':{'type':Sequelize[_0x5fb6('0x3')]},'phone':{'type':Sequelize[_0x5fb6('0x3')]},'read1stAt':{'type':Sequelize[_0x5fb6('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x5fb6('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x5fb6('0x4')]('in',_0x5fb6('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x5fb6('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x81d4=['BOOLEAN','moment','exports','DATE','STRING','ENUM','out'];(function(_0x11ab6d,_0x40d70f){var _0x5352f0=function(_0x43c0a1){while(--_0x43c0a1){_0x11ab6d['push'](_0x11ab6d['shift']());}};_0x5352f0(++_0x40d70f);}(_0x81d4,0x197));var _0x481d=function(_0x1ade05,_0x10f4b7){_0x1ade05=_0x1ade05-0x0;var _0x1fa8df=_0x81d4[_0x1ade05];return _0x1fa8df;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x481d('0x0'));module[_0x481d('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x481d('0x2')]},'disposition':{'type':Sequelize[_0x481d('0x3')]},'secondDisposition':{'type':Sequelize[_0x481d('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x481d('0x3')]},'read1stAt':{'type':Sequelize[_0x481d('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x481d('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x481d('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x481d('0x4')]('in',_0x481d('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x481d('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 60c87ec..f3fd269 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 _0x99d1=['join','root','files','tmp','server','firstName','lastName','Messages','direction','secret','SmsAccount','Account','Owner','Sms','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','out','System','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','Users','map','fullname','TagIds','split','Tags','catch','SmsInteraction','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','length','sort','where','filters','select','field','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','left_join','users','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','body','start','some','compact','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','SELECT','clone','DESC','t.id\x20IN\x20?','resolve','user','role','isEmpty','i.SmsAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','fields','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','contactName','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','SmsInteractionId','push','all','rows','show','params','includeAll','include','options','create','describe','addMessage','SmsMessage','omit','ids','getMessages','findOne','hasOwnProperty','order','$gte','format','findAll','addTags','setTags','spread','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix'];(function(_0xfaf455,_0x13c0a9){var _0x5aaa60=function(_0x55ce23){while(--_0x55ce23){_0xfaf455['push'](_0xfaf455['shift']());}};_0x5aaa60(++_0x13c0a9);}(_0x99d1,0x104));var _0x199d=function(_0x4ed12e,_0x449d39){_0x4ed12e=_0x4ed12e-0x0;var _0x4b5f8a=_0x99d1[_0x4ed12e];return _0x4b5f8a;};'use strict';var emlformat=require(_0x199d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x199d('0x1'));var jsonpatch=require(_0x199d('0x2'));var rp=require(_0x199d('0x3'));var moment=require(_0x199d('0x4'));var BPromise=require(_0x199d('0x5'));var Mustache=require('mustache');var util=require(_0x199d('0x6'));var path=require(_0x199d('0x7'));var sox=require(_0x199d('0x8'));var csv=require(_0x199d('0x9'));var ejs=require(_0x199d('0xa'));var fs=require('fs');var fs_extra=require(_0x199d('0xb'));var _=require(_0x199d('0xc'));var squel=require(_0x199d('0xd'));var crypto=require(_0x199d('0xe'));var jsforce=require(_0x199d('0xf'));var deskjs=require(_0x199d('0x10'));var toCsv=require(_0x199d('0x9'));var querystring=require(_0x199d('0x11'));var Papa=require(_0x199d('0x12'));var Redis=require('ioredis');var authService=require(_0x199d('0x13'));var qs=require(_0x199d('0x14'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x199d('0x15'));var hardwareService=require(_0x199d('0x16'));var logger=require(_0x199d('0x17'))('api');var utils=require(_0x199d('0x18'));var config=require(_0x199d('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x199d('0x1a')]=_[_0x199d('0x1b')](config[_0x199d('0x1a')],{'host':_0x199d('0x1c'),'port':0x18eb});var socket=require(_0x199d('0x1d'))(new Redis(config[_0x199d('0x1a')]));require('./smsInteraction.socket')[_0x199d('0x1e')](socket);function respondWithStatusCode(_0x3800b4,_0x5b033d){_0x5b033d=_0x5b033d||0xcc;return function(_0x21ee01){if(_0x21ee01){return _0x3800b4[_0x199d('0x1f')](_0x5b033d);}return _0x3800b4[_0x199d('0x20')](_0x5b033d)[_0x199d('0x21')]();};}function respondWithResult(_0x46a10f,_0x3da481){_0x3da481=_0x3da481||0xc8;return function(_0x1fa235){if(_0x1fa235){return _0x46a10f[_0x199d('0x20')](_0x3da481)[_0x199d('0x22')](_0x1fa235);}};}function respondWithFilteredResult(_0x2c68a9,_0x1c99d2){return function(_0x2637a6){if(_0x2637a6){var _0x1bac24=typeof _0x1c99d2[_0x199d('0x23')]===_0x199d('0x24')&&typeof _0x1c99d2[_0x199d('0x25')]===_0x199d('0x24');var _0x28eb93=_0x2637a6[_0x199d('0x26')];var _0x4a4007=_0x1bac24?0x0:_0x1c99d2['offset'];var _0x5e0746=_0x1bac24?_0x2637a6['count']:_0x1c99d2[_0x199d('0x23')]+_0x1c99d2[_0x199d('0x25')];var _0x548a01;if(_0x5e0746>=_0x28eb93){_0x5e0746=_0x28eb93;_0x548a01=0xc8;}else{_0x548a01=0xce;}_0x2c68a9[_0x199d('0x20')](_0x548a01);return _0x2c68a9[_0x199d('0x27')](_0x199d('0x28'),_0x4a4007+'-'+_0x5e0746+'/'+_0x28eb93)['json'](_0x2637a6);}return null;};}function patchUpdates(_0x14bba2){return function(_0x32f7ea){try{jsonpatch[_0x199d('0x29')](_0x32f7ea,_0x14bba2,!![]);}catch(_0x903963){return BPromise['reject'](_0x903963);}return _0x32f7ea[_0x199d('0x2a')]();};}function saveUpdates(_0xac74fe,_0x167b34){return function(_0x582a1f){if(_0x582a1f){return _0x582a1f[_0x199d('0x2b')](_0xac74fe)[_0x199d('0x2c')](function(_0x34f330){return _0x34f330;});}return null;};}function removeEntity(_0x1f73de,_0x40832c){return function(_0x42ccbd){if(_0x42ccbd){return _0x42ccbd[_0x199d('0x2d')]()[_0x199d('0x2c')](function(){_0x1f73de[_0x199d('0x20')](0xcc)[_0x199d('0x21')]();});}};}function handleEntityNotFound(_0x2e35dc,_0x241ce0){return function(_0x4e8a18){if(!_0x4e8a18){_0x2e35dc['sendStatus'](0x194);}return _0x4e8a18;};}function handleError(_0x2e91fa,_0x17a289){_0x17a289=_0x17a289||0x1f4;return function(_0x4bdbda){logger['error'](_0x4bdbda[_0x199d('0x2e')]);if(_0x4bdbda[_0x199d('0x2f')]){delete _0x4bdbda[_0x199d('0x2f')];}_0x2e91fa['status'](_0x17a289)[_0x199d('0x30')](_0x4bdbda);};}function getInteractionUsers(_0x58ba02,_0x15bf09){return new BPromise(function(_0x26eb74,_0x5a2734){try{if(_0x15bf09[_0x58ba02['id']]){_0x58ba02[_0x199d('0x31')]=_[_0x199d('0x32')](_0x15bf09[_0x58ba02['id']],function(_0x1f7e4d){return{'id':_0x1f7e4d['id'],'fullname':_0x1f7e4d[_0x199d('0x33')]};});}}catch(_0x1dd441){_0x5a2734(_0x1dd441);}_0x26eb74(_0x58ba02);});}function getInteractionTags(_0x306af7,_0x1e05ec){return new BPromise(function(_0x22d17b,_0x3405f8){try{if(_0x306af7[_0x199d('0x34')]){_0x306af7['Tags']=[];_0x306af7[_0x199d('0x34')][_0x199d('0x35')](',')['forEach'](function(_0x4f7e41){_0x306af7[_0x199d('0x36')]['push'](_0x1e05ec[_0x4f7e41]);});}delete _0x306af7[_0x199d('0x34')];}catch(_0x487cc1){_0x3405f8(_0x487cc1);}_0x22d17b(_0x306af7);});}function updateSmsInteraction(_0x9fb64,_0x5a9ea0,_0x5b9709){return new BPromise(function(_0x17cfbe,_0x5b2a4e){return getInteractionUsers(_0x9fb64,_0x5b9709)['then'](function(_0x487432){return getInteractionTags(_0x487432,_0x5a9ea0);})[_0x199d('0x2c')](function(_0x171c36){_0x17cfbe(_0x171c36);})[_0x199d('0x37')](function(_0x1840e4){_0x5b2a4e(_0x1840e4);});});}exports['index']=function(_0x134484,_0x241b2e){var _0x11653a={},_0x40c716={},_0xb9a062={'count':0x0,'rows':[]};var _0x234e77=_[_0x199d('0x32')](db[_0x199d('0x38')][_0x199d('0x39')],function(_0x34691d){return{'name':_0x34691d[_0x199d('0x3a')],'type':_0x34691d[_0x199d('0x3b')][_0x199d('0x3c')]};});_0x40c716[_0x199d('0x3d')]=_[_0x199d('0x32')](_0x234e77,_0x199d('0x2f'));_0x40c716[_0x199d('0x3e')]=_[_0x199d('0x3f')](_0x134484[_0x199d('0x3e')]);_0x40c716['filters']=_[_0x199d('0x40')](_0x40c716['model'],_0x40c716[_0x199d('0x3e')]);_0x11653a[_0x199d('0x41')]=_[_0x199d('0x40')](_0x40c716['model'],qs['fields'](_0x134484['query']['fields']));_0x11653a[_0x199d('0x41')]=_0x11653a[_0x199d('0x41')][_0x199d('0x42')]?_0x11653a[_0x199d('0x41')]:_0x40c716[_0x199d('0x3d')];if(!_0x134484[_0x199d('0x3e')]['hasOwnProperty']('nolimit')){_0x11653a[_0x199d('0x25')]=qs[_0x199d('0x25')](_0x134484[_0x199d('0x3e')][_0x199d('0x25')]);_0x11653a[_0x199d('0x23')]=qs['offset'](_0x134484['query'][_0x199d('0x23')]);}_0x11653a['order']=qs[_0x199d('0x43')](_0x134484['query']['sort']);_0x11653a[_0x199d('0x44')]=qs[_0x199d('0x45')](_['pick'](_0x134484[_0x199d('0x3e')],_0x40c716['filters']),_0x234e77);var _0x35ca57=[];var _0x1d95e1=squel[_0x199d('0x46')]()[_0x199d('0x47')]('id')['field']('name')[_0x199d('0x47')]('color')[_0x199d('0x48')](_0x199d('0x49'));var _0x1ab5d8=squel['select']()[_0x199d('0x47')](_0x199d('0x4a'))[_0x199d('0x47')](_0x199d('0x4b'))[_0x199d('0x47')](_0x199d('0x4c'))[_0x199d('0x48')]('user_has_sms_interactions','ui')[_0x199d('0x4d')]('users','u','u.id\x20=\x20ui.UserId');var _0x1b6d3a=squel[_0x199d('0x46')]()['from']('sms_interactions','i')[_0x199d('0x4d')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x199d('0x4d')](_0x199d('0x4e'),'o',_0x199d('0x4f'))['left_join'](_0x199d('0x50'),'a',_0x199d('0x51'))[_0x199d('0x4d')](_0x199d('0x52'),'me',_0x199d('0x53'))[_0x199d('0x4d')](_0x199d('0x54'),'it',_0x199d('0x55'))[_0x199d('0x4d')](_0x199d('0x49'),'t',_0x199d('0x56'));var _0x263c6c=squel[_0x199d('0x57')]();var _0x300e25=[];var _0x215b74=squel['expr']();var _0x92e7ca;if(_0x134484[_0x199d('0x3e')][_0x199d('0x58')]){_0x92e7ca=as[_0x199d('0x59')](_0x134484['query'][_0x199d('0x58')]);var _0x1884f3=_0x92e7ca[_0x199d('0x5a')];for(var _0x528c75=0x0;_0x528c75<_0x92e7ca[_0x199d('0x5b')]['length'];_0x528c75++){var _0xdcef98=_0x92e7ca[_0x199d('0x5b')][_0x528c75];var _0x152e10='i';var _0x59c5e9=_[_0x199d('0x5c')](_0x234e77,[_0x199d('0x2f'),_0xdcef98['field']]);if(!_0x59c5e9){switch(_0xdcef98[_0x199d('0x47')]){case _0x199d('0x5d'):if(_0xdcef98[_0x199d('0x5e')]==0x1){_0x1b6d3a[_0x199d('0x5f')]('`'+_0xdcef98[_0x199d('0x47')]+'`\x20=\x200');}else{_0x1b6d3a[_0x199d('0x5f')]('`'+_0xdcef98['field']+'`\x20>\x200');}break;case _0x199d('0x60'):if(_0xdcef98[_0x199d('0x61')]===_0x199d('0x62')){if(_0xdcef98[_0x199d('0x5e')][_0x199d('0x35')]('\x20')[_0x199d('0x42')]>0x1){_0x263c6c[_0x1884f3](_0x199d('0x63'),qs['getFullTextValue'](_0xdcef98[_0x199d('0x5e')]),null);}else{var _0x3efd95='%'+_0xdcef98[_0x199d('0x5e')]+'%';_0x263c6c[_0x1884f3](_0x199d('0x64'),_0x3efd95,_0x3efd95,_0x3efd95);}}else{_0x59c5e9=_['find'](_0x234e77,[_0x199d('0x2f'),'ContactId']);_0xdcef98['field']=_0x199d('0x65');_0x4216bc=as[_0x199d('0x66')](_0x152e10,_0x59c5e9[_0x199d('0x3b')],_0xdcef98);_0x263c6c[_0x1884f3](_0x4216bc[_0x199d('0x67')],_0x4216bc[_0x199d('0x5e')]['start'],_0x4216bc[_0x199d('0x5e')]['end']);}break;case'Tag':var _0x27b568=_0xdcef98['value']['split'](',')[_0x199d('0x32')](function(_0x418eb0){return Number(_0x418eb0);});_0x27b568[_0x199d('0x68')](function(_0x38c2e0){_0x215b74['or'](_0x199d('0x69'),'%,'+_0x38c2e0+',%');});_0x300e25=_[_0x199d('0x6a')](_0x300e25,_0x27b568);break;case _0x199d('0x6b'):if(_0xdcef98[_0x199d('0x61')]===_0x199d('0x62')){_0x263c6c[_0x1884f3]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0xdcef98['value']+'%',null);}else{_0x59c5e9=_['find'](_0x234e77,[_0x199d('0x2f'),_0x199d('0x6c')]);_0xdcef98['field']=_0x199d('0x6c');_0x4216bc=as[_0x199d('0x66')](_0x152e10,_0x59c5e9['type'],_0xdcef98);_0x263c6c[_0x1884f3](_0x4216bc[_0x199d('0x67')],_0x4216bc[_0x199d('0x5e')]['start'],_0x4216bc[_0x199d('0x5e')]['end']);}break;case _0x199d('0x6d'):_0x4216bc=as[_0x199d('0x66')]('me',null,_0xdcef98);_0x263c6c[_0x1884f3](_0x4216bc[_0x199d('0x67')],_0x4216bc[_0x199d('0x5e')][_0x199d('0x6e')],_0x4216bc['value'][_0x199d('0x21')]);break;}}else{var _0x4216bc=as[_0x199d('0x66')](_0x152e10,_0x59c5e9['type'],_0xdcef98);_0x263c6c[_0x1884f3](_0x4216bc[_0x199d('0x67')],_0x4216bc['value']['start'],_0x4216bc[_0x199d('0x5e')][_0x199d('0x21')]);}}}else{var _0x2a8d79=_(_0x134484['query'])['keys']()[_0x199d('0x32')](function(_0x31171f){return _[_0x199d('0x6f')](_0x234e77,[_0x199d('0x2f'),_0x31171f])?_0x31171f:undefined;})[_0x199d('0x70')]()[_0x199d('0x5e')]();if(!_['isEmpty'](_0x2a8d79)){_0x2a8d79['forEach'](function(_0x551102){if(_0x551102===_0x199d('0x71')){_0x1b6d3a[_0x199d('0x44')](_0x199d('0x72'),[][_0x199d('0x73')](_0x134484['query'][_0x551102]));}else if(_0x551102===_0x199d('0x74')){var _0x2b6562=JSON[_0x199d('0x75')](_0x134484[_0x199d('0x3e')][_0x551102])['$gte'];var _0x19fa45=JSON['parse'](_0x134484[_0x199d('0x3e')][_0x551102])[_0x199d('0x76')];_0x1b6d3a[_0x199d('0x44')](_0x199d('0x77'),_0x2b6562,_0x19fa45);}else{if(_0x134484[_0x199d('0x3e')][_0x551102]===_0x199d('0x78')){_0x1b6d3a['where']('i.'+_0x551102+_0x199d('0x79'));}else{_0x1b6d3a[_0x199d('0x44')]('i.'+_0x551102+_0x199d('0x7a'),_0x134484[_0x199d('0x3e')][_0x551102]);}}});}if(_0x134484['query'][_0x199d('0x7b')]){if(_0x134484['query'][_0x199d('0x7b')]==0x1){_0x1b6d3a[_0x199d('0x5f')]('`unreadMessages`\x20=\x200');}else{_0x1b6d3a[_0x199d('0x5f')](_0x199d('0x7c'));}}if(_0x134484['query'][_0x199d('0x7d')]){_0x300e25=_[_0x199d('0x7e')](_0x134484[_0x199d('0x3e')]['tag'])?_0x134484[_0x199d('0x3e')][_0x199d('0x7d')]:new Array(_0x134484['query'][_0x199d('0x7d')]);_0x300e25[_0x199d('0x68')](function(_0x50f7dd){_0x215b74['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x50f7dd+',%');});}if(_0x134484[_0x199d('0x3e')][_0x199d('0x7f')]){var _0x3dc861=_0x134484[_0x199d('0x3e')][_0x199d('0x7f')]['replace']('\x5c','\x5c\x5c')[_0x199d('0x80')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x3dc861)){_0x263c6c['or'](_0x199d('0x81'),_0x3dc861+'%')['or'](_0x199d('0x82'),_0x3dc861+'%');}else{_0x263c6c['or'](_0x199d('0x83'),qs['getFullTextValue'](_0x3dc861))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3dc861+'%');}}}_0x1b6d3a['where'](_0x263c6c);_0x1b6d3a[_0x199d('0x84')](_0x199d('0x85'));var _0x341a10={'type':db['Sequelize']['QueryTypes'][_0x199d('0x86')],'raw':!![]};var _0x5dca3b=_0x1b6d3a[_0x199d('0x87')]();_0x5dca3b[_0x199d('0x47')]('i.id');_0x5dca3b['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x199d('0x5d'));if(_0x11653a['order']){_0x11653a['order'][_0x199d('0x68')](function(_0xeaf7fa){var _0x440ceb=_0xeaf7fa[0x0]==='contactName'?_0xeaf7fa[0x0]:'i.'+_0xeaf7fa[0x0];_0x1b6d3a['order'](_0x440ceb,_0xeaf7fa[0x1]===_0x199d('0x88')?![]:!![]);});}if(!_['isEmpty'](_0x300e25)){_0x1b6d3a['having'](_0x215b74);_0x5dca3b[_0x199d('0x44')](_0x199d('0x89'),_0x300e25);}BPromise[_0x199d('0x8a')]()[_0x199d('0x2c')](function(){if(!_0x92e7ca){if(_0x134484[_0x199d('0x3e')][_0x199d('0x71')])return;_0x5dca3b[_0x199d('0x44')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x1b6d3a['where']('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x134484[_0x199d('0x8b')][_0x199d('0x8c')]!=='agent')return;return _0x134484['user']['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0x199d('0x2c')](function(_0x6cdb50){if(_[_0x199d('0x8d')](_0x6cdb50)){_0x5dca3b[_0x199d('0x44')](_0x199d('0x8e'));_0x1b6d3a['where'](_0x199d('0x8e'));}else{_0x5dca3b[_0x199d('0x44')](_0x199d('0x72'),_['map'](_0x6cdb50,'id'));_0x1b6d3a['where']('i.SmsAccountId\x20IN\x20?',_[_0x199d('0x32')](_0x6cdb50,'id'));}});})[_0x199d('0x2c')](function(){if(_0x134484[_0x199d('0x8b')]['role']===_0x199d('0x8f')&&!_0x92e7ca&&!_0x134484[_0x199d('0x3e')]['SmsAccountId'])return[];return db[_0x199d('0x90')][_0x199d('0x3e')](_0x5dca3b[_0x199d('0x91')](),_0x341a10);})['then'](function(_0x39553e){_0xb9a062['count']=_0x39553e[_0x199d('0x42')];if(_0xb9a062[_0x199d('0x26')]===0x0)return[];return db[_0x199d('0x90')][_0x199d('0x3e')](_0x1d95e1[_0x199d('0x91')](),_0x341a10)[_0x199d('0x2c')](function(_0x46cabe){_0x35ca57=_[_0x199d('0x92')](_0x46cabe,'id');_0x341a10=_[_0x199d('0x93')](_0x341a10,{'model':db[_0x199d('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x134484[_0x199d('0x3e')][_0x199d('0x94')]){_0x11653a[_0x199d('0x41')][_0x199d('0x68')](function(_0x24b001){_0x1b6d3a[_0x199d('0x47')]('i.'+_0x24b001);});}else{_0x1b6d3a['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x199d('0x5d'));_0x1b6d3a['field']('a.key',_0x199d('0x95'));_0x1b6d3a[_0x199d('0x47')](_0x199d('0x96'),_0x199d('0x97'));_0x1b6d3a['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',_0x199d('0x98'));_0x1b6d3a['field']('i.*');_0x1b6d3a[_0x199d('0x47')](_0x199d('0x99'),'Contact.firstName');_0x1b6d3a[_0x199d('0x47')](_0x199d('0x9a'),_0x199d('0x9b'));_0x1b6d3a[_0x199d('0x47')](_0x199d('0x9c'),_0x199d('0x9d'));_0x1b6d3a['field'](_0x199d('0x9e'),_0x199d('0x9f'));_0x1b6d3a[_0x199d('0x47')](_0x199d('0xa0'),_0x199d('0xa1'));_0x1b6d3a[_0x199d('0x47')]('c.fax',_0x199d('0xa2'));_0x1b6d3a[_0x199d('0x47')](_0x199d('0xa3'),'Owner.fullname');_0x1b6d3a[_0x199d('0x47')](_0x199d('0xa4'),_0x199d('0xa5'));_0x1b6d3a[_0x199d('0x47')](_0x199d('0xa6'),'TagIds');}if(_0x11653a[_0x199d('0x25')])_0x1b6d3a[_0x199d('0x25')](_0x11653a[_0x199d('0x25')]);if(_0x11653a[_0x199d('0x23')])_0x1b6d3a[_0x199d('0x23')](_0x11653a[_0x199d('0x23')]);return db[_0x199d('0x90')][_0x199d('0x3e')](_0x1b6d3a[_0x199d('0x91')](),_0x341a10);})['then'](function(_0x5161bf){if(_0x5161bf[_0x199d('0x42')]>0x0)_0x1ab5d8['where']('ui.SmsInteractionId\x20IN\x20?',_[_0x199d('0x32')](_0x5161bf,'id'));return db[_0x199d('0x90')][_0x199d('0x3e')](_0x1ab5d8['toString'](),_0x341a10)['then'](function(_0x52cae7){var _0x4dc3ad=_[_0x199d('0xa7')](_0x52cae7,_0x199d('0xa8'));var _0x346ab2=[];_0x5161bf[_0x199d('0x68')](function(_0x430b19){_0x346ab2[_0x199d('0xa9')](updateSmsInteraction(_0x430b19,_0x35ca57,_0x4dc3ad));});return BPromise[_0x199d('0xaa')](_0x346ab2);});});})[_0x199d('0x2c')](function(_0x296003){_0xb9a062[_0x199d('0xab')]=_0x296003;return _0xb9a062;})[_0x199d('0x2c')](respondWithFilteredResult(_0x241b2e,_0x11653a))['catch'](handleError(_0x241b2e,null));};exports[_0x199d('0xac')]=function(_0x3071b3,_0x2891a0){var _0x260d3e={'raw':![],'where':{'id':_0x3071b3[_0x199d('0xad')]['id']}},_0x4f0d60={};_0x4f0d60['model']=_[_0x199d('0x3f')](db[_0x199d('0x38')]['rawAttributes']);_0x4f0d60[_0x199d('0x3e')]=_[_0x199d('0x3f')](_0x3071b3[_0x199d('0x3e')]);_0x4f0d60[_0x199d('0x45')]=_[_0x199d('0x40')](_0x4f0d60[_0x199d('0x3d')],_0x4f0d60['query']);_0x260d3e[_0x199d('0x41')]=_[_0x199d('0x40')](_0x4f0d60[_0x199d('0x3d')],qs[_0x199d('0x94')](_0x3071b3['query'][_0x199d('0x94')]));_0x260d3e['attributes']=_0x260d3e[_0x199d('0x41')][_0x199d('0x42')]?_0x260d3e[_0x199d('0x41')]:_0x4f0d60[_0x199d('0x3d')];if(_0x3071b3[_0x199d('0x3e')][_0x199d('0xae')]){_0x260d3e[_0x199d('0xaf')]=[{'all':!![]}];}_0x260d3e=_['merge']({},_0x260d3e,_0x3071b3[_0x199d('0xb0')]);return db[_0x199d('0x38')]['find'](_0x260d3e)[_0x199d('0x2c')](handleEntityNotFound(_0x2891a0,null))[_0x199d('0x2c')](respondWithResult(_0x2891a0,null))['catch'](handleError(_0x2891a0,null));};exports[_0x199d('0xb1')]=function(_0x53e2f8,_0x12b87f){return db[_0x199d('0x38')][_0x199d('0xb1')](_0x53e2f8[_0x199d('0x6d')],{})[_0x199d('0x2c')](respondWithResult(_0x12b87f,0xc9))[_0x199d('0x37')](handleError(_0x12b87f,null));};exports[_0x199d('0x2b')]=function(_0x44664f,_0x2ad3e7){if(_0x44664f['body']['id']){delete _0x44664f['body']['id'];}return db[_0x199d('0x38')][_0x199d('0x5c')]({'where':{'id':_0x44664f[_0x199d('0xad')]['id']}})[_0x199d('0x2c')](handleEntityNotFound(_0x2ad3e7,null))[_0x199d('0x2c')](saveUpdates(_0x44664f[_0x199d('0x6d')],null))['then'](respondWithResult(_0x2ad3e7,null))[_0x199d('0x37')](handleError(_0x2ad3e7,null));};exports[_0x199d('0x2d')]=function(_0x4347a0,_0x49307d){return db['SmsInteraction'][_0x199d('0x5c')]({'where':{'id':_0x4347a0[_0x199d('0xad')]['id']}})['then'](handleEntityNotFound(_0x49307d,null))[_0x199d('0x2c')](removeEntity(_0x49307d,null))[_0x199d('0x37')](handleError(_0x49307d,null));};exports[_0x199d('0xb2')]=function(_0x4d051d,_0x9d3040){return db[_0x199d('0x38')][_0x199d('0xb2')]()[_0x199d('0x2c')](respondWithResult(_0x9d3040,null))[_0x199d('0x37')](handleError(_0x9d3040,null));};exports[_0x199d('0xb3')]=function(_0x29a729,_0x6c9a59,_0x3aa329){return db[_0x199d('0xb4')][_0x199d('0x5c')]({'where':{'id':_0x29a729[_0x199d('0xad')]['id']}})[_0x199d('0x2c')](handleEntityNotFound(_0x6c9a59,null))['then'](function(_0x90fab5){if(_0x90fab5){return _0x90fab5[_0x199d('0xb3')](_0x29a729[_0x199d('0x6d')]['ids'],_[_0x199d('0xb5')](_0x29a729['body'],[_0x199d('0xb6'),'id'])||{});}})['then'](respondWithResult(_0x6c9a59,null))[_0x199d('0x37')](handleError(_0x6c9a59,null));};exports[_0x199d('0xb7')]=function(_0x2aad36,_0x46a21b,_0x4e299e){var _0x5f0f78={'raw':![],'where':{}};var _0xaf52ed={};var _0x5023d0={'count':0x0,'rows':[]};return db[_0x199d('0x38')][_0x199d('0xb8')]({'where':{'id':_0x2aad36[_0x199d('0xad')]['id']}})[_0x199d('0x2c')](handleEntityNotFound(_0x46a21b,null))[_0x199d('0x2c')](function(_0x10bf73){if(_0x10bf73){_0xaf52ed['model']=_['keys'](db['SmsMessage'][_0x199d('0x39')]);_0xaf52ed['query']=_['keys'](_0x2aad36[_0x199d('0x3e')]);_0xaf52ed[_0x199d('0x45')]=_[_0x199d('0x40')](_0xaf52ed[_0x199d('0x3d')],_0xaf52ed[_0x199d('0x3e')]);_0x5f0f78[_0x199d('0x41')]=_[_0x199d('0x40')](_0xaf52ed[_0x199d('0x3d')],qs['fields'](_0x2aad36[_0x199d('0x3e')][_0x199d('0x94')]));_0x5f0f78[_0x199d('0x41')]=_0x5f0f78[_0x199d('0x41')][_0x199d('0x42')]?_0x5f0f78[_0x199d('0x41')]:_0xaf52ed[_0x199d('0x3d')];if(!_0x2aad36[_0x199d('0x3e')][_0x199d('0xb9')]('nolimit')){_0x5f0f78[_0x199d('0x25')]=qs[_0x199d('0x25')](_0x2aad36[_0x199d('0x3e')]['limit']);_0x5f0f78[_0x199d('0x23')]=qs[_0x199d('0x23')](_0x2aad36[_0x199d('0x3e')][_0x199d('0x23')]);}_0x5f0f78[_0x199d('0xba')]=qs[_0x199d('0x43')](_0x2aad36[_0x199d('0x3e')]['sort']);_0x5f0f78[_0x199d('0x44')]=qs['filters'](_['pick'](_0x2aad36[_0x199d('0x3e')],_0xaf52ed[_0x199d('0x45')]));_0x5f0f78[_0x199d('0x44')][_0x199d('0xa8')]=_0x10bf73['id'];if(_0x2aad36[_0x199d('0x3e')][_0x199d('0x7f')]){_0x5f0f78[_0x199d('0x44')]=_[_0x199d('0x93')](_0x5f0f78[_0x199d('0x44')],{'$or':_[_0x199d('0x32')](_0x5f0f78[_0x199d('0x41')],function(_0x44c6fe){var _0x435c8c={};_0x435c8c[_0x44c6fe]={'$like':'%'+_0x2aad36['query'][_0x199d('0x7f')]+'%'};return _0x435c8c;})});}if(_0x2aad36[_0x199d('0x3e')][_0x199d('0xbb')]){var _0x28b5e1=_0x2aad36[_0x199d('0x3e')][_0x199d('0xbb')][_0x199d('0x35')](',');var _0x5a9902={};_0x5a9902[_0x28b5e1[0x0]]={'$gte':moment(_0x28b5e1[0x1])[_0x199d('0xbc')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5f0f78[_0x199d('0x44')]=_[_0x199d('0x93')](_0x5f0f78['where'],_0x5a9902);}_0x5f0f78=_[_0x199d('0x93')]({},_0x5f0f78,_0x2aad36[_0x199d('0xb0')]);return db['SmsMessage']['count']({'where':_0x5f0f78[_0x199d('0x44')]})['then'](function(_0x1e4639){_0x5023d0['count']=_0x1e4639;if(_0x2aad36[_0x199d('0x3e')][_0x199d('0xae')]){_0x5f0f78['include']=[{'all':!![]}];}return db[_0x199d('0xb4')][_0x199d('0xbd')](_0x5f0f78);})['then'](function(_0x9f2e9){_0x5023d0[_0x199d('0xab')]=_0x9f2e9;return _0x5023d0;});}})[_0x199d('0x2c')](respondWithFilteredResult(_0x46a21b,_0x5f0f78))[_0x199d('0x37')](handleError(_0x46a21b,null));};exports[_0x199d('0xbe')]=function(_0x24b28a,_0x53dadf,_0x187053){return db['SmsInteraction']['find']({'where':{'id':_0x24b28a[_0x199d('0xad')]['id']}})[_0x199d('0x2c')](handleEntityNotFound(_0x53dadf,null))[_0x199d('0x2c')](function(_0x104558){if(_0x104558){return _0x104558[_0x199d('0xbf')](_0x24b28a[_0x199d('0x6d')]['ids'],_['omit'](_0x24b28a['body'],['ids','id'])||{})[_0x199d('0xc0')](function(){return db[_0x199d('0xc1')]['findAll']({'attributes':['id','name',_0x199d('0xc2')],'where':{'id':_0x24b28a[_0x199d('0x6d')][_0x199d('0xb6')]}});})[_0x199d('0x2c')](function(_0x2bfe5e){socket[_0x199d('0xc3')](_0x199d('0xc4'),{'id':Number(_0x24b28a[_0x199d('0xad')]['id']),'tags':_0x2bfe5e||[]});return{'id':Number(_0x24b28a[_0x199d('0xad')]['id']),'tags':_0x2bfe5e||[]};});}})[_0x199d('0x2c')](respondWithResult(_0x53dadf,null))['catch'](handleError(_0x53dadf,null));};exports[_0x199d('0xc5')]=function(_0xdfecd0,_0x406811,_0x1c4c08){return db[_0x199d('0x38')][_0x199d('0x5c')]({'where':{'id':_0xdfecd0[_0x199d('0xad')]['id']}})['then'](handleEntityNotFound(_0x406811,null))[_0x199d('0x2c')](function(_0x3088f1){if(_0x3088f1){return _0x3088f1[_0x199d('0xc5')](_0xdfecd0['query']['ids']);}})[_0x199d('0x2c')](respondWithStatusCode(_0x406811,null))['catch'](handleError(_0x406811,null));};exports[_0x199d('0xc6')]=function(_0x351f7e,_0x15e503){var _0x1dcc55=moment()[_0x199d('0xc7')]()[_0x199d('0x91')]();var _0x4825bb=path[_0x199d('0xc8')](config[_0x199d('0xc9')],'server',_0x199d('0xca'),_0x199d('0xcb'));var _0x2b8b90=path[_0x199d('0xc8')](config['root'],_0x199d('0xcc'),_0x199d('0xca'),'attachments');var _0xb140c8=path['join'](_0x4825bb,_0x1dcc55);var _0x203ff6=util[_0x199d('0xbc')]('transcript-%d-%s.zip',_0x351f7e[_0x199d('0xad')]['id'],_0x1dcc55);var _0x45b66f=path[_0x199d('0xc8')](_0x4825bb,_0x203ff6);var _0x48594e=[];_0x48594e[_0x199d('0xa9')]({'model':db[_0x199d('0x6b')],'as':'User','attributes':['id',_0x199d('0x33')],'raw':!![]});_0x48594e[_0x199d('0xa9')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x199d('0xcd'),_0x199d('0xce')],'raw':!![]});var _0x4f915f=[{'model':db[_0x199d('0xb4')],'as':_0x199d('0xcf'),'attributes':['id',_0x199d('0x6d'),_0x199d('0x74'),_0x199d('0xd0'),_0x199d('0xd1'),_0x199d('0x7b')],'include':_0x48594e}];_0x4f915f[_0x199d('0xa9')]({'model':db[_0x199d('0xd2')],'as':_0x199d('0xd3'),'attributes':['id',_0x199d('0x2f')]});_0x4f915f[_0x199d('0xa9')]({'model':db[_0x199d('0x6b')],'as':_0x199d('0xd4'),'attributes':['id','fullname']});return db[_0x199d('0x38')][_0x199d('0x5c')]({'where':{'id':_0x351f7e[_0x199d('0xad')]['id']},'include':_0x4f915f})['then'](handleEntityNotFound(_0x15e503,null))['then'](function(_0x45667a){if(_0x45667a){var _0x82be14=_0x45667a['get']({'plain':!![]});fs['mkdirSync'](_0xb140c8);var _0x4063b4={'channel':_0x199d('0xd5'),'account':_0x82be14['Account'][_0x199d('0x2f')],'agent':_0x82be14[_0x199d('0xd4')]?_0x82be14['Owner'][_0x199d('0x33')]:_0x199d('0xd6'),'createdAt':moment(_0x82be14['createdAt'])[_0x199d('0xbc')](_0x199d('0xd7'))[_0x199d('0x91')](),'closedAt':_0x82be14[_0x199d('0xd8')]?moment(_0x82be14[_0x199d('0xd9')])['format'](_0x199d('0xd7'))[_0x199d('0x91')]():'','disposition':_0x82be14[_0x199d('0xda')],'messages':_(_0x82be14[_0x199d('0xcf')])[_0x199d('0x7f')]({'secret':![]})[_0x199d('0x32')](function(_0x45c587){return{'date':moment(_0x45c587[_0x199d('0x74')])[_0x199d('0xbc')](_0x199d('0xd7'))[_0x199d('0x91')](),'sender':_0x45c587['direction']===_0x199d('0xdb')?_0x45c587['User']?_0x45c587[_0x199d('0x6b')][_0x199d('0x33')]:_0x199d('0xdc'):_0x45c587['Contact'][_0x199d('0xcd')]+(_0x45c587[_0x199d('0x60')][_0x199d('0xce')]?'\x20'+_0x45c587[_0x199d('0x60')][_0x199d('0xce')]:''),'body':_0x45c587[_0x199d('0x6d')],'direction':_0x45c587[_0x199d('0xd0')]===_0x199d('0xdb')?'A':'C','secret':_0x45c587[_0x199d('0xd1')],'read':_0x45c587['read']};})['value']()};return ejs[_0x199d('0xdd')](path[_0x199d('0xc8')](config[_0x199d('0xc9')],_0x199d('0xcc'),_0x199d('0xde'),_0x199d('0xdf')),{'interaction':_0x4063b4})[_0x199d('0x2c')](function(_0x10a7fc){var _0x506900=path[_0x199d('0xc8')](_0xb140c8,_0x199d('0xe0')+_0x82be14['id']+'-'+_0x1dcc55+_0x199d('0xe1'));var _0x2dd8d3={'path':_0x506900,'channel':_0x199d('0xd5'),'interactionId':_0x82be14['id']};return pdf[_0x199d('0xe2')](_0x10a7fc,_0x2dd8d3);})[_0x199d('0x2c')](function(){return new BPromise(function(_0x21fb96,_0x382d22){zipdir(_0xb140c8,{'saveTo':_0x45b66f},function(_0x38e855,_0x3ed1cd){if(_0x38e855)return _0x382d22(_0x38e855);return _0x21fb96(_0x3ed1cd);});})[_0x199d('0x2c')](function(){return new BPromise(function(_0x7a7e4,_0x49666f){rimraf(_0xb140c8,function(_0x517543){if(_0x517543)_0x49666f(_0x517543);return _0x7a7e4();});});})[_0x199d('0x2c')](function(){return _0x15e503['download'](_0x45b66f,_0x203ff6,function(_0xcf54a){if(_0xcf54a){console[_0x199d('0xe3')](_0x199d('0xe4'),_0xcf54a);}else{fs[_0x199d('0xe5')](_0x45b66f);}});});});}else{return _0x15e503[_0x199d('0x1f')](0xc8);}})[_0x199d('0x37')](handleError(_0x15e503,null));}; \ No newline at end of file +var _0xc3bf=['key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','ui.SmsInteractionId','user_has_sms_interactions','users','sms_interactions','left_join','cm_contacts','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','conditions','find','value','having','`\x20=\x200','`\x20>\x200','Contact','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','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','end','body','text','keys','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\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','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId','rows','catch','params','includeAll','include','create','describe','addMessage','ids','omit','getMessages','findOne','SmsMessage','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','spread','Tag','emit','smsInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','User','CmContact','firstName','lastName','direction','SmsAccount','Account','get','mkdirSync','Owner','N.A.','closed','closedAt','disposition','Messages','System','out','renderFile','views','downloadInteraction.ejs','.pdf','Sms','createPdfFromHTML','download','log','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/export/pdf','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','json','undefined','offset','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','fullname','TagIds','Tags','split','forEach','push','SmsInteraction','rawAttributes','type'];(function(_0xbcea1,_0x469f9f){var _0x17fb47=function(_0x48f5e7){while(--_0x48f5e7){_0xbcea1['push'](_0xbcea1['shift']());}};_0x17fb47(++_0x469f9f);}(_0xc3bf,0x19d));var _0xfc3b=function(_0x48f0de,_0x4ab07d){_0x48f0de=_0x48f0de-0x0;var _0x43185b=_0xc3bf[_0x48f0de];return _0x43185b;};'use strict';var emlformat=require(_0xfc3b('0x0'));var rimraf=require(_0xfc3b('0x1'));var zipdir=require(_0xfc3b('0x2'));var jsonpatch=require(_0xfc3b('0x3'));var rp=require('request-promise');var moment=require(_0xfc3b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfc3b('0x5'));var util=require(_0xfc3b('0x6'));var path=require(_0xfc3b('0x7'));var sox=require('sox');var csv=require(_0xfc3b('0x8'));var ejs=require(_0xfc3b('0x9'));var fs=require('fs');var fs_extra=require(_0xfc3b('0xa'));var _=require(_0xfc3b('0xb'));var squel=require(_0xfc3b('0xc'));var crypto=require(_0xfc3b('0xd'));var jsforce=require(_0xfc3b('0xe'));var deskjs=require(_0xfc3b('0xf'));var toCsv=require(_0xfc3b('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfc3b('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xfc3b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfc3b('0x12'));var utils=require('../../config/utils');var config=require(_0xfc3b('0x13'));var licenseUtil=require(_0xfc3b('0x14'));var db=require(_0xfc3b('0x15'))['db'];config[_0xfc3b('0x16')]=_[_0xfc3b('0x17')](config[_0xfc3b('0x16')],{'host':_0xfc3b('0x18'),'port':0x18eb});var socket=require(_0xfc3b('0x19'))(new Redis(config[_0xfc3b('0x16')]));require(_0xfc3b('0x1a'))[_0xfc3b('0x1b')](socket);function respondWithStatusCode(_0xd4fbca,_0x272b33){_0x272b33=_0x272b33||0xcc;return function(_0xd7d9){if(_0xd7d9){return _0xd4fbca[_0xfc3b('0x1c')](_0x272b33);}return _0xd4fbca[_0xfc3b('0x1d')](_0x272b33)['end']();};}function respondWithResult(_0x268fb6,_0x2202f2){_0x2202f2=_0x2202f2||0xc8;return function(_0x8264a){if(_0x8264a){return _0x268fb6['status'](_0x2202f2)[_0xfc3b('0x1e')](_0x8264a);}};}function respondWithFilteredResult(_0x105124,_0x17bb62){return function(_0xd387fb){if(_0xd387fb){var _0x261332=typeof _0x17bb62['offset']===_0xfc3b('0x1f')&&typeof _0x17bb62['limit']===_0xfc3b('0x1f');var _0x3f272e=_0xd387fb['count'];var _0x4978c8=_0x261332?0x0:_0x17bb62[_0xfc3b('0x20')];var _0x31b4e9=_0x261332?_0xd387fb[_0xfc3b('0x21')]:_0x17bb62[_0xfc3b('0x20')]+_0x17bb62[_0xfc3b('0x22')];var _0x505af0;if(_0x31b4e9>=_0x3f272e){_0x31b4e9=_0x3f272e;_0x505af0=0xc8;}else{_0x505af0=0xce;}_0x105124['status'](_0x505af0);return _0x105124['set'](_0xfc3b('0x23'),_0x4978c8+'-'+_0x31b4e9+'/'+_0x3f272e)[_0xfc3b('0x1e')](_0xd387fb);}return null;};}function patchUpdates(_0x26da24){return function(_0x60721f){try{jsonpatch[_0xfc3b('0x24')](_0x60721f,_0x26da24,!![]);}catch(_0x588209){return BPromise[_0xfc3b('0x25')](_0x588209);}return _0x60721f[_0xfc3b('0x26')]();};}function saveUpdates(_0xd1b564,_0x380feb){return function(_0x4c0761){if(_0x4c0761){return _0x4c0761[_0xfc3b('0x27')](_0xd1b564)[_0xfc3b('0x28')](function(_0x1a469f){return _0x1a469f;});}return null;};}function removeEntity(_0x38df4a,_0x302e2a){return function(_0x160c61){if(_0x160c61){return _0x160c61[_0xfc3b('0x29')]()[_0xfc3b('0x28')](function(){_0x38df4a[_0xfc3b('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c395c,_0x118b36){return function(_0x14bb1a){if(!_0x14bb1a){_0x3c395c[_0xfc3b('0x1c')](0x194);}return _0x14bb1a;};}function handleError(_0x346825,_0x16e716){_0x16e716=_0x16e716||0x1f4;return function(_0x2dbd09){logger[_0xfc3b('0x2a')](_0x2dbd09[_0xfc3b('0x2b')]);if(_0x2dbd09[_0xfc3b('0x2c')]){delete _0x2dbd09[_0xfc3b('0x2c')];}_0x346825[_0xfc3b('0x1d')](_0x16e716)['send'](_0x2dbd09);};}function getInteractionUsers(_0x51ba3f,_0x67c51e){return new BPromise(function(_0x18d18f,_0x1c462a){try{if(_0x67c51e[_0x51ba3f['id']]){_0x51ba3f['Users']=_[_0xfc3b('0x2d')](_0x67c51e[_0x51ba3f['id']],function(_0x1aaba5){return{'id':_0x1aaba5['id'],'fullname':_0x1aaba5[_0xfc3b('0x2e')]};});}}catch(_0x463644){_0x1c462a(_0x463644);}_0x18d18f(_0x51ba3f);});}function getInteractionTags(_0x3fe56c,_0x478693){return new BPromise(function(_0xba67c8,_0x4d948e){try{if(_0x3fe56c[_0xfc3b('0x2f')]){_0x3fe56c[_0xfc3b('0x30')]=[];_0x3fe56c[_0xfc3b('0x2f')][_0xfc3b('0x31')](',')[_0xfc3b('0x32')](function(_0x178445){_0x3fe56c[_0xfc3b('0x30')][_0xfc3b('0x33')](_0x478693[_0x178445]);});}delete _0x3fe56c['TagIds'];}catch(_0x22aa22){_0x4d948e(_0x22aa22);}_0xba67c8(_0x3fe56c);});}function updateSmsInteraction(_0xba3e3d,_0x3e7e4e,_0x3522ee){return new BPromise(function(_0x51d757,_0x242ed0){return getInteractionUsers(_0xba3e3d,_0x3522ee)['then'](function(_0x317213){return getInteractionTags(_0x317213,_0x3e7e4e);})[_0xfc3b('0x28')](function(_0x30524f){_0x51d757(_0x30524f);})['catch'](function(_0x37d200){_0x242ed0(_0x37d200);});});}exports['index']=function(_0x29d53e,_0xb84b66){var _0x115737={},_0x4a2599={},_0x186749={'count':0x0,'rows':[]};var _0x30ee6f=_[_0xfc3b('0x2d')](db[_0xfc3b('0x34')][_0xfc3b('0x35')],function(_0x346a1e){return{'name':_0x346a1e['fieldName'],'type':_0x346a1e[_0xfc3b('0x36')][_0xfc3b('0x37')]};});_0x4a2599[_0xfc3b('0x38')]=_[_0xfc3b('0x2d')](_0x30ee6f,_0xfc3b('0x2c'));_0x4a2599[_0xfc3b('0x39')]=_['keys'](_0x29d53e[_0xfc3b('0x39')]);_0x4a2599[_0xfc3b('0x3a')]=_[_0xfc3b('0x3b')](_0x4a2599[_0xfc3b('0x38')],_0x4a2599[_0xfc3b('0x39')]);_0x115737[_0xfc3b('0x3c')]=_[_0xfc3b('0x3b')](_0x4a2599[_0xfc3b('0x38')],qs[_0xfc3b('0x3d')](_0x29d53e[_0xfc3b('0x39')][_0xfc3b('0x3d')]));_0x115737[_0xfc3b('0x3c')]=_0x115737[_0xfc3b('0x3c')][_0xfc3b('0x3e')]?_0x115737['attributes']:_0x4a2599[_0xfc3b('0x38')];if(!_0x29d53e[_0xfc3b('0x39')][_0xfc3b('0x3f')](_0xfc3b('0x40'))){_0x115737[_0xfc3b('0x22')]=qs[_0xfc3b('0x22')](_0x29d53e[_0xfc3b('0x39')][_0xfc3b('0x22')]);_0x115737['offset']=qs['offset'](_0x29d53e[_0xfc3b('0x39')][_0xfc3b('0x20')]);}_0x115737[_0xfc3b('0x41')]=qs[_0xfc3b('0x42')](_0x29d53e[_0xfc3b('0x39')][_0xfc3b('0x42')]);_0x115737[_0xfc3b('0x43')]=qs[_0xfc3b('0x3a')](_[_0xfc3b('0x44')](_0x29d53e[_0xfc3b('0x39')],_0x4a2599[_0xfc3b('0x3a')]),_0x30ee6f);var _0xb5121e=[];var _0x21675a=squel[_0xfc3b('0x45')]()[_0xfc3b('0x46')]('id')[_0xfc3b('0x46')](_0xfc3b('0x2c'))[_0xfc3b('0x46')](_0xfc3b('0x47'))[_0xfc3b('0x48')](_0xfc3b('0x49'));var _0x424ff5=squel[_0xfc3b('0x45')]()[_0xfc3b('0x46')](_0xfc3b('0x4a'))['field']('u.fullname')[_0xfc3b('0x46')](_0xfc3b('0x4b'))[_0xfc3b('0x48')](_0xfc3b('0x4c'),'ui')['left_join'](_0xfc3b('0x4d'),'u','u.id\x20=\x20ui.UserId');var _0x4376bd=squel[_0xfc3b('0x45')]()['from'](_0xfc3b('0x4e'),'i')[_0xfc3b('0x4f')](_0xfc3b('0x50'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xfc3b('0x4f')](_0xfc3b('0x4d'),'o',_0xfc3b('0x51'))[_0xfc3b('0x4f')](_0xfc3b('0x52'),'a',_0xfc3b('0x53'))[_0xfc3b('0x4f')](_0xfc3b('0x54'),'me',_0xfc3b('0x55'))['left_join'](_0xfc3b('0x56'),'it','it.SmsInteractionId\x20=\x20i.id')[_0xfc3b('0x4f')](_0xfc3b('0x49'),'t',_0xfc3b('0x57'));var _0x384362=squel['expr']();var _0x2f4c59=[];var _0x213a1f=squel[_0xfc3b('0x58')]();var _0x22be1c;if(_0x29d53e['query'][_0xfc3b('0x59')]){_0x22be1c=as['parseSearch'](_0x29d53e[_0xfc3b('0x39')]['search']);var _0xf47faf=_0x22be1c['sqlOperator'];for(var _0x2b8b1e=0x0;_0x2b8b1e<_0x22be1c[_0xfc3b('0x5a')][_0xfc3b('0x3e')];_0x2b8b1e++){var _0x3afc8b=_0x22be1c['conditions'][_0x2b8b1e];var _0xeddcd0='i';var _0x50ab94=_[_0xfc3b('0x5b')](_0x30ee6f,['name',_0x3afc8b[_0xfc3b('0x46')]]);if(!_0x50ab94){switch(_0x3afc8b[_0xfc3b('0x46')]){case'unreadMessages':if(_0x3afc8b[_0xfc3b('0x5c')]==0x1){_0x4376bd[_0xfc3b('0x5d')]('`'+_0x3afc8b[_0xfc3b('0x46')]+_0xfc3b('0x5e'));}else{_0x4376bd['having']('`'+_0x3afc8b[_0xfc3b('0x46')]+_0xfc3b('0x5f'));}break;case _0xfc3b('0x60'):if(_0x3afc8b['operator']==='$substring'){if(_0x3afc8b[_0xfc3b('0x5c')][_0xfc3b('0x31')]('\x20')['length']>0x1){_0x384362[_0xf47faf](_0xfc3b('0x61'),qs[_0xfc3b('0x62')](_0x3afc8b[_0xfc3b('0x5c')]),null);}else{var _0x32bb99='%'+_0x3afc8b['value']+'%';_0x384362[_0xf47faf](_0xfc3b('0x63'),_0x32bb99,_0x32bb99,_0x32bb99);}}else{_0x50ab94=_[_0xfc3b('0x5b')](_0x30ee6f,[_0xfc3b('0x2c'),_0xfc3b('0x64')]);_0x3afc8b['field']=_0xfc3b('0x64');_0x32cd19=as['buildExpression'](_0xeddcd0,_0x50ab94[_0xfc3b('0x36')],_0x3afc8b);_0x384362[_0xf47faf](_0x32cd19['text'],_0x32cd19[_0xfc3b('0x5c')][_0xfc3b('0x65')],_0x32cd19[_0xfc3b('0x5c')]['end']);}break;case'Tag':var _0x343e25=_0x3afc8b[_0xfc3b('0x5c')]['split'](',')[_0xfc3b('0x2d')](function(_0x356e71){return Number(_0x356e71);});_0x343e25['forEach'](function(_0x566291){_0x213a1f['or'](_0xfc3b('0x66'),'%,'+_0x566291+',%');});_0x2f4c59=_[_0xfc3b('0x67')](_0x2f4c59,_0x343e25);break;case'User':if(_0x3afc8b['operator']===_0xfc3b('0x68')){_0x384362[_0xf47faf](_0xfc3b('0x69'),'%'+_0x3afc8b['value']+'%',null);}else{_0x50ab94=_['find'](_0x30ee6f,[_0xfc3b('0x2c'),_0xfc3b('0x6a')]);_0x3afc8b['field']=_0xfc3b('0x6a');_0x32cd19=as[_0xfc3b('0x6b')](_0xeddcd0,_0x50ab94[_0xfc3b('0x36')],_0x3afc8b);_0x384362[_0xf47faf](_0x32cd19['text'],_0x32cd19['value'][_0xfc3b('0x65')],_0x32cd19[_0xfc3b('0x5c')][_0xfc3b('0x6c')]);}break;case _0xfc3b('0x6d'):_0x32cd19=as[_0xfc3b('0x6b')]('me',null,_0x3afc8b);_0x384362[_0xf47faf](_0x32cd19[_0xfc3b('0x6e')],_0x32cd19[_0xfc3b('0x5c')][_0xfc3b('0x65')],_0x32cd19[_0xfc3b('0x5c')][_0xfc3b('0x6c')]);break;}}else{var _0x32cd19=as[_0xfc3b('0x6b')](_0xeddcd0,_0x50ab94['type'],_0x3afc8b);_0x384362[_0xf47faf](_0x32cd19['text'],_0x32cd19[_0xfc3b('0x5c')]['start'],_0x32cd19[_0xfc3b('0x5c')][_0xfc3b('0x6c')]);}}}else{var _0x3c38c6=_(_0x29d53e[_0xfc3b('0x39')])[_0xfc3b('0x6f')]()['map'](function(_0x4bacb4){return _[_0xfc3b('0x70')](_0x30ee6f,[_0xfc3b('0x2c'),_0x4bacb4])?_0x4bacb4:undefined;})[_0xfc3b('0x71')]()[_0xfc3b('0x5c')]();if(!_[_0xfc3b('0x72')](_0x3c38c6)){_0x3c38c6[_0xfc3b('0x32')](function(_0x3f88e5){if(_0x3f88e5===_0xfc3b('0x73')){_0x4376bd['where'](_0xfc3b('0x74'),[][_0xfc3b('0x75')](_0x29d53e[_0xfc3b('0x39')][_0x3f88e5]));}else if(_0x3f88e5===_0xfc3b('0x76')){var _0x2821d2=JSON['parse'](_0x29d53e[_0xfc3b('0x39')][_0x3f88e5])[_0xfc3b('0x77')];var _0x24a1de=JSON[_0xfc3b('0x78')](_0x29d53e[_0xfc3b('0x39')][_0x3f88e5])[_0xfc3b('0x79')];_0x4376bd[_0xfc3b('0x43')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2821d2,_0x24a1de);}else{if(_0x29d53e[_0xfc3b('0x39')][_0x3f88e5]===_0xfc3b('0x7a')){_0x4376bd['where']('i.'+_0x3f88e5+'\x20IS\x20NULL');}else{_0x4376bd[_0xfc3b('0x43')]('i.'+_0x3f88e5+_0xfc3b('0x7b'),_0x29d53e[_0xfc3b('0x39')][_0x3f88e5]);}}});}if(_0x29d53e[_0xfc3b('0x39')][_0xfc3b('0x7c')]){if(_0x29d53e['query'][_0xfc3b('0x7c')]==0x1){_0x4376bd[_0xfc3b('0x5d')]('`unreadMessages`\x20=\x200');}else{_0x4376bd['having'](_0xfc3b('0x7d'));}}if(_0x29d53e[_0xfc3b('0x39')][_0xfc3b('0x7e')]){_0x2f4c59=_[_0xfc3b('0x7f')](_0x29d53e['query'][_0xfc3b('0x7e')])?_0x29d53e[_0xfc3b('0x39')][_0xfc3b('0x7e')]:new Array(_0x29d53e[_0xfc3b('0x39')][_0xfc3b('0x7e')]);_0x2f4c59[_0xfc3b('0x32')](function(_0x1ab20c){_0x213a1f['or'](_0xfc3b('0x66'),'%,'+_0x1ab20c+',%');});}if(_0x29d53e[_0xfc3b('0x39')][_0xfc3b('0x80')]){var _0x3616df=_0x29d53e[_0xfc3b('0x39')]['filter'][_0xfc3b('0x81')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xfc3b('0x82')](_0x3616df)){_0x384362['or'](_0xfc3b('0x83'),_0x3616df+'%')['or'](_0xfc3b('0x84'),_0x3616df+'%');}else{_0x384362['or'](_0xfc3b('0x85'),qs['getFullTextValue'](_0x3616df))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3616df+'%');}}}_0x4376bd['where'](_0x384362);_0x4376bd[_0xfc3b('0x86')](_0xfc3b('0x87'));var _0x5d6d5e={'type':db[_0xfc3b('0x88')][_0xfc3b('0x89')][_0xfc3b('0x8a')],'raw':!![]};var _0x4dbbe0=_0x4376bd[_0xfc3b('0x8b')]();_0x4dbbe0['field'](_0xfc3b('0x87'));_0x4dbbe0[_0xfc3b('0x46')](_0xfc3b('0x8c'),_0xfc3b('0x8d'));if(_0x115737[_0xfc3b('0x41')]){_0x115737['order']['forEach'](function(_0x66a661){var _0x19d140=_0x66a661[0x0]===_0xfc3b('0x8e')?_0x66a661[0x0]:'i.'+_0x66a661[0x0];_0x4376bd['order'](_0x19d140,_0x66a661[0x1]===_0xfc3b('0x8f')?![]:!![]);});}if(!_[_0xfc3b('0x72')](_0x2f4c59)){_0x4376bd[_0xfc3b('0x5d')](_0x213a1f);_0x4dbbe0[_0xfc3b('0x43')]('t.id\x20IN\x20?',_0x2f4c59);}BPromise[_0xfc3b('0x90')]()[_0xfc3b('0x28')](function(){if(!_0x22be1c){if(_0x29d53e['query'][_0xfc3b('0x73')])return;_0x4dbbe0[_0xfc3b('0x43')](_0xfc3b('0x91'));_0x4376bd[_0xfc3b('0x43')](_0xfc3b('0x91'));return;}if(_0x29d53e[_0xfc3b('0x92')][_0xfc3b('0x93')]!==_0xfc3b('0x94'))return;return _0x29d53e[_0xfc3b('0x92')][_0xfc3b('0x95')]({'attributes':['id'],'raw':!![]})[_0xfc3b('0x28')](function(_0x1b1434){if(_[_0xfc3b('0x72')](_0x1b1434)){_0x4dbbe0[_0xfc3b('0x43')](_0xfc3b('0x96'));_0x4376bd['where'](_0xfc3b('0x96'));}else{_0x4dbbe0['where'](_0xfc3b('0x74'),_['map'](_0x1b1434,'id'));_0x4376bd[_0xfc3b('0x43')](_0xfc3b('0x74'),_[_0xfc3b('0x2d')](_0x1b1434,'id'));}});})[_0xfc3b('0x28')](function(){if(_0x29d53e[_0xfc3b('0x92')]['role']===_0xfc3b('0x94')&&!_0x22be1c&&!_0x29d53e[_0xfc3b('0x39')][_0xfc3b('0x73')])return[];return db['sequelize']['query'](_0x4dbbe0['toString'](),_0x5d6d5e);})['then'](function(_0x36f913){_0x186749['count']=_0x36f913[_0xfc3b('0x3e')];if(_0x186749[_0xfc3b('0x21')]===0x0)return[];return db[_0xfc3b('0x97')][_0xfc3b('0x39')](_0x21675a[_0xfc3b('0x98')](),_0x5d6d5e)[_0xfc3b('0x28')](function(_0x3cb167){_0xb5121e=_[_0xfc3b('0x99')](_0x3cb167,'id');_0x5d6d5e=_[_0xfc3b('0x9a')](_0x5d6d5e,{'model':db[_0xfc3b('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x29d53e[_0xfc3b('0x39')][_0xfc3b('0x3d')]){_0x115737[_0xfc3b('0x3c')]['forEach'](function(_0x3707fc){_0x4376bd[_0xfc3b('0x46')]('i.'+_0x3707fc);});}else{_0x4376bd[_0xfc3b('0x46')](_0xfc3b('0x8c'),'unreadMessages');_0x4376bd[_0xfc3b('0x46')](_0xfc3b('0x9b'),_0xfc3b('0x9c'));_0x4376bd[_0xfc3b('0x46')](_0xfc3b('0x9d'),_0xfc3b('0x9e'));_0x4376bd[_0xfc3b('0x46')](_0xfc3b('0x9f'),'contactName');_0x4376bd[_0xfc3b('0x46')](_0xfc3b('0xa0'));_0x4376bd['field'](_0xfc3b('0xa1'),_0xfc3b('0xa2'));_0x4376bd[_0xfc3b('0x46')](_0xfc3b('0xa3'),_0xfc3b('0xa4'));_0x4376bd['field']('c.email',_0xfc3b('0xa5'));_0x4376bd[_0xfc3b('0x46')](_0xfc3b('0xa6'),'Contact.phone');_0x4376bd[_0xfc3b('0x46')](_0xfc3b('0xa7'),_0xfc3b('0xa8'));_0x4376bd[_0xfc3b('0x46')]('c.fax',_0xfc3b('0xa9'));_0x4376bd[_0xfc3b('0x46')](_0xfc3b('0xaa'),_0xfc3b('0xab'));_0x4376bd[_0xfc3b('0x46')]('o.internal',_0xfc3b('0xac'));_0x4376bd[_0xfc3b('0x46')](_0xfc3b('0xad'),_0xfc3b('0x2f'));}if(_0x115737[_0xfc3b('0x22')])_0x4376bd[_0xfc3b('0x22')](_0x115737[_0xfc3b('0x22')]);if(_0x115737['offset'])_0x4376bd[_0xfc3b('0x20')](_0x115737[_0xfc3b('0x20')]);return db[_0xfc3b('0x97')][_0xfc3b('0x39')](_0x4376bd[_0xfc3b('0x98')](),_0x5d6d5e);})[_0xfc3b('0x28')](function(_0x557df8){if(_0x557df8[_0xfc3b('0x3e')]>0x0)_0x424ff5['where'](_0xfc3b('0xae'),_[_0xfc3b('0x2d')](_0x557df8,'id'));return db[_0xfc3b('0x97')][_0xfc3b('0x39')](_0x424ff5[_0xfc3b('0x98')](),_0x5d6d5e)[_0xfc3b('0x28')](function(_0x5630ca){var _0x20d441=_['groupBy'](_0x5630ca,_0xfc3b('0xaf'));var _0x2adc17=[];_0x557df8[_0xfc3b('0x32')](function(_0x57bb15){_0x2adc17[_0xfc3b('0x33')](updateSmsInteraction(_0x57bb15,_0xb5121e,_0x20d441));});return BPromise['all'](_0x2adc17);});});})['then'](function(_0x2f5ca1){_0x186749[_0xfc3b('0xb0')]=_0x2f5ca1;return _0x186749;})[_0xfc3b('0x28')](respondWithFilteredResult(_0xb84b66,_0x115737))[_0xfc3b('0xb1')](handleError(_0xb84b66,null));};exports['show']=function(_0x929aac,_0x172476){var _0x154abf={'raw':![],'where':{'id':_0x929aac[_0xfc3b('0xb2')]['id']}},_0x6de5c3={};_0x6de5c3[_0xfc3b('0x38')]=_[_0xfc3b('0x6f')](db[_0xfc3b('0x34')][_0xfc3b('0x35')]);_0x6de5c3['query']=_[_0xfc3b('0x6f')](_0x929aac[_0xfc3b('0x39')]);_0x6de5c3[_0xfc3b('0x3a')]=_[_0xfc3b('0x3b')](_0x6de5c3[_0xfc3b('0x38')],_0x6de5c3[_0xfc3b('0x39')]);_0x154abf[_0xfc3b('0x3c')]=_[_0xfc3b('0x3b')](_0x6de5c3['model'],qs[_0xfc3b('0x3d')](_0x929aac['query'][_0xfc3b('0x3d')]));_0x154abf[_0xfc3b('0x3c')]=_0x154abf[_0xfc3b('0x3c')][_0xfc3b('0x3e')]?_0x154abf[_0xfc3b('0x3c')]:_0x6de5c3[_0xfc3b('0x38')];if(_0x929aac[_0xfc3b('0x39')][_0xfc3b('0xb3')]){_0x154abf[_0xfc3b('0xb4')]=[{'all':!![]}];}_0x154abf=_[_0xfc3b('0x9a')]({},_0x154abf,_0x929aac['options']);return db['SmsInteraction']['find'](_0x154abf)[_0xfc3b('0x28')](handleEntityNotFound(_0x172476,null))[_0xfc3b('0x28')](respondWithResult(_0x172476,null))['catch'](handleError(_0x172476,null));};exports[_0xfc3b('0xb5')]=function(_0x101743,_0x243d69){return db[_0xfc3b('0x34')][_0xfc3b('0xb5')](_0x101743['body'],{})['then'](respondWithResult(_0x243d69,0xc9))[_0xfc3b('0xb1')](handleError(_0x243d69,null));};exports[_0xfc3b('0x27')]=function(_0xad9d70,_0x2114be){if(_0xad9d70[_0xfc3b('0x6d')]['id']){delete _0xad9d70['body']['id'];}return db[_0xfc3b('0x34')]['find']({'where':{'id':_0xad9d70[_0xfc3b('0xb2')]['id']}})['then'](handleEntityNotFound(_0x2114be,null))[_0xfc3b('0x28')](saveUpdates(_0xad9d70[_0xfc3b('0x6d')],null))[_0xfc3b('0x28')](respondWithResult(_0x2114be,null))[_0xfc3b('0xb1')](handleError(_0x2114be,null));};exports['destroy']=function(_0x217c52,_0x40ea2d){return db[_0xfc3b('0x34')][_0xfc3b('0x5b')]({'where':{'id':_0x217c52[_0xfc3b('0xb2')]['id']}})[_0xfc3b('0x28')](handleEntityNotFound(_0x40ea2d,null))[_0xfc3b('0x28')](removeEntity(_0x40ea2d,null))[_0xfc3b('0xb1')](handleError(_0x40ea2d,null));};exports[_0xfc3b('0xb6')]=function(_0x1c702e,_0x73aa0b){return db[_0xfc3b('0x34')]['describe']()[_0xfc3b('0x28')](respondWithResult(_0x73aa0b,null))[_0xfc3b('0xb1')](handleError(_0x73aa0b,null));};exports['addMessage']=function(_0xf10d5b,_0x4cf5bf,_0x2e6f7f){return db['SmsMessage'][_0xfc3b('0x5b')]({'where':{'id':_0xf10d5b[_0xfc3b('0xb2')]['id']}})[_0xfc3b('0x28')](handleEntityNotFound(_0x4cf5bf,null))[_0xfc3b('0x28')](function(_0x509c22){if(_0x509c22){return _0x509c22[_0xfc3b('0xb7')](_0xf10d5b[_0xfc3b('0x6d')][_0xfc3b('0xb8')],_[_0xfc3b('0xb9')](_0xf10d5b[_0xfc3b('0x6d')],[_0xfc3b('0xb8'),'id'])||{});}})[_0xfc3b('0x28')](respondWithResult(_0x4cf5bf,null))[_0xfc3b('0xb1')](handleError(_0x4cf5bf,null));};exports[_0xfc3b('0xba')]=function(_0x5ab2d3,_0x57d7f7,_0x15fda6){var _0x493781={'raw':![],'where':{}};var _0x10ec30={};var _0x533a9c={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xfc3b('0xbb')]({'where':{'id':_0x5ab2d3[_0xfc3b('0xb2')]['id']}})[_0xfc3b('0x28')](handleEntityNotFound(_0x57d7f7,null))['then'](function(_0x267ddf){if(_0x267ddf){_0x10ec30[_0xfc3b('0x38')]=_[_0xfc3b('0x6f')](db[_0xfc3b('0xbc')]['rawAttributes']);_0x10ec30[_0xfc3b('0x39')]=_[_0xfc3b('0x6f')](_0x5ab2d3[_0xfc3b('0x39')]);_0x10ec30[_0xfc3b('0x3a')]=_[_0xfc3b('0x3b')](_0x10ec30[_0xfc3b('0x38')],_0x10ec30[_0xfc3b('0x39')]);_0x493781['attributes']=_[_0xfc3b('0x3b')](_0x10ec30[_0xfc3b('0x38')],qs['fields'](_0x5ab2d3[_0xfc3b('0x39')][_0xfc3b('0x3d')]));_0x493781[_0xfc3b('0x3c')]=_0x493781[_0xfc3b('0x3c')][_0xfc3b('0x3e')]?_0x493781[_0xfc3b('0x3c')]:_0x10ec30[_0xfc3b('0x38')];if(!_0x5ab2d3[_0xfc3b('0x39')]['hasOwnProperty']('nolimit')){_0x493781[_0xfc3b('0x22')]=qs['limit'](_0x5ab2d3[_0xfc3b('0x39')]['limit']);_0x493781[_0xfc3b('0x20')]=qs[_0xfc3b('0x20')](_0x5ab2d3[_0xfc3b('0x39')][_0xfc3b('0x20')]);}_0x493781[_0xfc3b('0x41')]=qs[_0xfc3b('0x42')](_0x5ab2d3[_0xfc3b('0x39')][_0xfc3b('0x42')]);_0x493781['where']=qs[_0xfc3b('0x3a')](_[_0xfc3b('0x44')](_0x5ab2d3[_0xfc3b('0x39')],_0x10ec30[_0xfc3b('0x3a')]));_0x493781[_0xfc3b('0x43')][_0xfc3b('0xaf')]=_0x267ddf['id'];if(_0x5ab2d3['query'][_0xfc3b('0x80')]){_0x493781['where']=_[_0xfc3b('0x9a')](_0x493781['where'],{'$or':_[_0xfc3b('0x2d')](_0x493781[_0xfc3b('0x3c')],function(_0x53fbbd){var _0x3b8ec3={};_0x3b8ec3[_0x53fbbd]={'$like':'%'+_0x5ab2d3[_0xfc3b('0x39')]['filter']+'%'};return _0x3b8ec3;})});}if(_0x5ab2d3[_0xfc3b('0x39')][_0xfc3b('0x77')]){var _0xf01eb4=_0x5ab2d3[_0xfc3b('0x39')][_0xfc3b('0x77')][_0xfc3b('0x31')](',');var _0x2d1718={};_0x2d1718[_0xf01eb4[0x0]]={'$gte':moment(_0xf01eb4[0x1])[_0xfc3b('0xbd')](_0xfc3b('0xbe'))};_0x493781[_0xfc3b('0x43')]=_[_0xfc3b('0x9a')](_0x493781[_0xfc3b('0x43')],_0x2d1718);}_0x493781=_[_0xfc3b('0x9a')]({},_0x493781,_0x5ab2d3[_0xfc3b('0xbf')]);return db[_0xfc3b('0xbc')][_0xfc3b('0x21')]({'where':_0x493781[_0xfc3b('0x43')]})[_0xfc3b('0x28')](function(_0x372e2c){_0x533a9c[_0xfc3b('0x21')]=_0x372e2c;if(_0x5ab2d3[_0xfc3b('0x39')][_0xfc3b('0xb3')]){_0x493781[_0xfc3b('0xb4')]=[{'all':!![]}];}return db['SmsMessage'][_0xfc3b('0xc0')](_0x493781);})[_0xfc3b('0x28')](function(_0x49c700){_0x533a9c[_0xfc3b('0xb0')]=_0x49c700;return _0x533a9c;});}})[_0xfc3b('0x28')](respondWithFilteredResult(_0x57d7f7,_0x493781))['catch'](handleError(_0x57d7f7,null));};exports[_0xfc3b('0xc1')]=function(_0x4a40b9,_0x19124c,_0x12f4ef){return db[_0xfc3b('0x34')][_0xfc3b('0x5b')]({'where':{'id':_0x4a40b9[_0xfc3b('0xb2')]['id']}})['then'](handleEntityNotFound(_0x19124c,null))[_0xfc3b('0x28')](function(_0x540d33){if(_0x540d33){return _0x540d33[_0xfc3b('0xc2')](_0x4a40b9[_0xfc3b('0x6d')][_0xfc3b('0xb8')],_['omit'](_0x4a40b9[_0xfc3b('0x6d')],[_0xfc3b('0xb8'),'id'])||{})[_0xfc3b('0xc3')](function(){return db[_0xfc3b('0xc4')][_0xfc3b('0xc0')]({'attributes':['id',_0xfc3b('0x2c'),_0xfc3b('0x47')],'where':{'id':_0x4a40b9['body'][_0xfc3b('0xb8')]}});})[_0xfc3b('0x28')](function(_0x4a908a){socket[_0xfc3b('0xc5')](_0xfc3b('0xc6'),{'id':Number(_0x4a40b9[_0xfc3b('0xb2')]['id']),'tags':_0x4a908a||[]});return{'id':Number(_0x4a40b9[_0xfc3b('0xb2')]['id']),'tags':_0x4a908a||[]};});}})['then'](respondWithResult(_0x19124c,null))[_0xfc3b('0xb1')](handleError(_0x19124c,null));};exports[_0xfc3b('0xc7')]=function(_0x2cc6df,_0x514c7b,_0x39dd2d){return db[_0xfc3b('0x34')][_0xfc3b('0x5b')]({'where':{'id':_0x2cc6df[_0xfc3b('0xb2')]['id']}})['then'](handleEntityNotFound(_0x514c7b,null))[_0xfc3b('0x28')](function(_0x1e31c0){if(_0x1e31c0){return _0x1e31c0['removeTags'](_0x2cc6df['query'][_0xfc3b('0xb8')]);}})[_0xfc3b('0x28')](respondWithStatusCode(_0x514c7b,null))[_0xfc3b('0xb1')](handleError(_0x514c7b,null));};exports['download']=function(_0x2300a5,_0x2e95e3){var _0x479322=moment()[_0xfc3b('0xc8')]()[_0xfc3b('0x98')]();var _0x360c01=path[_0xfc3b('0xc9')](config[_0xfc3b('0xca')],_0xfc3b('0xcb'),_0xfc3b('0xcc'),_0xfc3b('0xcd'));var _0x404b0c=path['join'](config[_0xfc3b('0xca')],_0xfc3b('0xcb'),_0xfc3b('0xcc'),_0xfc3b('0xce'));var _0x41a37b=path[_0xfc3b('0xc9')](_0x360c01,_0x479322);var _0x361933=util[_0xfc3b('0xbd')](_0xfc3b('0xcf'),_0x2300a5[_0xfc3b('0xb2')]['id'],_0x479322);var _0x43f13c=path[_0xfc3b('0xc9')](_0x360c01,_0x361933);var _0x1c0038=[];_0x1c0038['push']({'model':db[_0xfc3b('0xd0')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x1c0038['push']({'model':db[_0xfc3b('0xd1')],'as':_0xfc3b('0x60'),'attributes':['id',_0xfc3b('0xd2'),_0xfc3b('0xd3')],'raw':!![]});var _0x112304=[{'model':db[_0xfc3b('0xbc')],'as':'Messages','attributes':['id',_0xfc3b('0x6d'),_0xfc3b('0x76'),_0xfc3b('0xd4'),'secret',_0xfc3b('0x7c')],'include':_0x1c0038}];_0x112304[_0xfc3b('0x33')]({'model':db[_0xfc3b('0xd5')],'as':_0xfc3b('0xd6'),'attributes':['id','name']});_0x112304[_0xfc3b('0x33')]({'model':db[_0xfc3b('0xd0')],'as':'Owner','attributes':['id',_0xfc3b('0x2e')]});return db[_0xfc3b('0x34')][_0xfc3b('0x5b')]({'where':{'id':_0x2300a5[_0xfc3b('0xb2')]['id']},'include':_0x112304})[_0xfc3b('0x28')](handleEntityNotFound(_0x2e95e3,null))[_0xfc3b('0x28')](function(_0x39cd33){if(_0x39cd33){var _0x305945=_0x39cd33[_0xfc3b('0xd7')]({'plain':!![]});fs[_0xfc3b('0xd8')](_0x41a37b);var _0x4cd32e={'channel':'Sms','account':_0x305945[_0xfc3b('0xd6')][_0xfc3b('0x2c')],'agent':_0x305945['Owner']?_0x305945[_0xfc3b('0xd9')][_0xfc3b('0x2e')]:_0xfc3b('0xda'),'createdAt':moment(_0x305945['createdAt'])[_0xfc3b('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')[_0xfc3b('0x98')](),'closedAt':_0x305945[_0xfc3b('0xdb')]?moment(_0x305945[_0xfc3b('0xdc')])[_0xfc3b('0xbd')](_0xfc3b('0xbe'))[_0xfc3b('0x98')]():'','disposition':_0x305945[_0xfc3b('0xdd')],'messages':_(_0x305945[_0xfc3b('0xde')])[_0xfc3b('0x80')]({'secret':![]})['map'](function(_0xed9ac8){return{'date':moment(_0xed9ac8[_0xfc3b('0x76')])[_0xfc3b('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')[_0xfc3b('0x98')](),'sender':_0xed9ac8[_0xfc3b('0xd4')]==='out'?_0xed9ac8[_0xfc3b('0xd0')]?_0xed9ac8['User'][_0xfc3b('0x2e')]:_0xfc3b('0xdf'):_0xed9ac8[_0xfc3b('0x60')][_0xfc3b('0xd2')]+(_0xed9ac8['Contact'][_0xfc3b('0xd3')]?'\x20'+_0xed9ac8['Contact'][_0xfc3b('0xd3')]:''),'body':_0xed9ac8[_0xfc3b('0x6d')],'direction':_0xed9ac8['direction']===_0xfc3b('0xe0')?'A':'C','secret':_0xed9ac8['secret'],'read':_0xed9ac8[_0xfc3b('0x7c')]};})[_0xfc3b('0x5c')]()};return ejs[_0xfc3b('0xe1')](path['join'](config[_0xfc3b('0xca')],_0xfc3b('0xcb'),_0xfc3b('0xe2'),_0xfc3b('0xe3')),{'interaction':_0x4cd32e})[_0xfc3b('0x28')](function(_0x43bee7){var _0x2372fd=path['join'](_0x41a37b,'transcript-'+_0x305945['id']+'-'+_0x479322+_0xfc3b('0xe4'));var _0x4bb4a4={'path':_0x2372fd,'channel':_0xfc3b('0xe5'),'interactionId':_0x305945['id']};return pdf[_0xfc3b('0xe6')](_0x43bee7,_0x4bb4a4);})[_0xfc3b('0x28')](function(){return new BPromise(function(_0x28f11e,_0x511985){zipdir(_0x41a37b,{'saveTo':_0x43f13c},function(_0x4571ae,_0x816cb8){if(_0x4571ae)return _0x511985(_0x4571ae);return _0x28f11e(_0x816cb8);});})[_0xfc3b('0x28')](function(){return new BPromise(function(_0x4b0ee3,_0x587e49){rimraf(_0x41a37b,function(_0x43a9b5){if(_0x43a9b5)_0x587e49(_0x43a9b5);return _0x4b0ee3();});});})[_0xfc3b('0x28')](function(){return _0x2e95e3[_0xfc3b('0xe7')](_0x43f13c,_0x361933,function(_0x28c120){if(_0x28c120){console[_0xfc3b('0xe8')]('err',_0x28c120);}else{fs[_0xfc3b('0xe9')](_0x43f13c);}});});});}else{return _0x2e95e3[_0xfc3b('0x1c')](0xc8);}})[_0xfc3b('0xb1')](handleError(_0x2e95e3,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 2143ea8..216d3ec 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 _0x0b0e=['update','remove','getUsers','then','Users','map','findAll','setDataValue','length','emit','catch','hasOwnProperty','hook','events','SmsInteraction','SmsMessage','setMaxListeners','save'];(function(_0x19ad35,_0x3adcbb){var _0x2fc5a1=function(_0x422068){while(--_0x422068){_0x19ad35['push'](_0x19ad35['shift']());}};_0x2fc5a1(++_0x3adcbb);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5302fb,_0x1a2db3){_0x5302fb=_0x5302fb-0x0;var _0x43e6a4=_0x0b0e[_0x5302fb];return _0x43e6a4;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xe0b0('0x1')];var SmsMessage=require('../../mysqldb')['db'][_0xe0b0('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xe0b0('0x3')](0x0);var events={'afterCreate':_0xe0b0('0x4'),'afterUpdate':_0xe0b0('0x5'),'afterDestroy':_0xe0b0('0x6')};function emitEvent(_0x38a058){return function(_0x399e67,_0x185efa,_0x30e20d){_0x399e67[_0xe0b0('0x7')]({'attributes':['id'],'raw':!![]})[_0xe0b0('0x8')](function(_0x5cf9cc){_0x399e67['setDataValue'](_0xe0b0('0x9'),_0x5cf9cc[_0xe0b0('0xa')](function(_0xc4a085){return{'id':_0xc4a085['id']};}));return SmsMessage[_0xe0b0('0xb')]({'where':{'SmsInteractionId':_0x399e67['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x338e7c){_0x399e67[_0xe0b0('0xc')]('unreadMessages',_0x338e7c[_0xe0b0('0xd')]);SmsInteractionEvents[_0xe0b0('0xe')](_0x38a058+':'+_0x399e67['id'],_0x399e67);SmsInteractionEvents['emit'](_0x38a058,_0x399e67);_0x30e20d(null);})[_0xe0b0('0xf')](_0x30e20d(null));};}for(var e in events){if(events[_0xe0b0('0x10')](e)){var event=events[e];SmsInteraction[_0xe0b0('0x11')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x6a95=['save','getUsers','then','map','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners'];(function(_0x30f272,_0x401f2d){var _0x1969ce=function(_0x9129ee){while(--_0x9129ee){_0x30f272['push'](_0x30f272['shift']());}};_0x1969ce(++_0x401f2d);}(_0x6a95,0x1db));var _0x56a9=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x6a95[_0x32d457];return _0x338386;};'use strict';var EventEmitter=require(_0x56a9('0x0'));var SmsInteraction=require(_0x56a9('0x1'))['db'][_0x56a9('0x2')];var SmsMessage=require(_0x56a9('0x1'))['db'][_0x56a9('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x56a9('0x4')](0x0);var events={'afterCreate':_0x56a9('0x5'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x12cd60){return function(_0x83f534,_0x1b42ac,_0x2eb132){_0x83f534[_0x56a9('0x6')]({'attributes':['id'],'raw':!![]})[_0x56a9('0x7')](function(_0xd8aa7c){_0x83f534['setDataValue']('Users',_0xd8aa7c[_0x56a9('0x8')](function(_0x15f2ff){return{'id':_0x15f2ff['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x83f534['id'],'direction':'in','read':![]},'raw':!![]});})[_0x56a9('0x7')](function(_0x1eddfd){_0x83f534[_0x56a9('0x9')](_0x56a9('0xa'),_0x1eddfd[_0x56a9('0xb')]);SmsInteractionEvents[_0x56a9('0xc')](_0x12cd60+':'+_0x83f534['id'],_0x83f534);SmsInteractionEvents[_0x56a9('0xc')](_0x12cd60,_0x83f534);_0x2eb132(null);})[_0x56a9('0xd')](_0x2eb132(null));};}for(var e in events){if(events[_0x56a9('0xe')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x56a9('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 14711b8..5d04f70 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 _0xc795=['../../config/environment','./smsInteraction.attributes','exports','define','sms_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xc795,0x1ef));var _0x5c79=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xc795[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x5c79('0x0'));var util=require(_0x5c79('0x1'));var logger=require(_0x5c79('0x2'))(_0x5c79('0x3'));var moment=require(_0x5c79('0x4'));var BPromise=require(_0x5c79('0x5'));var rp=require(_0x5c79('0x6'));var fs=require('fs');var path=require(_0x5c79('0x7'));var rimraf=require(_0x5c79('0x8'));var config=require(_0x5c79('0x9'));var attributes=require(_0x5c79('0xa'));module[_0x5c79('0xb')]=function(_0x4f1a7a,_0x5045a9){return _0x4f1a7a[_0x5c79('0xc')]('SmsInteraction',attributes,{'tableName':_0x5c79('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x363188,_0x254cf8,_0x49d377){if(_0x363188[_0x5c79('0xe')]('closed')){_0x363188[_0x5c79('0xf')]=moment()[_0x5c79('0x10')](_0x5c79('0x11'));}_0x49d377(null,_0x363188);}}});}; \ No newline at end of file +var _0x81a7=['rimraf','./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','changed','closed','closedAt','util','../../config/logger','api'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x81a7,0x1e1));var _0x781a=function(_0xa645c0,_0x2d0bbb){_0xa645c0=_0xa645c0-0x0;var _0x1d6704=_0x81a7[_0xa645c0];return _0x1d6704;};'use strict';var _=require('lodash');var util=require(_0x781a('0x0'));var logger=require(_0x781a('0x1'))(_0x781a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x781a('0x3'));var config=require('../../config/environment');var attributes=require(_0x781a('0x4'));module[_0x781a('0x5')]=function(_0xa0fffa,_0x1f35c7){return _0xa0fffa['define'](_0x781a('0x6'),attributes,{'tableName':_0x781a('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x25eeff,_0x331428,_0x24268e){if(_0x25eeff[_0x781a('0x8')](_0x781a('0x9'))){_0x25eeff[_0x781a('0xa')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x24268e(null,_0x25eeff);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 3e04791..7bf3228 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 _0x8859=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request\x20sent','debug','stringify','error','message','SmsInteraction,\x20%s,\x20%s','result','catch','UpdateSmsInteraction','SmsInteraction','body','options','raw','limit','then','info','find','where','addTags','ids','AddTags'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x8859,0x6c));var _0x9885=function(_0xc0344c,_0x199031){_0xc0344c=_0xc0344c-0x0;var _0x564f2d=_0x8859[_0xc0344c];return _0x564f2d;};'use strict';var _=require(_0x9885('0x0'));var util=require(_0x9885('0x1'));var moment=require('moment');var BPromise=require(_0x9885('0x2'));var rs=require(_0x9885('0x3'));var fs=require('fs');var Redis=require(_0x9885('0x4'));var db=require(_0x9885('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9885('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9885('0x7')][_0x9885('0x8')]({'port':0x232a});config[_0x9885('0x9')]=_[_0x9885('0xa')](config[_0x9885('0x9')],{'host':_0x9885('0xb'),'port':0x18eb});var socket=require(_0x9885('0xc'))(new Redis(config[_0x9885('0x9')]));require(_0x9885('0xd'))[_0x9885('0xe')](socket);function respondWithRpcPromise(_0x388f5e,_0x84ad00,_0x44a391){return new BPromise(function(_0x31f263,_0x4c0662){return client['request'](_0x388f5e,_0x44a391)['then'](function(_0x4d5fab){logger['info']('SmsInteraction,\x20%s,\x20%s',_0x84ad00,_0x9885('0xf'));logger[_0x9885('0x10')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x84ad00,_0x9885('0xf'),JSON[_0x9885('0x11')](_0x4d5fab));if(_0x4d5fab[_0x9885('0x12')]){if(_0x4d5fab[_0x9885('0x12')]['code']===0x1f4){logger[_0x9885('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x84ad00,_0x4d5fab['error'][_0x9885('0x13')]);return _0x4c0662(_0x4d5fab[_0x9885('0x12')]['message']);}logger['error'](_0x9885('0x14'),_0x84ad00,_0x4d5fab[_0x9885('0x12')][_0x9885('0x13')]);return _0x31f263(_0x4d5fab[_0x9885('0x12')][_0x9885('0x13')]);}else{logger['info'](_0x9885('0x14'),_0x84ad00,_0x9885('0xf'));_0x31f263(_0x4d5fab[_0x9885('0x15')]['message']);}})[_0x9885('0x16')](function(_0x1bb7ab){logger['error'](_0x9885('0x14'),_0x84ad00,_0x1bb7ab);_0x4c0662(_0x1bb7ab);});});}exports[_0x9885('0x17')]=function(_0x40b13a){var _0x209c35=this;return new Promise(function(_0x49c150,_0xb7c7d8){return db[_0x9885('0x18')]['update'](_0x40b13a[_0x9885('0x19')],{'raw':_0x40b13a[_0x9885('0x1a')]?_0x40b13a[_0x9885('0x1a')][_0x9885('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40b13a['options']?_0x40b13a[_0x9885('0x1a')]['where']||null:null,'attributes':_0x40b13a[_0x9885('0x1a')]?_0x40b13a[_0x9885('0x1a')]['attributes']||null:null,'limit':_0x40b13a[_0x9885('0x1a')]?_0x40b13a[_0x9885('0x1a')][_0x9885('0x1c')]||null:null})[_0x9885('0x1d')](function(_0x23065f){logger[_0x9885('0x1e')]('UpdateSmsInteraction',_0x40b13a);logger['debug'](_0x9885('0x17'),_0x40b13a,JSON['stringify'](_0x23065f));_0x49c150(_0x23065f);})['catch'](function(_0x5988e8){logger[_0x9885('0x12')](_0x9885('0x17'),_0x5988e8[_0x9885('0x13')],_0x40b13a);_0xb7c7d8(_0x209c35[_0x9885('0x12')](0x1f4,_0x5988e8[_0x9885('0x13')]));});});};exports['AddTagsToSmsInteraction']=function(_0xc88248){return new Promise(function(_0x2a8e6a,_0x3f7ac1){return db[_0x9885('0x18')][_0x9885('0x1f')]({'where':_0xc88248[_0x9885('0x1a')]?_0xc88248[_0x9885('0x1a')][_0x9885('0x20')]||null:null})['then'](function(_0x525805){if(_0x525805){return _0x525805[_0x9885('0x21')](_0xc88248[_0x9885('0x19')][_0x9885('0x22')],_['omit'](_0xc88248[_0x9885('0x19')],[_0x9885('0x22'),'id'])||{});}})['spread'](function(_0x3d2fc3){logger[_0x9885('0x1e')]('AddTags',_0xc88248);logger[_0x9885('0x10')](_0x9885('0x23'),_0xc88248,JSON['stringify'](_0x3d2fc3));_0x2a8e6a(_0x3d2fc3);})[_0x9885('0x16')](function(_0x2d915a){logger['error'](_0x9885('0x23'),_0x2d915a['message'],_0xc88248);_0x3f7ac1(_this[_0x9885('0x12')](0x1f4,_0x2d915a[_0x9885('0x13')]));});});}; \ No newline at end of file +var _0x99c2=['catch','lodash','util','moment','bluebird','../../config/utils','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request','then','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','SmsInteraction,\x20%s,\x20%s','message','info','result','UpdateSmsInteraction','SmsInteraction','update','options','limit','AddTagsToSmsInteraction','find','body','ids','omit','spread','AddTags'];(function(_0xb1c71,_0x583b95){var _0x9fc2e8=function(_0x3e4fce){while(--_0x3e4fce){_0xb1c71['push'](_0xb1c71['shift']());}};_0x9fc2e8(++_0x583b95);}(_0x99c2,0xb5));var _0x299c=function(_0x1428b8,_0x10e63f){_0x1428b8=_0x1428b8-0x0;var _0x59c20b=_0x99c2[_0x1428b8];return _0x59c20b;};'use strict';var _=require(_0x299c('0x0'));var util=require(_0x299c('0x1'));var moment=require(_0x299c('0x2'));var BPromise=require(_0x299c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x299c('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x299c('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x299c('0x6')][_0x299c('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0x299c('0x8')],{'host':_0x299c('0x9'),'port':0x18eb});var socket=require(_0x299c('0xa'))(new Redis(config[_0x299c('0x8')]));require('./smsInteraction.socket')[_0x299c('0xb')](socket);function respondWithRpcPromise(_0x34ef70,_0x38c3e3,_0x17c60b){return new BPromise(function(_0x179fda,_0x5ee659){return client[_0x299c('0xc')](_0x34ef70,_0x17c60b)[_0x299c('0xd')](function(_0x32635b){logger['info']('SmsInteraction,\x20%s,\x20%s',_0x38c3e3,_0x299c('0xe'));logger[_0x299c('0xf')](_0x299c('0x10'),_0x38c3e3,_0x299c('0xe'),JSON[_0x299c('0x11')](_0x32635b));if(_0x32635b[_0x299c('0x12')]){if(_0x32635b[_0x299c('0x12')]['code']===0x1f4){logger['error'](_0x299c('0x13'),_0x38c3e3,_0x32635b[_0x299c('0x12')][_0x299c('0x14')]);return _0x5ee659(_0x32635b[_0x299c('0x12')][_0x299c('0x14')]);}logger[_0x299c('0x12')](_0x299c('0x13'),_0x38c3e3,_0x32635b[_0x299c('0x12')]['message']);return _0x179fda(_0x32635b['error']['message']);}else{logger[_0x299c('0x15')](_0x299c('0x13'),_0x38c3e3,_0x299c('0xe'));_0x179fda(_0x32635b[_0x299c('0x16')][_0x299c('0x14')]);}})['catch'](function(_0x5a250c){logger[_0x299c('0x12')](_0x299c('0x13'),_0x38c3e3,_0x5a250c);_0x5ee659(_0x5a250c);});});}exports[_0x299c('0x17')]=function(_0x3ebf0e){var _0x1a8efa=this;return new Promise(function(_0x4f8d17,_0x28fb8b){return db[_0x299c('0x18')][_0x299c('0x19')](_0x3ebf0e['body'],{'raw':_0x3ebf0e['options']?_0x3ebf0e[_0x299c('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ebf0e['options']?_0x3ebf0e[_0x299c('0x1a')]['where']||null:null,'attributes':_0x3ebf0e[_0x299c('0x1a')]?_0x3ebf0e[_0x299c('0x1a')]['attributes']||null:null,'limit':_0x3ebf0e['options']?_0x3ebf0e[_0x299c('0x1a')][_0x299c('0x1b')]||null:null})[_0x299c('0xd')](function(_0x4220ae){logger['info'](_0x299c('0x17'),_0x3ebf0e);logger[_0x299c('0xf')]('UpdateSmsInteraction',_0x3ebf0e,JSON[_0x299c('0x11')](_0x4220ae));_0x4f8d17(_0x4220ae);})['catch'](function(_0x274214){logger['error']('UpdateSmsInteraction',_0x274214[_0x299c('0x14')],_0x3ebf0e);_0x28fb8b(_0x1a8efa[_0x299c('0x12')](0x1f4,_0x274214[_0x299c('0x14')]));});});};exports[_0x299c('0x1c')]=function(_0x55234e){return new Promise(function(_0xbab880,_0x9100f8){return db['SmsInteraction'][_0x299c('0x1d')]({'where':_0x55234e[_0x299c('0x1a')]?_0x55234e['options']['where']||null:null})[_0x299c('0xd')](function(_0x362f12){if(_0x362f12){return _0x362f12['addTags'](_0x55234e[_0x299c('0x1e')][_0x299c('0x1f')],_[_0x299c('0x20')](_0x55234e['body'],[_0x299c('0x1f'),'id'])||{});}})[_0x299c('0x21')](function(_0x44fdbe){logger['info'](_0x299c('0x22'),_0x55234e);logger[_0x299c('0xf')](_0x299c('0x22'),_0x55234e,JSON[_0x299c('0x11')](_0x44fdbe));_0xbab880(_0x44fdbe);})[_0x299c('0x23')](function(_0x475ab8){logger[_0x299c('0x12')]('AddTags',_0x475ab8[_0x299c('0x14')],_0x55234e);_0x9100f8(_this[_0x299c('0x12')](0x1f4,_0x475ab8[_0x299c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index e4bd856..2b3d4bb 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 _0xfc38=['length','smsInteraction:','./smsInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x516ffb,_0x5b5b42){var _0x319667=function(_0x250098){while(--_0x250098){_0x516ffb['push'](_0x516ffb['shift']());}};_0x319667(++_0x5b5b42);}(_0xfc38,0x1f1));var _0x8fc3=function(_0x503c5c,_0x38e24d){_0x503c5c=_0x503c5c-0x0;var _0x894667=_0xfc38[_0x503c5c];return _0x894667;};'use strict';var SmsInteractionEvents=require(_0x8fc3('0x0'));var events=[_0x8fc3('0x1'),_0x8fc3('0x2'),_0x8fc3('0x3')];function createListener(_0x126598,_0x3153e9){return function(_0x50b8dc){_0x3153e9[_0x8fc3('0x4')](_0x126598,_0x50b8dc);};}function removeListener(_0x11de67,_0x147c9f){return function(){SmsInteractionEvents[_0x8fc3('0x5')](_0x11de67,_0x147c9f);};}exports[_0x8fc3('0x6')]=function(_0x2c6c23){for(var _0x5e0a4c=0x0,_0x53975e=events[_0x8fc3('0x7')];_0x5e0a4c<_0x53975e;_0x5e0a4c++){var _0x5d0563=events[_0x5e0a4c];var _0x141edd=createListener(_0x8fc3('0x8')+_0x5d0563,_0x2c6c23);SmsInteractionEvents['on'](_0x5d0563,_0x141edd);}}; \ No newline at end of file +var _0x8a5a=['update','register','length','smsInteraction:','./smsInteraction.events','save','remove'];(function(_0x4a3f02,_0x490d08){var _0x50877b=function(_0x254578){while(--_0x254578){_0x4a3f02['push'](_0x4a3f02['shift']());}};_0x50877b(++_0x490d08);}(_0x8a5a,0x123));var _0xa8a5=function(_0x1d75d8,_0x179ba2){_0x1d75d8=_0x1d75d8-0x0;var _0xeb5933=_0x8a5a[_0x1d75d8];return _0xeb5933;};'use strict';var SmsInteractionEvents=require(_0xa8a5('0x0'));var events=[_0xa8a5('0x1'),_0xa8a5('0x2'),_0xa8a5('0x3')];function createListener(_0x5c068a,_0x28dc0f){return function(_0x22527a){_0x28dc0f['emit'](_0x5c068a,_0x22527a);};}function removeListener(_0x48ee3a,_0x30e881){return function(){SmsInteractionEvents['removeListener'](_0x48ee3a,_0x30e881);};}exports[_0xa8a5('0x4')]=function(_0x493a10){for(var _0xbc3f8c=0x0,_0x622a9a=events[_0xa8a5('0x5')];_0xbc3f8c<_0x622a9a;_0xbc3f8c++){var _0x3a0b94=events[_0xbc3f8c];var _0x3c1ab2=createListener(_0xa8a5('0x6')+_0x3a0b94,_0x493a10);SmsInteractionEvents['on'](_0x3a0b94,_0x3c1ab2);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 76eddc5..859ee69 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 _0x1d90=['status','put','/:id','update','/:id/accept','accept','reject','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../config/environment','./smsMessage.controller','get','index','/describe','describe','isAuthenticated','show','post','tracked','sms','smsmessage:create','/:id/status'];(function(_0x1c9017,_0x32be18){var _0x20520c=function(_0x17b6a9){while(--_0x17b6a9){_0x1c9017['push'](_0x1c9017['shift']());}};_0x20520c(++_0x32be18);}(_0x1d90,0x13e));var _0x01d9=function(_0x466663,_0x44219b){_0x466663=_0x466663-0x0;var _0x1e4d52=_0x1d90[_0x466663];return _0x1e4d52;};'use strict';var multer=require(_0x01d9('0x0'));var util=require('util');var path=require(_0x01d9('0x1'));var timeout=require('connect-timeout');var express=require(_0x01d9('0x2'));var router=express['Router']();var fs_extra=require(_0x01d9('0x3'));var auth=require(_0x01d9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x01d9('0x5'));var controller=require(_0x01d9('0x6'));router[_0x01d9('0x7')]('/',auth['isAuthenticated'](),controller[_0x01d9('0x8')]);router[_0x01d9('0x7')](_0x01d9('0x9'),auth['isAuthenticated'](),controller[_0x01d9('0xa')]);router['get']('/:id',auth[_0x01d9('0xb')](),controller[_0x01d9('0xc')]);router[_0x01d9('0xd')]('/',auth['isAuthenticated'](),interaction[_0x01d9('0xe')](_0x01d9('0xf'),_0x01d9('0x10')),controller['create']);router[_0x01d9('0xd')](_0x01d9('0x11'),controller[_0x01d9('0x12')]);router[_0x01d9('0x13')](_0x01d9('0x14'),auth[_0x01d9('0xb')](),controller[_0x01d9('0x15')]);router[_0x01d9('0x13')](_0x01d9('0x16'),auth[_0x01d9('0xb')](),controller[_0x01d9('0x17')]);router[_0x01d9('0x13')]('/:id/reject',auth[_0x01d9('0xb')](),controller[_0x01d9('0x18')]);router[_0x01d9('0x19')](_0x01d9('0x14'),auth['isAuthenticated'](),controller[_0x01d9('0x1a')]);module[_0x01d9('0x1b')]=router; \ No newline at end of file +var _0x6df7=['destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsMessage.controller','isAuthenticated','index','get','describe','/:id','post','tracked','smsmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete'];(function(_0x42035b,_0x5f2ab5){var _0x3fe817=function(_0x12cdde){while(--_0x12cdde){_0x42035b['push'](_0x42035b['shift']());}};_0x3fe817(++_0x5f2ab5);}(_0x6df7,0x72));var _0x76df=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6df7[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x76df('0x0'));var util=require('util');var path=require(_0x76df('0x1'));var timeout=require(_0x76df('0x2'));var express=require('express');var router=express[_0x76df('0x3')]();var fs_extra=require(_0x76df('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x76df('0x5'));var config=require(_0x76df('0x6'));var controller=require(_0x76df('0x7'));router['get']('/',auth[_0x76df('0x8')](),controller[_0x76df('0x9')]);router[_0x76df('0xa')]('/describe',auth[_0x76df('0x8')](),controller[_0x76df('0xb')]);router[_0x76df('0xa')](_0x76df('0xc'),auth[_0x76df('0x8')](),controller['show']);router[_0x76df('0xd')]('/',auth['isAuthenticated'](),interaction[_0x76df('0xe')]('sms',_0x76df('0xf')),controller[_0x76df('0x10')]);router[_0x76df('0xd')](_0x76df('0x11'),controller[_0x76df('0x12')]);router[_0x76df('0x13')](_0x76df('0xc'),auth[_0x76df('0x8')](),controller[_0x76df('0x14')]);router[_0x76df('0x13')](_0x76df('0x15'),auth[_0x76df('0x8')](),controller[_0x76df('0x16')]);router[_0x76df('0x13')](_0x76df('0x17'),auth[_0x76df('0x8')](),controller[_0x76df('0x18')]);router[_0x76df('0x19')](_0x76df('0xc'),auth[_0x76df('0x8')](),controller[_0x76df('0x1a')]);module[_0x76df('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index da88678..3262ece 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 _0x4932=['ENUM','out','STRING','DATE','BOOLEAN','sequelize','exports','TEXT','medium'];(function(_0x560aba,_0x3af005){var _0xe3f374=function(_0x5526c8){while(--_0x5526c8){_0x560aba['push'](_0x560aba['shift']());}};_0xe3f374(++_0x3af005);}(_0x4932,0x164));var _0x2493=function(_0x38a62f,_0x26b533){_0x38a62f=_0x38a62f-0x0;var _0x1f734b=_0x4932[_0x38a62f];return _0x1f734b;};'use strict';var Sequelize=require(_0x2493('0x0'));module[_0x2493('0x1')]={'body':{'type':Sequelize[_0x2493('0x2')](_0x2493('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x2493('0x4')]('in',_0x2493('0x5')),'defaultValue':_0x2493('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x2493('0x6')](0xbe)},'phone':{'type':Sequelize[_0x2493('0x6')]},'readAt':{'type':Sequelize[_0x2493('0x7')]},'secret':{'type':Sequelize[_0x2493('0x8')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x2493('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xa3b9=['out','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa3b9,0x102));var _0x9a3b=function(_0x14ec85,_0x5cd0ed){_0x14ec85=_0x14ec85-0x0;var _0x3c1853=_0xa3b9[_0x14ec85];return _0x3c1853;};'use strict';var Sequelize=require(_0x9a3b('0x0'));module[_0x9a3b('0x1')]={'body':{'type':Sequelize[_0x9a3b('0x2')](_0x9a3b('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x9a3b('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9a3b('0x5')]('in',_0x9a3b('0x6')),'defaultValue':_0x9a3b('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x9a3b('0x7')](0xbe)},'phone':{'type':Sequelize[_0x9a3b('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x9a3b('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x9a3b('0x7')]},'providerResponse':{'type':Sequelize[_0x9a3b('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 19fa470..bed207e 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 _0x2484=['../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','SmsMessage','includeAll','findAll','rows','show','params','filters','fields','include','find','catch','create','body','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','SmsInteraction','SmsInteractionId','isNil','read1stAt','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','agent','fullname','email','interface','SIP/%s','channel','motionChannel','event','EventManager','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','User','internal','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','indexOf','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','results','groupName','infobip','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x2484,0x1b9));var _0x4248=function(_0x46a3e8,_0x2e1b35){_0x46a3e8=_0x46a3e8-0x0;var _0xf1442e=_0x2484[_0x46a3e8];return _0xf1442e;};'use strict';var emlformat=require(_0x4248('0x0'));var rimraf=require(_0x4248('0x1'));var zipdir=require(_0x4248('0x2'));var jsonpatch=require(_0x4248('0x3'));var rp=require(_0x4248('0x4'));var moment=require('moment');var BPromise=require(_0x4248('0x5'));var Mustache=require(_0x4248('0x6'));var util=require(_0x4248('0x7'));var path=require(_0x4248('0x8'));var sox=require(_0x4248('0x9'));var csv=require(_0x4248('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4248('0xb'));var _=require(_0x4248('0xc'));var squel=require(_0x4248('0xd'));var crypto=require(_0x4248('0xe'));var jsforce=require(_0x4248('0xf'));var deskjs=require(_0x4248('0x10'));var toCsv=require(_0x4248('0xa'));var querystring=require(_0x4248('0x11'));var Papa=require(_0x4248('0x12'));var Redis=require(_0x4248('0x13'));var authService=require(_0x4248('0x14'));var qs=require(_0x4248('0x15'));var as=require(_0x4248('0x16'));var hardwareService=require(_0x4248('0x17'));var logger=require(_0x4248('0x18'))(_0x4248('0x19'));var utils=require('../../config/utils');var config=require(_0x4248('0x1a'));var licenseUtil=require(_0x4248('0x1b'));var db=require(_0x4248('0x1c'))['db'];config[_0x4248('0x1d')]=_[_0x4248('0x1e')](config['redis'],{'host':_0x4248('0x1f'),'port':0x18eb});var socket=require(_0x4248('0x20'))(new Redis(config[_0x4248('0x1d')]));require(_0x4248('0x21'))[_0x4248('0x22')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4248('0x23')][_0x4248('0x24')]({'port':0x232c});var client9002=jayson[_0x4248('0x23')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14fd5d,_0x88067a,_0x297cf8,_0x1c49f0){return new BPromise(function(_0x22fb18,_0x40513d){var _0x41b2af=_0x1c49f0||client;return _0x41b2af[_0x4248('0x25')](_0x14fd5d,_0x297cf8)[_0x4248('0x26')](function(_0x567457){logger[_0x4248('0x27')](_0x4248('0x28'),_0x88067a,_0x4248('0x29'));logger[_0x4248('0x2a')](_0x4248('0x2b'),_0x88067a,'request\x20sent',JSON[_0x4248('0x2c')](_0x567457));if(_0x567457[_0x4248('0x2d')]){if(_0x567457[_0x4248('0x2d')][_0x4248('0x2e')]===0x1f4){logger[_0x4248('0x2d')](_0x4248('0x28'),_0x88067a,_0x567457['error'][_0x4248('0x2f')]);return _0x40513d(_0x567457[_0x4248('0x2d')][_0x4248('0x2f')]);}logger['error'](_0x4248('0x28'),_0x88067a,_0x567457[_0x4248('0x2d')]['message']);return _0x22fb18(_0x567457[_0x4248('0x2d')][_0x4248('0x2f')]);}else{logger[_0x4248('0x27')]('SmsMessage,\x20%s,\x20%s',_0x88067a,_0x4248('0x29'));_0x22fb18(_0x567457[_0x4248('0x30')][_0x4248('0x2f')]);}})['catch'](function(_0x7a1dec){logger[_0x4248('0x2d')](_0x4248('0x28'),_0x88067a,_0x7a1dec);_0x40513d(_0x7a1dec);});});}function respondWithStatusCode(_0x4d9c63,_0xa8bc08){_0xa8bc08=_0xa8bc08||0xcc;return function(_0x535ea2){if(_0x535ea2){return _0x4d9c63['sendStatus'](_0xa8bc08);}return _0x4d9c63[_0x4248('0x31')](_0xa8bc08)[_0x4248('0x32')]();};}function respondWithResult(_0x239a4a,_0x27c41d){_0x27c41d=_0x27c41d||0xc8;return function(_0x4d686a){if(_0x4d686a){return _0x239a4a[_0x4248('0x31')](_0x27c41d)['json'](_0x4d686a);}};}function respondWithFilteredResult(_0x1274c9,_0x3dc30a){return function(_0x13acf4){if(_0x13acf4){var _0xcf90b9=typeof _0x3dc30a[_0x4248('0x33')]===_0x4248('0x34')&&typeof _0x3dc30a[_0x4248('0x35')]==='undefined';var _0x1f5675=_0x13acf4[_0x4248('0x36')];var _0x1454b4=_0xcf90b9?0x0:_0x3dc30a['offset'];var _0x1b7ba8=_0xcf90b9?_0x13acf4[_0x4248('0x36')]:_0x3dc30a['offset']+_0x3dc30a[_0x4248('0x35')];var _0x38c403;if(_0x1b7ba8>=_0x1f5675){_0x1b7ba8=_0x1f5675;_0x38c403=0xc8;}else{_0x38c403=0xce;}_0x1274c9[_0x4248('0x31')](_0x38c403);return _0x1274c9[_0x4248('0x37')](_0x4248('0x38'),_0x1454b4+'-'+_0x1b7ba8+'/'+_0x1f5675)[_0x4248('0x39')](_0x13acf4);}return null;};}function patchUpdates(_0x169690){return function(_0x4f7b87){try{jsonpatch[_0x4248('0x3a')](_0x4f7b87,_0x169690,!![]);}catch(_0xab84f6){return BPromise[_0x4248('0x3b')](_0xab84f6);}return _0x4f7b87[_0x4248('0x3c')]();};}function saveUpdates(_0x489aae,_0x36d15c){return function(_0x28139d){if(_0x28139d){return _0x28139d[_0x4248('0x3d')](_0x489aae)[_0x4248('0x26')](function(_0x468315){return _0x468315;});}return null;};}function removeEntity(_0x36f0e9,_0x491dc4){return function(_0xf5e29b){if(_0xf5e29b){return _0xf5e29b[_0x4248('0x3e')]()['then'](function(){_0x36f0e9['status'](0xcc)[_0x4248('0x32')]();});}};}function handleEntityNotFound(_0x155e56,_0x3dd657){return function(_0x3a8346){if(!_0x3a8346){_0x155e56['sendStatus'](0x194);}return _0x3a8346;};}function handleError(_0x14a9c3,_0x16b4a2){_0x16b4a2=_0x16b4a2||0x1f4;return function(_0x315269){logger['error'](_0x315269[_0x4248('0x3f')]);if(_0x315269[_0x4248('0x40')]){delete _0x315269[_0x4248('0x40')];}_0x14a9c3['status'](_0x16b4a2)[_0x4248('0x41')](_0x315269);};}exports[_0x4248('0x42')]=function(_0xc61207,_0x1d13b1){var _0x41e69d={},_0x12d0a6={},_0x4ecace={'count':0x0,'rows':[]};var _0x1da0d1=_['map'](db['SmsMessage'][_0x4248('0x43')],function(_0x38e40c){return{'name':_0x38e40c[_0x4248('0x44')],'type':_0x38e40c[_0x4248('0x45')][_0x4248('0x46')]};});_0x12d0a6[_0x4248('0x47')]=_[_0x4248('0x48')](_0x1da0d1,_0x4248('0x40'));_0x12d0a6[_0x4248('0x49')]=_[_0x4248('0x4a')](_0xc61207[_0x4248('0x49')]);_0x12d0a6['filters']=_[_0x4248('0x4b')](_0x12d0a6[_0x4248('0x47')],_0x12d0a6[_0x4248('0x49')]);_0x41e69d['attributes']=_[_0x4248('0x4b')](_0x12d0a6[_0x4248('0x47')],qs['fields'](_0xc61207[_0x4248('0x49')]['fields']));_0x41e69d[_0x4248('0x4c')]=_0x41e69d[_0x4248('0x4c')][_0x4248('0x4d')]?_0x41e69d[_0x4248('0x4c')]:_0x12d0a6[_0x4248('0x47')];if(!_0xc61207['query']['hasOwnProperty'](_0x4248('0x4e'))){_0x41e69d[_0x4248('0x35')]=qs[_0x4248('0x35')](_0xc61207[_0x4248('0x49')]['limit']);_0x41e69d[_0x4248('0x33')]=qs[_0x4248('0x33')](_0xc61207[_0x4248('0x49')]['offset']);}_0x41e69d[_0x4248('0x4f')]=qs['sort'](_0xc61207['query'][_0x4248('0x50')]);_0x41e69d[_0x4248('0x51')]=qs['filters'](_[_0x4248('0x52')](_0xc61207['query'],_0x12d0a6['filters']),_0x1da0d1);if(_0xc61207[_0x4248('0x49')][_0x4248('0x53')]){_0x41e69d['where']=_[_0x4248('0x54')](_0x41e69d[_0x4248('0x51')],{'$or':_[_0x4248('0x48')](_0x1da0d1,function(_0x4c207f){if(_0x4c207f['type']!=='VIRTUAL'){var _0x3991ff={};_0x3991ff[_0x4c207f[_0x4248('0x40')]]={'$like':'%'+_0xc61207[_0x4248('0x49')]['filter']+'%'};return _0x3991ff;}})});}_0x41e69d=_['merge']({},_0x41e69d,_0xc61207[_0x4248('0x55')]);var _0x1da830={'where':_0x41e69d[_0x4248('0x51')]};return db[_0x4248('0x56')][_0x4248('0x36')](_0x1da830)['then'](function(_0x22c607){_0x4ecace[_0x4248('0x36')]=_0x22c607;if(_0xc61207['query'][_0x4248('0x57')]){_0x41e69d['include']=[{'all':!![]}];}return db[_0x4248('0x56')][_0x4248('0x58')](_0x41e69d);})[_0x4248('0x26')](function(_0x362639){_0x4ecace[_0x4248('0x59')]=_0x362639;return _0x4ecace;})[_0x4248('0x26')](respondWithFilteredResult(_0x1d13b1,_0x41e69d))['catch'](handleError(_0x1d13b1,null));};exports[_0x4248('0x5a')]=function(_0x46bb12,_0x58990a){var _0x150cc5={'raw':!![],'where':{'id':_0x46bb12[_0x4248('0x5b')]['id']}},_0x2814ba={};_0x2814ba[_0x4248('0x47')]=_[_0x4248('0x4a')](db[_0x4248('0x56')][_0x4248('0x43')]);_0x2814ba[_0x4248('0x49')]=_[_0x4248('0x4a')](_0x46bb12[_0x4248('0x49')]);_0x2814ba[_0x4248('0x5c')]=_[_0x4248('0x4b')](_0x2814ba[_0x4248('0x47')],_0x2814ba[_0x4248('0x49')]);_0x150cc5[_0x4248('0x4c')]=_['intersection'](_0x2814ba[_0x4248('0x47')],qs[_0x4248('0x5d')](_0x46bb12['query'][_0x4248('0x5d')]));_0x150cc5['attributes']=_0x150cc5['attributes'][_0x4248('0x4d')]?_0x150cc5[_0x4248('0x4c')]:_0x2814ba[_0x4248('0x47')];if(_0x46bb12['query'][_0x4248('0x57')]){_0x150cc5[_0x4248('0x5e')]=[{'all':!![]}];}_0x150cc5=_[_0x4248('0x54')]({},_0x150cc5,_0x46bb12[_0x4248('0x55')]);return db['SmsMessage'][_0x4248('0x5f')](_0x150cc5)[_0x4248('0x26')](handleEntityNotFound(_0x58990a,null))[_0x4248('0x26')](respondWithResult(_0x58990a,null))[_0x4248('0x60')](handleError(_0x58990a,null));};exports['create']=function(_0x3cb6a3,_0x350cd5){return db[_0x4248('0x56')][_0x4248('0x61')](_0x3cb6a3[_0x4248('0x62')],{})['then'](respondWithResult(_0x350cd5,0xc9))[_0x4248('0x60')](handleError(_0x350cd5,null));};exports[_0x4248('0x3d')]=function(_0x4d8c91,_0x380265){if(_0x4d8c91[_0x4248('0x62')]['id']){delete _0x4d8c91[_0x4248('0x62')]['id'];}return db['SmsMessage'][_0x4248('0x5f')]({'where':{'id':_0x4d8c91['params']['id']}})['then'](handleEntityNotFound(_0x380265,null))[_0x4248('0x26')](saveUpdates(_0x4d8c91[_0x4248('0x62')],null))[_0x4248('0x26')](respondWithResult(_0x380265,null))[_0x4248('0x60')](handleError(_0x380265,null));};exports[_0x4248('0x3e')]=function(_0x1faa56,_0x48122f){return db[_0x4248('0x56')]['find']({'where':{'id':_0x1faa56['params']['id']}})[_0x4248('0x26')](handleEntityNotFound(_0x48122f,null))[_0x4248('0x26')](removeEntity(_0x48122f,null))[_0x4248('0x60')](handleError(_0x48122f,null));};exports[_0x4248('0x63')]=function(_0x25107c,_0x2428aa){return db[_0x4248('0x56')][_0x4248('0x63')]()[_0x4248('0x26')](respondWithResult(_0x2428aa,null))['catch'](handleError(_0x2428aa,null));};var interaction_log=require(_0x4248('0x18'))(_0x4248('0x64'));exports[_0x4248('0x65')]=function(_0x2a31b4,_0x265a1e,_0x1b6d4a){var _0x296485={'agent':{},'channel':_0x4248('0x66')};if(_0x2a31b4[_0x4248('0x62')]['id']){delete _0x2a31b4[_0x4248('0x62')]['id'];}_0x2a31b4[_0x4248('0x62')][_0x4248('0x67')]=!![];_0x2a31b4[_0x4248('0x62')][_0x4248('0x68')]=moment()[_0x4248('0x69')](_0x4248('0x6a'));_0x2a31b4[_0x4248('0x62')][_0x4248('0x6b')]=_0x2a31b4[_0x4248('0x62')][_0x4248('0x6b')]||_0x2a31b4['user']['id'];_0x296485['agent']['id']=_0x2a31b4[_0x4248('0x62')][_0x4248('0x6b')];return db[_0x4248('0x56')][_0x4248('0x5f')]({'where':{'id':_0x2a31b4['params']['id'],'UserId':null}})[_0x4248('0x26')](handleEntityNotFound(_0x265a1e,null))[_0x4248('0x26')](saveUpdates(_0x2a31b4['body'],null))[_0x4248('0x26')](function(_0x677b77){if(_0x677b77){_0x296485[_0x4248('0x2f')]=_0x677b77['get']({'plain':!![]});return db[_0x4248('0x6c')][_0x4248('0x5f')]({'where':{'id':_0x677b77[_0x4248('0x6d')]}});}return null;})[_0x4248('0x26')](handleEntityNotFound(_0x265a1e,null))[_0x4248('0x26')](function(_0x1801b5){if(_0x1801b5){return _0x1801b5['update']({'UserId':_0x2a31b4[_0x4248('0x62')]['UserId'],'read1stAt':_[_0x4248('0x6e')](_0x1801b5[_0x4248('0x6f')])?moment()[_0x4248('0x69')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x4248('0x26')](function(_0x31fdf7){if(_0x31fdf7){_0x296485['interaction']=_0x31fdf7[_0x4248('0x70')]({'plain':!![]});interaction_log[_0x4248('0x27')](_0x4248('0x71'),_0x2a31b4['user']['id'],_0x2a31b4[_0x4248('0x72')][_0x4248('0x40')],_0x2a31b4['user'][_0x4248('0x73')],_0x296485[_0x4248('0x74')]['id'],_0x2a31b4[_0x4248('0x62')]?JSON[_0x4248('0x2c')](_0x2a31b4[_0x4248('0x62')]):'null');return respondWithRpcPromise(_0x4248('0x75'),_0x4248('0x76'),_0x296485);}return null;})[_0x4248('0x26')](function(_0x2ea2a4){var _0x1787f5=_0x4248('0x77')+_0x2ea2a4['message'][_0x4248('0x78')];return db[_0x4248('0x79')][_0x4248('0x49')](_0x1787f5,{'type':db[_0x4248('0x7a')][_0x4248('0x7b')][_0x4248('0x7c')],'raw':!![]})[_0x4248('0x26')](function(_0x13121a){return _0x13121a;});})['then'](function(_0x3d8d12){if(_0x3d8d12){_0x296485[_0x4248('0x2f')][_0x4248('0x7d')]=_0x3d8d12[0x0];if(!_0x2a31b4[_0x4248('0x62')]['UserId'])return;return db['User'][_0x4248('0x5f')]({'where':{'id':_0x2a31b4[_0x4248('0x62')][_0x4248('0x6b')],'role':_0x4248('0x7e')},'attributes':['id','name',_0x4248('0x7f'),_0x4248('0x80'),'internal'],'raw':!![]});}return null;})[_0x4248('0x26')](function(_0xb78966){if(!_0xb78966)return null;_0x296485[_0x4248('0x2f')]['agent']=_0xb78966;return _0x296485;})[_0x4248('0x26')](function(_0x334aa4){if(_0x334aa4){if(_0x2a31b4[_0x4248('0x62')]['manual']){_0x296485[_0x4248('0x2f')][_0x4248('0x81')]=util[_0x4248('0x69')](_0x4248('0x82'),_0x2a31b4[_0x4248('0x72')][_0x4248('0x40')]);_0x296485[_0x4248('0x2f')]['channel']=_0x296485[_0x4248('0x83')];_0x296485[_0x4248('0x2f')][_0x4248('0x84')]=_0x296485[_0x4248('0x83')];_0x296485[_0x4248('0x2f')][_0x4248('0x85')]=_0x4248('0x65');return respondWithRpcPromise(_0x4248('0x86'),_0x4248('0x86'),{'event':'acceptmessage','message':_0x296485[_0x4248('0x2f')]},client9002)[_0x4248('0x26')](function(){return _0x296485;});}return _0x296485;}return null;})['then'](respondWithResult(_0x265a1e,null))[_0x4248('0x60')](handleError(_0x265a1e,null));};var interaction_log=require(_0x4248('0x18'))(_0x4248('0x64'));exports[_0x4248('0x3b')]=function(_0x5d3305,_0x2b3831,_0x526680){var _0x289f8b={'agent':{},'channel':_0x4248('0x66')};if(_0x5d3305['body']['id']){delete _0x5d3305[_0x4248('0x62')]['id'];}_0x5d3305[_0x4248('0x62')]['UserId']=_0x5d3305['body'][_0x4248('0x6b')]||_0x5d3305[_0x4248('0x72')]['id'];_0x289f8b['agent']['id']=_0x5d3305[_0x4248('0x62')][_0x4248('0x6b')];return db[_0x4248('0x56')][_0x4248('0x5f')]({'where':{'id':_0x5d3305[_0x4248('0x5b')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2b3831,null))[_0x4248('0x26')](function(_0x2eaf9e){if(_0x2eaf9e){_0x289f8b[_0x4248('0x2f')]=_0x2eaf9e['get']({'plain':!![]});return db[_0x4248('0x6c')]['find']({'where':{'id':_0x2eaf9e[_0x4248('0x6d')]}});}return null;})[_0x4248('0x26')](handleEntityNotFound(_0x2b3831,null))['then'](function(_0x1bb6d5){if(_0x1bb6d5){_0x289f8b[_0x4248('0x74')]=_0x1bb6d5[_0x4248('0x70')]({'plain':!![]});interaction_log['info'](_0x4248('0x87'),_0x5d3305[_0x4248('0x72')]['id'],_0x5d3305[_0x4248('0x72')][_0x4248('0x40')],_0x5d3305[_0x4248('0x72')][_0x4248('0x73')],_0x289f8b[_0x4248('0x74')]['id'],_0x5d3305[_0x4248('0x62')]?JSON[_0x4248('0x2c')](_0x5d3305[_0x4248('0x62')]):'null');return respondWithRpcPromise(_0x4248('0x88'),_0x4248('0x89'),_0x289f8b);}return null;})[_0x4248('0x26')](function(_0x1544b7){var _0x3d07d5=_0x4248('0x77')+_0x1544b7['message'][_0x4248('0x78')];return db[_0x4248('0x79')][_0x4248('0x49')](_0x3d07d5,{'type':db[_0x4248('0x7a')]['QueryTypes'][_0x4248('0x7c')],'raw':!![]})[_0x4248('0x26')](function(_0x408262){return _0x408262;});})[_0x4248('0x26')](function(_0x5b3ef0){if(_0x5b3ef0){_0x289f8b[_0x4248('0x2f')][_0x4248('0x7d')]=_0x5b3ef0[0x0];if(!_0x5d3305['body'][_0x4248('0x6b')])return;return db[_0x4248('0x8a')]['find']({'where':{'id':_0x5d3305[_0x4248('0x62')][_0x4248('0x6b')],'role':_0x4248('0x7e')},'attributes':['id',_0x4248('0x40'),'fullname',_0x4248('0x80'),_0x4248('0x8b')],'raw':!![]});}return null;})[_0x4248('0x26')](function(_0x5038f){if(!_0x5038f)return null;_0x289f8b['message']['agent']=_0x5038f;return _0x289f8b;})['then'](function(_0x3701f6){if(_0x3701f6){_0x3701f6['message'][_0x4248('0x81')]=util[_0x4248('0x69')](_0x4248('0x82'),_0x5d3305[_0x4248('0x72')][_0x4248('0x40')]);_0x3701f6[_0x4248('0x2f')][_0x4248('0x83')]=_0x289f8b['channel'];_0x3701f6[_0x4248('0x2f')][_0x4248('0x84')]=_0x289f8b[_0x4248('0x83')];_0x3701f6[_0x4248('0x2f')][_0x4248('0x85')]=_0x4248('0x3b');respondWithRpcPromise(_0x4248('0x86'),_0x4248('0x86'),{'event':_0x4248('0x8c'),'message':_0x3701f6[_0x4248('0x2f')]},client9002);return _0x289f8b;}return null;})[_0x4248('0x26')](respondWithResult(_0x2b3831,null))['catch'](handleError(_0x2b3831,null));};exports[_0x4248('0x31')]=function(_0x43e20a,_0xc9eb6d,_0x1f6358){if(_0x43e20a[_0x4248('0x62')]['id']){delete _0x43e20a[_0x4248('0x62')]['id'];}var _0x539b83;return db[_0x4248('0x56')][_0x4248('0x5f')]({'where':{'id':_0x43e20a[_0x4248('0x5b')]['id']}})['then'](handleEntityNotFound(_0xc9eb6d,null))[_0x4248('0x26')](function(_0x1065b0){if(_0x1065b0){_0x539b83=_0x1065b0;return db[_0x4248('0x8d')]['find']({'where':{'id':_0x1065b0[_0x4248('0x8e')]}});}})[_0x4248('0x26')](handleEntityNotFound(_0xc9eb6d,null))[_0x4248('0x26')](function(_0x2a5b3f){if(_0x2a5b3f){logger[_0x4248('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4248('0x31'),_0x4248('0x8f'),_0x2a5b3f[_0x4248('0x45')],util[_0x4248('0x90')](_0x43e20a['body'],{'showHidden':![],'depth':null}));switch(_0x2a5b3f[_0x4248('0x45')]){case _0x4248('0x91'):if(_0x43e20a[_0x4248('0x62')][_0x4248('0x92')]&&_0x43e20a[_0x4248('0x62')][_0x4248('0x92')]===_0x539b83['messageId']){return _0x539b83[_0x4248('0x3d')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4248('0x31'),'twilio',util[_0x4248('0x90')](_0x43e20a[_0x4248('0x62')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x43e20a['body']['MessageUUID']&&_0x43e20a[_0x4248('0x62')]['MessageUUID']===_0x539b83[_0x4248('0x93')]&&_[_0x4248('0x94')](['sent',_0x4248('0x95')],_0x43e20a[_0x4248('0x62')][_0x4248('0x96')])>=0x0){return _0x539b83['update']({'read':!![]});}else{logger[_0x4248('0x2d')](_0x4248('0x97'),_0x4248('0x31'),_0x4248('0x98'),util[_0x4248('0x90')](_0x43e20a['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x26f8fd=_0x43e20a[_0x4248('0x62')][_0x4248('0x99')][0x0];if(_0x26f8fd[_0x4248('0x31')][_0x4248('0x9a')]==='DELIVERED'){return _0x539b83[_0x4248('0x3d')]({'read':!![]});}else{logger['error'](_0x4248('0x97'),_0x4248('0x31'),_0x4248('0x9b'),util[_0x4248('0x90')](_0x43e20a[_0x4248('0x62')],{'showHidden':![],'depth':null}));}break;}return _0x539b83;}})[_0x4248('0x26')](respondWithResult(_0xc9eb6d,null))['catch'](handleError(_0xc9eb6d,null));}; \ No newline at end of file +var _0x26b0=['rejectmessage','SmsAccount','SmsAccountId','debug','SmsMessage,\x20%s,\x20%s,\x20%s','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','messageId','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','client','http','SmsMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','end','status','undefined','limit','count','offset','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','name','index','map','SmsMessage','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','SmsInteraction','SmsInteractionId','isNil','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','User','fullname','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','QueryTypes','contact','email'];(function(_0x303c30,_0x16edcb){var _0x43161b=function(_0x3330ff){while(--_0x3330ff){_0x303c30['push'](_0x303c30['shift']());}};_0x43161b(++_0x16edcb);}(_0x26b0,0x138));var _0x026b=function(_0x5d845a,_0x3d3db0){_0x5d845a=_0x5d845a-0x0;var _0x111a7b=_0x26b0[_0x5d845a];return _0x111a7b;};'use strict';var emlformat=require(_0x026b('0x0'));var rimraf=require(_0x026b('0x1'));var zipdir=require(_0x026b('0x2'));var jsonpatch=require(_0x026b('0x3'));var rp=require(_0x026b('0x4'));var moment=require(_0x026b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x026b('0x6'));var util=require(_0x026b('0x7'));var path=require(_0x026b('0x8'));var sox=require(_0x026b('0x9'));var csv=require(_0x026b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x026b('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x026b('0xc'));var deskjs=require(_0x026b('0xd'));var toCsv=require(_0x026b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x026b('0xe'));var authService=require(_0x026b('0xf'));var qs=require(_0x026b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x026b('0x11'));var logger=require(_0x026b('0x12'))(_0x026b('0x13'));var utils=require(_0x026b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x026b('0x15'));var db=require(_0x026b('0x16'))['db'];config[_0x026b('0x17')]=_[_0x026b('0x18')](config[_0x026b('0x17')],{'host':_0x026b('0x19'),'port':0x18eb});var socket=require(_0x026b('0x1a'))(new Redis(config['redis']));require(_0x026b('0x1b'))['register'](socket);var jayson=require(_0x026b('0x1c'));var client=jayson[_0x026b('0x1d')][_0x026b('0x1e')]({'port':0x232c});var client9002=jayson[_0x026b('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x250697,_0x1956a4,_0xe8d12,_0x4c0fca){return new BPromise(function(_0x5117f3,_0x4bd1ff){var _0x43b1a8=_0x4c0fca||client;return _0x43b1a8['request'](_0x250697,_0xe8d12)['then'](function(_0xbb0e24){logger['info'](_0x026b('0x1f'),_0x1956a4,_0x026b('0x20'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1956a4,_0x026b('0x20'),JSON[_0x026b('0x21')](_0xbb0e24));if(_0xbb0e24[_0x026b('0x22')]){if(_0xbb0e24[_0x026b('0x22')][_0x026b('0x23')]===0x1f4){logger['error'](_0x026b('0x1f'),_0x1956a4,_0xbb0e24[_0x026b('0x22')][_0x026b('0x24')]);return _0x4bd1ff(_0xbb0e24['error'][_0x026b('0x24')]);}logger[_0x026b('0x22')](_0x026b('0x1f'),_0x1956a4,_0xbb0e24[_0x026b('0x22')][_0x026b('0x24')]);return _0x5117f3(_0xbb0e24['error'][_0x026b('0x24')]);}else{logger[_0x026b('0x25')](_0x026b('0x1f'),_0x1956a4,_0x026b('0x20'));_0x5117f3(_0xbb0e24[_0x026b('0x26')][_0x026b('0x24')]);}})['catch'](function(_0x4b42b9){logger[_0x026b('0x22')]('SmsMessage,\x20%s,\x20%s',_0x1956a4,_0x4b42b9);_0x4bd1ff(_0x4b42b9);});});}function respondWithStatusCode(_0x27cb59,_0x19b1dc){_0x19b1dc=_0x19b1dc||0xcc;return function(_0x39f344){if(_0x39f344){return _0x27cb59['sendStatus'](_0x19b1dc);}return _0x27cb59['status'](_0x19b1dc)[_0x026b('0x27')]();};}function respondWithResult(_0x3f3999,_0x472191){_0x472191=_0x472191||0xc8;return function(_0x382e51){if(_0x382e51){return _0x3f3999[_0x026b('0x28')](_0x472191)['json'](_0x382e51);}};}function respondWithFilteredResult(_0x2ab365,_0x335463){return function(_0x464667){if(_0x464667){var _0x2bb89f=typeof _0x335463['offset']===_0x026b('0x29')&&typeof _0x335463[_0x026b('0x2a')]==='undefined';var _0x59e9b2=_0x464667[_0x026b('0x2b')];var _0x34fbba=_0x2bb89f?0x0:_0x335463['offset'];var _0x5b9edf=_0x2bb89f?_0x464667['count']:_0x335463[_0x026b('0x2c')]+_0x335463['limit'];var _0x33590f;if(_0x5b9edf>=_0x59e9b2){_0x5b9edf=_0x59e9b2;_0x33590f=0xc8;}else{_0x33590f=0xce;}_0x2ab365[_0x026b('0x28')](_0x33590f);return _0x2ab365[_0x026b('0x2d')](_0x026b('0x2e'),_0x34fbba+'-'+_0x5b9edf+'/'+_0x59e9b2)[_0x026b('0x2f')](_0x464667);}return null;};}function patchUpdates(_0x17bc65){return function(_0x421f43){try{jsonpatch['apply'](_0x421f43,_0x17bc65,!![]);}catch(_0x2d8002){return BPromise[_0x026b('0x30')](_0x2d8002);}return _0x421f43[_0x026b('0x31')]();};}function saveUpdates(_0x5a3781,_0x54df5a){return function(_0x283a18){if(_0x283a18){return _0x283a18[_0x026b('0x32')](_0x5a3781)[_0x026b('0x33')](function(_0x25e02c){return _0x25e02c;});}return null;};}function removeEntity(_0x48fe1c,_0x22d5c6){return function(_0x3ee3dd){if(_0x3ee3dd){return _0x3ee3dd[_0x026b('0x34')]()[_0x026b('0x33')](function(){_0x48fe1c['status'](0xcc)[_0x026b('0x27')]();});}};}function handleEntityNotFound(_0xa3adae,_0x685abe){return function(_0x163dff){if(!_0x163dff){_0xa3adae[_0x026b('0x35')](0x194);}return _0x163dff;};}function handleError(_0xab6df2,_0x862d33){_0x862d33=_0x862d33||0x1f4;return function(_0x339b59){logger[_0x026b('0x22')](_0x339b59['stack']);if(_0x339b59[_0x026b('0x36')]){delete _0x339b59[_0x026b('0x36')];}_0xab6df2[_0x026b('0x28')](_0x862d33)['send'](_0x339b59);};}exports[_0x026b('0x37')]=function(_0x1105cf,_0x3c8d55){var _0x30e072={},_0x27e29d={},_0x400c6f={'count':0x0,'rows':[]};var _0x5bb124=_[_0x026b('0x38')](db[_0x026b('0x39')][_0x026b('0x3a')],function(_0x5811e7){return{'name':_0x5811e7['fieldName'],'type':_0x5811e7[_0x026b('0x3b')]['key']};});_0x27e29d[_0x026b('0x3c')]=_['map'](_0x5bb124,_0x026b('0x36'));_0x27e29d[_0x026b('0x3d')]=_[_0x026b('0x3e')](_0x1105cf[_0x026b('0x3d')]);_0x27e29d['filters']=_[_0x026b('0x3f')](_0x27e29d[_0x026b('0x3c')],_0x27e29d[_0x026b('0x3d')]);_0x30e072[_0x026b('0x40')]=_['intersection'](_0x27e29d[_0x026b('0x3c')],qs[_0x026b('0x41')](_0x1105cf[_0x026b('0x3d')]['fields']));_0x30e072[_0x026b('0x40')]=_0x30e072[_0x026b('0x40')][_0x026b('0x42')]?_0x30e072[_0x026b('0x40')]:_0x27e29d[_0x026b('0x3c')];if(!_0x1105cf[_0x026b('0x3d')][_0x026b('0x43')]('nolimit')){_0x30e072[_0x026b('0x2a')]=qs[_0x026b('0x2a')](_0x1105cf[_0x026b('0x3d')][_0x026b('0x2a')]);_0x30e072[_0x026b('0x2c')]=qs[_0x026b('0x2c')](_0x1105cf[_0x026b('0x3d')]['offset']);}_0x30e072['order']=qs[_0x026b('0x44')](_0x1105cf['query'][_0x026b('0x44')]);_0x30e072['where']=qs[_0x026b('0x45')](_[_0x026b('0x46')](_0x1105cf[_0x026b('0x3d')],_0x27e29d[_0x026b('0x45')]),_0x5bb124);if(_0x1105cf[_0x026b('0x3d')][_0x026b('0x47')]){_0x30e072['where']=_['merge'](_0x30e072[_0x026b('0x48')],{'$or':_[_0x026b('0x38')](_0x5bb124,function(_0x300660){if(_0x300660[_0x026b('0x3b')]!==_0x026b('0x49')){var _0x197847={};_0x197847[_0x300660['name']]={'$like':'%'+_0x1105cf[_0x026b('0x3d')][_0x026b('0x47')]+'%'};return _0x197847;}})});}_0x30e072=_[_0x026b('0x4a')]({},_0x30e072,_0x1105cf[_0x026b('0x4b')]);var _0x4eb458={'where':_0x30e072[_0x026b('0x48')]};return db[_0x026b('0x39')]['count'](_0x4eb458)[_0x026b('0x33')](function(_0x1773eb){_0x400c6f[_0x026b('0x2b')]=_0x1773eb;if(_0x1105cf['query'][_0x026b('0x4c')]){_0x30e072[_0x026b('0x4d')]=[{'all':!![]}];}return db[_0x026b('0x39')][_0x026b('0x4e')](_0x30e072);})[_0x026b('0x33')](function(_0x50ef6f){_0x400c6f[_0x026b('0x4f')]=_0x50ef6f;return _0x400c6f;})[_0x026b('0x33')](respondWithFilteredResult(_0x3c8d55,_0x30e072))[_0x026b('0x50')](handleError(_0x3c8d55,null));};exports['show']=function(_0x43b296,_0x4a3028){var _0x40d424={'raw':!![],'where':{'id':_0x43b296[_0x026b('0x51')]['id']}},_0x2ccc79={};_0x2ccc79[_0x026b('0x3c')]=_[_0x026b('0x3e')](db[_0x026b('0x39')][_0x026b('0x3a')]);_0x2ccc79[_0x026b('0x3d')]=_[_0x026b('0x3e')](_0x43b296[_0x026b('0x3d')]);_0x2ccc79['filters']=_[_0x026b('0x3f')](_0x2ccc79[_0x026b('0x3c')],_0x2ccc79[_0x026b('0x3d')]);_0x40d424['attributes']=_[_0x026b('0x3f')](_0x2ccc79[_0x026b('0x3c')],qs[_0x026b('0x41')](_0x43b296[_0x026b('0x3d')][_0x026b('0x41')]));_0x40d424['attributes']=_0x40d424[_0x026b('0x40')][_0x026b('0x42')]?_0x40d424[_0x026b('0x40')]:_0x2ccc79[_0x026b('0x3c')];if(_0x43b296[_0x026b('0x3d')][_0x026b('0x4c')]){_0x40d424[_0x026b('0x4d')]=[{'all':!![]}];}_0x40d424=_[_0x026b('0x4a')]({},_0x40d424,_0x43b296[_0x026b('0x4b')]);return db[_0x026b('0x39')][_0x026b('0x52')](_0x40d424)['then'](handleEntityNotFound(_0x4a3028,null))[_0x026b('0x33')](respondWithResult(_0x4a3028,null))[_0x026b('0x50')](handleError(_0x4a3028,null));};exports[_0x026b('0x53')]=function(_0x5bb329,_0x495425){return db[_0x026b('0x39')][_0x026b('0x53')](_0x5bb329[_0x026b('0x54')],{})['then'](respondWithResult(_0x495425,0xc9))['catch'](handleError(_0x495425,null));};exports[_0x026b('0x32')]=function(_0x3f8b13,_0xc3bcd0){if(_0x3f8b13[_0x026b('0x54')]['id']){delete _0x3f8b13['body']['id'];}return db[_0x026b('0x39')][_0x026b('0x52')]({'where':{'id':_0x3f8b13['params']['id']}})[_0x026b('0x33')](handleEntityNotFound(_0xc3bcd0,null))[_0x026b('0x33')](saveUpdates(_0x3f8b13[_0x026b('0x54')],null))['then'](respondWithResult(_0xc3bcd0,null))[_0x026b('0x50')](handleError(_0xc3bcd0,null));};exports['destroy']=function(_0x3334e6,_0x416475){return db['SmsMessage'][_0x026b('0x52')]({'where':{'id':_0x3334e6[_0x026b('0x51')]['id']}})['then'](handleEntityNotFound(_0x416475,null))[_0x026b('0x33')](removeEntity(_0x416475,null))[_0x026b('0x50')](handleError(_0x416475,null));};exports['describe']=function(_0x422e38,_0x813477){return db[_0x026b('0x39')]['describe']()[_0x026b('0x33')](respondWithResult(_0x813477,null))[_0x026b('0x50')](handleError(_0x813477,null));};var interaction_log=require(_0x026b('0x12'))(_0x026b('0x55'));exports[_0x026b('0x56')]=function(_0x45b74f,_0x424588,_0x2b64ce){var _0x30a887={'agent':{},'channel':_0x026b('0x57')};if(_0x45b74f[_0x026b('0x54')]['id']){delete _0x45b74f[_0x026b('0x54')]['id'];}_0x45b74f[_0x026b('0x54')][_0x026b('0x58')]=!![];_0x45b74f[_0x026b('0x54')][_0x026b('0x59')]=moment()[_0x026b('0x5a')](_0x026b('0x5b'));_0x45b74f['body']['UserId']=_0x45b74f[_0x026b('0x54')][_0x026b('0x5c')]||_0x45b74f[_0x026b('0x5d')]['id'];_0x30a887[_0x026b('0x5e')]['id']=_0x45b74f[_0x026b('0x54')][_0x026b('0x5c')];return db[_0x026b('0x39')][_0x026b('0x52')]({'where':{'id':_0x45b74f[_0x026b('0x51')]['id'],'UserId':null}})[_0x026b('0x33')](handleEntityNotFound(_0x424588,null))[_0x026b('0x33')](saveUpdates(_0x45b74f['body'],null))[_0x026b('0x33')](function(_0x5e32a1){if(_0x5e32a1){_0x30a887[_0x026b('0x24')]=_0x5e32a1['get']({'plain':!![]});return db[_0x026b('0x5f')][_0x026b('0x52')]({'where':{'id':_0x5e32a1[_0x026b('0x60')]}});}return null;})[_0x026b('0x33')](handleEntityNotFound(_0x424588,null))[_0x026b('0x33')](function(_0x2e8e42){if(_0x2e8e42){return _0x2e8e42[_0x026b('0x32')]({'UserId':_0x45b74f[_0x026b('0x54')][_0x026b('0x5c')],'read1stAt':_[_0x026b('0x61')](_0x2e8e42['read1stAt'])?moment()[_0x026b('0x5a')](_0x026b('0x5b')):undefined});}return null;})['then'](function(_0x391a69){if(_0x391a69){_0x30a887[_0x026b('0x62')]=_0x391a69[_0x026b('0x63')]({'plain':!![]});interaction_log[_0x026b('0x25')](_0x026b('0x64'),_0x45b74f['user']['id'],_0x45b74f[_0x026b('0x5d')]['name'],_0x45b74f[_0x026b('0x5d')]['role'],_0x30a887[_0x026b('0x62')]['id'],_0x45b74f[_0x026b('0x54')]?JSON['stringify'](_0x45b74f[_0x026b('0x54')]):'null');return respondWithRpcPromise(_0x026b('0x65'),_0x026b('0x66'),_0x30a887);}return null;})[_0x026b('0x33')](function(_0x453445){var _0x5c5023=_0x026b('0x67')+_0x453445[_0x026b('0x24')][_0x026b('0x68')];return db[_0x026b('0x69')][_0x026b('0x3d')](_0x5c5023,{'type':db[_0x026b('0x6a')]['QueryTypes'][_0x026b('0x6b')],'raw':!![]})[_0x026b('0x33')](function(_0x119483){return _0x119483;});})[_0x026b('0x33')](function(_0x35baf2){if(_0x35baf2){_0x30a887[_0x026b('0x24')]['contact']=_0x35baf2[0x0];if(!_0x45b74f[_0x026b('0x54')]['UserId'])return;return db[_0x026b('0x6c')][_0x026b('0x52')]({'where':{'id':_0x45b74f['body']['UserId'],'role':_0x026b('0x5e')},'attributes':['id',_0x026b('0x36'),_0x026b('0x6d'),'email',_0x026b('0x6e')],'raw':!![]});}return null;})['then'](function(_0x5b5875){if(!_0x5b5875)return null;_0x30a887['message'][_0x026b('0x5e')]=_0x5b5875;return _0x30a887;})[_0x026b('0x33')](function(_0xd798ac){if(_0xd798ac){if(_0x45b74f[_0x026b('0x54')]['manual']){_0x30a887[_0x026b('0x24')][_0x026b('0x6f')]=util[_0x026b('0x5a')](_0x026b('0x70'),_0x45b74f[_0x026b('0x5d')][_0x026b('0x36')]);_0x30a887['message']['channel']=_0x30a887[_0x026b('0x71')];_0x30a887[_0x026b('0x24')][_0x026b('0x72')]=_0x30a887[_0x026b('0x71')];_0x30a887['message'][_0x026b('0x73')]=_0x026b('0x56');return respondWithRpcPromise(_0x026b('0x74'),_0x026b('0x74'),{'event':_0x026b('0x75'),'message':_0x30a887[_0x026b('0x24')]},client9002)[_0x026b('0x33')](function(){return _0x30a887;});}return _0x30a887;}return null;})[_0x026b('0x33')](respondWithResult(_0x424588,null))[_0x026b('0x50')](handleError(_0x424588,null));};var interaction_log=require('../../config/logger')(_0x026b('0x55'));exports[_0x026b('0x30')]=function(_0x525ea8,_0x52cb12,_0x30d002){var _0x5a5ee3={'agent':{},'channel':'sms'};if(_0x525ea8[_0x026b('0x54')]['id']){delete _0x525ea8[_0x026b('0x54')]['id'];}_0x525ea8[_0x026b('0x54')][_0x026b('0x5c')]=_0x525ea8[_0x026b('0x54')]['UserId']||_0x525ea8['user']['id'];_0x5a5ee3[_0x026b('0x5e')]['id']=_0x525ea8[_0x026b('0x54')]['UserId'];return db[_0x026b('0x39')][_0x026b('0x52')]({'where':{'id':_0x525ea8[_0x026b('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x52cb12,null))[_0x026b('0x33')](function(_0x1c61f2){if(_0x1c61f2){_0x5a5ee3['message']=_0x1c61f2[_0x026b('0x63')]({'plain':!![]});return db[_0x026b('0x5f')][_0x026b('0x52')]({'where':{'id':_0x1c61f2[_0x026b('0x60')]}});}return null;})[_0x026b('0x33')](handleEntityNotFound(_0x52cb12,null))['then'](function(_0x5ec571){if(_0x5ec571){_0x5a5ee3[_0x026b('0x62')]=_0x5ec571[_0x026b('0x63')]({'plain':!![]});interaction_log[_0x026b('0x25')](_0x026b('0x76'),_0x525ea8[_0x026b('0x5d')]['id'],_0x525ea8['user']['name'],_0x525ea8[_0x026b('0x5d')][_0x026b('0x77')],_0x5a5ee3['interaction']['id'],_0x525ea8[_0x026b('0x54')]?JSON['stringify'](_0x525ea8[_0x026b('0x54')]):_0x026b('0x78'));return respondWithRpcPromise(_0x026b('0x79'),_0x026b('0x7a'),_0x5a5ee3);}return null;})[_0x026b('0x33')](function(_0x13883a){var _0x349ff8=_0x026b('0x67')+_0x13883a[_0x026b('0x24')][_0x026b('0x68')];return db[_0x026b('0x69')][_0x026b('0x3d')](_0x349ff8,{'type':db[_0x026b('0x6a')][_0x026b('0x7b')][_0x026b('0x6b')],'raw':!![]})[_0x026b('0x33')](function(_0x14272a){return _0x14272a;});})['then'](function(_0x31a8e8){if(_0x31a8e8){_0x5a5ee3[_0x026b('0x24')][_0x026b('0x7c')]=_0x31a8e8[0x0];if(!_0x525ea8[_0x026b('0x54')][_0x026b('0x5c')])return;return db['User']['find']({'where':{'id':_0x525ea8['body']['UserId'],'role':_0x026b('0x5e')},'attributes':['id',_0x026b('0x36'),_0x026b('0x6d'),_0x026b('0x7d'),_0x026b('0x6e')],'raw':!![]});}return null;})[_0x026b('0x33')](function(_0x31f6f3){if(!_0x31f6f3)return null;_0x5a5ee3[_0x026b('0x24')]['agent']=_0x31f6f3;return _0x5a5ee3;})[_0x026b('0x33')](function(_0x287e03){if(_0x287e03){_0x287e03['message'][_0x026b('0x6f')]=util[_0x026b('0x5a')](_0x026b('0x70'),_0x525ea8['user'][_0x026b('0x36')]);_0x287e03[_0x026b('0x24')][_0x026b('0x71')]=_0x5a5ee3[_0x026b('0x71')];_0x287e03[_0x026b('0x24')][_0x026b('0x72')]=_0x5a5ee3['channel'];_0x287e03[_0x026b('0x24')][_0x026b('0x73')]=_0x026b('0x30');respondWithRpcPromise(_0x026b('0x74'),_0x026b('0x74'),{'event':_0x026b('0x7e'),'message':_0x287e03[_0x026b('0x24')]},client9002);return _0x5a5ee3;}return null;})[_0x026b('0x33')](respondWithResult(_0x52cb12,null))[_0x026b('0x50')](handleError(_0x52cb12,null));};exports[_0x026b('0x28')]=function(_0x578af5,_0x32f151,_0x5a779e){if(_0x578af5[_0x026b('0x54')]['id']){delete _0x578af5[_0x026b('0x54')]['id'];}var _0x269f9c;return db[_0x026b('0x39')][_0x026b('0x52')]({'where':{'id':_0x578af5[_0x026b('0x51')]['id']}})[_0x026b('0x33')](handleEntityNotFound(_0x32f151,null))[_0x026b('0x33')](function(_0x4928eb){if(_0x4928eb){_0x269f9c=_0x4928eb;return db[_0x026b('0x7f')][_0x026b('0x52')]({'where':{'id':_0x4928eb[_0x026b('0x80')]}});}})[_0x026b('0x33')](handleEntityNotFound(_0x32f151,null))[_0x026b('0x33')](function(_0x41722c){if(_0x41722c){logger[_0x026b('0x81')](_0x026b('0x82'),_0x026b('0x28'),'received\x20delivery\x20report\x20from',_0x41722c[_0x026b('0x3b')],util['inspect'](_0x578af5[_0x026b('0x54')],{'showHidden':![],'depth':null}));switch(_0x41722c[_0x026b('0x3b')]){case _0x026b('0x83'):if(_0x578af5['body'][_0x026b('0x84')]&&_0x578af5[_0x026b('0x54')]['MessageSid']===_0x269f9c['messageId']){return _0x269f9c['update']({'read':!![]});}else{logger['error'](_0x026b('0x85'),_0x026b('0x28'),'twilio',util[_0x026b('0x86')](_0x578af5[_0x026b('0x54')],{'showHidden':![],'depth':null}));}break;case _0x026b('0x87'):if(_0x578af5[_0x026b('0x54')][_0x026b('0x88')]&&_0x578af5[_0x026b('0x54')][_0x026b('0x88')]===_0x269f9c[_0x026b('0x89')]&&_[_0x026b('0x8a')]([_0x026b('0x8b'),_0x026b('0x8c')],_0x578af5[_0x026b('0x54')][_0x026b('0x8d')])>=0x0){return _0x269f9c[_0x026b('0x32')]({'read':!![]});}else{logger['error'](_0x026b('0x85'),_0x026b('0x28'),_0x026b('0x8e'),util[_0x026b('0x86')](_0x578af5['body'],{'showHidden':![],'depth':null}));}break;case _0x026b('0x8f'):var _0x6d4d2a=_0x578af5[_0x026b('0x54')][_0x026b('0x90')][0x0];if(_0x6d4d2a[_0x026b('0x28')][_0x026b('0x91')]==='DELIVERED'){return _0x269f9c[_0x026b('0x32')]({'read':!![]});}else{logger[_0x026b('0x22')](_0x026b('0x85'),_0x026b('0x28'),_0x026b('0x8f'),util[_0x026b('0x86')](_0x578af5[_0x026b('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x269f9c;}})['then'](respondWithResult(_0x32f151,null))[_0x026b('0x50')](handleError(_0x32f151,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index ae61b54..31951f9 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 _0x93ad=['remove','hasOwnProperty','hook','exports','events','../../mysqldb','save','update'];(function(_0x284506,_0x191316){var _0x1e9ee5=function(_0xe7eaa){while(--_0xe7eaa){_0x284506['push'](_0x284506['shift']());}};_0x1e9ee5(++_0x191316);}(_0x93ad,0x1f4));var _0xd93a=function(_0x33d63e,_0x3268e5){_0x33d63e=_0x33d63e-0x0;var _0x30ed75=_0x93ad[_0x33d63e];return _0x30ed75;};'use strict';var EventEmitter=require(_0xd93a('0x0'));var SmsMessage=require(_0xd93a('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd93a('0x2'),'afterUpdate':_0xd93a('0x3'),'afterDestroy':_0xd93a('0x4')};function emitEvent(_0x46b814){return function(_0x366ea0,_0x3661c2,_0x38de49){SmsMessageEvents['emit'](_0x46b814+':'+_0x366ea0['id'],_0x366ea0);SmsMessageEvents['emit'](_0x46b814,_0x366ea0);_0x38de49(null);};}for(var e in events){if(events[_0xd93a('0x5')](e)){var event=events[e];SmsMessage[_0xd93a('0x6')](e,emitEvent(event));}}module[_0xd93a('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0x5c25=['save','remove','emit','exports','events','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0x230bf9,_0x4bfdeb){var _0x292b54=function(_0x40b38d){while(--_0x40b38d){_0x230bf9['push'](_0x230bf9['shift']());}};_0x292b54(++_0x4bfdeb);}(_0x5c25,0x84));var _0x55c2=function(_0x44399a,_0x28e41e){_0x44399a=_0x44399a-0x0;var _0x55e5c2=_0x5c25[_0x44399a];return _0x55e5c2;};'use strict';var EventEmitter=require(_0x55c2('0x0'));var SmsMessage=require(_0x55c2('0x1'))['db'][_0x55c2('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x55c2('0x3')](0x0);var events={'afterCreate':_0x55c2('0x4'),'afterUpdate':'update','afterDestroy':_0x55c2('0x5')};function emitEvent(_0x523d89){return function(_0x416227,_0x23d13f,_0x441725){SmsMessageEvents[_0x55c2('0x6')](_0x523d89+':'+_0x416227['id'],_0x416227);SmsMessageEvents[_0x55c2('0x6')](_0x523d89,_0x416227);_0x441725(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x55c2('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index c24e4e3..6d4aa9d 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 _0xbac2=['out','secret','UserId','isNil','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','messages','phone','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','&password=','password','GET','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','catch','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','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','remote','/api/sms/messages/','/status?token=','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','Missing\x20parameters:\x20username,\x20password','csc','crypto','apiKey','login','text','timestamp','keys','sort','createHash','md5','digest','hex','signature=','/external/get/send.php?','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','bandwidth','accountId','/messages','applicationId','intelepeer','Bearer\x20','code','message','refid','status','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xbac2,0x67));var _0x2bac=function(_0x4664db,_0x1de672){_0x4664db=_0x4664db-0x0;var _0x5615b4=_0xbac2[_0x4664db];return _0x5615b4;};'use strict';var _=require(_0x2bac('0x0'));var util=require(_0x2bac('0x1'));var logger=require(_0x2bac('0x2'))(_0x2bac('0x3'));var moment=require(_0x2bac('0x4'));var BPromise=require(_0x2bac('0x5'));var rp=require(_0x2bac('0x6'));var fs=require('fs');var path=require(_0x2bac('0x7'));var rimraf=require(_0x2bac('0x8'));var config=require(_0x2bac('0x9'));var attributes=require(_0x2bac('0xa'));module[_0x2bac('0xb')]=function(_0x5af138,_0x4a1c2e){return _0x5af138[_0x2bac('0xc')](_0x2bac('0xd'),attributes,{'tableName':_0x2bac('0xe'),'paranoid':![],'indexes':[{'name':_0x2bac('0xf'),'fields':['messageId']},{'name':_0x2bac('0x10'),'fields':[_0x2bac('0x11')],'type':_0x2bac('0x12')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2c8fca,_0x1e3cc7,_0x4ef652){var _0x2b7b51=_0x5af138[_0x2bac('0x13')];var _0x2372b1=_0x2c8fca[_0x2bac('0x14')]({'plain':!![]});if(_0x2372b1[_0x2bac('0x15')]['toLowerCase']()==='in'||_0x2372b1[_0x2bac('0x15')][_0x2bac('0x16')]()===_0x2bac('0x17')&&!_0x2372b1[_0x2bac('0x18')]&&!_['isNil'](_0x2372b1[_0x2bac('0x19')])&&!_[_0x2bac('0x1a')](_0x2372b1['SmsInteractionId'])){_0x2b7b51[_0x2bac('0x1b')][_0x2bac('0x1c')]({'where':{'id':_0x2372b1[_0x2bac('0x1d')]}})[_0x2bac('0x1e')](function(_0x4661b){if(_0x4661b){_0x4661b[_0x2bac('0x1f')]({'lastMsgAt':_0x2372b1[_0x2bac('0x20')],'lastMsgDirection':_0x2372b1['direction'][_0x2bac('0x16')]()});}})['catch'](function(_0x1deb49){console[_0x2bac('0x21')](_0x1deb49);});}if(_0x2372b1[_0x2bac('0x15')]===_0x2bac('0x17')&&!_0x2372b1[_0x2bac('0x18')]){var _0x16ae03;_0x2b7b51[_0x2bac('0x22')][_0x2bac('0x23')]({'where':{'id':_0x2372b1[_0x2bac('0x24')]},'raw':!![]})[_0x2bac('0x1e')](function(_0x31578c){_0x16ae03=_0x31578c;if(_0x16ae03&&_0x16ae03[_0x2bac('0x25')]){switch(_0x16ae03[_0x2bac('0x25')]){case _0x2bac('0x26'):var _0x464754=require(_0x2bac('0x26'));if(_0x16ae03[_0x2bac('0x27')]&&_0x16ae03['authToken']&&_0x16ae03['phone']){var _0x8d0d28=new _0x464754(_0x16ae03[_0x2bac('0x27')],_0x16ae03[_0x2bac('0x28')]);_0x8d0d28[_0x2bac('0x29')]['create']({'body':_0x2372b1[_0x2bac('0x11')],'to':_0x2372b1['phone'],'from':_0x16ae03[_0x2bac('0x2a')],'statusCallback':_0x16ae03['remote']+'/api/sms/messages/'+_0x2372b1['id']+'/status?token='+_0x16ae03[_0x2bac('0x2b')]})['then'](function(_0x5c664e){if(_0x5c664e[_0x2bac('0x2c')]){return _0x2c8fca[_0x2bac('0x1f')]({'messageId':_0x5c664e[_0x2bac('0x2c')]});}})['catch'](function(_0x396b40){logger['error'](_0x2bac('0x2d'),'afterCreate','twilio',util[_0x2bac('0x2e')](_0x396b40,{'showHidden':![],'depth':null}));});}else{logger[_0x2bac('0x21')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2bac('0x2f'),'twilio',_0x2bac('0x30'));}break;case _0x2bac('0x31'):var _0x22856d=_0x2bac('0x32');if(_0x16ae03[_0x2bac('0x33')]&&_0x16ae03['password']){var _0x56e888={'recipient':[_0x2372b1[_0x2bac('0x2a')]],'message':_0x2372b1['body'],'message_type':_0x16ae03['smsMethod']};if(_0x16ae03[_0x2bac('0x34')]&&_0x16ae03[_0x2bac('0x34')]!=='SI'){_0x56e888[_0x2bac('0x35')]=_0x16ae03['phone'];}var _0x3c5d42={'url':_0x22856d+'login?username='+_0x16ae03[_0x2bac('0x33')]+_0x2bac('0x36')+_0x16ae03[_0x2bac('0x37')],'method':_0x2bac('0x38')};rp(_0x3c5d42)['then'](function(_0x45c0e9){var _0x373503=_0x45c0e9[_0x2bac('0x39')](';');var _0x33f217={'user_key':_0x373503[0x0],'session_key':_0x373503[0x1]};_0x3c5d42={'url':_0x22856d+_0x2bac('0x3a'),'method':_0x2bac('0x3b'),'headers':{'user_key':_0x33f217[_0x2bac('0x3c')],'Session_key':_0x33f217[_0x2bac('0x3d')]},'json':!![],'body':_0x56e888};return rp(_0x3c5d42);})['then'](function(_0x4b124f){if(_0x4b124f[_0x2bac('0x3e')]>=0x1){var _0x405dff={'messageId':_0x4b124f[_0x2bac('0x3f')]};if(_0x16ae03[_0x2bac('0x34')]!=='GP'||!_0x16ae03[_0x2bac('0x40')]){_0x405dff[_0x2bac('0x41')]=!![];}return _0x2c8fca[_0x2bac('0x1f')](_0x405dff);}else{return logger[_0x2bac('0x21')](_0x2bac('0x2d'),_0x2bac('0x2f'),_0x2bac('0x31'),util['inspect'](_0x4b124f,{'showHidden':![],'depth':null}));}})[_0x2bac('0x42')](function(_0x17adb6){return logger[_0x2bac('0x21')](_0x2bac('0x2d'),_0x2bac('0x2f'),'skebby',util['inspect'](_0x17adb6,{'showHidden':![],'depth':null}));});}else{logger[_0x2bac('0x21')](_0x2bac('0x2d'),'afterCreate','skebby','Missing\x20parameters:\x20username,\x20password');}break;case _0x2bac('0x43'):if(_0x16ae03['authToken']){var _0x1a79cc={'recipient':_0x2372b1[_0x2bac('0x2a')],'message':_0x2372b1[_0x2bac('0x11')],'sender':_0x16ae03[_0x2bac('0x44')]||_0x16ae03[_0x2bac('0x2a')],'authorization':_0x16ae03[_0x2bac('0x28')]};var _0x1e3cc7={'method':_0x2bac('0x3b'),'uri':_0x2bac('0x45'),'body':_0x1a79cc,'json':!![]};rp(_0x1e3cc7)[_0x2bac('0x1e')](function(_0x2d6864){var _0x38e49e={'messageId':_0x2d6864[_0x2bac('0x46')]};if(!_0x16ae03[_0x2bac('0x40')]){_0x38e49e[_0x2bac('0x41')]=!![];}return _0x2c8fca['update'](_0x38e49e);})[_0x2bac('0x42')](function(_0x4fabaf){logger[_0x2bac('0x21')](_0x2bac('0x2d'),_0x2bac('0x2f'),_0x2bac('0x43'),util[_0x2bac('0x2e')](_0x4fabaf,{'showHidden':![],'depth':null}));});}else{logger[_0x2bac('0x21')](_0x2bac('0x2d'),'afterCreate','connectel',_0x2bac('0x47'));}break;case'clicksend':if(_0x16ae03['username']&&_0x16ae03[_0x2bac('0x37')]){var _0x1a79cc={'messages':[{'source':_0x2bac('0x48'),'to':_0x2372b1['phone'],'body':_0x2372b1[_0x2bac('0x11')],'from':_0x16ae03[_0x2bac('0x44')]||_0x16ae03[_0x2bac('0x2a')]}]};var _0x4d3c61=util[_0x2bac('0x49')](_0x2bac('0x4a'),_0x16ae03[_0x2bac('0x33')],_0x16ae03[_0x2bac('0x37')]);var _0x1e3cc7={'method':_0x2bac('0x3b'),'uri':_0x2bac('0x4b'),'body':_0x1a79cc,'headers':{'Authorization':util[_0x2bac('0x49')](_0x2bac('0x4c'),new Buffer(_0x4d3c61)[_0x2bac('0x4d')](_0x2bac('0x4e')))},'json':!![]};rp(_0x1e3cc7)['then'](function(_0x357d30){if(_0x357d30[_0x2bac('0x4f')]>=0xc8&&_0x357d30[_0x2bac('0x4f')]<=0xce){if(_0x357d30[_0x2bac('0x50')]&&_0x357d30[_0x2bac('0x50')][_0x2bac('0x51')]>0x0){var _0x1ae0a6=_['head'](_0x357d30['data'][_0x2bac('0x29')]);var _0x2bdb0d={'messageId':_0x1ae0a6[_0x2bac('0x52')]};if(!_0x16ae03['deliveryReport']){_0x2bdb0d['read']=!![];}return _0x2c8fca[_0x2bac('0x1f')](_0x2bdb0d);}else{logger[_0x2bac('0x21')](_0x2bac('0x2d'),_0x2bac('0x2f'),_0x2bac('0x53'),util[_0x2bac('0x2e')](_0x357d30,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x2bac('0x2d'),_0x2bac('0x2f'),'clickSend',util['inspect'](_0x357d30,{'showHidden':![],'depth':null}));}})[_0x2bac('0x42')](function(_0x653213){logger[_0x2bac('0x21')](_0x2bac('0x2d'),'afterCreate',_0x2bac('0x53'),util[_0x2bac('0x2e')](_0x653213,{'showHidden':![],'depth':null}));});}else{logger[_0x2bac('0x21')](_0x2bac('0x2d'),_0x2bac('0x2f'),_0x2bac('0x53'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x2bac('0x54'):if(_0x16ae03[_0x2bac('0x55')]&&_0x16ae03[_0x2bac('0x28')]){var _0x1a79cc={'dst':_0x2372b1[_0x2bac('0x2a')],'text':_0x2372b1[_0x2bac('0x11')],'src':_0x16ae03[_0x2bac('0x44')]||_0x16ae03[_0x2bac('0x2a')],'url':_0x16ae03[_0x2bac('0x56')]+_0x2bac('0x57')+_0x2372b1['id']+_0x2bac('0x58')+_0x16ae03[_0x2bac('0x2b')]};var _0x4d3c61=util[_0x2bac('0x49')](_0x2bac('0x4a'),_0x16ae03[_0x2bac('0x55')],_0x16ae03['authToken']);var _0x1e3cc7={'method':'POST','uri':util[_0x2bac('0x49')]('https://api.plivo.com/v1/Account/%s/Message/',_0x16ae03[_0x2bac('0x55')]),'body':_0x1a79cc,'headers':{'Authorization':util[_0x2bac('0x49')](_0x2bac('0x4c'),new Buffer(_0x4d3c61)[_0x2bac('0x4d')](_0x2bac('0x4e')))},'json':!![]};rp(_0x1e3cc7)['then'](function(_0x5948b4){var _0xd6d770={'messageId':_0x5948b4['message_uuid'][0x0]};return _0x2c8fca[_0x2bac('0x1f')](_0xd6d770);})[_0x2bac('0x42')](function(_0x5d170d){logger[_0x2bac('0x21')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2bac('0x2f'),_0x2bac('0x54'),util[_0x2bac('0x2e')](_0x5d170d,{'showHidden':![],'depth':null}));});}else{logger[_0x2bac('0x21')](_0x2bac('0x2d'),'afterCreate',_0x2bac('0x54'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x2bac('0x59'):if(_0x16ae03[_0x2bac('0x33')]&&_0x16ae03['password']){if(_0x16ae03[_0x2bac('0x5a')]){var _0x4a0d49={'method':'POST','uri':_0x16ae03['baseUrl']+_0x2bac('0x5b'),'body':{'username':_0x16ae03['username'],'password':_0x16ae03[_0x2bac('0x37')]},'json':!![]};return rp(_0x4a0d49)['then'](function(_0x4a7f8c){var _0x8d5561={'method':_0x2bac('0x3b'),'uri':_0x16ae03[_0x2bac('0x5a')]+_0x2bac('0x5c'),'body':{'messages':[{'from':_0x16ae03['phone'],'destinations':[{'to':_0x2372b1[_0x2bac('0x2a')]}],'text':_0x2372b1[_0x2bac('0x11')],'notifyUrl':_0x16ae03[_0x2bac('0x56')]+_0x2bac('0x57')+_0x2372b1['id']+'/status?token='+_0x16ae03[_0x2bac('0x2b')],'notifyContentType':_0x2bac('0x5d'),'callbackData':_0x16ae03['phone']+';'+_0x2372b1[_0x2bac('0x11')]}]},'headers':{'Authorization':_0x2bac('0x5e')+_0x4a7f8c[_0x2bac('0x2b')]},'json':!![]};return rp(_0x8d5561)[_0x2bac('0x1e')](function(_0x4cd197){if(_0x4cd197['messages']){var _0x39ff0b={'messageId':_0x4cd197[_0x2bac('0x29')][0x0][_0x2bac('0xf')]};if(!_0x16ae03[_0x2bac('0x40')]){_0x39ff0b['read']=!![];}return _0x2c8fca[_0x2bac('0x1f')](_0x39ff0b);}else{return logger[_0x2bac('0x21')](_0x2bac('0x2d'),_0x2bac('0x2f'),_0x2bac('0x59'),util[_0x2bac('0x2e')](_0x4cd197,{'showHidden':![],'depth':null}));}});})[_0x2bac('0x42')](function(_0x7fef72){return logger[_0x2bac('0x21')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','infobip',util[_0x2bac('0x2e')](_0x7fef72,{'showHidden':![],'depth':null}));});}else{logger[_0x2bac('0x21')](_0x2bac('0x2d'),_0x2bac('0x2f'),_0x2bac('0x59'),_0x2bac('0x5f'));}}else{logger[_0x2bac('0x21')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x2bac('0x59'),_0x2bac('0x60'));}break;case _0x2bac('0x61'):var _0x2e060b=require(_0x2bac('0x62'));if(_0x16ae03[_0x2bac('0x63')]){var _0x5576f2={};_0x5576f2[_0x2bac('0x64')]=_0x16ae03[_0x2bac('0x33')];_0x5576f2[_0x2bac('0x2a')]=_0x2372b1[_0x2bac('0x2a')];_0x5576f2[_0x2bac('0x35')]=_0x16ae03['phone'];_0x5576f2[_0x2bac('0x65')]=_0x2372b1[_0x2bac('0x11')];_0x5576f2[_0x2bac('0x66')]=+new Date();var _0x2160f2='';var _0x282412='';var _0x498bb6=Object[_0x2bac('0x67')](_0x5576f2);_0x498bb6[_0x2bac('0x68')]();for(var _0x837352=0x0;_0x837352<_0x498bb6['length'];_0x837352++){if(_0x2160f2!=''){_0x2160f2+='&';}_0x2160f2+=_0x498bb6[_0x837352]+'='+encodeURIComponent(_0x5576f2[_0x498bb6[_0x837352]]);_0x282412+=_0x5576f2[_0x498bb6[_0x837352]];}_0x282412+=_0x16ae03['apiKey'];_0x282412=_0x2e060b[_0x2bac('0x69')](_0x2bac('0x6a'))['update'](_0x282412)[_0x2bac('0x6b')](_0x2bac('0x6c'));if(_0x2160f2!==''){_0x2160f2+='&';}_0x2160f2+=_0x2bac('0x6d')+_0x282412;var _0x3c5d42={'method':_0x2bac('0x38'),'uri':_0x16ae03[_0x2bac('0x5a')]+_0x2bac('0x6e')+_0x2160f2,'json':!![]};return rp(_0x3c5d42)[_0x2bac('0x1e')](function(_0x45ff17){var _0x4027a2=Object[_0x2bac('0x67')](_0x45ff17);if(_0x45ff17[_0x4027a2[0x0]][_0x2bac('0x21')]&&parseInt(_0x45ff17[_0x4027a2[0x0]][_0x2bac('0x21')])===0x0){var _0x25f8fa={'messageId':_0x45ff17[_0x4027a2[0x0]]['id_sms']};if(!_0x16ae03[_0x2bac('0x40')]){_0x25f8fa[_0x2bac('0x41')]=!![];}return _0x2c8fca[_0x2bac('0x1f')](_0x25f8fa);}else{return logger[_0x2bac('0x21')](_0x2bac('0x2d'),'afterCreate',_0x2bac('0x61'),util[_0x2bac('0x2e')](_0x45ff17['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0xf2e6a2){return logger[_0x2bac('0x21')](_0x2bac('0x2d'),'afterCreate',_0x2bac('0x61'),util[_0x2bac('0x2e')](_0xf2e6a2,{'showHidden':![],'depth':null}));});}else{logger[_0x2bac('0x21')](_0x2bac('0x2d'),'afterCreate',_0x2bac('0x61'),_0x2bac('0x6f'));}break;case _0x2bac('0x70'):if(_0x16ae03[_0x2bac('0x63')]){var _0x4b21a7={'method':_0x2bac('0x3b'),'uri':_0x2bac('0x71'),'headers':{'Authorization':_0x16ae03[_0x2bac('0x63')]},'body':{'content':_0x2372b1[_0x2bac('0x11')],'to':[_0x2372b1[_0x2bac('0x2a')]],'from':_0x16ae03[_0x2bac('0x2a')],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0x4b21a7)[_0x2bac('0x1e')](function(_0x2a490d){if(!_0x2a490d[_0x2bac('0x21')]){var _0x3992d2={'messageId':_0x2a490d[_0x2bac('0x29')][0x0]['apiMessageId']};if(!_0x16ae03['deliveryReport']){_0x3992d2['read']=!![];}return _0x2c8fca[_0x2bac('0x1f')](_0x3992d2);}else{return logger[_0x2bac('0x21')](_0x2bac('0x2d'),_0x2bac('0x2f'),_0x2bac('0x70'),util[_0x2bac('0x2e')](_0x2a490d[_0x2bac('0x21')],{'showHidden':![],'depth':null}));}})[_0x2bac('0x42')](function(_0x443dd9){return logger[_0x2bac('0x21')](_0x2bac('0x2d'),_0x2bac('0x2f'),_0x2bac('0x70'),util[_0x2bac('0x2e')](_0x443dd9,{'showHidden':![],'depth':null}));});}else{logger[_0x2bac('0x21')](_0x2bac('0x2d'),_0x2bac('0x2f'),'clickatell',_0x2bac('0x6f'));}break;case _0x2bac('0x72'):if(_0x16ae03[_0x2bac('0x33')]&&_0x16ae03['password']){var _0x4d3c61=util[_0x2bac('0x49')](_0x2bac('0x4a'),_0x16ae03[_0x2bac('0x33')],_0x16ae03['password']);var _0x1e3cc7={'method':_0x2bac('0x3b'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x16ae03[_0x2bac('0x73')]+_0x2bac('0x74'),'body':{'to':[_0x2372b1[_0x2bac('0x2a')]],'text':_0x2372b1[_0x2bac('0x11')],'from':_0x16ae03['phone'],'applicationId':_0x16ae03[_0x2bac('0x75')]},'headers':{'Authorization':util['format'](_0x2bac('0x4c'),new Buffer(_0x4d3c61)[_0x2bac('0x4d')](_0x2bac('0x4e')))},'json':!![]};rp(_0x1e3cc7)[_0x2bac('0x1e')](function(_0x39df22){if(_0x39df22['id']){var _0x38a211={'messageId':_0x39df22['id']};return _0x2c8fca['update'](_0x38a211);}else{logger[_0x2bac('0x21')](_0x2bac('0x2d'),'afterCreate',_0x2bac('0x72'),util['inspect'](_0x39df22,{'showHidden':![],'depth':null}));}})['catch'](function(_0x21d903){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','bandwidth',util[_0x2bac('0x2e')](_0x21d903,{'showHidden':![],'depth':null}));});}else{logger[_0x2bac('0x21')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2bac('0x2f'),'bandwidth','Missing\x20parameters:\x20username,\x20password');}break;case _0x2bac('0x76'):if(_0x16ae03[_0x2bac('0x63')]){var _0x26bdef={};var _0x3c5d42={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x2bac('0x77')+_0x16ae03[_0x2bac('0x63')],'Content-Type':_0x2bac('0x5d')},'body':{'from':_0x16ae03[_0x2bac('0x2a')],'to':_0x2372b1['phone'],'text':_0x2372b1[_0x2bac('0x11')]},'json':!![]};return rp(_0x3c5d42)[_0x2bac('0x1e')](function(_0x55b55d){if(_0x55b55d[_0x2bac('0x78')]==0xca){_0x26bdef[_0x2bac('0x79')]=_0x55b55d;var _0x1c9198={'method':_0x2bac('0x3b'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':'Bearer\x20'+_0x16ae03[_0x2bac('0x63')],'Content-Type':'application/json'},'body':{'refid':_0x26bdef[_0x2bac('0x79')][_0x2bac('0x7a')]},'json':!![]};return rp(_0x1c9198)[_0x2bac('0x1e')](function(_0x131c09){_0x26bdef[_0x2bac('0x7b')]=_0x131c09;var _0x4a0c8d={'messageId':_0x26bdef[_0x2bac('0x79')][_0x2bac('0x7a')],'read':!![]};return _0x2c8fca['update'](_0x4a0c8d);});}else{return logger[_0x2bac('0x21')](_0x2bac('0x2d'),_0x2bac('0x2f'),_0x2bac('0x76'),util[_0x2bac('0x2e')](_0x55b55d,{'showHidden':![],'depth':null}));}})['catch'](function(_0x18f559){return logger[_0x2bac('0x21')](_0x2bac('0x2d'),_0x2bac('0x2f'),_0x2bac('0x76'),util[_0x2bac('0x2e')](_0x18f559,{'showHidden':![],'depth':null}));});}else{return logger[_0x2bac('0x21')](_0x2bac('0x2d'),_0x2bac('0x2f'),'intelepeer','Token\x20not\x20received');}break;}}})[_0x2bac('0x7c')](function(){_0x4ef652();});}else{_0x4ef652();}}},'charset':'utf8mb4','collate':_0x2bac('0x7d')});}; \ No newline at end of file +var _0x1a0f=['head','message_id','clickSend','plivo','https://api.plivo.com/v1/Account/%s/Message/','toString','base64','message_uuid','infobip','baseUrl','application/json','IBSSO\x20','csc','apiKey','login','text','timestamp','sort','length','createHash','md5','digest','hex','signature=','/external/get/send.php?','keys','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid','UTF-8','apiMessageId','bandwidth','/messages','applicationId','intelepeer','Bearer\x20','code','message','refid','Token\x20not\x20received','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','direction','toLowerCase','out','isNil','UserId','SmsInteractionId','SmsInteraction','then','update','createdAt','error','secret','SmsAccount','find','type','twilio','accountSid','authToken','phone','messages','remote','/api/sms/messages/','/status?token=','token','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','&password=','GET','split','sms','POST','user_key','session_key','total_sent','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','%s:%s','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','http_code','data','queued_count'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x1a0f,0xa3));var _0xf1a0=function(_0x310832,_0xe72c7e){_0x310832=_0x310832-0x0;var _0x103f74=_0x1a0f[_0x310832];return _0x103f74;};'use strict';var _=require(_0xf1a0('0x0'));var util=require(_0xf1a0('0x1'));var logger=require(_0xf1a0('0x2'))(_0xf1a0('0x3'));var moment=require(_0xf1a0('0x4'));var BPromise=require(_0xf1a0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf1a0('0x6'));var rimraf=require(_0xf1a0('0x7'));var config=require(_0xf1a0('0x8'));var attributes=require(_0xf1a0('0x9'));module[_0xf1a0('0xa')]=function(_0x490fc9,_0x5d8bd8){return _0x490fc9[_0xf1a0('0xb')](_0xf1a0('0xc'),attributes,{'tableName':_0xf1a0('0xd'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xf1a0('0xe')]},{'name':_0xf1a0('0xf'),'fields':[_0xf1a0('0x10')],'type':_0xf1a0('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x105cc5,_0x56b9cd,_0x359681){var _0x459701=_0x490fc9['models'];var _0x3bcf1d=_0x105cc5['get']({'plain':!![]});if(_0x3bcf1d[_0xf1a0('0x12')][_0xf1a0('0x13')]()==='in'||_0x3bcf1d['direction']['toLowerCase']()===_0xf1a0('0x14')&&!_0x3bcf1d['secret']&&!_[_0xf1a0('0x15')](_0x3bcf1d[_0xf1a0('0x16')])&&!_[_0xf1a0('0x15')](_0x3bcf1d[_0xf1a0('0x17')])){_0x459701[_0xf1a0('0x18')]['findOne']({'where':{'id':_0x3bcf1d[_0xf1a0('0x17')]}})[_0xf1a0('0x19')](function(_0x13e034){if(_0x13e034){_0x13e034[_0xf1a0('0x1a')]({'lastMsgAt':_0x3bcf1d[_0xf1a0('0x1b')],'lastMsgDirection':_0x3bcf1d[_0xf1a0('0x12')][_0xf1a0('0x13')]()});}})['catch'](function(_0x2d5561){console[_0xf1a0('0x1c')](_0x2d5561);});}if(_0x3bcf1d['direction']===_0xf1a0('0x14')&&!_0x3bcf1d[_0xf1a0('0x1d')]){var _0x6152fa;_0x459701[_0xf1a0('0x1e')][_0xf1a0('0x1f')]({'where':{'id':_0x3bcf1d['SmsAccountId']},'raw':!![]})[_0xf1a0('0x19')](function(_0x51c2f8){_0x6152fa=_0x51c2f8;if(_0x6152fa&&_0x6152fa[_0xf1a0('0x20')]){switch(_0x6152fa[_0xf1a0('0x20')]){case _0xf1a0('0x21'):var _0xae8622=require(_0xf1a0('0x21'));if(_0x6152fa[_0xf1a0('0x22')]&&_0x6152fa[_0xf1a0('0x23')]&&_0x6152fa[_0xf1a0('0x24')]){var _0x2e55d5=new _0xae8622(_0x6152fa['accountSid'],_0x6152fa['authToken']);_0x2e55d5[_0xf1a0('0x25')]['create']({'body':_0x3bcf1d[_0xf1a0('0x10')],'to':_0x3bcf1d[_0xf1a0('0x24')],'from':_0x6152fa[_0xf1a0('0x24')],'statusCallback':_0x6152fa[_0xf1a0('0x26')]+_0xf1a0('0x27')+_0x3bcf1d['id']+_0xf1a0('0x28')+_0x6152fa[_0xf1a0('0x29')]})[_0xf1a0('0x19')](function(_0x1f510d){if(_0x1f510d[_0xf1a0('0x2a')]){return _0x105cc5['update']({'messageId':_0x1f510d['sid']});}})[_0xf1a0('0x2b')](function(_0x543f51){logger['error'](_0xf1a0('0x2c'),_0xf1a0('0x2d'),_0xf1a0('0x21'),util[_0xf1a0('0x2e')](_0x543f51,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf1a0('0x2c'),'afterCreate',_0xf1a0('0x21'),_0xf1a0('0x2f'));}break;case _0xf1a0('0x30'):var _0x3963af=_0xf1a0('0x31');if(_0x6152fa[_0xf1a0('0x32')]&&_0x6152fa[_0xf1a0('0x33')]){var _0x3cd9de={'recipient':[_0x3bcf1d['phone']],'message':_0x3bcf1d[_0xf1a0('0x10')],'message_type':_0x6152fa[_0xf1a0('0x34')]};if(_0x6152fa[_0xf1a0('0x34')]&&_0x6152fa[_0xf1a0('0x34')]!=='SI'){_0x3cd9de[_0xf1a0('0x35')]=_0x6152fa[_0xf1a0('0x24')];}var _0x3c8454={'url':_0x3963af+'login?username='+_0x6152fa[_0xf1a0('0x32')]+_0xf1a0('0x36')+_0x6152fa[_0xf1a0('0x33')],'method':_0xf1a0('0x37')};rp(_0x3c8454)['then'](function(_0x4c4551){var _0x3dd3cd=_0x4c4551[_0xf1a0('0x38')](';');var _0x30380d={'user_key':_0x3dd3cd[0x0],'session_key':_0x3dd3cd[0x1]};_0x3c8454={'url':_0x3963af+_0xf1a0('0x39'),'method':_0xf1a0('0x3a'),'headers':{'user_key':_0x30380d[_0xf1a0('0x3b')],'Session_key':_0x30380d[_0xf1a0('0x3c')]},'json':!![],'body':_0x3cd9de};return rp(_0x3c8454);})[_0xf1a0('0x19')](function(_0x46e0e9){if(_0x46e0e9[_0xf1a0('0x3d')]>=0x1){var _0x33d6bf={'messageId':_0x46e0e9['internal_order_id']};if(_0x6152fa[_0xf1a0('0x34')]!=='GP'||!_0x6152fa[_0xf1a0('0x3e')]){_0x33d6bf[_0xf1a0('0x3f')]=!![];}return _0x105cc5[_0xf1a0('0x1a')](_0x33d6bf);}else{return logger[_0xf1a0('0x1c')](_0xf1a0('0x2c'),'afterCreate','skebby',util[_0xf1a0('0x2e')](_0x46e0e9,{'showHidden':![],'depth':null}));}})[_0xf1a0('0x2b')](function(_0x366e0e){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf1a0('0x2d'),_0xf1a0('0x30'),util['inspect'](_0x366e0e,{'showHidden':![],'depth':null}));});}else{logger[_0xf1a0('0x1c')](_0xf1a0('0x2c'),'afterCreate',_0xf1a0('0x30'),_0xf1a0('0x40'));}break;case _0xf1a0('0x41'):if(_0x6152fa[_0xf1a0('0x23')]){var _0x5c214d={'recipient':_0x3bcf1d[_0xf1a0('0x24')],'message':_0x3bcf1d['body'],'sender':_0x6152fa[_0xf1a0('0x42')]||_0x6152fa[_0xf1a0('0x24')],'authorization':_0x6152fa[_0xf1a0('0x23')]};var _0x56b9cd={'method':_0xf1a0('0x3a'),'uri':_0xf1a0('0x43'),'body':_0x5c214d,'json':!![]};rp(_0x56b9cd)[_0xf1a0('0x19')](function(_0x498873){var _0x3a506e={'messageId':_0x498873[_0xf1a0('0x44')]};if(!_0x6152fa[_0xf1a0('0x3e')]){_0x3a506e[_0xf1a0('0x3f')]=!![];}return _0x105cc5[_0xf1a0('0x1a')](_0x3a506e);})['catch'](function(_0x312642){logger[_0xf1a0('0x1c')](_0xf1a0('0x2c'),_0xf1a0('0x2d'),'connectel',util[_0xf1a0('0x2e')](_0x312642,{'showHidden':![],'depth':null}));});}else{logger[_0xf1a0('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf1a0('0x2d'),'connectel',_0xf1a0('0x45'));}break;case'clicksend':if(_0x6152fa[_0xf1a0('0x32')]&&_0x6152fa[_0xf1a0('0x33')]){var _0x5c214d={'messages':[{'source':'xCALLY\x20Motion','to':_0x3bcf1d[_0xf1a0('0x24')],'body':_0x3bcf1d[_0xf1a0('0x10')],'from':_0x6152fa[_0xf1a0('0x42')]||_0x6152fa[_0xf1a0('0x24')]}]};var _0x438cca=util['format'](_0xf1a0('0x46'),_0x6152fa['username'],_0x6152fa['password']);var _0x56b9cd={'method':_0xf1a0('0x3a'),'uri':_0xf1a0('0x47'),'body':_0x5c214d,'headers':{'Authorization':util[_0xf1a0('0x48')](_0xf1a0('0x49'),new Buffer(_0x438cca)['toString']('base64'))},'json':!![]};rp(_0x56b9cd)[_0xf1a0('0x19')](function(_0x5c3c56){if(_0x5c3c56['http_code']>=0xc8&&_0x5c3c56[_0xf1a0('0x4a')]<=0xce){if(_0x5c3c56[_0xf1a0('0x4b')]&&_0x5c3c56['data'][_0xf1a0('0x4c')]>0x0){var _0x76d3d5=_[_0xf1a0('0x4d')](_0x5c3c56['data'][_0xf1a0('0x25')]);var _0x55eb89={'messageId':_0x76d3d5[_0xf1a0('0x4e')]};if(!_0x6152fa['deliveryReport']){_0x55eb89[_0xf1a0('0x3f')]=!![];}return _0x105cc5[_0xf1a0('0x1a')](_0x55eb89);}else{logger['error'](_0xf1a0('0x2c'),_0xf1a0('0x2d'),_0xf1a0('0x4f'),util[_0xf1a0('0x2e')](_0x5c3c56,{'showHidden':![],'depth':null}));}}else{logger[_0xf1a0('0x1c')](_0xf1a0('0x2c'),'afterCreate',_0xf1a0('0x4f'),util['inspect'](_0x5c3c56,{'showHidden':![],'depth':null}));}})[_0xf1a0('0x2b')](function(_0x37d9d6){logger[_0xf1a0('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf1a0('0x2d'),_0xf1a0('0x4f'),util['inspect'](_0x37d9d6,{'showHidden':![],'depth':null}));});}else{logger[_0xf1a0('0x1c')](_0xf1a0('0x2c'),_0xf1a0('0x2d'),'clickSend',_0xf1a0('0x40'));}break;case _0xf1a0('0x50'):if(_0x6152fa['authId']&&_0x6152fa[_0xf1a0('0x23')]){var _0x5c214d={'dst':_0x3bcf1d[_0xf1a0('0x24')],'text':_0x3bcf1d['body'],'src':_0x6152fa[_0xf1a0('0x42')]||_0x6152fa['phone'],'url':_0x6152fa[_0xf1a0('0x26')]+'/api/sms/messages/'+_0x3bcf1d['id']+'/status?token='+_0x6152fa['token']};var _0x438cca=util[_0xf1a0('0x48')]('%s:%s',_0x6152fa['authId'],_0x6152fa[_0xf1a0('0x23')]);var _0x56b9cd={'method':'POST','uri':util['format'](_0xf1a0('0x51'),_0x6152fa['authId']),'body':_0x5c214d,'headers':{'Authorization':util[_0xf1a0('0x48')](_0xf1a0('0x49'),new Buffer(_0x438cca)[_0xf1a0('0x52')](_0xf1a0('0x53')))},'json':!![]};rp(_0x56b9cd)[_0xf1a0('0x19')](function(_0x42b350){var _0x27c4ae={'messageId':_0x42b350[_0xf1a0('0x54')][0x0]};return _0x105cc5[_0xf1a0('0x1a')](_0x27c4ae);})['catch'](function(_0xa8d018){logger[_0xf1a0('0x1c')](_0xf1a0('0x2c'),_0xf1a0('0x2d'),_0xf1a0('0x50'),util[_0xf1a0('0x2e')](_0xa8d018,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xf1a0('0x50'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xf1a0('0x55'):if(_0x6152fa['username']&&_0x6152fa['password']){if(_0x6152fa[_0xf1a0('0x56')]){var _0x431369={'method':_0xf1a0('0x3a'),'uri':_0x6152fa[_0xf1a0('0x56')]+'/auth/1/session','body':{'username':_0x6152fa[_0xf1a0('0x32')],'password':_0x6152fa['password']},'json':!![]};return rp(_0x431369)[_0xf1a0('0x19')](function(_0x5dee58){var _0x1f4dd2={'method':'POST','uri':_0x6152fa[_0xf1a0('0x56')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x6152fa[_0xf1a0('0x24')],'destinations':[{'to':_0x3bcf1d[_0xf1a0('0x24')]}],'text':_0x3bcf1d[_0xf1a0('0x10')],'notifyUrl':_0x6152fa[_0xf1a0('0x26')]+_0xf1a0('0x27')+_0x3bcf1d['id']+_0xf1a0('0x28')+_0x6152fa[_0xf1a0('0x29')],'notifyContentType':_0xf1a0('0x57'),'callbackData':_0x6152fa[_0xf1a0('0x24')]+';'+_0x3bcf1d[_0xf1a0('0x10')]}]},'headers':{'Authorization':_0xf1a0('0x58')+_0x5dee58[_0xf1a0('0x29')]},'json':!![]};return rp(_0x1f4dd2)[_0xf1a0('0x19')](function(_0x27b806){if(_0x27b806[_0xf1a0('0x25')]){var _0x1b885e={'messageId':_0x27b806[_0xf1a0('0x25')][0x0]['messageId']};if(!_0x6152fa['deliveryReport']){_0x1b885e[_0xf1a0('0x3f')]=!![];}return _0x105cc5[_0xf1a0('0x1a')](_0x1b885e);}else{return logger[_0xf1a0('0x1c')](_0xf1a0('0x2c'),_0xf1a0('0x2d'),_0xf1a0('0x55'),util[_0xf1a0('0x2e')](_0x27b806,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x571aec){return logger[_0xf1a0('0x1c')](_0xf1a0('0x2c'),_0xf1a0('0x2d'),'infobip',util['inspect'](_0x571aec,{'showHidden':![],'depth':null}));});}else{logger[_0xf1a0('0x1c')](_0xf1a0('0x2c'),_0xf1a0('0x2d'),'infobip','Missing\x20parameters:\x20base_url');}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf1a0('0x2d'),'infobip',_0xf1a0('0x40'));}break;case _0xf1a0('0x59'):var _0x48145a=require('crypto');if(_0x6152fa[_0xf1a0('0x5a')]){var _0x229a47={};_0x229a47[_0xf1a0('0x5b')]=_0x6152fa[_0xf1a0('0x32')];_0x229a47[_0xf1a0('0x24')]=_0x3bcf1d[_0xf1a0('0x24')];_0x229a47[_0xf1a0('0x35')]=_0x6152fa[_0xf1a0('0x24')];_0x229a47[_0xf1a0('0x5c')]=_0x3bcf1d['body'];_0x229a47[_0xf1a0('0x5d')]=+new Date();var _0x51350e='';var _0x3e7126='';var _0x52a161=Object['keys'](_0x229a47);_0x52a161[_0xf1a0('0x5e')]();for(var _0x289c76=0x0;_0x289c76<_0x52a161[_0xf1a0('0x5f')];_0x289c76++){if(_0x51350e!=''){_0x51350e+='&';}_0x51350e+=_0x52a161[_0x289c76]+'='+encodeURIComponent(_0x229a47[_0x52a161[_0x289c76]]);_0x3e7126+=_0x229a47[_0x52a161[_0x289c76]];}_0x3e7126+=_0x6152fa['apiKey'];_0x3e7126=_0x48145a[_0xf1a0('0x60')](_0xf1a0('0x61'))[_0xf1a0('0x1a')](_0x3e7126)[_0xf1a0('0x62')](_0xf1a0('0x63'));if(_0x51350e!==''){_0x51350e+='&';}_0x51350e+=_0xf1a0('0x64')+_0x3e7126;var _0x3c8454={'method':_0xf1a0('0x37'),'uri':_0x6152fa[_0xf1a0('0x56')]+_0xf1a0('0x65')+_0x51350e,'json':!![]};return rp(_0x3c8454)['then'](function(_0x4e57bf){var _0xea9b6e=Object[_0xf1a0('0x66')](_0x4e57bf);if(_0x4e57bf[_0xea9b6e[0x0]][_0xf1a0('0x1c')]&&parseInt(_0x4e57bf[_0xea9b6e[0x0]]['error'])===0x0){var _0xc16c9b={'messageId':_0x4e57bf[_0xea9b6e[0x0]][_0xf1a0('0x67')]};if(!_0x6152fa['deliveryReport']){_0xc16c9b[_0xf1a0('0x3f')]=!![];}return _0x105cc5[_0xf1a0('0x1a')](_0xc16c9b);}else{return logger[_0xf1a0('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xf1a0('0x59'),util['inspect'](_0x4e57bf['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x2c0d10){return logger[_0xf1a0('0x1c')](_0xf1a0('0x2c'),'afterCreate',_0xf1a0('0x59'),util[_0xf1a0('0x2e')](_0x2c0d10,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf1a0('0x2c'),_0xf1a0('0x2d'),_0xf1a0('0x59'),_0xf1a0('0x68'));}break;case _0xf1a0('0x69'):if(_0x6152fa['apiKey']){var _0x4afa43={'method':_0xf1a0('0x3a'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x6152fa['apiKey']},'body':{'content':_0x3bcf1d['body'],'to':[_0x3bcf1d['phone']],'from':_0x6152fa[_0xf1a0('0x24')],'binary':![],'clientMessageId':_0xf1a0('0x6a'),'charset':_0xf1a0('0x6b')},'json':!![]};rp(_0x4afa43)[_0xf1a0('0x19')](function(_0x1afbc4){if(!_0x1afbc4[_0xf1a0('0x1c')]){var _0x3ee36f={'messageId':_0x1afbc4['messages'][0x0][_0xf1a0('0x6c')]};if(!_0x6152fa[_0xf1a0('0x3e')]){_0x3ee36f[_0xf1a0('0x3f')]=!![];}return _0x105cc5[_0xf1a0('0x1a')](_0x3ee36f);}else{return logger['error'](_0xf1a0('0x2c'),_0xf1a0('0x2d'),_0xf1a0('0x69'),util[_0xf1a0('0x2e')](_0x1afbc4[_0xf1a0('0x1c')],{'showHidden':![],'depth':null}));}})[_0xf1a0('0x2b')](function(_0x250814){return logger[_0xf1a0('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf1a0('0x2d'),_0xf1a0('0x69'),util[_0xf1a0('0x2e')](_0x250814,{'showHidden':![],'depth':null}));});}else{logger[_0xf1a0('0x1c')](_0xf1a0('0x2c'),'afterCreate',_0xf1a0('0x69'),_0xf1a0('0x68'));}break;case _0xf1a0('0x6d'):if(_0x6152fa[_0xf1a0('0x32')]&&_0x6152fa['password']){var _0x438cca=util[_0xf1a0('0x48')](_0xf1a0('0x46'),_0x6152fa[_0xf1a0('0x32')],_0x6152fa[_0xf1a0('0x33')]);var _0x56b9cd={'method':_0xf1a0('0x3a'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x6152fa['accountId']+_0xf1a0('0x6e'),'body':{'to':[_0x3bcf1d[_0xf1a0('0x24')]],'text':_0x3bcf1d[_0xf1a0('0x10')],'from':_0x6152fa[_0xf1a0('0x24')],'applicationId':_0x6152fa[_0xf1a0('0x6f')]},'headers':{'Authorization':util[_0xf1a0('0x48')](_0xf1a0('0x49'),new Buffer(_0x438cca)[_0xf1a0('0x52')]('base64'))},'json':!![]};rp(_0x56b9cd)[_0xf1a0('0x19')](function(_0x1e646a){if(_0x1e646a['id']){var _0x11679c={'messageId':_0x1e646a['id']};return _0x105cc5[_0xf1a0('0x1a')](_0x11679c);}else{logger['error'](_0xf1a0('0x2c'),_0xf1a0('0x2d'),_0xf1a0('0x6d'),util[_0xf1a0('0x2e')](_0x1e646a,{'showHidden':![],'depth':null}));}})[_0xf1a0('0x2b')](function(_0x1139d0){logger[_0xf1a0('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf1a0('0x2d'),_0xf1a0('0x6d'),util['inspect'](_0x1139d0,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf1a0('0x2d'),_0xf1a0('0x6d'),_0xf1a0('0x40'));}break;case _0xf1a0('0x70'):if(_0x6152fa[_0xf1a0('0x5a')]){var _0x53e76c={};var _0x3c8454={'method':_0xf1a0('0x3a'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0xf1a0('0x71')+_0x6152fa['apiKey'],'Content-Type':_0xf1a0('0x57')},'body':{'from':_0x6152fa[_0xf1a0('0x24')],'to':_0x3bcf1d[_0xf1a0('0x24')],'text':_0x3bcf1d[_0xf1a0('0x10')]},'json':!![]};return rp(_0x3c8454)[_0xf1a0('0x19')](function(_0x23d4b0){if(_0x23d4b0[_0xf1a0('0x72')]==0xca){_0x53e76c[_0xf1a0('0x73')]=_0x23d4b0;var _0x4a98fc={'method':_0xf1a0('0x3a'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0xf1a0('0x71')+_0x6152fa['apiKey'],'Content-Type':_0xf1a0('0x57')},'body':{'refid':_0x53e76c[_0xf1a0('0x73')][_0xf1a0('0x74')]},'json':!![]};return rp(_0x4a98fc)[_0xf1a0('0x19')](function(_0x2382bb){_0x53e76c['status']=_0x2382bb;var _0x340c90={'messageId':_0x53e76c[_0xf1a0('0x73')][_0xf1a0('0x74')],'read':!![]};return _0x105cc5[_0xf1a0('0x1a')](_0x340c90);});}else{return logger[_0xf1a0('0x1c')](_0xf1a0('0x2c'),_0xf1a0('0x2d'),'intelepeer',util[_0xf1a0('0x2e')](_0x23d4b0,{'showHidden':![],'depth':null}));}})[_0xf1a0('0x2b')](function(_0x302fa7){return logger[_0xf1a0('0x1c')](_0xf1a0('0x2c'),_0xf1a0('0x2d'),_0xf1a0('0x70'),util[_0xf1a0('0x2e')](_0x302fa7,{'showHidden':![],'depth':null}));});}else{return logger[_0xf1a0('0x1c')](_0xf1a0('0x2c'),_0xf1a0('0x2d'),'intelepeer',_0xf1a0('0x75'));}break;}}})[_0xf1a0('0x76')](function(){_0x359681();});}else{_0x359681();}}},'charset':_0xf1a0('0x77'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 43cc646..14dd408 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 _0xd87b=['register','request','then','info','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','SmsMessage','create','body','options','CreateSmsMessage','debug','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xd87b,0x1e0));var _0xbd87=function(_0x440e74,_0x3631f2){_0x440e74=_0x440e74-0x0;var _0x2ca439=_0xd87b[_0x440e74];return _0x2ca439;};'use strict';var _=require('lodash');var util=require(_0xbd87('0x0'));var moment=require(_0xbd87('0x1'));var BPromise=require('bluebird');var rs=require(_0xbd87('0x2'));var fs=require('fs');var Redis=require(_0xbd87('0x3'));var db=require(_0xbd87('0x4'))['db'];var utils=require(_0xbd87('0x5'));var logger=require(_0xbd87('0x6'))(_0xbd87('0x7'));var config=require(_0xbd87('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbd87('0x9')][_0xbd87('0xa')]({'port':0x232a});config['redis']=_[_0xbd87('0xb')](config[_0xbd87('0xc')],{'host':_0xbd87('0xd'),'port':0x18eb});var socket=require(_0xbd87('0xe'))(new Redis(config[_0xbd87('0xc')]));require('./smsMessage.socket')[_0xbd87('0xf')](socket);function respondWithRpcPromise(_0x3b8c0b,_0x2085e5,_0x109352){return new BPromise(function(_0xde3143,_0x2f066d){return client[_0xbd87('0x10')](_0x3b8c0b,_0x109352)[_0xbd87('0x11')](function(_0x409310){logger[_0xbd87('0x12')]('SmsMessage,\x20%s,\x20%s',_0x2085e5,'request\x20sent');logger['debug'](_0xbd87('0x13'),_0x2085e5,'request\x20sent',JSON['stringify'](_0x409310));if(_0x409310[_0xbd87('0x14')]){if(_0x409310[_0xbd87('0x14')][_0xbd87('0x15')]===0x1f4){logger[_0xbd87('0x14')](_0xbd87('0x16'),_0x2085e5,_0x409310[_0xbd87('0x14')][_0xbd87('0x17')]);return _0x2f066d(_0x409310['error'][_0xbd87('0x17')]);}logger[_0xbd87('0x14')](_0xbd87('0x16'),_0x2085e5,_0x409310['error'][_0xbd87('0x17')]);return _0xde3143(_0x409310['error'][_0xbd87('0x17')]);}else{logger[_0xbd87('0x12')](_0xbd87('0x16'),_0x2085e5,'request\x20sent');_0xde3143(_0x409310[_0xbd87('0x18')][_0xbd87('0x17')]);}})[_0xbd87('0x19')](function(_0x5c93ee){logger['error']('SmsMessage,\x20%s,\x20%s',_0x2085e5,_0x5c93ee);_0x2f066d(_0x5c93ee);});});}exports['CreateSmsMessage']=function(_0xc7c574){var _0x186966=this;return new Promise(function(_0xf3be1e,_0x3b2ed5){return db[_0xbd87('0x1a')][_0xbd87('0x1b')](_0xc7c574[_0xbd87('0x1c')],{'raw':_0xc7c574[_0xbd87('0x1d')]?_0xc7c574[_0xbd87('0x1d')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4980c7){logger[_0xbd87('0x12')](_0xbd87('0x1e'),_0xc7c574);logger[_0xbd87('0x1f')]('CreateSmsMessage',_0xc7c574,JSON[_0xbd87('0x20')](_0x4980c7));_0xf3be1e(_0x4980c7);})['catch'](function(_0x44b768){logger[_0xbd87('0x14')](_0xbd87('0x1e'),_0x44b768[_0xbd87('0x17')],_0xc7c574);_0x3b2ed5(_0x186966[_0xbd87('0x14')](0x1f4,_0x44b768[_0xbd87('0x17')]));});});}; \ No newline at end of file +var _0xc136=['../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','debug','lodash','util','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x49988d,_0x15dae4){var _0x2259f7=function(_0x1c964d){while(--_0x1c964d){_0x49988d['push'](_0x49988d['shift']());}};_0x2259f7(++_0x15dae4);}(_0xc136,0x170));var _0x6c13=function(_0x13bced,_0x4ffbb2){_0x13bced=_0x13bced-0x0;var _0x34acff=_0xc136[_0x13bced];return _0x34acff;};'use strict';var _=require(_0x6c13('0x0'));var util=require(_0x6c13('0x1'));var moment=require('moment');var BPromise=require(_0x6c13('0x2'));var rs=require(_0x6c13('0x3'));var fs=require('fs');var Redis=require(_0x6c13('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6c13('0x5'));var logger=require(_0x6c13('0x6'))(_0x6c13('0x7'));var config=require(_0x6c13('0x8'));var jayson=require(_0x6c13('0x9'));var client=jayson[_0x6c13('0xa')]['http']({'port':0x232a});config[_0x6c13('0xb')]=_[_0x6c13('0xc')](config['redis'],{'host':_0x6c13('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6c13('0xb')]));require(_0x6c13('0xe'))[_0x6c13('0xf')](socket);function respondWithRpcPromise(_0x303b15,_0x3fd8e7,_0x4a8434){return new BPromise(function(_0x3718a6,_0x30fba0){return client[_0x6c13('0x10')](_0x303b15,_0x4a8434)[_0x6c13('0x11')](function(_0x579e83){logger[_0x6c13('0x12')](_0x6c13('0x13'),_0x3fd8e7,_0x6c13('0x14'));logger['debug'](_0x6c13('0x15'),_0x3fd8e7,_0x6c13('0x14'),JSON[_0x6c13('0x16')](_0x579e83));if(_0x579e83[_0x6c13('0x17')]){if(_0x579e83['error'][_0x6c13('0x18')]===0x1f4){logger[_0x6c13('0x17')](_0x6c13('0x13'),_0x3fd8e7,_0x579e83[_0x6c13('0x17')]['message']);return _0x30fba0(_0x579e83['error'][_0x6c13('0x19')]);}logger[_0x6c13('0x17')]('SmsMessage,\x20%s,\x20%s',_0x3fd8e7,_0x579e83[_0x6c13('0x17')]['message']);return _0x3718a6(_0x579e83[_0x6c13('0x17')][_0x6c13('0x19')]);}else{logger[_0x6c13('0x12')]('SmsMessage,\x20%s,\x20%s',_0x3fd8e7,'request\x20sent');_0x3718a6(_0x579e83['result'][_0x6c13('0x19')]);}})[_0x6c13('0x1a')](function(_0x416063){logger[_0x6c13('0x17')]('SmsMessage,\x20%s,\x20%s',_0x3fd8e7,_0x416063);_0x30fba0(_0x416063);});});}exports[_0x6c13('0x1b')]=function(_0x55db0e){var _0x88d51b=this;return new Promise(function(_0x37cac8,_0x246794){return db[_0x6c13('0x1c')][_0x6c13('0x1d')](_0x55db0e[_0x6c13('0x1e')],{'raw':_0x55db0e['options']?_0x55db0e[_0x6c13('0x1f')][_0x6c13('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x36fc10){logger[_0x6c13('0x12')](_0x6c13('0x1b'),_0x55db0e);logger[_0x6c13('0x21')](_0x6c13('0x1b'),_0x55db0e,JSON[_0x6c13('0x16')](_0x36fc10));_0x37cac8(_0x36fc10);})[_0x6c13('0x1a')](function(_0x260a8a){logger[_0x6c13('0x17')](_0x6c13('0x1b'),_0x260a8a[_0x6c13('0x19')],_0x55db0e);_0x246794(_0x88d51b[_0x6c13('0x17')](0x1f4,_0x260a8a[_0x6c13('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index e820c51..1e7a5ef 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 _0xed0c=['smsMessage:','./smsMessage.events','save','emit','register'];(function(_0x4d53ad,_0x5a8c2b){var _0x1bf121=function(_0x4f88c1){while(--_0x4f88c1){_0x4d53ad['push'](_0x4d53ad['shift']());}};_0x1bf121(++_0x5a8c2b);}(_0xed0c,0x15f));var _0xced0=function(_0x137898,_0x527c83){_0x137898=_0x137898-0x0;var _0x1177b0=_0xed0c[_0x137898];return _0x1177b0;};'use strict';var SmsMessageEvents=require(_0xced0('0x0'));var events=[_0xced0('0x1'),'remove','update'];function createListener(_0x3c650e,_0x47f1bd){return function(_0x3974cb){_0x47f1bd[_0xced0('0x2')](_0x3c650e,_0x3974cb);};}function removeListener(_0x34decf,_0x8d93ea){return function(){SmsMessageEvents['removeListener'](_0x34decf,_0x8d93ea);};}exports[_0xced0('0x3')]=function(_0x427120){for(var _0x255163=0x0,_0x3e0304=events['length'];_0x255163<_0x3e0304;_0x255163++){var _0xe1c94d=events[_0x255163];var _0xdb3f3e=createListener(_0xced0('0x4')+_0xe1c94d,_0x427120);SmsMessageEvents['on'](_0xe1c94d,_0xdb3f3e);}}; \ No newline at end of file +var _0x4734=['length','smsMessage:','./smsMessage.events','save','remove','emit','register'];(function(_0x3a3605,_0x7910ee){var _0x13ef3e=function(_0x179831){while(--_0x179831){_0x3a3605['push'](_0x3a3605['shift']());}};_0x13ef3e(++_0x7910ee);}(_0x4734,0x87));var _0x4473=function(_0xfbfdd8,_0x1fb5a3){_0xfbfdd8=_0xfbfdd8-0x0;var _0x35349d=_0x4734[_0xfbfdd8];return _0x35349d;};'use strict';var SmsMessageEvents=require(_0x4473('0x0'));var events=[_0x4473('0x1'),_0x4473('0x2'),'update'];function createListener(_0x12a3a3,_0x55883a){return function(_0x40f2e0){_0x55883a[_0x4473('0x3')](_0x12a3a3,_0x40f2e0);};}function removeListener(_0x508f60,_0x395f64){return function(){SmsMessageEvents['removeListener'](_0x508f60,_0x395f64);};}exports[_0x4473('0x4')]=function(_0x7cd9b7){for(var _0x2e05aa=0x0,_0x357873=events[_0x4473('0x5')];_0x2e05aa<_0x357873;_0x2e05aa++){var _0x39c9de=events[_0x2e05aa];var _0xc53185=createListener(_0x4473('0x6')+_0x39c9de,_0x7cd9b7);SmsMessageEvents['on'](_0x39c9de,_0xc53185);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index a7e7a9f..025553f 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 _0x512e=['exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeTeams','removeAgents'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x512e,0x187));var _0xe512=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x512e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe512('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe512('0x1'));var express=require(_0xe512('0x2'));var router=express[_0xe512('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe512('0x4'));var interaction=require(_0xe512('0x5'));var config=require('../../config/environment');var controller=require('./smsQueue.controller');router[_0xe512('0x6')]('/',auth['isAuthenticated'](),controller[_0xe512('0x7')]);router[_0xe512('0x6')](_0xe512('0x8'),auth[_0xe512('0x9')](),controller[_0xe512('0xa')]);router[_0xe512('0x6')]('/:id',auth[_0xe512('0x9')](),controller['show']);router[_0xe512('0x6')]('/:id/members',auth[_0xe512('0x9')](),controller[_0xe512('0xb')]);router[_0xe512('0x6')](_0xe512('0xc'),auth[_0xe512('0x9')](),controller['getTeams']);router['get'](_0xe512('0xd'),auth[_0xe512('0x9')](),controller[_0xe512('0xe')]);router[_0xe512('0xf')]('/',auth[_0xe512('0x9')](),controller[_0xe512('0x10')]);router[_0xe512('0xf')](_0xe512('0xc'),auth[_0xe512('0x9')](),controller[_0xe512('0x11')]);router['post'](_0xe512('0xd'),auth['isAuthenticated'](),controller[_0xe512('0x12')]);router[_0xe512('0x13')](_0xe512('0x14'),auth[_0xe512('0x9')](),controller['update']);router[_0xe512('0x15')](_0xe512('0x14'),auth[_0xe512('0x9')](),controller[_0xe512('0x16')]);router[_0xe512('0x15')]('/:id/teams',auth['isAuthenticated'](),controller[_0xe512('0x17')]);router[_0xe512('0x15')](_0xe512('0xd'),auth[_0xe512('0x9')](),controller[_0xe512('0x18')]);module[_0xe512('0x19')]=router; \ No newline at end of file +var _0x9016=['removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','create','post','addTeams','addAgents','put','destroy','delete','removeTeams'];(function(_0x3be002,_0x1ac993){var _0x3e3664=function(_0x5c324c){while(--_0x5c324c){_0x3be002['push'](_0x3be002['shift']());}};_0x3e3664(++_0x1ac993);}(_0x9016,0x195));var _0x6901=function(_0x511cda,_0x28d234){_0x511cda=_0x511cda-0x0;var _0x22d1b4=_0x9016[_0x511cda];return _0x22d1b4;};'use strict';var multer=require(_0x6901('0x0'));var util=require(_0x6901('0x1'));var path=require(_0x6901('0x2'));var timeout=require(_0x6901('0x3'));var express=require('express');var router=express[_0x6901('0x4')]();var fs_extra=require(_0x6901('0x5'));var auth=require(_0x6901('0x6'));var interaction=require(_0x6901('0x7'));var config=require(_0x6901('0x8'));var controller=require(_0x6901('0x9'));router['get']('/',auth[_0x6901('0xa')](),controller[_0x6901('0xb')]);router[_0x6901('0xc')](_0x6901('0xd'),auth[_0x6901('0xa')](),controller[_0x6901('0xe')]);router[_0x6901('0xc')](_0x6901('0xf'),auth['isAuthenticated'](),controller['show']);router['get'](_0x6901('0x10'),auth[_0x6901('0xa')](),controller[_0x6901('0x11')]);router[_0x6901('0xc')](_0x6901('0x12'),auth['isAuthenticated'](),controller[_0x6901('0x13')]);router['get'](_0x6901('0x14'),auth[_0x6901('0xa')](),controller['getAgents']);router['post']('/',auth[_0x6901('0xa')](),controller[_0x6901('0x15')]);router[_0x6901('0x16')](_0x6901('0x12'),auth[_0x6901('0xa')](),controller[_0x6901('0x17')]);router[_0x6901('0x16')](_0x6901('0x14'),auth[_0x6901('0xa')](),controller[_0x6901('0x18')]);router[_0x6901('0x19')](_0x6901('0xf'),auth[_0x6901('0xa')](),controller['update']);router['delete']('/:id',auth[_0x6901('0xa')](),controller[_0x6901('0x1a')]);router[_0x6901('0x1b')](_0x6901('0x12'),auth[_0x6901('0xa')](),controller[_0x6901('0x1c')]);router[_0x6901('0x1b')]('/:id/users',auth[_0x6901('0xa')](),controller[_0x6901('0x1d')]);module[_0x6901('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index f9ed950..47c9cca 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 _0xbec7=['ENUM','beepall','roundrobin','exports','STRING'];(function(_0x47e629,_0x4609fa){var _0x30f8a0=function(_0xae7c89){while(--_0xae7c89){_0x47e629['push'](_0x47e629['shift']());}};_0x30f8a0(++_0x4609fa);}(_0xbec7,0x1b6));var _0x7bec=function(_0x149eed,_0x2b9592){_0x149eed=_0x149eed-0x0;var _0x22b584=_0xbec7[_0x149eed];return _0x22b584;};'use strict';var Sequelize=require('sequelize');module[_0x7bec('0x0')]={'name':{'type':Sequelize[_0x7bec('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7bec('0x2')]('rrmemory',_0x7bec('0x3'),_0x7bec('0x4'))}}; \ No newline at end of file +var _0xb602=['name','beepall','roundrobin','exports','STRING'];(function(_0x284686,_0x547691){var _0x159a4d=function(_0x2ac0f9){while(--_0x2ac0f9){_0x284686['push'](_0x284686['shift']());}};_0x159a4d(++_0x547691);}(_0xb602,0x1b6));var _0x2b60=function(_0x12d121,_0x1ef59d){_0x12d121=_0x12d121-0x0;var _0x1af836=_0xb602[_0x12d121];return _0x1af836;};'use strict';var Sequelize=require('sequelize');module[_0x2b60('0x0')]={'name':{'type':Sequelize[_0x2b60('0x1')],'unique':_0x2b60('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2b60('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x2b60('0x3'),_0x2b60('0x4'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 0922d34..44a55d4 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 _0xe16d=['rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','map','SmsQueue','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','order','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','describe','getMembers','hasOwnProperty','nolimit','pick','UserSmsQueue','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','SIP','smsPause','getTeams','findOne','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','SmsQueueId\x20=\x20?','push','toString','QueryTypes','TeamId','includes','all','union','compact','value','isEmpty','userSmsQueue:remove','addAgents','spread','userSmsQueue:save','removeAgents','isArray','getAgents','eml-format'];(function(_0x59f574,_0x1b7f46){var _0x111a20=function(_0x3faa19){while(--_0x3faa19){_0x59f574['push'](_0x59f574['shift']());}};_0x111a20(++_0x1b7f46);}(_0xe16d,0x11d));var _0xde16=function(_0xde9c67,_0x4e3853){_0xde9c67=_0xde9c67-0x0;var _0x59cc42=_0xe16d[_0xde9c67];return _0x59cc42;};'use strict';var emlformat=require(_0xde16('0x0'));var rimraf=require(_0xde16('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xde16('0x2'));var rp=require(_0xde16('0x3'));var moment=require(_0xde16('0x4'));var BPromise=require(_0xde16('0x5'));var Mustache=require(_0xde16('0x6'));var util=require(_0xde16('0x7'));var path=require(_0xde16('0x8'));var sox=require(_0xde16('0x9'));var csv=require('to-csv');var ejs=require(_0xde16('0xa'));var fs=require('fs');var fs_extra=require(_0xde16('0xb'));var _=require(_0xde16('0xc'));var squel=require(_0xde16('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xde16('0xe'));var toCsv=require(_0xde16('0xf'));var querystring=require(_0xde16('0x10'));var Papa=require(_0xde16('0x11'));var Redis=require(_0xde16('0x12'));var authService=require(_0xde16('0x13'));var qs=require(_0xde16('0x14'));var as=require(_0xde16('0x15'));var hardwareService=require(_0xde16('0x16'));var logger=require('../../config/logger')(_0xde16('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xde16('0x18'));var db=require(_0xde16('0x19'))['db'];config['redis']=_[_0xde16('0x1a')](config[_0xde16('0x1b')],{'host':_0xde16('0x1c'),'port':0x18eb});var socket=require(_0xde16('0x1d'))(new Redis(config['redis']));require(_0xde16('0x1e'))[_0xde16('0x1f')](socket);function respondWithStatusCode(_0x303f61,_0x385bb0){_0x385bb0=_0x385bb0||0xcc;return function(_0x51f2e8){if(_0x51f2e8){return _0x303f61[_0xde16('0x20')](_0x385bb0);}return _0x303f61[_0xde16('0x21')](_0x385bb0)[_0xde16('0x22')]();};}function respondWithResult(_0x36f90e,_0x3b0606){_0x3b0606=_0x3b0606||0xc8;return function(_0x4b7185){if(_0x4b7185){return _0x36f90e[_0xde16('0x21')](_0x3b0606)[_0xde16('0x23')](_0x4b7185);}};}function respondWithFilteredResult(_0x36cdac,_0x5de770){return function(_0x3d0474){if(_0x3d0474){var _0x54de2f=typeof _0x5de770[_0xde16('0x24')]==='undefined'&&typeof _0x5de770[_0xde16('0x25')]===_0xde16('0x26');var _0x4162f4=_0x3d0474[_0xde16('0x27')];var _0x57814b=_0x54de2f?0x0:_0x5de770[_0xde16('0x24')];var _0x1b10f5=_0x54de2f?_0x3d0474[_0xde16('0x27')]:_0x5de770[_0xde16('0x24')]+_0x5de770['limit'];var _0x3afcbc;if(_0x1b10f5>=_0x4162f4){_0x1b10f5=_0x4162f4;_0x3afcbc=0xc8;}else{_0x3afcbc=0xce;}_0x36cdac['status'](_0x3afcbc);return _0x36cdac[_0xde16('0x28')](_0xde16('0x29'),_0x57814b+'-'+_0x1b10f5+'/'+_0x4162f4)[_0xde16('0x23')](_0x3d0474);}return null;};}function patchUpdates(_0x486cda){return function(_0x1ffb8c){try{jsonpatch['apply'](_0x1ffb8c,_0x486cda,!![]);}catch(_0x221663){return BPromise[_0xde16('0x2a')](_0x221663);}return _0x1ffb8c[_0xde16('0x2b')]();};}function saveUpdates(_0x36e261,_0x4e3170){return function(_0x39c6c7){if(_0x39c6c7){return _0x39c6c7[_0xde16('0x2c')](_0x36e261)[_0xde16('0x2d')](function(_0x11aac2){return _0x11aac2;});}return null;};}function removeEntity(_0x129691,_0x271567){return function(_0x4592de){if(_0x4592de){return _0x4592de[_0xde16('0x2e')]()[_0xde16('0x2d')](function(){var _0x31bf89=_0x4592de[_0xde16('0x2f')]({'plain':!![]});var _0xd5bd5e=_0xde16('0x30');return db[_0xde16('0x31')]['destroy']({'where':{'type':_0xd5bd5e,'resourceId':_0x31bf89['id']}})['then'](function(){return _0x4592de;});})[_0xde16('0x2d')](function(){_0x129691['status'](0xcc)[_0xde16('0x22')]();});}};}function handleEntityNotFound(_0x491ab2,_0x3c9af7){return function(_0x387ac0){if(!_0x387ac0){_0x491ab2[_0xde16('0x20')](0x194);}return _0x387ac0;};}function handleError(_0x3cfd1d,_0x3a16bc){_0x3a16bc=_0x3a16bc||0x1f4;return function(_0x491642){logger[_0xde16('0x32')](_0x491642[_0xde16('0x33')]);if(_0x491642[_0xde16('0x34')]){delete _0x491642[_0xde16('0x34')];}_0x3cfd1d[_0xde16('0x21')](_0x3a16bc)['send'](_0x491642);};}exports['index']=function(_0x5f33e4,_0x58d7d5){var _0x38e9d7={},_0x260f5e={},_0x113f52={'count':0x0,'rows':[]};var _0x481d70=_[_0xde16('0x35')](db[_0xde16('0x36')][_0xde16('0x37')],function(_0x239dca){return{'name':_0x239dca[_0xde16('0x38')],'type':_0x239dca['type'][_0xde16('0x39')]};});_0x260f5e[_0xde16('0x3a')]=_[_0xde16('0x35')](_0x481d70,'name');_0x260f5e[_0xde16('0x3b')]=_[_0xde16('0x3c')](_0x5f33e4[_0xde16('0x3b')]);_0x260f5e[_0xde16('0x3d')]=_['intersection'](_0x260f5e['model'],_0x260f5e['query']);_0x38e9d7[_0xde16('0x3e')]=_[_0xde16('0x3f')](_0x260f5e['model'],qs['fields'](_0x5f33e4[_0xde16('0x3b')][_0xde16('0x40')]));_0x38e9d7[_0xde16('0x3e')]=_0x38e9d7[_0xde16('0x3e')][_0xde16('0x41')]?_0x38e9d7[_0xde16('0x3e')]:_0x260f5e[_0xde16('0x3a')];if(!_0x5f33e4['query']['hasOwnProperty']('nolimit')){_0x38e9d7[_0xde16('0x25')]=qs[_0xde16('0x25')](_0x5f33e4['query']['limit']);_0x38e9d7['offset']=qs[_0xde16('0x24')](_0x5f33e4[_0xde16('0x3b')][_0xde16('0x24')]);}_0x38e9d7[_0xde16('0x42')]=qs[_0xde16('0x43')](_0x5f33e4[_0xde16('0x3b')][_0xde16('0x43')]);_0x38e9d7['where']=qs[_0xde16('0x3d')](_['pick'](_0x5f33e4[_0xde16('0x3b')],_0x260f5e[_0xde16('0x3d')]),_0x481d70);if(_0x5f33e4[_0xde16('0x3b')][_0xde16('0x44')]){_0x38e9d7[_0xde16('0x45')]=_[_0xde16('0x46')](_0x38e9d7[_0xde16('0x45')],{'$or':_[_0xde16('0x35')](_0x481d70,function(_0x1af9cc){if(_0x1af9cc['type']!==_0xde16('0x47')){var _0x537192={};_0x537192[_0x1af9cc['name']]={'$like':'%'+_0x5f33e4[_0xde16('0x3b')]['filter']+'%'};return _0x537192;}})});}_0x38e9d7=_['merge']({},_0x38e9d7,_0x5f33e4[_0xde16('0x48')]);var _0x55f644={'where':_0x38e9d7[_0xde16('0x45')]};return db['SmsQueue'][_0xde16('0x27')](_0x55f644)[_0xde16('0x2d')](function(_0x3110b5){_0x113f52[_0xde16('0x27')]=_0x3110b5;if(_0x5f33e4['query'][_0xde16('0x49')]){_0x38e9d7['include']=[{'all':!![]}];}return db['SmsQueue'][_0xde16('0x4a')](_0x38e9d7);})[_0xde16('0x2d')](function(_0x3a124e){_0x113f52[_0xde16('0x4b')]=_0x3a124e;return _0x113f52;})[_0xde16('0x2d')](respondWithFilteredResult(_0x58d7d5,_0x38e9d7))[_0xde16('0x4c')](handleError(_0x58d7d5,null));};exports['show']=function(_0x4801bd,_0x39a909){var _0xadf87d={'raw':!![],'where':{'id':_0x4801bd[_0xde16('0x4d')]['id']}},_0x590ea9={};_0x590ea9[_0xde16('0x3a')]=_[_0xde16('0x3c')](db[_0xde16('0x36')]['rawAttributes']);_0x590ea9[_0xde16('0x3b')]=_[_0xde16('0x3c')](_0x4801bd[_0xde16('0x3b')]);_0x590ea9['filters']=_[_0xde16('0x3f')](_0x590ea9[_0xde16('0x3a')],_0x590ea9[_0xde16('0x3b')]);_0xadf87d[_0xde16('0x3e')]=_[_0xde16('0x3f')](_0x590ea9[_0xde16('0x3a')],qs[_0xde16('0x40')](_0x4801bd[_0xde16('0x3b')]['fields']));_0xadf87d[_0xde16('0x3e')]=_0xadf87d[_0xde16('0x3e')][_0xde16('0x41')]?_0xadf87d[_0xde16('0x3e')]:_0x590ea9[_0xde16('0x3a')];if(_0x4801bd[_0xde16('0x3b')]['includeAll']){_0xadf87d['include']=[{'all':!![]}];}_0xadf87d=_[_0xde16('0x46')]({},_0xadf87d,_0x4801bd[_0xde16('0x48')]);return db[_0xde16('0x36')][_0xde16('0x4e')](_0xadf87d)['then'](handleEntityNotFound(_0x39a909,null))[_0xde16('0x2d')](respondWithResult(_0x39a909,null))[_0xde16('0x4c')](handleError(_0x39a909,null));};exports[_0xde16('0x4f')]=function(_0x2318f2,_0x542562){return db[_0xde16('0x36')][_0xde16('0x4f')](_0x2318f2['body'],{})[_0xde16('0x2d')](function(_0x2fc577){var _0x550349=_0x2318f2[_0xde16('0x50')]['get']({'plain':!![]});if(!_0x550349)throw new Error(_0xde16('0x51'));if(_0x550349[_0xde16('0x52')]===_0xde16('0x50')){var _0xad02e5=_0x2fc577['get']({'plain':!![]});var _0x19b79b=_0xde16('0x30');return db[_0xde16('0x53')][_0xde16('0x4e')]({'where':{'name':_0x19b79b,'userProfileId':_0x550349[_0xde16('0x54')]},'raw':!![]})[_0xde16('0x2d')](function(_0x275ca9){if(_0x275ca9&&_0x275ca9[_0xde16('0x55')]===0x0){return db['UserProfileResource'][_0xde16('0x4f')]({'name':_0xad02e5[_0xde16('0x34')],'resourceId':_0xad02e5['id'],'type':_0x275ca9[_0xde16('0x34')],'sectionId':_0x275ca9['id']},{})[_0xde16('0x2d')](function(){return _0x2fc577;});}else{return _0x2fc577;}})[_0xde16('0x4c')](function(_0x39fb54){logger[_0xde16('0x32')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x39fb54);throw _0x39fb54;});}return _0x2fc577;})[_0xde16('0x2d')](respondWithResult(_0x542562,0xc9))['catch'](handleError(_0x542562,null));};exports[_0xde16('0x2c')]=function(_0x574bd0,_0x4a32b3){if(_0x574bd0[_0xde16('0x56')]['id']){delete _0x574bd0[_0xde16('0x56')]['id'];}return db[_0xde16('0x36')][_0xde16('0x4e')]({'where':{'id':_0x574bd0['params']['id']}})['then'](handleEntityNotFound(_0x4a32b3,null))['then'](saveUpdates(_0x574bd0['body'],null))[_0xde16('0x2d')](respondWithResult(_0x4a32b3,null))[_0xde16('0x4c')](handleError(_0x4a32b3,null));};exports['destroy']=function(_0x4052fa,_0x2d30c6){return db[_0xde16('0x36')][_0xde16('0x4e')]({'where':{'id':_0x4052fa[_0xde16('0x4d')]['id']}})[_0xde16('0x2d')](handleEntityNotFound(_0x2d30c6,null))[_0xde16('0x2d')](removeEntity(_0x2d30c6,null))[_0xde16('0x4c')](handleError(_0x2d30c6,null));};exports[_0xde16('0x57')]=function(_0x460c5c,_0x5b8b05){return db['SmsQueue'][_0xde16('0x57')]()[_0xde16('0x2d')](respondWithResult(_0x5b8b05,null))[_0xde16('0x4c')](handleError(_0x5b8b05,null));};exports[_0xde16('0x58')]=function(_0x19b1a9,_0x2e06c7,_0x1cdae4){var _0x259bd3={'raw':!![],'where':{}},_0x2885a4={},_0x2887f9;return db[_0xde16('0x36')]['findOne']({'where':{'id':_0x19b1a9[_0xde16('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2e06c7,null))[_0xde16('0x2d')](function(_0x3a3eaa){if(_0x3a3eaa){_0x2887f9=_0x3a3eaa[_0xde16('0x2f')]({'plain':!![]});_0x2885a4[_0xde16('0x3a')]=_[_0xde16('0x3c')](db['UserSmsQueue'][_0xde16('0x37')]);_0x2885a4[_0xde16('0x3b')]=_[_0xde16('0x3c')](_0x19b1a9[_0xde16('0x3b')]);_0x2885a4[_0xde16('0x3d')]=_['intersection'](_0x2885a4[_0xde16('0x3a')],_0x2885a4[_0xde16('0x3b')]);_0x259bd3[_0xde16('0x3e')]=_[_0xde16('0x3f')](_0x2885a4[_0xde16('0x3a')],qs['fields'](_0x19b1a9[_0xde16('0x3b')]['fields']));_0x259bd3['attributes']=_0x259bd3[_0xde16('0x3e')][_0xde16('0x41')]?_0x259bd3[_0xde16('0x3e')]:_0x2885a4[_0xde16('0x3a')];if(!_0x19b1a9['query'][_0xde16('0x59')](_0xde16('0x5a'))){_0x259bd3[_0xde16('0x25')]=qs[_0xde16('0x25')](_0x19b1a9['query'][_0xde16('0x25')]);_0x259bd3[_0xde16('0x24')]=qs['offset'](_0x19b1a9[_0xde16('0x3b')][_0xde16('0x24')]);}_0x259bd3[_0xde16('0x42')]=qs['sort'](_0x19b1a9['query'][_0xde16('0x43')]);_0x259bd3[_0xde16('0x45')]=qs['filters'](_[_0xde16('0x5b')](_0x19b1a9['query'],_0x2885a4[_0xde16('0x3d')]));_0x259bd3[_0xde16('0x45')]['SmsQueueId']=_0x3a3eaa['id'];if(_0x19b1a9[_0xde16('0x3b')][_0xde16('0x44')]){_0x259bd3[_0xde16('0x45')]=_['merge'](_0x259bd3[_0xde16('0x45')],{'$or':_[_0xde16('0x35')](_0x259bd3[_0xde16('0x3e')],function(_0x65543e){var _0x477dcb={};_0x477dcb[_0x65543e]={'$like':'%'+_0x19b1a9[_0xde16('0x3b')][_0xde16('0x44')]+'%'};return _0x477dcb;})});}_0x259bd3=_[_0xde16('0x46')]({},_0x259bd3,_0x19b1a9[_0xde16('0x48')]);return db[_0xde16('0x5c')][_0xde16('0x4a')](_0x259bd3);}})[_0xde16('0x2d')](function(_0x374d3b){if(_0x374d3b){return db[_0xde16('0x5d')][_0xde16('0x5e')]({'where':{'id':_[_0xde16('0x35')](_0x374d3b,_0xde16('0x5f')),'role':_0xde16('0x60')},'attributes':['id',_0xde16('0x34'),'smsPause',_0xde16('0x61'),_0xde16('0x62')]});}})[_0xde16('0x2d')](function(_0x40d0fa){if(_0x40d0fa){return{'count':_0x40d0fa[_0xde16('0x27')],'rows':_[_0xde16('0x35')](_0x40d0fa[_0xde16('0x4b')],function(_0x99d5c6){return{'membername':_0x99d5c6['name'],'UserId':_0x99d5c6['id'],'queue_name':_0x2887f9[_0xde16('0x34')],'SmsQueueId':_0x2887f9['id'],'interface':util[_0xde16('0x63')]('%s/%s',_0xde16('0x64'),_0x99d5c6[_0xde16('0x34')]),'penalty':0x0,'paused':_0x99d5c6[_0xde16('0x65')],'createdAt':_0x99d5c6[_0xde16('0x62')],'updatedAt':_0x99d5c6[_0xde16('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2e06c7,_0x259bd3))['catch'](handleError(_0x2e06c7,null));};exports[_0xde16('0x66')]=function(_0x40e875,_0x4b2611,_0x3d27f5){var _0x43a446={};var _0x5bd58c={};var _0x3e3368;var _0x5dca2b;return db['SmsQueue'][_0xde16('0x67')]({'where':{'id':_0x40e875[_0xde16('0x4d')]['id']}})[_0xde16('0x2d')](handleEntityNotFound(_0x4b2611,null))[_0xde16('0x2d')](function(_0x1d3a23){if(_0x1d3a23){_0x3e3368=_0x1d3a23;_0x5bd58c[_0xde16('0x3a')]=_[_0xde16('0x3c')](db['Team'][_0xde16('0x37')]);_0x5bd58c['query']=_['keys'](_0x40e875['query']);_0x5bd58c[_0xde16('0x3d')]=_['intersection'](_0x5bd58c['model'],_0x5bd58c['query']);_0x43a446[_0xde16('0x3e')]=_[_0xde16('0x3f')](_0x5bd58c[_0xde16('0x3a')],qs['fields'](_0x40e875[_0xde16('0x3b')][_0xde16('0x40')]));_0x43a446[_0xde16('0x3e')]=_0x43a446['attributes'][_0xde16('0x41')]?_0x43a446[_0xde16('0x3e')]:_0x5bd58c[_0xde16('0x3a')];_0x43a446[_0xde16('0x42')]=qs[_0xde16('0x43')](_0x40e875[_0xde16('0x3b')]['sort']);_0x43a446[_0xde16('0x45')]=qs[_0xde16('0x3d')](_[_0xde16('0x5b')](_0x40e875[_0xde16('0x3b')],_0x5bd58c[_0xde16('0x3d')]));if(_0x40e875['query']['filter']){_0x43a446[_0xde16('0x45')]=_[_0xde16('0x46')](_0x43a446[_0xde16('0x45')],{'$or':_[_0xde16('0x35')](_0x43a446[_0xde16('0x3e')],function(_0x277121){var _0x280fe4={};_0x280fe4[_0x277121]={'$like':'%'+_0x40e875[_0xde16('0x3b')][_0xde16('0x44')]+'%'};return _0x280fe4;})});}_0x43a446=_[_0xde16('0x46')]({},_0x43a446,_0x40e875[_0xde16('0x48')]);return _0x3e3368['getTeams'](_0x43a446);}})['then'](function(_0x1497a5){if(_0x1497a5){_0x5dca2b=_0x1497a5[_0xde16('0x41')];if(!_0x40e875['query'][_0xde16('0x59')](_0xde16('0x5a'))){_0x43a446[_0xde16('0x25')]=qs[_0xde16('0x25')](_0x40e875[_0xde16('0x3b')][_0xde16('0x25')]);_0x43a446[_0xde16('0x24')]=qs['offset'](_0x40e875[_0xde16('0x3b')]['offset']);}return _0x3e3368[_0xde16('0x66')](_0x43a446);}})[_0xde16('0x2d')](function(_0x3dc355){if(_0x3dc355){return _0x3dc355?{'count':_0x5dca2b,'rows':_0x3dc355}:null;}})[_0xde16('0x2d')](respondWithResult(_0x4b2611,null))[_0xde16('0x4c')](handleError(_0x4b2611,null));};exports['addTeams']=function(_0x27221c,_0x548d47,_0x43fc0e){var _0x37415f=_0x27221c[_0xde16('0x56')][_0xde16('0x68')];return db[_0xde16('0x69')][_0xde16('0x4a')]({'where':{'id':_0x37415f},'attributes':['id'],'include':[{'model':db[_0xde16('0x5d')],'as':_0xde16('0x6a'),'attributes':['id',_0xde16('0x34'),_0xde16('0x6b'),_0xde16('0x6c'),_0xde16('0x6d')],'raw':!![]}]})[_0xde16('0x2d')](function(_0x44524b){if(_0x44524b){var _0x72a916=_[_0xde16('0x6e')](_0x44524b,function(_0x4bc586){var _0x1ff144=_0x4bc586[_0xde16('0x2f')]({'plain':!![]});return _0x1ff144['Agents'];});return db[_0xde16('0x36')][_0xde16('0x4e')]({'where':{'id':_0x27221c[_0xde16('0x4d')]['id']}})['then'](function(_0x31c0bc){return db[_0xde16('0x6f')][_0xde16('0x70')](function(_0x1c75eb){return _0x31c0bc['addTeams'](_0x37415f,{'transaction':_0x1c75eb})[_0xde16('0x2d')](function(){return BPromise[_0xde16('0x71')](_0x72a916,function(_0x13accd){return db[_0xde16('0x5c')][_0xde16('0x72')]({'where':{'UserId':_0x13accd['id'],'SmsQueueId':_0x27221c[_0xde16('0x4d')]['id']},'transaction':_0x1c75eb});});})[_0xde16('0x2d')](function(){_0x72a916[_0xde16('0x73')](function(_0x371ebf){socket[_0xde16('0x74')]('userSmsQueue:save',{'UserId':_0x371ebf['id'],'SmsQueueId':_0x31c0bc['id']});});});});});}})[_0xde16('0x2d')](respondWithStatusCode(_0x548d47,null))[_0xde16('0x4c')](handleError(_0x548d47,null));};exports[_0xde16('0x75')]=function(_0x6f1ce6,_0x2ee9d2,_0x28ff92){return db[_0xde16('0x69')]['findAll']({'where':{'id':_0x6f1ce6[_0xde16('0x3b')][_0xde16('0x68')]},'attributes':['id'],'include':[{'model':db[_0xde16('0x5d')],'as':_0xde16('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xde16('0x2d')](handleEntityNotFound(_0x2ee9d2,null))['then'](function(_0x4f9b08){var _0x1635e1=_[_0xde16('0x35')](_0x4f9b08,'id');var _0x559aa3=[];var _0x3144e1=[];var _0x4eb91c=squel[_0xde16('0x76')]();_0x4eb91c[_0xde16('0x77')](_0xde16('0x78'))[_0xde16('0x79')](_0xde16('0x7a'),'tq')[_0xde16('0x7b')](_0xde16('0x7c'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xde16('0x45')](_0xde16('0x7d'),_0x6f1ce6[_0xde16('0x4d')]['id']);for(var _0x373580=0x0;_0x373580<_0x4f9b08[_0xde16('0x41')];_0x373580+=0x1){let _0x5b63b0=_0x4f9b08[_0x373580];for(var _0x20deec=0x0;_0x20deec<_0x5b63b0[_0xde16('0x6a')][_0xde16('0x41')];_0x20deec+=0x1){let _0x3be878=_0x5b63b0['Agents'][_0x20deec];var _0xe3b745=_0x4eb91c['clone']();_0xe3b745[_0xde16('0x45')]('ut.UserId\x20=\x20?',_0x3be878['id']);_0x3144e1[_0xde16('0x7e')](db[_0xde16('0x6f')][_0xde16('0x3b')](_0xe3b745[_0xde16('0x7f')](),{'type':db[_0xde16('0x6f')][_0xde16('0x80')]['SELECT']})[_0xde16('0x2d')](function(_0xf23e3a){if(_0xf23e3a[_0xde16('0x41')]===0x1){return _0x3be878['id'];}else{var _0x935c87=_['every'](_[_0xde16('0x35')](_0xf23e3a,_0xde16('0x81')),function(_0x409da2){return _[_0xde16('0x82')](_0x1635e1,_0x409da2);});if(_0x935c87){return _0x3be878['id'];}}}));}}return BPromise[_0xde16('0x83')](_0x3144e1)[_0xde16('0x2d')](function(_0x1dbfd1){_0x559aa3=_(_0x559aa3)[_0xde16('0x84')](_0x1dbfd1)[_0xde16('0x85')]()[_0xde16('0x86')]();return db['SmsQueue'][_0xde16('0x4e')]({'where':{'id':_0x6f1ce6[_0xde16('0x4d')]['id']}})['then'](function(_0x2c0d8c){return db['sequelize'][_0xde16('0x70')](function(_0x457918){return _0x2c0d8c[_0xde16('0x75')](_0x6f1ce6[_0xde16('0x3b')][_0xde16('0x68')],{'transaction':_0x457918})[_0xde16('0x2d')](function(){if(!_[_0xde16('0x87')](_0x559aa3)){return _0x2c0d8c['removeAgents'](_0x559aa3,{'transaction':_0x457918});}})['then'](function(){_0x559aa3[_0xde16('0x73')](function(_0x188376){socket[_0xde16('0x74')](_0xde16('0x88'),{'UserId':_0x188376,'SmsQueueId':_0x2c0d8c['id']});});});});});});})[_0xde16('0x2d')](respondWithStatusCode(_0x2ee9d2,null))[_0xde16('0x4c')](handleError(_0x2ee9d2,null));};exports[_0xde16('0x89')]=function(_0x140f2c,_0x195a03,_0x5a45e9){return db[_0xde16('0x36')][_0xde16('0x4e')]({'where':{'id':_0x140f2c[_0xde16('0x4d')]['id']}})[_0xde16('0x2d')](handleEntityNotFound(_0x195a03,null))[_0xde16('0x2d')](function(_0x315b2d){if(_0x315b2d){return _0x315b2d[_0xde16('0x89')](_0x140f2c[_0xde16('0x56')]['ids'],_['omit'](_0x140f2c[_0xde16('0x56')],['ids','id'])||{})[_0xde16('0x8a')](function(_0x15e9a1){for(var _0x21a1ae=0x0;_0x21a1ae<_0x140f2c['body'][_0xde16('0x68')][_0xde16('0x41')];_0x21a1ae+=0x1){socket[_0xde16('0x74')](_0xde16('0x8b'),{'UserId':Number(_0x140f2c[_0xde16('0x56')][_0xde16('0x68')][_0x21a1ae]),'SmsQueueId':Number(_0x140f2c[_0xde16('0x4d')]['id'])});}return _0x15e9a1;});}})[_0xde16('0x2d')](respondWithResult(_0x195a03,null))[_0xde16('0x4c')](handleError(_0x195a03,null));};exports[_0xde16('0x8c')]=function(_0x36fb7d,_0x3fe92c,_0x248b0a){return db[_0xde16('0x36')][_0xde16('0x4e')]({'where':{'id':_0x36fb7d[_0xde16('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3fe92c,null))[_0xde16('0x2d')](function(_0x1853f2){if(_0x1853f2){return _0x1853f2[_0xde16('0x8c')](_0x36fb7d[_0xde16('0x3b')]['ids'])[_0xde16('0x2d')](function(){if(_[_0xde16('0x8d')](_0x36fb7d[_0xde16('0x3b')]['ids'])){for(var _0x599dfe=0x0;_0x599dfe<_0x36fb7d[_0xde16('0x3b')][_0xde16('0x68')][_0xde16('0x41')];_0x599dfe+=0x1){socket[_0xde16('0x74')]('userSmsQueue:remove',{'UserId':Number(_0x36fb7d[_0xde16('0x3b')]['ids'][_0x599dfe]),'SmsQueueId':Number(_0x36fb7d['params']['id'])});}}else{socket[_0xde16('0x74')](_0xde16('0x88'),{'UserId':Number(_0x36fb7d[_0xde16('0x3b')][_0xde16('0x68')]),'SmsQueueId':Number(_0x36fb7d['params']['id'])});}});}})[_0xde16('0x2d')](respondWithStatusCode(_0x3fe92c,null))['catch'](handleError(_0x3fe92c,null));};exports[_0xde16('0x8e')]=function(_0x2091c0,_0x599789,_0x255b87){var _0x42cce6={};var _0xc977c8={};var _0x42cddb;var _0x47591e;return db[_0xde16('0x36')][_0xde16('0x67')]({'where':{'id':_0x2091c0[_0xde16('0x4d')]['id']}})[_0xde16('0x2d')](handleEntityNotFound(_0x599789,null))[_0xde16('0x2d')](function(_0x30d0fb){if(_0x30d0fb){_0x42cddb=_0x30d0fb;_0xc977c8[_0xde16('0x3a')]=_[_0xde16('0x3c')](db[_0xde16('0x5d')]['rawAttributes']);_0xc977c8['query']=_[_0xde16('0x3c')](_0x2091c0[_0xde16('0x3b')]);_0xc977c8[_0xde16('0x3d')]=_[_0xde16('0x3f')](_0xc977c8['model'],_0xc977c8['query']);_0x42cce6[_0xde16('0x3e')]=_[_0xde16('0x3f')](_0xc977c8['model'],qs[_0xde16('0x40')](_0x2091c0[_0xde16('0x3b')][_0xde16('0x40')]));_0x42cce6[_0xde16('0x3e')]=_0x42cce6[_0xde16('0x3e')][_0xde16('0x41')]?_0x42cce6['attributes']:_0xc977c8[_0xde16('0x3a')];_0x42cce6[_0xde16('0x42')]=qs[_0xde16('0x43')](_0x2091c0['query'][_0xde16('0x43')]);_0x42cce6[_0xde16('0x45')]=qs[_0xde16('0x3d')](_[_0xde16('0x5b')](_0x2091c0[_0xde16('0x3b')],_0xc977c8['filters']));if(_0x2091c0[_0xde16('0x3b')][_0xde16('0x44')]){_0x42cce6[_0xde16('0x45')]=_[_0xde16('0x46')](_0x42cce6['where'],{'$or':_['map'](_0x42cce6['attributes'],function(_0x3dc3f0){var _0x23ca9d={};_0x23ca9d[_0x3dc3f0]={'$like':'%'+_0x2091c0['query'][_0xde16('0x44')]+'%'};return _0x23ca9d;})});}_0x42cce6=_[_0xde16('0x46')]({},_0x42cce6,_0x2091c0['options']);return _0x42cddb[_0xde16('0x8e')](_0x42cce6);}})[_0xde16('0x2d')](function(_0xbf7658){if(_0xbf7658){_0x47591e=_0xbf7658[_0xde16('0x41')];if(!_0x2091c0[_0xde16('0x3b')]['hasOwnProperty'](_0xde16('0x5a'))){_0x42cce6[_0xde16('0x25')]=qs[_0xde16('0x25')](_0x2091c0[_0xde16('0x3b')][_0xde16('0x25')]);_0x42cce6[_0xde16('0x24')]=qs[_0xde16('0x24')](_0x2091c0[_0xde16('0x3b')][_0xde16('0x24')]);}return _0x42cddb[_0xde16('0x8e')](_0x42cce6);}})[_0xde16('0x2d')](function(_0x436be9){if(_0x436be9){return _0x436be9?{'count':_0x47591e,'rows':_0x436be9}:null;}})['then'](respondWithResult(_0x599789,null))[_0xde16('0x4c')](handleError(_0x599789,null));}; \ No newline at end of file +var _0x819e=['limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','create','describe','findOne','pick','UserSmsQueue','User','agent','smsPause','updatedAt','Team','getTeams','addTeams','Agents','interface','flatMap','sequelize','transaction','forEach','emit','userSmsQueue:save','removeTeams','ids','field','tq.TeamId','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','count','set','Content-Range','apply','save','update','then','get','SmsQueues','destroy','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x55df63,_0x26ee86){var _0x2843d7=function(_0xe8a97c){while(--_0xe8a97c){_0x55df63['push'](_0x55df63['shift']());}};_0x2843d7(++_0x26ee86);}(_0x819e,0x141));var _0xe819=function(_0xb2e670,_0x436e56){_0xb2e670=_0xb2e670-0x0;var _0x598b6b=_0x819e[_0xb2e670];return _0x598b6b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe819('0x0'));var zipdir=require(_0xe819('0x1'));var jsonpatch=require(_0xe819('0x2'));var rp=require('request-promise');var moment=require(_0xe819('0x3'));var BPromise=require(_0xe819('0x4'));var Mustache=require(_0xe819('0x5'));var util=require('util');var path=require(_0xe819('0x6'));var sox=require(_0xe819('0x7'));var csv=require(_0xe819('0x8'));var ejs=require(_0xe819('0x9'));var fs=require('fs');var fs_extra=require(_0xe819('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe819('0xb'));var jsforce=require(_0xe819('0xc'));var deskjs=require(_0xe819('0xd'));var toCsv=require(_0xe819('0x8'));var querystring=require(_0xe819('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe819('0xf'));var qs=require(_0xe819('0x10'));var as=require(_0xe819('0x11'));var hardwareService=require(_0xe819('0x12'));var logger=require(_0xe819('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xe819('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xe819('0x15')]=_[_0xe819('0x16')](config[_0xe819('0x15')],{'host':_0xe819('0x17'),'port':0x18eb});var socket=require(_0xe819('0x18'))(new Redis(config['redis']));require(_0xe819('0x19'))[_0xe819('0x1a')](socket);function respondWithStatusCode(_0x437492,_0x5883d7){_0x5883d7=_0x5883d7||0xcc;return function(_0x11ab31){if(_0x11ab31){return _0x437492[_0xe819('0x1b')](_0x5883d7);}return _0x437492[_0xe819('0x1c')](_0x5883d7)[_0xe819('0x1d')]();};}function respondWithResult(_0x38b7ab,_0x1afc3f){_0x1afc3f=_0x1afc3f||0xc8;return function(_0x4cf93a){if(_0x4cf93a){return _0x38b7ab[_0xe819('0x1c')](_0x1afc3f)[_0xe819('0x1e')](_0x4cf93a);}};}function respondWithFilteredResult(_0x4accb8,_0x518db3){return function(_0x5a7897){if(_0x5a7897){var _0x5d96f4=typeof _0x518db3[_0xe819('0x1f')]==='undefined'&&typeof _0x518db3['limit']==='undefined';var _0x47cf12=_0x5a7897['count'];var _0x28ea68=_0x5d96f4?0x0:_0x518db3[_0xe819('0x1f')];var _0x126c7e=_0x5d96f4?_0x5a7897[_0xe819('0x20')]:_0x518db3[_0xe819('0x1f')]+_0x518db3['limit'];var _0x1f9846;if(_0x126c7e>=_0x47cf12){_0x126c7e=_0x47cf12;_0x1f9846=0xc8;}else{_0x1f9846=0xce;}_0x4accb8['status'](_0x1f9846);return _0x4accb8[_0xe819('0x21')](_0xe819('0x22'),_0x28ea68+'-'+_0x126c7e+'/'+_0x47cf12)[_0xe819('0x1e')](_0x5a7897);}return null;};}function patchUpdates(_0x1cd463){return function(_0x207538){try{jsonpatch[_0xe819('0x23')](_0x207538,_0x1cd463,!![]);}catch(_0x1e6f14){return BPromise['reject'](_0x1e6f14);}return _0x207538[_0xe819('0x24')]();};}function saveUpdates(_0x38f502,_0x3e772e){return function(_0x2788e3){if(_0x2788e3){return _0x2788e3[_0xe819('0x25')](_0x38f502)[_0xe819('0x26')](function(_0x427ed2){return _0x427ed2;});}return null;};}function removeEntity(_0x39184e,_0x31bcf1){return function(_0x864afd){if(_0x864afd){return _0x864afd['destroy']()[_0xe819('0x26')](function(){var _0x4e2a19=_0x864afd[_0xe819('0x27')]({'plain':!![]});var _0x28f828=_0xe819('0x28');return db['UserProfileResource'][_0xe819('0x29')]({'where':{'type':_0x28f828,'resourceId':_0x4e2a19['id']}})[_0xe819('0x26')](function(){return _0x864afd;});})[_0xe819('0x26')](function(){_0x39184e[_0xe819('0x1c')](0xcc)[_0xe819('0x1d')]();});}};}function handleEntityNotFound(_0x5181cb,_0x4d30aa){return function(_0x2ca5a0){if(!_0x2ca5a0){_0x5181cb['sendStatus'](0x194);}return _0x2ca5a0;};}function handleError(_0x2cb391,_0x3d1364){_0x3d1364=_0x3d1364||0x1f4;return function(_0x1f50ca){logger[_0xe819('0x2a')](_0x1f50ca[_0xe819('0x2b')]);if(_0x1f50ca[_0xe819('0x2c')]){delete _0x1f50ca[_0xe819('0x2c')];}_0x2cb391[_0xe819('0x1c')](_0x3d1364)[_0xe819('0x2d')](_0x1f50ca);};}exports[_0xe819('0x2e')]=function(_0x14c7cf,_0x3638c1){var _0x46d2d2={},_0x22e245={},_0x5a8773={'count':0x0,'rows':[]};var _0x2add86=_[_0xe819('0x2f')](db[_0xe819('0x30')][_0xe819('0x31')],function(_0x4b8bfb){return{'name':_0x4b8bfb[_0xe819('0x32')],'type':_0x4b8bfb[_0xe819('0x33')][_0xe819('0x34')]};});_0x22e245[_0xe819('0x35')]=_[_0xe819('0x2f')](_0x2add86,_0xe819('0x2c'));_0x22e245['query']=_[_0xe819('0x36')](_0x14c7cf[_0xe819('0x37')]);_0x22e245[_0xe819('0x38')]=_['intersection'](_0x22e245[_0xe819('0x35')],_0x22e245[_0xe819('0x37')]);_0x46d2d2[_0xe819('0x39')]=_[_0xe819('0x3a')](_0x22e245[_0xe819('0x35')],qs[_0xe819('0x3b')](_0x14c7cf[_0xe819('0x37')][_0xe819('0x3b')]));_0x46d2d2[_0xe819('0x39')]=_0x46d2d2[_0xe819('0x39')][_0xe819('0x3c')]?_0x46d2d2[_0xe819('0x39')]:_0x22e245[_0xe819('0x35')];if(!_0x14c7cf[_0xe819('0x37')][_0xe819('0x3d')](_0xe819('0x3e'))){_0x46d2d2[_0xe819('0x3f')]=qs[_0xe819('0x3f')](_0x14c7cf[_0xe819('0x37')]['limit']);_0x46d2d2[_0xe819('0x1f')]=qs['offset'](_0x14c7cf[_0xe819('0x37')][_0xe819('0x1f')]);}_0x46d2d2[_0xe819('0x40')]=qs['sort'](_0x14c7cf[_0xe819('0x37')][_0xe819('0x41')]);_0x46d2d2[_0xe819('0x42')]=qs[_0xe819('0x38')](_['pick'](_0x14c7cf['query'],_0x22e245[_0xe819('0x38')]),_0x2add86);if(_0x14c7cf[_0xe819('0x37')][_0xe819('0x43')]){_0x46d2d2[_0xe819('0x42')]=_[_0xe819('0x44')](_0x46d2d2['where'],{'$or':_[_0xe819('0x2f')](_0x2add86,function(_0x120450){if(_0x120450[_0xe819('0x33')]!==_0xe819('0x45')){var _0xede277={};_0xede277[_0x120450['name']]={'$like':'%'+_0x14c7cf[_0xe819('0x37')]['filter']+'%'};return _0xede277;}})});}_0x46d2d2=_[_0xe819('0x44')]({},_0x46d2d2,_0x14c7cf[_0xe819('0x46')]);var _0x307cf0={'where':_0x46d2d2[_0xe819('0x42')]};return db['SmsQueue']['count'](_0x307cf0)[_0xe819('0x26')](function(_0x5e5947){_0x5a8773[_0xe819('0x20')]=_0x5e5947;if(_0x14c7cf[_0xe819('0x37')][_0xe819('0x47')]){_0x46d2d2[_0xe819('0x48')]=[{'all':!![]}];}return db[_0xe819('0x30')][_0xe819('0x49')](_0x46d2d2);})['then'](function(_0x319603){_0x5a8773[_0xe819('0x4a')]=_0x319603;return _0x5a8773;})[_0xe819('0x26')](respondWithFilteredResult(_0x3638c1,_0x46d2d2))[_0xe819('0x4b')](handleError(_0x3638c1,null));};exports[_0xe819('0x4c')]=function(_0x5beed9,_0x53eaa5){var _0x45af12={'raw':!![],'where':{'id':_0x5beed9[_0xe819('0x4d')]['id']}},_0x11c389={};_0x11c389[_0xe819('0x35')]=_[_0xe819('0x36')](db['SmsQueue'][_0xe819('0x31')]);_0x11c389[_0xe819('0x37')]=_[_0xe819('0x36')](_0x5beed9[_0xe819('0x37')]);_0x11c389[_0xe819('0x38')]=_[_0xe819('0x3a')](_0x11c389[_0xe819('0x35')],_0x11c389[_0xe819('0x37')]);_0x45af12[_0xe819('0x39')]=_[_0xe819('0x3a')](_0x11c389['model'],qs['fields'](_0x5beed9[_0xe819('0x37')][_0xe819('0x3b')]));_0x45af12[_0xe819('0x39')]=_0x45af12[_0xe819('0x39')]['length']?_0x45af12[_0xe819('0x39')]:_0x11c389[_0xe819('0x35')];if(_0x5beed9[_0xe819('0x37')]['includeAll']){_0x45af12[_0xe819('0x48')]=[{'all':!![]}];}_0x45af12=_[_0xe819('0x44')]({},_0x45af12,_0x5beed9[_0xe819('0x46')]);return db[_0xe819('0x30')]['find'](_0x45af12)['then'](handleEntityNotFound(_0x53eaa5,null))[_0xe819('0x26')](respondWithResult(_0x53eaa5,null))[_0xe819('0x4b')](handleError(_0x53eaa5,null));};exports['create']=function(_0x4f515a,_0xcd909f){return db['SmsQueue']['create'](_0x4f515a[_0xe819('0x4e')],{})[_0xe819('0x26')](function(_0xd7b3a5){var _0x2532e3=_0x4f515a[_0xe819('0x4f')][_0xe819('0x27')]({'plain':!![]});if(!_0x2532e3)throw new Error(_0xe819('0x50'));if(_0x2532e3['role']===_0xe819('0x4f')){var _0x54678d=_0xd7b3a5[_0xe819('0x27')]({'plain':!![]});var _0x40701d=_0xe819('0x28');return db['UserProfileSection'][_0xe819('0x51')]({'where':{'name':_0x40701d,'userProfileId':_0x2532e3[_0xe819('0x52')]},'raw':!![]})['then'](function(_0x246cf9){if(_0x246cf9&&_0x246cf9[_0xe819('0x53')]===0x0){return db['UserProfileResource'][_0xe819('0x54')]({'name':_0x54678d[_0xe819('0x2c')],'resourceId':_0x54678d['id'],'type':_0x246cf9[_0xe819('0x2c')],'sectionId':_0x246cf9['id']},{})['then'](function(){return _0xd7b3a5;});}else{return _0xd7b3a5;}})['catch'](function(_0x3934cc){logger[_0xe819('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3934cc);throw _0x3934cc;});}return _0xd7b3a5;})['then'](respondWithResult(_0xcd909f,0xc9))['catch'](handleError(_0xcd909f,null));};exports['update']=function(_0x54b0bd,_0x175747){if(_0x54b0bd[_0xe819('0x4e')]['id']){delete _0x54b0bd[_0xe819('0x4e')]['id'];}return db[_0xe819('0x30')][_0xe819('0x51')]({'where':{'id':_0x54b0bd[_0xe819('0x4d')]['id']}})[_0xe819('0x26')](handleEntityNotFound(_0x175747,null))['then'](saveUpdates(_0x54b0bd[_0xe819('0x4e')],null))[_0xe819('0x26')](respondWithResult(_0x175747,null))[_0xe819('0x4b')](handleError(_0x175747,null));};exports[_0xe819('0x29')]=function(_0x42ce26,_0x445119){return db['SmsQueue'][_0xe819('0x51')]({'where':{'id':_0x42ce26[_0xe819('0x4d')]['id']}})['then'](handleEntityNotFound(_0x445119,null))['then'](removeEntity(_0x445119,null))[_0xe819('0x4b')](handleError(_0x445119,null));};exports[_0xe819('0x55')]=function(_0x417891,_0x347a1e){return db[_0xe819('0x30')][_0xe819('0x55')]()[_0xe819('0x26')](respondWithResult(_0x347a1e,null))[_0xe819('0x4b')](handleError(_0x347a1e,null));};exports['getMembers']=function(_0x16c31f,_0x211514,_0xdf80f0){var _0x53af42={'raw':!![],'where':{}},_0x18662c={},_0x3afb64;return db[_0xe819('0x30')][_0xe819('0x56')]({'where':{'id':_0x16c31f[_0xe819('0x4d')]['id']}})[_0xe819('0x26')](handleEntityNotFound(_0x211514,null))['then'](function(_0x4b2ce9){if(_0x4b2ce9){_0x3afb64=_0x4b2ce9[_0xe819('0x27')]({'plain':!![]});_0x18662c[_0xe819('0x35')]=_[_0xe819('0x36')](db['UserSmsQueue'][_0xe819('0x31')]);_0x18662c['query']=_[_0xe819('0x36')](_0x16c31f[_0xe819('0x37')]);_0x18662c[_0xe819('0x38')]=_[_0xe819('0x3a')](_0x18662c['model'],_0x18662c[_0xe819('0x37')]);_0x53af42['attributes']=_[_0xe819('0x3a')](_0x18662c[_0xe819('0x35')],qs[_0xe819('0x3b')](_0x16c31f[_0xe819('0x37')]['fields']));_0x53af42[_0xe819('0x39')]=_0x53af42['attributes'][_0xe819('0x3c')]?_0x53af42[_0xe819('0x39')]:_0x18662c[_0xe819('0x35')];if(!_0x16c31f['query']['hasOwnProperty']('nolimit')){_0x53af42[_0xe819('0x3f')]=qs[_0xe819('0x3f')](_0x16c31f[_0xe819('0x37')]['limit']);_0x53af42[_0xe819('0x1f')]=qs['offset'](_0x16c31f[_0xe819('0x37')][_0xe819('0x1f')]);}_0x53af42[_0xe819('0x40')]=qs[_0xe819('0x41')](_0x16c31f[_0xe819('0x37')][_0xe819('0x41')]);_0x53af42['where']=qs['filters'](_[_0xe819('0x57')](_0x16c31f[_0xe819('0x37')],_0x18662c[_0xe819('0x38')]));_0x53af42[_0xe819('0x42')]['SmsQueueId']=_0x4b2ce9['id'];if(_0x16c31f[_0xe819('0x37')][_0xe819('0x43')]){_0x53af42[_0xe819('0x42')]=_[_0xe819('0x44')](_0x53af42['where'],{'$or':_[_0xe819('0x2f')](_0x53af42[_0xe819('0x39')],function(_0x169212){var _0x385b1b={};_0x385b1b[_0x169212]={'$like':'%'+_0x16c31f['query'][_0xe819('0x43')]+'%'};return _0x385b1b;})});}_0x53af42=_[_0xe819('0x44')]({},_0x53af42,_0x16c31f[_0xe819('0x46')]);return db[_0xe819('0x58')][_0xe819('0x49')](_0x53af42);}})[_0xe819('0x26')](function(_0xe186f1){if(_0xe186f1){return db[_0xe819('0x59')]['findAndCountAll']({'where':{'id':_['map'](_0xe186f1,'UserId'),'role':_0xe819('0x5a')},'attributes':['id',_0xe819('0x2c'),_0xe819('0x5b'),_0xe819('0x5c'),'createdAt']});}})[_0xe819('0x26')](function(_0x3c8cdf){if(_0x3c8cdf){return{'count':_0x3c8cdf['count'],'rows':_[_0xe819('0x2f')](_0x3c8cdf['rows'],function(_0x41f28b){return{'membername':_0x41f28b['name'],'UserId':_0x41f28b['id'],'queue_name':_0x3afb64[_0xe819('0x2c')],'SmsQueueId':_0x3afb64['id'],'interface':util['format']('%s/%s','SIP',_0x41f28b[_0xe819('0x2c')]),'penalty':0x0,'paused':_0x41f28b[_0xe819('0x5b')],'createdAt':_0x41f28b['createdAt'],'updatedAt':_0x41f28b[_0xe819('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x211514,_0x53af42))[_0xe819('0x4b')](handleError(_0x211514,null));};exports['getTeams']=function(_0x57bc48,_0x5e1c9b,_0x150763){var _0x573e63={};var _0x160e1a={};var _0x31fde2;var _0x1c6dce;return db[_0xe819('0x30')][_0xe819('0x56')]({'where':{'id':_0x57bc48[_0xe819('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5e1c9b,null))[_0xe819('0x26')](function(_0x6719b8){if(_0x6719b8){_0x31fde2=_0x6719b8;_0x160e1a[_0xe819('0x35')]=_['keys'](db[_0xe819('0x5d')][_0xe819('0x31')]);_0x160e1a[_0xe819('0x37')]=_[_0xe819('0x36')](_0x57bc48[_0xe819('0x37')]);_0x160e1a[_0xe819('0x38')]=_['intersection'](_0x160e1a['model'],_0x160e1a[_0xe819('0x37')]);_0x573e63[_0xe819('0x39')]=_['intersection'](_0x160e1a[_0xe819('0x35')],qs[_0xe819('0x3b')](_0x57bc48[_0xe819('0x37')]['fields']));_0x573e63[_0xe819('0x39')]=_0x573e63[_0xe819('0x39')]['length']?_0x573e63[_0xe819('0x39')]:_0x160e1a[_0xe819('0x35')];_0x573e63['order']=qs[_0xe819('0x41')](_0x57bc48[_0xe819('0x37')][_0xe819('0x41')]);_0x573e63['where']=qs[_0xe819('0x38')](_[_0xe819('0x57')](_0x57bc48['query'],_0x160e1a[_0xe819('0x38')]));if(_0x57bc48[_0xe819('0x37')][_0xe819('0x43')]){_0x573e63[_0xe819('0x42')]=_[_0xe819('0x44')](_0x573e63[_0xe819('0x42')],{'$or':_['map'](_0x573e63[_0xe819('0x39')],function(_0x33ee28){var _0x2aa90f={};_0x2aa90f[_0x33ee28]={'$like':'%'+_0x57bc48[_0xe819('0x37')][_0xe819('0x43')]+'%'};return _0x2aa90f;})});}_0x573e63=_[_0xe819('0x44')]({},_0x573e63,_0x57bc48[_0xe819('0x46')]);return _0x31fde2[_0xe819('0x5e')](_0x573e63);}})[_0xe819('0x26')](function(_0x2a02e4){if(_0x2a02e4){_0x1c6dce=_0x2a02e4[_0xe819('0x3c')];if(!_0x57bc48['query'][_0xe819('0x3d')](_0xe819('0x3e'))){_0x573e63[_0xe819('0x3f')]=qs[_0xe819('0x3f')](_0x57bc48[_0xe819('0x37')][_0xe819('0x3f')]);_0x573e63[_0xe819('0x1f')]=qs[_0xe819('0x1f')](_0x57bc48[_0xe819('0x37')][_0xe819('0x1f')]);}return _0x31fde2['getTeams'](_0x573e63);}})['then'](function(_0x3ae820){if(_0x3ae820){return _0x3ae820?{'count':_0x1c6dce,'rows':_0x3ae820}:null;}})[_0xe819('0x26')](respondWithResult(_0x5e1c9b,null))['catch'](handleError(_0x5e1c9b,null));};exports[_0xe819('0x5f')]=function(_0x29a1fe,_0x542234,_0x2daffc){var _0x30ddbe=_0x29a1fe['body']['ids'];return db[_0xe819('0x5d')][_0xe819('0x49')]({'where':{'id':_0x30ddbe},'attributes':['id'],'include':[{'model':db[_0xe819('0x59')],'as':_0xe819('0x60'),'attributes':['id',_0xe819('0x2c'),'online','voicePause',_0xe819('0x61')],'raw':!![]}]})['then'](function(_0x25228a){if(_0x25228a){var _0x3622dd=_[_0xe819('0x62')](_0x25228a,function(_0x11ca62){var _0xaab4f7=_0x11ca62['get']({'plain':!![]});return _0xaab4f7['Agents'];});return db[_0xe819('0x30')]['find']({'where':{'id':_0x29a1fe['params']['id']}})[_0xe819('0x26')](function(_0x8379c6){return db[_0xe819('0x63')][_0xe819('0x64')](function(_0x5d1eec){return _0x8379c6[_0xe819('0x5f')](_0x30ddbe,{'transaction':_0x5d1eec})[_0xe819('0x26')](function(){return BPromise['each'](_0x3622dd,function(_0x31205c){return db[_0xe819('0x58')]['findOrCreate']({'where':{'UserId':_0x31205c['id'],'SmsQueueId':_0x29a1fe[_0xe819('0x4d')]['id']},'transaction':_0x5d1eec});});})['then'](function(){_0x3622dd[_0xe819('0x65')](function(_0xbce280){socket[_0xe819('0x66')](_0xe819('0x67'),{'UserId':_0xbce280['id'],'SmsQueueId':_0x8379c6['id']});});});});});}})[_0xe819('0x26')](respondWithStatusCode(_0x542234,null))[_0xe819('0x4b')](handleError(_0x542234,null));};exports[_0xe819('0x68')]=function(_0x3c5a9c,_0x2049f0,_0x319ce8){return db[_0xe819('0x5d')][_0xe819('0x49')]({'where':{'id':_0x3c5a9c[_0xe819('0x37')][_0xe819('0x69')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe819('0x60'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2049f0,null))['then'](function(_0x2f1126){var _0x37211b=_[_0xe819('0x2f')](_0x2f1126,'id');var _0x130a48=[];var _0x127a49=[];var _0x5b86d5=squel['select']();_0x5b86d5[_0xe819('0x6a')](_0xe819('0x6b'))['from']('team_has_sms_queues','tq')['join'](_0xe819('0x6c'),'ut',_0xe819('0x6d'))['where'](_0xe819('0x6e'),_0x3c5a9c[_0xe819('0x4d')]['id']);for(var _0x544a21=0x0;_0x544a21<_0x2f1126[_0xe819('0x3c')];_0x544a21+=0x1){let _0x1c0eed=_0x2f1126[_0x544a21];for(var _0x476e12=0x0;_0x476e12<_0x1c0eed[_0xe819('0x60')]['length'];_0x476e12+=0x1){let _0x257f05=_0x1c0eed[_0xe819('0x60')][_0x476e12];var _0x3465b9=_0x5b86d5['clone']();_0x3465b9[_0xe819('0x42')](_0xe819('0x6f'),_0x257f05['id']);_0x127a49[_0xe819('0x70')](db['sequelize']['query'](_0x3465b9[_0xe819('0x71')](),{'type':db[_0xe819('0x63')][_0xe819('0x72')][_0xe819('0x73')]})[_0xe819('0x26')](function(_0x2f4e4){if(_0x2f4e4[_0xe819('0x3c')]===0x1){return _0x257f05['id'];}else{var _0x438536=_[_0xe819('0x74')](_[_0xe819('0x2f')](_0x2f4e4,_0xe819('0x75')),function(_0x4b991f){return _[_0xe819('0x76')](_0x37211b,_0x4b991f);});if(_0x438536){return _0x257f05['id'];}}}));}}return BPromise[_0xe819('0x77')](_0x127a49)[_0xe819('0x26')](function(_0x249f44){_0x130a48=_(_0x130a48)['union'](_0x249f44)[_0xe819('0x78')]()['value']();return db['SmsQueue'][_0xe819('0x51')]({'where':{'id':_0x3c5a9c['params']['id']}})['then'](function(_0x3adf71){return db[_0xe819('0x63')]['transaction'](function(_0x3c43de){return _0x3adf71[_0xe819('0x68')](_0x3c5a9c['query'][_0xe819('0x69')],{'transaction':_0x3c43de})['then'](function(){if(!_[_0xe819('0x79')](_0x130a48)){return _0x3adf71[_0xe819('0x7a')](_0x130a48,{'transaction':_0x3c43de});}})[_0xe819('0x26')](function(){_0x130a48['forEach'](function(_0x37f98d){socket['emit'](_0xe819('0x7b'),{'UserId':_0x37f98d,'SmsQueueId':_0x3adf71['id']});});});});});});})['then'](respondWithStatusCode(_0x2049f0,null))[_0xe819('0x4b')](handleError(_0x2049f0,null));};exports[_0xe819('0x7c')]=function(_0xde1953,_0x24ff84,_0x3d7ff8){return db[_0xe819('0x30')]['find']({'where':{'id':_0xde1953[_0xe819('0x4d')]['id']}})['then'](handleEntityNotFound(_0x24ff84,null))[_0xe819('0x26')](function(_0x1e68a8){if(_0x1e68a8){return _0x1e68a8[_0xe819('0x7c')](_0xde1953[_0xe819('0x4e')][_0xe819('0x69')],_['omit'](_0xde1953[_0xe819('0x4e')],[_0xe819('0x69'),'id'])||{})[_0xe819('0x7d')](function(_0x436380){for(var _0x4b1a0e=0x0;_0x4b1a0e<_0xde1953['body'][_0xe819('0x69')][_0xe819('0x3c')];_0x4b1a0e+=0x1){socket[_0xe819('0x66')](_0xe819('0x67'),{'UserId':Number(_0xde1953[_0xe819('0x4e')][_0xe819('0x69')][_0x4b1a0e]),'SmsQueueId':Number(_0xde1953[_0xe819('0x4d')]['id'])});}return _0x436380;});}})[_0xe819('0x26')](respondWithResult(_0x24ff84,null))[_0xe819('0x4b')](handleError(_0x24ff84,null));};exports[_0xe819('0x7a')]=function(_0x17243a,_0x21a83d,_0xa6b0fb){return db['SmsQueue'][_0xe819('0x51')]({'where':{'id':_0x17243a[_0xe819('0x4d')]['id']}})[_0xe819('0x26')](handleEntityNotFound(_0x21a83d,null))[_0xe819('0x26')](function(_0x1346dc){if(_0x1346dc){return _0x1346dc[_0xe819('0x7a')](_0x17243a['query'][_0xe819('0x69')])[_0xe819('0x26')](function(){if(_[_0xe819('0x7e')](_0x17243a[_0xe819('0x37')][_0xe819('0x69')])){for(var _0x3f764e=0x0;_0x3f764e<_0x17243a[_0xe819('0x37')][_0xe819('0x69')][_0xe819('0x3c')];_0x3f764e+=0x1){socket[_0xe819('0x66')](_0xe819('0x7b'),{'UserId':Number(_0x17243a[_0xe819('0x37')][_0xe819('0x69')][_0x3f764e]),'SmsQueueId':Number(_0x17243a['params']['id'])});}}else{socket[_0xe819('0x66')]('userSmsQueue:remove',{'UserId':Number(_0x17243a[_0xe819('0x37')]['ids']),'SmsQueueId':Number(_0x17243a[_0xe819('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x21a83d,null))['catch'](handleError(_0x21a83d,null));};exports[_0xe819('0x7f')]=function(_0x41a290,_0x253cd4,_0x4a5486){var _0x560654={};var _0x16ad4c={};var _0x4a9a68;var _0xc35ef6;return db['SmsQueue'][_0xe819('0x56')]({'where':{'id':_0x41a290[_0xe819('0x4d')]['id']}})[_0xe819('0x26')](handleEntityNotFound(_0x253cd4,null))[_0xe819('0x26')](function(_0x9fb9c6){if(_0x9fb9c6){_0x4a9a68=_0x9fb9c6;_0x16ad4c['model']=_[_0xe819('0x36')](db[_0xe819('0x59')]['rawAttributes']);_0x16ad4c['query']=_[_0xe819('0x36')](_0x41a290[_0xe819('0x37')]);_0x16ad4c[_0xe819('0x38')]=_[_0xe819('0x3a')](_0x16ad4c[_0xe819('0x35')],_0x16ad4c[_0xe819('0x37')]);_0x560654['attributes']=_[_0xe819('0x3a')](_0x16ad4c[_0xe819('0x35')],qs['fields'](_0x41a290['query'][_0xe819('0x3b')]));_0x560654[_0xe819('0x39')]=_0x560654[_0xe819('0x39')][_0xe819('0x3c')]?_0x560654[_0xe819('0x39')]:_0x16ad4c[_0xe819('0x35')];_0x560654[_0xe819('0x40')]=qs[_0xe819('0x41')](_0x41a290[_0xe819('0x37')]['sort']);_0x560654[_0xe819('0x42')]=qs[_0xe819('0x38')](_[_0xe819('0x57')](_0x41a290[_0xe819('0x37')],_0x16ad4c[_0xe819('0x38')]));if(_0x41a290[_0xe819('0x37')][_0xe819('0x43')]){_0x560654[_0xe819('0x42')]=_['merge'](_0x560654[_0xe819('0x42')],{'$or':_[_0xe819('0x2f')](_0x560654['attributes'],function(_0x45aa8e){var _0x27fcbb={};_0x27fcbb[_0x45aa8e]={'$like':'%'+_0x41a290[_0xe819('0x37')][_0xe819('0x43')]+'%'};return _0x27fcbb;})});}_0x560654=_[_0xe819('0x44')]({},_0x560654,_0x41a290[_0xe819('0x46')]);return _0x4a9a68[_0xe819('0x7f')](_0x560654);}})[_0xe819('0x26')](function(_0x193d88){if(_0x193d88){_0xc35ef6=_0x193d88[_0xe819('0x3c')];if(!_0x41a290[_0xe819('0x37')]['hasOwnProperty'](_0xe819('0x3e'))){_0x560654['limit']=qs[_0xe819('0x3f')](_0x41a290[_0xe819('0x37')][_0xe819('0x3f')]);_0x560654[_0xe819('0x1f')]=qs[_0xe819('0x1f')](_0x41a290['query']['offset']);}return _0x4a9a68[_0xe819('0x7f')](_0x560654);}})['then'](function(_0x219d9d){if(_0x219d9d){return _0x219d9d?{'count':_0xc35ef6,'rows':_0x219d9d}:null;}})[_0xe819('0x26')](respondWithResult(_0x253cd4,null))['catch'](handleError(_0x253cd4,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index e3055dc..a45e818 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 _0x5023=['update','remove','emit','hasOwnProperty','exports','events','SmsQueue','save'];(function(_0x53dd4f,_0x1d4ec6){var _0x4eb08=function(_0x4b2c9d){while(--_0x4b2c9d){_0x53dd4f['push'](_0x53dd4f['shift']());}};_0x4eb08(++_0x1d4ec6);}(_0x5023,0x105));var _0x3502=function(_0x3193e0,_0x18ba65){_0x3193e0=_0x3193e0-0x0;var _0x36ebed=_0x5023[_0x3193e0];return _0x36ebed;};'use strict';var EventEmitter=require(_0x3502('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x3502('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3502('0x2'),'afterUpdate':_0x3502('0x3'),'afterDestroy':_0x3502('0x4')};function emitEvent(_0x1f517a){return function(_0x9cad59,_0x17b2da,_0x901a70){SmsQueueEvents[_0x3502('0x5')](_0x1f517a+':'+_0x9cad59['id'],_0x9cad59);SmsQueueEvents[_0x3502('0x5')](_0x1f517a,_0x9cad59);_0x901a70(null);};}for(var e in events){if(events[_0x3502('0x6')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x3502('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0xda5e=['events','../../mysqldb','SmsQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2fd608,_0x5670ae){var _0x54f2e8=function(_0x176987){while(--_0x176987){_0x2fd608['push'](_0x2fd608['shift']());}};_0x54f2e8(++_0x5670ae);}(_0xda5e,0xfd));var _0xeda5=function(_0x38d74a,_0x50c071){_0x38d74a=_0x38d74a-0x0;var _0x2f7a94=_0xda5e[_0x38d74a];return _0x2f7a94;};'use strict';var EventEmitter=require(_0xeda5('0x0'));var SmsQueue=require(_0xeda5('0x1'))['db'][_0xeda5('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xeda5('0x3')](0x0);var events={'afterCreate':_0xeda5('0x4'),'afterUpdate':_0xeda5('0x5'),'afterDestroy':_0xeda5('0x6')};function emitEvent(_0x229f92){return function(_0x587f5c,_0x5c7fa5,_0x4ef595){SmsQueueEvents['emit'](_0x229f92+':'+_0x587f5c['id'],_0x587f5c);SmsQueueEvents[_0xeda5('0x7')](_0x229f92,_0x587f5c);_0x4ef595(null);};}for(var e in events){if(events[_0xeda5('0x8')](e)){var event=events[e];SmsQueue[_0xeda5('0x9')](e,emitEvent(event));}}module[_0xeda5('0xa')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index b9dc645..b4ff562 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 _0x914c=['api','bluebird','rimraf','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util'];(function(_0x3316ab,_0x2e8e60){var _0x2611e6=function(_0x3b83a6){while(--_0x3b83a6){_0x3316ab['push'](_0x3316ab['shift']());}};_0x2611e6(++_0x2e8e60);}(_0x914c,0x6c));var _0xc914=function(_0x1249f4,_0x27226c){_0x1249f4=_0x1249f4-0x0;var _0x47c8a9=_0x914c[_0x1249f4];return _0x47c8a9;};'use strict';var _=require(_0xc914('0x0'));var util=require(_0xc914('0x1'));var logger=require('../../config/logger')(_0xc914('0x2'));var moment=require('moment');var BPromise=require(_0xc914('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc914('0x4'));var config=require('../../config/environment');var attributes=require(_0xc914('0x5'));module[_0xc914('0x6')]=function(_0x59425c,_0x2f8de8){return _0x59425c[_0xc914('0x7')](_0xc914('0x8'),attributes,{'tableName':_0xc914('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x48c7=['SmsQueue','sms_queues','lodash','util','api','moment','bluebird','request-promise','path','./smsQueue.attributes','define'];(function(_0x3932f2,_0x1920d0){var _0x16cf7e=function(_0xfa57c6){while(--_0xfa57c6){_0x3932f2['push'](_0x3932f2['shift']());}};_0x16cf7e(++_0x1920d0);}(_0x48c7,0x1f1));var _0x748c=function(_0xf10840,_0xad3916){_0xf10840=_0xf10840-0x0;var _0x1fdf7e=_0x48c7[_0xf10840];return _0x1fdf7e;};'use strict';var _=require(_0x748c('0x0'));var util=require(_0x748c('0x1'));var logger=require('../../config/logger')(_0x748c('0x2'));var moment=require(_0x748c('0x3'));var BPromise=require(_0x748c('0x4'));var rp=require(_0x748c('0x5'));var fs=require('fs');var path=require(_0x748c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x748c('0x7'));module['exports']=function(_0x1e6744,_0x8fb3f3){return _0x1e6744[_0x748c('0x8')](_0x748c('0x9'),attributes,{'tableName':_0x748c('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 c99db4f..369c60a 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 _0x325f=['./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','map','include','model','stringify','ShowSmsQueue','find','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter'];(function(_0xa98302,_0x844f27){var _0x1ad8e3=function(_0x57e51d){while(--_0x57e51d){_0xa98302['push'](_0xa98302['shift']());}};_0x1ad8e3(++_0x844f27);}(_0x325f,0x105));var _0xf325=function(_0x34d7d3,_0x301c15){_0x34d7d3=_0x34d7d3-0x0;var _0x2f04e3=_0x325f[_0x34d7d3];return _0x2f04e3;};'use strict';var _=require(_0xf325('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf325('0x1'));var rs=require(_0xf325('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf325('0x3'))['db'];var utils=require(_0xf325('0x4'));var logger=require(_0xf325('0x5'))(_0xf325('0x6'));var config=require('../../config/environment');var jayson=require(_0xf325('0x7'));var client=jayson[_0xf325('0x8')][_0xf325('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xf325('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xf325('0xb'))(new Redis(config[_0xf325('0xa')]));require(_0xf325('0xc'))[_0xf325('0xd')](socket);function respondWithRpcPromise(_0x2e65b6,_0x34e5e8,_0x19506a){return new BPromise(function(_0x4512f0,_0x3fad77){return client[_0xf325('0xe')](_0x2e65b6,_0x19506a)[_0xf325('0xf')](function(_0x4c4933){logger[_0xf325('0x10')](_0xf325('0x11'),_0x34e5e8,_0xf325('0x12'));logger[_0xf325('0x13')](_0xf325('0x14'),_0x34e5e8,_0xf325('0x12'),JSON['stringify'](_0x4c4933));if(_0x4c4933[_0xf325('0x15')]){if(_0x4c4933[_0xf325('0x15')][_0xf325('0x16')]===0x1f4){logger[_0xf325('0x15')](_0xf325('0x11'),_0x34e5e8,_0x4c4933[_0xf325('0x15')]['message']);return _0x3fad77(_0x4c4933['error']['message']);}logger[_0xf325('0x15')](_0xf325('0x11'),_0x34e5e8,_0x4c4933[_0xf325('0x15')][_0xf325('0x17')]);return _0x4512f0(_0x4c4933[_0xf325('0x15')]['message']);}else{logger[_0xf325('0x10')](_0xf325('0x11'),_0x34e5e8,_0xf325('0x12'));_0x4512f0(_0x4c4933['result'][_0xf325('0x17')]);}})[_0xf325('0x18')](function(_0x31c784){logger['error'](_0xf325('0x11'),_0x34e5e8,_0x31c784);_0x3fad77(_0x31c784);});});}exports[_0xf325('0x19')]=function(_0x53872a){var _0x43aa7c=this;return new Promise(function(_0x2ab046,_0x4a794d){return db[_0xf325('0x1a')][_0xf325('0x1b')]({'raw':_0x53872a[_0xf325('0x1c')]?_0x53872a['options'][_0xf325('0x1d')]===undefined?!![]:![]:!![],'where':_0x53872a[_0xf325('0x1c')]?_0x53872a['options'][_0xf325('0x1e')]||null:null,'attributes':_0x53872a[_0xf325('0x1c')]?_0x53872a['options'][_0xf325('0x1f')]||null:null,'limit':_0x53872a[_0xf325('0x1c')]?_0x53872a[_0xf325('0x1c')][_0xf325('0x20')]||null:null,'include':_0x53872a[_0xf325('0x1c')]?_0x53872a[_0xf325('0x1c')]['include']?_[_0xf325('0x21')](_0x53872a[_0xf325('0x1c')][_0xf325('0x22')],function(_0x49ab68){return{'model':db[_0x49ab68['model']],'as':_0x49ab68['as'],'attributes':_0x49ab68[_0xf325('0x1f')],'include':_0x49ab68[_0xf325('0x22')]?_[_0xf325('0x21')](_0x49ab68[_0xf325('0x22')],function(_0x4d2ecc){return{'model':db[_0x4d2ecc[_0xf325('0x23')]],'as':_0x4d2ecc['as'],'attributes':_0x4d2ecc[_0xf325('0x1f')],'include':_0x4d2ecc[_0xf325('0x22')]?_[_0xf325('0x21')](_0x4d2ecc[_0xf325('0x22')],function(_0xb3841e){return{'model':db[_0xb3841e['model']],'as':_0xb3841e['as'],'attributes':_0xb3841e[_0xf325('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf325('0xf')](function(_0x2ce7f2){logger[_0xf325('0x10')](_0xf325('0x19'),_0x53872a);logger[_0xf325('0x13')]('GetSmsQueue',_0x53872a,JSON[_0xf325('0x24')](_0x2ce7f2));_0x2ab046(_0x2ce7f2);})['catch'](function(_0x5e14d8){logger[_0xf325('0x15')]('GetSmsQueue',_0x5e14d8[_0xf325('0x17')],_0x53872a);_0x4a794d(_0x43aa7c['error'](0x1f4,_0x5e14d8[_0xf325('0x17')]));});});};exports[_0xf325('0x25')]=function(_0x48ba79){var _0x55b4b0=this;return new Promise(function(_0x40c398,_0x40de48){return db[_0xf325('0x1a')][_0xf325('0x26')]({'raw':_0x48ba79[_0xf325('0x1c')]?_0x48ba79[_0xf325('0x1c')][_0xf325('0x1d')]===undefined?!![]:![]:!![],'where':_0x48ba79[_0xf325('0x1c')]?_0x48ba79['options'][_0xf325('0x1e')]||null:null,'attributes':_0x48ba79['options']?_0x48ba79[_0xf325('0x1c')][_0xf325('0x1f')]||null:null,'include':_0x48ba79['options']?_0x48ba79[_0xf325('0x1c')]['include']?_[_0xf325('0x21')](_0x48ba79['options'][_0xf325('0x22')],function(_0x503625){return{'model':db[_0x503625['model']],'as':_0x503625['as'],'attributes':_0x503625['attributes'],'include':_0x503625['include']?_['map'](_0x503625[_0xf325('0x22')],function(_0x1cb538){return{'model':db[_0x1cb538['model']],'as':_0x1cb538['as'],'attributes':_0x1cb538[_0xf325('0x1f')],'include':_0x1cb538['include']?_[_0xf325('0x21')](_0x1cb538['include'],function(_0x287a93){return{'model':db[_0x287a93[_0xf325('0x23')]],'as':_0x287a93['as'],'attributes':_0x287a93[_0xf325('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf325('0xf')](function(_0x1c2049){logger[_0xf325('0x10')](_0xf325('0x25'),_0x48ba79);logger[_0xf325('0x13')](_0xf325('0x25'),_0x48ba79,JSON[_0xf325('0x24')](_0x1c2049));_0x40c398(_0x1c2049);})['catch'](function(_0x611d93){logger[_0xf325('0x15')]('ShowSmsQueue',_0x611d93[_0xf325('0x17')],_0x48ba79);_0x40de48(_0x55b4b0[_0xf325('0x15')](0x1f4,_0x611d93[_0xf325('0x17')]));});});}; \ No newline at end of file +var _0x248d=['find','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','request','info','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','result','catch','SmsQueue','findAll','options','raw','where','limit','include','model','attributes','map','then','GetSmsQueue','debug','ShowSmsQueue'];(function(_0x134192,_0x36adc5){var _0x3cd080=function(_0x134371){while(--_0x134371){_0x134192['push'](_0x134192['shift']());}};_0x3cd080(++_0x36adc5);}(_0x248d,0x17b));var _0xd248=function(_0x5e4735,_0x537029){_0x5e4735=_0x5e4735-0x0;var _0x5ae2ed=_0x248d[_0x5e4735];return _0x5ae2ed;};'use strict';var _=require(_0xd248('0x0'));var util=require(_0xd248('0x1'));var moment=require(_0xd248('0x2'));var BPromise=require('bluebird');var rs=require(_0xd248('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd248('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd248('0x5'))(_0xd248('0x6'));var config=require(_0xd248('0x7'));var jayson=require(_0xd248('0x8'));var client=jayson[_0xd248('0x9')][_0xd248('0xa')]({'port':0x232a});config[_0xd248('0xb')]=_[_0xd248('0xc')](config[_0xd248('0xb')],{'host':_0xd248('0xd'),'port':0x18eb});var socket=require(_0xd248('0xe'))(new Redis(config[_0xd248('0xb')]));require(_0xd248('0xf'))['register'](socket);function respondWithRpcPromise(_0x7422bc,_0x2ac751,_0x37d8d3){return new BPromise(function(_0x208f1e,_0x50a279){return client[_0xd248('0x10')](_0x7422bc,_0x37d8d3)['then'](function(_0x2522aa){logger[_0xd248('0x11')]('SmsQueue,\x20%s,\x20%s',_0x2ac751,_0xd248('0x12'));logger['debug'](_0xd248('0x13'),_0x2ac751,_0xd248('0x12'),JSON[_0xd248('0x14')](_0x2522aa));if(_0x2522aa['error']){if(_0x2522aa[_0xd248('0x15')][_0xd248('0x16')]===0x1f4){logger[_0xd248('0x15')](_0xd248('0x17'),_0x2ac751,_0x2522aa[_0xd248('0x15')][_0xd248('0x18')]);return _0x50a279(_0x2522aa['error'][_0xd248('0x18')]);}logger[_0xd248('0x15')](_0xd248('0x17'),_0x2ac751,_0x2522aa[_0xd248('0x15')][_0xd248('0x18')]);return _0x208f1e(_0x2522aa[_0xd248('0x15')][_0xd248('0x18')]);}else{logger[_0xd248('0x11')](_0xd248('0x17'),_0x2ac751,_0xd248('0x12'));_0x208f1e(_0x2522aa[_0xd248('0x19')][_0xd248('0x18')]);}})[_0xd248('0x1a')](function(_0x511813){logger[_0xd248('0x15')](_0xd248('0x17'),_0x2ac751,_0x511813);_0x50a279(_0x511813);});});}exports['GetSmsQueue']=function(_0x5b6693){var _0x2070bc=this;return new Promise(function(_0x237bee,_0x4ec63d){return db[_0xd248('0x1b')][_0xd248('0x1c')]({'raw':_0x5b6693[_0xd248('0x1d')]?_0x5b6693[_0xd248('0x1d')][_0xd248('0x1e')]===undefined?!![]:![]:!![],'where':_0x5b6693['options']?_0x5b6693[_0xd248('0x1d')][_0xd248('0x1f')]||null:null,'attributes':_0x5b6693['options']?_0x5b6693[_0xd248('0x1d')]['attributes']||null:null,'limit':_0x5b6693[_0xd248('0x1d')]?_0x5b6693[_0xd248('0x1d')][_0xd248('0x20')]||null:null,'include':_0x5b6693['options']?_0x5b6693[_0xd248('0x1d')][_0xd248('0x21')]?_['map'](_0x5b6693[_0xd248('0x1d')][_0xd248('0x21')],function(_0x2e4e4f){return{'model':db[_0x2e4e4f[_0xd248('0x22')]],'as':_0x2e4e4f['as'],'attributes':_0x2e4e4f[_0xd248('0x23')],'include':_0x2e4e4f[_0xd248('0x21')]?_[_0xd248('0x24')](_0x2e4e4f['include'],function(_0x91511){return{'model':db[_0x91511[_0xd248('0x22')]],'as':_0x91511['as'],'attributes':_0x91511[_0xd248('0x23')],'include':_0x91511[_0xd248('0x21')]?_['map'](_0x91511[_0xd248('0x21')],function(_0x5c1905){return{'model':db[_0x5c1905[_0xd248('0x22')]],'as':_0x5c1905['as'],'attributes':_0x5c1905[_0xd248('0x23')]};}):[]};}):[]};}):[]:[]})[_0xd248('0x25')](function(_0x4e6d3c){logger['info'](_0xd248('0x26'),_0x5b6693);logger[_0xd248('0x27')](_0xd248('0x26'),_0x5b6693,JSON[_0xd248('0x14')](_0x4e6d3c));_0x237bee(_0x4e6d3c);})[_0xd248('0x1a')](function(_0x466d91){logger[_0xd248('0x15')](_0xd248('0x26'),_0x466d91[_0xd248('0x18')],_0x5b6693);_0x4ec63d(_0x2070bc[_0xd248('0x15')](0x1f4,_0x466d91[_0xd248('0x18')]));});});};exports[_0xd248('0x28')]=function(_0x2150c1){var _0x168eb6=this;return new Promise(function(_0x616781,_0x1cc7bb){return db['SmsQueue'][_0xd248('0x29')]({'raw':_0x2150c1['options']?_0x2150c1['options']['raw']===undefined?!![]:![]:!![],'where':_0x2150c1[_0xd248('0x1d')]?_0x2150c1[_0xd248('0x1d')][_0xd248('0x1f')]||null:null,'attributes':_0x2150c1[_0xd248('0x1d')]?_0x2150c1['options'][_0xd248('0x23')]||null:null,'include':_0x2150c1[_0xd248('0x1d')]?_0x2150c1[_0xd248('0x1d')][_0xd248('0x21')]?_[_0xd248('0x24')](_0x2150c1[_0xd248('0x1d')][_0xd248('0x21')],function(_0x40c5e6){return{'model':db[_0x40c5e6[_0xd248('0x22')]],'as':_0x40c5e6['as'],'attributes':_0x40c5e6[_0xd248('0x23')],'include':_0x40c5e6[_0xd248('0x21')]?_[_0xd248('0x24')](_0x40c5e6[_0xd248('0x21')],function(_0x2b966b){return{'model':db[_0x2b966b[_0xd248('0x22')]],'as':_0x2b966b['as'],'attributes':_0x2b966b[_0xd248('0x23')],'include':_0x2b966b[_0xd248('0x21')]?_[_0xd248('0x24')](_0x2b966b[_0xd248('0x21')],function(_0x415294){return{'model':db[_0x415294[_0xd248('0x22')]],'as':_0x415294['as'],'attributes':_0x415294[_0xd248('0x23')]};}):[]};}):[]};}):[]:[]})[_0xd248('0x25')](function(_0x2340dd){logger[_0xd248('0x11')](_0xd248('0x28'),_0x2150c1);logger[_0xd248('0x27')](_0xd248('0x28'),_0x2150c1,JSON['stringify'](_0x2340dd));_0x616781(_0x2340dd);})[_0xd248('0x1a')](function(_0x22c2dd){logger[_0xd248('0x15')](_0xd248('0x28'),_0x22c2dd['message'],_0x2150c1);_0x1cc7bb(_0x168eb6[_0xd248('0x15')](0x1f4,_0x22c2dd[_0xd248('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index ff82550..9742ca8 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 _0xfd56=['register','length','smsQueue:','./smsQueue.events','save','emit'];(function(_0x283902,_0x5c566c){var _0x17c2c6=function(_0x3172df){while(--_0x3172df){_0x283902['push'](_0x283902['shift']());}};_0x17c2c6(++_0x5c566c);}(_0xfd56,0xed));var _0x6fd5=function(_0x4635c3,_0x896415){_0x4635c3=_0x4635c3-0x0;var _0x3ab9d0=_0xfd56[_0x4635c3];return _0x3ab9d0;};'use strict';var SmsQueueEvents=require(_0x6fd5('0x0'));var events=[_0x6fd5('0x1'),'remove','update'];function createListener(_0x56efad,_0x311b37){return function(_0xb3de7){_0x311b37[_0x6fd5('0x2')](_0x56efad,_0xb3de7);};}function removeListener(_0x5f03a9,_0x19ddba){return function(){SmsQueueEvents['removeListener'](_0x5f03a9,_0x19ddba);};}exports[_0x6fd5('0x3')]=function(_0x758fc){for(var _0x525b55=0x0,_0x8aa886=events[_0x6fd5('0x4')];_0x525b55<_0x8aa886;_0x525b55++){var _0x5a4160=events[_0x525b55];var _0x3f91ba=createListener(_0x6fd5('0x5')+_0x5a4160,_0x758fc);SmsQueueEvents['on'](_0x5a4160,_0x3f91ba);}}; \ No newline at end of file +var _0x43b3=['removeListener','register','length','smsQueue:','./smsQueue.events','remove','update','emit'];(function(_0x3808fd,_0x4a2cce){var _0x5d0e5d=function(_0x4c6f1d){while(--_0x4c6f1d){_0x3808fd['push'](_0x3808fd['shift']());}};_0x5d0e5d(++_0x4a2cce);}(_0x43b3,0x12c));var _0x343b=function(_0xfe476f,_0x4f542c){_0xfe476f=_0xfe476f-0x0;var _0x57c867=_0x43b3[_0xfe476f];return _0x57c867;};'use strict';var SmsQueueEvents=require(_0x343b('0x0'));var events=['save',_0x343b('0x1'),_0x343b('0x2')];function createListener(_0x4628e2,_0x415426){return function(_0x520a82){_0x415426[_0x343b('0x3')](_0x4628e2,_0x520a82);};}function removeListener(_0x526ef0,_0x38c6d3){return function(){SmsQueueEvents[_0x343b('0x4')](_0x526ef0,_0x38c6d3);};}exports[_0x343b('0x5')]=function(_0x1ce05a){for(var _0x3d13ef=0x0,_0x3d34ba=events[_0x343b('0x6')];_0x3d13ef<_0x3d34ba;_0x3d13ef++){var _0x3fb9fd=events[_0x3d13ef];var _0xb84aa1=createListener(_0x343b('0x7')+_0x3fb9fd,_0x1ce05a);SmsQueueEvents['on'](_0x3fb9fd,_0xb84aa1);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 27a6e17..c4bbc16 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 _0xb453=['../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','update','delete','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x1fd972,_0x1bec54){var _0xf99733=function(_0x22baa7){while(--_0x22baa7){_0x1fd972['push'](_0x1fd972['shift']());}};_0xf99733(++_0x1bec54);}(_0xb453,0x1e8));var _0x3b45=function(_0x1dd59d,_0x509804){_0x1dd59d=_0x1dd59d-0x0;var _0x4f9734=_0xb453[_0x1dd59d];return _0x4f9734;};'use strict';var multer=require(_0x3b45('0x0'));var util=require(_0x3b45('0x1'));var path=require('path');var timeout=require(_0x3b45('0x2'));var express=require(_0x3b45('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3b45('0x4'));var interaction=require(_0x3b45('0x5'));var config=require(_0x3b45('0x6'));var controller=require(_0x3b45('0x7'));router[_0x3b45('0x8')]('/',auth[_0x3b45('0x9')](),controller[_0x3b45('0xa')]);router[_0x3b45('0x8')](_0x3b45('0xb'),auth[_0x3b45('0x9')](),controller['describe']);router[_0x3b45('0x8')](_0x3b45('0xc'),auth[_0x3b45('0x9')](),controller[_0x3b45('0xd')]);router[_0x3b45('0xe')]('/',auth[_0x3b45('0x9')](),controller[_0x3b45('0xf')]);router['put'](_0x3b45('0xc'),auth['isAuthenticated'](),controller[_0x3b45('0x10')]);router[_0x3b45('0x11')](_0x3b45('0xc'),auth[_0x3b45('0x9')](),controller[_0x3b45('0x12')]);module['exports']=router; \ No newline at end of file +var _0xeb98=['describe','/:id','show','post','put','delete','destroy','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','index','get'];(function(_0x3a20b7,_0x815ffa){var _0x5b7110=function(_0x3a93d7){while(--_0x3a93d7){_0x3a20b7['push'](_0x3a20b7['shift']());}};_0x5b7110(++_0x815ffa);}(_0xeb98,0xe0));var _0x8eb9=function(_0x4bf2ec,_0x4bb8db){_0x4bf2ec=_0x4bf2ec-0x0;var _0x3005f6=_0xeb98[_0x4bf2ec];return _0x3005f6;};'use strict';var multer=require('multer');var util=require(_0x8eb9('0x0'));var path=require(_0x8eb9('0x1'));var timeout=require(_0x8eb9('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8eb9('0x3'));var interaction=require(_0x8eb9('0x4'));var config=require(_0x8eb9('0x5'));var controller=require(_0x8eb9('0x6'));router['get']('/',auth[_0x8eb9('0x7')](),controller[_0x8eb9('0x8')]);router[_0x8eb9('0x9')]('/describe',auth[_0x8eb9('0x7')](),controller[_0x8eb9('0xa')]);router[_0x8eb9('0x9')](_0x8eb9('0xb'),auth[_0x8eb9('0x7')](),controller[_0x8eb9('0xc')]);router[_0x8eb9('0xd')]('/',auth[_0x8eb9('0x7')](),controller['create']);router[_0x8eb9('0xe')](_0x8eb9('0xb'),auth[_0x8eb9('0x7')](),controller['update']);router[_0x8eb9('0xf')](_0x8eb9('0xb'),auth[_0x8eb9('0x7')](),controller[_0x8eb9('0x10')]);module[_0x8eb9('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index ec31ac6..c565f5a 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 _0xece3=['STRING','DATE','sequelize','exports'];(function(_0x1d4934,_0x273e2b){var _0x3603f7=function(_0x41f762){while(--_0x41f762){_0x1d4934['push'](_0x1d4934['shift']());}};_0x3603f7(++_0x273e2b);}(_0xece3,0x102));var _0x3ece=function(_0x6c0833,_0x59e073){_0x6c0833=_0x6c0833-0x0;var _0x25d75b=_0xece3[_0x6c0833];return _0x25d75b;};'use strict';var moment=require('moment');var Sequelize=require(_0x3ece('0x0'));module[_0x3ece('0x1')]={'uniqueid':{'type':Sequelize[_0x3ece('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x3ece('0x3')]},'acceptAt':{'type':Sequelize[_0x3ece('0x3')]},'exitAt':{'type':Sequelize[_0x3ece('0x3')]},'reason':{'type':Sequelize[_0x3ece('0x2')]}}; \ No newline at end of file +var _0x2187=['sequelize','exports','STRING','DATE','moment'];(function(_0x25656f,_0x4cf8be){var _0x6e703f=function(_0x334697){while(--_0x334697){_0x25656f['push'](_0x25656f['shift']());}};_0x6e703f(++_0x4cf8be);}(_0x2187,0x1ad));var _0x7218=function(_0x256a44,_0x2c1875){_0x256a44=_0x256a44-0x0;var _0x2332ff=_0x2187[_0x256a44];return _0x2332ff;};'use strict';var moment=require(_0x7218('0x0'));var Sequelize=require(_0x7218('0x1'));module[_0x7218('0x2')]={'uniqueid':{'type':Sequelize[_0x7218('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x7218('0x3')]},'joinAt':{'type':Sequelize[_0x7218('0x4')]},'leaveAt':{'type':Sequelize[_0x7218('0x4')]},'acceptAt':{'type':Sequelize[_0x7218('0x4')]},'exitAt':{'type':Sequelize[_0x7218('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 972c85a..5bb94fd 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 _0xf59d=['moment','util','path','to-csv','ejs','fs-extra','lodash','squel','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','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','name','send','index','SmsQueueReport','fieldName','key','model','keys','filters','intersection','fields','query','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','map','type','VIRTUAL','options','includeAll','rows','catch','show','params','rawAttributes','length','include','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x4ea1ba,_0x156707){var _0x175756=function(_0x1d34c0){while(--_0x1d34c0){_0x4ea1ba['push'](_0x4ea1ba['shift']());}};_0x175756(++_0x156707);}(_0xf59d,0x181));var _0xdf59=function(_0x1aab33,_0x327f92){_0x1aab33=_0x1aab33-0x0;var _0x4bf0df=_0xf59d[_0x1aab33];return _0x4bf0df;};'use strict';var emlformat=require(_0xdf59('0x0'));var rimraf=require(_0xdf59('0x1'));var zipdir=require(_0xdf59('0x2'));var jsonpatch=require(_0xdf59('0x3'));var rp=require(_0xdf59('0x4'));var moment=require(_0xdf59('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdf59('0x6'));var path=require(_0xdf59('0x7'));var sox=require('sox');var csv=require(_0xdf59('0x8'));var ejs=require(_0xdf59('0x9'));var fs=require('fs');var fs_extra=require(_0xdf59('0xa'));var _=require(_0xdf59('0xb'));var squel=require(_0xdf59('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdf59('0xd'));var toCsv=require(_0xdf59('0x8'));var querystring=require(_0xdf59('0xe'));var Papa=require(_0xdf59('0xf'));var Redis=require(_0xdf59('0x10'));var authService=require(_0xdf59('0x11'));var qs=require(_0xdf59('0x12'));var as=require(_0xdf59('0x13'));var hardwareService=require(_0xdf59('0x14'));var logger=require(_0xdf59('0x15'))('api');var utils=require(_0xdf59('0x16'));var config=require(_0xdf59('0x17'));var licenseUtil=require(_0xdf59('0x18'));var db=require(_0xdf59('0x19'))['db'];function respondWithStatusCode(_0x478b61,_0x454955){_0x454955=_0x454955||0xcc;return function(_0x561b21){if(_0x561b21){return _0x478b61['sendStatus'](_0x454955);}return _0x478b61[_0xdf59('0x1a')](_0x454955)[_0xdf59('0x1b')]();};}function respondWithResult(_0x46b1fc,_0x3e5d6f){_0x3e5d6f=_0x3e5d6f||0xc8;return function(_0x386850){if(_0x386850){return _0x46b1fc['status'](_0x3e5d6f)[_0xdf59('0x1c')](_0x386850);}};}function respondWithFilteredResult(_0x343be8,_0x5d0f5d){return function(_0x37a1ed){if(_0x37a1ed){var _0x65797b=typeof _0x5d0f5d[_0xdf59('0x1d')]==='undefined'&&typeof _0x5d0f5d[_0xdf59('0x1e')]===_0xdf59('0x1f');var _0x1b8dd0=_0x37a1ed['count'];var _0x5f0f64=_0x65797b?0x0:_0x5d0f5d['offset'];var _0x481fb1=_0x65797b?_0x37a1ed[_0xdf59('0x20')]:_0x5d0f5d[_0xdf59('0x1d')]+_0x5d0f5d['limit'];var _0x4395f6;if(_0x481fb1>=_0x1b8dd0){_0x481fb1=_0x1b8dd0;_0x4395f6=0xc8;}else{_0x4395f6=0xce;}_0x343be8[_0xdf59('0x1a')](_0x4395f6);return _0x343be8[_0xdf59('0x21')](_0xdf59('0x22'),_0x5f0f64+'-'+_0x481fb1+'/'+_0x1b8dd0)['json'](_0x37a1ed);}return null;};}function patchUpdates(_0x3c126e){return function(_0x6d9ec2){try{jsonpatch[_0xdf59('0x23')](_0x6d9ec2,_0x3c126e,!![]);}catch(_0x2351cc){return BPromise['reject'](_0x2351cc);}return _0x6d9ec2[_0xdf59('0x24')]();};}function saveUpdates(_0x14a57c,_0xaca528){return function(_0x49280a){if(_0x49280a){return _0x49280a['update'](_0x14a57c)[_0xdf59('0x25')](function(_0xb6d3af){return _0xb6d3af;});}return null;};}function removeEntity(_0x40df61,_0x435ee3){return function(_0x4116b4){if(_0x4116b4){return _0x4116b4[_0xdf59('0x26')]()[_0xdf59('0x25')](function(){_0x40df61[_0xdf59('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16ea80,_0x3dd2ac){return function(_0x13d327){if(!_0x13d327){_0x16ea80[_0xdf59('0x27')](0x194);}return _0x13d327;};}function handleError(_0x575e67,_0x2038f3){_0x2038f3=_0x2038f3||0x1f4;return function(_0x56bf8d){logger[_0xdf59('0x28')](_0x56bf8d['stack']);if(_0x56bf8d[_0xdf59('0x29')]){delete _0x56bf8d[_0xdf59('0x29')];}_0x575e67[_0xdf59('0x1a')](_0x2038f3)[_0xdf59('0x2a')](_0x56bf8d);};}exports[_0xdf59('0x2b')]=function(_0x2ec83b,_0x28d735){var _0x6506={},_0x1476d5={},_0x161ea5={'count':0x0,'rows':[]};var _0x57d0fa=_['map'](db[_0xdf59('0x2c')]['rawAttributes'],function(_0x223297){return{'name':_0x223297[_0xdf59('0x2d')],'type':_0x223297['type'][_0xdf59('0x2e')]};});_0x1476d5[_0xdf59('0x2f')]=_['map'](_0x57d0fa,'name');_0x1476d5['query']=_[_0xdf59('0x30')](_0x2ec83b['query']);_0x1476d5[_0xdf59('0x31')]=_['intersection'](_0x1476d5[_0xdf59('0x2f')],_0x1476d5['query']);_0x6506['attributes']=_[_0xdf59('0x32')](_0x1476d5[_0xdf59('0x2f')],qs[_0xdf59('0x33')](_0x2ec83b[_0xdf59('0x34')]['fields']));_0x6506['attributes']=_0x6506[_0xdf59('0x35')]['length']?_0x6506[_0xdf59('0x35')]:_0x1476d5[_0xdf59('0x2f')];if(!_0x2ec83b[_0xdf59('0x34')][_0xdf59('0x36')]('nolimit')){_0x6506[_0xdf59('0x1e')]=qs[_0xdf59('0x1e')](_0x2ec83b[_0xdf59('0x34')]['limit']);_0x6506[_0xdf59('0x1d')]=qs[_0xdf59('0x1d')](_0x2ec83b['query']['offset']);}_0x6506[_0xdf59('0x37')]=qs[_0xdf59('0x38')](_0x2ec83b[_0xdf59('0x34')][_0xdf59('0x38')]);_0x6506['where']=qs[_0xdf59('0x31')](_[_0xdf59('0x39')](_0x2ec83b['query'],_0x1476d5['filters']),_0x57d0fa);if(_0x2ec83b['query'][_0xdf59('0x3a')]){_0x6506[_0xdf59('0x3b')]=_[_0xdf59('0x3c')](_0x6506['where'],{'$or':_[_0xdf59('0x3d')](_0x57d0fa,function(_0x2e761c){if(_0x2e761c[_0xdf59('0x3e')]!==_0xdf59('0x3f')){var _0x2a1755={};_0x2a1755[_0x2e761c[_0xdf59('0x29')]]={'$like':'%'+_0x2ec83b['query']['filter']+'%'};return _0x2a1755;}})});}_0x6506=_[_0xdf59('0x3c')]({},_0x6506,_0x2ec83b[_0xdf59('0x40')]);var _0x5ab1d8={'where':_0x6506[_0xdf59('0x3b')]};return db['SmsQueueReport']['count'](_0x5ab1d8)[_0xdf59('0x25')](function(_0x31bf98){_0x161ea5[_0xdf59('0x20')]=_0x31bf98;if(_0x2ec83b[_0xdf59('0x34')][_0xdf59('0x41')]){_0x6506['include']=[{'all':!![]}];}return db['SmsQueueReport']['findAll'](_0x6506);})['then'](function(_0x635daf){_0x161ea5[_0xdf59('0x42')]=_0x635daf;return _0x161ea5;})[_0xdf59('0x25')](respondWithFilteredResult(_0x28d735,_0x6506))[_0xdf59('0x43')](handleError(_0x28d735,null));};exports[_0xdf59('0x44')]=function(_0x47f7c1,_0x29c137){var _0x3cb349={'raw':!![],'where':{'id':_0x47f7c1[_0xdf59('0x45')]['id']}},_0x2574d8={};_0x2574d8[_0xdf59('0x2f')]=_['keys'](db[_0xdf59('0x2c')][_0xdf59('0x46')]);_0x2574d8[_0xdf59('0x34')]=_['keys'](_0x47f7c1[_0xdf59('0x34')]);_0x2574d8['filters']=_['intersection'](_0x2574d8[_0xdf59('0x2f')],_0x2574d8[_0xdf59('0x34')]);_0x3cb349['attributes']=_[_0xdf59('0x32')](_0x2574d8[_0xdf59('0x2f')],qs[_0xdf59('0x33')](_0x47f7c1[_0xdf59('0x34')][_0xdf59('0x33')]));_0x3cb349['attributes']=_0x3cb349[_0xdf59('0x35')][_0xdf59('0x47')]?_0x3cb349[_0xdf59('0x35')]:_0x2574d8[_0xdf59('0x2f')];if(_0x47f7c1[_0xdf59('0x34')][_0xdf59('0x41')]){_0x3cb349[_0xdf59('0x48')]=[{'all':!![]}];}_0x3cb349=_[_0xdf59('0x3c')]({},_0x3cb349,_0x47f7c1['options']);return db[_0xdf59('0x2c')]['find'](_0x3cb349)[_0xdf59('0x25')](handleEntityNotFound(_0x29c137,null))['then'](respondWithResult(_0x29c137,null))[_0xdf59('0x43')](handleError(_0x29c137,null));};exports[_0xdf59('0x49')]=function(_0x3f8dc5,_0x3ecb58){return db[_0xdf59('0x2c')][_0xdf59('0x49')](_0x3f8dc5[_0xdf59('0x4a')],{})['then'](respondWithResult(_0x3ecb58,0xc9))['catch'](handleError(_0x3ecb58,null));};exports[_0xdf59('0x4b')]=function(_0x1fedc1,_0x2b0e0c){if(_0x1fedc1[_0xdf59('0x4a')]['id']){delete _0x1fedc1[_0xdf59('0x4a')]['id'];}return db[_0xdf59('0x2c')][_0xdf59('0x4c')]({'where':{'id':_0x1fedc1[_0xdf59('0x45')]['id']}})[_0xdf59('0x25')](handleEntityNotFound(_0x2b0e0c,null))[_0xdf59('0x25')](saveUpdates(_0x1fedc1[_0xdf59('0x4a')],null))[_0xdf59('0x25')](respondWithResult(_0x2b0e0c,null))['catch'](handleError(_0x2b0e0c,null));};exports[_0xdf59('0x26')]=function(_0x43202f,_0x1562c0){return db[_0xdf59('0x2c')][_0xdf59('0x4c')]({'where':{'id':_0x43202f[_0xdf59('0x45')]['id']}})[_0xdf59('0x25')](handleEntityNotFound(_0x1562c0,null))[_0xdf59('0x25')](removeEntity(_0x1562c0,null))[_0xdf59('0x43')](handleError(_0x1562c0,null));};exports[_0xdf59('0x4d')]=function(_0x571758,_0x5e4df5){return db[_0xdf59('0x2c')][_0xdf59('0x4d')]()[_0xdf59('0x25')](respondWithResult(_0x5e4df5,null))[_0xdf59('0x43')](handleError(_0x5e4df5,null));}; \ No newline at end of file +var _0x1314=['options','includeAll','rows','catch','show','params','length','include','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','nolimit','order','sort','pick','filter','where','VIRTUAL','merge'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x1314,0x150));var _0x4131=function(_0x30bdff,_0x308063){_0x30bdff=_0x30bdff-0x0;var _0x1e7ca9=_0x1314[_0x30bdff];return _0x1e7ca9;};'use strict';var emlformat=require(_0x4131('0x0'));var rimraf=require(_0x4131('0x1'));var zipdir=require(_0x4131('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4131('0x3'));var moment=require(_0x4131('0x4'));var BPromise=require(_0x4131('0x5'));var Mustache=require(_0x4131('0x6'));var util=require('util');var path=require(_0x4131('0x7'));var sox=require(_0x4131('0x8'));var csv=require(_0x4131('0x9'));var ejs=require(_0x4131('0xa'));var fs=require('fs');var fs_extra=require(_0x4131('0xb'));var _=require(_0x4131('0xc'));var squel=require(_0x4131('0xd'));var crypto=require('crypto');var jsforce=require(_0x4131('0xe'));var deskjs=require(_0x4131('0xf'));var toCsv=require(_0x4131('0x9'));var querystring=require(_0x4131('0x10'));var Papa=require(_0x4131('0x11'));var Redis=require(_0x4131('0x12'));var authService=require(_0x4131('0x13'));var qs=require(_0x4131('0x14'));var as=require(_0x4131('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4131('0x16'))(_0x4131('0x17'));var utils=require(_0x4131('0x18'));var config=require(_0x4131('0x19'));var licenseUtil=require(_0x4131('0x1a'));var db=require(_0x4131('0x1b'))['db'];function respondWithStatusCode(_0x4b12f3,_0x375a91){_0x375a91=_0x375a91||0xcc;return function(_0x4a6ad4){if(_0x4a6ad4){return _0x4b12f3[_0x4131('0x1c')](_0x375a91);}return _0x4b12f3[_0x4131('0x1d')](_0x375a91)[_0x4131('0x1e')]();};}function respondWithResult(_0xf7809a,_0xb73730){_0xb73730=_0xb73730||0xc8;return function(_0x3a9cac){if(_0x3a9cac){return _0xf7809a[_0x4131('0x1d')](_0xb73730)[_0x4131('0x1f')](_0x3a9cac);}};}function respondWithFilteredResult(_0x1418c0,_0x1cc833){return function(_0x19871b){if(_0x19871b){var _0x1dab4e=typeof _0x1cc833[_0x4131('0x20')]===_0x4131('0x21')&&typeof _0x1cc833[_0x4131('0x22')]==='undefined';var _0x1c72ba=_0x19871b['count'];var _0xe6b741=_0x1dab4e?0x0:_0x1cc833[_0x4131('0x20')];var _0x497aa1=_0x1dab4e?_0x19871b[_0x4131('0x23')]:_0x1cc833[_0x4131('0x20')]+_0x1cc833[_0x4131('0x22')];var _0x345354;if(_0x497aa1>=_0x1c72ba){_0x497aa1=_0x1c72ba;_0x345354=0xc8;}else{_0x345354=0xce;}_0x1418c0[_0x4131('0x1d')](_0x345354);return _0x1418c0['set'](_0x4131('0x24'),_0xe6b741+'-'+_0x497aa1+'/'+_0x1c72ba)[_0x4131('0x1f')](_0x19871b);}return null;};}function patchUpdates(_0x2269bb){return function(_0x31eef8){try{jsonpatch[_0x4131('0x25')](_0x31eef8,_0x2269bb,!![]);}catch(_0xabc92){return BPromise[_0x4131('0x26')](_0xabc92);}return _0x31eef8[_0x4131('0x27')]();};}function saveUpdates(_0xa9d98f,_0x30cfd2){return function(_0x32a6e5){if(_0x32a6e5){return _0x32a6e5[_0x4131('0x28')](_0xa9d98f)[_0x4131('0x29')](function(_0x23fd52){return _0x23fd52;});}return null;};}function removeEntity(_0x395f90,_0xb7b207){return function(_0x50f61a){if(_0x50f61a){return _0x50f61a[_0x4131('0x2a')]()[_0x4131('0x29')](function(){_0x395f90[_0x4131('0x1d')](0xcc)[_0x4131('0x1e')]();});}};}function handleEntityNotFound(_0x43f376,_0x149037){return function(_0x7a41c4){if(!_0x7a41c4){_0x43f376[_0x4131('0x1c')](0x194);}return _0x7a41c4;};}function handleError(_0x34f790,_0x31ccba){_0x31ccba=_0x31ccba||0x1f4;return function(_0x3f4b1a){logger[_0x4131('0x2b')](_0x3f4b1a[_0x4131('0x2c')]);if(_0x3f4b1a[_0x4131('0x2d')]){delete _0x3f4b1a['name'];}_0x34f790[_0x4131('0x1d')](_0x31ccba)[_0x4131('0x2e')](_0x3f4b1a);};}exports[_0x4131('0x2f')]=function(_0x5b74ff,_0x3ba529){var _0x2b772b={},_0x58ceee={},_0x1796c3={'count':0x0,'rows':[]};var _0x3306a5=_[_0x4131('0x30')](db[_0x4131('0x31')][_0x4131('0x32')],function(_0x3ccb00){return{'name':_0x3ccb00[_0x4131('0x33')],'type':_0x3ccb00[_0x4131('0x34')][_0x4131('0x35')]};});_0x58ceee['model']=_[_0x4131('0x30')](_0x3306a5,_0x4131('0x2d'));_0x58ceee[_0x4131('0x36')]=_[_0x4131('0x37')](_0x5b74ff[_0x4131('0x36')]);_0x58ceee[_0x4131('0x38')]=_[_0x4131('0x39')](_0x58ceee['model'],_0x58ceee[_0x4131('0x36')]);_0x2b772b[_0x4131('0x3a')]=_[_0x4131('0x39')](_0x58ceee[_0x4131('0x3b')],qs[_0x4131('0x3c')](_0x5b74ff['query'][_0x4131('0x3c')]));_0x2b772b[_0x4131('0x3a')]=_0x2b772b['attributes']['length']?_0x2b772b[_0x4131('0x3a')]:_0x58ceee[_0x4131('0x3b')];if(!_0x5b74ff[_0x4131('0x36')]['hasOwnProperty'](_0x4131('0x3d'))){_0x2b772b[_0x4131('0x22')]=qs[_0x4131('0x22')](_0x5b74ff['query'][_0x4131('0x22')]);_0x2b772b[_0x4131('0x20')]=qs['offset'](_0x5b74ff[_0x4131('0x36')][_0x4131('0x20')]);}_0x2b772b[_0x4131('0x3e')]=qs[_0x4131('0x3f')](_0x5b74ff[_0x4131('0x36')][_0x4131('0x3f')]);_0x2b772b['where']=qs['filters'](_[_0x4131('0x40')](_0x5b74ff[_0x4131('0x36')],_0x58ceee[_0x4131('0x38')]),_0x3306a5);if(_0x5b74ff[_0x4131('0x36')][_0x4131('0x41')]){_0x2b772b['where']=_['merge'](_0x2b772b[_0x4131('0x42')],{'$or':_[_0x4131('0x30')](_0x3306a5,function(_0xe82442){if(_0xe82442[_0x4131('0x34')]!==_0x4131('0x43')){var _0x5a2caf={};_0x5a2caf[_0xe82442[_0x4131('0x2d')]]={'$like':'%'+_0x5b74ff[_0x4131('0x36')][_0x4131('0x41')]+'%'};return _0x5a2caf;}})});}_0x2b772b=_[_0x4131('0x44')]({},_0x2b772b,_0x5b74ff[_0x4131('0x45')]);var _0x5089bc={'where':_0x2b772b['where']};return db[_0x4131('0x31')][_0x4131('0x23')](_0x5089bc)['then'](function(_0xe1a943){_0x1796c3['count']=_0xe1a943;if(_0x5b74ff[_0x4131('0x36')][_0x4131('0x46')]){_0x2b772b['include']=[{'all':!![]}];}return db[_0x4131('0x31')]['findAll'](_0x2b772b);})[_0x4131('0x29')](function(_0x2c30cd){_0x1796c3[_0x4131('0x47')]=_0x2c30cd;return _0x1796c3;})[_0x4131('0x29')](respondWithFilteredResult(_0x3ba529,_0x2b772b))[_0x4131('0x48')](handleError(_0x3ba529,null));};exports[_0x4131('0x49')]=function(_0x4b5a7f,_0xd31aa8){var _0x55fb82={'raw':!![],'where':{'id':_0x4b5a7f[_0x4131('0x4a')]['id']}},_0x50206d={};_0x50206d[_0x4131('0x3b')]=_[_0x4131('0x37')](db['SmsQueueReport'][_0x4131('0x32')]);_0x50206d[_0x4131('0x36')]=_[_0x4131('0x37')](_0x4b5a7f[_0x4131('0x36')]);_0x50206d[_0x4131('0x38')]=_[_0x4131('0x39')](_0x50206d[_0x4131('0x3b')],_0x50206d[_0x4131('0x36')]);_0x55fb82[_0x4131('0x3a')]=_[_0x4131('0x39')](_0x50206d['model'],qs[_0x4131('0x3c')](_0x4b5a7f[_0x4131('0x36')][_0x4131('0x3c')]));_0x55fb82[_0x4131('0x3a')]=_0x55fb82[_0x4131('0x3a')][_0x4131('0x4b')]?_0x55fb82['attributes']:_0x50206d[_0x4131('0x3b')];if(_0x4b5a7f[_0x4131('0x36')][_0x4131('0x46')]){_0x55fb82[_0x4131('0x4c')]=[{'all':!![]}];}_0x55fb82=_[_0x4131('0x44')]({},_0x55fb82,_0x4b5a7f['options']);return db['SmsQueueReport'][_0x4131('0x4d')](_0x55fb82)[_0x4131('0x29')](handleEntityNotFound(_0xd31aa8,null))['then'](respondWithResult(_0xd31aa8,null))[_0x4131('0x48')](handleError(_0xd31aa8,null));};exports[_0x4131('0x4e')]=function(_0x356101,_0xb16831){return db[_0x4131('0x31')][_0x4131('0x4e')](_0x356101['body'],{})[_0x4131('0x29')](respondWithResult(_0xb16831,0xc9))[_0x4131('0x48')](handleError(_0xb16831,null));};exports[_0x4131('0x28')]=function(_0x252125,_0x13e119){if(_0x252125[_0x4131('0x4f')]['id']){delete _0x252125[_0x4131('0x4f')]['id'];}return db[_0x4131('0x31')]['find']({'where':{'id':_0x252125[_0x4131('0x4a')]['id']}})['then'](handleEntityNotFound(_0x13e119,null))[_0x4131('0x29')](saveUpdates(_0x252125['body'],null))[_0x4131('0x29')](respondWithResult(_0x13e119,null))[_0x4131('0x48')](handleError(_0x13e119,null));};exports[_0x4131('0x2a')]=function(_0x3a26,_0x53ffe9){return db[_0x4131('0x31')]['find']({'where':{'id':_0x3a26[_0x4131('0x4a')]['id']}})['then'](handleEntityNotFound(_0x53ffe9,null))['then'](removeEntity(_0x53ffe9,null))[_0x4131('0x48')](handleError(_0x53ffe9,null));};exports[_0x4131('0x50')]=function(_0x452d62,_0x45460a){return db[_0x4131('0x31')][_0x4131('0x50')]()[_0x4131('0x29')](respondWithResult(_0x45460a,null))['catch'](handleError(_0x45460a,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 483e591..d762fd6 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x4c48b0,_0x18f42e){var _0x2bff07=function(_0x3987e7){while(--_0x3987e7){_0x4c48b0['push'](_0x4c48b0['shift']());}};_0x2bff07(++_0x18f42e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2d61b2,_0x142947){_0x2d61b2=_0x2d61b2-0x0;var _0x12df89=_0xcb91[_0x2d61b2];return _0x12df89;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('SmsQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['util','../../config/logger','bluebird','request-promise','path','rimraf','./smsQueueReport.attributes','report_sms_queue','uniqueid','lodash'];(function(_0x1be1e8,_0x4a23f2){var _0x35c569=function(_0x24c6aa){while(--_0x24c6aa){_0x1be1e8['push'](_0x1be1e8['shift']());}};_0x35c569(++_0x4a23f2);}(_0x70e0,0x17b));var _0x070e=function(_0x2a4617,_0x278f7e){_0x2a4617=_0x2a4617-0x0;var _0x245a03=_0x70e0[_0x2a4617];return _0x245a03;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('SmsQueueReport',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[{'name':_0x070e('0x9'),'fields':[_0x070e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index af89db2..e9568ea 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 _0x73d7=['create','body','options','raw','UpdateSmsQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSmsQueueReport','SmsQueueReport'];(function(_0xae1a83,_0x1980d4){var _0xdb9da8=function(_0x36fc99){while(--_0x36fc99){_0xae1a83['push'](_0xae1a83['shift']());}};_0xdb9da8(++_0x1980d4);}(_0x73d7,0x13b));var _0x773d=function(_0x14fd87,_0x17497b){_0x14fd87=_0x14fd87-0x0;var _0x20570b=_0x73d7[_0x14fd87];return _0x20570b;};'use strict';var _=require(_0x773d('0x0'));var util=require(_0x773d('0x1'));var moment=require(_0x773d('0x2'));var BPromise=require(_0x773d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x773d('0x4'));var db=require(_0x773d('0x5'))['db'];var utils=require(_0x773d('0x6'));var logger=require(_0x773d('0x7'))(_0x773d('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x773d('0x9')][_0x773d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c90df,_0x33d869,_0x4f49c1){return new BPromise(function(_0x49bc3d,_0x3fb0da){return client['request'](_0x1c90df,_0x4f49c1)[_0x773d('0xb')](function(_0x2915c7){logger['info'](_0x773d('0xc'),_0x33d869,_0x773d('0xd'));logger[_0x773d('0xe')](_0x773d('0xf'),_0x33d869,'request\x20sent',JSON[_0x773d('0x10')](_0x2915c7));if(_0x2915c7[_0x773d('0x11')]){if(_0x2915c7[_0x773d('0x11')][_0x773d('0x12')]===0x1f4){logger[_0x773d('0x11')](_0x773d('0xc'),_0x33d869,_0x2915c7['error'][_0x773d('0x13')]);return _0x3fb0da(_0x2915c7[_0x773d('0x11')][_0x773d('0x13')]);}logger[_0x773d('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x33d869,_0x2915c7[_0x773d('0x11')][_0x773d('0x13')]);return _0x49bc3d(_0x2915c7['error'][_0x773d('0x13')]);}else{logger[_0x773d('0x14')](_0x773d('0xc'),_0x33d869,_0x773d('0xd'));_0x49bc3d(_0x2915c7[_0x773d('0x15')][_0x773d('0x13')]);}})[_0x773d('0x16')](function(_0x399f55){logger[_0x773d('0x11')](_0x773d('0xc'),_0x33d869,_0x399f55);_0x3fb0da(_0x399f55);});});}exports[_0x773d('0x17')]=function(_0x10b073){var _0x1cf4f2=this;return new Promise(function(_0x12808b,_0x355cd5){return db[_0x773d('0x18')][_0x773d('0x19')](_0x10b073[_0x773d('0x1a')],{'raw':_0x10b073[_0x773d('0x1b')]?_0x10b073[_0x773d('0x1b')][_0x773d('0x1c')]===undefined?!![]:![]:!![]})[_0x773d('0xb')](function(_0x46cfe3){logger[_0x773d('0x14')](_0x773d('0x17'),_0x10b073);logger[_0x773d('0xe')](_0x773d('0x17'),_0x10b073,JSON[_0x773d('0x10')](_0x46cfe3));_0x12808b(_0x46cfe3);})[_0x773d('0x16')](function(_0x227014){logger[_0x773d('0x11')](_0x773d('0x17'),_0x227014[_0x773d('0x13')],_0x10b073);_0x355cd5(_0x1cf4f2[_0x773d('0x11')](0x1f4,_0x227014[_0x773d('0x13')]));});});};exports[_0x773d('0x1d')]=function(_0x2ace93){var _0x3ae8b2=this;return new Promise(function(_0x1ad168,_0x2c33ac){return db[_0x773d('0x18')][_0x773d('0x1e')](_0x2ace93['body'],{'raw':_0x2ace93[_0x773d('0x1b')]?_0x2ace93[_0x773d('0x1b')][_0x773d('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ace93[_0x773d('0x1b')]?_0x2ace93[_0x773d('0x1b')][_0x773d('0x1f')]||null:null,'attributes':_0x2ace93[_0x773d('0x1b')]?_0x2ace93[_0x773d('0x1b')][_0x773d('0x20')]||null:null,'limit':_0x2ace93[_0x773d('0x1b')]?_0x2ace93[_0x773d('0x1b')][_0x773d('0x21')]||null:null})['then'](function(_0x1f0b4d){logger['info'](_0x773d('0x1d'),_0x2ace93);logger[_0x773d('0xe')](_0x773d('0x1d'),_0x2ace93,JSON[_0x773d('0x10')](_0x1f0b4d));_0x1ad168(_0x1f0b4d);})[_0x773d('0x16')](function(_0x5d2ea6){logger[_0x773d('0x11')]('UpdateSmsQueueReport',_0x5d2ea6[_0x773d('0x13')],_0x2ace93);_0x2c33ac(_0x3ae8b2[_0x773d('0x11')](0x1f4,_0x5d2ea6['message']));});});}; \ No newline at end of file +var _0x2a2b=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','SmsQueueReport,\x20%s,\x20%s','message','info','result','catch','SmsQueueReport','body','options','raw','CreateSmsQueueReport','stringify','UpdateSmsQueueReport','update','where','attributes','lodash','util','moment'];(function(_0x25da53,_0x2ee2ba){var _0x425da9=function(_0x3ecbde){while(--_0x3ecbde){_0x25da53['push'](_0x25da53['shift']());}};_0x425da9(++_0x2ee2ba);}(_0x2a2b,0x1cb));var _0xb2a2=function(_0x57d3f0,_0x17ffdb){_0x57d3f0=_0x57d3f0-0x0;var _0x24eed8=_0x2a2b[_0x57d3f0];return _0x24eed8;};'use strict';var _=require(_0xb2a2('0x0'));var util=require(_0xb2a2('0x1'));var moment=require(_0xb2a2('0x2'));var BPromise=require(_0xb2a2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb2a2('0x4'))['db'];var utils=require(_0xb2a2('0x5'));var logger=require(_0xb2a2('0x6'))(_0xb2a2('0x7'));var config=require(_0xb2a2('0x8'));var jayson=require(_0xb2a2('0x9'));var client=jayson['client'][_0xb2a2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3805f9,_0x26fd5f,_0x55291d){return new BPromise(function(_0x5eda30,_0x323b36){return client[_0xb2a2('0xb')](_0x3805f9,_0x55291d)[_0xb2a2('0xc')](function(_0x4eb58e){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x26fd5f,_0xb2a2('0xd'));logger[_0xb2a2('0xe')](_0xb2a2('0xf'),_0x26fd5f,'request\x20sent',JSON['stringify'](_0x4eb58e));if(_0x4eb58e['error']){if(_0x4eb58e[_0xb2a2('0x10')][_0xb2a2('0x11')]===0x1f4){logger[_0xb2a2('0x10')](_0xb2a2('0x12'),_0x26fd5f,_0x4eb58e[_0xb2a2('0x10')][_0xb2a2('0x13')]);return _0x323b36(_0x4eb58e['error']['message']);}logger[_0xb2a2('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x26fd5f,_0x4eb58e[_0xb2a2('0x10')][_0xb2a2('0x13')]);return _0x5eda30(_0x4eb58e[_0xb2a2('0x10')][_0xb2a2('0x13')]);}else{logger[_0xb2a2('0x14')](_0xb2a2('0x12'),_0x26fd5f,_0xb2a2('0xd'));_0x5eda30(_0x4eb58e[_0xb2a2('0x15')]['message']);}})[_0xb2a2('0x16')](function(_0x512168){logger['error'](_0xb2a2('0x12'),_0x26fd5f,_0x512168);_0x323b36(_0x512168);});});}exports['CreateSmsQueueReport']=function(_0x3f2b27){var _0x2df742=this;return new Promise(function(_0x17a4cc,_0x3a4fce){return db[_0xb2a2('0x17')]['create'](_0x3f2b27[_0xb2a2('0x18')],{'raw':_0x3f2b27[_0xb2a2('0x19')]?_0x3f2b27[_0xb2a2('0x19')][_0xb2a2('0x1a')]===undefined?!![]:![]:!![]})[_0xb2a2('0xc')](function(_0xfd9a56){logger['info'](_0xb2a2('0x1b'),_0x3f2b27);logger['debug'](_0xb2a2('0x1b'),_0x3f2b27,JSON[_0xb2a2('0x1c')](_0xfd9a56));_0x17a4cc(_0xfd9a56);})[_0xb2a2('0x16')](function(_0x28b076){logger['error'](_0xb2a2('0x1b'),_0x28b076[_0xb2a2('0x13')],_0x3f2b27);_0x3a4fce(_0x2df742[_0xb2a2('0x10')](0x1f4,_0x28b076[_0xb2a2('0x13')]));});});};exports[_0xb2a2('0x1d')]=function(_0x2fe1d7){var _0x1b29b4=this;return new Promise(function(_0x2c6c68,_0x374a17){return db[_0xb2a2('0x17')][_0xb2a2('0x1e')](_0x2fe1d7[_0xb2a2('0x18')],{'raw':_0x2fe1d7[_0xb2a2('0x19')]?_0x2fe1d7[_0xb2a2('0x19')][_0xb2a2('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fe1d7[_0xb2a2('0x19')]?_0x2fe1d7[_0xb2a2('0x19')][_0xb2a2('0x1f')]||null:null,'attributes':_0x2fe1d7[_0xb2a2('0x19')]?_0x2fe1d7['options'][_0xb2a2('0x20')]||null:null,'limit':_0x2fe1d7[_0xb2a2('0x19')]?_0x2fe1d7[_0xb2a2('0x19')]['limit']||null:null})['then'](function(_0x3e716d){logger[_0xb2a2('0x14')](_0xb2a2('0x1d'),_0x2fe1d7);logger[_0xb2a2('0xe')](_0xb2a2('0x1d'),_0x2fe1d7,JSON[_0xb2a2('0x1c')](_0x3e716d));_0x2c6c68(_0x3e716d);})[_0xb2a2('0x16')](function(_0xd97328){logger[_0xb2a2('0x10')](_0xb2a2('0x1d'),_0xd97328['message'],_0x2fe1d7);_0x374a17(_0x1b29b4[_0xb2a2('0x10')](0x1f4,_0xd97328['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index d9c9dce..36041c1 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 _0x79a8=['fs-extra','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','destroy','exports','multer','path','connect-timeout','express'];(function(_0x597bf3,_0x3a2bd8){var _0x4db0db=function(_0x4d5983){while(--_0x4d5983){_0x597bf3['push'](_0x597bf3['shift']());}};_0x4db0db(++_0x3a2bd8);}(_0x79a8,0x1d0));var _0x879a=function(_0x12551a,_0x5af080){_0x12551a=_0x12551a-0x0;var _0x6f8fc0=_0x79a8[_0x12551a];return _0x6f8fc0;};'use strict';var multer=require(_0x879a('0x0'));var util=require('util');var path=require(_0x879a('0x1'));var timeout=require(_0x879a('0x2'));var express=require(_0x879a('0x3'));var router=express['Router']();var fs_extra=require(_0x879a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x879a('0x5'));var config=require(_0x879a('0x6'));var controller=require(_0x879a('0x7'));router[_0x879a('0x8')]('/',auth[_0x879a('0x9')](),controller[_0x879a('0xa')]);router[_0x879a('0x8')](_0x879a('0xb'),auth['isAuthenticated'](),controller[_0x879a('0xc')]);router['get'](_0x879a('0xd'),auth[_0x879a('0x9')](),controller['show']);router[_0x879a('0xe')]('/',auth[_0x879a('0x9')](),controller[_0x879a('0xf')]);router['put'](_0x879a('0xd'),auth[_0x879a('0x9')](),controller['update']);router['delete'](_0x879a('0xd'),auth[_0x879a('0x9')](),controller[_0x879a('0x10')]);module[_0x879a('0x11')]=router; \ No newline at end of file +var _0x6921=['describe','/:id','post','create','put','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/interaction/service','./smsTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x3d7f20,_0x216969){var _0x5c82c4=function(_0x411d05){while(--_0x411d05){_0x3d7f20['push'](_0x3d7f20['shift']());}};_0x5c82c4(++_0x216969);}(_0x6921,0x1d1));var _0x1692=function(_0x325259,_0x504d3b){_0x325259=_0x325259-0x0;var _0x11d584=_0x6921[_0x325259];return _0x11d584;};'use strict';var multer=require('multer');var util=require(_0x1692('0x0'));var path=require('path');var timeout=require(_0x1692('0x1'));var express=require('express');var router=express[_0x1692('0x2')]();var fs_extra=require(_0x1692('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x1692('0x4'));var config=require('../../config/environment');var controller=require(_0x1692('0x5'));router[_0x1692('0x6')]('/',auth[_0x1692('0x7')](),controller[_0x1692('0x8')]);router[_0x1692('0x6')](_0x1692('0x9'),auth[_0x1692('0x7')](),controller[_0x1692('0xa')]);router[_0x1692('0x6')](_0x1692('0xb'),auth[_0x1692('0x7')](),controller['show']);router[_0x1692('0xc')]('/',auth['isAuthenticated'](),controller[_0x1692('0xd')]);router[_0x1692('0xe')](_0x1692('0xb'),auth[_0x1692('0x7')](),controller[_0x1692('0xf')]);router[_0x1692('0x10')]('/:id',auth[_0x1692('0x7')](),controller[_0x1692('0x11')]);module[_0x1692('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index d0bc0a2..6277d94 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x298017,_0x4c7f93){var _0x53b547=function(_0x2c85bf){while(--_0x2c85bf){_0x298017['push'](_0x298017['shift']());}};_0x53b547(++_0x4c7f93);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x221a0f,_0x3970f6){_0x221a0f=_0x221a0f-0x0;var _0x30309e=_0xf3cd[_0x221a0f];return _0x30309e;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x44ffaf,_0x48b6f2){var _0x413d15=function(_0x22c53d){while(--_0x22c53d){_0x44ffaf['push'](_0x44ffaf['shift']());}};_0x413d15(++_0x48b6f2);}(_0xf4eb,0xec));var _0xbf4e=function(_0x4d65a0,_0xb87692){_0x4d65a0=_0x4d65a0-0x0;var _0x3657dc=_0xf4eb[_0x4d65a0];return _0x3657dc;};'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/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 0f901ea..91b8b4d 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 _0xa223=['moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','count','set','Content-Range','apply','update','end','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','include','SmsTransferReport','findAll','then','rows','params','length','includeAll','catch','body','find','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x1deda8,_0x351b1a){var _0x97c2ab=function(_0x489a7b){while(--_0x489a7b){_0x1deda8['push'](_0x1deda8['shift']());}};_0x97c2ab(++_0x351b1a);}(_0xa223,0x1f4));var _0x3a22=function(_0x555ae5,_0x506559){_0x555ae5=_0x555ae5-0x0;var _0x1e5601=_0xa223[_0x555ae5];return _0x1e5601;};'use strict';var emlformat=require(_0x3a22('0x0'));var rimraf=require(_0x3a22('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3a22('0x2'));var rp=require(_0x3a22('0x3'));var moment=require(_0x3a22('0x4'));var BPromise=require(_0x3a22('0x5'));var Mustache=require(_0x3a22('0x6'));var util=require(_0x3a22('0x7'));var path=require('path');var sox=require(_0x3a22('0x8'));var csv=require(_0x3a22('0x9'));var ejs=require(_0x3a22('0xa'));var fs=require('fs');var fs_extra=require(_0x3a22('0xb'));var _=require(_0x3a22('0xc'));var squel=require(_0x3a22('0xd'));var crypto=require(_0x3a22('0xe'));var jsforce=require(_0x3a22('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3a22('0x9'));var querystring=require(_0x3a22('0x10'));var Papa=require(_0x3a22('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3a22('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3a22('0x13'))(_0x3a22('0x14'));var utils=require(_0x3a22('0x15'));var config=require(_0x3a22('0x16'));var licenseUtil=require(_0x3a22('0x17'));var db=require(_0x3a22('0x18'))['db'];function respondWithStatusCode(_0x2e94f1,_0x55293a){_0x55293a=_0x55293a||0xcc;return function(_0x12eba1){if(_0x12eba1){return _0x2e94f1['sendStatus'](_0x55293a);}return _0x2e94f1['status'](_0x55293a)['end']();};}function respondWithResult(_0x14b4c3,_0x43d242){_0x43d242=_0x43d242||0xc8;return function(_0x4c72ad){if(_0x4c72ad){return _0x14b4c3[_0x3a22('0x19')](_0x43d242)[_0x3a22('0x1a')](_0x4c72ad);}};}function respondWithFilteredResult(_0x23409f,_0x1689b7){return function(_0x271478){if(_0x271478){var _0x51e8bb=typeof _0x1689b7[_0x3a22('0x1b')]==='undefined'&&typeof _0x1689b7[_0x3a22('0x1c')]==='undefined';var _0x26eac5=_0x271478[_0x3a22('0x1d')];var _0x4c2491=_0x51e8bb?0x0:_0x1689b7['offset'];var _0x428ebb=_0x51e8bb?_0x271478[_0x3a22('0x1d')]:_0x1689b7['offset']+_0x1689b7['limit'];var _0x45d5c8;if(_0x428ebb>=_0x26eac5){_0x428ebb=_0x26eac5;_0x45d5c8=0xc8;}else{_0x45d5c8=0xce;}_0x23409f[_0x3a22('0x19')](_0x45d5c8);return _0x23409f[_0x3a22('0x1e')](_0x3a22('0x1f'),_0x4c2491+'-'+_0x428ebb+'/'+_0x26eac5)['json'](_0x271478);}return null;};}function patchUpdates(_0x5e44d6){return function(_0x2c70bf){try{jsonpatch[_0x3a22('0x20')](_0x2c70bf,_0x5e44d6,!![]);}catch(_0x321557){return BPromise['reject'](_0x321557);}return _0x2c70bf['save']();};}function saveUpdates(_0xc4f699,_0x3c2e9a){return function(_0x49b4c4){if(_0x49b4c4){return _0x49b4c4[_0x3a22('0x21')](_0xc4f699)['then'](function(_0x4d3c9b){return _0x4d3c9b;});}return null;};}function removeEntity(_0x282a19,_0x1b9f84){return function(_0x51b8ad){if(_0x51b8ad){return _0x51b8ad['destroy']()['then'](function(){_0x282a19[_0x3a22('0x19')](0xcc)[_0x3a22('0x22')]();});}};}function handleEntityNotFound(_0x10d84e,_0x3744ce){return function(_0x4aa293){if(!_0x4aa293){_0x10d84e['sendStatus'](0x194);}return _0x4aa293;};}function handleError(_0x2c75a5,_0xd573cf){_0xd573cf=_0xd573cf||0x1f4;return function(_0x510453){logger[_0x3a22('0x23')](_0x510453[_0x3a22('0x24')]);if(_0x510453[_0x3a22('0x25')]){delete _0x510453[_0x3a22('0x25')];}_0x2c75a5['status'](_0xd573cf)[_0x3a22('0x26')](_0x510453);};}exports['index']=function(_0x6faed3,_0x482df5){var _0xa7cb2={},_0x4ec4ac={},_0x30a765={'count':0x0,'rows':[]};var _0xd96897=_[_0x3a22('0x27')](db['SmsTransferReport'][_0x3a22('0x28')],function(_0x6ceb9){return{'name':_0x6ceb9[_0x3a22('0x29')],'type':_0x6ceb9[_0x3a22('0x2a')][_0x3a22('0x2b')]};});_0x4ec4ac[_0x3a22('0x2c')]=_['map'](_0xd96897,_0x3a22('0x25'));_0x4ec4ac[_0x3a22('0x2d')]=_[_0x3a22('0x2e')](_0x6faed3[_0x3a22('0x2d')]);_0x4ec4ac[_0x3a22('0x2f')]=_[_0x3a22('0x30')](_0x4ec4ac[_0x3a22('0x2c')],_0x4ec4ac[_0x3a22('0x2d')]);_0xa7cb2[_0x3a22('0x31')]=_['intersection'](_0x4ec4ac['model'],qs[_0x3a22('0x32')](_0x6faed3[_0x3a22('0x2d')][_0x3a22('0x32')]));_0xa7cb2[_0x3a22('0x31')]=_0xa7cb2['attributes']['length']?_0xa7cb2['attributes']:_0x4ec4ac[_0x3a22('0x2c')];if(!_0x6faed3[_0x3a22('0x2d')][_0x3a22('0x33')](_0x3a22('0x34'))){_0xa7cb2[_0x3a22('0x1c')]=qs[_0x3a22('0x1c')](_0x6faed3[_0x3a22('0x2d')][_0x3a22('0x1c')]);_0xa7cb2[_0x3a22('0x1b')]=qs[_0x3a22('0x1b')](_0x6faed3[_0x3a22('0x2d')]['offset']);}_0xa7cb2[_0x3a22('0x35')]=qs['sort'](_0x6faed3[_0x3a22('0x2d')]['sort']);_0xa7cb2[_0x3a22('0x36')]=qs[_0x3a22('0x2f')](_[_0x3a22('0x37')](_0x6faed3[_0x3a22('0x2d')],_0x4ec4ac[_0x3a22('0x2f')]),_0xd96897);if(_0x6faed3['query'][_0x3a22('0x38')]){_0xa7cb2['where']=_[_0x3a22('0x39')](_0xa7cb2[_0x3a22('0x36')],{'$or':_[_0x3a22('0x27')](_0xd96897,function(_0x50661a){if(_0x50661a[_0x3a22('0x2a')]!=='VIRTUAL'){var _0x4f3c0a={};_0x4f3c0a[_0x50661a[_0x3a22('0x25')]]={'$like':'%'+_0x6faed3[_0x3a22('0x2d')][_0x3a22('0x38')]+'%'};return _0x4f3c0a;}})});}_0xa7cb2=_[_0x3a22('0x39')]({},_0xa7cb2,_0x6faed3[_0x3a22('0x3a')]);var _0x10a336={'where':_0xa7cb2[_0x3a22('0x36')]};return db['SmsTransferReport'][_0x3a22('0x1d')](_0x10a336)['then'](function(_0x1e5fef){_0x30a765[_0x3a22('0x1d')]=_0x1e5fef;if(_0x6faed3['query']['includeAll']){_0xa7cb2[_0x3a22('0x3b')]=[{'all':!![]}];}return db[_0x3a22('0x3c')][_0x3a22('0x3d')](_0xa7cb2);})[_0x3a22('0x3e')](function(_0x5ba168){_0x30a765[_0x3a22('0x3f')]=_0x5ba168;return _0x30a765;})['then'](respondWithFilteredResult(_0x482df5,_0xa7cb2))['catch'](handleError(_0x482df5,null));};exports['show']=function(_0x317ddb,_0x20557d){var _0x204762={'raw':!![],'where':{'id':_0x317ddb[_0x3a22('0x40')]['id']}},_0x2d7d0d={};_0x2d7d0d[_0x3a22('0x2c')]=_[_0x3a22('0x2e')](db['SmsTransferReport']['rawAttributes']);_0x2d7d0d['query']=_[_0x3a22('0x2e')](_0x317ddb[_0x3a22('0x2d')]);_0x2d7d0d[_0x3a22('0x2f')]=_[_0x3a22('0x30')](_0x2d7d0d[_0x3a22('0x2c')],_0x2d7d0d[_0x3a22('0x2d')]);_0x204762[_0x3a22('0x31')]=_[_0x3a22('0x30')](_0x2d7d0d[_0x3a22('0x2c')],qs[_0x3a22('0x32')](_0x317ddb[_0x3a22('0x2d')]['fields']));_0x204762[_0x3a22('0x31')]=_0x204762[_0x3a22('0x31')][_0x3a22('0x41')]?_0x204762['attributes']:_0x2d7d0d[_0x3a22('0x2c')];if(_0x317ddb[_0x3a22('0x2d')][_0x3a22('0x42')]){_0x204762['include']=[{'all':!![]}];}_0x204762=_[_0x3a22('0x39')]({},_0x204762,_0x317ddb[_0x3a22('0x3a')]);return db[_0x3a22('0x3c')]['find'](_0x204762)['then'](handleEntityNotFound(_0x20557d,null))[_0x3a22('0x3e')](respondWithResult(_0x20557d,null))[_0x3a22('0x43')](handleError(_0x20557d,null));};exports['create']=function(_0x167499,_0x6ad123){return db[_0x3a22('0x3c')]['create'](_0x167499[_0x3a22('0x44')],{})['then'](respondWithResult(_0x6ad123,0xc9))[_0x3a22('0x43')](handleError(_0x6ad123,null));};exports[_0x3a22('0x21')]=function(_0x24b473,_0x483c49){if(_0x24b473['body']['id']){delete _0x24b473[_0x3a22('0x44')]['id'];}return db['SmsTransferReport'][_0x3a22('0x45')]({'where':{'id':_0x24b473[_0x3a22('0x40')]['id']}})[_0x3a22('0x3e')](handleEntityNotFound(_0x483c49,null))[_0x3a22('0x3e')](saveUpdates(_0x24b473[_0x3a22('0x44')],null))[_0x3a22('0x3e')](respondWithResult(_0x483c49,null))[_0x3a22('0x43')](handleError(_0x483c49,null));};exports[_0x3a22('0x46')]=function(_0x37ebd5,_0x385f16){return db[_0x3a22('0x3c')][_0x3a22('0x45')]({'where':{'id':_0x37ebd5[_0x3a22('0x40')]['id']}})[_0x3a22('0x3e')](handleEntityNotFound(_0x385f16,null))['then'](removeEntity(_0x385f16,null))[_0x3a22('0x43')](handleError(_0x385f16,null));};exports[_0x3a22('0x47')]=function(_0x3efde8,_0x593977){return db[_0x3a22('0x3c')][_0x3a22('0x47')]()[_0x3a22('0x3e')](respondWithResult(_0x593977,null))[_0x3a22('0x43')](handleError(_0x593977,null));}; \ No newline at end of file +var _0xda58=['nolimit','order','sort','where','pick','filter','merge','map','findAll','rows','catch','show','intersection','fields','includeAll','include','options','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','SmsTransferReport','rawAttributes','fieldName','type','model','keys','query','filters','attributes'];(function(_0x389a61,_0x20216c){var _0x1acde9=function(_0x3c72d3){while(--_0x3c72d3){_0x389a61['push'](_0x389a61['shift']());}};_0x1acde9(++_0x20216c);}(_0xda58,0x1c5));var _0x8da5=function(_0x512b3f,_0x2874ff){_0x512b3f=_0x512b3f-0x0;var _0x3cdfa2=_0xda58[_0x512b3f];return _0x3cdfa2;};'use strict';var emlformat=require(_0x8da5('0x0'));var rimraf=require(_0x8da5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8da5('0x2'));var rp=require(_0x8da5('0x3'));var moment=require('moment');var BPromise=require(_0x8da5('0x4'));var Mustache=require(_0x8da5('0x5'));var util=require(_0x8da5('0x6'));var path=require(_0x8da5('0x7'));var sox=require(_0x8da5('0x8'));var csv=require(_0x8da5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8da5('0xa'));var _=require('lodash');var squel=require(_0x8da5('0xb'));var crypto=require(_0x8da5('0xc'));var jsforce=require(_0x8da5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8da5('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8da5('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8da5('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8da5('0x10'));var logger=require(_0x8da5('0x11'))(_0x8da5('0x12'));var utils=require(_0x8da5('0x13'));var config=require(_0x8da5('0x14'));var licenseUtil=require(_0x8da5('0x15'));var db=require(_0x8da5('0x16'))['db'];function respondWithStatusCode(_0x960bab,_0x1de072){_0x1de072=_0x1de072||0xcc;return function(_0x198168){if(_0x198168){return _0x960bab['sendStatus'](_0x1de072);}return _0x960bab['status'](_0x1de072)['end']();};}function respondWithResult(_0x19c139,_0x305bc){_0x305bc=_0x305bc||0xc8;return function(_0x534534){if(_0x534534){return _0x19c139[_0x8da5('0x17')](_0x305bc)['json'](_0x534534);}};}function respondWithFilteredResult(_0x3c5065,_0x6eade1){return function(_0x226bcd){if(_0x226bcd){var _0xf298c0=typeof _0x6eade1[_0x8da5('0x18')]===_0x8da5('0x19')&&typeof _0x6eade1[_0x8da5('0x1a')]===_0x8da5('0x19');var _0x4419e1=_0x226bcd[_0x8da5('0x1b')];var _0x5f08f1=_0xf298c0?0x0:_0x6eade1[_0x8da5('0x18')];var _0x2262d1=_0xf298c0?_0x226bcd[_0x8da5('0x1b')]:_0x6eade1[_0x8da5('0x18')]+_0x6eade1[_0x8da5('0x1a')];var _0x572552;if(_0x2262d1>=_0x4419e1){_0x2262d1=_0x4419e1;_0x572552=0xc8;}else{_0x572552=0xce;}_0x3c5065[_0x8da5('0x17')](_0x572552);return _0x3c5065['set'](_0x8da5('0x1c'),_0x5f08f1+'-'+_0x2262d1+'/'+_0x4419e1)[_0x8da5('0x1d')](_0x226bcd);}return null;};}function patchUpdates(_0x24e6a9){return function(_0x4868e0){try{jsonpatch[_0x8da5('0x1e')](_0x4868e0,_0x24e6a9,!![]);}catch(_0x589d71){return BPromise[_0x8da5('0x1f')](_0x589d71);}return _0x4868e0[_0x8da5('0x20')]();};}function saveUpdates(_0x5ed845,_0x1c5a86){return function(_0x3852b6){if(_0x3852b6){return _0x3852b6[_0x8da5('0x21')](_0x5ed845)['then'](function(_0x3cab43){return _0x3cab43;});}return null;};}function removeEntity(_0x309b07,_0x4b5ffb){return function(_0x3d4d7c){if(_0x3d4d7c){return _0x3d4d7c[_0x8da5('0x22')]()[_0x8da5('0x23')](function(){_0x309b07[_0x8da5('0x17')](0xcc)[_0x8da5('0x24')]();});}};}function handleEntityNotFound(_0x325d2d,_0x27ce02){return function(_0x477919){if(!_0x477919){_0x325d2d['sendStatus'](0x194);}return _0x477919;};}function handleError(_0x40d567,_0x276a95){_0x276a95=_0x276a95||0x1f4;return function(_0x13f403){logger[_0x8da5('0x25')](_0x13f403[_0x8da5('0x26')]);if(_0x13f403[_0x8da5('0x27')]){delete _0x13f403[_0x8da5('0x27')];}_0x40d567['status'](_0x276a95)[_0x8da5('0x28')](_0x13f403);};}exports[_0x8da5('0x29')]=function(_0x35a6af,_0x2bcb02){var _0xca8c33={},_0x196e8e={},_0x455923={'count':0x0,'rows':[]};var _0x68527c=_['map'](db[_0x8da5('0x2a')][_0x8da5('0x2b')],function(_0xd846f9){return{'name':_0xd846f9[_0x8da5('0x2c')],'type':_0xd846f9[_0x8da5('0x2d')]['key']};});_0x196e8e[_0x8da5('0x2e')]=_['map'](_0x68527c,'name');_0x196e8e['query']=_[_0x8da5('0x2f')](_0x35a6af[_0x8da5('0x30')]);_0x196e8e[_0x8da5('0x31')]=_['intersection'](_0x196e8e['model'],_0x196e8e['query']);_0xca8c33['attributes']=_['intersection'](_0x196e8e[_0x8da5('0x2e')],qs['fields'](_0x35a6af[_0x8da5('0x30')]['fields']));_0xca8c33[_0x8da5('0x32')]=_0xca8c33['attributes']['length']?_0xca8c33[_0x8da5('0x32')]:_0x196e8e[_0x8da5('0x2e')];if(!_0x35a6af[_0x8da5('0x30')]['hasOwnProperty'](_0x8da5('0x33'))){_0xca8c33[_0x8da5('0x1a')]=qs[_0x8da5('0x1a')](_0x35a6af[_0x8da5('0x30')]['limit']);_0xca8c33['offset']=qs['offset'](_0x35a6af['query'][_0x8da5('0x18')]);}_0xca8c33[_0x8da5('0x34')]=qs['sort'](_0x35a6af[_0x8da5('0x30')][_0x8da5('0x35')]);_0xca8c33[_0x8da5('0x36')]=qs[_0x8da5('0x31')](_[_0x8da5('0x37')](_0x35a6af['query'],_0x196e8e['filters']),_0x68527c);if(_0x35a6af[_0x8da5('0x30')][_0x8da5('0x38')]){_0xca8c33['where']=_[_0x8da5('0x39')](_0xca8c33[_0x8da5('0x36')],{'$or':_[_0x8da5('0x3a')](_0x68527c,function(_0x5c7c7a){if(_0x5c7c7a['type']!=='VIRTUAL'){var _0x55eb0b={};_0x55eb0b[_0x5c7c7a[_0x8da5('0x27')]]={'$like':'%'+_0x35a6af[_0x8da5('0x30')][_0x8da5('0x38')]+'%'};return _0x55eb0b;}})});}_0xca8c33=_[_0x8da5('0x39')]({},_0xca8c33,_0x35a6af['options']);var _0x21c71d={'where':_0xca8c33[_0x8da5('0x36')]};return db[_0x8da5('0x2a')]['count'](_0x21c71d)[_0x8da5('0x23')](function(_0x328fff){_0x455923[_0x8da5('0x1b')]=_0x328fff;if(_0x35a6af[_0x8da5('0x30')]['includeAll']){_0xca8c33['include']=[{'all':!![]}];}return db[_0x8da5('0x2a')][_0x8da5('0x3b')](_0xca8c33);})[_0x8da5('0x23')](function(_0x1cdb70){_0x455923[_0x8da5('0x3c')]=_0x1cdb70;return _0x455923;})[_0x8da5('0x23')](respondWithFilteredResult(_0x2bcb02,_0xca8c33))[_0x8da5('0x3d')](handleError(_0x2bcb02,null));};exports[_0x8da5('0x3e')]=function(_0x29660d,_0x5ed582){var _0x58327c={'raw':!![],'where':{'id':_0x29660d['params']['id']}},_0x312918={};_0x312918[_0x8da5('0x2e')]=_[_0x8da5('0x2f')](db[_0x8da5('0x2a')][_0x8da5('0x2b')]);_0x312918['query']=_[_0x8da5('0x2f')](_0x29660d['query']);_0x312918[_0x8da5('0x31')]=_['intersection'](_0x312918[_0x8da5('0x2e')],_0x312918[_0x8da5('0x30')]);_0x58327c[_0x8da5('0x32')]=_[_0x8da5('0x3f')](_0x312918[_0x8da5('0x2e')],qs[_0x8da5('0x40')](_0x29660d['query'][_0x8da5('0x40')]));_0x58327c[_0x8da5('0x32')]=_0x58327c[_0x8da5('0x32')]['length']?_0x58327c[_0x8da5('0x32')]:_0x312918[_0x8da5('0x2e')];if(_0x29660d[_0x8da5('0x30')][_0x8da5('0x41')]){_0x58327c[_0x8da5('0x42')]=[{'all':!![]}];}_0x58327c=_['merge']({},_0x58327c,_0x29660d[_0x8da5('0x43')]);return db[_0x8da5('0x2a')][_0x8da5('0x44')](_0x58327c)['then'](handleEntityNotFound(_0x5ed582,null))['then'](respondWithResult(_0x5ed582,null))[_0x8da5('0x3d')](handleError(_0x5ed582,null));};exports[_0x8da5('0x45')]=function(_0x23402e,_0x435a2d){return db[_0x8da5('0x2a')]['create'](_0x23402e[_0x8da5('0x46')],{})[_0x8da5('0x23')](respondWithResult(_0x435a2d,0xc9))[_0x8da5('0x3d')](handleError(_0x435a2d,null));};exports[_0x8da5('0x21')]=function(_0x2c7dd5,_0x5eb33a){if(_0x2c7dd5[_0x8da5('0x46')]['id']){delete _0x2c7dd5[_0x8da5('0x46')]['id'];}return db[_0x8da5('0x2a')][_0x8da5('0x44')]({'where':{'id':_0x2c7dd5['params']['id']}})[_0x8da5('0x23')](handleEntityNotFound(_0x5eb33a,null))[_0x8da5('0x23')](saveUpdates(_0x2c7dd5[_0x8da5('0x46')],null))[_0x8da5('0x23')](respondWithResult(_0x5eb33a,null))['catch'](handleError(_0x5eb33a,null));};exports[_0x8da5('0x22')]=function(_0x5bfb31,_0x278151){return db['SmsTransferReport']['find']({'where':{'id':_0x5bfb31['params']['id']}})[_0x8da5('0x23')](handleEntityNotFound(_0x278151,null))[_0x8da5('0x23')](removeEntity(_0x278151,null))[_0x8da5('0x3d')](handleError(_0x278151,null));};exports[_0x8da5('0x47')]=function(_0x2f28c9,_0x2ae82c){return db[_0x8da5('0x2a')]['describe']()[_0x8da5('0x23')](respondWithResult(_0x2ae82c,null))['catch'](handleError(_0x2ae82c,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 3dcaa61..28583a0 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 _0x78cc=['path','rimraf','../../config/environment','SmsTransferReport','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xb83474,_0x41a08a){var _0x1bb9e0=function(_0x3dbdfe){while(--_0x3dbdfe){_0xb83474['push'](_0xb83474['shift']());}};_0x1bb9e0(++_0x41a08a);}(_0x78cc,0x11c));var _0xc78c=function(_0x19ed59,_0x5b4ac6){_0x19ed59=_0x19ed59-0x0;var _0xe73f16=_0x78cc[_0x19ed59];return _0xe73f16;};'use strict';var _=require(_0xc78c('0x0'));var util=require('util');var logger=require(_0xc78c('0x1'))(_0xc78c('0x2'));var moment=require(_0xc78c('0x3'));var BPromise=require(_0xc78c('0x4'));var rp=require(_0xc78c('0x5'));var fs=require('fs');var path=require(_0xc78c('0x6'));var rimraf=require(_0xc78c('0x7'));var config=require(_0xc78c('0x8'));var attributes=require('./smsTransferReport.attributes');module['exports']=function(_0x5c884b,_0x204b56){return _0x5c884b['define'](_0xc78c('0x9'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe3c3=['../../config/logger','api','moment','bluebird','path','rimraf','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util'];(function(_0x5c7a85,_0x41dd19){var _0x35290f=function(_0x26215b){while(--_0x26215b){_0x5c7a85['push'](_0x5c7a85['shift']());}};_0x35290f(++_0x41dd19);}(_0xe3c3,0xb4));var _0x3e3c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe3c3[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3e3c('0x0'));var util=require(_0x3e3c('0x1'));var logger=require(_0x3e3c('0x2'))(_0x3e3c('0x3'));var moment=require(_0x3e3c('0x4'));var BPromise=require(_0x3e3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3e3c('0x6'));var rimraf=require(_0x3e3c('0x7'));var config=require('../../config/environment');var attributes=require(_0x3e3c('0x8'));module[_0x3e3c('0x9')]=function(_0x2ec3c9,_0x55e5b0){return _0x2ec3c9[_0x3e3c('0xa')](_0x3e3c('0xb'),attributes,{'tableName':_0x3e3c('0xc'),'paranoid':![],'indexes':[{'name':_0x3e3c('0xd'),'fields':[_0x3e3c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index d7fb0ed..f887e35 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 _0x70e9=['error','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x28c52d,_0x4e870b){var _0x5d285c=function(_0x57c342){while(--_0x57c342){_0x28c52d['push'](_0x28c52d['shift']());}};_0x5d285c(++_0x4e870b);}(_0x70e9,0x193));var _0x970e=function(_0x3640e3,_0x5031a0){_0x3640e3=_0x3640e3-0x0;var _0x471398=_0x70e9[_0x3640e3];return _0x471398;};'use strict';var _=require('lodash');var util=require(_0x970e('0x0'));var moment=require(_0x970e('0x1'));var BPromise=require('bluebird');var rs=require(_0x970e('0x2'));var fs=require('fs');var Redis=require(_0x970e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x970e('0x4'));var logger=require('../../config/logger')(_0x970e('0x5'));var config=require(_0x970e('0x6'));var jayson=require(_0x970e('0x7'));var client=jayson[_0x970e('0x8')][_0x970e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x303190,_0x1e5701,_0x508324){return new BPromise(function(_0x50cab9,_0x388bf7){return client[_0x970e('0xa')](_0x303190,_0x508324)['then'](function(_0x38c7a0){logger[_0x970e('0xb')](_0x970e('0xc'),_0x1e5701,'request\x20sent');logger[_0x970e('0xd')](_0x970e('0xe'),_0x1e5701,_0x970e('0xf'),JSON[_0x970e('0x10')](_0x38c7a0));if(_0x38c7a0[_0x970e('0x11')]){if(_0x38c7a0[_0x970e('0x11')]['code']===0x1f4){logger[_0x970e('0x11')](_0x970e('0xc'),_0x1e5701,_0x38c7a0[_0x970e('0x11')][_0x970e('0x12')]);return _0x388bf7(_0x38c7a0[_0x970e('0x11')][_0x970e('0x12')]);}logger[_0x970e('0x11')](_0x970e('0xc'),_0x1e5701,_0x38c7a0['error'][_0x970e('0x12')]);return _0x50cab9(_0x38c7a0[_0x970e('0x11')]['message']);}else{logger[_0x970e('0xb')](_0x970e('0xc'),_0x1e5701,_0x970e('0xf'));_0x50cab9(_0x38c7a0[_0x970e('0x13')]['message']);}})[_0x970e('0x14')](function(_0x2ec7f5){logger[_0x970e('0x11')](_0x970e('0xc'),_0x1e5701,_0x2ec7f5);_0x388bf7(_0x2ec7f5);});});} \ No newline at end of file +var _0xc3a8=['result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','SmsTransferReport,\x20%s,\x20%s'];(function(_0x20bce8,_0x4c9684){var _0xb9a2b3=function(_0x4a1dd3){while(--_0x4a1dd3){_0x20bce8['push'](_0x20bce8['shift']());}};_0xb9a2b3(++_0x4c9684);}(_0xc3a8,0xe8));var _0x8c3a=function(_0x1261c2,_0x3ef819){_0x1261c2=_0x1261c2-0x0;var _0x3aabd2=_0xc3a8[_0x1261c2];return _0x3aabd2;};'use strict';var _=require(_0x8c3a('0x0'));var util=require(_0x8c3a('0x1'));var moment=require(_0x8c3a('0x2'));var BPromise=require('bluebird');var rs=require(_0x8c3a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c3a('0x4'))['db'];var utils=require(_0x8c3a('0x5'));var logger=require(_0x8c3a('0x6'))(_0x8c3a('0x7'));var config=require('../../config/environment');var jayson=require(_0x8c3a('0x8'));var client=jayson[_0x8c3a('0x9')][_0x8c3a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x170999,_0x2fae6f,_0x37047e){return new BPromise(function(_0x58a9b0,_0x174e6c){return client[_0x8c3a('0xb')](_0x170999,_0x37047e)[_0x8c3a('0xc')](function(_0x1593a7){logger[_0x8c3a('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x2fae6f,_0x8c3a('0xe'));logger[_0x8c3a('0xf')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x2fae6f,_0x8c3a('0xe'),JSON[_0x8c3a('0x10')](_0x1593a7));if(_0x1593a7[_0x8c3a('0x11')]){if(_0x1593a7[_0x8c3a('0x11')][_0x8c3a('0x12')]===0x1f4){logger[_0x8c3a('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x2fae6f,_0x1593a7[_0x8c3a('0x11')]['message']);return _0x174e6c(_0x1593a7['error'][_0x8c3a('0x13')]);}logger[_0x8c3a('0x11')](_0x8c3a('0x14'),_0x2fae6f,_0x1593a7[_0x8c3a('0x11')][_0x8c3a('0x13')]);return _0x58a9b0(_0x1593a7[_0x8c3a('0x11')][_0x8c3a('0x13')]);}else{logger[_0x8c3a('0xd')](_0x8c3a('0x14'),_0x2fae6f,'request\x20sent');_0x58a9b0(_0x1593a7[_0x8c3a('0x15')][_0x8c3a('0x13')]);}})[_0x8c3a('0x16')](function(_0x1ee355){logger[_0x8c3a('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x2fae6f,_0x1ee355);_0x174e6c(_0x1ee355);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index eafbd24..3653d0b 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 _0xd711=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','extname','single','create','put','delete','exports','multer','util','path'];(function(_0x1c0655,_0x49a3e0){var _0x559e57=function(_0x228246){while(--_0x228246){_0x1c0655['push'](_0x1c0655['shift']());}};_0x559e57(++_0x49a3e0);}(_0xd711,0xd6));var _0x1d71=function(_0x396d77,_0x330eb5){_0x396d77=_0x396d77-0x0;var _0x477389=_0xd711[_0x396d77];return _0x477389;};'use strict';var multer=require(_0x1d71('0x0'));var util=require(_0x1d71('0x1'));var path=require(_0x1d71('0x2'));var timeout=require(_0x1d71('0x3'));var express=require(_0x1d71('0x4'));var router=express[_0x1d71('0x5')]();var fs_extra=require(_0x1d71('0x6'));var auth=require(_0x1d71('0x7'));var interaction=require(_0x1d71('0x8'));var config=require(_0x1d71('0x9'));var controller=require(_0x1d71('0xa'));router[_0x1d71('0xb')]('/',auth[_0x1d71('0xc')](),controller[_0x1d71('0xd')]);router[_0x1d71('0xb')](_0x1d71('0xe'),auth[_0x1d71('0xc')](),controller[_0x1d71('0xf')]);router[_0x1d71('0xb')](_0x1d71('0x10'),auth[_0x1d71('0xc')](),controller[_0x1d71('0x11')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x73190d,_0x481c8a,_0x3e2f6f){_0x3e2f6f(null,path[_0x1d71('0x12')](config[_0x1d71('0x13')],_0x1d71('0x14')));},'filename':function(_0x188b38,_0x577544,_0x3ec2c5){_0x577544[_0x1d71('0x15')]=_0x577544[_0x1d71('0x15')][_0x1d71('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3ec2c5(null,util[_0x1d71('0x17')](_0x1d71('0x18'),path['basename'](_0x577544[_0x1d71('0x15')],path[_0x1d71('0x19')](_0x577544[_0x1d71('0x15')])),Date['now'](),path[_0x1d71('0x19')](_0x577544[_0x1d71('0x15')])));}})});router['post']('/',upload[_0x1d71('0x1a')]('file'),controller[_0x1d71('0x1b')]);router[_0x1d71('0x1c')](_0x1d71('0xe'),auth[_0x1d71('0xc')](),controller['update']);router[_0x1d71('0x1d')](_0x1d71('0xe'),auth[_0x1d71('0xc')](),controller['delete']);module[_0x1d71('0x1e')]=router; \ No newline at end of file +var _0x3d78=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post','create','put','update','delete'];(function(_0xf39ada,_0x177fb7){var _0x244acb=function(_0x358204){while(--_0x358204){_0xf39ada['push'](_0xf39ada['shift']());}};_0x244acb(++_0x177fb7);}(_0x3d78,0xe9));var _0x83d7=function(_0x28bde1,_0x49cb5b){_0x28bde1=_0x28bde1-0x0;var _0x15be5c=_0x3d78[_0x28bde1];return _0x15be5c;};'use strict';var multer=require('multer');var util=require(_0x83d7('0x0'));var path=require(_0x83d7('0x1'));var timeout=require(_0x83d7('0x2'));var express=require(_0x83d7('0x3'));var router=express[_0x83d7('0x4')]();var fs_extra=require(_0x83d7('0x5'));var auth=require(_0x83d7('0x6'));var interaction=require(_0x83d7('0x7'));var config=require(_0x83d7('0x8'));var controller=require('./sound.controller');router[_0x83d7('0x9')]('/',auth[_0x83d7('0xa')](),controller[_0x83d7('0xb')]);router['get'](_0x83d7('0xc'),auth[_0x83d7('0xa')](),controller['show']);router[_0x83d7('0x9')]('/:id/download',auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x36dfde,_0x4d0b4a,_0x225134){_0x225134(null,path[_0x83d7('0xd')](config[_0x83d7('0xe')],_0x83d7('0xf')));},'filename':function(_0x113552,_0x828dfb,_0x1e367f){_0x828dfb['originalname']=_0x828dfb[_0x83d7('0x10')][_0x83d7('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1e367f(null,util[_0x83d7('0x12')](_0x83d7('0x13'),path[_0x83d7('0x14')](_0x828dfb[_0x83d7('0x10')],path[_0x83d7('0x15')](_0x828dfb[_0x83d7('0x10')])),Date[_0x83d7('0x16')](),path[_0x83d7('0x15')](_0x828dfb[_0x83d7('0x10')])));}})});router[_0x83d7('0x17')]('/',upload['single']('file'),controller[_0x83d7('0x18')]);router[_0x83d7('0x19')](_0x83d7('0xc'),auth[_0x83d7('0xa')](),controller[_0x83d7('0x1a')]);router[_0x83d7('0x1b')](_0x83d7('0xc'),auth[_0x83d7('0xa')](),controller['delete']);module[_0x83d7('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 2dcc661..e02a88f 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 _0x4977=['STRING','name','FLOAT','BIGINT','INTEGER','sequelize','exports'];(function(_0x1e82f5,_0x18ffed){var _0x5107d0=function(_0x45788f){while(--_0x45788f){_0x1e82f5['push'](_0x1e82f5['shift']());}};_0x5107d0(++_0x18ffed);}(_0x4977,0x6e));var _0x7497=function(_0xb35c09,_0x2e923b){_0xb35c09=_0xb35c09-0x0;var _0x8f8507=_0x4977[_0xb35c09];return _0x8f8507;};'use strict';var Sequelize=require(_0x7497('0x0'));module[_0x7497('0x1')]={'name':{'type':Sequelize[_0x7497('0x2')],'unique':_0x7497('0x3'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x7497('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x7497('0x2')]},'original_format':{'type':Sequelize[_0x7497('0x2')]},'original_duration':{'type':Sequelize[_0x7497('0x4')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x7497('0x5')]},'original_sampleRate':{'type':Sequelize[_0x7497('0x6')]},'converted_format':{'type':Sequelize[_0x7497('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x7497('0x5')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x7497('0x5')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xa9aa=['exports','STRING','FLOAT','BIGINT','INTEGER','sequelize'];(function(_0x1c97c8,_0x28d564){var _0x2c096d=function(_0x1bf3ec){while(--_0x1bf3ec){_0x1c97c8['push'](_0x1c97c8['shift']());}};_0x2c096d(++_0x28d564);}(_0xa9aa,0xb9));var _0xaa9a=function(_0x713d1e,_0x2fc04e){_0x713d1e=_0x713d1e-0x0;var _0x1f26df=_0xa9aa[_0x713d1e];return _0x1f26df;};'use strict';var Sequelize=require(_0xaa9a('0x0'));module[_0xaa9a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xaa9a('0x2')]},'display_name':{'type':Sequelize[_0xaa9a('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xaa9a('0x2')]},'original_format':{'type':Sequelize[_0xaa9a('0x2')]},'original_duration':{'type':Sequelize[_0xaa9a('0x3')]},'original_sampleCount':{'type':Sequelize[_0xaa9a('0x4')]},'original_channelCount':{'type':Sequelize[_0xaa9a('0x5')]},'original_bitRate':{'type':Sequelize[_0xaa9a('0x4')]},'original_sampleRate':{'type':Sequelize[_0xaa9a('0x5')]},'converted_format':{'type':Sequelize[_0xaa9a('0x2')]},'converted_duration':{'type':Sequelize[_0xaa9a('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xaa9a('0x4')]},'converted_channelCount':{'type':Sequelize[_0xaa9a('0x5')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xaa9a('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index bce9392..3ec80f0 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 _0x20ec=['jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','get','Sounds','error','name','index','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','sort','where','pick','VIRTUAL','merge','options','Sound','includeAll','findAll','params','include','catch','download','find','converted_format','join','server/files/sounds/converted','Sequelize','root','%s.%s','save_name','create','originalname','file','basename','filename','extname','substring','wav','server/files/sounds/original','format','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','0777','unlinkSync','send','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_sampleRate','chmodSync','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','original_format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto'];(function(_0x267382,_0x101697){var _0x342ec1=function(_0x50b9c1){while(--_0x50b9c1){_0x267382['push'](_0x267382['shift']());}};_0x342ec1(++_0x101697);}(_0x20ec,0x159));var _0xc20e=function(_0x239632,_0x472e6a){_0x239632=_0x239632-0x0;var _0x2fad25=_0x20ec[_0x239632];return _0x2fad25;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc20e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc20e('0x1'));var rp=require(_0xc20e('0x2'));var moment=require(_0xc20e('0x3'));var BPromise=require(_0xc20e('0x4'));var Mustache=require('mustache');var util=require(_0xc20e('0x5'));var path=require(_0xc20e('0x6'));var sox=require(_0xc20e('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc20e('0x8'));var _=require(_0xc20e('0x9'));var squel=require(_0xc20e('0xa'));var crypto=require(_0xc20e('0xb'));var jsforce=require(_0xc20e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc20e('0xd'));var querystring=require(_0xc20e('0xe'));var Papa=require(_0xc20e('0xf'));var Redis=require(_0xc20e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc20e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc20e('0x12'));var logger=require('../../config/logger')(_0xc20e('0x13'));var utils=require(_0xc20e('0x14'));var config=require(_0xc20e('0x15'));var licenseUtil=require(_0xc20e('0x16'));var db=require(_0xc20e('0x17'))['db'];function respondWithStatusCode(_0x4910d4,_0x4892fb){_0x4892fb=_0x4892fb||0xcc;return function(_0x251250){if(_0x251250){return _0x4910d4[_0xc20e('0x18')](_0x4892fb);}return _0x4910d4[_0xc20e('0x19')](_0x4892fb)[_0xc20e('0x1a')]();};}function respondWithResult(_0x39ed2d,_0x4e62ed){_0x4e62ed=_0x4e62ed||0xc8;return function(_0xebe083){if(_0xebe083){return _0x39ed2d['status'](_0x4e62ed)[_0xc20e('0x1b')](_0xebe083);}};}function respondWithFilteredResult(_0x1012ff,_0x1f2fce){return function(_0x418b30){if(_0x418b30){var _0x394e1f=typeof _0x1f2fce[_0xc20e('0x1c')]===_0xc20e('0x1d')&&typeof _0x1f2fce[_0xc20e('0x1e')]===_0xc20e('0x1d');var _0x2f73b3=_0x418b30[_0xc20e('0x1f')];var _0x40df1f=_0x394e1f?0x0:_0x1f2fce[_0xc20e('0x1c')];var _0x5bfa8f=_0x394e1f?_0x418b30[_0xc20e('0x1f')]:_0x1f2fce[_0xc20e('0x1c')]+_0x1f2fce[_0xc20e('0x1e')];var _0x3621d4;if(_0x5bfa8f>=_0x2f73b3){_0x5bfa8f=_0x2f73b3;_0x3621d4=0xc8;}else{_0x3621d4=0xce;}_0x1012ff['status'](_0x3621d4);return _0x1012ff['set'](_0xc20e('0x20'),_0x40df1f+'-'+_0x5bfa8f+'/'+_0x2f73b3)[_0xc20e('0x1b')](_0x418b30);}return null;};}function patchUpdates(_0x4b541e){return function(_0xe8e6e3){try{jsonpatch['apply'](_0xe8e6e3,_0x4b541e,!![]);}catch(_0x319f79){return BPromise[_0xc20e('0x21')](_0x319f79);}return _0xe8e6e3[_0xc20e('0x22')]();};}function saveUpdates(_0x3b1276,_0x1976d5){return function(_0x3e27af){if(_0x3e27af){return _0x3e27af[_0xc20e('0x23')](_0x3b1276)[_0xc20e('0x24')](function(_0x25aa25){return _0x25aa25;});}return null;};}function removeEntity(_0x5d50cb,_0x199c7b){return function(_0x10fa00){if(_0x10fa00){return _0x10fa00[_0xc20e('0x25')]()[_0xc20e('0x24')](function(){var _0x2aa25a=_0x10fa00[_0xc20e('0x26')]({'plain':!![]});var _0x46b370=_0xc20e('0x27');return db['UserProfileResource'][_0xc20e('0x25')]({'where':{'type':_0x46b370,'resourceId':_0x2aa25a['id']}})[_0xc20e('0x24')](function(){return _0x10fa00;});})[_0xc20e('0x24')](function(){_0x5d50cb['status'](0xcc)[_0xc20e('0x1a')]();});}};}function handleEntityNotFound(_0x2b3be1,_0x214e04){return function(_0x57fa9f){if(!_0x57fa9f){_0x2b3be1[_0xc20e('0x18')](0x194);}return _0x57fa9f;};}function handleError(_0x558328,_0x4a23b2){_0x4a23b2=_0x4a23b2||0x1f4;return function(_0x5f39e3){logger[_0xc20e('0x28')](_0x5f39e3['stack']);if(_0x5f39e3['name']){delete _0x5f39e3[_0xc20e('0x29')];}_0x558328[_0xc20e('0x19')](_0x4a23b2)['send'](_0x5f39e3);};}exports[_0xc20e('0x2a')]=function(_0x59e459,_0x2c3ce7){var _0x23ee34={},_0x1637ed={},_0x2facac={'count':0x0,'rows':[]};var _0x5c7389=_['map'](db['Sound'][_0xc20e('0x2b')],function(_0x21864b){return{'name':_0x21864b[_0xc20e('0x2c')],'type':_0x21864b['type'][_0xc20e('0x2d')]};});_0x1637ed['model']=_[_0xc20e('0x2e')](_0x5c7389,'name');_0x1637ed[_0xc20e('0x2f')]=_[_0xc20e('0x30')](_0x59e459[_0xc20e('0x2f')]);_0x1637ed[_0xc20e('0x31')]=_[_0xc20e('0x32')](_0x1637ed[_0xc20e('0x33')],_0x1637ed[_0xc20e('0x2f')]);_0x23ee34['attributes']=_[_0xc20e('0x32')](_0x1637ed['model'],qs[_0xc20e('0x34')](_0x59e459[_0xc20e('0x2f')][_0xc20e('0x34')]));_0x23ee34[_0xc20e('0x35')]=_0x23ee34[_0xc20e('0x35')]['length']?_0x23ee34[_0xc20e('0x35')]:_0x1637ed[_0xc20e('0x33')];if(!_0x59e459[_0xc20e('0x2f')][_0xc20e('0x36')]('nolimit')){_0x23ee34['limit']=qs['limit'](_0x59e459['query'][_0xc20e('0x1e')]);_0x23ee34[_0xc20e('0x1c')]=qs[_0xc20e('0x1c')](_0x59e459[_0xc20e('0x2f')][_0xc20e('0x1c')]);}_0x23ee34['order']=qs[_0xc20e('0x37')](_0x59e459[_0xc20e('0x2f')]['sort']);_0x23ee34[_0xc20e('0x38')]=qs['filters'](_[_0xc20e('0x39')](_0x59e459[_0xc20e('0x2f')],_0x1637ed[_0xc20e('0x31')]),_0x5c7389);if(_0x59e459['query']['filter']){_0x23ee34[_0xc20e('0x38')]=_['merge'](_0x23ee34[_0xc20e('0x38')],{'$or':_[_0xc20e('0x2e')](_0x5c7389,function(_0x248118){if(_0x248118['type']!==_0xc20e('0x3a')){var _0xb241e9={};_0xb241e9[_0x248118[_0xc20e('0x29')]]={'$like':'%'+_0x59e459[_0xc20e('0x2f')]['filter']+'%'};return _0xb241e9;}})});}_0x23ee34=_[_0xc20e('0x3b')]({},_0x23ee34,_0x59e459[_0xc20e('0x3c')]);var _0x55306b={'where':_0x23ee34[_0xc20e('0x38')]};return db[_0xc20e('0x3d')][_0xc20e('0x1f')](_0x55306b)[_0xc20e('0x24')](function(_0x27ddec){_0x2facac[_0xc20e('0x1f')]=_0x27ddec;if(_0x59e459[_0xc20e('0x2f')][_0xc20e('0x3e')]){_0x23ee34['include']=[{'all':!![]}];}return db['Sound'][_0xc20e('0x3f')](_0x23ee34);})[_0xc20e('0x24')](function(_0x9e44c3){_0x2facac['rows']=_0x9e44c3;return _0x2facac;})[_0xc20e('0x24')](respondWithFilteredResult(_0x2c3ce7,_0x23ee34))['catch'](handleError(_0x2c3ce7,null));};exports['show']=function(_0x1b0536,_0x5c129d){var _0xd63b35={'raw':!![],'where':{'id':_0x1b0536[_0xc20e('0x40')]['id']}},_0x58ada7={};_0x58ada7[_0xc20e('0x33')]=_[_0xc20e('0x30')](db[_0xc20e('0x3d')][_0xc20e('0x2b')]);_0x58ada7[_0xc20e('0x2f')]=_[_0xc20e('0x30')](_0x1b0536[_0xc20e('0x2f')]);_0x58ada7[_0xc20e('0x31')]=_[_0xc20e('0x32')](_0x58ada7['model'],_0x58ada7[_0xc20e('0x2f')]);_0xd63b35[_0xc20e('0x35')]=_['intersection'](_0x58ada7[_0xc20e('0x33')],qs[_0xc20e('0x34')](_0x1b0536[_0xc20e('0x2f')]['fields']));_0xd63b35[_0xc20e('0x35')]=_0xd63b35[_0xc20e('0x35')]['length']?_0xd63b35[_0xc20e('0x35')]:_0x58ada7[_0xc20e('0x33')];if(_0x1b0536['query'][_0xc20e('0x3e')]){_0xd63b35[_0xc20e('0x41')]=[{'all':!![]}];}_0xd63b35=_[_0xc20e('0x3b')]({},_0xd63b35,_0x1b0536[_0xc20e('0x3c')]);return db[_0xc20e('0x3d')]['find'](_0xd63b35)[_0xc20e('0x24')](handleEntityNotFound(_0x5c129d,null))[_0xc20e('0x24')](respondWithResult(_0x5c129d,null))[_0xc20e('0x42')](handleError(_0x5c129d,null));};exports[_0xc20e('0x43')]=function(_0x495b38,_0x548a65,_0x4a385e){return db[_0xc20e('0x3d')][_0xc20e('0x44')]({'where':{'id':_0x495b38[_0xc20e('0x40')]['id']},'attributes':['name','save_name',_0xc20e('0x45')],'raw':!![]})['then'](handleEntityNotFound(_0x548a65,null))[_0xc20e('0x24')](function(_0x2f74ca){if(_0x2f74ca){if(!fs['existsSync'](path[_0xc20e('0x46')](config['root'],_0xc20e('0x47'),_0x2f74ca['save_name']+'.'+_0x2f74ca[_0xc20e('0x45')]))){throw new db[(_0xc20e('0x48'))]['ValidationError']('Sound\x20not\x20found');}return _0x548a65[_0xc20e('0x43')](path[_0xc20e('0x46')](config[_0xc20e('0x49')],'server/files/sounds/converted',util['format'](_0xc20e('0x4a'),_0x2f74ca[_0xc20e('0x4b')],_0x2f74ca[_0xc20e('0x45')])),util['format'](_0xc20e('0x4a'),_0x2f74ca[_0xc20e('0x29')],_0x2f74ca[_0xc20e('0x45')]));}return null;})[_0xc20e('0x42')](handleError(_0x548a65,null));};exports[_0xc20e('0x4c')]=function(_0x56ba59,_0x3a10e2,_0x480d36){var _0xaa4ade={'name':path['basename'](_0x56ba59['file'][_0xc20e('0x4d')],path['extname'](_0x56ba59[_0xc20e('0x4e')][_0xc20e('0x4d')])),'save_name':path[_0xc20e('0x4f')](_0x56ba59[_0xc20e('0x4e')][_0xc20e('0x50')],path[_0xc20e('0x51')](_0x56ba59[_0xc20e('0x4e')][_0xc20e('0x50')])),'original_format':path['extname'](_0x56ba59[_0xc20e('0x4e')]['originalname'])[_0xc20e('0x52')](0x1),'converted_format':_0xc20e('0x53')};var _0x3d35bc=path[_0xc20e('0x46')](config[_0xc20e('0x49')],_0xc20e('0x54'),_0x56ba59[_0xc20e('0x4e')]['filename']);var _0x401b80=path[_0xc20e('0x46')](config['root'],'server/files/sounds/converted',util[_0xc20e('0x55')](_0xc20e('0x4a'),path[_0xc20e('0x4f')](_0x56ba59[_0xc20e('0x4e')]['filename'],path['extname'](_0x56ba59[_0xc20e('0x4e')][_0xc20e('0x50')])),_0xaa4ade[_0xc20e('0x45')]));logger[_0xc20e('0x56')](_0xc20e('0x57'),_0x3d35bc);logger[_0xc20e('0x56')](_0xc20e('0x58'),_0x401b80);try{fs['chmodSync'](_0x3d35bc,parseInt(_0xc20e('0x59'),0x8));var _0x319706=sox['transcode'](_0x3d35bc,_0x401b80,{'sampleRate':0x1f40,'format':_0xc20e('0x53'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x319706['on']('error',function(_0x41902a){fs[_0xc20e('0x5a')](_0x3d35bc);_0x3a10e2[_0xc20e('0x19')](0x1f4)[_0xc20e('0x5b')](_0x41902a);});_0x319706['on'](_0xc20e('0x5c'),function(_0x5e6182){_0xaa4ade['original_duration']=isNaN(_0x5e6182[_0xc20e('0x5d')])?null:_0x5e6182[_0xc20e('0x5d')]*0x3e8;_0xaa4ade[_0xc20e('0x5e')]=isNaN(_0x5e6182[_0xc20e('0x5f')])?null:_0x5e6182['sampleCount'];_0xaa4ade[_0xc20e('0x60')]=isNaN(_0x5e6182[_0xc20e('0x61')])?null:_0x5e6182[_0xc20e('0x61')];_0xaa4ade[_0xc20e('0x62')]=isNaN(_0x5e6182['bitRate'])?null:_0x5e6182[_0xc20e('0x63')];_0xaa4ade[_0xc20e('0x64')]=isNaN(_0x5e6182[_0xc20e('0x65')])?null:_0x5e6182[_0xc20e('0x65')];});_0x319706['on'](_0xc20e('0x66'),function(_0x18d96f){_0xaa4ade[_0xc20e('0x67')]=isNaN(_0x18d96f[_0xc20e('0x5d')])?null:_0x18d96f[_0xc20e('0x5d')]*0x3e8;_0xaa4ade[_0xc20e('0x68')]=isNaN(_0x18d96f['sampleCount'])?null:_0x18d96f[_0xc20e('0x5f')];_0xaa4ade[_0xc20e('0x69')]=isNaN(_0x18d96f[_0xc20e('0x61')])?null:_0x18d96f[_0xc20e('0x61')];_0xaa4ade['converted_bitRate']=isNaN(_0x18d96f[_0xc20e('0x63')])?null:_0x18d96f[_0xc20e('0x63')];_0xaa4ade[_0xc20e('0x6a')]=isNaN(_0x18d96f[_0xc20e('0x65')])?null:_0x18d96f[_0xc20e('0x65')];});_0x319706['on'](_0xc20e('0x1a'),function(){fs[_0xc20e('0x6b')](_0x401b80,parseInt(_0xc20e('0x59'),0x8));return db['Sound'][_0xc20e('0x4c')](_0xaa4ade)['then'](function(_0x3e03d8){var _0x28699a={'role':_0x56ba59[_0xc20e('0x6c')][_0xc20e('0x6d')],'userProfileId':_0x56ba59['body'][_0xc20e('0x6e')]};if(!_0x28699a)throw new Error(_0xc20e('0x6f'));if(_0x28699a['role']===_0xc20e('0x70')){var _0x5b28e6=_0x3e03d8[_0xc20e('0x26')]({'plain':!![]});return db['UserProfileSection'][_0xc20e('0x44')]({'where':{'name':_0xc20e('0x27'),'userProfileId':_0x28699a[_0xc20e('0x6e')]},'raw':!![]})[_0xc20e('0x24')](function(_0x55ede5){if(_0x55ede5&&_0x55ede5[_0xc20e('0x71')]===0x0){return db[_0xc20e('0x72')][_0xc20e('0x4c')]({'name':_0x5b28e6[_0xc20e('0x29')],'resourceId':_0x5b28e6['id'],'type':_0x55ede5[_0xc20e('0x29')],'sectionId':_0x55ede5['id']},{})[_0xc20e('0x24')](function(){return _0x3e03d8;});}else{return _0x3e03d8;}})[_0xc20e('0x42')](function(_0x1b0c73){logger[_0xc20e('0x28')](_0xc20e('0x73'),_0x1b0c73);throw _0x1b0c73;});}return _0x3e03d8;})[_0xc20e('0x24')](respondWithResult(_0x3a10e2,null))[_0xc20e('0x42')](handleError(_0x3a10e2,null));});_0x319706[_0xc20e('0x74')]();}catch(_0x596c69){_0x3a10e2['status'](0x1f4)['send'](_0x596c69);}};exports['update']=function(_0x391a3b,_0x1a7cda,_0x4a214c){return db[_0xc20e('0x3d')][_0xc20e('0x44')]({'where':{'id':_0x391a3b[_0xc20e('0x40')]['id']}})[_0xc20e('0x24')](handleEntityNotFound(_0x1a7cda,null))[_0xc20e('0x24')](saveUpdates(_[_0xc20e('0x39')](_0x391a3b['body'],[_0xc20e('0x29'),'description']),null))[_0xc20e('0x24')](respondWithResult(_0x1a7cda,null))[_0xc20e('0x42')](handleError(_0x1a7cda,null));};exports[_0xc20e('0x75')]=function(_0x365e59,_0x1dc6c5,_0x46c755){return db[_0xc20e('0x3d')][_0xc20e('0x44')]({'where':{'id':_0x365e59[_0xc20e('0x40')]['id']}})[_0xc20e('0x24')](function(_0x415b7b){if(_0x415b7b){return _0x415b7b[_0xc20e('0x25')]();}})[_0xc20e('0x24')](function(_0x20c734){var _0x2ea2d3=path[_0xc20e('0x46')](config[_0xc20e('0x49')],'server/files/sounds/original',util[_0xc20e('0x55')](_0xc20e('0x4a'),_0x20c734[_0xc20e('0x4b')],_0x20c734[_0xc20e('0x76')]));var _0x16c6ff=path[_0xc20e('0x46')](config['root'],_0xc20e('0x47'),util[_0xc20e('0x55')](_0xc20e('0x4a'),_0x20c734[_0xc20e('0x4b')],_0x20c734[_0xc20e('0x45')]));fs[_0xc20e('0x5a')](_0x2ea2d3);fs[_0xc20e('0x5a')](_0x16c6ff);return _0x20c734;})[_0xc20e('0x24')](function(_0x49f0ec){if(_0x49f0ec){return _0x1dc6c5[_0xc20e('0x19')](0xcc)['end']();}})[_0xc20e('0x24')](handleEntityNotFound(_0x1dc6c5,null))['catch'](handleError(_0x1dc6c5,null));}; \ No newline at end of file +var _0xd5b2=['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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','then','get','Sounds','UserProfileResource','end','error','stack','name','index','Sound','fieldName','type','key','model','map','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','catch','keys','rawAttributes','length','find','download','params','save_name','converted_format','existsSync','root','server/files/sounds/converted','ValidationError','join','format','%s.%s','basename','file','originalname','extname','filename','substring','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','unlinkSync','send','original_duration','duration','sampleCount','original_channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','channelCount','converted_bitRate','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','description','server/files/sounds/original','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x58e767,_0x530936){var _0x169942=function(_0x2e787e){while(--_0x2e787e){_0x58e767['push'](_0x58e767['shift']());}};_0x169942(++_0x530936);}(_0xd5b2,0x7a));var _0x2d5b=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xd5b2[_0x24237f];return _0x48298e;};'use strict';var emlformat=require(_0x2d5b('0x0'));var rimraf=require(_0x2d5b('0x1'));var zipdir=require(_0x2d5b('0x2'));var jsonpatch=require(_0x2d5b('0x3'));var rp=require(_0x2d5b('0x4'));var moment=require('moment');var BPromise=require(_0x2d5b('0x5'));var Mustache=require(_0x2d5b('0x6'));var util=require(_0x2d5b('0x7'));var path=require(_0x2d5b('0x8'));var sox=require(_0x2d5b('0x9'));var csv=require(_0x2d5b('0xa'));var ejs=require(_0x2d5b('0xb'));var fs=require('fs');var fs_extra=require(_0x2d5b('0xc'));var _=require(_0x2d5b('0xd'));var squel=require(_0x2d5b('0xe'));var crypto=require(_0x2d5b('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x2d5b('0x10'));var toCsv=require(_0x2d5b('0xa'));var querystring=require(_0x2d5b('0x11'));var Papa=require(_0x2d5b('0x12'));var Redis=require(_0x2d5b('0x13'));var authService=require(_0x2d5b('0x14'));var qs=require(_0x2d5b('0x15'));var as=require(_0x2d5b('0x16'));var hardwareService=require(_0x2d5b('0x17'));var logger=require('../../config/logger')(_0x2d5b('0x18'));var utils=require(_0x2d5b('0x19'));var config=require(_0x2d5b('0x1a'));var licenseUtil=require(_0x2d5b('0x1b'));var db=require(_0x2d5b('0x1c'))['db'];function respondWithStatusCode(_0x411203,_0x3567ae){_0x3567ae=_0x3567ae||0xcc;return function(_0x184078){if(_0x184078){return _0x411203[_0x2d5b('0x1d')](_0x3567ae);}return _0x411203[_0x2d5b('0x1e')](_0x3567ae)['end']();};}function respondWithResult(_0x22e6c2,_0x5c646c){_0x5c646c=_0x5c646c||0xc8;return function(_0x53e630){if(_0x53e630){return _0x22e6c2[_0x2d5b('0x1e')](_0x5c646c)[_0x2d5b('0x1f')](_0x53e630);}};}function respondWithFilteredResult(_0x500005,_0xbb5f84){return function(_0x259a0f){if(_0x259a0f){var _0x4e585c=typeof _0xbb5f84['offset']===_0x2d5b('0x20')&&typeof _0xbb5f84[_0x2d5b('0x21')]===_0x2d5b('0x20');var _0x1cea46=_0x259a0f[_0x2d5b('0x22')];var _0x33ac0e=_0x4e585c?0x0:_0xbb5f84[_0x2d5b('0x23')];var _0x25e30a=_0x4e585c?_0x259a0f[_0x2d5b('0x22')]:_0xbb5f84[_0x2d5b('0x23')]+_0xbb5f84['limit'];var _0x3dc9b9;if(_0x25e30a>=_0x1cea46){_0x25e30a=_0x1cea46;_0x3dc9b9=0xc8;}else{_0x3dc9b9=0xce;}_0x500005['status'](_0x3dc9b9);return _0x500005[_0x2d5b('0x24')](_0x2d5b('0x25'),_0x33ac0e+'-'+_0x25e30a+'/'+_0x1cea46)['json'](_0x259a0f);}return null;};}function patchUpdates(_0x376717){return function(_0x2518f1){try{jsonpatch[_0x2d5b('0x26')](_0x2518f1,_0x376717,!![]);}catch(_0x450886){return BPromise[_0x2d5b('0x27')](_0x450886);}return _0x2518f1[_0x2d5b('0x28')]();};}function saveUpdates(_0x2a35bc,_0x5b6c8c){return function(_0x2d3775){if(_0x2d3775){return _0x2d3775['update'](_0x2a35bc)['then'](function(_0xd298f2){return _0xd298f2;});}return null;};}function removeEntity(_0x48f196,_0x9343a3){return function(_0x42e492){if(_0x42e492){return _0x42e492[_0x2d5b('0x29')]()[_0x2d5b('0x2a')](function(){var _0x19c63c=_0x42e492[_0x2d5b('0x2b')]({'plain':!![]});var _0x493cd4=_0x2d5b('0x2c');return db[_0x2d5b('0x2d')][_0x2d5b('0x29')]({'where':{'type':_0x493cd4,'resourceId':_0x19c63c['id']}})[_0x2d5b('0x2a')](function(){return _0x42e492;});})[_0x2d5b('0x2a')](function(){_0x48f196[_0x2d5b('0x1e')](0xcc)[_0x2d5b('0x2e')]();});}};}function handleEntityNotFound(_0x3ad5a2,_0x370106){return function(_0x3c0a13){if(!_0x3c0a13){_0x3ad5a2[_0x2d5b('0x1d')](0x194);}return _0x3c0a13;};}function handleError(_0x544742,_0x109965){_0x109965=_0x109965||0x1f4;return function(_0x4d988d){logger[_0x2d5b('0x2f')](_0x4d988d[_0x2d5b('0x30')]);if(_0x4d988d['name']){delete _0x4d988d[_0x2d5b('0x31')];}_0x544742['status'](_0x109965)['send'](_0x4d988d);};}exports[_0x2d5b('0x32')]=function(_0x320cd4,_0x4ae98c){var _0x2fbbbb={},_0x26b29b={},_0x2f7fa3={'count':0x0,'rows':[]};var _0x487909=_['map'](db[_0x2d5b('0x33')]['rawAttributes'],function(_0x178e6f){return{'name':_0x178e6f[_0x2d5b('0x34')],'type':_0x178e6f[_0x2d5b('0x35')][_0x2d5b('0x36')]};});_0x26b29b[_0x2d5b('0x37')]=_[_0x2d5b('0x38')](_0x487909,_0x2d5b('0x31'));_0x26b29b[_0x2d5b('0x39')]=_['keys'](_0x320cd4['query']);_0x26b29b['filters']=_[_0x2d5b('0x3a')](_0x26b29b[_0x2d5b('0x37')],_0x26b29b[_0x2d5b('0x39')]);_0x2fbbbb[_0x2d5b('0x3b')]=_[_0x2d5b('0x3a')](_0x26b29b[_0x2d5b('0x37')],qs[_0x2d5b('0x3c')](_0x320cd4[_0x2d5b('0x39')]['fields']));_0x2fbbbb[_0x2d5b('0x3b')]=_0x2fbbbb['attributes']['length']?_0x2fbbbb[_0x2d5b('0x3b')]:_0x26b29b['model'];if(!_0x320cd4[_0x2d5b('0x39')][_0x2d5b('0x3d')]('nolimit')){_0x2fbbbb[_0x2d5b('0x21')]=qs['limit'](_0x320cd4[_0x2d5b('0x39')][_0x2d5b('0x21')]);_0x2fbbbb[_0x2d5b('0x23')]=qs[_0x2d5b('0x23')](_0x320cd4[_0x2d5b('0x39')][_0x2d5b('0x23')]);}_0x2fbbbb[_0x2d5b('0x3e')]=qs[_0x2d5b('0x3f')](_0x320cd4[_0x2d5b('0x39')][_0x2d5b('0x3f')]);_0x2fbbbb[_0x2d5b('0x40')]=qs[_0x2d5b('0x41')](_['pick'](_0x320cd4[_0x2d5b('0x39')],_0x26b29b[_0x2d5b('0x41')]),_0x487909);if(_0x320cd4[_0x2d5b('0x39')][_0x2d5b('0x42')]){_0x2fbbbb[_0x2d5b('0x40')]=_['merge'](_0x2fbbbb[_0x2d5b('0x40')],{'$or':_[_0x2d5b('0x38')](_0x487909,function(_0x67d73){if(_0x67d73[_0x2d5b('0x35')]!=='VIRTUAL'){var _0xd1029b={};_0xd1029b[_0x67d73[_0x2d5b('0x31')]]={'$like':'%'+_0x320cd4['query'][_0x2d5b('0x42')]+'%'};return _0xd1029b;}})});}_0x2fbbbb=_[_0x2d5b('0x43')]({},_0x2fbbbb,_0x320cd4[_0x2d5b('0x44')]);var _0x5baf23={'where':_0x2fbbbb['where']};return db[_0x2d5b('0x33')][_0x2d5b('0x22')](_0x5baf23)[_0x2d5b('0x2a')](function(_0x44bf5b){_0x2f7fa3['count']=_0x44bf5b;if(_0x320cd4[_0x2d5b('0x39')][_0x2d5b('0x45')]){_0x2fbbbb[_0x2d5b('0x46')]=[{'all':!![]}];}return db[_0x2d5b('0x33')][_0x2d5b('0x47')](_0x2fbbbb);})[_0x2d5b('0x2a')](function(_0x58c3e7){_0x2f7fa3['rows']=_0x58c3e7;return _0x2f7fa3;})[_0x2d5b('0x2a')](respondWithFilteredResult(_0x4ae98c,_0x2fbbbb))[_0x2d5b('0x48')](handleError(_0x4ae98c,null));};exports['show']=function(_0x5e4b22,_0x2b6e4e){var _0x2fd4ee={'raw':!![],'where':{'id':_0x5e4b22['params']['id']}},_0x409d0f={};_0x409d0f['model']=_[_0x2d5b('0x49')](db[_0x2d5b('0x33')][_0x2d5b('0x4a')]);_0x409d0f[_0x2d5b('0x39')]=_['keys'](_0x5e4b22[_0x2d5b('0x39')]);_0x409d0f[_0x2d5b('0x41')]=_[_0x2d5b('0x3a')](_0x409d0f[_0x2d5b('0x37')],_0x409d0f['query']);_0x2fd4ee[_0x2d5b('0x3b')]=_[_0x2d5b('0x3a')](_0x409d0f[_0x2d5b('0x37')],qs[_0x2d5b('0x3c')](_0x5e4b22[_0x2d5b('0x39')]['fields']));_0x2fd4ee[_0x2d5b('0x3b')]=_0x2fd4ee[_0x2d5b('0x3b')][_0x2d5b('0x4b')]?_0x2fd4ee['attributes']:_0x409d0f['model'];if(_0x5e4b22[_0x2d5b('0x39')][_0x2d5b('0x45')]){_0x2fd4ee[_0x2d5b('0x46')]=[{'all':!![]}];}_0x2fd4ee=_[_0x2d5b('0x43')]({},_0x2fd4ee,_0x5e4b22[_0x2d5b('0x44')]);return db[_0x2d5b('0x33')][_0x2d5b('0x4c')](_0x2fd4ee)['then'](handleEntityNotFound(_0x2b6e4e,null))[_0x2d5b('0x2a')](respondWithResult(_0x2b6e4e,null))[_0x2d5b('0x48')](handleError(_0x2b6e4e,null));};exports[_0x2d5b('0x4d')]=function(_0xac154c,_0x572fef,_0x52f819){return db[_0x2d5b('0x33')][_0x2d5b('0x4c')]({'where':{'id':_0xac154c[_0x2d5b('0x4e')]['id']},'attributes':[_0x2d5b('0x31'),_0x2d5b('0x4f'),_0x2d5b('0x50')],'raw':!![]})[_0x2d5b('0x2a')](handleEntityNotFound(_0x572fef,null))[_0x2d5b('0x2a')](function(_0x2fa875){if(_0x2fa875){if(!fs[_0x2d5b('0x51')](path['join'](config[_0x2d5b('0x52')],_0x2d5b('0x53'),_0x2fa875['save_name']+'.'+_0x2fa875['converted_format']))){throw new db['Sequelize'][(_0x2d5b('0x54'))]('Sound\x20not\x20found');}return _0x572fef[_0x2d5b('0x4d')](path[_0x2d5b('0x55')](config['root'],_0x2d5b('0x53'),util[_0x2d5b('0x56')](_0x2d5b('0x57'),_0x2fa875[_0x2d5b('0x4f')],_0x2fa875[_0x2d5b('0x50')])),util['format'](_0x2d5b('0x57'),_0x2fa875[_0x2d5b('0x31')],_0x2fa875[_0x2d5b('0x50')]));}return null;})[_0x2d5b('0x48')](handleError(_0x572fef,null));};exports['create']=function(_0x98e244,_0x296db1,_0x3e51b9){var _0x2a3cdb={'name':path[_0x2d5b('0x58')](_0x98e244[_0x2d5b('0x59')][_0x2d5b('0x5a')],path[_0x2d5b('0x5b')](_0x98e244[_0x2d5b('0x59')][_0x2d5b('0x5a')])),'save_name':path[_0x2d5b('0x58')](_0x98e244[_0x2d5b('0x59')]['filename'],path[_0x2d5b('0x5b')](_0x98e244[_0x2d5b('0x59')][_0x2d5b('0x5c')])),'original_format':path[_0x2d5b('0x5b')](_0x98e244[_0x2d5b('0x59')][_0x2d5b('0x5a')])[_0x2d5b('0x5d')](0x1),'converted_format':'wav'};var _0x5cdb54=path[_0x2d5b('0x55')](config[_0x2d5b('0x52')],'server/files/sounds/original',_0x98e244[_0x2d5b('0x59')]['filename']);var _0x3f4f07=path[_0x2d5b('0x55')](config[_0x2d5b('0x52')],'server/files/sounds/converted',util['format'](_0x2d5b('0x57'),path[_0x2d5b('0x58')](_0x98e244[_0x2d5b('0x59')][_0x2d5b('0x5c')],path[_0x2d5b('0x5b')](_0x98e244[_0x2d5b('0x59')][_0x2d5b('0x5c')])),_0x2a3cdb[_0x2d5b('0x50')]));logger[_0x2d5b('0x5e')]('Sound\x20upload\x20filepath:\x20%s',_0x5cdb54);logger[_0x2d5b('0x5e')](_0x2d5b('0x5f'),_0x3f4f07);try{fs[_0x2d5b('0x60')](_0x5cdb54,parseInt(_0x2d5b('0x61'),0x8));var _0x400026=sox[_0x2d5b('0x62')](_0x5cdb54,_0x3f4f07,{'sampleRate':0x1f40,'format':_0x2d5b('0x63'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x400026['on'](_0x2d5b('0x2f'),function(_0x28a3ba){fs[_0x2d5b('0x64')](_0x5cdb54);_0x296db1[_0x2d5b('0x1e')](0x1f4)[_0x2d5b('0x65')](_0x28a3ba);});_0x400026['on']('src',function(_0x73976a){_0x2a3cdb[_0x2d5b('0x66')]=isNaN(_0x73976a[_0x2d5b('0x67')])?null:_0x73976a[_0x2d5b('0x67')]*0x3e8;_0x2a3cdb['original_sampleCount']=isNaN(_0x73976a[_0x2d5b('0x68')])?null:_0x73976a[_0x2d5b('0x68')];_0x2a3cdb[_0x2d5b('0x69')]=isNaN(_0x73976a['channelCount'])?null:_0x73976a['channelCount'];_0x2a3cdb[_0x2d5b('0x6a')]=isNaN(_0x73976a[_0x2d5b('0x6b')])?null:_0x73976a[_0x2d5b('0x6b')];_0x2a3cdb[_0x2d5b('0x6c')]=isNaN(_0x73976a[_0x2d5b('0x6d')])?null:_0x73976a[_0x2d5b('0x6d')];});_0x400026['on'](_0x2d5b('0x6e'),function(_0x18c189){_0x2a3cdb[_0x2d5b('0x6f')]=isNaN(_0x18c189[_0x2d5b('0x67')])?null:_0x18c189[_0x2d5b('0x67')]*0x3e8;_0x2a3cdb[_0x2d5b('0x70')]=isNaN(_0x18c189[_0x2d5b('0x68')])?null:_0x18c189[_0x2d5b('0x68')];_0x2a3cdb[_0x2d5b('0x71')]=isNaN(_0x18c189[_0x2d5b('0x72')])?null:_0x18c189[_0x2d5b('0x72')];_0x2a3cdb[_0x2d5b('0x73')]=isNaN(_0x18c189['bitRate'])?null:_0x18c189[_0x2d5b('0x6b')];_0x2a3cdb['converted_sampleRate']=isNaN(_0x18c189['sampleRate'])?null:_0x18c189[_0x2d5b('0x6d')];});_0x400026['on'](_0x2d5b('0x2e'),function(){fs[_0x2d5b('0x60')](_0x3f4f07,parseInt('0777',0x8));return db[_0x2d5b('0x33')]['create'](_0x2a3cdb)['then'](function(_0x33a453){var _0x3e36b3={'role':_0x98e244['body']['role'],'userProfileId':_0x98e244[_0x2d5b('0x74')][_0x2d5b('0x75')]};if(!_0x3e36b3)throw new Error(_0x2d5b('0x76'));if(_0x3e36b3[_0x2d5b('0x77')]===_0x2d5b('0x78')){var _0x3fd59a=_0x33a453[_0x2d5b('0x2b')]({'plain':!![]});return db[_0x2d5b('0x79')][_0x2d5b('0x4c')]({'where':{'name':_0x2d5b('0x2c'),'userProfileId':_0x3e36b3['userProfileId']},'raw':!![]})[_0x2d5b('0x2a')](function(_0xbeb64e){if(_0xbeb64e&&_0xbeb64e['autoAssociation']===0x0){return db['UserProfileResource'][_0x2d5b('0x7a')]({'name':_0x3fd59a[_0x2d5b('0x31')],'resourceId':_0x3fd59a['id'],'type':_0xbeb64e[_0x2d5b('0x31')],'sectionId':_0xbeb64e['id']},{})[_0x2d5b('0x2a')](function(){return _0x33a453;});}else{return _0x33a453;}})[_0x2d5b('0x48')](function(_0x558491){logger[_0x2d5b('0x2f')](_0x2d5b('0x7b'),_0x558491);throw _0x558491;});}return _0x33a453;})[_0x2d5b('0x2a')](respondWithResult(_0x296db1,null))['catch'](handleError(_0x296db1,null));});_0x400026['start']();}catch(_0x320f60){_0x296db1[_0x2d5b('0x1e')](0x1f4)[_0x2d5b('0x65')](_0x320f60);}};exports['update']=function(_0x5a71dc,_0x5b6274,_0x4bbb56){return db[_0x2d5b('0x33')][_0x2d5b('0x4c')]({'where':{'id':_0x5a71dc['params']['id']}})[_0x2d5b('0x2a')](handleEntityNotFound(_0x5b6274,null))[_0x2d5b('0x2a')](saveUpdates(_[_0x2d5b('0x7c')](_0x5a71dc['body'],[_0x2d5b('0x31'),_0x2d5b('0x7d')]),null))['then'](respondWithResult(_0x5b6274,null))[_0x2d5b('0x48')](handleError(_0x5b6274,null));};exports['delete']=function(_0x466089,_0x30cf62,_0x5ad0db){return db[_0x2d5b('0x33')][_0x2d5b('0x4c')]({'where':{'id':_0x466089[_0x2d5b('0x4e')]['id']}})[_0x2d5b('0x2a')](function(_0x2b0fa5){if(_0x2b0fa5){return _0x2b0fa5[_0x2d5b('0x29')]();}})[_0x2d5b('0x2a')](function(_0x2eb4a1){var _0x90921c=path[_0x2d5b('0x55')](config['root'],_0x2d5b('0x7e'),util[_0x2d5b('0x56')](_0x2d5b('0x57'),_0x2eb4a1['save_name'],_0x2eb4a1[_0x2d5b('0x7f')]));var _0x439a0b=path[_0x2d5b('0x55')](config[_0x2d5b('0x52')],'server/files/sounds/converted',util[_0x2d5b('0x56')](_0x2d5b('0x57'),_0x2eb4a1[_0x2d5b('0x4f')],_0x2eb4a1['converted_format']));fs['unlinkSync'](_0x90921c);fs[_0x2d5b('0x64')](_0x439a0b);return _0x2eb4a1;})[_0x2d5b('0x2a')](function(_0x1cd167){if(_0x1cd167){return _0x30cf62[_0x2d5b('0x1e')](0xcc)[_0x2d5b('0x2e')]();}})[_0x2d5b('0x2a')](handleEntityNotFound(_0x30cf62,null))[_0x2d5b('0x48')](handleError(_0x30cf62,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index a796e81..ff54317 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 _0x9e94=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./sound.attributes','define','Sound','tools_sounds','lodash','util'];(function(_0xc1aac4,_0x30319e){var _0xa1fefe=function(_0x3fbeab){while(--_0x3fbeab){_0xc1aac4['push'](_0xc1aac4['shift']());}};_0xa1fefe(++_0x30319e);}(_0x9e94,0x82));var _0x49e9=function(_0x5a3bc9,_0x11259e){_0x5a3bc9=_0x5a3bc9-0x0;var _0x5ad287=_0x9e94[_0x5a3bc9];return _0x5ad287;};'use strict';var _=require(_0x49e9('0x0'));var util=require(_0x49e9('0x1'));var logger=require(_0x49e9('0x2'))(_0x49e9('0x3'));var moment=require(_0x49e9('0x4'));var BPromise=require(_0x49e9('0x5'));var rp=require(_0x49e9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x49e9('0x7'));var attributes=require(_0x49e9('0x8'));module['exports']=function(_0x34b954,_0x4c365f){return _0x34b954[_0x49e9('0x9')](_0x49e9('0xa'),attributes,{'tableName':_0x49e9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5859=['util','../../config/logger','api','moment','bluebird','path','rimraf','./sound.attributes','exports','define','tools_sounds','lodash'];(function(_0x4e498a,_0x5b0684){var _0x5eea36=function(_0x2edd24){while(--_0x2edd24){_0x4e498a['push'](_0x4e498a['shift']());}};_0x5eea36(++_0x5b0684);}(_0x5859,0x107));var _0x9585=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x5859[_0x4792c8];return _0x35edb1;};'use strict';var _=require(_0x9585('0x0'));var util=require(_0x9585('0x1'));var logger=require(_0x9585('0x2'))(_0x9585('0x3'));var moment=require(_0x9585('0x4'));var BPromise=require(_0x9585('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9585('0x6'));var rimraf=require(_0x9585('0x7'));var config=require('../../config/environment');var attributes=require(_0x9585('0x8'));module[_0x9585('0x9')]=function(_0x2ec382,_0x59550e){return _0x2ec382[_0x9585('0xa')]('Sound',attributes,{'tableName':_0x9585('0xb'),'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 e01fdea..ccc2b9b 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 _0xf6aa=['client','http','request','then','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','ShowSound','options','attributes','map','include','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x299b71,_0x9a9ba5){var _0x4aa7f3=function(_0x44c9d5){while(--_0x44c9d5){_0x299b71['push'](_0x299b71['shift']());}};_0x4aa7f3(++_0x9a9ba5);}(_0xf6aa,0xe5));var _0xaf6a=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xf6aa[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xaf6a('0x0'));var util=require(_0xaf6a('0x1'));var moment=require(_0xaf6a('0x2'));var BPromise=require(_0xaf6a('0x3'));var rs=require(_0xaf6a('0x4'));var fs=require('fs');var Redis=require(_0xaf6a('0x5'));var db=require(_0xaf6a('0x6'))['db'];var utils=require(_0xaf6a('0x7'));var logger=require(_0xaf6a('0x8'))(_0xaf6a('0x9'));var config=require('../../config/environment');var jayson=require(_0xaf6a('0xa'));var client=jayson[_0xaf6a('0xb')][_0xaf6a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xc764c4,_0x31068b,_0x237370){return new BPromise(function(_0x53a9e5,_0x15e583){return client[_0xaf6a('0xd')](_0xc764c4,_0x237370)[_0xaf6a('0xe')](function(_0x258c74){logger['info'](_0xaf6a('0xf'),_0x31068b,_0xaf6a('0x10'));logger['debug'](_0xaf6a('0x11'),_0x31068b,_0xaf6a('0x10'),JSON[_0xaf6a('0x12')](_0x258c74));if(_0x258c74[_0xaf6a('0x13')]){if(_0x258c74[_0xaf6a('0x13')][_0xaf6a('0x14')]===0x1f4){logger[_0xaf6a('0x13')](_0xaf6a('0xf'),_0x31068b,_0x258c74[_0xaf6a('0x13')]['message']);return _0x15e583(_0x258c74[_0xaf6a('0x13')][_0xaf6a('0x15')]);}logger[_0xaf6a('0x13')](_0xaf6a('0xf'),_0x31068b,_0x258c74[_0xaf6a('0x13')]['message']);return _0x53a9e5(_0x258c74[_0xaf6a('0x13')]['message']);}else{logger[_0xaf6a('0x16')](_0xaf6a('0xf'),_0x31068b,_0xaf6a('0x10'));_0x53a9e5(_0x258c74[_0xaf6a('0x17')][_0xaf6a('0x15')]);}})['catch'](function(_0x32eb5a){logger['error'](_0xaf6a('0xf'),_0x31068b,_0x32eb5a);_0x15e583(_0x32eb5a);});});}exports[_0xaf6a('0x18')]=function(_0x4d8f3e){var _0x212776=this;return new Promise(function(_0x412d04,_0x3a719d){return db['Sound']['find']({'raw':_0x4d8f3e[_0xaf6a('0x19')]?_0x4d8f3e['options']['raw']===undefined?!![]:![]:!![],'where':_0x4d8f3e[_0xaf6a('0x19')]?_0x4d8f3e[_0xaf6a('0x19')]['where']||null:null,'attributes':_0x4d8f3e[_0xaf6a('0x19')]?_0x4d8f3e['options'][_0xaf6a('0x1a')]||null:null,'include':_0x4d8f3e[_0xaf6a('0x19')]?_0x4d8f3e[_0xaf6a('0x19')]['include']?_[_0xaf6a('0x1b')](_0x4d8f3e[_0xaf6a('0x19')][_0xaf6a('0x1c')],function(_0x3775ec){return{'model':db[_0x3775ec[_0xaf6a('0x1d')]],'as':_0x3775ec['as'],'attributes':_0x3775ec[_0xaf6a('0x1a')],'include':_0x3775ec['include']?_[_0xaf6a('0x1b')](_0x3775ec[_0xaf6a('0x1c')],function(_0x58cf40){return{'model':db[_0x58cf40['model']],'as':_0x58cf40['as'],'attributes':_0x58cf40[_0xaf6a('0x1a')],'include':_0x58cf40[_0xaf6a('0x1c')]?_[_0xaf6a('0x1b')](_0x58cf40['include'],function(_0x3cda2e){return{'model':db[_0x3cda2e[_0xaf6a('0x1d')]],'as':_0x3cda2e['as'],'attributes':_0x3cda2e[_0xaf6a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xaf6a('0xe')](function(_0x346f1d){logger['info'](_0xaf6a('0x18'),_0x4d8f3e);logger['debug'](_0xaf6a('0x18'),_0x4d8f3e,JSON[_0xaf6a('0x12')](_0x346f1d));_0x412d04(_0x346f1d);})['catch'](function(_0x3e42ec){logger[_0xaf6a('0x13')](_0xaf6a('0x18'),_0x3e42ec[_0xaf6a('0x15')],_0x4d8f3e);_0x3a719d(_0x212776[_0xaf6a('0x13')](0x1f4,_0x3e42ec[_0xaf6a('0x15')]));});});}; \ No newline at end of file +var _0x8e99=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','request','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','message','result','ShowSound','find','options','raw','where','attributes','include','model','map','then','stringify','catch','lodash','moment'];(function(_0x55c979,_0x36c5f0){var _0x690107=function(_0xa61dad){while(--_0xa61dad){_0x55c979['push'](_0x55c979['shift']());}};_0x690107(++_0x36c5f0);}(_0x8e99,0xf6));var _0x98e9=function(_0x63d4ef,_0x51f1bf){_0x63d4ef=_0x63d4ef-0x0;var _0xf63462=_0x8e99[_0x63d4ef];return _0xf63462;};'use strict';var _=require(_0x98e9('0x0'));var util=require('util');var moment=require(_0x98e9('0x1'));var BPromise=require(_0x98e9('0x2'));var rs=require(_0x98e9('0x3'));var fs=require('fs');var Redis=require(_0x98e9('0x4'));var db=require(_0x98e9('0x5'))['db'];var utils=require(_0x98e9('0x6'));var logger=require(_0x98e9('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x98e9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54d778,_0x47bc6f,_0x1d4194){return new BPromise(function(_0x3d9efd,_0x440a31){return client[_0x98e9('0x9')](_0x54d778,_0x1d4194)['then'](function(_0x3f0ecc){logger[_0x98e9('0xa')](_0x98e9('0xb'),_0x47bc6f,_0x98e9('0xc'));logger[_0x98e9('0xd')](_0x98e9('0xe'),_0x47bc6f,_0x98e9('0xc'),JSON['stringify'](_0x3f0ecc));if(_0x3f0ecc['error']){if(_0x3f0ecc[_0x98e9('0xf')][_0x98e9('0x10')]===0x1f4){logger[_0x98e9('0xf')](_0x98e9('0xb'),_0x47bc6f,_0x3f0ecc[_0x98e9('0xf')][_0x98e9('0x11')]);return _0x440a31(_0x3f0ecc[_0x98e9('0xf')][_0x98e9('0x11')]);}logger[_0x98e9('0xf')](_0x98e9('0xb'),_0x47bc6f,_0x3f0ecc[_0x98e9('0xf')]['message']);return _0x3d9efd(_0x3f0ecc[_0x98e9('0xf')][_0x98e9('0x11')]);}else{logger[_0x98e9('0xa')](_0x98e9('0xb'),_0x47bc6f,'request\x20sent');_0x3d9efd(_0x3f0ecc[_0x98e9('0x12')][_0x98e9('0x11')]);}})['catch'](function(_0xd34ed1){logger[_0x98e9('0xf')](_0x98e9('0xb'),_0x47bc6f,_0xd34ed1);_0x440a31(_0xd34ed1);});});}exports[_0x98e9('0x13')]=function(_0x328069){var _0x4b1bf6=this;return new Promise(function(_0x3ec81c,_0x100a8a){return db['Sound'][_0x98e9('0x14')]({'raw':_0x328069[_0x98e9('0x15')]?_0x328069[_0x98e9('0x15')][_0x98e9('0x16')]===undefined?!![]:![]:!![],'where':_0x328069[_0x98e9('0x15')]?_0x328069[_0x98e9('0x15')][_0x98e9('0x17')]||null:null,'attributes':_0x328069[_0x98e9('0x15')]?_0x328069[_0x98e9('0x15')][_0x98e9('0x18')]||null:null,'include':_0x328069['options']?_0x328069[_0x98e9('0x15')][_0x98e9('0x19')]?_['map'](_0x328069[_0x98e9('0x15')][_0x98e9('0x19')],function(_0x5908c7){return{'model':db[_0x5908c7[_0x98e9('0x1a')]],'as':_0x5908c7['as'],'attributes':_0x5908c7[_0x98e9('0x18')],'include':_0x5908c7['include']?_[_0x98e9('0x1b')](_0x5908c7[_0x98e9('0x19')],function(_0x5f05df){return{'model':db[_0x5f05df['model']],'as':_0x5f05df['as'],'attributes':_0x5f05df[_0x98e9('0x18')],'include':_0x5f05df['include']?_[_0x98e9('0x1b')](_0x5f05df['include'],function(_0x5c4a0e){return{'model':db[_0x5c4a0e['model']],'as':_0x5c4a0e['as'],'attributes':_0x5c4a0e[_0x98e9('0x18')]};}):[]};}):[]};}):[]:[]})[_0x98e9('0x1c')](function(_0x2626ee){logger[_0x98e9('0xa')](_0x98e9('0x13'),_0x328069);logger[_0x98e9('0xd')](_0x98e9('0x13'),_0x328069,JSON[_0x98e9('0x1d')](_0x2626ee));_0x3ec81c(_0x2626ee);})[_0x98e9('0x1e')](function(_0xceea51){logger['error'](_0x98e9('0x13'),_0xceea51['message'],_0x328069);_0x100a8a(_0x4b1bf6[_0x98e9('0xf')](0x1f4,_0xceea51[_0x98e9('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index ae7567f..a393260 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14a0=['get','isAuthenticated','/:id','show','create','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./squareMessage.controller'];(function(_0x57537f,_0x76ed18){var _0x58ad18=function(_0x151b0e){while(--_0x151b0e){_0x57537f['push'](_0x57537f['shift']());}};_0x58ad18(++_0x76ed18);}(_0x14a0,0x8e));var _0x014a=function(_0x43f54d,_0x14681a){_0x43f54d=_0x43f54d-0x0;var _0x5753c1=_0x14a0[_0x43f54d];return _0x5753c1;};'use strict';var multer=require('multer');var util=require(_0x014a('0x0'));var path=require(_0x014a('0x1'));var timeout=require(_0x014a('0x2'));var express=require(_0x014a('0x3'));var router=express[_0x014a('0x4')]();var fs_extra=require(_0x014a('0x5'));var auth=require(_0x014a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x014a('0x7'));router[_0x014a('0x8')]('/',auth[_0x014a('0x9')](),controller['index']);router['get'](_0x014a('0xa'),auth[_0x014a('0x9')](),controller[_0x014a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x014a('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x014a('0xd')]('/:id',auth[_0x014a('0x9')](),controller[_0x014a('0xe')]);module['exports']=router; \ No newline at end of file +var _0x2032=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x4a5438,_0x19aa59){var _0x35a70d=function(_0x42b805){while(--_0x42b805){_0x4a5438['push'](_0x4a5438['shift']());}};_0x35a70d(++_0x19aa59);}(_0x2032,0xd9));var _0x2203=function(_0x8aa889,_0x101ba4){_0x8aa889=_0x8aa889-0x0;var _0x2730bc=_0x2032[_0x8aa889];return _0x2730bc;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2203('0xe')]('/:id',auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router[_0x2203('0x10')]('/:id',auth[_0x2203('0x9')](),controller['destroy']);module[_0x2203('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index afdd7b1..04933ec 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 _0x6ff1=['medium','ENUM','out'];(function(_0x585b8d,_0x313b42){var _0x4fede5=function(_0x25181e){while(--_0x25181e){_0x585b8d['push'](_0x585b8d['shift']());}};_0x4fede5(++_0x313b42);}(_0x6ff1,0xfc));var _0x16ff=function(_0x15756b,_0x1e9807){_0x15756b=_0x15756b-0x0;var _0xd925b5=_0x6ff1[_0x15756b];return _0xd925b5;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize['TEXT'](_0x16ff('0x0')),'allowNull':![]},'direction':{'type':Sequelize[_0x16ff('0x1')]('in','out'),'defaultValue':_0x16ff('0x2'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x018e=['medium','ENUM','out','sequelize','STRING','TEXT'];(function(_0x4daeaf,_0x175e37){var _0x355a00=function(_0x1b80bf){while(--_0x1b80bf){_0x4daeaf['push'](_0x4daeaf['shift']());}};_0x355a00(++_0x175e37);}(_0x018e,0xd5));var _0xe018=function(_0x3a16d4,_0x23ecda){_0x3a16d4=_0x3a16d4-0x0;var _0x31ea9c=_0x018e[_0x3a16d4];return _0x31ea9c;};'use strict';var Sequelize=require(_0xe018('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe018('0x1')]},'body':{'type':Sequelize[_0xe018('0x2')](_0xe018('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xe018('0x4')]('in',_0xe018('0x5')),'defaultValue':_0xe018('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0xe018('0x1')]},'providerResponse':{'type':Sequelize[_0xe018('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index ca9a442..5d28f49 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 _0x87ef=['where','filter','VIRTUAL','merge','options','findAll','rows','catch','show','includeAll','include','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','SquareMessage','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort'];(function(_0x4541ee,_0x689687){var _0xde5008=function(_0x174a59){while(--_0x174a59){_0x4541ee['push'](_0x4541ee['shift']());}};_0xde5008(++_0x689687);}(_0x87ef,0x13f));var _0xf87e=function(_0x30a31e,_0x31f766){_0x30a31e=_0x30a31e-0x0;var _0x170879=_0x87ef[_0x30a31e];return _0x170879;};'use strict';var emlformat=require(_0xf87e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf87e('0x1'));var jsonpatch=require(_0xf87e('0x2'));var rp=require(_0xf87e('0x3'));var moment=require(_0xf87e('0x4'));var BPromise=require(_0xf87e('0x5'));var Mustache=require(_0xf87e('0x6'));var util=require(_0xf87e('0x7'));var path=require(_0xf87e('0x8'));var sox=require(_0xf87e('0x9'));var csv=require(_0xf87e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf87e('0xb'));var _=require(_0xf87e('0xc'));var squel=require(_0xf87e('0xd'));var crypto=require(_0xf87e('0xe'));var jsforce=require(_0xf87e('0xf'));var deskjs=require(_0xf87e('0x10'));var toCsv=require(_0xf87e('0xa'));var querystring=require('querystring');var Papa=require(_0xf87e('0x11'));var Redis=require('ioredis');var authService=require(_0xf87e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf87e('0x13'));var hardwareService=require(_0xf87e('0x14'));var logger=require('../../config/logger')(_0xf87e('0x15'));var utils=require('../../config/utils');var config=require(_0xf87e('0x16'));var licenseUtil=require(_0xf87e('0x17'));var db=require(_0xf87e('0x18'))['db'];function respondWithStatusCode(_0x2055f2,_0x3cf430){_0x3cf430=_0x3cf430||0xcc;return function(_0x4efa18){if(_0x4efa18){return _0x2055f2['sendStatus'](_0x3cf430);}return _0x2055f2[_0xf87e('0x19')](_0x3cf430)[_0xf87e('0x1a')]();};}function respondWithResult(_0x2a3fc6,_0x440a9f){_0x440a9f=_0x440a9f||0xc8;return function(_0x568a15){if(_0x568a15){return _0x2a3fc6['status'](_0x440a9f)[_0xf87e('0x1b')](_0x568a15);}};}function respondWithFilteredResult(_0x466d65,_0x5b4616){return function(_0x6df6f4){if(_0x6df6f4){var _0x40c3af=typeof _0x5b4616[_0xf87e('0x1c')]===_0xf87e('0x1d')&&typeof _0x5b4616['limit']===_0xf87e('0x1d');var _0x3f8e6e=_0x6df6f4[_0xf87e('0x1e')];var _0x10fe70=_0x40c3af?0x0:_0x5b4616[_0xf87e('0x1c')];var _0x17f22c=_0x40c3af?_0x6df6f4[_0xf87e('0x1e')]:_0x5b4616['offset']+_0x5b4616[_0xf87e('0x1f')];var _0x3c0815;if(_0x17f22c>=_0x3f8e6e){_0x17f22c=_0x3f8e6e;_0x3c0815=0xc8;}else{_0x3c0815=0xce;}_0x466d65[_0xf87e('0x19')](_0x3c0815);return _0x466d65['set'](_0xf87e('0x20'),_0x10fe70+'-'+_0x17f22c+'/'+_0x3f8e6e)[_0xf87e('0x1b')](_0x6df6f4);}return null;};}function patchUpdates(_0x4e716c){return function(_0x53177){try{jsonpatch[_0xf87e('0x21')](_0x53177,_0x4e716c,!![]);}catch(_0x44a99f){return BPromise[_0xf87e('0x22')](_0x44a99f);}return _0x53177[_0xf87e('0x23')]();};}function saveUpdates(_0x4ef633,_0x16bfc7){return function(_0x5ea936){if(_0x5ea936){return _0x5ea936[_0xf87e('0x24')](_0x4ef633)[_0xf87e('0x25')](function(_0x289adb){return _0x289adb;});}return null;};}function removeEntity(_0xd44dbf,_0x419096){return function(_0xf03593){if(_0xf03593){return _0xf03593[_0xf87e('0x26')]()[_0xf87e('0x25')](function(){_0xd44dbf[_0xf87e('0x19')](0xcc)[_0xf87e('0x1a')]();});}};}function handleEntityNotFound(_0x29f54a,_0x19f500){return function(_0xba804a){if(!_0xba804a){_0x29f54a[_0xf87e('0x27')](0x194);}return _0xba804a;};}function handleError(_0x4b43fe,_0x281c33){_0x281c33=_0x281c33||0x1f4;return function(_0x4040d1){logger[_0xf87e('0x28')](_0x4040d1[_0xf87e('0x29')]);if(_0x4040d1[_0xf87e('0x2a')]){delete _0x4040d1[_0xf87e('0x2a')];}_0x4b43fe[_0xf87e('0x19')](_0x281c33)[_0xf87e('0x2b')](_0x4040d1);};}exports[_0xf87e('0x2c')]=function(_0x2e41fa,_0x3ad696){var _0x52a354={},_0x1b60ac={},_0x3d9cef={'count':0x0,'rows':[]};var _0x3b206f=_['map'](db[_0xf87e('0x2d')][_0xf87e('0x2e')],function(_0x2a43b9){return{'name':_0x2a43b9[_0xf87e('0x2f')],'type':_0x2a43b9[_0xf87e('0x30')][_0xf87e('0x31')]};});_0x1b60ac['model']=_[_0xf87e('0x32')](_0x3b206f,_0xf87e('0x2a'));_0x1b60ac[_0xf87e('0x33')]=_[_0xf87e('0x34')](_0x2e41fa[_0xf87e('0x33')]);_0x1b60ac[_0xf87e('0x35')]=_[_0xf87e('0x36')](_0x1b60ac[_0xf87e('0x37')],_0x1b60ac[_0xf87e('0x33')]);_0x52a354[_0xf87e('0x38')]=_[_0xf87e('0x36')](_0x1b60ac['model'],qs[_0xf87e('0x39')](_0x2e41fa[_0xf87e('0x33')][_0xf87e('0x39')]));_0x52a354['attributes']=_0x52a354[_0xf87e('0x38')]['length']?_0x52a354[_0xf87e('0x38')]:_0x1b60ac[_0xf87e('0x37')];if(!_0x2e41fa[_0xf87e('0x33')][_0xf87e('0x3a')]('nolimit')){_0x52a354[_0xf87e('0x1f')]=qs[_0xf87e('0x1f')](_0x2e41fa[_0xf87e('0x33')][_0xf87e('0x1f')]);_0x52a354[_0xf87e('0x1c')]=qs[_0xf87e('0x1c')](_0x2e41fa[_0xf87e('0x33')][_0xf87e('0x1c')]);}_0x52a354[_0xf87e('0x3b')]=qs['sort'](_0x2e41fa['query'][_0xf87e('0x3c')]);_0x52a354[_0xf87e('0x3d')]=qs[_0xf87e('0x35')](_['pick'](_0x2e41fa[_0xf87e('0x33')],_0x1b60ac[_0xf87e('0x35')]),_0x3b206f);if(_0x2e41fa[_0xf87e('0x33')][_0xf87e('0x3e')]){_0x52a354['where']=_['merge'](_0x52a354[_0xf87e('0x3d')],{'$or':_[_0xf87e('0x32')](_0x3b206f,function(_0x1aa926){if(_0x1aa926[_0xf87e('0x30')]!==_0xf87e('0x3f')){var _0x1d2445={};_0x1d2445[_0x1aa926['name']]={'$like':'%'+_0x2e41fa[_0xf87e('0x33')][_0xf87e('0x3e')]+'%'};return _0x1d2445;}})});}_0x52a354=_[_0xf87e('0x40')]({},_0x52a354,_0x2e41fa[_0xf87e('0x41')]);var _0x580931={'where':_0x52a354[_0xf87e('0x3d')]};return db['SquareMessage'][_0xf87e('0x1e')](_0x580931)['then'](function(_0x1f80ab){_0x3d9cef[_0xf87e('0x1e')]=_0x1f80ab;if(_0x2e41fa[_0xf87e('0x33')]['includeAll']){_0x52a354['include']=[{'all':!![]}];}return db[_0xf87e('0x2d')][_0xf87e('0x42')](_0x52a354);})[_0xf87e('0x25')](function(_0x111b5b){_0x3d9cef[_0xf87e('0x43')]=_0x111b5b;return _0x3d9cef;})['then'](respondWithFilteredResult(_0x3ad696,_0x52a354))[_0xf87e('0x44')](handleError(_0x3ad696,null));};exports[_0xf87e('0x45')]=function(_0x58ca6a,_0x129c70){var _0x1b1417={'raw':!![],'where':{'id':_0x58ca6a['params']['id']}},_0x1adfd2={};_0x1adfd2[_0xf87e('0x37')]=_[_0xf87e('0x34')](db[_0xf87e('0x2d')][_0xf87e('0x2e')]);_0x1adfd2[_0xf87e('0x33')]=_[_0xf87e('0x34')](_0x58ca6a[_0xf87e('0x33')]);_0x1adfd2['filters']=_[_0xf87e('0x36')](_0x1adfd2[_0xf87e('0x37')],_0x1adfd2[_0xf87e('0x33')]);_0x1b1417['attributes']=_[_0xf87e('0x36')](_0x1adfd2[_0xf87e('0x37')],qs[_0xf87e('0x39')](_0x58ca6a[_0xf87e('0x33')][_0xf87e('0x39')]));_0x1b1417[_0xf87e('0x38')]=_0x1b1417['attributes']['length']?_0x1b1417[_0xf87e('0x38')]:_0x1adfd2['model'];if(_0x58ca6a['query'][_0xf87e('0x46')]){_0x1b1417[_0xf87e('0x47')]=[{'all':!![]}];}_0x1b1417=_[_0xf87e('0x40')]({},_0x1b1417,_0x58ca6a[_0xf87e('0x41')]);return db['SquareMessage'][_0xf87e('0x48')](_0x1b1417)[_0xf87e('0x25')](handleEntityNotFound(_0x129c70,null))[_0xf87e('0x25')](respondWithResult(_0x129c70,null))['catch'](handleError(_0x129c70,null));};exports['create']=function(_0x14e9ca,_0x494405){return db[_0xf87e('0x2d')][_0xf87e('0x49')](_0x14e9ca[_0xf87e('0x4a')],{})['then'](respondWithResult(_0x494405,0xc9))['catch'](handleError(_0x494405,null));};exports[_0xf87e('0x24')]=function(_0xa25d64,_0x1e9b5d){if(_0xa25d64['body']['id']){delete _0xa25d64[_0xf87e('0x4a')]['id'];}return db[_0xf87e('0x2d')][_0xf87e('0x48')]({'where':{'id':_0xa25d64[_0xf87e('0x4b')]['id']}})[_0xf87e('0x25')](handleEntityNotFound(_0x1e9b5d,null))[_0xf87e('0x25')](saveUpdates(_0xa25d64['body'],null))[_0xf87e('0x25')](respondWithResult(_0x1e9b5d,null))[_0xf87e('0x44')](handleError(_0x1e9b5d,null));};exports['destroy']=function(_0x2aaa9a,_0x18e519){return db[_0xf87e('0x2d')][_0xf87e('0x48')]({'where':{'id':_0x2aaa9a[_0xf87e('0x4b')]['id']}})[_0xf87e('0x25')](handleEntityNotFound(_0x18e519,null))['then'](removeEntity(_0x18e519,null))[_0xf87e('0x44')](handleError(_0x18e519,null));}; \ No newline at end of file +var _0xfa94=['order','sort','where','pick','filter','merge','rows','show','params','length','includeAll','include','options','find','catch','create','body','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x252a21,_0x154e6c){var _0x216ca0=function(_0xcee59e){while(--_0xcee59e){_0x252a21['push'](_0x252a21['shift']());}};_0x216ca0(++_0x154e6c);}(_0xfa94,0xef));var _0x4fa9=function(_0x3ae24a,_0x7d32f9){_0x3ae24a=_0x3ae24a-0x0;var _0x18690f=_0xfa94[_0x3ae24a];return _0x18690f;};'use strict';var emlformat=require(_0x4fa9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4fa9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4fa9('0x2'));var moment=require(_0x4fa9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4fa9('0x4'));var util=require(_0x4fa9('0x5'));var path=require(_0x4fa9('0x6'));var sox=require(_0x4fa9('0x7'));var csv=require(_0x4fa9('0x8'));var ejs=require(_0x4fa9('0x9'));var fs=require('fs');var fs_extra=require(_0x4fa9('0xa'));var _=require('lodash');var squel=require(_0x4fa9('0xb'));var crypto=require(_0x4fa9('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4fa9('0x8'));var querystring=require('querystring');var Papa=require(_0x4fa9('0xd'));var Redis=require(_0x4fa9('0xe'));var authService=require(_0x4fa9('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4fa9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4fa9('0x11'))(_0x4fa9('0x12'));var utils=require('../../config/utils');var config=require(_0x4fa9('0x13'));var licenseUtil=require(_0x4fa9('0x14'));var db=require(_0x4fa9('0x15'))['db'];function respondWithStatusCode(_0x57df6a,_0x85f1e5){_0x85f1e5=_0x85f1e5||0xcc;return function(_0x54d8c5){if(_0x54d8c5){return _0x57df6a[_0x4fa9('0x16')](_0x85f1e5);}return _0x57df6a[_0x4fa9('0x17')](_0x85f1e5)['end']();};}function respondWithResult(_0x47953e,_0x4279c0){_0x4279c0=_0x4279c0||0xc8;return function(_0x43b71d){if(_0x43b71d){return _0x47953e[_0x4fa9('0x17')](_0x4279c0)[_0x4fa9('0x18')](_0x43b71d);}};}function respondWithFilteredResult(_0x36af3a,_0x438850){return function(_0x2c28be){if(_0x2c28be){var _0x328770=typeof _0x438850['offset']===_0x4fa9('0x19')&&typeof _0x438850[_0x4fa9('0x1a')]==='undefined';var _0x56cf7d=_0x2c28be[_0x4fa9('0x1b')];var _0x4f58bd=_0x328770?0x0:_0x438850[_0x4fa9('0x1c')];var _0x416e08=_0x328770?_0x2c28be['count']:_0x438850[_0x4fa9('0x1c')]+_0x438850['limit'];var _0x3f8036;if(_0x416e08>=_0x56cf7d){_0x416e08=_0x56cf7d;_0x3f8036=0xc8;}else{_0x3f8036=0xce;}_0x36af3a[_0x4fa9('0x17')](_0x3f8036);return _0x36af3a[_0x4fa9('0x1d')](_0x4fa9('0x1e'),_0x4f58bd+'-'+_0x416e08+'/'+_0x56cf7d)[_0x4fa9('0x18')](_0x2c28be);}return null;};}function patchUpdates(_0x5e2576){return function(_0x2e5142){try{jsonpatch[_0x4fa9('0x1f')](_0x2e5142,_0x5e2576,!![]);}catch(_0xa43250){return BPromise['reject'](_0xa43250);}return _0x2e5142[_0x4fa9('0x20')]();};}function saveUpdates(_0x1544b1,_0x31333c){return function(_0x475624){if(_0x475624){return _0x475624[_0x4fa9('0x21')](_0x1544b1)[_0x4fa9('0x22')](function(_0x360262){return _0x360262;});}return null;};}function removeEntity(_0x261db9,_0x185806){return function(_0x1189c6){if(_0x1189c6){return _0x1189c6[_0x4fa9('0x23')]()[_0x4fa9('0x22')](function(){_0x261db9[_0x4fa9('0x17')](0xcc)[_0x4fa9('0x24')]();});}};}function handleEntityNotFound(_0x1d00c9,_0x244c95){return function(_0x1bac66){if(!_0x1bac66){_0x1d00c9[_0x4fa9('0x16')](0x194);}return _0x1bac66;};}function handleError(_0x1fe8ba,_0x31a3fb){_0x31a3fb=_0x31a3fb||0x1f4;return function(_0x498a6f){logger[_0x4fa9('0x25')](_0x498a6f[_0x4fa9('0x26')]);if(_0x498a6f[_0x4fa9('0x27')]){delete _0x498a6f[_0x4fa9('0x27')];}_0x1fe8ba[_0x4fa9('0x17')](_0x31a3fb)[_0x4fa9('0x28')](_0x498a6f);};}exports[_0x4fa9('0x29')]=function(_0x5545b9,_0x384d4e){var _0x1185df={},_0x13cf76={},_0x383d27={'count':0x0,'rows':[]};var _0x112673=_[_0x4fa9('0x2a')](db[_0x4fa9('0x2b')][_0x4fa9('0x2c')],function(_0xa9932f){return{'name':_0xa9932f[_0x4fa9('0x2d')],'type':_0xa9932f[_0x4fa9('0x2e')][_0x4fa9('0x2f')]};});_0x13cf76[_0x4fa9('0x30')]=_[_0x4fa9('0x2a')](_0x112673,_0x4fa9('0x27'));_0x13cf76[_0x4fa9('0x31')]=_[_0x4fa9('0x32')](_0x5545b9['query']);_0x13cf76[_0x4fa9('0x33')]=_[_0x4fa9('0x34')](_0x13cf76[_0x4fa9('0x30')],_0x13cf76[_0x4fa9('0x31')]);_0x1185df[_0x4fa9('0x35')]=_[_0x4fa9('0x34')](_0x13cf76['model'],qs[_0x4fa9('0x36')](_0x5545b9[_0x4fa9('0x31')][_0x4fa9('0x36')]));_0x1185df['attributes']=_0x1185df[_0x4fa9('0x35')]['length']?_0x1185df['attributes']:_0x13cf76[_0x4fa9('0x30')];if(!_0x5545b9['query'][_0x4fa9('0x37')](_0x4fa9('0x38'))){_0x1185df[_0x4fa9('0x1a')]=qs[_0x4fa9('0x1a')](_0x5545b9['query'][_0x4fa9('0x1a')]);_0x1185df[_0x4fa9('0x1c')]=qs[_0x4fa9('0x1c')](_0x5545b9['query'][_0x4fa9('0x1c')]);}_0x1185df[_0x4fa9('0x39')]=qs[_0x4fa9('0x3a')](_0x5545b9[_0x4fa9('0x31')][_0x4fa9('0x3a')]);_0x1185df[_0x4fa9('0x3b')]=qs[_0x4fa9('0x33')](_[_0x4fa9('0x3c')](_0x5545b9[_0x4fa9('0x31')],_0x13cf76[_0x4fa9('0x33')]),_0x112673);if(_0x5545b9[_0x4fa9('0x31')][_0x4fa9('0x3d')]){_0x1185df['where']=_[_0x4fa9('0x3e')](_0x1185df['where'],{'$or':_['map'](_0x112673,function(_0x21578d){if(_0x21578d['type']!=='VIRTUAL'){var _0x4b05a6={};_0x4b05a6[_0x21578d[_0x4fa9('0x27')]]={'$like':'%'+_0x5545b9[_0x4fa9('0x31')]['filter']+'%'};return _0x4b05a6;}})});}_0x1185df=_[_0x4fa9('0x3e')]({},_0x1185df,_0x5545b9['options']);var _0x493c4f={'where':_0x1185df[_0x4fa9('0x3b')]};return db[_0x4fa9('0x2b')][_0x4fa9('0x1b')](_0x493c4f)[_0x4fa9('0x22')](function(_0x167112){_0x383d27[_0x4fa9('0x1b')]=_0x167112;if(_0x5545b9[_0x4fa9('0x31')]['includeAll']){_0x1185df['include']=[{'all':!![]}];}return db[_0x4fa9('0x2b')]['findAll'](_0x1185df);})[_0x4fa9('0x22')](function(_0x19fe0f){_0x383d27[_0x4fa9('0x3f')]=_0x19fe0f;return _0x383d27;})[_0x4fa9('0x22')](respondWithFilteredResult(_0x384d4e,_0x1185df))['catch'](handleError(_0x384d4e,null));};exports[_0x4fa9('0x40')]=function(_0x51e105,_0xd28126){var _0x2c39bf={'raw':!![],'where':{'id':_0x51e105[_0x4fa9('0x41')]['id']}},_0x14eb12={};_0x14eb12[_0x4fa9('0x30')]=_[_0x4fa9('0x32')](db[_0x4fa9('0x2b')][_0x4fa9('0x2c')]);_0x14eb12['query']=_[_0x4fa9('0x32')](_0x51e105[_0x4fa9('0x31')]);_0x14eb12[_0x4fa9('0x33')]=_['intersection'](_0x14eb12[_0x4fa9('0x30')],_0x14eb12[_0x4fa9('0x31')]);_0x2c39bf[_0x4fa9('0x35')]=_[_0x4fa9('0x34')](_0x14eb12[_0x4fa9('0x30')],qs[_0x4fa9('0x36')](_0x51e105[_0x4fa9('0x31')][_0x4fa9('0x36')]));_0x2c39bf[_0x4fa9('0x35')]=_0x2c39bf[_0x4fa9('0x35')][_0x4fa9('0x42')]?_0x2c39bf[_0x4fa9('0x35')]:_0x14eb12['model'];if(_0x51e105[_0x4fa9('0x31')][_0x4fa9('0x43')]){_0x2c39bf[_0x4fa9('0x44')]=[{'all':!![]}];}_0x2c39bf=_[_0x4fa9('0x3e')]({},_0x2c39bf,_0x51e105[_0x4fa9('0x45')]);return db[_0x4fa9('0x2b')][_0x4fa9('0x46')](_0x2c39bf)[_0x4fa9('0x22')](handleEntityNotFound(_0xd28126,null))[_0x4fa9('0x22')](respondWithResult(_0xd28126,null))[_0x4fa9('0x47')](handleError(_0xd28126,null));};exports[_0x4fa9('0x48')]=function(_0x5d3b12,_0x5d838c){return db[_0x4fa9('0x2b')]['create'](_0x5d3b12[_0x4fa9('0x49')],{})[_0x4fa9('0x22')](respondWithResult(_0x5d838c,0xc9))[_0x4fa9('0x47')](handleError(_0x5d838c,null));};exports[_0x4fa9('0x21')]=function(_0x306096,_0x12e735){if(_0x306096['body']['id']){delete _0x306096['body']['id'];}return db['SquareMessage'][_0x4fa9('0x46')]({'where':{'id':_0x306096['params']['id']}})[_0x4fa9('0x22')](handleEntityNotFound(_0x12e735,null))[_0x4fa9('0x22')](saveUpdates(_0x306096[_0x4fa9('0x49')],null))[_0x4fa9('0x22')](respondWithResult(_0x12e735,null))['catch'](handleError(_0x12e735,null));};exports[_0x4fa9('0x23')]=function(_0x463bd4,_0x5cd8d1){return db[_0x4fa9('0x2b')][_0x4fa9('0x46')]({'where':{'id':_0x463bd4[_0x4fa9('0x41')]['id']}})[_0x4fa9('0x22')](handleEntityNotFound(_0x5cd8d1,null))[_0x4fa9('0x22')](removeEntity(_0x5cd8d1,null))[_0x4fa9('0x47')](handleError(_0x5cd8d1,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index a993b76..6f93854 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 _0xdfc6=['request-promise','path','rimraf','../../config/environment','exports','define','SquareMessage','square_messages','lodash','../../config/logger','api','moment','bluebird'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0xdfc6,0x119));var _0x6dfc=function(_0x39f77c,_0x4b8ff9){_0x39f77c=_0x39f77c-0x0;var _0x514d7f=_0xdfc6[_0x39f77c];return _0x514d7f;};'use strict';var _=require(_0x6dfc('0x0'));var util=require('util');var logger=require(_0x6dfc('0x1'))(_0x6dfc('0x2'));var moment=require(_0x6dfc('0x3'));var BPromise=require(_0x6dfc('0x4'));var rp=require(_0x6dfc('0x5'));var fs=require('fs');var path=require(_0x6dfc('0x6'));var rimraf=require(_0x6dfc('0x7'));var config=require(_0x6dfc('0x8'));var attributes=require('./squareMessage.attributes');module[_0x6dfc('0x9')]=function(_0x495299,_0x289abd){return _0x495299[_0x6dfc('0xa')](_0x6dfc('0xb'),attributes,{'tableName':_0x6dfc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66a1=['../../config/environment','./squareMessage.attributes','exports','SquareMessage','square_messages','lodash','util','../../config/logger','path','rimraf'];(function(_0x67caf,_0x56a915){var _0x57118e=function(_0x298442){while(--_0x298442){_0x67caf['push'](_0x67caf['shift']());}};_0x57118e(++_0x56a915);}(_0x66a1,0x9b));var _0x166a=function(_0x47586d,_0xe129f){_0x47586d=_0x47586d-0x0;var _0x4c2ff0=_0x66a1[_0x47586d];return _0x4c2ff0;};'use strict';var _=require(_0x166a('0x0'));var util=require(_0x166a('0x1'));var logger=require(_0x166a('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x166a('0x3'));var rimraf=require(_0x166a('0x4'));var config=require(_0x166a('0x5'));var attributes=require(_0x166a('0x6'));module[_0x166a('0x7')]=function(_0x1f29f9,_0x273b84){return _0x1f29f9['define'](_0x166a('0x8'),attributes,{'tableName':_0x166a('0x9'),'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 fd31118..f094ee3 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 _0xf51d=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','CreateSquareMessage','SquareMessage','create','body','options','raw','then'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0xf51d,0xe9));var _0xdf51=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf51d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdf51('0x0'));var util=require(_0xdf51('0x1'));var moment=require(_0xdf51('0x2'));var BPromise=require(_0xdf51('0x3'));var rs=require(_0xdf51('0x4'));var fs=require('fs');var Redis=require(_0xdf51('0x5'));var db=require(_0xdf51('0x6'))['db'];var utils=require(_0xdf51('0x7'));var logger=require(_0xdf51('0x8'))(_0xdf51('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdf51('0xa')][_0xdf51('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe38b30,_0x9b5c4e,_0x51ea1b){return new BPromise(function(_0x407056,_0x5801cb){return client[_0xdf51('0xc')](_0xe38b30,_0x51ea1b)['then'](function(_0x22a3bc){logger[_0xdf51('0xd')](_0xdf51('0xe'),_0x9b5c4e,_0xdf51('0xf'));logger[_0xdf51('0x10')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x9b5c4e,_0xdf51('0xf'),JSON['stringify'](_0x22a3bc));if(_0x22a3bc[_0xdf51('0x11')]){if(_0x22a3bc['error'][_0xdf51('0x12')]===0x1f4){logger[_0xdf51('0x11')](_0xdf51('0xe'),_0x9b5c4e,_0x22a3bc[_0xdf51('0x11')][_0xdf51('0x13')]);return _0x5801cb(_0x22a3bc[_0xdf51('0x11')][_0xdf51('0x13')]);}logger[_0xdf51('0x11')](_0xdf51('0xe'),_0x9b5c4e,_0x22a3bc['error']['message']);return _0x407056(_0x22a3bc[_0xdf51('0x11')][_0xdf51('0x13')]);}else{logger[_0xdf51('0xd')](_0xdf51('0xe'),_0x9b5c4e,'request\x20sent');_0x407056(_0x22a3bc[_0xdf51('0x14')]['message']);}})['catch'](function(_0x2b2b32){logger[_0xdf51('0x11')](_0xdf51('0xe'),_0x9b5c4e,_0x2b2b32);_0x5801cb(_0x2b2b32);});});}exports[_0xdf51('0x15')]=function(_0x3fc10a){var _0x2de0f7=this;return new Promise(function(_0x425348,_0x1fce21){return db[_0xdf51('0x16')][_0xdf51('0x17')](_0x3fc10a[_0xdf51('0x18')],{'raw':_0x3fc10a[_0xdf51('0x19')]?_0x3fc10a[_0xdf51('0x19')][_0xdf51('0x1a')]===undefined?!![]:![]:!![]})[_0xdf51('0x1b')](function(_0x314009){logger['info'](_0xdf51('0x15'),_0x3fc10a);logger[_0xdf51('0x10')]('CreateSquareMessage',_0x3fc10a,JSON['stringify'](_0x314009));_0x425348(_0x314009);})[_0xdf51('0x1c')](function(_0x1679f6){logger[_0xdf51('0x11')](_0xdf51('0x15'),_0x1679f6[_0xdf51('0x13')],_0x3fc10a);_0x1fce21(_0x2de0f7[_0xdf51('0x11')](0x1f4,_0x1679f6[_0xdf51('0x13')]));});});}; \ No newline at end of file +var _0xc316=['catch','create','body','options','CreateSquareMessage','stringify','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x16466e,_0x409500){var _0x3ad212=function(_0x3896c1){while(--_0x3896c1){_0x16466e['push'](_0x16466e['shift']());}};_0x3ad212(++_0x409500);}(_0xc316,0x180));var _0x6c31=function(_0x104d23,_0x39fb6c){_0x104d23=_0x104d23-0x0;var _0x1988c5=_0xc316[_0x104d23];return _0x1988c5;};'use strict';var _=require(_0x6c31('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6c31('0x1'));var rs=require(_0x6c31('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c31('0x3'))['db'];var utils=require(_0x6c31('0x4'));var logger=require(_0x6c31('0x5'))(_0x6c31('0x6'));var config=require(_0x6c31('0x7'));var jayson=require(_0x6c31('0x8'));var client=jayson[_0x6c31('0x9')][_0x6c31('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xeee85f,_0x2d8782,_0x3d2597){return new BPromise(function(_0x21f81d,_0x500475){return client[_0x6c31('0xb')](_0xeee85f,_0x3d2597)[_0x6c31('0xc')](function(_0xf2dcd1){logger[_0x6c31('0xd')](_0x6c31('0xe'),_0x2d8782,'request\x20sent');logger[_0x6c31('0xf')](_0x6c31('0x10'),_0x2d8782,_0x6c31('0x11'),JSON['stringify'](_0xf2dcd1));if(_0xf2dcd1[_0x6c31('0x12')]){if(_0xf2dcd1['error'][_0x6c31('0x13')]===0x1f4){logger['error'](_0x6c31('0xe'),_0x2d8782,_0xf2dcd1[_0x6c31('0x12')][_0x6c31('0x14')]);return _0x500475(_0xf2dcd1['error'][_0x6c31('0x14')]);}logger['error'](_0x6c31('0xe'),_0x2d8782,_0xf2dcd1[_0x6c31('0x12')][_0x6c31('0x14')]);return _0x21f81d(_0xf2dcd1[_0x6c31('0x12')][_0x6c31('0x14')]);}else{logger['info']('SquareMessage,\x20%s,\x20%s',_0x2d8782,_0x6c31('0x11'));_0x21f81d(_0xf2dcd1['result'][_0x6c31('0x14')]);}})[_0x6c31('0x15')](function(_0x204f50){logger[_0x6c31('0x12')](_0x6c31('0xe'),_0x2d8782,_0x204f50);_0x500475(_0x204f50);});});}exports['CreateSquareMessage']=function(_0x560d1f){var _0x8b884=this;return new Promise(function(_0x416de3,_0x3cc89a){return db['SquareMessage'][_0x6c31('0x16')](_0x560d1f[_0x6c31('0x17')],{'raw':_0x560d1f[_0x6c31('0x18')]?_0x560d1f['options']['raw']===undefined?!![]:![]:!![]})[_0x6c31('0xc')](function(_0x54c81e){logger[_0x6c31('0xd')](_0x6c31('0x19'),_0x560d1f);logger['debug'](_0x6c31('0x19'),_0x560d1f,JSON[_0x6c31('0x1a')](_0x54c81e));_0x416de3(_0x54c81e);})[_0x6c31('0x15')](function(_0x393689){logger[_0x6c31('0x12')](_0x6c31('0x19'),_0x393689[_0x6c31('0x14')],_0x560d1f);_0x3cc89a(_0x8b884['error'](0x1f4,_0x393689['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index a89eb3b..52e83c8 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 _0xa543=['test','post','create','put','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test'];(function(_0x568995,_0x542d4b){var _0x22e5dd=function(_0x9a68a0){while(--_0x9a68a0){_0x568995['push'](_0x568995['shift']());}};_0x22e5dd(++_0x542d4b);}(_0xa543,0x16f));var _0x3a54=function(_0x8af5e2,_0x2fb5d0){_0x8af5e2=_0x8af5e2-0x0;var _0x4a8a99=_0xa543[_0x8af5e2];return _0x4a8a99;};'use strict';var multer=require('multer');var util=require(_0x3a54('0x0'));var path=require('path');var timeout=require(_0x3a54('0x1'));var express=require(_0x3a54('0x2'));var router=express[_0x3a54('0x3')]();var fs_extra=require(_0x3a54('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3a54('0x5'));var config=require('../../config/environment');var controller=require(_0x3a54('0x6'));router[_0x3a54('0x7')]('/',auth[_0x3a54('0x8')](),controller[_0x3a54('0x9')]);router[_0x3a54('0x7')](_0x3a54('0xa'),auth['isAuthenticated'](),controller[_0x3a54('0xb')]);router[_0x3a54('0x7')](_0x3a54('0xc'),auth['isAuthenticated'](),timeout('15s'),controller[_0x3a54('0xd')]);router[_0x3a54('0xe')]('/',auth['isAuthenticated'](),controller[_0x3a54('0xf')]);router[_0x3a54('0x10')](_0x3a54('0xa'),auth[_0x3a54('0x8')](),controller['update']);router[_0x3a54('0x11')](_0x3a54('0xa'),auth[_0x3a54('0x8')](),controller['destroy']);module[_0x3a54('0x12')]=router; \ No newline at end of file +var _0xa59a=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated','index','/:id/test','test','post','create','put','/:id','delete','exports','multer'];(function(_0x22a75f,_0xf98f1f){var _0x583584=function(_0x48a6cc){while(--_0x48a6cc){_0x22a75f['push'](_0x22a75f['shift']());}};_0x583584(++_0xf98f1f);}(_0xa59a,0x155));var _0xaa59=function(_0x516edc,_0xe54fe5){_0x516edc=_0x516edc-0x0;var _0x2b7b17=_0xa59a[_0x516edc];return _0x2b7b17;};'use strict';var multer=require(_0xaa59('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xaa59('0x1'));var router=express[_0xaa59('0x2')]();var fs_extra=require(_0xaa59('0x3'));var auth=require(_0xaa59('0x4'));var interaction=require(_0xaa59('0x5'));var config=require('../../config/environment');var controller=require(_0xaa59('0x6'));router[_0xaa59('0x7')]('/',auth[_0xaa59('0x8')](),controller[_0xaa59('0x9')]);router[_0xaa59('0x7')]('/:id',auth[_0xaa59('0x8')](),controller['show']);router[_0xaa59('0x7')](_0xaa59('0xa'),auth[_0xaa59('0x8')](),timeout('15s'),controller[_0xaa59('0xb')]);router[_0xaa59('0xc')]('/',auth[_0xaa59('0x8')](),controller[_0xaa59('0xd')]);router[_0xaa59('0xe')](_0xaa59('0xf'),auth[_0xaa59('0x8')](),controller['update']);router[_0xaa59('0x10')](_0xaa59('0xf'),auth[_0xaa59('0x8')](),controller['destroy']);module[_0xaa59('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 790424c..3e1ede1 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 _0xc207=['sequelize','STRING','name'];(function(_0x581a00,_0x129468){var _0x5bfca2=function(_0x48d1ef){while(--_0x48d1ef){_0x581a00['push'](_0x581a00['shift']());}};_0x5bfca2(++_0x129468);}(_0xc207,0x16e));var _0x7c20=function(_0x15d913,_0x51cf7a){_0x15d913=_0x15d913-0x0;var _0x4ae65e=_0xc207[_0x15d913];return _0x4ae65e;};'use strict';var Sequelize=require(_0x7c20('0x0'));module['exports']={'name':{'type':Sequelize[_0x7c20('0x1')],'unique':_0x7c20('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x7c20('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa25d=['sequelize','exports','STRING','name'];(function(_0x2b8bbe,_0x37eb6a){var _0x1bb210=function(_0x116173){while(--_0x116173){_0x2b8bbe['push'](_0x2b8bbe['shift']());}};_0x1bb210(++_0x37eb6a);}(_0xa25d,0x1ec));var _0xda25=function(_0x24f08d,_0x19ae14){_0x24f08d=_0x24f08d-0x0;var _0x1233ed=_0xa25d[_0x24f08d];return _0x1233ed;};'use strict';var Sequelize=require(_0xda25('0x0'));module[_0xda25('0x1')]={'name':{'type':Sequelize[_0xda25('0x2')],'unique':_0xda25('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xda25('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index f5107c2..8c2a6f1 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 _0x1abd=['ODBC','end','error','send','index','map','SquareOdbc','rawAttributes','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','merge','where','type','VIRTUAL','name','options','findAll','rows','catch','show','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','odbc','openSync','dsn','closeSync','eml-format','zip-dir','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get'];(function(_0x2d385e,_0x2615d9){var _0x207c11=function(_0x273f4b){while(--_0x273f4b){_0x2d385e['push'](_0x2d385e['shift']());}};_0x207c11(++_0x2615d9);}(_0x1abd,0x1cf));var _0xd1ab=function(_0x2300c7,_0x255f74){_0x2300c7=_0x2300c7-0x0;var _0x23f720=_0x1abd[_0x2300c7];return _0x23f720;};'use strict';var emlformat=require(_0xd1ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd1ab('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd1ab('0x2'));var Mustache=require(_0xd1ab('0x3'));var util=require(_0xd1ab('0x4'));var path=require('path');var sox=require(_0xd1ab('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd1ab('0x6'));var _=require(_0xd1ab('0x7'));var squel=require(_0xd1ab('0x8'));var crypto=require(_0xd1ab('0x9'));var jsforce=require(_0xd1ab('0xa'));var deskjs=require(_0xd1ab('0xb'));var toCsv=require(_0xd1ab('0xc'));var querystring=require(_0xd1ab('0xd'));var Papa=require(_0xd1ab('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd1ab('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd1ab('0x10'))(_0xd1ab('0x11'));var utils=require(_0xd1ab('0x12'));var config=require(_0xd1ab('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23b050,_0x26be09){_0x26be09=_0x26be09||0xcc;return function(_0x1edd7c){if(_0x1edd7c){return _0x23b050[_0xd1ab('0x14')](_0x26be09);}return _0x23b050[_0xd1ab('0x15')](_0x26be09)['end']();};}function respondWithResult(_0x131df0,_0x2836b8){_0x2836b8=_0x2836b8||0xc8;return function(_0x45334c){if(_0x45334c){return _0x131df0['status'](_0x2836b8)[_0xd1ab('0x16')](_0x45334c);}};}function respondWithFilteredResult(_0x21eba0,_0x6fa37e){return function(_0x1a2dfb){if(_0x1a2dfb){var _0x2f77b3=typeof _0x6fa37e[_0xd1ab('0x17')]===_0xd1ab('0x18')&&typeof _0x6fa37e[_0xd1ab('0x19')]==='undefined';var _0x4cda27=_0x1a2dfb[_0xd1ab('0x1a')];var _0x39ec10=_0x2f77b3?0x0:_0x6fa37e[_0xd1ab('0x17')];var _0x3a1d6c=_0x2f77b3?_0x1a2dfb[_0xd1ab('0x1a')]:_0x6fa37e[_0xd1ab('0x17')]+_0x6fa37e['limit'];var _0x284b36;if(_0x3a1d6c>=_0x4cda27){_0x3a1d6c=_0x4cda27;_0x284b36=0xc8;}else{_0x284b36=0xce;}_0x21eba0['status'](_0x284b36);return _0x21eba0[_0xd1ab('0x1b')](_0xd1ab('0x1c'),_0x39ec10+'-'+_0x3a1d6c+'/'+_0x4cda27)[_0xd1ab('0x16')](_0x1a2dfb);}return null;};}function patchUpdates(_0x279149){return function(_0x257ad5){try{jsonpatch['apply'](_0x257ad5,_0x279149,!![]);}catch(_0x4e1b83){return BPromise[_0xd1ab('0x1d')](_0x4e1b83);}return _0x257ad5[_0xd1ab('0x1e')]();};}function saveUpdates(_0x140187,_0x2f9680){return function(_0x515e07){if(_0x515e07){return _0x515e07[_0xd1ab('0x1f')](_0x140187)[_0xd1ab('0x20')](function(_0x1b3385){return _0x1b3385;});}return null;};}function removeEntity(_0x2843a0,_0x4e00e9){return function(_0x24961c){if(_0x24961c){return _0x24961c[_0xd1ab('0x21')]()[_0xd1ab('0x20')](function(){var _0x38bb4b=_0x24961c[_0xd1ab('0x22')]({'plain':!![]});var _0x20f50b=_0xd1ab('0x23');return db['UserProfileResource'][_0xd1ab('0x21')]({'where':{'type':_0x20f50b,'resourceId':_0x38bb4b['id']}})['then'](function(){return _0x24961c;});})[_0xd1ab('0x20')](function(){_0x2843a0['status'](0xcc)[_0xd1ab('0x24')]();});}};}function handleEntityNotFound(_0x161e74,_0x529b71){return function(_0x1d7903){if(!_0x1d7903){_0x161e74[_0xd1ab('0x14')](0x194);}return _0x1d7903;};}function handleError(_0xd17108,_0x266e6b){_0x266e6b=_0x266e6b||0x1f4;return function(_0x110b41){logger[_0xd1ab('0x25')](_0x110b41['stack']);if(_0x110b41['name']){delete _0x110b41['name'];}_0xd17108[_0xd1ab('0x15')](_0x266e6b)[_0xd1ab('0x26')](_0x110b41);};}exports[_0xd1ab('0x27')]=function(_0x179064,_0x5ddee5){var _0x433dcc={},_0xdc6583={},_0x4e5b87={'count':0x0,'rows':[]};var _0x59ee6c=_[_0xd1ab('0x28')](db[_0xd1ab('0x29')][_0xd1ab('0x2a')],function(_0x131d2a){return{'name':_0x131d2a['fieldName'],'type':_0x131d2a['type'][_0xd1ab('0x2b')]};});_0xdc6583[_0xd1ab('0x2c')]=_[_0xd1ab('0x28')](_0x59ee6c,'name');_0xdc6583[_0xd1ab('0x2d')]=_[_0xd1ab('0x2e')](_0x179064[_0xd1ab('0x2d')]);_0xdc6583['filters']=_[_0xd1ab('0x2f')](_0xdc6583['model'],_0xdc6583[_0xd1ab('0x2d')]);_0x433dcc[_0xd1ab('0x30')]=_[_0xd1ab('0x2f')](_0xdc6583[_0xd1ab('0x2c')],qs['fields'](_0x179064['query'][_0xd1ab('0x31')]));_0x433dcc['attributes']=_0x433dcc[_0xd1ab('0x30')][_0xd1ab('0x32')]?_0x433dcc[_0xd1ab('0x30')]:_0xdc6583[_0xd1ab('0x2c')];if(!_0x179064['query'][_0xd1ab('0x33')]('nolimit')){_0x433dcc[_0xd1ab('0x19')]=qs['limit'](_0x179064['query'][_0xd1ab('0x19')]);_0x433dcc['offset']=qs[_0xd1ab('0x17')](_0x179064['query'][_0xd1ab('0x17')]);}_0x433dcc[_0xd1ab('0x34')]=qs[_0xd1ab('0x35')](_0x179064[_0xd1ab('0x2d')][_0xd1ab('0x35')]);_0x433dcc['where']=qs[_0xd1ab('0x36')](_[_0xd1ab('0x37')](_0x179064[_0xd1ab('0x2d')],_0xdc6583[_0xd1ab('0x36')]),_0x59ee6c);if(_0x179064[_0xd1ab('0x2d')][_0xd1ab('0x38')]){_0x433dcc['where']=_[_0xd1ab('0x39')](_0x433dcc[_0xd1ab('0x3a')],{'$or':_[_0xd1ab('0x28')](_0x59ee6c,function(_0x59732d){if(_0x59732d[_0xd1ab('0x3b')]!==_0xd1ab('0x3c')){var _0x2103f5={};_0x2103f5[_0x59732d[_0xd1ab('0x3d')]]={'$like':'%'+_0x179064[_0xd1ab('0x2d')][_0xd1ab('0x38')]+'%'};return _0x2103f5;}})});}_0x433dcc=_[_0xd1ab('0x39')]({},_0x433dcc,_0x179064[_0xd1ab('0x3e')]);var _0x480d37={'where':_0x433dcc['where']};return db[_0xd1ab('0x29')][_0xd1ab('0x1a')](_0x480d37)[_0xd1ab('0x20')](function(_0x20427c){_0x4e5b87['count']=_0x20427c;if(_0x179064[_0xd1ab('0x2d')]['includeAll']){_0x433dcc['include']=[{'all':!![]}];}return db[_0xd1ab('0x29')][_0xd1ab('0x3f')](_0x433dcc);})['then'](function(_0x375acf){_0x4e5b87[_0xd1ab('0x40')]=_0x375acf;return _0x4e5b87;})[_0xd1ab('0x20')](respondWithFilteredResult(_0x5ddee5,_0x433dcc))[_0xd1ab('0x41')](handleError(_0x5ddee5,null));};exports[_0xd1ab('0x42')]=function(_0x47e623,_0x1172db){var _0x10c2c6={'raw':!![],'where':{'id':_0x47e623['params']['id']}},_0x2b28bd={};_0x2b28bd[_0xd1ab('0x2c')]=_[_0xd1ab('0x2e')](db[_0xd1ab('0x29')][_0xd1ab('0x2a')]);_0x2b28bd[_0xd1ab('0x2d')]=_[_0xd1ab('0x2e')](_0x47e623['query']);_0x2b28bd[_0xd1ab('0x36')]=_['intersection'](_0x2b28bd['model'],_0x2b28bd[_0xd1ab('0x2d')]);_0x10c2c6['attributes']=_[_0xd1ab('0x2f')](_0x2b28bd['model'],qs[_0xd1ab('0x31')](_0x47e623['query'][_0xd1ab('0x31')]));_0x10c2c6[_0xd1ab('0x30')]=_0x10c2c6['attributes'][_0xd1ab('0x32')]?_0x10c2c6['attributes']:_0x2b28bd['model'];if(_0x47e623[_0xd1ab('0x2d')][_0xd1ab('0x43')]){_0x10c2c6[_0xd1ab('0x44')]=[{'all':!![]}];}_0x10c2c6=_[_0xd1ab('0x39')]({},_0x10c2c6,_0x47e623['options']);return db[_0xd1ab('0x29')][_0xd1ab('0x45')](_0x10c2c6)[_0xd1ab('0x20')](handleEntityNotFound(_0x1172db,null))['then'](respondWithResult(_0x1172db,null))[_0xd1ab('0x41')](handleError(_0x1172db,null));};exports[_0xd1ab('0x46')]=function(_0x4b9d27,_0x19233b){return db[_0xd1ab('0x29')][_0xd1ab('0x46')](_0x4b9d27[_0xd1ab('0x47')],{})[_0xd1ab('0x20')](function(_0x1bb23a){var _0x8d01f2=_0x4b9d27[_0xd1ab('0x48')][_0xd1ab('0x22')]({'plain':!![]});if(!_0x8d01f2)throw new Error(_0xd1ab('0x49'));if(_0x8d01f2['role']===_0xd1ab('0x48')){var _0x339982=_0x1bb23a['get']({'plain':!![]});var _0x2a4ea0=_0xd1ab('0x23');return db[_0xd1ab('0x4a')][_0xd1ab('0x45')]({'where':{'name':_0x2a4ea0,'userProfileId':_0x8d01f2[_0xd1ab('0x4b')]},'raw':!![]})[_0xd1ab('0x20')](function(_0x2e5495){if(_0x2e5495&&_0x2e5495['autoAssociation']===0x0){return db[_0xd1ab('0x4c')][_0xd1ab('0x46')]({'name':_0x339982[_0xd1ab('0x3d')],'resourceId':_0x339982['id'],'type':_0x2e5495[_0xd1ab('0x3d')],'sectionId':_0x2e5495['id']},{})[_0xd1ab('0x20')](function(){return _0x1bb23a;});}else{return _0x1bb23a;}})[_0xd1ab('0x41')](function(_0x386fa9){logger['error'](_0xd1ab('0x4d'),_0x386fa9);throw _0x386fa9;});}return _0x1bb23a;})[_0xd1ab('0x20')](respondWithResult(_0x19233b,0xc9))['catch'](handleError(_0x19233b,null));};exports[_0xd1ab('0x1f')]=function(_0x185c0e,_0x11de23){if(_0x185c0e[_0xd1ab('0x47')]['id']){delete _0x185c0e[_0xd1ab('0x47')]['id'];}return db[_0xd1ab('0x29')][_0xd1ab('0x45')]({'where':{'id':_0x185c0e[_0xd1ab('0x4e')]['id']}})['then'](handleEntityNotFound(_0x11de23,null))[_0xd1ab('0x20')](saveUpdates(_0x185c0e['body'],null))[_0xd1ab('0x20')](respondWithResult(_0x11de23,null))[_0xd1ab('0x41')](handleError(_0x11de23,null));};exports[_0xd1ab('0x21')]=function(_0x8272f1,_0x22cede){return db['SquareOdbc'][_0xd1ab('0x45')]({'where':{'id':_0x8272f1[_0xd1ab('0x4e')]['id']}})[_0xd1ab('0x20')](handleEntityNotFound(_0x22cede,null))[_0xd1ab('0x20')](removeEntity(_0x22cede,null))[_0xd1ab('0x41')](handleError(_0x22cede,null));};exports['test']=function(_0x17b829,_0x2c2911,_0x57660b){var _0x1eac79;return db[_0xd1ab('0x29')][_0xd1ab('0x45')]({'where':{'id':_0x17b829[_0xd1ab('0x4e')]['id']},'attributes':['id','dsn']})[_0xd1ab('0x20')](handleEntityNotFound(_0x2c2911,null))[_0xd1ab('0x20')](function(_0x111eb0){if(_0x111eb0){var _0x4d05ec=require(_0xd1ab('0x4f'))();_0x4d05ec[_0xd1ab('0x50')](_0x111eb0[_0xd1ab('0x51')]);_0x4d05ec[_0xd1ab('0x52')]();return _0x111eb0;}})['then'](respondWithResult(_0x2c2911,null))[_0xd1ab('0x41')](handleError(_0x2c2911,null));}; \ No newline at end of file +var _0x9508=['UserProfileResource','status','sendStatus','error','name','index','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','SquareOdbc','includeAll','include','rows','rawAttributes','length','options','find','catch','create','body','role','user','update','test','params','openSync','dsn','closeSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','destroy','then','get','ODBC'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x9508,0xd2));var _0x8950=function(_0x3f5895,_0x1d4960){_0x3f5895=_0x3f5895-0x0;var _0x154033=_0x9508[_0x3f5895];return _0x154033;};'use strict';var emlformat=require(_0x8950('0x0'));var rimraf=require(_0x8950('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8950('0x2'));var rp=require(_0x8950('0x3'));var moment=require(_0x8950('0x4'));var BPromise=require(_0x8950('0x5'));var Mustache=require(_0x8950('0x6'));var util=require(_0x8950('0x7'));var path=require(_0x8950('0x8'));var sox=require('sox');var csv=require(_0x8950('0x9'));var ejs=require(_0x8950('0xa'));var fs=require('fs');var fs_extra=require(_0x8950('0xb'));var _=require(_0x8950('0xc'));var squel=require(_0x8950('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8950('0xe'));var toCsv=require(_0x8950('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8950('0xf'));var qs=require(_0x8950('0x10'));var as=require(_0x8950('0x11'));var hardwareService=require(_0x8950('0x12'));var logger=require(_0x8950('0x13'))(_0x8950('0x14'));var utils=require(_0x8950('0x15'));var config=require(_0x8950('0x16'));var licenseUtil=require(_0x8950('0x17'));var db=require(_0x8950('0x18'))['db'];function respondWithStatusCode(_0x4da134,_0x132446){_0x132446=_0x132446||0xcc;return function(_0x1c2b57){if(_0x1c2b57){return _0x4da134['sendStatus'](_0x132446);}return _0x4da134['status'](_0x132446)[_0x8950('0x19')]();};}function respondWithResult(_0x288133,_0x1acc9d){_0x1acc9d=_0x1acc9d||0xc8;return function(_0x3c4727){if(_0x3c4727){return _0x288133['status'](_0x1acc9d)['json'](_0x3c4727);}};}function respondWithFilteredResult(_0x22828d,_0x35170f){return function(_0x2cdc3e){if(_0x2cdc3e){var _0x182576=typeof _0x35170f[_0x8950('0x1a')]===_0x8950('0x1b')&&typeof _0x35170f[_0x8950('0x1c')]===_0x8950('0x1b');var _0x2411ad=_0x2cdc3e[_0x8950('0x1d')];var _0x1b7aa0=_0x182576?0x0:_0x35170f[_0x8950('0x1a')];var _0x19666a=_0x182576?_0x2cdc3e['count']:_0x35170f[_0x8950('0x1a')]+_0x35170f[_0x8950('0x1c')];var _0x1bfbb1;if(_0x19666a>=_0x2411ad){_0x19666a=_0x2411ad;_0x1bfbb1=0xc8;}else{_0x1bfbb1=0xce;}_0x22828d['status'](_0x1bfbb1);return _0x22828d[_0x8950('0x1e')](_0x8950('0x1f'),_0x1b7aa0+'-'+_0x19666a+'/'+_0x2411ad)[_0x8950('0x20')](_0x2cdc3e);}return null;};}function patchUpdates(_0x1ed486){return function(_0x1765db){try{jsonpatch[_0x8950('0x21')](_0x1765db,_0x1ed486,!![]);}catch(_0x49a5f4){return BPromise['reject'](_0x49a5f4);}return _0x1765db[_0x8950('0x22')]();};}function saveUpdates(_0x33ab4d,_0x5f58b5){return function(_0x5f4244){if(_0x5f4244){return _0x5f4244['update'](_0x33ab4d)['then'](function(_0x93d34){return _0x93d34;});}return null;};}function removeEntity(_0x1bbf68,_0xefb389){return function(_0xc31a46){if(_0xc31a46){return _0xc31a46[_0x8950('0x23')]()[_0x8950('0x24')](function(){var _0x5ecde0=_0xc31a46[_0x8950('0x25')]({'plain':!![]});var _0x53a8e4=_0x8950('0x26');return db[_0x8950('0x27')][_0x8950('0x23')]({'where':{'type':_0x53a8e4,'resourceId':_0x5ecde0['id']}})[_0x8950('0x24')](function(){return _0xc31a46;});})[_0x8950('0x24')](function(){_0x1bbf68[_0x8950('0x28')](0xcc)[_0x8950('0x19')]();});}};}function handleEntityNotFound(_0x27ba70,_0x5174e1){return function(_0x252f2a){if(!_0x252f2a){_0x27ba70[_0x8950('0x29')](0x194);}return _0x252f2a;};}function handleError(_0xa03bf5,_0x3b7c83){_0x3b7c83=_0x3b7c83||0x1f4;return function(_0x2005bd){logger[_0x8950('0x2a')](_0x2005bd['stack']);if(_0x2005bd[_0x8950('0x2b')]){delete _0x2005bd['name'];}_0xa03bf5['status'](_0x3b7c83)['send'](_0x2005bd);};}exports[_0x8950('0x2c')]=function(_0x50a910,_0x57002d){var _0x51c602={},_0x44aa11={},_0x2751b7={'count':0x0,'rows':[]};var _0x30821a=_['map'](db['SquareOdbc']['rawAttributes'],function(_0x204740){return{'name':_0x204740[_0x8950('0x2d')],'type':_0x204740[_0x8950('0x2e')][_0x8950('0x2f')]};});_0x44aa11[_0x8950('0x30')]=_[_0x8950('0x31')](_0x30821a,_0x8950('0x2b'));_0x44aa11[_0x8950('0x32')]=_[_0x8950('0x33')](_0x50a910[_0x8950('0x32')]);_0x44aa11['filters']=_[_0x8950('0x34')](_0x44aa11[_0x8950('0x30')],_0x44aa11[_0x8950('0x32')]);_0x51c602['attributes']=_[_0x8950('0x34')](_0x44aa11[_0x8950('0x30')],qs[_0x8950('0x35')](_0x50a910['query'][_0x8950('0x35')]));_0x51c602['attributes']=_0x51c602[_0x8950('0x36')]['length']?_0x51c602['attributes']:_0x44aa11[_0x8950('0x30')];if(!_0x50a910[_0x8950('0x32')][_0x8950('0x37')](_0x8950('0x38'))){_0x51c602['limit']=qs[_0x8950('0x1c')](_0x50a910[_0x8950('0x32')][_0x8950('0x1c')]);_0x51c602['offset']=qs[_0x8950('0x1a')](_0x50a910['query'][_0x8950('0x1a')]);}_0x51c602[_0x8950('0x39')]=qs[_0x8950('0x3a')](_0x50a910['query'][_0x8950('0x3a')]);_0x51c602['where']=qs[_0x8950('0x3b')](_[_0x8950('0x3c')](_0x50a910[_0x8950('0x32')],_0x44aa11[_0x8950('0x3b')]),_0x30821a);if(_0x50a910[_0x8950('0x32')][_0x8950('0x3d')]){_0x51c602['where']=_[_0x8950('0x3e')](_0x51c602[_0x8950('0x3f')],{'$or':_[_0x8950('0x31')](_0x30821a,function(_0x581445){if(_0x581445[_0x8950('0x2e')]!=='VIRTUAL'){var _0x380b3c={};_0x380b3c[_0x581445['name']]={'$like':'%'+_0x50a910[_0x8950('0x32')]['filter']+'%'};return _0x380b3c;}})});}_0x51c602=_['merge']({},_0x51c602,_0x50a910['options']);var _0x2bcca2={'where':_0x51c602[_0x8950('0x3f')]};return db[_0x8950('0x40')]['count'](_0x2bcca2)[_0x8950('0x24')](function(_0x4a4120){_0x2751b7[_0x8950('0x1d')]=_0x4a4120;if(_0x50a910[_0x8950('0x32')][_0x8950('0x41')]){_0x51c602[_0x8950('0x42')]=[{'all':!![]}];}return db[_0x8950('0x40')]['findAll'](_0x51c602);})[_0x8950('0x24')](function(_0x18531c){_0x2751b7[_0x8950('0x43')]=_0x18531c;return _0x2751b7;})[_0x8950('0x24')](respondWithFilteredResult(_0x57002d,_0x51c602))['catch'](handleError(_0x57002d,null));};exports['show']=function(_0x3e7b3d,_0x552b31){var _0x44c940={'raw':!![],'where':{'id':_0x3e7b3d['params']['id']}},_0x8c6e69={};_0x8c6e69[_0x8950('0x30')]=_[_0x8950('0x33')](db[_0x8950('0x40')][_0x8950('0x44')]);_0x8c6e69[_0x8950('0x32')]=_['keys'](_0x3e7b3d[_0x8950('0x32')]);_0x8c6e69['filters']=_[_0x8950('0x34')](_0x8c6e69['model'],_0x8c6e69['query']);_0x44c940[_0x8950('0x36')]=_[_0x8950('0x34')](_0x8c6e69[_0x8950('0x30')],qs[_0x8950('0x35')](_0x3e7b3d[_0x8950('0x32')]['fields']));_0x44c940[_0x8950('0x36')]=_0x44c940[_0x8950('0x36')][_0x8950('0x45')]?_0x44c940[_0x8950('0x36')]:_0x8c6e69[_0x8950('0x30')];if(_0x3e7b3d['query'][_0x8950('0x41')]){_0x44c940[_0x8950('0x42')]=[{'all':!![]}];}_0x44c940=_['merge']({},_0x44c940,_0x3e7b3d[_0x8950('0x46')]);return db[_0x8950('0x40')][_0x8950('0x47')](_0x44c940)[_0x8950('0x24')](handleEntityNotFound(_0x552b31,null))[_0x8950('0x24')](respondWithResult(_0x552b31,null))[_0x8950('0x48')](handleError(_0x552b31,null));};exports[_0x8950('0x49')]=function(_0x4f23f7,_0x5c9d29){return db['SquareOdbc'][_0x8950('0x49')](_0x4f23f7[_0x8950('0x4a')],{})[_0x8950('0x24')](function(_0x2d1efe){var _0x1debed=_0x4f23f7['user'][_0x8950('0x25')]({'plain':!![]});if(!_0x1debed)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1debed[_0x8950('0x4b')]===_0x8950('0x4c')){var _0x10e367=_0x2d1efe['get']({'plain':!![]});var _0x90aa04=_0x8950('0x26');return db['UserProfileSection'][_0x8950('0x47')]({'where':{'name':_0x90aa04,'userProfileId':_0x1debed['userProfileId']},'raw':!![]})[_0x8950('0x24')](function(_0x211212){if(_0x211212&&_0x211212['autoAssociation']===0x0){return db['UserProfileResource'][_0x8950('0x49')]({'name':_0x10e367[_0x8950('0x2b')],'resourceId':_0x10e367['id'],'type':_0x211212['name'],'sectionId':_0x211212['id']},{})[_0x8950('0x24')](function(){return _0x2d1efe;});}else{return _0x2d1efe;}})[_0x8950('0x48')](function(_0x1ca028){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ca028);throw _0x1ca028;});}return _0x2d1efe;})['then'](respondWithResult(_0x5c9d29,0xc9))['catch'](handleError(_0x5c9d29,null));};exports[_0x8950('0x4d')]=function(_0x46ec68,_0x5a41c6){if(_0x46ec68['body']['id']){delete _0x46ec68[_0x8950('0x4a')]['id'];}return db['SquareOdbc'][_0x8950('0x47')]({'where':{'id':_0x46ec68['params']['id']}})['then'](handleEntityNotFound(_0x5a41c6,null))['then'](saveUpdates(_0x46ec68[_0x8950('0x4a')],null))[_0x8950('0x24')](respondWithResult(_0x5a41c6,null))[_0x8950('0x48')](handleError(_0x5a41c6,null));};exports[_0x8950('0x23')]=function(_0x478da2,_0x1ac18c){return db[_0x8950('0x40')][_0x8950('0x47')]({'where':{'id':_0x478da2['params']['id']}})['then'](handleEntityNotFound(_0x1ac18c,null))[_0x8950('0x24')](removeEntity(_0x1ac18c,null))[_0x8950('0x48')](handleError(_0x1ac18c,null));};exports[_0x8950('0x4e')]=function(_0xda1cc8,_0x2d473f,_0x538be6){var _0x42ceea;return db[_0x8950('0x40')][_0x8950('0x47')]({'where':{'id':_0xda1cc8[_0x8950('0x4f')]['id']},'attributes':['id','dsn']})[_0x8950('0x24')](handleEntityNotFound(_0x2d473f,null))[_0x8950('0x24')](function(_0x57d032){if(_0x57d032){var _0x366c73=require('odbc')();_0x366c73[_0x8950('0x50')](_0x57d032[_0x8950('0x51')]);_0x366c73[_0x8950('0x52')]();return _0x57d032;}})['then'](respondWithResult(_0x2d473f,null))['catch'](handleError(_0x2d473f,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 8c118cc..b4cc733 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 _0xfbfc=['SquareOdbc','square_odbc','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./squareOdbc.attributes','exports','define'];(function(_0x10e865,_0x32b9e5){var _0xf49753=function(_0x3b8d7a){while(--_0x3b8d7a){_0x10e865['push'](_0x10e865['shift']());}};_0xf49753(++_0x32b9e5);}(_0xfbfc,0x1be));var _0xcfbf=function(_0x41d1b6,_0x258ab8){_0x41d1b6=_0x41d1b6-0x0;var _0xe0a00d=_0xfbfc[_0x41d1b6];return _0xe0a00d;};'use strict';var _=require(_0xcfbf('0x0'));var util=require('util');var logger=require(_0xcfbf('0x1'))(_0xcfbf('0x2'));var moment=require(_0xcfbf('0x3'));var BPromise=require(_0xcfbf('0x4'));var rp=require(_0xcfbf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcfbf('0x6'));var attributes=require(_0xcfbf('0x7'));module[_0xcfbf('0x8')]=function(_0x599344,_0xa7952f){return _0x599344[_0xcfbf('0x9')](_0xcfbf('0xa'),attributes,{'tableName':_0xcfbf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd6c9=['./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','util','../../config/logger','moment','bluebird','rimraf','../../config/environment'];(function(_0x47725b,_0x3f9e95){var _0x4940e1=function(_0x30251f){while(--_0x30251f){_0x47725b['push'](_0x47725b['shift']());}};_0x4940e1(++_0x3f9e95);}(_0xd6c9,0x191));var _0x9d6c=function(_0x2fd71a,_0x3b7db6){_0x2fd71a=_0x2fd71a-0x0;var _0x497a1f=_0xd6c9[_0x2fd71a];return _0x497a1f;};'use strict';var _=require('lodash');var util=require(_0x9d6c('0x0'));var logger=require(_0x9d6c('0x1'))('api');var moment=require(_0x9d6c('0x2'));var BPromise=require(_0x9d6c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9d6c('0x4'));var config=require(_0x9d6c('0x5'));var attributes=require(_0x9d6c('0x6'));module[_0x9d6c('0x7')]=function(_0x5d5a4d,_0x34ff61){return _0x5d5a4d[_0x9d6c('0x8')](_0x9d6c('0x9'),attributes,{'tableName':_0x9d6c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index de5e5ce..895064b 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 _0xea67=['request','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareOdbc','options','attributes','include','map','model','then','ShowSquareOdbc','debug','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x539fb2,_0x5b6718){var _0x4d583d=function(_0x55fa69){while(--_0x55fa69){_0x539fb2['push'](_0x539fb2['shift']());}};_0x4d583d(++_0x5b6718);}(_0xea67,0xbc));var _0x7ea6=function(_0x57ac3b,_0x32e884){_0x57ac3b=_0x57ac3b-0x0;var _0x4204c9=_0xea67[_0x57ac3b];return _0x4204c9;};'use strict';var _=require('lodash');var util=require(_0x7ea6('0x0'));var moment=require('moment');var BPromise=require(_0x7ea6('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7ea6('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x7ea6('0x3'))(_0x7ea6('0x4'));var config=require(_0x7ea6('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x7ea6('0x6')][_0x7ea6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x28857d,_0x511a15,_0x3a3870){return new BPromise(function(_0x2cbb2d,_0x1a1523){return client[_0x7ea6('0x8')](_0x28857d,_0x3a3870)['then'](function(_0x245949){logger[_0x7ea6('0x9')](_0x7ea6('0xa'),_0x511a15,_0x7ea6('0xb'));logger['debug'](_0x7ea6('0xc'),_0x511a15,'request\x20sent',JSON[_0x7ea6('0xd')](_0x245949));if(_0x245949[_0x7ea6('0xe')]){if(_0x245949['error'][_0x7ea6('0xf')]===0x1f4){logger['error'](_0x7ea6('0xa'),_0x511a15,_0x245949['error']['message']);return _0x1a1523(_0x245949[_0x7ea6('0xe')]['message']);}logger['error'](_0x7ea6('0xa'),_0x511a15,_0x245949['error'][_0x7ea6('0x10')]);return _0x2cbb2d(_0x245949[_0x7ea6('0xe')]['message']);}else{logger[_0x7ea6('0x9')]('SquareOdbc,\x20%s,\x20%s',_0x511a15,_0x7ea6('0xb'));_0x2cbb2d(_0x245949[_0x7ea6('0x11')][_0x7ea6('0x10')]);}})[_0x7ea6('0x12')](function(_0x4cc888){logger[_0x7ea6('0xe')](_0x7ea6('0xa'),_0x511a15,_0x4cc888);_0x1a1523(_0x4cc888);});});}exports['ShowSquareOdbc']=function(_0x20607e){var _0x29ad92=this;return new Promise(function(_0xe80127,_0x3aae09){return db[_0x7ea6('0x13')]['find']({'raw':_0x20607e[_0x7ea6('0x14')]?_0x20607e[_0x7ea6('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x20607e['options']?_0x20607e[_0x7ea6('0x14')]['where']||null:null,'attributes':_0x20607e[_0x7ea6('0x14')]?_0x20607e['options'][_0x7ea6('0x15')]||null:null,'include':_0x20607e[_0x7ea6('0x14')]?_0x20607e[_0x7ea6('0x14')][_0x7ea6('0x16')]?_[_0x7ea6('0x17')](_0x20607e[_0x7ea6('0x14')][_0x7ea6('0x16')],function(_0x4aced1){return{'model':db[_0x4aced1[_0x7ea6('0x18')]],'as':_0x4aced1['as'],'attributes':_0x4aced1[_0x7ea6('0x15')],'include':_0x4aced1[_0x7ea6('0x16')]?_['map'](_0x4aced1[_0x7ea6('0x16')],function(_0x3d9818){return{'model':db[_0x3d9818[_0x7ea6('0x18')]],'as':_0x3d9818['as'],'attributes':_0x3d9818[_0x7ea6('0x15')],'include':_0x3d9818[_0x7ea6('0x16')]?_[_0x7ea6('0x17')](_0x3d9818[_0x7ea6('0x16')],function(_0x45d937){return{'model':db[_0x45d937['model']],'as':_0x45d937['as'],'attributes':_0x45d937[_0x7ea6('0x15')]};}):[]};}):[]};}):[]:[]})[_0x7ea6('0x19')](function(_0x530a18){logger[_0x7ea6('0x9')](_0x7ea6('0x1a'),_0x20607e);logger[_0x7ea6('0x1b')](_0x7ea6('0x1a'),_0x20607e,JSON[_0x7ea6('0xd')](_0x530a18));_0xe80127(_0x530a18);})[_0x7ea6('0x12')](function(_0x14eb00){logger[_0x7ea6('0xe')]('ShowSquareOdbc',_0x14eb00[_0x7ea6('0x10')],_0x20607e);_0x3aae09(_0x29ad92[_0x7ea6('0xe')](0x1f4,_0x14eb00['message']));});});}; \ No newline at end of file +var _0xab71=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareOdbc,\x20%s,\x20%s','message','info','result','catch','ShowSquareOdbc','find','options','raw','attributes','include','model','map','debug','lodash','util'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xab71,0x1a2));var _0x1ab7=function(_0x1cfe2e,_0x1ebbcd){_0x1cfe2e=_0x1cfe2e-0x0;var _0x39233f=_0xab71[_0x1cfe2e];return _0x39233f;};'use strict';var _=require(_0x1ab7('0x0'));var util=require(_0x1ab7('0x1'));var moment=require('moment');var BPromise=require(_0x1ab7('0x2'));var rs=require(_0x1ab7('0x3'));var fs=require('fs');var Redis=require(_0x1ab7('0x4'));var db=require(_0x1ab7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ab7('0x6'))(_0x1ab7('0x7'));var config=require('../../config/environment');var jayson=require(_0x1ab7('0x8'));var client=jayson['client'][_0x1ab7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x482c1a,_0x5316e1,_0x8a2ba5){return new BPromise(function(_0x4534ff,_0x58577e){return client[_0x1ab7('0xa')](_0x482c1a,_0x8a2ba5)[_0x1ab7('0xb')](function(_0x33c237){logger['info']('SquareOdbc,\x20%s,\x20%s',_0x5316e1,'request\x20sent');logger['debug'](_0x1ab7('0xc'),_0x5316e1,'request\x20sent',JSON[_0x1ab7('0xd')](_0x33c237));if(_0x33c237[_0x1ab7('0xe')]){if(_0x33c237[_0x1ab7('0xe')][_0x1ab7('0xf')]===0x1f4){logger[_0x1ab7('0xe')](_0x1ab7('0x10'),_0x5316e1,_0x33c237[_0x1ab7('0xe')]['message']);return _0x58577e(_0x33c237[_0x1ab7('0xe')][_0x1ab7('0x11')]);}logger[_0x1ab7('0xe')](_0x1ab7('0x10'),_0x5316e1,_0x33c237['error'][_0x1ab7('0x11')]);return _0x4534ff(_0x33c237[_0x1ab7('0xe')][_0x1ab7('0x11')]);}else{logger[_0x1ab7('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x5316e1,'request\x20sent');_0x4534ff(_0x33c237[_0x1ab7('0x13')][_0x1ab7('0x11')]);}})[_0x1ab7('0x14')](function(_0x359fac){logger[_0x1ab7('0xe')]('SquareOdbc,\x20%s,\x20%s',_0x5316e1,_0x359fac);_0x58577e(_0x359fac);});});}exports[_0x1ab7('0x15')]=function(_0x4be3fd){var _0x5d65df=this;return new Promise(function(_0x419acd,_0x2816a0){return db['SquareOdbc'][_0x1ab7('0x16')]({'raw':_0x4be3fd[_0x1ab7('0x17')]?_0x4be3fd[_0x1ab7('0x17')][_0x1ab7('0x18')]===undefined?!![]:![]:!![],'where':_0x4be3fd[_0x1ab7('0x17')]?_0x4be3fd[_0x1ab7('0x17')]['where']||null:null,'attributes':_0x4be3fd['options']?_0x4be3fd[_0x1ab7('0x17')][_0x1ab7('0x19')]||null:null,'include':_0x4be3fd[_0x1ab7('0x17')]?_0x4be3fd[_0x1ab7('0x17')][_0x1ab7('0x1a')]?_['map'](_0x4be3fd[_0x1ab7('0x17')][_0x1ab7('0x1a')],function(_0x4b7ee8){return{'model':db[_0x4b7ee8[_0x1ab7('0x1b')]],'as':_0x4b7ee8['as'],'attributes':_0x4b7ee8[_0x1ab7('0x19')],'include':_0x4b7ee8[_0x1ab7('0x1a')]?_[_0x1ab7('0x1c')](_0x4b7ee8[_0x1ab7('0x1a')],function(_0x51debf){return{'model':db[_0x51debf[_0x1ab7('0x1b')]],'as':_0x51debf['as'],'attributes':_0x51debf['attributes'],'include':_0x51debf['include']?_[_0x1ab7('0x1c')](_0x51debf[_0x1ab7('0x1a')],function(_0x38dd85){return{'model':db[_0x38dd85[_0x1ab7('0x1b')]],'as':_0x38dd85['as'],'attributes':_0x38dd85[_0x1ab7('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1ab7('0xb')](function(_0x3e2cca){logger[_0x1ab7('0x12')](_0x1ab7('0x15'),_0x4be3fd);logger[_0x1ab7('0x1d')](_0x1ab7('0x15'),_0x4be3fd,JSON[_0x1ab7('0xd')](_0x3e2cca));_0x419acd(_0x3e2cca);})['catch'](function(_0x407153){logger[_0x1ab7('0xe')](_0x1ab7('0x15'),_0x407153[_0x1ab7('0x11')],_0x4be3fd);_0x2816a0(_0x5d65df[_0x1ab7('0xe')](0x1f4,_0x407153[_0x1ab7('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 8498dc2..e1be7f5 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 _0xe651=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','/:id','show','/:id/users','getUsers','post','create','addUsers','put','update','delete','destroy','removeUsers','exports','multer','util','path','connect-timeout'];(function(_0x7b401a,_0x5cd5d7){var _0x8ad574=function(_0x219600){while(--_0x219600){_0x7b401a['push'](_0x7b401a['shift']());}};_0x8ad574(++_0x5cd5d7);}(_0xe651,0x1a5));var _0x1e65=function(_0x508a0a,_0x3ed316){_0x508a0a=_0x508a0a-0x0;var _0x4acf06=_0xe651[_0x508a0a];return _0x4acf06;};'use strict';var multer=require(_0x1e65('0x0'));var util=require(_0x1e65('0x1'));var path=require(_0x1e65('0x2'));var timeout=require(_0x1e65('0x3'));var express=require(_0x1e65('0x4'));var router=express[_0x1e65('0x5')]();var fs_extra=require(_0x1e65('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1e65('0x7'));var config=require(_0x1e65('0x8'));var controller=require(_0x1e65('0x9'));router[_0x1e65('0xa')]('/',auth[_0x1e65('0xb')](),controller['index']);router['get'](_0x1e65('0xc'),auth['isAuthenticated'](),controller[_0x1e65('0xd')]);router[_0x1e65('0xa')](_0x1e65('0xe'),auth[_0x1e65('0xb')](),controller[_0x1e65('0xf')]);router[_0x1e65('0x10')]('/',auth['isAuthenticated'](),controller[_0x1e65('0x11')]);router[_0x1e65('0x10')]('/:id/users',auth[_0x1e65('0xb')](),controller[_0x1e65('0x12')]);router[_0x1e65('0x13')](_0x1e65('0xc'),auth['isAuthenticated'](),controller[_0x1e65('0x14')]);router[_0x1e65('0x15')]('/:id',auth[_0x1e65('0xb')](),controller[_0x1e65('0x16')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x1e65('0x17')]);module[_0x1e65('0x18')]=router; \ No newline at end of file +var _0xe6f1=['isAuthenticated','show','getUsers','post','addUsers','put','/:id','update','destroy','delete','/:id/users','removeUsers','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./squareProject.controller','get'];(function(_0x41ded3,_0x2a2ebf){var _0x46ddce=function(_0x51f782){while(--_0x51f782){_0x41ded3['push'](_0x41ded3['shift']());}};_0x46ddce(++_0x2a2ebf);}(_0xe6f1,0x19c));var _0x1e6f=function(_0x8b953b,_0x132acf){_0x8b953b=_0x8b953b-0x0;var _0x1943d5=_0xe6f1[_0x8b953b];return _0x1943d5;};'use strict';var multer=require(_0x1e6f('0x0'));var util=require('util');var path=require(_0x1e6f('0x1'));var timeout=require('connect-timeout');var express=require(_0x1e6f('0x2'));var router=express['Router']();var fs_extra=require(_0x1e6f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x1e6f('0x4'));var config=require(_0x1e6f('0x5'));var controller=require(_0x1e6f('0x6'));router[_0x1e6f('0x7')]('/',auth[_0x1e6f('0x8')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x1e6f('0x9')]);router[_0x1e6f('0x7')]('/:id/users',auth[_0x1e6f('0x8')](),controller[_0x1e6f('0xa')]);router[_0x1e6f('0xb')]('/',auth[_0x1e6f('0x8')](),controller['create']);router[_0x1e6f('0xb')]('/:id/users',auth[_0x1e6f('0x8')](),controller[_0x1e6f('0xc')]);router[_0x1e6f('0xd')](_0x1e6f('0xe'),auth['isAuthenticated'](),controller[_0x1e6f('0xf')]);router['delete'](_0x1e6f('0xe'),auth[_0x1e6f('0x8')](),controller[_0x1e6f('0x10')]);router[_0x1e6f('0x11')](_0x1e6f('0x12'),auth['isAuthenticated'](),controller[_0x1e6f('0x13')]);module[_0x1e6f('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index cb18239..46abbf9 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 _0x1315=['sequelize','exports','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','utf8','production','toString','DATE'];(function(_0x5a7f64,_0x347d57){var _0x3d30f1=function(_0x4bd1d6){while(--_0x4bd1d6){_0x5a7f64['push'](_0x5a7f64['shift']());}};_0x3d30f1(++_0x347d57);}(_0x1315,0xdd));var _0x5131=function(_0x1c34e7,_0x33f9a8){_0x1c34e7=_0x1c34e7-0x0;var _0x378cb1=_0x1315[_0x1c34e7];return _0x378cb1;};'use strict';var Sequelize=require(_0x5131('0x0'));module[_0x5131('0x1')]={'name':{'type':Sequelize[_0x5131('0x2')],'unique':_0x5131('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x5131('0x2')]},'notes':{'type':Sequelize[_0x5131('0x4')]},'preproduction':{'type':Sequelize[_0x5131('0x5')](_0x5131('0x6')),'get':function(){if(this[_0x5131('0x7')]('preproduction')){return this[_0x5131('0x7')](_0x5131('0x8'))['toString'](_0x5131('0x9'));}}},'production':{'type':Sequelize[_0x5131('0x5')](_0x5131('0x6')),'get':function(){if(this[_0x5131('0x7')](_0x5131('0xa'))){return this[_0x5131('0x7')](_0x5131('0xa'))[_0x5131('0xb')]('utf8');}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x5131('0xc')]}}; \ No newline at end of file +var _0x5458=['exports','STRING','TEXT','long','getDataValue','preproduction','toString','utf8','BLOB','production','DATE','sequelize'];(function(_0x17cb1b,_0xe109f0){var _0x4e4f52=function(_0x464562){while(--_0x464562){_0x17cb1b['push'](_0x17cb1b['shift']());}};_0x4e4f52(++_0xe109f0);}(_0x5458,0x1c7));var _0x8545=function(_0x14d45f,_0x2d0dbb){_0x14d45f=_0x14d45f-0x0;var _0x176c80=_0x5458[_0x14d45f];return _0x176c80;};'use strict';var Sequelize=require(_0x8545('0x0'));module[_0x8545('0x1')]={'name':{'type':Sequelize[_0x8545('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x8545('0x2')]},'notes':{'type':Sequelize[_0x8545('0x3')]},'preproduction':{'type':Sequelize['BLOB'](_0x8545('0x4')),'get':function(){if(this[_0x8545('0x5')](_0x8545('0x6'))){return this['getDataValue'](_0x8545('0x6'))[_0x8545('0x7')](_0x8545('0x8'));}}},'production':{'type':Sequelize[_0x8545('0x9')]('long'),'get':function(){if(this[_0x8545('0x5')]('production')){return this[_0x8545('0x5')](_0x8545('0xa'))[_0x8545('0x7')](_0x8545('0x8'));}}},'savedAt':{'type':Sequelize[_0x8545('0xb')]},'publishedAt':{'type':Sequelize[_0x8545('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 2d1e4ac..f5a91bf 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 _0x39ab=['show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addUsers','omit','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','pick','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','then','destroy','get','SquareProjects','UserProfileResource','error','stack','name','send','index','SquareProject','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch'];(function(_0x1bca53,_0x3dcb7c){var _0x52a1e5=function(_0x532e94){while(--_0x532e94){_0x1bca53['push'](_0x1bca53['shift']());}};_0x52a1e5(++_0x3dcb7c);}(_0x39ab,0xe0));var _0xb39a=function(_0x2d6630,_0x45fb62){_0x2d6630=_0x2d6630-0x0;var _0x33acb2=_0x39ab[_0x2d6630];return _0x33acb2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb39a('0x0'));var jsonpatch=require(_0xb39a('0x1'));var rp=require(_0xb39a('0x2'));var moment=require('moment');var BPromise=require(_0xb39a('0x3'));var Mustache=require(_0xb39a('0x4'));var util=require('util');var path=require(_0xb39a('0x5'));var sox=require(_0xb39a('0x6'));var csv=require(_0xb39a('0x7'));var ejs=require(_0xb39a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb39a('0x9'));var squel=require(_0xb39a('0xa'));var crypto=require('crypto');var jsforce=require(_0xb39a('0xb'));var deskjs=require(_0xb39a('0xc'));var toCsv=require(_0xb39a('0x7'));var querystring=require('querystring');var Papa=require(_0xb39a('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb39a('0xe'));var hardwareService=require(_0xb39a('0xf'));var logger=require(_0xb39a('0x10'))(_0xb39a('0x11'));var utils=require(_0xb39a('0x12'));var config=require(_0xb39a('0x13'));var licenseUtil=require(_0xb39a('0x14'));var db=require(_0xb39a('0x15'))['db'];config['redis']=_[_0xb39a('0x16')](config[_0xb39a('0x17')],{'host':_0xb39a('0x18'),'port':0x18eb});var socket=require(_0xb39a('0x19'))(new Redis(config['redis']));require(_0xb39a('0x1a'))[_0xb39a('0x1b')](socket);function respondWithStatusCode(_0x13956c,_0x34c680){_0x34c680=_0x34c680||0xcc;return function(_0x41ef6){if(_0x41ef6){return _0x13956c[_0xb39a('0x1c')](_0x34c680);}return _0x13956c[_0xb39a('0x1d')](_0x34c680)[_0xb39a('0x1e')]();};}function respondWithResult(_0x53aba2,_0x57bb52){_0x57bb52=_0x57bb52||0xc8;return function(_0x1b605b){if(_0x1b605b){return _0x53aba2[_0xb39a('0x1d')](_0x57bb52)[_0xb39a('0x1f')](_0x1b605b);}};}function respondWithFilteredResult(_0x5ef084,_0x5edec5){return function(_0x4ce4e8){if(_0x4ce4e8){var _0x913de5=typeof _0x5edec5[_0xb39a('0x20')]===_0xb39a('0x21')&&typeof _0x5edec5['limit']===_0xb39a('0x21');var _0x917a9d=_0x4ce4e8[_0xb39a('0x22')];var _0x45719a=_0x913de5?0x0:_0x5edec5[_0xb39a('0x20')];var _0x19097e=_0x913de5?_0x4ce4e8[_0xb39a('0x22')]:_0x5edec5[_0xb39a('0x20')]+_0x5edec5[_0xb39a('0x23')];var _0x3931b5;if(_0x19097e>=_0x917a9d){_0x19097e=_0x917a9d;_0x3931b5=0xc8;}else{_0x3931b5=0xce;}_0x5ef084['status'](_0x3931b5);return _0x5ef084['set'](_0xb39a('0x24'),_0x45719a+'-'+_0x19097e+'/'+_0x917a9d)[_0xb39a('0x1f')](_0x4ce4e8);}return null;};}function patchUpdates(_0x43d3b7){return function(_0x4e1bbf){try{jsonpatch[_0xb39a('0x25')](_0x4e1bbf,_0x43d3b7,!![]);}catch(_0x4f766e){return BPromise[_0xb39a('0x26')](_0x4f766e);}return _0x4e1bbf['save']();};}function saveUpdates(_0xbd7161,_0x12d66a){return function(_0x4f7e6e){if(_0x4f7e6e){return _0x4f7e6e['update'](_0xbd7161)[_0xb39a('0x27')](function(_0x48bf84){return _0x48bf84;});}return null;};}function removeEntity(_0x53118e,_0x5f58fe){return function(_0x328a1c){if(_0x328a1c){return _0x328a1c[_0xb39a('0x28')]()[_0xb39a('0x27')](function(){var _0x4c8d82=_0x328a1c[_0xb39a('0x29')]({'plain':!![]});var _0x1cc7ed=_0xb39a('0x2a');return db[_0xb39a('0x2b')]['destroy']({'where':{'type':_0x1cc7ed,'resourceId':_0x4c8d82['id']}})[_0xb39a('0x27')](function(){return _0x328a1c;});})[_0xb39a('0x27')](function(){_0x53118e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x297d4f,_0x57b766){return function(_0x1a59a9){if(!_0x1a59a9){_0x297d4f[_0xb39a('0x1c')](0x194);}return _0x1a59a9;};}function handleError(_0x102c6e,_0x39e5b1){_0x39e5b1=_0x39e5b1||0x1f4;return function(_0xbe092d){logger[_0xb39a('0x2c')](_0xbe092d[_0xb39a('0x2d')]);if(_0xbe092d[_0xb39a('0x2e')]){delete _0xbe092d[_0xb39a('0x2e')];}_0x102c6e[_0xb39a('0x1d')](_0x39e5b1)[_0xb39a('0x2f')](_0xbe092d);};}exports[_0xb39a('0x30')]=function(_0x3eb1fa,_0x55a98c){var _0x27164a={},_0x5e009d={},_0x298836={'count':0x0,'rows':[]};var _0xbea8e2=_['map'](db[_0xb39a('0x31')][_0xb39a('0x32')],function(_0x4bff1c){return{'name':_0x4bff1c[_0xb39a('0x33')],'type':_0x4bff1c[_0xb39a('0x34')][_0xb39a('0x35')]};});_0x5e009d[_0xb39a('0x36')]=_[_0xb39a('0x37')](_0xbea8e2,_0xb39a('0x2e'));_0x5e009d[_0xb39a('0x38')]=_['keys'](_0x3eb1fa['query']);_0x5e009d[_0xb39a('0x39')]=_[_0xb39a('0x3a')](_0x5e009d[_0xb39a('0x36')],_0x5e009d[_0xb39a('0x38')]);_0x27164a['attributes']=_['intersection'](_0x5e009d['model'],qs['fields'](_0x3eb1fa['query'][_0xb39a('0x3b')]));_0x27164a[_0xb39a('0x3c')]=_0x27164a[_0xb39a('0x3c')][_0xb39a('0x3d')]?_0x27164a['attributes']:_0x5e009d[_0xb39a('0x36')];if(!_0x3eb1fa[_0xb39a('0x38')][_0xb39a('0x3e')](_0xb39a('0x3f'))){_0x27164a[_0xb39a('0x23')]=qs[_0xb39a('0x23')](_0x3eb1fa[_0xb39a('0x38')][_0xb39a('0x23')]);_0x27164a[_0xb39a('0x20')]=qs[_0xb39a('0x20')](_0x3eb1fa[_0xb39a('0x38')][_0xb39a('0x20')]);}_0x27164a[_0xb39a('0x40')]=qs[_0xb39a('0x41')](_0x3eb1fa[_0xb39a('0x38')]['sort']);_0x27164a[_0xb39a('0x42')]=qs[_0xb39a('0x39')](_['pick'](_0x3eb1fa[_0xb39a('0x38')],_0x5e009d[_0xb39a('0x39')]),_0xbea8e2);if(_0x3eb1fa[_0xb39a('0x38')]['filter']){_0x27164a[_0xb39a('0x42')]=_[_0xb39a('0x43')](_0x27164a['where'],{'$or':_[_0xb39a('0x37')](_0xbea8e2,function(_0x29c3ee){if(_0x29c3ee[_0xb39a('0x34')]!==_0xb39a('0x44')){var _0x244286={};_0x244286[_0x29c3ee[_0xb39a('0x2e')]]={'$like':'%'+_0x3eb1fa[_0xb39a('0x38')][_0xb39a('0x45')]+'%'};return _0x244286;}})});}_0x27164a=_[_0xb39a('0x43')]({},_0x27164a,_0x3eb1fa[_0xb39a('0x46')]);var _0x2bf465={'where':_0x27164a[_0xb39a('0x42')]};return db[_0xb39a('0x31')]['count'](_0x2bf465)['then'](function(_0x239dae){_0x298836[_0xb39a('0x22')]=_0x239dae;if(_0x3eb1fa[_0xb39a('0x38')][_0xb39a('0x47')]){_0x27164a[_0xb39a('0x48')]=[{'all':!![]}];}return db['SquareProject'][_0xb39a('0x49')](_0x27164a);})[_0xb39a('0x27')](function(_0x12ba0e){_0x298836[_0xb39a('0x4a')]=_0x12ba0e;return _0x298836;})['then'](respondWithFilteredResult(_0x55a98c,_0x27164a))[_0xb39a('0x4b')](handleError(_0x55a98c,null));};exports[_0xb39a('0x4c')]=function(_0x2d56b9,_0x273610){var _0x2cfa06={'raw':![],'where':{'id':_0x2d56b9[_0xb39a('0x4d')]['id']}},_0x413a59={};_0x413a59[_0xb39a('0x36')]=_[_0xb39a('0x4e')](db[_0xb39a('0x31')][_0xb39a('0x32')]);_0x413a59[_0xb39a('0x38')]=_[_0xb39a('0x4e')](_0x2d56b9[_0xb39a('0x38')]);_0x413a59[_0xb39a('0x39')]=_[_0xb39a('0x3a')](_0x413a59[_0xb39a('0x36')],_0x413a59['query']);_0x2cfa06['attributes']=_[_0xb39a('0x3a')](_0x413a59[_0xb39a('0x36')],qs['fields'](_0x2d56b9['query']['fields']));_0x2cfa06[_0xb39a('0x3c')]=_0x2cfa06[_0xb39a('0x3c')][_0xb39a('0x3d')]?_0x2cfa06[_0xb39a('0x3c')]:_0x413a59[_0xb39a('0x36')];if(_0x2d56b9[_0xb39a('0x38')][_0xb39a('0x47')]){_0x2cfa06[_0xb39a('0x48')]=[{'all':!![]}];}_0x2cfa06=_[_0xb39a('0x43')]({},_0x2cfa06,_0x2d56b9['options']);return db[_0xb39a('0x31')][_0xb39a('0x4f')](_0x2cfa06)['then'](handleEntityNotFound(_0x273610,null))[_0xb39a('0x27')](respondWithResult(_0x273610,null))['catch'](handleError(_0x273610,null));};exports[_0xb39a('0x50')]=function(_0x287cc9,_0x2a8af9){return db['SquareProject'][_0xb39a('0x50')](_0x287cc9[_0xb39a('0x51')],{})[_0xb39a('0x27')](function(_0x249f07){var _0x22d48e=_0x287cc9[_0xb39a('0x52')][_0xb39a('0x29')]({'plain':!![]});if(!_0x22d48e)throw new Error(_0xb39a('0x53'));if(_0x22d48e['role']===_0xb39a('0x52')){var _0x1275d8=_0x249f07[_0xb39a('0x29')]({'plain':!![]});var _0x12e83b='SquareProjects';return db[_0xb39a('0x54')][_0xb39a('0x4f')]({'where':{'name':_0x12e83b,'userProfileId':_0x22d48e[_0xb39a('0x55')]},'raw':!![]})[_0xb39a('0x27')](function(_0x12f592){if(_0x12f592&&_0x12f592[_0xb39a('0x56')]===0x0){return db[_0xb39a('0x2b')]['create']({'name':_0x1275d8[_0xb39a('0x2e')],'resourceId':_0x1275d8['id'],'type':_0x12f592['name'],'sectionId':_0x12f592['id']},{})[_0xb39a('0x27')](function(){return _0x249f07;});}else{return _0x249f07;}})[_0xb39a('0x4b')](function(_0x3aa1a1){logger['error'](_0xb39a('0x57'),_0x3aa1a1);throw _0x3aa1a1;});}return _0x249f07;})['then'](respondWithResult(_0x2a8af9,0xc9))[_0xb39a('0x4b')](handleError(_0x2a8af9,null));};exports[_0xb39a('0x58')]=function(_0x3a9e54,_0x4847c6){if(_0x3a9e54[_0xb39a('0x51')]['id']){delete _0x3a9e54['body']['id'];}return db[_0xb39a('0x31')][_0xb39a('0x4f')]({'where':{'id':_0x3a9e54[_0xb39a('0x4d')]['id']}})[_0xb39a('0x27')](handleEntityNotFound(_0x4847c6,null))['then'](saveUpdates(_0x3a9e54[_0xb39a('0x51')],null))['then'](respondWithResult(_0x4847c6,null))[_0xb39a('0x4b')](handleError(_0x4847c6,null));};exports[_0xb39a('0x28')]=function(_0x24a5d3,_0x3d2e22){return db['SquareProject']['find']({'where':{'id':_0x24a5d3['params']['id']}})[_0xb39a('0x27')](handleEntityNotFound(_0x3d2e22,null))[_0xb39a('0x27')](removeEntity(_0x3d2e22,null))[_0xb39a('0x4b')](handleError(_0x3d2e22,null));};exports[_0xb39a('0x59')]=function(_0x1dc03c,_0x226906,_0x50fbe2){return db[_0xb39a('0x31')][_0xb39a('0x4f')]({'where':{'id':_0x1dc03c[_0xb39a('0x4d')]['id']}})[_0xb39a('0x27')](handleEntityNotFound(_0x226906,null))[_0xb39a('0x27')](function(_0x29c5a6){if(_0x29c5a6){return _0x29c5a6['addUsers'](_0x1dc03c[_0xb39a('0x51')]['ids'],_[_0xb39a('0x5a')](_0x1dc03c[_0xb39a('0x51')],[_0xb39a('0x5b'),'id'])||{});}})['then'](respondWithResult(_0x226906,null))[_0xb39a('0x4b')](handleError(_0x226906,null));};exports['removeUsers']=function(_0x4275c0,_0x13c312,_0x3ea743){return db[_0xb39a('0x31')][_0xb39a('0x4f')]({'where':{'id':_0x4275c0[_0xb39a('0x4d')]['id']}})[_0xb39a('0x27')](handleEntityNotFound(_0x13c312,null))['then'](function(_0x1387b6){if(_0x1387b6){return _0x1387b6[_0xb39a('0x5c')](_0x4275c0[_0xb39a('0x38')]['ids'])['then'](function(){if(_[_0xb39a('0x5d')](_0x4275c0[_0xb39a('0x38')][_0xb39a('0x5b')])){for(var _0x4bd4a4=0x0;_0x4bd4a4<_0x4275c0[_0xb39a('0x38')][_0xb39a('0x5b')][_0xb39a('0x3d')];_0x4bd4a4+=0x1){socket[_0xb39a('0x5e')]('userSquareProject:remove',{'UserId':Number(_0x4275c0[_0xb39a('0x38')][_0xb39a('0x5b')][_0x4bd4a4]),'SquareProjectId':Number(_0x4275c0['params']['id'])});}}else{socket[_0xb39a('0x5e')](_0xb39a('0x5f'),{'UserId':Number(_0x4275c0[_0xb39a('0x38')]['ids']),'SquareProjectId':Number(_0x4275c0[_0xb39a('0x4d')]['id'])});}});}})[_0xb39a('0x27')](respondWithStatusCode(_0x13c312,null))[_0xb39a('0x4b')](handleError(_0x13c312,null));};exports[_0xb39a('0x60')]=function(_0x5b1953,_0xe592c4,_0x4cba25){var _0x4369fc={};var _0x6a1598={};var _0x5c0de2;var _0x37a9df;return db['SquareProject'][_0xb39a('0x61')]({'where':{'id':_0x5b1953[_0xb39a('0x4d')]['id']}})[_0xb39a('0x27')](handleEntityNotFound(_0xe592c4,null))[_0xb39a('0x27')](function(_0x100cec){if(_0x100cec){_0x5c0de2=_0x100cec;_0x6a1598[_0xb39a('0x36')]=_['keys'](db[_0xb39a('0x62')]['rawAttributes']);_0x6a1598[_0xb39a('0x38')]=_[_0xb39a('0x4e')](_0x5b1953[_0xb39a('0x38')]);_0x6a1598[_0xb39a('0x39')]=_['intersection'](_0x6a1598['model'],_0x6a1598[_0xb39a('0x38')]);_0x4369fc[_0xb39a('0x3c')]=_['intersection'](_0x6a1598['model'],qs['fields'](_0x5b1953[_0xb39a('0x38')][_0xb39a('0x3b')]));_0x4369fc['attributes']=_0x4369fc['attributes'][_0xb39a('0x3d')]?_0x4369fc[_0xb39a('0x3c')]:_0x6a1598['model'];_0x4369fc[_0xb39a('0x40')]=qs[_0xb39a('0x41')](_0x5b1953['query']['sort']);_0x4369fc[_0xb39a('0x42')]=qs[_0xb39a('0x39')](_[_0xb39a('0x63')](_0x5b1953['query'],_0x6a1598[_0xb39a('0x39')]));if(_0x5b1953['query'][_0xb39a('0x45')]){_0x4369fc[_0xb39a('0x42')]=_[_0xb39a('0x43')](_0x4369fc[_0xb39a('0x42')],{'$or':_[_0xb39a('0x37')](_0x4369fc[_0xb39a('0x3c')],function(_0x385a48){var _0x425075={};_0x425075[_0x385a48]={'$like':'%'+_0x5b1953[_0xb39a('0x38')][_0xb39a('0x45')]+'%'};return _0x425075;})});}_0x4369fc=_[_0xb39a('0x43')]({},_0x4369fc,_0x5b1953[_0xb39a('0x46')]);return _0x5c0de2['getUsers'](_0x4369fc);}})[_0xb39a('0x27')](function(_0x5ed6fc){if(_0x5ed6fc){_0x37a9df=_0x5ed6fc[_0xb39a('0x3d')];if(!_0x5b1953[_0xb39a('0x38')][_0xb39a('0x3e')](_0xb39a('0x3f'))){_0x4369fc['limit']=qs[_0xb39a('0x23')](_0x5b1953[_0xb39a('0x38')][_0xb39a('0x23')]);_0x4369fc[_0xb39a('0x20')]=qs[_0xb39a('0x20')](_0x5b1953[_0xb39a('0x38')][_0xb39a('0x20')]);}return _0x5c0de2[_0xb39a('0x60')](_0x4369fc);}})[_0xb39a('0x27')](function(_0x598d8c){if(_0x598d8c){return _0x598d8c?{'count':_0x37a9df,'rows':_0x598d8c}:null;}})[_0xb39a('0x27')](respondWithResult(_0xe592c4,null))[_0xb39a('0x4b')](handleError(_0xe592c4,null));}; \ No newline at end of file +var _0xacc1=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./squareProject.socket','register','sendStatus','status','end','undefined','count','offset','limit','set','json','reject','save','update','then','destroy','stack','name','send','index','SquareProject','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','rows','catch','show','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','findOne','User','getUsers','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x77d310,_0x2b2fe7){var _0x2cdce4=function(_0xbaa481){while(--_0xbaa481){_0x77d310['push'](_0x77d310['shift']());}};_0x2cdce4(++_0x2b2fe7);}(_0xacc1,0xad));var _0x1acc=function(_0x4a60d8,_0x5d238b){_0x4a60d8=_0x4a60d8-0x0;var _0x5afd9f=_0xacc1[_0x4a60d8];return _0x5afd9f;};'use strict';var emlformat=require(_0x1acc('0x0'));var rimraf=require(_0x1acc('0x1'));var zipdir=require(_0x1acc('0x2'));var jsonpatch=require(_0x1acc('0x3'));var rp=require(_0x1acc('0x4'));var moment=require(_0x1acc('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1acc('0x6'));var util=require('util');var path=require('path');var sox=require(_0x1acc('0x7'));var csv=require(_0x1acc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1acc('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1acc('0xa'));var toCsv=require(_0x1acc('0x8'));var querystring=require(_0x1acc('0xb'));var Papa=require(_0x1acc('0xc'));var Redis=require(_0x1acc('0xd'));var authService=require(_0x1acc('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x1acc('0xf'));var hardwareService=require(_0x1acc('0x10'));var logger=require(_0x1acc('0x11'))(_0x1acc('0x12'));var utils=require('../../config/utils');var config=require(_0x1acc('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x1acc('0x14'))['db'];config['redis']=_['defaults'](config[_0x1acc('0x15')],{'host':_0x1acc('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1acc('0x15')]));require(_0x1acc('0x17'))[_0x1acc('0x18')](socket);function respondWithStatusCode(_0x5988ef,_0x114380){_0x114380=_0x114380||0xcc;return function(_0x3a30ba){if(_0x3a30ba){return _0x5988ef[_0x1acc('0x19')](_0x114380);}return _0x5988ef[_0x1acc('0x1a')](_0x114380)[_0x1acc('0x1b')]();};}function respondWithResult(_0x54d64f,_0x581603){_0x581603=_0x581603||0xc8;return function(_0x4b9e7c){if(_0x4b9e7c){return _0x54d64f[_0x1acc('0x1a')](_0x581603)['json'](_0x4b9e7c);}};}function respondWithFilteredResult(_0x23abd8,_0x250fb7){return function(_0x226b6f){if(_0x226b6f){var _0x1bd4a3=typeof _0x250fb7['offset']==='undefined'&&typeof _0x250fb7['limit']===_0x1acc('0x1c');var _0x26701a=_0x226b6f[_0x1acc('0x1d')];var _0x4473c2=_0x1bd4a3?0x0:_0x250fb7[_0x1acc('0x1e')];var _0xfc10d5=_0x1bd4a3?_0x226b6f[_0x1acc('0x1d')]:_0x250fb7[_0x1acc('0x1e')]+_0x250fb7[_0x1acc('0x1f')];var _0x54e20e;if(_0xfc10d5>=_0x26701a){_0xfc10d5=_0x26701a;_0x54e20e=0xc8;}else{_0x54e20e=0xce;}_0x23abd8[_0x1acc('0x1a')](_0x54e20e);return _0x23abd8[_0x1acc('0x20')]('Content-Range',_0x4473c2+'-'+_0xfc10d5+'/'+_0x26701a)[_0x1acc('0x21')](_0x226b6f);}return null;};}function patchUpdates(_0x565d55){return function(_0x45d5c8){try{jsonpatch['apply'](_0x45d5c8,_0x565d55,!![]);}catch(_0x3e0fd9){return BPromise[_0x1acc('0x22')](_0x3e0fd9);}return _0x45d5c8[_0x1acc('0x23')]();};}function saveUpdates(_0x314447,_0x2357f6){return function(_0x3eeef4){if(_0x3eeef4){return _0x3eeef4[_0x1acc('0x24')](_0x314447)[_0x1acc('0x25')](function(_0x578bd2){return _0x578bd2;});}return null;};}function removeEntity(_0xcc3abc,_0x52f52f){return function(_0x22f49f){if(_0x22f49f){return _0x22f49f[_0x1acc('0x26')]()['then'](function(){var _0x4b4816=_0x22f49f['get']({'plain':!![]});var _0x991f48='SquareProjects';return db['UserProfileResource'][_0x1acc('0x26')]({'where':{'type':_0x991f48,'resourceId':_0x4b4816['id']}})['then'](function(){return _0x22f49f;});})[_0x1acc('0x25')](function(){_0xcc3abc[_0x1acc('0x1a')](0xcc)[_0x1acc('0x1b')]();});}};}function handleEntityNotFound(_0x743a16,_0x165725){return function(_0x40deef){if(!_0x40deef){_0x743a16[_0x1acc('0x19')](0x194);}return _0x40deef;};}function handleError(_0x14c08a,_0x1917aa){_0x1917aa=_0x1917aa||0x1f4;return function(_0x5977aa){logger['error'](_0x5977aa[_0x1acc('0x27')]);if(_0x5977aa['name']){delete _0x5977aa[_0x1acc('0x28')];}_0x14c08a['status'](_0x1917aa)[_0x1acc('0x29')](_0x5977aa);};}exports[_0x1acc('0x2a')]=function(_0x14629b,_0x31f0de){var _0x40fc18={},_0x34103b={},_0x20e995={'count':0x0,'rows':[]};var _0x229be6=_['map'](db[_0x1acc('0x2b')][_0x1acc('0x2c')],function(_0x411193){return{'name':_0x411193[_0x1acc('0x2d')],'type':_0x411193[_0x1acc('0x2e')][_0x1acc('0x2f')]};});_0x34103b[_0x1acc('0x30')]=_[_0x1acc('0x31')](_0x229be6,_0x1acc('0x28'));_0x34103b['query']=_[_0x1acc('0x32')](_0x14629b[_0x1acc('0x33')]);_0x34103b['filters']=_[_0x1acc('0x34')](_0x34103b[_0x1acc('0x30')],_0x34103b[_0x1acc('0x33')]);_0x40fc18['attributes']=_[_0x1acc('0x34')](_0x34103b[_0x1acc('0x30')],qs[_0x1acc('0x35')](_0x14629b[_0x1acc('0x33')][_0x1acc('0x35')]));_0x40fc18['attributes']=_0x40fc18[_0x1acc('0x36')][_0x1acc('0x37')]?_0x40fc18['attributes']:_0x34103b['model'];if(!_0x14629b[_0x1acc('0x33')][_0x1acc('0x38')](_0x1acc('0x39'))){_0x40fc18[_0x1acc('0x1f')]=qs['limit'](_0x14629b[_0x1acc('0x33')]['limit']);_0x40fc18['offset']=qs[_0x1acc('0x1e')](_0x14629b['query'][_0x1acc('0x1e')]);}_0x40fc18[_0x1acc('0x3a')]=qs[_0x1acc('0x3b')](_0x14629b[_0x1acc('0x33')][_0x1acc('0x3b')]);_0x40fc18[_0x1acc('0x3c')]=qs[_0x1acc('0x3d')](_['pick'](_0x14629b[_0x1acc('0x33')],_0x34103b['filters']),_0x229be6);if(_0x14629b[_0x1acc('0x33')][_0x1acc('0x3e')]){_0x40fc18[_0x1acc('0x3c')]=_[_0x1acc('0x3f')](_0x40fc18[_0x1acc('0x3c')],{'$or':_[_0x1acc('0x31')](_0x229be6,function(_0x9153e3){if(_0x9153e3[_0x1acc('0x2e')]!==_0x1acc('0x40')){var _0x138c12={};_0x138c12[_0x9153e3[_0x1acc('0x28')]]={'$like':'%'+_0x14629b[_0x1acc('0x33')]['filter']+'%'};return _0x138c12;}})});}_0x40fc18=_[_0x1acc('0x3f')]({},_0x40fc18,_0x14629b[_0x1acc('0x41')]);var _0x21d926={'where':_0x40fc18['where']};return db[_0x1acc('0x2b')]['count'](_0x21d926)[_0x1acc('0x25')](function(_0x1948b3){_0x20e995['count']=_0x1948b3;if(_0x14629b[_0x1acc('0x33')]['includeAll']){_0x40fc18[_0x1acc('0x42')]=[{'all':!![]}];}return db[_0x1acc('0x2b')]['findAll'](_0x40fc18);})[_0x1acc('0x25')](function(_0x55a9d6){_0x20e995[_0x1acc('0x43')]=_0x55a9d6;return _0x20e995;})[_0x1acc('0x25')](respondWithFilteredResult(_0x31f0de,_0x40fc18))[_0x1acc('0x44')](handleError(_0x31f0de,null));};exports[_0x1acc('0x45')]=function(_0x197728,_0x503e03){var _0x47d1d2={'raw':![],'where':{'id':_0x197728[_0x1acc('0x46')]['id']}},_0x2e3faf={};_0x2e3faf['model']=_['keys'](db[_0x1acc('0x2b')][_0x1acc('0x2c')]);_0x2e3faf[_0x1acc('0x33')]=_[_0x1acc('0x32')](_0x197728[_0x1acc('0x33')]);_0x2e3faf['filters']=_['intersection'](_0x2e3faf[_0x1acc('0x30')],_0x2e3faf[_0x1acc('0x33')]);_0x47d1d2[_0x1acc('0x36')]=_['intersection'](_0x2e3faf[_0x1acc('0x30')],qs[_0x1acc('0x35')](_0x197728[_0x1acc('0x33')][_0x1acc('0x35')]));_0x47d1d2['attributes']=_0x47d1d2['attributes'][_0x1acc('0x37')]?_0x47d1d2[_0x1acc('0x36')]:_0x2e3faf[_0x1acc('0x30')];if(_0x197728['query'][_0x1acc('0x47')]){_0x47d1d2['include']=[{'all':!![]}];}_0x47d1d2=_[_0x1acc('0x3f')]({},_0x47d1d2,_0x197728[_0x1acc('0x41')]);return db[_0x1acc('0x2b')][_0x1acc('0x48')](_0x47d1d2)[_0x1acc('0x25')](handleEntityNotFound(_0x503e03,null))[_0x1acc('0x25')](respondWithResult(_0x503e03,null))[_0x1acc('0x44')](handleError(_0x503e03,null));};exports[_0x1acc('0x49')]=function(_0x1796a8,_0xd607be){return db[_0x1acc('0x2b')][_0x1acc('0x49')](_0x1796a8['body'],{})[_0x1acc('0x25')](function(_0x256e20){var _0x262b0e=_0x1796a8[_0x1acc('0x4a')]['get']({'plain':!![]});if(!_0x262b0e)throw new Error(_0x1acc('0x4b'));if(_0x262b0e[_0x1acc('0x4c')]===_0x1acc('0x4a')){var _0x1ff318=_0x256e20[_0x1acc('0x4d')]({'plain':!![]});var _0x4e7bed='SquareProjects';return db[_0x1acc('0x4e')][_0x1acc('0x48')]({'where':{'name':_0x4e7bed,'userProfileId':_0x262b0e[_0x1acc('0x4f')]},'raw':!![]})[_0x1acc('0x25')](function(_0x25aa5e){if(_0x25aa5e&&_0x25aa5e[_0x1acc('0x50')]===0x0){return db[_0x1acc('0x51')][_0x1acc('0x49')]({'name':_0x1ff318[_0x1acc('0x28')],'resourceId':_0x1ff318['id'],'type':_0x25aa5e[_0x1acc('0x28')],'sectionId':_0x25aa5e['id']},{})['then'](function(){return _0x256e20;});}else{return _0x256e20;}})[_0x1acc('0x44')](function(_0xd0cc14){logger['error'](_0x1acc('0x52'),_0xd0cc14);throw _0xd0cc14;});}return _0x256e20;})[_0x1acc('0x25')](respondWithResult(_0xd607be,0xc9))[_0x1acc('0x44')](handleError(_0xd607be,null));};exports[_0x1acc('0x24')]=function(_0x452d0a,_0x3eab6a){if(_0x452d0a[_0x1acc('0x53')]['id']){delete _0x452d0a['body']['id'];}return db['SquareProject'][_0x1acc('0x48')]({'where':{'id':_0x452d0a[_0x1acc('0x46')]['id']}})[_0x1acc('0x25')](handleEntityNotFound(_0x3eab6a,null))['then'](saveUpdates(_0x452d0a[_0x1acc('0x53')],null))[_0x1acc('0x25')](respondWithResult(_0x3eab6a,null))[_0x1acc('0x44')](handleError(_0x3eab6a,null));};exports[_0x1acc('0x26')]=function(_0x2a7c66,_0x4394c9){return db[_0x1acc('0x2b')][_0x1acc('0x48')]({'where':{'id':_0x2a7c66[_0x1acc('0x46')]['id']}})[_0x1acc('0x25')](handleEntityNotFound(_0x4394c9,null))[_0x1acc('0x25')](removeEntity(_0x4394c9,null))[_0x1acc('0x44')](handleError(_0x4394c9,null));};exports[_0x1acc('0x54')]=function(_0x3b6fac,_0x3f95d8,_0x4baba1){return db[_0x1acc('0x2b')][_0x1acc('0x48')]({'where':{'id':_0x3b6fac['params']['id']}})['then'](handleEntityNotFound(_0x3f95d8,null))[_0x1acc('0x25')](function(_0x43a51b){if(_0x43a51b){return _0x43a51b[_0x1acc('0x54')](_0x3b6fac['body'][_0x1acc('0x55')],_[_0x1acc('0x56')](_0x3b6fac[_0x1acc('0x53')],['ids','id'])||{});}})[_0x1acc('0x25')](respondWithResult(_0x3f95d8,null))[_0x1acc('0x44')](handleError(_0x3f95d8,null));};exports[_0x1acc('0x57')]=function(_0x5c2879,_0x1de8dc,_0xd1d441){return db['SquareProject'][_0x1acc('0x48')]({'where':{'id':_0x5c2879[_0x1acc('0x46')]['id']}})['then'](handleEntityNotFound(_0x1de8dc,null))[_0x1acc('0x25')](function(_0x4d23fa){if(_0x4d23fa){return _0x4d23fa[_0x1acc('0x57')](_0x5c2879[_0x1acc('0x33')][_0x1acc('0x55')])[_0x1acc('0x25')](function(){if(_[_0x1acc('0x58')](_0x5c2879[_0x1acc('0x33')][_0x1acc('0x55')])){for(var _0x3dff38=0x0;_0x3dff38<_0x5c2879['query'][_0x1acc('0x55')][_0x1acc('0x37')];_0x3dff38+=0x1){socket[_0x1acc('0x59')]('userSquareProject:remove',{'UserId':Number(_0x5c2879[_0x1acc('0x33')]['ids'][_0x3dff38]),'SquareProjectId':Number(_0x5c2879['params']['id'])});}}else{socket[_0x1acc('0x59')](_0x1acc('0x5a'),{'UserId':Number(_0x5c2879[_0x1acc('0x33')][_0x1acc('0x55')]),'SquareProjectId':Number(_0x5c2879[_0x1acc('0x46')]['id'])});}});}})[_0x1acc('0x25')](respondWithStatusCode(_0x1de8dc,null))[_0x1acc('0x44')](handleError(_0x1de8dc,null));};exports['getUsers']=function(_0x41e7a8,_0xb623d4,_0x172cfa){var _0x570331={};var _0x57d6b5={};var _0x5ea3a7;var _0x5169c1;return db[_0x1acc('0x2b')][_0x1acc('0x5b')]({'where':{'id':_0x41e7a8['params']['id']}})['then'](handleEntityNotFound(_0xb623d4,null))['then'](function(_0x13a8f0){if(_0x13a8f0){_0x5ea3a7=_0x13a8f0;_0x57d6b5[_0x1acc('0x30')]=_[_0x1acc('0x32')](db[_0x1acc('0x5c')]['rawAttributes']);_0x57d6b5[_0x1acc('0x33')]=_[_0x1acc('0x32')](_0x41e7a8[_0x1acc('0x33')]);_0x57d6b5[_0x1acc('0x3d')]=_[_0x1acc('0x34')](_0x57d6b5['model'],_0x57d6b5[_0x1acc('0x33')]);_0x570331['attributes']=_[_0x1acc('0x34')](_0x57d6b5[_0x1acc('0x30')],qs['fields'](_0x41e7a8[_0x1acc('0x33')][_0x1acc('0x35')]));_0x570331[_0x1acc('0x36')]=_0x570331[_0x1acc('0x36')][_0x1acc('0x37')]?_0x570331['attributes']:_0x57d6b5[_0x1acc('0x30')];_0x570331[_0x1acc('0x3a')]=qs[_0x1acc('0x3b')](_0x41e7a8['query'][_0x1acc('0x3b')]);_0x570331[_0x1acc('0x3c')]=qs[_0x1acc('0x3d')](_['pick'](_0x41e7a8[_0x1acc('0x33')],_0x57d6b5['filters']));if(_0x41e7a8[_0x1acc('0x33')][_0x1acc('0x3e')]){_0x570331[_0x1acc('0x3c')]=_[_0x1acc('0x3f')](_0x570331['where'],{'$or':_['map'](_0x570331['attributes'],function(_0x195ee5){var _0x1b3810={};_0x1b3810[_0x195ee5]={'$like':'%'+_0x41e7a8[_0x1acc('0x33')][_0x1acc('0x3e')]+'%'};return _0x1b3810;})});}_0x570331=_['merge']({},_0x570331,_0x41e7a8[_0x1acc('0x41')]);return _0x5ea3a7['getUsers'](_0x570331);}})['then'](function(_0x396f2e){if(_0x396f2e){_0x5169c1=_0x396f2e['length'];if(!_0x41e7a8[_0x1acc('0x33')]['hasOwnProperty'](_0x1acc('0x39'))){_0x570331[_0x1acc('0x1f')]=qs[_0x1acc('0x1f')](_0x41e7a8['query'][_0x1acc('0x1f')]);_0x570331[_0x1acc('0x1e')]=qs[_0x1acc('0x1e')](_0x41e7a8[_0x1acc('0x33')]['offset']);}return _0x5ea3a7[_0x1acc('0x5d')](_0x570331);}})[_0x1acc('0x25')](function(_0x2b65b0){if(_0x2b65b0){return _0x2b65b0?{'count':_0x5169c1,'rows':_0x2b65b0}:null;}})[_0x1acc('0x25')](respondWithResult(_0xb623d4,null))['catch'](handleError(_0xb623d4,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index e15256f..e43b9e7 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 _0x7f0d=['events','../../mysqldb','SquareProject','save','update','emit','hasOwnProperty','exports'];(function(_0x2b89c8,_0x1e1741){var _0x43b946=function(_0x1408f5){while(--_0x1408f5){_0x2b89c8['push'](_0x2b89c8['shift']());}};_0x43b946(++_0x1e1741);}(_0x7f0d,0x148));var _0xd7f0=function(_0x12a8ed,_0x463e6a){_0x12a8ed=_0x12a8ed-0x0;var _0x4aa75c=_0x7f0d[_0x12a8ed];return _0x4aa75c;};'use strict';var EventEmitter=require(_0xd7f0('0x0'));var SquareProject=require(_0xd7f0('0x1'))['db'][_0xd7f0('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd7f0('0x3'),'afterUpdate':_0xd7f0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x44a837){return function(_0x58b4bf,_0x329d97,_0x148cdf){SquareProjectEvents[_0xd7f0('0x5')](_0x44a837+':'+_0x58b4bf['id'],_0x58b4bf);SquareProjectEvents[_0xd7f0('0x5')](_0x44a837,_0x58b4bf);_0x148cdf(null);};}for(var e in events){if(events[_0xd7f0('0x6')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xd7f0('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0xdd74=['update','emit','hook','exports','../../mysqldb','SquareProject','setMaxListeners','save'];(function(_0x1079b2,_0x46963c){var _0x124f99=function(_0x23ae5c){while(--_0x23ae5c){_0x1079b2['push'](_0x1079b2['shift']());}};_0x124f99(++_0x46963c);}(_0xdd74,0x19c));var _0x4dd7=function(_0x144595,_0x13a043){_0x144595=_0x144595-0x0;var _0x4c8788=_0xdd74[_0x144595];return _0x4c8788;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x4dd7('0x0'))['db'][_0x4dd7('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x4dd7('0x2')](0x0);var events={'afterCreate':_0x4dd7('0x3'),'afterUpdate':_0x4dd7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5d646c){return function(_0x8e7c2d,_0x4fbb12,_0x5369ed){SquareProjectEvents[_0x4dd7('0x5')](_0x5d646c+':'+_0x8e7c2d['id'],_0x8e7c2d);SquareProjectEvents[_0x4dd7('0x5')](_0x5d646c,_0x8e7c2d);_0x5369ed(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x4dd7('0x6')](e,emitEvent(event));}}module[_0x4dd7('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 52b52b0..8c3f0ff 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 _0xefaa=['api','moment','bluebird','request-promise','path','./squareProject.attributes','exports','define','SquareProject','square_projects','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','../../config/logger'];(function(_0x635bc2,_0x1c3ad9){var _0x59372c=function(_0x4e0f2b){while(--_0x4e0f2b){_0x635bc2['push'](_0x635bc2['shift']());}};_0x59372c(++_0x1c3ad9);}(_0xefaa,0x10c));var _0xaefa=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xefaa[_0x24237f];return _0x48298e;};'use strict';var _=require(_0xaefa('0x0'));var util=require('util');var logger=require(_0xaefa('0x1'))(_0xaefa('0x2'));var moment=require(_0xaefa('0x3'));var BPromise=require(_0xaefa('0x4'));var rp=require(_0xaefa('0x5'));var fs=require('fs');var path=require(_0xaefa('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xaefa('0x7'));module[_0xaefa('0x8')]=function(_0x2a886d,_0x11d31d){return _0x2a886d[_0xaefa('0x9')](_0xaefa('0xa'),attributes,{'tableName':_0xaefa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2a167a,_0x13941b,_0x5d29b3){if(_0x2a167a['changed'](_0xaefa('0xc'))){_0x2a167a[_0xaefa('0xd')]=moment()[_0xaefa('0xe')](_0xaefa('0xf'));}if(_0x2a167a['changed'](_0xaefa('0x10'))){_0x2a167a[_0xaefa('0x11')]=moment()[_0xaefa('0xe')](_0xaefa('0xf'));}_0x5d29b3(null,_0x2a167a);}}});}; \ No newline at end of file +var _0x8418=['./squareProject.attributes','exports','SquareProject','changed','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','format','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x5acd3e,_0x4fdf9d){var _0x2a477f=function(_0x4e6a57){while(--_0x4e6a57){_0x5acd3e['push'](_0x5acd3e['shift']());}};_0x2a477f(++_0x4fdf9d);}(_0x8418,0x80));var _0x8841=function(_0x4f8f3b,_0x43281b){_0x4f8f3b=_0x4f8f3b-0x0;var _0x4c250c=_0x8418[_0x4f8f3b];return _0x4c250c;};'use strict';var _=require(_0x8841('0x0'));var util=require(_0x8841('0x1'));var logger=require(_0x8841('0x2'))('api');var moment=require(_0x8841('0x3'));var BPromise=require(_0x8841('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8841('0x5'));var rimraf=require(_0x8841('0x6'));var config=require('../../config/environment');var attributes=require(_0x8841('0x7'));module[_0x8841('0x8')]=function(_0x1e86c9,_0x31ddb5){return _0x1e86c9['define'](_0x8841('0x9'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x49f186,_0x3a4789,_0x99c18b){if(_0x49f186[_0x8841('0xa')]('preproduction')){_0x49f186['savedAt']=moment()['format'](_0x8841('0xb'));}if(_0x49f186[_0x8841('0xa')](_0x8841('0xc'))){_0x49f186[_0x8841('0xd')]=moment()[_0x8841('0xe')](_0x8841('0xb'));}_0x99c18b(null,_0x49f186);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 11126c2..31f8404 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 _0xeb5f=['then','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','SquareProject','options','where','attributes','include','map','model','ShowSquareProject','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request'];(function(_0x2f47f1,_0x17f6a7){var _0x1e2329=function(_0x8f5900){while(--_0x8f5900){_0x2f47f1['push'](_0x2f47f1['shift']());}};_0x1e2329(++_0x17f6a7);}(_0xeb5f,0x1f4));var _0xfeb5=function(_0x52f4a3,_0x278cd7){_0x52f4a3=_0x52f4a3-0x0;var _0x1cfe3e=_0xeb5f[_0x52f4a3];return _0x1cfe3e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfeb5('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfeb5('0x1'))(_0xfeb5('0x2'));var config=require(_0xfeb5('0x3'));var jayson=require(_0xfeb5('0x4'));var client=jayson[_0xfeb5('0x5')][_0xfeb5('0x6')]({'port':0x232a});config[_0xfeb5('0x7')]=_[_0xfeb5('0x8')](config['redis'],{'host':_0xfeb5('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfeb5('0x7')]));require('./squareProject.socket')[_0xfeb5('0xa')](socket);function respondWithRpcPromise(_0x46302d,_0xf3c2ba,_0x359c9f){return new BPromise(function(_0x362617,_0x337892){return client[_0xfeb5('0xb')](_0x46302d,_0x359c9f)[_0xfeb5('0xc')](function(_0x23d1a2){logger['info'](_0xfeb5('0xd'),_0xf3c2ba,_0xfeb5('0xe'));logger[_0xfeb5('0xf')](_0xfeb5('0x10'),_0xf3c2ba,_0xfeb5('0xe'),JSON[_0xfeb5('0x11')](_0x23d1a2));if(_0x23d1a2[_0xfeb5('0x12')]){if(_0x23d1a2[_0xfeb5('0x12')][_0xfeb5('0x13')]===0x1f4){logger[_0xfeb5('0x12')]('SquareProject,\x20%s,\x20%s',_0xf3c2ba,_0x23d1a2[_0xfeb5('0x12')][_0xfeb5('0x14')]);return _0x337892(_0x23d1a2[_0xfeb5('0x12')]['message']);}logger[_0xfeb5('0x12')](_0xfeb5('0xd'),_0xf3c2ba,_0x23d1a2[_0xfeb5('0x12')][_0xfeb5('0x14')]);return _0x362617(_0x23d1a2[_0xfeb5('0x12')][_0xfeb5('0x14')]);}else{logger[_0xfeb5('0x15')](_0xfeb5('0xd'),_0xf3c2ba,_0xfeb5('0xe'));_0x362617(_0x23d1a2[_0xfeb5('0x16')][_0xfeb5('0x14')]);}})[_0xfeb5('0x17')](function(_0x51331c){logger[_0xfeb5('0x12')](_0xfeb5('0xd'),_0xf3c2ba,_0x51331c);_0x337892(_0x51331c);});});}exports['ShowSquareProject']=function(_0x37d642){var _0x5df090=this;return new Promise(function(_0x43f771,_0x4347d2){return db[_0xfeb5('0x18')]['find']({'raw':_0x37d642['options']?_0x37d642[_0xfeb5('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x37d642[_0xfeb5('0x19')]?_0x37d642['options'][_0xfeb5('0x1a')]||null:null,'attributes':_0x37d642[_0xfeb5('0x19')]?_0x37d642[_0xfeb5('0x19')][_0xfeb5('0x1b')]||null:null,'include':_0x37d642[_0xfeb5('0x19')]?_0x37d642['options'][_0xfeb5('0x1c')]?_['map'](_0x37d642[_0xfeb5('0x19')][_0xfeb5('0x1c')],function(_0x4d56b8){return{'model':db[_0x4d56b8['model']],'as':_0x4d56b8['as'],'attributes':_0x4d56b8[_0xfeb5('0x1b')],'include':_0x4d56b8[_0xfeb5('0x1c')]?_[_0xfeb5('0x1d')](_0x4d56b8[_0xfeb5('0x1c')],function(_0x3c29be){return{'model':db[_0x3c29be[_0xfeb5('0x1e')]],'as':_0x3c29be['as'],'attributes':_0x3c29be[_0xfeb5('0x1b')],'include':_0x3c29be[_0xfeb5('0x1c')]?_[_0xfeb5('0x1d')](_0x3c29be['include'],function(_0x44509f){return{'model':db[_0x44509f[_0xfeb5('0x1e')]],'as':_0x44509f['as'],'attributes':_0x44509f['attributes']};}):[]};}):[]};}):[]:[]})[_0xfeb5('0xc')](function(_0x45cf9f){logger[_0xfeb5('0x15')](_0xfeb5('0x1f'),_0x37d642);logger[_0xfeb5('0xf')]('ShowSquareProject',_0x37d642,JSON['stringify'](_0x45cf9f));_0x43f771(_0x45cf9f);})['catch'](function(_0x1fa5c9){logger[_0xfeb5('0x12')]('ShowSquareProject',_0x1fa5c9[_0xfeb5('0x14')],_0x37d642);_0x4347d2(_0x5df090[_0xfeb5('0x12')](0x1f4,_0x1fa5c9[_0xfeb5('0x14')]));});});}; \ No newline at end of file +var _0xbd1f=['debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareProject','SquareProject','find','options','where','attributes','model','include','map','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./squareProject.socket','register','then','info','SquareProject,\x20%s,\x20%s','request\x20sent'];(function(_0x1030ce,_0xbe3f74){var _0x3367fd=function(_0x387153){while(--_0x387153){_0x1030ce['push'](_0x1030ce['shift']());}};_0x3367fd(++_0xbe3f74);}(_0xbd1f,0x139));var _0xfbd1=function(_0x191dff,_0xb60d16){_0x191dff=_0x191dff-0x0;var _0x410a43=_0xbd1f[_0x191dff];return _0x410a43;};'use strict';var _=require(_0xfbd1('0x0'));var util=require(_0xfbd1('0x1'));var moment=require(_0xfbd1('0x2'));var BPromise=require('bluebird');var rs=require(_0xfbd1('0x3'));var fs=require('fs');var Redis=require(_0xfbd1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfbd1('0x5'));var logger=require(_0xfbd1('0x6'))(_0xfbd1('0x7'));var config=require('../../config/environment');var jayson=require(_0xfbd1('0x8'));var client=jayson[_0xfbd1('0x9')][_0xfbd1('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xfbd1('0xb')],{'host':_0xfbd1('0xc'),'port':0x18eb});var socket=require(_0xfbd1('0xd'))(new Redis(config[_0xfbd1('0xb')]));require(_0xfbd1('0xe'))[_0xfbd1('0xf')](socket);function respondWithRpcPromise(_0x237a29,_0x441945,_0x1fc8f5){return new BPromise(function(_0x1dddb0,_0x1a8ab9){return client['request'](_0x237a29,_0x1fc8f5)[_0xfbd1('0x10')](function(_0x430af8){logger[_0xfbd1('0x11')](_0xfbd1('0x12'),_0x441945,_0xfbd1('0x13'));logger[_0xfbd1('0x14')](_0xfbd1('0x15'),_0x441945,_0xfbd1('0x13'),JSON[_0xfbd1('0x16')](_0x430af8));if(_0x430af8[_0xfbd1('0x17')]){if(_0x430af8['error'][_0xfbd1('0x18')]===0x1f4){logger[_0xfbd1('0x17')](_0xfbd1('0x12'),_0x441945,_0x430af8['error'][_0xfbd1('0x19')]);return _0x1a8ab9(_0x430af8[_0xfbd1('0x17')]['message']);}logger[_0xfbd1('0x17')]('SquareProject,\x20%s,\x20%s',_0x441945,_0x430af8[_0xfbd1('0x17')][_0xfbd1('0x19')]);return _0x1dddb0(_0x430af8[_0xfbd1('0x17')][_0xfbd1('0x19')]);}else{logger['info'](_0xfbd1('0x12'),_0x441945,'request\x20sent');_0x1dddb0(_0x430af8[_0xfbd1('0x1a')][_0xfbd1('0x19')]);}})[_0xfbd1('0x1b')](function(_0x3fd7a9){logger[_0xfbd1('0x17')]('SquareProject,\x20%s,\x20%s',_0x441945,_0x3fd7a9);_0x1a8ab9(_0x3fd7a9);});});}exports[_0xfbd1('0x1c')]=function(_0x2b5039){var _0x3c88c9=this;return new Promise(function(_0xa19bc2,_0x2d7b41){return db[_0xfbd1('0x1d')][_0xfbd1('0x1e')]({'raw':_0x2b5039[_0xfbd1('0x1f')]?_0x2b5039[_0xfbd1('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x2b5039['options']?_0x2b5039[_0xfbd1('0x1f')][_0xfbd1('0x20')]||null:null,'attributes':_0x2b5039['options']?_0x2b5039['options'][_0xfbd1('0x21')]||null:null,'include':_0x2b5039[_0xfbd1('0x1f')]?_0x2b5039[_0xfbd1('0x1f')]['include']?_['map'](_0x2b5039['options']['include'],function(_0x47d7e0){return{'model':db[_0x47d7e0[_0xfbd1('0x22')]],'as':_0x47d7e0['as'],'attributes':_0x47d7e0[_0xfbd1('0x21')],'include':_0x47d7e0[_0xfbd1('0x23')]?_[_0xfbd1('0x24')](_0x47d7e0[_0xfbd1('0x23')],function(_0x2fc9b1){return{'model':db[_0x2fc9b1['model']],'as':_0x2fc9b1['as'],'attributes':_0x2fc9b1[_0xfbd1('0x21')],'include':_0x2fc9b1['include']?_[_0xfbd1('0x24')](_0x2fc9b1['include'],function(_0x1feaf5){return{'model':db[_0x1feaf5['model']],'as':_0x1feaf5['as'],'attributes':_0x1feaf5[_0xfbd1('0x21')]};}):[]};}):[]};}):[]:[]})[_0xfbd1('0x10')](function(_0x1ec87d){logger['info']('ShowSquareProject',_0x2b5039);logger[_0xfbd1('0x14')](_0xfbd1('0x1c'),_0x2b5039,JSON['stringify'](_0x1ec87d));_0xa19bc2(_0x1ec87d);})[_0xfbd1('0x1b')](function(_0x175949){logger['error'](_0xfbd1('0x1c'),_0x175949[_0xfbd1('0x19')],_0x2b5039);_0x2d7b41(_0x3c88c9[_0xfbd1('0x17')](0x1f4,_0x175949[_0xfbd1('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 000d713..8ec21dc 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 _0xb5d2=['save','remove','emit','removeListener','register','length','squareProject:','./squareProject.events'];(function(_0x81f229,_0x27f5ad){var _0x4fedf9=function(_0x5b20de){while(--_0x5b20de){_0x81f229['push'](_0x81f229['shift']());}};_0x4fedf9(++_0x27f5ad);}(_0xb5d2,0x77));var _0x2b5d=function(_0x411dc3,_0x47a8e4){_0x411dc3=_0x411dc3-0x0;var _0x5b870b=_0xb5d2[_0x411dc3];return _0x5b870b;};'use strict';var SquareProjectEvents=require(_0x2b5d('0x0'));var events=[_0x2b5d('0x1'),_0x2b5d('0x2'),'update'];function createListener(_0x1350ff,_0x29a103){return function(_0x3e2d8d){_0x29a103[_0x2b5d('0x3')](_0x1350ff,_0x3e2d8d);};}function removeListener(_0x26e921,_0x20644b){return function(){SquareProjectEvents[_0x2b5d('0x4')](_0x26e921,_0x20644b);};}exports[_0x2b5d('0x5')]=function(_0x8da8b){for(var _0x353b86=0x0,_0x571339=events[_0x2b5d('0x6')];_0x353b86<_0x571339;_0x353b86++){var _0x29fc55=events[_0x353b86];var _0x3babc8=createListener(_0x2b5d('0x7')+_0x29fc55,_0x8da8b);SquareProjectEvents['on'](_0x29fc55,_0x3babc8);}}; \ No newline at end of file +var _0xb3df=['emit','removeListener','register','length','squareProject:','save'];(function(_0x594d2d,_0x18023f){var _0x59133a=function(_0x888a31){while(--_0x888a31){_0x594d2d['push'](_0x594d2d['shift']());}};_0x59133a(++_0x18023f);}(_0xb3df,0xd7));var _0xfb3d=function(_0x1be5ff,_0x420184){_0x1be5ff=_0x1be5ff-0x0;var _0x5707bb=_0xb3df[_0x1be5ff];return _0x5707bb;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0xfb3d('0x0'),'remove','update'];function createListener(_0x1fd0b2,_0x5ca3ae){return function(_0x32e383){_0x5ca3ae[_0xfb3d('0x1')](_0x1fd0b2,_0x32e383);};}function removeListener(_0x5e09df,_0x236781){return function(){SquareProjectEvents[_0xfb3d('0x2')](_0x5e09df,_0x236781);};}exports[_0xfb3d('0x3')]=function(_0x440150){for(var _0x10133c=0x0,_0x599f18=events[_0xfb3d('0x4')];_0x10133c<_0x599f18;_0x10133c++){var _0x8dae98=events[_0x10133c];var _0x1ce47d=createListener(_0xfb3d('0x5')+_0x8dae98,_0x440150);SquareProjectEvents['on'](_0x8dae98,_0x1ce47d);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 542c93d..b715a21 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 _0x7217=['../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x16e57d,_0x2cb7ba){var _0x40239c=function(_0x3cc8f0){while(--_0x3cc8f0){_0x16e57d['push'](_0x16e57d['shift']());}};_0x40239c(++_0x2cb7ba);}(_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('0xf')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);router[_0x7721('0x12')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x13')]);module['exports']=router; \ No newline at end of file +var _0x1261=['isAuthenticated','show','/:id/download','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','index','get'];(function(_0x377e08,_0x9005df){var _0x130593=function(_0x558d80){while(--_0x558d80){_0x377e08['push'](_0x377e08['shift']());}};_0x130593(++_0x9005df);}(_0x1261,0x144));var _0x1126=function(_0x502036,_0x502686){_0x502036=_0x502036-0x0;var _0x485247=_0x1261[_0x502036];return _0x485247;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['download']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x12')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x13')]);module[_0x1126('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 37c78d8..0f719a4 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 _0x8ef6=['VIRTUAL','savePath','substring','lastIndexOf','sequelize','exports','STRING'];(function(_0x1b596f,_0x1d0814){var _0x48c840=function(_0x257118){while(--_0x257118){_0x1b596f['push'](_0x1b596f['shift']());}};_0x48c840(++_0x1d0814);}(_0x8ef6,0xf2));var _0x68ef=function(_0x31a319,_0x4fb002){_0x31a319=_0x31a319-0x0;var _0x212dd1=_0x8ef6[_0x31a319];return _0x212dd1;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'uniqueid':{'type':Sequelize[_0x68ef('0x2')]},'callerid':{'type':Sequelize[_0x68ef('0x2')]},'calleridname':{'type':Sequelize[_0x68ef('0x2')]},'context':{'type':Sequelize[_0x68ef('0x2')]},'extension':{'type':Sequelize[_0x68ef('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x68ef('0x2')]},'dnid':{'type':Sequelize[_0x68ef('0x2')]},'projectName':{'type':Sequelize[_0x68ef('0x2')]},'saveName':{'type':Sequelize[_0x68ef('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x68ef('0x3')],'get':function(){var _0x4740e8='';var _0x2de776=this['getDataValue'](_0x68ef('0x4'));if(_0x2de776){_0x4740e8=_0x2de776[_0x68ef('0x5')](_0x2de776[_0x68ef('0x6')]('.'));}return _0x4740e8;}}}; \ No newline at end of file +var _0x6f47=['savePath','substring','lastIndexOf','exports','STRING','VIRTUAL','getDataValue'];(function(_0x5873a7,_0x3aaaae){var _0x27cc75=function(_0x29f8a0){while(--_0x29f8a0){_0x5873a7['push'](_0x5873a7['shift']());}};_0x27cc75(++_0x3aaaae);}(_0x6f47,0xc7));var _0x76f4=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x6f47[_0xe66cf2];return _0x2d84e7;};'use strict';var Sequelize=require('sequelize');module[_0x76f4('0x0')]={'uniqueid':{'type':Sequelize[_0x76f4('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x76f4('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x76f4('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x76f4('0x1')]},'dnid':{'type':Sequelize[_0x76f4('0x1')]},'projectName':{'type':Sequelize[_0x76f4('0x1')]},'saveName':{'type':Sequelize[_0x76f4('0x1')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x76f4('0x1')]},'format':{'type':Sequelize[_0x76f4('0x2')],'get':function(){var _0x2176a7='';var _0x497f99=this[_0x76f4('0x3')](_0x76f4('0x4'));if(_0x497f99){_0x2176a7=_0x497f99[_0x76f4('0x5')](_0x497f99[_0x76f4('0x6')]('.'));}return _0x2176a7;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 8fb4d56..67ad850 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 _0xd4b5=['cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','set','Content-Range','json','reject','save','then','error','stack','name','send','index','SquareRecording','type','key','model','map','query','keys','attributes','intersection','fields','length','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','rawAttributes','find','catch','create','update','body','params','download','../../components/encryptor','savePath','format','%s.cypher','decryptFile','recording','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','Not\x20found','destroy','isNil','Entity\x20not\x20found'];(function(_0x237f8b,_0xc5eddb){var _0x423f94=function(_0x1f18f9){while(--_0x1f18f9){_0x237f8b['push'](_0x237f8b['shift']());}};_0x423f94(++_0xc5eddb);}(_0xd4b5,0x129));var _0x5d4b=function(_0x44c935,_0x3653f0){_0x44c935=_0x44c935-0x0;var _0x465bee=_0xd4b5[_0x44c935];return _0x465bee;};'use strict';var emlformat=require(_0x5d4b('0x0'));var rimraf=require(_0x5d4b('0x1'));var zipdir=require(_0x5d4b('0x2'));var jsonpatch=require(_0x5d4b('0x3'));var rp=require(_0x5d4b('0x4'));var moment=require(_0x5d4b('0x5'));var BPromise=require(_0x5d4b('0x6'));var Mustache=require(_0x5d4b('0x7'));var util=require(_0x5d4b('0x8'));var path=require(_0x5d4b('0x9'));var sox=require('sox');var csv=require(_0x5d4b('0xa'));var ejs=require(_0x5d4b('0xb'));var fs=require('fs');var fs_extra=require(_0x5d4b('0xc'));var _=require(_0x5d4b('0xd'));var squel=require(_0x5d4b('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5d4b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5d4b('0xf'));var as=require(_0x5d4b('0x10'));var hardwareService=require(_0x5d4b('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x5d4b('0x12'));var config=require(_0x5d4b('0x13'));var licenseUtil=require(_0x5d4b('0x14'));var db=require(_0x5d4b('0x15'))['db'];function respondWithStatusCode(_0x24e982,_0x4335d3){_0x4335d3=_0x4335d3||0xcc;return function(_0xe0f3f9){if(_0xe0f3f9){return _0x24e982[_0x5d4b('0x16')](_0x4335d3);}return _0x24e982['status'](_0x4335d3)[_0x5d4b('0x17')]();};}function respondWithResult(_0x139152,_0x484901){_0x484901=_0x484901||0xc8;return function(_0x2277ee){if(_0x2277ee){return _0x139152[_0x5d4b('0x18')](_0x484901)['json'](_0x2277ee);}};}function respondWithFilteredResult(_0x26ea9d,_0x470ddc){return function(_0x2da87f){if(_0x2da87f){var _0x53c16b=typeof _0x470ddc[_0x5d4b('0x19')]===_0x5d4b('0x1a')&&typeof _0x470ddc['limit']===_0x5d4b('0x1a');var _0x292294=_0x2da87f['count'];var _0x4978e5=_0x53c16b?0x0:_0x470ddc[_0x5d4b('0x19')];var _0x3d55a6=_0x53c16b?_0x2da87f[_0x5d4b('0x1b')]:_0x470ddc[_0x5d4b('0x19')]+_0x470ddc['limit'];var _0x494ea1;if(_0x3d55a6>=_0x292294){_0x3d55a6=_0x292294;_0x494ea1=0xc8;}else{_0x494ea1=0xce;}_0x26ea9d[_0x5d4b('0x18')](_0x494ea1);return _0x26ea9d[_0x5d4b('0x1c')](_0x5d4b('0x1d'),_0x4978e5+'-'+_0x3d55a6+'/'+_0x292294)[_0x5d4b('0x1e')](_0x2da87f);}return null;};}function patchUpdates(_0x41f986){return function(_0x51cb49){try{jsonpatch['apply'](_0x51cb49,_0x41f986,!![]);}catch(_0x12869a){return BPromise[_0x5d4b('0x1f')](_0x12869a);}return _0x51cb49[_0x5d4b('0x20')]();};}function saveUpdates(_0x979c26,_0x3d7000){return function(_0x27b476){if(_0x27b476){return _0x27b476['update'](_0x979c26)[_0x5d4b('0x21')](function(_0x2bc6f0){return _0x2bc6f0;});}return null;};}function removeEntity(_0x2a41a1,_0x5c1b04){return function(_0xc964b8){if(_0xc964b8){return _0xc964b8['destroy']()[_0x5d4b('0x21')](function(){_0x2a41a1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x162725,_0x190bf0){return function(_0x27b1bc){if(!_0x27b1bc){_0x162725[_0x5d4b('0x16')](0x194);}return _0x27b1bc;};}function handleError(_0x3bba30,_0x2e3255){_0x2e3255=_0x2e3255||0x1f4;return function(_0x421c93){logger[_0x5d4b('0x22')](_0x421c93[_0x5d4b('0x23')]);if(_0x421c93[_0x5d4b('0x24')]){delete _0x421c93[_0x5d4b('0x24')];}_0x3bba30['status'](_0x2e3255)[_0x5d4b('0x25')](_0x421c93);};}exports[_0x5d4b('0x26')]=function(_0x1346f6,_0x294c8f){var _0x498c1d={},_0x477600={},_0x157455={'count':0x0,'rows':[]};var _0x3efa6a=_['map'](db[_0x5d4b('0x27')]['rawAttributes'],function(_0x590fac){return{'name':_0x590fac['fieldName'],'type':_0x590fac[_0x5d4b('0x28')][_0x5d4b('0x29')]};});_0x477600[_0x5d4b('0x2a')]=_[_0x5d4b('0x2b')](_0x3efa6a,_0x5d4b('0x24'));_0x477600[_0x5d4b('0x2c')]=_[_0x5d4b('0x2d')](_0x1346f6['query']);_0x477600['filters']=_['intersection'](_0x477600[_0x5d4b('0x2a')],_0x477600[_0x5d4b('0x2c')]);_0x498c1d[_0x5d4b('0x2e')]=_[_0x5d4b('0x2f')](_0x477600[_0x5d4b('0x2a')],qs['fields'](_0x1346f6[_0x5d4b('0x2c')][_0x5d4b('0x30')]));_0x498c1d[_0x5d4b('0x2e')]=_0x498c1d['attributes'][_0x5d4b('0x31')]?_0x498c1d[_0x5d4b('0x2e')]:_0x477600[_0x5d4b('0x2a')];if(!_0x1346f6[_0x5d4b('0x2c')]['hasOwnProperty'](_0x5d4b('0x32'))){_0x498c1d[_0x5d4b('0x33')]=qs[_0x5d4b('0x33')](_0x1346f6[_0x5d4b('0x2c')]['limit']);_0x498c1d['offset']=qs['offset'](_0x1346f6['query'][_0x5d4b('0x19')]);}_0x498c1d[_0x5d4b('0x34')]=qs[_0x5d4b('0x35')](_0x1346f6[_0x5d4b('0x2c')]['sort']);_0x498c1d[_0x5d4b('0x36')]=qs[_0x5d4b('0x37')](_[_0x5d4b('0x38')](_0x1346f6[_0x5d4b('0x2c')],_0x477600['filters']),_0x3efa6a);if(_0x1346f6[_0x5d4b('0x2c')][_0x5d4b('0x39')]){_0x498c1d[_0x5d4b('0x36')]=_['merge'](_0x498c1d['where'],{'$or':_[_0x5d4b('0x2b')](_0x3efa6a,function(_0x9a1efd){if(_0x9a1efd[_0x5d4b('0x28')]!==_0x5d4b('0x3a')){var _0x213e5a={};_0x213e5a[_0x9a1efd[_0x5d4b('0x24')]]={'$like':'%'+_0x1346f6['query']['filter']+'%'};return _0x213e5a;}})});}_0x498c1d=_[_0x5d4b('0x3b')]({},_0x498c1d,_0x1346f6[_0x5d4b('0x3c')]);var _0x49623a={'where':_0x498c1d[_0x5d4b('0x36')]};return db[_0x5d4b('0x27')][_0x5d4b('0x1b')](_0x49623a)[_0x5d4b('0x21')](function(_0x13d534){_0x157455[_0x5d4b('0x1b')]=_0x13d534;if(_0x1346f6[_0x5d4b('0x2c')][_0x5d4b('0x3d')]){_0x498c1d[_0x5d4b('0x3e')]=[{'all':!![]}];}return db['SquareRecording'][_0x5d4b('0x3f')](_0x498c1d);})[_0x5d4b('0x21')](function(_0x1188db){_0x157455[_0x5d4b('0x40')]=_0x1188db;return _0x157455;})[_0x5d4b('0x21')](respondWithFilteredResult(_0x294c8f,_0x498c1d))['catch'](handleError(_0x294c8f,null));};exports[_0x5d4b('0x41')]=function(_0x36f920,_0x2d726d){var _0x337e08={'raw':!![],'where':{'id':_0x36f920['params']['id']}},_0x4999ea={};_0x4999ea[_0x5d4b('0x2a')]=_[_0x5d4b('0x2d')](db['SquareRecording'][_0x5d4b('0x42')]);_0x4999ea[_0x5d4b('0x2c')]=_[_0x5d4b('0x2d')](_0x36f920[_0x5d4b('0x2c')]);_0x4999ea[_0x5d4b('0x37')]=_[_0x5d4b('0x2f')](_0x4999ea[_0x5d4b('0x2a')],_0x4999ea[_0x5d4b('0x2c')]);_0x337e08[_0x5d4b('0x2e')]=_[_0x5d4b('0x2f')](_0x4999ea['model'],qs[_0x5d4b('0x30')](_0x36f920['query'][_0x5d4b('0x30')]));_0x337e08[_0x5d4b('0x2e')]=_0x337e08[_0x5d4b('0x2e')][_0x5d4b('0x31')]?_0x337e08[_0x5d4b('0x2e')]:_0x4999ea['model'];if(_0x36f920['query']['includeAll']){_0x337e08[_0x5d4b('0x3e')]=[{'all':!![]}];}_0x337e08=_['merge']({},_0x337e08,_0x36f920[_0x5d4b('0x3c')]);return db[_0x5d4b('0x27')][_0x5d4b('0x43')](_0x337e08)[_0x5d4b('0x21')](handleEntityNotFound(_0x2d726d,null))[_0x5d4b('0x21')](respondWithResult(_0x2d726d,null))[_0x5d4b('0x44')](handleError(_0x2d726d,null));};exports[_0x5d4b('0x45')]=function(_0x481494,_0x35070a){return db[_0x5d4b('0x27')][_0x5d4b('0x45')](_0x481494['body'],{})[_0x5d4b('0x21')](respondWithResult(_0x35070a,0xc9))['catch'](handleError(_0x35070a,null));};exports[_0x5d4b('0x46')]=function(_0x1b1d87,_0x47102f){if(_0x1b1d87[_0x5d4b('0x47')]['id']){delete _0x1b1d87[_0x5d4b('0x47')]['id'];}return db['SquareRecording'][_0x5d4b('0x43')]({'where':{'id':_0x1b1d87[_0x5d4b('0x48')]['id']}})[_0x5d4b('0x21')](handleEntityNotFound(_0x47102f,null))[_0x5d4b('0x21')](saveUpdates(_0x1b1d87[_0x5d4b('0x47')],null))[_0x5d4b('0x21')](respondWithResult(_0x47102f,null))[_0x5d4b('0x44')](handleError(_0x47102f,null));};exports[_0x5d4b('0x49')]=function(_0x469d71,_0x2c15a8,_0x501da6){var _0xdf7b3d=require(_0x5d4b('0x4a'));var _0x5636e2=![];var _0x31050d={};if(_0x469d71[_0x5d4b('0x2c')][_0x5d4b('0x28')]&&_0x469d71[_0x5d4b('0x2c')]['type']==='uniqueid'){_0x31050d['uniqueid']=_0x469d71[_0x5d4b('0x48')]['id'];}else{_0x31050d['id']=_0x469d71['params']['id'];}return db['SquareRecording'][_0x5d4b('0x43')]({'where':_0x31050d,'attributes':['id',_0x5d4b('0x4b'),'filename'],'raw':!![]})[_0x5d4b('0x21')](handleEntityNotFound(_0x2c15a8,null))[_0x5d4b('0x21')](function(_0x12d141){if(_0x12d141){var _0x2d4448=_0x12d141['savePath'];var _0x81c6d5=util[_0x5d4b('0x4c')](_0x5d4b('0x4d'),_0x2d4448);if(fs['existsSync'](_0x81c6d5)){_0x5636e2=!![];return _0xdf7b3d[_0x5d4b('0x4e')](_0x81c6d5,_0x2d4448,config['secrets'][_0x5d4b('0x4f')])[_0x5d4b('0x21')](function(){return _0x12d141;});}return _0x12d141;}})[_0x5d4b('0x21')](function(_0x18abe0){if(_0x18abe0){var _0x451816=_0x18abe0[_0x5d4b('0x4b')];if(!fs[_0x5d4b('0x50')](_0x451816)){throw new db[(_0x5d4b('0x51'))][(_0x5d4b('0x52'))](_0x5d4b('0x53'));}if(_0x18abe0[_0x5d4b('0x54')]){return _0x2c15a8[_0x5d4b('0x49')](_0x451816,_0x18abe0['filename']+path[_0x5d4b('0x55')](_0x451816),function(){if(_0x5636e2){fs[_0x5d4b('0x56')](_0x451816);}});}else{return _0x2c15a8[_0x5d4b('0x49')](_0x451816,function(_0x5de944){if(_0x5636e2){fs[_0x5d4b('0x56')](_0x451816);}});}}})['catch'](function(_0x4b706a){if(_0x4b706a['message']===_0x5d4b('0x53')){_0x2c15a8[_0x5d4b('0x18')](0x194)[_0x5d4b('0x25')](_0x5d4b('0x57'));}else{return handleError(_0x2c15a8,null);}});};exports[_0x5d4b('0x58')]=function(_0x2847e3,_0x45c7c5){return db[_0x5d4b('0x27')]['find']({'where':{'id':_0x2847e3[_0x5d4b('0x48')]['id']}})[_0x5d4b('0x21')](function(_0x4c2161){if(_[_0x5d4b('0x59')](_0x4c2161)){throw new ReferenceError(_0x5d4b('0x5a'));}return _0x4c2161;})[_0x5d4b('0x21')](function(_0x4b3854){var _0x1b99de=_0x4b3854['savePath'];logger['info'](_0x5d4b('0x5b'),_0x1b99de);if(!_['isNil'](_0x4b3854['savePath'])&&fs[_0x5d4b('0x50')](_0x1b99de)){logger[_0x5d4b('0x5c')](_0x5d4b('0x5d')+_0x1b99de+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x5d4b('0x5e')](_0x1b99de);}_0x1b99de=_0x1b99de+_0x5d4b('0x5f');if(!_[_0x5d4b('0x59')](_0x4b3854['savePath'])&&fs['existsSync'](_0x1b99de)){logger[_0x5d4b('0x5c')](_0x5d4b('0x5d')+_0x1b99de+_0x5d4b('0x60'));fs[_0x5d4b('0x5e')](_0x1b99de);}return _0x4b3854;})[_0x5d4b('0x21')](function(_0x45ed71){if(!_0x45ed71)throw new InternalError();return _0x45ed71[_0x5d4b('0x58')]();})['then'](function(){_0x45c7c5[_0x5d4b('0x18')](0xcc)[_0x5d4b('0x17')]();})[_0x5d4b('0x44')](handleError(_0x45c7c5,null));}; \ No newline at end of file +var _0xd5a0=['VIRTUAL','options','findAll','rows','catch','show','params','rawAttributes','includeAll','include','find','create','body','download','../../components/encryptor','uniqueid','savePath','filename','format','decryptFile','recording','existsSync','Sequelize','SquareRecording\x20not\x20found','unlink','message','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','apply','reject','save','update','then','destroy','stack','name','send','index','SquareRecording','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type'];(function(_0x242d4f,_0x5f0025){var _0x3f474b=function(_0x1b1e4a){while(--_0x1b1e4a){_0x242d4f['push'](_0x242d4f['shift']());}};_0x3f474b(++_0x5f0025);}(_0xd5a0,0x1f3));var _0x0d5a=function(_0x4c38af,_0x55a605){_0x4c38af=_0x4c38af-0x0;var _0xf94a80=_0xd5a0[_0x4c38af];return _0xf94a80;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0d5a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d5a('0x1'));var BPromise=require(_0x0d5a('0x2'));var Mustache=require(_0x0d5a('0x3'));var util=require('util');var path=require(_0x0d5a('0x4'));var sox=require(_0x0d5a('0x5'));var csv=require(_0x0d5a('0x6'));var ejs=require(_0x0d5a('0x7'));var fs=require('fs');var fs_extra=require(_0x0d5a('0x8'));var _=require(_0x0d5a('0x9'));var squel=require(_0x0d5a('0xa'));var crypto=require(_0x0d5a('0xb'));var jsforce=require(_0x0d5a('0xc'));var deskjs=require(_0x0d5a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0d5a('0xe'));var Papa=require(_0x0d5a('0xf'));var Redis=require(_0x0d5a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0d5a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0d5a('0x12'));var logger=require(_0x0d5a('0x13'))('api');var utils=require(_0x0d5a('0x14'));var config=require(_0x0d5a('0x15'));var licenseUtil=require(_0x0d5a('0x16'));var db=require(_0x0d5a('0x17'))['db'];function respondWithStatusCode(_0x8431fd,_0x25428c){_0x25428c=_0x25428c||0xcc;return function(_0x278fd8){if(_0x278fd8){return _0x8431fd[_0x0d5a('0x18')](_0x25428c);}return _0x8431fd['status'](_0x25428c)[_0x0d5a('0x19')]();};}function respondWithResult(_0x43e1a4,_0x4d28d8){_0x4d28d8=_0x4d28d8||0xc8;return function(_0x22804e){if(_0x22804e){return _0x43e1a4[_0x0d5a('0x1a')](_0x4d28d8)[_0x0d5a('0x1b')](_0x22804e);}};}function respondWithFilteredResult(_0x23646f,_0xf841f8){return function(_0x3dfabe){if(_0x3dfabe){var _0xf37e77=typeof _0xf841f8[_0x0d5a('0x1c')]==='undefined'&&typeof _0xf841f8[_0x0d5a('0x1d')]==='undefined';var _0x59bc1a=_0x3dfabe[_0x0d5a('0x1e')];var _0x595530=_0xf37e77?0x0:_0xf841f8[_0x0d5a('0x1c')];var _0x275942=_0xf37e77?_0x3dfabe[_0x0d5a('0x1e')]:_0xf841f8[_0x0d5a('0x1c')]+_0xf841f8[_0x0d5a('0x1d')];var _0x4d6a3a;if(_0x275942>=_0x59bc1a){_0x275942=_0x59bc1a;_0x4d6a3a=0xc8;}else{_0x4d6a3a=0xce;}_0x23646f[_0x0d5a('0x1a')](_0x4d6a3a);return _0x23646f['set']('Content-Range',_0x595530+'-'+_0x275942+'/'+_0x59bc1a)['json'](_0x3dfabe);}return null;};}function patchUpdates(_0x501ce1){return function(_0x21e057){try{jsonpatch[_0x0d5a('0x1f')](_0x21e057,_0x501ce1,!![]);}catch(_0x595c98){return BPromise[_0x0d5a('0x20')](_0x595c98);}return _0x21e057[_0x0d5a('0x21')]();};}function saveUpdates(_0x12d554,_0x243cbb){return function(_0xad9ac7){if(_0xad9ac7){return _0xad9ac7[_0x0d5a('0x22')](_0x12d554)[_0x0d5a('0x23')](function(_0x5d419d){return _0x5d419d;});}return null;};}function removeEntity(_0x3dcb5b,_0x5d4fd2){return function(_0x33c7b3){if(_0x33c7b3){return _0x33c7b3[_0x0d5a('0x24')]()[_0x0d5a('0x23')](function(){_0x3dcb5b[_0x0d5a('0x1a')](0xcc)[_0x0d5a('0x19')]();});}};}function handleEntityNotFound(_0x18e1e1,_0x157e0a){return function(_0x1c36c4){if(!_0x1c36c4){_0x18e1e1[_0x0d5a('0x18')](0x194);}return _0x1c36c4;};}function handleError(_0x31b0a6,_0x58e1c2){_0x58e1c2=_0x58e1c2||0x1f4;return function(_0x19242c){logger['error'](_0x19242c[_0x0d5a('0x25')]);if(_0x19242c['name']){delete _0x19242c[_0x0d5a('0x26')];}_0x31b0a6[_0x0d5a('0x1a')](_0x58e1c2)[_0x0d5a('0x27')](_0x19242c);};}exports[_0x0d5a('0x28')]=function(_0x5eb74f,_0x49050f){var _0x4b98d9={},_0x1df912={},_0x5d24a1={'count':0x0,'rows':[]};var _0x5eaaf7=_['map'](db[_0x0d5a('0x29')]['rawAttributes'],function(_0x49ef20){return{'name':_0x49ef20[_0x0d5a('0x2a')],'type':_0x49ef20['type']['key']};});_0x1df912[_0x0d5a('0x2b')]=_['map'](_0x5eaaf7,_0x0d5a('0x26'));_0x1df912[_0x0d5a('0x2c')]=_[_0x0d5a('0x2d')](_0x5eb74f[_0x0d5a('0x2c')]);_0x1df912[_0x0d5a('0x2e')]=_[_0x0d5a('0x2f')](_0x1df912[_0x0d5a('0x2b')],_0x1df912['query']);_0x4b98d9[_0x0d5a('0x30')]=_[_0x0d5a('0x2f')](_0x1df912[_0x0d5a('0x2b')],qs[_0x0d5a('0x31')](_0x5eb74f[_0x0d5a('0x2c')][_0x0d5a('0x31')]));_0x4b98d9[_0x0d5a('0x30')]=_0x4b98d9['attributes'][_0x0d5a('0x32')]?_0x4b98d9[_0x0d5a('0x30')]:_0x1df912['model'];if(!_0x5eb74f['query'][_0x0d5a('0x33')](_0x0d5a('0x34'))){_0x4b98d9[_0x0d5a('0x1d')]=qs[_0x0d5a('0x1d')](_0x5eb74f['query'][_0x0d5a('0x1d')]);_0x4b98d9[_0x0d5a('0x1c')]=qs['offset'](_0x5eb74f[_0x0d5a('0x2c')][_0x0d5a('0x1c')]);}_0x4b98d9[_0x0d5a('0x35')]=qs['sort'](_0x5eb74f[_0x0d5a('0x2c')][_0x0d5a('0x36')]);_0x4b98d9[_0x0d5a('0x37')]=qs['filters'](_[_0x0d5a('0x38')](_0x5eb74f[_0x0d5a('0x2c')],_0x1df912[_0x0d5a('0x2e')]),_0x5eaaf7);if(_0x5eb74f[_0x0d5a('0x2c')]['filter']){_0x4b98d9[_0x0d5a('0x37')]=_[_0x0d5a('0x39')](_0x4b98d9['where'],{'$or':_['map'](_0x5eaaf7,function(_0x2e960e){if(_0x2e960e[_0x0d5a('0x3a')]!==_0x0d5a('0x3b')){var _0x15a80d={};_0x15a80d[_0x2e960e[_0x0d5a('0x26')]]={'$like':'%'+_0x5eb74f[_0x0d5a('0x2c')]['filter']+'%'};return _0x15a80d;}})});}_0x4b98d9=_[_0x0d5a('0x39')]({},_0x4b98d9,_0x5eb74f[_0x0d5a('0x3c')]);var _0x314506={'where':_0x4b98d9[_0x0d5a('0x37')]};return db[_0x0d5a('0x29')]['count'](_0x314506)[_0x0d5a('0x23')](function(_0x49d534){_0x5d24a1[_0x0d5a('0x1e')]=_0x49d534;if(_0x5eb74f[_0x0d5a('0x2c')]['includeAll']){_0x4b98d9['include']=[{'all':!![]}];}return db[_0x0d5a('0x29')][_0x0d5a('0x3d')](_0x4b98d9);})['then'](function(_0x408296){_0x5d24a1[_0x0d5a('0x3e')]=_0x408296;return _0x5d24a1;})[_0x0d5a('0x23')](respondWithFilteredResult(_0x49050f,_0x4b98d9))[_0x0d5a('0x3f')](handleError(_0x49050f,null));};exports[_0x0d5a('0x40')]=function(_0x258a25,_0x2d79e5){var _0x1012e9={'raw':!![],'where':{'id':_0x258a25[_0x0d5a('0x41')]['id']}},_0x291f39={};_0x291f39['model']=_[_0x0d5a('0x2d')](db[_0x0d5a('0x29')][_0x0d5a('0x42')]);_0x291f39[_0x0d5a('0x2c')]=_[_0x0d5a('0x2d')](_0x258a25[_0x0d5a('0x2c')]);_0x291f39['filters']=_[_0x0d5a('0x2f')](_0x291f39[_0x0d5a('0x2b')],_0x291f39[_0x0d5a('0x2c')]);_0x1012e9[_0x0d5a('0x30')]=_[_0x0d5a('0x2f')](_0x291f39[_0x0d5a('0x2b')],qs[_0x0d5a('0x31')](_0x258a25[_0x0d5a('0x2c')][_0x0d5a('0x31')]));_0x1012e9[_0x0d5a('0x30')]=_0x1012e9[_0x0d5a('0x30')][_0x0d5a('0x32')]?_0x1012e9[_0x0d5a('0x30')]:_0x291f39[_0x0d5a('0x2b')];if(_0x258a25[_0x0d5a('0x2c')][_0x0d5a('0x43')]){_0x1012e9[_0x0d5a('0x44')]=[{'all':!![]}];}_0x1012e9=_[_0x0d5a('0x39')]({},_0x1012e9,_0x258a25[_0x0d5a('0x3c')]);return db[_0x0d5a('0x29')][_0x0d5a('0x45')](_0x1012e9)[_0x0d5a('0x23')](handleEntityNotFound(_0x2d79e5,null))['then'](respondWithResult(_0x2d79e5,null))[_0x0d5a('0x3f')](handleError(_0x2d79e5,null));};exports[_0x0d5a('0x46')]=function(_0x4f4533,_0x4c0756){return db[_0x0d5a('0x29')]['create'](_0x4f4533[_0x0d5a('0x47')],{})[_0x0d5a('0x23')](respondWithResult(_0x4c0756,0xc9))[_0x0d5a('0x3f')](handleError(_0x4c0756,null));};exports[_0x0d5a('0x22')]=function(_0x3cc6d6,_0x46eac){if(_0x3cc6d6[_0x0d5a('0x47')]['id']){delete _0x3cc6d6[_0x0d5a('0x47')]['id'];}return db[_0x0d5a('0x29')][_0x0d5a('0x45')]({'where':{'id':_0x3cc6d6[_0x0d5a('0x41')]['id']}})[_0x0d5a('0x23')](handleEntityNotFound(_0x46eac,null))[_0x0d5a('0x23')](saveUpdates(_0x3cc6d6[_0x0d5a('0x47')],null))[_0x0d5a('0x23')](respondWithResult(_0x46eac,null))['catch'](handleError(_0x46eac,null));};exports[_0x0d5a('0x48')]=function(_0x185e21,_0x1dbc7c,_0x5739a0){var _0x16292e=require(_0x0d5a('0x49'));var _0x3beb63=![];var _0x5ba497={};if(_0x185e21['query'][_0x0d5a('0x3a')]&&_0x185e21[_0x0d5a('0x2c')]['type']===_0x0d5a('0x4a')){_0x5ba497[_0x0d5a('0x4a')]=_0x185e21[_0x0d5a('0x41')]['id'];}else{_0x5ba497['id']=_0x185e21[_0x0d5a('0x41')]['id'];}return db[_0x0d5a('0x29')][_0x0d5a('0x45')]({'where':_0x5ba497,'attributes':['id',_0x0d5a('0x4b'),_0x0d5a('0x4c')],'raw':!![]})[_0x0d5a('0x23')](handleEntityNotFound(_0x1dbc7c,null))['then'](function(_0x2613a7){if(_0x2613a7){var _0x465e08=_0x2613a7[_0x0d5a('0x4b')];var _0xe2d614=util[_0x0d5a('0x4d')]('%s.cypher',_0x465e08);if(fs['existsSync'](_0xe2d614)){_0x3beb63=!![];return _0x16292e[_0x0d5a('0x4e')](_0xe2d614,_0x465e08,config['secrets'][_0x0d5a('0x4f')])['then'](function(){return _0x2613a7;});}return _0x2613a7;}})[_0x0d5a('0x23')](function(_0x38f9b3){if(_0x38f9b3){var _0x25e6e5=_0x38f9b3['savePath'];if(!fs[_0x0d5a('0x50')](_0x25e6e5)){throw new db[(_0x0d5a('0x51'))]['ValidationError'](_0x0d5a('0x52'));}if(_0x38f9b3[_0x0d5a('0x4c')]){return _0x1dbc7c[_0x0d5a('0x48')](_0x25e6e5,_0x38f9b3[_0x0d5a('0x4c')]+path['extname'](_0x25e6e5),function(){if(_0x3beb63){fs[_0x0d5a('0x53')](_0x25e6e5);}});}else{return _0x1dbc7c[_0x0d5a('0x48')](_0x25e6e5,function(_0x51f025){if(_0x3beb63){fs['unlink'](_0x25e6e5);}});}}})['catch'](function(_0x3a81ff){if(_0x3a81ff[_0x0d5a('0x54')]===_0x0d5a('0x52')){_0x1dbc7c[_0x0d5a('0x1a')](0x194)['send']('Not\x20found');}else{return handleError(_0x1dbc7c,null);}});};exports[_0x0d5a('0x24')]=function(_0x204816,_0x1c4680){return db[_0x0d5a('0x29')][_0x0d5a('0x45')]({'where':{'id':_0x204816[_0x0d5a('0x41')]['id']}})[_0x0d5a('0x23')](function(_0x26515c){if(_[_0x0d5a('0x55')](_0x26515c)){throw new ReferenceError(_0x0d5a('0x56'));}return _0x26515c;})[_0x0d5a('0x23')](function(_0x1a9b99){var _0x223dd4=_0x1a9b99['savePath'];logger[_0x0d5a('0x57')](_0x0d5a('0x58'),_0x223dd4);if(!_[_0x0d5a('0x55')](_0x1a9b99['savePath'])&&fs[_0x0d5a('0x50')](_0x223dd4)){logger['info']('File:\x20\x22'+_0x223dd4+_0x0d5a('0x59'));fs[_0x0d5a('0x5a')](_0x223dd4);}_0x223dd4=_0x223dd4+_0x0d5a('0x5b');if(!_[_0x0d5a('0x55')](_0x1a9b99['savePath'])&&fs['existsSync'](_0x223dd4)){logger[_0x0d5a('0x57')](_0x0d5a('0x5c')+_0x223dd4+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x223dd4);}return _0x1a9b99;})['then'](function(_0x3f5229){if(!_0x3f5229)throw new InternalError();return _0x3f5229[_0x0d5a('0x24')]();})[_0x0d5a('0x23')](function(){_0x1c4680[_0x0d5a('0x1a')](0xcc)[_0x0d5a('0x19')]();})[_0x0d5a('0x3f')](handleError(_0x1c4680,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 177e1f8..067d841 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 _0xdeb3=['./squareRecording.attributes','define','square_recordings','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x192b1e,_0x578930){var _0x5db684=function(_0x3d89d6){while(--_0x3d89d6){_0x192b1e['push'](_0x192b1e['shift']());}};_0x5db684(++_0x578930);}(_0xdeb3,0xb7));var _0x3deb=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xdeb3[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0x3deb('0x0'));var logger=require(_0x3deb('0x1'))(_0x3deb('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3deb('0x3'));var fs=require('fs');var path=require(_0x3deb('0x4'));var rimraf=require(_0x3deb('0x5'));var config=require(_0x3deb('0x6'));var attributes=require(_0x3deb('0x7'));module['exports']=function(_0x193700,_0x47d2d4){return _0x193700[_0x3deb('0x8')]('SquareRecording',attributes,{'tableName':_0x3deb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x57ca=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./squareRecording.attributes','exports','define','SquareRecording','square_recordings'];(function(_0x26cbe9,_0x54b7ae){var _0x464322=function(_0x56278d){while(--_0x56278d){_0x26cbe9['push'](_0x26cbe9['shift']());}};_0x464322(++_0x54b7ae);}(_0x57ca,0x108));var _0xa57c=function(_0x5dd8dc,_0x4b0cdc){_0x5dd8dc=_0x5dd8dc-0x0;var _0x123ddc=_0x57ca[_0x5dd8dc];return _0x123ddc;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var logger=require(_0xa57c('0x1'))('api');var moment=require(_0xa57c('0x2'));var BPromise=require(_0xa57c('0x3'));var rp=require(_0xa57c('0x4'));var fs=require('fs');var path=require(_0xa57c('0x5'));var rimraf=require(_0xa57c('0x6'));var config=require('../../config/environment');var attributes=require(_0xa57c('0x7'));module[_0xa57c('0x8')]=function(_0x113dcf,_0x19473f){return _0x113dcf[_0xa57c('0x9')](_0xa57c('0xa'),attributes,{'tableName':_0xa57c('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 316f599..b953942 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 _0x675c=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SquareRecording','create','body','options','then','CreateSquareRecording','util','moment','bluebird'];(function(_0xbe079e,_0x19008d){var _0x5c2ebc=function(_0xbafd78){while(--_0xbafd78){_0xbe079e['push'](_0xbe079e['shift']());}};_0x5c2ebc(++_0x19008d);}(_0x675c,0x126));var _0xc675=function(_0x2f8e55,_0x4ff987){_0x2f8e55=_0x2f8e55-0x0;var _0x34746e=_0x675c[_0x2f8e55];return _0x34746e;};'use strict';var _=require('lodash');var util=require(_0xc675('0x0'));var moment=require(_0xc675('0x1'));var BPromise=require(_0xc675('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc675('0x3'));var db=require(_0xc675('0x4'))['db'];var utils=require(_0xc675('0x5'));var logger=require(_0xc675('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc675('0x7'));var client=jayson[_0xc675('0x8')][_0xc675('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x54cc67,_0x3136f0,_0x1dc60f){return new BPromise(function(_0x2e6cf4,_0xfb9fae){return client[_0xc675('0xa')](_0x54cc67,_0x1dc60f)['then'](function(_0x44b91a){logger[_0xc675('0xb')](_0xc675('0xc'),_0x3136f0,_0xc675('0xd'));logger[_0xc675('0xe')](_0xc675('0xf'),_0x3136f0,_0xc675('0xd'),JSON[_0xc675('0x10')](_0x44b91a));if(_0x44b91a['error']){if(_0x44b91a[_0xc675('0x11')]['code']===0x1f4){logger[_0xc675('0x11')](_0xc675('0xc'),_0x3136f0,_0x44b91a['error']['message']);return _0xfb9fae(_0x44b91a[_0xc675('0x11')][_0xc675('0x12')]);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x3136f0,_0x44b91a[_0xc675('0x11')]['message']);return _0x2e6cf4(_0x44b91a[_0xc675('0x11')][_0xc675('0x12')]);}else{logger[_0xc675('0xb')](_0xc675('0xc'),_0x3136f0,_0xc675('0xd'));_0x2e6cf4(_0x44b91a[_0xc675('0x13')]['message']);}})[_0xc675('0x14')](function(_0x543771){logger[_0xc675('0x11')](_0xc675('0xc'),_0x3136f0,_0x543771);_0xfb9fae(_0x543771);});});}exports['CreateSquareRecording']=function(_0x87f340){var _0x24d516=this;return new Promise(function(_0x100618,_0x516b44){return db[_0xc675('0x15')][_0xc675('0x16')](_0x87f340[_0xc675('0x17')],{'raw':_0x87f340['options']?_0x87f340[_0xc675('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xc675('0x19')](function(_0x1ba667){logger[_0xc675('0xb')](_0xc675('0x1a'),_0x87f340);logger[_0xc675('0xe')](_0xc675('0x1a'),_0x87f340,JSON[_0xc675('0x10')](_0x1ba667));_0x100618(_0x1ba667);})[_0xc675('0x14')](function(_0x351d01){logger[_0xc675('0x11')](_0xc675('0x1a'),_0x351d01[_0xc675('0x12')],_0x87f340);_0x516b44(_0x24d516[_0xc675('0x11')](0x1f4,_0x351d01['message']));});});}; \ No newline at end of file +var _0x8825=['create','body','options','raw','then','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareRecording'];(function(_0x1cd43b,_0x553cc7){var _0x1b6231=function(_0x2bbe15){while(--_0x2bbe15){_0x1cd43b['push'](_0x1cd43b['shift']());}};_0x1b6231(++_0x553cc7);}(_0x8825,0x1d9));var _0x5882=function(_0x3d75f2,_0x3e4377){_0x3d75f2=_0x3d75f2-0x0;var _0x129ffb=_0x8825[_0x3d75f2];return _0x129ffb;};'use strict';var _=require(_0x5882('0x0'));var util=require(_0x5882('0x1'));var moment=require('moment');var BPromise=require(_0x5882('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5882('0x3'));var logger=require(_0x5882('0x4'))(_0x5882('0x5'));var config=require(_0x5882('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5882('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x334ed2,_0x2ca29e,_0x46260e){return new BPromise(function(_0x3c301d,_0xc7fbe9){return client[_0x5882('0x8')](_0x334ed2,_0x46260e)['then'](function(_0x1a4938){logger['info'](_0x5882('0x9'),_0x2ca29e,_0x5882('0xa'));logger[_0x5882('0xb')](_0x5882('0xc'),_0x2ca29e,_0x5882('0xa'),JSON[_0x5882('0xd')](_0x1a4938));if(_0x1a4938[_0x5882('0xe')]){if(_0x1a4938[_0x5882('0xe')][_0x5882('0xf')]===0x1f4){logger['error'](_0x5882('0x9'),_0x2ca29e,_0x1a4938['error'][_0x5882('0x10')]);return _0xc7fbe9(_0x1a4938[_0x5882('0xe')][_0x5882('0x10')]);}logger[_0x5882('0xe')](_0x5882('0x9'),_0x2ca29e,_0x1a4938['error'][_0x5882('0x10')]);return _0x3c301d(_0x1a4938[_0x5882('0xe')]['message']);}else{logger[_0x5882('0x11')](_0x5882('0x9'),_0x2ca29e,_0x5882('0xa'));_0x3c301d(_0x1a4938[_0x5882('0x12')]['message']);}})[_0x5882('0x13')](function(_0x2388dc){logger[_0x5882('0xe')](_0x5882('0x9'),_0x2ca29e,_0x2388dc);_0xc7fbe9(_0x2388dc);});});}exports[_0x5882('0x14')]=function(_0x409891){var _0x38dd9f=this;return new Promise(function(_0x111d88,_0x328491){return db['SquareRecording'][_0x5882('0x15')](_0x409891[_0x5882('0x16')],{'raw':_0x409891['options']?_0x409891[_0x5882('0x17')][_0x5882('0x18')]===undefined?!![]:![]:!![]})[_0x5882('0x19')](function(_0x4e9c42){logger['info']('CreateSquareRecording',_0x409891);logger[_0x5882('0xb')](_0x5882('0x14'),_0x409891,JSON[_0x5882('0xd')](_0x4e9c42));_0x111d88(_0x4e9c42);})[_0x5882('0x13')](function(_0x2b077b){logger['error'](_0x5882('0x14'),_0x2b077b['message'],_0x409891);_0x328491(_0x38dd9f[_0x5882('0xe')](0x1f4,_0x2b077b[_0x5882('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index d4173cc..e545be7 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(_0x2bd603,_0x247e31){var _0x3fb3e5=function(_0x3f6ab1){while(--_0x3f6ab1){_0x2bd603['push'](_0x2bd603['shift']());}};_0x3fb3e5(++_0x247e31);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 3ffdb56..ef9457c 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 _0x1e66=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x2f9427,_0x225d50){var _0x3bada7=function(_0x5bf32f){while(--_0x5bf32f){_0x2f9427['push'](_0x2f9427['shift']());}};_0x3bada7(++_0x225d50);}(_0x1e66,0x165));var _0x61e6=function(_0x589aee,_0x140a03){_0x589aee=_0x589aee-0x0;var _0x2f5ed4=_0x1e66[_0x589aee];return _0x2f5ed4;};'use strict';var Sequelize=require(_0x61e6('0x0'));module[_0x61e6('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x61e6('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x61e6('0x2')]},'language':{'type':Sequelize[_0x61e6('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x61e6('0x2')]},'version':{'type':Sequelize[_0x61e6('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x61e6('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x61e6('0x2')]},'callington':{'type':Sequelize[_0x61e6('0x2')]},'callingtns':{'type':Sequelize[_0x61e6('0x2')]},'dnid':{'type':Sequelize[_0x61e6('0x2')]},'rdnis':{'type':Sequelize[_0x61e6('0x2')]},'context':{'type':Sequelize[_0x61e6('0x2')]},'extension':{'type':Sequelize[_0x61e6('0x2')]},'priority':{'type':Sequelize[_0x61e6('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x61e6('0x2')]},'project_name':{'type':Sequelize[_0x61e6('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x61e6('0x3')]},'bot':{'type':Sequelize[_0x61e6('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xee64=['STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x18b275,_0x2ee9a9){var _0x4ff78d=function(_0x2a7c73){while(--_0x2a7c73){_0x18b275['push'](_0x18b275['shift']());}};_0x4ff78d(++_0x2ee9a9);}(_0xee64,0x1ca));var _0x4ee6=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xee64[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x4ee6('0x0'));module[_0x4ee6('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x4ee6('0x2')]},'request':{'type':Sequelize[_0x4ee6('0x2')]},'channel':{'type':Sequelize[_0x4ee6('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4ee6('0x2')]},'version':{'type':Sequelize[_0x4ee6('0x2')]},'callerid':{'type':Sequelize[_0x4ee6('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x4ee6('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x4ee6('0x2')]},'callingtns':{'type':Sequelize[_0x4ee6('0x2')]},'dnid':{'type':Sequelize[_0x4ee6('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x4ee6('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4ee6('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x4ee6('0x2')]},'joinAt':{'type':Sequelize[_0x4ee6('0x3')]},'leaveAt':{'type':Sequelize[_0x4ee6('0x3')]},'bot':{'type':Sequelize[_0x4ee6('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index c322013..5953205 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 _0x0c61=['../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','save','then','destroy','error','stack','name','send','index','map','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','SquareReport','includeAll','include','findAll','rows','show','params','find','catch','create','body','update','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x2e2cca,_0x4dd45e){var _0x6d91bc=function(_0x195200){while(--_0x195200){_0x2e2cca['push'](_0x2e2cca['shift']());}};_0x6d91bc(++_0x4dd45e);}(_0x0c61,0x80));var _0x10c6=function(_0x547add,_0x387042){_0x547add=_0x547add-0x0;var _0x2ed1f3=_0x0c61[_0x547add];return _0x2ed1f3;};'use strict';var emlformat=require(_0x10c6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x10c6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x10c6('0x2'));var moment=require(_0x10c6('0x3'));var BPromise=require(_0x10c6('0x4'));var Mustache=require(_0x10c6('0x5'));var util=require(_0x10c6('0x6'));var path=require(_0x10c6('0x7'));var sox=require(_0x10c6('0x8'));var csv=require(_0x10c6('0x9'));var ejs=require(_0x10c6('0xa'));var fs=require('fs');var fs_extra=require(_0x10c6('0xb'));var _=require('lodash');var squel=require(_0x10c6('0xc'));var crypto=require(_0x10c6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x10c6('0xe'));var toCsv=require(_0x10c6('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x10c6('0xf'));var authService=require(_0x10c6('0x10'));var qs=require(_0x10c6('0x11'));var as=require(_0x10c6('0x12'));var hardwareService=require(_0x10c6('0x13'));var logger=require(_0x10c6('0x14'))(_0x10c6('0x15'));var utils=require(_0x10c6('0x16'));var config=require(_0x10c6('0x17'));var licenseUtil=require(_0x10c6('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x313f9a,_0x56e851){_0x56e851=_0x56e851||0xcc;return function(_0x6e81){if(_0x6e81){return _0x313f9a[_0x10c6('0x19')](_0x56e851);}return _0x313f9a['status'](_0x56e851)[_0x10c6('0x1a')]();};}function respondWithResult(_0x7d3197,_0x27101e){_0x27101e=_0x27101e||0xc8;return function(_0x376fe7){if(_0x376fe7){return _0x7d3197[_0x10c6('0x1b')](_0x27101e)[_0x10c6('0x1c')](_0x376fe7);}};}function respondWithFilteredResult(_0x31938a,_0x1389bd){return function(_0x3bf839){if(_0x3bf839){var _0x131b3e=typeof _0x1389bd[_0x10c6('0x1d')]===_0x10c6('0x1e')&&typeof _0x1389bd[_0x10c6('0x1f')]===_0x10c6('0x1e');var _0x2e8d4e=_0x3bf839[_0x10c6('0x20')];var _0x3d5f73=_0x131b3e?0x0:_0x1389bd[_0x10c6('0x1d')];var _0x3efa8f=_0x131b3e?_0x3bf839[_0x10c6('0x20')]:_0x1389bd[_0x10c6('0x1d')]+_0x1389bd['limit'];var _0x2df9d7;if(_0x3efa8f>=_0x2e8d4e){_0x3efa8f=_0x2e8d4e;_0x2df9d7=0xc8;}else{_0x2df9d7=0xce;}_0x31938a[_0x10c6('0x1b')](_0x2df9d7);return _0x31938a[_0x10c6('0x21')]('Content-Range',_0x3d5f73+'-'+_0x3efa8f+'/'+_0x2e8d4e)['json'](_0x3bf839);}return null;};}function patchUpdates(_0x17fe1f){return function(_0x4a3618){try{jsonpatch[_0x10c6('0x22')](_0x4a3618,_0x17fe1f,!![]);}catch(_0x3c9de0){return BPromise['reject'](_0x3c9de0);}return _0x4a3618[_0x10c6('0x23')]();};}function saveUpdates(_0x193ac0,_0x233ef7){return function(_0x5705fb){if(_0x5705fb){return _0x5705fb['update'](_0x193ac0)[_0x10c6('0x24')](function(_0x513857){return _0x513857;});}return null;};}function removeEntity(_0x344e13,_0x21cc2e){return function(_0x53c9ae){if(_0x53c9ae){return _0x53c9ae[_0x10c6('0x25')]()[_0x10c6('0x24')](function(){_0x344e13[_0x10c6('0x1b')](0xcc)[_0x10c6('0x1a')]();});}};}function handleEntityNotFound(_0x136b60,_0x7dca6){return function(_0x2485ae){if(!_0x2485ae){_0x136b60[_0x10c6('0x19')](0x194);}return _0x2485ae;};}function handleError(_0x55d6fc,_0x3cc7d2){_0x3cc7d2=_0x3cc7d2||0x1f4;return function(_0x3332d6){logger[_0x10c6('0x26')](_0x3332d6[_0x10c6('0x27')]);if(_0x3332d6[_0x10c6('0x28')]){delete _0x3332d6['name'];}_0x55d6fc[_0x10c6('0x1b')](_0x3cc7d2)[_0x10c6('0x29')](_0x3332d6);};}exports[_0x10c6('0x2a')]=function(_0x3c8c9a,_0x4f2100){var _0x2661d3={},_0x886399={},_0x27db91={'count':0x0,'rows':[]};var _0x2168a7=_[_0x10c6('0x2b')](db['SquareReport']['rawAttributes'],function(_0x134674){return{'name':_0x134674[_0x10c6('0x2c')],'type':_0x134674[_0x10c6('0x2d')]['key']};});_0x886399[_0x10c6('0x2e')]=_[_0x10c6('0x2b')](_0x2168a7,_0x10c6('0x28'));_0x886399[_0x10c6('0x2f')]=_[_0x10c6('0x30')](_0x3c8c9a[_0x10c6('0x2f')]);_0x886399['filters']=_[_0x10c6('0x31')](_0x886399[_0x10c6('0x2e')],_0x886399[_0x10c6('0x2f')]);_0x2661d3[_0x10c6('0x32')]=_['intersection'](_0x886399[_0x10c6('0x2e')],qs[_0x10c6('0x33')](_0x3c8c9a[_0x10c6('0x2f')][_0x10c6('0x33')]));_0x2661d3[_0x10c6('0x32')]=_0x2661d3[_0x10c6('0x32')][_0x10c6('0x34')]?_0x2661d3['attributes']:_0x886399[_0x10c6('0x2e')];if(!_0x3c8c9a[_0x10c6('0x2f')][_0x10c6('0x35')](_0x10c6('0x36'))){_0x2661d3[_0x10c6('0x1f')]=qs[_0x10c6('0x1f')](_0x3c8c9a[_0x10c6('0x2f')][_0x10c6('0x1f')]);_0x2661d3['offset']=qs[_0x10c6('0x1d')](_0x3c8c9a[_0x10c6('0x2f')][_0x10c6('0x1d')]);}_0x2661d3[_0x10c6('0x37')]=qs[_0x10c6('0x38')](_0x3c8c9a[_0x10c6('0x2f')][_0x10c6('0x38')]);_0x2661d3[_0x10c6('0x39')]=qs[_0x10c6('0x3a')](_[_0x10c6('0x3b')](_0x3c8c9a[_0x10c6('0x2f')],_0x886399['filters']),_0x2168a7);if(_0x3c8c9a[_0x10c6('0x2f')]['filter']){_0x2661d3['where']=_[_0x10c6('0x3c')](_0x2661d3['where'],{'$or':_[_0x10c6('0x2b')](_0x2168a7,function(_0x8fe2fd){if(_0x8fe2fd['type']!=='VIRTUAL'){var _0x324d6c={};_0x324d6c[_0x8fe2fd['name']]={'$like':'%'+_0x3c8c9a['query'][_0x10c6('0x3d')]+'%'};return _0x324d6c;}})});}_0x2661d3=_[_0x10c6('0x3c')]({},_0x2661d3,_0x3c8c9a[_0x10c6('0x3e')]);var _0x376552={'where':_0x2661d3[_0x10c6('0x39')]};return db[_0x10c6('0x3f')][_0x10c6('0x20')](_0x376552)[_0x10c6('0x24')](function(_0xa3999){_0x27db91[_0x10c6('0x20')]=_0xa3999;if(_0x3c8c9a[_0x10c6('0x2f')][_0x10c6('0x40')]){_0x2661d3[_0x10c6('0x41')]=[{'all':!![]}];}return db[_0x10c6('0x3f')][_0x10c6('0x42')](_0x2661d3);})[_0x10c6('0x24')](function(_0x8e65e2){_0x27db91[_0x10c6('0x43')]=_0x8e65e2;return _0x27db91;})['then'](respondWithFilteredResult(_0x4f2100,_0x2661d3))['catch'](handleError(_0x4f2100,null));};exports[_0x10c6('0x44')]=function(_0x1fc668,_0x3df9e0){var _0xbeaa24={'raw':!![],'where':{'id':_0x1fc668[_0x10c6('0x45')]['id']}},_0xc07bee={};_0xc07bee[_0x10c6('0x2e')]=_['keys'](db[_0x10c6('0x3f')]['rawAttributes']);_0xc07bee['query']=_[_0x10c6('0x30')](_0x1fc668[_0x10c6('0x2f')]);_0xc07bee[_0x10c6('0x3a')]=_[_0x10c6('0x31')](_0xc07bee[_0x10c6('0x2e')],_0xc07bee[_0x10c6('0x2f')]);_0xbeaa24['attributes']=_['intersection'](_0xc07bee['model'],qs['fields'](_0x1fc668['query']['fields']));_0xbeaa24['attributes']=_0xbeaa24[_0x10c6('0x32')]['length']?_0xbeaa24[_0x10c6('0x32')]:_0xc07bee['model'];if(_0x1fc668[_0x10c6('0x2f')][_0x10c6('0x40')]){_0xbeaa24[_0x10c6('0x41')]=[{'all':!![]}];}_0xbeaa24=_['merge']({},_0xbeaa24,_0x1fc668[_0x10c6('0x3e')]);return db['SquareReport'][_0x10c6('0x46')](_0xbeaa24)[_0x10c6('0x24')](handleEntityNotFound(_0x3df9e0,null))[_0x10c6('0x24')](respondWithResult(_0x3df9e0,null))[_0x10c6('0x47')](handleError(_0x3df9e0,null));};exports[_0x10c6('0x48')]=function(_0x1b4586,_0x18beaf){return db[_0x10c6('0x3f')][_0x10c6('0x48')](_0x1b4586[_0x10c6('0x49')],{})[_0x10c6('0x24')](respondWithResult(_0x18beaf,0xc9))[_0x10c6('0x47')](handleError(_0x18beaf,null));};exports[_0x10c6('0x4a')]=function(_0x260af0,_0x2d00e6){if(_0x260af0[_0x10c6('0x49')]['id']){delete _0x260af0[_0x10c6('0x49')]['id'];}return db[_0x10c6('0x3f')][_0x10c6('0x46')]({'where':{'id':_0x260af0[_0x10c6('0x45')]['id']}})['then'](handleEntityNotFound(_0x2d00e6,null))[_0x10c6('0x24')](saveUpdates(_0x260af0[_0x10c6('0x49')],null))[_0x10c6('0x24')](respondWithResult(_0x2d00e6,null))[_0x10c6('0x47')](handleError(_0x2d00e6,null));};exports['destroy']=function(_0x56bc04,_0xa95b40){return db['SquareReport'][_0x10c6('0x46')]({'where':{'id':_0x56bc04[_0x10c6('0x45')]['id']}})['then'](handleEntityNotFound(_0xa95b40,null))[_0x10c6('0x24')](removeEntity(_0xa95b40,null))[_0x10c6('0x47')](handleError(_0xa95b40,null));};exports[_0x10c6('0x4b')]=function(_0x2d8a58,_0x1097a0){return db[_0x10c6('0x3f')][_0x10c6('0x4b')]()[_0x10c6('0x24')](respondWithResult(_0x1097a0,null))['catch'](handleError(_0x1097a0,null));}; \ No newline at end of file +var _0x9d89=['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','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','reject','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','options','SquareReport','includeAll','include','findAll','rows','catch','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x3efe9b,_0x5b41a8){var _0x132073=function(_0x34459e){while(--_0x34459e){_0x3efe9b['push'](_0x3efe9b['shift']());}};_0x132073(++_0x5b41a8);}(_0x9d89,0x94));var _0x99d8=function(_0x5e8694,_0x157841){_0x5e8694=_0x5e8694-0x0;var _0x295aaf=_0x9d89[_0x5e8694];return _0x295aaf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x99d8('0x0'));var zipdir=require(_0x99d8('0x1'));var jsonpatch=require(_0x99d8('0x2'));var rp=require(_0x99d8('0x3'));var moment=require(_0x99d8('0x4'));var BPromise=require(_0x99d8('0x5'));var Mustache=require(_0x99d8('0x6'));var util=require(_0x99d8('0x7'));var path=require(_0x99d8('0x8'));var sox=require(_0x99d8('0x9'));var csv=require(_0x99d8('0xa'));var ejs=require(_0x99d8('0xb'));var fs=require('fs');var fs_extra=require(_0x99d8('0xc'));var _=require(_0x99d8('0xd'));var squel=require(_0x99d8('0xe'));var crypto=require(_0x99d8('0xf'));var jsforce=require(_0x99d8('0x10'));var deskjs=require(_0x99d8('0x11'));var toCsv=require(_0x99d8('0xa'));var querystring=require(_0x99d8('0x12'));var Papa=require(_0x99d8('0x13'));var Redis=require(_0x99d8('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x99d8('0x15'));var as=require(_0x99d8('0x16'));var hardwareService=require(_0x99d8('0x17'));var logger=require('../../config/logger')(_0x99d8('0x18'));var utils=require(_0x99d8('0x19'));var config=require(_0x99d8('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x99d8('0x1b'))['db'];function respondWithStatusCode(_0x4879b7,_0x2a0494){_0x2a0494=_0x2a0494||0xcc;return function(_0x266dc7){if(_0x266dc7){return _0x4879b7[_0x99d8('0x1c')](_0x2a0494);}return _0x4879b7[_0x99d8('0x1d')](_0x2a0494)[_0x99d8('0x1e')]();};}function respondWithResult(_0x4e4a65,_0x33e7a7){_0x33e7a7=_0x33e7a7||0xc8;return function(_0x4f7d96){if(_0x4f7d96){return _0x4e4a65[_0x99d8('0x1d')](_0x33e7a7)[_0x99d8('0x1f')](_0x4f7d96);}};}function respondWithFilteredResult(_0x2d2f4c,_0x4dfa53){return function(_0x754570){if(_0x754570){var _0x195e40=typeof _0x4dfa53[_0x99d8('0x20')]===_0x99d8('0x21')&&typeof _0x4dfa53['limit']==='undefined';var _0x1e51cb=_0x754570[_0x99d8('0x22')];var _0x3d961c=_0x195e40?0x0:_0x4dfa53[_0x99d8('0x20')];var _0x4d9dcd=_0x195e40?_0x754570[_0x99d8('0x22')]:_0x4dfa53['offset']+_0x4dfa53['limit'];var _0x21c8ea;if(_0x4d9dcd>=_0x1e51cb){_0x4d9dcd=_0x1e51cb;_0x21c8ea=0xc8;}else{_0x21c8ea=0xce;}_0x2d2f4c[_0x99d8('0x1d')](_0x21c8ea);return _0x2d2f4c[_0x99d8('0x23')]('Content-Range',_0x3d961c+'-'+_0x4d9dcd+'/'+_0x1e51cb)['json'](_0x754570);}return null;};}function patchUpdates(_0x5418df){return function(_0x909e9b){try{jsonpatch['apply'](_0x909e9b,_0x5418df,!![]);}catch(_0x15c6c6){return BPromise[_0x99d8('0x24')](_0x15c6c6);}return _0x909e9b['save']();};}function saveUpdates(_0x5e1c24,_0x56dab8){return function(_0x45f679){if(_0x45f679){return _0x45f679[_0x99d8('0x25')](_0x5e1c24)[_0x99d8('0x26')](function(_0x297c64){return _0x297c64;});}return null;};}function removeEntity(_0x12dd3d,_0x22adcd){return function(_0x54152e){if(_0x54152e){return _0x54152e[_0x99d8('0x27')]()[_0x99d8('0x26')](function(){_0x12dd3d[_0x99d8('0x1d')](0xcc)[_0x99d8('0x1e')]();});}};}function handleEntityNotFound(_0x4b3289,_0xa5060d){return function(_0x54123f){if(!_0x54123f){_0x4b3289['sendStatus'](0x194);}return _0x54123f;};}function handleError(_0x2c1ebc,_0x18d8cb){_0x18d8cb=_0x18d8cb||0x1f4;return function(_0x4a7364){logger[_0x99d8('0x28')](_0x4a7364[_0x99d8('0x29')]);if(_0x4a7364['name']){delete _0x4a7364[_0x99d8('0x2a')];}_0x2c1ebc[_0x99d8('0x1d')](_0x18d8cb)['send'](_0x4a7364);};}exports[_0x99d8('0x2b')]=function(_0x597f21,_0x475b1e){var _0x3c4494={},_0x3f834a={},_0x7ae12c={'count':0x0,'rows':[]};var _0x4bab1a=_[_0x99d8('0x2c')](db['SquareReport'][_0x99d8('0x2d')],function(_0x351f3a){return{'name':_0x351f3a[_0x99d8('0x2e')],'type':_0x351f3a[_0x99d8('0x2f')][_0x99d8('0x30')]};});_0x3f834a['model']=_['map'](_0x4bab1a,'name');_0x3f834a[_0x99d8('0x31')]=_[_0x99d8('0x32')](_0x597f21['query']);_0x3f834a[_0x99d8('0x33')]=_[_0x99d8('0x34')](_0x3f834a['model'],_0x3f834a['query']);_0x3c4494['attributes']=_['intersection'](_0x3f834a[_0x99d8('0x35')],qs['fields'](_0x597f21['query'][_0x99d8('0x36')]));_0x3c4494[_0x99d8('0x37')]=_0x3c4494[_0x99d8('0x37')][_0x99d8('0x38')]?_0x3c4494[_0x99d8('0x37')]:_0x3f834a[_0x99d8('0x35')];if(!_0x597f21[_0x99d8('0x31')][_0x99d8('0x39')]('nolimit')){_0x3c4494[_0x99d8('0x3a')]=qs['limit'](_0x597f21['query'][_0x99d8('0x3a')]);_0x3c4494['offset']=qs[_0x99d8('0x20')](_0x597f21['query'][_0x99d8('0x20')]);}_0x3c4494[_0x99d8('0x3b')]=qs[_0x99d8('0x3c')](_0x597f21[_0x99d8('0x31')][_0x99d8('0x3c')]);_0x3c4494[_0x99d8('0x3d')]=qs[_0x99d8('0x33')](_[_0x99d8('0x3e')](_0x597f21['query'],_0x3f834a[_0x99d8('0x33')]),_0x4bab1a);if(_0x597f21['query'][_0x99d8('0x3f')]){_0x3c4494[_0x99d8('0x3d')]=_[_0x99d8('0x40')](_0x3c4494[_0x99d8('0x3d')],{'$or':_[_0x99d8('0x2c')](_0x4bab1a,function(_0x4906bb){if(_0x4906bb[_0x99d8('0x2f')]!=='VIRTUAL'){var _0x3c7003={};_0x3c7003[_0x4906bb[_0x99d8('0x2a')]]={'$like':'%'+_0x597f21['query'][_0x99d8('0x3f')]+'%'};return _0x3c7003;}})});}_0x3c4494=_[_0x99d8('0x40')]({},_0x3c4494,_0x597f21[_0x99d8('0x41')]);var _0x313caf={'where':_0x3c4494[_0x99d8('0x3d')]};return db[_0x99d8('0x42')]['count'](_0x313caf)[_0x99d8('0x26')](function(_0x4cb574){_0x7ae12c[_0x99d8('0x22')]=_0x4cb574;if(_0x597f21[_0x99d8('0x31')][_0x99d8('0x43')]){_0x3c4494[_0x99d8('0x44')]=[{'all':!![]}];}return db[_0x99d8('0x42')][_0x99d8('0x45')](_0x3c4494);})['then'](function(_0x29028f){_0x7ae12c[_0x99d8('0x46')]=_0x29028f;return _0x7ae12c;})[_0x99d8('0x26')](respondWithFilteredResult(_0x475b1e,_0x3c4494))[_0x99d8('0x47')](handleError(_0x475b1e,null));};exports['show']=function(_0x26380a,_0x15b9e7){var _0x50f362={'raw':!![],'where':{'id':_0x26380a[_0x99d8('0x48')]['id']}},_0x102307={};_0x102307[_0x99d8('0x35')]=_['keys'](db[_0x99d8('0x42')][_0x99d8('0x2d')]);_0x102307[_0x99d8('0x31')]=_[_0x99d8('0x32')](_0x26380a[_0x99d8('0x31')]);_0x102307[_0x99d8('0x33')]=_[_0x99d8('0x34')](_0x102307['model'],_0x102307[_0x99d8('0x31')]);_0x50f362[_0x99d8('0x37')]=_[_0x99d8('0x34')](_0x102307[_0x99d8('0x35')],qs[_0x99d8('0x36')](_0x26380a[_0x99d8('0x31')][_0x99d8('0x36')]));_0x50f362[_0x99d8('0x37')]=_0x50f362['attributes'][_0x99d8('0x38')]?_0x50f362[_0x99d8('0x37')]:_0x102307['model'];if(_0x26380a[_0x99d8('0x31')][_0x99d8('0x43')]){_0x50f362[_0x99d8('0x44')]=[{'all':!![]}];}_0x50f362=_[_0x99d8('0x40')]({},_0x50f362,_0x26380a[_0x99d8('0x41')]);return db[_0x99d8('0x42')][_0x99d8('0x49')](_0x50f362)['then'](handleEntityNotFound(_0x15b9e7,null))[_0x99d8('0x26')](respondWithResult(_0x15b9e7,null))[_0x99d8('0x47')](handleError(_0x15b9e7,null));};exports[_0x99d8('0x4a')]=function(_0x8b0d6,_0x62fc3b){return db['SquareReport']['create'](_0x8b0d6['body'],{})[_0x99d8('0x26')](respondWithResult(_0x62fc3b,0xc9))[_0x99d8('0x47')](handleError(_0x62fc3b,null));};exports[_0x99d8('0x25')]=function(_0x4dca52,_0xabca6c){if(_0x4dca52['body']['id']){delete _0x4dca52[_0x99d8('0x4b')]['id'];}return db[_0x99d8('0x42')][_0x99d8('0x49')]({'where':{'id':_0x4dca52[_0x99d8('0x48')]['id']}})[_0x99d8('0x26')](handleEntityNotFound(_0xabca6c,null))['then'](saveUpdates(_0x4dca52[_0x99d8('0x4b')],null))[_0x99d8('0x26')](respondWithResult(_0xabca6c,null))['catch'](handleError(_0xabca6c,null));};exports[_0x99d8('0x27')]=function(_0x1e4ae8,_0x1fceea){return db['SquareReport'][_0x99d8('0x49')]({'where':{'id':_0x1e4ae8[_0x99d8('0x48')]['id']}})['then'](handleEntityNotFound(_0x1fceea,null))[_0x99d8('0x26')](removeEntity(_0x1fceea,null))[_0x99d8('0x47')](handleError(_0x1fceea,null));};exports[_0x99d8('0x4c')]=function(_0x3ac057,_0x2710c2){return db[_0x99d8('0x42')]['describe']()[_0x99d8('0x26')](respondWithResult(_0x2710c2,null))[_0x99d8('0x47')](handleError(_0x2710c2,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 08ee73c..f1a9734 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 _0xbd6a=['rimraf','../../config/environment','./squareReport.attributes','exports','define','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xbd6a,0xea));var _0xabd6=function(_0x3b150c,_0x2f93f8){_0x3b150c=_0x3b150c-0x0;var _0x5cd414=_0xbd6a[_0x3b150c];return _0x5cd414;};'use strict';var _=require(_0xabd6('0x0'));var util=require(_0xabd6('0x1'));var logger=require(_0xabd6('0x2'))(_0xabd6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xabd6('0x4'));var fs=require('fs');var path=require(_0xabd6('0x5'));var rimraf=require(_0xabd6('0x6'));var config=require(_0xabd6('0x7'));var attributes=require(_0xabd6('0x8'));module[_0xabd6('0x9')]=function(_0x1902b4,_0x1ffd0b){return _0x1902b4[_0xabd6('0xa')]('SquareReport',attributes,{'tableName':_0xabd6('0xb'),'paranoid':![],'indexes':[{'name':_0xabd6('0xc'),'fields':[_0xabd6('0xd'),_0xabd6('0xe')]},{'name':_0xabd6('0xf'),'fields':[_0xabd6('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x25d4=['../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x4cdcdc,_0x34eac7){var _0x4704ce=function(_0x1de4ed){while(--_0x1de4ed){_0x4cdcdc['push'](_0x4cdcdc['shift']());}};_0x4704ce(++_0x34eac7);}(_0x25d4,0x191));var _0x425d=function(_0x2c5aed,_0x295e39){_0x2c5aed=_0x2c5aed-0x0;var _0xd20e67=_0x25d4[_0x2c5aed];return _0xd20e67;};'use strict';var _=require(_0x425d('0x0'));var util=require('util');var logger=require(_0x425d('0x1'))(_0x425d('0x2'));var moment=require(_0x425d('0x3'));var BPromise=require('bluebird');var rp=require(_0x425d('0x4'));var fs=require('fs');var path=require(_0x425d('0x5'));var rimraf=require(_0x425d('0x6'));var config=require(_0x425d('0x7'));var attributes=require(_0x425d('0x8'));module[_0x425d('0x9')]=function(_0x36758e,_0x2beebf){return _0x36758e[_0x425d('0xa')](_0x425d('0xb'),attributes,{'tableName':_0x425d('0xc'),'paranoid':![],'indexes':[{'name':_0x425d('0xd'),'fields':[_0x425d('0xe'),_0x425d('0xf')]},{'name':_0x425d('0x10'),'fields':[_0x425d('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index fcdd58f..b8ee5e5 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 _0x6940=['util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','UpdateSquareReport','where','attributes','limit'];(function(_0x34c542,_0x220b05){var _0x5b9ec2=function(_0x51dc4f){while(--_0x51dc4f){_0x34c542['push'](_0x34c542['shift']());}};_0x5b9ec2(++_0x220b05);}(_0x6940,0x1e0));var _0x0694=function(_0x3f3242,_0x24fed1){_0x3f3242=_0x3f3242-0x0;var _0x3d976b=_0x6940[_0x3f3242];return _0x3d976b;};'use strict';var _=require('lodash');var util=require(_0x0694('0x0'));var moment=require(_0x0694('0x1'));var BPromise=require(_0x0694('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0694('0x3'))['db'];var utils=require(_0x0694('0x4'));var logger=require(_0x0694('0x5'))('rpc');var config=require(_0x0694('0x6'));var jayson=require(_0x0694('0x7'));var client=jayson['client'][_0x0694('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x8de2d1,_0xd087bf,_0x4eb0f6){return new BPromise(function(_0x21ab8a,_0x5982f0){return client[_0x0694('0x9')](_0x8de2d1,_0x4eb0f6)[_0x0694('0xa')](function(_0x4dca35){logger['info'](_0x0694('0xb'),_0xd087bf,_0x0694('0xc'));logger[_0x0694('0xd')](_0x0694('0xe'),_0xd087bf,'request\x20sent',JSON[_0x0694('0xf')](_0x4dca35));if(_0x4dca35[_0x0694('0x10')]){if(_0x4dca35[_0x0694('0x10')][_0x0694('0x11')]===0x1f4){logger[_0x0694('0x10')](_0x0694('0xb'),_0xd087bf,_0x4dca35['error'][_0x0694('0x12')]);return _0x5982f0(_0x4dca35[_0x0694('0x10')][_0x0694('0x12')]);}logger['error'](_0x0694('0xb'),_0xd087bf,_0x4dca35[_0x0694('0x10')][_0x0694('0x12')]);return _0x21ab8a(_0x4dca35['error'][_0x0694('0x12')]);}else{logger[_0x0694('0x13')](_0x0694('0xb'),_0xd087bf,_0x0694('0xc'));_0x21ab8a(_0x4dca35[_0x0694('0x14')]['message']);}})[_0x0694('0x15')](function(_0x219415){logger[_0x0694('0x10')](_0x0694('0xb'),_0xd087bf,_0x219415);_0x5982f0(_0x219415);});});}exports[_0x0694('0x16')]=function(_0x191db8){var _0x302d4b=this;return new Promise(function(_0x51b3e6,_0x287146){return db[_0x0694('0x17')][_0x0694('0x18')](_0x191db8[_0x0694('0x19')],{'raw':_0x191db8[_0x0694('0x1a')]?_0x191db8['options'][_0x0694('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x2a0860){logger[_0x0694('0x13')](_0x0694('0x16'),_0x191db8);logger['debug'](_0x0694('0x16'),_0x191db8,JSON[_0x0694('0xf')](_0x2a0860));_0x51b3e6(_0x2a0860);})[_0x0694('0x15')](function(_0x55fa20){logger['error']('CreateSquareReport',_0x55fa20['message'],_0x191db8);_0x287146(_0x302d4b[_0x0694('0x10')](0x1f4,_0x55fa20['message']));});});};exports[_0x0694('0x1c')]=function(_0x584219){var _0x33d941=this;return new Promise(function(_0x4cae74,_0x4e3989){return db[_0x0694('0x17')]['update'](_0x584219[_0x0694('0x19')],{'raw':_0x584219[_0x0694('0x1a')]?_0x584219['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x584219[_0x0694('0x1a')]?_0x584219[_0x0694('0x1a')][_0x0694('0x1d')]||null:null,'attributes':_0x584219['options']?_0x584219['options'][_0x0694('0x1e')]||null:null,'limit':_0x584219['options']?_0x584219[_0x0694('0x1a')][_0x0694('0x1f')]||null:null})[_0x0694('0xa')](function(_0x493708){logger['info']('UpdateSquareReport',_0x584219);logger[_0x0694('0xd')](_0x0694('0x1c'),_0x584219,JSON[_0x0694('0xf')](_0x493708));_0x4cae74(_0x493708);})[_0x0694('0x15')](function(_0x45263a){logger['error']('UpdateSquareReport',_0x45263a[_0x0694('0x12')],_0x584219);_0x4e3989(_0x33d941[_0x0694('0x10')](0x1f4,_0x45263a[_0x0694('0x12')]));});});}; \ No newline at end of file +var _0x00b5=['stringify','error','code','message','result','create','body','options','raw','CreateSquareReport','debug','catch','UpdateSquareReport','SquareReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x00b5,0xa2));var _0x500b=function(_0x1ad557,_0x5b4159){_0x1ad557=_0x1ad557-0x0;var _0x54d556=_0x00b5[_0x1ad557];return _0x54d556;};'use strict';var _=require(_0x500b('0x0'));var util=require(_0x500b('0x1'));var moment=require(_0x500b('0x2'));var BPromise=require(_0x500b('0x3'));var rs=require(_0x500b('0x4'));var fs=require('fs');var Redis=require(_0x500b('0x5'));var db=require(_0x500b('0x6'))['db'];var utils=require(_0x500b('0x7'));var logger=require(_0x500b('0x8'))('rpc');var config=require(_0x500b('0x9'));var jayson=require(_0x500b('0xa'));var client=jayson[_0x500b('0xb')][_0x500b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x131da1,_0x31af51,_0x28851c){return new BPromise(function(_0x103335,_0x26683f){return client[_0x500b('0xd')](_0x131da1,_0x28851c)[_0x500b('0xe')](function(_0x3cca9e){logger[_0x500b('0xf')](_0x500b('0x10'),_0x31af51,_0x500b('0x11'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x31af51,_0x500b('0x11'),JSON[_0x500b('0x12')](_0x3cca9e));if(_0x3cca9e['error']){if(_0x3cca9e[_0x500b('0x13')][_0x500b('0x14')]===0x1f4){logger[_0x500b('0x13')](_0x500b('0x10'),_0x31af51,_0x3cca9e[_0x500b('0x13')][_0x500b('0x15')]);return _0x26683f(_0x3cca9e[_0x500b('0x13')][_0x500b('0x15')]);}logger[_0x500b('0x13')](_0x500b('0x10'),_0x31af51,_0x3cca9e[_0x500b('0x13')][_0x500b('0x15')]);return _0x103335(_0x3cca9e['error'][_0x500b('0x15')]);}else{logger['info'](_0x500b('0x10'),_0x31af51,'request\x20sent');_0x103335(_0x3cca9e[_0x500b('0x16')][_0x500b('0x15')]);}})['catch'](function(_0x2f5efb){logger[_0x500b('0x13')](_0x500b('0x10'),_0x31af51,_0x2f5efb);_0x26683f(_0x2f5efb);});});}exports['CreateSquareReport']=function(_0x4fcc0b){var _0x50dcf6=this;return new Promise(function(_0x92cdc9,_0x3ef752){return db['SquareReport'][_0x500b('0x17')](_0x4fcc0b[_0x500b('0x18')],{'raw':_0x4fcc0b[_0x500b('0x19')]?_0x4fcc0b[_0x500b('0x19')][_0x500b('0x1a')]===undefined?!![]:![]:!![]})[_0x500b('0xe')](function(_0x44f898){logger[_0x500b('0xf')](_0x500b('0x1b'),_0x4fcc0b);logger[_0x500b('0x1c')](_0x500b('0x1b'),_0x4fcc0b,JSON['stringify'](_0x44f898));_0x92cdc9(_0x44f898);})[_0x500b('0x1d')](function(_0x3903ee){logger['error'](_0x500b('0x1b'),_0x3903ee[_0x500b('0x15')],_0x4fcc0b);_0x3ef752(_0x50dcf6[_0x500b('0x13')](0x1f4,_0x3903ee['message']));});});};exports[_0x500b('0x1e')]=function(_0x485237){var _0x1f171c=this;return new Promise(function(_0x46731a,_0x55d966){return db[_0x500b('0x1f')][_0x500b('0x20')](_0x485237[_0x500b('0x18')],{'raw':_0x485237['options']?_0x485237[_0x500b('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x485237[_0x500b('0x19')]?_0x485237[_0x500b('0x19')][_0x500b('0x21')]||null:null,'attributes':_0x485237[_0x500b('0x19')]?_0x485237[_0x500b('0x19')][_0x500b('0x22')]||null:null,'limit':_0x485237[_0x500b('0x19')]?_0x485237[_0x500b('0x19')][_0x500b('0x23')]||null:null})[_0x500b('0xe')](function(_0x2ee86b){logger['info']('UpdateSquareReport',_0x485237);logger[_0x500b('0x1c')](_0x500b('0x1e'),_0x485237,JSON['stringify'](_0x2ee86b));_0x46731a(_0x2ee86b);})['catch'](function(_0x5c2192){logger['error'](_0x500b('0x1e'),_0x5c2192[_0x500b('0x15')],_0x485237);_0x55d966(_0x1f171c[_0x500b('0x13')](0x1f4,_0x5c2192[_0x500b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 4202d4a..bb62fec 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 _0x6c64=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','isAuthenticated','index','get','describe','post','create','/:id','update','destroy','exports','multer'];(function(_0x460150,_0x232949){var _0x340677=function(_0x5b7e32){while(--_0x5b7e32){_0x460150['push'](_0x460150['shift']());}};_0x340677(++_0x232949);}(_0x6c64,0x1ed));var _0x46c6=function(_0x3d9b13,_0x59056f){_0x3d9b13=_0x3d9b13-0x0;var _0xebbf9f=_0x6c64[_0x3d9b13];return _0xebbf9f;};'use strict';var multer=require(_0x46c6('0x0'));var util=require(_0x46c6('0x1'));var path=require(_0x46c6('0x2'));var timeout=require('connect-timeout');var express=require(_0x46c6('0x3'));var router=express[_0x46c6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x46c6('0x5'));var interaction=require(_0x46c6('0x6'));var config=require(_0x46c6('0x7'));var controller=require(_0x46c6('0x8'));router['get']('/',auth[_0x46c6('0x9')](),controller[_0x46c6('0xa')]);router[_0x46c6('0xb')]('/describe',auth[_0x46c6('0x9')](),controller[_0x46c6('0xc')]);router[_0x46c6('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x46c6('0xd')]('/',auth[_0x46c6('0x9')](),controller[_0x46c6('0xe')]);router['put'](_0x46c6('0xf'),auth[_0x46c6('0x9')](),controller[_0x46c6('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x46c6('0x11')]);module[_0x46c6('0x12')]=router; \ No newline at end of file +var _0xe538=['exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy'];(function(_0x3b31da,_0x5bdcef){var _0x15ee8f=function(_0x3f1ab9){while(--_0x3f1ab9){_0x3b31da['push'](_0x3b31da['shift']());}};_0x15ee8f(++_0x5bdcef);}(_0xe538,0x112));var _0x8e53=function(_0x1c6089,_0x3816e2){_0x1c6089=_0x1c6089-0x0;var _0x4d97c1=_0xe538[_0x1c6089];return _0x4d97c1;};'use strict';var multer=require(_0x8e53('0x0'));var util=require(_0x8e53('0x1'));var path=require(_0x8e53('0x2'));var timeout=require(_0x8e53('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8e53('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8e53('0x5'));var config=require(_0x8e53('0x6'));var controller=require(_0x8e53('0x7'));router[_0x8e53('0x8')]('/',auth['isAuthenticated'](),controller[_0x8e53('0x9')]);router[_0x8e53('0x8')](_0x8e53('0xa'),auth[_0x8e53('0xb')](),controller['describe']);router[_0x8e53('0x8')](_0x8e53('0xc'),auth[_0x8e53('0xb')](),controller[_0x8e53('0xd')]);router[_0x8e53('0xe')]('/',auth[_0x8e53('0xb')](),controller[_0x8e53('0xf')]);router[_0x8e53('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x8e53('0x11')]);router[_0x8e53('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x8e53('0x13')]);module[_0x8e53('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 01e2054..2ee3a0a 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 _0x8909=['sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8909,0xe7));var _0x9890=function(_0x1305e3,_0x43a724){_0x1305e3=_0x1305e3-0x0;var _0x1068e9=_0x8909[_0x1305e3];return _0x1068e9;};'use strict';var Sequelize=require(_0x9890('0x0'));module[_0x9890('0x1')]={'uniqueid':{'type':Sequelize[_0x9890('0x2')]},'node':{'type':Sequelize[_0x9890('0x2')]},'application':{'type':Sequelize[_0x9890('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x9890('0x2')]},'callerid':{'type':Sequelize[_0x9890('0x2')]}}; \ No newline at end of file +var _0xa6d1=['TEXT','STRING'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa6d1,0x161));var _0x1a6d=function(_0x1d89b1,_0x28cc7f){_0x1d89b1=_0x1d89b1-0x0;var _0xc63e19=_0xa6d1[_0x1d89b1];return _0xc63e19;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x1a6d('0x0')]},'node':{'type':Sequelize[_0x1a6d('0x0')]},'application':{'type':Sequelize[_0x1a6d('0x0')]},'data':{'type':Sequelize[_0x1a6d('0x1')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x1a6d('0x0')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index f52439f..5228e34 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 _0x91c4=['rawAttributes','intersection','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','SquareDetailsReport','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','findAll','rows','catch','show','params'];(function(_0x1401e9,_0x4ba55f){var _0x5f3e9e=function(_0x2cf8d8){while(--_0x2cf8d8){_0x1401e9['push'](_0x1401e9['shift']());}};_0x5f3e9e(++_0x4ba55f);}(_0x91c4,0xf1));var _0x491c=function(_0x3d6445,_0x5cf50c){_0x3d6445=_0x3d6445-0x0;var _0xc0b055=_0x91c4[_0x3d6445];return _0xc0b055;};'use strict';var emlformat=require(_0x491c('0x0'));var rimraf=require(_0x491c('0x1'));var zipdir=require(_0x491c('0x2'));var jsonpatch=require(_0x491c('0x3'));var rp=require(_0x491c('0x4'));var moment=require(_0x491c('0x5'));var BPromise=require(_0x491c('0x6'));var Mustache=require(_0x491c('0x7'));var util=require(_0x491c('0x8'));var path=require(_0x491c('0x9'));var sox=require(_0x491c('0xa'));var csv=require(_0x491c('0xb'));var ejs=require(_0x491c('0xc'));var fs=require('fs');var fs_extra=require(_0x491c('0xd'));var _=require(_0x491c('0xe'));var squel=require(_0x491c('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x491c('0x10'));var toCsv=require(_0x491c('0xb'));var querystring=require('querystring');var Papa=require(_0x491c('0x11'));var Redis=require(_0x491c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x491c('0x13'));var as=require(_0x491c('0x14'));var hardwareService=require(_0x491c('0x15'));var logger=require('../../config/logger')(_0x491c('0x16'));var utils=require(_0x491c('0x17'));var config=require(_0x491c('0x18'));var licenseUtil=require(_0x491c('0x19'));var db=require(_0x491c('0x1a'))['db'];function respondWithStatusCode(_0x1e519d,_0x1afcb3){_0x1afcb3=_0x1afcb3||0xcc;return function(_0x35ec3c){if(_0x35ec3c){return _0x1e519d[_0x491c('0x1b')](_0x1afcb3);}return _0x1e519d[_0x491c('0x1c')](_0x1afcb3)[_0x491c('0x1d')]();};}function respondWithResult(_0x4d479b,_0x3e69e7){_0x3e69e7=_0x3e69e7||0xc8;return function(_0x1220a8){if(_0x1220a8){return _0x4d479b[_0x491c('0x1c')](_0x3e69e7)[_0x491c('0x1e')](_0x1220a8);}};}function respondWithFilteredResult(_0x314c7e,_0x37b634){return function(_0x224b72){if(_0x224b72){var _0xd28660=typeof _0x37b634['offset']==='undefined'&&typeof _0x37b634[_0x491c('0x1f')]==='undefined';var _0x100bab=_0x224b72[_0x491c('0x20')];var _0x2a14d5=_0xd28660?0x0:_0x37b634['offset'];var _0x2ba8bd=_0xd28660?_0x224b72[_0x491c('0x20')]:_0x37b634[_0x491c('0x21')]+_0x37b634[_0x491c('0x1f')];var _0x169e34;if(_0x2ba8bd>=_0x100bab){_0x2ba8bd=_0x100bab;_0x169e34=0xc8;}else{_0x169e34=0xce;}_0x314c7e[_0x491c('0x1c')](_0x169e34);return _0x314c7e[_0x491c('0x22')](_0x491c('0x23'),_0x2a14d5+'-'+_0x2ba8bd+'/'+_0x100bab)[_0x491c('0x1e')](_0x224b72);}return null;};}function patchUpdates(_0x1e056d){return function(_0x512669){try{jsonpatch[_0x491c('0x24')](_0x512669,_0x1e056d,!![]);}catch(_0x204966){return BPromise[_0x491c('0x25')](_0x204966);}return _0x512669[_0x491c('0x26')]();};}function saveUpdates(_0x303334,_0x4bbf3e){return function(_0x465d8b){if(_0x465d8b){return _0x465d8b[_0x491c('0x27')](_0x303334)['then'](function(_0x47fa9f){return _0x47fa9f;});}return null;};}function removeEntity(_0x5bc3d9,_0x435063){return function(_0x30c582){if(_0x30c582){return _0x30c582[_0x491c('0x28')]()[_0x491c('0x29')](function(){_0x5bc3d9['status'](0xcc)[_0x491c('0x1d')]();});}};}function handleEntityNotFound(_0x492dcf,_0xe7aaf5){return function(_0x3003db){if(!_0x3003db){_0x492dcf[_0x491c('0x1b')](0x194);}return _0x3003db;};}function handleError(_0x17ed96,_0x1fb1a3){_0x1fb1a3=_0x1fb1a3||0x1f4;return function(_0x1a9902){logger[_0x491c('0x2a')](_0x1a9902[_0x491c('0x2b')]);if(_0x1a9902[_0x491c('0x2c')]){delete _0x1a9902[_0x491c('0x2c')];}_0x17ed96[_0x491c('0x1c')](_0x1fb1a3)[_0x491c('0x2d')](_0x1a9902);};}exports['index']=function(_0x45643f,_0xadb4f3){var _0x333dd5={},_0x4047fe={},_0x401c53={'count':0x0,'rows':[]};var _0x4d6ad8=_[_0x491c('0x2e')](db[_0x491c('0x2f')]['rawAttributes'],function(_0x485afa){return{'name':_0x485afa[_0x491c('0x30')],'type':_0x485afa[_0x491c('0x31')]['key']};});_0x4047fe[_0x491c('0x32')]=_[_0x491c('0x2e')](_0x4d6ad8,_0x491c('0x2c'));_0x4047fe[_0x491c('0x33')]=_[_0x491c('0x34')](_0x45643f[_0x491c('0x33')]);_0x4047fe[_0x491c('0x35')]=_['intersection'](_0x4047fe[_0x491c('0x32')],_0x4047fe[_0x491c('0x33')]);_0x333dd5[_0x491c('0x36')]=_['intersection'](_0x4047fe[_0x491c('0x32')],qs[_0x491c('0x37')](_0x45643f[_0x491c('0x33')]['fields']));_0x333dd5[_0x491c('0x36')]=_0x333dd5[_0x491c('0x36')][_0x491c('0x38')]?_0x333dd5[_0x491c('0x36')]:_0x4047fe[_0x491c('0x32')];if(!_0x45643f['query'][_0x491c('0x39')]('nolimit')){_0x333dd5['limit']=qs['limit'](_0x45643f['query'][_0x491c('0x1f')]);_0x333dd5[_0x491c('0x21')]=qs['offset'](_0x45643f[_0x491c('0x33')]['offset']);}_0x333dd5[_0x491c('0x3a')]=qs[_0x491c('0x3b')](_0x45643f[_0x491c('0x33')]['sort']);_0x333dd5['where']=qs['filters'](_[_0x491c('0x3c')](_0x45643f[_0x491c('0x33')],_0x4047fe[_0x491c('0x35')]),_0x4d6ad8);if(_0x45643f[_0x491c('0x33')][_0x491c('0x3d')]){_0x333dd5[_0x491c('0x3e')]=_[_0x491c('0x3f')](_0x333dd5['where'],{'$or':_['map'](_0x4d6ad8,function(_0x3e833f){if(_0x3e833f['type']!=='VIRTUAL'){var _0x15dda6={};_0x15dda6[_0x3e833f[_0x491c('0x2c')]]={'$like':'%'+_0x45643f[_0x491c('0x33')]['filter']+'%'};return _0x15dda6;}})});}_0x333dd5=_['merge']({},_0x333dd5,_0x45643f[_0x491c('0x40')]);var _0x11c62d={'where':_0x333dd5['where']};return db[_0x491c('0x2f')]['count'](_0x11c62d)[_0x491c('0x29')](function(_0x545a56){_0x401c53[_0x491c('0x20')]=_0x545a56;if(_0x45643f[_0x491c('0x33')][_0x491c('0x41')]){_0x333dd5['include']=[{'all':!![]}];}return db[_0x491c('0x2f')][_0x491c('0x42')](_0x333dd5);})[_0x491c('0x29')](function(_0x59219a){_0x401c53[_0x491c('0x43')]=_0x59219a;return _0x401c53;})['then'](respondWithFilteredResult(_0xadb4f3,_0x333dd5))[_0x491c('0x44')](handleError(_0xadb4f3,null));};exports[_0x491c('0x45')]=function(_0x3d3f6d,_0x497646){var _0x20147b={'raw':!![],'where':{'id':_0x3d3f6d[_0x491c('0x46')]['id']}},_0x41ad66={};_0x41ad66[_0x491c('0x32')]=_[_0x491c('0x34')](db['SquareDetailsReport'][_0x491c('0x47')]);_0x41ad66[_0x491c('0x33')]=_[_0x491c('0x34')](_0x3d3f6d[_0x491c('0x33')]);_0x41ad66[_0x491c('0x35')]=_[_0x491c('0x48')](_0x41ad66['model'],_0x41ad66[_0x491c('0x33')]);_0x20147b[_0x491c('0x36')]=_['intersection'](_0x41ad66[_0x491c('0x32')],qs['fields'](_0x3d3f6d[_0x491c('0x33')][_0x491c('0x37')]));_0x20147b[_0x491c('0x36')]=_0x20147b[_0x491c('0x36')]['length']?_0x20147b[_0x491c('0x36')]:_0x41ad66[_0x491c('0x32')];if(_0x3d3f6d[_0x491c('0x33')]['includeAll']){_0x20147b[_0x491c('0x49')]=[{'all':!![]}];}_0x20147b=_[_0x491c('0x3f')]({},_0x20147b,_0x3d3f6d['options']);return db[_0x491c('0x2f')][_0x491c('0x4a')](_0x20147b)[_0x491c('0x29')](handleEntityNotFound(_0x497646,null))['then'](respondWithResult(_0x497646,null))[_0x491c('0x44')](handleError(_0x497646,null));};exports[_0x491c('0x4b')]=function(_0x31764d,_0x43c83a){return db[_0x491c('0x2f')][_0x491c('0x4b')](_0x31764d['body'],{})['then'](respondWithResult(_0x43c83a,0xc9))['catch'](handleError(_0x43c83a,null));};exports[_0x491c('0x27')]=function(_0x1bc2d4,_0x44dcad){if(_0x1bc2d4['body']['id']){delete _0x1bc2d4['body']['id'];}return db[_0x491c('0x2f')][_0x491c('0x4a')]({'where':{'id':_0x1bc2d4[_0x491c('0x46')]['id']}})[_0x491c('0x29')](handleEntityNotFound(_0x44dcad,null))['then'](saveUpdates(_0x1bc2d4[_0x491c('0x4c')],null))[_0x491c('0x29')](respondWithResult(_0x44dcad,null))[_0x491c('0x44')](handleError(_0x44dcad,null));};exports[_0x491c('0x28')]=function(_0x5aafcf,_0x1ae348){return db['SquareDetailsReport']['find']({'where':{'id':_0x5aafcf[_0x491c('0x46')]['id']}})['then'](handleEntityNotFound(_0x1ae348,null))['then'](removeEntity(_0x1ae348,null))['catch'](handleError(_0x1ae348,null));};exports[_0x491c('0x4d')]=function(_0x2b331b,_0x2d8c92){return db[_0x491c('0x2f')]['describe']()[_0x491c('0x29')](respondWithResult(_0x2d8c92,null))[_0x491c('0x44')](handleError(_0x2d8c92,null));}; \ No newline at end of file +var _0xfe9c=['query','intersection','fields','length','nolimit','order','sort','filters','filter','where','merge','type','options','findAll','rows','show','keys','attributes','includeAll','find','create','body','params','catch','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','end','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','model'];(function(_0x3496c3,_0x4c3221){var _0x39878c=function(_0x30cc51){while(--_0x30cc51){_0x3496c3['push'](_0x3496c3['shift']());}};_0x39878c(++_0x4c3221);}(_0xfe9c,0x12d));var _0xcfe9=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xfe9c[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0xcfe9('0x0'));var rimraf=require(_0xcfe9('0x1'));var zipdir=require(_0xcfe9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcfe9('0x3'));var moment=require('moment');var BPromise=require(_0xcfe9('0x4'));var Mustache=require(_0xcfe9('0x5'));var util=require(_0xcfe9('0x6'));var path=require(_0xcfe9('0x7'));var sox=require(_0xcfe9('0x8'));var csv=require(_0xcfe9('0x9'));var ejs=require(_0xcfe9('0xa'));var fs=require('fs');var fs_extra=require(_0xcfe9('0xb'));var _=require(_0xcfe9('0xc'));var squel=require(_0xcfe9('0xd'));var crypto=require('crypto');var jsforce=require(_0xcfe9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcfe9('0x9'));var querystring=require('querystring');var Papa=require(_0xcfe9('0xf'));var Redis=require(_0xcfe9('0x10'));var authService=require(_0xcfe9('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcfe9('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcfe9('0x13'));var db=require(_0xcfe9('0x14'))['db'];function respondWithStatusCode(_0x22c83c,_0x16b1c0){_0x16b1c0=_0x16b1c0||0xcc;return function(_0x3767cd){if(_0x3767cd){return _0x22c83c[_0xcfe9('0x15')](_0x16b1c0);}return _0x22c83c['status'](_0x16b1c0)['end']();};}function respondWithResult(_0x221089,_0x1387dd){_0x1387dd=_0x1387dd||0xc8;return function(_0x45eab0){if(_0x45eab0){return _0x221089[_0xcfe9('0x16')](_0x1387dd)[_0xcfe9('0x17')](_0x45eab0);}};}function respondWithFilteredResult(_0x2756b9,_0x183e21){return function(_0x4411ff){if(_0x4411ff){var _0x32ad1c=typeof _0x183e21[_0xcfe9('0x18')]===_0xcfe9('0x19')&&typeof _0x183e21[_0xcfe9('0x1a')]===_0xcfe9('0x19');var _0x510eb4=_0x4411ff[_0xcfe9('0x1b')];var _0x2203c5=_0x32ad1c?0x0:_0x183e21[_0xcfe9('0x18')];var _0x355eaf=_0x32ad1c?_0x4411ff[_0xcfe9('0x1b')]:_0x183e21[_0xcfe9('0x18')]+_0x183e21[_0xcfe9('0x1a')];var _0x202cbb;if(_0x355eaf>=_0x510eb4){_0x355eaf=_0x510eb4;_0x202cbb=0xc8;}else{_0x202cbb=0xce;}_0x2756b9['status'](_0x202cbb);return _0x2756b9[_0xcfe9('0x1c')](_0xcfe9('0x1d'),_0x2203c5+'-'+_0x355eaf+'/'+_0x510eb4)[_0xcfe9('0x17')](_0x4411ff);}return null;};}function patchUpdates(_0x3e3565){return function(_0x3ef8b1){try{jsonpatch['apply'](_0x3ef8b1,_0x3e3565,!![]);}catch(_0x14d500){return BPromise[_0xcfe9('0x1e')](_0x14d500);}return _0x3ef8b1['save']();};}function saveUpdates(_0x5ad595,_0x1d5cac){return function(_0x31c0bc){if(_0x31c0bc){return _0x31c0bc[_0xcfe9('0x1f')](_0x5ad595)[_0xcfe9('0x20')](function(_0x58bfd7){return _0x58bfd7;});}return null;};}function removeEntity(_0x476e7d,_0x375cdb){return function(_0x513f82){if(_0x513f82){return _0x513f82[_0xcfe9('0x21')]()['then'](function(){_0x476e7d[_0xcfe9('0x16')](0xcc)[_0xcfe9('0x22')]();});}};}function handleEntityNotFound(_0xdf53b9,_0x4520b6){return function(_0xe566d7){if(!_0xe566d7){_0xdf53b9[_0xcfe9('0x15')](0x194);}return _0xe566d7;};}function handleError(_0x52ee2d,_0x1e8605){_0x1e8605=_0x1e8605||0x1f4;return function(_0x5ef739){logger['error'](_0x5ef739[_0xcfe9('0x23')]);if(_0x5ef739[_0xcfe9('0x24')]){delete _0x5ef739[_0xcfe9('0x24')];}_0x52ee2d[_0xcfe9('0x16')](_0x1e8605)[_0xcfe9('0x25')](_0x5ef739);};}exports[_0xcfe9('0x26')]=function(_0x10c6cf,_0x2bcb90){var _0x3fbc5f={},_0x1467cb={},_0x639681={'count':0x0,'rows':[]};var _0x4436f7=_[_0xcfe9('0x27')](db[_0xcfe9('0x28')][_0xcfe9('0x29')],function(_0x7e1b06){return{'name':_0x7e1b06[_0xcfe9('0x2a')],'type':_0x7e1b06['type']['key']};});_0x1467cb[_0xcfe9('0x2b')]=_[_0xcfe9('0x27')](_0x4436f7,_0xcfe9('0x24'));_0x1467cb[_0xcfe9('0x2c')]=_['keys'](_0x10c6cf[_0xcfe9('0x2c')]);_0x1467cb['filters']=_[_0xcfe9('0x2d')](_0x1467cb['model'],_0x1467cb['query']);_0x3fbc5f['attributes']=_[_0xcfe9('0x2d')](_0x1467cb['model'],qs[_0xcfe9('0x2e')](_0x10c6cf[_0xcfe9('0x2c')][_0xcfe9('0x2e')]));_0x3fbc5f['attributes']=_0x3fbc5f['attributes'][_0xcfe9('0x2f')]?_0x3fbc5f['attributes']:_0x1467cb[_0xcfe9('0x2b')];if(!_0x10c6cf[_0xcfe9('0x2c')]['hasOwnProperty'](_0xcfe9('0x30'))){_0x3fbc5f[_0xcfe9('0x1a')]=qs[_0xcfe9('0x1a')](_0x10c6cf[_0xcfe9('0x2c')][_0xcfe9('0x1a')]);_0x3fbc5f['offset']=qs[_0xcfe9('0x18')](_0x10c6cf[_0xcfe9('0x2c')][_0xcfe9('0x18')]);}_0x3fbc5f[_0xcfe9('0x31')]=qs[_0xcfe9('0x32')](_0x10c6cf[_0xcfe9('0x2c')][_0xcfe9('0x32')]);_0x3fbc5f['where']=qs['filters'](_['pick'](_0x10c6cf[_0xcfe9('0x2c')],_0x1467cb[_0xcfe9('0x33')]),_0x4436f7);if(_0x10c6cf[_0xcfe9('0x2c')][_0xcfe9('0x34')]){_0x3fbc5f[_0xcfe9('0x35')]=_[_0xcfe9('0x36')](_0x3fbc5f[_0xcfe9('0x35')],{'$or':_[_0xcfe9('0x27')](_0x4436f7,function(_0x25188c){if(_0x25188c[_0xcfe9('0x37')]!=='VIRTUAL'){var _0x5bc59e={};_0x5bc59e[_0x25188c['name']]={'$like':'%'+_0x10c6cf[_0xcfe9('0x2c')][_0xcfe9('0x34')]+'%'};return _0x5bc59e;}})});}_0x3fbc5f=_[_0xcfe9('0x36')]({},_0x3fbc5f,_0x10c6cf[_0xcfe9('0x38')]);var _0x397e26={'where':_0x3fbc5f['where']};return db[_0xcfe9('0x28')]['count'](_0x397e26)['then'](function(_0x3e51ac){_0x639681[_0xcfe9('0x1b')]=_0x3e51ac;if(_0x10c6cf[_0xcfe9('0x2c')]['includeAll']){_0x3fbc5f['include']=[{'all':!![]}];}return db[_0xcfe9('0x28')][_0xcfe9('0x39')](_0x3fbc5f);})[_0xcfe9('0x20')](function(_0x589f23){_0x639681[_0xcfe9('0x3a')]=_0x589f23;return _0x639681;})[_0xcfe9('0x20')](respondWithFilteredResult(_0x2bcb90,_0x3fbc5f))['catch'](handleError(_0x2bcb90,null));};exports[_0xcfe9('0x3b')]=function(_0x168024,_0x2612ea){var _0x40179d={'raw':!![],'where':{'id':_0x168024['params']['id']}},_0x2da942={};_0x2da942[_0xcfe9('0x2b')]=_[_0xcfe9('0x3c')](db[_0xcfe9('0x28')][_0xcfe9('0x29')]);_0x2da942[_0xcfe9('0x2c')]=_[_0xcfe9('0x3c')](_0x168024[_0xcfe9('0x2c')]);_0x2da942[_0xcfe9('0x33')]=_[_0xcfe9('0x2d')](_0x2da942[_0xcfe9('0x2b')],_0x2da942[_0xcfe9('0x2c')]);_0x40179d[_0xcfe9('0x3d')]=_[_0xcfe9('0x2d')](_0x2da942[_0xcfe9('0x2b')],qs[_0xcfe9('0x2e')](_0x168024[_0xcfe9('0x2c')][_0xcfe9('0x2e')]));_0x40179d[_0xcfe9('0x3d')]=_0x40179d[_0xcfe9('0x3d')][_0xcfe9('0x2f')]?_0x40179d[_0xcfe9('0x3d')]:_0x2da942[_0xcfe9('0x2b')];if(_0x168024[_0xcfe9('0x2c')][_0xcfe9('0x3e')]){_0x40179d['include']=[{'all':!![]}];}_0x40179d=_[_0xcfe9('0x36')]({},_0x40179d,_0x168024[_0xcfe9('0x38')]);return db[_0xcfe9('0x28')][_0xcfe9('0x3f')](_0x40179d)['then'](handleEntityNotFound(_0x2612ea,null))['then'](respondWithResult(_0x2612ea,null))['catch'](handleError(_0x2612ea,null));};exports[_0xcfe9('0x40')]=function(_0x18bdd0,_0x588a88){return db[_0xcfe9('0x28')][_0xcfe9('0x40')](_0x18bdd0[_0xcfe9('0x41')],{})[_0xcfe9('0x20')](respondWithResult(_0x588a88,0xc9))['catch'](handleError(_0x588a88,null));};exports[_0xcfe9('0x1f')]=function(_0x267708,_0x49464b){if(_0x267708[_0xcfe9('0x41')]['id']){delete _0x267708[_0xcfe9('0x41')]['id'];}return db['SquareDetailsReport'][_0xcfe9('0x3f')]({'where':{'id':_0x267708[_0xcfe9('0x42')]['id']}})[_0xcfe9('0x20')](handleEntityNotFound(_0x49464b,null))['then'](saveUpdates(_0x267708[_0xcfe9('0x41')],null))['then'](respondWithResult(_0x49464b,null))[_0xcfe9('0x43')](handleError(_0x49464b,null));};exports[_0xcfe9('0x21')]=function(_0x2860db,_0x328261){return db[_0xcfe9('0x28')]['find']({'where':{'id':_0x2860db[_0xcfe9('0x42')]['id']}})['then'](handleEntityNotFound(_0x328261,null))['then'](removeEntity(_0x328261,null))[_0xcfe9('0x43')](handleError(_0x328261,null));};exports[_0xcfe9('0x44')]=function(_0x325382,_0x367e32){return db[_0xcfe9('0x28')][_0xcfe9('0x44')]()[_0xcfe9('0x20')](respondWithResult(_0x367e32,null))[_0xcfe9('0x43')](handleError(_0x367e32,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 25fbb35..eab75b9 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 _0xea19=['report_square_details','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport'];(function(_0x349472,_0x974363){var _0x451c1e=function(_0x33a96a){while(--_0x33a96a){_0x349472['push'](_0x349472['shift']());}};_0x451c1e(++_0x974363);}(_0xea19,0xde));var _0x9ea1=function(_0x2bc3f4,_0x470b26){_0x2bc3f4=_0x2bc3f4-0x0;var _0x14ac53=_0xea19[_0x2bc3f4];return _0x14ac53;};'use strict';var _=require(_0x9ea1('0x0'));var util=require(_0x9ea1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9ea1('0x2'));var BPromise=require(_0x9ea1('0x3'));var rp=require(_0x9ea1('0x4'));var fs=require('fs');var path=require(_0x9ea1('0x5'));var rimraf=require(_0x9ea1('0x6'));var config=require(_0x9ea1('0x7'));var attributes=require(_0x9ea1('0x8'));module[_0x9ea1('0x9')]=function(_0x517be0,_0x2e8d43){return _0x517be0[_0x9ea1('0xa')](_0x9ea1('0xb'),attributes,{'tableName':_0x9ea1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9106=['define','report_square_details','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2fe622,_0x4e258a){var _0x165bdb=function(_0x48b999){while(--_0x48b999){_0x2fe622['push'](_0x2fe622['shift']());}};_0x165bdb(++_0x4e258a);}(_0x9106,0x6e));var _0x6910=function(_0x448bab,_0x25517b){_0x448bab=_0x448bab-0x0;var _0x5dc534=_0x9106[_0x448bab];return _0x5dc534;};'use strict';var _=require(_0x6910('0x0'));var util=require(_0x6910('0x1'));var logger=require(_0x6910('0x2'))(_0x6910('0x3'));var moment=require('moment');var BPromise=require(_0x6910('0x4'));var rp=require(_0x6910('0x5'));var fs=require('fs');var path=require(_0x6910('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0x28b7a9,_0x582073){return _0x28b7a9[_0x6910('0x7')]('SquareDetailsReport',attributes,{'tableName':_0x6910('0x8'),'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 0bfd715..75e3315 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 _0x26f9=['create','options','CreateSquareDetailsReport','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareDetailsReport'];(function(_0x169e53,_0x46be55){var _0x252bb3=function(_0x521e7a){while(--_0x521e7a){_0x169e53['push'](_0x169e53['shift']());}};_0x252bb3(++_0x46be55);}(_0x26f9,0x16f));var _0x926f=function(_0xff780c,_0x3c94eb){_0xff780c=_0xff780c-0x0;var _0x1f0861=_0x26f9[_0xff780c];return _0x1f0861;};'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']('SquareDetailsReport,\x20%s,\x20%s',_0xf56fcb,_0x593c13['error'][_0x926f('0x13')]);return _0x41a7ed(_0x593c13[_0x926f('0x11')][_0x926f('0x13')]);}else{logger[_0x926f('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0xf56fcb,_0x926f('0xf'));_0x41a7ed(_0x593c13[_0x926f('0x14')]['message']);}})[_0x926f('0x15')](function(_0x52865b){logger[_0x926f('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0xf56fcb,_0x52865b);_0x2af11e(_0x52865b);});});}exports['CreateSquareDetailsReport']=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')]));});});}; \ No newline at end of file +var _0xb6fa=['result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','debug','lodash','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x14cb92,_0x43857a){var _0x53ca3e=function(_0xe7ff63){while(--_0xe7ff63){_0x14cb92['push'](_0x14cb92['shift']());}};_0x53ca3e(++_0x43857a);}(_0xb6fa,0x1c2));var _0xab6f=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xb6fa[_0x209941];return _0x1e8729;};'use strict';var _=require(_0xab6f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xab6f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab6f('0x2'))['db'];var utils=require(_0xab6f('0x3'));var logger=require('../../config/logger')(_0xab6f('0x4'));var config=require(_0xab6f('0x5'));var jayson=require(_0xab6f('0x6'));var client=jayson[_0xab6f('0x7')][_0xab6f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x895acc,_0x16b84e,_0x1b4da9){return new BPromise(function(_0x46b0f6,_0x85cb19){return client[_0xab6f('0x9')](_0x895acc,_0x1b4da9)[_0xab6f('0xa')](function(_0x199f2d){logger[_0xab6f('0xb')](_0xab6f('0xc'),_0x16b84e,_0xab6f('0xd'));logger['debug']('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x16b84e,_0xab6f('0xd'),JSON[_0xab6f('0xe')](_0x199f2d));if(_0x199f2d['error']){if(_0x199f2d[_0xab6f('0xf')][_0xab6f('0x10')]===0x1f4){logger[_0xab6f('0xf')](_0xab6f('0xc'),_0x16b84e,_0x199f2d[_0xab6f('0xf')][_0xab6f('0x11')]);return _0x85cb19(_0x199f2d[_0xab6f('0xf')]['message']);}logger[_0xab6f('0xf')](_0xab6f('0xc'),_0x16b84e,_0x199f2d[_0xab6f('0xf')]['message']);return _0x46b0f6(_0x199f2d[_0xab6f('0xf')]['message']);}else{logger['info'](_0xab6f('0xc'),_0x16b84e,'request\x20sent');_0x46b0f6(_0x199f2d[_0xab6f('0x12')][_0xab6f('0x11')]);}})[_0xab6f('0x13')](function(_0x59b934){logger[_0xab6f('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x16b84e,_0x59b934);_0x85cb19(_0x59b934);});});}exports[_0xab6f('0x14')]=function(_0x439b73){var _0x3e616c=this;return new Promise(function(_0x2f75c1,_0xbb7af){return db[_0xab6f('0x15')][_0xab6f('0x16')](_0x439b73['body'],{'raw':_0x439b73[_0xab6f('0x17')]?_0x439b73[_0xab6f('0x17')][_0xab6f('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x43eda0){logger[_0xab6f('0xb')](_0xab6f('0x14'),_0x439b73);logger[_0xab6f('0x19')](_0xab6f('0x14'),_0x439b73,JSON[_0xab6f('0xe')](_0x43eda0));_0x2f75c1(_0x43eda0);})['catch'](function(_0x4dc7c1){logger[_0xab6f('0xf')](_0xab6f('0x14'),_0x4dc7c1[_0xab6f('0x11')],_0x439b73);_0xbb7af(_0x3e616c[_0xab6f('0xf')](0x1f4,_0x4dc7c1[_0xab6f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 85c9e0c..8255c7a 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 _0x6964=['./system.controller','get','isAuthenticated','index','/process/:pid/kill','exports','express','../../components/auth/service'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x6964,0xa6));var _0x4696=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x6964[_0x18ab2a];return _0x16dcee;};'use strict';var express=require(_0x4696('0x0'));var router=express['Router']();var auth=require(_0x4696('0x1'));var controller=require(_0x4696('0x2'));router[_0x4696('0x3')]('/',auth[_0x4696('0x4')](),controller[_0x4696('0x5')]);router[_0x4696('0x3')](_0x4696('0x6'),auth[_0x4696('0x4')](),controller['killProcess']);module[_0x4696('0x7')]=router; \ No newline at end of file +var _0xab68=['get','isAuthenticated','index','/process/:pid/kill','Router'];(function(_0x550c66,_0x2134fd){var _0x3a58dd=function(_0x4b0a17){while(--_0x4b0a17){_0x550c66['push'](_0x550c66['shift']());}};_0x3a58dd(++_0x2134fd);}(_0xab68,0x1a3));var _0x8ab6=function(_0x340459,_0x7a9d8e){_0x340459=_0x340459-0x0;var _0x505bac=_0xab68[_0x340459];return _0x505bac;};'use strict';var express=require('express');var router=express[_0x8ab6('0x0')]();var auth=require('../../components/auth/service');var controller=require('./system.controller');router[_0x8ab6('0x1')]('/',auth[_0x8ab6('0x2')](),controller[_0x8ab6('0x3')]);router['get'](_0x8ab6('0x4'),auth[_0x8ab6('0x2')](),controller['killProcess']);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 71a1139..1ac3304 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 _0xa30b=['bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','getAllData','then','json','catch','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','indexOf','kill','SIGINT','systeminformation','child_process','exec','../../config/logger','util'];(function(_0x5bec43,_0x2b6022){var _0x1a1172=function(_0x200159){while(--_0x200159){_0x5bec43['push'](_0x5bec43['shift']());}};_0x1a1172(++_0x2b6022);}(_0xa30b,0xaa));var _0xba30=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa30b[_0x122ef9];return _0x42fba0;};'use strict';var info=require(_0xba30('0x0'));var exec=require(_0xba30('0x1'))[_0xba30('0x2')];var logger=require(_0xba30('0x3'))('api');var util=require(_0xba30('0x4'));var BPromise=require(_0xba30('0x5'));var _=require(_0xba30('0x6'));function handleError(_0x1580b0,_0x2153a4,_0x3589b1){_0x2153a4=_0x2153a4||0x1f4;return function(_0xe8615e){logger[_0xba30('0x7')](_0xba30('0x8'),_0x3589b1,_0x2153a4,util[_0xba30('0x9')](_0xe8615e,{'showHidden':![],'depth':null}));delete _0xe8615e[_0xba30('0xa')];_0x1580b0[_0xba30('0xb')](_0x2153a4)['send'](_0xe8615e);};}exports['index']=function(_0x7d4d79,_0x491ac1){return info[_0xba30('0xc')]()[_0xba30('0xd')](function(_0x1d3d49){return _0x491ac1[_0xba30('0xb')](0xc8)[_0xba30('0xe')](_0x1d3d49);})[_0xba30('0xf')](function(_0x448d71){return _0x491ac1['status'](0x1f4)['json'](_0x448d71);});};exports[_0xba30('0x10')]=function(_0x1ff06b,_0x380c01){var _0x4360c6=[_0xba30('0x11')];return new BPromise(function(_0x5362d3,_0x48862f){return exec(util['format'](_0xba30('0x12'),_0x1ff06b[_0xba30('0x13')][_0xba30('0x14')]),function(_0x12f175,_0x3a8891,_0x580610){if(_0x12f175){return _0x48862f(_0x12f175);}return _0x5362d3(_0x3a8891);});})[_0xba30('0xd')](function(_0x6a21bb){var _0x7a4c42=![];var _0x4060dd=_0x6a21bb[_0xba30('0x15')](/\n/);for(var _0x3245f1=0x0,_0x3d5ba1=_0x4360c6['length'];_0x3245f1<_0x3d5ba1,_0x7a4c42===![];_0x3245f1+=0x1){if(_0x6a21bb[_0xba30('0x16')](_0x4360c6[_0x3245f1])>=0x0){_0x7a4c42=!![];}}if(!_0x7a4c42){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x1ff06b['params'][_0xba30('0x14')]));}process[_0xba30('0x17')](_0x1ff06b['params'][_0xba30('0x14')],_0xba30('0x18'));return _0x380c01[_0xba30('0xb')](0xc8)[_0xba30('0xe')]({'message':util['format']('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x1ff06b[_0xba30('0x13')]['pid'])});})['catch'](handleError(_0x380c01,null,_0xba30('0x10')));}; \ No newline at end of file +var _0x50a1=['lodash','error','inspect','status','send','index','getAllData','then','json','catch','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','exec','../../config/logger','api','bluebird'];(function(_0x180eb2,_0xa4455f){var _0x44cbe7=function(_0x148ede){while(--_0x148ede){_0x180eb2['push'](_0x180eb2['shift']());}};_0x44cbe7(++_0xa4455f);}(_0x50a1,0x10e));var _0x150a=function(_0x8d41fb,_0x49f6a7){_0x8d41fb=_0x8d41fb-0x0;var _0x1e77c5=_0x50a1[_0x8d41fb];return _0x1e77c5;};'use strict';var info=require('systeminformation');var exec=require(_0x150a('0x0'))[_0x150a('0x1')];var logger=require(_0x150a('0x2'))(_0x150a('0x3'));var util=require('util');var BPromise=require(_0x150a('0x4'));var _=require(_0x150a('0x5'));function handleError(_0x28c689,_0x17c533,_0x2cc1ce){_0x17c533=_0x17c533||0x1f4;return function(_0x33699f){logger[_0x150a('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x2cc1ce,_0x17c533,util[_0x150a('0x7')](_0x33699f,{'showHidden':![],'depth':null}));delete _0x33699f['name'];_0x28c689[_0x150a('0x8')](_0x17c533)[_0x150a('0x9')](_0x33699f);};}exports[_0x150a('0xa')]=function(_0x17a763,_0x9d2f0e){return info[_0x150a('0xb')]()[_0x150a('0xc')](function(_0x47c7d6){return _0x9d2f0e['status'](0xc8)[_0x150a('0xd')](_0x47c7d6);})[_0x150a('0xe')](function(_0x393f0f){return _0x9d2f0e[_0x150a('0x8')](0x1f4)[_0x150a('0xd')](_0x393f0f);});};exports[_0x150a('0xf')]=function(_0x3412d2,_0x156f77){var _0x3c9270=['components/import/cm'];return new BPromise(function(_0x51036c,_0x1149f6){return exec(util[_0x150a('0x10')](_0x150a('0x11'),_0x3412d2[_0x150a('0x12')][_0x150a('0x13')]),function(_0x18ff59,_0x16e01d,_0x193932){if(_0x18ff59){return _0x1149f6(_0x18ff59);}return _0x51036c(_0x16e01d);});})[_0x150a('0xc')](function(_0xda97fe){var _0x36e583=![];var _0x2d67f3=_0xda97fe[_0x150a('0x14')](/\n/);for(var _0x10335a=0x0,_0x5565da=_0x3c9270[_0x150a('0x15')];_0x10335a<_0x5565da,_0x36e583===![];_0x10335a+=0x1){if(_0xda97fe['indexOf'](_0x3c9270[_0x10335a])>=0x0){_0x36e583=!![];}}if(!_0x36e583){throw new Error(util['format'](_0x150a('0x16'),_0x3412d2[_0x150a('0x12')][_0x150a('0x13')]));}process[_0x150a('0x17')](_0x3412d2[_0x150a('0x12')]['pid'],'SIGINT');return _0x156f77['status'](0xc8)['json']({'message':util['format'](_0x150a('0x18'),_0x3412d2['params'][_0x150a('0x13')])});})[_0x150a('0xe')](handleError(_0x156f77,null,_0x150a('0xf')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 2decab6..a47eb2f 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 _0x8a59=['post','create','put','destroy','exports','multer','connect-timeout','Router','../../components/auth/service','../../config/environment','./tag.controller','get','isAuthenticated'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x8a59,0x1a5));var _0x98a5=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x8a59[_0x45e98e];return _0x374dba;};'use strict';var multer=require(_0x98a5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x98a5('0x1'));var express=require('express');var router=express[_0x98a5('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x98a5('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x98a5('0x4'));var controller=require(_0x98a5('0x5'));router[_0x98a5('0x6')]('/',auth[_0x98a5('0x7')](),controller['index']);router[_0x98a5('0x6')]('/:id',auth[_0x98a5('0x7')](),controller['show']);router[_0x98a5('0x8')]('/',auth[_0x98a5('0x7')](),controller[_0x98a5('0x9')]);router[_0x98a5('0xa')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x98a5('0x7')](),controller[_0x98a5('0xb')]);module[_0x98a5('0xc')]=router; \ No newline at end of file +var _0xa6ee=['../../config/environment','get','isAuthenticated','show','create','put','/:id','update','exports','util','path','express','../../components/interaction/service'];(function(_0x2c6e81,_0x3f8d03){var _0x45d481=function(_0x1303a7){while(--_0x1303a7){_0x2c6e81['push'](_0x2c6e81['shift']());}};_0x45d481(++_0x3f8d03);}(_0xa6ee,0x1a9));var _0xea6e=function(_0x1166bb,_0x17f7a7){_0x1166bb=_0x1166bb-0x0;var _0x36ead4=_0xa6ee[_0x1166bb];return _0x36ead4;};'use strict';var multer=require('multer');var util=require(_0xea6e('0x0'));var path=require(_0xea6e('0x1'));var timeout=require('connect-timeout');var express=require(_0xea6e('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xea6e('0x3'));var config=require(_0xea6e('0x4'));var controller=require('./tag.controller');router[_0xea6e('0x5')]('/',auth[_0xea6e('0x6')](),controller['index']);router['get']('/:id',auth[_0xea6e('0x6')](),controller[_0xea6e('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0xea6e('0x8')]);router[_0xea6e('0x9')](_0xea6e('0xa'),auth[_0xea6e('0x6')](),controller[_0xea6e('0xb')]);router['delete']('/:id',auth[_0xea6e('0x6')](),controller['destroy']);module[_0xea6e('0xc')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index fd02b9e..e850a8c 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 _0x7e05=['sequelize','exports','name','#0091EA','STRING'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7e05,0x69));var _0x57e0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7e05[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x57e0('0x0'));module[_0x57e0('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x57e0('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x57e0('0x3')},'description':{'type':Sequelize[_0x57e0('0x4')]}}; \ No newline at end of file +var _0x2136=['#0091EA','sequelize','exports','STRING','name'];(function(_0x491fcf,_0x35ea5f){var _0x3d4795=function(_0x1b2c9b){while(--_0x1b2c9b){_0x491fcf['push'](_0x491fcf['shift']());}};_0x3d4795(++_0x35ea5f);}(_0x2136,0x1eb));var _0x6213=function(_0x1f4b18,_0x4e777c){_0x1f4b18=_0x1f4b18-0x0;var _0xde3957=_0x2136[_0x1f4b18];return _0xde3957;};'use strict';var Sequelize=require(_0x6213('0x0'));module[_0x6213('0x1')]={'name':{'type':Sequelize[_0x6213('0x2')],'unique':_0x6213('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x6213('0x2')],'defaultValue':_0x6213('0x4')},'description':{'type':Sequelize[_0x6213('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index b7b04ee..140f22f 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 _0xa8a8=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','save','update','then','get','Tags','UserProfileResource','destroy','error','name','send','index','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','map','type','options','Tag','catch','show','rawAttributes','includeAll','include','find','create','body','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x42e9ee,_0x5f4be1){var _0x502f42=function(_0x49d035){while(--_0x49d035){_0x42e9ee['push'](_0x42e9ee['shift']());}};_0x502f42(++_0x5f4be1);}(_0xa8a8,0xec));var _0x8a8a=function(_0x2637d5,_0x454f1e){_0x2637d5=_0x2637d5-0x0;var _0x5de732=_0xa8a8[_0x2637d5];return _0x5de732;};'use strict';var emlformat=require(_0x8a8a('0x0'));var rimraf=require(_0x8a8a('0x1'));var zipdir=require(_0x8a8a('0x2'));var jsonpatch=require(_0x8a8a('0x3'));var rp=require('request-promise');var moment=require(_0x8a8a('0x4'));var BPromise=require(_0x8a8a('0x5'));var Mustache=require(_0x8a8a('0x6'));var util=require(_0x8a8a('0x7'));var path=require(_0x8a8a('0x8'));var sox=require(_0x8a8a('0x9'));var csv=require(_0x8a8a('0xa'));var ejs=require(_0x8a8a('0xb'));var fs=require('fs');var fs_extra=require(_0x8a8a('0xc'));var _=require(_0x8a8a('0xd'));var squel=require(_0x8a8a('0xe'));var crypto=require(_0x8a8a('0xf'));var jsforce=require(_0x8a8a('0x10'));var deskjs=require(_0x8a8a('0x11'));var toCsv=require(_0x8a8a('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8a8a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8a8a('0x13'));var as=require(_0x8a8a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a8a('0x15'))(_0x8a8a('0x16'));var utils=require(_0x8a8a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x8a8a('0x18'));var db=require(_0x8a8a('0x19'))['db'];function respondWithStatusCode(_0x330796,_0x234481){_0x234481=_0x234481||0xcc;return function(_0x4a1b91){if(_0x4a1b91){return _0x330796[_0x8a8a('0x1a')](_0x234481);}return _0x330796['status'](_0x234481)[_0x8a8a('0x1b')]();};}function respondWithResult(_0xb2a3bc,_0x787eec){_0x787eec=_0x787eec||0xc8;return function(_0x2f6e33){if(_0x2f6e33){return _0xb2a3bc[_0x8a8a('0x1c')](_0x787eec)[_0x8a8a('0x1d')](_0x2f6e33);}};}function respondWithFilteredResult(_0x16d38d,_0x51ce75){return function(_0x1ed3be){if(_0x1ed3be){var _0x568b83=typeof _0x51ce75[_0x8a8a('0x1e')]===_0x8a8a('0x1f')&&typeof _0x51ce75[_0x8a8a('0x20')]===_0x8a8a('0x1f');var _0x42e8b6=_0x1ed3be['count'];var _0x9d55f9=_0x568b83?0x0:_0x51ce75[_0x8a8a('0x1e')];var _0x262ca9=_0x568b83?_0x1ed3be[_0x8a8a('0x21')]:_0x51ce75[_0x8a8a('0x1e')]+_0x51ce75[_0x8a8a('0x20')];var _0x4d7a45;if(_0x262ca9>=_0x42e8b6){_0x262ca9=_0x42e8b6;_0x4d7a45=0xc8;}else{_0x4d7a45=0xce;}_0x16d38d['status'](_0x4d7a45);return _0x16d38d['set']('Content-Range',_0x9d55f9+'-'+_0x262ca9+'/'+_0x42e8b6)['json'](_0x1ed3be);}return null;};}function patchUpdates(_0x3a9b2f){return function(_0x45095b){try{jsonpatch[_0x8a8a('0x22')](_0x45095b,_0x3a9b2f,!![]);}catch(_0x44719e){return BPromise[_0x8a8a('0x23')](_0x44719e);}return _0x45095b[_0x8a8a('0x24')]();};}function saveUpdates(_0x242bac,_0xe0321c){return function(_0x25d5d4){if(_0x25d5d4){return _0x25d5d4[_0x8a8a('0x25')](_0x242bac)[_0x8a8a('0x26')](function(_0x3aa2bb){return _0x3aa2bb;});}return null;};}function removeEntity(_0x3b4ece,_0x625c1b){return function(_0x442c00){if(_0x442c00){return _0x442c00['destroy']()[_0x8a8a('0x26')](function(){var _0x16c55b=_0x442c00[_0x8a8a('0x27')]({'plain':!![]});var _0x7662e=_0x8a8a('0x28');return db[_0x8a8a('0x29')][_0x8a8a('0x2a')]({'where':{'type':_0x7662e,'resourceId':_0x16c55b['id']}})['then'](function(){return _0x442c00;});})[_0x8a8a('0x26')](function(){_0x3b4ece[_0x8a8a('0x1c')](0xcc)[_0x8a8a('0x1b')]();});}};}function handleEntityNotFound(_0x54ff7e,_0x58f42b){return function(_0x2dafcd){if(!_0x2dafcd){_0x54ff7e[_0x8a8a('0x1a')](0x194);}return _0x2dafcd;};}function handleError(_0x5c70bd,_0x4d8760){_0x4d8760=_0x4d8760||0x1f4;return function(_0x4b3bc5){logger[_0x8a8a('0x2b')](_0x4b3bc5['stack']);if(_0x4b3bc5[_0x8a8a('0x2c')]){delete _0x4b3bc5[_0x8a8a('0x2c')];}_0x5c70bd['status'](_0x4d8760)[_0x8a8a('0x2d')](_0x4b3bc5);};}exports[_0x8a8a('0x2e')]=function(_0x250852,_0x8df0cb){var _0x41802e={},_0x3d6594={},_0x3e73b1={'count':0x0,'rows':[]};var _0x2a2917=_['map'](db['Tag']['rawAttributes'],function(_0x2a00a7){return{'name':_0x2a00a7[_0x8a8a('0x2f')],'type':_0x2a00a7['type'][_0x8a8a('0x30')]};});_0x3d6594[_0x8a8a('0x31')]=_['map'](_0x2a2917,_0x8a8a('0x2c'));_0x3d6594[_0x8a8a('0x32')]=_[_0x8a8a('0x33')](_0x250852['query']);_0x3d6594['filters']=_[_0x8a8a('0x34')](_0x3d6594['model'],_0x3d6594[_0x8a8a('0x32')]);_0x41802e[_0x8a8a('0x35')]=_[_0x8a8a('0x34')](_0x3d6594[_0x8a8a('0x31')],qs[_0x8a8a('0x36')](_0x250852[_0x8a8a('0x32')][_0x8a8a('0x36')]));_0x41802e[_0x8a8a('0x35')]=_0x41802e[_0x8a8a('0x35')][_0x8a8a('0x37')]?_0x41802e[_0x8a8a('0x35')]:_0x3d6594[_0x8a8a('0x31')];if(!_0x250852[_0x8a8a('0x32')][_0x8a8a('0x38')](_0x8a8a('0x39'))){_0x41802e[_0x8a8a('0x20')]=qs[_0x8a8a('0x20')](_0x250852[_0x8a8a('0x32')]['limit']);_0x41802e['offset']=qs['offset'](_0x250852[_0x8a8a('0x32')][_0x8a8a('0x1e')]);}_0x41802e[_0x8a8a('0x3a')]=qs[_0x8a8a('0x3b')](_0x250852[_0x8a8a('0x32')]['sort']);_0x41802e['where']=qs[_0x8a8a('0x3c')](_['pick'](_0x250852[_0x8a8a('0x32')],_0x3d6594['filters']),_0x2a2917);if(_0x250852['query'][_0x8a8a('0x3d')]){_0x41802e[_0x8a8a('0x3e')]=_[_0x8a8a('0x3f')](_0x41802e[_0x8a8a('0x3e')],{'$or':_[_0x8a8a('0x40')](_0x2a2917,function(_0x3a0e91){if(_0x3a0e91[_0x8a8a('0x41')]!=='VIRTUAL'){var _0x40d509={};_0x40d509[_0x3a0e91[_0x8a8a('0x2c')]]={'$like':'%'+_0x250852[_0x8a8a('0x32')]['filter']+'%'};return _0x40d509;}})});}_0x41802e=_[_0x8a8a('0x3f')]({},_0x41802e,_0x250852[_0x8a8a('0x42')]);var _0x3f845e={'where':_0x41802e['where']};return db[_0x8a8a('0x43')][_0x8a8a('0x21')](_0x3f845e)[_0x8a8a('0x26')](function(_0x19fd7a){_0x3e73b1[_0x8a8a('0x21')]=_0x19fd7a;if(_0x250852[_0x8a8a('0x32')]['includeAll']){_0x41802e['include']=[{'all':!![]}];}return db[_0x8a8a('0x43')]['findAll'](_0x41802e);})[_0x8a8a('0x26')](function(_0x1aa8b5){_0x3e73b1['rows']=_0x1aa8b5;return _0x3e73b1;})['then'](respondWithFilteredResult(_0x8df0cb,_0x41802e))[_0x8a8a('0x44')](handleError(_0x8df0cb,null));};exports[_0x8a8a('0x45')]=function(_0x41d986,_0x2c1b87){var _0x492596={'raw':!![],'where':{'id':_0x41d986['params']['id']}},_0x103223={};_0x103223[_0x8a8a('0x31')]=_[_0x8a8a('0x33')](db['Tag'][_0x8a8a('0x46')]);_0x103223[_0x8a8a('0x32')]=_[_0x8a8a('0x33')](_0x41d986['query']);_0x103223[_0x8a8a('0x3c')]=_[_0x8a8a('0x34')](_0x103223[_0x8a8a('0x31')],_0x103223['query']);_0x492596['attributes']=_[_0x8a8a('0x34')](_0x103223[_0x8a8a('0x31')],qs[_0x8a8a('0x36')](_0x41d986['query'][_0x8a8a('0x36')]));_0x492596[_0x8a8a('0x35')]=_0x492596[_0x8a8a('0x35')][_0x8a8a('0x37')]?_0x492596[_0x8a8a('0x35')]:_0x103223[_0x8a8a('0x31')];if(_0x41d986[_0x8a8a('0x32')][_0x8a8a('0x47')]){_0x492596[_0x8a8a('0x48')]=[{'all':!![]}];}_0x492596=_[_0x8a8a('0x3f')]({},_0x492596,_0x41d986[_0x8a8a('0x42')]);return db['Tag'][_0x8a8a('0x49')](_0x492596)[_0x8a8a('0x26')](handleEntityNotFound(_0x2c1b87,null))[_0x8a8a('0x26')](respondWithResult(_0x2c1b87,null))[_0x8a8a('0x44')](handleError(_0x2c1b87,null));};exports[_0x8a8a('0x4a')]=function(_0x2e22b0,_0x565a49){return db[_0x8a8a('0x43')][_0x8a8a('0x4a')](_0x2e22b0[_0x8a8a('0x4b')],{})[_0x8a8a('0x26')](function(_0x494df8){var _0x1faad3=_0x2e22b0[_0x8a8a('0x4c')][_0x8a8a('0x27')]({'plain':!![]});if(!_0x1faad3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1faad3['role']===_0x8a8a('0x4c')){var _0x39a8e0=_0x494df8[_0x8a8a('0x27')]({'plain':!![]});var _0x51d2e=_0x8a8a('0x28');return db[_0x8a8a('0x4d')][_0x8a8a('0x49')]({'where':{'name':_0x51d2e,'userProfileId':_0x1faad3[_0x8a8a('0x4e')]},'raw':!![]})[_0x8a8a('0x26')](function(_0x4ab312){if(_0x4ab312&&_0x4ab312['autoAssociation']===0x0){return db[_0x8a8a('0x29')][_0x8a8a('0x4a')]({'name':_0x39a8e0['name'],'resourceId':_0x39a8e0['id'],'type':_0x4ab312['name'],'sectionId':_0x4ab312['id']},{})[_0x8a8a('0x26')](function(){return _0x494df8;});}else{return _0x494df8;}})['catch'](function(_0x3faa28){logger['error'](_0x8a8a('0x4f'),_0x3faa28);throw _0x3faa28;});}return _0x494df8;})[_0x8a8a('0x26')](respondWithResult(_0x565a49,0xc9))[_0x8a8a('0x44')](handleError(_0x565a49,null));};exports[_0x8a8a('0x25')]=function(_0x330654,_0x14066f){if(_0x330654[_0x8a8a('0x4b')]['id']){delete _0x330654[_0x8a8a('0x4b')]['id'];}return db[_0x8a8a('0x43')][_0x8a8a('0x49')]({'where':{'id':_0x330654['params']['id']}})[_0x8a8a('0x26')](handleEntityNotFound(_0x14066f,null))[_0x8a8a('0x26')](saveUpdates(_0x330654[_0x8a8a('0x4b')],null))[_0x8a8a('0x26')](respondWithResult(_0x14066f,null))[_0x8a8a('0x44')](handleError(_0x14066f,null));};exports['destroy']=function(_0x428d57,_0x140673){return db['Tag']['find']({'where':{'id':_0x428d57[_0x8a8a('0x50')]['id']}})[_0x8a8a('0x26')](handleEntityNotFound(_0x140673,null))[_0x8a8a('0x26')](removeEntity(_0x140673,null))[_0x8a8a('0x44')](handleError(_0x140673,null));}; \ No newline at end of file +var _0xf72b=['sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','get','Tags','end','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','params','keys','create','body','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xf72b,0x1d9));var _0xbf72=function(_0x2a1f3d,_0x108153){_0x2a1f3d=_0x2a1f3d-0x0;var _0x48c9aa=_0xf72b[_0x2a1f3d];return _0x48c9aa;};'use strict';var emlformat=require(_0xbf72('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbf72('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbf72('0x2'));var moment=require(_0xbf72('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbf72('0x4'));var util=require(_0xbf72('0x5'));var path=require(_0xbf72('0x6'));var sox=require(_0xbf72('0x7'));var csv=require(_0xbf72('0x8'));var ejs=require(_0xbf72('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbf72('0xa'));var squel=require(_0xbf72('0xb'));var crypto=require(_0xbf72('0xc'));var jsforce=require(_0xbf72('0xd'));var deskjs=require(_0xbf72('0xe'));var toCsv=require(_0xbf72('0x8'));var querystring=require('querystring');var Papa=require(_0xbf72('0xf'));var Redis=require('ioredis');var authService=require(_0xbf72('0x10'));var qs=require(_0xbf72('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbf72('0x12'));var logger=require(_0xbf72('0x13'))(_0xbf72('0x14'));var utils=require(_0xbf72('0x15'));var config=require(_0xbf72('0x16'));var licenseUtil=require(_0xbf72('0x17'));var db=require(_0xbf72('0x18'))['db'];function respondWithStatusCode(_0x5eb4cc,_0x5967f5){_0x5967f5=_0x5967f5||0xcc;return function(_0x3bd500){if(_0x3bd500){return _0x5eb4cc[_0xbf72('0x19')](_0x5967f5);}return _0x5eb4cc[_0xbf72('0x1a')](_0x5967f5)['end']();};}function respondWithResult(_0x25255e,_0x4f4fa5){_0x4f4fa5=_0x4f4fa5||0xc8;return function(_0x5625b3){if(_0x5625b3){return _0x25255e['status'](_0x4f4fa5)[_0xbf72('0x1b')](_0x5625b3);}};}function respondWithFilteredResult(_0xb96906,_0x3af48d){return function(_0x723eb1){if(_0x723eb1){var _0x39d0cd=typeof _0x3af48d[_0xbf72('0x1c')]==='undefined'&&typeof _0x3af48d[_0xbf72('0x1d')]===_0xbf72('0x1e');var _0x2a8609=_0x723eb1[_0xbf72('0x1f')];var _0x27dadc=_0x39d0cd?0x0:_0x3af48d['offset'];var _0x51d4c9=_0x39d0cd?_0x723eb1[_0xbf72('0x1f')]:_0x3af48d[_0xbf72('0x1c')]+_0x3af48d[_0xbf72('0x1d')];var _0x2584d9;if(_0x51d4c9>=_0x2a8609){_0x51d4c9=_0x2a8609;_0x2584d9=0xc8;}else{_0x2584d9=0xce;}_0xb96906[_0xbf72('0x1a')](_0x2584d9);return _0xb96906[_0xbf72('0x20')](_0xbf72('0x21'),_0x27dadc+'-'+_0x51d4c9+'/'+_0x2a8609)['json'](_0x723eb1);}return null;};}function patchUpdates(_0x2aecae){return function(_0x42a193){try{jsonpatch[_0xbf72('0x22')](_0x42a193,_0x2aecae,!![]);}catch(_0x200139){return BPromise[_0xbf72('0x23')](_0x200139);}return _0x42a193['save']();};}function saveUpdates(_0x3cd181,_0x1de926){return function(_0x536071){if(_0x536071){return _0x536071[_0xbf72('0x24')](_0x3cd181)[_0xbf72('0x25')](function(_0x267c41){return _0x267c41;});}return null;};}function removeEntity(_0x4c7f3d,_0x44f3f9){return function(_0x428361){if(_0x428361){return _0x428361[_0xbf72('0x26')]()[_0xbf72('0x25')](function(){var _0x4f4dc0=_0x428361[_0xbf72('0x27')]({'plain':!![]});var _0x392a8c=_0xbf72('0x28');return db['UserProfileResource'][_0xbf72('0x26')]({'where':{'type':_0x392a8c,'resourceId':_0x4f4dc0['id']}})[_0xbf72('0x25')](function(){return _0x428361;});})[_0xbf72('0x25')](function(){_0x4c7f3d[_0xbf72('0x1a')](0xcc)[_0xbf72('0x29')]();});}};}function handleEntityNotFound(_0x2b1ff1,_0x182154){return function(_0x25ecdf){if(!_0x25ecdf){_0x2b1ff1[_0xbf72('0x19')](0x194);}return _0x25ecdf;};}function handleError(_0x92307f,_0x280d7a){_0x280d7a=_0x280d7a||0x1f4;return function(_0x20e747){logger[_0xbf72('0x2a')](_0x20e747[_0xbf72('0x2b')]);if(_0x20e747[_0xbf72('0x2c')]){delete _0x20e747['name'];}_0x92307f[_0xbf72('0x1a')](_0x280d7a)[_0xbf72('0x2d')](_0x20e747);};}exports[_0xbf72('0x2e')]=function(_0x28850d,_0xb1ee4e){var _0x82c0f0={},_0x35ecdc={},_0x209b2b={'count':0x0,'rows':[]};var _0x1be26a=_[_0xbf72('0x2f')](db[_0xbf72('0x30')][_0xbf72('0x31')],function(_0x423c61){return{'name':_0x423c61[_0xbf72('0x32')],'type':_0x423c61['type'][_0xbf72('0x33')]};});_0x35ecdc[_0xbf72('0x34')]=_[_0xbf72('0x2f')](_0x1be26a,'name');_0x35ecdc['query']=_['keys'](_0x28850d[_0xbf72('0x35')]);_0x35ecdc[_0xbf72('0x36')]=_[_0xbf72('0x37')](_0x35ecdc['model'],_0x35ecdc[_0xbf72('0x35')]);_0x82c0f0[_0xbf72('0x38')]=_['intersection'](_0x35ecdc[_0xbf72('0x34')],qs['fields'](_0x28850d[_0xbf72('0x35')][_0xbf72('0x39')]));_0x82c0f0['attributes']=_0x82c0f0['attributes'][_0xbf72('0x3a')]?_0x82c0f0[_0xbf72('0x38')]:_0x35ecdc[_0xbf72('0x34')];if(!_0x28850d[_0xbf72('0x35')][_0xbf72('0x3b')](_0xbf72('0x3c'))){_0x82c0f0[_0xbf72('0x1d')]=qs[_0xbf72('0x1d')](_0x28850d[_0xbf72('0x35')]['limit']);_0x82c0f0[_0xbf72('0x1c')]=qs[_0xbf72('0x1c')](_0x28850d[_0xbf72('0x35')][_0xbf72('0x1c')]);}_0x82c0f0['order']=qs[_0xbf72('0x3d')](_0x28850d[_0xbf72('0x35')]['sort']);_0x82c0f0[_0xbf72('0x3e')]=qs['filters'](_['pick'](_0x28850d['query'],_0x35ecdc['filters']),_0x1be26a);if(_0x28850d[_0xbf72('0x35')]['filter']){_0x82c0f0['where']=_[_0xbf72('0x3f')](_0x82c0f0['where'],{'$or':_[_0xbf72('0x2f')](_0x1be26a,function(_0xde4ed9){if(_0xde4ed9['type']!==_0xbf72('0x40')){var _0x4aee64={};_0x4aee64[_0xde4ed9['name']]={'$like':'%'+_0x28850d[_0xbf72('0x35')][_0xbf72('0x41')]+'%'};return _0x4aee64;}})});}_0x82c0f0=_[_0xbf72('0x3f')]({},_0x82c0f0,_0x28850d[_0xbf72('0x42')]);var _0xffb333={'where':_0x82c0f0[_0xbf72('0x3e')]};return db[_0xbf72('0x30')][_0xbf72('0x1f')](_0xffb333)['then'](function(_0x311a0c){_0x209b2b[_0xbf72('0x1f')]=_0x311a0c;if(_0x28850d['query'][_0xbf72('0x43')]){_0x82c0f0['include']=[{'all':!![]}];}return db['Tag'][_0xbf72('0x44')](_0x82c0f0);})[_0xbf72('0x25')](function(_0x3992fd){_0x209b2b[_0xbf72('0x45')]=_0x3992fd;return _0x209b2b;})[_0xbf72('0x25')](respondWithFilteredResult(_0xb1ee4e,_0x82c0f0))['catch'](handleError(_0xb1ee4e,null));};exports['show']=function(_0x4b8f31,_0x359c2b){var _0x3a7828={'raw':!![],'where':{'id':_0x4b8f31[_0xbf72('0x46')]['id']}},_0x3871d0={};_0x3871d0['model']=_['keys'](db[_0xbf72('0x30')]['rawAttributes']);_0x3871d0[_0xbf72('0x35')]=_[_0xbf72('0x47')](_0x4b8f31[_0xbf72('0x35')]);_0x3871d0[_0xbf72('0x36')]=_['intersection'](_0x3871d0[_0xbf72('0x34')],_0x3871d0[_0xbf72('0x35')]);_0x3a7828[_0xbf72('0x38')]=_[_0xbf72('0x37')](_0x3871d0['model'],qs[_0xbf72('0x39')](_0x4b8f31[_0xbf72('0x35')]['fields']));_0x3a7828[_0xbf72('0x38')]=_0x3a7828[_0xbf72('0x38')][_0xbf72('0x3a')]?_0x3a7828[_0xbf72('0x38')]:_0x3871d0[_0xbf72('0x34')];if(_0x4b8f31[_0xbf72('0x35')][_0xbf72('0x43')]){_0x3a7828['include']=[{'all':!![]}];}_0x3a7828=_['merge']({},_0x3a7828,_0x4b8f31['options']);return db[_0xbf72('0x30')]['find'](_0x3a7828)[_0xbf72('0x25')](handleEntityNotFound(_0x359c2b,null))['then'](respondWithResult(_0x359c2b,null))['catch'](handleError(_0x359c2b,null));};exports['create']=function(_0x9f94ea,_0x15a271){return db[_0xbf72('0x30')][_0xbf72('0x48')](_0x9f94ea[_0xbf72('0x49')],{})[_0xbf72('0x25')](function(_0x530663){var _0x3ffa72=_0x9f94ea['user'][_0xbf72('0x27')]({'plain':!![]});if(!_0x3ffa72)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ffa72[_0xbf72('0x4a')]===_0xbf72('0x4b')){var _0x45e4d5=_0x530663[_0xbf72('0x27')]({'plain':!![]});var _0x26ce94=_0xbf72('0x28');return db[_0xbf72('0x4c')][_0xbf72('0x4d')]({'where':{'name':_0x26ce94,'userProfileId':_0x3ffa72[_0xbf72('0x4e')]},'raw':!![]})['then'](function(_0x1fb168){if(_0x1fb168&&_0x1fb168[_0xbf72('0x4f')]===0x0){return db[_0xbf72('0x50')]['create']({'name':_0x45e4d5[_0xbf72('0x2c')],'resourceId':_0x45e4d5['id'],'type':_0x1fb168[_0xbf72('0x2c')],'sectionId':_0x1fb168['id']},{})[_0xbf72('0x25')](function(){return _0x530663;});}else{return _0x530663;}})[_0xbf72('0x51')](function(_0x824918){logger['error'](_0xbf72('0x52'),_0x824918);throw _0x824918;});}return _0x530663;})[_0xbf72('0x25')](respondWithResult(_0x15a271,0xc9))['catch'](handleError(_0x15a271,null));};exports[_0xbf72('0x24')]=function(_0x5e2dcd,_0x58080b){if(_0x5e2dcd[_0xbf72('0x49')]['id']){delete _0x5e2dcd[_0xbf72('0x49')]['id'];}return db[_0xbf72('0x30')][_0xbf72('0x4d')]({'where':{'id':_0x5e2dcd[_0xbf72('0x46')]['id']}})['then'](handleEntityNotFound(_0x58080b,null))['then'](saveUpdates(_0x5e2dcd['body'],null))[_0xbf72('0x25')](respondWithResult(_0x58080b,null))[_0xbf72('0x51')](handleError(_0x58080b,null));};exports[_0xbf72('0x26')]=function(_0x1648d0,_0x5cfbc4){return db['Tag'][_0xbf72('0x4d')]({'where':{'id':_0x1648d0[_0xbf72('0x46')]['id']}})[_0xbf72('0x25')](handleEntityNotFound(_0x5cfbc4,null))['then'](removeEntity(_0x5cfbc4,null))[_0xbf72('0x51')](handleError(_0x5cfbc4,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 0e0e173..31cdae7 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 _0x6f88=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags'];(function(_0x1f4d27,_0x59fdb6){var _0x519243=function(_0x3b7e62){while(--_0x3b7e62){_0x1f4d27['push'](_0x1f4d27['shift']());}};_0x519243(++_0x59fdb6);}(_0x6f88,0x134));var _0x86f8=function(_0x3c08b4,_0x52318d){_0x3c08b4=_0x3c08b4-0x0;var _0x5c200f=_0x6f88[_0x3c08b4];return _0x5c200f;};'use strict';var _=require(_0x86f8('0x0'));var util=require(_0x86f8('0x1'));var logger=require(_0x86f8('0x2'))(_0x86f8('0x3'));var moment=require(_0x86f8('0x4'));var BPromise=require('bluebird');var rp=require(_0x86f8('0x5'));var fs=require('fs');var path=require(_0x86f8('0x6'));var rimraf=require(_0x86f8('0x7'));var config=require(_0x86f8('0x8'));var attributes=require(_0x86f8('0x9'));module[_0x86f8('0xa')]=function(_0x53b79b,_0x2368c4){return _0x53b79b[_0x86f8('0xb')](_0x86f8('0xc'),attributes,{'tableName':_0x86f8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b60=['./tag.attributes','exports','Tag','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xc11eb7,_0x14c399){var _0x442a61=function(_0x2b9d70){while(--_0x2b9d70){_0xc11eb7['push'](_0xc11eb7['shift']());}};_0x442a61(++_0x14c399);}(_0x2b60,0x189));var _0x02b6=function(_0x3cb8e7,_0x323f8a){_0x3cb8e7=_0x3cb8e7-0x0;var _0x1ce364=_0x2b60[_0x3cb8e7];return _0x1ce364;};'use strict';var _=require(_0x02b6('0x0'));var util=require('util');var logger=require(_0x02b6('0x1'))(_0x02b6('0x2'));var moment=require(_0x02b6('0x3'));var BPromise=require(_0x02b6('0x4'));var rp=require(_0x02b6('0x5'));var fs=require('fs');var path=require(_0x02b6('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x02b6('0x7'));module[_0x02b6('0x8')]=function(_0x3dc913,_0x52bd19){return _0x3dc913['define'](_0x02b6('0x9'),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 3a4bf97..78314df 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 _0x37f8=['catch','util','moment','bluebird','randomstring','../../mysqldb','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xfedc72,_0x292f02){var _0x2c7c78=function(_0x12fbf1){while(--_0x12fbf1){_0xfedc72['push'](_0xfedc72['shift']());}};_0x2c7c78(++_0x292f02);}(_0x37f8,0xd2));var _0x837f=function(_0x4c64b5,_0x188653){_0x4c64b5=_0x4c64b5-0x0;var _0x244f8f=_0x37f8[_0x4c64b5];return _0x244f8f;};'use strict';var _=require('lodash');var util=require(_0x837f('0x0'));var moment=require(_0x837f('0x1'));var BPromise=require(_0x837f('0x2'));var rs=require(_0x837f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x837f('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[_0x837f('0x5')][_0x837f('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x224ad2,_0x40270f,_0x4111cb){return new BPromise(function(_0x25bbcb,_0x12c732){return client[_0x837f('0x7')](_0x224ad2,_0x4111cb)[_0x837f('0x8')](function(_0x2f1dc7){logger[_0x837f('0x9')](_0x837f('0xa'),_0x40270f,_0x837f('0xb'));logger[_0x837f('0xc')](_0x837f('0xd'),_0x40270f,'request\x20sent',JSON[_0x837f('0xe')](_0x2f1dc7));if(_0x2f1dc7[_0x837f('0xf')]){if(_0x2f1dc7[_0x837f('0xf')][_0x837f('0x10')]===0x1f4){logger[_0x837f('0xf')]('Tag,\x20%s,\x20%s',_0x40270f,_0x2f1dc7['error'][_0x837f('0x11')]);return _0x12c732(_0x2f1dc7[_0x837f('0xf')][_0x837f('0x11')]);}logger[_0x837f('0xf')](_0x837f('0xa'),_0x40270f,_0x2f1dc7['error'][_0x837f('0x11')]);return _0x25bbcb(_0x2f1dc7[_0x837f('0xf')][_0x837f('0x11')]);}else{logger[_0x837f('0x9')](_0x837f('0xa'),_0x40270f,_0x837f('0xb'));_0x25bbcb(_0x2f1dc7['result'][_0x837f('0x11')]);}})[_0x837f('0x12')](function(_0x47bbe7){logger[_0x837f('0xf')](_0x837f('0xa'),_0x40270f,_0x47bbe7);_0x12c732(_0x47bbe7);});});} \ No newline at end of file +var _0xf873=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5cd65a,_0x301f8f){var _0x1606f8=function(_0x573494){while(--_0x573494){_0x5cd65a['push'](_0x5cd65a['shift']());}};_0x1606f8(++_0x301f8f);}(_0xf873,0xb2));var _0x3f87=function(_0x13be3e,_0x33eaea){_0x13be3e=_0x13be3e-0x0;var _0x375312=_0xf873[_0x13be3e];return _0x375312;};'use strict';var _=require('lodash');var util=require(_0x3f87('0x0'));var moment=require(_0x3f87('0x1'));var BPromise=require(_0x3f87('0x2'));var rs=require(_0x3f87('0x3'));var fs=require('fs');var Redis=require(_0x3f87('0x4'));var db=require(_0x3f87('0x5'))['db'];var utils=require(_0x3f87('0x6'));var logger=require(_0x3f87('0x7'))(_0x3f87('0x8'));var config=require('../../config/environment');var jayson=require(_0x3f87('0x9'));var client=jayson[_0x3f87('0xa')][_0x3f87('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a5e37,_0x8bf89b,_0x2c7ccc){return new BPromise(function(_0x3b8e92,_0x41faf2){return client[_0x3f87('0xc')](_0x5a5e37,_0x2c7ccc)[_0x3f87('0xd')](function(_0x4c3ed4){logger[_0x3f87('0xe')](_0x3f87('0xf'),_0x8bf89b,_0x3f87('0x10'));logger[_0x3f87('0x11')](_0x3f87('0x12'),_0x8bf89b,_0x3f87('0x10'),JSON[_0x3f87('0x13')](_0x4c3ed4));if(_0x4c3ed4[_0x3f87('0x14')]){if(_0x4c3ed4[_0x3f87('0x14')][_0x3f87('0x15')]===0x1f4){logger[_0x3f87('0x14')](_0x3f87('0xf'),_0x8bf89b,_0x4c3ed4[_0x3f87('0x14')][_0x3f87('0x16')]);return _0x41faf2(_0x4c3ed4['error'][_0x3f87('0x16')]);}logger[_0x3f87('0x14')]('Tag,\x20%s,\x20%s',_0x8bf89b,_0x4c3ed4[_0x3f87('0x14')][_0x3f87('0x16')]);return _0x3b8e92(_0x4c3ed4[_0x3f87('0x14')][_0x3f87('0x16')]);}else{logger[_0x3f87('0xe')](_0x3f87('0xf'),_0x8bf89b,_0x3f87('0x10'));_0x3b8e92(_0x4c3ed4[_0x3f87('0x17')]['message']);}})[_0x3f87('0x18')](function(_0x3ac7a7){logger[_0x3f87('0x14')]('Tag,\x20%s,\x20%s',_0x8bf89b,_0x3ac7a7);_0x41faf2(_0x3ac7a7);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 8d5c16f..4d3c758 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(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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 5651e58..b0467a2 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 _0x2032=['name','exports','STRING'];(function(_0x5178c5,_0x12938b){var _0x4d67d5=function(_0x1f3c2c){while(--_0x1f3c2c){_0x5178c5['push'](_0x5178c5['shift']());}};_0x4d67d5(++_0x12938b);}(_0x2032,0xd9));var _0x2203=function(_0x2bedd,_0x1f4ab6){_0x2bedd=_0x2bedd-0x0;var _0x52b9d9=_0x2032[_0x2bedd];return _0x52b9d9;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x757a=['exports','STRING'];(function(_0x86e25c,_0x225c84){var _0x28c584=function(_0x1ff151){while(--_0x1ff151){_0x86e25c['push'](_0x86e25c['shift']());}};_0x28c584(++_0x225c84);}(_0x757a,0xde));var _0xa757=function(_0x1292d4,_0x3a0ce0){_0x1292d4=_0x1292d4-0x0;var _0x5e695a=_0x757a[_0x1292d4];return _0x5e695a;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 4a12738..1e09c7a 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 _0xb75d=['findOrCreate','emit','voicePause','UserVoiceQueueRt','upsert','isNil','interface','format','SIP/%s','all','VoicePrefixId','addAgents','spread','removeAgents','Chat','Whatsapp','Queue:remove','getAgents','hasOwnProperty','eml-format','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','register','end','status','json','offset','limit','count','set','Content-Range','apply','save','update','then','name','send','index','Team','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','includeAll','findAll','rows','catch','params','rawAttributes','find','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','sequelize','transaction','Sequelize','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','TeamVoicePrefix','UserVoicePrefix','getQueues','channel','isValidChannel','toLowerCase','Queue','addQueues','Unknown\x20channel','capitalize','Queues','ids','removeQueues','findOne','ValidationError','remove','isArray','Voice','Mail','Sms','Fax','Openchannel','penalty','QueueId','TeamVoiceQueue','User'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb75d,0x1cc));var _0xdb75=function(_0x6e1239,_0x3562ac){_0x6e1239=_0x6e1239-0x0;var _0x418150=_0xb75d[_0x6e1239];return _0x418150;};'use strict';var emlformat=require(_0xdb75('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdb75('0x1'));var BPromise=require(_0xdb75('0x2'));var Mustache=require(_0xdb75('0x3'));var util=require(_0xdb75('0x4'));var path=require('path');var sox=require(_0xdb75('0x5'));var csv=require(_0xdb75('0x6'));var ejs=require(_0xdb75('0x7'));var fs=require('fs');var fs_extra=require(_0xdb75('0x8'));var _=require(_0xdb75('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdb75('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xdb75('0x6'));var querystring=require(_0xdb75('0xb'));var Papa=require('papaparse');var Redis=require(_0xdb75('0xc'));var authService=require(_0xdb75('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xdb75('0xe'));var hardwareService=require(_0xdb75('0xf'));var logger=require(_0xdb75('0x10'))(_0xdb75('0x11'));var utils=require('../../config/utils');var config=require(_0xdb75('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xdb75('0x13'))['db'];config[_0xdb75('0x14')]=_['defaults'](config[_0xdb75('0x14')],{'host':_0xdb75('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdb75('0x14')]));require('./team.socket')[_0xdb75('0x16')](socket);function respondWithStatusCode(_0x32a9fb,_0x522536){_0x522536=_0x522536||0xcc;return function(_0x5873e2){if(_0x5873e2){return _0x32a9fb['sendStatus'](_0x522536);}return _0x32a9fb['status'](_0x522536)[_0xdb75('0x17')]();};}function respondWithResult(_0x358e44,_0x1e4769){_0x1e4769=_0x1e4769||0xc8;return function(_0x1a1e25){if(_0x1a1e25){return _0x358e44[_0xdb75('0x18')](_0x1e4769)[_0xdb75('0x19')](_0x1a1e25);}};}function respondWithFilteredResult(_0x11ef0f,_0x221d33){return function(_0xec8ae1){if(_0xec8ae1){var _0x12dd6d=typeof _0x221d33[_0xdb75('0x1a')]==='undefined'&&typeof _0x221d33[_0xdb75('0x1b')]==='undefined';var _0x2f3527=_0xec8ae1[_0xdb75('0x1c')];var _0xfd5fe7=_0x12dd6d?0x0:_0x221d33[_0xdb75('0x1a')];var _0x51a31d=_0x12dd6d?_0xec8ae1[_0xdb75('0x1c')]:_0x221d33[_0xdb75('0x1a')]+_0x221d33[_0xdb75('0x1b')];var _0x203b21;if(_0x51a31d>=_0x2f3527){_0x51a31d=_0x2f3527;_0x203b21=0xc8;}else{_0x203b21=0xce;}_0x11ef0f['status'](_0x203b21);return _0x11ef0f[_0xdb75('0x1d')](_0xdb75('0x1e'),_0xfd5fe7+'-'+_0x51a31d+'/'+_0x2f3527)['json'](_0xec8ae1);}return null;};}function patchUpdates(_0x24f64c){return function(_0x22253){try{jsonpatch[_0xdb75('0x1f')](_0x22253,_0x24f64c,!![]);}catch(_0x11054f){return BPromise['reject'](_0x11054f);}return _0x22253[_0xdb75('0x20')]();};}function saveUpdates(_0x2d6f24,_0x254419){return function(_0x39cfe8){if(_0x39cfe8){return _0x39cfe8[_0xdb75('0x21')](_0x2d6f24)[_0xdb75('0x22')](function(_0x1534a9){return _0x1534a9;});}return null;};}function handleEntityNotFound(_0x38a626,_0x4c7d23){return function(_0xdd38ea){if(!_0xdd38ea){_0x38a626['sendStatus'](0x194);}return _0xdd38ea;};}function handleError(_0x27510a,_0x39d984){_0x39d984=_0x39d984||0x1f4;return function(_0x6c1753){logger['error'](_0x6c1753['stack']);if(_0x6c1753[_0xdb75('0x23')]){delete _0x6c1753[_0xdb75('0x23')];}_0x27510a[_0xdb75('0x18')](_0x39d984)[_0xdb75('0x24')](_0x6c1753);};}exports[_0xdb75('0x25')]=function(_0x28ac4b,_0x366d7f){var _0x2c911f={},_0xa449cb={},_0x47d857={'count':0x0,'rows':[]};var _0x44c662=_['map'](db[_0xdb75('0x26')]['rawAttributes'],function(_0x2939bd){return{'name':_0x2939bd[_0xdb75('0x27')],'type':_0x2939bd['type'][_0xdb75('0x28')]};});_0xa449cb[_0xdb75('0x29')]=_['map'](_0x44c662,_0xdb75('0x23'));_0xa449cb[_0xdb75('0x2a')]=_[_0xdb75('0x2b')](_0x28ac4b[_0xdb75('0x2a')]);_0xa449cb[_0xdb75('0x2c')]=_[_0xdb75('0x2d')](_0xa449cb[_0xdb75('0x29')],_0xa449cb['query']);_0x2c911f[_0xdb75('0x2e')]=_[_0xdb75('0x2d')](_0xa449cb[_0xdb75('0x29')],qs[_0xdb75('0x2f')](_0x28ac4b['query'][_0xdb75('0x2f')]));_0x2c911f[_0xdb75('0x2e')]=_0x2c911f[_0xdb75('0x2e')][_0xdb75('0x30')]?_0x2c911f['attributes']:_0xa449cb[_0xdb75('0x29')];if(!_0x28ac4b[_0xdb75('0x2a')]['hasOwnProperty'](_0xdb75('0x31'))){_0x2c911f[_0xdb75('0x1b')]=qs['limit'](_0x28ac4b[_0xdb75('0x2a')][_0xdb75('0x1b')]);_0x2c911f[_0xdb75('0x1a')]=qs[_0xdb75('0x1a')](_0x28ac4b[_0xdb75('0x2a')][_0xdb75('0x1a')]);}_0x2c911f[_0xdb75('0x32')]=qs[_0xdb75('0x33')](_0x28ac4b[_0xdb75('0x2a')][_0xdb75('0x33')]);_0x2c911f[_0xdb75('0x34')]=qs[_0xdb75('0x2c')](_[_0xdb75('0x35')](_0x28ac4b['query'],_0xa449cb['filters']),_0x44c662);if(_0x28ac4b[_0xdb75('0x2a')][_0xdb75('0x36')]){_0x2c911f[_0xdb75('0x34')]=_[_0xdb75('0x37')](_0x2c911f[_0xdb75('0x34')],{'$or':_[_0xdb75('0x38')](_0x44c662,function(_0x53ac28){if(_0x53ac28[_0xdb75('0x39')]!==_0xdb75('0x3a')){var _0x32d053={};_0x32d053[_0x53ac28[_0xdb75('0x23')]]={'$like':'%'+_0x28ac4b[_0xdb75('0x2a')][_0xdb75('0x36')]+'%'};return _0x32d053;}})});}_0x2c911f=_[_0xdb75('0x37')]({},_0x2c911f,_0x28ac4b[_0xdb75('0x3b')]);var _0x531cde={'where':_0x2c911f['where']};return db['Team']['count'](_0x531cde)[_0xdb75('0x22')](function(_0x349a99){_0x47d857[_0xdb75('0x1c')]=_0x349a99;if(_0x28ac4b['query'][_0xdb75('0x3c')]){_0x2c911f['include']=[{'all':!![]}];}return db[_0xdb75('0x26')][_0xdb75('0x3d')](_0x2c911f);})[_0xdb75('0x22')](function(_0xd3e7){_0x47d857[_0xdb75('0x3e')]=_0xd3e7;return _0x47d857;})[_0xdb75('0x22')](respondWithFilteredResult(_0x366d7f,_0x2c911f))[_0xdb75('0x3f')](handleError(_0x366d7f,null));};exports['show']=function(_0x1d0c03,_0x39e408){var _0x338838={'raw':![],'where':{'id':_0x1d0c03[_0xdb75('0x40')]['id']}},_0x1fa1ac={};_0x1fa1ac[_0xdb75('0x29')]=_[_0xdb75('0x2b')](db[_0xdb75('0x26')][_0xdb75('0x41')]);_0x1fa1ac[_0xdb75('0x2a')]=_['keys'](_0x1d0c03[_0xdb75('0x2a')]);_0x1fa1ac[_0xdb75('0x2c')]=_['intersection'](_0x1fa1ac[_0xdb75('0x29')],_0x1fa1ac[_0xdb75('0x2a')]);_0x338838[_0xdb75('0x2e')]=_['intersection'](_0x1fa1ac[_0xdb75('0x29')],qs['fields'](_0x1d0c03[_0xdb75('0x2a')]['fields']));_0x338838[_0xdb75('0x2e')]=_0x338838[_0xdb75('0x2e')][_0xdb75('0x30')]?_0x338838[_0xdb75('0x2e')]:_0x1fa1ac[_0xdb75('0x29')];if(_0x1d0c03[_0xdb75('0x2a')][_0xdb75('0x3c')]){_0x338838['include']=[{'all':!![]}];}_0x338838=_[_0xdb75('0x37')]({},_0x338838,_0x1d0c03['options']);return db[_0xdb75('0x26')][_0xdb75('0x42')](_0x338838)[_0xdb75('0x22')](handleEntityNotFound(_0x39e408,null))[_0xdb75('0x22')](respondWithResult(_0x39e408,null))['catch'](handleError(_0x39e408,null));};exports['create']=function(_0x2007bc,_0x1ecc14){return db[_0xdb75('0x26')]['create'](_0x2007bc['body'],{})[_0xdb75('0x22')](function(_0xfdd527){var _0x3f341f=_0x2007bc[_0xdb75('0x43')][_0xdb75('0x44')]({'plain':!![]});if(!_0x3f341f)throw new Error(_0xdb75('0x45'));if(_0x3f341f[_0xdb75('0x46')]==='user'){var _0xceeca5=_0xfdd527['get']({'plain':!![]});var _0x5dd13b=_0xdb75('0x47');return db[_0xdb75('0x48')][_0xdb75('0x42')]({'where':{'name':_0x5dd13b,'userProfileId':_0x3f341f[_0xdb75('0x49')]},'raw':!![]})[_0xdb75('0x22')](function(_0x3e9d91){if(_0x3e9d91&&_0x3e9d91[_0xdb75('0x4a')]===0x0){return db[_0xdb75('0x4b')][_0xdb75('0x4c')]({'name':_0xceeca5[_0xdb75('0x23')],'resourceId':_0xceeca5['id'],'type':_0x3e9d91[_0xdb75('0x23')],'sectionId':_0x3e9d91['id']},{})[_0xdb75('0x22')](function(){return _0xfdd527;});}else{return _0xfdd527;}})[_0xdb75('0x3f')](function(_0x256fe5){logger[_0xdb75('0x4d')](_0xdb75('0x4e'),_0x256fe5);throw _0x256fe5;});}return _0xfdd527;})['then'](respondWithResult(_0x1ecc14,0xc9))[_0xdb75('0x3f')](handleError(_0x1ecc14,null));};exports[_0xdb75('0x21')]=function(_0x59c2fe,_0x49f25d){if(_0x59c2fe[_0xdb75('0x4f')]['id']){delete _0x59c2fe[_0xdb75('0x4f')]['id'];}return db[_0xdb75('0x26')][_0xdb75('0x42')]({'where':{'id':_0x59c2fe[_0xdb75('0x40')]['id']}})[_0xdb75('0x22')](handleEntityNotFound(_0x49f25d,null))['then'](saveUpdates(_0x59c2fe['body'],null))[_0xdb75('0x22')](respondWithResult(_0x49f25d,null))[_0xdb75('0x3f')](handleError(_0x49f25d,null));};exports[_0xdb75('0x50')]=function(_0x4b648a,_0x26ae14){var _0x59097b=_0x4b648a[_0xdb75('0x40')]['id'];var _0x4c7440=[];return db[_0xdb75('0x51')][_0xdb75('0x52')](function(_0x49a0ff){var _0x48607d='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x59097b;return db[_0xdb75('0x51')]['query'](_0x48607d,{'type':db[_0xdb75('0x53')][_0xdb75('0x54')]['SELECT'],'raw':!![],'transaction':_0x49a0ff})[_0xdb75('0x22')](function(_0x403361){_0x4c7440=_[_0xdb75('0x38')](_0x403361,function(_0x3c6666){return Number(_0x3c6666[_0xdb75('0x55')]);});})[_0xdb75('0x22')](function(){var _0x174c81=_0xdb75('0x56')+_0x59097b;return db[_0xdb75('0x51')]['query'](_0x174c81,{'type':db[_0xdb75('0x53')][_0xdb75('0x54')][_0xdb75('0x57')],'raw':!![],'transaction':_0x49a0ff});})[_0xdb75('0x22')](function(_0x19831){var _0x276b07=_[_0xdb75('0x38')](_0x19831,function(_0x41b19c){return Number(_0x41b19c['VoiceQueueId']);});return db[_0xdb75('0x58')][_0xdb75('0x50')]({'where':{'UserId':{'$in':_0x4c7440},'VoiceQueueId':{'$in':_0x276b07}},'transaction':_0x49a0ff});})[_0xdb75('0x22')](function(){var _0xfd2834=_0xdb75('0x59')+_0x59097b;return db[_0xdb75('0x51')]['query'](_0xfd2834,{'type':db['Sequelize'][_0xdb75('0x54')]['SELECT'],'raw':!![],'transaction':_0x49a0ff});})[_0xdb75('0x22')](function(_0x22865d){var _0x3acc13=_[_0xdb75('0x38')](_0x22865d,function(_0x4bfc26){return Number(_0x4bfc26[_0xdb75('0x5a')]);});return db['UserMailQueue'][_0xdb75('0x50')]({'where':{'UserId':{'$in':_0x4c7440},'MailQueueId':{'$in':_0x3acc13}},'transaction':_0x49a0ff});})[_0xdb75('0x22')](function(){var _0x20327f=_0xdb75('0x5b')+_0x59097b;return db[_0xdb75('0x51')][_0xdb75('0x2a')](_0x20327f,{'type':db[_0xdb75('0x53')][_0xdb75('0x54')][_0xdb75('0x57')],'raw':!![],'transaction':_0x49a0ff});})['then'](function(_0x5e7eaf){var _0xe17f1b=_[_0xdb75('0x38')](_0x5e7eaf,function(_0x9ec278){return Number(_0x9ec278[_0xdb75('0x5c')]);});return db[_0xdb75('0x5d')][_0xdb75('0x50')]({'where':{'UserId':{'$in':_0x4c7440},'SmsQueueId':{'$in':_0xe17f1b}},'transaction':_0x49a0ff});})[_0xdb75('0x22')](function(){var _0x5c7028=_0xdb75('0x5e')+_0x59097b;return db['sequelize'][_0xdb75('0x2a')](_0x5c7028,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x49a0ff});})[_0xdb75('0x22')](function(_0x13d41a){var _0x13b584=_[_0xdb75('0x38')](_0x13d41a,function(_0x4ce74b){return Number(_0x4ce74b[_0xdb75('0x5f')]);});return db[_0xdb75('0x60')][_0xdb75('0x50')]({'where':{'UserId':{'$in':_0x4c7440},'ChatQueueId':{'$in':_0x13b584}},'transaction':_0x49a0ff});})[_0xdb75('0x22')](function(){var _0x13bb84=_0xdb75('0x61')+_0x59097b;return db[_0xdb75('0x51')][_0xdb75('0x2a')](_0x13bb84,{'type':db['Sequelize'][_0xdb75('0x54')]['SELECT'],'raw':!![],'transaction':_0x49a0ff});})[_0xdb75('0x22')](function(_0x3e4ef0){var _0x26a865=_[_0xdb75('0x38')](_0x3e4ef0,function(_0xef7236){return Number(_0xef7236[_0xdb75('0x62')]);});return db['UserFaxQueue'][_0xdb75('0x50')]({'where':{'UserId':{'$in':_0x4c7440},'FaxQueueId':{'$in':_0x26a865}},'transaction':_0x49a0ff});})[_0xdb75('0x22')](function(){var _0xd09571='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x59097b;return db[_0xdb75('0x51')][_0xdb75('0x2a')](_0xd09571,{'type':db[_0xdb75('0x53')]['QueryTypes'][_0xdb75('0x57')],'raw':!![],'transaction':_0x49a0ff});})[_0xdb75('0x22')](function(_0x3aae4b){var _0x2a4541=_[_0xdb75('0x38')](_0x3aae4b,function(_0x637636){return Number(_0x637636[_0xdb75('0x63')]);});return db['UserOpenchannelQueue'][_0xdb75('0x50')]({'where':{'UserId':{'$in':_0x4c7440},'OpenchannelQueueId':{'$in':_0x2a4541}},'transaction':_0x49a0ff});})[_0xdb75('0x22')](function(){var _0x28ff90=_0xdb75('0x64')+_0x59097b;return db[_0xdb75('0x51')]['query'](_0x28ff90,{'type':db['Sequelize'][_0xdb75('0x54')][_0xdb75('0x57')],'raw':!![],'transaction':_0x49a0ff});})[_0xdb75('0x22')](function(_0x9dbd65){var _0x5474f6=_['map'](_0x9dbd65,function(_0x2175ee){return Number(_0x2175ee[_0xdb75('0x65')]);});return db['UserWhatsappQueue'][_0xdb75('0x50')]({'where':{'UserId':{'$in':_0x4c7440},'WhatsappQueueId':{'$in':_0x5474f6}},'transaction':_0x49a0ff});})[_0xdb75('0x22')](function(){return db[_0xdb75('0x66')]['find']({'where':{'TeamId':_0x59097b}});})['then'](function(_0x441f5f){if(_0x441f5f===null){return;}return db[_0xdb75('0x67')]['destroy']({'where':{'UserId':{'$in':_0x4c7440},'VoicePrefixId':_0x441f5f['VoicePrefixId']},'transaction':_0x49a0ff});})[_0xdb75('0x22')](function(){return db[_0xdb75('0x26')][_0xdb75('0x50')]({'where':{'id':_0x59097b},'cascade':!![],'transaction':_0x49a0ff});})[_0xdb75('0x22')](function(_0x4c6ae5){if(_0x4c6ae5===0x0){_0x26ae14['sendStatus'](0x194);}else{return db[_0xdb75('0x4b')][_0xdb75('0x50')]({'where':{'type':_0xdb75('0x47'),'resourceId':_0x59097b},'cascade':!![],'transaction':_0x49a0ff})[_0xdb75('0x22')](function(){_0x26ae14[_0xdb75('0x18')](0xcc)[_0xdb75('0x17')]();});}})[_0xdb75('0x3f')](function(_0xb485f7){_0x26ae14[_0xdb75('0x18')](0x1f4)[_0xdb75('0x24')](_0xb485f7);});});};exports[_0xdb75('0x68')]=function(_0x513f80,_0x1a8269,_0x4f2426){return db[_0xdb75('0x26')]['findOne']({'where':{'id':_0x513f80['params']['id']}})[_0xdb75('0x22')](handleEntityNotFound(_0x1a8269,null))['then'](function(_0x581224){if(!_0x513f80[_0xdb75('0x2a')][_0xdb75('0x69')]||!utils[_0xdb75('0x6a')](_0x513f80['query'][_0xdb75('0x69')])){throw new db[(_0xdb75('0x53'))]['ValidationError']('Unknown\x20channel');}var _0x519604={};var _0x588022={};_0x588022[_0xdb75('0x29')]=_[_0xdb75('0x2b')](db[_['capitalize'](_0x513f80['query'][_0xdb75('0x69')][_0xdb75('0x6b')]())+_0xdb75('0x6c')][_0xdb75('0x41')]);_0x588022[_0xdb75('0x2a')]=_['keys'](_0x513f80[_0xdb75('0x2a')]);_0x588022['filters']=_[_0xdb75('0x2d')](_0x588022[_0xdb75('0x29')],_0x588022[_0xdb75('0x2a')]);_0x519604['attributes']=_[_0xdb75('0x2d')](_0x588022['model'],qs[_0xdb75('0x2f')](_0x513f80['query']['fields']));_0x519604[_0xdb75('0x2e')]=_0x519604[_0xdb75('0x2e')]['length']?_0x519604['attributes']:_0x588022['model'];_0x519604['limit']=qs[_0xdb75('0x1b')](_0x513f80[_0xdb75('0x2a')]['limit']);_0x519604[_0xdb75('0x1a')]=qs[_0xdb75('0x1a')](_0x513f80[_0xdb75('0x2a')][_0xdb75('0x1a')]);_0x519604[_0xdb75('0x32')]=qs['sort'](_0x513f80[_0xdb75('0x2a')][_0xdb75('0x33')]);_0x519604[_0xdb75('0x34')]=qs['filters'](_[_0xdb75('0x35')](_0x513f80[_0xdb75('0x2a')],_0x588022[_0xdb75('0x2c')]));_0x519604=_[_0xdb75('0x37')]({},_0x519604,_0x513f80[_0xdb75('0x3b')]);return _0x581224[_0xdb75('0x44')+_['capitalize'](_0x513f80[_0xdb75('0x2a')]['channel'][_0xdb75('0x6b')]())+'Queues'](_0x519604);})[_0xdb75('0x22')](respondWithResult(_0x1a8269,null))['catch'](handleError(_0x1a8269,null));};exports[_0xdb75('0x6d')]=function(_0x1e1e82,_0x278e75,_0x29435e){return db[_0xdb75('0x26')]['findOne']({'where':{'id':_0x1e1e82[_0xdb75('0x40')]['id']}})['then'](function(_0x423f9){if(_0x423f9){if(!_0x1e1e82[_0xdb75('0x4f')]['channel']||!utils[_0xdb75('0x6a')](_0x1e1e82['body'][_0xdb75('0x69')])){throw new db[(_0xdb75('0x53'))]['ValidationError'](_0xdb75('0x6e'));}return _0x423f9['add'+_[_0xdb75('0x6f')](_0x1e1e82[_0xdb75('0x4f')]['channel']['toLowerCase']())+_0xdb75('0x70')](_0x1e1e82[_0xdb75('0x4f')][_0xdb75('0x71')]);}return null;})[_0xdb75('0x22')](handleEntityNotFound(_0x278e75,null))[_0xdb75('0x22')](respondWithStatusCode(_0x278e75,null))[_0xdb75('0x3f')](handleError(_0x278e75,null));};exports[_0xdb75('0x72')]=function(_0x288277,_0x1a70dd,_0x3cdd7e){return db[_0xdb75('0x26')][_0xdb75('0x73')]({'where':{'id':_0x288277[_0xdb75('0x40')]['id']}})[_0xdb75('0x22')](function(_0x54895b){if(_0x54895b){if(!_0x288277[_0xdb75('0x2a')][_0xdb75('0x69')]||!utils[_0xdb75('0x6a')](_0x288277[_0xdb75('0x2a')]['channel'])){throw new db[(_0xdb75('0x53'))][(_0xdb75('0x74'))](_0xdb75('0x6e'));}return _0x54895b[_0xdb75('0x75')+_[_0xdb75('0x6f')](_0x288277['query'][_0xdb75('0x69')][_0xdb75('0x6b')]())+'Queues'](_0x288277[_0xdb75('0x2a')][_0xdb75('0x71')]);}return null;})[_0xdb75('0x22')](handleEntityNotFound(_0x1a70dd,null))['then'](respondWithStatusCode(_0x1a70dd,null))[_0xdb75('0x3f')](handleError(_0x1a70dd,null));};exports['addAgents']=function(_0x2eb242,_0x344dab){var _0x5f06e0=_[_0xdb75('0x76')](_0x2eb242['body']['ids'])?_0x2eb242['body'][_0xdb75('0x71')]:[_0x2eb242[_0xdb75('0x4f')][_0xdb75('0x71')]];var _0x480e3e=_0x2eb242[_0xdb75('0x40')]['id'];return db[_0xdb75('0x26')][_0xdb75('0x42')]({'where':{'id':_0x480e3e}})[_0xdb75('0x22')](handleEntityNotFound(_0x344dab,null))['then'](function(_0x479dce){if(_0x479dce){var _0x1cc6db=[_0xdb75('0x77'),'Chat',_0xdb75('0x78'),_0xdb75('0x79'),_0xdb75('0x7a'),_0xdb75('0x7b'),'Whatsapp'];return db['sequelize']['transaction'](function(_0x132994){var _0x2ee50e=_['map'](_0x1cc6db,function(_0x2ce098){var _0x1cac47={'attributes':['id','name']};if(_0x2ce098==='Voice'){_0x1cac47['through']={'attributes':[_0xdb75('0x7c')]};}return _0x479dce[_0xdb75('0x44')+_0x2ce098+_0xdb75('0x70')](_0x1cac47)[_0xdb75('0x22')](function(_0x16ceea){var _0x36552e=_[_0xdb75('0x38')](_0x16ceea,function(_0x5c937a){var _0xdd1039=_[_0xdb75('0x38')](_0x5f06e0,function(_0x2999ff){var _0x20393e={'where':{'UserId':_0x2999ff,[_0x2ce098+_0xdb75('0x7d')]:_0x5c937a['id']},'transaction':_0x132994};if(_0x2ce098===_0xdb75('0x77')){_0x20393e['defaults']={'penalty':_0x5c937a[_0xdb75('0x7e')][_0xdb75('0x7c')]};}return db[_0xdb75('0x7f')+_0x2ce098+_0xdb75('0x6c')][_0xdb75('0x80')](_0x20393e)[_0xdb75('0x22')](function(){socket[_0xdb75('0x81')](_0xdb75('0x43')+_0x2ce098+'Queue:save',{'UserId':_0x2999ff,[_0x2ce098+_0xdb75('0x7d')]:_0x5c937a['id']});if(_0x2ce098!==_0xdb75('0x77')){return;}return db['User']['findAll']({'where':{'id':_0x5f06e0,'online':0x1},'attributes':['id',_0xdb75('0x23'),'online',_0xdb75('0x82'),'interface'],'raw':!![]})[_0xdb75('0x22')](function(_0x380563){var _0xad8545=_['map'](_0x380563,function(_0x460654){return db[_0xdb75('0x83')][_0xdb75('0x84')]({'membername':_0x460654[_0xdb75('0x23')],'UserId':_0x460654['id'],'queue_name':_0x5c937a['name'],'VoiceQueueId':_0x5c937a['id'],'interface':_[_0xdb75('0x85')](_0x460654[_0xdb75('0x86')])?util[_0xdb75('0x87')](_0xdb75('0x88'),_0x460654['name']):_0x460654['interface'],'paused':_0x460654[_0xdb75('0x82')]||![],'penalty':_0x5c937a[_0xdb75('0x7e')][_0xdb75('0x7c')]},{'transaction':_0x132994});});return Promise[_0xdb75('0x89')](_0xad8545);});});});return Promise[_0xdb75('0x89')](_0xdd1039);});return Promise[_0xdb75('0x89')](_0x36552e);})[_0xdb75('0x22')](function(){return db[_0xdb75('0x66')][_0xdb75('0x73')]({'where':{'teamId':_0x480e3e}})[_0xdb75('0x22')](function(_0x40c609){if(_0x40c609){var _0x15ccf7=_[_0xdb75('0x38')](_0x5f06e0,function(_0x3f410b){db[_0xdb75('0x67')][_0xdb75('0x84')]({'UserId':_0x3f410b,'VoicePrefixId':_0x40c609[_0xdb75('0x8a')]});});return Promise['all'](_0x15ccf7);}});});});return Promise[_0xdb75('0x89')](_0x2ee50e)['then'](function(){return _0x479dce[_0xdb75('0x8b')](_0x5f06e0,{'transaction':_0x132994})[_0xdb75('0x8c')](function(_0x3584bd){return _0x3584bd;});});});}})[_0xdb75('0x22')](respondWithResult(_0x344dab,null))[_0xdb75('0x3f')](handleError(_0x344dab,null));};exports[_0xdb75('0x8d')]=function(_0x462ee9,_0x334efc){var _0xcfe274=_['isArray'](_0x462ee9[_0xdb75('0x2a')][_0xdb75('0x71')])?_0x462ee9[_0xdb75('0x2a')][_0xdb75('0x71')]:[_0x462ee9[_0xdb75('0x2a')]['ids']];var _0x31fec5=_0x462ee9[_0xdb75('0x40')]['id'];return db[_0xdb75('0x26')][_0xdb75('0x42')]({'where':{'id':_0x31fec5}})[_0xdb75('0x22')](handleEntityNotFound(_0x334efc,null))[_0xdb75('0x22')](function(_0x15b6f0){if(_0x15b6f0){var _0x3808dc=[_0xdb75('0x77'),_0xdb75('0x8e'),_0xdb75('0x78'),'Sms',_0xdb75('0x7a'),_0xdb75('0x7b'),_0xdb75('0x8f')];return db['sequelize'][_0xdb75('0x52')](function(_0x49718e){var _0x169601=_['map'](_0x3808dc,function(_0x5dff9e){var _0x1b4e05={'attributes':['id',_0xdb75('0x23')]};return _0x15b6f0[_0xdb75('0x44')+_0x5dff9e+_0xdb75('0x70')](_0x1b4e05)['then'](function(_0x1b40d4){var _0x40ab71=_[_0xdb75('0x38')](_0x1b40d4,function(_0x50639e){return _0x50639e[_0xdb75('0x8d')](_0xcfe274,{'transaction':_0x49718e})[_0xdb75('0x22')](function(){var _0x2757e7=_[_0xdb75('0x38')](_0xcfe274,function(_0x200712){socket['emit']('user'+_0x5dff9e+_0xdb75('0x90'),{'UserId':Number(_0x200712),[_0x5dff9e+'QueueId']:_0x50639e['id']});if(_0x5dff9e!=='Voice'){return;}return db[_0xdb75('0x83')][_0xdb75('0x50')]({'where':{'VoiceQueueId':_0x50639e['id'],'UserId':_0x200712},'transaction':_0x49718e});});return Promise[_0xdb75('0x89')](_0x2757e7);});});return Promise[_0xdb75('0x89')](_0x40ab71);});});return Promise[_0xdb75('0x89')](_0x169601)[_0xdb75('0x22')](function(){return _0x15b6f0['removeAgents'](_0xcfe274,{'transaction':_0x49718e});})[_0xdb75('0x22')](function(){return db['TeamVoicePrefix'][_0xdb75('0x73')]({'where':{'teamId':_0x31fec5}})[_0xdb75('0x22')](function(_0x2daf4e){if(_0x2daf4e){var _0x55c78f=_[_0xdb75('0x38')](_0xcfe274,function(_0x4a6f47){db[_0xdb75('0x67')]['destroy']({'where':{'UserId':_0x4a6f47,'VoicePrefixId':_0x2daf4e[_0xdb75('0x8a')]}});});return Promise['all'](_0x55c78f);}});});});}})[_0xdb75('0x22')](respondWithStatusCode(_0x334efc,null))[_0xdb75('0x3f')](handleError(_0x334efc,null));};exports[_0xdb75('0x91')]=function(_0x129cb6,_0x195344,_0x21a688){var _0x504773={};var _0x37c8ce={};var _0x2043f0;var _0x26ce52;return db['Team']['findOne']({'where':{'id':_0x129cb6[_0xdb75('0x40')]['id']}})[_0xdb75('0x22')](handleEntityNotFound(_0x195344,null))[_0xdb75('0x22')](function(_0x3a726f){if(_0x3a726f){_0x2043f0=_0x3a726f;_0x37c8ce['model']=_['keys'](db[_0xdb75('0x7f')][_0xdb75('0x41')]);_0x37c8ce['query']=_['keys'](_0x129cb6[_0xdb75('0x2a')]);_0x37c8ce[_0xdb75('0x2c')]=_[_0xdb75('0x2d')](_0x37c8ce[_0xdb75('0x29')],_0x37c8ce[_0xdb75('0x2a')]);_0x504773[_0xdb75('0x2e')]=_[_0xdb75('0x2d')](_0x37c8ce[_0xdb75('0x29')],qs[_0xdb75('0x2f')](_0x129cb6[_0xdb75('0x2a')][_0xdb75('0x2f')]));_0x504773[_0xdb75('0x2e')]=_0x504773[_0xdb75('0x2e')]['length']?_0x504773[_0xdb75('0x2e')]:_0x37c8ce[_0xdb75('0x29')];_0x504773[_0xdb75('0x32')]=qs[_0xdb75('0x33')](_0x129cb6['query']['sort']);_0x504773[_0xdb75('0x34')]=qs[_0xdb75('0x2c')](_['pick'](_0x129cb6[_0xdb75('0x2a')],_0x37c8ce[_0xdb75('0x2c')]));if(_0x129cb6[_0xdb75('0x2a')]['filter']){_0x504773[_0xdb75('0x34')]=_[_0xdb75('0x37')](_0x504773[_0xdb75('0x34')],{'$or':_['map'](_0x504773[_0xdb75('0x2e')],function(_0xb08b7d){var _0x16ebac={};_0x16ebac[_0xb08b7d]={'$like':'%'+_0x129cb6[_0xdb75('0x2a')][_0xdb75('0x36')]+'%'};return _0x16ebac;})});}_0x504773=_[_0xdb75('0x37')]({},_0x504773,_0x129cb6[_0xdb75('0x3b')]);return _0x2043f0[_0xdb75('0x91')](_0x504773);}})[_0xdb75('0x22')](function(_0x2c6953){if(_0x2c6953){_0x26ce52=_0x2c6953[_0xdb75('0x30')];if(!_0x129cb6[_0xdb75('0x2a')][_0xdb75('0x92')](_0xdb75('0x31'))){_0x504773[_0xdb75('0x1b')]=qs['limit'](_0x129cb6['query']['limit']);_0x504773['offset']=qs[_0xdb75('0x1a')](_0x129cb6[_0xdb75('0x2a')]['offset']);}return _0x2043f0['getAgents'](_0x504773);}})[_0xdb75('0x22')](function(_0x11b549){if(_0x11b549){return _0x11b549?{'count':_0x26ce52,'rows':_0x11b549}:null;}})[_0xdb75('0x22')](respondWithResult(_0x195344,null))[_0xdb75('0x3f')](handleError(_0x195344,null));}; \ No newline at end of file +var _0x6ef4=['intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','where','includeAll','include','show','params','rawAttributes','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','sequelize','transaction','Sequelize','SELECT','UserId','VoiceQueueId','UserVoiceQueue','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserProfileResource','Teams','getQueues','findOne','channel','capitalize','toLowerCase','Queues','addQueues','isValidChannel','ValidationError','Unknown\x20channel','ids','removeQueues','remove','addAgents','Voice','Chat','Mail','Fax','Openchannel','penalty','QueueId','TeamVoiceQueue','Queue','emit','User','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','interface','voicePause','all','UserVoicePrefix','VoicePrefixId','spread','removeAgents','isArray','Sms','Whatsapp','Queue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','send','map','Team','fieldName','type','query','keys','filters'];(function(_0xf2b58e,_0x388716){var _0x255788=function(_0x22db5f){while(--_0x22db5f){_0xf2b58e['push'](_0xf2b58e['shift']());}};_0x255788(++_0x388716);}(_0x6ef4,0x64));var _0x46ef=function(_0x5de889,_0x115fc4){_0x5de889=_0x5de889-0x0;var _0x549a4f=_0x6ef4[_0x5de889];return _0x549a4f;};'use strict';var emlformat=require(_0x46ef('0x0'));var rimraf=require(_0x46ef('0x1'));var zipdir=require(_0x46ef('0x2'));var jsonpatch=require(_0x46ef('0x3'));var rp=require('request-promise');var moment=require(_0x46ef('0x4'));var BPromise=require(_0x46ef('0x5'));var Mustache=require('mustache');var util=require(_0x46ef('0x6'));var path=require(_0x46ef('0x7'));var sox=require(_0x46ef('0x8'));var csv=require('to-csv');var ejs=require(_0x46ef('0x9'));var fs=require('fs');var fs_extra=require(_0x46ef('0xa'));var _=require(_0x46ef('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x46ef('0xc'));var deskjs=require(_0x46ef('0xd'));var toCsv=require(_0x46ef('0xe'));var querystring=require(_0x46ef('0xf'));var Papa=require(_0x46ef('0x10'));var Redis=require(_0x46ef('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x46ef('0x12'));var as=require(_0x46ef('0x13'));var hardwareService=require(_0x46ef('0x14'));var logger=require(_0x46ef('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x46ef('0x16'));var licenseUtil=require(_0x46ef('0x17'));var db=require('../../mysqldb')['db'];config[_0x46ef('0x18')]=_[_0x46ef('0x19')](config[_0x46ef('0x18')],{'host':_0x46ef('0x1a'),'port':0x18eb});var socket=require(_0x46ef('0x1b'))(new Redis(config[_0x46ef('0x18')]));require(_0x46ef('0x1c'))[_0x46ef('0x1d')](socket);function respondWithStatusCode(_0x28deec,_0x383890){_0x383890=_0x383890||0xcc;return function(_0x29a683){if(_0x29a683){return _0x28deec[_0x46ef('0x1e')](_0x383890);}return _0x28deec['status'](_0x383890)[_0x46ef('0x1f')]();};}function respondWithResult(_0x46e369,_0x5a345b){_0x5a345b=_0x5a345b||0xc8;return function(_0x1a6167){if(_0x1a6167){return _0x46e369[_0x46ef('0x20')](_0x5a345b)[_0x46ef('0x21')](_0x1a6167);}};}function respondWithFilteredResult(_0x1d0bf1,_0x2572ae){return function(_0x3675ca){if(_0x3675ca){var _0x59ed68=typeof _0x2572ae[_0x46ef('0x22')]===_0x46ef('0x23')&&typeof _0x2572ae[_0x46ef('0x24')]==='undefined';var _0x5b8b71=_0x3675ca[_0x46ef('0x25')];var _0x18f70d=_0x59ed68?0x0:_0x2572ae[_0x46ef('0x22')];var _0x5a3620=_0x59ed68?_0x3675ca[_0x46ef('0x25')]:_0x2572ae[_0x46ef('0x22')]+_0x2572ae[_0x46ef('0x24')];var _0x22d198;if(_0x5a3620>=_0x5b8b71){_0x5a3620=_0x5b8b71;_0x22d198=0xc8;}else{_0x22d198=0xce;}_0x1d0bf1[_0x46ef('0x20')](_0x22d198);return _0x1d0bf1[_0x46ef('0x26')](_0x46ef('0x27'),_0x18f70d+'-'+_0x5a3620+'/'+_0x5b8b71)[_0x46ef('0x21')](_0x3675ca);}return null;};}function patchUpdates(_0x4bb1b3){return function(_0x259afe){try{jsonpatch[_0x46ef('0x28')](_0x259afe,_0x4bb1b3,!![]);}catch(_0x464f0c){return BPromise['reject'](_0x464f0c);}return _0x259afe[_0x46ef('0x29')]();};}function saveUpdates(_0x5d8c11,_0x477815){return function(_0x34c17b){if(_0x34c17b){return _0x34c17b[_0x46ef('0x2a')](_0x5d8c11)[_0x46ef('0x2b')](function(_0x44e91f){return _0x44e91f;});}return null;};}function handleEntityNotFound(_0x344776,_0x1fe322){return function(_0x2ec08e){if(!_0x2ec08e){_0x344776[_0x46ef('0x1e')](0x194);}return _0x2ec08e;};}function handleError(_0x8a7e93,_0x258e7a){_0x258e7a=_0x258e7a||0x1f4;return function(_0x3422e7){logger[_0x46ef('0x2c')](_0x3422e7[_0x46ef('0x2d')]);if(_0x3422e7[_0x46ef('0x2e')]){delete _0x3422e7['name'];}_0x8a7e93[_0x46ef('0x20')](_0x258e7a)[_0x46ef('0x2f')](_0x3422e7);};}exports['index']=function(_0x793a25,_0x234f7a){var _0x523240={},_0x1343b4={},_0x354018={'count':0x0,'rows':[]};var _0x6a41f9=_[_0x46ef('0x30')](db[_0x46ef('0x31')]['rawAttributes'],function(_0xa8abb7){return{'name':_0xa8abb7[_0x46ef('0x32')],'type':_0xa8abb7[_0x46ef('0x33')]['key']};});_0x1343b4['model']=_[_0x46ef('0x30')](_0x6a41f9,'name');_0x1343b4[_0x46ef('0x34')]=_[_0x46ef('0x35')](_0x793a25[_0x46ef('0x34')]);_0x1343b4[_0x46ef('0x36')]=_[_0x46ef('0x37')](_0x1343b4[_0x46ef('0x38')],_0x1343b4[_0x46ef('0x34')]);_0x523240['attributes']=_[_0x46ef('0x37')](_0x1343b4['model'],qs['fields'](_0x793a25[_0x46ef('0x34')][_0x46ef('0x39')]));_0x523240[_0x46ef('0x3a')]=_0x523240[_0x46ef('0x3a')][_0x46ef('0x3b')]?_0x523240[_0x46ef('0x3a')]:_0x1343b4[_0x46ef('0x38')];if(!_0x793a25[_0x46ef('0x34')][_0x46ef('0x3c')](_0x46ef('0x3d'))){_0x523240[_0x46ef('0x24')]=qs[_0x46ef('0x24')](_0x793a25[_0x46ef('0x34')]['limit']);_0x523240['offset']=qs[_0x46ef('0x22')](_0x793a25[_0x46ef('0x34')][_0x46ef('0x22')]);}_0x523240[_0x46ef('0x3e')]=qs[_0x46ef('0x3f')](_0x793a25['query'][_0x46ef('0x3f')]);_0x523240['where']=qs['filters'](_[_0x46ef('0x40')](_0x793a25['query'],_0x1343b4[_0x46ef('0x36')]),_0x6a41f9);if(_0x793a25['query'][_0x46ef('0x41')]){_0x523240['where']=_[_0x46ef('0x42')](_0x523240['where'],{'$or':_[_0x46ef('0x30')](_0x6a41f9,function(_0x4bd4c9){if(_0x4bd4c9[_0x46ef('0x33')]!==_0x46ef('0x43')){var _0x47648f={};_0x47648f[_0x4bd4c9[_0x46ef('0x2e')]]={'$like':'%'+_0x793a25[_0x46ef('0x34')][_0x46ef('0x41')]+'%'};return _0x47648f;}})});}_0x523240=_['merge']({},_0x523240,_0x793a25['options']);var _0xabf45a={'where':_0x523240[_0x46ef('0x44')]};return db['Team'][_0x46ef('0x25')](_0xabf45a)[_0x46ef('0x2b')](function(_0x5436b6){_0x354018[_0x46ef('0x25')]=_0x5436b6;if(_0x793a25[_0x46ef('0x34')][_0x46ef('0x45')]){_0x523240[_0x46ef('0x46')]=[{'all':!![]}];}return db[_0x46ef('0x31')]['findAll'](_0x523240);})['then'](function(_0x46c061){_0x354018['rows']=_0x46c061;return _0x354018;})[_0x46ef('0x2b')](respondWithFilteredResult(_0x234f7a,_0x523240))['catch'](handleError(_0x234f7a,null));};exports[_0x46ef('0x47')]=function(_0x3f4dc0,_0xa0a136){var _0x33f01c={'raw':![],'where':{'id':_0x3f4dc0[_0x46ef('0x48')]['id']}},_0x509a5d={};_0x509a5d[_0x46ef('0x38')]=_[_0x46ef('0x35')](db[_0x46ef('0x31')][_0x46ef('0x49')]);_0x509a5d[_0x46ef('0x34')]=_[_0x46ef('0x35')](_0x3f4dc0[_0x46ef('0x34')]);_0x509a5d[_0x46ef('0x36')]=_[_0x46ef('0x37')](_0x509a5d['model'],_0x509a5d['query']);_0x33f01c[_0x46ef('0x3a')]=_[_0x46ef('0x37')](_0x509a5d[_0x46ef('0x38')],qs[_0x46ef('0x39')](_0x3f4dc0[_0x46ef('0x34')][_0x46ef('0x39')]));_0x33f01c[_0x46ef('0x3a')]=_0x33f01c[_0x46ef('0x3a')]['length']?_0x33f01c[_0x46ef('0x3a')]:_0x509a5d[_0x46ef('0x38')];if(_0x3f4dc0[_0x46ef('0x34')][_0x46ef('0x45')]){_0x33f01c[_0x46ef('0x46')]=[{'all':!![]}];}_0x33f01c=_[_0x46ef('0x42')]({},_0x33f01c,_0x3f4dc0[_0x46ef('0x4a')]);return db['Team']['find'](_0x33f01c)['then'](handleEntityNotFound(_0xa0a136,null))['then'](respondWithResult(_0xa0a136,null))[_0x46ef('0x4b')](handleError(_0xa0a136,null));};exports[_0x46ef('0x4c')]=function(_0x5e744e,_0x4bc650){return db[_0x46ef('0x31')][_0x46ef('0x4c')](_0x5e744e[_0x46ef('0x4d')],{})[_0x46ef('0x2b')](function(_0x56b898){var _0x2cfa63=_0x5e744e[_0x46ef('0x4e')]['get']({'plain':!![]});if(!_0x2cfa63)throw new Error(_0x46ef('0x4f'));if(_0x2cfa63['role']===_0x46ef('0x4e')){var _0x48075a=_0x56b898[_0x46ef('0x50')]({'plain':!![]});var _0x4e5c50='Teams';return db['UserProfileSection']['find']({'where':{'name':_0x4e5c50,'userProfileId':_0x2cfa63[_0x46ef('0x51')]},'raw':!![]})['then'](function(_0x51092b){if(_0x51092b&&_0x51092b[_0x46ef('0x52')]===0x0){return db['UserProfileResource'][_0x46ef('0x4c')]({'name':_0x48075a['name'],'resourceId':_0x48075a['id'],'type':_0x51092b[_0x46ef('0x2e')],'sectionId':_0x51092b['id']},{})[_0x46ef('0x2b')](function(){return _0x56b898;});}else{return _0x56b898;}})['catch'](function(_0x35750d){logger['error'](_0x46ef('0x53'),_0x35750d);throw _0x35750d;});}return _0x56b898;})[_0x46ef('0x2b')](respondWithResult(_0x4bc650,0xc9))[_0x46ef('0x4b')](handleError(_0x4bc650,null));};exports[_0x46ef('0x2a')]=function(_0x3c092d,_0xbfa838){if(_0x3c092d[_0x46ef('0x4d')]['id']){delete _0x3c092d[_0x46ef('0x4d')]['id'];}return db[_0x46ef('0x31')][_0x46ef('0x54')]({'where':{'id':_0x3c092d[_0x46ef('0x48')]['id']}})[_0x46ef('0x2b')](handleEntityNotFound(_0xbfa838,null))[_0x46ef('0x2b')](saveUpdates(_0x3c092d['body'],null))[_0x46ef('0x2b')](respondWithResult(_0xbfa838,null))[_0x46ef('0x4b')](handleError(_0xbfa838,null));};exports['destroy']=function(_0x3bc974,_0x54eb77){var _0x3ea953=_0x3bc974['params']['id'];var _0x45215b=[];return db[_0x46ef('0x55')][_0x46ef('0x56')](function(_0x3bbd54){var _0x5a8232='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x3ea953;return db[_0x46ef('0x55')]['query'](_0x5a8232,{'type':db[_0x46ef('0x57')]['QueryTypes'][_0x46ef('0x58')],'raw':!![],'transaction':_0x3bbd54})['then'](function(_0x1b3722){_0x45215b=_[_0x46ef('0x30')](_0x1b3722,function(_0x8f8576){return Number(_0x8f8576[_0x46ef('0x59')]);});})['then'](function(){var _0x49da47='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x3ea953;return db[_0x46ef('0x55')][_0x46ef('0x34')](_0x49da47,{'type':db[_0x46ef('0x57')]['QueryTypes'][_0x46ef('0x58')],'raw':!![],'transaction':_0x3bbd54});})['then'](function(_0x3d83f9){var _0x22a764=_[_0x46ef('0x30')](_0x3d83f9,function(_0x24d537){return Number(_0x24d537[_0x46ef('0x5a')]);});return db[_0x46ef('0x5b')][_0x46ef('0x5c')]({'where':{'UserId':{'$in':_0x45215b},'VoiceQueueId':{'$in':_0x22a764}},'transaction':_0x3bbd54});})[_0x46ef('0x2b')](function(){var _0x29f302=_0x46ef('0x5d')+_0x3ea953;return db['sequelize'][_0x46ef('0x34')](_0x29f302,{'type':db[_0x46ef('0x57')]['QueryTypes'][_0x46ef('0x58')],'raw':!![],'transaction':_0x3bbd54});})[_0x46ef('0x2b')](function(_0x5e1a5f){var _0x401b3f=_['map'](_0x5e1a5f,function(_0x444b70){return Number(_0x444b70[_0x46ef('0x5e')]);});return db[_0x46ef('0x5f')]['destroy']({'where':{'UserId':{'$in':_0x45215b},'MailQueueId':{'$in':_0x401b3f}},'transaction':_0x3bbd54});})['then'](function(){var _0x4191f0=_0x46ef('0x60')+_0x3ea953;return db['sequelize'][_0x46ef('0x34')](_0x4191f0,{'type':db['Sequelize'][_0x46ef('0x61')]['SELECT'],'raw':!![],'transaction':_0x3bbd54});})[_0x46ef('0x2b')](function(_0x129430){var _0x50bb03=_[_0x46ef('0x30')](_0x129430,function(_0x31dc10){return Number(_0x31dc10['SmsQueueId']);});return db[_0x46ef('0x62')][_0x46ef('0x5c')]({'where':{'UserId':{'$in':_0x45215b},'SmsQueueId':{'$in':_0x50bb03}},'transaction':_0x3bbd54});})[_0x46ef('0x2b')](function(){var _0x4bedf1=_0x46ef('0x63')+_0x3ea953;return db['sequelize']['query'](_0x4bedf1,{'type':db[_0x46ef('0x57')][_0x46ef('0x61')][_0x46ef('0x58')],'raw':!![],'transaction':_0x3bbd54});})[_0x46ef('0x2b')](function(_0x3b8ede){var _0x32a694=_[_0x46ef('0x30')](_0x3b8ede,function(_0x2e36c1){return Number(_0x2e36c1[_0x46ef('0x64')]);});return db[_0x46ef('0x65')][_0x46ef('0x5c')]({'where':{'UserId':{'$in':_0x45215b},'ChatQueueId':{'$in':_0x32a694}},'transaction':_0x3bbd54});})[_0x46ef('0x2b')](function(){var _0x685a1a=_0x46ef('0x66')+_0x3ea953;return db[_0x46ef('0x55')]['query'](_0x685a1a,{'type':db[_0x46ef('0x57')][_0x46ef('0x61')][_0x46ef('0x58')],'raw':!![],'transaction':_0x3bbd54});})[_0x46ef('0x2b')](function(_0x57a0d1){var _0x52cff5=_[_0x46ef('0x30')](_0x57a0d1,function(_0x3e43e3){return Number(_0x3e43e3[_0x46ef('0x67')]);});return db[_0x46ef('0x68')][_0x46ef('0x5c')]({'where':{'UserId':{'$in':_0x45215b},'FaxQueueId':{'$in':_0x52cff5}},'transaction':_0x3bbd54});})['then'](function(){var _0x25c8a3='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x3ea953;return db[_0x46ef('0x55')]['query'](_0x25c8a3,{'type':db[_0x46ef('0x57')][_0x46ef('0x61')][_0x46ef('0x58')],'raw':!![],'transaction':_0x3bbd54});})['then'](function(_0x204b1a){var _0x3f5c7e=_[_0x46ef('0x30')](_0x204b1a,function(_0x2e928c){return Number(_0x2e928c[_0x46ef('0x69')]);});return db[_0x46ef('0x6a')][_0x46ef('0x5c')]({'where':{'UserId':{'$in':_0x45215b},'OpenchannelQueueId':{'$in':_0x3f5c7e}},'transaction':_0x3bbd54});})[_0x46ef('0x2b')](function(){var _0x1510f9=_0x46ef('0x6b')+_0x3ea953;return db[_0x46ef('0x55')][_0x46ef('0x34')](_0x1510f9,{'type':db[_0x46ef('0x57')][_0x46ef('0x61')][_0x46ef('0x58')],'raw':!![],'transaction':_0x3bbd54});})[_0x46ef('0x2b')](function(_0xd8aa61){var _0x324597=_[_0x46ef('0x30')](_0xd8aa61,function(_0x572f10){return Number(_0x572f10[_0x46ef('0x6c')]);});return db[_0x46ef('0x6d')]['destroy']({'where':{'UserId':{'$in':_0x45215b},'WhatsappQueueId':{'$in':_0x324597}},'transaction':_0x3bbd54});})[_0x46ef('0x2b')](function(){return db[_0x46ef('0x6e')][_0x46ef('0x54')]({'where':{'TeamId':_0x3ea953}});})[_0x46ef('0x2b')](function(_0x3385f3){if(_0x3385f3===null){return;}return db['UserVoicePrefix']['destroy']({'where':{'UserId':{'$in':_0x45215b},'VoicePrefixId':_0x3385f3['VoicePrefixId']},'transaction':_0x3bbd54});})[_0x46ef('0x2b')](function(){return db[_0x46ef('0x31')]['destroy']({'where':{'id':_0x3ea953},'cascade':!![],'transaction':_0x3bbd54});})[_0x46ef('0x2b')](function(_0x47c84c){if(_0x47c84c===0x0){_0x54eb77[_0x46ef('0x1e')](0x194);}else{return db[_0x46ef('0x6f')][_0x46ef('0x5c')]({'where':{'type':_0x46ef('0x70'),'resourceId':_0x3ea953},'cascade':!![],'transaction':_0x3bbd54})['then'](function(){_0x54eb77[_0x46ef('0x20')](0xcc)[_0x46ef('0x1f')]();});}})[_0x46ef('0x4b')](function(_0x478ab6){_0x54eb77[_0x46ef('0x20')](0x1f4)[_0x46ef('0x2f')](_0x478ab6);});});};exports[_0x46ef('0x71')]=function(_0x20cc30,_0xb010bc,_0x16aea8){return db[_0x46ef('0x31')][_0x46ef('0x72')]({'where':{'id':_0x20cc30[_0x46ef('0x48')]['id']}})[_0x46ef('0x2b')](handleEntityNotFound(_0xb010bc,null))[_0x46ef('0x2b')](function(_0x38053f){if(!_0x20cc30[_0x46ef('0x34')][_0x46ef('0x73')]||!utils['isValidChannel'](_0x20cc30['query'][_0x46ef('0x73')])){throw new db[(_0x46ef('0x57'))]['ValidationError']('Unknown\x20channel');}var _0x3d6a13={};var _0x1db8c5={};_0x1db8c5['model']=_['keys'](db[_[_0x46ef('0x74')](_0x20cc30[_0x46ef('0x34')]['channel'][_0x46ef('0x75')]())+'Queue'][_0x46ef('0x49')]);_0x1db8c5['query']=_[_0x46ef('0x35')](_0x20cc30[_0x46ef('0x34')]);_0x1db8c5[_0x46ef('0x36')]=_['intersection'](_0x1db8c5['model'],_0x1db8c5[_0x46ef('0x34')]);_0x3d6a13['attributes']=_[_0x46ef('0x37')](_0x1db8c5[_0x46ef('0x38')],qs[_0x46ef('0x39')](_0x20cc30[_0x46ef('0x34')][_0x46ef('0x39')]));_0x3d6a13[_0x46ef('0x3a')]=_0x3d6a13['attributes'][_0x46ef('0x3b')]?_0x3d6a13[_0x46ef('0x3a')]:_0x1db8c5[_0x46ef('0x38')];_0x3d6a13['limit']=qs['limit'](_0x20cc30[_0x46ef('0x34')][_0x46ef('0x24')]);_0x3d6a13[_0x46ef('0x22')]=qs[_0x46ef('0x22')](_0x20cc30[_0x46ef('0x34')][_0x46ef('0x22')]);_0x3d6a13[_0x46ef('0x3e')]=qs[_0x46ef('0x3f')](_0x20cc30[_0x46ef('0x34')][_0x46ef('0x3f')]);_0x3d6a13[_0x46ef('0x44')]=qs[_0x46ef('0x36')](_[_0x46ef('0x40')](_0x20cc30[_0x46ef('0x34')],_0x1db8c5[_0x46ef('0x36')]));_0x3d6a13=_[_0x46ef('0x42')]({},_0x3d6a13,_0x20cc30[_0x46ef('0x4a')]);return _0x38053f[_0x46ef('0x50')+_[_0x46ef('0x74')](_0x20cc30[_0x46ef('0x34')][_0x46ef('0x73')][_0x46ef('0x75')]())+_0x46ef('0x76')](_0x3d6a13);})['then'](respondWithResult(_0xb010bc,null))[_0x46ef('0x4b')](handleError(_0xb010bc,null));};exports[_0x46ef('0x77')]=function(_0x427ea4,_0x4f4b4c,_0x44d00f){return db[_0x46ef('0x31')]['findOne']({'where':{'id':_0x427ea4['params']['id']}})[_0x46ef('0x2b')](function(_0x51fb6b){if(_0x51fb6b){if(!_0x427ea4['body'][_0x46ef('0x73')]||!utils[_0x46ef('0x78')](_0x427ea4[_0x46ef('0x4d')][_0x46ef('0x73')])){throw new db[(_0x46ef('0x57'))][(_0x46ef('0x79'))](_0x46ef('0x7a'));}return _0x51fb6b['add'+_['capitalize'](_0x427ea4[_0x46ef('0x4d')][_0x46ef('0x73')]['toLowerCase']())+_0x46ef('0x76')](_0x427ea4[_0x46ef('0x4d')][_0x46ef('0x7b')]);}return null;})[_0x46ef('0x2b')](handleEntityNotFound(_0x4f4b4c,null))[_0x46ef('0x2b')](respondWithStatusCode(_0x4f4b4c,null))['catch'](handleError(_0x4f4b4c,null));};exports[_0x46ef('0x7c')]=function(_0x1840ef,_0x5b9a81,_0x449786){return db[_0x46ef('0x31')][_0x46ef('0x72')]({'where':{'id':_0x1840ef[_0x46ef('0x48')]['id']}})[_0x46ef('0x2b')](function(_0x2e1aea){if(_0x2e1aea){if(!_0x1840ef['query'][_0x46ef('0x73')]||!utils[_0x46ef('0x78')](_0x1840ef['query']['channel'])){throw new db[(_0x46ef('0x57'))]['ValidationError']('Unknown\x20channel');}return _0x2e1aea[_0x46ef('0x7d')+_[_0x46ef('0x74')](_0x1840ef[_0x46ef('0x34')]['channel']['toLowerCase']())+_0x46ef('0x76')](_0x1840ef['query']['ids']);}return null;})[_0x46ef('0x2b')](handleEntityNotFound(_0x5b9a81,null))['then'](respondWithStatusCode(_0x5b9a81,null))[_0x46ef('0x4b')](handleError(_0x5b9a81,null));};exports[_0x46ef('0x7e')]=function(_0x223c71,_0x4f6c6c){var _0x479deb=_['isArray'](_0x223c71['body'][_0x46ef('0x7b')])?_0x223c71[_0x46ef('0x4d')][_0x46ef('0x7b')]:[_0x223c71[_0x46ef('0x4d')][_0x46ef('0x7b')]];var _0x5e6578=_0x223c71[_0x46ef('0x48')]['id'];return db[_0x46ef('0x31')]['find']({'where':{'id':_0x5e6578}})[_0x46ef('0x2b')](handleEntityNotFound(_0x4f6c6c,null))[_0x46ef('0x2b')](function(_0x595f3f){if(_0x595f3f){var _0x105079=[_0x46ef('0x7f'),_0x46ef('0x80'),_0x46ef('0x81'),'Sms',_0x46ef('0x82'),_0x46ef('0x83'),'Whatsapp'];return db[_0x46ef('0x55')]['transaction'](function(_0xa5b190){var _0x29b13d=_[_0x46ef('0x30')](_0x105079,function(_0x46e82f){var _0x3eee75={'attributes':['id',_0x46ef('0x2e')]};if(_0x46e82f===_0x46ef('0x7f')){_0x3eee75['through']={'attributes':[_0x46ef('0x84')]};}return _0x595f3f[_0x46ef('0x50')+_0x46e82f+_0x46ef('0x76')](_0x3eee75)[_0x46ef('0x2b')](function(_0x52df8d){var _0x19132c=_[_0x46ef('0x30')](_0x52df8d,function(_0x3a7806){var _0x43f4c0=_['map'](_0x479deb,function(_0x55b760){var _0x598b45={'where':{'UserId':_0x55b760,[_0x46e82f+_0x46ef('0x85')]:_0x3a7806['id']},'transaction':_0xa5b190};if(_0x46e82f===_0x46ef('0x7f')){_0x598b45[_0x46ef('0x19')]={'penalty':_0x3a7806[_0x46ef('0x86')][_0x46ef('0x84')]};}return db['User'+_0x46e82f+_0x46ef('0x87')]['findOrCreate'](_0x598b45)[_0x46ef('0x2b')](function(){socket[_0x46ef('0x88')](_0x46ef('0x4e')+_0x46e82f+'Queue:save',{'UserId':_0x55b760,[_0x46e82f+'QueueId']:_0x3a7806['id']});if(_0x46e82f!==_0x46ef('0x7f')){return;}return db[_0x46ef('0x89')]['findAll']({'where':{'id':_0x479deb,'online':0x1},'attributes':['id',_0x46ef('0x2e'),'online','voicePause','interface'],'raw':!![]})[_0x46ef('0x2b')](function(_0x53b2cc){var _0x38c1f2=_['map'](_0x53b2cc,function(_0x5b9ba1){return db[_0x46ef('0x8a')][_0x46ef('0x8b')]({'membername':_0x5b9ba1[_0x46ef('0x2e')],'UserId':_0x5b9ba1['id'],'queue_name':_0x3a7806[_0x46ef('0x2e')],'VoiceQueueId':_0x3a7806['id'],'interface':_[_0x46ef('0x8c')](_0x5b9ba1['interface'])?util[_0x46ef('0x8d')](_0x46ef('0x8e'),_0x5b9ba1['name']):_0x5b9ba1[_0x46ef('0x8f')],'paused':_0x5b9ba1[_0x46ef('0x90')]||![],'penalty':_0x3a7806['TeamVoiceQueue']['penalty']},{'transaction':_0xa5b190});});return Promise['all'](_0x38c1f2);});});});return Promise[_0x46ef('0x91')](_0x43f4c0);});return Promise['all'](_0x19132c);})[_0x46ef('0x2b')](function(){return db[_0x46ef('0x6e')][_0x46ef('0x72')]({'where':{'teamId':_0x5e6578}})[_0x46ef('0x2b')](function(_0x58fb40){if(_0x58fb40){var _0x30ff2f=_['map'](_0x479deb,function(_0x58208a){db[_0x46ef('0x92')]['upsert']({'UserId':_0x58208a,'VoicePrefixId':_0x58fb40[_0x46ef('0x93')]});});return Promise[_0x46ef('0x91')](_0x30ff2f);}});});});return Promise[_0x46ef('0x91')](_0x29b13d)['then'](function(){return _0x595f3f[_0x46ef('0x7e')](_0x479deb,{'transaction':_0xa5b190})[_0x46ef('0x94')](function(_0x2686e7){return _0x2686e7;});});});}})['then'](respondWithResult(_0x4f6c6c,null))[_0x46ef('0x4b')](handleError(_0x4f6c6c,null));};exports[_0x46ef('0x95')]=function(_0x2b33fa,_0x48dd80){var _0x374ba7=_[_0x46ef('0x96')](_0x2b33fa[_0x46ef('0x34')][_0x46ef('0x7b')])?_0x2b33fa['query'][_0x46ef('0x7b')]:[_0x2b33fa[_0x46ef('0x34')]['ids']];var _0x4ad31b=_0x2b33fa['params']['id'];return db[_0x46ef('0x31')][_0x46ef('0x54')]({'where':{'id':_0x4ad31b}})[_0x46ef('0x2b')](handleEntityNotFound(_0x48dd80,null))[_0x46ef('0x2b')](function(_0x1aff12){if(_0x1aff12){var _0x38c9aa=[_0x46ef('0x7f'),'Chat',_0x46ef('0x81'),_0x46ef('0x97'),_0x46ef('0x82'),'Openchannel',_0x46ef('0x98')];return db['sequelize'][_0x46ef('0x56')](function(_0x27db79){var _0x553a16=_[_0x46ef('0x30')](_0x38c9aa,function(_0x4835e9){var _0x1c3135={'attributes':['id',_0x46ef('0x2e')]};return _0x1aff12[_0x46ef('0x50')+_0x4835e9+_0x46ef('0x76')](_0x1c3135)['then'](function(_0x55c026){var _0x10fd2a=_[_0x46ef('0x30')](_0x55c026,function(_0x51e352){return _0x51e352[_0x46ef('0x95')](_0x374ba7,{'transaction':_0x27db79})[_0x46ef('0x2b')](function(){var _0x5d3a61=_['map'](_0x374ba7,function(_0x959ec){socket[_0x46ef('0x88')](_0x46ef('0x4e')+_0x4835e9+_0x46ef('0x99'),{'UserId':Number(_0x959ec),[_0x4835e9+_0x46ef('0x85')]:_0x51e352['id']});if(_0x4835e9!==_0x46ef('0x7f')){return;}return db[_0x46ef('0x8a')]['destroy']({'where':{'VoiceQueueId':_0x51e352['id'],'UserId':_0x959ec},'transaction':_0x27db79});});return Promise[_0x46ef('0x91')](_0x5d3a61);});});return Promise[_0x46ef('0x91')](_0x10fd2a);});});return Promise[_0x46ef('0x91')](_0x553a16)[_0x46ef('0x2b')](function(){return _0x1aff12['removeAgents'](_0x374ba7,{'transaction':_0x27db79});})[_0x46ef('0x2b')](function(){return db['TeamVoicePrefix'][_0x46ef('0x72')]({'where':{'teamId':_0x4ad31b}})[_0x46ef('0x2b')](function(_0x39e1c8){if(_0x39e1c8){var _0x4006a5=_[_0x46ef('0x30')](_0x374ba7,function(_0xbffe4a){db[_0x46ef('0x92')][_0x46ef('0x5c')]({'where':{'UserId':_0xbffe4a,'VoicePrefixId':_0x39e1c8[_0x46ef('0x93')]}});});return Promise['all'](_0x4006a5);}});});});}})[_0x46ef('0x2b')](respondWithStatusCode(_0x48dd80,null))[_0x46ef('0x4b')](handleError(_0x48dd80,null));};exports['getAgents']=function(_0xcf1fda,_0x32de8b,_0x451a93){var _0x3e40bd={};var _0x4481cf={};var _0x526ee7;var _0x1c7c8b;return db[_0x46ef('0x31')][_0x46ef('0x72')]({'where':{'id':_0xcf1fda[_0x46ef('0x48')]['id']}})[_0x46ef('0x2b')](handleEntityNotFound(_0x32de8b,null))[_0x46ef('0x2b')](function(_0x1863ce){if(_0x1863ce){_0x526ee7=_0x1863ce;_0x4481cf[_0x46ef('0x38')]=_[_0x46ef('0x35')](db[_0x46ef('0x89')]['rawAttributes']);_0x4481cf['query']=_['keys'](_0xcf1fda[_0x46ef('0x34')]);_0x4481cf[_0x46ef('0x36')]=_['intersection'](_0x4481cf[_0x46ef('0x38')],_0x4481cf['query']);_0x3e40bd[_0x46ef('0x3a')]=_[_0x46ef('0x37')](_0x4481cf[_0x46ef('0x38')],qs[_0x46ef('0x39')](_0xcf1fda[_0x46ef('0x34')][_0x46ef('0x39')]));_0x3e40bd['attributes']=_0x3e40bd[_0x46ef('0x3a')][_0x46ef('0x3b')]?_0x3e40bd[_0x46ef('0x3a')]:_0x4481cf[_0x46ef('0x38')];_0x3e40bd['order']=qs[_0x46ef('0x3f')](_0xcf1fda[_0x46ef('0x34')]['sort']);_0x3e40bd[_0x46ef('0x44')]=qs[_0x46ef('0x36')](_[_0x46ef('0x40')](_0xcf1fda[_0x46ef('0x34')],_0x4481cf['filters']));if(_0xcf1fda['query']['filter']){_0x3e40bd['where']=_['merge'](_0x3e40bd[_0x46ef('0x44')],{'$or':_[_0x46ef('0x30')](_0x3e40bd[_0x46ef('0x3a')],function(_0x65c290){var _0x43b91e={};_0x43b91e[_0x65c290]={'$like':'%'+_0xcf1fda[_0x46ef('0x34')][_0x46ef('0x41')]+'%'};return _0x43b91e;})});}_0x3e40bd=_[_0x46ef('0x42')]({},_0x3e40bd,_0xcf1fda['options']);return _0x526ee7['getAgents'](_0x3e40bd);}})[_0x46ef('0x2b')](function(_0x291cf5){if(_0x291cf5){_0x1c7c8b=_0x291cf5[_0x46ef('0x3b')];if(!_0xcf1fda[_0x46ef('0x34')]['hasOwnProperty'](_0x46ef('0x3d'))){_0x3e40bd[_0x46ef('0x24')]=qs[_0x46ef('0x24')](_0xcf1fda[_0x46ef('0x34')][_0x46ef('0x24')]);_0x3e40bd[_0x46ef('0x22')]=qs[_0x46ef('0x22')](_0xcf1fda[_0x46ef('0x34')][_0x46ef('0x22')]);}return _0x526ee7[_0x46ef('0x9a')](_0x3e40bd);}})[_0x46ef('0x2b')](function(_0xd1392b){if(_0xd1392b){return _0xd1392b?{'count':_0x1c7c8b,'rows':_0xd1392b}:null;}})[_0x46ef('0x2b')](respondWithResult(_0x32de8b,null))[_0x46ef('0x4b')](handleError(_0x32de8b,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 8f080c1..8943b4a 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 _0x42ae=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team'];(function(_0x5b9a8c,_0x195ce5){var _0x28c63a=function(_0x9121b4){while(--_0x9121b4){_0x5b9a8c['push'](_0x5b9a8c['shift']());}};_0x28c63a(++_0x195ce5);}(_0x42ae,0x1b5));var _0xe42a=function(_0x49d7ca,_0x514fc4){_0x49d7ca=_0x49d7ca-0x0;var _0x12422f=_0x42ae[_0x49d7ca];return _0x12422f;};'use strict';var EventEmitter=require(_0xe42a('0x0'));var Team=require(_0xe42a('0x1'))['db'][_0xe42a('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xe42a('0x3')](0x0);var events={'afterCreate':_0xe42a('0x4'),'afterUpdate':_0xe42a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x980cfe){return function(_0xafe1ec,_0x5bd50d,_0x104399){TeamEvents[_0xe42a('0x6')](_0x980cfe+':'+_0xafe1ec['id'],_0xafe1ec);TeamEvents[_0xe42a('0x6')](_0x980cfe,_0xafe1ec);_0x104399(null);};}for(var e in events){if(events[_0xe42a('0x7')](e)){var event=events[e];Team[_0xe42a('0x8')](e,emitEvent(event));}}module[_0xe42a('0x9')]=TeamEvents; \ No newline at end of file +var _0x029e=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team','setMaxListeners','update'];(function(_0x8f74de,_0x59bda1){var _0x58f8d5=function(_0x55aee5){while(--_0x55aee5){_0x8f74de['push'](_0x8f74de['shift']());}};_0x58f8d5(++_0x59bda1);}(_0x029e,0x19f));var _0xe029=function(_0x3fb2ed,_0x980dae){_0x3fb2ed=_0x3fb2ed-0x0;var _0x48deec=_0x029e[_0x3fb2ed];return _0x48deec;};'use strict';var EventEmitter=require(_0xe029('0x0'));var Team=require(_0xe029('0x1'))['db'][_0xe029('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xe029('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe029('0x4'),'afterDestroy':_0xe029('0x5')};function emitEvent(_0x270269){return function(_0x1e2da5,_0x304597,_0x371b7c){TeamEvents[_0xe029('0x6')](_0x270269+':'+_0x1e2da5['id'],_0x1e2da5);TeamEvents[_0xe029('0x6')](_0x270269,_0x1e2da5);_0x371b7c(null);};}for(var e in events){if(events[_0xe029('0x7')](e)){var event=events[e];Team[_0xe029('0x8')](e,emitEvent(event));}}module[_0xe029('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 5fafe04..244e9a6 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 _0x0e6d=['Team','teams','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./team.attributes','exports','define'];(function(_0x3bb19d,_0x4e2eca){var _0x4c8442=function(_0x4c9ff8){while(--_0x4c9ff8){_0x3bb19d['push'](_0x3bb19d['shift']());}};_0x4c8442(++_0x4e2eca);}(_0x0e6d,0x146));var _0xd0e6=function(_0x149980,_0xeb67c8){_0x149980=_0x149980-0x0;var _0x3aacce=_0x0e6d[_0x149980];return _0x3aacce;};'use strict';var _=require(_0xd0e6('0x0'));var util=require(_0xd0e6('0x1'));var logger=require(_0xd0e6('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd0e6('0x3'));var rp=require(_0xd0e6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd0e6('0x5'));var config=require(_0xd0e6('0x6'));var attributes=require(_0xd0e6('0x7'));module[_0xd0e6('0x8')]=function(_0x31c304,_0x3eba5a){return _0x31c304[_0xd0e6('0x9')](_0xd0e6('0xa'),attributes,{'tableName':_0xd0e6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6476=['define','Team','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./team.attributes','exports'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x6476,0x195));var _0x6647=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x6476[_0x433a86];return _0x23000c;};'use strict';var _=require(_0x6647('0x0'));var util=require(_0x6647('0x1'));var logger=require('../../config/logger')(_0x6647('0x2'));var moment=require(_0x6647('0x3'));var BPromise=require(_0x6647('0x4'));var rp=require(_0x6647('0x5'));var fs=require('fs');var path=require(_0x6647('0x6'));var rimraf=require(_0x6647('0x7'));var config=require(_0x6647('0x8'));var attributes=require(_0x6647('0x9'));module[_0x6647('0xa')]=function(_0x1987d6,_0x324625){return _0x1987d6[_0x6647('0xb')](_0x6647('0xc'),attributes,{'tableName':'teams','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 4bf34bc..2d8f597 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 _0x1268=['info','Team,\x20%s,\x20%s','Team,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./team.socket','register','request','then'];(function(_0x337839,_0x5eac3c){var _0x325d48=function(_0x2e831f){while(--_0x2e831f){_0x337839['push'](_0x337839['shift']());}};_0x325d48(++_0x5eac3c);}(_0x1268,0x10d));var _0x8126=function(_0x949210,_0x2f8a32){_0x949210=_0x949210-0x0;var _0xdd151b=_0x1268[_0x949210];return _0xdd151b;};'use strict';var _=require(_0x8126('0x0'));var util=require(_0x8126('0x1'));var moment=require(_0x8126('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8126('0x3'))['db'];var utils=require(_0x8126('0x4'));var logger=require(_0x8126('0x5'))('rpc');var config=require(_0x8126('0x6'));var jayson=require(_0x8126('0x7'));var client=jayson[_0x8126('0x8')][_0x8126('0x9')]({'port':0x232a});config[_0x8126('0xa')]=_[_0x8126('0xb')](config[_0x8126('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x8126('0xc'))(new Redis(config[_0x8126('0xa')]));require(_0x8126('0xd'))[_0x8126('0xe')](socket);function respondWithRpcPromise(_0x5d719a,_0x2fdc03,_0x45a851){return new BPromise(function(_0xddcd56,_0xf4956){return client[_0x8126('0xf')](_0x5d719a,_0x45a851)[_0x8126('0x10')](function(_0x4da2f5){logger[_0x8126('0x11')](_0x8126('0x12'),_0x2fdc03,'request\x20sent');logger['debug'](_0x8126('0x13'),_0x2fdc03,'request\x20sent',JSON[_0x8126('0x14')](_0x4da2f5));if(_0x4da2f5['error']){if(_0x4da2f5['error'][_0x8126('0x15')]===0x1f4){logger['error'](_0x8126('0x12'),_0x2fdc03,_0x4da2f5[_0x8126('0x16')]['message']);return _0xf4956(_0x4da2f5[_0x8126('0x16')][_0x8126('0x17')]);}logger[_0x8126('0x16')](_0x8126('0x12'),_0x2fdc03,_0x4da2f5[_0x8126('0x16')][_0x8126('0x17')]);return _0xddcd56(_0x4da2f5[_0x8126('0x16')][_0x8126('0x17')]);}else{logger[_0x8126('0x11')]('Team,\x20%s,\x20%s',_0x2fdc03,_0x8126('0x18'));_0xddcd56(_0x4da2f5[_0x8126('0x19')][_0x8126('0x17')]);}})['catch'](function(_0x5c2b0c){logger['error'](_0x8126('0x12'),_0x2fdc03,_0x5c2b0c);_0xf4956(_0x5c2b0c);});});} \ No newline at end of file +var _0x4cd7=['message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./team.socket','register','request','then','info','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Team,\x20%s,\x20%s'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x4cd7,0x1de));var _0x74cd=function(_0x59d224,_0x511d4a){_0x59d224=_0x59d224-0x0;var _0xce4248=_0x4cd7[_0x59d224];return _0xce4248;};'use strict';var _=require('lodash');var util=require(_0x74cd('0x0'));var moment=require(_0x74cd('0x1'));var BPromise=require(_0x74cd('0x2'));var rs=require(_0x74cd('0x3'));var fs=require('fs');var Redis=require(_0x74cd('0x4'));var db=require(_0x74cd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x74cd('0x6'))('rpc');var config=require(_0x74cd('0x7'));var jayson=require(_0x74cd('0x8'));var client=jayson[_0x74cd('0x9')][_0x74cd('0xa')]({'port':0x232a});config['redis']=_[_0x74cd('0xb')](config[_0x74cd('0xc')],{'host':_0x74cd('0xd'),'port':0x18eb});var socket=require(_0x74cd('0xe'))(new Redis(config['redis']));require(_0x74cd('0xf'))[_0x74cd('0x10')](socket);function respondWithRpcPromise(_0x302bdb,_0x29f2e6,_0xe6ddff){return new BPromise(function(_0x5eb8ae,_0x35de16){return client[_0x74cd('0x11')](_0x302bdb,_0xe6ddff)[_0x74cd('0x12')](function(_0x451c75){logger[_0x74cd('0x13')]('Team,\x20%s,\x20%s',_0x29f2e6,'request\x20sent');logger[_0x74cd('0x14')](_0x74cd('0x15'),_0x29f2e6,_0x74cd('0x16'),JSON['stringify'](_0x451c75));if(_0x451c75[_0x74cd('0x17')]){if(_0x451c75['error'][_0x74cd('0x18')]===0x1f4){logger['error'](_0x74cd('0x19'),_0x29f2e6,_0x451c75[_0x74cd('0x17')][_0x74cd('0x1a')]);return _0x35de16(_0x451c75[_0x74cd('0x17')][_0x74cd('0x1a')]);}logger[_0x74cd('0x17')](_0x74cd('0x19'),_0x29f2e6,_0x451c75['error'][_0x74cd('0x1a')]);return _0x5eb8ae(_0x451c75[_0x74cd('0x17')][_0x74cd('0x1a')]);}else{logger[_0x74cd('0x13')](_0x74cd('0x19'),_0x29f2e6,_0x74cd('0x16'));_0x5eb8ae(_0x451c75[_0x74cd('0x1b')]['message']);}})['catch'](function(_0x29bdac){logger[_0x74cd('0x17')](_0x74cd('0x19'),_0x29f2e6,_0x29bdac);_0x35de16(_0x29bdac);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 695d65e..fde0fb3 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 _0x2242=['register','length','team:','./team.events','save','remove','emit','removeListener'];(function(_0x1a0600,_0x41feef){var _0x734670=function(_0x2da4e4){while(--_0x2da4e4){_0x1a0600['push'](_0x1a0600['shift']());}};_0x734670(++_0x41feef);}(_0x2242,0x1a3));var _0x2224=function(_0x4bac3e,_0x413176){_0x4bac3e=_0x4bac3e-0x0;var _0x59fc8d=_0x2242[_0x4bac3e];return _0x59fc8d;};'use strict';var TeamEvents=require(_0x2224('0x0'));var events=[_0x2224('0x1'),_0x2224('0x2'),'update'];function createListener(_0x3180c8,_0x317565){return function(_0x4acc10){_0x317565[_0x2224('0x3')](_0x3180c8,_0x4acc10);};}function removeListener(_0xb65b2f,_0x4b2099){return function(){TeamEvents[_0x2224('0x4')](_0xb65b2f,_0x4b2099);};}exports[_0x2224('0x5')]=function(_0x23a873){for(var _0x54d057=0x0,_0x28833b=events[_0x2224('0x6')];_0x54d057<_0x28833b;_0x54d057++){var _0x35f807=events[_0x54d057];var _0x25c6d4=createListener(_0x2224('0x7')+_0x35f807,_0x23a873);TeamEvents['on'](_0x35f807,_0x25c6d4);}}; \ No newline at end of file +var _0xbe62=['register','length','team:','save','emit'];(function(_0x4a1dbf,_0x43992d){var _0x2dea37=function(_0x168903){while(--_0x168903){_0x4a1dbf['push'](_0x4a1dbf['shift']());}};_0x2dea37(++_0x43992d);}(_0xbe62,0x9e));var _0x2be6=function(_0x3bfd56,_0x3d0aca){_0x3bfd56=_0x3bfd56-0x0;var _0x59b827=_0xbe62[_0x3bfd56];return _0x59b827;};'use strict';var TeamEvents=require('./team.events');var events=[_0x2be6('0x0'),'remove','update'];function createListener(_0x4ac9b6,_0x4b7ee1){return function(_0x2ddf14){_0x4b7ee1[_0x2be6('0x1')](_0x4ac9b6,_0x2ddf14);};}function removeListener(_0x12a7cd,_0x3d043d){return function(){TeamEvents['removeListener'](_0x12a7cd,_0x3d043d);};}exports[_0x2be6('0x2')]=function(_0x15a434){for(var _0x2e6c00=0x0,_0x4bc271=events[_0x2be6('0x3')];_0x2e6c00<_0x4bc271;_0x2e6c00++){var _0x573ada=events[_0x2e6c00];var _0x21def5=createListener(_0x2be6('0x4')+_0x573ada,_0x15a434);TeamEvents['on'](_0x573ada,_0x21def5);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index afb1c7b..200479b 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 _0xf43e=['sequelize','exports','INTEGER'];(function(_0x4e7c2,_0x3b3347){var _0x84bb35=function(_0x217b38){while(--_0x217b38){_0x4e7c2['push'](_0x4e7c2['shift']());}};_0x84bb35(++_0x3b3347);}(_0xf43e,0x75));var _0xef43=function(_0x24917b,_0x3cd084){_0x24917b=_0x24917b-0x0;var _0x30ec59=_0xf43e[_0x24917b];return _0x30ec59;};'use strict';var Sequelize=require(_0xef43('0x0'));module[_0xef43('0x1')]={'TeamId':{'type':Sequelize[_0xef43('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xef43('0x2')]}}; \ No newline at end of file +var _0x6c4b=['sequelize','exports','INTEGER'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x6c4b,0x93));var _0xb6c4=function(_0x3cb646,_0xdfd9e7){_0x3cb646=_0x3cb646-0x0;var _0x124430=_0x6c4b[_0x3cb646];return _0x124430;};'use strict';var Sequelize=require(_0xb6c4('0x0'));module[_0xb6c4('0x1')]={'TeamId':{'type':Sequelize[_0xb6c4('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index e2e7e4a..ad33b20 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 _0x81a5=['moment','bluebird','path','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api'];(function(_0x527400,_0x22ec2a){var _0x361f86=function(_0x598a1b){while(--_0x598a1b){_0x527400['push'](_0x527400['shift']());}};_0x361f86(++_0x22ec2a);}(_0x81a5,0x1c8));var _0x581a=function(_0x3b7501,_0x3e7f86){_0x3b7501=_0x3b7501-0x0;var _0x5c8e2e=_0x81a5[_0x3b7501];return _0x5c8e2e;};'use strict';var _=require(_0x581a('0x0'));var util=require(_0x581a('0x1'));var logger=require(_0x581a('0x2'))(_0x581a('0x3'));var moment=require(_0x581a('0x4'));var BPromise=require(_0x581a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x581a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./teamVoicePrefix.attributes');module['exports']=function(_0x21fea7,_0x56065e){return _0x21fea7[_0x581a('0x7')](_0x581a('0x8'),attributes,{'tableName':_0x581a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x19c3=['bluebird','request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','../../config/logger','api'];(function(_0x237f8b,_0xc5eddb){var _0x423f94=function(_0x1f18f9){while(--_0x1f18f9){_0x237f8b['push'](_0x237f8b['shift']());}};_0x423f94(++_0xc5eddb);}(_0x19c3,0xf9));var _0x319c=function(_0xde55a9,_0x287bb0){_0xde55a9=_0xde55a9-0x0;var _0x3c5611=_0x19c3[_0xde55a9];return _0x3c5611;};'use strict';var _=require(_0x319c('0x0'));var util=require('util');var logger=require(_0x319c('0x1'))(_0x319c('0x2'));var moment=require('moment');var BPromise=require(_0x319c('0x3'));var rp=require(_0x319c('0x4'));var fs=require('fs');var path=require(_0x319c('0x5'));var rimraf=require(_0x319c('0x6'));var config=require(_0x319c('0x7'));var attributes=require(_0x319c('0x8'));module['exports']=function(_0x20f77e,_0x53a1de){return _0x20f77e[_0x319c('0x9')](_0x319c('0xa'),attributes,{'tableName':_0x319c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index ab60d9c..7a85a45 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x34cab6,_0x23724e){var _0x29874c=function(_0x24f299){while(--_0x24f299){_0x34cab6['push'](_0x34cab6['shift']());}};_0x29874c(++_0x23724e);}(_0x9c44,0x178));var _0x49c4=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x9c44[_0x2dea24];return _0x309d58;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x19c1c8,_0x2f0b5d){var _0x39a68a=function(_0x254985){while(--_0x254985){_0x19c1c8['push'](_0x19c1c8['shift']());}};_0x39a68a(++_0x2f0b5d);}(_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 diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 0e49847..22a7630 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 _0xfb08=['INTEGER'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0xfb08,0x12c));var _0x8fb0=function(_0x103541,_0x1bd09a){_0x103541=_0x103541-0x0;var _0x2c4e99=_0xfb08[_0x103541];return _0x2c4e99;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x8fb0('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0298=['INTEGER','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0298,0x95));var _0x8029=function(_0x185af2,_0x2d0be5){_0x185af2=_0x185af2-0x0;var _0x46d876=_0x0298[_0x185af2];return _0x46d876;};'use strict';var Sequelize=require(_0x8029('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x8029('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 229fda6..ec46237 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 _0xaba6=['define','team_has_voice_queues','lodash','util','request-promise','path','../../config/environment','./teamVoiceQueue.attributes'];(function(_0x378aae,_0x57fc0b){var _0x2afaa1=function(_0x463500){while(--_0x463500){_0x378aae['push'](_0x378aae['shift']());}};_0x2afaa1(++_0x57fc0b);}(_0xaba6,0xe2));var _0x6aba=function(_0x1181f3,_0xf81baa){_0x1181f3=_0x1181f3-0x0;var _0x37abb6=_0xaba6[_0x1181f3];return _0x37abb6;};'use strict';var _=require(_0x6aba('0x0'));var util=require(_0x6aba('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6aba('0x2'));var fs=require('fs');var path=require(_0x6aba('0x3'));var rimraf=require('rimraf');var config=require(_0x6aba('0x4'));var attributes=require(_0x6aba('0x5'));module['exports']=function(_0x4e929a,_0x5ae14c){return _0x4e929a[_0x6aba('0x6')]('TeamVoiceQueue',attributes,{'tableName':_0x6aba('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x17ba=['define','TeamVoiceQueue','team_has_voice_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports'];(function(_0x54e8f7,_0x1e7f85){var _0x3a1cd0=function(_0x2da115){while(--_0x2da115){_0x54e8f7['push'](_0x54e8f7['shift']());}};_0x3a1cd0(++_0x1e7f85);}(_0x17ba,0xab));var _0xa17b=function(_0x4cde93,_0x2a7eb6){_0x4cde93=_0x4cde93-0x0;var _0x48b29f=_0x17ba[_0x4cde93];return _0x48b29f;};'use strict';var _=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var logger=require('../../config/logger')(_0xa17b('0x2'));var moment=require(_0xa17b('0x3'));var BPromise=require(_0xa17b('0x4'));var rp=require(_0xa17b('0x5'));var fs=require('fs');var path=require(_0xa17b('0x6'));var rimraf=require(_0xa17b('0x7'));var config=require(_0xa17b('0x8'));var attributes=require(_0xa17b('0x9'));module[_0xa17b('0xa')]=function(_0x3cced2,_0xf72ed4){return _0x3cced2[_0xa17b('0xb')](_0xa17b('0xc'),attributes,{'tableName':_0xa17b('0xd'),'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 9b65f63..aa196d0 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 _0xd2ea=['../../config/environment','jayson/promise','client','request','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x371d1a,_0x17b8de){var _0x492c7b=function(_0x35200e){while(--_0x35200e){_0x371d1a['push'](_0x371d1a['shift']());}};_0x492c7b(++_0x17b8de);}(_0xd2ea,0x15f));var _0xad2e=function(_0x2fa593,_0x3df231){_0x2fa593=_0x2fa593-0x0;var _0x1b2f07=_0xd2ea[_0x2fa593];return _0x1b2f07;};'use strict';var _=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var moment=require(_0xad2e('0x2'));var BPromise=require(_0xad2e('0x3'));var rs=require(_0xad2e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad2e('0x5'))['db'];var utils=require(_0xad2e('0x6'));var logger=require(_0xad2e('0x7'))(_0xad2e('0x8'));var config=require(_0xad2e('0x9'));var jayson=require(_0xad2e('0xa'));var client=jayson[_0xad2e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b5170,_0x3e3d1f,_0x2ff7b2){return new BPromise(function(_0x5710ac,_0x1e0e9e){return client[_0xad2e('0xc')](_0x3b5170,_0x2ff7b2)['then'](function(_0x1eed2f){logger['info'](_0xad2e('0xd'),_0x3e3d1f,_0xad2e('0xe'));logger[_0xad2e('0xf')](_0xad2e('0x10'),_0x3e3d1f,'request\x20sent',JSON[_0xad2e('0x11')](_0x1eed2f));if(_0x1eed2f['error']){if(_0x1eed2f[_0xad2e('0x12')][_0xad2e('0x13')]===0x1f4){logger[_0xad2e('0x12')](_0xad2e('0xd'),_0x3e3d1f,_0x1eed2f['error'][_0xad2e('0x14')]);return _0x1e0e9e(_0x1eed2f['error'][_0xad2e('0x14')]);}logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x3e3d1f,_0x1eed2f['error']['message']);return _0x5710ac(_0x1eed2f[_0xad2e('0x12')][_0xad2e('0x14')]);}else{logger[_0xad2e('0x15')](_0xad2e('0xd'),_0x3e3d1f,_0xad2e('0xe'));_0x5710ac(_0x1eed2f[_0xad2e('0x16')][_0xad2e('0x14')]);}})[_0xad2e('0x17')](function(_0xd40b31){logger[_0xad2e('0x12')](_0xad2e('0xd'),_0x3e3d1f,_0xd40b31);_0x1e0e9e(_0xd40b31);});});} \ No newline at end of file +var _0xc2b0=['../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','bluebird','randomstring','../../mysqldb'];(function(_0x171bc2,_0x499f65){var _0x328c04=function(_0x412c3a){while(--_0x412c3a){_0x171bc2['push'](_0x171bc2['shift']());}};_0x328c04(++_0x499f65);}(_0xc2b0,0x13c));var _0x0c2b=function(_0x4557dc,_0x3687b2){_0x4557dc=_0x4557dc-0x0;var _0x1377aa=_0xc2b0[_0x4557dc];return _0x1377aa;};'use strict';var _=require(_0x0c2b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0c2b('0x1'));var rs=require(_0x0c2b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0c2b('0x3'))['db'];var utils=require(_0x0c2b('0x4'));var logger=require(_0x0c2b('0x5'))(_0x0c2b('0x6'));var config=require(_0x0c2b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0c2b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33a900,_0x5c7f50,_0x2c1b85){return new BPromise(function(_0x1dd75a,_0x4c74b0){return client[_0x0c2b('0x9')](_0x33a900,_0x2c1b85)[_0x0c2b('0xa')](function(_0x307821){logger['info'](_0x0c2b('0xb'),_0x5c7f50,_0x0c2b('0xc'));logger[_0x0c2b('0xd')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x5c7f50,_0x0c2b('0xc'),JSON['stringify'](_0x307821));if(_0x307821[_0x0c2b('0xe')]){if(_0x307821['error'][_0x0c2b('0xf')]===0x1f4){logger[_0x0c2b('0xe')](_0x0c2b('0xb'),_0x5c7f50,_0x307821[_0x0c2b('0xe')][_0x0c2b('0x10')]);return _0x4c74b0(_0x307821[_0x0c2b('0xe')][_0x0c2b('0x10')]);}logger['error'](_0x0c2b('0xb'),_0x5c7f50,_0x307821['error'][_0x0c2b('0x10')]);return _0x1dd75a(_0x307821['error'][_0x0c2b('0x10')]);}else{logger[_0x0c2b('0x11')](_0x0c2b('0xb'),_0x5c7f50,_0x0c2b('0xc'));_0x1dd75a(_0x307821[_0x0c2b('0x12')][_0x0c2b('0x10')]);}})[_0x0c2b('0x13')](function(_0x220527){logger[_0x0c2b('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x5c7f50,_0x220527);_0x4c74b0(_0x220527);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 2f73c9e..a334588 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 _0x0b0e=['./template.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xbe0bad,_0x242e22){var _0x2a18cc=function(_0x17f8ff){while(--_0x17f8ff){_0xbe0bad['push'](_0xbe0bad['shift']());}};_0x2a18cc(++_0x242e22);}(_0x0b0e,0x187));var _0xe0b0=function(_0x246890,_0x46b964){_0x246890=_0x246890-0x0;var _0x2b2a5a=_0x0b0e[_0x246890];return _0x2b2a5a;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0xd')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xf'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x10')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x11')]);module[_0xe0b0('0x12')]=router; \ No newline at end of file +var _0x0120=['../../config/environment','./template.controller','get','/:id','isAuthenticated','show','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x32ae0a,_0x209e9a){var _0x52603d=function(_0x446537){while(--_0x446537){_0x32ae0a['push'](_0x32ae0a['shift']());}};_0x52603d(++_0x209e9a);}(_0x0120,0x6f));var _0x0012=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x0120[_0xa1e3e3];return _0xc980e9;};'use strict';var multer=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var path=require(_0x0012('0x2'));var timeout=require(_0x0012('0x3'));var express=require(_0x0012('0x4'));var router=express[_0x0012('0x5')]();var fs_extra=require(_0x0012('0x6'));var auth=require(_0x0012('0x7'));var interaction=require(_0x0012('0x8'));var config=require(_0x0012('0x9'));var controller=require(_0x0012('0xa'));router[_0x0012('0xb')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x0012('0xc'),auth[_0x0012('0xd')](),controller[_0x0012('0xe')]);router[_0x0012('0xf')]('/',auth[_0x0012('0xd')](),controller['create']);router[_0x0012('0x10')](_0x0012('0xc'),auth[_0x0012('0xd')](),controller[_0x0012('0x11')]);router['delete'](_0x0012('0xc'),auth['isAuthenticated'](),controller[_0x0012('0x12')]);module[_0x0012('0x13')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index c0def1d..74ccbaa 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 _0x2c85=['STRING','TEXT','sequelize'];(function(_0x3ea6ab,_0x318298){var _0x39bd08=function(_0x51d193){while(--_0x51d193){_0x3ea6ab['push'](_0x3ea6ab['shift']());}};_0x39bd08(++_0x318298);}(_0x2c85,0x191));var _0x52c8=function(_0x517898,_0xc34345){_0x517898=_0x517898-0x0;var _0x6f87d1=_0x2c85[_0x517898];return _0x6f87d1;};'use strict';var Sequelize=require(_0x52c8('0x0'));module['exports']={'name':{'type':Sequelize[_0x52c8('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x52c8('0x2')]}}; \ No newline at end of file +var _0x8d86=['exports','STRING','sequelize'];(function(_0x2688d5,_0x45db72){var _0x372637=function(_0x51c20d){while(--_0x51c20d){_0x2688d5['push'](_0x2688d5['shift']());}};_0x372637(++_0x45db72);}(_0x8d86,0x17c));var _0x68d8=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x8d86[_0x342700];return _0x53406f;};'use strict';var Sequelize=require(_0x68d8('0x0'));module[_0x68d8('0x1')]={'name':{'type':Sequelize[_0x68d8('0x2')]},'description':{'type':Sequelize['STRING']},'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 a1ab532..7d0c3c4 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 _0x8fc8=['order','where','pick','VIRTUAL','filter','options','Template','findAll','rows','catch','show','params','include','merge','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','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','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','Templates','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x2a32b7,_0x29b767){var _0x44c5c3=function(_0x94a295){while(--_0x94a295){_0x2a32b7['push'](_0x2a32b7['shift']());}};_0x44c5c3(++_0x29b767);}(_0x8fc8,0x6c));var _0x88fc=function(_0x4fe9ee,_0x3e8038){_0x4fe9ee=_0x4fe9ee-0x0;var _0x5d1ed6=_0x8fc8[_0x4fe9ee];return _0x5d1ed6;};'use strict';var emlformat=require(_0x88fc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x88fc('0x1'));var moment=require(_0x88fc('0x2'));var BPromise=require(_0x88fc('0x3'));var Mustache=require(_0x88fc('0x4'));var util=require(_0x88fc('0x5'));var path=require(_0x88fc('0x6'));var sox=require(_0x88fc('0x7'));var csv=require(_0x88fc('0x8'));var ejs=require(_0x88fc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x88fc('0xa'));var squel=require(_0x88fc('0xb'));var crypto=require(_0x88fc('0xc'));var jsforce=require(_0x88fc('0xd'));var deskjs=require(_0x88fc('0xe'));var toCsv=require(_0x88fc('0x8'));var querystring=require(_0x88fc('0xf'));var Papa=require(_0x88fc('0x10'));var Redis=require(_0x88fc('0x11'));var authService=require(_0x88fc('0x12'));var qs=require(_0x88fc('0x13'));var as=require(_0x88fc('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x88fc('0x15'))(_0x88fc('0x16'));var utils=require(_0x88fc('0x17'));var config=require(_0x88fc('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c632e,_0x10f67a){_0x10f67a=_0x10f67a||0xcc;return function(_0x498457){if(_0x498457){return _0x5c632e['sendStatus'](_0x10f67a);}return _0x5c632e[_0x88fc('0x19')](_0x10f67a)[_0x88fc('0x1a')]();};}function respondWithResult(_0x2b2b27,_0x390927){_0x390927=_0x390927||0xc8;return function(_0x3b9fc9){if(_0x3b9fc9){return _0x2b2b27[_0x88fc('0x19')](_0x390927)[_0x88fc('0x1b')](_0x3b9fc9);}};}function respondWithFilteredResult(_0x58cdb4,_0x3570c6){return function(_0x521fed){if(_0x521fed){var _0x447deb=typeof _0x3570c6[_0x88fc('0x1c')]===_0x88fc('0x1d')&&typeof _0x3570c6[_0x88fc('0x1e')]===_0x88fc('0x1d');var _0x44713a=_0x521fed[_0x88fc('0x1f')];var _0x449677=_0x447deb?0x0:_0x3570c6[_0x88fc('0x1c')];var _0x300b47=_0x447deb?_0x521fed[_0x88fc('0x1f')]:_0x3570c6['offset']+_0x3570c6['limit'];var _0x399a41;if(_0x300b47>=_0x44713a){_0x300b47=_0x44713a;_0x399a41=0xc8;}else{_0x399a41=0xce;}_0x58cdb4['status'](_0x399a41);return _0x58cdb4[_0x88fc('0x20')](_0x88fc('0x21'),_0x449677+'-'+_0x300b47+'/'+_0x44713a)['json'](_0x521fed);}return null;};}function patchUpdates(_0x461273){return function(_0x2c9c25){try{jsonpatch[_0x88fc('0x22')](_0x2c9c25,_0x461273,!![]);}catch(_0x364fbd){return BPromise['reject'](_0x364fbd);}return _0x2c9c25[_0x88fc('0x23')]();};}function saveUpdates(_0x398926,_0x2f6fe4){return function(_0xf47668){if(_0xf47668){return _0xf47668[_0x88fc('0x24')](_0x398926)[_0x88fc('0x25')](function(_0x3c7142){return _0x3c7142;});}return null;};}function removeEntity(_0xb21b4a,_0x20da2e){return function(_0x5ba559){if(_0x5ba559){return _0x5ba559['destroy']()['then'](function(){var _0x432b4e=_0x5ba559[_0x88fc('0x26')]({'plain':!![]});var _0x52c2bb=_0x88fc('0x27');return db[_0x88fc('0x28')][_0x88fc('0x29')]({'where':{'type':_0x52c2bb,'resourceId':_0x432b4e['id']}})[_0x88fc('0x25')](function(){return _0x5ba559;});})[_0x88fc('0x25')](function(){_0xb21b4a[_0x88fc('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x246502,_0x20bab2){return function(_0x4ccff7){if(!_0x4ccff7){_0x246502[_0x88fc('0x2a')](0x194);}return _0x4ccff7;};}function handleError(_0x472049,_0x487bb6){_0x487bb6=_0x487bb6||0x1f4;return function(_0x246f17){logger[_0x88fc('0x2b')](_0x246f17[_0x88fc('0x2c')]);if(_0x246f17[_0x88fc('0x2d')]){delete _0x246f17['name'];}_0x472049[_0x88fc('0x19')](_0x487bb6)[_0x88fc('0x2e')](_0x246f17);};}exports[_0x88fc('0x2f')]=function(_0x881ad2,_0xbb0e67){var _0x26c296={},_0x2aeda3={},_0xd05c2c={'count':0x0,'rows':[]};var _0x109fdd=_[_0x88fc('0x30')](db['Template'][_0x88fc('0x31')],function(_0x4e1070){return{'name':_0x4e1070['fieldName'],'type':_0x4e1070[_0x88fc('0x32')][_0x88fc('0x33')]};});_0x2aeda3['model']=_[_0x88fc('0x30')](_0x109fdd,_0x88fc('0x2d'));_0x2aeda3[_0x88fc('0x34')]=_[_0x88fc('0x35')](_0x881ad2[_0x88fc('0x34')]);_0x2aeda3[_0x88fc('0x36')]=_[_0x88fc('0x37')](_0x2aeda3[_0x88fc('0x38')],_0x2aeda3[_0x88fc('0x34')]);_0x26c296['attributes']=_['intersection'](_0x2aeda3['model'],qs[_0x88fc('0x39')](_0x881ad2[_0x88fc('0x34')][_0x88fc('0x39')]));_0x26c296[_0x88fc('0x3a')]=_0x26c296[_0x88fc('0x3a')][_0x88fc('0x3b')]?_0x26c296[_0x88fc('0x3a')]:_0x2aeda3[_0x88fc('0x38')];if(!_0x881ad2['query'][_0x88fc('0x3c')](_0x88fc('0x3d'))){_0x26c296[_0x88fc('0x1e')]=qs['limit'](_0x881ad2['query']['limit']);_0x26c296[_0x88fc('0x1c')]=qs['offset'](_0x881ad2[_0x88fc('0x34')][_0x88fc('0x1c')]);}_0x26c296[_0x88fc('0x3e')]=qs['sort'](_0x881ad2[_0x88fc('0x34')]['sort']);_0x26c296[_0x88fc('0x3f')]=qs['filters'](_[_0x88fc('0x40')](_0x881ad2['query'],_0x2aeda3[_0x88fc('0x36')]),_0x109fdd);if(_0x881ad2[_0x88fc('0x34')]['filter']){_0x26c296[_0x88fc('0x3f')]=_['merge'](_0x26c296['where'],{'$or':_[_0x88fc('0x30')](_0x109fdd,function(_0x18c8a8){if(_0x18c8a8[_0x88fc('0x32')]!==_0x88fc('0x41')){var _0x170f8c={};_0x170f8c[_0x18c8a8[_0x88fc('0x2d')]]={'$like':'%'+_0x881ad2[_0x88fc('0x34')][_0x88fc('0x42')]+'%'};return _0x170f8c;}})});}_0x26c296=_['merge']({},_0x26c296,_0x881ad2[_0x88fc('0x43')]);var _0x207f5c={'where':_0x26c296[_0x88fc('0x3f')]};return db[_0x88fc('0x44')][_0x88fc('0x1f')](_0x207f5c)[_0x88fc('0x25')](function(_0x3d5507){_0xd05c2c['count']=_0x3d5507;if(_0x881ad2[_0x88fc('0x34')]['includeAll']){_0x26c296['include']=[{'all':!![]}];}return db[_0x88fc('0x44')][_0x88fc('0x45')](_0x26c296);})[_0x88fc('0x25')](function(_0x5cfa93){_0xd05c2c[_0x88fc('0x46')]=_0x5cfa93;return _0xd05c2c;})['then'](respondWithFilteredResult(_0xbb0e67,_0x26c296))[_0x88fc('0x47')](handleError(_0xbb0e67,null));};exports[_0x88fc('0x48')]=function(_0x314334,_0x184d2b){var _0x2a4245={'raw':!![],'where':{'id':_0x314334[_0x88fc('0x49')]['id']}},_0x22216f={};_0x22216f[_0x88fc('0x38')]=_[_0x88fc('0x35')](db[_0x88fc('0x44')][_0x88fc('0x31')]);_0x22216f[_0x88fc('0x34')]=_['keys'](_0x314334[_0x88fc('0x34')]);_0x22216f[_0x88fc('0x36')]=_[_0x88fc('0x37')](_0x22216f['model'],_0x22216f[_0x88fc('0x34')]);_0x2a4245['attributes']=_[_0x88fc('0x37')](_0x22216f[_0x88fc('0x38')],qs['fields'](_0x314334[_0x88fc('0x34')]['fields']));_0x2a4245[_0x88fc('0x3a')]=_0x2a4245[_0x88fc('0x3a')][_0x88fc('0x3b')]?_0x2a4245['attributes']:_0x22216f['model'];if(_0x314334[_0x88fc('0x34')]['includeAll']){_0x2a4245[_0x88fc('0x4a')]=[{'all':!![]}];}_0x2a4245=_[_0x88fc('0x4b')]({},_0x2a4245,_0x314334[_0x88fc('0x43')]);return db[_0x88fc('0x44')][_0x88fc('0x4c')](_0x2a4245)[_0x88fc('0x25')](handleEntityNotFound(_0x184d2b,null))[_0x88fc('0x25')](respondWithResult(_0x184d2b,null))[_0x88fc('0x47')](handleError(_0x184d2b,null));};exports['create']=function(_0x22d67d,_0x4f8d41){return db[_0x88fc('0x44')]['create'](_0x22d67d[_0x88fc('0x4d')],{})[_0x88fc('0x25')](function(_0x2690c1){var _0x388c1a=_0x22d67d['user'][_0x88fc('0x26')]({'plain':!![]});if(!_0x388c1a)throw new Error(_0x88fc('0x4e'));if(_0x388c1a[_0x88fc('0x4f')]===_0x88fc('0x50')){var _0x23bea5=_0x2690c1[_0x88fc('0x26')]({'plain':!![]});var _0x2cdfa5=_0x88fc('0x27');return db[_0x88fc('0x51')][_0x88fc('0x4c')]({'where':{'name':_0x2cdfa5,'userProfileId':_0x388c1a[_0x88fc('0x52')]},'raw':!![]})['then'](function(_0xb906e6){if(_0xb906e6&&_0xb906e6['autoAssociation']===0x0){return db['UserProfileResource'][_0x88fc('0x53')]({'name':_0x23bea5[_0x88fc('0x2d')],'resourceId':_0x23bea5['id'],'type':_0xb906e6[_0x88fc('0x2d')],'sectionId':_0xb906e6['id']},{})['then'](function(){return _0x2690c1;});}else{return _0x2690c1;}})[_0x88fc('0x47')](function(_0x846645){logger[_0x88fc('0x2b')](_0x88fc('0x54'),_0x846645);throw _0x846645;});}return _0x2690c1;})['then'](respondWithResult(_0x4f8d41,0xc9))['catch'](handleError(_0x4f8d41,null));};exports[_0x88fc('0x24')]=function(_0x220543,_0x16222e){if(_0x220543[_0x88fc('0x4d')]['id']){delete _0x220543[_0x88fc('0x4d')]['id'];}return db[_0x88fc('0x44')][_0x88fc('0x4c')]({'where':{'id':_0x220543['params']['id']}})[_0x88fc('0x25')](handleEntityNotFound(_0x16222e,null))[_0x88fc('0x25')](saveUpdates(_0x220543[_0x88fc('0x4d')],null))[_0x88fc('0x25')](respondWithResult(_0x16222e,null))['catch'](handleError(_0x16222e,null));};exports[_0x88fc('0x29')]=function(_0xf3d4c3,_0x1a21a5){return db[_0x88fc('0x44')][_0x88fc('0x4c')]({'where':{'id':_0xf3d4c3['params']['id']}})[_0x88fc('0x25')](handleEntityNotFound(_0x1a21a5,null))[_0x88fc('0x25')](removeEntity(_0x1a21a5,null))[_0x88fc('0x47')](handleError(_0x1a21a5,null));}; \ No newline at end of file +var _0x6cc6=['name','send','Template','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','include','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','get','Templates','UserProfileResource','destroy','error','stack'];(function(_0x30884c,_0x560d93){var _0xf149a8=function(_0x4db89c){while(--_0x4db89c){_0x30884c['push'](_0x30884c['shift']());}};_0xf149a8(++_0x560d93);}(_0x6cc6,0x1df));var _0x66cc=function(_0x32dd88,_0x404675){_0x32dd88=_0x32dd88-0x0;var _0x38c736=_0x6cc6[_0x32dd88];return _0x38c736;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x66cc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x66cc('0x1'));var rp=require(_0x66cc('0x2'));var moment=require(_0x66cc('0x3'));var BPromise=require(_0x66cc('0x4'));var Mustache=require(_0x66cc('0x5'));var util=require(_0x66cc('0x6'));var path=require(_0x66cc('0x7'));var sox=require(_0x66cc('0x8'));var csv=require(_0x66cc('0x9'));var ejs=require(_0x66cc('0xa'));var fs=require('fs');var fs_extra=require(_0x66cc('0xb'));var _=require('lodash');var squel=require(_0x66cc('0xc'));var crypto=require(_0x66cc('0xd'));var jsforce=require(_0x66cc('0xe'));var deskjs=require(_0x66cc('0xf'));var toCsv=require(_0x66cc('0x9'));var querystring=require(_0x66cc('0x10'));var Papa=require(_0x66cc('0x11'));var Redis=require('ioredis');var authService=require(_0x66cc('0x12'));var qs=require(_0x66cc('0x13'));var as=require(_0x66cc('0x14'));var hardwareService=require(_0x66cc('0x15'));var logger=require(_0x66cc('0x16'))(_0x66cc('0x17'));var utils=require(_0x66cc('0x18'));var config=require(_0x66cc('0x19'));var licenseUtil=require(_0x66cc('0x1a'));var db=require(_0x66cc('0x1b'))['db'];function respondWithStatusCode(_0x2da0a7,_0xd8a1c4){_0xd8a1c4=_0xd8a1c4||0xcc;return function(_0x3aee62){if(_0x3aee62){return _0x2da0a7[_0x66cc('0x1c')](_0xd8a1c4);}return _0x2da0a7['status'](_0xd8a1c4)[_0x66cc('0x1d')]();};}function respondWithResult(_0x1ed157,_0x10ea9d){_0x10ea9d=_0x10ea9d||0xc8;return function(_0x162e7e){if(_0x162e7e){return _0x1ed157[_0x66cc('0x1e')](_0x10ea9d)[_0x66cc('0x1f')](_0x162e7e);}};}function respondWithFilteredResult(_0x6bd35a,_0x338d2e){return function(_0x459718){if(_0x459718){var _0x216ca1=typeof _0x338d2e['offset']===_0x66cc('0x20')&&typeof _0x338d2e[_0x66cc('0x21')]===_0x66cc('0x20');var _0x2096b8=_0x459718[_0x66cc('0x22')];var _0x534dc6=_0x216ca1?0x0:_0x338d2e[_0x66cc('0x23')];var _0x2cc971=_0x216ca1?_0x459718['count']:_0x338d2e[_0x66cc('0x23')]+_0x338d2e[_0x66cc('0x21')];var _0x143a94;if(_0x2cc971>=_0x2096b8){_0x2cc971=_0x2096b8;_0x143a94=0xc8;}else{_0x143a94=0xce;}_0x6bd35a[_0x66cc('0x1e')](_0x143a94);return _0x6bd35a[_0x66cc('0x24')](_0x66cc('0x25'),_0x534dc6+'-'+_0x2cc971+'/'+_0x2096b8)[_0x66cc('0x1f')](_0x459718);}return null;};}function patchUpdates(_0x35ddf7){return function(_0x48ba36){try{jsonpatch[_0x66cc('0x26')](_0x48ba36,_0x35ddf7,!![]);}catch(_0x488bba){return BPromise[_0x66cc('0x27')](_0x488bba);}return _0x48ba36[_0x66cc('0x28')]();};}function saveUpdates(_0x5b08b9,_0xa130e){return function(_0x326647){if(_0x326647){return _0x326647[_0x66cc('0x29')](_0x5b08b9)[_0x66cc('0x2a')](function(_0x56958c){return _0x56958c;});}return null;};}function removeEntity(_0x401286,_0x423075){return function(_0x1b304b){if(_0x1b304b){return _0x1b304b['destroy']()['then'](function(){var _0x4ccd88=_0x1b304b[_0x66cc('0x2b')]({'plain':!![]});var _0x2c07a5=_0x66cc('0x2c');return db[_0x66cc('0x2d')][_0x66cc('0x2e')]({'where':{'type':_0x2c07a5,'resourceId':_0x4ccd88['id']}})['then'](function(){return _0x1b304b;});})[_0x66cc('0x2a')](function(){_0x401286['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x15e451,_0x4d8541){return function(_0x983ee2){if(!_0x983ee2){_0x15e451['sendStatus'](0x194);}return _0x983ee2;};}function handleError(_0x41615e,_0x47c6aa){_0x47c6aa=_0x47c6aa||0x1f4;return function(_0xb5e815){logger[_0x66cc('0x2f')](_0xb5e815[_0x66cc('0x30')]);if(_0xb5e815[_0x66cc('0x31')]){delete _0xb5e815['name'];}_0x41615e[_0x66cc('0x1e')](_0x47c6aa)[_0x66cc('0x32')](_0xb5e815);};}exports['index']=function(_0x16835a,_0x331127){var _0x20756e={},_0x2d7e23={},_0x5954cd={'count':0x0,'rows':[]};var _0xe91616=_['map'](db[_0x66cc('0x33')][_0x66cc('0x34')],function(_0x46a154){return{'name':_0x46a154[_0x66cc('0x35')],'type':_0x46a154[_0x66cc('0x36')][_0x66cc('0x37')]};});_0x2d7e23[_0x66cc('0x38')]=_[_0x66cc('0x39')](_0xe91616,_0x66cc('0x31'));_0x2d7e23[_0x66cc('0x3a')]=_['keys'](_0x16835a[_0x66cc('0x3a')]);_0x2d7e23[_0x66cc('0x3b')]=_[_0x66cc('0x3c')](_0x2d7e23['model'],_0x2d7e23[_0x66cc('0x3a')]);_0x20756e[_0x66cc('0x3d')]=_[_0x66cc('0x3c')](_0x2d7e23['model'],qs[_0x66cc('0x3e')](_0x16835a['query'][_0x66cc('0x3e')]));_0x20756e[_0x66cc('0x3d')]=_0x20756e['attributes'][_0x66cc('0x3f')]?_0x20756e[_0x66cc('0x3d')]:_0x2d7e23[_0x66cc('0x38')];if(!_0x16835a['query'][_0x66cc('0x40')](_0x66cc('0x41'))){_0x20756e[_0x66cc('0x21')]=qs[_0x66cc('0x21')](_0x16835a[_0x66cc('0x3a')][_0x66cc('0x21')]);_0x20756e['offset']=qs[_0x66cc('0x23')](_0x16835a[_0x66cc('0x3a')]['offset']);}_0x20756e[_0x66cc('0x42')]=qs[_0x66cc('0x43')](_0x16835a[_0x66cc('0x3a')]['sort']);_0x20756e[_0x66cc('0x44')]=qs[_0x66cc('0x3b')](_['pick'](_0x16835a['query'],_0x2d7e23['filters']),_0xe91616);if(_0x16835a[_0x66cc('0x3a')][_0x66cc('0x45')]){_0x20756e[_0x66cc('0x44')]=_[_0x66cc('0x46')](_0x20756e[_0x66cc('0x44')],{'$or':_[_0x66cc('0x39')](_0xe91616,function(_0x3739ad){if(_0x3739ad[_0x66cc('0x36')]!==_0x66cc('0x47')){var _0x15b6bc={};_0x15b6bc[_0x3739ad['name']]={'$like':'%'+_0x16835a['query']['filter']+'%'};return _0x15b6bc;}})});}_0x20756e=_[_0x66cc('0x46')]({},_0x20756e,_0x16835a[_0x66cc('0x48')]);var _0x189db5={'where':_0x20756e['where']};return db[_0x66cc('0x33')]['count'](_0x189db5)[_0x66cc('0x2a')](function(_0x3e3aae){_0x5954cd[_0x66cc('0x22')]=_0x3e3aae;if(_0x16835a[_0x66cc('0x3a')][_0x66cc('0x49')]){_0x20756e['include']=[{'all':!![]}];}return db[_0x66cc('0x33')][_0x66cc('0x4a')](_0x20756e);})[_0x66cc('0x2a')](function(_0x4f7e39){_0x5954cd[_0x66cc('0x4b')]=_0x4f7e39;return _0x5954cd;})['then'](respondWithFilteredResult(_0x331127,_0x20756e))[_0x66cc('0x4c')](handleError(_0x331127,null));};exports['show']=function(_0x38b833,_0x515a46){var _0x119fb2={'raw':!![],'where':{'id':_0x38b833[_0x66cc('0x4d')]['id']}},_0x160f92={};_0x160f92[_0x66cc('0x38')]=_[_0x66cc('0x4e')](db[_0x66cc('0x33')][_0x66cc('0x34')]);_0x160f92[_0x66cc('0x3a')]=_[_0x66cc('0x4e')](_0x38b833['query']);_0x160f92[_0x66cc('0x3b')]=_[_0x66cc('0x3c')](_0x160f92[_0x66cc('0x38')],_0x160f92[_0x66cc('0x3a')]);_0x119fb2[_0x66cc('0x3d')]=_['intersection'](_0x160f92[_0x66cc('0x38')],qs[_0x66cc('0x3e')](_0x38b833[_0x66cc('0x3a')][_0x66cc('0x3e')]));_0x119fb2[_0x66cc('0x3d')]=_0x119fb2[_0x66cc('0x3d')][_0x66cc('0x3f')]?_0x119fb2['attributes']:_0x160f92['model'];if(_0x38b833[_0x66cc('0x3a')][_0x66cc('0x49')]){_0x119fb2[_0x66cc('0x4f')]=[{'all':!![]}];}_0x119fb2=_[_0x66cc('0x46')]({},_0x119fb2,_0x38b833[_0x66cc('0x48')]);return db[_0x66cc('0x33')][_0x66cc('0x50')](_0x119fb2)[_0x66cc('0x2a')](handleEntityNotFound(_0x515a46,null))[_0x66cc('0x2a')](respondWithResult(_0x515a46,null))['catch'](handleError(_0x515a46,null));};exports[_0x66cc('0x51')]=function(_0x5e8d92,_0x5b4aa6){return db[_0x66cc('0x33')][_0x66cc('0x51')](_0x5e8d92[_0x66cc('0x52')],{})['then'](function(_0x1e3dbd){var _0x5911de=_0x5e8d92['user'][_0x66cc('0x2b')]({'plain':!![]});if(!_0x5911de)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5911de['role']===_0x66cc('0x53')){var _0x32be40=_0x1e3dbd[_0x66cc('0x2b')]({'plain':!![]});var _0x4e1fd5='Templates';return db[_0x66cc('0x54')]['find']({'where':{'name':_0x4e1fd5,'userProfileId':_0x5911de[_0x66cc('0x55')]},'raw':!![]})[_0x66cc('0x2a')](function(_0x2ce018){if(_0x2ce018&&_0x2ce018[_0x66cc('0x56')]===0x0){return db[_0x66cc('0x2d')][_0x66cc('0x51')]({'name':_0x32be40['name'],'resourceId':_0x32be40['id'],'type':_0x2ce018['name'],'sectionId':_0x2ce018['id']},{})['then'](function(){return _0x1e3dbd;});}else{return _0x1e3dbd;}})[_0x66cc('0x4c')](function(_0x28b437){logger[_0x66cc('0x2f')](_0x66cc('0x57'),_0x28b437);throw _0x28b437;});}return _0x1e3dbd;})[_0x66cc('0x2a')](respondWithResult(_0x5b4aa6,0xc9))['catch'](handleError(_0x5b4aa6,null));};exports[_0x66cc('0x29')]=function(_0x3da264,_0x21c842){if(_0x3da264[_0x66cc('0x52')]['id']){delete _0x3da264[_0x66cc('0x52')]['id'];}return db[_0x66cc('0x33')]['find']({'where':{'id':_0x3da264['params']['id']}})[_0x66cc('0x2a')](handleEntityNotFound(_0x21c842,null))[_0x66cc('0x2a')](saveUpdates(_0x3da264['body'],null))['then'](respondWithResult(_0x21c842,null))[_0x66cc('0x4c')](handleError(_0x21c842,null));};exports[_0x66cc('0x2e')]=function(_0x53a4f4,_0x1a6839){return db['Template'][_0x66cc('0x50')]({'where':{'id':_0x53a4f4[_0x66cc('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1a6839,null))[_0x66cc('0x2a')](removeEntity(_0x1a6839,null))[_0x66cc('0x4c')](handleError(_0x1a6839,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 3857882..7334f23 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 _0x2edf=['rimraf','../../config/environment','./template.attributes','exports','define','tools_templates','util','../../config/logger','api','request-promise','path'];(function(_0x39ddbb,_0x349add){var _0x4c8595=function(_0xf30d74){while(--_0xf30d74){_0x39ddbb['push'](_0x39ddbb['shift']());}};_0x4c8595(++_0x349add);}(_0x2edf,0x1be));var _0xf2ed=function(_0x312ad6,_0x5dcca8){_0x312ad6=_0x312ad6-0x0;var _0x1069dc=_0x2edf[_0x312ad6];return _0x1069dc;};'use strict';var _=require('lodash');var util=require(_0xf2ed('0x0'));var logger=require(_0xf2ed('0x1'))(_0xf2ed('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf2ed('0x3'));var fs=require('fs');var path=require(_0xf2ed('0x4'));var rimraf=require(_0xf2ed('0x5'));var config=require(_0xf2ed('0x6'));var attributes=require(_0xf2ed('0x7'));module[_0xf2ed('0x8')]=function(_0x3c9a69,_0x89dea4){return _0x3c9a69[_0xf2ed('0x9')]('Template',attributes,{'tableName':_0xf2ed('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3977=['moment','bluebird','path','rimraf','exports','define','Template','tools_templates','util','../../config/logger'];(function(_0x3f2fea,_0x3c4ea8){var _0x69a4d5=function(_0x223109){while(--_0x223109){_0x3f2fea['push'](_0x3f2fea['shift']());}};_0x69a4d5(++_0x3c4ea8);}(_0x3977,0x15c));var _0x7397=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3977[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x7397('0x0'));var logger=require(_0x7397('0x1'))('api');var moment=require(_0x7397('0x2'));var BPromise=require(_0x7397('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7397('0x4'));var rimraf=require(_0x7397('0x5'));var config=require('../../config/environment');var attributes=require('./template.attributes');module[_0x7397('0x6')]=function(_0xbbcc1b,_0x42f1b7){return _0xbbcc1b[_0x7397('0x7')](_0x7397('0x8'),attributes,{'tableName':_0x7397('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index c2deed5..394f745 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 _0x915f=['code','message','GetTemplate','options','raw','attributes','limit','map','model','include','debug','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','Template,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x133c58,_0x5d85f2){var _0x5937d5=function(_0x5d27fc){while(--_0x5d27fc){_0x133c58['push'](_0x133c58['shift']());}};_0x5937d5(++_0x5d85f2);}(_0x915f,0xf4));var _0xf915=function(_0x5a66b5,_0x330dba){_0x5a66b5=_0x5a66b5-0x0;var _0x2be394=_0x915f[_0x5a66b5];return _0x2be394;};'use strict';var _=require(_0xf915('0x0'));var util=require(_0xf915('0x1'));var moment=require(_0xf915('0x2'));var BPromise=require(_0xf915('0x3'));var rs=require(_0xf915('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf915('0x5'))['db'];var utils=require(_0xf915('0x6'));var logger=require(_0xf915('0x7'))('rpc');var config=require(_0xf915('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf915('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ab392,_0x241a7f,_0x4ce9b9){return new BPromise(function(_0x308b97,_0x3bc596){return client[_0xf915('0xa')](_0x2ab392,_0x4ce9b9)[_0xf915('0xb')](function(_0x50a4bd){logger[_0xf915('0xc')](_0xf915('0xd'),_0x241a7f,_0xf915('0xe'));logger['debug']('Template,\x20%s,\x20%s,\x20%s',_0x241a7f,_0xf915('0xe'),JSON[_0xf915('0xf')](_0x50a4bd));if(_0x50a4bd['error']){if(_0x50a4bd[_0xf915('0x10')][_0xf915('0x11')]===0x1f4){logger[_0xf915('0x10')](_0xf915('0xd'),_0x241a7f,_0x50a4bd[_0xf915('0x10')][_0xf915('0x12')]);return _0x3bc596(_0x50a4bd[_0xf915('0x10')]['message']);}logger[_0xf915('0x10')](_0xf915('0xd'),_0x241a7f,_0x50a4bd['error'][_0xf915('0x12')]);return _0x308b97(_0x50a4bd[_0xf915('0x10')]['message']);}else{logger[_0xf915('0xc')](_0xf915('0xd'),_0x241a7f,_0xf915('0xe'));_0x308b97(_0x50a4bd['result'][_0xf915('0x12')]);}})['catch'](function(_0x588dcd){logger['error'](_0xf915('0xd'),_0x241a7f,_0x588dcd);_0x3bc596(_0x588dcd);});});}exports[_0xf915('0x13')]=function(_0x5d4584){var _0x45882e=this;return new Promise(function(_0x287a91,_0x40c2cf){return db['Template']['findAll']({'raw':_0x5d4584[_0xf915('0x14')]?_0x5d4584[_0xf915('0x14')][_0xf915('0x15')]===undefined?!![]:![]:!![],'where':_0x5d4584['options']?_0x5d4584[_0xf915('0x14')]['where']||null:null,'attributes':_0x5d4584[_0xf915('0x14')]?_0x5d4584['options'][_0xf915('0x16')]||null:null,'limit':_0x5d4584[_0xf915('0x14')]?_0x5d4584[_0xf915('0x14')][_0xf915('0x17')]||null:null,'include':_0x5d4584['options']?_0x5d4584[_0xf915('0x14')]['include']?_[_0xf915('0x18')](_0x5d4584[_0xf915('0x14')]['include'],function(_0x24c1b1){return{'model':db[_0x24c1b1[_0xf915('0x19')]],'as':_0x24c1b1['as'],'attributes':_0x24c1b1[_0xf915('0x16')],'include':_0x24c1b1['include']?_[_0xf915('0x18')](_0x24c1b1['include'],function(_0xff6b57){return{'model':db[_0xff6b57[_0xf915('0x19')]],'as':_0xff6b57['as'],'attributes':_0xff6b57[_0xf915('0x16')],'include':_0xff6b57[_0xf915('0x1a')]?_[_0xf915('0x18')](_0xff6b57['include'],function(_0x14ac59){return{'model':db[_0x14ac59[_0xf915('0x19')]],'as':_0x14ac59['as'],'attributes':_0x14ac59[_0xf915('0x16')]};}):[]};}):[]};}):[]:[]})[_0xf915('0xb')](function(_0x43ceca){logger[_0xf915('0xc')](_0xf915('0x13'),_0x5d4584);logger[_0xf915('0x1b')](_0xf915('0x13'),_0x5d4584,JSON[_0xf915('0xf')](_0x43ceca));_0x287a91(_0x43ceca);})[_0xf915('0x1c')](function(_0xd55b9b){logger[_0xf915('0x10')](_0xf915('0x13'),_0xd55b9b['message'],_0x5d4584);_0x40c2cf(_0x45882e[_0xf915('0x10')](0x1f4,_0xd55b9b['message']));});});}; \ No newline at end of file +var _0x2054=['map','include','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTemplate','Template','findAll','options','raw','where','attributes','limit'];(function(_0x5f2088,_0x46bfe4){var _0xfe7e35=function(_0x43e834){while(--_0x43e834){_0x5f2088['push'](_0x5f2088['shift']());}};_0xfe7e35(++_0x46bfe4);}(_0x2054,0x1b3));var _0x4205=function(_0x5f046c,_0x53eb88){_0x5f046c=_0x5f046c-0x0;var _0x568032=_0x2054[_0x5f046c];return _0x568032;};'use strict';var _=require(_0x4205('0x0'));var util=require(_0x4205('0x1'));var moment=require(_0x4205('0x2'));var BPromise=require(_0x4205('0x3'));var rs=require(_0x4205('0x4'));var fs=require('fs');var Redis=require(_0x4205('0x5'));var db=require(_0x4205('0x6'))['db'];var utils=require(_0x4205('0x7'));var logger=require(_0x4205('0x8'))(_0x4205('0x9'));var config=require(_0x4205('0xa'));var jayson=require(_0x4205('0xb'));var client=jayson[_0x4205('0xc')][_0x4205('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x279a19,_0x2a1459,_0x1cb718){return new BPromise(function(_0x47f17f,_0x249d0e){return client['request'](_0x279a19,_0x1cb718)[_0x4205('0xe')](function(_0xd5663f){logger[_0x4205('0xf')](_0x4205('0x10'),_0x2a1459,_0x4205('0x11'));logger['debug'](_0x4205('0x12'),_0x2a1459,_0x4205('0x11'),JSON[_0x4205('0x13')](_0xd5663f));if(_0xd5663f[_0x4205('0x14')]){if(_0xd5663f[_0x4205('0x14')][_0x4205('0x15')]===0x1f4){logger[_0x4205('0x14')](_0x4205('0x10'),_0x2a1459,_0xd5663f[_0x4205('0x14')][_0x4205('0x16')]);return _0x249d0e(_0xd5663f[_0x4205('0x14')][_0x4205('0x16')]);}logger[_0x4205('0x14')](_0x4205('0x10'),_0x2a1459,_0xd5663f[_0x4205('0x14')][_0x4205('0x16')]);return _0x47f17f(_0xd5663f[_0x4205('0x14')]['message']);}else{logger['info'](_0x4205('0x10'),_0x2a1459,'request\x20sent');_0x47f17f(_0xd5663f[_0x4205('0x17')]['message']);}})[_0x4205('0x18')](function(_0xf779a){logger[_0x4205('0x14')](_0x4205('0x10'),_0x2a1459,_0xf779a);_0x249d0e(_0xf779a);});});}exports[_0x4205('0x19')]=function(_0x124a52){var _0x4d0dd2=this;return new Promise(function(_0x48d9d9,_0x2f194d){return db[_0x4205('0x1a')][_0x4205('0x1b')]({'raw':_0x124a52[_0x4205('0x1c')]?_0x124a52[_0x4205('0x1c')][_0x4205('0x1d')]===undefined?!![]:![]:!![],'where':_0x124a52[_0x4205('0x1c')]?_0x124a52['options'][_0x4205('0x1e')]||null:null,'attributes':_0x124a52[_0x4205('0x1c')]?_0x124a52[_0x4205('0x1c')][_0x4205('0x1f')]||null:null,'limit':_0x124a52[_0x4205('0x1c')]?_0x124a52[_0x4205('0x1c')][_0x4205('0x20')]||null:null,'include':_0x124a52['options']?_0x124a52[_0x4205('0x1c')]['include']?_[_0x4205('0x21')](_0x124a52[_0x4205('0x1c')][_0x4205('0x22')],function(_0x323c5b){return{'model':db[_0x323c5b['model']],'as':_0x323c5b['as'],'attributes':_0x323c5b[_0x4205('0x1f')],'include':_0x323c5b['include']?_[_0x4205('0x21')](_0x323c5b[_0x4205('0x22')],function(_0x3f58ce){return{'model':db[_0x3f58ce[_0x4205('0x23')]],'as':_0x3f58ce['as'],'attributes':_0x3f58ce[_0x4205('0x1f')],'include':_0x3f58ce[_0x4205('0x22')]?_[_0x4205('0x21')](_0x3f58ce[_0x4205('0x22')],function(_0x9d0ed2){return{'model':db[_0x9d0ed2[_0x4205('0x23')]],'as':_0x9d0ed2['as'],'attributes':_0x9d0ed2[_0x4205('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4205('0xe')](function(_0x472b38){logger['info'](_0x4205('0x19'),_0x124a52);logger['debug']('GetTemplate',_0x124a52,JSON[_0x4205('0x13')](_0x472b38));_0x48d9d9(_0x472b38);})[_0x4205('0x18')](function(_0x104ded){logger[_0x4205('0x14')](_0x4205('0x19'),_0x104ded[_0x4205('0x16')],_0x124a52);_0x2f194d(_0x4d0dd2[_0x4205('0x14')](0x1f4,_0x104ded[_0x4205('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index a066ad8..3d09454 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 _0x9431=['addAllCondition','addAnyCondition','addAction','/:id','update','destroy','exports','multer','util','path','Router','fs-extra','../../config/environment','./trigger.controller','get','index','isAuthenticated','/:id/all_conditions','/:id/any_conditions','/:id/actions','getActions','create','post'];(function(_0x3e8128,_0x3fc84){var _0x50552c=function(_0x236f4){while(--_0x236f4){_0x3e8128['push'](_0x3e8128['shift']());}};_0x50552c(++_0x3fc84);}(_0x9431,0xa8));var _0x1943=function(_0x4bf658,_0x4f9c09){_0x4bf658=_0x4bf658-0x0;var _0x3852ab=_0x9431[_0x4bf658];return _0x3852ab;};'use strict';var multer=require(_0x1943('0x0'));var util=require(_0x1943('0x1'));var path=require(_0x1943('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1943('0x3')]();var fs_extra=require(_0x1943('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1943('0x5'));var controller=require(_0x1943('0x6'));router[_0x1943('0x7')]('/',auth['isAuthenticated'](),controller[_0x1943('0x8')]);router['get']('/:id',auth[_0x1943('0x9')](),controller['show']);router[_0x1943('0x7')](_0x1943('0xa'),auth['isAuthenticated'](),controller['getAllConditions']);router[_0x1943('0x7')](_0x1943('0xb'),auth['isAuthenticated'](),controller['getAnyConditions']);router['get'](_0x1943('0xc'),auth['isAuthenticated'](),controller[_0x1943('0xd')]);router['post']('/',auth[_0x1943('0x9')](),controller[_0x1943('0xe')]);router[_0x1943('0xf')](_0x1943('0xa'),auth[_0x1943('0x9')](),controller[_0x1943('0x10')]);router[_0x1943('0xf')](_0x1943('0xb'),auth['isAuthenticated'](),controller[_0x1943('0x11')]);router['post'](_0x1943('0xc'),auth[_0x1943('0x9')](),controller[_0x1943('0x12')]);router['put'](_0x1943('0x13'),auth[_0x1943('0x9')](),controller[_0x1943('0x14')]);router['delete'](_0x1943('0x13'),auth[_0x1943('0x9')](),controller[_0x1943('0x15')]);module[_0x1943('0x16')]=router; \ No newline at end of file +var _0xdadd=['isAuthenticated','show','getAllConditions','/:id/any_conditions','getAnyConditions','getActions','post','create','/:id/all_conditions','addAllCondition','addAnyCondition','/:id/actions','addAction','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./trigger.controller','get','index','/:id'];(function(_0x5e1d5d,_0x4c8b0f){var _0x5df5c2=function(_0x53f460){while(--_0x53f460){_0x5e1d5d['push'](_0x5e1d5d['shift']());}};_0x5df5c2(++_0x4c8b0f);}(_0xdadd,0x18b));var _0xddad=function(_0x13cab0,_0x14d825){_0x13cab0=_0x13cab0-0x0;var _0x38804f=_0xdadd[_0x13cab0];return _0x38804f;};'use strict';var multer=require(_0xddad('0x0'));var util=require(_0xddad('0x1'));var path=require('path');var timeout=require(_0xddad('0x2'));var express=require(_0xddad('0x3'));var router=express[_0xddad('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xddad('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xddad('0x6'));var controller=require(_0xddad('0x7'));router[_0xddad('0x8')]('/',auth['isAuthenticated'](),controller[_0xddad('0x9')]);router['get'](_0xddad('0xa'),auth[_0xddad('0xb')](),controller[_0xddad('0xc')]);router['get']('/:id/all_conditions',auth[_0xddad('0xb')](),controller[_0xddad('0xd')]);router[_0xddad('0x8')](_0xddad('0xe'),auth[_0xddad('0xb')](),controller[_0xddad('0xf')]);router[_0xddad('0x8')]('/:id/actions',auth[_0xddad('0xb')](),controller[_0xddad('0x10')]);router[_0xddad('0x11')]('/',auth['isAuthenticated'](),controller[_0xddad('0x12')]);router[_0xddad('0x11')](_0xddad('0x13'),auth[_0xddad('0xb')](),controller[_0xddad('0x14')]);router[_0xddad('0x11')](_0xddad('0xe'),auth[_0xddad('0xb')](),controller[_0xddad('0x15')]);router['post'](_0xddad('0x16'),auth['isAuthenticated'](),controller[_0xddad('0x17')]);router[_0xddad('0x18')]('/:id',auth[_0xddad('0xb')](),controller[_0xddad('0x19')]);router[_0xddad('0x1a')]('/:id',auth[_0xddad('0xb')](),controller[_0xddad('0x1b')]);module[_0xddad('0x1c')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index e948cb1..d0b97cf 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 _0x5ccc=['BOOLEAN','sequelize','STRING'];(function(_0x4dab14,_0x164ea0){var _0xf41aa=function(_0x305d50){while(--_0x305d50){_0x4dab14['push'](_0x4dab14['shift']());}};_0xf41aa(++_0x164ea0);}(_0x5ccc,0x190));var _0xc5cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5ccc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc5cc('0x0'));module['exports']={'name':{'type':Sequelize[_0xc5cc('0x1')]},'channel':{'type':Sequelize[_0xc5cc('0x1')]},'description':{'type':Sequelize[_0xc5cc('0x1')]},'status':{'type':Sequelize[_0xc5cc('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xc84e=['sequelize','exports','STRING','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc84e,0x108));var _0xec84=function(_0x64c605,_0x18c764){_0x64c605=_0x64c605-0x0;var _0x36fff0=_0xc84e[_0x64c605];return _0x36fff0;};'use strict';var Sequelize=require(_0xec84('0x0'));module[_0xec84('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xec84('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xec84('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index ad5a52e..9311333 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 _0x54c5=['zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','offset','limit','apply','reject','save','then','destroy','get','Triggers','UserProfileResource','status','sendStatus','error','name','send','index','map','Trigger','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','count','include','rows','show','params','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','findOne','pick','getAllConditions','getAnyConditions','addAction','TriggerId','getActions','eml-format'];(function(_0x5d58a8,_0x1c4c28){var _0x59278b=function(_0x5bc3a6){while(--_0x5bc3a6){_0x5d58a8['push'](_0x5d58a8['shift']());}};_0x59278b(++_0x1c4c28);}(_0x54c5,0x10a));var _0x554c=function(_0x176947,_0x591cb4){_0x176947=_0x176947-0x0;var _0x5360a4=_0x54c5[_0x176947];return _0x5360a4;};'use strict';var emlformat=require(_0x554c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x554c('0x1'));var jsonpatch=require(_0x554c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x554c('0x3'));var util=require(_0x554c('0x4'));var path=require('path');var sox=require(_0x554c('0x5'));var csv=require(_0x554c('0x6'));var ejs=require(_0x554c('0x7'));var fs=require('fs');var fs_extra=require(_0x554c('0x8'));var _=require('lodash');var squel=require(_0x554c('0x9'));var crypto=require(_0x554c('0xa'));var jsforce=require(_0x554c('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x554c('0xc'));var Papa=require(_0x554c('0xd'));var Redis=require(_0x554c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x554c('0xf'));var as=require(_0x554c('0x10'));var hardwareService=require(_0x554c('0x11'));var logger=require('../../config/logger')(_0x554c('0x12'));var utils=require(_0x554c('0x13'));var config=require(_0x554c('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x554c('0x15'))['db'];function respondWithStatusCode(_0xb3dbb,_0x1ea23e){_0x1ea23e=_0x1ea23e||0xcc;return function(_0x196697){if(_0x196697){return _0xb3dbb['sendStatus'](_0x1ea23e);}return _0xb3dbb['status'](_0x1ea23e)[_0x554c('0x16')]();};}function respondWithResult(_0x4b8a42,_0x5c7862){_0x5c7862=_0x5c7862||0xc8;return function(_0x48c4df){if(_0x48c4df){return _0x4b8a42['status'](_0x5c7862)[_0x554c('0x17')](_0x48c4df);}};}function respondWithFilteredResult(_0x23a345,_0x2cc798){return function(_0x19c05e){if(_0x19c05e){var _0x4789f2=typeof _0x2cc798['offset']===_0x554c('0x18')&&typeof _0x2cc798['limit']===_0x554c('0x18');var _0x260834=_0x19c05e['count'];var _0x2955e2=_0x4789f2?0x0:_0x2cc798[_0x554c('0x19')];var _0x4f6781=_0x4789f2?_0x19c05e['count']:_0x2cc798[_0x554c('0x19')]+_0x2cc798[_0x554c('0x1a')];var _0x38962a;if(_0x4f6781>=_0x260834){_0x4f6781=_0x260834;_0x38962a=0xc8;}else{_0x38962a=0xce;}_0x23a345['status'](_0x38962a);return _0x23a345['set']('Content-Range',_0x2955e2+'-'+_0x4f6781+'/'+_0x260834)[_0x554c('0x17')](_0x19c05e);}return null;};}function patchUpdates(_0x9c8589){return function(_0x3a9ecf){try{jsonpatch[_0x554c('0x1b')](_0x3a9ecf,_0x9c8589,!![]);}catch(_0x1a8975){return BPromise[_0x554c('0x1c')](_0x1a8975);}return _0x3a9ecf[_0x554c('0x1d')]();};}function saveUpdates(_0x448b34,_0x4cec2b){return function(_0x375844){if(_0x375844){return _0x375844['update'](_0x448b34)[_0x554c('0x1e')](function(_0x2d122b){return _0x2d122b;});}return null;};}function removeEntity(_0xbd8ddf,_0x1b7763){return function(_0x4c81fc){if(_0x4c81fc){return _0x4c81fc[_0x554c('0x1f')]()[_0x554c('0x1e')](function(){var _0x50a5d9=_0x4c81fc[_0x554c('0x20')]({'plain':!![]});var _0x574032=_0x554c('0x21');return db[_0x554c('0x22')]['destroy']({'where':{'type':_0x574032,'resourceId':_0x50a5d9['id']}})[_0x554c('0x1e')](function(){return _0x4c81fc;});})[_0x554c('0x1e')](function(){_0xbd8ddf[_0x554c('0x23')](0xcc)[_0x554c('0x16')]();});}};}function handleEntityNotFound(_0x38bb5d,_0x55d95b){return function(_0x574943){if(!_0x574943){_0x38bb5d[_0x554c('0x24')](0x194);}return _0x574943;};}function handleError(_0x4cb354,_0x2377d0){_0x2377d0=_0x2377d0||0x1f4;return function(_0x9cc65d){logger[_0x554c('0x25')](_0x9cc65d['stack']);if(_0x9cc65d[_0x554c('0x26')]){delete _0x9cc65d[_0x554c('0x26')];}_0x4cb354[_0x554c('0x23')](_0x2377d0)[_0x554c('0x27')](_0x9cc65d);};}exports[_0x554c('0x28')]=function(_0x26e075,_0x591a7b){var _0x2d9500={},_0x1d99a2={},_0x2e096d={'count':0x0,'rows':[]};var _0x2da671=_[_0x554c('0x29')](db[_0x554c('0x2a')][_0x554c('0x2b')],function(_0x267ed4){return{'name':_0x267ed4['fieldName'],'type':_0x267ed4['type']['key']};});_0x1d99a2[_0x554c('0x2c')]=_['map'](_0x2da671,_0x554c('0x26'));_0x1d99a2[_0x554c('0x2d')]=_[_0x554c('0x2e')](_0x26e075['query']);_0x1d99a2[_0x554c('0x2f')]=_[_0x554c('0x30')](_0x1d99a2[_0x554c('0x2c')],_0x1d99a2[_0x554c('0x2d')]);_0x2d9500[_0x554c('0x31')]=_['intersection'](_0x1d99a2['model'],qs[_0x554c('0x32')](_0x26e075[_0x554c('0x2d')][_0x554c('0x32')]));_0x2d9500[_0x554c('0x31')]=_0x2d9500['attributes'][_0x554c('0x33')]?_0x2d9500[_0x554c('0x31')]:_0x1d99a2['model'];if(!_0x26e075[_0x554c('0x2d')][_0x554c('0x34')](_0x554c('0x35'))){_0x2d9500[_0x554c('0x1a')]=qs[_0x554c('0x1a')](_0x26e075['query'][_0x554c('0x1a')]);_0x2d9500[_0x554c('0x19')]=qs[_0x554c('0x19')](_0x26e075[_0x554c('0x2d')][_0x554c('0x19')]);}_0x2d9500[_0x554c('0x36')]=qs[_0x554c('0x37')](_0x26e075['query'][_0x554c('0x37')]);_0x2d9500[_0x554c('0x38')]=qs[_0x554c('0x2f')](_['pick'](_0x26e075[_0x554c('0x2d')],_0x1d99a2['filters']),_0x2da671);if(_0x26e075[_0x554c('0x2d')][_0x554c('0x39')]){_0x2d9500[_0x554c('0x38')]=_[_0x554c('0x3a')](_0x2d9500[_0x554c('0x38')],{'$or':_[_0x554c('0x29')](_0x2da671,function(_0x221a3c){if(_0x221a3c['type']!=='VIRTUAL'){var _0x6c1abe={};_0x6c1abe[_0x221a3c[_0x554c('0x26')]]={'$like':'%'+_0x26e075[_0x554c('0x2d')][_0x554c('0x39')]+'%'};return _0x6c1abe;}})});}_0x2d9500=_[_0x554c('0x3a')]({},_0x2d9500,_0x26e075['options']);var _0x5a33a0={'where':_0x2d9500[_0x554c('0x38')]};return db[_0x554c('0x2a')][_0x554c('0x3b')](_0x5a33a0)[_0x554c('0x1e')](function(_0xc9902c){_0x2e096d[_0x554c('0x3b')]=_0xc9902c;if(_0x26e075[_0x554c('0x2d')]['includeAll']){_0x2d9500[_0x554c('0x3c')]=[{'all':!![]}];}return db[_0x554c('0x2a')]['findAll'](_0x2d9500);})['then'](function(_0x470950){_0x2e096d[_0x554c('0x3d')]=_0x470950;return _0x2e096d;})[_0x554c('0x1e')](respondWithFilteredResult(_0x591a7b,_0x2d9500))['catch'](handleError(_0x591a7b,null));};exports[_0x554c('0x3e')]=function(_0x31a697,_0x2389e7){var _0x29d646={'raw':![],'where':{'id':_0x31a697[_0x554c('0x3f')]['id']}},_0x42d882={};_0x42d882['model']=_['keys'](db[_0x554c('0x2a')][_0x554c('0x2b')]);_0x42d882[_0x554c('0x2d')]=_[_0x554c('0x2e')](_0x31a697['query']);_0x42d882[_0x554c('0x2f')]=_[_0x554c('0x30')](_0x42d882[_0x554c('0x2c')],_0x42d882['query']);_0x29d646[_0x554c('0x31')]=_['intersection'](_0x42d882[_0x554c('0x2c')],qs[_0x554c('0x32')](_0x31a697[_0x554c('0x2d')][_0x554c('0x32')]));_0x29d646['attributes']=_0x29d646[_0x554c('0x31')][_0x554c('0x33')]?_0x29d646[_0x554c('0x31')]:_0x42d882[_0x554c('0x2c')];if(_0x31a697[_0x554c('0x2d')]['includeAll']){_0x29d646[_0x554c('0x3c')]=[{'all':!![]}];}_0x29d646=_['merge']({},_0x29d646,_0x31a697[_0x554c('0x40')]);return db[_0x554c('0x2a')][_0x554c('0x41')](_0x29d646)['then'](handleEntityNotFound(_0x2389e7,null))['then'](respondWithResult(_0x2389e7,null))[_0x554c('0x42')](handleError(_0x2389e7,null));};exports['create']=function(_0x591597,_0x1b93d2){return db[_0x554c('0x2a')][_0x554c('0x43')](_0x591597[_0x554c('0x44')],{})[_0x554c('0x1e')](function(_0xf4eb77){var _0x287efe=_0x591597[_0x554c('0x45')][_0x554c('0x20')]({'plain':!![]});if(!_0x287efe)throw new Error(_0x554c('0x46'));if(_0x287efe[_0x554c('0x47')]===_0x554c('0x45')){var _0x4ce001=_0xf4eb77['get']({'plain':!![]});var _0x2ee88d='Triggers';return db[_0x554c('0x48')]['find']({'where':{'name':_0x2ee88d,'userProfileId':_0x287efe[_0x554c('0x49')]},'raw':!![]})['then'](function(_0x1f6018){if(_0x1f6018&&_0x1f6018[_0x554c('0x4a')]===0x0){return db['UserProfileResource'][_0x554c('0x43')]({'name':_0x4ce001[_0x554c('0x26')],'resourceId':_0x4ce001['id'],'type':_0x1f6018[_0x554c('0x26')],'sectionId':_0x1f6018['id']},{})[_0x554c('0x1e')](function(){return _0xf4eb77;});}else{return _0xf4eb77;}})[_0x554c('0x42')](function(_0x4b139d){logger[_0x554c('0x25')](_0x554c('0x4b'),_0x4b139d);throw _0x4b139d;});}return _0xf4eb77;})[_0x554c('0x1e')](respondWithResult(_0x1b93d2,0xc9))[_0x554c('0x42')](handleError(_0x1b93d2,null));};exports[_0x554c('0x4c')]=function(_0x1b0a6c,_0x579c1a){if(_0x1b0a6c[_0x554c('0x44')]['id']){delete _0x1b0a6c['body']['id'];}return db[_0x554c('0x2a')][_0x554c('0x41')]({'where':{'id':_0x1b0a6c[_0x554c('0x3f')]['id']}})[_0x554c('0x1e')](handleEntityNotFound(_0x579c1a,null))[_0x554c('0x1e')](saveUpdates(_0x1b0a6c[_0x554c('0x44')],null))[_0x554c('0x1e')](respondWithResult(_0x579c1a,null))['catch'](handleError(_0x579c1a,null));};exports[_0x554c('0x1f')]=function(_0x37fb4d,_0x360f85){return db['Trigger'][_0x554c('0x41')]({'where':{'id':_0x37fb4d[_0x554c('0x3f')]['id']}})[_0x554c('0x1e')](handleEntityNotFound(_0x360f85,null))[_0x554c('0x1e')](removeEntity(_0x360f85,null))[_0x554c('0x42')](handleError(_0x360f85,null));};exports[_0x554c('0x4d')]=function(_0x48e71b,_0x15354d,_0x452724){if(_0x48e71b[_0x554c('0x44')]['id']){delete _0x48e71b[_0x554c('0x44')]['id'];}return db[_0x554c('0x2a')][_0x554c('0x41')]({'where':{'id':_0x48e71b['params']['id']}})[_0x554c('0x1e')](handleEntityNotFound(_0x15354d,null))[_0x554c('0x1e')](function(_0x38ccc8){if(_0x38ccc8){_0x48e71b[_0x554c('0x44')][_0x554c('0x4e')]=_0x38ccc8['id'];return db['Condition'][_0x554c('0x43')](_0x48e71b[_0x554c('0x44')]);}})[_0x554c('0x1e')](respondWithResult(_0x15354d,null))['catch'](handleError(_0x15354d,null));};exports[_0x554c('0x4f')]=function(_0x115f54,_0x136580,_0x12c000){if(_0x115f54[_0x554c('0x44')]['id']){delete _0x115f54[_0x554c('0x44')]['id'];}return db[_0x554c('0x2a')][_0x554c('0x41')]({'where':{'id':_0x115f54[_0x554c('0x3f')]['id']}})[_0x554c('0x1e')](handleEntityNotFound(_0x136580,null))['then'](function(_0x4d3b13){if(_0x4d3b13){_0x115f54[_0x554c('0x44')][_0x554c('0x50')]=_0x4d3b13['id'];return db[_0x554c('0x51')]['create'](_0x115f54['body']);}})[_0x554c('0x1e')](respondWithResult(_0x136580,null))[_0x554c('0x42')](handleError(_0x136580,null));};exports['getAllConditions']=function(_0x1cfab9,_0x3c3218,_0x59c73c){var _0x4b8de7={};var _0x5b6da8={};var _0xc37be7;var _0x5c8ee3;return db[_0x554c('0x2a')][_0x554c('0x52')]({'where':{'id':_0x1cfab9[_0x554c('0x3f')]['id']}})[_0x554c('0x1e')](handleEntityNotFound(_0x3c3218,null))[_0x554c('0x1e')](function(_0x536076){if(_0x536076){_0xc37be7=_0x536076;_0x5b6da8[_0x554c('0x2c')]=_[_0x554c('0x2e')](db['Condition'][_0x554c('0x2b')]);_0x5b6da8[_0x554c('0x2d')]=_[_0x554c('0x2e')](_0x1cfab9['query']);_0x5b6da8[_0x554c('0x2f')]=_['intersection'](_0x5b6da8[_0x554c('0x2c')],_0x5b6da8[_0x554c('0x2d')]);_0x4b8de7[_0x554c('0x31')]=_['intersection'](_0x5b6da8[_0x554c('0x2c')],qs[_0x554c('0x32')](_0x1cfab9[_0x554c('0x2d')][_0x554c('0x32')]));_0x4b8de7[_0x554c('0x31')]=_0x4b8de7['attributes'][_0x554c('0x33')]?_0x4b8de7['attributes']:_0x5b6da8[_0x554c('0x2c')];_0x4b8de7['order']=qs[_0x554c('0x37')](_0x1cfab9[_0x554c('0x2d')][_0x554c('0x37')]);_0x4b8de7['where']=qs[_0x554c('0x2f')](_[_0x554c('0x53')](_0x1cfab9[_0x554c('0x2d')],_0x5b6da8[_0x554c('0x2f')]));if(_0x1cfab9[_0x554c('0x2d')][_0x554c('0x39')]){_0x4b8de7[_0x554c('0x38')]=_['merge'](_0x4b8de7[_0x554c('0x38')],{'$or':_[_0x554c('0x29')](_0x4b8de7[_0x554c('0x31')],function(_0x2d5802){var _0x6a4c87={};_0x6a4c87[_0x2d5802]={'$like':'%'+_0x1cfab9[_0x554c('0x2d')][_0x554c('0x39')]+'%'};return _0x6a4c87;})});}_0x4b8de7=_[_0x554c('0x3a')]({},_0x4b8de7,_0x1cfab9[_0x554c('0x40')]);return _0xc37be7[_0x554c('0x54')](_0x4b8de7);}})[_0x554c('0x1e')](function(_0x3024a6){if(_0x3024a6){_0x5c8ee3=_0x3024a6[_0x554c('0x33')];if(!_0x1cfab9[_0x554c('0x2d')][_0x554c('0x34')]('nolimit')){_0x4b8de7[_0x554c('0x1a')]=qs[_0x554c('0x1a')](_0x1cfab9[_0x554c('0x2d')][_0x554c('0x1a')]);_0x4b8de7[_0x554c('0x19')]=qs[_0x554c('0x19')](_0x1cfab9[_0x554c('0x2d')][_0x554c('0x19')]);}return _0xc37be7[_0x554c('0x54')](_0x4b8de7);}})[_0x554c('0x1e')](function(_0x5b495d){if(_0x5b495d){return _0x5b495d?{'count':_0x5c8ee3,'rows':_0x5b495d}:null;}})['then'](respondWithResult(_0x3c3218,null))['catch'](handleError(_0x3c3218,null));};exports[_0x554c('0x55')]=function(_0xa85073,_0x2c2ab9,_0x302acf){var _0x1f1429={};var _0x7962f3={};var _0x420774;var _0x1bfa55;return db[_0x554c('0x2a')][_0x554c('0x52')]({'where':{'id':_0xa85073['params']['id']}})[_0x554c('0x1e')](handleEntityNotFound(_0x2c2ab9,null))[_0x554c('0x1e')](function(_0x3d2f96){if(_0x3d2f96){_0x420774=_0x3d2f96;_0x7962f3['model']=_[_0x554c('0x2e')](db[_0x554c('0x51')]['rawAttributes']);_0x7962f3[_0x554c('0x2d')]=_['keys'](_0xa85073['query']);_0x7962f3[_0x554c('0x2f')]=_[_0x554c('0x30')](_0x7962f3[_0x554c('0x2c')],_0x7962f3[_0x554c('0x2d')]);_0x1f1429[_0x554c('0x31')]=_[_0x554c('0x30')](_0x7962f3[_0x554c('0x2c')],qs[_0x554c('0x32')](_0xa85073['query']['fields']));_0x1f1429[_0x554c('0x31')]=_0x1f1429[_0x554c('0x31')][_0x554c('0x33')]?_0x1f1429[_0x554c('0x31')]:_0x7962f3[_0x554c('0x2c')];_0x1f1429[_0x554c('0x36')]=qs[_0x554c('0x37')](_0xa85073[_0x554c('0x2d')]['sort']);_0x1f1429['where']=qs['filters'](_['pick'](_0xa85073[_0x554c('0x2d')],_0x7962f3[_0x554c('0x2f')]));if(_0xa85073[_0x554c('0x2d')][_0x554c('0x39')]){_0x1f1429['where']=_[_0x554c('0x3a')](_0x1f1429[_0x554c('0x38')],{'$or':_[_0x554c('0x29')](_0x1f1429[_0x554c('0x31')],function(_0x47876c){var _0x87e793={};_0x87e793[_0x47876c]={'$like':'%'+_0xa85073['query'][_0x554c('0x39')]+'%'};return _0x87e793;})});}_0x1f1429=_[_0x554c('0x3a')]({},_0x1f1429,_0xa85073[_0x554c('0x40')]);return _0x420774[_0x554c('0x55')](_0x1f1429);}})[_0x554c('0x1e')](function(_0x35dc7f){if(_0x35dc7f){_0x1bfa55=_0x35dc7f[_0x554c('0x33')];if(!_0xa85073['query'][_0x554c('0x34')]('nolimit')){_0x1f1429['limit']=qs[_0x554c('0x1a')](_0xa85073[_0x554c('0x2d')]['limit']);_0x1f1429[_0x554c('0x19')]=qs[_0x554c('0x19')](_0xa85073[_0x554c('0x2d')][_0x554c('0x19')]);}return _0x420774['getAnyConditions'](_0x1f1429);}})['then'](function(_0x16e3fa){if(_0x16e3fa){return _0x16e3fa?{'count':_0x1bfa55,'rows':_0x16e3fa}:null;}})[_0x554c('0x1e')](respondWithResult(_0x2c2ab9,null))['catch'](handleError(_0x2c2ab9,null));};exports[_0x554c('0x56')]=function(_0x390baf,_0x44697c,_0x3a0596){if(_0x390baf[_0x554c('0x44')]['id']){delete _0x390baf[_0x554c('0x44')]['id'];}return db['Trigger']['find']({'where':{'id':_0x390baf[_0x554c('0x3f')]['id']}})[_0x554c('0x1e')](handleEntityNotFound(_0x44697c,null))['then'](function(_0x4bc11f){if(_0x4bc11f){_0x390baf[_0x554c('0x44')][_0x554c('0x57')]=_0x4bc11f['id'];return db['Action']['create'](_0x390baf[_0x554c('0x44')]);}})[_0x554c('0x1e')](respondWithResult(_0x44697c,null))['catch'](handleError(_0x44697c,null));};exports[_0x554c('0x58')]=function(_0x200404,_0x486efc,_0x187d26){var _0x1f93d3={};var _0x21e30b={};var _0x160ca7;var _0x31e98c;return db[_0x554c('0x2a')][_0x554c('0x52')]({'where':{'id':_0x200404[_0x554c('0x3f')]['id']}})[_0x554c('0x1e')](handleEntityNotFound(_0x486efc,null))[_0x554c('0x1e')](function(_0x22b806){if(_0x22b806){_0x160ca7=_0x22b806;_0x21e30b['model']=_[_0x554c('0x2e')](db['Action']['rawAttributes']);_0x21e30b[_0x554c('0x2d')]=_['keys'](_0x200404['query']);_0x21e30b[_0x554c('0x2f')]=_[_0x554c('0x30')](_0x21e30b['model'],_0x21e30b[_0x554c('0x2d')]);_0x1f93d3[_0x554c('0x31')]=_[_0x554c('0x30')](_0x21e30b[_0x554c('0x2c')],qs[_0x554c('0x32')](_0x200404[_0x554c('0x2d')]['fields']));_0x1f93d3[_0x554c('0x31')]=_0x1f93d3['attributes']['length']?_0x1f93d3[_0x554c('0x31')]:_0x21e30b[_0x554c('0x2c')];_0x1f93d3[_0x554c('0x36')]=qs[_0x554c('0x37')](_0x200404[_0x554c('0x2d')][_0x554c('0x37')]);_0x1f93d3['where']=qs[_0x554c('0x2f')](_[_0x554c('0x53')](_0x200404[_0x554c('0x2d')],_0x21e30b['filters']));if(_0x200404[_0x554c('0x2d')]['filter']){_0x1f93d3[_0x554c('0x38')]=_[_0x554c('0x3a')](_0x1f93d3[_0x554c('0x38')],{'$or':_['map'](_0x1f93d3[_0x554c('0x31')],function(_0x4ce14a){var _0x5a52be={};_0x5a52be[_0x4ce14a]={'$like':'%'+_0x200404[_0x554c('0x2d')][_0x554c('0x39')]+'%'};return _0x5a52be;})});}_0x1f93d3=_[_0x554c('0x3a')]({},_0x1f93d3,_0x200404['options']);return _0x160ca7['getActions'](_0x1f93d3);}})[_0x554c('0x1e')](function(_0x1041da){if(_0x1041da){_0x31e98c=_0x1041da[_0x554c('0x33')];if(!_0x200404[_0x554c('0x2d')]['hasOwnProperty'](_0x554c('0x35'))){_0x1f93d3[_0x554c('0x1a')]=qs[_0x554c('0x1a')](_0x200404['query'][_0x554c('0x1a')]);_0x1f93d3[_0x554c('0x19')]=qs[_0x554c('0x19')](_0x200404[_0x554c('0x2d')][_0x554c('0x19')]);}return _0x160ca7['getActions'](_0x1f93d3);}})['then'](function(_0x4ebf68){if(_0x4ebf68){return _0x4ebf68?{'count':_0x31e98c,'rows':_0x4ebf68}:null;}})[_0x554c('0x1e')](respondWithResult(_0x486efc,null))[_0x554c('0x42')](handleError(_0x486efc,null));}; \ No newline at end of file +var _0xd766=['addAnyCondition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','getActions','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','save','get','Triggers','destroy','then','end','error','stack','name','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Trigger','include','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addAllCondition','TriggerAllId','Condition'];(function(_0x5b5118,_0x40e485){var _0x3a5e11=function(_0x155e8b){while(--_0x155e8b){_0x5b5118['push'](_0x5b5118['shift']());}};_0x3a5e11(++_0x40e485);}(_0xd766,0x1e4));var _0x6d76=function(_0x42184d,_0x264f92){_0x42184d=_0x42184d-0x0;var _0x144722=_0xd766[_0x42184d];return _0x144722;};'use strict';var emlformat=require(_0x6d76('0x0'));var rimraf=require(_0x6d76('0x1'));var zipdir=require(_0x6d76('0x2'));var jsonpatch=require(_0x6d76('0x3'));var rp=require(_0x6d76('0x4'));var moment=require(_0x6d76('0x5'));var BPromise=require(_0x6d76('0x6'));var Mustache=require(_0x6d76('0x7'));var util=require('util');var path=require(_0x6d76('0x8'));var sox=require(_0x6d76('0x9'));var csv=require(_0x6d76('0xa'));var ejs=require(_0x6d76('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6d76('0xc'));var squel=require(_0x6d76('0xd'));var crypto=require(_0x6d76('0xe'));var jsforce=require(_0x6d76('0xf'));var deskjs=require(_0x6d76('0x10'));var toCsv=require(_0x6d76('0xa'));var querystring=require(_0x6d76('0x11'));var Papa=require('papaparse');var Redis=require(_0x6d76('0x12'));var authService=require(_0x6d76('0x13'));var qs=require(_0x6d76('0x14'));var as=require(_0x6d76('0x15'));var hardwareService=require(_0x6d76('0x16'));var logger=require(_0x6d76('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x6d76('0x18'));var licenseUtil=require(_0x6d76('0x19'));var db=require(_0x6d76('0x1a'))['db'];function respondWithStatusCode(_0x1ed9f1,_0x21940d){_0x21940d=_0x21940d||0xcc;return function(_0x5cc905){if(_0x5cc905){return _0x1ed9f1[_0x6d76('0x1b')](_0x21940d);}return _0x1ed9f1[_0x6d76('0x1c')](_0x21940d)['end']();};}function respondWithResult(_0x49e967,_0x198893){_0x198893=_0x198893||0xc8;return function(_0x2c45fb){if(_0x2c45fb){return _0x49e967[_0x6d76('0x1c')](_0x198893)[_0x6d76('0x1d')](_0x2c45fb);}};}function respondWithFilteredResult(_0x1ed18d,_0x563f89){return function(_0x2b7a19){if(_0x2b7a19){var _0x358488=typeof _0x563f89[_0x6d76('0x1e')]===_0x6d76('0x1f')&&typeof _0x563f89[_0x6d76('0x20')]===_0x6d76('0x1f');var _0x446748=_0x2b7a19[_0x6d76('0x21')];var _0x4c8a62=_0x358488?0x0:_0x563f89['offset'];var _0x4a6e45=_0x358488?_0x2b7a19[_0x6d76('0x21')]:_0x563f89[_0x6d76('0x1e')]+_0x563f89['limit'];var _0x271b65;if(_0x4a6e45>=_0x446748){_0x4a6e45=_0x446748;_0x271b65=0xc8;}else{_0x271b65=0xce;}_0x1ed18d[_0x6d76('0x1c')](_0x271b65);return _0x1ed18d[_0x6d76('0x22')]('Content-Range',_0x4c8a62+'-'+_0x4a6e45+'/'+_0x446748)[_0x6d76('0x1d')](_0x2b7a19);}return null;};}function patchUpdates(_0x2bac1a){return function(_0x51d0b2){try{jsonpatch['apply'](_0x51d0b2,_0x2bac1a,!![]);}catch(_0x3484c1){return BPromise['reject'](_0x3484c1);}return _0x51d0b2[_0x6d76('0x23')]();};}function saveUpdates(_0x419388,_0x50640f){return function(_0x3349cb){if(_0x3349cb){return _0x3349cb['update'](_0x419388)['then'](function(_0x5009b7){return _0x5009b7;});}return null;};}function removeEntity(_0x49d0ac,_0x1bf596){return function(_0x8d3d00){if(_0x8d3d00){return _0x8d3d00['destroy']()['then'](function(){var _0x286da3=_0x8d3d00[_0x6d76('0x24')]({'plain':!![]});var _0x5717c1=_0x6d76('0x25');return db['UserProfileResource'][_0x6d76('0x26')]({'where':{'type':_0x5717c1,'resourceId':_0x286da3['id']}})[_0x6d76('0x27')](function(){return _0x8d3d00;});})['then'](function(){_0x49d0ac[_0x6d76('0x1c')](0xcc)[_0x6d76('0x28')]();});}};}function handleEntityNotFound(_0xf72119,_0x96fde8){return function(_0xb7b194){if(!_0xb7b194){_0xf72119[_0x6d76('0x1b')](0x194);}return _0xb7b194;};}function handleError(_0x4b1058,_0x140dfe){_0x140dfe=_0x140dfe||0x1f4;return function(_0x68288d){logger[_0x6d76('0x29')](_0x68288d[_0x6d76('0x2a')]);if(_0x68288d[_0x6d76('0x2b')]){delete _0x68288d[_0x6d76('0x2b')];}_0x4b1058[_0x6d76('0x1c')](_0x140dfe)['send'](_0x68288d);};}exports['index']=function(_0x2b8260,_0x57fa0e){var _0x35c300={},_0x46a87f={},_0x4cabd6={'count':0x0,'rows':[]};var _0x5abb3b=_[_0x6d76('0x2c')](db['Trigger'][_0x6d76('0x2d')],function(_0x5bcf22){return{'name':_0x5bcf22[_0x6d76('0x2e')],'type':_0x5bcf22[_0x6d76('0x2f')]['key']};});_0x46a87f[_0x6d76('0x30')]=_['map'](_0x5abb3b,_0x6d76('0x2b'));_0x46a87f['query']=_[_0x6d76('0x31')](_0x2b8260[_0x6d76('0x32')]);_0x46a87f[_0x6d76('0x33')]=_[_0x6d76('0x34')](_0x46a87f['model'],_0x46a87f['query']);_0x35c300['attributes']=_[_0x6d76('0x34')](_0x46a87f[_0x6d76('0x30')],qs['fields'](_0x2b8260[_0x6d76('0x32')][_0x6d76('0x35')]));_0x35c300[_0x6d76('0x36')]=_0x35c300[_0x6d76('0x36')][_0x6d76('0x37')]?_0x35c300['attributes']:_0x46a87f['model'];if(!_0x2b8260[_0x6d76('0x32')][_0x6d76('0x38')](_0x6d76('0x39'))){_0x35c300[_0x6d76('0x20')]=qs[_0x6d76('0x20')](_0x2b8260[_0x6d76('0x32')][_0x6d76('0x20')]);_0x35c300[_0x6d76('0x1e')]=qs[_0x6d76('0x1e')](_0x2b8260['query'][_0x6d76('0x1e')]);}_0x35c300[_0x6d76('0x3a')]=qs[_0x6d76('0x3b')](_0x2b8260[_0x6d76('0x32')][_0x6d76('0x3b')]);_0x35c300[_0x6d76('0x3c')]=qs[_0x6d76('0x33')](_[_0x6d76('0x3d')](_0x2b8260[_0x6d76('0x32')],_0x46a87f['filters']),_0x5abb3b);if(_0x2b8260['query'][_0x6d76('0x3e')]){_0x35c300['where']=_[_0x6d76('0x3f')](_0x35c300[_0x6d76('0x3c')],{'$or':_['map'](_0x5abb3b,function(_0x5b8a97){if(_0x5b8a97[_0x6d76('0x2f')]!==_0x6d76('0x40')){var _0x4c19af={};_0x4c19af[_0x5b8a97[_0x6d76('0x2b')]]={'$like':'%'+_0x2b8260[_0x6d76('0x32')][_0x6d76('0x3e')]+'%'};return _0x4c19af;}})});}_0x35c300=_[_0x6d76('0x3f')]({},_0x35c300,_0x2b8260[_0x6d76('0x41')]);var _0x12c071={'where':_0x35c300[_0x6d76('0x3c')]};return db[_0x6d76('0x42')][_0x6d76('0x21')](_0x12c071)['then'](function(_0x2cb937){_0x4cabd6['count']=_0x2cb937;if(_0x2b8260[_0x6d76('0x32')]['includeAll']){_0x35c300[_0x6d76('0x43')]=[{'all':!![]}];}return db[_0x6d76('0x42')]['findAll'](_0x35c300);})[_0x6d76('0x27')](function(_0xd95dfa){_0x4cabd6[_0x6d76('0x44')]=_0xd95dfa;return _0x4cabd6;})[_0x6d76('0x27')](respondWithFilteredResult(_0x57fa0e,_0x35c300))[_0x6d76('0x45')](handleError(_0x57fa0e,null));};exports[_0x6d76('0x46')]=function(_0x276025,_0x3ec9e0){var _0x9cab09={'raw':![],'where':{'id':_0x276025[_0x6d76('0x47')]['id']}},_0x4a56bf={};_0x4a56bf['model']=_['keys'](db[_0x6d76('0x42')][_0x6d76('0x2d')]);_0x4a56bf[_0x6d76('0x32')]=_[_0x6d76('0x31')](_0x276025[_0x6d76('0x32')]);_0x4a56bf[_0x6d76('0x33')]=_[_0x6d76('0x34')](_0x4a56bf[_0x6d76('0x30')],_0x4a56bf[_0x6d76('0x32')]);_0x9cab09[_0x6d76('0x36')]=_[_0x6d76('0x34')](_0x4a56bf[_0x6d76('0x30')],qs[_0x6d76('0x35')](_0x276025['query']['fields']));_0x9cab09[_0x6d76('0x36')]=_0x9cab09[_0x6d76('0x36')]['length']?_0x9cab09['attributes']:_0x4a56bf[_0x6d76('0x30')];if(_0x276025[_0x6d76('0x32')][_0x6d76('0x48')]){_0x9cab09[_0x6d76('0x43')]=[{'all':!![]}];}_0x9cab09=_[_0x6d76('0x3f')]({},_0x9cab09,_0x276025[_0x6d76('0x41')]);return db['Trigger'][_0x6d76('0x49')](_0x9cab09)[_0x6d76('0x27')](handleEntityNotFound(_0x3ec9e0,null))[_0x6d76('0x27')](respondWithResult(_0x3ec9e0,null))[_0x6d76('0x45')](handleError(_0x3ec9e0,null));};exports['create']=function(_0x2b3843,_0x5c4c10){return db[_0x6d76('0x42')][_0x6d76('0x4a')](_0x2b3843[_0x6d76('0x4b')],{})[_0x6d76('0x27')](function(_0x18121d){var _0x47b6ad=_0x2b3843[_0x6d76('0x4c')][_0x6d76('0x24')]({'plain':!![]});if(!_0x47b6ad)throw new Error(_0x6d76('0x4d'));if(_0x47b6ad[_0x6d76('0x4e')]===_0x6d76('0x4c')){var _0x4b333d=_0x18121d['get']({'plain':!![]});var _0x3b0cd6=_0x6d76('0x25');return db['UserProfileSection'][_0x6d76('0x49')]({'where':{'name':_0x3b0cd6,'userProfileId':_0x47b6ad[_0x6d76('0x4f')]},'raw':!![]})['then'](function(_0x475406){if(_0x475406&&_0x475406[_0x6d76('0x50')]===0x0){return db['UserProfileResource'][_0x6d76('0x4a')]({'name':_0x4b333d[_0x6d76('0x2b')],'resourceId':_0x4b333d['id'],'type':_0x475406[_0x6d76('0x2b')],'sectionId':_0x475406['id']},{})[_0x6d76('0x27')](function(){return _0x18121d;});}else{return _0x18121d;}})[_0x6d76('0x45')](function(_0x4e080c){logger[_0x6d76('0x29')](_0x6d76('0x51'),_0x4e080c);throw _0x4e080c;});}return _0x18121d;})[_0x6d76('0x27')](respondWithResult(_0x5c4c10,0xc9))[_0x6d76('0x45')](handleError(_0x5c4c10,null));};exports[_0x6d76('0x52')]=function(_0x46bb16,_0x2d89ae){if(_0x46bb16[_0x6d76('0x4b')]['id']){delete _0x46bb16[_0x6d76('0x4b')]['id'];}return db[_0x6d76('0x42')][_0x6d76('0x49')]({'where':{'id':_0x46bb16['params']['id']}})[_0x6d76('0x27')](handleEntityNotFound(_0x2d89ae,null))[_0x6d76('0x27')](saveUpdates(_0x46bb16[_0x6d76('0x4b')],null))[_0x6d76('0x27')](respondWithResult(_0x2d89ae,null))[_0x6d76('0x45')](handleError(_0x2d89ae,null));};exports['destroy']=function(_0x54934d,_0x238e32){return db[_0x6d76('0x42')][_0x6d76('0x49')]({'where':{'id':_0x54934d[_0x6d76('0x47')]['id']}})[_0x6d76('0x27')](handleEntityNotFound(_0x238e32,null))[_0x6d76('0x27')](removeEntity(_0x238e32,null))[_0x6d76('0x45')](handleError(_0x238e32,null));};exports[_0x6d76('0x53')]=function(_0x4f5b96,_0x1d8d16,_0x43e626){if(_0x4f5b96[_0x6d76('0x4b')]['id']){delete _0x4f5b96[_0x6d76('0x4b')]['id'];}return db['Trigger'][_0x6d76('0x49')]({'where':{'id':_0x4f5b96[_0x6d76('0x47')]['id']}})['then'](handleEntityNotFound(_0x1d8d16,null))['then'](function(_0x135124){if(_0x135124){_0x4f5b96[_0x6d76('0x4b')][_0x6d76('0x54')]=_0x135124['id'];return db[_0x6d76('0x55')][_0x6d76('0x4a')](_0x4f5b96['body']);}})[_0x6d76('0x27')](respondWithResult(_0x1d8d16,null))[_0x6d76('0x45')](handleError(_0x1d8d16,null));};exports[_0x6d76('0x56')]=function(_0x4aa683,_0x2d233d,_0x4e2170){if(_0x4aa683[_0x6d76('0x4b')]['id']){delete _0x4aa683['body']['id'];}return db[_0x6d76('0x42')]['find']({'where':{'id':_0x4aa683[_0x6d76('0x47')]['id']}})[_0x6d76('0x27')](handleEntityNotFound(_0x2d233d,null))[_0x6d76('0x27')](function(_0x4e54e7){if(_0x4e54e7){_0x4aa683[_0x6d76('0x4b')][_0x6d76('0x57')]=_0x4e54e7['id'];return db['Condition'][_0x6d76('0x4a')](_0x4aa683[_0x6d76('0x4b')]);}})[_0x6d76('0x27')](respondWithResult(_0x2d233d,null))['catch'](handleError(_0x2d233d,null));};exports[_0x6d76('0x58')]=function(_0x4dcccf,_0x540c8e,_0x572229){var _0x2c08cd={};var _0x5f08cb={};var _0x1231a7;var _0x592a54;return db[_0x6d76('0x42')][_0x6d76('0x59')]({'where':{'id':_0x4dcccf[_0x6d76('0x47')]['id']}})[_0x6d76('0x27')](handleEntityNotFound(_0x540c8e,null))[_0x6d76('0x27')](function(_0x3d50a1){if(_0x3d50a1){_0x1231a7=_0x3d50a1;_0x5f08cb[_0x6d76('0x30')]=_[_0x6d76('0x31')](db[_0x6d76('0x55')][_0x6d76('0x2d')]);_0x5f08cb['query']=_[_0x6d76('0x31')](_0x4dcccf[_0x6d76('0x32')]);_0x5f08cb[_0x6d76('0x33')]=_[_0x6d76('0x34')](_0x5f08cb['model'],_0x5f08cb[_0x6d76('0x32')]);_0x2c08cd['attributes']=_[_0x6d76('0x34')](_0x5f08cb['model'],qs[_0x6d76('0x35')](_0x4dcccf[_0x6d76('0x32')][_0x6d76('0x35')]));_0x2c08cd[_0x6d76('0x36')]=_0x2c08cd['attributes'][_0x6d76('0x37')]?_0x2c08cd[_0x6d76('0x36')]:_0x5f08cb[_0x6d76('0x30')];_0x2c08cd['order']=qs[_0x6d76('0x3b')](_0x4dcccf[_0x6d76('0x32')][_0x6d76('0x3b')]);_0x2c08cd['where']=qs[_0x6d76('0x33')](_[_0x6d76('0x3d')](_0x4dcccf[_0x6d76('0x32')],_0x5f08cb[_0x6d76('0x33')]));if(_0x4dcccf['query'][_0x6d76('0x3e')]){_0x2c08cd[_0x6d76('0x3c')]=_['merge'](_0x2c08cd['where'],{'$or':_[_0x6d76('0x2c')](_0x2c08cd[_0x6d76('0x36')],function(_0x1a7f08){var _0x5d615b={};_0x5d615b[_0x1a7f08]={'$like':'%'+_0x4dcccf[_0x6d76('0x32')][_0x6d76('0x3e')]+'%'};return _0x5d615b;})});}_0x2c08cd=_['merge']({},_0x2c08cd,_0x4dcccf[_0x6d76('0x41')]);return _0x1231a7[_0x6d76('0x58')](_0x2c08cd);}})[_0x6d76('0x27')](function(_0x3634bc){if(_0x3634bc){_0x592a54=_0x3634bc[_0x6d76('0x37')];if(!_0x4dcccf[_0x6d76('0x32')][_0x6d76('0x38')](_0x6d76('0x39'))){_0x2c08cd[_0x6d76('0x20')]=qs[_0x6d76('0x20')](_0x4dcccf[_0x6d76('0x32')][_0x6d76('0x20')]);_0x2c08cd[_0x6d76('0x1e')]=qs[_0x6d76('0x1e')](_0x4dcccf[_0x6d76('0x32')][_0x6d76('0x1e')]);}return _0x1231a7[_0x6d76('0x58')](_0x2c08cd);}})[_0x6d76('0x27')](function(_0x315c2a){if(_0x315c2a){return _0x315c2a?{'count':_0x592a54,'rows':_0x315c2a}:null;}})[_0x6d76('0x27')](respondWithResult(_0x540c8e,null))['catch'](handleError(_0x540c8e,null));};exports[_0x6d76('0x5a')]=function(_0x23355c,_0x3215fe,_0x1b011b){var _0x1ad41c={};var _0x43412d={};var _0x570b19;var _0x44509a;return db['Trigger'][_0x6d76('0x59')]({'where':{'id':_0x23355c['params']['id']}})[_0x6d76('0x27')](handleEntityNotFound(_0x3215fe,null))[_0x6d76('0x27')](function(_0x4933ae){if(_0x4933ae){_0x570b19=_0x4933ae;_0x43412d[_0x6d76('0x30')]=_[_0x6d76('0x31')](db['Condition'][_0x6d76('0x2d')]);_0x43412d['query']=_[_0x6d76('0x31')](_0x23355c[_0x6d76('0x32')]);_0x43412d[_0x6d76('0x33')]=_[_0x6d76('0x34')](_0x43412d[_0x6d76('0x30')],_0x43412d[_0x6d76('0x32')]);_0x1ad41c[_0x6d76('0x36')]=_[_0x6d76('0x34')](_0x43412d['model'],qs[_0x6d76('0x35')](_0x23355c[_0x6d76('0x32')][_0x6d76('0x35')]));_0x1ad41c[_0x6d76('0x36')]=_0x1ad41c[_0x6d76('0x36')][_0x6d76('0x37')]?_0x1ad41c[_0x6d76('0x36')]:_0x43412d[_0x6d76('0x30')];_0x1ad41c[_0x6d76('0x3a')]=qs[_0x6d76('0x3b')](_0x23355c[_0x6d76('0x32')][_0x6d76('0x3b')]);_0x1ad41c[_0x6d76('0x3c')]=qs['filters'](_['pick'](_0x23355c[_0x6d76('0x32')],_0x43412d[_0x6d76('0x33')]));if(_0x23355c[_0x6d76('0x32')][_0x6d76('0x3e')]){_0x1ad41c[_0x6d76('0x3c')]=_[_0x6d76('0x3f')](_0x1ad41c[_0x6d76('0x3c')],{'$or':_['map'](_0x1ad41c['attributes'],function(_0x429e09){var _0x4c5fb8={};_0x4c5fb8[_0x429e09]={'$like':'%'+_0x23355c[_0x6d76('0x32')]['filter']+'%'};return _0x4c5fb8;})});}_0x1ad41c=_[_0x6d76('0x3f')]({},_0x1ad41c,_0x23355c[_0x6d76('0x41')]);return _0x570b19[_0x6d76('0x5a')](_0x1ad41c);}})[_0x6d76('0x27')](function(_0x2948fb){if(_0x2948fb){_0x44509a=_0x2948fb[_0x6d76('0x37')];if(!_0x23355c[_0x6d76('0x32')][_0x6d76('0x38')]('nolimit')){_0x1ad41c['limit']=qs[_0x6d76('0x20')](_0x23355c[_0x6d76('0x32')][_0x6d76('0x20')]);_0x1ad41c[_0x6d76('0x1e')]=qs[_0x6d76('0x1e')](_0x23355c[_0x6d76('0x32')][_0x6d76('0x1e')]);}return _0x570b19['getAnyConditions'](_0x1ad41c);}})[_0x6d76('0x27')](function(_0x1e4030){if(_0x1e4030){return _0x1e4030?{'count':_0x44509a,'rows':_0x1e4030}:null;}})['then'](respondWithResult(_0x3215fe,null))[_0x6d76('0x45')](handleError(_0x3215fe,null));};exports[_0x6d76('0x5b')]=function(_0x37619f,_0x4eb062,_0x5c453f){if(_0x37619f[_0x6d76('0x4b')]['id']){delete _0x37619f[_0x6d76('0x4b')]['id'];}return db['Trigger'][_0x6d76('0x49')]({'where':{'id':_0x37619f[_0x6d76('0x47')]['id']}})[_0x6d76('0x27')](handleEntityNotFound(_0x4eb062,null))['then'](function(_0x172f09){if(_0x172f09){_0x37619f['body'][_0x6d76('0x5c')]=_0x172f09['id'];return db['Action']['create'](_0x37619f[_0x6d76('0x4b')]);}})[_0x6d76('0x27')](respondWithResult(_0x4eb062,null))[_0x6d76('0x45')](handleError(_0x4eb062,null));};exports[_0x6d76('0x5d')]=function(_0x5ac42e,_0x4063fa,_0x488f02){var _0x3c55ff={};var _0x246e1d={};var _0x2ee64e;var _0x577acf;return db[_0x6d76('0x42')][_0x6d76('0x59')]({'where':{'id':_0x5ac42e[_0x6d76('0x47')]['id']}})[_0x6d76('0x27')](handleEntityNotFound(_0x4063fa,null))[_0x6d76('0x27')](function(_0x24360c){if(_0x24360c){_0x2ee64e=_0x24360c;_0x246e1d[_0x6d76('0x30')]=_[_0x6d76('0x31')](db[_0x6d76('0x5e')][_0x6d76('0x2d')]);_0x246e1d[_0x6d76('0x32')]=_[_0x6d76('0x31')](_0x5ac42e[_0x6d76('0x32')]);_0x246e1d['filters']=_['intersection'](_0x246e1d[_0x6d76('0x30')],_0x246e1d[_0x6d76('0x32')]);_0x3c55ff[_0x6d76('0x36')]=_['intersection'](_0x246e1d[_0x6d76('0x30')],qs['fields'](_0x5ac42e['query']['fields']));_0x3c55ff['attributes']=_0x3c55ff[_0x6d76('0x36')]['length']?_0x3c55ff[_0x6d76('0x36')]:_0x246e1d[_0x6d76('0x30')];_0x3c55ff[_0x6d76('0x3a')]=qs[_0x6d76('0x3b')](_0x5ac42e['query'][_0x6d76('0x3b')]);_0x3c55ff[_0x6d76('0x3c')]=qs[_0x6d76('0x33')](_[_0x6d76('0x3d')](_0x5ac42e[_0x6d76('0x32')],_0x246e1d[_0x6d76('0x33')]));if(_0x5ac42e[_0x6d76('0x32')][_0x6d76('0x3e')]){_0x3c55ff[_0x6d76('0x3c')]=_[_0x6d76('0x3f')](_0x3c55ff[_0x6d76('0x3c')],{'$or':_[_0x6d76('0x2c')](_0x3c55ff[_0x6d76('0x36')],function(_0x49a561){var _0x12328a={};_0x12328a[_0x49a561]={'$like':'%'+_0x5ac42e[_0x6d76('0x32')][_0x6d76('0x3e')]+'%'};return _0x12328a;})});}_0x3c55ff=_[_0x6d76('0x3f')]({},_0x3c55ff,_0x5ac42e[_0x6d76('0x41')]);return _0x2ee64e[_0x6d76('0x5d')](_0x3c55ff);}})[_0x6d76('0x27')](function(_0x3d535d){if(_0x3d535d){_0x577acf=_0x3d535d[_0x6d76('0x37')];if(!_0x5ac42e['query']['hasOwnProperty'](_0x6d76('0x39'))){_0x3c55ff[_0x6d76('0x20')]=qs[_0x6d76('0x20')](_0x5ac42e[_0x6d76('0x32')][_0x6d76('0x20')]);_0x3c55ff[_0x6d76('0x1e')]=qs['offset'](_0x5ac42e[_0x6d76('0x32')][_0x6d76('0x1e')]);}return _0x2ee64e[_0x6d76('0x5d')](_0x3c55ff);}})[_0x6d76('0x27')](function(_0x1658d4){if(_0x1658d4){return _0x1658d4?{'count':_0x577acf,'rows':_0x1658d4}:null;}})[_0x6d76('0x27')](respondWithResult(_0x4063fa,null))[_0x6d76('0x45')](handleError(_0x4063fa,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index b3715ed..a1b9c15 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 _0x7a08=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./trigger.attributes','exports','define','tools_triggers','lodash','util'];(function(_0x41a765,_0x4a1742){var _0x39dbd6=function(_0x527776){while(--_0x527776){_0x41a765['push'](_0x41a765['shift']());}};_0x39dbd6(++_0x4a1742);}(_0x7a08,0x11e));var _0x87a0=function(_0xdb5808,_0x58c067){_0xdb5808=_0xdb5808-0x0;var _0x111072=_0x7a08[_0xdb5808];return _0x111072;};'use strict';var _=require(_0x87a0('0x0'));var util=require(_0x87a0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x87a0('0x2'));var BPromise=require(_0x87a0('0x3'));var rp=require(_0x87a0('0x4'));var fs=require('fs');var path=require(_0x87a0('0x5'));var rimraf=require(_0x87a0('0x6'));var config=require(_0x87a0('0x7'));var attributes=require(_0x87a0('0x8'));module[_0x87a0('0x9')]=function(_0x1b384a,_0xf9199b){return _0x1b384a[_0x87a0('0xa')]('Trigger',attributes,{'tableName':_0x87a0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7250=['rimraf','./trigger.attributes','Trigger','tools_triggers','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7250,0x1b1));var _0x0725=function(_0x107288,_0x4d1dc3){_0x107288=_0x107288-0x0;var _0x4a0fd1=_0x7250[_0x107288];return _0x4a0fd1;};'use strict';var _=require(_0x0725('0x0'));var util=require(_0x0725('0x1'));var logger=require('../../config/logger')(_0x0725('0x2'));var moment=require(_0x0725('0x3'));var BPromise=require(_0x0725('0x4'));var rp=require(_0x0725('0x5'));var fs=require('fs');var path=require(_0x0725('0x6'));var rimraf=require(_0x0725('0x7'));var config=require('../../config/environment');var attributes=require(_0x0725('0x8'));module['exports']=function(_0x4e8c6c,_0xa32c3f){return _0x4e8c6c['define'](_0x0725('0x9'),attributes,{'tableName':_0x0725('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index f1ed954..9edc577 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 _0x67c4=['Trigger','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowTrigger','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetTrigger'];(function(_0x32ca03,_0x14c7ee){var _0x17967f=function(_0x2175e5){while(--_0x2175e5){_0x32ca03['push'](_0x32ca03['shift']());}};_0x17967f(++_0x14c7ee);}(_0x67c4,0x178));var _0x467c=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x67c4[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0x467c('0x0'));var util=require(_0x467c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x467c('0x2'));var fs=require('fs');var Redis=require(_0x467c('0x3'));var db=require(_0x467c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x467c('0x5'))(_0x467c('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x467c('0x7')][_0x467c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x37da4c,_0x214fb4,_0x139f48){return new BPromise(function(_0x33a0e6,_0x3bf46c){return client['request'](_0x37da4c,_0x139f48)[_0x467c('0x9')](function(_0x506984){logger[_0x467c('0xa')](_0x467c('0xb'),_0x214fb4,_0x467c('0xc'));logger[_0x467c('0xd')](_0x467c('0xe'),_0x214fb4,'request\x20sent',JSON[_0x467c('0xf')](_0x506984));if(_0x506984['error']){if(_0x506984[_0x467c('0x10')]['code']===0x1f4){logger[_0x467c('0x10')](_0x467c('0xb'),_0x214fb4,_0x506984['error'][_0x467c('0x11')]);return _0x3bf46c(_0x506984['error']['message']);}logger[_0x467c('0x10')](_0x467c('0xb'),_0x214fb4,_0x506984[_0x467c('0x10')][_0x467c('0x11')]);return _0x33a0e6(_0x506984[_0x467c('0x10')]['message']);}else{logger[_0x467c('0xa')](_0x467c('0xb'),_0x214fb4,_0x467c('0xc'));_0x33a0e6(_0x506984[_0x467c('0x12')][_0x467c('0x11')]);}})['catch'](function(_0x33a86d){logger[_0x467c('0x10')]('Trigger,\x20%s,\x20%s',_0x214fb4,_0x33a86d);_0x3bf46c(_0x33a86d);});});}exports[_0x467c('0x13')]=function(_0x798709){var _0x4ecb0d=this;return new Promise(function(_0x54593a,_0x4aad82){return db[_0x467c('0x14')][_0x467c('0x15')]({'raw':_0x798709[_0x467c('0x16')]?_0x798709[_0x467c('0x16')][_0x467c('0x17')]===undefined?!![]:![]:!![],'where':_0x798709[_0x467c('0x16')]?_0x798709['options'][_0x467c('0x18')]||null:null,'attributes':_0x798709[_0x467c('0x16')]?_0x798709['options'][_0x467c('0x19')]||null:null,'limit':_0x798709[_0x467c('0x16')]?_0x798709[_0x467c('0x16')][_0x467c('0x1a')]||null:null,'include':_0x798709['options']?_0x798709[_0x467c('0x16')][_0x467c('0x1b')]?_[_0x467c('0x1c')](_0x798709['options'][_0x467c('0x1b')],function(_0x27e57e){return{'model':db[_0x27e57e['model']],'as':_0x27e57e['as'],'attributes':_0x27e57e[_0x467c('0x19')],'include':_0x27e57e[_0x467c('0x1b')]?_[_0x467c('0x1c')](_0x27e57e[_0x467c('0x1b')],function(_0x3166fd){return{'model':db[_0x3166fd[_0x467c('0x1d')]],'as':_0x3166fd['as'],'attributes':_0x3166fd[_0x467c('0x19')],'include':_0x3166fd[_0x467c('0x1b')]?_[_0x467c('0x1c')](_0x3166fd[_0x467c('0x1b')],function(_0x4d6352){return{'model':db[_0x4d6352[_0x467c('0x1d')]],'as':_0x4d6352['as'],'attributes':_0x4d6352[_0x467c('0x19')]};}):[]};}):[]};}):[]:[]})[_0x467c('0x9')](function(_0x5d661f){logger['info']('GetTrigger',_0x798709);logger[_0x467c('0xd')](_0x467c('0x13'),_0x798709,JSON['stringify'](_0x5d661f));_0x54593a(_0x5d661f);})['catch'](function(_0x51a6bc){logger[_0x467c('0x10')]('GetTrigger',_0x51a6bc[_0x467c('0x11')],_0x798709);_0x4aad82(_0x4ecb0d['error'](0x1f4,_0x51a6bc[_0x467c('0x11')]));});});};exports['ShowTrigger']=function(_0x95b824){var _0x563acc=this;return new Promise(function(_0x4bc687,_0x2da9c1){return db[_0x467c('0x14')][_0x467c('0x1e')]({'raw':_0x95b824[_0x467c('0x16')]?_0x95b824[_0x467c('0x16')][_0x467c('0x17')]===undefined?!![]:![]:!![],'where':_0x95b824[_0x467c('0x16')]?_0x95b824[_0x467c('0x16')]['where']||null:null,'attributes':_0x95b824[_0x467c('0x16')]?_0x95b824[_0x467c('0x16')]['attributes']||null:null,'include':_0x95b824['options']?_0x95b824[_0x467c('0x16')]['include']?_['map'](_0x95b824['options'][_0x467c('0x1b')],function(_0x117493){return{'model':db[_0x117493[_0x467c('0x1d')]],'as':_0x117493['as'],'attributes':_0x117493[_0x467c('0x19')],'include':_0x117493['include']?_[_0x467c('0x1c')](_0x117493[_0x467c('0x1b')],function(_0x1176c4){return{'model':db[_0x1176c4['model']],'as':_0x1176c4['as'],'attributes':_0x1176c4['attributes'],'include':_0x1176c4['include']?_[_0x467c('0x1c')](_0x1176c4[_0x467c('0x1b')],function(_0x3bf841){return{'model':db[_0x3bf841[_0x467c('0x1d')]],'as':_0x3bf841['as'],'attributes':_0x3bf841[_0x467c('0x19')]};}):[]};}):[]};}):[]:[]})[_0x467c('0x9')](function(_0x233191){logger[_0x467c('0xa')](_0x467c('0x1f'),_0x95b824);logger['debug'](_0x467c('0x1f'),_0x95b824,JSON[_0x467c('0xf')](_0x233191));_0x4bc687(_0x233191);})[_0x467c('0x20')](function(_0x2c053c){logger[_0x467c('0x10')](_0x467c('0x1f'),_0x2c053c[_0x467c('0x11')],_0x95b824);_0x2da9c1(_0x563acc[_0x467c('0x10')](0x1f4,_0x2c053c['message']));});});}; \ No newline at end of file +var _0xe7ea=['include','map','model','catch','ShowTrigger','find','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','GetTrigger','Trigger','findAll','options','where','attributes'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0xe7ea,0x93));var _0xae7e=function(_0x1c5835,_0x20431a){_0x1c5835=_0x1c5835-0x0;var _0x558ebf=_0xe7ea[_0x1c5835];return _0x558ebf;};'use strict';var _=require(_0xae7e('0x0'));var util=require(_0xae7e('0x1'));var moment=require(_0xae7e('0x2'));var BPromise=require(_0xae7e('0x3'));var rs=require(_0xae7e('0x4'));var fs=require('fs');var Redis=require(_0xae7e('0x5'));var db=require(_0xae7e('0x6'))['db'];var utils=require(_0xae7e('0x7'));var logger=require(_0xae7e('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xae7e('0x9'));var client=jayson[_0xae7e('0xa')][_0xae7e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b720c,_0x1515dc,_0x5aab92){return new BPromise(function(_0x50a2ae,_0x3c277b){return client[_0xae7e('0xc')](_0x2b720c,_0x5aab92)[_0xae7e('0xd')](function(_0x778081){logger['info'](_0xae7e('0xe'),_0x1515dc,_0xae7e('0xf'));logger['debug'](_0xae7e('0x10'),_0x1515dc,'request\x20sent',JSON[_0xae7e('0x11')](_0x778081));if(_0x778081[_0xae7e('0x12')]){if(_0x778081[_0xae7e('0x12')]['code']===0x1f4){logger[_0xae7e('0x12')](_0xae7e('0xe'),_0x1515dc,_0x778081[_0xae7e('0x12')][_0xae7e('0x13')]);return _0x3c277b(_0x778081[_0xae7e('0x12')]['message']);}logger[_0xae7e('0x12')](_0xae7e('0xe'),_0x1515dc,_0x778081[_0xae7e('0x12')][_0xae7e('0x13')]);return _0x50a2ae(_0x778081[_0xae7e('0x12')][_0xae7e('0x13')]);}else{logger[_0xae7e('0x14')]('Trigger,\x20%s,\x20%s',_0x1515dc,_0xae7e('0xf'));_0x50a2ae(_0x778081[_0xae7e('0x15')][_0xae7e('0x13')]);}})['catch'](function(_0x593a2a){logger[_0xae7e('0x12')](_0xae7e('0xe'),_0x1515dc,_0x593a2a);_0x3c277b(_0x593a2a);});});}exports[_0xae7e('0x16')]=function(_0x19ad2a){var _0x295818=this;return new Promise(function(_0x332021,_0x5288ae){return db[_0xae7e('0x17')][_0xae7e('0x18')]({'raw':_0x19ad2a[_0xae7e('0x19')]?_0x19ad2a[_0xae7e('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x19ad2a[_0xae7e('0x19')]?_0x19ad2a[_0xae7e('0x19')][_0xae7e('0x1a')]||null:null,'attributes':_0x19ad2a[_0xae7e('0x19')]?_0x19ad2a[_0xae7e('0x19')][_0xae7e('0x1b')]||null:null,'limit':_0x19ad2a['options']?_0x19ad2a['options']['limit']||null:null,'include':_0x19ad2a[_0xae7e('0x19')]?_0x19ad2a[_0xae7e('0x19')][_0xae7e('0x1c')]?_[_0xae7e('0x1d')](_0x19ad2a[_0xae7e('0x19')][_0xae7e('0x1c')],function(_0x23ef86){return{'model':db[_0x23ef86[_0xae7e('0x1e')]],'as':_0x23ef86['as'],'attributes':_0x23ef86[_0xae7e('0x1b')],'include':_0x23ef86[_0xae7e('0x1c')]?_[_0xae7e('0x1d')](_0x23ef86[_0xae7e('0x1c')],function(_0x339fd5){return{'model':db[_0x339fd5[_0xae7e('0x1e')]],'as':_0x339fd5['as'],'attributes':_0x339fd5[_0xae7e('0x1b')],'include':_0x339fd5['include']?_[_0xae7e('0x1d')](_0x339fd5[_0xae7e('0x1c')],function(_0x32dc65){return{'model':db[_0x32dc65[_0xae7e('0x1e')]],'as':_0x32dc65['as'],'attributes':_0x32dc65[_0xae7e('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c624a){logger[_0xae7e('0x14')]('GetTrigger',_0x19ad2a);logger['debug'](_0xae7e('0x16'),_0x19ad2a,JSON[_0xae7e('0x11')](_0x2c624a));_0x332021(_0x2c624a);})[_0xae7e('0x1f')](function(_0x4e8d36){logger[_0xae7e('0x12')](_0xae7e('0x16'),_0x4e8d36[_0xae7e('0x13')],_0x19ad2a);_0x5288ae(_0x295818['error'](0x1f4,_0x4e8d36[_0xae7e('0x13')]));});});};exports[_0xae7e('0x20')]=function(_0x1ff1c4){var _0x5422ff=this;return new Promise(function(_0x130d55,_0x3be0d0){return db['Trigger'][_0xae7e('0x21')]({'raw':_0x1ff1c4[_0xae7e('0x19')]?_0x1ff1c4[_0xae7e('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1ff1c4[_0xae7e('0x19')]?_0x1ff1c4['options']['where']||null:null,'attributes':_0x1ff1c4['options']?_0x1ff1c4[_0xae7e('0x19')][_0xae7e('0x1b')]||null:null,'include':_0x1ff1c4[_0xae7e('0x19')]?_0x1ff1c4[_0xae7e('0x19')][_0xae7e('0x1c')]?_[_0xae7e('0x1d')](_0x1ff1c4['options'][_0xae7e('0x1c')],function(_0x5a63ec){return{'model':db[_0x5a63ec[_0xae7e('0x1e')]],'as':_0x5a63ec['as'],'attributes':_0x5a63ec[_0xae7e('0x1b')],'include':_0x5a63ec[_0xae7e('0x1c')]?_[_0xae7e('0x1d')](_0x5a63ec[_0xae7e('0x1c')],function(_0x16f461){return{'model':db[_0x16f461[_0xae7e('0x1e')]],'as':_0x16f461['as'],'attributes':_0x16f461[_0xae7e('0x1b')],'include':_0x16f461[_0xae7e('0x1c')]?_['map'](_0x16f461['include'],function(_0x9fcd31){return{'model':db[_0x9fcd31[_0xae7e('0x1e')]],'as':_0x9fcd31['as'],'attributes':_0x9fcd31[_0xae7e('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ba8ce){logger[_0xae7e('0x14')](_0xae7e('0x20'),_0x1ff1c4);logger[_0xae7e('0x22')]('ShowTrigger',_0x1ff1c4,JSON['stringify'](_0x4ba8ce));_0x130d55(_0x4ba8ce);})['catch'](function(_0x3bdce4){logger['error']('ShowTrigger',_0x3bdce4[_0xae7e('0x13')],_0x1ff1c4);_0x3be0d0(_0x5422ff[_0xae7e('0x12')](0x1f4,_0x3bdce4['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 753018d..32153ae 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 _0x67c4=['clone','put','update','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','get','isAuthenticated','/:id','show','post','/:id/clone'];(function(_0x575335,_0x3955b8){var _0x1b9677=function(_0x19215c){while(--_0x19215c){_0x575335['push'](_0x575335['shift']());}};_0x1b9677(++_0x3955b8);}(_0x67c4,0x125));var _0x467c=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x67c4[_0x9dfc10];return _0x4f938a;};'use strict';var multer=require('multer');var util=require(_0x467c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x467c('0x1'));var router=express[_0x467c('0x2')]();var fs_extra=require(_0x467c('0x3'));var auth=require(_0x467c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x467c('0x5'));var controller=require(_0x467c('0x6'));router[_0x467c('0x7')]('/',auth[_0x467c('0x8')](),controller['index']);router[_0x467c('0x7')](_0x467c('0x9'),auth[_0x467c('0x8')](),controller[_0x467c('0xa')]);router[_0x467c('0xb')](_0x467c('0xc'),auth[_0x467c('0x8')](),controller[_0x467c('0xd')]);router[_0x467c('0xb')]('/',auth[_0x467c('0x8')](),controller['create']);router[_0x467c('0xe')](_0x467c('0x9'),auth[_0x467c('0x8')](),controller[_0x467c('0xf')]);router['delete'](_0x467c('0x9'),auth[_0x467c('0x8')](),controller[_0x467c('0x10')]);module[_0x467c('0x11')]=router; \ No newline at end of file +var _0xb788=['update','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','post','create','put'];(function(_0x150626,_0x4ec9eb){var _0x18ccec=function(_0x12e227){while(--_0x12e227){_0x150626['push'](_0x150626['shift']());}};_0x18ccec(++_0x4ec9eb);}(_0xb788,0x6e));var _0x8b78=function(_0x55a76a,_0x2d0203){_0x55a76a=_0x55a76a-0x0;var _0x45885a=_0xb788[_0x55a76a];return _0x45885a;};'use strict';var multer=require('multer');var util=require(_0x8b78('0x0'));var path=require(_0x8b78('0x1'));var timeout=require(_0x8b78('0x2'));var express=require(_0x8b78('0x3'));var router=express[_0x8b78('0x4')]();var fs_extra=require(_0x8b78('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b78('0x6'));var config=require(_0x8b78('0x7'));var controller=require(_0x8b78('0x8'));router[_0x8b78('0x9')]('/',auth[_0x8b78('0xa')](),controller[_0x8b78('0xb')]);router['get'](_0x8b78('0xc'),auth[_0x8b78('0xa')](),controller['show']);router[_0x8b78('0xd')]('/:id/clone',auth['isAuthenticated'](),controller['clone']);router[_0x8b78('0xd')]('/',auth[_0x8b78('0xa')](),controller[_0x8b78('0xe')]);router[_0x8b78('0xf')](_0x8b78('0xc'),auth[_0x8b78('0xa')](),controller[_0x8b78('0x10')]);router[_0x8b78('0x11')](_0x8b78('0xc'),auth[_0x8b78('0xa')](),controller['destroy']);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 824ac11..33d9a71 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 _0xc7d2=['certificate','active','passive','actpass','dynamic','update','update,nonat','sequelize','exports','STRING','friend','user','peer','from-voip-provider','ENUM','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','setDataValue','join','getDataValue','transport','shortinfo','inband','auto','rfc2833','yes','nonat','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','split','port,invite','insecure','INTEGER','\x22\x22\x20<>','always','accept','uas','pai'];(function(_0x3c8be8,_0x5c39b1){var _0x3370c4=function(_0x3e91f7){while(--_0x3e91f7){_0x3c8be8['push'](_0x3c8be8['shift']());}};_0x3370c4(++_0x5c39b1);}(_0xc7d2,0x149));var _0x2c7d=function(_0x5161fc,_0x37c5f6){_0x5161fc=_0x5161fc-0x0;var _0x38490b=_0xc7d2[_0x5161fc];return _0x38490b;};'use strict';var Sequelize=require(_0x2c7d('0x0'));module[_0x2c7d('0x1')]={'name':{'type':Sequelize[_0x2c7d('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x2c7d('0x3'),_0x2c7d('0x4'),_0x2c7d('0x5')),'allowNull':![],'defaultValue':_0x2c7d('0x3')},'context':{'type':Sequelize[_0x2c7d('0x2')],'allowNull':![],'defaultValue':_0x2c7d('0x6')},'callingpres':{'type':Sequelize[_0x2c7d('0x7')]('ALLOWED_NOT_SCREENED',_0x2c7d('0x8'),_0x2c7d('0x9'),'ALLOWED',_0x2c7d('0xa'),_0x2c7d('0xb'),'PROHIB_FAILED_SCREEN',_0x2c7d('0xc'))},'deny':{'type':Sequelize[_0x2c7d('0x2')]},'permit':{'type':Sequelize[_0x2c7d('0x2')]},'secret':{'type':Sequelize[_0x2c7d('0x2')]},'md5secret':{'type':Sequelize[_0x2c7d('0x2')]},'remotesecret':{'type':Sequelize[_0x2c7d('0x2')]},'transport':{'type':Sequelize[_0x2c7d('0x2')],'defaultValue':_0x2c7d('0xd'),'set':function(_0x252ca4){this[_0x2c7d('0xe')]('transport',_0x252ca4?_0x252ca4[_0x2c7d('0xf')](','):null);},'get':function(){return this[_0x2c7d('0x10')](_0x2c7d('0x11'))?this[_0x2c7d('0x10')](_0x2c7d('0x11'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x2c7d('0x7')]('rfc2833','info',_0x2c7d('0x12'),_0x2c7d('0x13'),_0x2c7d('0x14')),'defaultValue':_0x2c7d('0x15')},'directmedia':{'type':Sequelize[_0x2c7d('0x7')](_0x2c7d('0x16'),'no',_0x2c7d('0x17'),'update','outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2c7d('0x7')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2c7d('0x2')]},'directmediadeny':{'type':Sequelize[_0x2c7d('0x2')]},'nat':{'type':Sequelize[_0x2c7d('0x2')],'defaultValue':_0x2c7d('0x18'),'set':function(_0x5c7d04){this[_0x2c7d('0xe')](_0x2c7d('0x19'),_0x5c7d04?_0x5c7d04[_0x2c7d('0xf')](','):null);},'get':function(){return this[_0x2c7d('0x10')](_0x2c7d('0x19'))?this[_0x2c7d('0x10')]('nat')['split'](','):null;},'comment':_0x2c7d('0x1a')},'callgroup':{'type':Sequelize[_0x2c7d('0x2')]},'namedcallgroup':{'type':Sequelize[_0x2c7d('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x2c7d('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2c7d('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x2c7d('0x2')],'defaultValue':_0x2c7d('0x1b')},'allow':{'type':Sequelize[_0x2c7d('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x5e7131){this[_0x2c7d('0xe')]('allow',_0x5e7131?_0x5e7131['join'](';'):_0x2c7d('0x1c'));},'get':function(){return this['getDataValue']('allow')?this[_0x2c7d('0x10')](_0x2c7d('0x1d'))[_0x2c7d('0x1e')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x2c7d('0x7')]('yes','no')},'insecure':{'type':Sequelize[_0x2c7d('0x2')],'defaultValue':_0x2c7d('0x1f'),'set':function(_0x13b21c){this[_0x2c7d('0xe')](_0x2c7d('0x20'),_0x13b21c?_0x13b21c[_0x2c7d('0xf')](','):null);},'get':function(){return this['getDataValue'](_0x2c7d('0x20'))?this[_0x2c7d('0x10')](_0x2c7d('0x20'))[_0x2c7d('0x1e')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x2c7d('0x7')](_0x2c7d('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2c7d('0x7')](_0x2c7d('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no','never')},'promiscredir':{'type':Sequelize[_0x2c7d('0x7')](_0x2c7d('0x16'),'no')},'useclientcode':{'type':Sequelize['ENUM']('yes','no')},'accountcode':{'type':Sequelize[_0x2c7d('0x21')](0xb)},'setvar':{'type':Sequelize[_0x2c7d('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x2c7d('0x22')},'amaflags':{'type':Sequelize[_0x2c7d('0x2')]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x2c7d('0x7')](_0x2c7d('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0x2c7d('0x7')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x2c7d('0x7')](_0x2c7d('0x16'),'no')},'ignoresdpversion':{'type':Sequelize[_0x2c7d('0x7')](_0x2c7d('0x16'),'no')},'subscribecontext':{'type':Sequelize[_0x2c7d('0x2')]},'template':{'type':Sequelize[_0x2c7d('0x2')]},'videosupport':{'type':Sequelize[_0x2c7d('0x7')]('yes','no',_0x2c7d('0x23')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2c7d('0x21')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x2c7d('0x7')]('yes','no')},'mailbox':{'type':Sequelize[_0x2c7d('0x2')]},'session_timers':{'type':Sequelize[_0x2c7d('0x7')](_0x2c7d('0x24'),'refuse','originate')},'session_expires':{'type':Sequelize[_0x2c7d('0x21')](0xb)},'session_minse':{'type':Sequelize[_0x2c7d('0x21')](0xb)},'session_refresher':{'type':Sequelize[_0x2c7d('0x7')]('uac',_0x2c7d('0x25')),'defaultValue':_0x2c7d('0x25')},'t38pt_usertpsource':{'type':Sequelize[_0x2c7d('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x2c7d('0x2')]},'fromuser':{'type':Sequelize[_0x2c7d('0x2')]},'port':{'type':Sequelize[_0x2c7d('0x21')](0x5)},'qualify':{'type':Sequelize[_0x2c7d('0x7')](_0x2c7d('0x16'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x2c7d('0x21')](0xb)},'defaultip':{'type':Sequelize[_0x2c7d('0x2')]},'defaultuser':{'type':Sequelize[_0x2c7d('0x2')]},'rtptimeout':{'type':Sequelize[_0x2c7d('0x21')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x2c7d('0x21')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x2c7d('0x21')](0xb)},'sendrpid':{'type':Sequelize['ENUM']('yes','no',_0x2c7d('0x26')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2c7d('0x2')]},'callbackextension':{'type':Sequelize[_0x2c7d('0x2')]},'timert1':{'type':Sequelize[_0x2c7d('0x21')](0xb)},'timerb':{'type':Sequelize[_0x2c7d('0x21')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x2c7d('0x2')]},'contactdeny':{'type':Sequelize[_0x2c7d('0x2')]},'contactacl':{'type':Sequelize[_0x2c7d('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x2c7d('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x2c7d('0x21')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x2c7d('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2c7d('0x7')](_0x2c7d('0x16'),'no')},'force_avp':{'type':Sequelize[_0x2c7d('0x7')](_0x2c7d('0x16'),'no')},'icesupport':{'type':Sequelize[_0x2c7d('0x7')](_0x2c7d('0x16'),'no')},'dtlsenable':{'type':Sequelize[_0x2c7d('0x7')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x2c7d('0x7')](_0x2c7d('0x16'),'no','fingerprint',_0x2c7d('0x27'))},'dtlsrekey':{'type':Sequelize[_0x2c7d('0x21')](0xb)},'dtlscertfile':{'type':Sequelize[_0x2c7d('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x2c7d('0x2')]},'dtlscipher':{'type':Sequelize[_0x2c7d('0x2')]},'dtlscafile':{'type':Sequelize[_0x2c7d('0x2')]},'dtlscapath':{'type':Sequelize[_0x2c7d('0x2')]},'dtlssetup':{'type':Sequelize[_0x2c7d('0x7')](_0x2c7d('0x28'),_0x2c7d('0x29'),_0x2c7d('0x2a')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x2c7d('0x7')](_0x2c7d('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2c7d('0x2')]},'recordofffeature':{'type':Sequelize[_0x2c7d('0x2')]},'call_limit':{'type':Sequelize[_0x2c7d('0x21')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x2c7d('0x7')](_0x2c7d('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0x2c7d('0x7')]('yes','no')},'vmexten':{'type':Sequelize[_0x2c7d('0x2')]},'mohinterpret':{'type':Sequelize[_0x2c7d('0x2')]},'mohsuggest':{'type':Sequelize[_0x2c7d('0x2')]},'parkinglot':{'type':Sequelize[_0x2c7d('0x2')]},'description':{'type':Sequelize[_0x2c7d('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x2c7d('0x2b')},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0x2c7d('0x17'),_0x2c7d('0x2c'),_0x2c7d('0x2d')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x2c7d('0x2')]},'otherFields':{'type':Sequelize[_0x2c7d('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0xd48b=['nonat','update','outgoing','join','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','yes','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','uac','uas','pai','fingerprint','certificate','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','friend','user','peer','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','getDataValue','split','info','shortinfo','inband','auto','rfc2833'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd48b,0x131));var _0xbd48=function(_0x2f4366,_0x2658f7){_0x2f4366=_0x2f4366-0x0;var _0x53aee7=_0xd48b[_0x2f4366];return _0x53aee7;};'use strict';var Sequelize=require(_0xbd48('0x0'));module[_0xbd48('0x1')]={'name':{'type':Sequelize[_0xbd48('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xbd48('0x3'),_0xbd48('0x4'),_0xbd48('0x5')),'allowNull':![],'defaultValue':_0xbd48('0x3')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbd48('0x6')},'callingpres':{'type':Sequelize[_0xbd48('0x7')](_0xbd48('0x8'),_0xbd48('0x9'),'ALLOWED_FAILED_SCREEN',_0xbd48('0xa'),_0xbd48('0xb'),_0xbd48('0xc'),_0xbd48('0xd'),_0xbd48('0xe'))},'deny':{'type':Sequelize[_0xbd48('0x2')]},'permit':{'type':Sequelize[_0xbd48('0x2')]},'secret':{'type':Sequelize[_0xbd48('0x2')]},'md5secret':{'type':Sequelize[_0xbd48('0x2')]},'remotesecret':{'type':Sequelize[_0xbd48('0x2')]},'transport':{'type':Sequelize[_0xbd48('0x2')],'defaultValue':_0xbd48('0xf'),'set':function(_0x20ccdf){this[_0xbd48('0x10')](_0xbd48('0x11'),_0x20ccdf?_0x20ccdf['join'](','):null);},'get':function(){return this['getDataValue'](_0xbd48('0x11'))?this[_0xbd48('0x12')](_0xbd48('0x11'))[_0xbd48('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xbd48('0x7')]('rfc2833',_0xbd48('0x14'),_0xbd48('0x15'),_0xbd48('0x16'),_0xbd48('0x17')),'defaultValue':_0xbd48('0x18')},'directmedia':{'type':Sequelize[_0xbd48('0x7')]('yes','no',_0xbd48('0x19'),_0xbd48('0x1a'),_0xbd48('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xbd48('0x7')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xbd48('0x2')]},'directmediadeny':{'type':Sequelize[_0xbd48('0x2')]},'nat':{'type':Sequelize[_0xbd48('0x2')],'defaultValue':'force_rport,comedia','set':function(_0xc44bee){this['setDataValue']('nat',_0xc44bee?_0xc44bee[_0xbd48('0x1c')](','):null);},'get':function(){return this[_0xbd48('0x12')](_0xbd48('0x1d'))?this[_0xbd48('0x12')](_0xbd48('0x1d'))[_0xbd48('0x13')](','):null;},'comment':_0xbd48('0x1e')},'callgroup':{'type':Sequelize[_0xbd48('0x2')]},'namedcallgroup':{'type':Sequelize[_0xbd48('0x2')]},'pickupgroup':{'type':Sequelize[_0xbd48('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xbd48('0x2')]},'language':{'type':Sequelize[_0xbd48('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xbd48('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xbd48('0x2')],'defaultValue':_0xbd48('0x1f')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbd48('0x20'),'set':function(_0x46dd3d){this[_0xbd48('0x10')]('allow',_0x46dd3d?_0x46dd3d[_0xbd48('0x1c')](';'):_0xbd48('0x20'));},'get':function(){return this['getDataValue']('allow')?this[_0xbd48('0x12')](_0xbd48('0x21'))[_0xbd48('0x13')](';'):null;},'comment':_0xbd48('0x22')},'autoframing':{'type':Sequelize[_0xbd48('0x7')](_0xbd48('0x23'),'no')},'insecure':{'type':Sequelize[_0xbd48('0x2')],'defaultValue':_0xbd48('0x24'),'set':function(_0x371d12){this[_0xbd48('0x10')](_0xbd48('0x25'),_0x371d12?_0x371d12['join'](','):null);},'get':function(){return this[_0xbd48('0x12')]('insecure')?this[_0xbd48('0x12')](_0xbd48('0x25'))[_0xbd48('0x13')](','):null;},'comment':_0xbd48('0x26')},'trustrpid':{'type':Sequelize['ENUM'](_0xbd48('0x23'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xbd48('0x7')](_0xbd48('0x23'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xbd48('0x23'),'no',_0xbd48('0x27'))},'promiscredir':{'type':Sequelize[_0xbd48('0x7')]('yes','no')},'useclientcode':{'type':Sequelize[_0xbd48('0x7')]('yes','no')},'accountcode':{'type':Sequelize[_0xbd48('0x28')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0xbd48('0x29')},'amaflags':{'type':Sequelize[_0xbd48('0x2')]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xbd48('0x28')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0xbd48('0x23'),'no')},'allowsubscribe':{'type':Sequelize[_0xbd48('0x7')](_0xbd48('0x23'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0xbd48('0x23'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xbd48('0x23'),'no')},'subscribecontext':{'type':Sequelize[_0xbd48('0x2')]},'template':{'type':Sequelize[_0xbd48('0x2')]},'videosupport':{'type':Sequelize['ENUM']('yes','no',_0xbd48('0x2a')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xbd48('0x28')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xbd48('0x7')](_0xbd48('0x23'),'no')},'mailbox':{'type':Sequelize[_0xbd48('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0xbd48('0x2b'),_0xbd48('0x2c'),'originate')},'session_expires':{'type':Sequelize[_0xbd48('0x28')](0xb)},'session_minse':{'type':Sequelize[_0xbd48('0x28')](0xb)},'session_refresher':{'type':Sequelize[_0xbd48('0x7')](_0xbd48('0x2d'),_0xbd48('0x2e')),'defaultValue':_0xbd48('0x2e')},'t38pt_usertpsource':{'type':Sequelize[_0xbd48('0x2')]},'regexten':{'type':Sequelize[_0xbd48('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xbd48('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0xbd48('0x7')](_0xbd48('0x23'),'no'),'defaultValue':_0xbd48('0x23')},'keepalive':{'type':Sequelize[_0xbd48('0x28')](0xb)},'defaultip':{'type':Sequelize[_0xbd48('0x2')]},'defaultuser':{'type':Sequelize[_0xbd48('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xbd48('0x28')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xbd48('0x28')](0xb)},'sendrpid':{'type':Sequelize[_0xbd48('0x7')]('yes','no',_0xbd48('0x2f')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xbd48('0x2')]},'callbackextension':{'type':Sequelize[_0xbd48('0x2')]},'timert1':{'type':Sequelize[_0xbd48('0x28')](0xb)},'timerb':{'type':Sequelize[_0xbd48('0x28')](0xb)},'qualifyfreq':{'type':Sequelize[_0xbd48('0x28')](0xb)},'contactpermit':{'type':Sequelize[_0xbd48('0x2')]},'contactdeny':{'type':Sequelize[_0xbd48('0x2')]},'contactacl':{'type':Sequelize[_0xbd48('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xbd48('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xbd48('0x7')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xbd48('0x7')](_0xbd48('0x23'),'no')},'force_avp':{'type':Sequelize[_0xbd48('0x7')](_0xbd48('0x23'),'no')},'icesupport':{'type':Sequelize[_0xbd48('0x7')](_0xbd48('0x23'),'no')},'dtlsenable':{'type':Sequelize[_0xbd48('0x7')](_0xbd48('0x23'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0xbd48('0x23'),'no',_0xbd48('0x30'),_0xbd48('0x31'))},'dtlsrekey':{'type':Sequelize[_0xbd48('0x28')](0xb)},'dtlscertfile':{'type':Sequelize[_0xbd48('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xbd48('0x2')]},'dtlscipher':{'type':Sequelize[_0xbd48('0x2')]},'dtlscafile':{'type':Sequelize[_0xbd48('0x2')]},'dtlscapath':{'type':Sequelize[_0xbd48('0x2')]},'dtlssetup':{'type':Sequelize[_0xbd48('0x7')]('active',_0xbd48('0x32'),_0xbd48('0x33')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xbd48('0x2')]},'usereqphone':{'type':Sequelize[_0xbd48('0x7')](_0xbd48('0x23'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xbd48('0x2')]},'recordofffeature':{'type':Sequelize[_0xbd48('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xbd48('0x23'),'no')},'subscribemwi':{'type':Sequelize[_0xbd48('0x7')](_0xbd48('0x23'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xbd48('0x2')]},'mohsuggest':{'type':Sequelize[_0xbd48('0x2')]},'parkinglot':{'type':Sequelize[_0xbd48('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xbd48('0x2')],'defaultValue':_0xbd48('0x34')},'canreinvite':{'type':Sequelize[_0xbd48('0x7')](_0xbd48('0x23'),'no','nonat',_0xbd48('0x1a'),_0xbd48('0x35')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xbd48('0x36')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xbd48('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index f02accc..a912c4e 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 _0x9c44=['key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','clone','find','omit','createdAt','body','updatedAt','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','params','/etc/asterisk/sip_xcally_registers.conf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','get','Trunks','destroy','stack','name','send','index','Trunk','rawAttributes','fieldName','type'];(function(_0x720f58,_0x51ad3d){var _0x4a7755=function(_0x21db74){while(--_0x21db74){_0x720f58['push'](_0x720f58['shift']());}};_0x4a7755(++_0x51ad3d);}(_0x9c44,0x178));var _0x49c4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9c44[_0xfae23b];return _0x200640;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x16')][_0x49c4('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x5f2fd9,_0x1909fe,_0x280996,_0x21f15a){return new BPromise(function(_0x2decee,_0x12777c){var _0x18211c=_0x21f15a||client;return _0x18211c[_0x49c4('0x18')](_0x5f2fd9,_0x280996)[_0x49c4('0x19')](function(_0x58d177){logger[_0x49c4('0x1a')](_0x49c4('0x1b'),_0x1909fe,_0x49c4('0x1c'));logger[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x1909fe,'request\x20sent',JSON[_0x49c4('0x1f')](_0x58d177));if(_0x58d177[_0x49c4('0x20')]){if(_0x58d177['error']['code']===0x1f4){logger[_0x49c4('0x20')](_0x49c4('0x1b'),_0x1909fe,_0x58d177[_0x49c4('0x20')]['message']);return _0x12777c(_0x58d177[_0x49c4('0x20')]['message']);}logger[_0x49c4('0x20')](_0x49c4('0x1b'),_0x1909fe,_0x58d177[_0x49c4('0x20')][_0x49c4('0x21')]);return _0x2decee(_0x58d177[_0x49c4('0x20')][_0x49c4('0x21')]);}else{logger[_0x49c4('0x1a')](_0x49c4('0x1b'),_0x1909fe,_0x49c4('0x1c'));_0x2decee(_0x58d177['result']['message']);}})['catch'](function(_0x1c99b1){logger['error']('Trunk,\x20%s,\x20%s',_0x1909fe,_0x1c99b1);_0x12777c(_0x1c99b1);});});}function respondWithStatusCode(_0x2263ae,_0x15581b){_0x15581b=_0x15581b||0xcc;return function(_0x26c640){if(_0x26c640){return _0x2263ae[_0x49c4('0x22')](_0x15581b);}return _0x2263ae['status'](_0x15581b)['end']();};}function respondWithResult(_0x180276,_0x9cb797){_0x9cb797=_0x9cb797||0xc8;return function(_0x565423){if(_0x565423){return _0x180276[_0x49c4('0x23')](_0x9cb797)[_0x49c4('0x24')](_0x565423);}};}function respondWithFilteredResult(_0x210159,_0xa7a826){return function(_0x531d92){if(_0x531d92){var _0x543ea2=typeof _0xa7a826[_0x49c4('0x25')]==='undefined'&&typeof _0xa7a826[_0x49c4('0x26')]===_0x49c4('0x27');var _0x3f1708=_0x531d92[_0x49c4('0x28')];var _0x5987ae=_0x543ea2?0x0:_0xa7a826[_0x49c4('0x25')];var _0x2b2793=_0x543ea2?_0x531d92[_0x49c4('0x28')]:_0xa7a826[_0x49c4('0x25')]+_0xa7a826[_0x49c4('0x26')];var _0x29f835;if(_0x2b2793>=_0x3f1708){_0x2b2793=_0x3f1708;_0x29f835=0xc8;}else{_0x29f835=0xce;}_0x210159[_0x49c4('0x23')](_0x29f835);return _0x210159[_0x49c4('0x29')](_0x49c4('0x2a'),_0x5987ae+'-'+_0x2b2793+'/'+_0x3f1708)[_0x49c4('0x24')](_0x531d92);}return null;};}function patchUpdates(_0x46f7ea){return function(_0x4ea6ea){try{jsonpatch['apply'](_0x4ea6ea,_0x46f7ea,!![]);}catch(_0x59eb84){return BPromise[_0x49c4('0x2b')](_0x59eb84);}return _0x4ea6ea[_0x49c4('0x2c')]();};}function saveUpdates(_0x1eb035,_0x27e467){return function(_0x28eb47){if(_0x28eb47){return _0x28eb47['update'](_0x1eb035)[_0x49c4('0x19')](function(_0x116eb4){return _0x116eb4;});}return null;};}function removeEntity(_0x2e7a69,_0x24bba9){return function(_0x58e252){if(_0x58e252){return _0x58e252['destroy']()[_0x49c4('0x19')](function(){var _0x9a1bed=_0x58e252[_0x49c4('0x2d')]({'plain':!![]});var _0x13b3b4=_0x49c4('0x2e');return db['UserProfileResource'][_0x49c4('0x2f')]({'where':{'type':_0x13b3b4,'resourceId':_0x9a1bed['id']}})[_0x49c4('0x19')](function(){return _0x58e252;});})[_0x49c4('0x19')](function(){_0x2e7a69['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x85dce2,_0x1991e9){return function(_0x3bec0a){if(!_0x3bec0a){_0x85dce2[_0x49c4('0x22')](0x194);}return _0x3bec0a;};}function handleError(_0x2b45a1,_0x2cf897){_0x2cf897=_0x2cf897||0x1f4;return function(_0x1d1557){logger[_0x49c4('0x20')](_0x1d1557[_0x49c4('0x30')]);if(_0x1d1557['name']){delete _0x1d1557[_0x49c4('0x31')];}_0x2b45a1['status'](_0x2cf897)[_0x49c4('0x32')](_0x1d1557);};}exports[_0x49c4('0x33')]=function(_0x2625a6,_0x1c2830){var _0x4ed4f8={},_0x335f0c={},_0x31f3ff={'count':0x0,'rows':[]};var _0x1c910a=_['map'](db[_0x49c4('0x34')][_0x49c4('0x35')],function(_0x178987){return{'name':_0x178987[_0x49c4('0x36')],'type':_0x178987[_0x49c4('0x37')][_0x49c4('0x38')]};});_0x335f0c[_0x49c4('0x39')]=_[_0x49c4('0x3a')](_0x1c910a,_0x49c4('0x31'));_0x335f0c[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2625a6['query']);_0x335f0c[_0x49c4('0x3d')]=_[_0x49c4('0x3e')](_0x335f0c[_0x49c4('0x39')],_0x335f0c[_0x49c4('0x3b')]);_0x4ed4f8[_0x49c4('0x3f')]=_[_0x49c4('0x3e')](_0x335f0c[_0x49c4('0x39')],qs[_0x49c4('0x40')](_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x40')]));_0x4ed4f8[_0x49c4('0x3f')]=_0x4ed4f8[_0x49c4('0x3f')][_0x49c4('0x41')]?_0x4ed4f8['attributes']:_0x335f0c[_0x49c4('0x39')];if(!_0x2625a6['query'][_0x49c4('0x42')](_0x49c4('0x43'))){_0x4ed4f8[_0x49c4('0x26')]=qs[_0x49c4('0x26')](_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x26')]);_0x4ed4f8['offset']=qs['offset'](_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x25')]);}_0x4ed4f8[_0x49c4('0x44')]=qs[_0x49c4('0x45')](_0x2625a6['query'][_0x49c4('0x45')]);_0x4ed4f8[_0x49c4('0x46')]=qs[_0x49c4('0x3d')](_[_0x49c4('0x47')](_0x2625a6[_0x49c4('0x3b')],_0x335f0c[_0x49c4('0x3d')]),_0x1c910a);if(_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x48')]){_0x4ed4f8[_0x49c4('0x46')]=_['merge'](_0x4ed4f8[_0x49c4('0x46')],{'$or':_['map'](_0x1c910a,function(_0x33696e){if(_0x33696e[_0x49c4('0x37')]!==_0x49c4('0x49')){var _0x258abe={};_0x258abe[_0x33696e[_0x49c4('0x31')]]={'$like':'%'+_0x2625a6['query'][_0x49c4('0x48')]+'%'};return _0x258abe;}})});}_0x4ed4f8=_[_0x49c4('0x4a')]({},_0x4ed4f8,_0x2625a6[_0x49c4('0x4b')]);var _0x254d07={'where':_0x4ed4f8[_0x49c4('0x46')]};return db[_0x49c4('0x34')][_0x49c4('0x28')](_0x254d07)['then'](function(_0x3bac1b){_0x31f3ff['count']=_0x3bac1b;if(_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x4c')]){_0x4ed4f8[_0x49c4('0x4d')]=[{'all':!![]}];}return db[_0x49c4('0x34')][_0x49c4('0x4e')](_0x4ed4f8);})[_0x49c4('0x19')](function(_0x2c6be1){_0x31f3ff['rows']=_0x2c6be1;return _0x31f3ff;})[_0x49c4('0x19')](respondWithFilteredResult(_0x1c2830,_0x4ed4f8))[_0x49c4('0x4f')](handleError(_0x1c2830,null));};exports['show']=function(_0x1e1ac4,_0xaece5f){var _0xfbe179={'raw':![],'where':{'id':_0x1e1ac4['params']['id']}},_0x242afc={};_0x242afc['model']=_[_0x49c4('0x3c')](db['Trunk'][_0x49c4('0x35')]);_0x242afc[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x1e1ac4[_0x49c4('0x3b')]);_0x242afc[_0x49c4('0x3d')]=_[_0x49c4('0x3e')](_0x242afc[_0x49c4('0x39')],_0x242afc['query']);_0xfbe179[_0x49c4('0x3f')]=_[_0x49c4('0x3e')](_0x242afc[_0x49c4('0x39')],qs[_0x49c4('0x40')](_0x1e1ac4[_0x49c4('0x3b')][_0x49c4('0x40')]));_0xfbe179[_0x49c4('0x3f')]=_0xfbe179[_0x49c4('0x3f')][_0x49c4('0x41')]?_0xfbe179[_0x49c4('0x3f')]:_0x242afc['model'];if(_0x1e1ac4['query'][_0x49c4('0x4c')]){_0xfbe179[_0x49c4('0x4d')]=[{'all':!![]}];}_0xfbe179=_['merge']({},_0xfbe179,_0x1e1ac4['options']);return db[_0x49c4('0x34')]['find'](_0xfbe179)['then'](handleEntityNotFound(_0xaece5f,null))[_0x49c4('0x19')](respondWithResult(_0xaece5f,null))[_0x49c4('0x4f')](handleError(_0xaece5f,null));};exports[_0x49c4('0x50')]=function(_0x38c480,_0x2884ca){var _0x16949a={'where':{'id':_0x38c480['params']['id']}},_0x35724e={};_0x35724e[_0x49c4('0x39')]=_[_0x49c4('0x3c')](db[_0x49c4('0x34')][_0x49c4('0x35')]);_0x16949a[_0x49c4('0x3f')]=_[_0x49c4('0x3e')](_0x35724e['model'],qs['fields'](_0x38c480[_0x49c4('0x3b')][_0x49c4('0x40')]));_0x16949a[_0x49c4('0x3f')]=_0x16949a[_0x49c4('0x3f')][_0x49c4('0x41')]?_0x16949a[_0x49c4('0x3f')]:_0x35724e[_0x49c4('0x39')];if(_0x38c480['query'][_0x49c4('0x4c')]){_0x16949a[_0x49c4('0x4d')]=[{'all':!![]}];}_0x16949a=_['merge']({},_0x16949a,_0x38c480[_0x49c4('0x4b')]);return db['Trunk'][_0x49c4('0x51')](_0x16949a)[_0x49c4('0x19')](handleEntityNotFound(_0x2884ca,null))[_0x49c4('0x19')](function(_0x2fe89a){if(_0x2fe89a){var _0x845f7e=_0x2fe89a[_0x49c4('0x2d')]({'plain':!![]});_0x845f7e=qs[_0x49c4('0x52')](_0x845f7e,['id',_0x49c4('0x53'),'updatedAt']);_0x38c480[_0x49c4('0x54')]=_[_0x49c4('0x52')](_0x38c480['body'],['id',_0x49c4('0x53'),_0x49c4('0x55')]);return db['Trunk'][_0x49c4('0x56')](_[_0x49c4('0x4a')](_0x845f7e,_0x38c480['body']),{'include':_0x38c480['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0xc43386){var _0x54947d=_0x38c480[_0x49c4('0x57')][_0x49c4('0x2d')]({'plain':!![]});if(!_0x54947d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x54947d[_0x49c4('0x58')]===_0x49c4('0x57')){var _0x5ac9f0=_0xc43386[_0x49c4('0x2d')]({'plain':!![]});var _0x3dcf4c=_0x49c4('0x2e');return db[_0x49c4('0x59')]['find']({'where':{'name':_0x3dcf4c,'userProfileId':_0x54947d[_0x49c4('0x5a')]},'raw':!![]})[_0x49c4('0x19')](function(_0x3cc604){if(_0x3cc604&&_0x3cc604[_0x49c4('0x5b')]===0x0){return db['UserProfileResource'][_0x49c4('0x56')]({'name':_0x5ac9f0['name'],'resourceId':_0x5ac9f0['id'],'type':_0x3cc604['name'],'sectionId':_0x3cc604['id']},{})['then'](function(){return _0xc43386;});}else{return _0xc43386;}})['catch'](function(_0x302251){logger[_0x49c4('0x20')](_0x49c4('0x5c'),_0x302251);throw _0x302251;});}return _0xc43386;});}})[_0x49c4('0x19')](respondWithResult(_0x2884ca,0xc9))['catch'](handleError(_0x2884ca,null));};exports['create']=function(_0x340523,_0x109b81,_0x342326){var _0x295ad0;return db[_0x49c4('0x34')][_0x49c4('0x56')](_0x340523[_0x49c4('0x54')],{'raw':!![]})[_0x49c4('0x19')](function(_0x4d49e0){_0x295ad0=_0x4d49e0;return db[_0x49c4('0x34')]['findAll']({'raw':!![]});})[_0x49c4('0x19')](function(_0x264902){var _0x1a5d4c=fs[_0x49c4('0x5d')](path[_0x49c4('0x5e')](config[_0x49c4('0x5f')],_0x49c4('0x60')),_0x49c4('0x61'));var _0x13d951=fs[_0x49c4('0x5d')](path[_0x49c4('0x5e')](config[_0x49c4('0x5f')],_0x49c4('0x62')),_0x49c4('0x61'));var _0x2d5f63=ejs[_0x49c4('0x63')](_0x1a5d4c,{'trunks':_0x264902||[]});fs[_0x49c4('0x64')](_0x49c4('0x65'),_0x2d5f63);if(_0x295ad0['registry']){var _0x5ec201=ejs[_0x49c4('0x63')](_0x13d951,{'trunks':_0x264902||[]});fs[_0x49c4('0x64')]('/etc/asterisk/sip_xcally_registers.conf',_0x5ec201);}})[_0x49c4('0x19')](function(){return respondWithRpcPromise(_0x49c4('0x66'),_0x49c4('0x56'),{'module':_0x49c4('0x67')});})['then'](function(){var _0x5a14a5=_0x340523['user'][_0x49c4('0x2d')]({'plain':!![]});if(!_0x5a14a5)throw new Error(_0x49c4('0x68'));if(_0x5a14a5[_0x49c4('0x58')]===_0x49c4('0x57')){var _0x118fc4=_0x295ad0[_0x49c4('0x2d')]({'plain':!![]});return db[_0x49c4('0x59')][_0x49c4('0x51')]({'where':{'name':_0x49c4('0x2e'),'userProfileId':_0x5a14a5['userProfileId']},'raw':!![]})[_0x49c4('0x19')](function(_0x10fb84){if(_0x10fb84&&_0x10fb84[_0x49c4('0x5b')]===0x0){return db['UserProfileResource'][_0x49c4('0x56')]({'name':_0x118fc4[_0x49c4('0x31')],'resourceId':_0x118fc4['id'],'type':_0x10fb84[_0x49c4('0x31')],'sectionId':_0x10fb84['id']},{})[_0x49c4('0x19')](function(){return _0x295ad0;});}else{return _0x295ad0;}})[_0x49c4('0x4f')](function(_0x2fd749){logger[_0x49c4('0x20')](_0x49c4('0x5c'),_0x2fd749);throw _0x2fd749;});}return _0x295ad0;})['then'](respondWithResult(_0x109b81,0xc9))[_0x49c4('0x4f')](handleError(_0x109b81,null));};exports[_0x49c4('0x69')]=function(_0x85540f,_0x18e82b,_0x1e948a){var _0x4a204d;return db['Trunk'][_0x49c4('0x51')]({'where':{'id':_0x85540f['params']['id']}})[_0x49c4('0x19')](handleEntityNotFound(_0x18e82b,null))['then'](saveUpdates(_0x85540f[_0x49c4('0x54')],null))[_0x49c4('0x19')](function(_0x3b03dd){if(_0x3b03dd){_0x4a204d=_0x3b03dd;return db[_0x49c4('0x34')]['findAll']({'raw':!![]});}})[_0x49c4('0x19')](function(_0x38d7d3){if(_0x38d7d3){var _0x2ceada=fs[_0x49c4('0x5d')](path[_0x49c4('0x5e')](config[_0x49c4('0x5f')],_0x49c4('0x60')),_0x49c4('0x61'));var _0x46477f=fs[_0x49c4('0x5d')](path['join'](config[_0x49c4('0x5f')],_0x49c4('0x62')),'utf8');var _0x15bee0=ejs['render'](_0x2ceada,{'trunks':_0x38d7d3||[]});fs[_0x49c4('0x64')](_0x49c4('0x65'),_0x15bee0);var _0x1f14a6=ejs[_0x49c4('0x63')](_0x46477f,{'trunks':_0x38d7d3||[]});fs[_0x49c4('0x64')]('/etc/asterisk/sip_xcally_registers.conf',_0x1f14a6);return respondWithRpcPromise(_0x49c4('0x66'),_0x49c4('0x69'),{'module':'chan_sip.so'});}return null;})[_0x49c4('0x19')](function(_0x167e41){if(_0x167e41){return _0x4a204d;}})['then'](respondWithResult(_0x18e82b,null))[_0x49c4('0x4f')](handleError(_0x18e82b,null));};exports[_0x49c4('0x2f')]=function(_0x57b137,_0x37fef1,_0x993d00){var _0x25989a;return db[_0x49c4('0x34')]['find']({'where':{'id':_0x57b137[_0x49c4('0x6a')]['id']}})[_0x49c4('0x19')](handleEntityNotFound(_0x37fef1,null))['then'](removeEntity(_0x37fef1,null))[_0x49c4('0x19')](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0x49c4('0x19')](function(_0x507078){var _0x50fd24=fs[_0x49c4('0x5d')](path[_0x49c4('0x5e')](config['root'],_0x49c4('0x60')),'utf8');var _0x578f4b=fs['readFileSync'](path[_0x49c4('0x5e')](config[_0x49c4('0x5f')],_0x49c4('0x62')),_0x49c4('0x61'));var _0x4a5f0b=ejs['render'](_0x50fd24,{'trunks':_0x507078});var _0x348693=ejs['render'](_0x578f4b,{'trunks':_0x507078});fs[_0x49c4('0x64')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4a5f0b);fs[_0x49c4('0x64')](_0x49c4('0x6b'),_0x348693);return respondWithRpcPromise(_0x49c4('0x66'),_0x49c4('0x2f'),{'module':_0x49c4('0x67')});})[_0x49c4('0x4f')](handleError(_0x37fef1,null));}; \ No newline at end of file +var _0x9bde=['fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','get','Trunks','UserProfileResource','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','offset','order','sort','where','pick','filter','VIRTUAL','merge','Trunk','includeAll','findAll','rows','show','params','fields','include','options','clone','find','omit','createdAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/registry.ejs','utf8','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','root','server/files/templates/trunk.ejs','writeFileSync','rimraf'];(function(_0x53f122,_0x2cdeca){var _0x59a134=function(_0x41468d){while(--_0x41468d){_0x53f122['push'](_0x53f122['shift']());}};_0x59a134(++_0x2cdeca);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1aaa6d,_0x3e8767){_0x1aaa6d=_0x1aaa6d-0x0;var _0x1386b2=_0x9bde[_0x1aaa6d];return _0x1386b2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe9bd('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x220d07,_0x429e88,_0x3435b4,_0x51109f){return new BPromise(function(_0x47ba5e,_0x46a95e){var _0x248818=_0x51109f||client;return _0x248818[_0xe9bd('0x1a')](_0x220d07,_0x3435b4)[_0xe9bd('0x1b')](function(_0x3360bd){logger[_0xe9bd('0x1c')](_0xe9bd('0x1d'),_0x429e88,'request\x20sent');logger[_0xe9bd('0x1e')](_0xe9bd('0x1f'),_0x429e88,_0xe9bd('0x20'),JSON['stringify'](_0x3360bd));if(_0x3360bd[_0xe9bd('0x21')]){if(_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x22')]===0x1f4){logger[_0xe9bd('0x21')]('Trunk,\x20%s,\x20%s',_0x429e88,_0x3360bd[_0xe9bd('0x21')]['message']);return _0x46a95e(_0x3360bd[_0xe9bd('0x21')]['message']);}logger[_0xe9bd('0x21')](_0xe9bd('0x1d'),_0x429e88,_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x23')]);return _0x47ba5e(_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x23')]);}else{logger[_0xe9bd('0x1c')]('Trunk,\x20%s,\x20%s',_0x429e88,_0xe9bd('0x20'));_0x47ba5e(_0x3360bd[_0xe9bd('0x24')]['message']);}})[_0xe9bd('0x25')](function(_0x505c23){logger[_0xe9bd('0x21')](_0xe9bd('0x1d'),_0x429e88,_0x505c23);_0x46a95e(_0x505c23);});});}function respondWithStatusCode(_0x36f8c0,_0xf02209){_0xf02209=_0xf02209||0xcc;return function(_0x5bc4bf){if(_0x5bc4bf){return _0x36f8c0[_0xe9bd('0x26')](_0xf02209);}return _0x36f8c0[_0xe9bd('0x27')](_0xf02209)[_0xe9bd('0x28')]();};}function respondWithResult(_0x39b206,_0x2641be){_0x2641be=_0x2641be||0xc8;return function(_0xb52d45){if(_0xb52d45){return _0x39b206[_0xe9bd('0x27')](_0x2641be)[_0xe9bd('0x29')](_0xb52d45);}};}function respondWithFilteredResult(_0x1ae889,_0x5987af){return function(_0x3c211a){if(_0x3c211a){var _0x38fdfa=typeof _0x5987af['offset']===_0xe9bd('0x2a')&&typeof _0x5987af[_0xe9bd('0x2b')]===_0xe9bd('0x2a');var _0x429055=_0x3c211a[_0xe9bd('0x2c')];var _0x183601=_0x38fdfa?0x0:_0x5987af['offset'];var _0x5b7f1d=_0x38fdfa?_0x3c211a[_0xe9bd('0x2c')]:_0x5987af['offset']+_0x5987af[_0xe9bd('0x2b')];var _0x1f2c0e;if(_0x5b7f1d>=_0x429055){_0x5b7f1d=_0x429055;_0x1f2c0e=0xc8;}else{_0x1f2c0e=0xce;}_0x1ae889[_0xe9bd('0x27')](_0x1f2c0e);return _0x1ae889[_0xe9bd('0x2d')](_0xe9bd('0x2e'),_0x183601+'-'+_0x5b7f1d+'/'+_0x429055)['json'](_0x3c211a);}return null;};}function patchUpdates(_0x4b7bc2){return function(_0x7f2c5){try{jsonpatch[_0xe9bd('0x2f')](_0x7f2c5,_0x4b7bc2,!![]);}catch(_0x3f96a0){return BPromise[_0xe9bd('0x30')](_0x3f96a0);}return _0x7f2c5[_0xe9bd('0x31')]();};}function saveUpdates(_0x1f0f9e,_0x3c31ee){return function(_0x66213a){if(_0x66213a){return _0x66213a[_0xe9bd('0x32')](_0x1f0f9e)['then'](function(_0x426004){return _0x426004;});}return null;};}function removeEntity(_0x81a31f,_0x390a43){return function(_0x5117bc){if(_0x5117bc){return _0x5117bc['destroy']()[_0xe9bd('0x1b')](function(){var _0x2e9593=_0x5117bc[_0xe9bd('0x33')]({'plain':!![]});var _0x3ed60a=_0xe9bd('0x34');return db[_0xe9bd('0x35')][_0xe9bd('0x36')]({'where':{'type':_0x3ed60a,'resourceId':_0x2e9593['id']}})[_0xe9bd('0x1b')](function(){return _0x5117bc;});})[_0xe9bd('0x1b')](function(){_0x81a31f[_0xe9bd('0x27')](0xcc)[_0xe9bd('0x28')]();});}};}function handleEntityNotFound(_0x549dd1,_0x2ad46e){return function(_0x199477){if(!_0x199477){_0x549dd1[_0xe9bd('0x26')](0x194);}return _0x199477;};}function handleError(_0x8ff624,_0x264ba0){_0x264ba0=_0x264ba0||0x1f4;return function(_0x147da5){logger['error'](_0x147da5[_0xe9bd('0x37')]);if(_0x147da5[_0xe9bd('0x38')]){delete _0x147da5['name'];}_0x8ff624[_0xe9bd('0x27')](_0x264ba0)[_0xe9bd('0x39')](_0x147da5);};}exports['index']=function(_0x4b1da0,_0x2785e6){var _0xdf43b9={},_0x4d2f3d={},_0x2d1289={'count':0x0,'rows':[]};var _0x3ea705=_[_0xe9bd('0x3a')](db['Trunk'][_0xe9bd('0x3b')],function(_0x4d1945){return{'name':_0x4d1945[_0xe9bd('0x3c')],'type':_0x4d1945[_0xe9bd('0x3d')][_0xe9bd('0x3e')]};});_0x4d2f3d[_0xe9bd('0x3f')]=_['map'](_0x3ea705,_0xe9bd('0x38'));_0x4d2f3d[_0xe9bd('0x40')]=_[_0xe9bd('0x41')](_0x4b1da0[_0xe9bd('0x40')]);_0x4d2f3d[_0xe9bd('0x42')]=_[_0xe9bd('0x43')](_0x4d2f3d[_0xe9bd('0x3f')],_0x4d2f3d[_0xe9bd('0x40')]);_0xdf43b9[_0xe9bd('0x44')]=_[_0xe9bd('0x43')](_0x4d2f3d['model'],qs['fields'](_0x4b1da0[_0xe9bd('0x40')]['fields']));_0xdf43b9[_0xe9bd('0x44')]=_0xdf43b9[_0xe9bd('0x44')][_0xe9bd('0x45')]?_0xdf43b9['attributes']:_0x4d2f3d[_0xe9bd('0x3f')];if(!_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x46')]('nolimit')){_0xdf43b9[_0xe9bd('0x2b')]=qs[_0xe9bd('0x2b')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x2b')]);_0xdf43b9[_0xe9bd('0x47')]=qs[_0xe9bd('0x47')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x47')]);}_0xdf43b9[_0xe9bd('0x48')]=qs[_0xe9bd('0x49')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x49')]);_0xdf43b9[_0xe9bd('0x4a')]=qs[_0xe9bd('0x42')](_[_0xe9bd('0x4b')](_0x4b1da0['query'],_0x4d2f3d['filters']),_0x3ea705);if(_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x4c')]){_0xdf43b9[_0xe9bd('0x4a')]=_['merge'](_0xdf43b9['where'],{'$or':_[_0xe9bd('0x3a')](_0x3ea705,function(_0x3f6f22){if(_0x3f6f22[_0xe9bd('0x3d')]!==_0xe9bd('0x4d')){var _0x39fb61={};_0x39fb61[_0x3f6f22[_0xe9bd('0x38')]]={'$like':'%'+_0x4b1da0[_0xe9bd('0x40')]['filter']+'%'};return _0x39fb61;}})});}_0xdf43b9=_[_0xe9bd('0x4e')]({},_0xdf43b9,_0x4b1da0['options']);var _0x36726e={'where':_0xdf43b9[_0xe9bd('0x4a')]};return db[_0xe9bd('0x4f')][_0xe9bd('0x2c')](_0x36726e)[_0xe9bd('0x1b')](function(_0x4b7b67){_0x2d1289[_0xe9bd('0x2c')]=_0x4b7b67;if(_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x50')]){_0xdf43b9['include']=[{'all':!![]}];}return db[_0xe9bd('0x4f')][_0xe9bd('0x51')](_0xdf43b9);})[_0xe9bd('0x1b')](function(_0x5a466b){_0x2d1289[_0xe9bd('0x52')]=_0x5a466b;return _0x2d1289;})[_0xe9bd('0x1b')](respondWithFilteredResult(_0x2785e6,_0xdf43b9))[_0xe9bd('0x25')](handleError(_0x2785e6,null));};exports[_0xe9bd('0x53')]=function(_0x1ee09c,_0x579d26){var _0x3f4833={'raw':![],'where':{'id':_0x1ee09c[_0xe9bd('0x54')]['id']}},_0x4b8ff9={};_0x4b8ff9[_0xe9bd('0x3f')]=_[_0xe9bd('0x41')](db[_0xe9bd('0x4f')][_0xe9bd('0x3b')]);_0x4b8ff9['query']=_[_0xe9bd('0x41')](_0x1ee09c['query']);_0x4b8ff9[_0xe9bd('0x42')]=_[_0xe9bd('0x43')](_0x4b8ff9['model'],_0x4b8ff9['query']);_0x3f4833[_0xe9bd('0x44')]=_['intersection'](_0x4b8ff9[_0xe9bd('0x3f')],qs['fields'](_0x1ee09c[_0xe9bd('0x40')][_0xe9bd('0x55')]));_0x3f4833['attributes']=_0x3f4833[_0xe9bd('0x44')]['length']?_0x3f4833[_0xe9bd('0x44')]:_0x4b8ff9[_0xe9bd('0x3f')];if(_0x1ee09c[_0xe9bd('0x40')]['includeAll']){_0x3f4833[_0xe9bd('0x56')]=[{'all':!![]}];}_0x3f4833=_[_0xe9bd('0x4e')]({},_0x3f4833,_0x1ee09c[_0xe9bd('0x57')]);return db[_0xe9bd('0x4f')]['find'](_0x3f4833)['then'](handleEntityNotFound(_0x579d26,null))[_0xe9bd('0x1b')](respondWithResult(_0x579d26,null))['catch'](handleError(_0x579d26,null));};exports[_0xe9bd('0x58')]=function(_0x3c33b8,_0xc7dd2f){var _0xc818b4={'where':{'id':_0x3c33b8[_0xe9bd('0x54')]['id']}},_0x159f68={};_0x159f68[_0xe9bd('0x3f')]=_[_0xe9bd('0x41')](db[_0xe9bd('0x4f')][_0xe9bd('0x3b')]);_0xc818b4[_0xe9bd('0x44')]=_[_0xe9bd('0x43')](_0x159f68['model'],qs['fields'](_0x3c33b8['query'][_0xe9bd('0x55')]));_0xc818b4['attributes']=_0xc818b4[_0xe9bd('0x44')][_0xe9bd('0x45')]?_0xc818b4[_0xe9bd('0x44')]:_0x159f68[_0xe9bd('0x3f')];if(_0x3c33b8[_0xe9bd('0x40')][_0xe9bd('0x50')]){_0xc818b4[_0xe9bd('0x56')]=[{'all':!![]}];}_0xc818b4=_[_0xe9bd('0x4e')]({},_0xc818b4,_0x3c33b8[_0xe9bd('0x57')]);return db['Trunk'][_0xe9bd('0x59')](_0xc818b4)[_0xe9bd('0x1b')](handleEntityNotFound(_0xc7dd2f,null))[_0xe9bd('0x1b')](function(_0x3f848d){if(_0x3f848d){var _0x4d58c1=_0x3f848d[_0xe9bd('0x33')]({'plain':!![]});_0x4d58c1=qs[_0xe9bd('0x5a')](_0x4d58c1,['id',_0xe9bd('0x5b'),'updatedAt']);_0x3c33b8[_0xe9bd('0x5c')]=_[_0xe9bd('0x5a')](_0x3c33b8[_0xe9bd('0x5c')],['id',_0xe9bd('0x5b'),'updatedAt']);return db['Trunk'][_0xe9bd('0x5d')](_[_0xe9bd('0x4e')](_0x4d58c1,_0x3c33b8[_0xe9bd('0x5c')]),{'include':_0x3c33b8[_0xe9bd('0x40')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x305efa){var _0x20855b=_0x3c33b8[_0xe9bd('0x5e')][_0xe9bd('0x33')]({'plain':!![]});if(!_0x20855b)throw new Error(_0xe9bd('0x5f'));if(_0x20855b[_0xe9bd('0x60')]==='user'){var _0x179c8d=_0x305efa['get']({'plain':!![]});var _0x27e07c=_0xe9bd('0x34');return db[_0xe9bd('0x61')][_0xe9bd('0x59')]({'where':{'name':_0x27e07c,'userProfileId':_0x20855b['userProfileId']},'raw':!![]})[_0xe9bd('0x1b')](function(_0x263ad9){if(_0x263ad9&&_0x263ad9[_0xe9bd('0x62')]===0x0){return db['UserProfileResource'][_0xe9bd('0x5d')]({'name':_0x179c8d[_0xe9bd('0x38')],'resourceId':_0x179c8d['id'],'type':_0x263ad9[_0xe9bd('0x38')],'sectionId':_0x263ad9['id']},{})[_0xe9bd('0x1b')](function(){return _0x305efa;});}else{return _0x305efa;}})[_0xe9bd('0x25')](function(_0x16b66c){logger[_0xe9bd('0x21')](_0xe9bd('0x63'),_0x16b66c);throw _0x16b66c;});}return _0x305efa;});}})[_0xe9bd('0x1b')](respondWithResult(_0xc7dd2f,0xc9))[_0xe9bd('0x25')](handleError(_0xc7dd2f,null));};exports[_0xe9bd('0x5d')]=function(_0x37d07a,_0x5d1e4b,_0x3a12e9){var _0x9d0603;return db['Trunk'][_0xe9bd('0x5d')](_0x37d07a[_0xe9bd('0x5c')],{'raw':!![]})['then'](function(_0x561165){_0x9d0603=_0x561165;return db[_0xe9bd('0x4f')][_0xe9bd('0x51')]({'raw':!![]});})['then'](function(_0x4ec8be){var _0x4a6422=fs[_0xe9bd('0x64')](path['join'](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x1fc88d=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config['root'],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x337284=ejs[_0xe9bd('0x68')](_0x4a6422,{'trunks':_0x4ec8be||[]});fs['writeFileSync'](_0xe9bd('0x69'),_0x337284);if(_0x9d0603[_0xe9bd('0x6a')]){var _0x11ebcb=ejs['render'](_0x1fc88d,{'trunks':_0x4ec8be||[]});fs['writeFileSync'](_0xe9bd('0x6b'),_0x11ebcb);}})[_0xe9bd('0x1b')](function(){return respondWithRpcPromise(_0xe9bd('0x6c'),_0xe9bd('0x5d'),{'module':_0xe9bd('0x6d')});})[_0xe9bd('0x1b')](function(){var _0x3fda4c=_0x37d07a[_0xe9bd('0x5e')]['get']({'plain':!![]});if(!_0x3fda4c)throw new Error(_0xe9bd('0x5f'));if(_0x3fda4c[_0xe9bd('0x60')]===_0xe9bd('0x5e')){var _0x3db47a=_0x9d0603[_0xe9bd('0x33')]({'plain':!![]});return db['UserProfileSection'][_0xe9bd('0x59')]({'where':{'name':'Trunks','userProfileId':_0x3fda4c['userProfileId']},'raw':!![]})[_0xe9bd('0x1b')](function(_0x4496e3){if(_0x4496e3&&_0x4496e3['autoAssociation']===0x0){return db[_0xe9bd('0x35')][_0xe9bd('0x5d')]({'name':_0x3db47a[_0xe9bd('0x38')],'resourceId':_0x3db47a['id'],'type':_0x4496e3[_0xe9bd('0x38')],'sectionId':_0x4496e3['id']},{})['then'](function(){return _0x9d0603;});}else{return _0x9d0603;}})[_0xe9bd('0x25')](function(_0x41fb41){logger['error'](_0xe9bd('0x63'),_0x41fb41);throw _0x41fb41;});}return _0x9d0603;})[_0xe9bd('0x1b')](respondWithResult(_0x5d1e4b,0xc9))[_0xe9bd('0x25')](handleError(_0x5d1e4b,null));};exports[_0xe9bd('0x32')]=function(_0x2e63c7,_0x1a36aa,_0x466a89){var _0x5e127b;return db[_0xe9bd('0x4f')][_0xe9bd('0x59')]({'where':{'id':_0x2e63c7[_0xe9bd('0x54')]['id']}})[_0xe9bd('0x1b')](handleEntityNotFound(_0x1a36aa,null))[_0xe9bd('0x1b')](saveUpdates(_0x2e63c7[_0xe9bd('0x5c')],null))[_0xe9bd('0x1b')](function(_0x2adc49){if(_0x2adc49){_0x5e127b=_0x2adc49;return db[_0xe9bd('0x4f')]['findAll']({'raw':!![]});}})[_0xe9bd('0x1b')](function(_0x466952){if(_0x466952){var _0x256890=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config[_0xe9bd('0x6e')],_0xe9bd('0x6f')),'utf8');var _0x18519d=fs[_0xe9bd('0x64')](path['join'](config[_0xe9bd('0x6e')],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x2083c4=ejs[_0xe9bd('0x68')](_0x256890,{'trunks':_0x466952||[]});fs[_0xe9bd('0x70')](_0xe9bd('0x69'),_0x2083c4);var _0x4f3dc6=ejs['render'](_0x18519d,{'trunks':_0x466952||[]});fs[_0xe9bd('0x70')](_0xe9bd('0x6b'),_0x4f3dc6);return respondWithRpcPromise(_0xe9bd('0x6c'),_0xe9bd('0x32'),{'module':_0xe9bd('0x6d')});}return null;})[_0xe9bd('0x1b')](function(_0x1b46f4){if(_0x1b46f4){return _0x5e127b;}})['then'](respondWithResult(_0x1a36aa,null))[_0xe9bd('0x25')](handleError(_0x1a36aa,null));};exports[_0xe9bd('0x36')]=function(_0x29833b,_0x256862,_0x14cdd5){var _0x74063;return db[_0xe9bd('0x4f')]['find']({'where':{'id':_0x29833b['params']['id']}})['then'](handleEntityNotFound(_0x256862,null))[_0xe9bd('0x1b')](removeEntity(_0x256862,null))['then'](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0xe9bd('0x1b')](function(_0x402ab2){var _0xf170d4=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config[_0xe9bd('0x6e')],_0xe9bd('0x6f')),_0xe9bd('0x67'));var _0x14ec42=fs['readFileSync'](path[_0xe9bd('0x65')](config['root'],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x22c67f=ejs[_0xe9bd('0x68')](_0xf170d4,{'trunks':_0x402ab2});var _0x416938=ejs['render'](_0x14ec42,{'trunks':_0x402ab2});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x22c67f);fs[_0xe9bd('0x70')](_0xe9bd('0x6b'),_0x416938);return respondWithRpcPromise('Reload',_0xe9bd('0x36'),{'module':_0xe9bd('0x6d')});})[_0xe9bd('0x25')](handleError(_0x256862,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 4fa05c7..1d49c69 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 _0xd3e1=['request-promise','path','rimraf','../../config/environment','lodash','util','../../config/logger','api','moment'];(function(_0x10620,_0x423d1c){var _0x5ed94f=function(_0x15fb08){while(--_0x15fb08){_0x10620['push'](_0x10620['shift']());}};_0x5ed94f(++_0x423d1c);}(_0xd3e1,0xee));var _0x1d3e=function(_0x40017b,_0x29ae62){_0x40017b=_0x40017b-0x0;var _0x41d9fa=_0xd3e1[_0x40017b];return _0x41d9fa;};'use strict';var _=require(_0x1d3e('0x0'));var util=require(_0x1d3e('0x1'));var logger=require(_0x1d3e('0x2'))(_0x1d3e('0x3'));var moment=require(_0x1d3e('0x4'));var BPromise=require('bluebird');var rp=require(_0x1d3e('0x5'));var fs=require('fs');var path=require(_0x1d3e('0x6'));var rimraf=require(_0x1d3e('0x7'));var config=require(_0x1d3e('0x8'));var attributes=require('./trunk.attributes');module['exports']=function(_0x284d4b,_0x469860){return _0x284d4b['define']('Trunk',attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b2d=['./trunk.attributes','define','Trunk','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1fb6e2,_0x3a22ce){var _0x354690=function(_0x51f968){while(--_0x51f968){_0x1fb6e2['push'](_0x1fb6e2['shift']());}};_0x354690(++_0x3a22ce);}(_0x0b2d,0xe9));var _0xd0b2=function(_0x23e139,_0x986e53){_0x23e139=_0x23e139-0x0;var _0x291ba1=_0x0b2d[_0x23e139];return _0x291ba1;};'use strict';var _=require('lodash');var util=require(_0xd0b2('0x0'));var logger=require('../../config/logger')(_0xd0b2('0x1'));var moment=require(_0xd0b2('0x2'));var BPromise=require(_0xd0b2('0x3'));var rp=require(_0xd0b2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd0b2('0x5'));var config=require(_0xd0b2('0x6'));var attributes=require(_0xd0b2('0x7'));module['exports']=function(_0x1221c1,_0x1b305f){return _0x1221c1[_0xd0b2('0x8')](_0xd0b2('0x9'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 28d6acc..771aa42 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 _0xfa2d=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','GetTrunk','Trunk','findAll','options','raw','include','map','attributes','debug','catch','ShowTrunk','find','where','model','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x2a34a2,_0x4fb88f){var _0x46eae5=function(_0x4a3231){while(--_0x4a3231){_0x2a34a2['push'](_0x2a34a2['shift']());}};_0x46eae5(++_0x4fb88f);}(_0xfa2d,0x8e));var _0xdfa2=function(_0x33d04e,_0xf90b00){_0x33d04e=_0x33d04e-0x0;var _0x2f3b66=_0xfa2d[_0x33d04e];return _0x2f3b66;};'use strict';var _=require(_0xdfa2('0x0'));var util=require(_0xdfa2('0x1'));var moment=require(_0xdfa2('0x2'));var BPromise=require(_0xdfa2('0x3'));var rs=require(_0xdfa2('0x4'));var fs=require('fs');var Redis=require(_0xdfa2('0x5'));var db=require(_0xdfa2('0x6'))['db'];var utils=require(_0xdfa2('0x7'));var logger=require(_0xdfa2('0x8'))(_0xdfa2('0x9'));var config=require('../../config/environment');var jayson=require(_0xdfa2('0xa'));var client=jayson[_0xdfa2('0xb')][_0xdfa2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4dd353,_0x5cabbc,_0x5dac9f){return new BPromise(function(_0xa332e8,_0x3962fe){return client[_0xdfa2('0xd')](_0x4dd353,_0x5dac9f)[_0xdfa2('0xe')](function(_0x589e5a){logger[_0xdfa2('0xf')](_0xdfa2('0x10'),_0x5cabbc,'request\x20sent');logger['debug']('Trunk,\x20%s,\x20%s,\x20%s',_0x5cabbc,'request\x20sent',JSON[_0xdfa2('0x11')](_0x589e5a));if(_0x589e5a[_0xdfa2('0x12')]){if(_0x589e5a[_0xdfa2('0x12')][_0xdfa2('0x13')]===0x1f4){logger[_0xdfa2('0x12')](_0xdfa2('0x10'),_0x5cabbc,_0x589e5a['error'][_0xdfa2('0x14')]);return _0x3962fe(_0x589e5a[_0xdfa2('0x12')][_0xdfa2('0x14')]);}logger['error'](_0xdfa2('0x10'),_0x5cabbc,_0x589e5a[_0xdfa2('0x12')][_0xdfa2('0x14')]);return _0xa332e8(_0x589e5a[_0xdfa2('0x12')][_0xdfa2('0x14')]);}else{logger['info'](_0xdfa2('0x10'),_0x5cabbc,_0xdfa2('0x15'));_0xa332e8(_0x589e5a[_0xdfa2('0x16')][_0xdfa2('0x14')]);}})['catch'](function(_0x504759){logger[_0xdfa2('0x12')]('Trunk,\x20%s,\x20%s',_0x5cabbc,_0x504759);_0x3962fe(_0x504759);});});}exports[_0xdfa2('0x17')]=function(_0x3b4028){var _0x5d6ee7=this;return new Promise(function(_0x3094e4,_0x4faf93){return db[_0xdfa2('0x18')][_0xdfa2('0x19')]({'raw':_0x3b4028[_0xdfa2('0x1a')]?_0x3b4028[_0xdfa2('0x1a')][_0xdfa2('0x1b')]===undefined?!![]:![]:!![],'where':_0x3b4028[_0xdfa2('0x1a')]?_0x3b4028[_0xdfa2('0x1a')]['where']||null:null,'attributes':_0x3b4028[_0xdfa2('0x1a')]?_0x3b4028['options']['attributes']||null:null,'limit':_0x3b4028[_0xdfa2('0x1a')]?_0x3b4028[_0xdfa2('0x1a')]['limit']||null:null,'include':_0x3b4028[_0xdfa2('0x1a')]?_0x3b4028[_0xdfa2('0x1a')][_0xdfa2('0x1c')]?_[_0xdfa2('0x1d')](_0x3b4028[_0xdfa2('0x1a')]['include'],function(_0x2c23d4){return{'model':db[_0x2c23d4['model']],'as':_0x2c23d4['as'],'attributes':_0x2c23d4[_0xdfa2('0x1e')],'include':_0x2c23d4['include']?_[_0xdfa2('0x1d')](_0x2c23d4['include'],function(_0x4279db){return{'model':db[_0x4279db['model']],'as':_0x4279db['as'],'attributes':_0x4279db[_0xdfa2('0x1e')],'include':_0x4279db['include']?_[_0xdfa2('0x1d')](_0x4279db[_0xdfa2('0x1c')],function(_0x35001c){return{'model':db[_0x35001c['model']],'as':_0x35001c['as'],'attributes':_0x35001c['attributes']};}):[]};}):[]};}):[]:[]})[_0xdfa2('0xe')](function(_0x44245c){logger[_0xdfa2('0xf')](_0xdfa2('0x17'),_0x3b4028);logger[_0xdfa2('0x1f')](_0xdfa2('0x17'),_0x3b4028,JSON[_0xdfa2('0x11')](_0x44245c));_0x3094e4(_0x44245c);})[_0xdfa2('0x20')](function(_0x2870df){logger[_0xdfa2('0x12')](_0xdfa2('0x17'),_0x2870df[_0xdfa2('0x14')],_0x3b4028);_0x4faf93(_0x5d6ee7[_0xdfa2('0x12')](0x1f4,_0x2870df[_0xdfa2('0x14')]));});});};exports[_0xdfa2('0x21')]=function(_0x483303){var _0x59aafc=this;return new Promise(function(_0x2dbb33,_0x469b3b){return db['Trunk'][_0xdfa2('0x22')]({'raw':_0x483303[_0xdfa2('0x1a')]?_0x483303['options']['raw']===undefined?!![]:![]:!![],'where':_0x483303['options']?_0x483303[_0xdfa2('0x1a')][_0xdfa2('0x23')]||null:null,'attributes':_0x483303[_0xdfa2('0x1a')]?_0x483303['options'][_0xdfa2('0x1e')]||null:null,'include':_0x483303[_0xdfa2('0x1a')]?_0x483303[_0xdfa2('0x1a')][_0xdfa2('0x1c')]?_[_0xdfa2('0x1d')](_0x483303['options'][_0xdfa2('0x1c')],function(_0x3900f2){return{'model':db[_0x3900f2[_0xdfa2('0x24')]],'as':_0x3900f2['as'],'attributes':_0x3900f2[_0xdfa2('0x1e')],'include':_0x3900f2['include']?_['map'](_0x3900f2[_0xdfa2('0x1c')],function(_0x3eb5c4){return{'model':db[_0x3eb5c4['model']],'as':_0x3eb5c4['as'],'attributes':_0x3eb5c4[_0xdfa2('0x1e')],'include':_0x3eb5c4[_0xdfa2('0x1c')]?_[_0xdfa2('0x1d')](_0x3eb5c4[_0xdfa2('0x1c')],function(_0xeecb35){return{'model':db[_0xeecb35[_0xdfa2('0x24')]],'as':_0xeecb35['as'],'attributes':_0xeecb35['attributes']};}):[]};}):[]};}):[]:[]})[_0xdfa2('0xe')](function(_0xb59202){logger[_0xdfa2('0xf')](_0xdfa2('0x21'),_0x483303);logger[_0xdfa2('0x1f')](_0xdfa2('0x21'),_0x483303,JSON[_0xdfa2('0x11')](_0xb59202));_0x2dbb33(_0xb59202);})['catch'](function(_0x4f63fc){logger['error']('ShowTrunk',_0x4f63fc[_0xdfa2('0x14')],_0x483303);_0x469b3b(_0x59aafc[_0xdfa2('0x12')](0x1f4,_0x4f63fc[_0xdfa2('0x14')]));});});}; \ No newline at end of file +var _0xf78a=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','code','error','message','GetTrunk','Trunk','options','attributes','limit','include','map','model','catch','find','raw','where','ShowTrunk','lodash'];(function(_0x49d8ab,_0x7e24db){var _0x3c1bf6=function(_0x433b86){while(--_0x433b86){_0x49d8ab['push'](_0x49d8ab['shift']());}};_0x3c1bf6(++_0x7e24db);}(_0xf78a,0x65));var _0xaf78=function(_0x365e54,_0x44be74){_0x365e54=_0x365e54-0x0;var _0x13317a=_0xf78a[_0x365e54];return _0x13317a;};'use strict';var _=require(_0xaf78('0x0'));var util=require(_0xaf78('0x1'));var moment=require(_0xaf78('0x2'));var BPromise=require(_0xaf78('0x3'));var rs=require(_0xaf78('0x4'));var fs=require('fs');var Redis=require(_0xaf78('0x5'));var db=require(_0xaf78('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xaf78('0x7'))(_0xaf78('0x8'));var config=require('../../config/environment');var jayson=require(_0xaf78('0x9'));var client=jayson['client'][_0xaf78('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4881d1,_0x54ede9,_0x300339){return new BPromise(function(_0x710134,_0x56fa08){return client['request'](_0x4881d1,_0x300339)[_0xaf78('0xb')](function(_0x48ac03){logger[_0xaf78('0xc')](_0xaf78('0xd'),_0x54ede9,_0xaf78('0xe'));logger[_0xaf78('0xf')](_0xaf78('0x10'),_0x54ede9,_0xaf78('0xe'),JSON[_0xaf78('0x11')](_0x48ac03));if(_0x48ac03['error']){if(_0x48ac03['error'][_0xaf78('0x12')]===0x1f4){logger[_0xaf78('0x13')](_0xaf78('0xd'),_0x54ede9,_0x48ac03['error'][_0xaf78('0x14')]);return _0x56fa08(_0x48ac03[_0xaf78('0x13')][_0xaf78('0x14')]);}logger[_0xaf78('0x13')]('Trunk,\x20%s,\x20%s',_0x54ede9,_0x48ac03['error'][_0xaf78('0x14')]);return _0x710134(_0x48ac03['error'][_0xaf78('0x14')]);}else{logger[_0xaf78('0xc')](_0xaf78('0xd'),_0x54ede9,_0xaf78('0xe'));_0x710134(_0x48ac03['result'][_0xaf78('0x14')]);}})['catch'](function(_0x27abf4){logger[_0xaf78('0x13')]('Trunk,\x20%s,\x20%s',_0x54ede9,_0x27abf4);_0x56fa08(_0x27abf4);});});}exports[_0xaf78('0x15')]=function(_0x12a6c3){var _0x5d70b0=this;return new Promise(function(_0x143a90,_0x366848){return db[_0xaf78('0x16')]['findAll']({'raw':_0x12a6c3[_0xaf78('0x17')]?_0x12a6c3['options']['raw']===undefined?!![]:![]:!![],'where':_0x12a6c3[_0xaf78('0x17')]?_0x12a6c3[_0xaf78('0x17')]['where']||null:null,'attributes':_0x12a6c3[_0xaf78('0x17')]?_0x12a6c3['options'][_0xaf78('0x18')]||null:null,'limit':_0x12a6c3[_0xaf78('0x17')]?_0x12a6c3[_0xaf78('0x17')][_0xaf78('0x19')]||null:null,'include':_0x12a6c3[_0xaf78('0x17')]?_0x12a6c3['options'][_0xaf78('0x1a')]?_[_0xaf78('0x1b')](_0x12a6c3[_0xaf78('0x17')]['include'],function(_0x305863){return{'model':db[_0x305863[_0xaf78('0x1c')]],'as':_0x305863['as'],'attributes':_0x305863[_0xaf78('0x18')],'include':_0x305863[_0xaf78('0x1a')]?_[_0xaf78('0x1b')](_0x305863[_0xaf78('0x1a')],function(_0x2360ed){return{'model':db[_0x2360ed['model']],'as':_0x2360ed['as'],'attributes':_0x2360ed[_0xaf78('0x18')],'include':_0x2360ed[_0xaf78('0x1a')]?_[_0xaf78('0x1b')](_0x2360ed[_0xaf78('0x1a')],function(_0x47cb54){return{'model':db[_0x47cb54['model']],'as':_0x47cb54['as'],'attributes':_0x47cb54[_0xaf78('0x18')]};}):[]};}):[]};}):[]:[]})[_0xaf78('0xb')](function(_0x1faf4f){logger[_0xaf78('0xc')]('GetTrunk',_0x12a6c3);logger[_0xaf78('0xf')](_0xaf78('0x15'),_0x12a6c3,JSON[_0xaf78('0x11')](_0x1faf4f));_0x143a90(_0x1faf4f);})[_0xaf78('0x1d')](function(_0x82c51a){logger[_0xaf78('0x13')]('GetTrunk',_0x82c51a[_0xaf78('0x14')],_0x12a6c3);_0x366848(_0x5d70b0[_0xaf78('0x13')](0x1f4,_0x82c51a[_0xaf78('0x14')]));});});};exports['ShowTrunk']=function(_0x399512){var _0x55d517=this;return new Promise(function(_0x5cbeec,_0x3c7260){return db[_0xaf78('0x16')][_0xaf78('0x1e')]({'raw':_0x399512['options']?_0x399512[_0xaf78('0x17')][_0xaf78('0x1f')]===undefined?!![]:![]:!![],'where':_0x399512[_0xaf78('0x17')]?_0x399512[_0xaf78('0x17')][_0xaf78('0x20')]||null:null,'attributes':_0x399512[_0xaf78('0x17')]?_0x399512[_0xaf78('0x17')]['attributes']||null:null,'include':_0x399512['options']?_0x399512['options']['include']?_[_0xaf78('0x1b')](_0x399512[_0xaf78('0x17')]['include'],function(_0x5bd232){return{'model':db[_0x5bd232[_0xaf78('0x1c')]],'as':_0x5bd232['as'],'attributes':_0x5bd232[_0xaf78('0x18')],'include':_0x5bd232[_0xaf78('0x1a')]?_[_0xaf78('0x1b')](_0x5bd232[_0xaf78('0x1a')],function(_0x406d30){return{'model':db[_0x406d30[_0xaf78('0x1c')]],'as':_0x406d30['as'],'attributes':_0x406d30['attributes'],'include':_0x406d30[_0xaf78('0x1a')]?_[_0xaf78('0x1b')](_0x406d30['include'],function(_0x99f192){return{'model':db[_0x99f192[_0xaf78('0x1c')]],'as':_0x99f192['as'],'attributes':_0x99f192[_0xaf78('0x18')]};}):[]};}):[]};}):[]:[]})[_0xaf78('0xb')](function(_0x4e299b){logger['info']('ShowTrunk',_0x399512);logger[_0xaf78('0xf')](_0xaf78('0x21'),_0x399512,JSON[_0xaf78('0x11')](_0x4e299b));_0x5cbeec(_0x4e299b);})[_0xaf78('0x1d')](function(_0x5e016b){logger['error'](_0xaf78('0x21'),_0x5e016b[_0xaf78('0x14')],_0x399512);_0x3c7260(_0x55d517[_0xaf78('0x13')](0x1f4,_0x5e016b[_0xaf78('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 547fc2d..4fb12d4 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 _0xe51f=['addSquareProjects','createApiKey','update','put','changePassword','delete','removeQueues','destroy','removeMailInteractions','removeFaxInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','/:id/fax_accounts','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','/describe','isAuthenticated','describe','/whoami','whoami','/presence','getPresence','/:id','show','/:id/avatar','getOpenTabs','/:id/contacts','/:id/queues','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/agents','getAgents','/:id/prefixes','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','%s-%s','now','originalname','single','file','/:id/login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','/:id/square_projects'];(function(_0x3eb834,_0x4a3ed4){var _0x446635=function(_0x456ffd){while(--_0x456ffd){_0x3eb834['push'](_0x3eb834['shift']());}};_0x446635(++_0x4a3ed4);}(_0xe51f,0x1f3));var _0xfe51=function(_0x5764ae,_0x5eb768){_0x5764ae=_0x5764ae-0x0;var _0x46a0d0=_0xe51f[_0x5764ae];return _0x46a0d0;};'use strict';var multer=require(_0xfe51('0x0'));var util=require(_0xfe51('0x1'));var path=require(_0xfe51('0x2'));var timeout=require(_0xfe51('0x3'));var express=require(_0xfe51('0x4'));var router=express[_0xfe51('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xfe51('0x6'));var interaction=require(_0xfe51('0x7'));var config=require(_0xfe51('0x8'));var controller=require(_0xfe51('0x9'));router[_0xfe51('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfe51('0xa')](_0xfe51('0xb'),auth[_0xfe51('0xc')](),controller[_0xfe51('0xd')]);router[_0xfe51('0xa')](_0xfe51('0xe'),auth[_0xfe51('0xc')](),controller[_0xfe51('0xf')]);router[_0xfe51('0xa')](_0xfe51('0x10'),auth['isAuthenticated'](),controller[_0xfe51('0x11')]);router[_0xfe51('0xa')](_0xfe51('0x12'),auth['isAuthenticated'](),controller[_0xfe51('0x13')]);router[_0xfe51('0xa')](_0xfe51('0x14'),controller['getAvatar']);router[_0xfe51('0xa')]('/:id/open_tabs',auth[_0xfe51('0xc')](),controller[_0xfe51('0x15')]);router[_0xfe51('0xa')](_0xfe51('0x16'),auth[_0xfe51('0xc')](),controller['getContacts']);router[_0xfe51('0xa')](_0xfe51('0x17'),auth[_0xfe51('0xc')](),controller['getQueues']);router[_0xfe51('0xa')]('/:id/queues_rt',auth[_0xfe51('0xc')](),controller['getVoiceQueuesRt']);router[_0xfe51('0xa')](_0xfe51('0x18'),auth[_0xfe51('0xc')](),controller[_0xfe51('0x19')]);router[_0xfe51('0xa')](_0xfe51('0x1a'),auth[_0xfe51('0xc')](),controller[_0xfe51('0x1b')]);router[_0xfe51('0xa')](_0xfe51('0x1c'),auth['isAuthenticated'](),controller[_0xfe51('0x1d')]);router[_0xfe51('0xa')](_0xfe51('0x1e'),auth[_0xfe51('0xc')](),controller['getChatInteractions']);router[_0xfe51('0xa')]('/:id/openchannel/interactions',auth[_0xfe51('0xc')](),controller[_0xfe51('0x1f')]);router[_0xfe51('0xa')](_0xfe51('0x20'),auth[_0xfe51('0xc')](),controller['getMailInteractions']);router[_0xfe51('0xa')](_0xfe51('0x21'),auth['isAuthenticated'](),controller[_0xfe51('0x22')]);router[_0xfe51('0xa')](_0xfe51('0x23'),auth[_0xfe51('0xc')](),controller[_0xfe51('0x24')]);router['get'](_0xfe51('0x25'),auth[_0xfe51('0xc')](),controller[_0xfe51('0x26')]);router[_0xfe51('0xa')](_0xfe51('0x27'),auth[_0xfe51('0xc')](),controller[_0xfe51('0x28')]);router[_0xfe51('0xa')]('/:id/lists',auth[_0xfe51('0xc')](),controller['getLists']);router['get'](_0xfe51('0x29'),auth[_0xfe51('0xc')](),controller[_0xfe51('0x2a')]);router[_0xfe51('0xa')](_0xfe51('0x2b'),auth[_0xfe51('0xc')](),controller['getVoicePrefixes']);router[_0xfe51('0xa')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0xfe51('0x2c')]);router[_0xfe51('0xa')]('/:id/mail_accounts',auth[_0xfe51('0xc')](),controller[_0xfe51('0x2d')]);router['get'](_0xfe51('0x2e'),auth[_0xfe51('0xc')](),controller['getOpenchannelAccounts']);router[_0xfe51('0xa')](_0xfe51('0x2f'),auth['isAuthenticated'](),controller[_0xfe51('0x30')]);router['get'](_0xfe51('0x31'),auth[_0xfe51('0xc')](),controller[_0xfe51('0x32')]);router[_0xfe51('0xa')](_0xfe51('0x33'),auth[_0xfe51('0xc')](),controller[_0xfe51('0x34')]);router['get']('/:id/square_projects',auth['isAuthenticated'](),controller[_0xfe51('0x35')]);router['get'](_0xfe51('0x36'),auth[_0xfe51('0xc')](),controller[_0xfe51('0x37')]);router[_0xfe51('0xa')](_0xfe51('0x38'),auth['isAuthenticated'](),controller[_0xfe51('0x39')]);router[_0xfe51('0x3a')]('/:id/contacts',auth[_0xfe51('0xc')](),controller[_0xfe51('0x3b')]);router[_0xfe51('0x3a')]('/',auth[_0xfe51('0xc')](),controller[_0xfe51('0x3c')]);router[_0xfe51('0x3a')](_0xfe51('0x3d'),auth[_0xfe51('0xc')](),controller[_0xfe51('0x3e')]);router[_0xfe51('0x3a')](_0xfe51('0x17'),auth['isAuthenticated'](),controller[_0xfe51('0x3f')]);var upload=multer({'storage':multer[_0xfe51('0x40')]({'destination':function(_0x19166f,_0x201d82,_0x59971d){_0x59971d(null,path[_0xfe51('0x41')](config[_0xfe51('0x42')],_0xfe51('0x43')));},'filename':function(_0x29d2d8,_0x59be5a,_0x20c9ec){_0x20c9ec(null,util['format'](_0xfe51('0x44'),Date[_0xfe51('0x45')](),_0x59be5a[_0xfe51('0x46')]));}})});router['post'](_0xfe51('0x14'),upload[_0xfe51('0x47')](_0xfe51('0x48')),controller['addAvatar']);router['post'](_0xfe51('0x49'),auth[_0xfe51('0xc')](),controller['login']);router['post'](_0xfe51('0x4a'),auth[_0xfe51('0xc')](),controller[_0xfe51('0x4b')]);router['post'](_0xfe51('0x4c'),auth['isAuthenticated'](),controller[_0xfe51('0x4d')]);router[_0xfe51('0x3a')](_0xfe51('0x4e'),auth['isAuthenticated'](),controller[_0xfe51('0x4f')]);router['post'](_0xfe51('0x27'),auth[_0xfe51('0xc')](),controller[_0xfe51('0x50')]);router['post'](_0xfe51('0x51'),auth[_0xfe51('0xc')](),controller[_0xfe51('0x52')]);router['post']('/:id/mail_interactions',auth[_0xfe51('0xc')](),controller['addMailInteractions']);router[_0xfe51('0x3a')]('/:id/fax_interactions',auth[_0xfe51('0xc')](),controller[_0xfe51('0x53')]);router['post'](_0xfe51('0x54'),auth[_0xfe51('0xc')](),controller[_0xfe51('0x55')]);router['post']('/:id/openchannel_interactions',auth[_0xfe51('0xc')](),controller[_0xfe51('0x56')]);router[_0xfe51('0x3a')](_0xfe51('0x57'),auth[_0xfe51('0xc')](),controller[_0xfe51('0x58')]);router[_0xfe51('0x3a')]('/:id/fax_accounts',auth[_0xfe51('0xc')](),controller['addFaxAccounts']);router[_0xfe51('0x3a')](_0xfe51('0x59'),auth[_0xfe51('0xc')](),controller[_0xfe51('0x5a')]);router[_0xfe51('0x3a')](_0xfe51('0x2e'),auth[_0xfe51('0xc')](),controller[_0xfe51('0x5b')]);router[_0xfe51('0x3a')](_0xfe51('0x2f'),auth[_0xfe51('0xc')](),controller[_0xfe51('0x5c')]);router[_0xfe51('0x3a')](_0xfe51('0x31'),auth[_0xfe51('0xc')](),controller[_0xfe51('0x5d')]);router['post'](_0xfe51('0x33'),auth[_0xfe51('0xc')](),controller[_0xfe51('0x5e')]);router['post'](_0xfe51('0x5f'),auth[_0xfe51('0xc')](),controller[_0xfe51('0x60')]);router[_0xfe51('0x3a')](_0xfe51('0x38'),auth[_0xfe51('0xc')](),controller[_0xfe51('0x61')]);router['put'](_0xfe51('0x12'),auth[_0xfe51('0xc')](),controller[_0xfe51('0x62')]);router[_0xfe51('0x63')]('/:id/password',auth[_0xfe51('0xc')](),controller[_0xfe51('0x64')]);router[_0xfe51('0x65')](_0xfe51('0x17'),auth[_0xfe51('0xc')](),controller[_0xfe51('0x66')]);router[_0xfe51('0x65')](_0xfe51('0x27'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xfe51('0x65')]('/:id',auth[_0xfe51('0xc')](),controller[_0xfe51('0x67')]);router[_0xfe51('0x65')](_0xfe51('0x51'),auth[_0xfe51('0xc')](),controller['removeChatInteractions']);router[_0xfe51('0x65')]('/:id/mail_interactions',auth[_0xfe51('0xc')](),controller[_0xfe51('0x68')]);router[_0xfe51('0x65')]('/:id/fax_interactions',auth[_0xfe51('0xc')](),controller[_0xfe51('0x69')]);router['delete']('/:id/sms_interactions',auth[_0xfe51('0xc')](),controller['removeSmsInteractions']);router[_0xfe51('0x65')](_0xfe51('0x6a'),auth[_0xfe51('0xc')](),controller[_0xfe51('0x6b')]);router[_0xfe51('0x65')](_0xfe51('0x57'),auth[_0xfe51('0xc')](),controller[_0xfe51('0x6c')]);router[_0xfe51('0x65')](_0xfe51('0x6d'),auth['isAuthenticated'](),controller[_0xfe51('0x6e')]);router['delete'](_0xfe51('0x59'),auth[_0xfe51('0xc')](),controller[_0xfe51('0x6f')]);router['delete'](_0xfe51('0x2e'),auth[_0xfe51('0xc')](),controller[_0xfe51('0x70')]);router[_0xfe51('0x65')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0xfe51('0x71')]);router['delete'](_0xfe51('0x31'),auth['isAuthenticated'](),controller[_0xfe51('0x72')]);router['delete'](_0xfe51('0x33'),auth[_0xfe51('0xc')](),controller[_0xfe51('0x73')]);router[_0xfe51('0x65')](_0xfe51('0x5f'),auth[_0xfe51('0xc')](),controller[_0xfe51('0x74')]);router[_0xfe51('0x65')](_0xfe51('0x38'),auth[_0xfe51('0xc')](),controller[_0xfe51('0x75')]);module[_0xfe51('0x76')]=router; \ No newline at end of file +var _0x186e=['addOpenchannelAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeSquareProjects','removeApiKey','exports','multer','util','express','Router','get','isAuthenticated','describe','/presence','/:id','/:id/avatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','getQueues','/:id/queues_rt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getLists','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','create','/create_many','bulkCreate','/:id/queues','addQueues','diskStorage','join','format','%s-%s','now','originalname','file','addAvatar','/:id/login','login','/:id/pause','/:id/unpause','unpause','/:id/teams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','/:id/openchannel_accounts'];(function(_0x580642,_0x4911a6){var _0x30a08f=function(_0x1c6179){while(--_0x1c6179){_0x580642['push'](_0x580642['shift']());}};_0x30a08f(++_0x4911a6);}(_0x186e,0x156));var _0xe186=function(_0xba275f,_0x2b9273){_0xba275f=_0xba275f-0x0;var _0x4f3750=_0x186e[_0xba275f];return _0x4f3750;};'use strict';var multer=require(_0xe186('0x0'));var util=require(_0xe186('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe186('0x2'));var router=express[_0xe186('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('./user.controller');router[_0xe186('0x4')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe186('0x4')]('/describe',auth[_0xe186('0x5')](),controller[_0xe186('0x6')]);router[_0xe186('0x4')]('/whoami',auth[_0xe186('0x5')](),controller['whoami']);router[_0xe186('0x4')](_0xe186('0x7'),auth['isAuthenticated'](),controller['getPresence']);router[_0xe186('0x4')](_0xe186('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xe186('0x4')](_0xe186('0x9'),controller['getAvatar']);router[_0xe186('0x4')](_0xe186('0xa'),auth['isAuthenticated'](),controller[_0xe186('0xb')]);router['get'](_0xe186('0xc'),auth[_0xe186('0x5')](),controller[_0xe186('0xd')]);router[_0xe186('0x4')]('/:id/queues',auth[_0xe186('0x5')](),controller[_0xe186('0xe')]);router[_0xe186('0x4')](_0xe186('0xf'),auth[_0xe186('0x5')](),controller['getVoiceQueuesRt']);router[_0xe186('0x4')](_0xe186('0x10'),auth['isAuthenticated'](),controller[_0xe186('0x11')]);router[_0xe186('0x4')](_0xe186('0x12'),auth[_0xe186('0x5')](),controller[_0xe186('0x13')]);router[_0xe186('0x4')](_0xe186('0x14'),auth['isAuthenticated'](),controller[_0xe186('0x15')]);router['get']('/:id/chat/interactions',auth[_0xe186('0x5')](),controller[_0xe186('0x16')]);router[_0xe186('0x4')](_0xe186('0x17'),auth[_0xe186('0x5')](),controller[_0xe186('0x18')]);router[_0xe186('0x4')](_0xe186('0x19'),auth[_0xe186('0x5')](),controller[_0xe186('0x1a')]);router[_0xe186('0x4')](_0xe186('0x1b'),auth['isAuthenticated'](),controller['getSmsInteractions']);router[_0xe186('0x4')](_0xe186('0x1c'),auth[_0xe186('0x5')](),controller[_0xe186('0x1d')]);router[_0xe186('0x4')](_0xe186('0x1e'),auth[_0xe186('0x5')](),controller[_0xe186('0x1f')]);router['get']('/:id/teams',auth[_0xe186('0x5')](),controller['getTeams']);router[_0xe186('0x4')]('/:id/lists',auth[_0xe186('0x5')](),controller[_0xe186('0x20')]);router['get']('/:id/agents',auth[_0xe186('0x5')](),controller['getAgents']);router[_0xe186('0x4')](_0xe186('0x21'),auth[_0xe186('0x5')](),controller[_0xe186('0x22')]);router['get']('/:id/fax_accounts',auth[_0xe186('0x5')](),controller[_0xe186('0x23')]);router[_0xe186('0x4')](_0xe186('0x24'),auth[_0xe186('0x5')](),controller[_0xe186('0x25')]);router[_0xe186('0x4')]('/:id/openchannel_accounts',auth[_0xe186('0x5')](),controller[_0xe186('0x26')]);router[_0xe186('0x4')](_0xe186('0x27'),auth[_0xe186('0x5')](),controller[_0xe186('0x28')]);router[_0xe186('0x4')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xe186('0x29')]);router['get'](_0xe186('0x2a'),auth[_0xe186('0x5')](),controller[_0xe186('0x2b')]);router[_0xe186('0x4')](_0xe186('0x2c'),auth[_0xe186('0x5')](),controller['getSquareProjects']);router['get'](_0xe186('0x2d'),auth[_0xe186('0x5')](),controller[_0xe186('0x2e')]);router[_0xe186('0x4')](_0xe186('0x2f'),auth[_0xe186('0x5')](),controller[_0xe186('0x30')]);router[_0xe186('0x31')](_0xe186('0xc'),auth['isAuthenticated'](),controller['addContacts']);router['post']('/',auth[_0xe186('0x5')](),controller[_0xe186('0x32')]);router[_0xe186('0x31')](_0xe186('0x33'),auth[_0xe186('0x5')](),controller[_0xe186('0x34')]);router[_0xe186('0x31')](_0xe186('0x35'),auth[_0xe186('0x5')](),controller[_0xe186('0x36')]);var upload=multer({'storage':multer[_0xe186('0x37')]({'destination':function(_0x3ee987,_0x4d1716,_0x106fbd){_0x106fbd(null,path[_0xe186('0x38')](config['root'],'server/files/images/'));},'filename':function(_0x5908f2,_0x100efa,_0xf3ea7e){_0xf3ea7e(null,util[_0xe186('0x39')](_0xe186('0x3a'),Date[_0xe186('0x3b')](),_0x100efa[_0xe186('0x3c')]));}})});router[_0xe186('0x31')](_0xe186('0x9'),upload['single'](_0xe186('0x3d')),controller[_0xe186('0x3e')]);router[_0xe186('0x31')](_0xe186('0x3f'),auth['isAuthenticated'](),controller[_0xe186('0x40')]);router[_0xe186('0x31')]('/:id/logout',auth[_0xe186('0x5')](),controller['logout']);router[_0xe186('0x31')](_0xe186('0x41'),auth[_0xe186('0x5')](),controller['pause']);router['post'](_0xe186('0x42'),auth[_0xe186('0x5')](),controller[_0xe186('0x43')]);router[_0xe186('0x31')](_0xe186('0x44'),auth[_0xe186('0x5')](),controller['addTeams']);router[_0xe186('0x31')](_0xe186('0x45'),auth['isAuthenticated'](),controller[_0xe186('0x46')]);router['post'](_0xe186('0x47'),auth[_0xe186('0x5')](),controller[_0xe186('0x48')]);router[_0xe186('0x31')](_0xe186('0x49'),auth['isAuthenticated'](),controller[_0xe186('0x4a')]);router[_0xe186('0x31')](_0xe186('0x4b'),auth[_0xe186('0x5')](),controller[_0xe186('0x4c')]);router['post'](_0xe186('0x4d'),auth[_0xe186('0x5')](),controller['addOpenchannelInteractions']);router[_0xe186('0x31')]('/:id/whatsapp_interactions',auth[_0xe186('0x5')](),controller[_0xe186('0x4e')]);router[_0xe186('0x31')](_0xe186('0x4f'),auth['isAuthenticated'](),controller[_0xe186('0x50')]);router['post'](_0xe186('0x24'),auth[_0xe186('0x5')](),controller['addMailAccounts']);router[_0xe186('0x31')](_0xe186('0x51'),auth['isAuthenticated'](),controller[_0xe186('0x52')]);router[_0xe186('0x31')](_0xe186('0x27'),auth[_0xe186('0x5')](),controller['addSmsAccounts']);router[_0xe186('0x31')](_0xe186('0x53'),auth[_0xe186('0x5')](),controller[_0xe186('0x54')]);router[_0xe186('0x31')](_0xe186('0x2a'),auth[_0xe186('0x5')](),controller[_0xe186('0x55')]);router[_0xe186('0x31')](_0xe186('0x2c'),auth[_0xe186('0x5')](),controller['addSquareProjects']);router['post'](_0xe186('0x2f'),auth['isAuthenticated'](),controller['createApiKey']);router[_0xe186('0x56')](_0xe186('0x8'),auth[_0xe186('0x5')](),controller[_0xe186('0x57')]);router['put'](_0xe186('0x58'),auth[_0xe186('0x5')](),controller[_0xe186('0x59')]);router[_0xe186('0x5a')](_0xe186('0x35'),auth[_0xe186('0x5')](),controller[_0xe186('0x5b')]);router['delete'](_0xe186('0x44'),auth[_0xe186('0x5')](),controller[_0xe186('0x5c')]);router[_0xe186('0x5a')](_0xe186('0x8'),auth[_0xe186('0x5')](),controller[_0xe186('0x5d')]);router['delete'](_0xe186('0x45'),auth[_0xe186('0x5')](),controller[_0xe186('0x5e')]);router['delete'](_0xe186('0x47'),auth[_0xe186('0x5')](),controller['removeMailInteractions']);router['delete']('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0xe186('0x5f')]);router[_0xe186('0x5a')](_0xe186('0x4b'),auth['isAuthenticated'](),controller[_0xe186('0x60')]);router['delete'](_0xe186('0x4d'),auth['isAuthenticated'](),controller[_0xe186('0x61')]);router[_0xe186('0x5a')](_0xe186('0x62'),auth[_0xe186('0x5')](),controller[_0xe186('0x63')]);router[_0xe186('0x5a')](_0xe186('0x4f'),auth['isAuthenticated'](),controller[_0xe186('0x64')]);router[_0xe186('0x5a')](_0xe186('0x24'),auth['isAuthenticated'](),controller[_0xe186('0x65')]);router[_0xe186('0x5a')](_0xe186('0x51'),auth[_0xe186('0x5')](),controller['removeOpenchannelAccounts']);router['delete']('/:id/sms_accounts',auth[_0xe186('0x5')](),controller[_0xe186('0x66')]);router[_0xe186('0x5a')](_0xe186('0x53'),auth[_0xe186('0x5')](),controller['removeChatWebsites']);router['delete'](_0xe186('0x2a'),auth['isAuthenticated'](),controller['removeWhatsappAccounts']);router[_0xe186('0x5a')]('/:id/square_projects',auth[_0xe186('0x5')](),controller[_0xe186('0x67')]);router[_0xe186('0x5a')](_0xe186('0x2f'),auth[_0xe186('0x5')](),controller[_0xe186('0x68')]);module[_0xe186('0x69')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 72690c6..7bbb834 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 _0x4876=['yes','insecure','never','always','refuse','originate','uac','uas','fingerprint','active','passive','actpass','update,nonat','TEXT','showWebBar','get','isArray','udp','wss','encryption','force_avp','icesupport','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','avpf','dtlsenable','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','util','STRING','setDataValue','name','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','telephone','local','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','nonat','update','outgoing','join','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'];(function(_0x27c62d,_0x302598){var _0x139ccc=function(_0x460020){while(--_0x460020){_0x27c62d['push'](_0x27c62d['shift']());}};_0x139ccc(++_0x302598);}(_0x4876,0x84));var _0x6487=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4876[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x6487('0x0'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x6487('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x43e7e8){this[_0x6487('0x2')](_0x6487('0x3'),_0x43e7e8);this[_0x6487('0x2')]('defaultuser',_0x43e7e8);},'comment':_0x6487('0x4')},'fullname':{'type':Sequelize[_0x6487('0x1')],'allowNull':![],'set':function(_0x52177e){this[_0x6487('0x2')](_0x6487('0x5'),_0x52177e);this[_0x6487('0x2')](_0x6487('0x6'),util[_0x6487('0x7')](_0x6487('0x8'),_0x52177e,this[_0x6487('0x9')](_0x6487('0xa'))));}},'alias':{'type':Sequelize[_0x6487('0x1')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6487('0xb'),'validate':{'isEmail':!![]},'set':function(_0x3964d5){if(_0x3964d5){this[_0x6487('0x2')](_0x6487('0xb'),_0x3964d5[_0x6487('0xc')]());}}},'role':{'type':Sequelize[_0x6487('0xd')](_0x6487('0xe'),_0x6487('0xf'),'agent',_0x6487('0x10')),'allowNull':![]},'password':{'type':Sequelize[_0x6487('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x6487('0x1')],'defaultValue':_0x6487('0x11')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x6487('0xa'),'set':function(_0x10f2e1){this[_0x6487('0x2')](_0x6487('0xa'),_0x10f2e1);this['setDataValue']('accountcode',_0x10f2e1);this[_0x6487('0x2')]('callerid',util[_0x6487('0x7')]('\x22%s\x22\x20<%s>',this[_0x6487('0x9')](_0x6487('0x5')),_0x10f2e1));}},'salt':{'type':Sequelize[_0x6487('0x1')]},'phone':{'type':Sequelize[_0x6487('0x1')]},'mobile':{'type':Sequelize[_0x6487('0x1')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x6487('0x1')]},'country':{'type':Sequelize[_0x6487('0x1')]},'online':{'type':Sequelize[_0x6487('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x6487('0x13')]},'voicePause':{'type':Sequelize[_0x6487('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x6487('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x6487('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x6487('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x6487('0x12')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x6487('0x12')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x6487('0x12')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x6487('0x1')],'defaultValue':_0x6487('0x14')},'lastPauseAt':{'type':Sequelize[_0x6487('0x13')]},'chatCapacity':{'type':Sequelize[_0x6487('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x6487('0x15')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x6487('0x15')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x6487('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x6487('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x6487('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x6487('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x6487('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x6487('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x6487('0x12')],'defaultValue':![]},'description':{'type':Sequelize[_0x6487('0x1')],'allowNull':!![]},'host':{'type':Sequelize[_0x6487('0x1')],'allowNull':!![],'defaultValue':_0x6487('0x16')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x6487('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x6487('0x1')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x6487('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x6487('0xd')](_0x6487('0x17'),'user',_0x6487('0x18')),'allowNull':!![],'defaultValue':_0x6487('0x17')},'context':{'type':Sequelize[_0x6487('0x1')],'allowNull':!![],'defaultValue':_0x6487('0x19')},'callingpres':{'type':Sequelize[_0x6487('0xd')](_0x6487('0x1a'),'ALLOWED_PASSED_SCREEN',_0x6487('0x1b'),_0x6487('0x1c'),'PROHIB_NOT_SCREENED',_0x6487('0x1d'),_0x6487('0x1e'),_0x6487('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize[_0x6487('0x1')],'allowNull':!![]},'permit':{'type':Sequelize[_0x6487('0x1')],'allowNull':!![]},'secret':{'type':Sequelize[_0x6487('0x1')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x6487('0x1')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x6487('0x1')],'allowNull':!![],'defaultValue':'udp','set':function(_0x2d320c){this['setDataValue']('transport',_0x2d320c?_0x2d320c['join'](','):null);},'get':function(){return this['getDataValue'](_0x6487('0x20'))?this[_0x6487('0x9')](_0x6487('0x20'))['split'](','):null;},'comment':_0x6487('0x21')},'dtmfmode':{'type':Sequelize['ENUM'](_0x6487('0x22'),_0x6487('0x23'),_0x6487('0x24'),_0x6487('0x25'),_0x6487('0x26')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x6487('0xd')]('yes','no',_0x6487('0x27'),_0x6487('0x28'),_0x6487('0x29')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x6487('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x6487('0x1')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x6487('0x1')],'allowNull':!![]},'nat':{'type':Sequelize[_0x6487('0x1')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x53e715){this[_0x6487('0x2')]('nat',_0x53e715?_0x53e715[_0x6487('0x2a')](','):null);},'get':function(){return this[_0x6487('0x9')](_0x6487('0x2b'))?this['getDataValue'](_0x6487('0x2b'))[_0x6487('0x2c')](','):null;},'comment':_0x6487('0x2d')},'callgroup':{'type':Sequelize[_0x6487('0x1')]},'namedcallgroup':{'type':Sequelize[_0x6487('0x1')]},'pickupgroup':{'type':Sequelize[_0x6487('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x6487('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x6487('0x1')]},'disallow':{'type':Sequelize[_0x6487('0x1')],'allowNull':![],'defaultValue':_0x6487('0x2e')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6487('0x2f'),'set':function(_0x4de8c8){this[_0x6487('0x2')]('allow',_0x4de8c8?_0x4de8c8[_0x6487('0x2a')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x6487('0x9')](_0x6487('0x30'))?this[_0x6487('0x9')](_0x6487('0x30'))[_0x6487('0x2c')](';'):null;},'comment':_0x6487('0x31')},'autoframing':{'type':Sequelize[_0x6487('0xd')](_0x6487('0x32'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x3e6af0){this[_0x6487('0x2')](_0x6487('0x33'),_0x3e6af0?_0x3e6af0[_0x6487('0x2a')](','):null);},'get':function(){return this[_0x6487('0x9')](_0x6487('0x33'))?this['getDataValue'](_0x6487('0x33'))[_0x6487('0x2c')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x6487('0xd')](_0x6487('0x32'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x6487('0xd')](_0x6487('0x32'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x6487('0xd')](_0x6487('0x32'),'no',_0x6487('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x6487('0xd')](_0x6487('0x32'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x6487('0x32'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x6487('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x6487('0x1')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x6487('0x1')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x6487('0xd')](_0x6487('0x32'),'no'),'allowNull':!![],'defaultValue':_0x6487('0x32')},'busylevel':{'type':Sequelize[_0x6487('0x15')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x6487('0xd')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x6487('0xd')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x6487('0xd')](_0x6487('0x32'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x6487('0xd')](_0x6487('0x32'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x6487('0x1')],'allowNull':!![]},'template':{'type':Sequelize[_0x6487('0x1')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x6487('0xd')](_0x6487('0x32'),'no',_0x6487('0x35')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x6487('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x6487('0xd')](_0x6487('0x32'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x6487('0xd')]('accept',_0x6487('0x36'),_0x6487('0x37')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x6487('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x6487('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x6487('0xd')](_0x6487('0x38'),_0x6487('0x39')),'allowNull':!![],'defaultValue':_0x6487('0x39')},'t38pt_usertpsource':{'type':Sequelize[_0x6487('0x1')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x6487('0x1')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x6487('0x1')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x6487('0x1')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x6487('0xd')](_0x6487('0x32'),'no'),'allowNull':!![],'defaultValue':_0x6487('0x32')},'keepalive':{'type':Sequelize[_0x6487('0x15')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x6487('0x1')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x6487('0x1')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x6487('0x15')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x6487('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x6487('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x6487('0x1')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x6487('0x1')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x6487('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x6487('0x15')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x6487('0x1')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x6487('0x1')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x6487('0x1')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x6487('0x1')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x6487('0x1')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x6487('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x6487('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x6487('0xd')](_0x6487('0x32'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x6487('0xd')](_0x6487('0x32'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x6487('0xd')](_0x6487('0x32'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x6487('0xd')](_0x6487('0x32'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x6487('0xd')](_0x6487('0x32'),'no',_0x6487('0x3a'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x6487('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x6487('0x1')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x6487('0x1')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x6487('0x1')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x6487('0x1')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x6487('0xd')](_0x6487('0x3b'),_0x6487('0x3c'),_0x6487('0x3d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x6487('0x32'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x6487('0x1')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x6487('0x15')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x6487('0xd')](_0x6487('0x32'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x6487('0xd')](_0x6487('0x32'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x6487('0x1')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x6487('0x1')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM']('yes','no','nonat',_0x6487('0x28'),_0x6487('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x6487('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x6487('0x1')]},'resetPasswordExpires':{'type':Sequelize[_0x6487('0x13')]},'passwordResetAt':{'type':Sequelize[_0x6487('0x13')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x6487('0x3f')]},'showWebBar':{'type':Sequelize[_0x6487('0x15')],'defaultValue':0x0,'set':function(_0x4c9799){this['setDataValue'](_0x6487('0x40'),_0x4c9799);var _0x1bae08=this[_0x6487('0x41')]({'plain':!![]});switch(_0x4c9799){case 0x0:case 0x1:var _0x1585ae=_0x1bae08[_0x6487('0x20')]?_[_0x6487('0x42')](_0x1bae08[_0x6487('0x20')])?_0x1bae08[_0x6487('0x20')]['join']():_0x1bae08[_0x6487('0x20')]:_0x6487('0x43');if(_0x1585ae===_0x6487('0x44')){_0x1585ae=_0x6487('0x43');}this[_0x6487('0x2')](_0x6487('0x20'),_0x1585ae);this[_0x6487('0x2')](_0x6487('0x45'),'no');this['setDataValue']('avpf',null);this[_0x6487('0x2')](_0x6487('0x46'),null);this[_0x6487('0x2')](_0x6487('0x47'),null);this['setDataValue']('dtlsenable',null);this[_0x6487('0x2')](_0x6487('0x48'),null);this[_0x6487('0x2')](_0x6487('0x49'),null);this[_0x6487('0x2')](_0x6487('0x4a'),null);this[_0x6487('0x2')](_0x6487('0x4b'),null);this[_0x6487('0x2')](_0x6487('0x4c'),'no');break;case 0x2:this['setDataValue'](_0x6487('0x20'),_0x6487('0x44'));this[_0x6487('0x2')](_0x6487('0x45'),_0x6487('0x32'));this[_0x6487('0x2')](_0x6487('0x4d'),_0x6487('0x32'));this['setDataValue'](_0x6487('0x46'),'yes');this[_0x6487('0x2')](_0x6487('0x47'),_0x6487('0x32'));this[_0x6487('0x2')](_0x6487('0x4e'),'yes');this['setDataValue'](_0x6487('0x48'),'no');this[_0x6487('0x2')](_0x6487('0x49'),_0x6487('0x3d'));this[_0x6487('0x2')](_0x6487('0x4a'),_0x1bae08[_0x6487('0x4a')]||_0x6487('0x4f'));this[_0x6487('0x2')](_0x6487('0x4b'),_0x1bae08[_0x6487('0x4b')]||_0x6487('0x50'));this[_0x6487('0x2')](_0x6487('0x4c'),_0x6487('0x32'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x374135){this[_0x6487('0x2')](_0x6487('0x51'),_0x374135?_0x374135[_0x6487('0x2a')](','):[]);},'get':function(){return this['getDataValue'](_0x6487('0x51'))?_['map'](this[_0x6487('0x9')](_0x6487('0x51'))[_0x6487('0x2c')](','),function(_0x2fffa8){return parseInt(_0x2fffa8,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x6487('0x1')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x6487('0x1')]},'phoneBarBusyNumber':{'type':Sequelize[_0x6487('0x1')]},'phoneBarUnconditional':{'type':Sequelize[_0x6487('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x6487('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x6487('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x6487('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x6487('0x1')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x6487('0xd')](_0x6487('0x32'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x6487('0x1')]},'phoneBarEnableJaws':{'type':Sequelize[_0x6487('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x6487('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x6487('0x52')],'get':function(){return this['getDataValue'](_0x6487('0x53'))?this['getDataValue'](_0x6487('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x6487('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x6487('0x1')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x6487('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x6487('0x1')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x6487('0x12')],'defaultValue':![],'set':function(_0x3a6e6e){if(typeof _0x3a6e6e==='string'){var _0x7c6b3c=_0x3a6e6e==='1'?!![]:_0x3a6e6e==='0'?![]:_0x3a6e6e===_0x6487('0x54')?!![]:_0x3a6e6e===_0x6487('0x55')?![]:![];this['setDataValue'](_0x6487('0x56'),_0x7c6b3c);}else{this[_0x6487('0x2')](_0x6487('0x56'),_0x3a6e6e);}}},'blocked':{'type':Sequelize[_0x6487('0x12')],'defaultValue':![],'set':function(_0x3f7a41){this[_0x6487('0x2')](_0x6487('0x57'),_0x3f7a41);if(_0x3f7a41===!![]){this['setDataValue'](_0x6487('0x58'),moment());this['setDataValue'](_0x6487('0x59'),0x0);}else{this[_0x6487('0x2')](_0x6487('0x58'),null);}}},'blockedAt':{'type':Sequelize[_0x6487('0x13')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x6487('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x6487('0x12')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x6487('0x12')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x6487('0x15')](0x5)[_0x6487('0x5a')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x6487('0x12')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x6487('0x12')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x6487('0x12')],'defaultValue':![]}}; \ No newline at end of file +var _0x8135=['format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','admin','user','agent','INTEGER','BOOLEAN','DATE','DEFAULT\x20PAUSE','friend','from-sip','ENUM','ALLOWED_NOT_SCREENED','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','update','outgoing','yes','force_rport,comedia','nat','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','accept','refuse','uas','certificate','active','passive','actpass','update,nonat','TEXT','showWebBar','get','isArray','udp','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blockedAt','loginAttempts','moment','util','lodash','exports','name','setDataValue','STRING','fullname','callerid'];(function(_0x41d8c2,_0x3a7593){var _0x2a209b=function(_0x87303d){while(--_0x87303d){_0x41d8c2['push'](_0x41d8c2['shift']());}};_0x2a209b(++_0x3a7593);}(_0x8135,0x99));var _0x5813=function(_0x37a962,_0x4aac38){_0x37a962=_0x37a962-0x0;var _0x55573a=_0x8135[_0x37a962];return _0x55573a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5813('0x0'));var util=require(_0x5813('0x1'));var _=require(_0x5813('0x2'));module[_0x5813('0x3')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5813('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x196ea8){this[_0x5813('0x5')](_0x5813('0x4'),_0x196ea8);this[_0x5813('0x5')]('defaultuser',_0x196ea8);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x5813('0x6')],'allowNull':![],'set':function(_0x2cdde9){this[_0x5813('0x5')](_0x5813('0x7'),_0x2cdde9);this[_0x5813('0x5')](_0x5813('0x8'),util[_0x5813('0x9')](_0x5813('0xa'),_0x2cdde9,this[_0x5813('0xb')](_0x5813('0xc'))));}},'alias':{'type':Sequelize[_0x5813('0x6')]},'email':{'type':Sequelize[_0x5813('0x6')],'allowNull':![],'unique':_0x5813('0xd'),'validate':{'isEmail':!![]},'set':function(_0x1326c3){if(_0x1326c3){this[_0x5813('0x5')](_0x5813('0xd'),_0x1326c3[_0x5813('0xe')]());}}},'role':{'type':Sequelize['ENUM'](_0x5813('0xf'),_0x5813('0x10'),_0x5813('0x11'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x5813('0x6')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x5813('0x6')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x5813('0x12')](0xb),'allowNull':![],'unique':_0x5813('0xc'),'set':function(_0x57df76){this[_0x5813('0x5')](_0x5813('0xc'),_0x57df76);this[_0x5813('0x5')]('accountcode',_0x57df76);this[_0x5813('0x5')](_0x5813('0x8'),util['format'](_0x5813('0xa'),this['getDataValue']('fullname'),_0x57df76));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x5813('0x6')]},'zipcode':{'type':Sequelize[_0x5813('0x6')]},'userpic':{'type':Sequelize[_0x5813('0x6')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x5813('0x6')]},'online':{'type':Sequelize[_0x5813('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x5813('0x14')]},'voicePause':{'type':Sequelize[_0x5813('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x5813('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x5813('0x13')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x5813('0x13')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x5813('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x5813('0x6')],'defaultValue':_0x5813('0x15')},'lastPauseAt':{'type':Sequelize[_0x5813('0x14')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x5813('0x12')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x5813('0x12')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x5813('0x12')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x5813('0x12')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x5813('0x12')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x5813('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x5813('0x13')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x5813('0x12')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x5813('0x13')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x5813('0x12')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x5813('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x5813('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x5813('0x13')],'defaultValue':![]},'description':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![]},'host':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![]},'port':{'type':Sequelize[_0x5813('0x12')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x5813('0x12')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x5813('0x16'),_0x5813('0x10'),'peer'),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![],'defaultValue':_0x5813('0x17')},'callingpres':{'type':Sequelize[_0x5813('0x18')](_0x5813('0x19'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0x5813('0x1a'),_0x5813('0x1b'),_0x5813('0x1c'),'PROHIB_FAILED_SCREEN',_0x5813('0x1d')),'allowNull':!![]},'deny':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![]},'permit':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![]},'transport':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![],'defaultValue':'udp','set':function(_0x247ba1){this[_0x5813('0x5')](_0x5813('0x1e'),_0x247ba1?_0x247ba1[_0x5813('0x1f')](','):null);},'get':function(){return this[_0x5813('0xb')](_0x5813('0x1e'))?this[_0x5813('0xb')]('transport')[_0x5813('0x20')](','):null;},'comment':_0x5813('0x21')},'dtmfmode':{'type':Sequelize[_0x5813('0x18')](_0x5813('0x22'),_0x5813('0x23'),'shortinfo',_0x5813('0x24'),_0x5813('0x25')),'allowNull':!![],'defaultValue':_0x5813('0x22')},'directmedia':{'type':Sequelize[_0x5813('0x18')]('yes','no','nonat',_0x5813('0x26'),_0x5813('0x27')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x5813('0x18')](_0x5813('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x5813('0x29'),'set':function(_0x38f941){this[_0x5813('0x5')](_0x5813('0x2a'),_0x38f941?_0x38f941[_0x5813('0x1f')](','):null);},'get':function(){return this[_0x5813('0xb')](_0x5813('0x2a'))?this['getDataValue'](_0x5813('0x2a'))[_0x5813('0x20')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x5813('0x6')]},'namedcallgroup':{'type':Sequelize[_0x5813('0x6')]},'pickupgroup':{'type':Sequelize[_0x5813('0x6')]},'namedpickupgroup':{'type':Sequelize[_0x5813('0x6')]},'language':{'type':Sequelize[_0x5813('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x5813('0x6')]},'disallow':{'type':Sequelize[_0x5813('0x6')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x5813('0x6')],'allowNull':![],'defaultValue':_0x5813('0x2b'),'set':function(_0x262698){this[_0x5813('0x5')]('allow',_0x262698?_0x262698[_0x5813('0x1f')](';'):_0x5813('0x2b'));},'get':function(){return this[_0x5813('0xb')]('allow')?this[_0x5813('0xb')](_0x5813('0x2c'))['split'](';'):null;},'comment':_0x5813('0x2d')},'autoframing':{'type':Sequelize[_0x5813('0x18')](_0x5813('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![],'set':function(_0x2c49f0){this[_0x5813('0x5')]('insecure',_0x2c49f0?_0x2c49f0[_0x5813('0x1f')](','):null);},'get':function(){return this['getDataValue']('insecure')?this['getDataValue']('insecure')[_0x5813('0x20')](','):null;},'comment':_0x5813('0x2e')},'trustrpid':{'type':Sequelize[_0x5813('0x18')](_0x5813('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x5813('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x5813('0x18')](_0x5813('0x28'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x5813('0x18')](_0x5813('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x5813('0x18')](_0x5813('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x5813('0x12')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x5813('0x18')](_0x5813('0x28'),'no'),'allowNull':!![],'defaultValue':_0x5813('0x28')},'busylevel':{'type':Sequelize[_0x5813('0x12')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x5813('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x5813('0x18')](_0x5813('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x5813('0x18')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![]},'template':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x5813('0x18')](_0x5813('0x28'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x5813('0x12')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x5813('0x18')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x5813('0x2f'),_0x5813('0x30'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x5813('0x12')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x5813('0x12')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x5813('0x18')]('uac','uas'),'allowNull':!![],'defaultValue':_0x5813('0x31')},'t38pt_usertpsource':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x5813('0x18')]('yes','no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x5813('0x12')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x5813('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x5813('0x12')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x5813('0x18')](_0x5813('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x5813('0x12')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x5813('0x12')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x5813('0x12')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x5813('0x18')](_0x5813('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x5813('0x28'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x5813('0x18')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x5813('0x18')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x5813('0x18')](_0x5813('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x5813('0x18')]('yes','no','fingerprint',_0x5813('0x32')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x5813('0x12')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x5813('0x33'),_0x5813('0x34'),_0x5813('0x35')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x5813('0x18')](_0x5813('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x5813('0x12')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x5813('0x18')](_0x5813('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x5813('0x18')]('yes','no','nonat',_0x5813('0x26'),_0x5813('0x36')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x5813('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x5813('0x14')]},'passwordResetAt':{'type':Sequelize[_0x5813('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x5813('0x37')]},'showWebBar':{'type':Sequelize[_0x5813('0x12')],'defaultValue':0x0,'set':function(_0x3278f8){this[_0x5813('0x5')](_0x5813('0x38'),_0x3278f8);var _0x111fb1=this[_0x5813('0x39')]({'plain':!![]});switch(_0x3278f8){case 0x0:case 0x1:var _0x5f4708=_0x111fb1[_0x5813('0x1e')]?_[_0x5813('0x3a')](_0x111fb1[_0x5813('0x1e')])?_0x111fb1[_0x5813('0x1e')][_0x5813('0x1f')]():_0x111fb1[_0x5813('0x1e')]:_0x5813('0x3b');if(_0x5f4708===_0x5813('0x3c')){_0x5f4708=_0x5813('0x3b');}this[_0x5813('0x5')](_0x5813('0x1e'),_0x5f4708);this[_0x5813('0x5')](_0x5813('0x3d'),'no');this[_0x5813('0x5')](_0x5813('0x3e'),null);this['setDataValue'](_0x5813('0x3f'),null);this[_0x5813('0x5')](_0x5813('0x40'),null);this[_0x5813('0x5')](_0x5813('0x41'),null);this['setDataValue'](_0x5813('0x42'),null);this[_0x5813('0x5')](_0x5813('0x43'),null);this[_0x5813('0x5')](_0x5813('0x44'),null);this[_0x5813('0x5')](_0x5813('0x45'),null);this[_0x5813('0x5')](_0x5813('0x46'),'no');break;case 0x2:this[_0x5813('0x5')](_0x5813('0x1e'),_0x5813('0x3c'));this[_0x5813('0x5')](_0x5813('0x3d'),_0x5813('0x28'));this['setDataValue'](_0x5813('0x3e'),_0x5813('0x28'));this[_0x5813('0x5')](_0x5813('0x3f'),_0x5813('0x28'));this[_0x5813('0x5')](_0x5813('0x40'),_0x5813('0x28'));this[_0x5813('0x5')]('dtlsenable',_0x5813('0x28'));this[_0x5813('0x5')](_0x5813('0x42'),'no');this['setDataValue'](_0x5813('0x43'),_0x5813('0x35'));this['setDataValue'](_0x5813('0x44'),_0x111fb1['dtlscertfile']||_0x5813('0x47'));this['setDataValue'](_0x5813('0x45'),_0x111fb1[_0x5813('0x45')]||_0x5813('0x48'));this['setDataValue']('rtcp_mux','yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x2a5a7e){this[_0x5813('0x5')]('permissions',_0x2a5a7e?_0x2a5a7e[_0x5813('0x1f')](','):[]);},'get':function(){return this[_0x5813('0xb')](_0x5813('0x49'))?_['map'](this[_0x5813('0xb')](_0x5813('0x49'))[_0x5813('0x20')](','),function(_0x2c81c2){return parseInt(_0x2c81c2,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x5813('0x6')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x5813('0x6')]},'phoneBarUnconditional':{'type':Sequelize[_0x5813('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x5813('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x5813('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x5813('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x5813('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x5813('0x13')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x5813('0x12')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x5813('0x6')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x5813('0x12')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x5813('0x18')](_0x5813('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x5813('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x5813('0x6')]},'phoneBarEnableJaws':{'type':Sequelize[_0x5813('0x13')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x5813('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x5813('0x4a')],'get':function(){return this['getDataValue'](_0x5813('0x4b'))?this['getDataValue'](_0x5813('0x4b')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x5813('0x13')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x5813('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x5813('0x6')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x13d067){if(typeof _0x13d067===_0x5813('0x4c')){var _0x587a31=_0x13d067==='1'?!![]:_0x13d067==='0'?![]:_0x13d067==='true'?!![]:_0x13d067===_0x5813('0x4d')?![]:![];this['setDataValue'](_0x5813('0x4e'),_0x587a31);}else{this[_0x5813('0x5')]('screenrecording',_0x13d067);}}},'blocked':{'type':Sequelize[_0x5813('0x13')],'defaultValue':![],'set':function(_0x3ef427){this[_0x5813('0x5')]('blocked',_0x3ef427);if(_0x3ef427===!![]){this[_0x5813('0x5')](_0x5813('0x4f'),moment());this[_0x5813('0x5')](_0x5813('0x50'),0x0);}else{this[_0x5813('0x5')](_0x5813('0x4f'),null);}}},'blockedAt':{'type':Sequelize[_0x5813('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x5813('0x13')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x5813('0x13')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x5813('0x13')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index dcb9826..575f3fa 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 _0x1967=['limit','count','set','destroy','get','admin','Users','user','Agents','agent','Telephones','telephone','filter','ignore','value','includes','find','role','name','UserProfileResource','end','stack','send','index','User','map','type','getOptions','where','query','includeAll','attributes','push','rows','openTabs','true','fax','dataValues','mail','openchannel','whatsapp','all','show','differenceBy','keys','rawAttributes','salt','intersection','model','fields','length','include','merge','options','chat','catch','update','body','params','describe','addContacts','omit','ids','internal','Setting','findById','password','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','from','voicemail','mailbox','VoiceMail','fullname','101','102','103','110','105','106','108','111','114','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','settingsEnabled','userProfileId','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','checkUserLimits','isEmpty','autoAssociation','compact','oldPassword','newPassword','Sequelize','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','ValidationError','Wrong\x20credentials','Invalid\x20body\x20format.\x20Use\x20newPassword','securePassword','passwordHistoryLimit','validatePasswordPattern','enforcePasswordHistory','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','loginInPause','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','QueueId','emit','Queue:save','VoiceQueue','findAll','online','interface','format','SIP/%s','voicePause','each','UserVoiceQueueRt','upsert','removeQueues','remove','isArray','Queue:remove','voice','userpic','file','getAvatar','join','root','server/files/images/logos/default_profile.png','existsSync','download','server/files/images/','getOpenTabs','sms','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','getContacts','CmContact','filters','order','sort','pick','hasOwnProperty','CmList','Tag','Tags','color','tag','getQueues','Queue','nolimit','getVoiceQueuesRt','findOne','getGroups','ChatGroup','UserId','VoiceRecording','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','login','phone','LOCAL/%s@from-sip/n','intrf','user:%s','headers','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','device','LOGININPAUSE','MemberReport','concat','resolve','pause','QueuePause','PAUSE','DEFAULT\x20PAUSE','unpause','chatPause','faxPause','openchannelPause','smsPause','manual','getTeams','Team','addTeams','setDataValue','getChatQueues','Chat','getMailQueues','getSmsQueues','Sms','getWhatsappQueues','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','transaction','addAgent','getDataValue','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','flatten','removeAgent','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','spread','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','$and','$gt','$gte','$lt','$lte','$ne','$not','$in','$notIn','$like','$iLike','$notILike','$overlap','$contains','$contained','$any','CmHopper','Contact','dialActive','getApiKey','No\x20API\x20access\x20key\x20found!','createApiKey','iat','nonce','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','queues','teams','inbound','lower','col','toString','asc','desc','uniqBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','http','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','unavailable','ringing','busy','slice','charAt','SELECT','select','ui.','InteractionId','field','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/utils','../../config/environment','../../config/license/util','../../mysqldb','socket.io-emitter','redis','register','defaults','localhost','request','then','info','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','code','User,\x20%s,\x20%s','message','sendStatus','status','json','offset','undefined'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x1967,0x173));var _0x7196=function(_0x10a89f,_0x38ce5a){_0x10a89f=_0x10a89f-0x0;var _0x5b9248=_0x1967[_0x10a89f];return _0x5b9248;};'use strict';var moment=require('moment');var BPromise=require(_0x7196('0x0'));var util=require(_0x7196('0x1'));var path=require(_0x7196('0x2'));var fs=require('fs');var _=require(_0x7196('0x3'));var squel=require(_0x7196('0x4'));var jayson=require(_0x7196('0x5'));var Redis=require(_0x7196('0x6'));var authService=require(_0x7196('0x7'));var qs=require(_0x7196('0x8'));var logger=require(_0x7196('0x9'))('api');var utils=require(_0x7196('0xa'));var config=require(_0x7196('0xb'));var licenseUtil=require(_0x7196('0xc'));var db=require(_0x7196('0xd'))['db'];var socket=require(_0x7196('0xe'))(new Redis(config[_0x7196('0xf')]));require('./user.socket')[_0x7196('0x10')](socket);config[_0x7196('0xf')]=_[_0x7196('0x11')](config[_0x7196('0xf')],{'host':_0x7196('0x12'),'port':0x18eb});var client=jayson['client']['http']({'port':0x232a});var values;function respondWithRpcPromise(_0x2028dd,_0x10459b,_0x97bbff,_0x107759){return new BPromise(function(_0x25b780,_0x46f26c){var _0x1bf0a5=_0x107759||client;return _0x1bf0a5[_0x7196('0x13')](_0x2028dd,_0x97bbff)[_0x7196('0x14')](function(_0xba707b){logger[_0x7196('0x15')]('User,\x20%s,\x20%s',_0x10459b,_0x7196('0x16'));logger[_0x7196('0x17')](_0x7196('0x18'),_0x10459b,_0x7196('0x16'),JSON['stringify'](_0xba707b));if(_0xba707b[_0x7196('0x19')]){if(_0xba707b['error'][_0x7196('0x1a')]===0x1f4){logger[_0x7196('0x19')](_0x7196('0x1b'),_0x10459b,_0xba707b[_0x7196('0x19')][_0x7196('0x1c')]);return _0x46f26c(_0xba707b[_0x7196('0x19')][_0x7196('0x1c')]);}logger[_0x7196('0x19')](_0x7196('0x1b'),_0x10459b,_0xba707b[_0x7196('0x19')][_0x7196('0x1c')]);return _0x25b780(_0xba707b['error']['message']);}else{logger[_0x7196('0x15')](_0x7196('0x1b'),_0x10459b,_0x7196('0x16'));_0x25b780(_0xba707b['result'][_0x7196('0x1c')]);}})['catch'](function(_0x5b25f0){logger[_0x7196('0x19')](_0x7196('0x1b'),_0x10459b,_0x5b25f0);_0x46f26c(_0x5b25f0);});});}function respondWithStatusCode(_0x8dee9d,_0x4ddf78){_0x4ddf78=_0x4ddf78||0xcc;return function(_0x57c390){if(_0x57c390){return _0x8dee9d[_0x7196('0x1d')](_0x4ddf78);}return _0x8dee9d[_0x7196('0x1e')](_0x4ddf78)['end']();};}function respondWithResult(_0x18649b,_0x27ff84){_0x27ff84=_0x27ff84||0xc8;return function(_0x6e22e5){if(_0x6e22e5){return _0x18649b[_0x7196('0x1e')](_0x27ff84)[_0x7196('0x1f')](_0x6e22e5);}};}function respondWithFilteredResult(_0x549f34,_0x3f8178){return function(_0x520d01){if(_0x520d01){var _0x3ce9a0=typeof _0x3f8178[_0x7196('0x20')]===_0x7196('0x21')&&typeof _0x3f8178[_0x7196('0x22')]===_0x7196('0x21');var _0x43f6a2=_0x520d01['count'];var _0x57c404=_0x3ce9a0?0x0:_0x3f8178[_0x7196('0x20')];var _0x2d284f=_0x3ce9a0?_0x520d01[_0x7196('0x23')]:_0x3f8178['offset']+_0x3f8178['limit'];var _0x41cfd2;if(_0x2d284f>=_0x43f6a2){_0x2d284f=_0x43f6a2;_0x41cfd2=0xc8;}else{_0x41cfd2=0xce;}_0x549f34[_0x7196('0x1e')](_0x41cfd2);return _0x549f34[_0x7196('0x24')]('Content-Range',_0x57c404+'-'+_0x2d284f+'/'+_0x43f6a2)[_0x7196('0x1f')](_0x520d01);}return null;};}function saveUpdates(_0x4ecea1){return function(_0x4fd339){if(_0x4fd339){return _0x4fd339['update'](_0x4ecea1)[_0x7196('0x14')](function(_0x985727){return _0x985727;});}return null;};}function removeEntity(_0x1257ad){return function(_0x4f02b1){if(_0x4f02b1){return _0x4f02b1[_0x7196('0x25')]()[_0x7196('0x14')](function(){var _0x2f9583=_0x4f02b1[_0x7196('0x26')]({'plain':!![]});if(_0x2f9583['role']===_0x7196('0x27'))return;var _0x429160=[{'name':_0x7196('0x28'),'value':_0x7196('0x29'),'ignore':!![]},{'name':_0x7196('0x2a'),'value':_0x7196('0x2b'),'ignore':![]},{'name':_0x7196('0x2c'),'value':_0x7196('0x2d'),'ignore':![]}];var _0x354175=_(_0x429160)[_0x7196('0x2e')](_0x7196('0x2f'))['map'](_0x7196('0x30'))['value']();if(_[_0x7196('0x31')](_0x354175,_0x2f9583['role'])){return;}var _0x372ddc=_[_0x7196('0x32')](_0x429160,['value',_0x2f9583[_0x7196('0x33')]])[_0x7196('0x34')];return db[_0x7196('0x35')][_0x7196('0x25')]({'where':{'type':_0x372ddc,'resourceId':_0x2f9583['id']}})[_0x7196('0x14')](function(){return _0x4f02b1;});})['then'](function(){_0x1257ad[_0x7196('0x1e')](0xcc)[_0x7196('0x36')]();});}};}function handleEntityNotFound(_0x2174ca){return function(_0xf2b652){if(!_0xf2b652){_0x2174ca[_0x7196('0x1d')](0x194);}return _0xf2b652;};}function handleError(_0x123cad,_0x50a101){_0x50a101=_0x50a101||0x1f4;return function(_0x23d7aa){logger[_0x7196('0x19')](_0x23d7aa[_0x7196('0x37')]);if(_0x23d7aa['name']){delete _0x23d7aa[_0x7196('0x34')];}_0x123cad[_0x7196('0x1e')](_0x50a101)[_0x7196('0x38')](_0x23d7aa);};}exports[_0x7196('0x39')]=function(_0x11d4ec,_0x31fca7){var _0x938e49={},_0x1ab720={'count':0x0,'rows':[]};var _0x92cfb1=_(db[_0x7196('0x3a')]['rawAttributes'])[_0x7196('0x3b')](function(_0x17cefd){return{'name':_0x17cefd['fieldName'],'type':_0x17cefd[_0x7196('0x3c')]['key']};})['filter'](function(_0x301c42){return!_[_0x7196('0x31')](['password','salt'],_0x301c42[_0x7196('0x34')]);})[_0x7196('0x30')]();_0x938e49=qs[_0x7196('0x3d')](_0x92cfb1,_0x11d4ec);var _0x4c2341={'where':_0x938e49[_0x7196('0x3e')]};return db[_0x7196('0x3a')][_0x7196('0x23')](_0x4c2341)[_0x7196('0x14')](function(_0x16da09){_0x1ab720[_0x7196('0x23')]=_0x16da09;if(_0x11d4ec[_0x7196('0x3f')][_0x7196('0x40')]){_0x938e49['include']=[{'all':!![]}];}if(!_[_0x7196('0x31')](_0x938e49[_0x7196('0x41')],'id')){_0x938e49['attributes'][_0x7196('0x42')]('id');}return db[_0x7196('0x3a')]['findAll'](_0x938e49);})[_0x7196('0x14')](function(_0x471bb2){_0x1ab720[_0x7196('0x43')]=_0x471bb2;if(_0x11d4ec['query'][_0x7196('0x44')]===_0x7196('0x45')){var _0x54f6fc=[];for(var _0xcd287c=0x0;_0xcd287c<_0x1ab720[_0x7196('0x43')]['length'];_0xcd287c++){_0x54f6fc[_0x7196('0x42')](get_open_tabs('chat',_0x1ab720['rows'][_0xcd287c]['dataValues']));_0x54f6fc['push'](get_open_tabs('sms',_0x1ab720[_0x7196('0x43')][_0xcd287c]['dataValues']));_0x54f6fc[_0x7196('0x42')](get_open_tabs(_0x7196('0x46'),_0x1ab720[_0x7196('0x43')][_0xcd287c][_0x7196('0x47')]));_0x54f6fc['push'](get_open_tabs(_0x7196('0x48'),_0x1ab720['rows'][_0xcd287c][_0x7196('0x47')]));_0x54f6fc[_0x7196('0x42')](get_open_tabs(_0x7196('0x49'),_0x1ab720['rows'][_0xcd287c][_0x7196('0x47')]));_0x54f6fc[_0x7196('0x42')](get_open_tabs(_0x7196('0x4a'),_0x1ab720['rows'][_0xcd287c]['dataValues']));}return BPromise[_0x7196('0x4b')](_0x54f6fc)['then'](function(_0x29c7e8){return _0x1ab720;});}else{return _0x1ab720;}})['then'](respondWithFilteredResult(_0x31fca7,_0x938e49))['catch'](handleError(_0x31fca7,null));};exports[_0x7196('0x4c')]=function(_0x5de6f2,_0x48f5e7){var _0x516825={'raw':![],'where':{'id':_0x5de6f2['params']['id']}},_0x2299e2={};_0x2299e2['model']=_[_0x7196('0x4d')](_[_0x7196('0x4e')](db[_0x7196('0x3a')][_0x7196('0x4f')]),['password',_0x7196('0x50')]);_0x2299e2['query']=_[_0x7196('0x4e')](_0x5de6f2[_0x7196('0x3f')]);_0x2299e2['filters']=_[_0x7196('0x51')](_0x2299e2[_0x7196('0x52')],_0x2299e2[_0x7196('0x3f')]);_0x516825['attributes']=_[_0x7196('0x51')](_0x2299e2['model'],qs[_0x7196('0x53')](_0x5de6f2[_0x7196('0x3f')][_0x7196('0x53')]));_0x516825[_0x7196('0x41')]=_0x516825[_0x7196('0x41')][_0x7196('0x54')]?_0x516825[_0x7196('0x41')]:_0x2299e2[_0x7196('0x52')];if(_0x5de6f2['query']['includeAll']){_0x516825[_0x7196('0x55')]=[{'all':!![]}];}_0x516825=_[_0x7196('0x56')]({},_0x516825,_0x5de6f2[_0x7196('0x57')]);if(!_[_0x7196('0x31')](_0x516825['attributes'],'id')){_0x516825[_0x7196('0x41')][_0x7196('0x42')]('id');}return db[_0x7196('0x3a')][_0x7196('0x32')](_0x516825)[_0x7196('0x14')](handleEntityNotFound(_0x48f5e7,null))[_0x7196('0x14')](function(_0x7bc89f){var _0x18b49b=[];values=_0x7bc89f;if(_0x5de6f2[_0x7196('0x3f')][_0x7196('0x44')]===_0x7196('0x45')){_0x18b49b['push'](get_open_tabs(_0x7196('0x58'),_0x7bc89f[_0x7196('0x47')]));_0x18b49b[_0x7196('0x42')](get_open_tabs('sms',_0x7bc89f[_0x7196('0x47')]));_0x18b49b['push'](get_open_tabs(_0x7196('0x49'),_0x7bc89f[_0x7196('0x47')]));_0x18b49b[_0x7196('0x42')](get_open_tabs(_0x7196('0x4a'),_0x7bc89f[_0x7196('0x47')]));_0x18b49b['push'](get_open_tabs(_0x7196('0x46'),_0x7bc89f['dataValues']));_0x18b49b['push'](get_open_tabs('mail',_0x7bc89f[_0x7196('0x47')]));return BPromise[_0x7196('0x4b')](_0x18b49b);}else{return values;}})[_0x7196('0x14')](function(_0x35f342){return values;})[_0x7196('0x14')](respondWithResult(_0x48f5e7,null))[_0x7196('0x59')](handleError(_0x48f5e7,null));};exports[_0x7196('0x5a')]=function(_0x560ddb,_0x293467){if(_0x560ddb[_0x7196('0x5b')]['id']){delete _0x560ddb[_0x7196('0x5b')]['id'];}delete _0x560ddb[_0x7196('0x5b')][_0x7196('0x33')];return db['User']['find']({'where':{'id':_0x560ddb[_0x7196('0x5c')]['id']}})[_0x7196('0x14')](handleEntityNotFound(_0x293467,null))[_0x7196('0x14')](saveUpdates(_0x560ddb[_0x7196('0x5b')],null))[_0x7196('0x14')](respondWithResult(_0x293467,null))[_0x7196('0x59')](handleError(_0x293467,null));};exports[_0x7196('0x5d')]=function(_0x43ee13,_0x13e9d0){return db[_0x7196('0x3a')][_0x7196('0x5d')]()['then'](respondWithResult(_0x13e9d0,null))[_0x7196('0x59')](handleError(_0x13e9d0,null));};exports[_0x7196('0x5e')]=function(_0x27d5d7,_0x33f43b){return db['User'][_0x7196('0x32')]({'where':{'id':_0x27d5d7[_0x7196('0x5c')]['id']}})[_0x7196('0x14')](handleEntityNotFound(_0x33f43b,null))[_0x7196('0x14')](function(_0x3b12af){if(_0x3b12af){return _0x3b12af[_0x7196('0x5e')](_0x27d5d7[_0x7196('0x5b')]['ids'],_[_0x7196('0x5f')](_0x27d5d7[_0x7196('0x5b')],[_0x7196('0x60'),'id'])||{});}})[_0x7196('0x14')](respondWithResult(_0x33f43b,null))['catch'](handleError(_0x33f43b,null));};function validateUser(_0x418a7a){return new BPromise(function(_0x3809c4,_0x10f376){if(_0x418a7a[_0x7196('0x61')])return _0x3809c4(_0x418a7a);return db[_0x7196('0x62')][_0x7196('0x63')](0x1)[_0x7196('0x14')](function(_0x517dfb){if(_0x517dfb['securePassword'])authService['validatePasswordPattern'](_0x418a7a[_0x7196('0x64')]);db['User'][_0x7196('0x65')](_0x7196('0x61'))[_0x7196('0x14')](function(_0x37c7d4){if(_[_0x7196('0x66')](_0x37c7d4)){_0x418a7a[_0x7196('0x61')]=_0x517dfb[_0x7196('0x67')]||0x1;return;}if(_[_0x7196('0x66')](_0x517dfb[_0x7196('0x67')])||_0x517dfb['min_internal']===_0x37c7d4){_0x418a7a['internal']=_0x37c7d4+0x1;return;}if(_0x517dfb[_0x7196('0x67')]>_0x37c7d4){_0x418a7a[_0x7196('0x61')]=_0x517dfb[_0x7196('0x67')];return;}return db[_0x7196('0x68')][_0x7196('0x3f')](_0x7196('0x69'),{'type':db[_0x7196('0x68')][_0x7196('0x6a')]['SELECT']})['then'](function(_0x1a736a){if(_0x1a736a&&_0x1a736a['length']){for(var _0x30d114=0x0,_0x52f532=_0x1a736a[_0x7196('0x54')];_0x30d114<_0x52f532&&_[_0x7196('0x66')](_0x418a7a[_0x7196('0x61')]);_0x30d114++){if(_0x517dfb[_0x7196('0x67')]<=_0x1a736a[_0x30d114]['from']){_0x418a7a['internal']=_0x1a736a[_0x30d114][_0x7196('0x6b')];}else if(_0x517dfb['min_internal']>_0x1a736a[_0x30d114][_0x7196('0x6b')]&&_0x517dfb[_0x7196('0x67')]<=_0x1a736a[_0x30d114]['to']){_0x418a7a[_0x7196('0x61')]=_0x517dfb[_0x7196('0x67')];}}}if(_[_0x7196('0x66')](_0x418a7a[_0x7196('0x61')])){_0x418a7a['internal']=_0x37c7d4+0x1;}return _0x3809c4(_0x418a7a);});});})[_0x7196('0x59')](function(_0x25b862){_0x10f376(_0x25b862);});});}function updateUser(_0x41208b){return new BPromise(function(_0x294a4b,_0x1fb9cc){try{if(_0x41208b[_0x7196('0x6c')]){_0x41208b[_0x7196('0x6d')]=_0x41208b[_0x7196('0x61')];_0x41208b[_0x7196('0x6e')]={'mailbox':_0x41208b[_0x7196('0x61')],'password':_0x41208b[_0x7196('0x64')],'fullname':_0x41208b[_0x7196('0x6f')],'email':_0x41208b['email']};}if(_0x41208b[_0x7196('0x33')]===_0x7196('0x2b')){if(!_0x41208b['permissions'])_0x41208b['permissions']=[_0x7196('0x70'),_0x7196('0x71'),_0x7196('0x72'),'113',_0x7196('0x73'),'104',_0x7196('0x74'),_0x7196('0x75'),'107',_0x7196('0x76'),'109','100',_0x7196('0x77'),_0x7196('0x78'),_0x7196('0x79')];}_0x294a4b(_0x41208b);}catch(_0x53a2bb){_0x1fb9cc(_0x53a2bb);}});}exports[_0x7196('0x7a')]=function(_0x4dee0a,_0x20349c){if(_0x4dee0a[_0x7196('0x29')][_0x7196('0x33')]===_0x7196('0x2b'))throw new Error(_0x7196('0x7b'));if(_0x4dee0a['body'][_0x7196('0x33')]===_0x7196('0x29')&&_0x4dee0a[_0x7196('0x29')][_0x7196('0x33')]!==_0x7196('0x27')){throw new Error(_0x7196('0x7c'));}if(_0x4dee0a[_0x7196('0x5b')][_0x7196('0x33')]==='admin'&&_0x4dee0a[_0x7196('0x29')][_0x7196('0x33')]!==_0x7196('0x27')){throw new Error(_0x7196('0x7d'));}return licenseUtil['checkUserLimits']([_0x4dee0a[_0x7196('0x5b')]])[_0x7196('0x14')](function(){return validateUser(_0x4dee0a['body']);})[_0x7196('0x14')](function(_0x53d470){return updateUser(_0x53d470)[_0x7196('0x14')](function(_0x5318c1){if(_0x5318c1[_0x7196('0x33')]===_0x7196('0x27')){_0x5318c1['settingsEnabled']=_0x4dee0a[_0x7196('0x29')][_0x7196('0x7e')];delete _0x5318c1[_0x7196('0x7f')];}return _0x5318c1;});})['then'](function(_0x548ac9){return db[_0x7196('0x3a')]['create'](_0x548ac9,{'include':[{'model':db['VoiceMail'],'as':_0x7196('0x6e')}]});})[_0x7196('0x14')](function(_0xd7312c){if(_0x4dee0a['body'][_0x7196('0x33')]===_0x7196('0x29'))return _0xd7312c;if(_0x4dee0a[_0x7196('0x29')][_0x7196('0x33')]!==_0x7196('0x29'))return _0xd7312c;return db[_0x7196('0x80')][_0x7196('0x32')]({'where':{'name':_0xd7312c[_0x7196('0x33')]===_0x7196('0x2b')?_0x7196('0x2a'):_0x7196('0x2c'),'userProfileId':_0x4dee0a['user']['userProfileId']},'raw':!![]})[_0x7196('0x14')](function(_0x5d52a8){if(!_0x5d52a8||_0x5d52a8['autoAssociation']!=0x0)return _0xd7312c;return db[_0x7196('0x35')][_0x7196('0x7a')]({'name':_0xd7312c[_0x7196('0x34')],'resourceId':_0xd7312c['id'],'type':_0x5d52a8[_0x7196('0x34')],'sectionId':_0x5d52a8['id']},{})['then'](function(){return _0xd7312c;});})['catch'](function(_0x337717){logger[_0x7196('0x19')](_0x7196('0x81'),_0x337717);throw _0x337717;});})[_0x7196('0x14')](respondWithResult(_0x20349c,0xc9))['catch'](handleError(_0x20349c,null));};exports[_0x7196('0x82')]=function(_0x4afbee,_0x4e8ba8){var _0x2820ef=_0x4afbee[_0x7196('0x5b')];var _0x1e14da=[];if(_0x4afbee['user'][_0x7196('0x33')]===_0x7196('0x2b'))throw new Error(_0x7196('0x7b'));if(_[_0x7196('0x83')](_0x2820ef,[_0x7196('0x33'),_0x7196('0x29')])&&_0x4afbee[_0x7196('0x29')][_0x7196('0x33')]!=='admin'){throw new Error(_0x7196('0x7c'));}if(_[_0x7196('0x83')](_0x2820ef,[_0x7196('0x33'),_0x7196('0x27')])&&_0x4afbee[_0x7196('0x29')]['role']!==_0x7196('0x27')){throw new Error(_0x7196('0x84'));}return licenseUtil[_0x7196('0x85')](_0x2820ef)['then'](function(){return validateUser(_0x2820ef[0x0]);})[_0x7196('0x14')](function(){for(var _0x4b98de=0x1;_0x4b98de<_0x2820ef['length'];_0x4b98de++){var _0x1dcf93=_0x2820ef[_0x4b98de-0x1][_0x7196('0x61')];if(!_0x2820ef[_0x4b98de]['internal'])_0x2820ef[_0x4b98de][_0x7196('0x61')]=_0x1dcf93+0x1;_0x1e14da[_0x7196('0x42')](validateUser(_0x2820ef[_0x4b98de]));}return BPromise['all'](_0x1e14da);})[_0x7196('0x14')](function(){_0x1e14da=[];for(var _0xdd5f69=0x0;_0xdd5f69<_0x2820ef[_0x7196('0x54')];_0xdd5f69++){_0x1e14da[_0x7196('0x42')](updateUser(_0x2820ef[_0xdd5f69]));}return BPromise[_0x7196('0x4b')](_0x1e14da);})[_0x7196('0x14')](function(){return BPromise['each'](_0x2820ef,function(_0x3639be){return db[_0x7196('0x3a')][_0x7196('0x7a')](_0x3639be,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})['then'](function(_0x1ae7cb){_0x3639be['id']=_0x1ae7cb['id'];return _0x3639be;});});})[_0x7196('0x14')](function(_0x43e84b){if(_0x4afbee['body'][_0x7196('0x33')]==='user')return _0x43e84b;if(_0x4afbee[_0x7196('0x29')]['role']!==_0x7196('0x29'))return _0x43e84b;var _0x18bafa=_[_0x7196('0x83')](_0x43e84b,function(_0x369203){return _0x369203[_0x7196('0x33')]===_0x7196('0x2b')||_0x369203[_0x7196('0x33')]==='telephone';});if(!_0x18bafa)return _0x43e84b;return db[_0x7196('0x80')]['findAll']({'where':{'name':{'$or':['Agents','Telephones']},'userProfileId':_0x4afbee['user']['userProfileId']},'raw':!![]})[_0x7196('0x14')](function(_0x12b032){if(_[_0x7196('0x86')](_0x12b032)||!_['some'](_0x12b032,[_0x7196('0x87'),0x0]))return _0x43e84b;_0x1e14da=[];var _0x49bf7e=_(_0x12b032)['map'](function(_0x4f7717){if(_0x4f7717[_0x7196('0x87')]===0x1)return;return _0x4f7717['name']===_0x7196('0x2a')?_0x7196('0x2b'):_0x7196('0x2d');})[_0x7196('0x88')]()[_0x7196('0x30')]();for(var _0x36893a=0x0;_0x36893a<_0x43e84b[_0x7196('0x54')];_0x36893a++){if(!_[_0x7196('0x31')](_0x49bf7e,_0x43e84b[_0x36893a]['role']))return;var _0x377a27=_0x43e84b[_0x36893a][_0x7196('0x33')]===_0x7196('0x2b')?'Agents':_0x7196('0x2c');_0x1e14da[_0x7196('0x42')](db[_0x7196('0x35')]['create']({'name':_0x43e84b[_0x36893a][_0x7196('0x34')],'resourceId':_0x43e84b[_0x36893a]['id'],'type':_0x377a27,'sectionId':_[_0x7196('0x32')](_0x12b032,[_0x7196('0x34'),_0x377a27])['id']},{}));}return BPromise['all'](_0x1e14da);});})[_0x7196('0x14')](respondWithResult(_0x4e8ba8,0xc9))[_0x7196('0x59')](handleError(_0x4e8ba8,null));};exports['changePassword']=function(_0xfb40ad,_0x5db5f1){if(_0xfb40ad[_0x7196('0x5b')]['id']){delete _0xfb40ad[_0x7196('0x5b')]['id'];}return db['User'][_0x7196('0x32')]({'where':{'id':_0xfb40ad['params']['id']}})[_0x7196('0x14')](function(_0x2cae94){if(!_0x2cae94)return null;if(_0x2cae94['id']===_0xfb40ad[_0x7196('0x29')]['id']){if(!_0xfb40ad['body'][_0x7196('0x89')]||!_0xfb40ad[_0x7196('0x5b')][_0x7196('0x8a')]){throw new db[(_0x7196('0x8b'))]['ValidationError'](_0x7196('0x8c'));}if(!_0x2cae94[_0x7196('0x8d')](_0xfb40ad[_0x7196('0x5b')]['oldPassword'])){throw new db['Sequelize'][(_0x7196('0x8e'))](_0x7196('0x8f'));}if(_0xfb40ad[_0x7196('0x5b')][_0x7196('0x89')]===_0xfb40ad['body'][_0x7196('0x8a')]){throw new db['Sequelize'][(_0x7196('0x8e'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0xfb40ad[_0x7196('0x29')][_0x7196('0x33')]===_0x7196('0x27')){if(!_0xfb40ad[_0x7196('0x5b')][_0x7196('0x8a')]){throw new db[(_0x7196('0x8b'))][(_0x7196('0x8e'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0xfb40ad[_0x7196('0x29')][_0x7196('0x33')]===_0x7196('0x29')){if(!_0xfb40ad[_0x7196('0x5b')][_0x7196('0x8a')]){throw new db[(_0x7196('0x8b'))][(_0x7196('0x8e'))](_0x7196('0x90'));}if(_0x2cae94['role']!==_0x7196('0x2b')){throw new db[(_0x7196('0x8b'))]['ValidationError'](_0x7196('0x7b'));}}else{throw new db[(_0x7196('0x8b'))]['ValidationError'](_0x7196('0x7b'));}return _0x2cae94;})[_0x7196('0x14')](handleEntityNotFound(_0x5db5f1,null))[_0x7196('0x14')](function(_0x289d3a){return db['Setting']['findOne']({'attributes':['id',_0x7196('0x91'),'enforcePasswordHistory',_0x7196('0x92')]})[_0x7196('0x14')](function(_0x1663e1){if(_0x1663e1[_0x7196('0x91')])authService[_0x7196('0x93')](_0xfb40ad['body'][_0x7196('0x8a')]);if(!_0x1663e1[_0x7196('0x94')]||!_0x289d3a[_0x7196('0x95')])return _0x289d3a;authService[_0x7196('0x96')](_0xfb40ad[_0x7196('0x5b')][_0x7196('0x8a')],_0x289d3a[_0x7196('0x95')],_0x1663e1[_0x7196('0x92')]);return _0x289d3a;})[_0x7196('0x14')](saveUpdates({'password':_0xfb40ad['body']['newPassword'],'passwordResetAt':_0xfb40ad['user']['id']==_0xfb40ad[_0x7196('0x5c')]['id']?moment():null,'previousPasswords':authService[_0x7196('0x97')](_0xfb40ad[_0x7196('0x5b')][_0x7196('0x8a')],_0x289d3a[_0x7196('0x95')])},null));})[_0x7196('0x14')](respondWithResult(_0x5db5f1,null))[_0x7196('0x59')](handleError(_0x5db5f1,null));};exports[_0x7196('0x98')]=function(_0x5550b7,_0x50027f){var _0x4e5d47=_0x5550b7['body'][_0x7196('0x99')];return db[_0x7196('0x3a')][_0x7196('0x32')]({'where':{'id':_0x5550b7[_0x7196('0x5c')]['id']},'attributes':['id',_0x7196('0x34'),_0x7196('0x33'),'online',_0x7196('0x9a'),'voicePause','interface']})[_0x7196('0x14')](handleEntityNotFound(_0x50027f,null))['then'](function(_0x5f1525){if(_0x5f1525){if(!utils[_0x7196('0x9b')](_0x4e5d47)){throw new db['Sequelize'][(_0x7196('0x8e'))](_0x7196('0x9c'));}return _0x5f1525[_0x7196('0x9d')+_[_0x7196('0x9e')](_0x4e5d47[_0x7196('0x9f')]())+_0x7196('0xa0')](_0x5550b7['body'][_0x7196('0x60')],{'penalty':_0x5550b7[_0x7196('0x5b')][_0x7196('0xa1')]||0x0})['spread'](function(_0x5fdaf1){for(var _0x17904c=0x0;_0x17904c<_0x5550b7[_0x7196('0x5b')]['ids']['length'];_0x17904c+=0x1){var _0x2d1e7e={'UserId':Number(_0x5550b7[_0x7196('0x5c')]['id'])};_0x2d1e7e[_[_0x7196('0x9e')](_0x4e5d47[_0x7196('0x9f')]())+_0x7196('0xa2')]=Number(_0x5550b7[_0x7196('0x5b')][_0x7196('0x60')][_0x17904c]);socket[_0x7196('0xa3')](_0x7196('0x29')+_[_0x7196('0x9e')](_0x4e5d47['toLowerCase']())+_0x7196('0xa4'),_0x2d1e7e);}return _0x5fdaf1;})[_0x7196('0x14')](function(){if(_0x4e5d47==='voice'){return db[_0x7196('0xa5')][_0x7196('0xa6')]({'where':{'id':_0x5550b7['body'][_0x7196('0x60')]||[]},'raw':!![],'attributes':['id',_0x7196('0x34')]});}})[_0x7196('0x14')](function(_0xe3b75a){var _0x1e7a64=_0x5f1525[_0x7196('0x26')]({'plain':!![]});var _0x558113=[];if(_0x4e5d47==='voice'&&_0x1e7a64[_0x7196('0x33')]==='agent'&&_0x1e7a64[_0x7196('0xa7')]){for(var _0x23e3f0=0x0;_0x23e3f0<_0xe3b75a[_0x7196('0x54')];_0x23e3f0+=0x1){_0x558113['push']({'membername':_0x1e7a64[_0x7196('0x34')],'UserId':_0x1e7a64['id'],'queue_name':_0xe3b75a[_0x23e3f0][_0x7196('0x34')],'VoiceQueueId':_0xe3b75a[_0x23e3f0]['id'],'interface':_[_0x7196('0x66')](_0x1e7a64[_0x7196('0xa8')])?util[_0x7196('0xa9')](_0x7196('0xaa'),_0x1e7a64[_0x7196('0x34')]):_0x1e7a64[_0x7196('0xa8')],'paused':_0x1e7a64[_0x7196('0xab')]||![],'penalty':_0x5550b7['body'][_0x7196('0xa1')]||0x0});}return BPromise[_0x7196('0xac')](_0x558113,function(_0x928d2c){return db[_0x7196('0xad')][_0x7196('0xae')](_0x928d2c);});}return _0x5f1525;});}})[_0x7196('0x14')](respondWithStatusCode(_0x50027f,null))['catch'](handleError(_0x50027f,null));};exports[_0x7196('0xaf')]=function(_0x527ec2,_0x446cd2){var _0x11cad0;return db[_0x7196('0x3a')]['find']({'where':{'id':_0x527ec2['params']['id']},'attributes':['id',_0x7196('0x34'),_0x7196('0x33')]})[_0x7196('0x14')](handleEntityNotFound(_0x446cd2,null))[_0x7196('0x14')](function(_0x223d70){if(_0x223d70){_0x11cad0=_0x223d70;if(!_0x527ec2[_0x7196('0x3f')][_0x7196('0x99')]||!utils[_0x7196('0x9b')](_0x527ec2['query'][_0x7196('0x99')])){throw new db[(_0x7196('0x8b'))]['ValidationError'](_0x7196('0x9c'));}return _0x223d70[_0x7196('0xb0')+_[_0x7196('0x9e')](_0x527ec2['query'][_0x7196('0x99')][_0x7196('0x9f')]())+_0x7196('0xa0')](_0x527ec2[_0x7196('0x3f')][_0x7196('0x60')]);}})['then'](function(_0x4fabd7){if(_[_0x7196('0xb1')](_0x527ec2[_0x7196('0x3f')][_0x7196('0x60')])){for(var _0x189a63=0x0;_0x189a63<_0x527ec2[_0x7196('0x3f')][_0x7196('0x60')]['length'];_0x189a63+=0x1){var _0x409d1b={'UserId':Number(_0x527ec2[_0x7196('0x5c')]['id'])};_0x409d1b[_[_0x7196('0x9e')](_0x527ec2[_0x7196('0x3f')]['channel'][_0x7196('0x9f')]())+_0x7196('0xa2')]=Number(_0x527ec2[_0x7196('0x3f')][_0x7196('0x60')][_0x189a63]);socket[_0x7196('0xa3')](_0x7196('0x29')+_[_0x7196('0x9e')](_0x527ec2[_0x7196('0x3f')][_0x7196('0x99')][_0x7196('0x9f')]())+_0x7196('0xb2'),_0x409d1b);}}else{var _0x409d1b={'UserId':Number(_0x527ec2['params']['id'])};_0x409d1b[_[_0x7196('0x9e')](_0x527ec2['query'][_0x7196('0x99')]['toLowerCase']())+_0x7196('0xa2')]=Number(_0x527ec2['query'][_0x7196('0x60')]);socket[_0x7196('0xa3')](_0x7196('0x29')+_[_0x7196('0x9e')](_0x527ec2['query'][_0x7196('0x99')][_0x7196('0x9f')]())+_0x7196('0xb2'),_0x409d1b);}return _0x4fabd7;})['then'](function(){if(_0x527ec2[_0x7196('0x3f')][_0x7196('0x99')]===_0x7196('0xb3')){return db['UserVoiceQueueRt'][_0x7196('0x25')]({'where':{'UserId':_0x527ec2[_0x7196('0x5c')]['id'],'VoiceQueueId':_0x527ec2[_0x7196('0x3f')]['ids']},'individualHooks':!![]})[_0x7196('0x14')](function(){return _0x11cad0;});}return _0x11cad0;})[_0x7196('0x14')](respondWithStatusCode(_0x446cd2,null))[_0x7196('0x59')](handleError(_0x446cd2,null));};exports['addAvatar']=function(_0x53fe08,_0x4a045c){_0x53fe08['body'][_0x7196('0xb4')]=_0x53fe08[_0x7196('0xb5')]['filename'];return db[_0x7196('0x3a')][_0x7196('0x32')]({'where':{'id':_0x53fe08[_0x7196('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4a045c,null))['then'](saveUpdates(_0x53fe08[_0x7196('0x5b')],null))[_0x7196('0x14')](respondWithResult(_0x4a045c,null))[_0x7196('0x59')](handleError(_0x4a045c,null));};exports[_0x7196('0xb6')]=function(_0x29ec00,_0x48e055){var _0x3f2bc9=path[_0x7196('0xb7')](config[_0x7196('0xb8')],_0x7196('0xb9'));return db['User']['find']({'where':{'id':_0x29ec00[_0x7196('0x5c')]['id']},'attributes':['id',_0x7196('0xb4')],'raw':!![]})[_0x7196('0x14')](handleEntityNotFound(_0x48e055,null))[_0x7196('0x14')](function(_0x1825c8){if(_0x1825c8){if(_[_0x7196('0x66')](_0x1825c8['userpic'])){return _0x48e055['download'](_0x3f2bc9);}else{if(!fs[_0x7196('0xba')](path[_0x7196('0xb7')](config[_0x7196('0xb8')],'server/files/images/',_0x1825c8['userpic']))){return _0x48e055[_0x7196('0xbb')](_0x3f2bc9);}return _0x48e055['download'](path[_0x7196('0xb7')](config[_0x7196('0xb8')],_0x7196('0xbc'),_0x1825c8[_0x7196('0xb4')]));}}})[_0x7196('0x59')](handleError(_0x48e055,null));};exports[_0x7196('0xbd')]=function(_0x2ed123,_0x459406){return db[_0x7196('0x3a')][_0x7196('0x32')]({'where':{'id':_0x2ed123['params']['id']},'attributes':['id']})[_0x7196('0x14')](handleEntityNotFound(_0x459406,null))['then'](function(_0xa31695){var _0x14e094=[];values=_0xa31695[_0x7196('0x47')];_0x14e094[_0x7196('0x42')](get_open_tabs('chat',_0xa31695['dataValues']));_0x14e094[_0x7196('0x42')](get_open_tabs(_0x7196('0xbe'),_0xa31695[_0x7196('0x47')]));_0x14e094[_0x7196('0x42')](get_open_tabs('openchannel',_0xa31695['dataValues']));_0x14e094[_0x7196('0x42')](get_open_tabs(_0x7196('0x4a'),_0xa31695['dataValues']));_0x14e094[_0x7196('0x42')](get_open_tabs(_0x7196('0x46'),_0xa31695['dataValues']));_0x14e094[_0x7196('0x42')](get_open_tabs(_0x7196('0x48'),_0xa31695[_0x7196('0x47')]));return BPromise[_0x7196('0x4b')](_0x14e094);})[_0x7196('0x14')](function(_0x318240){var _0x33ab3c=[];if(_0x318240){for(var _0x167e87=0x0;_0x167e87=_0x3c5fe4){_0x611764=_0x3c5fe4;_0x42413c=0xc8;}else{_0x42413c=0xce;}_0x1fa4ac[_0x86d3('0x1c')](_0x42413c);return _0x1fa4ac[_0x86d3('0x21')](_0x86d3('0x22'),_0x481077+'-'+_0x611764+'/'+_0x3c5fe4)[_0x86d3('0x1d')](_0x58ba51);}return null;};}function saveUpdates(_0x14c9ff){return function(_0x1f203e){if(_0x1f203e){return _0x1f203e[_0x86d3('0x23')](_0x14c9ff)[_0x86d3('0x11')](function(_0x44dacf){return _0x44dacf;});}return null;};}function removeEntity(_0x206996){return function(_0x1666af){if(_0x1666af){return _0x1666af[_0x86d3('0x24')]()[_0x86d3('0x11')](function(){var _0x5b09f6=_0x1666af[_0x86d3('0x25')]({'plain':!![]});if(_0x5b09f6[_0x86d3('0x26')]===_0x86d3('0x27'))return;var _0x31cefe=[{'name':_0x86d3('0x28'),'value':_0x86d3('0x29'),'ignore':!![]},{'name':'Agents','value':_0x86d3('0x2a'),'ignore':![]},{'name':'Telephones','value':'telephone','ignore':![]}];var _0x20fa21=_(_0x31cefe)[_0x86d3('0x2b')](_0x86d3('0x2c'))['map'](_0x86d3('0x2d'))[_0x86d3('0x2d')]();if(_['includes'](_0x20fa21,_0x5b09f6[_0x86d3('0x26')])){return;}var _0x375264=_[_0x86d3('0x2e')](_0x31cefe,[_0x86d3('0x2d'),_0x5b09f6[_0x86d3('0x26')]])[_0x86d3('0x2f')];return db[_0x86d3('0x30')][_0x86d3('0x24')]({'where':{'type':_0x375264,'resourceId':_0x5b09f6['id']}})['then'](function(){return _0x1666af;});})['then'](function(){_0x206996['status'](0xcc)[_0x86d3('0x1b')]();});}};}function handleEntityNotFound(_0x5990eb){return function(_0x15926f){if(!_0x15926f){_0x5990eb['sendStatus'](0x194);}return _0x15926f;};}function handleError(_0x366943,_0x3b739b){_0x3b739b=_0x3b739b||0x1f4;return function(_0x452d49){logger[_0x86d3('0x17')](_0x452d49[_0x86d3('0x31')]);if(_0x452d49[_0x86d3('0x2f')]){delete _0x452d49[_0x86d3('0x2f')];}_0x366943['status'](_0x3b739b)[_0x86d3('0x32')](_0x452d49);};}exports[_0x86d3('0x33')]=function(_0x5e2519,_0x178fc6){var _0x3e115d={},_0x3ff0fd={'count':0x0,'rows':[]};var _0x8bfd46=_(db['User'][_0x86d3('0x34')])[_0x86d3('0x35')](function(_0x2e01ff){return{'name':_0x2e01ff['fieldName'],'type':_0x2e01ff[_0x86d3('0x36')][_0x86d3('0x37')]};})[_0x86d3('0x2b')](function(_0x1be818){return!_[_0x86d3('0x38')]([_0x86d3('0x39'),_0x86d3('0x3a')],_0x1be818[_0x86d3('0x2f')]);})['value']();_0x3e115d=qs[_0x86d3('0x3b')](_0x8bfd46,_0x5e2519);var _0x470978={'where':_0x3e115d[_0x86d3('0x3c')]};return db[_0x86d3('0x3d')]['count'](_0x470978)[_0x86d3('0x11')](function(_0x8ff605){_0x3ff0fd[_0x86d3('0x3e')]=_0x8ff605;if(_0x5e2519[_0x86d3('0x3f')]['includeAll']){_0x3e115d['include']=[{'all':!![]}];}if(!_[_0x86d3('0x38')](_0x3e115d['attributes'],'id')){_0x3e115d['attributes'][_0x86d3('0x40')]('id');}return db[_0x86d3('0x3d')][_0x86d3('0x41')](_0x3e115d);})[_0x86d3('0x11')](function(_0x23ef72){_0x3ff0fd['rows']=_0x23ef72;if(_0x5e2519[_0x86d3('0x3f')][_0x86d3('0x42')]===_0x86d3('0x43')){var _0x584dc8=[];for(var _0x39d6cd=0x0;_0x39d6cd<_0x3ff0fd[_0x86d3('0x44')]['length'];_0x39d6cd++){_0x584dc8[_0x86d3('0x40')](get_open_tabs(_0x86d3('0x45'),_0x3ff0fd['rows'][_0x39d6cd]['dataValues']));_0x584dc8['push'](get_open_tabs(_0x86d3('0x46'),_0x3ff0fd[_0x86d3('0x44')][_0x39d6cd][_0x86d3('0x47')]));_0x584dc8[_0x86d3('0x40')](get_open_tabs(_0x86d3('0x48'),_0x3ff0fd[_0x86d3('0x44')][_0x39d6cd]['dataValues']));_0x584dc8[_0x86d3('0x40')](get_open_tabs(_0x86d3('0x49'),_0x3ff0fd['rows'][_0x39d6cd][_0x86d3('0x47')]));_0x584dc8[_0x86d3('0x40')](get_open_tabs(_0x86d3('0x4a'),_0x3ff0fd[_0x86d3('0x44')][_0x39d6cd][_0x86d3('0x47')]));_0x584dc8[_0x86d3('0x40')](get_open_tabs('whatsapp',_0x3ff0fd[_0x86d3('0x44')][_0x39d6cd][_0x86d3('0x47')]));}return BPromise['all'](_0x584dc8)[_0x86d3('0x11')](function(_0x412d0e){return _0x3ff0fd;});}else{return _0x3ff0fd;}})[_0x86d3('0x11')](respondWithFilteredResult(_0x178fc6,_0x3e115d))[_0x86d3('0x4b')](handleError(_0x178fc6,null));};exports[_0x86d3('0x4c')]=function(_0x48f8a2,_0x97c5b8){var _0x3e6620={'raw':![],'where':{'id':_0x48f8a2[_0x86d3('0x4d')]['id']}},_0x3226b5={};_0x3226b5[_0x86d3('0x4e')]=_[_0x86d3('0x4f')](_[_0x86d3('0x50')](db[_0x86d3('0x3d')][_0x86d3('0x34')]),[_0x86d3('0x39'),_0x86d3('0x3a')]);_0x3226b5[_0x86d3('0x3f')]=_['keys'](_0x48f8a2[_0x86d3('0x3f')]);_0x3226b5[_0x86d3('0x51')]=_['intersection'](_0x3226b5[_0x86d3('0x4e')],_0x3226b5[_0x86d3('0x3f')]);_0x3e6620[_0x86d3('0x52')]=_[_0x86d3('0x53')](_0x3226b5[_0x86d3('0x4e')],qs[_0x86d3('0x54')](_0x48f8a2['query']['fields']));_0x3e6620['attributes']=_0x3e6620['attributes'][_0x86d3('0x55')]?_0x3e6620[_0x86d3('0x52')]:_0x3226b5[_0x86d3('0x4e')];if(_0x48f8a2[_0x86d3('0x3f')][_0x86d3('0x56')]){_0x3e6620[_0x86d3('0x57')]=[{'all':!![]}];}_0x3e6620=_[_0x86d3('0x58')]({},_0x3e6620,_0x48f8a2['options']);if(!_[_0x86d3('0x38')](_0x3e6620[_0x86d3('0x52')],'id')){_0x3e6620[_0x86d3('0x52')][_0x86d3('0x40')]('id');}return db[_0x86d3('0x3d')][_0x86d3('0x2e')](_0x3e6620)[_0x86d3('0x11')](handleEntityNotFound(_0x97c5b8,null))['then'](function(_0x258eed){var _0x50a1ed=[];values=_0x258eed;if(_0x48f8a2[_0x86d3('0x3f')][_0x86d3('0x42')]===_0x86d3('0x43')){_0x50a1ed[_0x86d3('0x40')](get_open_tabs(_0x86d3('0x45'),_0x258eed['dataValues']));_0x50a1ed[_0x86d3('0x40')](get_open_tabs(_0x86d3('0x46'),_0x258eed[_0x86d3('0x47')]));_0x50a1ed['push'](get_open_tabs('openchannel',_0x258eed['dataValues']));_0x50a1ed[_0x86d3('0x40')](get_open_tabs('whatsapp',_0x258eed[_0x86d3('0x47')]));_0x50a1ed[_0x86d3('0x40')](get_open_tabs(_0x86d3('0x48'),_0x258eed[_0x86d3('0x47')]));_0x50a1ed['push'](get_open_tabs('mail',_0x258eed['dataValues']));return BPromise[_0x86d3('0x59')](_0x50a1ed);}else{return values;}})[_0x86d3('0x11')](function(_0x5a7b69){return values;})[_0x86d3('0x11')](respondWithResult(_0x97c5b8,null))[_0x86d3('0x4b')](handleError(_0x97c5b8,null));};exports[_0x86d3('0x23')]=function(_0x4584e5,_0x3fdce3){if(_0x4584e5['body']['id']){delete _0x4584e5[_0x86d3('0x5a')]['id'];}delete _0x4584e5[_0x86d3('0x5a')][_0x86d3('0x26')];return db[_0x86d3('0x3d')]['find']({'where':{'id':_0x4584e5[_0x86d3('0x4d')]['id']}})[_0x86d3('0x11')](handleEntityNotFound(_0x3fdce3,null))['then'](saveUpdates(_0x4584e5[_0x86d3('0x5a')],null))[_0x86d3('0x11')](respondWithResult(_0x3fdce3,null))[_0x86d3('0x4b')](handleError(_0x3fdce3,null));};exports[_0x86d3('0x5b')]=function(_0x4598d4,_0x4029a4){return db[_0x86d3('0x3d')]['describe']()['then'](respondWithResult(_0x4029a4,null))[_0x86d3('0x4b')](handleError(_0x4029a4,null));};exports['addContacts']=function(_0x528ca8,_0x58e4b6){return db[_0x86d3('0x3d')]['find']({'where':{'id':_0x528ca8[_0x86d3('0x4d')]['id']}})['then'](handleEntityNotFound(_0x58e4b6,null))[_0x86d3('0x11')](function(_0x1c2e06){if(_0x1c2e06){return _0x1c2e06[_0x86d3('0x5c')](_0x528ca8['body']['ids'],_[_0x86d3('0x5d')](_0x528ca8[_0x86d3('0x5a')],[_0x86d3('0x5e'),'id'])||{});}})[_0x86d3('0x11')](respondWithResult(_0x58e4b6,null))[_0x86d3('0x4b')](handleError(_0x58e4b6,null));};function validateUser(_0x1952af){return new BPromise(function(_0x24daf3,_0x27b8f6){if(_0x1952af[_0x86d3('0x5f')])return _0x24daf3(_0x1952af);return db[_0x86d3('0x60')][_0x86d3('0x61')](0x1)[_0x86d3('0x11')](function(_0xfaf168){if(_0xfaf168[_0x86d3('0x62')])authService[_0x86d3('0x63')](_0x1952af[_0x86d3('0x39')]);db[_0x86d3('0x3d')][_0x86d3('0x64')]('internal')[_0x86d3('0x11')](function(_0x365802){if(_[_0x86d3('0x65')](_0x365802)){_0x1952af['internal']=_0xfaf168[_0x86d3('0x66')]||0x1;return;}if(_[_0x86d3('0x65')](_0xfaf168[_0x86d3('0x66')])||_0xfaf168[_0x86d3('0x66')]===_0x365802){_0x1952af['internal']=_0x365802+0x1;return;}if(_0xfaf168[_0x86d3('0x66')]>_0x365802){_0x1952af['internal']=_0xfaf168[_0x86d3('0x66')];return;}return db[_0x86d3('0x67')][_0x86d3('0x3f')](_0x86d3('0x68'),{'type':db[_0x86d3('0x67')]['QueryTypes'][_0x86d3('0x69')]})['then'](function(_0x1ddd6d){if(_0x1ddd6d&&_0x1ddd6d[_0x86d3('0x55')]){for(var _0x5866fe=0x0,_0x2fdd03=_0x1ddd6d[_0x86d3('0x55')];_0x5866fe<_0x2fdd03&&_[_0x86d3('0x65')](_0x1952af[_0x86d3('0x5f')]);_0x5866fe++){if(_0xfaf168[_0x86d3('0x66')]<=_0x1ddd6d[_0x5866fe][_0x86d3('0x6a')]){_0x1952af[_0x86d3('0x5f')]=_0x1ddd6d[_0x5866fe]['from'];}else if(_0xfaf168[_0x86d3('0x66')]>_0x1ddd6d[_0x5866fe][_0x86d3('0x6a')]&&_0xfaf168[_0x86d3('0x66')]<=_0x1ddd6d[_0x5866fe]['to']){_0x1952af[_0x86d3('0x5f')]=_0xfaf168[_0x86d3('0x66')];}}}if(_['isNil'](_0x1952af[_0x86d3('0x5f')])){_0x1952af[_0x86d3('0x5f')]=_0x365802+0x1;}return _0x24daf3(_0x1952af);});});})['catch'](function(_0x3d8965){_0x27b8f6(_0x3d8965);});});}function updateUser(_0x42a16c){return new BPromise(function(_0x97d16a,_0x7710d8){try{if(_0x42a16c[_0x86d3('0x6b')]){_0x42a16c[_0x86d3('0x6c')]=_0x42a16c[_0x86d3('0x5f')];_0x42a16c[_0x86d3('0x6d')]={'mailbox':_0x42a16c[_0x86d3('0x5f')],'password':_0x42a16c[_0x86d3('0x39')],'fullname':_0x42a16c[_0x86d3('0x6e')],'email':_0x42a16c[_0x86d3('0x6f')]};}if(_0x42a16c[_0x86d3('0x26')]===_0x86d3('0x2a')){if(!_0x42a16c['permissions'])_0x42a16c[_0x86d3('0x70')]=[_0x86d3('0x71'),_0x86d3('0x72'),_0x86d3('0x73'),'113',_0x86d3('0x74'),_0x86d3('0x75'),_0x86d3('0x76'),_0x86d3('0x77'),'107','108',_0x86d3('0x78'),'100',_0x86d3('0x79'),'114','115'];}_0x97d16a(_0x42a16c);}catch(_0x199947){_0x7710d8(_0x199947);}});}exports[_0x86d3('0x7a')]=function(_0x3cb04d,_0x357398){if(_0x3cb04d[_0x86d3('0x29')]['role']===_0x86d3('0x2a'))throw new Error(_0x86d3('0x7b'));if(_0x3cb04d['body'][_0x86d3('0x26')]===_0x86d3('0x29')&&_0x3cb04d['user'][_0x86d3('0x26')]!=='admin'){throw new Error(_0x86d3('0x7c'));}if(_0x3cb04d['body']['role']===_0x86d3('0x27')&&_0x3cb04d['user'][_0x86d3('0x26')]!==_0x86d3('0x27')){throw new Error(_0x86d3('0x7d'));}return licenseUtil[_0x86d3('0x7e')]([_0x3cb04d[_0x86d3('0x5a')]])[_0x86d3('0x11')](function(){return validateUser(_0x3cb04d[_0x86d3('0x5a')]);})[_0x86d3('0x11')](function(_0x566a91){return updateUser(_0x566a91)[_0x86d3('0x11')](function(_0x158f56){if(_0x158f56[_0x86d3('0x26')]===_0x86d3('0x27')){_0x158f56[_0x86d3('0x7f')]=_0x3cb04d['user'][_0x86d3('0x7f')];delete _0x158f56[_0x86d3('0x80')];}return _0x158f56;});})[_0x86d3('0x11')](function(_0x302240){return db[_0x86d3('0x3d')][_0x86d3('0x7a')](_0x302240,{'include':[{'model':db[_0x86d3('0x6d')],'as':'VoiceMail'}]});})[_0x86d3('0x11')](function(_0x51884a){if(_0x3cb04d[_0x86d3('0x5a')]['role']==='user')return _0x51884a;if(_0x3cb04d[_0x86d3('0x29')][_0x86d3('0x26')]!=='user')return _0x51884a;return db[_0x86d3('0x81')][_0x86d3('0x2e')]({'where':{'name':_0x51884a[_0x86d3('0x26')]===_0x86d3('0x2a')?_0x86d3('0x82'):_0x86d3('0x83'),'userProfileId':_0x3cb04d[_0x86d3('0x29')]['userProfileId']},'raw':!![]})['then'](function(_0x2eeddc){if(!_0x2eeddc||_0x2eeddc[_0x86d3('0x84')]!=0x0)return _0x51884a;return db[_0x86d3('0x30')][_0x86d3('0x7a')]({'name':_0x51884a[_0x86d3('0x2f')],'resourceId':_0x51884a['id'],'type':_0x2eeddc[_0x86d3('0x2f')],'sectionId':_0x2eeddc['id']},{})['then'](function(){return _0x51884a;});})[_0x86d3('0x4b')](function(_0x14ffa9){logger[_0x86d3('0x17')](_0x86d3('0x85'),_0x14ffa9);throw _0x14ffa9;});})[_0x86d3('0x11')](respondWithResult(_0x357398,0xc9))[_0x86d3('0x4b')](handleError(_0x357398,null));};exports[_0x86d3('0x86')]=function(_0x2a9b06,_0x15dfa1){var _0x5948e1=_0x2a9b06[_0x86d3('0x5a')];var _0x458526=[];if(_0x2a9b06['user']['role']===_0x86d3('0x2a'))throw new Error(_0x86d3('0x7b'));if(_[_0x86d3('0x87')](_0x5948e1,['role',_0x86d3('0x29')])&&_0x2a9b06[_0x86d3('0x29')][_0x86d3('0x26')]!==_0x86d3('0x27')){throw new Error(_0x86d3('0x7c'));}if(_['some'](_0x5948e1,[_0x86d3('0x26'),_0x86d3('0x27')])&&_0x2a9b06['user'][_0x86d3('0x26')]!==_0x86d3('0x27')){throw new Error(_0x86d3('0x88'));}return licenseUtil[_0x86d3('0x7e')](_0x5948e1)['then'](function(){return validateUser(_0x5948e1[0x0]);})[_0x86d3('0x11')](function(){for(var _0x2896e1=0x1;_0x2896e1<_0x5948e1[_0x86d3('0x55')];_0x2896e1++){var _0x18295c=_0x5948e1[_0x2896e1-0x1][_0x86d3('0x5f')];if(!_0x5948e1[_0x2896e1]['internal'])_0x5948e1[_0x2896e1][_0x86d3('0x5f')]=_0x18295c+0x1;_0x458526[_0x86d3('0x40')](validateUser(_0x5948e1[_0x2896e1]));}return BPromise[_0x86d3('0x59')](_0x458526);})[_0x86d3('0x11')](function(){_0x458526=[];for(var _0x1093a1=0x0;_0x1093a1<_0x5948e1[_0x86d3('0x55')];_0x1093a1++){_0x458526[_0x86d3('0x40')](updateUser(_0x5948e1[_0x1093a1]));}return BPromise[_0x86d3('0x59')](_0x458526);})[_0x86d3('0x11')](function(){return BPromise[_0x86d3('0x89')](_0x5948e1,function(_0x537e2c){return db['User'][_0x86d3('0x7a')](_0x537e2c,{'include':[{'model':db[_0x86d3('0x6d')],'as':'VoiceMail'}]})[_0x86d3('0x11')](function(_0x71d3d7){_0x537e2c['id']=_0x71d3d7['id'];return _0x537e2c;});});})[_0x86d3('0x11')](function(_0x362b2e){if(_0x2a9b06[_0x86d3('0x5a')][_0x86d3('0x26')]===_0x86d3('0x29'))return _0x362b2e;if(_0x2a9b06[_0x86d3('0x29')][_0x86d3('0x26')]!=='user')return _0x362b2e;var _0x4c2d40=_['some'](_0x362b2e,function(_0x5b583e){return _0x5b583e[_0x86d3('0x26')]===_0x86d3('0x2a')||_0x5b583e[_0x86d3('0x26')]===_0x86d3('0x8a');});if(!_0x4c2d40)return _0x362b2e;return db[_0x86d3('0x81')][_0x86d3('0x41')]({'where':{'name':{'$or':[_0x86d3('0x82'),'Telephones']},'userProfileId':_0x2a9b06[_0x86d3('0x29')][_0x86d3('0x80')]},'raw':!![]})[_0x86d3('0x11')](function(_0x940d18){if(_['isEmpty'](_0x940d18)||!_[_0x86d3('0x87')](_0x940d18,['autoAssociation',0x0]))return _0x362b2e;_0x458526=[];var _0x441a7d=_(_0x940d18)[_0x86d3('0x35')](function(_0x4628f1){if(_0x4628f1[_0x86d3('0x84')]===0x1)return;return _0x4628f1[_0x86d3('0x2f')]==='Agents'?'agent':_0x86d3('0x8a');})['compact']()[_0x86d3('0x2d')]();for(var _0x53514d=0x0;_0x53514d<_0x362b2e[_0x86d3('0x55')];_0x53514d++){if(!_['includes'](_0x441a7d,_0x362b2e[_0x53514d]['role']))return;var _0x426c26=_0x362b2e[_0x53514d][_0x86d3('0x26')]===_0x86d3('0x2a')?_0x86d3('0x82'):_0x86d3('0x83');_0x458526[_0x86d3('0x40')](db[_0x86d3('0x30')][_0x86d3('0x7a')]({'name':_0x362b2e[_0x53514d][_0x86d3('0x2f')],'resourceId':_0x362b2e[_0x53514d]['id'],'type':_0x426c26,'sectionId':_[_0x86d3('0x2e')](_0x940d18,[_0x86d3('0x2f'),_0x426c26])['id']},{}));}return BPromise[_0x86d3('0x59')](_0x458526);});})[_0x86d3('0x11')](respondWithResult(_0x15dfa1,0xc9))[_0x86d3('0x4b')](handleError(_0x15dfa1,null));};exports[_0x86d3('0x8b')]=function(_0x4abc61,_0x5361d9){if(_0x4abc61['body']['id']){delete _0x4abc61[_0x86d3('0x5a')]['id'];}return db[_0x86d3('0x3d')][_0x86d3('0x2e')]({'where':{'id':_0x4abc61[_0x86d3('0x4d')]['id']}})[_0x86d3('0x11')](function(_0x32efe6){if(!_0x32efe6)return null;if(_0x32efe6['id']===_0x4abc61[_0x86d3('0x29')]['id']){if(!_0x4abc61[_0x86d3('0x5a')][_0x86d3('0x8c')]||!_0x4abc61[_0x86d3('0x5a')][_0x86d3('0x8d')]){throw new db['Sequelize'][(_0x86d3('0x8e'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x32efe6[_0x86d3('0x8f')](_0x4abc61[_0x86d3('0x5a')][_0x86d3('0x8c')])){throw new db[(_0x86d3('0x90'))]['ValidationError'](_0x86d3('0x91'));}if(_0x4abc61[_0x86d3('0x5a')][_0x86d3('0x8c')]===_0x4abc61[_0x86d3('0x5a')][_0x86d3('0x8d')]){throw new db[(_0x86d3('0x90'))][(_0x86d3('0x8e'))](_0x86d3('0x92'));}}else if(_0x4abc61[_0x86d3('0x29')][_0x86d3('0x26')]===_0x86d3('0x27')){if(!_0x4abc61[_0x86d3('0x5a')][_0x86d3('0x8d')]){throw new db[(_0x86d3('0x90'))][(_0x86d3('0x8e'))](_0x86d3('0x93'));}}else if(_0x4abc61[_0x86d3('0x29')]['role']===_0x86d3('0x29')){if(!_0x4abc61[_0x86d3('0x5a')][_0x86d3('0x8d')]){throw new db[(_0x86d3('0x90'))]['ValidationError'](_0x86d3('0x93'));}if(_0x32efe6['role']!=='agent'){throw new db[(_0x86d3('0x90'))][(_0x86d3('0x8e'))](_0x86d3('0x7b'));}}else{throw new db[(_0x86d3('0x90'))][(_0x86d3('0x8e'))](_0x86d3('0x7b'));}return _0x32efe6;})[_0x86d3('0x11')](handleEntityNotFound(_0x5361d9,null))[_0x86d3('0x11')](function(_0x50f46a){return db['Setting']['findOne']({'attributes':['id',_0x86d3('0x62'),_0x86d3('0x94'),_0x86d3('0x95')]})['then'](function(_0x36eb07){if(_0x36eb07['securePassword'])authService[_0x86d3('0x63')](_0x4abc61[_0x86d3('0x5a')][_0x86d3('0x8d')]);if(!_0x36eb07[_0x86d3('0x94')]||!_0x50f46a['previousPasswords'])return _0x50f46a;authService[_0x86d3('0x96')](_0x4abc61[_0x86d3('0x5a')][_0x86d3('0x8d')],_0x50f46a['previousPasswords'],_0x36eb07['passwordHistoryLimit']);return _0x50f46a;})['then'](saveUpdates({'password':_0x4abc61[_0x86d3('0x5a')][_0x86d3('0x8d')],'passwordResetAt':_0x4abc61['user']['id']==_0x4abc61[_0x86d3('0x4d')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x4abc61[_0x86d3('0x5a')][_0x86d3('0x8d')],_0x50f46a[_0x86d3('0x97')])},null));})['then'](respondWithResult(_0x5361d9,null))[_0x86d3('0x4b')](handleError(_0x5361d9,null));};exports[_0x86d3('0x98')]=function(_0x106657,_0xecaf18){var _0x412404=_0x106657['body'][_0x86d3('0x99')];return db[_0x86d3('0x3d')]['find']({'where':{'id':_0x106657[_0x86d3('0x4d')]['id']},'attributes':['id',_0x86d3('0x2f'),'role',_0x86d3('0x9a'),'loginInPause','voicePause',_0x86d3('0x9b')]})[_0x86d3('0x11')](handleEntityNotFound(_0xecaf18,null))[_0x86d3('0x11')](function(_0x1482a4){if(_0x1482a4){if(!utils[_0x86d3('0x9c')](_0x412404)){throw new db[(_0x86d3('0x90'))][(_0x86d3('0x8e'))](_0x86d3('0x9d'));}return _0x1482a4[_0x86d3('0x9e')+_[_0x86d3('0x9f')](_0x412404[_0x86d3('0xa0')]())+_0x86d3('0xa1')](_0x106657[_0x86d3('0x5a')]['ids'],{'penalty':_0x106657[_0x86d3('0x5a')][_0x86d3('0xa2')]||0x0})[_0x86d3('0xa3')](function(_0x10ce5e){for(var _0x3c46aa=0x0;_0x3c46aa<_0x106657[_0x86d3('0x5a')]['ids'][_0x86d3('0x55')];_0x3c46aa+=0x1){var _0x4f2359={'UserId':Number(_0x106657[_0x86d3('0x4d')]['id'])};_0x4f2359[_[_0x86d3('0x9f')](_0x412404['toLowerCase']())+'QueueId']=Number(_0x106657[_0x86d3('0x5a')][_0x86d3('0x5e')][_0x3c46aa]);socket[_0x86d3('0xa4')]('user'+_['capitalize'](_0x412404[_0x86d3('0xa0')]())+_0x86d3('0xa5'),_0x4f2359);}return _0x10ce5e;})[_0x86d3('0x11')](function(){if(_0x412404==='voice'){return db[_0x86d3('0xa6')][_0x86d3('0x41')]({'where':{'id':_0x106657[_0x86d3('0x5a')][_0x86d3('0x5e')]||[]},'raw':!![],'attributes':['id',_0x86d3('0x2f')]});}})[_0x86d3('0x11')](function(_0x12a1f8){var _0x3dddbe=_0x1482a4[_0x86d3('0x25')]({'plain':!![]});var _0x40490a=[];if(_0x412404===_0x86d3('0xa7')&&_0x3dddbe['role']===_0x86d3('0x2a')&&_0x3dddbe['online']){for(var _0x495b62=0x0;_0x495b62<_0x12a1f8[_0x86d3('0x55')];_0x495b62+=0x1){_0x40490a[_0x86d3('0x40')]({'membername':_0x3dddbe['name'],'UserId':_0x3dddbe['id'],'queue_name':_0x12a1f8[_0x495b62]['name'],'VoiceQueueId':_0x12a1f8[_0x495b62]['id'],'interface':_[_0x86d3('0x65')](_0x3dddbe[_0x86d3('0x9b')])?util[_0x86d3('0xa8')](_0x86d3('0xa9'),_0x3dddbe['name']):_0x3dddbe[_0x86d3('0x9b')],'paused':_0x3dddbe[_0x86d3('0xaa')]||![],'penalty':_0x106657[_0x86d3('0x5a')][_0x86d3('0xa2')]||0x0});}return BPromise[_0x86d3('0x89')](_0x40490a,function(_0x523b4f){return db[_0x86d3('0xab')][_0x86d3('0xac')](_0x523b4f);});}return _0x1482a4;});}})[_0x86d3('0x11')](respondWithStatusCode(_0xecaf18,null))['catch'](handleError(_0xecaf18,null));};exports[_0x86d3('0xad')]=function(_0x5375d6,_0xebed40){var _0x3506ed;return db['User'][_0x86d3('0x2e')]({'where':{'id':_0x5375d6[_0x86d3('0x4d')]['id']},'attributes':['id',_0x86d3('0x2f'),_0x86d3('0x26')]})[_0x86d3('0x11')](handleEntityNotFound(_0xebed40,null))[_0x86d3('0x11')](function(_0x49f182){if(_0x49f182){_0x3506ed=_0x49f182;if(!_0x5375d6[_0x86d3('0x3f')]['channel']||!utils[_0x86d3('0x9c')](_0x5375d6[_0x86d3('0x3f')][_0x86d3('0x99')])){throw new db[(_0x86d3('0x90'))]['ValidationError'](_0x86d3('0x9d'));}return _0x49f182[_0x86d3('0xae')+_[_0x86d3('0x9f')](_0x5375d6[_0x86d3('0x3f')][_0x86d3('0x99')][_0x86d3('0xa0')]())+'Queues'](_0x5375d6[_0x86d3('0x3f')][_0x86d3('0x5e')]);}})['then'](function(_0x5748ad){if(_[_0x86d3('0xaf')](_0x5375d6['query']['ids'])){for(var _0xeb0ac9=0x0;_0xeb0ac9<_0x5375d6[_0x86d3('0x3f')][_0x86d3('0x5e')]['length'];_0xeb0ac9+=0x1){var _0x58d7f5={'UserId':Number(_0x5375d6[_0x86d3('0x4d')]['id'])};_0x58d7f5[_[_0x86d3('0x9f')](_0x5375d6[_0x86d3('0x3f')][_0x86d3('0x99')]['toLowerCase']())+_0x86d3('0xb0')]=Number(_0x5375d6[_0x86d3('0x3f')]['ids'][_0xeb0ac9]);socket['emit']('user'+_[_0x86d3('0x9f')](_0x5375d6['query']['channel'][_0x86d3('0xa0')]())+_0x86d3('0xb1'),_0x58d7f5);}}else{var _0x58d7f5={'UserId':Number(_0x5375d6['params']['id'])};_0x58d7f5[_[_0x86d3('0x9f')](_0x5375d6[_0x86d3('0x3f')][_0x86d3('0x99')]['toLowerCase']())+_0x86d3('0xb0')]=Number(_0x5375d6[_0x86d3('0x3f')][_0x86d3('0x5e')]);socket[_0x86d3('0xa4')](_0x86d3('0x29')+_[_0x86d3('0x9f')](_0x5375d6['query'][_0x86d3('0x99')][_0x86d3('0xa0')]())+_0x86d3('0xb1'),_0x58d7f5);}return _0x5748ad;})['then'](function(){if(_0x5375d6[_0x86d3('0x3f')]['channel']===_0x86d3('0xa7')){return db[_0x86d3('0xab')][_0x86d3('0x24')]({'where':{'UserId':_0x5375d6[_0x86d3('0x4d')]['id'],'VoiceQueueId':_0x5375d6['query']['ids']},'individualHooks':!![]})[_0x86d3('0x11')](function(){return _0x3506ed;});}return _0x3506ed;})[_0x86d3('0x11')](respondWithStatusCode(_0xebed40,null))[_0x86d3('0x4b')](handleError(_0xebed40,null));};exports[_0x86d3('0xb2')]=function(_0x35f797,_0x2205cd){_0x35f797[_0x86d3('0x5a')]['userpic']=_0x35f797[_0x86d3('0xb3')][_0x86d3('0xb4')];return db[_0x86d3('0x3d')][_0x86d3('0x2e')]({'where':{'id':_0x35f797['params']['id']}})[_0x86d3('0x11')](handleEntityNotFound(_0x2205cd,null))['then'](saveUpdates(_0x35f797[_0x86d3('0x5a')],null))[_0x86d3('0x11')](respondWithResult(_0x2205cd,null))[_0x86d3('0x4b')](handleError(_0x2205cd,null));};exports['getAvatar']=function(_0x376606,_0x1cdc5c){var _0x58738c=path['join'](config['root'],_0x86d3('0xb5'));return db['User'][_0x86d3('0x2e')]({'where':{'id':_0x376606[_0x86d3('0x4d')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x86d3('0x11')](handleEntityNotFound(_0x1cdc5c,null))[_0x86d3('0x11')](function(_0x2ffcee){if(_0x2ffcee){if(_['isNil'](_0x2ffcee[_0x86d3('0xb6')])){return _0x1cdc5c[_0x86d3('0xb7')](_0x58738c);}else{if(!fs[_0x86d3('0xb8')](path[_0x86d3('0xb9')](config['root'],_0x86d3('0xba'),_0x2ffcee[_0x86d3('0xb6')]))){return _0x1cdc5c['download'](_0x58738c);}return _0x1cdc5c[_0x86d3('0xb7')](path[_0x86d3('0xb9')](config[_0x86d3('0xbb')],_0x86d3('0xba'),_0x2ffcee[_0x86d3('0xb6')]));}}})[_0x86d3('0x4b')](handleError(_0x1cdc5c,null));};exports[_0x86d3('0xbc')]=function(_0x1ccc49,_0x4b4f4c){return db[_0x86d3('0x3d')][_0x86d3('0x2e')]({'where':{'id':_0x1ccc49[_0x86d3('0x4d')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x4b4f4c,null))[_0x86d3('0x11')](function(_0x7ac1e1){var _0x4ccd97=[];values=_0x7ac1e1[_0x86d3('0x47')];_0x4ccd97[_0x86d3('0x40')](get_open_tabs(_0x86d3('0x45'),_0x7ac1e1[_0x86d3('0x47')]));_0x4ccd97[_0x86d3('0x40')](get_open_tabs('sms',_0x7ac1e1['dataValues']));_0x4ccd97['push'](get_open_tabs('openchannel',_0x7ac1e1['dataValues']));_0x4ccd97[_0x86d3('0x40')](get_open_tabs(_0x86d3('0xbd'),_0x7ac1e1[_0x86d3('0x47')]));_0x4ccd97['push'](get_open_tabs(_0x86d3('0x48'),_0x7ac1e1[_0x86d3('0x47')]));_0x4ccd97[_0x86d3('0x40')](get_open_tabs(_0x86d3('0x49'),_0x7ac1e1['dataValues']));return BPromise[_0x86d3('0x59')](_0x4ccd97);})['then'](function(_0x1b6e76){var _0x3322e5=[];if(_0x1b6e76){for(var _0x3310d6=0x0;_0x3310d6=_0xf91294[_0xc2f6('0x51')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0xc2f6('0x2d')](function(){if(_0x4b2a30){return db[_0xc2f6('0x2e')][_0xc2f6('0x4a')]({'where':{'membername':_0x4b2a30['name']},'individualHooks':!![]});}})['then'](function(){if(_0x4b2a30){return _0x4b2a30[_0xc2f6('0x52')]({'raw':!![]});}})[_0xc2f6('0x2d')](function(_0xd08e5f){if(_0x4b2a30){if(_0xd08e5f){var _0x12ea01=[];_0x4ca479=_0xd08e5f;if(_0x4ca479[_0xc2f6('0x32')]){for(var _0x5e97f5=0x0;_0x5e97f5<_0x4ca479[_0xc2f6('0x32')];_0x5e97f5++){_0x12ea01[_0xc2f6('0x38')](db[_0xc2f6('0x2e')][_0xc2f6('0x53')]({'membername':_0x4b2a30['name'],'UserId':_0x4b2a30['id'],'queue_name':_0x4ca479[_0x5e97f5][_0xc2f6('0x2a')],'VoiceQueueId':_0x4ca479[_0x5e97f5]['id'],'interface':_0x4735bb,'paused':_0x4b2a30['loginInPause']||![],'penalty':_0x4ca479[_0x5e97f5][_0xc2f6('0x54')]||0x0}));}return BPromise[_0xc2f6('0x48')](_0x12ea01);}}}})[_0xc2f6('0x2d')](function(){if(_0x4b2a30){return db[_0xc2f6('0x30')][_0xc2f6('0x1d')]({'where':{'membername':_0x4b2a30['name'],'exitAt':null}});}})[_0xc2f6('0x2d')](function(_0x2443d4){if(_0x4b2a30){if(_0x2443d4&&_0x2443d4[_0xc2f6('0x32')]){var _0x3643c2=[];_0x2443d4[_0xc2f6('0x37')](function(_0x37f474){_0x3643c2[_0xc2f6('0x38')](_0x37f474[_0xc2f6('0x2f')]({'exitAt':moment()[_0xc2f6('0x33')](_0xc2f6('0x34'))}));});return BPromise[_0xc2f6('0x48')](_0x3643c2);}}})[_0xc2f6('0x2d')](function(_0x5b571f){if(_0x4b2a30){var _0x5c7a3b=[];var _0xa74982=[];var _0x5ed7bd=utils['getChannels']();var _0x1214f9={'membername':_0x4b2a30[_0xc2f6('0x2a')],'interface':_0x4735bb,'enterAt':moment()[_0xc2f6('0x33')](_0xc2f6('0x34')),'role':_0x4b2a30['role'],'internal':_0x4b2a30['internal']};_0x5ed7bd['forEach'](function(_0x3af5c7){_0x5c7a3b['push'](_[_0xc2f6('0x55')]({'channel':_0x3af5c7,'type':_0xc2f6('0x56'),'data1':'callysquare','data2':_0x4735bb},_0x1214f9));if(_0x4b2a30[_0xc2f6('0x4d')]){_0xa74982[_0xc2f6('0x38')](_['merge']({'channel':_0x3af5c7,'type':_0xc2f6('0x31'),'data1':_0xc2f6('0x57')},_0x1214f9));}});return db[_0xc2f6('0x30')]['bulkCreate'](_0x5c7a3b['concat'](_0xa74982),{'individualHooks':!![]});}})[_0xc2f6('0x2d')](function(){if(_0x4b2a30){return _0x4b2a30[_0xc2f6('0x2f')]({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x4b2a30[_0xc2f6('0x4d')]||![],'mailPause':_0x4b2a30[_0xc2f6('0x4d')]||![],'chatPause':_0x4b2a30[_0xc2f6('0x4d')]||![],'faxPause':_0x4b2a30[_0xc2f6('0x4d')]||![],'smsPause':_0x4b2a30[_0xc2f6('0x4d')]||![],'openchannelPause':_0x4b2a30[_0xc2f6('0x4d')]||![],'pauseType':_0x4b2a30[_0xc2f6('0x4d')]?_0xc2f6('0x57'):null,'lastPauseAt':moment()[_0xc2f6('0x33')](_0xc2f6('0x34')),'interface':_0x4735bb});}})[_0xc2f6('0x2d')](function(_0x2cd845){_0xfbd37a(_0x2cd845);})[_0xc2f6('0x1a')](function(_0x4762ee){_0x2a097a(_0x31252a['error'](0x1f4,_0x4762ee[_0xc2f6('0x19')]));});});}; \ No newline at end of file +var _0xff47=['UserVoiceQueueRt','update','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','push','SIP/%s','PAUSE','body','type','DEFAULT\x20PAUSE','internal','MemberReport','bulkCreate','UnpauseUser','findOne','channel','isValidChannel','chat','fax','openchannel','system','set','%s%s','Pause','forEach','all','LogoutUser','destroy','LoginUser','mobile','phone','loginInPause','agent','../../config/license/util','agents','getVoiceQueues','upsert','UserVoiceQueue.penalty','getChannels','merge','LOGIN','callysquare','LOGININPAUSE','concat','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./user.socket','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','where','attributes','limit','include','map','model','GetUser','User','find','raw','ShowUser','name','role','interface'];(function(_0xfafe54,_0x23c9a6){var _0x4ab8e6=function(_0x23942c){while(--_0x23942c){_0xfafe54['push'](_0xfafe54['shift']());}};_0x4ab8e6(++_0x23c9a6);}(_0xff47,0x1f0));var _0x7ff4=function(_0x26efac,_0x21ab8a){_0x26efac=_0x26efac-0x0;var _0x8482e4=_0xff47[_0x26efac];return _0x8482e4;};'use strict';var _=require(_0x7ff4('0x0'));var util=require('util');var moment=require(_0x7ff4('0x1'));var BPromise=require('bluebird');var rs=require(_0x7ff4('0x2'));var fs=require('fs');var Redis=require(_0x7ff4('0x3'));var db=require(_0x7ff4('0x4'))['db'];var utils=require(_0x7ff4('0x5'));var logger=require(_0x7ff4('0x6'))(_0x7ff4('0x7'));var config=require(_0x7ff4('0x8'));var jayson=require(_0x7ff4('0x9'));var client=jayson[_0x7ff4('0xa')][_0x7ff4('0xb')]({'port':0x232a});config[_0x7ff4('0xc')]=_[_0x7ff4('0xd')](config[_0x7ff4('0xc')],{'host':_0x7ff4('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7ff4('0xc')]));require(_0x7ff4('0xf'))['register'](socket);function respondWithRpcPromise(_0x223fad,_0x19c105,_0x4d5ac3){return new BPromise(function(_0xe29264,_0x58198c){return client['request'](_0x223fad,_0x4d5ac3)[_0x7ff4('0x10')](function(_0x1fcb38){logger[_0x7ff4('0x11')](_0x7ff4('0x12'),_0x19c105,_0x7ff4('0x13'));logger[_0x7ff4('0x14')](_0x7ff4('0x15'),_0x19c105,_0x7ff4('0x13'),JSON[_0x7ff4('0x16')](_0x1fcb38));if(_0x1fcb38[_0x7ff4('0x17')]){if(_0x1fcb38[_0x7ff4('0x17')][_0x7ff4('0x18')]===0x1f4){logger[_0x7ff4('0x17')](_0x7ff4('0x12'),_0x19c105,_0x1fcb38[_0x7ff4('0x17')][_0x7ff4('0x19')]);return _0x58198c(_0x1fcb38[_0x7ff4('0x17')][_0x7ff4('0x19')]);}logger[_0x7ff4('0x17')](_0x7ff4('0x12'),_0x19c105,_0x1fcb38[_0x7ff4('0x17')][_0x7ff4('0x19')]);return _0xe29264(_0x1fcb38['error'][_0x7ff4('0x19')]);}else{logger[_0x7ff4('0x11')](_0x7ff4('0x12'),_0x19c105,'request\x20sent');_0xe29264(_0x1fcb38[_0x7ff4('0x1a')]['message']);}})[_0x7ff4('0x1b')](function(_0x2dd8a6){logger[_0x7ff4('0x17')]('User,\x20%s,\x20%s',_0x19c105,_0x2dd8a6);_0x58198c(_0x2dd8a6);});});}exports['GetUser']=function(_0x123a30){var _0x15ee38=this;return new Promise(function(_0x4dab25,_0x5ef088){return db['User'][_0x7ff4('0x1c')]({'raw':_0x123a30[_0x7ff4('0x1d')]?_0x123a30['options']['raw']===undefined?!![]:![]:!![],'where':_0x123a30['options']?_0x123a30[_0x7ff4('0x1d')][_0x7ff4('0x1e')]||null:null,'attributes':_0x123a30['options']?_0x123a30[_0x7ff4('0x1d')][_0x7ff4('0x1f')]||null:null,'limit':_0x123a30[_0x7ff4('0x1d')]?_0x123a30[_0x7ff4('0x1d')][_0x7ff4('0x20')]||null:null,'include':_0x123a30['options']?_0x123a30['options'][_0x7ff4('0x21')]?_['map'](_0x123a30['options'][_0x7ff4('0x21')],function(_0xd734fc){return{'model':db[_0xd734fc['model']],'as':_0xd734fc['as'],'attributes':_0xd734fc[_0x7ff4('0x1f')],'include':_0xd734fc['include']?_[_0x7ff4('0x22')](_0xd734fc[_0x7ff4('0x21')],function(_0x4b7b0c){return{'model':db[_0x4b7b0c[_0x7ff4('0x23')]],'as':_0x4b7b0c['as'],'attributes':_0x4b7b0c[_0x7ff4('0x1f')],'include':_0x4b7b0c[_0x7ff4('0x21')]?_[_0x7ff4('0x22')](_0x4b7b0c['include'],function(_0x4584cd){return{'model':db[_0x4584cd[_0x7ff4('0x23')]],'as':_0x4584cd['as'],'attributes':_0x4584cd[_0x7ff4('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3fae4a){logger['info'](_0x7ff4('0x24'),_0x123a30);logger[_0x7ff4('0x14')](_0x7ff4('0x24'),_0x123a30,JSON[_0x7ff4('0x16')](_0x3fae4a));_0x4dab25(_0x3fae4a);})['catch'](function(_0xe8358e){logger[_0x7ff4('0x17')]('GetUser',_0xe8358e['message'],_0x123a30);_0x5ef088(_0x15ee38['error'](0x1f4,_0xe8358e[_0x7ff4('0x19')]));});});};exports['ShowUser']=function(_0x369e42){var _0x1f5edf=this;return new Promise(function(_0x52640d,_0x33adb5){return db[_0x7ff4('0x25')][_0x7ff4('0x26')]({'raw':_0x369e42[_0x7ff4('0x1d')]?_0x369e42[_0x7ff4('0x1d')][_0x7ff4('0x27')]===undefined?!![]:![]:!![],'where':_0x369e42[_0x7ff4('0x1d')]?_0x369e42[_0x7ff4('0x1d')][_0x7ff4('0x1e')]||null:null,'attributes':_0x369e42['options']?_0x369e42[_0x7ff4('0x1d')][_0x7ff4('0x1f')]||null:null,'include':_0x369e42['options']?_0x369e42[_0x7ff4('0x1d')]['include']?_[_0x7ff4('0x22')](_0x369e42[_0x7ff4('0x1d')]['include'],function(_0x2b2ddd){return{'model':db[_0x2b2ddd[_0x7ff4('0x23')]],'as':_0x2b2ddd['as'],'attributes':_0x2b2ddd[_0x7ff4('0x1f')],'include':_0x2b2ddd['include']?_[_0x7ff4('0x22')](_0x2b2ddd[_0x7ff4('0x21')],function(_0x313b73){return{'model':db[_0x313b73[_0x7ff4('0x23')]],'as':_0x313b73['as'],'attributes':_0x313b73[_0x7ff4('0x1f')],'include':_0x313b73['include']?_[_0x7ff4('0x22')](_0x313b73['include'],function(_0x56a5af){return{'model':db[_0x56a5af[_0x7ff4('0x23')]],'as':_0x56a5af['as'],'attributes':_0x56a5af[_0x7ff4('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7ff4('0x10')](function(_0x36e5f8){logger[_0x7ff4('0x11')](_0x7ff4('0x28'),_0x369e42);logger['debug'](_0x7ff4('0x28'),_0x369e42,JSON[_0x7ff4('0x16')](_0x36e5f8));_0x52640d(_0x36e5f8);})[_0x7ff4('0x1b')](function(_0x19eff4){logger[_0x7ff4('0x17')](_0x7ff4('0x28'),_0x19eff4[_0x7ff4('0x19')],_0x369e42);_0x33adb5(_0x1f5edf['error'](0x1f4,_0x19eff4[_0x7ff4('0x19')]));});});};exports['PauseUser']=function(_0x23e3f1){var _0x21eb7b=this;return new Promise(function(_0x557959,_0x2694d0){var _0xe4c379;return db[_0x7ff4('0x25')][_0x7ff4('0x26')]({'where':_0x23e3f1[_0x7ff4('0x1d')][_0x7ff4('0x1e')]||{},'attributes':['id',_0x7ff4('0x29'),_0x7ff4('0x2a'),'internal',_0x7ff4('0x2b')]})[_0x7ff4('0x10')](function(_0x5541e9){if(_0x5541e9){_0xe4c379=_0x5541e9;return db[_0x7ff4('0x2c')][_0x7ff4('0x2d')]({'paused':0x1},{'where':{'UserId':_0xe4c379['id']},'individualHooks':!![]});}})['then'](function(){if(_0xe4c379){return db['MemberReport'][_0x7ff4('0x1c')]({'where':{'membername':_0xe4c379[_0x7ff4('0x29')],'type':'PAUSE','exitAt':null}});}})['then'](function(_0x21a41b){if(_0xe4c379){if(_0x21a41b&&_0x21a41b[_0x7ff4('0x2e')]){var _0x5dbc7c=moment()[_0x7ff4('0x2f')](_0x7ff4('0x30'));for(var _0x2d8cb1=0x0,_0x2ec4c3=_0x21a41b[_0x7ff4('0x2e')];_0x2d8cb1<_0x2ec4c3;_0x2d8cb1++){_0x21a41b[_0x2d8cb1][_0x7ff4('0x31')]({'exitAt':_0x5dbc7c});}}}})[_0x7ff4('0x10')](function(){if(_0xe4c379){var _0x3a1917=[];var _0x30b1da=utils['getChannels']();_0x30b1da['forEach'](function(_0x4307eb){_0x3a1917[_0x7ff4('0x32')]({'channel':_0x4307eb,'membername':_0xe4c379['name'],'interface':_['isNil'](_0xe4c379[_0x7ff4('0x2b')])?util[_0x7ff4('0x2f')](_0x7ff4('0x33'),_0xe4c379[_0x7ff4('0x29')]):_0xe4c379['interface'],'type':_0x7ff4('0x34'),'enterAt':moment()[_0x7ff4('0x2f')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x23e3f1[_0x7ff4('0x35')][_0x7ff4('0x36')]||_0x7ff4('0x37'),'role':_0xe4c379[_0x7ff4('0x2a')],'internal':_0xe4c379[_0x7ff4('0x38')],'uniqueid':_0x23e3f1[_0x7ff4('0x35')]['uniqueid']||null});});return db[_0x7ff4('0x39')][_0x7ff4('0x3a')](_0x3a1917,{'individualHooks':!![]});}})[_0x7ff4('0x10')](function(){if(_0xe4c379){return _0xe4c379[_0x7ff4('0x2d')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x23e3f1[_0x7ff4('0x35')]['type']||_0x7ff4('0x37'),'lastPauseAt':moment()[_0x7ff4('0x2f')](_0x7ff4('0x30'))});}})[_0x7ff4('0x10')](function(_0x45f3bd){_0x557959(_0x45f3bd);})[_0x7ff4('0x1b')](function(_0x207e24){_0x2694d0(_0x21eb7b[_0x7ff4('0x17')](0x1f4,_0x207e24['message']));});});};exports[_0x7ff4('0x3b')]=function(_0x443d04){var _0x287892=this;return new Promise(function(_0x26b4a,_0x48d27f){var _0x1302bf;return db[_0x7ff4('0x25')][_0x7ff4('0x3c')]({'where':_0x443d04[_0x7ff4('0x1d')][_0x7ff4('0x1e')]||{},'attributes':['id',_0x7ff4('0x29')]})[_0x7ff4('0x10')](function(_0x4f4f99){if(_0x4f4f99){_0x1302bf=_0x4f4f99;if(_0x443d04[_0x7ff4('0x35')][_0x7ff4('0x3d')]&&!utils[_0x7ff4('0x3e')](_0x443d04[_0x7ff4('0x35')]['channel'])){throw new Error('Unknown\x20channel');}switch(_0x443d04[_0x7ff4('0x35')][_0x7ff4('0x3d')]){case'voice':return db['UserVoiceQueueRt'][_0x7ff4('0x2d')]({'paused':0x0},{'where':{'UserId':_0x1302bf['id']}})[_0x7ff4('0x10')](function(){return db[_0x7ff4('0x39')][_0x7ff4('0x26')]({'where':{'channel':_0x443d04[_0x7ff4('0x35')][_0x7ff4('0x3d')],'membername':_0x1302bf[_0x7ff4('0x29')],'type':_0x7ff4('0x34'),'exitAt':null}});})[_0x7ff4('0x10')](function(_0x1fd00b){if(_0x1fd00b){return _0x1fd00b['update']({'exitAt':moment()[_0x7ff4('0x2f')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'system'},{'individualHooks':!![]});}return null;})[_0x7ff4('0x10')](function(){return _0x1302bf['update']({'voicePause':![]});});case'mail':case _0x7ff4('0x3f'):case _0x7ff4('0x40'):case'sms':case _0x7ff4('0x41'):case'whatsapp':return db['MemberReport'][_0x7ff4('0x26')]({'where':{'channel':_0x443d04[_0x7ff4('0x35')]['channel'],'membername':_0x1302bf['name'],'type':_0x7ff4('0x34'),'exitAt':null}})[_0x7ff4('0x10')](function(_0x235f5f){return _0x235f5f[_0x7ff4('0x2d')]({'exitAt':moment()[_0x7ff4('0x2f')](_0x7ff4('0x30')),'data2':_0x7ff4('0x42')},{'individualHooks':!![]});})[_0x7ff4('0x10')](function(){var _0x5720f9={};_[_0x7ff4('0x43')](_0x5720f9,util[_0x7ff4('0x2f')](_0x7ff4('0x44'),_0x443d04[_0x7ff4('0x35')][_0x7ff4('0x3d')],_0x7ff4('0x45')),![]);return _0x1302bf[_0x7ff4('0x2d')](_0x5720f9);});default:return db['UserVoiceQueueRt'][_0x7ff4('0x2d')]({'paused':0x0},{'where':{'UserId':_0x1302bf['id']}})['then'](function(){return db[_0x7ff4('0x39')][_0x7ff4('0x1c')]({'where':{'membername':_0x1302bf[_0x7ff4('0x29')],'type':_0x7ff4('0x34'),'exitAt':null}});})[_0x7ff4('0x10')](function(_0x5805ac){var _0x4422c3=[];_0x5805ac[_0x7ff4('0x46')](function(_0x5d6989){_0x4422c3[_0x7ff4('0x32')](_0x5d6989[_0x7ff4('0x2d')]({'exitAt':moment()[_0x7ff4('0x2f')](_0x7ff4('0x30')),'data2':_0x7ff4('0x42')}));});return BPromise[_0x7ff4('0x47')](_0x4422c3);})[_0x7ff4('0x10')](function(){return _0x1302bf[_0x7ff4('0x2d')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x7ff4('0x10')](function(_0x135f95){_0x26b4a(_0x135f95);})[_0x7ff4('0x1b')](function(_0xed3025){_0x48d27f(_0x287892[_0x7ff4('0x17')](0x1f4,_0xed3025['message']));});});};exports[_0x7ff4('0x48')]=function(_0x4a8ba3){var _0x1f6d67=this;return new Promise(function(_0x364599,_0x112b92){var _0x2ed2b0;return db[_0x7ff4('0x25')][_0x7ff4('0x3c')]({'where':_0x4a8ba3[_0x7ff4('0x1d')]['where']||{},'attributes':['id',_0x7ff4('0x29')]})['then'](function(_0x44fa87){if(_0x44fa87){_0x2ed2b0=_0x44fa87;return db[_0x7ff4('0x2c')][_0x7ff4('0x49')]({'where':{'membername':_0x2ed2b0[_0x7ff4('0x29')]},'individualHooks':!![]});}})[_0x7ff4('0x10')](function(){if(_0x2ed2b0){return db[_0x7ff4('0x39')][_0x7ff4('0x1c')]({'where':{'membername':_0x2ed2b0[_0x7ff4('0x29')],'exitAt':null}});}})['then'](function(_0x59a39b){if(_0x2ed2b0){if(_0x59a39b&&_0x59a39b['length']){var _0x56a910=[];_0x59a39b[_0x7ff4('0x46')](function(_0x32c816){_0x56a910[_0x7ff4('0x32')](_0x32c816['update']({'exitAt':moment()[_0x7ff4('0x2f')](_0x7ff4('0x30'))}));});return BPromise[_0x7ff4('0x47')](_0x56a910);}}})['then'](function(){if(_0x2ed2b0){return _0x2ed2b0[_0x7ff4('0x2d')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x4ddb4d){_0x364599(_0x4ddb4d);})[_0x7ff4('0x1b')](function(_0x56f427){_0x112b92(_0x1f6d67[_0x7ff4('0x17')](0x1f4,_0x56f427[_0x7ff4('0x19')]));});});};exports[_0x7ff4('0x4a')]=function(_0x585bb6){var _0x43086c=this;return new Promise(function(_0x3c2763,_0x2fb3f3){var _0x2e9ef8;var _0x4f5bcc;var _0x9668c5;var _0x10d0d7;return db['User']['findOne']({'where':_0x585bb6['options'][_0x7ff4('0x1e')]||{},'attributes':['id',_0x7ff4('0x29'),_0x7ff4('0x2a'),_0x7ff4('0x4b'),_0x7ff4('0x4c'),'internal',_0x7ff4('0x4d'),_0x7ff4('0x2b')]})[_0x7ff4('0x10')](function(_0x245681){if(_0x245681){_0x2e9ef8=_0x245681;_0x10d0d7=_0x585bb6[_0x7ff4('0x35')][_0x7ff4('0x2b')]?_0x585bb6[_0x7ff4('0x35')][_0x7ff4('0x2b')]:util[_0x7ff4('0x2f')]('SIP/%s',_0x2e9ef8[_0x7ff4('0x29')]);return db[_0x7ff4('0x25')]['count']({'where':{'role':_0x7ff4('0x4e'),'online':!![],'id':{'$ne':_0x2e9ef8['id']}}});}})[_0x7ff4('0x10')](function(_0x2cc0f8){if(_0x2cc0f8){_0x9668c5=_0x2cc0f8;return require(_0x7ff4('0x4f'))['getLicense']();}})[_0x7ff4('0x10')](function(_0x2e66b2){if(_0x2e66b2&&_0x2e66b2[_0x7ff4('0x50')]&&_0x9668c5>=_0x2e66b2[_0x7ff4('0x50')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})['then'](function(){if(_0x2e9ef8){return db[_0x7ff4('0x2c')][_0x7ff4('0x49')]({'where':{'membername':_0x2e9ef8[_0x7ff4('0x29')]},'individualHooks':!![]});}})[_0x7ff4('0x10')](function(){if(_0x2e9ef8){return _0x2e9ef8[_0x7ff4('0x51')]({'raw':!![]});}})[_0x7ff4('0x10')](function(_0x4e1a5f){if(_0x2e9ef8){if(_0x4e1a5f){var _0x4ca1e4=[];_0x4f5bcc=_0x4e1a5f;if(_0x4f5bcc[_0x7ff4('0x2e')]){for(var _0x2fcbe3=0x0;_0x2fcbe3<_0x4f5bcc[_0x7ff4('0x2e')];_0x2fcbe3++){_0x4ca1e4[_0x7ff4('0x32')](db[_0x7ff4('0x2c')][_0x7ff4('0x52')]({'membername':_0x2e9ef8['name'],'UserId':_0x2e9ef8['id'],'queue_name':_0x4f5bcc[_0x2fcbe3]['name'],'VoiceQueueId':_0x4f5bcc[_0x2fcbe3]['id'],'interface':_0x10d0d7,'paused':_0x2e9ef8['loginInPause']||![],'penalty':_0x4f5bcc[_0x2fcbe3][_0x7ff4('0x53')]||0x0}));}return BPromise[_0x7ff4('0x47')](_0x4ca1e4);}}}})['then'](function(){if(_0x2e9ef8){return db[_0x7ff4('0x39')]['findAll']({'where':{'membername':_0x2e9ef8[_0x7ff4('0x29')],'exitAt':null}});}})['then'](function(_0x263296){if(_0x2e9ef8){if(_0x263296&&_0x263296['length']){var _0x281333=[];_0x263296[_0x7ff4('0x46')](function(_0x4eb419){_0x281333[_0x7ff4('0x32')](_0x4eb419[_0x7ff4('0x2d')]({'exitAt':moment()[_0x7ff4('0x2f')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x7ff4('0x47')](_0x281333);}}})['then'](function(_0x3063ae){if(_0x2e9ef8){var _0x4c3412=[];var _0x42763a=[];var _0x55d51f=utils[_0x7ff4('0x54')]();var _0x1d1b0e={'membername':_0x2e9ef8[_0x7ff4('0x29')],'interface':_0x10d0d7,'enterAt':moment()[_0x7ff4('0x2f')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x2e9ef8[_0x7ff4('0x2a')],'internal':_0x2e9ef8[_0x7ff4('0x38')]};_0x55d51f['forEach'](function(_0x395d90){_0x4c3412['push'](_[_0x7ff4('0x55')]({'channel':_0x395d90,'type':_0x7ff4('0x56'),'data1':_0x7ff4('0x57'),'data2':_0x10d0d7},_0x1d1b0e));if(_0x2e9ef8[_0x7ff4('0x4d')]){_0x42763a[_0x7ff4('0x32')](_[_0x7ff4('0x55')]({'channel':_0x395d90,'type':_0x7ff4('0x34'),'data1':_0x7ff4('0x58')},_0x1d1b0e));}});return db[_0x7ff4('0x39')][_0x7ff4('0x3a')](_0x4c3412[_0x7ff4('0x59')](_0x42763a),{'individualHooks':!![]});}})['then'](function(){if(_0x2e9ef8){return _0x2e9ef8[_0x7ff4('0x2d')]({'online':!![],'lastLoginAt':moment()['format'](_0x7ff4('0x30')),'voicePause':_0x2e9ef8[_0x7ff4('0x4d')]||![],'mailPause':_0x2e9ef8['loginInPause']||![],'chatPause':_0x2e9ef8[_0x7ff4('0x4d')]||![],'faxPause':_0x2e9ef8[_0x7ff4('0x4d')]||![],'smsPause':_0x2e9ef8['loginInPause']||![],'openchannelPause':_0x2e9ef8[_0x7ff4('0x4d')]||![],'pauseType':_0x2e9ef8[_0x7ff4('0x4d')]?_0x7ff4('0x58'):null,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x10d0d7});}})['then'](function(_0x46f2a6){_0x3c2763(_0x46f2a6);})[_0x7ff4('0x1b')](function(_0x4ac903){_0x2fb3f3(_0x43086c['error'](0x1f4,_0x4ac903['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 7740875..3010249 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 _0xc8af=['length','remove','update','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc8af,0x13d));var _0xfc8a=function(_0x9aa840,_0x84ebbe){_0x9aa840=_0x9aa840-0x0;var _0x1b5e16=_0xc8af[_0x9aa840];return _0x1b5e16;};'use strict';var UserEvents=require('./user.events');var events=['save',_0xfc8a('0x0'),_0xfc8a('0x1')];function createListener(_0x4f978d,_0x5e1ba6){return function(_0x1a7041){_0x5e1ba6['emit'](_0x4f978d,_0x1a7041);};}function removeListener(_0x486aef,_0x4c6496){return function(){UserEvents[_0xfc8a('0x2')](_0x486aef,_0x4c6496);};}exports['register']=function(_0x24b176){for(var _0x43cb29=0x0,_0x44da5c=events[_0xfc8a('0x3')];_0x43cb29<_0x44da5c;_0x43cb29++){var _0x11d8cf=events[_0x43cb29];var _0x52da18=createListener('user:'+_0x11d8cf,_0x24b176);UserEvents['on'](_0x11d8cf,_0x52da18);}}; \ No newline at end of file +var _0xc332=['register','length','save','update','removeListener'];(function(_0x2ff2cb,_0x429c8b){var _0x27e306=function(_0x3d524a){while(--_0x3d524a){_0x2ff2cb['push'](_0x2ff2cb['shift']());}};_0x27e306(++_0x429c8b);}(_0xc332,0x183));var _0x2c33=function(_0x4c4dc9,_0x1cf5ae){_0x4c4dc9=_0x4c4dc9-0x0;var _0x2e5b34=_0xc332[_0x4c4dc9];return _0x2e5b34;};'use strict';var UserEvents=require('./user.events');var events=[_0x2c33('0x0'),'remove',_0x2c33('0x1')];function createListener(_0x2a98a7,_0x51eeb1){return function(_0x1eaf1c){_0x51eeb1['emit'](_0x2a98a7,_0x1eaf1c);};}function removeListener(_0x5dfb0c,_0x2b1528){return function(){UserEvents[_0x2c33('0x2')](_0x5dfb0c,_0x2b1528);};}exports[_0x2c33('0x3')]=function(_0x2c4d6a){for(var _0x2cceb3=0x0,_0x37fb5d=events[_0x2c33('0x4')];_0x2cceb3<_0x37fb5d;_0x2cceb3++){var _0x180897=events[_0x2cceb3];var _0x34fad6=createListener('user:'+_0x180897,_0x2c4d6a);UserEvents['on'](_0x180897,_0x34fad6);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index e257e4c..5546a23 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(_0x27038f,_0x27bde5){var _0x8c1051=function(_0x5f4199){while(--_0x5f4199){_0x27038f['push'](_0x27038f['shift']());}};_0x8c1051(++_0x27bde5);}(_0xe706,0xa3));var _0x6e70=function(_0x1892f9,_0x2cb4ab){_0x1892f9=_0x1892f9-0x0;var _0x5a765f=_0xe706[_0x1892f9];return _0x5a765f;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x550fbe,_0x2f37c6){var _0x13b43b=function(_0x8252dc){while(--_0x8252dc){_0x550fbe['push'](_0x550fbe['shift']());}};_0x13b43b(++_0x2f37c6);}(_0x70e0,0x17b));var _0x070e=function(_0x28fc98,_0x3363d0){_0x28fc98=_0x28fc98-0x0;var _0x1c7fb8=_0x70e0[_0x28fc98];return _0x1c7fb8;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index c58cad8..a9be16d 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 _0x0cc6=['exports','INTEGER','sequelize'];(function(_0x471a85,_0x239e8d){var _0x5f2039=function(_0x378952){while(--_0x378952){_0x471a85['push'](_0x471a85['shift']());}};_0x5f2039(++_0x239e8d);}(_0x0cc6,0x158));var _0x60cc=function(_0x2fdf82,_0x322e7c){_0x2fdf82=_0x2fdf82-0x0;var _0x2382f5=_0x0cc6[_0x2fdf82];return _0x2382f5;};'use strict';var Sequelize=require(_0x60cc('0x0'));module[_0x60cc('0x1')]={'penalty':{'type':Sequelize[_0x60cc('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf4bd=['INTEGER','exports'];(function(_0x3a109c,_0x2339a6){var _0x4474a2=function(_0x4cecc3){while(--_0x4cecc3){_0x3a109c['push'](_0x3a109c['shift']());}};_0x4474a2(++_0x2339a6);}(_0xf4bd,0xe7));var _0xdf4b=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xf4bd[_0x1c546c];return _0x2cc384;};'use strict';var Sequelize=require('sequelize');module[_0xdf4b('0x0')]={'penalty':{'type':Sequelize[_0xdf4b('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 ace39d8..0daf45b 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 _0x5505=['user_has_chat_queues','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue'];(function(_0x12254f,_0x100cfe){var _0x3a4fa2=function(_0x1ce891){while(--_0x1ce891){_0x12254f['push'](_0x12254f['shift']());}};_0x3a4fa2(++_0x100cfe);}(_0x5505,0x139));var _0x5550=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x5505[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x5550('0x0'));var util=require('util');var logger=require(_0x5550('0x1'))(_0x5550('0x2'));var moment=require(_0x5550('0x3'));var BPromise=require(_0x5550('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5550('0x5'));var rimraf=require('rimraf');var config=require(_0x5550('0x6'));var attributes=require(_0x5550('0x7'));module[_0x5550('0x8')]=function(_0x2a1cf7,_0xc2a46){return _0x2a1cf7[_0x5550('0x9')](_0x5550('0xa'),attributes,{'tableName':_0x5550('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6aa2=['../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4fb760,_0x49aa21){var _0x5d41bb=function(_0x5a65b6){while(--_0x5a65b6){_0x4fb760['push'](_0x4fb760['shift']());}};_0x5d41bb(++_0x49aa21);}(_0x6aa2,0x17d));var _0x26aa=function(_0x47c902,_0x220fd2){_0x47c902=_0x47c902-0x0;var _0x1ad6a0=_0x6aa2[_0x47c902];return _0x1ad6a0;};'use strict';var _=require(_0x26aa('0x0'));var util=require(_0x26aa('0x1'));var logger=require(_0x26aa('0x2'))(_0x26aa('0x3'));var moment=require(_0x26aa('0x4'));var BPromise=require(_0x26aa('0x5'));var rp=require(_0x26aa('0x6'));var fs=require('fs');var path=require(_0x26aa('0x7'));var rimraf=require(_0x26aa('0x8'));var config=require(_0x26aa('0x9'));var attributes=require(_0x26aa('0xa'));module[_0x26aa('0xb')]=function(_0x3e9718,_0x2b263c){return _0x3e9718[_0x26aa('0xc')](_0x26aa('0xd'),attributes,{'tableName':_0x26aa('0xe'),'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 4d05e4e..41f189e 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 _0x180d=['../../config/environment','jayson/promise','client','http','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc'];(function(_0xede86b,_0x19d449){var _0x125ad0=function(_0x557b60){while(--_0x557b60){_0xede86b['push'](_0xede86b['shift']());}};_0x125ad0(++_0x19d449);}(_0x180d,0x191));var _0xd180=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x180d[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require('lodash');var util=require(_0xd180('0x0'));var moment=require(_0xd180('0x1'));var BPromise=require(_0xd180('0x2'));var rs=require(_0xd180('0x3'));var fs=require('fs');var Redis=require(_0xd180('0x4'));var db=require(_0xd180('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd180('0x6'));var config=require(_0xd180('0x7'));var jayson=require(_0xd180('0x8'));var client=jayson[_0xd180('0x9')][_0xd180('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e49c4,_0x34dbb2,_0x533928){return new BPromise(function(_0x2da0d3,_0x26d8cf){return client[_0xd180('0xb')](_0x3e49c4,_0x533928)[_0xd180('0xc')](function(_0x53e33c){logger['info'](_0xd180('0xd'),_0x34dbb2,_0xd180('0xe'));logger[_0xd180('0xf')](_0xd180('0x10'),_0x34dbb2,_0xd180('0xe'),JSON[_0xd180('0x11')](_0x53e33c));if(_0x53e33c[_0xd180('0x12')]){if(_0x53e33c[_0xd180('0x12')][_0xd180('0x13')]===0x1f4){logger[_0xd180('0x12')](_0xd180('0xd'),_0x34dbb2,_0x53e33c[_0xd180('0x12')][_0xd180('0x14')]);return _0x26d8cf(_0x53e33c[_0xd180('0x12')][_0xd180('0x14')]);}logger[_0xd180('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x34dbb2,_0x53e33c[_0xd180('0x12')][_0xd180('0x14')]);return _0x2da0d3(_0x53e33c[_0xd180('0x12')]['message']);}else{logger[_0xd180('0x15')](_0xd180('0xd'),_0x34dbb2,_0xd180('0xe'));_0x2da0d3(_0x53e33c[_0xd180('0x16')][_0xd180('0x14')]);}})[_0xd180('0x17')](function(_0x4136bd){logger[_0xd180('0x12')](_0xd180('0xd'),_0x34dbb2,_0x4136bd);_0x26d8cf(_0x4136bd);});});} \ No newline at end of file +var _0x583d=['../../config/environment','jayson/promise','http','request','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4bc063,_0x2e9d5c){var _0x482ad0=function(_0x7e1794){while(--_0x7e1794){_0x4bc063['push'](_0x4bc063['shift']());}};_0x482ad0(++_0x2e9d5c);}(_0x583d,0x176));var _0xd583=function(_0x345344,_0x451196){_0x345344=_0x345344-0x0;var _0x4a5881=_0x583d[_0x345344];return _0x4a5881;};'use strict';var _=require('lodash');var util=require(_0xd583('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd583('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd583('0x2'))['db'];var utils=require(_0xd583('0x3'));var logger=require(_0xd583('0x4'))(_0xd583('0x5'));var config=require(_0xd583('0x6'));var jayson=require(_0xd583('0x7'));var client=jayson['client'][_0xd583('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5aeeb6,_0x41b2c0,_0x1e8fe4){return new BPromise(function(_0x4098ab,_0x27fca7){return client[_0xd583('0x9')](_0x5aeeb6,_0x1e8fe4)['then'](function(_0x1f2034){logger[_0xd583('0xa')](_0xd583('0xb'),_0x41b2c0,_0xd583('0xc'));logger[_0xd583('0xd')](_0xd583('0xe'),_0x41b2c0,'request\x20sent',JSON[_0xd583('0xf')](_0x1f2034));if(_0x1f2034[_0xd583('0x10')]){if(_0x1f2034[_0xd583('0x10')][_0xd583('0x11')]===0x1f4){logger['error'](_0xd583('0xb'),_0x41b2c0,_0x1f2034[_0xd583('0x10')][_0xd583('0x12')]);return _0x27fca7(_0x1f2034['error']['message']);}logger[_0xd583('0x10')](_0xd583('0xb'),_0x41b2c0,_0x1f2034[_0xd583('0x10')][_0xd583('0x12')]);return _0x4098ab(_0x1f2034['error'][_0xd583('0x12')]);}else{logger[_0xd583('0xa')](_0xd583('0xb'),_0x41b2c0,_0xd583('0xc'));_0x4098ab(_0x1f2034[_0xd583('0x13')][_0xd583('0x12')]);}})['catch'](function(_0x134bb2){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x41b2c0,_0x134bb2);_0x27fca7(_0x134bb2);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index ecce106..c7ad8ed 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4b6651,_0x40dcb4){var _0x5e8c87=function(_0x5c1238){while(--_0x5c1238){_0x4b6651['push'](_0x4b6651['shift']());}};_0x5e8c87(++_0x40dcb4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x87e0dc,_0x577dce){var _0x2cd2d1=function(_0x2d8173){while(--_0x2d8173){_0x87e0dc['push'](_0x87e0dc['shift']());}};_0x2cd2d1(++_0x577dce);}(_0x9c44,0x178));var _0x49c4=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x9c44[_0x4f9b18];return _0x29f20c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index df3b697..943d2b5 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 _0x684b=['sequelize','exports','INTEGER'];(function(_0x44f670,_0x1f27cd){var _0x2587ba=function(_0x54ccd0){while(--_0x54ccd0){_0x44f670['push'](_0x44f670['shift']());}};_0x2587ba(++_0x1f27cd);}(_0x684b,0x1d4));var _0xb684=function(_0x4091d8,_0x108c89){_0x4091d8=_0x4091d8-0x0;var _0x412365=_0x684b[_0x4091d8];return _0x412365;};'use strict';var Sequelize=require(_0xb684('0x0'));module[_0xb684('0x1')]={'penalty':{'type':Sequelize[_0xb684('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xb684('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x542b=['exports','INTEGER','STRING','sequelize'];(function(_0x2bd355,_0x179977){var _0x3c2511=function(_0x28e20f){while(--_0x28e20f){_0x2bd355['push'](_0x2bd355['shift']());}};_0x3c2511(++_0x179977);}(_0x542b,0x1af));var _0xb542=function(_0x454018,_0x46e33a){_0x454018=_0x454018-0x0;var _0x24697d=_0x542b[_0x454018];return _0x24697d;};'use strict';var Sequelize=require(_0xb542('0x0'));module[_0xb542('0x1')]={'penalty':{'type':Sequelize[_0xb542('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xb542('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xb542('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index e440d5a..899118e 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 _0x458f=['./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','util','../../config/logger','moment','path','rimraf'];(function(_0x392f82,_0x4dc713){var _0x3ad0b8=function(_0x29da4b){while(--_0x29da4b){_0x392f82['push'](_0x392f82['shift']());}};_0x3ad0b8(++_0x4dc713);}(_0x458f,0xeb));var _0xf458=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x458f[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0xf458('0x0'));var logger=require(_0xf458('0x1'))('api');var moment=require(_0xf458('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf458('0x3'));var rimraf=require(_0xf458('0x4'));var config=require('../../config/environment');var attributes=require(_0xf458('0x5'));module[_0xf458('0x6')]=function(_0x46335f,_0x55f58e){return _0x46335f[_0xf458('0x7')](_0xf458('0x8'),attributes,{'tableName':_0xf458('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1de1=['../../config/environment','./userFaxQueue.attributes','define','UserFaxQueue','user_has_fax_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x532687,_0xc7347a){var _0x5997e1=function(_0x1e40d4){while(--_0x1e40d4){_0x532687['push'](_0x532687['shift']());}};_0x5997e1(++_0xc7347a);}(_0x1de1,0x116));var _0x11de=function(_0x54c3fb,_0x20246a){_0x54c3fb=_0x54c3fb-0x0;var _0x5646d4=_0x1de1[_0x54c3fb];return _0x5646d4;};'use strict';var _=require(_0x11de('0x0'));var util=require('util');var logger=require(_0x11de('0x1'))(_0x11de('0x2'));var moment=require(_0x11de('0x3'));var BPromise=require(_0x11de('0x4'));var rp=require(_0x11de('0x5'));var fs=require('fs');var path=require(_0x11de('0x6'));var rimraf=require(_0x11de('0x7'));var config=require(_0x11de('0x8'));var attributes=require(_0x11de('0x9'));module['exports']=function(_0x3c803b,_0x1e5a0e){return _0x3c803b[_0x11de('0xa')](_0x11de('0xb'),attributes,{'tableName':_0x11de('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 76192da..41e46e0 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 _0x3906=['rpc','../../config/environment','jayson/promise','client','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','randomstring','../../config/utils','../../config/logger'];(function(_0x133fc0,_0x5ed4fd){var _0x1abd55=function(_0x34319c){while(--_0x34319c){_0x133fc0['push'](_0x133fc0['shift']());}};_0x1abd55(++_0x5ed4fd);}(_0x3906,0x119));var _0x6390=function(_0x23c3fa,_0x11fb0c){_0x23c3fa=_0x23c3fa-0x0;var _0x4a02b9=_0x3906[_0x23c3fa];return _0x4a02b9;};'use strict';var _=require(_0x6390('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6390('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6390('0x2'));var logger=require(_0x6390('0x3'))(_0x6390('0x4'));var config=require(_0x6390('0x5'));var jayson=require(_0x6390('0x6'));var client=jayson[_0x6390('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13bb14,_0x5dad35,_0x40101f){return new BPromise(function(_0x1e867a,_0x251a09){return client['request'](_0x13bb14,_0x40101f)[_0x6390('0x8')](function(_0x17c102){logger[_0x6390('0x9')](_0x6390('0xa'),_0x5dad35,_0x6390('0xb'));logger[_0x6390('0xc')](_0x6390('0xd'),_0x5dad35,_0x6390('0xb'),JSON[_0x6390('0xe')](_0x17c102));if(_0x17c102['error']){if(_0x17c102[_0x6390('0xf')][_0x6390('0x10')]===0x1f4){logger[_0x6390('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x5dad35,_0x17c102[_0x6390('0xf')][_0x6390('0x11')]);return _0x251a09(_0x17c102[_0x6390('0xf')][_0x6390('0x11')]);}logger['error'](_0x6390('0xa'),_0x5dad35,_0x17c102['error']['message']);return _0x1e867a(_0x17c102[_0x6390('0xf')][_0x6390('0x11')]);}else{logger[_0x6390('0x9')](_0x6390('0xa'),_0x5dad35,_0x6390('0xb'));_0x1e867a(_0x17c102[_0x6390('0x12')][_0x6390('0x11')]);}})['catch'](function(_0x468a8c){logger[_0x6390('0xf')](_0x6390('0xa'),_0x5dad35,_0x468a8c);_0x251a09(_0x468a8c);});});} \ No newline at end of file +var _0xc24d=['debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','UserFaxQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x1bc4de,_0x8487a8){var _0x41dd13=function(_0x365a8b){while(--_0x365a8b){_0x1bc4de['push'](_0x1bc4de['shift']());}};_0x41dd13(++_0x8487a8);}(_0xc24d,0x110));var _0xdc24=function(_0x1b02bb,_0x3d9fde){_0x1b02bb=_0x1b02bb-0x0;var _0x131245=_0xc24d[_0x1b02bb];return _0x131245;};'use strict';var _=require(_0xdc24('0x0'));var util=require(_0xdc24('0x1'));var moment=require(_0xdc24('0x2'));var BPromise=require(_0xdc24('0x3'));var rs=require(_0xdc24('0x4'));var fs=require('fs');var Redis=require(_0xdc24('0x5'));var db=require(_0xdc24('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdc24('0x7'));var config=require(_0xdc24('0x8'));var jayson=require(_0xdc24('0x9'));var client=jayson[_0xdc24('0xa')][_0xdc24('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f1960,_0xf1d19,_0x325bff){return new BPromise(function(_0x4d267d,_0x563f68){return client[_0xdc24('0xc')](_0x2f1960,_0x325bff)[_0xdc24('0xd')](function(_0x1c1374){logger[_0xdc24('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0xf1d19,_0xdc24('0xf'));logger[_0xdc24('0x10')](_0xdc24('0x11'),_0xf1d19,'request\x20sent',JSON['stringify'](_0x1c1374));if(_0x1c1374['error']){if(_0x1c1374[_0xdc24('0x12')][_0xdc24('0x13')]===0x1f4){logger[_0xdc24('0x12')](_0xdc24('0x14'),_0xf1d19,_0x1c1374[_0xdc24('0x12')][_0xdc24('0x15')]);return _0x563f68(_0x1c1374[_0xdc24('0x12')][_0xdc24('0x15')]);}logger[_0xdc24('0x12')](_0xdc24('0x14'),_0xf1d19,_0x1c1374['error'][_0xdc24('0x15')]);return _0x4d267d(_0x1c1374['error'][_0xdc24('0x15')]);}else{logger[_0xdc24('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0xf1d19,_0xdc24('0xf'));_0x4d267d(_0x1c1374[_0xdc24('0x16')]['message']);}})[_0xdc24('0x17')](function(_0x296cfc){logger['error'](_0xdc24('0x14'),_0xf1d19,_0x296cfc);_0x563f68(_0x296cfc);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 4301a95..a55788c 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(_0x4f8508,_0x32f74){var _0x512c4d=function(_0x187a2a){while(--_0x187a2a){_0x4f8508['push'](_0x4f8508['shift']());}};_0x512c4d(++_0x32f74);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x213be2,_0x54176b){var _0x4d31a5=function(_0x104530){while(--_0x104530){_0x213be2['push'](_0x213be2['shift']());}};_0x4d31a5(++_0x54176b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index a726769..a2dbdd1 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 _0xc5d3=['INTEGER','sequelize','exports'];(function(_0x3929e2,_0x4291e0){var _0x290b5f=function(_0x303623){while(--_0x303623){_0x3929e2['push'](_0x3929e2['shift']());}};_0x290b5f(++_0x4291e0);}(_0xc5d3,0x175));var _0x3c5d=function(_0x327cbf,_0x114362){_0x327cbf=_0x327cbf-0x0;var _0x409cb8=_0xc5d3[_0x327cbf];return _0x409cb8;};'use strict';var Sequelize=require(_0x3c5d('0x0'));module[_0x3c5d('0x1')]={'penalty':{'type':Sequelize[_0x3c5d('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6618=['INTEGER','sequelize','exports'];(function(_0x21a848,_0x5ce41a){var _0x5aaf99=function(_0x342593){while(--_0x342593){_0x21a848['push'](_0x21a848['shift']());}};_0x5aaf99(++_0x5ce41a);}(_0x6618,0xb8));var _0x8661=function(_0x14d629,_0x3a5110){_0x14d629=_0x14d629-0x0;var _0x508ffe=_0x6618[_0x14d629];return _0x508ffe;};'use strict';var Sequelize=require(_0x8661('0x0'));module[_0x8661('0x1')]={'penalty':{'type':Sequelize[_0x8661('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index b35d0b5..0b3ace2 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 _0x553d=['util','../../config/logger','moment','request-promise','path','rimraf','exports','user_has_mail_queues','lodash'];(function(_0x297acf,_0x530d6c){var _0x2dd757=function(_0x1b7aa9){while(--_0x1b7aa9){_0x297acf['push'](_0x297acf['shift']());}};_0x2dd757(++_0x530d6c);}(_0x553d,0x170));var _0xd553=function(_0x18f2a5,_0xfebc88){_0x18f2a5=_0x18f2a5-0x0;var _0x2b8c30=_0x553d[_0x18f2a5];return _0x2b8c30;};'use strict';var _=require(_0xd553('0x0'));var util=require(_0xd553('0x1'));var logger=require(_0xd553('0x2'))('api');var moment=require(_0xd553('0x3'));var BPromise=require('bluebird');var rp=require(_0xd553('0x4'));var fs=require('fs');var path=require(_0xd553('0x5'));var rimraf=require(_0xd553('0x6'));var config=require('../../config/environment');var attributes=require('./userMailQueue.attributes');module[_0xd553('0x7')]=function(_0x4028b0,_0x3e215d){return _0x4028b0['define']('UserMailQueue',attributes,{'tableName':_0xd553('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c0d=['moment','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger'];(function(_0x7532b,_0x1168b0){var _0x10cfec=function(_0xec023e){while(--_0xec023e){_0x7532b['push'](_0x7532b['shift']());}};_0x10cfec(++_0x1168b0);}(_0x5c0d,0x1c4));var _0xd5c0=function(_0x247fa1,_0x4ec37c){_0x247fa1=_0x247fa1-0x0;var _0x244f35=_0x5c0d[_0x247fa1];return _0x244f35;};'use strict';var _=require(_0xd5c0('0x0'));var util=require(_0xd5c0('0x1'));var logger=require(_0xd5c0('0x2'))('api');var moment=require(_0xd5c0('0x3'));var BPromise=require(_0xd5c0('0x4'));var rp=require(_0xd5c0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd5c0('0x6'));var config=require(_0xd5c0('0x7'));var attributes=require(_0xd5c0('0x8'));module[_0xd5c0('0x9')]=function(_0x439bcd,_0x56d80a){return _0x439bcd[_0xd5c0('0xa')](_0xd5c0('0xb'),attributes,{'tableName':_0xd5c0('0xc'),'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 b1c5b38..d520882 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 _0x4b84=['../../config/logger','rpc','http','then','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserMailQueue,\x20%s,\x20%s','message','lodash','util','randomstring','../../config/utils'];(function(_0x4b7eab,_0x35ec62){var _0x36a9ce=function(_0x4286c6){while(--_0x4286c6){_0x4b7eab['push'](_0x4b7eab['shift']());}};_0x36a9ce(++_0x35ec62);}(_0x4b84,0x1cc));var _0x44b8=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x4b84[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});} \ No newline at end of file +var _0xa41a=['rpc','../../config/environment','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x11bc8e,_0x293afe){var _0x218e59=function(_0x408122){while(--_0x408122){_0x11bc8e['push'](_0x11bc8e['shift']());}};_0x218e59(++_0x293afe);}(_0xa41a,0x6b));var _0xaa41=function(_0x2ace39,_0x3ea54a){_0x2ace39=_0x2ace39-0x0;var _0x57142b=_0xa41a[_0x2ace39];return _0x57142b;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 4d7df93..287fedb 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 _0xe129=['isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post'];(function(_0x3b22e9,_0x354406){var _0x230314=function(_0x29ae96){while(--_0x29ae96){_0x3b22e9['push'](_0x3b22e9['shift']());}};_0x230314(++_0x354406);}(_0xe129,0x129));var _0x9e12=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe129[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9e12('0x0'));var util=require(_0x9e12('0x1'));var path=require(_0x9e12('0x2'));var timeout=require(_0x9e12('0x3'));var express=require('express');var router=express[_0x9e12('0x4')]();var fs_extra=require(_0x9e12('0x5'));var auth=require(_0x9e12('0x6'));var interaction=require(_0x9e12('0x7'));var config=require(_0x9e12('0x8'));var controller=require(_0x9e12('0x9'));router[_0x9e12('0xa')]('/',auth[_0x9e12('0xb')](),controller[_0x9e12('0xc')]);module[_0x9e12('0xd')]=router; \ No newline at end of file +var _0xc868=['../../config/environment','sendUserNotification','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x578d71,_0x4412af){var _0x4398ee=function(_0x422dd6){while(--_0x422dd6){_0x578d71['push'](_0x578d71['shift']());}};_0x4398ee(++_0x4412af);}(_0xc868,0x16e));var _0x8c86=function(_0x2ff591,_0x37ff76){_0x2ff591=_0x2ff591-0x0;var _0x10336f=_0xc868[_0x2ff591];return _0x10336f;};'use strict';var multer=require('multer');var util=require(_0x8c86('0x0'));var path=require(_0x8c86('0x1'));var timeout=require(_0x8c86('0x2'));var express=require(_0x8c86('0x3'));var router=express[_0x8c86('0x4')]();var fs_extra=require(_0x8c86('0x5'));var auth=require(_0x8c86('0x6'));var interaction=require(_0x8c86('0x7'));var config=require(_0x8c86('0x8'));var controller=require('./userNotification.controller');router['post']('/',auth['isAuthenticated'](),controller[_0x8c86('0x9')]);module[_0x8c86('0xa')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 0bcd011..13044ff 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 _0xd292=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x65fd53,_0x14085c){var _0x22692f=function(_0x19f2dd){while(--_0x19f2dd){_0x65fd53['push'](_0x65fd53['shift']());}};_0x22692f(++_0x14085c);}(_0xd292,0x126));var _0x2d29=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd292[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2d29('0x0'));module[_0x2d29('0x1')]={'body':{'type':Sequelize[_0x2d29('0x2')]},'senderName':{'type':Sequelize[_0x2d29('0x3')]},'recipientsId':{'type':Sequelize[_0x2d29('0x2')]},'recipientsDescription':{'type':Sequelize[_0x2d29('0x3')]},'beep':{'type':Sequelize[_0x2d29('0x4')]}}; \ No newline at end of file +var _0x3427=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x3c936b,_0x499267){var _0x366e49=function(_0x26924c){while(--_0x26924c){_0x3c936b['push'](_0x3c936b['shift']());}};_0x366e49(++_0x499267);}(_0x3427,0x11f));var _0x7342=function(_0x59f557,_0x4a0f02){_0x59f557=_0x59f557-0x0;var _0x4962c7=_0x3427[_0x59f557];return _0x4962c7;};'use strict';var Sequelize=require(_0x7342('0x0'));module[_0x7342('0x1')]={'body':{'type':Sequelize[_0x7342('0x2')]},'senderName':{'type':Sequelize[_0x7342('0x3')]},'recipientsId':{'type':Sequelize[_0x7342('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x7342('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 12bfdbe..fd2ae6b 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 _0x654e=['path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./userNotification.socket','register','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','smsqueue','voicequeue','team','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','beep','recipientsId','sequelize','transaction','create','forEach','emit','catch','Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','toLowerCase','User','union','ids','replace','queue','Queue','push','flatten','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util'];(function(_0x12a53b,_0x3ea3da){var _0x28b49c=function(_0x28b727){while(--_0x28b727){_0x12a53b['push'](_0x12a53b['shift']());}};_0x28b49c(++_0x3ea3da);}(_0x654e,0x1d4));var _0xe654=function(_0x34b9c5,_0x42700f){_0x34b9c5=_0x34b9c5-0x0;var _0x10b193=_0x654e[_0x34b9c5];return _0x10b193;};'use strict';var emlformat=require(_0xe654('0x0'));var rimraf=require(_0xe654('0x1'));var zipdir=require(_0xe654('0x2'));var jsonpatch=require(_0xe654('0x3'));var rp=require(_0xe654('0x4'));var moment=require(_0xe654('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe654('0x6'));var path=require(_0xe654('0x7'));var sox=require(_0xe654('0x8'));var csv=require(_0xe654('0x9'));var ejs=require(_0xe654('0xa'));var fs=require('fs');var fs_extra=require(_0xe654('0xb'));var _=require('lodash');var squel=require(_0xe654('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe654('0xd'));var toCsv=require(_0xe654('0x9'));var querystring=require(_0xe654('0xe'));var Papa=require('papaparse');var Redis=require(_0xe654('0xf'));var authService=require(_0xe654('0x10'));var qs=require(_0xe654('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe654('0x12'))(_0xe654('0x13'));var utils=require(_0xe654('0x14'));var config=require(_0xe654('0x15'));var licenseUtil=require(_0xe654('0x16'));var db=require(_0xe654('0x17'))['db'];config['redis']=_[_0xe654('0x18')](config[_0xe654('0x19')],{'host':_0xe654('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe654('0x19')]));require(_0xe654('0x1b'))[_0xe654('0x1c')](socket);function respondWithStatusCode(_0x5e00f9,_0x32e30a){_0x32e30a=_0x32e30a||0xcc;return function(_0x56a653){if(_0x56a653){return _0x5e00f9['sendStatus'](_0x32e30a);}return _0x5e00f9[_0xe654('0x1d')](_0x32e30a)[_0xe654('0x1e')]();};}function respondWithResult(_0xa96cac,_0x4682b9){_0x4682b9=_0x4682b9||0xc8;return function(_0x3f2c4e){if(_0x3f2c4e){return _0xa96cac[_0xe654('0x1d')](_0x4682b9)[_0xe654('0x1f')](_0x3f2c4e);}};}function respondWithFilteredResult(_0x2eb480,_0x1f64f4){return function(_0x17b54c){if(_0x17b54c){var _0x470e03=typeof _0x1f64f4[_0xe654('0x20')]===_0xe654('0x21')&&typeof _0x1f64f4['limit']===_0xe654('0x21');var _0x53f250=_0x17b54c['count'];var _0x158c7a=_0x470e03?0x0:_0x1f64f4[_0xe654('0x20')];var _0x24e898=_0x470e03?_0x17b54c[_0xe654('0x22')]:_0x1f64f4[_0xe654('0x20')]+_0x1f64f4['limit'];var _0x40a756;if(_0x24e898>=_0x53f250){_0x24e898=_0x53f250;_0x40a756=0xc8;}else{_0x40a756=0xce;}_0x2eb480[_0xe654('0x1d')](_0x40a756);return _0x2eb480[_0xe654('0x23')](_0xe654('0x24'),_0x158c7a+'-'+_0x24e898+'/'+_0x53f250)[_0xe654('0x1f')](_0x17b54c);}return null;};}function patchUpdates(_0x3631ed){return function(_0x1e309d){try{jsonpatch[_0xe654('0x25')](_0x1e309d,_0x3631ed,!![]);}catch(_0x20efc5){return BPromise[_0xe654('0x26')](_0x20efc5);}return _0x1e309d[_0xe654('0x27')]();};}function saveUpdates(_0x3d023d,_0xf8c2e8){return function(_0x44d8ac){if(_0x44d8ac){return _0x44d8ac[_0xe654('0x28')](_0x3d023d)['then'](function(_0x304667){return _0x304667;});}return null;};}function removeEntity(_0x30724e,_0x30987d){return function(_0x17676d){if(_0x17676d){return _0x17676d[_0xe654('0x29')]()[_0xe654('0x2a')](function(){_0x30724e[_0xe654('0x1d')](0xcc)[_0xe654('0x1e')]();});}};}function handleEntityNotFound(_0x1b80c6,_0x421036){return function(_0x4d86fa){if(!_0x4d86fa){_0x1b80c6[_0xe654('0x2b')](0x194);}return _0x4d86fa;};}function handleError(_0x293209,_0x3c0249){_0x3c0249=_0x3c0249||0x1f4;return function(_0x561f42){logger['error'](_0x561f42['stack']);if(_0x561f42[_0xe654('0x2c')]){delete _0x561f42['name'];}_0x293209[_0xe654('0x1d')](_0x3c0249)[_0xe654('0x2d')](_0x561f42);};}exports[_0xe654('0x2e')]=function(_0x29d5fc,_0x4c90f2,_0x40303c){if(!_0x29d5fc[_0xe654('0x2f')][_0xe654('0x30')](_0xe654('0x31'))&&!_0x29d5fc[_0xe654('0x2f')][_0xe654('0x30')](_0xe654('0x32'))){throw new db[(_0xe654('0x33'))]['ValidationError']('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x29d5fc[_0xe654('0x2f')][_0xe654('0x30')](_0xe654('0x32'))&&!_0x29d5fc['body']['hasOwnProperty']('view')){throw new db[(_0xe654('0x33'))][(_0xe654('0x34'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x29d5fc[_0xe654('0x2f')][_0xe654('0x30')](_0xe654('0x35'))){throw new db[(_0xe654('0x33'))][(_0xe654('0x34'))](_0xe654('0x36'));}else{try{var _0x5ea2b1=JSON[_0xe654('0x37')](_0x29d5fc[_0xe654('0x2f')][_0xe654('0x35')]);}catch(_0x49523f){logger['error'](_0x49523f);throw new db[(_0xe654('0x33'))][(_0xe654('0x34'))](_0xe654('0x38'));}var _0x22f6c5=[_0xe654('0x39'),_0xe654('0x3a'),'mailqueue',_0xe654('0x3b'),_0xe654('0x3c'),_0xe654('0x3d'),'whatsappqueue',_0xe654('0x3e'),'user'];if(_[_0xe654('0x3f')](_0x5ea2b1,function(_0x330371){return!_[_0xe654('0x40')](_0x22f6c5,_0x330371[_0xe654('0x41')]['toLowerCase']());})){throw new db[(_0xe654('0x33'))]['ValidationError'](_0xe654('0x42'));}}}var _0x13f508={};_0x13f508[_0xe654('0x43')]=_0x29d5fc[_0xe654('0x2f')][_0xe654('0x30')](_0xe654('0x43'))?_0x29d5fc['body']['senderName']:_0x29d5fc[_0xe654('0x44')][_0xe654('0x45')];_0x13f508[_0xe654('0x46')]=_['isEmpty'](_0x29d5fc[_0xe654('0x2f')]['recipientsDescription'])?null:_0x29d5fc[_0xe654('0x2f')][_0xe654('0x46')];_0x13f508[_0xe654('0x47')]=_0x29d5fc[_0xe654('0x2f')][_0xe654('0x47')]||![];_0x13f508['SenderId']=_0x29d5fc['user']['id'];return getContent(_0x29d5fc[_0xe654('0x2f')])[_0xe654('0x2a')](function(_0xc11a45){_0x13f508[_0xe654('0x2f')]=_0xc11a45;return getRecipients(_0x5ea2b1);})['then'](function(_0x335fc7){_0x13f508[_0xe654('0x48')]=_['sortBy'](_0x335fc7)['join'](',');return db[_0xe654('0x49')][_0xe654('0x4a')](function(_0x2bcf30){return db['UserNotification'][_0xe654('0x4b')](_0x13f508,{'raw':!![],'transaction':_0x2bcf30})[_0xe654('0x2a')](function(_0x2fe282){var _0xa1d372={'sender':_0x13f508['senderName'],'description':_0x13f508[_0xe654('0x46')],'content':_0x13f508['body'],'beep':_0x13f508[_0xe654('0x47')]};_0x335fc7[_0xe654('0x4c')](function(_0x3e814f){_0xa1d372['recipient']=_0x3e814f;socket[_0xe654('0x4d')]('userNotification:send',_0xa1d372);});return _0x2fe282;});});})[_0xe654('0x2a')](respondWithResult(_0x4c90f2,0xc9))[_0xe654('0x4e')](handleError(_0x4c90f2,null));};function getContent(_0x46b74f){return new BPromise(function(_0x34185f,_0x15837e){if(_0x46b74f[_0xe654('0x31')]){_0x34185f(_0x46b74f[_0xe654('0x31')]);return;}return db[_0xe654('0x4f')]['findOne']({'attributes':[_0xe654('0x50')],'where':{'id':_0x46b74f[_0xe654('0x32')]},'raw':!![]})['then'](function(_0x194816){if(!_0x194816)throw new db[(_0xe654('0x33'))][(_0xe654('0x34'))](_0xe654('0x51'));var _0x52ea04=Mustache[_0xe654('0x52')](_0x194816[_0xe654('0x50')],_0x46b74f['view']);_0x34185f(_0x52ea04);})[_0xe654('0x4e')](function(_0x33796){_0x15837e(_0x33796);});});}function getRecipients(_0x22ac35){return new BPromise(function(_0x49685e,_0x589eba){var _0x460b16=[];var _0x1b5594=[];_0x22ac35['forEach'](function(_0x18fde9){var _0x26f3c9=_[_0xe654('0x53')](_0x18fde9['model'][_0xe654('0x54')]());if(_0x26f3c9===_0xe654('0x55')){_0x460b16=_[_0xe654('0x56')](_0x460b16,_0x18fde9[_0xe654('0x57')]);}else{if(_[_0xe654('0x40')](_0x26f3c9,'queue'))_0x26f3c9=_0x26f3c9[_0xe654('0x58')](_0xe654('0x59'),_0xe654('0x5a'));_0x18fde9[_0xe654('0x57')]['forEach'](function(_0x3bc819){_0x1b5594[_0xe654('0x5b')](getAgents(_0x26f3c9,_0x3bc819));});}});return BPromise['all'](_0x1b5594)[_0xe654('0x2a')](function(_0xee62eb){_0x460b16=_[_0xe654('0x56')](_0x460b16,_[_0xe654('0x5c')](_0xee62eb));_0x49685e(_0x460b16);})[_0xe654('0x4e')](function(_0x5869bd){_0x589eba(_0x5869bd);});});}function getAgents(_0x543b0d,_0x2eac48){return new BPromise(function(_0x4ff74d,_0xeba036){return db[_0x543b0d]['findOne']({'where':{'id':_0x2eac48}})['then'](function(_0x2e6282){return _0x2e6282[_0xe654('0x5d')]({'attributes':['id'],'raw':!![]})[_0xe654('0x2a')](function(_0x5ceed7){var _0x1519a1=_[_0xe654('0x5e')](_0x5ceed7,'id');_0x4ff74d(_0x1519a1);});})[_0xe654('0x4e')](function(_0x8d4550){_0xeba036(_0x8d4550);});});} \ No newline at end of file +var _0xf683=['sequelize','transaction','UserNotification','create','forEach','Template','html','startCase','User','union','ids','queue','replace','Queue','push','all','catch','findOne','getAgents','map','eml-format','rimraf','request-promise','moment','bluebird','path','sox','ejs','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','error','stack','name','sendUserNotification','body','text','TemplateId','Sequelize','ValidationError','hasOwnProperty','view','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','faxqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','sortBy','join'];(function(_0x3eadb9,_0x396b2e){var _0x56e053=function(_0x2ef350){while(--_0x2ef350){_0x3eadb9['push'](_0x3eadb9['shift']());}};_0x56e053(++_0x396b2e);}(_0xf683,0xca));var _0x3f68=function(_0x359bde,_0x37882f){_0x359bde=_0x359bde-0x0;var _0x632a6a=_0xf683[_0x359bde];return _0x632a6a;};'use strict';var emlformat=require(_0x3f68('0x0'));var rimraf=require(_0x3f68('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3f68('0x2'));var moment=require(_0x3f68('0x3'));var BPromise=require(_0x3f68('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3f68('0x5'));var sox=require(_0x3f68('0x6'));var csv=require('to-csv');var ejs=require(_0x3f68('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3f68('0x8'));var deskjs=require(_0x3f68('0x9'));var toCsv=require(_0x3f68('0xa'));var querystring=require(_0x3f68('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3f68('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x3f68('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f68('0xe'))(_0x3f68('0xf'));var utils=require(_0x3f68('0x10'));var config=require(_0x3f68('0x11'));var licenseUtil=require(_0x3f68('0x12'));var db=require(_0x3f68('0x13'))['db'];config[_0x3f68('0x14')]=_[_0x3f68('0x15')](config[_0x3f68('0x14')],{'host':_0x3f68('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./userNotification.socket')[_0x3f68('0x17')](socket);function respondWithStatusCode(_0xb8c026,_0x4a9385){_0x4a9385=_0x4a9385||0xcc;return function(_0x273808){if(_0x273808){return _0xb8c026[_0x3f68('0x18')](_0x4a9385);}return _0xb8c026[_0x3f68('0x19')](_0x4a9385)[_0x3f68('0x1a')]();};}function respondWithResult(_0x150230,_0x2126a0){_0x2126a0=_0x2126a0||0xc8;return function(_0x558cd7){if(_0x558cd7){return _0x150230[_0x3f68('0x19')](_0x2126a0)['json'](_0x558cd7);}};}function respondWithFilteredResult(_0x4580f8,_0x92e7d6){return function(_0x169562){if(_0x169562){var _0x1d5366=typeof _0x92e7d6[_0x3f68('0x1b')]===_0x3f68('0x1c')&&typeof _0x92e7d6[_0x3f68('0x1d')]==='undefined';var _0x4bb828=_0x169562[_0x3f68('0x1e')];var _0x19d5b5=_0x1d5366?0x0:_0x92e7d6[_0x3f68('0x1b')];var _0x47a13f=_0x1d5366?_0x169562['count']:_0x92e7d6[_0x3f68('0x1b')]+_0x92e7d6[_0x3f68('0x1d')];var _0x4dd1eb;if(_0x47a13f>=_0x4bb828){_0x47a13f=_0x4bb828;_0x4dd1eb=0xc8;}else{_0x4dd1eb=0xce;}_0x4580f8[_0x3f68('0x19')](_0x4dd1eb);return _0x4580f8[_0x3f68('0x1f')](_0x3f68('0x20'),_0x19d5b5+'-'+_0x47a13f+'/'+_0x4bb828)[_0x3f68('0x21')](_0x169562);}return null;};}function patchUpdates(_0x17b880){return function(_0x3ce514){try{jsonpatch['apply'](_0x3ce514,_0x17b880,!![]);}catch(_0x34c07f){return BPromise[_0x3f68('0x22')](_0x34c07f);}return _0x3ce514[_0x3f68('0x23')]();};}function saveUpdates(_0x154d6f,_0x338673){return function(_0x11b6b1){if(_0x11b6b1){return _0x11b6b1[_0x3f68('0x24')](_0x154d6f)[_0x3f68('0x25')](function(_0x5447a0){return _0x5447a0;});}return null;};}function removeEntity(_0xf8d210,_0x376570){return function(_0x501339){if(_0x501339){return _0x501339['destroy']()['then'](function(){_0xf8d210['status'](0xcc)[_0x3f68('0x1a')]();});}};}function handleEntityNotFound(_0x5c3d74,_0x5b5de4){return function(_0x32db4c){if(!_0x32db4c){_0x5c3d74[_0x3f68('0x18')](0x194);}return _0x32db4c;};}function handleError(_0xb4d61c,_0x1152f9){_0x1152f9=_0x1152f9||0x1f4;return function(_0x45de30){logger[_0x3f68('0x26')](_0x45de30[_0x3f68('0x27')]);if(_0x45de30[_0x3f68('0x28')]){delete _0x45de30[_0x3f68('0x28')];}_0xb4d61c['status'](_0x1152f9)['send'](_0x45de30);};}exports[_0x3f68('0x29')]=function(_0x373239,_0x631179,_0x393e71){if(!_0x373239[_0x3f68('0x2a')]['hasOwnProperty'](_0x3f68('0x2b'))&&!_0x373239[_0x3f68('0x2a')]['hasOwnProperty'](_0x3f68('0x2c'))){throw new db[(_0x3f68('0x2d'))][(_0x3f68('0x2e'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x373239[_0x3f68('0x2a')]['hasOwnProperty']('TemplateId')&&!_0x373239['body'][_0x3f68('0x2f')](_0x3f68('0x30'))){throw new db[(_0x3f68('0x2d'))]['ValidationError']('Missing\x20\x27view\x27\x20parameter');}if(!_0x373239[_0x3f68('0x2a')][_0x3f68('0x2f')](_0x3f68('0x31'))){throw new db[(_0x3f68('0x2d'))][(_0x3f68('0x2e'))](_0x3f68('0x32'));}else{try{var _0x4fa409=JSON[_0x3f68('0x33')](_0x373239[_0x3f68('0x2a')][_0x3f68('0x31')]);}catch(_0x1b7d3c){logger[_0x3f68('0x26')](_0x1b7d3c);throw new db['Sequelize']['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0x4d2810=['chatqueue',_0x3f68('0x34'),_0x3f68('0x35'),'openchannelqueue',_0x3f68('0x36'),_0x3f68('0x37'),_0x3f68('0x38'),'team',_0x3f68('0x39')];if(_[_0x3f68('0x3a')](_0x4fa409,function(_0x5823f2){return!_[_0x3f68('0x3b')](_0x4d2810,_0x5823f2[_0x3f68('0x3c')][_0x3f68('0x3d')]());})){throw new db[(_0x3f68('0x2d'))][(_0x3f68('0x2e'))](_0x3f68('0x3e'));}}}var _0x5b7266={};_0x5b7266[_0x3f68('0x3f')]=_0x373239['body'][_0x3f68('0x2f')](_0x3f68('0x3f'))?_0x373239[_0x3f68('0x2a')]['senderName']:_0x373239['user'][_0x3f68('0x40')];_0x5b7266[_0x3f68('0x41')]=_[_0x3f68('0x42')](_0x373239['body']['recipientsDescription'])?null:_0x373239[_0x3f68('0x2a')][_0x3f68('0x41')];_0x5b7266[_0x3f68('0x43')]=_0x373239['body'][_0x3f68('0x43')]||![];_0x5b7266[_0x3f68('0x44')]=_0x373239[_0x3f68('0x39')]['id'];return getContent(_0x373239[_0x3f68('0x2a')])[_0x3f68('0x25')](function(_0x11c888){_0x5b7266['body']=_0x11c888;return getRecipients(_0x4fa409);})[_0x3f68('0x25')](function(_0x4ec8d9){_0x5b7266['recipientsId']=_[_0x3f68('0x45')](_0x4ec8d9)[_0x3f68('0x46')](',');return db[_0x3f68('0x47')][_0x3f68('0x48')](function(_0x156889){return db[_0x3f68('0x49')][_0x3f68('0x4a')](_0x5b7266,{'raw':!![],'transaction':_0x156889})[_0x3f68('0x25')](function(_0x1153b3){var _0x31ecd4={'sender':_0x5b7266[_0x3f68('0x3f')],'description':_0x5b7266[_0x3f68('0x41')],'content':_0x5b7266['body'],'beep':_0x5b7266['beep']};_0x4ec8d9[_0x3f68('0x4b')](function(_0x914b9b){_0x31ecd4['recipient']=_0x914b9b;socket['emit']('userNotification:send',_0x31ecd4);});return _0x1153b3;});});})[_0x3f68('0x25')](respondWithResult(_0x631179,0xc9))['catch'](handleError(_0x631179,null));};function getContent(_0x17d284){return new BPromise(function(_0x47f7e9,_0x5d26ba){if(_0x17d284[_0x3f68('0x2b')]){_0x47f7e9(_0x17d284['text']);return;}return db[_0x3f68('0x4c')]['findOne']({'attributes':['html'],'where':{'id':_0x17d284[_0x3f68('0x2c')]},'raw':!![]})[_0x3f68('0x25')](function(_0x192e87){if(!_0x192e87)throw new db[(_0x3f68('0x2d'))][(_0x3f68('0x2e'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x8b4d6e=Mustache['render'](_0x192e87[_0x3f68('0x4d')],_0x17d284['view']);_0x47f7e9(_0x8b4d6e);})['catch'](function(_0x1b420c){_0x5d26ba(_0x1b420c);});});}function getRecipients(_0x3d347d){return new BPromise(function(_0x2afc07,_0x345329){var _0xcc8cdd=[];var _0x3610a6=[];_0x3d347d[_0x3f68('0x4b')](function(_0x2df3fe){var _0x1c7621=_[_0x3f68('0x4e')](_0x2df3fe[_0x3f68('0x3c')][_0x3f68('0x3d')]());if(_0x1c7621===_0x3f68('0x4f')){_0xcc8cdd=_[_0x3f68('0x50')](_0xcc8cdd,_0x2df3fe[_0x3f68('0x51')]);}else{if(_[_0x3f68('0x3b')](_0x1c7621,_0x3f68('0x52')))_0x1c7621=_0x1c7621[_0x3f68('0x53')](_0x3f68('0x52'),_0x3f68('0x54'));_0x2df3fe['ids'][_0x3f68('0x4b')](function(_0x121a81){_0x3610a6[_0x3f68('0x55')](getAgents(_0x1c7621,_0x121a81));});}});return BPromise[_0x3f68('0x56')](_0x3610a6)[_0x3f68('0x25')](function(_0x138aab){_0xcc8cdd=_[_0x3f68('0x50')](_0xcc8cdd,_['flatten'](_0x138aab));_0x2afc07(_0xcc8cdd);})[_0x3f68('0x57')](function(_0x3430f2){_0x345329(_0x3430f2);});});}function getAgents(_0x3847ea,_0x595031){return new BPromise(function(_0x103e4d,_0x4dcd5b){return db[_0x3847ea][_0x3f68('0x58')]({'where':{'id':_0x595031}})['then'](function(_0x3f5cff){return _0x3f5cff[_0x3f68('0x59')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4eed77){var _0x6231ff=_[_0x3f68('0x5a')](_0x4eed77,'id');_0x103e4d(_0x6231ff);});})['catch'](function(_0x23fd63){_0x4dcd5b(_0x23fd63);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index f20175b..672f0ef 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 _0x1731=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserNotification'];(function(_0xd839e7,_0x4209e9){var _0xc3cf23=function(_0x16ace2){while(--_0x16ace2){_0xd839e7['push'](_0xd839e7['shift']());}};_0xc3cf23(++_0x4209e9);}(_0x1731,0x1c8));var _0x1173=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1731[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x1173('0x0'));var UserNotification=require(_0x1173('0x1'))['db'][_0x1173('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x1173('0x3')](0x0);var events={'afterCreate':_0x1173('0x4'),'afterUpdate':'update','afterDestroy':_0x1173('0x5')};function emitEvent(_0x41b04f){return function(_0x390717,_0x66b2c6,_0x21856e){UserNotificationEvents[_0x1173('0x6')](_0x41b04f+':'+_0x390717['id'],_0x390717);UserNotificationEvents[_0x1173('0x6')](_0x41b04f,_0x390717);_0x21856e(null);};}for(var e in events){if(events[_0x1173('0x7')](e)){var event=events[e];UserNotification[_0x1173('0x8')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0xd896=['events','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x3ee1fe,_0x59f2a1){var _0x1ae57a=function(_0x1ef0c4){while(--_0x1ef0c4){_0x3ee1fe['push'](_0x3ee1fe['shift']());}};_0x1ae57a(++_0x59f2a1);}(_0xd896,0x1b0));var _0x6d89=function(_0x2664bb,_0x349c07){_0x2664bb=_0x2664bb-0x0;var _0x4fe1ff=_0xd896[_0x2664bb];return _0x4fe1ff;};'use strict';var EventEmitter=require(_0x6d89('0x0'));var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x6d89('0x1')](0x0);var events={'afterCreate':_0x6d89('0x2'),'afterUpdate':_0x6d89('0x3'),'afterDestroy':_0x6d89('0x4')};function emitEvent(_0x20454a){return function(_0x3778c9,_0x14a2d7,_0x450fbe){UserNotificationEvents[_0x6d89('0x5')](_0x20454a+':'+_0x3778c9['id'],_0x3778c9);UserNotificationEvents[_0x6d89('0x5')](_0x20454a,_0x3778c9);_0x450fbe(null);};}for(var e in events){if(events[_0x6d89('0x6')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x6d89('0x7')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index b80e2d7..15404f5 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 _0x6027=['UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x1bd169,_0x4a3c56){var _0x5451e8=function(_0xffec01){while(--_0xffec01){_0x1bd169['push'](_0x1bd169['shift']());}};_0x5451e8(++_0x4a3c56);}(_0x6027,0x90));var _0x7602=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0x6027[_0x236d24];return _0x1574cf;};'use strict';var _=require(_0x7602('0x0'));var util=require(_0x7602('0x1'));var logger=require(_0x7602('0x2'))('api');var moment=require(_0x7602('0x3'));var BPromise=require('bluebird');var rp=require(_0x7602('0x4'));var fs=require('fs');var path=require(_0x7602('0x5'));var rimraf=require(_0x7602('0x6'));var config=require(_0x7602('0x7'));var attributes=require('./userNotification.attributes');module[_0x7602('0x8')]=function(_0x9c1438,_0x366c3f){return _0x9c1438[_0x7602('0x9')](_0x7602('0xa'),attributes,{'tableName':_0x7602('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7602('0xc'),'collate':_0x7602('0xd')});}; \ No newline at end of file +var _0x5354=['util','../../config/logger','api','rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4_unicode_ci','lodash'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x5354,0x18b));var _0x4535=function(_0x2ef8dc,_0x3ea7cb){_0x2ef8dc=_0x2ef8dc-0x0;var _0x5b641c=_0x5354[_0x2ef8dc];return _0x5b641c;};'use strict';var _=require(_0x4535('0x0'));var util=require(_0x4535('0x1'));var logger=require(_0x4535('0x2'))(_0x4535('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4535('0x4'));var config=require(_0x4535('0x5'));var attributes=require(_0x4535('0x6'));module[_0x4535('0x7')]=function(_0x3fc439,_0xfe2418){return _0x3fc439[_0x4535('0x8')](_0x4535('0x9'),attributes,{'tableName':_0x4535('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x4535('0xb')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index bdf9018..a788ae3 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 _0x98a1=['info','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','code','UserNotification,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','then'];(function(_0x1812d5,_0x43f247){var _0x2aca09=function(_0x593484){while(--_0x593484){_0x1812d5['push'](_0x1812d5['shift']());}};_0x2aca09(++_0x43f247);}(_0x98a1,0x176));var _0x198a=function(_0x296039,_0x3f3e50){_0x296039=_0x296039-0x0;var _0x16e440=_0x98a1[_0x296039];return _0x16e440;};'use strict';var _=require(_0x198a('0x0'));var util=require(_0x198a('0x1'));var moment=require(_0x198a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x198a('0x3'));var db=require(_0x198a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x198a('0x5'))('rpc');var config=require(_0x198a('0x6'));var jayson=require(_0x198a('0x7'));var client=jayson['client'][_0x198a('0x8')]({'port':0x232a});config[_0x198a('0x9')]=_[_0x198a('0xa')](config[_0x198a('0x9')],{'host':_0x198a('0xb'),'port':0x18eb});var socket=require(_0x198a('0xc'))(new Redis(config[_0x198a('0x9')]));require(_0x198a('0xd'))[_0x198a('0xe')](socket);function respondWithRpcPromise(_0x36c828,_0x53822f,_0x44676e){return new BPromise(function(_0x18e7a5,_0x3ad966){return client['request'](_0x36c828,_0x44676e)[_0x198a('0xf')](function(_0x110165){logger[_0x198a('0x10')]('UserNotification,\x20%s,\x20%s',_0x53822f,_0x198a('0x11'));logger[_0x198a('0x12')](_0x198a('0x13'),_0x53822f,_0x198a('0x11'),JSON['stringify'](_0x110165));if(_0x110165[_0x198a('0x14')]){if(_0x110165[_0x198a('0x14')][_0x198a('0x15')]===0x1f4){logger[_0x198a('0x14')](_0x198a('0x16'),_0x53822f,_0x110165['error'][_0x198a('0x17')]);return _0x3ad966(_0x110165['error'][_0x198a('0x17')]);}logger[_0x198a('0x14')](_0x198a('0x16'),_0x53822f,_0x110165[_0x198a('0x14')][_0x198a('0x17')]);return _0x18e7a5(_0x110165[_0x198a('0x14')][_0x198a('0x17')]);}else{logger[_0x198a('0x10')](_0x198a('0x16'),_0x53822f,'request\x20sent');_0x18e7a5(_0x110165[_0x198a('0x18')][_0x198a('0x17')]);}})[_0x198a('0x19')](function(_0xc71763){logger[_0x198a('0x14')](_0x198a('0x16'),_0x53822f,_0xc71763);_0x3ad966(_0xc71763);});});} \ No newline at end of file +var _0x24ef=['code','message','info','catch','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','register','request','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2b49bc,_0x47b636){var _0x43cc65=function(_0x236ec3){while(--_0x236ec3){_0x2b49bc['push'](_0x2b49bc['shift']());}};_0x43cc65(++_0x47b636);}(_0x24ef,0x124));var _0xf24e=function(_0x3be244,_0x8d6c7e){_0x3be244=_0x3be244-0x0;var _0x256e64=_0x24ef[_0x3be244];return _0x256e64;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xf24e('0x0'));var rs=require(_0xf24e('0x1'));var fs=require('fs');var Redis=require(_0xf24e('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xf24e('0x3'));var logger=require(_0xf24e('0x4'))(_0xf24e('0x5'));var config=require(_0xf24e('0x6'));var jayson=require(_0xf24e('0x7'));var client=jayson[_0xf24e('0x8')]['http']({'port':0x232a});config['redis']=_[_0xf24e('0x9')](config[_0xf24e('0xa')],{'host':_0xf24e('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf24e('0xa')]));require('./userNotification.socket')[_0xf24e('0xc')](socket);function respondWithRpcPromise(_0x22d4b2,_0x3d85e8,_0x854917){return new BPromise(function(_0x1e8953,_0x58516f){return client[_0xf24e('0xd')](_0x22d4b2,_0x854917)['then'](function(_0x45f086){logger['info'](_0xf24e('0xe'),_0x3d85e8,_0xf24e('0xf'));logger[_0xf24e('0x10')](_0xf24e('0x11'),_0x3d85e8,_0xf24e('0xf'),JSON[_0xf24e('0x12')](_0x45f086));if(_0x45f086[_0xf24e('0x13')]){if(_0x45f086[_0xf24e('0x13')][_0xf24e('0x14')]===0x1f4){logger[_0xf24e('0x13')](_0xf24e('0xe'),_0x3d85e8,_0x45f086[_0xf24e('0x13')][_0xf24e('0x15')]);return _0x58516f(_0x45f086[_0xf24e('0x13')][_0xf24e('0x15')]);}logger['error'](_0xf24e('0xe'),_0x3d85e8,_0x45f086[_0xf24e('0x13')][_0xf24e('0x15')]);return _0x1e8953(_0x45f086[_0xf24e('0x13')][_0xf24e('0x15')]);}else{logger[_0xf24e('0x16')](_0xf24e('0xe'),_0x3d85e8,'request\x20sent');_0x1e8953(_0x45f086['result']['message']);}})[_0xf24e('0x17')](function(_0x58a7b2){logger[_0xf24e('0x13')](_0xf24e('0xe'),_0x3d85e8,_0x58a7b2);_0x58516f(_0x58a7b2);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index dbce687..458f50d 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 _0xc462=['removeListener','register','length','update'];(function(_0x49d101,_0x79ffde){var _0x1fe79d=function(_0x2074ce){while(--_0x2074ce){_0x49d101['push'](_0x49d101['shift']());}};_0x1fe79d(++_0x79ffde);}(_0xc462,0xcf));var _0x2c46=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xc462[_0x4d613c];return _0x301fe3;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=['save','remove',_0x2c46('0x0')];function createListener(_0x534a5f,_0x2a779a){return function(_0x21c3c3){_0x2a779a['emit'](_0x534a5f,_0x21c3c3);};}function removeListener(_0x10f229,_0x44d006){return function(){UserNotificationEvents[_0x2c46('0x1')](_0x10f229,_0x44d006);};}exports[_0x2c46('0x2')]=function(_0x5a1365){for(var _0x560890=0x0,_0x396163=events[_0x2c46('0x3')];_0x560890<_0x396163;_0x560890++){var _0x1ee511=events[_0x560890];var _0xdbfe44=createListener('userNotification:'+_0x1ee511,_0x5a1365);UserNotificationEvents['on'](_0x1ee511,_0xdbfe44);}}; \ No newline at end of file +var _0xd8dc=['removeListener','register','length','userNotification:','save','update'];(function(_0xced6d1,_0x3ac921){var _0x4586fb=function(_0x459a56){while(--_0x459a56){_0xced6d1['push'](_0xced6d1['shift']());}};_0x4586fb(++_0x3ac921);}(_0xd8dc,0xdc));var _0xcd8d=function(_0x35e25c,_0x301f23){_0x35e25c=_0x35e25c-0x0;var _0x5266c6=_0xd8dc[_0x35e25c];return _0x5266c6;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xcd8d('0x0'),'remove',_0xcd8d('0x1')];function createListener(_0x2f093c,_0x4dff43){return function(_0x31624c){_0x4dff43['emit'](_0x2f093c,_0x31624c);};}function removeListener(_0x3e3ed3,_0x35c043){return function(){UserNotificationEvents[_0xcd8d('0x2')](_0x3e3ed3,_0x35c043);};}exports[_0xcd8d('0x3')]=function(_0x7ab522){for(var _0x46d2d3=0x0,_0x128305=events[_0xcd8d('0x4')];_0x46d2d3<_0x128305;_0x46d2d3++){var _0x2384d3=events[_0x46d2d3];var _0x144776=createListener(_0xcd8d('0x5')+_0x2384d3,_0x7ab522);UserNotificationEvents['on'](_0x2384d3,_0x144776);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 3608362..0a4b890 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x7b5700,_0x22ffa8){var _0x423320=function(_0x45d579){while(--_0x45d579){_0x7b5700['push'](_0x7b5700['shift']());}};_0x423320(++_0x22ffa8);}(_0xe706,0xa3));var _0x6e70=function(_0x4a5195,_0x20603e){_0x4a5195=_0x4a5195-0x0;var _0x30908e=_0xe706[_0x4a5195];return _0x30908e;};'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(_0x4c7d12,_0x39cba0){var _0x216158=function(_0x9a2a5c){while(--_0x9a2a5c){_0x4c7d12['push'](_0x4c7d12['shift']());}};_0x216158(++_0x39cba0);}(_0xedd9,0xfc));var _0x9edd=function(_0x9056,_0x4ea22d){_0x9056=_0x9056-0x0;var _0x196705=_0xedd9[_0x9056];return _0x196705;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 8678eaa..fa1cb61 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 _0x114d=['exports','INTEGER','sequelize'];(function(_0x5a33e5,_0xf91e32){var _0x3e73dd=function(_0x56660f){while(--_0x56660f){_0x5a33e5['push'](_0x5a33e5['shift']());}};_0x3e73dd(++_0xf91e32);}(_0x114d,0x8c));var _0xd114=function(_0x31df2a,_0x1f42e9){_0x31df2a=_0x31df2a-0x0;var _0x4c15ea=_0x114d[_0x31df2a];return _0x4c15ea;};'use strict';var Sequelize=require(_0xd114('0x0'));module[_0xd114('0x1')]={'penalty':{'type':Sequelize[_0xd114('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x278d=['sequelize','exports','INTEGER'];(function(_0x147f37,_0x3ec880){var _0x341007=function(_0x262314){while(--_0x262314){_0x147f37['push'](_0x147f37['shift']());}};_0x341007(++_0x3ec880);}(_0x278d,0x126));var _0xd278=function(_0x581af1,_0x4f02c5){_0x581af1=_0x581af1-0x0;var _0x54c22e=_0x278d[_0x581af1];return _0x54c22e;};'use strict';var Sequelize=require(_0xd278('0x0'));module[_0xd278('0x1')]={'penalty':{'type':Sequelize[_0xd278('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 2f9bc7b..d20e921 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 _0x8286=['exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','moment','bluebird','request-promise','path','rimraf','./userOpenchannelQueue.attributes'];(function(_0x3c6bc7,_0x4a786d){var _0x35975c=function(_0x29f80b){while(--_0x29f80b){_0x3c6bc7['push'](_0x3c6bc7['shift']());}};_0x35975c(++_0x4a786d);}(_0x8286,0x1c7));var _0x6828=function(_0x3b9cfe,_0x2e4adb){_0x3b9cfe=_0x3b9cfe-0x0;var _0x19328d=_0x8286[_0x3b9cfe];return _0x19328d;};'use strict';var _=require(_0x6828('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x6828('0x1'));var BPromise=require(_0x6828('0x2'));var rp=require(_0x6828('0x3'));var fs=require('fs');var path=require(_0x6828('0x4'));var rimraf=require(_0x6828('0x5'));var config=require('../../config/environment');var attributes=require(_0x6828('0x6'));module[_0x6828('0x7')]=function(_0x33ec2e,_0xe21b5c){return _0x33ec2e[_0x6828('0x8')](_0x6828('0x9'),attributes,{'tableName':_0x6828('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6753=['lodash','util','api','moment','request-promise','path','../../config/environment','exports','define','UserOpenchannelQueue','user_has_openchannel_queues'];(function(_0x3cfc6c,_0x5d1fcb){var _0x3e5066=function(_0x4436aa){while(--_0x4436aa){_0x3cfc6c['push'](_0x3cfc6c['shift']());}};_0x3e5066(++_0x5d1fcb);}(_0x6753,0x16b));var _0x3675=function(_0x30d0b,_0xb23268){_0x30d0b=_0x30d0b-0x0;var _0x2e46a2=_0x6753[_0x30d0b];return _0x2e46a2;};'use strict';var _=require(_0x3675('0x0'));var util=require(_0x3675('0x1'));var logger=require('../../config/logger')(_0x3675('0x2'));var moment=require(_0x3675('0x3'));var BPromise=require('bluebird');var rp=require(_0x3675('0x4'));var fs=require('fs');var path=require(_0x3675('0x5'));var rimraf=require('rimraf');var config=require(_0x3675('0x6'));var attributes=require('./userOpenchannelQueue.attributes');module[_0x3675('0x7')]=function(_0x359b9a,_0x2ff432){return _0x359b9a[_0x3675('0x8')](_0x3675('0x9'),attributes,{'tableName':_0x3675('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 5ecc037..c379cc7 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 _0x3d04=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','stringify','error','UserOpenchannelQueue,\x20%s,\x20%s','message','info'];(function(_0x426b61,_0x41e6dc){var _0x278191=function(_0x1cb85f){while(--_0x1cb85f){_0x426b61['push'](_0x426b61['shift']());}};_0x278191(++_0x41e6dc);}(_0x3d04,0xbe));var _0x43d0=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x3d04[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var moment=require(_0x43d0('0x2'));var BPromise=require(_0x43d0('0x3'));var rs=require(_0x43d0('0x4'));var fs=require('fs');var Redis=require(_0x43d0('0x5'));var db=require(_0x43d0('0x6'))['db'];var utils=require(_0x43d0('0x7'));var logger=require('../../config/logger')(_0x43d0('0x8'));var config=require(_0x43d0('0x9'));var jayson=require(_0x43d0('0xa'));var client=jayson[_0x43d0('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x484271,_0x50919e,_0x5efb95){return new BPromise(function(_0x457550,_0x3344d3){return client[_0x43d0('0xc')](_0x484271,_0x5efb95)[_0x43d0('0xd')](function(_0x44a763){logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x50919e,_0x43d0('0xe'));logger['debug']('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x50919e,_0x43d0('0xe'),JSON[_0x43d0('0xf')](_0x44a763));if(_0x44a763[_0x43d0('0x10')]){if(_0x44a763[_0x43d0('0x10')]['code']===0x1f4){logger[_0x43d0('0x10')](_0x43d0('0x11'),_0x50919e,_0x44a763['error'][_0x43d0('0x12')]);return _0x3344d3(_0x44a763[_0x43d0('0x10')][_0x43d0('0x12')]);}logger['error'](_0x43d0('0x11'),_0x50919e,_0x44a763[_0x43d0('0x10')][_0x43d0('0x12')]);return _0x457550(_0x44a763['error'][_0x43d0('0x12')]);}else{logger[_0x43d0('0x13')](_0x43d0('0x11'),_0x50919e,_0x43d0('0xe'));_0x457550(_0x44a763[_0x43d0('0x14')]['message']);}})['catch'](function(_0x1e91a7){logger[_0x43d0('0x10')](_0x43d0('0x11'),_0x50919e,_0x1e91a7);_0x3344d3(_0x1e91a7);});});} \ No newline at end of file +var _0xa1c7=['result','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4946e2,_0x37f730){var _0x42953f=function(_0x523708){while(--_0x523708){_0x4946e2['push'](_0x4946e2['shift']());}};_0x42953f(++_0x37f730);}(_0xa1c7,0x1cd));var _0x7a1c=function(_0x2fc20a,_0x5e2fb5){_0x2fc20a=_0x2fc20a-0x0;var _0x1aa57c=_0xa1c7[_0x2fc20a];return _0x1aa57c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x7a1c('0x0'));var rs=require(_0x7a1c('0x1'));var fs=require('fs');var Redis=require(_0x7a1c('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a1c('0x3'));var logger=require(_0x7a1c('0x4'))(_0x7a1c('0x5'));var config=require(_0x7a1c('0x6'));var jayson=require(_0x7a1c('0x7'));var client=jayson[_0x7a1c('0x8')][_0x7a1c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53459a,_0x15083c,_0x2fcbad){return new BPromise(function(_0x41abf0,_0x19426a){return client[_0x7a1c('0xa')](_0x53459a,_0x2fcbad)['then'](function(_0x9d4292){logger[_0x7a1c('0xb')](_0x7a1c('0xc'),_0x15083c,_0x7a1c('0xd'));logger['debug'](_0x7a1c('0xe'),_0x15083c,_0x7a1c('0xd'),JSON[_0x7a1c('0xf')](_0x9d4292));if(_0x9d4292[_0x7a1c('0x10')]){if(_0x9d4292[_0x7a1c('0x10')][_0x7a1c('0x11')]===0x1f4){logger[_0x7a1c('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x15083c,_0x9d4292[_0x7a1c('0x10')][_0x7a1c('0x12')]);return _0x19426a(_0x9d4292['error'][_0x7a1c('0x12')]);}logger['error'](_0x7a1c('0xc'),_0x15083c,_0x9d4292[_0x7a1c('0x10')]['message']);return _0x41abf0(_0x9d4292[_0x7a1c('0x10')]['message']);}else{logger[_0x7a1c('0xb')](_0x7a1c('0xc'),_0x15083c,'request\x20sent');_0x41abf0(_0x9d4292[_0x7a1c('0x13')][_0x7a1c('0x12')]);}})['catch'](function(_0x2105db){logger[_0x7a1c('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x15083c,_0x2105db);_0x19426a(_0x2105db);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 3ef3481..6fbf8aa 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 _0x0e73=['/:id','destroy','delete','removeSections','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','isAuthenticated','describe','show','getSections','/:id/resources','getResources','post','clone','/:id/sections','addSections','addResources','update'];(function(_0x33802c,_0x4f01a6){var _0x2cfc7a=function(_0x464e9b){while(--_0x464e9b){_0x33802c['push'](_0x33802c['shift']());}};_0x2cfc7a(++_0x4f01a6);}(_0x0e73,0x113));var _0x30e7=function(_0x82158f,_0x4e103e){_0x82158f=_0x82158f-0x0;var _0x5f475f=_0x0e73[_0x82158f];return _0x5f475f;};'use strict';var multer=require(_0x30e7('0x0'));var util=require(_0x30e7('0x1'));var path=require(_0x30e7('0x2'));var timeout=require('connect-timeout');var express=require(_0x30e7('0x3'));var router=express[_0x30e7('0x4')]();var fs_extra=require(_0x30e7('0x5'));var auth=require(_0x30e7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x30e7('0x7'));var controller=require('./userProfile.controller');router[_0x30e7('0x8')]('/',auth['isAuthenticated'](),controller[_0x30e7('0x9')]);router[_0x30e7('0x8')]('/describe',auth[_0x30e7('0xa')](),controller[_0x30e7('0xb')]);router[_0x30e7('0x8')]('/:id',auth[_0x30e7('0xa')](),controller[_0x30e7('0xc')]);router[_0x30e7('0x8')]('/:id/sections',auth[_0x30e7('0xa')](),controller[_0x30e7('0xd')]);router[_0x30e7('0x8')](_0x30e7('0xe'),auth[_0x30e7('0xa')](),controller[_0x30e7('0xf')]);router[_0x30e7('0x10')]('/',auth[_0x30e7('0xa')](),controller['create']);router['post']('/:id/clone',auth[_0x30e7('0xa')](),controller[_0x30e7('0x11')]);router[_0x30e7('0x10')](_0x30e7('0x12'),auth[_0x30e7('0xa')](),controller[_0x30e7('0x13')]);router[_0x30e7('0x10')](_0x30e7('0xe'),auth[_0x30e7('0xa')](),controller[_0x30e7('0x14')]);router['put']('/:id',auth[_0x30e7('0xa')](),controller[_0x30e7('0x15')]);router['delete'](_0x30e7('0x16'),auth[_0x30e7('0xa')](),controller[_0x30e7('0x17')]);router[_0x30e7('0x18')](_0x30e7('0x12'),auth[_0x30e7('0xa')](),controller[_0x30e7('0x19')]);router[_0x30e7('0x18')](_0x30e7('0xe'),auth[_0x30e7('0xa')](),controller['removeResources']);module[_0x30e7('0x1a')]=router; \ No newline at end of file +var _0xcfca=['/:id/clone','clone','/:id/sections','addSections','/:id/resources','put','update','delete','/:id','destroy','removeSections','removeResources','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','getResources','post','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcfca,0x6a));var _0xacfc=function(_0x20597b,_0x272377){_0x20597b=_0x20597b-0x0;var _0x332c7f=_0xcfca[_0x20597b];return _0x332c7f;};'use strict';var multer=require(_0xacfc('0x0'));var util=require(_0xacfc('0x1'));var path=require('path');var timeout=require(_0xacfc('0x2'));var express=require(_0xacfc('0x3'));var router=express[_0xacfc('0x4')]();var fs_extra=require(_0xacfc('0x5'));var auth=require(_0xacfc('0x6'));var interaction=require(_0xacfc('0x7'));var config=require(_0xacfc('0x8'));var controller=require(_0xacfc('0x9'));router[_0xacfc('0xa')]('/',auth[_0xacfc('0xb')](),controller[_0xacfc('0xc')]);router[_0xacfc('0xa')](_0xacfc('0xd'),auth['isAuthenticated'](),controller[_0xacfc('0xe')]);router[_0xacfc('0xa')]('/:id',auth[_0xacfc('0xb')](),controller['show']);router[_0xacfc('0xa')]('/:id/sections',auth[_0xacfc('0xb')](),controller['getSections']);router[_0xacfc('0xa')]('/:id/resources',auth[_0xacfc('0xb')](),controller[_0xacfc('0xf')]);router[_0xacfc('0x10')]('/',auth[_0xacfc('0xb')](),controller[_0xacfc('0x11')]);router[_0xacfc('0x10')](_0xacfc('0x12'),auth[_0xacfc('0xb')](),controller[_0xacfc('0x13')]);router[_0xacfc('0x10')](_0xacfc('0x14'),auth[_0xacfc('0xb')](),controller[_0xacfc('0x15')]);router[_0xacfc('0x10')](_0xacfc('0x16'),auth['isAuthenticated'](),controller['addResources']);router[_0xacfc('0x17')]('/:id',auth[_0xacfc('0xb')](),controller[_0xacfc('0x18')]);router[_0xacfc('0x19')](_0xacfc('0x1a'),auth['isAuthenticated'](),controller[_0xacfc('0x1b')]);router['delete'](_0xacfc('0x14'),auth[_0xacfc('0xb')](),controller[_0xacfc('0x1c')]);router[_0xacfc('0x19')](_0xacfc('0x16'),auth[_0xacfc('0xb')](),controller[_0xacfc('0x1d')]);module[_0xacfc('0x1e')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 0ed9cfe..00fc2db 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 _0x77c6=['sequelize','exports','STRING','name','setDataValue','crudPermissions','join','getDataValue','BOOLEAN'];(function(_0x3e6adf,_0x2e2232){var _0x28ad5f=function(_0x14bc31){while(--_0x14bc31){_0x3e6adf['push'](_0x3e6adf['shift']());}};_0x28ad5f(++_0x2e2232);}(_0x77c6,0x144));var _0x677c=function(_0x43d3e5,_0x419339){_0x43d3e5=_0x43d3e5-0x0;var _0x2dcdc4=_0x77c6[_0x43d3e5];return _0x2dcdc4;};'use strict';var Sequelize=require(_0x677c('0x0'));module[_0x677c('0x1')]={'name':{'type':Sequelize[_0x677c('0x2')],'allowNull':![],'unique':_0x677c('0x3')},'crudPermissions':{'type':Sequelize[_0x677c('0x2')],'set':function(_0x1d331a){this[_0x677c('0x4')](_0x677c('0x5'),_0x1d331a?_0x1d331a[_0x677c('0x6')](''):[]);},'get':function(){return this[_0x677c('0x7')](_0x677c('0x5'))?this[_0x677c('0x7')](_0x677c('0x5'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x677c('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x677c('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x677c('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x677c('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x677c('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x677c('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x677c('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x677c('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0x28d4=['split','BOOLEAN','sequelize','exports','STRING','setDataValue','join','getDataValue','crudPermissions'];(function(_0x310eb9,_0x1aed15){var _0x28915c=function(_0x457fd6){while(--_0x457fd6){_0x310eb9['push'](_0x310eb9['shift']());}};_0x28915c(++_0x1aed15);}(_0x28d4,0x1a9));var _0x428d=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x28d4[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x428d('0x0'));module[_0x428d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x428d('0x2')],'set':function(_0x1194de){this[_0x428d('0x3')]('crudPermissions',_0x1194de?_0x1194de[_0x428d('0x4')](''):[]);},'get':function(){return this[_0x428d('0x5')](_0x428d('0x6'))?this['getDataValue'](_0x428d('0x6'))[_0x428d('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x428d('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x428d('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x428d('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x428d('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x428d('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x428d('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x428d('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x428d('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index b063093..ef032a6 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 _0xf567=['catch','show','params','create','body','clone','includeAll','find','get','omit','createdAt','updatedAt','crudPermissions','transaction','findAll','each','autoAssociation','UserProfileResource','sectionId','userProfileId','UserProfileSection','Resources','destroy','addSections','sequelize','push','getSections','includes','isEmpty','subsections','enabled','findOne','Dashboard','forEach','resourceId','addResources','bulkCreate','removeResources','ids','getResources','section','Missing\x20section\x20parameter','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','end','status','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','map','UserProfile','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','count','include','rows'];(function(_0x38422b,_0x10cf71){var _0x2fb623=function(_0x3f7dfb){while(--_0x3f7dfb){_0x38422b['push'](_0x38422b['shift']());}};_0x2fb623(++_0x10cf71);}(_0xf567,0x118));var _0x7f56=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf567[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x7f56('0x0'));var rimraf=require(_0x7f56('0x1'));var zipdir=require(_0x7f56('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7f56('0x3'));var moment=require(_0x7f56('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7f56('0x5'));var util=require(_0x7f56('0x6'));var path=require(_0x7f56('0x7'));var sox=require(_0x7f56('0x8'));var csv=require('to-csv');var ejs=require(_0x7f56('0x9'));var fs=require('fs');var fs_extra=require(_0x7f56('0xa'));var _=require(_0x7f56('0xb'));var squel=require('squel');var crypto=require(_0x7f56('0xc'));var jsforce=require(_0x7f56('0xd'));var deskjs=require(_0x7f56('0xe'));var toCsv=require(_0x7f56('0xf'));var querystring=require(_0x7f56('0x10'));var Papa=require(_0x7f56('0x11'));var Redis=require(_0x7f56('0x12'));var authService=require(_0x7f56('0x13'));var qs=require(_0x7f56('0x14'));var as=require(_0x7f56('0x15'));var hardwareService=require(_0x7f56('0x16'));var logger=require(_0x7f56('0x17'))(_0x7f56('0x18'));var utils=require(_0x7f56('0x19'));var config=require(_0x7f56('0x1a'));var licenseUtil=require(_0x7f56('0x1b'));var db=require(_0x7f56('0x1c'))['db'];config[_0x7f56('0x1d')]=_[_0x7f56('0x1e')](config[_0x7f56('0x1d')],{'host':_0x7f56('0x1f'),'port':0x18eb});var socket=require(_0x7f56('0x20'))(new Redis(config['redis']));require(_0x7f56('0x21'))[_0x7f56('0x22')](socket);function respondWithStatusCode(_0x11d663,_0x53befd){_0x53befd=_0x53befd||0xcc;return function(_0x1c1e6d){if(_0x1c1e6d){return _0x11d663[_0x7f56('0x23')](_0x53befd);}return _0x11d663['status'](_0x53befd)[_0x7f56('0x24')]();};}function respondWithResult(_0x441459,_0x4ad41a){_0x4ad41a=_0x4ad41a||0xc8;return function(_0x5b2b27){if(_0x5b2b27){return _0x441459[_0x7f56('0x25')](_0x4ad41a)['json'](_0x5b2b27);}};}function respondWithFilteredResult(_0x415b6f,_0x2a2d7b){return function(_0x5201eb){if(_0x5201eb){var _0xc4d664=typeof _0x2a2d7b[_0x7f56('0x26')]===_0x7f56('0x27')&&typeof _0x2a2d7b[_0x7f56('0x28')]===_0x7f56('0x27');var _0x24fe45=_0x5201eb['count'];var _0x32aa49=_0xc4d664?0x0:_0x2a2d7b['offset'];var _0x179521=_0xc4d664?_0x5201eb['count']:_0x2a2d7b[_0x7f56('0x26')]+_0x2a2d7b[_0x7f56('0x28')];var _0x289207;if(_0x179521>=_0x24fe45){_0x179521=_0x24fe45;_0x289207=0xc8;}else{_0x289207=0xce;}_0x415b6f[_0x7f56('0x25')](_0x289207);return _0x415b6f[_0x7f56('0x29')](_0x7f56('0x2a'),_0x32aa49+'-'+_0x179521+'/'+_0x24fe45)[_0x7f56('0x2b')](_0x5201eb);}return null;};}function patchUpdates(_0x3f54f8){return function(_0x879e3a){try{jsonpatch[_0x7f56('0x2c')](_0x879e3a,_0x3f54f8,!![]);}catch(_0x52a902){return BPromise[_0x7f56('0x2d')](_0x52a902);}return _0x879e3a[_0x7f56('0x2e')]();};}function saveUpdates(_0x2943fe,_0x3c8658){return function(_0x37d48e){if(_0x37d48e){return _0x37d48e[_0x7f56('0x2f')](_0x2943fe)[_0x7f56('0x30')](function(_0x5da9ce){return _0x5da9ce;});}return null;};}function removeEntity(_0x4a20d5,_0x4a1f1b){return function(_0x29de7c){if(_0x29de7c){return _0x29de7c['destroy']()[_0x7f56('0x30')](function(){_0x4a20d5[_0x7f56('0x25')](0xcc)[_0x7f56('0x24')]();});}};}function handleEntityNotFound(_0x5bb367,_0x236120){return function(_0x3d0faa){if(!_0x3d0faa){_0x5bb367[_0x7f56('0x23')](0x194);}return _0x3d0faa;};}function handleError(_0xb8197f,_0x5ea887){_0x5ea887=_0x5ea887||0x1f4;return function(_0x3d3095){logger[_0x7f56('0x31')](_0x3d3095[_0x7f56('0x32')]);if(_0x3d3095['name']){delete _0x3d3095[_0x7f56('0x33')];}_0xb8197f[_0x7f56('0x25')](_0x5ea887)['send'](_0x3d3095);};}exports['index']=function(_0x57db84,_0x2849f8){var _0x47e4ce={},_0x4d92c0={},_0x25bd28={'count':0x0,'rows':[]};var _0x56a70b=_[_0x7f56('0x34')](db[_0x7f56('0x35')][_0x7f56('0x36')],function(_0x523805){return{'name':_0x523805[_0x7f56('0x37')],'type':_0x523805[_0x7f56('0x38')][_0x7f56('0x39')]};});_0x4d92c0['model']=_[_0x7f56('0x34')](_0x56a70b,_0x7f56('0x33'));_0x4d92c0[_0x7f56('0x3a')]=_[_0x7f56('0x3b')](_0x57db84[_0x7f56('0x3a')]);_0x4d92c0[_0x7f56('0x3c')]=_[_0x7f56('0x3d')](_0x4d92c0[_0x7f56('0x3e')],_0x4d92c0[_0x7f56('0x3a')]);_0x47e4ce[_0x7f56('0x3f')]=_[_0x7f56('0x3d')](_0x4d92c0[_0x7f56('0x3e')],qs['fields'](_0x57db84['query'][_0x7f56('0x40')]));_0x47e4ce['attributes']=_0x47e4ce[_0x7f56('0x3f')][_0x7f56('0x41')]?_0x47e4ce['attributes']:_0x4d92c0[_0x7f56('0x3e')];if(!_0x57db84[_0x7f56('0x3a')]['hasOwnProperty'](_0x7f56('0x42'))){_0x47e4ce[_0x7f56('0x28')]=qs['limit'](_0x57db84[_0x7f56('0x3a')][_0x7f56('0x28')]);_0x47e4ce[_0x7f56('0x26')]=qs['offset'](_0x57db84[_0x7f56('0x3a')]['offset']);}_0x47e4ce[_0x7f56('0x43')]=qs['sort'](_0x57db84[_0x7f56('0x3a')][_0x7f56('0x44')]);_0x47e4ce['where']=qs['filters'](_['pick'](_0x57db84[_0x7f56('0x3a')],_0x4d92c0[_0x7f56('0x3c')]),_0x56a70b);if(_0x57db84['query'][_0x7f56('0x45')]){_0x47e4ce[_0x7f56('0x46')]=_[_0x7f56('0x47')](_0x47e4ce[_0x7f56('0x46')],{'$or':_[_0x7f56('0x34')](_0x56a70b,function(_0x29887c){if(_0x29887c[_0x7f56('0x38')]!==_0x7f56('0x48')){var _0x453741={};_0x453741[_0x29887c[_0x7f56('0x33')]]={'$like':'%'+_0x57db84[_0x7f56('0x3a')][_0x7f56('0x45')]+'%'};return _0x453741;}})});}_0x47e4ce=_[_0x7f56('0x47')]({},_0x47e4ce,_0x57db84[_0x7f56('0x49')]);var _0x352456={'where':_0x47e4ce[_0x7f56('0x46')]};return db[_0x7f56('0x35')][_0x7f56('0x4a')](_0x352456)[_0x7f56('0x30')](function(_0xe02966){_0x25bd28[_0x7f56('0x4a')]=_0xe02966;if(_0x57db84[_0x7f56('0x3a')]['includeAll']){_0x47e4ce[_0x7f56('0x4b')]=[{'all':!![]}];}return db['UserProfile']['findAll'](_0x47e4ce);})[_0x7f56('0x30')](function(_0x438a30){_0x25bd28[_0x7f56('0x4c')]=_0x438a30;return _0x25bd28;})[_0x7f56('0x30')](respondWithFilteredResult(_0x2849f8,_0x47e4ce))[_0x7f56('0x4d')](handleError(_0x2849f8,null));};exports[_0x7f56('0x4e')]=function(_0x5bd4fb,_0x3725e6){var _0x2d0756={'raw':![],'where':{'id':_0x5bd4fb[_0x7f56('0x4f')]['id']}},_0x4a4767={};_0x4a4767[_0x7f56('0x3e')]=_[_0x7f56('0x3b')](db[_0x7f56('0x35')][_0x7f56('0x36')]);_0x4a4767[_0x7f56('0x3a')]=_[_0x7f56('0x3b')](_0x5bd4fb[_0x7f56('0x3a')]);_0x4a4767[_0x7f56('0x3c')]=_[_0x7f56('0x3d')](_0x4a4767[_0x7f56('0x3e')],_0x4a4767['query']);_0x2d0756['attributes']=_[_0x7f56('0x3d')](_0x4a4767[_0x7f56('0x3e')],qs['fields'](_0x5bd4fb[_0x7f56('0x3a')]['fields']));_0x2d0756[_0x7f56('0x3f')]=_0x2d0756[_0x7f56('0x3f')][_0x7f56('0x41')]?_0x2d0756['attributes']:_0x4a4767[_0x7f56('0x3e')];if(_0x5bd4fb['query']['includeAll']){_0x2d0756[_0x7f56('0x4b')]=[{'all':!![]}];}_0x2d0756=_[_0x7f56('0x47')]({},_0x2d0756,_0x5bd4fb['options']);return db[_0x7f56('0x35')]['find'](_0x2d0756)[_0x7f56('0x30')](handleEntityNotFound(_0x3725e6,null))[_0x7f56('0x30')](respondWithResult(_0x3725e6,null))[_0x7f56('0x4d')](handleError(_0x3725e6,null));};exports[_0x7f56('0x50')]=function(_0x5cc708,_0x25704f){return db[_0x7f56('0x35')][_0x7f56('0x50')](_0x5cc708[_0x7f56('0x51')],{})[_0x7f56('0x30')](respondWithResult(_0x25704f,0xc9))[_0x7f56('0x4d')](handleError(_0x25704f,null));};exports[_0x7f56('0x52')]=function(_0x21ed5c,_0x725760){var _0x509d3a={'where':{'id':_0x21ed5c[_0x7f56('0x4f')]['id']}},_0x489c6a={};_0x489c6a['model']=_[_0x7f56('0x3b')](db[_0x7f56('0x35')]['rawAttributes']);_0x509d3a[_0x7f56('0x3f')]=_[_0x7f56('0x3d')](_0x489c6a['model'],qs[_0x7f56('0x40')](_0x21ed5c[_0x7f56('0x3a')][_0x7f56('0x40')]));_0x509d3a['attributes']=_0x509d3a[_0x7f56('0x3f')][_0x7f56('0x41')]?_0x509d3a[_0x7f56('0x3f')]:_0x489c6a[_0x7f56('0x3e')];if(_0x21ed5c['query'][_0x7f56('0x53')]){_0x509d3a['include']=[{'all':!![]}];}_0x509d3a=_[_0x7f56('0x47')]({},_0x509d3a,_0x21ed5c[_0x7f56('0x49')]);return db[_0x7f56('0x35')][_0x7f56('0x54')](_0x509d3a)[_0x7f56('0x30')](handleEntityNotFound(_0x725760,null))[_0x7f56('0x30')](function(_0x14acdc){if(_0x14acdc){var _0x250315=_0x14acdc[_0x7f56('0x55')]({'plain':!![]});_0x250315=qs[_0x7f56('0x56')](_0x250315,['id',_0x7f56('0x57'),_0x7f56('0x58'),_0x7f56('0x59')]);_0x21ed5c[_0x7f56('0x51')]=_[_0x7f56('0x56')](_0x21ed5c[_0x7f56('0x51')],['id',_0x7f56('0x57'),_0x7f56('0x58')]);return db['sequelize'][_0x7f56('0x5a')](function(_0x1e8914){return db['UserProfile'][_0x7f56('0x50')](_['merge'](_0x250315,_0x21ed5c[_0x7f56('0x51')]),{'include':_0x21ed5c['query'][_0x7f56('0x53')]?[{'all':!![]}]:undefined,'transaction':_0x1e8914})['then'](function(_0x36d8a0){var _0x20dbda=_0x36d8a0[_0x7f56('0x55')]({'plain':!![]});return db['UserProfileSection'][_0x7f56('0x5b')]({'where':{'userProfileId':_0x21ed5c[_0x7f56('0x4f')]['id']},'raw':!![]})[_0x7f56('0x30')](function(_0x517630){if(_0x517630){return BPromise[_0x7f56('0x5c')](_0x517630,function(_0x3be0a1){return new BPromise(function(_0x1db23a,_0x61201d){if(_0x3be0a1[_0x7f56('0x5d')]===null||_0x3be0a1[_0x7f56('0x5d')]===0x1)_0x1db23a(null);return db[_0x7f56('0x5e')][_0x7f56('0x5b')]({'where':{'sectionId':_0x3be0a1['id']},'raw':!![]})[_0x7f56('0x30')](function(_0x3d3e48){var _0x1ab83b=_[_0x7f56('0x34')](_0x3d3e48,function(_0x227356){return qs[_0x7f56('0x56')](_0x227356,['id',_0x7f56('0x57'),_0x7f56('0x58'),_0x7f56('0x5f')]);});_0x1db23a(_0x1ab83b);})[_0x7f56('0x4d')](function(_0x1e7bec){_0x61201d(_0x1e7bec);});})[_0x7f56('0x30')](function(_0x282e42){var _0x887246=qs[_0x7f56('0x56')](_0x3be0a1,['id',_0x7f56('0x57'),_0x7f56('0x58')]);_0x887246[_0x7f56('0x60')]=_0x20dbda['id'];if(_0x282e42)_0x887246['Resources']=_0x282e42;return _0x887246;})['then'](function(_0x41e86e){return db[_0x7f56('0x61')][_0x7f56('0x50')](_0x41e86e,{'include':[{'model':db[_0x7f56('0x5e')],'as':_0x7f56('0x62')}],'raw':!![],'transaction':_0x1e8914});});})[_0x7f56('0x30')](function(){return _0x20dbda;});}});});});}})[_0x7f56('0x30')](respondWithResult(_0x725760,0xc9))[_0x7f56('0x4d')](handleError(_0x725760,null));};exports['update']=function(_0x3dbf43,_0x3d8c89){if(_0x3dbf43['body']['id']){delete _0x3dbf43[_0x7f56('0x51')]['id'];}return db[_0x7f56('0x35')][_0x7f56('0x54')]({'where':{'id':_0x3dbf43[_0x7f56('0x4f')]['id']}})[_0x7f56('0x30')](handleEntityNotFound(_0x3d8c89,null))[_0x7f56('0x30')](saveUpdates(_0x3dbf43[_0x7f56('0x51')],null))[_0x7f56('0x30')](respondWithResult(_0x3d8c89,null))['catch'](handleError(_0x3d8c89,null));};exports[_0x7f56('0x63')]=function(_0x521978,_0x9d77d9){return db[_0x7f56('0x35')][_0x7f56('0x54')]({'where':{'id':_0x521978[_0x7f56('0x4f')]['id']}})[_0x7f56('0x30')](handleEntityNotFound(_0x9d77d9,null))[_0x7f56('0x30')](removeEntity(_0x9d77d9,null))['catch'](handleError(_0x9d77d9,null));};exports['describe']=function(_0x43fa26,_0x3ed009){return db[_0x7f56('0x35')]['describe']()['then'](respondWithResult(_0x3ed009,null))['catch'](handleError(_0x3ed009,null));};exports[_0x7f56('0x64')]=function(_0x5a8e66,_0x43a0f6){var _0x141740=_0x5a8e66[_0x7f56('0x51')];return db['UserProfile'][_0x7f56('0x54')]({'where':{'id':_0x5a8e66['params']['id']}})[_0x7f56('0x30')](handleEntityNotFound(_0x43a0f6,null))[_0x7f56('0x30')](function(_0x2197fe){if(_0x2197fe){return db[_0x7f56('0x65')]['transaction'](function(_0x1070a5){return db[_0x7f56('0x61')][_0x7f56('0x63')]({'where':{'userProfileId':_0x5a8e66[_0x7f56('0x4f')]['id'],'sectionId':_['map'](_0x141740,function(_0x14b46c){return _0x14b46c[_0x7f56('0x5f')];})},'transaction':_0x1070a5})[_0x7f56('0x30')](function(){var _0x2c8c48=_[_0x7f56('0x34')](_0x141740,function(_0x3eb2b2){_0x3eb2b2[_0x7f56('0x60')]=_0x5a8e66['params']['id'];return _0x3eb2b2;});var _0x2ebc14=[];return BPromise['each'](_0x2c8c48,function(_0x376347){return db[_0x7f56('0x61')][_0x7f56('0x50')](_0x376347,{'include':[{'model':db[_0x7f56('0x5e')],'as':_0x7f56('0x62')}],'raw':!![],'transaction':_0x1070a5})['then'](function(_0x25297a){_0x2ebc14[_0x7f56('0x66')](_0x25297a[_0x7f56('0x55')]({'plain':!![]}));});})[_0x7f56('0x30')](function(){return _0x2ebc14;});});});}})[_0x7f56('0x30')](function(_0x402f38){return _0x402f38;})[_0x7f56('0x30')](respondWithResult(_0x43a0f6,null))[_0x7f56('0x4d')](handleError(_0x43a0f6,null));};exports['removeSections']=function(_0x4f16f7,_0x183e08){var _0x101bd5;return db[_0x7f56('0x35')][_0x7f56('0x54')]({'where':{'id':_0x4f16f7[_0x7f56('0x4f')]['id']},'attributes':['id',_0x7f56('0x33')]})[_0x7f56('0x30')](handleEntityNotFound(_0x183e08,null))['then'](function(_0x29b055){if(_0x29b055){_0x101bd5=_0x29b055;return db[_0x7f56('0x61')]['destroy']({'where':{'userProfileId':_0x4f16f7[_0x7f56('0x4f')]['id'],'sectionId':_0x4f16f7[_0x7f56('0x3a')]['ids']}});}})[_0x7f56('0x30')](function(){return _0x101bd5;})[_0x7f56('0x30')](respondWithStatusCode(_0x183e08,null))[_0x7f56('0x4d')](handleError(_0x183e08,null));};exports[_0x7f56('0x67')]=function(_0x2b15cf,_0x377bea){var _0x5394b7=[];var _0x198f1a=[];return db[_0x7f56('0x61')][_0x7f56('0x5b')]({'where':{'userProfileId':_0x2b15cf['params']['id']},'raw':!![]})[_0x7f56('0x30')](function(_0x3a7427){_0x5394b7=_['filter'](_0x3a7427,function(_0x2eb3ff){return _0x2eb3ff['enabled']===0x1||_[_0x7f56('0x68')]([0x3eb,0x709],_0x2eb3ff[_0x7f56('0x5f')]);});if(!_[_0x7f56('0x69')](_0x5394b7)){return _['map'](_0x5394b7,function(_0x44d45d){return _0x44d45d[_0x7f56('0x5f')];});}else{return;}})['then'](function(_0x3da59a){if(_0x3da59a)_0x198f1a=_0x3da59a;if(_[_0x7f56('0x68')](_0x198f1a,0x64)){var _0x203463=_[_0x7f56('0x54')](_0x5394b7,{'sectionId':0x64});return hasDefaultDashboard(_0x203463)[_0x7f56('0x30')](function(_0x84c93c){return _['map'](_0x5394b7,function(_0x3ac09b){if(_0x3ac09b[_0x7f56('0x5f')]===0x64){_0x3ac09b[_0x7f56('0x6a')]=_0x84c93c;}return _0x3ac09b;});});}else{return;}})[_0x7f56('0x30')](function(_0x6c5d62){if(_0x6c5d62)_0x5394b7=_0x6c5d62;if(_[_0x7f56('0x68')](_0x198f1a,0x3eb)){var _0x57eddb=_[_0x7f56('0x54')](_0x5394b7,{'sectionId':0x3eb});return getCustomDashboards(_0x57eddb)[_0x7f56('0x30')](function(_0x521e88){return _[_0x7f56('0x34')](_0x5394b7,function(_0xd29eb5){if(_0x57eddb[_0x7f56('0x6b')]){if(_0xd29eb5[_0x7f56('0x5f')]===0x3eb){_0xd29eb5[_0x7f56('0x6a')]=_0x521e88;}}else{if(_0xd29eb5[_0x7f56('0x5f')]===0x64){_0xd29eb5[_0x7f56('0x6a')]=_0x521e88;}}return _0xd29eb5;});});}else{return;}})[_0x7f56('0x30')](function(_0x13abb9){if(_0x13abb9)_0x5394b7=_0x13abb9;if(_['includes'](_0x198f1a,0x709)){var _0xf65309=_['find'](_0x5394b7,{'sectionId':0x709});return getPlugins(_0xf65309)[_0x7f56('0x30')](function(_0x681e85){if(_0xf65309[_0x7f56('0x6b')]){return _[_0x7f56('0x34')](_0x5394b7,function(_0x379ef9){if(_0x379ef9['sectionId']===0x709){_0x379ef9[_0x7f56('0x6a')]=_0x681e85;}return _0x379ef9;});}else{var _0x102e98={'sectionId':0x76c,'enabled':0x1,'subsections':_0x681e85};var _0x5eb683=_[_0x7f56('0x34')](_0x5394b7);_0x5eb683[_0x7f56('0x66')](_0x102e98);return _0x5eb683;}});}else{return;}})[_0x7f56('0x30')](function(_0x4c93b9){if(_0x4c93b9)_0x5394b7=_0x4c93b9;return _[_0x7f56('0x45')](_0x5394b7,[_0x7f56('0x6b'),0x1]);})[_0x7f56('0x30')](respondWithResult(_0x377bea,null))[_0x7f56('0x4d')](handleError(_0x377bea,null));};function hasDefaultDashboard(_0x1febc1){var _0x5aa159=[0x65];return new BPromise(function(_0x542b98,_0x5165d9){try{if(_0x1febc1['autoAssociation']){_0x542b98(_0x5aa159);}else{return db['UserProfileResource'][_0x7f56('0x6c')]({'where':{'sectionId':_0x1febc1['id']},'raw':!![]})[_0x7f56('0x30')](function(_0x229565){_0x229565?_0x542b98(_0x5aa159):_0x542b98();});}}catch(_0x336156){_0x5165d9(_0x336156);}});}function getCustomDashboards(_0x5c95c7){var _0x13e3ce=[];return new BPromise(function(_0x1a77a8,_0x46ea50){try{if(_0x5c95c7[_0x7f56('0x5d')]){return db[_0x7f56('0x6d')][_0x7f56('0x5b')]({'raw':!![]})[_0x7f56('0x30')](function(_0x436f88){_0x436f88[_0x7f56('0x6e')](function(_0x4e89ae){_0x13e3ce[_0x7f56('0x66')](_0x4e89ae['id']+0x1869f);});_0x1a77a8(_0x13e3ce);});}else{return db['UserProfileResource'][_0x7f56('0x5b')]({'where':{'sectionId':_0x5c95c7['id']},'raw':!![]})[_0x7f56('0x30')](function(_0x355ee2){_0x355ee2[_0x7f56('0x6e')](function(_0x1321e4){_0x13e3ce['push'](_0x1321e4[_0x7f56('0x6f')]+0x1869f);});_0x1a77a8(_0x13e3ce);});}}catch(_0x4133d6){_0x46ea50(_0x4133d6);}});}function getPlugins(_0x2f4336){var _0x4b769a=[];return new BPromise(function(_0x1d90ea,_0x32b529){try{if(_0x2f4336[_0x7f56('0x5d')]){return db['Plugin'][_0x7f56('0x5b')]({'raw':!![]})[_0x7f56('0x30')](function(_0x352923){_0x352923[_0x7f56('0x6e')](function(_0xd07ceb){_0x4b769a[_0x7f56('0x66')](_0xd07ceb['id']+0x15b38);});_0x1d90ea(_0x4b769a);});}else{return db[_0x7f56('0x5e')][_0x7f56('0x5b')]({'where':{'sectionId':_0x2f4336['id']},'raw':!![]})[_0x7f56('0x30')](function(_0x39576e){_0x39576e[_0x7f56('0x6e')](function(_0x5ce5ac){_0x4b769a[_0x7f56('0x66')](_0x5ce5ac['resourceId']+0x15b38);});_0x1d90ea(_0x4b769a);});}}catch(_0x5ccab4){_0x32b529(_0x5ccab4);}});}exports[_0x7f56('0x70')]=function(_0xc65837,_0x2f00c7){return db[_0x7f56('0x35')][_0x7f56('0x54')]({'where':{'id':_0xc65837[_0x7f56('0x4f')]['id']}})[_0x7f56('0x30')](handleEntityNotFound(_0x2f00c7,null))['then'](function(_0x284a7f){if(_0x284a7f){return db[_0x7f56('0x65')][_0x7f56('0x5a')](function(_0x45ca9f){return db[_0x7f56('0x61')][_0x7f56('0x5b')]({'where':{'userProfileId':_0xc65837['params']['id']},'attributes':['id'],'raw':!![]})[_0x7f56('0x30')](function(_0x1e334e){if(_0x1e334e){return db[_0x7f56('0x61')][_0x7f56('0x63')]({'where':{'userProfileId':_0xc65837[_0x7f56('0x4f')]['id'],'id':_[_0x7f56('0x34')](_0x1e334e,function(_0x27f678){return _0x27f678['id'];})},'transaction':_0x45ca9f});}})[_0x7f56('0x30')](function(_0x482202){var _0xa836bc=_[_0x7f56('0x34')](_0xc65837[_0x7f56('0x51')],function(_0x3112e2){_0x3112e2[_0x7f56('0x60')]=_0xc65837['params']['id'];return _0x3112e2;});return db[_0x7f56('0x61')]['bulkCreate'](_0xa836bc,{'raw':!![],'transaction':_0x45ca9f});})[_0x7f56('0x30')](function(_0x1f30dd){var _0x29b1dc=_[_0x7f56('0x45')](_[_0x7f56('0x34')](_0x1f30dd,function(_0x164d7c){return _0x164d7c['get']({'plain':!![]});}),{'includeAll':![]});if(_0x29b1dc){return db[_0x7f56('0x61')]['findAll']({'where':{'userProfileId':_0xc65837['params']['id'],'sectionId':_[_0x7f56('0x34')](_0x29b1dc,function(_0x46df2c){return _0x46df2c[_0x7f56('0x5f')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x7f56('0x30')](function(_0x82b63d){var _0x2d046d=_[_0x7f56('0x34')](_0xc65837[_0x7f56('0x51')],function(_0x51a9d3){_0x51a9d3[_0x7f56('0x60')]=_0xc65837['params']['id'];return _0x51a9d3;});return db[_0x7f56('0x5e')][_0x7f56('0x71')](_0x2d046d,{'raw':!![],'transaction':_0x45ca9f});});}})[_0x7f56('0x4d')](handleError(_0x2f00c7,null));});}})[_0x7f56('0x30')](function(_0x2d4b7d){var _0x20d20a=_[_0x7f56('0x34')](_0x2d4b7d,function(_0x59c20e){return _0x59c20e[_0x7f56('0x55')]({'plain':!![]});});})[_0x7f56('0x30')](respondWithResult(_0x2f00c7,null))[_0x7f56('0x4d')](handleError(_0x2f00c7,null));};exports[_0x7f56('0x72')]=function(_0x197254,_0x3c723d,_0x3d21a8){return db[_0x7f56('0x35')][_0x7f56('0x54')]({'where':{'id':_0x197254[_0x7f56('0x4f')]['id']}})[_0x7f56('0x30')](handleEntityNotFound(_0x3c723d,null))[_0x7f56('0x30')](function(_0x4a44f9){if(_0x4a44f9){return _0x4a44f9[_0x7f56('0x72')](_0x197254['query'][_0x7f56('0x73')]);}})[_0x7f56('0x30')](respondWithStatusCode(_0x3c723d,null))[_0x7f56('0x4d')](handleError(_0x3c723d,null));};exports[_0x7f56('0x74')]=function(_0x38418c,_0xfeba8b){var _0x4dcc87={};if(!_0x38418c[_0x7f56('0x3a')][_0x7f56('0x75')])throw new Error(_0x7f56('0x76'));if(!_0x38418c[_0x7f56('0x3a')]['hasOwnProperty'](_0x7f56('0x42'))){_0x4dcc87['limit']=qs[_0x7f56('0x28')](_0x38418c[_0x7f56('0x3a')][_0x7f56('0x28')]);_0x4dcc87[_0x7f56('0x26')]=qs['offset'](_0x38418c[_0x7f56('0x3a')][_0x7f56('0x26')]);}return db[_0x7f56('0x35')][_0x7f56('0x54')]({'where':{'id':_0x38418c[_0x7f56('0x4f')]['id']}})[_0x7f56('0x30')](function(_0x4ef150){if(!_0x4ef150)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x38418c[_0x7f56('0x4f')]['id']);return db[_0x7f56('0x35')]['getResources'](_0x38418c);})[_0x7f56('0x30')](respondWithFilteredResult(_0xfeba8b,_0x4dcc87))[_0x7f56('0x4d')](handleError(_0xfeba8b,null));}; \ No newline at end of file +var _0x2b29=['No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','map','VIRTUAL','merge','UserProfile','includeAll','include','rows','length','options','find','catch','create','body','clone','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','get','UserProfileSection','findAll','params','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','push','removeSections','ids','getSections','includes','isEmpty','subsections','enabled','findOne','Dashboard','forEach','Plugin','resourceId','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','nolimit'];(function(_0x2b84da,_0x3242c4){var _0x527187=function(_0x503897){while(--_0x503897){_0x2b84da['push'](_0x2b84da['shift']());}};_0x527187(++_0x3242c4);}(_0x2b29,0x163));var _0x92b2=function(_0xaafc2a,_0x433e57){_0xaafc2a=_0xaafc2a-0x0;var _0x34408b=_0x2b29[_0xaafc2a];return _0x34408b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x92b2('0x0'));var zipdir=require(_0x92b2('0x1'));var jsonpatch=require(_0x92b2('0x2'));var rp=require(_0x92b2('0x3'));var moment=require('moment');var BPromise=require(_0x92b2('0x4'));var Mustache=require(_0x92b2('0x5'));var util=require(_0x92b2('0x6'));var path=require(_0x92b2('0x7'));var sox=require(_0x92b2('0x8'));var csv=require(_0x92b2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x92b2('0xa'));var _=require('lodash');var squel=require(_0x92b2('0xb'));var crypto=require(_0x92b2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x92b2('0xd'));var toCsv=require(_0x92b2('0x9'));var querystring=require(_0x92b2('0xe'));var Papa=require(_0x92b2('0xf'));var Redis=require('ioredis');var authService=require(_0x92b2('0x10'));var qs=require(_0x92b2('0x11'));var as=require(_0x92b2('0x12'));var hardwareService=require(_0x92b2('0x13'));var logger=require(_0x92b2('0x14'))(_0x92b2('0x15'));var utils=require(_0x92b2('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x92b2('0x17'));var db=require(_0x92b2('0x18'))['db'];config[_0x92b2('0x19')]=_['defaults'](config[_0x92b2('0x19')],{'host':_0x92b2('0x1a'),'port':0x18eb});var socket=require(_0x92b2('0x1b'))(new Redis(config[_0x92b2('0x19')]));require(_0x92b2('0x1c'))[_0x92b2('0x1d')](socket);function respondWithStatusCode(_0x52ef07,_0x11e175){_0x11e175=_0x11e175||0xcc;return function(_0x5c42b5){if(_0x5c42b5){return _0x52ef07[_0x92b2('0x1e')](_0x11e175);}return _0x52ef07[_0x92b2('0x1f')](_0x11e175)[_0x92b2('0x20')]();};}function respondWithResult(_0x4899fa,_0x5cbb30){_0x5cbb30=_0x5cbb30||0xc8;return function(_0xbb9cef){if(_0xbb9cef){return _0x4899fa['status'](_0x5cbb30)[_0x92b2('0x21')](_0xbb9cef);}};}function respondWithFilteredResult(_0x4d51db,_0x42872b){return function(_0x1a7866){if(_0x1a7866){var _0x39d811=typeof _0x42872b[_0x92b2('0x22')]===_0x92b2('0x23')&&typeof _0x42872b[_0x92b2('0x24')]===_0x92b2('0x23');var _0x692704=_0x1a7866[_0x92b2('0x25')];var _0xa08831=_0x39d811?0x0:_0x42872b[_0x92b2('0x22')];var _0x3bdda8=_0x39d811?_0x1a7866[_0x92b2('0x25')]:_0x42872b[_0x92b2('0x22')]+_0x42872b[_0x92b2('0x24')];var _0x4d2850;if(_0x3bdda8>=_0x692704){_0x3bdda8=_0x692704;_0x4d2850=0xc8;}else{_0x4d2850=0xce;}_0x4d51db[_0x92b2('0x1f')](_0x4d2850);return _0x4d51db['set'](_0x92b2('0x26'),_0xa08831+'-'+_0x3bdda8+'/'+_0x692704)[_0x92b2('0x21')](_0x1a7866);}return null;};}function patchUpdates(_0x2b372c){return function(_0x1e09b6){try{jsonpatch[_0x92b2('0x27')](_0x1e09b6,_0x2b372c,!![]);}catch(_0x574c3e){return BPromise['reject'](_0x574c3e);}return _0x1e09b6[_0x92b2('0x28')]();};}function saveUpdates(_0x31567c,_0x8ed58d){return function(_0x386a80){if(_0x386a80){return _0x386a80[_0x92b2('0x29')](_0x31567c)[_0x92b2('0x2a')](function(_0x15faf5){return _0x15faf5;});}return null;};}function removeEntity(_0x49b81e,_0xbbbfa7){return function(_0x573df3){if(_0x573df3){return _0x573df3[_0x92b2('0x2b')]()['then'](function(){_0x49b81e[_0x92b2('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e9688,_0x105270){return function(_0x2d707f){if(!_0x2d707f){_0x5e9688[_0x92b2('0x1e')](0x194);}return _0x2d707f;};}function handleError(_0x5a874e,_0x9314e3){_0x9314e3=_0x9314e3||0x1f4;return function(_0x482706){logger[_0x92b2('0x2c')](_0x482706[_0x92b2('0x2d')]);if(_0x482706[_0x92b2('0x2e')]){delete _0x482706[_0x92b2('0x2e')];}_0x5a874e[_0x92b2('0x1f')](_0x9314e3)[_0x92b2('0x2f')](_0x482706);};}exports[_0x92b2('0x30')]=function(_0x515a62,_0x4dda21){var _0x5efa2b={},_0xd240ec={},_0xaf5043={'count':0x0,'rows':[]};var _0x1ec945=_['map'](db['UserProfile'][_0x92b2('0x31')],function(_0x6b06d5){return{'name':_0x6b06d5[_0x92b2('0x32')],'type':_0x6b06d5[_0x92b2('0x33')][_0x92b2('0x34')]};});_0xd240ec['model']=_['map'](_0x1ec945,'name');_0xd240ec[_0x92b2('0x35')]=_[_0x92b2('0x36')](_0x515a62['query']);_0xd240ec[_0x92b2('0x37')]=_[_0x92b2('0x38')](_0xd240ec[_0x92b2('0x39')],_0xd240ec[_0x92b2('0x35')]);_0x5efa2b[_0x92b2('0x3a')]=_[_0x92b2('0x38')](_0xd240ec[_0x92b2('0x39')],qs[_0x92b2('0x3b')](_0x515a62['query'][_0x92b2('0x3b')]));_0x5efa2b[_0x92b2('0x3a')]=_0x5efa2b[_0x92b2('0x3a')]['length']?_0x5efa2b[_0x92b2('0x3a')]:_0xd240ec['model'];if(!_0x515a62[_0x92b2('0x35')][_0x92b2('0x3c')]('nolimit')){_0x5efa2b['limit']=qs[_0x92b2('0x24')](_0x515a62[_0x92b2('0x35')]['limit']);_0x5efa2b['offset']=qs[_0x92b2('0x22')](_0x515a62[_0x92b2('0x35')]['offset']);}_0x5efa2b[_0x92b2('0x3d')]=qs[_0x92b2('0x3e')](_0x515a62[_0x92b2('0x35')]['sort']);_0x5efa2b[_0x92b2('0x3f')]=qs['filters'](_[_0x92b2('0x40')](_0x515a62[_0x92b2('0x35')],_0xd240ec[_0x92b2('0x37')]),_0x1ec945);if(_0x515a62[_0x92b2('0x35')][_0x92b2('0x41')]){_0x5efa2b[_0x92b2('0x3f')]=_['merge'](_0x5efa2b[_0x92b2('0x3f')],{'$or':_[_0x92b2('0x42')](_0x1ec945,function(_0x5d1d48){if(_0x5d1d48[_0x92b2('0x33')]!==_0x92b2('0x43')){var _0x129af1={};_0x129af1[_0x5d1d48[_0x92b2('0x2e')]]={'$like':'%'+_0x515a62[_0x92b2('0x35')][_0x92b2('0x41')]+'%'};return _0x129af1;}})});}_0x5efa2b=_[_0x92b2('0x44')]({},_0x5efa2b,_0x515a62['options']);var _0x19efe0={'where':_0x5efa2b['where']};return db[_0x92b2('0x45')]['count'](_0x19efe0)[_0x92b2('0x2a')](function(_0xefc848){_0xaf5043[_0x92b2('0x25')]=_0xefc848;if(_0x515a62['query'][_0x92b2('0x46')]){_0x5efa2b[_0x92b2('0x47')]=[{'all':!![]}];}return db[_0x92b2('0x45')]['findAll'](_0x5efa2b);})[_0x92b2('0x2a')](function(_0x19fe8f){_0xaf5043[_0x92b2('0x48')]=_0x19fe8f;return _0xaf5043;})[_0x92b2('0x2a')](respondWithFilteredResult(_0x4dda21,_0x5efa2b))['catch'](handleError(_0x4dda21,null));};exports['show']=function(_0x49ca54,_0x399bb7){var _0x150958={'raw':![],'where':{'id':_0x49ca54['params']['id']}},_0x423c41={};_0x423c41[_0x92b2('0x39')]=_['keys'](db[_0x92b2('0x45')][_0x92b2('0x31')]);_0x423c41[_0x92b2('0x35')]=_[_0x92b2('0x36')](_0x49ca54[_0x92b2('0x35')]);_0x423c41[_0x92b2('0x37')]=_[_0x92b2('0x38')](_0x423c41[_0x92b2('0x39')],_0x423c41[_0x92b2('0x35')]);_0x150958[_0x92b2('0x3a')]=_[_0x92b2('0x38')](_0x423c41[_0x92b2('0x39')],qs['fields'](_0x49ca54[_0x92b2('0x35')]['fields']));_0x150958[_0x92b2('0x3a')]=_0x150958['attributes'][_0x92b2('0x49')]?_0x150958[_0x92b2('0x3a')]:_0x423c41[_0x92b2('0x39')];if(_0x49ca54['query'][_0x92b2('0x46')]){_0x150958['include']=[{'all':!![]}];}_0x150958=_[_0x92b2('0x44')]({},_0x150958,_0x49ca54[_0x92b2('0x4a')]);return db['UserProfile'][_0x92b2('0x4b')](_0x150958)[_0x92b2('0x2a')](handleEntityNotFound(_0x399bb7,null))[_0x92b2('0x2a')](respondWithResult(_0x399bb7,null))[_0x92b2('0x4c')](handleError(_0x399bb7,null));};exports[_0x92b2('0x4d')]=function(_0x7d6dcf,_0x2c4531){return db[_0x92b2('0x45')][_0x92b2('0x4d')](_0x7d6dcf[_0x92b2('0x4e')],{})[_0x92b2('0x2a')](respondWithResult(_0x2c4531,0xc9))[_0x92b2('0x4c')](handleError(_0x2c4531,null));};exports[_0x92b2('0x4f')]=function(_0x12f255,_0x563ded){var _0x16de05={'where':{'id':_0x12f255['params']['id']}},_0x350a24={};_0x350a24['model']=_['keys'](db[_0x92b2('0x45')][_0x92b2('0x31')]);_0x16de05['attributes']=_['intersection'](_0x350a24['model'],qs[_0x92b2('0x3b')](_0x12f255[_0x92b2('0x35')][_0x92b2('0x3b')]));_0x16de05[_0x92b2('0x3a')]=_0x16de05[_0x92b2('0x3a')][_0x92b2('0x49')]?_0x16de05[_0x92b2('0x3a')]:_0x350a24[_0x92b2('0x39')];if(_0x12f255['query']['includeAll']){_0x16de05['include']=[{'all':!![]}];}_0x16de05=_[_0x92b2('0x44')]({},_0x16de05,_0x12f255['options']);return db[_0x92b2('0x45')]['find'](_0x16de05)[_0x92b2('0x2a')](handleEntityNotFound(_0x563ded,null))[_0x92b2('0x2a')](function(_0x46e583){if(_0x46e583){var _0x1ac73f=_0x46e583['get']({'plain':!![]});_0x1ac73f=qs[_0x92b2('0x50')](_0x1ac73f,['id',_0x92b2('0x51'),_0x92b2('0x52'),_0x92b2('0x53')]);_0x12f255[_0x92b2('0x4e')]=_[_0x92b2('0x50')](_0x12f255[_0x92b2('0x4e')],['id',_0x92b2('0x51'),_0x92b2('0x52')]);return db[_0x92b2('0x54')][_0x92b2('0x55')](function(_0x172e0f){return db[_0x92b2('0x45')][_0x92b2('0x4d')](_[_0x92b2('0x44')](_0x1ac73f,_0x12f255['body']),{'include':_0x12f255['query'][_0x92b2('0x46')]?[{'all':!![]}]:undefined,'transaction':_0x172e0f})[_0x92b2('0x2a')](function(_0x308842){var _0x4bef43=_0x308842[_0x92b2('0x56')]({'plain':!![]});return db[_0x92b2('0x57')][_0x92b2('0x58')]({'where':{'userProfileId':_0x12f255[_0x92b2('0x59')]['id']},'raw':!![]})[_0x92b2('0x2a')](function(_0x46b4de){if(_0x46b4de){return BPromise[_0x92b2('0x5a')](_0x46b4de,function(_0x4de976){return new BPromise(function(_0x307a89,_0x27e273){if(_0x4de976[_0x92b2('0x5b')]===null||_0x4de976['autoAssociation']===0x1)_0x307a89(null);return db[_0x92b2('0x5c')][_0x92b2('0x58')]({'where':{'sectionId':_0x4de976['id']},'raw':!![]})['then'](function(_0x4a0355){var _0x2d1878=_[_0x92b2('0x42')](_0x4a0355,function(_0x5c8772){return qs[_0x92b2('0x50')](_0x5c8772,['id',_0x92b2('0x51'),_0x92b2('0x52'),_0x92b2('0x5d')]);});_0x307a89(_0x2d1878);})[_0x92b2('0x4c')](function(_0x1c9790){_0x27e273(_0x1c9790);});})[_0x92b2('0x2a')](function(_0x31e0dc){var _0x413980=qs[_0x92b2('0x50')](_0x4de976,['id','createdAt',_0x92b2('0x52')]);_0x413980[_0x92b2('0x5e')]=_0x4bef43['id'];if(_0x31e0dc)_0x413980[_0x92b2('0x5f')]=_0x31e0dc;return _0x413980;})[_0x92b2('0x2a')](function(_0x1be9dc){return db['UserProfileSection']['create'](_0x1be9dc,{'include':[{'model':db[_0x92b2('0x5c')],'as':_0x92b2('0x5f')}],'raw':!![],'transaction':_0x172e0f});});})[_0x92b2('0x2a')](function(){return _0x4bef43;});}});});});}})[_0x92b2('0x2a')](respondWithResult(_0x563ded,0xc9))[_0x92b2('0x4c')](handleError(_0x563ded,null));};exports[_0x92b2('0x29')]=function(_0x2607ed,_0x478fff){if(_0x2607ed[_0x92b2('0x4e')]['id']){delete _0x2607ed[_0x92b2('0x4e')]['id'];}return db['UserProfile'][_0x92b2('0x4b')]({'where':{'id':_0x2607ed['params']['id']}})[_0x92b2('0x2a')](handleEntityNotFound(_0x478fff,null))[_0x92b2('0x2a')](saveUpdates(_0x2607ed[_0x92b2('0x4e')],null))['then'](respondWithResult(_0x478fff,null))['catch'](handleError(_0x478fff,null));};exports[_0x92b2('0x2b')]=function(_0x57b2d4,_0x5056d4){return db[_0x92b2('0x45')][_0x92b2('0x4b')]({'where':{'id':_0x57b2d4[_0x92b2('0x59')]['id']}})[_0x92b2('0x2a')](handleEntityNotFound(_0x5056d4,null))[_0x92b2('0x2a')](removeEntity(_0x5056d4,null))[_0x92b2('0x4c')](handleError(_0x5056d4,null));};exports[_0x92b2('0x60')]=function(_0x4d6a15,_0x3ba3ca){return db[_0x92b2('0x45')]['describe']()[_0x92b2('0x2a')](respondWithResult(_0x3ba3ca,null))[_0x92b2('0x4c')](handleError(_0x3ba3ca,null));};exports[_0x92b2('0x61')]=function(_0x1bcc26,_0x24b5fd){var _0x4e4cd0=_0x1bcc26[_0x92b2('0x4e')];return db[_0x92b2('0x45')]['find']({'where':{'id':_0x1bcc26[_0x92b2('0x59')]['id']}})[_0x92b2('0x2a')](handleEntityNotFound(_0x24b5fd,null))[_0x92b2('0x2a')](function(_0x3f94ec){if(_0x3f94ec){return db[_0x92b2('0x54')][_0x92b2('0x55')](function(_0x1b7f9d){return db['UserProfileSection'][_0x92b2('0x2b')]({'where':{'userProfileId':_0x1bcc26[_0x92b2('0x59')]['id'],'sectionId':_[_0x92b2('0x42')](_0x4e4cd0,function(_0x3c3e33){return _0x3c3e33['sectionId'];})},'transaction':_0x1b7f9d})[_0x92b2('0x2a')](function(){var _0xa6501b=_[_0x92b2('0x42')](_0x4e4cd0,function(_0x3d75f8){_0x3d75f8['userProfileId']=_0x1bcc26[_0x92b2('0x59')]['id'];return _0x3d75f8;});var _0x3a241c=[];return BPromise[_0x92b2('0x5a')](_0xa6501b,function(_0x18edcd){return db[_0x92b2('0x57')][_0x92b2('0x4d')](_0x18edcd,{'include':[{'model':db[_0x92b2('0x5c')],'as':_0x92b2('0x5f')}],'raw':!![],'transaction':_0x1b7f9d})[_0x92b2('0x2a')](function(_0x1df280){_0x3a241c[_0x92b2('0x62')](_0x1df280[_0x92b2('0x56')]({'plain':!![]}));});})[_0x92b2('0x2a')](function(){return _0x3a241c;});});});}})[_0x92b2('0x2a')](function(_0x2e937c){return _0x2e937c;})[_0x92b2('0x2a')](respondWithResult(_0x24b5fd,null))[_0x92b2('0x4c')](handleError(_0x24b5fd,null));};exports[_0x92b2('0x63')]=function(_0x337f43,_0x2087f0){var _0x116c26;return db[_0x92b2('0x45')]['find']({'where':{'id':_0x337f43['params']['id']},'attributes':['id','name']})['then'](handleEntityNotFound(_0x2087f0,null))[_0x92b2('0x2a')](function(_0x12a079){if(_0x12a079){_0x116c26=_0x12a079;return db[_0x92b2('0x57')]['destroy']({'where':{'userProfileId':_0x337f43[_0x92b2('0x59')]['id'],'sectionId':_0x337f43[_0x92b2('0x35')][_0x92b2('0x64')]}});}})[_0x92b2('0x2a')](function(){return _0x116c26;})['then'](respondWithStatusCode(_0x2087f0,null))[_0x92b2('0x4c')](handleError(_0x2087f0,null));};exports[_0x92b2('0x65')]=function(_0x187dbb,_0x2bbda6){var _0x23e99e=[];var _0x3dd8b5=[];return db[_0x92b2('0x57')][_0x92b2('0x58')]({'where':{'userProfileId':_0x187dbb[_0x92b2('0x59')]['id']},'raw':!![]})[_0x92b2('0x2a')](function(_0x5e70cd){_0x23e99e=_[_0x92b2('0x41')](_0x5e70cd,function(_0x20f6d0){return _0x20f6d0['enabled']===0x1||_[_0x92b2('0x66')]([0x3eb,0x709],_0x20f6d0[_0x92b2('0x5d')]);});if(!_[_0x92b2('0x67')](_0x23e99e)){return _[_0x92b2('0x42')](_0x23e99e,function(_0x9c143c){return _0x9c143c[_0x92b2('0x5d')];});}else{return;}})[_0x92b2('0x2a')](function(_0x2e3552){if(_0x2e3552)_0x3dd8b5=_0x2e3552;if(_[_0x92b2('0x66')](_0x3dd8b5,0x64)){var _0x248f80=_[_0x92b2('0x4b')](_0x23e99e,{'sectionId':0x64});return hasDefaultDashboard(_0x248f80)[_0x92b2('0x2a')](function(_0x23a44a){return _[_0x92b2('0x42')](_0x23e99e,function(_0x380141){if(_0x380141[_0x92b2('0x5d')]===0x64){_0x380141[_0x92b2('0x68')]=_0x23a44a;}return _0x380141;});});}else{return;}})['then'](function(_0x1fd6bc){if(_0x1fd6bc)_0x23e99e=_0x1fd6bc;if(_[_0x92b2('0x66')](_0x3dd8b5,0x3eb)){var _0x31b3b9=_[_0x92b2('0x4b')](_0x23e99e,{'sectionId':0x3eb});return getCustomDashboards(_0x31b3b9)['then'](function(_0x4cf881){return _[_0x92b2('0x42')](_0x23e99e,function(_0x530621){if(_0x31b3b9[_0x92b2('0x69')]){if(_0x530621[_0x92b2('0x5d')]===0x3eb){_0x530621[_0x92b2('0x68')]=_0x4cf881;}}else{if(_0x530621[_0x92b2('0x5d')]===0x64){_0x530621[_0x92b2('0x68')]=_0x4cf881;}}return _0x530621;});});}else{return;}})[_0x92b2('0x2a')](function(_0x33b5b4){if(_0x33b5b4)_0x23e99e=_0x33b5b4;if(_[_0x92b2('0x66')](_0x3dd8b5,0x709)){var _0x58e447=_[_0x92b2('0x4b')](_0x23e99e,{'sectionId':0x709});return getPlugins(_0x58e447)[_0x92b2('0x2a')](function(_0x4d4da5){if(_0x58e447[_0x92b2('0x69')]){return _['map'](_0x23e99e,function(_0x13da8d){if(_0x13da8d['sectionId']===0x709){_0x13da8d[_0x92b2('0x68')]=_0x4d4da5;}return _0x13da8d;});}else{var _0x4745ea={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4d4da5};var _0x4f9cf3=_[_0x92b2('0x42')](_0x23e99e);_0x4f9cf3[_0x92b2('0x62')](_0x4745ea);return _0x4f9cf3;}});}else{return;}})[_0x92b2('0x2a')](function(_0x2e5c07){if(_0x2e5c07)_0x23e99e=_0x2e5c07;return _[_0x92b2('0x41')](_0x23e99e,['enabled',0x1]);})[_0x92b2('0x2a')](respondWithResult(_0x2bbda6,null))['catch'](handleError(_0x2bbda6,null));};function hasDefaultDashboard(_0x42dae7){var _0x14321d=[0x65];return new BPromise(function(_0x2dfbb1,_0x55591){try{if(_0x42dae7[_0x92b2('0x5b')]){_0x2dfbb1(_0x14321d);}else{return db[_0x92b2('0x5c')][_0x92b2('0x6a')]({'where':{'sectionId':_0x42dae7['id']},'raw':!![]})['then'](function(_0xed7f70){_0xed7f70?_0x2dfbb1(_0x14321d):_0x2dfbb1();});}}catch(_0xb35ba8){_0x55591(_0xb35ba8);}});}function getCustomDashboards(_0x29e9dd){var _0x251a11=[];return new BPromise(function(_0x56c66f,_0x6799ab){try{if(_0x29e9dd['autoAssociation']){return db[_0x92b2('0x6b')][_0x92b2('0x58')]({'raw':!![]})[_0x92b2('0x2a')](function(_0x1cdce0){_0x1cdce0[_0x92b2('0x6c')](function(_0x377b43){_0x251a11[_0x92b2('0x62')](_0x377b43['id']+0x1869f);});_0x56c66f(_0x251a11);});}else{return db[_0x92b2('0x5c')][_0x92b2('0x58')]({'where':{'sectionId':_0x29e9dd['id']},'raw':!![]})['then'](function(_0x30ae48){_0x30ae48[_0x92b2('0x6c')](function(_0x484b82){_0x251a11[_0x92b2('0x62')](_0x484b82['resourceId']+0x1869f);});_0x56c66f(_0x251a11);});}}catch(_0x1e64b0){_0x6799ab(_0x1e64b0);}});}function getPlugins(_0x320c1){var _0x1dc806=[];return new BPromise(function(_0x42a0be,_0x462d02){try{if(_0x320c1['autoAssociation']){return db[_0x92b2('0x6d')][_0x92b2('0x58')]({'raw':!![]})[_0x92b2('0x2a')](function(_0x36c190){_0x36c190[_0x92b2('0x6c')](function(_0x55c1d5){_0x1dc806[_0x92b2('0x62')](_0x55c1d5['id']+0x15b38);});_0x42a0be(_0x1dc806);});}else{return db[_0x92b2('0x5c')][_0x92b2('0x58')]({'where':{'sectionId':_0x320c1['id']},'raw':!![]})[_0x92b2('0x2a')](function(_0x14ae16){_0x14ae16[_0x92b2('0x6c')](function(_0x382ce0){_0x1dc806[_0x92b2('0x62')](_0x382ce0[_0x92b2('0x6e')]+0x15b38);});_0x42a0be(_0x1dc806);});}}catch(_0x1e67ce){_0x462d02(_0x1e67ce);}});}exports['addResources']=function(_0x124b39,_0x54e0f4){return db[_0x92b2('0x45')][_0x92b2('0x4b')]({'where':{'id':_0x124b39['params']['id']}})[_0x92b2('0x2a')](handleEntityNotFound(_0x54e0f4,null))['then'](function(_0x222c3e){if(_0x222c3e){return db[_0x92b2('0x54')][_0x92b2('0x55')](function(_0x531127){return db[_0x92b2('0x57')][_0x92b2('0x58')]({'where':{'userProfileId':_0x124b39[_0x92b2('0x59')]['id']},'attributes':['id'],'raw':!![]})[_0x92b2('0x2a')](function(_0x1168f9){if(_0x1168f9){return db[_0x92b2('0x57')]['destroy']({'where':{'userProfileId':_0x124b39[_0x92b2('0x59')]['id'],'id':_[_0x92b2('0x42')](_0x1168f9,function(_0x53bedb){return _0x53bedb['id'];})},'transaction':_0x531127});}})['then'](function(_0x212999){var _0x3ae16a=_[_0x92b2('0x42')](_0x124b39[_0x92b2('0x4e')],function(_0x367847){_0x367847[_0x92b2('0x5e')]=_0x124b39['params']['id'];return _0x367847;});return db[_0x92b2('0x57')][_0x92b2('0x6f')](_0x3ae16a,{'raw':!![],'transaction':_0x531127});})[_0x92b2('0x2a')](function(_0x2cc695){var _0x4fddb2=_['filter'](_['map'](_0x2cc695,function(_0x10c31c){return _0x10c31c[_0x92b2('0x56')]({'plain':!![]});}),{'includeAll':![]});if(_0x4fddb2){return db[_0x92b2('0x57')][_0x92b2('0x58')]({'where':{'userProfileId':_0x124b39['params']['id'],'sectionId':_['map'](_0x4fddb2,function(_0x27d336){return _0x27d336[_0x92b2('0x5d')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x92b2('0x2a')](function(_0x36a78e){var _0x538662=_[_0x92b2('0x42')](_0x124b39[_0x92b2('0x4e')],function(_0x1a55ac){_0x1a55ac[_0x92b2('0x5e')]=_0x124b39[_0x92b2('0x59')]['id'];return _0x1a55ac;});return db[_0x92b2('0x5c')][_0x92b2('0x6f')](_0x538662,{'raw':!![],'transaction':_0x531127});});}})[_0x92b2('0x4c')](handleError(_0x54e0f4,null));});}})[_0x92b2('0x2a')](function(_0x4d32dc){var _0x1d61ea=_['map'](_0x4d32dc,function(_0x4bd619){return _0x4bd619[_0x92b2('0x56')]({'plain':!![]});});})[_0x92b2('0x2a')](respondWithResult(_0x54e0f4,null))[_0x92b2('0x4c')](handleError(_0x54e0f4,null));};exports[_0x92b2('0x70')]=function(_0x536d2c,_0x56e25d,_0x4dba37){return db[_0x92b2('0x45')][_0x92b2('0x4b')]({'where':{'id':_0x536d2c[_0x92b2('0x59')]['id']}})[_0x92b2('0x2a')](handleEntityNotFound(_0x56e25d,null))[_0x92b2('0x2a')](function(_0xf08ad1){if(_0xf08ad1){return _0xf08ad1[_0x92b2('0x70')](_0x536d2c[_0x92b2('0x35')]['ids']);}})['then'](respondWithStatusCode(_0x56e25d,null))['catch'](handleError(_0x56e25d,null));};exports[_0x92b2('0x71')]=function(_0x24dc07,_0x300f25){var _0x40002d={};if(!_0x24dc07[_0x92b2('0x35')][_0x92b2('0x72')])throw new Error(_0x92b2('0x73'));if(!_0x24dc07[_0x92b2('0x35')][_0x92b2('0x3c')](_0x92b2('0x74'))){_0x40002d[_0x92b2('0x24')]=qs[_0x92b2('0x24')](_0x24dc07['query'][_0x92b2('0x24')]);_0x40002d['offset']=qs[_0x92b2('0x22')](_0x24dc07['query'][_0x92b2('0x22')]);}return db[_0x92b2('0x45')]['find']({'where':{'id':_0x24dc07[_0x92b2('0x59')]['id']}})[_0x92b2('0x2a')](function(_0x27ed96){if(!_0x27ed96)throw new Error(_0x92b2('0x75')+_0x24dc07['params']['id']);return db[_0x92b2('0x45')][_0x92b2('0x71')](_0x24dc07);})[_0x92b2('0x2a')](respondWithFilteredResult(_0x300f25,_0x40002d))['catch'](handleError(_0x300f25,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 5425fcf..af208b6 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 _0xbc48=['events','../../mysqldb','UserProfile','setMaxListeners','update','remove','hook'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbc48,0x111));var _0x8bc4=function(_0x61eeb4,_0x32115c){_0x61eeb4=_0x61eeb4-0x0;var _0x2ce907=_0xbc48[_0x61eeb4];return _0x2ce907;};'use strict';var EventEmitter=require(_0x8bc4('0x0'));var UserProfile=require(_0x8bc4('0x1'))['db'][_0x8bc4('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x8bc4('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8bc4('0x4'),'afterDestroy':_0x8bc4('0x5')};function emitEvent(_0x3efe3a){return function(_0x5971fb,_0x5468ea,_0x2f83e9){UserProfileEvents['emit'](_0x3efe3a+':'+_0x5971fb['id'],_0x5971fb);UserProfileEvents['emit'](_0x3efe3a,_0x5971fb);_0x2f83e9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x8bc4('0x6')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x8af6=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserProfile'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8af6,0x76));var _0x68af=function(_0x15917d,_0x499eb6){_0x15917d=_0x15917d-0x0;var _0x4c305d=_0x8af6[_0x15917d];return _0x4c305d;};'use strict';var EventEmitter=require(_0x68af('0x0'));var UserProfile=require(_0x68af('0x1'))['db'][_0x68af('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x68af('0x3')](0x0);var events={'afterCreate':_0x68af('0x4'),'afterUpdate':_0x68af('0x5'),'afterDestroy':_0x68af('0x6')};function emitEvent(_0xe2ba54){return function(_0x1f8b3a,_0x3d1c16,_0x52bd87){UserProfileEvents[_0x68af('0x7')](_0xe2ba54+':'+_0x1f8b3a['id'],_0x1f8b3a);UserProfileEvents['emit'](_0xe2ba54,_0x1f8b3a);_0x52bd87(null);};}for(var e in events){if(events[_0x68af('0x8')](e)){var event=events[e];UserProfile[_0x68af('0x9')](e,emitEvent(event));}}module[_0x68af('0xa')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index e7451a5..0dd1149 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 _0x27a0=['Tags','color','tag','include','openTabs','true','chat','dataValues','sms','mail','openchannel','whatsapp','./userProfile.attributes','../../components/parsers/qs','squel','exports','filter','value','findAll','associatedResources','map','field','model','then','name','UserProfileResource','resourceId','type','catch','toLowerCase','childModel','SquareProject','odbc','SquareRecording','parentSections','SquareProjects','projectName','contacts','lists','CmList','CmCompany','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','inbound','QueueCampaigns','VoiceQueue','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','users','agents','telephones','Users','admin','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','zohoaccounts','customdashboards','Interval','pauses','scheduler','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','Variable','plugins','Plugin','extractedreports','AnalyticExtractedReport','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','ui.','InteractionId','ui.createdAt','_interactions','sequelize','query','toString','OpenTabs','define','user_profiles','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','push','UserProfileSection','find','params','all','union','ignore','intersection','attributes','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','filters','merge','VIRTUAL','foreignKey','forEach','options','autoAssociation','includeAll','default','DefaultReports','custom','CustomReports','count','rows','CmContact'];(function(_0x35eea8,_0x54193e){var _0x410ab6=function(_0x47d3b7){while(--_0x47d3b7){_0x35eea8['push'](_0x35eea8['shift']());}};_0x410ab6(++_0x54193e);}(_0x27a0,0xbf));var _0x027a=function(_0x2befa5,_0x428272){_0x2befa5=_0x2befa5-0x0;var _0x3ec992=_0x27a0[_0x2befa5];return _0x3ec992;};'use strict';var _=require('lodash');var attributes=require(_0x027a('0x0'));var qs=require(_0x027a('0x1'));var squel=require(_0x027a('0x2'));module[_0x027a('0x3')]=function(_0x32e5e0){var _0x59cd58=_0x32e5e0['models'];function _0x4e8d6b(_0x47cd65,_0x30a54d){return new Promise(function(_0x2a409a,_0x137b09){if(!_0x30a54d)return _0x2a409a(null);var _0x639bec=_0x30a54d[_0x027a('0x4')]?{[_0x30a54d[_0x027a('0x4')]['field']]:_0x30a54d[_0x027a('0x4')][_0x027a('0x5')]}:undefined;return _0x59cd58[_0x47cd65][_0x027a('0x6')]({'where':_0x639bec,'raw':!![]})['then'](function(_0x44c56a){_0x30a54d[_0x027a('0x7')]=_[_0x027a('0x8')](_0x44c56a,'id');_0x2a409a(_0x30a54d);})['catch'](function(_0x6d5b04){_0x137b09(_0x6d5b04);});});}function _0xe5df59(_0x7daf8a,_0x2ca4f0){return new Promise(function(_0x172eb4,_0x267afc){var _0x2698d1=_0x7daf8a[_0x027a('0x4')]?{[_0x7daf8a[_0x027a('0x4')][_0x027a('0x9')]]:_0x7daf8a[_0x027a('0x4')]['value']}:undefined;return _0x59cd58[_0x7daf8a[_0x027a('0xa')]][_0x027a('0x6')]({'where':_0x2698d1,'raw':!![]})[_0x027a('0xb')](function(_0x21da53){_0x2ca4f0[_0x027a('0x7')]=_['map'](_0x21da53,function(_0x5b6165){return _0x5b6165[_0x027a('0xc')];});_0x172eb4(_0x2ca4f0);})['catch'](function(_0x2b3870){_0x267afc(_0x2b3870);});});}function _0x559d13(_0x432007,_0x5a1224,_0x4dc3ab){if(!_0x5a1224)return Promise['resolve'](null);return new Promise(function(_0x588f53,_0x2f04e9){return _0x59cd58[_0x027a('0xd')][_0x027a('0x6')]({'where':{'sectionId':_0x5a1224['id']},'raw':!![]})['then'](function(_0x282e70){if(_0x432007[_0x027a('0x9')]&&_0x432007['field']!=='id'){_0x5a1224['associatedResources']=_[_0x027a('0x8')](_0x282e70,function(_0x57cf67){return _0x57cf67[_0x432007[_0x027a('0x9')]];});}else{if(_0x4dc3ab==='AnalyticExtractedReport'){_0x5a1224['associatedResources']=_['map'](_0x282e70,function(_0x4b4f90){return{'id':_0x4b4f90[_0x027a('0xe')],'type':_0x4b4f90[_0x027a('0xf')]};});}else{_0x5a1224[_0x027a('0x7')]=_[_0x027a('0x8')](_0x282e70,function(_0x51b870){return _0x51b870[_0x027a('0xe')];});}}_0x588f53(_0x5a1224);})[_0x027a('0x10')](function(_0x20e2da){_0x2f04e9(_0x20e2da);});});}function _0x3dee99(_0x178ed8,_0x3bbd46){var _0x595f0e={'parentSections':[]};switch(_0x178ed8[_0x027a('0x11')]()){case'squareprojects':_0x595f0e[_0x027a('0x12')]=_0x027a('0x13');break;case _0x027a('0x14'):_0x595f0e[_0x027a('0x12')]='SquareOdbc';break;case'squarerecordings':_0x595f0e[_0x027a('0x12')]=_0x027a('0x15');_0x595f0e[_0x027a('0x16')]=[{'name':_0x027a('0x17'),'field':'name','foreignKey':_0x027a('0x18')}];break;case'projects':_0x595f0e[_0x027a('0x12')]='JscriptyProject';break;case _0x027a('0x19'):_0x595f0e['childModel']='CmContact';_0x595f0e[_0x027a('0x16')]=[{'name':'Lists','field':'id','foreignKey':'ListId'}];break;case _0x027a('0x1a'):_0x595f0e['childModel']=_0x027a('0x1b');break;case'companies':_0x595f0e[_0x027a('0x12')]=_0x027a('0x1c');break;case'globalcustomfields':_0x595f0e[_0x027a('0x12')]='CmCustomField';break;case _0x027a('0x1d'):_0x595f0e[_0x027a('0x12')]=_0x027a('0x1e');break;case _0x027a('0x1f'):_0x595f0e[_0x027a('0x12')]=_0x027a('0x20');break;case'faxqueues':_0x595f0e[_0x027a('0x12')]='FaxQueue';break;case _0x027a('0x21'):_0x595f0e['childModel']=_0x027a('0x22');break;case _0x027a('0x23'):case _0x027a('0x24'):case _0x027a('0x25'):_0x595f0e[_0x027a('0x12')]='VoiceExtension';break;case _0x027a('0x26'):_0x595f0e[_0x027a('0x12')]=_0x027a('0x27');break;case _0x027a('0x28'):_0x595f0e[_0x027a('0x12')]=_0x027a('0x29');break;case _0x027a('0x2a'):_0x595f0e[_0x027a('0x12')]=_0x027a('0x2b');_0x595f0e[_0x027a('0x16')]=[{'name':_0x027a('0x2c'),'field':'name','foreignKey':_0x027a('0x2d'),'model':_0x027a('0x2e'),'filter':{'field':_0x027a('0x2f'),'value':[_0x027a('0x30')]}},{'name':_0x027a('0x31'),'field':_0x027a('0xc'),'foreignKey':_0x027a('0x2d'),'model':'User','filter':{'field':_0x027a('0x2f'),'value':[_0x027a('0x32')]}},{'name':_0x027a('0x33'),'field':'name','foreignKey':_0x027a('0x34'),'model':'VoiceQueue','filter':{'field':_0x027a('0xf'),'value':[_0x027a('0x35')]}},{'name':_0x027a('0x36'),'field':'name','foreignKey':'queue','model':_0x027a('0x37'),'filter':{'field':_0x027a('0xf'),'value':['outbound']}}];break;case _0x027a('0x38'):_0x595f0e[_0x027a('0x12')]=_0x027a('0x39');break;case _0x027a('0x3a'):_0x595f0e[_0x027a('0x12')]=_0x027a('0x3b');break;case _0x027a('0x3c'):_0x595f0e[_0x027a('0x12')]=_0x027a('0x3d');break;case _0x027a('0x3e'):_0x595f0e[_0x027a('0x12')]=_0x027a('0x3f');break;case _0x027a('0x40'):_0x595f0e[_0x027a('0x12')]=_0x027a('0x41');break;case _0x027a('0x42'):_0x595f0e[_0x027a('0x12')]='MailAccount';break;case _0x027a('0x43'):_0x595f0e[_0x027a('0x12')]=_0x027a('0x44');break;case _0x027a('0x45'):_0x595f0e[_0x027a('0x12')]=_0x027a('0x46');break;case'openchannelaccounts':_0x595f0e[_0x027a('0x12')]=_0x027a('0x47');break;case'smsqueues':_0x595f0e[_0x027a('0x12')]='SmsQueue';break;case'smsaccounts':_0x595f0e[_0x027a('0x12')]='SmsAccount';break;case _0x027a('0x48'):_0x595f0e[_0x027a('0x12')]=_0x027a('0x49');break;case _0x027a('0x4a'):_0x595f0e[_0x027a('0x12')]='WhatsappAccount';break;case _0x027a('0x4b'):_0x595f0e[_0x027a('0x12')]=_0x027a('0x4c');break;case'voicequeues':case'queuecampaigns':_0x595f0e['childModel']='VoiceQueue';if(_0x3bbd46){_0x595f0e[_0x027a('0x16')]=[{'name':_0x027a('0x33')},{'name':_0x027a('0x36')}];}break;case _0x027a('0x4d'):case _0x027a('0x4e'):case _0x027a('0x4f'):_0x595f0e['childModel']='User';if(_0x3bbd46){_0x595f0e[_0x027a('0x16')]=[{'name':_0x027a('0x50'),'filter':{'field':_0x027a('0x2f'),'value':[_0x027a('0x51'),_0x027a('0x52')]},'ignore':!![]},{'name':_0x027a('0x2c')},{'name':_0x027a('0x31')}];}break;case _0x027a('0x53'):_0x595f0e[_0x027a('0x12')]='ZendeskAccount';break;case _0x027a('0x54'):_0x595f0e[_0x027a('0x12')]=_0x027a('0x55');break;case _0x027a('0x56'):_0x595f0e[_0x027a('0x12')]=_0x027a('0x57');break;case _0x027a('0x58'):_0x595f0e[_0x027a('0x12')]='SugarcrmAccount';break;case _0x027a('0x59'):_0x595f0e[_0x027a('0x12')]='DeskAccount';break;case _0x027a('0x5a'):_0x595f0e[_0x027a('0x12')]='ZohoAccount';break;case'vtigeraccounts':_0x595f0e['childModel']=_0x027a('0x2e');break;case'cannedanswers':_0x595f0e[_0x027a('0x12')]='CannedAnswer';break;case'dispositions':_0x595f0e['childModel']='Disposition';break;case _0x027a('0x5b'):_0x595f0e[_0x027a('0x12')]='Dashboard';break;case'intervals':_0x595f0e[_0x027a('0x12')]=_0x027a('0x5c');break;case _0x027a('0x5d'):_0x595f0e[_0x027a('0x12')]='Pause';break;case _0x027a('0x5e'):_0x595f0e['childModel']=_0x027a('0x5f');break;case _0x027a('0x60'):_0x595f0e[_0x027a('0x12')]=_0x027a('0x61');break;case _0x027a('0x62'):_0x595f0e[_0x027a('0x12')]=_0x027a('0x63');break;case _0x027a('0x64'):_0x595f0e['childModel']=_0x027a('0x65');break;case _0x027a('0x66'):_0x595f0e[_0x027a('0x12')]=_0x027a('0x67');break;case _0x027a('0x68'):_0x595f0e[_0x027a('0x12')]=_0x027a('0x69');break;case'variables':_0x595f0e[_0x027a('0x12')]=_0x027a('0x6a');break;case _0x027a('0x6b'):_0x595f0e[_0x027a('0x12')]=_0x027a('0x6c');break;case _0x027a('0x6d'):_0x595f0e[_0x027a('0x12')]=_0x027a('0x6e');_0x595f0e[_0x027a('0x16')]=[{'name':_0x027a('0x6f'),'field':'id','foreignKey':_0x027a('0x70')}];break;case _0x027a('0x71'):_0x595f0e[_0x027a('0x12')]=_0x027a('0x72');break;}return _0x595f0e;}function _0x9796e8(_0x5b2cdc,_0x13f9b9){var _0x3ed56f=_0x5b2cdc[_0x027a('0x73')](0x0)[_0x027a('0x74')]()+_0x5b2cdc[_0x027a('0x75')](0x1);var _0x25366e={'type':_0x59cd58[_0x027a('0x76')][_0x027a('0x77')][_0x027a('0x78')],'raw':!![]};return new Promise(function(_0x514c34,_0x553850){var _0x4c8ea0=squel['select']()[_0x027a('0x9')](_0x027a('0x79')+_0x3ed56f+_0x027a('0x7a'),'id')[_0x027a('0x9')](_0x027a('0x7b'))['from']('user_has_'+_0x5b2cdc+_0x027a('0x7c'),'ui')['where']('ui.UserId\x20=\x20?',_0x13f9b9['id']);return _0x59cd58[_0x027a('0x7d')][_0x027a('0x7e')](_0x4c8ea0[_0x027a('0x7f')](),_0x25366e)[_0x027a('0xb')](function(_0x18fb27){_0x13f9b9[_0x3ed56f+_0x027a('0x80')]=_0x18fb27;_0x514c34(_0x18fb27);})[_0x027a('0x10')](function(_0x3d0e4c){_0x553850(_0x3d0e4c);});});}return _0x32e5e0[_0x027a('0x81')]('UserProfile',attributes,{'tableName':_0x027a('0x82'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x14b9c8){var _0x227c70={'raw':![],'where':{}};var _0x3d5313={};var _0x2aa773={'count':0x0,'rows':[]};var _0x1b5d30=_0x14b9c8[_0x027a('0x7e')][_0x027a('0x83')];var _0x1292ec=_0x14b9c8[_0x027a('0x7e')][_0x027a('0x84')]||![];var _0x12d17d=_0x3dee99(_0x1b5d30,_0x1292ec);if(!_0x12d17d[_0x027a('0x12')])throw new Error(_0x027a('0x85')+_0x1b5d30+'\x27');var _0x5b3a5a=[{'name':_0x1b5d30}];if(!_[_0x027a('0x86')](_0x12d17d[_0x027a('0x16')]))_0x5b3a5a=_0x12d17d[_0x027a('0x16')];var _0x388626=[];for(var _0x51afb8=0x0;_0x51afb8<_0x5b3a5a['length'];_0x51afb8++){_0x388626[_0x027a('0x87')](_0x59cd58[_0x027a('0x88')][_0x027a('0x89')]({'where':{'userProfileId':_0x14b9c8[_0x027a('0x8a')]['id'],'name':_0x5b3a5a[_0x51afb8][_0x027a('0xc')]},'raw':!![]}));}return Promise[_0x027a('0x8b')](_0x388626)[_0x027a('0xb')](function(_0x2b4cbd){var _0x3ae1f3=_['filter'](_0x2b4cbd,function(_0x40a920){return _0x40a920?_0x40a920:undefined;});var _0x3888de=_[_0x027a('0x4')](_0x5b3a5a,['ignore',!![]]);var _0x136332=_[_0x027a('0x86')](_0x3ae1f3)&&_['isEmpty'](_0x3888de)?null:_[_0x027a('0x8c')](_0x3888de,_0x3ae1f3);if(!_0x136332)return null;var _0x9f8482=[];for(var _0x4bbfb1=0x0;_0x4bbfb1<_0x136332['length'];_0x4bbfb1++){var _0x22dea5=_[_0x027a('0x89')](_0x5b3a5a,function(_0x643789){return _0x136332[_0x4bbfb1]?_0x643789[_0x027a('0xc')]===_0x136332[_0x4bbfb1]['name']:null;});if(_0x22dea5){if(_0x136332[_0x4bbfb1][_0x027a('0x8d')]){_0x9f8482[_0x027a('0x87')](_0x4e8d6b(_0x12d17d[_0x027a('0x12')],_0x136332[_0x4bbfb1]));}else{if(!_0x136332[_0x4bbfb1]['autoAssociation']){_0x9f8482[_0x027a('0x87')](_0x559d13(_0x22dea5,_0x136332[_0x4bbfb1],_0x12d17d['childModel']));}else{if(_0x22dea5[_0x027a('0xa')]){_0x9f8482['push'](_0xe5df59(_0x22dea5,_0x136332[_0x4bbfb1]));}}}}}return Promise[_0x027a('0x8b')](_0x9f8482);})[_0x027a('0xb')](function(_0x17ef27){var _0x19014a=_0x17ef27;var _0x49aff5=null;if(_0x19014a){_0x49aff5=_0x19014a['length']===0x1?_0x19014a[0x0]:null;}if(!_0x49aff5&&!_0x19014a)return _0x2aa773;var _0x4f67bb=_0x59cd58[_0x12d17d['childModel']]['rawAttributes'];_0x3d5313['model']=_['keys'](_0x4f67bb);_0x3d5313[_0x027a('0x7e')]=_['keys'](_0x14b9c8[_0x027a('0x7e')]);_0x3d5313['filters']=_[_0x027a('0x8e')](_0x3d5313['model'],_0x3d5313['query']);_0x227c70[_0x027a('0x8f')]=_[_0x027a('0x8e')](_0x3d5313[_0x027a('0xa')],qs['fields'](_0x14b9c8[_0x027a('0x7e')]['fields']));_0x227c70[_0x027a('0x8f')]=_0x227c70[_0x027a('0x8f')][_0x027a('0x90')]?_0x227c70['attributes']:_0x3d5313[_0x027a('0xa')];if(!_0x14b9c8[_0x027a('0x7e')][_0x027a('0x91')](_0x027a('0x92'))){_0x227c70[_0x027a('0x93')]=qs[_0x027a('0x93')](_0x14b9c8['query'][_0x027a('0x93')]);_0x227c70['offset']=qs[_0x027a('0x94')](_0x14b9c8[_0x027a('0x7e')][_0x027a('0x94')]);}_0x227c70[_0x027a('0x95')]=qs['sort'](_0x14b9c8[_0x027a('0x7e')][_0x027a('0x96')]);_0x227c70[_0x027a('0x97')]=qs[_0x027a('0x98')](_['pick'](_0x14b9c8[_0x027a('0x7e')],_0x3d5313[_0x027a('0x98')]));if(_0x14b9c8[_0x027a('0x7e')][_0x027a('0x4')]){_0x227c70['where']=_[_0x027a('0x99')](_0x227c70[_0x027a('0x97')],{'$or':_['map'](_0x4f67bb,function(_0x367a36){if(_0x367a36[_0x027a('0xf')]['key']!==_0x027a('0x9a')){var _0x1dac6d={};_0x1dac6d[_0x367a36[_0x027a('0x9')]]={'$like':'%'+_0x14b9c8[_0x027a('0x7e')][_0x027a('0x4')]+'%'};return _0x1dac6d;}})});}var _0x345be0=[];var _0xf2d0d9=null;var _0x5099c2={};if(_0x49aff5){_0xf2d0d9=_['find'](_0x5b3a5a,['name',_0x49aff5[_0x027a('0xc')]]);if(_0xf2d0d9[_0x027a('0x9')]){_0x5099c2={};if(_0x12d17d[_0x027a('0x12')]===_0x027a('0x6e')){_0x5099c2[_0xf2d0d9[_0x027a('0x9b')]]=_[_0x027a('0x8')](_0x49aff5['associatedResources'],'id');}else{_0x5099c2[_0xf2d0d9[_0x027a('0x9b')]]=_0x49aff5[_0x027a('0x7')];}_0x345be0[_0x027a('0x87')](_0x5099c2);}else{_0x227c70[_0x027a('0x97')]['id']=_0x49aff5['associatedResources'];}}else{for(var _0x4d58e7=0x0;_0x4d58e7<_0x19014a[_0x027a('0x90')];_0x4d58e7++){_0xf2d0d9=_['find'](_0x5b3a5a,[_0x027a('0xc'),_0x19014a[_0x4d58e7][_0x027a('0xc')]]);if(_0xf2d0d9['field']){_0x5099c2={};_0x5099c2[_0xf2d0d9[_0x027a('0x9b')]]=_0x19014a[_0x4d58e7][_0x027a('0x7')];_0x345be0[_0x027a('0x87')](_0x5099c2);}else{if(!_0x227c70[_0x027a('0x97')]['id'])_0x227c70[_0x027a('0x97')]['id']=[];_0x19014a[_0x4d58e7][_0x027a('0x7')][_0x027a('0x9c')](function(_0x3af905){_0x227c70[_0x027a('0x97')]['id'][_0x027a('0x87')](_0x3af905);});}}}if(!_[_0x027a('0x86')](_0x345be0)){_0x227c70[_0x027a('0x97')]=_[_0x027a('0x99')](_0x227c70[_0x027a('0x97')],{'$and':{'$or':_0x345be0}});}_0x227c70=_[_0x027a('0x99')]({},_0x227c70,_0x14b9c8[_0x027a('0x9d')]);if(_0x49aff5&&!_0x49aff5[_0x027a('0x9e')]&&_0x12d17d['childModel']==='AnalyticExtractedReport'){if(_0x14b9c8[_0x027a('0x7e')][_0x027a('0x9f')]){_0x227c70['include']=[{'all':!![]}];}return _0x59cd58[_0x12d17d[_0x027a('0x12')]][_0x027a('0x6')](_0x227c70)[_0x027a('0xb')](function(_0x36bb99){var _0x1f2f86=[];_0x36bb99['forEach'](function(_0x39ffe1){var _0x218e4f;switch(_0x39ffe1['reportType']){case _0x027a('0xa0'):_0x218e4f=_[_0x027a('0x89')](_0x49aff5['associatedResources'],function(_0x5d6d7b){return _0x5d6d7b['id']===_0x39ffe1[_0x027a('0x70')]&&_0x5d6d7b[_0x027a('0xf')]===_0x027a('0xa1');});break;case _0x027a('0xa2'):_0x218e4f=_[_0x027a('0x89')](_0x49aff5[_0x027a('0x7')],function(_0x4b2e49){return _0x4b2e49['id']===_0x39ffe1[_0x027a('0x70')]&&_0x4b2e49['type']===_0x027a('0xa3');});break;}if(_0x218e4f)_0x1f2f86[_0x027a('0x87')](_0x39ffe1);});_0x2aa773[_0x027a('0xa4')]=_0x1f2f86[_0x027a('0x90')];_0x2aa773[_0x027a('0xa5')]=_0x1f2f86;return _0x2aa773;});}else{return _0x59cd58[_0x12d17d[_0x027a('0x12')]]['count']({'where':_0x227c70[_0x027a('0x97')]})[_0x027a('0xb')](function(_0x2629b6){_0x2aa773['count']=_0x2629b6;if(_0x14b9c8[_0x027a('0x7e')][_0x027a('0x9f')]){if(_0x12d17d[_0x027a('0x12')]===_0x027a('0xa6')){_0x227c70['include']=[{'model':_0x59cd58[_0x027a('0x63')],'as':_0x027a('0xa7'),'attributes':['id',_0x027a('0xc'),_0x027a('0xa8')],'required':_0x14b9c8[_0x027a('0x7e')][_0x027a('0xa9')]?!![]:![]},{'model':_0x59cd58[_0x027a('0x63')],'as':'ThroughTags','attributes':['id',_0x027a('0xc'),_0x027a('0xa8')],'through':_0x14b9c8[_0x027a('0x7e')][_0x027a('0xa9')]?{'attributes':[],'where':{'TagId':_0x14b9c8[_0x027a('0x7e')][_0x027a('0xa9')]||undefined}}:{},'required':_0x14b9c8['query']['tag']?!![]:![]}];}else{_0x227c70[_0x027a('0xaa')]=[{'all':!![]}];}}return _0x59cd58[_0x12d17d[_0x027a('0x12')]][_0x027a('0x6')](_0x227c70);})['then'](function(_0x39c173){_0x2aa773[_0x027a('0xa5')]=_0x39c173;if(_0x1b5d30===_0x027a('0x2c')&&_0x14b9c8[_0x027a('0x7e')][_0x027a('0xab')]===_0x027a('0xac')){var _0x3fca19=[];for(var _0x1131b6=0x0;_0x1131b6<_0x2aa773[_0x027a('0xa5')]['length'];_0x1131b6++){_0x3fca19['push'](_0x9796e8(_0x027a('0xad'),_0x2aa773[_0x027a('0xa5')][_0x1131b6][_0x027a('0xae')]));_0x3fca19[_0x027a('0x87')](_0x9796e8(_0x027a('0xaf'),_0x2aa773[_0x027a('0xa5')][_0x1131b6][_0x027a('0xae')]));_0x3fca19[_0x027a('0x87')](_0x9796e8('fax',_0x2aa773[_0x027a('0xa5')][_0x1131b6][_0x027a('0xae')]));_0x3fca19[_0x027a('0x87')](_0x9796e8(_0x027a('0xb0'),_0x2aa773[_0x027a('0xa5')][_0x1131b6][_0x027a('0xae')]));_0x3fca19[_0x027a('0x87')](_0x9796e8(_0x027a('0xb1'),_0x2aa773['rows'][_0x1131b6][_0x027a('0xae')]));_0x3fca19[_0x027a('0x87')](_0x9796e8(_0x027a('0xb2'),_0x2aa773[_0x027a('0xa5')][_0x1131b6][_0x027a('0xae')]));}return Promise[_0x027a('0x8b')](_0x3fca19)[_0x027a('0xb')](function(){return _0x2aa773;});}return _0x2aa773;});}});}}});}; \ No newline at end of file +var _0xe2fe=['FaxAccount','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','inbound','QueueCampaigns','VoiceQueue','outbound','chanspies','VoiceChanSpy','Campaign','mailqueues','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','users','agents','telephones','Users','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','cannedanswers','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','Tag','templates','Template','Trunk','variables','Variable','plugins','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','QueryTypes','SELECT','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','OpenTabs','UserProfile','user_profiles','query','section','Invalid\x20section\x20\x27','isEmpty','length','push','find','params','all','ignore','union','autoAssociation','rawAttributes','keys','filters','intersection','attributes','hasOwnProperty','limit','offset','order','sort','pick','key','VIRTUAL','foreignKey','forEach','merge','options','includeAll','reportType','default','DefaultReports','custom','CustomReports','count','include','color','tag','true','rows','dataValues','sms','mail','openchannel','whatsapp','lodash','squel','models','filter','findAll','then','associatedResources','map','field','value','model','name','catch','AnalyticExtractedReport','type','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','projects','JscriptyProject','contacts','CmContact','Lists','lists','CmList','companies','globalcustomfields','chatwebsites','faxqueues'];(function(_0x3f9f10,_0x4e2ea7){var _0x1e3a12=function(_0x17c0dd){while(--_0x17c0dd){_0x3f9f10['push'](_0x3f9f10['shift']());}};_0x1e3a12(++_0x4e2ea7);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var attributes=require('./userProfile.attributes');var qs=require('../../components/parsers/qs');var squel=require(_0xee2f('0x1'));module['exports']=function(_0x169cf9){var _0x1b6f4c=_0x169cf9[_0xee2f('0x2')];function _0x2d2b03(_0xcb45e6,_0x4ba89f){return new Promise(function(_0x311a2f,_0x2b7e7c){if(!_0x4ba89f)return _0x311a2f(null);var _0x49926b=_0x4ba89f[_0xee2f('0x3')]?{[_0x4ba89f[_0xee2f('0x3')]['field']]:_0x4ba89f[_0xee2f('0x3')]['value']}:undefined;return _0x1b6f4c[_0xcb45e6][_0xee2f('0x4')]({'where':_0x49926b,'raw':!![]})[_0xee2f('0x5')](function(_0x53f7dd){_0x4ba89f[_0xee2f('0x6')]=_[_0xee2f('0x7')](_0x53f7dd,'id');_0x311a2f(_0x4ba89f);})['catch'](function(_0x5597ea){_0x2b7e7c(_0x5597ea);});});}function _0x4818df(_0x56bbea,_0x2b8fb1){return new Promise(function(_0x4cb4bf,_0x481ea7){var _0x53047d=_0x56bbea[_0xee2f('0x3')]?{[_0x56bbea[_0xee2f('0x3')][_0xee2f('0x8')]]:_0x56bbea[_0xee2f('0x3')][_0xee2f('0x9')]}:undefined;return _0x1b6f4c[_0x56bbea[_0xee2f('0xa')]]['findAll']({'where':_0x53047d,'raw':!![]})[_0xee2f('0x5')](function(_0x531c3a){_0x2b8fb1[_0xee2f('0x6')]=_[_0xee2f('0x7')](_0x531c3a,function(_0x48b30c){return _0x48b30c[_0xee2f('0xb')];});_0x4cb4bf(_0x2b8fb1);})[_0xee2f('0xc')](function(_0x28b614){_0x481ea7(_0x28b614);});});}function _0x1bbf7d(_0x390c2c,_0x58f42a,_0x3f6372){if(!_0x58f42a)return Promise['resolve'](null);return new Promise(function(_0x17d288,_0x3359ff){return _0x1b6f4c['UserProfileResource']['findAll']({'where':{'sectionId':_0x58f42a['id']},'raw':!![]})[_0xee2f('0x5')](function(_0x5a5078){if(_0x390c2c[_0xee2f('0x8')]&&_0x390c2c[_0xee2f('0x8')]!=='id'){_0x58f42a[_0xee2f('0x6')]=_['map'](_0x5a5078,function(_0x35e1a4){return _0x35e1a4[_0x390c2c[_0xee2f('0x8')]];});}else{if(_0x3f6372===_0xee2f('0xd')){_0x58f42a[_0xee2f('0x6')]=_[_0xee2f('0x7')](_0x5a5078,function(_0x5d36d4){return{'id':_0x5d36d4['resourceId'],'type':_0x5d36d4[_0xee2f('0xe')]};});}else{_0x58f42a[_0xee2f('0x6')]=_[_0xee2f('0x7')](_0x5a5078,function(_0x203b2f){return _0x203b2f[_0xee2f('0xf')];});}}_0x17d288(_0x58f42a);})[_0xee2f('0xc')](function(_0x39a39c){_0x3359ff(_0x39a39c);});});}function _0x4d68d3(_0x250399,_0x2c47c5){var _0x15ceda={'parentSections':[]};switch(_0x250399[_0xee2f('0x10')]()){case _0xee2f('0x11'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x13');break;case _0xee2f('0x14'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x15');break;case _0xee2f('0x16'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x17');_0x15ceda[_0xee2f('0x18')]=[{'name':'SquareProjects','field':'name','foreignKey':'projectName'}];break;case _0xee2f('0x19'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x1a');break;case _0xee2f('0x1b'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x1c');_0x15ceda['parentSections']=[{'name':_0xee2f('0x1d'),'field':'id','foreignKey':'ListId'}];break;case _0xee2f('0x1e'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x1f');break;case _0xee2f('0x20'):_0x15ceda[_0xee2f('0x12')]='CmCompany';break;case _0xee2f('0x21'):_0x15ceda[_0xee2f('0x12')]='CmCustomField';break;case'chatqueues':_0x15ceda[_0xee2f('0x12')]='ChatQueue';break;case _0xee2f('0x22'):_0x15ceda[_0xee2f('0x12')]='ChatWebsite';break;case _0xee2f('0x23'):_0x15ceda['childModel']='FaxQueue';break;case'faxaccounts':_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x24');break;case'inboundroutes':case _0xee2f('0x25'):case _0xee2f('0x26'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x27');break;case _0xee2f('0x28'):_0x15ceda['childModel']=_0xee2f('0x29');break;case'voicemails':_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x2a');break;case _0xee2f('0x2b'):_0x15ceda['childModel']=_0xee2f('0x2c');_0x15ceda['parentSections']=[{'name':_0xee2f('0x2d'),'field':'name','foreignKey':_0xee2f('0x2e'),'model':_0xee2f('0x2f'),'filter':{'field':_0xee2f('0x30'),'value':[_0xee2f('0x31')]}},{'name':_0xee2f('0x32'),'field':_0xee2f('0xb'),'foreignKey':_0xee2f('0x2e'),'model':_0xee2f('0x2f'),'filter':{'field':_0xee2f('0x30'),'value':[_0xee2f('0x33')]}},{'name':_0xee2f('0x34'),'field':'name','foreignKey':_0xee2f('0x35'),'model':'VoiceQueue','filter':{'field':_0xee2f('0xe'),'value':[_0xee2f('0x36')]}},{'name':_0xee2f('0x37'),'field':_0xee2f('0xb'),'foreignKey':_0xee2f('0x35'),'model':_0xee2f('0x38'),'filter':{'field':_0xee2f('0xe'),'value':[_0xee2f('0x39')]}}];break;case'musiconholds':_0x15ceda['childModel']='VoiceMusicOnHold';break;case _0xee2f('0x3a'):_0x15ceda['childModel']=_0xee2f('0x3b');break;case'voiceprefixes':_0x15ceda['childModel']='VoicePrefix';break;case'ivrcampaigns':_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x3c');break;case _0xee2f('0x3d'):_0x15ceda[_0xee2f('0x12')]='MailQueue';break;case'mailaccounts':_0x15ceda[_0xee2f('0x12')]='MailAccount';break;case'mailsubstatuses':_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x3e');break;case _0xee2f('0x3f'):_0x15ceda['childModel']=_0xee2f('0x40');break;case _0xee2f('0x41'):_0x15ceda[_0xee2f('0x12')]='OpenchannelAccount';break;case'smsqueues':_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x42');break;case _0xee2f('0x43'):_0x15ceda[_0xee2f('0x12')]='SmsAccount';break;case _0xee2f('0x44'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x45');break;case _0xee2f('0x46'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x47');break;case _0xee2f('0x48'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x49');break;case _0xee2f('0x4a'):case'queuecampaigns':_0x15ceda['childModel']='VoiceQueue';if(_0x2c47c5){_0x15ceda['parentSections']=[{'name':_0xee2f('0x34')},{'name':_0xee2f('0x37')}];}break;case _0xee2f('0x4b'):case _0xee2f('0x4c'):case _0xee2f('0x4d'):_0x15ceda['childModel']=_0xee2f('0x2f');if(_0x2c47c5){_0x15ceda[_0xee2f('0x18')]=[{'name':_0xee2f('0x4e'),'filter':{'field':_0xee2f('0x30'),'value':['admin','user']},'ignore':!![]},{'name':'Agents'},{'name':_0xee2f('0x32')}];}break;case'zendeskaccounts':_0x15ceda['childModel']='ZendeskAccount';break;case'salesforceaccounts':_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x4f');break;case _0xee2f('0x50'):_0x15ceda['childModel']=_0xee2f('0x51');break;case'sugarcrmaccounts':_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x52');break;case _0xee2f('0x53'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x54');break;case'zohoaccounts':_0x15ceda['childModel']=_0xee2f('0x55');break;case'vtigeraccounts':_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x2f');break;case _0xee2f('0x56'):_0x15ceda[_0xee2f('0x12')]='CannedAnswer';break;case'dispositions':_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x57');break;case _0xee2f('0x58'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x59');break;case _0xee2f('0x5a'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x5b');break;case _0xee2f('0x5c'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x5d');break;case _0xee2f('0x5e'):_0x15ceda['childModel']=_0xee2f('0x5f');break;case _0xee2f('0x60'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x61');break;case'tags':_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x62');break;case _0xee2f('0x63'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x64');break;case'triggers':_0x15ceda[_0xee2f('0x12')]='Trigger';break;case'trunks':_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x65');break;case _0xee2f('0x66'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x67');break;case _0xee2f('0x68'):_0x15ceda[_0xee2f('0x12')]='Plugin';break;case _0xee2f('0x69'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0xd');_0x15ceda[_0xee2f('0x18')]=[{'name':_0xee2f('0x6a'),'field':'id','foreignKey':_0xee2f('0x6b')}];break;case _0xee2f('0x6c'):_0x15ceda[_0xee2f('0x12')]=_0xee2f('0x6d');break;}return _0x15ceda;}function _0x5d6c40(_0x12373b,_0x4b9d29){var _0x1b4ee6=_0x12373b[_0xee2f('0x6e')](0x0)[_0xee2f('0x6f')]()+_0x12373b[_0xee2f('0x70')](0x1);var _0x2f3891={'type':_0x1b6f4c['Sequelize'][_0xee2f('0x71')][_0xee2f('0x72')],'raw':!![]};return new Promise(function(_0x27a938,_0x65d1af){var _0x53441d=squel['select']()['field']('ui.'+_0x1b4ee6+'InteractionId','id')[_0xee2f('0x8')]('ui.createdAt')[_0xee2f('0x73')](_0xee2f('0x74')+_0x12373b+_0xee2f('0x75'),'ui')[_0xee2f('0x76')](_0xee2f('0x77'),_0x4b9d29['id']);return _0x1b6f4c[_0xee2f('0x78')]['query'](_0x53441d['toString'](),_0x2f3891)[_0xee2f('0x5')](function(_0x58e464){_0x4b9d29[_0x1b4ee6+_0xee2f('0x79')]=_0x58e464;_0x27a938(_0x58e464);})['catch'](function(_0x7167f9){_0x65d1af(_0x7167f9);});});}return _0x169cf9['define'](_0xee2f('0x7a'),attributes,{'tableName':_0xee2f('0x7b'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x2f419c){var _0x5655f4={'raw':![],'where':{}};var _0x3cc477={};var _0x3fd375={'count':0x0,'rows':[]};var _0x3bdfc5=_0x2f419c[_0xee2f('0x7c')][_0xee2f('0x7d')];var _0x486146=_0x2f419c[_0xee2f('0x7c')]['mergeResources']||![];var _0x3ee766=_0x4d68d3(_0x3bdfc5,_0x486146);if(!_0x3ee766[_0xee2f('0x12')])throw new Error(_0xee2f('0x7e')+_0x3bdfc5+'\x27');var _0x353bd9=[{'name':_0x3bdfc5}];if(!_[_0xee2f('0x7f')](_0x3ee766[_0xee2f('0x18')]))_0x353bd9=_0x3ee766[_0xee2f('0x18')];var _0x15c7ff=[];for(var _0x191af8=0x0;_0x191af8<_0x353bd9[_0xee2f('0x80')];_0x191af8++){_0x15c7ff[_0xee2f('0x81')](_0x1b6f4c['UserProfileSection'][_0xee2f('0x82')]({'where':{'userProfileId':_0x2f419c[_0xee2f('0x83')]['id'],'name':_0x353bd9[_0x191af8]['name']},'raw':!![]}));}return Promise[_0xee2f('0x84')](_0x15c7ff)['then'](function(_0x4372cc){var _0x4ed7c9=_['filter'](_0x4372cc,function(_0x465acd){return _0x465acd?_0x465acd:undefined;});var _0x46ecac=_[_0xee2f('0x3')](_0x353bd9,[_0xee2f('0x85'),!![]]);var _0x48c3fa=_['isEmpty'](_0x4ed7c9)&&_[_0xee2f('0x7f')](_0x46ecac)?null:_[_0xee2f('0x86')](_0x46ecac,_0x4ed7c9);if(!_0x48c3fa)return null;var _0x42fae8=[];for(var _0x5d4fe8=0x0;_0x5d4fe8<_0x48c3fa[_0xee2f('0x80')];_0x5d4fe8++){var _0x413d70=_['find'](_0x353bd9,function(_0x1f1c55){return _0x48c3fa[_0x5d4fe8]?_0x1f1c55[_0xee2f('0xb')]===_0x48c3fa[_0x5d4fe8][_0xee2f('0xb')]:null;});if(_0x413d70){if(_0x48c3fa[_0x5d4fe8][_0xee2f('0x85')]){_0x42fae8[_0xee2f('0x81')](_0x2d2b03(_0x3ee766[_0xee2f('0x12')],_0x48c3fa[_0x5d4fe8]));}else{if(!_0x48c3fa[_0x5d4fe8][_0xee2f('0x87')]){_0x42fae8[_0xee2f('0x81')](_0x1bbf7d(_0x413d70,_0x48c3fa[_0x5d4fe8],_0x3ee766[_0xee2f('0x12')]));}else{if(_0x413d70['model']){_0x42fae8['push'](_0x4818df(_0x413d70,_0x48c3fa[_0x5d4fe8]));}}}}}return Promise['all'](_0x42fae8);})[_0xee2f('0x5')](function(_0x19ce25){var _0x4288eb=_0x19ce25;var _0x7ab1db=null;if(_0x4288eb){_0x7ab1db=_0x4288eb[_0xee2f('0x80')]===0x1?_0x4288eb[0x0]:null;}if(!_0x7ab1db&&!_0x4288eb)return _0x3fd375;var _0x4f7be1=_0x1b6f4c[_0x3ee766[_0xee2f('0x12')]][_0xee2f('0x88')];_0x3cc477['model']=_[_0xee2f('0x89')](_0x4f7be1);_0x3cc477[_0xee2f('0x7c')]=_[_0xee2f('0x89')](_0x2f419c['query']);_0x3cc477[_0xee2f('0x8a')]=_['intersection'](_0x3cc477[_0xee2f('0xa')],_0x3cc477[_0xee2f('0x7c')]);_0x5655f4['attributes']=_[_0xee2f('0x8b')](_0x3cc477[_0xee2f('0xa')],qs['fields'](_0x2f419c['query']['fields']));_0x5655f4[_0xee2f('0x8c')]=_0x5655f4['attributes']['length']?_0x5655f4[_0xee2f('0x8c')]:_0x3cc477[_0xee2f('0xa')];if(!_0x2f419c['query'][_0xee2f('0x8d')]('nolimit')){_0x5655f4[_0xee2f('0x8e')]=qs[_0xee2f('0x8e')](_0x2f419c[_0xee2f('0x7c')][_0xee2f('0x8e')]);_0x5655f4[_0xee2f('0x8f')]=qs[_0xee2f('0x8f')](_0x2f419c[_0xee2f('0x7c')]['offset']);}_0x5655f4[_0xee2f('0x90')]=qs[_0xee2f('0x91')](_0x2f419c[_0xee2f('0x7c')][_0xee2f('0x91')]);_0x5655f4[_0xee2f('0x76')]=qs['filters'](_[_0xee2f('0x92')](_0x2f419c[_0xee2f('0x7c')],_0x3cc477[_0xee2f('0x8a')]));if(_0x2f419c[_0xee2f('0x7c')][_0xee2f('0x3')]){_0x5655f4[_0xee2f('0x76')]=_['merge'](_0x5655f4['where'],{'$or':_[_0xee2f('0x7')](_0x4f7be1,function(_0x28320c){if(_0x28320c[_0xee2f('0xe')][_0xee2f('0x93')]!==_0xee2f('0x94')){var _0x266fb7={};_0x266fb7[_0x28320c[_0xee2f('0x8')]]={'$like':'%'+_0x2f419c['query']['filter']+'%'};return _0x266fb7;}})});}var _0x2ad26d=[];var _0x27eabc=null;var _0x12c4f9={};if(_0x7ab1db){_0x27eabc=_[_0xee2f('0x82')](_0x353bd9,[_0xee2f('0xb'),_0x7ab1db[_0xee2f('0xb')]]);if(_0x27eabc[_0xee2f('0x8')]){_0x12c4f9={};if(_0x3ee766[_0xee2f('0x12')]===_0xee2f('0xd')){_0x12c4f9[_0x27eabc[_0xee2f('0x95')]]=_[_0xee2f('0x7')](_0x7ab1db[_0xee2f('0x6')],'id');}else{_0x12c4f9[_0x27eabc['foreignKey']]=_0x7ab1db['associatedResources'];}_0x2ad26d[_0xee2f('0x81')](_0x12c4f9);}else{_0x5655f4['where']['id']=_0x7ab1db['associatedResources'];}}else{for(var _0x5a460d=0x0;_0x5a460d<_0x4288eb['length'];_0x5a460d++){_0x27eabc=_[_0xee2f('0x82')](_0x353bd9,[_0xee2f('0xb'),_0x4288eb[_0x5a460d]['name']]);if(_0x27eabc['field']){_0x12c4f9={};_0x12c4f9[_0x27eabc[_0xee2f('0x95')]]=_0x4288eb[_0x5a460d][_0xee2f('0x6')];_0x2ad26d[_0xee2f('0x81')](_0x12c4f9);}else{if(!_0x5655f4['where']['id'])_0x5655f4['where']['id']=[];_0x4288eb[_0x5a460d][_0xee2f('0x6')][_0xee2f('0x96')](function(_0x499d0e){_0x5655f4['where']['id'][_0xee2f('0x81')](_0x499d0e);});}}}if(!_['isEmpty'](_0x2ad26d)){_0x5655f4[_0xee2f('0x76')]=_['merge'](_0x5655f4[_0xee2f('0x76')],{'$and':{'$or':_0x2ad26d}});}_0x5655f4=_[_0xee2f('0x97')]({},_0x5655f4,_0x2f419c[_0xee2f('0x98')]);if(_0x7ab1db&&!_0x7ab1db['autoAssociation']&&_0x3ee766['childModel']===_0xee2f('0xd')){if(_0x2f419c[_0xee2f('0x7c')][_0xee2f('0x99')]){_0x5655f4['include']=[{'all':!![]}];}return _0x1b6f4c[_0x3ee766[_0xee2f('0x12')]][_0xee2f('0x4')](_0x5655f4)[_0xee2f('0x5')](function(_0x346fc2){var _0x413340=[];_0x346fc2[_0xee2f('0x96')](function(_0x411afb){var _0x16326e;switch(_0x411afb[_0xee2f('0x9a')]){case _0xee2f('0x9b'):_0x16326e=_[_0xee2f('0x82')](_0x7ab1db[_0xee2f('0x6')],function(_0x28bde7){return _0x28bde7['id']===_0x411afb[_0xee2f('0x6b')]&&_0x28bde7['type']===_0xee2f('0x9c');});break;case _0xee2f('0x9d'):_0x16326e=_[_0xee2f('0x82')](_0x7ab1db[_0xee2f('0x6')],function(_0x23f8c7){return _0x23f8c7['id']===_0x411afb[_0xee2f('0x6b')]&&_0x23f8c7[_0xee2f('0xe')]===_0xee2f('0x9e');});break;}if(_0x16326e)_0x413340[_0xee2f('0x81')](_0x411afb);});_0x3fd375[_0xee2f('0x9f')]=_0x413340[_0xee2f('0x80')];_0x3fd375['rows']=_0x413340;return _0x3fd375;});}else{return _0x1b6f4c[_0x3ee766[_0xee2f('0x12')]][_0xee2f('0x9f')]({'where':_0x5655f4[_0xee2f('0x76')]})[_0xee2f('0x5')](function(_0x53d769){_0x3fd375[_0xee2f('0x9f')]=_0x53d769;if(_0x2f419c[_0xee2f('0x7c')][_0xee2f('0x99')]){if(_0x3ee766['childModel']==='CmContact'){_0x5655f4[_0xee2f('0xa0')]=[{'model':_0x1b6f4c['Tag'],'as':'Tags','attributes':['id','name',_0xee2f('0xa1')],'required':_0x2f419c[_0xee2f('0x7c')][_0xee2f('0xa2')]?!![]:![]},{'model':_0x1b6f4c[_0xee2f('0x62')],'as':'ThroughTags','attributes':['id',_0xee2f('0xb'),_0xee2f('0xa1')],'through':_0x2f419c[_0xee2f('0x7c')]['tag']?{'attributes':[],'where':{'TagId':_0x2f419c[_0xee2f('0x7c')]['tag']||undefined}}:{},'required':_0x2f419c[_0xee2f('0x7c')]['tag']?!![]:![]}];}else{_0x5655f4['include']=[{'all':!![]}];}}return _0x1b6f4c[_0x3ee766[_0xee2f('0x12')]]['findAll'](_0x5655f4);})[_0xee2f('0x5')](function(_0x5a95e0){_0x3fd375['rows']=_0x5a95e0;if(_0x3bdfc5===_0xee2f('0x2d')&&_0x2f419c[_0xee2f('0x7c')]['openTabs']===_0xee2f('0xa3')){var _0x34f882=[];for(var _0x4fe164=0x0;_0x4fe164<_0x3fd375['rows'][_0xee2f('0x80')];_0x4fe164++){_0x34f882[_0xee2f('0x81')](_0x5d6c40('chat',_0x3fd375[_0xee2f('0xa4')][_0x4fe164][_0xee2f('0xa5')]));_0x34f882[_0xee2f('0x81')](_0x5d6c40(_0xee2f('0xa6'),_0x3fd375[_0xee2f('0xa4')][_0x4fe164]['dataValues']));_0x34f882['push'](_0x5d6c40('fax',_0x3fd375[_0xee2f('0xa4')][_0x4fe164][_0xee2f('0xa5')]));_0x34f882[_0xee2f('0x81')](_0x5d6c40(_0xee2f('0xa7'),_0x3fd375[_0xee2f('0xa4')][_0x4fe164][_0xee2f('0xa5')]));_0x34f882[_0xee2f('0x81')](_0x5d6c40(_0xee2f('0xa8'),_0x3fd375[_0xee2f('0xa4')][_0x4fe164][_0xee2f('0xa5')]));_0x34f882[_0xee2f('0x81')](_0x5d6c40(_0xee2f('0xa9'),_0x3fd375[_0xee2f('0xa4')][_0x4fe164][_0xee2f('0xa5')]));}return Promise[_0xee2f('0x84')](_0x34f882)[_0xee2f('0x5')](function(){return _0x3fd375;});}return _0x3fd375;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index ce2b73a..a20804f 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 _0x583c=['UserProfile,\x20%s,\x20%s','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','info','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x54c2ba,_0x2dd793){var _0x2b0af4=function(_0x323646){while(--_0x323646){_0x54c2ba['push'](_0x54c2ba['shift']());}};_0x2b0af4(++_0x2dd793);}(_0x583c,0x12b));var _0xc583=function(_0x2ef8f1,_0x1280a3){_0x2ef8f1=_0x2ef8f1-0x0;var _0x17498d=_0x583c[_0x2ef8f1];return _0x17498d;};'use strict';var _=require(_0xc583('0x0'));var util=require(_0xc583('0x1'));var moment=require(_0xc583('0x2'));var BPromise=require(_0xc583('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc583('0x4'));var db=require(_0xc583('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc583('0x6'));var config=require(_0xc583('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc583('0x8')][_0xc583('0x9')]({'port':0x232a});config[_0xc583('0xa')]=_[_0xc583('0xb')](config['redis'],{'host':_0xc583('0xc'),'port':0x18eb});var socket=require(_0xc583('0xd'))(new Redis(config['redis']));require(_0xc583('0xe'))[_0xc583('0xf')](socket);function respondWithRpcPromise(_0x25f8d3,_0xb23f07,_0x2d99ca){return new BPromise(function(_0x550b1e,_0x3437be){return client[_0xc583('0x10')](_0x25f8d3,_0x2d99ca)['then'](function(_0x23c51a){logger[_0xc583('0x11')]('UserProfile,\x20%s,\x20%s',_0xb23f07,_0xc583('0x12'));logger[_0xc583('0x13')](_0xc583('0x14'),_0xb23f07,_0xc583('0x12'),JSON[_0xc583('0x15')](_0x23c51a));if(_0x23c51a[_0xc583('0x16')]){if(_0x23c51a[_0xc583('0x16')][_0xc583('0x17')]===0x1f4){logger[_0xc583('0x16')]('UserProfile,\x20%s,\x20%s',_0xb23f07,_0x23c51a[_0xc583('0x16')]['message']);return _0x3437be(_0x23c51a[_0xc583('0x16')][_0xc583('0x18')]);}logger['error'](_0xc583('0x19'),_0xb23f07,_0x23c51a[_0xc583('0x16')]['message']);return _0x550b1e(_0x23c51a[_0xc583('0x16')][_0xc583('0x18')]);}else{logger['info'](_0xc583('0x19'),_0xb23f07,_0xc583('0x12'));_0x550b1e(_0x23c51a[_0xc583('0x1a')][_0xc583('0x18')]);}})['catch'](function(_0x3dd3cc){logger['error'](_0xc583('0x19'),_0xb23f07,_0x3dd3cc);_0x3437be(_0x3dd3cc);});});} \ No newline at end of file +var _0xea4e=['UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','lodash','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','request\x20sent','debug'];(function(_0x547388,_0x519ad5){var _0x546c9a=function(_0x40797c){while(--_0x40797c){_0x547388['push'](_0x547388['shift']());}};_0x546c9a(++_0x519ad5);}(_0xea4e,0x10c));var _0xeea4=function(_0x38a3d6,_0x52e305){_0x38a3d6=_0x38a3d6-0x0;var _0x3768d7=_0xea4e[_0x38a3d6];return _0x3768d7;};'use strict';var _=require(_0xeea4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xeea4('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeea4('0x2'))['db'];var utils=require(_0xeea4('0x3'));var logger=require('../../config/logger')(_0xeea4('0x4'));var config=require(_0xeea4('0x5'));var jayson=require(_0xeea4('0x6'));var client=jayson[_0xeea4('0x7')][_0xeea4('0x8')]({'port':0x232a});config[_0xeea4('0x9')]=_[_0xeea4('0xa')](config[_0xeea4('0x9')],{'host':_0xeea4('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeea4('0x9')]));require('./userProfile.socket')[_0xeea4('0xc')](socket);function respondWithRpcPromise(_0x114d6e,_0x279b9,_0x367d41){return new BPromise(function(_0x16a077,_0x3f9846){return client[_0xeea4('0xd')](_0x114d6e,_0x367d41)[_0xeea4('0xe')](function(_0x48a0db){logger[_0xeea4('0xf')]('UserProfile,\x20%s,\x20%s',_0x279b9,_0xeea4('0x10'));logger[_0xeea4('0x11')](_0xeea4('0x12'),_0x279b9,_0xeea4('0x10'),JSON[_0xeea4('0x13')](_0x48a0db));if(_0x48a0db[_0xeea4('0x14')]){if(_0x48a0db[_0xeea4('0x14')][_0xeea4('0x15')]===0x1f4){logger['error'](_0xeea4('0x16'),_0x279b9,_0x48a0db[_0xeea4('0x14')]['message']);return _0x3f9846(_0x48a0db[_0xeea4('0x14')]['message']);}logger[_0xeea4('0x14')](_0xeea4('0x16'),_0x279b9,_0x48a0db[_0xeea4('0x14')][_0xeea4('0x17')]);return _0x16a077(_0x48a0db[_0xeea4('0x14')][_0xeea4('0x17')]);}else{logger[_0xeea4('0xf')](_0xeea4('0x16'),_0x279b9,_0xeea4('0x10'));_0x16a077(_0x48a0db[_0xeea4('0x18')]['message']);}})[_0xeea4('0x19')](function(_0x8e29fb){logger['error'](_0xeea4('0x16'),_0x279b9,_0x8e29fb);_0x3f9846(_0x8e29fb);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index c09e04f..b5aab67 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 _0x6a62=['update','emit','removeListener','length','userProfile:','./userProfile.events','remove'];(function(_0x59e033,_0x125307){var _0x2cff63=function(_0x14c81e){while(--_0x14c81e){_0x59e033['push'](_0x59e033['shift']());}};_0x2cff63(++_0x125307);}(_0x6a62,0x171));var _0x26a6=function(_0x32a89c,_0x3d4860){_0x32a89c=_0x32a89c-0x0;var _0x414f60=_0x6a62[_0x32a89c];return _0x414f60;};'use strict';var UserProfileEvents=require(_0x26a6('0x0'));var events=['save',_0x26a6('0x1'),_0x26a6('0x2')];function createListener(_0x63cfa2,_0x13eb68){return function(_0xf50549){_0x13eb68[_0x26a6('0x3')](_0x63cfa2,_0xf50549);};}function removeListener(_0x18f650,_0x103468){return function(){UserProfileEvents[_0x26a6('0x4')](_0x18f650,_0x103468);};}exports['register']=function(_0x197a91){for(var _0x2ae66b=0x0,_0x56a9e8=events[_0x26a6('0x5')];_0x2ae66b<_0x56a9e8;_0x2ae66b++){var _0x3c6518=events[_0x2ae66b];var _0x4afbcf=createListener(_0x26a6('0x6')+_0x3c6518,_0x197a91);UserProfileEvents['on'](_0x3c6518,_0x4afbcf);}}; \ No newline at end of file +var _0x4bbc=['register','length','./userProfile.events','save','update','emit','removeListener'];(function(_0x26042f,_0x2f822f){var _0xa0e4cf=function(_0x1175f6){while(--_0x1175f6){_0x26042f['push'](_0x26042f['shift']());}};_0xa0e4cf(++_0x2f822f);}(_0x4bbc,0xf7));var _0xc4bb=function(_0x31e1d7,_0x54b26e){_0x31e1d7=_0x31e1d7-0x0;var _0xfa9f78=_0x4bbc[_0x31e1d7];return _0xfa9f78;};'use strict';var UserProfileEvents=require(_0xc4bb('0x0'));var events=[_0xc4bb('0x1'),'remove',_0xc4bb('0x2')];function createListener(_0x287646,_0x223a77){return function(_0xed6be9){_0x223a77[_0xc4bb('0x3')](_0x287646,_0xed6be9);};}function removeListener(_0x80474a,_0x4bd341){return function(){UserProfileEvents[_0xc4bb('0x4')](_0x80474a,_0x4bd341);};}exports[_0xc4bb('0x5')]=function(_0x10f597){for(var _0x4bcffc=0x0,_0x1b82e7=events[_0xc4bb('0x6')];_0x4bcffc<_0x1b82e7;_0x4bcffc++){var _0x4c4cec=events[_0x4bcffc];var _0x5bb033=createListener('userProfile:'+_0x4c4cec,_0x10f597);UserProfileEvents['on'](_0x4c4cec,_0x5bb033);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 28bd75f..bef5567 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 _0x39a0=['put','/:id','update','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfileResource.controller','get','index','/describe','describe','isAuthenticated','show','post','create'];(function(_0x2dab20,_0x52ed85){var _0x462b05=function(_0x36608a){while(--_0x36608a){_0x2dab20['push'](_0x2dab20['shift']());}};_0x462b05(++_0x52ed85);}(_0x39a0,0xd6));var _0x039a=function(_0x256b75,_0x261162){_0x256b75=_0x256b75-0x0;var _0x5be390=_0x39a0[_0x256b75];return _0x5be390;};'use strict';var multer=require(_0x039a('0x0'));var util=require(_0x039a('0x1'));var path=require(_0x039a('0x2'));var timeout=require('connect-timeout');var express=require(_0x039a('0x3'));var router=express[_0x039a('0x4')]();var fs_extra=require(_0x039a('0x5'));var auth=require(_0x039a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x039a('0x7'));var controller=require(_0x039a('0x8'));router[_0x039a('0x9')]('/',auth['isAuthenticated'](),controller[_0x039a('0xa')]);router[_0x039a('0x9')](_0x039a('0xb'),auth['isAuthenticated'](),controller[_0x039a('0xc')]);router[_0x039a('0x9')]('/:id',auth[_0x039a('0xd')](),controller[_0x039a('0xe')]);router[_0x039a('0xf')]('/',auth[_0x039a('0xd')](),controller[_0x039a('0x10')]);router[_0x039a('0x11')](_0x039a('0x12'),auth['isAuthenticated'](),controller[_0x039a('0x13')]);router['delete'](_0x039a('0x12'),auth[_0x039a('0xd')](),controller[_0x039a('0x14')]);module['exports']=router; \ No newline at end of file +var _0x68fb=['./userProfileResource.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','delete','destroy','exports','util','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x5b8bb,_0xa85472){var _0x2d819c=function(_0x5725b6){while(--_0x5725b6){_0x5b8bb['push'](_0x5b8bb['shift']());}};_0x2d819c(++_0xa85472);}(_0x68fb,0x9d));var _0xb68f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x68fb[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xb68f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb68f('0x1')]();var fs_extra=require(_0xb68f('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xb68f('0x3'));var config=require(_0xb68f('0x4'));var controller=require(_0xb68f('0x5'));router[_0xb68f('0x6')]('/',auth['isAuthenticated'](),controller[_0xb68f('0x7')]);router[_0xb68f('0x6')](_0xb68f('0x8'),auth[_0xb68f('0x9')](),controller[_0xb68f('0xa')]);router[_0xb68f('0x6')](_0xb68f('0xb'),auth[_0xb68f('0x9')](),controller[_0xb68f('0xc')]);router[_0xb68f('0xd')]('/',auth[_0xb68f('0x9')](),controller[_0xb68f('0xe')]);router['put'](_0xb68f('0xb'),auth[_0xb68f('0x9')](),controller['update']);router[_0xb68f('0xf')](_0xb68f('0xb'),auth[_0xb68f('0x9')](),controller[_0xb68f('0x10')]);module[_0xb68f('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index a827e4c..0e12b17 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 _0xc6f3=['INTEGER','sequelize','exports','STRING'];(function(_0xb6afda,_0x55854e){var _0x8c25e3=function(_0x550be5){while(--_0x550be5){_0xb6afda['push'](_0xb6afda['shift']());}};_0x8c25e3(++_0x55854e);}(_0xc6f3,0x191));var _0x3c6f=function(_0x279bbc,_0x4857fb){_0x279bbc=_0x279bbc-0x0;var _0x527c92=_0xc6f3[_0x279bbc];return _0x527c92;};'use strict';var Sequelize=require(_0x3c6f('0x0'));module[_0x3c6f('0x1')]={'name':{'type':Sequelize[_0x3c6f('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x3c6f('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x44da=['exports','STRING','INTEGER','sequelize'];(function(_0x5b2c50,_0x4db66b){var _0x47f2f9=function(_0xef76e4){while(--_0xef76e4){_0x5b2c50['push'](_0x5b2c50['shift']());}};_0x47f2f9(++_0x4db66b);}(_0x44da,0xeb));var _0xa44d=function(_0x9bbd70,_0x53a9ca){_0x9bbd70=_0x9bbd70-0x0;var _0x5301bb=_0x44da[_0x9bbd70];return _0x5301bb;};'use strict';var Sequelize=require(_0xa44d('0x0'));module[_0xa44d('0x1')]={'name':{'type':Sequelize[_0xa44d('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xa44d('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xa44d('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index d999fea..bef70d6 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 _0xe2fe=['find','body','params','describe','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','name','send','index','map','UserProfileResource','rawAttributes','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show'];(function(_0x162f4b,_0x31b569){var _0x57b00b=function(_0xef34c9){while(--_0xef34c9){_0x162f4b['push'](_0x162f4b['shift']());}};_0x57b00b(++_0x31b569);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xee2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee2f('0x1'));var rp=require('request-promise');var moment=require(_0xee2f('0x2'));var BPromise=require(_0xee2f('0x3'));var Mustache=require(_0xee2f('0x4'));var util=require(_0xee2f('0x5'));var path=require(_0xee2f('0x6'));var sox=require('sox');var csv=require(_0xee2f('0x7'));var ejs=require(_0xee2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x7'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];function respondWithStatusCode(_0x346dbc,_0xa13e7b){_0xa13e7b=_0xa13e7b||0xcc;return function(_0x100449){if(_0x100449){return _0x346dbc[_0xee2f('0x11')](_0xa13e7b);}return _0x346dbc[_0xee2f('0x12')](_0xa13e7b)['end']();};}function respondWithResult(_0x3861e6,_0x531c3a){_0x531c3a=_0x531c3a||0xc8;return function(_0x36db10){if(_0x36db10){return _0x3861e6[_0xee2f('0x12')](_0x531c3a)['json'](_0x36db10);}};}function respondWithFilteredResult(_0x445ba8,_0x145241){return function(_0x28b614){if(_0x28b614){var _0x1bbf7d=typeof _0x145241[_0xee2f('0x13')]==='undefined'&&typeof _0x145241[_0xee2f('0x14')]==='undefined';var _0x17d288=_0x28b614[_0xee2f('0x15')];var _0x502eb6=_0x1bbf7d?0x0:_0x145241['offset'];var _0x40b5bc=_0x1bbf7d?_0x28b614['count']:_0x145241[_0xee2f('0x13')]+_0x145241[_0xee2f('0x14')];var _0x28549d;if(_0x40b5bc>=_0x17d288){_0x40b5bc=_0x17d288;_0x28549d=0xc8;}else{_0x28549d=0xce;}_0x445ba8['status'](_0x28549d);return _0x445ba8[_0xee2f('0x16')](_0xee2f('0x17'),_0x502eb6+'-'+_0x40b5bc+'/'+_0x17d288)[_0xee2f('0x18')](_0x28b614);}return null;};}function patchUpdates(_0x21fdf4){return function(_0x3d892d){try{jsonpatch['apply'](_0x3d892d,_0x21fdf4,!![]);}catch(_0x5e73ad){return BPromise[_0xee2f('0x19')](_0x5e73ad);}return _0x3d892d[_0xee2f('0x1a')]();};}function saveUpdates(_0x1ea808,_0x203b2f){return function(_0x472e3b){if(_0x472e3b){return _0x472e3b[_0xee2f('0x1b')](_0x1ea808)[_0xee2f('0x1c')](function(_0x4d68d3){return _0x4d68d3;});}return null;};}function removeEntity(_0x250399,_0x2c47c5){return function(_0x15ceda){if(_0x15ceda){return _0x15ceda[_0xee2f('0x1d')]()[_0xee2f('0x1c')](function(){_0x250399[_0xee2f('0x12')](0xcc)[_0xee2f('0x1e')]();});}};}function handleEntityNotFound(_0x13013f,_0x382174){return function(_0x1e394f){if(!_0x1e394f){_0x13013f[_0xee2f('0x11')](0x194);}return _0x1e394f;};}function handleError(_0x168adc,_0x1c8454){_0x1c8454=_0x1c8454||0x1f4;return function(_0x45c4a0){logger['error'](_0x45c4a0['stack']);if(_0x45c4a0['name']){delete _0x45c4a0[_0xee2f('0x1f')];}_0x168adc[_0xee2f('0x12')](_0x1c8454)[_0xee2f('0x20')](_0x45c4a0);};}exports[_0xee2f('0x21')]=function(_0x892a4e,_0x3737fd){var _0x4d8398={},_0x3d3806={},_0x52e1fa={'count':0x0,'rows':[]};var _0x235697=_[_0xee2f('0x22')](db[_0xee2f('0x23')][_0xee2f('0x24')],function(_0x3ddbe3){return{'name':_0x3ddbe3['fieldName'],'type':_0x3ddbe3[_0xee2f('0x25')][_0xee2f('0x26')]};});_0x3d3806['model']=_['map'](_0x235697,_0xee2f('0x1f'));_0x3d3806['query']=_[_0xee2f('0x27')](_0x892a4e[_0xee2f('0x28')]);_0x3d3806['filters']=_[_0xee2f('0x29')](_0x3d3806['model'],_0x3d3806['query']);_0x4d8398['attributes']=_[_0xee2f('0x29')](_0x3d3806[_0xee2f('0x2a')],qs['fields'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x2b')]));_0x4d8398[_0xee2f('0x2c')]=_0x4d8398[_0xee2f('0x2c')][_0xee2f('0x2d')]?_0x4d8398['attributes']:_0x3d3806[_0xee2f('0x2a')];if(!_0x892a4e['query'][_0xee2f('0x2e')](_0xee2f('0x2f'))){_0x4d8398[_0xee2f('0x14')]=qs['limit'](_0x892a4e[_0xee2f('0x28')]['limit']);_0x4d8398[_0xee2f('0x13')]=qs['offset'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x13')]);}_0x4d8398[_0xee2f('0x30')]=qs[_0xee2f('0x31')](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x31')]);_0x4d8398[_0xee2f('0x32')]=qs[_0xee2f('0x33')](_[_0xee2f('0x34')](_0x892a4e[_0xee2f('0x28')],_0x3d3806[_0xee2f('0x33')]),_0x235697);if(_0x892a4e['query'][_0xee2f('0x35')]){_0x4d8398['where']=_[_0xee2f('0x36')](_0x4d8398[_0xee2f('0x32')],{'$or':_[_0xee2f('0x22')](_0x235697,function(_0x2cbb89){if(_0x2cbb89[_0xee2f('0x25')]!==_0xee2f('0x37')){var _0x694950={};_0x694950[_0x2cbb89[_0xee2f('0x1f')]]={'$like':'%'+_0x892a4e['query']['filter']+'%'};return _0x694950;}})});}_0x4d8398=_['merge']({},_0x4d8398,_0x892a4e[_0xee2f('0x38')]);var _0x5483ae={'where':_0x4d8398[_0xee2f('0x32')]};return db['UserProfileResource']['count'](_0x5483ae)['then'](function(_0x58e361){_0x52e1fa[_0xee2f('0x15')]=_0x58e361;if(_0x892a4e[_0xee2f('0x28')][_0xee2f('0x39')]){_0x4d8398[_0xee2f('0x3a')]=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x4d8398);})[_0xee2f('0x1c')](function(_0x5e12b7){_0x52e1fa['rows']=_0x5e12b7;return _0x52e1fa;})[_0xee2f('0x1c')](respondWithFilteredResult(_0x3737fd,_0x4d8398))[_0xee2f('0x3b')](handleError(_0x3737fd,null));};exports[_0xee2f('0x3c')]=function(_0x54130b,_0x3bc173){var _0x27c447={'raw':![],'where':{'id':_0x54130b['params']['id']}},_0x19bd4d={};_0x19bd4d['model']=_[_0xee2f('0x27')](db[_0xee2f('0x23')][_0xee2f('0x24')]);_0x19bd4d[_0xee2f('0x28')]=_['keys'](_0x54130b[_0xee2f('0x28')]);_0x19bd4d[_0xee2f('0x33')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],_0x19bd4d[_0xee2f('0x28')]);_0x27c447[_0xee2f('0x2c')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],qs[_0xee2f('0x2b')](_0x54130b[_0xee2f('0x28')]['fields']));_0x27c447['attributes']=_0x27c447['attributes']['length']?_0x27c447[_0xee2f('0x2c')]:_0x19bd4d[_0xee2f('0x2a')];if(_0x54130b[_0xee2f('0x28')][_0xee2f('0x39')]){_0x27c447[_0xee2f('0x3a')]=[{'all':!![]}];}_0x27c447=_['merge']({},_0x27c447,_0x54130b[_0xee2f('0x38')]);return db[_0xee2f('0x23')][_0xee2f('0x3d')](_0x27c447)[_0xee2f('0x1c')](handleEntityNotFound(_0x3bc173,null))['then'](respondWithResult(_0x3bc173,null))['catch'](handleError(_0x3bc173,null));};exports['create']=function(_0x1609f0,_0x54cc44){return db['UserProfileResource']['create'](_0x1609f0['body'],{})[_0xee2f('0x1c')](respondWithResult(_0x54cc44,0xc9))[_0xee2f('0x3b')](handleError(_0x54cc44,null));};exports[_0xee2f('0x1b')]=function(_0x584383,_0x22506e){if(_0x584383['body']['id']){delete _0x584383[_0xee2f('0x3e')]['id'];}return db[_0xee2f('0x23')][_0xee2f('0x3d')]({'where':{'id':_0x584383[_0xee2f('0x3f')]['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x22506e,null))['then'](saveUpdates(_0x584383['body'],null))[_0xee2f('0x1c')](respondWithResult(_0x22506e,null))['catch'](handleError(_0x22506e,null));};exports[_0xee2f('0x1d')]=function(_0x282e89,_0x1928f8){return db[_0xee2f('0x23')]['find']({'where':{'id':_0x282e89['params']['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x1928f8,null))[_0xee2f('0x1c')](removeEntity(_0x1928f8,null))[_0xee2f('0x3b')](handleError(_0x1928f8,null));};exports[_0xee2f('0x40')]=function(_0x3acae6,_0x2a450f){return db[_0xee2f('0x23')][_0xee2f('0x40')]()[_0xee2f('0x1c')](respondWithResult(_0x2a450f,null))[_0xee2f('0x3b')](handleError(_0x2a450f,null));}; \ No newline at end of file +var _0x57ca=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','UserProfileResource','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','params','find','catch','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox'];(function(_0x412489,_0x4aa9e3){var _0x405e70=function(_0x28be29){while(--_0x28be29){_0x412489['push'](_0x412489['shift']());}};_0x405e70(++_0x4aa9e3);}(_0x57ca,0x108));var _0xa57c=function(_0x305598,_0x368e2a){_0x305598=_0x305598-0x0;var _0x5e1680=_0x57ca[_0x305598];return _0x5e1680;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa57c('0x0'));var zipdir=require(_0xa57c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa57c('0x2'));var moment=require(_0xa57c('0x3'));var BPromise=require(_0xa57c('0x4'));var Mustache=require(_0xa57c('0x5'));var util=require(_0xa57c('0x6'));var path=require('path');var sox=require(_0xa57c('0x7'));var csv=require(_0xa57c('0x8'));var ejs=require(_0xa57c('0x9'));var fs=require('fs');var fs_extra=require(_0xa57c('0xa'));var _=require(_0xa57c('0xb'));var squel=require(_0xa57c('0xc'));var crypto=require(_0xa57c('0xd'));var jsforce=require(_0xa57c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa57c('0x8'));var querystring=require('querystring');var Papa=require(_0xa57c('0xf'));var Redis=require(_0xa57c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa57c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa57c('0x12'));var logger=require(_0xa57c('0x13'))('api');var utils=require(_0xa57c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa57c('0x15'));var db=require(_0xa57c('0x16'))['db'];function respondWithStatusCode(_0x1f2bb5,_0x9e25bf){_0x9e25bf=_0x9e25bf||0xcc;return function(_0x205e72){if(_0x205e72){return _0x1f2bb5['sendStatus'](_0x9e25bf);}return _0x1f2bb5[_0xa57c('0x17')](_0x9e25bf)['end']();};}function respondWithResult(_0x30d23d,_0x3d5995){_0x3d5995=_0x3d5995||0xc8;return function(_0x30940d){if(_0x30940d){return _0x30d23d[_0xa57c('0x17')](_0x3d5995)[_0xa57c('0x18')](_0x30940d);}};}function respondWithFilteredResult(_0x37a323,_0x3f900a){return function(_0x4b4bdb){if(_0x4b4bdb){var _0x26607a=typeof _0x3f900a[_0xa57c('0x19')]===_0xa57c('0x1a')&&typeof _0x3f900a['limit']===_0xa57c('0x1a');var _0x5f33f1=_0x4b4bdb[_0xa57c('0x1b')];var _0x3d781d=_0x26607a?0x0:_0x3f900a[_0xa57c('0x19')];var _0xe3d505=_0x26607a?_0x4b4bdb[_0xa57c('0x1b')]:_0x3f900a[_0xa57c('0x19')]+_0x3f900a[_0xa57c('0x1c')];var _0x595c7a;if(_0xe3d505>=_0x5f33f1){_0xe3d505=_0x5f33f1;_0x595c7a=0xc8;}else{_0x595c7a=0xce;}_0x37a323['status'](_0x595c7a);return _0x37a323[_0xa57c('0x1d')]('Content-Range',_0x3d781d+'-'+_0xe3d505+'/'+_0x5f33f1)['json'](_0x4b4bdb);}return null;};}function patchUpdates(_0x418415){return function(_0xa5b314){try{jsonpatch[_0xa57c('0x1e')](_0xa5b314,_0x418415,!![]);}catch(_0x23bec0){return BPromise['reject'](_0x23bec0);}return _0xa5b314[_0xa57c('0x1f')]();};}function saveUpdates(_0x25715f,_0x34d1bc){return function(_0x2213b2){if(_0x2213b2){return _0x2213b2[_0xa57c('0x20')](_0x25715f)[_0xa57c('0x21')](function(_0x1e0192){return _0x1e0192;});}return null;};}function removeEntity(_0x42038e,_0x2e99ed){return function(_0xdf65dd){if(_0xdf65dd){return _0xdf65dd[_0xa57c('0x22')]()[_0xa57c('0x21')](function(){_0x42038e[_0xa57c('0x17')](0xcc)[_0xa57c('0x23')]();});}};}function handleEntityNotFound(_0x431bec,_0x511a26){return function(_0x2db443){if(!_0x2db443){_0x431bec[_0xa57c('0x24')](0x194);}return _0x2db443;};}function handleError(_0x27884d,_0x5228b9){_0x5228b9=_0x5228b9||0x1f4;return function(_0x315ad7){logger[_0xa57c('0x25')](_0x315ad7[_0xa57c('0x26')]);if(_0x315ad7[_0xa57c('0x27')]){delete _0x315ad7[_0xa57c('0x27')];}_0x27884d[_0xa57c('0x17')](_0x5228b9)['send'](_0x315ad7);};}exports[_0xa57c('0x28')]=function(_0x4c1478,_0x54a18b){var _0x257661={},_0x7d10ec={},_0x5a3e03={'count':0x0,'rows':[]};var _0x12898b=_[_0xa57c('0x29')](db[_0xa57c('0x2a')]['rawAttributes'],function(_0xd779f1){return{'name':_0xd779f1['fieldName'],'type':_0xd779f1[_0xa57c('0x2b')]['key']};});_0x7d10ec[_0xa57c('0x2c')]=_['map'](_0x12898b,_0xa57c('0x27'));_0x7d10ec['query']=_[_0xa57c('0x2d')](_0x4c1478[_0xa57c('0x2e')]);_0x7d10ec[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x7d10ec[_0xa57c('0x2c')],_0x7d10ec[_0xa57c('0x2e')]);_0x257661[_0xa57c('0x31')]=_['intersection'](_0x7d10ec[_0xa57c('0x2c')],qs['fields'](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x257661[_0xa57c('0x31')]=_0x257661['attributes'][_0xa57c('0x33')]?_0x257661['attributes']:_0x7d10ec[_0xa57c('0x2c')];if(!_0x4c1478['query'][_0xa57c('0x34')]('nolimit')){_0x257661[_0xa57c('0x1c')]=qs[_0xa57c('0x1c')](_0x4c1478['query'][_0xa57c('0x1c')]);_0x257661['offset']=qs[_0xa57c('0x19')](_0x4c1478['query'][_0xa57c('0x19')]);}_0x257661[_0xa57c('0x35')]=qs[_0xa57c('0x36')](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x36')]);_0x257661[_0xa57c('0x37')]=qs['filters'](_['pick'](_0x4c1478[_0xa57c('0x2e')],_0x7d10ec[_0xa57c('0x2f')]),_0x12898b);if(_0x4c1478[_0xa57c('0x2e')]['filter']){_0x257661[_0xa57c('0x37')]=_['merge'](_0x257661[_0xa57c('0x37')],{'$or':_[_0xa57c('0x29')](_0x12898b,function(_0x5c8256){if(_0x5c8256['type']!=='VIRTUAL'){var _0x3be888={};_0x3be888[_0x5c8256[_0xa57c('0x27')]]={'$like':'%'+_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x38')]+'%'};return _0x3be888;}})});}_0x257661=_[_0xa57c('0x39')]({},_0x257661,_0x4c1478[_0xa57c('0x3a')]);var _0x5a444a={'where':_0x257661[_0xa57c('0x37')]};return db[_0xa57c('0x2a')]['count'](_0x5a444a)['then'](function(_0x5e10b){_0x5a3e03[_0xa57c('0x1b')]=_0x5e10b;if(_0x4c1478['query'][_0xa57c('0x3b')]){_0x257661[_0xa57c('0x3c')]=[{'all':!![]}];}return db[_0xa57c('0x2a')][_0xa57c('0x3d')](_0x257661);})[_0xa57c('0x21')](function(_0x43c1d7){_0x5a3e03['rows']=_0x43c1d7;return _0x5a3e03;})[_0xa57c('0x21')](respondWithFilteredResult(_0x54a18b,_0x257661))['catch'](handleError(_0x54a18b,null));};exports['show']=function(_0x5b3300,_0x520383){var _0x588199={'raw':![],'where':{'id':_0x5b3300[_0xa57c('0x3e')]['id']}},_0x39b20f={};_0x39b20f[_0xa57c('0x2c')]=_['keys'](db['UserProfileResource']['rawAttributes']);_0x39b20f[_0xa57c('0x2e')]=_[_0xa57c('0x2d')](_0x5b3300[_0xa57c('0x2e')]);_0x39b20f[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],_0x39b20f['query']);_0x588199[_0xa57c('0x31')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],qs[_0xa57c('0x32')](_0x5b3300[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x588199['attributes']=_0x588199[_0xa57c('0x31')][_0xa57c('0x33')]?_0x588199[_0xa57c('0x31')]:_0x39b20f[_0xa57c('0x2c')];if(_0x5b3300[_0xa57c('0x2e')]['includeAll']){_0x588199[_0xa57c('0x3c')]=[{'all':!![]}];}_0x588199=_[_0xa57c('0x39')]({},_0x588199,_0x5b3300[_0xa57c('0x3a')]);return db[_0xa57c('0x2a')][_0xa57c('0x3f')](_0x588199)[_0xa57c('0x21')](handleEntityNotFound(_0x520383,null))['then'](respondWithResult(_0x520383,null))[_0xa57c('0x40')](handleError(_0x520383,null));};exports[_0xa57c('0x41')]=function(_0x247906,_0x44ea0a){return db[_0xa57c('0x2a')][_0xa57c('0x41')](_0x247906['body'],{})['then'](respondWithResult(_0x44ea0a,0xc9))['catch'](handleError(_0x44ea0a,null));};exports['update']=function(_0x232675,_0x49492f){if(_0x232675[_0xa57c('0x42')]['id']){delete _0x232675[_0xa57c('0x42')]['id'];}return db['UserProfileResource'][_0xa57c('0x3f')]({'where':{'id':_0x232675[_0xa57c('0x3e')]['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x49492f,null))[_0xa57c('0x21')](saveUpdates(_0x232675[_0xa57c('0x42')],null))['then'](respondWithResult(_0x49492f,null))[_0xa57c('0x40')](handleError(_0x49492f,null));};exports[_0xa57c('0x22')]=function(_0x4584e8,_0xd57bac){return db[_0xa57c('0x2a')]['find']({'where':{'id':_0x4584e8[_0xa57c('0x3e')]['id']}})['then'](handleEntityNotFound(_0xd57bac,null))['then'](removeEntity(_0xd57bac,null))[_0xa57c('0x40')](handleError(_0xd57bac,null));};exports[_0xa57c('0x43')]=function(_0x5ded49,_0x5bf336){return db['UserProfileResource'][_0xa57c('0x43')]()[_0xa57c('0x21')](respondWithResult(_0x5bf336,null))[_0xa57c('0x40')](handleError(_0x5bf336,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index a915b18..dd2ddc3 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 _0xe2b1=['api','moment','bluebird','request-promise','path','rimraf','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','../../config/logger'];(function(_0x2c8575,_0x2fb3c1){var _0x14982f=function(_0x310d00){while(--_0x310d00){_0x2c8575['push'](_0x2c8575['shift']());}};_0x14982f(++_0x2fb3c1);}(_0xe2b1,0x66));var _0x1e2b=function(_0x2e4d53,_0x409b7d){_0x2e4d53=_0x2e4d53-0x0;var _0x4fb6da=_0xe2b1[_0x2e4d53];return _0x4fb6da;};'use strict';var _=require(_0x1e2b('0x0'));var util=require('util');var logger=require(_0x1e2b('0x1'))(_0x1e2b('0x2'));var moment=require(_0x1e2b('0x3'));var BPromise=require(_0x1e2b('0x4'));var rp=require(_0x1e2b('0x5'));var fs=require('fs');var path=require(_0x1e2b('0x6'));var rimraf=require(_0x1e2b('0x7'));var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x1e6296,_0x4184a4){return _0x1e6296['define'](_0x1e2b('0x8'),attributes,{'tableName':_0x1e2b('0x9'),'paranoid':![],'indexes':[{'name':_0x1e2b('0xa'),'fields':[_0x1e2b('0xb'),_0x1e2b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0201=['request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','compositeIndex','resourceId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3fe440,_0x18d0cb){var _0x30cf95=function(_0x1f7af5){while(--_0x1f7af5){_0x3fe440['push'](_0x3fe440['shift']());}};_0x30cf95(++_0x18d0cb);}(_0x0201,0x72));var _0x1020=function(_0x1e1647,_0x377738){_0x1e1647=_0x1e1647-0x0;var _0x3acd39=_0x0201[_0x1e1647];return _0x3acd39;};'use strict';var _=require(_0x1020('0x0'));var util=require(_0x1020('0x1'));var logger=require(_0x1020('0x2'))(_0x1020('0x3'));var moment=require(_0x1020('0x4'));var BPromise=require(_0x1020('0x5'));var rp=require(_0x1020('0x6'));var fs=require('fs');var path=require(_0x1020('0x7'));var rimraf=require(_0x1020('0x8'));var config=require(_0x1020('0x9'));var attributes=require(_0x1020('0xa'));module[_0x1020('0xb')]=function(_0x183dc4,_0x40c922){return _0x183dc4[_0x1020('0xc')]('UserProfileResource',attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x1020('0xd'),'fields':[_0x1020('0xe'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index bc8840d..ab15760 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 _0xde60=['request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s'];(function(_0x16d64e,_0x227e07){var _0x2b30a2=function(_0x3522f4){while(--_0x3522f4){_0x16d64e['push'](_0x16d64e['shift']());}};_0x2b30a2(++_0x227e07);}(_0xde60,0xa4));var _0x0de6=function(_0x409b87,_0x5ef488){_0x409b87=_0x409b87-0x0;var _0x46fa68=_0xde60[_0x409b87];return _0x46fa68;};'use strict';var _=require(_0x0de6('0x0'));var util=require(_0x0de6('0x1'));var moment=require(_0x0de6('0x2'));var BPromise=require(_0x0de6('0x3'));var rs=require(_0x0de6('0x4'));var fs=require('fs');var Redis=require(_0x0de6('0x5'));var db=require(_0x0de6('0x6'))['db'];var utils=require(_0x0de6('0x7'));var logger=require(_0x0de6('0x8'))(_0x0de6('0x9'));var config=require(_0x0de6('0xa'));var jayson=require(_0x0de6('0xb'));var client=jayson[_0x0de6('0xc')][_0x0de6('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2b88be,_0x3d588d,_0x31c4cc){return new BPromise(function(_0x1221af,_0x28e13b){return client[_0x0de6('0xe')](_0x2b88be,_0x31c4cc)[_0x0de6('0xf')](function(_0x96bcf1){logger[_0x0de6('0x10')](_0x0de6('0x11'),_0x3d588d,_0x0de6('0x12'));logger[_0x0de6('0x13')](_0x0de6('0x14'),_0x3d588d,_0x0de6('0x12'),JSON[_0x0de6('0x15')](_0x96bcf1));if(_0x96bcf1[_0x0de6('0x16')]){if(_0x96bcf1['error'][_0x0de6('0x17')]===0x1f4){logger[_0x0de6('0x16')]('UserProfileResource,\x20%s,\x20%s',_0x3d588d,_0x96bcf1[_0x0de6('0x16')]['message']);return _0x28e13b(_0x96bcf1['error'][_0x0de6('0x18')]);}logger[_0x0de6('0x16')]('UserProfileResource,\x20%s,\x20%s',_0x3d588d,_0x96bcf1[_0x0de6('0x16')][_0x0de6('0x18')]);return _0x1221af(_0x96bcf1[_0x0de6('0x16')]['message']);}else{logger[_0x0de6('0x10')](_0x0de6('0x11'),_0x3d588d,_0x0de6('0x12'));_0x1221af(_0x96bcf1['result'][_0x0de6('0x18')]);}})[_0x0de6('0x19')](function(_0x41e096){logger[_0x0de6('0x16')](_0x0de6('0x11'),_0x3d588d,_0x41e096);_0x28e13b(_0x41e096);});});} \ No newline at end of file +var _0xd69b=['../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','UserProfileResource,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0xd69b,0x64));var _0xbd69=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xd69b[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0xbd69('0x0'));var util=require('util');var moment=require(_0xbd69('0x1'));var BPromise=require(_0xbd69('0x2'));var rs=require(_0xbd69('0x3'));var fs=require('fs');var Redis=require(_0xbd69('0x4'));var db=require(_0xbd69('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbd69('0x6'));var config=require(_0xbd69('0x7'));var jayson=require(_0xbd69('0x8'));var client=jayson[_0xbd69('0x9')][_0xbd69('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42540f,_0x528195,_0xa2f73d){return new BPromise(function(_0xfd2ac7,_0x550499){return client['request'](_0x42540f,_0xa2f73d)[_0xbd69('0xb')](function(_0x303ff4){logger[_0xbd69('0xc')]('UserProfileResource,\x20%s,\x20%s',_0x528195,_0xbd69('0xd'));logger[_0xbd69('0xe')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x528195,_0xbd69('0xd'),JSON[_0xbd69('0xf')](_0x303ff4));if(_0x303ff4[_0xbd69('0x10')]){if(_0x303ff4[_0xbd69('0x10')]['code']===0x1f4){logger[_0xbd69('0x10')](_0xbd69('0x11'),_0x528195,_0x303ff4[_0xbd69('0x10')][_0xbd69('0x12')]);return _0x550499(_0x303ff4[_0xbd69('0x10')][_0xbd69('0x12')]);}logger[_0xbd69('0x10')](_0xbd69('0x11'),_0x528195,_0x303ff4[_0xbd69('0x10')][_0xbd69('0x12')]);return _0xfd2ac7(_0x303ff4['error'][_0xbd69('0x12')]);}else{logger['info'](_0xbd69('0x11'),_0x528195,_0xbd69('0xd'));_0xfd2ac7(_0x303ff4[_0xbd69('0x13')]['message']);}})[_0xbd69('0x14')](function(_0x181f25){logger['error'](_0xbd69('0x11'),_0x528195,_0x181f25);_0x550499(_0x181f25);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index d601cbc..af04829 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 _0xec5e=['put','update','destroy','multer','path','express','fs-extra','../../components/auth/service','./userProfileSection.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x35fb56,_0x5dadff){var _0x2fd52c=function(_0x97bd3f){while(--_0x97bd3f){_0x35fb56['push'](_0x35fb56['shift']());}};_0x2fd52c(++_0x5dadff);}(_0xec5e,0x189));var _0xeec5=function(_0x2105ce,_0x247be1){_0x2105ce=_0x2105ce-0x0;var _0x2a8959=_0xec5e[_0x2105ce];return _0x2a8959;};'use strict';var multer=require(_0xeec5('0x0'));var util=require('util');var path=require(_0xeec5('0x1'));var timeout=require('connect-timeout');var express=require(_0xeec5('0x2'));var router=express['Router']();var fs_extra=require(_0xeec5('0x3'));var auth=require(_0xeec5('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xeec5('0x5'));router[_0xeec5('0x6')]('/',auth[_0xeec5('0x7')](),controller['index']);router[_0xeec5('0x6')](_0xeec5('0x8'),auth[_0xeec5('0x7')](),controller['describe']);router['get'](_0xeec5('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xeec5('0xa')]('/',auth[_0xeec5('0x7')](),controller[_0xeec5('0xb')]);router[_0xeec5('0xc')](_0xeec5('0x9'),auth[_0xeec5('0x7')](),controller[_0xeec5('0xd')]);router['delete'](_0xeec5('0x9'),auth[_0xeec5('0x7')](),controller[_0xeec5('0xe')]);module['exports']=router; \ No newline at end of file +var _0xe156=['get','isAuthenticated','index','/describe','describe','/:id','show','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0xe156,0x197));var _0x6e15=function(_0x273dc5,_0x268a81){_0x273dc5=_0x273dc5-0x0;var _0x46dae7=_0xe156[_0x273dc5];return _0x46dae7;};'use strict';var multer=require(_0x6e15('0x0'));var util=require(_0x6e15('0x1'));var path=require(_0x6e15('0x2'));var timeout=require(_0x6e15('0x3'));var express=require(_0x6e15('0x4'));var router=express[_0x6e15('0x5')]();var fs_extra=require(_0x6e15('0x6'));var auth=require(_0x6e15('0x7'));var interaction=require(_0x6e15('0x8'));var config=require(_0x6e15('0x9'));var controller=require(_0x6e15('0xa'));router[_0x6e15('0xb')]('/',auth[_0x6e15('0xc')](),controller[_0x6e15('0xd')]);router[_0x6e15('0xb')](_0x6e15('0xe'),auth['isAuthenticated'](),controller[_0x6e15('0xf')]);router[_0x6e15('0xb')](_0x6e15('0x10'),auth[_0x6e15('0xc')](),controller[_0x6e15('0x11')]);router['post']('/',auth[_0x6e15('0xc')](),controller[_0x6e15('0x12')]);router['put'](_0x6e15('0x10'),auth['isAuthenticated'](),controller[_0x6e15('0x13')]);router['delete'](_0x6e15('0x10'),auth['isAuthenticated'](),controller[_0x6e15('0x14')]);module[_0x6e15('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index d803bf0..51a32ca 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 _0xf45e=['INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','sequelize','STRING'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xf45e,0x115));var _0xef45=function(_0x12c7dd,_0x4d52f9){_0x12c7dd=_0x12c7dd-0x0;var _0x4c1b4b=_0xf45e[_0x12c7dd];return _0x4c1b4b;};'use strict';var Sequelize=require(_0xef45('0x0'));module['exports']={'name':{'type':Sequelize[_0xef45('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xef45('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xef45('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xef45('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xef45('0x1')],'set':function(_0x37772f){this[_0xef45('0x4')](_0xef45('0x5'),_0x37772f?_0x37772f[_0xef45('0x6')](''):[]);},'get':function(){return this[_0xef45('0x7')](_0xef45('0x5'))?this[_0xef45('0x7')](_0xef45('0x5'))[_0xef45('0x8')](''):[];}}}; \ No newline at end of file +var _0xeb74=['INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','sequelize','exports','STRING'];(function(_0x4044bd,_0x390ebf){var _0x46f00f=function(_0x887ee2){while(--_0x887ee2){_0x4044bd['push'](_0x4044bd['shift']());}};_0x46f00f(++_0x390ebf);}(_0xeb74,0xe3));var _0x4eb7=function(_0x26b23e,_0x133281){_0x26b23e=_0x26b23e-0x0;var _0x58d811=_0xeb74[_0x26b23e];return _0x58d811;};'use strict';var Sequelize=require(_0x4eb7('0x0'));module[_0x4eb7('0x1')]={'name':{'type':Sequelize[_0x4eb7('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x4eb7('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x4eb7('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x4eb7('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x4eb7('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x35c7ca){this[_0x4eb7('0x5')](_0x4eb7('0x6'),_0x35c7ca?_0x35c7ca[_0x4eb7('0x7')](''):[]);},'get':function(){return this[_0x4eb7('0x8')]('crudPermissions')?this[_0x4eb7('0x8')]('crudPermissions')[_0x4eb7('0x9')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index a1645f9..add0f34 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 _0x19ed=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','map','UserProfileSection','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','include','findAll','catch','show','params','rawAttributes','length','body','find','describe','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x4b0db6,_0xeb372c){var _0x313ee6=function(_0x37e514){while(--_0x37e514){_0x4b0db6['push'](_0x4b0db6['shift']());}};_0x313ee6(++_0xeb372c);}(_0x19ed,0xc5));var _0xd19e=function(_0x39909d,_0x11017e){_0x39909d=_0x39909d-0x0;var _0x2e9b17=_0x19ed[_0x39909d];return _0x2e9b17;};'use strict';var emlformat=require(_0xd19e('0x0'));var rimraf=require(_0xd19e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd19e('0x2'));var rp=require('request-promise');var moment=require(_0xd19e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd19e('0x4'));var util=require(_0xd19e('0x5'));var path=require(_0xd19e('0x6'));var sox=require(_0xd19e('0x7'));var csv=require(_0xd19e('0x8'));var ejs=require(_0xd19e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd19e('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd19e('0x8'));var querystring=require(_0xd19e('0xb'));var Papa=require(_0xd19e('0xc'));var Redis=require(_0xd19e('0xd'));var authService=require(_0xd19e('0xe'));var qs=require(_0xd19e('0xf'));var as=require(_0xd19e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd19e('0x11'))(_0xd19e('0x12'));var utils=require(_0xd19e('0x13'));var config=require(_0xd19e('0x14'));var licenseUtil=require(_0xd19e('0x15'));var db=require(_0xd19e('0x16'))['db'];function respondWithStatusCode(_0x158d1d,_0x5a21e1){_0x5a21e1=_0x5a21e1||0xcc;return function(_0x2bf969){if(_0x2bf969){return _0x158d1d['sendStatus'](_0x5a21e1);}return _0x158d1d[_0xd19e('0x17')](_0x5a21e1)[_0xd19e('0x18')]();};}function respondWithResult(_0x54b80c,_0x232854){_0x232854=_0x232854||0xc8;return function(_0x558c9d){if(_0x558c9d){return _0x54b80c[_0xd19e('0x17')](_0x232854)[_0xd19e('0x19')](_0x558c9d);}};}function respondWithFilteredResult(_0x3d8360,_0x315418){return function(_0x4e10fc){if(_0x4e10fc){var _0x3c6bb2=typeof _0x315418[_0xd19e('0x1a')]===_0xd19e('0x1b')&&typeof _0x315418['limit']==='undefined';var _0x3ab49e=_0x4e10fc['count'];var _0x5f3cd4=_0x3c6bb2?0x0:_0x315418[_0xd19e('0x1a')];var _0x45b581=_0x3c6bb2?_0x4e10fc[_0xd19e('0x1c')]:_0x315418[_0xd19e('0x1a')]+_0x315418[_0xd19e('0x1d')];var _0x47f9de;if(_0x45b581>=_0x3ab49e){_0x45b581=_0x3ab49e;_0x47f9de=0xc8;}else{_0x47f9de=0xce;}_0x3d8360['status'](_0x47f9de);return _0x3d8360[_0xd19e('0x1e')](_0xd19e('0x1f'),_0x5f3cd4+'-'+_0x45b581+'/'+_0x3ab49e)[_0xd19e('0x19')](_0x4e10fc);}return null;};}function patchUpdates(_0x242965){return function(_0x5001d8){try{jsonpatch[_0xd19e('0x20')](_0x5001d8,_0x242965,!![]);}catch(_0x57f977){return BPromise[_0xd19e('0x21')](_0x57f977);}return _0x5001d8[_0xd19e('0x22')]();};}function saveUpdates(_0x591cbb,_0x46a65d){return function(_0x315c17){if(_0x315c17){return _0x315c17[_0xd19e('0x23')](_0x591cbb)[_0xd19e('0x24')](function(_0x101a2d){return _0x101a2d;});}return null;};}function removeEntity(_0x443d79,_0x71af41){return function(_0x53fcd1){if(_0x53fcd1){return _0x53fcd1[_0xd19e('0x25')]()[_0xd19e('0x24')](function(){_0x443d79[_0xd19e('0x17')](0xcc)[_0xd19e('0x18')]();});}};}function handleEntityNotFound(_0x5b30ef,_0x28e59d){return function(_0x1f1086){if(!_0x1f1086){_0x5b30ef[_0xd19e('0x26')](0x194);}return _0x1f1086;};}function handleError(_0x56c942,_0x368d12){_0x368d12=_0x368d12||0x1f4;return function(_0x56960c){logger['error'](_0x56960c[_0xd19e('0x27')]);if(_0x56960c[_0xd19e('0x28')]){delete _0x56960c[_0xd19e('0x28')];}_0x56c942[_0xd19e('0x17')](_0x368d12)['send'](_0x56960c);};}exports[_0xd19e('0x29')]=function(_0x1edb98,_0x53d0e8){var _0x40b253={},_0x5e9979={},_0x3f425c={'count':0x0,'rows':[]};var _0x239b01=_[_0xd19e('0x2a')](db[_0xd19e('0x2b')]['rawAttributes'],function(_0x2e50f9){return{'name':_0x2e50f9[_0xd19e('0x2c')],'type':_0x2e50f9[_0xd19e('0x2d')][_0xd19e('0x2e')]};});_0x5e9979[_0xd19e('0x2f')]=_[_0xd19e('0x2a')](_0x239b01,_0xd19e('0x28'));_0x5e9979[_0xd19e('0x30')]=_[_0xd19e('0x31')](_0x1edb98[_0xd19e('0x30')]);_0x5e9979[_0xd19e('0x32')]=_[_0xd19e('0x33')](_0x5e9979[_0xd19e('0x2f')],_0x5e9979[_0xd19e('0x30')]);_0x40b253[_0xd19e('0x34')]=_[_0xd19e('0x33')](_0x5e9979[_0xd19e('0x2f')],qs[_0xd19e('0x35')](_0x1edb98['query'][_0xd19e('0x35')]));_0x40b253['attributes']=_0x40b253['attributes']['length']?_0x40b253[_0xd19e('0x34')]:_0x5e9979[_0xd19e('0x2f')];if(!_0x1edb98[_0xd19e('0x30')][_0xd19e('0x36')](_0xd19e('0x37'))){_0x40b253['limit']=qs[_0xd19e('0x1d')](_0x1edb98['query'][_0xd19e('0x1d')]);_0x40b253[_0xd19e('0x1a')]=qs['offset'](_0x1edb98[_0xd19e('0x30')]['offset']);}_0x40b253['order']=qs[_0xd19e('0x38')](_0x1edb98[_0xd19e('0x30')]['sort']);_0x40b253[_0xd19e('0x39')]=qs[_0xd19e('0x32')](_[_0xd19e('0x3a')](_0x1edb98[_0xd19e('0x30')],_0x5e9979[_0xd19e('0x32')]),_0x239b01);if(_0x1edb98['query']['filter']){_0x40b253[_0xd19e('0x39')]=_[_0xd19e('0x3b')](_0x40b253[_0xd19e('0x39')],{'$or':_[_0xd19e('0x2a')](_0x239b01,function(_0x2e3716){if(_0x2e3716[_0xd19e('0x2d')]!==_0xd19e('0x3c')){var _0x544509={};_0x544509[_0x2e3716['name']]={'$like':'%'+_0x1edb98[_0xd19e('0x30')]['filter']+'%'};return _0x544509;}})});}_0x40b253=_[_0xd19e('0x3b')]({},_0x40b253,_0x1edb98[_0xd19e('0x3d')]);var _0x3c45c0={'where':_0x40b253['where']};return db[_0xd19e('0x2b')][_0xd19e('0x1c')](_0x3c45c0)['then'](function(_0x57ecb8){_0x3f425c[_0xd19e('0x1c')]=_0x57ecb8;if(_0x1edb98['query']['includeAll']){_0x40b253[_0xd19e('0x3e')]=[{'all':!![]}];}return db[_0xd19e('0x2b')][_0xd19e('0x3f')](_0x40b253);})[_0xd19e('0x24')](function(_0x23a163){_0x3f425c['rows']=_0x23a163;return _0x3f425c;})[_0xd19e('0x24')](respondWithFilteredResult(_0x53d0e8,_0x40b253))[_0xd19e('0x40')](handleError(_0x53d0e8,null));};exports[_0xd19e('0x41')]=function(_0x30f02c,_0x2d9e82){var _0x79b11f={'raw':![],'where':{'id':_0x30f02c[_0xd19e('0x42')]['id']}},_0x9d0a74={};_0x9d0a74[_0xd19e('0x2f')]=_['keys'](db['UserProfileSection'][_0xd19e('0x43')]);_0x9d0a74['query']=_['keys'](_0x30f02c['query']);_0x9d0a74[_0xd19e('0x32')]=_['intersection'](_0x9d0a74[_0xd19e('0x2f')],_0x9d0a74[_0xd19e('0x30')]);_0x79b11f[_0xd19e('0x34')]=_[_0xd19e('0x33')](_0x9d0a74[_0xd19e('0x2f')],qs['fields'](_0x30f02c[_0xd19e('0x30')][_0xd19e('0x35')]));_0x79b11f[_0xd19e('0x34')]=_0x79b11f[_0xd19e('0x34')][_0xd19e('0x44')]?_0x79b11f[_0xd19e('0x34')]:_0x9d0a74['model'];if(_0x30f02c[_0xd19e('0x30')]['includeAll']){_0x79b11f['include']=[{'all':!![]}];}_0x79b11f=_[_0xd19e('0x3b')]({},_0x79b11f,_0x30f02c[_0xd19e('0x3d')]);return db[_0xd19e('0x2b')]['find'](_0x79b11f)[_0xd19e('0x24')](handleEntityNotFound(_0x2d9e82,null))['then'](respondWithResult(_0x2d9e82,null))[_0xd19e('0x40')](handleError(_0x2d9e82,null));};exports['create']=function(_0x11577b,_0xfa2683){return db['UserProfileSection']['create'](_0x11577b[_0xd19e('0x45')],{})['then'](respondWithResult(_0xfa2683,0xc9))[_0xd19e('0x40')](handleError(_0xfa2683,null));};exports[_0xd19e('0x23')]=function(_0x2bb368,_0x33ad4c){if(_0x2bb368[_0xd19e('0x45')]['id']){delete _0x2bb368[_0xd19e('0x45')]['id'];}return db[_0xd19e('0x2b')][_0xd19e('0x46')]({'where':{'id':_0x2bb368['params']['id']}})[_0xd19e('0x24')](handleEntityNotFound(_0x33ad4c,null))[_0xd19e('0x24')](saveUpdates(_0x2bb368[_0xd19e('0x45')],null))[_0xd19e('0x24')](respondWithResult(_0x33ad4c,null))['catch'](handleError(_0x33ad4c,null));};exports[_0xd19e('0x25')]=function(_0x38b8f6,_0x157aa9){return db[_0xd19e('0x2b')][_0xd19e('0x46')]({'where':{'id':_0x38b8f6[_0xd19e('0x42')]['id']}})[_0xd19e('0x24')](handleEntityNotFound(_0x157aa9,null))[_0xd19e('0x24')](removeEntity(_0x157aa9,null))['catch'](handleError(_0x157aa9,null));};exports['describe']=function(_0x399d12,_0x8bf387){return db[_0xd19e('0x2b')][_0xd19e('0x47')]()[_0xd19e('0x24')](respondWithResult(_0x8bf387,null))[_0xd19e('0x40')](handleError(_0x8bf387,null));}; \ No newline at end of file +var _0x83b6=['crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','index','map','UserProfileSection','rawAttributes','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','filters','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','params','include','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash'];(function(_0x2ea087,_0x17f324){var _0x23ebac=function(_0x5575d8){while(--_0x5575d8){_0x2ea087['push'](_0x2ea087['shift']());}};_0x23ebac(++_0x17f324);}(_0x83b6,0x83));var _0x683b=function(_0x24ec78,_0x5c40e5){_0x24ec78=_0x24ec78-0x0;var _0x297a11=_0x83b6[_0x24ec78];return _0x297a11;};'use strict';var emlformat=require(_0x683b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x683b('0x1'));var jsonpatch=require(_0x683b('0x2'));var rp=require(_0x683b('0x3'));var moment=require(_0x683b('0x4'));var BPromise=require(_0x683b('0x5'));var Mustache=require('mustache');var util=require(_0x683b('0x6'));var path=require('path');var sox=require(_0x683b('0x7'));var csv=require('to-csv');var ejs=require(_0x683b('0x8'));var fs=require('fs');var fs_extra=require(_0x683b('0x9'));var _=require(_0x683b('0xa'));var squel=require('squel');var crypto=require(_0x683b('0xb'));var jsforce=require(_0x683b('0xc'));var deskjs=require(_0x683b('0xd'));var toCsv=require(_0x683b('0xe'));var querystring=require(_0x683b('0xf'));var Papa=require('papaparse');var Redis=require(_0x683b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x683b('0x11'));var as=require(_0x683b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x683b('0x13'))(_0x683b('0x14'));var utils=require(_0x683b('0x15'));var config=require(_0x683b('0x16'));var licenseUtil=require(_0x683b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4af4fd,_0x376345){_0x376345=_0x376345||0xcc;return function(_0x5bba5a){if(_0x5bba5a){return _0x4af4fd['sendStatus'](_0x376345);}return _0x4af4fd[_0x683b('0x18')](_0x376345)[_0x683b('0x19')]();};}function respondWithResult(_0x3afaed,_0x32e0a6){_0x32e0a6=_0x32e0a6||0xc8;return function(_0x5dbeda){if(_0x5dbeda){return _0x3afaed[_0x683b('0x18')](_0x32e0a6)[_0x683b('0x1a')](_0x5dbeda);}};}function respondWithFilteredResult(_0x535bfd,_0x15f679){return function(_0x385791){if(_0x385791){var _0x252e99=typeof _0x15f679[_0x683b('0x1b')]==='undefined'&&typeof _0x15f679[_0x683b('0x1c')]===_0x683b('0x1d');var _0x338384=_0x385791[_0x683b('0x1e')];var _0x2a01e8=_0x252e99?0x0:_0x15f679[_0x683b('0x1b')];var _0x518188=_0x252e99?_0x385791[_0x683b('0x1e')]:_0x15f679[_0x683b('0x1b')]+_0x15f679[_0x683b('0x1c')];var _0x705988;if(_0x518188>=_0x338384){_0x518188=_0x338384;_0x705988=0xc8;}else{_0x705988=0xce;}_0x535bfd[_0x683b('0x18')](_0x705988);return _0x535bfd['set'](_0x683b('0x1f'),_0x2a01e8+'-'+_0x518188+'/'+_0x338384)[_0x683b('0x1a')](_0x385791);}return null;};}function patchUpdates(_0xf51c7b){return function(_0x1b6c13){try{jsonpatch[_0x683b('0x20')](_0x1b6c13,_0xf51c7b,!![]);}catch(_0x3fcfb0){return BPromise[_0x683b('0x21')](_0x3fcfb0);}return _0x1b6c13['save']();};}function saveUpdates(_0x3f16c5,_0x5696a7){return function(_0xb96967){if(_0xb96967){return _0xb96967[_0x683b('0x22')](_0x3f16c5)[_0x683b('0x23')](function(_0x2e2746){return _0x2e2746;});}return null;};}function removeEntity(_0x45a8ab,_0x2db209){return function(_0x3aa0b0){if(_0x3aa0b0){return _0x3aa0b0[_0x683b('0x24')]()[_0x683b('0x23')](function(){_0x45a8ab[_0x683b('0x18')](0xcc)[_0x683b('0x19')]();});}};}function handleEntityNotFound(_0x26369b,_0x309470){return function(_0x497044){if(!_0x497044){_0x26369b[_0x683b('0x25')](0x194);}return _0x497044;};}function handleError(_0x297b9c,_0xdef040){_0xdef040=_0xdef040||0x1f4;return function(_0x10ccde){logger[_0x683b('0x26')](_0x10ccde[_0x683b('0x27')]);if(_0x10ccde[_0x683b('0x28')]){delete _0x10ccde[_0x683b('0x28')];}_0x297b9c[_0x683b('0x18')](_0xdef040)['send'](_0x10ccde);};}exports[_0x683b('0x29')]=function(_0x33830a,_0x3dfca4){var _0x197de0={},_0x2da44e={},_0x13bce3={'count':0x0,'rows':[]};var _0x4dae71=_[_0x683b('0x2a')](db[_0x683b('0x2b')][_0x683b('0x2c')],function(_0xa7b1eb){return{'name':_0xa7b1eb['fieldName'],'type':_0xa7b1eb['type'][_0x683b('0x2d')]};});_0x2da44e['model']=_[_0x683b('0x2a')](_0x4dae71,'name');_0x2da44e[_0x683b('0x2e')]=_[_0x683b('0x2f')](_0x33830a[_0x683b('0x2e')]);_0x2da44e['filters']=_[_0x683b('0x30')](_0x2da44e[_0x683b('0x31')],_0x2da44e[_0x683b('0x2e')]);_0x197de0[_0x683b('0x32')]=_[_0x683b('0x30')](_0x2da44e[_0x683b('0x31')],qs[_0x683b('0x33')](_0x33830a[_0x683b('0x2e')][_0x683b('0x33')]));_0x197de0['attributes']=_0x197de0[_0x683b('0x32')]['length']?_0x197de0['attributes']:_0x2da44e['model'];if(!_0x33830a[_0x683b('0x2e')][_0x683b('0x34')](_0x683b('0x35'))){_0x197de0['limit']=qs['limit'](_0x33830a[_0x683b('0x2e')][_0x683b('0x1c')]);_0x197de0[_0x683b('0x1b')]=qs[_0x683b('0x1b')](_0x33830a['query'][_0x683b('0x1b')]);}_0x197de0['order']=qs['sort'](_0x33830a['query'][_0x683b('0x36')]);_0x197de0['where']=qs[_0x683b('0x37')](_['pick'](_0x33830a[_0x683b('0x2e')],_0x2da44e['filters']),_0x4dae71);if(_0x33830a[_0x683b('0x2e')][_0x683b('0x38')]){_0x197de0[_0x683b('0x39')]=_[_0x683b('0x3a')](_0x197de0[_0x683b('0x39')],{'$or':_['map'](_0x4dae71,function(_0x4c3922){if(_0x4c3922['type']!==_0x683b('0x3b')){var _0x370e0c={};_0x370e0c[_0x4c3922[_0x683b('0x28')]]={'$like':'%'+_0x33830a[_0x683b('0x2e')]['filter']+'%'};return _0x370e0c;}})});}_0x197de0=_[_0x683b('0x3a')]({},_0x197de0,_0x33830a[_0x683b('0x3c')]);var _0x42921e={'where':_0x197de0['where']};return db[_0x683b('0x2b')]['count'](_0x42921e)[_0x683b('0x23')](function(_0x3331ec){_0x13bce3[_0x683b('0x1e')]=_0x3331ec;if(_0x33830a[_0x683b('0x2e')]['includeAll']){_0x197de0['include']=[{'all':!![]}];}return db['UserProfileSection'][_0x683b('0x3d')](_0x197de0);})[_0x683b('0x23')](function(_0x240160){_0x13bce3[_0x683b('0x3e')]=_0x240160;return _0x13bce3;})[_0x683b('0x23')](respondWithFilteredResult(_0x3dfca4,_0x197de0))[_0x683b('0x3f')](handleError(_0x3dfca4,null));};exports[_0x683b('0x40')]=function(_0x5ee4e8,_0x1a0b28){var _0x5bea08={'raw':![],'where':{'id':_0x5ee4e8[_0x683b('0x41')]['id']}},_0x1d5cab={};_0x1d5cab[_0x683b('0x31')]=_[_0x683b('0x2f')](db[_0x683b('0x2b')][_0x683b('0x2c')]);_0x1d5cab[_0x683b('0x2e')]=_[_0x683b('0x2f')](_0x5ee4e8[_0x683b('0x2e')]);_0x1d5cab[_0x683b('0x37')]=_[_0x683b('0x30')](_0x1d5cab[_0x683b('0x31')],_0x1d5cab[_0x683b('0x2e')]);_0x5bea08['attributes']=_['intersection'](_0x1d5cab['model'],qs[_0x683b('0x33')](_0x5ee4e8[_0x683b('0x2e')][_0x683b('0x33')]));_0x5bea08[_0x683b('0x32')]=_0x5bea08[_0x683b('0x32')]['length']?_0x5bea08['attributes']:_0x1d5cab[_0x683b('0x31')];if(_0x5ee4e8['query']['includeAll']){_0x5bea08[_0x683b('0x42')]=[{'all':!![]}];}_0x5bea08=_[_0x683b('0x3a')]({},_0x5bea08,_0x5ee4e8[_0x683b('0x3c')]);return db[_0x683b('0x2b')][_0x683b('0x43')](_0x5bea08)[_0x683b('0x23')](handleEntityNotFound(_0x1a0b28,null))[_0x683b('0x23')](respondWithResult(_0x1a0b28,null))[_0x683b('0x3f')](handleError(_0x1a0b28,null));};exports[_0x683b('0x44')]=function(_0xf66cd6,_0x22c8e8){return db[_0x683b('0x2b')][_0x683b('0x44')](_0xf66cd6[_0x683b('0x45')],{})[_0x683b('0x23')](respondWithResult(_0x22c8e8,0xc9))[_0x683b('0x3f')](handleError(_0x22c8e8,null));};exports[_0x683b('0x22')]=function(_0x2fda57,_0x438f73){if(_0x2fda57[_0x683b('0x45')]['id']){delete _0x2fda57[_0x683b('0x45')]['id'];}return db[_0x683b('0x2b')][_0x683b('0x43')]({'where':{'id':_0x2fda57[_0x683b('0x41')]['id']}})[_0x683b('0x23')](handleEntityNotFound(_0x438f73,null))[_0x683b('0x23')](saveUpdates(_0x2fda57[_0x683b('0x45')],null))[_0x683b('0x23')](respondWithResult(_0x438f73,null))['catch'](handleError(_0x438f73,null));};exports[_0x683b('0x24')]=function(_0x10f972,_0x3d9a04){return db['UserProfileSection']['find']({'where':{'id':_0x10f972['params']['id']}})[_0x683b('0x23')](handleEntityNotFound(_0x3d9a04,null))['then'](removeEntity(_0x3d9a04,null))[_0x683b('0x3f')](handleError(_0x3d9a04,null));};exports[_0x683b('0x46')]=function(_0x28ec6b,_0x102694){return db[_0x683b('0x2b')][_0x683b('0x46')]()[_0x683b('0x23')](respondWithResult(_0x102694,null))['catch'](handleError(_0x102694,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index c85360a..45225da 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 _0x6ace=['compositeIndex','userProfileId','lodash','moment','request-promise','path','rimraf','../../config/environment','exports','UserProfileSection','user_profile_has_sections'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x6ace,0x18e));var _0xe6ac=function(_0x41273c,_0x4c0c04){_0x41273c=_0x41273c-0x0;var _0x453ce4=_0x6ace[_0x41273c];return _0x453ce4;};'use strict';var _=require(_0xe6ac('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe6ac('0x1'));var BPromise=require('bluebird');var rp=require(_0xe6ac('0x2'));var fs=require('fs');var path=require(_0xe6ac('0x3'));var rimraf=require(_0xe6ac('0x4'));var config=require(_0xe6ac('0x5'));var attributes=require('./userProfileSection.attributes');module[_0xe6ac('0x6')]=function(_0x2f5dc6,_0x5ab941){return _0x2f5dc6['define'](_0xe6ac('0x7'),attributes,{'tableName':_0xe6ac('0x8'),'paranoid':![],'indexes':[{'name':_0xe6ac('0x9'),'fields':['sectionId',_0xe6ac('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x06f1=['sectionId','userProfileId','lodash','util','../../config/logger','moment','request-promise','../../config/environment','./userProfileSection.attributes','exports','define','user_profile_has_sections'];(function(_0x443494,_0x51fc7e){var _0x4a6794=function(_0x15197a){while(--_0x15197a){_0x443494['push'](_0x443494['shift']());}};_0x4a6794(++_0x51fc7e);}(_0x06f1,0x6e));var _0x106f=function(_0x4f5bbb,_0x274491){_0x4f5bbb=_0x4f5bbb-0x0;var _0x38de06=_0x06f1[_0x4f5bbb];return _0x38de06;};'use strict';var _=require(_0x106f('0x0'));var util=require(_0x106f('0x1'));var logger=require(_0x106f('0x2'))('api');var moment=require(_0x106f('0x3'));var BPromise=require('bluebird');var rp=require(_0x106f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x106f('0x5'));var attributes=require(_0x106f('0x6'));module[_0x106f('0x7')]=function(_0x24f34d,_0x1d7e96){return _0x24f34d[_0x106f('0x8')]('UserProfileSection',attributes,{'tableName':_0x106f('0x9'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x106f('0xa'),_0x106f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 67fefc2..d64ad12 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 _0x3573=['info','UserProfileSection,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x330cc5,_0x147150){var _0x5b3ad9=function(_0x418fc7){while(--_0x418fc7){_0x330cc5['push'](_0x330cc5['shift']());}};_0x5b3ad9(++_0x147150);}(_0x3573,0x15e));var _0x3357=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3573[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3357('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3357('0x1'));var rs=require(_0x3357('0x2'));var fs=require('fs');var Redis=require(_0x3357('0x3'));var db=require(_0x3357('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3357('0x5'))(_0x3357('0x6'));var config=require('../../config/environment');var jayson=require(_0x3357('0x7'));var client=jayson[_0x3357('0x8')][_0x3357('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x595f70,_0xb49f1,_0x5763c1){return new BPromise(function(_0x275806,_0x3209a2){return client['request'](_0x595f70,_0x5763c1)['then'](function(_0x1e074c){logger[_0x3357('0xa')](_0x3357('0xb'),_0xb49f1,_0x3357('0xc'));logger['debug']('UserProfileSection,\x20%s,\x20%s,\x20%s',_0xb49f1,_0x3357('0xc'),JSON[_0x3357('0xd')](_0x1e074c));if(_0x1e074c['error']){if(_0x1e074c[_0x3357('0xe')]['code']===0x1f4){logger['error'](_0x3357('0xb'),_0xb49f1,_0x1e074c[_0x3357('0xe')]['message']);return _0x3209a2(_0x1e074c['error']['message']);}logger['error'](_0x3357('0xb'),_0xb49f1,_0x1e074c[_0x3357('0xe')]['message']);return _0x275806(_0x1e074c[_0x3357('0xe')][_0x3357('0xf')]);}else{logger[_0x3357('0xa')](_0x3357('0xb'),_0xb49f1,_0x3357('0xc'));_0x275806(_0x1e074c[_0x3357('0x10')][_0x3357('0xf')]);}})[_0x3357('0x11')](function(_0x4ec8de){logger[_0x3357('0xe')](_0x3357('0xb'),_0xb49f1,_0x4ec8de);_0x3209a2(_0x4ec8de);});});} \ No newline at end of file +var _0xdcd0=['UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','UserProfileSection,\x20%s,\x20%s','request\x20sent'];(function(_0x1aee39,_0x45ecc9){var _0x41c6c0=function(_0x27bbe9){while(--_0x27bbe9){_0x1aee39['push'](_0x1aee39['shift']());}};_0x41c6c0(++_0x45ecc9);}(_0xdcd0,0x1cf));var _0x0dcd=function(_0x287a14,_0x3c73c7){_0x287a14=_0x287a14-0x0;var _0x1b07a2=_0xdcd0[_0x287a14];return _0x1b07a2;};'use strict';var _=require(_0x0dcd('0x0'));var util=require(_0x0dcd('0x1'));var moment=require('moment');var BPromise=require(_0x0dcd('0x2'));var rs=require(_0x0dcd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0dcd('0x4'))['db'];var utils=require(_0x0dcd('0x5'));var logger=require(_0x0dcd('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0dcd('0x7'));var client=jayson[_0x0dcd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x508b05,_0x1c03fb,_0x59833c){return new BPromise(function(_0xedc12f,_0x27accf){return client[_0x0dcd('0x9')](_0x508b05,_0x59833c)['then'](function(_0x26cd0f){logger['info'](_0x0dcd('0xa'),_0x1c03fb,_0x0dcd('0xb'));logger['debug'](_0x0dcd('0xc'),_0x1c03fb,_0x0dcd('0xb'),JSON[_0x0dcd('0xd')](_0x26cd0f));if(_0x26cd0f[_0x0dcd('0xe')]){if(_0x26cd0f['error'][_0x0dcd('0xf')]===0x1f4){logger['error'](_0x0dcd('0xa'),_0x1c03fb,_0x26cd0f[_0x0dcd('0xe')][_0x0dcd('0x10')]);return _0x27accf(_0x26cd0f['error']['message']);}logger[_0x0dcd('0xe')](_0x0dcd('0xa'),_0x1c03fb,_0x26cd0f[_0x0dcd('0xe')]['message']);return _0xedc12f(_0x26cd0f['error'][_0x0dcd('0x10')]);}else{logger[_0x0dcd('0x11')](_0x0dcd('0xa'),_0x1c03fb,_0x0dcd('0xb'));_0xedc12f(_0x26cd0f[_0x0dcd('0x12')][_0x0dcd('0x10')]);}})['catch'](function(_0x10cccf){logger[_0x0dcd('0xe')](_0x0dcd('0xa'),_0x1c03fb,_0x10cccf);_0x27accf(_0x10cccf);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index f5a91e5..ba46d0a 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1119de,_0x523dda){var _0x1e4ba3=function(_0x274b1f){while(--_0x274b1f){_0x1119de['push'](_0x1119de['shift']());}};_0x1e4ba3(++_0x523dda);}(_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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x21727c,_0x5e29fa){var _0x4975e6=function(_0x5f3606){while(--_0x5f3606){_0x21727c['push'](_0x21727c['shift']());}};_0x4975e6(++_0x5e29fa);}(_0xedd9,0xfc));var _0x9edd=function(_0x4e7ed5,_0x3c76d8){_0x4e7ed5=_0x4e7ed5-0x0;var _0x502393=_0xedd9[_0x4e7ed5];return _0x502393;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 86bb84b..c953422 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 _0x8e81=['exports','INTEGER','sequelize'];(function(_0x1a40d7,_0x488ef5){var _0xf0a15b=function(_0x1f5f8f){while(--_0x1f5f8f){_0x1a40d7['push'](_0x1a40d7['shift']());}};_0xf0a15b(++_0x488ef5);}(_0x8e81,0x1d0));var _0x18e8=function(_0x39d161,_0x337944){_0x39d161=_0x39d161-0x0;var _0x57edae=_0x8e81[_0x39d161];return _0x57edae;};'use strict';var Sequelize=require(_0x18e8('0x0'));module[_0x18e8('0x1')]={'penalty':{'type':Sequelize[_0x18e8('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7989=['sequelize','exports','INTEGER'];(function(_0xbeb705,_0x1c9e72){var _0x4a0517=function(_0x47920b){while(--_0x47920b){_0xbeb705['push'](_0xbeb705['shift']());}};_0x4a0517(++_0x1c9e72);}(_0x7989,0x135));var _0x9798=function(_0x26a815,_0xcde2b9){_0x26a815=_0x26a815-0x0;var _0x539ed1=_0x7989[_0x26a815];return _0x539ed1;};'use strict';var Sequelize=require(_0x9798('0x0'));module[_0x9798('0x1')]={'penalty':{'type':Sequelize[_0x9798('0x2')],'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 a210db9..05483d0 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 _0x1261=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','define','user_has_sms_queues'];(function(_0x5ce5cf,_0x5f4d41){var _0x713a97=function(_0x16f53e){while(--_0x16f53e){_0x5ce5cf['push'](_0x5ce5cf['shift']());}};_0x713a97(++_0x5f4d41);}(_0x1261,0x144));var _0x1126=function(_0x23285f,_0x5529ce){_0x23285f=_0x23285f-0x0;var _0x1a5a34=_0x1261[_0x23285f];return _0x1a5a34;};'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')]('UserSmsQueue',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4351=['exports','define','user_has_sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes'];(function(_0x1d5400,_0x567e3c){var _0x21d9fe=function(_0x23fb75){while(--_0x23fb75){_0x1d5400['push'](_0x1d5400['shift']());}};_0x21d9fe(++_0x567e3c);}(_0x4351,0x1b5));var _0x1435=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x4351[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x1435('0x0'));var util=require(_0x1435('0x1'));var logger=require(_0x1435('0x2'))(_0x1435('0x3'));var moment=require(_0x1435('0x4'));var BPromise=require(_0x1435('0x5'));var rp=require(_0x1435('0x6'));var fs=require('fs');var path=require(_0x1435('0x7'));var rimraf=require(_0x1435('0x8'));var config=require(_0x1435('0x9'));var attributes=require(_0x1435('0xa'));module[_0x1435('0xb')]=function(_0x1f0838,_0x3a9f9a){return _0x1f0838[_0x1435('0xc')]('UserSmsQueue',attributes,{'tableName':_0x1435('0xd'),'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 88003b3..9c05ead 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 _0xd291=['info','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x15318f,_0x7114dc){var _0x159e91=function(_0x5a6515){while(--_0x5a6515){_0x15318f['push'](_0x15318f['shift']());}};_0x159e91(++_0x7114dc);}(_0xd291,0x1a6));var _0x1d29=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd291[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x1d29('0x0'));var moment=require(_0x1d29('0x1'));var BPromise=require(_0x1d29('0x2'));var rs=require(_0x1d29('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1d29('0x4'))['db'];var utils=require(_0x1d29('0x5'));var logger=require(_0x1d29('0x6'))(_0x1d29('0x7'));var config=require(_0x1d29('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1d29('0x9')][_0x1d29('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x348a84,_0x1cf6dd,_0x18f39f){return new BPromise(function(_0x459497,_0x5d5d2f){return client['request'](_0x348a84,_0x18f39f)[_0x1d29('0xb')](function(_0x43e750){logger['info'](_0x1d29('0xc'),_0x1cf6dd,_0x1d29('0xd'));logger[_0x1d29('0xe')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x1cf6dd,_0x1d29('0xd'),JSON[_0x1d29('0xf')](_0x43e750));if(_0x43e750[_0x1d29('0x10')]){if(_0x43e750[_0x1d29('0x10')][_0x1d29('0x11')]===0x1f4){logger[_0x1d29('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x1cf6dd,_0x43e750[_0x1d29('0x10')][_0x1d29('0x12')]);return _0x5d5d2f(_0x43e750[_0x1d29('0x10')]['message']);}logger['error'](_0x1d29('0xc'),_0x1cf6dd,_0x43e750[_0x1d29('0x10')][_0x1d29('0x12')]);return _0x459497(_0x43e750[_0x1d29('0x10')][_0x1d29('0x12')]);}else{logger[_0x1d29('0x13')](_0x1d29('0xc'),_0x1cf6dd,_0x1d29('0xd'));_0x459497(_0x43e750['result'][_0x1d29('0x12')]);}})[_0x1d29('0x14')](function(_0x269cec){logger[_0x1d29('0x10')](_0x1d29('0xc'),_0x1cf6dd,_0x269cec);_0x5d5d2f(_0x269cec);});});} \ No newline at end of file +var _0xac6a=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','request','then','info','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserSmsQueue,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac6a,0xa2));var _0xaac6=function(_0x57bb89,_0x2e6ba4){_0x57bb89=_0x57bb89-0x0;var _0x1dfe15=_0xac6a[_0x57bb89];return _0x1dfe15;};'use strict';var _=require(_0xaac6('0x0'));var util=require('util');var moment=require(_0xaac6('0x1'));var BPromise=require(_0xaac6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaac6('0x3'));var db=require(_0xaac6('0x4'))['db'];var utils=require(_0xaac6('0x5'));var logger=require('../../config/logger')(_0xaac6('0x6'));var config=require(_0xaac6('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x289411,_0x1093aa,_0x91069a){return new BPromise(function(_0x5d4e52,_0x1f48ec){return client[_0xaac6('0x8')](_0x289411,_0x91069a)[_0xaac6('0x9')](function(_0x46cd13){logger[_0xaac6('0xa')]('UserSmsQueue,\x20%s,\x20%s',_0x1093aa,'request\x20sent');logger[_0xaac6('0xb')](_0xaac6('0xc'),_0x1093aa,'request\x20sent',JSON[_0xaac6('0xd')](_0x46cd13));if(_0x46cd13['error']){if(_0x46cd13[_0xaac6('0xe')][_0xaac6('0xf')]===0x1f4){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x1093aa,_0x46cd13['error'][_0xaac6('0x10')]);return _0x1f48ec(_0x46cd13[_0xaac6('0xe')][_0xaac6('0x10')]);}logger[_0xaac6('0xe')](_0xaac6('0x11'),_0x1093aa,_0x46cd13[_0xaac6('0xe')][_0xaac6('0x10')]);return _0x5d4e52(_0x46cd13[_0xaac6('0xe')][_0xaac6('0x10')]);}else{logger[_0xaac6('0xa')](_0xaac6('0x11'),_0x1093aa,'request\x20sent');_0x5d4e52(_0x46cd13['result'][_0xaac6('0x10')]);}})['catch'](function(_0x555778){logger['error'](_0xaac6('0x11'),_0x1093aa,_0x555778);_0x1f48ec(_0x555778);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 212bf85..664f369 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 _0xd625=['exports','INTEGER','sequelize'];(function(_0x1626c8,_0x230ee0){var _0x83b481=function(_0x357f80){while(--_0x357f80){_0x1626c8['push'](_0x1626c8['shift']());}};_0x83b481(++_0x230ee0);}(_0xd625,0x170));var _0x5d62=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xd625[_0x40ac5e];return _0x2839d6;};'use strict';var Sequelize=require(_0x5d62('0x0'));module[_0x5d62('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x5d62('0x2')]}}; \ No newline at end of file +var _0xdd81=['INTEGER'];(function(_0x21c85e,_0x276d6c){var _0x592a7d=function(_0x33bb44){while(--_0x33bb44){_0x21c85e['push'](_0x21c85e['shift']());}};_0x592a7d(++_0x276d6c);}(_0xdd81,0x194));var _0x1dd8=function(_0x3761d2,_0x6dd230){_0x3761d2=_0x3761d2-0x0;var _0x364f46=_0xdd81[_0x3761d2];return _0x364f46;};'use strict';var Sequelize=require('sequelize');module['exports']={'UserId':{'type':Sequelize[_0x1dd8('0x0')]},'VoicePrefixId':{'type':Sequelize[_0x1dd8('0x0')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 9b8fc5a..2979410 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(_0x5666d7,_0x4e03e8){var _0x13cf18=function(_0x425f6c){while(--_0x425f6c){_0x5666d7['push'](_0x5666d7['shift']());}};_0x13cf18(++_0x4e03e8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x3bba94,_0x2a03da){var _0x22e9f4=function(_0x3aea59){while(--_0x3aea59){_0x3bba94['push'](_0x3bba94['shift']());}};_0x22e9f4(++_0x2a03da);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 164c3e2..84a0618 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x562faf,_0x102bcc){var _0x22c1f6=function(_0x2cd3b8){while(--_0x2cd3b8){_0x562faf['push'](_0x562faf['shift']());}};_0x22c1f6(++_0x102bcc);}(_0x9c44,0x178));var _0x49c4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9c44[_0x4b369d];return _0x571a98;};'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(_0x344179,_0xb1c8a7){var _0x38fb32=function(_0x601710){while(--_0x601710){_0x344179['push'](_0x344179['shift']());}};_0x38fb32(++_0xb1c8a7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 03dda7f..81036c2 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 _0xf22c=['INTEGER'];(function(_0x3a73f9,_0x5354a4){var _0x4af8bc=function(_0x3c14c9){while(--_0x3c14c9){_0x3a73f9['push'](_0x3a73f9['shift']());}};_0x4af8bc(++_0x5354a4);}(_0xf22c,0x19f));var _0xcf22=function(_0x359f64,_0x36f85a){_0x359f64=_0x359f64-0x0;var _0x27da7e=_0xf22c[_0x359f64];return _0x27da7e;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xcf22('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf69d=['INTEGER','sequelize','exports'];(function(_0x415ba5,_0x54bcc0){var _0x30423e=function(_0x2fbea7){while(--_0x2fbea7){_0x415ba5['push'](_0x415ba5['shift']());}};_0x30423e(++_0x54bcc0);}(_0xf69d,0xd3));var _0xdf69=function(_0x20b5e2,_0x8af880){_0x20b5e2=_0x20b5e2-0x0;var _0x57b1ab=_0xf69d[_0x20b5e2];return _0x57b1ab;};'use strict';var Sequelize=require(_0xdf69('0x0'));module[_0xdf69('0x1')]={'penalty':{'type':Sequelize[_0xdf69('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index d42f48f..c30cf38 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 _0x7406=['bluebird','path','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','../../config/logger','api','moment'];(function(_0xb6a98d,_0x456d90){var _0x25295e=function(_0x45dfa9){while(--_0x45dfa9){_0xb6a98d['push'](_0xb6a98d['shift']());}};_0x25295e(++_0x456d90);}(_0x7406,0x1bf));var _0x6740=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0x7406[_0x1762b4];return _0x29beda;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6740('0x0'))(_0x6740('0x1'));var moment=require(_0x6740('0x2'));var BPromise=require(_0x6740('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6740('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6740('0x5'));module[_0x6740('0x6')]=function(_0x7c02b2,_0x1d3fd3){return _0x7c02b2[_0x6740('0x7')](_0x6740('0x8'),attributes,{'tableName':_0x6740('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4997=['rimraf','../../config/environment','define','UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger','bluebird','request-promise','path'];(function(_0xed14ad,_0x242dcd){var _0x3ed9ea=function(_0xedf765){while(--_0xedf765){_0xed14ad['push'](_0xed14ad['shift']());}};_0x3ed9ea(++_0x242dcd);}(_0x4997,0xaf));var _0x7499=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4997[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7499('0x0'));var util=require('util');var logger=require(_0x7499('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7499('0x2'));var rp=require(_0x7499('0x3'));var fs=require('fs');var path=require(_0x7499('0x4'));var rimraf=require(_0x7499('0x5'));var config=require(_0x7499('0x6'));var attributes=require('./userVoiceQueue.attributes');module['exports']=function(_0x59eecd,_0x1c2e13){return _0x59eecd[_0x7499('0x7')](_0x7499('0x8'),attributes,{'tableName':_0x7499('0x9'),'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 a285fd8..6829ad1 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 _0xf029=['UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf029,0xb0));var _0x9f02=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xf029[_0x29d94e];return _0x106237;};'use strict';var _=require(_0x9f02('0x0'));var util=require(_0x9f02('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9f02('0x2'));var db=require(_0x9f02('0x3'))['db'];var utils=require(_0x9f02('0x4'));var logger=require(_0x9f02('0x5'))(_0x9f02('0x6'));var config=require(_0x9f02('0x7'));var jayson=require(_0x9f02('0x8'));var client=jayson[_0x9f02('0x9')][_0x9f02('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a2c17,_0x57aa59,_0x2bb81f){return new BPromise(function(_0x2584b3,_0x33491b){return client[_0x9f02('0xb')](_0x3a2c17,_0x2bb81f)[_0x9f02('0xc')](function(_0x5a4a5b){logger['info'](_0x9f02('0xd'),_0x57aa59,_0x9f02('0xe'));logger[_0x9f02('0xf')](_0x9f02('0x10'),_0x57aa59,_0x9f02('0xe'),JSON[_0x9f02('0x11')](_0x5a4a5b));if(_0x5a4a5b[_0x9f02('0x12')]){if(_0x5a4a5b['error'][_0x9f02('0x13')]===0x1f4){logger[_0x9f02('0x12')](_0x9f02('0xd'),_0x57aa59,_0x5a4a5b[_0x9f02('0x12')][_0x9f02('0x14')]);return _0x33491b(_0x5a4a5b[_0x9f02('0x12')][_0x9f02('0x14')]);}logger[_0x9f02('0x12')](_0x9f02('0xd'),_0x57aa59,_0x5a4a5b[_0x9f02('0x12')][_0x9f02('0x14')]);return _0x2584b3(_0x5a4a5b['error']['message']);}else{logger[_0x9f02('0x15')](_0x9f02('0xd'),_0x57aa59,'request\x20sent');_0x2584b3(_0x5a4a5b[_0x9f02('0x16')][_0x9f02('0x14')]);}})[_0x9f02('0x17')](function(_0x5501c6){logger[_0x9f02('0x12')](_0x9f02('0xd'),_0x57aa59,_0x5501c6);_0x33491b(_0x5501c6);});});} \ No newline at end of file +var _0x7c4e=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x7c4e,0x71));var _0xe7c4=function(_0x36c0f1,_0x38b1b2){_0x36c0f1=_0x36c0f1-0x0;var _0x5b375d=_0x7c4e[_0x36c0f1];return _0x5b375d;};'use strict';var _=require(_0xe7c4('0x0'));var util=require(_0xe7c4('0x1'));var moment=require(_0xe7c4('0x2'));var BPromise=require(_0xe7c4('0x3'));var rs=require(_0xe7c4('0x4'));var fs=require('fs');var Redis=require(_0xe7c4('0x5'));var db=require(_0xe7c4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe7c4('0x7'))(_0xe7c4('0x8'));var config=require(_0xe7c4('0x9'));var jayson=require(_0xe7c4('0xa'));var client=jayson[_0xe7c4('0xb')][_0xe7c4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x693730,_0x1a050b,_0x275604){return new BPromise(function(_0x274d35,_0x71bcc7){return client['request'](_0x693730,_0x275604)[_0xe7c4('0xd')](function(_0xe1ab2b){logger['info'](_0xe7c4('0xe'),_0x1a050b,_0xe7c4('0xf'));logger[_0xe7c4('0x10')](_0xe7c4('0x11'),_0x1a050b,_0xe7c4('0xf'),JSON['stringify'](_0xe1ab2b));if(_0xe1ab2b[_0xe7c4('0x12')]){if(_0xe1ab2b[_0xe7c4('0x12')][_0xe7c4('0x13')]===0x1f4){logger[_0xe7c4('0x12')](_0xe7c4('0xe'),_0x1a050b,_0xe1ab2b[_0xe7c4('0x12')][_0xe7c4('0x14')]);return _0x71bcc7(_0xe1ab2b[_0xe7c4('0x12')]['message']);}logger[_0xe7c4('0x12')](_0xe7c4('0xe'),_0x1a050b,_0xe1ab2b[_0xe7c4('0x12')][_0xe7c4('0x14')]);return _0x274d35(_0xe1ab2b['error']['message']);}else{logger['info'](_0xe7c4('0xe'),_0x1a050b,_0xe7c4('0xf'));_0x274d35(_0xe1ab2b[_0xe7c4('0x15')]['message']);}})[_0xe7c4('0x16')](function(_0x13acca){logger[_0xe7c4('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x1a050b,_0x13acca);_0x71bcc7(_0x13acca);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 8c5fa7e..ba9f852 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5ea51f,_0x1e3a5b){var _0x28f6ab=function(_0x3bb09f){while(--_0x3bb09f){_0x5ea51f['push'](_0x5ea51f['shift']());}};_0x28f6ab(++_0x1e3a5b);}(_0x9c44,0x178));var _0x49c4=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x9c44[_0x2d2c16];return _0x53f2fb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x48d35a,_0xaa12ec){var _0x4ac414=function(_0x2b97bb){while(--_0x2b97bb){_0x48d35a['push'](_0x48d35a['shift']());}};_0x4ac414(++_0xaa12ec);}(_0xe706,0xa3));var _0x6e70=function(_0x282a1f,_0x49a6ef){_0x282a1f=_0x282a1f-0x0;var _0x296ea7=_0xe706[_0x282a1f];return _0x296ea7;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 5597183..6b83b72 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 _0xf00d=['Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports','INTEGER'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xf00d,0x195));var _0xdf00=function(_0x34334a,_0x50d451){_0x34334a=_0x34334a-0x0;var _0x4c497a=_0xf00d[_0x34334a];return _0x4c497a;};'use strict';var Sequelize=require(_0xdf00('0x0'));module[_0xdf00('0x1')]={'uniqueid':{'type':Sequelize[_0xdf00('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xdf00('0x3')},'membername':{'type':Sequelize[_0xdf00('0x4')],'allowNull':![],'comment':_0xdf00('0x3')},'UserId':{'type':Sequelize[_0xdf00('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xdf00('0x4')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xdf00('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xdf00('0x3')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xdf00('0x3')}}; \ No newline at end of file +var _0xde81=['queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xde81,0x109));var _0x1de8=function(_0x26ede6,_0x21d559){_0x26ede6=_0x26ede6-0x0;var _0x3e7207=_0xde81[_0x26ede6];return _0x3e7207;};'use strict';var Sequelize=require(_0x1de8('0x0'));module[_0x1de8('0x1')]={'uniqueid':{'type':Sequelize[_0x1de8('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x1de8('0x3')},'membername':{'type':Sequelize[_0x1de8('0x4')],'allowNull':![],'comment':_0x1de8('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1de8('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x1de8('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x1de8('0x4')],'allowNull':![],'unique':_0x1de8('0x5'),'comment':_0x1de8('0x3')},'penalty':{'type':Sequelize[_0x1de8('0x2')](0xb),'defaultValue':0x0,'comment':_0x1de8('0x3')},'paused':{'type':Sequelize[_0x1de8('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index ac87173..2c5624e 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 _0x6d59=['UserVoiceQueueRt','setMaxListeners','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x2b2857,_0x328e5a){var _0x215d52=function(_0x8f200b){while(--_0x8f200b){_0x2b2857['push'](_0x2b2857['shift']());}};_0x215d52(++_0x328e5a);}(_0x6d59,0x97));var _0x96d5=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x6d59[_0x4b369d];return _0x571a98;};'use strict';var EventEmitter=require(_0x96d5('0x0'));var UserVoiceQueueRt=require(_0x96d5('0x1'))['db'][_0x96d5('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x96d5('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x96d5('0x4'),'afterDestroy':_0x96d5('0x5')};function emitEvent(_0x557d6d){return function(_0x6c2946,_0x3221d6,_0x199eff){UserVoiceQueueRtEvents[_0x96d5('0x6')](_0x557d6d+':'+_0x6c2946['id'],_0x6c2946);UserVoiceQueueRtEvents[_0x96d5('0x6')](_0x557d6d,_0x6c2946);_0x199eff(null);};}for(var e in events){if(events[_0x96d5('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x96d5('0x8')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x5916=['../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x47a1b3,_0xb3e083){var _0x13c068=function(_0x3541e1){while(--_0x3541e1){_0x47a1b3['push'](_0x47a1b3['shift']());}};_0x13c068(++_0xb3e083);}(_0x5916,0x1dc));var _0x6591=function(_0xa95c99,_0x109c0e){_0xa95c99=_0xa95c99-0x0;var _0x5a457e=_0x5916[_0xa95c99];return _0x5a457e;};'use strict';var EventEmitter=require(_0x6591('0x0'));var UserVoiceQueueRt=require(_0x6591('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x6591('0x2')](0x0);var events={'afterCreate':_0x6591('0x3'),'afterUpdate':_0x6591('0x4'),'afterDestroy':'remove'};function emitEvent(_0x57b1df){return function(_0x50628f,_0x31b8c8,_0x4154ab){UserVoiceQueueRtEvents['emit'](_0x57b1df+':'+_0x50628f['id'],_0x50628f);UserVoiceQueueRtEvents[_0x6591('0x5')](_0x57b1df,_0x50628f);_0x4154ab(null);};}for(var e in events){if(events[_0x6591('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x6591('0x7')](e,emitEvent(event));}}module[_0x6591('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 0638f44..8df4a58 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 _0xcafb=['user_has_voice_queues_rt','util','api','bluebird','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0xcafb,0x1d5));var _0xbcaf=function(_0x39a315,_0x521ba8){_0x39a315=_0x39a315-0x0;var _0x45fb9f=_0xcafb[_0x39a315];return _0x45fb9f;};'use strict';var _=require('lodash');var util=require(_0xbcaf('0x0'));var logger=require('../../config/logger')(_0xbcaf('0x1'));var moment=require('moment');var BPromise=require(_0xbcaf('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbcaf('0x3'));var config=require(_0xbcaf('0x4'));var attributes=require(_0xbcaf('0x5'));module[_0xbcaf('0x6')]=function(_0x47751e,_0x3f6ae8){return _0x47751e['define'](_0xbcaf('0x7'),attributes,{'tableName':_0xbcaf('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d84=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','user_has_voice_queues_rt','lodash'];(function(_0x183acc,_0x3db18c){var _0xd06c1e=function(_0x5c2a6d){while(--_0x5c2a6d){_0x183acc['push'](_0x183acc['shift']());}};_0xd06c1e(++_0x3db18c);}(_0x9d84,0xd7));var _0x49d8=function(_0x3bab8d,_0xfa8364){_0x3bab8d=_0x3bab8d-0x0;var _0x19eba5=_0x9d84[_0x3bab8d];return _0x19eba5;};'use strict';var _=require(_0x49d8('0x0'));var util=require(_0x49d8('0x1'));var logger=require(_0x49d8('0x2'))(_0x49d8('0x3'));var moment=require(_0x49d8('0x4'));var BPromise=require(_0x49d8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x49d8('0x6'));var config=require(_0x49d8('0x7'));var attributes=require(_0x49d8('0x8'));module[_0x49d8('0x9')]=function(_0x516f51,_0x2bff51){return _0x516f51[_0x49d8('0xa')]('UserVoiceQueueRt',attributes,{'tableName':_0x49d8('0xb'),'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 deeb9ee..aafedbd 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 _0x9a6f=['COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','stringify','util','moment','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults','localhost','socket.io-emitter','redis','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','UserVoiceQueueRt','options','sequelize'];(function(_0x5abbca,_0x595973){var _0x1a31c7=function(_0x3430ec){while(--_0x3430ec){_0x5abbca['push'](_0x5abbca['shift']());}};_0x1a31c7(++_0x595973);}(_0x9a6f,0x1a6));var _0xf9a6=function(_0xf61129,_0x523668){_0xf61129=_0xf61129-0x0;var _0xefa38a=_0x9a6f[_0xf61129];return _0xefa38a;};'use strict';var _=require('lodash');var util=require(_0xf9a6('0x0'));var moment=require(_0xf9a6('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(_0xf9a6('0x2'));var logger=require(_0xf9a6('0x3'))(_0xf9a6('0x4'));var config=require(_0xf9a6('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf9a6('0x6')]({'port':0x232a});config['redis']=_[_0xf9a6('0x7')](config['redis'],{'host':_0xf9a6('0x8'),'port':0x18eb});var socket=require(_0xf9a6('0x9'))(new Redis(config[_0xf9a6('0xa')]));require(_0xf9a6('0xb'))[_0xf9a6('0xc')](socket);function respondWithRpcPromise(_0x4645af,_0x200cd6,_0x5e4149){return new BPromise(function(_0x414061,_0xdceeb7){return client[_0xf9a6('0xd')](_0x4645af,_0x5e4149)[_0xf9a6('0xe')](function(_0x49df7a){logger[_0xf9a6('0xf')](_0xf9a6('0x10'),_0x200cd6,_0xf9a6('0x11'));logger[_0xf9a6('0x12')](_0xf9a6('0x13'),_0x200cd6,_0xf9a6('0x11'),JSON['stringify'](_0x49df7a));if(_0x49df7a[_0xf9a6('0x14')]){if(_0x49df7a[_0xf9a6('0x14')][_0xf9a6('0x15')]===0x1f4){logger[_0xf9a6('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x200cd6,_0x49df7a[_0xf9a6('0x14')]['message']);return _0xdceeb7(_0x49df7a[_0xf9a6('0x14')]['message']);}logger[_0xf9a6('0x14')](_0xf9a6('0x10'),_0x200cd6,_0x49df7a[_0xf9a6('0x14')][_0xf9a6('0x16')]);return _0x414061(_0x49df7a[_0xf9a6('0x14')][_0xf9a6('0x16')]);}else{logger[_0xf9a6('0xf')](_0xf9a6('0x10'),_0x200cd6,_0xf9a6('0x11'));_0x414061(_0x49df7a['result']['message']);}})['catch'](function(_0xa3e991){logger['error'](_0xf9a6('0x10'),_0x200cd6,_0xa3e991);_0xdceeb7(_0xa3e991);});});}exports['GetVoiceQueueRtPauses']=function(_0x25ba03){var _0x333db7=this;return new Promise(function(_0x5b56c3,_0x838577){return db[_0xf9a6('0x17')]['findAll']({'raw':_0x25ba03['options']?_0x25ba03[_0xf9a6('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x25ba03[_0xf9a6('0x18')]?_0x25ba03[_0xf9a6('0x18')]['where']||null:null,'attributes':[[db[_0xf9a6('0x19')]['fn'](_0xf9a6('0x1a'),db[_0xf9a6('0x19')]['fn']('IF',db[_0xf9a6('0x19')][_0xf9a6('0x1b')](_0xf9a6('0x1c')))),_0xf9a6('0x1d')]]})[_0xf9a6('0xe')](function(_0xeca072){logger['info'](_0xf9a6('0x1e'),_0x25ba03);logger[_0xf9a6('0x12')]('GetVoiceQueueRtPauses',_0x25ba03,JSON[_0xf9a6('0x1f')](_0xeca072));_0x5b56c3(_0xeca072);})['catch'](function(_0x10da80){logger[_0xf9a6('0x14')](_0xf9a6('0x1e'),_0x10da80[_0xf9a6('0x16')],_0x25ba03);_0x838577(_0x333db7[_0xf9a6('0x14')](0x1f4,_0x10da80[_0xf9a6('0x16')]));});});}; \ No newline at end of file +var _0x9958=['catch','GetVoiceQueueRtPauses','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info'];(function(_0x2e2681,_0x4089c1){var _0x368a64=function(_0x267262){while(--_0x267262){_0x2e2681['push'](_0x2e2681['shift']());}};_0x368a64(++_0x4089c1);}(_0x9958,0x1c8));var _0x8995=function(_0x206a7d,_0x37b18f){_0x206a7d=_0x206a7d-0x0;var _0x5e442f=_0x9958[_0x206a7d];return _0x5e442f;};'use strict';var _=require(_0x8995('0x0'));var util=require(_0x8995('0x1'));var moment=require(_0x8995('0x2'));var BPromise=require(_0x8995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8995('0x4'));var db=require(_0x8995('0x5'))['db'];var utils=require(_0x8995('0x6'));var logger=require('../../config/logger')(_0x8995('0x7'));var config=require('../../config/environment');var jayson=require(_0x8995('0x8'));var client=jayson[_0x8995('0x9')][_0x8995('0xa')]({'port':0x232a});config[_0x8995('0xb')]=_['defaults'](config['redis'],{'host':_0x8995('0xc'),'port':0x18eb});var socket=require(_0x8995('0xd'))(new Redis(config[_0x8995('0xb')]));require(_0x8995('0xe'))[_0x8995('0xf')](socket);function respondWithRpcPromise(_0x302452,_0x589aa0,_0x2431dd){return new BPromise(function(_0x381e52,_0x5b8420){return client[_0x8995('0x10')](_0x302452,_0x2431dd)['then'](function(_0x2d2742){logger['info'](_0x8995('0x11'),_0x589aa0,_0x8995('0x12'));logger['debug'](_0x8995('0x13'),_0x589aa0,'request\x20sent',JSON[_0x8995('0x14')](_0x2d2742));if(_0x2d2742['error']){if(_0x2d2742['error'][_0x8995('0x15')]===0x1f4){logger[_0x8995('0x16')](_0x8995('0x11'),_0x589aa0,_0x2d2742[_0x8995('0x16')][_0x8995('0x17')]);return _0x5b8420(_0x2d2742['error']['message']);}logger[_0x8995('0x16')](_0x8995('0x11'),_0x589aa0,_0x2d2742[_0x8995('0x16')][_0x8995('0x17')]);return _0x381e52(_0x2d2742[_0x8995('0x16')][_0x8995('0x17')]);}else{logger[_0x8995('0x18')](_0x8995('0x11'),_0x589aa0,_0x8995('0x12'));_0x381e52(_0x2d2742['result'][_0x8995('0x17')]);}})[_0x8995('0x19')](function(_0x3c48ce){logger[_0x8995('0x16')](_0x8995('0x11'),_0x589aa0,_0x3c48ce);_0x5b8420(_0x3c48ce);});});}exports[_0x8995('0x1a')]=function(_0x41e8e9){var _0x70248f=this;return new Promise(function(_0x1d4b4b,_0x4c026d){return db['UserVoiceQueueRt'][_0x8995('0x1b')]({'raw':_0x41e8e9[_0x8995('0x1c')]?_0x41e8e9[_0x8995('0x1c')][_0x8995('0x1d')]===undefined?!![]:![]:!![],'where':_0x41e8e9[_0x8995('0x1c')]?_0x41e8e9['options'][_0x8995('0x1e')]||null:null,'attributes':[[db[_0x8995('0x1f')]['fn'](_0x8995('0x20'),db[_0x8995('0x1f')]['fn']('IF',db['sequelize'][_0x8995('0x21')](_0x8995('0x22')))),_0x8995('0x23')]]})[_0x8995('0x24')](function(_0x41d96f){logger[_0x8995('0x18')](_0x8995('0x1a'),_0x41e8e9);logger['debug']('GetVoiceQueueRtPauses',_0x41e8e9,JSON['stringify'](_0x41d96f));_0x1d4b4b(_0x41d96f);})[_0x8995('0x19')](function(_0x53f0cc){logger[_0x8995('0x16')]('GetVoiceQueueRtPauses',_0x53f0cc[_0x8995('0x17')],_0x41e8e9);_0x4c026d(_0x70248f[_0x8995('0x16')](0x1f4,_0x53f0cc['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index c8c7f37..2e78915 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 _0x31af=['remove','emit','removeListener','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x5ce786,_0xc111){var _0x1ee460=function(_0x200dc2){while(--_0x200dc2){_0x5ce786['push'](_0x5ce786['shift']());}};_0x1ee460(++_0xc111);}(_0x31af,0xde));var _0xf31a=function(_0xde001,_0xe7b70e){_0xde001=_0xde001-0x0;var _0xa4d114=_0x31af[_0xde001];return _0xa4d114;};'use strict';var UserVoiceQueueRtEvents=require(_0xf31a('0x0'));var events=[_0xf31a('0x1'),_0xf31a('0x2'),'update'];function createListener(_0x5f5639,_0x4596f6){return function(_0x4a8ef1){_0x4596f6[_0xf31a('0x3')](_0x5f5639,_0x4a8ef1);};}function removeListener(_0x1853d7,_0x820362){return function(){UserVoiceQueueRtEvents[_0xf31a('0x4')](_0x1853d7,_0x820362);};}exports['register']=function(_0x8d7853){for(var _0x209fcc=0x0,_0x405926=events[_0xf31a('0x5')];_0x209fcc<_0x405926;_0x209fcc++){var _0x47b7a1=events[_0x209fcc];var _0x31f8e7=createListener(_0xf31a('0x6')+_0x47b7a1,_0x8d7853);UserVoiceQueueRtEvents['on'](_0x47b7a1,_0x31f8e7);}}; \ No newline at end of file +var _0xc812=['removeListener','length','./userVoiceQueueRt.events','save','remove','emit'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xc812,0xbc));var _0x2c81=function(_0x113e50,_0x95aac){_0x113e50=_0x113e50-0x0;var _0x3df86d=_0xc812[_0x113e50];return _0x3df86d;};'use strict';var UserVoiceQueueRtEvents=require(_0x2c81('0x0'));var events=[_0x2c81('0x1'),_0x2c81('0x2'),'update'];function createListener(_0x143b6d,_0x14e77c){return function(_0x27a149){_0x14e77c[_0x2c81('0x3')](_0x143b6d,_0x27a149);};}function removeListener(_0x5b0772,_0x9ad923){return function(){UserVoiceQueueRtEvents[_0x2c81('0x4')](_0x5b0772,_0x9ad923);};}exports['register']=function(_0x209191){for(var _0x132a16=0x0,_0x1c6fe7=events[_0x2c81('0x5')];_0x132a16<_0x1c6fe7;_0x132a16++){var _0x42ef3d=events[_0x132a16];var _0x2e4013=createListener('userVoiceQueueRt:'+_0x42ef3d,_0x209191);UserVoiceQueueRtEvents['on'](_0x42ef3d,_0x2e4013);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 121bf47..3140dd7 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(_0x523b06,_0x41fd1e){var _0x445bb5=function(_0x1323fe){while(--_0x1323fe){_0x523b06['push'](_0x523b06['shift']());}};_0x445bb5(++_0x41fd1e);}(_0xedd9,0xfc));var _0x9edd=function(_0x34e5a3,_0x4aacf6){_0x34e5a3=_0x34e5a3-0x0;var _0x294114=_0xedd9[_0x34e5a3];return _0x294114;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x54a360,_0x97497e){var _0x5b9d56=function(_0x4cd847){while(--_0x4cd847){_0x54a360['push'](_0x54a360['shift']());}};_0x5b9d56(++_0x97497e);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 1c1eea8..c58b06c 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 _0x8251=['INTEGER','sequelize','exports'];(function(_0x29f574,_0x4e27dd){var _0xbc2316=function(_0x5309f4){while(--_0x5309f4){_0x29f574['push'](_0x29f574['shift']());}};_0xbc2316(++_0x4e27dd);}(_0x8251,0x1cf));var _0x1825=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x8251[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require(_0x1825('0x0'));module[_0x1825('0x1')]={'penalty':{'type':Sequelize[_0x1825('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0e5b=['exports','INTEGER','sequelize'];(function(_0x58581e,_0x3a3aef){var _0x1a0645=function(_0x3d09fc){while(--_0x3d09fc){_0x58581e['push'](_0x58581e['shift']());}};_0x1a0645(++_0x3a3aef);}(_0x0e5b,0x170));var _0xb0e5=function(_0x2d3470,_0x47965f){_0x2d3470=_0x2d3470-0x0;var _0x3ce039=_0x0e5b[_0x2d3470];return _0x3ce039;};'use strict';var Sequelize=require(_0xb0e5('0x0'));module[_0xb0e5('0x1')]={'penalty':{'type':Sequelize[_0xb0e5('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 0b29ac5..2942e56 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 _0x064a=['bluebird','request-promise','rimraf','exports','define','lodash','util','../../config/logger','api'];(function(_0x50bef5,_0x2899c1){var _0x4fb411=function(_0x33f9da){while(--_0x33f9da){_0x50bef5['push'](_0x50bef5['shift']());}};_0x4fb411(++_0x2899c1);}(_0x064a,0x16d));var _0xa064=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x064a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xa064('0x0'));var util=require(_0xa064('0x1'));var logger=require(_0xa064('0x2'))(_0xa064('0x3'));var moment=require('moment');var BPromise=require(_0xa064('0x4'));var rp=require(_0xa064('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa064('0x6'));var config=require('../../config/environment');var attributes=require('./userWhatsappQueue.attributes');module[_0xa064('0x7')]=function(_0x450ae1,_0x435830){return _0x450ae1[_0xa064('0x8')]('UserWhatsappQueue',attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x802f=['bluebird','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','define','UserWhatsappQueue','lodash','util','../../config/logger','api','moment'];(function(_0x2e577d,_0x43297e){var _0x5b0752=function(_0x491bf3){while(--_0x491bf3){_0x2e577d['push'](_0x2e577d['shift']());}};_0x5b0752(++_0x43297e);}(_0x802f,0xf7));var _0xf802=function(_0x3a5b61,_0x522306){_0x3a5b61=_0x3a5b61-0x0;var _0x59fe74=_0x802f[_0x3a5b61];return _0x59fe74;};'use strict';var _=require(_0xf802('0x0'));var util=require(_0xf802('0x1'));var logger=require(_0xf802('0x2'))(_0xf802('0x3'));var moment=require(_0xf802('0x4'));var BPromise=require(_0xf802('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf802('0x6'));var rimraf=require(_0xf802('0x7'));var config=require(_0xf802('0x8'));var attributes=require(_0xf802('0x9'));module['exports']=function(_0x31dd68,_0x1ba297){return _0x31dd68[_0xf802('0xa')](_0xf802('0xb'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 536abe9..40a9dac 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 _0x411f=['jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x411f,0x118));var _0xf411=function(_0x21620c,_0x186151){_0x21620c=_0x21620c-0x0;var _0x2df6f=_0x411f[_0x21620c];return _0x2df6f;};'use strict';var _=require(_0xf411('0x0'));var util=require(_0xf411('0x1'));var moment=require(_0xf411('0x2'));var BPromise=require('bluebird');var rs=require(_0xf411('0x3'));var fs=require('fs');var Redis=require(_0xf411('0x4'));var db=require(_0xf411('0x5'))['db'];var utils=require(_0xf411('0x6'));var logger=require('../../config/logger')(_0xf411('0x7'));var config=require('../../config/environment');var jayson=require(_0xf411('0x8'));var client=jayson[_0xf411('0x9')][_0xf411('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa97e01,_0x2a01c9,_0x37945f){return new BPromise(function(_0x43ec86,_0x10d099){return client[_0xf411('0xb')](_0xa97e01,_0x37945f)[_0xf411('0xc')](function(_0x41b76f){logger[_0xf411('0xd')](_0xf411('0xe'),_0x2a01c9,_0xf411('0xf'));logger[_0xf411('0x10')](_0xf411('0x11'),_0x2a01c9,_0xf411('0xf'),JSON[_0xf411('0x12')](_0x41b76f));if(_0x41b76f[_0xf411('0x13')]){if(_0x41b76f[_0xf411('0x13')][_0xf411('0x14')]===0x1f4){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x2a01c9,_0x41b76f[_0xf411('0x13')][_0xf411('0x15')]);return _0x10d099(_0x41b76f[_0xf411('0x13')]['message']);}logger[_0xf411('0x13')](_0xf411('0xe'),_0x2a01c9,_0x41b76f[_0xf411('0x13')][_0xf411('0x15')]);return _0x43ec86(_0x41b76f[_0xf411('0x13')][_0xf411('0x15')]);}else{logger[_0xf411('0xd')]('UserWhatsappQueue,\x20%s,\x20%s',_0x2a01c9,_0xf411('0xf'));_0x43ec86(_0x41b76f[_0xf411('0x16')]['message']);}})[_0xf411('0x17')](function(_0x42f6cd){logger[_0xf411('0x13')](_0xf411('0xe'),_0x2a01c9,_0x42f6cd);_0x10d099(_0x42f6cd);});});} \ No newline at end of file +var _0x95fc=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3ac10c,_0x5a6415){var _0x58b91f=function(_0x42ac5f){while(--_0x42ac5f){_0x3ac10c['push'](_0x3ac10c['shift']());}};_0x58b91f(++_0x5a6415);}(_0x95fc,0x1b2));var _0xc95f=function(_0x31ab90,_0x145a96){_0x31ab90=_0x31ab90-0x0;var _0x2d6123=_0x95fc[_0x31ab90];return _0x2d6123;};'use strict';var _=require(_0xc95f('0x0'));var util=require(_0xc95f('0x1'));var moment=require(_0xc95f('0x2'));var BPromise=require(_0xc95f('0x3'));var rs=require(_0xc95f('0x4'));var fs=require('fs');var Redis=require(_0xc95f('0x5'));var db=require(_0xc95f('0x6'))['db'];var utils=require(_0xc95f('0x7'));var logger=require(_0xc95f('0x8'))('rpc');var config=require(_0xc95f('0x9'));var jayson=require(_0xc95f('0xa'));var client=jayson['client'][_0xc95f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9280a3,_0x228bf8,_0x920327){return new BPromise(function(_0x5a4fc9,_0x366798){return client[_0xc95f('0xc')](_0x9280a3,_0x920327)[_0xc95f('0xd')](function(_0x4bfeb0){logger[_0xc95f('0xe')](_0xc95f('0xf'),_0x228bf8,_0xc95f('0x10'));logger[_0xc95f('0x11')](_0xc95f('0x12'),_0x228bf8,_0xc95f('0x10'),JSON[_0xc95f('0x13')](_0x4bfeb0));if(_0x4bfeb0[_0xc95f('0x14')]){if(_0x4bfeb0[_0xc95f('0x14')][_0xc95f('0x15')]===0x1f4){logger[_0xc95f('0x14')](_0xc95f('0xf'),_0x228bf8,_0x4bfeb0['error'][_0xc95f('0x16')]);return _0x366798(_0x4bfeb0[_0xc95f('0x14')]['message']);}logger[_0xc95f('0x14')](_0xc95f('0xf'),_0x228bf8,_0x4bfeb0[_0xc95f('0x14')][_0xc95f('0x16')]);return _0x5a4fc9(_0x4bfeb0[_0xc95f('0x14')]['message']);}else{logger[_0xc95f('0xe')](_0xc95f('0xf'),_0x228bf8,'request\x20sent');_0x5a4fc9(_0x4bfeb0['result'][_0xc95f('0x16')]);}})[_0xc95f('0x17')](function(_0x20e215){logger[_0xc95f('0x14')](_0xc95f('0xf'),_0x228bf8,_0x20e215);_0x366798(_0x20e215);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 218c3d0..b7cca33 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 _0x885e=['show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./variable.controller','get','isAuthenticated','index','/:id'];(function(_0xa83fcc,_0xace7a1){var _0x3a124f=function(_0x1be329){while(--_0x1be329){_0xa83fcc['push'](_0xa83fcc['shift']());}};_0x3a124f(++_0xace7a1);}(_0x885e,0xe4));var _0xe885=function(_0x343667,_0x318e72){_0x343667=_0x343667-0x0;var _0x17a942=_0x885e[_0x343667];return _0x17a942;};'use strict';var multer=require(_0xe885('0x0'));var util=require(_0xe885('0x1'));var path=require('path');var timeout=require(_0xe885('0x2'));var express=require(_0xe885('0x3'));var router=express[_0xe885('0x4')]();var fs_extra=require(_0xe885('0x5'));var auth=require(_0xe885('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe885('0x7'));router[_0xe885('0x8')]('/',auth[_0xe885('0x9')](),controller[_0xe885('0xa')]);router['get'](_0xe885('0xb'),auth['isAuthenticated'](),controller[_0xe885('0xc')]);router[_0xe885('0xd')]('/',auth[_0xe885('0x9')](),controller[_0xe885('0xe')]);router[_0xe885('0xf')](_0xe885('0xb'),auth['isAuthenticated'](),controller[_0xe885('0x10')]);router[_0xe885('0x11')](_0xe885('0xb'),auth[_0xe885('0x9')](),controller[_0xe885('0x12')]);module[_0xe885('0x13')]=router; \ No newline at end of file +var _0xabe8=['post','create','put','delete','/:id','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./variable.controller','get','isAuthenticated','index','show'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xabe8,0x8c));var _0x8abe=function(_0x443228,_0x2d5284){_0x443228=_0x443228-0x0;var _0x2e9d6a=_0xabe8[_0x443228];return _0x2e9d6a;};'use strict';var multer=require(_0x8abe('0x0'));var util=require(_0x8abe('0x1'));var path=require(_0x8abe('0x2'));var timeout=require('connect-timeout');var express=require(_0x8abe('0x3'));var router=express[_0x8abe('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8abe('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8abe('0x6'));var controller=require(_0x8abe('0x7'));router[_0x8abe('0x8')]('/',auth[_0x8abe('0x9')](),controller[_0x8abe('0xa')]);router['get']('/:id',auth[_0x8abe('0x9')](),controller[_0x8abe('0xb')]);router[_0x8abe('0xc')]('/',auth[_0x8abe('0x9')](),controller[_0x8abe('0xd')]);router[_0x8abe('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x8abe('0xf')](_0x8abe('0x10'),auth[_0x8abe('0x9')](),controller[_0x8abe('0x11')]);module[_0x8abe('0x12')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index d07d59e..94aa618 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 _0xe152=['name','sequelize','exports','STRING'];(function(_0x5c14b2,_0x1fedf6){var _0x729409=function(_0x1dcf75){while(--_0x1dcf75){_0x5c14b2['push'](_0x5c14b2['shift']());}};_0x729409(++_0x1fedf6);}(_0xe152,0x91));var _0x2e15=function(_0x816f5,_0xb52c99){_0x816f5=_0x816f5-0x0;var _0x1c9534=_0xe152[_0x816f5];return _0x1c9534;};'use strict';var Sequelize=require(_0x2e15('0x0'));module[_0x2e15('0x1')]={'name':{'type':Sequelize[_0x2e15('0x2')],'unique':_0x2e15('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2e15('0x2')]}}; \ No newline at end of file +var _0xdd12=['name','STRING','sequelize','exports'];(function(_0x32bedc,_0x4221de){var _0x1c25f=function(_0x58c4b3){while(--_0x58c4b3){_0x32bedc['push'](_0x32bedc['shift']());}};_0x1c25f(++_0x4221de);}(_0xdd12,0xf6));var _0x2dd1=function(_0x28cae5,_0x44cf5f){_0x28cae5=_0x28cae5-0x0;var _0x5db0cd=_0xdd12[_0x28cae5];return _0x5db0cd;};'use strict';var Sequelize=require(_0x2dd1('0x0'));module[_0x2dd1('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2dd1('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2dd1('0x3')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 4547328..cc8670d 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 _0x27ff=['keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','where','merge','filter','options','includeAll','include','findAll','rows','params','find','create','body','user','UserProfileSection','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','get','Variables','UserProfileResource','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','key','model','query'];(function(_0x1789c3,_0x29b7d4){var _0x16f236=function(_0x5e1006){while(--_0x5e1006){_0x1789c3['push'](_0x1789c3['shift']());}};_0x16f236(++_0x29b7d4);}(_0x27ff,0x158));var _0xf27f=function(_0x3b5f66,_0x1dbfc5){_0x3b5f66=_0x3b5f66-0x0;var _0x4aa1a8=_0x27ff[_0x3b5f66];return _0x4aa1a8;};'use strict';var emlformat=require(_0xf27f('0x0'));var rimraf=require(_0xf27f('0x1'));var zipdir=require(_0xf27f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf27f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf27f('0x4'));var util=require('util');var path=require(_0xf27f('0x5'));var sox=require(_0xf27f('0x6'));var csv=require('to-csv');var ejs=require(_0xf27f('0x7'));var fs=require('fs');var fs_extra=require(_0xf27f('0x8'));var _=require(_0xf27f('0x9'));var squel=require(_0xf27f('0xa'));var crypto=require(_0xf27f('0xb'));var jsforce=require(_0xf27f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf27f('0xd'));var querystring=require(_0xf27f('0xe'));var Papa=require('papaparse');var Redis=require(_0xf27f('0xf'));var authService=require(_0xf27f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf27f('0x11'));var hardwareService=require(_0xf27f('0x12'));var logger=require(_0xf27f('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xf27f('0x14'));var licenseUtil=require(_0xf27f('0x15'));var db=require(_0xf27f('0x16'))['db'];function respondWithStatusCode(_0x47ddfa,_0x3f0b48){_0x3f0b48=_0x3f0b48||0xcc;return function(_0xfa50e7){if(_0xfa50e7){return _0x47ddfa[_0xf27f('0x17')](_0x3f0b48);}return _0x47ddfa[_0xf27f('0x18')](_0x3f0b48)['end']();};}function respondWithResult(_0x4a9fdb,_0x3f2b5e){_0x3f2b5e=_0x3f2b5e||0xc8;return function(_0xbe0d81){if(_0xbe0d81){return _0x4a9fdb[_0xf27f('0x18')](_0x3f2b5e)[_0xf27f('0x19')](_0xbe0d81);}};}function respondWithFilteredResult(_0x4a5b08,_0x49d836){return function(_0x1dc9f1){if(_0x1dc9f1){var _0x90ad4c=typeof _0x49d836[_0xf27f('0x1a')]===_0xf27f('0x1b')&&typeof _0x49d836[_0xf27f('0x1c')]===_0xf27f('0x1b');var _0x21538d=_0x1dc9f1[_0xf27f('0x1d')];var _0x1f40fa=_0x90ad4c?0x0:_0x49d836[_0xf27f('0x1a')];var _0x28e4b6=_0x90ad4c?_0x1dc9f1[_0xf27f('0x1d')]:_0x49d836[_0xf27f('0x1a')]+_0x49d836[_0xf27f('0x1c')];var _0xa383e9;if(_0x28e4b6>=_0x21538d){_0x28e4b6=_0x21538d;_0xa383e9=0xc8;}else{_0xa383e9=0xce;}_0x4a5b08['status'](_0xa383e9);return _0x4a5b08['set'](_0xf27f('0x1e'),_0x1f40fa+'-'+_0x28e4b6+'/'+_0x21538d)[_0xf27f('0x19')](_0x1dc9f1);}return null;};}function patchUpdates(_0x359816){return function(_0x3957ad){try{jsonpatch[_0xf27f('0x1f')](_0x3957ad,_0x359816,!![]);}catch(_0x56c2aa){return BPromise['reject'](_0x56c2aa);}return _0x3957ad[_0xf27f('0x20')]();};}function saveUpdates(_0x15130d,_0x2a7217){return function(_0x1b815c){if(_0x1b815c){return _0x1b815c['update'](_0x15130d)[_0xf27f('0x21')](function(_0x38214a){return _0x38214a;});}return null;};}function removeEntity(_0x2ac8c3,_0x2d9087){return function(_0x5bcf09){if(_0x5bcf09){return _0x5bcf09[_0xf27f('0x22')]()['then'](function(){var _0x1e0d17=_0x5bcf09[_0xf27f('0x23')]({'plain':!![]});var _0x18bea0=_0xf27f('0x24');return db[_0xf27f('0x25')][_0xf27f('0x22')]({'where':{'type':_0x18bea0,'resourceId':_0x1e0d17['id']}})[_0xf27f('0x21')](function(){return _0x5bcf09;});})[_0xf27f('0x21')](function(){_0x2ac8c3[_0xf27f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a07cb,_0x5aea24){return function(_0x40d7e1){if(!_0x40d7e1){_0x4a07cb[_0xf27f('0x17')](0x194);}return _0x40d7e1;};}function handleError(_0x313b21,_0x2d7256){_0x2d7256=_0x2d7256||0x1f4;return function(_0x36803e){logger[_0xf27f('0x26')](_0x36803e[_0xf27f('0x27')]);if(_0x36803e['name']){delete _0x36803e[_0xf27f('0x28')];}_0x313b21['status'](_0x2d7256)[_0xf27f('0x29')](_0x36803e);};}exports[_0xf27f('0x2a')]=function(_0x347555,_0x79ac22){var _0x5d47b8={},_0x2353a3={},_0x2f20e9={'count':0x0,'rows':[]};var _0x2bf4bd=_[_0xf27f('0x2b')](db[_0xf27f('0x2c')][_0xf27f('0x2d')],function(_0x5e89f3){return{'name':_0x5e89f3[_0xf27f('0x2e')],'type':_0x5e89f3[_0xf27f('0x2f')][_0xf27f('0x30')]};});_0x2353a3[_0xf27f('0x31')]=_['map'](_0x2bf4bd,'name');_0x2353a3[_0xf27f('0x32')]=_[_0xf27f('0x33')](_0x347555['query']);_0x2353a3[_0xf27f('0x34')]=_[_0xf27f('0x35')](_0x2353a3['model'],_0x2353a3['query']);_0x5d47b8['attributes']=_[_0xf27f('0x35')](_0x2353a3[_0xf27f('0x31')],qs[_0xf27f('0x36')](_0x347555[_0xf27f('0x32')][_0xf27f('0x36')]));_0x5d47b8[_0xf27f('0x37')]=_0x5d47b8[_0xf27f('0x37')][_0xf27f('0x38')]?_0x5d47b8[_0xf27f('0x37')]:_0x2353a3['model'];if(!_0x347555['query']['hasOwnProperty'](_0xf27f('0x39'))){_0x5d47b8[_0xf27f('0x1c')]=qs['limit'](_0x347555['query'][_0xf27f('0x1c')]);_0x5d47b8['offset']=qs[_0xf27f('0x1a')](_0x347555['query'][_0xf27f('0x1a')]);}_0x5d47b8[_0xf27f('0x3a')]=qs[_0xf27f('0x3b')](_0x347555[_0xf27f('0x32')]['sort']);_0x5d47b8['where']=qs['filters'](_[_0xf27f('0x3c')](_0x347555['query'],_0x2353a3[_0xf27f('0x34')]),_0x2bf4bd);if(_0x347555[_0xf27f('0x32')]['filter']){_0x5d47b8[_0xf27f('0x3d')]=_[_0xf27f('0x3e')](_0x5d47b8[_0xf27f('0x3d')],{'$or':_[_0xf27f('0x2b')](_0x2bf4bd,function(_0x5098ae){if(_0x5098ae[_0xf27f('0x2f')]!=='VIRTUAL'){var _0x24e550={};_0x24e550[_0x5098ae[_0xf27f('0x28')]]={'$like':'%'+_0x347555[_0xf27f('0x32')][_0xf27f('0x3f')]+'%'};return _0x24e550;}})});}_0x5d47b8=_[_0xf27f('0x3e')]({},_0x5d47b8,_0x347555[_0xf27f('0x40')]);var _0x1245c6={'where':_0x5d47b8['where']};return db['Variable'][_0xf27f('0x1d')](_0x1245c6)[_0xf27f('0x21')](function(_0x2c2484){_0x2f20e9[_0xf27f('0x1d')]=_0x2c2484;if(_0x347555['query'][_0xf27f('0x41')]){_0x5d47b8[_0xf27f('0x42')]=[{'all':!![]}];}return db[_0xf27f('0x2c')][_0xf27f('0x43')](_0x5d47b8);})['then'](function(_0x4e4750){_0x2f20e9[_0xf27f('0x44')]=_0x4e4750;return _0x2f20e9;})[_0xf27f('0x21')](respondWithFilteredResult(_0x79ac22,_0x5d47b8))['catch'](handleError(_0x79ac22,null));};exports['show']=function(_0x12c119,_0x3ae450){var _0x2e673a={'raw':!![],'where':{'id':_0x12c119[_0xf27f('0x45')]['id']}},_0x15b558={};_0x15b558[_0xf27f('0x31')]=_[_0xf27f('0x33')](db['Variable'][_0xf27f('0x2d')]);_0x15b558[_0xf27f('0x32')]=_['keys'](_0x12c119[_0xf27f('0x32')]);_0x15b558[_0xf27f('0x34')]=_[_0xf27f('0x35')](_0x15b558[_0xf27f('0x31')],_0x15b558[_0xf27f('0x32')]);_0x2e673a[_0xf27f('0x37')]=_['intersection'](_0x15b558[_0xf27f('0x31')],qs[_0xf27f('0x36')](_0x12c119[_0xf27f('0x32')][_0xf27f('0x36')]));_0x2e673a[_0xf27f('0x37')]=_0x2e673a[_0xf27f('0x37')]['length']?_0x2e673a[_0xf27f('0x37')]:_0x15b558['model'];if(_0x12c119[_0xf27f('0x32')][_0xf27f('0x41')]){_0x2e673a[_0xf27f('0x42')]=[{'all':!![]}];}_0x2e673a=_[_0xf27f('0x3e')]({},_0x2e673a,_0x12c119[_0xf27f('0x40')]);return db[_0xf27f('0x2c')][_0xf27f('0x46')](_0x2e673a)['then'](handleEntityNotFound(_0x3ae450,null))[_0xf27f('0x21')](respondWithResult(_0x3ae450,null))['catch'](handleError(_0x3ae450,null));};exports[_0xf27f('0x47')]=function(_0x2637a4,_0x2f2613){return db['Variable'][_0xf27f('0x47')](_0x2637a4[_0xf27f('0x48')],{})[_0xf27f('0x21')](function(_0x1310de){var _0x56a58c=_0x2637a4[_0xf27f('0x49')]['get']({'plain':!![]});if(!_0x56a58c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x56a58c['role']===_0xf27f('0x49')){var _0x391a80=_0x1310de['get']({'plain':!![]});var _0x1b4d72=_0xf27f('0x24');return db[_0xf27f('0x4a')][_0xf27f('0x46')]({'where':{'name':_0x1b4d72,'userProfileId':_0x56a58c[_0xf27f('0x4b')]},'raw':!![]})[_0xf27f('0x21')](function(_0x402408){if(_0x402408&&_0x402408['autoAssociation']===0x0){return db['UserProfileResource'][_0xf27f('0x47')]({'name':_0x391a80[_0xf27f('0x28')],'resourceId':_0x391a80['id'],'type':_0x402408[_0xf27f('0x28')],'sectionId':_0x402408['id']},{})[_0xf27f('0x21')](function(){return _0x1310de;});}else{return _0x1310de;}})[_0xf27f('0x4c')](function(_0x1e5483){logger[_0xf27f('0x26')](_0xf27f('0x4d'),_0x1e5483);throw _0x1e5483;});}return _0x1310de;})[_0xf27f('0x21')](respondWithResult(_0x2f2613,0xc9))[_0xf27f('0x4c')](handleError(_0x2f2613,null));};exports[_0xf27f('0x4e')]=function(_0x573e61,_0x2ef2f1){if(_0x573e61['body']['id']){delete _0x573e61[_0xf27f('0x48')]['id'];}return db[_0xf27f('0x2c')]['find']({'where':{'id':_0x573e61[_0xf27f('0x45')]['id']}})[_0xf27f('0x21')](handleEntityNotFound(_0x2ef2f1,null))['then'](saveUpdates(_0x573e61[_0xf27f('0x48')],null))[_0xf27f('0x21')](respondWithResult(_0x2ef2f1,null))['catch'](handleError(_0x2ef2f1,null));};exports[_0xf27f('0x22')]=function(_0x92cff9,_0x4cd33c){return db[_0xf27f('0x2c')]['find']({'where':{'id':_0x92cff9['params']['id']}})[_0xf27f('0x21')](handleEntityNotFound(_0x4cd33c,null))['then'](removeEntity(_0x4cd33c,null))[_0xf27f('0x4c')](handleError(_0x4cd33c,null));}; \ No newline at end of file +var _0x6c25=['filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','keys','rawAttributes','length','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','fast-json-patch','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','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','limit','count','set','Content-Range','apply','reject','update','then','destroy','Variables','status','error','stack','name','send','index','map','Variable','fieldName','type','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where'];(function(_0x38ed42,_0x3d9a37){var _0x474931=function(_0x1fa601){while(--_0x1fa601){_0x38ed42['push'](_0x38ed42['shift']());}};_0x474931(++_0x3d9a37);}(_0x6c25,0xba));var _0x56c2=function(_0x1da436,_0x2fab9d){_0x1da436=_0x1da436-0x0;var _0xe4468d=_0x6c25[_0x1da436];return _0xe4468d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x56c2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x56c2('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x56c2('0x2'));var Mustache=require(_0x56c2('0x3'));var util=require(_0x56c2('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x56c2('0x5'));var ejs=require(_0x56c2('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x56c2('0x7'));var squel=require(_0x56c2('0x8'));var crypto=require(_0x56c2('0x9'));var jsforce=require(_0x56c2('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x56c2('0x5'));var querystring=require(_0x56c2('0xb'));var Papa=require(_0x56c2('0xc'));var Redis=require(_0x56c2('0xd'));var authService=require(_0x56c2('0xe'));var qs=require(_0x56c2('0xf'));var as=require(_0x56c2('0x10'));var hardwareService=require(_0x56c2('0x11'));var logger=require('../../config/logger')(_0x56c2('0x12'));var utils=require('../../config/utils');var config=require(_0x56c2('0x13'));var licenseUtil=require(_0x56c2('0x14'));var db=require(_0x56c2('0x15'))['db'];function respondWithStatusCode(_0xcc6e9c,_0x60ed81){_0x60ed81=_0x60ed81||0xcc;return function(_0x5a060d){if(_0x5a060d){return _0xcc6e9c[_0x56c2('0x16')](_0x60ed81);}return _0xcc6e9c['status'](_0x60ed81)[_0x56c2('0x17')]();};}function respondWithResult(_0xeac457,_0x2a3311){_0x2a3311=_0x2a3311||0xc8;return function(_0x543491){if(_0x543491){return _0xeac457['status'](_0x2a3311)[_0x56c2('0x18')](_0x543491);}};}function respondWithFilteredResult(_0x552d21,_0x5c51fb){return function(_0x181b4d){if(_0x181b4d){var _0x34cf96=typeof _0x5c51fb[_0x56c2('0x19')]===_0x56c2('0x1a')&&typeof _0x5c51fb[_0x56c2('0x1b')]==='undefined';var _0x294ca1=_0x181b4d[_0x56c2('0x1c')];var _0x476aaa=_0x34cf96?0x0:_0x5c51fb[_0x56c2('0x19')];var _0x241557=_0x34cf96?_0x181b4d[_0x56c2('0x1c')]:_0x5c51fb[_0x56c2('0x19')]+_0x5c51fb[_0x56c2('0x1b')];var _0x2dbbf0;if(_0x241557>=_0x294ca1){_0x241557=_0x294ca1;_0x2dbbf0=0xc8;}else{_0x2dbbf0=0xce;}_0x552d21['status'](_0x2dbbf0);return _0x552d21[_0x56c2('0x1d')](_0x56c2('0x1e'),_0x476aaa+'-'+_0x241557+'/'+_0x294ca1)[_0x56c2('0x18')](_0x181b4d);}return null;};}function patchUpdates(_0x18a86e){return function(_0x14e9a0){try{jsonpatch[_0x56c2('0x1f')](_0x14e9a0,_0x18a86e,!![]);}catch(_0x1354b2){return BPromise[_0x56c2('0x20')](_0x1354b2);}return _0x14e9a0['save']();};}function saveUpdates(_0x1008be,_0x37bf75){return function(_0x415fbc){if(_0x415fbc){return _0x415fbc[_0x56c2('0x21')](_0x1008be)[_0x56c2('0x22')](function(_0x317bb6){return _0x317bb6;});}return null;};}function removeEntity(_0x8b377c,_0x42b3b8){return function(_0xa403d3){if(_0xa403d3){return _0xa403d3[_0x56c2('0x23')]()[_0x56c2('0x22')](function(){var _0x2e6a40=_0xa403d3['get']({'plain':!![]});var _0x38b202=_0x56c2('0x24');return db['UserProfileResource'][_0x56c2('0x23')]({'where':{'type':_0x38b202,'resourceId':_0x2e6a40['id']}})[_0x56c2('0x22')](function(){return _0xa403d3;});})[_0x56c2('0x22')](function(){_0x8b377c[_0x56c2('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52a11b,_0x57e8b8){return function(_0x3dfc1d){if(!_0x3dfc1d){_0x52a11b['sendStatus'](0x194);}return _0x3dfc1d;};}function handleError(_0x31162b,_0x56112d){_0x56112d=_0x56112d||0x1f4;return function(_0x400d56){logger[_0x56c2('0x26')](_0x400d56[_0x56c2('0x27')]);if(_0x400d56[_0x56c2('0x28')]){delete _0x400d56[_0x56c2('0x28')];}_0x31162b[_0x56c2('0x25')](_0x56112d)[_0x56c2('0x29')](_0x400d56);};}exports[_0x56c2('0x2a')]=function(_0x1850af,_0x1a8571){var _0x2dc547={},_0x30c7c7={},_0x52d167={'count':0x0,'rows':[]};var _0x1e0176=_[_0x56c2('0x2b')](db[_0x56c2('0x2c')]['rawAttributes'],function(_0x564ddf){return{'name':_0x564ddf[_0x56c2('0x2d')],'type':_0x564ddf[_0x56c2('0x2e')]['key']};});_0x30c7c7[_0x56c2('0x2f')]=_[_0x56c2('0x2b')](_0x1e0176,_0x56c2('0x28'));_0x30c7c7[_0x56c2('0x30')]=_['keys'](_0x1850af[_0x56c2('0x30')]);_0x30c7c7['filters']=_['intersection'](_0x30c7c7[_0x56c2('0x2f')],_0x30c7c7[_0x56c2('0x30')]);_0x2dc547['attributes']=_[_0x56c2('0x31')](_0x30c7c7[_0x56c2('0x2f')],qs[_0x56c2('0x32')](_0x1850af[_0x56c2('0x30')][_0x56c2('0x32')]));_0x2dc547[_0x56c2('0x33')]=_0x2dc547[_0x56c2('0x33')]['length']?_0x2dc547[_0x56c2('0x33')]:_0x30c7c7[_0x56c2('0x2f')];if(!_0x1850af[_0x56c2('0x30')][_0x56c2('0x34')](_0x56c2('0x35'))){_0x2dc547[_0x56c2('0x1b')]=qs[_0x56c2('0x1b')](_0x1850af[_0x56c2('0x30')][_0x56c2('0x1b')]);_0x2dc547[_0x56c2('0x19')]=qs[_0x56c2('0x19')](_0x1850af[_0x56c2('0x30')][_0x56c2('0x19')]);}_0x2dc547[_0x56c2('0x36')]=qs['sort'](_0x1850af[_0x56c2('0x30')][_0x56c2('0x37')]);_0x2dc547[_0x56c2('0x38')]=qs[_0x56c2('0x39')](_[_0x56c2('0x3a')](_0x1850af[_0x56c2('0x30')],_0x30c7c7[_0x56c2('0x39')]),_0x1e0176);if(_0x1850af[_0x56c2('0x30')]['filter']){_0x2dc547[_0x56c2('0x38')]=_[_0x56c2('0x3b')](_0x2dc547[_0x56c2('0x38')],{'$or':_[_0x56c2('0x2b')](_0x1e0176,function(_0x3e9dfa){if(_0x3e9dfa[_0x56c2('0x2e')]!==_0x56c2('0x3c')){var _0x346bad={};_0x346bad[_0x3e9dfa[_0x56c2('0x28')]]={'$like':'%'+_0x1850af['query'][_0x56c2('0x3d')]+'%'};return _0x346bad;}})});}_0x2dc547=_[_0x56c2('0x3b')]({},_0x2dc547,_0x1850af[_0x56c2('0x3e')]);var _0x259538={'where':_0x2dc547[_0x56c2('0x38')]};return db[_0x56c2('0x2c')]['count'](_0x259538)['then'](function(_0x43fef0){_0x52d167['count']=_0x43fef0;if(_0x1850af[_0x56c2('0x30')][_0x56c2('0x3f')]){_0x2dc547[_0x56c2('0x40')]=[{'all':!![]}];}return db[_0x56c2('0x2c')][_0x56c2('0x41')](_0x2dc547);})[_0x56c2('0x22')](function(_0x7e1a49){_0x52d167['rows']=_0x7e1a49;return _0x52d167;})[_0x56c2('0x22')](respondWithFilteredResult(_0x1a8571,_0x2dc547))[_0x56c2('0x42')](handleError(_0x1a8571,null));};exports['show']=function(_0x7b7401,_0x46b2b9){var _0x4b6872={'raw':!![],'where':{'id':_0x7b7401['params']['id']}},_0x2649bd={};_0x2649bd[_0x56c2('0x2f')]=_[_0x56c2('0x43')](db[_0x56c2('0x2c')][_0x56c2('0x44')]);_0x2649bd[_0x56c2('0x30')]=_[_0x56c2('0x43')](_0x7b7401[_0x56c2('0x30')]);_0x2649bd[_0x56c2('0x39')]=_[_0x56c2('0x31')](_0x2649bd[_0x56c2('0x2f')],_0x2649bd['query']);_0x4b6872[_0x56c2('0x33')]=_[_0x56c2('0x31')](_0x2649bd[_0x56c2('0x2f')],qs[_0x56c2('0x32')](_0x7b7401[_0x56c2('0x30')][_0x56c2('0x32')]));_0x4b6872[_0x56c2('0x33')]=_0x4b6872[_0x56c2('0x33')][_0x56c2('0x45')]?_0x4b6872[_0x56c2('0x33')]:_0x2649bd[_0x56c2('0x2f')];if(_0x7b7401[_0x56c2('0x30')]['includeAll']){_0x4b6872['include']=[{'all':!![]}];}_0x4b6872=_[_0x56c2('0x3b')]({},_0x4b6872,_0x7b7401[_0x56c2('0x3e')]);return db[_0x56c2('0x2c')]['find'](_0x4b6872)[_0x56c2('0x22')](handleEntityNotFound(_0x46b2b9,null))[_0x56c2('0x22')](respondWithResult(_0x46b2b9,null))[_0x56c2('0x42')](handleError(_0x46b2b9,null));};exports['create']=function(_0x53e1a8,_0x28ca84){return db[_0x56c2('0x2c')]['create'](_0x53e1a8[_0x56c2('0x46')],{})['then'](function(_0xc60cb3){var _0x5cf39d=_0x53e1a8[_0x56c2('0x47')][_0x56c2('0x48')]({'plain':!![]});if(!_0x5cf39d)throw new Error(_0x56c2('0x49'));if(_0x5cf39d[_0x56c2('0x4a')]===_0x56c2('0x47')){var _0x3115bd=_0xc60cb3[_0x56c2('0x48')]({'plain':!![]});var _0xb10ab5=_0x56c2('0x24');return db['UserProfileSection'][_0x56c2('0x4b')]({'where':{'name':_0xb10ab5,'userProfileId':_0x5cf39d[_0x56c2('0x4c')]},'raw':!![]})[_0x56c2('0x22')](function(_0x555cbd){if(_0x555cbd&&_0x555cbd[_0x56c2('0x4d')]===0x0){return db['UserProfileResource'][_0x56c2('0x4e')]({'name':_0x3115bd[_0x56c2('0x28')],'resourceId':_0x3115bd['id'],'type':_0x555cbd[_0x56c2('0x28')],'sectionId':_0x555cbd['id']},{})['then'](function(){return _0xc60cb3;});}else{return _0xc60cb3;}})[_0x56c2('0x42')](function(_0x3c3e41){logger['error'](_0x56c2('0x4f'),_0x3c3e41);throw _0x3c3e41;});}return _0xc60cb3;})['then'](respondWithResult(_0x28ca84,0xc9))[_0x56c2('0x42')](handleError(_0x28ca84,null));};exports[_0x56c2('0x21')]=function(_0x338ad6,_0x2ed61b){if(_0x338ad6[_0x56c2('0x46')]['id']){delete _0x338ad6[_0x56c2('0x46')]['id'];}return db[_0x56c2('0x2c')]['find']({'where':{'id':_0x338ad6[_0x56c2('0x50')]['id']}})[_0x56c2('0x22')](handleEntityNotFound(_0x2ed61b,null))[_0x56c2('0x22')](saveUpdates(_0x338ad6['body'],null))[_0x56c2('0x22')](respondWithResult(_0x2ed61b,null))['catch'](handleError(_0x2ed61b,null));};exports['destroy']=function(_0x15b9fa,_0x5e3e5f){return db['Variable'][_0x56c2('0x4b')]({'where':{'id':_0x15b9fa[_0x56c2('0x50')]['id']}})[_0x56c2('0x22')](handleEntityNotFound(_0x5e3e5f,null))[_0x56c2('0x22')](removeEntity(_0x5e3e5f,null))[_0x56c2('0x42')](handleError(_0x5e3e5f,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index c28a0c2..dcae197 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 _0x89fc=['path','rimraf','./variable.attributes','exports','define','tools_variables','lodash','util','moment','bluebird','request-promise'];(function(_0x232b67,_0x3dc89e){var _0x39fcc0=function(_0x3e20c6){while(--_0x3e20c6){_0x232b67['push'](_0x232b67['shift']());}};_0x39fcc0(++_0x3dc89e);}(_0x89fc,0x12f));var _0xc89f=function(_0x137ae7,_0x3f2bf7){_0x137ae7=_0x137ae7-0x0;var _0x4862ce=_0x89fc[_0x137ae7];return _0x4862ce;};'use strict';var _=require(_0xc89f('0x0'));var util=require(_0xc89f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc89f('0x2'));var BPromise=require(_0xc89f('0x3'));var rp=require(_0xc89f('0x4'));var fs=require('fs');var path=require(_0xc89f('0x5'));var rimraf=require(_0xc89f('0x6'));var config=require('../../config/environment');var attributes=require(_0xc89f('0x7'));module[_0xc89f('0x8')]=function(_0x4b8ccb,_0x4dd2f3){return _0x4b8ccb[_0xc89f('0x9')]('Variable',attributes,{'tableName':_0xc89f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x82fc=['tools_variables','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','Variable'];(function(_0x4b7102,_0x468f98){var _0xa3c743=function(_0x456160){while(--_0x456160){_0x4b7102['push'](_0x4b7102['shift']());}};_0xa3c743(++_0x468f98);}(_0x82fc,0x1ae));var _0xc82f=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x82fc[_0x465028];return _0xb783d4;};'use strict';var _=require(_0xc82f('0x0'));var util=require(_0xc82f('0x1'));var logger=require(_0xc82f('0x2'))(_0xc82f('0x3'));var moment=require('moment');var BPromise=require(_0xc82f('0x4'));var rp=require(_0xc82f('0x5'));var fs=require('fs');var path=require(_0xc82f('0x6'));var rimraf=require(_0xc82f('0x7'));var config=require(_0xc82f('0x8'));var attributes=require(_0xc82f('0x9'));module[_0xc82f('0xa')]=function(_0x4492fa,_0x1b480d){return _0x4492fa['define'](_0xc82f('0xb'),attributes,{'tableName':_0xc82f('0xc'),'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 fedcf5f..4915c65 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6aa7=['include','model','attributes','map','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowVariable','find','options','raw','where'];(function(_0x5f096e,_0x3deb0c){var _0x247525=function(_0x24a07a){while(--_0x24a07a){_0x5f096e['push'](_0x5f096e['shift']());}};_0x247525(++_0x3deb0c);}(_0x6aa7,0x178));var _0x76aa=function(_0x468f5a,_0x551b79){_0x468f5a=_0x468f5a-0x0;var _0x19458e=_0x6aa7[_0x468f5a];return _0x19458e;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});}exports[_0x76aa('0x16')]=function(_0x21c16d){var _0xa1bc7=this;return new Promise(function(_0x3ead3f,_0x496902){return db['Variable'][_0x76aa('0x17')]({'raw':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x19')]===undefined?!![]:![]:!![],'where':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1a')]||null:null,'attributes':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')]['attributes']||null:null,'include':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')]?_['map'](_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')],function(_0x31252f){return{'model':db[_0x31252f[_0x76aa('0x1c')]],'as':_0x31252f['as'],'attributes':_0x31252f[_0x76aa('0x1d')],'include':_0x31252f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x31252f[_0x76aa('0x1b')],function(_0x32bf9f){return{'model':db[_0x32bf9f[_0x76aa('0x1c')]],'as':_0x32bf9f['as'],'attributes':_0x32bf9f[_0x76aa('0x1d')],'include':_0x32bf9f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x32bf9f['include'],function(_0xb5e8a9){return{'model':db[_0xb5e8a9[_0x76aa('0x1c')]],'as':_0xb5e8a9['as'],'attributes':_0xb5e8a9[_0x76aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x76aa('0xa')](function(_0xa1e6){logger[_0x76aa('0xb')](_0x76aa('0x16'),_0x21c16d);logger[_0x76aa('0xe')](_0x76aa('0x16'),_0x21c16d,JSON[_0x76aa('0x10')](_0xa1e6));_0x3ead3f(_0xa1e6);})['catch'](function(_0x3fcb7f){logger['error'](_0x76aa('0x16'),_0x3fcb7f[_0x76aa('0x13')],_0x21c16d);_0x496902(_0xa1bc7[_0x76aa('0x11')](0x1f4,_0x3fcb7f[_0x76aa('0x13')]));});});}; \ No newline at end of file +var _0x7217=['where','attributes','map','include','model','ShowVariable','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Variable','find','options','raw'];(function(_0x545739,_0x2d132c){var _0x1b085f=function(_0x350a19){while(--_0x350a19){_0x545739['push'](_0x545739['shift']());}};_0x1b085f(++_0x2d132c);}(_0x7217,0x19e));var _0x7721=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x7217[_0x29b609];return _0x54c952;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('Variable,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('Variable,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});}exports['ShowVariable']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowVariable',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 109e031..1be1a2f 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 _0xe7fe=['./version.controller','get','isAuthenticated','canUpdate','fetch','/reset','/pull','/restart','restart','migrations','exports','express','Router','../../components/auth/service'];(function(_0x284b92,_0x140334){var _0x3e6212=function(_0x39e2f6){while(--_0x39e2f6){_0x284b92['push'](_0x284b92['shift']());}};_0x3e6212(++_0x140334);}(_0xe7fe,0x89));var _0xee7f=function(_0x4a0324,_0x438fa1){_0x4a0324=_0x4a0324-0x0;var _0x3cd3e0=_0xe7fe[_0x4a0324];return _0x3cd3e0;};'use strict';var express=require(_0xee7f('0x0'));var router=express[_0xee7f('0x1')]();var auth=require(_0xee7f('0x2'));var controller=require(_0xee7f('0x3'));router['get']('/',controller['index']);router[_0xee7f('0x4')]('/fetch',auth[_0xee7f('0x5')](),auth[_0xee7f('0x6')](),controller[_0xee7f('0x7')]);router[_0xee7f('0x4')](_0xee7f('0x8'),auth[_0xee7f('0x5')](),auth[_0xee7f('0x6')](),controller['reset']);router[_0xee7f('0x4')](_0xee7f('0x9'),auth['isAuthenticated'](),auth[_0xee7f('0x6')](),controller['pull']);router[_0xee7f('0x4')](_0xee7f('0xa'),auth['isAuthenticated'](),controller[_0xee7f('0xb')]);router[_0xee7f('0x4')]('/migrations',controller[_0xee7f('0xc')]);module[_0xee7f('0xd')]=router; \ No newline at end of file +var _0x5f00=['get','index','/fetch','isAuthenticated','fetch','canUpdate','reset','/pull','pull','/restart','restart','/migrations','migrations','exports','Router','../../components/auth/service','./version.controller'];(function(_0x3642ef,_0x79bfa8){var _0xa8726d=function(_0x1acad1){while(--_0x1acad1){_0x3642ef['push'](_0x3642ef['shift']());}};_0xa8726d(++_0x79bfa8);}(_0x5f00,0x74));var _0x05f0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f00[_0x3dd15e];return _0x231fd0;};'use strict';var express=require('express');var router=express[_0x05f0('0x0')]();var auth=require(_0x05f0('0x1'));var controller=require(_0x05f0('0x2'));router[_0x05f0('0x3')]('/',controller[_0x05f0('0x4')]);router[_0x05f0('0x3')](_0x05f0('0x5'),auth[_0x05f0('0x6')](),auth['canUpdate'](),controller[_0x05f0('0x7')]);router[_0x05f0('0x3')]('/reset',auth['isAuthenticated'](),auth[_0x05f0('0x8')](),controller[_0x05f0('0x9')]);router['get'](_0x05f0('0xa'),auth[_0x05f0('0x6')](),auth['canUpdate'](),controller[_0x05f0('0xb')]);router['get'](_0x05f0('0xc'),auth[_0x05f0('0x6')](),controller[_0x05f0('0xd')]);router['get'](_0x05f0('0xe'),controller[_0x05f0('0xf')]);module[_0x05f0('0x10')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 6f81fec..c6b953d 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 _0xd064=['simple-git','root','index','exports','query','latest','2.0.0','status','json','fetch','origin','info','reset','FETCH_HEAD','error','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','catch','migrations','readdirSync','join','server','length','replace','.js','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2'];(function(_0x23678b,_0xc7137){var _0x152c02=function(_0x322a12){while(--_0x322a12){_0x23678b['push'](_0x23678b['shift']());}};_0x152c02(++_0xc7137);}(_0xd064,0xf9));var _0x4d06=function(_0x46c8fb,_0x253501){_0x46c8fb=_0x46c8fb-0x0;var _0x48f9eb=_0xd064[_0x46c8fb];return _0x48f9eb;};'use strict';var Umzug=require(_0x4d06('0x0'));var path=require(_0x4d06('0x1'));var fs=require('fs');var _=require(_0x4d06('0x2'));var pkginfo=require(_0x4d06('0x3'))(module,_0x4d06('0x4'));var compareVersions=require(_0x4d06('0x5'));var exec=require(_0x4d06('0x6'))[_0x4d06('0x7')];var db=require(_0x4d06('0x8'))['db'];var config=require(_0x4d06('0x9'));var pm2=require(_0x4d06('0xa'));var logger=require('../../config/logger')('update');var git=require(_0x4d06('0xb'))(config[_0x4d06('0xc')]);exports[_0x4d06('0xd')]=function(_0x5e501c,_0x48dd59){var _0x81185b={'current':module[_0x4d06('0xe')]['version'],'phonebar':0x2};if(_0x5e501c[_0x4d06('0xf')]&&_0x5e501c[_0x4d06('0xf')][_0x4d06('0x10')]){return git['fetch']()['tags'](function(_0x10607e,_0x4bd434){_0x81185b[_0x4d06('0x10')]=(_0x10607e?module[_0x4d06('0xe')][_0x4d06('0x4')]:_0x4bd434[_0x4d06('0x10')])||_0x4d06('0x11');return _0x48dd59[_0x4d06('0x12')](0xc8)[_0x4d06('0x13')](_0x81185b);});}else{return _0x48dd59[_0x4d06('0x12')](0xc8)[_0x4d06('0x13')](_0x81185b);}};exports['fetch']=function(_0x1f1fb7,_0x5156b5){return git[_0x4d06('0x14')]([_0x4d06('0x15'),'master'],function(_0x2eebeb){if(_0x2eebeb){logger['error'](_0x2eebeb);return _0x5156b5['status'](0x1f4)[_0x4d06('0x13')](_0x2eebeb);}logger[_0x4d06('0x16')]('git\x20fetch');return _0x5156b5[_0x4d06('0x12')](0xc8)[_0x4d06('0x13')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x4d06('0x17')]=function(_0x482f97,_0x54639b){return git['reset'](['--hard',_0x4d06('0x18')],function(_0x203825){if(_0x203825){logger[_0x4d06('0x19')](_0x203825);return _0x54639b[_0x4d06('0x12')](0x1f4)[_0x4d06('0x13')](_0x203825);}logger['info']('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x54639b[_0x4d06('0x12')](0xc8)[_0x4d06('0x13')]({'output':_0x4d06('0x1a')});});};exports[_0x4d06('0x1b')]=function(_0x1939c2,_0x483176){exec(_0x4d06('0x1c'),function(_0x26e86e,_0x5d44c1,_0x4c5c81){logger[_0x4d06('0x16')](_0x5d44c1);logger[_0x4d06('0x16')](_0x4c5c81);if(_0x26e86e){logger['error'](_0x26e86e);return _0x483176[_0x4d06('0x12')](0x1f4)[_0x4d06('0x13')](_0x26e86e);}return _0x483176[_0x4d06('0x12')](0xc8)['json']({'output':_0x5d44c1});});};exports[_0x4d06('0x1d')]=function(_0x3bd9d5,_0x4736f9){return pm2[_0x4d06('0x1d')](_0x4d06('0x1e'))[_0x4d06('0x1f')](function(_0x2e03c9){logger[_0x4d06('0x16')]('pm2\x20restart\x20motion\x20%s',_0x2e03c9);return _0x4736f9[_0x4d06('0x12')](0xc8)[_0x4d06('0x13')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x4d06('0x20')](function(_0x4e1c13){logger[_0x4d06('0x19')](_0x4e1c13);return _0x4736f9[_0x4d06('0x12')](0x1f4)[_0x4d06('0x13')](_0x4e1c13);});};exports[_0x4d06('0x21')]=function(_0x52e0eb,_0x112f8e){var _0x348e33=fs[_0x4d06('0x22')](path[_0x4d06('0x23')](config['root'],_0x4d06('0x24'),_0x4d06('0x21')));var _0x4048b8=[];for(var _0x13372d=0x0;_0x13372d<_0x348e33[_0x4d06('0x25')];_0x13372d++){var _0x36870a=_0x348e33[_0x13372d][_0x4d06('0x26')](_0x4d06('0x27'),'');if(compareVersions(module[_0x4d06('0xe')][_0x4d06('0x4')],_0x36870a)===-0x1){_0x4048b8[_0x4d06('0x28')](_0x36870a);}}if(_0x4048b8['length']){var _0x3b6f15=_0x4048b8[_0x4d06('0x29')](compareVersions);var _0x12bbf6=new Umzug({'storage':_0x4d06('0x2a'),'storageOptions':{'model':db['Migration'],'modelName':_0x4d06('0x2b'),'columnName':'version'},'migrations':{'params':[db['sequelize'][_0x4d06('0x2c')](),db[_0x4d06('0x2a')][_0x4d06('0x2d')],function(){throw new Error(_0x4d06('0x2e'));}],'path':path['join'](config[_0x4d06('0xc')],_0x4d06('0x24'),_0x4d06('0x21')),'pattern':/\.js$/}});_0x12bbf6['up']({'migrations':_['map'](_0x3b6f15,function(_0x54e863){return _0x54e863+_0x4d06('0x27');})})['then'](function(){return _0x112f8e[_0x4d06('0x12')](0xc8)[_0x4d06('0x13')]({'output':_0x4d06('0x2f')+module[_0x4d06('0xe')][_0x4d06('0x4')]+_0x4d06('0x30')+_[_0x4d06('0x31')](_0x3b6f15),'migrations':_[_0x4d06('0x23')](_0x3b6f15)});})[_0x4d06('0x20')](function(_0x130738){if(_0x130738 instanceof db[_0x4d06('0x2a')][_0x4d06('0x32')]){return _0x112f8e[_0x4d06('0x12')](0xc8)[_0x4d06('0x13')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x112f8e[_0x4d06('0x12')](0x1f4)['json'](_0x130738);}});}else{return _0x112f8e[_0x4d06('0x12')](0xc8)[_0x4d06('0x13')]({'output':_0x4d06('0x33')});}}; \ No newline at end of file +var _0x0f28=['--hard','FETCH_HEAD','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','join','server','length','.js','exports','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','compare-versions','exec','../../mysqldb','../../config/pm2','../../config/logger','update','simple-git','root','version','query','latest','fetch','tags','json','status','origin','master','info','git\x20fetch','reset'];(function(_0x54deb9,_0x53e74b){var _0x5da9aa=function(_0x45dca8){while(--_0x45dca8){_0x54deb9['push'](_0x54deb9['shift']());}};_0x5da9aa(++_0x53e74b);}(_0x0f28,0x87));var _0x80f2=function(_0x19dd8a,_0x4af545){_0x19dd8a=_0x19dd8a-0x0;var _0x6245d3=_0x0f28[_0x19dd8a];return _0x6245d3;};'use strict';var Umzug=require(_0x80f2('0x0'));var path=require(_0x80f2('0x1'));var fs=require('fs');var _=require(_0x80f2('0x2'));var pkginfo=require(_0x80f2('0x3'))(module,'version');var compareVersions=require(_0x80f2('0x4'));var exec=require('child_process')[_0x80f2('0x5')];var db=require(_0x80f2('0x6'))['db'];var config=require('../../config/environment');var pm2=require(_0x80f2('0x7'));var logger=require(_0x80f2('0x8'))(_0x80f2('0x9'));var git=require(_0x80f2('0xa'))(config[_0x80f2('0xb')]);exports['index']=function(_0x39c943,_0x2e1169){var _0x101678={'current':module['exports'][_0x80f2('0xc')],'phonebar':0x2};if(_0x39c943[_0x80f2('0xd')]&&_0x39c943[_0x80f2('0xd')][_0x80f2('0xe')]){return git[_0x80f2('0xf')]()[_0x80f2('0x10')](function(_0x49a11f,_0x54a79c){_0x101678[_0x80f2('0xe')]=(_0x49a11f?module['exports']['version']:_0x54a79c['latest'])||'2.0.0';return _0x2e1169['status'](0xc8)[_0x80f2('0x11')](_0x101678);});}else{return _0x2e1169[_0x80f2('0x12')](0xc8)[_0x80f2('0x11')](_0x101678);}};exports['fetch']=function(_0x11e072,_0x216c00){return git[_0x80f2('0xf')]([_0x80f2('0x13'),_0x80f2('0x14')],function(_0x1ebd42){if(_0x1ebd42){logger['error'](_0x1ebd42);return _0x216c00['status'](0x1f4)[_0x80f2('0x11')](_0x1ebd42);}logger[_0x80f2('0x15')](_0x80f2('0x16'));return _0x216c00[_0x80f2('0x12')](0xc8)[_0x80f2('0x11')]({'output':'git\x20fetch\x20origin\x20master'});});};exports['reset']=function(_0x1eb166,_0x248b56){return git[_0x80f2('0x17')]([_0x80f2('0x18'),_0x80f2('0x19')],function(_0x50de4a){if(_0x50de4a){logger[_0x80f2('0x1a')](_0x50de4a);return _0x248b56[_0x80f2('0x12')](0x1f4)['json'](_0x50de4a);}logger['info'](_0x80f2('0x1b'));return _0x248b56['status'](0xc8)[_0x80f2('0x11')]({'output':_0x80f2('0x1c')});});};exports[_0x80f2('0x1d')]=function(_0x4f3964,_0x1a2aa8){exec(_0x80f2('0x1e'),function(_0x5a2845,_0x275f08,_0x292a27){logger[_0x80f2('0x15')](_0x275f08);logger[_0x80f2('0x15')](_0x292a27);if(_0x5a2845){logger[_0x80f2('0x1a')](_0x5a2845);return _0x1a2aa8[_0x80f2('0x12')](0x1f4)[_0x80f2('0x11')](_0x5a2845);}return _0x1a2aa8[_0x80f2('0x12')](0xc8)[_0x80f2('0x11')]({'output':_0x275f08});});};exports[_0x80f2('0x1f')]=function(_0x38b2cd,_0x16539b){return pm2[_0x80f2('0x1f')]('motion2')[_0x80f2('0x20')](function(_0x11cfef){logger[_0x80f2('0x15')](_0x80f2('0x21'),_0x11cfef);return _0x16539b[_0x80f2('0x12')](0xc8)[_0x80f2('0x11')]({'output':_0x80f2('0x22')});})['catch'](function(_0x23a628){logger[_0x80f2('0x1a')](_0x23a628);return _0x16539b[_0x80f2('0x12')](0x1f4)[_0x80f2('0x11')](_0x23a628);});};exports[_0x80f2('0x23')]=function(_0x29f74c,_0x191c5e){var _0x56b005=fs[_0x80f2('0x24')](path[_0x80f2('0x25')](config[_0x80f2('0xb')],_0x80f2('0x26'),_0x80f2('0x23')));var _0xe4363c=[];for(var _0x135bcb=0x0;_0x135bcb<_0x56b005[_0x80f2('0x27')];_0x135bcb++){var _0x3eb01e=_0x56b005[_0x135bcb]['replace'](_0x80f2('0x28'),'');if(compareVersions(module[_0x80f2('0x29')][_0x80f2('0xc')],_0x3eb01e)===-0x1){_0xe4363c[_0x80f2('0x2a')](_0x3eb01e);}}if(_0xe4363c['length']){var _0x4a0a99=_0xe4363c[_0x80f2('0x2b')](compareVersions);var _0x207b1b=new Umzug({'storage':_0x80f2('0x2c'),'storageOptions':{'model':db[_0x80f2('0x2d')],'modelName':_0x80f2('0x2d'),'columnName':'version'},'migrations':{'params':[db[_0x80f2('0x2c')][_0x80f2('0x2e')](),db[_0x80f2('0x2c')][_0x80f2('0x2f')],function(){throw new Error(_0x80f2('0x30'));}],'path':path['join'](config[_0x80f2('0xb')],_0x80f2('0x26'),'migrations'),'pattern':/\.js$/}});_0x207b1b['up']({'migrations':_[_0x80f2('0x31')](_0x4a0a99,function(_0x5629b5){return _0x5629b5+_0x80f2('0x28');})})['then'](function(){return _0x191c5e['status'](0xc8)[_0x80f2('0x11')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x80f2('0x29')][_0x80f2('0xc')]+'\x20to\x20'+_['last'](_0x4a0a99),'migrations':_['join'](_0x4a0a99)});})[_0x80f2('0x32')](function(_0x1d26fd){if(_0x1d26fd instanceof db[_0x80f2('0x2c')][_0x80f2('0x33')]){return _0x191c5e['status'](0xc8)[_0x80f2('0x11')]({'output':_0x80f2('0x34')});}else{return _0x191c5e[_0x80f2('0x12')](0x1f4)[_0x80f2('0x11')](_0x1d26fd);}});}else{return _0x191c5e[_0x80f2('0x12')](0xc8)[_0x80f2('0x11')]({'output':_0x80f2('0x34')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index fb5f672..a3e9b44 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 _0x856a=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','destroy','exports','util','path','express','Router'];(function(_0x568496,_0x565afd){var _0x26c5c1=function(_0x4d251e){while(--_0x4d251e){_0x568496['push'](_0x568496['shift']());}};_0x26c5c1(++_0x565afd);}(_0x856a,0xba));var _0xa856=function(_0x5619fa,_0x545154){_0x5619fa=_0x5619fa-0x0;var _0x4a109c=_0x856a[_0x5619fa];return _0x4a109c;};'use strict';var multer=require('multer');var util=require(_0xa856('0x0'));var path=require(_0xa856('0x1'));var timeout=require('connect-timeout');var express=require(_0xa856('0x2'));var router=express[_0xa856('0x3')]();var fs_extra=require(_0xa856('0x4'));var auth=require(_0xa856('0x5'));var interaction=require(_0xa856('0x6'));var config=require(_0xa856('0x7'));var controller=require('./voiceAgentReport.controller');router[_0xa856('0x8')]('/',auth[_0xa856('0x9')](),controller['index']);router[_0xa856('0x8')](_0xa856('0xa'),auth[_0xa856('0x9')](),controller[_0xa856('0xb')]);router[_0xa856('0x8')](_0xa856('0xc'),auth[_0xa856('0x9')](),controller[_0xa856('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa856('0xe')]);router[_0xa856('0xf')](_0xa856('0xc'),auth['isAuthenticated'](),controller[_0xa856('0x10')]);router['delete'](_0xa856('0xc'),auth[_0xa856('0x9')](),controller[_0xa856('0x11')]);module[_0xa856('0x12')]=router; \ No newline at end of file +var _0x23b0=['put','update','delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','index','describe','/:id','show','create'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x23b0,0x1f2));var _0x023b=function(_0x4bb5dd,_0x3dd76a){_0x4bb5dd=_0x4bb5dd-0x0;var _0x27fcca=_0x23b0[_0x4bb5dd];return _0x27fcca;};'use strict';var multer=require('multer');var util=require(_0x023b('0x0'));var path=require('path');var timeout=require(_0x023b('0x1'));var express=require(_0x023b('0x2'));var router=express[_0x023b('0x3')]();var fs_extra=require(_0x023b('0x4'));var auth=require(_0x023b('0x5'));var interaction=require(_0x023b('0x6'));var config=require('../../config/environment');var controller=require(_0x023b('0x7'));router[_0x023b('0x8')]('/',auth[_0x023b('0x9')](),controller[_0x023b('0xa')]);router[_0x023b('0x8')]('/describe',auth[_0x023b('0x9')](),controller[_0x023b('0xb')]);router['get'](_0x023b('0xc'),auth[_0x023b('0x9')](),controller[_0x023b('0xd')]);router['post']('/',auth[_0x023b('0x9')](),controller[_0x023b('0xe')]);router[_0x023b('0xf')](_0x023b('0xc'),auth['isAuthenticated'](),controller[_0x023b('0x10')]);router[_0x023b('0x11')](_0x023b('0xc'),auth[_0x023b('0x9')](),controller[_0x023b('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 4abd5fb..fe06bc9 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 _0x4f3c=['exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x537c98,_0xc28944){var _0x201915=function(_0xf1e6af){while(--_0xf1e6af){_0x537c98['push'](_0x537c98['shift']());}};_0x201915(++_0xc28944);}(_0x4f3c,0x15d));var _0xc4f3=function(_0x4b4d43,_0x1590f7){_0x4b4d43=_0x4b4d43-0x0;var _0x5706ba=_0x4f3c[_0x4b4d43];return _0x5706ba;};'use strict';var Sequelize=require(_0xc4f3('0x0'));module[_0xc4f3('0x1')]={'type':{'type':Sequelize[_0xc4f3('0x2')]},'uniqueid':{'type':Sequelize[_0xc4f3('0x2')]},'calleridnum':{'type':Sequelize[_0xc4f3('0x2')]},'calleridname':{'type':Sequelize[_0xc4f3('0x2')]},'queue':{'type':Sequelize[_0xc4f3('0x2')]},'interface':{'type':Sequelize[_0xc4f3('0x2')]},'membername':{'type':Sequelize[_0xc4f3('0x2')]},'agentcalledAt':{'type':Sequelize[_0xc4f3('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xc4f3('0x3')]},'agentdumpAt':{'type':Sequelize[_0xc4f3('0x3')]},'holdtime':{'type':Sequelize[_0xc4f3('0x4')]},'agentcomplete':{'type':Sequelize[_0xc4f3('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xc4f3('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xc4f3('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xc4f3('0x4')]},'agentacw':{'type':Sequelize[_0xc4f3('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc4f3('0x4')]},'reason':{'type':Sequelize[_0xc4f3('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xc4f3('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xc4f3('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xc4f3('0x2')]},'accountcode':{'type':Sequelize[_0xc4f3('0x2')]},'context':{'type':Sequelize[_0xc4f3('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xc4f3('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xc4f3('0x2')]},'destcalleridname':{'type':Sequelize[_0xc4f3('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xc4f3('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xc4f3('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xc4f3('0x2')]},'destcontext':{'type':Sequelize[_0xc4f3('0x2')]},'destexten':{'type':Sequelize[_0xc4f3('0x2')]},'destpriority':{'type':Sequelize[_0xc4f3('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xc4f3('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xc4f3('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xc4f3('0x2')],'comment':_0xc4f3('0x6')},'transferexten':{'type':Sequelize[_0xc4f3('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x0c71=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x0c71,0xfb));var _0x10c7=function(_0x41b292,_0x2a2ebe){_0x41b292=_0x41b292-0x0;var _0x2db04a=_0x0c71[_0x41b292];return _0x2db04a;};'use strict';var Sequelize=require('sequelize');module[_0x10c7('0x0')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x10c7('0x1')]},'calleridnum':{'type':Sequelize[_0x10c7('0x1')]},'calleridname':{'type':Sequelize[_0x10c7('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x10c7('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x10c7('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x10c7('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x10c7('0x2')]},'agentdumpAt':{'type':Sequelize[_0x10c7('0x2')]},'holdtime':{'type':Sequelize[_0x10c7('0x3')]},'agentcomplete':{'type':Sequelize[_0x10c7('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x10c7('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x10c7('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x10c7('0x3')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x10c7('0x1')]},'channelstate':{'type':Sequelize[_0x10c7('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x10c7('0x1')]},'connectedlinename':{'type':Sequelize[_0x10c7('0x1')]},'language':{'type':Sequelize[_0x10c7('0x1')]},'accountcode':{'type':Sequelize[_0x10c7('0x1')]},'context':{'type':Sequelize[_0x10c7('0x1')]},'exten':{'type':Sequelize[_0x10c7('0x1')]},'priority':{'type':Sequelize[_0x10c7('0x1')]},'destchannel':{'type':Sequelize[_0x10c7('0x1')]},'destchannelstate':{'type':Sequelize[_0x10c7('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x10c7('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x10c7('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x10c7('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x10c7('0x1')]},'destlanguage':{'type':Sequelize[_0x10c7('0x1')]},'destaccountcode':{'type':Sequelize[_0x10c7('0x1')]},'destcontext':{'type':Sequelize[_0x10c7('0x1')]},'destexten':{'type':Sequelize[_0x10c7('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x10c7('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x10c7('0x1')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x10c7('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x10c7('0x1')],'comment':_0x10c7('0x5')},'transferexten':{'type':Sequelize[_0x10c7('0x1')]},'transferuniqueid':{'type':Sequelize[_0x10c7('0x1')]},'agententerreason':{'type':Sequelize[_0x10c7('0x3')],'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 70a4f3b..b956e8d 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(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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 424722f..8de9f87 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 _0x4074=['uniqueid','destuniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','VoiceAgentReport'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x4074,0xf0));var _0x4407=function(_0x20daae,_0x2672e3){_0x20daae=_0x20daae-0x0;var _0x2d9ac2=_0x4074[_0x20daae];return _0x2d9ac2;};'use strict';var _=require(_0x4407('0x0'));var util=require(_0x4407('0x1'));var logger=require(_0x4407('0x2'))('api');var moment=require(_0x4407('0x3'));var BPromise=require(_0x4407('0x4'));var rp=require(_0x4407('0x5'));var fs=require('fs');var path=require(_0x4407('0x6'));var rimraf=require(_0x4407('0x7'));var config=require(_0x4407('0x8'));var attributes=require(_0x4407('0x9'));module[_0x4407('0xa')]=function(_0x3f085d,_0x35899d){return _0x3f085d['define'](_0x4407('0xb'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x4407('0xc'),_0x4407('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xff2a=['report_agent','uniqueid','destuniqueid','util','../../config/logger','moment','bluebird','path','../../config/environment','./voiceAgentReport.attributes','define','VoiceAgentReport'];(function(_0x2f47e5,_0x1f48d4){var _0x6de24b=function(_0x4fca07){while(--_0x4fca07){_0x2f47e5['push'](_0x2f47e5['shift']());}};_0x6de24b(++_0x1f48d4);}(_0xff2a,0x93));var _0xaff2=function(_0x4f1af9,_0xc95c63){_0x4f1af9=_0x4f1af9-0x0;var _0x11a60e=_0xff2a[_0x4f1af9];return _0x11a60e;};'use strict';var _=require('lodash');var util=require(_0xaff2('0x0'));var logger=require(_0xaff2('0x1'))('api');var moment=require(_0xaff2('0x2'));var BPromise=require(_0xaff2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaff2('0x4'));var rimraf=require('rimraf');var config=require(_0xaff2('0x5'));var attributes=require(_0xaff2('0x6'));module['exports']=function(_0x70cadf,_0x8313e5){return _0x70cadf[_0xaff2('0x7')](_0xaff2('0x8'),attributes,{'tableName':_0xaff2('0x9'),'paranoid':![],'indexes':[{'fields':[_0xaff2('0xa'),_0xaff2('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index d3ff936..f4eddca 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 _0x0d42=['client','http','request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateVoiceAgentReport','create','body','options','raw','then','catch','UpdateVoiceAgentReport','VoiceAgentReport','update','where','attributes','limit','util','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x47ffe0,_0x5ce36d){var _0xa45fbf=function(_0x2afbee){while(--_0x2afbee){_0x47ffe0['push'](_0x47ffe0['shift']());}};_0xa45fbf(++_0x5ce36d);}(_0x0d42,0x1ac));var _0x20d4=function(_0x109f48,_0x40847c){_0x109f48=_0x109f48-0x0;var _0x197fff=_0x0d42[_0x109f48];return _0x197fff;};'use strict';var _=require('lodash');var util=require(_0x20d4('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x20d4('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x20d4('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x20d4('0x3'))('rpc');var config=require(_0x20d4('0x4'));var jayson=require(_0x20d4('0x5'));var client=jayson[_0x20d4('0x6')][_0x20d4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4dd418,_0x192233,_0x2f6c6b){return new BPromise(function(_0x1c687,_0x28e1f6){return client[_0x20d4('0x8')](_0x4dd418,_0x2f6c6b)['then'](function(_0x3bf7e9){logger[_0x20d4('0x9')](_0x20d4('0xa'),_0x192233,_0x20d4('0xb'));logger[_0x20d4('0xc')](_0x20d4('0xd'),_0x192233,_0x20d4('0xb'),JSON[_0x20d4('0xe')](_0x3bf7e9));if(_0x3bf7e9[_0x20d4('0xf')]){if(_0x3bf7e9['error']['code']===0x1f4){logger[_0x20d4('0xf')](_0x20d4('0xa'),_0x192233,_0x3bf7e9[_0x20d4('0xf')]['message']);return _0x28e1f6(_0x3bf7e9[_0x20d4('0xf')][_0x20d4('0x10')]);}logger[_0x20d4('0xf')](_0x20d4('0xa'),_0x192233,_0x3bf7e9['error'][_0x20d4('0x10')]);return _0x1c687(_0x3bf7e9[_0x20d4('0xf')][_0x20d4('0x10')]);}else{logger[_0x20d4('0x9')]('VoiceAgentReport,\x20%s,\x20%s',_0x192233,'request\x20sent');_0x1c687(_0x3bf7e9[_0x20d4('0x11')][_0x20d4('0x10')]);}})['catch'](function(_0x5182c3){logger[_0x20d4('0xf')](_0x20d4('0xa'),_0x192233,_0x5182c3);_0x28e1f6(_0x5182c3);});});}exports[_0x20d4('0x12')]=function(_0x44a8e2){var _0x579d84=this;return new Promise(function(_0x37e2ff,_0x5e7b34){return db['VoiceAgentReport'][_0x20d4('0x13')](_0x44a8e2[_0x20d4('0x14')],{'raw':_0x44a8e2[_0x20d4('0x15')]?_0x44a8e2[_0x20d4('0x15')][_0x20d4('0x16')]===undefined?!![]:![]:!![]})[_0x20d4('0x17')](function(_0xaece2b){logger[_0x20d4('0x9')](_0x20d4('0x12'),_0x44a8e2);logger[_0x20d4('0xc')](_0x20d4('0x12'),_0x44a8e2,JSON[_0x20d4('0xe')](_0xaece2b));_0x37e2ff(_0xaece2b);})[_0x20d4('0x18')](function(_0x2240a6){logger[_0x20d4('0xf')]('CreateVoiceAgentReport',_0x2240a6[_0x20d4('0x10')],_0x44a8e2);_0x5e7b34(_0x579d84[_0x20d4('0xf')](0x1f4,_0x2240a6[_0x20d4('0x10')]));});});};exports[_0x20d4('0x19')]=function(_0x5028c0){var _0x14d590=this;return new Promise(function(_0x4aaae0,_0xf25a61){return db[_0x20d4('0x1a')][_0x20d4('0x1b')](_0x5028c0['body'],{'raw':_0x5028c0[_0x20d4('0x15')]?_0x5028c0['options'][_0x20d4('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5028c0[_0x20d4('0x15')]?_0x5028c0['options'][_0x20d4('0x1c')]||null:null,'attributes':_0x5028c0[_0x20d4('0x15')]?_0x5028c0['options'][_0x20d4('0x1d')]||null:null,'limit':_0x5028c0['options']?_0x5028c0['options'][_0x20d4('0x1e')]||null:null})['then'](function(_0x196d66){logger[_0x20d4('0x9')](_0x20d4('0x19'),_0x5028c0);logger[_0x20d4('0xc')]('UpdateVoiceAgentReport',_0x5028c0,JSON[_0x20d4('0xe')](_0x196d66));_0x4aaae0(_0x196d66);})[_0x20d4('0x18')](function(_0x4e03ee){logger[_0x20d4('0xf')]('UpdateVoiceAgentReport',_0x4e03ee[_0x20d4('0x10')],_0x5028c0);_0xf25a61(_0x14d590[_0x20d4('0xf')](0x1f4,_0x4e03ee[_0x20d4('0x10')]));});});}; \ No newline at end of file +var _0xdf80=['UpdateVoiceAgentReport','VoiceAgentReport','update','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','create','body','options','raw','CreateVoiceAgentReport'];(function(_0x23733d,_0x56f0a1){var _0x4a9cc4=function(_0x26f9ab){while(--_0x26f9ab){_0x23733d['push'](_0x23733d['shift']());}};_0x4a9cc4(++_0x56f0a1);}(_0xdf80,0xbf));var _0x0df8=function(_0x509dad,_0x1f995f){_0x509dad=_0x509dad-0x0;var _0x21e122=_0xdf80[_0x509dad];return _0x21e122;};'use strict';var _=require('lodash');var util=require(_0x0df8('0x0'));var moment=require(_0x0df8('0x1'));var BPromise=require(_0x0df8('0x2'));var rs=require(_0x0df8('0x3'));var fs=require('fs');var Redis=require(_0x0df8('0x4'));var db=require(_0x0df8('0x5'))['db'];var utils=require(_0x0df8('0x6'));var logger=require(_0x0df8('0x7'))(_0x0df8('0x8'));var config=require(_0x0df8('0x9'));var jayson=require(_0x0df8('0xa'));var client=jayson[_0x0df8('0xb')][_0x0df8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x339dd9,_0x5b0e7e,_0x52afad){return new BPromise(function(_0x5727dd,_0x2b324b){return client[_0x0df8('0xd')](_0x339dd9,_0x52afad)[_0x0df8('0xe')](function(_0x15e90f){logger[_0x0df8('0xf')](_0x0df8('0x10'),_0x5b0e7e,'request\x20sent');logger[_0x0df8('0x11')](_0x0df8('0x12'),_0x5b0e7e,_0x0df8('0x13'),JSON[_0x0df8('0x14')](_0x15e90f));if(_0x15e90f[_0x0df8('0x15')]){if(_0x15e90f[_0x0df8('0x15')][_0x0df8('0x16')]===0x1f4){logger['error'](_0x0df8('0x10'),_0x5b0e7e,_0x15e90f[_0x0df8('0x15')]['message']);return _0x2b324b(_0x15e90f[_0x0df8('0x15')]['message']);}logger['error'](_0x0df8('0x10'),_0x5b0e7e,_0x15e90f[_0x0df8('0x15')][_0x0df8('0x17')]);return _0x5727dd(_0x15e90f['error'][_0x0df8('0x17')]);}else{logger[_0x0df8('0xf')](_0x0df8('0x10'),_0x5b0e7e,_0x0df8('0x13'));_0x5727dd(_0x15e90f[_0x0df8('0x18')][_0x0df8('0x17')]);}})[_0x0df8('0x19')](function(_0x1bf85c){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x5b0e7e,_0x1bf85c);_0x2b324b(_0x1bf85c);});});}exports['CreateVoiceAgentReport']=function(_0x2e7587){var _0x4c4a22=this;return new Promise(function(_0x488a43,_0x310eaa){return db['VoiceAgentReport'][_0x0df8('0x1a')](_0x2e7587[_0x0df8('0x1b')],{'raw':_0x2e7587[_0x0df8('0x1c')]?_0x2e7587[_0x0df8('0x1c')][_0x0df8('0x1d')]===undefined?!![]:![]:!![]})[_0x0df8('0xe')](function(_0x889dee){logger[_0x0df8('0xf')](_0x0df8('0x1e'),_0x2e7587);logger[_0x0df8('0x11')]('CreateVoiceAgentReport',_0x2e7587,JSON[_0x0df8('0x14')](_0x889dee));_0x488a43(_0x889dee);})[_0x0df8('0x19')](function(_0x32833b){logger[_0x0df8('0x15')]('CreateVoiceAgentReport',_0x32833b[_0x0df8('0x17')],_0x2e7587);_0x310eaa(_0x4c4a22[_0x0df8('0x15')](0x1f4,_0x32833b[_0x0df8('0x17')]));});});};exports[_0x0df8('0x1f')]=function(_0x2c892a){var _0x19922f=this;return new Promise(function(_0x4ccf80,_0x1b5400){return db[_0x0df8('0x20')][_0x0df8('0x21')](_0x2c892a[_0x0df8('0x1b')],{'raw':_0x2c892a['options']?_0x2c892a['options'][_0x0df8('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c892a[_0x0df8('0x1c')]?_0x2c892a[_0x0df8('0x1c')][_0x0df8('0x22')]||null:null,'attributes':_0x2c892a[_0x0df8('0x1c')]?_0x2c892a['options'][_0x0df8('0x23')]||null:null,'limit':_0x2c892a[_0x0df8('0x1c')]?_0x2c892a[_0x0df8('0x1c')][_0x0df8('0x24')]||null:null})[_0x0df8('0xe')](function(_0x4705e8){logger[_0x0df8('0xf')](_0x0df8('0x1f'),_0x2c892a);logger[_0x0df8('0x11')](_0x0df8('0x1f'),_0x2c892a,JSON[_0x0df8('0x14')](_0x4705e8));_0x4ccf80(_0x4705e8);})[_0x0df8('0x19')](function(_0x53d43e){logger[_0x0df8('0x15')](_0x0df8('0x1f'),_0x53d43e[_0x0df8('0x17')],_0x2c892a);_0x1b5400(_0x19922f[_0x0df8('0x15')](0x1f4,_0x53d43e['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index af088d2..5d98793 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 _0x55ca=['create','put','update','delete','destroy','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x1a38de,_0x3d2192){var _0x4d4729=function(_0x442f66){while(--_0x442f66){_0x1a38de['push'](_0x1a38de['shift']());}};_0x4d4729(++_0x3d2192);}(_0x55ca,0x126));var _0xa55c=function(_0x5fe7ce,_0x1a0d39){_0x5fe7ce=_0x5fe7ce-0x0;var _0x3b5793=_0x55ca[_0x5fe7ce];return _0x3b5793;};'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')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xe')]);router[_0xa55c('0xf')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x10')]);module['exports']=router; \ No newline at end of file +var _0x2d17=['destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','index','isAuthenticated','describe','show','post','create','put','/:id','update','delete'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x2d17,0x17e));var _0x72d1=function(_0x4bdffb,_0x3b2e2e){_0x4bdffb=_0x4bdffb-0x0;var _0x3851c5=_0x2d17[_0x4bdffb];return _0x3851c5;};'use strict';var multer=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var path=require('path');var timeout=require(_0x72d1('0x2'));var express=require(_0x72d1('0x3'));var router=express['Router']();var fs_extra=require(_0x72d1('0x4'));var auth=require(_0x72d1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x72d1('0x6'));var controller=require('./voiceCallReport.controller');router[_0x72d1('0x7')]('/',auth['isAuthenticated'](),controller[_0x72d1('0x8')]);router[_0x72d1('0x7')]('/describe',auth[_0x72d1('0x9')](),controller[_0x72d1('0xa')]);router[_0x72d1('0x7')]('/:id',auth[_0x72d1('0x9')](),controller[_0x72d1('0xb')]);router[_0x72d1('0xc')]('/',auth['isAuthenticated'](),controller[_0x72d1('0xd')]);router[_0x72d1('0xe')](_0x72d1('0xf'),auth[_0x72d1('0x9')](),controller[_0x72d1('0x10')]);router[_0x72d1('0x11')](_0x72d1('0xf'),auth[_0x72d1('0x9')](),controller[_0x72d1('0x12')]);module[_0x72d1('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 5cdaaea..39ac732 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 _0xa6ea=['DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','internal','outbound','outbound-fax','dialer','TEXT'];(function(_0x417675,_0x31161b){var _0xab10f2=function(_0x18fd54){while(--_0x18fd54){_0x417675['push'](_0x417675['shift']());}};_0xab10f2(++_0x31161b);}(_0xa6ea,0x122));var _0xaa6e=function(_0x49e15f,_0x235d8d){_0x49e15f=_0x49e15f-0x0;var _0x43d5ac=_0xa6ea[_0x49e15f];return _0x43d5ac;};'use strict';var Sequelize=require(_0xaa6e('0x0'));module[_0xaa6e('0x1')]={'uniqueid':{'type':Sequelize[_0xaa6e('0x2')]},'type':{'type':Sequelize[_0xaa6e('0x3')](_0xaa6e('0x4'),_0xaa6e('0x5'),_0xaa6e('0x6'),'inbound-fax',_0xaa6e('0x7'),_0xaa6e('0x8'))},'tag':{'type':Sequelize[_0xaa6e('0x2')]},'accountcode':{'type':Sequelize[_0xaa6e('0x2')]},'source':{'type':Sequelize[_0xaa6e('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xaa6e('0x2')]},'channel':{'type':Sequelize[_0xaa6e('0x2')]},'destinationchannel':{'type':Sequelize[_0xaa6e('0x2')]},'lastapplication':{'type':Sequelize[_0xaa6e('0x2')]},'lastdata':{'type':Sequelize[_0xaa6e('0x9')]},'starttime':{'type':Sequelize[_0xaa6e('0xa')]},'systemanswertime':{'type':Sequelize[_0xaa6e('0xa')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xaa6e('0xa')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xaa6e('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xaa6e('0x2')]},'userDisposition':{'type':Sequelize[_0xaa6e('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0xaa6e('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xaa6e('0x2')]},'routeid':{'type':Sequelize[_0xaa6e('0xb')]},'sipcallid':{'type':Sequelize[_0xaa6e('0x2')]}}; \ No newline at end of file +var _0xfcbb=['exports','STRING','internal','outbound','inbound-fax','outbound-fax','dialer','DATE','INTEGER','sequelize'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x1d6ac6,_0x119c79){_0x1d6ac6=_0x1d6ac6-0x0;var _0x4dfcb2=_0xfcbb[_0x1d6ac6];return _0x4dfcb2;};'use strict';var Sequelize=require(_0xbfcb('0x0'));module[_0xbfcb('0x1')]={'uniqueid':{'type':Sequelize[_0xbfcb('0x2')]},'type':{'type':Sequelize['ENUM']('inbound',_0xbfcb('0x3'),_0xbfcb('0x4'),_0xbfcb('0x5'),_0xbfcb('0x6'),_0xbfcb('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0xbfcb('0x2')]},'destination':{'type':Sequelize[_0xbfcb('0x2')]},'destinationcontext':{'type':Sequelize[_0xbfcb('0x2')]},'callerid':{'type':Sequelize[_0xbfcb('0x2')]},'channel':{'type':Sequelize[_0xbfcb('0x2')]},'destinationchannel':{'type':Sequelize[_0xbfcb('0x2')]},'lastapplication':{'type':Sequelize[_0xbfcb('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xbfcb('0x8')]},'systemanswertime':{'type':Sequelize[_0xbfcb('0x8')]},'answertime':{'type':Sequelize[_0xbfcb('0x8')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0xbfcb('0x9')]},'billableseconds':{'type':Sequelize[_0xbfcb('0x9')]},'mohtime':{'type':Sequelize[_0xbfcb('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xbfcb('0x2')]},'amaflags':{'type':Sequelize[_0xbfcb('0x2')]},'userfield':{'type':Sequelize[_0xbfcb('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xbfcb('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xbfcb('0x2')]},'note':{'type':Sequelize[_0xbfcb('0x2')]},'prefix':{'type':Sequelize[_0xbfcb('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0xbfcb('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 2d4f294..24ecc2a 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 _0x0b0e=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','fullname','alias','User','findAll','rows','params','find','create','body','catch','describe','update','uniqueid','user','eml-format','zip-dir','request-promise','moment'];(function(_0x349f3e,_0x3b4ff2){var _0x41a299=function(_0x15fcc7){while(--_0x15fcc7){_0x349f3e['push'](_0x349f3e['shift']());}};_0x41a299(++_0x3b4ff2);}(_0x0b0e,0x187));var _0xe0b0=function(_0x378720,_0xa711f1){_0x378720=_0x378720-0x0;var _0x47920a=_0x0b0e[_0x378720];return _0x47920a;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['VoiceCallReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'attributes':['id',_0xe0b0('0x27'),_0xe0b0('0x41'),_0xe0b0('0x42')],'model':db[_0xe0b0('0x43')],'as':_0xe0b0('0x43')}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x44')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x52ffe4){_0x36d137[_0xe0b0('0x45')]=_0x52ffe4;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))['catch'](handleError(_0x5b7a64,null));};exports['show']=function(_0x327fb4,_0x247f8d){var _0x56e7df={'raw':!![],'where':{'id':_0x327fb4[_0xe0b0('0x46')]['id']}},_0x18a59d={};_0x18a59d[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db[_0xe0b0('0x2a')]['rawAttributes']);_0x18a59d['query']=_['keys'](_0x327fb4[_0xe0b0('0x2e')]);_0x18a59d[_0xe0b0('0x39')]=_['intersection'](_0x18a59d[_0xe0b0('0x31')],_0x18a59d[_0xe0b0('0x2e')]);_0x56e7df[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x18a59d[_0xe0b0('0x31')],qs['fields'](_0x327fb4['query'][_0xe0b0('0x33')]));_0x56e7df[_0xe0b0('0x32')]=_0x56e7df[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x56e7df[_0xe0b0('0x32')]:_0x18a59d['model'];if(_0x327fb4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x56e7df['include']=[{'all':!![]}];}_0x56e7df=_['merge']({},_0x56e7df,_0x327fb4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x47')](_0x56e7df)[_0xe0b0('0x23')](handleEntityNotFound(_0x247f8d,null))[_0xe0b0('0x23')](respondWithResult(_0x247f8d,null))['catch'](handleError(_0x247f8d,null));};exports[_0xe0b0('0x48')]=function(_0x87d8f3,_0x483f12){return db['VoiceCallReport'][_0xe0b0('0x48')](_0x87d8f3[_0xe0b0('0x49')],{})['then'](respondWithResult(_0x483f12,0xc9))[_0xe0b0('0x4a')](handleError(_0x483f12,null));};exports[_0xe0b0('0x24')]=function(_0x504284,_0x5cb2b6){return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x504284[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5cb2b6,null))[_0xe0b0('0x23')](removeEntity(_0x5cb2b6,null))[_0xe0b0('0x4a')](handleError(_0x5cb2b6,null));};exports[_0xe0b0('0x4b')]=function(_0xf9e694,_0x5f5486){return db['VoiceCallReport'][_0xe0b0('0x4b')]()['then'](respondWithResult(_0x5f5486,null))['catch'](handleError(_0x5f5486,null));};exports[_0xe0b0('0x4c')]=function(_0x222174,_0x54cf7b){if(_0x222174['body'][_0xe0b0('0x4d')]){delete _0x222174[_0xe0b0('0x49')][_0xe0b0('0x4d')];}return db[_0xe0b0('0x2a')][_0xe0b0('0x47')]({'where':{'uniqueid':_0x222174[_0xe0b0('0x46')]['id'],'UserId':{'$or':[null,_0x222174[_0xe0b0('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x54cf7b,null))[_0xe0b0('0x23')](saveUpdates(_0x222174['body'],null))[_0xe0b0('0x23')](respondWithResult(_0x54cf7b,null))['catch'](handleError(_0x54cf7b,null));}; \ No newline at end of file +var _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x2ef3,0xba));var _0x32ef=function(_0x27f696,_0x5585fa){_0x27f696=_0x27f696-0x0;var _0x1e9841=_0x2ef3[_0x27f696];return _0x1e9841;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['VoiceCallReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index cf4a854..7b9ceb8 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 _0x20ce=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash'];(function(_0x489be6,_0x422c90){var _0x2cb375=function(_0x52ce01){while(--_0x52ce01){_0x489be6['push'](_0x489be6['shift']());}};_0x2cb375(++_0x422c90);}(_0x20ce,0x10d));var _0xe20c=function(_0x1bde43,_0x482f91){_0x1bde43=_0x1bde43-0x0;var _0x419e6b=_0x20ce[_0x1bde43];return _0x419e6b;};'use strict';var _=require(_0xe20c('0x0'));var util=require(_0xe20c('0x1'));var logger=require(_0xe20c('0x2'))('api');var moment=require(_0xe20c('0x3'));var BPromise=require(_0xe20c('0x4'));var rp=require(_0xe20c('0x5'));var fs=require('fs');var path=require(_0xe20c('0x6'));var rimraf=require(_0xe20c('0x7'));var config=require(_0xe20c('0x8'));var attributes=require(_0xe20c('0x9'));module[_0xe20c('0xa')]=function(_0x373f9f,_0x2c9e6a){return _0x373f9f[_0xe20c('0xb')](_0xe20c('0xc'),attributes,{'tableName':_0xe20c('0xd'),'paranoid':![],'indexes':[{'fields':[_0xe20c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x867e=['exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./voiceCallReport.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x867e,0x6d));var _0xe867=function(_0x3ec325,_0x111632){_0x3ec325=_0x3ec325-0x0;var _0x11c2b6=_0x867e[_0x3ec325];return _0x11c2b6;};'use strict';var _=require(_0xe867('0x0'));var util=require(_0xe867('0x1'));var logger=require(_0xe867('0x2'))(_0xe867('0x3'));var moment=require(_0xe867('0x4'));var BPromise=require(_0xe867('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe867('0x6'));var attributes=require(_0xe867('0x7'));module[_0xe867('0x8')]=function(_0x25a539,_0x46cec3){return _0x25a539[_0xe867('0x9')](_0xe867('0xa'),attributes,{'tableName':_0xe867('0xb'),'paranoid':![],'indexes':[{'fields':[_0xe867('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 0b227f6..d90eb3e 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 _0x2b9e=['request','then','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','attributes','limit','include','map','model','CreateVoiceCallReport','create','body','catch','update','where','UpdateVoiceCallReport','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x44e4e1,_0x5637b2){var _0x300cd2=function(_0x189eeb){while(--_0x189eeb){_0x44e4e1['push'](_0x44e4e1['shift']());}};_0x300cd2(++_0x5637b2);}(_0x2b9e,0x11d));var _0xe2b9=function(_0x240f88,_0x3def9d){_0x240f88=_0x240f88-0x0;var _0x36f183=_0x2b9e[_0x240f88];return _0x36f183;};'use strict';var _=require(_0xe2b9('0x0'));var util=require(_0xe2b9('0x1'));var moment=require('moment');var BPromise=require(_0xe2b9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe2b9('0x3'));var db=require(_0xe2b9('0x4'))['db'];var utils=require(_0xe2b9('0x5'));var logger=require(_0xe2b9('0x6'))(_0xe2b9('0x7'));var config=require(_0xe2b9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe2b9('0x9')][_0xe2b9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8bcb2e,_0x34bf52,_0x204f49){return new BPromise(function(_0x21422d,_0x202f6b){return client[_0xe2b9('0xb')](_0x8bcb2e,_0x204f49)[_0xe2b9('0xc')](function(_0x2a01fd){logger[_0xe2b9('0xd')](_0xe2b9('0xe'),_0x34bf52,'request\x20sent');logger[_0xe2b9('0xf')](_0xe2b9('0x10'),_0x34bf52,'request\x20sent',JSON[_0xe2b9('0x11')](_0x2a01fd));if(_0x2a01fd[_0xe2b9('0x12')]){if(_0x2a01fd[_0xe2b9('0x12')]['code']===0x1f4){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x34bf52,_0x2a01fd[_0xe2b9('0x12')][_0xe2b9('0x13')]);return _0x202f6b(_0x2a01fd['error']['message']);}logger[_0xe2b9('0x12')](_0xe2b9('0xe'),_0x34bf52,_0x2a01fd['error'][_0xe2b9('0x13')]);return _0x21422d(_0x2a01fd[_0xe2b9('0x12')]['message']);}else{logger['info'](_0xe2b9('0xe'),_0x34bf52,'request\x20sent');_0x21422d(_0x2a01fd['result'][_0xe2b9('0x13')]);}})['catch'](function(_0x582eef){logger[_0xe2b9('0x12')](_0xe2b9('0xe'),_0x34bf52,_0x582eef);_0x202f6b(_0x582eef);});});}exports[_0xe2b9('0x14')]=function(_0x2fbbea){var _0x3c69c3=this;return new Promise(function(_0x32b2fa,_0x22f0fd){return db[_0xe2b9('0x15')][_0xe2b9('0x16')]({'raw':_0x2fbbea[_0xe2b9('0x17')]?_0x2fbbea[_0xe2b9('0x17')][_0xe2b9('0x18')]===undefined?!![]:![]:!![],'where':_0x2fbbea['options']?_0x2fbbea[_0xe2b9('0x17')]['where']||null:null,'attributes':_0x2fbbea[_0xe2b9('0x17')]?_0x2fbbea[_0xe2b9('0x17')][_0xe2b9('0x19')]||null:null,'limit':_0x2fbbea['options']?_0x2fbbea[_0xe2b9('0x17')][_0xe2b9('0x1a')]||null:null,'include':_0x2fbbea['options']?_0x2fbbea[_0xe2b9('0x17')][_0xe2b9('0x1b')]?_[_0xe2b9('0x1c')](_0x2fbbea['options'][_0xe2b9('0x1b')],function(_0x4bfe06){return{'model':db[_0x4bfe06['model']],'as':_0x4bfe06['as'],'attributes':_0x4bfe06['attributes'],'include':_0x4bfe06[_0xe2b9('0x1b')]?_[_0xe2b9('0x1c')](_0x4bfe06[_0xe2b9('0x1b')],function(_0x209c76){return{'model':db[_0x209c76[_0xe2b9('0x1d')]],'as':_0x209c76['as'],'attributes':_0x209c76[_0xe2b9('0x19')],'include':_0x209c76['include']?_['map'](_0x209c76[_0xe2b9('0x1b')],function(_0xa9eed2){return{'model':db[_0xa9eed2['model']],'as':_0xa9eed2['as'],'attributes':_0xa9eed2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x32b324){logger[_0xe2b9('0xd')](_0xe2b9('0x14'),_0x2fbbea);logger[_0xe2b9('0xf')](_0xe2b9('0x14'),_0x2fbbea,JSON['stringify'](_0x32b324));_0x32b2fa(_0x32b324);})['catch'](function(_0x1054bb){logger[_0xe2b9('0x12')]('GetVoiceCallReport',_0x1054bb[_0xe2b9('0x13')],_0x2fbbea);_0x22f0fd(_0x3c69c3[_0xe2b9('0x12')](0x1f4,_0x1054bb['message']));});});};exports[_0xe2b9('0x1e')]=function(_0x2c9c0d){var _0x44b230=this;return new Promise(function(_0x119f23,_0x39b8c1){return db[_0xe2b9('0x15')][_0xe2b9('0x1f')](_0x2c9c0d[_0xe2b9('0x20')],{'raw':_0x2c9c0d[_0xe2b9('0x17')]?_0x2c9c0d[_0xe2b9('0x17')][_0xe2b9('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x2f2377){logger[_0xe2b9('0xd')](_0xe2b9('0x1e'),_0x2c9c0d);logger[_0xe2b9('0xf')](_0xe2b9('0x1e'),_0x2c9c0d,JSON[_0xe2b9('0x11')](_0x2f2377));_0x119f23(_0x2f2377);})[_0xe2b9('0x21')](function(_0x35e7e1){logger[_0xe2b9('0x12')](_0xe2b9('0x1e'),_0x35e7e1[_0xe2b9('0x13')],_0x2c9c0d);_0x39b8c1(_0x44b230[_0xe2b9('0x12')](0x1f4,_0x35e7e1[_0xe2b9('0x13')]));});});};exports['UpdateVoiceCallReport']=function(_0x4448e7){var _0x27d4ae=this;return new Promise(function(_0x31a021,_0x4b456e){return db[_0xe2b9('0x15')][_0xe2b9('0x22')](_0x4448e7['body'],{'raw':_0x4448e7[_0xe2b9('0x17')]?_0x4448e7['options'][_0xe2b9('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4448e7[_0xe2b9('0x17')]?_0x4448e7[_0xe2b9('0x17')][_0xe2b9('0x23')]||null:null,'attributes':_0x4448e7[_0xe2b9('0x17')]?_0x4448e7[_0xe2b9('0x17')][_0xe2b9('0x19')]||null:null,'limit':_0x4448e7[_0xe2b9('0x17')]?_0x4448e7[_0xe2b9('0x17')][_0xe2b9('0x1a')]||null:null})[_0xe2b9('0xc')](function(_0x58352d){logger['info']('UpdateVoiceCallReport',_0x4448e7);logger[_0xe2b9('0xf')](_0xe2b9('0x24'),_0x4448e7,JSON[_0xe2b9('0x11')](_0x58352d));_0x31a021(_0x58352d);})['catch'](function(_0x44bbba){logger[_0xe2b9('0x12')](_0xe2b9('0x24'),_0x44bbba['message'],_0x4448e7);_0x4b456e(_0x27d4ae[_0xe2b9('0x12')](0x1f4,_0x44bbba[_0xe2b9('0x13')]));});});}; \ No newline at end of file +var _0x2ac1=['request','then','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceCallReport,\x20%s,\x20%s','message','info','result','catch','options','raw','where','limit','map','include','model','attributes','GetVoiceCallReport','debug','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','VoiceCallReport','update','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2ac1,0x12c));var _0x12ac=function(_0x463dd0,_0x405e8){_0x463dd0=_0x463dd0-0x0;var _0x253d37=_0x2ac1[_0x463dd0];return _0x253d37;};'use strict';var _=require(_0x12ac('0x0'));var util=require('util');var moment=require(_0x12ac('0x1'));var BPromise=require(_0x12ac('0x2'));var rs=require(_0x12ac('0x3'));var fs=require('fs');var Redis=require(_0x12ac('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x12ac('0x5'));var logger=require(_0x12ac('0x6'))(_0x12ac('0x7'));var config=require(_0x12ac('0x8'));var jayson=require(_0x12ac('0x9'));var client=jayson[_0x12ac('0xa')][_0x12ac('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2343c6,_0x5ca4b4,_0x23ca8c){return new BPromise(function(_0x58ce4c,_0x48420f){return client[_0x12ac('0xc')](_0x2343c6,_0x23ca8c)[_0x12ac('0xd')](function(_0x14f995){logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x5ca4b4,_0x12ac('0xe'));logger['debug'](_0x12ac('0xf'),_0x5ca4b4,_0x12ac('0xe'),JSON[_0x12ac('0x10')](_0x14f995));if(_0x14f995['error']){if(_0x14f995[_0x12ac('0x11')]['code']===0x1f4){logger[_0x12ac('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x5ca4b4,_0x14f995[_0x12ac('0x11')]['message']);return _0x48420f(_0x14f995[_0x12ac('0x11')]['message']);}logger[_0x12ac('0x11')](_0x12ac('0x12'),_0x5ca4b4,_0x14f995[_0x12ac('0x11')][_0x12ac('0x13')]);return _0x58ce4c(_0x14f995[_0x12ac('0x11')]['message']);}else{logger[_0x12ac('0x14')](_0x12ac('0x12'),_0x5ca4b4,'request\x20sent');_0x58ce4c(_0x14f995[_0x12ac('0x15')][_0x12ac('0x13')]);}})[_0x12ac('0x16')](function(_0x50ffbf){logger[_0x12ac('0x11')](_0x12ac('0x12'),_0x5ca4b4,_0x50ffbf);_0x48420f(_0x50ffbf);});});}exports['GetVoiceCallReport']=function(_0x1fac5e){var _0x4d5333=this;return new Promise(function(_0x151e17,_0x248f29){return db['VoiceCallReport']['findAll']({'raw':_0x1fac5e[_0x12ac('0x17')]?_0x1fac5e[_0x12ac('0x17')][_0x12ac('0x18')]===undefined?!![]:![]:!![],'where':_0x1fac5e[_0x12ac('0x17')]?_0x1fac5e['options'][_0x12ac('0x19')]||null:null,'attributes':_0x1fac5e['options']?_0x1fac5e[_0x12ac('0x17')]['attributes']||null:null,'limit':_0x1fac5e['options']?_0x1fac5e[_0x12ac('0x17')][_0x12ac('0x1a')]||null:null,'include':_0x1fac5e[_0x12ac('0x17')]?_0x1fac5e['options']['include']?_[_0x12ac('0x1b')](_0x1fac5e[_0x12ac('0x17')][_0x12ac('0x1c')],function(_0xcc733d){return{'model':db[_0xcc733d[_0x12ac('0x1d')]],'as':_0xcc733d['as'],'attributes':_0xcc733d[_0x12ac('0x1e')],'include':_0xcc733d['include']?_[_0x12ac('0x1b')](_0xcc733d[_0x12ac('0x1c')],function(_0x482313){return{'model':db[_0x482313['model']],'as':_0x482313['as'],'attributes':_0x482313[_0x12ac('0x1e')],'include':_0x482313[_0x12ac('0x1c')]?_[_0x12ac('0x1b')](_0x482313[_0x12ac('0x1c')],function(_0x667a2f){return{'model':db[_0x667a2f[_0x12ac('0x1d')]],'as':_0x667a2f['as'],'attributes':_0x667a2f[_0x12ac('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x12ac('0xd')](function(_0x352725){logger[_0x12ac('0x14')](_0x12ac('0x1f'),_0x1fac5e);logger[_0x12ac('0x20')]('GetVoiceCallReport',_0x1fac5e,JSON[_0x12ac('0x10')](_0x352725));_0x151e17(_0x352725);})['catch'](function(_0x1b070f){logger[_0x12ac('0x11')](_0x12ac('0x1f'),_0x1b070f[_0x12ac('0x13')],_0x1fac5e);_0x248f29(_0x4d5333['error'](0x1f4,_0x1b070f['message']));});});};exports[_0x12ac('0x21')]=function(_0x451c3d){var _0x5b4ee3=this;return new Promise(function(_0x1a774,_0x7d0a58){return db['VoiceCallReport'][_0x12ac('0x22')](_0x451c3d[_0x12ac('0x23')],{'raw':_0x451c3d['options']?_0x451c3d['options'][_0x12ac('0x18')]===undefined?!![]:![]:!![]})[_0x12ac('0xd')](function(_0x40dc6c){logger['info'](_0x12ac('0x21'),_0x451c3d);logger['debug'](_0x12ac('0x21'),_0x451c3d,JSON[_0x12ac('0x10')](_0x40dc6c));_0x1a774(_0x40dc6c);})['catch'](function(_0xbc5c01){logger[_0x12ac('0x11')](_0x12ac('0x21'),_0xbc5c01['message'],_0x451c3d);_0x7d0a58(_0x5b4ee3[_0x12ac('0x11')](0x1f4,_0xbc5c01[_0x12ac('0x13')]));});});};exports[_0x12ac('0x24')]=function(_0x207b11){var _0x28ee65=this;return new Promise(function(_0x370341,_0x11d03a){return db[_0x12ac('0x25')][_0x12ac('0x26')](_0x207b11['body'],{'raw':_0x207b11[_0x12ac('0x17')]?_0x207b11[_0x12ac('0x17')][_0x12ac('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x207b11[_0x12ac('0x17')]?_0x207b11[_0x12ac('0x17')][_0x12ac('0x19')]||null:null,'attributes':_0x207b11['options']?_0x207b11['options'][_0x12ac('0x1e')]||null:null,'limit':_0x207b11['options']?_0x207b11['options']['limit']||null:null})[_0x12ac('0xd')](function(_0x52bf9f){logger[_0x12ac('0x14')](_0x12ac('0x24'),_0x207b11);logger[_0x12ac('0x20')](_0x12ac('0x24'),_0x207b11,JSON[_0x12ac('0x10')](_0x52bf9f));_0x370341(_0x52bf9f);})[_0x12ac('0x16')](function(_0x51a37a){logger[_0x12ac('0x11')](_0x12ac('0x24'),_0x51a37a[_0x12ac('0x13')],_0x207b11);_0x11d03a(_0x28ee65['error'](0x1f4,_0x51a37a[_0x12ac('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index a4933c5..2289bf0 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 _0x9038=['./voiceChanSpy.controller','get','/:id','isAuthenticated','post','create','put','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x9038,0x118));var _0x8903=function(_0x2d88f,_0x372318){_0x2d88f=_0x2d88f-0x0;var _0x7f016e=_0x9038[_0x2d88f];return _0x7f016e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8903('0x0'));var timeout=require(_0x8903('0x1'));var express=require(_0x8903('0x2'));var router=express[_0x8903('0x3')]();var fs_extra=require(_0x8903('0x4'));var auth=require(_0x8903('0x5'));var interaction=require(_0x8903('0x6'));var config=require(_0x8903('0x7'));var controller=require(_0x8903('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x8903('0x9')](_0x8903('0xa'),auth[_0x8903('0xb')](),controller['show']);router[_0x8903('0xc')]('/',auth[_0x8903('0xb')](),controller[_0x8903('0xd')]);router[_0x8903('0xe')](_0x8903('0xa'),auth[_0x8903('0xb')](),controller[_0x8903('0xf')]);router[_0x8903('0x10')]('/:id',auth[_0x8903('0xb')](),controller['destroy']);module[_0x8903('0x11')]=router; \ No newline at end of file +var _0x75fb=['show','post','create','put','delete','destroy','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x75fb,0x15d));var _0xb75f=function(_0x18f027,_0x22098f){_0x18f027=_0x18f027-0x0;var _0x5f2347=_0x75fb[_0x18f027];return _0x5f2347;};'use strict';var multer=require('multer');var util=require(_0xb75f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb75f('0x1'));var router=express[_0xb75f('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xb75f('0x3'));var interaction=require(_0xb75f('0x4'));var config=require(_0xb75f('0x5'));var controller=require(_0xb75f('0x6'));router[_0xb75f('0x7')]('/',auth[_0xb75f('0x8')](),controller[_0xb75f('0x9')]);router[_0xb75f('0x7')](_0xb75f('0xa'),auth[_0xb75f('0x8')](),controller[_0xb75f('0xb')]);router[_0xb75f('0xc')]('/',auth[_0xb75f('0x8')](),controller[_0xb75f('0xd')]);router[_0xb75f('0xe')](_0xb75f('0xa'),auth[_0xb75f('0x8')](),controller['update']);router[_0xb75f('0xf')](_0xb75f('0xa'),auth[_0xb75f('0x8')](),controller[_0xb75f('0x10')]);module[_0xb75f('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 2e37504..71d5d1a 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 _0xaaf2=['setDataValue','options','join','getDataValue','BOOLEAN','sequelize','exports','STRING','name'];(function(_0xd578bb,_0x35fccc){var _0x1f4ecd=function(_0x2798b6){while(--_0x2798b6){_0xd578bb['push'](_0xd578bb['shift']());}};_0x1f4ecd(++_0x35fccc);}(_0xaaf2,0x164));var _0x2aaf=function(_0x36dd98,_0x2ba221){_0x36dd98=_0x36dd98-0x0;var _0x1d32fa=_0xaaf2[_0x36dd98];return _0x1d32fa;};'use strict';var Sequelize=require(_0x2aaf('0x0'));module[_0x2aaf('0x1')]={'name':{'type':Sequelize[_0x2aaf('0x2')]},'prefix':{'type':Sequelize[_0x2aaf('0x2')],'unique':_0x2aaf('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x2aaf('0x2')],'set':function(_0x21aedd){this[_0x2aaf('0x4')](_0x2aaf('0x5'),_0x21aedd?_0x21aedd[_0x2aaf('0x6')](''):[]);},'get':function(){return this[_0x2aaf('0x7')](_0x2aaf('0x5'))?this[_0x2aaf('0x7')](_0x2aaf('0x5'))['split'](''):[];}},'auth':{'type':Sequelize[_0x2aaf('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x2aaf('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2aaf('0x2')]}}; \ No newline at end of file +var _0x1dcd=['options','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x519e24,_0x1e994d){var _0x2b6d4f=function(_0x414611){while(--_0x414611){_0x519e24['push'](_0x519e24['shift']());}};_0x2b6d4f(++_0x1e994d);}(_0x1dcd,0xa7));var _0xd1dc=function(_0x207061,_0xe38cda){_0x207061=_0x207061-0x0;var _0x4a2833=_0x1dcd[_0x207061];return _0x4a2833;};'use strict';var Sequelize=require(_0xd1dc('0x0'));module[_0xd1dc('0x1')]={'name':{'type':Sequelize[_0xd1dc('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0xd1dc('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xd1dc('0x2')],'set':function(_0x1b3a22){this['setDataValue'](_0xd1dc('0x4'),_0x1b3a22?_0x1b3a22[_0xd1dc('0x5')](''):[]);},'get':function(){return this[_0xd1dc('0x6')](_0xd1dc('0x4'))?this[_0xd1dc('0x6')](_0xd1dc('0x4'))[_0xd1dc('0x7')](''):[];}},'auth':{'type':Sequelize[_0xd1dc('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0xd1dc('0x2')]},'record':{'type':Sequelize[_0xd1dc('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 2f4e940..ab0e6f9 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 _0xb63f=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','get','ChanSpies','UserProfileResource','sendStatus','error','stack','name','send','index','VoiceChanSpy','rawAttributes','key','keys','query','filters','intersection','model','attributes','length','nolimit','order','sort','where','pick','merge','map','type','VIRTUAL','filter','options','rows','catch','show','params','fields','includeAll','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','zip-dir'];(function(_0x166664,_0x3e99c2){var _0xdbfaa9=function(_0x1e22f9){while(--_0x1e22f9){_0x166664['push'](_0x166664['shift']());}};_0xdbfaa9(++_0x3e99c2);}(_0xb63f,0xa3));var _0xfb63=function(_0x35d3a8,_0x44406a){_0x35d3a8=_0x35d3a8-0x0;var _0x182378=_0xb63f[_0x35d3a8];return _0x182378;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfb63('0x0'));var jsonpatch=require(_0xfb63('0x1'));var rp=require(_0xfb63('0x2'));var moment=require(_0xfb63('0x3'));var BPromise=require(_0xfb63('0x4'));var Mustache=require(_0xfb63('0x5'));var util=require(_0xfb63('0x6'));var path=require(_0xfb63('0x7'));var sox=require(_0xfb63('0x8'));var csv=require('to-csv');var ejs=require(_0xfb63('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfb63('0xa'));var squel=require(_0xfb63('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfb63('0xc'));var querystring=require(_0xfb63('0xd'));var Papa=require(_0xfb63('0xe'));var Redis=require('ioredis');var authService=require(_0xfb63('0xf'));var qs=require(_0xfb63('0x10'));var as=require(_0xfb63('0x11'));var hardwareService=require(_0xfb63('0x12'));var logger=require(_0xfb63('0x13'))(_0xfb63('0x14'));var utils=require(_0xfb63('0x15'));var config=require(_0xfb63('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xee69d,_0x233ec3){_0x233ec3=_0x233ec3||0xcc;return function(_0xa2f034){if(_0xa2f034){return _0xee69d['sendStatus'](_0x233ec3);}return _0xee69d[_0xfb63('0x17')](_0x233ec3)[_0xfb63('0x18')]();};}function respondWithResult(_0x48a22c,_0x4575b6){_0x4575b6=_0x4575b6||0xc8;return function(_0x377d1e){if(_0x377d1e){return _0x48a22c[_0xfb63('0x17')](_0x4575b6)[_0xfb63('0x19')](_0x377d1e);}};}function respondWithFilteredResult(_0x51e7ef,_0x44619e){return function(_0x48e2c0){if(_0x48e2c0){var _0x19f196=typeof _0x44619e[_0xfb63('0x1a')]===_0xfb63('0x1b')&&typeof _0x44619e[_0xfb63('0x1c')]===_0xfb63('0x1b');var _0x49081d=_0x48e2c0[_0xfb63('0x1d')];var _0x5dfd32=_0x19f196?0x0:_0x44619e[_0xfb63('0x1a')];var _0x4f7508=_0x19f196?_0x48e2c0[_0xfb63('0x1d')]:_0x44619e[_0xfb63('0x1a')]+_0x44619e[_0xfb63('0x1c')];var _0x452f1e;if(_0x4f7508>=_0x49081d){_0x4f7508=_0x49081d;_0x452f1e=0xc8;}else{_0x452f1e=0xce;}_0x51e7ef['status'](_0x452f1e);return _0x51e7ef[_0xfb63('0x1e')]('Content-Range',_0x5dfd32+'-'+_0x4f7508+'/'+_0x49081d)[_0xfb63('0x19')](_0x48e2c0);}return null;};}function patchUpdates(_0x3ef0cf){return function(_0x564052){try{jsonpatch[_0xfb63('0x1f')](_0x564052,_0x3ef0cf,!![]);}catch(_0x23c4fb){return BPromise['reject'](_0x23c4fb);}return _0x564052[_0xfb63('0x20')]();};}function saveUpdates(_0x43bf68,_0x267953){return function(_0x34e22c){if(_0x34e22c){return _0x34e22c[_0xfb63('0x21')](_0x43bf68)[_0xfb63('0x22')](function(_0x17f81e){return _0x17f81e;});}return null;};}function removeEntity(_0x1bbedc,_0x43c245){return function(_0xa7612f){if(_0xa7612f){return _0xa7612f[_0xfb63('0x23')]()[_0xfb63('0x22')](function(){var _0x2d453a=_0xa7612f[_0xfb63('0x24')]({'plain':!![]});var _0x26036d=_0xfb63('0x25');return db[_0xfb63('0x26')][_0xfb63('0x23')]({'where':{'type':_0x26036d,'resourceId':_0x2d453a['id']}})['then'](function(){return _0xa7612f;});})[_0xfb63('0x22')](function(){_0x1bbedc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2035d2,_0x44c0a5){return function(_0xaad3a4){if(!_0xaad3a4){_0x2035d2[_0xfb63('0x27')](0x194);}return _0xaad3a4;};}function handleError(_0x1d7c55,_0x5d4a76){_0x5d4a76=_0x5d4a76||0x1f4;return function(_0x594962){logger[_0xfb63('0x28')](_0x594962[_0xfb63('0x29')]);if(_0x594962[_0xfb63('0x2a')]){delete _0x594962[_0xfb63('0x2a')];}_0x1d7c55[_0xfb63('0x17')](_0x5d4a76)[_0xfb63('0x2b')](_0x594962);};}exports[_0xfb63('0x2c')]=function(_0xc20ddf,_0x293909){var _0x2478af={},_0xaaf02a={},_0x4d651b={'count':0x0,'rows':[]};var _0x22f574=_['map'](db[_0xfb63('0x2d')][_0xfb63('0x2e')],function(_0x379936){return{'name':_0x379936['fieldName'],'type':_0x379936['type'][_0xfb63('0x2f')]};});_0xaaf02a['model']=_['map'](_0x22f574,_0xfb63('0x2a'));_0xaaf02a['query']=_[_0xfb63('0x30')](_0xc20ddf[_0xfb63('0x31')]);_0xaaf02a[_0xfb63('0x32')]=_[_0xfb63('0x33')](_0xaaf02a[_0xfb63('0x34')],_0xaaf02a[_0xfb63('0x31')]);_0x2478af[_0xfb63('0x35')]=_[_0xfb63('0x33')](_0xaaf02a['model'],qs['fields'](_0xc20ddf[_0xfb63('0x31')]['fields']));_0x2478af[_0xfb63('0x35')]=_0x2478af[_0xfb63('0x35')][_0xfb63('0x36')]?_0x2478af[_0xfb63('0x35')]:_0xaaf02a[_0xfb63('0x34')];if(!_0xc20ddf['query']['hasOwnProperty'](_0xfb63('0x37'))){_0x2478af[_0xfb63('0x1c')]=qs['limit'](_0xc20ddf['query']['limit']);_0x2478af[_0xfb63('0x1a')]=qs[_0xfb63('0x1a')](_0xc20ddf[_0xfb63('0x31')]['offset']);}_0x2478af[_0xfb63('0x38')]=qs[_0xfb63('0x39')](_0xc20ddf[_0xfb63('0x31')][_0xfb63('0x39')]);_0x2478af[_0xfb63('0x3a')]=qs[_0xfb63('0x32')](_[_0xfb63('0x3b')](_0xc20ddf['query'],_0xaaf02a['filters']),_0x22f574);if(_0xc20ddf[_0xfb63('0x31')]['filter']){_0x2478af[_0xfb63('0x3a')]=_[_0xfb63('0x3c')](_0x2478af[_0xfb63('0x3a')],{'$or':_[_0xfb63('0x3d')](_0x22f574,function(_0x284b38){if(_0x284b38[_0xfb63('0x3e')]!==_0xfb63('0x3f')){var _0x173768={};_0x173768[_0x284b38[_0xfb63('0x2a')]]={'$like':'%'+_0xc20ddf[_0xfb63('0x31')][_0xfb63('0x40')]+'%'};return _0x173768;}})});}_0x2478af=_[_0xfb63('0x3c')]({},_0x2478af,_0xc20ddf[_0xfb63('0x41')]);var _0x32b25c={'where':_0x2478af[_0xfb63('0x3a')]};return db[_0xfb63('0x2d')][_0xfb63('0x1d')](_0x32b25c)[_0xfb63('0x22')](function(_0x3f0d52){_0x4d651b[_0xfb63('0x1d')]=_0x3f0d52;if(_0xc20ddf[_0xfb63('0x31')]['includeAll']){_0x2478af['include']=[{'all':!![]}];}return db[_0xfb63('0x2d')]['findAll'](_0x2478af);})[_0xfb63('0x22')](function(_0x1fc68b){_0x4d651b[_0xfb63('0x42')]=_0x1fc68b;return _0x4d651b;})[_0xfb63('0x22')](respondWithFilteredResult(_0x293909,_0x2478af))[_0xfb63('0x43')](handleError(_0x293909,null));};exports[_0xfb63('0x44')]=function(_0x3406c3,_0x4485f1){var _0xb636f2={'raw':![],'where':{'id':_0x3406c3[_0xfb63('0x45')]['id']}},_0x9db24f={};_0x9db24f[_0xfb63('0x34')]=_['keys'](db[_0xfb63('0x2d')][_0xfb63('0x2e')]);_0x9db24f[_0xfb63('0x31')]=_[_0xfb63('0x30')](_0x3406c3[_0xfb63('0x31')]);_0x9db24f[_0xfb63('0x32')]=_[_0xfb63('0x33')](_0x9db24f[_0xfb63('0x34')],_0x9db24f[_0xfb63('0x31')]);_0xb636f2['attributes']=_[_0xfb63('0x33')](_0x9db24f[_0xfb63('0x34')],qs[_0xfb63('0x46')](_0x3406c3[_0xfb63('0x31')][_0xfb63('0x46')]));_0xb636f2[_0xfb63('0x35')]=_0xb636f2['attributes'][_0xfb63('0x36')]?_0xb636f2[_0xfb63('0x35')]:_0x9db24f[_0xfb63('0x34')];if(_0x3406c3[_0xfb63('0x31')][_0xfb63('0x47')]){_0xb636f2[_0xfb63('0x48')]=[{'all':!![]}];}_0xb636f2=_[_0xfb63('0x3c')]({},_0xb636f2,_0x3406c3[_0xfb63('0x41')]);return db[_0xfb63('0x2d')]['find'](_0xb636f2)[_0xfb63('0x22')](handleEntityNotFound(_0x4485f1,null))[_0xfb63('0x22')](respondWithResult(_0x4485f1,null))[_0xfb63('0x43')](handleError(_0x4485f1,null));};exports[_0xfb63('0x49')]=function(_0x27a179,_0x1f0478){return db[_0xfb63('0x2d')][_0xfb63('0x49')](_0x27a179[_0xfb63('0x4a')],{})['then'](function(_0x17dff4){var _0x193f0b=_0x27a179[_0xfb63('0x4b')][_0xfb63('0x24')]({'plain':!![]});if(!_0x193f0b)throw new Error(_0xfb63('0x4c'));if(_0x193f0b[_0xfb63('0x4d')]==='user'){var _0x39d921=_0x17dff4[_0xfb63('0x24')]({'plain':!![]});var _0x4a20e6=_0xfb63('0x25');return db[_0xfb63('0x4e')][_0xfb63('0x4f')]({'where':{'name':_0x4a20e6,'userProfileId':_0x193f0b[_0xfb63('0x50')]},'raw':!![]})[_0xfb63('0x22')](function(_0x2c4f2b){if(_0x2c4f2b&&_0x2c4f2b[_0xfb63('0x51')]===0x0){return db[_0xfb63('0x26')][_0xfb63('0x49')]({'name':_0x39d921[_0xfb63('0x2a')],'resourceId':_0x39d921['id'],'type':_0x2c4f2b[_0xfb63('0x2a')],'sectionId':_0x2c4f2b['id']},{})['then'](function(){return _0x17dff4;});}else{return _0x17dff4;}})[_0xfb63('0x43')](function(_0x464a67){logger[_0xfb63('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x464a67);throw _0x464a67;});}return _0x17dff4;})['then'](respondWithResult(_0x1f0478,0xc9))[_0xfb63('0x43')](handleError(_0x1f0478,null));};exports[_0xfb63('0x21')]=function(_0x258ce1,_0x447852){if(_0x258ce1['body']['id']){delete _0x258ce1[_0xfb63('0x4a')]['id'];}return db[_0xfb63('0x2d')][_0xfb63('0x4f')]({'where':{'id':_0x258ce1[_0xfb63('0x45')]['id']}})[_0xfb63('0x22')](handleEntityNotFound(_0x447852,null))[_0xfb63('0x22')](saveUpdates(_0x258ce1[_0xfb63('0x4a')],null))[_0xfb63('0x22')](respondWithResult(_0x447852,null))['catch'](handleError(_0x447852,null));};exports[_0xfb63('0x23')]=function(_0x18fa7f,_0x441609){return db[_0xfb63('0x2d')]['find']({'where':{'id':_0x18fa7f[_0xfb63('0x45')]['id']}})[_0xfb63('0x22')](handleEntityNotFound(_0x441609,null))[_0xfb63('0x22')](removeEntity(_0x441609,null))[_0xfb63('0x43')](handleError(_0x441609,null));}; \ No newline at end of file +var _0xb945=['squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','set','Content-Range','json','apply','update','then','destroy','get','ChanSpies','UserProfileResource','sendStatus','error','stack','send','index','fieldName','key','model','map','name','query','filters','attributes','intersection','hasOwnProperty','nolimit','order','sort','pick','where','type','VIRTUAL','filter','merge','options','VoiceChanSpy','count','findAll','rows','show','params','keys','fields','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','catch','eml-format','zip-dir','request-promise','mustache','util','path','sox','to-csv','lodash'];(function(_0x5b98d6,_0x58ea4e){var _0x356481=function(_0x4692c0){while(--_0x4692c0){_0x5b98d6['push'](_0x5b98d6['shift']());}};_0x356481(++_0x58ea4e);}(_0xb945,0x97));var _0x5b94=function(_0x52d618,_0x3b8074){_0x52d618=_0x52d618-0x0;var _0x5db6b7=_0xb945[_0x52d618];return _0x5db6b7;};'use strict';var emlformat=require(_0x5b94('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5b94('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5b94('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5b94('0x3'));var util=require(_0x5b94('0x4'));var path=require(_0x5b94('0x5'));var sox=require(_0x5b94('0x6'));var csv=require(_0x5b94('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5b94('0x8'));var squel=require(_0x5b94('0x9'));var crypto=require(_0x5b94('0xa'));var jsforce=require(_0x5b94('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5b94('0x7'));var querystring=require('querystring');var Papa=require(_0x5b94('0xc'));var Redis=require(_0x5b94('0xd'));var authService=require(_0x5b94('0xe'));var qs=require(_0x5b94('0xf'));var as=require(_0x5b94('0x10'));var hardwareService=require(_0x5b94('0x11'));var logger=require(_0x5b94('0x12'))('api');var utils=require(_0x5b94('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x5b94('0x14'));var db=require(_0x5b94('0x15'))['db'];function respondWithStatusCode(_0x11e65c,_0x23e1d8){_0x23e1d8=_0x23e1d8||0xcc;return function(_0x32948e){if(_0x32948e){return _0x11e65c['sendStatus'](_0x23e1d8);}return _0x11e65c[_0x5b94('0x16')](_0x23e1d8)[_0x5b94('0x17')]();};}function respondWithResult(_0x3d819d,_0x1114ab){_0x1114ab=_0x1114ab||0xc8;return function(_0x51f123){if(_0x51f123){return _0x3d819d[_0x5b94('0x16')](_0x1114ab)['json'](_0x51f123);}};}function respondWithFilteredResult(_0xa8cf03,_0x34aa94){return function(_0x48914f){if(_0x48914f){var _0x40fbc7=typeof _0x34aa94[_0x5b94('0x18')]===_0x5b94('0x19')&&typeof _0x34aa94['limit']===_0x5b94('0x19');var _0x371fce=_0x48914f['count'];var _0x2bb003=_0x40fbc7?0x0:_0x34aa94[_0x5b94('0x18')];var _0x1b5874=_0x40fbc7?_0x48914f['count']:_0x34aa94[_0x5b94('0x18')]+_0x34aa94[_0x5b94('0x1a')];var _0x5b13e0;if(_0x1b5874>=_0x371fce){_0x1b5874=_0x371fce;_0x5b13e0=0xc8;}else{_0x5b13e0=0xce;}_0xa8cf03[_0x5b94('0x16')](_0x5b13e0);return _0xa8cf03[_0x5b94('0x1b')](_0x5b94('0x1c'),_0x2bb003+'-'+_0x1b5874+'/'+_0x371fce)[_0x5b94('0x1d')](_0x48914f);}return null;};}function patchUpdates(_0x1f2293){return function(_0x5d1a5a){try{jsonpatch[_0x5b94('0x1e')](_0x5d1a5a,_0x1f2293,!![]);}catch(_0x44d510){return BPromise['reject'](_0x44d510);}return _0x5d1a5a['save']();};}function saveUpdates(_0x17789b,_0xb9e5db){return function(_0x12980d){if(_0x12980d){return _0x12980d[_0x5b94('0x1f')](_0x17789b)[_0x5b94('0x20')](function(_0x30fb7a){return _0x30fb7a;});}return null;};}function removeEntity(_0x1e8236,_0x31d950){return function(_0x219486){if(_0x219486){return _0x219486[_0x5b94('0x21')]()[_0x5b94('0x20')](function(){var _0x29ad17=_0x219486[_0x5b94('0x22')]({'plain':!![]});var _0x1c8db6=_0x5b94('0x23');return db[_0x5b94('0x24')]['destroy']({'where':{'type':_0x1c8db6,'resourceId':_0x29ad17['id']}})[_0x5b94('0x20')](function(){return _0x219486;});})[_0x5b94('0x20')](function(){_0x1e8236[_0x5b94('0x16')](0xcc)[_0x5b94('0x17')]();});}};}function handleEntityNotFound(_0x1e0313,_0x4e2a53){return function(_0x548ab5){if(!_0x548ab5){_0x1e0313[_0x5b94('0x25')](0x194);}return _0x548ab5;};}function handleError(_0x41a544,_0x2fbb32){_0x2fbb32=_0x2fbb32||0x1f4;return function(_0x5bace6){logger[_0x5b94('0x26')](_0x5bace6[_0x5b94('0x27')]);if(_0x5bace6['name']){delete _0x5bace6['name'];}_0x41a544[_0x5b94('0x16')](_0x2fbb32)[_0x5b94('0x28')](_0x5bace6);};}exports[_0x5b94('0x29')]=function(_0x1ecbfc,_0x67a149){var _0x400290={},_0x30c35c={},_0x5425e7={'count':0x0,'rows':[]};var _0x2594d8=_['map'](db['VoiceChanSpy']['rawAttributes'],function(_0xc151f5){return{'name':_0xc151f5[_0x5b94('0x2a')],'type':_0xc151f5['type'][_0x5b94('0x2b')]};});_0x30c35c[_0x5b94('0x2c')]=_[_0x5b94('0x2d')](_0x2594d8,_0x5b94('0x2e'));_0x30c35c['query']=_['keys'](_0x1ecbfc[_0x5b94('0x2f')]);_0x30c35c[_0x5b94('0x30')]=_['intersection'](_0x30c35c[_0x5b94('0x2c')],_0x30c35c[_0x5b94('0x2f')]);_0x400290[_0x5b94('0x31')]=_[_0x5b94('0x32')](_0x30c35c[_0x5b94('0x2c')],qs['fields'](_0x1ecbfc['query']['fields']));_0x400290[_0x5b94('0x31')]=_0x400290[_0x5b94('0x31')]['length']?_0x400290[_0x5b94('0x31')]:_0x30c35c['model'];if(!_0x1ecbfc['query'][_0x5b94('0x33')](_0x5b94('0x34'))){_0x400290[_0x5b94('0x1a')]=qs['limit'](_0x1ecbfc['query'][_0x5b94('0x1a')]);_0x400290[_0x5b94('0x18')]=qs['offset'](_0x1ecbfc['query'][_0x5b94('0x18')]);}_0x400290[_0x5b94('0x35')]=qs[_0x5b94('0x36')](_0x1ecbfc[_0x5b94('0x2f')]['sort']);_0x400290['where']=qs[_0x5b94('0x30')](_[_0x5b94('0x37')](_0x1ecbfc[_0x5b94('0x2f')],_0x30c35c[_0x5b94('0x30')]),_0x2594d8);if(_0x1ecbfc[_0x5b94('0x2f')]['filter']){_0x400290['where']=_['merge'](_0x400290[_0x5b94('0x38')],{'$or':_[_0x5b94('0x2d')](_0x2594d8,function(_0x18acdf){if(_0x18acdf[_0x5b94('0x39')]!==_0x5b94('0x3a')){var _0x11b23b={};_0x11b23b[_0x18acdf[_0x5b94('0x2e')]]={'$like':'%'+_0x1ecbfc[_0x5b94('0x2f')][_0x5b94('0x3b')]+'%'};return _0x11b23b;}})});}_0x400290=_[_0x5b94('0x3c')]({},_0x400290,_0x1ecbfc[_0x5b94('0x3d')]);var _0x37637a={'where':_0x400290['where']};return db[_0x5b94('0x3e')][_0x5b94('0x3f')](_0x37637a)[_0x5b94('0x20')](function(_0x2f5353){_0x5425e7[_0x5b94('0x3f')]=_0x2f5353;if(_0x1ecbfc[_0x5b94('0x2f')]['includeAll']){_0x400290['include']=[{'all':!![]}];}return db[_0x5b94('0x3e')][_0x5b94('0x40')](_0x400290);})['then'](function(_0x40e32b){_0x5425e7[_0x5b94('0x41')]=_0x40e32b;return _0x5425e7;})[_0x5b94('0x20')](respondWithFilteredResult(_0x67a149,_0x400290))['catch'](handleError(_0x67a149,null));};exports[_0x5b94('0x42')]=function(_0x236278,_0x507c08){var _0x173135={'raw':![],'where':{'id':_0x236278[_0x5b94('0x43')]['id']}},_0x3d09d7={};_0x3d09d7['model']=_[_0x5b94('0x44')](db['VoiceChanSpy']['rawAttributes']);_0x3d09d7[_0x5b94('0x2f')]=_[_0x5b94('0x44')](_0x236278[_0x5b94('0x2f')]);_0x3d09d7[_0x5b94('0x30')]=_['intersection'](_0x3d09d7[_0x5b94('0x2c')],_0x3d09d7[_0x5b94('0x2f')]);_0x173135['attributes']=_[_0x5b94('0x32')](_0x3d09d7[_0x5b94('0x2c')],qs[_0x5b94('0x45')](_0x236278[_0x5b94('0x2f')][_0x5b94('0x45')]));_0x173135[_0x5b94('0x31')]=_0x173135[_0x5b94('0x31')]['length']?_0x173135[_0x5b94('0x31')]:_0x3d09d7[_0x5b94('0x2c')];if(_0x236278[_0x5b94('0x2f')]['includeAll']){_0x173135['include']=[{'all':!![]}];}_0x173135=_['merge']({},_0x173135,_0x236278[_0x5b94('0x3d')]);return db['VoiceChanSpy'][_0x5b94('0x46')](_0x173135)[_0x5b94('0x20')](handleEntityNotFound(_0x507c08,null))['then'](respondWithResult(_0x507c08,null))['catch'](handleError(_0x507c08,null));};exports[_0x5b94('0x47')]=function(_0x389134,_0x157593){return db[_0x5b94('0x3e')][_0x5b94('0x47')](_0x389134[_0x5b94('0x48')],{})[_0x5b94('0x20')](function(_0x111a79){var _0xf9dca2=_0x389134['user'][_0x5b94('0x22')]({'plain':!![]});if(!_0xf9dca2)throw new Error(_0x5b94('0x49'));if(_0xf9dca2[_0x5b94('0x4a')]===_0x5b94('0x4b')){var _0x17e67f=_0x111a79['get']({'plain':!![]});var _0x3d4b47='ChanSpies';return db[_0x5b94('0x4c')]['find']({'where':{'name':_0x3d4b47,'userProfileId':_0xf9dca2[_0x5b94('0x4d')]},'raw':!![]})[_0x5b94('0x20')](function(_0x37d12a){if(_0x37d12a&&_0x37d12a[_0x5b94('0x4e')]===0x0){return db['UserProfileResource'][_0x5b94('0x47')]({'name':_0x17e67f[_0x5b94('0x2e')],'resourceId':_0x17e67f['id'],'type':_0x37d12a[_0x5b94('0x2e')],'sectionId':_0x37d12a['id']},{})[_0x5b94('0x20')](function(){return _0x111a79;});}else{return _0x111a79;}})[_0x5b94('0x4f')](function(_0x53b442){logger[_0x5b94('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53b442);throw _0x53b442;});}return _0x111a79;})[_0x5b94('0x20')](respondWithResult(_0x157593,0xc9))['catch'](handleError(_0x157593,null));};exports[_0x5b94('0x1f')]=function(_0x3003af,_0x269ab2){if(_0x3003af['body']['id']){delete _0x3003af[_0x5b94('0x48')]['id'];}return db[_0x5b94('0x3e')][_0x5b94('0x46')]({'where':{'id':_0x3003af[_0x5b94('0x43')]['id']}})[_0x5b94('0x20')](handleEntityNotFound(_0x269ab2,null))[_0x5b94('0x20')](saveUpdates(_0x3003af[_0x5b94('0x48')],null))[_0x5b94('0x20')](respondWithResult(_0x269ab2,null))[_0x5b94('0x4f')](handleError(_0x269ab2,null));};exports[_0x5b94('0x21')]=function(_0x414fc2,_0x3ca4ca){return db[_0x5b94('0x3e')][_0x5b94('0x46')]({'where':{'id':_0x414fc2[_0x5b94('0x43')]['id']}})[_0x5b94('0x20')](handleEntityNotFound(_0x3ca4ca,null))[_0x5b94('0x20')](removeEntity(_0x3ca4ca,null))[_0x5b94('0x4f')](handleError(_0x3ca4ca,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 1f318bc..6f8d357 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 _0x820a=['MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','findAll','then','catch','exports','models','define','VoiceChanSpy','VoiceExtension','bulkCreate','util','bluebird','./voiceChanSpy.attributes','from-sip','format','%s%s','prefix','merge','Set','CDR(type)=%s','record','push'];(function(_0x351c29,_0x1abaa4){var _0x2b3bdc=function(_0x2cdbf8){while(--_0x2cdbf8){_0x351c29['push'](_0x351c29['shift']());}};_0x2b3bdc(++_0x1abaa4);}(_0x820a,0x16a));var _0xa820=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x820a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xa820('0x0'));var BPromise=require(_0xa820('0x1'));var attributes=require(_0xa820('0x2'));var getUserApplications=function(_0xc7e13f,_0x51128e,_0x3771b2){var _0xb6eac5=0x1;var _0x11abe2=[];var _0x239a20={'context':_0x51128e['context']||_0xa820('0x3'),'exten':util[_0xa820('0x4')](_0xa820('0x5'),_0xc7e13f[_0xa820('0x6')],_0x3771b2),'type':'system','isApp':![],'ChanSpyId':_0xc7e13f['id'],'UserId':_0x51128e['id']};_0x11abe2['push'](_[_0xa820('0x7')]({'app':_0xa820('0x8'),'appdata':util[_0xa820('0x4')](_0xa820('0x9'),'chanspy'),'priority':_0xb6eac5++},_0x239a20));if(_0xc7e13f[_0xa820('0xa')]){_0x11abe2[_0xa820('0xb')](_['merge']({'app':_0xa820('0xc'),'appdata':util[_0xa820('0x4')](_0xa820('0xd'),_0xc7e13f[_0xa820('0xe')]),'priority':_0xb6eac5++},_0x239a20));}if(_0xc7e13f[_0xa820('0xf')]){_0x11abe2['push'](_['merge']({'app':'Authenticate','appdata':_0xc7e13f['password'],'priority':_0xb6eac5++},_0x239a20));}_0x11abe2[_0xa820('0xb')](_['merge']({'app':_0xa820('0x10'),'appdata':util['format'](_0xa820('0x11'),_0x51128e[_0xa820('0x12')],_0xc7e13f[_0xa820('0x13')]?_0xc7e13f[_0xa820('0x13')][_0xa820('0x14')](''):''),'priority':_0xb6eac5++},_0x239a20));if(_0xc7e13f[_0xa820('0xa')]){_0x11abe2['push'](_[_0xa820('0x7')]({'app':_0xa820('0x15'),'priority':_0xb6eac5++},_0x239a20));}return _0x11abe2;};var getChanSpyApplications=function(_0x5ea8e5,_0x19692f){var _0x3fd2a0=[];for(var _0x95eb30=0x0,_0x4f7a13=0x1;_0x95eb30<_0x19692f[_0xa820('0x16')];_0x95eb30++,_0x4f7a13=0x1){_0x3fd2a0=_0x3fd2a0[_0xa820('0x17')](getUserApplications(_0x5ea8e5,_0x19692f[_0x95eb30],_0x19692f[_0x95eb30][_0xa820('0x18')]));if(_0x19692f[_0x95eb30]['internal']!=_0x19692f[_0x95eb30]['name']){_0x3fd2a0=_0x3fd2a0[_0xa820('0x17')](getUserApplications(_0x5ea8e5,_0x19692f[_0x95eb30],_0x19692f[_0x95eb30]['name']));}}return _0x3fd2a0;};var getChanSpyPromise=function(_0x431fd4,_0x583fba){return new BPromise(function(_0x272220,_0x5aeb91){return _0x431fd4['User'][_0xa820('0x19')]({'attributes':['id','name',_0xa820('0x18')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xa820('0x1a')](function(_0x19c823){if(_0x19c823){return _0x272220(getChanSpyApplications(_0x583fba,_0x19c823));}return _0x272220([]);})[_0xa820('0x1b')](function(_0x2556c5){_0x5aeb91(_0x2556c5);});});};module[_0xa820('0x1c')]=function(_0x252532,_0x1f4dcb){var _0xc2e825=_0x252532[_0xa820('0x1d')];return _0x252532[_0xa820('0x1e')](_0xa820('0x1f'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x18ca22,_0x329ee3,_0x3b83ca){return getChanSpyPromise(_0xc2e825,_0x18ca22)['then'](function(_0x39dde7){if(_0x39dde7&&_0x39dde7[_0xa820('0x16')]){return _0xc2e825[_0xa820('0x20')][_0xa820('0x21')](_0x39dde7);}})[_0xa820('0x1a')](function(){_0x3b83ca();})[_0xa820('0x1b')](function(_0x2e2968){_0x3b83ca(_0x2e2968);});},'afterUpdate':function(_0x39ac34,_0x1c1c57,_0x8c6376){return _0xc2e825[_0xa820('0x20')]['destroy']({'where':{'ChanSpyId':_0x39ac34['id']}})['then'](function(){return getChanSpyPromise(_0xc2e825,_0x39ac34);})[_0xa820('0x1a')](function(_0xb59dc7){if(_0xb59dc7&&_0xb59dc7[_0xa820('0x16')]){return _0xc2e825[_0xa820('0x20')]['bulkCreate'](_0xb59dc7);}})[_0xa820('0x1a')](function(){_0x8c6376();})[_0xa820('0x1b')](function(_0x129f7a){_0x8c6376(_0x129f7a);});},'afterDestroy':function(_0x2424b8,_0x18e62b,_0x4a82e){return _0xc2e825[_0xa820('0x20')]['destroy']({'where':{'ChanSpyId':_0x2424b8['id']}})[_0xa820('0x1a')](function(){_0x4a82e();})[_0xa820('0x1b')](function(_0x4ec748){_0x4a82e(_0x4ec748);});}}});}; \ No newline at end of file +var _0x4961=['VoiceChanSpy','voice_chanspy','VoiceExtension','catch','destroy','bulkCreate','lodash','bluebird','from-sip','format','%s%s','prefix','system','Set','CDR(type)=%s','chanspy','push','merge','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','record','StopMixMonitor','length','concat','internal','User','findAll','agent','then','exports','models'];(function(_0x4e2a78,_0x4fd30f){var _0x4ce2b1=function(_0x3387e8){while(--_0x3387e8){_0x4e2a78['push'](_0x4e2a78['shift']());}};_0x4ce2b1(++_0x4fd30f);}(_0x4961,0x75));var _0x1496=function(_0x9e6184,_0x1a154f){_0x9e6184=_0x9e6184-0x0;var _0xf57108=_0x4961[_0x9e6184];return _0xf57108;};'use strict';var _=require(_0x1496('0x0'));var util=require('util');var BPromise=require(_0x1496('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0xfec8ff,_0x4313b2,_0x5ca2a7){var _0x93265b=0x1;var _0x5d16c2=[];var _0x1ea3c1={'context':_0x4313b2['context']||_0x1496('0x2'),'exten':util[_0x1496('0x3')](_0x1496('0x4'),_0xfec8ff[_0x1496('0x5')],_0x5ca2a7),'type':_0x1496('0x6'),'isApp':![],'ChanSpyId':_0xfec8ff['id'],'UserId':_0x4313b2['id']};_0x5d16c2['push'](_['merge']({'app':_0x1496('0x7'),'appdata':util[_0x1496('0x3')](_0x1496('0x8'),_0x1496('0x9')),'priority':_0x93265b++},_0x1ea3c1));if(_0xfec8ff['record']){_0x5d16c2[_0x1496('0xa')](_[_0x1496('0xb')]({'app':'MixMonitor','appdata':util[_0x1496('0x3')]('${UNIQUEID}.%s,a',_0xfec8ff['recordingFormat']),'priority':_0x93265b++},_0x1ea3c1));}if(_0xfec8ff[_0x1496('0xc')]){_0x5d16c2[_0x1496('0xa')](_['merge']({'app':_0x1496('0xd'),'appdata':_0xfec8ff[_0x1496('0xe')],'priority':_0x93265b++},_0x1ea3c1));}_0x5d16c2[_0x1496('0xa')](_['merge']({'app':_0x1496('0xf'),'appdata':util['format'](_0x1496('0x10'),_0x4313b2[_0x1496('0x11')],_0xfec8ff[_0x1496('0x12')]?_0xfec8ff['options'][_0x1496('0x13')](''):''),'priority':_0x93265b++},_0x1ea3c1));if(_0xfec8ff[_0x1496('0x14')]){_0x5d16c2[_0x1496('0xa')](_[_0x1496('0xb')]({'app':_0x1496('0x15'),'priority':_0x93265b++},_0x1ea3c1));}return _0x5d16c2;};var getChanSpyApplications=function(_0x350b63,_0x10c8e2){var _0x5ec150=[];for(var _0x33049c=0x0,_0x3136d6=0x1;_0x33049c<_0x10c8e2[_0x1496('0x16')];_0x33049c++,_0x3136d6=0x1){_0x5ec150=_0x5ec150[_0x1496('0x17')](getUserApplications(_0x350b63,_0x10c8e2[_0x33049c],_0x10c8e2[_0x33049c]['internal']));if(_0x10c8e2[_0x33049c][_0x1496('0x18')]!=_0x10c8e2[_0x33049c][_0x1496('0x11')]){_0x5ec150=_0x5ec150['concat'](getUserApplications(_0x350b63,_0x10c8e2[_0x33049c],_0x10c8e2[_0x33049c][_0x1496('0x11')]));}}return _0x5ec150;};var getChanSpyPromise=function(_0x3eef33,_0x3503cb){return new BPromise(function(_0x173b2b,_0x425f6b){return _0x3eef33[_0x1496('0x19')][_0x1496('0x1a')]({'attributes':['id',_0x1496('0x11'),_0x1496('0x18')],'where':{'role':_0x1496('0x1b'),'chanspy':!![]},'raw':!![]})[_0x1496('0x1c')](function(_0x731456){if(_0x731456){return _0x173b2b(getChanSpyApplications(_0x3503cb,_0x731456));}return _0x173b2b([]);})['catch'](function(_0x1e590f){_0x425f6b(_0x1e590f);});});};module[_0x1496('0x1d')]=function(_0x348f75,_0x481b4b){var _0x6bdee1=_0x348f75[_0x1496('0x1e')];return _0x348f75['define'](_0x1496('0x1f'),attributes,{'tableName':_0x1496('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3dc757,_0x217596,_0x1ccb0c){return getChanSpyPromise(_0x6bdee1,_0x3dc757)['then'](function(_0x139d89){if(_0x139d89&&_0x139d89[_0x1496('0x16')]){return _0x6bdee1[_0x1496('0x21')]['bulkCreate'](_0x139d89);}})[_0x1496('0x1c')](function(){_0x1ccb0c();})[_0x1496('0x22')](function(_0x1138e2){_0x1ccb0c(_0x1138e2);});},'afterUpdate':function(_0x5451e1,_0x5ca370,_0x4ce4fd){return _0x6bdee1['VoiceExtension'][_0x1496('0x23')]({'where':{'ChanSpyId':_0x5451e1['id']}})[_0x1496('0x1c')](function(){return getChanSpyPromise(_0x6bdee1,_0x5451e1);})['then'](function(_0xff17a1){if(_0xff17a1&&_0xff17a1[_0x1496('0x16')]){return _0x6bdee1[_0x1496('0x21')][_0x1496('0x24')](_0xff17a1);}})['then'](function(){_0x4ce4fd();})[_0x1496('0x22')](function(_0x2665d8){_0x4ce4fd(_0x2665d8);});},'afterDestroy':function(_0x22d5da,_0x187d1c,_0x48edeb){return _0x6bdee1['VoiceExtension'][_0x1496('0x23')]({'where':{'ChanSpyId':_0x22d5da['id']}})['then'](function(){_0x48edeb();})[_0x1496('0x22')](function(_0x4d8105){_0x48edeb(_0x4d8105);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 1579de5..4521ff5 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 _0xa25c=['message','VoiceChanSpy,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x31f63d,_0x27b2bf){var _0x598d06=function(_0x93e26b){while(--_0x93e26b){_0x31f63d['push'](_0x31f63d['shift']());}};_0x598d06(++_0x27b2bf);}(_0xa25c,0x13f));var _0xca25=function(_0x1b5a05,_0x2c80de){_0x1b5a05=_0x1b5a05-0x0;var _0x347931=_0xa25c[_0x1b5a05];return _0x347931;};'use strict';var _=require('lodash');var util=require(_0xca25('0x0'));var moment=require(_0xca25('0x1'));var BPromise=require(_0xca25('0x2'));var rs=require(_0xca25('0x3'));var fs=require('fs');var Redis=require(_0xca25('0x4'));var db=require(_0xca25('0x5'))['db'];var utils=require(_0xca25('0x6'));var logger=require(_0xca25('0x7'))('rpc');var config=require(_0xca25('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xca25('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e9352,_0xb2fc94,_0x3cee89){return new BPromise(function(_0x2c0b8c,_0x42a97a){return client[_0xca25('0xa')](_0x4e9352,_0x3cee89)['then'](function(_0x5d820c){logger[_0xca25('0xb')]('VoiceChanSpy,\x20%s,\x20%s',_0xb2fc94,_0xca25('0xc'));logger[_0xca25('0xd')](_0xca25('0xe'),_0xb2fc94,'request\x20sent',JSON['stringify'](_0x5d820c));if(_0x5d820c['error']){if(_0x5d820c[_0xca25('0xf')][_0xca25('0x10')]===0x1f4){logger[_0xca25('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0xb2fc94,_0x5d820c['error'][_0xca25('0x11')]);return _0x42a97a(_0x5d820c['error'][_0xca25('0x11')]);}logger[_0xca25('0xf')](_0xca25('0x12'),_0xb2fc94,_0x5d820c[_0xca25('0xf')][_0xca25('0x11')]);return _0x2c0b8c(_0x5d820c[_0xca25('0xf')][_0xca25('0x11')]);}else{logger[_0xca25('0xb')](_0xca25('0x12'),_0xb2fc94,_0xca25('0xc'));_0x2c0b8c(_0x5d820c[_0xca25('0x13')]['message']);}})[_0xca25('0x14')](function(_0x340c9b){logger['error'](_0xca25('0x12'),_0xb2fc94,_0x340c9b);_0x42a97a(_0x340c9b);});});} \ No newline at end of file +var _0xb28a=['catch','util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result'];(function(_0x328940,_0x10ebfc){var _0x2b4d77=function(_0x134b4e){while(--_0x134b4e){_0x328940['push'](_0x328940['shift']());}};_0x2b4d77(++_0x10ebfc);}(_0xb28a,0x166));var _0xab28=function(_0x21ea8d,_0x365fd4){_0x21ea8d=_0x21ea8d-0x0;var _0x37d89b=_0xb28a[_0x21ea8d];return _0x37d89b;};'use strict';var _=require('lodash');var util=require(_0xab28('0x0'));var moment=require(_0xab28('0x1'));var BPromise=require('bluebird');var rs=require(_0xab28('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xab28('0x3'))(_0xab28('0x4'));var config=require(_0xab28('0x5'));var jayson=require(_0xab28('0x6'));var client=jayson[_0xab28('0x7')][_0xab28('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x450e5b,_0x3b2507,_0x48949b){return new BPromise(function(_0x479267,_0x294e36){return client[_0xab28('0x9')](_0x450e5b,_0x48949b)[_0xab28('0xa')](function(_0x2508ef){logger[_0xab28('0xb')](_0xab28('0xc'),_0x3b2507,'request\x20sent');logger[_0xab28('0xd')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x3b2507,_0xab28('0xe'),JSON[_0xab28('0xf')](_0x2508ef));if(_0x2508ef[_0xab28('0x10')]){if(_0x2508ef[_0xab28('0x10')][_0xab28('0x11')]===0x1f4){logger[_0xab28('0x10')](_0xab28('0xc'),_0x3b2507,_0x2508ef[_0xab28('0x10')]['message']);return _0x294e36(_0x2508ef[_0xab28('0x10')][_0xab28('0x12')]);}logger[_0xab28('0x10')](_0xab28('0xc'),_0x3b2507,_0x2508ef[_0xab28('0x10')][_0xab28('0x12')]);return _0x479267(_0x2508ef['error']['message']);}else{logger[_0xab28('0xb')](_0xab28('0xc'),_0x3b2507,_0xab28('0xe'));_0x479267(_0x2508ef[_0xab28('0x13')]['message']);}})[_0xab28('0x14')](function(_0x4912fa){logger[_0xab28('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x3b2507,_0x4912fa);_0x294e36(_0x4912fa);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 5dcc8a8..5aead31 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 _0x2557=['index','/:id','show','create','put','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated'];(function(_0xd7de76,_0x16addf){var _0xc15526=function(_0x37e0c9){while(--_0x37e0c9){_0xd7de76['push'](_0xd7de76['shift']());}};_0xc15526(++_0x16addf);}(_0x2557,0x98));var _0x7255=function(_0x31bf7f,_0x9c0a6c){_0x31bf7f=_0x31bf7f-0x0;var _0x1fb738=_0x2557[_0x31bf7f];return _0x1fb738;};'use strict';var multer=require(_0x7255('0x0'));var util=require('util');var path=require(_0x7255('0x1'));var timeout=require(_0x7255('0x2'));var express=require('express');var router=express[_0x7255('0x3')]();var fs_extra=require(_0x7255('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7255('0x5'));var config=require(_0x7255('0x6'));var controller=require(_0x7255('0x7'));router[_0x7255('0x8')]('/',auth[_0x7255('0x9')](),controller[_0x7255('0xa')]);router['get'](_0x7255('0xb'),auth[_0x7255('0x9')](),controller[_0x7255('0xc')]);router['post']('/',auth[_0x7255('0x9')](),controller[_0x7255('0xd')]);router[_0x7255('0xe')](_0x7255('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x7255('0xf')]('/:id',auth[_0x7255('0x9')](),controller[_0x7255('0x10')]);module[_0x7255('0x11')]=router; \ No newline at end of file +var _0xa93e=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','util','Router'];(function(_0x509035,_0x599fd6){var _0x4ca601=function(_0x3f2f98){while(--_0x3f2f98){_0x509035['push'](_0x509035['shift']());}};_0x4ca601(++_0x599fd6);}(_0xa93e,0x1e3));var _0xea93=function(_0x7ae4b4,_0xcf53ce){_0x7ae4b4=_0x7ae4b4-0x0;var _0x15a034=_0xa93e[_0x7ae4b4];return _0x15a034;};'use strict';var multer=require(_0xea93('0x0'));var util=require(_0xea93('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xea93('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xea93('0x3'));var interaction=require(_0xea93('0x4'));var config=require(_0xea93('0x5'));var controller=require(_0xea93('0x6'));router[_0xea93('0x7')]('/',auth[_0xea93('0x8')](),controller[_0xea93('0x9')]);router[_0xea93('0x7')]('/:id',auth[_0xea93('0x8')](),controller['show']);router[_0xea93('0xa')]('/',auth['isAuthenticated'](),controller[_0xea93('0xb')]);router[_0xea93('0xc')](_0xea93('0xd'),auth[_0xea93('0x8')](),controller[_0xea93('0xe')]);router[_0xea93('0xf')](_0xea93('0xd'),auth[_0xea93('0x8')](),controller[_0xea93('0x10')]);module[_0xea93('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index f8557b6..1fec9dd 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 _0xc9ae=['STRING','name','BOOLEAN'];(function(_0x2cc499,_0x54a565){var _0x4b1183=function(_0x104a3a){while(--_0x104a3a){_0x2cc499['push'](_0x2cc499['shift']());}};_0x4b1183(++_0x54a565);}(_0xc9ae,0x1a1));var _0xec9a=function(_0x5de73d,_0x3d3ccb){_0x5de73d=_0x5de73d-0x0;var _0x3ebc90=_0xc9ae[_0x5de73d];return _0x3ebc90;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xec9a('0x0')],'unique':_0xec9a('0x1')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xec9a('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb522=['name','STRING','BOOLEAN'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xb522,0x1a4));var _0x2b52=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb522[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x2b52('0x0')},'description':{'type':Sequelize[_0x2b52('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x2b52('0x2')],'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 387995b..dd275d1 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 _0x6d5d=['Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Contexts','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','readFileSync','join','root','writeFileSync','render','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','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','client','http','request','then','info','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceContext,\x20%s,\x20%s','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','get','UserProfileResource','destroy','end','stack','name','send','index','map','rawAttributes','type','query','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','VoiceContext','includeAll','include','rows','show','params','keys','intersection','find','create','findAll','server/files/templates/context.ejs','utf8','/etc/asterisk/extensions_xcally_contexts.conf'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x6d5d,0x7a));var _0xd6d5=function(_0x44d2f7,_0x36474a){_0x44d2f7=_0x44d2f7-0x0;var _0x3c1693=_0x6d5d[_0x44d2f7];return _0x3c1693;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd6d5('0x0'));var jsonpatch=require(_0xd6d5('0x1'));var rp=require(_0xd6d5('0x2'));var moment=require(_0xd6d5('0x3'));var BPromise=require(_0xd6d5('0x4'));var Mustache=require(_0xd6d5('0x5'));var util=require(_0xd6d5('0x6'));var path=require(_0xd6d5('0x7'));var sox=require(_0xd6d5('0x8'));var csv=require(_0xd6d5('0x9'));var ejs=require(_0xd6d5('0xa'));var fs=require('fs');var fs_extra=require(_0xd6d5('0xb'));var _=require(_0xd6d5('0xc'));var squel=require(_0xd6d5('0xd'));var crypto=require(_0xd6d5('0xe'));var jsforce=require(_0xd6d5('0xf'));var deskjs=require(_0xd6d5('0x10'));var toCsv=require(_0xd6d5('0x9'));var querystring=require(_0xd6d5('0x11'));var Papa=require(_0xd6d5('0x12'));var Redis=require(_0xd6d5('0x13'));var authService=require(_0xd6d5('0x14'));var qs=require(_0xd6d5('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6d5('0x16'));var logger=require(_0xd6d5('0x17'))(_0xd6d5('0x18'));var utils=require('../../config/utils');var config=require(_0xd6d5('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd6d5('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xd6d5('0x1b')][_0xd6d5('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x57e079,_0x49096d,_0x584fe8,_0x48327e){return new BPromise(function(_0x1038f3,_0x3e6cc7){var _0x4af1ff=_0x48327e||client;return _0x4af1ff[_0xd6d5('0x1d')](_0x57e079,_0x584fe8)[_0xd6d5('0x1e')](function(_0x1443ae){logger[_0xd6d5('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x49096d,'request\x20sent');logger[_0xd6d5('0x20')](_0xd6d5('0x21'),_0x49096d,'request\x20sent',JSON[_0xd6d5('0x22')](_0x1443ae));if(_0x1443ae[_0xd6d5('0x23')]){if(_0x1443ae[_0xd6d5('0x23')][_0xd6d5('0x24')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x49096d,_0x1443ae[_0xd6d5('0x23')][_0xd6d5('0x25')]);return _0x3e6cc7(_0x1443ae[_0xd6d5('0x23')][_0xd6d5('0x25')]);}logger[_0xd6d5('0x23')](_0xd6d5('0x26'),_0x49096d,_0x1443ae['error'][_0xd6d5('0x25')]);return _0x1038f3(_0x1443ae[_0xd6d5('0x23')]['message']);}else{logger[_0xd6d5('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x49096d,'request\x20sent');_0x1038f3(_0x1443ae[_0xd6d5('0x27')][_0xd6d5('0x25')]);}})[_0xd6d5('0x28')](function(_0x40f6fe){logger['error'](_0xd6d5('0x26'),_0x49096d,_0x40f6fe);_0x3e6cc7(_0x40f6fe);});});}function respondWithStatusCode(_0x7315a3,_0x4d1c75){_0x4d1c75=_0x4d1c75||0xcc;return function(_0x42f6b0){if(_0x42f6b0){return _0x7315a3[_0xd6d5('0x29')](_0x4d1c75);}return _0x7315a3[_0xd6d5('0x2a')](_0x4d1c75)['end']();};}function respondWithResult(_0x4f4b76,_0x25e2aa){_0x25e2aa=_0x25e2aa||0xc8;return function(_0x16c224){if(_0x16c224){return _0x4f4b76['status'](_0x25e2aa)['json'](_0x16c224);}};}function respondWithFilteredResult(_0x157955,_0x150405){return function(_0x2b4bac){if(_0x2b4bac){var _0x38265a=typeof _0x150405[_0xd6d5('0x2b')]===_0xd6d5('0x2c')&&typeof _0x150405[_0xd6d5('0x2d')]===_0xd6d5('0x2c');var _0x5cd732=_0x2b4bac[_0xd6d5('0x2e')];var _0x5f0e78=_0x38265a?0x0:_0x150405[_0xd6d5('0x2b')];var _0x3546b6=_0x38265a?_0x2b4bac['count']:_0x150405['offset']+_0x150405[_0xd6d5('0x2d')];var _0x29a09b;if(_0x3546b6>=_0x5cd732){_0x3546b6=_0x5cd732;_0x29a09b=0xc8;}else{_0x29a09b=0xce;}_0x157955[_0xd6d5('0x2a')](_0x29a09b);return _0x157955[_0xd6d5('0x2f')](_0xd6d5('0x30'),_0x5f0e78+'-'+_0x3546b6+'/'+_0x5cd732)[_0xd6d5('0x31')](_0x2b4bac);}return null;};}function patchUpdates(_0x1a0508){return function(_0x4fdcf8){try{jsonpatch['apply'](_0x4fdcf8,_0x1a0508,!![]);}catch(_0x3fba63){return BPromise[_0xd6d5('0x32')](_0x3fba63);}return _0x4fdcf8[_0xd6d5('0x33')]();};}function saveUpdates(_0x44ef91,_0x15f762){return function(_0x2b1326){if(_0x2b1326){return _0x2b1326[_0xd6d5('0x34')](_0x44ef91)[_0xd6d5('0x1e')](function(_0x2f3cdf){return _0x2f3cdf;});}return null;};}function removeEntity(_0x1ffdad,_0x29ecaf){return function(_0xa8c75e){if(_0xa8c75e){return _0xa8c75e['destroy']()[_0xd6d5('0x1e')](function(){var _0xdb84d4=_0xa8c75e[_0xd6d5('0x35')]({'plain':!![]});var _0x26318a='Contexts';return db[_0xd6d5('0x36')][_0xd6d5('0x37')]({'where':{'type':_0x26318a,'resourceId':_0xdb84d4['id']}})[_0xd6d5('0x1e')](function(){return _0xa8c75e;});})[_0xd6d5('0x1e')](function(){_0x1ffdad[_0xd6d5('0x2a')](0xcc)[_0xd6d5('0x38')]();});}};}function handleEntityNotFound(_0x37c67d,_0x2457f7){return function(_0xa2bdf8){if(!_0xa2bdf8){_0x37c67d[_0xd6d5('0x29')](0x194);}return _0xa2bdf8;};}function handleError(_0x102a85,_0x382fe3){_0x382fe3=_0x382fe3||0x1f4;return function(_0x27351a){logger[_0xd6d5('0x23')](_0x27351a[_0xd6d5('0x39')]);if(_0x27351a[_0xd6d5('0x3a')]){delete _0x27351a[_0xd6d5('0x3a')];}_0x102a85[_0xd6d5('0x2a')](_0x382fe3)[_0xd6d5('0x3b')](_0x27351a);};}exports[_0xd6d5('0x3c')]=function(_0x4b4197,_0x1e2f09){var _0x347e05={},_0x4e7cb6={},_0x551be0={'count':0x0,'rows':[]};var _0x265bea=_[_0xd6d5('0x3d')](db['VoiceContext'][_0xd6d5('0x3e')],function(_0x136a03){return{'name':_0x136a03['fieldName'],'type':_0x136a03[_0xd6d5('0x3f')]['key']};});_0x4e7cb6['model']=_[_0xd6d5('0x3d')](_0x265bea,'name');_0x4e7cb6[_0xd6d5('0x40')]=_['keys'](_0x4b4197[_0xd6d5('0x40')]);_0x4e7cb6['filters']=_['intersection'](_0x4e7cb6[_0xd6d5('0x41')],_0x4e7cb6[_0xd6d5('0x40')]);_0x347e05[_0xd6d5('0x42')]=_['intersection'](_0x4e7cb6[_0xd6d5('0x41')],qs[_0xd6d5('0x43')](_0x4b4197[_0xd6d5('0x40')][_0xd6d5('0x43')]));_0x347e05[_0xd6d5('0x42')]=_0x347e05[_0xd6d5('0x42')][_0xd6d5('0x44')]?_0x347e05[_0xd6d5('0x42')]:_0x4e7cb6[_0xd6d5('0x41')];if(!_0x4b4197['query'][_0xd6d5('0x45')]('nolimit')){_0x347e05['limit']=qs[_0xd6d5('0x2d')](_0x4b4197[_0xd6d5('0x40')][_0xd6d5('0x2d')]);_0x347e05[_0xd6d5('0x2b')]=qs['offset'](_0x4b4197[_0xd6d5('0x40')][_0xd6d5('0x2b')]);}_0x347e05[_0xd6d5('0x46')]=qs['sort'](_0x4b4197[_0xd6d5('0x40')][_0xd6d5('0x47')]);_0x347e05[_0xd6d5('0x48')]=qs[_0xd6d5('0x49')](_[_0xd6d5('0x4a')](_0x4b4197[_0xd6d5('0x40')],_0x4e7cb6['filters']),_0x265bea);if(_0x4b4197[_0xd6d5('0x40')][_0xd6d5('0x4b')]){_0x347e05[_0xd6d5('0x48')]=_[_0xd6d5('0x4c')](_0x347e05['where'],{'$or':_['map'](_0x265bea,function(_0x58d6e8){if(_0x58d6e8['type']!=='VIRTUAL'){var _0x18d394={};_0x18d394[_0x58d6e8[_0xd6d5('0x3a')]]={'$like':'%'+_0x4b4197['query'][_0xd6d5('0x4b')]+'%'};return _0x18d394;}})});}_0x347e05=_[_0xd6d5('0x4c')]({},_0x347e05,_0x4b4197[_0xd6d5('0x4d')]);var _0x13e52e={'where':_0x347e05['where']};return db[_0xd6d5('0x4e')]['count'](_0x13e52e)['then'](function(_0x1813c2){_0x551be0[_0xd6d5('0x2e')]=_0x1813c2;if(_0x4b4197[_0xd6d5('0x40')][_0xd6d5('0x4f')]){_0x347e05[_0xd6d5('0x50')]=[{'all':!![]}];}return db[_0xd6d5('0x4e')]['findAll'](_0x347e05);})[_0xd6d5('0x1e')](function(_0x2e5e67){_0x551be0[_0xd6d5('0x51')]=_0x2e5e67;return _0x551be0;})[_0xd6d5('0x1e')](respondWithFilteredResult(_0x1e2f09,_0x347e05))[_0xd6d5('0x28')](handleError(_0x1e2f09,null));};exports[_0xd6d5('0x52')]=function(_0x4002e4,_0x5437ff){var _0x4d39fb={'raw':![],'where':{'id':_0x4002e4[_0xd6d5('0x53')]['id']}},_0x50e76b={};_0x50e76b[_0xd6d5('0x41')]=_[_0xd6d5('0x54')](db['VoiceContext'][_0xd6d5('0x3e')]);_0x50e76b[_0xd6d5('0x40')]=_[_0xd6d5('0x54')](_0x4002e4[_0xd6d5('0x40')]);_0x50e76b[_0xd6d5('0x49')]=_[_0xd6d5('0x55')](_0x50e76b[_0xd6d5('0x41')],_0x50e76b[_0xd6d5('0x40')]);_0x4d39fb[_0xd6d5('0x42')]=_[_0xd6d5('0x55')](_0x50e76b[_0xd6d5('0x41')],qs['fields'](_0x4002e4[_0xd6d5('0x40')][_0xd6d5('0x43')]));_0x4d39fb['attributes']=_0x4d39fb[_0xd6d5('0x42')][_0xd6d5('0x44')]?_0x4d39fb['attributes']:_0x50e76b[_0xd6d5('0x41')];if(_0x4002e4[_0xd6d5('0x40')][_0xd6d5('0x4f')]){_0x4d39fb['include']=[{'all':!![]}];}_0x4d39fb=_[_0xd6d5('0x4c')]({},_0x4d39fb,_0x4002e4['options']);return db[_0xd6d5('0x4e')][_0xd6d5('0x56')](_0x4d39fb)[_0xd6d5('0x1e')](handleEntityNotFound(_0x5437ff,null))[_0xd6d5('0x1e')](respondWithResult(_0x5437ff,null))['catch'](handleError(_0x5437ff,null));};exports[_0xd6d5('0x57')]=function(_0x256c9e,_0x13ff34,_0x40a2c8){var _0x28d9df;return db[_0xd6d5('0x4e')]['create'](_0x256c9e['body'],{'raw':!![]})[_0xd6d5('0x1e')](function(_0xf8198a){_0x28d9df=_0xf8198a;return db['VoiceContext'][_0xd6d5('0x58')]({'raw':!![]});})[_0xd6d5('0x1e')](function(_0x421f5e){var _0x154287=fs['readFileSync'](path['join'](config['root'],_0xd6d5('0x59')),_0xd6d5('0x5a'));var _0x434287=ejs['render'](_0x154287,{'contexts':_0x421f5e||[]});fs['writeFileSync'](_0xd6d5('0x5b'),_0x434287);})['then'](function(){return respondWithRpcPromise(_0xd6d5('0x5c'),_0xd6d5('0x57'),{'module':_0xd6d5('0x5d')});})[_0xd6d5('0x1e')](function(){var _0x38d8d2=_0x256c9e[_0xd6d5('0x5e')]['get']({'plain':!![]});if(!_0x38d8d2)throw new Error(_0xd6d5('0x5f'));if(_0x38d8d2[_0xd6d5('0x60')]===_0xd6d5('0x5e')){var _0x285af0=_0x28d9df[_0xd6d5('0x35')]({'plain':!![]});return db[_0xd6d5('0x61')]['find']({'where':{'name':_0xd6d5('0x62'),'userProfileId':_0x38d8d2['userProfileId']},'raw':!![]})[_0xd6d5('0x1e')](function(_0x3f1900){if(_0x3f1900&&_0x3f1900[_0xd6d5('0x63')]===0x0){return db[_0xd6d5('0x36')][_0xd6d5('0x57')]({'name':_0x285af0[_0xd6d5('0x3a')],'resourceId':_0x285af0['id'],'type':_0x3f1900[_0xd6d5('0x3a')],'sectionId':_0x3f1900['id']},{})['then'](function(){return _0x28d9df;});}else{return _0x28d9df;}})[_0xd6d5('0x28')](function(_0x324a70){logger[_0xd6d5('0x23')](_0xd6d5('0x64'),_0x324a70);throw _0x324a70;});}return _0x28d9df;})[_0xd6d5('0x1e')](respondWithResult(_0x13ff34,0xc9))[_0xd6d5('0x28')](handleError(_0x13ff34,null));};exports[_0xd6d5('0x34')]=function(_0x1278e2,_0x178334,_0x2086a8){var _0x405d04;return db['VoiceContext'][_0xd6d5('0x56')]({'where':{'id':_0x1278e2[_0xd6d5('0x53')]['id']}})[_0xd6d5('0x1e')](handleEntityNotFound(_0x178334,null))['then'](saveUpdates(_0x1278e2[_0xd6d5('0x65')],null))[_0xd6d5('0x1e')](function(_0x501cfa){if(_0x501cfa){_0x405d04=_0x501cfa;return db[_0xd6d5('0x4e')][_0xd6d5('0x58')]({'raw':!![]});}})[_0xd6d5('0x1e')](function(_0xe680e8){var _0x41d9e3=fs[_0xd6d5('0x66')](path[_0xd6d5('0x67')](config[_0xd6d5('0x68')],'server/files/templates/context.ejs'),'utf8');var _0x437e8a=ejs['render'](_0x41d9e3,{'contexts':_0xe680e8||[]});fs[_0xd6d5('0x69')](_0xd6d5('0x5b'),_0x437e8a);})[_0xd6d5('0x1e')](function(){return respondWithRpcPromise(_0xd6d5('0x5c'),_0xd6d5('0x34'),{'module':'chan_sip.so'});})[_0xd6d5('0x1e')](function(){return _0x405d04;})[_0xd6d5('0x1e')](respondWithResult(_0x178334,null))['catch'](handleError(_0x178334,null));};exports['destroy']=function(_0x228ef9,_0x4e8d75,_0x4b179d){var _0x41b663;return db[_0xd6d5('0x4e')]['find']({'where':{'id':_0x228ef9[_0xd6d5('0x53')]['id']}})[_0xd6d5('0x1e')](handleEntityNotFound(_0x4e8d75,null))[_0xd6d5('0x1e')](removeEntity(_0x4e8d75,null))[_0xd6d5('0x1e')](function(){return db[_0xd6d5('0x4e')]['findAll']({'raw':!![]});})[_0xd6d5('0x1e')](function(_0x1cbf00){var _0x20f814=fs['readFileSync'](path[_0xd6d5('0x67')](config[_0xd6d5('0x68')],_0xd6d5('0x59')),'utf8');var _0x37d949=ejs[_0xd6d5('0x6a')](_0x20f814,{'contexts':_0x1cbf00});fs[_0xd6d5('0x69')](_0xd6d5('0x5b'),_0x37d949);return respondWithRpcPromise('Reload',_0xd6d5('0x37'),{'module':_0xd6d5('0x5d')});})['catch'](handleError(_0x4e8d75,null));}; \ No newline at end of file +var _0xb20b=['destroy','then','get','Contexts','UserProfileResource','stack','name','VoiceContext','fieldName','key','map','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','type','VIRTUAL','filter','include','rows','params','includeAll','options','find','create','body','findAll','join','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','role','UserProfileSection','userProfileId','readFileSync','root','writeFileSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','request','info','debug','stringify','error','message','VoiceContext,\x20%s,\x20%s','request\x20sent','result','catch','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update'];(function(_0x56b368,_0x2e841d){var _0x989ddf=function(_0xd8e9d2){while(--_0xd8e9d2){_0x56b368['push'](_0x56b368['shift']());}};_0x989ddf(++_0x2e841d);}(_0xb20b,0x93));var _0xbb20=function(_0x298de8,_0x18acad){_0x298de8=_0x298de8-0x0;var _0x18de47=_0xb20b[_0x298de8];return _0x18de47;};'use strict';var emlformat=require(_0xbb20('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb20('0x1'));var jsonpatch=require(_0xbb20('0x2'));var rp=require(_0xbb20('0x3'));var moment=require(_0xbb20('0x4'));var BPromise=require(_0xbb20('0x5'));var Mustache=require(_0xbb20('0x6'));var util=require(_0xbb20('0x7'));var path=require(_0xbb20('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbb20('0x9'));var fs=require('fs');var fs_extra=require(_0xbb20('0xa'));var _=require(_0xbb20('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbb20('0xc'));var querystring=require(_0xbb20('0xd'));var Papa=require('papaparse');var Redis=require(_0xbb20('0xe'));var authService=require(_0xbb20('0xf'));var qs=require(_0xbb20('0x10'));var as=require(_0xbb20('0x11'));var hardwareService=require(_0xbb20('0x12'));var logger=require(_0xbb20('0x13'))('api');var utils=require(_0xbb20('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xbb20('0x15'));var db=require(_0xbb20('0x16'))['db'];var jayson=require(_0xbb20('0x17'));var client=jayson[_0xbb20('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1deda4,_0x3895ab,_0x40838d,_0x2a99cd){return new BPromise(function(_0x5c1ec2,_0x48303c){var _0xd9f246=_0x2a99cd||client;return _0xd9f246[_0xbb20('0x19')](_0x1deda4,_0x40838d)['then'](function(_0x3a84de){logger[_0xbb20('0x1a')]('VoiceContext,\x20%s,\x20%s',_0x3895ab,'request\x20sent');logger[_0xbb20('0x1b')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x3895ab,'request\x20sent',JSON[_0xbb20('0x1c')](_0x3a84de));if(_0x3a84de[_0xbb20('0x1d')]){if(_0x3a84de[_0xbb20('0x1d')]['code']===0x1f4){logger[_0xbb20('0x1d')]('VoiceContext,\x20%s,\x20%s',_0x3895ab,_0x3a84de['error'][_0xbb20('0x1e')]);return _0x48303c(_0x3a84de['error'][_0xbb20('0x1e')]);}logger['error'](_0xbb20('0x1f'),_0x3895ab,_0x3a84de['error'][_0xbb20('0x1e')]);return _0x5c1ec2(_0x3a84de['error']['message']);}else{logger[_0xbb20('0x1a')]('VoiceContext,\x20%s,\x20%s',_0x3895ab,_0xbb20('0x20'));_0x5c1ec2(_0x3a84de[_0xbb20('0x21')][_0xbb20('0x1e')]);}})[_0xbb20('0x22')](function(_0x37bfed){logger[_0xbb20('0x1d')]('VoiceContext,\x20%s,\x20%s',_0x3895ab,_0x37bfed);_0x48303c(_0x37bfed);});});}function respondWithStatusCode(_0xd75062,_0x1016fa){_0x1016fa=_0x1016fa||0xcc;return function(_0x22ed3d){if(_0x22ed3d){return _0xd75062['sendStatus'](_0x1016fa);}return _0xd75062[_0xbb20('0x23')](_0x1016fa)[_0xbb20('0x24')]();};}function respondWithResult(_0x4b43a4,_0x28c6fc){_0x28c6fc=_0x28c6fc||0xc8;return function(_0x598bce){if(_0x598bce){return _0x4b43a4[_0xbb20('0x23')](_0x28c6fc)[_0xbb20('0x25')](_0x598bce);}};}function respondWithFilteredResult(_0x1ebc2b,_0x54c9ed){return function(_0x5a08b7){if(_0x5a08b7){var _0x601efa=typeof _0x54c9ed[_0xbb20('0x26')]===_0xbb20('0x27')&&typeof _0x54c9ed[_0xbb20('0x28')]===_0xbb20('0x27');var _0x275f2b=_0x5a08b7[_0xbb20('0x29')];var _0x355950=_0x601efa?0x0:_0x54c9ed[_0xbb20('0x26')];var _0x4057e9=_0x601efa?_0x5a08b7[_0xbb20('0x29')]:_0x54c9ed[_0xbb20('0x26')]+_0x54c9ed[_0xbb20('0x28')];var _0x125f49;if(_0x4057e9>=_0x275f2b){_0x4057e9=_0x275f2b;_0x125f49=0xc8;}else{_0x125f49=0xce;}_0x1ebc2b[_0xbb20('0x23')](_0x125f49);return _0x1ebc2b['set'](_0xbb20('0x2a'),_0x355950+'-'+_0x4057e9+'/'+_0x275f2b)[_0xbb20('0x25')](_0x5a08b7);}return null;};}function patchUpdates(_0x3e37c0){return function(_0x4d43e2){try{jsonpatch[_0xbb20('0x2b')](_0x4d43e2,_0x3e37c0,!![]);}catch(_0x261bb8){return BPromise[_0xbb20('0x2c')](_0x261bb8);}return _0x4d43e2[_0xbb20('0x2d')]();};}function saveUpdates(_0x53b109,_0x525afa){return function(_0x562359){if(_0x562359){return _0x562359[_0xbb20('0x2e')](_0x53b109)['then'](function(_0x1d4a4f){return _0x1d4a4f;});}return null;};}function removeEntity(_0x4afe8c,_0x2df483){return function(_0x135b15){if(_0x135b15){return _0x135b15[_0xbb20('0x2f')]()[_0xbb20('0x30')](function(){var _0x4beeda=_0x135b15[_0xbb20('0x31')]({'plain':!![]});var _0x5cb9dd=_0xbb20('0x32');return db[_0xbb20('0x33')]['destroy']({'where':{'type':_0x5cb9dd,'resourceId':_0x4beeda['id']}})['then'](function(){return _0x135b15;});})[_0xbb20('0x30')](function(){_0x4afe8c['status'](0xcc)[_0xbb20('0x24')]();});}};}function handleEntityNotFound(_0x92939d,_0x4bdf1e){return function(_0x9556c1){if(!_0x9556c1){_0x92939d['sendStatus'](0x194);}return _0x9556c1;};}function handleError(_0x218228,_0xf7f38b){_0xf7f38b=_0xf7f38b||0x1f4;return function(_0x2b778d){logger[_0xbb20('0x1d')](_0x2b778d[_0xbb20('0x34')]);if(_0x2b778d['name']){delete _0x2b778d[_0xbb20('0x35')];}_0x218228[_0xbb20('0x23')](_0xf7f38b)['send'](_0x2b778d);};}exports['index']=function(_0x425d93,_0x464a46){var _0x70e3d={},_0x7ae9aa={},_0x38cd42={'count':0x0,'rows':[]};var _0x441baa=_['map'](db[_0xbb20('0x36')]['rawAttributes'],function(_0x361ba0){return{'name':_0x361ba0[_0xbb20('0x37')],'type':_0x361ba0['type'][_0xbb20('0x38')]};});_0x7ae9aa['model']=_[_0xbb20('0x39')](_0x441baa,_0xbb20('0x35'));_0x7ae9aa['query']=_[_0xbb20('0x3a')](_0x425d93['query']);_0x7ae9aa[_0xbb20('0x3b')]=_[_0xbb20('0x3c')](_0x7ae9aa[_0xbb20('0x3d')],_0x7ae9aa[_0xbb20('0x3e')]);_0x70e3d[_0xbb20('0x3f')]=_[_0xbb20('0x3c')](_0x7ae9aa[_0xbb20('0x3d')],qs['fields'](_0x425d93['query'][_0xbb20('0x40')]));_0x70e3d[_0xbb20('0x3f')]=_0x70e3d['attributes'][_0xbb20('0x41')]?_0x70e3d['attributes']:_0x7ae9aa['model'];if(!_0x425d93[_0xbb20('0x3e')][_0xbb20('0x42')]('nolimit')){_0x70e3d[_0xbb20('0x28')]=qs[_0xbb20('0x28')](_0x425d93['query'][_0xbb20('0x28')]);_0x70e3d[_0xbb20('0x26')]=qs[_0xbb20('0x26')](_0x425d93[_0xbb20('0x3e')][_0xbb20('0x26')]);}_0x70e3d['order']=qs[_0xbb20('0x43')](_0x425d93['query']['sort']);_0x70e3d[_0xbb20('0x44')]=qs[_0xbb20('0x3b')](_[_0xbb20('0x45')](_0x425d93['query'],_0x7ae9aa['filters']),_0x441baa);if(_0x425d93['query']['filter']){_0x70e3d[_0xbb20('0x44')]=_[_0xbb20('0x46')](_0x70e3d[_0xbb20('0x44')],{'$or':_[_0xbb20('0x39')](_0x441baa,function(_0x1191fa){if(_0x1191fa[_0xbb20('0x47')]!==_0xbb20('0x48')){var _0x22025d={};_0x22025d[_0x1191fa[_0xbb20('0x35')]]={'$like':'%'+_0x425d93[_0xbb20('0x3e')][_0xbb20('0x49')]+'%'};return _0x22025d;}})});}_0x70e3d=_[_0xbb20('0x46')]({},_0x70e3d,_0x425d93['options']);var _0x13f66c={'where':_0x70e3d[_0xbb20('0x44')]};return db['VoiceContext'][_0xbb20('0x29')](_0x13f66c)[_0xbb20('0x30')](function(_0x29f6cc){_0x38cd42['count']=_0x29f6cc;if(_0x425d93[_0xbb20('0x3e')]['includeAll']){_0x70e3d[_0xbb20('0x4a')]=[{'all':!![]}];}return db[_0xbb20('0x36')]['findAll'](_0x70e3d);})['then'](function(_0x43ee7c){_0x38cd42[_0xbb20('0x4b')]=_0x43ee7c;return _0x38cd42;})[_0xbb20('0x30')](respondWithFilteredResult(_0x464a46,_0x70e3d))[_0xbb20('0x22')](handleError(_0x464a46,null));};exports['show']=function(_0x420e1d,_0x31c4f3){var _0x545ce3={'raw':![],'where':{'id':_0x420e1d[_0xbb20('0x4c')]['id']}},_0x5739d7={};_0x5739d7[_0xbb20('0x3d')]=_[_0xbb20('0x3a')](db[_0xbb20('0x36')]['rawAttributes']);_0x5739d7[_0xbb20('0x3e')]=_[_0xbb20('0x3a')](_0x420e1d[_0xbb20('0x3e')]);_0x5739d7[_0xbb20('0x3b')]=_[_0xbb20('0x3c')](_0x5739d7[_0xbb20('0x3d')],_0x5739d7[_0xbb20('0x3e')]);_0x545ce3['attributes']=_[_0xbb20('0x3c')](_0x5739d7[_0xbb20('0x3d')],qs[_0xbb20('0x40')](_0x420e1d[_0xbb20('0x3e')][_0xbb20('0x40')]));_0x545ce3[_0xbb20('0x3f')]=_0x545ce3[_0xbb20('0x3f')][_0xbb20('0x41')]?_0x545ce3[_0xbb20('0x3f')]:_0x5739d7['model'];if(_0x420e1d[_0xbb20('0x3e')][_0xbb20('0x4d')]){_0x545ce3['include']=[{'all':!![]}];}_0x545ce3=_[_0xbb20('0x46')]({},_0x545ce3,_0x420e1d[_0xbb20('0x4e')]);return db[_0xbb20('0x36')][_0xbb20('0x4f')](_0x545ce3)['then'](handleEntityNotFound(_0x31c4f3,null))[_0xbb20('0x30')](respondWithResult(_0x31c4f3,null))['catch'](handleError(_0x31c4f3,null));};exports[_0xbb20('0x50')]=function(_0x24b0e9,_0x271d94,_0x13aeb9){var _0x333b24;return db['VoiceContext'][_0xbb20('0x50')](_0x24b0e9[_0xbb20('0x51')],{'raw':!![]})[_0xbb20('0x30')](function(_0x2c0625){_0x333b24=_0x2c0625;return db[_0xbb20('0x36')][_0xbb20('0x52')]({'raw':!![]});})[_0xbb20('0x30')](function(_0x5e1b8d){var _0x91bd6b=fs['readFileSync'](path[_0xbb20('0x53')](config['root'],_0xbb20('0x54')),_0xbb20('0x55'));var _0x39fc2d=ejs[_0xbb20('0x56')](_0x91bd6b,{'contexts':_0x5e1b8d||[]});fs['writeFileSync'](_0xbb20('0x57'),_0x39fc2d);})[_0xbb20('0x30')](function(){return respondWithRpcPromise(_0xbb20('0x58'),_0xbb20('0x50'),{'module':_0xbb20('0x59')});})[_0xbb20('0x30')](function(){var _0x477b16=_0x24b0e9[_0xbb20('0x5a')][_0xbb20('0x31')]({'plain':!![]});if(!_0x477b16)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x477b16[_0xbb20('0x5b')]==='user'){var _0xf3e0d3=_0x333b24[_0xbb20('0x31')]({'plain':!![]});return db[_0xbb20('0x5c')][_0xbb20('0x4f')]({'where':{'name':_0xbb20('0x32'),'userProfileId':_0x477b16[_0xbb20('0x5d')]},'raw':!![]})[_0xbb20('0x30')](function(_0x1a77f3){if(_0x1a77f3&&_0x1a77f3['autoAssociation']===0x0){return db[_0xbb20('0x33')][_0xbb20('0x50')]({'name':_0xf3e0d3[_0xbb20('0x35')],'resourceId':_0xf3e0d3['id'],'type':_0x1a77f3['name'],'sectionId':_0x1a77f3['id']},{})[_0xbb20('0x30')](function(){return _0x333b24;});}else{return _0x333b24;}})[_0xbb20('0x22')](function(_0x39d661){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x39d661);throw _0x39d661;});}return _0x333b24;})[_0xbb20('0x30')](respondWithResult(_0x271d94,0xc9))['catch'](handleError(_0x271d94,null));};exports[_0xbb20('0x2e')]=function(_0x5f2f92,_0x9b994e,_0x258458){var _0x3e545b;return db[_0xbb20('0x36')][_0xbb20('0x4f')]({'where':{'id':_0x5f2f92[_0xbb20('0x4c')]['id']}})[_0xbb20('0x30')](handleEntityNotFound(_0x9b994e,null))['then'](saveUpdates(_0x5f2f92['body'],null))[_0xbb20('0x30')](function(_0x49bf68){if(_0x49bf68){_0x3e545b=_0x49bf68;return db['VoiceContext'][_0xbb20('0x52')]({'raw':!![]});}})[_0xbb20('0x30')](function(_0x2a9d82){var _0x18c0bf=fs[_0xbb20('0x5e')](path['join'](config[_0xbb20('0x5f')],_0xbb20('0x54')),'utf8');var _0x52f6b5=ejs[_0xbb20('0x56')](_0x18c0bf,{'contexts':_0x2a9d82||[]});fs[_0xbb20('0x60')](_0xbb20('0x57'),_0x52f6b5);})[_0xbb20('0x30')](function(){return respondWithRpcPromise('Reload',_0xbb20('0x2e'),{'module':_0xbb20('0x59')});})[_0xbb20('0x30')](function(){return _0x3e545b;})[_0xbb20('0x30')](respondWithResult(_0x9b994e,null))[_0xbb20('0x22')](handleError(_0x9b994e,null));};exports['destroy']=function(_0x1ad9c3,_0x1873ce,_0x37fad2){var _0xb1185c;return db[_0xbb20('0x36')][_0xbb20('0x4f')]({'where':{'id':_0x1ad9c3['params']['id']}})[_0xbb20('0x30')](handleEntityNotFound(_0x1873ce,null))['then'](removeEntity(_0x1873ce,null))[_0xbb20('0x30')](function(){return db[_0xbb20('0x36')][_0xbb20('0x52')]({'raw':!![]});})[_0xbb20('0x30')](function(_0x20a0df){var _0x13a035=fs[_0xbb20('0x5e')](path[_0xbb20('0x53')](config['root'],_0xbb20('0x54')),'utf8');var _0x309eea=ejs['render'](_0x13a035,{'contexts':_0x20a0df});fs[_0xbb20('0x60')](_0xbb20('0x57'),_0x309eea);return respondWithRpcPromise(_0xbb20('0x58'),_0xbb20('0x2f'),{'module':_0xbb20('0x59')});})['catch'](handleError(_0x1873ce,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 55c76d5..cee74c4 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 _0x40bc=['moment','bluebird','request-promise','../../config/environment','./voiceContext.attributes','define','lodash','util'];(function(_0x5f0b1c,_0x51038f){var _0x113360=function(_0x41ba84){while(--_0x41ba84){_0x5f0b1c['push'](_0x5f0b1c['shift']());}};_0x113360(++_0x51038f);}(_0x40bc,0x10e));var _0xc40b=function(_0x5ab887,_0x5c6305){_0x5ab887=_0x5ab887-0x0;var _0x431754=_0x40bc[_0x5ab887];return _0x431754;};'use strict';var _=require(_0xc40b('0x0'));var util=require(_0xc40b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc40b('0x2'));var BPromise=require(_0xc40b('0x3'));var rp=require(_0xc40b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc40b('0x5'));var attributes=require(_0xc40b('0x6'));module['exports']=function(_0x4bb225,_0x1a29fe){return _0x4bb225[_0xc40b('0x7')]('VoiceContext',attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x19a8=['moment','path','rimraf','../../config/environment','exports','define','VoiceContext','voice_contexts','lodash','util'];(function(_0x5ac118,_0x2d6a3a){var _0x2e66b2=function(_0x353752){while(--_0x353752){_0x5ac118['push'](_0x5ac118['shift']());}};_0x2e66b2(++_0x2d6a3a);}(_0x19a8,0x120));var _0x819a=function(_0x48549e,_0x167d58){_0x48549e=_0x48549e-0x0;var _0x262901=_0x19a8[_0x48549e];return _0x262901;};'use strict';var _=require(_0x819a('0x0'));var util=require(_0x819a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x819a('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x819a('0x3'));var rimraf=require(_0x819a('0x4'));var config=require(_0x819a('0x5'));var attributes=require('./voiceContext.attributes');module[_0x819a('0x6')]=function(_0x2aa6bd,_0x10bf31){return _0x2aa6bd[_0x819a('0x7')](_0x819a('0x8'),attributes,{'tableName':_0x819a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index e858317..93001be 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 _0xc234=['stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s'];(function(_0x4ee280,_0x2bdbac){var _0x1311c3=function(_0x4cb210){while(--_0x4cb210){_0x4ee280['push'](_0x4ee280['shift']());}};_0x1311c3(++_0x2bdbac);}(_0xc234,0x7f));var _0x4c23=function(_0xad8452,_0x116000){_0xad8452=_0xad8452-0x0;var _0x110f8f=_0xc234[_0xad8452];return _0x110f8f;};'use strict';var _=require('lodash');var util=require(_0x4c23('0x0'));var moment=require(_0x4c23('0x1'));var BPromise=require('bluebird');var rs=require(_0x4c23('0x2'));var fs=require('fs');var Redis=require(_0x4c23('0x3'));var db=require(_0x4c23('0x4'))['db'];var utils=require(_0x4c23('0x5'));var logger=require(_0x4c23('0x6'))(_0x4c23('0x7'));var config=require(_0x4c23('0x8'));var jayson=require(_0x4c23('0x9'));var client=jayson['client'][_0x4c23('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b1c09,_0x3dc42b,_0x44d13d){return new BPromise(function(_0xa2297d,_0x49a163){return client[_0x4c23('0xb')](_0x4b1c09,_0x44d13d)[_0x4c23('0xc')](function(_0x4d2e31){logger[_0x4c23('0xd')]('VoiceContext,\x20%s,\x20%s',_0x3dc42b,_0x4c23('0xe'));logger[_0x4c23('0xf')](_0x4c23('0x10'),_0x3dc42b,'request\x20sent',JSON[_0x4c23('0x11')](_0x4d2e31));if(_0x4d2e31['error']){if(_0x4d2e31[_0x4c23('0x12')][_0x4c23('0x13')]===0x1f4){logger[_0x4c23('0x12')](_0x4c23('0x14'),_0x3dc42b,_0x4d2e31['error'][_0x4c23('0x15')]);return _0x49a163(_0x4d2e31[_0x4c23('0x12')][_0x4c23('0x15')]);}logger[_0x4c23('0x12')]('VoiceContext,\x20%s,\x20%s',_0x3dc42b,_0x4d2e31['error']['message']);return _0xa2297d(_0x4d2e31[_0x4c23('0x12')][_0x4c23('0x15')]);}else{logger['info'](_0x4c23('0x14'),_0x3dc42b,_0x4c23('0xe'));_0xa2297d(_0x4d2e31[_0x4c23('0x16')][_0x4c23('0x15')]);}})[_0x4c23('0x17')](function(_0x135b4e){logger['error']('VoiceContext,\x20%s,\x20%s',_0x3dc42b,_0x135b4e);_0x49a163(_0x135b4e);});});} \ No newline at end of file +var _0xea85=['then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x9227d4,_0x13da92){var _0x4d6b44=function(_0x2cf757){while(--_0x2cf757){_0x9227d4['push'](_0x9227d4['shift']());}};_0x4d6b44(++_0x13da92);}(_0xea85,0x1cd));var _0x5ea8=function(_0x4dcae1,_0x15d7c1){_0x4dcae1=_0x4dcae1-0x0;var _0x5971e7=_0xea85[_0x4dcae1];return _0x5971e7;};'use strict';var _=require(_0x5ea8('0x0'));var util=require('util');var moment=require(_0x5ea8('0x1'));var BPromise=require(_0x5ea8('0x2'));var rs=require(_0x5ea8('0x3'));var fs=require('fs');var Redis=require(_0x5ea8('0x4'));var db=require(_0x5ea8('0x5'))['db'];var utils=require(_0x5ea8('0x6'));var logger=require(_0x5ea8('0x7'))(_0x5ea8('0x8'));var config=require(_0x5ea8('0x9'));var jayson=require(_0x5ea8('0xa'));var client=jayson[_0x5ea8('0xb')][_0x5ea8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x322848,_0x25aa3c,_0xa604ff){return new BPromise(function(_0x53baa9,_0x27938b){return client[_0x5ea8('0xd')](_0x322848,_0xa604ff)[_0x5ea8('0xe')](function(_0x16d173){logger['info'](_0x5ea8('0xf'),_0x25aa3c,_0x5ea8('0x10'));logger[_0x5ea8('0x11')](_0x5ea8('0x12'),_0x25aa3c,_0x5ea8('0x10'),JSON[_0x5ea8('0x13')](_0x16d173));if(_0x16d173[_0x5ea8('0x14')]){if(_0x16d173[_0x5ea8('0x14')][_0x5ea8('0x15')]===0x1f4){logger[_0x5ea8('0x14')](_0x5ea8('0xf'),_0x25aa3c,_0x16d173['error'][_0x5ea8('0x16')]);return _0x27938b(_0x16d173['error'][_0x5ea8('0x16')]);}logger[_0x5ea8('0x14')](_0x5ea8('0xf'),_0x25aa3c,_0x16d173[_0x5ea8('0x14')][_0x5ea8('0x16')]);return _0x53baa9(_0x16d173[_0x5ea8('0x14')][_0x5ea8('0x16')]);}else{logger[_0x5ea8('0x17')](_0x5ea8('0xf'),_0x25aa3c,_0x5ea8('0x10'));_0x53baa9(_0x16d173['result']['message']);}})[_0x5ea8('0x18')](function(_0x28a8b0){logger[_0x5ea8('0x14')](_0x5ea8('0xf'),_0x25aa3c,_0x28a8b0);_0x27938b(_0x28a8b0);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index e7a847b..890b2fd 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 _0x5f4b=['Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','destroy','multer','util','path','connect-timeout','express'];(function(_0x4c29df,_0xcba67e){var _0x30af2a=function(_0x3bc0f8){while(--_0x3bc0f8){_0x4c29df['push'](_0x4c29df['shift']());}};_0x30af2a(++_0xcba67e);}(_0x5f4b,0x1b3));var _0xb5f4=function(_0x15e67c,_0x1880f0){_0x15e67c=_0x15e67c-0x0;var _0x2d1ac6=_0x5f4b[_0x15e67c];return _0x2d1ac6;};'use strict';var multer=require(_0xb5f4('0x0'));var util=require(_0xb5f4('0x1'));var path=require(_0xb5f4('0x2'));var timeout=require(_0xb5f4('0x3'));var express=require(_0xb5f4('0x4'));var router=express[_0xb5f4('0x5')]();var fs_extra=require(_0xb5f4('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb5f4('0x7'));var config=require(_0xb5f4('0x8'));var controller=require(_0xb5f4('0x9'));router[_0xb5f4('0xa')]('/',auth[_0xb5f4('0xb')](),controller[_0xb5f4('0xc')]);router[_0xb5f4('0xa')](_0xb5f4('0xd'),auth[_0xb5f4('0xb')](),controller[_0xb5f4('0xe')]);router[_0xb5f4('0xa')]('/:id',auth[_0xb5f4('0xb')](),controller[_0xb5f4('0xf')]);router[_0xb5f4('0x10')]('/',auth[_0xb5f4('0xb')](),controller[_0xb5f4('0x11')]);router[_0xb5f4('0x12')](_0xb5f4('0x13'),auth[_0xb5f4('0xb')](),controller[_0xb5f4('0x14')]);router['delete'](_0xb5f4('0x13'),auth[_0xb5f4('0xb')](),controller[_0xb5f4('0x15')]);module['exports']=router; \ No newline at end of file +var _0xef36=['index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated'];(function(_0x527c39,_0x3ea2a6){var _0x3f4dd6=function(_0x1ec265){while(--_0x1ec265){_0x527c39['push'](_0x527c39['shift']());}};_0x3f4dd6(++_0x3ea2a6);}(_0xef36,0x18c));var _0x6ef3=function(_0x2556a7,_0x22583a){_0x2556a7=_0x2556a7-0x0;var _0x4ee6ad=_0xef36[_0x2556a7];return _0x4ee6ad;};'use strict';var multer=require(_0x6ef3('0x0'));var util=require(_0x6ef3('0x1'));var path=require(_0x6ef3('0x2'));var timeout=require(_0x6ef3('0x3'));var express=require(_0x6ef3('0x4'));var router=express[_0x6ef3('0x5')]();var fs_extra=require(_0x6ef3('0x6'));var auth=require(_0x6ef3('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6ef3('0x8'));var controller=require(_0x6ef3('0x9'));router[_0x6ef3('0xa')]('/',auth[_0x6ef3('0xb')](),controller[_0x6ef3('0xc')]);router[_0x6ef3('0xa')](_0x6ef3('0xd'),auth['isAuthenticated'](),controller[_0x6ef3('0xe')]);router[_0x6ef3('0xa')](_0x6ef3('0xf'),auth[_0x6ef3('0xb')](),controller[_0x6ef3('0x10')]);router[_0x6ef3('0x11')]('/',auth[_0x6ef3('0xb')](),controller[_0x6ef3('0x12')]);router[_0x6ef3('0x13')](_0x6ef3('0xf'),auth[_0x6ef3('0xb')](),controller[_0x6ef3('0x14')]);router[_0x6ef3('0x15')](_0x6ef3('0xf'),auth['isAuthenticated'](),controller[_0x6ef3('0x16')]);module[_0x6ef3('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index ed983fa..5472a06 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 _0xedd9=['DATE','called,connect,complete','exports','STRING','INTEGER'];(function(_0xf1ead4,_0x3bf221){var _0x5661ef=function(_0x48c747){while(--_0x48c747){_0xf1ead4['push'](_0xf1ead4['shift']());}};_0x5661ef(++_0x3bf221);}(_0xedd9,0xfc));var _0x9edd=function(_0x3bfd8b,_0x4305e8){_0x3bfd8b=_0x3bfd8b-0x0;var _0x49be81=_0xedd9[_0x3bfd8b];return _0x49be81;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'privilege':{'type':Sequelize[_0x9edd('0x1')]},'channel':{'type':Sequelize[_0x9edd('0x1')]},'channelstate':{'type':Sequelize[_0x9edd('0x2')]},'channelstatedesc':{'type':Sequelize[_0x9edd('0x1')]},'calleridnum':{'type':Sequelize[_0x9edd('0x1')]},'calleridname':{'type':Sequelize[_0x9edd('0x1')]},'connectedlinenum':{'type':Sequelize[_0x9edd('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x9edd('0x1')]},'accountcode':{'type':Sequelize[_0x9edd('0x1')]},'context':{'type':Sequelize[_0x9edd('0x1')]},'exten':{'type':Sequelize[_0x9edd('0x1')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x9edd('0x1')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x9edd('0x1')]},'destchannelstate':{'type':Sequelize[_0x9edd('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x9edd('0x1')]},'destcalleridnum':{'type':Sequelize[_0x9edd('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x9edd('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x9edd('0x1')]},'destaccountcode':{'type':Sequelize[_0x9edd('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x9edd('0x1')]},'destpriority':{'type':Sequelize[_0x9edd('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x9edd('0x1')]},'dialstring':{'type':Sequelize[_0x9edd('0x1')]},'dialstatus':{'type':Sequelize[_0x9edd('0x1')]},'starttime':{'type':Sequelize[_0x9edd('0x3')]},'answertime':{'type':Sequelize[_0x9edd('0x3')]},'endtime':{'type':Sequelize[_0x9edd('0x3')]},'lastevent':{'type':Sequelize[_0x9edd('0x1')],'comment':_0x9edd('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0x9edd('0x2')]},'holdtime':{'type':Sequelize[_0x9edd('0x2')]},'billableseconds':{'type':Sequelize[_0x9edd('0x2')]}}; \ No newline at end of file +var _0x00bb=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x3bab2a,_0x7c4ddb){var _0x11dbc0=function(_0x47f5f9){while(--_0x47f5f9){_0x3bab2a['push'](_0x3bab2a['shift']());}};_0x11dbc0(++_0x7c4ddb);}(_0x00bb,0x1d8));var _0xb00b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x00bb[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0xb00b('0x0'));module[_0xb00b('0x1')]={'privilege':{'type':Sequelize[_0xb00b('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xb00b('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb00b('0x2')]},'calleridname':{'type':Sequelize[_0xb00b('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb00b('0x2')]},'language':{'type':Sequelize[_0xb00b('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb00b('0x3')]},'uniqueid':{'type':Sequelize[_0xb00b('0x2')]},'linkedid':{'type':Sequelize[_0xb00b('0x2')]},'destchannel':{'type':Sequelize[_0xb00b('0x2')]},'destchannelstate':{'type':Sequelize[_0xb00b('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xb00b('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xb00b('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb00b('0x2')]},'destlanguage':{'type':Sequelize[_0xb00b('0x2')]},'destaccountcode':{'type':Sequelize[_0xb00b('0x2')]},'destcontext':{'type':Sequelize[_0xb00b('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb00b('0x3')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xb00b('0x2')]},'starttime':{'type':Sequelize[_0xb00b('0x4')]},'answertime':{'type':Sequelize[_0xb00b('0x4')]},'endtime':{'type':Sequelize[_0xb00b('0x4')]},'lastevent':{'type':Sequelize[_0xb00b('0x2')],'comment':_0xb00b('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xb00b('0x3')]},'holdtime':{'type':Sequelize[_0xb00b('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 6799c89..46a2050 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 _0xcd66=['index','map','VoiceDialReport','rawAttributes','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send'];(function(_0x122e15,_0x232eb6){var _0xd0a28e=function(_0x4ee004){while(--_0x4ee004){_0x122e15['push'](_0x122e15['shift']());}};_0xd0a28e(++_0x232eb6);}(_0xcd66,0xb0));var _0x6cd6=function(_0x913dfc,_0x25e640){_0x913dfc=_0x913dfc-0x0;var _0x32c5dd=_0xcd66[_0x913dfc];return _0x32c5dd;};'use strict';var emlformat=require(_0x6cd6('0x0'));var rimraf=require(_0x6cd6('0x1'));var zipdir=require(_0x6cd6('0x2'));var jsonpatch=require(_0x6cd6('0x3'));var rp=require(_0x6cd6('0x4'));var moment=require(_0x6cd6('0x5'));var BPromise=require(_0x6cd6('0x6'));var Mustache=require(_0x6cd6('0x7'));var util=require(_0x6cd6('0x8'));var path=require('path');var sox=require(_0x6cd6('0x9'));var csv=require(_0x6cd6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6cd6('0xb'));var _=require(_0x6cd6('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6cd6('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6cd6('0xe'));var Redis=require(_0x6cd6('0xf'));var authService=require(_0x6cd6('0x10'));var qs=require(_0x6cd6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6cd6('0x12'));var logger=require(_0x6cd6('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6cd6('0x14'))['db'];function respondWithStatusCode(_0x4d99ce,_0x26edac){_0x26edac=_0x26edac||0xcc;return function(_0x4552ca){if(_0x4552ca){return _0x4d99ce[_0x6cd6('0x15')](_0x26edac);}return _0x4d99ce[_0x6cd6('0x16')](_0x26edac)[_0x6cd6('0x17')]();};}function respondWithResult(_0x53f411,_0x2c992a){_0x2c992a=_0x2c992a||0xc8;return function(_0x121238){if(_0x121238){return _0x53f411[_0x6cd6('0x16')](_0x2c992a)['json'](_0x121238);}};}function respondWithFilteredResult(_0x2e34be,_0x162d9e){return function(_0x45280d){if(_0x45280d){var _0x253f73=typeof _0x162d9e[_0x6cd6('0x18')]===_0x6cd6('0x19')&&typeof _0x162d9e[_0x6cd6('0x1a')]===_0x6cd6('0x19');var _0x4a5eb3=_0x45280d[_0x6cd6('0x1b')];var _0x2e54f3=_0x253f73?0x0:_0x162d9e['offset'];var _0x4f62b7=_0x253f73?_0x45280d[_0x6cd6('0x1b')]:_0x162d9e[_0x6cd6('0x18')]+_0x162d9e[_0x6cd6('0x1a')];var _0x1dadc9;if(_0x4f62b7>=_0x4a5eb3){_0x4f62b7=_0x4a5eb3;_0x1dadc9=0xc8;}else{_0x1dadc9=0xce;}_0x2e34be[_0x6cd6('0x16')](_0x1dadc9);return _0x2e34be[_0x6cd6('0x1c')](_0x6cd6('0x1d'),_0x2e54f3+'-'+_0x4f62b7+'/'+_0x4a5eb3)[_0x6cd6('0x1e')](_0x45280d);}return null;};}function patchUpdates(_0x4cc60b){return function(_0x13b665){try{jsonpatch[_0x6cd6('0x1f')](_0x13b665,_0x4cc60b,!![]);}catch(_0x1101bd){return BPromise[_0x6cd6('0x20')](_0x1101bd);}return _0x13b665[_0x6cd6('0x21')]();};}function saveUpdates(_0x59ed0f,_0x57a398){return function(_0x2b0e9e){if(_0x2b0e9e){return _0x2b0e9e[_0x6cd6('0x22')](_0x59ed0f)[_0x6cd6('0x23')](function(_0x544bc2){return _0x544bc2;});}return null;};}function removeEntity(_0x10e701,_0x43f100){return function(_0x410da0){if(_0x410da0){return _0x410da0[_0x6cd6('0x24')]()[_0x6cd6('0x23')](function(){_0x10e701[_0x6cd6('0x16')](0xcc)[_0x6cd6('0x17')]();});}};}function handleEntityNotFound(_0x21cc5d,_0xb83c0c){return function(_0x31a65d){if(!_0x31a65d){_0x21cc5d['sendStatus'](0x194);}return _0x31a65d;};}function handleError(_0x2803bb,_0x551b48){_0x551b48=_0x551b48||0x1f4;return function(_0x18d52c){logger[_0x6cd6('0x25')](_0x18d52c['stack']);if(_0x18d52c[_0x6cd6('0x26')]){delete _0x18d52c[_0x6cd6('0x26')];}_0x2803bb[_0x6cd6('0x16')](_0x551b48)[_0x6cd6('0x27')](_0x18d52c);};}exports[_0x6cd6('0x28')]=function(_0x19cf78,_0x207075){var _0x297a00={},_0x1716a7={},_0x407269={'count':0x0,'rows':[]};var _0x48931a=_[_0x6cd6('0x29')](db[_0x6cd6('0x2a')][_0x6cd6('0x2b')],function(_0x2f2ffd){return{'name':_0x2f2ffd['fieldName'],'type':_0x2f2ffd[_0x6cd6('0x2c')][_0x6cd6('0x2d')]};});_0x1716a7[_0x6cd6('0x2e')]=_['map'](_0x48931a,_0x6cd6('0x26'));_0x1716a7[_0x6cd6('0x2f')]=_['keys'](_0x19cf78[_0x6cd6('0x2f')]);_0x1716a7['filters']=_['intersection'](_0x1716a7[_0x6cd6('0x2e')],_0x1716a7[_0x6cd6('0x2f')]);_0x297a00['attributes']=_[_0x6cd6('0x30')](_0x1716a7[_0x6cd6('0x2e')],qs[_0x6cd6('0x31')](_0x19cf78[_0x6cd6('0x2f')][_0x6cd6('0x31')]));_0x297a00[_0x6cd6('0x32')]=_0x297a00['attributes'][_0x6cd6('0x33')]?_0x297a00[_0x6cd6('0x32')]:_0x1716a7[_0x6cd6('0x2e')];if(!_0x19cf78[_0x6cd6('0x2f')][_0x6cd6('0x34')](_0x6cd6('0x35'))){_0x297a00[_0x6cd6('0x1a')]=qs[_0x6cd6('0x1a')](_0x19cf78[_0x6cd6('0x2f')][_0x6cd6('0x1a')]);_0x297a00[_0x6cd6('0x18')]=qs[_0x6cd6('0x18')](_0x19cf78[_0x6cd6('0x2f')][_0x6cd6('0x18')]);}_0x297a00['order']=qs['sort'](_0x19cf78[_0x6cd6('0x2f')][_0x6cd6('0x36')]);_0x297a00['where']=qs[_0x6cd6('0x37')](_[_0x6cd6('0x38')](_0x19cf78['query'],_0x1716a7[_0x6cd6('0x37')]),_0x48931a);if(_0x19cf78[_0x6cd6('0x2f')][_0x6cd6('0x39')]){_0x297a00[_0x6cd6('0x3a')]=_[_0x6cd6('0x3b')](_0x297a00[_0x6cd6('0x3a')],{'$or':_[_0x6cd6('0x29')](_0x48931a,function(_0xdf3fea){if(_0xdf3fea[_0x6cd6('0x2c')]!==_0x6cd6('0x3c')){var _0x315bb3={};_0x315bb3[_0xdf3fea[_0x6cd6('0x26')]]={'$like':'%'+_0x19cf78['query'][_0x6cd6('0x39')]+'%'};return _0x315bb3;}})});}_0x297a00=_[_0x6cd6('0x3b')]({},_0x297a00,_0x19cf78[_0x6cd6('0x3d')]);var _0x36ad48={'where':_0x297a00[_0x6cd6('0x3a')]};return db['VoiceDialReport'][_0x6cd6('0x1b')](_0x36ad48)['then'](function(_0x477379){_0x407269[_0x6cd6('0x1b')]=_0x477379;if(_0x19cf78[_0x6cd6('0x2f')][_0x6cd6('0x3e')]){_0x297a00[_0x6cd6('0x3f')]=[{'all':!![]}];}return db[_0x6cd6('0x2a')]['findAll'](_0x297a00);})['then'](function(_0x1778af){_0x407269[_0x6cd6('0x40')]=_0x1778af;return _0x407269;})[_0x6cd6('0x23')](respondWithFilteredResult(_0x207075,_0x297a00))[_0x6cd6('0x41')](handleError(_0x207075,null));};exports[_0x6cd6('0x42')]=function(_0x47e910,_0x11c969){var _0x56c2cd={'raw':!![],'where':{'id':_0x47e910[_0x6cd6('0x43')]['id']}},_0x5b29c6={};_0x5b29c6['model']=_['keys'](db[_0x6cd6('0x2a')][_0x6cd6('0x2b')]);_0x5b29c6[_0x6cd6('0x2f')]=_['keys'](_0x47e910[_0x6cd6('0x2f')]);_0x5b29c6[_0x6cd6('0x37')]=_[_0x6cd6('0x30')](_0x5b29c6[_0x6cd6('0x2e')],_0x5b29c6[_0x6cd6('0x2f')]);_0x56c2cd[_0x6cd6('0x32')]=_[_0x6cd6('0x30')](_0x5b29c6[_0x6cd6('0x2e')],qs[_0x6cd6('0x31')](_0x47e910[_0x6cd6('0x2f')][_0x6cd6('0x31')]));_0x56c2cd[_0x6cd6('0x32')]=_0x56c2cd[_0x6cd6('0x32')]['length']?_0x56c2cd['attributes']:_0x5b29c6['model'];if(_0x47e910[_0x6cd6('0x2f')][_0x6cd6('0x3e')]){_0x56c2cd[_0x6cd6('0x3f')]=[{'all':!![]}];}_0x56c2cd=_[_0x6cd6('0x3b')]({},_0x56c2cd,_0x47e910[_0x6cd6('0x3d')]);return db[_0x6cd6('0x2a')][_0x6cd6('0x44')](_0x56c2cd)[_0x6cd6('0x23')](handleEntityNotFound(_0x11c969,null))['then'](respondWithResult(_0x11c969,null))[_0x6cd6('0x41')](handleError(_0x11c969,null));};exports[_0x6cd6('0x45')]=function(_0x3643be,_0x4c8aac){return db[_0x6cd6('0x2a')][_0x6cd6('0x45')](_0x3643be['body'],{})[_0x6cd6('0x23')](respondWithResult(_0x4c8aac,0xc9))['catch'](handleError(_0x4c8aac,null));};exports['update']=function(_0x3d4485,_0x5ded9d){if(_0x3d4485[_0x6cd6('0x46')]['id']){delete _0x3d4485[_0x6cd6('0x46')]['id'];}return db['VoiceDialReport'][_0x6cd6('0x44')]({'where':{'id':_0x3d4485[_0x6cd6('0x43')]['id']}})[_0x6cd6('0x23')](handleEntityNotFound(_0x5ded9d,null))['then'](saveUpdates(_0x3d4485[_0x6cd6('0x46')],null))[_0x6cd6('0x23')](respondWithResult(_0x5ded9d,null))['catch'](handleError(_0x5ded9d,null));};exports[_0x6cd6('0x24')]=function(_0x13d0bd,_0x225e26){return db[_0x6cd6('0x2a')][_0x6cd6('0x44')]({'where':{'id':_0x13d0bd['params']['id']}})['then'](handleEntityNotFound(_0x225e26,null))[_0x6cd6('0x23')](removeEntity(_0x225e26,null))['catch'](handleError(_0x225e26,null));};exports['describe']=function(_0x4f8e4b,_0x326858){return db['VoiceDialReport'][_0x6cd6('0x47')]()[_0x6cd6('0x23')](respondWithResult(_0x326858,null))['catch'](handleError(_0x326858,null));}; \ No newline at end of file +var _0x0630=['../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','end','error','name','send','VoiceDialReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','findAll','rows','catch','show','keys','rawAttributes','include','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','squel','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0630,0xc7));var _0x0063=function(_0x3f3caf,_0x15637d){_0x3f3caf=_0x3f3caf-0x0;var _0x35065e=_0x0630[_0x3f3caf];return _0x35065e;};'use strict';var emlformat=require(_0x0063('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0063('0x1'));var jsonpatch=require(_0x0063('0x2'));var rp=require('request-promise');var moment=require(_0x0063('0x3'));var BPromise=require(_0x0063('0x4'));var Mustache=require(_0x0063('0x5'));var util=require(_0x0063('0x6'));var path=require('path');var sox=require(_0x0063('0x7'));var csv=require('to-csv');var ejs=require(_0x0063('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0063('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0063('0xa'));var querystring=require('querystring');var Papa=require(_0x0063('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0063('0xc'));var as=require(_0x0063('0xd'));var hardwareService=require(_0x0063('0xe'));var logger=require(_0x0063('0xf'))(_0x0063('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0063('0x11'));var db=require(_0x0063('0x12'))['db'];function respondWithStatusCode(_0xd7e230,_0x4b0ce3){_0x4b0ce3=_0x4b0ce3||0xcc;return function(_0x298894){if(_0x298894){return _0xd7e230[_0x0063('0x13')](_0x4b0ce3);}return _0xd7e230[_0x0063('0x14')](_0x4b0ce3)['end']();};}function respondWithResult(_0x150350,_0x2e62ca){_0x2e62ca=_0x2e62ca||0xc8;return function(_0xa8d109){if(_0xa8d109){return _0x150350[_0x0063('0x14')](_0x2e62ca)[_0x0063('0x15')](_0xa8d109);}};}function respondWithFilteredResult(_0x1d6c48,_0x301a0a){return function(_0x1324cc){if(_0x1324cc){var _0x57ca18=typeof _0x301a0a['offset']===_0x0063('0x16')&&typeof _0x301a0a[_0x0063('0x17')]===_0x0063('0x16');var _0x3825cc=_0x1324cc[_0x0063('0x18')];var _0x519e2e=_0x57ca18?0x0:_0x301a0a[_0x0063('0x19')];var _0x1f02a9=_0x57ca18?_0x1324cc[_0x0063('0x18')]:_0x301a0a['offset']+_0x301a0a[_0x0063('0x17')];var _0x4cf937;if(_0x1f02a9>=_0x3825cc){_0x1f02a9=_0x3825cc;_0x4cf937=0xc8;}else{_0x4cf937=0xce;}_0x1d6c48[_0x0063('0x14')](_0x4cf937);return _0x1d6c48[_0x0063('0x1a')](_0x0063('0x1b'),_0x519e2e+'-'+_0x1f02a9+'/'+_0x3825cc)[_0x0063('0x15')](_0x1324cc);}return null;};}function patchUpdates(_0x359750){return function(_0x26a52a){try{jsonpatch[_0x0063('0x1c')](_0x26a52a,_0x359750,!![]);}catch(_0x470533){return BPromise[_0x0063('0x1d')](_0x470533);}return _0x26a52a['save']();};}function saveUpdates(_0x5a8977,_0x4a11e7){return function(_0x2030a2){if(_0x2030a2){return _0x2030a2[_0x0063('0x1e')](_0x5a8977)[_0x0063('0x1f')](function(_0x3d051a){return _0x3d051a;});}return null;};}function removeEntity(_0xac7cd5,_0x1a6b9d){return function(_0x1cadea){if(_0x1cadea){return _0x1cadea[_0x0063('0x20')]()['then'](function(){_0xac7cd5[_0x0063('0x14')](0xcc)[_0x0063('0x21')]();});}};}function handleEntityNotFound(_0x293292,_0x18b483){return function(_0x5ddf38){if(!_0x5ddf38){_0x293292[_0x0063('0x13')](0x194);}return _0x5ddf38;};}function handleError(_0x543e3f,_0x3d3aaa){_0x3d3aaa=_0x3d3aaa||0x1f4;return function(_0x2b17ff){logger[_0x0063('0x22')](_0x2b17ff['stack']);if(_0x2b17ff['name']){delete _0x2b17ff[_0x0063('0x23')];}_0x543e3f[_0x0063('0x14')](_0x3d3aaa)[_0x0063('0x24')](_0x2b17ff);};}exports['index']=function(_0x42bc4d,_0x1740b2){var _0x288866={},_0x1c0f39={},_0x54b3b4={'count':0x0,'rows':[]};var _0x1bbf2c=_['map'](db[_0x0063('0x25')]['rawAttributes'],function(_0x5e0636){return{'name':_0x5e0636[_0x0063('0x26')],'type':_0x5e0636[_0x0063('0x27')][_0x0063('0x28')]};});_0x1c0f39[_0x0063('0x29')]=_['map'](_0x1bbf2c,'name');_0x1c0f39[_0x0063('0x2a')]=_['keys'](_0x42bc4d[_0x0063('0x2a')]);_0x1c0f39[_0x0063('0x2b')]=_[_0x0063('0x2c')](_0x1c0f39[_0x0063('0x29')],_0x1c0f39[_0x0063('0x2a')]);_0x288866[_0x0063('0x2d')]=_[_0x0063('0x2c')](_0x1c0f39['model'],qs[_0x0063('0x2e')](_0x42bc4d[_0x0063('0x2a')][_0x0063('0x2e')]));_0x288866[_0x0063('0x2d')]=_0x288866[_0x0063('0x2d')][_0x0063('0x2f')]?_0x288866[_0x0063('0x2d')]:_0x1c0f39[_0x0063('0x29')];if(!_0x42bc4d[_0x0063('0x2a')][_0x0063('0x30')](_0x0063('0x31'))){_0x288866[_0x0063('0x17')]=qs['limit'](_0x42bc4d[_0x0063('0x2a')][_0x0063('0x17')]);_0x288866[_0x0063('0x19')]=qs['offset'](_0x42bc4d['query'][_0x0063('0x19')]);}_0x288866[_0x0063('0x32')]=qs[_0x0063('0x33')](_0x42bc4d[_0x0063('0x2a')][_0x0063('0x33')]);_0x288866[_0x0063('0x34')]=qs['filters'](_[_0x0063('0x35')](_0x42bc4d[_0x0063('0x2a')],_0x1c0f39['filters']),_0x1bbf2c);if(_0x42bc4d[_0x0063('0x2a')][_0x0063('0x36')]){_0x288866[_0x0063('0x34')]=_[_0x0063('0x37')](_0x288866[_0x0063('0x34')],{'$or':_[_0x0063('0x38')](_0x1bbf2c,function(_0x5166c0){if(_0x5166c0['type']!=='VIRTUAL'){var _0x5f308c={};_0x5f308c[_0x5166c0[_0x0063('0x23')]]={'$like':'%'+_0x42bc4d[_0x0063('0x2a')][_0x0063('0x36')]+'%'};return _0x5f308c;}})});}_0x288866=_['merge']({},_0x288866,_0x42bc4d[_0x0063('0x39')]);var _0x6122af={'where':_0x288866[_0x0063('0x34')]};return db['VoiceDialReport']['count'](_0x6122af)[_0x0063('0x1f')](function(_0x5d4f88){_0x54b3b4[_0x0063('0x18')]=_0x5d4f88;if(_0x42bc4d['query'][_0x0063('0x3a')]){_0x288866['include']=[{'all':!![]}];}return db['VoiceDialReport'][_0x0063('0x3b')](_0x288866);})[_0x0063('0x1f')](function(_0x12ab11){_0x54b3b4[_0x0063('0x3c')]=_0x12ab11;return _0x54b3b4;})[_0x0063('0x1f')](respondWithFilteredResult(_0x1740b2,_0x288866))[_0x0063('0x3d')](handleError(_0x1740b2,null));};exports[_0x0063('0x3e')]=function(_0x1eeb92,_0x984fa3){var _0x4a6f4d={'raw':!![],'where':{'id':_0x1eeb92['params']['id']}},_0x2c344c={};_0x2c344c[_0x0063('0x29')]=_[_0x0063('0x3f')](db[_0x0063('0x25')][_0x0063('0x40')]);_0x2c344c['query']=_[_0x0063('0x3f')](_0x1eeb92[_0x0063('0x2a')]);_0x2c344c[_0x0063('0x2b')]=_[_0x0063('0x2c')](_0x2c344c[_0x0063('0x29')],_0x2c344c['query']);_0x4a6f4d[_0x0063('0x2d')]=_[_0x0063('0x2c')](_0x2c344c[_0x0063('0x29')],qs[_0x0063('0x2e')](_0x1eeb92[_0x0063('0x2a')]['fields']));_0x4a6f4d[_0x0063('0x2d')]=_0x4a6f4d[_0x0063('0x2d')][_0x0063('0x2f')]?_0x4a6f4d[_0x0063('0x2d')]:_0x2c344c[_0x0063('0x29')];if(_0x1eeb92['query'][_0x0063('0x3a')]){_0x4a6f4d[_0x0063('0x41')]=[{'all':!![]}];}_0x4a6f4d=_['merge']({},_0x4a6f4d,_0x1eeb92[_0x0063('0x39')]);return db[_0x0063('0x25')][_0x0063('0x42')](_0x4a6f4d)['then'](handleEntityNotFound(_0x984fa3,null))[_0x0063('0x1f')](respondWithResult(_0x984fa3,null))[_0x0063('0x3d')](handleError(_0x984fa3,null));};exports['create']=function(_0x19bf48,_0x4bf85e){return db[_0x0063('0x25')][_0x0063('0x43')](_0x19bf48['body'],{})[_0x0063('0x1f')](respondWithResult(_0x4bf85e,0xc9))['catch'](handleError(_0x4bf85e,null));};exports[_0x0063('0x1e')]=function(_0x14fd39,_0x50acde){if(_0x14fd39[_0x0063('0x44')]['id']){delete _0x14fd39[_0x0063('0x44')]['id'];}return db[_0x0063('0x25')][_0x0063('0x42')]({'where':{'id':_0x14fd39[_0x0063('0x45')]['id']}})[_0x0063('0x1f')](handleEntityNotFound(_0x50acde,null))[_0x0063('0x1f')](saveUpdates(_0x14fd39[_0x0063('0x44')],null))[_0x0063('0x1f')](respondWithResult(_0x50acde,null))['catch'](handleError(_0x50acde,null));};exports[_0x0063('0x20')]=function(_0x41dadc,_0x111dcd){return db[_0x0063('0x25')][_0x0063('0x42')]({'where':{'id':_0x41dadc[_0x0063('0x45')]['id']}})[_0x0063('0x1f')](handleEntityNotFound(_0x111dcd,null))[_0x0063('0x1f')](removeEntity(_0x111dcd,null))['catch'](handleError(_0x111dcd,null));};exports[_0x0063('0x46')]=function(_0x566e2e,_0x21b5c7){return db[_0x0063('0x25')][_0x0063('0x46')]()[_0x0063('0x1f')](respondWithResult(_0x21b5c7,null))[_0x0063('0x3d')](handleError(_0x21b5c7,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 7f3c49f..075dcdd 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 _0xec38=['path','rimraf','../../config/environment','./voiceDialReport.attributes','VoiceDialReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x362c9d,_0x3b8c08){var _0x2b3545=function(_0x431b79){while(--_0x431b79){_0x362c9d['push'](_0x362c9d['shift']());}};_0x2b3545(++_0x3b8c08);}(_0xec38,0x1f4));var _0x8ec3=function(_0x4adf20,_0x41cc23){_0x4adf20=_0x4adf20-0x0;var _0x5e2b5b=_0xec38[_0x4adf20];return _0x5e2b5b;};'use strict';var _=require(_0x8ec3('0x0'));var util=require(_0x8ec3('0x1'));var logger=require(_0x8ec3('0x2'))(_0x8ec3('0x3'));var moment=require(_0x8ec3('0x4'));var BPromise=require(_0x8ec3('0x5'));var rp=require(_0x8ec3('0x6'));var fs=require('fs');var path=require(_0x8ec3('0x7'));var rimraf=require(_0x8ec3('0x8'));var config=require(_0x8ec3('0x9'));var attributes=require(_0x8ec3('0xa'));module['exports']=function(_0x353e89,_0x4db3e1){return _0x353e89['define'](_0x8ec3('0xb'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x8ec3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6f33=['moment','bluebird','request-promise','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','util','../../config/logger','api'];(function(_0x586358,_0x599303){var _0x5202a1=function(_0x20b28c){while(--_0x20b28c){_0x586358['push'](_0x586358['shift']());}};_0x5202a1(++_0x599303);}(_0x6f33,0x169));var _0x36f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f33[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x36f3('0x0'));var logger=require(_0x36f3('0x1'))(_0x36f3('0x2'));var moment=require(_0x36f3('0x3'));var BPromise=require(_0x36f3('0x4'));var rp=require(_0x36f3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x36f3('0x6'));var config=require(_0x36f3('0x7'));var attributes=require(_0x36f3('0x8'));module[_0x36f3('0x9')]=function(_0x4f6e4b,_0x5105d3){return _0x4f6e4b[_0x36f3('0xa')](_0x36f3('0xb'),attributes,{'tableName':_0x36f3('0xc'),'paranoid':![],'indexes':[{'fields':[_0x36f3('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 08a1c58..bd3f3de 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 _0x4d46=['attributes','limit','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceDialReport','create','body','options','info','CreateVoiceDialReport','UpdateVoiceDialReport','update','raw','where'];(function(_0x5ce0e9,_0x7c0d68){var _0x33f319=function(_0x56788b){while(--_0x56788b){_0x5ce0e9['push'](_0x5ce0e9['shift']());}};_0x33f319(++_0x7c0d68);}(_0x4d46,0x1de));var _0x64d4=function(_0x3e83d0,_0x4fdcd3){_0x3e83d0=_0x3e83d0-0x0;var _0x70c69d=_0x4d46[_0x3e83d0];return _0x70c69d;};'use strict';var _=require(_0x64d4('0x0'));var util=require(_0x64d4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x64d4('0x2'));var fs=require('fs');var Redis=require(_0x64d4('0x3'));var db=require(_0x64d4('0x4'))['db'];var utils=require(_0x64d4('0x5'));var logger=require(_0x64d4('0x6'))(_0x64d4('0x7'));var config=require('../../config/environment');var jayson=require(_0x64d4('0x8'));var client=jayson['client'][_0x64d4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2399d4,_0x386af9,_0x5af71d){return new BPromise(function(_0x4597b8,_0x775bbd){return client[_0x64d4('0xa')](_0x2399d4,_0x5af71d)[_0x64d4('0xb')](function(_0x9052ae){logger['info'](_0x64d4('0xc'),_0x386af9,_0x64d4('0xd'));logger[_0x64d4('0xe')](_0x64d4('0xf'),_0x386af9,_0x64d4('0xd'),JSON[_0x64d4('0x10')](_0x9052ae));if(_0x9052ae[_0x64d4('0x11')]){if(_0x9052ae[_0x64d4('0x11')][_0x64d4('0x12')]===0x1f4){logger[_0x64d4('0x11')](_0x64d4('0xc'),_0x386af9,_0x9052ae['error']['message']);return _0x775bbd(_0x9052ae[_0x64d4('0x11')]['message']);}logger[_0x64d4('0x11')](_0x64d4('0xc'),_0x386af9,_0x9052ae[_0x64d4('0x11')][_0x64d4('0x13')]);return _0x4597b8(_0x9052ae['error'][_0x64d4('0x13')]);}else{logger['info'](_0x64d4('0xc'),_0x386af9,_0x64d4('0xd'));_0x4597b8(_0x9052ae[_0x64d4('0x14')][_0x64d4('0x13')]);}})[_0x64d4('0x15')](function(_0x46b8b9){logger['error'](_0x64d4('0xc'),_0x386af9,_0x46b8b9);_0x775bbd(_0x46b8b9);});});}exports['CreateVoiceDialReport']=function(_0x279a2c){var _0x424c7b=this;return new Promise(function(_0x2ee4db,_0x5e382b){return db[_0x64d4('0x16')][_0x64d4('0x17')](_0x279a2c[_0x64d4('0x18')],{'raw':_0x279a2c[_0x64d4('0x19')]?_0x279a2c[_0x64d4('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x64d4('0xb')](function(_0x503d3a){logger[_0x64d4('0x1a')](_0x64d4('0x1b'),_0x279a2c);logger[_0x64d4('0xe')](_0x64d4('0x1b'),_0x279a2c,JSON['stringify'](_0x503d3a));_0x2ee4db(_0x503d3a);})[_0x64d4('0x15')](function(_0x4ef776){logger[_0x64d4('0x11')](_0x64d4('0x1b'),_0x4ef776[_0x64d4('0x13')],_0x279a2c);_0x5e382b(_0x424c7b['error'](0x1f4,_0x4ef776[_0x64d4('0x13')]));});});};exports[_0x64d4('0x1c')]=function(_0x499943){var _0x3e9156=this;return new Promise(function(_0x4dd7a9,_0x5c0b86){return db['VoiceDialReport'][_0x64d4('0x1d')](_0x499943['body'],{'raw':_0x499943[_0x64d4('0x19')]?_0x499943[_0x64d4('0x19')][_0x64d4('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x499943[_0x64d4('0x19')]?_0x499943[_0x64d4('0x19')][_0x64d4('0x1f')]||null:null,'attributes':_0x499943[_0x64d4('0x19')]?_0x499943[_0x64d4('0x19')][_0x64d4('0x20')]||null:null,'limit':_0x499943[_0x64d4('0x19')]?_0x499943[_0x64d4('0x19')][_0x64d4('0x21')]||null:null})[_0x64d4('0xb')](function(_0x30df0b){logger[_0x64d4('0x1a')](_0x64d4('0x1c'),_0x499943);logger[_0x64d4('0xe')](_0x64d4('0x1c'),_0x499943,JSON[_0x64d4('0x10')](_0x30df0b));_0x4dd7a9(_0x30df0b);})['catch'](function(_0x129e20){logger[_0x64d4('0x11')]('UpdateVoiceDialReport',_0x129e20['message'],_0x499943);_0x5c0b86(_0x3e9156[_0x64d4('0x11')](0x1f4,_0x129e20[_0x64d4('0x13')]));});});}; \ No newline at end of file +var _0x72ca=['randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','UpdateVoiceDialReport','update','where','limit','util','moment'];(function(_0x325024,_0x10aa13){var _0x111660=function(_0x3be0f8){while(--_0x3be0f8){_0x325024['push'](_0x325024['shift']());}};_0x111660(++_0x10aa13);}(_0x72ca,0x1c0));var _0xa72c=function(_0x1a4aaa,_0x3c9a40){_0x1a4aaa=_0x1a4aaa-0x0;var _0x48c5c0=_0x72ca[_0x1a4aaa];return _0x48c5c0;};'use strict';var _=require('lodash');var util=require(_0xa72c('0x0'));var moment=require(_0xa72c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa72c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa72c('0x3'));var logger=require(_0xa72c('0x4'))(_0xa72c('0x5'));var config=require('../../config/environment');var jayson=require(_0xa72c('0x6'));var client=jayson[_0xa72c('0x7')][_0xa72c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4f2112,_0x35103b,_0x4dcf35){return new BPromise(function(_0x19ac99,_0x425661){return client[_0xa72c('0x9')](_0x4f2112,_0x4dcf35)[_0xa72c('0xa')](function(_0x2e48f6){logger['info'](_0xa72c('0xb'),_0x35103b,_0xa72c('0xc'));logger[_0xa72c('0xd')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x35103b,_0xa72c('0xc'),JSON[_0xa72c('0xe')](_0x2e48f6));if(_0x2e48f6[_0xa72c('0xf')]){if(_0x2e48f6['error'][_0xa72c('0x10')]===0x1f4){logger[_0xa72c('0xf')](_0xa72c('0xb'),_0x35103b,_0x2e48f6[_0xa72c('0xf')][_0xa72c('0x11')]);return _0x425661(_0x2e48f6[_0xa72c('0xf')][_0xa72c('0x11')]);}logger[_0xa72c('0xf')](_0xa72c('0xb'),_0x35103b,_0x2e48f6['error'][_0xa72c('0x11')]);return _0x19ac99(_0x2e48f6['error'][_0xa72c('0x11')]);}else{logger[_0xa72c('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x35103b,_0xa72c('0xc'));_0x19ac99(_0x2e48f6['result'][_0xa72c('0x11')]);}})[_0xa72c('0x13')](function(_0x113b3d){logger[_0xa72c('0xf')](_0xa72c('0xb'),_0x35103b,_0x113b3d);_0x425661(_0x113b3d);});});}exports[_0xa72c('0x14')]=function(_0xb885a2){var _0x4f25a5=this;return new Promise(function(_0x33cd9c,_0x38e4a0){return db[_0xa72c('0x15')][_0xa72c('0x16')](_0xb885a2[_0xa72c('0x17')],{'raw':_0xb885a2[_0xa72c('0x18')]?_0xb885a2[_0xa72c('0x18')][_0xa72c('0x19')]===undefined?!![]:![]:!![]})[_0xa72c('0xa')](function(_0x5a9633){logger[_0xa72c('0x12')](_0xa72c('0x14'),_0xb885a2);logger['debug'](_0xa72c('0x14'),_0xb885a2,JSON[_0xa72c('0xe')](_0x5a9633));_0x33cd9c(_0x5a9633);})[_0xa72c('0x13')](function(_0x507425){logger['error'](_0xa72c('0x14'),_0x507425[_0xa72c('0x11')],_0xb885a2);_0x38e4a0(_0x4f25a5['error'](0x1f4,_0x507425[_0xa72c('0x11')]));});});};exports[_0xa72c('0x1a')]=function(_0x3c0465){var _0x187ce0=this;return new Promise(function(_0x3e9eb7,_0x353c05){return db['VoiceDialReport'][_0xa72c('0x1b')](_0x3c0465[_0xa72c('0x17')],{'raw':_0x3c0465[_0xa72c('0x18')]?_0x3c0465['options'][_0xa72c('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c0465[_0xa72c('0x18')]?_0x3c0465[_0xa72c('0x18')][_0xa72c('0x1c')]||null:null,'attributes':_0x3c0465[_0xa72c('0x18')]?_0x3c0465['options']['attributes']||null:null,'limit':_0x3c0465[_0xa72c('0x18')]?_0x3c0465[_0xa72c('0x18')][_0xa72c('0x1d')]||null:null})[_0xa72c('0xa')](function(_0x14c8a1){logger[_0xa72c('0x12')](_0xa72c('0x1a'),_0x3c0465);logger[_0xa72c('0xd')](_0xa72c('0x1a'),_0x3c0465,JSON[_0xa72c('0xe')](_0x14c8a1));_0x3e9eb7(_0x14c8a1);})['catch'](function(_0x4deb54){logger[_0xa72c('0xf')](_0xa72c('0x1a'),_0x4deb54['message'],_0x3c0465);_0x353c05(_0x187ce0[_0xa72c('0xf')](0x1f4,_0x4deb54[_0xa72c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 86c23b2..19f349c 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 _0x6d8a=['post','create','addApplications','put','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show'];(function(_0x41522d,_0x54f55e){var _0x1563ec=function(_0x34967a){while(--_0x34967a){_0x41522d['push'](_0x41522d['shift']());}};_0x1563ec(++_0x54f55e);}(_0x6d8a,0x120));var _0xa6d8=function(_0x1ae31c,_0x8dcd2d){_0x1ae31c=_0x1ae31c-0x0;var _0x19519d=_0x6d8a[_0x1ae31c];return _0x19519d;};'use strict';var multer=require(_0xa6d8('0x0'));var util=require(_0xa6d8('0x1'));var path=require('path');var timeout=require(_0xa6d8('0x2'));var express=require(_0xa6d8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa6d8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa6d8('0x5'));var controller=require(_0xa6d8('0x6'));router[_0xa6d8('0x7')]('/',auth[_0xa6d8('0x8')](),controller[_0xa6d8('0x9')]);router[_0xa6d8('0x7')](_0xa6d8('0xa'),auth[_0xa6d8('0x8')](),controller[_0xa6d8('0xb')]);router[_0xa6d8('0xc')]('/',auth['isAuthenticated'](),controller[_0xa6d8('0xd')]);router[_0xa6d8('0xc')]('/:id/applications',auth[_0xa6d8('0x8')](),controller[_0xa6d8('0xe')]);router[_0xa6d8('0xf')](_0xa6d8('0xa'),auth[_0xa6d8('0x8')](),controller[_0xa6d8('0x10')]);router[_0xa6d8('0x11')](_0xa6d8('0xa'),auth[_0xa6d8('0x8')](),controller[_0xa6d8('0x12')]);module[_0xa6d8('0x13')]=router; \ No newline at end of file +var _0xa4c1=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','addApplications','put','destroy','exports'];(function(_0x3e1e8e,_0x5e49bf){var _0x10c861=function(_0x20925d){while(--_0x20925d){_0x3e1e8e['push'](_0x3e1e8e['shift']());}};_0x10c861(++_0x5e49bf);}(_0xa4c1,0x70));var _0x1a4c=function(_0x141e03,_0x18340e){_0x141e03=_0x141e03-0x0;var _0x2074e3=_0xa4c1[_0x141e03];return _0x2074e3;};'use strict';var multer=require('multer');var util=require(_0x1a4c('0x0'));var path=require(_0x1a4c('0x1'));var timeout=require(_0x1a4c('0x2'));var express=require(_0x1a4c('0x3'));var router=express[_0x1a4c('0x4')]();var fs_extra=require(_0x1a4c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1a4c('0x6'));var config=require(_0x1a4c('0x7'));var controller=require('./voiceExtension.controller');router['get']('/',auth[_0x1a4c('0x8')](),controller['index']);router[_0x1a4c('0x9')](_0x1a4c('0xa'),auth[_0x1a4c('0x8')](),controller[_0x1a4c('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/applications',auth[_0x1a4c('0x8')](),controller[_0x1a4c('0xc')]);router[_0x1a4c('0xd')](_0x1a4c('0xa'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x1a4c('0x8')](),controller[_0x1a4c('0xe')]);module[_0x1a4c('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index f538ff5..51889be 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 _0x00c8=['system','any','*,*,*,*','INTEGER','wav','BOOLEAN','VIRTUAL','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','outbound-fax'];(function(_0x387b02,_0xe5094a){var _0x1ebf5b=function(_0x46ab10){while(--_0x46ab10){_0x387b02['push'](_0x387b02['shift']());}};_0x1ebf5b(++_0xe5094a);}(_0x00c8,0x14a));var _0x800c=function(_0x2f0b82,_0xa07e26){_0x2f0b82=_0x2f0b82-0x0;var _0x5d6fb1=_0x00c8[_0x2f0b82];return _0x5d6fb1;};'use strict';var Sequelize=require(_0x800c('0x0'));module[_0x800c('0x1')]={'context':{'type':Sequelize[_0x800c('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x800c('0x2')],'allowNull':![],'unique':_0x800c('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x800c('0x3')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x800c('0x2')],'allowNull':![],'defaultValue':_0x800c('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x800c('0x5')](_0x800c('0x6'),_0x800c('0x7'),_0x800c('0x8'),'inbound-fax',_0x800c('0x9'),_0x800c('0xa'),_0x800c('0xb')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x800c('0x2')],'allowNull':![],'defaultValue':_0x800c('0xc')},'IntervalId':{'type':Sequelize[_0x800c('0xd')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x800c('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x800c('0xd')]},'recordingFormat':{'type':Sequelize[_0x800c('0x2')],'defaultValue':_0x800c('0xe')},'answer':{'type':Sequelize[_0x800c('0xf')],'defaultValue':!![]},'name':{'type':Sequelize[_0x800c('0x10')],'get':function(_0x4772ab){return this['getDataValue']('exten');}},'alias':{'type':Sequelize[_0x800c('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x2e6d=['ENUM','inbound','internal','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','sequelize','exports','STRING','compositeIndex','NoOp'];(function(_0x4d68cf,_0x3989b9){var _0x46907c=function(_0x4505f9){while(--_0x4505f9){_0x4d68cf['push'](_0x4d68cf['shift']());}};_0x46907c(++_0x3989b9);}(_0x2e6d,0x1db));var _0xd2e6=function(_0x2da525,_0x315a01){_0x2da525=_0x2da525-0x0;var _0xf0a632=_0x2e6d[_0x2da525];return _0xf0a632;};'use strict';var Sequelize=require(_0xd2e6('0x0'));module[_0xd2e6('0x1')]={'context':{'type':Sequelize[_0xd2e6('0x2')],'allowNull':![],'unique':_0xd2e6('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd2e6('0x3')},'priority':{'type':Sequelize[_0xd2e6('0x2')],'allowNull':![],'defaultValue':'1','unique':_0xd2e6('0x3')},'tag':{'type':Sequelize[_0xd2e6('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xd2e6('0x2')],'allowNull':![],'defaultValue':_0xd2e6('0x4')},'appdata':{'type':Sequelize[_0xd2e6('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xd2e6('0x5')](_0xd2e6('0x6'),'outbound',_0xd2e6('0x7'),'inbound-fax','outbound-fax',_0xd2e6('0x8'),_0xd2e6('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0xd2e6('0x2')]},'interval':{'type':Sequelize[_0xd2e6('0x2')],'allowNull':![],'defaultValue':_0xd2e6('0xa')},'IntervalId':{'type':Sequelize[_0xd2e6('0xb')]},'isApp':{'type':Sequelize[_0xd2e6('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xd2e6('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xd2e6('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xd2e6('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xd2e6('0xb')]},'recordingFormat':{'type':Sequelize[_0xd2e6('0x2')],'defaultValue':_0xd2e6('0xd')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0xd2e6('0xe')],'get':function(_0x526a2b){return this[_0xd2e6('0xf')]('exten');}},'alias':{'type':Sequelize[_0xd2e6('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index cb7e3d7..a2d0596 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 _0x3f92=['findAndCountAll','priority','lodash','ioredis','../../components/parsers/qs','../../config/logger','defaults','redis','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','limit','undefined','offset','count','Content-Range','json','then','get','InboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','type','find','name','UserProfileResource','destroy','error','stack','send','index','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filters','merge','VIRTUAL','options','VoiceExtension','include','findAll','rows','catch','show','params','body','concat','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','inbound','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','exten','description','recordingFormat','cutdigits','mandatoryDisposition','alias','context','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','isApp','createRouting','bulkCreate'];(function(_0x16cb03,_0x43ea58){var _0x10944e=function(_0x27ebaa){while(--_0x27ebaa){_0x16cb03['push'](_0x16cb03['shift']());}};_0x10944e(++_0x43ea58);}(_0x3f92,0x113));var _0x23f9=function(_0x2e502,_0x224753){_0x2e502=_0x2e502-0x0;var _0x3e17a4=_0x3f92[_0x2e502];return _0x3e17a4;};'use strict';var _=require(_0x23f9('0x0'));var Redis=require(_0x23f9('0x1'));var qs=require(_0x23f9('0x2'));var logger=require(_0x23f9('0x3'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0x23f9('0x4')](config[_0x23f9('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0x23f9('0x6'))(new Redis(config[_0x23f9('0x5')]));require(_0x23f9('0x7'))[_0x23f9('0x8')](socket);function respondWithStatusCode(_0x184be4,_0x30b15c){_0x30b15c=_0x30b15c||0xcc;return function(_0xf46992){if(_0xf46992){return _0x184be4[_0x23f9('0x9')](_0x30b15c);}return _0x184be4[_0x23f9('0xa')](_0x30b15c)[_0x23f9('0xb')]();};}function respondWithResult(_0xc6364f,_0x2aad87){_0x2aad87=_0x2aad87||0xc8;return function(_0x4834ec){if(_0x4834ec){return _0xc6364f[_0x23f9('0xa')](_0x2aad87)['json'](_0x4834ec);}};}function respondWithFilteredResult(_0x4869f9,_0x3b8a81){return function(_0x158298){if(_0x158298){var _0x19a96d=typeof _0x3b8a81['offset']==='undefined'&&typeof _0x3b8a81[_0x23f9('0xc')]===_0x23f9('0xd');var _0x195c56=_0x158298['count'];var _0x109046=_0x19a96d?0x0:_0x3b8a81[_0x23f9('0xe')];var _0x2ddef0=_0x19a96d?_0x158298[_0x23f9('0xf')]:_0x3b8a81[_0x23f9('0xe')]+_0x3b8a81[_0x23f9('0xc')];var _0xf68773;if(_0x2ddef0>=_0x195c56){_0x2ddef0=_0x195c56;_0xf68773=0xc8;}else{_0xf68773=0xce;}_0x4869f9[_0x23f9('0xa')](_0xf68773);return _0x4869f9['set'](_0x23f9('0x10'),_0x109046+'-'+_0x2ddef0+'/'+_0x195c56)[_0x23f9('0x11')](_0x158298);}return null;};}function removeEntity(_0x281dd4){return function(_0x222735){if(_0x222735){return _0x222735['destroy']()[_0x23f9('0x12')](function(){var _0x13a23b=_0x222735[_0x23f9('0x13')]({'plain':!![]});var _0x1930ad=[{'name':_0x23f9('0x14'),'value':'inbound','ignore':![]},{'name':'OutboundRoutes','value':_0x23f9('0x15'),'ignore':![]},{'name':_0x23f9('0x16'),'value':_0x23f9('0x17'),'ignore':![]}];var _0x5d53e3=_(_0x1930ad)[_0x23f9('0x18')](_0x23f9('0x19'))[_0x23f9('0x1a')](_0x23f9('0x1b'))[_0x23f9('0x1b')]();if(_[_0x23f9('0x1c')](_0x5d53e3,_0x13a23b[_0x23f9('0x1d')])){return;}var _0x4d3210=_[_0x23f9('0x1e')](_0x1930ad,[_0x23f9('0x1b'),_0x13a23b[_0x23f9('0x1d')]])[_0x23f9('0x1f')];return db[_0x23f9('0x20')][_0x23f9('0x21')]({'where':{'type':_0x4d3210,'resourceId':_0x13a23b['id']}})['then'](function(){return _0x222735;});})['then'](function(){_0x281dd4[_0x23f9('0xa')](0xcc)[_0x23f9('0xb')]();});}};}function handleEntityNotFound(_0x33532e){return function(_0x3bc7e2){if(!_0x3bc7e2){_0x33532e[_0x23f9('0x9')](0x194);}return _0x3bc7e2;};}function handleError(_0x1215b3,_0x5ca355){_0x5ca355=_0x5ca355||0x1f4;return function(_0x2a0b76){logger[_0x23f9('0x22')](_0x2a0b76[_0x23f9('0x23')]);if(_0x2a0b76['name']){delete _0x2a0b76[_0x23f9('0x1f')];}_0x1215b3['status'](_0x5ca355)[_0x23f9('0x24')](_0x2a0b76);};}exports[_0x23f9('0x25')]=function(_0x562c81,_0x312142){var _0x585c9f={},_0x439737={},_0x4c60f1={'count':0x0,'rows':[]};var _0x4564cd=_[_0x23f9('0x1a')](db['VoiceExtension'][_0x23f9('0x26')],function(_0x9ae9b5){return{'name':_0x9ae9b5[_0x23f9('0x27')],'type':_0x9ae9b5[_0x23f9('0x1d')][_0x23f9('0x28')]};});_0x439737[_0x23f9('0x29')]=_['map'](_0x4564cd,'name');_0x439737[_0x23f9('0x2a')]=_[_0x23f9('0x2b')](_0x562c81[_0x23f9('0x2a')]);_0x439737['filters']=_[_0x23f9('0x2c')](_0x439737[_0x23f9('0x29')],_0x439737[_0x23f9('0x2a')]);_0x585c9f[_0x23f9('0x2d')]=_['intersection'](_0x439737['model'],qs[_0x23f9('0x2e')](_0x562c81[_0x23f9('0x2a')][_0x23f9('0x2e')]));_0x585c9f['attributes']=_0x585c9f[_0x23f9('0x2d')][_0x23f9('0x2f')]?_0x585c9f[_0x23f9('0x2d')]:_0x439737[_0x23f9('0x29')];if(!_0x562c81[_0x23f9('0x2a')][_0x23f9('0x30')]('nolimit')){_0x585c9f['limit']=qs[_0x23f9('0xc')](_0x562c81['query'][_0x23f9('0xc')]);_0x585c9f['offset']=qs[_0x23f9('0xe')](_0x562c81[_0x23f9('0x2a')][_0x23f9('0xe')]);}_0x585c9f['order']=qs[_0x23f9('0x31')](_0x562c81[_0x23f9('0x2a')][_0x23f9('0x31')]);_0x585c9f[_0x23f9('0x32')]=qs['filters'](_[_0x23f9('0x33')](_0x562c81[_0x23f9('0x2a')],_0x439737[_0x23f9('0x34')]),_0x4564cd);if(_0x562c81['query'][_0x23f9('0x18')]){_0x585c9f['where']=_[_0x23f9('0x35')](_0x585c9f[_0x23f9('0x32')],{'$or':_[_0x23f9('0x1a')](_0x4564cd,function(_0x54e25){if(_0x54e25[_0x23f9('0x1d')]!==_0x23f9('0x36')){var _0x31acac={};_0x31acac[_0x54e25['name']]={'$like':'%'+_0x562c81[_0x23f9('0x2a')][_0x23f9('0x18')]+'%'};return _0x31acac;}})});}_0x585c9f=_[_0x23f9('0x35')]({},_0x585c9f,_0x562c81[_0x23f9('0x37')]);var _0x830bf2={'where':_0x585c9f['where']};return db[_0x23f9('0x38')][_0x23f9('0xf')](_0x830bf2)[_0x23f9('0x12')](function(_0x2bbbfa){_0x4c60f1['count']=_0x2bbbfa;if(_0x562c81[_0x23f9('0x2a')]['includeAll']){_0x585c9f[_0x23f9('0x39')]=[{'all':!![]}];}return db[_0x23f9('0x38')][_0x23f9('0x3a')](_0x585c9f);})[_0x23f9('0x12')](function(_0x2cbe7d){_0x4c60f1[_0x23f9('0x3b')]=_0x2cbe7d;return _0x4c60f1;})[_0x23f9('0x12')](respondWithFilteredResult(_0x312142,_0x585c9f))[_0x23f9('0x3c')](handleError(_0x312142,null));};exports[_0x23f9('0x3d')]=function(_0xa930b5,_0x240719){var _0x43aa9e={'raw':![],'where':{'id':_0xa930b5[_0x23f9('0x3e')]['id']}},_0x19e3cf={};_0x19e3cf[_0x23f9('0x29')]=_[_0x23f9('0x2b')](db[_0x23f9('0x38')][_0x23f9('0x26')]);_0x19e3cf[_0x23f9('0x2a')]=_[_0x23f9('0x2b')](_0xa930b5['query']);_0x19e3cf[_0x23f9('0x34')]=_[_0x23f9('0x2c')](_0x19e3cf[_0x23f9('0x29')],_0x19e3cf['query']);_0x43aa9e['attributes']=_[_0x23f9('0x2c')](_0x19e3cf[_0x23f9('0x29')],qs[_0x23f9('0x2e')](_0xa930b5[_0x23f9('0x2a')][_0x23f9('0x2e')]));_0x43aa9e[_0x23f9('0x2d')]=_0x43aa9e['attributes'][_0x23f9('0x2f')]?_0x43aa9e[_0x23f9('0x2d')]:_0x19e3cf[_0x23f9('0x29')];if(_0xa930b5['query']['includeAll']){_0x43aa9e[_0x23f9('0x39')]=[{'all':!![]}];}_0x43aa9e=_[_0x23f9('0x35')]({},_0x43aa9e,_0xa930b5[_0x23f9('0x37')]);return db['VoiceExtension'][_0x23f9('0x1e')](_0x43aa9e)[_0x23f9('0x12')](handleEntityNotFound(_0x240719,null))[_0x23f9('0x12')](respondWithResult(_0x240719,null))[_0x23f9('0x3c')](handleError(_0x240719,null));};exports[_0x23f9('0x21')]=function(_0x1a3adf,_0x52e185){return db[_0x23f9('0x38')][_0x23f9('0x1e')]({'where':{'id':_0x1a3adf[_0x23f9('0x3e')]['id']}})[_0x23f9('0x12')](handleEntityNotFound(_0x52e185,null))[_0x23f9('0x12')](removeEntity(_0x52e185,null))[_0x23f9('0x3c')](handleError(_0x52e185,null));};exports['create']=function(_0x40834b,_0x19c618){if(_0x40834b[_0x23f9('0x3f')][_0x23f9('0x1d')]===_0x23f9('0x15')&&!_['startsWith'](_0x40834b[_0x23f9('0x3f')]['exten'],'_')){_0x40834b[_0x23f9('0x3f')]['exten']='_'[_0x23f9('0x40')](_0x40834b[_0x23f9('0x3f')]['exten']);}return db['VoiceExtension'][_0x23f9('0x41')](_0x40834b[_0x23f9('0x3f')],{'raw':![]})[_0x23f9('0x12')](function(_0x472af0){var _0x51a5fb=_0x40834b['user'][_0x23f9('0x13')]({'plain':!![]});if(!_0x51a5fb)throw new Error(_0x23f9('0x42'));if(_0x51a5fb[_0x23f9('0x43')]===_0x23f9('0x44')){var _0x35a66a=_0x472af0[_0x23f9('0x13')]({'plain':!![]});var _0x5abb46=[{'name':_0x23f9('0x14'),'value':_0x23f9('0x45')},{'name':'OutboundRoutes','value':_0x23f9('0x15')},{'name':_0x23f9('0x16'),'value':_0x23f9('0x17')}];var _0x39d968=_[_0x23f9('0x1e')](_0x5abb46,[_0x23f9('0x1b'),_0x35a66a[_0x23f9('0x1d')]])[_0x23f9('0x1f')];return db[_0x23f9('0x46')]['find']({'where':{'name':_0x39d968,'userProfileId':_0x51a5fb['userProfileId']},'raw':!![]})[_0x23f9('0x12')](function(_0x5c9764){if(_0x5c9764&&_0x5c9764[_0x23f9('0x47')]===0x0){return db['UserProfileResource']['create']({'name':_0x35a66a[_0x23f9('0x1f')],'resourceId':_0x35a66a['id'],'type':_0x5c9764['name'],'sectionId':_0x5c9764['id']},{})['then'](function(){return _0x472af0;});}else{return _0x472af0;}})[_0x23f9('0x3c')](function(_0x18e4ba){logger[_0x23f9('0x22')](_0x23f9('0x48'),_0x18e4ba);throw _0x18e4ba;});}return _0x472af0;})['then'](respondWithResult(_0x19c618,0xc9))['catch'](handleError(_0x19c618,null));};exports[_0x23f9('0x49')]=function(_0x42db63,_0x2fb6ad){if(_0x42db63[_0x23f9('0x3f')]['id']){delete _0x42db63[_0x23f9('0x3f')]['id'];}return db[_0x23f9('0x38')][_0x23f9('0x1e')]({'where':{'id':_0x42db63['params']['id']}})['then'](handleEntityNotFound(_0x2fb6ad,null))['then'](function(_0x5c01dc){if(_0x5c01dc){return db[_0x23f9('0x38')][_0x23f9('0x49')](_[_0x23f9('0x33')](_0x42db63[_0x23f9('0x3f')],[_0x23f9('0x4a'),'context',_0x23f9('0x4b'),_0x23f9('0x4c'),_0x23f9('0x4d'),_0x23f9('0x4e'),_0x23f9('0x4f')]),{'where':{'context':_0x5c01dc[_0x23f9('0x50')],'exten':_0x5c01dc[_0x23f9('0x4a')]},'individualHooks':!![]})[_0x23f9('0x12')](function(_0x3ab2b0){return _0x3ab2b0;});}return null;})[_0x23f9('0x12')](respondWithStatusCode(_0x2fb6ad,null))['catch'](handleError(_0x2fb6ad,null));};exports[_0x23f9('0x51')]=function(_0x26d62c,_0xb4d9f2){var _0x4c3150=_0x26d62c[_0x23f9('0x3e')]['id'];var _0x8a94db=_0x26d62c[_0x23f9('0x3f')];var _0x1dfb63=0xc8;var _0x232db7=null;return db[_0x23f9('0x52')]['transaction']({'isolationLevel':db[_0x23f9('0x52')][_0x23f9('0x53')][_0x23f9('0x54')][_0x23f9('0x55')]},function(_0x33f550){return db[_0x23f9('0x38')]['findOne']({'where':{'id':_0x4c3150},'transaction':_0x33f550})[_0x23f9('0x12')](function(_0x54d529){if(_0x54d529){return db[_0x23f9('0x38')][_0x23f9('0x21')]({'where':{'VoiceExtensionId':_0x4c3150},'transaction':_0x33f550})[_0x23f9('0x12')](function(){var _0x4f521e=_[_0x23f9('0x1a')](_0x8a94db,function(_0x3cc898){_0x3cc898['VoiceExtensionId']=_0x4c3150;_0x3cc898[_0x23f9('0x56')]=!![];return _0x3cc898;});return _0x54d529[_0x23f9('0x57')](_0x4f521e);})[_0x23f9('0x12')](function(_0x15a161){return db[_0x23f9('0x38')][_0x23f9('0x58')](_0x15a161,{'transaction':_0x33f550});});}else{_0x1dfb63=0x194;_0x232db7=[];}});})[_0x23f9('0x12')](function(){if(_0x1dfb63!==0x194){return db[_0x23f9('0x38')][_0x23f9('0x59')]({'where':{'isApp':!![],'VoiceExtensionId':_0x4c3150},'order':_0x23f9('0x5a')})[_0x23f9('0x12')](function(_0x598f54){_0x232db7=_0x598f54;});}})[_0x23f9('0x3c')](function(_0x543bca){_0x1dfb63=0x1f4;logger[_0x23f9('0x22')](_0x543bca[_0x23f9('0x23')]);if(_0x543bca[_0x23f9('0x1f')]){delete _0x543bca[_0x23f9('0x1f')];}_0x232db7=_0x543bca;})['finally'](function(){if(_0x232db7===null){_0xb4d9f2[_0x23f9('0x9')](_0x1dfb63);}else{if(_0x1dfb63===0x1f4){_0xb4d9f2[_0x23f9('0xa')](_0x1dfb63)[_0x23f9('0x24')](_0x232db7);}else{_0xb4d9f2[_0x23f9('0xa')](_0x1dfb63)[_0x23f9('0x11')](_0x232db7);}}});}; \ No newline at end of file +var _0x0320=['rows','catch','params','rawAttributes','attributes','includeAll','options','find','create','body','outbound','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','cutdigits','mandatoryDisposition','context','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','stack','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','internal','ignore','map','value','includes','type','name','UserProfileResource','error','send','index','VoiceExtension','fieldName','key','model','query','keys','filters','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','include'];(function(_0x1b87d1,_0x165246){var _0x25a7e1=function(_0x5bdf4e){while(--_0x5bdf4e){_0x1b87d1['push'](_0x1b87d1['shift']());}};_0x25a7e1(++_0x165246);}(_0x0320,0x1a2));var _0x0032=function(_0x2d7071,_0x156deb){_0x2d7071=_0x2d7071-0x0;var _0x56c3e7=_0x0320[_0x2d7071];return _0x56c3e7;};'use strict';var _=require('lodash');var Redis=require(_0x0032('0x0'));var qs=require(_0x0032('0x1'));var logger=require(_0x0032('0x2'))('api');var config=require(_0x0032('0x3'));var db=require(_0x0032('0x4'))['db'];config[_0x0032('0x5')]=_[_0x0032('0x6')](config[_0x0032('0x5')],{'host':_0x0032('0x7'),'port':0x18eb});var socket=require(_0x0032('0x8'))(new Redis(config['redis']));require(_0x0032('0x9'))[_0x0032('0xa')](socket);function respondWithStatusCode(_0x2fdd0f,_0x1320ee){_0x1320ee=_0x1320ee||0xcc;return function(_0x204f0c){if(_0x204f0c){return _0x2fdd0f[_0x0032('0xb')](_0x1320ee);}return _0x2fdd0f[_0x0032('0xc')](_0x1320ee)[_0x0032('0xd')]();};}function respondWithResult(_0xc911ed,_0x3f6eb8){_0x3f6eb8=_0x3f6eb8||0xc8;return function(_0x3b56f0){if(_0x3b56f0){return _0xc911ed['status'](_0x3f6eb8)['json'](_0x3b56f0);}};}function respondWithFilteredResult(_0x725e41,_0xb1c658){return function(_0x2db703){if(_0x2db703){var _0x3f20f6=typeof _0xb1c658[_0x0032('0xe')]==='undefined'&&typeof _0xb1c658['limit']===_0x0032('0xf');var _0x15994f=_0x2db703[_0x0032('0x10')];var _0x2300d1=_0x3f20f6?0x0:_0xb1c658[_0x0032('0xe')];var _0x384c81=_0x3f20f6?_0x2db703[_0x0032('0x10')]:_0xb1c658[_0x0032('0xe')]+_0xb1c658[_0x0032('0x11')];var _0x16d350;if(_0x384c81>=_0x15994f){_0x384c81=_0x15994f;_0x16d350=0xc8;}else{_0x16d350=0xce;}_0x725e41['status'](_0x16d350);return _0x725e41[_0x0032('0x12')](_0x0032('0x13'),_0x2300d1+'-'+_0x384c81+'/'+_0x15994f)[_0x0032('0x14')](_0x2db703);}return null;};}function removeEntity(_0x180e30){return function(_0x1683c8){if(_0x1683c8){return _0x1683c8[_0x0032('0x15')]()[_0x0032('0x16')](function(){var _0x2edf7b=_0x1683c8[_0x0032('0x17')]({'plain':!![]});var _0x145049=[{'name':_0x0032('0x18'),'value':_0x0032('0x19'),'ignore':![]},{'name':_0x0032('0x1a'),'value':'outbound','ignore':![]},{'name':_0x0032('0x1b'),'value':_0x0032('0x1c'),'ignore':![]}];var _0x13b6cd=_(_0x145049)['filter'](_0x0032('0x1d'))[_0x0032('0x1e')](_0x0032('0x1f'))[_0x0032('0x1f')]();if(_[_0x0032('0x20')](_0x13b6cd,_0x2edf7b['type'])){return;}var _0x5a78db=_['find'](_0x145049,[_0x0032('0x1f'),_0x2edf7b[_0x0032('0x21')]])[_0x0032('0x22')];return db[_0x0032('0x23')]['destroy']({'where':{'type':_0x5a78db,'resourceId':_0x2edf7b['id']}})[_0x0032('0x16')](function(){return _0x1683c8;});})[_0x0032('0x16')](function(){_0x180e30[_0x0032('0xc')](0xcc)[_0x0032('0xd')]();});}};}function handleEntityNotFound(_0x1e960f){return function(_0x366cf){if(!_0x366cf){_0x1e960f[_0x0032('0xb')](0x194);}return _0x366cf;};}function handleError(_0x1ab0e2,_0x4d9565){_0x4d9565=_0x4d9565||0x1f4;return function(_0x3ff110){logger[_0x0032('0x24')](_0x3ff110['stack']);if(_0x3ff110[_0x0032('0x22')]){delete _0x3ff110[_0x0032('0x22')];}_0x1ab0e2[_0x0032('0xc')](_0x4d9565)[_0x0032('0x25')](_0x3ff110);};}exports[_0x0032('0x26')]=function(_0x27f83d,_0x2b44a2){var _0x271e32={},_0x1247c1={},_0xabdd64={'count':0x0,'rows':[]};var _0x164774=_[_0x0032('0x1e')](db[_0x0032('0x27')]['rawAttributes'],function(_0x5bff4c){return{'name':_0x5bff4c[_0x0032('0x28')],'type':_0x5bff4c[_0x0032('0x21')][_0x0032('0x29')]};});_0x1247c1[_0x0032('0x2a')]=_[_0x0032('0x1e')](_0x164774,'name');_0x1247c1[_0x0032('0x2b')]=_[_0x0032('0x2c')](_0x27f83d[_0x0032('0x2b')]);_0x1247c1[_0x0032('0x2d')]=_[_0x0032('0x2e')](_0x1247c1['model'],_0x1247c1[_0x0032('0x2b')]);_0x271e32['attributes']=_[_0x0032('0x2e')](_0x1247c1['model'],qs[_0x0032('0x2f')](_0x27f83d[_0x0032('0x2b')][_0x0032('0x2f')]));_0x271e32['attributes']=_0x271e32['attributes'][_0x0032('0x30')]?_0x271e32['attributes']:_0x1247c1[_0x0032('0x2a')];if(!_0x27f83d['query']['hasOwnProperty']('nolimit')){_0x271e32[_0x0032('0x11')]=qs[_0x0032('0x11')](_0x27f83d[_0x0032('0x2b')][_0x0032('0x11')]);_0x271e32['offset']=qs[_0x0032('0xe')](_0x27f83d['query'][_0x0032('0xe')]);}_0x271e32[_0x0032('0x31')]=qs[_0x0032('0x32')](_0x27f83d[_0x0032('0x2b')]['sort']);_0x271e32[_0x0032('0x33')]=qs['filters'](_[_0x0032('0x34')](_0x27f83d[_0x0032('0x2b')],_0x1247c1['filters']),_0x164774);if(_0x27f83d[_0x0032('0x2b')][_0x0032('0x35')]){_0x271e32[_0x0032('0x33')]=_[_0x0032('0x36')](_0x271e32[_0x0032('0x33')],{'$or':_['map'](_0x164774,function(_0x21efb5){if(_0x21efb5[_0x0032('0x21')]!==_0x0032('0x37')){var _0x5d83c9={};_0x5d83c9[_0x21efb5[_0x0032('0x22')]]={'$like':'%'+_0x27f83d[_0x0032('0x2b')][_0x0032('0x35')]+'%'};return _0x5d83c9;}})});}_0x271e32=_[_0x0032('0x36')]({},_0x271e32,_0x27f83d['options']);var _0x59a16d={'where':_0x271e32[_0x0032('0x33')]};return db[_0x0032('0x27')]['count'](_0x59a16d)['then'](function(_0x53a9df){_0xabdd64['count']=_0x53a9df;if(_0x27f83d[_0x0032('0x2b')]['includeAll']){_0x271e32[_0x0032('0x38')]=[{'all':!![]}];}return db[_0x0032('0x27')]['findAll'](_0x271e32);})['then'](function(_0x3412cc){_0xabdd64[_0x0032('0x39')]=_0x3412cc;return _0xabdd64;})['then'](respondWithFilteredResult(_0x2b44a2,_0x271e32))[_0x0032('0x3a')](handleError(_0x2b44a2,null));};exports['show']=function(_0x44c155,_0x8ba8be){var _0x13636f={'raw':![],'where':{'id':_0x44c155[_0x0032('0x3b')]['id']}},_0x2fd89c={};_0x2fd89c[_0x0032('0x2a')]=_[_0x0032('0x2c')](db[_0x0032('0x27')][_0x0032('0x3c')]);_0x2fd89c['query']=_['keys'](_0x44c155[_0x0032('0x2b')]);_0x2fd89c[_0x0032('0x2d')]=_['intersection'](_0x2fd89c[_0x0032('0x2a')],_0x2fd89c[_0x0032('0x2b')]);_0x13636f['attributes']=_[_0x0032('0x2e')](_0x2fd89c[_0x0032('0x2a')],qs[_0x0032('0x2f')](_0x44c155[_0x0032('0x2b')][_0x0032('0x2f')]));_0x13636f[_0x0032('0x3d')]=_0x13636f[_0x0032('0x3d')][_0x0032('0x30')]?_0x13636f['attributes']:_0x2fd89c['model'];if(_0x44c155['query'][_0x0032('0x3e')]){_0x13636f[_0x0032('0x38')]=[{'all':!![]}];}_0x13636f=_['merge']({},_0x13636f,_0x44c155[_0x0032('0x3f')]);return db[_0x0032('0x27')][_0x0032('0x40')](_0x13636f)['then'](handleEntityNotFound(_0x8ba8be,null))[_0x0032('0x16')](respondWithResult(_0x8ba8be,null))[_0x0032('0x3a')](handleError(_0x8ba8be,null));};exports[_0x0032('0x15')]=function(_0x57a68f,_0x11821f){return db[_0x0032('0x27')][_0x0032('0x40')]({'where':{'id':_0x57a68f[_0x0032('0x3b')]['id']}})[_0x0032('0x16')](handleEntityNotFound(_0x11821f,null))[_0x0032('0x16')](removeEntity(_0x11821f,null))[_0x0032('0x3a')](handleError(_0x11821f,null));};exports[_0x0032('0x41')]=function(_0x21c9b7,_0x599f5c){if(_0x21c9b7[_0x0032('0x42')][_0x0032('0x21')]===_0x0032('0x43')&&!_[_0x0032('0x44')](_0x21c9b7[_0x0032('0x42')][_0x0032('0x45')],'_')){_0x21c9b7[_0x0032('0x42')][_0x0032('0x45')]='_'[_0x0032('0x46')](_0x21c9b7[_0x0032('0x42')][_0x0032('0x45')]);}return db['VoiceExtension'][_0x0032('0x41')](_0x21c9b7[_0x0032('0x42')],{'raw':![]})[_0x0032('0x16')](function(_0x74e526){var _0x1708ed=_0x21c9b7[_0x0032('0x47')][_0x0032('0x17')]({'plain':!![]});if(!_0x1708ed)throw new Error(_0x0032('0x48'));if(_0x1708ed[_0x0032('0x49')]===_0x0032('0x47')){var _0x19f884=_0x74e526[_0x0032('0x17')]({'plain':!![]});var _0x4e6f11=[{'name':_0x0032('0x18'),'value':_0x0032('0x19')},{'name':_0x0032('0x1a'),'value':_0x0032('0x43')},{'name':_0x0032('0x1b'),'value':_0x0032('0x1c')}];var _0x5e3ba9=_[_0x0032('0x40')](_0x4e6f11,[_0x0032('0x1f'),_0x19f884['type']])[_0x0032('0x22')];return db[_0x0032('0x4a')][_0x0032('0x40')]({'where':{'name':_0x5e3ba9,'userProfileId':_0x1708ed['userProfileId']},'raw':!![]})[_0x0032('0x16')](function(_0x3d1bdc){if(_0x3d1bdc&&_0x3d1bdc[_0x0032('0x4b')]===0x0){return db['UserProfileResource'][_0x0032('0x41')]({'name':_0x19f884[_0x0032('0x22')],'resourceId':_0x19f884['id'],'type':_0x3d1bdc['name'],'sectionId':_0x3d1bdc['id']},{})['then'](function(){return _0x74e526;});}else{return _0x74e526;}})[_0x0032('0x3a')](function(_0x4f0828){logger['error'](_0x0032('0x4c'),_0x4f0828);throw _0x4f0828;});}return _0x74e526;})[_0x0032('0x16')](respondWithResult(_0x599f5c,0xc9))[_0x0032('0x3a')](handleError(_0x599f5c,null));};exports[_0x0032('0x4d')]=function(_0x1a4fdd,_0xcb24bd){if(_0x1a4fdd[_0x0032('0x42')]['id']){delete _0x1a4fdd[_0x0032('0x42')]['id'];}return db[_0x0032('0x27')]['find']({'where':{'id':_0x1a4fdd[_0x0032('0x3b')]['id']}})[_0x0032('0x16')](handleEntityNotFound(_0xcb24bd,null))[_0x0032('0x16')](function(_0x1eeca4){if(_0x1eeca4){return db[_0x0032('0x27')][_0x0032('0x4d')](_[_0x0032('0x34')](_0x1a4fdd[_0x0032('0x42')],[_0x0032('0x45'),'context',_0x0032('0x4e'),'recordingFormat',_0x0032('0x4f'),_0x0032('0x50'),'alias']),{'where':{'context':_0x1eeca4[_0x0032('0x51')],'exten':_0x1eeca4['exten']},'individualHooks':!![]})[_0x0032('0x16')](function(_0x339a2b){return _0x339a2b;});}return null;})['then'](respondWithStatusCode(_0xcb24bd,null))[_0x0032('0x3a')](handleError(_0xcb24bd,null));};exports[_0x0032('0x52')]=function(_0x543282,_0x46b00d){var _0x52f1c4=_0x543282[_0x0032('0x3b')]['id'];var _0x5e1f29=_0x543282[_0x0032('0x42')];var _0x3ad309=0xc8;var _0x429a32=null;return db[_0x0032('0x53')][_0x0032('0x54')]({'isolationLevel':db[_0x0032('0x53')][_0x0032('0x55')][_0x0032('0x56')]['READ_COMMITTED']},function(_0x3a499d){return db[_0x0032('0x27')][_0x0032('0x57')]({'where':{'id':_0x52f1c4},'transaction':_0x3a499d})[_0x0032('0x16')](function(_0x1145aa){if(_0x1145aa){return db[_0x0032('0x27')][_0x0032('0x15')]({'where':{'VoiceExtensionId':_0x52f1c4},'transaction':_0x3a499d})[_0x0032('0x16')](function(){var _0x196ef9=_[_0x0032('0x1e')](_0x5e1f29,function(_0x506432){_0x506432[_0x0032('0x58')]=_0x52f1c4;_0x506432[_0x0032('0x59')]=!![];return _0x506432;});return _0x1145aa[_0x0032('0x5a')](_0x196ef9);})[_0x0032('0x16')](function(_0x10389d){return db['VoiceExtension'][_0x0032('0x5b')](_0x10389d,{'transaction':_0x3a499d});});}else{_0x3ad309=0x194;_0x429a32=[];}});})[_0x0032('0x16')](function(){if(_0x3ad309!==0x194){return db[_0x0032('0x27')][_0x0032('0x5c')]({'where':{'isApp':!![],'VoiceExtensionId':_0x52f1c4},'order':_0x0032('0x5d')})[_0x0032('0x16')](function(_0x6c6ad4){_0x429a32=_0x6c6ad4;});}})[_0x0032('0x3a')](function(_0x420c48){_0x3ad309=0x1f4;logger[_0x0032('0x24')](_0x420c48[_0x0032('0x5e')]);if(_0x420c48[_0x0032('0x22')]){delete _0x420c48[_0x0032('0x22')];}_0x429a32=_0x420c48;})['finally'](function(){if(_0x429a32===null){_0x46b00d[_0x0032('0xb')](_0x3ad309);}else{if(_0x3ad309===0x1f4){_0x46b00d[_0x0032('0xc')](_0x3ad309)[_0x0032('0x25')](_0x429a32);}else{_0x46b00d[_0x0032('0xc')](_0x3ad309)['json'](_0x429a32);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 7bd05e4..ade56e3 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 _0x5db6=['hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','remove','emit'];(function(_0x2a98b4,_0x52ea88){var _0x3ddab1=function(_0x4fa172){while(--_0x4fa172){_0x2a98b4['push'](_0x2a98b4['shift']());}};_0x3ddab1(++_0x52ea88);}(_0x5db6,0x125));var _0x65db=function(_0x111bab,_0x271498){_0x111bab=_0x111bab-0x0;var _0x5999fa=_0x5db6[_0x111bab];return _0x5999fa;};'use strict';var EventEmitter=require(_0x65db('0x0'));var VoiceExtension=require(_0x65db('0x1'))['db'][_0x65db('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x65db('0x3')](0x0);var events={'afterCreate':_0x65db('0x4'),'afterUpdate':'update','afterDestroy':_0x65db('0x5')};function emitEvent(_0x599852){return function(_0x40c538,_0x19b778,_0x3c0fa1){VoiceExtensionEvents[_0x65db('0x6')](_0x599852+':'+_0x40c538['id'],_0x40c538);VoiceExtensionEvents[_0x65db('0x6')](_0x599852,_0x40c538);_0x3c0fa1(null);};}for(var e in events){if(events[_0x65db('0x7')](e)){var event=events[e];VoiceExtension[_0x65db('0x8')](e,emitEvent(event));}}module[_0x65db('0x9')]=VoiceExtensionEvents; \ No newline at end of file +var _0xf2db=['events','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x578e17,_0x34e6d1){var _0x30dd9f=function(_0x3ab44c){while(--_0x3ab44c){_0x578e17['push'](_0x578e17['shift']());}};_0x30dd9f(++_0x34e6d1);}(_0xf2db,0x90));var _0xbf2d=function(_0x507956,_0x3e576e){_0x507956=_0x507956-0x0;var _0xfd2b24=_0xf2db[_0x507956];return _0xfd2b24;};'use strict';var EventEmitter=require(_0xbf2d('0x0'));var VoiceExtension=require('../../mysqldb')['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xbf2d('0x1')](0x0);var events={'afterCreate':_0xbf2d('0x2'),'afterUpdate':_0xbf2d('0x3'),'afterDestroy':_0xbf2d('0x4')};function emitEvent(_0xeeffbf){return function(_0x3ae258,_0x41f5bb,_0x3e08b1){VoiceExtensionEvents[_0xbf2d('0x5')](_0xeeffbf+':'+_0x3ae258['id'],_0x3ae258);VoiceExtensionEvents['emit'](_0xeeffbf,_0x3ae258);_0x3e08b1(null);};}for(var e in events){if(events[_0xbf2d('0x6')](e)){var event=events[e];VoiceExtension[_0xbf2d('0x7')](e,emitEvent(event));}}module[_0xbf2d('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 278b798..422bb7d 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 _0x7aaa=['get','priority','then','Hangup','lodash','exports','type','Set','CDR(type)=','context','exten','alias','NoOp','No\x20alias\x20set','inbound','CDR(routeid)=','push','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(routeAlias)=','CDR(destination)=','cutdigits','${EXTEN}','):Goto(','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','options','url','length','name','param','split','phone','prefix','${EXTEN:','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','queue','playback','includes','app','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','last','concat','catch','define','VoiceExtension','voice_extensions'];(function(_0x325e04,_0x441a7e){var _0x147bd3=function(_0x19979e){while(--_0x19979e){_0x325e04['push'](_0x325e04['shift']());}};_0x147bd3(++_0x441a7e);}(_0x7aaa,0x164));var _0xa7aa=function(_0x11b437,_0x47e6f7){_0x11b437=_0x11b437-0x0;var _0x2c2b82=_0x7aaa[_0x11b437];return _0x2c2b82;};'use strict';var _=require(_0xa7aa('0x0'));var attributes=require('./voiceExtension.attributes');module[_0xa7aa('0x1')]=function(_0x903656){var _0x225c5c=_0x903656['models'];function _0x1fbfd6(_0x2f507e){var _0x1d1dec=0x2;var _0x56f65d=[{'type':_0x2f507e[_0xa7aa('0x2')],'app':_0xa7aa('0x3'),'appdata':_0xa7aa('0x4')+_0x2f507e[_0xa7aa('0x2')],'context':_0x2f507e[_0xa7aa('0x5')],'exten':_0x2f507e[_0xa7aa('0x6')],'priority':_0x1d1dec++,'VoiceExtensionId':_0x2f507e['id']},{'type':_0x2f507e['type'],'app':_0x2f507e[_0xa7aa('0x7')]?_0xa7aa('0x3'):_0xa7aa('0x8'),'appdata':_0x2f507e[_0xa7aa('0x7')]?'CDR(routeAlias)='+_0x2f507e['alias']:_0xa7aa('0x9'),'context':_0x2f507e[_0xa7aa('0x5')],'exten':_0x2f507e[_0xa7aa('0x6')],'priority':_0x1d1dec++,'VoiceExtensionId':_0x2f507e['id']}];if(_0x2f507e[_0xa7aa('0x2')]===_0xa7aa('0xa')){_0x56f65d['push']({'type':'inbound','app':'Set','appdata':_0xa7aa('0xb')+_0x2f507e['id'],'context':_0x2f507e['context'],'exten':_0x2f507e['exten'],'priority':_0x1d1dec++,'VoiceExtensionId':_0x2f507e['id']});}_0x56f65d[_0xa7aa('0xc')]({'type':_0x2f507e[_0xa7aa('0x2')],'app':_0xa7aa('0x3'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x2f507e[_0xa7aa('0x5')],'exten':_0x2f507e['exten'],'priority':_0x1d1dec++,'VoiceExtensionId':_0x2f507e['id']},{'type':_0x2f507e[_0xa7aa('0x2')],'app':_0xa7aa('0x3'),'appdata':_0xa7aa('0xd'),'context':_0x2f507e[_0xa7aa('0x5')],'exten':_0x2f507e['exten'],'priority':_0x1d1dec++,'VoiceExtensionId':_0x2f507e['id']},{'type':_0x2f507e['type'],'app':_0xa7aa('0x3'),'appdata':_0xa7aa('0xe'),'context':_0x2f507e['context'],'exten':_0x2f507e['exten'],'priority':_0x1d1dec++,'VoiceExtensionId':_0x2f507e['id']});return _0x56f65d;}function _0x8b74c9(_0x196e4c){var _0xdf1a0b=0x2;var _0x14687c=[{'type':_0xa7aa('0xf'),'app':_0xa7aa('0x3'),'appdata':_0xa7aa('0x10'),'context':_0x196e4c[_0xa7aa('0x5')],'exten':_0x196e4c['exten'],'priority':_0xdf1a0b++,'VoiceExtensionId':_0x196e4c['id']},{'type':_0xa7aa('0xf'),'app':_0x196e4c[_0xa7aa('0x7')]?_0xa7aa('0x3'):_0xa7aa('0x8'),'appdata':_0x196e4c[_0xa7aa('0x7')]?_0xa7aa('0x11')+_0x196e4c[_0xa7aa('0x7')]:'No\x20alias\x20set','context':_0x196e4c[_0xa7aa('0x5')],'exten':_0x196e4c[_0xa7aa('0x6')],'priority':_0xdf1a0b++,'VoiceExtensionId':_0x196e4c['id']},{'type':'outbound','app':'Set','appdata':_0xa7aa('0x12')+(_0x196e4c['cutdigits']?'${EXTEN:'+_0x196e4c[_0xa7aa('0x13')]+'}':_0xa7aa('0x14')),'context':_0x196e4c[_0xa7aa('0x5')],'exten':_0x196e4c[_0xa7aa('0x6')],'priority':_0xdf1a0b++,'VoiceExtensionId':_0x196e4c['id']},{'type':_0xa7aa('0xf'),'app':_0xa7aa('0x3'),'appdata':'CDR(routeid)='+_0x196e4c['id'],'context':_0x196e4c[_0xa7aa('0x5')],'exten':_0x196e4c[_0xa7aa('0x6')],'priority':_0xdf1a0b++,'VoiceExtensionId':_0x196e4c['id']},{'type':_0xa7aa('0xf'),'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0xdf1a0b+0x2)+_0xa7aa('0x15')+(_0xdf1a0b+0x1)+')','context':_0x196e4c['context'],'exten':_0x196e4c[_0xa7aa('0x6')],'priority':_0xdf1a0b++,'VoiceExtensionId':_0x196e4c['id']},{'type':_0xa7aa('0xf'),'app':_0xa7aa('0x3'),'appdata':_0x196e4c[_0xa7aa('0x13')]?'CDR(prefix)=${EXTEN:0:'+_0x196e4c['cutdigits']+'}':_0xa7aa('0x16'),'context':_0x196e4c[_0xa7aa('0x5')],'exten':_0x196e4c['exten'],'priority':_0xdf1a0b++,'VoiceExtensionId':_0x196e4c['id']},{'type':_0xa7aa('0xf'),'app':'Set','appdata':_0xa7aa('0x17'),'context':_0x196e4c[_0xa7aa('0x5')],'exten':_0x196e4c[_0xa7aa('0x6')],'priority':_0xdf1a0b++,'VoiceExtensionId':_0x196e4c['id']},{'type':_0xa7aa('0xf'),'app':_0xa7aa('0x3'),'appdata':_0xa7aa('0xd'),'context':_0x196e4c['context'],'exten':_0x196e4c[_0xa7aa('0x6')],'priority':_0xdf1a0b++,'VoiceExtensionId':_0x196e4c['id']},{'type':_0xa7aa('0xf'),'app':_0xa7aa('0x3'),'appdata':_0xa7aa('0xe'),'context':_0x196e4c[_0xa7aa('0x5')],'exten':_0x196e4c['exten'],'priority':_0xdf1a0b++,'VoiceExtensionId':_0x196e4c['id']},{'type':_0xa7aa('0xf'),'app':'Set','appdata':_0xa7aa('0x18')+_0x196e4c['id'],'context':_0x196e4c[_0xa7aa('0x5')],'exten':_0x196e4c[_0xa7aa('0x6')],'priority':_0xdf1a0b++,'VoiceExtensionId':_0x196e4c['id']}];if(_0x196e4c[_0xa7aa('0x19')](_0xa7aa('0x1a'))&&_0x196e4c[_0xa7aa('0x1a')]!==_0xa7aa('0x1b')){_0x14687c[_0xa7aa('0xc')]({'type':_0xa7aa('0xf'),'app':_0xa7aa('0x3'),'appdata':_0xa7aa('0x1c'),'context':_0x196e4c[_0xa7aa('0x5')],'exten':_0x196e4c[_0xa7aa('0x6')],'priority':_0xdf1a0b++,'VoiceExtensionId':_0x196e4c['id']},{'type':_0xa7aa('0xf'),'app':'Set','appdata':_0xa7aa('0x1d')+_0x196e4c['recordingFormat']||_0xa7aa('0x1e'),'context':_0x196e4c['context'],'exten':_0x196e4c['exten'],'priority':_0xdf1a0b++,'VoiceExtensionId':_0x196e4c['id']});}return _0x14687c;}function _0x90edf4(_0x570a8c,_0x2b6233){var _0x191f4e=[{'name':_0xa7aa('0x1f'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0xa7aa('0x20'),'param':0x2},{'name':_0xa7aa('0x21'),'param':0x3}];var _0x30648b={};var _0xd80141=_0x2b6233['split'](',');var _0x56740f=[];for(var _0x4999fa=0x0;_0x4999fa<_0x191f4e[_0xa7aa('0x22')];_0x4999fa++){switch(_0x191f4e[_0x4999fa][_0xa7aa('0x23')]){case _0xa7aa('0x1f'):_0x30648b[_0xa7aa('0x1f')]=_0xd80141[_0x191f4e[_0x4999fa][_0xa7aa('0x24')]][_0xa7aa('0x25')]('/')[0x1];_0x30648b[_0xa7aa('0x26')]=_0xd80141[_0x191f4e[_0x4999fa][_0xa7aa('0x24')]][_0xa7aa('0x25')]('/')[0x2];_0x30648b[_0xa7aa('0x27')]=_0x30648b[_0xa7aa('0x26')]?_0x30648b[_0xa7aa('0x26')][_0xa7aa('0x25')]('$')[0x0]:undefined;_0x30648b[_0xa7aa('0x26')]=_0x570a8c['cutdigits']?(_0x30648b[_0xa7aa('0x27')]||'')+_0xa7aa('0x28')+_0x570a8c[_0xa7aa('0x13')]+'}':(_0x30648b['prefix']||'')+'${EXTEN}';_0x56740f[_0x191f4e[_0x4999fa][_0xa7aa('0x24')]]=[_0xa7aa('0x29'),_0x30648b['trunk'],_0x30648b[_0xa7aa('0x26')]][_0xa7aa('0x2a')]('/');break;case'options':_0x30648b[_0xa7aa('0x20')]=_0xd80141[_0x191f4e[_0x4999fa][_0xa7aa('0x24')]];if(_0x570a8c[_0xa7aa('0x1a')]!==_0xa7aa('0x1b')){if(_0x30648b[_0xa7aa('0x20')][_0xa7aa('0x2b')]('U(xcally-mixmonitor-context)')<0x0){_0x30648b[_0xa7aa('0x20')]+=_0xa7aa('0x2c');}}else{_0x30648b[_0xa7aa('0x20')]=_0x30648b[_0xa7aa('0x20')][_0xa7aa('0x2d')](_0xa7aa('0x2c'),'');}_0x56740f[_0x191f4e[_0x4999fa][_0xa7aa('0x24')]]=_0x30648b[_0xa7aa('0x20')];break;default:_0x56740f[_0x191f4e[_0x4999fa]['param']]=_0xd80141[_0x191f4e[_0x4999fa][_0xa7aa('0x24')]];}}return _0x56740f['join'](',');}function _0x469659(_0x23011b,_0x231b97,_0x2c2829){return new Promise(function(_0x3c99c2,_0x26f8e5){var _0x1a2a5f=[];if(_[_0xa7aa('0x2e')](_0x231b97))return _0x3c99c2(_0x1a2a5f);_0x225c5c[_0xa7aa('0x2f')][_0xa7aa('0x30')]({'attributes':['id',_0xa7aa('0x31'),_0xa7aa('0x32')],'raw':!![]})['then'](function(_0x4db62d){for(var _0xf0bf25=0x0,_0x557fc3=0x0;_0xf0bf25<_0x231b97['length'];_0xf0bf25++,_0x557fc3=0x0){var _0x2ff162=_0x231b97[_0xf0bf25];var _0x572362=[];var _0x6ba0da=[];delete _0x2ff162['id'];if(_0x2ff162[_0xa7aa('0x31')]!==_0xa7aa('0x33')){_0x2ff162[_0xa7aa('0x34')]=[_0x2ff162[_0xa7aa('0x31')]];}else{_0x2ff162[_0xa7aa('0x34')]=_0x2ff162[_0xa7aa('0x32')]?_[_0xa7aa('0x35')](_[_0xa7aa('0x36')](_0x4db62d,{'IntervalId':_0x2ff162[_0xa7aa('0x32')]}),_0xa7aa('0x31')):[];}_0x2ff162[_0xa7aa('0x5')]=_0x23011b[_0xa7aa('0x5')];_0x2ff162['exten']=_0x23011b['exten'];if(_0x2ff162[_0xa7aa('0x2')])_0x2ff162['type']=_0x2ff162[_0xa7aa('0x2')][_0xa7aa('0x37')]();if(_0x23011b['type']===_0xa7aa('0xf')){if(_0x2ff162['hasOwnProperty'](_0xa7aa('0x38'))&&_0x2ff162['tag']&&_0x2ff162[_0xa7aa('0x38')]!=='--'){_0x572362[_0xa7aa('0xc')]({'type':_0x2ff162[_0xa7aa('0x2')][_0xa7aa('0x37')](),'app':'Set','appdata':_0xa7aa('0x39')+_0x2ff162['tag'],'context':_0x23011b[_0xa7aa('0x5')],'exten':_0x23011b[_0xa7aa('0x6')],'priority':_0x2ff162[_0xa7aa('0x34')][_0xa7aa('0x22')]+_0x2c2829+_0x557fc3++,'VoiceExtensionId':_0x23011b['id']});}_0x572362['push']({'type':_0x2ff162[_0xa7aa('0x2')][_0xa7aa('0x37')](),'app':_0xa7aa('0x3a'),'appdata':_0xa7aa('0x3b')+(_0x2ff162[_0xa7aa('0x3c')]?_0xa7aa('0x3d')+_0x2ff162[_0xa7aa('0x3c')]+')':'NoOp(No\x20number\x20available)'),'context':_0x23011b['context'],'exten':_0x23011b['exten'],'priority':_0x2ff162['intervals'][_0xa7aa('0x22')]+_0x2c2829+_0x557fc3++,'VoiceExtensionId':_0x23011b['id']});}else{if(_0x2ff162['hasOwnProperty']('answer')){if([_0xa7aa('0x3e'),_0xa7aa('0x3f')][_0xa7aa('0x40')](_0x2ff162[_0xa7aa('0x41')][_0xa7aa('0x37')]())&&_0x2ff162['appType']!==_0xa7aa('0x42')){if(_0x2ff162[_0xa7aa('0x43')]){_0x572362[_0xa7aa('0xc')]({'type':_0x2ff162['type'][_0xa7aa('0x37')](),'app':'ExecIf','appdata':_0xa7aa('0x44'),'context':_0x23011b[_0xa7aa('0x5')],'exten':_0x23011b['exten'],'priority':_0x2ff162[_0xa7aa('0x34')][_0xa7aa('0x22')]+_0x2c2829+_0x557fc3++,'VoiceExtensionId':_0x23011b['id']});_0x572362['push']({'type':_0x2ff162['type']['toLowerCase'](),'app':_0xa7aa('0x3'),'appdata':_0xa7aa('0x45'),'context':_0x23011b['context'],'exten':_0x23011b[_0xa7aa('0x6')],'priority':_0x2ff162[_0xa7aa('0x34')][_0xa7aa('0x22')]+_0x2c2829+_0x557fc3++,'VoiceExtensionId':_0x23011b['id']});}else{_0x572362['push']({'type':_0x2ff162['type'][_0xa7aa('0x37')](),'app':_0xa7aa('0x3a'),'appdata':_0xa7aa('0x46'),'context':_0x23011b[_0xa7aa('0x5')],'exten':_0x23011b[_0xa7aa('0x6')],'priority':_0x2ff162[_0xa7aa('0x34')][_0xa7aa('0x22')]+_0x2c2829+_0x557fc3++,'VoiceExtensionId':_0x23011b['id']});_0x572362['push']({'type':_0x2ff162[_0xa7aa('0x2')][_0xa7aa('0x37')](),'app':_0xa7aa('0x3'),'appdata':_0xa7aa('0x47'),'context':_0x23011b[_0xa7aa('0x5')],'exten':_0x23011b[_0xa7aa('0x6')],'priority':_0x2ff162[_0xa7aa('0x34')]['length']+_0x2c2829+_0x557fc3++,'VoiceExtensionId':_0x23011b['id']});}}}}for(var _0x26d0c4=0x0;_0x26d0c4<_0x2ff162[_0xa7aa('0x34')][_0xa7aa('0x22')];_0x26d0c4++){var _0x5c06b1=_0x2c2829+_0x2ff162['intervals'][_0xa7aa('0x22')];var _0x280295=_0x26d0c4===_0x2ff162[_0xa7aa('0x34')][_0xa7aa('0x22')]-0x1?_0x2c2829+_0x572362[_0xa7aa('0x22')]+_0x6ba0da['length']+0x2:_0x2c2829+_0x26d0c4+0x1;_0x572362[_0xa7aa('0x48')](_0x26d0c4,0x0,{'type':_0x23011b[_0xa7aa('0x2')],'app':_0xa7aa('0x49'),'appdata':_0x2ff162['intervals'][_0x26d0c4]+'?'+_0x23011b[_0xa7aa('0x5')]+_0xa7aa('0x4a')+_0x5c06b1+':'+_0x23011b[_0xa7aa('0x5')]+',${EXTEN},'+_0x280295,'exten':_0x23011b['exten'],'context':_0x23011b[_0xa7aa('0x5')],'priority':_0x2c2829+_0x26d0c4,'VoiceExtensionId':_0x23011b['id']});}if(_0x2ff162[_0xa7aa('0x4b')]===_0xa7aa('0x4c'))_0x2ff162['appdata']=_0x90edf4(_0x23011b,_0x2ff162[_0xa7aa('0x4d')]);_0x2ff162['priority']=_0x572362[_0xa7aa('0x22')]?_[_0xa7aa('0x4e')](_0x572362)['priority']+0x1:_0x2c2829;_0x1a2a5f=_[_0xa7aa('0x4f')](_0x1a2a5f,_0x572362,[_0x2ff162],_0x6ba0da);_0x2c2829=_[_0xa7aa('0x4e')](_0x1a2a5f)['priority']+0x1;}return _0x3c99c2(_0x1a2a5f);})[_0xa7aa('0x50')](function(_0x39872d){_0x26f8e5(_0x39872d);});});}return _0x903656[_0xa7aa('0x51')](_0xa7aa('0x52'),attributes,{'tableName':_0xa7aa('0x53'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x48396c){var _0x247d1e=this[_0xa7aa('0x54')]({'plain':!![]});var _0x56518b=_0x247d1e[_0xa7aa('0x2')]===_0xa7aa('0xf')?_0x8b74c9(_0x247d1e):_0x1fbfd6(_0x247d1e);return _0x469659(_0x247d1e,_0x48396c,_[_0xa7aa('0x4e')](_0x56518b)[_0xa7aa('0x55')]+0x1)[_0xa7aa('0x56')](function(_0x24cd06){var _0x2b4d88=_['concat'](_0x56518b,_0x24cd06);_0x2b4d88[_0xa7aa('0xc')]({'type':_0x247d1e[_0xa7aa('0x2')],'app':_0xa7aa('0x57'),'exten':_0x247d1e[_0xa7aa('0x6')],'context':_0x247d1e['context'],'priority':_[_0xa7aa('0x4e')](_0x2b4d88)[_0xa7aa('0x55')]+0x1,'VoiceExtensionId':_0x247d1e['id']});return _0x2b4d88;});}}});}; \ No newline at end of file +var _0xb55e=['trunk','param','phone','prefix','join','options','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','findAll','interval','then','*,*,*,*','intervals','IntervalId','toLowerCase','tag','length','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','appType','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','outboundDial','appdata','priority','last','concat','catch','define','VoiceExtension','get','Hangup','lodash','./voiceExtension.attributes','exports','type','context','exten','alias','Set','NoOp','No\x20alias\x20set','push','inbound','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(routeAlias)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','url','split','name'];(function(_0x34ae76,_0x4cd562){var _0x5325eb=function(_0x29406a){while(--_0x29406a){_0x34ae76['push'](_0x34ae76['shift']());}};_0x5325eb(++_0x4cd562);}(_0xb55e,0x106));var _0xeb55=function(_0x19a5ae,_0x518421){_0x19a5ae=_0x19a5ae-0x0;var _0x36f984=_0xb55e[_0x19a5ae];return _0x36f984;};'use strict';var _=require(_0xeb55('0x0'));var attributes=require(_0xeb55('0x1'));module[_0xeb55('0x2')]=function(_0x8bb640){var _0x559039=_0x8bb640['models'];function _0xd22a98(_0x3d16b1){var _0x4bc06c=0x2;var _0x16ed89=[{'type':_0x3d16b1['type'],'app':'Set','appdata':'CDR(type)='+_0x3d16b1[_0xeb55('0x3')],'context':_0x3d16b1[_0xeb55('0x4')],'exten':_0x3d16b1[_0xeb55('0x5')],'priority':_0x4bc06c++,'VoiceExtensionId':_0x3d16b1['id']},{'type':_0x3d16b1[_0xeb55('0x3')],'app':_0x3d16b1[_0xeb55('0x6')]?_0xeb55('0x7'):_0xeb55('0x8'),'appdata':_0x3d16b1[_0xeb55('0x6')]?'CDR(routeAlias)='+_0x3d16b1['alias']:_0xeb55('0x9'),'context':_0x3d16b1[_0xeb55('0x4')],'exten':_0x3d16b1['exten'],'priority':_0x4bc06c++,'VoiceExtensionId':_0x3d16b1['id']}];if(_0x3d16b1[_0xeb55('0x3')]==='inbound'){_0x16ed89[_0xeb55('0xa')]({'type':_0xeb55('0xb'),'app':'Set','appdata':_0xeb55('0xc')+_0x3d16b1['id'],'context':_0x3d16b1[_0xeb55('0x4')],'exten':_0x3d16b1[_0xeb55('0x5')],'priority':_0x4bc06c++,'VoiceExtensionId':_0x3d16b1['id']});}_0x16ed89[_0xeb55('0xa')]({'type':_0x3d16b1[_0xeb55('0x3')],'app':_0xeb55('0x7'),'appdata':_0xeb55('0xd'),'context':_0x3d16b1[_0xeb55('0x4')],'exten':_0x3d16b1[_0xeb55('0x5')],'priority':_0x4bc06c++,'VoiceExtensionId':_0x3d16b1['id']},{'type':_0x3d16b1[_0xeb55('0x3')],'app':_0xeb55('0x7'),'appdata':_0xeb55('0xe'),'context':_0x3d16b1[_0xeb55('0x4')],'exten':_0x3d16b1[_0xeb55('0x5')],'priority':_0x4bc06c++,'VoiceExtensionId':_0x3d16b1['id']},{'type':_0x3d16b1[_0xeb55('0x3')],'app':_0xeb55('0x7'),'appdata':_0xeb55('0xf'),'context':_0x3d16b1[_0xeb55('0x4')],'exten':_0x3d16b1[_0xeb55('0x5')],'priority':_0x4bc06c++,'VoiceExtensionId':_0x3d16b1['id']});return _0x16ed89;}function _0x506cdb(_0xf9e5ea){var _0x177baf=0x2;var _0x105a9b=[{'type':_0xeb55('0x10'),'app':_0xeb55('0x7'),'appdata':'CDR(type)=outbound','context':_0xf9e5ea[_0xeb55('0x4')],'exten':_0xf9e5ea[_0xeb55('0x5')],'priority':_0x177baf++,'VoiceExtensionId':_0xf9e5ea['id']},{'type':_0xeb55('0x10'),'app':_0xf9e5ea['alias']?_0xeb55('0x7'):_0xeb55('0x8'),'appdata':_0xf9e5ea['alias']?_0xeb55('0x11')+_0xf9e5ea[_0xeb55('0x6')]:_0xeb55('0x9'),'context':_0xf9e5ea[_0xeb55('0x4')],'exten':_0xf9e5ea[_0xeb55('0x5')],'priority':_0x177baf++,'VoiceExtensionId':_0xf9e5ea['id']},{'type':'outbound','app':_0xeb55('0x7'),'appdata':'CDR(destination)='+(_0xf9e5ea[_0xeb55('0x12')]?_0xeb55('0x13')+_0xf9e5ea[_0xeb55('0x12')]+'}':_0xeb55('0x14')),'context':_0xf9e5ea[_0xeb55('0x4')],'exten':_0xf9e5ea['exten'],'priority':_0x177baf++,'VoiceExtensionId':_0xf9e5ea['id']},{'type':'outbound','app':_0xeb55('0x7'),'appdata':'CDR(routeid)='+_0xf9e5ea['id'],'context':_0xf9e5ea[_0xeb55('0x4')],'exten':_0xf9e5ea[_0xeb55('0x5')],'priority':_0x177baf++,'VoiceExtensionId':_0xf9e5ea['id']},{'type':_0xeb55('0x10'),'app':_0xeb55('0x15'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x177baf+0x2)+_0xeb55('0x16')+(_0x177baf+0x1)+')','context':_0xf9e5ea[_0xeb55('0x4')],'exten':_0xf9e5ea[_0xeb55('0x5')],'priority':_0x177baf++,'VoiceExtensionId':_0xf9e5ea['id']},{'type':_0xeb55('0x10'),'app':'Set','appdata':_0xf9e5ea[_0xeb55('0x12')]?_0xeb55('0x17')+_0xf9e5ea[_0xeb55('0x12')]+'}':_0xeb55('0x18'),'context':_0xf9e5ea[_0xeb55('0x4')],'exten':_0xf9e5ea[_0xeb55('0x5')],'priority':_0x177baf++,'VoiceExtensionId':_0xf9e5ea['id']},{'type':_0xeb55('0x10'),'app':_0xeb55('0x7'),'appdata':_0xeb55('0xd'),'context':_0xf9e5ea[_0xeb55('0x4')],'exten':_0xf9e5ea['exten'],'priority':_0x177baf++,'VoiceExtensionId':_0xf9e5ea['id']},{'type':'outbound','app':'Set','appdata':_0xeb55('0xe'),'context':_0xf9e5ea['context'],'exten':_0xf9e5ea['exten'],'priority':_0x177baf++,'VoiceExtensionId':_0xf9e5ea['id']},{'type':_0xeb55('0x10'),'app':_0xeb55('0x7'),'appdata':_0xeb55('0xf'),'context':_0xf9e5ea[_0xeb55('0x4')],'exten':_0xf9e5ea[_0xeb55('0x5')],'priority':_0x177baf++,'VoiceExtensionId':_0xf9e5ea['id']},{'type':_0xeb55('0x10'),'app':_0xeb55('0x7'),'appdata':'outboundrouteid='+_0xf9e5ea['id'],'context':_0xf9e5ea['context'],'exten':_0xf9e5ea[_0xeb55('0x5')],'priority':_0x177baf++,'VoiceExtensionId':_0xf9e5ea['id']}];if(_0xf9e5ea[_0xeb55('0x19')](_0xeb55('0x1a'))&&_0xf9e5ea[_0xeb55('0x1a')]!==_0xeb55('0x1b')){_0x105a9b[_0xeb55('0xa')]({'type':_0xeb55('0x10'),'app':'Set','appdata':_0xeb55('0x1c'),'context':_0xf9e5ea['context'],'exten':_0xf9e5ea[_0xeb55('0x5')],'priority':_0x177baf++,'VoiceExtensionId':_0xf9e5ea['id']},{'type':_0xeb55('0x10'),'app':'Set','appdata':_0xeb55('0x1d')+_0xf9e5ea[_0xeb55('0x1a')]||_0xeb55('0x1e'),'context':_0xf9e5ea['context'],'exten':_0xf9e5ea[_0xeb55('0x5')],'priority':_0x177baf++,'VoiceExtensionId':_0xf9e5ea['id']});}return _0x105a9b;}function _0xcb4071(_0x3a72cb,_0x15f54b){var _0x32367b=[{'name':'trunk','param':0x0},{'name':'timeout','param':0x1},{'name':'options','param':0x2},{'name':_0xeb55('0x1f'),'param':0x3}];var _0x13f5ee={};var _0x4c8673=_0x15f54b[_0xeb55('0x20')](',');var _0x214613=[];for(var _0x24469a=0x0;_0x24469a<_0x32367b['length'];_0x24469a++){switch(_0x32367b[_0x24469a][_0xeb55('0x21')]){case _0xeb55('0x22'):_0x13f5ee[_0xeb55('0x22')]=_0x4c8673[_0x32367b[_0x24469a][_0xeb55('0x23')]]['split']('/')[0x1];_0x13f5ee[_0xeb55('0x24')]=_0x4c8673[_0x32367b[_0x24469a][_0xeb55('0x23')]][_0xeb55('0x20')]('/')[0x2];_0x13f5ee[_0xeb55('0x25')]=_0x13f5ee[_0xeb55('0x24')]?_0x13f5ee[_0xeb55('0x24')][_0xeb55('0x20')]('$')[0x0]:undefined;_0x13f5ee[_0xeb55('0x24')]=_0x3a72cb[_0xeb55('0x12')]?(_0x13f5ee[_0xeb55('0x25')]||'')+_0xeb55('0x13')+_0x3a72cb[_0xeb55('0x12')]+'}':(_0x13f5ee[_0xeb55('0x25')]||'')+_0xeb55('0x14');_0x214613[_0x32367b[_0x24469a][_0xeb55('0x23')]]=['SIP',_0x13f5ee['trunk'],_0x13f5ee[_0xeb55('0x24')]][_0xeb55('0x26')]('/');break;case _0xeb55('0x27'):_0x13f5ee[_0xeb55('0x27')]=_0x4c8673[_0x32367b[_0x24469a][_0xeb55('0x23')]];if(_0x3a72cb[_0xeb55('0x1a')]!==_0xeb55('0x1b')){if(_0x13f5ee[_0xeb55('0x27')][_0xeb55('0x28')](_0xeb55('0x29'))<0x0){_0x13f5ee[_0xeb55('0x27')]+=_0xeb55('0x29');}}else{_0x13f5ee[_0xeb55('0x27')]=_0x13f5ee[_0xeb55('0x27')][_0xeb55('0x2a')](_0xeb55('0x29'),'');}_0x214613[_0x32367b[_0x24469a][_0xeb55('0x23')]]=_0x13f5ee['options'];break;default:_0x214613[_0x32367b[_0x24469a][_0xeb55('0x23')]]=_0x4c8673[_0x32367b[_0x24469a]['param']];}}return _0x214613['join'](',');}function _0x12a2bf(_0x349ca7,_0x4e3a9d,_0x341ebc){return new Promise(function(_0x10cc7c,_0x28585b){var _0x635834=[];if(_[_0xeb55('0x2b')](_0x4e3a9d))return _0x10cc7c(_0x635834);_0x559039['Interval'][_0xeb55('0x2c')]({'attributes':['id',_0xeb55('0x2d'),'IntervalId'],'raw':!![]})[_0xeb55('0x2e')](function(_0x1964c7){for(var _0x25b92e=0x0,_0x90098d=0x0;_0x25b92e<_0x4e3a9d['length'];_0x25b92e++,_0x90098d=0x0){var _0x31f968=_0x4e3a9d[_0x25b92e];var _0x421100=[];var _0x470130=[];delete _0x31f968['id'];if(_0x31f968[_0xeb55('0x2d')]!==_0xeb55('0x2f')){_0x31f968['intervals']=[_0x31f968[_0xeb55('0x2d')]];}else{_0x31f968[_0xeb55('0x30')]=_0x31f968[_0xeb55('0x31')]?_['map'](_['filter'](_0x1964c7,{'IntervalId':_0x31f968['IntervalId']}),_0xeb55('0x2d')):[];}_0x31f968[_0xeb55('0x4')]=_0x349ca7[_0xeb55('0x4')];_0x31f968['exten']=_0x349ca7['exten'];if(_0x31f968[_0xeb55('0x3')])_0x31f968['type']=_0x31f968[_0xeb55('0x3')][_0xeb55('0x32')]();if(_0x349ca7['type']==='outbound'){if(_0x31f968[_0xeb55('0x19')](_0xeb55('0x33'))&&_0x31f968[_0xeb55('0x33')]&&_0x31f968[_0xeb55('0x33')]!=='--'){_0x421100[_0xeb55('0xa')]({'type':_0x31f968[_0xeb55('0x3')][_0xeb55('0x32')](),'app':_0xeb55('0x7'),'appdata':'CDR(tag)='+_0x31f968[_0xeb55('0x33')],'context':_0x349ca7[_0xeb55('0x4')],'exten':_0x349ca7[_0xeb55('0x5')],'priority':_0x31f968['intervals'][_0xeb55('0x34')]+_0x341ebc+_0x90098d++,'VoiceExtensionId':_0x349ca7['id']});}_0x421100[_0xeb55('0xa')]({'type':_0x31f968['type']['toLowerCase'](),'app':'ExecIf','appdata':_0xeb55('0x35')+(_0x31f968[_0xeb55('0x36')]?'Set(CALLERID(all)='+_0x31f968[_0xeb55('0x36')]+')':_0xeb55('0x37')),'context':_0x349ca7['context'],'exten':_0x349ca7['exten'],'priority':_0x31f968[_0xeb55('0x30')][_0xeb55('0x34')]+_0x341ebc+_0x90098d++,'VoiceExtensionId':_0x349ca7['id']});}else{if(_0x31f968[_0xeb55('0x19')]('answer')){if(['queue','playback']['includes'](_0x31f968['app'][_0xeb55('0x32')]())&&_0x31f968[_0xeb55('0x38')]!=='custom'){if(_0x31f968[_0xeb55('0x39')]){_0x421100[_0xeb55('0xa')]({'type':_0x31f968[_0xeb55('0x3')][_0xeb55('0x32')](),'app':'ExecIf','appdata':_0xeb55('0x3a'),'context':_0x349ca7[_0xeb55('0x4')],'exten':_0x349ca7[_0xeb55('0x5')],'priority':_0x31f968[_0xeb55('0x30')]['length']+_0x341ebc+_0x90098d++,'VoiceExtensionId':_0x349ca7['id']});_0x421100[_0xeb55('0xa')]({'type':_0x31f968[_0xeb55('0x3')][_0xeb55('0x32')](),'app':_0xeb55('0x7'),'appdata':_0xeb55('0x3b'),'context':_0x349ca7[_0xeb55('0x4')],'exten':_0x349ca7[_0xeb55('0x5')],'priority':_0x31f968[_0xeb55('0x30')][_0xeb55('0x34')]+_0x341ebc+_0x90098d++,'VoiceExtensionId':_0x349ca7['id']});}else{_0x421100[_0xeb55('0xa')]({'type':_0x31f968[_0xeb55('0x3')][_0xeb55('0x32')](),'app':_0xeb55('0x15'),'appdata':_0xeb55('0x3c'),'context':_0x349ca7['context'],'exten':_0x349ca7[_0xeb55('0x5')],'priority':_0x31f968[_0xeb55('0x30')][_0xeb55('0x34')]+_0x341ebc+_0x90098d++,'VoiceExtensionId':_0x349ca7['id']});_0x421100[_0xeb55('0xa')]({'type':_0x31f968[_0xeb55('0x3')]['toLowerCase'](),'app':'Set','appdata':_0xeb55('0x3d'),'context':_0x349ca7['context'],'exten':_0x349ca7[_0xeb55('0x5')],'priority':_0x31f968[_0xeb55('0x30')]['length']+_0x341ebc+_0x90098d++,'VoiceExtensionId':_0x349ca7['id']});}}}}for(var _0x321cd0=0x0;_0x321cd0<_0x31f968[_0xeb55('0x30')][_0xeb55('0x34')];_0x321cd0++){var _0x55fd0c=_0x341ebc+_0x31f968[_0xeb55('0x30')][_0xeb55('0x34')];var _0x2e1550=_0x321cd0===_0x31f968['intervals'][_0xeb55('0x34')]-0x1?_0x341ebc+_0x421100[_0xeb55('0x34')]+_0x470130[_0xeb55('0x34')]+0x2:_0x341ebc+_0x321cd0+0x1;_0x421100[_0xeb55('0x3e')](_0x321cd0,0x0,{'type':_0x349ca7[_0xeb55('0x3')],'app':'GotoIfTime','appdata':_0x31f968[_0xeb55('0x30')][_0x321cd0]+'?'+_0x349ca7[_0xeb55('0x4')]+_0xeb55('0x3f')+_0x55fd0c+':'+_0x349ca7[_0xeb55('0x4')]+',${EXTEN},'+_0x2e1550,'exten':_0x349ca7[_0xeb55('0x5')],'context':_0x349ca7[_0xeb55('0x4')],'priority':_0x341ebc+_0x321cd0,'VoiceExtensionId':_0x349ca7['id']});}if(_0x31f968[_0xeb55('0x38')]===_0xeb55('0x40'))_0x31f968[_0xeb55('0x41')]=_0xcb4071(_0x349ca7,_0x31f968[_0xeb55('0x41')]);_0x31f968[_0xeb55('0x42')]=_0x421100[_0xeb55('0x34')]?_[_0xeb55('0x43')](_0x421100)[_0xeb55('0x42')]+0x1:_0x341ebc;_0x635834=_[_0xeb55('0x44')](_0x635834,_0x421100,[_0x31f968],_0x470130);_0x341ebc=_[_0xeb55('0x43')](_0x635834)[_0xeb55('0x42')]+0x1;}return _0x10cc7c(_0x635834);})[_0xeb55('0x45')](function(_0x500907){_0x28585b(_0x500907);});});}return _0x8bb640[_0xeb55('0x46')](_0xeb55('0x47'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x357e5f){var _0x2d0761=this[_0xeb55('0x48')]({'plain':!![]});var _0x4b4730=_0x2d0761[_0xeb55('0x3')]===_0xeb55('0x10')?_0x506cdb(_0x2d0761):_0xd22a98(_0x2d0761);return _0x12a2bf(_0x2d0761,_0x357e5f,_[_0xeb55('0x43')](_0x4b4730)[_0xeb55('0x42')]+0x1)[_0xeb55('0x2e')](function(_0x4cfc58){var _0x112a1b=_['concat'](_0x4b4730,_0x4cfc58);_0x112a1b[_0xeb55('0xa')]({'type':_0x2d0761['type'],'app':_0xeb55('0x49'),'exten':_0x2d0761[_0xeb55('0x5')],'context':_0x2d0761[_0xeb55('0x4')],'priority':_['last'](_0x112a1b)['priority']+0x1,'VoiceExtensionId':_0x2d0761['id']});return _0x112a1b;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index e128f7f..1fbbf72 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 _0x16ce=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','VoiceExtension','findAll','options','raw','attributes','limit','map','include','model','GetVoiceExtension','util'];(function(_0x44e834,_0x594bac){var _0x286d42=function(_0x3b7377){while(--_0x3b7377){_0x44e834['push'](_0x44e834['shift']());}};_0x286d42(++_0x594bac);}(_0x16ce,0xfb));var _0xe16c=function(_0x5a55ce,_0x339bba){_0x5a55ce=_0x5a55ce-0x0;var _0x2fd6ce=_0x16ce[_0x5a55ce];return _0x2fd6ce;};'use strict';var _=require('lodash');var util=require(_0xe16c('0x0'));var moment=require(_0xe16c('0x1'));var BPromise=require(_0xe16c('0x2'));var rs=require(_0xe16c('0x3'));var fs=require('fs');var Redis=require(_0xe16c('0x4'));var db=require(_0xe16c('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xe16c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe16c('0x7')][_0xe16c('0x8')]({'port':0x232a});config[_0xe16c('0x9')]=_[_0xe16c('0xa')](config[_0xe16c('0x9')],{'host':_0xe16c('0xb'),'port':0x18eb});var socket=require(_0xe16c('0xc'))(new Redis(config[_0xe16c('0x9')]));require('./voiceExtension.socket')[_0xe16c('0xd')](socket);function respondWithRpcPromise(_0x1dfa84,_0x3cc96b,_0x2e59ad){return new BPromise(function(_0x1b7da7,_0x280e21){return client[_0xe16c('0xe')](_0x1dfa84,_0x2e59ad)[_0xe16c('0xf')](function(_0x1b460c){logger[_0xe16c('0x10')](_0xe16c('0x11'),_0x3cc96b,'request\x20sent');logger[_0xe16c('0x12')](_0xe16c('0x13'),_0x3cc96b,_0xe16c('0x14'),JSON[_0xe16c('0x15')](_0x1b460c));if(_0x1b460c['error']){if(_0x1b460c['error'][_0xe16c('0x16')]===0x1f4){logger[_0xe16c('0x17')](_0xe16c('0x11'),_0x3cc96b,_0x1b460c[_0xe16c('0x17')]['message']);return _0x280e21(_0x1b460c[_0xe16c('0x17')]['message']);}logger[_0xe16c('0x17')](_0xe16c('0x11'),_0x3cc96b,_0x1b460c[_0xe16c('0x17')]['message']);return _0x1b7da7(_0x1b460c[_0xe16c('0x17')][_0xe16c('0x18')]);}else{logger[_0xe16c('0x10')](_0xe16c('0x11'),_0x3cc96b,_0xe16c('0x14'));_0x1b7da7(_0x1b460c['result'][_0xe16c('0x18')]);}})[_0xe16c('0x19')](function(_0x22fe04){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x3cc96b,_0x22fe04);_0x280e21(_0x22fe04);});});}exports['GetVoiceExtension']=function(_0x30e657){var _0x23fe64=this;return new Promise(function(_0x611939,_0xfc18a6){return db[_0xe16c('0x1a')][_0xe16c('0x1b')]({'raw':_0x30e657['options']?_0x30e657[_0xe16c('0x1c')][_0xe16c('0x1d')]===undefined?!![]:![]:!![],'where':_0x30e657[_0xe16c('0x1c')]?_0x30e657[_0xe16c('0x1c')]['where']||null:null,'attributes':_0x30e657[_0xe16c('0x1c')]?_0x30e657[_0xe16c('0x1c')][_0xe16c('0x1e')]||null:null,'limit':_0x30e657[_0xe16c('0x1c')]?_0x30e657[_0xe16c('0x1c')][_0xe16c('0x1f')]||null:null,'include':_0x30e657[_0xe16c('0x1c')]?_0x30e657[_0xe16c('0x1c')]['include']?_[_0xe16c('0x20')](_0x30e657[_0xe16c('0x1c')]['include'],function(_0xd0799){return{'model':db[_0xd0799['model']],'as':_0xd0799['as'],'attributes':_0xd0799[_0xe16c('0x1e')],'include':_0xd0799['include']?_[_0xe16c('0x20')](_0xd0799[_0xe16c('0x21')],function(_0x234c26){return{'model':db[_0x234c26[_0xe16c('0x22')]],'as':_0x234c26['as'],'attributes':_0x234c26[_0xe16c('0x1e')],'include':_0x234c26[_0xe16c('0x21')]?_[_0xe16c('0x20')](_0x234c26[_0xe16c('0x21')],function(_0x3472ef){return{'model':db[_0x3472ef[_0xe16c('0x22')]],'as':_0x3472ef['as'],'attributes':_0x3472ef['attributes']};}):[]};}):[]};}):[]:[]})[_0xe16c('0xf')](function(_0x213216){logger[_0xe16c('0x10')]('GetVoiceExtension',_0x30e657);logger[_0xe16c('0x12')](_0xe16c('0x23'),_0x30e657,JSON['stringify'](_0x213216));_0x611939(_0x213216);})[_0xe16c('0x19')](function(_0x25ec64){logger['error'](_0xe16c('0x23'),_0x25ec64[_0xe16c('0x18')],_0x30e657);_0xfc18a6(_0x23fe64[_0xe16c('0x17')](0x1f4,_0x25ec64[_0xe16c('0x18')]));});});}; \ No newline at end of file +var _0xc01b=['util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceExtension','options','raw','where','attributes','include','model','map','stringify','lodash'];(function(_0x36dbb0,_0x1bc606){var _0x26ddd2=function(_0x14208b){while(--_0x14208b){_0x36dbb0['push'](_0x36dbb0['shift']());}};_0x26ddd2(++_0x1bc606);}(_0xc01b,0x65));var _0xbc01=function(_0x3e1f42,_0x347b2b){_0x3e1f42=_0x3e1f42-0x0;var _0x13a26a=_0xc01b[_0x3e1f42];return _0x13a26a;};'use strict';var _=require(_0xbc01('0x0'));var util=require(_0xbc01('0x1'));var moment=require(_0xbc01('0x2'));var BPromise=require(_0xbc01('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbc01('0x4'));var db=require(_0xbc01('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xbc01('0x6'));var jayson=require(_0xbc01('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xbc01('0x8')]=_[_0xbc01('0x9')](config[_0xbc01('0x8')],{'host':_0xbc01('0xa'),'port':0x18eb});var socket=require(_0xbc01('0xb'))(new Redis(config[_0xbc01('0x8')]));require(_0xbc01('0xc'))['register'](socket);function respondWithRpcPromise(_0x46f01c,_0x3cc11e,_0x3b7f4d){return new BPromise(function(_0x1d84e8,_0xa0d0b1){return client[_0xbc01('0xd')](_0x46f01c,_0x3b7f4d)[_0xbc01('0xe')](function(_0x28067a){logger[_0xbc01('0xf')](_0xbc01('0x10'),_0x3cc11e,_0xbc01('0x11'));logger[_0xbc01('0x12')](_0xbc01('0x13'),_0x3cc11e,_0xbc01('0x11'),JSON['stringify'](_0x28067a));if(_0x28067a[_0xbc01('0x14')]){if(_0x28067a[_0xbc01('0x14')][_0xbc01('0x15')]===0x1f4){logger['error'](_0xbc01('0x10'),_0x3cc11e,_0x28067a[_0xbc01('0x14')]['message']);return _0xa0d0b1(_0x28067a[_0xbc01('0x14')][_0xbc01('0x16')]);}logger[_0xbc01('0x14')](_0xbc01('0x10'),_0x3cc11e,_0x28067a['error']['message']);return _0x1d84e8(_0x28067a[_0xbc01('0x14')][_0xbc01('0x16')]);}else{logger['info'](_0xbc01('0x10'),_0x3cc11e,'request\x20sent');_0x1d84e8(_0x28067a[_0xbc01('0x17')][_0xbc01('0x16')]);}})[_0xbc01('0x18')](function(_0x1e79d0){logger['error'](_0xbc01('0x10'),_0x3cc11e,_0x1e79d0);_0xa0d0b1(_0x1e79d0);});});}exports[_0xbc01('0x19')]=function(_0x40162b){var _0x4a579c=this;return new Promise(function(_0x364c87,_0x121670){return db['VoiceExtension']['findAll']({'raw':_0x40162b['options']?_0x40162b[_0xbc01('0x1a')][_0xbc01('0x1b')]===undefined?!![]:![]:!![],'where':_0x40162b[_0xbc01('0x1a')]?_0x40162b[_0xbc01('0x1a')][_0xbc01('0x1c')]||null:null,'attributes':_0x40162b[_0xbc01('0x1a')]?_0x40162b['options'][_0xbc01('0x1d')]||null:null,'limit':_0x40162b['options']?_0x40162b[_0xbc01('0x1a')]['limit']||null:null,'include':_0x40162b[_0xbc01('0x1a')]?_0x40162b[_0xbc01('0x1a')][_0xbc01('0x1e')]?_['map'](_0x40162b[_0xbc01('0x1a')][_0xbc01('0x1e')],function(_0x56383f){return{'model':db[_0x56383f[_0xbc01('0x1f')]],'as':_0x56383f['as'],'attributes':_0x56383f[_0xbc01('0x1d')],'include':_0x56383f[_0xbc01('0x1e')]?_[_0xbc01('0x20')](_0x56383f[_0xbc01('0x1e')],function(_0x2ca748){return{'model':db[_0x2ca748[_0xbc01('0x1f')]],'as':_0x2ca748['as'],'attributes':_0x2ca748[_0xbc01('0x1d')],'include':_0x2ca748[_0xbc01('0x1e')]?_[_0xbc01('0x20')](_0x2ca748[_0xbc01('0x1e')],function(_0x5778d7){return{'model':db[_0x5778d7[_0xbc01('0x1f')]],'as':_0x5778d7['as'],'attributes':_0x5778d7[_0xbc01('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbc01('0xe')](function(_0xc51dea){logger[_0xbc01('0xf')](_0xbc01('0x19'),_0x40162b);logger[_0xbc01('0x12')]('GetVoiceExtension',_0x40162b,JSON[_0xbc01('0x21')](_0xc51dea));_0x364c87(_0xc51dea);})['catch'](function(_0x11e8b9){logger[_0xbc01('0x14')]('GetVoiceExtension',_0x11e8b9[_0xbc01('0x16')],_0x40162b);_0x121670(_0x4a579c[_0xbc01('0x14')](0x1f4,_0x11e8b9['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 9fea6f0..9fc8bef 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['update','emit','removeListener','register','length','./voiceExtension.events'];(function(_0xbe65b8,_0x1a1357){var _0x1d009a=function(_0x232e83){while(--_0x232e83){_0xbe65b8['push'](_0xbe65b8['shift']());}};_0x1d009a(++_0x1a1357);}(_0x326f,0xd1));var _0xf326=function(_0x1f3aef,_0x1ce665){_0x1f3aef=_0x1f3aef-0x0;var _0x2bd2b0=_0x326f[_0x1f3aef];return _0x2bd2b0;};'use strict';var VoiceExtensionEvents=require(_0xf326('0x0'));var events=['save','remove',_0xf326('0x1')];function createListener(_0x330ddb,_0x22aabf){return function(_0x408257){_0x22aabf[_0xf326('0x2')](_0x330ddb,_0x408257);};}function removeListener(_0x120a26,_0x9445c6){return function(){VoiceExtensionEvents[_0xf326('0x3')](_0x120a26,_0x9445c6);};}exports[_0xf326('0x4')]=function(_0x3ace29){for(var _0x4c2249=0x0,_0x3c254d=events[_0xf326('0x5')];_0x4c2249<_0x3c254d;_0x4c2249++){var _0x165f95=events[_0x4c2249];var _0x1e7b8a=createListener('voiceExtension:'+_0x165f95,_0x3ace29);VoiceExtensionEvents['on'](_0x165f95,_0x1e7b8a);}}; \ No newline at end of file +var _0x814b=['removeListener','register','length','voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x2f227c,_0x360c3a){var _0x5032bc=function(_0x824bb){while(--_0x824bb){_0x2f227c['push'](_0x2f227c['shift']());}};_0x5032bc(++_0x360c3a);}(_0x814b,0x1a2));var _0xb814=function(_0x131fe7,_0x21fcdb){_0x131fe7=_0x131fe7-0x0;var _0x2eddf3=_0x814b[_0x131fe7];return _0x2eddf3;};'use strict';var VoiceExtensionEvents=require(_0xb814('0x0'));var events=[_0xb814('0x1'),_0xb814('0x2'),_0xb814('0x3')];function createListener(_0xfbb64b,_0x477725){return function(_0x4a98af){_0x477725[_0xb814('0x4')](_0xfbb64b,_0x4a98af);};}function removeListener(_0x3e1e9,_0x258866){return function(){VoiceExtensionEvents[_0xb814('0x5')](_0x3e1e9,_0x258866);};}exports[_0xb814('0x6')]=function(_0x322a70){for(var _0x53e507=0x0,_0x3b0829=events[_0xb814('0x7')];_0x53e507<_0x3b0829;_0x53e507++){var _0x5c8539=events[_0x53e507];var _0x271af9=createListener(_0xb814('0x8')+_0x5c8539,_0x322a70);VoiceExtensionEvents['on'](_0x5c8539,_0x271af9);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 584e6f9..4d4015b 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 _0x11e5=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','show','/:id/messages','getMessages','post','create','put','/:id','delete','destroy','exports','multer'];(function(_0x7df6aa,_0x328c99){var _0x2208ce=function(_0x564814){while(--_0x564814){_0x7df6aa['push'](_0x7df6aa['shift']());}};_0x2208ce(++_0x328c99);}(_0x11e5,0x8b));var _0x511e=function(_0x19c67c,_0x253239){_0x19c67c=_0x19c67c-0x0;var _0x4b304b=_0x11e5[_0x19c67c];return _0x4b304b;};'use strict';var multer=require(_0x511e('0x0'));var util=require('util');var path=require(_0x511e('0x1'));var timeout=require(_0x511e('0x2'));var express=require('express');var router=express[_0x511e('0x3')]();var fs_extra=require(_0x511e('0x4'));var auth=require(_0x511e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x511e('0x6'));var controller=require('./voiceMail.controller');router['get']('/',auth[_0x511e('0x7')](),controller[_0x511e('0x8')]);router[_0x511e('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x511e('0xa')]);router[_0x511e('0x9')](_0x511e('0xb'),auth[_0x511e('0x7')](),controller[_0x511e('0xc')]);router[_0x511e('0xd')]('/',auth[_0x511e('0x7')](),controller[_0x511e('0xe')]);router[_0x511e('0xf')](_0x511e('0x10'),auth[_0x511e('0x7')](),controller['update']);router[_0x511e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x511e('0x12')]);module[_0x511e('0x13')]=router; \ No newline at end of file +var _0x958a=['Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','getMessages','post','create','put','update','delete','destroy','multer','util','connect-timeout','express'];(function(_0x5b69bd,_0xe10a86){var _0x4c7122=function(_0x216572){while(--_0x216572){_0x5b69bd['push'](_0x5b69bd['shift']());}};_0x4c7122(++_0xe10a86);}(_0x958a,0x128));var _0xa958=function(_0x30db8f,_0x561b61){_0x30db8f=_0x30db8f-0x0;var _0x576139=_0x958a[_0x30db8f];return _0x576139;};'use strict';var multer=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var path=require('path');var timeout=require(_0xa958('0x2'));var express=require(_0xa958('0x3'));var router=express[_0xa958('0x4')]();var fs_extra=require(_0xa958('0x5'));var auth=require(_0xa958('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa958('0x7'));var controller=require('./voiceMail.controller');router[_0xa958('0x8')]('/',auth[_0xa958('0x9')](),controller[_0xa958('0xa')]);router[_0xa958('0x8')](_0xa958('0xb'),auth[_0xa958('0x9')](),controller[_0xa958('0xc')]);router['get']('/:id/messages',auth[_0xa958('0x9')](),controller[_0xa958('0xd')]);router[_0xa958('0xe')]('/',auth[_0xa958('0x9')](),controller[_0xa958('0xf')]);router[_0xa958('0x10')](_0xa958('0xb'),auth[_0xa958('0x9')](),controller[_0xa958('0x11')]);router[_0xa958('0x12')](_0xa958('0xb'),auth[_0xa958('0x9')](),controller[_0xa958('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 2595ff9..fb9a228 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 _0xeb74=['TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','exports','from-voicemail','contest_mailbox','STRING','setDataValue','email','string','ENUM','yes'];(function(_0x1b8e3c,_0x32e0e3){var _0x35aa7c=function(_0x5001be){while(--_0x5001be){_0x1b8e3c['push'](_0x1b8e3c['shift']());}};_0x35aa7c(++_0x32e0e3);}(_0xeb74,0x1d7));var _0x4eb7=function(_0x39607b,_0x8a7f64){_0x39607b=_0x39607b-0x0;var _0x472612=_0xeb74[_0x39607b];return _0x472612;};'use strict';var Sequelize=require('sequelize');module[_0x4eb7('0x0')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING'],'defaultValue':_0x4eb7('0x1'),'unique':_0x4eb7('0x2')},'mailbox':{'type':Sequelize[_0x4eb7('0x3')],'defaultValue':'','allowNull':![],'unique':_0x4eb7('0x2')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x4eb7('0x3')]},'email':{'type':Sequelize[_0x4eb7('0x3')],'validate':{'isEmail':!![]},'set':function(_0x3f06ca){this[_0x4eb7('0x4')](_0x4eb7('0x5'),typeof _0x3f06ca===_0x4eb7('0x6')&&_0x3f06ca['trim']()?_0x3f06ca['trim']():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x4eb7('0x3')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x4eb7('0x7')](_0x4eb7('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x4eb7('0x7')](_0x4eb7('0x8'),'no'),'defaultValue':_0x4eb7('0x8'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x4eb7('0x3')]},'review':{'type':Sequelize[_0x4eb7('0x7')](_0x4eb7('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x4eb7('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x4eb7('0x7')](_0x4eb7('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x4eb7('0x7')](_0x4eb7('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x4eb7('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x4eb7('0x7')](_0x4eb7('0x8'),'no'),'defaultValue':_0x4eb7('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x4eb7('0x7')](_0x4eb7('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x4eb7('0x7')](_0x4eb7('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x4eb7('0x7')]('yes','no'),'defaultValue':_0x4eb7('0x8'),'allowNull':![]},'stamp':{'type':_0x4eb7('0x9')},'emailsubject':{'type':Sequelize[_0x4eb7('0x3')]},'emailbody':{'type':Sequelize[_0x4eb7('0x3')]},'maxsecs':{'type':Sequelize[_0x4eb7('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x4eb7('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x4eb7('0xb')],'get':function(){return this[_0x4eb7('0xc')](_0x4eb7('0xd'))+_0x4eb7('0xe')+this[_0x4eb7('0xc')](_0x4eb7('0xf'));}}}; \ No newline at end of file +var _0x3975=['INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x3975,0x15c));var _0x5397=function(_0x24ea04,_0x194960){_0x24ea04=_0x24ea04-0x0;var _0x3635ee=_0x3975[_0x24ea04];return _0x3635ee;};'use strict';var Sequelize=require(_0x5397('0x0'));module[_0x5397('0x1')]={'customer_id':{'type':Sequelize[_0x5397('0x2')]},'context':{'type':Sequelize[_0x5397('0x2')],'defaultValue':_0x5397('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x5397('0x2')],'defaultValue':'','allowNull':![],'unique':_0x5397('0x4')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x5397('0x2')]},'email':{'type':Sequelize[_0x5397('0x2')],'validate':{'isEmail':!![]},'set':function(_0x21ae83){this[_0x5397('0x5')](_0x5397('0x6'),typeof _0x21ae83===_0x5397('0x7')&&_0x21ae83['trim']()?_0x21ae83[_0x5397('0x8')]():null);}},'pager':{'type':Sequelize[_0x5397('0x2')]},'tz':{'type':Sequelize[_0x5397('0x2')],'defaultValue':_0x5397('0x9')},'attach':{'type':Sequelize[_0x5397('0xa')](_0x5397('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x5397('0xa')](_0x5397('0xb'),'no'),'defaultValue':_0x5397('0xb'),'allowNull':![]},'dialout':{'type':Sequelize[_0x5397('0x2')]},'callback':{'type':Sequelize[_0x5397('0x2')]},'review':{'type':Sequelize[_0x5397('0xa')](_0x5397('0xb'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x5397('0xa')](_0x5397('0xb'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x5397('0xa')](_0x5397('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x5397('0xa')](_0x5397('0xb'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x5397('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x5397('0xb'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x5397('0xa')](_0x5397('0xb'),'no'),'defaultValue':_0x5397('0xb'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x5397('0xb'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x5397('0xa')](_0x5397('0xb'),'no'),'defaultValue':_0x5397('0xb'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x5397('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x5397('0xd')],'get':function(){return this[_0x5397('0xe')](_0x5397('0xf'))+_0x5397('0x10')+this[_0x5397('0xe')](_0x5397('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 0213625..544ed5a 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 _0xbc9d=['mailbox','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','destroy','then','get','UserProfileResource','stack','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','name','options','include','VoiceMail','findAll','rows','params','fields','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','UserProfileSection','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage'];(function(_0x421d0e,_0x18cbcd){var _0x1e7d5a=function(_0x4b8c65){while(--_0x4b8c65){_0x421d0e['push'](_0x421d0e['shift']());}};_0x1e7d5a(++_0x18cbcd);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x3191ce,_0x91a151){_0x3191ce=_0x3191ce-0x0;var _0x5bd274=_0xbc9d[_0x3191ce];return _0x5bd274;};'use strict';var emlformat=require(_0xdbc9('0x0'));var rimraf=require(_0xdbc9('0x1'));var zipdir=require(_0xdbc9('0x2'));var jsonpatch=require(_0xdbc9('0x3'));var rp=require(_0xdbc9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdbc9('0x5'));var path=require(_0xdbc9('0x6'));var sox=require(_0xdbc9('0x7'));var csv=require(_0xdbc9('0x8'));var ejs=require(_0xdbc9('0x9'));var fs=require('fs');var fs_extra=require(_0xdbc9('0xa'));var _=require(_0xdbc9('0xb'));var squel=require('squel');var crypto=require(_0xdbc9('0xc'));var jsforce=require(_0xdbc9('0xd'));var deskjs=require(_0xdbc9('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdbc9('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdbc9('0x10'));var qs=require(_0xdbc9('0x11'));var as=require(_0xdbc9('0x12'));var hardwareService=require(_0xdbc9('0x13'));var logger=require('../../config/logger')(_0xdbc9('0x14'));var utils=require(_0xdbc9('0x15'));var config=require(_0xdbc9('0x16'));var licenseUtil=require(_0xdbc9('0x17'));var db=require(_0xdbc9('0x18'))['db'];function respondWithStatusCode(_0x103d54,_0x48bc83){_0x48bc83=_0x48bc83||0xcc;return function(_0x567e71){if(_0x567e71){return _0x103d54[_0xdbc9('0x19')](_0x48bc83);}return _0x103d54[_0xdbc9('0x1a')](_0x48bc83)[_0xdbc9('0x1b')]();};}function respondWithResult(_0x436e50,_0x53495d){_0x53495d=_0x53495d||0xc8;return function(_0x4a9dcb){if(_0x4a9dcb){return _0x436e50[_0xdbc9('0x1a')](_0x53495d)[_0xdbc9('0x1c')](_0x4a9dcb);}};}function respondWithFilteredResult(_0x3a8a7b,_0x4c7b4f){return function(_0x1b4616){if(_0x1b4616){var _0x1abee8=typeof _0x4c7b4f['offset']===_0xdbc9('0x1d')&&typeof _0x4c7b4f[_0xdbc9('0x1e')]===_0xdbc9('0x1d');var _0x14e655=_0x1b4616[_0xdbc9('0x1f')];var _0x33f1bd=_0x1abee8?0x0:_0x4c7b4f[_0xdbc9('0x20')];var _0xc2ddd2=_0x1abee8?_0x1b4616[_0xdbc9('0x1f')]:_0x4c7b4f[_0xdbc9('0x20')]+_0x4c7b4f['limit'];var _0x1ca5fd;if(_0xc2ddd2>=_0x14e655){_0xc2ddd2=_0x14e655;_0x1ca5fd=0xc8;}else{_0x1ca5fd=0xce;}_0x3a8a7b['status'](_0x1ca5fd);return _0x3a8a7b[_0xdbc9('0x21')](_0xdbc9('0x22'),_0x33f1bd+'-'+_0xc2ddd2+'/'+_0x14e655)['json'](_0x1b4616);}return null;};}function patchUpdates(_0x4408e9){return function(_0x5367dc){try{jsonpatch['apply'](_0x5367dc,_0x4408e9,!![]);}catch(_0x4ab00d){return BPromise['reject'](_0x4ab00d);}return _0x5367dc[_0xdbc9('0x23')]();};}function saveUpdates(_0x2011a2,_0x570ad9){return function(_0x16dcf7){if(_0x16dcf7){return _0x16dcf7[_0xdbc9('0x24')](_0x2011a2)['then'](function(_0x1bc073){return _0x1bc073;});}return null;};}function removeEntity(_0x6b788,_0x1b1c0d){return function(_0x119230){if(_0x119230){return _0x119230[_0xdbc9('0x25')]()[_0xdbc9('0x26')](function(){var _0x32822f=_0x119230[_0xdbc9('0x27')]({'plain':!![]});var _0x3c8c1d='Voicemails';return db[_0xdbc9('0x28')][_0xdbc9('0x25')]({'where':{'type':_0x3c8c1d,'resourceId':_0x32822f['id']}})[_0xdbc9('0x26')](function(){return _0x119230;});})[_0xdbc9('0x26')](function(){_0x6b788[_0xdbc9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf121e9,_0x2ee00a){return function(_0x5300bd){if(!_0x5300bd){_0xf121e9['sendStatus'](0x194);}return _0x5300bd;};}function handleError(_0x45aebe,_0x278db2){_0x278db2=_0x278db2||0x1f4;return function(_0x473430){logger['error'](_0x473430[_0xdbc9('0x29')]);if(_0x473430['name']){delete _0x473430['name'];}_0x45aebe[_0xdbc9('0x1a')](_0x278db2)['send'](_0x473430);};}exports['index']=function(_0x417b17,_0x20eb4f){var _0x1cb557={},_0x4db824={},_0x35eaf8={'count':0x0,'rows':[]};var _0x22f8aa=_['map'](db['VoiceMail'][_0xdbc9('0x2a')],function(_0x245496){return{'name':_0x245496[_0xdbc9('0x2b')],'type':_0x245496[_0xdbc9('0x2c')][_0xdbc9('0x2d')]};});_0x4db824[_0xdbc9('0x2e')]=_[_0xdbc9('0x2f')](_0x22f8aa,'name');_0x4db824[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x417b17[_0xdbc9('0x30')]);_0x4db824[_0xdbc9('0x32')]=_[_0xdbc9('0x33')](_0x4db824[_0xdbc9('0x2e')],_0x4db824['query']);_0x1cb557[_0xdbc9('0x34')]=_['intersection'](_0x4db824['model'],qs['fields'](_0x417b17['query']['fields']));_0x1cb557[_0xdbc9('0x34')]=_0x1cb557[_0xdbc9('0x34')][_0xdbc9('0x35')]?_0x1cb557['attributes']:_0x4db824[_0xdbc9('0x2e')];if(!_0x417b17[_0xdbc9('0x30')][_0xdbc9('0x36')](_0xdbc9('0x37'))){_0x1cb557[_0xdbc9('0x1e')]=qs[_0xdbc9('0x1e')](_0x417b17['query'][_0xdbc9('0x1e')]);_0x1cb557[_0xdbc9('0x20')]=qs[_0xdbc9('0x20')](_0x417b17['query'][_0xdbc9('0x20')]);}_0x1cb557[_0xdbc9('0x38')]=qs[_0xdbc9('0x39')](_0x417b17[_0xdbc9('0x30')]['sort']);_0x1cb557['where']=qs[_0xdbc9('0x32')](_[_0xdbc9('0x3a')](_0x417b17[_0xdbc9('0x30')],_0x4db824[_0xdbc9('0x32')]),_0x22f8aa);if(_0x417b17['query'][_0xdbc9('0x3b')]){_0x1cb557[_0xdbc9('0x3c')]=_[_0xdbc9('0x3d')](_0x1cb557['where'],{'$or':_[_0xdbc9('0x2f')](_0x22f8aa,function(_0x38a2a7){if(_0x38a2a7[_0xdbc9('0x2c')]!=='VIRTUAL'){var _0xa11bc8={};_0xa11bc8[_0x38a2a7[_0xdbc9('0x3e')]]={'$like':'%'+_0x417b17['query']['filter']+'%'};return _0xa11bc8;}})});}_0x1cb557=_[_0xdbc9('0x3d')]({},_0x1cb557,_0x417b17[_0xdbc9('0x3f')]);var _0x387b57={'where':_0x1cb557[_0xdbc9('0x3c')]};return db['VoiceMail'][_0xdbc9('0x1f')](_0x387b57)[_0xdbc9('0x26')](function(_0x577725){_0x35eaf8[_0xdbc9('0x1f')]=_0x577725;if(_0x417b17[_0xdbc9('0x30')]['includeAll']){_0x1cb557[_0xdbc9('0x40')]=[{'all':!![]}];}return db[_0xdbc9('0x41')][_0xdbc9('0x42')](_0x1cb557);})[_0xdbc9('0x26')](function(_0x3ed4de){_0x35eaf8[_0xdbc9('0x43')]=_0x3ed4de;return _0x35eaf8;})[_0xdbc9('0x26')](respondWithFilteredResult(_0x20eb4f,_0x1cb557))['catch'](handleError(_0x20eb4f,null));};exports['show']=function(_0x768856,_0x3b8437){var _0xc77676={'raw':!![],'where':{'id':_0x768856[_0xdbc9('0x44')]['id']}},_0x41f56a={};_0x41f56a[_0xdbc9('0x2e')]=_[_0xdbc9('0x31')](db[_0xdbc9('0x41')][_0xdbc9('0x2a')]);_0x41f56a[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x768856['query']);_0x41f56a['filters']=_[_0xdbc9('0x33')](_0x41f56a[_0xdbc9('0x2e')],_0x41f56a[_0xdbc9('0x30')]);_0xc77676[_0xdbc9('0x34')]=_[_0xdbc9('0x33')](_0x41f56a[_0xdbc9('0x2e')],qs[_0xdbc9('0x45')](_0x768856[_0xdbc9('0x30')]['fields']));_0xc77676['attributes']=_0xc77676[_0xdbc9('0x34')][_0xdbc9('0x35')]?_0xc77676[_0xdbc9('0x34')]:_0x41f56a[_0xdbc9('0x2e')];if(_0x768856[_0xdbc9('0x30')][_0xdbc9('0x46')]){_0xc77676[_0xdbc9('0x40')]=[{'all':!![]}];}_0xc77676=_[_0xdbc9('0x3d')]({},_0xc77676,_0x768856[_0xdbc9('0x3f')]);return db['VoiceMail'][_0xdbc9('0x47')](_0xc77676)[_0xdbc9('0x26')](handleEntityNotFound(_0x3b8437,null))['then'](respondWithResult(_0x3b8437,null))['catch'](handleError(_0x3b8437,null));};exports[_0xdbc9('0x48')]=function(_0xc3db3c,_0x133a13){return db['VoiceMail'][_0xdbc9('0x48')](_0xc3db3c[_0xdbc9('0x49')],{})[_0xdbc9('0x26')](function(_0x274607){var _0x5aee83=_0xc3db3c[_0xdbc9('0x4a')][_0xdbc9('0x27')]({'plain':!![]});if(!_0x5aee83)throw new Error(_0xdbc9('0x4b'));if(_0x5aee83[_0xdbc9('0x4c')]==='user'){var _0x3e89f5=_0x274607[_0xdbc9('0x27')]({'plain':!![]});var _0x3f49b7=_0xdbc9('0x4d');return db[_0xdbc9('0x4e')][_0xdbc9('0x47')]({'where':{'name':_0x3f49b7,'userProfileId':_0x5aee83[_0xdbc9('0x4f')]},'raw':!![]})[_0xdbc9('0x26')](function(_0x4b34dd){if(_0x4b34dd&&_0x4b34dd[_0xdbc9('0x50')]===0x0){return db['UserProfileResource'][_0xdbc9('0x48')]({'name':_0x3e89f5[_0xdbc9('0x3e')],'resourceId':_0x3e89f5['id'],'type':_0x4b34dd['name'],'sectionId':_0x4b34dd['id']},{})['then'](function(){return _0x274607;});}else{return _0x274607;}})[_0xdbc9('0x51')](function(_0x4b55df){logger[_0xdbc9('0x52')](_0xdbc9('0x53'),_0x4b55df);throw _0x4b55df;});}return _0x274607;})[_0xdbc9('0x26')](respondWithResult(_0x133a13,0xc9))['catch'](handleError(_0x133a13,null));};exports[_0xdbc9('0x24')]=function(_0x1c52e6,_0x3d8b01){if(_0x1c52e6[_0xdbc9('0x49')]['id']){delete _0x1c52e6[_0xdbc9('0x49')]['id'];}return db[_0xdbc9('0x41')][_0xdbc9('0x47')]({'where':{'id':_0x1c52e6[_0xdbc9('0x44')]['id']}})['then'](handleEntityNotFound(_0x3d8b01,null))['then'](saveUpdates(_0x1c52e6['body'],null))[_0xdbc9('0x26')](respondWithResult(_0x3d8b01,null))[_0xdbc9('0x51')](handleError(_0x3d8b01,null));};exports[_0xdbc9('0x25')]=function(_0x55d8ba,_0x519ac9){return db[_0xdbc9('0x41')][_0xdbc9('0x47')]({'where':{'id':_0x55d8ba['params']['id']}})['then'](handleEntityNotFound(_0x519ac9,null))[_0xdbc9('0x26')](removeEntity(_0x519ac9,null))[_0xdbc9('0x51')](handleError(_0x519ac9,null));};exports[_0xdbc9('0x54')]=function(_0x2f90a8,_0x3021be,_0x1f52bb){return db['VoiceMail'][_0xdbc9('0x55')]({'where':{'id':_0x2f90a8[_0xdbc9('0x44')]['id']}})[_0xdbc9('0x26')](handleEntityNotFound(_0x3021be,null))['then'](function(_0x189d8a){var _0x14ccb4;var _0x1819fa={},_0x57b4ab={};_0x57b4ab[_0xdbc9('0x2e')]=_['keys'](db[_0xdbc9('0x56')][_0xdbc9('0x2a')]);_0x57b4ab[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x2f90a8[_0xdbc9('0x30')]);_0x57b4ab[_0xdbc9('0x32')]=_['intersection'](_0x57b4ab[_0xdbc9('0x2e')],_0x57b4ab['query']);_0x1819fa[_0xdbc9('0x34')]=_[_0xdbc9('0x33')](_0x57b4ab['model'],qs[_0xdbc9('0x45')](_0x2f90a8[_0xdbc9('0x30')]['fields']));_0x1819fa['attributes']=_0x1819fa[_0xdbc9('0x34')][_0xdbc9('0x35')]?_0x1819fa[_0xdbc9('0x34')]:_0x57b4ab['model'];if(!_0x2f90a8[_0xdbc9('0x30')][_0xdbc9('0x36')]('nolimit')){_0x1819fa[_0xdbc9('0x1e')]=qs[_0xdbc9('0x1e')](_0x2f90a8['query']['limit']);_0x1819fa[_0xdbc9('0x20')]=qs[_0xdbc9('0x20')](_0x2f90a8[_0xdbc9('0x30')][_0xdbc9('0x20')]);}_0x1819fa[_0xdbc9('0x38')]=qs[_0xdbc9('0x39')](_0x2f90a8[_0xdbc9('0x30')][_0xdbc9('0x39')]);_0x1819fa['where']=qs[_0xdbc9('0x32')](_[_0xdbc9('0x3a')](_0x2f90a8[_0xdbc9('0x30')],_0x57b4ab[_0xdbc9('0x32')]));if(_0x2f90a8[_0xdbc9('0x30')][_0xdbc9('0x3b')]){_0x1819fa[_0xdbc9('0x3c')]=_[_0xdbc9('0x3d')](_0x1819fa['where'],{'$or':_[_0xdbc9('0x2f')](_0x1819fa['attributes'],function(_0x2678b2){var _0x4c5207={};_0x4c5207[_0x2678b2]={'$like':'%'+_0x2f90a8[_0xdbc9('0x30')][_0xdbc9('0x3b')]+'%'};return _0x4c5207;})});}_0x1819fa['where']=_['merge'](_0x1819fa['where'],{'mailboxuser':_0x189d8a[_0xdbc9('0x57')]});_0x1819fa=_[_0xdbc9('0x3d')]({},_0x1819fa,_0x2f90a8[_0xdbc9('0x3f')]);return db['VoiceMailMessage'][_0xdbc9('0x58')](_0x1819fa)[_0xdbc9('0x26')](respondWithFilteredResult(_0x3021be,_0x1819fa));})[_0xdbc9('0x51')](handleError(_0x3021be,null));}; \ No newline at end of file +var _0x9ffd=['moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','apply','update','then','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMail','includeAll','include','findAll','rows','catch','params','find','create','user','get','Voicemails','UserProfileSection','userProfileId','autoAssociation','body','destroy','getMessages','findOne','VoiceMailMessage','order','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','request-promise'];(function(_0x47866c,_0x412515){var _0x6c382e=function(_0x59a34e){while(--_0x59a34e){_0x47866c['push'](_0x47866c['shift']());}};_0x6c382e(++_0x412515);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x5b3dc6,_0x1360d3){_0x5b3dc6=_0x5b3dc6-0x0;var _0x573067=_0x9ffd[_0x5b3dc6];return _0x573067;};'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 hardwareService=require(_0xd9ff('0x13'));var logger=require(_0xd9ff('0x14'))(_0xd9ff('0x15'));var utils=require(_0xd9ff('0x16'));var config=require(_0xd9ff('0x17'));var licenseUtil=require(_0xd9ff('0x18'));var db=require(_0xd9ff('0x19'))['db'];function respondWithStatusCode(_0x47d842,_0x47b0d7){_0x47b0d7=_0x47b0d7||0xcc;return function(_0xaaf7af){if(_0xaaf7af){return _0x47d842[_0xd9ff('0x1a')](_0x47b0d7);}return _0x47d842[_0xd9ff('0x1b')](_0x47b0d7)[_0xd9ff('0x1c')]();};}function respondWithResult(_0x12c39a,_0x556aa4){_0x556aa4=_0x556aa4||0xc8;return function(_0x2f78c1){if(_0x2f78c1){return _0x12c39a[_0xd9ff('0x1b')](_0x556aa4)['json'](_0x2f78c1);}};}function respondWithFilteredResult(_0xf14c9f,_0x5db010){return function(_0x4ffe54){if(_0x4ffe54){var _0x547e28=typeof _0x5db010['offset']===_0xd9ff('0x1d')&&typeof _0x5db010['limit']===_0xd9ff('0x1d');var _0xa30fd2=_0x4ffe54[_0xd9ff('0x1e')];var _0x3afd19=_0x547e28?0x0:_0x5db010[_0xd9ff('0x1f')];var _0x2d4df1=_0x547e28?_0x4ffe54[_0xd9ff('0x1e')]:_0x5db010[_0xd9ff('0x1f')]+_0x5db010[_0xd9ff('0x20')];var _0x1f028f;if(_0x2d4df1>=_0xa30fd2){_0x2d4df1=_0xa30fd2;_0x1f028f=0xc8;}else{_0x1f028f=0xce;}_0xf14c9f[_0xd9ff('0x1b')](_0x1f028f);return _0xf14c9f[_0xd9ff('0x21')](_0xd9ff('0x22'),_0x3afd19+'-'+_0x2d4df1+'/'+_0xa30fd2)['json'](_0x4ffe54);}return null;};}function patchUpdates(_0x4cf8ec){return function(_0x264a3d){try{jsonpatch[_0xd9ff('0x23')](_0x264a3d,_0x4cf8ec,!![]);}catch(_0x4eea4d){return BPromise['reject'](_0x4eea4d);}return _0x264a3d['save']();};}function saveUpdates(_0x4b1477,_0x1f4d9e){return function(_0x58eb5f){if(_0x58eb5f){return _0x58eb5f[_0xd9ff('0x24')](_0x4b1477)[_0xd9ff('0x25')](function(_0x291f52){return _0x291f52;});}return null;};}function removeEntity(_0x9f074e,_0x278b66){return function(_0x42a828){if(_0x42a828){return _0x42a828['destroy']()['then'](function(){var _0x1136e9=_0x42a828['get']({'plain':!![]});var _0x3ca906='Voicemails';return db[_0xd9ff('0x26')]['destroy']({'where':{'type':_0x3ca906,'resourceId':_0x1136e9['id']}})[_0xd9ff('0x25')](function(){return _0x42a828;});})[_0xd9ff('0x25')](function(){_0x9f074e[_0xd9ff('0x1b')](0xcc)[_0xd9ff('0x1c')]();});}};}function handleEntityNotFound(_0x5d685e,_0x11a17b){return function(_0xe11f88){if(!_0xe11f88){_0x5d685e[_0xd9ff('0x1a')](0x194);}return _0xe11f88;};}function handleError(_0x4390f7,_0x5c1c1f){_0x5c1c1f=_0x5c1c1f||0x1f4;return function(_0x1d3684){logger[_0xd9ff('0x27')](_0x1d3684[_0xd9ff('0x28')]);if(_0x1d3684[_0xd9ff('0x29')]){delete _0x1d3684[_0xd9ff('0x29')];}_0x4390f7[_0xd9ff('0x1b')](_0x5c1c1f)[_0xd9ff('0x2a')](_0x1d3684);};}exports[_0xd9ff('0x2b')]=function(_0x3dc443,_0x5706cf){var _0xcea5db={},_0x4ba2be={},_0x1d55fd={'count':0x0,'rows':[]};var _0x29c532=_[_0xd9ff('0x2c')](db['VoiceMail'][_0xd9ff('0x2d')],function(_0x3b26da){return{'name':_0x3b26da[_0xd9ff('0x2e')],'type':_0x3b26da[_0xd9ff('0x2f')]['key']};});_0x4ba2be[_0xd9ff('0x30')]=_['map'](_0x29c532,_0xd9ff('0x29'));_0x4ba2be[_0xd9ff('0x31')]=_[_0xd9ff('0x32')](_0x3dc443[_0xd9ff('0x31')]);_0x4ba2be[_0xd9ff('0x33')]=_[_0xd9ff('0x34')](_0x4ba2be[_0xd9ff('0x30')],_0x4ba2be[_0xd9ff('0x31')]);_0xcea5db[_0xd9ff('0x35')]=_[_0xd9ff('0x34')](_0x4ba2be[_0xd9ff('0x30')],qs[_0xd9ff('0x36')](_0x3dc443[_0xd9ff('0x31')][_0xd9ff('0x36')]));_0xcea5db['attributes']=_0xcea5db[_0xd9ff('0x35')][_0xd9ff('0x37')]?_0xcea5db[_0xd9ff('0x35')]:_0x4ba2be['model'];if(!_0x3dc443[_0xd9ff('0x31')]['hasOwnProperty'](_0xd9ff('0x38'))){_0xcea5db['limit']=qs[_0xd9ff('0x20')](_0x3dc443['query'][_0xd9ff('0x20')]);_0xcea5db[_0xd9ff('0x1f')]=qs[_0xd9ff('0x1f')](_0x3dc443['query']['offset']);}_0xcea5db['order']=qs[_0xd9ff('0x39')](_0x3dc443[_0xd9ff('0x31')][_0xd9ff('0x39')]);_0xcea5db[_0xd9ff('0x3a')]=qs[_0xd9ff('0x33')](_[_0xd9ff('0x3b')](_0x3dc443['query'],_0x4ba2be['filters']),_0x29c532);if(_0x3dc443['query'][_0xd9ff('0x3c')]){_0xcea5db[_0xd9ff('0x3a')]=_[_0xd9ff('0x3d')](_0xcea5db[_0xd9ff('0x3a')],{'$or':_['map'](_0x29c532,function(_0x2692c0){if(_0x2692c0['type']!==_0xd9ff('0x3e')){var _0x3e2beb={};_0x3e2beb[_0x2692c0[_0xd9ff('0x29')]]={'$like':'%'+_0x3dc443[_0xd9ff('0x31')]['filter']+'%'};return _0x3e2beb;}})});}_0xcea5db=_[_0xd9ff('0x3d')]({},_0xcea5db,_0x3dc443[_0xd9ff('0x3f')]);var _0x4961a7={'where':_0xcea5db[_0xd9ff('0x3a')]};return db[_0xd9ff('0x40')][_0xd9ff('0x1e')](_0x4961a7)[_0xd9ff('0x25')](function(_0x1fe44d){_0x1d55fd[_0xd9ff('0x1e')]=_0x1fe44d;if(_0x3dc443['query'][_0xd9ff('0x41')]){_0xcea5db[_0xd9ff('0x42')]=[{'all':!![]}];}return db[_0xd9ff('0x40')][_0xd9ff('0x43')](_0xcea5db);})[_0xd9ff('0x25')](function(_0x52aab8){_0x1d55fd[_0xd9ff('0x44')]=_0x52aab8;return _0x1d55fd;})[_0xd9ff('0x25')](respondWithFilteredResult(_0x5706cf,_0xcea5db))[_0xd9ff('0x45')](handleError(_0x5706cf,null));};exports['show']=function(_0x5d06dd,_0x36843b){var _0x7eb1a={'raw':!![],'where':{'id':_0x5d06dd[_0xd9ff('0x46')]['id']}},_0x18d1c4={};_0x18d1c4[_0xd9ff('0x30')]=_[_0xd9ff('0x32')](db['VoiceMail'][_0xd9ff('0x2d')]);_0x18d1c4[_0xd9ff('0x31')]=_['keys'](_0x5d06dd[_0xd9ff('0x31')]);_0x18d1c4[_0xd9ff('0x33')]=_[_0xd9ff('0x34')](_0x18d1c4[_0xd9ff('0x30')],_0x18d1c4[_0xd9ff('0x31')]);_0x7eb1a['attributes']=_['intersection'](_0x18d1c4['model'],qs[_0xd9ff('0x36')](_0x5d06dd['query'][_0xd9ff('0x36')]));_0x7eb1a[_0xd9ff('0x35')]=_0x7eb1a[_0xd9ff('0x35')]['length']?_0x7eb1a[_0xd9ff('0x35')]:_0x18d1c4[_0xd9ff('0x30')];if(_0x5d06dd['query'][_0xd9ff('0x41')]){_0x7eb1a[_0xd9ff('0x42')]=[{'all':!![]}];}_0x7eb1a=_[_0xd9ff('0x3d')]({},_0x7eb1a,_0x5d06dd[_0xd9ff('0x3f')]);return db['VoiceMail'][_0xd9ff('0x47')](_0x7eb1a)['then'](handleEntityNotFound(_0x36843b,null))[_0xd9ff('0x25')](respondWithResult(_0x36843b,null))['catch'](handleError(_0x36843b,null));};exports[_0xd9ff('0x48')]=function(_0x3d91e6,_0x2bf37a){return db[_0xd9ff('0x40')][_0xd9ff('0x48')](_0x3d91e6['body'],{})[_0xd9ff('0x25')](function(_0x3d6f11){var _0x2fbe53=_0x3d91e6[_0xd9ff('0x49')]['get']({'plain':!![]});if(!_0x2fbe53)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2fbe53['role']===_0xd9ff('0x49')){var _0x40be56=_0x3d6f11[_0xd9ff('0x4a')]({'plain':!![]});var _0x572618=_0xd9ff('0x4b');return db[_0xd9ff('0x4c')][_0xd9ff('0x47')]({'where':{'name':_0x572618,'userProfileId':_0x2fbe53[_0xd9ff('0x4d')]},'raw':!![]})[_0xd9ff('0x25')](function(_0x40d391){if(_0x40d391&&_0x40d391[_0xd9ff('0x4e')]===0x0){return db[_0xd9ff('0x26')][_0xd9ff('0x48')]({'name':_0x40be56[_0xd9ff('0x29')],'resourceId':_0x40be56['id'],'type':_0x40d391[_0xd9ff('0x29')],'sectionId':_0x40d391['id']},{})[_0xd9ff('0x25')](function(){return _0x3d6f11;});}else{return _0x3d6f11;}})[_0xd9ff('0x45')](function(_0x487b07){logger[_0xd9ff('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x487b07);throw _0x487b07;});}return _0x3d6f11;})[_0xd9ff('0x25')](respondWithResult(_0x2bf37a,0xc9))['catch'](handleError(_0x2bf37a,null));};exports[_0xd9ff('0x24')]=function(_0x49623d,_0xc82610){if(_0x49623d['body']['id']){delete _0x49623d[_0xd9ff('0x4f')]['id'];}return db['VoiceMail'][_0xd9ff('0x47')]({'where':{'id':_0x49623d['params']['id']}})[_0xd9ff('0x25')](handleEntityNotFound(_0xc82610,null))['then'](saveUpdates(_0x49623d[_0xd9ff('0x4f')],null))[_0xd9ff('0x25')](respondWithResult(_0xc82610,null))[_0xd9ff('0x45')](handleError(_0xc82610,null));};exports[_0xd9ff('0x50')]=function(_0x4df17b,_0x8c136b){return db[_0xd9ff('0x40')][_0xd9ff('0x47')]({'where':{'id':_0x4df17b['params']['id']}})[_0xd9ff('0x25')](handleEntityNotFound(_0x8c136b,null))[_0xd9ff('0x25')](removeEntity(_0x8c136b,null))[_0xd9ff('0x45')](handleError(_0x8c136b,null));};exports[_0xd9ff('0x51')]=function(_0x11dd0c,_0x56e8e8,_0x27cc9e){return db[_0xd9ff('0x40')][_0xd9ff('0x52')]({'where':{'id':_0x11dd0c[_0xd9ff('0x46')]['id']}})[_0xd9ff('0x25')](handleEntityNotFound(_0x56e8e8,null))[_0xd9ff('0x25')](function(_0x458fd4){var _0x5bac6f;var _0x3be850={},_0x11251f={};_0x11251f['model']=_[_0xd9ff('0x32')](db[_0xd9ff('0x53')]['rawAttributes']);_0x11251f[_0xd9ff('0x31')]=_[_0xd9ff('0x32')](_0x11dd0c[_0xd9ff('0x31')]);_0x11251f['filters']=_['intersection'](_0x11251f[_0xd9ff('0x30')],_0x11251f['query']);_0x3be850[_0xd9ff('0x35')]=_[_0xd9ff('0x34')](_0x11251f[_0xd9ff('0x30')],qs[_0xd9ff('0x36')](_0x11dd0c['query']['fields']));_0x3be850['attributes']=_0x3be850[_0xd9ff('0x35')][_0xd9ff('0x37')]?_0x3be850[_0xd9ff('0x35')]:_0x11251f[_0xd9ff('0x30')];if(!_0x11dd0c[_0xd9ff('0x31')]['hasOwnProperty'](_0xd9ff('0x38'))){_0x3be850['limit']=qs[_0xd9ff('0x20')](_0x11dd0c[_0xd9ff('0x31')][_0xd9ff('0x20')]);_0x3be850[_0xd9ff('0x1f')]=qs[_0xd9ff('0x1f')](_0x11dd0c[_0xd9ff('0x31')][_0xd9ff('0x1f')]);}_0x3be850[_0xd9ff('0x54')]=qs['sort'](_0x11dd0c[_0xd9ff('0x31')][_0xd9ff('0x39')]);_0x3be850['where']=qs['filters'](_[_0xd9ff('0x3b')](_0x11dd0c['query'],_0x11251f[_0xd9ff('0x33')]));if(_0x11dd0c[_0xd9ff('0x31')]['filter']){_0x3be850[_0xd9ff('0x3a')]=_[_0xd9ff('0x3d')](_0x3be850[_0xd9ff('0x3a')],{'$or':_[_0xd9ff('0x2c')](_0x3be850[_0xd9ff('0x35')],function(_0x49c5fa){var _0x12a8d7={};_0x12a8d7[_0x49c5fa]={'$like':'%'+_0x11dd0c['query']['filter']+'%'};return _0x12a8d7;})});}_0x3be850[_0xd9ff('0x3a')]=_[_0xd9ff('0x3d')](_0x3be850[_0xd9ff('0x3a')],{'mailboxuser':_0x458fd4[_0xd9ff('0x55')]});_0x3be850=_['merge']({},_0x3be850,_0x11dd0c[_0xd9ff('0x3f')]);return db[_0xd9ff('0x53')][_0xd9ff('0x56')](_0x3be850)[_0xd9ff('0x25')](respondWithFilteredResult(_0x56e8e8,_0x3be850));})[_0xd9ff('0x45')](handleError(_0x56e8e8,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 4f7d601..260a9e7 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 _0x1238=['moment','bluebird','request-promise','path','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util','api'];(function(_0x4f5226,_0x518f6c){var _0x42fdd5=function(_0x565397){while(--_0x565397){_0x4f5226['push'](_0x4f5226['shift']());}};_0x42fdd5(++_0x518f6c);}(_0x1238,0x1ec));var _0x8123=function(_0x16b77e,_0x4a56a3){_0x16b77e=_0x16b77e-0x0;var _0x3ae284=_0x1238[_0x16b77e];return _0x3ae284;};'use strict';var _=require(_0x8123('0x0'));var util=require(_0x8123('0x1'));var logger=require('../../config/logger')(_0x8123('0x2'));var moment=require(_0x8123('0x3'));var BPromise=require(_0x8123('0x4'));var rp=require(_0x8123('0x5'));var fs=require('fs');var path=require(_0x8123('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8123('0x7'));module[_0x8123('0x8')]=function(_0x1584fe,_0x462de7){return _0x1584fe[_0x8123('0x9')](_0x8123('0xa'),attributes,{'tableName':_0x8123('0xb'),'paranoid':![],'indexes':[{'name':_0x8123('0xc'),'fields':[_0x8123('0xd'),_0x8123('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2660=['moment','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','util','../../config/logger','api'];(function(_0x399199,_0x4844ee){var _0x2115c7=function(_0x456377){while(--_0x456377){_0x399199['push'](_0x399199['shift']());}};_0x2115c7(++_0x4844ee);}(_0x2660,0x6d));var _0x0266=function(_0x406115,_0x19f7a1){_0x406115=_0x406115-0x0;var _0xbbabdb=_0x2660[_0x406115];return _0xbbabdb;};'use strict';var _=require('lodash');var util=require(_0x0266('0x0'));var logger=require(_0x0266('0x1'))(_0x0266('0x2'));var moment=require(_0x0266('0x3'));var BPromise=require('bluebird');var rp=require(_0x0266('0x4'));var fs=require('fs');var path=require(_0x0266('0x5'));var rimraf=require(_0x0266('0x6'));var config=require(_0x0266('0x7'));var attributes=require(_0x0266('0x8'));module[_0x0266('0x9')]=function(_0x5c1ea3,_0x3d2f54){return _0x5c1ea3[_0x0266('0xa')](_0x0266('0xb'),attributes,{'tableName':_0x0266('0xc'),'paranoid':![],'indexes':[{'name':_0x0266('0xd'),'fields':[_0x0266('0xe'),_0x0266('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 257b908..0400821 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 _0x5139=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util'];(function(_0x30cbb9,_0x226d5d){var _0x52be29=function(_0x1e805d){while(--_0x1e805d){_0x30cbb9['push'](_0x30cbb9['shift']());}};_0x52be29(++_0x226d5d);}(_0x5139,0xe4));var _0x9513=function(_0x10655d,_0x4fa617){_0x10655d=_0x10655d-0x0;var _0x517ad6=_0x5139[_0x10655d];return _0x517ad6;};'use strict';var _=require(_0x9513('0x0'));var util=require(_0x9513('0x1'));var moment=require(_0x9513('0x2'));var BPromise=require(_0x9513('0x3'));var rs=require(_0x9513('0x4'));var fs=require('fs');var Redis=require(_0x9513('0x5'));var db=require(_0x9513('0x6'))['db'];var utils=require(_0x9513('0x7'));var logger=require('../../config/logger')(_0x9513('0x8'));var config=require(_0x9513('0x9'));var jayson=require(_0x9513('0xa'));var client=jayson[_0x9513('0xb')][_0x9513('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d16d1,_0x40b9d8,_0x1d369c){return new BPromise(function(_0x51d956,_0x27b6af){return client[_0x9513('0xd')](_0x2d16d1,_0x1d369c)[_0x9513('0xe')](function(_0x4e180d){logger[_0x9513('0xf')](_0x9513('0x10'),_0x40b9d8,_0x9513('0x11'));logger['debug']('VoiceMail,\x20%s,\x20%s,\x20%s',_0x40b9d8,'request\x20sent',JSON['stringify'](_0x4e180d));if(_0x4e180d[_0x9513('0x12')]){if(_0x4e180d[_0x9513('0x12')][_0x9513('0x13')]===0x1f4){logger['error'](_0x9513('0x10'),_0x40b9d8,_0x4e180d['error'][_0x9513('0x14')]);return _0x27b6af(_0x4e180d[_0x9513('0x12')][_0x9513('0x14')]);}logger['error'](_0x9513('0x10'),_0x40b9d8,_0x4e180d[_0x9513('0x12')]['message']);return _0x51d956(_0x4e180d['error'][_0x9513('0x14')]);}else{logger[_0x9513('0xf')]('VoiceMail,\x20%s,\x20%s',_0x40b9d8,_0x9513('0x11'));_0x51d956(_0x4e180d[_0x9513('0x15')][_0x9513('0x14')]);}})[_0x9513('0x16')](function(_0x23e5f8){logger[_0x9513('0x12')](_0x9513('0x10'),_0x40b9d8,_0x23e5f8);_0x27b6af(_0x23e5f8);});});} \ No newline at end of file +var _0x9a26=['debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','info','VoiceMail,\x20%s,\x20%s','request\x20sent'];(function(_0x5a435c,_0x455012){var _0x31a14f=function(_0xa6ffcd){while(--_0xa6ffcd){_0x5a435c['push'](_0x5a435c['shift']());}};_0x31a14f(++_0x455012);}(_0x9a26,0x6b));var _0x69a2=function(_0x7ee7e8,_0xf44f8a){_0x7ee7e8=_0x7ee7e8-0x0;var _0x53ef4f=_0x9a26[_0x7ee7e8];return _0x53ef4f;};'use strict';var _=require(_0x69a2('0x0'));var util=require('util');var moment=require(_0x69a2('0x1'));var BPromise=require(_0x69a2('0x2'));var rs=require(_0x69a2('0x3'));var fs=require('fs');var Redis=require(_0x69a2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x69a2('0x5'));var logger=require('../../config/logger')(_0x69a2('0x6'));var config=require(_0x69a2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x69a2('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53daa4,_0x2fb776,_0x14abe6){return new BPromise(function(_0x71c52,_0x1e775e){return client[_0x69a2('0x9')](_0x53daa4,_0x14abe6)['then'](function(_0x4a8c6a){logger[_0x69a2('0xa')](_0x69a2('0xb'),_0x2fb776,_0x69a2('0xc'));logger[_0x69a2('0xd')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x2fb776,_0x69a2('0xc'),JSON[_0x69a2('0xe')](_0x4a8c6a));if(_0x4a8c6a[_0x69a2('0xf')]){if(_0x4a8c6a[_0x69a2('0xf')][_0x69a2('0x10')]===0x1f4){logger[_0x69a2('0xf')](_0x69a2('0xb'),_0x2fb776,_0x4a8c6a['error']['message']);return _0x1e775e(_0x4a8c6a['error'][_0x69a2('0x11')]);}logger[_0x69a2('0xf')](_0x69a2('0xb'),_0x2fb776,_0x4a8c6a[_0x69a2('0xf')][_0x69a2('0x11')]);return _0x71c52(_0x4a8c6a[_0x69a2('0xf')]['message']);}else{logger[_0x69a2('0xa')](_0x69a2('0xb'),_0x2fb776,_0x69a2('0xc'));_0x71c52(_0x4a8c6a[_0x69a2('0x12')]['message']);}})[_0x69a2('0x13')](function(_0x527397){logger[_0x69a2('0xf')](_0x69a2('0xb'),_0x2fb776,_0x527397);_0x1e775e(_0x527397);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index cc71b50..02c65fd 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 _0xf872=['util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','index','/:id','isAuthenticated','post','create','put','update','destroy','exports','multer'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xf872,0x1d3));var _0x2f87=function(_0x2ef44b,_0x553359){_0x2ef44b=_0x2ef44b-0x0;var _0x2405b9=_0xf872[_0x2ef44b];return _0x2405b9;};'use strict';var multer=require(_0x2f87('0x0'));var util=require(_0x2f87('0x1'));var path=require(_0x2f87('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x2f87('0x3'));var auth=require(_0x2f87('0x4'));var interaction=require(_0x2f87('0x5'));var config=require(_0x2f87('0x6'));var controller=require(_0x2f87('0x7'));router[_0x2f87('0x8')]('/',auth['isAuthenticated'](),controller[_0x2f87('0x9')]);router[_0x2f87('0x8')](_0x2f87('0xa'),auth[_0x2f87('0xb')](),controller['show']);router[_0x2f87('0x8')]('/:id/download',auth[_0x2f87('0xb')](),controller['download']);router[_0x2f87('0xc')]('/',auth[_0x2f87('0xb')](),controller[_0x2f87('0xd')]);router[_0x2f87('0xe')](_0x2f87('0xa'),auth[_0x2f87('0xb')](),controller[_0x2f87('0xf')]);router['delete']('/:id',auth[_0x2f87('0xb')](),controller[_0x2f87('0x10')]);module[_0x2f87('0x11')]=router; \ No newline at end of file +var _0xe108=['delete','exports','multer','path','Router','fs-extra','../../components/auth/service','./voiceMailMessage.controller','get','isAuthenticated','/:id','show','post','create','put','update'];(function(_0x4757c5,_0x1a2cc1){var _0x4a8bdb=function(_0x5ba2c1){while(--_0x5ba2c1){_0x4757c5['push'](_0x4757c5['shift']());}};_0x4a8bdb(++_0x1a2cc1);}(_0xe108,0xe2));var _0x8e10=function(_0x334444,_0x20403c){_0x334444=_0x334444-0x0;var _0x303741=_0xe108[_0x334444];return _0x303741;};'use strict';var multer=require(_0x8e10('0x0'));var util=require('util');var path=require(_0x8e10('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8e10('0x2')]();var fs_extra=require(_0x8e10('0x3'));var auth=require(_0x8e10('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8e10('0x5'));router[_0x8e10('0x6')]('/',auth[_0x8e10('0x7')](),controller['index']);router[_0x8e10('0x6')](_0x8e10('0x8'),auth['isAuthenticated'](),controller[_0x8e10('0x9')]);router[_0x8e10('0x6')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x8e10('0xa')]('/',auth[_0x8e10('0x7')](),controller[_0x8e10('0xb')]);router[_0x8e10('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x8e10('0xd')]);router[_0x8e10('0xe')](_0x8e10('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x8e10('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 1c516a8..c0edbf0 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 _0x7eed=['exports','getDataValue','STRING','BLOB','long','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0x7eed,0x187));var _0xd7ee=function(_0x7be910,_0x2b381b){_0x7be910=_0x7be910-0x0;var _0x496ddf=_0x7eed[_0x7be910];return _0x496ddf;};'use strict';var Sequelize=require(_0xd7ee('0x0'));module[_0xd7ee('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1aa9a8){return this[_0xd7ee('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xd7ee('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0xd7ee('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xd7ee('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0xd7ee('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0xd7ee('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xd7ee('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0xd7ee('0x4')](_0xd7ee('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0xd7ee('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xd7ee('0x6'),'defaultValue':Sequelize['literal'](_0xd7ee('0x7'))}}; \ No newline at end of file +var _0xd36e=['TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','STRING','long'];(function(_0x3f2d02,_0x2c7deb){var _0x54092b=function(_0x427ff8){while(--_0x427ff8){_0x3f2d02['push'](_0x3f2d02['shift']());}};_0x54092b(++_0x2c7deb);}(_0xd36e,0xd4));var _0xed36=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xd36e[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require('sequelize');module[_0xed36('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x4724d2){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xed36('0x1')],'defaultValue':''},'origtime':{'type':Sequelize[_0xed36('0x1')],'defaultValue':''},'duration':{'type':Sequelize[_0xed36('0x1')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xed36('0x1')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xed36('0x1')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xed36('0x2')),'defaultValue':null},'flag':{'type':Sequelize[_0xed36('0x1')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xed36('0x1')],'defaultValue':''},'stamp':{'type':_0xed36('0x3'),'defaultValue':Sequelize['literal'](_0xed36('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 888f58e..6248efb 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 _0x29ce=['fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','then','destroy','stack','name','send','VoiceMailMessage','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','filter','includeAll','include','findAll','rows','show','params','keys','find','create','body','catch','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs'];(function(_0x1fab27,_0xbbdc3a){var _0x3c1382=function(_0xafdb67){while(--_0xafdb67){_0x1fab27['push'](_0x1fab27['shift']());}};_0x3c1382(++_0xbbdc3a);}(_0x29ce,0x181));var _0xe29c=function(_0x4e4d3,_0x4fa23d){_0x4e4d3=_0x4e4d3-0x0;var _0x299a7d=_0x29ce[_0x4e4d3];return _0x299a7d;};'use strict';var emlformat=require(_0xe29c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe29c('0x1'));var jsonpatch=require(_0xe29c('0x2'));var rp=require(_0xe29c('0x3'));var moment=require(_0xe29c('0x4'));var BPromise=require(_0xe29c('0x5'));var Mustache=require('mustache');var util=require(_0xe29c('0x6'));var path=require('path');var sox=require(_0xe29c('0x7'));var csv=require(_0xe29c('0x8'));var ejs=require(_0xe29c('0x9'));var fs=require('fs');var fs_extra=require(_0xe29c('0xa'));var _=require('lodash');var squel=require(_0xe29c('0xb'));var crypto=require('crypto');var jsforce=require(_0xe29c('0xc'));var deskjs=require(_0xe29c('0xd'));var toCsv=require(_0xe29c('0x8'));var querystring=require('querystring');var Papa=require(_0xe29c('0xe'));var Redis=require(_0xe29c('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe29c('0x10'));var hardwareService=require(_0xe29c('0x11'));var logger=require(_0xe29c('0x12'))(_0xe29c('0x13'));var utils=require(_0xe29c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe29c('0x15'));var db=require(_0xe29c('0x16'))['db'];function respondWithStatusCode(_0x16db79,_0x564d69){_0x564d69=_0x564d69||0xcc;return function(_0xd0830b){if(_0xd0830b){return _0x16db79[_0xe29c('0x17')](_0x564d69);}return _0x16db79[_0xe29c('0x18')](_0x564d69)[_0xe29c('0x19')]();};}function respondWithResult(_0x40a582,_0x452388){_0x452388=_0x452388||0xc8;return function(_0x2c6757){if(_0x2c6757){return _0x40a582[_0xe29c('0x18')](_0x452388)[_0xe29c('0x1a')](_0x2c6757);}};}function respondWithFilteredResult(_0x316df7,_0x46ec6a){return function(_0x236d15){if(_0x236d15){var _0x33c2d3=typeof _0x46ec6a[_0xe29c('0x1b')]===_0xe29c('0x1c')&&typeof _0x46ec6a['limit']==='undefined';var _0x4f05af=_0x236d15[_0xe29c('0x1d')];var _0x472397=_0x33c2d3?0x0:_0x46ec6a[_0xe29c('0x1b')];var _0x234e9c=_0x33c2d3?_0x236d15['count']:_0x46ec6a[_0xe29c('0x1b')]+_0x46ec6a[_0xe29c('0x1e')];var _0x300f51;if(_0x234e9c>=_0x4f05af){_0x234e9c=_0x4f05af;_0x300f51=0xc8;}else{_0x300f51=0xce;}_0x316df7['status'](_0x300f51);return _0x316df7[_0xe29c('0x1f')]('Content-Range',_0x472397+'-'+_0x234e9c+'/'+_0x4f05af)[_0xe29c('0x1a')](_0x236d15);}return null;};}function patchUpdates(_0x4ac787){return function(_0x3ed2c6){try{jsonpatch[_0xe29c('0x20')](_0x3ed2c6,_0x4ac787,!![]);}catch(_0xfba69d){return BPromise[_0xe29c('0x21')](_0xfba69d);}return _0x3ed2c6[_0xe29c('0x22')]();};}function saveUpdates(_0x450088,_0x3aebbf){return function(_0x9f13f){if(_0x9f13f){return _0x9f13f['update'](_0x450088)[_0xe29c('0x23')](function(_0x276a51){return _0x276a51;});}return null;};}function removeEntity(_0x1b192c,_0x2154c8){return function(_0x42d149){if(_0x42d149){return _0x42d149[_0xe29c('0x24')]()['then'](function(){_0x1b192c['status'](0xcc)[_0xe29c('0x19')]();});}};}function handleEntityNotFound(_0x588e2f,_0x29b6a2){return function(_0x25fdf8){if(!_0x25fdf8){_0x588e2f[_0xe29c('0x17')](0x194);}return _0x25fdf8;};}function handleError(_0x2d9085,_0x2f015d){_0x2f015d=_0x2f015d||0x1f4;return function(_0x21e97c){logger['error'](_0x21e97c[_0xe29c('0x25')]);if(_0x21e97c[_0xe29c('0x26')]){delete _0x21e97c[_0xe29c('0x26')];}_0x2d9085['status'](_0x2f015d)[_0xe29c('0x27')](_0x21e97c);};}exports['index']=function(_0x4fbf34,_0x5b977c){var _0x15d59a={},_0x1c7b3e={},_0x475804={'count':0x0,'rows':[]};var _0x3f74cd=_['map'](db[_0xe29c('0x28')][_0xe29c('0x29')],function(_0x521801){return{'name':_0x521801[_0xe29c('0x2a')],'type':_0x521801[_0xe29c('0x2b')][_0xe29c('0x2c')]};});_0x1c7b3e[_0xe29c('0x2d')]=_['differenceBy'](_[_0xe29c('0x2e')](_0x3f74cd,'name'),[_0xe29c('0x26')]);_0x1c7b3e[_0xe29c('0x2f')]=_['keys'](_0x4fbf34[_0xe29c('0x2f')]);_0x1c7b3e[_0xe29c('0x30')]=_[_0xe29c('0x31')](_0x1c7b3e[_0xe29c('0x2d')],_0x1c7b3e[_0xe29c('0x2f')]);_0x15d59a['attributes']=_[_0xe29c('0x31')](_0x1c7b3e[_0xe29c('0x2d')],qs[_0xe29c('0x32')](_0x4fbf34[_0xe29c('0x2f')][_0xe29c('0x32')]));_0x15d59a[_0xe29c('0x33')]=_0x15d59a['attributes'][_0xe29c('0x34')]?_0x15d59a[_0xe29c('0x33')]:_0x1c7b3e[_0xe29c('0x2d')];if(!_0x4fbf34[_0xe29c('0x2f')]['hasOwnProperty'](_0xe29c('0x35'))){_0x15d59a['limit']=qs[_0xe29c('0x1e')](_0x4fbf34[_0xe29c('0x2f')][_0xe29c('0x1e')]);_0x15d59a[_0xe29c('0x1b')]=qs['offset'](_0x4fbf34[_0xe29c('0x2f')]['offset']);}_0x15d59a[_0xe29c('0x36')]=qs[_0xe29c('0x37')](_0x4fbf34['query'][_0xe29c('0x37')]);_0x15d59a[_0xe29c('0x38')]=qs[_0xe29c('0x30')](_[_0xe29c('0x39')](_0x4fbf34[_0xe29c('0x2f')],_0x1c7b3e['filters']),_0x3f74cd);if(_0x4fbf34[_0xe29c('0x2f')]['filter']){_0x15d59a[_0xe29c('0x38')]=_[_0xe29c('0x3a')](_0x15d59a[_0xe29c('0x38')],{'$or':_[_0xe29c('0x2e')](_0x3f74cd,function(_0x2efc17){if(_0x2efc17[_0xe29c('0x2b')]!=='VIRTUAL'){var _0x48b786={};_0x48b786[_0x2efc17[_0xe29c('0x26')]]={'$like':'%'+_0x4fbf34[_0xe29c('0x2f')][_0xe29c('0x3b')]+'%'};return _0x48b786;}})});}_0x15d59a=_[_0xe29c('0x3a')]({},_0x15d59a,_0x4fbf34['options']);var _0x4a67e0={'where':_0x15d59a[_0xe29c('0x38')]};return db[_0xe29c('0x28')][_0xe29c('0x1d')](_0x4a67e0)[_0xe29c('0x23')](function(_0x561738){_0x475804[_0xe29c('0x1d')]=_0x561738;if(_0x4fbf34['query'][_0xe29c('0x3c')]){_0x15d59a[_0xe29c('0x3d')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0xe29c('0x3e')](_0x15d59a);})[_0xe29c('0x23')](function(_0x38bea4){_0x475804[_0xe29c('0x3f')]=_0x38bea4;return _0x475804;})['then'](respondWithFilteredResult(_0x5b977c,_0x15d59a))['catch'](handleError(_0x5b977c,null));};exports[_0xe29c('0x40')]=function(_0x143d3e,_0x568618){var _0x5d25d3={'raw':!![],'where':{'id':_0x143d3e[_0xe29c('0x41')]['id']}},_0x3431ba={};_0x3431ba[_0xe29c('0x2d')]=_[_0xe29c('0x42')](db[_0xe29c('0x28')]['rawAttributes']);_0x3431ba[_0xe29c('0x2f')]=_[_0xe29c('0x42')](_0x143d3e['query']);_0x3431ba[_0xe29c('0x30')]=_[_0xe29c('0x31')](_0x3431ba['model'],_0x3431ba[_0xe29c('0x2f')]);_0x5d25d3[_0xe29c('0x33')]=_[_0xe29c('0x31')](_0x3431ba[_0xe29c('0x2d')],qs[_0xe29c('0x32')](_0x143d3e[_0xe29c('0x2f')][_0xe29c('0x32')]));_0x5d25d3[_0xe29c('0x33')]=_0x5d25d3[_0xe29c('0x33')][_0xe29c('0x34')]?_0x5d25d3[_0xe29c('0x33')]:_0x3431ba[_0xe29c('0x2d')];if(_0x143d3e['query']['includeAll']){_0x5d25d3['include']=[{'all':!![]}];}_0x5d25d3=_[_0xe29c('0x3a')]({},_0x5d25d3,_0x143d3e['options']);return db['VoiceMailMessage'][_0xe29c('0x43')](_0x5d25d3)['then'](handleEntityNotFound(_0x568618,null))['then'](respondWithResult(_0x568618,null))['catch'](handleError(_0x568618,null));};exports['create']=function(_0x544510,_0x48a2cb){return db[_0xe29c('0x28')][_0xe29c('0x44')](_0x544510[_0xe29c('0x45')],{})[_0xe29c('0x23')](respondWithResult(_0x48a2cb,0xc9))['catch'](handleError(_0x48a2cb,null));};exports['update']=function(_0x1f9a02,_0x19754f){if(_0x1f9a02[_0xe29c('0x45')]['id']){delete _0x1f9a02[_0xe29c('0x45')]['id'];}return db[_0xe29c('0x28')]['find']({'where':{'id':_0x1f9a02[_0xe29c('0x41')]['id']}})[_0xe29c('0x23')](handleEntityNotFound(_0x19754f,null))[_0xe29c('0x23')](saveUpdates(_0x1f9a02[_0xe29c('0x45')],null))[_0xe29c('0x23')](respondWithResult(_0x19754f,null))[_0xe29c('0x46')](handleError(_0x19754f,null));};exports[_0xe29c('0x24')]=function(_0x4248af,_0x14705d){return db['VoiceMailMessage'][_0xe29c('0x43')]({'where':{'id':_0x4248af['params']['id']}})[_0xe29c('0x23')](handleEntityNotFound(_0x14705d,null))[_0xe29c('0x23')](removeEntity(_0x14705d,null))['catch'](handleError(_0x14705d,null));};exports['download']=function(_0x4a7ea1,_0x4ddc73,_0x5e7210){return db[_0xe29c('0x28')][_0xe29c('0x43')]({'where':{'id':_0x4a7ea1[_0xe29c('0x41')]['id']},'attributes':['id',_0xe29c('0x47'),'msg_id']})[_0xe29c('0x23')](handleEntityNotFound(_0x4ddc73,null))['then'](function(_0x5059a4){if(_0x5059a4){if(!_0x5059a4[_0xe29c('0x47')]){throw new db[(_0xe29c('0x48'))][(_0xe29c('0x49'))](_0xe29c('0x4a'));}var _0x3259e2={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x5059a4[_0xe29c('0x4b')]){_0x3259e2[_0xe29c('0x4c')]=_0xe29c('0x4d')+_0x5059a4[_0xe29c('0x4b')]+_0xe29c('0x4e');}_0x4ddc73[_0xe29c('0x1f')](_0x3259e2);return _0x4ddc73['send'](new Buffer(_0x5059a4[_0xe29c('0x47')]));}})[_0xe29c('0x46')](handleError(_0x4ddc73,null));}; \ No newline at end of file +var _0x97e8=['stack','name','map','VoiceMailMessage','rawAttributes','type','key','model','differenceBy','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','create','body','download','recording','msg_id','Sequelize','ValidationError','audio/wav','attachment','attachment;\x20filename=\x22','.wav\x22','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error'];(function(_0x1b91c7,_0x36cb81){var _0x354499=function(_0x52f7d3){while(--_0x52f7d3){_0x1b91c7['push'](_0x1b91c7['shift']());}};_0x354499(++_0x36cb81);}(_0x97e8,0x1d9));var _0x897e=function(_0xde38ba,_0x4f7cc9){_0xde38ba=_0xde38ba-0x0;var _0x25d984=_0x97e8[_0xde38ba];return _0x25d984;};'use strict';var emlformat=require(_0x897e('0x0'));var rimraf=require(_0x897e('0x1'));var zipdir=require(_0x897e('0x2'));var jsonpatch=require(_0x897e('0x3'));var rp=require(_0x897e('0x4'));var moment=require(_0x897e('0x5'));var BPromise=require(_0x897e('0x6'));var Mustache=require(_0x897e('0x7'));var util=require(_0x897e('0x8'));var path=require(_0x897e('0x9'));var sox=require(_0x897e('0xa'));var csv=require(_0x897e('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x897e('0xc'));var _=require(_0x897e('0xd'));var squel=require(_0x897e('0xe'));var crypto=require(_0x897e('0xf'));var jsforce=require(_0x897e('0x10'));var deskjs=require(_0x897e('0x11'));var toCsv=require(_0x897e('0xb'));var querystring=require(_0x897e('0x12'));var Papa=require(_0x897e('0x13'));var Redis=require('ioredis');var authService=require(_0x897e('0x14'));var qs=require(_0x897e('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x897e('0x16'));var logger=require('../../config/logger')(_0x897e('0x17'));var utils=require(_0x897e('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x897e('0x19'));var db=require(_0x897e('0x1a'))['db'];function respondWithStatusCode(_0x18bd64,_0x23c7e0){_0x23c7e0=_0x23c7e0||0xcc;return function(_0x431eed){if(_0x431eed){return _0x18bd64[_0x897e('0x1b')](_0x23c7e0);}return _0x18bd64[_0x897e('0x1c')](_0x23c7e0)[_0x897e('0x1d')]();};}function respondWithResult(_0x2a80ef,_0x538312){_0x538312=_0x538312||0xc8;return function(_0xfd76da){if(_0xfd76da){return _0x2a80ef[_0x897e('0x1c')](_0x538312)[_0x897e('0x1e')](_0xfd76da);}};}function respondWithFilteredResult(_0x37d9eb,_0x105aca){return function(_0x5cd9f0){if(_0x5cd9f0){var _0x8e62a1=typeof _0x105aca[_0x897e('0x1f')]===_0x897e('0x20')&&typeof _0x105aca[_0x897e('0x21')]===_0x897e('0x20');var _0x3219cf=_0x5cd9f0[_0x897e('0x22')];var _0x912a91=_0x8e62a1?0x0:_0x105aca[_0x897e('0x1f')];var _0x116931=_0x8e62a1?_0x5cd9f0['count']:_0x105aca[_0x897e('0x1f')]+_0x105aca[_0x897e('0x21')];var _0x2d1b15;if(_0x116931>=_0x3219cf){_0x116931=_0x3219cf;_0x2d1b15=0xc8;}else{_0x2d1b15=0xce;}_0x37d9eb[_0x897e('0x1c')](_0x2d1b15);return _0x37d9eb[_0x897e('0x23')]('Content-Range',_0x912a91+'-'+_0x116931+'/'+_0x3219cf)['json'](_0x5cd9f0);}return null;};}function patchUpdates(_0x47a005){return function(_0x5b836c){try{jsonpatch[_0x897e('0x24')](_0x5b836c,_0x47a005,!![]);}catch(_0x2ecf62){return BPromise[_0x897e('0x25')](_0x2ecf62);}return _0x5b836c[_0x897e('0x26')]();};}function saveUpdates(_0x35af13,_0x29b79c){return function(_0x4cb1b5){if(_0x4cb1b5){return _0x4cb1b5[_0x897e('0x27')](_0x35af13)[_0x897e('0x28')](function(_0x3930ef){return _0x3930ef;});}return null;};}function removeEntity(_0x34b28f,_0x1eab7e){return function(_0x514283){if(_0x514283){return _0x514283[_0x897e('0x29')]()['then'](function(){_0x34b28f[_0x897e('0x1c')](0xcc)[_0x897e('0x1d')]();});}};}function handleEntityNotFound(_0x50480a,_0x5afcd5){return function(_0x592825){if(!_0x592825){_0x50480a[_0x897e('0x1b')](0x194);}return _0x592825;};}function handleError(_0x6209af,_0x2897a9){_0x2897a9=_0x2897a9||0x1f4;return function(_0x1be66c){logger[_0x897e('0x2a')](_0x1be66c[_0x897e('0x2b')]);if(_0x1be66c[_0x897e('0x2c')]){delete _0x1be66c[_0x897e('0x2c')];}_0x6209af[_0x897e('0x1c')](_0x2897a9)['send'](_0x1be66c);};}exports['index']=function(_0x18c783,_0x521349){var _0xb2dc5e={},_0x1481bf={},_0xfe6080={'count':0x0,'rows':[]};var _0x2f5035=_[_0x897e('0x2d')](db[_0x897e('0x2e')][_0x897e('0x2f')],function(_0x25df74){return{'name':_0x25df74['fieldName'],'type':_0x25df74[_0x897e('0x30')][_0x897e('0x31')]};});_0x1481bf[_0x897e('0x32')]=_[_0x897e('0x33')](_['map'](_0x2f5035,_0x897e('0x2c')),['name']);_0x1481bf['query']=_[_0x897e('0x34')](_0x18c783[_0x897e('0x35')]);_0x1481bf[_0x897e('0x36')]=_[_0x897e('0x37')](_0x1481bf[_0x897e('0x32')],_0x1481bf[_0x897e('0x35')]);_0xb2dc5e[_0x897e('0x38')]=_[_0x897e('0x37')](_0x1481bf['model'],qs[_0x897e('0x39')](_0x18c783[_0x897e('0x35')]['fields']));_0xb2dc5e[_0x897e('0x38')]=_0xb2dc5e['attributes'][_0x897e('0x3a')]?_0xb2dc5e[_0x897e('0x38')]:_0x1481bf[_0x897e('0x32')];if(!_0x18c783[_0x897e('0x35')]['hasOwnProperty'](_0x897e('0x3b'))){_0xb2dc5e['limit']=qs[_0x897e('0x21')](_0x18c783[_0x897e('0x35')]['limit']);_0xb2dc5e[_0x897e('0x1f')]=qs[_0x897e('0x1f')](_0x18c783['query']['offset']);}_0xb2dc5e[_0x897e('0x3c')]=qs[_0x897e('0x3d')](_0x18c783[_0x897e('0x35')][_0x897e('0x3d')]);_0xb2dc5e[_0x897e('0x3e')]=qs['filters'](_[_0x897e('0x3f')](_0x18c783[_0x897e('0x35')],_0x1481bf['filters']),_0x2f5035);if(_0x18c783[_0x897e('0x35')]['filter']){_0xb2dc5e[_0x897e('0x3e')]=_[_0x897e('0x40')](_0xb2dc5e[_0x897e('0x3e')],{'$or':_[_0x897e('0x2d')](_0x2f5035,function(_0x5b7529){if(_0x5b7529[_0x897e('0x30')]!==_0x897e('0x41')){var _0x31c687={};_0x31c687[_0x5b7529['name']]={'$like':'%'+_0x18c783['query']['filter']+'%'};return _0x31c687;}})});}_0xb2dc5e=_[_0x897e('0x40')]({},_0xb2dc5e,_0x18c783[_0x897e('0x42')]);var _0x3fb45e={'where':_0xb2dc5e[_0x897e('0x3e')]};return db[_0x897e('0x2e')][_0x897e('0x22')](_0x3fb45e)[_0x897e('0x28')](function(_0x4881af){_0xfe6080[_0x897e('0x22')]=_0x4881af;if(_0x18c783[_0x897e('0x35')][_0x897e('0x43')]){_0xb2dc5e['include']=[{'all':!![]}];}return db[_0x897e('0x2e')][_0x897e('0x44')](_0xb2dc5e);})[_0x897e('0x28')](function(_0x320ff0){_0xfe6080['rows']=_0x320ff0;return _0xfe6080;})[_0x897e('0x28')](respondWithFilteredResult(_0x521349,_0xb2dc5e))[_0x897e('0x45')](handleError(_0x521349,null));};exports[_0x897e('0x46')]=function(_0x44b4c1,_0x4b1ca7){var _0x31c574={'raw':!![],'where':{'id':_0x44b4c1[_0x897e('0x47')]['id']}},_0x1f94d6={};_0x1f94d6[_0x897e('0x32')]=_[_0x897e('0x34')](db['VoiceMailMessage'][_0x897e('0x2f')]);_0x1f94d6['query']=_[_0x897e('0x34')](_0x44b4c1[_0x897e('0x35')]);_0x1f94d6['filters']=_[_0x897e('0x37')](_0x1f94d6[_0x897e('0x32')],_0x1f94d6[_0x897e('0x35')]);_0x31c574['attributes']=_['intersection'](_0x1f94d6['model'],qs['fields'](_0x44b4c1[_0x897e('0x35')]['fields']));_0x31c574[_0x897e('0x38')]=_0x31c574[_0x897e('0x38')]['length']?_0x31c574['attributes']:_0x1f94d6[_0x897e('0x32')];if(_0x44b4c1[_0x897e('0x35')]['includeAll']){_0x31c574[_0x897e('0x48')]=[{'all':!![]}];}_0x31c574=_[_0x897e('0x40')]({},_0x31c574,_0x44b4c1['options']);return db[_0x897e('0x2e')][_0x897e('0x49')](_0x31c574)[_0x897e('0x28')](handleEntityNotFound(_0x4b1ca7,null))[_0x897e('0x28')](respondWithResult(_0x4b1ca7,null))['catch'](handleError(_0x4b1ca7,null));};exports[_0x897e('0x4a')]=function(_0x25fd3d,_0x4f18a9){return db[_0x897e('0x2e')][_0x897e('0x4a')](_0x25fd3d['body'],{})[_0x897e('0x28')](respondWithResult(_0x4f18a9,0xc9))[_0x897e('0x45')](handleError(_0x4f18a9,null));};exports['update']=function(_0x4bea09,_0x3457c1){if(_0x4bea09['body']['id']){delete _0x4bea09[_0x897e('0x4b')]['id'];}return db['VoiceMailMessage'][_0x897e('0x49')]({'where':{'id':_0x4bea09[_0x897e('0x47')]['id']}})[_0x897e('0x28')](handleEntityNotFound(_0x3457c1,null))[_0x897e('0x28')](saveUpdates(_0x4bea09[_0x897e('0x4b')],null))[_0x897e('0x28')](respondWithResult(_0x3457c1,null))[_0x897e('0x45')](handleError(_0x3457c1,null));};exports[_0x897e('0x29')]=function(_0xc99523,_0x59f704){return db['VoiceMailMessage']['find']({'where':{'id':_0xc99523['params']['id']}})[_0x897e('0x28')](handleEntityNotFound(_0x59f704,null))[_0x897e('0x28')](removeEntity(_0x59f704,null))[_0x897e('0x45')](handleError(_0x59f704,null));};exports[_0x897e('0x4c')]=function(_0x276c51,_0x38f2f4,_0x3adb69){return db[_0x897e('0x2e')][_0x897e('0x49')]({'where':{'id':_0x276c51[_0x897e('0x47')]['id']},'attributes':['id',_0x897e('0x4d'),_0x897e('0x4e')]})[_0x897e('0x28')](handleEntityNotFound(_0x38f2f4,null))['then'](function(_0x27a101){if(_0x27a101){if(!_0x27a101[_0x897e('0x4d')]){throw new db[(_0x897e('0x4f'))][(_0x897e('0x50'))]('VoiceMailMessage\x20not\x20found');}var _0x18d9f4={'Content-Type':_0x897e('0x51'),'Content-Disposition':_0x897e('0x52')};if(_0x27a101[_0x897e('0x4e')]){_0x18d9f4['Content-Disposition']=_0x897e('0x53')+_0x27a101[_0x897e('0x4e')]+_0x897e('0x54');}_0x38f2f4[_0x897e('0x23')](_0x18d9f4);return _0x38f2f4[_0x897e('0x55')](new Buffer(_0x27a101[_0x897e('0x4d')]));}})['catch'](handleError(_0x38f2f4,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index b19f597..b668620 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 _0x1338=['dir','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages'];(function(_0x73a84b,_0x23d3bb){var _0x9e2a66=function(_0x2153dc){while(--_0x2153dc){_0x73a84b['push'](_0x73a84b['shift']());}};_0x9e2a66(++_0x23d3bb);}(_0x1338,0x189));var _0x8133=function(_0x3538ed,_0x221640){_0x3538ed=_0x3538ed-0x0;var _0x326f01=_0x1338[_0x3538ed];return _0x326f01;};'use strict';var _=require(_0x8133('0x0'));var util=require(_0x8133('0x1'));var logger=require('../../config/logger')(_0x8133('0x2'));var moment=require(_0x8133('0x3'));var BPromise=require(_0x8133('0x4'));var rp=require(_0x8133('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8133('0x6'));var config=require(_0x8133('0x7'));var attributes=require(_0x8133('0x8'));module[_0x8133('0x9')]=function(_0x4a56de,_0x159e43){return _0x4a56de[_0x8133('0xa')](_0x8133('0xb'),attributes,{'tableName':_0x8133('0xc'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x8133('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x47f9=['../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','api','bluebird','rimraf'];(function(_0x5ecff9,_0x473070){var _0x5e1415=function(_0x3c34a1){while(--_0x3c34a1){_0x5ecff9['push'](_0x5ecff9['shift']());}};_0x5e1415(++_0x473070);}(_0x47f9,0x19f));var _0x947f=function(_0x5db96a,_0x60039){_0x5db96a=_0x5db96a-0x0;var _0x13fdb0=_0x47f9[_0x5db96a];return _0x13fdb0;};'use strict';var _=require(_0x947f('0x0'));var util=require(_0x947f('0x1'));var logger=require('../../config/logger')(_0x947f('0x2'));var moment=require('moment');var BPromise=require(_0x947f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x947f('0x4'));var config=require(_0x947f('0x5'));var attributes=require(_0x947f('0x6'));module[_0x947f('0x7')]=function(_0x476d33,_0x3af612){return _0x476d33[_0x947f('0x8')](_0x947f('0x9'),attributes,{'tableName':_0x947f('0xa'),'paranoid':![],'indexes':[{'name':_0x947f('0xb'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 648ebd5..b9b76a1 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 _0x3121=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x528ef0,_0x64c128){var _0x563f6e=function(_0x472e69){while(--_0x472e69){_0x528ef0['push'](_0x528ef0['shift']());}};_0x563f6e(++_0x64c128);}(_0x3121,0x143));var _0x1312=function(_0x247ee0,_0x9807a5){_0x247ee0=_0x247ee0-0x0;var _0x4e86cc=_0x3121[_0x247ee0];return _0x4e86cc;};'use strict';var _=require(_0x1312('0x0'));var util=require(_0x1312('0x1'));var moment=require(_0x1312('0x2'));var BPromise=require(_0x1312('0x3'));var rs=require(_0x1312('0x4'));var fs=require('fs');var Redis=require(_0x1312('0x5'));var db=require(_0x1312('0x6'))['db'];var utils=require(_0x1312('0x7'));var logger=require(_0x1312('0x8'))('rpc');var config=require(_0x1312('0x9'));var jayson=require(_0x1312('0xa'));var client=jayson[_0x1312('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a45a2,_0x5d421f,_0x285cfe){return new BPromise(function(_0x3b9de6,_0x350329){return client['request'](_0x1a45a2,_0x285cfe)[_0x1312('0xc')](function(_0x397c32){logger[_0x1312('0xd')](_0x1312('0xe'),_0x5d421f,_0x1312('0xf'));logger[_0x1312('0x10')](_0x1312('0x11'),_0x5d421f,'request\x20sent',JSON[_0x1312('0x12')](_0x397c32));if(_0x397c32[_0x1312('0x13')]){if(_0x397c32['error'][_0x1312('0x14')]===0x1f4){logger[_0x1312('0x13')](_0x1312('0xe'),_0x5d421f,_0x397c32[_0x1312('0x13')][_0x1312('0x15')]);return _0x350329(_0x397c32[_0x1312('0x13')][_0x1312('0x15')]);}logger['error'](_0x1312('0xe'),_0x5d421f,_0x397c32[_0x1312('0x13')][_0x1312('0x15')]);return _0x3b9de6(_0x397c32[_0x1312('0x13')][_0x1312('0x15')]);}else{logger[_0x1312('0xd')]('VoiceMailMessage,\x20%s,\x20%s',_0x5d421f,_0x1312('0xf'));_0x3b9de6(_0x397c32[_0x1312('0x16')][_0x1312('0x15')]);}})['catch'](function(_0x55e419){logger['error'](_0x1312('0xe'),_0x5d421f,_0x55e419);_0x350329(_0x55e419);});});} \ No newline at end of file +var _0xb7ef=['catch','lodash','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','debug','stringify','error','code','message','info','result'];(function(_0x5d283b,_0x14d1de){var _0x3a7d42=function(_0x31ace6){while(--_0x31ace6){_0x5d283b['push'](_0x5d283b['shift']());}};_0x3a7d42(++_0x14d1de);}(_0xb7ef,0xd1));var _0xfb7e=function(_0x35bb80,_0x500d2b){_0x35bb80=_0x35bb80-0x0;var _0x386897=_0xb7ef[_0x35bb80];return _0x386897;};'use strict';var _=require(_0xfb7e('0x0'));var util=require(_0xfb7e('0x1'));var moment=require(_0xfb7e('0x2'));var BPromise=require(_0xfb7e('0x3'));var rs=require(_0xfb7e('0x4'));var fs=require('fs');var Redis=require(_0xfb7e('0x5'));var db=require(_0xfb7e('0x6'))['db'];var utils=require(_0xfb7e('0x7'));var logger=require(_0xfb7e('0x8'))(_0xfb7e('0x9'));var config=require(_0xfb7e('0xa'));var jayson=require(_0xfb7e('0xb'));var client=jayson[_0xfb7e('0xc')][_0xfb7e('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1d0776,_0xab3447,_0x400283){return new BPromise(function(_0x8ca386,_0x528a2b){return client[_0xfb7e('0xe')](_0x1d0776,_0x400283)[_0xfb7e('0xf')](function(_0x2b1928){logger['info'](_0xfb7e('0x10'),_0xab3447,_0xfb7e('0x11'));logger[_0xfb7e('0x12')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0xab3447,'request\x20sent',JSON[_0xfb7e('0x13')](_0x2b1928));if(_0x2b1928['error']){if(_0x2b1928[_0xfb7e('0x14')][_0xfb7e('0x15')]===0x1f4){logger['error'](_0xfb7e('0x10'),_0xab3447,_0x2b1928[_0xfb7e('0x14')][_0xfb7e('0x16')]);return _0x528a2b(_0x2b1928[_0xfb7e('0x14')][_0xfb7e('0x16')]);}logger['error'](_0xfb7e('0x10'),_0xab3447,_0x2b1928[_0xfb7e('0x14')][_0xfb7e('0x16')]);return _0x8ca386(_0x2b1928['error'][_0xfb7e('0x16')]);}else{logger[_0xfb7e('0x17')](_0xfb7e('0x10'),_0xab3447,_0xfb7e('0x11'));_0x8ca386(_0x2b1928[_0xfb7e('0x18')][_0xfb7e('0x16')]);}})[_0xfb7e('0x19')](function(_0x401a57){logger['error'](_0xfb7e('0x10'),_0xab3447,_0x401a57);_0x528a2b(_0x401a57);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 8baec3d..70e91db 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 _0xb876=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','index','show','/:id/sounds','isAuthenticated','getSounds','post','addSound','update','delete','destroy','/:id/sounds/:id2','path','connect-timeout','express'];(function(_0x103ece,_0x50019c){var _0x1635b9=function(_0x1be8f9){while(--_0x1be8f9){_0x103ece['push'](_0x103ece['shift']());}};_0x1635b9(++_0x50019c);}(_0xb876,0x10e));var _0x6b87=function(_0x1f7367,_0x2c635e){_0x1f7367=_0x1f7367-0x0;var _0x5e048f=_0xb876[_0x1f7367];return _0x5e048f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6b87('0x0'));var timeout=require(_0x6b87('0x1'));var express=require(_0x6b87('0x2'));var router=express[_0x6b87('0x3')]();var fs_extra=require(_0x6b87('0x4'));var auth=require(_0x6b87('0x5'));var interaction=require(_0x6b87('0x6'));var config=require(_0x6b87('0x7'));var controller=require(_0x6b87('0x8'));router[_0x6b87('0x9')]('/',auth['isAuthenticated'](),controller[_0x6b87('0xa')]);router[_0x6b87('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6b87('0xb')]);router[_0x6b87('0x9')](_0x6b87('0xc'),auth[_0x6b87('0xd')](),controller[_0x6b87('0xe')]);router[_0x6b87('0xf')]('/',auth[_0x6b87('0xd')](),controller['create']);router['post']('/:id/sounds',auth['isAuthenticated'](),controller[_0x6b87('0x10')]);router['put']('/:id',auth[_0x6b87('0xd')](),controller[_0x6b87('0x11')]);router[_0x6b87('0x12')]('/:id',auth[_0x6b87('0xd')](),controller[_0x6b87('0x13')]);router[_0x6b87('0x12')](_0x6b87('0x14'),auth[_0x6b87('0xd')](),controller['removeSound']);module['exports']=router; \ No newline at end of file +var _0x590e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','show','/:id/sounds','getSounds','post','create','addSound','update','delete','/:id','/:id/sounds/:id2','removeSound','exports','multer','util','path','express'];(function(_0x436849,_0x430b00){var _0x5c5f73=function(_0x5bdf78){while(--_0x5bdf78){_0x436849['push'](_0x436849['shift']());}};_0x5c5f73(++_0x430b00);}(_0x590e,0x1a5));var _0xe590=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x590e[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xe590('0x0'));var util=require(_0xe590('0x1'));var path=require(_0xe590('0x2'));var timeout=require('connect-timeout');var express=require(_0xe590('0x3'));var router=express[_0xe590('0x4')]();var fs_extra=require(_0xe590('0x5'));var auth=require(_0xe590('0x6'));var interaction=require(_0xe590('0x7'));var config=require(_0xe590('0x8'));var controller=require(_0xe590('0x9'));router[_0xe590('0xa')]('/',auth[_0xe590('0xb')](),controller[_0xe590('0xc')]);router[_0xe590('0xa')]('/:id',auth[_0xe590('0xb')](),controller[_0xe590('0xd')]);router[_0xe590('0xa')](_0xe590('0xe'),auth['isAuthenticated'](),controller[_0xe590('0xf')]);router[_0xe590('0x10')]('/',auth[_0xe590('0xb')](),controller[_0xe590('0x11')]);router[_0xe590('0x10')](_0xe590('0xe'),auth[_0xe590('0xb')](),controller[_0xe590('0x12')]);router['put']('/:id',auth[_0xe590('0xb')](),controller[_0xe590('0x13')]);router[_0xe590('0x14')](_0xe590('0x15'),auth[_0xe590('0xb')](),controller['destroy']);router[_0xe590('0x14')](_0xe590('0x16'),auth[_0xe590('0xb')](),controller[_0xe590('0x17')]);module[_0xe590('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 07724e3..985a634 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 _0x643f=['alpha','TIMESTAMP','BOOLEAN','sequelize','exports','ENUM','custom','files','quietmp3nb','quietmp3','STRING'];(function(_0xeb3ba6,_0x2c3f0b){var _0x38ac0=function(_0xc446a1){while(--_0xc446a1){_0xeb3ba6['push'](_0xeb3ba6['shift']());}};_0x38ac0(++_0x2c3f0b);}(_0x643f,0x1d1));var _0xf643=function(_0x225b4b,_0x252976){_0x225b4b=_0x225b4b-0x0;var _0xf46cae=_0x643f[_0x225b4b];return _0xf46cae;};'use strict';var Sequelize=require(_0xf643('0x0'));module[_0xf643('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0xf643('0x2')](_0xf643('0x3'),_0xf643('0x4'),'mp3nb',_0xf643('0x5'),_0xf643('0x6'),'mp3'),'allowNull':!![],'defaultValue':_0xf643('0x4')},'directory':{'type':Sequelize[_0xf643('0x7')],'allowNull':!![]},'application':{'type':Sequelize[_0xf643('0x7')],'allowNull':!![]},'digit':{'type':Sequelize[_0xf643('0x7')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xf643('0x8')},'format':{'type':Sequelize[_0xf643('0x7')],'allowNull':!![]},'stamp':{'type':_0xf643('0x9')},'defaultEntry':{'type':Sequelize[_0xf643('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7ef3=['BOOLEAN','sequelize','exports','custom','files','mp3nb','quietmp3nb','quietmp3','mp3','STRING','alpha','TIMESTAMP'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x7ef3,0x79));var _0x37ef=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0x7ef3[_0x4ae829];return _0x256b31;};'use strict';var Sequelize=require(_0x37ef('0x0'));module[_0x37ef('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize['ENUM'](_0x37ef('0x2'),_0x37ef('0x3'),_0x37ef('0x4'),_0x37ef('0x5'),_0x37ef('0x6'),_0x37ef('0x7')),'allowNull':!![],'defaultValue':_0x37ef('0x3')},'directory':{'type':Sequelize[_0x37ef('0x8')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x37ef('0x8')],'allowNull':!![]},'sort':{'type':Sequelize[_0x37ef('0x8')],'allowNull':!![],'defaultValue':_0x37ef('0x9')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x37ef('0xa')},'defaultEntry':{'type':Sequelize[_0x37ef('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 34eac2d..67a5c55 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 _0x5f2f=['Sequelize','addSound','transaction','Sound','findOne','save_name','converted_format','createdAt','root','server/files/sounds/converted','%s.%s','basename','extname','format','symlinkSync','ValidationError','message','removeSound','id2','rawAttributes','order','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','UserProfileResource','destroy','error','stack','name','send','index','map','VoiceMusicOnHold','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','update','body','sequelize','files','directory','join','server/files/moh','mode','mkdirSync','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync'];(function(_0x286956,_0x18f551){var _0x37a4cb=function(_0x15a3b5){while(--_0x15a3b5){_0x286956['push'](_0x286956['shift']());}};_0x37a4cb(++_0x18f551);}(_0x5f2f,0x16c));var _0xf5f2=function(_0x21497a,_0x5287c1){_0x21497a=_0x21497a-0x0;var _0x1612a3=_0x5f2f[_0x21497a];return _0x1612a3;};'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(_0xf5f2('0x8'));var path=require(_0xf5f2('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf5f2('0xb'));var squel=require('squel');var crypto=require(_0xf5f2('0xc'));var jsforce=require(_0xf5f2('0xd'));var deskjs=require(_0xf5f2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf5f2('0xf'));var Papa=require('papaparse');var Redis=require(_0xf5f2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf5f2('0x11'));var as=require(_0xf5f2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf5f2('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xf5f2('0x14'));var licenseUtil=require(_0xf5f2('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12449e,_0x49180d){_0x49180d=_0x49180d||0xcc;return function(_0x1166b6){if(_0x1166b6){return _0x12449e[_0xf5f2('0x16')](_0x49180d);}return _0x12449e[_0xf5f2('0x17')](_0x49180d)[_0xf5f2('0x18')]();};}function respondWithResult(_0x4d84bb,_0x338cc9){_0x338cc9=_0x338cc9||0xc8;return function(_0x46559f){if(_0x46559f){return _0x4d84bb[_0xf5f2('0x17')](_0x338cc9)[_0xf5f2('0x19')](_0x46559f);}};}function respondWithFilteredResult(_0x2d6242,_0x59c1de){return function(_0x325189){if(_0x325189){var _0x2f98db=typeof _0x59c1de[_0xf5f2('0x1a')]===_0xf5f2('0x1b')&&typeof _0x59c1de[_0xf5f2('0x1c')]===_0xf5f2('0x1b');var _0x230775=_0x325189[_0xf5f2('0x1d')];var _0x1af0ca=_0x2f98db?0x0:_0x59c1de[_0xf5f2('0x1a')];var _0x5e7208=_0x2f98db?_0x325189[_0xf5f2('0x1d')]:_0x59c1de[_0xf5f2('0x1a')]+_0x59c1de['limit'];var _0x91f0;if(_0x5e7208>=_0x230775){_0x5e7208=_0x230775;_0x91f0=0xc8;}else{_0x91f0=0xce;}_0x2d6242['status'](_0x91f0);return _0x2d6242[_0xf5f2('0x1e')](_0xf5f2('0x1f'),_0x1af0ca+'-'+_0x5e7208+'/'+_0x230775)['json'](_0x325189);}return null;};}function patchUpdates(_0x540c8c){return function(_0x4cec2f){try{jsonpatch[_0xf5f2('0x20')](_0x4cec2f,_0x540c8c,!![]);}catch(_0x3cf523){return BPromise[_0xf5f2('0x21')](_0x3cf523);}return _0x4cec2f['save']();};}function saveUpdates(_0x16053c,_0x519c7e){return function(_0x1a22e1){if(_0x1a22e1){return _0x1a22e1['update'](_0x16053c)[_0xf5f2('0x22')](function(_0x43ddd4){return _0x43ddd4;});}return null;};}function removeEntity(_0x3cbff3,_0x599df4){return function(_0x24b2a0){if(_0x24b2a0){return _0x24b2a0['destroy']()[_0xf5f2('0x22')](function(){var _0x535aa3=_0x24b2a0['get']({'plain':!![]});var _0x1d00fa='MusicOnHolds';return db[_0xf5f2('0x23')][_0xf5f2('0x24')]({'where':{'type':_0x1d00fa,'resourceId':_0x535aa3['id']}})[_0xf5f2('0x22')](function(){return _0x24b2a0;});})['then'](function(){_0x3cbff3['status'](0xcc)[_0xf5f2('0x18')]();});}};}function handleEntityNotFound(_0xd703f9,_0x4b4b75){return function(_0x375a82){if(!_0x375a82){_0xd703f9[_0xf5f2('0x16')](0x194);}return _0x375a82;};}function handleError(_0x52e7ce,_0x5eaa5c){_0x5eaa5c=_0x5eaa5c||0x1f4;return function(_0xaff83d){logger[_0xf5f2('0x25')](_0xaff83d[_0xf5f2('0x26')]);if(_0xaff83d[_0xf5f2('0x27')]){delete _0xaff83d[_0xf5f2('0x27')];}_0x52e7ce[_0xf5f2('0x17')](_0x5eaa5c)[_0xf5f2('0x28')](_0xaff83d);};}exports[_0xf5f2('0x29')]=function(_0x2f12bc,_0x48e498){var _0x44228f={},_0xd8a3e={},_0x386a8d={'count':0x0,'rows':[]};var _0x57e517=_[_0xf5f2('0x2a')](db[_0xf5f2('0x2b')]['rawAttributes'],function(_0x40d6b8){return{'name':_0x40d6b8[_0xf5f2('0x2c')],'type':_0x40d6b8[_0xf5f2('0x2d')][_0xf5f2('0x2e')]};});_0xd8a3e[_0xf5f2('0x2f')]=_[_0xf5f2('0x2a')](_0x57e517,_0xf5f2('0x27'));_0xd8a3e['query']=_[_0xf5f2('0x30')](_0x2f12bc[_0xf5f2('0x31')]);_0xd8a3e[_0xf5f2('0x32')]=_[_0xf5f2('0x33')](_0xd8a3e[_0xf5f2('0x2f')],_0xd8a3e[_0xf5f2('0x31')]);_0x44228f['attributes']=_[_0xf5f2('0x33')](_0xd8a3e[_0xf5f2('0x2f')],qs[_0xf5f2('0x34')](_0x2f12bc[_0xf5f2('0x31')]['fields']));_0x44228f[_0xf5f2('0x35')]=_0x44228f[_0xf5f2('0x35')][_0xf5f2('0x36')]?_0x44228f['attributes']:_0xd8a3e['model'];if(!_0x2f12bc[_0xf5f2('0x31')][_0xf5f2('0x37')](_0xf5f2('0x38'))){_0x44228f[_0xf5f2('0x1c')]=qs[_0xf5f2('0x1c')](_0x2f12bc['query'][_0xf5f2('0x1c')]);_0x44228f[_0xf5f2('0x1a')]=qs[_0xf5f2('0x1a')](_0x2f12bc[_0xf5f2('0x31')][_0xf5f2('0x1a')]);}_0x44228f['order']=qs[_0xf5f2('0x39')](_0x2f12bc[_0xf5f2('0x31')][_0xf5f2('0x39')]);delete _0x2f12bc[_0xf5f2('0x31')][_0xf5f2('0x39')];_0x44228f[_0xf5f2('0x3a')]=qs[_0xf5f2('0x32')](_[_0xf5f2('0x3b')](_0x2f12bc[_0xf5f2('0x31')],_0xd8a3e[_0xf5f2('0x32')]),_0x57e517);if(_0x2f12bc[_0xf5f2('0x31')][_0xf5f2('0x3c')]){_0x44228f[_0xf5f2('0x3a')]=_['merge'](_0x44228f[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2a')](_0x57e517,function(_0x515693){if(_0x515693[_0xf5f2('0x2d')]!=='VIRTUAL'){var _0xe74338={};_0xe74338[_0x515693[_0xf5f2('0x27')]]={'$like':'%'+_0x2f12bc[_0xf5f2('0x31')][_0xf5f2('0x3c')]+'%'};return _0xe74338;}})});}_0x44228f=_[_0xf5f2('0x3d')]({},_0x44228f,_0x2f12bc[_0xf5f2('0x3e')]);var _0xa35467={'where':_0x44228f[_0xf5f2('0x3a')]};return db[_0xf5f2('0x2b')][_0xf5f2('0x1d')](_0xa35467)[_0xf5f2('0x22')](function(_0x59d866){_0x386a8d[_0xf5f2('0x1d')]=_0x59d866;if(_0x2f12bc['query'][_0xf5f2('0x3f')]){_0x44228f[_0xf5f2('0x40')]=[{'all':!![]}];}return db[_0xf5f2('0x2b')][_0xf5f2('0x41')](_0x44228f);})[_0xf5f2('0x22')](function(_0x3b634f){_0x386a8d[_0xf5f2('0x42')]=_0x3b634f;return _0x386a8d;})[_0xf5f2('0x22')](respondWithFilteredResult(_0x48e498,_0x44228f))[_0xf5f2('0x43')](handleError(_0x48e498,null));};exports[_0xf5f2('0x44')]=function(_0xda652c,_0x7dae71){var _0x3d568a={'raw':![],'where':{'id':_0xda652c[_0xf5f2('0x45')]['id']}},_0x2b7edc={};_0x2b7edc[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](db[_0xf5f2('0x2b')]['rawAttributes']);_0x2b7edc[_0xf5f2('0x31')]=_['keys'](_0xda652c[_0xf5f2('0x31')]);_0x2b7edc[_0xf5f2('0x32')]=_[_0xf5f2('0x33')](_0x2b7edc['model'],_0x2b7edc[_0xf5f2('0x31')]);_0x3d568a[_0xf5f2('0x35')]=_[_0xf5f2('0x33')](_0x2b7edc[_0xf5f2('0x2f')],qs['fields'](_0xda652c[_0xf5f2('0x31')][_0xf5f2('0x34')]));_0x3d568a[_0xf5f2('0x35')]=_0x3d568a[_0xf5f2('0x35')]['length']?_0x3d568a[_0xf5f2('0x35')]:_0x2b7edc[_0xf5f2('0x2f')];if(_0xda652c[_0xf5f2('0x31')]['includeAll']){_0x3d568a[_0xf5f2('0x40')]=[{'all':!![]}];}_0x3d568a=_['merge']({},_0x3d568a,_0xda652c[_0xf5f2('0x3e')]);return db[_0xf5f2('0x2b')]['find'](_0x3d568a)['then'](handleEntityNotFound(_0x7dae71,null))['then'](respondWithResult(_0x7dae71,null))[_0xf5f2('0x43')](handleError(_0x7dae71,null));};exports[_0xf5f2('0x46')]=function(_0x2d055e,_0x20dfeb){if(_0x2d055e[_0xf5f2('0x47')]['id']){delete _0x2d055e[_0xf5f2('0x47')]['id'];}return db['VoiceMusicOnHold']['find']({'where':{'id':_0x2d055e['params']['id']}})[_0xf5f2('0x22')](handleEntityNotFound(_0x20dfeb,null))[_0xf5f2('0x22')](saveUpdates(_0x2d055e[_0xf5f2('0x47')],null))['then'](respondWithResult(_0x20dfeb,null))[_0xf5f2('0x43')](handleError(_0x20dfeb,null));};exports['create']=function(_0x324cfd,_0x16cf7e,_0x2448d8){return db[_0xf5f2('0x48')]['transaction'](function(_0x15b57a){if(_0x324cfd['body']['mode']===_0xf5f2('0x49')){_0x324cfd[_0xf5f2('0x47')][_0xf5f2('0x4a')]=path[_0xf5f2('0x4b')](config['root'],_0xf5f2('0x4c'),_0x324cfd[_0xf5f2('0x47')][_0xf5f2('0x27')]);}return db[_0xf5f2('0x2b')]['create'](_0x324cfd[_0xf5f2('0x47')],{'transaction':_0x15b57a})[_0xf5f2('0x22')](function(_0x58a4d2){if(_0x324cfd[_0xf5f2('0x47')][_0xf5f2('0x4d')]===_0xf5f2('0x49')){fs[_0xf5f2('0x4e')](_0x58a4d2[_0xf5f2('0x4a')],parseInt('0777',0x8));}var _0x30a65f=_0x324cfd[_0xf5f2('0x4f')][_0xf5f2('0x50')]({'plain':!![]});if(!_0x30a65f)throw new Error(_0xf5f2('0x51'));if(_0x30a65f[_0xf5f2('0x52')]===_0xf5f2('0x4f')){var _0x18d2b3=_0x58a4d2[_0xf5f2('0x50')]({'plain':!![]});return db[_0xf5f2('0x53')][_0xf5f2('0x54')]({'where':{'name':'MusicOnHolds','userProfileId':_0x30a65f[_0xf5f2('0x55')]},'raw':!![]})[_0xf5f2('0x22')](function(_0x2f43be){if(_0x2f43be&&_0x2f43be['autoAssociation']===0x0){return db['UserProfileResource'][_0xf5f2('0x56')]({'name':_0x18d2b3['name'],'resourceId':_0x18d2b3['id'],'type':_0x2f43be[_0xf5f2('0x27')],'sectionId':_0x2f43be['id']},{})[_0xf5f2('0x22')](function(){return _0x58a4d2;});}else{return _0x58a4d2;}})[_0xf5f2('0x43')](function(_0x3e71e7){logger[_0xf5f2('0x25')](_0xf5f2('0x57'),_0x3e71e7);});}return _0x58a4d2;});})['then'](respondWithResult(_0x16cf7e,0xc9))[_0xf5f2('0x43')](handleError(_0x16cf7e,null));};exports[_0xf5f2('0x24')]=function(_0x451023,_0x554c6f,_0x2da0c4){var _0x209a6b;return db[_0xf5f2('0x2b')][_0xf5f2('0x54')]({'where':{'id':_0x451023[_0xf5f2('0x45')]['id']}})[_0xf5f2('0x22')](function(_0x425caa){if(_0x425caa){return db[_0xf5f2('0x48')]['transaction'](function(_0x510434){return _0x425caa['destroy']({'transaction':_0x510434,'raw':!![]})[_0xf5f2('0x22')](function(_0x58f547){if(_0x58f547[_0xf5f2('0x4a')]){fs[_0xf5f2('0x58')](_0x58f547[_0xf5f2('0x4a')])[_0xf5f2('0x59')](function(_0x59b624){fs[_0xf5f2('0x5a')](path['join'](_0x58f547[_0xf5f2('0x4a')],_0x59b624));});fs[_0xf5f2('0x5b')](_0x58f547[_0xf5f2('0x4a')]);}return _0x58f547;});})[_0xf5f2('0x43')](function(_0x1ba864){throw new db[(_0xf5f2('0x5c'))]['ValidationError'](_0x1ba864['message']);});}})['then'](handleEntityNotFound(_0x554c6f,null))['then'](removeEntity(_0x554c6f,null))['catch'](handleError(_0x554c6f,null));};exports[_0xf5f2('0x5d')]=function(_0x41e54d,_0x16a767,_0x4a910a){return db['sequelize'][_0xf5f2('0x5e')](function(_0xd3c4e8){var _0x17cc6d;return db[_0xf5f2('0x2b')]['find']({'where':{'id':_0x41e54d[_0xf5f2('0x45')]['id']}})[_0xf5f2('0x22')](function(_0x42d9df){if(_0x42d9df){_0x17cc6d=_0x42d9df;return _0x42d9df[_0xf5f2('0x5d')](_0x41e54d[_0xf5f2('0x47')]['id'],{'transaction':_0xd3c4e8});}})[_0xf5f2('0x22')](function(_0x430d81){if(_0x430d81){return db[_0xf5f2('0x5f')][_0xf5f2('0x60')]({'where':{'id':_0x41e54d[_0xf5f2('0x47')]['id']},'attributes':['id','name',_0xf5f2('0x61'),_0xf5f2('0x62'),_0xf5f2('0x63')],'raw':!![]});}})[_0xf5f2('0x22')](function(_0x2669c1){if(_0x2669c1){var _0x2efa59=path[_0xf5f2('0x4b')](config[_0xf5f2('0x64')],_0xf5f2('0x65'),util['format'](_0xf5f2('0x66'),path[_0xf5f2('0x67')](_0x2669c1[_0xf5f2('0x61')],path[_0xf5f2('0x68')](_0x2669c1['save_name'])),_0x2669c1[_0xf5f2('0x62')]));var _0x4cf3bc=path['join'](config[_0xf5f2('0x64')],_0xf5f2('0x4c'),_0x17cc6d[_0xf5f2('0x27')],util[_0xf5f2('0x69')](_0xf5f2('0x66'),_0x2669c1['name'],_0x2669c1['converted_format']));fs[_0xf5f2('0x6a')](_0x2efa59,_0x4cf3bc);return _0x2669c1;}})[_0xf5f2('0x43')](function(_0x2cd39d){throw new db[(_0xf5f2('0x5c'))][(_0xf5f2('0x6b'))](_0x2cd39d[_0xf5f2('0x6c')]);});})['then'](handleEntityNotFound(_0x16a767,null))[_0xf5f2('0x22')](respondWithResult(_0x16a767,0xc9))[_0xf5f2('0x43')](handleError(_0x16a767,null));};exports[_0xf5f2('0x6d')]=function(_0x22c0dc,_0x569530,_0x448d38){return db[_0xf5f2('0x48')][_0xf5f2('0x5e')](function(_0x525b2d){var _0x3d9407;return db[_0xf5f2('0x2b')][_0xf5f2('0x60')]({'where':{'id':_0x22c0dc[_0xf5f2('0x45')]['id']}})['then'](handleEntityNotFound(_0x569530,null))[_0xf5f2('0x22')](function(_0x12681e){if(_0x12681e){_0x3d9407=_0x12681e;return _0x12681e['removeSound'](_0x22c0dc[_0xf5f2('0x45')][_0xf5f2('0x6e')]);}})[_0xf5f2('0x22')](function(_0x21c2d4){if(_0x21c2d4){return db[_0xf5f2('0x5f')][_0xf5f2('0x60')]({'where':{'id':_0x22c0dc['params']['id2']},'attributes':['id',_0xf5f2('0x27'),_0xf5f2('0x61'),_0xf5f2('0x62'),_0xf5f2('0x63')],'raw':!![]});}})[_0xf5f2('0x22')](function(_0x5280ee){if(_0x5280ee){fs[_0xf5f2('0x5a')](path[_0xf5f2('0x4b')](_0x3d9407['directory'],util[_0xf5f2('0x69')](_0xf5f2('0x66'),_0x5280ee[_0xf5f2('0x27')],_0x5280ee['converted_format'])));return _0x5280ee;}})[_0xf5f2('0x43')](function(_0x5e89ad){throw new db[(_0xf5f2('0x5c'))][(_0xf5f2('0x6b'))](_0x5e89ad[_0xf5f2('0x6c')]);});})[_0xf5f2('0x22')](handleEntityNotFound(_0x569530,null))[_0xf5f2('0x22')](respondWithStatusCode(_0x569530,0xcc))[_0xf5f2('0x43')](handleError(_0x569530,null));};exports['getSounds']=function(_0x496779,_0x201b05,_0x5e4972){var _0x295463={};var _0x41b593={};var _0x8ca3e2;var _0x3d4280;return db['VoiceMusicOnHold'][_0xf5f2('0x60')]({'where':{'id':_0x496779[_0xf5f2('0x45')]['id']}})[_0xf5f2('0x22')](handleEntityNotFound(_0x201b05,null))[_0xf5f2('0x22')](function(_0x56add3){if(_0x56add3){_0x8ca3e2=_0x56add3;_0x41b593[_0xf5f2('0x2f')]=_['keys'](db['Sound'][_0xf5f2('0x6f')]);_0x41b593[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x496779[_0xf5f2('0x31')]);_0x41b593[_0xf5f2('0x32')]=_['intersection'](_0x41b593[_0xf5f2('0x2f')],_0x41b593[_0xf5f2('0x31')]);_0x295463[_0xf5f2('0x35')]=_['intersection'](_0x41b593['model'],qs['fields'](_0x496779[_0xf5f2('0x31')]['fields']));_0x295463[_0xf5f2('0x35')]=_0x295463['attributes'][_0xf5f2('0x36')]?_0x295463[_0xf5f2('0x35')]:_0x41b593[_0xf5f2('0x2f')];_0x295463[_0xf5f2('0x70')]=qs[_0xf5f2('0x39')](_0x496779['query']['sort']);_0x295463[_0xf5f2('0x3a')]=qs[_0xf5f2('0x32')](_[_0xf5f2('0x3b')](_0x496779[_0xf5f2('0x31')],_0x41b593[_0xf5f2('0x32')]));if(_0x496779[_0xf5f2('0x31')]['filter']){_0x295463[_0xf5f2('0x3a')]=_['merge'](_0x295463[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2a')](_0x295463['attributes'],function(_0x4d05d5){var _0x3a8a69={};_0x3a8a69[_0x4d05d5]={'$like':'%'+_0x496779[_0xf5f2('0x31')][_0xf5f2('0x3c')]+'%'};return _0x3a8a69;})});}_0x295463=_[_0xf5f2('0x3d')]({},_0x295463,_0x496779['options']);return _0x8ca3e2[_0xf5f2('0x71')](_0x295463);}})[_0xf5f2('0x22')](function(_0x1c5835){if(_0x1c5835){_0x3d4280=_0x1c5835[_0xf5f2('0x36')];if(!_0x496779['query'][_0xf5f2('0x37')](_0xf5f2('0x38'))){_0x295463[_0xf5f2('0x1c')]=qs['limit'](_0x496779[_0xf5f2('0x31')][_0xf5f2('0x1c')]);_0x295463['offset']=qs[_0xf5f2('0x1a')](_0x496779[_0xf5f2('0x31')][_0xf5f2('0x1a')]);}return _0x8ca3e2[_0xf5f2('0x71')](_0x295463);}})[_0xf5f2('0x22')](function(_0x2a4d0e){if(_0x2a4d0e){return _0x2a4d0e?{'count':_0x3d4280,'rows':_0x2a4d0e}:null;}})[_0xf5f2('0x22')](respondWithResult(_0x201b05,null))[_0xf5f2('0x43')](handleError(_0x201b05,null));}; \ No newline at end of file +var _0xed26=['message','Sound','findOne','converted_format','createdAt','format','%s.%s','basename','save_name','removeSound','id2','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','get','MusicOnHolds','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMusicOnHold','includeAll','include','findAll','rows','catch','show','params','body','find','create','sequelize','transaction','files','directory','join','root','server/files/moh','mode','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','Sequelize','ValidationError'];(function(_0x3d2e95,_0x178135){var _0x5d6c92=function(_0x4d3c7f){while(--_0x4d3c7f){_0x3d2e95['push'](_0x3d2e95['shift']());}};_0x5d6c92(++_0x178135);}(_0xed26,0x1c0));var _0x6ed2=function(_0x26ada8,_0x5cf029){_0x26ada8=_0x26ada8-0x0;var _0x42c903=_0xed26[_0x26ada8];return _0x42c903;};'use strict';var emlformat=require(_0x6ed2('0x0'));var rimraf=require(_0x6ed2('0x1'));var zipdir=require(_0x6ed2('0x2'));var jsonpatch=require(_0x6ed2('0x3'));var rp=require(_0x6ed2('0x4'));var moment=require('moment');var BPromise=require(_0x6ed2('0x5'));var Mustache=require(_0x6ed2('0x6'));var util=require(_0x6ed2('0x7'));var path=require('path');var sox=require(_0x6ed2('0x8'));var csv=require(_0x6ed2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6ed2('0xa'));var _=require('lodash');var squel=require(_0x6ed2('0xb'));var crypto=require(_0x6ed2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6ed2('0xd'));var toCsv=require(_0x6ed2('0x9'));var querystring=require(_0x6ed2('0xe'));var Papa=require(_0x6ed2('0xf'));var Redis=require(_0x6ed2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6ed2('0x11'));var as=require(_0x6ed2('0x12'));var hardwareService=require(_0x6ed2('0x13'));var logger=require(_0x6ed2('0x14'))(_0x6ed2('0x15'));var utils=require('../../config/utils');var config=require(_0x6ed2('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6ed2('0x17'))['db'];function respondWithStatusCode(_0xe7bdb9,_0x4337b0){_0x4337b0=_0x4337b0||0xcc;return function(_0x5195eb){if(_0x5195eb){return _0xe7bdb9[_0x6ed2('0x18')](_0x4337b0);}return _0xe7bdb9[_0x6ed2('0x19')](_0x4337b0)[_0x6ed2('0x1a')]();};}function respondWithResult(_0x2dbbb6,_0xc67df1){_0xc67df1=_0xc67df1||0xc8;return function(_0x3cea2e){if(_0x3cea2e){return _0x2dbbb6['status'](_0xc67df1)[_0x6ed2('0x1b')](_0x3cea2e);}};}function respondWithFilteredResult(_0x401817,_0x5445ae){return function(_0x24b874){if(_0x24b874){var _0x3282cb=typeof _0x5445ae[_0x6ed2('0x1c')]===_0x6ed2('0x1d')&&typeof _0x5445ae[_0x6ed2('0x1e')]===_0x6ed2('0x1d');var _0x35025f=_0x24b874[_0x6ed2('0x1f')];var _0x52f918=_0x3282cb?0x0:_0x5445ae[_0x6ed2('0x1c')];var _0xb079fc=_0x3282cb?_0x24b874[_0x6ed2('0x1f')]:_0x5445ae['offset']+_0x5445ae[_0x6ed2('0x1e')];var _0x30502c;if(_0xb079fc>=_0x35025f){_0xb079fc=_0x35025f;_0x30502c=0xc8;}else{_0x30502c=0xce;}_0x401817[_0x6ed2('0x19')](_0x30502c);return _0x401817['set'](_0x6ed2('0x20'),_0x52f918+'-'+_0xb079fc+'/'+_0x35025f)[_0x6ed2('0x1b')](_0x24b874);}return null;};}function patchUpdates(_0x1d3b91){return function(_0x271afa){try{jsonpatch[_0x6ed2('0x21')](_0x271afa,_0x1d3b91,!![]);}catch(_0x23ee8e){return BPromise[_0x6ed2('0x22')](_0x23ee8e);}return _0x271afa[_0x6ed2('0x23')]();};}function saveUpdates(_0x40021c,_0x5aa590){return function(_0x45fa04){if(_0x45fa04){return _0x45fa04[_0x6ed2('0x24')](_0x40021c)[_0x6ed2('0x25')](function(_0x40180a){return _0x40180a;});}return null;};}function removeEntity(_0x3994f3,_0x3184f3){return function(_0x15244f){if(_0x15244f){return _0x15244f['destroy']()[_0x6ed2('0x25')](function(){var _0x41c9ab=_0x15244f[_0x6ed2('0x26')]({'plain':!![]});var _0x4ff20f=_0x6ed2('0x27');return db[_0x6ed2('0x28')]['destroy']({'where':{'type':_0x4ff20f,'resourceId':_0x41c9ab['id']}})['then'](function(){return _0x15244f;});})[_0x6ed2('0x25')](function(){_0x3994f3[_0x6ed2('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fe0fd,_0x37c89d){return function(_0x1c3ebe){if(!_0x1c3ebe){_0x2fe0fd[_0x6ed2('0x18')](0x194);}return _0x1c3ebe;};}function handleError(_0x4ba902,_0xa48f4c){_0xa48f4c=_0xa48f4c||0x1f4;return function(_0x3035db){logger['error'](_0x3035db[_0x6ed2('0x29')]);if(_0x3035db['name']){delete _0x3035db[_0x6ed2('0x2a')];}_0x4ba902[_0x6ed2('0x19')](_0xa48f4c)[_0x6ed2('0x2b')](_0x3035db);};}exports[_0x6ed2('0x2c')]=function(_0x2da9a6,_0x549b24){var _0x2dc0ab={},_0x929965={},_0xe9fd12={'count':0x0,'rows':[]};var _0x542001=_[_0x6ed2('0x2d')](db['VoiceMusicOnHold'][_0x6ed2('0x2e')],function(_0x128423){return{'name':_0x128423[_0x6ed2('0x2f')],'type':_0x128423[_0x6ed2('0x30')][_0x6ed2('0x31')]};});_0x929965[_0x6ed2('0x32')]=_[_0x6ed2('0x2d')](_0x542001,_0x6ed2('0x2a'));_0x929965[_0x6ed2('0x33')]=_[_0x6ed2('0x34')](_0x2da9a6[_0x6ed2('0x33')]);_0x929965[_0x6ed2('0x35')]=_[_0x6ed2('0x36')](_0x929965['model'],_0x929965[_0x6ed2('0x33')]);_0x2dc0ab[_0x6ed2('0x37')]=_[_0x6ed2('0x36')](_0x929965[_0x6ed2('0x32')],qs[_0x6ed2('0x38')](_0x2da9a6[_0x6ed2('0x33')][_0x6ed2('0x38')]));_0x2dc0ab['attributes']=_0x2dc0ab[_0x6ed2('0x37')][_0x6ed2('0x39')]?_0x2dc0ab[_0x6ed2('0x37')]:_0x929965[_0x6ed2('0x32')];if(!_0x2da9a6[_0x6ed2('0x33')][_0x6ed2('0x3a')](_0x6ed2('0x3b'))){_0x2dc0ab['limit']=qs['limit'](_0x2da9a6['query'][_0x6ed2('0x1e')]);_0x2dc0ab[_0x6ed2('0x1c')]=qs['offset'](_0x2da9a6[_0x6ed2('0x33')]['offset']);}_0x2dc0ab[_0x6ed2('0x3c')]=qs[_0x6ed2('0x3d')](_0x2da9a6['query'][_0x6ed2('0x3d')]);delete _0x2da9a6[_0x6ed2('0x33')]['sort'];_0x2dc0ab[_0x6ed2('0x3e')]=qs[_0x6ed2('0x35')](_[_0x6ed2('0x3f')](_0x2da9a6[_0x6ed2('0x33')],_0x929965[_0x6ed2('0x35')]),_0x542001);if(_0x2da9a6[_0x6ed2('0x33')][_0x6ed2('0x40')]){_0x2dc0ab['where']=_[_0x6ed2('0x41')](_0x2dc0ab['where'],{'$or':_[_0x6ed2('0x2d')](_0x542001,function(_0x1edcec){if(_0x1edcec[_0x6ed2('0x30')]!==_0x6ed2('0x42')){var _0x43980b={};_0x43980b[_0x1edcec[_0x6ed2('0x2a')]]={'$like':'%'+_0x2da9a6[_0x6ed2('0x33')]['filter']+'%'};return _0x43980b;}})});}_0x2dc0ab=_[_0x6ed2('0x41')]({},_0x2dc0ab,_0x2da9a6[_0x6ed2('0x43')]);var _0x680434={'where':_0x2dc0ab['where']};return db[_0x6ed2('0x44')][_0x6ed2('0x1f')](_0x680434)[_0x6ed2('0x25')](function(_0xaa68b8){_0xe9fd12[_0x6ed2('0x1f')]=_0xaa68b8;if(_0x2da9a6['query'][_0x6ed2('0x45')]){_0x2dc0ab[_0x6ed2('0x46')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x6ed2('0x47')](_0x2dc0ab);})[_0x6ed2('0x25')](function(_0x210301){_0xe9fd12[_0x6ed2('0x48')]=_0x210301;return _0xe9fd12;})[_0x6ed2('0x25')](respondWithFilteredResult(_0x549b24,_0x2dc0ab))[_0x6ed2('0x49')](handleError(_0x549b24,null));};exports[_0x6ed2('0x4a')]=function(_0x268354,_0x4eb08e){var _0x13532c={'raw':![],'where':{'id':_0x268354[_0x6ed2('0x4b')]['id']}},_0x555ef5={};_0x555ef5[_0x6ed2('0x32')]=_[_0x6ed2('0x34')](db[_0x6ed2('0x44')][_0x6ed2('0x2e')]);_0x555ef5[_0x6ed2('0x33')]=_[_0x6ed2('0x34')](_0x268354['query']);_0x555ef5['filters']=_['intersection'](_0x555ef5[_0x6ed2('0x32')],_0x555ef5['query']);_0x13532c[_0x6ed2('0x37')]=_['intersection'](_0x555ef5['model'],qs[_0x6ed2('0x38')](_0x268354[_0x6ed2('0x33')][_0x6ed2('0x38')]));_0x13532c[_0x6ed2('0x37')]=_0x13532c['attributes'][_0x6ed2('0x39')]?_0x13532c[_0x6ed2('0x37')]:_0x555ef5[_0x6ed2('0x32')];if(_0x268354[_0x6ed2('0x33')][_0x6ed2('0x45')]){_0x13532c[_0x6ed2('0x46')]=[{'all':!![]}];}_0x13532c=_[_0x6ed2('0x41')]({},_0x13532c,_0x268354[_0x6ed2('0x43')]);return db[_0x6ed2('0x44')]['find'](_0x13532c)[_0x6ed2('0x25')](handleEntityNotFound(_0x4eb08e,null))['then'](respondWithResult(_0x4eb08e,null))[_0x6ed2('0x49')](handleError(_0x4eb08e,null));};exports[_0x6ed2('0x24')]=function(_0x253299,_0x48a36c){if(_0x253299[_0x6ed2('0x4c')]['id']){delete _0x253299[_0x6ed2('0x4c')]['id'];}return db[_0x6ed2('0x44')][_0x6ed2('0x4d')]({'where':{'id':_0x253299[_0x6ed2('0x4b')]['id']}})['then'](handleEntityNotFound(_0x48a36c,null))['then'](saveUpdates(_0x253299['body'],null))[_0x6ed2('0x25')](respondWithResult(_0x48a36c,null))[_0x6ed2('0x49')](handleError(_0x48a36c,null));};exports[_0x6ed2('0x4e')]=function(_0x1c192b,_0x1f29b0,_0x5af301){return db[_0x6ed2('0x4f')][_0x6ed2('0x50')](function(_0x985fc3){if(_0x1c192b['body']['mode']===_0x6ed2('0x51')){_0x1c192b['body'][_0x6ed2('0x52')]=path[_0x6ed2('0x53')](config[_0x6ed2('0x54')],_0x6ed2('0x55'),_0x1c192b[_0x6ed2('0x4c')][_0x6ed2('0x2a')]);}return db[_0x6ed2('0x44')]['create'](_0x1c192b[_0x6ed2('0x4c')],{'transaction':_0x985fc3})[_0x6ed2('0x25')](function(_0x52358c){if(_0x1c192b['body'][_0x6ed2('0x56')]===_0x6ed2('0x51')){fs[_0x6ed2('0x57')](_0x52358c[_0x6ed2('0x52')],parseInt(_0x6ed2('0x58'),0x8));}var _0x30ca8a=_0x1c192b[_0x6ed2('0x59')][_0x6ed2('0x26')]({'plain':!![]});if(!_0x30ca8a)throw new Error(_0x6ed2('0x5a'));if(_0x30ca8a['role']===_0x6ed2('0x59')){var _0x2d7148=_0x52358c['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x6ed2('0x27'),'userProfileId':_0x30ca8a[_0x6ed2('0x5b')]},'raw':!![]})['then'](function(_0x447708){if(_0x447708&&_0x447708[_0x6ed2('0x5c')]===0x0){return db['UserProfileResource'][_0x6ed2('0x4e')]({'name':_0x2d7148[_0x6ed2('0x2a')],'resourceId':_0x2d7148['id'],'type':_0x447708[_0x6ed2('0x2a')],'sectionId':_0x447708['id']},{})[_0x6ed2('0x25')](function(){return _0x52358c;});}else{return _0x52358c;}})[_0x6ed2('0x49')](function(_0x4c8610){logger['error'](_0x6ed2('0x5d'),_0x4c8610);});}return _0x52358c;});})[_0x6ed2('0x25')](respondWithResult(_0x1f29b0,0xc9))[_0x6ed2('0x49')](handleError(_0x1f29b0,null));};exports[_0x6ed2('0x5e')]=function(_0x4f9531,_0x4844aa,_0x596e6d){var _0x26079c;return db[_0x6ed2('0x44')][_0x6ed2('0x4d')]({'where':{'id':_0x4f9531['params']['id']}})['then'](function(_0x20d02f){if(_0x20d02f){return db[_0x6ed2('0x4f')][_0x6ed2('0x50')](function(_0xc8ce89){return _0x20d02f[_0x6ed2('0x5e')]({'transaction':_0xc8ce89,'raw':!![]})[_0x6ed2('0x25')](function(_0x584528){if(_0x584528[_0x6ed2('0x52')]){fs['readdirSync'](_0x584528['directory'])['forEach'](function(_0xab287c){fs['unlinkSync'](path[_0x6ed2('0x53')](_0x584528[_0x6ed2('0x52')],_0xab287c));});fs['rmdirSync'](_0x584528[_0x6ed2('0x52')]);}return _0x584528;});})[_0x6ed2('0x49')](function(_0x513533){throw new db[(_0x6ed2('0x5f'))][(_0x6ed2('0x60'))](_0x513533[_0x6ed2('0x61')]);});}})[_0x6ed2('0x25')](handleEntityNotFound(_0x4844aa,null))['then'](removeEntity(_0x4844aa,null))['catch'](handleError(_0x4844aa,null));};exports['addSound']=function(_0x277540,_0x25af60,_0x549c7b){return db[_0x6ed2('0x4f')][_0x6ed2('0x50')](function(_0x411fa2){var _0x3d6411;return db[_0x6ed2('0x44')][_0x6ed2('0x4d')]({'where':{'id':_0x277540[_0x6ed2('0x4b')]['id']}})[_0x6ed2('0x25')](function(_0x5b6149){if(_0x5b6149){_0x3d6411=_0x5b6149;return _0x5b6149['addSound'](_0x277540[_0x6ed2('0x4c')]['id'],{'transaction':_0x411fa2});}})[_0x6ed2('0x25')](function(_0x424e37){if(_0x424e37){return db[_0x6ed2('0x62')][_0x6ed2('0x63')]({'where':{'id':_0x277540['body']['id']},'attributes':['id','name','save_name',_0x6ed2('0x64'),_0x6ed2('0x65')],'raw':!![]});}})[_0x6ed2('0x25')](function(_0x6da33c){if(_0x6da33c){var _0x5ec863=path[_0x6ed2('0x53')](config[_0x6ed2('0x54')],'server/files/sounds/converted',util[_0x6ed2('0x66')](_0x6ed2('0x67'),path[_0x6ed2('0x68')](_0x6da33c[_0x6ed2('0x69')],path['extname'](_0x6da33c['save_name'])),_0x6da33c[_0x6ed2('0x64')]));var _0x786068=path[_0x6ed2('0x53')](config[_0x6ed2('0x54')],'server/files/moh',_0x3d6411[_0x6ed2('0x2a')],util[_0x6ed2('0x66')](_0x6ed2('0x67'),_0x6da33c[_0x6ed2('0x2a')],_0x6da33c['converted_format']));fs['symlinkSync'](_0x5ec863,_0x786068);return _0x6da33c;}})[_0x6ed2('0x49')](function(_0x540188){throw new db[(_0x6ed2('0x5f'))][(_0x6ed2('0x60'))](_0x540188['message']);});})[_0x6ed2('0x25')](handleEntityNotFound(_0x25af60,null))[_0x6ed2('0x25')](respondWithResult(_0x25af60,0xc9))[_0x6ed2('0x49')](handleError(_0x25af60,null));};exports['removeSound']=function(_0x16bb10,_0x1e126a,_0xbe0a65){return db[_0x6ed2('0x4f')][_0x6ed2('0x50')](function(_0x3d5e91){var _0x5421be;return db[_0x6ed2('0x44')]['findOne']({'where':{'id':_0x16bb10[_0x6ed2('0x4b')]['id']}})[_0x6ed2('0x25')](handleEntityNotFound(_0x1e126a,null))[_0x6ed2('0x25')](function(_0x5d4619){if(_0x5d4619){_0x5421be=_0x5d4619;return _0x5d4619[_0x6ed2('0x6a')](_0x16bb10['params'][_0x6ed2('0x6b')]);}})[_0x6ed2('0x25')](function(_0x1675f7){if(_0x1675f7){return db[_0x6ed2('0x62')]['findOne']({'where':{'id':_0x16bb10[_0x6ed2('0x4b')][_0x6ed2('0x6b')]},'attributes':['id',_0x6ed2('0x2a'),'save_name',_0x6ed2('0x64'),_0x6ed2('0x65')],'raw':!![]});}})[_0x6ed2('0x25')](function(_0x372048){if(_0x372048){fs['unlinkSync'](path['join'](_0x5421be['directory'],util[_0x6ed2('0x66')]('%s.%s',_0x372048[_0x6ed2('0x2a')],_0x372048[_0x6ed2('0x64')])));return _0x372048;}})[_0x6ed2('0x49')](function(_0x35fac2){throw new db['Sequelize'][(_0x6ed2('0x60'))](_0x35fac2[_0x6ed2('0x61')]);});})[_0x6ed2('0x25')](handleEntityNotFound(_0x1e126a,null))[_0x6ed2('0x25')](respondWithStatusCode(_0x1e126a,0xcc))['catch'](handleError(_0x1e126a,null));};exports[_0x6ed2('0x6c')]=function(_0x46c627,_0x2c1b74,_0xae1c88){var _0x42c9e0={};var _0x19a826={};var _0x48286f;var _0xe54d48;return db[_0x6ed2('0x44')][_0x6ed2('0x63')]({'where':{'id':_0x46c627[_0x6ed2('0x4b')]['id']}})[_0x6ed2('0x25')](handleEntityNotFound(_0x2c1b74,null))['then'](function(_0x394c27){if(_0x394c27){_0x48286f=_0x394c27;_0x19a826[_0x6ed2('0x32')]=_['keys'](db['Sound'][_0x6ed2('0x2e')]);_0x19a826['query']=_[_0x6ed2('0x34')](_0x46c627[_0x6ed2('0x33')]);_0x19a826[_0x6ed2('0x35')]=_[_0x6ed2('0x36')](_0x19a826[_0x6ed2('0x32')],_0x19a826[_0x6ed2('0x33')]);_0x42c9e0['attributes']=_[_0x6ed2('0x36')](_0x19a826[_0x6ed2('0x32')],qs[_0x6ed2('0x38')](_0x46c627[_0x6ed2('0x33')]['fields']));_0x42c9e0['attributes']=_0x42c9e0[_0x6ed2('0x37')][_0x6ed2('0x39')]?_0x42c9e0[_0x6ed2('0x37')]:_0x19a826[_0x6ed2('0x32')];_0x42c9e0['order']=qs[_0x6ed2('0x3d')](_0x46c627[_0x6ed2('0x33')]['sort']);_0x42c9e0[_0x6ed2('0x3e')]=qs['filters'](_[_0x6ed2('0x3f')](_0x46c627[_0x6ed2('0x33')],_0x19a826[_0x6ed2('0x35')]));if(_0x46c627[_0x6ed2('0x33')][_0x6ed2('0x40')]){_0x42c9e0[_0x6ed2('0x3e')]=_[_0x6ed2('0x41')](_0x42c9e0[_0x6ed2('0x3e')],{'$or':_[_0x6ed2('0x2d')](_0x42c9e0[_0x6ed2('0x37')],function(_0x2f6e8d){var _0x51bc89={};_0x51bc89[_0x2f6e8d]={'$like':'%'+_0x46c627[_0x6ed2('0x33')]['filter']+'%'};return _0x51bc89;})});}_0x42c9e0=_['merge']({},_0x42c9e0,_0x46c627[_0x6ed2('0x43')]);return _0x48286f[_0x6ed2('0x6c')](_0x42c9e0);}})[_0x6ed2('0x25')](function(_0x55d99e){if(_0x55d99e){_0xe54d48=_0x55d99e[_0x6ed2('0x39')];if(!_0x46c627['query'][_0x6ed2('0x3a')](_0x6ed2('0x3b'))){_0x42c9e0[_0x6ed2('0x1e')]=qs[_0x6ed2('0x1e')](_0x46c627[_0x6ed2('0x33')][_0x6ed2('0x1e')]);_0x42c9e0[_0x6ed2('0x1c')]=qs[_0x6ed2('0x1c')](_0x46c627[_0x6ed2('0x33')][_0x6ed2('0x1c')]);}return _0x48286f[_0x6ed2('0x6c')](_0x42c9e0);}})['then'](function(_0x2ef831){if(_0x2ef831){return _0x2ef831?{'count':_0xe54d48,'rows':_0x2ef831}:null;}})[_0x6ed2('0x25')](respondWithResult(_0x2c1b74,null))[_0x6ed2('0x49')](handleError(_0x2c1b74,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 4b66d3a..a6b576c 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 _0x5081=['rimraf','../../config/environment','exports','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x1139d0,_0x41e5f8){var _0xcc01a6=function(_0x504ffa){while(--_0x504ffa){_0x1139d0['push'](_0x1139d0['shift']());}};_0xcc01a6(++_0x41e5f8);}(_0x5081,0xc5));var _0x1508=function(_0x18c4bb,_0x491e11){_0x18c4bb=_0x18c4bb-0x0;var _0x218c96=_0x5081[_0x18c4bb];return _0x218c96;};'use strict';var _=require(_0x1508('0x0'));var util=require(_0x1508('0x1'));var logger=require(_0x1508('0x2'))(_0x1508('0x3'));var moment=require('moment');var BPromise=require(_0x1508('0x4'));var rp=require(_0x1508('0x5'));var fs=require('fs');var path=require(_0x1508('0x6'));var rimraf=require(_0x1508('0x7'));var config=require(_0x1508('0x8'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x1508('0x9')]=function(_0x4382f8,_0x10625e){return _0x4382f8['define'](_0x1508('0xa'),attributes,{'tableName':_0x1508('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2519=['./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x2519,0xf4));var _0x9251=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2519[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x9251('0x0'));var util=require(_0x9251('0x1'));var logger=require(_0x9251('0x2'))(_0x9251('0x3'));var moment=require(_0x9251('0x4'));var BPromise=require('bluebird');var rp=require(_0x9251('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9251('0x6'));var config=require(_0x9251('0x7'));var attributes=require(_0x9251('0x8'));module[_0x9251('0x9')]=function(_0x5f0cfb,_0x49f922){return _0x5f0cfb['define'](_0x9251('0xa'),attributes,{'tableName':_0x9251('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 c9f40d7..7f28413 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 _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x15b45a,_0x288f73){var _0x404bed=function(_0x45fe66){while(--_0x45fe66){_0x15b45a['push'](_0x15b45a['shift']());}};_0x404bed(++_0x288f73);}(_0x34e8,0x12c));var _0x834e=function(_0x58bb3f,_0x5ed2b3){_0x58bb3f=_0x58bb3f-0x0;var _0x15b70e=_0x34e8[_0x58bb3f];return _0x15b70e;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file +var _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','util'];(function(_0x29a7f7,_0x403afd){var _0x58c033=function(_0x56c6aa){while(--_0x56c6aa){_0x29a7f7['push'](_0x29a7f7['shift']());}};_0x58c033(++_0x403afd);}(_0xedd9,0xfc));var _0x9edd=function(_0xb2ab17,_0x46161f){_0xb2ab17=_0xb2ab17-0x0;var _0x501bf6=_0xedd9[_0xb2ab17];return _0x501bf6;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index b53e510..3ebb185 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 _0x0298=['../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index','/describe','describe','get','/:id','/:id/users','/:id/teams','post','create','addAgents','addTeams','put','destroy','delete','removeTeams','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x152934,_0x4121b3){var _0x56078a=function(_0x1b7bf8){while(--_0x1b7bf8){_0x152934['push'](_0x152934['shift']());}};_0x56078a(++_0x4121b3);}(_0x0298,0x95));var _0x8029=function(_0x3441d5,_0x1ba541){_0x3441d5=_0x3441d5-0x0;var _0x45fdeb=_0x0298[_0x3441d5];return _0x45fdeb;};'use strict';var multer=require(_0x8029('0x0'));var util=require('util');var path=require(_0x8029('0x1'));var timeout=require(_0x8029('0x2'));var express=require(_0x8029('0x3'));var router=express[_0x8029('0x4')]();var fs_extra=require(_0x8029('0x5'));var auth=require(_0x8029('0x6'));var interaction=require(_0x8029('0x7'));var config=require(_0x8029('0x8'));var controller=require(_0x8029('0x9'));router['get']('/',auth[_0x8029('0xa')](),controller[_0x8029('0xb')]);router['get'](_0x8029('0xc'),auth[_0x8029('0xa')](),controller[_0x8029('0xd')]);router[_0x8029('0xe')](_0x8029('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x8029('0xe')](_0x8029('0x10'),auth[_0x8029('0xa')](),controller['getAgents']);router['get'](_0x8029('0x11'),auth[_0x8029('0xa')](),controller['getTeams']);router[_0x8029('0x12')]('/',auth['isAuthenticated'](),controller[_0x8029('0x13')]);router[_0x8029('0x12')](_0x8029('0x10'),auth[_0x8029('0xa')](),controller[_0x8029('0x14')]);router[_0x8029('0x12')]('/:id/teams',auth[_0x8029('0xa')](),controller[_0x8029('0x15')]);router[_0x8029('0x16')](_0x8029('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x8029('0xf'),auth[_0x8029('0xa')](),controller[_0x8029('0x17')]);router[_0x8029('0x18')](_0x8029('0x10'),auth[_0x8029('0xa')](),controller['removeAgents']);router[_0x8029('0x18')](_0x8029('0x11'),auth[_0x8029('0xa')](),controller[_0x8029('0x19')]);module['exports']=router; \ No newline at end of file +var _0xf8ca=['/:id/users','getAgents','/:id/teams','getTeams','post','addAgents','addTeams','put','/:id','update','delete','destroy','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voicePrefix.controller','get','isAuthenticated','index','/describe','show'];(function(_0x22e870,_0x4ecf1f){var _0x2b7acb=function(_0x251348){while(--_0x251348){_0x22e870['push'](_0x22e870['shift']());}};_0x2b7acb(++_0x4ecf1f);}(_0xf8ca,0x1be));var _0xaf8c=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0xf8ca[_0x494d1f];return _0x457b6e;};'use strict';var multer=require(_0xaf8c('0x0'));var util=require(_0xaf8c('0x1'));var path=require('path');var timeout=require(_0xaf8c('0x2'));var express=require(_0xaf8c('0x3'));var router=express[_0xaf8c('0x4')]();var fs_extra=require(_0xaf8c('0x5'));var auth=require(_0xaf8c('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xaf8c('0x7'));router[_0xaf8c('0x8')]('/',auth[_0xaf8c('0x9')](),controller[_0xaf8c('0xa')]);router[_0xaf8c('0x8')](_0xaf8c('0xb'),auth[_0xaf8c('0x9')](),controller['describe']);router[_0xaf8c('0x8')]('/:id',auth[_0xaf8c('0x9')](),controller[_0xaf8c('0xc')]);router['get'](_0xaf8c('0xd'),auth[_0xaf8c('0x9')](),controller[_0xaf8c('0xe')]);router['get'](_0xaf8c('0xf'),auth[_0xaf8c('0x9')](),controller[_0xaf8c('0x10')]);router[_0xaf8c('0x11')]('/',auth[_0xaf8c('0x9')](),controller['create']);router[_0xaf8c('0x11')](_0xaf8c('0xd'),auth[_0xaf8c('0x9')](),controller[_0xaf8c('0x12')]);router[_0xaf8c('0x11')](_0xaf8c('0xf'),auth[_0xaf8c('0x9')](),controller[_0xaf8c('0x13')]);router[_0xaf8c('0x14')](_0xaf8c('0x15'),auth[_0xaf8c('0x9')](),controller[_0xaf8c('0x16')]);router[_0xaf8c('0x17')]('/:id',auth[_0xaf8c('0x9')](),controller[_0xaf8c('0x18')]);router['delete'](_0xaf8c('0xd'),auth['isAuthenticated'](),controller[_0xaf8c('0x19')]);router[_0xaf8c('0x17')](_0xaf8c('0xf'),auth['isAuthenticated'](),controller['removeTeams']);module[_0xaf8c('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index a699021..10bb7b8 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 _0xd5e1=['getDataValue','sequelize','exports','STRING','name','VIRTUAL','system-'];(function(_0x55dee1,_0x172927){var _0x1d6d61=function(_0x28e15d){while(--_0x28e15d){_0x55dee1['push'](_0x55dee1['shift']());}};_0x1d6d61(++_0x172927);}(_0xd5e1,0xcc));var _0x1d5e=function(_0x3e7d99,_0x17da8c){_0x3e7d99=_0x3e7d99-0x0;var _0x16d663=_0xd5e1[_0x3e7d99];return _0x16d663;};'use strict';var Sequelize=require(_0x1d5e('0x0'));module[_0x1d5e('0x1')]={'name':{'type':Sequelize[_0x1d5e('0x2')],'allowNull':![],'unique':_0x1d5e('0x3')},'prefix':{'type':Sequelize[_0x1d5e('0x4')],'get':function(_0x4cc61f){return _0x1d5e('0x5')+this[_0x1d5e('0x6')](_0x1d5e('0x3'))+'-';}},'description':{'type':Sequelize[_0x1d5e('0x2')]},'callerIdAll':{'type':Sequelize[_0x1d5e('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x272e=['INTEGER','sequelize','exports','STRING','name','VIRTUAL','system-'];(function(_0x5554e9,_0x32bebc){var _0x4732b3=function(_0x568578){while(--_0x568578){_0x5554e9['push'](_0x5554e9['shift']());}};_0x4732b3(++_0x32bebc);}(_0x272e,0xc5));var _0xe272=function(_0x291d8f,_0x57b3e6){_0x291d8f=_0x291d8f-0x0;var _0x2be4a7=_0x272e[_0x291d8f];return _0x2be4a7;};'use strict';var Sequelize=require(_0xe272('0x0'));module[_0xe272('0x1')]={'name':{'type':Sequelize[_0xe272('0x2')],'allowNull':![],'unique':_0xe272('0x3')},'prefix':{'type':Sequelize[_0xe272('0x4')],'get':function(_0x14d409){return _0xe272('0x5')+this['getDataValue'](_0xe272('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0xe272('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xe272('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index facd067..ce1e3f9 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 _0x2272=['Voice\x20Prefix\x20Extension','priority','NoOp','VoicePrefixId','prefix','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','goto','context','${EXTEN:','charAt','update','system-','findById','addAgents','ids','spread','emit','removeAgents','userVoicePrefix:remove','getAgents','User','order','pick','getTeams','findOne','addTeams','Team','Agents','online','voicePause','interface','flatMap','each','upsert','UserVoicePrefix','findOrCreate','forEach','userVoicePrefix:save','select','field','tq.TeamId','from','team_has_voice_prefixes','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','toString','SELECT','every','TeamId','includes','all','union','removeTeams','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./voicePrefix.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','stack','name','send','map','VoicePrefix','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoicePrefixes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','app','system','description'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x2272,0xd8));var _0x2227=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2272[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0x2227('0x0'));var rimraf=require(_0x2227('0x1'));var zipdir=require(_0x2227('0x2'));var jsonpatch=require(_0x2227('0x3'));var rp=require(_0x2227('0x4'));var moment=require('moment');var BPromise=require(_0x2227('0x5'));var Mustache=require(_0x2227('0x6'));var util=require(_0x2227('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x2227('0x8'));var ejs=require(_0x2227('0x9'));var fs=require('fs');var fs_extra=require(_0x2227('0xa'));var _=require(_0x2227('0xb'));var squel=require(_0x2227('0xc'));var crypto=require(_0x2227('0xd'));var jsforce=require(_0x2227('0xe'));var deskjs=require(_0x2227('0xf'));var toCsv=require(_0x2227('0x8'));var querystring=require(_0x2227('0x10'));var Papa=require('papaparse');var Redis=require(_0x2227('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2227('0x12'));var as=require(_0x2227('0x13'));var hardwareService=require(_0x2227('0x14'));var logger=require(_0x2227('0x15'))(_0x2227('0x16'));var utils=require('../../config/utils');var config=require(_0x2227('0x17'));var licenseUtil=require(_0x2227('0x18'));var db=require(_0x2227('0x19'))['db'];config[_0x2227('0x1a')]=_[_0x2227('0x1b')](config[_0x2227('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2227('0x1c'))['register'](socket);function respondWithStatusCode(_0x42f60b,_0xb631b0){_0xb631b0=_0xb631b0||0xcc;return function(_0x510b09){if(_0x510b09){return _0x42f60b[_0x2227('0x1d')](_0xb631b0);}return _0x42f60b[_0x2227('0x1e')](_0xb631b0)[_0x2227('0x1f')]();};}function respondWithResult(_0x43e174,_0x42a93c){_0x42a93c=_0x42a93c||0xc8;return function(_0x1e78a8){if(_0x1e78a8){return _0x43e174['status'](_0x42a93c)[_0x2227('0x20')](_0x1e78a8);}};}function respondWithFilteredResult(_0x1cf016,_0x162723){return function(_0x531f75){if(_0x531f75){var _0x11bf80=typeof _0x162723[_0x2227('0x21')]===_0x2227('0x22')&&typeof _0x162723[_0x2227('0x23')]===_0x2227('0x22');var _0x28e642=_0x531f75[_0x2227('0x24')];var _0x4e0bba=_0x11bf80?0x0:_0x162723[_0x2227('0x21')];var _0x59f988=_0x11bf80?_0x531f75[_0x2227('0x24')]:_0x162723[_0x2227('0x21')]+_0x162723[_0x2227('0x23')];var _0x1f28ef;if(_0x59f988>=_0x28e642){_0x59f988=_0x28e642;_0x1f28ef=0xc8;}else{_0x1f28ef=0xce;}_0x1cf016[_0x2227('0x1e')](_0x1f28ef);return _0x1cf016[_0x2227('0x25')](_0x2227('0x26'),_0x4e0bba+'-'+_0x59f988+'/'+_0x28e642)[_0x2227('0x20')](_0x531f75);}return null;};}function patchUpdates(_0x3299fd){return function(_0x34c090){try{jsonpatch[_0x2227('0x27')](_0x34c090,_0x3299fd,!![]);}catch(_0x5a454f){return BPromise[_0x2227('0x28')](_0x5a454f);}return _0x34c090[_0x2227('0x29')]();};}function saveUpdates(_0x5b3a09,_0x2cef4b){return function(_0xbfdce1){if(_0xbfdce1){return _0xbfdce1['update'](_0x5b3a09)['then'](function(_0x17c7a4){return _0x17c7a4;});}return null;};}function removeEntity(_0xa4d18b,_0x35333f){return function(_0x1f30c3){if(_0x1f30c3){return _0x1f30c3['destroy']()[_0x2227('0x2a')](function(){var _0x301304=_0x1f30c3[_0x2227('0x2b')]({'plain':!![]});var _0x1957ee='VoicePrefixes';return db[_0x2227('0x2c')][_0x2227('0x2d')]({'where':{'type':_0x1957ee,'resourceId':_0x301304['id']}})[_0x2227('0x2a')](function(){return _0x1f30c3;});})[_0x2227('0x2a')](function(){_0xa4d18b[_0x2227('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55015e,_0x5d1d56){return function(_0x2dc38d){if(!_0x2dc38d){_0x55015e['sendStatus'](0x194);}return _0x2dc38d;};}function handleError(_0x2ba581,_0x1979d8){_0x1979d8=_0x1979d8||0x1f4;return function(_0x58609e){logger['error'](_0x58609e[_0x2227('0x2e')]);if(_0x58609e[_0x2227('0x2f')]){delete _0x58609e[_0x2227('0x2f')];}_0x2ba581['status'](_0x1979d8)[_0x2227('0x30')](_0x58609e);};}exports['index']=function(_0xaa2bbb,_0x3f108b){var _0x28ad1c={},_0xfa2140={},_0x155095={'count':0x0,'rows':[]};var _0x256b7b=_[_0x2227('0x31')](db[_0x2227('0x32')][_0x2227('0x33')],function(_0x781f79){return{'name':_0x781f79[_0x2227('0x34')],'type':_0x781f79['type'][_0x2227('0x35')]};});_0xfa2140[_0x2227('0x36')]=_[_0x2227('0x31')](_0x256b7b,_0x2227('0x2f'));_0xfa2140['query']=_[_0x2227('0x37')](_0xaa2bbb[_0x2227('0x38')]);_0xfa2140[_0x2227('0x39')]=_[_0x2227('0x3a')](_0xfa2140['model'],_0xfa2140[_0x2227('0x38')]);_0x28ad1c[_0x2227('0x3b')]=_[_0x2227('0x3a')](_0xfa2140['model'],qs['fields'](_0xaa2bbb[_0x2227('0x38')][_0x2227('0x3c')]));_0x28ad1c['attributes']=_0x28ad1c[_0x2227('0x3b')][_0x2227('0x3d')]?_0x28ad1c['attributes']:_0xfa2140[_0x2227('0x36')];if(!_0xaa2bbb['query'][_0x2227('0x3e')](_0x2227('0x3f'))){_0x28ad1c[_0x2227('0x23')]=qs[_0x2227('0x23')](_0xaa2bbb['query'][_0x2227('0x23')]);_0x28ad1c['offset']=qs[_0x2227('0x21')](_0xaa2bbb[_0x2227('0x38')][_0x2227('0x21')]);}_0x28ad1c['order']=qs[_0x2227('0x40')](_0xaa2bbb[_0x2227('0x38')][_0x2227('0x40')]);_0x28ad1c[_0x2227('0x41')]=qs[_0x2227('0x39')](_['pick'](_0xaa2bbb['query'],_0xfa2140[_0x2227('0x39')]),_0x256b7b);if(_0xaa2bbb['query'][_0x2227('0x42')]){_0x28ad1c[_0x2227('0x41')]=_[_0x2227('0x43')](_0x28ad1c[_0x2227('0x41')],{'$or':_[_0x2227('0x31')](_0x256b7b,function(_0xd08cd8){if(_0xd08cd8[_0x2227('0x44')]!==_0x2227('0x45')){var _0x5688b5={};_0x5688b5[_0xd08cd8[_0x2227('0x2f')]]={'$like':'%'+_0xaa2bbb['query'][_0x2227('0x42')]+'%'};return _0x5688b5;}})});}_0x28ad1c=_['merge']({},_0x28ad1c,_0xaa2bbb[_0x2227('0x46')]);var _0x59afc0={'where':_0x28ad1c[_0x2227('0x41')]};return db['VoicePrefix'][_0x2227('0x24')](_0x59afc0)[_0x2227('0x2a')](function(_0x46eb0f){_0x155095[_0x2227('0x24')]=_0x46eb0f;if(_0xaa2bbb[_0x2227('0x38')][_0x2227('0x47')]){_0x28ad1c['include']=[{'all':!![]}];}return db['VoicePrefix'][_0x2227('0x48')](_0x28ad1c);})['then'](function(_0x3552db){_0x155095['rows']=_0x3552db;return _0x155095;})[_0x2227('0x2a')](respondWithFilteredResult(_0x3f108b,_0x28ad1c))[_0x2227('0x49')](handleError(_0x3f108b,null));};exports[_0x2227('0x4a')]=function(_0xa3ae06,_0x3f9787){var _0x2871a6={'raw':![],'where':{'id':_0xa3ae06[_0x2227('0x4b')]['id']}},_0x5f5880={};_0x5f5880[_0x2227('0x36')]=_[_0x2227('0x37')](db[_0x2227('0x32')][_0x2227('0x33')]);_0x5f5880[_0x2227('0x38')]=_[_0x2227('0x37')](_0xa3ae06[_0x2227('0x38')]);_0x5f5880['filters']=_[_0x2227('0x3a')](_0x5f5880[_0x2227('0x36')],_0x5f5880[_0x2227('0x38')]);_0x2871a6[_0x2227('0x3b')]=_['intersection'](_0x5f5880[_0x2227('0x36')],qs[_0x2227('0x3c')](_0xa3ae06['query'][_0x2227('0x3c')]));_0x2871a6[_0x2227('0x3b')]=_0x2871a6[_0x2227('0x3b')][_0x2227('0x3d')]?_0x2871a6[_0x2227('0x3b')]:_0x5f5880[_0x2227('0x36')];if(_0xa3ae06[_0x2227('0x38')]['includeAll']){_0x2871a6[_0x2227('0x4c')]=[{'all':!![]}];}_0x2871a6=_[_0x2227('0x43')]({},_0x2871a6,_0xa3ae06['options']);return db[_0x2227('0x32')]['find'](_0x2871a6)[_0x2227('0x2a')](handleEntityNotFound(_0x3f9787,null))[_0x2227('0x2a')](respondWithResult(_0x3f9787,null))[_0x2227('0x49')](handleError(_0x3f9787,null));};exports[_0x2227('0x2d')]=function(_0x5387fc,_0x4e12c7){return db['VoicePrefix'][_0x2227('0x4d')]({'where':{'id':_0x5387fc[_0x2227('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4e12c7,null))[_0x2227('0x2a')](removeEntity(_0x4e12c7,null))[_0x2227('0x49')](handleError(_0x4e12c7,null));};exports[_0x2227('0x4e')]=function(_0x39166b,_0x4ee23c){return db['VoicePrefix'][_0x2227('0x4e')]()[_0x2227('0x2a')](respondWithResult(_0x4ee23c,null))[_0x2227('0x49')](handleError(_0x4ee23c,null));};exports[_0x2227('0x4f')]=function(_0x597f00,_0x26581d){var _0x443933;return db[_0x2227('0x50')][_0x2227('0x51')](function(_0x125fa8){return db[_0x2227('0x32')][_0x2227('0x4f')](_0x597f00[_0x2227('0x52')],{'transaction':_0x125fa8})[_0x2227('0x2a')](function(_0x418ec4){_0x443933=_0x418ec4[_0x2227('0x2b')]({'plain':!![]});return db[_0x2227('0x53')][_0x2227('0x4d')]({'where':{'id':_0x443933[_0x2227('0x54')]},'raw':!![]})[_0x2227('0x2a')](function(_0x10c21a){return createVoicePrefixExtensions(_0x443933,_0x10c21a,_0x125fa8);});});})['then'](function(){var _0xc176c9=_0x597f00[_0x2227('0x55')]['get']({'plain':!![]});if(!_0xc176c9)throw new Error(_0x2227('0x56'));if(_0xc176c9[_0x2227('0x57')]===_0x2227('0x55')){var _0x4e8622=_0x443933;return db['UserProfileSection']['find']({'where':{'name':_0x2227('0x58'),'userProfileId':_0xc176c9[_0x2227('0x59')]},'raw':!![]})['then'](function(_0x2171b1){if(_0x2171b1&&_0x2171b1[_0x2227('0x5a')]===0x0){return db[_0x2227('0x2c')]['create']({'name':_0x4e8622[_0x2227('0x2f')],'resourceId':_0x4e8622['id'],'type':_0x2171b1[_0x2227('0x2f')],'sectionId':_0x2171b1['id']},{})['then'](function(){return _0x443933;});}else{return _0x443933;}})[_0x2227('0x49')](function(_0x1f02be){logger['error'](_0x2227('0x5b'),_0x1f02be);throw _0x1f02be;});}return _0x443933;})[_0x2227('0x2a')](respondWithResult(_0x26581d,null))[_0x2227('0x49')](handleError(_0x26581d,null));};function Extension(_0x1ab7e0,_0x300741,_0x118225,_0x52861f){this['context']=_0x2227('0x5c');this['exten']=_0x1ab7e0;this[_0x2227('0x5d')]=_0x118225;this['type']=_0x2227('0x5e');this[_0x2227('0x5f')]=_0x2227('0x60');this[_0x2227('0x61')]=_0x300741;this['appdata']=_0x52861f;}function createVoicePrefixExtensions(_0x44a025,_0x41359a,_0x10df84){return new BPromise(function(_0x1ec0db,_0x30fbd8){var _0x4fdb8d=new Extension(formatPrefixName(_0x44a025['prefix']),0x1,_0x2227('0x62'),'Voice\x20Prefix');_0x4fdb8d[_0x2227('0x63')]=_0x44a025['id'];return db[_0x2227('0x53')]['create'](_0x4fdb8d,{'transaction':_0x10df84})['then'](function(_0x1aa091){var _0x335798=_0x1aa091[_0x2227('0x2b')]({'plain':!![]});var _0x2f6d49=_[_0x2227('0x31')](addVoicePrefixExtensions(_0x44a025,_0x41359a),function(_0x119d39){_0x119d39[_0x2227('0x54')]=_0x335798['id'];_0x119d39[_0x2227('0x63')]=_0x44a025['id'];return _0x119d39;});return db[_0x2227('0x53')]['bulkCreate'](_0x2f6d49,{'transaction':_0x10df84})[_0x2227('0x2a')](function(_0x1d0e87){if(!_0x1d0e87){return _0x30fbd8('Extensions\x20creation\x20failed');}else{return _0x1ec0db(_0x1d0e87);}})[_0x2227('0x49')](function(_0x108605){return _0x30fbd8(_0x108605);});});;});};function addVoicePrefixExtensions(_0x1b2634,_0x5a41d9){var _0x215fb2=[];var _0xfa23f1=formatPrefixName(_0x1b2634[_0x2227('0x64')]);_0x215fb2[_0x2227('0x65')](new Extension(_0xfa23f1,0x2,_0x2227('0x66'),_0x2227('0x67')+_0x1b2634[_0x2227('0x2f')]));if(_0x1b2634[_0x2227('0x68')]){_0x215fb2[_0x2227('0x65')](new Extension(_0xfa23f1,0x3,_0x2227('0x66'),_0x2227('0x69')+_0x1b2634[_0x2227('0x68')]));}else{_0x215fb2[_0x2227('0x65')](new Extension(_0xfa23f1,0x3,_0x2227('0x62'),'No\x20callerid\x20available'));}_0x215fb2[_0x2227('0x65')](new Extension(_0xfa23f1,0x4,_0x2227('0x6a'),_0x5a41d9[_0x2227('0x6b')]+','+_0x2227('0x6c')+(0x8+_0x1b2634[_0x2227('0x2f')][_0x2227('0x3d')])+'}'+','+0x1));return _0x215fb2;}function formatPrefixName(_0x1e7779){var _0x4633d8='_';for(var _0x4e0ca2=0x0;_0x4e0ca2<_0x1e7779[_0x2227('0x3d')];_0x4e0ca2++){if(_0x1e7779[_0x2227('0x6d')](_0x4e0ca2)=='-'){_0x4633d8+=_0x1e7779[_0x2227('0x6d')](_0x4e0ca2);}else{_0x4633d8+='['+_0x1e7779['charAt'](_0x4e0ca2)+']';}}_0x4633d8+='.';return _0x4633d8;}exports[_0x2227('0x6e')]=function(_0x4258a3,_0x24b5b0,_0x5bd233){var _0x398d76=_0x4258a3['body'];_0x398d76[_0x2227('0x64')]=_0x2227('0x6f')+_0x398d76[_0x2227('0x2f')]+'-';return db[_0x2227('0x50')]['transaction'](function(_0x3a34d8){return db[_0x2227('0x32')]['update'](_0x398d76,{'where':{'id':_0x398d76['id']},'transaction':_0x3a34d8})['then'](function(){return db[_0x2227('0x53')][_0x2227('0x2d')]({'where':{'VoicePrefixId':_0x398d76['id']},'transaction':_0x3a34d8})[_0x2227('0x2a')](function(){return db[_0x2227('0x53')][_0x2227('0x4d')]({'where':{'id':_0x398d76[_0x2227('0x54')]},'raw':!![]})[_0x2227('0x2a')](function(_0x36a85a){return createVoicePrefixExtensions(_0x398d76,_0x36a85a,_0x3a34d8);});});});})['then'](function(){return db[_0x2227('0x32')][_0x2227('0x70')](_0x398d76['id']);})[_0x2227('0x2a')](respondWithResult(_0x24b5b0,null))['catch'](handleError(_0x24b5b0,null));};exports['addAgents']=function(_0x5147fe,_0xf3038b,_0x57b27a){return db[_0x2227('0x32')][_0x2227('0x4d')]({'where':{'id':_0x5147fe[_0x2227('0x4b')]['id']}})[_0x2227('0x2a')](handleEntityNotFound(_0xf3038b,null))[_0x2227('0x2a')](function(_0x2435d0){if(_0x2435d0){return _0x2435d0[_0x2227('0x71')](_0x5147fe[_0x2227('0x52')][_0x2227('0x72')],_['omit'](_0x5147fe[_0x2227('0x52')],[_0x2227('0x72'),'id'])||{})[_0x2227('0x73')](function(_0x58e3ee){for(var _0x22a30f=0x0;_0x22a30f<_0x5147fe[_0x2227('0x52')]['ids']['length'];_0x22a30f+=0x1){socket[_0x2227('0x74')]('userVoicePrefix:save',{'UserId':Number(_0x5147fe[_0x2227('0x52')][_0x2227('0x72')][_0x22a30f]),'VoicePrefixId':Number(_0x5147fe[_0x2227('0x4b')]['id'])});}return _0x58e3ee;});}})[_0x2227('0x2a')](respondWithResult(_0xf3038b,null))[_0x2227('0x49')](handleError(_0xf3038b,null));};exports['removeAgents']=function(_0x9b431a,_0x128e74,_0x770f98){return db[_0x2227('0x32')]['find']({'where':{'id':_0x9b431a[_0x2227('0x4b')]['id']}})[_0x2227('0x2a')](handleEntityNotFound(_0x128e74,null))['then'](function(_0x5af36d){if(_0x5af36d){return _0x5af36d[_0x2227('0x75')](_0x9b431a[_0x2227('0x38')][_0x2227('0x72')])['then'](function(){if(_['isArray'](_0x9b431a[_0x2227('0x38')][_0x2227('0x72')])){for(var _0x13cd17=0x0;_0x13cd17<_0x9b431a[_0x2227('0x38')]['ids']['length'];_0x13cd17+=0x1){socket[_0x2227('0x74')]('userVoicePrefix:remove',{'UserId':Number(_0x9b431a[_0x2227('0x38')][_0x2227('0x72')][_0x13cd17]),'VoicePrefixId':Number(_0x9b431a[_0x2227('0x4b')]['id'])});}}else{socket['emit'](_0x2227('0x76'),{'UserId':Number(_0x9b431a['query'][_0x2227('0x72')]),'VoicePrefixId':Number(_0x9b431a[_0x2227('0x4b')]['id'])});}});}})[_0x2227('0x2a')](respondWithStatusCode(_0x128e74,null))[_0x2227('0x49')](handleError(_0x128e74,null));};exports[_0x2227('0x77')]=function(_0x190760,_0x2eea42,_0x9364ec){var _0x50c689={};var _0x266f3b={};var _0x3e2219;var _0x1f0fc8;return db['VoicePrefix']['findOne']({'where':{'id':_0x190760[_0x2227('0x4b')]['id']}})[_0x2227('0x2a')](handleEntityNotFound(_0x2eea42,null))[_0x2227('0x2a')](function(_0x5daa8b){if(_0x5daa8b){_0x3e2219=_0x5daa8b;_0x266f3b[_0x2227('0x36')]=_['keys'](db[_0x2227('0x78')]['rawAttributes']);_0x266f3b[_0x2227('0x38')]=_[_0x2227('0x37')](_0x190760['query']);_0x266f3b[_0x2227('0x39')]=_[_0x2227('0x3a')](_0x266f3b[_0x2227('0x36')],_0x266f3b[_0x2227('0x38')]);_0x50c689[_0x2227('0x3b')]=_[_0x2227('0x3a')](_0x266f3b['model'],qs['fields'](_0x190760[_0x2227('0x38')][_0x2227('0x3c')]));_0x50c689[_0x2227('0x3b')]=_0x50c689[_0x2227('0x3b')]['length']?_0x50c689['attributes']:_0x266f3b[_0x2227('0x36')];_0x50c689[_0x2227('0x79')]=qs[_0x2227('0x40')](_0x190760['query']['sort']);_0x50c689[_0x2227('0x41')]=qs[_0x2227('0x39')](_[_0x2227('0x7a')](_0x190760[_0x2227('0x38')],_0x266f3b[_0x2227('0x39')]));if(_0x190760[_0x2227('0x38')][_0x2227('0x42')]){_0x50c689[_0x2227('0x41')]=_[_0x2227('0x43')](_0x50c689['where'],{'$or':_['map'](_0x50c689[_0x2227('0x3b')],function(_0x5732e5){var _0x5f1ade={};_0x5f1ade[_0x5732e5]={'$like':'%'+_0x190760[_0x2227('0x38')]['filter']+'%'};return _0x5f1ade;})});}_0x50c689=_[_0x2227('0x43')]({},_0x50c689,_0x190760[_0x2227('0x46')]);return _0x3e2219['getAgents'](_0x50c689);}})[_0x2227('0x2a')](function(_0x3174ef){if(_0x3174ef){_0x1f0fc8=_0x3174ef[_0x2227('0x3d')];if(!_0x190760['query'][_0x2227('0x3e')]('nolimit')){_0x50c689['limit']=qs[_0x2227('0x23')](_0x190760['query'][_0x2227('0x23')]);_0x50c689[_0x2227('0x21')]=qs[_0x2227('0x21')](_0x190760['query'][_0x2227('0x21')]);}return _0x3e2219[_0x2227('0x77')](_0x50c689);}})[_0x2227('0x2a')](function(_0x467380){if(_0x467380){return _0x467380?{'count':_0x1f0fc8,'rows':_0x467380}:null;}})['then'](respondWithResult(_0x2eea42,null))['catch'](handleError(_0x2eea42,null));};exports[_0x2227('0x7b')]=function(_0x3b653f,_0x35c9ea,_0x2e4a1b){var _0x4cd27e={};var _0x1a2852={};var _0x4599ab;var _0x3d592a;return db[_0x2227('0x32')][_0x2227('0x7c')]({'where':{'id':_0x3b653f[_0x2227('0x4b')]['id']}})[_0x2227('0x2a')](handleEntityNotFound(_0x35c9ea,null))['then'](function(_0x524e6a){if(_0x524e6a){_0x4599ab=_0x524e6a;_0x1a2852[_0x2227('0x36')]=_[_0x2227('0x37')](db['Team'][_0x2227('0x33')]);_0x1a2852[_0x2227('0x38')]=_[_0x2227('0x37')](_0x3b653f[_0x2227('0x38')]);_0x1a2852['filters']=_[_0x2227('0x3a')](_0x1a2852['model'],_0x1a2852['query']);_0x4cd27e[_0x2227('0x3b')]=_[_0x2227('0x3a')](_0x1a2852[_0x2227('0x36')],qs[_0x2227('0x3c')](_0x3b653f[_0x2227('0x38')][_0x2227('0x3c')]));_0x4cd27e[_0x2227('0x3b')]=_0x4cd27e[_0x2227('0x3b')][_0x2227('0x3d')]?_0x4cd27e['attributes']:_0x1a2852[_0x2227('0x36')];_0x4cd27e[_0x2227('0x79')]=qs[_0x2227('0x40')](_0x3b653f[_0x2227('0x38')][_0x2227('0x40')]);_0x4cd27e['where']=qs[_0x2227('0x39')](_['pick'](_0x3b653f[_0x2227('0x38')],_0x1a2852[_0x2227('0x39')]));if(_0x3b653f[_0x2227('0x38')][_0x2227('0x42')]){_0x4cd27e[_0x2227('0x41')]=_[_0x2227('0x43')](_0x4cd27e[_0x2227('0x41')],{'$or':_[_0x2227('0x31')](_0x4cd27e['attributes'],function(_0x1686d7){var _0x30101f={};_0x30101f[_0x1686d7]={'$like':'%'+_0x3b653f[_0x2227('0x38')]['filter']+'%'};return _0x30101f;})});}_0x4cd27e=_[_0x2227('0x43')]({},_0x4cd27e,_0x3b653f[_0x2227('0x46')]);return _0x4599ab['getTeams'](_0x4cd27e);}})[_0x2227('0x2a')](function(_0x386b5d){if(_0x386b5d){_0x3d592a=_0x386b5d['length'];if(!_0x3b653f[_0x2227('0x38')][_0x2227('0x3e')](_0x2227('0x3f'))){_0x4cd27e[_0x2227('0x23')]=qs[_0x2227('0x23')](_0x3b653f[_0x2227('0x38')][_0x2227('0x23')]);_0x4cd27e[_0x2227('0x21')]=qs['offset'](_0x3b653f[_0x2227('0x38')][_0x2227('0x21')]);}return _0x4599ab[_0x2227('0x7b')](_0x4cd27e);}})[_0x2227('0x2a')](function(_0x172b34){if(_0x172b34){return _0x172b34?{'count':_0x3d592a,'rows':_0x172b34}:null;}})[_0x2227('0x2a')](respondWithResult(_0x35c9ea,null))['catch'](handleError(_0x35c9ea,null));};exports[_0x2227('0x7d')]=function(_0x2ffe4f,_0x28d3ca,_0x20def8){var _0x42787b=_0x2ffe4f[_0x2227('0x52')][_0x2227('0x72')];var _0x2cf763;return db[_0x2227('0x7e')][_0x2227('0x48')]({'where':{'id':_0x42787b},'attributes':['id'],'include':[{'model':db[_0x2227('0x78')],'as':_0x2227('0x7f'),'attributes':['id','name',_0x2227('0x80'),_0x2227('0x81'),_0x2227('0x82')],'raw':!![]}]})[_0x2227('0x2a')](function(_0x43af43){if(_0x43af43){_0x2cf763=_0x43af43;var _0x1766e5=_[_0x2227('0x83')](_0x43af43,function(_0x2fdf17){var _0x38e805=_0x2fdf17[_0x2227('0x2b')]({'plain':!![]});return _0x38e805['Agents'];});return db[_0x2227('0x32')][_0x2227('0x4d')]({'where':{'id':_0x2ffe4f[_0x2227('0x4b')]['id']}})[_0x2227('0x2a')](function(_0x2fdc19){return db[_0x2227('0x50')][_0x2227('0x51')](function(_0x3f7d5d){return _0x2fdc19['addTeams'](_0x42787b,{'transaction':_0x3f7d5d})[_0x2227('0x2a')](function(){return BPromise[_0x2227('0x84')](_0x2cf763,function(_0x36492d){return db['TeamVoicePrefix'][_0x2227('0x85')]({'TeamId':_0x36492d['id'],'VoicePrefixId':_0x2ffe4f[_0x2227('0x4b')]['id']},{'transaction':_0x3f7d5d});});})['then'](function(){return BPromise[_0x2227('0x84')](_0x1766e5,function(_0x2fb89b){return db[_0x2227('0x86')][_0x2227('0x87')]({'where':{'UserId':_0x2fb89b['id'],'VoicePrefixId':_0x2ffe4f[_0x2227('0x4b')]['id']},'transaction':_0x3f7d5d});});})['then'](function(){_0x1766e5[_0x2227('0x88')](function(_0x12fabe){socket[_0x2227('0x74')](_0x2227('0x89'),{'UserId':_0x12fabe['id'],'VoicePrefixId':_0x2fdc19['id']});});});});});}})[_0x2227('0x2a')](respondWithStatusCode(_0x28d3ca,null))['catch'](handleError(_0x28d3ca,null));};exports['removeTeams']=function(_0x2e153f,_0x312033,_0x1c557d){return db['Team']['findAll']({'where':{'id':_0x2e153f['query'][_0x2227('0x72')]},'attributes':['id'],'include':[{'model':db[_0x2227('0x78')],'as':_0x2227('0x7f'),'attributes':['id'],'raw':!![]}]})[_0x2227('0x2a')](handleEntityNotFound(_0x312033,null))[_0x2227('0x2a')](function(_0x3e5597){var _0x3f58d2=_['map'](_0x3e5597,'id');var _0x2930e9=[];var _0x4505ab=[];var _0x2824b1=squel[_0x2227('0x8a')]();_0x2824b1[_0x2227('0x8b')](_0x2227('0x8c'))[_0x2227('0x8d')](_0x2227('0x8e'),'tq')[_0x2227('0x8f')]('user_has_teams','ut',_0x2227('0x90'))[_0x2227('0x41')](_0x2227('0x91'),_0x2e153f[_0x2227('0x4b')]['id']);for(var _0x3b5b07=0x0;_0x3b5b07<_0x3e5597[_0x2227('0x3d')];_0x3b5b07+=0x1){let _0x19608d=_0x3e5597[_0x3b5b07];for(var _0x5008cc=0x0;_0x5008cc<_0x19608d[_0x2227('0x7f')][_0x2227('0x3d')];_0x5008cc+=0x1){let _0x15b3c4=_0x19608d[_0x2227('0x7f')][_0x5008cc];var _0x1a0805=_0x2824b1[_0x2227('0x92')]();_0x1a0805[_0x2227('0x41')]('ut.UserId\x20=\x20?',_0x15b3c4['id']);_0x4505ab[_0x2227('0x65')](db[_0x2227('0x50')][_0x2227('0x38')](_0x1a0805[_0x2227('0x93')](),{'type':db[_0x2227('0x50')]['QueryTypes'][_0x2227('0x94')]})[_0x2227('0x2a')](function(_0x4f822c){if(_0x4f822c['length']===0x1){return _0x15b3c4['id'];}else{var _0x1bab79=_[_0x2227('0x95')](_[_0x2227('0x31')](_0x4f822c,_0x2227('0x96')),function(_0x26c479){return _[_0x2227('0x97')](_0x3f58d2,_0x26c479);});if(_0x1bab79){return _0x15b3c4['id'];}}}));}}return BPromise[_0x2227('0x98')](_0x4505ab)['then'](function(_0x54db70){_0x2930e9=_(_0x2930e9)[_0x2227('0x99')](_0x54db70)['compact']()['value']();return db[_0x2227('0x32')][_0x2227('0x4d')]({'where':{'id':_0x2e153f[_0x2227('0x4b')]['id']}})[_0x2227('0x2a')](function(_0x152b89){return db[_0x2227('0x50')]['transaction'](function(_0x360f72){return _0x152b89[_0x2227('0x9a')](_0x2e153f['query'][_0x2227('0x72')],{'transaction':_0x360f72})[_0x2227('0x2a')](function(){if(!_[_0x2227('0x9b')](_0x2930e9)){return _0x152b89[_0x2227('0x75')](_0x2930e9,{'transaction':_0x360f72});}})[_0x2227('0x2a')](function(){_0x2930e9[_0x2227('0x88')](function(_0x66aa39){socket[_0x2227('0x74')](_0x2227('0x76'),{'UserId':_0x66aa39,'VoicePrefixId':_0x152b89['id']});});});});});});})[_0x2227('0x2a')](respondWithStatusCode(_0x312033,null))['catch'](handleError(_0x312033,null));}; \ No newline at end of file +var _0xb44a=['../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','VoicePrefixes','destroy','end','error','name','index','map','VoicePrefix','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','exten','app','system','description','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','prefix','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','pick','getAgents','getTeams','nolimit','addTeams','Team','Agents','online','voicePause','interface','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','select','field','tq.TeamId','from','team_has_voice_prefixes','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','SELECT','every','includes','all','union','removeTeams','isEmpty','zip-dir','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x470bfb,_0x389787){var _0x2f5d97=function(_0x3431b4){while(--_0x3431b4){_0x470bfb['push'](_0x470bfb['shift']());}};_0x2f5d97(++_0x389787);}(_0xb44a,0x1c2));var _0xab44=function(_0x2f2360,_0x151089){_0x2f2360=_0x2f2360-0x0;var _0x1cc8d3=_0xb44a[_0x2f2360];return _0x1cc8d3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xab44('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab44('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xab44('0x2'));var util=require('util');var path=require(_0xab44('0x3'));var sox=require(_0xab44('0x4'));var csv=require(_0xab44('0x5'));var ejs=require(_0xab44('0x6'));var fs=require('fs');var fs_extra=require(_0xab44('0x7'));var _=require(_0xab44('0x8'));var squel=require(_0xab44('0x9'));var crypto=require(_0xab44('0xa'));var jsforce=require(_0xab44('0xb'));var deskjs=require(_0xab44('0xc'));var toCsv=require(_0xab44('0x5'));var querystring=require(_0xab44('0xd'));var Papa=require(_0xab44('0xe'));var Redis=require('ioredis');var authService=require(_0xab44('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xab44('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xab44('0x11'));var utils=require(_0xab44('0x12'));var config=require(_0xab44('0x13'));var licenseUtil=require(_0xab44('0x14'));var db=require(_0xab44('0x15'))['db'];config[_0xab44('0x16')]=_['defaults'](config['redis'],{'host':_0xab44('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xab44('0x16')]));require('./voicePrefix.socket')[_0xab44('0x18')](socket);function respondWithStatusCode(_0x15b98a,_0x344e6b){_0x344e6b=_0x344e6b||0xcc;return function(_0x384f02){if(_0x384f02){return _0x15b98a[_0xab44('0x19')](_0x344e6b);}return _0x15b98a[_0xab44('0x1a')](_0x344e6b)['end']();};}function respondWithResult(_0x51251b,_0x44c85e){_0x44c85e=_0x44c85e||0xc8;return function(_0x272a5b){if(_0x272a5b){return _0x51251b[_0xab44('0x1a')](_0x44c85e)[_0xab44('0x1b')](_0x272a5b);}};}function respondWithFilteredResult(_0xffdfbc,_0x5fd6a1){return function(_0x354b09){if(_0x354b09){var _0x44fa43=typeof _0x5fd6a1[_0xab44('0x1c')]===_0xab44('0x1d')&&typeof _0x5fd6a1[_0xab44('0x1e')]==='undefined';var _0xb779bb=_0x354b09[_0xab44('0x1f')];var _0x101a1b=_0x44fa43?0x0:_0x5fd6a1[_0xab44('0x1c')];var _0x29bb73=_0x44fa43?_0x354b09['count']:_0x5fd6a1[_0xab44('0x1c')]+_0x5fd6a1['limit'];var _0x1f7311;if(_0x29bb73>=_0xb779bb){_0x29bb73=_0xb779bb;_0x1f7311=0xc8;}else{_0x1f7311=0xce;}_0xffdfbc[_0xab44('0x1a')](_0x1f7311);return _0xffdfbc[_0xab44('0x20')](_0xab44('0x21'),_0x101a1b+'-'+_0x29bb73+'/'+_0xb779bb)['json'](_0x354b09);}return null;};}function patchUpdates(_0x3a2b1d){return function(_0x26fc03){try{jsonpatch[_0xab44('0x22')](_0x26fc03,_0x3a2b1d,!![]);}catch(_0x3b17d5){return BPromise[_0xab44('0x23')](_0x3b17d5);}return _0x26fc03[_0xab44('0x24')]();};}function saveUpdates(_0x43f1c6,_0x554955){return function(_0x595761){if(_0x595761){return _0x595761[_0xab44('0x25')](_0x43f1c6)['then'](function(_0x2439f3){return _0x2439f3;});}return null;};}function removeEntity(_0x5a7269,_0x2a1bbc){return function(_0x5ac42f){if(_0x5ac42f){return _0x5ac42f['destroy']()[_0xab44('0x26')](function(){var _0x25287b=_0x5ac42f[_0xab44('0x27')]({'plain':!![]});var _0x4620ed=_0xab44('0x28');return db['UserProfileResource'][_0xab44('0x29')]({'where':{'type':_0x4620ed,'resourceId':_0x25287b['id']}})[_0xab44('0x26')](function(){return _0x5ac42f;});})['then'](function(){_0x5a7269[_0xab44('0x1a')](0xcc)[_0xab44('0x2a')]();});}};}function handleEntityNotFound(_0x21131e,_0x1cd486){return function(_0x4550c8){if(!_0x4550c8){_0x21131e[_0xab44('0x19')](0x194);}return _0x4550c8;};}function handleError(_0x59f844,_0x22f28e){_0x22f28e=_0x22f28e||0x1f4;return function(_0x43a42d){logger[_0xab44('0x2b')](_0x43a42d['stack']);if(_0x43a42d['name']){delete _0x43a42d[_0xab44('0x2c')];}_0x59f844['status'](_0x22f28e)['send'](_0x43a42d);};}exports[_0xab44('0x2d')]=function(_0x2f8a1d,_0x160177){var _0x1e9715={},_0x1192a8={},_0x475f09={'count':0x0,'rows':[]};var _0x17e4ea=_[_0xab44('0x2e')](db[_0xab44('0x2f')][_0xab44('0x30')],function(_0x43aa7f){return{'name':_0x43aa7f[_0xab44('0x31')],'type':_0x43aa7f[_0xab44('0x32')][_0xab44('0x33')]};});_0x1192a8['model']=_['map'](_0x17e4ea,_0xab44('0x2c'));_0x1192a8[_0xab44('0x34')]=_['keys'](_0x2f8a1d[_0xab44('0x34')]);_0x1192a8[_0xab44('0x35')]=_[_0xab44('0x36')](_0x1192a8[_0xab44('0x37')],_0x1192a8[_0xab44('0x34')]);_0x1e9715[_0xab44('0x38')]=_[_0xab44('0x36')](_0x1192a8[_0xab44('0x37')],qs[_0xab44('0x39')](_0x2f8a1d[_0xab44('0x34')][_0xab44('0x39')]));_0x1e9715[_0xab44('0x38')]=_0x1e9715[_0xab44('0x38')][_0xab44('0x3a')]?_0x1e9715[_0xab44('0x38')]:_0x1192a8[_0xab44('0x37')];if(!_0x2f8a1d[_0xab44('0x34')][_0xab44('0x3b')]('nolimit')){_0x1e9715[_0xab44('0x1e')]=qs[_0xab44('0x1e')](_0x2f8a1d[_0xab44('0x34')][_0xab44('0x1e')]);_0x1e9715['offset']=qs[_0xab44('0x1c')](_0x2f8a1d[_0xab44('0x34')][_0xab44('0x1c')]);}_0x1e9715[_0xab44('0x3c')]=qs[_0xab44('0x3d')](_0x2f8a1d['query'][_0xab44('0x3d')]);_0x1e9715[_0xab44('0x3e')]=qs[_0xab44('0x35')](_['pick'](_0x2f8a1d[_0xab44('0x34')],_0x1192a8[_0xab44('0x35')]),_0x17e4ea);if(_0x2f8a1d[_0xab44('0x34')][_0xab44('0x3f')]){_0x1e9715[_0xab44('0x3e')]=_['merge'](_0x1e9715[_0xab44('0x3e')],{'$or':_['map'](_0x17e4ea,function(_0x8b55da){if(_0x8b55da['type']!=='VIRTUAL'){var _0x5aa438={};_0x5aa438[_0x8b55da['name']]={'$like':'%'+_0x2f8a1d['query'][_0xab44('0x3f')]+'%'};return _0x5aa438;}})});}_0x1e9715=_[_0xab44('0x40')]({},_0x1e9715,_0x2f8a1d[_0xab44('0x41')]);var _0x1aec00={'where':_0x1e9715[_0xab44('0x3e')]};return db[_0xab44('0x2f')][_0xab44('0x1f')](_0x1aec00)[_0xab44('0x26')](function(_0x4429e6){_0x475f09[_0xab44('0x1f')]=_0x4429e6;if(_0x2f8a1d['query'][_0xab44('0x42')]){_0x1e9715[_0xab44('0x43')]=[{'all':!![]}];}return db[_0xab44('0x2f')][_0xab44('0x44')](_0x1e9715);})['then'](function(_0x3e9a79){_0x475f09[_0xab44('0x45')]=_0x3e9a79;return _0x475f09;})[_0xab44('0x26')](respondWithFilteredResult(_0x160177,_0x1e9715))[_0xab44('0x46')](handleError(_0x160177,null));};exports[_0xab44('0x47')]=function(_0x436cd8,_0x4d4421){var _0x5bb256={'raw':![],'where':{'id':_0x436cd8[_0xab44('0x48')]['id']}},_0x2dd6f8={};_0x2dd6f8[_0xab44('0x37')]=_[_0xab44('0x49')](db[_0xab44('0x2f')]['rawAttributes']);_0x2dd6f8[_0xab44('0x34')]=_[_0xab44('0x49')](_0x436cd8[_0xab44('0x34')]);_0x2dd6f8[_0xab44('0x35')]=_['intersection'](_0x2dd6f8[_0xab44('0x37')],_0x2dd6f8[_0xab44('0x34')]);_0x5bb256[_0xab44('0x38')]=_['intersection'](_0x2dd6f8[_0xab44('0x37')],qs[_0xab44('0x39')](_0x436cd8[_0xab44('0x34')][_0xab44('0x39')]));_0x5bb256['attributes']=_0x5bb256[_0xab44('0x38')]['length']?_0x5bb256[_0xab44('0x38')]:_0x2dd6f8[_0xab44('0x37')];if(_0x436cd8[_0xab44('0x34')][_0xab44('0x42')]){_0x5bb256['include']=[{'all':!![]}];}_0x5bb256=_[_0xab44('0x40')]({},_0x5bb256,_0x436cd8['options']);return db[_0xab44('0x2f')][_0xab44('0x4a')](_0x5bb256)[_0xab44('0x26')](handleEntityNotFound(_0x4d4421,null))[_0xab44('0x26')](respondWithResult(_0x4d4421,null))[_0xab44('0x46')](handleError(_0x4d4421,null));};exports['destroy']=function(_0x4736fd,_0x53ef06){return db[_0xab44('0x2f')][_0xab44('0x4a')]({'where':{'id':_0x4736fd[_0xab44('0x48')]['id']}})['then'](handleEntityNotFound(_0x53ef06,null))[_0xab44('0x26')](removeEntity(_0x53ef06,null))[_0xab44('0x46')](handleError(_0x53ef06,null));};exports[_0xab44('0x4b')]=function(_0x160232,_0x41f946){return db['VoicePrefix']['describe']()[_0xab44('0x26')](respondWithResult(_0x41f946,null))[_0xab44('0x46')](handleError(_0x41f946,null));};exports[_0xab44('0x4c')]=function(_0x51ee03,_0x11bcd9){var _0x1bf44b;return db[_0xab44('0x4d')][_0xab44('0x4e')](function(_0x4eb2eb){return db['VoicePrefix'][_0xab44('0x4c')](_0x51ee03[_0xab44('0x4f')],{'transaction':_0x4eb2eb})[_0xab44('0x26')](function(_0x1e5731){_0x1bf44b=_0x1e5731[_0xab44('0x27')]({'plain':!![]});return db[_0xab44('0x50')][_0xab44('0x4a')]({'where':{'id':_0x1bf44b[_0xab44('0x51')]},'raw':!![]})['then'](function(_0x496e6d){return createVoicePrefixExtensions(_0x1bf44b,_0x496e6d,_0x4eb2eb);});});})[_0xab44('0x26')](function(){var _0x39bc1b=_0x51ee03[_0xab44('0x52')][_0xab44('0x27')]({'plain':!![]});if(!_0x39bc1b)throw new Error(_0xab44('0x53'));if(_0x39bc1b[_0xab44('0x54')]===_0xab44('0x52')){var _0x411bac=_0x1bf44b;return db[_0xab44('0x55')]['find']({'where':{'name':_0xab44('0x28'),'userProfileId':_0x39bc1b[_0xab44('0x56')]},'raw':!![]})[_0xab44('0x26')](function(_0xf8edd8){if(_0xf8edd8&&_0xf8edd8[_0xab44('0x57')]===0x0){return db[_0xab44('0x58')][_0xab44('0x4c')]({'name':_0x411bac[_0xab44('0x2c')],'resourceId':_0x411bac['id'],'type':_0xf8edd8['name'],'sectionId':_0xf8edd8['id']},{})['then'](function(){return _0x1bf44b;});}else{return _0x1bf44b;}})[_0xab44('0x46')](function(_0x35b4bc){logger[_0xab44('0x2b')](_0xab44('0x59'),_0x35b4bc);throw _0x35b4bc;});}return _0x1bf44b;})[_0xab44('0x26')](respondWithResult(_0x11bcd9,null))[_0xab44('0x46')](handleError(_0x11bcd9,null));};function Extension(_0x29fdb2,_0x41c4aa,_0x5b238d,_0x4d6a68){this['context']='from-sip';this[_0xab44('0x5a')]=_0x29fdb2;this[_0xab44('0x5b')]=_0x5b238d;this[_0xab44('0x32')]=_0xab44('0x5c');this[_0xab44('0x5d')]='Voice\x20Prefix\x20Extension';this[_0xab44('0x5e')]=_0x41c4aa;this[_0xab44('0x5f')]=_0x4d6a68;}function createVoicePrefixExtensions(_0x1e32d9,_0x32f92e,_0x1ef3af){return new BPromise(function(_0x255ec7,_0x205168){var _0x3a982b=new Extension(formatPrefixName(_0x1e32d9['prefix']),0x1,_0xab44('0x60'),_0xab44('0x61'));_0x3a982b[_0xab44('0x62')]=_0x1e32d9['id'];return db[_0xab44('0x50')]['create'](_0x3a982b,{'transaction':_0x1ef3af})[_0xab44('0x26')](function(_0x56401c){var _0x47ecdc=_0x56401c[_0xab44('0x27')]({'plain':!![]});var _0x5718fc=_['map'](addVoicePrefixExtensions(_0x1e32d9,_0x32f92e),function(_0x1daf6c){_0x1daf6c[_0xab44('0x51')]=_0x47ecdc['id'];_0x1daf6c[_0xab44('0x62')]=_0x1e32d9['id'];return _0x1daf6c;});return db[_0xab44('0x50')][_0xab44('0x63')](_0x5718fc,{'transaction':_0x1ef3af})['then'](function(_0x242795){if(!_0x242795){return _0x205168(_0xab44('0x64'));}else{return _0x255ec7(_0x242795);}})[_0xab44('0x46')](function(_0x3ad244){return _0x205168(_0x3ad244);});});;});};function addVoicePrefixExtensions(_0x45a9b4,_0x81b522){var _0x50558d=[];var _0x5ecf43=formatPrefixName(_0x45a9b4['prefix']);_0x50558d[_0xab44('0x65')](new Extension(_0x5ecf43,0x2,_0xab44('0x66'),'CDR(prefix)='+_0x45a9b4[_0xab44('0x2c')]));if(_0x45a9b4[_0xab44('0x67')]){_0x50558d[_0xab44('0x65')](new Extension(_0x5ecf43,0x3,_0xab44('0x66'),_0xab44('0x68')+_0x45a9b4[_0xab44('0x67')]));}else{_0x50558d[_0xab44('0x65')](new Extension(_0x5ecf43,0x3,_0xab44('0x60'),_0xab44('0x69')));}_0x50558d[_0xab44('0x65')](new Extension(_0x5ecf43,0x4,_0xab44('0x6a'),_0x81b522[_0xab44('0x6b')]+','+_0xab44('0x6c')+(0x8+_0x45a9b4[_0xab44('0x2c')][_0xab44('0x3a')])+'}'+','+0x1));return _0x50558d;}function formatPrefixName(_0x3f0eb0){var _0x445555='_';for(var _0x3c0668=0x0;_0x3c0668<_0x3f0eb0[_0xab44('0x3a')];_0x3c0668++){if(_0x3f0eb0[_0xab44('0x6d')](_0x3c0668)=='-'){_0x445555+=_0x3f0eb0[_0xab44('0x6d')](_0x3c0668);}else{_0x445555+='['+_0x3f0eb0[_0xab44('0x6d')](_0x3c0668)+']';}}_0x445555+='.';return _0x445555;}exports[_0xab44('0x25')]=function(_0x24055f,_0x315b00,_0x15dd86){var _0xd8a908=_0x24055f['body'];_0xd8a908[_0xab44('0x6e')]='system-'+_0xd8a908[_0xab44('0x2c')]+'-';return db[_0xab44('0x4d')][_0xab44('0x4e')](function(_0x169139){return db[_0xab44('0x2f')][_0xab44('0x25')](_0xd8a908,{'where':{'id':_0xd8a908['id']},'transaction':_0x169139})[_0xab44('0x26')](function(){return db[_0xab44('0x50')][_0xab44('0x29')]({'where':{'VoicePrefixId':_0xd8a908['id']},'transaction':_0x169139})[_0xab44('0x26')](function(){return db[_0xab44('0x50')]['find']({'where':{'id':_0xd8a908[_0xab44('0x51')]},'raw':!![]})[_0xab44('0x26')](function(_0x4e8352){return createVoicePrefixExtensions(_0xd8a908,_0x4e8352,_0x169139);});});});})[_0xab44('0x26')](function(){return db['VoicePrefix'][_0xab44('0x6f')](_0xd8a908['id']);})[_0xab44('0x26')](respondWithResult(_0x315b00,null))[_0xab44('0x46')](handleError(_0x315b00,null));};exports[_0xab44('0x70')]=function(_0x2f523f,_0x9115d9,_0x114499){return db['VoicePrefix'][_0xab44('0x4a')]({'where':{'id':_0x2f523f['params']['id']}})[_0xab44('0x26')](handleEntityNotFound(_0x9115d9,null))['then'](function(_0x1078ff){if(_0x1078ff){return _0x1078ff[_0xab44('0x70')](_0x2f523f[_0xab44('0x4f')][_0xab44('0x71')],_[_0xab44('0x72')](_0x2f523f[_0xab44('0x4f')],[_0xab44('0x71'),'id'])||{})['spread'](function(_0x5ab4b5){for(var _0x4baedb=0x0;_0x4baedb<_0x2f523f[_0xab44('0x4f')]['ids'][_0xab44('0x3a')];_0x4baedb+=0x1){socket[_0xab44('0x73')](_0xab44('0x74'),{'UserId':Number(_0x2f523f[_0xab44('0x4f')][_0xab44('0x71')][_0x4baedb]),'VoicePrefixId':Number(_0x2f523f['params']['id'])});}return _0x5ab4b5;});}})[_0xab44('0x26')](respondWithResult(_0x9115d9,null))[_0xab44('0x46')](handleError(_0x9115d9,null));};exports[_0xab44('0x75')]=function(_0x5387d5,_0xa7bbeb,_0x4ac1a2){return db[_0xab44('0x2f')][_0xab44('0x4a')]({'where':{'id':_0x5387d5[_0xab44('0x48')]['id']}})[_0xab44('0x26')](handleEntityNotFound(_0xa7bbeb,null))[_0xab44('0x26')](function(_0x690755){if(_0x690755){return _0x690755[_0xab44('0x75')](_0x5387d5[_0xab44('0x34')][_0xab44('0x71')])[_0xab44('0x26')](function(){if(_[_0xab44('0x76')](_0x5387d5[_0xab44('0x34')][_0xab44('0x71')])){for(var _0x491112=0x0;_0x491112<_0x5387d5['query'][_0xab44('0x71')][_0xab44('0x3a')];_0x491112+=0x1){socket['emit'](_0xab44('0x77'),{'UserId':Number(_0x5387d5[_0xab44('0x34')][_0xab44('0x71')][_0x491112]),'VoicePrefixId':Number(_0x5387d5[_0xab44('0x48')]['id'])});}}else{socket[_0xab44('0x73')]('userVoicePrefix:remove',{'UserId':Number(_0x5387d5[_0xab44('0x34')][_0xab44('0x71')]),'VoicePrefixId':Number(_0x5387d5['params']['id'])});}});}})['then'](respondWithStatusCode(_0xa7bbeb,null))['catch'](handleError(_0xa7bbeb,null));};exports['getAgents']=function(_0x3846d7,_0x13b63b,_0x630390){var _0x345c5e={};var _0x43c787={};var _0x4338dd;var _0x4fc173;return db[_0xab44('0x2f')][_0xab44('0x78')]({'where':{'id':_0x3846d7['params']['id']}})['then'](handleEntityNotFound(_0x13b63b,null))[_0xab44('0x26')](function(_0x1814ea){if(_0x1814ea){_0x4338dd=_0x1814ea;_0x43c787['model']=_[_0xab44('0x49')](db[_0xab44('0x79')][_0xab44('0x30')]);_0x43c787['query']=_[_0xab44('0x49')](_0x3846d7[_0xab44('0x34')]);_0x43c787[_0xab44('0x35')]=_[_0xab44('0x36')](_0x43c787[_0xab44('0x37')],_0x43c787[_0xab44('0x34')]);_0x345c5e[_0xab44('0x38')]=_['intersection'](_0x43c787['model'],qs[_0xab44('0x39')](_0x3846d7[_0xab44('0x34')][_0xab44('0x39')]));_0x345c5e[_0xab44('0x38')]=_0x345c5e[_0xab44('0x38')]['length']?_0x345c5e[_0xab44('0x38')]:_0x43c787[_0xab44('0x37')];_0x345c5e['order']=qs['sort'](_0x3846d7[_0xab44('0x34')][_0xab44('0x3d')]);_0x345c5e[_0xab44('0x3e')]=qs[_0xab44('0x35')](_[_0xab44('0x7a')](_0x3846d7['query'],_0x43c787[_0xab44('0x35')]));if(_0x3846d7[_0xab44('0x34')][_0xab44('0x3f')]){_0x345c5e[_0xab44('0x3e')]=_[_0xab44('0x40')](_0x345c5e['where'],{'$or':_[_0xab44('0x2e')](_0x345c5e[_0xab44('0x38')],function(_0x493533){var _0x3bee2e={};_0x3bee2e[_0x493533]={'$like':'%'+_0x3846d7[_0xab44('0x34')][_0xab44('0x3f')]+'%'};return _0x3bee2e;})});}_0x345c5e=_['merge']({},_0x345c5e,_0x3846d7[_0xab44('0x41')]);return _0x4338dd[_0xab44('0x7b')](_0x345c5e);}})[_0xab44('0x26')](function(_0x685026){if(_0x685026){_0x4fc173=_0x685026[_0xab44('0x3a')];if(!_0x3846d7[_0xab44('0x34')][_0xab44('0x3b')]('nolimit')){_0x345c5e[_0xab44('0x1e')]=qs[_0xab44('0x1e')](_0x3846d7['query'][_0xab44('0x1e')]);_0x345c5e[_0xab44('0x1c')]=qs[_0xab44('0x1c')](_0x3846d7[_0xab44('0x34')][_0xab44('0x1c')]);}return _0x4338dd[_0xab44('0x7b')](_0x345c5e);}})[_0xab44('0x26')](function(_0x40ee04){if(_0x40ee04){return _0x40ee04?{'count':_0x4fc173,'rows':_0x40ee04}:null;}})[_0xab44('0x26')](respondWithResult(_0x13b63b,null))[_0xab44('0x46')](handleError(_0x13b63b,null));};exports[_0xab44('0x7c')]=function(_0x1c96ef,_0xa5033e,_0x5e8820){var _0x41b30b={};var _0x5e93de={};var _0x476957;var _0x594482;return db[_0xab44('0x2f')][_0xab44('0x78')]({'where':{'id':_0x1c96ef[_0xab44('0x48')]['id']}})[_0xab44('0x26')](handleEntityNotFound(_0xa5033e,null))[_0xab44('0x26')](function(_0x1a25cd){if(_0x1a25cd){_0x476957=_0x1a25cd;_0x5e93de[_0xab44('0x37')]=_[_0xab44('0x49')](db['Team']['rawAttributes']);_0x5e93de['query']=_['keys'](_0x1c96ef[_0xab44('0x34')]);_0x5e93de[_0xab44('0x35')]=_[_0xab44('0x36')](_0x5e93de['model'],_0x5e93de['query']);_0x41b30b['attributes']=_['intersection'](_0x5e93de[_0xab44('0x37')],qs[_0xab44('0x39')](_0x1c96ef[_0xab44('0x34')][_0xab44('0x39')]));_0x41b30b['attributes']=_0x41b30b[_0xab44('0x38')][_0xab44('0x3a')]?_0x41b30b[_0xab44('0x38')]:_0x5e93de['model'];_0x41b30b[_0xab44('0x3c')]=qs[_0xab44('0x3d')](_0x1c96ef[_0xab44('0x34')][_0xab44('0x3d')]);_0x41b30b[_0xab44('0x3e')]=qs[_0xab44('0x35')](_['pick'](_0x1c96ef[_0xab44('0x34')],_0x5e93de[_0xab44('0x35')]));if(_0x1c96ef[_0xab44('0x34')]['filter']){_0x41b30b[_0xab44('0x3e')]=_['merge'](_0x41b30b[_0xab44('0x3e')],{'$or':_[_0xab44('0x2e')](_0x41b30b[_0xab44('0x38')],function(_0x1798c7){var _0x5e44d0={};_0x5e44d0[_0x1798c7]={'$like':'%'+_0x1c96ef[_0xab44('0x34')]['filter']+'%'};return _0x5e44d0;})});}_0x41b30b=_[_0xab44('0x40')]({},_0x41b30b,_0x1c96ef[_0xab44('0x41')]);return _0x476957[_0xab44('0x7c')](_0x41b30b);}})[_0xab44('0x26')](function(_0x41a7bc){if(_0x41a7bc){_0x594482=_0x41a7bc[_0xab44('0x3a')];if(!_0x1c96ef[_0xab44('0x34')][_0xab44('0x3b')](_0xab44('0x7d'))){_0x41b30b[_0xab44('0x1e')]=qs[_0xab44('0x1e')](_0x1c96ef['query'][_0xab44('0x1e')]);_0x41b30b[_0xab44('0x1c')]=qs[_0xab44('0x1c')](_0x1c96ef['query'][_0xab44('0x1c')]);}return _0x476957[_0xab44('0x7c')](_0x41b30b);}})[_0xab44('0x26')](function(_0x4c8a45){if(_0x4c8a45){return _0x4c8a45?{'count':_0x594482,'rows':_0x4c8a45}:null;}})[_0xab44('0x26')](respondWithResult(_0xa5033e,null))[_0xab44('0x46')](handleError(_0xa5033e,null));};exports[_0xab44('0x7e')]=function(_0x5d0a30,_0x545819,_0x2b71dc){var _0x3d56cb=_0x5d0a30['body']['ids'];var _0x1033a;return db[_0xab44('0x7f')][_0xab44('0x44')]({'where':{'id':_0x3d56cb},'attributes':['id'],'include':[{'model':db[_0xab44('0x79')],'as':_0xab44('0x80'),'attributes':['id','name',_0xab44('0x81'),_0xab44('0x82'),_0xab44('0x83')],'raw':!![]}]})[_0xab44('0x26')](function(_0x4bdb57){if(_0x4bdb57){_0x1033a=_0x4bdb57;var _0x101332=_[_0xab44('0x84')](_0x4bdb57,function(_0x5802ff){var _0x286dbf=_0x5802ff[_0xab44('0x27')]({'plain':!![]});return _0x286dbf[_0xab44('0x80')];});return db[_0xab44('0x2f')][_0xab44('0x4a')]({'where':{'id':_0x5d0a30['params']['id']}})[_0xab44('0x26')](function(_0x37bfc1){return db[_0xab44('0x4d')][_0xab44('0x4e')](function(_0x2271d4){return _0x37bfc1['addTeams'](_0x3d56cb,{'transaction':_0x2271d4})[_0xab44('0x26')](function(){return BPromise[_0xab44('0x85')](_0x1033a,function(_0x2f00b7){return db[_0xab44('0x86')][_0xab44('0x87')]({'TeamId':_0x2f00b7['id'],'VoicePrefixId':_0x5d0a30['params']['id']},{'transaction':_0x2271d4});});})[_0xab44('0x26')](function(){return BPromise['each'](_0x101332,function(_0x1aa45c){return db[_0xab44('0x88')][_0xab44('0x89')]({'where':{'UserId':_0x1aa45c['id'],'VoicePrefixId':_0x5d0a30['params']['id']},'transaction':_0x2271d4});});})['then'](function(){_0x101332[_0xab44('0x8a')](function(_0x114e4e){socket['emit'](_0xab44('0x74'),{'UserId':_0x114e4e['id'],'VoicePrefixId':_0x37bfc1['id']});});});});});}})[_0xab44('0x26')](respondWithStatusCode(_0x545819,null))[_0xab44('0x46')](handleError(_0x545819,null));};exports['removeTeams']=function(_0x528b00,_0xa0e3ff,_0x460778){return db[_0xab44('0x7f')][_0xab44('0x44')]({'where':{'id':_0x528b00['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xab44('0x79')],'as':_0xab44('0x80'),'attributes':['id'],'raw':!![]}]})[_0xab44('0x26')](handleEntityNotFound(_0xa0e3ff,null))[_0xab44('0x26')](function(_0x4c299f){var _0x4e7857=_[_0xab44('0x2e')](_0x4c299f,'id');var _0x322cff=[];var _0x1525ad=[];var _0xe27f2c=squel[_0xab44('0x8b')]();_0xe27f2c[_0xab44('0x8c')](_0xab44('0x8d'))[_0xab44('0x8e')](_0xab44('0x8f'),'tq')['join']('user_has_teams','ut',_0xab44('0x90'))[_0xab44('0x3e')]('VoicePrefixId\x20=\x20?',_0x528b00[_0xab44('0x48')]['id']);for(var _0x544b82=0x0;_0x544b82<_0x4c299f[_0xab44('0x3a')];_0x544b82+=0x1){let _0x495ef4=_0x4c299f[_0x544b82];for(var _0x471790=0x0;_0x471790<_0x495ef4[_0xab44('0x80')][_0xab44('0x3a')];_0x471790+=0x1){let _0x5c77ed=_0x495ef4['Agents'][_0x471790];var _0x21fbb5=_0xe27f2c[_0xab44('0x91')]();_0x21fbb5['where'](_0xab44('0x92'),_0x5c77ed['id']);_0x1525ad['push'](db[_0xab44('0x4d')][_0xab44('0x34')](_0x21fbb5[_0xab44('0x93')](),{'type':db[_0xab44('0x4d')]['QueryTypes'][_0xab44('0x94')]})[_0xab44('0x26')](function(_0x48b47c){if(_0x48b47c[_0xab44('0x3a')]===0x1){return _0x5c77ed['id'];}else{var _0x4696f3=_[_0xab44('0x95')](_[_0xab44('0x2e')](_0x48b47c,'TeamId'),function(_0x3bbb88){return _[_0xab44('0x96')](_0x4e7857,_0x3bbb88);});if(_0x4696f3){return _0x5c77ed['id'];}}}));}}return BPromise[_0xab44('0x97')](_0x1525ad)['then'](function(_0x415556){_0x322cff=_(_0x322cff)[_0xab44('0x98')](_0x415556)['compact']()['value']();return db['VoicePrefix'][_0xab44('0x4a')]({'where':{'id':_0x528b00[_0xab44('0x48')]['id']}})[_0xab44('0x26')](function(_0x54a64f){return db['sequelize'][_0xab44('0x4e')](function(_0x1988bc){return _0x54a64f[_0xab44('0x99')](_0x528b00[_0xab44('0x34')][_0xab44('0x71')],{'transaction':_0x1988bc})[_0xab44('0x26')](function(){if(!_[_0xab44('0x9a')](_0x322cff)){return _0x54a64f[_0xab44('0x75')](_0x322cff,{'transaction':_0x1988bc});}})['then'](function(){_0x322cff['forEach'](function(_0xb093c4){socket[_0xab44('0x73')](_0xab44('0x77'),{'UserId':_0xb093c4,'VoicePrefixId':_0x54a64f['id']});});});});});});})['then'](respondWithStatusCode(_0xa0e3ff,null))[_0xab44('0x46')](handleError(_0xa0e3ff,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 7f84cb7..dba9dce 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 _0x8936=['hook','exports','../../mysqldb','VoicePrefix','setMaxListeners','save','emit','hasOwnProperty'];(function(_0xe4ed65,_0x50a240){var _0x541788=function(_0x1d966f){while(--_0x1d966f){_0xe4ed65['push'](_0xe4ed65['shift']());}};_0x541788(++_0x50a240);}(_0x8936,0x72));var _0x6893=function(_0x495e9f,_0x1b1d80){_0x495e9f=_0x495e9f-0x0;var _0xb249d2=_0x8936[_0x495e9f];return _0xb249d2;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x6893('0x0'))['db'][_0x6893('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x6893('0x2')](0x0);var events={'afterCreate':_0x6893('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x59c20e){return function(_0x2fda7c,_0x4f31b5,_0x137ed6){VoicePrefixEvents[_0x6893('0x4')](_0x59c20e+':'+_0x2fda7c['id'],_0x2fda7c);VoicePrefixEvents[_0x6893('0x4')](_0x59c20e,_0x2fda7c);_0x137ed6(null);};}for(var e in events){if(events[_0x6893('0x5')](e)){var event=events[e];VoicePrefix[_0x6893('0x6')](e,emitEvent(event));}}module[_0x6893('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0x5071=['exports','events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x3b231a,_0x53a00d){var _0x18d67a=function(_0x5e14c6){while(--_0x5e14c6){_0x3b231a['push'](_0x3b231a['shift']());}};_0x18d67a(++_0x53a00d);}(_0x5071,0xd1));var _0x1507=function(_0x4d8524,_0x1e8925){_0x4d8524=_0x4d8524-0x0;var _0xbdb413=_0x5071[_0x4d8524];return _0xbdb413;};'use strict';var EventEmitter=require(_0x1507('0x0'));var VoicePrefix=require(_0x1507('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1507('0x2'),'afterDestroy':_0x1507('0x3')};function emitEvent(_0x1f87bb){return function(_0x4e46a6,_0x10e034,_0x53436d){VoicePrefixEvents[_0x1507('0x4')](_0x1f87bb+':'+_0x4e46a6['id'],_0x4e46a6);VoicePrefixEvents[_0x1507('0x4')](_0x1f87bb,_0x4e46a6);_0x53436d(null);};}for(var e in events){if(events[_0x1507('0x5')](e)){var event=events[e];VoicePrefix[_0x1507('0x6')](e,emitEvent(event));}}module[_0x1507('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 395da98..3321e9d 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 _0xf39b=['rimraf','../../config/environment','./voicePrefix.attributes','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4aaeda,_0x2a9023){var _0xa1ead4=function(_0x527f22){while(--_0x527f22){_0x4aaeda['push'](_0x4aaeda['shift']());}};_0xa1ead4(++_0x2a9023);}(_0xf39b,0xbc));var _0xbf39=function(_0x44fea4,_0x50bd0f){_0x44fea4=_0x44fea4-0x0;var _0xaa5875=_0xf39b[_0x44fea4];return _0xaa5875;};'use strict';var _=require(_0xbf39('0x0'));var util=require(_0xbf39('0x1'));var logger=require(_0xbf39('0x2'))(_0xbf39('0x3'));var moment=require(_0xbf39('0x4'));var BPromise=require(_0xbf39('0x5'));var rp=require(_0xbf39('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbf39('0x7'));var config=require(_0xbf39('0x8'));var attributes=require(_0xbf39('0x9'));module['exports']=function(_0x43c1df,_0x447cd0){return _0x43c1df[_0xbf39('0xa')](_0xbf39('0xb'),attributes,{'tableName':_0xbf39('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb6df=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash'];(function(_0x46e3f7,_0x52f8c1){var _0x54e9c2=function(_0x220856){while(--_0x220856){_0x46e3f7['push'](_0x46e3f7['shift']());}};_0x54e9c2(++_0x52f8c1);}(_0xb6df,0x1ac));var _0xfb6d=function(_0x384737,_0x4ec400){_0x384737=_0x384737-0x0;var _0x4250a1=_0xb6df[_0x384737];return _0x4250a1;};'use strict';var _=require(_0xfb6d('0x0'));var util=require(_0xfb6d('0x1'));var logger=require(_0xfb6d('0x2'))(_0xfb6d('0x3'));var moment=require('moment');var BPromise=require(_0xfb6d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfb6d('0x5'));var rimraf=require(_0xfb6d('0x6'));var config=require(_0xfb6d('0x7'));var attributes=require(_0xfb6d('0x8'));module[_0xfb6d('0x9')]=function(_0x551d60,_0x221cf6){return _0x551d60[_0xfb6d('0xa')](_0xfb6d('0xb'),attributes,{'tableName':_0xfb6d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 106c2ad..b299269 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 _0x672a=['then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request'];(function(_0x52a637,_0x26c1fb){var _0x50ecd0=function(_0x2d5bb5){while(--_0x2d5bb5){_0x52a637['push'](_0x52a637['shift']());}};_0x50ecd0(++_0x26c1fb);}(_0x672a,0x122));var _0xa672=function(_0x29a718,_0x10099d){_0x29a718=_0x29a718-0x0;var _0x5ed716=_0x672a[_0x29a718];return _0x5ed716;};'use strict';var _=require(_0xa672('0x0'));var util=require(_0xa672('0x1'));var moment=require(_0xa672('0x2'));var BPromise=require(_0xa672('0x3'));var rs=require(_0xa672('0x4'));var fs=require('fs');var Redis=require(_0xa672('0x5'));var db=require(_0xa672('0x6'))['db'];var utils=require(_0xa672('0x7'));var logger=require(_0xa672('0x8'))(_0xa672('0x9'));var config=require(_0xa672('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xa672('0xb')][_0xa672('0xc')]({'port':0x232a});config[_0xa672('0xd')]=_[_0xa672('0xe')](config[_0xa672('0xd')],{'host':_0xa672('0xf'),'port':0x18eb});var socket=require(_0xa672('0x10'))(new Redis(config[_0xa672('0xd')]));require(_0xa672('0x11'))[_0xa672('0x12')](socket);function respondWithRpcPromise(_0x215c43,_0x2f2b63,_0x2c1de6){return new BPromise(function(_0x351025,_0x5ae63c){return client[_0xa672('0x13')](_0x215c43,_0x2c1de6)[_0xa672('0x14')](function(_0x59fd41){logger[_0xa672('0x15')](_0xa672('0x16'),_0x2f2b63,_0xa672('0x17'));logger[_0xa672('0x18')](_0xa672('0x19'),_0x2f2b63,_0xa672('0x17'),JSON[_0xa672('0x1a')](_0x59fd41));if(_0x59fd41[_0xa672('0x1b')]){if(_0x59fd41[_0xa672('0x1b')]['code']===0x1f4){logger[_0xa672('0x1b')](_0xa672('0x16'),_0x2f2b63,_0x59fd41['error']['message']);return _0x5ae63c(_0x59fd41[_0xa672('0x1b')]['message']);}logger['error']('VoicePrefix,\x20%s,\x20%s',_0x2f2b63,_0x59fd41[_0xa672('0x1b')]['message']);return _0x351025(_0x59fd41['error'][_0xa672('0x1c')]);}else{logger[_0xa672('0x15')](_0xa672('0x16'),_0x2f2b63,_0xa672('0x17'));_0x351025(_0x59fd41[_0xa672('0x1d')][_0xa672('0x1c')]);}})[_0xa672('0x1e')](function(_0x21817d){logger[_0xa672('0x1b')](_0xa672('0x16'),_0x2f2b63,_0x21817d);_0x5ae63c(_0x21817d);});});} \ No newline at end of file +var _0x8561=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','redis','localhost','then','info','request\x20sent','debug','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','result','util','moment','randomstring'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x8561,0x1b2));var _0x1856=function(_0x4ea5eb,_0x190c43){_0x4ea5eb=_0x4ea5eb-0x0;var _0x2133cf=_0x8561[_0x4ea5eb];return _0x2133cf;};'use strict';var _=require('lodash');var util=require(_0x1856('0x0'));var moment=require(_0x1856('0x1'));var BPromise=require('bluebird');var rs=require(_0x1856('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1856('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1856('0x4'))('rpc');var config=require(_0x1856('0x5'));var jayson=require(_0x1856('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0x1856('0x7')]=_['defaults'](config['redis'],{'host':_0x1856('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voicePrefix.socket')['register'](socket);function respondWithRpcPromise(_0x1bfad8,_0x3e47b3,_0x510505){return new BPromise(function(_0x55fe85,_0x97f276){return client['request'](_0x1bfad8,_0x510505)[_0x1856('0x9')](function(_0x584a8e){logger[_0x1856('0xa')]('VoicePrefix,\x20%s,\x20%s',_0x3e47b3,_0x1856('0xb'));logger[_0x1856('0xc')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x3e47b3,_0x1856('0xb'),JSON[_0x1856('0xd')](_0x584a8e));if(_0x584a8e[_0x1856('0xe')]){if(_0x584a8e['error'][_0x1856('0xf')]===0x1f4){logger[_0x1856('0xe')](_0x1856('0x10'),_0x3e47b3,_0x584a8e['error'][_0x1856('0x11')]);return _0x97f276(_0x584a8e[_0x1856('0xe')][_0x1856('0x11')]);}logger[_0x1856('0xe')](_0x1856('0x10'),_0x3e47b3,_0x584a8e[_0x1856('0xe')][_0x1856('0x11')]);return _0x55fe85(_0x584a8e['error']['message']);}else{logger[_0x1856('0xa')]('VoicePrefix,\x20%s,\x20%s',_0x3e47b3,'request\x20sent');_0x55fe85(_0x584a8e[_0x1856('0x12')][_0x1856('0x11')]);}})['catch'](function(_0x4f5381){logger[_0x1856('0xe')](_0x1856('0x10'),_0x3e47b3,_0x4f5381);_0x97f276(_0x4f5381);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 079b0b3..36bd948 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 _0xf69b=['length','voicePrefix:','save','update','emit','register'];(function(_0x3d01c0,_0x26b90c){var _0x228ccc=function(_0x37664a){while(--_0x37664a){_0x3d01c0['push'](_0x3d01c0['shift']());}};_0x228ccc(++_0x26b90c);}(_0xf69b,0xc8));var _0xbf69=function(_0x23e3da,_0x3e95d1){_0x23e3da=_0x23e3da-0x0;var _0x24f2a2=_0xf69b[_0x23e3da];return _0x24f2a2;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xbf69('0x0'),'remove',_0xbf69('0x1')];function createListener(_0x4ff894,_0x2d35f6){return function(_0x44a08d){_0x2d35f6[_0xbf69('0x2')](_0x4ff894,_0x44a08d);};}function removeListener(_0x5b8f25,_0x28fa1e){return function(){VoicePrefixEvents['removeListener'](_0x5b8f25,_0x28fa1e);};}exports[_0xbf69('0x3')]=function(_0x1480a1){for(var _0x33d729=0x0,_0x642645=events[_0xbf69('0x4')];_0x33d729<_0x642645;_0x33d729++){var _0x4e3088=events[_0x33d729];var _0x1fec31=createListener(_0xbf69('0x5')+_0x4e3088,_0x1480a1);VoicePrefixEvents['on'](_0x4e3088,_0x1fec31);}}; \ No newline at end of file +var _0xa9e0=['register','length','voicePrefix:','./voicePrefix.events','save','remove','emit','removeListener'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var VoicePrefixEvents=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(){VoicePrefixEvents[_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);VoicePrefixEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 5681499..addcfd5 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xb10b,0x12a));var _0xbb10=function(_0x4f33ff,_0x4cc52d){_0x4f33ff=_0x4f33ff-0x0;var _0x40e19c=_0xb10b[_0x4f33ff];return _0x40e19c;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x3d78d7,_0x44acea){var _0x4b6784=function(_0x284157){while(--_0x284157){_0x3d78d7['push'](_0x3d78d7['shift']());}};_0x4b6784(++_0x44acea);}(_0xb10b,0x12a));var _0xbb10=function(_0x310215,_0x541b20){_0x310215=_0x310215-0x0;var _0x1e9d59=_0xb10b[_0x310215];return _0x1e9d59;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index b428b65..a50fa07 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 _0x40da=['ENUM','leastrecent','fewestcalls','rrmemory','linear','wrandom','rrordered','ringall','setDataValue','strategy','type','getDataValue','dialMethod','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','FLOAT','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','inbound','STRING'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x40da,0xe0));var _0xa40d=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x40da[_0x11005e];return _0x29338f;};'use strict';var Sequelize=require(_0xa40d('0x0'));module[_0xa40d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xa40d('0x2'),'outbound'),'allowNull':![],'defaultValue':_0xa40d('0x2')},'musiconhold':{'type':Sequelize[_0xa40d('0x3')],'defaultValue':'default'},'announce':{'type':Sequelize[_0xa40d('0x3')],'defaultValue':''},'strategy':{'type':Sequelize[_0xa40d('0x4')]('rr','ringall',_0xa40d('0x5'),_0xa40d('0x6'),'random',_0xa40d('0x7'),_0xa40d('0x8'),_0xa40d('0x9'),_0xa40d('0xa')),'allowNull':![],'defaultValue':_0xa40d('0xb'),'set':function(_0x591d9d){this[_0xa40d('0xc')](_0xa40d('0xd'),_0x591d9d?_0x591d9d:_0xa40d('0x7'));},'get':function(){var _0x46d351=this['getDataValue'](_0xa40d('0xe'));var _0x2e5079=this[_0xa40d('0xf')](_0xa40d('0x10'));var _0x38c139=this['getDataValue'](_0xa40d('0xd'));if(_0x46d351==='inbound'){return _0x38c139;}if(_0x2e5079===_0xa40d('0x11')&&_0x38c139===_0xa40d('0x7')||_0x2e5079===_0xa40d('0x11')&&_0x38c139===_0xa40d('0x12')){return _0x38c139;}if(_0x2e5079===_0xa40d('0x13')||_0x2e5079===_0xa40d('0x14')||_0x2e5079===_0xa40d('0x15')){return _0x38c139;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0xa40d('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xa40d('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0xa40d('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xa40d('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xa40d('0x4')](_0xa40d('0x17'),'no'),'defaultValue':_0xa40d('0x17')},'autopause':{'type':Sequelize[_0xa40d('0x4')](_0xa40d('0x17'),'no',_0xa40d('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0xa40d('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xa40d('0x4')](_0xa40d('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xa40d('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xa40d('0x4')](_0xa40d('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xa40d('0x4')](_0xa40d('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xa40d('0x4')](_0xa40d('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0xa40d('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xa40d('0x3')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xa40d('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xa40d('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xa40d('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xa40d('0x4')](_0xa40d('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0xa40d('0x17'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0xa40d('0x4')](_0xa40d('0x17'),'no',_0xa40d('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xa40d('0x4')](_0xa40d('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0xa40d('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xa40d('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xa40d('0x3')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xa40d('0x3')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xa40d('0x3')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xa40d('0x3')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xa40d('0x3')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xa40d('0x3')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xa40d('0x3')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xa40d('0x3')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xa40d('0x3')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0xa40d('0x3')]},'queue_less_than':{'type':Sequelize[_0xa40d('0x3')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x3a2923){this[_0xa40d('0xc')](_0xa40d('0x1a'),_0x3a2923?_0x3a2923[_0xa40d('0x1b')](','):[]);},'get':function(){return this[_0xa40d('0xf')](_0xa40d('0x1a'))?this[_0xa40d('0xf')](_0xa40d('0x1a'))[_0xa40d('0x1c')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':'yes','set':function(_0x33ba21){this[_0xa40d('0xc')](_0xa40d('0x1d'),_0x33ba21?_0x33ba21[_0xa40d('0x1b')](','):undefined);},'get':function(){return this['getDataValue'](_0xa40d('0x1d'))?this[_0xa40d('0xf')](_0xa40d('0x1d'))[_0xa40d('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0xc78c2e){this[_0xa40d('0xc')]('leavewhenempty',_0xc78c2e?_0xc78c2e[_0xa40d('0x1b')](','):undefined);},'get':function(){return this['getDataValue'](_0xa40d('0x1e'))?this[_0xa40d('0xf')](_0xa40d('0x1e'))[_0xa40d('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xa40d('0x4')](_0xa40d('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xa40d('0x4')](_0xa40d('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xa40d('0x4')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xa40d('0x3')]},'description':{'type':Sequelize[_0xa40d('0x3')]},'acw':{'type':Sequelize[_0xa40d('0x1f')],'defaultValue':0x0,'set':function(_0x467df7){this[_0xa40d('0xc')](_0xa40d('0x20'),_0x467df7);if(_0x467df7){if(this['getDataValue'](_0xa40d('0x21'))<0x2){this['setDataValue'](_0xa40d('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xa40d('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xa40d('0x1f')],'defaultValue':0x0,'comment':_0xa40d('0x22')},'dialMethod':{'type':Sequelize['ENUM'](_0xa40d('0x23'),'progressive','power',_0xa40d('0x14'),_0xa40d('0x11')),'defaultValue':_0xa40d('0x13'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0xa40d('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xa40d('0x24')},'dialLimitQueue':{'type':Sequelize[_0xa40d('0x16')](0x4)[_0xa40d('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0xa40d('0x26')](0x2)[_0xa40d('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize['ENUM']('agentBusyFactor','dropRate'),'defaultValue':'dropRate','comment':_0xa40d('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0xa40d('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xa40d('0x28')},'dialPredictiveInterval':{'type':Sequelize[_0xa40d('0x16')](0x3)[_0xa40d('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xa40d('0x29')},'dialOriginateCallerIdName':{'type':Sequelize[_0xa40d('0x3')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xa40d('0x3')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xa40d('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0xa40d('0x3')],'defaultValue':_0xa40d('0x2a'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xa40d('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa40d('0x2b')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa40d('0x2c')},'dialBusyMaxRetry':{'type':Sequelize[_0xa40d('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa40d('0x2d')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa40d('0x25')],'defaultValue':0x3,'comment':_0xa40d('0x2e')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa40d('0x2f')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa40d('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xa40d('0x30')},'dialTimezone':{'type':Sequelize[_0xa40d('0x3')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xa40d('0x31')},'dialPrefix':{'type':Sequelize[_0xa40d('0x3')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xa40d('0x4')](_0xa40d('0x32'),'never','onlyIfOpen'),'defaultValue':_0xa40d('0x32')},'dialAMDActive':{'type':Sequelize[_0xa40d('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xa40d('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xa40d('0x33')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xa40d('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xa40d('0x34')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xa40d('0x35')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xa40d('0x16')](0x9)[_0xa40d('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa40d('0x36')},'dialAMDMinWordLength':{'type':Sequelize[_0xa40d('0x16')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xa40d('0x37')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xa40d('0x38')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xa40d('0x16')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xa40d('0x16')](0x5)[_0xa40d('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xa40d('0x39')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xa40d('0x16')](0x9)[_0xa40d('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa40d('0x3a')},'dialRecallMeTimeout':{'type':Sequelize[_0xa40d('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xa40d('0x3b')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xa40d('0x3c')},'dialOrderByScheduledAt':{'type':Sequelize[_0xa40d('0x4')]('DESC',_0xa40d('0x3d')),'defaultValue':_0xa40d('0x3e')},'dialQueueProject2':{'type':Sequelize[_0xa40d('0x3')],'comment':_0xa40d('0x3f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xa40d('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xa40d('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa40d('0x40')},'dialCutDigit':{'type':Sequelize[_0xa40d('0x16')](0x3)[_0xa40d('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa40d('0x41')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa40d('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xa40d('0x16')](0x5)[_0xa40d('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa40d('0x42')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa40d('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa40d('0x43')},'dialDropRetryFrequency':{'type':Sequelize[_0xa40d('0x16')](0x5)[_0xa40d('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa40d('0x44')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xa40d('0x16')](0x3)[_0xa40d('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa40d('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa40d('0x45')},'dialMachineMaxRetry':{'type':Sequelize[_0xa40d('0x16')](0x3)[_0xa40d('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xa40d('0x16')](0x5)[_0xa40d('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa40d('0x46')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xa40d('0x16')](0x3)[_0xa40d('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa40d('0x47')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa40d('0x16')],'allowNull':!![],'comment':_0xa40d('0x48')},'mandatoryDisposition':{'type':Sequelize[_0xa40d('0x1f')],'defaultValue':![],'comment':_0xa40d('0x49'),'set':function(_0xb20557){if(!_0xb20557)this[_0xa40d('0xc')](_0xa40d('0x4a'),null);this[_0xa40d('0xc')](_0xa40d('0x4b'),_0xb20557);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xa40d('0x16')](0x3)[_0xa40d('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xa40d('0x16')](0x3)[_0xa40d('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xe989=['#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','#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','mandatoryDisposition','sequelize','STRING','name','ENUM','inbound','outbound','default','ringall','leastrecent','random','linear','wrandom','rrordered','setDataValue','getDataValue','type','dialMethod','strategy','booked','rrmemory','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','split','joinempty','join','leavewhenempty','acw','wrapuptime','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words'];(function(_0x1b5530,_0x5045d3){var _0x48b089=function(_0x207048){while(--_0x207048){_0x1b5530['push'](_0x1b5530['shift']());}};_0x48b089(++_0x5045d3);}(_0xe989,0x11e));var _0x9e98=function(_0xc889e1,_0x438415){_0xc889e1=_0xc889e1-0x0;var _0x17ab9e=_0xe989[_0xc889e1];return _0x17ab9e;};'use strict';var Sequelize=require(_0x9e98('0x0'));module['exports']={'name':{'type':Sequelize[_0x9e98('0x1')],'allowNull':![],'unique':_0x9e98('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x9e98('0x3')](_0x9e98('0x4'),_0x9e98('0x5')),'allowNull':![],'defaultValue':_0x9e98('0x4')},'musiconhold':{'type':Sequelize[_0x9e98('0x1')],'defaultValue':_0x9e98('0x6')},'announce':{'type':Sequelize[_0x9e98('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x9e98('0x3')]('rr',_0x9e98('0x7'),_0x9e98('0x8'),'fewestcalls',_0x9e98('0x9'),'rrmemory',_0x9e98('0xa'),_0x9e98('0xb'),_0x9e98('0xc')),'allowNull':![],'defaultValue':_0x9e98('0x7'),'set':function(_0x7780f4){this[_0x9e98('0xd')]('strategy',_0x7780f4?_0x7780f4:'rrmemory');},'get':function(){var _0xf4362e=this[_0x9e98('0xe')](_0x9e98('0xf'));var _0xf5f8cc=this[_0x9e98('0xe')](_0x9e98('0x10'));var _0x4d13f3=this['getDataValue'](_0x9e98('0x11'));if(_0xf4362e==='inbound'){return _0x4d13f3;}if(_0xf5f8cc===_0x9e98('0x12')&&_0x4d13f3===_0x9e98('0x13')||_0xf5f8cc===_0x9e98('0x12')&&_0x4d13f3===_0x9e98('0x14')){return _0x4d13f3;}if(_0xf5f8cc===_0x9e98('0x15')||_0xf5f8cc===_0x9e98('0x16')||_0xf5f8cc===_0x9e98('0x17')){return _0x4d13f3;}return null;}},'servicelevel':{'type':Sequelize[_0x9e98('0x18')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x9e98('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x9e98('0x18')](0xb)},'timeout':{'type':Sequelize[_0x9e98('0x18')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x9e98('0x18')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x9e98('0x1')]},'weight':{'type':Sequelize[_0x9e98('0x18')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x9e98('0x18')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x9e98('0x3')](_0x9e98('0x19'),'no'),'defaultValue':_0x9e98('0x19')},'autopause':{'type':Sequelize[_0x9e98('0x3')](_0x9e98('0x19'),'no',_0x9e98('0x1a')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x9e98('0x18')](0xb)},'autopausebusy':{'type':Sequelize[_0x9e98('0x3')](_0x9e98('0x19'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x9e98('0x3')](_0x9e98('0x19'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x9e98('0x3')](_0x9e98('0x19'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x9e98('0x3')](_0x9e98('0x19'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x9e98('0x19'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x9e98('0x3')](_0x9e98('0x19'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x9e98('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x9e98('0x18')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x9e98('0x18')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x9e98('0x3')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x9e98('0x3')](_0x9e98('0x19'),'no'),'defaultValue':_0x9e98('0x19')},'announce_holdtime':{'type':Sequelize[_0x9e98('0x3')]('yes','no',_0x9e98('0x1b')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x9e98('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x9e98('0x3')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x9e98('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x9e98('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x9e98('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x9e98('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x9e98('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x9e98('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x9e98('0x1')]},'queue_quantity1':{'type':Sequelize[_0x9e98('0x1')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x9e98('0x1')]},'queue_less_than':{'type':Sequelize[_0x9e98('0x1')]},'periodic_announce':{'type':Sequelize[_0x9e98('0x1c')],'set':function(_0x1bc68e){this['setDataValue'](_0x9e98('0x1d'),_0x1bc68e?_0x1bc68e['join'](','):[]);},'get':function(){return this[_0x9e98('0xe')](_0x9e98('0x1d'))?this[_0x9e98('0xe')](_0x9e98('0x1d'))[_0x9e98('0x1e')](','):[];}},'joinempty':{'type':Sequelize[_0x9e98('0x1')],'defaultValue':_0x9e98('0x19'),'set':function(_0x4f1bfd){this[_0x9e98('0xd')](_0x9e98('0x1f'),_0x4f1bfd?_0x4f1bfd[_0x9e98('0x20')](','):undefined);},'get':function(){return this[_0x9e98('0xe')](_0x9e98('0x1f'))?this[_0x9e98('0xe')](_0x9e98('0x1f'))[_0x9e98('0x1e')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x9e98('0x1')],'defaultValue':'no','set':function(_0x3ef272){this[_0x9e98('0xd')](_0x9e98('0x21'),_0x3ef272?_0x3ef272['join'](','):undefined);},'get':function(){return this[_0x9e98('0xe')]('leavewhenempty')?this[_0x9e98('0xe')](_0x9e98('0x21'))[_0x9e98('0x1e')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x9e98('0x3')](_0x9e98('0x19'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x9e98('0x3')](_0x9e98('0x19'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x9e98('0x18')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x9e98('0x3')](_0x9e98('0x19'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9e98('0x1')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x23c18b){this[_0x9e98('0xd')](_0x9e98('0x22'),_0x23c18b);if(_0x23c18b){if(this[_0x9e98('0xe')](_0x9e98('0x23'))<0x2){this[_0x9e98('0xd')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x9e98('0x18')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x9e98('0x3')](_0x9e98('0x24'),'progressive','power','predictive',_0x9e98('0x12')),'defaultValue':'progressive','comment':_0x9e98('0x25')},'dialLimitChannel':{'type':Sequelize[_0x9e98('0x18')](0x4)[_0x9e98('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x9e98('0x27')},'dialLimitQueue':{'type':Sequelize[_0x9e98('0x18')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x9e98('0x28')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x9e98('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x9e98('0x29')},'dialPredictiveOptimization':{'type':Sequelize[_0x9e98('0x3')]('agentBusyFactor',_0x9e98('0x2a')),'defaultValue':_0x9e98('0x2a'),'comment':_0x9e98('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x9e98('0x2c')](0x2)[_0x9e98('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x9e98('0x2d')},'dialPredictiveInterval':{'type':Sequelize[_0x9e98('0x18')](0x3)[_0x9e98('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x9e98('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize[_0x9e98('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x9e98('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x9e98('0x18')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9e98('0x2f')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x9e98('0x30'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9e98('0x31')},'dialQueueProject':{'type':Sequelize[_0x9e98('0x1')],'comment':_0x9e98('0x32')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9e98('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9e98('0x33')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x9e98('0x18')](0x5)[_0x9e98('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9e98('0x34')},'dialBusyMaxRetry':{'type':Sequelize[_0x9e98('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9e98('0x35')},'dialBusyRetryFrequency':{'type':Sequelize[_0x9e98('0x18')](0x5)[_0x9e98('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9e98('0x36')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9e98('0x26')],'defaultValue':0x3,'comment':_0x9e98('0x37')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x9e98('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9e98('0x38')},'dialGlobalMaxRetry':{'type':Sequelize[_0x9e98('0x18')](0x3)[_0x9e98('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x9e98('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x9e98('0x1')],'defaultValue':_0x9e98('0x39')},'dialPrefix':{'type':Sequelize[_0x9e98('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x9e98('0x3')](_0x9e98('0x3a'),_0x9e98('0x3b'),_0x9e98('0x3c')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x9e98('0x3d')],'defaultValue':0x0,'comment':_0x9e98('0x3e')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x9e98('0x3f')},'dialAMDGreeting':{'type':Sequelize[_0x9e98('0x18')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x9e98('0x40')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x9e98('0x18')](0x9)[_0x9e98('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x9e98('0x41')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x9e98('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9e98('0x42')},'dialAMDMinWordLength':{'type':Sequelize[_0x9e98('0x18')](0x9)[_0x9e98('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x9e98('0x43')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x9e98('0x26')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x9e98('0x44')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x9e98('0x45')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x9e98('0x18')](0x5)[_0x9e98('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x9e98('0x46')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x9e98('0x18')](0x9)[_0x9e98('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9e98('0x47')},'dialRecallMeTimeout':{'type':Sequelize[_0x9e98('0x18')](0x5)[_0x9e98('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x9e98('0x48')},'dialRecallInQueue':{'type':Sequelize[_0x9e98('0x3d')],'defaultValue':0x0,'comment':_0x9e98('0x49')},'dialOrderByScheduledAt':{'type':Sequelize[_0x9e98('0x3')]('DESC',_0x9e98('0x4a')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x9e98('0x32')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x9e98('0x3d')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x9e98('0x3d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x9e98('0x18')](0x3)[_0x9e98('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x9e98('0x18')](0x3)[_0x9e98('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x9e98('0x18')](0x3)[_0x9e98('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9e98('0x4b')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x9e98('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9e98('0x4c')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9e98('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9e98('0x4d')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9e98('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9e98('0x4e')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9e98('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9e98('0x4f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x9e98('0x18')](0x5)[_0x9e98('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9e98('0x50')},'dialMachineMaxRetry':{'type':Sequelize[_0x9e98('0x18')](0x3)[_0x9e98('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9e98('0x51')},'dialMachineRetryFrequency':{'type':Sequelize[_0x9e98('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9e98('0x52')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x9e98('0x18')](0x3)[_0x9e98('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9e98('0x53')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x9e98('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9e98('0x54')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9e98('0x18')],'allowNull':!![],'comment':_0x9e98('0x55')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x9e98('0x56'),'set':function(_0x2543a0){if(!_0x2543a0)this['setDataValue'](_0x9e98('0x57'),null);this[_0x9e98('0xd')](_0x9e98('0x58'),_0x2543a0);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x9e98('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x9e98('0x18')](0x3)[_0x9e98('0x26')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x9e98('0x3d')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 7828b5c..22a4e55 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 _0x8803=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','end','status','offset','limit','undefined','count','set','json','reject','save','update','then','destroy','VoiceQueues','QueueCampaigns','outbound','filter','map','includes','find','type','name','UserProfileResource','sendStatus','error','stack','send','index','VoiceQueue','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','catch','params','create','body','role','user','get','inbound','value','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','CmHopper','VoiceQueueId','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','User','Agents','online','voicePause','flatMap','penalty','each','TeamVoiceQueue','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','isNil','interface','format','SIP/%s','forEach','emit','removeTeams','ids','select','field','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','all','compact','transaction','removeAgents','userVoiceQueue:remove','addAgents','spread','isArray','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','into','cm_hopper','ContactId','ListId','phone','NOW()','CmListId','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','fromQuery','scheduledAt','removeLists','CmList','getBlackLists','addBlackLists','cm_hopper_black','cm_contacts','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','crypto','jsforce','desk.js'];(function(_0x142ac8,_0x3fdac0){var _0x2e4be5=function(_0x29a3c1){while(--_0x29a3c1){_0x142ac8['push'](_0x142ac8['shift']());}};_0x2e4be5(++_0x3fdac0);}(_0x8803,0x15f));var _0x3880=function(_0x6e3cb3,_0x15636e){_0x6e3cb3=_0x6e3cb3-0x0;var _0x3879b0=_0x8803[_0x6e3cb3];return _0x3879b0;};'use strict';var emlformat=require(_0x3880('0x0'));var rimraf=require(_0x3880('0x1'));var zipdir=require(_0x3880('0x2'));var jsonpatch=require(_0x3880('0x3'));var rp=require(_0x3880('0x4'));var moment=require(_0x3880('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3880('0x6'));var path=require('path');var sox=require(_0x3880('0x7'));var csv=require(_0x3880('0x8'));var ejs=require(_0x3880('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3880('0xa'));var jsforce=require(_0x3880('0xb'));var deskjs=require(_0x3880('0xc'));var toCsv=require(_0x3880('0x8'));var querystring=require(_0x3880('0xd'));var Papa=require(_0x3880('0xe'));var Redis=require(_0x3880('0xf'));var authService=require(_0x3880('0x10'));var qs=require(_0x3880('0x11'));var as=require(_0x3880('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3880('0x13'));var utils=require(_0x3880('0x14'));var config=require(_0x3880('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3880('0x16'))['db'];config[_0x3880('0x17')]=_[_0x3880('0x18')](config[_0x3880('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x3880('0x19'))(new Redis(config[_0x3880('0x17')]));require('./voiceQueue.socket')['register'](socket);function respondWithStatusCode(_0x21daaa,_0x5da54b){_0x5da54b=_0x5da54b||0xcc;return function(_0x364ac8){if(_0x364ac8){return _0x21daaa['sendStatus'](_0x5da54b);}return _0x21daaa['status'](_0x5da54b)[_0x3880('0x1a')]();};}function respondWithResult(_0x3df2e6,_0x5e348d){_0x5e348d=_0x5e348d||0xc8;return function(_0x338a96){if(_0x338a96){return _0x3df2e6[_0x3880('0x1b')](_0x5e348d)['json'](_0x338a96);}};}function respondWithFilteredResult(_0x352b2e,_0x28d9c1){return function(_0x4ee5ee){if(_0x4ee5ee){var _0x162102=typeof _0x28d9c1[_0x3880('0x1c')]==='undefined'&&typeof _0x28d9c1[_0x3880('0x1d')]===_0x3880('0x1e');var _0x12e120=_0x4ee5ee[_0x3880('0x1f')];var _0x4a7beb=_0x162102?0x0:_0x28d9c1['offset'];var _0x297c72=_0x162102?_0x4ee5ee[_0x3880('0x1f')]:_0x28d9c1[_0x3880('0x1c')]+_0x28d9c1['limit'];var _0x32af72;if(_0x297c72>=_0x12e120){_0x297c72=_0x12e120;_0x32af72=0xc8;}else{_0x32af72=0xce;}_0x352b2e[_0x3880('0x1b')](_0x32af72);return _0x352b2e[_0x3880('0x20')]('Content-Range',_0x4a7beb+'-'+_0x297c72+'/'+_0x12e120)[_0x3880('0x21')](_0x4ee5ee);}return null;};}function patchUpdates(_0x20ab5e){return function(_0x21ef65){try{jsonpatch['apply'](_0x21ef65,_0x20ab5e,!![]);}catch(_0x480772){return BPromise[_0x3880('0x22')](_0x480772);}return _0x21ef65[_0x3880('0x23')]();};}function saveUpdates(_0x141d09,_0x31ac52){return function(_0x192196){if(_0x192196){return _0x192196[_0x3880('0x24')](_0x141d09)[_0x3880('0x25')](function(_0x3aa4ba){return _0x3aa4ba;});}return null;};}function removeEntity(_0x36ac1d,_0xc84e86){return function(_0x120192){if(_0x120192){return _0x120192[_0x3880('0x26')]()[_0x3880('0x25')](function(){var _0xbbf026=_0x120192['get']({'plain':!![]});var _0x12cf70=[{'name':_0x3880('0x27'),'value':'inbound','ignore':![]},{'name':_0x3880('0x28'),'value':_0x3880('0x29'),'ignore':![]}];var _0x3a06ec=_(_0x12cf70)[_0x3880('0x2a')]('ignore')[_0x3880('0x2b')]('value')['value']();if(_[_0x3880('0x2c')](_0x3a06ec,_0xbbf026['type'])){return;}var _0x55daeb=_[_0x3880('0x2d')](_0x12cf70,['value',_0xbbf026[_0x3880('0x2e')]])[_0x3880('0x2f')];return db[_0x3880('0x30')][_0x3880('0x26')]({'where':{'type':_0x55daeb,'resourceId':_0xbbf026['id']}})[_0x3880('0x25')](function(){return _0x120192;});})[_0x3880('0x25')](function(){_0x36ac1d[_0x3880('0x1b')](0xcc)[_0x3880('0x1a')]();});}};}function handleEntityNotFound(_0x3cabfe,_0x3367e0){return function(_0x4e2f5f){if(!_0x4e2f5f){_0x3cabfe[_0x3880('0x31')](0x194);}return _0x4e2f5f;};}function handleError(_0x3a606c,_0x247d4e){_0x247d4e=_0x247d4e||0x1f4;return function(_0x5ab16d){logger[_0x3880('0x32')](_0x5ab16d[_0x3880('0x33')]);if(_0x5ab16d['name']){delete _0x5ab16d[_0x3880('0x2f')];}_0x3a606c['status'](_0x247d4e)[_0x3880('0x34')](_0x5ab16d);};}exports[_0x3880('0x35')]=function(_0x59ca84,_0x432989){var _0x4a7f0e={},_0x25b89c={},_0x5cf74e={'count':0x0,'rows':[]};var _0x2de162=_[_0x3880('0x2b')](db[_0x3880('0x36')][_0x3880('0x37')],function(_0x1bb120){return{'name':_0x1bb120['fieldName'],'type':_0x1bb120[_0x3880('0x2e')][_0x3880('0x38')]};});_0x25b89c[_0x3880('0x39')]=_[_0x3880('0x2b')](_0x2de162,_0x3880('0x2f'));_0x25b89c[_0x3880('0x3a')]=_[_0x3880('0x3b')](_0x59ca84[_0x3880('0x3a')]);_0x25b89c[_0x3880('0x3c')]=_['intersection'](_0x25b89c[_0x3880('0x39')],_0x25b89c[_0x3880('0x3a')]);_0x4a7f0e[_0x3880('0x3d')]=_[_0x3880('0x3e')](_0x25b89c[_0x3880('0x39')],qs[_0x3880('0x3f')](_0x59ca84[_0x3880('0x3a')]['fields']));_0x4a7f0e[_0x3880('0x3d')]=_0x4a7f0e['attributes'][_0x3880('0x40')]?_0x4a7f0e[_0x3880('0x3d')]:_0x25b89c[_0x3880('0x39')];if(!_0x59ca84['query'][_0x3880('0x41')](_0x3880('0x42'))){_0x4a7f0e[_0x3880('0x1d')]=qs[_0x3880('0x1d')](_0x59ca84['query'][_0x3880('0x1d')]);_0x4a7f0e[_0x3880('0x1c')]=qs[_0x3880('0x1c')](_0x59ca84[_0x3880('0x3a')][_0x3880('0x1c')]);}_0x4a7f0e[_0x3880('0x43')]=qs[_0x3880('0x44')](_0x59ca84['query'][_0x3880('0x44')]);_0x4a7f0e[_0x3880('0x45')]=qs[_0x3880('0x3c')](_[_0x3880('0x46')](_0x59ca84['query'],_0x25b89c['filters']),_0x2de162);if(_0x59ca84['query'][_0x3880('0x2a')]){_0x4a7f0e['where']=_[_0x3880('0x47')](_0x4a7f0e[_0x3880('0x45')],{'$or':_[_0x3880('0x2b')](_0x2de162,function(_0xd5e0af){if(_0xd5e0af['type']!=='VIRTUAL'){var _0x117805={};_0x117805[_0xd5e0af[_0x3880('0x2f')]]={'$like':'%'+_0x59ca84[_0x3880('0x3a')][_0x3880('0x2a')]+'%'};return _0x117805;}})});}_0x4a7f0e=_['merge']({},_0x4a7f0e,_0x59ca84[_0x3880('0x48')]);var _0x3ec7cd={'where':_0x4a7f0e[_0x3880('0x45')]};return db[_0x3880('0x36')][_0x3880('0x1f')](_0x3ec7cd)['then'](function(_0x2fe93a){_0x5cf74e['count']=_0x2fe93a;if(_0x59ca84[_0x3880('0x3a')][_0x3880('0x49')]){_0x4a7f0e[_0x3880('0x4a')]=[{'all':!![]}];}return db[_0x3880('0x36')][_0x3880('0x4b')](_0x4a7f0e);})[_0x3880('0x25')](function(_0x5c88b1){_0x5cf74e[_0x3880('0x4c')]=_0x5c88b1;return _0x5cf74e;})[_0x3880('0x25')](respondWithFilteredResult(_0x432989,_0x4a7f0e))[_0x3880('0x4d')](handleError(_0x432989,null));};exports['show']=function(_0x12d222,_0x5b7268){var _0x4bc195={'raw':![],'where':{'id':_0x12d222[_0x3880('0x4e')]['id']}},_0xda4a4e={};_0xda4a4e[_0x3880('0x39')]=_['keys'](db[_0x3880('0x36')]['rawAttributes']);_0xda4a4e[_0x3880('0x3a')]=_[_0x3880('0x3b')](_0x12d222[_0x3880('0x3a')]);_0xda4a4e[_0x3880('0x3c')]=_['intersection'](_0xda4a4e[_0x3880('0x39')],_0xda4a4e[_0x3880('0x3a')]);_0x4bc195[_0x3880('0x3d')]=_['intersection'](_0xda4a4e['model'],qs[_0x3880('0x3f')](_0x12d222[_0x3880('0x3a')][_0x3880('0x3f')]));_0x4bc195[_0x3880('0x3d')]=_0x4bc195[_0x3880('0x3d')][_0x3880('0x40')]?_0x4bc195['attributes']:_0xda4a4e[_0x3880('0x39')];if(_0x12d222['query'][_0x3880('0x49')]){_0x4bc195[_0x3880('0x4a')]=[{'all':!![]}];}_0x4bc195=_[_0x3880('0x47')]({},_0x4bc195,_0x12d222[_0x3880('0x48')]);return db[_0x3880('0x36')][_0x3880('0x2d')](_0x4bc195)[_0x3880('0x25')](handleEntityNotFound(_0x5b7268,null))[_0x3880('0x25')](respondWithResult(_0x5b7268,null))[_0x3880('0x4d')](handleError(_0x5b7268,null));};exports[_0x3880('0x4f')]=function(_0x53b758,_0x4469e0){return db[_0x3880('0x36')][_0x3880('0x4f')](_0x53b758[_0x3880('0x50')],{})['then'](function(_0x46eb6b){var _0x40c7a0=_0x53b758['user']['get']({'plain':!![]});if(!_0x40c7a0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40c7a0[_0x3880('0x51')]===_0x3880('0x52')){var _0x207763=_0x46eb6b[_0x3880('0x53')]({'plain':!![]});var _0x22c6f3=[{'name':_0x3880('0x27'),'value':_0x3880('0x54')},{'name':_0x3880('0x28'),'value':'outbound'}];var _0x33b85d=_[_0x3880('0x2d')](_0x22c6f3,[_0x3880('0x55'),_0x207763[_0x3880('0x2e')]])[_0x3880('0x2f')];return db[_0x3880('0x56')][_0x3880('0x2d')]({'where':{'name':_0x33b85d,'userProfileId':_0x40c7a0[_0x3880('0x57')]},'raw':!![]})[_0x3880('0x25')](function(_0x2938e0){if(_0x2938e0&&_0x2938e0['autoAssociation']===0x0){return db[_0x3880('0x30')][_0x3880('0x4f')]({'name':_0x207763[_0x3880('0x2f')],'resourceId':_0x207763['id'],'type':_0x2938e0[_0x3880('0x2f')],'sectionId':_0x2938e0['id']},{})[_0x3880('0x25')](function(){return _0x46eb6b;});}else{return _0x46eb6b;}})['catch'](function(_0xac13df){logger[_0x3880('0x32')](_0x3880('0x58'),_0xac13df);throw _0xac13df;});}return _0x46eb6b;})[_0x3880('0x25')](respondWithResult(_0x4469e0,0xc9))[_0x3880('0x4d')](handleError(_0x4469e0,null));};exports[_0x3880('0x59')]=function(_0x1c26c4,_0x301be3){var _0x18cfb2={'where':{'id':_0x1c26c4[_0x3880('0x4e')]['id']}},_0x11d136={};_0x11d136[_0x3880('0x39')]=_[_0x3880('0x3b')](db[_0x3880('0x36')][_0x3880('0x37')]);_0x18cfb2['attributes']=_['intersection'](_0x11d136[_0x3880('0x39')],qs[_0x3880('0x3f')](_0x1c26c4[_0x3880('0x3a')][_0x3880('0x3f')]));_0x18cfb2[_0x3880('0x3d')]=_0x18cfb2['attributes']['length']?_0x18cfb2[_0x3880('0x3d')]:_0x11d136['model'];if(_0x1c26c4['query'][_0x3880('0x49')]){_0x18cfb2[_0x3880('0x4a')]=[{'all':!![]}];}_0x18cfb2=_['merge']({},_0x18cfb2,_0x1c26c4[_0x3880('0x48')]);return db[_0x3880('0x36')]['find'](_0x18cfb2)[_0x3880('0x25')](handleEntityNotFound(_0x301be3,null))['then'](function(_0x3ae48e){if(_0x3ae48e){var _0x4fa55e=_0x3ae48e[_0x3880('0x53')]({'plain':!![]});_0x4fa55e=qs[_0x3880('0x5a')](_0x4fa55e,['id',_0x3880('0x5b'),_0x3880('0x5c')]);_0x1c26c4[_0x3880('0x50')]=_[_0x3880('0x5a')](_0x1c26c4[_0x3880('0x50')],['id','createdAt','updatedAt']);return db[_0x3880('0x36')][_0x3880('0x4f')](_['merge'](_0x4fa55e,_0x1c26c4[_0x3880('0x50')]),{'include':_0x1c26c4['query'][_0x3880('0x49')]?[{'all':!![]}]:undefined})[_0x3880('0x25')](function(_0x24e733){var _0x481bea=_0x1c26c4['user'][_0x3880('0x53')]({'plain':!![]});if(!_0x481bea)throw new Error(_0x3880('0x5d'));if(_0x481bea['role']===_0x3880('0x52')){var _0x47c707=_0x24e733['get']({'plain':!![]});var _0x582bf3=[{'name':_0x3880('0x27'),'value':'inbound'},{'name':_0x3880('0x28'),'value':_0x3880('0x29')}];var _0x14255d=_[_0x3880('0x2d')](_0x582bf3,[_0x3880('0x55'),_0x47c707[_0x3880('0x2e')]])[_0x3880('0x2f')];return db['UserProfileSection']['find']({'where':{'name':_0x14255d,'userProfileId':_0x481bea[_0x3880('0x57')]},'raw':!![]})[_0x3880('0x25')](function(_0xcc49b2){if(_0xcc49b2&&_0xcc49b2['autoAssociation']===0x0){return db['UserProfileResource'][_0x3880('0x4f')]({'name':_0x47c707[_0x3880('0x2f')],'resourceId':_0x47c707['id'],'type':_0xcc49b2['name'],'sectionId':_0xcc49b2['id']},{})[_0x3880('0x25')](function(){return _0x24e733;});}else{return _0x24e733;}})['catch'](function(_0x2319cb){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2319cb);throw _0x2319cb;});}return _0x24e733;});}})['then'](respondWithResult(_0x301be3,0xc9))['catch'](handleError(_0x301be3,null));};exports[_0x3880('0x24')]=function(_0x66b384,_0x56e336){if(_0x66b384[_0x3880('0x50')]['id']){delete _0x66b384[_0x3880('0x50')]['id'];}return db[_0x3880('0x36')][_0x3880('0x2d')]({'where':{'id':_0x66b384[_0x3880('0x4e')]['id']}})['then'](handleEntityNotFound(_0x56e336,null))[_0x3880('0x25')](saveUpdates(_0x66b384[_0x3880('0x50')],null))['then'](respondWithResult(_0x56e336,null))[_0x3880('0x4d')](handleError(_0x56e336,null));};exports[_0x3880('0x26')]=function(_0x2f47a2,_0x4cc277){return db[_0x3880('0x36')][_0x3880('0x2d')]({'where':{'id':_0x2f47a2['params']['id']}})[_0x3880('0x25')](handleEntityNotFound(_0x4cc277,null))[_0x3880('0x25')](removeEntity(_0x4cc277,null))[_0x3880('0x4d')](handleError(_0x4cc277,null));};exports[_0x3880('0x5e')]=function(_0x2223fa,_0x5c4fbe,_0x7fc8ec){var _0x446a66={'raw':![],'where':{}};var _0x8d78e9={};var _0x5165d9={'count':0x0,'rows':[]};return db[_0x3880('0x36')]['findOne']({'where':{'id':_0x2223fa[_0x3880('0x4e')]['id']}})[_0x3880('0x25')](handleEntityNotFound(_0x5c4fbe,null))[_0x3880('0x25')](function(_0x26f624){if(_0x26f624){_0x8d78e9[_0x3880('0x39')]=_[_0x3880('0x3b')](db[_0x3880('0x5f')][_0x3880('0x37')]);_0x8d78e9[_0x3880('0x3a')]=_[_0x3880('0x3b')](_0x2223fa[_0x3880('0x3a')]);_0x8d78e9[_0x3880('0x3c')]=_[_0x3880('0x3e')](_0x8d78e9[_0x3880('0x39')],_0x8d78e9[_0x3880('0x3a')]);_0x446a66[_0x3880('0x3d')]=_[_0x3880('0x3e')](_0x8d78e9[_0x3880('0x39')],qs[_0x3880('0x3f')](_0x2223fa[_0x3880('0x3a')][_0x3880('0x3f')]));_0x446a66[_0x3880('0x3d')]=_0x446a66[_0x3880('0x3d')][_0x3880('0x40')]?_0x446a66['attributes']:_0x8d78e9[_0x3880('0x39')];if(!_0x2223fa[_0x3880('0x3a')][_0x3880('0x41')](_0x3880('0x42'))){_0x446a66['limit']=qs['limit'](_0x2223fa[_0x3880('0x3a')][_0x3880('0x1d')]);_0x446a66[_0x3880('0x1c')]=qs['offset'](_0x2223fa['query'][_0x3880('0x1c')]);}_0x446a66[_0x3880('0x43')]=qs[_0x3880('0x44')](_0x2223fa[_0x3880('0x3a')][_0x3880('0x44')]);_0x446a66['where']=qs[_0x3880('0x3c')](_[_0x3880('0x46')](_0x2223fa['query'],_0x8d78e9[_0x3880('0x3c')]));_0x446a66[_0x3880('0x45')][_0x3880('0x60')]=_0x26f624['id'];if(_0x2223fa[_0x3880('0x3a')][_0x3880('0x2a')]){_0x446a66[_0x3880('0x45')]=_[_0x3880('0x47')](_0x446a66[_0x3880('0x45')],{'$or':_[_0x3880('0x2b')](_0x446a66[_0x3880('0x3d')],function(_0x256ced){var _0x224a3d={};_0x224a3d[_0x256ced]={'$like':'%'+_0x2223fa[_0x3880('0x3a')][_0x3880('0x2a')]+'%'};return _0x224a3d;})});}_0x446a66=_[_0x3880('0x47')]({},_0x446a66,_0x2223fa['options']);return db[_0x3880('0x5f')][_0x3880('0x1f')]({'where':_0x446a66[_0x3880('0x45')]})[_0x3880('0x25')](function(_0x9586c3){_0x5165d9[_0x3880('0x1f')]=_0x9586c3;if(_0x2223fa[_0x3880('0x3a')][_0x3880('0x49')]){_0x446a66[_0x3880('0x4a')]=[{'all':!![]}];}return db[_0x3880('0x5f')][_0x3880('0x4b')](_0x446a66);})[_0x3880('0x25')](function(_0x1e8def){_0x5165d9[_0x3880('0x4c')]=_0x1e8def;return _0x5165d9;});}})[_0x3880('0x25')](respondWithFilteredResult(_0x5c4fbe,_0x446a66))[_0x3880('0x4d')](handleError(_0x5c4fbe,null));};exports[_0x3880('0x61')]=function(_0x1d4382,_0x5f2970,_0x119f7a){var _0x5e6626={'raw':!![],'where':{}};var _0x1f6414={};var _0x2b8c5c={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x3880('0x62')]({'where':{'id':_0x1d4382[_0x3880('0x4e')]['id']}})[_0x3880('0x25')](handleEntityNotFound(_0x5f2970,null))[_0x3880('0x25')](function(_0x5242c4){if(_0x5242c4){_0x1f6414['model']=_[_0x3880('0x3b')](db['CmHopperHistory']['rawAttributes']);_0x1f6414[_0x3880('0x3a')]=_[_0x3880('0x3b')](_0x1d4382[_0x3880('0x3a')]);_0x1f6414[_0x3880('0x3c')]=_[_0x3880('0x3e')](_0x1f6414[_0x3880('0x39')],_0x1f6414['query']);_0x5e6626[_0x3880('0x3d')]=_[_0x3880('0x3e')](_0x1f6414['model'],qs[_0x3880('0x3f')](_0x1d4382[_0x3880('0x3a')][_0x3880('0x3f')]));_0x5e6626[_0x3880('0x3d')]=_0x5e6626[_0x3880('0x3d')][_0x3880('0x40')]?_0x5e6626[_0x3880('0x3d')]:_0x1f6414[_0x3880('0x39')];if(!_0x1d4382[_0x3880('0x3a')]['hasOwnProperty'](_0x3880('0x42'))){_0x5e6626['limit']=qs[_0x3880('0x1d')](_0x1d4382[_0x3880('0x3a')][_0x3880('0x1d')]);_0x5e6626['offset']=qs[_0x3880('0x1c')](_0x1d4382[_0x3880('0x3a')][_0x3880('0x1c')]);}_0x5e6626[_0x3880('0x43')]=qs[_0x3880('0x44')](_0x1d4382[_0x3880('0x3a')][_0x3880('0x44')]);_0x5e6626['where']=qs[_0x3880('0x3c')](_[_0x3880('0x46')](_0x1d4382[_0x3880('0x3a')],_0x1f6414[_0x3880('0x3c')]));_0x5e6626['where'][_0x3880('0x60')]=_0x5242c4['id'];if(_0x1d4382[_0x3880('0x3a')]['filter']){_0x5e6626[_0x3880('0x45')]=_['merge'](_0x5e6626[_0x3880('0x45')],{'$or':_[_0x3880('0x2b')](_0x5e6626[_0x3880('0x3d')],function(_0x4b8388){var _0x513be0={};_0x513be0[_0x4b8388]={'$like':'%'+_0x1d4382[_0x3880('0x3a')][_0x3880('0x2a')]+'%'};return _0x513be0;})});}_0x5e6626=_[_0x3880('0x47')]({},_0x5e6626,_0x1d4382[_0x3880('0x48')]);return db[_0x3880('0x63')][_0x3880('0x1f')]({'where':_0x5e6626['where']})[_0x3880('0x25')](function(_0x5d6017){_0x2b8c5c[_0x3880('0x1f')]=_0x5d6017;if(_0x1d4382[_0x3880('0x3a')][_0x3880('0x49')]){_0x5e6626[_0x3880('0x4a')]=[{'all':!![]}];}return db[_0x3880('0x63')][_0x3880('0x4b')](_0x5e6626);})[_0x3880('0x25')](function(_0x118648){_0x2b8c5c[_0x3880('0x4c')]=_0x118648;return _0x2b8c5c;});}})[_0x3880('0x25')](respondWithFilteredResult(_0x5f2970,_0x5e6626))['catch'](handleError(_0x5f2970,null));};exports[_0x3880('0x64')]=function(_0xcf28c9,_0x3afbe9,_0xaf16dc){var _0x139c4c={'raw':!![],'where':{}};var _0x73d3eb={};var _0x142a5b={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0xcf28c9['params']['id']}})['then'](handleEntityNotFound(_0x3afbe9,null))[_0x3880('0x25')](function(_0x334307){if(_0x334307){_0x73d3eb['model']=_[_0x3880('0x3b')](db[_0x3880('0x65')][_0x3880('0x37')]);_0x73d3eb[_0x3880('0x3a')]=_[_0x3880('0x3b')](_0xcf28c9[_0x3880('0x3a')]);_0x73d3eb['filters']=_[_0x3880('0x3e')](_0x73d3eb[_0x3880('0x39')],_0x73d3eb[_0x3880('0x3a')]);_0x139c4c[_0x3880('0x3d')]=_[_0x3880('0x3e')](_0x73d3eb[_0x3880('0x39')],qs[_0x3880('0x3f')](_0xcf28c9[_0x3880('0x3a')][_0x3880('0x3f')]));_0x139c4c['attributes']=_0x139c4c[_0x3880('0x3d')][_0x3880('0x40')]?_0x139c4c[_0x3880('0x3d')]:_0x73d3eb[_0x3880('0x39')];if(!_0xcf28c9[_0x3880('0x3a')][_0x3880('0x41')](_0x3880('0x42'))){_0x139c4c[_0x3880('0x1d')]=qs[_0x3880('0x1d')](_0xcf28c9[_0x3880('0x3a')][_0x3880('0x1d')]);_0x139c4c['offset']=qs[_0x3880('0x1c')](_0xcf28c9[_0x3880('0x3a')][_0x3880('0x1c')]);}_0x139c4c[_0x3880('0x43')]=qs[_0x3880('0x44')](_0xcf28c9[_0x3880('0x3a')]['sort']);_0x139c4c[_0x3880('0x45')]=qs[_0x3880('0x3c')](_[_0x3880('0x46')](_0xcf28c9[_0x3880('0x3a')],_0x73d3eb['filters']));_0x139c4c[_0x3880('0x45')][_0x3880('0x60')]=_0x334307['id'];if(_0xcf28c9['query'][_0x3880('0x2a')]){_0x139c4c[_0x3880('0x45')]=_[_0x3880('0x47')](_0x139c4c[_0x3880('0x45')],{'$or':_[_0x3880('0x2b')](_0x139c4c[_0x3880('0x3d')],function(_0x533ea5){var _0x41d9ec={};_0x41d9ec[_0x533ea5]={'$like':'%'+_0xcf28c9[_0x3880('0x3a')]['filter']+'%'};return _0x41d9ec;})});}_0x139c4c=_[_0x3880('0x47')]({},_0x139c4c,_0xcf28c9[_0x3880('0x48')]);return db[_0x3880('0x65')][_0x3880('0x1f')]({'where':_0x139c4c['where']})[_0x3880('0x25')](function(_0x5b767f){_0x142a5b[_0x3880('0x1f')]=_0x5b767f;if(_0xcf28c9[_0x3880('0x3a')][_0x3880('0x49')]){_0x139c4c['include']=[{'all':!![]}];}return db[_0x3880('0x65')][_0x3880('0x4b')](_0x139c4c);})[_0x3880('0x25')](function(_0x2a3831){_0x142a5b[_0x3880('0x4c')]=_0x2a3831;return _0x142a5b;});}})[_0x3880('0x25')](respondWithFilteredResult(_0x3afbe9,_0x139c4c))['catch'](handleError(_0x3afbe9,null));};exports[_0x3880('0x66')]=function(_0x2a8cb6,_0x122f0a,_0x341694){var _0x23f2c9={'raw':!![],'where':{}};var _0x3a2eb7={};var _0xcc317f={'count':0x0,'rows':[]};return db[_0x3880('0x36')][_0x3880('0x62')]({'where':{'id':_0x2a8cb6['params']['id']}})['then'](handleEntityNotFound(_0x122f0a,null))['then'](function(_0x484bd2){if(_0x484bd2){_0x3a2eb7['model']=_[_0x3880('0x3b')](db[_0x3880('0x67')][_0x3880('0x37')]);_0x3a2eb7[_0x3880('0x3a')]=_[_0x3880('0x3b')](_0x2a8cb6['query']);_0x3a2eb7[_0x3880('0x3c')]=_[_0x3880('0x3e')](_0x3a2eb7[_0x3880('0x39')],_0x3a2eb7['query']);_0x23f2c9[_0x3880('0x3d')]=_['intersection'](_0x3a2eb7[_0x3880('0x39')],qs['fields'](_0x2a8cb6[_0x3880('0x3a')]['fields']));_0x23f2c9[_0x3880('0x3d')]=_0x23f2c9[_0x3880('0x3d')][_0x3880('0x40')]?_0x23f2c9[_0x3880('0x3d')]:_0x3a2eb7[_0x3880('0x39')];if(!_0x2a8cb6[_0x3880('0x3a')]['hasOwnProperty'](_0x3880('0x42'))){_0x23f2c9[_0x3880('0x1d')]=qs[_0x3880('0x1d')](_0x2a8cb6[_0x3880('0x3a')][_0x3880('0x1d')]);_0x23f2c9['offset']=qs[_0x3880('0x1c')](_0x2a8cb6[_0x3880('0x3a')][_0x3880('0x1c')]);}_0x23f2c9[_0x3880('0x43')]=qs['sort'](_0x2a8cb6['query'][_0x3880('0x44')]);_0x23f2c9[_0x3880('0x45')]=qs[_0x3880('0x3c')](_[_0x3880('0x46')](_0x2a8cb6[_0x3880('0x3a')],_0x3a2eb7[_0x3880('0x3c')]));_0x23f2c9[_0x3880('0x45')][_0x3880('0x60')]=_0x484bd2['id'];if(_0x2a8cb6[_0x3880('0x3a')][_0x3880('0x2a')]){_0x23f2c9[_0x3880('0x45')]=_[_0x3880('0x47')](_0x23f2c9['where'],{'$or':_[_0x3880('0x2b')](_0x23f2c9[_0x3880('0x3d')],function(_0x38ff90){var _0x1ca8b3={};_0x1ca8b3[_0x38ff90]={'$like':'%'+_0x2a8cb6[_0x3880('0x3a')][_0x3880('0x2a')]+'%'};return _0x1ca8b3;})});}_0x23f2c9=_[_0x3880('0x47')]({},_0x23f2c9,_0x2a8cb6[_0x3880('0x48')]);return db[_0x3880('0x67')][_0x3880('0x1f')]({'where':_0x23f2c9['where']})[_0x3880('0x25')](function(_0x51aa14){_0xcc317f['count']=_0x51aa14;if(_0x2a8cb6[_0x3880('0x3a')][_0x3880('0x49')]){_0x23f2c9[_0x3880('0x4a')]=[{'all':!![]}];}return db[_0x3880('0x67')]['findAll'](_0x23f2c9);})[_0x3880('0x25')](function(_0xe7f953){_0xcc317f[_0x3880('0x4c')]=_0xe7f953;return _0xcc317f;});}})[_0x3880('0x25')](respondWithFilteredResult(_0x122f0a,_0x23f2c9))['catch'](handleError(_0x122f0a,null));};exports[_0x3880('0x68')]=function(_0x202881,_0x563111,_0x59a01f){var _0x5f309a={};var _0x14bf51={};var _0x5e8061;var _0x2fce6b;return db[_0x3880('0x36')][_0x3880('0x62')]({'where':{'id':_0x202881[_0x3880('0x4e')]['id']}})[_0x3880('0x25')](handleEntityNotFound(_0x563111,null))[_0x3880('0x25')](function(_0x5590fa){if(_0x5590fa){_0x5e8061=_0x5590fa;_0x14bf51[_0x3880('0x39')]=_[_0x3880('0x3b')](db['Team'][_0x3880('0x37')]);_0x14bf51[_0x3880('0x3a')]=_[_0x3880('0x3b')](_0x202881[_0x3880('0x3a')]);_0x14bf51[_0x3880('0x3c')]=_['intersection'](_0x14bf51[_0x3880('0x39')],_0x14bf51[_0x3880('0x3a')]);_0x5f309a[_0x3880('0x3d')]=_[_0x3880('0x3e')](_0x14bf51[_0x3880('0x39')],qs['fields'](_0x202881[_0x3880('0x3a')][_0x3880('0x3f')]));_0x5f309a[_0x3880('0x3d')]=_0x5f309a['attributes'][_0x3880('0x40')]?_0x5f309a['attributes']:_0x14bf51[_0x3880('0x39')];_0x5f309a[_0x3880('0x43')]=qs[_0x3880('0x44')](_0x202881['query'][_0x3880('0x44')]);_0x5f309a[_0x3880('0x45')]=qs[_0x3880('0x3c')](_[_0x3880('0x46')](_0x202881['query'],_0x14bf51[_0x3880('0x3c')]));if(_0x202881[_0x3880('0x3a')][_0x3880('0x2a')]){_0x5f309a['where']=_[_0x3880('0x47')](_0x5f309a[_0x3880('0x45')],{'$or':_[_0x3880('0x2b')](_0x5f309a['attributes'],function(_0x57ffed){var _0x6f570a={};_0x6f570a[_0x57ffed]={'$like':'%'+_0x202881[_0x3880('0x3a')][_0x3880('0x2a')]+'%'};return _0x6f570a;})});}_0x5f309a=_[_0x3880('0x47')]({},_0x5f309a,_0x202881[_0x3880('0x48')]);return _0x5e8061[_0x3880('0x68')](_0x5f309a);}})[_0x3880('0x25')](function(_0x29d0c5){if(_0x29d0c5){_0x2fce6b=_0x29d0c5[_0x3880('0x40')];if(!_0x202881[_0x3880('0x3a')][_0x3880('0x41')](_0x3880('0x42'))){_0x5f309a[_0x3880('0x1d')]=qs['limit'](_0x202881[_0x3880('0x3a')][_0x3880('0x1d')]);_0x5f309a[_0x3880('0x1c')]=qs[_0x3880('0x1c')](_0x202881[_0x3880('0x3a')][_0x3880('0x1c')]);}return _0x5e8061[_0x3880('0x68')](_0x5f309a);}})[_0x3880('0x25')](function(_0x161611){if(_0x161611){return _0x161611?{'count':_0x2fce6b,'rows':_0x161611}:null;}})['then'](respondWithResult(_0x563111,null))[_0x3880('0x4d')](handleError(_0x563111,null));};exports[_0x3880('0x69')]=function(_0x2d386c,_0x1203d4,_0x1f1343){var _0xf6bd6c=_0x2d386c['body'][_0x3880('0x6a')];var _0x3d9839=_[_0x3880('0x2b')](_0xf6bd6c,'id');return db[_0x3880('0x6b')][_0x3880('0x4b')]({'where':{'id':_0x3d9839},'attributes':['id'],'include':[{'model':db[_0x3880('0x6c')],'as':_0x3880('0x6d'),'attributes':['id',_0x3880('0x2f'),_0x3880('0x6e'),_0x3880('0x6f'),'interface'],'raw':!![]}]})['then'](function(_0x252852){if(_0x252852){var _0x343605=_[_0x3880('0x70')](_0x252852,function(_0x468e46){var _0x25f853=_0x468e46[_0x3880('0x53')]({'plain':!![]});_0x25f853['Agents']['forEach'](function(_0xa4a52f){_0xa4a52f['penalty']=_[_0x3880('0x2d')](_0xf6bd6c,{'id':_0x25f853['id']})[_0x3880('0x71')];});return _0x25f853[_0x3880('0x6d')];});return db[_0x3880('0x36')]['find']({'where':{'id':_0x2d386c[_0x3880('0x4e')]['id']}})[_0x3880('0x25')](function(_0x3644cb){return db['sequelize']['transaction'](function(_0x40d539){return _0x3644cb[_0x3880('0x69')](_0x3d9839,{'transaction':_0x40d539})['then'](function(){return BPromise[_0x3880('0x72')](_0xf6bd6c,function(_0x2338f0){return db[_0x3880('0x73')]['upsert']({'TeamId':_0x2338f0['id'],'VoiceQueueId':_0x2d386c[_0x3880('0x4e')]['id'],'penalty':_0x2338f0[_0x3880('0x71')]},{'transaction':_0x40d539});});})[_0x3880('0x25')](function(){return BPromise[_0x3880('0x72')](_0x343605,function(_0x45ee82){return db[_0x3880('0x74')][_0x3880('0x75')]({'where':{'UserId':_0x45ee82['id'],'VoiceQueueId':_0x2d386c['params']['id']},'defaults':{'penalty':_0x45ee82[_0x3880('0x71')]},'transaction':_0x40d539});});})[_0x3880('0x25')](function(){return BPromise[_0x3880('0x72')](_[_0x3880('0x2a')](_0x343605,{'online':!![]}),function(_0x4c5074){return db[_0x3880('0x76')][_0x3880('0x77')]({'membername':_0x4c5074[_0x3880('0x2f')],'UserId':_0x4c5074['id'],'queue_name':_0x3644cb[_0x3880('0x2f')],'VoiceQueueId':_0x3644cb['id'],'interface':_[_0x3880('0x78')](_0x4c5074[_0x3880('0x79')])?util[_0x3880('0x7a')](_0x3880('0x7b'),_0x4c5074['name']):_0x4c5074[_0x3880('0x79')],'paused':_0x4c5074[_0x3880('0x6f')]||![],'penalty':_0x4c5074[_0x3880('0x71')]},{'transaction':_0x40d539});});})[_0x3880('0x25')](function(){_0x343605[_0x3880('0x7c')](function(_0x31a6ea){socket[_0x3880('0x7d')]('userVoiceQueue:save',{'UserId':_0x31a6ea['id'],'VoiceQueueId':_0x3644cb['id']});});});});});}})['then'](respondWithStatusCode(_0x1203d4,null))[_0x3880('0x4d')](handleError(_0x1203d4,null));};exports[_0x3880('0x7e')]=function(_0x278375,_0x10b7a4,_0x24ff64){return db[_0x3880('0x6b')][_0x3880('0x4b')]({'where':{'id':_0x278375[_0x3880('0x3a')][_0x3880('0x7f')]},'attributes':['id'],'include':[{'model':db[_0x3880('0x6c')],'as':_0x3880('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x3880('0x25')](handleEntityNotFound(_0x10b7a4,null))[_0x3880('0x25')](function(_0x418db9){var _0x429272=_['map'](_0x418db9,'id');var _0x484834=[];var _0x5ab8eb=[];var _0x510d54=squel[_0x3880('0x80')]();_0x510d54[_0x3880('0x81')]('tq.TeamId')[_0x3880('0x82')](_0x3880('0x83'),'tq')[_0x3880('0x84')](_0x3880('0x85'),'ut',_0x3880('0x86'))[_0x3880('0x45')](_0x3880('0x87'),_0x278375[_0x3880('0x4e')]['id']);for(var _0x5221de=0x0;_0x5221de<_0x418db9[_0x3880('0x40')];_0x5221de+=0x1){let _0xd6e2fb=_0x418db9[_0x5221de];for(var _0x2d8228=0x0;_0x2d8228<_0xd6e2fb['Agents']['length'];_0x2d8228+=0x1){let _0x446d03=_0xd6e2fb[_0x3880('0x6d')][_0x2d8228];var _0x57181b=_0x510d54['clone']();_0x57181b['where'](_0x3880('0x88'),_0x446d03['id']);_0x5ab8eb[_0x3880('0x89')](db[_0x3880('0x8a')][_0x3880('0x3a')](_0x57181b[_0x3880('0x8b')](),{'type':db[_0x3880('0x8a')]['QueryTypes'][_0x3880('0x8c')]})[_0x3880('0x25')](function(_0x30beba){if(_0x30beba[_0x3880('0x40')]===0x1){return _0x446d03['id'];}else{var _0x1c75f3=_[_0x3880('0x8d')](_[_0x3880('0x2b')](_0x30beba,_0x3880('0x8e')),function(_0x1fc67a){return _[_0x3880('0x2c')](_0x429272,_0x1fc67a);});if(_0x1c75f3){return _0x446d03['id'];}}}));}}return BPromise[_0x3880('0x8f')](_0x5ab8eb)[_0x3880('0x25')](function(_0x21fd9f){_0x484834=_(_0x484834)['union'](_0x21fd9f)[_0x3880('0x90')]()[_0x3880('0x55')]();return db['VoiceQueue'][_0x3880('0x2d')]({'where':{'id':_0x278375['params']['id']}})[_0x3880('0x25')](function(_0x52caf1){return db[_0x3880('0x8a')][_0x3880('0x91')](function(_0x350258){return _0x52caf1['removeTeams'](_0x278375[_0x3880('0x3a')][_0x3880('0x7f')],{'transaction':_0x350258})[_0x3880('0x25')](function(){if(!_['isEmpty'](_0x484834)){return _0x52caf1[_0x3880('0x92')](_0x484834,{'transaction':_0x350258})[_0x3880('0x25')](function(){return db[_0x3880('0x76')][_0x3880('0x26')]({'where':{'VoiceQueueId':_0x278375['params']['id'],'UserId':_0x484834},'transaction':_0x350258});});}})['then'](function(){_0x484834[_0x3880('0x7c')](function(_0x2a9b63){socket[_0x3880('0x7d')](_0x3880('0x93'),{'UserId':_0x2a9b63,'VoiceQueueId':_0x52caf1['id']});});});});});});})[_0x3880('0x25')](respondWithStatusCode(_0x10b7a4,null))[_0x3880('0x4d')](handleError(_0x10b7a4,null));};exports[_0x3880('0x94')]=function(_0x37ee74,_0x58f771,_0x1dfccc){var _0x58196f,_0x16471a;return db[_0x3880('0x36')][_0x3880('0x2d')]({'where':{'id':_0x37ee74[_0x3880('0x4e')]['id']}})[_0x3880('0x25')](handleEntityNotFound(_0x58f771,null))[_0x3880('0x25')](function(_0x3f2900){if(_0x3f2900){_0x16471a=_0x3f2900;return _0x3f2900[_0x3880('0x94')](_0x37ee74[_0x3880('0x50')][_0x3880('0x7f')],_[_0x3880('0x5a')](_0x37ee74[_0x3880('0x50')],['ids','id'])||{})[_0x3880('0x95')](function(_0x10fa26){for(var _0x3323ed=0x0;_0x3323ed<_0x37ee74[_0x3880('0x50')][_0x3880('0x7f')]['length'];_0x3323ed+=0x1){socket[_0x3880('0x7d')]('userVoiceQueue:save',{'UserId':Number(_0x37ee74[_0x3880('0x50')]['ids'][_0x3323ed]),'VoiceQueueId':Number(_0x37ee74[_0x3880('0x4e')]['id'])});}return _0x10fa26;});}})[_0x3880('0x25')](function(_0x1e35f3){_0x58196f=_0x1e35f3||[];if(_0x16471a){return db[_0x3880('0x6c')][_0x3880('0x4b')]({'where':{'id':_0x37ee74['body'][_0x3880('0x7f')]},'attributes':['id',_0x3880('0x2f'),_0x3880('0x6e'),_0x3880('0x6f'),_0x3880('0x79')],'raw':!![]});}})['then'](function(_0x17b9a1){if(!_['isEmpty'](_0x17b9a1)){var _0x205291=[];for(var _0x29f770=0x0;_0x29f770<_0x17b9a1[_0x3880('0x40')];_0x29f770++){if(_0x17b9a1[_0x29f770]['online']){_0x205291[_0x3880('0x89')](db[_0x3880('0x76')][_0x3880('0x77')]({'membername':_0x17b9a1[_0x29f770]['name'],'UserId':_0x17b9a1[_0x29f770]['id'],'queue_name':_0x16471a[_0x3880('0x2f')],'VoiceQueueId':_0x16471a['id'],'interface':_[_0x3880('0x78')](_0x17b9a1[_0x29f770][_0x3880('0x79')])?util[_0x3880('0x7a')]('SIP/%s',_0x17b9a1[_0x29f770]['name']):_0x17b9a1[_0x29f770][_0x3880('0x79')],'paused':_0x17b9a1[_0x29f770][_0x3880('0x6f')]||![],'penalty':_0x37ee74['body'][_0x3880('0x71')]||0x0}));}}return BPromise['all'](_0x205291);}})['then'](function(){return _0x58196f;})['then'](respondWithResult(_0x58f771,null))[_0x3880('0x4d')](handleError(_0x58f771,null));};exports['removeAgents']=function(_0x1a2ac4,_0x53429,_0x412f9f){return db[_0x3880('0x36')][_0x3880('0x2d')]({'where':{'id':_0x1a2ac4[_0x3880('0x4e')]['id']}})['then'](handleEntityNotFound(_0x53429,null))[_0x3880('0x25')](function(_0x4790fa){if(_0x4790fa){return _0x4790fa[_0x3880('0x92')](_0x1a2ac4[_0x3880('0x3a')][_0x3880('0x7f')])[_0x3880('0x25')](function(){if(_[_0x3880('0x96')](_0x1a2ac4['query']['ids'])){for(var _0x371efa=0x0;_0x371efa<_0x1a2ac4[_0x3880('0x3a')][_0x3880('0x7f')][_0x3880('0x40')];_0x371efa+=0x1){socket[_0x3880('0x7d')](_0x3880('0x93'),{'UserId':Number(_0x1a2ac4['query'][_0x3880('0x7f')][_0x371efa]),'VoiceQueueId':Number(_0x1a2ac4[_0x3880('0x4e')]['id'])});}}else{socket[_0x3880('0x7d')](_0x3880('0x93'),{'UserId':Number(_0x1a2ac4['query'][_0x3880('0x7f')]),'VoiceQueueId':Number(_0x1a2ac4[_0x3880('0x4e')]['id'])});}});}})[_0x3880('0x25')](function(_0x5d772e){return db[_0x3880('0x76')][_0x3880('0x26')]({'where':{'VoiceQueueId':_0x1a2ac4[_0x3880('0x4e')]['id'],'UserId':_0x1a2ac4[_0x3880('0x3a')]['ids']}})[_0x3880('0x25')](function(){return _0x5d772e;});})[_0x3880('0x25')](respondWithStatusCode(_0x53429,null))[_0x3880('0x4d')](handleError(_0x53429,null));};exports[_0x3880('0x97')]=function(_0x42fd3d,_0x5c85bc,_0x1131a7){var _0xcfb855={};var _0x2654f8={};var _0x191bd3;var _0x36d9f3;return db['VoiceQueue'][_0x3880('0x62')]({'where':{'id':_0x42fd3d['params']['id']}})[_0x3880('0x25')](handleEntityNotFound(_0x5c85bc,null))[_0x3880('0x25')](function(_0x88964){if(_0x88964){_0x191bd3=_0x88964;_0x2654f8[_0x3880('0x39')]=_[_0x3880('0x3b')](db['User']['rawAttributes']);_0x2654f8[_0x3880('0x3a')]=_[_0x3880('0x3b')](_0x42fd3d[_0x3880('0x3a')]);_0x2654f8[_0x3880('0x3c')]=_[_0x3880('0x3e')](_0x2654f8[_0x3880('0x39')],_0x2654f8[_0x3880('0x3a')]);_0xcfb855['attributes']=_[_0x3880('0x3e')](_0x2654f8[_0x3880('0x39')],qs[_0x3880('0x3f')](_0x42fd3d[_0x3880('0x3a')][_0x3880('0x3f')]));_0xcfb855[_0x3880('0x3d')]=_0xcfb855[_0x3880('0x3d')][_0x3880('0x40')]?_0xcfb855[_0x3880('0x3d')]:_0x2654f8['model'];_0xcfb855[_0x3880('0x43')]=qs[_0x3880('0x44')](_0x42fd3d[_0x3880('0x3a')][_0x3880('0x44')]);_0xcfb855[_0x3880('0x45')]=qs[_0x3880('0x3c')](_['pick'](_0x42fd3d[_0x3880('0x3a')],_0x2654f8['filters']));if(_0x42fd3d[_0x3880('0x3a')][_0x3880('0x2a')]){_0xcfb855[_0x3880('0x45')]=_[_0x3880('0x47')](_0xcfb855[_0x3880('0x45')],{'$or':_[_0x3880('0x2b')](_0xcfb855['attributes'],function(_0x2292e1){var _0x217879={};_0x217879[_0x2292e1]={'$like':'%'+_0x42fd3d[_0x3880('0x3a')][_0x3880('0x2a')]+'%'};return _0x217879;})});}_0xcfb855=_['merge']({},_0xcfb855,_0x42fd3d[_0x3880('0x48')]);return _0x191bd3[_0x3880('0x97')](_0xcfb855);}})[_0x3880('0x25')](function(_0x1583d5){if(_0x1583d5){_0x36d9f3=_0x1583d5['length'];if(!_0x42fd3d['query']['hasOwnProperty'](_0x3880('0x42'))){_0xcfb855['limit']=qs[_0x3880('0x1d')](_0x42fd3d[_0x3880('0x3a')][_0x3880('0x1d')]);_0xcfb855['offset']=qs['offset'](_0x42fd3d['query'][_0x3880('0x1c')]);}return _0x191bd3['getAgents'](_0xcfb855);}})[_0x3880('0x25')](function(_0x1c9758){if(_0x1c9758){return _0x1c9758?{'count':_0x36d9f3,'rows':_0x1c9758}:null;}})[_0x3880('0x25')](respondWithResult(_0x5c85bc,null))[_0x3880('0x4d')](handleError(_0x5c85bc,null));};exports[_0x3880('0x98')]=function(_0xa1716f,_0x53a8d2,_0xe2eca7){var _0x12e9dd={};var _0x737886={};var _0xe5f207;var _0x1bffa8;return db[_0x3880('0x36')][_0x3880('0x62')]({'where':{'id':_0xa1716f[_0x3880('0x4e')]['id']}})[_0x3880('0x25')](handleEntityNotFound(_0x53a8d2,null))[_0x3880('0x25')](function(_0x52768f){if(_0x52768f){_0xe5f207=_0x52768f;_0x737886[_0x3880('0x39')]=_[_0x3880('0x3b')](db['UserVoiceQueueRt']['rawAttributes']);_0x737886['query']=_[_0x3880('0x3b')](_0xa1716f[_0x3880('0x3a')]);_0x737886[_0x3880('0x3c')]=_[_0x3880('0x3e')](_0x737886[_0x3880('0x39')],_0x737886[_0x3880('0x3a')]);_0x12e9dd[_0x3880('0x3d')]=_[_0x3880('0x3e')](_0x737886['model'],qs[_0x3880('0x3f')](_0xa1716f['query'][_0x3880('0x3f')]));_0x12e9dd['attributes']=_0x12e9dd[_0x3880('0x3d')][_0x3880('0x40')]?_0x12e9dd[_0x3880('0x3d')]:_0x737886[_0x3880('0x39')];_0x12e9dd[_0x3880('0x43')]=qs[_0x3880('0x44')](_0xa1716f[_0x3880('0x3a')][_0x3880('0x44')]);_0x12e9dd[_0x3880('0x45')]=qs[_0x3880('0x3c')](_['pick'](_0xa1716f[_0x3880('0x3a')],_0x737886[_0x3880('0x3c')]));if(_0xa1716f[_0x3880('0x3a')][_0x3880('0x2a')]){_0x12e9dd[_0x3880('0x45')]=_[_0x3880('0x47')](_0x12e9dd['where'],{'$or':_['map'](_0x12e9dd[_0x3880('0x3d')],function(_0x36585a){var _0x49659c={};_0x49659c[_0x36585a]={'$like':'%'+_0xa1716f[_0x3880('0x3a')][_0x3880('0x2a')]+'%'};return _0x49659c;})});}_0x12e9dd=_['merge']({},_0x12e9dd,_0xa1716f[_0x3880('0x48')]);return _0xe5f207[_0x3880('0x98')](_0x12e9dd);}})[_0x3880('0x25')](function(_0x18c14e){if(_0x18c14e){_0x1bffa8=_0x18c14e['length'];if(!_0xa1716f[_0x3880('0x3a')]['hasOwnProperty'](_0x3880('0x42'))){_0x12e9dd['limit']=qs[_0x3880('0x1d')](_0xa1716f[_0x3880('0x3a')]['limit']);_0x12e9dd[_0x3880('0x1c')]=qs[_0x3880('0x1c')](_0xa1716f[_0x3880('0x3a')][_0x3880('0x1c')]);}return _0xe5f207[_0x3880('0x98')](_0x12e9dd);}})[_0x3880('0x25')](function(_0x1db9ca){return _0x1db9ca?{'count':_0x1bffa8,'rows':_0x1db9ca}:null;})[_0x3880('0x25')](respondWithResult(_0x53a8d2,null))['catch'](handleError(_0x53a8d2,null));};exports[_0x3880('0x99')]=function(_0x4f66be,_0x3fbe87,_0x2f559c){var _0x1f4fb8={};var _0x32d75a={};var _0x15b1c2;var _0x27000d;return db['VoiceQueue']['findOne']({'where':{'id':_0x4f66be[_0x3880('0x4e')]['id']}})[_0x3880('0x25')](handleEntityNotFound(_0x3fbe87,null))[_0x3880('0x25')](function(_0x45a7bc){if(_0x45a7bc){_0x15b1c2=_0x45a7bc;_0x32d75a[_0x3880('0x39')]=_[_0x3880('0x3b')](db['CmList'][_0x3880('0x37')]);_0x32d75a['query']=_['keys'](_0x4f66be['query']);_0x32d75a[_0x3880('0x3c')]=_[_0x3880('0x3e')](_0x32d75a[_0x3880('0x39')],_0x32d75a['query']);_0x1f4fb8[_0x3880('0x3d')]=_[_0x3880('0x3e')](_0x32d75a['model'],qs['fields'](_0x4f66be[_0x3880('0x3a')][_0x3880('0x3f')]));_0x1f4fb8[_0x3880('0x3d')]=_0x1f4fb8[_0x3880('0x3d')][_0x3880('0x40')]?_0x1f4fb8[_0x3880('0x3d')]:_0x32d75a[_0x3880('0x39')];_0x1f4fb8[_0x3880('0x43')]=qs[_0x3880('0x44')](_0x4f66be[_0x3880('0x3a')][_0x3880('0x44')]);_0x1f4fb8[_0x3880('0x45')]=qs[_0x3880('0x3c')](_[_0x3880('0x46')](_0x4f66be[_0x3880('0x3a')],_0x32d75a[_0x3880('0x3c')]));if(_0x4f66be['query'][_0x3880('0x2a')]){_0x1f4fb8[_0x3880('0x45')]=_[_0x3880('0x47')](_0x1f4fb8['where'],{'$or':_[_0x3880('0x2b')](_0x1f4fb8['attributes'],function(_0x52a696){var _0x1584ec={};_0x1584ec[_0x52a696]={'$like':'%'+_0x4f66be[_0x3880('0x3a')][_0x3880('0x2a')]+'%'};return _0x1584ec;})});}_0x1f4fb8=_['merge']({},_0x1f4fb8,_0x4f66be[_0x3880('0x48')]);return _0x15b1c2[_0x3880('0x99')](_0x1f4fb8);}})[_0x3880('0x25')](function(_0x2d29a2){if(_0x2d29a2){_0x27000d=_0x2d29a2[_0x3880('0x40')];if(!_0x4f66be[_0x3880('0x3a')][_0x3880('0x41')](_0x3880('0x42'))){_0x1f4fb8[_0x3880('0x1d')]=qs[_0x3880('0x1d')](_0x4f66be[_0x3880('0x3a')][_0x3880('0x1d')]);_0x1f4fb8['offset']=qs['offset'](_0x4f66be['query'][_0x3880('0x1c')]);}return _0x15b1c2[_0x3880('0x99')](_0x1f4fb8);}})['then'](function(_0x39d7fd){if(_0x39d7fd){return _0x39d7fd?{'count':_0x27000d,'rows':_0x39d7fd}:null;}})[_0x3880('0x25')](respondWithResult(_0x3fbe87,null))[_0x3880('0x4d')](handleError(_0x3fbe87,null));};exports[_0x3880('0x9a')]=function(_0x461fa1,_0x45fd41,_0x187689){var _0x22833b,_0x2121df;return db[_0x3880('0x36')][_0x3880('0x2d')]({'where':{'id':_0x461fa1[_0x3880('0x4e')]['id']}})['then'](handleEntityNotFound(_0x45fd41,null))[_0x3880('0x25')](function(_0x3d48b9){if(_0x3d48b9){_0x2121df=_0x3d48b9;return _0x3d48b9[_0x3880('0x9a')](_0x461fa1[_0x3880('0x50')][_0x3880('0x7f')],_[_0x3880('0x5a')](_0x461fa1[_0x3880('0x50')],[_0x3880('0x7f'),'id'])||{});}return null;})['spread'](function(_0x1f0dfa){var _0xda2cae;_0x22833b=_0x1f0dfa||[];var _0x55461f=[];if(_0x1f0dfa){for(var _0x2da7e0=0x0;_0x2da7e0<_0x1f0dfa['length'];_0x2da7e0+=0x1){var _0x1c7b1a=_0x1f0dfa[_0x2da7e0]['get']({'plain':!![]});_0x2121df['dialCheckDuplicateType']=_0x461fa1[_0x3880('0x50')]['dialCheckDuplicateType']?_0x461fa1[_0x3880('0x50')][_0x3880('0x9b')]:_0x2121df[_0x3880('0x9b')];switch(_0x2121df[_0x3880('0x9b')]){case _0x3880('0x9c'):_0xda2cae=squel['insert']()[_0x3880('0x9d')](_0x3880('0x9e'))['fromQuery'](['phone','scheduledAt',_0x3880('0x9f'),_0x3880('0xa0'),_0x3880('0x60'),'createdAt',_0x3880('0x5c')],squel['select']()[_0x3880('0x81')]('phone',_0x3880('0xa1'))[_0x3880('0x81')](_0x3880('0xa2'),'scheduledAt')[_0x3880('0x81')]('id',_0x3880('0x9f'))[_0x3880('0x81')](_0x1c7b1a[_0x3880('0xa3')]['toString'](),'ListId')[_0x3880('0x81')](_0x461fa1['params']['id']['toString'](),_0x3880('0x60'))[_0x3880('0x81')](_0x3880('0xa2'),'createdAt')['field'](_0x3880('0xa2'),_0x3880('0x5c'))[_0x3880('0x82')]('cm_contacts')[_0x3880('0x45')](_0x3880('0xa4'))[_0x3880('0x45')](_0x3880('0xa5'),_0x1c7b1a[_0x3880('0xa3')][_0x3880('0x8b')]())[_0x3880('0x45')](_0x3880('0xa6'))['where'](_0x3880('0xa7'),squel[_0x3880('0x80')]()[_0x3880('0x81')](_0x3880('0xa8'))[_0x3880('0x82')](_0x3880('0xa9'))[_0x3880('0x45')]('VoiceQueueId\x20=\x20?',_0x461fa1[_0x3880('0x4e')]['id'][_0x3880('0x8b')]()))[_0x3880('0x45')](_0x3880('0xa7'),squel[_0x3880('0x80')]()[_0x3880('0x81')](_0x3880('0xaa'))[_0x3880('0x82')](_0x3880('0x9e'))[_0x3880('0x45')](_0x3880('0x87'),_0x461fa1[_0x3880('0x4e')]['id'][_0x3880('0x8b')]())))[_0x3880('0x8b')]();break;case _0x3880('0xab'):_0xda2cae=squel['insert']()[_0x3880('0x9d')](_0x3880('0x9e'))['fromQuery']([_0x3880('0xa1'),'scheduledAt',_0x3880('0x9f'),_0x3880('0xa0'),'VoiceQueueId',_0x3880('0x5b'),_0x3880('0x5c')],squel[_0x3880('0x80')]()[_0x3880('0x81')]('phone',_0x3880('0xa1'))[_0x3880('0x81')](_0x3880('0xa2'),'scheduledAt')[_0x3880('0x81')]('id',_0x3880('0x9f'))[_0x3880('0x81')](_0x1c7b1a[_0x3880('0xa3')]['toString'](),_0x3880('0xa0'))[_0x3880('0x81')](_0x461fa1[_0x3880('0x4e')]['id'][_0x3880('0x8b')](),'VoiceQueueId')[_0x3880('0x81')](_0x3880('0xa2'),_0x3880('0x5b'))['field'](_0x3880('0xa2'),_0x3880('0x5c'))['from']('cm_contacts')[_0x3880('0x45')]('deletedAt\x20IS\x20NULL')[_0x3880('0x45')]('ListId\x20=\x20?',_0x1c7b1a[_0x3880('0xa3')][_0x3880('0x8b')]())[_0x3880('0x45')](_0x3880('0xa6'))['where'](_0x3880('0xa7'),squel[_0x3880('0x80')]()[_0x3880('0x81')]('COALESCE(phone,\x27\x27)')[_0x3880('0x82')]('cm_hopper')[_0x3880('0x45')]('VoiceQueueId\x20=\x20?',_0x461fa1[_0x3880('0x4e')]['id'][_0x3880('0x8b')]())))[_0x3880('0x8b')]();break;default:_0xda2cae=squel[_0x3880('0xac')]()[_0x3880('0x9d')]('cm_hopper')[_0x3880('0xad')]([_0x3880('0xa1'),_0x3880('0xae'),_0x3880('0x9f'),'ListId',_0x3880('0x60'),_0x3880('0x5b'),_0x3880('0x5c')],squel[_0x3880('0x80')]()['field'](_0x3880('0xa1'),_0x3880('0xa1'))[_0x3880('0x81')]('NOW()',_0x3880('0xae'))[_0x3880('0x81')]('id','ContactId')['field'](_0x1c7b1a[_0x3880('0xa3')]['toString'](),_0x3880('0xa0'))['field'](_0x461fa1[_0x3880('0x4e')]['id'][_0x3880('0x8b')](),_0x3880('0x60'))[_0x3880('0x81')](_0x3880('0xa2'),_0x3880('0x5b'))['field'](_0x3880('0xa2'),_0x3880('0x5c'))[_0x3880('0x82')]('cm_contacts')[_0x3880('0x45')]('deletedAt\x20IS\x20NULL')[_0x3880('0x45')](_0x3880('0xa5'),_0x1c7b1a[_0x3880('0xa3')][_0x3880('0x8b')]())[_0x3880('0x45')](_0x3880('0xa6')))[_0x3880('0x8b')]();}_0x55461f['push'](db[_0x3880('0x8a')][_0x3880('0x3a')](_0xda2cae));}return BPromise[_0x3880('0x8f')](_0x55461f);}})[_0x3880('0x25')](function(){return _0x22833b;})[_0x3880('0x25')](respondWithResult(_0x45fd41,null))[_0x3880('0x4d')](handleError(_0x45fd41,null));};exports[_0x3880('0xaf')]=function(_0x6e2a5a,_0x32e3dc,_0x4fe1f2){return db[_0x3880('0x36')][_0x3880('0x2d')]({'where':{'id':_0x6e2a5a[_0x3880('0x4e')]['id']}})['then'](handleEntityNotFound(_0x32e3dc,null))[_0x3880('0x25')](function(_0x44a957){if(_0x44a957){return _0x44a957['removeLists'](_0x6e2a5a[_0x3880('0x3a')]['ids']);}})[_0x3880('0x25')](function(_0x24ffee){if(_0x24ffee){return db['CmHopper'][_0x3880('0x26')]({'where':{'ListId':_0x6e2a5a[_0x3880('0x3a')]['ids'],'VoiceQueueId':_0x6e2a5a[_0x3880('0x4e')]['id']}})['then'](function(){return _0x24ffee;});}})[_0x3880('0x25')](respondWithStatusCode(_0x32e3dc,null))[_0x3880('0x4d')](handleError(_0x32e3dc,null));};exports['getBlackLists']=function(_0x554c00,_0x3a641e,_0x17707c){var _0x2e4983={};var _0x2b657d={};var _0x26c143;var _0x1daaf6;return db['VoiceQueue'][_0x3880('0x62')]({'where':{'id':_0x554c00['params']['id']}})[_0x3880('0x25')](handleEntityNotFound(_0x3a641e,null))[_0x3880('0x25')](function(_0x1af04b){if(_0x1af04b){_0x26c143=_0x1af04b;_0x2b657d['model']=_[_0x3880('0x3b')](db[_0x3880('0xb0')]['rawAttributes']);_0x2b657d[_0x3880('0x3a')]=_['keys'](_0x554c00[_0x3880('0x3a')]);_0x2b657d[_0x3880('0x3c')]=_[_0x3880('0x3e')](_0x2b657d[_0x3880('0x39')],_0x2b657d['query']);_0x2e4983[_0x3880('0x3d')]=_[_0x3880('0x3e')](_0x2b657d[_0x3880('0x39')],qs['fields'](_0x554c00['query']['fields']));_0x2e4983['attributes']=_0x2e4983[_0x3880('0x3d')][_0x3880('0x40')]?_0x2e4983[_0x3880('0x3d')]:_0x2b657d[_0x3880('0x39')];_0x2e4983[_0x3880('0x43')]=qs[_0x3880('0x44')](_0x554c00[_0x3880('0x3a')][_0x3880('0x44')]);_0x2e4983[_0x3880('0x45')]=qs[_0x3880('0x3c')](_['pick'](_0x554c00[_0x3880('0x3a')],_0x2b657d[_0x3880('0x3c')]));if(_0x554c00[_0x3880('0x3a')][_0x3880('0x2a')]){_0x2e4983[_0x3880('0x45')]=_[_0x3880('0x47')](_0x2e4983[_0x3880('0x45')],{'$or':_[_0x3880('0x2b')](_0x2e4983[_0x3880('0x3d')],function(_0x187dc8){var _0x569390={};_0x569390[_0x187dc8]={'$like':'%'+_0x554c00[_0x3880('0x3a')][_0x3880('0x2a')]+'%'};return _0x569390;})});}_0x2e4983=_[_0x3880('0x47')]({},_0x2e4983,_0x554c00[_0x3880('0x48')]);return _0x26c143['getBlackLists'](_0x2e4983);}})['then'](function(_0x3e1643){if(_0x3e1643){_0x1daaf6=_0x3e1643[_0x3880('0x40')];if(!_0x554c00[_0x3880('0x3a')][_0x3880('0x41')]('nolimit')){_0x2e4983['limit']=qs[_0x3880('0x1d')](_0x554c00[_0x3880('0x3a')][_0x3880('0x1d')]);_0x2e4983[_0x3880('0x1c')]=qs[_0x3880('0x1c')](_0x554c00[_0x3880('0x3a')][_0x3880('0x1c')]);}return _0x26c143[_0x3880('0xb1')](_0x2e4983);}})[_0x3880('0x25')](function(_0x17fb12){if(_0x17fb12){return _0x17fb12?{'count':_0x1daaf6,'rows':_0x17fb12}:null;}})[_0x3880('0x25')](respondWithResult(_0x3a641e,null))[_0x3880('0x4d')](handleError(_0x3a641e,null));};exports['addBlackLists']=function(_0x447d96,_0x552012,_0x39d48e){var _0x77e896,_0x11aa36;return db[_0x3880('0x36')][_0x3880('0x2d')]({'where':{'id':_0x447d96[_0x3880('0x4e')]['id']}})[_0x3880('0x25')](handleEntityNotFound(_0x552012,null))['then'](function(_0x1c9317){if(_0x1c9317){_0x11aa36=_0x1c9317;return _0x1c9317[_0x3880('0xb2')](_0x447d96[_0x3880('0x50')][_0x3880('0x7f')],_['omit'](_0x447d96[_0x3880('0x50')],['ids','id'])||{});}return null;})[_0x3880('0x95')](function(_0x1be173){var _0x34ee4c;_0x77e896=_0x1be173||[];var _0x532eb1=[];if(_0x1be173){for(var _0x199827=0x0;_0x199827<_0x1be173[_0x3880('0x40')];_0x199827+=0x1){var _0x417772=_0x1be173[_0x199827][_0x3880('0x53')]({'plain':!![]});_0x34ee4c=squel['insert']()[_0x3880('0x9d')](_0x3880('0xb3'))[_0x3880('0xad')]([_0x3880('0xa1'),'ContactId',_0x3880('0xa0'),_0x3880('0x60'),_0x3880('0x5b'),_0x3880('0x5c')],squel[_0x3880('0x80')]()[_0x3880('0x81')](_0x3880('0xa1'),_0x3880('0xa1'))['field']('id',_0x3880('0x9f'))[_0x3880('0x81')](_0x417772['CmListId'][_0x3880('0x8b')](),'ListId')[_0x3880('0x81')](_0x447d96[_0x3880('0x4e')]['id']['toString'](),_0x3880('0x60'))[_0x3880('0x81')]('NOW()','createdAt')['field'](_0x3880('0xa2'),_0x3880('0x5c'))[_0x3880('0x82')](_0x3880('0xb4'))[_0x3880('0x45')](_0x3880('0xa4'))[_0x3880('0x45')]('ListId\x20=\x20?',_0x417772[_0x3880('0xa3')]['toString']())[_0x3880('0x45')](_0x3880('0xa6')))[_0x3880('0x8b')]();_0x532eb1[_0x3880('0x89')](db['sequelize'][_0x3880('0x3a')](_0x34ee4c));}return BPromise[_0x3880('0x8f')](_0x532eb1);}})[_0x3880('0x25')](function(){return _0x77e896;})[_0x3880('0x25')](respondWithResult(_0x552012,null))[_0x3880('0x4d')](handleError(_0x552012,null));};exports[_0x3880('0xb5')]=function(_0x38849e,_0x5a55e7,_0x2b3fc1){return db[_0x3880('0x36')]['find']({'where':{'id':_0x38849e[_0x3880('0x4e')]['id']}})[_0x3880('0x25')](handleEntityNotFound(_0x5a55e7,null))['then'](function(_0x1c2c58){if(_0x1c2c58){return _0x1c2c58[_0x3880('0xb5')](_0x38849e[_0x3880('0x3a')][_0x3880('0x7f')]);}})['then'](function(_0x5f2bfc){if(_0x5f2bfc){return db['CmHopperBlack'][_0x3880('0x26')]({'where':{'ListId':_0x38849e[_0x3880('0x3a')][_0x3880('0x7f')],'VoiceQueueId':_0x38849e[_0x3880('0x4e')]['id']}})[_0x3880('0x25')](function(){return _0x5f2bfc;});}})['then'](respondWithStatusCode(_0x5a55e7,null))['catch'](handleError(_0x5a55e7,null));}; \ No newline at end of file +var _0x8635=['penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','UserVoiceQueueRt','interface','format','SIP/%s','removeTeams','ids','field','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','emit','userVoiceQueue:save','isNil','all','isArray','getAgents','getMembers','CmList','getLists','addLists','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','select','NOW()','ContactId','CmListId','ListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','into','phone\x20IS\x20NOT\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','value','type','name','UserProfileResource','destroy','then','error','send','index','map','VoiceQueue','rawAttributes','key','model','query','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','include','updatedAt','omit','createdAt','autoAssociation','getHoppers','CmHopper','hasOwnProperty','VoiceQueueId','rows','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','User','Agents','online','voicePause','flatMap','forEach'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x8635,0x1ba));var _0x5863=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x8635[_0x134c2e];return _0x2825db;};'use strict';var emlformat=require(_0x5863('0x0'));var rimraf=require(_0x5863('0x1'));var zipdir=require(_0x5863('0x2'));var jsonpatch=require(_0x5863('0x3'));var rp=require('request-promise');var moment=require(_0x5863('0x4'));var BPromise=require(_0x5863('0x5'));var Mustache=require(_0x5863('0x6'));var util=require(_0x5863('0x7'));var path=require(_0x5863('0x8'));var sox=require(_0x5863('0x9'));var csv=require(_0x5863('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5863('0xb'));var crypto=require(_0x5863('0xc'));var jsforce=require(_0x5863('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5863('0xa'));var querystring=require('querystring');var Papa=require(_0x5863('0xe'));var Redis=require(_0x5863('0xf'));var authService=require(_0x5863('0x10'));var qs=require(_0x5863('0x11'));var as=require(_0x5863('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5863('0x13'))(_0x5863('0x14'));var utils=require(_0x5863('0x15'));var config=require(_0x5863('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x5863('0x17')]=_[_0x5863('0x18')](config[_0x5863('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x5863('0x19'))(new Redis(config[_0x5863('0x17')]));require('./voiceQueue.socket')[_0x5863('0x1a')](socket);function respondWithStatusCode(_0x5a9a56,_0x3751ab){_0x3751ab=_0x3751ab||0xcc;return function(_0x392032){if(_0x392032){return _0x5a9a56[_0x5863('0x1b')](_0x3751ab);}return _0x5a9a56[_0x5863('0x1c')](_0x3751ab)[_0x5863('0x1d')]();};}function respondWithResult(_0x4847ab,_0x5e656e){_0x5e656e=_0x5e656e||0xc8;return function(_0x4134f6){if(_0x4134f6){return _0x4847ab[_0x5863('0x1c')](_0x5e656e)[_0x5863('0x1e')](_0x4134f6);}};}function respondWithFilteredResult(_0x324c4d,_0x3cff42){return function(_0xf43613){if(_0xf43613){var _0x4e2be1=typeof _0x3cff42[_0x5863('0x1f')]===_0x5863('0x20')&&typeof _0x3cff42['limit']===_0x5863('0x20');var _0x23206e=_0xf43613[_0x5863('0x21')];var _0x5b332c=_0x4e2be1?0x0:_0x3cff42[_0x5863('0x1f')];var _0x488584=_0x4e2be1?_0xf43613[_0x5863('0x21')]:_0x3cff42[_0x5863('0x1f')]+_0x3cff42['limit'];var _0x4ed253;if(_0x488584>=_0x23206e){_0x488584=_0x23206e;_0x4ed253=0xc8;}else{_0x4ed253=0xce;}_0x324c4d[_0x5863('0x1c')](_0x4ed253);return _0x324c4d[_0x5863('0x22')](_0x5863('0x23'),_0x5b332c+'-'+_0x488584+'/'+_0x23206e)[_0x5863('0x1e')](_0xf43613);}return null;};}function patchUpdates(_0x139022){return function(_0x5c5d5b){try{jsonpatch[_0x5863('0x24')](_0x5c5d5b,_0x139022,!![]);}catch(_0x4c0ff9){return BPromise[_0x5863('0x25')](_0x4c0ff9);}return _0x5c5d5b['save']();};}function saveUpdates(_0xe9ad2,_0x205fe1){return function(_0x3076c3){if(_0x3076c3){return _0x3076c3[_0x5863('0x26')](_0xe9ad2)['then'](function(_0x2d69f5){return _0x2d69f5;});}return null;};}function removeEntity(_0x3c27f7,_0x15cc7b){return function(_0x55bbae){if(_0x55bbae){return _0x55bbae['destroy']()['then'](function(){var _0x533e2a=_0x55bbae[_0x5863('0x27')]({'plain':!![]});var _0x151c0e=[{'name':_0x5863('0x28'),'value':_0x5863('0x29'),'ignore':![]},{'name':_0x5863('0x2a'),'value':_0x5863('0x2b'),'ignore':![]}];var _0x1d7505=_(_0x151c0e)[_0x5863('0x2c')](_0x5863('0x2d'))['map']('value')[_0x5863('0x2e')]();if(_['includes'](_0x1d7505,_0x533e2a[_0x5863('0x2f')])){return;}var _0xf1d407=_['find'](_0x151c0e,[_0x5863('0x2e'),_0x533e2a['type']])[_0x5863('0x30')];return db[_0x5863('0x31')][_0x5863('0x32')]({'where':{'type':_0xf1d407,'resourceId':_0x533e2a['id']}})['then'](function(){return _0x55bbae;});})[_0x5863('0x33')](function(){_0x3c27f7[_0x5863('0x1c')](0xcc)[_0x5863('0x1d')]();});}};}function handleEntityNotFound(_0x2376ac,_0x5dba93){return function(_0x31b6d7){if(!_0x31b6d7){_0x2376ac[_0x5863('0x1b')](0x194);}return _0x31b6d7;};}function handleError(_0xfdb84d,_0x4fbd64){_0x4fbd64=_0x4fbd64||0x1f4;return function(_0x5a4a65){logger[_0x5863('0x34')](_0x5a4a65['stack']);if(_0x5a4a65[_0x5863('0x30')]){delete _0x5a4a65[_0x5863('0x30')];}_0xfdb84d['status'](_0x4fbd64)[_0x5863('0x35')](_0x5a4a65);};}exports[_0x5863('0x36')]=function(_0x34d4c0,_0x46684a){var _0x404bb5={},_0x3770e1={},_0x1ab5c6={'count':0x0,'rows':[]};var _0x3685b6=_[_0x5863('0x37')](db[_0x5863('0x38')][_0x5863('0x39')],function(_0x14bc13){return{'name':_0x14bc13['fieldName'],'type':_0x14bc13[_0x5863('0x2f')][_0x5863('0x3a')]};});_0x3770e1[_0x5863('0x3b')]=_[_0x5863('0x37')](_0x3685b6,_0x5863('0x30'));_0x3770e1[_0x5863('0x3c')]=_['keys'](_0x34d4c0[_0x5863('0x3c')]);_0x3770e1[_0x5863('0x3d')]=_['intersection'](_0x3770e1[_0x5863('0x3b')],_0x3770e1[_0x5863('0x3c')]);_0x404bb5[_0x5863('0x3e')]=_[_0x5863('0x3f')](_0x3770e1[_0x5863('0x3b')],qs[_0x5863('0x40')](_0x34d4c0[_0x5863('0x3c')][_0x5863('0x40')]));_0x404bb5[_0x5863('0x3e')]=_0x404bb5[_0x5863('0x3e')][_0x5863('0x41')]?_0x404bb5[_0x5863('0x3e')]:_0x3770e1['model'];if(!_0x34d4c0[_0x5863('0x3c')]['hasOwnProperty'](_0x5863('0x42'))){_0x404bb5[_0x5863('0x43')]=qs[_0x5863('0x43')](_0x34d4c0['query'][_0x5863('0x43')]);_0x404bb5[_0x5863('0x1f')]=qs[_0x5863('0x1f')](_0x34d4c0[_0x5863('0x3c')][_0x5863('0x1f')]);}_0x404bb5[_0x5863('0x44')]=qs['sort'](_0x34d4c0[_0x5863('0x3c')][_0x5863('0x45')]);_0x404bb5[_0x5863('0x46')]=qs[_0x5863('0x3d')](_[_0x5863('0x47')](_0x34d4c0[_0x5863('0x3c')],_0x3770e1[_0x5863('0x3d')]),_0x3685b6);if(_0x34d4c0[_0x5863('0x3c')][_0x5863('0x2c')]){_0x404bb5[_0x5863('0x46')]=_[_0x5863('0x48')](_0x404bb5[_0x5863('0x46')],{'$or':_['map'](_0x3685b6,function(_0x4c157f){if(_0x4c157f['type']!==_0x5863('0x49')){var _0x49b027={};_0x49b027[_0x4c157f[_0x5863('0x30')]]={'$like':'%'+_0x34d4c0['query'][_0x5863('0x2c')]+'%'};return _0x49b027;}})});}_0x404bb5=_['merge']({},_0x404bb5,_0x34d4c0[_0x5863('0x4a')]);var _0x4b0f6f={'where':_0x404bb5[_0x5863('0x46')]};return db[_0x5863('0x38')]['count'](_0x4b0f6f)['then'](function(_0x40e64a){_0x1ab5c6['count']=_0x40e64a;if(_0x34d4c0['query'][_0x5863('0x4b')]){_0x404bb5['include']=[{'all':!![]}];}return db[_0x5863('0x38')][_0x5863('0x4c')](_0x404bb5);})[_0x5863('0x33')](function(_0x21dba0){_0x1ab5c6['rows']=_0x21dba0;return _0x1ab5c6;})[_0x5863('0x33')](respondWithFilteredResult(_0x46684a,_0x404bb5))[_0x5863('0x4d')](handleError(_0x46684a,null));};exports[_0x5863('0x4e')]=function(_0x46dedf,_0x41e1bd){var _0x410919={'raw':![],'where':{'id':_0x46dedf[_0x5863('0x4f')]['id']}},_0x43e55b={};_0x43e55b['model']=_[_0x5863('0x50')](db[_0x5863('0x38')][_0x5863('0x39')]);_0x43e55b['query']=_[_0x5863('0x50')](_0x46dedf['query']);_0x43e55b[_0x5863('0x3d')]=_[_0x5863('0x3f')](_0x43e55b[_0x5863('0x3b')],_0x43e55b['query']);_0x410919[_0x5863('0x3e')]=_['intersection'](_0x43e55b['model'],qs[_0x5863('0x40')](_0x46dedf[_0x5863('0x3c')][_0x5863('0x40')]));_0x410919[_0x5863('0x3e')]=_0x410919[_0x5863('0x3e')][_0x5863('0x41')]?_0x410919['attributes']:_0x43e55b[_0x5863('0x3b')];if(_0x46dedf[_0x5863('0x3c')][_0x5863('0x4b')]){_0x410919['include']=[{'all':!![]}];}_0x410919=_[_0x5863('0x48')]({},_0x410919,_0x46dedf['options']);return db[_0x5863('0x38')][_0x5863('0x51')](_0x410919)[_0x5863('0x33')](handleEntityNotFound(_0x41e1bd,null))[_0x5863('0x33')](respondWithResult(_0x41e1bd,null))[_0x5863('0x4d')](handleError(_0x41e1bd,null));};exports[_0x5863('0x52')]=function(_0x1cc485,_0x4cd0bf){return db[_0x5863('0x38')][_0x5863('0x52')](_0x1cc485[_0x5863('0x53')],{})[_0x5863('0x33')](function(_0x1bca37){var _0x1a11c2=_0x1cc485['user'][_0x5863('0x27')]({'plain':!![]});if(!_0x1a11c2)throw new Error(_0x5863('0x54'));if(_0x1a11c2[_0x5863('0x55')]===_0x5863('0x56')){var _0xff2a76=_0x1bca37[_0x5863('0x27')]({'plain':!![]});var _0x365352=[{'name':_0x5863('0x28'),'value':_0x5863('0x29')},{'name':_0x5863('0x2a'),'value':'outbound'}];var _0xe7923c=_['find'](_0x365352,[_0x5863('0x2e'),_0xff2a76[_0x5863('0x2f')]])[_0x5863('0x30')];return db[_0x5863('0x57')]['find']({'where':{'name':_0xe7923c,'userProfileId':_0x1a11c2[_0x5863('0x58')]},'raw':!![]})[_0x5863('0x33')](function(_0x2681f4){if(_0x2681f4&&_0x2681f4['autoAssociation']===0x0){return db[_0x5863('0x31')][_0x5863('0x52')]({'name':_0xff2a76[_0x5863('0x30')],'resourceId':_0xff2a76['id'],'type':_0x2681f4['name'],'sectionId':_0x2681f4['id']},{})[_0x5863('0x33')](function(){return _0x1bca37;});}else{return _0x1bca37;}})['catch'](function(_0x506bb0){logger[_0x5863('0x34')](_0x5863('0x59'),_0x506bb0);throw _0x506bb0;});}return _0x1bca37;})[_0x5863('0x33')](respondWithResult(_0x4cd0bf,0xc9))[_0x5863('0x4d')](handleError(_0x4cd0bf,null));};exports[_0x5863('0x5a')]=function(_0x1ff4a3,_0x3032f6){var _0x133f3d={'where':{'id':_0x1ff4a3[_0x5863('0x4f')]['id']}},_0x1738ab={};_0x1738ab[_0x5863('0x3b')]=_['keys'](db['VoiceQueue'][_0x5863('0x39')]);_0x133f3d[_0x5863('0x3e')]=_[_0x5863('0x3f')](_0x1738ab[_0x5863('0x3b')],qs['fields'](_0x1ff4a3[_0x5863('0x3c')][_0x5863('0x40')]));_0x133f3d['attributes']=_0x133f3d[_0x5863('0x3e')]['length']?_0x133f3d[_0x5863('0x3e')]:_0x1738ab[_0x5863('0x3b')];if(_0x1ff4a3[_0x5863('0x3c')][_0x5863('0x4b')]){_0x133f3d[_0x5863('0x5b')]=[{'all':!![]}];}_0x133f3d=_[_0x5863('0x48')]({},_0x133f3d,_0x1ff4a3[_0x5863('0x4a')]);return db[_0x5863('0x38')][_0x5863('0x51')](_0x133f3d)[_0x5863('0x33')](handleEntityNotFound(_0x3032f6,null))['then'](function(_0x57d158){if(_0x57d158){var _0x2b52ff=_0x57d158[_0x5863('0x27')]({'plain':!![]});_0x2b52ff=qs['omit'](_0x2b52ff,['id','createdAt',_0x5863('0x5c')]);_0x1ff4a3[_0x5863('0x53')]=_[_0x5863('0x5d')](_0x1ff4a3['body'],['id',_0x5863('0x5e'),'updatedAt']);return db[_0x5863('0x38')][_0x5863('0x52')](_[_0x5863('0x48')](_0x2b52ff,_0x1ff4a3[_0x5863('0x53')]),{'include':_0x1ff4a3[_0x5863('0x3c')][_0x5863('0x4b')]?[{'all':!![]}]:undefined})[_0x5863('0x33')](function(_0x3e6941){var _0x3d043d=_0x1ff4a3[_0x5863('0x56')]['get']({'plain':!![]});if(!_0x3d043d)throw new Error(_0x5863('0x54'));if(_0x3d043d[_0x5863('0x55')]==='user'){var _0x17b4bd=_0x3e6941[_0x5863('0x27')]({'plain':!![]});var _0x5a0a43=[{'name':_0x5863('0x28'),'value':_0x5863('0x29')},{'name':'QueueCampaigns','value':_0x5863('0x2b')}];var _0x2e485b=_[_0x5863('0x51')](_0x5a0a43,[_0x5863('0x2e'),_0x17b4bd[_0x5863('0x2f')]])['name'];return db[_0x5863('0x57')][_0x5863('0x51')]({'where':{'name':_0x2e485b,'userProfileId':_0x3d043d['userProfileId']},'raw':!![]})[_0x5863('0x33')](function(_0x22d8e8){if(_0x22d8e8&&_0x22d8e8[_0x5863('0x5f')]===0x0){return db[_0x5863('0x31')][_0x5863('0x52')]({'name':_0x17b4bd[_0x5863('0x30')],'resourceId':_0x17b4bd['id'],'type':_0x22d8e8[_0x5863('0x30')],'sectionId':_0x22d8e8['id']},{})[_0x5863('0x33')](function(){return _0x3e6941;});}else{return _0x3e6941;}})[_0x5863('0x4d')](function(_0x3177a0){logger[_0x5863('0x34')](_0x5863('0x59'),_0x3177a0);throw _0x3177a0;});}return _0x3e6941;});}})[_0x5863('0x33')](respondWithResult(_0x3032f6,0xc9))[_0x5863('0x4d')](handleError(_0x3032f6,null));};exports[_0x5863('0x26')]=function(_0x495b1e,_0x1d2ad0){if(_0x495b1e[_0x5863('0x53')]['id']){delete _0x495b1e['body']['id'];}return db[_0x5863('0x38')][_0x5863('0x51')]({'where':{'id':_0x495b1e[_0x5863('0x4f')]['id']}})[_0x5863('0x33')](handleEntityNotFound(_0x1d2ad0,null))[_0x5863('0x33')](saveUpdates(_0x495b1e[_0x5863('0x53')],null))[_0x5863('0x33')](respondWithResult(_0x1d2ad0,null))[_0x5863('0x4d')](handleError(_0x1d2ad0,null));};exports['destroy']=function(_0xee5624,_0x4bd759){return db[_0x5863('0x38')][_0x5863('0x51')]({'where':{'id':_0xee5624['params']['id']}})[_0x5863('0x33')](handleEntityNotFound(_0x4bd759,null))['then'](removeEntity(_0x4bd759,null))[_0x5863('0x4d')](handleError(_0x4bd759,null));};exports[_0x5863('0x60')]=function(_0x47fdf0,_0x5cff71,_0x12ed21){var _0x1b5935={'raw':![],'where':{}};var _0xc9846e={};var _0xa1488={'count':0x0,'rows':[]};return db[_0x5863('0x38')]['findOne']({'where':{'id':_0x47fdf0[_0x5863('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5cff71,null))[_0x5863('0x33')](function(_0x25e01a){if(_0x25e01a){_0xc9846e[_0x5863('0x3b')]=_['keys'](db[_0x5863('0x61')][_0x5863('0x39')]);_0xc9846e[_0x5863('0x3c')]=_[_0x5863('0x50')](_0x47fdf0['query']);_0xc9846e['filters']=_['intersection'](_0xc9846e[_0x5863('0x3b')],_0xc9846e[_0x5863('0x3c')]);_0x1b5935[_0x5863('0x3e')]=_[_0x5863('0x3f')](_0xc9846e['model'],qs[_0x5863('0x40')](_0x47fdf0[_0x5863('0x3c')]['fields']));_0x1b5935['attributes']=_0x1b5935[_0x5863('0x3e')][_0x5863('0x41')]?_0x1b5935[_0x5863('0x3e')]:_0xc9846e[_0x5863('0x3b')];if(!_0x47fdf0[_0x5863('0x3c')][_0x5863('0x62')]('nolimit')){_0x1b5935[_0x5863('0x43')]=qs[_0x5863('0x43')](_0x47fdf0[_0x5863('0x3c')]['limit']);_0x1b5935[_0x5863('0x1f')]=qs['offset'](_0x47fdf0[_0x5863('0x3c')][_0x5863('0x1f')]);}_0x1b5935['order']=qs[_0x5863('0x45')](_0x47fdf0['query'][_0x5863('0x45')]);_0x1b5935[_0x5863('0x46')]=qs['filters'](_[_0x5863('0x47')](_0x47fdf0['query'],_0xc9846e[_0x5863('0x3d')]));_0x1b5935[_0x5863('0x46')][_0x5863('0x63')]=_0x25e01a['id'];if(_0x47fdf0[_0x5863('0x3c')][_0x5863('0x2c')]){_0x1b5935[_0x5863('0x46')]=_[_0x5863('0x48')](_0x1b5935[_0x5863('0x46')],{'$or':_[_0x5863('0x37')](_0x1b5935[_0x5863('0x3e')],function(_0x5066a2){var _0x108840={};_0x108840[_0x5066a2]={'$like':'%'+_0x47fdf0[_0x5863('0x3c')][_0x5863('0x2c')]+'%'};return _0x108840;})});}_0x1b5935=_['merge']({},_0x1b5935,_0x47fdf0[_0x5863('0x4a')]);return db[_0x5863('0x61')]['count']({'where':_0x1b5935['where']})[_0x5863('0x33')](function(_0x206f3a){_0xa1488[_0x5863('0x21')]=_0x206f3a;if(_0x47fdf0[_0x5863('0x3c')][_0x5863('0x4b')]){_0x1b5935[_0x5863('0x5b')]=[{'all':!![]}];}return db['CmHopper'][_0x5863('0x4c')](_0x1b5935);})[_0x5863('0x33')](function(_0x558b7a){_0xa1488[_0x5863('0x64')]=_0x558b7a;return _0xa1488;});}})[_0x5863('0x33')](respondWithFilteredResult(_0x5cff71,_0x1b5935))[_0x5863('0x4d')](handleError(_0x5cff71,null));};exports['getHopperHistories']=function(_0x22ae45,_0x5f4ea6,_0x111694){var _0x30a663={'raw':!![],'where':{}};var _0xb846f2={};var _0x414d7e={'count':0x0,'rows':[]};return db[_0x5863('0x38')][_0x5863('0x65')]({'where':{'id':_0x22ae45['params']['id']}})[_0x5863('0x33')](handleEntityNotFound(_0x5f4ea6,null))[_0x5863('0x33')](function(_0x13b897){if(_0x13b897){_0xb846f2[_0x5863('0x3b')]=_[_0x5863('0x50')](db[_0x5863('0x66')][_0x5863('0x39')]);_0xb846f2[_0x5863('0x3c')]=_[_0x5863('0x50')](_0x22ae45['query']);_0xb846f2['filters']=_['intersection'](_0xb846f2[_0x5863('0x3b')],_0xb846f2[_0x5863('0x3c')]);_0x30a663[_0x5863('0x3e')]=_['intersection'](_0xb846f2['model'],qs[_0x5863('0x40')](_0x22ae45[_0x5863('0x3c')][_0x5863('0x40')]));_0x30a663['attributes']=_0x30a663['attributes'][_0x5863('0x41')]?_0x30a663[_0x5863('0x3e')]:_0xb846f2[_0x5863('0x3b')];if(!_0x22ae45[_0x5863('0x3c')][_0x5863('0x62')](_0x5863('0x42'))){_0x30a663[_0x5863('0x43')]=qs[_0x5863('0x43')](_0x22ae45[_0x5863('0x3c')]['limit']);_0x30a663[_0x5863('0x1f')]=qs['offset'](_0x22ae45[_0x5863('0x3c')]['offset']);}_0x30a663[_0x5863('0x44')]=qs[_0x5863('0x45')](_0x22ae45[_0x5863('0x3c')]['sort']);_0x30a663[_0x5863('0x46')]=qs[_0x5863('0x3d')](_[_0x5863('0x47')](_0x22ae45[_0x5863('0x3c')],_0xb846f2[_0x5863('0x3d')]));_0x30a663[_0x5863('0x46')][_0x5863('0x63')]=_0x13b897['id'];if(_0x22ae45[_0x5863('0x3c')]['filter']){_0x30a663['where']=_[_0x5863('0x48')](_0x30a663[_0x5863('0x46')],{'$or':_[_0x5863('0x37')](_0x30a663[_0x5863('0x3e')],function(_0x4b5366){var _0x2222a7={};_0x2222a7[_0x4b5366]={'$like':'%'+_0x22ae45[_0x5863('0x3c')]['filter']+'%'};return _0x2222a7;})});}_0x30a663=_['merge']({},_0x30a663,_0x22ae45['options']);return db[_0x5863('0x66')][_0x5863('0x21')]({'where':_0x30a663['where']})['then'](function(_0x86faa){_0x414d7e[_0x5863('0x21')]=_0x86faa;if(_0x22ae45[_0x5863('0x3c')][_0x5863('0x4b')]){_0x30a663['include']=[{'all':!![]}];}return db[_0x5863('0x66')]['findAll'](_0x30a663);})[_0x5863('0x33')](function(_0x159978){_0x414d7e[_0x5863('0x64')]=_0x159978;return _0x414d7e;});}})[_0x5863('0x33')](respondWithFilteredResult(_0x5f4ea6,_0x30a663))[_0x5863('0x4d')](handleError(_0x5f4ea6,null));};exports[_0x5863('0x67')]=function(_0x503445,_0x1e4ae5,_0x2dd618){var _0x161b9c={'raw':!![],'where':{}};var _0x341a89={};var _0x3ddf97={'count':0x0,'rows':[]};return db[_0x5863('0x38')][_0x5863('0x65')]({'where':{'id':_0x503445[_0x5863('0x4f')]['id']}})[_0x5863('0x33')](handleEntityNotFound(_0x1e4ae5,null))['then'](function(_0x1d2ecf){if(_0x1d2ecf){_0x341a89[_0x5863('0x3b')]=_['keys'](db[_0x5863('0x68')][_0x5863('0x39')]);_0x341a89[_0x5863('0x3c')]=_[_0x5863('0x50')](_0x503445[_0x5863('0x3c')]);_0x341a89[_0x5863('0x3d')]=_['intersection'](_0x341a89[_0x5863('0x3b')],_0x341a89[_0x5863('0x3c')]);_0x161b9c[_0x5863('0x3e')]=_[_0x5863('0x3f')](_0x341a89[_0x5863('0x3b')],qs[_0x5863('0x40')](_0x503445[_0x5863('0x3c')]['fields']));_0x161b9c[_0x5863('0x3e')]=_0x161b9c[_0x5863('0x3e')][_0x5863('0x41')]?_0x161b9c[_0x5863('0x3e')]:_0x341a89[_0x5863('0x3b')];if(!_0x503445[_0x5863('0x3c')][_0x5863('0x62')](_0x5863('0x42'))){_0x161b9c[_0x5863('0x43')]=qs[_0x5863('0x43')](_0x503445['query']['limit']);_0x161b9c['offset']=qs['offset'](_0x503445['query'][_0x5863('0x1f')]);}_0x161b9c['order']=qs[_0x5863('0x45')](_0x503445[_0x5863('0x3c')]['sort']);_0x161b9c[_0x5863('0x46')]=qs[_0x5863('0x3d')](_[_0x5863('0x47')](_0x503445[_0x5863('0x3c')],_0x341a89['filters']));_0x161b9c['where'][_0x5863('0x63')]=_0x1d2ecf['id'];if(_0x503445[_0x5863('0x3c')][_0x5863('0x2c')]){_0x161b9c[_0x5863('0x46')]=_[_0x5863('0x48')](_0x161b9c['where'],{'$or':_['map'](_0x161b9c[_0x5863('0x3e')],function(_0x509613){var _0xb45b6e={};_0xb45b6e[_0x509613]={'$like':'%'+_0x503445[_0x5863('0x3c')][_0x5863('0x2c')]+'%'};return _0xb45b6e;})});}_0x161b9c=_[_0x5863('0x48')]({},_0x161b9c,_0x503445[_0x5863('0x4a')]);return db['CmHopperFinal'][_0x5863('0x21')]({'where':_0x161b9c[_0x5863('0x46')]})[_0x5863('0x33')](function(_0x2117af){_0x3ddf97[_0x5863('0x21')]=_0x2117af;if(_0x503445[_0x5863('0x3c')][_0x5863('0x4b')]){_0x161b9c[_0x5863('0x5b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x5863('0x4c')](_0x161b9c);})[_0x5863('0x33')](function(_0x58d9cd){_0x3ddf97[_0x5863('0x64')]=_0x58d9cd;return _0x3ddf97;});}})[_0x5863('0x33')](respondWithFilteredResult(_0x1e4ae5,_0x161b9c))[_0x5863('0x4d')](handleError(_0x1e4ae5,null));};exports[_0x5863('0x69')]=function(_0x164ba9,_0x2e1297,_0x2bde89){var _0x5a5170={'raw':!![],'where':{}};var _0x4f5479={};var _0x441c1b={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x164ba9[_0x5863('0x4f')]['id']}})[_0x5863('0x33')](handleEntityNotFound(_0x2e1297,null))['then'](function(_0x25945e){if(_0x25945e){_0x4f5479[_0x5863('0x3b')]=_[_0x5863('0x50')](db['CmHopperBlack'][_0x5863('0x39')]);_0x4f5479[_0x5863('0x3c')]=_[_0x5863('0x50')](_0x164ba9[_0x5863('0x3c')]);_0x4f5479[_0x5863('0x3d')]=_['intersection'](_0x4f5479[_0x5863('0x3b')],_0x4f5479['query']);_0x5a5170['attributes']=_[_0x5863('0x3f')](_0x4f5479[_0x5863('0x3b')],qs[_0x5863('0x40')](_0x164ba9[_0x5863('0x3c')]['fields']));_0x5a5170['attributes']=_0x5a5170[_0x5863('0x3e')][_0x5863('0x41')]?_0x5a5170[_0x5863('0x3e')]:_0x4f5479[_0x5863('0x3b')];if(!_0x164ba9[_0x5863('0x3c')][_0x5863('0x62')](_0x5863('0x42'))){_0x5a5170[_0x5863('0x43')]=qs[_0x5863('0x43')](_0x164ba9[_0x5863('0x3c')][_0x5863('0x43')]);_0x5a5170[_0x5863('0x1f')]=qs['offset'](_0x164ba9[_0x5863('0x3c')][_0x5863('0x1f')]);}_0x5a5170['order']=qs[_0x5863('0x45')](_0x164ba9[_0x5863('0x3c')]['sort']);_0x5a5170[_0x5863('0x46')]=qs['filters'](_['pick'](_0x164ba9[_0x5863('0x3c')],_0x4f5479['filters']));_0x5a5170[_0x5863('0x46')][_0x5863('0x63')]=_0x25945e['id'];if(_0x164ba9[_0x5863('0x3c')][_0x5863('0x2c')]){_0x5a5170[_0x5863('0x46')]=_['merge'](_0x5a5170[_0x5863('0x46')],{'$or':_[_0x5863('0x37')](_0x5a5170[_0x5863('0x3e')],function(_0x2239ba){var _0x4de728={};_0x4de728[_0x2239ba]={'$like':'%'+_0x164ba9[_0x5863('0x3c')][_0x5863('0x2c')]+'%'};return _0x4de728;})});}_0x5a5170=_[_0x5863('0x48')]({},_0x5a5170,_0x164ba9[_0x5863('0x4a')]);return db[_0x5863('0x6a')]['count']({'where':_0x5a5170['where']})[_0x5863('0x33')](function(_0x14814b){_0x441c1b[_0x5863('0x21')]=_0x14814b;if(_0x164ba9[_0x5863('0x3c')]['includeAll']){_0x5a5170[_0x5863('0x5b')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x5a5170);})[_0x5863('0x33')](function(_0x2bbf07){_0x441c1b[_0x5863('0x64')]=_0x2bbf07;return _0x441c1b;});}})['then'](respondWithFilteredResult(_0x2e1297,_0x5a5170))['catch'](handleError(_0x2e1297,null));};exports[_0x5863('0x6b')]=function(_0x5ea6b2,_0x64e62e,_0x32a0ef){var _0x241d5a={};var _0x37d18e={};var _0x27cd8e;var _0xa6853a;return db['VoiceQueue']['findOne']({'where':{'id':_0x5ea6b2[_0x5863('0x4f')]['id']}})[_0x5863('0x33')](handleEntityNotFound(_0x64e62e,null))[_0x5863('0x33')](function(_0x401c44){if(_0x401c44){_0x27cd8e=_0x401c44;_0x37d18e[_0x5863('0x3b')]=_[_0x5863('0x50')](db[_0x5863('0x6c')][_0x5863('0x39')]);_0x37d18e[_0x5863('0x3c')]=_[_0x5863('0x50')](_0x5ea6b2['query']);_0x37d18e[_0x5863('0x3d')]=_['intersection'](_0x37d18e[_0x5863('0x3b')],_0x37d18e['query']);_0x241d5a[_0x5863('0x3e')]=_[_0x5863('0x3f')](_0x37d18e[_0x5863('0x3b')],qs[_0x5863('0x40')](_0x5ea6b2[_0x5863('0x3c')]['fields']));_0x241d5a[_0x5863('0x3e')]=_0x241d5a[_0x5863('0x3e')][_0x5863('0x41')]?_0x241d5a['attributes']:_0x37d18e[_0x5863('0x3b')];_0x241d5a[_0x5863('0x44')]=qs['sort'](_0x5ea6b2['query'][_0x5863('0x45')]);_0x241d5a[_0x5863('0x46')]=qs[_0x5863('0x3d')](_[_0x5863('0x47')](_0x5ea6b2['query'],_0x37d18e['filters']));if(_0x5ea6b2[_0x5863('0x3c')][_0x5863('0x2c')]){_0x241d5a[_0x5863('0x46')]=_[_0x5863('0x48')](_0x241d5a['where'],{'$or':_[_0x5863('0x37')](_0x241d5a[_0x5863('0x3e')],function(_0x3b325e){var _0x30935d={};_0x30935d[_0x3b325e]={'$like':'%'+_0x5ea6b2['query']['filter']+'%'};return _0x30935d;})});}_0x241d5a=_[_0x5863('0x48')]({},_0x241d5a,_0x5ea6b2['options']);return _0x27cd8e[_0x5863('0x6b')](_0x241d5a);}})[_0x5863('0x33')](function(_0x3d05d2){if(_0x3d05d2){_0xa6853a=_0x3d05d2[_0x5863('0x41')];if(!_0x5ea6b2[_0x5863('0x3c')][_0x5863('0x62')](_0x5863('0x42'))){_0x241d5a[_0x5863('0x43')]=qs['limit'](_0x5ea6b2[_0x5863('0x3c')][_0x5863('0x43')]);_0x241d5a[_0x5863('0x1f')]=qs[_0x5863('0x1f')](_0x5ea6b2[_0x5863('0x3c')][_0x5863('0x1f')]);}return _0x27cd8e[_0x5863('0x6b')](_0x241d5a);}})[_0x5863('0x33')](function(_0x3f2212){if(_0x3f2212){return _0x3f2212?{'count':_0xa6853a,'rows':_0x3f2212}:null;}})[_0x5863('0x33')](respondWithResult(_0x64e62e,null))[_0x5863('0x4d')](handleError(_0x64e62e,null));};exports[_0x5863('0x6d')]=function(_0x446bf1,_0x2f6016,_0x2c2ea1){var _0x4435b2=_0x446bf1[_0x5863('0x53')]['teams'];var _0x1ce192=_[_0x5863('0x37')](_0x4435b2,'id');return db[_0x5863('0x6c')][_0x5863('0x4c')]({'where':{'id':_0x1ce192},'attributes':['id'],'include':[{'model':db[_0x5863('0x6e')],'as':_0x5863('0x6f'),'attributes':['id',_0x5863('0x30'),_0x5863('0x70'),_0x5863('0x71'),'interface'],'raw':!![]}]})[_0x5863('0x33')](function(_0x2f841c){if(_0x2f841c){var _0x23d31e=_[_0x5863('0x72')](_0x2f841c,function(_0x444fe5){var _0x1a926=_0x444fe5[_0x5863('0x27')]({'plain':!![]});_0x1a926[_0x5863('0x6f')][_0x5863('0x73')](function(_0x2fc8a5){_0x2fc8a5[_0x5863('0x74')]=_[_0x5863('0x51')](_0x4435b2,{'id':_0x1a926['id']})[_0x5863('0x74')];});return _0x1a926[_0x5863('0x6f')];});return db[_0x5863('0x38')][_0x5863('0x51')]({'where':{'id':_0x446bf1['params']['id']}})[_0x5863('0x33')](function(_0x5989b1){return db[_0x5863('0x75')][_0x5863('0x76')](function(_0x5ca156){return _0x5989b1[_0x5863('0x6d')](_0x1ce192,{'transaction':_0x5ca156})[_0x5863('0x33')](function(){return BPromise[_0x5863('0x77')](_0x4435b2,function(_0x1eb72a){return db[_0x5863('0x78')][_0x5863('0x79')]({'TeamId':_0x1eb72a['id'],'VoiceQueueId':_0x446bf1['params']['id'],'penalty':_0x1eb72a['penalty']},{'transaction':_0x5ca156});});})[_0x5863('0x33')](function(){return BPromise['each'](_0x23d31e,function(_0x94e09){return db[_0x5863('0x7a')]['findOrCreate']({'where':{'UserId':_0x94e09['id'],'VoiceQueueId':_0x446bf1[_0x5863('0x4f')]['id']},'defaults':{'penalty':_0x94e09[_0x5863('0x74')]},'transaction':_0x5ca156});});})[_0x5863('0x33')](function(){return BPromise[_0x5863('0x77')](_['filter'](_0x23d31e,{'online':!![]}),function(_0x4bf155){return db[_0x5863('0x7b')]['upsert']({'membername':_0x4bf155[_0x5863('0x30')],'UserId':_0x4bf155['id'],'queue_name':_0x5989b1[_0x5863('0x30')],'VoiceQueueId':_0x5989b1['id'],'interface':_['isNil'](_0x4bf155[_0x5863('0x7c')])?util[_0x5863('0x7d')](_0x5863('0x7e'),_0x4bf155[_0x5863('0x30')]):_0x4bf155[_0x5863('0x7c')],'paused':_0x4bf155[_0x5863('0x71')]||![],'penalty':_0x4bf155['penalty']},{'transaction':_0x5ca156});});})[_0x5863('0x33')](function(){_0x23d31e['forEach'](function(_0x459703){socket['emit']('userVoiceQueue:save',{'UserId':_0x459703['id'],'VoiceQueueId':_0x5989b1['id']});});});});});}})[_0x5863('0x33')](respondWithStatusCode(_0x2f6016,null))[_0x5863('0x4d')](handleError(_0x2f6016,null));};exports[_0x5863('0x7f')]=function(_0x422f27,_0x1b9d7d,_0x4a27cb){return db['Team']['findAll']({'where':{'id':_0x422f27[_0x5863('0x3c')][_0x5863('0x80')]},'attributes':['id'],'include':[{'model':db[_0x5863('0x6e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x5863('0x33')](handleEntityNotFound(_0x1b9d7d,null))[_0x5863('0x33')](function(_0x2de551){var _0x1aefaf=_[_0x5863('0x37')](_0x2de551,'id');var _0x359a67=[];var _0x5987ee=[];var _0x25c2cb=squel['select']();_0x25c2cb[_0x5863('0x81')]('tq.TeamId')[_0x5863('0x82')](_0x5863('0x83'),'tq')[_0x5863('0x84')](_0x5863('0x85'),'ut',_0x5863('0x86'))[_0x5863('0x46')](_0x5863('0x87'),_0x422f27[_0x5863('0x4f')]['id']);for(var _0x4db57e=0x0;_0x4db57e<_0x2de551[_0x5863('0x41')];_0x4db57e+=0x1){let _0x317b83=_0x2de551[_0x4db57e];for(var _0x38dd2b=0x0;_0x38dd2b<_0x317b83[_0x5863('0x6f')][_0x5863('0x41')];_0x38dd2b+=0x1){let _0x170b47=_0x317b83[_0x5863('0x6f')][_0x38dd2b];var _0x23c000=_0x25c2cb[_0x5863('0x5a')]();_0x23c000['where'](_0x5863('0x88'),_0x170b47['id']);_0x5987ee[_0x5863('0x89')](db[_0x5863('0x75')][_0x5863('0x3c')](_0x23c000[_0x5863('0x8a')](),{'type':db[_0x5863('0x75')][_0x5863('0x8b')][_0x5863('0x8c')]})[_0x5863('0x33')](function(_0x399b03){if(_0x399b03[_0x5863('0x41')]===0x1){return _0x170b47['id'];}else{var _0x2eaa26=_[_0x5863('0x8d')](_[_0x5863('0x37')](_0x399b03,'TeamId'),function(_0xedfcfc){return _[_0x5863('0x8e')](_0x1aefaf,_0xedfcfc);});if(_0x2eaa26){return _0x170b47['id'];}}}));}}return BPromise['all'](_0x5987ee)['then'](function(_0x47a6ae){_0x359a67=_(_0x359a67)['union'](_0x47a6ae)[_0x5863('0x8f')]()['value']();return db[_0x5863('0x38')]['find']({'where':{'id':_0x422f27[_0x5863('0x4f')]['id']}})[_0x5863('0x33')](function(_0x58bb75){return db['sequelize'][_0x5863('0x76')](function(_0x8c1a6f){return _0x58bb75['removeTeams'](_0x422f27[_0x5863('0x3c')][_0x5863('0x80')],{'transaction':_0x8c1a6f})[_0x5863('0x33')](function(){if(!_[_0x5863('0x90')](_0x359a67)){return _0x58bb75[_0x5863('0x91')](_0x359a67,{'transaction':_0x8c1a6f})[_0x5863('0x33')](function(){return db[_0x5863('0x7b')][_0x5863('0x32')]({'where':{'VoiceQueueId':_0x422f27[_0x5863('0x4f')]['id'],'UserId':_0x359a67},'transaction':_0x8c1a6f});});}})[_0x5863('0x33')](function(){_0x359a67[_0x5863('0x73')](function(_0x1e5087){socket['emit'](_0x5863('0x92'),{'UserId':_0x1e5087,'VoiceQueueId':_0x58bb75['id']});});});});});});})[_0x5863('0x33')](respondWithStatusCode(_0x1b9d7d,null))[_0x5863('0x4d')](handleError(_0x1b9d7d,null));};exports[_0x5863('0x93')]=function(_0x4bd5ae,_0x39b05f,_0x4a8ff8){var _0xa0a7d6,_0x516b27;return db[_0x5863('0x38')][_0x5863('0x51')]({'where':{'id':_0x4bd5ae[_0x5863('0x4f')]['id']}})['then'](handleEntityNotFound(_0x39b05f,null))[_0x5863('0x33')](function(_0x5976f3){if(_0x5976f3){_0x516b27=_0x5976f3;return _0x5976f3[_0x5863('0x93')](_0x4bd5ae[_0x5863('0x53')]['ids'],_[_0x5863('0x5d')](_0x4bd5ae[_0x5863('0x53')],['ids','id'])||{})['spread'](function(_0x3bc82c){for(var _0x31505d=0x0;_0x31505d<_0x4bd5ae[_0x5863('0x53')][_0x5863('0x80')][_0x5863('0x41')];_0x31505d+=0x1){socket[_0x5863('0x94')](_0x5863('0x95'),{'UserId':Number(_0x4bd5ae[_0x5863('0x53')][_0x5863('0x80')][_0x31505d]),'VoiceQueueId':Number(_0x4bd5ae[_0x5863('0x4f')]['id'])});}return _0x3bc82c;});}})[_0x5863('0x33')](function(_0x26175e){_0xa0a7d6=_0x26175e||[];if(_0x516b27){return db[_0x5863('0x6e')][_0x5863('0x4c')]({'where':{'id':_0x4bd5ae[_0x5863('0x53')][_0x5863('0x80')]},'attributes':['id',_0x5863('0x30'),_0x5863('0x70'),_0x5863('0x71'),_0x5863('0x7c')],'raw':!![]});}})[_0x5863('0x33')](function(_0x1c6aa7){if(!_[_0x5863('0x90')](_0x1c6aa7)){var _0x5bfc81=[];for(var _0x218deb=0x0;_0x218deb<_0x1c6aa7[_0x5863('0x41')];_0x218deb++){if(_0x1c6aa7[_0x218deb][_0x5863('0x70')]){_0x5bfc81[_0x5863('0x89')](db[_0x5863('0x7b')][_0x5863('0x79')]({'membername':_0x1c6aa7[_0x218deb]['name'],'UserId':_0x1c6aa7[_0x218deb]['id'],'queue_name':_0x516b27[_0x5863('0x30')],'VoiceQueueId':_0x516b27['id'],'interface':_[_0x5863('0x96')](_0x1c6aa7[_0x218deb][_0x5863('0x7c')])?util['format'](_0x5863('0x7e'),_0x1c6aa7[_0x218deb][_0x5863('0x30')]):_0x1c6aa7[_0x218deb][_0x5863('0x7c')],'paused':_0x1c6aa7[_0x218deb][_0x5863('0x71')]||![],'penalty':_0x4bd5ae['body'][_0x5863('0x74')]||0x0}));}}return BPromise[_0x5863('0x97')](_0x5bfc81);}})[_0x5863('0x33')](function(){return _0xa0a7d6;})['then'](respondWithResult(_0x39b05f,null))[_0x5863('0x4d')](handleError(_0x39b05f,null));};exports[_0x5863('0x91')]=function(_0x29dc6e,_0x229f79,_0x373d81){return db[_0x5863('0x38')][_0x5863('0x51')]({'where':{'id':_0x29dc6e[_0x5863('0x4f')]['id']}})['then'](handleEntityNotFound(_0x229f79,null))[_0x5863('0x33')](function(_0x3582e8){if(_0x3582e8){return _0x3582e8[_0x5863('0x91')](_0x29dc6e['query']['ids'])[_0x5863('0x33')](function(){if(_[_0x5863('0x98')](_0x29dc6e['query'][_0x5863('0x80')])){for(var _0x5600a0=0x0;_0x5600a0<_0x29dc6e[_0x5863('0x3c')]['ids'][_0x5863('0x41')];_0x5600a0+=0x1){socket[_0x5863('0x94')](_0x5863('0x92'),{'UserId':Number(_0x29dc6e[_0x5863('0x3c')]['ids'][_0x5600a0]),'VoiceQueueId':Number(_0x29dc6e[_0x5863('0x4f')]['id'])});}}else{socket[_0x5863('0x94')](_0x5863('0x92'),{'UserId':Number(_0x29dc6e['query'][_0x5863('0x80')]),'VoiceQueueId':Number(_0x29dc6e['params']['id'])});}});}})[_0x5863('0x33')](function(_0x73a01c){return db[_0x5863('0x7b')][_0x5863('0x32')]({'where':{'VoiceQueueId':_0x29dc6e[_0x5863('0x4f')]['id'],'UserId':_0x29dc6e[_0x5863('0x3c')]['ids']}})[_0x5863('0x33')](function(){return _0x73a01c;});})['then'](respondWithStatusCode(_0x229f79,null))[_0x5863('0x4d')](handleError(_0x229f79,null));};exports['getAgents']=function(_0x462122,_0x3798ab,_0x5d5e85){var _0xe231a7={};var _0x2409ef={};var _0x16c7d8;var _0x36a5d5;return db['VoiceQueue']['findOne']({'where':{'id':_0x462122[_0x5863('0x4f')]['id']}})[_0x5863('0x33')](handleEntityNotFound(_0x3798ab,null))[_0x5863('0x33')](function(_0x46df0e){if(_0x46df0e){_0x16c7d8=_0x46df0e;_0x2409ef[_0x5863('0x3b')]=_[_0x5863('0x50')](db[_0x5863('0x6e')][_0x5863('0x39')]);_0x2409ef['query']=_[_0x5863('0x50')](_0x462122[_0x5863('0x3c')]);_0x2409ef[_0x5863('0x3d')]=_[_0x5863('0x3f')](_0x2409ef[_0x5863('0x3b')],_0x2409ef[_0x5863('0x3c')]);_0xe231a7[_0x5863('0x3e')]=_[_0x5863('0x3f')](_0x2409ef['model'],qs[_0x5863('0x40')](_0x462122['query'][_0x5863('0x40')]));_0xe231a7[_0x5863('0x3e')]=_0xe231a7['attributes'][_0x5863('0x41')]?_0xe231a7[_0x5863('0x3e')]:_0x2409ef['model'];_0xe231a7[_0x5863('0x44')]=qs[_0x5863('0x45')](_0x462122[_0x5863('0x3c')][_0x5863('0x45')]);_0xe231a7['where']=qs['filters'](_[_0x5863('0x47')](_0x462122[_0x5863('0x3c')],_0x2409ef[_0x5863('0x3d')]));if(_0x462122[_0x5863('0x3c')][_0x5863('0x2c')]){_0xe231a7[_0x5863('0x46')]=_['merge'](_0xe231a7['where'],{'$or':_[_0x5863('0x37')](_0xe231a7[_0x5863('0x3e')],function(_0x13950a){var _0x2c7999={};_0x2c7999[_0x13950a]={'$like':'%'+_0x462122[_0x5863('0x3c')][_0x5863('0x2c')]+'%'};return _0x2c7999;})});}_0xe231a7=_[_0x5863('0x48')]({},_0xe231a7,_0x462122[_0x5863('0x4a')]);return _0x16c7d8[_0x5863('0x99')](_0xe231a7);}})['then'](function(_0x63e86e){if(_0x63e86e){_0x36a5d5=_0x63e86e['length'];if(!_0x462122[_0x5863('0x3c')][_0x5863('0x62')]('nolimit')){_0xe231a7[_0x5863('0x43')]=qs[_0x5863('0x43')](_0x462122[_0x5863('0x3c')][_0x5863('0x43')]);_0xe231a7['offset']=qs['offset'](_0x462122[_0x5863('0x3c')][_0x5863('0x1f')]);}return _0x16c7d8[_0x5863('0x99')](_0xe231a7);}})[_0x5863('0x33')](function(_0x47c0b5){if(_0x47c0b5){return _0x47c0b5?{'count':_0x36a5d5,'rows':_0x47c0b5}:null;}})['then'](respondWithResult(_0x3798ab,null))[_0x5863('0x4d')](handleError(_0x3798ab,null));};exports[_0x5863('0x9a')]=function(_0x2cd57b,_0x2f08ca,_0x3494e1){var _0x3b8225={};var _0x329605={};var _0x123977;var _0x1ea072;return db[_0x5863('0x38')][_0x5863('0x65')]({'where':{'id':_0x2cd57b['params']['id']}})[_0x5863('0x33')](handleEntityNotFound(_0x2f08ca,null))[_0x5863('0x33')](function(_0xc73c15){if(_0xc73c15){_0x123977=_0xc73c15;_0x329605[_0x5863('0x3b')]=_[_0x5863('0x50')](db['UserVoiceQueueRt'][_0x5863('0x39')]);_0x329605[_0x5863('0x3c')]=_[_0x5863('0x50')](_0x2cd57b['query']);_0x329605[_0x5863('0x3d')]=_['intersection'](_0x329605[_0x5863('0x3b')],_0x329605[_0x5863('0x3c')]);_0x3b8225[_0x5863('0x3e')]=_[_0x5863('0x3f')](_0x329605[_0x5863('0x3b')],qs['fields'](_0x2cd57b[_0x5863('0x3c')][_0x5863('0x40')]));_0x3b8225['attributes']=_0x3b8225['attributes'][_0x5863('0x41')]?_0x3b8225[_0x5863('0x3e')]:_0x329605[_0x5863('0x3b')];_0x3b8225[_0x5863('0x44')]=qs[_0x5863('0x45')](_0x2cd57b[_0x5863('0x3c')][_0x5863('0x45')]);_0x3b8225[_0x5863('0x46')]=qs['filters'](_[_0x5863('0x47')](_0x2cd57b[_0x5863('0x3c')],_0x329605[_0x5863('0x3d')]));if(_0x2cd57b[_0x5863('0x3c')]['filter']){_0x3b8225['where']=_[_0x5863('0x48')](_0x3b8225[_0x5863('0x46')],{'$or':_[_0x5863('0x37')](_0x3b8225['attributes'],function(_0x34f97e){var _0x238b25={};_0x238b25[_0x34f97e]={'$like':'%'+_0x2cd57b[_0x5863('0x3c')][_0x5863('0x2c')]+'%'};return _0x238b25;})});}_0x3b8225=_[_0x5863('0x48')]({},_0x3b8225,_0x2cd57b[_0x5863('0x4a')]);return _0x123977[_0x5863('0x9a')](_0x3b8225);}})[_0x5863('0x33')](function(_0x25f175){if(_0x25f175){_0x1ea072=_0x25f175[_0x5863('0x41')];if(!_0x2cd57b[_0x5863('0x3c')][_0x5863('0x62')]('nolimit')){_0x3b8225[_0x5863('0x43')]=qs['limit'](_0x2cd57b[_0x5863('0x3c')]['limit']);_0x3b8225[_0x5863('0x1f')]=qs[_0x5863('0x1f')](_0x2cd57b[_0x5863('0x3c')][_0x5863('0x1f')]);}return _0x123977['getMembers'](_0x3b8225);}})[_0x5863('0x33')](function(_0x285c4a){return _0x285c4a?{'count':_0x1ea072,'rows':_0x285c4a}:null;})[_0x5863('0x33')](respondWithResult(_0x2f08ca,null))[_0x5863('0x4d')](handleError(_0x2f08ca,null));};exports['getLists']=function(_0x5c4c56,_0x5e5c38,_0x3431a6){var _0x12b38a={};var _0x44a995={};var _0x5a415d;var _0x3540ee;return db['VoiceQueue'][_0x5863('0x65')]({'where':{'id':_0x5c4c56[_0x5863('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5e5c38,null))[_0x5863('0x33')](function(_0x2d5807){if(_0x2d5807){_0x5a415d=_0x2d5807;_0x44a995[_0x5863('0x3b')]=_[_0x5863('0x50')](db[_0x5863('0x9b')]['rawAttributes']);_0x44a995['query']=_[_0x5863('0x50')](_0x5c4c56[_0x5863('0x3c')]);_0x44a995[_0x5863('0x3d')]=_[_0x5863('0x3f')](_0x44a995[_0x5863('0x3b')],_0x44a995[_0x5863('0x3c')]);_0x12b38a[_0x5863('0x3e')]=_['intersection'](_0x44a995[_0x5863('0x3b')],qs[_0x5863('0x40')](_0x5c4c56[_0x5863('0x3c')][_0x5863('0x40')]));_0x12b38a[_0x5863('0x3e')]=_0x12b38a['attributes'][_0x5863('0x41')]?_0x12b38a[_0x5863('0x3e')]:_0x44a995[_0x5863('0x3b')];_0x12b38a[_0x5863('0x44')]=qs[_0x5863('0x45')](_0x5c4c56[_0x5863('0x3c')]['sort']);_0x12b38a['where']=qs[_0x5863('0x3d')](_[_0x5863('0x47')](_0x5c4c56[_0x5863('0x3c')],_0x44a995[_0x5863('0x3d')]));if(_0x5c4c56[_0x5863('0x3c')][_0x5863('0x2c')]){_0x12b38a[_0x5863('0x46')]=_[_0x5863('0x48')](_0x12b38a['where'],{'$or':_[_0x5863('0x37')](_0x12b38a[_0x5863('0x3e')],function(_0x399ea0){var _0xd4c2c8={};_0xd4c2c8[_0x399ea0]={'$like':'%'+_0x5c4c56[_0x5863('0x3c')][_0x5863('0x2c')]+'%'};return _0xd4c2c8;})});}_0x12b38a=_[_0x5863('0x48')]({},_0x12b38a,_0x5c4c56[_0x5863('0x4a')]);return _0x5a415d[_0x5863('0x9c')](_0x12b38a);}})['then'](function(_0x323a60){if(_0x323a60){_0x3540ee=_0x323a60[_0x5863('0x41')];if(!_0x5c4c56[_0x5863('0x3c')][_0x5863('0x62')](_0x5863('0x42'))){_0x12b38a[_0x5863('0x43')]=qs[_0x5863('0x43')](_0x5c4c56[_0x5863('0x3c')][_0x5863('0x43')]);_0x12b38a['offset']=qs[_0x5863('0x1f')](_0x5c4c56[_0x5863('0x3c')][_0x5863('0x1f')]);}return _0x5a415d[_0x5863('0x9c')](_0x12b38a);}})[_0x5863('0x33')](function(_0x516df0){if(_0x516df0){return _0x516df0?{'count':_0x3540ee,'rows':_0x516df0}:null;}})[_0x5863('0x33')](respondWithResult(_0x5e5c38,null))[_0x5863('0x4d')](handleError(_0x5e5c38,null));};exports[_0x5863('0x9d')]=function(_0xe7e97c,_0x26b373,_0x1206cf){var _0x6c9b55,_0x394846;return db[_0x5863('0x38')][_0x5863('0x51')]({'where':{'id':_0xe7e97c['params']['id']}})[_0x5863('0x33')](handleEntityNotFound(_0x26b373,null))[_0x5863('0x33')](function(_0x565f80){if(_0x565f80){_0x394846=_0x565f80;return _0x565f80[_0x5863('0x9d')](_0xe7e97c[_0x5863('0x53')][_0x5863('0x80')],_[_0x5863('0x5d')](_0xe7e97c[_0x5863('0x53')],['ids','id'])||{});}return null;})[_0x5863('0x9e')](function(_0x4013ce){var _0x2af025;_0x6c9b55=_0x4013ce||[];var _0x363dfd=[];if(_0x4013ce){for(var _0x334240=0x0;_0x334240<_0x4013ce['length'];_0x334240+=0x1){var _0x3f52de=_0x4013ce[_0x334240]['get']({'plain':!![]});_0x394846[_0x5863('0x9f')]=_0xe7e97c[_0x5863('0x53')][_0x5863('0x9f')]?_0xe7e97c[_0x5863('0x53')][_0x5863('0x9f')]:_0x394846[_0x5863('0x9f')];switch(_0x394846[_0x5863('0x9f')]){case _0x5863('0xa0'):_0x2af025=squel[_0x5863('0xa1')]()['into'](_0x5863('0xa2'))[_0x5863('0xa3')]([_0x5863('0xa4'),_0x5863('0xa5'),'ContactId','ListId',_0x5863('0x63'),'createdAt',_0x5863('0x5c')],squel[_0x5863('0xa6')]()[_0x5863('0x81')](_0x5863('0xa4'),'phone')['field'](_0x5863('0xa7'),_0x5863('0xa5'))[_0x5863('0x81')]('id',_0x5863('0xa8'))[_0x5863('0x81')](_0x3f52de[_0x5863('0xa9')][_0x5863('0x8a')](),_0x5863('0xaa'))[_0x5863('0x81')](_0xe7e97c[_0x5863('0x4f')]['id']['toString'](),_0x5863('0x63'))['field']('NOW()','createdAt')[_0x5863('0x81')]('NOW()',_0x5863('0x5c'))['from'](_0x5863('0xab'))[_0x5863('0x46')](_0x5863('0xac'))[_0x5863('0x46')](_0x5863('0xad'),_0x3f52de[_0x5863('0xa9')]['toString']())[_0x5863('0x46')]('phone\x20IS\x20NOT\x20NULL')[_0x5863('0x46')](_0x5863('0xae'),squel['select']()['field'](_0x5863('0xaf'))[_0x5863('0x82')](_0x5863('0xb0'))[_0x5863('0x46')](_0x5863('0x87'),_0xe7e97c[_0x5863('0x4f')]['id'][_0x5863('0x8a')]()))[_0x5863('0x46')]('phone\x20NOT\x20IN\x20(?)',squel[_0x5863('0xa6')]()[_0x5863('0x81')](_0x5863('0xb1'))[_0x5863('0x82')](_0x5863('0xa2'))[_0x5863('0x46')](_0x5863('0x87'),_0xe7e97c['params']['id']['toString']())))[_0x5863('0x8a')]();break;case _0x5863('0xb2'):_0x2af025=squel[_0x5863('0xa1')]()[_0x5863('0xb3')](_0x5863('0xa2'))[_0x5863('0xa3')]([_0x5863('0xa4'),_0x5863('0xa5'),_0x5863('0xa8'),_0x5863('0xaa'),_0x5863('0x63'),_0x5863('0x5e'),'updatedAt'],squel['select']()[_0x5863('0x81')](_0x5863('0xa4'),_0x5863('0xa4'))[_0x5863('0x81')](_0x5863('0xa7'),_0x5863('0xa5'))[_0x5863('0x81')]('id','ContactId')[_0x5863('0x81')](_0x3f52de[_0x5863('0xa9')][_0x5863('0x8a')](),_0x5863('0xaa'))[_0x5863('0x81')](_0xe7e97c[_0x5863('0x4f')]['id']['toString'](),_0x5863('0x63'))[_0x5863('0x81')]('NOW()',_0x5863('0x5e'))[_0x5863('0x81')]('NOW()',_0x5863('0x5c'))[_0x5863('0x82')]('cm_contacts')[_0x5863('0x46')](_0x5863('0xac'))[_0x5863('0x46')]('ListId\x20=\x20?',_0x3f52de[_0x5863('0xa9')][_0x5863('0x8a')]())[_0x5863('0x46')](_0x5863('0xb4'))[_0x5863('0x46')](_0x5863('0xae'),squel[_0x5863('0xa6')]()['field']('COALESCE(phone,\x27\x27)')[_0x5863('0x82')](_0x5863('0xa2'))[_0x5863('0x46')](_0x5863('0x87'),_0xe7e97c[_0x5863('0x4f')]['id'][_0x5863('0x8a')]())))[_0x5863('0x8a')]();break;default:_0x2af025=squel[_0x5863('0xa1')]()[_0x5863('0xb3')]('cm_hopper')[_0x5863('0xa3')]([_0x5863('0xa4'),_0x5863('0xa5'),_0x5863('0xa8'),_0x5863('0xaa'),_0x5863('0x63'),_0x5863('0x5e'),_0x5863('0x5c')],squel['select']()[_0x5863('0x81')](_0x5863('0xa4'),_0x5863('0xa4'))[_0x5863('0x81')](_0x5863('0xa7'),_0x5863('0xa5'))[_0x5863('0x81')]('id','ContactId')[_0x5863('0x81')](_0x3f52de[_0x5863('0xa9')][_0x5863('0x8a')](),'ListId')['field'](_0xe7e97c[_0x5863('0x4f')]['id'][_0x5863('0x8a')](),_0x5863('0x63'))[_0x5863('0x81')](_0x5863('0xa7'),_0x5863('0x5e'))['field'](_0x5863('0xa7'),_0x5863('0x5c'))[_0x5863('0x82')](_0x5863('0xab'))[_0x5863('0x46')](_0x5863('0xac'))[_0x5863('0x46')](_0x5863('0xad'),_0x3f52de[_0x5863('0xa9')][_0x5863('0x8a')]())[_0x5863('0x46')](_0x5863('0xb4')))[_0x5863('0x8a')]();}_0x363dfd['push'](db[_0x5863('0x75')]['query'](_0x2af025));}return BPromise[_0x5863('0x97')](_0x363dfd);}})['then'](function(){return _0x6c9b55;})[_0x5863('0x33')](respondWithResult(_0x26b373,null))[_0x5863('0x4d')](handleError(_0x26b373,null));};exports[_0x5863('0xb5')]=function(_0x4b80d5,_0x939b8,_0x19ae07){return db[_0x5863('0x38')]['find']({'where':{'id':_0x4b80d5['params']['id']}})[_0x5863('0x33')](handleEntityNotFound(_0x939b8,null))[_0x5863('0x33')](function(_0x38b566){if(_0x38b566){return _0x38b566[_0x5863('0xb5')](_0x4b80d5[_0x5863('0x3c')]['ids']);}})['then'](function(_0x536478){if(_0x536478){return db[_0x5863('0x61')][_0x5863('0x32')]({'where':{'ListId':_0x4b80d5[_0x5863('0x3c')][_0x5863('0x80')],'VoiceQueueId':_0x4b80d5[_0x5863('0x4f')]['id']}})['then'](function(){return _0x536478;});}})[_0x5863('0x33')](respondWithStatusCode(_0x939b8,null))[_0x5863('0x4d')](handleError(_0x939b8,null));};exports[_0x5863('0xb6')]=function(_0x4244db,_0x226eda,_0x101937){var _0x5ee06d={};var _0x36bf76={};var _0x35fe5f;var _0x1a858c;return db[_0x5863('0x38')][_0x5863('0x65')]({'where':{'id':_0x4244db['params']['id']}})[_0x5863('0x33')](handleEntityNotFound(_0x226eda,null))[_0x5863('0x33')](function(_0x14c902){if(_0x14c902){_0x35fe5f=_0x14c902;_0x36bf76[_0x5863('0x3b')]=_[_0x5863('0x50')](db[_0x5863('0x9b')][_0x5863('0x39')]);_0x36bf76[_0x5863('0x3c')]=_['keys'](_0x4244db[_0x5863('0x3c')]);_0x36bf76[_0x5863('0x3d')]=_[_0x5863('0x3f')](_0x36bf76[_0x5863('0x3b')],_0x36bf76[_0x5863('0x3c')]);_0x5ee06d['attributes']=_['intersection'](_0x36bf76['model'],qs[_0x5863('0x40')](_0x4244db[_0x5863('0x3c')][_0x5863('0x40')]));_0x5ee06d[_0x5863('0x3e')]=_0x5ee06d['attributes'][_0x5863('0x41')]?_0x5ee06d[_0x5863('0x3e')]:_0x36bf76[_0x5863('0x3b')];_0x5ee06d[_0x5863('0x44')]=qs[_0x5863('0x45')](_0x4244db[_0x5863('0x3c')]['sort']);_0x5ee06d['where']=qs['filters'](_[_0x5863('0x47')](_0x4244db[_0x5863('0x3c')],_0x36bf76[_0x5863('0x3d')]));if(_0x4244db['query'][_0x5863('0x2c')]){_0x5ee06d[_0x5863('0x46')]=_[_0x5863('0x48')](_0x5ee06d[_0x5863('0x46')],{'$or':_[_0x5863('0x37')](_0x5ee06d['attributes'],function(_0x12a3c4){var _0x3c86f7={};_0x3c86f7[_0x12a3c4]={'$like':'%'+_0x4244db['query'][_0x5863('0x2c')]+'%'};return _0x3c86f7;})});}_0x5ee06d=_[_0x5863('0x48')]({},_0x5ee06d,_0x4244db[_0x5863('0x4a')]);return _0x35fe5f[_0x5863('0xb6')](_0x5ee06d);}})['then'](function(_0x1f8a79){if(_0x1f8a79){_0x1a858c=_0x1f8a79[_0x5863('0x41')];if(!_0x4244db['query'][_0x5863('0x62')](_0x5863('0x42'))){_0x5ee06d[_0x5863('0x43')]=qs[_0x5863('0x43')](_0x4244db[_0x5863('0x3c')][_0x5863('0x43')]);_0x5ee06d['offset']=qs[_0x5863('0x1f')](_0x4244db[_0x5863('0x3c')][_0x5863('0x1f')]);}return _0x35fe5f[_0x5863('0xb6')](_0x5ee06d);}})[_0x5863('0x33')](function(_0x314fd7){if(_0x314fd7){return _0x314fd7?{'count':_0x1a858c,'rows':_0x314fd7}:null;}})[_0x5863('0x33')](respondWithResult(_0x226eda,null))[_0x5863('0x4d')](handleError(_0x226eda,null));};exports[_0x5863('0xb7')]=function(_0x35690a,_0x6ad3bd,_0xd3e816){var _0x42b4d2,_0x37e036;return db['VoiceQueue'][_0x5863('0x51')]({'where':{'id':_0x35690a[_0x5863('0x4f')]['id']}})[_0x5863('0x33')](handleEntityNotFound(_0x6ad3bd,null))[_0x5863('0x33')](function(_0x26aef6){if(_0x26aef6){_0x37e036=_0x26aef6;return _0x26aef6[_0x5863('0xb7')](_0x35690a[_0x5863('0x53')][_0x5863('0x80')],_[_0x5863('0x5d')](_0x35690a[_0x5863('0x53')],[_0x5863('0x80'),'id'])||{});}return null;})[_0x5863('0x9e')](function(_0x2cbf4b){var _0x9fb8aa;_0x42b4d2=_0x2cbf4b||[];var _0x587191=[];if(_0x2cbf4b){for(var _0x25ea10=0x0;_0x25ea10<_0x2cbf4b[_0x5863('0x41')];_0x25ea10+=0x1){var _0x43a9c6=_0x2cbf4b[_0x25ea10][_0x5863('0x27')]({'plain':!![]});_0x9fb8aa=squel['insert']()[_0x5863('0xb3')](_0x5863('0xb8'))[_0x5863('0xa3')](['phone',_0x5863('0xa8'),_0x5863('0xaa'),_0x5863('0x63'),_0x5863('0x5e'),_0x5863('0x5c')],squel[_0x5863('0xa6')]()['field'](_0x5863('0xa4'),_0x5863('0xa4'))['field']('id',_0x5863('0xa8'))[_0x5863('0x81')](_0x43a9c6[_0x5863('0xa9')][_0x5863('0x8a')](),_0x5863('0xaa'))[_0x5863('0x81')](_0x35690a[_0x5863('0x4f')]['id']['toString'](),'VoiceQueueId')[_0x5863('0x81')](_0x5863('0xa7'),'createdAt')['field'](_0x5863('0xa7'),_0x5863('0x5c'))[_0x5863('0x82')](_0x5863('0xab'))[_0x5863('0x46')]('deletedAt\x20IS\x20NULL')[_0x5863('0x46')]('ListId\x20=\x20?',_0x43a9c6[_0x5863('0xa9')][_0x5863('0x8a')]())[_0x5863('0x46')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x587191[_0x5863('0x89')](db['sequelize'][_0x5863('0x3c')](_0x9fb8aa));}return BPromise['all'](_0x587191);}})[_0x5863('0x33')](function(){return _0x42b4d2;})[_0x5863('0x33')](respondWithResult(_0x6ad3bd,null))[_0x5863('0x4d')](handleError(_0x6ad3bd,null));};exports[_0x5863('0xb9')]=function(_0x2ea76c,_0x5371e9,_0x93b45d){return db['VoiceQueue']['find']({'where':{'id':_0x2ea76c[_0x5863('0x4f')]['id']}})[_0x5863('0x33')](handleEntityNotFound(_0x5371e9,null))['then'](function(_0xfba621){if(_0xfba621){return _0xfba621[_0x5863('0xb9')](_0x2ea76c[_0x5863('0x3c')]['ids']);}})['then'](function(_0x4aaa81){if(_0x4aaa81){return db[_0x5863('0x6a')][_0x5863('0x32')]({'where':{'ListId':_0x2ea76c[_0x5863('0x3c')]['ids'],'VoiceQueueId':_0x2ea76c[_0x5863('0x4f')]['id']}})['then'](function(){return _0x4aaa81;});}})[_0x5863('0x33')](respondWithStatusCode(_0x5371e9,null))[_0x5863('0x4d')](handleError(_0x5371e9,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 23a1842..4c2582e 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 _0x03ae=['../../mysqldb','VoiceQueue','setMaxListeners','remove','emit','hasOwnProperty','exports'];(function(_0x4a8721,_0x143f8c){var _0x4ba00f=function(_0x2655d9){while(--_0x2655d9){_0x4a8721['push'](_0x4a8721['shift']());}};_0x4ba00f(++_0x143f8c);}(_0x03ae,0xe0));var _0xe03a=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x03ae[_0x138adb];return _0x1b27f2;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0xe03a('0x0'))['db'][_0xe03a('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xe03a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xe03a('0x3')};function emitEvent(_0x1bcb0f){return function(_0x5ecdd1,_0x40aa44,_0x484ffd){VoiceQueueEvents[_0xe03a('0x4')](_0x1bcb0f+':'+_0x5ecdd1['id'],_0x5ecdd1);VoiceQueueEvents[_0xe03a('0x4')](_0x1bcb0f,_0x5ecdd1);_0x484ffd(null);};}for(var e in events){if(events[_0xe03a('0x5')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xe03a('0x6')]=VoiceQueueEvents; \ No newline at end of file +var _0x905b=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save','update'];(function(_0x1c289a,_0x277fe7){var _0x28d68e=function(_0x2f8e98){while(--_0x2f8e98){_0x1c289a['push'](_0x1c289a['shift']());}};_0x28d68e(++_0x277fe7);}(_0x905b,0x12e));var _0xb905=function(_0x52c583,_0x595d8b){_0x52c583=_0x52c583-0x0;var _0x53d77=_0x905b[_0x52c583];return _0x53d77;};'use strict';var EventEmitter=require(_0xb905('0x0'));var VoiceQueue=require(_0xb905('0x1'))['db'][_0xb905('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xb905('0x3')](0x0);var events={'afterCreate':_0xb905('0x4'),'afterUpdate':_0xb905('0x5'),'afterDestroy':_0xb905('0x6')};function emitEvent(_0x38d6bb){return function(_0x9931b9,_0x2ae861,_0x27161e){VoiceQueueEvents[_0xb905('0x7')](_0x38d6bb+':'+_0x9931b9['id'],_0x9931b9);VoiceQueueEvents[_0xb905('0x7')](_0x38d6bb,_0x9931b9);_0x27161e(null);};}for(var e in events){if(events[_0xb905('0x8')](e)){var event=events[e];VoiceQueue[_0xb905('0x9')](e,emitEvent(event));}}module[_0xb905('0xa')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 9b7a08a..8aadd6f 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 _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x373e58,_0x5d8b0e){var _0x34df2=function(_0x555b4b){while(--_0x555b4b){_0x373e58['push'](_0x373e58['shift']());}};_0x34df2(++_0x5d8b0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x9c79b3,_0x5c5ac0){var _0x2b897a=function(_0x13cdc8){while(--_0x13cdc8){_0x9c79b3['push'](_0x9c79b3['shift']());}};_0x2b897a(++_0x5c5ac0);}(_0x70e0,0x17b));var _0x070e=function(_0x262dfd,_0x52d8e9){_0x262dfd=_0x262dfd-0x0;var _0x42c715=_0x70e0[_0x262dfd];return _0x42c715;};'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 diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index bd47d58..c45f94d 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 _0xc04c=['catch','ShowVoiceQueue','find','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x246f0c,_0x39f734){var _0x30fe50=function(_0x9a975c){while(--_0x9a975c){_0x246f0c['push'](_0x246f0c['shift']());}};_0x30fe50(++_0x39f734);}(_0xc04c,0x1d8));var _0xcc04=function(_0x5c94c2,_0x348ace){_0x5c94c2=_0x5c94c2-0x0;var _0x5f38f1=_0xc04c[_0x5c94c2];return _0x5f38f1;};'use strict';var _=require(_0xcc04('0x0'));var util=require(_0xcc04('0x1'));var moment=require(_0xcc04('0x2'));var BPromise=require(_0xcc04('0x3'));var rs=require(_0xcc04('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc04('0x5'))['db'];var utils=require(_0xcc04('0x6'));var logger=require('../../config/logger')(_0xcc04('0x7'));var config=require(_0xcc04('0x8'));var jayson=require(_0xcc04('0x9'));var client=jayson['client'][_0xcc04('0xa')]({'port':0x232a});config[_0xcc04('0xb')]=_['defaults'](config['redis'],{'host':_0xcc04('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcc04('0xb')]));require(_0xcc04('0xd'))[_0xcc04('0xe')](socket);function respondWithRpcPromise(_0x5c82e3,_0x55e4b8,_0x37c99c){return new BPromise(function(_0x2df9ca,_0x122ca4){return client[_0xcc04('0xf')](_0x5c82e3,_0x37c99c)[_0xcc04('0x10')](function(_0x284ab3){logger[_0xcc04('0x11')](_0xcc04('0x12'),_0x55e4b8,_0xcc04('0x13'));logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x55e4b8,_0xcc04('0x13'),JSON['stringify'](_0x284ab3));if(_0x284ab3[_0xcc04('0x14')]){if(_0x284ab3['error'][_0xcc04('0x15')]===0x1f4){logger['error'](_0xcc04('0x12'),_0x55e4b8,_0x284ab3[_0xcc04('0x14')][_0xcc04('0x16')]);return _0x122ca4(_0x284ab3[_0xcc04('0x14')][_0xcc04('0x16')]);}logger['error'](_0xcc04('0x12'),_0x55e4b8,_0x284ab3[_0xcc04('0x14')][_0xcc04('0x16')]);return _0x2df9ca(_0x284ab3[_0xcc04('0x14')][_0xcc04('0x16')]);}else{logger['info']('VoiceQueue,\x20%s,\x20%s',_0x55e4b8,_0xcc04('0x13'));_0x2df9ca(_0x284ab3[_0xcc04('0x17')][_0xcc04('0x16')]);}})['catch'](function(_0x1a1d49){logger['error'](_0xcc04('0x12'),_0x55e4b8,_0x1a1d49);_0x122ca4(_0x1a1d49);});});}exports[_0xcc04('0x18')]=function(_0x49802e){var _0x4f267a=this;return new Promise(function(_0x1cd8a7,_0x17356b){return db[_0xcc04('0x19')][_0xcc04('0x1a')]({'raw':_0x49802e[_0xcc04('0x1b')]?_0x49802e[_0xcc04('0x1b')][_0xcc04('0x1c')]===undefined?!![]:![]:!![],'where':_0x49802e['options']?_0x49802e['options'][_0xcc04('0x1d')]||null:null,'attributes':_0x49802e[_0xcc04('0x1b')]?_0x49802e[_0xcc04('0x1b')][_0xcc04('0x1e')]||null:null,'limit':_0x49802e[_0xcc04('0x1b')]?_0x49802e[_0xcc04('0x1b')][_0xcc04('0x1f')]||null:null,'include':_0x49802e[_0xcc04('0x1b')]?_0x49802e['options'][_0xcc04('0x20')]?_[_0xcc04('0x21')](_0x49802e[_0xcc04('0x1b')][_0xcc04('0x20')],function(_0x9da0d1){return{'model':db[_0x9da0d1[_0xcc04('0x22')]],'as':_0x9da0d1['as'],'attributes':_0x9da0d1[_0xcc04('0x1e')],'include':_0x9da0d1[_0xcc04('0x20')]?_['map'](_0x9da0d1[_0xcc04('0x20')],function(_0x4b0297){return{'model':db[_0x4b0297[_0xcc04('0x22')]],'as':_0x4b0297['as'],'attributes':_0x4b0297[_0xcc04('0x1e')],'include':_0x4b0297['include']?_['map'](_0x4b0297[_0xcc04('0x20')],function(_0x5e219b){return{'model':db[_0x5e219b[_0xcc04('0x22')]],'as':_0x5e219b['as'],'attributes':_0x5e219b[_0xcc04('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5cd5dd){logger[_0xcc04('0x11')]('GetVoiceQueue',_0x49802e);logger['debug'](_0xcc04('0x18'),_0x49802e,JSON['stringify'](_0x5cd5dd));_0x1cd8a7(_0x5cd5dd);})[_0xcc04('0x23')](function(_0x2382d6){logger['error'](_0xcc04('0x18'),_0x2382d6[_0xcc04('0x16')],_0x49802e);_0x17356b(_0x4f267a[_0xcc04('0x14')](0x1f4,_0x2382d6[_0xcc04('0x16')]));});});};exports[_0xcc04('0x24')]=function(_0x571b7e){var _0x5aef9a=this;return new Promise(function(_0x3822a3,_0x3e10f9){return db[_0xcc04('0x19')][_0xcc04('0x25')]({'raw':_0x571b7e['options']?_0x571b7e[_0xcc04('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x571b7e[_0xcc04('0x1b')]?_0x571b7e['options'][_0xcc04('0x1d')]||null:null,'attributes':_0x571b7e[_0xcc04('0x1b')]?_0x571b7e[_0xcc04('0x1b')][_0xcc04('0x1e')]||null:null,'include':_0x571b7e[_0xcc04('0x1b')]?_0x571b7e[_0xcc04('0x1b')]['include']?_[_0xcc04('0x21')](_0x571b7e[_0xcc04('0x1b')][_0xcc04('0x20')],function(_0xa5bf91){return{'model':db[_0xa5bf91[_0xcc04('0x22')]],'as':_0xa5bf91['as'],'attributes':_0xa5bf91[_0xcc04('0x1e')],'include':_0xa5bf91[_0xcc04('0x20')]?_['map'](_0xa5bf91[_0xcc04('0x20')],function(_0x25d6be){return{'model':db[_0x25d6be[_0xcc04('0x22')]],'as':_0x25d6be['as'],'attributes':_0x25d6be[_0xcc04('0x1e')],'include':_0x25d6be[_0xcc04('0x20')]?_[_0xcc04('0x21')](_0x25d6be['include'],function(_0xd84427){return{'model':db[_0xd84427[_0xcc04('0x22')]],'as':_0xd84427['as'],'attributes':_0xd84427[_0xcc04('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xcc04('0x10')](function(_0x40fa7b){logger[_0xcc04('0x11')](_0xcc04('0x24'),_0x571b7e);logger['debug']('ShowVoiceQueue',_0x571b7e,JSON[_0xcc04('0x26')](_0x40fa7b));_0x3822a3(_0x40fa7b);})[_0xcc04('0x23')](function(_0x440582){logger[_0xcc04('0x14')](_0xcc04('0x24'),_0x440582[_0xcc04('0x16')],_0x571b7e);_0x3e10f9(_0x5aef9a['error'](0x1f4,_0x440582[_0xcc04('0x16')]));});});}; \ No newline at end of file +var _0x6015=['limit','map','include','model','attributes','GetVoiceQueue','VoiceQueue','find','ShowVoiceQueue','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','then','info','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','raw','options','where'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x6015,0x199));var _0x5601=function(_0x198c8c,_0x840a64){_0x198c8c=_0x198c8c-0x0;var _0x235403=_0x6015[_0x198c8c];return _0x235403;};'use strict';var _=require(_0x5601('0x0'));var util=require(_0x5601('0x1'));var moment=require(_0x5601('0x2'));var BPromise=require('bluebird');var rs=require(_0x5601('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5601('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5601('0x5'))(_0x5601('0x6'));var config=require('../../config/environment');var jayson=require(_0x5601('0x7'));var client=jayson[_0x5601('0x8')][_0x5601('0x9')]({'port':0x232a});config['redis']=_[_0x5601('0xa')](config[_0x5601('0xb')],{'host':_0x5601('0xc'),'port':0x18eb});var socket=require(_0x5601('0xd'))(new Redis(config[_0x5601('0xb')]));require(_0x5601('0xe'))[_0x5601('0xf')](socket);function respondWithRpcPromise(_0x2ccbb6,_0x1f4ce9,_0x6e9536){return new BPromise(function(_0x5adb8e,_0x4b972b){return client['request'](_0x2ccbb6,_0x6e9536)[_0x5601('0x10')](function(_0x1c82d1){logger[_0x5601('0x11')](_0x5601('0x12'),_0x1f4ce9,'request\x20sent');logger[_0x5601('0x13')](_0x5601('0x14'),_0x1f4ce9,_0x5601('0x15'),JSON[_0x5601('0x16')](_0x1c82d1));if(_0x1c82d1[_0x5601('0x17')]){if(_0x1c82d1[_0x5601('0x17')][_0x5601('0x18')]===0x1f4){logger[_0x5601('0x17')](_0x5601('0x12'),_0x1f4ce9,_0x1c82d1[_0x5601('0x17')]['message']);return _0x4b972b(_0x1c82d1[_0x5601('0x17')][_0x5601('0x19')]);}logger[_0x5601('0x17')](_0x5601('0x12'),_0x1f4ce9,_0x1c82d1[_0x5601('0x17')]['message']);return _0x5adb8e(_0x1c82d1[_0x5601('0x17')][_0x5601('0x19')]);}else{logger['info'](_0x5601('0x12'),_0x1f4ce9,'request\x20sent');_0x5adb8e(_0x1c82d1[_0x5601('0x1a')][_0x5601('0x19')]);}})[_0x5601('0x1b')](function(_0x32dff8){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x1f4ce9,_0x32dff8);_0x4b972b(_0x32dff8);});});}exports['GetVoiceQueue']=function(_0x1f4265){var _0x4033f2=this;return new Promise(function(_0x382532,_0x3ff6b0){return db['VoiceQueue']['findAll']({'raw':_0x1f4265['options']?_0x1f4265['options'][_0x5601('0x1c')]===undefined?!![]:![]:!![],'where':_0x1f4265[_0x5601('0x1d')]?_0x1f4265['options'][_0x5601('0x1e')]||null:null,'attributes':_0x1f4265['options']?_0x1f4265[_0x5601('0x1d')]['attributes']||null:null,'limit':_0x1f4265[_0x5601('0x1d')]?_0x1f4265[_0x5601('0x1d')][_0x5601('0x1f')]||null:null,'include':_0x1f4265['options']?_0x1f4265[_0x5601('0x1d')]['include']?_[_0x5601('0x20')](_0x1f4265[_0x5601('0x1d')][_0x5601('0x21')],function(_0x5f04f7){return{'model':db[_0x5f04f7[_0x5601('0x22')]],'as':_0x5f04f7['as'],'attributes':_0x5f04f7[_0x5601('0x23')],'include':_0x5f04f7['include']?_['map'](_0x5f04f7[_0x5601('0x21')],function(_0x71f6e3){return{'model':db[_0x71f6e3[_0x5601('0x22')]],'as':_0x71f6e3['as'],'attributes':_0x71f6e3['attributes'],'include':_0x71f6e3[_0x5601('0x21')]?_[_0x5601('0x20')](_0x71f6e3[_0x5601('0x21')],function(_0x3f7e0f){return{'model':db[_0x3f7e0f[_0x5601('0x22')]],'as':_0x3f7e0f['as'],'attributes':_0x3f7e0f[_0x5601('0x23')]};}):[]};}):[]};}):[]:[]})[_0x5601('0x10')](function(_0x2f3e78){logger[_0x5601('0x11')]('GetVoiceQueue',_0x1f4265);logger[_0x5601('0x13')](_0x5601('0x24'),_0x1f4265,JSON[_0x5601('0x16')](_0x2f3e78));_0x382532(_0x2f3e78);})['catch'](function(_0x322b99){logger[_0x5601('0x17')]('GetVoiceQueue',_0x322b99['message'],_0x1f4265);_0x3ff6b0(_0x4033f2[_0x5601('0x17')](0x1f4,_0x322b99[_0x5601('0x19')]));});});};exports['ShowVoiceQueue']=function(_0x526b93){var _0x535613=this;return new Promise(function(_0x155b4a,_0x3bfd85){return db[_0x5601('0x25')][_0x5601('0x26')]({'raw':_0x526b93['options']?_0x526b93['options']['raw']===undefined?!![]:![]:!![],'where':_0x526b93['options']?_0x526b93[_0x5601('0x1d')][_0x5601('0x1e')]||null:null,'attributes':_0x526b93['options']?_0x526b93[_0x5601('0x1d')]['attributes']||null:null,'include':_0x526b93[_0x5601('0x1d')]?_0x526b93['options'][_0x5601('0x21')]?_[_0x5601('0x20')](_0x526b93[_0x5601('0x1d')][_0x5601('0x21')],function(_0x936124){return{'model':db[_0x936124[_0x5601('0x22')]],'as':_0x936124['as'],'attributes':_0x936124['attributes'],'include':_0x936124['include']?_['map'](_0x936124['include'],function(_0x469516){return{'model':db[_0x469516['model']],'as':_0x469516['as'],'attributes':_0x469516['attributes'],'include':_0x469516[_0x5601('0x21')]?_[_0x5601('0x20')](_0x469516[_0x5601('0x21')],function(_0x42a5b9){return{'model':db[_0x42a5b9[_0x5601('0x22')]],'as':_0x42a5b9['as'],'attributes':_0x42a5b9[_0x5601('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x844af){logger[_0x5601('0x11')](_0x5601('0x27'),_0x526b93);logger[_0x5601('0x13')](_0x5601('0x27'),_0x526b93,JSON[_0x5601('0x16')](_0x844af));_0x155b4a(_0x844af);})['catch'](function(_0x2ec1e1){logger[_0x5601('0x17')](_0x5601('0x27'),_0x2ec1e1[_0x5601('0x19')],_0x526b93);_0x3bfd85(_0x535613[_0x5601('0x17')](0x1f4,_0x2ec1e1[_0x5601('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index ec2fb1c..80339d0 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 _0x05f0=['./voiceQueue.events','save','remove','update','emit','removeListener','register','voiceQueue:'];(function(_0x31a98e,_0x19b04a){var _0x3098e6=function(_0x522356){while(--_0x522356){_0x31a98e['push'](_0x31a98e['shift']());}};_0x3098e6(++_0x19b04a);}(_0x05f0,0x170));var _0x005f=function(_0x430459,_0x58519c){_0x430459=_0x430459-0x0;var _0x3a2439=_0x05f0[_0x430459];return _0x3a2439;};'use strict';var VoiceQueueEvents=require(_0x005f('0x0'));var events=[_0x005f('0x1'),_0x005f('0x2'),_0x005f('0x3')];function createListener(_0x57690b,_0x3c44c6){return function(_0x4572da){_0x3c44c6[_0x005f('0x4')](_0x57690b,_0x4572da);};}function removeListener(_0x3be0f4,_0x250232){return function(){VoiceQueueEvents[_0x005f('0x5')](_0x3be0f4,_0x250232);};}exports[_0x005f('0x6')]=function(_0x12f43a){for(var _0x197ff0=0x0,_0x462caa=events['length'];_0x197ff0<_0x462caa;_0x197ff0++){var _0x1a52c7=events[_0x197ff0];var _0x34271d=createListener(_0x005f('0x7')+_0x1a52c7,_0x12f43a);VoiceQueueEvents['on'](_0x1a52c7,_0x34271d);}}; \ No newline at end of file +var _0x6e9c=['./voiceQueue.events','save','remove','update','emit','removeListener','register','length','voiceQueue:'];(function(_0x29fc45,_0x1d010b){var _0x512a89=function(_0x3722f2){while(--_0x3722f2){_0x29fc45['push'](_0x29fc45['shift']());}};_0x512a89(++_0x1d010b);}(_0x6e9c,0xbd));var _0xc6e9=function(_0x1d63b0,_0x5a1f5e){_0x1d63b0=_0x1d63b0-0x0;var _0x2c5970=_0x6e9c[_0x1d63b0];return _0x2c5970;};'use strict';var VoiceQueueEvents=require(_0xc6e9('0x0'));var events=[_0xc6e9('0x1'),_0xc6e9('0x2'),_0xc6e9('0x3')];function createListener(_0x25d774,_0x32b518){return function(_0x2e8ae3){_0x32b518[_0xc6e9('0x4')](_0x25d774,_0x2e8ae3);};}function removeListener(_0x2fa3df,_0x414797){return function(){VoiceQueueEvents[_0xc6e9('0x5')](_0x2fa3df,_0x414797);};}exports[_0xc6e9('0x6')]=function(_0x5ac46e){for(var _0x4f6866=0x0,_0x488da0=events[_0xc6e9('0x7')];_0x4f6866<_0x488da0;_0x4f6866++){var _0x1d5817=events[_0x4f6866];var _0x35344d=createListener(_0xc6e9('0x8')+_0x1d5817,_0x5ac46e);VoiceQueueEvents['on'](_0x1d5817,_0x35344d);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 5710cbc..c621a67 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 _0x8984=['destroy','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/index','/:id','show','post','update'];(function(_0x382d8e,_0x2a5761){var _0x23993d=function(_0x1f491c){while(--_0x1f491c){_0x382d8e['push'](_0x382d8e['shift']());}};_0x23993d(++_0x2a5761);}(_0x8984,0xbc));var _0x4898=function(_0x25ec29,_0x3929e2){_0x25ec29=_0x25ec29-0x0;var _0x3eced7=_0x8984[_0x25ec29];return _0x3eced7;};'use strict';var multer=require(_0x4898('0x0'));var util=require(_0x4898('0x1'));var path=require(_0x4898('0x2'));var timeout=require(_0x4898('0x3'));var express=require('express');var router=express[_0x4898('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4898('0x5'));var config=require(_0x4898('0x6'));var controller=require('./voiceQueueReport.controller');router[_0x4898('0x7')]('/',auth[_0x4898('0x8')](),controller[_0x4898('0x9')]);router[_0x4898('0x7')]('/describe',auth[_0x4898('0x8')](),controller[_0x4898('0xa')]);router[_0x4898('0x7')](_0x4898('0xb'),auth['isAuthenticated'](),controller['getVoiceQueuesReport']);router[_0x4898('0x7')](_0x4898('0xc'),auth[_0x4898('0x8')](),controller[_0x4898('0xd')]);router[_0x4898('0xe')]('/',auth[_0x4898('0x8')](),controller['create']);router['put'](_0x4898('0xc'),auth[_0x4898('0x8')](),controller[_0x4898('0xf')]);router['delete'](_0x4898('0xc'),auth[_0x4898('0x8')](),controller[_0x4898('0x10')]);module['exports']=router; \ No newline at end of file +var _0xb72c=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0xd8245f,_0x53dc57){var _0x153f9d=function(_0x3ce2f5){while(--_0x3ce2f5){_0xd8245f['push'](_0xd8245f['shift']());}};_0x153f9d(++_0x53dc57);}(_0xb72c,0x1e0));var _0xcb72=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb72c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xcb72('0x0'));var util=require(_0xcb72('0x1'));var path=require('path');var timeout=require(_0xcb72('0x2'));var express=require(_0xcb72('0x3'));var router=express[_0xcb72('0x4')]();var fs_extra=require(_0xcb72('0x5'));var auth=require(_0xcb72('0x6'));var interaction=require(_0xcb72('0x7'));var config=require(_0xcb72('0x8'));var controller=require(_0xcb72('0x9'));router[_0xcb72('0xa')]('/',auth[_0xcb72('0xb')](),controller[_0xcb72('0xc')]);router['get'](_0xcb72('0xd'),auth['isAuthenticated'](),controller[_0xcb72('0xe')]);router['get']('/index',auth[_0xcb72('0xb')](),controller['getVoiceQueuesReport']);router['get']('/:id',auth[_0xcb72('0xb')](),controller['show']);router[_0xcb72('0xf')]('/',auth[_0xcb72('0xb')](),controller[_0xcb72('0x10')]);router[_0xcb72('0x11')](_0xcb72('0x12'),auth[_0xcb72('0xb')](),controller[_0xcb72('0x13')]);router[_0xcb72('0x14')]('/:id',auth[_0xcb72('0xb')](),controller[_0xcb72('0x15')]);module[_0xcb72('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 8618ace..02ce3b0 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 _0xa6c2=['queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','DATE','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue'];(function(_0x57cb4f,_0x541f57){var _0x29bb45=function(_0x462bee){while(--_0x462bee){_0x57cb4f['push'](_0x57cb4f['shift']());}};_0x29bb45(++_0x541f57);}(_0xa6c2,0x1b7));var _0x2a6c=function(_0x290ef5,_0x32cfa7){_0x290ef5=_0x290ef5-0x0;var _0x450d92=_0xa6c2[_0x290ef5];return _0x450d92;};'use strict';var Sequelize=require(_0x2a6c('0x0'));var moment=require(_0x2a6c('0x1'));module[_0x2a6c('0x2')]={'type':{'type':Sequelize[_0x2a6c('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2a6c('0x3')]},'queue':{'type':Sequelize[_0x2a6c('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x1f6fc9){var _0xaf0d96=moment(_0x1f6fc9);var _0xa17969=moment(this[_0x2a6c('0x4')](_0x2a6c('0x5')))['format'](_0x2a6c('0x6'));var _0x181674=_0xaf0d96['diff'](_0xa17969,_0x2a6c('0x7'));this[_0x2a6c('0x8')](_0x2a6c('0x9'),_0x1f6fc9);this[_0x2a6c('0x8')](_0x2a6c('0xa'),_0x181674||null);}},'position':{'type':Sequelize[_0x2a6c('0xb')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x2a6c('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x2a6c('0xd')]},'queuecallercomplete':{'type':Sequelize[_0x2a6c('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x2a6c('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x2a6c('0xd')]},'queuecallerexitreason':{'type':Sequelize[_0x2a6c('0x3')],'comment':_0x2a6c('0xe')},'originalposition':{'type':Sequelize[_0x2a6c('0xb')]},'channel':{'type':Sequelize[_0x2a6c('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x2a6c('0x3')]},'accountcode':{'type':Sequelize[_0x2a6c('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x2a6c('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x2a6c('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x2a6c('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x2a6c('0x3')],'comment':_0x2a6c('0xf')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x2a6c('0x3')]},'disposition':{'type':Sequelize[_0x2a6c('0x3')]},'secondDisposition':{'type':Sequelize[_0x2a6c('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x2a6c('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8ce5=['COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN'];(function(_0x1189e1,_0x52e91e){var _0x5f0bdf=function(_0x487c3c){while(--_0x487c3c){_0x1189e1['push'](_0x1189e1['shift']());}};_0x5f0bdf(++_0x52e91e);}(_0x8ce5,0x172));var _0x58ce=function(_0x484458,_0x2a0995){_0x484458=_0x484458-0x0;var _0x3333ce=_0x8ce5[_0x484458];return _0x3333ce;};'use strict';var Sequelize=require(_0x58ce('0x0'));var moment=require(_0x58ce('0x1'));module[_0x58ce('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x58ce('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x58ce('0x3')]},'queue':{'type':Sequelize[_0x58ce('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x58ce('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x58ce('0x4')],'set':function(_0x464d05){var _0x399b21=moment(_0x464d05);var _0x5a96ea=moment(this[_0x58ce('0x5')](_0x58ce('0x6')))[_0x58ce('0x7')]('YYYY-MM-DD\x20HH:mm:ss');var _0x160827=_0x399b21['diff'](_0x5a96ea,_0x58ce('0x8'));this[_0x58ce('0x9')](_0x58ce('0xa'),_0x464d05);this[_0x58ce('0x9')](_0x58ce('0xb'),_0x160827||null);}},'position':{'type':Sequelize[_0x58ce('0xc')]},'count':{'type':Sequelize[_0x58ce('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x58ce('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x58ce('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x58ce('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x58ce('0x4')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x58ce('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x58ce('0x3')],'comment':_0x58ce('0xe')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x58ce('0x3')]},'connectedlinename':{'type':Sequelize[_0x58ce('0x3')]},'accountcode':{'type':Sequelize[_0x58ce('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x58ce('0x3')]},'priority':{'type':Sequelize[_0x58ce('0x3')]},'holdtime':{'type':Sequelize[_0x58ce('0xc')]},'mohtime':{'type':Sequelize[_0x58ce('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x58ce('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x58ce('0x3')]},'transfer':{'type':Sequelize[_0x58ce('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x58ce('0x3')],'comment':_0x58ce('0xf')},'transferexten':{'type':Sequelize[_0x58ce('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x58ce('0x3')]},'secondDisposition':{'type':Sequelize[_0x58ce('0x3')]},'thirdDisposition':{'type':Sequelize[_0x58ce('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x58ce('0xc')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 4181635..aa820c0 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 _0x4890=['filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','getVoiceQueuesReport','rawAttributes','order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','stack','name','index','map','VoiceQueueReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x11e103,_0x5a50e4){var _0x15e882=function(_0x37aa61){while(--_0x37aa61){_0x11e103['push'](_0x11e103['shift']());}};_0x15e882(++_0x5a50e4);}(_0x4890,0x1ec));var _0x0489=function(_0x49ad79,_0x48ee93){_0x49ad79=_0x49ad79-0x0;var _0xa4e38a=_0x4890[_0x49ad79];return _0xa4e38a;};'use strict';var emlformat=require(_0x0489('0x0'));var rimraf=require(_0x0489('0x1'));var zipdir=require(_0x0489('0x2'));var jsonpatch=require(_0x0489('0x3'));var rp=require(_0x0489('0x4'));var moment=require('moment');var BPromise=require(_0x0489('0x5'));var Mustache=require(_0x0489('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0489('0x7'));var fs=require('fs');var fs_extra=require(_0x0489('0x8'));var _=require(_0x0489('0x9'));var squel=require('squel');var crypto=require(_0x0489('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x0489('0xb'));var toCsv=require('to-csv');var querystring=require(_0x0489('0xc'));var Papa=require(_0x0489('0xd'));var Redis=require(_0x0489('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0489('0xf'));var as=require(_0x0489('0x10'));var hardwareService=require(_0x0489('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x0489('0x12'));var config=require(_0x0489('0x13'));var licenseUtil=require(_0x0489('0x14'));var db=require('../../mysqldb')['db'];config[_0x0489('0x15')]=_[_0x0489('0x16')](config[_0x0489('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x0489('0x17'))(new Redis(config[_0x0489('0x15')]));require(_0x0489('0x18'))[_0x0489('0x19')](socket);function respondWithStatusCode(_0x5dd08d,_0x2ae1df){_0x2ae1df=_0x2ae1df||0xcc;return function(_0x1d55dd){if(_0x1d55dd){return _0x5dd08d['sendStatus'](_0x2ae1df);}return _0x5dd08d[_0x0489('0x1a')](_0x2ae1df)[_0x0489('0x1b')]();};}function respondWithResult(_0x19bbfb,_0x19c684){_0x19c684=_0x19c684||0xc8;return function(_0x3707ad){if(_0x3707ad){return _0x19bbfb[_0x0489('0x1a')](_0x19c684)[_0x0489('0x1c')](_0x3707ad);}};}function respondWithFilteredResult(_0x4c3ccb,_0xdbac7d){return function(_0x50c2db){if(_0x50c2db){var _0x39888a=typeof _0xdbac7d[_0x0489('0x1d')]===_0x0489('0x1e')&&typeof _0xdbac7d[_0x0489('0x1f')]===_0x0489('0x1e');var _0x929f6=_0x50c2db['count'];var _0x1dafbc=_0x39888a?0x0:_0xdbac7d[_0x0489('0x1d')];var _0x22cb98=_0x39888a?_0x50c2db[_0x0489('0x20')]:_0xdbac7d[_0x0489('0x1d')]+_0xdbac7d['limit'];var _0x3d191c;if(_0x22cb98>=_0x929f6){_0x22cb98=_0x929f6;_0x3d191c=0xc8;}else{_0x3d191c=0xce;}_0x4c3ccb[_0x0489('0x1a')](_0x3d191c);return _0x4c3ccb[_0x0489('0x21')](_0x0489('0x22'),_0x1dafbc+'-'+_0x22cb98+'/'+_0x929f6)[_0x0489('0x1c')](_0x50c2db);}return null;};}function patchUpdates(_0x3ed528){return function(_0x49c7ca){try{jsonpatch['apply'](_0x49c7ca,_0x3ed528,!![]);}catch(_0x2762aa){return BPromise[_0x0489('0x23')](_0x2762aa);}return _0x49c7ca[_0x0489('0x24')]();};}function saveUpdates(_0x25485a,_0x31a16a){return function(_0x261de7){if(_0x261de7){return _0x261de7[_0x0489('0x25')](_0x25485a)['then'](function(_0x45598d){return _0x45598d;});}return null;};}function removeEntity(_0x339f08,_0x57d7bf){return function(_0x3a4985){if(_0x3a4985){return _0x3a4985[_0x0489('0x26')]()[_0x0489('0x27')](function(){_0x339f08[_0x0489('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1705b1,_0x2503b7){return function(_0x3cb0c2){if(!_0x3cb0c2){_0x1705b1['sendStatus'](0x194);}return _0x3cb0c2;};}function handleError(_0x49fb88,_0x4e1966){_0x4e1966=_0x4e1966||0x1f4;return function(_0x4909e0){logger['error'](_0x4909e0[_0x0489('0x28')]);if(_0x4909e0[_0x0489('0x29')]){delete _0x4909e0[_0x0489('0x29')];}_0x49fb88[_0x0489('0x1a')](_0x4e1966)['send'](_0x4909e0);};}exports[_0x0489('0x2a')]=function(_0x1049e3,_0x14e9a5){var _0x49cba5={},_0x40fe41={},_0x1fa45b={'count':0x0,'rows':[]};var _0x12585c=_[_0x0489('0x2b')](db[_0x0489('0x2c')]['rawAttributes'],function(_0xd184e6){return{'name':_0xd184e6[_0x0489('0x2d')],'type':_0xd184e6[_0x0489('0x2e')][_0x0489('0x2f')]};});_0x40fe41[_0x0489('0x30')]=_[_0x0489('0x2b')](_0x12585c,_0x0489('0x29'));_0x40fe41[_0x0489('0x31')]=_[_0x0489('0x32')](_0x1049e3[_0x0489('0x31')]);_0x40fe41['filters']=_[_0x0489('0x33')](_0x40fe41['model'],_0x40fe41['query']);_0x49cba5[_0x0489('0x34')]=_['intersection'](_0x40fe41['model'],qs[_0x0489('0x35')](_0x1049e3[_0x0489('0x31')][_0x0489('0x35')]));_0x49cba5[_0x0489('0x34')]=_0x49cba5[_0x0489('0x34')][_0x0489('0x36')]?_0x49cba5[_0x0489('0x34')]:_0x40fe41[_0x0489('0x30')];if(!_0x1049e3['query'][_0x0489('0x37')](_0x0489('0x38'))){_0x49cba5[_0x0489('0x1f')]=qs[_0x0489('0x1f')](_0x1049e3[_0x0489('0x31')][_0x0489('0x1f')]);_0x49cba5[_0x0489('0x1d')]=qs[_0x0489('0x1d')](_0x1049e3[_0x0489('0x31')][_0x0489('0x1d')]);}_0x49cba5['order']=qs['sort'](_0x1049e3[_0x0489('0x31')][_0x0489('0x39')]);_0x49cba5[_0x0489('0x3a')]=qs['filters'](_[_0x0489('0x3b')](_0x1049e3['query'],_0x40fe41[_0x0489('0x3c')]),_0x12585c);if(_0x1049e3['query'][_0x0489('0x3d')]){_0x49cba5[_0x0489('0x3a')]=_[_0x0489('0x3e')](_0x49cba5[_0x0489('0x3a')],{'$or':_[_0x0489('0x2b')](_0x12585c,function(_0x488347){if(_0x488347[_0x0489('0x2e')]!==_0x0489('0x3f')){var _0x53d0f2={};_0x53d0f2[_0x488347['name']]={'$like':'%'+_0x1049e3[_0x0489('0x31')][_0x0489('0x3d')]+'%'};return _0x53d0f2;}})});}_0x49cba5=_[_0x0489('0x3e')]({},_0x49cba5,_0x1049e3[_0x0489('0x40')]);var _0x363993={'where':_0x49cba5['where']};return db[_0x0489('0x2c')][_0x0489('0x20')](_0x363993)['then'](function(_0x12f243){_0x1fa45b[_0x0489('0x20')]=_0x12f243;if(_0x1049e3[_0x0489('0x31')][_0x0489('0x41')]){_0x49cba5['include']=[{'all':!![]}];}return db[_0x0489('0x2c')][_0x0489('0x42')](_0x49cba5);})[_0x0489('0x27')](function(_0x1a4b01){_0x1fa45b[_0x0489('0x43')]=_0x1a4b01;return _0x1fa45b;})[_0x0489('0x27')](respondWithFilteredResult(_0x14e9a5,_0x49cba5))[_0x0489('0x44')](handleError(_0x14e9a5,null));};exports[_0x0489('0x45')]=function(_0x192ec8,_0x4fd151){var _0x53b9d3={'raw':![],'where':{'id':_0x192ec8[_0x0489('0x46')]['id']}},_0x5192a6={};_0x5192a6[_0x0489('0x30')]=_[_0x0489('0x32')](db[_0x0489('0x2c')]['rawAttributes']);_0x5192a6[_0x0489('0x31')]=_[_0x0489('0x32')](_0x192ec8[_0x0489('0x31')]);_0x5192a6['filters']=_['intersection'](_0x5192a6['model'],_0x5192a6['query']);_0x53b9d3['attributes']=_[_0x0489('0x33')](_0x5192a6[_0x0489('0x30')],qs[_0x0489('0x35')](_0x192ec8[_0x0489('0x31')][_0x0489('0x35')]));_0x53b9d3['attributes']=_0x53b9d3[_0x0489('0x34')]['length']?_0x53b9d3[_0x0489('0x34')]:_0x5192a6[_0x0489('0x30')];if(_0x192ec8['query'][_0x0489('0x41')]){_0x53b9d3[_0x0489('0x47')]=[{'all':!![]}];}_0x53b9d3=_[_0x0489('0x3e')]({},_0x53b9d3,_0x192ec8[_0x0489('0x40')]);return db[_0x0489('0x2c')][_0x0489('0x48')](_0x53b9d3)[_0x0489('0x27')](handleEntityNotFound(_0x4fd151,null))[_0x0489('0x27')](respondWithResult(_0x4fd151,null))[_0x0489('0x44')](handleError(_0x4fd151,null));};exports[_0x0489('0x49')]=function(_0x10a3e3,_0x279be4){return db[_0x0489('0x2c')][_0x0489('0x49')](_0x10a3e3[_0x0489('0x4a')],{})['then'](respondWithResult(_0x279be4,0xc9))[_0x0489('0x44')](handleError(_0x279be4,null));};exports[_0x0489('0x25')]=function(_0x44d7c4,_0x547d98){if(_0x44d7c4[_0x0489('0x4a')]['id']){delete _0x44d7c4[_0x0489('0x4a')]['id'];}return db['VoiceQueueReport'][_0x0489('0x48')]({'where':{'id':_0x44d7c4['params']['id']}})['then'](handleEntityNotFound(_0x547d98,null))[_0x0489('0x27')](saveUpdates(_0x44d7c4['body'],null))['then'](respondWithResult(_0x547d98,null))['catch'](handleError(_0x547d98,null));};exports[_0x0489('0x26')]=function(_0x38585b,_0x2db0df){return db[_0x0489('0x2c')][_0x0489('0x48')]({'where':{'id':_0x38585b[_0x0489('0x46')]['id']}})['then'](handleEntityNotFound(_0x2db0df,null))[_0x0489('0x27')](removeEntity(_0x2db0df,null))[_0x0489('0x44')](handleError(_0x2db0df,null));};exports['describe']=function(_0xbee661,_0x2193bf){return db['VoiceQueueReport'][_0x0489('0x4b')]()[_0x0489('0x27')](respondWithResult(_0x2193bf,null))[_0x0489('0x44')](handleError(_0x2193bf,null));};exports[_0x0489('0x4c')]=function(_0x250e49,_0x318179){var _0x4343c6={},_0xe1074f={},_0x4b6097={'count':0x0,'rows':[]};_0xe1074f[_0x0489('0x30')]=_[_0x0489('0x32')](db[_0x0489('0x2c')][_0x0489('0x4d')]);_0xe1074f['query']=_[_0x0489('0x32')](_0x250e49['query']);_0xe1074f['filters']=_[_0x0489('0x33')](_0xe1074f['model'],_0xe1074f[_0x0489('0x31')]);_0x4343c6[_0x0489('0x34')]=_[_0x0489('0x33')](_0xe1074f['model'],qs['fields'](_0x250e49[_0x0489('0x31')]['fields']));_0x4343c6[_0x0489('0x34')]=_0x4343c6[_0x0489('0x34')][_0x0489('0x36')]?_0x4343c6[_0x0489('0x34')]:_0xe1074f[_0x0489('0x30')];if(!_0x250e49['query']['hasOwnProperty'](_0x0489('0x38'))){_0x4343c6[_0x0489('0x1f')]=qs[_0x0489('0x1f')](_0x250e49[_0x0489('0x31')][_0x0489('0x1f')]);_0x4343c6[_0x0489('0x1d')]=qs[_0x0489('0x1d')](_0x250e49[_0x0489('0x31')][_0x0489('0x1d')]);}_0x4343c6[_0x0489('0x4e')]=qs[_0x0489('0x39')](_0x250e49[_0x0489('0x31')][_0x0489('0x39')]);_0x4343c6['where']=qs[_0x0489('0x3c')](_[_0x0489('0x3b')](_0x250e49[_0x0489('0x31')],_0xe1074f[_0x0489('0x3c')]));if(_0x250e49[_0x0489('0x31')][_0x0489('0x3d')]){_0x4343c6[_0x0489('0x3a')]=_[_0x0489('0x3e')](_0x4343c6[_0x0489('0x3a')],{'$or':_[_0x0489('0x2b')](_0x4343c6[_0x0489('0x34')],function(_0x5b851b){var _0x2baa23={};_0x2baa23[_0x5b851b]={'$like':'%'+_0x250e49['query'][_0x0489('0x3d')]+'%'};return _0x2baa23;})});}_0x4343c6=_[_0x0489('0x3e')]({},_0x4343c6,_0x250e49[_0x0489('0x40')]);var _0x219b78={'where':_0x4343c6[_0x0489('0x3a')]};return db['VoiceQueueReport']['count'](_0x219b78)['then'](function(_0x3332dc){_0x4b6097['count']=_0x3332dc;if(_0x250e49[_0x0489('0x31')]['includeAll']){_0x4343c6[_0x0489('0x47')]=[{'all':!![]}];}return db[_0x0489('0x2c')][_0x0489('0x42')](_0x4343c6);})['then'](function(_0x471aa8){_0x4b6097[_0x0489('0x43')]=_0x471aa8;return _0x4b6097;})['then'](respondWithFilteredResult(_0x318179,_0x4343c6,_0x0489('0x4c')))[_0x0489('0x44')](handleError(_0x318179,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0xa82b=['../../config/license/util','redis','defaults','localhost','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','VoiceQueueReport','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','show','params','length','includeAll','find','create','body','catch','describe','getVoiceQueuesReport','eml-format','rimraf','request-promise','bluebird','mustache','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'];(function(_0x3007be,_0x40ae2d){var _0xef118e=function(_0x3475a6){while(--_0x3475a6){_0x3007be['push'](_0x3007be['shift']());}};_0xef118e(++_0x40ae2d);}(_0xa82b,0xe1));var _0xba82=function(_0x261038,_0x2fab28){_0x261038=_0x261038-0x0;var _0x2fd230=_0xa82b[_0x261038];return _0x2fd230;};'use strict';var emlformat=require(_0xba82('0x0'));var rimraf=require(_0xba82('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xba82('0x2'));var moment=require('moment');var BPromise=require(_0xba82('0x3'));var Mustache=require(_0xba82('0x4'));var util=require('util');var path=require(_0xba82('0x5'));var sox=require(_0xba82('0x6'));var csv=require(_0xba82('0x7'));var ejs=require(_0xba82('0x8'));var fs=require('fs');var fs_extra=require(_0xba82('0x9'));var _=require(_0xba82('0xa'));var squel=require(_0xba82('0xb'));var crypto=require(_0xba82('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xba82('0x7'));var querystring=require(_0xba82('0xd'));var Papa=require(_0xba82('0xe'));var Redis=require(_0xba82('0xf'));var authService=require(_0xba82('0x10'));var qs=require(_0xba82('0x11'));var as=require(_0xba82('0x12'));var hardwareService=require(_0xba82('0x13'));var logger=require(_0xba82('0x14'))(_0xba82('0x15'));var utils=require(_0xba82('0x16'));var config=require(_0xba82('0x17'));var licenseUtil=require(_0xba82('0x18'));var db=require('../../mysqldb')['db'];config[_0xba82('0x19')]=_[_0xba82('0x1a')](config[_0xba82('0x19')],{'host':_0xba82('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xba82('0x19')]));require(_0xba82('0x1c'))[_0xba82('0x1d')](socket);function respondWithStatusCode(_0x300ff3,_0x394a5e){_0x394a5e=_0x394a5e||0xcc;return function(_0x40fb8e){if(_0x40fb8e){return _0x300ff3[_0xba82('0x1e')](_0x394a5e);}return _0x300ff3[_0xba82('0x1f')](_0x394a5e)[_0xba82('0x20')]();};}function respondWithResult(_0x3f6869,_0x1c9bc0){_0x1c9bc0=_0x1c9bc0||0xc8;return function(_0x4f9359){if(_0x4f9359){return _0x3f6869[_0xba82('0x1f')](_0x1c9bc0)[_0xba82('0x21')](_0x4f9359);}};}function respondWithFilteredResult(_0x1f19c2,_0x4b8546){return function(_0x192d52){if(_0x192d52){var _0x42a632=typeof _0x4b8546[_0xba82('0x22')]===_0xba82('0x23')&&typeof _0x4b8546[_0xba82('0x24')]===_0xba82('0x23');var _0x726897=_0x192d52[_0xba82('0x25')];var _0x5663a1=_0x42a632?0x0:_0x4b8546[_0xba82('0x22')];var _0x26d012=_0x42a632?_0x192d52[_0xba82('0x25')]:_0x4b8546[_0xba82('0x22')]+_0x4b8546[_0xba82('0x24')];var _0xa9ea71;if(_0x26d012>=_0x726897){_0x26d012=_0x726897;_0xa9ea71=0xc8;}else{_0xa9ea71=0xce;}_0x1f19c2[_0xba82('0x1f')](_0xa9ea71);return _0x1f19c2[_0xba82('0x26')](_0xba82('0x27'),_0x5663a1+'-'+_0x26d012+'/'+_0x726897)[_0xba82('0x21')](_0x192d52);}return null;};}function patchUpdates(_0x5b3ae1){return function(_0x18a68e){try{jsonpatch[_0xba82('0x28')](_0x18a68e,_0x5b3ae1,!![]);}catch(_0x2ecdd8){return BPromise[_0xba82('0x29')](_0x2ecdd8);}return _0x18a68e['save']();};}function saveUpdates(_0xa664,_0x2dbca3){return function(_0x1fd347){if(_0x1fd347){return _0x1fd347[_0xba82('0x2a')](_0xa664)[_0xba82('0x2b')](function(_0x4dce50){return _0x4dce50;});}return null;};}function removeEntity(_0x5ce240,_0x10e232){return function(_0x40bca8){if(_0x40bca8){return _0x40bca8[_0xba82('0x2c')]()['then'](function(){_0x5ce240['status'](0xcc)[_0xba82('0x20')]();});}};}function handleEntityNotFound(_0x4d0ed1,_0x4b6527){return function(_0x397685){if(!_0x397685){_0x4d0ed1[_0xba82('0x1e')](0x194);}return _0x397685;};}function handleError(_0x3272f2,_0x49829c){_0x49829c=_0x49829c||0x1f4;return function(_0x2140a8){logger[_0xba82('0x2d')](_0x2140a8['stack']);if(_0x2140a8['name']){delete _0x2140a8[_0xba82('0x2e')];}_0x3272f2[_0xba82('0x1f')](_0x49829c)[_0xba82('0x2f')](_0x2140a8);};}exports[_0xba82('0x30')]=function(_0x43d61d,_0x31c67e){var _0x380882={},_0x151690={},_0x33464d={'count':0x0,'rows':[]};var _0x2d39bc=_['map'](db[_0xba82('0x31')][_0xba82('0x32')],function(_0x383967){return{'name':_0x383967[_0xba82('0x33')],'type':_0x383967[_0xba82('0x34')]['key']};});_0x151690[_0xba82('0x35')]=_['map'](_0x2d39bc,'name');_0x151690['query']=_[_0xba82('0x36')](_0x43d61d[_0xba82('0x37')]);_0x151690[_0xba82('0x38')]=_[_0xba82('0x39')](_0x151690[_0xba82('0x35')],_0x151690[_0xba82('0x37')]);_0x380882[_0xba82('0x3a')]=_[_0xba82('0x39')](_0x151690['model'],qs[_0xba82('0x3b')](_0x43d61d['query'][_0xba82('0x3b')]));_0x380882[_0xba82('0x3a')]=_0x380882[_0xba82('0x3a')]['length']?_0x380882[_0xba82('0x3a')]:_0x151690[_0xba82('0x35')];if(!_0x43d61d[_0xba82('0x37')][_0xba82('0x3c')]('nolimit')){_0x380882[_0xba82('0x24')]=qs[_0xba82('0x24')](_0x43d61d[_0xba82('0x37')][_0xba82('0x24')]);_0x380882[_0xba82('0x22')]=qs['offset'](_0x43d61d[_0xba82('0x37')][_0xba82('0x22')]);}_0x380882[_0xba82('0x3d')]=qs[_0xba82('0x3e')](_0x43d61d[_0xba82('0x37')][_0xba82('0x3e')]);_0x380882[_0xba82('0x3f')]=qs['filters'](_[_0xba82('0x40')](_0x43d61d[_0xba82('0x37')],_0x151690[_0xba82('0x38')]),_0x2d39bc);if(_0x43d61d[_0xba82('0x37')][_0xba82('0x41')]){_0x380882[_0xba82('0x3f')]=_[_0xba82('0x42')](_0x380882[_0xba82('0x3f')],{'$or':_[_0xba82('0x43')](_0x2d39bc,function(_0x319b25){if(_0x319b25[_0xba82('0x34')]!==_0xba82('0x44')){var _0x3f8778={};_0x3f8778[_0x319b25[_0xba82('0x2e')]]={'$like':'%'+_0x43d61d[_0xba82('0x37')][_0xba82('0x41')]+'%'};return _0x3f8778;}})});}_0x380882=_['merge']({},_0x380882,_0x43d61d[_0xba82('0x45')]);var _0x29d90d={'where':_0x380882[_0xba82('0x3f')]};return db[_0xba82('0x31')][_0xba82('0x25')](_0x29d90d)[_0xba82('0x2b')](function(_0x4d0b34){_0x33464d[_0xba82('0x25')]=_0x4d0b34;if(_0x43d61d['query']['includeAll']){_0x380882[_0xba82('0x46')]=[{'all':!![]}];}return db[_0xba82('0x31')][_0xba82('0x47')](_0x380882);})['then'](function(_0x3a1718){_0x33464d[_0xba82('0x48')]=_0x3a1718;return _0x33464d;})[_0xba82('0x2b')](respondWithFilteredResult(_0x31c67e,_0x380882))['catch'](handleError(_0x31c67e,null));};exports[_0xba82('0x49')]=function(_0x517b65,_0x315cdd){var _0x3c0ad3={'raw':![],'where':{'id':_0x517b65[_0xba82('0x4a')]['id']}},_0xb958a8={};_0xb958a8['model']=_[_0xba82('0x36')](db['VoiceQueueReport'][_0xba82('0x32')]);_0xb958a8[_0xba82('0x37')]=_[_0xba82('0x36')](_0x517b65[_0xba82('0x37')]);_0xb958a8[_0xba82('0x38')]=_[_0xba82('0x39')](_0xb958a8[_0xba82('0x35')],_0xb958a8[_0xba82('0x37')]);_0x3c0ad3['attributes']=_[_0xba82('0x39')](_0xb958a8[_0xba82('0x35')],qs[_0xba82('0x3b')](_0x517b65[_0xba82('0x37')][_0xba82('0x3b')]));_0x3c0ad3[_0xba82('0x3a')]=_0x3c0ad3[_0xba82('0x3a')][_0xba82('0x4b')]?_0x3c0ad3['attributes']:_0xb958a8[_0xba82('0x35')];if(_0x517b65['query'][_0xba82('0x4c')]){_0x3c0ad3[_0xba82('0x46')]=[{'all':!![]}];}_0x3c0ad3=_[_0xba82('0x42')]({},_0x3c0ad3,_0x517b65[_0xba82('0x45')]);return db['VoiceQueueReport'][_0xba82('0x4d')](_0x3c0ad3)[_0xba82('0x2b')](handleEntityNotFound(_0x315cdd,null))[_0xba82('0x2b')](respondWithResult(_0x315cdd,null))['catch'](handleError(_0x315cdd,null));};exports[_0xba82('0x4e')]=function(_0x18dce8,_0x393ca7){return db[_0xba82('0x31')]['create'](_0x18dce8[_0xba82('0x4f')],{})['then'](respondWithResult(_0x393ca7,0xc9))['catch'](handleError(_0x393ca7,null));};exports[_0xba82('0x2a')]=function(_0x575fce,_0xe39c9f){if(_0x575fce['body']['id']){delete _0x575fce[_0xba82('0x4f')]['id'];}return db[_0xba82('0x31')][_0xba82('0x4d')]({'where':{'id':_0x575fce[_0xba82('0x4a')]['id']}})[_0xba82('0x2b')](handleEntityNotFound(_0xe39c9f,null))[_0xba82('0x2b')](saveUpdates(_0x575fce[_0xba82('0x4f')],null))[_0xba82('0x2b')](respondWithResult(_0xe39c9f,null))[_0xba82('0x50')](handleError(_0xe39c9f,null));};exports['destroy']=function(_0x1dd0ab,_0x24739e){return db['VoiceQueueReport'][_0xba82('0x4d')]({'where':{'id':_0x1dd0ab[_0xba82('0x4a')]['id']}})[_0xba82('0x2b')](handleEntityNotFound(_0x24739e,null))[_0xba82('0x2b')](removeEntity(_0x24739e,null))[_0xba82('0x50')](handleError(_0x24739e,null));};exports[_0xba82('0x51')]=function(_0x2a9e8c,_0x2ca0ba){return db[_0xba82('0x31')][_0xba82('0x51')]()[_0xba82('0x2b')](respondWithResult(_0x2ca0ba,null))[_0xba82('0x50')](handleError(_0x2ca0ba,null));};exports[_0xba82('0x52')]=function(_0x1cd9d0,_0x529a01){var _0xd1f8b3={},_0x5625e7={},_0x7278e={'count':0x0,'rows':[]};_0x5625e7[_0xba82('0x35')]=_[_0xba82('0x36')](db[_0xba82('0x31')]['rawAttributes']);_0x5625e7[_0xba82('0x37')]=_[_0xba82('0x36')](_0x1cd9d0[_0xba82('0x37')]);_0x5625e7[_0xba82('0x38')]=_[_0xba82('0x39')](_0x5625e7[_0xba82('0x35')],_0x5625e7['query']);_0xd1f8b3[_0xba82('0x3a')]=_['intersection'](_0x5625e7[_0xba82('0x35')],qs['fields'](_0x1cd9d0[_0xba82('0x37')][_0xba82('0x3b')]));_0xd1f8b3[_0xba82('0x3a')]=_0xd1f8b3['attributes'][_0xba82('0x4b')]?_0xd1f8b3[_0xba82('0x3a')]:_0x5625e7[_0xba82('0x35')];if(!_0x1cd9d0[_0xba82('0x37')][_0xba82('0x3c')]('nolimit')){_0xd1f8b3[_0xba82('0x24')]=qs[_0xba82('0x24')](_0x1cd9d0[_0xba82('0x37')][_0xba82('0x24')]);_0xd1f8b3[_0xba82('0x22')]=qs[_0xba82('0x22')](_0x1cd9d0[_0xba82('0x37')][_0xba82('0x22')]);}_0xd1f8b3[_0xba82('0x3d')]=qs[_0xba82('0x3e')](_0x1cd9d0[_0xba82('0x37')]['sort']);_0xd1f8b3['where']=qs[_0xba82('0x38')](_[_0xba82('0x40')](_0x1cd9d0['query'],_0x5625e7[_0xba82('0x38')]));if(_0x1cd9d0[_0xba82('0x37')][_0xba82('0x41')]){_0xd1f8b3[_0xba82('0x3f')]=_[_0xba82('0x42')](_0xd1f8b3[_0xba82('0x3f')],{'$or':_[_0xba82('0x43')](_0xd1f8b3['attributes'],function(_0x501d33){var _0x3f3803={};_0x3f3803[_0x501d33]={'$like':'%'+_0x1cd9d0[_0xba82('0x37')][_0xba82('0x41')]+'%'};return _0x3f3803;})});}_0xd1f8b3=_[_0xba82('0x42')]({},_0xd1f8b3,_0x1cd9d0['options']);var _0x5a2733={'where':_0xd1f8b3[_0xba82('0x3f')]};return db['VoiceQueueReport'][_0xba82('0x25')](_0x5a2733)['then'](function(_0x51751a){_0x7278e[_0xba82('0x25')]=_0x51751a;if(_0x1cd9d0[_0xba82('0x37')][_0xba82('0x4c')]){_0xd1f8b3[_0xba82('0x46')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0xd1f8b3);})[_0xba82('0x2b')](function(_0x421d84){_0x7278e[_0xba82('0x48')]=_0x421d84;return _0x7278e;})[_0xba82('0x2b')](respondWithFilteredResult(_0x529a01,_0xd1f8b3,'getVoiceQueuesReport'))[_0xba82('0x50')](handleError(_0x529a01,null,_0xba82('0x52')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 28d9040..c6f4ca6 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 _0xda36=['events','../../mysqldb','VoiceQueueReport','update','remove','emit','hasOwnProperty','hook'];(function(_0x54286b,_0x59bf38){var _0x99940f=function(_0x4a5bc2){while(--_0x4a5bc2){_0x54286b['push'](_0x54286b['shift']());}};_0x99940f(++_0x59bf38);}(_0xda36,0x108));var _0x6da3=function(_0x479016,_0x4b36fa){_0x479016=_0x479016-0x0;var _0x5caacf=_0xda36[_0x479016];return _0x5caacf;};'use strict';var EventEmitter=require(_0x6da3('0x0'));var VoiceQueueReport=require(_0x6da3('0x1'))['db'][_0x6da3('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6da3('0x3'),'afterDestroy':_0x6da3('0x4')};function emitEvent(_0x119dac){return function(_0x26e7e3,_0x39904e,_0x46f3b2){VoiceQueueReportEvents[_0x6da3('0x5')](_0x119dac+':'+_0x26e7e3['id'],_0x26e7e3);VoiceQueueReportEvents[_0x6da3('0x5')](_0x119dac,_0x26e7e3);_0x46f3b2(null);};}for(var e in events){if(events[_0x6da3('0x6')](e)){var event=events[e];VoiceQueueReport[_0x6da3('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x6dbe=['setMaxListeners','save','update','remove','emit','events','VoiceQueueReport'];(function(_0x4a9909,_0x49ea07){var _0x2c82f3=function(_0x245abf){while(--_0x245abf){_0x4a9909['push'](_0x4a9909['shift']());}};_0x2c82f3(++_0x49ea07);}(_0x6dbe,0x19b));var _0xe6db=function(_0x2b30cd,_0x5446ef){_0x2b30cd=_0x2b30cd-0x0;var _0xef930f=_0x6dbe[_0x2b30cd];return _0xef930f;};'use strict';var EventEmitter=require(_0xe6db('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0xe6db('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xe6db('0x2')](0x0);var events={'afterCreate':_0xe6db('0x3'),'afterUpdate':_0xe6db('0x4'),'afterDestroy':_0xe6db('0x5')};function emitEvent(_0x3cf822){return function(_0x3936ff,_0x20a2ee,_0x381df3){VoiceQueueReportEvents[_0xe6db('0x6')](_0x3cf822+':'+_0x3936ff['id'],_0x3936ff);VoiceQueueReportEvents[_0xe6db('0x6')](_0x3cf822,_0x3936ff);_0x381df3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 04a0940..4aff380 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 _0x3a71=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','define','report_queue','uniqueid','calleridnum','lodash','../../config/logger','api','moment'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x3a71,0xea));var _0x13a7=function(_0x3abda8,_0x4a7965){_0x3abda8=_0x3abda8-0x0;var _0x2d5d79=_0x3a71[_0x3abda8];return _0x2d5d79;};'use strict';var _=require(_0x13a7('0x0'));var util=require('util');var logger=require(_0x13a7('0x1'))(_0x13a7('0x2'));var moment=require(_0x13a7('0x3'));var BPromise=require(_0x13a7('0x4'));var rp=require(_0x13a7('0x5'));var fs=require('fs');var path=require(_0x13a7('0x6'));var rimraf=require(_0x13a7('0x7'));var config=require(_0x13a7('0x8'));var attributes=require(_0x13a7('0x9'));module['exports']=function(_0x2efe76,_0x52985e){return _0x2efe76[_0x13a7('0xa')]('VoiceQueueReport',attributes,{'tableName':_0x13a7('0xb'),'paranoid':![],'indexes':[{'fields':[_0x13a7('0xc')]},{'fields':[_0x13a7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x805e=['uniqueid','calleridnum','util','api','moment','bluebird','request-promise','../../config/environment','exports','define','VoiceQueueReport'];(function(_0x14f466,_0xa58628){var _0xd8d98b=function(_0x2aed63){while(--_0x2aed63){_0x14f466['push'](_0x14f466['shift']());}};_0xd8d98b(++_0xa58628);}(_0x805e,0x70));var _0xe805=function(_0x19c765,_0x5c7831){_0x19c765=_0x19c765-0x0;var _0x6e07a0=_0x805e[_0x19c765];return _0x6e07a0;};'use strict';var _=require('lodash');var util=require(_0xe805('0x0'));var logger=require('../../config/logger')(_0xe805('0x1'));var moment=require(_0xe805('0x2'));var BPromise=require(_0xe805('0x3'));var rp=require(_0xe805('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe805('0x5'));var attributes=require('./voiceQueueReport.attributes');module[_0xe805('0x6')]=function(_0x5d74a5,_0x3260a2){return _0x5d74a5[_0xe805('0x7')](_0xe805('0x8'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xe805('0x9')]},{'fields':[_0xe805('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 9893aa2..9927add 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 _0x5b00=['defaults','redis','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','GetVoiceQueueReport','findAll','options','raw','where','limit','include','map','model','attributes','CreateVoiceQueueReport','VoiceQueueReport','create','body','UpdateVoiceQueueReport','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x53358c,_0x35810d){var _0x10cfb8=function(_0x3dd2ce){while(--_0x3dd2ce){_0x53358c['push'](_0x53358c['shift']());}};_0x10cfb8(++_0x35810d);}(_0x5b00,0x1ee));var _0x05b0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5b00[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x05b0('0x0'));var util=require('util');var moment=require(_0x05b0('0x1'));var BPromise=require('bluebird');var rs=require(_0x05b0('0x2'));var fs=require('fs');var Redis=require(_0x05b0('0x3'));var db=require(_0x05b0('0x4'))['db'];var utils=require(_0x05b0('0x5'));var logger=require(_0x05b0('0x6'))(_0x05b0('0x7'));var config=require('../../config/environment');var jayson=require(_0x05b0('0x8'));var client=jayson['client'][_0x05b0('0x9')]({'port':0x232a});config['redis']=_[_0x05b0('0xa')](config[_0x05b0('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x05b0('0xc'))(new Redis(config['redis']));require(_0x05b0('0xd'))[_0x05b0('0xe')](socket);function respondWithRpcPromise(_0x59407c,_0x460a87,_0x505fa2){return new BPromise(function(_0x29c52a,_0x3ba3db){return client[_0x05b0('0xf')](_0x59407c,_0x505fa2)[_0x05b0('0x10')](function(_0x2b84e8){logger[_0x05b0('0x11')](_0x05b0('0x12'),_0x460a87,'request\x20sent');logger[_0x05b0('0x13')](_0x05b0('0x14'),_0x460a87,_0x05b0('0x15'),JSON[_0x05b0('0x16')](_0x2b84e8));if(_0x2b84e8['error']){if(_0x2b84e8['error'][_0x05b0('0x17')]===0x1f4){logger[_0x05b0('0x18')](_0x05b0('0x12'),_0x460a87,_0x2b84e8['error'][_0x05b0('0x19')]);return _0x3ba3db(_0x2b84e8[_0x05b0('0x18')][_0x05b0('0x19')]);}logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x460a87,_0x2b84e8['error']['message']);return _0x29c52a(_0x2b84e8[_0x05b0('0x18')]['message']);}else{logger[_0x05b0('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x460a87,'request\x20sent');_0x29c52a(_0x2b84e8[_0x05b0('0x1a')][_0x05b0('0x19')]);}})['catch'](function(_0x3b1266){logger[_0x05b0('0x18')](_0x05b0('0x12'),_0x460a87,_0x3b1266);_0x3ba3db(_0x3b1266);});});}exports[_0x05b0('0x1b')]=function(_0x53c5b4){var _0x4e014b=this;return new Promise(function(_0x184a42,_0x3fef35){return db['VoiceQueueReport'][_0x05b0('0x1c')]({'raw':_0x53c5b4[_0x05b0('0x1d')]?_0x53c5b4[_0x05b0('0x1d')][_0x05b0('0x1e')]===undefined?!![]:![]:!![],'where':_0x53c5b4[_0x05b0('0x1d')]?_0x53c5b4['options'][_0x05b0('0x1f')]||null:null,'attributes':_0x53c5b4[_0x05b0('0x1d')]?_0x53c5b4[_0x05b0('0x1d')]['attributes']||null:null,'limit':_0x53c5b4[_0x05b0('0x1d')]?_0x53c5b4[_0x05b0('0x1d')][_0x05b0('0x20')]||null:null,'include':_0x53c5b4[_0x05b0('0x1d')]?_0x53c5b4[_0x05b0('0x1d')][_0x05b0('0x21')]?_[_0x05b0('0x22')](_0x53c5b4[_0x05b0('0x1d')][_0x05b0('0x21')],function(_0x24e456){return{'model':db[_0x24e456[_0x05b0('0x23')]],'as':_0x24e456['as'],'attributes':_0x24e456[_0x05b0('0x24')],'include':_0x24e456[_0x05b0('0x21')]?_[_0x05b0('0x22')](_0x24e456[_0x05b0('0x21')],function(_0x3bc054){return{'model':db[_0x3bc054[_0x05b0('0x23')]],'as':_0x3bc054['as'],'attributes':_0x3bc054[_0x05b0('0x24')],'include':_0x3bc054['include']?_['map'](_0x3bc054[_0x05b0('0x21')],function(_0xb52b7f){return{'model':db[_0xb52b7f[_0x05b0('0x23')]],'as':_0xb52b7f['as'],'attributes':_0xb52b7f[_0x05b0('0x24')]};}):[]};}):[]};}):[]:[]})[_0x05b0('0x10')](function(_0x5a2b09){logger[_0x05b0('0x11')](_0x05b0('0x1b'),_0x53c5b4);logger[_0x05b0('0x13')](_0x05b0('0x1b'),_0x53c5b4,JSON[_0x05b0('0x16')](_0x5a2b09));_0x184a42(_0x5a2b09);})['catch'](function(_0x140fb0){logger[_0x05b0('0x18')](_0x05b0('0x1b'),_0x140fb0[_0x05b0('0x19')],_0x53c5b4);_0x3fef35(_0x4e014b[_0x05b0('0x18')](0x1f4,_0x140fb0[_0x05b0('0x19')]));});});};exports[_0x05b0('0x25')]=function(_0x3d4a7){var _0x367817=this;return new Promise(function(_0x2f31d4,_0x4541c6){return db[_0x05b0('0x26')][_0x05b0('0x27')](_0x3d4a7[_0x05b0('0x28')],{'raw':_0x3d4a7['options']?_0x3d4a7[_0x05b0('0x1d')][_0x05b0('0x1e')]===undefined?!![]:![]:!![]})[_0x05b0('0x10')](function(_0x471e73){logger[_0x05b0('0x11')]('CreateVoiceQueueReport',_0x3d4a7);logger['debug']('CreateVoiceQueueReport',_0x3d4a7,JSON['stringify'](_0x471e73));_0x2f31d4(_0x471e73);})['catch'](function(_0x322468){logger[_0x05b0('0x18')]('CreateVoiceQueueReport',_0x322468[_0x05b0('0x19')],_0x3d4a7);_0x4541c6(_0x367817[_0x05b0('0x18')](0x1f4,_0x322468['message']));});});};exports[_0x05b0('0x29')]=function(_0x2704ec){var _0x3d4add=this;return new Promise(function(_0x5a4c0c,_0x408003){return db[_0x05b0('0x26')]['update'](_0x2704ec[_0x05b0('0x28')],{'raw':_0x2704ec['options']?_0x2704ec[_0x05b0('0x1d')][_0x05b0('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2704ec[_0x05b0('0x1d')]?_0x2704ec[_0x05b0('0x1d')][_0x05b0('0x1f')]||null:null,'attributes':_0x2704ec['options']?_0x2704ec[_0x05b0('0x1d')][_0x05b0('0x24')]||null:null,'limit':_0x2704ec['options']?_0x2704ec['options'][_0x05b0('0x20')]||null:null})[_0x05b0('0x10')](function(_0x19eeb8){logger[_0x05b0('0x11')](_0x05b0('0x29'),_0x2704ec);logger['debug'](_0x05b0('0x29'),_0x2704ec,JSON[_0x05b0('0x16')](_0x19eeb8));_0x5a4c0c(_0x19eeb8);})['catch'](function(_0x4859cc){logger['error']('UpdateVoiceQueueReport',_0x4859cc[_0x05b0('0x19')],_0x2704ec);_0x408003(_0x3d4add['error'](0x1f4,_0x4859cc[_0x05b0('0x19')]));});});}; \ No newline at end of file +var _0xbf17=['create','body','CreateVoiceQueueReport','update','UpdateVoiceQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','register','request','info','request\x20sent','debug','stringify','error','VoiceQueueReport,\x20%s,\x20%s','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','then'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0xbf17,0x101));var _0x7bf1=function(_0x535dde,_0x5e1bf3){_0x535dde=_0x535dde-0x0;var _0x23aa86=_0xbf17[_0x535dde];return _0x23aa86;};'use strict';var _=require(_0x7bf1('0x0'));var util=require(_0x7bf1('0x1'));var moment=require(_0x7bf1('0x2'));var BPromise=require(_0x7bf1('0x3'));var rs=require(_0x7bf1('0x4'));var fs=require('fs');var Redis=require(_0x7bf1('0x5'));var db=require(_0x7bf1('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7bf1('0x7'));var config=require(_0x7bf1('0x8'));var jayson=require(_0x7bf1('0x9'));var client=jayson[_0x7bf1('0xa')]['http']({'port':0x232a});config[_0x7bf1('0xb')]=_[_0x7bf1('0xc')](config[_0x7bf1('0xb')],{'host':_0x7bf1('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7bf1('0xb')]));require('./voiceQueueReport.socket')[_0x7bf1('0xe')](socket);function respondWithRpcPromise(_0x1b6af8,_0x24e5d3,_0x9588c6){return new BPromise(function(_0x39b072,_0x28a9f5){return client[_0x7bf1('0xf')](_0x1b6af8,_0x9588c6)['then'](function(_0x466e8c){logger[_0x7bf1('0x10')]('VoiceQueueReport,\x20%s,\x20%s',_0x24e5d3,_0x7bf1('0x11'));logger[_0x7bf1('0x12')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x24e5d3,_0x7bf1('0x11'),JSON[_0x7bf1('0x13')](_0x466e8c));if(_0x466e8c[_0x7bf1('0x14')]){if(_0x466e8c[_0x7bf1('0x14')]['code']===0x1f4){logger[_0x7bf1('0x14')](_0x7bf1('0x15'),_0x24e5d3,_0x466e8c[_0x7bf1('0x14')]['message']);return _0x28a9f5(_0x466e8c['error'][_0x7bf1('0x16')]);}logger['error'](_0x7bf1('0x15'),_0x24e5d3,_0x466e8c[_0x7bf1('0x14')][_0x7bf1('0x16')]);return _0x39b072(_0x466e8c[_0x7bf1('0x14')][_0x7bf1('0x16')]);}else{logger[_0x7bf1('0x10')](_0x7bf1('0x15'),_0x24e5d3,_0x7bf1('0x11'));_0x39b072(_0x466e8c[_0x7bf1('0x17')][_0x7bf1('0x16')]);}})[_0x7bf1('0x18')](function(_0x18dbe1){logger['error'](_0x7bf1('0x15'),_0x24e5d3,_0x18dbe1);_0x28a9f5(_0x18dbe1);});});}exports[_0x7bf1('0x19')]=function(_0x8718ce){var _0x28c9fe=this;return new Promise(function(_0x557401,_0x19b666){return db[_0x7bf1('0x1a')][_0x7bf1('0x1b')]({'raw':_0x8718ce[_0x7bf1('0x1c')]?_0x8718ce[_0x7bf1('0x1c')][_0x7bf1('0x1d')]===undefined?!![]:![]:!![],'where':_0x8718ce[_0x7bf1('0x1c')]?_0x8718ce[_0x7bf1('0x1c')][_0x7bf1('0x1e')]||null:null,'attributes':_0x8718ce[_0x7bf1('0x1c')]?_0x8718ce[_0x7bf1('0x1c')][_0x7bf1('0x1f')]||null:null,'limit':_0x8718ce[_0x7bf1('0x1c')]?_0x8718ce['options'][_0x7bf1('0x20')]||null:null,'include':_0x8718ce[_0x7bf1('0x1c')]?_0x8718ce[_0x7bf1('0x1c')][_0x7bf1('0x21')]?_[_0x7bf1('0x22')](_0x8718ce[_0x7bf1('0x1c')][_0x7bf1('0x21')],function(_0x5c51c8){return{'model':db[_0x5c51c8['model']],'as':_0x5c51c8['as'],'attributes':_0x5c51c8[_0x7bf1('0x1f')],'include':_0x5c51c8['include']?_['map'](_0x5c51c8['include'],function(_0x521856){return{'model':db[_0x521856[_0x7bf1('0x23')]],'as':_0x521856['as'],'attributes':_0x521856['attributes'],'include':_0x521856[_0x7bf1('0x21')]?_['map'](_0x521856[_0x7bf1('0x21')],function(_0x38b5ac){return{'model':db[_0x38b5ac['model']],'as':_0x38b5ac['as'],'attributes':_0x38b5ac[_0x7bf1('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7bf1('0x24')](function(_0x45045f){logger[_0x7bf1('0x10')](_0x7bf1('0x19'),_0x8718ce);logger[_0x7bf1('0x12')](_0x7bf1('0x19'),_0x8718ce,JSON[_0x7bf1('0x13')](_0x45045f));_0x557401(_0x45045f);})[_0x7bf1('0x18')](function(_0x3882d8){logger[_0x7bf1('0x14')](_0x7bf1('0x19'),_0x3882d8[_0x7bf1('0x16')],_0x8718ce);_0x19b666(_0x28c9fe[_0x7bf1('0x14')](0x1f4,_0x3882d8[_0x7bf1('0x16')]));});});};exports['CreateVoiceQueueReport']=function(_0x2490d6){var _0x29ea2b=this;return new Promise(function(_0x55334d,_0x1e88e2){return db['VoiceQueueReport'][_0x7bf1('0x25')](_0x2490d6[_0x7bf1('0x26')],{'raw':_0x2490d6[_0x7bf1('0x1c')]?_0x2490d6[_0x7bf1('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x7bf1('0x24')](function(_0x12aa1b){logger['info'](_0x7bf1('0x27'),_0x2490d6);logger[_0x7bf1('0x12')](_0x7bf1('0x27'),_0x2490d6,JSON[_0x7bf1('0x13')](_0x12aa1b));_0x55334d(_0x12aa1b);})['catch'](function(_0x552f80){logger[_0x7bf1('0x14')](_0x7bf1('0x27'),_0x552f80[_0x7bf1('0x16')],_0x2490d6);_0x1e88e2(_0x29ea2b[_0x7bf1('0x14')](0x1f4,_0x552f80[_0x7bf1('0x16')]));});});};exports['UpdateVoiceQueueReport']=function(_0x473e89){var _0x45aa5b=this;return new Promise(function(_0x3743c4,_0x2885b2){return db[_0x7bf1('0x1a')][_0x7bf1('0x28')](_0x473e89[_0x7bf1('0x26')],{'raw':_0x473e89['options']?_0x473e89[_0x7bf1('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x473e89[_0x7bf1('0x1c')]?_0x473e89[_0x7bf1('0x1c')][_0x7bf1('0x1e')]||null:null,'attributes':_0x473e89[_0x7bf1('0x1c')]?_0x473e89[_0x7bf1('0x1c')][_0x7bf1('0x1f')]||null:null,'limit':_0x473e89[_0x7bf1('0x1c')]?_0x473e89[_0x7bf1('0x1c')][_0x7bf1('0x20')]||null:null})[_0x7bf1('0x24')](function(_0xe58f){logger[_0x7bf1('0x10')](_0x7bf1('0x29'),_0x473e89);logger[_0x7bf1('0x12')]('UpdateVoiceQueueReport',_0x473e89,JSON[_0x7bf1('0x13')](_0xe58f));_0x3743c4(_0xe58f);})[_0x7bf1('0x18')](function(_0x4ba3e5){logger[_0x7bf1('0x14')]('UpdateVoiceQueueReport',_0x4ba3e5[_0x7bf1('0x16')],_0x473e89);_0x2885b2(_0x45aa5b['error'](0x1f4,_0x4ba3e5[_0x7bf1('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 0762528..dcb4a3f 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 _0xd84b=['remove','update','emit','save'];(function(_0x10de69,_0x3fd9ed){var _0x3238f9=function(_0x288ff9){while(--_0x288ff9){_0x10de69['push'](_0x10de69['shift']());}};_0x3238f9(++_0x3fd9ed);}(_0xd84b,0x177));var _0xbd84=function(_0x57cceb,_0x56f08d){_0x57cceb=_0x57cceb-0x0;var _0x2f172b=_0xd84b[_0x57cceb];return _0x2f172b;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0xbd84('0x0'),_0xbd84('0x1'),_0xbd84('0x2')];function createListener(_0x4ddd4f,_0x5db14a){return function(_0x11dada){_0x5db14a[_0xbd84('0x3')](_0x4ddd4f,_0x11dada);};}function removeListener(_0x2f0d5e,_0x7f1712){return function(){VoiceQueueReportEvents['removeListener'](_0x2f0d5e,_0x7f1712);};}exports['register']=function(_0x394af9){for(var _0x11dbbc=0x0,_0x32211a=events['length'];_0x11dbbc<_0x32211a;_0x11dbbc++){var _0x50c325=events[_0x11dbbc];var _0x5008a7=createListener('voiceQueueReport:'+_0x50c325,_0x394af9);VoiceQueueReportEvents['on'](_0x50c325,_0x5008a7);}}; \ No newline at end of file +var _0x02ef=['length','voiceQueueReport:','./voiceQueueReport.events','remove','emit','removeListener','register'];(function(_0xfa12dc,_0x5ce77d){var _0x353283=function(_0x1f9c20){while(--_0x1f9c20){_0xfa12dc['push'](_0xfa12dc['shift']());}};_0x353283(++_0x5ce77d);}(_0x02ef,0x11a));var _0xf02e=function(_0xbc8873,_0x160489){_0xbc8873=_0xbc8873-0x0;var _0x5289fd=_0x02ef[_0xbc8873];return _0x5289fd;};'use strict';var VoiceQueueReportEvents=require(_0xf02e('0x0'));var events=['save',_0xf02e('0x1'),'update'];function createListener(_0x3acfe2,_0x1c228d){return function(_0x4c87bc){_0x1c228d[_0xf02e('0x2')](_0x3acfe2,_0x4c87bc);};}function removeListener(_0x4783f7,_0x1edc1c){return function(){VoiceQueueReportEvents[_0xf02e('0x3')](_0x4783f7,_0x1edc1c);};}exports[_0xf02e('0x4')]=function(_0x511257){for(var _0x332c29=0x0,_0x411cbe=events[_0xf02e('0x5')];_0x332c29<_0x411cbe;_0x332c29++){var _0x4682a6=events[_0x332c29];var _0x2b79b3=createListener(_0xf02e('0x6')+_0x4682a6,_0x511257);VoiceQueueReportEvents['on'](_0x4682a6,_0x2b79b3);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index b6ebe42..5ca1837 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 _0xd5d2=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports'];(function(_0xcb1fc1,_0x75c725){var _0x2c3823=function(_0x3a23f3){while(--_0x3a23f3){_0xcb1fc1['push'](_0xcb1fc1['shift']());}};_0x2c3823(++_0x75c725);}(_0xd5d2,0x154));var _0x2d5d=function(_0x2040a7,_0x8da657){_0x2040a7=_0x2040a7-0x0;var _0x346357=_0xd5d2[_0x2040a7];return _0x346357;};'use strict';var multer=require('multer');var util=require(_0x2d5d('0x0'));var path=require(_0x2d5d('0x1'));var timeout=require(_0x2d5d('0x2'));var express=require(_0x2d5d('0x3'));var router=express[_0x2d5d('0x4')]();var fs_extra=require(_0x2d5d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2d5d('0x6'));var config=require(_0x2d5d('0x7'));var controller=require(_0x2d5d('0x8'));router[_0x2d5d('0x9')]('/',auth[_0x2d5d('0xa')](),controller[_0x2d5d('0xb')]);router[_0x2d5d('0x9')](_0x2d5d('0xc'),auth['isAuthenticated'](),controller[_0x2d5d('0xd')]);router[_0x2d5d('0xe')]('/',auth[_0x2d5d('0xa')](),controller[_0x2d5d('0xf')]);router[_0x2d5d('0x10')](_0x2d5d('0xc'),auth[_0x2d5d('0xa')](),controller[_0x2d5d('0x11')]);router['delete'](_0x2d5d('0xc'),auth[_0x2d5d('0xa')](),controller[_0x2d5d('0x12')]);module[_0x2d5d('0x13')]=router; \ No newline at end of file +var _0x120b=['get','index','/:id','isAuthenticated','post','create','put','update','exports','multer','util','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x2a31cd,_0x15a139){var _0x22b1ba=function(_0x39ea30){while(--_0x39ea30){_0x2a31cd['push'](_0x2a31cd['shift']());}};_0x22b1ba(++_0x15a139);}(_0x120b,0x180));var _0xb120=function(_0xd093ad,_0x565a8f){_0xd093ad=_0xd093ad-0x0;var _0x26c9d0=_0x120b[_0xd093ad];return _0x26c9d0;};'use strict';var multer=require(_0xb120('0x0'));var util=require(_0xb120('0x1'));var path=require('path');var timeout=require(_0xb120('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb120('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xb120('0x4'));var config=require(_0xb120('0x5'));var controller=require('./voiceQueuesLog.controller');router[_0xb120('0x6')]('/',auth['isAuthenticated'](),controller[_0xb120('0x7')]);router[_0xb120('0x6')](_0xb120('0x8'),auth[_0xb120('0x9')](),controller['show']);router[_0xb120('0xa')]('/',auth[_0xb120('0x9')](),controller[_0xb120('0xb')]);router[_0xb120('0xc')]('/:id',auth[_0xb120('0x9')](),controller[_0xb120('0xd')]);router['delete'](_0xb120('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xb120('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index daa364c..a0d5e29 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 _0xac1b=['sequelize','moment','exports','STRING','DATE','format'];(function(_0x22ec4e,_0x3794a7){var _0x4184d5=function(_0x57636d){while(--_0x57636d){_0x22ec4e['push'](_0x22ec4e['shift']());}};_0x4184d5(++_0x3794a7);}(_0xac1b,0x10e));var _0xbac1=function(_0x508f11,_0x21d353){_0x508f11=_0x508f11-0x0;var _0x2ee3e8=_0xac1b[_0x508f11];return _0x2ee3e8;};'use strict';var Sequelize=require(_0xbac1('0x0'));var moment=require(_0xbac1('0x1'));module[_0xbac1('0x2')]={'time':{'type':Sequelize[_0xbac1('0x3')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xbac1('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xbac1('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xbac1('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xbac1('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xbac1('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xbac1('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xbac1('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xbac1('0x4')],'allowNull':![],'defaultValue':moment()[_0xbac1('0x5')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0xb71c=['YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING','DATE','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb71c,0x151));var _0xcb71=function(_0x591267,_0x378895){_0x591267=_0x591267-0x0;var _0x1f0215=_0xb71c[_0x591267];return _0x1f0215;};'use strict';var Sequelize=require(_0xcb71('0x0'));var moment=require(_0xcb71('0x1'));module[_0xcb71('0x2')]={'time':{'type':Sequelize[_0xcb71('0x3')]},'callid':{'type':Sequelize[_0xcb71('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xcb71('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xcb71('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xcb71('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xcb71('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xcb71('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xcb71('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xcb71('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xcb71('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xcb71('0x4')],'allowNull':![],'defaultValue':moment()[_0xcb71('0x5')](_0xcb71('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index df3ce87..eaf6b75 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 _0x8c42=['params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','json','limit','count','offset','status','set','Content-Range','save','update','then','destroy','sendStatus','stack','name','send','map','VoiceQueuesLog','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x8c42,0xa0));var _0x28c4=function(_0x3fb5eb,_0x5947a6){_0x3fb5eb=_0x3fb5eb-0x0;var _0x481291=_0x8c42[_0x3fb5eb];return _0x481291;};'use strict';var emlformat=require(_0x28c4('0x0'));var rimraf=require(_0x28c4('0x1'));var zipdir=require(_0x28c4('0x2'));var jsonpatch=require(_0x28c4('0x3'));var rp=require(_0x28c4('0x4'));var moment=require(_0x28c4('0x5'));var BPromise=require(_0x28c4('0x6'));var Mustache=require('mustache');var util=require(_0x28c4('0x7'));var path=require(_0x28c4('0x8'));var sox=require(_0x28c4('0x9'));var csv=require(_0x28c4('0xa'));var ejs=require(_0x28c4('0xb'));var fs=require('fs');var fs_extra=require(_0x28c4('0xc'));var _=require(_0x28c4('0xd'));var squel=require(_0x28c4('0xe'));var crypto=require(_0x28c4('0xf'));var jsforce=require(_0x28c4('0x10'));var deskjs=require(_0x28c4('0x11'));var toCsv=require(_0x28c4('0xa'));var querystring=require(_0x28c4('0x12'));var Papa=require(_0x28c4('0x13'));var Redis=require(_0x28c4('0x14'));var authService=require(_0x28c4('0x15'));var qs=require(_0x28c4('0x16'));var as=require(_0x28c4('0x17'));var hardwareService=require(_0x28c4('0x18'));var logger=require(_0x28c4('0x19'))(_0x28c4('0x1a'));var utils=require(_0x28c4('0x1b'));var config=require(_0x28c4('0x1c'));var licenseUtil=require(_0x28c4('0x1d'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5172e8,_0x463b43){_0x463b43=_0x463b43||0xcc;return function(_0x3cb8b0){if(_0x3cb8b0){return _0x5172e8['sendStatus'](_0x463b43);}return _0x5172e8['status'](_0x463b43)[_0x28c4('0x1e')]();};}function respondWithResult(_0xf482a6,_0x47b58d){_0x47b58d=_0x47b58d||0xc8;return function(_0xf29b89){if(_0xf29b89){return _0xf482a6['status'](_0x47b58d)[_0x28c4('0x1f')](_0xf29b89);}};}function respondWithFilteredResult(_0x38c8a2,_0x2ba9bf){return function(_0x47519e){if(_0x47519e){var _0x1eebec=typeof _0x2ba9bf['offset']==='undefined'&&typeof _0x2ba9bf[_0x28c4('0x20')]==='undefined';var _0xea591e=_0x47519e[_0x28c4('0x21')];var _0x55ac12=_0x1eebec?0x0:_0x2ba9bf[_0x28c4('0x22')];var _0x5b0d18=_0x1eebec?_0x47519e['count']:_0x2ba9bf[_0x28c4('0x22')]+_0x2ba9bf[_0x28c4('0x20')];var _0x5448dd;if(_0x5b0d18>=_0xea591e){_0x5b0d18=_0xea591e;_0x5448dd=0xc8;}else{_0x5448dd=0xce;}_0x38c8a2[_0x28c4('0x23')](_0x5448dd);return _0x38c8a2[_0x28c4('0x24')](_0x28c4('0x25'),_0x55ac12+'-'+_0x5b0d18+'/'+_0xea591e)[_0x28c4('0x1f')](_0x47519e);}return null;};}function patchUpdates(_0x31bac3){return function(_0x3476b8){try{jsonpatch['apply'](_0x3476b8,_0x31bac3,!![]);}catch(_0x728ee1){return BPromise['reject'](_0x728ee1);}return _0x3476b8[_0x28c4('0x26')]();};}function saveUpdates(_0x5794d8,_0x30d5b7){return function(_0x7acac2){if(_0x7acac2){return _0x7acac2[_0x28c4('0x27')](_0x5794d8)[_0x28c4('0x28')](function(_0x8de7d5){return _0x8de7d5;});}return null;};}function removeEntity(_0x2c87c3,_0x25c7cf){return function(_0x5e7ed7){if(_0x5e7ed7){return _0x5e7ed7[_0x28c4('0x29')]()[_0x28c4('0x28')](function(){_0x2c87c3['status'](0xcc)[_0x28c4('0x1e')]();});}};}function handleEntityNotFound(_0xdc0b5d,_0x55ce53){return function(_0x5b82fa){if(!_0x5b82fa){_0xdc0b5d[_0x28c4('0x2a')](0x194);}return _0x5b82fa;};}function handleError(_0x465e8f,_0x4b4df9){_0x4b4df9=_0x4b4df9||0x1f4;return function(_0x8105cb){logger['error'](_0x8105cb[_0x28c4('0x2b')]);if(_0x8105cb['name']){delete _0x8105cb[_0x28c4('0x2c')];}_0x465e8f[_0x28c4('0x23')](_0x4b4df9)[_0x28c4('0x2d')](_0x8105cb);};}exports['index']=function(_0x447852,_0x4b6dd5){var _0x18c671={},_0x40e79e={},_0x567d76={'count':0x0,'rows':[]};var _0x1fab9a=_[_0x28c4('0x2e')](db[_0x28c4('0x2f')][_0x28c4('0x30')],function(_0x4ebb32){return{'name':_0x4ebb32[_0x28c4('0x31')],'type':_0x4ebb32[_0x28c4('0x32')]['key']};});_0x40e79e[_0x28c4('0x33')]=_[_0x28c4('0x2e')](_0x1fab9a,_0x28c4('0x2c'));_0x40e79e[_0x28c4('0x34')]=_[_0x28c4('0x35')](_0x447852[_0x28c4('0x34')]);_0x40e79e['filters']=_[_0x28c4('0x36')](_0x40e79e['model'],_0x40e79e[_0x28c4('0x34')]);_0x18c671[_0x28c4('0x37')]=_[_0x28c4('0x36')](_0x40e79e[_0x28c4('0x33')],qs[_0x28c4('0x38')](_0x447852[_0x28c4('0x34')][_0x28c4('0x38')]));_0x18c671[_0x28c4('0x37')]=_0x18c671[_0x28c4('0x37')][_0x28c4('0x39')]?_0x18c671['attributes']:_0x40e79e[_0x28c4('0x33')];if(!_0x447852[_0x28c4('0x34')][_0x28c4('0x3a')](_0x28c4('0x3b'))){_0x18c671[_0x28c4('0x20')]=qs[_0x28c4('0x20')](_0x447852['query'][_0x28c4('0x20')]);_0x18c671[_0x28c4('0x22')]=qs[_0x28c4('0x22')](_0x447852['query'][_0x28c4('0x22')]);}_0x18c671[_0x28c4('0x3c')]=qs[_0x28c4('0x3d')](_0x447852[_0x28c4('0x34')][_0x28c4('0x3d')]);_0x18c671[_0x28c4('0x3e')]=qs[_0x28c4('0x3f')](_[_0x28c4('0x40')](_0x447852[_0x28c4('0x34')],_0x40e79e['filters']),_0x1fab9a);if(_0x447852[_0x28c4('0x34')][_0x28c4('0x41')]){_0x18c671[_0x28c4('0x3e')]=_[_0x28c4('0x42')](_0x18c671[_0x28c4('0x3e')],{'$or':_[_0x28c4('0x2e')](_0x1fab9a,function(_0x15dc68){if(_0x15dc68[_0x28c4('0x32')]!=='VIRTUAL'){var _0x6b2ac5={};_0x6b2ac5[_0x15dc68['name']]={'$like':'%'+_0x447852[_0x28c4('0x34')]['filter']+'%'};return _0x6b2ac5;}})});}_0x18c671=_['merge']({},_0x18c671,_0x447852[_0x28c4('0x43')]);var _0x4e167a={'where':_0x18c671[_0x28c4('0x3e')]};return db['VoiceQueuesLog']['count'](_0x4e167a)[_0x28c4('0x28')](function(_0x4a3cd0){_0x567d76[_0x28c4('0x21')]=_0x4a3cd0;if(_0x447852[_0x28c4('0x34')][_0x28c4('0x44')]){_0x18c671[_0x28c4('0x45')]=[{'all':!![]}];}return db[_0x28c4('0x2f')][_0x28c4('0x46')](_0x18c671);})['then'](function(_0x191a1f){_0x567d76[_0x28c4('0x47')]=_0x191a1f;return _0x567d76;})['then'](respondWithFilteredResult(_0x4b6dd5,_0x18c671))[_0x28c4('0x48')](handleError(_0x4b6dd5,null));};exports[_0x28c4('0x49')]=function(_0x34ded9,_0x58ee56){var _0x5f3357={'raw':!![],'where':{'id':_0x34ded9[_0x28c4('0x4a')]['id']}},_0x2e4f99={};_0x2e4f99[_0x28c4('0x33')]=_[_0x28c4('0x35')](db[_0x28c4('0x2f')]['rawAttributes']);_0x2e4f99['query']=_[_0x28c4('0x35')](_0x34ded9[_0x28c4('0x34')]);_0x2e4f99[_0x28c4('0x3f')]=_[_0x28c4('0x36')](_0x2e4f99[_0x28c4('0x33')],_0x2e4f99[_0x28c4('0x34')]);_0x5f3357[_0x28c4('0x37')]=_['intersection'](_0x2e4f99[_0x28c4('0x33')],qs[_0x28c4('0x38')](_0x34ded9[_0x28c4('0x34')][_0x28c4('0x38')]));_0x5f3357[_0x28c4('0x37')]=_0x5f3357['attributes'][_0x28c4('0x39')]?_0x5f3357['attributes']:_0x2e4f99[_0x28c4('0x33')];if(_0x34ded9[_0x28c4('0x34')][_0x28c4('0x44')]){_0x5f3357[_0x28c4('0x45')]=[{'all':!![]}];}_0x5f3357=_['merge']({},_0x5f3357,_0x34ded9[_0x28c4('0x43')]);return db[_0x28c4('0x2f')][_0x28c4('0x4b')](_0x5f3357)['then'](handleEntityNotFound(_0x58ee56,null))['then'](respondWithResult(_0x58ee56,null))[_0x28c4('0x48')](handleError(_0x58ee56,null));};exports[_0x28c4('0x4c')]=function(_0x396c6a,_0x9b7219){return db[_0x28c4('0x2f')][_0x28c4('0x4c')](_0x396c6a[_0x28c4('0x4d')],{})[_0x28c4('0x28')](respondWithResult(_0x9b7219,0xc9))[_0x28c4('0x48')](handleError(_0x9b7219,null));};exports[_0x28c4('0x27')]=function(_0xba20a3,_0x11c565){if(_0xba20a3[_0x28c4('0x4d')]['id']){delete _0xba20a3[_0x28c4('0x4d')]['id'];}return db[_0x28c4('0x2f')][_0x28c4('0x4b')]({'where':{'id':_0xba20a3['params']['id']}})['then'](handleEntityNotFound(_0x11c565,null))[_0x28c4('0x28')](saveUpdates(_0xba20a3[_0x28c4('0x4d')],null))[_0x28c4('0x28')](respondWithResult(_0x11c565,null))['catch'](handleError(_0x11c565,null));};exports[_0x28c4('0x29')]=function(_0x1f4795,_0x4971b9){return db[_0x28c4('0x2f')]['find']({'where':{'id':_0x1f4795['params']['id']}})[_0x28c4('0x28')](handleEntityNotFound(_0x4971b9,null))[_0x28c4('0x28')](removeEntity(_0x4971b9,null))[_0x28c4('0x48')](handleError(_0x4971b9,null));}; \ No newline at end of file +var _0x2868=['body','update','find','eml-format','rimraf','zip-dir','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','json','apply','save','destroy','then','error','stack','name','index','map','VoiceQueuesLog','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','findAll','rows','catch','params','includeAll','include','create'];(function(_0xf2628e,_0x521bf7){var _0x13863a=function(_0x2b04ab){while(--_0x2b04ab){_0xf2628e['push'](_0xf2628e['shift']());}};_0x13863a(++_0x521bf7);}(_0x2868,0x1f4));var _0x8286=function(_0x571ced,_0x173559){_0x571ced=_0x571ced-0x0;var _0x5b74be=_0x2868[_0x571ced];return _0x5b74be;};'use strict';var emlformat=require(_0x8286('0x0'));var rimraf=require(_0x8286('0x1'));var zipdir=require(_0x8286('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8286('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8286('0x4'));var util=require('util');var path=require(_0x8286('0x5'));var sox=require(_0x8286('0x6'));var csv=require(_0x8286('0x7'));var ejs=require(_0x8286('0x8'));var fs=require('fs');var fs_extra=require(_0x8286('0x9'));var _=require(_0x8286('0xa'));var squel=require('squel');var crypto=require(_0x8286('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8286('0xc'));var toCsv=require(_0x8286('0x7'));var querystring=require(_0x8286('0xd'));var Papa=require(_0x8286('0xe'));var Redis=require('ioredis');var authService=require(_0x8286('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x8286('0x10'));var hardwareService=require(_0x8286('0x11'));var logger=require(_0x8286('0x12'))(_0x8286('0x13'));var utils=require(_0x8286('0x14'));var config=require(_0x8286('0x15'));var licenseUtil=require(_0x8286('0x16'));var db=require(_0x8286('0x17'))['db'];function respondWithStatusCode(_0x305758,_0x2ac349){_0x2ac349=_0x2ac349||0xcc;return function(_0x373015){if(_0x373015){return _0x305758[_0x8286('0x18')](_0x2ac349);}return _0x305758['status'](_0x2ac349)[_0x8286('0x19')]();};}function respondWithResult(_0x26ad0f,_0x41b862){_0x41b862=_0x41b862||0xc8;return function(_0x39c4b5){if(_0x39c4b5){return _0x26ad0f[_0x8286('0x1a')](_0x41b862)['json'](_0x39c4b5);}};}function respondWithFilteredResult(_0x4e3c6c,_0x51cd1d){return function(_0x179a94){if(_0x179a94){var _0x3a2c0b=typeof _0x51cd1d[_0x8286('0x1b')]==='undefined'&&typeof _0x51cd1d['limit']===_0x8286('0x1c');var _0x3451ce=_0x179a94[_0x8286('0x1d')];var _0x1c51dd=_0x3a2c0b?0x0:_0x51cd1d[_0x8286('0x1b')];var _0x32bea8=_0x3a2c0b?_0x179a94[_0x8286('0x1d')]:_0x51cd1d['offset']+_0x51cd1d[_0x8286('0x1e')];var _0x99a17e;if(_0x32bea8>=_0x3451ce){_0x32bea8=_0x3451ce;_0x99a17e=0xc8;}else{_0x99a17e=0xce;}_0x4e3c6c['status'](_0x99a17e);return _0x4e3c6c['set']('Content-Range',_0x1c51dd+'-'+_0x32bea8+'/'+_0x3451ce)[_0x8286('0x1f')](_0x179a94);}return null;};}function patchUpdates(_0x228ffe){return function(_0x494098){try{jsonpatch[_0x8286('0x20')](_0x494098,_0x228ffe,!![]);}catch(_0x49ec6f){return BPromise['reject'](_0x49ec6f);}return _0x494098[_0x8286('0x21')]();};}function saveUpdates(_0x1ade12,_0x268c66){return function(_0x16bc0d){if(_0x16bc0d){return _0x16bc0d['update'](_0x1ade12)['then'](function(_0x5c5afd){return _0x5c5afd;});}return null;};}function removeEntity(_0x560230,_0x1b0283){return function(_0x50b4c2){if(_0x50b4c2){return _0x50b4c2[_0x8286('0x22')]()[_0x8286('0x23')](function(){_0x560230['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fed95,_0x575289){return function(_0x26f2e5){if(!_0x26f2e5){_0x4fed95[_0x8286('0x18')](0x194);}return _0x26f2e5;};}function handleError(_0x5e05f4,_0x1f0e8c){_0x1f0e8c=_0x1f0e8c||0x1f4;return function(_0x19b5aa){logger[_0x8286('0x24')](_0x19b5aa[_0x8286('0x25')]);if(_0x19b5aa[_0x8286('0x26')]){delete _0x19b5aa[_0x8286('0x26')];}_0x5e05f4[_0x8286('0x1a')](_0x1f0e8c)['send'](_0x19b5aa);};}exports[_0x8286('0x27')]=function(_0x51d701,_0x47bd19){var _0x260136={},_0x29aadd={},_0x519f99={'count':0x0,'rows':[]};var _0x46f8c4=_[_0x8286('0x28')](db[_0x8286('0x29')][_0x8286('0x2a')],function(_0x38777f){return{'name':_0x38777f['fieldName'],'type':_0x38777f[_0x8286('0x2b')]['key']};});_0x29aadd[_0x8286('0x2c')]=_[_0x8286('0x28')](_0x46f8c4,_0x8286('0x26'));_0x29aadd[_0x8286('0x2d')]=_[_0x8286('0x2e')](_0x51d701[_0x8286('0x2d')]);_0x29aadd[_0x8286('0x2f')]=_[_0x8286('0x30')](_0x29aadd[_0x8286('0x2c')],_0x29aadd[_0x8286('0x2d')]);_0x260136['attributes']=_[_0x8286('0x30')](_0x29aadd['model'],qs['fields'](_0x51d701[_0x8286('0x2d')][_0x8286('0x31')]));_0x260136[_0x8286('0x32')]=_0x260136['attributes'][_0x8286('0x33')]?_0x260136[_0x8286('0x32')]:_0x29aadd['model'];if(!_0x51d701[_0x8286('0x2d')]['hasOwnProperty'](_0x8286('0x34'))){_0x260136[_0x8286('0x1e')]=qs['limit'](_0x51d701[_0x8286('0x2d')][_0x8286('0x1e')]);_0x260136[_0x8286('0x1b')]=qs['offset'](_0x51d701['query']['offset']);}_0x260136[_0x8286('0x35')]=qs[_0x8286('0x36')](_0x51d701[_0x8286('0x2d')][_0x8286('0x36')]);_0x260136['where']=qs[_0x8286('0x2f')](_[_0x8286('0x37')](_0x51d701['query'],_0x29aadd[_0x8286('0x2f')]),_0x46f8c4);if(_0x51d701[_0x8286('0x2d')]['filter']){_0x260136['where']=_[_0x8286('0x38')](_0x260136[_0x8286('0x39')],{'$or':_[_0x8286('0x28')](_0x46f8c4,function(_0x41be86){if(_0x41be86['type']!==_0x8286('0x3a')){var _0x3308ff={};_0x3308ff[_0x41be86[_0x8286('0x26')]]={'$like':'%'+_0x51d701['query'][_0x8286('0x3b')]+'%'};return _0x3308ff;}})});}_0x260136=_[_0x8286('0x38')]({},_0x260136,_0x51d701[_0x8286('0x3c')]);var _0xc57e78={'where':_0x260136[_0x8286('0x39')]};return db[_0x8286('0x29')][_0x8286('0x1d')](_0xc57e78)[_0x8286('0x23')](function(_0x56b438){_0x519f99['count']=_0x56b438;if(_0x51d701[_0x8286('0x2d')]['includeAll']){_0x260136['include']=[{'all':!![]}];}return db[_0x8286('0x29')][_0x8286('0x3d')](_0x260136);})['then'](function(_0x40d8fb){_0x519f99[_0x8286('0x3e')]=_0x40d8fb;return _0x519f99;})[_0x8286('0x23')](respondWithFilteredResult(_0x47bd19,_0x260136))[_0x8286('0x3f')](handleError(_0x47bd19,null));};exports['show']=function(_0xc04362,_0x11ac4f){var _0x10aacb={'raw':!![],'where':{'id':_0xc04362[_0x8286('0x40')]['id']}},_0x155b6b={};_0x155b6b[_0x8286('0x2c')]=_[_0x8286('0x2e')](db[_0x8286('0x29')]['rawAttributes']);_0x155b6b['query']=_['keys'](_0xc04362['query']);_0x155b6b[_0x8286('0x2f')]=_[_0x8286('0x30')](_0x155b6b[_0x8286('0x2c')],_0x155b6b[_0x8286('0x2d')]);_0x10aacb[_0x8286('0x32')]=_[_0x8286('0x30')](_0x155b6b[_0x8286('0x2c')],qs[_0x8286('0x31')](_0xc04362[_0x8286('0x2d')]['fields']));_0x10aacb['attributes']=_0x10aacb[_0x8286('0x32')][_0x8286('0x33')]?_0x10aacb[_0x8286('0x32')]:_0x155b6b['model'];if(_0xc04362[_0x8286('0x2d')][_0x8286('0x41')]){_0x10aacb[_0x8286('0x42')]=[{'all':!![]}];}_0x10aacb=_['merge']({},_0x10aacb,_0xc04362['options']);return db[_0x8286('0x29')]['find'](_0x10aacb)[_0x8286('0x23')](handleEntityNotFound(_0x11ac4f,null))[_0x8286('0x23')](respondWithResult(_0x11ac4f,null))[_0x8286('0x3f')](handleError(_0x11ac4f,null));};exports[_0x8286('0x43')]=function(_0x2fbe99,_0x550bc2){return db[_0x8286('0x29')][_0x8286('0x43')](_0x2fbe99[_0x8286('0x44')],{})['then'](respondWithResult(_0x550bc2,0xc9))[_0x8286('0x3f')](handleError(_0x550bc2,null));};exports[_0x8286('0x45')]=function(_0x338973,_0x2b0879){if(_0x338973['body']['id']){delete _0x338973[_0x8286('0x44')]['id'];}return db[_0x8286('0x29')][_0x8286('0x46')]({'where':{'id':_0x338973[_0x8286('0x40')]['id']}})['then'](handleEntityNotFound(_0x2b0879,null))['then'](saveUpdates(_0x338973[_0x8286('0x44')],null))['then'](respondWithResult(_0x2b0879,null))['catch'](handleError(_0x2b0879,null));};exports[_0x8286('0x22')]=function(_0xc9f851,_0x5eb26b){return db[_0x8286('0x29')][_0x8286('0x46')]({'where':{'id':_0xc9f851[_0x8286('0x40')]['id']}})[_0x8286('0x23')](handleEntityNotFound(_0x5eb26b,null))[_0x8286('0x23')](removeEntity(_0x5eb26b,null))[_0x8286('0x3f')](handleError(_0x5eb26b,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 46d4719..880e11d 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 _0x7e65=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api'];(function(_0x952bf,_0x32c6a9){var _0x35fa03=function(_0x6104a4){while(--_0x6104a4){_0x952bf['push'](_0x952bf['shift']());}};_0x35fa03(++_0x32c6a9);}(_0x7e65,0x10a));var _0x57e6=function(_0x545e7c,_0x7cee70){_0x545e7c=_0x545e7c-0x0;var _0x5c9897=_0x7e65[_0x545e7c];return _0x5c9897;};'use strict';var _=require(_0x57e6('0x0'));var util=require(_0x57e6('0x1'));var logger=require(_0x57e6('0x2'))(_0x57e6('0x3'));var moment=require(_0x57e6('0x4'));var BPromise=require(_0x57e6('0x5'));var rp=require(_0x57e6('0x6'));var fs=require('fs');var path=require(_0x57e6('0x7'));var rimraf=require(_0x57e6('0x8'));var config=require(_0x57e6('0x9'));var attributes=require(_0x57e6('0xa'));module[_0x57e6('0xb')]=function(_0x47db6a,_0x5ea0f9){return _0x47db6a[_0x57e6('0xc')](_0x57e6('0xd'),attributes,{'tableName':_0x57e6('0xe'),'paranoid':![],'indexes':[{'name':_0x57e6('0xf'),'fields':[_0x57e6('0x10'),_0x57e6('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0xea20=['define','VoiceQueuesLog','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports'];(function(_0x30182f,_0x30ce41){var _0x5207db=function(_0x50a417){while(--_0x50a417){_0x30182f['push'](_0x30182f['shift']());}};_0x5207db(++_0x30ce41);}(_0xea20,0x198));var _0x0ea2=function(_0x395a44,_0x2750a3){_0x395a44=_0x395a44-0x0;var _0x39be54=_0xea20[_0x395a44];return _0x39be54;};'use strict';var _=require(_0x0ea2('0x0'));var util=require(_0x0ea2('0x1'));var logger=require(_0x0ea2('0x2'))(_0x0ea2('0x3'));var moment=require(_0x0ea2('0x4'));var BPromise=require(_0x0ea2('0x5'));var rp=require(_0x0ea2('0x6'));var fs=require('fs');var path=require(_0x0ea2('0x7'));var rimraf=require(_0x0ea2('0x8'));var config=require(_0x0ea2('0x9'));var attributes=require(_0x0ea2('0xa'));module[_0x0ea2('0xb')]=function(_0x2a321c,_0x642070){return _0x2a321c[_0x0ea2('0xc')](_0x0ea2('0xd'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':'event_dtm','fields':['event','dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index b3895dc..b1f79d1 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 _0x524a=['request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x524a,0xf5));var _0xa524=function(_0x532f9b,_0x57a3eb){_0x532f9b=_0x532f9b-0x0;var _0x1e5cb3=_0x524a[_0x532f9b];return _0x1e5cb3;};'use strict';var _=require(_0xa524('0x0'));var util=require(_0xa524('0x1'));var moment=require(_0xa524('0x2'));var BPromise=require(_0xa524('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa524('0x4'));var db=require(_0xa524('0x5'))['db'];var utils=require(_0xa524('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xa524('0x7'));var jayson=require(_0xa524('0x8'));var client=jayson[_0xa524('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x460738,_0x56bd0e,_0x3a2dd6){return new BPromise(function(_0x11aa98,_0x56849e){return client[_0xa524('0xa')](_0x460738,_0x3a2dd6)[_0xa524('0xb')](function(_0x228ffe){logger[_0xa524('0xc')](_0xa524('0xd'),_0x56bd0e,'request\x20sent');logger[_0xa524('0xe')](_0xa524('0xf'),_0x56bd0e,'request\x20sent',JSON['stringify'](_0x228ffe));if(_0x228ffe[_0xa524('0x10')]){if(_0x228ffe[_0xa524('0x10')][_0xa524('0x11')]===0x1f4){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x56bd0e,_0x228ffe[_0xa524('0x10')]['message']);return _0x56849e(_0x228ffe[_0xa524('0x10')]['message']);}logger[_0xa524('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x56bd0e,_0x228ffe[_0xa524('0x10')][_0xa524('0x12')]);return _0x11aa98(_0x228ffe['error'][_0xa524('0x12')]);}else{logger[_0xa524('0xc')](_0xa524('0xd'),_0x56bd0e,_0xa524('0x13'));_0x11aa98(_0x228ffe[_0xa524('0x14')][_0xa524('0x12')]);}})[_0xa524('0x15')](function(_0x4fc42f){logger[_0xa524('0x10')](_0xa524('0xd'),_0x56bd0e,_0x4fc42f);_0x56849e(_0x4fc42f);});});} \ No newline at end of file +var _0x5fcd=['request','then','info','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x56734f,_0x28c3cf){var _0x34b752=function(_0x5a4e8d){while(--_0x5a4e8d){_0x56734f['push'](_0x56734f['shift']());}};_0x34b752(++_0x28c3cf);}(_0x5fcd,0x189));var _0xd5fc=function(_0x731bfe,_0x3a87b5){_0x731bfe=_0x731bfe-0x0;var _0x56d721=_0x5fcd[_0x731bfe];return _0x56d721;};'use strict';var _=require(_0xd5fc('0x0'));var util=require(_0xd5fc('0x1'));var moment=require('moment');var BPromise=require(_0xd5fc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd5fc('0x3'))['db'];var utils=require(_0xd5fc('0x4'));var logger=require('../../config/logger')(_0xd5fc('0x5'));var config=require(_0xd5fc('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3aee6,_0x57dd12,_0xbc78ec){return new BPromise(function(_0x3b0eac,_0x454b1a){return client[_0xd5fc('0x7')](_0x3aee6,_0xbc78ec)[_0xd5fc('0x8')](function(_0x3be6f0){logger[_0xd5fc('0x9')](_0xd5fc('0xa'),_0x57dd12,'request\x20sent');logger[_0xd5fc('0xb')](_0xd5fc('0xc'),_0x57dd12,_0xd5fc('0xd'),JSON[_0xd5fc('0xe')](_0x3be6f0));if(_0x3be6f0['error']){if(_0x3be6f0['error'][_0xd5fc('0xf')]===0x1f4){logger['error'](_0xd5fc('0xa'),_0x57dd12,_0x3be6f0[_0xd5fc('0x10')][_0xd5fc('0x11')]);return _0x454b1a(_0x3be6f0[_0xd5fc('0x10')][_0xd5fc('0x11')]);}logger[_0xd5fc('0x10')](_0xd5fc('0xa'),_0x57dd12,_0x3be6f0['error'][_0xd5fc('0x11')]);return _0x3b0eac(_0x3be6f0[_0xd5fc('0x10')]['message']);}else{logger[_0xd5fc('0x9')](_0xd5fc('0xa'),_0x57dd12,_0xd5fc('0xd'));_0x3b0eac(_0x3be6f0[_0xd5fc('0x12')][_0xd5fc('0x11')]);}})[_0xd5fc('0x13')](function(_0x4a05fc){logger[_0xd5fc('0x10')](_0xd5fc('0xa'),_0x57dd12,_0x4a05fc);_0x454b1a(_0x4a05fc);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index b83bec4..d0c4214 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 _0x0eb7=['describe','/:id','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x24d1f0,_0x29e0df){var _0xed97da=function(_0x4b0fa1){while(--_0x4b0fa1){_0x24d1f0['push'](_0x24d1f0['shift']());}};_0xed97da(++_0x29e0df);}(_0x0eb7,0x1bf));var _0x70eb=function(_0x9c94fe,_0x350465){_0x9c94fe=_0x9c94fe-0x0;var _0x16ffb3=_0x0eb7[_0x9c94fe];return _0x16ffb3;};'use strict';var multer=require(_0x70eb('0x0'));var util=require(_0x70eb('0x1'));var path=require(_0x70eb('0x2'));var timeout=require(_0x70eb('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x70eb('0x4'));var auth=require(_0x70eb('0x5'));var interaction=require(_0x70eb('0x6'));var config=require(_0x70eb('0x7'));var controller=require('./voiceRecording.controller');router[_0x70eb('0x8')]('/',auth[_0x70eb('0x9')](),controller[_0x70eb('0xa')]);router[_0x70eb('0x8')](_0x70eb('0xb'),auth[_0x70eb('0x9')](),controller[_0x70eb('0xc')]);router[_0x70eb('0x8')](_0x70eb('0xd'),auth[_0x70eb('0x9')](),controller['show']);router[_0x70eb('0x8')](_0x70eb('0xe'),auth['isAuthenticated'](),controller[_0x70eb('0xf')]);router['get'](_0x70eb('0x10'),controller[_0x70eb('0x11')]);router[_0x70eb('0x8')](_0x70eb('0x12'),auth['isAuthenticated'](),controller[_0x70eb('0x13')]);router[_0x70eb('0x14')]('/',auth['isAuthenticated'](),controller[_0x70eb('0x15')]);router[_0x70eb('0x14')](_0x70eb('0x12'),auth[_0x70eb('0x9')](),controller[_0x70eb('0x16')]);router[_0x70eb('0x17')]('/:id',auth[_0x70eb('0x9')](),controller[_0x70eb('0x18')]);router['delete']('/:id',auth[_0x70eb('0x9')](),controller[_0x70eb('0x19')]);module[_0x70eb('0x1a')]=router; \ No newline at end of file +var _0xc154=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','put','delete','exports','multer','path','connect-timeout','express'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xc154,0x1d7));var _0x4c15=function(_0x50d922,_0x1b7787){_0x50d922=_0x50d922-0x0;var _0x56cd45=_0xc154[_0x50d922];return _0x56cd45;};'use strict';var multer=require(_0x4c15('0x0'));var util=require('util');var path=require(_0x4c15('0x1'));var timeout=require(_0x4c15('0x2'));var express=require(_0x4c15('0x3'));var router=express[_0x4c15('0x4')]();var fs_extra=require(_0x4c15('0x5'));var auth=require(_0x4c15('0x6'));var interaction=require(_0x4c15('0x7'));var config=require(_0x4c15('0x8'));var controller=require('./voiceRecording.controller');router['get']('/',auth[_0x4c15('0x9')](),controller['index']);router[_0x4c15('0xa')](_0x4c15('0xb'),auth[_0x4c15('0x9')](),controller['describe']);router[_0x4c15('0xa')](_0x4c15('0xc'),auth[_0x4c15('0x9')](),controller[_0x4c15('0xd')]);router[_0x4c15('0xa')](_0x4c15('0xe'),auth['isAuthenticated'](),controller[_0x4c15('0xf')]);router[_0x4c15('0xa')](_0x4c15('0x10'),controller[_0x4c15('0x11')]);router[_0x4c15('0xa')](_0x4c15('0x12'),auth[_0x4c15('0x9')](),controller[_0x4c15('0x13')]);router[_0x4c15('0x14')]('/',auth['isAuthenticated'](),controller[_0x4c15('0x15')]);router[_0x4c15('0x14')](_0x4c15('0x12'),auth[_0x4c15('0x9')](),controller['runTranscribe']);router[_0x4c15('0x16')](_0x4c15('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x4c15('0x17')](_0x4c15('0xc'),auth[_0x4c15('0x9')](),controller['destroy']);module[_0x4c15('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index fb3dbd1..47eb8a5 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(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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 9b26639..560a9d9 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 _0xe4ea=['jsforce','desk.js','querystring','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','update','then','name','map','VoiceRecording','rawAttributes','fieldName','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','filter','options','count','include','findAll','rows','catch','show','length','find','create','body','params','download','type','uniqueid','value','existsSync','secrets','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','../../components/encryptor','sequelize','MD5','col','$and','push','%s.cypher','decryptFile','recording','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','destroy','listBuckets','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','Location','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','bucket','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','CloudProvider','data2','Cloud\x20Provider\x20not\x20configured','data1','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','writeFile','downloadTranscribe','fileText','root','eml-format','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x3defe3,_0x514f52){var _0x258cb0=function(_0x3a5b2b){while(--_0x3a5b2b){_0x3defe3['push'](_0x3defe3['shift']());}};_0x258cb0(++_0x514f52);}(_0xe4ea,0x11d));var _0xae4e=function(_0x475e6c,_0x57e034){_0x475e6c=_0x475e6c-0x0;var _0x4988bd=_0xe4ea[_0x475e6c];return _0x4988bd;};'use strict';var emlformat=require(_0xae4e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xae4e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xae4e('0x2'));var moment=require(_0xae4e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xae4e('0x4'));var util=require('util');var path=require(_0xae4e('0x5'));var sox=require(_0xae4e('0x6'));var csv=require(_0xae4e('0x7'));var ejs=require(_0xae4e('0x8'));var fs=require('fs');var fs_extra=require(_0xae4e('0x9'));var _=require(_0xae4e('0xa'));var squel=require(_0xae4e('0xb'));var crypto=require(_0xae4e('0xc'));var jsforce=require(_0xae4e('0xd'));var deskjs=require(_0xae4e('0xe'));var toCsv=require(_0xae4e('0x7'));var querystring=require(_0xae4e('0xf'));var Papa=require(_0xae4e('0x10'));var AWS=require('aws-sdk');var uuidv4=require(_0xae4e('0x11'));var Redis=require(_0xae4e('0x12'));var authService=require(_0xae4e('0x13'));var qs=require(_0xae4e('0x14'));var as=require(_0xae4e('0x15'));var hardwareService=require(_0xae4e('0x16'));var logger=require(_0xae4e('0x17'))(_0xae4e('0x18'));var utils=require('../../config/utils');var config=require(_0xae4e('0x19'));var licenseUtil=require(_0xae4e('0x1a'));var db=require(_0xae4e('0x1b'))['db'];function respondWithStatusCode(_0x8bb7aa,_0x406ee8){_0x406ee8=_0x406ee8||0xcc;return function(_0x3a5f4e){if(_0x3a5f4e){return _0x8bb7aa[_0xae4e('0x1c')](_0x406ee8);}return _0x8bb7aa[_0xae4e('0x1d')](_0x406ee8)[_0xae4e('0x1e')]();};}function respondWithResult(_0x117a3d,_0x1cffb5){_0x1cffb5=_0x1cffb5||0xc8;return function(_0x2aa72e){if(_0x2aa72e){return _0x117a3d[_0xae4e('0x1d')](_0x1cffb5)[_0xae4e('0x1f')](_0x2aa72e);}};}function respondWithFilteredResult(_0x4985fa,_0x5da9f9){return function(_0x2ed775){if(_0x2ed775){var _0x1d29f6=typeof _0x5da9f9[_0xae4e('0x20')]===_0xae4e('0x21')&&typeof _0x5da9f9[_0xae4e('0x22')]===_0xae4e('0x21');var _0x7b94d7=_0x2ed775['count'];var _0x13c279=_0x1d29f6?0x0:_0x5da9f9['offset'];var _0x3e64be=_0x1d29f6?_0x2ed775['count']:_0x5da9f9[_0xae4e('0x20')]+_0x5da9f9[_0xae4e('0x22')];var _0x1583f3;if(_0x3e64be>=_0x7b94d7){_0x3e64be=_0x7b94d7;_0x1583f3=0xc8;}else{_0x1583f3=0xce;}_0x4985fa[_0xae4e('0x1d')](_0x1583f3);return _0x4985fa[_0xae4e('0x23')](_0xae4e('0x24'),_0x13c279+'-'+_0x3e64be+'/'+_0x7b94d7)['json'](_0x2ed775);}return null;};}function patchUpdates(_0x348c20){return function(_0x1341e2){try{jsonpatch[_0xae4e('0x25')](_0x1341e2,_0x348c20,!![]);}catch(_0x43f00f){return BPromise[_0xae4e('0x26')](_0x43f00f);}return _0x1341e2['save']();};}function saveUpdates(_0x7f1bd6,_0x3dfd7b){return function(_0x2c5836){if(_0x2c5836){return _0x2c5836[_0xae4e('0x27')](_0x7f1bd6)[_0xae4e('0x28')](function(_0x50ac92){return _0x50ac92;});}return null;};}function removeEntity(_0x29dc9c,_0x265d46){return function(_0x4ac5a2){if(_0x4ac5a2){return _0x4ac5a2['destroy']()['then'](function(){_0x29dc9c[_0xae4e('0x1d')](0xcc)[_0xae4e('0x1e')]();});}};}function handleEntityNotFound(_0x13e462,_0x4777b3){return function(_0x26254d){if(!_0x26254d){_0x13e462[_0xae4e('0x1c')](0x194);}return _0x26254d;};}function handleError(_0x286858,_0x4ddbea){_0x4ddbea=_0x4ddbea||0x1f4;return function(_0x523e1f){logger['error'](_0x523e1f['stack']);if(_0x523e1f[_0xae4e('0x29')]){delete _0x523e1f[_0xae4e('0x29')];}_0x286858[_0xae4e('0x1d')](_0x4ddbea)['send'](_0x523e1f);};}exports['index']=function(_0xb93f39,_0x2e6e53){var _0x2f90c9={},_0x5948b9={},_0x146f53={'count':0x0,'rows':[]};var _0x1e5257=_[_0xae4e('0x2a')](db[_0xae4e('0x2b')][_0xae4e('0x2c')],function(_0x30e37c){return{'name':_0x30e37c[_0xae4e('0x2d')],'type':_0x30e37c['type']['key']};});_0x5948b9[_0xae4e('0x2e')]=_[_0xae4e('0x2f')](_['map'](_0x1e5257,'name'),[_0xae4e('0x30')]);_0x5948b9[_0xae4e('0x31')]=_[_0xae4e('0x32')](_0xb93f39[_0xae4e('0x31')]);_0x5948b9[_0xae4e('0x33')]=_[_0xae4e('0x34')](_0x5948b9['model'],_0x5948b9[_0xae4e('0x31')]);_0x2f90c9[_0xae4e('0x35')]=_[_0xae4e('0x34')](_0x5948b9[_0xae4e('0x2e')],qs[_0xae4e('0x36')](_0xb93f39[_0xae4e('0x31')][_0xae4e('0x36')]));_0x2f90c9[_0xae4e('0x35')]=_0x2f90c9[_0xae4e('0x35')]['length']?_0x2f90c9[_0xae4e('0x35')]:_0x5948b9[_0xae4e('0x2e')];if(!_0xb93f39[_0xae4e('0x31')][_0xae4e('0x37')]('nolimit')){_0x2f90c9[_0xae4e('0x22')]=qs[_0xae4e('0x22')](_0xb93f39['query']['limit']);_0x2f90c9[_0xae4e('0x20')]=qs[_0xae4e('0x20')](_0xb93f39[_0xae4e('0x31')][_0xae4e('0x20')]);}_0x2f90c9[_0xae4e('0x38')]=qs[_0xae4e('0x39')](_0xb93f39[_0xae4e('0x31')][_0xae4e('0x39')]);_0x2f90c9[_0xae4e('0x3a')]=qs[_0xae4e('0x33')](_[_0xae4e('0x3b')](_0xb93f39[_0xae4e('0x31')],_0x5948b9[_0xae4e('0x33')]),_0x1e5257);if(_0xb93f39['query']['filter']){_0x2f90c9[_0xae4e('0x3a')]=_[_0xae4e('0x3c')](_0x2f90c9[_0xae4e('0x3a')],{'$or':_[_0xae4e('0x2a')](_0x1e5257,function(_0x6ff62f){if(_0x6ff62f['type']!=='VIRTUAL'){var _0x11722e={};_0x11722e[_0x6ff62f[_0xae4e('0x29')]]={'$like':'%'+_0xb93f39['query'][_0xae4e('0x3d')]+'%'};return _0x11722e;}})});}_0x2f90c9=_[_0xae4e('0x3c')]({},_0x2f90c9,_0xb93f39[_0xae4e('0x3e')]);var _0x3e49ea={'where':_0x2f90c9[_0xae4e('0x3a')]};return db[_0xae4e('0x2b')]['count'](_0x3e49ea)['then'](function(_0x516bba){_0x146f53[_0xae4e('0x3f')]=_0x516bba;if(_0xb93f39[_0xae4e('0x31')]['includeAll']){_0x2f90c9[_0xae4e('0x40')]=[{'all':!![]}];}return db[_0xae4e('0x2b')][_0xae4e('0x41')](_0x2f90c9);})['then'](function(_0x4caf6e){_0x146f53[_0xae4e('0x42')]=_0x4caf6e;return _0x146f53;})[_0xae4e('0x28')](respondWithFilteredResult(_0x2e6e53,_0x2f90c9))[_0xae4e('0x43')](handleError(_0x2e6e53,null));};exports[_0xae4e('0x44')]=function(_0x86a47d,_0x22180e){var _0x58607c={'raw':![],'where':{'id':_0x86a47d['params']['id']}},_0x27bea6={};_0x27bea6[_0xae4e('0x2e')]=_[_0xae4e('0x32')](db[_0xae4e('0x2b')]['rawAttributes']);_0x27bea6[_0xae4e('0x31')]=_[_0xae4e('0x32')](_0x86a47d[_0xae4e('0x31')]);_0x27bea6[_0xae4e('0x33')]=_['intersection'](_0x27bea6[_0xae4e('0x2e')],_0x27bea6[_0xae4e('0x31')]);_0x58607c['attributes']=_['intersection'](_0x27bea6[_0xae4e('0x2e')],qs[_0xae4e('0x36')](_0x86a47d['query'][_0xae4e('0x36')]));_0x58607c[_0xae4e('0x35')]=_0x58607c[_0xae4e('0x35')][_0xae4e('0x45')]?_0x58607c['attributes']:_0x27bea6[_0xae4e('0x2e')];if(_0x86a47d[_0xae4e('0x31')]['includeAll']){_0x58607c[_0xae4e('0x40')]=[{'all':!![]}];}_0x58607c=_[_0xae4e('0x3c')]({},_0x58607c,_0x86a47d[_0xae4e('0x3e')]);return db[_0xae4e('0x2b')][_0xae4e('0x46')](_0x58607c)[_0xae4e('0x28')](handleEntityNotFound(_0x22180e,null))[_0xae4e('0x28')](respondWithResult(_0x22180e,null))[_0xae4e('0x43')](handleError(_0x22180e,null));};exports[_0xae4e('0x47')]=function(_0x4b40f3,_0x244ac0){return db['VoiceRecording']['create'](_0x4b40f3['body'],{})[_0xae4e('0x28')](respondWithResult(_0x244ac0,0xc9))[_0xae4e('0x43')](handleError(_0x244ac0,null));};exports['update']=function(_0x395895,_0x25d06a){if(_0x395895[_0xae4e('0x48')]['id']){delete _0x395895['body']['id'];}return db[_0xae4e('0x2b')][_0xae4e('0x46')]({'where':{'id':_0x395895[_0xae4e('0x49')]['id']}})['then'](handleEntityNotFound(_0x25d06a,null))[_0xae4e('0x28')](saveUpdates(_0x395895[_0xae4e('0x48')],null))['then'](respondWithResult(_0x25d06a,null))['catch'](handleError(_0x25d06a,null));};exports['describe']=function(_0x1a5a81,_0x5e3e28){return db[_0xae4e('0x2b')]['describe']()[_0xae4e('0x28')](respondWithResult(_0x5e3e28,null))[_0xae4e('0x43')](handleError(_0x5e3e28,null));};exports[_0xae4e('0x4a')]=function(_0x30d1a,_0x4ac684,_0x39982d){var _0x168d36=require('../../components/encryptor');var _0x564c9a=![];var _0x5052b9={};if(_0x30d1a[_0xae4e('0x31')][_0xae4e('0x4b')]&&_0x30d1a[_0xae4e('0x31')]['type']===_0xae4e('0x4c')){_0x5052b9[_0xae4e('0x4c')]=_0x30d1a[_0xae4e('0x49')]['id'];}else{_0x5052b9['id']=_0x30d1a[_0xae4e('0x49')]['id'];}return db['VoiceRecording'][_0xae4e('0x46')]({'where':_0x5052b9,'attributes':['id',_0xae4e('0x4d')],'raw':!![]})[_0xae4e('0x28')](handleEntityNotFound(_0x4ac684,null))[_0xae4e('0x28')](function(_0x46fbc9){if(_0x46fbc9){var _0x499e74=_0x46fbc9[_0xae4e('0x4d')];var _0x22db5f=util['format']('%s.cypher',_0x499e74);if(fs[_0xae4e('0x4e')](_0x22db5f)){_0x564c9a=!![];return _0x168d36['decryptFile'](_0x22db5f,_0x499e74,config[_0xae4e('0x4f')]['recording'])[_0xae4e('0x28')](function(){return _0x46fbc9;});}return _0x46fbc9;}})[_0xae4e('0x28')](function(_0x11c9a){if(_0x11c9a){var _0x5efc31=_0x11c9a[_0xae4e('0x4d')];if(!fs[_0xae4e('0x4e')](_0x5efc31)){throw new db[(_0xae4e('0x50'))][(_0xae4e('0x51'))](_0xae4e('0x52'));}if(_0x11c9a[_0xae4e('0x53')]){return _0x4ac684[_0xae4e('0x4a')](_0x5efc31,_0x11c9a[_0xae4e('0x53')]+path[_0xae4e('0x54')](_0x5efc31),function(){if(_0x564c9a){fs[_0xae4e('0x55')](_0x5efc31);}});}else{return _0x4ac684[_0xae4e('0x4a')](_0x5efc31,function(_0x1460a0){if(_0x564c9a){fs[_0xae4e('0x55')](_0x5efc31);}});}}})[_0xae4e('0x43')](function(_0x6d51e5){if(_0x6d51e5[_0xae4e('0x56')]===_0xae4e('0x52')){_0x4ac684[_0xae4e('0x1d')](0x194)['send'](_0xae4e('0x57'));}else{return handleError(_0x4ac684,null);}});};exports[_0xae4e('0x58')]=function(_0xfb195f,_0x4dbf04,_0x448105){var _0x201e4f=require(_0xae4e('0x59'));var _0x1dab83=![];var _0x4954c2={'$and':[db[_0xae4e('0x5a')][_0xae4e('0x3a')](db[_0xae4e('0x5a')]['fn'](_0xae4e('0x5b'),db[_0xae4e('0x5a')][_0xae4e('0x5c')](_0xae4e('0x4c'))),_0xfb195f[_0xae4e('0x31')]['token'])]};if(_0xfb195f[_0xae4e('0x31')][_0xae4e('0x4b')]&&_0xfb195f['query'][_0xae4e('0x4b')]==='uniqueid'){_0x4954c2[_0xae4e('0x5d')][_0xae4e('0x5e')]({'uniqueid':_0xfb195f[_0xae4e('0x49')]['id']});}else{_0x4954c2[_0xae4e('0x5d')][_0xae4e('0x5e')]({'id':_0xfb195f[_0xae4e('0x49')]['id']});}return db[_0xae4e('0x2b')]['find']({'where':_0x4954c2,'attributes':['id',_0xae4e('0x4d')],'raw':!![]})[_0xae4e('0x28')](handleEntityNotFound(_0x4dbf04,null))['then'](function(_0x20e49e){if(_0x20e49e){var _0x40b098=util[_0xae4e('0x30')](_0xae4e('0x5f'),_0x20e49e[_0xae4e('0x4d')]);if(fs[_0xae4e('0x4e')](_0x40b098)){_0x1dab83=!![];return _0x201e4f[_0xae4e('0x60')](_0x40b098,_0x20e49e[_0xae4e('0x4d')],config['secrets'][_0xae4e('0x61')])[_0xae4e('0x28')](function(){return _0x20e49e;});}return _0x20e49e;}})[_0xae4e('0x28')](function(_0x5c9a9a){if(_0x5c9a9a){if(!fs[_0xae4e('0x4e')](_0x5c9a9a[_0xae4e('0x4d')])){throw new db[(_0xae4e('0x50'))][(_0xae4e('0x51'))](_0xae4e('0x52'));}if(_0x5c9a9a['filename']){return _0x4dbf04[_0xae4e('0x4a')](_0x5c9a9a['value'],_0x5c9a9a[_0xae4e('0x53')]+path[_0xae4e('0x54')](_0x5c9a9a['value']),function(){if(_0x1dab83){fs[_0xae4e('0x55')](_0x5c9a9a[_0xae4e('0x4d')]);}});}else{return _0x4dbf04[_0xae4e('0x4a')](_0x5c9a9a[_0xae4e('0x4d')],function(_0x3ae340){if(_0x1dab83){fs[_0xae4e('0x55')](_0x5c9a9a['value']);}});}}})[_0xae4e('0x43')](handleError(_0x4dbf04,null));};exports['destroy']=function(_0x50f2a0,_0x2d9687){return db['VoiceRecording'][_0xae4e('0x46')]({'where':{'id':_0x50f2a0[_0xae4e('0x49')]['id']}})['then'](function(_0xd2317a){if(_[_0xae4e('0x62')](_0xd2317a)){throw new ReferenceError(_0xae4e('0x63'));}return _0xd2317a;})[_0xae4e('0x28')](function(_0x1b9fac){var _0x5306ba=_0x1b9fac['value'];logger['info'](_0xae4e('0x64'),_0x5306ba);if(!_[_0xae4e('0x62')](_0x1b9fac['value'])&&fs[_0xae4e('0x4e')](_0x5306ba)){logger[_0xae4e('0x65')](_0xae4e('0x66')+_0x5306ba+_0xae4e('0x67'));fs[_0xae4e('0x68')](_0x5306ba);}_0x5306ba=_0x5306ba+'.cypher';if(!_[_0xae4e('0x62')](_0x1b9fac[_0xae4e('0x4d')])&&fs['existsSync'](_0x5306ba)){logger[_0xae4e('0x65')]('File:\x20\x22'+_0x5306ba+_0xae4e('0x67'));fs['unlinkSync'](_0x5306ba);}return _0x1b9fac;})['then'](function(_0x7aadba){if(!_0x7aadba)throw new InternalError();return _0x7aadba[_0xae4e('0x69')]();})[_0xae4e('0x28')](function(){_0x2d9687[_0xae4e('0x1d')](0xcc)[_0xae4e('0x1e')]();})[_0xae4e('0x43')](handleError(_0x2d9687,null));};function getBucketslist(_0x157345,_0x5041e8,_0x92a684){return new Promise(function(_0x952802,_0x32c38e){var _0x13d7e3=new AWS['S3']({'accessKeyId':_0x5041e8,'secretAccessKey':_0x157345,'region':_0x92a684});_0x13d7e3[_0xae4e('0x6a')]({},function(_0x3f2718,_0x15348b){if(_0x3f2718){return _0x32c38e(_0x3f2718);}else{return _0x952802(_0x15348b);}});});}function createBucket(_0x5d35a5,_0x44de8c,_0x23327e,_0x18595b){return new Promise(function(_0x433829,_0x5baa97){var _0x360d04=new AWS['S3']({'accessKeyId':_0x44de8c,'secretAccessKey':_0x5d35a5,'region':_0x23327e});_0x360d04['createBucket']({'Bucket':_0x18595b},function(_0x5aa8c2,_0x5ac0e9){if(_0x5aa8c2){return _0x5baa97(_0x5aa8c2);}else{return _0x433829(_0x5ac0e9);}});});}function uploadFile(_0x5a7d21,_0x1872f7,_0xe9ed70,_0x382275,_0x18182f,_0x1f9508){return new Promise(function(_0x2edad7,_0x310f0c){var _0x29ce08=new AWS['S3']({'accessKeyId':_0x1872f7,'secretAccessKey':_0x5a7d21,'region':_0xe9ed70});_0x29ce08[_0xae4e('0x6b')]({'Bucket':_0x382275,'Key':_0x18182f,'Body':_0x1f9508},function(_0xbb5dd7,_0x5656b1){if(_0xbb5dd7){return _0x310f0c(_0xbb5dd7);}else{return _0x2edad7(_0x5656b1);}});});}function startTranscribe(_0x191302,_0x399cab,_0x5e62fa,_0x50705a,_0xf6fb2c,_0x2303a7){return new Promise(function(_0x23bea4,_0x4d0d4b){var _0x478508=new AWS[(_0xae4e('0x6c'))]({'accessKeyId':_0x399cab,'secretAccessKey':_0x191302,'region':_0x5e62fa});_0x478508[_0xae4e('0x6d')]({'TranscriptionJobName':_0x50705a,'LanguageCode':_0xf6fb2c,'Media':{'MediaFileUri':_0x2303a7}},function(_0x3dd828,_0x2b774d){if(_0x3dd828){return _0x4d0d4b(_0x3dd828);}else{return _0x23bea4(_0x2b774d);}});});}function transcribe(_0x260698,_0xf30f50,_0x3dd6c7,_0x439a5e,_0x401160,_0x2abd9d,_0x28027d){return new Promise(function(_0x2a6f55,_0x2a1081){var _0x443e1c={};logger[_0xae4e('0x65')](util['format'](_0xae4e('0x6e'),_0x260698,_0x401160));return uploadFile(_0xf30f50,_0x3dd6c7,_0x439a5e,_0x401160,path['basename'](_0x2abd9d),fs[_0xae4e('0x6f')](_0x2abd9d))[_0xae4e('0x28')](function(_0x1b06e6){logger[_0xae4e('0x65')](util['format']('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x260698,_0x401160,_0x1b06e6[_0xae4e('0x70')]));_0x443e1c['bucket']=_0x1b06e6[_0xae4e('0x71')];_0x443e1c['location']=_0x1b06e6[_0xae4e('0x70')];logger[_0xae4e('0x65')](util['format'](_0xae4e('0x72'),_0x260698));return startTranscribe(_0xf30f50,_0x3dd6c7,_0x439a5e,uuidv4(),_0x28027d,_0x1b06e6['Location']);})[_0xae4e('0x28')](function(_0x184294){logger[_0xae4e('0x65')](util['format'](_0xae4e('0x73'),_0x260698,_0x184294[_0xae4e('0x74')][_0xae4e('0x75')]));_0x443e1c['transcribeName']=_0x184294[_0xae4e('0x74')][_0xae4e('0x75')];_0x443e1c[_0xae4e('0x76')]=_0x184294[_0xae4e('0x74')][_0xae4e('0x77')];return _0x2a6f55(_0x443e1c);})[_0xae4e('0x43')](function(_0x52e832){return _0x2a1081(_0x52e832);});});}exports[_0xae4e('0x78')]=function(_0x2b4627,_0x3917bd,_0x39f803){var _0x30b567;var _0x1d641a;var _0x11f80d;var _0x240b63=require('../../components/encryptor');return db['VoiceRecording'][_0xae4e('0x79')]({'where':{'id':_0x2b4627[_0xae4e('0x49')]['id']}})['then'](function(_0x71a92){if(_0x71a92){var _0x2cfb79=util[_0xae4e('0x30')]('%s.cypher',_0x71a92[_0xae4e('0x4d')]);if(fs[_0xae4e('0x4e')](_0x2cfb79)){cypher=!![];return _0x240b63[_0xae4e('0x60')](_0x2cfb79,_0x71a92[_0xae4e('0x4d')],config[_0xae4e('0x4f')][_0xae4e('0x61')])[_0xae4e('0x28')](function(){return _0x71a92;});}return _0x71a92;}})[_0xae4e('0x28')](function(_0x532d2f){if(!_0x532d2f){throw new db[(_0xae4e('0x50'))][(_0xae4e('0x51'))](_0xae4e('0x7a'));}_0x1d641a=_0x532d2f;return db[_0xae4e('0x7b')][_0xae4e('0x79')]({'where':{'id':0x1}});})[_0xae4e('0x28')](handleEntityNotFound(_0x3917bd,null))[_0xae4e('0x28')](function(_0x4ff35b){if(_0x4ff35b){_0x30b567=_0x4ff35b;if(!_0x30b567[_0xae4e('0x7c')]||!_0x30b567[_0xae4e('0x7d')]||!_0x30b567[_0xae4e('0x7e')]||!_0x30b567[_0xae4e('0x7f')]||!_0x30b567[_0xae4e('0x80')]){throw new db['Sequelize'][(_0xae4e('0x51'))](_0xae4e('0x81'));}if(_0x2b4627[_0xae4e('0x48')][_0xae4e('0x82')]&&(!_0x30b567[_0xae4e('0x83')]||!_0x30b567[_0xae4e('0x84')]||!_0x30b567['sentimentRegion']||!_0x30b567['language']||!_0x30b567[_0xae4e('0x80')])){throw new db[(_0xae4e('0x50'))][(_0xae4e('0x51'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0xae4e('0x85')][_0xae4e('0x79')]({'where':{'id':_0x30b567['transcribeAccountId']}});}})[_0xae4e('0x28')](function(_0x4576a8){if(!_0x4576a8){throw new db[(_0xae4e('0x50'))][(_0xae4e('0x51'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x4576a8['data1']||!_0x4576a8[_0xae4e('0x86')]){throw new db[(_0xae4e('0x50'))]['ValidationError'](_0xae4e('0x87'));}_0x11f80d=_0x4576a8;return getBucketslist(_0x11f80d[_0xae4e('0x88')],_0x11f80d[_0xae4e('0x86')],_0x30b567[_0xae4e('0x7e')]);})[_0xae4e('0x28')](function(_0x27a3ff){if(_0x27a3ff&&_0x27a3ff[_0xae4e('0x89')]){var _0x122cce=_[_0xae4e('0x46')](_0x27a3ff['Buckets'],function(_0x54053a){return _0x54053a[_0xae4e('0x8a')]===_0x30b567[_0xae4e('0x80')];});if(!_0x122cce){logger['info'](util[_0xae4e('0x30')](_0xae4e('0x8b'),_0x2b4627[_0xae4e('0x49')]['id'],_0x30b567[_0xae4e('0x80')]));return createBucket(_0x11f80d[_0xae4e('0x88')],_0x11f80d[_0xae4e('0x86')],_0x30b567[_0xae4e('0x7e')],_0x30b567[_0xae4e('0x80')]);}logger['info'](util['format'](_0xae4e('0x8c'),_0x2b4627[_0xae4e('0x49')]['id'],_0x30b567[_0xae4e('0x80')]));return;}})[_0xae4e('0x28')](function(_0x58871e){if(_0x1d641a[_0xae4e('0x76')]===_0xae4e('0x8d')){return transcribe(_0x2b4627[_0xae4e('0x49')]['id'],_0x11f80d['data1'],_0x11f80d['data2'],_0x30b567[_0xae4e('0x7e')],_0x30b567[_0xae4e('0x80')],_0x1d641a['value'],_0x30b567[_0xae4e('0x7f')]);}else{logger[_0xae4e('0x65')](util[_0xae4e('0x30')](_0xae4e('0x8e'),_0x2b4627['params']['id']));return{'transcribeStatus':_0xae4e('0x8f')};}})[_0xae4e('0x28')](function(_0xf27395){if(_0xf27395){_0xf27395['tempSentiment']=_0x2b4627['body'][_0xae4e('0x82')];return _0x1d641a[_0xae4e('0x90')](_0xf27395);}})['then'](respondWithResult(_0x3917bd,null))[_0xae4e('0x43')](handleError(_0x3917bd,null));};function writeFile(_0x246170,_0xb56567){return new Promise(function(_0x231efe,_0x5451a1){fs[_0xae4e('0x91')](_0xb56567,_0x246170,function(_0xdf55a2,_0x4ce69c){if(_0xdf55a2){return _0x5451a1(_0xdf55a2);}else{return _0x231efe(_0x4ce69c);}});});}exports[_0xae4e('0x92')]=function(_0x4f75f3,_0x52a7ce,_0x297da5){return db['VoiceRecording'][_0xae4e('0x79')]({'where':{'id':_0x4f75f3[_0xae4e('0x49')]['id']}})[_0xae4e('0x28')](handleEntityNotFound(_0x52a7ce))['then'](function(_0x8741c2){if(_0x8741c2&&_0x8741c2[_0xae4e('0x93')]){var _0x202e57=_0x8741c2['fileText'];var _0x384711=config[_0xae4e('0x94')]+'/server/files/transcribes/transcribe_'+_0x8741c2['id']+'.txt';if(fs[_0xae4e('0x4e')](_0x384711)){return _0x384711;}return writeFile(_0x202e57,_0x384711)['then'](function(){return _0x384711;});}else{throw new db[(_0xae4e('0x50'))]['ValidationError']('Transcript\x20not\x20available');}})['then'](function(_0x37f4fd){return _0x52a7ce[_0xae4e('0x4a')](_0x37f4fd);})['catch'](handleError(_0x52a7ce));}; \ No newline at end of file +var _0x0872=['fieldName','key','model','differenceBy','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','VoiceRecording','includeAll','include','findAll','rows','catch','keys','find','create','body','params','describe','download','../../components/encryptor','existsSync','decryptFile','recording','value','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','Not\x20found','downloads','sequelize','MD5','col','token','uniqueid','push','format','secrets','extname','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','File:\x20\x22','upload','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','%s.cypher','Sequelize','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','runSentiment','sentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20configured','data1','data2','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','eml-format','rimraf','zip-dir','fast-json-patch','mustache','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','end','error','name','send','map','rawAttributes'];(function(_0x92a712,_0x3733ca){var _0x9774da=function(_0xa64e26){while(--_0xa64e26){_0x92a712['push'](_0x92a712['shift']());}};_0x9774da(++_0x3733ca);}(_0x0872,0x6b));var _0x2087=function(_0xf16f9a,_0x261d58){_0xf16f9a=_0xf16f9a-0x0;var _0x13ddea=_0x0872[_0xf16f9a];return _0x13ddea;};'use strict';var emlformat=require(_0x2087('0x0'));var rimraf=require(_0x2087('0x1'));var zipdir=require(_0x2087('0x2'));var jsonpatch=require(_0x2087('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2087('0x4'));var util=require('util');var path=require(_0x2087('0x5'));var sox=require(_0x2087('0x6'));var csv=require('to-csv');var ejs=require(_0x2087('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2087('0x8'));var jsforce=require(_0x2087('0x9'));var deskjs=require(_0x2087('0xa'));var toCsv=require(_0x2087('0xb'));var querystring=require(_0x2087('0xc'));var Papa=require(_0x2087('0xd'));var AWS=require(_0x2087('0xe'));var uuidv4=require(_0x2087('0xf'));var Redis=require(_0x2087('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2087('0x11'));var as=require(_0x2087('0x12'));var hardwareService=require(_0x2087('0x13'));var logger=require(_0x2087('0x14'))(_0x2087('0x15'));var utils=require(_0x2087('0x16'));var config=require(_0x2087('0x17'));var licenseUtil=require(_0x2087('0x18'));var db=require(_0x2087('0x19'))['db'];function respondWithStatusCode(_0x2a78f0,_0x2853ce){_0x2853ce=_0x2853ce||0xcc;return function(_0x1b871f){if(_0x1b871f){return _0x2a78f0[_0x2087('0x1a')](_0x2853ce);}return _0x2a78f0[_0x2087('0x1b')](_0x2853ce)['end']();};}function respondWithResult(_0x5536fd,_0x1c01de){_0x1c01de=_0x1c01de||0xc8;return function(_0x4fc8f9){if(_0x4fc8f9){return _0x5536fd['status'](_0x1c01de)[_0x2087('0x1c')](_0x4fc8f9);}};}function respondWithFilteredResult(_0x388801,_0x3bcbeb){return function(_0x324142){if(_0x324142){var _0x15690d=typeof _0x3bcbeb[_0x2087('0x1d')]==='undefined'&&typeof _0x3bcbeb['limit']===_0x2087('0x1e');var _0xd5ff35=_0x324142[_0x2087('0x1f')];var _0x46ebab=_0x15690d?0x0:_0x3bcbeb[_0x2087('0x1d')];var _0x382ca0=_0x15690d?_0x324142[_0x2087('0x1f')]:_0x3bcbeb[_0x2087('0x1d')]+_0x3bcbeb[_0x2087('0x20')];var _0x29e832;if(_0x382ca0>=_0xd5ff35){_0x382ca0=_0xd5ff35;_0x29e832=0xc8;}else{_0x29e832=0xce;}_0x388801[_0x2087('0x1b')](_0x29e832);return _0x388801[_0x2087('0x21')]('Content-Range',_0x46ebab+'-'+_0x382ca0+'/'+_0xd5ff35)['json'](_0x324142);}return null;};}function patchUpdates(_0x49c536){return function(_0x59ff1c){try{jsonpatch[_0x2087('0x22')](_0x59ff1c,_0x49c536,!![]);}catch(_0x2f40c2){return BPromise[_0x2087('0x23')](_0x2f40c2);}return _0x59ff1c[_0x2087('0x24')]();};}function saveUpdates(_0x23fae9,_0x43ae4d){return function(_0x8d4839){if(_0x8d4839){return _0x8d4839[_0x2087('0x25')](_0x23fae9)[_0x2087('0x26')](function(_0x2e19e6){return _0x2e19e6;});}return null;};}function removeEntity(_0x32da3a,_0x1fcc19){return function(_0x31cb81){if(_0x31cb81){return _0x31cb81[_0x2087('0x27')]()[_0x2087('0x26')](function(){_0x32da3a[_0x2087('0x1b')](0xcc)[_0x2087('0x28')]();});}};}function handleEntityNotFound(_0x5b8bdf,_0x4153cb){return function(_0x5db0af){if(!_0x5db0af){_0x5b8bdf['sendStatus'](0x194);}return _0x5db0af;};}function handleError(_0xc74ad9,_0x5064be){_0x5064be=_0x5064be||0x1f4;return function(_0x4e3258){logger[_0x2087('0x29')](_0x4e3258['stack']);if(_0x4e3258[_0x2087('0x2a')]){delete _0x4e3258[_0x2087('0x2a')];}_0xc74ad9[_0x2087('0x1b')](_0x5064be)[_0x2087('0x2b')](_0x4e3258);};}exports['index']=function(_0x243ecb,_0x154118){var _0x5bea78={},_0x41a873={},_0x4988bd={'count':0x0,'rows':[]};var _0x438272=_[_0x2087('0x2c')](db['VoiceRecording'][_0x2087('0x2d')],function(_0x3dc2cc){return{'name':_0x3dc2cc[_0x2087('0x2e')],'type':_0x3dc2cc['type'][_0x2087('0x2f')]};});_0x41a873[_0x2087('0x30')]=_[_0x2087('0x31')](_[_0x2087('0x2c')](_0x438272,_0x2087('0x2a')),['format']);_0x41a873[_0x2087('0x32')]=_['keys'](_0x243ecb[_0x2087('0x32')]);_0x41a873[_0x2087('0x33')]=_[_0x2087('0x34')](_0x41a873[_0x2087('0x30')],_0x41a873[_0x2087('0x32')]);_0x5bea78[_0x2087('0x35')]=_[_0x2087('0x34')](_0x41a873[_0x2087('0x30')],qs[_0x2087('0x36')](_0x243ecb['query']['fields']));_0x5bea78[_0x2087('0x35')]=_0x5bea78[_0x2087('0x35')]['length']?_0x5bea78['attributes']:_0x41a873[_0x2087('0x30')];if(!_0x243ecb[_0x2087('0x32')][_0x2087('0x37')](_0x2087('0x38'))){_0x5bea78[_0x2087('0x20')]=qs['limit'](_0x243ecb[_0x2087('0x32')][_0x2087('0x20')]);_0x5bea78[_0x2087('0x1d')]=qs[_0x2087('0x1d')](_0x243ecb[_0x2087('0x32')][_0x2087('0x1d')]);}_0x5bea78[_0x2087('0x39')]=qs[_0x2087('0x3a')](_0x243ecb[_0x2087('0x32')]['sort']);_0x5bea78['where']=qs['filters'](_[_0x2087('0x3b')](_0x243ecb[_0x2087('0x32')],_0x41a873[_0x2087('0x33')]),_0x438272);if(_0x243ecb['query'][_0x2087('0x3c')]){_0x5bea78[_0x2087('0x3d')]=_[_0x2087('0x3e')](_0x5bea78['where'],{'$or':_['map'](_0x438272,function(_0x20a18a){if(_0x20a18a[_0x2087('0x3f')]!==_0x2087('0x40')){var _0x4ef1c0={};_0x4ef1c0[_0x20a18a[_0x2087('0x2a')]]={'$like':'%'+_0x243ecb[_0x2087('0x32')]['filter']+'%'};return _0x4ef1c0;}})});}_0x5bea78=_[_0x2087('0x3e')]({},_0x5bea78,_0x243ecb[_0x2087('0x41')]);var _0x32f9f6={'where':_0x5bea78['where']};return db[_0x2087('0x42')][_0x2087('0x1f')](_0x32f9f6)[_0x2087('0x26')](function(_0x253844){_0x4988bd[_0x2087('0x1f')]=_0x253844;if(_0x243ecb[_0x2087('0x32')][_0x2087('0x43')]){_0x5bea78[_0x2087('0x44')]=[{'all':!![]}];}return db[_0x2087('0x42')][_0x2087('0x45')](_0x5bea78);})['then'](function(_0xf450bd){_0x4988bd[_0x2087('0x46')]=_0xf450bd;return _0x4988bd;})['then'](respondWithFilteredResult(_0x154118,_0x5bea78))[_0x2087('0x47')](handleError(_0x154118,null));};exports['show']=function(_0x47fe54,_0x4bd0c4){var _0x41e870={'raw':![],'where':{'id':_0x47fe54['params']['id']}},_0xdc1721={};_0xdc1721[_0x2087('0x30')]=_[_0x2087('0x48')](db['VoiceRecording'][_0x2087('0x2d')]);_0xdc1721[_0x2087('0x32')]=_[_0x2087('0x48')](_0x47fe54['query']);_0xdc1721[_0x2087('0x33')]=_[_0x2087('0x34')](_0xdc1721['model'],_0xdc1721[_0x2087('0x32')]);_0x41e870[_0x2087('0x35')]=_[_0x2087('0x34')](_0xdc1721[_0x2087('0x30')],qs['fields'](_0x47fe54['query'][_0x2087('0x36')]));_0x41e870[_0x2087('0x35')]=_0x41e870[_0x2087('0x35')]['length']?_0x41e870[_0x2087('0x35')]:_0xdc1721[_0x2087('0x30')];if(_0x47fe54[_0x2087('0x32')][_0x2087('0x43')]){_0x41e870[_0x2087('0x44')]=[{'all':!![]}];}_0x41e870=_[_0x2087('0x3e')]({},_0x41e870,_0x47fe54['options']);return db[_0x2087('0x42')][_0x2087('0x49')](_0x41e870)['then'](handleEntityNotFound(_0x4bd0c4,null))[_0x2087('0x26')](respondWithResult(_0x4bd0c4,null))[_0x2087('0x47')](handleError(_0x4bd0c4,null));};exports[_0x2087('0x4a')]=function(_0x521edc,_0x5d1e30){return db['VoiceRecording'][_0x2087('0x4a')](_0x521edc[_0x2087('0x4b')],{})[_0x2087('0x26')](respondWithResult(_0x5d1e30,0xc9))[_0x2087('0x47')](handleError(_0x5d1e30,null));};exports[_0x2087('0x25')]=function(_0x43ba5d,_0x465337){if(_0x43ba5d[_0x2087('0x4b')]['id']){delete _0x43ba5d['body']['id'];}return db[_0x2087('0x42')]['find']({'where':{'id':_0x43ba5d[_0x2087('0x4c')]['id']}})[_0x2087('0x26')](handleEntityNotFound(_0x465337,null))[_0x2087('0x26')](saveUpdates(_0x43ba5d['body'],null))[_0x2087('0x26')](respondWithResult(_0x465337,null))['catch'](handleError(_0x465337,null));};exports[_0x2087('0x4d')]=function(_0x4cc9aa,_0x56acf1){return db['VoiceRecording'][_0x2087('0x4d')]()[_0x2087('0x26')](respondWithResult(_0x56acf1,null))['catch'](handleError(_0x56acf1,null));};exports[_0x2087('0x4e')]=function(_0x62e7d5,_0x1b9c5c,_0x54e18a){var _0x1d48e3=require(_0x2087('0x4f'));var _0x36cbae=![];var _0x1f1b6f={};if(_0x62e7d5[_0x2087('0x32')][_0x2087('0x3f')]&&_0x62e7d5[_0x2087('0x32')]['type']==='uniqueid'){_0x1f1b6f['uniqueid']=_0x62e7d5[_0x2087('0x4c')]['id'];}else{_0x1f1b6f['id']=_0x62e7d5[_0x2087('0x4c')]['id'];}return db[_0x2087('0x42')][_0x2087('0x49')]({'where':_0x1f1b6f,'attributes':['id','value'],'raw':!![]})[_0x2087('0x26')](handleEntityNotFound(_0x1b9c5c,null))[_0x2087('0x26')](function(_0x37d492){if(_0x37d492){var _0x1270fa=_0x37d492['value'];var _0x569e0c=util['format']('%s.cypher',_0x1270fa);if(fs[_0x2087('0x50')](_0x569e0c)){_0x36cbae=!![];return _0x1d48e3[_0x2087('0x51')](_0x569e0c,_0x1270fa,config['secrets'][_0x2087('0x52')])[_0x2087('0x26')](function(){return _0x37d492;});}return _0x37d492;}})['then'](function(_0x4488cb){if(_0x4488cb){var _0x22ae3d=_0x4488cb[_0x2087('0x53')];if(!fs[_0x2087('0x50')](_0x22ae3d)){throw new db['Sequelize'][(_0x2087('0x54'))](_0x2087('0x55'));}if(_0x4488cb[_0x2087('0x56')]){return _0x1b9c5c[_0x2087('0x4e')](_0x22ae3d,_0x4488cb[_0x2087('0x56')]+path['extname'](_0x22ae3d),function(){if(_0x36cbae){fs['unlink'](_0x22ae3d);}});}else{return _0x1b9c5c[_0x2087('0x4e')](_0x22ae3d,function(_0x8e0613){if(_0x36cbae){fs[_0x2087('0x57')](_0x22ae3d);}});}}})[_0x2087('0x47')](function(_0x51b9b9){if(_0x51b9b9['message']==='VoiceRecording\x20not\x20found'){_0x1b9c5c[_0x2087('0x1b')](0x194)[_0x2087('0x2b')](_0x2087('0x58'));}else{return handleError(_0x1b9c5c,null);}});};exports[_0x2087('0x59')]=function(_0x42de35,_0x285494,_0x24a558){var _0x17a7b3=require('../../components/encryptor');var _0x3b4ccd=![];var _0x30922d={'$and':[db[_0x2087('0x5a')][_0x2087('0x3d')](db['sequelize']['fn'](_0x2087('0x5b'),db[_0x2087('0x5a')][_0x2087('0x5c')]('uniqueid')),_0x42de35[_0x2087('0x32')][_0x2087('0x5d')])]};if(_0x42de35['query'][_0x2087('0x3f')]&&_0x42de35['query']['type']===_0x2087('0x5e')){_0x30922d['$and'][_0x2087('0x5f')]({'uniqueid':_0x42de35[_0x2087('0x4c')]['id']});}else{_0x30922d['$and'][_0x2087('0x5f')]({'id':_0x42de35['params']['id']});}return db[_0x2087('0x42')]['find']({'where':_0x30922d,'attributes':['id',_0x2087('0x53')],'raw':!![]})[_0x2087('0x26')](handleEntityNotFound(_0x285494,null))['then'](function(_0x479029){if(_0x479029){var _0xf330f0=util[_0x2087('0x60')]('%s.cypher',_0x479029[_0x2087('0x53')]);if(fs['existsSync'](_0xf330f0)){_0x3b4ccd=!![];return _0x17a7b3[_0x2087('0x51')](_0xf330f0,_0x479029['value'],config[_0x2087('0x61')][_0x2087('0x52')])[_0x2087('0x26')](function(){return _0x479029;});}return _0x479029;}})[_0x2087('0x26')](function(_0x5dc0f0){if(_0x5dc0f0){if(!fs['existsSync'](_0x5dc0f0[_0x2087('0x53')])){throw new db['Sequelize'][(_0x2087('0x54'))](_0x2087('0x55'));}if(_0x5dc0f0['filename']){return _0x285494[_0x2087('0x4e')](_0x5dc0f0[_0x2087('0x53')],_0x5dc0f0['filename']+path[_0x2087('0x62')](_0x5dc0f0[_0x2087('0x53')]),function(){if(_0x3b4ccd){fs[_0x2087('0x57')](_0x5dc0f0['value']);}});}else{return _0x285494[_0x2087('0x4e')](_0x5dc0f0['value'],function(_0x433592){if(_0x3b4ccd){fs[_0x2087('0x57')](_0x5dc0f0[_0x2087('0x53')]);}});}}})[_0x2087('0x47')](handleError(_0x285494,null));};exports[_0x2087('0x27')]=function(_0x496a76,_0x5f41fb){return db[_0x2087('0x42')][_0x2087('0x49')]({'where':{'id':_0x496a76[_0x2087('0x4c')]['id']}})['then'](function(_0x2e1c1d){if(_[_0x2087('0x63')](_0x2e1c1d)){throw new ReferenceError(_0x2087('0x64'));}return _0x2e1c1d;})['then'](function(_0x2438d9){var _0x2785c6=_0x2438d9[_0x2087('0x53')];logger[_0x2087('0x65')](_0x2087('0x66'),_0x2785c6);if(!_[_0x2087('0x63')](_0x2438d9[_0x2087('0x53')])&&fs[_0x2087('0x50')](_0x2785c6)){logger[_0x2087('0x65')]('File:\x20\x22'+_0x2785c6+_0x2087('0x67'));fs[_0x2087('0x68')](_0x2785c6);}_0x2785c6=_0x2785c6+'.cypher';if(!_[_0x2087('0x63')](_0x2438d9[_0x2087('0x53')])&&fs[_0x2087('0x50')](_0x2785c6)){logger['info'](_0x2087('0x69')+_0x2785c6+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x2087('0x68')](_0x2785c6);}return _0x2438d9;})['then'](function(_0x406393){if(!_0x406393)throw new InternalError();return _0x406393['destroy']();})[_0x2087('0x26')](function(){_0x5f41fb[_0x2087('0x1b')](0xcc)[_0x2087('0x28')]();})[_0x2087('0x47')](handleError(_0x5f41fb,null));};function getBucketslist(_0x285e30,_0x404c99,_0xb85264){return new Promise(function(_0x20825c,_0x5e35a9){var _0x16eeac=new AWS['S3']({'accessKeyId':_0x404c99,'secretAccessKey':_0x285e30,'region':_0xb85264});_0x16eeac['listBuckets']({},function(_0x48488b,_0xb9f931){if(_0x48488b){return _0x5e35a9(_0x48488b);}else{return _0x20825c(_0xb9f931);}});});}function createBucket(_0xb0e97e,_0x1a2521,_0x7a198e,_0x57340a){return new Promise(function(_0x3845e3,_0x3a0dac){var _0x30f36d=new AWS['S3']({'accessKeyId':_0x1a2521,'secretAccessKey':_0xb0e97e,'region':_0x7a198e});_0x30f36d['createBucket']({'Bucket':_0x57340a},function(_0x250619,_0x11b481){if(_0x250619){return _0x3a0dac(_0x250619);}else{return _0x3845e3(_0x11b481);}});});}function uploadFile(_0x3cacbc,_0x44fb4c,_0x2d1e34,_0x5afee9,_0x380812,_0x2c5591){return new Promise(function(_0x4e7489,_0x267f5a){var _0x1e2e6e=new AWS['S3']({'accessKeyId':_0x44fb4c,'secretAccessKey':_0x3cacbc,'region':_0x2d1e34});_0x1e2e6e[_0x2087('0x6a')]({'Bucket':_0x5afee9,'Key':_0x380812,'Body':_0x2c5591},function(_0x489c1a,_0x577e3e){if(_0x489c1a){return _0x267f5a(_0x489c1a);}else{return _0x4e7489(_0x577e3e);}});});}function startTranscribe(_0x5aa510,_0x2f31d4,_0x1c7555,_0x381c27,_0x1055bf,_0x59a4e1){return new Promise(function(_0x5df9c,_0x5f5d38){var _0x56d9aa=new AWS['TranscribeService']({'accessKeyId':_0x2f31d4,'secretAccessKey':_0x5aa510,'region':_0x1c7555});_0x56d9aa['startTranscriptionJob']({'TranscriptionJobName':_0x381c27,'LanguageCode':_0x1055bf,'Media':{'MediaFileUri':_0x59a4e1}},function(_0x4686d4,_0x3fd52d){if(_0x4686d4){return _0x5f5d38(_0x4686d4);}else{return _0x5df9c(_0x3fd52d);}});});}function transcribe(_0x20210d,_0x34c324,_0x43bbdb,_0x23274a,_0x1ecce5,_0x128da5,_0x47fa84){return new Promise(function(_0x22af0a,_0x374601){var _0x3243d3={};logger['info'](util[_0x2087('0x60')](_0x2087('0x6b'),_0x20210d,_0x1ecce5));return uploadFile(_0x34c324,_0x43bbdb,_0x23274a,_0x1ecce5,path['basename'](_0x128da5),fs[_0x2087('0x6c')](_0x128da5))[_0x2087('0x26')](function(_0x480da4){logger[_0x2087('0x65')](util[_0x2087('0x60')](_0x2087('0x6d'),_0x20210d,_0x1ecce5,_0x480da4[_0x2087('0x6e')]));_0x3243d3[_0x2087('0x6f')]=_0x480da4[_0x2087('0x70')];_0x3243d3[_0x2087('0x71')]=_0x480da4[_0x2087('0x6e')];logger[_0x2087('0x65')](util['format'](_0x2087('0x72'),_0x20210d));return startTranscribe(_0x34c324,_0x43bbdb,_0x23274a,uuidv4(),_0x47fa84,_0x480da4[_0x2087('0x6e')]);})[_0x2087('0x26')](function(_0x51fb75){logger[_0x2087('0x65')](util['format'](_0x2087('0x73'),_0x20210d,_0x51fb75[_0x2087('0x74')][_0x2087('0x75')]));_0x3243d3[_0x2087('0x76')]=_0x51fb75[_0x2087('0x74')][_0x2087('0x75')];_0x3243d3[_0x2087('0x77')]=_0x51fb75[_0x2087('0x74')][_0x2087('0x78')];return _0x22af0a(_0x3243d3);})['catch'](function(_0x532b3e){return _0x374601(_0x532b3e);});});}exports[_0x2087('0x79')]=function(_0x274eab,_0x53d1e6,_0x9253af){var _0x45688e;var _0x248b92;var _0x28b184;var _0x6e8677=require('../../components/encryptor');return db['VoiceRecording'][_0x2087('0x7a')]({'where':{'id':_0x274eab[_0x2087('0x4c')]['id']}})['then'](function(_0x5bd64e){if(_0x5bd64e){var _0x415db4=util[_0x2087('0x60')](_0x2087('0x7b'),_0x5bd64e[_0x2087('0x53')]);if(fs[_0x2087('0x50')](_0x415db4)){cypher=!![];return _0x6e8677['decryptFile'](_0x415db4,_0x5bd64e['value'],config[_0x2087('0x61')][_0x2087('0x52')])['then'](function(){return _0x5bd64e;});}return _0x5bd64e;}})['then'](function(_0x31170d){if(!_0x31170d){throw new db[(_0x2087('0x7c'))][(_0x2087('0x54'))](_0x2087('0x7d'));}_0x248b92=_0x31170d;return db[_0x2087('0x7e')][_0x2087('0x7a')]({'where':{'id':0x1}});})[_0x2087('0x26')](handleEntityNotFound(_0x53d1e6,null))[_0x2087('0x26')](function(_0x5667f3){if(_0x5667f3){_0x45688e=_0x5667f3;if(!_0x45688e['transcribe']||!_0x45688e[_0x2087('0x7f')]||!_0x45688e['transcribeRegion']||!_0x45688e['language']||!_0x45688e[_0x2087('0x6f')]){throw new db[(_0x2087('0x7c'))][(_0x2087('0x54'))]('Transcribe\x20not\x20configured');}if(_0x274eab[_0x2087('0x4b')][_0x2087('0x80')]&&(!_0x45688e[_0x2087('0x81')]||!_0x45688e[_0x2087('0x82')]||!_0x45688e[_0x2087('0x83')]||!_0x45688e[_0x2087('0x84')]||!_0x45688e[_0x2087('0x6f')])){throw new db[(_0x2087('0x7c'))]['ValidationError'](_0x2087('0x85'));}return db[_0x2087('0x86')]['findOne']({'where':{'id':_0x45688e['transcribeAccountId']}});}})[_0x2087('0x26')](function(_0x5ae652){if(!_0x5ae652){throw new db[(_0x2087('0x7c'))][(_0x2087('0x54'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5ae652['data1']||!_0x5ae652['data2']){throw new db[(_0x2087('0x7c'))]['ValidationError'](_0x2087('0x87'));}_0x28b184=_0x5ae652;return getBucketslist(_0x28b184[_0x2087('0x88')],_0x28b184[_0x2087('0x89')],_0x45688e[_0x2087('0x8a')]);})[_0x2087('0x26')](function(_0x400c86){if(_0x400c86&&_0x400c86[_0x2087('0x8b')]){var _0x508b96=_[_0x2087('0x49')](_0x400c86[_0x2087('0x8b')],function(_0x353fac){return _0x353fac[_0x2087('0x8c')]===_0x45688e[_0x2087('0x6f')];});if(!_0x508b96){logger[_0x2087('0x65')](util[_0x2087('0x60')](_0x2087('0x8d'),_0x274eab['params']['id'],_0x45688e['bucket']));return createBucket(_0x28b184[_0x2087('0x88')],_0x28b184['data2'],_0x45688e[_0x2087('0x8a')],_0x45688e[_0x2087('0x6f')]);}logger[_0x2087('0x65')](util[_0x2087('0x60')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x274eab[_0x2087('0x4c')]['id'],_0x45688e['bucket']));return;}})[_0x2087('0x26')](function(_0x461be3){if(_0x248b92[_0x2087('0x77')]===_0x2087('0x8e')){return transcribe(_0x274eab[_0x2087('0x4c')]['id'],_0x28b184[_0x2087('0x88')],_0x28b184[_0x2087('0x89')],_0x45688e[_0x2087('0x8a')],_0x45688e[_0x2087('0x6f')],_0x248b92['value'],_0x45688e['language']);}else{logger[_0x2087('0x65')](util[_0x2087('0x60')](_0x2087('0x8f'),_0x274eab[_0x2087('0x4c')]['id']));return{'transcribeStatus':_0x2087('0x90')};}})[_0x2087('0x26')](function(_0x30d93b){if(_0x30d93b){_0x30d93b[_0x2087('0x91')]=_0x274eab[_0x2087('0x4b')][_0x2087('0x80')];return _0x248b92[_0x2087('0x92')](_0x30d93b);}})[_0x2087('0x26')](respondWithResult(_0x53d1e6,null))['catch'](handleError(_0x53d1e6,null));};function writeFile(_0x29d11b,_0x3c409a){return new Promise(function(_0x2d1f8f,_0xa445f2){fs[_0x2087('0x93')](_0x3c409a,_0x29d11b,function(_0x217b58,_0x3b6dfa){if(_0x217b58){return _0xa445f2(_0x217b58);}else{return _0x2d1f8f(_0x3b6dfa);}});});}exports[_0x2087('0x94')]=function(_0x22b9e2,_0x469278,_0xb28ea4){return db[_0x2087('0x42')][_0x2087('0x7a')]({'where':{'id':_0x22b9e2[_0x2087('0x4c')]['id']}})[_0x2087('0x26')](handleEntityNotFound(_0x469278))[_0x2087('0x26')](function(_0xfabef1){if(_0xfabef1&&_0xfabef1[_0x2087('0x95')]){var _0x8d44a5=_0xfabef1[_0x2087('0x95')];var _0x5f0464=config[_0x2087('0x96')]+_0x2087('0x97')+_0xfabef1['id']+_0x2087('0x98');if(fs[_0x2087('0x50')](_0x5f0464)){return _0x5f0464;}return writeFile(_0x8d44a5,_0x5f0464)[_0x2087('0x26')](function(){return _0x5f0464;});}else{throw new db[(_0x2087('0x7c'))][(_0x2087('0x54'))]('Transcript\x20not\x20available');}})[_0x2087('0x26')](function(_0x15b710){return _0x469278[_0x2087('0x4e')](_0x15b710);})['catch'](handleError(_0x469278));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 4e553f8..53dbd6e 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 _0x39cd=['api','moment','bluebird','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','VoiceRecording','voice_recordings','uniqueid','lodash','util'];(function(_0x536bb1,_0x543e42){var _0x3398ee=function(_0x49e0c6){while(--_0x49e0c6){_0x536bb1['push'](_0x536bb1['shift']());}};_0x3398ee(++_0x543e42);}(_0x39cd,0x11c));var _0xd39c=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0x39cd[_0x17406a];return _0x1501ff;};'use strict';var _=require(_0xd39c('0x0'));var util=require(_0xd39c('0x1'));var logger=require('../../config/logger')(_0xd39c('0x2'));var moment=require(_0xd39c('0x3'));var BPromise=require(_0xd39c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd39c('0x5'));var rimraf=require(_0xd39c('0x6'));var config=require(_0xd39c('0x7'));var attributes=require(_0xd39c('0x8'));module[_0xd39c('0x9')]=function(_0x293f9b,_0x6d6a1e){return _0x293f9b['define'](_0xd39c('0xa'),attributes,{'tableName':_0xd39c('0xb'),'paranoid':![],'indexes':[{'name':_0xd39c('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa1c4=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid','lodash'];(function(_0x58adea,_0x5c2569){var _0x4895a8=function(_0x52f97c){while(--_0x52f97c){_0x58adea['push'](_0x58adea['shift']());}};_0x4895a8(++_0x5c2569);}(_0xa1c4,0xdf));var _0x4a1c=function(_0x3bafe6,_0x3432b7){_0x3bafe6=_0x3bafe6-0x0;var _0x30bc43=_0xa1c4[_0x3bafe6];return _0x30bc43;};'use strict';var _=require(_0x4a1c('0x0'));var util=require(_0x4a1c('0x1'));var logger=require(_0x4a1c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4a1c('0x3'));var rp=require(_0x4a1c('0x4'));var fs=require('fs');var path=require(_0x4a1c('0x5'));var rimraf=require(_0x4a1c('0x6'));var config=require(_0x4a1c('0x7'));var attributes=require(_0x4a1c('0x8'));module[_0x4a1c('0x9')]=function(_0x256237,_0x49bf92){return _0x256237[_0x4a1c('0xa')](_0x4a1c('0xb'),attributes,{'tableName':_0x4a1c('0xc'),'paranoid':![],'indexes':[{'name':_0x4a1c('0xd'),'fields':[_0x4a1c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index e72108b..f90821c 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 _0x958a=['unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher'];(function(_0x5ad00b,_0x22c334){var _0x2aab79=function(_0x999352){while(--_0x999352){_0x5ad00b['push'](_0x5ad00b['shift']());}};_0x2aab79(++_0x22c334);}(_0x958a,0x128));var _0xa958=function(_0xb0f119,_0x15e549){_0xb0f119=_0xb0f119-0x0;var _0x497ed5=_0x958a[_0xb0f119];return _0x497ed5;};'use strict';var _=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var moment=require('moment');var BPromise=require(_0xa958('0x2'));var rs=require(_0xa958('0x3'));var fs=require('fs');var Redis=require(_0xa958('0x4'));var db=require(_0xa958('0x5'))['db'];var utils=require(_0xa958('0x6'));var logger=require('../../config/logger')(_0xa958('0x7'));var config=require('../../config/environment');var jayson=require(_0xa958('0x8'));var client=jayson[_0xa958('0x9')][_0xa958('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ddaa9,_0x3ca01f,_0x3b2693){return new BPromise(function(_0x1895da,_0x54c0e0){return client['request'](_0x3ddaa9,_0x3b2693)[_0xa958('0xb')](function(_0x249764){logger[_0xa958('0xc')](_0xa958('0xd'),_0x3ca01f,_0xa958('0xe'));logger[_0xa958('0xf')](_0xa958('0x10'),_0x3ca01f,_0xa958('0xe'),JSON[_0xa958('0x11')](_0x249764));if(_0x249764[_0xa958('0x12')]){if(_0x249764[_0xa958('0x12')][_0xa958('0x13')]===0x1f4){logger[_0xa958('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x3ca01f,_0x249764['error']['message']);return _0x54c0e0(_0x249764[_0xa958('0x12')][_0xa958('0x14')]);}logger[_0xa958('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x3ca01f,_0x249764[_0xa958('0x12')]['message']);return _0x1895da(_0x249764['error']['message']);}else{logger[_0xa958('0xc')](_0xa958('0xd'),_0x3ca01f,_0xa958('0xe'));_0x1895da(_0x249764[_0xa958('0x15')][_0xa958('0x14')]);}})[_0xa958('0x16')](function(_0x23736f){logger[_0xa958('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x3ca01f,_0x23736f);_0x54c0e0(_0x23736f);});});}exports[_0xa958('0x17')]=function(_0x4eadc9){var _0x3a053f=this;return new Promise(function(_0x70d13e,_0x52a184){return db[_0xa958('0x18')][_0xa958('0x19')](_0x4eadc9[_0xa958('0x1a')],{'raw':_0x4eadc9[_0xa958('0x1b')]?_0x4eadc9[_0xa958('0x1b')][_0xa958('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4eadc9['options']?_0x4eadc9['options'][_0xa958('0x1d')]||null:null,'attributes':_0x4eadc9[_0xa958('0x1b')]?_0x4eadc9[_0xa958('0x1b')]['attributes']||null:null,'limit':_0x4eadc9[_0xa958('0x1b')]?_0x4eadc9[_0xa958('0x1b')]['limit']||null:null})[_0xa958('0xb')](function(_0x401175){logger['info']('UpdateVoiceRecording',_0x4eadc9);logger[_0xa958('0xf')](_0xa958('0x17'),_0x4eadc9,JSON['stringify'](_0x401175));_0x70d13e(_0x401175);})[_0xa958('0x16')](function(_0x27097a){logger[_0xa958('0x12')](_0xa958('0x17'),_0x27097a[_0xa958('0x14')],_0x4eadc9);_0x52a184(_0x3a053f[_0xa958('0x12')](0x1f4,_0x27097a['message']));});});};exports[_0xa958('0x1e')]=function(_0x48ef34){var _0x43df63=this;return new Promise(function(_0x3c2ea3,_0x32ea36){var _0x18f600=require(_0xa958('0x1f'));var _0xddc7f6;return db[_0xa958('0x20')][_0xa958('0x21')]({'attributes':['id',_0xa958('0x22')],'where':{'id':0x1},'raw':!![]})[_0xa958('0xb')](function(_0x4c4c37){_0xddc7f6=_0x4c4c37;return db['VoiceRecording'][_0xa958('0x23')](_0x48ef34['body']);})[_0xa958('0xb')](function(_0x1b76de){if(_0xddc7f6['callRecordingEncryption']&&fs[_0xa958('0x24')](_0x1b76de[_0xa958('0x25')])){var _0x179bc2=util[_0xa958('0x26')](_0xa958('0x27'),_0x1b76de['value']);return _0x18f600['encryptFile'](_0x1b76de[_0xa958('0x25')],_0x179bc2,config['secrets']['recording'])[_0xa958('0xb')](function(){fs[_0xa958('0x28')](_0x1b76de[_0xa958('0x25')]);logger[_0xa958('0xc')](_0xa958('0x29'));return _0x1b76de;});}return _0x1b76de;})[_0xa958('0xb')](function(_0x516a2f){logger[_0xa958('0xc')]('CreateVoiceRecording',_0x48ef34);logger['debug'](_0xa958('0x1e'),_0x48ef34,JSON[_0xa958('0x11')](_0x516a2f));_0x3c2ea3(_0x516a2f);})[_0xa958('0x16')](function(_0x1cc55d){logger[_0xa958('0x12')](_0xa958('0x1e'),_0x1cc55d[_0xa958('0x14')],_0x48ef34);_0x32ea36(_0x43df63[_0xa958('0x12')](0x1f4,_0x1cc55d['message']));});});}; \ No newline at end of file +var _0xdf55=['create','value','format','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','VoiceRecording,\x20%s,\x20%s','message','info','result','catch','UpdateVoiceRecording','update','options','raw','attributes','limit','debug','stringify','CreateVoiceRecording','findOne','callRecordingEncryption'];(function(_0x11aa8f,_0x5aec50){var _0x31b2d1=function(_0x58140f){while(--_0x58140f){_0x11aa8f['push'](_0x11aa8f['shift']());}};_0x31b2d1(++_0x5aec50);}(_0xdf55,0x83));var _0x5df5=function(_0x52e94f,_0x22e52d){_0x52e94f=_0x52e94f-0x0;var _0x127d43=_0xdf55[_0x52e94f];return _0x127d43;};'use strict';var _=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var moment=require('moment');var BPromise=require(_0x5df5('0x2'));var rs=require(_0x5df5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5df5('0x4'))['db'];var utils=require(_0x5df5('0x5'));var logger=require(_0x5df5('0x6'))('rpc');var config=require(_0x5df5('0x7'));var jayson=require(_0x5df5('0x8'));var client=jayson[_0x5df5('0x9')][_0x5df5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9b8756,_0x2b7ed9,_0x4722a2){return new BPromise(function(_0x3743f3,_0x4d43a3){return client[_0x5df5('0xb')](_0x9b8756,_0x4722a2)[_0x5df5('0xc')](function(_0x41941e){logger['info']('VoiceRecording,\x20%s,\x20%s',_0x2b7ed9,_0x5df5('0xd'));logger['debug'](_0x5df5('0xe'),_0x2b7ed9,_0x5df5('0xd'),JSON['stringify'](_0x41941e));if(_0x41941e['error']){if(_0x41941e[_0x5df5('0xf')][_0x5df5('0x10')]===0x1f4){logger[_0x5df5('0xf')](_0x5df5('0x11'),_0x2b7ed9,_0x41941e[_0x5df5('0xf')][_0x5df5('0x12')]);return _0x4d43a3(_0x41941e[_0x5df5('0xf')][_0x5df5('0x12')]);}logger[_0x5df5('0xf')](_0x5df5('0x11'),_0x2b7ed9,_0x41941e['error'][_0x5df5('0x12')]);return _0x3743f3(_0x41941e['error'][_0x5df5('0x12')]);}else{logger[_0x5df5('0x13')](_0x5df5('0x11'),_0x2b7ed9,_0x5df5('0xd'));_0x3743f3(_0x41941e[_0x5df5('0x14')]['message']);}})[_0x5df5('0x15')](function(_0x457205){logger['error'](_0x5df5('0x11'),_0x2b7ed9,_0x457205);_0x4d43a3(_0x457205);});});}exports[_0x5df5('0x16')]=function(_0xb7e1c2){var _0x44f700=this;return new Promise(function(_0x215d59,_0x4b499d){return db['VoiceRecording'][_0x5df5('0x17')](_0xb7e1c2['body'],{'raw':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2[_0x5df5('0x18')]['where']||null:null,'attributes':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x1a')]||null:null,'limit':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x1b')]||null:null})['then'](function(_0x2e99a1){logger[_0x5df5('0x13')](_0x5df5('0x16'),_0xb7e1c2);logger[_0x5df5('0x1c')]('UpdateVoiceRecording',_0xb7e1c2,JSON[_0x5df5('0x1d')](_0x2e99a1));_0x215d59(_0x2e99a1);})[_0x5df5('0x15')](function(_0x395f3e){logger['error']('UpdateVoiceRecording',_0x395f3e['message'],_0xb7e1c2);_0x4b499d(_0x44f700[_0x5df5('0xf')](0x1f4,_0x395f3e[_0x5df5('0x12')]));});});};exports[_0x5df5('0x1e')]=function(_0xa7f4b3){var _0x1baf52=this;return new Promise(function(_0x1fd83c,_0x210d20){var _0x28723e=require('../../components/encryptor');var _0x18bb61;return db['Setting'][_0x5df5('0x1f')]({'attributes':['id',_0x5df5('0x20')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x3854d0){_0x18bb61=_0x3854d0;return db['VoiceRecording'][_0x5df5('0x21')](_0xa7f4b3['body']);})[_0x5df5('0xc')](function(_0x4afe36){if(_0x18bb61[_0x5df5('0x20')]&&fs['existsSync'](_0x4afe36[_0x5df5('0x22')])){var _0x47bebb=util[_0x5df5('0x23')]('%s.cypher',_0x4afe36[_0x5df5('0x22')]);return _0x28723e[_0x5df5('0x24')](_0x4afe36[_0x5df5('0x22')],_0x47bebb,config[_0x5df5('0x25')][_0x5df5('0x26')])[_0x5df5('0xc')](function(){fs[_0x5df5('0x27')](_0x4afe36['value']);logger['info'](_0x5df5('0x28'));return _0x4afe36;});}return _0x4afe36;})[_0x5df5('0xc')](function(_0x3bbd2b){logger[_0x5df5('0x13')](_0x5df5('0x1e'),_0xa7f4b3);logger[_0x5df5('0x1c')]('CreateVoiceRecording',_0xa7f4b3,JSON[_0x5df5('0x1d')](_0x3bbd2b));_0x1fd83c(_0x3bbd2b);})[_0x5df5('0x15')](function(_0x2f1001){logger[_0x5df5('0xf')]('CreateVoiceRecording',_0x2f1001[_0x5df5('0x12')],_0xa7f4b3);_0x210d20(_0x1baf52['error'](0x1f4,_0x2f1001[_0x5df5('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 8366311..887d551 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 _0x124a=['../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','post','create','put','delete','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x124a,0xfa));var _0xa124=function(_0x15fab0,_0x416c7d){_0x15fab0=_0x15fab0-0x0;var _0x1b41a8=_0x124a[_0x15fab0];return _0x1b41a8;};'use strict';var multer=require(_0xa124('0x0'));var util=require('util');var path=require(_0xa124('0x1'));var timeout=require(_0xa124('0x2'));var express=require(_0xa124('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa124('0x4'));var interaction=require(_0xa124('0x5'));var config=require(_0xa124('0x6'));var controller=require('./voiceTransferReport.controller');router[_0xa124('0x7')]('/',auth[_0xa124('0x8')](),controller['index']);router[_0xa124('0x7')](_0xa124('0x9'),auth[_0xa124('0x8')](),controller[_0xa124('0xa')]);router['get'](_0xa124('0xb'),auth[_0xa124('0x8')](),controller['show']);router[_0xa124('0xc')]('/',auth[_0xa124('0x8')](),controller[_0xa124('0xd')]);router[_0xa124('0xe')](_0xa124('0xb'),auth[_0xa124('0x8')](),controller['update']);router[_0xa124('0xf')](_0xa124('0xb'),auth[_0xa124('0x8')](),controller['destroy']);module[_0xa124('0x10')]=router; \ No newline at end of file +var _0xfbc4=['./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','update','delete','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xfbc4,0x16f));var _0x4fbc=function(_0x71709b,_0x5d12ab){_0x71709b=_0x71709b-0x0;var _0x5d119e=_0xfbc4[_0x71709b];return _0x5d119e;};'use strict';var multer=require('multer');var util=require(_0x4fbc('0x0'));var path=require(_0x4fbc('0x1'));var timeout=require('connect-timeout');var express=require(_0x4fbc('0x2'));var router=express[_0x4fbc('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4fbc('0x4'));var interaction=require(_0x4fbc('0x5'));var config=require(_0x4fbc('0x6'));var controller=require(_0x4fbc('0x7'));router[_0x4fbc('0x8')]('/',auth[_0x4fbc('0x9')](),controller[_0x4fbc('0xa')]);router[_0x4fbc('0x8')](_0x4fbc('0xb'),auth['isAuthenticated'](),controller[_0x4fbc('0xc')]);router['get'](_0x4fbc('0xd'),auth[_0x4fbc('0x9')](),controller['show']);router[_0x4fbc('0xe')]('/',auth[_0x4fbc('0x9')](),controller['create']);router['put'](_0x4fbc('0xd'),auth[_0x4fbc('0x9')](),controller[_0x4fbc('0xf')]);router[_0x4fbc('0x10')]('/:id',auth[_0x4fbc('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 57834f9..842182a 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 _0x5a08=['Yes','sequelize','moment','exports','ENUM','blind','attended','STRING'];(function(_0x1ccbcc,_0x5c948b){var _0x1e873f=function(_0x4f232e){while(--_0x4f232e){_0x1ccbcc['push'](_0x1ccbcc['shift']());}};_0x1e873f(++_0x5c948b);}(_0x5a08,0x189));var _0x85a0=function(_0x46b0f8,_0x38b41a){_0x46b0f8=_0x46b0f8-0x0;var _0x3adfd8=_0x5a08[_0x46b0f8];return _0x3adfd8;};'use strict';var Sequelize=require(_0x85a0('0x0'));var moment=require(_0x85a0('0x1'));module[_0x85a0('0x2')]={'type':{'type':Sequelize[_0x85a0('0x3')](_0x85a0('0x4'),_0x85a0('0x5'))},'result':{'type':Sequelize[_0x85a0('0x6')]},'transfererchannel':{'type':Sequelize[_0x85a0('0x6')]},'transferercalleridnum':{'type':Sequelize[_0x85a0('0x6')]},'transferercalleridname':{'type':Sequelize[_0x85a0('0x6')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x85a0('0x6')]},'transferercontext':{'type':Sequelize[_0x85a0('0x6')]},'transfererexten':{'type':Sequelize[_0x85a0('0x6')]},'transfererlinkedid':{'type':Sequelize[_0x85a0('0x6')]},'transfereechannel':{'type':Sequelize[_0x85a0('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0x85a0('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x85a0('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x85a0('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0x85a0('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0x85a0('0x6')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x85a0('0x6')]},'isexternal':{'type':Sequelize[_0x85a0('0x3')](_0x85a0('0x7'),'No')},'context':{'type':Sequelize[_0x85a0('0x6')]},'extension':{'type':Sequelize[_0x85a0('0x6')]}}; \ No newline at end of file +var _0x3e90=['exports','ENUM','blind','attended','STRING','Yes','moment'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x3e90,0x18e));var _0x03e9=function(_0x21799a,_0x478112){_0x21799a=_0x21799a-0x0;var _0x16b0da=_0x3e90[_0x21799a];return _0x16b0da;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x03e9('0x0'));module[_0x03e9('0x1')]={'type':{'type':Sequelize[_0x03e9('0x2')](_0x03e9('0x3'),_0x03e9('0x4'))},'result':{'type':Sequelize[_0x03e9('0x5')]},'transfererchannel':{'type':Sequelize[_0x03e9('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x03e9('0x5')]},'transferercalleridname':{'type':Sequelize[_0x03e9('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x03e9('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x03e9('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x03e9('0x5')]},'transferercontext':{'type':Sequelize[_0x03e9('0x5')]},'transfererexten':{'type':Sequelize[_0x03e9('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x03e9('0x5')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x03e9('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x03e9('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x03e9('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x03e9('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x03e9('0x5')]},'isexternal':{'type':Sequelize[_0x03e9('0x2')](_0x03e9('0x6'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x03e9('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index d543bc4..15aa8ec 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 _0x6215=['show','params','keys','rawAttributes','include','find','create','body','catch','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','VoiceTransferReport','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows'];(function(_0x4647ec,_0x3c3078){var _0x41efb6=function(_0x2865ff){while(--_0x2865ff){_0x4647ec['push'](_0x4647ec['shift']());}};_0x41efb6(++_0x3c3078);}(_0x6215,0x19f));var _0x5621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6215[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x5621('0x0'));var rimraf=require(_0x5621('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5621('0x2'));var rp=require(_0x5621('0x3'));var moment=require(_0x5621('0x4'));var BPromise=require(_0x5621('0x5'));var Mustache=require('mustache');var util=require(_0x5621('0x6'));var path=require(_0x5621('0x7'));var sox=require(_0x5621('0x8'));var csv=require('to-csv');var ejs=require(_0x5621('0x9'));var fs=require('fs');var fs_extra=require(_0x5621('0xa'));var _=require(_0x5621('0xb'));var squel=require(_0x5621('0xc'));var crypto=require(_0x5621('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5621('0xe'));var toCsv=require(_0x5621('0xf'));var querystring=require(_0x5621('0x10'));var Papa=require(_0x5621('0x11'));var Redis=require(_0x5621('0x12'));var authService=require(_0x5621('0x13'));var qs=require(_0x5621('0x14'));var as=require(_0x5621('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5621('0x16'));var utils=require('../../config/utils');var config=require(_0x5621('0x17'));var licenseUtil=require(_0x5621('0x18'));var db=require(_0x5621('0x19'))['db'];function respondWithStatusCode(_0x54f328,_0xc05433){_0xc05433=_0xc05433||0xcc;return function(_0x5929d0){if(_0x5929d0){return _0x54f328[_0x5621('0x1a')](_0xc05433);}return _0x54f328[_0x5621('0x1b')](_0xc05433)['end']();};}function respondWithResult(_0x210c2e,_0x43a046){_0x43a046=_0x43a046||0xc8;return function(_0x69c89a){if(_0x69c89a){return _0x210c2e[_0x5621('0x1b')](_0x43a046)['json'](_0x69c89a);}};}function respondWithFilteredResult(_0x1eccd3,_0xc1d470){return function(_0x4dfbb1){if(_0x4dfbb1){var _0x2758fb=typeof _0xc1d470[_0x5621('0x1c')]===_0x5621('0x1d')&&typeof _0xc1d470[_0x5621('0x1e')]===_0x5621('0x1d');var _0x359a30=_0x4dfbb1[_0x5621('0x1f')];var _0x4f8494=_0x2758fb?0x0:_0xc1d470['offset'];var _0x5e558f=_0x2758fb?_0x4dfbb1[_0x5621('0x1f')]:_0xc1d470[_0x5621('0x1c')]+_0xc1d470[_0x5621('0x1e')];var _0x11b2e2;if(_0x5e558f>=_0x359a30){_0x5e558f=_0x359a30;_0x11b2e2=0xc8;}else{_0x11b2e2=0xce;}_0x1eccd3[_0x5621('0x1b')](_0x11b2e2);return _0x1eccd3[_0x5621('0x20')](_0x5621('0x21'),_0x4f8494+'-'+_0x5e558f+'/'+_0x359a30)[_0x5621('0x22')](_0x4dfbb1);}return null;};}function patchUpdates(_0x24da19){return function(_0x32583e){try{jsonpatch[_0x5621('0x23')](_0x32583e,_0x24da19,!![]);}catch(_0x35bd44){return BPromise[_0x5621('0x24')](_0x35bd44);}return _0x32583e[_0x5621('0x25')]();};}function saveUpdates(_0x360775,_0x5ccbfd){return function(_0x15eb34){if(_0x15eb34){return _0x15eb34[_0x5621('0x26')](_0x360775)[_0x5621('0x27')](function(_0x2854cb){return _0x2854cb;});}return null;};}function removeEntity(_0x5a00cb,_0x1184ef){return function(_0x4744be){if(_0x4744be){return _0x4744be[_0x5621('0x28')]()[_0x5621('0x27')](function(){_0x5a00cb['status'](0xcc)[_0x5621('0x29')]();});}};}function handleEntityNotFound(_0x657cf8,_0x211f89){return function(_0x50eb60){if(!_0x50eb60){_0x657cf8[_0x5621('0x1a')](0x194);}return _0x50eb60;};}function handleError(_0x52df97,_0x12d651){_0x12d651=_0x12d651||0x1f4;return function(_0x3c3b45){logger[_0x5621('0x2a')](_0x3c3b45[_0x5621('0x2b')]);if(_0x3c3b45[_0x5621('0x2c')]){delete _0x3c3b45[_0x5621('0x2c')];}_0x52df97[_0x5621('0x1b')](_0x12d651)[_0x5621('0x2d')](_0x3c3b45);};}exports[_0x5621('0x2e')]=function(_0x209b86,_0x19da3f){var _0x4ce4ea={},_0x14e657={},_0x55f579={'count':0x0,'rows':[]};var _0x194dc5=_['map'](db[_0x5621('0x2f')]['rawAttributes'],function(_0x125824){return{'name':_0x125824[_0x5621('0x30')],'type':_0x125824[_0x5621('0x31')][_0x5621('0x32')]};});_0x14e657[_0x5621('0x33')]=_[_0x5621('0x34')](_0x194dc5,_0x5621('0x2c'));_0x14e657['query']=_['keys'](_0x209b86[_0x5621('0x35')]);_0x14e657[_0x5621('0x36')]=_[_0x5621('0x37')](_0x14e657[_0x5621('0x33')],_0x14e657[_0x5621('0x35')]);_0x4ce4ea[_0x5621('0x38')]=_[_0x5621('0x37')](_0x14e657[_0x5621('0x33')],qs[_0x5621('0x39')](_0x209b86[_0x5621('0x35')][_0x5621('0x39')]));_0x4ce4ea['attributes']=_0x4ce4ea[_0x5621('0x38')][_0x5621('0x3a')]?_0x4ce4ea[_0x5621('0x38')]:_0x14e657[_0x5621('0x33')];if(!_0x209b86[_0x5621('0x35')]['hasOwnProperty'](_0x5621('0x3b'))){_0x4ce4ea[_0x5621('0x1e')]=qs[_0x5621('0x1e')](_0x209b86[_0x5621('0x35')][_0x5621('0x1e')]);_0x4ce4ea[_0x5621('0x1c')]=qs[_0x5621('0x1c')](_0x209b86[_0x5621('0x35')][_0x5621('0x1c')]);}_0x4ce4ea[_0x5621('0x3c')]=qs[_0x5621('0x3d')](_0x209b86[_0x5621('0x35')][_0x5621('0x3d')]);_0x4ce4ea[_0x5621('0x3e')]=qs[_0x5621('0x36')](_[_0x5621('0x3f')](_0x209b86['query'],_0x14e657['filters']),_0x194dc5);if(_0x209b86['query'][_0x5621('0x40')]){_0x4ce4ea[_0x5621('0x3e')]=_[_0x5621('0x41')](_0x4ce4ea[_0x5621('0x3e')],{'$or':_[_0x5621('0x34')](_0x194dc5,function(_0x42de05){if(_0x42de05[_0x5621('0x31')]!==_0x5621('0x42')){var _0xaafadc={};_0xaafadc[_0x42de05[_0x5621('0x2c')]]={'$like':'%'+_0x209b86['query'][_0x5621('0x40')]+'%'};return _0xaafadc;}})});}_0x4ce4ea=_[_0x5621('0x41')]({},_0x4ce4ea,_0x209b86[_0x5621('0x43')]);var _0x1c0dd5={'where':_0x4ce4ea[_0x5621('0x3e')]};return db[_0x5621('0x2f')][_0x5621('0x1f')](_0x1c0dd5)[_0x5621('0x27')](function(_0x5b9c93){_0x55f579[_0x5621('0x1f')]=_0x5b9c93;if(_0x209b86['query'][_0x5621('0x44')]){_0x4ce4ea['include']=[{'all':!![]}];}return db[_0x5621('0x2f')][_0x5621('0x45')](_0x4ce4ea);})[_0x5621('0x27')](function(_0x349d2c){_0x55f579[_0x5621('0x46')]=_0x349d2c;return _0x55f579;})[_0x5621('0x27')](respondWithFilteredResult(_0x19da3f,_0x4ce4ea))['catch'](handleError(_0x19da3f,null));};exports[_0x5621('0x47')]=function(_0x417f35,_0x5ef743){var _0x98aed4={'raw':!![],'where':{'id':_0x417f35[_0x5621('0x48')]['id']}},_0x5df09a={};_0x5df09a[_0x5621('0x33')]=_[_0x5621('0x49')](db[_0x5621('0x2f')][_0x5621('0x4a')]);_0x5df09a[_0x5621('0x35')]=_['keys'](_0x417f35[_0x5621('0x35')]);_0x5df09a[_0x5621('0x36')]=_[_0x5621('0x37')](_0x5df09a[_0x5621('0x33')],_0x5df09a['query']);_0x98aed4[_0x5621('0x38')]=_[_0x5621('0x37')](_0x5df09a[_0x5621('0x33')],qs[_0x5621('0x39')](_0x417f35[_0x5621('0x35')][_0x5621('0x39')]));_0x98aed4[_0x5621('0x38')]=_0x98aed4[_0x5621('0x38')][_0x5621('0x3a')]?_0x98aed4[_0x5621('0x38')]:_0x5df09a[_0x5621('0x33')];if(_0x417f35[_0x5621('0x35')]['includeAll']){_0x98aed4[_0x5621('0x4b')]=[{'all':!![]}];}_0x98aed4=_['merge']({},_0x98aed4,_0x417f35[_0x5621('0x43')]);return db['VoiceTransferReport'][_0x5621('0x4c')](_0x98aed4)[_0x5621('0x27')](handleEntityNotFound(_0x5ef743,null))[_0x5621('0x27')](respondWithResult(_0x5ef743,null))['catch'](handleError(_0x5ef743,null));};exports[_0x5621('0x4d')]=function(_0x55e722,_0x4cc5c4){return db[_0x5621('0x2f')][_0x5621('0x4d')](_0x55e722[_0x5621('0x4e')],{})[_0x5621('0x27')](respondWithResult(_0x4cc5c4,0xc9))[_0x5621('0x4f')](handleError(_0x4cc5c4,null));};exports[_0x5621('0x26')]=function(_0x358c1f,_0x10076e){if(_0x358c1f['body']['id']){delete _0x358c1f[_0x5621('0x4e')]['id'];}return db[_0x5621('0x2f')]['find']({'where':{'id':_0x358c1f[_0x5621('0x48')]['id']}})[_0x5621('0x27')](handleEntityNotFound(_0x10076e,null))[_0x5621('0x27')](saveUpdates(_0x358c1f[_0x5621('0x4e')],null))[_0x5621('0x27')](respondWithResult(_0x10076e,null))[_0x5621('0x4f')](handleError(_0x10076e,null));};exports['destroy']=function(_0x1ff11d,_0x495141){return db[_0x5621('0x2f')][_0x5621('0x4c')]({'where':{'id':_0x1ff11d[_0x5621('0x48')]['id']}})[_0x5621('0x27')](handleEntityNotFound(_0x495141,null))[_0x5621('0x27')](removeEntity(_0x495141,null))[_0x5621('0x4f')](handleError(_0x495141,null));};exports[_0x5621('0x50')]=function(_0x1819ab,_0x46b8b9){return db[_0x5621('0x2f')]['describe']()[_0x5621('0x27')](respondWithResult(_0x46b8b9,null))[_0x5621('0x4f')](handleError(_0x46b8b9,null));}; \ No newline at end of file +var _0x0b33=['to-csv','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','order','sort','where','filters','pick','merge','VIRTUAL','filter','include','findAll','catch','show','params','keys','includeAll','find','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox'];(function(_0x540466,_0xeea311){var _0x544bbf=function(_0xd03a7b){while(--_0xd03a7b){_0x540466['push'](_0x540466['shift']());}};_0x544bbf(++_0xeea311);}(_0x0b33,0xca));var _0x30b3=function(_0x391c55,_0x168617){_0x391c55=_0x391c55-0x0;var _0xa434e0=_0x0b33[_0x391c55];return _0xa434e0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x30b3('0x0'));var zipdir=require(_0x30b3('0x1'));var jsonpatch=require(_0x30b3('0x2'));var rp=require('request-promise');var moment=require(_0x30b3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x30b3('0x4'));var util=require(_0x30b3('0x5'));var path=require(_0x30b3('0x6'));var sox=require(_0x30b3('0x7'));var csv=require(_0x30b3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x30b3('0x9'));var _=require(_0x30b3('0xa'));var squel=require(_0x30b3('0xb'));var crypto=require('crypto');var jsforce=require(_0x30b3('0xc'));var deskjs=require(_0x30b3('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x30b3('0xe'));var authService=require(_0x30b3('0xf'));var qs=require(_0x30b3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x30b3('0x11'))(_0x30b3('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x30b3('0x13'))['db'];function respondWithStatusCode(_0x45639e,_0x4c4c45){_0x4c4c45=_0x4c4c45||0xcc;return function(_0x5cef79){if(_0x5cef79){return _0x45639e[_0x30b3('0x14')](_0x4c4c45);}return _0x45639e[_0x30b3('0x15')](_0x4c4c45)['end']();};}function respondWithResult(_0x598e56,_0x274e31){_0x274e31=_0x274e31||0xc8;return function(_0x4ac3ec){if(_0x4ac3ec){return _0x598e56[_0x30b3('0x15')](_0x274e31)[_0x30b3('0x16')](_0x4ac3ec);}};}function respondWithFilteredResult(_0x10b737,_0x324966){return function(_0x573b6c){if(_0x573b6c){var _0x51432a=typeof _0x324966[_0x30b3('0x17')]===_0x30b3('0x18')&&typeof _0x324966[_0x30b3('0x19')]===_0x30b3('0x18');var _0x32205b=_0x573b6c[_0x30b3('0x1a')];var _0x42286b=_0x51432a?0x0:_0x324966[_0x30b3('0x17')];var _0x3195ed=_0x51432a?_0x573b6c[_0x30b3('0x1a')]:_0x324966[_0x30b3('0x17')]+_0x324966['limit'];var _0x378910;if(_0x3195ed>=_0x32205b){_0x3195ed=_0x32205b;_0x378910=0xc8;}else{_0x378910=0xce;}_0x10b737[_0x30b3('0x15')](_0x378910);return _0x10b737[_0x30b3('0x1b')]('Content-Range',_0x42286b+'-'+_0x3195ed+'/'+_0x32205b)[_0x30b3('0x16')](_0x573b6c);}return null;};}function patchUpdates(_0x5b40c3){return function(_0x18a725){try{jsonpatch[_0x30b3('0x1c')](_0x18a725,_0x5b40c3,!![]);}catch(_0x5b414c){return BPromise[_0x30b3('0x1d')](_0x5b414c);}return _0x18a725[_0x30b3('0x1e')]();};}function saveUpdates(_0x1befde,_0xa28daa){return function(_0x579a8e){if(_0x579a8e){return _0x579a8e[_0x30b3('0x1f')](_0x1befde)[_0x30b3('0x20')](function(_0x456d8b){return _0x456d8b;});}return null;};}function removeEntity(_0x284aec,_0x33d512){return function(_0x58ee14){if(_0x58ee14){return _0x58ee14[_0x30b3('0x21')]()['then'](function(){_0x284aec[_0x30b3('0x15')](0xcc)[_0x30b3('0x22')]();});}};}function handleEntityNotFound(_0x19d9fa,_0x108e3b){return function(_0x30ac06){if(!_0x30ac06){_0x19d9fa['sendStatus'](0x194);}return _0x30ac06;};}function handleError(_0x288361,_0x2ddaae){_0x2ddaae=_0x2ddaae||0x1f4;return function(_0x15a27f){logger[_0x30b3('0x23')](_0x15a27f[_0x30b3('0x24')]);if(_0x15a27f[_0x30b3('0x25')]){delete _0x15a27f[_0x30b3('0x25')];}_0x288361[_0x30b3('0x15')](_0x2ddaae)[_0x30b3('0x26')](_0x15a27f);};}exports['index']=function(_0x489790,_0x43dfd4){var _0x5b05d0={},_0x5d9590={},_0x1869a8={'count':0x0,'rows':[]};var _0x26a613=_[_0x30b3('0x27')](db[_0x30b3('0x28')][_0x30b3('0x29')],function(_0x99759){return{'name':_0x99759[_0x30b3('0x2a')],'type':_0x99759[_0x30b3('0x2b')][_0x30b3('0x2c')]};});_0x5d9590[_0x30b3('0x2d')]=_[_0x30b3('0x27')](_0x26a613,_0x30b3('0x25'));_0x5d9590[_0x30b3('0x2e')]=_['keys'](_0x489790[_0x30b3('0x2e')]);_0x5d9590['filters']=_[_0x30b3('0x2f')](_0x5d9590[_0x30b3('0x2d')],_0x5d9590[_0x30b3('0x2e')]);_0x5b05d0[_0x30b3('0x30')]=_['intersection'](_0x5d9590[_0x30b3('0x2d')],qs['fields'](_0x489790[_0x30b3('0x2e')][_0x30b3('0x31')]));_0x5b05d0[_0x30b3('0x30')]=_0x5b05d0[_0x30b3('0x30')][_0x30b3('0x32')]?_0x5b05d0[_0x30b3('0x30')]:_0x5d9590[_0x30b3('0x2d')];if(!_0x489790[_0x30b3('0x2e')]['hasOwnProperty']('nolimit')){_0x5b05d0[_0x30b3('0x19')]=qs[_0x30b3('0x19')](_0x489790['query'][_0x30b3('0x19')]);_0x5b05d0[_0x30b3('0x17')]=qs[_0x30b3('0x17')](_0x489790['query'][_0x30b3('0x17')]);}_0x5b05d0[_0x30b3('0x33')]=qs[_0x30b3('0x34')](_0x489790[_0x30b3('0x2e')][_0x30b3('0x34')]);_0x5b05d0[_0x30b3('0x35')]=qs[_0x30b3('0x36')](_[_0x30b3('0x37')](_0x489790['query'],_0x5d9590[_0x30b3('0x36')]),_0x26a613);if(_0x489790[_0x30b3('0x2e')]['filter']){_0x5b05d0[_0x30b3('0x35')]=_[_0x30b3('0x38')](_0x5b05d0['where'],{'$or':_[_0x30b3('0x27')](_0x26a613,function(_0x194d48){if(_0x194d48[_0x30b3('0x2b')]!==_0x30b3('0x39')){var _0x493c52={};_0x493c52[_0x194d48[_0x30b3('0x25')]]={'$like':'%'+_0x489790['query'][_0x30b3('0x3a')]+'%'};return _0x493c52;}})});}_0x5b05d0=_[_0x30b3('0x38')]({},_0x5b05d0,_0x489790['options']);var _0x515a13={'where':_0x5b05d0[_0x30b3('0x35')]};return db['VoiceTransferReport']['count'](_0x515a13)['then'](function(_0x314c26){_0x1869a8[_0x30b3('0x1a')]=_0x314c26;if(_0x489790[_0x30b3('0x2e')]['includeAll']){_0x5b05d0[_0x30b3('0x3b')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x30b3('0x3c')](_0x5b05d0);})[_0x30b3('0x20')](function(_0x47381d){_0x1869a8['rows']=_0x47381d;return _0x1869a8;})[_0x30b3('0x20')](respondWithFilteredResult(_0x43dfd4,_0x5b05d0))[_0x30b3('0x3d')](handleError(_0x43dfd4,null));};exports[_0x30b3('0x3e')]=function(_0x27d49b,_0x2eaedc){var _0x4e1d42={'raw':!![],'where':{'id':_0x27d49b[_0x30b3('0x3f')]['id']}},_0x232d54={};_0x232d54[_0x30b3('0x2d')]=_[_0x30b3('0x40')](db[_0x30b3('0x28')][_0x30b3('0x29')]);_0x232d54[_0x30b3('0x2e')]=_[_0x30b3('0x40')](_0x27d49b[_0x30b3('0x2e')]);_0x232d54['filters']=_[_0x30b3('0x2f')](_0x232d54[_0x30b3('0x2d')],_0x232d54[_0x30b3('0x2e')]);_0x4e1d42[_0x30b3('0x30')]=_[_0x30b3('0x2f')](_0x232d54[_0x30b3('0x2d')],qs[_0x30b3('0x31')](_0x27d49b[_0x30b3('0x2e')][_0x30b3('0x31')]));_0x4e1d42[_0x30b3('0x30')]=_0x4e1d42['attributes'][_0x30b3('0x32')]?_0x4e1d42[_0x30b3('0x30')]:_0x232d54[_0x30b3('0x2d')];if(_0x27d49b['query'][_0x30b3('0x41')]){_0x4e1d42[_0x30b3('0x3b')]=[{'all':!![]}];}_0x4e1d42=_['merge']({},_0x4e1d42,_0x27d49b['options']);return db['VoiceTransferReport'][_0x30b3('0x42')](_0x4e1d42)[_0x30b3('0x20')](handleEntityNotFound(_0x2eaedc,null))[_0x30b3('0x20')](respondWithResult(_0x2eaedc,null))['catch'](handleError(_0x2eaedc,null));};exports[_0x30b3('0x43')]=function(_0x515649,_0x4daf4d){return db[_0x30b3('0x28')][_0x30b3('0x43')](_0x515649[_0x30b3('0x44')],{})['then'](respondWithResult(_0x4daf4d,0xc9))[_0x30b3('0x3d')](handleError(_0x4daf4d,null));};exports[_0x30b3('0x1f')]=function(_0x2c0e58,_0x436a10){if(_0x2c0e58['body']['id']){delete _0x2c0e58['body']['id'];}return db['VoiceTransferReport'][_0x30b3('0x42')]({'where':{'id':_0x2c0e58[_0x30b3('0x3f')]['id']}})[_0x30b3('0x20')](handleEntityNotFound(_0x436a10,null))[_0x30b3('0x20')](saveUpdates(_0x2c0e58[_0x30b3('0x44')],null))[_0x30b3('0x20')](respondWithResult(_0x436a10,null))['catch'](handleError(_0x436a10,null));};exports[_0x30b3('0x21')]=function(_0x4c2a52,_0x3cfe93){return db['VoiceTransferReport'][_0x30b3('0x42')]({'where':{'id':_0x4c2a52[_0x30b3('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3cfe93,null))[_0x30b3('0x20')](removeEntity(_0x3cfe93,null))[_0x30b3('0x3d')](handleError(_0x3cfe93,null));};exports[_0x30b3('0x45')]=function(_0x3a1d07,_0x11b7b4){return db[_0x30b3('0x28')][_0x30b3('0x45')]()[_0x30b3('0x20')](respondWithResult(_0x11b7b4,null))['catch'](handleError(_0x11b7b4,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index f77720f..c64e346 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 _0x24fd=['VoiceTransferReport','report_call_transfer','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','define'];(function(_0x238830,_0x545f75){var _0x5917f0=function(_0x12f821){while(--_0x12f821){_0x238830['push'](_0x238830['shift']());}};_0x5917f0(++_0x545f75);}(_0x24fd,0x120));var _0xd24f=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0x24fd[_0x1ae5ab];return _0x1ce001;};'use strict';var _=require('lodash');var util=require(_0xd24f('0x0'));var logger=require(_0xd24f('0x1'))(_0xd24f('0x2'));var moment=require(_0xd24f('0x3'));var BPromise=require(_0xd24f('0x4'));var rp=require(_0xd24f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd24f('0x6'));var attributes=require('./voiceTransferReport.attributes');module[_0xd24f('0x7')]=function(_0x3c058a,_0x1b4916){return _0x3c058a[_0xd24f('0x8')](_0xd24f('0x9'),attributes,{'tableName':_0xd24f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b57=['../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','util','../../config/logger','moment','request-promise','path'];(function(_0x77cdb1,_0x2a2bf3){var _0x54763d=function(_0x19fa2b){while(--_0x19fa2b){_0x77cdb1['push'](_0x77cdb1['shift']());}};_0x54763d(++_0x2a2bf3);}(_0x6b57,0xd7));var _0x76b5=function(_0x66bd99,_0x3403af){_0x66bd99=_0x66bd99-0x0;var _0x3465a2=_0x6b57[_0x66bd99];return _0x3465a2;};'use strict';var _=require('lodash');var util=require(_0x76b5('0x0'));var logger=require(_0x76b5('0x1'))('api');var moment=require(_0x76b5('0x2'));var BPromise=require('bluebird');var rp=require(_0x76b5('0x3'));var fs=require('fs');var path=require(_0x76b5('0x4'));var rimraf=require('rimraf');var config=require(_0x76b5('0x5'));var attributes=require(_0x76b5('0x6'));module[_0x76b5('0x7')]=function(_0x63b985,_0x14c3da){return _0x63b985[_0x76b5('0x8')](_0x76b5('0x9'),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 bf86b90..6baf0bf 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 _0x9ae6=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','result','catch','CreateVoiceTransferReport','create','body','options','raw','debug','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x45c5ac,_0x58bdeb){var _0x3a7b16=function(_0x5d2ca4){while(--_0x5d2ca4){_0x45c5ac['push'](_0x45c5ac['shift']());}};_0x3a7b16(++_0x58bdeb);}(_0x9ae6,0xe2));var _0x69ae=function(_0x37357f,_0x3b23bb){_0x37357f=_0x37357f-0x0;var _0x505ef9=_0x9ae6[_0x37357f];return _0x505ef9;};'use strict';var _=require('lodash');var util=require(_0x69ae('0x0'));var moment=require(_0x69ae('0x1'));var BPromise=require(_0x69ae('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x69ae('0x3'));var db=require(_0x69ae('0x4'))['db'];var utils=require(_0x69ae('0x5'));var logger=require(_0x69ae('0x6'))(_0x69ae('0x7'));var config=require(_0x69ae('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x69ae('0x9')][_0x69ae('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bd1f9,_0x4f7496,_0x52671a){return new BPromise(function(_0x5049ab,_0x25b4c8){return client[_0x69ae('0xb')](_0x3bd1f9,_0x52671a)[_0x69ae('0xc')](function(_0x5efefd){logger[_0x69ae('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x4f7496,'request\x20sent');logger['debug'](_0x69ae('0xe'),_0x4f7496,'request\x20sent',JSON[_0x69ae('0xf')](_0x5efefd));if(_0x5efefd[_0x69ae('0x10')]){if(_0x5efefd[_0x69ae('0x10')][_0x69ae('0x11')]===0x1f4){logger[_0x69ae('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x4f7496,_0x5efefd[_0x69ae('0x10')][_0x69ae('0x12')]);return _0x25b4c8(_0x5efefd[_0x69ae('0x10')]['message']);}logger[_0x69ae('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x4f7496,_0x5efefd[_0x69ae('0x10')]['message']);return _0x5049ab(_0x5efefd[_0x69ae('0x10')][_0x69ae('0x12')]);}else{logger[_0x69ae('0xd')](_0x69ae('0x13'),_0x4f7496,_0x69ae('0x14'));_0x5049ab(_0x5efefd[_0x69ae('0x15')][_0x69ae('0x12')]);}})[_0x69ae('0x16')](function(_0x4f08d0){logger[_0x69ae('0x10')](_0x69ae('0x13'),_0x4f7496,_0x4f08d0);_0x25b4c8(_0x4f08d0);});});}exports[_0x69ae('0x17')]=function(_0x4f590c){var _0x1d6dac=this;return new Promise(function(_0x26c310,_0x3ff7fb){return db['VoiceTransferReport'][_0x69ae('0x18')](_0x4f590c[_0x69ae('0x19')],{'raw':_0x4f590c[_0x69ae('0x1a')]?_0x4f590c[_0x69ae('0x1a')][_0x69ae('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x2b2b87){logger[_0x69ae('0xd')](_0x69ae('0x17'),_0x4f590c);logger[_0x69ae('0x1c')](_0x69ae('0x17'),_0x4f590c,JSON[_0x69ae('0xf')](_0x2b2b87));_0x26c310(_0x2b2b87);})[_0x69ae('0x16')](function(_0x5dad62){logger['error'](_0x69ae('0x17'),_0x5dad62[_0x69ae('0x12')],_0x4f590c);_0x3ff7fb(_0x1d6dac[_0x69ae('0x10')](0x1f4,_0x5dad62[_0x69ae('0x12')]));});});}; \ No newline at end of file +var _0xc4bf=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','VoiceTransferReport,\x20%s,\x20%s','result','CreateVoiceTransferReport','create','body','options','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x154305,_0x12431e){var _0x17990a=function(_0x2acccf){while(--_0x2acccf){_0x154305['push'](_0x154305['shift']());}};_0x17990a(++_0x12431e);}(_0xc4bf,0x72));var _0xfc4b=function(_0x3df7b8,_0x55db91){_0x3df7b8=_0x3df7b8-0x0;var _0x16f05d=_0xc4bf[_0x3df7b8];return _0x16f05d;};'use strict';var _=require(_0xfc4b('0x0'));var util=require(_0xfc4b('0x1'));var moment=require(_0xfc4b('0x2'));var BPromise=require('bluebird');var rs=require(_0xfc4b('0x3'));var fs=require('fs');var Redis=require(_0xfc4b('0x4'));var db=require(_0xfc4b('0x5'))['db'];var utils=require(_0xfc4b('0x6'));var logger=require(_0xfc4b('0x7'))(_0xfc4b('0x8'));var config=require(_0xfc4b('0x9'));var jayson=require(_0xfc4b('0xa'));var client=jayson[_0xfc4b('0xb')][_0xfc4b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3f5b2b,_0x2296b6,_0x32b16e){return new BPromise(function(_0x4cbdf9,_0x1545aa){return client[_0xfc4b('0xd')](_0x3f5b2b,_0x32b16e)[_0xfc4b('0xe')](function(_0x2a6eb8){logger[_0xfc4b('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x2296b6,'request\x20sent');logger[_0xfc4b('0x10')](_0xfc4b('0x11'),_0x2296b6,_0xfc4b('0x12'),JSON[_0xfc4b('0x13')](_0x2a6eb8));if(_0x2a6eb8[_0xfc4b('0x14')]){if(_0x2a6eb8[_0xfc4b('0x14')][_0xfc4b('0x15')]===0x1f4){logger[_0xfc4b('0x14')]('VoiceTransferReport,\x20%s,\x20%s',_0x2296b6,_0x2a6eb8[_0xfc4b('0x14')][_0xfc4b('0x16')]);return _0x1545aa(_0x2a6eb8[_0xfc4b('0x14')][_0xfc4b('0x16')]);}logger['error'](_0xfc4b('0x17'),_0x2296b6,_0x2a6eb8[_0xfc4b('0x14')][_0xfc4b('0x16')]);return _0x4cbdf9(_0x2a6eb8[_0xfc4b('0x14')][_0xfc4b('0x16')]);}else{logger[_0xfc4b('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x2296b6,'request\x20sent');_0x4cbdf9(_0x2a6eb8[_0xfc4b('0x18')][_0xfc4b('0x16')]);}})['catch'](function(_0x3aa3ea){logger[_0xfc4b('0x14')]('VoiceTransferReport,\x20%s,\x20%s',_0x2296b6,_0x3aa3ea);_0x1545aa(_0x3aa3ea);});});}exports[_0xfc4b('0x19')]=function(_0x5e42b3){var _0x25059c=this;return new Promise(function(_0x91b380,_0x3b9104){return db['VoiceTransferReport'][_0xfc4b('0x1a')](_0x5e42b3[_0xfc4b('0x1b')],{'raw':_0x5e42b3['options']?_0x5e42b3[_0xfc4b('0x1c')][_0xfc4b('0x1d')]===undefined?!![]:![]:!![]})[_0xfc4b('0xe')](function(_0x3746d7){logger[_0xfc4b('0xf')](_0xfc4b('0x19'),_0x5e42b3);logger[_0xfc4b('0x10')]('CreateVoiceTransferReport',_0x5e42b3,JSON[_0xfc4b('0x13')](_0x3746d7));_0x91b380(_0x3746d7);})['catch'](function(_0x2ff997){logger[_0xfc4b('0x14')]('CreateVoiceTransferReport',_0x2ff997[_0xfc4b('0x16')],_0x5e42b3);_0x3b9104(_0x25059c[_0xfc4b('0x14')](0x1f4,_0x2ff997['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index dc27f73..8082bdc 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 _0x153f=['hold','/unhold','unhold','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','originate','/hangup','isWebrtcLicence','hangup','answer','/hold'];(function(_0x35561d,_0x59a5cf){var _0x2ccc5b=function(_0x6d37d2){while(--_0x6d37d2){_0x35561d['push'](_0x35561d['shift']());}};_0x2ccc5b(++_0x59a5cf);}(_0x153f,0x15b));var _0xf153=function(_0x35141c,_0x2b61a4){_0x35141c=_0x35141c-0x0;var _0x5df2f6=_0x153f[_0x35141c];return _0x5df2f6;};'use strict';var express=require(_0xf153('0x0'));var router=express[_0xf153('0x1')]();var auth=require(_0xf153('0x2'));var controller=require(_0xf153('0x3'));router[_0xf153('0x4')](_0xf153('0x5'),auth[_0xf153('0x6')](),auth['isWebrtcLicence'](),controller[_0xf153('0x7')]);router['post'](_0xf153('0x8'),auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0xa')]);router[_0xf153('0x4')]('/answer',auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0xb')]);router[_0xf153('0x4')](_0xf153('0xc'),auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0xd')]);router[_0xf153('0x4')](_0xf153('0xe'),auth['isAuthenticated'](),auth[_0xf153('0x9')](),controller[_0xf153('0xf')]);router[_0xf153('0x4')]('/calls',auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0x10')]);router[_0xf153('0x4')](_0xf153('0x11'),auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0x12')]);module[_0xf153('0x13')]=router; \ No newline at end of file +var _0xf4eb=['/hangup','isAuthenticated','isWebrtcLicence','hangup','/hold','hold','/unhold','unhold','/calls','calls','transfer','exports','express','/originate','originate','post'];(function(_0xc11070,_0x5caf00){var _0x4f2e8d=function(_0x2ac30b){while(--_0x2ac30b){_0xc11070['push'](_0xc11070['shift']());}};_0x4f2e8d(++_0x5caf00);}(_0xf4eb,0xec));var _0xbf4e=function(_0x6a4890,_0x469d0b){_0x6a4890=_0x6a4890-0x0;var _0x29f3db=_0xf4eb[_0x6a4890];return _0x29f3db;};'use strict';var express=require(_0xbf4e('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router['post'](_0xbf4e('0x1'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbf4e('0x2')]);router[_0xbf4e('0x3')](_0xbf4e('0x4'),auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x7')]);router[_0xbf4e('0x3')]('/answer',auth[_0xbf4e('0x5')](),auth['isWebrtcLicence'](),controller['answer']);router[_0xbf4e('0x3')](_0xbf4e('0x8'),auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0x3')](_0xbf4e('0xa'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbf4e('0xb')]);router['post'](_0xbf4e('0xc'),auth[_0xbf4e('0x5')](),auth['isWebrtcLicence'](),controller[_0xbf4e('0xd')]);router['post']('/transfer',auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0xe')]);module[_0xbf4e('0xf')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 9cf0c2b..ad55f50 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 _0x55ea=['NotFound','request','code','message','result','catch','User','findOne','agent','then','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','originate','info','originate\x20fired:','body','userId','callNumber','callerId','callbackUrl','entityFound:','webbar:originate','json','originate\x20executed!','hangup','hangup\x20fired:','format','user:%s','webbar:hangup','answer','answer\x20fired:','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference\x20fired:','transfer\x20fired:','path','lodash','../../mysqldb','util','bluebird','jayson/promise','client','http','webbarapi','localhost','socket.io-emitter','redis','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','log','handleError:','error','stack','name','status','send'];(function(_0xbc4659,_0x578fba){var _0x5831f9=function(_0x5eb0eb){while(--_0x5eb0eb){_0xbc4659['push'](_0xbc4659['shift']());}};_0x5831f9(++_0x578fba);}(_0x55ea,0xc9));var _0xa55e=function(_0x3d64cb,_0x47ad3d){_0x3d64cb=_0x3d64cb-0x0;var _0x38c85a=_0x55ea[_0x3d64cb];return _0x38c85a;};'use strict';var path=require(_0xa55e('0x0'));var fs=require('fs');var _=require(_0xa55e('0x1'));var db=require(_0xa55e('0x2'))['db'];var config=require('../../config/environment');var util=require(_0xa55e('0x3'));var BPromise=require(_0xa55e('0x4'));var jayson=require(_0xa55e('0x5'));var amiClient=jayson[_0xa55e('0x6')][_0xa55e('0x7')]({'port':0x232a});var logger=require('../../config/logger')(_0xa55e('0x8'));var Redis=require('ioredis');config['redis']=_['defaults'](config['redis'],{'host':_0xa55e('0x9'),'port':0x18eb});var io=require(_0xa55e('0xa'))(new Redis(config[_0xa55e('0xb')]));var Schema=require(_0xa55e('0xc'));var originateValidation=new Schema({'userId':{'type':_0xa55e('0xd'),'required':[!![],_0xa55e('0xe')]},'callNumber':{'type':_0xa55e('0xf'),'required':[!![],_0xa55e('0x10')]},'callerId':{'type':_0xa55e('0xf')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa55e('0xe')]},'sessionId':{'type':_0xa55e('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xa55e('0xd'),'required':[!![],_0xa55e('0xe')]},'sessionId':{'type':_0xa55e('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa55e('0xe')]},'sessionId':{'type':'string','required':[!![],_0xa55e('0x11')]},'transferNumber':{'type':_0xa55e('0xf'),'required':[!![],_0xa55e('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0xa55e('0xd'),'required':[!![],_0xa55e('0xe')]},'sessionId':{'type':_0xa55e('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xa55e('0xd'),'required':[!![],_0xa55e('0xe')]},'sessionId':{'type':_0xa55e('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa55e('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0xa55e('0xd'),'required':[!![],_0xa55e('0xe')]}});function emit(_0x12895e,_0x303698,_0x339f1e){logger['info'](_0x12895e,_0x303698,JSON[_0xa55e('0x13')](_0x339f1e));io['to'](_0x12895e)['emit'](_0x303698,_0x339f1e);}function handleError(_0x517142){return function(_0x4599b9){console[_0xa55e('0x14')](_0xa55e('0x15'),_0x4599b9,_0x4599b9 instanceof RangeError);logger[_0xa55e('0x16')](_0x4599b9[_0xa55e('0x17')]);if(_0x4599b9 instanceof RangeError){if(_0x4599b9['name']){delete _0x4599b9[_0xa55e('0x18')];}_0x517142['status'](0x194)['send'](_0x4599b9);}else{if(_0x4599b9[_0xa55e('0x18')]){delete _0x4599b9[_0xa55e('0x18')];}_0x517142[_0xa55e('0x19')](0x1f4)[_0xa55e('0x1a')](_0x4599b9);}};}function checkError(){return function(_0x51304d){if(!_0x51304d){throw new RangeError(_0xa55e('0x1b'));}return _0x51304d;};}function respondWithRpcPromise(_0x475dde,_0x267adb){return new BPromise(function(_0x9594a3,_0x5b0e74){var _0x53a2f9=amiClient;return _0x53a2f9[_0xa55e('0x1c')](_0x475dde,_0x267adb)['then'](function(_0xaaf2f1){if(_0xaaf2f1[_0xa55e('0x16')]){if(_0xaaf2f1[_0xa55e('0x16')][_0xa55e('0x1d')]===0x1f4){return _0x5b0e74(_0xaaf2f1[_0xa55e('0x16')][_0xa55e('0x1e')]);}return _0x9594a3(_0xaaf2f1[_0xa55e('0x16')][_0xa55e('0x1e')]);}else{_0x9594a3(_0xaaf2f1[_0xa55e('0x1f')]);}})[_0xa55e('0x20')](function(_0x3c519d){_0x5b0e74(_0x3c519d);});});}function getAgent(_0x137aca){return db[_0xa55e('0x21')][_0xa55e('0x22')]({'where':{'id':_0x137aca,'role':_0xa55e('0x23')}})[_0xa55e('0x24')](checkError());}function getAgentCheckSession(_0x2f2579,_0xa1917c){return new BPromise(function(_0x875010,_0x4eebcc){var _0x5c218d=respondWithRpcPromise(_0xa55e('0x25'));var _0x4ebcbd=getAgent(_0x2f2579);Promise[_0xa55e('0x26')]([_0x5c218d,_0x4ebcbd])['then'](function(_0x2fe4e9){var _0x4d9634=_0x2fe4e9[0x0];var _0x2758ca=_0x2fe4e9[0x1];var _0x532b13=_[_0xa55e('0x27')](_0x4d9634[_0xa55e('0x28')],function(_0x4a03ef){return _0x4a03ef[_0xa55e('0x29')]==_0x2758ca['id']&&_0x4a03ef[_0xa55e('0x2a')]==_0xa1917c;});if(_0x532b13[_0xa55e('0x2b')]==0x1){_0x875010(_0x2758ca);}else{_0x4eebcc(new RangeError(_0xa55e('0x2c')+_0xa1917c+'\x20not\x20found!'));}});});}exports[_0xa55e('0x2d')]=function(_0x25ecb3,_0x5b79d6){logger[_0xa55e('0x2e')](_0xa55e('0x2f'),_0x25ecb3[_0xa55e('0x30')]);var _0xcaeba6=originateValidation['validate'](_0x25ecb3[_0xa55e('0x30')]);if(_0xcaeba6['length']>0x0){return _0x5b79d6[_0xa55e('0x19')](0x190)['json'](_0xcaeba6);}var _0x339406=_0x25ecb3[_0xa55e('0x30')][_0xa55e('0x31')];var _0x1e53f0=_0x25ecb3['body'][_0xa55e('0x32')];var _0x5aec2c=_0x25ecb3[_0xa55e('0x30')][_0xa55e('0x33')];var _0x7999ac=_0x25ecb3['body'][_0xa55e('0x34')];return getAgent(_0x339406)[_0xa55e('0x24')](function(_0x602aa0){logger[_0xa55e('0x2e')](_0xa55e('0x35'),_0x602aa0[_0xa55e('0x18')]);emit(util['format']('user:%s',_0x602aa0[_0xa55e('0x18')]),_0xa55e('0x36'),{'callNumber':_0x1e53f0,'callerId':_0x5aec2c,'callbackUrl':_0x7999ac});return _0x5b79d6[_0xa55e('0x19')](0xc8)[_0xa55e('0x37')]({'error':![],'message':_0xa55e('0x38')});})[_0xa55e('0x20')](handleError(_0x5b79d6));};exports[_0xa55e('0x39')]=function(_0x596a5d,_0x5cd5b3){logger[_0xa55e('0x2e')](_0xa55e('0x3a'),_0x596a5d[_0xa55e('0x30')]);var _0x351dbf=hangupValidation[_0xa55e('0xc')](_0x596a5d[_0xa55e('0x30')]);if(_0x351dbf[_0xa55e('0x2b')]>0x0){return _0x5cd5b3[_0xa55e('0x19')](0x190)[_0xa55e('0x37')](_0x351dbf);}var _0x113ab5=_0x596a5d[_0xa55e('0x30')]['userId'];var _0x1da8a9=_0x596a5d[_0xa55e('0x30')][_0xa55e('0x2a')];return getAgent(_0x113ab5)['then'](function(_0x1e806a){logger['info'](_0xa55e('0x35'),_0x1e806a[_0xa55e('0x18')]);emit(util[_0xa55e('0x3b')](_0xa55e('0x3c'),_0x1e806a[_0xa55e('0x18')]),_0xa55e('0x3d'),{'sessionId':_0x1da8a9});return _0x5cd5b3[_0xa55e('0x19')](0xc8)['json']({'error':![],'message':'hangup\x20executed!'});})[_0xa55e('0x20')](handleError(_0x5cd5b3));};exports[_0xa55e('0x3e')]=function(_0x27e756,_0x518e06){logger[_0xa55e('0x2e')](_0xa55e('0x3f'),_0x27e756[_0xa55e('0x30')]);var _0xb43d62=answerValidation[_0xa55e('0xc')](_0x27e756[_0xa55e('0x30')]);if(_0xb43d62[_0xa55e('0x2b')]>0x0){return _0x518e06[_0xa55e('0x19')](0x190)['json'](_0xb43d62);}var _0x4bd20d=_0x27e756[_0xa55e('0x30')][_0xa55e('0x31')];var _0x186dc2=_0x27e756[_0xa55e('0x30')][_0xa55e('0x2a')];return getAgent(_0x4bd20d)[_0xa55e('0x24')](function(_0x52c3b5){logger[_0xa55e('0x2e')]('entityFound:',_0x52c3b5['name']);emit(util[_0xa55e('0x3b')]('user:%s',_0x52c3b5[_0xa55e('0x18')]),'webbar:answer',{'sessionId':_0x186dc2});return _0x518e06['status'](0xc8)[_0xa55e('0x37')]({'error':![],'message':_0xa55e('0x40')});})['catch'](handleError(_0x518e06));};exports['hold']=function(_0x3ae40d,_0x1dda95){logger[_0xa55e('0x2e')](_0xa55e('0x41'),_0x3ae40d[_0xa55e('0x30')]);var _0x1031c9=holdValidation['validate'](_0x3ae40d['body']);if(_0x1031c9[_0xa55e('0x2b')]>0x0){return _0x1dda95[_0xa55e('0x19')](0x190)[_0xa55e('0x37')](_0x1031c9);}var _0x259cb3=_0x3ae40d[_0xa55e('0x30')][_0xa55e('0x31')];var _0x5b8776=_0x3ae40d[_0xa55e('0x30')][_0xa55e('0x2a')];return getAgent(_0x259cb3)[_0xa55e('0x24')](function(_0x1de3a8){logger[_0xa55e('0x2e')](_0xa55e('0x35'),_0x1de3a8['name']);emit(util['format'](_0xa55e('0x3c'),_0x1de3a8['name']),_0xa55e('0x42'),{'sessionId':_0x5b8776});return _0x1dda95['status'](0xc8)[_0xa55e('0x37')]({'error':![],'message':_0xa55e('0x43')});})[_0xa55e('0x20')](handleError(_0x1dda95));};exports[_0xa55e('0x44')]=function(_0x2c35a8,_0x63aa32){logger[_0xa55e('0x2e')](_0xa55e('0x45'),_0x2c35a8['body']);var _0x12c9e1=unholdValidation[_0xa55e('0xc')](_0x2c35a8[_0xa55e('0x30')]);if(_0x12c9e1[_0xa55e('0x2b')]>0x0){return _0x63aa32[_0xa55e('0x19')](0x190)[_0xa55e('0x37')](_0x12c9e1);}var _0x50bc5b=_0x2c35a8[_0xa55e('0x30')][_0xa55e('0x31')];var _0x42c00c=_0x2c35a8[_0xa55e('0x30')][_0xa55e('0x2a')];return getAgent(_0x50bc5b)[_0xa55e('0x24')](function(_0x5e0e05){logger[_0xa55e('0x2e')]('entityFound:',_0x5e0e05[_0xa55e('0x18')]);emit(util[_0xa55e('0x3b')](_0xa55e('0x3c'),_0x5e0e05[_0xa55e('0x18')]),_0xa55e('0x46'),{'sessionId':_0x42c00c});return _0x63aa32[_0xa55e('0x19')](0xc8)['json']({'error':![],'message':_0xa55e('0x47')});})['catch'](handleError(_0x63aa32));};exports[_0xa55e('0x48')]=function(_0x5be88c,_0x4f7b59){logger[_0xa55e('0x2e')](_0xa55e('0x49'),_0x4f7b59[_0xa55e('0x30')]);var _0x1f03a8=callsValidation[_0xa55e('0xc')](_0x5be88c[_0xa55e('0x30')]);if(_0x1f03a8[_0xa55e('0x2b')]>0x0){return _0x4f7b59['status'](0x190)[_0xa55e('0x37')](_0x1f03a8);}var _0x33d1e4=_0x5be88c[_0xa55e('0x30')]['userId'];var _0x467ea7=respondWithRpcPromise(_0xa55e('0x25'));var _0x2aeae3=getAgent(_0x33d1e4);return Promise['all']([_0x467ea7,_0x2aeae3])[_0xa55e('0x24')](function(_0x12c5a0){var _0x28fd5a=_0x12c5a0[0x0];var _0x2a6a1f=_0x12c5a0[0x1];var _0x6f0032=_[_0xa55e('0x27')](_0x28fd5a[_0xa55e('0x28')],function(_0x2f8b5f){return _0x2f8b5f[_0xa55e('0x29')]==_0x2a6a1f['id'];});return _0x4f7b59[_0xa55e('0x19')](0xc8)[_0xa55e('0x37')]({'count':_0x6f0032['length'],'rows':_0x6f0032});})[_0xa55e('0x20')](handleError(_0x4f7b59));};exports['conference']=function(_0x373874,_0x1ea145){logger[_0xa55e('0x2e')](_0xa55e('0x4a'),_0x373874[_0xa55e('0x30')]);var _0x1bef1b=conferenceValidation[_0xa55e('0xc')](_0x373874[_0xa55e('0x30')]);if(_0x1bef1b[_0xa55e('0x2b')]>0x0){return _0x1ea145[_0xa55e('0x19')](0x190)[_0xa55e('0x37')](_0x1bef1b);}var _0x424b87=_0x373874[_0xa55e('0x30')][_0xa55e('0x31')];return getAgent(_0x424b87)[_0xa55e('0x24')](function(_0x448641){logger['info']('entityFound:',_0x448641[_0xa55e('0x18')]);emit(util[_0xa55e('0x3b')](_0xa55e('0x3c'),_0x448641[_0xa55e('0x18')]),'webbar:conference');return _0x1ea145['status'](0xc8)[_0xa55e('0x37')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x1ea145));};exports['transfer']=function(_0x16f585,_0x37cd3a){logger[_0xa55e('0x2e')](_0xa55e('0x4b'),_0x16f585[_0xa55e('0x30')]);var _0x909ec4=transferValidation[_0xa55e('0xc')](_0x16f585[_0xa55e('0x30')]);if(_0x909ec4[_0xa55e('0x2b')]>0x0){return _0x37cd3a[_0xa55e('0x19')](0x190)['json'](_0x909ec4);}var _0x100633=_0x16f585[_0xa55e('0x30')][_0xa55e('0x31')];var _0x5d9388=_0x16f585[_0xa55e('0x30')][_0xa55e('0x2a')];var _0x3dab7b=_0x16f585[_0xa55e('0x30')]['transferNumber'];return getAgent(_0x100633)[_0xa55e('0x24')](function(_0x14fcad){logger[_0xa55e('0x2e')]('entityFound:',_0x14fcad['name']);emit(util[_0xa55e('0x3b')]('user:%s',_0x14fcad[_0xa55e('0x18')]),'webbar:transfer',{'sessionId':_0x5d9388,'transferNumber':_0x3dab7b});return _0x37cd3a[_0xa55e('0x19')](0xc8)[_0xa55e('0x37')]({'error':![],'message':'transfer\x20executed!'});})[_0xa55e('0x20')](handleError(_0x37cd3a));}; \ No newline at end of file +var _0xe28e=['../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','handleError:','stack','name','send','status','NotFound','request','error','code','message','result','catch','findOne','VoiceChannels','all','then','filter','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','info','body','json','callNumber','callerId','callbackUrl','entityFound:','user:%s','originate\x20executed!','hangup','hangup\x20fired:','userId','format','webbar:hangup','hangup\x20executed!','answer','webbar:answer','answer\x20executed!','hold','webbar:hold','hold\x20executed!','webbar:unhold','calls','rows','conference','conference\x20fired:','conference\x20executed!','transfer\x20fired:','transferNumber','path','lodash'];(function(_0x9fe075,_0x22df93){var _0x26443d=function(_0x126b87){while(--_0x126b87){_0x9fe075['push'](_0x9fe075['shift']());}};_0x26443d(++_0x22df93);}(_0xe28e,0x1ba));var _0xee28=function(_0x48e3a1,_0x5bfd26){_0x48e3a1=_0x48e3a1-0x0;var _0x5ac0ab=_0xe28e[_0x48e3a1];return _0x5ac0ab;};'use strict';var path=require(_0xee28('0x0'));var fs=require('fs');var _=require(_0xee28('0x1'));var db=require(_0xee28('0x2'))['db'];var config=require(_0xee28('0x3'));var util=require(_0xee28('0x4'));var BPromise=require(_0xee28('0x5'));var jayson=require(_0xee28('0x6'));var amiClient=jayson[_0xee28('0x7')][_0xee28('0x8')]({'port':0x232a});var logger=require(_0xee28('0x9'))(_0xee28('0xa'));var Redis=require(_0xee28('0xb'));config[_0xee28('0xc')]=_['defaults'](config[_0xee28('0xc')],{'host':_0xee28('0xd'),'port':0x18eb});var io=require(_0xee28('0xe'))(new Redis(config[_0xee28('0xc')]));var Schema=require(_0xee28('0xf'));var originateValidation=new Schema({'userId':{'type':_0xee28('0x10'),'required':[!![],_0xee28('0x11')]},'callNumber':{'type':'string','required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':_0xee28('0x12')}});var hangupValidation=new Schema({'userId':{'type':_0xee28('0x10'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xee28('0x12'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xee28('0x10'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xee28('0x12'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xee28('0x10'),'required':[!![],_0xee28('0x11')]},'sessionId':{'type':_0xee28('0x12'),'required':[!![],_0xee28('0x13')]},'transferNumber':{'type':_0xee28('0x12'),'required':[!![],_0xee28('0x14')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xee28('0x11')]},'sessionId':{'type':_0xee28('0x12'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xee28('0x10'),'required':[!![],_0xee28('0x11')]},'sessionId':{'type':_0xee28('0x12'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xee28('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':_0xee28('0x10'),'required':[!![],_0xee28('0x11')]}});function emit(_0x343358,_0x1ff99e,_0x11c95d){logger['info'](_0x343358,_0x1ff99e,JSON[_0xee28('0x15')](_0x11c95d));io['to'](_0x343358)['emit'](_0x1ff99e,_0x11c95d);}function handleError(_0x37e429){return function(_0x19472a){console['log'](_0xee28('0x16'),_0x19472a,_0x19472a instanceof RangeError);logger['error'](_0x19472a[_0xee28('0x17')]);if(_0x19472a instanceof RangeError){if(_0x19472a['name']){delete _0x19472a[_0xee28('0x18')];}_0x37e429['status'](0x194)[_0xee28('0x19')](_0x19472a);}else{if(_0x19472a['name']){delete _0x19472a[_0xee28('0x18')];}_0x37e429[_0xee28('0x1a')](0x1f4)[_0xee28('0x19')](_0x19472a);}};}function checkError(){return function(_0x3674c7){if(!_0x3674c7){throw new RangeError(_0xee28('0x1b'));}return _0x3674c7;};}function respondWithRpcPromise(_0x1280f5,_0x2dbd49){return new BPromise(function(_0x4bda53,_0x342798){var _0x44d7ff=amiClient;return _0x44d7ff[_0xee28('0x1c')](_0x1280f5,_0x2dbd49)['then'](function(_0x5b500b){if(_0x5b500b[_0xee28('0x1d')]){if(_0x5b500b[_0xee28('0x1d')][_0xee28('0x1e')]===0x1f4){return _0x342798(_0x5b500b[_0xee28('0x1d')][_0xee28('0x1f')]);}return _0x4bda53(_0x5b500b[_0xee28('0x1d')][_0xee28('0x1f')]);}else{_0x4bda53(_0x5b500b[_0xee28('0x20')]);}})[_0xee28('0x21')](function(_0x733ca8){_0x342798(_0x733ca8);});});}function getAgent(_0x281c8a){return db['User'][_0xee28('0x22')]({'where':{'id':_0x281c8a,'role':'agent'}})['then'](checkError());}function getAgentCheckSession(_0x54528b,_0x587aac){return new BPromise(function(_0x51eae7,_0x8373a7){var _0x884e7d=respondWithRpcPromise(_0xee28('0x23'));var _0x469889=getAgent(_0x54528b);Promise[_0xee28('0x24')]([_0x884e7d,_0x469889])[_0xee28('0x25')](function(_0xbafd67){var _0x4fcc8f=_0xbafd67[0x0];var _0x84e0ba=_0xbafd67[0x1];var _0x7390dc=_[_0xee28('0x26')](_0x4fcc8f['rows'],function(_0x14f7c4){return _0x14f7c4[_0xee28('0x27')]==_0x84e0ba['id']&&_0x14f7c4[_0xee28('0x28')]==_0x587aac;});if(_0x7390dc[_0xee28('0x29')]==0x1){_0x51eae7(_0x84e0ba);}else{_0x8373a7(new RangeError(_0xee28('0x2a')+_0x587aac+_0xee28('0x2b')));}});});}exports[_0xee28('0x2c')]=function(_0x5d2a9d,_0x15f294){logger[_0xee28('0x2d')]('originate\x20fired:',_0x5d2a9d[_0xee28('0x2e')]);var _0x34dd11=originateValidation[_0xee28('0xf')](_0x5d2a9d[_0xee28('0x2e')]);if(_0x34dd11[_0xee28('0x29')]>0x0){return _0x15f294[_0xee28('0x1a')](0x190)[_0xee28('0x2f')](_0x34dd11);}var _0x5a4f48=_0x5d2a9d['body']['userId'];var _0x1a8ef0=_0x5d2a9d[_0xee28('0x2e')][_0xee28('0x30')];var _0x3402ce=_0x5d2a9d[_0xee28('0x2e')][_0xee28('0x31')];var _0x5b0c20=_0x5d2a9d[_0xee28('0x2e')][_0xee28('0x32')];return getAgent(_0x5a4f48)['then'](function(_0x51b28d){logger[_0xee28('0x2d')](_0xee28('0x33'),_0x51b28d['name']);emit(util['format'](_0xee28('0x34'),_0x51b28d[_0xee28('0x18')]),'webbar:originate',{'callNumber':_0x1a8ef0,'callerId':_0x3402ce,'callbackUrl':_0x5b0c20});return _0x15f294[_0xee28('0x1a')](0xc8)[_0xee28('0x2f')]({'error':![],'message':_0xee28('0x35')});})[_0xee28('0x21')](handleError(_0x15f294));};exports[_0xee28('0x36')]=function(_0x594116,_0x2a5d06){logger[_0xee28('0x2d')](_0xee28('0x37'),_0x594116[_0xee28('0x2e')]);var _0x43b587=hangupValidation[_0xee28('0xf')](_0x594116['body']);if(_0x43b587[_0xee28('0x29')]>0x0){return _0x2a5d06['status'](0x190)['json'](_0x43b587);}var _0x265ae5=_0x594116['body'][_0xee28('0x38')];var _0x5c5f08=_0x594116[_0xee28('0x2e')]['sessionId'];return getAgent(_0x265ae5)[_0xee28('0x25')](function(_0x211345){logger[_0xee28('0x2d')](_0xee28('0x33'),_0x211345['name']);emit(util[_0xee28('0x39')]('user:%s',_0x211345[_0xee28('0x18')]),_0xee28('0x3a'),{'sessionId':_0x5c5f08});return _0x2a5d06[_0xee28('0x1a')](0xc8)[_0xee28('0x2f')]({'error':![],'message':_0xee28('0x3b')});})[_0xee28('0x21')](handleError(_0x2a5d06));};exports[_0xee28('0x3c')]=function(_0x5a4b9c,_0x4d9d21){logger[_0xee28('0x2d')]('answer\x20fired:',_0x5a4b9c['body']);var _0x4064cf=answerValidation[_0xee28('0xf')](_0x5a4b9c['body']);if(_0x4064cf[_0xee28('0x29')]>0x0){return _0x4d9d21[_0xee28('0x1a')](0x190)[_0xee28('0x2f')](_0x4064cf);}var _0x24cfaa=_0x5a4b9c[_0xee28('0x2e')][_0xee28('0x38')];var _0x1735a9=_0x5a4b9c['body'][_0xee28('0x28')];return getAgent(_0x24cfaa)[_0xee28('0x25')](function(_0x2dd024){logger[_0xee28('0x2d')](_0xee28('0x33'),_0x2dd024['name']);emit(util[_0xee28('0x39')](_0xee28('0x34'),_0x2dd024['name']),_0xee28('0x3d'),{'sessionId':_0x1735a9});return _0x4d9d21[_0xee28('0x1a')](0xc8)[_0xee28('0x2f')]({'error':![],'message':_0xee28('0x3e')});})[_0xee28('0x21')](handleError(_0x4d9d21));};exports[_0xee28('0x3f')]=function(_0x54ab7b,_0x36e5bb){logger['info']('hold\x20fired:',_0x54ab7b[_0xee28('0x2e')]);var _0x2f240f=holdValidation['validate'](_0x54ab7b[_0xee28('0x2e')]);if(_0x2f240f[_0xee28('0x29')]>0x0){return _0x36e5bb[_0xee28('0x1a')](0x190)['json'](_0x2f240f);}var _0x57e57e=_0x54ab7b[_0xee28('0x2e')][_0xee28('0x38')];var _0x1bb1ac=_0x54ab7b[_0xee28('0x2e')][_0xee28('0x28')];return getAgent(_0x57e57e)[_0xee28('0x25')](function(_0x2574c5){logger[_0xee28('0x2d')](_0xee28('0x33'),_0x2574c5[_0xee28('0x18')]);emit(util['format'](_0xee28('0x34'),_0x2574c5['name']),_0xee28('0x40'),{'sessionId':_0x1bb1ac});return _0x36e5bb[_0xee28('0x1a')](0xc8)[_0xee28('0x2f')]({'error':![],'message':_0xee28('0x41')});})[_0xee28('0x21')](handleError(_0x36e5bb));};exports['unhold']=function(_0x5247fe,_0x5ca018){logger[_0xee28('0x2d')]('unhold\x20fired:',_0x5247fe['body']);var _0x659fc4=unholdValidation['validate'](_0x5247fe[_0xee28('0x2e')]);if(_0x659fc4[_0xee28('0x29')]>0x0){return _0x5ca018[_0xee28('0x1a')](0x190)[_0xee28('0x2f')](_0x659fc4);}var _0x398120=_0x5247fe[_0xee28('0x2e')][_0xee28('0x38')];var _0xc1bdba=_0x5247fe[_0xee28('0x2e')][_0xee28('0x28')];return getAgent(_0x398120)['then'](function(_0x1f3680){logger[_0xee28('0x2d')](_0xee28('0x33'),_0x1f3680['name']);emit(util['format']('user:%s',_0x1f3680['name']),_0xee28('0x42'),{'sessionId':_0xc1bdba});return _0x5ca018[_0xee28('0x1a')](0xc8)[_0xee28('0x2f')]({'error':![],'message':'unhold\x20executed!'});})[_0xee28('0x21')](handleError(_0x5ca018));};exports[_0xee28('0x43')]=function(_0x204bbe,_0x39b228){logger[_0xee28('0x2d')]('calls\x20fired:',_0x39b228[_0xee28('0x2e')]);var _0x1c6696=callsValidation[_0xee28('0xf')](_0x204bbe['body']);if(_0x1c6696[_0xee28('0x29')]>0x0){return _0x39b228[_0xee28('0x1a')](0x190)[_0xee28('0x2f')](_0x1c6696);}var _0x47794a=_0x204bbe[_0xee28('0x2e')][_0xee28('0x38')];var _0xfcca7e=respondWithRpcPromise('VoiceChannels');var _0x161394=getAgent(_0x47794a);return Promise['all']([_0xfcca7e,_0x161394])['then'](function(_0x5b7292){var _0x333d7e=_0x5b7292[0x0];var _0x7c51d5=_0x5b7292[0x1];var _0x3cad0a=_[_0xee28('0x26')](_0x333d7e[_0xee28('0x44')],function(_0x27d96d){return _0x27d96d[_0xee28('0x27')]==_0x7c51d5['id'];});return _0x39b228[_0xee28('0x1a')](0xc8)['json']({'count':_0x3cad0a[_0xee28('0x29')],'rows':_0x3cad0a});})[_0xee28('0x21')](handleError(_0x39b228));};exports[_0xee28('0x45')]=function(_0x2b8252,_0x209c3e){logger[_0xee28('0x2d')](_0xee28('0x46'),_0x2b8252['body']);var _0x438943=conferenceValidation['validate'](_0x2b8252[_0xee28('0x2e')]);if(_0x438943[_0xee28('0x29')]>0x0){return _0x209c3e['status'](0x190)[_0xee28('0x2f')](_0x438943);}var _0x2a5fa7=_0x2b8252[_0xee28('0x2e')][_0xee28('0x38')];return getAgent(_0x2a5fa7)['then'](function(_0x209d6d){logger[_0xee28('0x2d')](_0xee28('0x33'),_0x209d6d[_0xee28('0x18')]);emit(util[_0xee28('0x39')](_0xee28('0x34'),_0x209d6d[_0xee28('0x18')]),'webbar:conference');return _0x209c3e[_0xee28('0x1a')](0xc8)['json']({'error':![],'message':_0xee28('0x47')});})[_0xee28('0x21')](handleError(_0x209c3e));};exports['transfer']=function(_0x4b222a,_0x14bc7a){logger['info'](_0xee28('0x48'),_0x4b222a[_0xee28('0x2e')]);var _0x19f81a=transferValidation[_0xee28('0xf')](_0x4b222a[_0xee28('0x2e')]);if(_0x19f81a[_0xee28('0x29')]>0x0){return _0x14bc7a[_0xee28('0x1a')](0x190)['json'](_0x19f81a);}var _0x179ce6=_0x4b222a[_0xee28('0x2e')][_0xee28('0x38')];var _0x57ded5=_0x4b222a[_0xee28('0x2e')][_0xee28('0x28')];var _0x1e190f=_0x4b222a[_0xee28('0x2e')][_0xee28('0x49')];return getAgent(_0x179ce6)[_0xee28('0x25')](function(_0x5dc31e){logger[_0xee28('0x2d')](_0xee28('0x33'),_0x5dc31e[_0xee28('0x18')]);emit(util[_0xee28('0x39')](_0xee28('0x34'),_0x5dc31e[_0xee28('0x18')]),'webbar:transfer',{'sessionId':_0x57ded5,'transferNumber':_0x1e190f});return _0x14bc7a[_0xee28('0x1a')](0xc8)[_0xee28('0x2f')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x14bc7a));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 2f486ad..7fe423a 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 _0x4888=['/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','getApplications','addDisposition','post','addAnswer','addAgents','/:id/applications','addApplications','/:id/notify','notify','/:id/send','update','delete','destroy','removeDispositions','removeAnswers','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4888,0x198));var _0x8488=function(_0x5e2489,_0x2fd8be){_0x5e2489=_0x5e2489-0x0;var _0xa87596=_0x4888[_0x5e2489];return _0xa87596;};'use strict';var multer=require('multer');var util=require(_0x8488('0x0'));var path=require(_0x8488('0x1'));var timeout=require(_0x8488('0x2'));var express=require(_0x8488('0x3'));var router=express[_0x8488('0x4')]();var fs_extra=require(_0x8488('0x5'));var auth=require(_0x8488('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8488('0x7'));var controller=require(_0x8488('0x8'));router[_0x8488('0x9')]('/',auth[_0x8488('0xa')](),controller[_0x8488('0xb')]);router[_0x8488('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x8488('0xc'),auth[_0x8488('0xa')](),controller['show']);router[_0x8488('0x9')](_0x8488('0xd'),auth[_0x8488('0xa')](),controller[_0x8488('0xe')]);router['get'](_0x8488('0xf'),auth[_0x8488('0xa')](),controller[_0x8488('0x10')]);router[_0x8488('0x9')](_0x8488('0x11'),auth['isAuthenticated'](),controller[_0x8488('0x12')]);router[_0x8488('0x9')]('/:id/applications',auth['isAuthenticated'](),controller[_0x8488('0x13')]);router['post']('/',auth[_0x8488('0xa')](),controller['create']);router['post'](_0x8488('0xd'),auth[_0x8488('0xa')](),controller[_0x8488('0x14')]);router[_0x8488('0x15')](_0x8488('0xf'),auth[_0x8488('0xa')](),controller[_0x8488('0x16')]);router['post'](_0x8488('0x11'),auth[_0x8488('0xa')](),controller[_0x8488('0x17')]);router[_0x8488('0x15')](_0x8488('0x18'),auth[_0x8488('0xa')](),controller[_0x8488('0x19')]);router[_0x8488('0x15')](_0x8488('0x1a'),controller[_0x8488('0x1b')]);router[_0x8488('0x15')](_0x8488('0x1c'),auth[_0x8488('0xa')](),controller['send']);router['put'](_0x8488('0xc'),auth[_0x8488('0xa')](),controller[_0x8488('0x1d')]);router[_0x8488('0x1e')](_0x8488('0xc'),auth[_0x8488('0xa')](),controller[_0x8488('0x1f')]);router[_0x8488('0x1e')](_0x8488('0xd'),auth['isAuthenticated'](),controller[_0x8488('0x20')]);router[_0x8488('0x1e')](_0x8488('0xf'),auth[_0x8488('0xa')](),controller[_0x8488('0x21')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x8488('0x22')]=router; \ No newline at end of file +var _0x7a54=['index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/users','getAgents','getApplications','post','create','/:id/canned_answers','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','/:id','delete','removeDispositions','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get'];(function(_0x17efd1,_0x1d7bb9){var _0x38b59d=function(_0x110cee){while(--_0x110cee){_0x17efd1['push'](_0x17efd1['shift']());}};_0x38b59d(++_0x1d7bb9);}(_0x7a54,0x106));var _0x47a5=function(_0x4523cd,_0x1f59eb){_0x4523cd=_0x4523cd-0x0;var _0x4ec37e=_0x7a54[_0x4523cd];return _0x4ec37e;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/applications',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x13')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x14')]);router[_0x47a5('0x13')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['addDisposition']);router[_0x47a5('0x13')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x16')]);router[_0x47a5('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0x47a5('0x17')]);router['post']('/:id/applications',auth[_0x47a5('0xc')](),controller[_0x47a5('0x18')]);router[_0x47a5('0x13')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x13')](_0x47a5('0x1b'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['put'](_0x47a5('0x1d'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0x1e')](_0x47a5('0x1d'),auth[_0x47a5('0xc')](),controller['destroy']);router[_0x47a5('0x1e')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1f')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['removeAnswers']);router[_0x47a5('0x1e')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x20')]);module[_0x47a5('0x21')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index c5d74ed..5371e9d 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 _0xccc1=['TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','sinch'];(function(_0x1fee29,_0x1aa1b5){var _0x2d2c2b=function(_0x1db2d2){while(--_0x1db2d2){_0x1fee29['push'](_0x1fee29['shift']());}};_0x2d2c2b(++_0x1aa1b5);}(_0xccc1,0xd2));var _0x1ccc=function(_0x50b634,_0x1a9974){_0x50b634=_0x50b634-0x0;var _0xcbb832=_0xccc1[_0x50b634];return _0xcbb832;};'use strict';var Sequelize=require(_0x1ccc('0x0'));var rs=require(_0x1ccc('0x1'));module[_0x1ccc('0x2')]={'name':{'type':Sequelize[_0x1ccc('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x1ccc('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x1ccc('0x4')]();}},'phone':{'type':Sequelize[_0x1ccc('0x3')]},'type':{'type':Sequelize['ENUM']('twilio',_0x1ccc('0x5'))},'accountSid':{'type':Sequelize[_0x1ccc('0x3')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x1ccc('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x1ccc('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x1ccc('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1ccc('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1ccc('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1ccc('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1ccc('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1ccc('0x8')],'comment':_0x1ccc('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x1ccc('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x23f57a){if(!_0x23f57a){this[_0x1ccc('0xa')]('mandatoryDispositionPauseId',null);}this['setDataValue'](_0x1ccc('0xb'),_0x23f57a);}},'description':{'type':Sequelize[_0x1ccc('0x3')]}}; \ No newline at end of file +var _0x3f54=['name','generate','ENUM','sinch','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','sequelize','randomstring','exports','STRING'];(function(_0xdd9669,_0xa191e0){var _0x295444=function(_0x3beda1){while(--_0x3beda1){_0xdd9669['push'](_0xdd9669['shift']());}};_0x295444(++_0xa191e0);}(_0x3f54,0x1b6));var _0x43f5=function(_0x52666e,_0x5b3776){_0x52666e=_0x52666e-0x0;var _0x515330=_0x3f54[_0x52666e];return _0x515330;};'use strict';var Sequelize=require(_0x43f5('0x0'));var rs=require(_0x43f5('0x1'));module[_0x43f5('0x2')]={'name':{'type':Sequelize[_0x43f5('0x3')],'unique':_0x43f5('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x43f5('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x43f5('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x43f5('0x3')],'defaultValue':function(){return rs[_0x43f5('0x5')]();}},'phone':{'type':Sequelize[_0x43f5('0x3')]},'type':{'type':Sequelize[_0x43f5('0x6')]('twilio',_0x43f5('0x7'))},'accountSid':{'type':Sequelize[_0x43f5('0x3')]},'baseUrl':{'type':Sequelize[_0x43f5('0x3')]},'authToken':{'type':Sequelize[_0x43f5('0x3')]},'notificationTemplate':{'type':Sequelize[_0x43f5('0x8')],'defaultValue':function(){return _0x43f5('0x9');}},'notificationSound':{'type':Sequelize[_0x43f5('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x43f5('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x43f5('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x43f5('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x43f5('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x43f5('0xb')],'comment':_0x43f5('0xc')},'mandatoryDisposition':{'type':Sequelize[_0x43f5('0xa')],'defaultValue':![],'comment':_0x43f5('0xd'),'set':function(_0x559876){if(!_0x559876){this['setDataValue'](_0x43f5('0xe'),null);}this[_0x43f5('0xf')](_0x43f5('0x10'),_0x559876);}},'description':{'type':Sequelize[_0x43f5('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 7be5521..ba9d78b 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 _0xcb34=['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','../../mysqldb','redis','defaults','localhost','./whatsappAccount.socket','register','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','WhatsappAccounts','UserProfileResource','name','send','index','mandatoryDispositionPause','WhatsappAccount','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','Pause','keys','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','pick','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addAgents','omit','spread','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','User','order','addApplications','sequelize','transaction','WhatsappApplication','findAndCountAll','priority','stack','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','asc','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From','replace','whatsapp:','messageId','from','notifications','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','CmContact','Contacts','DESC','list','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','Messages','dataValues','eml-format','rimraf','fast-json-patch','moment','bluebird','util'];(function(_0x189978,_0x4c1e21){var _0x173046=function(_0x278932){while(--_0x278932){_0x189978['push'](_0x189978['shift']());}};_0x173046(++_0x4c1e21);}(_0xcb34,0x190));var _0x4cb3=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xcb34[_0x36884e];return _0x1cc367;};'use strict';var emlformat=require(_0x4cb3('0x0'));var rimraf=require(_0x4cb3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4cb3('0x2'));var rp=require('request-promise');var moment=require(_0x4cb3('0x3'));var BPromise=require(_0x4cb3('0x4'));var Mustache=require('mustache');var util=require(_0x4cb3('0x5'));var path=require('path');var sox=require(_0x4cb3('0x6'));var csv=require(_0x4cb3('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4cb3('0x8'));var _=require('lodash');var squel=require(_0x4cb3('0x9'));var crypto=require(_0x4cb3('0xa'));var jsforce=require(_0x4cb3('0xb'));var deskjs=require(_0x4cb3('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4cb3('0xd'));var Papa=require(_0x4cb3('0xe'));var Redis=require(_0x4cb3('0xf'));var authService=require(_0x4cb3('0x10'));var qs=require(_0x4cb3('0x11'));var as=require(_0x4cb3('0x12'));var hardwareService=require(_0x4cb3('0x13'));var logger=require(_0x4cb3('0x14'))(_0x4cb3('0x15'));var utils=require(_0x4cb3('0x16'));var config=require(_0x4cb3('0x17'));var licenseUtil=require(_0x4cb3('0x18'));var db=require(_0x4cb3('0x19'))['db'];config[_0x4cb3('0x1a')]=_[_0x4cb3('0x1b')](config[_0x4cb3('0x1a')],{'host':_0x4cb3('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4cb3('0x1d'))[_0x4cb3('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4cb3('0x1f')][_0x4cb3('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x560c78,_0x3f7c43,_0x3a6b77,_0x88c87d){return new BPromise(function(_0x169b33,_0x398201){var _0xd10cb8=_0x88c87d||client;return _0xd10cb8[_0x4cb3('0x21')](_0x560c78,_0x3a6b77)[_0x4cb3('0x22')](function(_0x1118c2){logger[_0x4cb3('0x23')](_0x4cb3('0x24'),_0x3f7c43,_0x4cb3('0x25'));logger[_0x4cb3('0x26')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x3f7c43,_0x4cb3('0x25'),JSON['stringify'](_0x1118c2));if(_0x1118c2['error']){if(_0x1118c2[_0x4cb3('0x27')]['code']===0x1f4){logger[_0x4cb3('0x27')](_0x4cb3('0x24'),_0x3f7c43,_0x1118c2[_0x4cb3('0x27')][_0x4cb3('0x28')]);return _0x398201(_0x1118c2['error']['message']);}logger[_0x4cb3('0x27')](_0x4cb3('0x24'),_0x3f7c43,_0x1118c2[_0x4cb3('0x27')]['message']);return _0x169b33(_0x1118c2[_0x4cb3('0x27')]['message']);}else{logger[_0x4cb3('0x23')](_0x4cb3('0x24'),_0x3f7c43,_0x4cb3('0x25'));_0x169b33(_0x1118c2[_0x4cb3('0x29')][_0x4cb3('0x28')]);}})[_0x4cb3('0x2a')](function(_0x4b8912){logger['error'](_0x4cb3('0x24'),_0x3f7c43,_0x4b8912);_0x398201(_0x4b8912);});});}function respondWithStatusCode(_0xb449d8,_0xace990){_0xace990=_0xace990||0xcc;return function(_0x2decf8){if(_0x2decf8){return _0xb449d8[_0x4cb3('0x2b')](_0xace990);}return _0xb449d8[_0x4cb3('0x2c')](_0xace990)[_0x4cb3('0x2d')]();};}function respondWithResult(_0x5aab78,_0xc65683){_0xc65683=_0xc65683||0xc8;return function(_0x4ec4d5){if(_0x4ec4d5){return _0x5aab78[_0x4cb3('0x2c')](_0xc65683)['json'](_0x4ec4d5);}};}function respondWithFilteredResult(_0x4f6271,_0x32c0ca){return function(_0xa2ba3e){if(_0xa2ba3e){var _0x239bc2=typeof _0x32c0ca[_0x4cb3('0x2e')]===_0x4cb3('0x2f')&&typeof _0x32c0ca[_0x4cb3('0x30')]===_0x4cb3('0x2f');var _0x4f62d1=_0xa2ba3e[_0x4cb3('0x31')];var _0x4ce24d=_0x239bc2?0x0:_0x32c0ca[_0x4cb3('0x2e')];var _0x312bd9=_0x239bc2?_0xa2ba3e[_0x4cb3('0x31')]:_0x32c0ca[_0x4cb3('0x2e')]+_0x32c0ca['limit'];var _0x36c475;if(_0x312bd9>=_0x4f62d1){_0x312bd9=_0x4f62d1;_0x36c475=0xc8;}else{_0x36c475=0xce;}_0x4f6271[_0x4cb3('0x2c')](_0x36c475);return _0x4f6271[_0x4cb3('0x32')](_0x4cb3('0x33'),_0x4ce24d+'-'+_0x312bd9+'/'+_0x4f62d1)[_0x4cb3('0x34')](_0xa2ba3e);}return null;};}function patchUpdates(_0x5dd9b1){return function(_0x28c19c){try{jsonpatch[_0x4cb3('0x35')](_0x28c19c,_0x5dd9b1,!![]);}catch(_0x5d3244){return BPromise['reject'](_0x5d3244);}return _0x28c19c[_0x4cb3('0x36')]();};}function saveUpdates(_0x48b2ba,_0x2261d4){return function(_0x5a4793){if(_0x5a4793){return _0x5a4793[_0x4cb3('0x37')](_0x48b2ba)['then'](function(_0x48d975){return _0x48d975;});}return null;};}function removeEntity(_0x105d7d,_0xedf447){return function(_0x1d218f){if(_0x1d218f){return _0x1d218f[_0x4cb3('0x38')]()[_0x4cb3('0x22')](function(){var _0x1d5886=_0x1d218f['get']({'plain':!![]});var _0x4f91c3=_0x4cb3('0x39');return db[_0x4cb3('0x3a')]['destroy']({'where':{'type':_0x4f91c3,'resourceId':_0x1d5886['id']}})['then'](function(){return _0x1d218f;});})['then'](function(){_0x105d7d['status'](0xcc)[_0x4cb3('0x2d')]();});}};}function handleEntityNotFound(_0x145c3c,_0x3fc75d){return function(_0x5697ce){if(!_0x5697ce){_0x145c3c[_0x4cb3('0x2b')](0x194);}return _0x5697ce;};}function handleError(_0x8f15c8,_0x3b9054){_0x3b9054=_0x3b9054||0x1f4;return function(_0x14359c){logger[_0x4cb3('0x27')](_0x14359c['stack']);if(_0x14359c['name']){delete _0x14359c[_0x4cb3('0x3b')];}_0x8f15c8['status'](_0x3b9054)[_0x4cb3('0x3c')](_0x14359c);};}exports[_0x4cb3('0x3d')]=function(_0x15e735,_0xecebba){var _0x20c754={'include':[{'model':db['Pause'],'as':_0x4cb3('0x3e')}]},_0x175b1a={},_0x4ea75c={'count':0x0,'rows':[]};var _0x51f8c2=_['map'](db[_0x4cb3('0x3f')]['rawAttributes'],function(_0x27e99f){return{'name':_0x27e99f[_0x4cb3('0x40')],'type':_0x27e99f[_0x4cb3('0x41')][_0x4cb3('0x42')]};});_0x175b1a[_0x4cb3('0x43')]=_[_0x4cb3('0x44')](_0x51f8c2,_0x4cb3('0x3b'));_0x175b1a[_0x4cb3('0x45')]=_['keys'](_0x15e735[_0x4cb3('0x45')]);_0x175b1a['filters']=_[_0x4cb3('0x46')](_0x175b1a[_0x4cb3('0x43')],_0x175b1a[_0x4cb3('0x45')]);_0x20c754[_0x4cb3('0x47')]=_[_0x4cb3('0x46')](_0x175b1a[_0x4cb3('0x43')],qs['fields'](_0x15e735[_0x4cb3('0x45')][_0x4cb3('0x48')]));_0x20c754[_0x4cb3('0x47')]=_0x20c754[_0x4cb3('0x47')][_0x4cb3('0x49')]?_0x20c754[_0x4cb3('0x47')]:_0x175b1a[_0x4cb3('0x43')];if(!_0x15e735[_0x4cb3('0x45')][_0x4cb3('0x4a')](_0x4cb3('0x4b'))){_0x20c754[_0x4cb3('0x30')]=qs[_0x4cb3('0x30')](_0x15e735[_0x4cb3('0x45')][_0x4cb3('0x30')]);_0x20c754[_0x4cb3('0x2e')]=qs[_0x4cb3('0x2e')](_0x15e735[_0x4cb3('0x45')][_0x4cb3('0x2e')]);}_0x20c754['order']=qs[_0x4cb3('0x4c')](_0x15e735[_0x4cb3('0x45')]['sort']);_0x20c754[_0x4cb3('0x4d')]=qs[_0x4cb3('0x4e')](_['pick'](_0x15e735[_0x4cb3('0x45')],_0x175b1a[_0x4cb3('0x4e')]),_0x51f8c2);if(_0x15e735[_0x4cb3('0x45')][_0x4cb3('0x4f')]){_0x20c754[_0x4cb3('0x4d')]=_[_0x4cb3('0x50')](_0x20c754[_0x4cb3('0x4d')],{'$or':_[_0x4cb3('0x44')](_0x51f8c2,function(_0x44852b){if(_0x44852b[_0x4cb3('0x41')]!==_0x4cb3('0x51')){var _0x1f1836={};_0x1f1836[_0x44852b[_0x4cb3('0x3b')]]={'$like':'%'+_0x15e735[_0x4cb3('0x45')][_0x4cb3('0x4f')]+'%'};return _0x1f1836;}})});}_0x20c754=_[_0x4cb3('0x50')]({},_0x20c754,_0x15e735[_0x4cb3('0x52')]);var _0xdb28b0={'where':_0x20c754[_0x4cb3('0x4d')]};return db[_0x4cb3('0x3f')][_0x4cb3('0x31')](_0xdb28b0)['then'](function(_0x1a1f16){_0x4ea75c[_0x4cb3('0x31')]=_0x1a1f16;if(_0x15e735['query'][_0x4cb3('0x53')]){_0x20c754[_0x4cb3('0x54')]=[{'all':!![]}];}return db[_0x4cb3('0x3f')][_0x4cb3('0x55')](_0x20c754);})[_0x4cb3('0x22')](function(_0x1f9aca){_0x4ea75c[_0x4cb3('0x56')]=_0x1f9aca;return _0x4ea75c;})[_0x4cb3('0x22')](respondWithFilteredResult(_0xecebba,_0x20c754))['catch'](handleError(_0xecebba,null));};exports[_0x4cb3('0x57')]=function(_0x111a77,_0x5dee3a){var _0x77c653={'raw':![],'where':{'id':_0x111a77['params']['id']},'include':[{'model':db[_0x4cb3('0x58')],'as':_0x4cb3('0x3e')}]},_0x4dbd4a={};_0x4dbd4a[_0x4cb3('0x43')]=_[_0x4cb3('0x59')](db[_0x4cb3('0x3f')][_0x4cb3('0x5a')]);_0x4dbd4a[_0x4cb3('0x45')]=_[_0x4cb3('0x59')](_0x111a77[_0x4cb3('0x45')]);_0x4dbd4a[_0x4cb3('0x4e')]=_[_0x4cb3('0x46')](_0x4dbd4a[_0x4cb3('0x43')],_0x4dbd4a['query']);_0x77c653['attributes']=_[_0x4cb3('0x46')](_0x4dbd4a[_0x4cb3('0x43')],qs['fields'](_0x111a77['query'][_0x4cb3('0x48')]));_0x77c653['attributes']=_0x77c653[_0x4cb3('0x47')]['length']?_0x77c653[_0x4cb3('0x47')]:_0x4dbd4a[_0x4cb3('0x43')];if(_0x111a77[_0x4cb3('0x45')][_0x4cb3('0x53')]){_0x77c653[_0x4cb3('0x54')]=[{'all':!![]}];}_0x77c653=_['merge']({},_0x77c653,_0x111a77[_0x4cb3('0x52')]);return db[_0x4cb3('0x3f')][_0x4cb3('0x5b')](_0x77c653)[_0x4cb3('0x22')](handleEntityNotFound(_0x5dee3a,null))[_0x4cb3('0x22')](respondWithResult(_0x5dee3a,null))[_0x4cb3('0x2a')](handleError(_0x5dee3a,null));};exports[_0x4cb3('0x5c')]=function(_0xbff8a8,_0x51dbce){return db[_0x4cb3('0x3f')][_0x4cb3('0x5c')](_0xbff8a8[_0x4cb3('0x5d')],{})[_0x4cb3('0x22')](function(_0xc0547a){var _0x5bbf52=_0xbff8a8[_0x4cb3('0x5e')][_0x4cb3('0x5f')]({'plain':!![]});if(!_0x5bbf52)throw new Error(_0x4cb3('0x60'));if(_0x5bbf52[_0x4cb3('0x61')]==='user'){var _0x547379=_0xc0547a[_0x4cb3('0x5f')]({'plain':!![]});var _0x35879c=_0x4cb3('0x39');return db['UserProfileSection'][_0x4cb3('0x5b')]({'where':{'name':_0x35879c,'userProfileId':_0x5bbf52[_0x4cb3('0x62')]},'raw':!![]})[_0x4cb3('0x22')](function(_0x25e991){if(_0x25e991&&_0x25e991['autoAssociation']===0x0){return db[_0x4cb3('0x3a')][_0x4cb3('0x5c')]({'name':_0x547379[_0x4cb3('0x3b')],'resourceId':_0x547379['id'],'type':_0x25e991[_0x4cb3('0x3b')],'sectionId':_0x25e991['id']},{})[_0x4cb3('0x22')](function(){return _0xc0547a;});}else{return _0xc0547a;}})['catch'](function(_0x6da4a5){logger[_0x4cb3('0x27')](_0x4cb3('0x63'),_0x6da4a5);throw _0x6da4a5;});}return _0xc0547a;})['then'](respondWithResult(_0x51dbce,0xc9))[_0x4cb3('0x2a')](handleError(_0x51dbce,null));};exports[_0x4cb3('0x37')]=function(_0x3414df,_0x5b070f){if(_0x3414df['body']['id']){delete _0x3414df[_0x4cb3('0x5d')]['id'];}return db['WhatsappAccount'][_0x4cb3('0x5b')]({'where':{'id':_0x3414df[_0x4cb3('0x64')]['id']},'include':[{'model':db['Pause'],'as':_0x4cb3('0x3e')}]})[_0x4cb3('0x22')](handleEntityNotFound(_0x5b070f,null))[_0x4cb3('0x22')](saveUpdates(_0x3414df[_0x4cb3('0x5d')],null))[_0x4cb3('0x22')](respondWithResult(_0x5b070f,null))[_0x4cb3('0x2a')](handleError(_0x5b070f,null));};exports[_0x4cb3('0x38')]=function(_0x4396d3,_0x42189e){return db[_0x4cb3('0x3f')][_0x4cb3('0x5b')]({'where':{'id':_0x4396d3[_0x4cb3('0x64')]['id']}})[_0x4cb3('0x22')](handleEntityNotFound(_0x42189e,null))[_0x4cb3('0x22')](removeEntity(_0x42189e,null))[_0x4cb3('0x2a')](handleError(_0x42189e,null));};exports[_0x4cb3('0x65')]=function(_0x504d12,_0x175db2){return db['WhatsappAccount'][_0x4cb3('0x65')]()[_0x4cb3('0x22')](respondWithResult(_0x175db2,null))[_0x4cb3('0x2a')](handleError(_0x175db2,null));};exports[_0x4cb3('0x66')]=function(_0x2d2f19,_0x130e2e,_0x2990f2){if(_0x2d2f19['body']['id']){delete _0x2d2f19[_0x4cb3('0x5d')]['id'];}return db['WhatsappAccount'][_0x4cb3('0x5b')]({'where':{'id':_0x2d2f19[_0x4cb3('0x64')]['id']}})[_0x4cb3('0x22')](handleEntityNotFound(_0x130e2e,null))[_0x4cb3('0x22')](function(_0x1bf266){if(_0x1bf266){_0x2d2f19[_0x4cb3('0x5d')][_0x4cb3('0x67')]=_0x1bf266['id'];return db[_0x4cb3('0x68')][_0x4cb3('0x5c')](_0x2d2f19[_0x4cb3('0x5d')]);}})[_0x4cb3('0x22')](respondWithResult(_0x130e2e,null))['catch'](handleError(_0x130e2e,null));};exports[_0x4cb3('0x69')]=function(_0x50b653,_0x7c7610,_0x2d696b){var _0x2c5f57={'raw':![],'where':{}};var _0x3ae42a={};var _0x2a12b8={'count':0x0,'rows':[]};return db[_0x4cb3('0x3f')][_0x4cb3('0x6a')]({'where':{'id':_0x50b653[_0x4cb3('0x64')]['id']}})[_0x4cb3('0x22')](handleEntityNotFound(_0x7c7610,null))[_0x4cb3('0x22')](function(_0x423ed3){if(_0x423ed3){_0x3ae42a['model']=_[_0x4cb3('0x59')](db['Disposition'][_0x4cb3('0x5a')]);_0x3ae42a[_0x4cb3('0x45')]=_[_0x4cb3('0x59')](_0x50b653[_0x4cb3('0x45')]);_0x3ae42a[_0x4cb3('0x4e')]=_[_0x4cb3('0x46')](_0x3ae42a['model'],_0x3ae42a['query']);_0x2c5f57[_0x4cb3('0x47')]=_[_0x4cb3('0x46')](_0x3ae42a['model'],qs['fields'](_0x50b653[_0x4cb3('0x45')][_0x4cb3('0x48')]));_0x2c5f57[_0x4cb3('0x47')]=_0x2c5f57[_0x4cb3('0x47')][_0x4cb3('0x49')]?_0x2c5f57['attributes']:_0x3ae42a[_0x4cb3('0x43')];if(!_0x50b653['query']['hasOwnProperty'](_0x4cb3('0x4b'))){_0x2c5f57[_0x4cb3('0x30')]=qs[_0x4cb3('0x30')](_0x50b653['query'][_0x4cb3('0x30')]);_0x2c5f57['offset']=qs[_0x4cb3('0x2e')](_0x50b653[_0x4cb3('0x45')]['offset']);}_0x2c5f57['order']=qs[_0x4cb3('0x4c')](_0x50b653['query'][_0x4cb3('0x4c')]);_0x2c5f57[_0x4cb3('0x4d')]=qs[_0x4cb3('0x4e')](_[_0x4cb3('0x6b')](_0x50b653[_0x4cb3('0x45')],_0x3ae42a['filters']));_0x2c5f57[_0x4cb3('0x4d')]['WhatsappAccountId']=_0x423ed3['id'];if(_0x50b653[_0x4cb3('0x45')][_0x4cb3('0x4f')]){_0x2c5f57[_0x4cb3('0x4d')]=_[_0x4cb3('0x50')](_0x2c5f57[_0x4cb3('0x4d')],{'$or':_[_0x4cb3('0x44')](_0x2c5f57['attributes'],function(_0x9b76a0){var _0xc56879={};_0xc56879[_0x9b76a0]={'$like':'%'+_0x50b653[_0x4cb3('0x45')][_0x4cb3('0x4f')]+'%'};return _0xc56879;})});}_0x2c5f57=_[_0x4cb3('0x50')]({},_0x2c5f57,_0x50b653[_0x4cb3('0x52')]);return db['Disposition'][_0x4cb3('0x31')]({'where':_0x2c5f57['where']})[_0x4cb3('0x22')](function(_0x4338ba){_0x2a12b8[_0x4cb3('0x31')]=_0x4338ba;if(_0x50b653[_0x4cb3('0x45')][_0x4cb3('0x53')]){_0x2c5f57[_0x4cb3('0x54')]=[{'all':!![]}];}return db[_0x4cb3('0x68')]['findAll'](_0x2c5f57);})[_0x4cb3('0x22')](function(_0x249ecd){_0x2a12b8['rows']=_0x249ecd;return _0x2a12b8;});}})[_0x4cb3('0x22')](respondWithFilteredResult(_0x7c7610,_0x2c5f57))[_0x4cb3('0x2a')](handleError(_0x7c7610,null));};exports[_0x4cb3('0x6c')]=function(_0xb6c28f,_0x25f9e9,_0x4111d3){return db[_0x4cb3('0x3f')][_0x4cb3('0x5b')]({'where':{'id':_0xb6c28f['params']['id']}})[_0x4cb3('0x22')](handleEntityNotFound(_0x25f9e9,null))[_0x4cb3('0x22')](function(_0x725347){if(_0x725347){return _0x725347[_0x4cb3('0x6c')](_0xb6c28f[_0x4cb3('0x45')][_0x4cb3('0x6d')]);}})['then'](respondWithStatusCode(_0x25f9e9,null))[_0x4cb3('0x2a')](handleError(_0x25f9e9,null));};exports[_0x4cb3('0x6e')]=function(_0x687cfd,_0x500a39,_0x2c63c6){if(_0x687cfd[_0x4cb3('0x5d')]['id']){delete _0x687cfd[_0x4cb3('0x5d')]['id'];}return db[_0x4cb3('0x3f')]['find']({'where':{'id':_0x687cfd[_0x4cb3('0x64')]['id']}})[_0x4cb3('0x22')](handleEntityNotFound(_0x500a39,null))[_0x4cb3('0x22')](function(_0x32876b){if(_0x32876b){_0x687cfd['body'][_0x4cb3('0x67')]=_0x32876b['id'];return db['CannedAnswer'][_0x4cb3('0x5c')](_0x687cfd['body']);}})['then'](respondWithResult(_0x500a39,null))[_0x4cb3('0x2a')](handleError(_0x500a39,null));};exports[_0x4cb3('0x6f')]=function(_0x14b77f,_0x5f5393,_0x4d42cf){var _0x33c54a={'raw':![],'where':{}};var _0x1f0eca={};var _0x514d90={'count':0x0,'rows':[]};return db[_0x4cb3('0x3f')][_0x4cb3('0x6a')]({'where':{'id':_0x14b77f[_0x4cb3('0x64')]['id']}})[_0x4cb3('0x22')](handleEntityNotFound(_0x5f5393,null))[_0x4cb3('0x22')](function(_0x64c908){if(_0x64c908){_0x1f0eca[_0x4cb3('0x43')]=_['keys'](db['CannedAnswer']['rawAttributes']);_0x1f0eca['query']=_[_0x4cb3('0x59')](_0x14b77f[_0x4cb3('0x45')]);_0x1f0eca[_0x4cb3('0x4e')]=_[_0x4cb3('0x46')](_0x1f0eca[_0x4cb3('0x43')],_0x1f0eca[_0x4cb3('0x45')]);_0x33c54a[_0x4cb3('0x47')]=_['intersection'](_0x1f0eca[_0x4cb3('0x43')],qs[_0x4cb3('0x48')](_0x14b77f[_0x4cb3('0x45')][_0x4cb3('0x48')]));_0x33c54a[_0x4cb3('0x47')]=_0x33c54a[_0x4cb3('0x47')]['length']?_0x33c54a[_0x4cb3('0x47')]:_0x1f0eca[_0x4cb3('0x43')];if(!_0x14b77f[_0x4cb3('0x45')][_0x4cb3('0x4a')](_0x4cb3('0x4b'))){_0x33c54a['limit']=qs[_0x4cb3('0x30')](_0x14b77f[_0x4cb3('0x45')][_0x4cb3('0x30')]);_0x33c54a['offset']=qs['offset'](_0x14b77f[_0x4cb3('0x45')][_0x4cb3('0x2e')]);}_0x33c54a['order']=qs[_0x4cb3('0x4c')](_0x14b77f[_0x4cb3('0x45')][_0x4cb3('0x4c')]);_0x33c54a['where']=qs[_0x4cb3('0x4e')](_[_0x4cb3('0x6b')](_0x14b77f[_0x4cb3('0x45')],_0x1f0eca[_0x4cb3('0x4e')]));_0x33c54a[_0x4cb3('0x4d')][_0x4cb3('0x67')]=_0x64c908['id'];if(_0x14b77f[_0x4cb3('0x45')][_0x4cb3('0x4f')]){_0x33c54a[_0x4cb3('0x4d')]=_[_0x4cb3('0x50')](_0x33c54a[_0x4cb3('0x4d')],{'$or':_[_0x4cb3('0x44')](_0x33c54a[_0x4cb3('0x47')],function(_0x524fc6){var _0x235629={};_0x235629[_0x524fc6]={'$like':'%'+_0x14b77f[_0x4cb3('0x45')]['filter']+'%'};return _0x235629;})});}_0x33c54a=_['merge']({},_0x33c54a,_0x14b77f[_0x4cb3('0x52')]);return db[_0x4cb3('0x70')][_0x4cb3('0x31')]({'where':_0x33c54a[_0x4cb3('0x4d')]})[_0x4cb3('0x22')](function(_0x194f83){_0x514d90[_0x4cb3('0x31')]=_0x194f83;if(_0x14b77f[_0x4cb3('0x45')][_0x4cb3('0x53')]){_0x33c54a[_0x4cb3('0x54')]=[{'all':!![]}];}return db[_0x4cb3('0x70')][_0x4cb3('0x55')](_0x33c54a);})['then'](function(_0x1bc0d5){_0x514d90[_0x4cb3('0x56')]=_0x1bc0d5;return _0x514d90;});}})[_0x4cb3('0x22')](respondWithFilteredResult(_0x5f5393,_0x33c54a))['catch'](handleError(_0x5f5393,null));};exports[_0x4cb3('0x71')]=function(_0x39dedc,_0x1084e8,_0x4b81ab){return db[_0x4cb3('0x3f')]['find']({'where':{'id':_0x39dedc[_0x4cb3('0x64')]['id']}})[_0x4cb3('0x22')](handleEntityNotFound(_0x1084e8,null))[_0x4cb3('0x22')](function(_0x482c92){if(_0x482c92){return _0x482c92[_0x4cb3('0x71')](_0x39dedc[_0x4cb3('0x45')][_0x4cb3('0x6d')]);}})[_0x4cb3('0x22')](respondWithStatusCode(_0x1084e8,null))['catch'](handleError(_0x1084e8,null));};exports['addAgents']=function(_0x5544f5,_0x27a9b0,_0x586da1){return db[_0x4cb3('0x3f')]['find']({'where':{'id':_0x5544f5['params']['id']}})['then'](handleEntityNotFound(_0x27a9b0,null))[_0x4cb3('0x22')](function(_0x2cfaf1){if(_0x2cfaf1){return _0x2cfaf1[_0x4cb3('0x72')](_0x5544f5[_0x4cb3('0x5d')]['ids'],_[_0x4cb3('0x73')](_0x5544f5[_0x4cb3('0x5d')],['ids','id'])||{})[_0x4cb3('0x74')](function(_0x1101d5){for(var _0x253055=0x0;_0x253055<_0x5544f5[_0x4cb3('0x5d')][_0x4cb3('0x6d')]['length'];_0x253055+=0x1){socket['emit'](_0x4cb3('0x75'),{'UserId':Number(_0x5544f5[_0x4cb3('0x5d')]['ids'][_0x253055]),'WhatsappAccountId':Number(_0x5544f5['params']['id'])});}return _0x1101d5;});}})[_0x4cb3('0x22')](respondWithResult(_0x27a9b0,null))['catch'](handleError(_0x27a9b0,null));};exports[_0x4cb3('0x76')]=function(_0x3548ed,_0x2b121c,_0x317a95){return db[_0x4cb3('0x3f')][_0x4cb3('0x5b')]({'where':{'id':_0x3548ed[_0x4cb3('0x64')]['id']}})[_0x4cb3('0x22')](handleEntityNotFound(_0x2b121c,null))[_0x4cb3('0x22')](function(_0x194bce){if(_0x194bce){return _0x194bce[_0x4cb3('0x76')](_0x3548ed[_0x4cb3('0x45')]['ids'])[_0x4cb3('0x22')](function(){if(_[_0x4cb3('0x77')](_0x3548ed[_0x4cb3('0x45')][_0x4cb3('0x6d')])){for(var _0x142d5f=0x0;_0x142d5f<_0x3548ed[_0x4cb3('0x45')][_0x4cb3('0x6d')][_0x4cb3('0x49')];_0x142d5f+=0x1){socket[_0x4cb3('0x78')]('userWhatsappAccount:remove',{'UserId':Number(_0x3548ed[_0x4cb3('0x45')][_0x4cb3('0x6d')][_0x142d5f]),'WhatsappAccountId':Number(_0x3548ed[_0x4cb3('0x64')]['id'])});}}else{socket[_0x4cb3('0x78')](_0x4cb3('0x79'),{'UserId':Number(_0x3548ed[_0x4cb3('0x45')][_0x4cb3('0x6d')]),'WhatsappAccountId':Number(_0x3548ed[_0x4cb3('0x64')]['id'])});}});}})[_0x4cb3('0x22')](respondWithStatusCode(_0x2b121c,null))[_0x4cb3('0x2a')](handleError(_0x2b121c,null));};exports[_0x4cb3('0x7a')]=function(_0x56b1df,_0x14495a,_0x179b77){var _0x4f2d19={};var _0xce6289={};var _0x12cf88;var _0x507ce1;return db['WhatsappAccount']['findOne']({'where':{'id':_0x56b1df[_0x4cb3('0x64')]['id']}})[_0x4cb3('0x22')](handleEntityNotFound(_0x14495a,null))[_0x4cb3('0x22')](function(_0x50773e){if(_0x50773e){_0x12cf88=_0x50773e;_0xce6289[_0x4cb3('0x43')]=_[_0x4cb3('0x59')](db[_0x4cb3('0x7b')]['rawAttributes']);_0xce6289[_0x4cb3('0x45')]=_[_0x4cb3('0x59')](_0x56b1df[_0x4cb3('0x45')]);_0xce6289[_0x4cb3('0x4e')]=_['intersection'](_0xce6289['model'],_0xce6289[_0x4cb3('0x45')]);_0x4f2d19[_0x4cb3('0x47')]=_[_0x4cb3('0x46')](_0xce6289[_0x4cb3('0x43')],qs[_0x4cb3('0x48')](_0x56b1df[_0x4cb3('0x45')][_0x4cb3('0x48')]));_0x4f2d19[_0x4cb3('0x47')]=_0x4f2d19[_0x4cb3('0x47')]['length']?_0x4f2d19[_0x4cb3('0x47')]:_0xce6289[_0x4cb3('0x43')];_0x4f2d19[_0x4cb3('0x7c')]=qs[_0x4cb3('0x4c')](_0x56b1df[_0x4cb3('0x45')][_0x4cb3('0x4c')]);_0x4f2d19[_0x4cb3('0x4d')]=qs['filters'](_[_0x4cb3('0x6b')](_0x56b1df['query'],_0xce6289[_0x4cb3('0x4e')]));if(_0x56b1df[_0x4cb3('0x45')][_0x4cb3('0x4f')]){_0x4f2d19['where']=_[_0x4cb3('0x50')](_0x4f2d19['where'],{'$or':_['map'](_0x4f2d19[_0x4cb3('0x47')],function(_0x2aaba8){var _0xd944d0={};_0xd944d0[_0x2aaba8]={'$like':'%'+_0x56b1df[_0x4cb3('0x45')][_0x4cb3('0x4f')]+'%'};return _0xd944d0;})});}_0x4f2d19=_['merge']({},_0x4f2d19,_0x56b1df[_0x4cb3('0x52')]);return _0x12cf88[_0x4cb3('0x7a')](_0x4f2d19);}})[_0x4cb3('0x22')](function(_0x27d039){if(_0x27d039){_0x507ce1=_0x27d039['length'];if(!_0x56b1df['query'][_0x4cb3('0x4a')](_0x4cb3('0x4b'))){_0x4f2d19[_0x4cb3('0x30')]=qs[_0x4cb3('0x30')](_0x56b1df['query'][_0x4cb3('0x30')]);_0x4f2d19[_0x4cb3('0x2e')]=qs[_0x4cb3('0x2e')](_0x56b1df[_0x4cb3('0x45')][_0x4cb3('0x2e')]);}return _0x12cf88['getAgents'](_0x4f2d19);}})[_0x4cb3('0x22')](function(_0xe5d736){if(_0xe5d736){return _0xe5d736?{'count':_0x507ce1,'rows':_0xe5d736}:null;}})['then'](respondWithResult(_0x14495a,null))[_0x4cb3('0x2a')](handleError(_0x14495a,null));};exports[_0x4cb3('0x7d')]=function(_0x5b6d55,_0x4db0ce){var _0x2b0b32=_0x5b6d55[_0x4cb3('0x64')]['id'];var _0x229ea3=_0x5b6d55[_0x4cb3('0x5d')];var _0xf655e=0xc8;var _0x1e19b2=null;return db[_0x4cb3('0x7e')][_0x4cb3('0x7f')]({'isolationLevel':db[_0x4cb3('0x7e')]['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x4381f1){return db['WhatsappAccount']['findOne']({'where':{'id':_0x2b0b32},'transaction':_0x4381f1})['then'](function(_0x5c0110){if(_0x5c0110){return db['WhatsappApplication'][_0x4cb3('0x38')]({'where':{'WhatsappAccountId':_0x2b0b32},'transaction':_0x4381f1})[_0x4cb3('0x22')](function(){var _0x308a45=_[_0x4cb3('0x44')](_0x229ea3,function(_0x4481a9){_0x4481a9[_0x4cb3('0x67')]=_0x2b0b32;return _0x4481a9;});return db[_0x4cb3('0x80')]['bulkCreate'](_0x308a45,{'transaction':_0x4381f1});});}else{_0xf655e=0x194;_0x1e19b2=[];}});})[_0x4cb3('0x22')](function(){if(_0xf655e!==0x194){return db[_0x4cb3('0x80')][_0x4cb3('0x81')]({'where':{'WhatsappAccountId':_0x2b0b32},'order':_0x4cb3('0x82')})[_0x4cb3('0x22')](function(_0x3b4ac0){_0x1e19b2=_0x3b4ac0;});}})[_0x4cb3('0x2a')](function(_0x274b91){_0xf655e=0x1f4;logger[_0x4cb3('0x27')](_0x274b91[_0x4cb3('0x83')]);if(_0x274b91['name']){delete _0x274b91[_0x4cb3('0x3b')];}_0x1e19b2=_0x274b91;})[_0x4cb3('0x84')](function(){if(_0x1e19b2===null){_0x4db0ce[_0x4cb3('0x2b')](_0xf655e);}else{if(_0xf655e===0x1f4){_0x4db0ce[_0x4cb3('0x2c')](_0xf655e)[_0x4cb3('0x3c')](_0x1e19b2);}else{_0x4db0ce[_0x4cb3('0x2c')](_0xf655e)['json'](_0x1e19b2);}}});};exports[_0x4cb3('0x85')]=function(_0x97d6ff,_0x5e496d,_0x4eca22){var _0x5a24c4={};var _0x3976bf={};var _0x46a466;var _0x3215af;return db['WhatsappAccount'][_0x4cb3('0x6a')]({'where':{'id':_0x97d6ff['params']['id']}})[_0x4cb3('0x22')](handleEntityNotFound(_0x5e496d,null))['then'](function(_0x4cd49f){if(_0x4cd49f){_0x46a466=_0x4cd49f;_0x3976bf[_0x4cb3('0x43')]=_['keys'](db[_0x4cb3('0x80')]['rawAttributes']);_0x3976bf['query']=_[_0x4cb3('0x59')](_0x97d6ff[_0x4cb3('0x45')]);_0x3976bf[_0x4cb3('0x4e')]=_[_0x4cb3('0x46')](_0x3976bf[_0x4cb3('0x43')],_0x3976bf['query']);_0x5a24c4[_0x4cb3('0x47')]=_[_0x4cb3('0x46')](_0x3976bf[_0x4cb3('0x43')],qs[_0x4cb3('0x48')](_0x97d6ff[_0x4cb3('0x45')][_0x4cb3('0x48')]));_0x5a24c4[_0x4cb3('0x47')]=_0x5a24c4[_0x4cb3('0x47')][_0x4cb3('0x49')]?_0x5a24c4[_0x4cb3('0x47')]:_0x3976bf[_0x4cb3('0x43')];_0x5a24c4['order']=qs['sort'](_0x97d6ff[_0x4cb3('0x45')][_0x4cb3('0x4c')]);_0x5a24c4['where']=qs[_0x4cb3('0x4e')](_[_0x4cb3('0x6b')](_0x97d6ff[_0x4cb3('0x45')],_0x3976bf[_0x4cb3('0x4e')]));if(_0x97d6ff[_0x4cb3('0x45')][_0x4cb3('0x4f')]){_0x5a24c4[_0x4cb3('0x4d')]=_['merge'](_0x5a24c4['where'],{'$or':_[_0x4cb3('0x44')](_0x5a24c4['attributes'],function(_0x446a38){var _0x21507a={};_0x21507a[_0x446a38]={'$like':'%'+_0x97d6ff[_0x4cb3('0x45')][_0x4cb3('0x4f')]+'%'};return _0x21507a;})});}_0x5a24c4=_[_0x4cb3('0x50')]({},_0x5a24c4,_0x97d6ff[_0x4cb3('0x52')]);return _0x46a466[_0x4cb3('0x85')](_0x5a24c4);}})[_0x4cb3('0x22')](function(_0x4d89f7){if(_0x4d89f7){_0x3215af=_0x4d89f7[_0x4cb3('0x49')];if(!_0x97d6ff[_0x4cb3('0x45')][_0x4cb3('0x4a')](_0x4cb3('0x4b'))){_0x5a24c4[_0x4cb3('0x30')]=qs[_0x4cb3('0x30')](_0x97d6ff[_0x4cb3('0x45')][_0x4cb3('0x30')]);_0x5a24c4[_0x4cb3('0x2e')]=qs[_0x4cb3('0x2e')](_0x97d6ff[_0x4cb3('0x45')][_0x4cb3('0x2e')]);}return _0x46a466['getApplications'](_0x5a24c4);}})[_0x4cb3('0x22')](function(_0x29ea17){if(_0x29ea17){return _0x29ea17?{'count':_0x3215af,'rows':_0x29ea17}:null;}})[_0x4cb3('0x22')](respondWithResult(_0x5e496d,null))[_0x4cb3('0x2a')](handleError(_0x5e496d,null));};exports[_0x4cb3('0x86')]=function(_0xcea1ae,_0xa6f10,_0x533985){var _0x2971e0={'channel':_0x4cb3('0x87')};var _0x4042a8=[];var _0x13b6dd=[];var _0x25c8da={};return db[_0x4cb3('0x3f')]['find']({'where':{'id':_0xcea1ae[_0x4cb3('0x64')]['id']},'include':[{'model':db[_0x4cb3('0x80')],'as':_0x4cb3('0x88')}]})[_0x4cb3('0x22')](handleEntityNotFound(_0xa6f10,null))[_0x4cb3('0x22')](function(_0x34b25f){_0x2971e0['account']=_0x34b25f;if(_0x2971e0[_0x4cb3('0x89')]&&_0x2971e0[_0x4cb3('0x89')][_0x4cb3('0x41')]===_0x4cb3('0x8a')&&_0xcea1ae[_0x4cb3('0x5d')][_0x4cb3('0x8b')]){if(_0xcea1ae['body'][_0x4cb3('0x8b')]['length']===0x0)return;if(_0xcea1ae[_0x4cb3('0x5d')][_0x4cb3('0x8b')][0x0][_0x4cb3('0x8c')]!==_0x4cb3('0x8d'))return;return db[_0x4cb3('0x8e')][_0x4cb3('0x37')]({'read':!![],'readAt':_0xcea1ae[_0x4cb3('0x5d')][_0x4cb3('0x8b')][0x0][_0x4cb3('0x8f')]},{'where':{'messageId':_0xcea1ae['body']['statuses'][0x0][_0x4cb3('0x90')]},'individualHooks':!![]})[_0x4cb3('0x22')](function(_0x2d10be){return _0xa6f10[_0x4cb3('0x2c')](0xc8)[_0x4cb3('0x34')](_0x2d10be);});}_0x2971e0[_0x4cb3('0x91')]=_[_0x4cb3('0x92')](_0x34b25f[_0x4cb3('0x88')],[_0x4cb3('0x82')],[_0x4cb3('0x93')]);if(_0x2971e0[_0x4cb3('0x89')][_0x4cb3('0x88')]){delete _0x2971e0[_0x4cb3('0x89')][_0x4cb3('0x88')];}return db['CmContact']['describe']()[_0x4cb3('0x22')](function(_0x3a0f9d){if(!_0x3a0f9d){throw new db['Sequelize'][(_0x4cb3('0x94'))](_0x4cb3('0x95'));}_0x4042a8=_[_0x4cb3('0x96')](_[_0x4cb3('0x59')](_0x3a0f9d),['createdAt','updatedAt']);_0x13b6dd=_[_0x4cb3('0x96')](_[_0x4cb3('0x59')](_0x3a0f9d),[_0x4cb3('0x97'),_0x4cb3('0x98'),_0x4cb3('0x99'),_0x4cb3('0x9a')]);_0x2971e0[_0x4cb3('0x5d')]={'mapKey':_0x4cb3('0x9b')};if(_0x2971e0[_0x4cb3('0x89')]&&_0x2971e0[_0x4cb3('0x89')][_0x4cb3('0x41')]===_0x4cb3('0x9c')){_0x2971e0['body']['from']=_0xcea1ae[_0x4cb3('0x5d')][_0x4cb3('0x9d')][_0x4cb3('0x9e')](_0x4cb3('0x9f'),'');_0x2971e0['body'][_0x4cb3('0x5d')]=_0xcea1ae[_0x4cb3('0x5d')]['Body'];_0x2971e0[_0x4cb3('0x5d')][_0x4cb3('0xa0')]=_0xcea1ae[_0x4cb3('0x5d')]['MessageSid'];}if(_0x2971e0[_0x4cb3('0x89')]&&_0x2971e0[_0x4cb3('0x89')][_0x4cb3('0x41')]===_0x4cb3('0x8a')){_0x2971e0['body'][_0x4cb3('0xa1')]=_0xcea1ae[_0x4cb3('0x5d')][_0x4cb3('0xa2')][0x0][_0x4cb3('0xa1')];_0x2971e0[_0x4cb3('0x5d')][_0x4cb3('0x5d')]=_0xcea1ae['body'][_0x4cb3('0xa2')][0x0][_0x4cb3('0x28')][_0x4cb3('0x5d')];_0x2971e0[_0x4cb3('0x5d')]['messageId']=_0xcea1ae[_0x4cb3('0x5d')][_0x4cb3('0xa2')][0x0][_0x4cb3('0x90')];}if(_0x2971e0[_0x4cb3('0x5d')]['id']){delete _0x2971e0[_0x4cb3('0x5d')]['id'];}if(_[_0x4cb3('0xa3')](_0x2971e0[_0x4cb3('0x5d')]['from'])){throw new db[(_0x4cb3('0xa4'))]['ValidationError'](_0x4cb3('0xa5'));}if(_[_0x4cb3('0xa3')](_0x2971e0['body'][_0x4cb3('0x5d')])||_0x2971e0[_0x4cb3('0x5d')][_0x4cb3('0x5d')]===''){throw new db[(_0x4cb3('0xa4'))][(_0x4cb3('0x94'))](_0x4cb3('0xa6'));}if(_[_0x4cb3('0xa3')](_0x2971e0[_0x4cb3('0x5d')][_0x4cb3('0xa7')])){throw new db[(_0x4cb3('0xa4'))]['ValidationError'](_0x4cb3('0xa8')+_0x13b6dd);}if(!_[_0x4cb3('0xa9')](_0x13b6dd,_0x2971e0[_0x4cb3('0x5d')]['mapKey'])){throw new db[(_0x4cb3('0xa4'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x13b6dd);}_0x25c8da[_0x2971e0[_0x4cb3('0x5d')]['mapKey']]=_0x2971e0[_0x4cb3('0x5d')][_0x4cb3('0xa1')];return db[_0x4cb3('0xaa')][_0x4cb3('0x5b')]({'where':{'id':_0x2971e0['account'][_0x4cb3('0x9a')]},'include':[{'model':db[_0x4cb3('0xab')],'as':_0x4cb3('0xac'),'where':_0x25c8da,'limit':0x1,'order':[[_0x4cb3('0x98'),_0x4cb3('0xad')]]}]});})[_0x4cb3('0x22')](handleEntityNotFound(_0xa6f10,null))[_0x4cb3('0x22')](function(_0x3c7ed3){if(_0x3c7ed3){_0x2971e0[_0x4cb3('0xae')]=_[_0x4cb3('0x73')](_0x3c7ed3,[_0x4cb3('0xac')]);if(_0x3c7ed3[_0x4cb3('0xac')]['length']){return _0x3c7ed3[_0x4cb3('0xac')][0x0];}var _0x2f8c79=_[_0x4cb3('0x1b')](_0x2971e0['body'],{'firstName':_0x2971e0[_0x4cb3('0x5d')][_0x4cb3('0xa1')],'ListId':_0x3c7ed3['id']});_0x2f8c79[_0x2971e0[_0x4cb3('0x5d')][_0x4cb3('0xa7')]]=_0x2971e0[_0x4cb3('0x5d')][_0x4cb3('0xa1')];return db[_0x4cb3('0xab')][_0x4cb3('0x5c')](_0x2f8c79,{'fields':_0x4042a8,'raw':!![]});}})['then'](handleEntityNotFound(_0xa6f10,null))[_0x4cb3('0x22')](function(_0x56dc78){if(_0x56dc78){_0x2971e0['contact']=_0x56dc78;var _0x5c2466={'ContactId':_0x56dc78['id'],'phone':_0x2971e0[_0x4cb3('0x5d')]['from'],'WhatsappAccountId':_0xcea1ae[_0x4cb3('0x64')]['id']};var _0x54facc={'ContactId':_0x56dc78['id'],'WhatsappAccountId':_0xcea1ae[_0x4cb3('0x64')]['id'],'closed':![]};return db[_0x4cb3('0xaf')][_0x4cb3('0x5b')]({'where':_0x54facc})[_0x4cb3('0x22')](function(_0x1e7e55){if(_0x1e7e55){return[_0x1e7e55,![]];}return db[_0x4cb3('0xaf')]['create'](_0x5c2466)[_0x4cb3('0x22')](function(_0xf37d46){return[_0xf37d46,!![]];});});}})[_0x4cb3('0x74')](function(_0xb166f6,_0x1fddb0){_0x2971e0['interaction']=_0xb166f6[_0x4cb3('0x5f')]({'plain':!![]});_0x2971e0[_0x4cb3('0xb0')][_0x4cb3('0xb1')]=![];if(_0x1fddb0){if(_0x2971e0[_0x4cb3('0x89')][_0x4cb3('0xb2')]){_0x2971e0['applications'][_0x4cb3('0xb3')]({'id':0x0,'priority':_0x2971e0[_0x4cb3('0x91')]['length']+0x1,'app':_0x4cb3('0xb4'),'appdata':_0x4cb3('0xb5'),'interval':_0x4cb3('0xb6')});}_0x2971e0[_0x4cb3('0xb0')][_0x4cb3('0xb1')]=!![];}return db[_0x4cb3('0x8e')][_0x4cb3('0x5c')]({'phone':_0x2971e0[_0x4cb3('0x5d')]['from'],'messageId':_0x2971e0[_0x4cb3('0x5d')][_0x4cb3('0xa0')],'body':_0x2971e0[_0x4cb3('0x5d')]['body'],'WhatsappAccountId':_0xcea1ae[_0x4cb3('0x64')]['id'],'WhatsappInteractionId':_0xb166f6['id'],'direction':'in','ContactId':_0xb166f6[_0x4cb3('0xb7')],'AttachmentId':_0x2971e0[_0x4cb3('0x5d')][_0x4cb3('0xb8')]});})['then'](function(_0x1416c9){_0x2971e0[_0x4cb3('0x28')]=_0x1416c9;if(_0x2971e0[_0x4cb3('0xb0')][_0x4cb3('0xb9')]){return db[_0x4cb3('0x7b')][_0x4cb3('0x5b')]({'attributes':['id',_0x4cb3('0x3b')],'where':{'id':_0x2971e0[_0x4cb3('0xb0')][_0x4cb3('0xb9')]}})['then'](function(_0x31e476){if(_0x31e476){_0x2971e0[_0x4cb3('0x91')][_0x4cb3('0xba')]({'id':0x0,'priority':0x0,'app':_0x4cb3('0xbb'),'appdata':_0x31e476[_0x4cb3('0x3b')]+','+(_0x2971e0[_0x4cb3('0x89')][_0x4cb3('0xbc')]||0xa),'interval':_0x4cb3('0xb6')});}return respondWithRpcPromise(_0x4cb3('0xbd'),_0x4cb3('0xbe'),_0x2971e0);});}return respondWithRpcPromise(_0x4cb3('0xbd'),_0x4cb3('0xbe'),_0x2971e0);})[_0x4cb3('0x22')](function(_0x257148){if(_0x257148){var _0x191d6d=0xc8;var _0x3c8543=_0x4cb3('0xbf');logger['info'](_0x4cb3('0xc0'),_0x3c8543,_0x191d6d,_0x4cb3('0xc1'));logger[_0x4cb3('0x26')](_0x4cb3('0xc2'),_0x3c8543,_0x191d6d,'entity\x20found',JSON[_0x4cb3('0xc3')](_0x257148));if(_0x2971e0[_0x4cb3('0x89')][_0x4cb3('0x41')]===_0x4cb3('0x9c')){return _0xa6f10[_0x4cb3('0x2c')](_0x191d6d)[_0x4cb3('0x32')](_0x4cb3('0xc4'),_0x4cb3('0xc5'))[_0x4cb3('0x3c')](_0x4cb3('0xc6'));}else{return _0xa6f10[_0x4cb3('0x2c')](_0x191d6d)[_0x4cb3('0x34')](_0x257148);}}});})['catch'](handleError(_0xa6f10,null));};exports[_0x4cb3('0x3c')]=function(_0x2fdd49,_0x10df70,_0x3012d9){var _0x487d5e,_0x59f838,_0x2fa3e0;if(_['isNil'](_0x2fdd49[_0x4cb3('0x5d')][_0x4cb3('0x5d')])||_0x2fdd49[_0x4cb3('0x5d')][_0x4cb3('0x5d')]===''){throw new db[(_0x4cb3('0xa4'))][(_0x4cb3('0x94'))](_0x4cb3('0xa6'));}if(_[_0x4cb3('0xa3')](_0x2fdd49[_0x4cb3('0x5d')]['to'])){throw new db[(_0x4cb3('0xa4'))][(_0x4cb3('0x94'))](_0x4cb3('0xc7'));}_0x487d5e=_0x2fdd49[_0x4cb3('0x5d')]['to'];return db[_0x4cb3('0x3f')]['find']({'where':{'id':_0x2fdd49['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x4cb3('0xab')],'as':_0x4cb3('0xac'),'where':{'mobile':_0x487d5e},'limit':0x1,'order':[[_0x4cb3('0x98'),'DESC']]}]}]})[_0x4cb3('0x22')](handleEntityNotFound(_0x10df70,null))[_0x4cb3('0x22')](function(_0x7abdbe){if(_0x7abdbe&&_0x7abdbe[_0x4cb3('0xc8')]){_0x59f838=_0x7abdbe[_0x4cb3('0x5f')]({'plain':!![]});if(_0x59f838[_0x4cb3('0xc8')]&&_0x59f838['List'][_0x4cb3('0xac')]['length']){return _0x59f838[_0x4cb3('0xc8')][_0x4cb3('0xac')][0x0];}return db[_0x4cb3('0xab')]['create'](_[_0x4cb3('0x1b')](_0x2fdd49[_0x4cb3('0x5d')],{'firstName':_0x487d5e,'mobile':_0x487d5e,'phone':_0x487d5e,'ListId':_0x59f838[_0x4cb3('0x9a')]}));}})[_0x4cb3('0x22')](handleEntityNotFound(_0x10df70,null))['then'](function(_0x584a07){if(_0x584a07){_0x2fa3e0=_0x584a07;return db['WhatsappInteraction'][_0x4cb3('0x5b')]({'where':{'ContactId':_0x2fa3e0['id'],'closed':![],'WhatsappAccountId':_0x59f838['id']}})[_0x4cb3('0x22')](function(_0x5e5d7f){if(_0x5e5d7f){return[_0x5e5d7f,![]];}return db[_0x4cb3('0xaf')][_0x4cb3('0x5c')]({'UserId':_0x2fdd49['user']['id'],'ContactId':_0x2fa3e0['id'],'WhatsappAccountId':_0x59f838['id'],'phone':_0x487d5e,'firstMsgDirection':'out','Messages':[_['merge'](_0x2fdd49[_0x4cb3('0x5d')],{'read':![],'body':_0x2fdd49[_0x4cb3('0x5d')][_0x4cb3('0x5d')],'phone':_0x487d5e,'WhatsappAccountId':_0x59f838['id'],'UserId':_0x2fdd49[_0x4cb3('0x5e')]['id'],'ContactId':_0x2fa3e0['id']})]},{'include':[{'model':db[_0x4cb3('0x8e')],'as':_0x4cb3('0xc9')}]})[_0x4cb3('0x22')](function(_0x171251){return[_0x171251,!![]];});});}})[_0x4cb3('0x74')](function(_0x2ae0e2,_0x468289){if(_0x468289){return _0x2ae0e2;}return db[_0x4cb3('0x8e')][_0x4cb3('0x5c')](_['merge'](_0x2fdd49[_0x4cb3('0x5d')],{'read':![],'body':_0x2fdd49['body'][_0x4cb3('0x5d')],'phone':_0x487d5e,'WhatsappAccountId':_0x59f838['id'],'WhatsappInteractionId':_0x2ae0e2['id'],'UserId':_0x2fdd49['user']['id'],'ContactId':_0x2fa3e0['id']}))[_0x4cb3('0x22')](function(_0x4adf89){_0x2ae0e2[_0x4cb3('0xca')][_0x4cb3('0xc9')]=[];_0x2ae0e2[_0x4cb3('0xca')][_0x4cb3('0xc9')]['push'](_0x4adf89[_0x4cb3('0xca')]);return _0x2ae0e2;});})[_0x4cb3('0x22')](respondWithResult(_0x10df70,null))['catch'](handleError(_0x10df70,null));}; \ No newline at end of file +var _0x2a3f=['bulkCreate','findAndCountAll','priority','finally','getApplications','notify','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','orderBy','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','MessageSid','notifications','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','CmList','Contacts','DESC','omit','contact','WhatsappInteraction','interaction','created','autoclose','applications','push','close','unmanaged','*,*,*,*','messageId','ContactId','AttachmentId','UserId','unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','to\x20is\x20mandatory','List','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','save','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','user','role','WhatsappAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','WhatsappAccountId','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','pick','removeAnswers','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','WhatsappApplication'];(function(_0x3e3012,_0x46fe06){var _0x5dfc61=function(_0x4737b8){while(--_0x4737b8){_0x3e3012['push'](_0x3e3012['shift']());}};_0x5dfc61(++_0x46fe06);}(_0x2a3f,0x1cb));var _0xf2a3=function(_0x38f5f8,_0xefe164){_0x38f5f8=_0x38f5f8-0x0;var _0x34e820=_0x2a3f[_0x38f5f8];return _0x34e820;};'use strict';var emlformat=require(_0xf2a3('0x0'));var rimraf=require(_0xf2a3('0x1'));var zipdir=require(_0xf2a3('0x2'));var jsonpatch=require(_0xf2a3('0x3'));var rp=require('request-promise');var moment=require(_0xf2a3('0x4'));var BPromise=require(_0xf2a3('0x5'));var Mustache=require(_0xf2a3('0x6'));var util=require(_0xf2a3('0x7'));var path=require(_0xf2a3('0x8'));var sox=require('sox');var csv=require(_0xf2a3('0x9'));var ejs=require(_0xf2a3('0xa'));var fs=require('fs');var fs_extra=require(_0xf2a3('0xb'));var _=require(_0xf2a3('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf2a3('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf2a3('0x9'));var querystring=require(_0xf2a3('0xe'));var Papa=require(_0xf2a3('0xf'));var Redis=require(_0xf2a3('0x10'));var authService=require(_0xf2a3('0x11'));var qs=require(_0xf2a3('0x12'));var as=require(_0xf2a3('0x13'));var hardwareService=require(_0xf2a3('0x14'));var logger=require(_0xf2a3('0x15'))(_0xf2a3('0x16'));var utils=require('../../config/utils');var config=require(_0xf2a3('0x17'));var licenseUtil=require(_0xf2a3('0x18'));var db=require(_0xf2a3('0x19'))['db'];config['redis']=_['defaults'](config[_0xf2a3('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xf2a3('0x1b'))(new Redis(config[_0xf2a3('0x1a')]));require('./whatsappAccount.socket')[_0xf2a3('0x1c')](socket);var jayson=require(_0xf2a3('0x1d'));var client=jayson[_0xf2a3('0x1e')][_0xf2a3('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x4a4d37,_0xdacb4,_0x4f2bc7,_0x225600){return new BPromise(function(_0x57aeee,_0x23ebc2){var _0x539058=_0x225600||client;return _0x539058[_0xf2a3('0x20')](_0x4a4d37,_0x4f2bc7)[_0xf2a3('0x21')](function(_0x389d41){logger[_0xf2a3('0x22')](_0xf2a3('0x23'),_0xdacb4,_0xf2a3('0x24'));logger[_0xf2a3('0x25')](_0xf2a3('0x26'),_0xdacb4,_0xf2a3('0x24'),JSON[_0xf2a3('0x27')](_0x389d41));if(_0x389d41[_0xf2a3('0x28')]){if(_0x389d41[_0xf2a3('0x28')]['code']===0x1f4){logger[_0xf2a3('0x28')](_0xf2a3('0x23'),_0xdacb4,_0x389d41[_0xf2a3('0x28')][_0xf2a3('0x29')]);return _0x23ebc2(_0x389d41[_0xf2a3('0x28')][_0xf2a3('0x29')]);}logger['error'](_0xf2a3('0x23'),_0xdacb4,_0x389d41[_0xf2a3('0x28')]['message']);return _0x57aeee(_0x389d41['error'][_0xf2a3('0x29')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0xdacb4,_0xf2a3('0x24'));_0x57aeee(_0x389d41['result']['message']);}})['catch'](function(_0x2144d2){logger[_0xf2a3('0x28')](_0xf2a3('0x23'),_0xdacb4,_0x2144d2);_0x23ebc2(_0x2144d2);});});}function respondWithStatusCode(_0x5673c6,_0x2bc99c){_0x2bc99c=_0x2bc99c||0xcc;return function(_0x12a04a){if(_0x12a04a){return _0x5673c6[_0xf2a3('0x2a')](_0x2bc99c);}return _0x5673c6[_0xf2a3('0x2b')](_0x2bc99c)[_0xf2a3('0x2c')]();};}function respondWithResult(_0x3ee04c,_0x13d713){_0x13d713=_0x13d713||0xc8;return function(_0x256536){if(_0x256536){return _0x3ee04c[_0xf2a3('0x2b')](_0x13d713)[_0xf2a3('0x2d')](_0x256536);}};}function respondWithFilteredResult(_0x51fe5e,_0x409e18){return function(_0x2ebca8){if(_0x2ebca8){var _0x1bf827=typeof _0x409e18[_0xf2a3('0x2e')]==='undefined'&&typeof _0x409e18['limit']==='undefined';var _0x533efd=_0x2ebca8[_0xf2a3('0x2f')];var _0x41a86b=_0x1bf827?0x0:_0x409e18[_0xf2a3('0x2e')];var _0x58e440=_0x1bf827?_0x2ebca8[_0xf2a3('0x2f')]:_0x409e18[_0xf2a3('0x2e')]+_0x409e18[_0xf2a3('0x30')];var _0x5f0a87;if(_0x58e440>=_0x533efd){_0x58e440=_0x533efd;_0x5f0a87=0xc8;}else{_0x5f0a87=0xce;}_0x51fe5e['status'](_0x5f0a87);return _0x51fe5e[_0xf2a3('0x31')](_0xf2a3('0x32'),_0x41a86b+'-'+_0x58e440+'/'+_0x533efd)[_0xf2a3('0x2d')](_0x2ebca8);}return null;};}function patchUpdates(_0x576487){return function(_0x3ca1a0){try{jsonpatch[_0xf2a3('0x33')](_0x3ca1a0,_0x576487,!![]);}catch(_0xa0e04e){return BPromise['reject'](_0xa0e04e);}return _0x3ca1a0[_0xf2a3('0x34')]();};}function saveUpdates(_0x46de36,_0x43a48c){return function(_0x2dca8f){if(_0x2dca8f){return _0x2dca8f[_0xf2a3('0x35')](_0x46de36)['then'](function(_0x18265d){return _0x18265d;});}return null;};}function removeEntity(_0x9d0fed,_0x348707){return function(_0x1d8a58){if(_0x1d8a58){return _0x1d8a58[_0xf2a3('0x36')]()[_0xf2a3('0x21')](function(){var _0x2f527a=_0x1d8a58[_0xf2a3('0x37')]({'plain':!![]});var _0x29300e='WhatsappAccounts';return db[_0xf2a3('0x38')][_0xf2a3('0x36')]({'where':{'type':_0x29300e,'resourceId':_0x2f527a['id']}})[_0xf2a3('0x21')](function(){return _0x1d8a58;});})[_0xf2a3('0x21')](function(){_0x9d0fed[_0xf2a3('0x2b')](0xcc)[_0xf2a3('0x2c')]();});}};}function handleEntityNotFound(_0x66465d,_0x9d9d3e){return function(_0x5536ed){if(!_0x5536ed){_0x66465d['sendStatus'](0x194);}return _0x5536ed;};}function handleError(_0x212c4b,_0x295f2f){_0x295f2f=_0x295f2f||0x1f4;return function(_0x10a0cf){logger[_0xf2a3('0x28')](_0x10a0cf[_0xf2a3('0x39')]);if(_0x10a0cf[_0xf2a3('0x3a')]){delete _0x10a0cf['name'];}_0x212c4b[_0xf2a3('0x2b')](_0x295f2f)[_0xf2a3('0x3b')](_0x10a0cf);};}exports[_0xf2a3('0x3c')]=function(_0xef76a4,_0x20dbd3){var _0x3767bf={'include':[{'model':db[_0xf2a3('0x3d')],'as':_0xf2a3('0x3e')}]},_0x5d6bd3={},_0x38aca7={'count':0x0,'rows':[]};var _0x41c778=_['map'](db[_0xf2a3('0x3f')][_0xf2a3('0x40')],function(_0x39acc6){return{'name':_0x39acc6['fieldName'],'type':_0x39acc6[_0xf2a3('0x41')][_0xf2a3('0x42')]};});_0x5d6bd3['model']=_[_0xf2a3('0x43')](_0x41c778,_0xf2a3('0x3a'));_0x5d6bd3[_0xf2a3('0x44')]=_['keys'](_0xef76a4[_0xf2a3('0x44')]);_0x5d6bd3[_0xf2a3('0x45')]=_[_0xf2a3('0x46')](_0x5d6bd3[_0xf2a3('0x47')],_0x5d6bd3[_0xf2a3('0x44')]);_0x3767bf[_0xf2a3('0x48')]=_[_0xf2a3('0x46')](_0x5d6bd3[_0xf2a3('0x47')],qs[_0xf2a3('0x49')](_0xef76a4[_0xf2a3('0x44')][_0xf2a3('0x49')]));_0x3767bf['attributes']=_0x3767bf[_0xf2a3('0x48')][_0xf2a3('0x4a')]?_0x3767bf[_0xf2a3('0x48')]:_0x5d6bd3['model'];if(!_0xef76a4[_0xf2a3('0x44')][_0xf2a3('0x4b')](_0xf2a3('0x4c'))){_0x3767bf['limit']=qs[_0xf2a3('0x30')](_0xef76a4[_0xf2a3('0x44')][_0xf2a3('0x30')]);_0x3767bf[_0xf2a3('0x2e')]=qs['offset'](_0xef76a4[_0xf2a3('0x44')][_0xf2a3('0x2e')]);}_0x3767bf[_0xf2a3('0x4d')]=qs[_0xf2a3('0x4e')](_0xef76a4[_0xf2a3('0x44')][_0xf2a3('0x4e')]);_0x3767bf[_0xf2a3('0x4f')]=qs[_0xf2a3('0x45')](_['pick'](_0xef76a4['query'],_0x5d6bd3[_0xf2a3('0x45')]),_0x41c778);if(_0xef76a4[_0xf2a3('0x44')][_0xf2a3('0x50')]){_0x3767bf[_0xf2a3('0x4f')]=_[_0xf2a3('0x51')](_0x3767bf[_0xf2a3('0x4f')],{'$or':_[_0xf2a3('0x43')](_0x41c778,function(_0x5f0bda){if(_0x5f0bda[_0xf2a3('0x41')]!=='VIRTUAL'){var _0x16a8b2={};_0x16a8b2[_0x5f0bda[_0xf2a3('0x3a')]]={'$like':'%'+_0xef76a4['query']['filter']+'%'};return _0x16a8b2;}})});}_0x3767bf=_[_0xf2a3('0x51')]({},_0x3767bf,_0xef76a4[_0xf2a3('0x52')]);var _0x4f6f0b={'where':_0x3767bf[_0xf2a3('0x4f')]};return db[_0xf2a3('0x3f')]['count'](_0x4f6f0b)[_0xf2a3('0x21')](function(_0x5abd75){_0x38aca7['count']=_0x5abd75;if(_0xef76a4[_0xf2a3('0x44')][_0xf2a3('0x53')]){_0x3767bf[_0xf2a3('0x54')]=[{'all':!![]}];}return db['WhatsappAccount'][_0xf2a3('0x55')](_0x3767bf);})[_0xf2a3('0x21')](function(_0x59c184){_0x38aca7['rows']=_0x59c184;return _0x38aca7;})[_0xf2a3('0x21')](respondWithFilteredResult(_0x20dbd3,_0x3767bf))[_0xf2a3('0x56')](handleError(_0x20dbd3,null));};exports[_0xf2a3('0x57')]=function(_0x48a192,_0x3fb61a){var _0x4485a8={'raw':![],'where':{'id':_0x48a192[_0xf2a3('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0xf2a3('0x3e')}]},_0x5e64af={};_0x5e64af[_0xf2a3('0x47')]=_[_0xf2a3('0x59')](db[_0xf2a3('0x3f')][_0xf2a3('0x40')]);_0x5e64af[_0xf2a3('0x44')]=_['keys'](_0x48a192['query']);_0x5e64af['filters']=_[_0xf2a3('0x46')](_0x5e64af[_0xf2a3('0x47')],_0x5e64af[_0xf2a3('0x44')]);_0x4485a8[_0xf2a3('0x48')]=_[_0xf2a3('0x46')](_0x5e64af[_0xf2a3('0x47')],qs[_0xf2a3('0x49')](_0x48a192['query'][_0xf2a3('0x49')]));_0x4485a8['attributes']=_0x4485a8[_0xf2a3('0x48')][_0xf2a3('0x4a')]?_0x4485a8[_0xf2a3('0x48')]:_0x5e64af['model'];if(_0x48a192[_0xf2a3('0x44')][_0xf2a3('0x53')]){_0x4485a8[_0xf2a3('0x54')]=[{'all':!![]}];}_0x4485a8=_['merge']({},_0x4485a8,_0x48a192[_0xf2a3('0x52')]);return db[_0xf2a3('0x3f')][_0xf2a3('0x5a')](_0x4485a8)['then'](handleEntityNotFound(_0x3fb61a,null))[_0xf2a3('0x21')](respondWithResult(_0x3fb61a,null))[_0xf2a3('0x56')](handleError(_0x3fb61a,null));};exports['create']=function(_0x32e3c2,_0x35dc03){return db['WhatsappAccount'][_0xf2a3('0x5b')](_0x32e3c2[_0xf2a3('0x5c')],{})[_0xf2a3('0x21')](function(_0x12c4dd){var _0x44bcbf=_0x32e3c2[_0xf2a3('0x5d')][_0xf2a3('0x37')]({'plain':!![]});if(!_0x44bcbf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x44bcbf[_0xf2a3('0x5e')]==='user'){var _0x27d5a4=_0x12c4dd['get']({'plain':!![]});var _0x7a35c0=_0xf2a3('0x5f');return db[_0xf2a3('0x60')][_0xf2a3('0x5a')]({'where':{'name':_0x7a35c0,'userProfileId':_0x44bcbf[_0xf2a3('0x61')]},'raw':!![]})[_0xf2a3('0x21')](function(_0x473a81){if(_0x473a81&&_0x473a81[_0xf2a3('0x62')]===0x0){return db['UserProfileResource'][_0xf2a3('0x5b')]({'name':_0x27d5a4[_0xf2a3('0x3a')],'resourceId':_0x27d5a4['id'],'type':_0x473a81[_0xf2a3('0x3a')],'sectionId':_0x473a81['id']},{})[_0xf2a3('0x21')](function(){return _0x12c4dd;});}else{return _0x12c4dd;}})['catch'](function(_0x1e9b7b){logger[_0xf2a3('0x28')](_0xf2a3('0x63'),_0x1e9b7b);throw _0x1e9b7b;});}return _0x12c4dd;})['then'](respondWithResult(_0x35dc03,0xc9))[_0xf2a3('0x56')](handleError(_0x35dc03,null));};exports[_0xf2a3('0x35')]=function(_0x139fb2,_0x3c25c9){if(_0x139fb2[_0xf2a3('0x5c')]['id']){delete _0x139fb2[_0xf2a3('0x5c')]['id'];}return db['WhatsappAccount'][_0xf2a3('0x5a')]({'where':{'id':_0x139fb2[_0xf2a3('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0xf2a3('0x3e')}]})['then'](handleEntityNotFound(_0x3c25c9,null))[_0xf2a3('0x21')](saveUpdates(_0x139fb2[_0xf2a3('0x5c')],null))['then'](respondWithResult(_0x3c25c9,null))[_0xf2a3('0x56')](handleError(_0x3c25c9,null));};exports[_0xf2a3('0x36')]=function(_0x546e01,_0x3f0fd7){return db[_0xf2a3('0x3f')][_0xf2a3('0x5a')]({'where':{'id':_0x546e01[_0xf2a3('0x58')]['id']}})[_0xf2a3('0x21')](handleEntityNotFound(_0x3f0fd7,null))[_0xf2a3('0x21')](removeEntity(_0x3f0fd7,null))[_0xf2a3('0x56')](handleError(_0x3f0fd7,null));};exports[_0xf2a3('0x64')]=function(_0x44905c,_0x328a10){return db[_0xf2a3('0x3f')][_0xf2a3('0x64')]()[_0xf2a3('0x21')](respondWithResult(_0x328a10,null))[_0xf2a3('0x56')](handleError(_0x328a10,null));};exports[_0xf2a3('0x65')]=function(_0x56fb02,_0x36c15f,_0xa1c23){if(_0x56fb02[_0xf2a3('0x5c')]['id']){delete _0x56fb02[_0xf2a3('0x5c')]['id'];}return db['WhatsappAccount'][_0xf2a3('0x5a')]({'where':{'id':_0x56fb02[_0xf2a3('0x58')]['id']}})[_0xf2a3('0x21')](handleEntityNotFound(_0x36c15f,null))['then'](function(_0x3b330f){if(_0x3b330f){_0x56fb02[_0xf2a3('0x5c')]['WhatsappAccountId']=_0x3b330f['id'];return db[_0xf2a3('0x66')][_0xf2a3('0x5b')](_0x56fb02['body']);}})[_0xf2a3('0x21')](respondWithResult(_0x36c15f,null))[_0xf2a3('0x56')](handleError(_0x36c15f,null));};exports[_0xf2a3('0x67')]=function(_0x186ecb,_0x1d97a4,_0x5e55f8){var _0x1aba59={'raw':![],'where':{}};var _0x181904={};var _0xd1cf2c={'count':0x0,'rows':[]};return db[_0xf2a3('0x3f')][_0xf2a3('0x68')]({'where':{'id':_0x186ecb['params']['id']}})[_0xf2a3('0x21')](handleEntityNotFound(_0x1d97a4,null))['then'](function(_0x37f58f){if(_0x37f58f){_0x181904[_0xf2a3('0x47')]=_['keys'](db[_0xf2a3('0x66')]['rawAttributes']);_0x181904['query']=_[_0xf2a3('0x59')](_0x186ecb[_0xf2a3('0x44')]);_0x181904['filters']=_['intersection'](_0x181904[_0xf2a3('0x47')],_0x181904[_0xf2a3('0x44')]);_0x1aba59[_0xf2a3('0x48')]=_['intersection'](_0x181904[_0xf2a3('0x47')],qs[_0xf2a3('0x49')](_0x186ecb[_0xf2a3('0x44')][_0xf2a3('0x49')]));_0x1aba59[_0xf2a3('0x48')]=_0x1aba59[_0xf2a3('0x48')][_0xf2a3('0x4a')]?_0x1aba59[_0xf2a3('0x48')]:_0x181904[_0xf2a3('0x47')];if(!_0x186ecb['query'][_0xf2a3('0x4b')]('nolimit')){_0x1aba59[_0xf2a3('0x30')]=qs[_0xf2a3('0x30')](_0x186ecb['query']['limit']);_0x1aba59[_0xf2a3('0x2e')]=qs['offset'](_0x186ecb['query'][_0xf2a3('0x2e')]);}_0x1aba59['order']=qs['sort'](_0x186ecb['query'][_0xf2a3('0x4e')]);_0x1aba59[_0xf2a3('0x4f')]=qs[_0xf2a3('0x45')](_['pick'](_0x186ecb[_0xf2a3('0x44')],_0x181904['filters']));_0x1aba59['where'][_0xf2a3('0x69')]=_0x37f58f['id'];if(_0x186ecb[_0xf2a3('0x44')][_0xf2a3('0x50')]){_0x1aba59[_0xf2a3('0x4f')]=_[_0xf2a3('0x51')](_0x1aba59[_0xf2a3('0x4f')],{'$or':_['map'](_0x1aba59[_0xf2a3('0x48')],function(_0x5a665f){var _0x1995ba={};_0x1995ba[_0x5a665f]={'$like':'%'+_0x186ecb['query'][_0xf2a3('0x50')]+'%'};return _0x1995ba;})});}_0x1aba59=_[_0xf2a3('0x51')]({},_0x1aba59,_0x186ecb[_0xf2a3('0x52')]);return db['Disposition'][_0xf2a3('0x2f')]({'where':_0x1aba59['where']})['then'](function(_0x587ab8){_0xd1cf2c[_0xf2a3('0x2f')]=_0x587ab8;if(_0x186ecb['query'][_0xf2a3('0x53')]){_0x1aba59['include']=[{'all':!![]}];}return db['Disposition'][_0xf2a3('0x55')](_0x1aba59);})['then'](function(_0x136264){_0xd1cf2c[_0xf2a3('0x6a')]=_0x136264;return _0xd1cf2c;});}})['then'](respondWithFilteredResult(_0x1d97a4,_0x1aba59))['catch'](handleError(_0x1d97a4,null));};exports['removeDispositions']=function(_0x430d98,_0x10e39d,_0x4bbb46){return db['WhatsappAccount'][_0xf2a3('0x5a')]({'where':{'id':_0x430d98['params']['id']}})['then'](handleEntityNotFound(_0x10e39d,null))[_0xf2a3('0x21')](function(_0x37594b){if(_0x37594b){return _0x37594b[_0xf2a3('0x6b')](_0x430d98[_0xf2a3('0x44')][_0xf2a3('0x6c')]);}})['then'](respondWithStatusCode(_0x10e39d,null))[_0xf2a3('0x56')](handleError(_0x10e39d,null));};exports[_0xf2a3('0x6d')]=function(_0x1ead10,_0x4d2f92,_0x403e6a){if(_0x1ead10[_0xf2a3('0x5c')]['id']){delete _0x1ead10[_0xf2a3('0x5c')]['id'];}return db['WhatsappAccount'][_0xf2a3('0x5a')]({'where':{'id':_0x1ead10[_0xf2a3('0x58')]['id']}})[_0xf2a3('0x21')](handleEntityNotFound(_0x4d2f92,null))[_0xf2a3('0x21')](function(_0x1f782d){if(_0x1f782d){_0x1ead10['body'][_0xf2a3('0x69')]=_0x1f782d['id'];return db[_0xf2a3('0x6e')][_0xf2a3('0x5b')](_0x1ead10[_0xf2a3('0x5c')]);}})[_0xf2a3('0x21')](respondWithResult(_0x4d2f92,null))[_0xf2a3('0x56')](handleError(_0x4d2f92,null));};exports[_0xf2a3('0x6f')]=function(_0x2d6ca9,_0x445654,_0x111ec0){var _0x524cb7={'raw':![],'where':{}};var _0x292856={};var _0x4ea5e4={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xf2a3('0x68')]({'where':{'id':_0x2d6ca9['params']['id']}})[_0xf2a3('0x21')](handleEntityNotFound(_0x445654,null))[_0xf2a3('0x21')](function(_0x3bd965){if(_0x3bd965){_0x292856[_0xf2a3('0x47')]=_[_0xf2a3('0x59')](db[_0xf2a3('0x6e')][_0xf2a3('0x40')]);_0x292856[_0xf2a3('0x44')]=_[_0xf2a3('0x59')](_0x2d6ca9[_0xf2a3('0x44')]);_0x292856[_0xf2a3('0x45')]=_['intersection'](_0x292856['model'],_0x292856['query']);_0x524cb7[_0xf2a3('0x48')]=_[_0xf2a3('0x46')](_0x292856[_0xf2a3('0x47')],qs['fields'](_0x2d6ca9[_0xf2a3('0x44')][_0xf2a3('0x49')]));_0x524cb7['attributes']=_0x524cb7[_0xf2a3('0x48')][_0xf2a3('0x4a')]?_0x524cb7[_0xf2a3('0x48')]:_0x292856[_0xf2a3('0x47')];if(!_0x2d6ca9['query'][_0xf2a3('0x4b')](_0xf2a3('0x4c'))){_0x524cb7[_0xf2a3('0x30')]=qs[_0xf2a3('0x30')](_0x2d6ca9[_0xf2a3('0x44')][_0xf2a3('0x30')]);_0x524cb7['offset']=qs[_0xf2a3('0x2e')](_0x2d6ca9[_0xf2a3('0x44')]['offset']);}_0x524cb7['order']=qs[_0xf2a3('0x4e')](_0x2d6ca9['query'][_0xf2a3('0x4e')]);_0x524cb7[_0xf2a3('0x4f')]=qs[_0xf2a3('0x45')](_[_0xf2a3('0x70')](_0x2d6ca9['query'],_0x292856[_0xf2a3('0x45')]));_0x524cb7[_0xf2a3('0x4f')][_0xf2a3('0x69')]=_0x3bd965['id'];if(_0x2d6ca9[_0xf2a3('0x44')]['filter']){_0x524cb7['where']=_[_0xf2a3('0x51')](_0x524cb7['where'],{'$or':_[_0xf2a3('0x43')](_0x524cb7[_0xf2a3('0x48')],function(_0x4bb202){var _0x44b84c={};_0x44b84c[_0x4bb202]={'$like':'%'+_0x2d6ca9[_0xf2a3('0x44')][_0xf2a3('0x50')]+'%'};return _0x44b84c;})});}_0x524cb7=_[_0xf2a3('0x51')]({},_0x524cb7,_0x2d6ca9['options']);return db['CannedAnswer'][_0xf2a3('0x2f')]({'where':_0x524cb7[_0xf2a3('0x4f')]})['then'](function(_0x4bcd70){_0x4ea5e4[_0xf2a3('0x2f')]=_0x4bcd70;if(_0x2d6ca9[_0xf2a3('0x44')][_0xf2a3('0x53')]){_0x524cb7[_0xf2a3('0x54')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x524cb7);})[_0xf2a3('0x21')](function(_0x1b2417){_0x4ea5e4[_0xf2a3('0x6a')]=_0x1b2417;return _0x4ea5e4;});}})[_0xf2a3('0x21')](respondWithFilteredResult(_0x445654,_0x524cb7))[_0xf2a3('0x56')](handleError(_0x445654,null));};exports[_0xf2a3('0x71')]=function(_0x5f2d67,_0x42e533,_0x290d00){return db[_0xf2a3('0x3f')][_0xf2a3('0x5a')]({'where':{'id':_0x5f2d67['params']['id']}})[_0xf2a3('0x21')](handleEntityNotFound(_0x42e533,null))[_0xf2a3('0x21')](function(_0x122c3c){if(_0x122c3c){return _0x122c3c[_0xf2a3('0x71')](_0x5f2d67[_0xf2a3('0x44')]['ids']);}})[_0xf2a3('0x21')](respondWithStatusCode(_0x42e533,null))[_0xf2a3('0x56')](handleError(_0x42e533,null));};exports[_0xf2a3('0x72')]=function(_0x16dc77,_0x198b2c,_0x1f1cf6){return db[_0xf2a3('0x3f')][_0xf2a3('0x5a')]({'where':{'id':_0x16dc77[_0xf2a3('0x58')]['id']}})['then'](handleEntityNotFound(_0x198b2c,null))[_0xf2a3('0x21')](function(_0x11ec62){if(_0x11ec62){return _0x11ec62['addAgents'](_0x16dc77[_0xf2a3('0x5c')][_0xf2a3('0x6c')],_['omit'](_0x16dc77['body'],[_0xf2a3('0x6c'),'id'])||{})[_0xf2a3('0x73')](function(_0x5eb570){for(var _0x651638=0x0;_0x651638<_0x16dc77[_0xf2a3('0x5c')][_0xf2a3('0x6c')]['length'];_0x651638+=0x1){socket[_0xf2a3('0x74')](_0xf2a3('0x75'),{'UserId':Number(_0x16dc77[_0xf2a3('0x5c')][_0xf2a3('0x6c')][_0x651638]),'WhatsappAccountId':Number(_0x16dc77[_0xf2a3('0x58')]['id'])});}return _0x5eb570;});}})[_0xf2a3('0x21')](respondWithResult(_0x198b2c,null))[_0xf2a3('0x56')](handleError(_0x198b2c,null));};exports['removeAgents']=function(_0x23dca4,_0x4de6c5,_0x401d1a){return db[_0xf2a3('0x3f')]['find']({'where':{'id':_0x23dca4[_0xf2a3('0x58')]['id']}})['then'](handleEntityNotFound(_0x4de6c5,null))[_0xf2a3('0x21')](function(_0x3e3a34){if(_0x3e3a34){return _0x3e3a34[_0xf2a3('0x76')](_0x23dca4['query'][_0xf2a3('0x6c')])[_0xf2a3('0x21')](function(){if(_[_0xf2a3('0x77')](_0x23dca4[_0xf2a3('0x44')][_0xf2a3('0x6c')])){for(var _0xdfa9ec=0x0;_0xdfa9ec<_0x23dca4[_0xf2a3('0x44')][_0xf2a3('0x6c')][_0xf2a3('0x4a')];_0xdfa9ec+=0x1){socket[_0xf2a3('0x74')](_0xf2a3('0x78'),{'UserId':Number(_0x23dca4[_0xf2a3('0x44')]['ids'][_0xdfa9ec]),'WhatsappAccountId':Number(_0x23dca4[_0xf2a3('0x58')]['id'])});}}else{socket[_0xf2a3('0x74')](_0xf2a3('0x78'),{'UserId':Number(_0x23dca4[_0xf2a3('0x44')]['ids']),'WhatsappAccountId':Number(_0x23dca4['params']['id'])});}});}})[_0xf2a3('0x21')](respondWithStatusCode(_0x4de6c5,null))[_0xf2a3('0x56')](handleError(_0x4de6c5,null));};exports[_0xf2a3('0x79')]=function(_0x2c2f8c,_0x3d5467,_0x3d6679){var _0x41e0a5={};var _0x476e28={};var _0x381381;var _0x14d3ea;return db['WhatsappAccount'][_0xf2a3('0x68')]({'where':{'id':_0x2c2f8c['params']['id']}})[_0xf2a3('0x21')](handleEntityNotFound(_0x3d5467,null))['then'](function(_0x1003c8){if(_0x1003c8){_0x381381=_0x1003c8;_0x476e28[_0xf2a3('0x47')]=_['keys'](db[_0xf2a3('0x7a')]['rawAttributes']);_0x476e28['query']=_[_0xf2a3('0x59')](_0x2c2f8c[_0xf2a3('0x44')]);_0x476e28['filters']=_['intersection'](_0x476e28[_0xf2a3('0x47')],_0x476e28[_0xf2a3('0x44')]);_0x41e0a5['attributes']=_[_0xf2a3('0x46')](_0x476e28[_0xf2a3('0x47')],qs[_0xf2a3('0x49')](_0x2c2f8c[_0xf2a3('0x44')]['fields']));_0x41e0a5[_0xf2a3('0x48')]=_0x41e0a5[_0xf2a3('0x48')][_0xf2a3('0x4a')]?_0x41e0a5[_0xf2a3('0x48')]:_0x476e28[_0xf2a3('0x47')];_0x41e0a5['order']=qs[_0xf2a3('0x4e')](_0x2c2f8c[_0xf2a3('0x44')][_0xf2a3('0x4e')]);_0x41e0a5['where']=qs[_0xf2a3('0x45')](_[_0xf2a3('0x70')](_0x2c2f8c[_0xf2a3('0x44')],_0x476e28[_0xf2a3('0x45')]));if(_0x2c2f8c['query'][_0xf2a3('0x50')]){_0x41e0a5['where']=_[_0xf2a3('0x51')](_0x41e0a5[_0xf2a3('0x4f')],{'$or':_['map'](_0x41e0a5[_0xf2a3('0x48')],function(_0x155a9b){var _0x13a321={};_0x13a321[_0x155a9b]={'$like':'%'+_0x2c2f8c[_0xf2a3('0x44')][_0xf2a3('0x50')]+'%'};return _0x13a321;})});}_0x41e0a5=_[_0xf2a3('0x51')]({},_0x41e0a5,_0x2c2f8c[_0xf2a3('0x52')]);return _0x381381[_0xf2a3('0x79')](_0x41e0a5);}})['then'](function(_0x1552b5){if(_0x1552b5){_0x14d3ea=_0x1552b5['length'];if(!_0x2c2f8c['query']['hasOwnProperty'](_0xf2a3('0x4c'))){_0x41e0a5[_0xf2a3('0x30')]=qs[_0xf2a3('0x30')](_0x2c2f8c['query'][_0xf2a3('0x30')]);_0x41e0a5['offset']=qs[_0xf2a3('0x2e')](_0x2c2f8c['query'][_0xf2a3('0x2e')]);}return _0x381381[_0xf2a3('0x79')](_0x41e0a5);}})[_0xf2a3('0x21')](function(_0x44233d){if(_0x44233d){return _0x44233d?{'count':_0x14d3ea,'rows':_0x44233d}:null;}})[_0xf2a3('0x21')](respondWithResult(_0x3d5467,null))[_0xf2a3('0x56')](handleError(_0x3d5467,null));};exports[_0xf2a3('0x7b')]=function(_0x46d584,_0x2b8ece){var _0xb04137=_0x46d584[_0xf2a3('0x58')]['id'];var _0xe45fb2=_0x46d584[_0xf2a3('0x5c')];var _0x4056a2=0xc8;var _0xe17581=null;return db[_0xf2a3('0x7c')][_0xf2a3('0x7d')]({'isolationLevel':db[_0xf2a3('0x7c')][_0xf2a3('0x7e')]['ISOLATION_LEVELS'][_0xf2a3('0x7f')]},function(_0x569ad7){return db['WhatsappAccount'][_0xf2a3('0x68')]({'where':{'id':_0xb04137},'transaction':_0x569ad7})[_0xf2a3('0x21')](function(_0x4d47a3){if(_0x4d47a3){return db['WhatsappApplication'][_0xf2a3('0x36')]({'where':{'WhatsappAccountId':_0xb04137},'transaction':_0x569ad7})[_0xf2a3('0x21')](function(){var _0x595221=_[_0xf2a3('0x43')](_0xe45fb2,function(_0x262723){_0x262723['WhatsappAccountId']=_0xb04137;return _0x262723;});return db[_0xf2a3('0x80')][_0xf2a3('0x81')](_0x595221,{'transaction':_0x569ad7});});}else{_0x4056a2=0x194;_0xe17581=[];}});})[_0xf2a3('0x21')](function(){if(_0x4056a2!==0x194){return db[_0xf2a3('0x80')][_0xf2a3('0x82')]({'where':{'WhatsappAccountId':_0xb04137},'order':_0xf2a3('0x83')})['then'](function(_0x3f439d){_0xe17581=_0x3f439d;});}})[_0xf2a3('0x56')](function(_0x430b4c){_0x4056a2=0x1f4;logger[_0xf2a3('0x28')](_0x430b4c[_0xf2a3('0x39')]);if(_0x430b4c[_0xf2a3('0x3a')]){delete _0x430b4c[_0xf2a3('0x3a')];}_0xe17581=_0x430b4c;})[_0xf2a3('0x84')](function(){if(_0xe17581===null){_0x2b8ece['sendStatus'](_0x4056a2);}else{if(_0x4056a2===0x1f4){_0x2b8ece['status'](_0x4056a2)[_0xf2a3('0x3b')](_0xe17581);}else{_0x2b8ece['status'](_0x4056a2)['json'](_0xe17581);}}});};exports[_0xf2a3('0x85')]=function(_0x8b21ae,_0x2442fc,_0x731987){var _0x17b4ba={};var _0x1384a1={};var _0x36eff8;var _0x2cd8df;return db[_0xf2a3('0x3f')][_0xf2a3('0x68')]({'where':{'id':_0x8b21ae[_0xf2a3('0x58')]['id']}})[_0xf2a3('0x21')](handleEntityNotFound(_0x2442fc,null))[_0xf2a3('0x21')](function(_0x54063c){if(_0x54063c){_0x36eff8=_0x54063c;_0x1384a1[_0xf2a3('0x47')]=_[_0xf2a3('0x59')](db[_0xf2a3('0x80')][_0xf2a3('0x40')]);_0x1384a1[_0xf2a3('0x44')]=_[_0xf2a3('0x59')](_0x8b21ae['query']);_0x1384a1[_0xf2a3('0x45')]=_['intersection'](_0x1384a1[_0xf2a3('0x47')],_0x1384a1['query']);_0x17b4ba[_0xf2a3('0x48')]=_[_0xf2a3('0x46')](_0x1384a1[_0xf2a3('0x47')],qs['fields'](_0x8b21ae[_0xf2a3('0x44')][_0xf2a3('0x49')]));_0x17b4ba['attributes']=_0x17b4ba[_0xf2a3('0x48')][_0xf2a3('0x4a')]?_0x17b4ba['attributes']:_0x1384a1[_0xf2a3('0x47')];_0x17b4ba[_0xf2a3('0x4d')]=qs[_0xf2a3('0x4e')](_0x8b21ae[_0xf2a3('0x44')]['sort']);_0x17b4ba[_0xf2a3('0x4f')]=qs['filters'](_[_0xf2a3('0x70')](_0x8b21ae[_0xf2a3('0x44')],_0x1384a1['filters']));if(_0x8b21ae[_0xf2a3('0x44')][_0xf2a3('0x50')]){_0x17b4ba[_0xf2a3('0x4f')]=_['merge'](_0x17b4ba[_0xf2a3('0x4f')],{'$or':_['map'](_0x17b4ba['attributes'],function(_0x9ee782){var _0x52ab3e={};_0x52ab3e[_0x9ee782]={'$like':'%'+_0x8b21ae[_0xf2a3('0x44')][_0xf2a3('0x50')]+'%'};return _0x52ab3e;})});}_0x17b4ba=_['merge']({},_0x17b4ba,_0x8b21ae[_0xf2a3('0x52')]);return _0x36eff8[_0xf2a3('0x85')](_0x17b4ba);}})[_0xf2a3('0x21')](function(_0x50e518){if(_0x50e518){_0x2cd8df=_0x50e518[_0xf2a3('0x4a')];if(!_0x8b21ae[_0xf2a3('0x44')][_0xf2a3('0x4b')](_0xf2a3('0x4c'))){_0x17b4ba['limit']=qs[_0xf2a3('0x30')](_0x8b21ae['query'][_0xf2a3('0x30')]);_0x17b4ba[_0xf2a3('0x2e')]=qs[_0xf2a3('0x2e')](_0x8b21ae[_0xf2a3('0x44')][_0xf2a3('0x2e')]);}return _0x36eff8[_0xf2a3('0x85')](_0x17b4ba);}})['then'](function(_0x446b90){if(_0x446b90){return _0x446b90?{'count':_0x2cd8df,'rows':_0x446b90}:null;}})[_0xf2a3('0x21')](respondWithResult(_0x2442fc,null))[_0xf2a3('0x56')](handleError(_0x2442fc,null));};exports[_0xf2a3('0x86')]=function(_0x4b22a5,_0x4dd64a,_0x5a374c){var _0x1c3799={'channel':'whatsapp'};var _0x2226fb=[];var _0x501e7d=[];var _0x4fabe3={};return db[_0xf2a3('0x3f')][_0xf2a3('0x5a')]({'where':{'id':_0x4b22a5['params']['id']},'include':[{'model':db[_0xf2a3('0x80')],'as':'Applications'}]})[_0xf2a3('0x21')](handleEntityNotFound(_0x4dd64a,null))['then'](function(_0x41e5af){_0x1c3799[_0xf2a3('0x87')]=_0x41e5af;if(_0x1c3799[_0xf2a3('0x87')]&&_0x1c3799[_0xf2a3('0x87')]['type']===_0xf2a3('0x88')&&_0x4b22a5['body'][_0xf2a3('0x89')]){if(_0x4b22a5['body'][_0xf2a3('0x89')][_0xf2a3('0x4a')]===0x0)return;if(_0x4b22a5['body']['statuses'][0x0][_0xf2a3('0x8a')]!==_0xf2a3('0x8b'))return;return db[_0xf2a3('0x8c')][_0xf2a3('0x35')]({'read':!![],'readAt':_0x4b22a5[_0xf2a3('0x5c')][_0xf2a3('0x89')][0x0][_0xf2a3('0x8d')]},{'where':{'messageId':_0x4b22a5['body']['statuses'][0x0][_0xf2a3('0x8e')]},'individualHooks':!![]})[_0xf2a3('0x21')](function(_0x20e876){return _0x4dd64a[_0xf2a3('0x2b')](0xc8)[_0xf2a3('0x2d')](_0x20e876);});}_0x1c3799['applications']=_[_0xf2a3('0x8f')](_0x41e5af['Applications'],['priority'],['asc']);if(_0x1c3799[_0xf2a3('0x87')]['Applications']){delete _0x1c3799[_0xf2a3('0x87')]['Applications'];}return db[_0xf2a3('0x90')][_0xf2a3('0x64')]()[_0xf2a3('0x21')](function(_0x317462){if(!_0x317462){throw new db['Sequelize'][(_0xf2a3('0x91'))](_0xf2a3('0x92'));}_0x2226fb=_[_0xf2a3('0x93')](_['keys'](_0x317462),[_0xf2a3('0x94'),_0xf2a3('0x95')]);_0x501e7d=_[_0xf2a3('0x93')](_[_0xf2a3('0x59')](_0x317462),['createdAt',_0xf2a3('0x95'),'CompanyId',_0xf2a3('0x96')]);_0x1c3799[_0xf2a3('0x5c')]={'mapKey':_0xf2a3('0x97')};if(_0x1c3799['account']&&_0x1c3799['account'][_0xf2a3('0x41')]===_0xf2a3('0x98')){_0x1c3799['body'][_0xf2a3('0x99')]=_0x4b22a5[_0xf2a3('0x5c')][_0xf2a3('0x9a')][_0xf2a3('0x9b')](_0xf2a3('0x9c'),'');_0x1c3799[_0xf2a3('0x5c')][_0xf2a3('0x5c')]=_0x4b22a5[_0xf2a3('0x5c')][_0xf2a3('0x9d')];_0x1c3799[_0xf2a3('0x5c')]['messageId']=_0x4b22a5[_0xf2a3('0x5c')][_0xf2a3('0x9e')];}if(_0x1c3799['account']&&_0x1c3799['account'][_0xf2a3('0x41')]===_0xf2a3('0x88')){_0x1c3799['body'][_0xf2a3('0x99')]=_0x4b22a5[_0xf2a3('0x5c')][_0xf2a3('0x9f')][0x0][_0xf2a3('0x99')];_0x1c3799[_0xf2a3('0x5c')]['body']=_0x4b22a5['body'][_0xf2a3('0x9f')][0x0][_0xf2a3('0x29')][_0xf2a3('0x5c')];_0x1c3799[_0xf2a3('0x5c')]['messageId']=_0x4b22a5[_0xf2a3('0x5c')]['notifications'][0x0]['message_id'];}if(_0x1c3799[_0xf2a3('0x5c')]['id']){delete _0x1c3799[_0xf2a3('0x5c')]['id'];}if(_[_0xf2a3('0xa0')](_0x1c3799[_0xf2a3('0x5c')]['from'])){throw new db[(_0xf2a3('0xa1'))][(_0xf2a3('0x91'))](_0xf2a3('0xa2'));}if(_[_0xf2a3('0xa0')](_0x1c3799['body'][_0xf2a3('0x5c')])||_0x1c3799[_0xf2a3('0x5c')][_0xf2a3('0x5c')]===''){throw new db[(_0xf2a3('0xa1'))][(_0xf2a3('0x91'))](_0xf2a3('0xa3'));}if(_['isNil'](_0x1c3799[_0xf2a3('0x5c')][_0xf2a3('0xa4')])){throw new db['Sequelize'][(_0xf2a3('0x91'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x501e7d);}if(!_['includes'](_0x501e7d,_0x1c3799['body'][_0xf2a3('0xa4')])){throw new db['Sequelize'][(_0xf2a3('0x91'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x501e7d);}_0x4fabe3[_0x1c3799[_0xf2a3('0x5c')][_0xf2a3('0xa4')]]=_0x1c3799[_0xf2a3('0x5c')][_0xf2a3('0x99')];return db[_0xf2a3('0xa5')][_0xf2a3('0x5a')]({'where':{'id':_0x1c3799['account'][_0xf2a3('0x96')]},'include':[{'model':db['CmContact'],'as':_0xf2a3('0xa6'),'where':_0x4fabe3,'limit':0x1,'order':[['updatedAt',_0xf2a3('0xa7')]]}]});})['then'](handleEntityNotFound(_0x4dd64a,null))[_0xf2a3('0x21')](function(_0x33a60a){if(_0x33a60a){_0x1c3799['list']=_[_0xf2a3('0xa8')](_0x33a60a,[_0xf2a3('0xa6')]);if(_0x33a60a['Contacts']['length']){return _0x33a60a[_0xf2a3('0xa6')][0x0];}var _0x5c127a=_['defaults'](_0x1c3799['body'],{'firstName':_0x1c3799[_0xf2a3('0x5c')][_0xf2a3('0x99')],'ListId':_0x33a60a['id']});_0x5c127a[_0x1c3799[_0xf2a3('0x5c')][_0xf2a3('0xa4')]]=_0x1c3799[_0xf2a3('0x5c')][_0xf2a3('0x99')];return db[_0xf2a3('0x90')][_0xf2a3('0x5b')](_0x5c127a,{'fields':_0x2226fb,'raw':!![]});}})[_0xf2a3('0x21')](handleEntityNotFound(_0x4dd64a,null))[_0xf2a3('0x21')](function(_0x176ad6){if(_0x176ad6){_0x1c3799[_0xf2a3('0xa9')]=_0x176ad6;var _0x4073ef={'ContactId':_0x176ad6['id'],'phone':_0x1c3799['body'][_0xf2a3('0x99')],'WhatsappAccountId':_0x4b22a5['params']['id']};var _0x135ecf={'ContactId':_0x176ad6['id'],'WhatsappAccountId':_0x4b22a5['params']['id'],'closed':![]};return db[_0xf2a3('0xaa')]['find']({'where':_0x135ecf})[_0xf2a3('0x21')](function(_0x480ca2){if(_0x480ca2){return[_0x480ca2,![]];}return db[_0xf2a3('0xaa')]['create'](_0x4073ef)['then'](function(_0x4e3e11){return[_0x4e3e11,!![]];});});}})[_0xf2a3('0x73')](function(_0x40804d,_0x9374fd){_0x1c3799[_0xf2a3('0xab')]=_0x40804d[_0xf2a3('0x37')]({'plain':!![]});_0x1c3799['interaction'][_0xf2a3('0xac')]=![];if(_0x9374fd){if(_0x1c3799[_0xf2a3('0x87')][_0xf2a3('0xad')]){_0x1c3799[_0xf2a3('0xae')][_0xf2a3('0xaf')]({'id':0x0,'priority':_0x1c3799['applications'][_0xf2a3('0x4a')]+0x1,'app':_0xf2a3('0xb0'),'appdata':_0xf2a3('0xb1'),'interval':_0xf2a3('0xb2')});}_0x1c3799['interaction']['created']=!![];}return db[_0xf2a3('0x8c')][_0xf2a3('0x5b')]({'phone':_0x1c3799[_0xf2a3('0x5c')][_0xf2a3('0x99')],'messageId':_0x1c3799['body'][_0xf2a3('0xb3')],'body':_0x1c3799[_0xf2a3('0x5c')][_0xf2a3('0x5c')],'WhatsappAccountId':_0x4b22a5[_0xf2a3('0x58')]['id'],'WhatsappInteractionId':_0x40804d['id'],'direction':'in','ContactId':_0x40804d[_0xf2a3('0xb4')],'AttachmentId':_0x1c3799['body'][_0xf2a3('0xb5')]});})[_0xf2a3('0x21')](function(_0x1b2eb6){_0x1c3799['message']=_0x1b2eb6;if(_0x1c3799[_0xf2a3('0xab')][_0xf2a3('0xb6')]){return db[_0xf2a3('0x7a')][_0xf2a3('0x5a')]({'attributes':['id',_0xf2a3('0x3a')],'where':{'id':_0x1c3799[_0xf2a3('0xab')][_0xf2a3('0xb6')]}})[_0xf2a3('0x21')](function(_0x420d6a){if(_0x420d6a){_0x1c3799[_0xf2a3('0xae')][_0xf2a3('0xb7')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x420d6a[_0xf2a3('0x3a')]+','+(_0x1c3799[_0xf2a3('0x87')][_0xf2a3('0xb8')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xf2a3('0xb9'),_0xf2a3('0xba'),_0x1c3799);});}return respondWithRpcPromise(_0xf2a3('0xb9'),'startRouting',_0x1c3799);})[_0xf2a3('0x21')](function(_0x523bb9){if(_0x523bb9){var _0x509548=0xc8;var _0xa77cda=_0xf2a3('0xbb');logger[_0xf2a3('0x22')](_0xf2a3('0x26'),_0xa77cda,_0x509548,'entity\x20found');logger[_0xf2a3('0x25')](_0xf2a3('0xbc'),_0xa77cda,_0x509548,_0xf2a3('0xbd'),JSON[_0xf2a3('0x27')](_0x523bb9));if(_0x1c3799['account'][_0xf2a3('0x41')]===_0xf2a3('0x98')){return _0x4dd64a[_0xf2a3('0x2b')](_0x509548)[_0xf2a3('0x31')](_0xf2a3('0xbe'),_0xf2a3('0xbf'))[_0xf2a3('0x3b')]('\x0a');}else{return _0x4dd64a['status'](_0x509548)['json'](_0x523bb9);}}});})[_0xf2a3('0x56')](handleError(_0x4dd64a,null));};exports[_0xf2a3('0x3b')]=function(_0x508f34,_0x546d72,_0x19a367){var _0x165ca5,_0x28c1c8,_0x168a83;if(_['isNil'](_0x508f34['body'][_0xf2a3('0x5c')])||_0x508f34['body'][_0xf2a3('0x5c')]===''){throw new db[(_0xf2a3('0xa1'))][(_0xf2a3('0x91'))](_0xf2a3('0xa3'));}if(_['isNil'](_0x508f34[_0xf2a3('0x5c')]['to'])){throw new db[(_0xf2a3('0xa1'))][(_0xf2a3('0x91'))](_0xf2a3('0xc0'));}_0x165ca5=_0x508f34[_0xf2a3('0x5c')]['to'];return db['WhatsappAccount'][_0xf2a3('0x5a')]({'where':{'id':_0x508f34[_0xf2a3('0x58')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xf2a3('0x90')],'as':_0xf2a3('0xa6'),'where':{'mobile':_0x165ca5},'limit':0x1,'order':[[_0xf2a3('0x95'),_0xf2a3('0xa7')]]}]}]})[_0xf2a3('0x21')](handleEntityNotFound(_0x546d72,null))['then'](function(_0x98d0ed){if(_0x98d0ed&&_0x98d0ed[_0xf2a3('0xc1')]){_0x28c1c8=_0x98d0ed['get']({'plain':!![]});if(_0x28c1c8[_0xf2a3('0xc1')]&&_0x28c1c8['List'][_0xf2a3('0xa6')][_0xf2a3('0x4a')]){return _0x28c1c8[_0xf2a3('0xc1')]['Contacts'][0x0];}return db[_0xf2a3('0x90')][_0xf2a3('0x5b')](_['defaults'](_0x508f34['body'],{'firstName':_0x165ca5,'mobile':_0x165ca5,'phone':_0x165ca5,'ListId':_0x28c1c8[_0xf2a3('0x96')]}));}})['then'](handleEntityNotFound(_0x546d72,null))[_0xf2a3('0x21')](function(_0x1dd58c){if(_0x1dd58c){_0x168a83=_0x1dd58c;return db[_0xf2a3('0xaa')][_0xf2a3('0x5a')]({'where':{'ContactId':_0x168a83['id'],'closed':![],'WhatsappAccountId':_0x28c1c8['id']}})[_0xf2a3('0x21')](function(_0x54a2c5){if(_0x54a2c5){return[_0x54a2c5,![]];}return db['WhatsappInteraction']['create']({'UserId':_0x508f34['user']['id'],'ContactId':_0x168a83['id'],'WhatsappAccountId':_0x28c1c8['id'],'phone':_0x165ca5,'firstMsgDirection':'out','Messages':[_[_0xf2a3('0x51')](_0x508f34[_0xf2a3('0x5c')],{'read':![],'body':_0x508f34['body']['body'],'phone':_0x165ca5,'WhatsappAccountId':_0x28c1c8['id'],'UserId':_0x508f34[_0xf2a3('0x5d')]['id'],'ContactId':_0x168a83['id']})]},{'include':[{'model':db[_0xf2a3('0x8c')],'as':_0xf2a3('0xc2')}]})[_0xf2a3('0x21')](function(_0x547ab9){return[_0x547ab9,!![]];});});}})[_0xf2a3('0x73')](function(_0x1027e5,_0x3f45c2){if(_0x3f45c2){return _0x1027e5;}return db[_0xf2a3('0x8c')][_0xf2a3('0x5b')](_[_0xf2a3('0x51')](_0x508f34['body'],{'read':![],'body':_0x508f34['body'][_0xf2a3('0x5c')],'phone':_0x165ca5,'WhatsappAccountId':_0x28c1c8['id'],'WhatsappInteractionId':_0x1027e5['id'],'UserId':_0x508f34[_0xf2a3('0x5d')]['id'],'ContactId':_0x168a83['id']}))[_0xf2a3('0x21')](function(_0x1e3175){_0x1027e5['dataValues'][_0xf2a3('0xc2')]=[];_0x1027e5[_0xf2a3('0xc3')][_0xf2a3('0xc2')]['push'](_0x1e3175[_0xf2a3('0xc3')]);return _0x1027e5;});})[_0xf2a3('0x21')](respondWithResult(_0x546d72,null))[_0xf2a3('0x56')](handleError(_0x546d72,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 0396584..5062aff 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 _0x7d74=['save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x10764e,_0x41c460){var _0x3948cf=function(_0x4d4de7){while(--_0x4d4de7){_0x10764e['push'](_0x10764e['shift']());}};_0x3948cf(++_0x41c460);}(_0x7d74,0x84));var _0x47d7=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x7d74[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require(_0x47d7('0x0'));var WhatsappAccount=require('../../mysqldb')['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x47d7('0x1'),'afterUpdate':'update','afterDestroy':_0x47d7('0x2')};function emitEvent(_0x58d08e){return function(_0x22eeed,_0x4b4751,_0x197df){WhatsappAccountEvents[_0x47d7('0x3')](_0x58d08e+':'+_0x22eeed['id'],_0x22eeed);WhatsappAccountEvents[_0x47d7('0x3')](_0x58d08e,_0x22eeed);_0x197df(null);};}for(var e in events){if(events[_0x47d7('0x4')](e)){var event=events[e];WhatsappAccount[_0x47d7('0x5')](e,emitEvent(event));}}module[_0x47d7('0x6')]=WhatsappAccountEvents; \ No newline at end of file +var _0x9f23=['emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x9f23,0x16b));var _0x39f2=function(_0x758bc5,_0x539866){_0x758bc5=_0x758bc5-0x0;var _0x2473b4=_0x9f23[_0x758bc5];return _0x2473b4;};'use strict';var EventEmitter=require(_0x39f2('0x0'));var WhatsappAccount=require(_0x39f2('0x1'))['db'][_0x39f2('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x39f2('0x3')](0x0);var events={'afterCreate':_0x39f2('0x4'),'afterUpdate':_0x39f2('0x5'),'afterDestroy':_0x39f2('0x6')};function emitEvent(_0x567203){return function(_0xc1777a,_0x126047,_0x49fc28){WhatsappAccountEvents[_0x39f2('0x7')](_0x567203+':'+_0xc1777a['id'],_0xc1777a);WhatsappAccountEvents[_0x39f2('0x7')](_0x567203,_0xc1777a);_0x49fc28(null);};}for(var e in events){if(events[_0x39f2('0x8')](e)){var event=events[e];WhatsappAccount[_0x39f2('0x9')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index aea62d8..0e0e65f 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 _0xd1bb=['lodash','../../config/logger','api','bluebird','path','rimraf','exports','WhatsappAccount'];(function(_0x5b1097,_0x3ed62f){var _0x57979c=function(_0x512f68){while(--_0x512f68){_0x5b1097['push'](_0x5b1097['shift']());}};_0x57979c(++_0x3ed62f);}(_0xd1bb,0x140));var _0xbd1b=function(_0x5a4bcb,_0x357c03){_0x5a4bcb=_0x5a4bcb-0x0;var _0x5074a1=_0xd1bb[_0x5a4bcb];return _0x5074a1;};'use strict';var _=require(_0xbd1b('0x0'));var util=require('util');var logger=require(_0xbd1b('0x1'))(_0xbd1b('0x2'));var moment=require('moment');var BPromise=require(_0xbd1b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd1b('0x4'));var rimraf=require(_0xbd1b('0x5'));var config=require('../../config/environment');var attributes=require('./whatsappAccount.attributes');module[_0xbd1b('0x6')]=function(_0x548ae5,_0x144fb6){return _0x548ae5['define'](_0xbd1b('0x7'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x65dd=['rimraf','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x65dd,0xe4));var _0xd65d=function(_0xcaba06,_0x4dd502){_0xcaba06=_0xcaba06-0x0;var _0x29e16f=_0x65dd[_0xcaba06];return _0x29e16f;};'use strict';var _=require(_0xd65d('0x0'));var util=require('util');var logger=require(_0xd65d('0x1'))(_0xd65d('0x2'));var moment=require(_0xd65d('0x3'));var BPromise=require(_0xd65d('0x4'));var rp=require(_0xd65d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd65d('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappAccount.attributes');module[_0xd65d('0x7')]=function(_0xb2e7d1,_0x3abb49){return _0xb2e7d1[_0xd65d('0x8')]('WhatsappAccount',attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 654f7f7..5caee90 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 _0x4458=['then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','raw','options','where','attributes','include','map','model'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x4458,0x119));var _0x8445=function(_0x307211,_0x1456bc){_0x307211=_0x307211-0x0;var _0xeacaef=_0x4458[_0x307211];return _0xeacaef;};'use strict';var _=require(_0x8445('0x0'));var util=require(_0x8445('0x1'));var moment=require(_0x8445('0x2'));var BPromise=require('bluebird');var rs=require(_0x8445('0x3'));var fs=require('fs');var Redis=require(_0x8445('0x4'));var db=require(_0x8445('0x5'))['db'];var utils=require(_0x8445('0x6'));var logger=require(_0x8445('0x7'))(_0x8445('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8445('0x9')][_0x8445('0xa')]({'port':0x232a});config[_0x8445('0xb')]=_[_0x8445('0xc')](config[_0x8445('0xb')],{'host':_0x8445('0xd'),'port':0x18eb});var socket=require(_0x8445('0xe'))(new Redis(config[_0x8445('0xb')]));require(_0x8445('0xf'))[_0x8445('0x10')](socket);function respondWithRpcPromise(_0x192958,_0x279e7d,_0x321172){return new BPromise(function(_0xe0e994,_0x1c1893){return client[_0x8445('0x11')](_0x192958,_0x321172)['then'](function(_0x2adc09){logger[_0x8445('0x12')](_0x8445('0x13'),_0x279e7d,_0x8445('0x14'));logger[_0x8445('0x15')](_0x8445('0x16'),_0x279e7d,'request\x20sent',JSON[_0x8445('0x17')](_0x2adc09));if(_0x2adc09[_0x8445('0x18')]){if(_0x2adc09['error'][_0x8445('0x19')]===0x1f4){logger['error'](_0x8445('0x13'),_0x279e7d,_0x2adc09[_0x8445('0x18')][_0x8445('0x1a')]);return _0x1c1893(_0x2adc09[_0x8445('0x18')]['message']);}logger[_0x8445('0x18')]('WhatsappAccount,\x20%s,\x20%s',_0x279e7d,_0x2adc09[_0x8445('0x18')][_0x8445('0x1a')]);return _0xe0e994(_0x2adc09[_0x8445('0x18')][_0x8445('0x1a')]);}else{logger[_0x8445('0x12')](_0x8445('0x13'),_0x279e7d,_0x8445('0x14'));_0xe0e994(_0x2adc09[_0x8445('0x1b')][_0x8445('0x1a')]);}})[_0x8445('0x1c')](function(_0x2a62d1){logger[_0x8445('0x18')]('WhatsappAccount,\x20%s,\x20%s',_0x279e7d,_0x2a62d1);_0x1c1893(_0x2a62d1);});});}exports[_0x8445('0x1d')]=function(_0x16a086){var _0x258818=this;return new Promise(function(_0xeb2da0,_0xa3a2b6){return db[_0x8445('0x1e')][_0x8445('0x1f')]({'raw':_0x16a086['options']?_0x16a086['options'][_0x8445('0x20')]===undefined?!![]:![]:!![],'where':_0x16a086[_0x8445('0x21')]?_0x16a086[_0x8445('0x21')][_0x8445('0x22')]||null:null,'attributes':_0x16a086[_0x8445('0x21')]?_0x16a086[_0x8445('0x21')][_0x8445('0x23')]||null:null,'include':_0x16a086[_0x8445('0x21')]?_0x16a086[_0x8445('0x21')][_0x8445('0x24')]?_[_0x8445('0x25')](_0x16a086[_0x8445('0x21')][_0x8445('0x24')],function(_0x19d647){return{'model':db[_0x19d647[_0x8445('0x26')]],'as':_0x19d647['as'],'attributes':_0x19d647[_0x8445('0x23')],'include':_0x19d647[_0x8445('0x24')]?_[_0x8445('0x25')](_0x19d647['include'],function(_0x55b9d9){return{'model':db[_0x55b9d9[_0x8445('0x26')]],'as':_0x55b9d9['as'],'attributes':_0x55b9d9[_0x8445('0x23')],'include':_0x55b9d9[_0x8445('0x24')]?_[_0x8445('0x25')](_0x55b9d9[_0x8445('0x24')],function(_0x1489c5){return{'model':db[_0x1489c5[_0x8445('0x26')]],'as':_0x1489c5['as'],'attributes':_0x1489c5[_0x8445('0x23')]};}):[]};}):[]};}):[]:[]})[_0x8445('0x27')](function(_0x42b022){logger[_0x8445('0x12')](_0x8445('0x1d'),_0x16a086);logger['debug'](_0x8445('0x1d'),_0x16a086,JSON[_0x8445('0x17')](_0x42b022));_0xeb2da0(_0x42b022);})['catch'](function(_0x43de3d){logger[_0x8445('0x18')](_0x8445('0x1d'),_0x43de3d['message'],_0x16a086);_0xa3a2b6(_0x258818[_0x8445('0x18')](0x1f4,_0x43de3d['message']));});});}; \ No newline at end of file +var _0x0185=['request\x20sent','stringify','error','code','message','result','catch','ShowWhatsappAccount','options','where','include','map','model','then','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappAccount.socket','register','request','info','WhatsappAccount,\x20%s,\x20%s'];(function(_0x56441f,_0x34a692){var _0x55fe35=function(_0x1f8ec2){while(--_0x1f8ec2){_0x56441f['push'](_0x56441f['shift']());}};_0x55fe35(++_0x34a692);}(_0x0185,0xb3));var _0x5018=function(_0x59162a,_0x10e547){_0x59162a=_0x59162a-0x0;var _0x35e50d=_0x0185[_0x59162a];return _0x35e50d;};'use strict';var _=require(_0x5018('0x0'));var util=require('util');var moment=require(_0x5018('0x1'));var BPromise=require('bluebird');var rs=require(_0x5018('0x2'));var fs=require('fs');var Redis=require(_0x5018('0x3'));var db=require(_0x5018('0x4'))['db'];var utils=require(_0x5018('0x5'));var logger=require(_0x5018('0x6'))('rpc');var config=require(_0x5018('0x7'));var jayson=require(_0x5018('0x8'));var client=jayson[_0x5018('0x9')][_0x5018('0xa')]({'port':0x232a});config[_0x5018('0xb')]=_[_0x5018('0xc')](config[_0x5018('0xb')],{'host':_0x5018('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5018('0xe'))[_0x5018('0xf')](socket);function respondWithRpcPromise(_0x35b311,_0x5d705c,_0x3dfcc5){return new BPromise(function(_0x2a024f,_0x21e117){return client[_0x5018('0x10')](_0x35b311,_0x3dfcc5)['then'](function(_0xe897e){logger[_0x5018('0x11')](_0x5018('0x12'),_0x5d705c,_0x5018('0x13'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x5d705c,_0x5018('0x13'),JSON[_0x5018('0x14')](_0xe897e));if(_0xe897e[_0x5018('0x15')]){if(_0xe897e[_0x5018('0x15')][_0x5018('0x16')]===0x1f4){logger[_0x5018('0x15')](_0x5018('0x12'),_0x5d705c,_0xe897e[_0x5018('0x15')]['message']);return _0x21e117(_0xe897e[_0x5018('0x15')]['message']);}logger[_0x5018('0x15')](_0x5018('0x12'),_0x5d705c,_0xe897e[_0x5018('0x15')][_0x5018('0x17')]);return _0x2a024f(_0xe897e[_0x5018('0x15')][_0x5018('0x17')]);}else{logger[_0x5018('0x11')]('WhatsappAccount,\x20%s,\x20%s',_0x5d705c,_0x5018('0x13'));_0x2a024f(_0xe897e[_0x5018('0x18')][_0x5018('0x17')]);}})[_0x5018('0x19')](function(_0x912c97){logger[_0x5018('0x15')](_0x5018('0x12'),_0x5d705c,_0x912c97);_0x21e117(_0x912c97);});});}exports[_0x5018('0x1a')]=function(_0x4dbeb5){var _0x4c6f2e=this;return new Promise(function(_0x186c19,_0x5411c5){return db['WhatsappAccount']['find']({'raw':_0x4dbeb5[_0x5018('0x1b')]?_0x4dbeb5[_0x5018('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4dbeb5[_0x5018('0x1b')]?_0x4dbeb5[_0x5018('0x1b')][_0x5018('0x1c')]||null:null,'attributes':_0x4dbeb5['options']?_0x4dbeb5[_0x5018('0x1b')]['attributes']||null:null,'include':_0x4dbeb5[_0x5018('0x1b')]?_0x4dbeb5[_0x5018('0x1b')][_0x5018('0x1d')]?_[_0x5018('0x1e')](_0x4dbeb5[_0x5018('0x1b')][_0x5018('0x1d')],function(_0x4ae8e7){return{'model':db[_0x4ae8e7[_0x5018('0x1f')]],'as':_0x4ae8e7['as'],'attributes':_0x4ae8e7['attributes'],'include':_0x4ae8e7[_0x5018('0x1d')]?_[_0x5018('0x1e')](_0x4ae8e7[_0x5018('0x1d')],function(_0x54913e){return{'model':db[_0x54913e['model']],'as':_0x54913e['as'],'attributes':_0x54913e['attributes'],'include':_0x54913e[_0x5018('0x1d')]?_[_0x5018('0x1e')](_0x54913e['include'],function(_0x52035a){return{'model':db[_0x52035a[_0x5018('0x1f')]],'as':_0x52035a['as'],'attributes':_0x52035a['attributes']};}):[]};}):[]};}):[]:[]})[_0x5018('0x20')](function(_0x47b1f3){logger[_0x5018('0x11')]('ShowWhatsappAccount',_0x4dbeb5);logger['debug'](_0x5018('0x1a'),_0x4dbeb5,JSON[_0x5018('0x14')](_0x47b1f3));_0x186c19(_0x47b1f3);})[_0x5018('0x19')](function(_0x4ab0a6){logger[_0x5018('0x15')](_0x5018('0x1a'),_0x4ab0a6[_0x5018('0x17')],_0x4dbeb5);_0x5411c5(_0x4c6f2e[_0x5018('0x15')](0x1f4,_0x4ab0a6[_0x5018('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 7243c9a..abb2bb8 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 _0x7aed=['emit','removeListener','register','length','./whatsappAccount.events','save','remove','update'];(function(_0xc92471,_0x3bf3cf){var _0x32d350=function(_0x3d4e41){while(--_0x3d4e41){_0xc92471['push'](_0xc92471['shift']());}};_0x32d350(++_0x3bf3cf);}(_0x7aed,0xdc));var _0xd7ae=function(_0x279d05,_0x1ca4d1){_0x279d05=_0x279d05-0x0;var _0x561c1b=_0x7aed[_0x279d05];return _0x561c1b;};'use strict';var WhatsappAccountEvents=require(_0xd7ae('0x0'));var events=[_0xd7ae('0x1'),_0xd7ae('0x2'),_0xd7ae('0x3')];function createListener(_0x573335,_0xb1aebb){return function(_0x4df2e7){_0xb1aebb[_0xd7ae('0x4')](_0x573335,_0x4df2e7);};}function removeListener(_0x417a7f,_0x10134d){return function(){WhatsappAccountEvents[_0xd7ae('0x5')](_0x417a7f,_0x10134d);};}exports[_0xd7ae('0x6')]=function(_0x5660ea){for(var _0x12e0ca=0x0,_0x258afc=events[_0xd7ae('0x7')];_0x12e0ca<_0x258afc;_0x12e0ca++){var _0x149eaa=events[_0x12e0ca];var _0x276d2b=createListener('whatsappAccount:'+_0x149eaa,_0x5660ea);WhatsappAccountEvents['on'](_0x149eaa,_0x276d2b);}}; \ No newline at end of file +var _0x2c23=['save','remove','emit','removeListener','whatsappAccount:','./whatsappAccount.events'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0x2c23,0x1b5));var _0x32c2=function(_0x178d9c,_0x3aaad3){_0x178d9c=_0x178d9c-0x0;var _0x9656c5=_0x2c23[_0x178d9c];return _0x9656c5;};'use strict';var WhatsappAccountEvents=require(_0x32c2('0x0'));var events=[_0x32c2('0x1'),_0x32c2('0x2'),'update'];function createListener(_0x1641cd,_0x3b26bc){return function(_0x4d309b){_0x3b26bc[_0x32c2('0x3')](_0x1641cd,_0x4d309b);};}function removeListener(_0x3f4ac6,_0x1ec0db){return function(){WhatsappAccountEvents[_0x32c2('0x4')](_0x3f4ac6,_0x1ec0db);};}exports['register']=function(_0x11b833){for(var _0x30f125=0x0,_0x5cd9eb=events['length'];_0x30f125<_0x5cd9eb;_0x30f125++){var _0x2ea70d=events[_0x30f125];var _0x1776e3=createListener(_0x32c2('0x5')+_0x2ea70d,_0x11b833);WhatsappAccountEvents['on'](_0x2ea70d,_0x1776e3);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index e12dd4c..a200801 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 _0x26eb=['../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0xbaf37e,_0x35fa9a){var _0x2f4f56=function(_0x5eb71f){while(--_0x5eb71f){_0xbaf37e['push'](_0xbaf37e['shift']());}};_0x2f4f56(++_0x35fa9a);}(_0x26eb,0x173));var _0xb26e=function(_0xbb8ec7,_0xe5764b){_0xbb8ec7=_0xbb8ec7-0x0;var _0x60edab=_0x26eb[_0xbb8ec7];return _0x60edab;};'use strict';var multer=require(_0xb26e('0x0'));var util=require(_0xb26e('0x1'));var path=require(_0xb26e('0x2'));var timeout=require(_0xb26e('0x3'));var express=require(_0xb26e('0x4'));var router=express[_0xb26e('0x5')]();var fs_extra=require(_0xb26e('0x6'));var auth=require(_0xb26e('0x7'));var interaction=require(_0xb26e('0x8'));var config=require('../../config/environment');var controller=require(_0xb26e('0x9'));router[_0xb26e('0xa')]('/',auth['isAuthenticated'](),controller[_0xb26e('0xb')]);router['get'](_0xb26e('0xc'),auth[_0xb26e('0xd')](),controller[_0xb26e('0xe')]);router[_0xb26e('0xf')]('/',auth[_0xb26e('0xd')](),controller[_0xb26e('0x10')]);router[_0xb26e('0x11')](_0xb26e('0xc'),auth[_0xb26e('0xd')](),controller['update']);router[_0xb26e('0x12')](_0xb26e('0xc'),auth[_0xb26e('0xd')](),controller[_0xb26e('0x13')]);module[_0xb26e('0x14')]=router; \ No newline at end of file +var _0x8429=['exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappApplication.controller','isAuthenticated','get','/:id','show','create','put','update','delete'];(function(_0x516942,_0x55176a){var _0x46d390=function(_0x5be0ca){while(--_0x5be0ca){_0x516942['push'](_0x516942['shift']());}};_0x46d390(++_0x55176a);}(_0x8429,0x166));var _0x9842=function(_0x2021d4,_0x2d9839){_0x2021d4=_0x2021d4-0x0;var _0x981226=_0x8429[_0x2021d4];return _0x981226;};'use strict';var multer=require('multer');var util=require(_0x9842('0x0'));var path=require(_0x9842('0x1'));var timeout=require(_0x9842('0x2'));var express=require('express');var router=express[_0x9842('0x3')]();var fs_extra=require(_0x9842('0x4'));var auth=require(_0x9842('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9842('0x6'));var controller=require(_0x9842('0x7'));router['get']('/',auth[_0x9842('0x8')](),controller['index']);router[_0x9842('0x9')](_0x9842('0xa'),auth[_0x9842('0x8')](),controller[_0x9842('0xb')]);router['post']('/',auth[_0x9842('0x8')](),controller[_0x9842('0xc')]);router[_0x9842('0xd')](_0x9842('0xa'),auth['isAuthenticated'](),controller[_0x9842('0xe')]);router[_0x9842('0xf')]('/:id',auth[_0x9842('0x8')](),controller['destroy']);module[_0x9842('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 280a4a4..222b25d 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 _0x03fc=['*,*,*,*','sequelize','STRING','noop','TEXT'];(function(_0x512be6,_0x1136fd){var _0x5836d2=function(_0x4f041d){while(--_0x4f041d){_0x512be6['push'](_0x512be6['shift']());}};_0x5836d2(++_0x1136fd);}(_0x03fc,0x92));var _0xc03f=function(_0x483d12,_0x595296){_0x483d12=_0x483d12-0x0;var _0x443246=_0x03fc[_0x483d12];return _0x443246;};'use strict';var Sequelize=require(_0xc03f('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xc03f('0x1')],'allowNull':![],'defaultValue':_0xc03f('0x2')},'appdata':{'type':Sequelize[_0xc03f('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xc03f('0x1')],'defaultValue':_0xc03f('0x4')}}; \ No newline at end of file +var _0x376e=['STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x376e,0xac));var _0xe376=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x376e[_0x4b73a2];return _0x383c66;};'use strict';var Sequelize=require(_0xe376('0x0'));module[_0xe376('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xe376('0x2')],'allowNull':![],'defaultValue':_0xe376('0x3')},'appdata':{'type':Sequelize[_0xe376('0x4')]()},'description':{'type':Sequelize[_0xe376('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xe376('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index d310e29..49767e2 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 _0xd0da=['bluebird','mustache','util','to-csv','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','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','end','name','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x2b60f6,_0x5b0c2b){var _0x292ffc=function(_0x2fe85f){while(--_0x2fe85f){_0x2b60f6['push'](_0x2b60f6['shift']());}};_0x292ffc(++_0x5b0c2b);}(_0xd0da,0x1b1));var _0xad0d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd0da[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0xad0d('0x0'));var rimraf=require(_0xad0d('0x1'));var zipdir=require(_0xad0d('0x2'));var jsonpatch=require(_0xad0d('0x3'));var rp=require(_0xad0d('0x4'));var moment=require('moment');var BPromise=require(_0xad0d('0x5'));var Mustache=require(_0xad0d('0x6'));var util=require(_0xad0d('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xad0d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xad0d('0x9'));var squel=require(_0xad0d('0xa'));var crypto=require(_0xad0d('0xb'));var jsforce=require(_0xad0d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xad0d('0x8'));var querystring=require(_0xad0d('0xd'));var Papa=require(_0xad0d('0xe'));var Redis=require(_0xad0d('0xf'));var authService=require(_0xad0d('0x10'));var qs=require(_0xad0d('0x11'));var as=require(_0xad0d('0x12'));var hardwareService=require(_0xad0d('0x13'));var logger=require(_0xad0d('0x14'))(_0xad0d('0x15'));var utils=require(_0xad0d('0x16'));var config=require(_0xad0d('0x17'));var licenseUtil=require(_0xad0d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45c7ea,_0x3b62bf){_0x3b62bf=_0x3b62bf||0xcc;return function(_0x552370){if(_0x552370){return _0x45c7ea[_0xad0d('0x19')](_0x3b62bf);}return _0x45c7ea[_0xad0d('0x1a')](_0x3b62bf)['end']();};}function respondWithResult(_0x79cb76,_0xd50e3f){_0xd50e3f=_0xd50e3f||0xc8;return function(_0x5973a4){if(_0x5973a4){return _0x79cb76[_0xad0d('0x1a')](_0xd50e3f)[_0xad0d('0x1b')](_0x5973a4);}};}function respondWithFilteredResult(_0x58b701,_0x139e6f){return function(_0x59811c){if(_0x59811c){var _0x56d253=typeof _0x139e6f[_0xad0d('0x1c')]===_0xad0d('0x1d')&&typeof _0x139e6f[_0xad0d('0x1e')]==='undefined';var _0x1cac0c=_0x59811c[_0xad0d('0x1f')];var _0x5862bd=_0x56d253?0x0:_0x139e6f[_0xad0d('0x1c')];var _0x49891e=_0x56d253?_0x59811c['count']:_0x139e6f[_0xad0d('0x1c')]+_0x139e6f['limit'];var _0x439484;if(_0x49891e>=_0x1cac0c){_0x49891e=_0x1cac0c;_0x439484=0xc8;}else{_0x439484=0xce;}_0x58b701[_0xad0d('0x1a')](_0x439484);return _0x58b701[_0xad0d('0x20')]('Content-Range',_0x5862bd+'-'+_0x49891e+'/'+_0x1cac0c)['json'](_0x59811c);}return null;};}function patchUpdates(_0x16b5a1){return function(_0x327fe1){try{jsonpatch[_0xad0d('0x21')](_0x327fe1,_0x16b5a1,!![]);}catch(_0x542bd8){return BPromise['reject'](_0x542bd8);}return _0x327fe1[_0xad0d('0x22')]();};}function saveUpdates(_0x48333a,_0x264f63){return function(_0x129e80){if(_0x129e80){return _0x129e80[_0xad0d('0x23')](_0x48333a)[_0xad0d('0x24')](function(_0xefaf5f){return _0xefaf5f;});}return null;};}function removeEntity(_0x315f9c,_0x59efec){return function(_0x171757){if(_0x171757){return _0x171757[_0xad0d('0x25')]()['then'](function(){_0x315f9c['status'](0xcc)[_0xad0d('0x26')]();});}};}function handleEntityNotFound(_0x3e510e,_0x444eda){return function(_0x4ed3c8){if(!_0x4ed3c8){_0x3e510e[_0xad0d('0x19')](0x194);}return _0x4ed3c8;};}function handleError(_0x4944f4,_0x394aa2){_0x394aa2=_0x394aa2||0x1f4;return function(_0xddf172){logger['error'](_0xddf172['stack']);if(_0xddf172[_0xad0d('0x27')]){delete _0xddf172[_0xad0d('0x27')];}_0x4944f4[_0xad0d('0x1a')](_0x394aa2)['send'](_0xddf172);};}exports[_0xad0d('0x28')]=function(_0x62dfed,_0xc2bddb){var _0x59792d={},_0x17a8e4={},_0x1f33ed={'count':0x0,'rows':[]};var _0x4c306d=_[_0xad0d('0x29')](db[_0xad0d('0x2a')][_0xad0d('0x2b')],function(_0x11c203){return{'name':_0x11c203[_0xad0d('0x2c')],'type':_0x11c203[_0xad0d('0x2d')][_0xad0d('0x2e')]};});_0x17a8e4[_0xad0d('0x2f')]=_[_0xad0d('0x29')](_0x4c306d,_0xad0d('0x27'));_0x17a8e4[_0xad0d('0x30')]=_['keys'](_0x62dfed[_0xad0d('0x30')]);_0x17a8e4['filters']=_[_0xad0d('0x31')](_0x17a8e4[_0xad0d('0x2f')],_0x17a8e4[_0xad0d('0x30')]);_0x59792d[_0xad0d('0x32')]=_['intersection'](_0x17a8e4[_0xad0d('0x2f')],qs[_0xad0d('0x33')](_0x62dfed['query'][_0xad0d('0x33')]));_0x59792d[_0xad0d('0x32')]=_0x59792d[_0xad0d('0x32')][_0xad0d('0x34')]?_0x59792d[_0xad0d('0x32')]:_0x17a8e4['model'];if(!_0x62dfed[_0xad0d('0x30')][_0xad0d('0x35')](_0xad0d('0x36'))){_0x59792d[_0xad0d('0x1e')]=qs['limit'](_0x62dfed[_0xad0d('0x30')]['limit']);_0x59792d[_0xad0d('0x1c')]=qs[_0xad0d('0x1c')](_0x62dfed[_0xad0d('0x30')]['offset']);}_0x59792d[_0xad0d('0x37')]=qs[_0xad0d('0x38')](_0x62dfed[_0xad0d('0x30')][_0xad0d('0x38')]);_0x59792d[_0xad0d('0x39')]=qs[_0xad0d('0x3a')](_[_0xad0d('0x3b')](_0x62dfed[_0xad0d('0x30')],_0x17a8e4['filters']),_0x4c306d);if(_0x62dfed[_0xad0d('0x30')][_0xad0d('0x3c')]){_0x59792d[_0xad0d('0x39')]=_[_0xad0d('0x3d')](_0x59792d['where'],{'$or':_[_0xad0d('0x29')](_0x4c306d,function(_0x21e7ca){if(_0x21e7ca[_0xad0d('0x2d')]!==_0xad0d('0x3e')){var _0x18527b={};_0x18527b[_0x21e7ca['name']]={'$like':'%'+_0x62dfed['query'][_0xad0d('0x3c')]+'%'};return _0x18527b;}})});}_0x59792d=_['merge']({},_0x59792d,_0x62dfed[_0xad0d('0x3f')]);var _0x1d996f={'where':_0x59792d[_0xad0d('0x39')]};return db[_0xad0d('0x2a')][_0xad0d('0x1f')](_0x1d996f)[_0xad0d('0x24')](function(_0x419f2e){_0x1f33ed[_0xad0d('0x1f')]=_0x419f2e;if(_0x62dfed[_0xad0d('0x30')]['includeAll']){_0x59792d[_0xad0d('0x40')]=[{'all':!![]}];}return db[_0xad0d('0x2a')][_0xad0d('0x41')](_0x59792d);})[_0xad0d('0x24')](function(_0x3a1775){_0x1f33ed[_0xad0d('0x42')]=_0x3a1775;return _0x1f33ed;})[_0xad0d('0x24')](respondWithFilteredResult(_0xc2bddb,_0x59792d))[_0xad0d('0x43')](handleError(_0xc2bddb,null));};exports[_0xad0d('0x44')]=function(_0x3d4f6b,_0x3674dd){var _0xe3b423={'raw':!![],'where':{'id':_0x3d4f6b[_0xad0d('0x45')]['id']}},_0x336ac8={};_0x336ac8[_0xad0d('0x2f')]=_['keys'](db[_0xad0d('0x2a')][_0xad0d('0x2b')]);_0x336ac8[_0xad0d('0x30')]=_[_0xad0d('0x46')](_0x3d4f6b[_0xad0d('0x30')]);_0x336ac8[_0xad0d('0x3a')]=_[_0xad0d('0x31')](_0x336ac8[_0xad0d('0x2f')],_0x336ac8[_0xad0d('0x30')]);_0xe3b423[_0xad0d('0x32')]=_['intersection'](_0x336ac8[_0xad0d('0x2f')],qs[_0xad0d('0x33')](_0x3d4f6b[_0xad0d('0x30')]['fields']));_0xe3b423[_0xad0d('0x32')]=_0xe3b423[_0xad0d('0x32')]['length']?_0xe3b423[_0xad0d('0x32')]:_0x336ac8['model'];if(_0x3d4f6b[_0xad0d('0x30')]['includeAll']){_0xe3b423['include']=[{'all':!![]}];}_0xe3b423=_['merge']({},_0xe3b423,_0x3d4f6b['options']);return db[_0xad0d('0x2a')]['find'](_0xe3b423)['then'](handleEntityNotFound(_0x3674dd,null))['then'](respondWithResult(_0x3674dd,null))[_0xad0d('0x43')](handleError(_0x3674dd,null));};exports['create']=function(_0x4e4bb9,_0x43c8d1){return db[_0xad0d('0x2a')]['create'](_0x4e4bb9[_0xad0d('0x47')],{})[_0xad0d('0x24')](respondWithResult(_0x43c8d1,0xc9))['catch'](handleError(_0x43c8d1,null));};exports[_0xad0d('0x23')]=function(_0x3ef5e7,_0x32bad5){if(_0x3ef5e7[_0xad0d('0x47')]['id']){delete _0x3ef5e7[_0xad0d('0x47')]['id'];}return db['WhatsappApplication'][_0xad0d('0x48')]({'where':{'id':_0x3ef5e7[_0xad0d('0x45')]['id']}})['then'](handleEntityNotFound(_0x32bad5,null))['then'](saveUpdates(_0x3ef5e7[_0xad0d('0x47')],null))[_0xad0d('0x24')](respondWithResult(_0x32bad5,null))[_0xad0d('0x43')](handleError(_0x32bad5,null));};exports[_0xad0d('0x25')]=function(_0x5e6873,_0x30c9e9){return db[_0xad0d('0x2a')][_0xad0d('0x48')]({'where':{'id':_0x5e6873['params']['id']}})[_0xad0d('0x24')](handleEntityNotFound(_0x30c9e9,null))[_0xad0d('0x24')](removeEntity(_0x30c9e9,null))[_0xad0d('0x43')](handleError(_0x30c9e9,null));}; \ No newline at end of file +var _0x553a=['ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','count','set','apply','reject','save','destroy','then','end','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','query','model','attributes','intersection','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','update','rimraf','fast-json-patch','request-promise','moment','util','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x553a,0x192));var _0xa553=function(_0x2bbc07,_0x1e2168){_0x2bbc07=_0x2bbc07-0x0;var _0x6879e4=_0x553a[_0x2bbc07];return _0x6879e4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa553('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa553('0x1'));var rp=require(_0xa553('0x2'));var moment=require(_0xa553('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa553('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xa553('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa553('0x6'));var squel=require(_0xa553('0x7'));var crypto=require(_0xa553('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xa553('0x9'));var toCsv=require('to-csv');var querystring=require(_0xa553('0xa'));var Papa=require(_0xa553('0xb'));var Redis=require(_0xa553('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa553('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa553('0xe'))(_0xa553('0xf'));var utils=require(_0xa553('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xa553('0x11'));var db=require(_0xa553('0x12'))['db'];function respondWithStatusCode(_0x1c911f,_0x4de7da){_0x4de7da=_0x4de7da||0xcc;return function(_0x2cc917){if(_0x2cc917){return _0x1c911f[_0xa553('0x13')](_0x4de7da);}return _0x1c911f[_0xa553('0x14')](_0x4de7da)['end']();};}function respondWithResult(_0x5906ab,_0x15b224){_0x15b224=_0x15b224||0xc8;return function(_0x26dcc5){if(_0x26dcc5){return _0x5906ab[_0xa553('0x14')](_0x15b224)[_0xa553('0x15')](_0x26dcc5);}};}function respondWithFilteredResult(_0x56b80c,_0x35cf13){return function(_0x5207c7){if(_0x5207c7){var _0xaedbbc=typeof _0x35cf13['offset']==='undefined'&&typeof _0x35cf13[_0xa553('0x16')]==='undefined';var _0x453a3a=_0x5207c7[_0xa553('0x17')];var _0x30d91e=_0xaedbbc?0x0:_0x35cf13['offset'];var _0x102ef5=_0xaedbbc?_0x5207c7[_0xa553('0x17')]:_0x35cf13['offset']+_0x35cf13[_0xa553('0x16')];var _0x1b7c73;if(_0x102ef5>=_0x453a3a){_0x102ef5=_0x453a3a;_0x1b7c73=0xc8;}else{_0x1b7c73=0xce;}_0x56b80c['status'](_0x1b7c73);return _0x56b80c[_0xa553('0x18')]('Content-Range',_0x30d91e+'-'+_0x102ef5+'/'+_0x453a3a)[_0xa553('0x15')](_0x5207c7);}return null;};}function patchUpdates(_0x18af22){return function(_0x9be74f){try{jsonpatch[_0xa553('0x19')](_0x9be74f,_0x18af22,!![]);}catch(_0x5792b9){return BPromise[_0xa553('0x1a')](_0x5792b9);}return _0x9be74f[_0xa553('0x1b')]();};}function saveUpdates(_0x137778,_0x4dc781){return function(_0x17b058){if(_0x17b058){return _0x17b058['update'](_0x137778)['then'](function(_0xdead6a){return _0xdead6a;});}return null;};}function removeEntity(_0x3c1011,_0x478efb){return function(_0x306f1a){if(_0x306f1a){return _0x306f1a[_0xa553('0x1c')]()[_0xa553('0x1d')](function(){_0x3c1011['status'](0xcc)[_0xa553('0x1e')]();});}};}function handleEntityNotFound(_0x28fa86,_0x22744c){return function(_0x7b0d73){if(!_0x7b0d73){_0x28fa86[_0xa553('0x13')](0x194);}return _0x7b0d73;};}function handleError(_0x49a916,_0x1a4bab){_0x1a4bab=_0x1a4bab||0x1f4;return function(_0x10c08b){logger['error'](_0x10c08b['stack']);if(_0x10c08b[_0xa553('0x1f')]){delete _0x10c08b[_0xa553('0x1f')];}_0x49a916[_0xa553('0x14')](_0x1a4bab)[_0xa553('0x20')](_0x10c08b);};}exports[_0xa553('0x21')]=function(_0x407382,_0x3fe657){var _0x4ca838={},_0x3c029d={},_0x1a11b0={'count':0x0,'rows':[]};var _0x345fef=_[_0xa553('0x22')](db[_0xa553('0x23')][_0xa553('0x24')],function(_0x1090e0){return{'name':_0x1090e0[_0xa553('0x25')],'type':_0x1090e0[_0xa553('0x26')][_0xa553('0x27')]};});_0x3c029d['model']=_[_0xa553('0x22')](_0x345fef,'name');_0x3c029d[_0xa553('0x28')]=_['keys'](_0x407382['query']);_0x3c029d['filters']=_['intersection'](_0x3c029d[_0xa553('0x29')],_0x3c029d[_0xa553('0x28')]);_0x4ca838[_0xa553('0x2a')]=_[_0xa553('0x2b')](_0x3c029d[_0xa553('0x29')],qs['fields'](_0x407382[_0xa553('0x28')]['fields']));_0x4ca838[_0xa553('0x2a')]=_0x4ca838[_0xa553('0x2a')]['length']?_0x4ca838['attributes']:_0x3c029d[_0xa553('0x29')];if(!_0x407382[_0xa553('0x28')][_0xa553('0x2c')](_0xa553('0x2d'))){_0x4ca838[_0xa553('0x16')]=qs[_0xa553('0x16')](_0x407382['query']['limit']);_0x4ca838[_0xa553('0x2e')]=qs['offset'](_0x407382['query'][_0xa553('0x2e')]);}_0x4ca838[_0xa553('0x2f')]=qs[_0xa553('0x30')](_0x407382[_0xa553('0x28')][_0xa553('0x30')]);_0x4ca838[_0xa553('0x31')]=qs[_0xa553('0x32')](_[_0xa553('0x33')](_0x407382[_0xa553('0x28')],_0x3c029d[_0xa553('0x32')]),_0x345fef);if(_0x407382[_0xa553('0x28')][_0xa553('0x34')]){_0x4ca838[_0xa553('0x31')]=_[_0xa553('0x35')](_0x4ca838[_0xa553('0x31')],{'$or':_[_0xa553('0x22')](_0x345fef,function(_0x6a06ce){if(_0x6a06ce[_0xa553('0x26')]!==_0xa553('0x36')){var _0x13800e={};_0x13800e[_0x6a06ce[_0xa553('0x1f')]]={'$like':'%'+_0x407382[_0xa553('0x28')]['filter']+'%'};return _0x13800e;}})});}_0x4ca838=_[_0xa553('0x35')]({},_0x4ca838,_0x407382[_0xa553('0x37')]);var _0x222d8e={'where':_0x4ca838[_0xa553('0x31')]};return db[_0xa553('0x23')][_0xa553('0x17')](_0x222d8e)['then'](function(_0x429653){_0x1a11b0['count']=_0x429653;if(_0x407382[_0xa553('0x28')][_0xa553('0x38')]){_0x4ca838[_0xa553('0x39')]=[{'all':!![]}];}return db[_0xa553('0x23')][_0xa553('0x3a')](_0x4ca838);})[_0xa553('0x1d')](function(_0x1d5802){_0x1a11b0[_0xa553('0x3b')]=_0x1d5802;return _0x1a11b0;})[_0xa553('0x1d')](respondWithFilteredResult(_0x3fe657,_0x4ca838))[_0xa553('0x3c')](handleError(_0x3fe657,null));};exports[_0xa553('0x3d')]=function(_0x5b15ff,_0x49cb6b){var _0x30c332={'raw':!![],'where':{'id':_0x5b15ff[_0xa553('0x3e')]['id']}},_0x503a9d={};_0x503a9d[_0xa553('0x29')]=_['keys'](db[_0xa553('0x23')][_0xa553('0x24')]);_0x503a9d['query']=_[_0xa553('0x3f')](_0x5b15ff[_0xa553('0x28')]);_0x503a9d['filters']=_[_0xa553('0x2b')](_0x503a9d[_0xa553('0x29')],_0x503a9d['query']);_0x30c332[_0xa553('0x2a')]=_[_0xa553('0x2b')](_0x503a9d[_0xa553('0x29')],qs[_0xa553('0x40')](_0x5b15ff['query'][_0xa553('0x40')]));_0x30c332[_0xa553('0x2a')]=_0x30c332[_0xa553('0x2a')]['length']?_0x30c332[_0xa553('0x2a')]:_0x503a9d[_0xa553('0x29')];if(_0x5b15ff[_0xa553('0x28')][_0xa553('0x38')]){_0x30c332[_0xa553('0x39')]=[{'all':!![]}];}_0x30c332=_[_0xa553('0x35')]({},_0x30c332,_0x5b15ff['options']);return db['WhatsappApplication'][_0xa553('0x41')](_0x30c332)[_0xa553('0x1d')](handleEntityNotFound(_0x49cb6b,null))[_0xa553('0x1d')](respondWithResult(_0x49cb6b,null))[_0xa553('0x3c')](handleError(_0x49cb6b,null));};exports[_0xa553('0x42')]=function(_0x2d425f,_0x1534ac){return db[_0xa553('0x23')]['create'](_0x2d425f[_0xa553('0x43')],{})[_0xa553('0x1d')](respondWithResult(_0x1534ac,0xc9))[_0xa553('0x3c')](handleError(_0x1534ac,null));};exports[_0xa553('0x44')]=function(_0x1a31b1,_0xb8aa57){if(_0x1a31b1[_0xa553('0x43')]['id']){delete _0x1a31b1[_0xa553('0x43')]['id'];}return db[_0xa553('0x23')]['find']({'where':{'id':_0x1a31b1[_0xa553('0x3e')]['id']}})[_0xa553('0x1d')](handleEntityNotFound(_0xb8aa57,null))['then'](saveUpdates(_0x1a31b1[_0xa553('0x43')],null))[_0xa553('0x1d')](respondWithResult(_0xb8aa57,null))[_0xa553('0x3c')](handleError(_0xb8aa57,null));};exports['destroy']=function(_0xaec6d4,_0x12a7ff){return db[_0xa553('0x23')]['find']({'where':{'id':_0xaec6d4[_0xa553('0x3e')]['id']}})[_0xa553('0x1d')](handleEntityNotFound(_0x12a7ff,null))[_0xa553('0x1d')](removeEntity(_0x12a7ff,null))[_0xa553('0x3c')](handleError(_0x12a7ff,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index a2349e0..bcb88d7 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 _0x55ca=['request-promise','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','whatsapp_applications','utf8mb4','lodash','util','bluebird'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x55ca,0x126));var _0xa55c=function(_0x400672,_0x243a7e){_0x400672=_0x400672-0x0;var _0x27ed65=_0x55ca[_0x400672];return _0x27ed65;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('WhatsappApplication',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa55c('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb66c=['rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0xb66c,0x175));var _0xcb66=function(_0x1ef1e6,_0x3cd84a){_0x1ef1e6=_0x1ef1e6-0x0;var _0x5396f6=_0xb66c[_0x1ef1e6];return _0x5396f6;};'use strict';var _=require(_0xcb66('0x0'));var util=require('util');var logger=require(_0xcb66('0x1'))('api');var moment=require(_0xcb66('0x2'));var BPromise=require(_0xcb66('0x3'));var rp=require(_0xcb66('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcb66('0x5'));var config=require(_0xcb66('0x6'));var attributes=require(_0xcb66('0x7'));module[_0xcb66('0x8')]=function(_0x5d766d,_0x518163){return _0x5d766d[_0xcb66('0x9')](_0xcb66('0xa'),attributes,{'tableName':_0xcb66('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcb66('0xc'),'collate':_0xcb66('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 32d9c29..04fefc0 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 _0x207c=['message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error'];(function(_0x2b82dd,_0x48b4b4){var _0x5a83d5=function(_0x5ea851){while(--_0x5ea851){_0x2b82dd['push'](_0x2b82dd['shift']());}};_0x5a83d5(++_0x48b4b4);}(_0x207c,0x1e8));var _0xc207=function(_0x1a0557,_0x2a0db7){_0x1a0557=_0x1a0557-0x0;var _0x1ad015=_0x207c[_0x1a0557];return _0x1ad015;};'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});function respondWithRpcPromise(_0x314561,_0x3395e4,_0x59ff6f){return new BPromise(function(_0x25cb97,_0xad159b){return client[_0xc207('0x9')](_0x314561,_0x59ff6f)['then'](function(_0xffae6c){logger[_0xc207('0xa')](_0xc207('0xb'),_0x3395e4,_0xc207('0xc'));logger[_0xc207('0xd')](_0xc207('0xe'),_0x3395e4,'request\x20sent',JSON['stringify'](_0xffae6c));if(_0xffae6c['error']){if(_0xffae6c[_0xc207('0xf')]['code']===0x1f4){logger[_0xc207('0xf')](_0xc207('0xb'),_0x3395e4,_0xffae6c['error'][_0xc207('0x10')]);return _0xad159b(_0xffae6c[_0xc207('0xf')][_0xc207('0x10')]);}logger[_0xc207('0xf')](_0xc207('0xb'),_0x3395e4,_0xffae6c['error'][_0xc207('0x10')]);return _0x25cb97(_0xffae6c[_0xc207('0xf')][_0xc207('0x10')]);}else{logger[_0xc207('0xa')]('WhatsappApplication,\x20%s,\x20%s',_0x3395e4,'request\x20sent');_0x25cb97(_0xffae6c['result'][_0xc207('0x10')]);}})[_0xc207('0x11')](function(_0x3d9c7b){logger[_0xc207('0xf')]('WhatsappApplication,\x20%s,\x20%s',_0x3395e4,_0x3d9c7b);_0xad159b(_0x3d9c7b);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4dc31e,_0x4474e4){var _0x4c180c=function(_0x1154af){while(--_0x1154af){_0x4dc31e['push'](_0x4dc31e['shift']());}};_0x4c180c(++_0x4474e4);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 7d7e7f6..4e8382c 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 _0x5162=['whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','delete','removeTags','exports','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','whatsapp'];(function(_0x3ce1eb,_0x5b60a3){var _0x375bba=function(_0x5a82f3){while(--_0x5a82f3){_0x3ce1eb['push'](_0x3ce1eb['shift']());}};_0x375bba(++_0x5b60a3);}(_0x5162,0x103));var _0x2516=function(_0x388ccc,_0x2a24fd){_0x388ccc=_0x388ccc-0x0;var _0x570c20=_0x5162[_0x388ccc];return _0x570c20;};'use strict';var multer=require(_0x2516('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2516('0x1')]();var fs_extra=require(_0x2516('0x2'));var auth=require(_0x2516('0x3'));var interaction=require(_0x2516('0x4'));var config=require(_0x2516('0x5'));var controller=require(_0x2516('0x6'));router[_0x2516('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2516('0x8'),auth[_0x2516('0x9')](),controller[_0x2516('0xa')]);router[_0x2516('0x7')](_0x2516('0xb'),auth[_0x2516('0x9')](),controller[_0x2516('0xc')]);router['get'](_0x2516('0xd'),auth[_0x2516('0x9')](),controller[_0x2516('0xe')]);router['get']('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x2516('0xf')]('/',auth[_0x2516('0x9')](),controller[_0x2516('0x10')]);router[_0x2516('0xf')]('/:id/messages',auth[_0x2516('0x9')](),controller[_0x2516('0x11')]);router[_0x2516('0xf')](_0x2516('0x12'),auth[_0x2516('0x9')](),interaction[_0x2516('0x13')](_0x2516('0x14'),_0x2516('0x15')),controller[_0x2516('0x16')]);router[_0x2516('0x17')](_0x2516('0xb'),auth[_0x2516('0x9')](),interaction[_0x2516('0x13')](_0x2516('0x14'),_0x2516('0x18')),controller['update']);router[_0x2516('0x19')](_0x2516('0xb'),auth[_0x2516('0x9')](),interaction['tracked'](_0x2516('0x14'),'whatsappinteraction:destroy'),controller['destroy']);router[_0x2516('0x19')](_0x2516('0x12'),auth[_0x2516('0x9')](),controller[_0x2516('0x1a')]);module[_0x2516('0x1b')]=router; \ No newline at end of file +var _0x1623=['Router','fs-extra','../../components/auth/service','./whatsappInteraction.controller','isAuthenticated','index','/describe','describe','get','/:id','show','getMessages','/:id/download','download','post','create','/:id/tags','whatsapp','whatsappinteraction:addtags','addTags','tracked','whatsappinteraction:update','update','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x1366b9,_0x323fce){var _0x353f57=function(_0x1fc12c){while(--_0x1fc12c){_0x1366b9['push'](_0x1366b9['shift']());}};_0x353f57(++_0x323fce);}(_0x1623,0xab));var _0x3162=function(_0x501579,_0x260440){_0x501579=_0x501579-0x0;var _0xf6d5e8=_0x1623[_0x501579];return _0xf6d5e8;};'use strict';var multer=require(_0x3162('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3162('0x1'));var express=require(_0x3162('0x2'));var router=express[_0x3162('0x3')]();var fs_extra=require(_0x3162('0x4'));var auth=require(_0x3162('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3162('0x6'));router['get']('/',auth[_0x3162('0x7')](),controller[_0x3162('0x8')]);router['get'](_0x3162('0x9'),auth[_0x3162('0x7')](),controller[_0x3162('0xa')]);router[_0x3162('0xb')](_0x3162('0xc'),auth[_0x3162('0x7')](),controller[_0x3162('0xd')]);router[_0x3162('0xb')]('/:id/messages',auth['isAuthenticated'](),controller[_0x3162('0xe')]);router[_0x3162('0xb')](_0x3162('0xf'),auth[_0x3162('0x7')](),controller[_0x3162('0x10')]);router[_0x3162('0x11')]('/',auth[_0x3162('0x7')](),controller[_0x3162('0x12')]);router[_0x3162('0x11')]('/:id/messages',auth[_0x3162('0x7')](),controller['addMessage']);router[_0x3162('0x11')](_0x3162('0x13'),auth['isAuthenticated'](),interaction['tracked'](_0x3162('0x14'),_0x3162('0x15')),controller[_0x3162('0x16')]);router['put'](_0x3162('0xc'),auth[_0x3162('0x7')](),interaction[_0x3162('0x17')]('whatsapp',_0x3162('0x18')),controller[_0x3162('0x19')]);router[_0x3162('0x1a')](_0x3162('0xc'),auth[_0x3162('0x7')](),interaction[_0x3162('0x17')](_0x3162('0x14'),'whatsappinteraction:destroy'),controller[_0x3162('0x1b')]);router[_0x3162('0x1a')](_0x3162('0x13'),auth[_0x3162('0x7')](),controller['removeTags']);module[_0x3162('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index d8d3f20..455bdaa 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 _0xd9a8=['ENUM','out','BOOLEAN','sequelize','moment','exports','DATE','STRING'];(function(_0x4aa21e,_0x2c62c8){var _0x4ac58e=function(_0x1d03a1){while(--_0x1d03a1){_0x4aa21e['push'](_0x4aa21e['shift']());}};_0x4ac58e(++_0x2c62c8);}(_0xd9a8,0xc3));var _0x8d9a=function(_0x26f03d,_0x4866c2){_0x26f03d=_0x26f03d-0x0;var _0x42dc9f=_0xd9a8[_0x26f03d];return _0x42dc9f;};'use strict';var Sequelize=require(_0x8d9a('0x0'));var moment=require(_0x8d9a('0x1'));module[_0x8d9a('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8d9a('0x3')]},'disposition':{'type':Sequelize[_0x8d9a('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x8d9a('0x4')]},'phone':{'type':Sequelize[_0x8d9a('0x4')]},'read1stAt':{'type':Sequelize[_0x8d9a('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x8d9a('0x5')]('in',_0x8d9a('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x8d9a('0x5')]('in',_0x8d9a('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x8d9a('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0xa13d=['BOOLEAN','STRING','ENUM','out','sequelize','exports'];(function(_0x185133,_0x29a472){var _0x862f7f=function(_0x25ea87){while(--_0x25ea87){_0x185133['push'](_0x185133['shift']());}};_0x862f7f(++_0x29a472);}(_0xa13d,0x154));var _0xda13=function(_0x4eba2b,_0xd4d0ee){_0x4eba2b=_0x4eba2b-0x0;var _0xa5adee=_0xa13d[_0x4eba2b];return _0xa5adee;};'use strict';var Sequelize=require(_0xda13('0x0'));var moment=require('moment');module[_0xda13('0x1')]={'closed':{'type':Sequelize[_0xda13('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xda13('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xda13('0x3')]},'note':{'type':Sequelize[_0xda13('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xda13('0x4')]('in',_0xda13('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xda13('0x4')]('in',_0xda13('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xda13('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 45eb362..c705f58 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 _0x4226=['basename','existsSync','createReadStream','pipe','createWriteStream','out','System','secret','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','rimraf','moment','bluebird','util','path','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','register','status','end','offset','undefined','limit','count','json','apply','save','destroy','sendStatus','name','send','Users','map','fullname','TagIds','split','Tags','then','catch','index','WhatsappInteraction','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','sort','where','filters','pick','field','from','tools_tags','select','u.id','u.fullname','ui.WhatsappInteractionId','left_join','users','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','length','conditions','find','unreadMessages','having','`\x20=\x200','Contact','$substring','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','createdAt','parse','$gte','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?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','agent','user','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','Contact.phone','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','push','all','include','options','create','update','params','describe','addMessage','ids','omit','getMessages','findOne','WhatsappMessage','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','color','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','User','CmContact','firstName','lastName','Attachment','Messages','direction','WhatsappAccount','Owner','get','mkdirSync','Whatsapp','Account','N.A.','closed'];(function(_0x5bff9a,_0x49d4b8){var _0x223cd4=function(_0x55dccb){while(--_0x55dccb){_0x5bff9a['push'](_0x5bff9a['shift']());}};_0x223cd4(++_0x49d4b8);}(_0x4226,0x1dc));var _0x6422=function(_0x278d39,_0x16f999){_0x278d39=_0x278d39-0x0;var _0x49a00d=_0x4226[_0x278d39];return _0x49a00d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6422('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6422('0x1'));var BPromise=require(_0x6422('0x2'));var Mustache=require('mustache');var util=require(_0x6422('0x3'));var path=require(_0x6422('0x4'));var sox=require(_0x6422('0x5'));var csv=require(_0x6422('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6422('0x7'));var crypto=require('crypto');var jsforce=require(_0x6422('0x8'));var deskjs=require(_0x6422('0x9'));var toCsv=require('to-csv');var querystring=require(_0x6422('0xa'));var Papa=require(_0x6422('0xb'));var Redis=require('ioredis');var authService=require(_0x6422('0xc'));var qs=require(_0x6422('0xd'));var as=require(_0x6422('0xe'));var pdf=require(_0x6422('0xf'));var hardwareService=require(_0x6422('0x10'));var logger=require(_0x6422('0x11'))(_0x6422('0x12'));var utils=require(_0x6422('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6422('0x14'));var db=require(_0x6422('0x15'))['db'];config['redis']=_['defaults'](config[_0x6422('0x16')],{'host':_0x6422('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6422('0x16')]));require('./whatsappInteraction.socket')[_0x6422('0x18')](socket);function respondWithStatusCode(_0x44421e,_0x26c88e){_0x26c88e=_0x26c88e||0xcc;return function(_0x441ad9){if(_0x441ad9){return _0x44421e['sendStatus'](_0x26c88e);}return _0x44421e[_0x6422('0x19')](_0x26c88e)[_0x6422('0x1a')]();};}function respondWithResult(_0x3c294d,_0xaf8fc4){_0xaf8fc4=_0xaf8fc4||0xc8;return function(_0x5a05f5){if(_0x5a05f5){return _0x3c294d[_0x6422('0x19')](_0xaf8fc4)['json'](_0x5a05f5);}};}function respondWithFilteredResult(_0x889629,_0x533c21){return function(_0xc18217){if(_0xc18217){var _0x5394a6=typeof _0x533c21[_0x6422('0x1b')]===_0x6422('0x1c')&&typeof _0x533c21[_0x6422('0x1d')]===_0x6422('0x1c');var _0x4a06f7=_0xc18217['count'];var _0x332108=_0x5394a6?0x0:_0x533c21[_0x6422('0x1b')];var _0x407798=_0x5394a6?_0xc18217[_0x6422('0x1e')]:_0x533c21[_0x6422('0x1b')]+_0x533c21[_0x6422('0x1d')];var _0x1af391;if(_0x407798>=_0x4a06f7){_0x407798=_0x4a06f7;_0x1af391=0xc8;}else{_0x1af391=0xce;}_0x889629[_0x6422('0x19')](_0x1af391);return _0x889629['set']('Content-Range',_0x332108+'-'+_0x407798+'/'+_0x4a06f7)[_0x6422('0x1f')](_0xc18217);}return null;};}function patchUpdates(_0x531199){return function(_0x467dfc){try{jsonpatch[_0x6422('0x20')](_0x467dfc,_0x531199,!![]);}catch(_0xb0e33a){return BPromise['reject'](_0xb0e33a);}return _0x467dfc[_0x6422('0x21')]();};}function saveUpdates(_0x57e2,_0x2cf5c2){return function(_0x423d89){if(_0x423d89){return _0x423d89['update'](_0x57e2)['then'](function(_0xfd0571){return _0xfd0571;});}return null;};}function removeEntity(_0x2ec4a3,_0x13c09b){return function(_0xca8eb2){if(_0xca8eb2){return _0xca8eb2[_0x6422('0x22')]()['then'](function(){_0x2ec4a3[_0x6422('0x19')](0xcc)[_0x6422('0x1a')]();});}};}function handleEntityNotFound(_0x316d97,_0x5efa1e){return function(_0x233dee){if(!_0x233dee){_0x316d97[_0x6422('0x23')](0x194);}return _0x233dee;};}function handleError(_0x464246,_0x551346){_0x551346=_0x551346||0x1f4;return function(_0x21c503){logger['error'](_0x21c503['stack']);if(_0x21c503['name']){delete _0x21c503[_0x6422('0x24')];}_0x464246[_0x6422('0x19')](_0x551346)[_0x6422('0x25')](_0x21c503);};}function getInteractionUsers(_0x5e6aa7,_0x5443fa){return new BPromise(function(_0x20b6d9,_0x153402){try{if(_0x5443fa[_0x5e6aa7['id']]){_0x5e6aa7[_0x6422('0x26')]=_[_0x6422('0x27')](_0x5443fa[_0x5e6aa7['id']],function(_0x55ecae){return{'id':_0x55ecae['id'],'fullname':_0x55ecae[_0x6422('0x28')]};});}}catch(_0x1a1189){_0x153402(_0x1a1189);}_0x20b6d9(_0x5e6aa7);});}function getInteractionTags(_0x1aa79a,_0x3b990e){return new BPromise(function(_0x492438,_0x445d2b){try{if(_0x1aa79a[_0x6422('0x29')]){_0x1aa79a['Tags']=[];_0x1aa79a['TagIds'][_0x6422('0x2a')](',')['forEach'](function(_0x14b164){_0x1aa79a[_0x6422('0x2b')]['push'](_0x3b990e[_0x14b164]);});}delete _0x1aa79a['TagIds'];}catch(_0x262fc9){_0x445d2b(_0x262fc9);}_0x492438(_0x1aa79a);});}function updateWhatsappInteraction(_0x173d27,_0x5d0aa6,_0x3b466e){return new BPromise(function(_0x39a935,_0x46b047){return getInteractionUsers(_0x173d27,_0x3b466e)[_0x6422('0x2c')](function(_0x4cb3c9){return getInteractionTags(_0x4cb3c9,_0x5d0aa6);})[_0x6422('0x2c')](function(_0x565707){_0x39a935(_0x565707);})[_0x6422('0x2d')](function(_0x57011a){_0x46b047(_0x57011a);});});}exports[_0x6422('0x2e')]=function(_0x3c672d,_0x287b8c){var _0x51865b={},_0x40a4e2={},_0x165d85={'count':0x0,'rows':[]};var _0x6ba22f=_[_0x6422('0x27')](db[_0x6422('0x2f')][_0x6422('0x30')],function(_0x32195b){return{'name':_0x32195b[_0x6422('0x31')],'type':_0x32195b[_0x6422('0x32')][_0x6422('0x33')]};});_0x40a4e2[_0x6422('0x34')]=_[_0x6422('0x27')](_0x6ba22f,_0x6422('0x24'));_0x40a4e2[_0x6422('0x35')]=_[_0x6422('0x36')](_0x3c672d[_0x6422('0x35')]);_0x40a4e2['filters']=_[_0x6422('0x37')](_0x40a4e2['model'],_0x40a4e2['query']);_0x51865b[_0x6422('0x38')]=_[_0x6422('0x37')](_0x40a4e2[_0x6422('0x34')],qs[_0x6422('0x39')](_0x3c672d['query'][_0x6422('0x39')]));_0x51865b[_0x6422('0x38')]=_0x51865b[_0x6422('0x38')]['length']?_0x51865b['attributes']:_0x40a4e2['model'];if(!_0x3c672d['query'][_0x6422('0x3a')]('nolimit')){_0x51865b[_0x6422('0x1d')]=qs['limit'](_0x3c672d[_0x6422('0x35')][_0x6422('0x1d')]);_0x51865b[_0x6422('0x1b')]=qs[_0x6422('0x1b')](_0x3c672d[_0x6422('0x35')][_0x6422('0x1b')]);}_0x51865b['order']=qs[_0x6422('0x3b')](_0x3c672d[_0x6422('0x35')][_0x6422('0x3b')]);_0x51865b[_0x6422('0x3c')]=qs[_0x6422('0x3d')](_[_0x6422('0x3e')](_0x3c672d['query'],_0x40a4e2[_0x6422('0x3d')]),_0x6ba22f);var _0x5702a4=[];var _0x574f77=squel['select']()['field']('id')[_0x6422('0x3f')](_0x6422('0x24'))['field']('color')[_0x6422('0x40')](_0x6422('0x41'));var _0x35b9fb=squel[_0x6422('0x42')]()[_0x6422('0x3f')](_0x6422('0x43'))[_0x6422('0x3f')](_0x6422('0x44'))[_0x6422('0x3f')](_0x6422('0x45'))[_0x6422('0x40')]('user_has_whatsapp_interactions','ui')[_0x6422('0x46')](_0x6422('0x47'),'u',_0x6422('0x48'));var _0x3e0959=squel['select']()['from']('whatsapp_interactions','i')[_0x6422('0x46')]('cm_contacts','c',_0x6422('0x49'))[_0x6422('0x46')]('users','o',_0x6422('0x4a'))[_0x6422('0x46')](_0x6422('0x4b'),'a',_0x6422('0x4c'))[_0x6422('0x46')](_0x6422('0x4d'),'me',_0x6422('0x4e'))[_0x6422('0x46')](_0x6422('0x4f'),'it',_0x6422('0x50'))[_0x6422('0x46')](_0x6422('0x41'),'t',_0x6422('0x51'));var _0x4542c8=squel[_0x6422('0x52')]();var _0x2e8282=[];var _0x49dc0f=squel[_0x6422('0x52')]();var _0x9ce980;if(_0x3c672d[_0x6422('0x35')][_0x6422('0x53')]){_0x9ce980=as[_0x6422('0x54')](_0x3c672d[_0x6422('0x35')]['search']);var _0x5e1d2c=_0x9ce980[_0x6422('0x55')];for(var _0x32245a=0x0;_0x32245a<_0x9ce980['conditions'][_0x6422('0x56')];_0x32245a++){var _0x3352d0=_0x9ce980[_0x6422('0x57')][_0x32245a];var _0x536ff1='i';var _0x43c7e0=_[_0x6422('0x58')](_0x6ba22f,[_0x6422('0x24'),_0x3352d0[_0x6422('0x3f')]]);if(!_0x43c7e0){switch(_0x3352d0['field']){case _0x6422('0x59'):if(_0x3352d0['value']==0x1){_0x3e0959[_0x6422('0x5a')]('`'+_0x3352d0[_0x6422('0x3f')]+_0x6422('0x5b'));}else{_0x3e0959[_0x6422('0x5a')]('`'+_0x3352d0[_0x6422('0x3f')]+'`\x20>\x200');}break;case _0x6422('0x5c'):if(_0x3352d0['operator']===_0x6422('0x5d')){if(_0x3352d0[_0x6422('0x5e')][_0x6422('0x2a')]('\x20')[_0x6422('0x56')]>0x1){_0x4542c8[_0x5e1d2c]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x6422('0x5f')](_0x3352d0[_0x6422('0x5e')]),null);}else{var _0x5ae57c='%'+_0x3352d0['value']+'%';_0x4542c8[_0x5e1d2c](_0x6422('0x60'),_0x5ae57c,_0x5ae57c,_0x5ae57c);}}else{_0x43c7e0=_[_0x6422('0x58')](_0x6ba22f,[_0x6422('0x24'),'ContactId']);_0x3352d0[_0x6422('0x3f')]=_0x6422('0x61');_0x317033=as['buildExpression'](_0x536ff1,_0x43c7e0[_0x6422('0x32')],_0x3352d0);_0x4542c8[_0x5e1d2c](_0x317033[_0x6422('0x62')],_0x317033['value'][_0x6422('0x63')],_0x317033[_0x6422('0x5e')][_0x6422('0x1a')]);}break;case _0x6422('0x64'):var _0x202859=_0x3352d0[_0x6422('0x5e')][_0x6422('0x2a')](',')[_0x6422('0x27')](function(_0x16698e){return Number(_0x16698e);});_0x202859[_0x6422('0x65')](function(_0xf2d083){_0x49dc0f['or'](_0x6422('0x66'),'%,'+_0xf2d083+',%');});_0x2e8282=_[_0x6422('0x67')](_0x2e8282,_0x202859);break;case'User':if(_0x3352d0[_0x6422('0x68')]===_0x6422('0x5d')){_0x4542c8[_0x5e1d2c](_0x6422('0x69'),'%'+_0x3352d0['value']+'%',null);}else{_0x43c7e0=_[_0x6422('0x58')](_0x6ba22f,['name','UserId']);_0x3352d0[_0x6422('0x3f')]=_0x6422('0x6a');_0x317033=as[_0x6422('0x6b')](_0x536ff1,_0x43c7e0[_0x6422('0x32')],_0x3352d0);_0x4542c8[_0x5e1d2c](_0x317033[_0x6422('0x62')],_0x317033[_0x6422('0x5e')][_0x6422('0x63')],_0x317033[_0x6422('0x5e')][_0x6422('0x1a')]);}break;case _0x6422('0x6c'):_0x317033=as['buildExpression']('me',null,_0x3352d0);_0x4542c8[_0x5e1d2c](_0x317033[_0x6422('0x62')],_0x317033[_0x6422('0x5e')]['start'],_0x317033['value'][_0x6422('0x1a')]);break;}}else{var _0x317033=as['buildExpression'](_0x536ff1,_0x43c7e0[_0x6422('0x32')],_0x3352d0);_0x4542c8[_0x5e1d2c](_0x317033['text'],_0x317033[_0x6422('0x5e')]['start'],_0x317033[_0x6422('0x5e')][_0x6422('0x1a')]);}}}else{var _0x4808dd=_(_0x3c672d[_0x6422('0x35')])[_0x6422('0x36')]()[_0x6422('0x27')](function(_0x15697c){return _[_0x6422('0x6d')](_0x6ba22f,[_0x6422('0x24'),_0x15697c])?_0x15697c:undefined;})[_0x6422('0x6e')]()['value']();if(!_[_0x6422('0x6f')](_0x4808dd)){_0x4808dd['forEach'](function(_0x47d460){if(_0x47d460===_0x6422('0x70')){_0x3e0959['where'](_0x6422('0x71'),[]['concat'](_0x3c672d[_0x6422('0x35')][_0x47d460]));}else if(_0x47d460===_0x6422('0x72')){var _0x3fb35a=JSON[_0x6422('0x73')](_0x3c672d[_0x6422('0x35')][_0x47d460])[_0x6422('0x74')];var _0x3f3be5=JSON['parse'](_0x3c672d[_0x6422('0x35')][_0x47d460])['$lte'];_0x3e0959['where'](_0x6422('0x75'),_0x3fb35a,_0x3f3be5);}else{if(_0x3c672d[_0x6422('0x35')][_0x47d460]===_0x6422('0x76')){_0x3e0959['where']('i.'+_0x47d460+_0x6422('0x77'));}else{_0x3e0959[_0x6422('0x3c')]('i.'+_0x47d460+_0x6422('0x78'),_0x3c672d['query'][_0x47d460]);}}});}if(_0x3c672d[_0x6422('0x35')][_0x6422('0x79')]){if(_0x3c672d[_0x6422('0x35')][_0x6422('0x79')]==0x1){_0x3e0959['having'](_0x6422('0x7a'));}else{_0x3e0959[_0x6422('0x5a')](_0x6422('0x7b'));}}if(_0x3c672d[_0x6422('0x35')][_0x6422('0x7c')]){_0x2e8282=_[_0x6422('0x7d')](_0x3c672d['query'][_0x6422('0x7c')])?_0x3c672d['query'][_0x6422('0x7c')]:new Array(_0x3c672d['query'][_0x6422('0x7c')]);_0x2e8282['forEach'](function(_0x1fadca){_0x49dc0f['or'](_0x6422('0x66'),'%,'+_0x1fadca+',%');});}if(_0x3c672d[_0x6422('0x35')]['filter']){var _0x3ca9b5=_0x3c672d['query'][_0x6422('0x7e')]['replace']('\x5c','\x5c\x5c')[_0x6422('0x7f')](/'/g,'\x27\x27');if(qs[_0x6422('0x80')](_0x3ca9b5)){_0x4542c8['or'](_0x6422('0x81'),_0x3ca9b5+'%')['or'](_0x6422('0x82'),_0x3ca9b5+'%');}else{_0x4542c8['or'](_0x6422('0x83'),qs['getFullTextValue'](_0x3ca9b5))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3ca9b5+'%');}}}_0x3e0959[_0x6422('0x3c')](_0x4542c8);_0x3e0959['group'](_0x6422('0x84'));var _0x50f696={'type':db[_0x6422('0x85')]['QueryTypes'][_0x6422('0x86')],'raw':!![]};var _0x486e6c=_0x3e0959[_0x6422('0x87')]();_0x486e6c[_0x6422('0x3f')]('i.id');_0x486e6c['field'](_0x6422('0x88'),_0x6422('0x59'));if(_0x51865b[_0x6422('0x89')]){_0x51865b[_0x6422('0x89')]['forEach'](function(_0xaf5658){var _0x366e93=_0xaf5658[0x0]===_0x6422('0x8a')?_0xaf5658[0x0]:'i.'+_0xaf5658[0x0];_0x3e0959[_0x6422('0x89')](_0x366e93,_0xaf5658[0x1]==='DESC'?![]:!![]);});}if(!_[_0x6422('0x6f')](_0x2e8282)){_0x3e0959[_0x6422('0x5a')](_0x49dc0f);_0x486e6c['where']('t.id\x20IN\x20?',_0x2e8282);}BPromise[_0x6422('0x8b')]()[_0x6422('0x2c')](function(){if(!_0x9ce980){if(_0x3c672d[_0x6422('0x35')][_0x6422('0x70')])return;_0x486e6c['where'](_0x6422('0x8c'));_0x3e0959['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x3c672d['user'][_0x6422('0x8d')]!==_0x6422('0x8e'))return;return _0x3c672d[_0x6422('0x8f')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0x6422('0x2c')](function(_0x33c62b){if(_['isEmpty'](_0x33c62b)){_0x486e6c[_0x6422('0x3c')](_0x6422('0x90'));_0x3e0959[_0x6422('0x3c')](_0x6422('0x90'));}else{_0x486e6c['where'](_0x6422('0x71'),_['map'](_0x33c62b,'id'));_0x3e0959['where'](_0x6422('0x71'),_[_0x6422('0x27')](_0x33c62b,'id'));}});})[_0x6422('0x2c')](function(){if(_0x3c672d[_0x6422('0x8f')]['role']===_0x6422('0x8e')&&!_0x9ce980&&!_0x3c672d[_0x6422('0x35')][_0x6422('0x70')])return[];return db[_0x6422('0x91')][_0x6422('0x35')](_0x486e6c[_0x6422('0x92')](),_0x50f696);})[_0x6422('0x2c')](function(_0x5a95b2){_0x165d85[_0x6422('0x1e')]=_0x5a95b2[_0x6422('0x56')];if(_0x165d85[_0x6422('0x1e')]===0x0)return[];return db['sequelize'][_0x6422('0x35')](_0x574f77[_0x6422('0x92')](),_0x50f696)[_0x6422('0x2c')](function(_0xb130c4){_0x5702a4=_[_0x6422('0x93')](_0xb130c4,'id');_0x50f696=_[_0x6422('0x94')](_0x50f696,{'model':db[_0x6422('0x2f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3c672d[_0x6422('0x35')][_0x6422('0x39')]){_0x51865b[_0x6422('0x38')][_0x6422('0x65')](function(_0x342091){_0x3e0959[_0x6422('0x3f')]('i.'+_0x342091);});}else{_0x3e0959[_0x6422('0x3f')](_0x6422('0x88'),_0x6422('0x59'));_0x3e0959[_0x6422('0x3f')](_0x6422('0x95'),'Account.key');_0x3e0959[_0x6422('0x3f')](_0x6422('0x96'),_0x6422('0x97'));_0x3e0959['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',_0x6422('0x8a'));_0x3e0959[_0x6422('0x3f')]('i.*');_0x3e0959['field'](_0x6422('0x98'),_0x6422('0x99'));_0x3e0959[_0x6422('0x3f')](_0x6422('0x9a'),_0x6422('0x9b'));_0x3e0959[_0x6422('0x3f')]('c.email',_0x6422('0x9c'));_0x3e0959[_0x6422('0x3f')]('c.phone',_0x6422('0x9d'));_0x3e0959[_0x6422('0x3f')]('c.mobile','Contact.mobile');_0x3e0959[_0x6422('0x3f')](_0x6422('0x9e'),_0x6422('0x9f'));_0x3e0959[_0x6422('0x3f')]('o.fullname',_0x6422('0xa0'));_0x3e0959[_0x6422('0x3f')](_0x6422('0xa1'),_0x6422('0xa2'));_0x3e0959[_0x6422('0x3f')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x6422('0x29'));}if(_0x51865b['limit'])_0x3e0959[_0x6422('0x1d')](_0x51865b[_0x6422('0x1d')]);if(_0x51865b['offset'])_0x3e0959['offset'](_0x51865b[_0x6422('0x1b')]);return db[_0x6422('0x91')][_0x6422('0x35')](_0x3e0959[_0x6422('0x92')](),_0x50f696);})[_0x6422('0x2c')](function(_0x5b8b7a){if(_0x5b8b7a[_0x6422('0x56')]>0x0)_0x35b9fb[_0x6422('0x3c')](_0x6422('0xa3'),_[_0x6422('0x27')](_0x5b8b7a,'id'));return db['sequelize'][_0x6422('0x35')](_0x35b9fb['toString'](),_0x50f696)[_0x6422('0x2c')](function(_0x23de7f){var _0x2346d0=_[_0x6422('0xa4')](_0x23de7f,_0x6422('0xa5'));var _0x24a0af=[];_0x5b8b7a[_0x6422('0x65')](function(_0xa0421c){_0x24a0af[_0x6422('0xa6')](updateWhatsappInteraction(_0xa0421c,_0x5702a4,_0x2346d0));});return BPromise[_0x6422('0xa7')](_0x24a0af);});});})[_0x6422('0x2c')](function(_0x34746c){_0x165d85['rows']=_0x34746c;return _0x165d85;})[_0x6422('0x2c')](respondWithFilteredResult(_0x287b8c,_0x51865b))[_0x6422('0x2d')](handleError(_0x287b8c,null));};exports['show']=function(_0x400b19,_0x2113ac){var _0x349f76={'raw':![],'where':{'id':_0x400b19['params']['id']}},_0x3b9722={};_0x3b9722[_0x6422('0x34')]=_[_0x6422('0x36')](db[_0x6422('0x2f')]['rawAttributes']);_0x3b9722['query']=_[_0x6422('0x36')](_0x400b19[_0x6422('0x35')]);_0x3b9722[_0x6422('0x3d')]=_[_0x6422('0x37')](_0x3b9722['model'],_0x3b9722['query']);_0x349f76[_0x6422('0x38')]=_[_0x6422('0x37')](_0x3b9722[_0x6422('0x34')],qs['fields'](_0x400b19[_0x6422('0x35')][_0x6422('0x39')]));_0x349f76[_0x6422('0x38')]=_0x349f76[_0x6422('0x38')][_0x6422('0x56')]?_0x349f76[_0x6422('0x38')]:_0x3b9722[_0x6422('0x34')];if(_0x400b19['query']['includeAll']){_0x349f76[_0x6422('0xa8')]=[{'all':!![]}];}_0x349f76=_[_0x6422('0x94')]({},_0x349f76,_0x400b19[_0x6422('0xa9')]);return db['WhatsappInteraction']['find'](_0x349f76)[_0x6422('0x2c')](handleEntityNotFound(_0x2113ac,null))['then'](respondWithResult(_0x2113ac,null))[_0x6422('0x2d')](handleError(_0x2113ac,null));};exports[_0x6422('0xaa')]=function(_0x3dc3d2,_0x52f774){return db[_0x6422('0x2f')][_0x6422('0xaa')](_0x3dc3d2[_0x6422('0x6c')],{})[_0x6422('0x2c')](respondWithResult(_0x52f774,0xc9))['catch'](handleError(_0x52f774,null));};exports[_0x6422('0xab')]=function(_0x1ec071,_0x21517e){if(_0x1ec071[_0x6422('0x6c')]['id']){delete _0x1ec071[_0x6422('0x6c')]['id'];}return db[_0x6422('0x2f')]['find']({'where':{'id':_0x1ec071['params']['id']}})[_0x6422('0x2c')](handleEntityNotFound(_0x21517e,null))['then'](saveUpdates(_0x1ec071[_0x6422('0x6c')],null))['then'](respondWithResult(_0x21517e,null))[_0x6422('0x2d')](handleError(_0x21517e,null));};exports['destroy']=function(_0x10a799,_0x9390a2){return db[_0x6422('0x2f')][_0x6422('0x58')]({'where':{'id':_0x10a799[_0x6422('0xac')]['id']}})[_0x6422('0x2c')](handleEntityNotFound(_0x9390a2,null))[_0x6422('0x2c')](removeEntity(_0x9390a2,null))[_0x6422('0x2d')](handleError(_0x9390a2,null));};exports[_0x6422('0xad')]=function(_0x3e2b7b,_0x467052){return db[_0x6422('0x2f')][_0x6422('0xad')]()[_0x6422('0x2c')](respondWithResult(_0x467052,null))[_0x6422('0x2d')](handleError(_0x467052,null));};exports[_0x6422('0xae')]=function(_0x23774f,_0x18d8e,_0x1bb927){return db['WhatsappMessage'][_0x6422('0x58')]({'where':{'id':_0x23774f[_0x6422('0xac')]['id']}})[_0x6422('0x2c')](handleEntityNotFound(_0x18d8e,null))[_0x6422('0x2c')](function(_0x42cab1){if(_0x42cab1){return _0x42cab1[_0x6422('0xae')](_0x23774f[_0x6422('0x6c')][_0x6422('0xaf')],_[_0x6422('0xb0')](_0x23774f['body'],[_0x6422('0xaf'),'id'])||{});}})[_0x6422('0x2c')](respondWithResult(_0x18d8e,null))[_0x6422('0x2d')](handleError(_0x18d8e,null));};exports[_0x6422('0xb1')]=function(_0x2a3d69,_0x3206e3,_0x102123){var _0x203331={'raw':![],'where':{}};var _0x5c64fe={};var _0x4f2af2={'count':0x0,'rows':[]};return db[_0x6422('0x2f')][_0x6422('0xb2')]({'where':{'id':_0x2a3d69['params']['id']}})['then'](handleEntityNotFound(_0x3206e3,null))[_0x6422('0x2c')](function(_0x54e6d3){if(_0x54e6d3){_0x5c64fe[_0x6422('0x34')]=_[_0x6422('0x36')](db[_0x6422('0xb3')][_0x6422('0x30')]);_0x5c64fe[_0x6422('0x35')]=_[_0x6422('0x36')](_0x2a3d69['query']);_0x5c64fe[_0x6422('0x3d')]=_[_0x6422('0x37')](_0x5c64fe['model'],_0x5c64fe['query']);_0x203331[_0x6422('0x38')]=_[_0x6422('0x37')](_0x5c64fe[_0x6422('0x34')],qs['fields'](_0x2a3d69[_0x6422('0x35')][_0x6422('0x39')]));_0x203331[_0x6422('0x38')]=_0x203331[_0x6422('0x38')]['length']?_0x203331[_0x6422('0x38')]:_0x5c64fe[_0x6422('0x34')];if(!_0x2a3d69[_0x6422('0x35')]['hasOwnProperty']('nolimit')){_0x203331[_0x6422('0x1d')]=qs[_0x6422('0x1d')](_0x2a3d69[_0x6422('0x35')][_0x6422('0x1d')]);_0x203331['offset']=qs[_0x6422('0x1b')](_0x2a3d69[_0x6422('0x35')][_0x6422('0x1b')]);}_0x203331[_0x6422('0x89')]=qs[_0x6422('0x3b')](_0x2a3d69[_0x6422('0x35')][_0x6422('0x3b')]);_0x203331[_0x6422('0x3c')]=qs[_0x6422('0x3d')](_[_0x6422('0x3e')](_0x2a3d69[_0x6422('0x35')],_0x5c64fe[_0x6422('0x3d')]));_0x203331[_0x6422('0x3c')][_0x6422('0xa5')]=_0x54e6d3['id'];if(_0x2a3d69[_0x6422('0x35')]['filter']){_0x203331[_0x6422('0x3c')]=_[_0x6422('0x94')](_0x203331[_0x6422('0x3c')],{'$or':_[_0x6422('0x27')](_0x203331[_0x6422('0x38')],function(_0x2df856){var _0x571f9b={};_0x571f9b[_0x2df856]={'$like':'%'+_0x2a3d69[_0x6422('0x35')]['filter']+'%'};return _0x571f9b;})});}if(_0x2a3d69['query'][_0x6422('0x74')]){var _0x4f62a2=_0x2a3d69['query'][_0x6422('0x74')]['split'](',');var _0x3558ef={};_0x3558ef[_0x4f62a2[0x0]]={'$gte':moment(_0x4f62a2[0x1])[_0x6422('0xb4')](_0x6422('0xb5'))};_0x203331[_0x6422('0x3c')]=_[_0x6422('0x94')](_0x203331['where'],_0x3558ef);}_0x203331=_[_0x6422('0x94')]({},_0x203331,_0x2a3d69[_0x6422('0xa9')]);return db[_0x6422('0xb3')][_0x6422('0x1e')]({'where':_0x203331[_0x6422('0x3c')]})[_0x6422('0x2c')](function(_0x3f2446){_0x4f2af2[_0x6422('0x1e')]=_0x3f2446;if(_0x2a3d69[_0x6422('0x35')]['includeAll']){_0x203331[_0x6422('0xa8')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x6422('0xb6')](_0x203331);})['then'](function(_0x47a206){_0x4f2af2[_0x6422('0xb7')]=_0x47a206;return _0x4f2af2;});}})[_0x6422('0x2c')](respondWithFilteredResult(_0x3206e3,_0x203331))[_0x6422('0x2d')](handleError(_0x3206e3,null));};exports[_0x6422('0xb8')]=function(_0x4f528f,_0x1b24a0,_0x18cdc6){return db[_0x6422('0x2f')][_0x6422('0x58')]({'where':{'id':_0x4f528f[_0x6422('0xac')]['id']}})[_0x6422('0x2c')](handleEntityNotFound(_0x1b24a0,null))[_0x6422('0x2c')](function(_0x1320e1){if(_0x1320e1){return _0x1320e1[_0x6422('0xb9')](_0x4f528f[_0x6422('0x6c')]['ids'],_[_0x6422('0xb0')](_0x4f528f['body'],[_0x6422('0xaf'),'id'])||{})[_0x6422('0xba')](function(){return db[_0x6422('0x64')][_0x6422('0xb6')]({'attributes':['id',_0x6422('0x24'),_0x6422('0xbb')],'where':{'id':_0x4f528f[_0x6422('0x6c')]['ids']}});})[_0x6422('0x2c')](function(_0x13e974){socket[_0x6422('0xbc')](_0x6422('0xbd'),{'id':Number(_0x4f528f[_0x6422('0xac')]['id']),'tags':_0x13e974||[]});return{'id':Number(_0x4f528f[_0x6422('0xac')]['id']),'tags':_0x13e974||[]};});}})[_0x6422('0x2c')](respondWithResult(_0x1b24a0,null))[_0x6422('0x2d')](handleError(_0x1b24a0,null));};exports[_0x6422('0xbe')]=function(_0x5891fa,_0x295cec,_0x2e269b){return db['WhatsappInteraction'][_0x6422('0x58')]({'where':{'id':_0x5891fa[_0x6422('0xac')]['id']}})['then'](handleEntityNotFound(_0x295cec,null))[_0x6422('0x2c')](function(_0x5901d2){if(_0x5901d2){return _0x5901d2[_0x6422('0xbe')](_0x5891fa[_0x6422('0x35')][_0x6422('0xaf')]);}})['then'](respondWithStatusCode(_0x295cec,null))[_0x6422('0x2d')](handleError(_0x295cec,null));};exports[_0x6422('0xbf')]=function(_0x3785f4,_0x336577){var _0x22f9ae=moment()[_0x6422('0xc0')]()['toString']();var _0x1f3f42=path[_0x6422('0xc1')](config[_0x6422('0xc2')],_0x6422('0xc3'),_0x6422('0xc4'),_0x6422('0xc5'));var _0x2d04cb=path['join'](config[_0x6422('0xc2')],_0x6422('0xc3'),_0x6422('0xc4'),_0x6422('0xc6'));var _0x584a28=path[_0x6422('0xc1')](_0x1f3f42,_0x22f9ae);var _0x5b3bb6=util[_0x6422('0xb4')]('transcript-%d-%s.zip',_0x3785f4[_0x6422('0xac')]['id'],_0x22f9ae);var _0xea5bed=path[_0x6422('0xc1')](_0x1f3f42,_0x5b3bb6);var _0x4431f2=[];_0x4431f2[_0x6422('0xa6')]({'model':db[_0x6422('0xc7')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x4431f2[_0x6422('0xa6')]({'model':db[_0x6422('0xc8')],'as':_0x6422('0x5c'),'attributes':['id',_0x6422('0xc9'),_0x6422('0xca')],'raw':!![]});if(_0x3785f4[_0x6422('0x35')][_0x6422('0xc6')]){_0x4431f2[_0x6422('0xa6')]({'model':db[_0x6422('0xcb')],'as':_0x6422('0xcb'),'raw':!![]});}var _0x2d7d3a=[{'model':db[_0x6422('0xb3')],'as':_0x6422('0xcc'),'attributes':['id','body',_0x6422('0x72'),_0x6422('0xcd'),'secret',_0x6422('0x79')],'include':_0x4431f2}];_0x2d7d3a[_0x6422('0xa6')]({'model':db[_0x6422('0xce')],'as':'Account','attributes':['id',_0x6422('0x24')]});_0x2d7d3a['push']({'model':db[_0x6422('0xc7')],'as':_0x6422('0xcf'),'attributes':['id',_0x6422('0x28')]});return db[_0x6422('0x2f')][_0x6422('0x58')]({'where':{'id':_0x3785f4[_0x6422('0xac')]['id']},'include':_0x2d7d3a})['then'](handleEntityNotFound(_0x336577,null))[_0x6422('0x2c')](function(_0x47c783){if(_0x47c783){var _0x58c42a=_0x47c783[_0x6422('0xd0')]({'plain':!![]});fs[_0x6422('0xd1')](_0x584a28);var _0xa24af5={'channel':_0x6422('0xd2'),'account':_0x58c42a[_0x6422('0xd3')][_0x6422('0x24')],'agent':_0x58c42a['Owner']?_0x58c42a[_0x6422('0xcf')][_0x6422('0x28')]:_0x6422('0xd4'),'createdAt':moment(_0x58c42a[_0x6422('0x72')])[_0x6422('0xb4')](_0x6422('0xb5'))['toString'](),'closedAt':_0x58c42a[_0x6422('0xd5')]?moment(_0x58c42a['closedAt'])[_0x6422('0xb4')]('YYYY-MM-DD\x20HH:mm:ss')[_0x6422('0x92')]():'','disposition':_0x58c42a['disposition'],'messages':_(_0x58c42a[_0x6422('0xcc')])[_0x6422('0x7e')]({'secret':![]})[_0x6422('0x27')](function(_0x200ac5){if(_0x200ac5[_0x6422('0xcb')]){var _0x49d675=path[_0x6422('0xc1')](_0x2d04cb,_0x200ac5['Attachment'][_0x6422('0xd6')]);if(fs[_0x6422('0xd7')](_0x49d675)){fs[_0x6422('0xd8')](_0x49d675)[_0x6422('0xd9')](fs[_0x6422('0xda')](path[_0x6422('0xc1')](_0x584a28,_0x200ac5[_0x6422('0xcb')][_0x6422('0xd6')])));}}return{'date':moment(_0x200ac5[_0x6422('0x72')])[_0x6422('0xb4')]('YYYY-MM-DD\x20HH:mm:ss')[_0x6422('0x92')](),'sender':_0x200ac5[_0x6422('0xcd')]===_0x6422('0xdb')?_0x200ac5[_0x6422('0xc7')]?_0x200ac5[_0x6422('0xc7')]['fullname']:_0x6422('0xdc'):_0x200ac5[_0x6422('0x5c')][_0x6422('0xc9')]+(_0x200ac5[_0x6422('0x5c')]['lastName']?'\x20'+_0x200ac5[_0x6422('0x5c')][_0x6422('0xca')]:''),'body':_0x200ac5[_0x6422('0xcb')]?_0x200ac5[_0x6422('0xcb')][_0x6422('0xd6')]:_0x200ac5[_0x6422('0x6c')],'direction':_0x200ac5[_0x6422('0xcd')]===_0x6422('0xdb')?'A':'C','secret':_0x200ac5[_0x6422('0xdd')],'read':_0x200ac5[_0x6422('0x79')],'attachment':_0x200ac5['Attachment']};})[_0x6422('0x5e')]()};return ejs[_0x6422('0xde')](path[_0x6422('0xc1')](config[_0x6422('0xc2')],_0x6422('0xc3'),_0x6422('0xdf'),_0x6422('0xe0')),{'interaction':_0xa24af5})[_0x6422('0x2c')](function(_0x5d7fa6){var _0x27c32f=path[_0x6422('0xc1')](_0x584a28,_0x6422('0xe1')+_0x58c42a['id']+'-'+_0x22f9ae+_0x6422('0xe2'));var _0x5792b7={'path':_0x27c32f,'channel':_0x6422('0xd2'),'interactionId':_0x58c42a['id']};return pdf['createPdfFromHTML'](_0x5d7fa6,_0x5792b7);})[_0x6422('0x2c')](function(){return new BPromise(function(_0x4911a6,_0x18d3dc){zipdir(_0x584a28,{'saveTo':_0xea5bed},function(_0x1d82c8,_0x4c60db){if(_0x1d82c8)return _0x18d3dc(_0x1d82c8);return _0x4911a6(_0x4c60db);});})[_0x6422('0x2c')](function(){return new BPromise(function(_0xec839c,_0x3fa490){rimraf(_0x584a28,function(_0x1d7ac0){if(_0x1d7ac0)_0x3fa490(_0x1d7ac0);return _0xec839c();});});})['then'](function(){return _0x336577['download'](_0xea5bed,_0x5b3bb6,function(_0x2fec53){if(_0x2fec53){console[_0x6422('0xe3')](_0x6422('0xe4'),_0x2fec53);}else{fs[_0x6422('0xe5')](_0xea5bed);}});});});}else{return _0x336577[_0x6422('0x23')](0xc8);}})['catch'](handleError(_0x336577,null));}; \ No newline at end of file +var _0xb620=['pick','field','color','from','tools_tags','select','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','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','length','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','start','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','text','some','compact','forEach','WhatsappAccountId','concat','$gte','parse','$lte','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','getWhatsappAccounts','isEmpty','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','role','agent','sequelize','toString','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','Contact.lastName','c.phone','c.mobile','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','params','rawAttributes','keys','includeAll','include','options','create','body','destroy','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','omit','spread','Tag','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','tmp','attachments','transcript-%d-%s.zip','CmContact','lastName','Attachment','Messages','createdAt','direction','secret','WhatsappAccount','Owner','get','mkdirSync','Whatsapp','Account','N.A.','closed','closedAt','disposition','basename','existsSync','createReadStream','createWriteStream','out','System','firstName','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','push','catch','index','WhatsappInteraction','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x145624,_0x1ca5be){var _0x159468=function(_0x43ed4e){while(--_0x43ed4e){_0x145624['push'](_0x145624['shift']());}};_0x159468(++_0x1ca5be);}(_0xb620,0x1a0));var _0x0b62=function(_0x1f5b2f,_0x4b4b50){_0x1f5b2f=_0x1f5b2f-0x0;var _0x40a680=_0xb620[_0x1f5b2f];return _0x40a680;};'use strict';var emlformat=require(_0x0b62('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0b62('0x1'));var jsonpatch=require(_0x0b62('0x2'));var rp=require('request-promise');var moment=require(_0x0b62('0x3'));var BPromise=require(_0x0b62('0x4'));var Mustache=require(_0x0b62('0x5'));var util=require(_0x0b62('0x6'));var path=require(_0x0b62('0x7'));var sox=require(_0x0b62('0x8'));var csv=require('to-csv');var ejs=require(_0x0b62('0x9'));var fs=require('fs');var fs_extra=require(_0x0b62('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0b62('0xb'));var jsforce=require(_0x0b62('0xc'));var deskjs=require(_0x0b62('0xd'));var toCsv=require(_0x0b62('0xe'));var querystring=require(_0x0b62('0xf'));var Papa=require('papaparse');var Redis=require(_0x0b62('0x10'));var authService=require(_0x0b62('0x11'));var qs=require(_0x0b62('0x12'));var as=require(_0x0b62('0x13'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x0b62('0x14'));var logger=require(_0x0b62('0x15'))(_0x0b62('0x16'));var utils=require(_0x0b62('0x17'));var config=require(_0x0b62('0x18'));var licenseUtil=require(_0x0b62('0x19'));var db=require(_0x0b62('0x1a'))['db'];config[_0x0b62('0x1b')]=_[_0x0b62('0x1c')](config[_0x0b62('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x0b62('0x1d'))(new Redis(config[_0x0b62('0x1b')]));require('./whatsappInteraction.socket')[_0x0b62('0x1e')](socket);function respondWithStatusCode(_0xf8f5df,_0x5ac80b){_0x5ac80b=_0x5ac80b||0xcc;return function(_0x5e4dfc){if(_0x5e4dfc){return _0xf8f5df[_0x0b62('0x1f')](_0x5ac80b);}return _0xf8f5df[_0x0b62('0x20')](_0x5ac80b)[_0x0b62('0x21')]();};}function respondWithResult(_0x574e21,_0xcaf6fe){_0xcaf6fe=_0xcaf6fe||0xc8;return function(_0x58c82a){if(_0x58c82a){return _0x574e21['status'](_0xcaf6fe)[_0x0b62('0x22')](_0x58c82a);}};}function respondWithFilteredResult(_0x11c3a9,_0x5d71f5){return function(_0x3032be){if(_0x3032be){var _0x1cba53=typeof _0x5d71f5['offset']==='undefined'&&typeof _0x5d71f5[_0x0b62('0x23')]===_0x0b62('0x24');var _0x53759e=_0x3032be[_0x0b62('0x25')];var _0x505d30=_0x1cba53?0x0:_0x5d71f5[_0x0b62('0x26')];var _0x26e72d=_0x1cba53?_0x3032be[_0x0b62('0x25')]:_0x5d71f5[_0x0b62('0x26')]+_0x5d71f5['limit'];var _0x45723c;if(_0x26e72d>=_0x53759e){_0x26e72d=_0x53759e;_0x45723c=0xc8;}else{_0x45723c=0xce;}_0x11c3a9[_0x0b62('0x20')](_0x45723c);return _0x11c3a9['set'](_0x0b62('0x27'),_0x505d30+'-'+_0x26e72d+'/'+_0x53759e)['json'](_0x3032be);}return null;};}function patchUpdates(_0x4b75f6){return function(_0x34b71e){try{jsonpatch[_0x0b62('0x28')](_0x34b71e,_0x4b75f6,!![]);}catch(_0x20940e){return BPromise[_0x0b62('0x29')](_0x20940e);}return _0x34b71e[_0x0b62('0x2a')]();};}function saveUpdates(_0x42c1ab,_0x4a03a7){return function(_0x464257){if(_0x464257){return _0x464257[_0x0b62('0x2b')](_0x42c1ab)[_0x0b62('0x2c')](function(_0x389256){return _0x389256;});}return null;};}function removeEntity(_0x3393f1,_0x3410d4){return function(_0x441ea6){if(_0x441ea6){return _0x441ea6['destroy']()[_0x0b62('0x2c')](function(){_0x3393f1[_0x0b62('0x20')](0xcc)[_0x0b62('0x21')]();});}};}function handleEntityNotFound(_0x5576c4,_0x4a7d39){return function(_0x3ee5fe){if(!_0x3ee5fe){_0x5576c4[_0x0b62('0x1f')](0x194);}return _0x3ee5fe;};}function handleError(_0x32bf42,_0x5f4820){_0x5f4820=_0x5f4820||0x1f4;return function(_0x22f315){logger[_0x0b62('0x2d')](_0x22f315[_0x0b62('0x2e')]);if(_0x22f315[_0x0b62('0x2f')]){delete _0x22f315['name'];}_0x32bf42[_0x0b62('0x20')](_0x5f4820)[_0x0b62('0x30')](_0x22f315);};}function getInteractionUsers(_0x55cac0,_0x1b7088){return new BPromise(function(_0x3cc50e,_0x2acf84){try{if(_0x1b7088[_0x55cac0['id']]){_0x55cac0[_0x0b62('0x31')]=_[_0x0b62('0x32')](_0x1b7088[_0x55cac0['id']],function(_0x9e2b87){return{'id':_0x9e2b87['id'],'fullname':_0x9e2b87[_0x0b62('0x33')]};});}}catch(_0x31ef41){_0x2acf84(_0x31ef41);}_0x3cc50e(_0x55cac0);});}function getInteractionTags(_0x3d8435,_0x39dbf5){return new BPromise(function(_0x4958b3,_0x2f5a69){try{if(_0x3d8435[_0x0b62('0x34')]){_0x3d8435[_0x0b62('0x35')]=[];_0x3d8435['TagIds']['split'](',')['forEach'](function(_0x38453b){_0x3d8435[_0x0b62('0x35')][_0x0b62('0x36')](_0x39dbf5[_0x38453b]);});}delete _0x3d8435[_0x0b62('0x34')];}catch(_0x3d29c4){_0x2f5a69(_0x3d29c4);}_0x4958b3(_0x3d8435);});}function updateWhatsappInteraction(_0x39c480,_0x32893b,_0x335cdb){return new BPromise(function(_0x22cedb,_0x33e732){return getInteractionUsers(_0x39c480,_0x335cdb)[_0x0b62('0x2c')](function(_0x571619){return getInteractionTags(_0x571619,_0x32893b);})[_0x0b62('0x2c')](function(_0x2f3aad){_0x22cedb(_0x2f3aad);})[_0x0b62('0x37')](function(_0x4911ad){_0x33e732(_0x4911ad);});});}exports[_0x0b62('0x38')]=function(_0xb18f08,_0x5270ef){var _0xeaea0a={},_0x5cb4de={},_0x5aa3bf={'count':0x0,'rows':[]};var _0x187cd8=_['map'](db[_0x0b62('0x39')]['rawAttributes'],function(_0x3d805e){return{'name':_0x3d805e[_0x0b62('0x3a')],'type':_0x3d805e[_0x0b62('0x3b')][_0x0b62('0x3c')]};});_0x5cb4de[_0x0b62('0x3d')]=_[_0x0b62('0x32')](_0x187cd8,'name');_0x5cb4de[_0x0b62('0x3e')]=_['keys'](_0xb18f08[_0x0b62('0x3e')]);_0x5cb4de['filters']=_[_0x0b62('0x3f')](_0x5cb4de[_0x0b62('0x3d')],_0x5cb4de[_0x0b62('0x3e')]);_0xeaea0a['attributes']=_[_0x0b62('0x3f')](_0x5cb4de[_0x0b62('0x3d')],qs[_0x0b62('0x40')](_0xb18f08[_0x0b62('0x3e')][_0x0b62('0x40')]));_0xeaea0a[_0x0b62('0x41')]=_0xeaea0a[_0x0b62('0x41')]['length']?_0xeaea0a['attributes']:_0x5cb4de[_0x0b62('0x3d')];if(!_0xb18f08[_0x0b62('0x3e')][_0x0b62('0x42')](_0x0b62('0x43'))){_0xeaea0a[_0x0b62('0x23')]=qs[_0x0b62('0x23')](_0xb18f08['query'][_0x0b62('0x23')]);_0xeaea0a[_0x0b62('0x26')]=qs['offset'](_0xb18f08[_0x0b62('0x3e')][_0x0b62('0x26')]);}_0xeaea0a[_0x0b62('0x44')]=qs['sort'](_0xb18f08[_0x0b62('0x3e')][_0x0b62('0x45')]);_0xeaea0a[_0x0b62('0x46')]=qs[_0x0b62('0x47')](_[_0x0b62('0x48')](_0xb18f08['query'],_0x5cb4de[_0x0b62('0x47')]),_0x187cd8);var _0x4aeef3=[];var _0x5941c6=squel['select']()[_0x0b62('0x49')]('id')[_0x0b62('0x49')](_0x0b62('0x2f'))[_0x0b62('0x49')](_0x0b62('0x4a'))[_0x0b62('0x4b')](_0x0b62('0x4c'));var _0x4c1b4c=squel[_0x0b62('0x4d')]()[_0x0b62('0x49')](_0x0b62('0x4e'))[_0x0b62('0x49')](_0x0b62('0x4f'))[_0x0b62('0x49')]('ui.WhatsappInteractionId')[_0x0b62('0x4b')](_0x0b62('0x50'),'ui')[_0x0b62('0x51')](_0x0b62('0x52'),'u',_0x0b62('0x53'));var _0x359307=squel['select']()[_0x0b62('0x4b')](_0x0b62('0x54'),'i')[_0x0b62('0x51')](_0x0b62('0x55'),'c',_0x0b62('0x56'))[_0x0b62('0x51')](_0x0b62('0x52'),'o',_0x0b62('0x57'))[_0x0b62('0x51')]('whatsapp_accounts','a',_0x0b62('0x58'))[_0x0b62('0x51')](_0x0b62('0x59'),'me',_0x0b62('0x5a'))[_0x0b62('0x51')]('whatsapp_interaction_has_tags','it',_0x0b62('0x5b'))[_0x0b62('0x51')](_0x0b62('0x4c'),'t','t.id\x20=\x20it.TagId');var _0x49294a=squel[_0x0b62('0x5c')]();var _0x557b32=[];var _0x51d27e=squel[_0x0b62('0x5c')]();var _0x2a8a0e;if(_0xb18f08[_0x0b62('0x3e')][_0x0b62('0x5d')]){_0x2a8a0e=as[_0x0b62('0x5e')](_0xb18f08['query'][_0x0b62('0x5d')]);var _0x71933d=_0x2a8a0e['sqlOperator'];for(var _0x5411d3=0x0;_0x5411d3<_0x2a8a0e[_0x0b62('0x5f')][_0x0b62('0x60')];_0x5411d3++){var _0x65d647=_0x2a8a0e[_0x0b62('0x5f')][_0x5411d3];var _0xc31cb9='i';var _0x115927=_[_0x0b62('0x61')](_0x187cd8,[_0x0b62('0x2f'),_0x65d647[_0x0b62('0x49')]]);if(!_0x115927){switch(_0x65d647[_0x0b62('0x49')]){case _0x0b62('0x62'):if(_0x65d647[_0x0b62('0x63')]==0x1){_0x359307[_0x0b62('0x64')]('`'+_0x65d647[_0x0b62('0x49')]+_0x0b62('0x65'));}else{_0x359307['having']('`'+_0x65d647[_0x0b62('0x49')]+'`\x20>\x200');}break;case _0x0b62('0x66'):if(_0x65d647[_0x0b62('0x67')]===_0x0b62('0x68')){if(_0x65d647[_0x0b62('0x63')]['split']('\x20')[_0x0b62('0x60')]>0x1){_0x49294a[_0x71933d]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0b62('0x69')](_0x65d647[_0x0b62('0x63')]),null);}else{var _0x4c1ec8='%'+_0x65d647[_0x0b62('0x63')]+'%';_0x49294a[_0x71933d](_0x0b62('0x6a'),_0x4c1ec8,_0x4c1ec8,_0x4c1ec8);}}else{_0x115927=_[_0x0b62('0x61')](_0x187cd8,[_0x0b62('0x2f'),'ContactId']);_0x65d647['field']=_0x0b62('0x6b');_0x27be80=as['buildExpression'](_0xc31cb9,_0x115927['type'],_0x65d647);_0x49294a[_0x71933d](_0x27be80['text'],_0x27be80[_0x0b62('0x63')][_0x0b62('0x6c')],_0x27be80[_0x0b62('0x63')][_0x0b62('0x21')]);}break;case'Tag':var _0x3bc1d9=_0x65d647[_0x0b62('0x63')][_0x0b62('0x6d')](',')['map'](function(_0x35d6bf){return Number(_0x35d6bf);});_0x3bc1d9['forEach'](function(_0x3c1a2c){_0x51d27e['or'](_0x0b62('0x6e'),'%,'+_0x3c1a2c+',%');});_0x557b32=_['union'](_0x557b32,_0x3bc1d9);break;case _0x0b62('0x6f'):if(_0x65d647[_0x0b62('0x67')]===_0x0b62('0x68')){_0x49294a[_0x71933d](_0x0b62('0x70'),'%'+_0x65d647[_0x0b62('0x63')]+'%',null);}else{_0x115927=_['find'](_0x187cd8,[_0x0b62('0x2f'),_0x0b62('0x71')]);_0x65d647[_0x0b62('0x49')]=_0x0b62('0x71');_0x27be80=as[_0x0b62('0x72')](_0xc31cb9,_0x115927['type'],_0x65d647);_0x49294a[_0x71933d](_0x27be80[_0x0b62('0x73')],_0x27be80[_0x0b62('0x63')][_0x0b62('0x6c')],_0x27be80[_0x0b62('0x63')][_0x0b62('0x21')]);}break;case'body':_0x27be80=as[_0x0b62('0x72')]('me',null,_0x65d647);_0x49294a[_0x71933d](_0x27be80[_0x0b62('0x73')],_0x27be80[_0x0b62('0x63')][_0x0b62('0x6c')],_0x27be80[_0x0b62('0x63')][_0x0b62('0x21')]);break;}}else{var _0x27be80=as[_0x0b62('0x72')](_0xc31cb9,_0x115927[_0x0b62('0x3b')],_0x65d647);_0x49294a[_0x71933d](_0x27be80['text'],_0x27be80[_0x0b62('0x63')][_0x0b62('0x6c')],_0x27be80['value'][_0x0b62('0x21')]);}}}else{var _0x3de5e5=_(_0xb18f08[_0x0b62('0x3e')])['keys']()[_0x0b62('0x32')](function(_0x1d0124){return _[_0x0b62('0x74')](_0x187cd8,['name',_0x1d0124])?_0x1d0124:undefined;})[_0x0b62('0x75')]()['value']();if(!_['isEmpty'](_0x3de5e5)){_0x3de5e5[_0x0b62('0x76')](function(_0x4b97f2){if(_0x4b97f2===_0x0b62('0x77')){_0x359307[_0x0b62('0x46')]('i.WhatsappAccountId\x20IN\x20?',[][_0x0b62('0x78')](_0xb18f08[_0x0b62('0x3e')][_0x4b97f2]));}else if(_0x4b97f2==='createdAt'){var _0x5d30b0=JSON['parse'](_0xb18f08[_0x0b62('0x3e')][_0x4b97f2])[_0x0b62('0x79')];var _0x423872=JSON[_0x0b62('0x7a')](_0xb18f08[_0x0b62('0x3e')][_0x4b97f2])[_0x0b62('0x7b')];_0x359307['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5d30b0,_0x423872);}else{if(_0xb18f08[_0x0b62('0x3e')][_0x4b97f2]===_0x0b62('0x7c')){_0x359307[_0x0b62('0x46')]('i.'+_0x4b97f2+_0x0b62('0x7d'));}else{_0x359307['where']('i.'+_0x4b97f2+'\x20=\x20?',_0xb18f08[_0x0b62('0x3e')][_0x4b97f2]);}}});}if(_0xb18f08[_0x0b62('0x3e')][_0x0b62('0x7e')]){if(_0xb18f08['query'][_0x0b62('0x7e')]==0x1){_0x359307[_0x0b62('0x64')](_0x0b62('0x7f'));}else{_0x359307[_0x0b62('0x64')]('`unreadMessages`\x20>\x200');}}if(_0xb18f08['query']['tag']){_0x557b32=_['isArray'](_0xb18f08['query'][_0x0b62('0x80')])?_0xb18f08[_0x0b62('0x3e')][_0x0b62('0x80')]:new Array(_0xb18f08[_0x0b62('0x3e')][_0x0b62('0x80')]);_0x557b32[_0x0b62('0x76')](function(_0x40dde6){_0x51d27e['or'](_0x0b62('0x6e'),'%,'+_0x40dde6+',%');});}if(_0xb18f08[_0x0b62('0x3e')][_0x0b62('0x81')]){var _0x1d3dcf=_0xb18f08[_0x0b62('0x3e')][_0x0b62('0x81')][_0x0b62('0x82')]('\x5c','\x5c\x5c')[_0x0b62('0x82')](/'/g,'\x27\x27');if(qs[_0x0b62('0x83')](_0x1d3dcf)){_0x49294a['or'](_0x0b62('0x84'),_0x1d3dcf+'%')['or']('i.phone\x20LIKE\x20?',_0x1d3dcf+'%');}else{_0x49294a['or'](_0x0b62('0x85'),qs['getFullTextValue'](_0x1d3dcf))['or'](_0x0b62('0x86'),_0x1d3dcf+'%');}}}_0x359307[_0x0b62('0x46')](_0x49294a);_0x359307[_0x0b62('0x87')](_0x0b62('0x88'));var _0x18940e={'type':db[_0x0b62('0x89')][_0x0b62('0x8a')][_0x0b62('0x8b')],'raw':!![]};var _0x465ec2=_0x359307['clone']();_0x465ec2[_0x0b62('0x49')](_0x0b62('0x88'));_0x465ec2['field'](_0x0b62('0x8c'),_0x0b62('0x62'));if(_0xeaea0a['order']){_0xeaea0a[_0x0b62('0x44')][_0x0b62('0x76')](function(_0x285989){var _0x4b2d3f=_0x285989[0x0]===_0x0b62('0x8d')?_0x285989[0x0]:'i.'+_0x285989[0x0];_0x359307[_0x0b62('0x44')](_0x4b2d3f,_0x285989[0x1]===_0x0b62('0x8e')?![]:!![]);});}if(!_['isEmpty'](_0x557b32)){_0x359307[_0x0b62('0x64')](_0x51d27e);_0x465ec2[_0x0b62('0x46')](_0x0b62('0x8f'),_0x557b32);}BPromise[_0x0b62('0x90')]()[_0x0b62('0x2c')](function(){if(!_0x2a8a0e){if(_0xb18f08[_0x0b62('0x3e')]['WhatsappAccountId'])return;_0x465ec2['where'](_0x0b62('0x91'));_0x359307[_0x0b62('0x46')](_0x0b62('0x91'));return;}if(_0xb18f08[_0x0b62('0x92')]['role']!=='agent')return;return _0xb18f08[_0x0b62('0x92')][_0x0b62('0x93')]({'attributes':['id'],'raw':!![]})[_0x0b62('0x2c')](function(_0x251166){if(_[_0x0b62('0x94')](_0x251166)){_0x465ec2[_0x0b62('0x46')](_0x0b62('0x95'));_0x359307[_0x0b62('0x46')](_0x0b62('0x95'));}else{_0x465ec2['where']('i.WhatsappAccountId\x20IN\x20?',_['map'](_0x251166,'id'));_0x359307['where'](_0x0b62('0x96'),_[_0x0b62('0x32')](_0x251166,'id'));}});})['then'](function(){if(_0xb18f08[_0x0b62('0x92')][_0x0b62('0x97')]===_0x0b62('0x98')&&!_0x2a8a0e&&!_0xb18f08[_0x0b62('0x3e')][_0x0b62('0x77')])return[];return db[_0x0b62('0x99')][_0x0b62('0x3e')](_0x465ec2[_0x0b62('0x9a')](),_0x18940e);})[_0x0b62('0x2c')](function(_0x1adde8){_0x5aa3bf['count']=_0x1adde8['length'];if(_0x5aa3bf[_0x0b62('0x25')]===0x0)return[];return db[_0x0b62('0x99')]['query'](_0x5941c6[_0x0b62('0x9a')](),_0x18940e)[_0x0b62('0x2c')](function(_0x448599){_0x4aeef3=_[_0x0b62('0x9b')](_0x448599,'id');_0x18940e=_[_0x0b62('0x9c')](_0x18940e,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xb18f08['query'][_0x0b62('0x40')]){_0xeaea0a[_0x0b62('0x41')]['forEach'](function(_0x5afaad){_0x359307['field']('i.'+_0x5afaad);});}else{_0x359307[_0x0b62('0x49')](_0x0b62('0x8c'),_0x0b62('0x62'));_0x359307['field'](_0x0b62('0x9d'),_0x0b62('0x9e'));_0x359307[_0x0b62('0x49')]('a.mandatoryDisposition',_0x0b62('0x9f'));_0x359307[_0x0b62('0x49')](_0x0b62('0xa0'),_0x0b62('0x8d'));_0x359307[_0x0b62('0x49')](_0x0b62('0xa1'));_0x359307['field']('c.firstName',_0x0b62('0xa2'));_0x359307[_0x0b62('0x49')]('c.lastName',_0x0b62('0xa3'));_0x359307[_0x0b62('0x49')]('c.email','Contact.email');_0x359307[_0x0b62('0x49')](_0x0b62('0xa4'),'Contact.phone');_0x359307[_0x0b62('0x49')](_0x0b62('0xa5'),_0x0b62('0xa6'));_0x359307[_0x0b62('0x49')](_0x0b62('0xa7'),'Contact.fax');_0x359307[_0x0b62('0x49')](_0x0b62('0xa8'),'Owner.fullname');_0x359307[_0x0b62('0x49')](_0x0b62('0xa9'),_0x0b62('0xaa'));_0x359307[_0x0b62('0x49')](_0x0b62('0xab'),'TagIds');}if(_0xeaea0a[_0x0b62('0x23')])_0x359307[_0x0b62('0x23')](_0xeaea0a[_0x0b62('0x23')]);if(_0xeaea0a[_0x0b62('0x26')])_0x359307[_0x0b62('0x26')](_0xeaea0a[_0x0b62('0x26')]);return db[_0x0b62('0x99')][_0x0b62('0x3e')](_0x359307[_0x0b62('0x9a')](),_0x18940e);})['then'](function(_0x50a7ae){if(_0x50a7ae[_0x0b62('0x60')]>0x0)_0x4c1b4c[_0x0b62('0x46')](_0x0b62('0xac'),_[_0x0b62('0x32')](_0x50a7ae,'id'));return db['sequelize'][_0x0b62('0x3e')](_0x4c1b4c['toString'](),_0x18940e)[_0x0b62('0x2c')](function(_0x117d86){var _0x183f75=_[_0x0b62('0xad')](_0x117d86,_0x0b62('0xae'));var _0x2771e5=[];_0x50a7ae[_0x0b62('0x76')](function(_0x1fc995){_0x2771e5['push'](updateWhatsappInteraction(_0x1fc995,_0x4aeef3,_0x183f75));});return BPromise[_0x0b62('0xaf')](_0x2771e5);});});})[_0x0b62('0x2c')](function(_0x148922){_0x5aa3bf[_0x0b62('0xb0')]=_0x148922;return _0x5aa3bf;})[_0x0b62('0x2c')](respondWithFilteredResult(_0x5270ef,_0xeaea0a))[_0x0b62('0x37')](handleError(_0x5270ef,null));};exports[_0x0b62('0xb1')]=function(_0x21cc40,_0x142db1){var _0x2dff90={'raw':![],'where':{'id':_0x21cc40[_0x0b62('0xb2')]['id']}},_0x33b148={};_0x33b148[_0x0b62('0x3d')]=_['keys'](db['WhatsappInteraction'][_0x0b62('0xb3')]);_0x33b148[_0x0b62('0x3e')]=_[_0x0b62('0xb4')](_0x21cc40[_0x0b62('0x3e')]);_0x33b148[_0x0b62('0x47')]=_[_0x0b62('0x3f')](_0x33b148[_0x0b62('0x3d')],_0x33b148[_0x0b62('0x3e')]);_0x2dff90[_0x0b62('0x41')]=_[_0x0b62('0x3f')](_0x33b148[_0x0b62('0x3d')],qs[_0x0b62('0x40')](_0x21cc40[_0x0b62('0x3e')][_0x0b62('0x40')]));_0x2dff90[_0x0b62('0x41')]=_0x2dff90['attributes'][_0x0b62('0x60')]?_0x2dff90[_0x0b62('0x41')]:_0x33b148[_0x0b62('0x3d')];if(_0x21cc40[_0x0b62('0x3e')][_0x0b62('0xb5')]){_0x2dff90[_0x0b62('0xb6')]=[{'all':!![]}];}_0x2dff90=_['merge']({},_0x2dff90,_0x21cc40[_0x0b62('0xb7')]);return db[_0x0b62('0x39')][_0x0b62('0x61')](_0x2dff90)[_0x0b62('0x2c')](handleEntityNotFound(_0x142db1,null))[_0x0b62('0x2c')](respondWithResult(_0x142db1,null))[_0x0b62('0x37')](handleError(_0x142db1,null));};exports[_0x0b62('0xb8')]=function(_0x440a6c,_0x2c4cf2){return db[_0x0b62('0x39')][_0x0b62('0xb8')](_0x440a6c[_0x0b62('0xb9')],{})['then'](respondWithResult(_0x2c4cf2,0xc9))['catch'](handleError(_0x2c4cf2,null));};exports[_0x0b62('0x2b')]=function(_0x30ee9c,_0x4d7c5e){if(_0x30ee9c[_0x0b62('0xb9')]['id']){delete _0x30ee9c[_0x0b62('0xb9')]['id'];}return db[_0x0b62('0x39')]['find']({'where':{'id':_0x30ee9c[_0x0b62('0xb2')]['id']}})[_0x0b62('0x2c')](handleEntityNotFound(_0x4d7c5e,null))[_0x0b62('0x2c')](saveUpdates(_0x30ee9c[_0x0b62('0xb9')],null))[_0x0b62('0x2c')](respondWithResult(_0x4d7c5e,null))['catch'](handleError(_0x4d7c5e,null));};exports[_0x0b62('0xba')]=function(_0x1dc5df,_0x33a474){return db[_0x0b62('0x39')][_0x0b62('0x61')]({'where':{'id':_0x1dc5df[_0x0b62('0xb2')]['id']}})[_0x0b62('0x2c')](handleEntityNotFound(_0x33a474,null))[_0x0b62('0x2c')](removeEntity(_0x33a474,null))[_0x0b62('0x37')](handleError(_0x33a474,null));};exports[_0x0b62('0xbb')]=function(_0x4ad994,_0x3982c5){return db[_0x0b62('0x39')][_0x0b62('0xbb')]()[_0x0b62('0x2c')](respondWithResult(_0x3982c5,null))['catch'](handleError(_0x3982c5,null));};exports[_0x0b62('0xbc')]=function(_0x3d16ca,_0x55ba5a,_0x5c860b){return db[_0x0b62('0xbd')][_0x0b62('0x61')]({'where':{'id':_0x3d16ca[_0x0b62('0xb2')]['id']}})[_0x0b62('0x2c')](handleEntityNotFound(_0x55ba5a,null))['then'](function(_0x568d58){if(_0x568d58){return _0x568d58[_0x0b62('0xbc')](_0x3d16ca['body'][_0x0b62('0xbe')],_['omit'](_0x3d16ca[_0x0b62('0xb9')],[_0x0b62('0xbe'),'id'])||{});}})[_0x0b62('0x2c')](respondWithResult(_0x55ba5a,null))[_0x0b62('0x37')](handleError(_0x55ba5a,null));};exports[_0x0b62('0xbf')]=function(_0x3acbbd,_0x3f40e0,_0x7b5dfc){var _0x5857f0={'raw':![],'where':{}};var _0x52af36={};var _0x30187c={'count':0x0,'rows':[]};return db[_0x0b62('0x39')][_0x0b62('0xc0')]({'where':{'id':_0x3acbbd[_0x0b62('0xb2')]['id']}})[_0x0b62('0x2c')](handleEntityNotFound(_0x3f40e0,null))['then'](function(_0x6ff7e){if(_0x6ff7e){_0x52af36[_0x0b62('0x3d')]=_[_0x0b62('0xb4')](db[_0x0b62('0xbd')][_0x0b62('0xb3')]);_0x52af36[_0x0b62('0x3e')]=_['keys'](_0x3acbbd[_0x0b62('0x3e')]);_0x52af36[_0x0b62('0x47')]=_[_0x0b62('0x3f')](_0x52af36['model'],_0x52af36[_0x0b62('0x3e')]);_0x5857f0[_0x0b62('0x41')]=_['intersection'](_0x52af36[_0x0b62('0x3d')],qs['fields'](_0x3acbbd[_0x0b62('0x3e')][_0x0b62('0x40')]));_0x5857f0[_0x0b62('0x41')]=_0x5857f0['attributes']['length']?_0x5857f0[_0x0b62('0x41')]:_0x52af36[_0x0b62('0x3d')];if(!_0x3acbbd[_0x0b62('0x3e')][_0x0b62('0x42')]('nolimit')){_0x5857f0[_0x0b62('0x23')]=qs[_0x0b62('0x23')](_0x3acbbd[_0x0b62('0x3e')][_0x0b62('0x23')]);_0x5857f0[_0x0b62('0x26')]=qs[_0x0b62('0x26')](_0x3acbbd['query'][_0x0b62('0x26')]);}_0x5857f0[_0x0b62('0x44')]=qs[_0x0b62('0x45')](_0x3acbbd[_0x0b62('0x3e')][_0x0b62('0x45')]);_0x5857f0['where']=qs[_0x0b62('0x47')](_[_0x0b62('0x48')](_0x3acbbd[_0x0b62('0x3e')],_0x52af36[_0x0b62('0x47')]));_0x5857f0[_0x0b62('0x46')]['WhatsappInteractionId']=_0x6ff7e['id'];if(_0x3acbbd['query'][_0x0b62('0x81')]){_0x5857f0[_0x0b62('0x46')]=_[_0x0b62('0x9c')](_0x5857f0[_0x0b62('0x46')],{'$or':_[_0x0b62('0x32')](_0x5857f0[_0x0b62('0x41')],function(_0x45e0e0){var _0x2049c3={};_0x2049c3[_0x45e0e0]={'$like':'%'+_0x3acbbd[_0x0b62('0x3e')][_0x0b62('0x81')]+'%'};return _0x2049c3;})});}if(_0x3acbbd[_0x0b62('0x3e')][_0x0b62('0x79')]){var _0x3f84ab=_0x3acbbd[_0x0b62('0x3e')][_0x0b62('0x79')][_0x0b62('0x6d')](',');var _0x128b5c={};_0x128b5c[_0x3f84ab[0x0]]={'$gte':moment(_0x3f84ab[0x1])[_0x0b62('0xc1')](_0x0b62('0xc2'))};_0x5857f0[_0x0b62('0x46')]=_['merge'](_0x5857f0[_0x0b62('0x46')],_0x128b5c);}_0x5857f0=_['merge']({},_0x5857f0,_0x3acbbd[_0x0b62('0xb7')]);return db[_0x0b62('0xbd')][_0x0b62('0x25')]({'where':_0x5857f0[_0x0b62('0x46')]})[_0x0b62('0x2c')](function(_0x161224){_0x30187c['count']=_0x161224;if(_0x3acbbd[_0x0b62('0x3e')]['includeAll']){_0x5857f0[_0x0b62('0xb6')]=[{'all':!![]}];}return db[_0x0b62('0xbd')][_0x0b62('0xc3')](_0x5857f0);})[_0x0b62('0x2c')](function(_0x4edb81){_0x30187c[_0x0b62('0xb0')]=_0x4edb81;return _0x30187c;});}})[_0x0b62('0x2c')](respondWithFilteredResult(_0x3f40e0,_0x5857f0))[_0x0b62('0x37')](handleError(_0x3f40e0,null));};exports[_0x0b62('0xc4')]=function(_0x36cc21,_0x547f9e,_0x3ffc78){return db[_0x0b62('0x39')]['find']({'where':{'id':_0x36cc21['params']['id']}})[_0x0b62('0x2c')](handleEntityNotFound(_0x547f9e,null))['then'](function(_0x31e15d){if(_0x31e15d){return _0x31e15d[_0x0b62('0xc5')](_0x36cc21[_0x0b62('0xb9')]['ids'],_[_0x0b62('0xc6')](_0x36cc21[_0x0b62('0xb9')],[_0x0b62('0xbe'),'id'])||{})[_0x0b62('0xc7')](function(){return db[_0x0b62('0xc8')][_0x0b62('0xc3')]({'attributes':['id',_0x0b62('0x2f'),_0x0b62('0x4a')],'where':{'id':_0x36cc21[_0x0b62('0xb9')][_0x0b62('0xbe')]}});})[_0x0b62('0x2c')](function(_0x50e357){socket[_0x0b62('0xc9')](_0x0b62('0xca'),{'id':Number(_0x36cc21[_0x0b62('0xb2')]['id']),'tags':_0x50e357||[]});return{'id':Number(_0x36cc21[_0x0b62('0xb2')]['id']),'tags':_0x50e357||[]};});}})[_0x0b62('0x2c')](respondWithResult(_0x547f9e,null))[_0x0b62('0x37')](handleError(_0x547f9e,null));};exports[_0x0b62('0xcb')]=function(_0x2a1ddb,_0x217b4b,_0x35dcc7){return db[_0x0b62('0x39')]['find']({'where':{'id':_0x2a1ddb[_0x0b62('0xb2')]['id']}})[_0x0b62('0x2c')](handleEntityNotFound(_0x217b4b,null))[_0x0b62('0x2c')](function(_0x51d0c5){if(_0x51d0c5){return _0x51d0c5[_0x0b62('0xcb')](_0x2a1ddb[_0x0b62('0x3e')]['ids']);}})[_0x0b62('0x2c')](respondWithStatusCode(_0x217b4b,null))[_0x0b62('0x37')](handleError(_0x217b4b,null));};exports[_0x0b62('0xcc')]=function(_0x472f2e,_0xe46c57){var _0x2edee1=moment()[_0x0b62('0xcd')]()[_0x0b62('0x9a')]();var _0x240498=path[_0x0b62('0xce')](config[_0x0b62('0xcf')],_0x0b62('0xd0'),'files',_0x0b62('0xd1'));var _0x3e8487=path[_0x0b62('0xce')](config[_0x0b62('0xcf')],_0x0b62('0xd0'),'files',_0x0b62('0xd2'));var _0x2df09b=path[_0x0b62('0xce')](_0x240498,_0x2edee1);var _0x12d133=util[_0x0b62('0xc1')](_0x0b62('0xd3'),_0x472f2e[_0x0b62('0xb2')]['id'],_0x2edee1);var _0x488baf=path[_0x0b62('0xce')](_0x240498,_0x12d133);var _0x782526=[];_0x782526[_0x0b62('0x36')]({'model':db['User'],'as':_0x0b62('0x6f'),'attributes':['id',_0x0b62('0x33')],'raw':!![]});_0x782526[_0x0b62('0x36')]({'model':db[_0x0b62('0xd4')],'as':_0x0b62('0x66'),'attributes':['id','firstName',_0x0b62('0xd5')],'raw':!![]});if(_0x472f2e[_0x0b62('0x3e')][_0x0b62('0xd2')]){_0x782526['push']({'model':db[_0x0b62('0xd6')],'as':_0x0b62('0xd6'),'raw':!![]});}var _0x135b9c=[{'model':db[_0x0b62('0xbd')],'as':_0x0b62('0xd7'),'attributes':['id',_0x0b62('0xb9'),_0x0b62('0xd8'),_0x0b62('0xd9'),_0x0b62('0xda'),_0x0b62('0x7e')],'include':_0x782526}];_0x135b9c[_0x0b62('0x36')]({'model':db[_0x0b62('0xdb')],'as':'Account','attributes':['id','name']});_0x135b9c[_0x0b62('0x36')]({'model':db['User'],'as':_0x0b62('0xdc'),'attributes':['id',_0x0b62('0x33')]});return db[_0x0b62('0x39')][_0x0b62('0x61')]({'where':{'id':_0x472f2e['params']['id']},'include':_0x135b9c})['then'](handleEntityNotFound(_0xe46c57,null))['then'](function(_0x4e0563){if(_0x4e0563){var _0x25e5e7=_0x4e0563[_0x0b62('0xdd')]({'plain':!![]});fs[_0x0b62('0xde')](_0x2df09b);var _0x245b50={'channel':_0x0b62('0xdf'),'account':_0x25e5e7[_0x0b62('0xe0')][_0x0b62('0x2f')],'agent':_0x25e5e7[_0x0b62('0xdc')]?_0x25e5e7[_0x0b62('0xdc')][_0x0b62('0x33')]:_0x0b62('0xe1'),'createdAt':moment(_0x25e5e7[_0x0b62('0xd8')])[_0x0b62('0xc1')](_0x0b62('0xc2'))[_0x0b62('0x9a')](),'closedAt':_0x25e5e7[_0x0b62('0xe2')]?moment(_0x25e5e7[_0x0b62('0xe3')])[_0x0b62('0xc1')](_0x0b62('0xc2'))[_0x0b62('0x9a')]():'','disposition':_0x25e5e7[_0x0b62('0xe4')],'messages':_(_0x25e5e7[_0x0b62('0xd7')])['filter']({'secret':![]})['map'](function(_0x4e0eff){if(_0x4e0eff[_0x0b62('0xd6')]){var _0x5e274a=path[_0x0b62('0xce')](_0x3e8487,_0x4e0eff[_0x0b62('0xd6')][_0x0b62('0xe5')]);if(fs[_0x0b62('0xe6')](_0x5e274a)){fs[_0x0b62('0xe7')](_0x5e274a)['pipe'](fs[_0x0b62('0xe8')](path['join'](_0x2df09b,_0x4e0eff[_0x0b62('0xd6')][_0x0b62('0xe5')])));}}return{'date':moment(_0x4e0eff[_0x0b62('0xd8')])[_0x0b62('0xc1')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0b62('0x9a')](),'sender':_0x4e0eff['direction']===_0x0b62('0xe9')?_0x4e0eff['User']?_0x4e0eff[_0x0b62('0x6f')][_0x0b62('0x33')]:_0x0b62('0xea'):_0x4e0eff[_0x0b62('0x66')][_0x0b62('0xeb')]+(_0x4e0eff['Contact'][_0x0b62('0xd5')]?'\x20'+_0x4e0eff[_0x0b62('0x66')][_0x0b62('0xd5')]:''),'body':_0x4e0eff['Attachment']?_0x4e0eff[_0x0b62('0xd6')][_0x0b62('0xe5')]:_0x4e0eff[_0x0b62('0xb9')],'direction':_0x4e0eff[_0x0b62('0xd9')]===_0x0b62('0xe9')?'A':'C','secret':_0x4e0eff[_0x0b62('0xda')],'read':_0x4e0eff[_0x0b62('0x7e')],'attachment':_0x4e0eff[_0x0b62('0xd6')]};})[_0x0b62('0x63')]()};return ejs[_0x0b62('0xec')](path['join'](config[_0x0b62('0xcf')],_0x0b62('0xd0'),_0x0b62('0xed'),_0x0b62('0xee')),{'interaction':_0x245b50})[_0x0b62('0x2c')](function(_0x4a19fd){var _0x5844af=path[_0x0b62('0xce')](_0x2df09b,'transcript-'+_0x25e5e7['id']+'-'+_0x2edee1+_0x0b62('0xef'));var _0x26f903={'path':_0x5844af,'channel':_0x0b62('0xdf'),'interactionId':_0x25e5e7['id']};return pdf[_0x0b62('0xf0')](_0x4a19fd,_0x26f903);})[_0x0b62('0x2c')](function(){return new BPromise(function(_0x6bd4c8,_0x542cc4){zipdir(_0x2df09b,{'saveTo':_0x488baf},function(_0x29f4a4,_0xe76384){if(_0x29f4a4)return _0x542cc4(_0x29f4a4);return _0x6bd4c8(_0xe76384);});})[_0x0b62('0x2c')](function(){return new BPromise(function(_0x2ad13c,_0x5824fc){rimraf(_0x2df09b,function(_0x315bd7){if(_0x315bd7)_0x5824fc(_0x315bd7);return _0x2ad13c();});});})[_0x0b62('0x2c')](function(){return _0xe46c57[_0x0b62('0xcc')](_0x488baf,_0x12d133,function(_0x3ae808){if(_0x3ae808){console[_0x0b62('0xf1')](_0x0b62('0xf2'),_0x3ae808);}else{fs[_0x0b62('0xf3')](_0x488baf);}});});});}else{return _0xe46c57[_0x0b62('0x1f')](0xc8);}})[_0x0b62('0x37')](handleError(_0xe46c57,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 6e5e7ef..eef7dbe 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 _0x2c1b=['setMaxListeners','save','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage'];(function(_0xf4050f,_0xefc6bb){var _0x42baab=function(_0x571abb){while(--_0x571abb){_0xf4050f['push'](_0xf4050f['shift']());}};_0x42baab(++_0xefc6bb);}(_0x2c1b,0xb0));var _0xb2c1=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0x2c1b[_0x38b14f];return _0x22a324;};'use strict';var EventEmitter=require(_0xb2c1('0x0'));var WhatsappInteraction=require(_0xb2c1('0x1'))['db'][_0xb2c1('0x2')];var WhatsappMessage=require(_0xb2c1('0x1'))['db'][_0xb2c1('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xb2c1('0x4')](0x0);var events={'afterCreate':_0xb2c1('0x5'),'afterUpdate':'update','afterDestroy':_0xb2c1('0x6')};function emitEvent(_0x3ed884){return function(_0x40302d,_0x362abe,_0x42b565){_0x40302d[_0xb2c1('0x7')]({'attributes':['id'],'raw':!![]})[_0xb2c1('0x8')](function(_0x42308a){_0x40302d[_0xb2c1('0x9')](_0xb2c1('0xa'),_0x42308a['map'](function(_0x564bcb){return{'id':_0x564bcb['id']};}));return WhatsappMessage[_0xb2c1('0xb')]({'where':{'WhatsappInteractionId':_0x40302d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb2c1('0x8')](function(_0x33b6ae){_0x40302d[_0xb2c1('0x9')](_0xb2c1('0xc'),_0x33b6ae[_0xb2c1('0xd')]);WhatsappInteractionEvents[_0xb2c1('0xe')](_0x3ed884+':'+_0x40302d['id'],_0x40302d);WhatsappInteractionEvents[_0xb2c1('0xe')](_0x3ed884,_0x40302d);_0x42b565(null);})['catch'](_0x42b565(null));};}for(var e in events){if(events[_0xb2c1('0xf')](e)){var event=events[e];WhatsappInteraction[_0xb2c1('0x10')](e,emitEvent(event));}}module[_0xb2c1('0x11')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x7b37=['then','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','WhatsappMessage','save','remove','getUsers','setDataValue','map'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x7b37,0xd9));var _0x77b3=function(_0x217cd1,_0x10c0a5){_0x217cd1=_0x217cd1-0x0;var _0x515315=_0x7b37[_0x217cd1];return _0x515315;};'use strict';var EventEmitter=require(_0x77b3('0x0'));var WhatsappInteraction=require(_0x77b3('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x77b3('0x1'))['db'][_0x77b3('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x77b3('0x3'),'afterUpdate':'update','afterDestroy':_0x77b3('0x4')};function emitEvent(_0x2c94ea){return function(_0x2d64f7,_0x579ea7,_0x3acdea){_0x2d64f7[_0x77b3('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x49aded){_0x2d64f7[_0x77b3('0x6')]('Users',_0x49aded[_0x77b3('0x7')](function(_0x37fafb){return{'id':_0x37fafb['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x2d64f7['id'],'direction':'in','read':![]},'raw':!![]});})[_0x77b3('0x8')](function(_0x31b2ac){_0x2d64f7[_0x77b3('0x6')](_0x77b3('0x9'),_0x31b2ac[_0x77b3('0xa')]);WhatsappInteractionEvents[_0x77b3('0xb')](_0x2c94ea+':'+_0x2d64f7['id'],_0x2d64f7);WhatsappInteractionEvents[_0x77b3('0xb')](_0x2c94ea,_0x2d64f7);_0x3acdea(null);})[_0x77b3('0xc')](_0x3acdea(null));};}for(var e in events){if(events[_0x77b3('0xd')](e)){var event=events[e];WhatsappInteraction[_0x77b3('0xe')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 3538ad7..ef92e80 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 _0x207d=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment','bluebird','request-promise','rimraf','./whatsappInteraction.attributes','define','whatsapp_interactions','changed'];(function(_0x298527,_0x542f83){var _0x3264f3=function(_0x4d05c7){while(--_0x4d05c7){_0x298527['push'](_0x298527['shift']());}};_0x3264f3(++_0x542f83);}(_0x207d,0x189));var _0xd207=function(_0x47ee28,_0x254880){_0x47ee28=_0x47ee28-0x0;var _0xd7f35a=_0x207d[_0x47ee28];return _0xd7f35a;};'use strict';var _=require(_0xd207('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd207('0x1'));var moment=require(_0xd207('0x2'));var BPromise=require(_0xd207('0x3'));var rp=require(_0xd207('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd207('0x5'));var config=require('../../config/environment');var attributes=require(_0xd207('0x6'));module['exports']=function(_0x1bef25,_0x2ecf02){return _0x1bef25[_0xd207('0x7')]('WhatsappInteraction',attributes,{'tableName':_0xd207('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x7fd277,_0x4de2aa,_0x397b47){if(_0x7fd277[_0xd207('0x9')]('closed')){_0x7fd277[_0xd207('0xa')]=moment()[_0xd207('0xb')](_0xd207('0xc'));}_0x397b47(null,_0x7fd277);}}});}; \ No newline at end of file +var _0x5add=['changed','closedAt','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','WhatsappInteraction','whatsapp_interactions'];(function(_0x6b8c35,_0x41ef37){var _0x1a6675=function(_0x2f175a){while(--_0x2f175a){_0x6b8c35['push'](_0x6b8c35['shift']());}};_0x1a6675(++_0x41ef37);}(_0x5add,0x11a));var _0xd5ad=function(_0x3506aa,_0x355d9f){_0x3506aa=_0x3506aa-0x0;var _0x1284b0=_0x5add[_0x3506aa];return _0x1284b0;};'use strict';var _=require(_0xd5ad('0x0'));var util=require('util');var logger=require(_0xd5ad('0x1'))(_0xd5ad('0x2'));var moment=require(_0xd5ad('0x3'));var BPromise=require(_0xd5ad('0x4'));var rp=require(_0xd5ad('0x5'));var fs=require('fs');var path=require(_0xd5ad('0x6'));var rimraf=require(_0xd5ad('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module[_0xd5ad('0x8')]=function(_0x2ec8f7,_0x228078){return _0x2ec8f7[_0xd5ad('0x9')](_0xd5ad('0xa'),attributes,{'tableName':_0xd5ad('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x217034,_0x4792ac,_0x2a4ec1){if(_0x217034[_0xd5ad('0xc')]('closed')){_0x217034[_0xd5ad('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x2a4ec1(null,_0x217034);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index a44a967..27c710e 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 _0x6b4f=['util','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','WhatsappInteraction,\x20%s,\x20%s','result','catch','UpdateWhatsappInteraction','update','body','options','raw','where','attributes','limit','info','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','ids','omit','spread','AddTags','lodash'];(function(_0x42d4f6,_0x41e486){var _0x5d6eba=function(_0xc81a5d){while(--_0xc81a5d){_0x42d4f6['push'](_0x42d4f6['shift']());}};_0x5d6eba(++_0x41e486);}(_0x6b4f,0x1a3));var _0xf6b4=function(_0x15403e,_0x28c418){_0x15403e=_0x15403e-0x0;var _0x294216=_0x6b4f[_0x15403e];return _0x294216;};'use strict';var _=require(_0xf6b4('0x0'));var util=require(_0xf6b4('0x1'));var moment=require(_0xf6b4('0x2'));var BPromise=require(_0xf6b4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf6b4('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf6b4('0x5'));var config=require(_0xf6b4('0x6'));var jayson=require(_0xf6b4('0x7'));var client=jayson['client'][_0xf6b4('0x8')]({'port':0x232a});config[_0xf6b4('0x9')]=_[_0xf6b4('0xa')](config['redis'],{'host':_0xf6b4('0xb'),'port':0x18eb});var socket=require(_0xf6b4('0xc'))(new Redis(config[_0xf6b4('0x9')]));require('./whatsappInteraction.socket')[_0xf6b4('0xd')](socket);function respondWithRpcPromise(_0x28185f,_0x56b22f,_0x3eabda){return new BPromise(function(_0x762706,_0x2609b7){return client[_0xf6b4('0xe')](_0x28185f,_0x3eabda)[_0xf6b4('0xf')](function(_0x5f25ca){logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x56b22f,_0xf6b4('0x10'));logger[_0xf6b4('0x11')](_0xf6b4('0x12'),_0x56b22f,_0xf6b4('0x10'),JSON[_0xf6b4('0x13')](_0x5f25ca));if(_0x5f25ca[_0xf6b4('0x14')]){if(_0x5f25ca[_0xf6b4('0x14')]['code']===0x1f4){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x56b22f,_0x5f25ca['error'][_0xf6b4('0x15')]);return _0x2609b7(_0x5f25ca[_0xf6b4('0x14')][_0xf6b4('0x15')]);}logger['error'](_0xf6b4('0x16'),_0x56b22f,_0x5f25ca['error'][_0xf6b4('0x15')]);return _0x762706(_0x5f25ca[_0xf6b4('0x14')]['message']);}else{logger['info'](_0xf6b4('0x16'),_0x56b22f,'request\x20sent');_0x762706(_0x5f25ca[_0xf6b4('0x17')][_0xf6b4('0x15')]);}})[_0xf6b4('0x18')](function(_0x45ba33){logger['error'](_0xf6b4('0x16'),_0x56b22f,_0x45ba33);_0x2609b7(_0x45ba33);});});}exports[_0xf6b4('0x19')]=function(_0x4f05a1){var _0xdce0c0=this;return new Promise(function(_0x59560b,_0x52a590){return db['WhatsappInteraction'][_0xf6b4('0x1a')](_0x4f05a1[_0xf6b4('0x1b')],{'raw':_0x4f05a1[_0xf6b4('0x1c')]?_0x4f05a1[_0xf6b4('0x1c')][_0xf6b4('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f05a1[_0xf6b4('0x1c')]?_0x4f05a1[_0xf6b4('0x1c')][_0xf6b4('0x1e')]||null:null,'attributes':_0x4f05a1['options']?_0x4f05a1['options'][_0xf6b4('0x1f')]||null:null,'limit':_0x4f05a1[_0xf6b4('0x1c')]?_0x4f05a1[_0xf6b4('0x1c')][_0xf6b4('0x20')]||null:null})['then'](function(_0x598e57){logger[_0xf6b4('0x21')]('UpdateWhatsappInteraction',_0x4f05a1);logger[_0xf6b4('0x11')](_0xf6b4('0x19'),_0x4f05a1,JSON[_0xf6b4('0x13')](_0x598e57));_0x59560b(_0x598e57);})['catch'](function(_0x4f03c4){logger[_0xf6b4('0x14')]('UpdateWhatsappInteraction',_0x4f03c4[_0xf6b4('0x15')],_0x4f05a1);_0x52a590(_0xdce0c0[_0xf6b4('0x14')](0x1f4,_0x4f03c4[_0xf6b4('0x15')]));});});};exports[_0xf6b4('0x22')]=function(_0x5ecb5e){return new Promise(function(_0x8bc06e,_0x277226){return db[_0xf6b4('0x23')][_0xf6b4('0x24')]({'where':_0x5ecb5e[_0xf6b4('0x1c')]?_0x5ecb5e[_0xf6b4('0x1c')][_0xf6b4('0x1e')]||null:null})['then'](function(_0x24925c){if(_0x24925c){return _0x24925c[_0xf6b4('0x25')](_0x5ecb5e[_0xf6b4('0x1b')][_0xf6b4('0x26')],_[_0xf6b4('0x27')](_0x5ecb5e[_0xf6b4('0x1b')],[_0xf6b4('0x26'),'id'])||{});}})[_0xf6b4('0x28')](function(_0x47889b){logger['info'](_0xf6b4('0x29'),_0x5ecb5e);logger['debug'](_0xf6b4('0x29'),_0x5ecb5e,JSON[_0xf6b4('0x13')](_0x47889b));_0x8bc06e(_0x47889b);})['catch'](function(_0x9e5289){logger[_0xf6b4('0x14')](_0xf6b4('0x29'),_0x9e5289[_0xf6b4('0x15')],_0x5ecb5e);_0x277226(_this[_0xf6b4('0x14')](0x1f4,_0x9e5289[_0xf6b4('0x15')]));});});}; \ No newline at end of file +var _0x3cd1=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','then','AddTagsToWhatsappInteraction','find','addTags','spread','AddTags','lodash'];(function(_0x43d753,_0x3f297d){var _0x1958e9=function(_0xb48c3b){while(--_0xb48c3b){_0x43d753['push'](_0x43d753['shift']());}};_0x1958e9(++_0x3f297d);}(_0x3cd1,0x194));var _0x13cd=function(_0x269254,_0x1271e8){_0x269254=_0x269254-0x0;var _0x357608=_0x3cd1[_0x269254];return _0x357608;};'use strict';var _=require(_0x13cd('0x0'));var util=require(_0x13cd('0x1'));var moment=require(_0x13cd('0x2'));var BPromise=require(_0x13cd('0x3'));var rs=require(_0x13cd('0x4'));var fs=require('fs');var Redis=require(_0x13cd('0x5'));var db=require(_0x13cd('0x6'))['db'];var utils=require(_0x13cd('0x7'));var logger=require(_0x13cd('0x8'))(_0x13cd('0x9'));var config=require(_0x13cd('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x13cd('0xb')][_0x13cd('0xc')]({'port':0x232a});config['redis']=_[_0x13cd('0xd')](config[_0x13cd('0xe')],{'host':_0x13cd('0xf'),'port':0x18eb});var socket=require(_0x13cd('0x10'))(new Redis(config[_0x13cd('0xe')]));require(_0x13cd('0x11'))['register'](socket);function respondWithRpcPromise(_0x57a13f,_0x5ddcec,_0x3a34e6){return new BPromise(function(_0x27b700,_0x4f0d86){return client[_0x13cd('0x12')](_0x57a13f,_0x3a34e6)['then'](function(_0x59c462){logger[_0x13cd('0x13')](_0x13cd('0x14'),_0x5ddcec,_0x13cd('0x15'));logger[_0x13cd('0x16')](_0x13cd('0x17'),_0x5ddcec,_0x13cd('0x15'),JSON[_0x13cd('0x18')](_0x59c462));if(_0x59c462[_0x13cd('0x19')]){if(_0x59c462[_0x13cd('0x19')][_0x13cd('0x1a')]===0x1f4){logger[_0x13cd('0x19')](_0x13cd('0x14'),_0x5ddcec,_0x59c462[_0x13cd('0x19')]['message']);return _0x4f0d86(_0x59c462[_0x13cd('0x19')][_0x13cd('0x1b')]);}logger[_0x13cd('0x19')]('WhatsappInteraction,\x20%s,\x20%s',_0x5ddcec,_0x59c462[_0x13cd('0x19')][_0x13cd('0x1b')]);return _0x27b700(_0x59c462['error'][_0x13cd('0x1b')]);}else{logger[_0x13cd('0x13')](_0x13cd('0x14'),_0x5ddcec,_0x13cd('0x15'));_0x27b700(_0x59c462[_0x13cd('0x1c')][_0x13cd('0x1b')]);}})[_0x13cd('0x1d')](function(_0x49ba31){logger[_0x13cd('0x19')](_0x13cd('0x14'),_0x5ddcec,_0x49ba31);_0x4f0d86(_0x49ba31);});});}exports[_0x13cd('0x1e')]=function(_0x15ec7d){var _0x5549fa=this;return new Promise(function(_0x2cd502,_0x35d839){return db[_0x13cd('0x1f')][_0x13cd('0x20')](_0x15ec7d[_0x13cd('0x21')],{'raw':_0x15ec7d[_0x13cd('0x22')]?_0x15ec7d['options'][_0x13cd('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15ec7d[_0x13cd('0x22')]?_0x15ec7d[_0x13cd('0x22')][_0x13cd('0x24')]||null:null,'attributes':_0x15ec7d[_0x13cd('0x22')]?_0x15ec7d[_0x13cd('0x22')][_0x13cd('0x25')]||null:null,'limit':_0x15ec7d[_0x13cd('0x22')]?_0x15ec7d[_0x13cd('0x22')][_0x13cd('0x26')]||null:null})[_0x13cd('0x27')](function(_0x2adfe0){logger[_0x13cd('0x13')](_0x13cd('0x1e'),_0x15ec7d);logger[_0x13cd('0x16')](_0x13cd('0x1e'),_0x15ec7d,JSON[_0x13cd('0x18')](_0x2adfe0));_0x2cd502(_0x2adfe0);})[_0x13cd('0x1d')](function(_0x38c03f){logger[_0x13cd('0x19')](_0x13cd('0x1e'),_0x38c03f['message'],_0x15ec7d);_0x35d839(_0x5549fa[_0x13cd('0x19')](0x1f4,_0x38c03f[_0x13cd('0x1b')]));});});};exports[_0x13cd('0x28')]=function(_0x30f0b8){return new Promise(function(_0x479e41,_0x4ee3e2){return db[_0x13cd('0x1f')][_0x13cd('0x29')]({'where':_0x30f0b8['options']?_0x30f0b8[_0x13cd('0x22')][_0x13cd('0x24')]||null:null})['then'](function(_0xb0d65b){if(_0xb0d65b){return _0xb0d65b[_0x13cd('0x2a')](_0x30f0b8[_0x13cd('0x21')]['ids'],_['omit'](_0x30f0b8[_0x13cd('0x21')],['ids','id'])||{});}})[_0x13cd('0x2b')](function(_0x479126){logger[_0x13cd('0x13')](_0x13cd('0x2c'),_0x30f0b8);logger[_0x13cd('0x16')](_0x13cd('0x2c'),_0x30f0b8,JSON[_0x13cd('0x18')](_0x479126));_0x479e41(_0x479126);})[_0x13cd('0x1d')](function(_0x18b0c2){logger[_0x13cd('0x19')](_0x13cd('0x2c'),_0x18b0c2[_0x13cd('0x1b')],_0x30f0b8);_0x4ee3e2(_this[_0x13cd('0x19')](0x1f4,_0x18b0c2['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 6507209..1dc8392 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 _0x3b80=['./whatsappInteraction.events','save','remove','update','removeListener','register','whatsappInteraction:'];(function(_0x3905c9,_0x41d8b7){var _0x5ab26d=function(_0x114860){while(--_0x114860){_0x3905c9['push'](_0x3905c9['shift']());}};_0x5ab26d(++_0x41d8b7);}(_0x3b80,0x85));var _0x03b8=function(_0x1abafe,_0x572047){_0x1abafe=_0x1abafe-0x0;var _0x4fae5a=_0x3b80[_0x1abafe];return _0x4fae5a;};'use strict';var WhatsappInteractionEvents=require(_0x03b8('0x0'));var events=[_0x03b8('0x1'),_0x03b8('0x2'),_0x03b8('0x3')];function createListener(_0x31492c,_0x41e074){return function(_0x61111b){_0x41e074['emit'](_0x31492c,_0x61111b);};}function removeListener(_0x3ac7b6,_0x401bba){return function(){WhatsappInteractionEvents[_0x03b8('0x4')](_0x3ac7b6,_0x401bba);};}exports[_0x03b8('0x5')]=function(_0x44d971){for(var _0x56cbc5=0x0,_0x1773a7=events['length'];_0x56cbc5<_0x1773a7;_0x56cbc5++){var _0x4ac512=events[_0x56cbc5];var _0x4148b0=createListener(_0x03b8('0x6')+_0x4ac512,_0x44d971);WhatsappInteractionEvents['on'](_0x4ac512,_0x4148b0);}}; \ No newline at end of file +var _0x9fd9=['remove','emit','register','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x9fd9,0x144));var _0x99fd=function(_0x5001f5,_0x298fb){_0x5001f5=_0x5001f5-0x0;var _0x30017f=_0x9fd9[_0x5001f5];return _0x30017f;};'use strict';var WhatsappInteractionEvents=require(_0x99fd('0x0'));var events=['save',_0x99fd('0x1'),'update'];function createListener(_0x1deb04,_0x29dec5){return function(_0x31262f){_0x29dec5[_0x99fd('0x2')](_0x1deb04,_0x31262f);};}function removeListener(_0x1fb652,_0x23a20c){return function(){WhatsappInteractionEvents['removeListener'](_0x1fb652,_0x23a20c);};}exports[_0x99fd('0x3')]=function(_0x30e0c7){for(var _0x566730=0x0,_0x28c49a=events['length'];_0x566730<_0x28c49a;_0x566730++){var _0x4c618b=events[_0x566730];var _0x503e9d=createListener(_0x99fd('0x4')+_0x4c618b,_0x30e0c7);WhatsappInteractionEvents['on'](_0x4c618b,_0x503e9d);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 619c50c..0b12568 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 _0x760c=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','/describe','isAuthenticated','describe','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','/:id','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','path'];(function(_0x34596a,_0x4f5372){var _0x1695ec=function(_0x5d0080){while(--_0x5d0080){_0x34596a['push'](_0x34596a['shift']());}};_0x1695ec(++_0x4f5372);}(_0x760c,0xc2));var _0xc760=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x760c[_0x4e676e];return _0x336a3c;};'use strict';var multer=require(_0xc760('0x0'));var util=require('util');var path=require(_0xc760('0x1'));var timeout=require(_0xc760('0x2'));var express=require(_0xc760('0x3'));var router=express[_0xc760('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc760('0x5'));var interaction=require(_0xc760('0x6'));var config=require(_0xc760('0x7'));var controller=require(_0xc760('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc760('0x9')](_0xc760('0xa'),auth[_0xc760('0xb')](),controller[_0xc760('0xc')]);router[_0xc760('0x9')]('/:id',auth[_0xc760('0xb')](),controller['show']);router[_0xc760('0xd')]('/',auth[_0xc760('0xb')](),interaction[_0xc760('0xe')](_0xc760('0xf'),_0xc760('0x10')),controller[_0xc760('0x11')]);router[_0xc760('0xd')](_0xc760('0x12'),controller[_0xc760('0x13')]);router[_0xc760('0x14')](_0xc760('0x15'),auth['isAuthenticated'](),controller['update']);router['put'](_0xc760('0x16'),auth[_0xc760('0xb')](),controller[_0xc760('0x17')]);router[_0xc760('0x14')](_0xc760('0x18'),auth[_0xc760('0xb')](),controller[_0xc760('0x19')]);router[_0xc760('0x1a')](_0xc760('0x15'),auth[_0xc760('0xb')](),controller['destroy']);module[_0xc760('0x1b')]=router; \ No newline at end of file +var _0x14e1=['delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','/:id/status','status','put','/:id/accept','accept','reject'];(function(_0x1f0327,_0x255c0c){var _0x300d81=function(_0x591155){while(--_0x591155){_0x1f0327['push'](_0x1f0327['shift']());}};_0x300d81(++_0x255c0c);}(_0x14e1,0x8a));var _0x114e=function(_0x22daf2,_0x457c32){_0x22daf2=_0x22daf2-0x0;var _0x4f0d02=_0x14e1[_0x22daf2];return _0x4f0d02;};'use strict';var multer=require(_0x114e('0x0'));var util=require(_0x114e('0x1'));var path=require(_0x114e('0x2'));var timeout=require('connect-timeout');var express=require(_0x114e('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x114e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x114e('0x5'));var controller=require(_0x114e('0x6'));router[_0x114e('0x7')]('/',auth[_0x114e('0x8')](),controller[_0x114e('0x9')]);router[_0x114e('0x7')](_0x114e('0xa'),auth[_0x114e('0x8')](),controller[_0x114e('0xb')]);router['get'](_0x114e('0xc'),auth[_0x114e('0x8')](),controller[_0x114e('0xd')]);router[_0x114e('0xe')]('/',auth[_0x114e('0x8')](),interaction[_0x114e('0xf')](_0x114e('0x10'),_0x114e('0x11')),controller['create']);router[_0x114e('0xe')](_0x114e('0x12'),controller[_0x114e('0x13')]);router[_0x114e('0x14')](_0x114e('0xc'),auth[_0x114e('0x8')](),controller['update']);router[_0x114e('0x14')](_0x114e('0x15'),auth['isAuthenticated'](),controller[_0x114e('0x16')]);router['put']('/:id/reject',auth[_0x114e('0x8')](),controller[_0x114e('0x17')]);router[_0x114e('0x18')](_0x114e('0xc'),auth[_0x114e('0x8')](),controller[_0x114e('0x19')]);module[_0x114e('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 2f3b518..0185aca 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 _0xfef5=['BOOLEAN','ENUM','out','STRING','DATE','sequelize','TEXT','medium'];(function(_0x4f1027,_0x37369b){var _0x3821de=function(_0x53ab3c){while(--_0x53ab3c){_0x4f1027['push'](_0x4f1027['shift']());}};_0x3821de(++_0x37369b);}(_0xfef5,0x6d));var _0x5fef=function(_0x3e90ef,_0x63e9ab){_0x3e90ef=_0x3e90ef-0x0;var _0x5a9ce7=_0xfef5[_0x3e90ef];return _0x5a9ce7;};'use strict';var Sequelize=require(_0x5fef('0x0'));module['exports']={'body':{'type':Sequelize[_0x5fef('0x1')](_0x5fef('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x5fef('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5fef('0x4')]('in','out'),'defaultValue':_0x5fef('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x5fef('0x6')](0xbe)},'phone':{'type':Sequelize[_0x5fef('0x6')]},'readAt':{'type':Sequelize[_0x5fef('0x7')]},'secret':{'type':Sequelize[_0x5fef('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x5fef('0x6')]},'providerResponse':{'type':Sequelize[_0x5fef('0x1')]}}; \ No newline at end of file +var _0xf958=['medium','BOOLEAN','ENUM','out','STRING','DATE','TEXT'];(function(_0x4f4d36,_0x3b0484){var _0xf88ebc=function(_0x221140){while(--_0x221140){_0x4f4d36['push'](_0x4f4d36['shift']());}};_0xf88ebc(++_0x3b0484);}(_0xf958,0x1c0));var _0x8f95=function(_0x4079fa,_0x148b3c){_0x4079fa=_0x4079fa-0x0;var _0x4263d0=_0xf958[_0x4079fa];return _0x4263d0;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0x8f95('0x0')),'allowNull':![]},'read':{'type':Sequelize[_0x8f95('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8f95('0x2')]('in',_0x8f95('0x3')),'defaultValue':_0x8f95('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x8f95('0x4')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x8f95('0x5')]},'secret':{'type':Sequelize[_0x8f95('0x1')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x8f95('0x4')]},'providerResponse':{'type':Sequelize[_0x8f95('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 0b12c4b..1b91c20 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 _0x1197=['describe','../../config/logger','whatsapp-interactions','accept','whatsapp','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','AcceptMessage','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','contact','event','reject','rejectmessage','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','end','stack','name','send','index','map','WhatsappMessage','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','show','keys','find','create','body','params'];(function(_0x421eeb,_0x3d3e3e){var _0x2c7371=function(_0x174b74){while(--_0x174b74){_0x421eeb['push'](_0x421eeb['shift']());}};_0x2c7371(++_0x3d3e3e);}(_0x1197,0x14a));var _0x7119=function(_0x32a093,_0x4d4fbe){_0x32a093=_0x32a093-0x0;var _0xb8005f=_0x1197[_0x32a093];return _0xb8005f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7119('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7119('0x1'));var rp=require(_0x7119('0x2'));var moment=require(_0x7119('0x3'));var BPromise=require(_0x7119('0x4'));var Mustache=require(_0x7119('0x5'));var util=require(_0x7119('0x6'));var path=require(_0x7119('0x7'));var sox=require(_0x7119('0x8'));var csv=require(_0x7119('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7119('0xa'));var squel=require('squel');var crypto=require(_0x7119('0xb'));var jsforce=require(_0x7119('0xc'));var deskjs=require(_0x7119('0xd'));var toCsv=require(_0x7119('0x9'));var querystring=require('querystring');var Papa=require(_0x7119('0xe'));var Redis=require(_0x7119('0xf'));var authService=require(_0x7119('0x10'));var qs=require(_0x7119('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7119('0x12'));var logger=require('../../config/logger')(_0x7119('0x13'));var utils=require(_0x7119('0x14'));var config=require(_0x7119('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7119('0x16'))['db'];config['redis']=_['defaults'](config[_0x7119('0x17')],{'host':_0x7119('0x18'),'port':0x18eb});var socket=require(_0x7119('0x19'))(new Redis(config[_0x7119('0x17')]));require(_0x7119('0x1a'))[_0x7119('0x1b')](socket);var jayson=require(_0x7119('0x1c'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x7119('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22e9c6,_0x1f0080,_0x40cb55,_0x5099b6){return new BPromise(function(_0x5d1e4d,_0xa1b628){var _0x1173ef=_0x5099b6||client;return _0x1173ef[_0x7119('0x1e')](_0x22e9c6,_0x40cb55)[_0x7119('0x1f')](function(_0x5b0a01){logger[_0x7119('0x20')](_0x7119('0x21'),_0x1f0080,_0x7119('0x22'));logger[_0x7119('0x23')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x1f0080,_0x7119('0x22'),JSON['stringify'](_0x5b0a01));if(_0x5b0a01[_0x7119('0x24')]){if(_0x5b0a01[_0x7119('0x24')][_0x7119('0x25')]===0x1f4){logger['error'](_0x7119('0x21'),_0x1f0080,_0x5b0a01[_0x7119('0x24')][_0x7119('0x26')]);return _0xa1b628(_0x5b0a01[_0x7119('0x24')][_0x7119('0x26')]);}logger[_0x7119('0x24')](_0x7119('0x21'),_0x1f0080,_0x5b0a01[_0x7119('0x24')][_0x7119('0x26')]);return _0x5d1e4d(_0x5b0a01[_0x7119('0x24')][_0x7119('0x26')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x1f0080,_0x7119('0x22'));_0x5d1e4d(_0x5b0a01['result']['message']);}})[_0x7119('0x27')](function(_0x2c987c){logger[_0x7119('0x24')](_0x7119('0x21'),_0x1f0080,_0x2c987c);_0xa1b628(_0x2c987c);});});}function respondWithStatusCode(_0x223556,_0xd0edf0){_0xd0edf0=_0xd0edf0||0xcc;return function(_0x15614e){if(_0x15614e){return _0x223556[_0x7119('0x28')](_0xd0edf0);}return _0x223556['status'](_0xd0edf0)['end']();};}function respondWithResult(_0x59ff76,_0x496892){_0x496892=_0x496892||0xc8;return function(_0x5ad3c5){if(_0x5ad3c5){return _0x59ff76[_0x7119('0x29')](_0x496892)[_0x7119('0x2a')](_0x5ad3c5);}};}function respondWithFilteredResult(_0x40eefd,_0x53c7a5){return function(_0x4334ad){if(_0x4334ad){var _0x1d5517=typeof _0x53c7a5[_0x7119('0x2b')]===_0x7119('0x2c')&&typeof _0x53c7a5[_0x7119('0x2d')]===_0x7119('0x2c');var _0x55ec4c=_0x4334ad[_0x7119('0x2e')];var _0x513562=_0x1d5517?0x0:_0x53c7a5['offset'];var _0x545463=_0x1d5517?_0x4334ad[_0x7119('0x2e')]:_0x53c7a5['offset']+_0x53c7a5[_0x7119('0x2d')];var _0xb43893;if(_0x545463>=_0x55ec4c){_0x545463=_0x55ec4c;_0xb43893=0xc8;}else{_0xb43893=0xce;}_0x40eefd['status'](_0xb43893);return _0x40eefd[_0x7119('0x2f')](_0x7119('0x30'),_0x513562+'-'+_0x545463+'/'+_0x55ec4c)[_0x7119('0x2a')](_0x4334ad);}return null;};}function patchUpdates(_0x270332){return function(_0x35cb55){try{jsonpatch['apply'](_0x35cb55,_0x270332,!![]);}catch(_0x2a2536){return BPromise['reject'](_0x2a2536);}return _0x35cb55[_0x7119('0x31')]();};}function saveUpdates(_0x181b86,_0x1e8eec){return function(_0x2d32ac){if(_0x2d32ac){return _0x2d32ac[_0x7119('0x32')](_0x181b86)['then'](function(_0x12e618){return _0x12e618;});}return null;};}function removeEntity(_0x506119,_0xc0f82b){return function(_0x1b208f){if(_0x1b208f){return _0x1b208f[_0x7119('0x33')]()['then'](function(){_0x506119[_0x7119('0x29')](0xcc)[_0x7119('0x34')]();});}};}function handleEntityNotFound(_0x5b2ae6,_0x347c15){return function(_0x3d426e){if(!_0x3d426e){_0x5b2ae6[_0x7119('0x28')](0x194);}return _0x3d426e;};}function handleError(_0x1fad52,_0x11fa61){_0x11fa61=_0x11fa61||0x1f4;return function(_0x602121){logger['error'](_0x602121[_0x7119('0x35')]);if(_0x602121[_0x7119('0x36')]){delete _0x602121[_0x7119('0x36')];}_0x1fad52[_0x7119('0x29')](_0x11fa61)[_0x7119('0x37')](_0x602121);};}exports[_0x7119('0x38')]=function(_0x51e526,_0x9fd1c){var _0x1c8138={},_0x3c8bb1={},_0xd0d51a={'count':0x0,'rows':[]};var _0x14e9a5=_[_0x7119('0x39')](db[_0x7119('0x3a')][_0x7119('0x3b')],function(_0x441923){return{'name':_0x441923['fieldName'],'type':_0x441923[_0x7119('0x3c')][_0x7119('0x3d')]};});_0x3c8bb1[_0x7119('0x3e')]=_[_0x7119('0x39')](_0x14e9a5,_0x7119('0x36'));_0x3c8bb1[_0x7119('0x3f')]=_['keys'](_0x51e526['query']);_0x3c8bb1['filters']=_[_0x7119('0x40')](_0x3c8bb1['model'],_0x3c8bb1[_0x7119('0x3f')]);_0x1c8138[_0x7119('0x41')]=_[_0x7119('0x40')](_0x3c8bb1['model'],qs['fields'](_0x51e526[_0x7119('0x3f')][_0x7119('0x42')]));_0x1c8138['attributes']=_0x1c8138['attributes'][_0x7119('0x43')]?_0x1c8138[_0x7119('0x41')]:_0x3c8bb1['model'];if(!_0x51e526['query'][_0x7119('0x44')](_0x7119('0x45'))){_0x1c8138[_0x7119('0x2d')]=qs[_0x7119('0x2d')](_0x51e526[_0x7119('0x3f')][_0x7119('0x2d')]);_0x1c8138[_0x7119('0x2b')]=qs[_0x7119('0x2b')](_0x51e526[_0x7119('0x3f')][_0x7119('0x2b')]);}_0x1c8138[_0x7119('0x46')]=qs[_0x7119('0x47')](_0x51e526[_0x7119('0x3f')][_0x7119('0x47')]);_0x1c8138['where']=qs[_0x7119('0x48')](_[_0x7119('0x49')](_0x51e526[_0x7119('0x3f')],_0x3c8bb1['filters']),_0x14e9a5);if(_0x51e526[_0x7119('0x3f')][_0x7119('0x4a')]){_0x1c8138[_0x7119('0x4b')]=_[_0x7119('0x4c')](_0x1c8138['where'],{'$or':_[_0x7119('0x39')](_0x14e9a5,function(_0x2cfe3a){if(_0x2cfe3a[_0x7119('0x3c')]!==_0x7119('0x4d')){var _0x29e402={};_0x29e402[_0x2cfe3a['name']]={'$like':'%'+_0x51e526[_0x7119('0x3f')][_0x7119('0x4a')]+'%'};return _0x29e402;}})});}_0x1c8138=_[_0x7119('0x4c')]({},_0x1c8138,_0x51e526[_0x7119('0x4e')]);var _0xb85bd1={'where':_0x1c8138[_0x7119('0x4b')]};return db['WhatsappMessage']['count'](_0xb85bd1)[_0x7119('0x1f')](function(_0x348c73){_0xd0d51a[_0x7119('0x2e')]=_0x348c73;if(_0x51e526[_0x7119('0x3f')][_0x7119('0x4f')]){_0x1c8138['include']=[{'all':!![]}];}return db[_0x7119('0x3a')][_0x7119('0x50')](_0x1c8138);})[_0x7119('0x1f')](function(_0x41fa9e){_0xd0d51a['rows']=_0x41fa9e;return _0xd0d51a;})[_0x7119('0x1f')](respondWithFilteredResult(_0x9fd1c,_0x1c8138))[_0x7119('0x27')](handleError(_0x9fd1c,null));};exports[_0x7119('0x51')]=function(_0x92ff75,_0xb011f3){var _0x45f9ea={'raw':!![],'where':{'id':_0x92ff75['params']['id']}},_0x25cb74={};_0x25cb74['model']=_[_0x7119('0x52')](db[_0x7119('0x3a')][_0x7119('0x3b')]);_0x25cb74['query']=_[_0x7119('0x52')](_0x92ff75[_0x7119('0x3f')]);_0x25cb74[_0x7119('0x48')]=_[_0x7119('0x40')](_0x25cb74[_0x7119('0x3e')],_0x25cb74[_0x7119('0x3f')]);_0x45f9ea['attributes']=_[_0x7119('0x40')](_0x25cb74[_0x7119('0x3e')],qs[_0x7119('0x42')](_0x92ff75[_0x7119('0x3f')][_0x7119('0x42')]));_0x45f9ea['attributes']=_0x45f9ea[_0x7119('0x41')][_0x7119('0x43')]?_0x45f9ea[_0x7119('0x41')]:_0x25cb74[_0x7119('0x3e')];if(_0x92ff75[_0x7119('0x3f')]['includeAll']){_0x45f9ea['include']=[{'all':!![]}];}_0x45f9ea=_['merge']({},_0x45f9ea,_0x92ff75['options']);return db[_0x7119('0x3a')][_0x7119('0x53')](_0x45f9ea)[_0x7119('0x1f')](handleEntityNotFound(_0xb011f3,null))['then'](respondWithResult(_0xb011f3,null))[_0x7119('0x27')](handleError(_0xb011f3,null));};exports[_0x7119('0x54')]=function(_0x50a1d7,_0x50fbca){return db[_0x7119('0x3a')]['create'](_0x50a1d7['body'],{})[_0x7119('0x1f')](respondWithResult(_0x50fbca,0xc9))[_0x7119('0x27')](handleError(_0x50fbca,null));};exports[_0x7119('0x32')]=function(_0x501f90,_0x3d0d19){if(_0x501f90[_0x7119('0x55')]['id']){delete _0x501f90[_0x7119('0x55')]['id'];}return db[_0x7119('0x3a')][_0x7119('0x53')]({'where':{'id':_0x501f90['params']['id']}})[_0x7119('0x1f')](handleEntityNotFound(_0x3d0d19,null))[_0x7119('0x1f')](saveUpdates(_0x501f90['body'],null))[_0x7119('0x1f')](respondWithResult(_0x3d0d19,null))[_0x7119('0x27')](handleError(_0x3d0d19,null));};exports[_0x7119('0x33')]=function(_0x4c536e,_0x3c6890){return db['WhatsappMessage'][_0x7119('0x53')]({'where':{'id':_0x4c536e[_0x7119('0x56')]['id']}})[_0x7119('0x1f')](handleEntityNotFound(_0x3c6890,null))[_0x7119('0x1f')](removeEntity(_0x3c6890,null))[_0x7119('0x27')](handleError(_0x3c6890,null));};exports['describe']=function(_0x56e6c1,_0x5cb107){return db['WhatsappMessage'][_0x7119('0x57')]()['then'](respondWithResult(_0x5cb107,null))['catch'](handleError(_0x5cb107,null));};var interaction_log=require(_0x7119('0x58'))(_0x7119('0x59'));exports[_0x7119('0x5a')]=function(_0x3f392d,_0x24eabc,_0x263296){var _0x3e19b7={'agent':{},'channel':_0x7119('0x5b')};if(_0x3f392d[_0x7119('0x55')]['id']){delete _0x3f392d['body']['id'];}_0x3f392d[_0x7119('0x55')][_0x7119('0x5c')]=!![];_0x3f392d['body']['readAt']=moment()[_0x7119('0x5d')](_0x7119('0x5e'));_0x3f392d['body'][_0x7119('0x5f')]=_0x3f392d[_0x7119('0x55')][_0x7119('0x5f')]||_0x3f392d[_0x7119('0x60')]['id'];_0x3e19b7[_0x7119('0x61')]['id']=_0x3f392d[_0x7119('0x55')][_0x7119('0x5f')];return db[_0x7119('0x3a')][_0x7119('0x53')]({'where':{'id':_0x3f392d[_0x7119('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x24eabc,null))['then'](saveUpdates(_0x3f392d['body'],null))[_0x7119('0x1f')](function(_0x45b5c3){if(_0x45b5c3){_0x3e19b7[_0x7119('0x26')]=_0x45b5c3[_0x7119('0x62')]({'plain':!![]});return db[_0x7119('0x63')]['find']({'where':{'id':_0x45b5c3[_0x7119('0x64')]}});}return null;})[_0x7119('0x1f')](handleEntityNotFound(_0x24eabc,null))[_0x7119('0x1f')](function(_0x4ecb8b){if(_0x4ecb8b){return _0x4ecb8b[_0x7119('0x32')]({'UserId':_0x3f392d[_0x7119('0x55')][_0x7119('0x5f')],'read1stAt':_[_0x7119('0x65')](_0x4ecb8b[_0x7119('0x66')])?moment()['format'](_0x7119('0x5e')):undefined});}return null;})[_0x7119('0x1f')](function(_0x44c866){if(_0x44c866){_0x3e19b7[_0x7119('0x67')]=_0x44c866[_0x7119('0x62')]({'plain':!![]});interaction_log[_0x7119('0x20')](_0x7119('0x68'),_0x3f392d[_0x7119('0x60')]['id'],_0x3f392d[_0x7119('0x60')][_0x7119('0x36')],_0x3f392d[_0x7119('0x60')]['role'],_0x3e19b7[_0x7119('0x67')]['id'],_0x3f392d[_0x7119('0x55')]?JSON[_0x7119('0x69')](_0x3f392d[_0x7119('0x55')]):'null');return respondWithRpcPromise(_0x7119('0x6a'),'acceptMessage',_0x3e19b7);}return null;})[_0x7119('0x1f')](function(_0x607e86){var _0x19bead='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x607e86[_0x7119('0x26')]['ContactId'];return db['sequelize'][_0x7119('0x3f')](_0x19bead,{'type':db[_0x7119('0x6b')][_0x7119('0x6c')][_0x7119('0x6d')],'raw':!![]})[_0x7119('0x1f')](function(_0x58432d){return _0x58432d;});})['then'](function(_0xf6555d){if(_0xf6555d){_0x3e19b7[_0x7119('0x26')]['contact']=_0xf6555d[0x0];if(!_0x3f392d[_0x7119('0x55')][_0x7119('0x5f')])return;return db[_0x7119('0x6e')]['find']({'where':{'id':_0x3f392d[_0x7119('0x55')][_0x7119('0x5f')],'role':_0x7119('0x61')},'attributes':['id',_0x7119('0x36'),_0x7119('0x6f'),_0x7119('0x70'),_0x7119('0x71')],'raw':!![]});}return null;})[_0x7119('0x1f')](function(_0x546064){if(!_0x546064)return null;_0x3e19b7[_0x7119('0x26')][_0x7119('0x61')]=_0x546064;return _0x3e19b7;})['then'](function(_0x2ce8c7){if(_0x2ce8c7){if(_0x3f392d[_0x7119('0x55')][_0x7119('0x72')]){_0x3e19b7[_0x7119('0x26')][_0x7119('0x73')]=util[_0x7119('0x5d')](_0x7119('0x74'),_0x3f392d[_0x7119('0x60')][_0x7119('0x36')]);_0x3e19b7[_0x7119('0x26')][_0x7119('0x75')]=_0x3e19b7['channel'];_0x3e19b7[_0x7119('0x26')][_0x7119('0x76')]=_0x3e19b7['channel'];_0x3e19b7[_0x7119('0x26')]['event']=_0x7119('0x5a');return respondWithRpcPromise(_0x7119('0x77'),_0x7119('0x77'),{'event':_0x7119('0x78'),'message':_0x3e19b7[_0x7119('0x26')]},client9002)[_0x7119('0x1f')](function(){return _0x3e19b7;});}return _0x3e19b7;}return null;})[_0x7119('0x1f')](respondWithResult(_0x24eabc,null))[_0x7119('0x27')](handleError(_0x24eabc,null));};var interaction_log=require(_0x7119('0x58'))(_0x7119('0x59'));exports['reject']=function(_0xc4087b,_0x25ee43,_0xfefe61){var _0x1ad2db={'agent':{},'channel':_0x7119('0x5b')};if(_0xc4087b[_0x7119('0x55')]['id']){delete _0xc4087b[_0x7119('0x55')]['id'];}_0xc4087b[_0x7119('0x55')][_0x7119('0x5f')]=_0xc4087b[_0x7119('0x55')][_0x7119('0x5f')]||_0xc4087b[_0x7119('0x60')]['id'];_0x1ad2db[_0x7119('0x61')]['id']=_0xc4087b['body']['UserId'];return db[_0x7119('0x3a')]['find']({'where':{'id':_0xc4087b[_0x7119('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x25ee43,null))[_0x7119('0x1f')](function(_0x504b3c){if(_0x504b3c){_0x1ad2db['message']=_0x504b3c[_0x7119('0x62')]({'plain':!![]});return db['WhatsappInteraction'][_0x7119('0x53')]({'where':{'id':_0x504b3c[_0x7119('0x64')]}});}return null;})[_0x7119('0x1f')](handleEntityNotFound(_0x25ee43,null))['then'](function(_0x3b93c4){if(_0x3b93c4){_0x1ad2db['interaction']=_0x3b93c4[_0x7119('0x62')]({'plain':!![]});interaction_log[_0x7119('0x20')](_0x7119('0x79'),_0xc4087b[_0x7119('0x60')]['id'],_0xc4087b[_0x7119('0x60')][_0x7119('0x36')],_0xc4087b[_0x7119('0x60')][_0x7119('0x7a')],_0x1ad2db['interaction']['id'],_0xc4087b[_0x7119('0x55')]?JSON[_0x7119('0x69')](_0xc4087b['body']):_0x7119('0x7b'));return respondWithRpcPromise(_0x7119('0x7c'),_0x7119('0x7d'),_0x1ad2db);}return null;})['then'](function(_0xefc3c){var _0x2d15e1=_0x7119('0x7e')+_0xefc3c[_0x7119('0x26')][_0x7119('0x7f')];return db[_0x7119('0x80')][_0x7119('0x3f')](_0x2d15e1,{'type':db[_0x7119('0x6b')][_0x7119('0x6c')][_0x7119('0x6d')],'raw':!![]})[_0x7119('0x1f')](function(_0x7802fd){return _0x7802fd;});})['then'](function(_0x457ba3){if(_0x457ba3){_0x1ad2db['message'][_0x7119('0x81')]=_0x457ba3[0x0];if(!_0xc4087b[_0x7119('0x55')]['UserId'])return;return db[_0x7119('0x6e')][_0x7119('0x53')]({'where':{'id':_0xc4087b[_0x7119('0x55')]['UserId'],'role':_0x7119('0x61')},'attributes':['id',_0x7119('0x36'),_0x7119('0x6f'),'email','internal'],'raw':!![]});}return null;})[_0x7119('0x1f')](function(_0x2e0aa3){if(!_0x2e0aa3)return null;_0x1ad2db[_0x7119('0x26')][_0x7119('0x61')]=_0x2e0aa3;return _0x1ad2db;})[_0x7119('0x1f')](function(_0x1df1cf){if(_0x1df1cf){_0x1df1cf[_0x7119('0x26')]['interface']=util[_0x7119('0x5d')](_0x7119('0x74'),_0xc4087b[_0x7119('0x60')][_0x7119('0x36')]);_0x1df1cf['message'][_0x7119('0x75')]=_0x1ad2db[_0x7119('0x75')];_0x1df1cf[_0x7119('0x26')]['motionChannel']=_0x1ad2db[_0x7119('0x75')];_0x1df1cf[_0x7119('0x26')][_0x7119('0x82')]=_0x7119('0x83');respondWithRpcPromise(_0x7119('0x77'),_0x7119('0x77'),{'event':_0x7119('0x84'),'message':_0x1df1cf[_0x7119('0x26')]},client9002);return _0x1ad2db;}return null;})[_0x7119('0x1f')](respondWithResult(_0x25ee43,null))[_0x7119('0x27')](handleError(_0x25ee43,null));};exports[_0x7119('0x29')]=function(_0x44ebeb,_0x16aeb9,_0x4a73a9){if(_0x44ebeb[_0x7119('0x55')]['id']){delete _0x44ebeb[_0x7119('0x55')]['id'];}var _0x34865f;return db[_0x7119('0x3a')][_0x7119('0x53')]({'where':{'id':_0x44ebeb[_0x7119('0x56')]['id']}})['then'](handleEntityNotFound(_0x16aeb9,null))[_0x7119('0x1f')](function(_0x1784d9){if(_0x1784d9){_0x34865f=_0x1784d9;return db['WhatsappAccount'][_0x7119('0x53')]({'where':{'id':_0x1784d9['WhatsappAccountId']}});}})[_0x7119('0x1f')](handleEntityNotFound(_0x16aeb9,null))[_0x7119('0x1f')](function(_0x32689b){if(_0x32689b){logger['debug'](_0x7119('0x85'),'status','received\x20delivery\x20report\x20from',_0x32689b['type'],util[_0x7119('0x86')](_0x44ebeb[_0x7119('0x55')],{'showHidden':![],'depth':null}));switch(_0x32689b[_0x7119('0x3c')]){case'twilio':if(_0x44ebeb[_0x7119('0x55')][_0x7119('0x87')]&&_0x44ebeb['body'][_0x7119('0x87')]===_0x34865f[_0x7119('0x88')]&&_0x44ebeb[_0x7119('0x55')][_0x7119('0x89')]&&_0x44ebeb[_0x7119('0x55')][_0x7119('0x89')]===_0x7119('0x5c')){return _0x34865f[_0x7119('0x32')]({'read':!![]});}else{logger['error'](_0x7119('0x8a'),'status','twilio',util[_0x7119('0x86')](_0x44ebeb[_0x7119('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x34865f;}})[_0x7119('0x1f')](respondWithResult(_0x16aeb9,null))[_0x7119('0x27')](handleError(_0x16aeb9,null));}; \ No newline at end of file +var _0xd511=['inspect','eml-format','rimraf','zip-dir','fast-json-patch','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','jayson/promise','http','client','request','info','WhatsappMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','sendStatus','status','end','json','undefined','limit','offset','Content-Range','apply','reject','save','update','then','index','map','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','merge','options','count','includeAll','include','WhatsappMessage','findAll','rows','length','find','create','body','params','destroy','../../config/logger','whatsapp-interactions','accept','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','AcceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','role','null','RejectMessage','rejectMessage','fullname','motionChannel','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s'];(function(_0x53300e,_0x4032ba){var _0x28e1d0=function(_0xdf19fa){while(--_0xdf19fa){_0x53300e['push'](_0x53300e['shift']());}};_0x28e1d0(++_0x4032ba);}(_0xd511,0x184));var _0x1d51=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd511[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x1d51('0x0'));var rimraf=require(_0x1d51('0x1'));var zipdir=require(_0x1d51('0x2'));var jsonpatch=require(_0x1d51('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(_0x1d51('0x4'));var sox=require(_0x1d51('0x5'));var csv=require(_0x1d51('0x6'));var ejs=require(_0x1d51('0x7'));var fs=require('fs');var fs_extra=require(_0x1d51('0x8'));var _=require(_0x1d51('0x9'));var squel=require('squel');var crypto=require(_0x1d51('0xa'));var jsforce=require(_0x1d51('0xb'));var deskjs=require(_0x1d51('0xc'));var toCsv=require(_0x1d51('0x6'));var querystring=require(_0x1d51('0xd'));var Papa=require(_0x1d51('0xe'));var Redis=require(_0x1d51('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1d51('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1d51('0x11'));var utils=require(_0x1d51('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x1d51('0x13'));var db=require(_0x1d51('0x14'))['db'];config[_0x1d51('0x15')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1d51('0x15')]));require('./whatsappMessage.socket')['register'](socket);var jayson=require(_0x1d51('0x16'));var client=jayson['client'][_0x1d51('0x17')]({'port':0x232c});var client9002=jayson[_0x1d51('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fd6d7,_0x3ac390,_0x114565,_0x4b83fe){return new BPromise(function(_0x31556c,_0x25808a){var _0x339240=_0x4b83fe||client;return _0x339240[_0x1d51('0x19')](_0x2fd6d7,_0x114565)['then'](function(_0x27a9d4){logger[_0x1d51('0x1a')](_0x1d51('0x1b'),_0x3ac390,'request\x20sent');logger[_0x1d51('0x1c')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x3ac390,_0x1d51('0x1d'),JSON[_0x1d51('0x1e')](_0x27a9d4));if(_0x27a9d4['error']){if(_0x27a9d4[_0x1d51('0x1f')]['code']===0x1f4){logger['error'](_0x1d51('0x1b'),_0x3ac390,_0x27a9d4[_0x1d51('0x1f')][_0x1d51('0x20')]);return _0x25808a(_0x27a9d4[_0x1d51('0x1f')][_0x1d51('0x20')]);}logger[_0x1d51('0x1f')](_0x1d51('0x1b'),_0x3ac390,_0x27a9d4[_0x1d51('0x1f')]['message']);return _0x31556c(_0x27a9d4[_0x1d51('0x1f')][_0x1d51('0x20')]);}else{logger[_0x1d51('0x1a')](_0x1d51('0x1b'),_0x3ac390,_0x1d51('0x1d'));_0x31556c(_0x27a9d4['result'][_0x1d51('0x20')]);}})[_0x1d51('0x21')](function(_0x23fc8c){logger[_0x1d51('0x1f')](_0x1d51('0x1b'),_0x3ac390,_0x23fc8c);_0x25808a(_0x23fc8c);});});}function respondWithStatusCode(_0x34c7d7,_0x2fe928){_0x2fe928=_0x2fe928||0xcc;return function(_0x348356){if(_0x348356){return _0x34c7d7[_0x1d51('0x22')](_0x2fe928);}return _0x34c7d7[_0x1d51('0x23')](_0x2fe928)[_0x1d51('0x24')]();};}function respondWithResult(_0x4b6207,_0x3c15ed){_0x3c15ed=_0x3c15ed||0xc8;return function(_0x18f1c2){if(_0x18f1c2){return _0x4b6207[_0x1d51('0x23')](_0x3c15ed)[_0x1d51('0x25')](_0x18f1c2);}};}function respondWithFilteredResult(_0x26034f,_0x3b37b6){return function(_0x1c8fd8){if(_0x1c8fd8){var _0x22a25e=typeof _0x3b37b6['offset']===_0x1d51('0x26')&&typeof _0x3b37b6[_0x1d51('0x27')]===_0x1d51('0x26');var _0x989dec=_0x1c8fd8['count'];var _0x5a3104=_0x22a25e?0x0:_0x3b37b6[_0x1d51('0x28')];var _0x19242e=_0x22a25e?_0x1c8fd8['count']:_0x3b37b6[_0x1d51('0x28')]+_0x3b37b6[_0x1d51('0x27')];var _0x48fa8d;if(_0x19242e>=_0x989dec){_0x19242e=_0x989dec;_0x48fa8d=0xc8;}else{_0x48fa8d=0xce;}_0x26034f[_0x1d51('0x23')](_0x48fa8d);return _0x26034f['set'](_0x1d51('0x29'),_0x5a3104+'-'+_0x19242e+'/'+_0x989dec)[_0x1d51('0x25')](_0x1c8fd8);}return null;};}function patchUpdates(_0x1f8887){return function(_0x9a2ad2){try{jsonpatch[_0x1d51('0x2a')](_0x9a2ad2,_0x1f8887,!![]);}catch(_0x2ccf1a){return BPromise[_0x1d51('0x2b')](_0x2ccf1a);}return _0x9a2ad2[_0x1d51('0x2c')]();};}function saveUpdates(_0xc31133,_0xde07a7){return function(_0x319295){if(_0x319295){return _0x319295[_0x1d51('0x2d')](_0xc31133)[_0x1d51('0x2e')](function(_0x23476e){return _0x23476e;});}return null;};}function removeEntity(_0x31c0ce,_0x5a42e9){return function(_0x16abbc){if(_0x16abbc){return _0x16abbc['destroy']()[_0x1d51('0x2e')](function(){_0x31c0ce[_0x1d51('0x23')](0xcc)[_0x1d51('0x24')]();});}};}function handleEntityNotFound(_0x3f9cce,_0x82b5af){return function(_0x5b3fe2){if(!_0x5b3fe2){_0x3f9cce[_0x1d51('0x22')](0x194);}return _0x5b3fe2;};}function handleError(_0x2362a4,_0x4516b2){_0x4516b2=_0x4516b2||0x1f4;return function(_0x3456aa){logger[_0x1d51('0x1f')](_0x3456aa['stack']);if(_0x3456aa['name']){delete _0x3456aa['name'];}_0x2362a4[_0x1d51('0x23')](_0x4516b2)['send'](_0x3456aa);};}exports[_0x1d51('0x2f')]=function(_0x51ab92,_0x5cb5b2){var _0xb40f0e={},_0x3715d4={},_0x3e08de={'count':0x0,'rows':[]};var _0x533511=_[_0x1d51('0x30')](db['WhatsappMessage'][_0x1d51('0x31')],function(_0x4eeaeb){return{'name':_0x4eeaeb['fieldName'],'type':_0x4eeaeb[_0x1d51('0x32')][_0x1d51('0x33')]};});_0x3715d4[_0x1d51('0x34')]=_[_0x1d51('0x30')](_0x533511,_0x1d51('0x35'));_0x3715d4[_0x1d51('0x36')]=_[_0x1d51('0x37')](_0x51ab92[_0x1d51('0x36')]);_0x3715d4[_0x1d51('0x38')]=_[_0x1d51('0x39')](_0x3715d4[_0x1d51('0x34')],_0x3715d4[_0x1d51('0x36')]);_0xb40f0e[_0x1d51('0x3a')]=_[_0x1d51('0x39')](_0x3715d4[_0x1d51('0x34')],qs['fields'](_0x51ab92['query'][_0x1d51('0x3b')]));_0xb40f0e[_0x1d51('0x3a')]=_0xb40f0e[_0x1d51('0x3a')]['length']?_0xb40f0e[_0x1d51('0x3a')]:_0x3715d4[_0x1d51('0x34')];if(!_0x51ab92[_0x1d51('0x36')][_0x1d51('0x3c')](_0x1d51('0x3d'))){_0xb40f0e['limit']=qs[_0x1d51('0x27')](_0x51ab92['query'][_0x1d51('0x27')]);_0xb40f0e[_0x1d51('0x28')]=qs[_0x1d51('0x28')](_0x51ab92[_0x1d51('0x36')][_0x1d51('0x28')]);}_0xb40f0e['order']=qs['sort'](_0x51ab92[_0x1d51('0x36')][_0x1d51('0x3e')]);_0xb40f0e[_0x1d51('0x3f')]=qs['filters'](_['pick'](_0x51ab92[_0x1d51('0x36')],_0x3715d4[_0x1d51('0x38')]),_0x533511);if(_0x51ab92[_0x1d51('0x36')]['filter']){_0xb40f0e['where']=_[_0x1d51('0x40')](_0xb40f0e[_0x1d51('0x3f')],{'$or':_[_0x1d51('0x30')](_0x533511,function(_0x2a6611){if(_0x2a6611['type']!=='VIRTUAL'){var _0x595478={};_0x595478[_0x2a6611[_0x1d51('0x35')]]={'$like':'%'+_0x51ab92[_0x1d51('0x36')]['filter']+'%'};return _0x595478;}})});}_0xb40f0e=_[_0x1d51('0x40')]({},_0xb40f0e,_0x51ab92[_0x1d51('0x41')]);var _0x54518d={'where':_0xb40f0e[_0x1d51('0x3f')]};return db['WhatsappMessage'][_0x1d51('0x42')](_0x54518d)[_0x1d51('0x2e')](function(_0x33c54e){_0x3e08de[_0x1d51('0x42')]=_0x33c54e;if(_0x51ab92[_0x1d51('0x36')][_0x1d51('0x43')]){_0xb40f0e[_0x1d51('0x44')]=[{'all':!![]}];}return db[_0x1d51('0x45')][_0x1d51('0x46')](_0xb40f0e);})['then'](function(_0xfcd24){_0x3e08de[_0x1d51('0x47')]=_0xfcd24;return _0x3e08de;})[_0x1d51('0x2e')](respondWithFilteredResult(_0x5cb5b2,_0xb40f0e))[_0x1d51('0x21')](handleError(_0x5cb5b2,null));};exports['show']=function(_0x1e24a7,_0x1fe82d){var _0x1a2e10={'raw':!![],'where':{'id':_0x1e24a7['params']['id']}},_0x276ce8={};_0x276ce8[_0x1d51('0x34')]=_[_0x1d51('0x37')](db[_0x1d51('0x45')][_0x1d51('0x31')]);_0x276ce8[_0x1d51('0x36')]=_['keys'](_0x1e24a7['query']);_0x276ce8[_0x1d51('0x38')]=_['intersection'](_0x276ce8[_0x1d51('0x34')],_0x276ce8[_0x1d51('0x36')]);_0x1a2e10[_0x1d51('0x3a')]=_[_0x1d51('0x39')](_0x276ce8['model'],qs['fields'](_0x1e24a7[_0x1d51('0x36')][_0x1d51('0x3b')]));_0x1a2e10['attributes']=_0x1a2e10[_0x1d51('0x3a')][_0x1d51('0x48')]?_0x1a2e10[_0x1d51('0x3a')]:_0x276ce8['model'];if(_0x1e24a7[_0x1d51('0x36')][_0x1d51('0x43')]){_0x1a2e10[_0x1d51('0x44')]=[{'all':!![]}];}_0x1a2e10=_[_0x1d51('0x40')]({},_0x1a2e10,_0x1e24a7[_0x1d51('0x41')]);return db[_0x1d51('0x45')][_0x1d51('0x49')](_0x1a2e10)[_0x1d51('0x2e')](handleEntityNotFound(_0x1fe82d,null))[_0x1d51('0x2e')](respondWithResult(_0x1fe82d,null))[_0x1d51('0x21')](handleError(_0x1fe82d,null));};exports['create']=function(_0x2013b0,_0x4c7189){return db[_0x1d51('0x45')][_0x1d51('0x4a')](_0x2013b0[_0x1d51('0x4b')],{})['then'](respondWithResult(_0x4c7189,0xc9))[_0x1d51('0x21')](handleError(_0x4c7189,null));};exports[_0x1d51('0x2d')]=function(_0x220f1a,_0x426ee0){if(_0x220f1a['body']['id']){delete _0x220f1a[_0x1d51('0x4b')]['id'];}return db[_0x1d51('0x45')][_0x1d51('0x49')]({'where':{'id':_0x220f1a[_0x1d51('0x4c')]['id']}})[_0x1d51('0x2e')](handleEntityNotFound(_0x426ee0,null))[_0x1d51('0x2e')](saveUpdates(_0x220f1a[_0x1d51('0x4b')],null))['then'](respondWithResult(_0x426ee0,null))[_0x1d51('0x21')](handleError(_0x426ee0,null));};exports[_0x1d51('0x4d')]=function(_0x2647ca,_0x5dd6a2){return db[_0x1d51('0x45')][_0x1d51('0x49')]({'where':{'id':_0x2647ca['params']['id']}})[_0x1d51('0x2e')](handleEntityNotFound(_0x5dd6a2,null))['then'](removeEntity(_0x5dd6a2,null))[_0x1d51('0x21')](handleError(_0x5dd6a2,null));};exports['describe']=function(_0x49b9bc,_0x4d21ac){return db['WhatsappMessage']['describe']()[_0x1d51('0x2e')](respondWithResult(_0x4d21ac,null))['catch'](handleError(_0x4d21ac,null));};var interaction_log=require(_0x1d51('0x4e'))(_0x1d51('0x4f'));exports[_0x1d51('0x50')]=function(_0x4974c5,_0x37331f,_0x25befe){var _0x4918f0={'agent':{},'channel':_0x1d51('0x51')};if(_0x4974c5['body']['id']){delete _0x4974c5[_0x1d51('0x4b')]['id'];}_0x4974c5[_0x1d51('0x4b')]['read']=!![];_0x4974c5[_0x1d51('0x4b')][_0x1d51('0x52')]=moment()[_0x1d51('0x53')](_0x1d51('0x54'));_0x4974c5[_0x1d51('0x4b')]['UserId']=_0x4974c5[_0x1d51('0x4b')][_0x1d51('0x55')]||_0x4974c5[_0x1d51('0x56')]['id'];_0x4918f0[_0x1d51('0x57')]['id']=_0x4974c5[_0x1d51('0x4b')][_0x1d51('0x55')];return db[_0x1d51('0x45')][_0x1d51('0x49')]({'where':{'id':_0x4974c5[_0x1d51('0x4c')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x37331f,null))[_0x1d51('0x2e')](saveUpdates(_0x4974c5['body'],null))[_0x1d51('0x2e')](function(_0x30bd47){if(_0x30bd47){_0x4918f0[_0x1d51('0x20')]=_0x30bd47[_0x1d51('0x58')]({'plain':!![]});return db[_0x1d51('0x59')][_0x1d51('0x49')]({'where':{'id':_0x30bd47[_0x1d51('0x5a')]}});}return null;})[_0x1d51('0x2e')](handleEntityNotFound(_0x37331f,null))[_0x1d51('0x2e')](function(_0x354219){if(_0x354219){return _0x354219[_0x1d51('0x2d')]({'UserId':_0x4974c5[_0x1d51('0x4b')][_0x1d51('0x55')],'read1stAt':_[_0x1d51('0x5b')](_0x354219[_0x1d51('0x5c')])?moment()[_0x1d51('0x53')](_0x1d51('0x54')):undefined});}return null;})[_0x1d51('0x2e')](function(_0xac1247){if(_0xac1247){_0x4918f0['interaction']=_0xac1247[_0x1d51('0x58')]({'plain':!![]});interaction_log[_0x1d51('0x1a')](_0x1d51('0x5d'),_0x4974c5[_0x1d51('0x56')]['id'],_0x4974c5[_0x1d51('0x56')]['name'],_0x4974c5[_0x1d51('0x56')]['role'],_0x4918f0[_0x1d51('0x5e')]['id'],_0x4974c5[_0x1d51('0x4b')]?JSON['stringify'](_0x4974c5[_0x1d51('0x4b')]):'null');return respondWithRpcPromise(_0x1d51('0x5f'),'acceptMessage',_0x4918f0);}return null;})[_0x1d51('0x2e')](function(_0x147da8){var _0x3a7525='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x147da8[_0x1d51('0x20')][_0x1d51('0x60')];return db[_0x1d51('0x61')]['query'](_0x3a7525,{'type':db[_0x1d51('0x62')][_0x1d51('0x63')][_0x1d51('0x64')],'raw':!![]})[_0x1d51('0x2e')](function(_0x347bd8){return _0x347bd8;});})[_0x1d51('0x2e')](function(_0x19b6b5){if(_0x19b6b5){_0x4918f0[_0x1d51('0x20')][_0x1d51('0x65')]=_0x19b6b5[0x0];if(!_0x4974c5[_0x1d51('0x4b')]['UserId'])return;return db[_0x1d51('0x66')][_0x1d51('0x49')]({'where':{'id':_0x4974c5['body'][_0x1d51('0x55')],'role':_0x1d51('0x57')},'attributes':['id',_0x1d51('0x35'),'fullname',_0x1d51('0x67'),_0x1d51('0x68')],'raw':!![]});}return null;})[_0x1d51('0x2e')](function(_0x388bc0){if(!_0x388bc0)return null;_0x4918f0['message']['agent']=_0x388bc0;return _0x4918f0;})[_0x1d51('0x2e')](function(_0x417190){if(_0x417190){if(_0x4974c5[_0x1d51('0x4b')][_0x1d51('0x69')]){_0x4918f0[_0x1d51('0x20')][_0x1d51('0x6a')]=util[_0x1d51('0x53')](_0x1d51('0x6b'),_0x4974c5['user'][_0x1d51('0x35')]);_0x4918f0[_0x1d51('0x20')][_0x1d51('0x6c')]=_0x4918f0[_0x1d51('0x6c')];_0x4918f0['message']['motionChannel']=_0x4918f0['channel'];_0x4918f0['message'][_0x1d51('0x6d')]=_0x1d51('0x50');return respondWithRpcPromise(_0x1d51('0x6e'),'EventManager',{'event':_0x1d51('0x6f'),'message':_0x4918f0[_0x1d51('0x20')]},client9002)['then'](function(){return _0x4918f0;});}return _0x4918f0;}return null;})[_0x1d51('0x2e')](respondWithResult(_0x37331f,null))[_0x1d51('0x21')](handleError(_0x37331f,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0x1d51('0x2b')]=function(_0x25de42,_0x3c1797,_0x4b8b8b){var _0x1fea89={'agent':{},'channel':_0x1d51('0x51')};if(_0x25de42[_0x1d51('0x4b')]['id']){delete _0x25de42[_0x1d51('0x4b')]['id'];}_0x25de42[_0x1d51('0x4b')][_0x1d51('0x55')]=_0x25de42['body'][_0x1d51('0x55')]||_0x25de42[_0x1d51('0x56')]['id'];_0x1fea89[_0x1d51('0x57')]['id']=_0x25de42[_0x1d51('0x4b')][_0x1d51('0x55')];return db[_0x1d51('0x45')][_0x1d51('0x49')]({'where':{'id':_0x25de42[_0x1d51('0x4c')]['id'],'UserId':null}})[_0x1d51('0x2e')](handleEntityNotFound(_0x3c1797,null))[_0x1d51('0x2e')](function(_0x531926){if(_0x531926){_0x1fea89[_0x1d51('0x20')]=_0x531926[_0x1d51('0x58')]({'plain':!![]});return db[_0x1d51('0x59')]['find']({'where':{'id':_0x531926[_0x1d51('0x5a')]}});}return null;})[_0x1d51('0x2e')](handleEntityNotFound(_0x3c1797,null))['then'](function(_0x43698a){if(_0x43698a){_0x1fea89[_0x1d51('0x5e')]=_0x43698a[_0x1d51('0x58')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x25de42[_0x1d51('0x56')]['id'],_0x25de42[_0x1d51('0x56')][_0x1d51('0x35')],_0x25de42[_0x1d51('0x56')][_0x1d51('0x70')],_0x1fea89[_0x1d51('0x5e')]['id'],_0x25de42['body']?JSON[_0x1d51('0x1e')](_0x25de42[_0x1d51('0x4b')]):_0x1d51('0x71'));return respondWithRpcPromise(_0x1d51('0x72'),_0x1d51('0x73'),_0x1fea89);}return null;})[_0x1d51('0x2e')](function(_0x42e12c){var _0x3fb0a1='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x42e12c['message']['ContactId'];return db[_0x1d51('0x61')][_0x1d51('0x36')](_0x3fb0a1,{'type':db[_0x1d51('0x62')][_0x1d51('0x63')][_0x1d51('0x64')],'raw':!![]})[_0x1d51('0x2e')](function(_0x2cd7ea){return _0x2cd7ea;});})['then'](function(_0x206b1c){if(_0x206b1c){_0x1fea89[_0x1d51('0x20')][_0x1d51('0x65')]=_0x206b1c[0x0];if(!_0x25de42[_0x1d51('0x4b')]['UserId'])return;return db[_0x1d51('0x66')]['find']({'where':{'id':_0x25de42[_0x1d51('0x4b')][_0x1d51('0x55')],'role':'agent'},'attributes':['id',_0x1d51('0x35'),_0x1d51('0x74'),_0x1d51('0x67'),_0x1d51('0x68')],'raw':!![]});}return null;})['then'](function(_0x202962){if(!_0x202962)return null;_0x1fea89[_0x1d51('0x20')]['agent']=_0x202962;return _0x1fea89;})[_0x1d51('0x2e')](function(_0x5a5792){if(_0x5a5792){_0x5a5792[_0x1d51('0x20')]['interface']=util[_0x1d51('0x53')](_0x1d51('0x6b'),_0x25de42[_0x1d51('0x56')][_0x1d51('0x35')]);_0x5a5792[_0x1d51('0x20')]['channel']=_0x1fea89[_0x1d51('0x6c')];_0x5a5792[_0x1d51('0x20')][_0x1d51('0x75')]=_0x1fea89[_0x1d51('0x6c')];_0x5a5792[_0x1d51('0x20')][_0x1d51('0x6d')]=_0x1d51('0x2b');respondWithRpcPromise(_0x1d51('0x6e'),_0x1d51('0x6e'),{'event':_0x1d51('0x76'),'message':_0x5a5792[_0x1d51('0x20')]},client9002);return _0x1fea89;}return null;})['then'](respondWithResult(_0x3c1797,null))[_0x1d51('0x21')](handleError(_0x3c1797,null));};exports[_0x1d51('0x23')]=function(_0x4ac5e2,_0x108f89,_0x119f07){if(_0x4ac5e2['body']['id']){delete _0x4ac5e2[_0x1d51('0x4b')]['id'];}var _0x470400;return db[_0x1d51('0x45')]['find']({'where':{'id':_0x4ac5e2['params']['id']}})[_0x1d51('0x2e')](handleEntityNotFound(_0x108f89,null))[_0x1d51('0x2e')](function(_0x2a1cc8){if(_0x2a1cc8){_0x470400=_0x2a1cc8;return db['WhatsappAccount']['find']({'where':{'id':_0x2a1cc8[_0x1d51('0x77')]}});}})[_0x1d51('0x2e')](handleEntityNotFound(_0x108f89,null))[_0x1d51('0x2e')](function(_0x4e3a48){if(_0x4e3a48){logger['debug'](_0x1d51('0x78'),_0x1d51('0x23'),_0x1d51('0x79'),_0x4e3a48[_0x1d51('0x32')],util['inspect'](_0x4ac5e2[_0x1d51('0x4b')],{'showHidden':![],'depth':null}));switch(_0x4e3a48[_0x1d51('0x32')]){case _0x1d51('0x7a'):if(_0x4ac5e2[_0x1d51('0x4b')]['MessageSid']&&_0x4ac5e2[_0x1d51('0x4b')][_0x1d51('0x7b')]===_0x470400[_0x1d51('0x7c')]&&_0x4ac5e2[_0x1d51('0x4b')]['MessageStatus']&&_0x4ac5e2[_0x1d51('0x4b')][_0x1d51('0x7d')]===_0x1d51('0x7e')){return _0x470400[_0x1d51('0x2d')]({'read':!![]});}else{logger[_0x1d51('0x1f')](_0x1d51('0x7f'),'status',_0x1d51('0x7a'),util[_0x1d51('0x80')](_0x4ac5e2[_0x1d51('0x4b')],{'showHidden':![],'depth':null}));}break;}return _0x470400;}})[_0x1d51('0x2e')](respondWithResult(_0x108f89,null))['catch'](handleError(_0x108f89,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 6a54aaa..e145df3 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x373d=['update','emit','hasOwnProperty','hook','exports','events','WhatsappMessage','setMaxListeners','save'];(function(_0xd7ef9,_0x2cf2d7){var _0x160554=function(_0x35c674){while(--_0x35c674){_0xd7ef9['push'](_0xd7ef9['shift']());}};_0x160554(++_0x2cf2d7);}(_0x373d,0x1e2));var _0xd373=function(_0x3db2e8,_0x49c09b){_0x3db2e8=_0x3db2e8-0x0;var _0xf05958=_0x373d[_0x3db2e8];return _0xf05958;};'use strict';var EventEmitter=require(_0xd373('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xd373('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xd373('0x2')](0x0);var events={'afterCreate':_0xd373('0x3'),'afterUpdate':_0xd373('0x4'),'afterDestroy':'remove'};function emitEvent(_0x151fe9){return function(_0x547fca,_0x2b6e64,_0x598692){WhatsappMessageEvents['emit'](_0x151fe9+':'+_0x547fca['id'],_0x547fca);WhatsappMessageEvents[_0xd373('0x5')](_0x151fe9,_0x547fca);_0x598692(null);};}for(var e in events){if(events[_0xd373('0x6')](e)){var event=events[e];WhatsappMessage[_0xd373('0x7')](e,emitEvent(event));}}module[_0xd373('0x8')]=WhatsappMessageEvents; \ No newline at end of file +var _0x4227=['exports','events','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x15d203,_0x5b93ba){var _0x350cf6=function(_0x32335b){while(--_0x32335b){_0x15d203['push'](_0x15d203['shift']());}};_0x350cf6(++_0x5b93ba);}(_0x4227,0x89));var _0x7422=function(_0x421a4e,_0x75f0c4){_0x421a4e=_0x421a4e-0x0;var _0x5bcaca=_0x4227[_0x421a4e];return _0x5bcaca;};'use strict';var EventEmitter=require(_0x7422('0x0'));var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x7422('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7422('0x2'),'afterDestroy':_0x7422('0x3')};function emitEvent(_0x3e69ca){return function(_0x57e279,_0x2de51f,_0x1cd829){WhatsappMessageEvents[_0x7422('0x4')](_0x3e69ca+':'+_0x57e279['id'],_0x57e279);WhatsappMessageEvents[_0x7422('0x4')](_0x3e69ca,_0x57e279);_0x1cd829(null);};}for(var e in events){if(events[_0x7422('0x5')](e)){var event=events[e];WhatsappMessage[_0x7422('0x6')](e,emitEvent(event));}}module[_0x7422('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 642a80f..87069fc 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 _0x885f=['WhatsappInteractionId','update','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','then','type','twilio','accountSid','authToken','create','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','token','sid','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','body','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','messageId','fti_whatsapp_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','WhatsappInteraction'];(function(_0x1eeec8,_0x55f982){var _0x4a0464=function(_0x3076e4){while(--_0x3076e4){_0x1eeec8['push'](_0x1eeec8['shift']());}};_0x4a0464(++_0x55f982);}(_0x885f,0x18d));var _0xf885=function(_0x4f3522,_0x3e9fb){_0x4f3522=_0x4f3522-0x0;var _0x5b4de7=_0x885f[_0x4f3522];return _0x5b4de7;};'use strict';var _=require('lodash');var util=require(_0xf885('0x0'));var logger=require(_0xf885('0x1'))(_0xf885('0x2'));var moment=require(_0xf885('0x3'));var BPromise=require('bluebird');var rp=require(_0xf885('0x4'));var fetch=require(_0xf885('0x5'));var fs=require('fs');var path=require(_0xf885('0x6'));var rimraf=require(_0xf885('0x7'));var config=require(_0xf885('0x8'));var attributes=require(_0xf885('0x9'));module[_0xf885('0xa')]=function(_0x319803,_0x26804d){return _0x319803['define'](_0xf885('0xb'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xf885('0xc'),'fields':['messageId']},{'name':_0xf885('0xd'),'fields':['body'],'type':_0xf885('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2aed8b,_0x2a8b30,_0x2253ff){var _0xcfe612=_0x319803[_0xf885('0xf')];var _0x220dec=_0x2aed8b[_0xf885('0x10')]({'plain':!![]});if(_0x220dec[_0xf885('0x11')][_0xf885('0x12')]()==='in'||_0x220dec[_0xf885('0x11')][_0xf885('0x12')]()===_0xf885('0x13')&&!_0x220dec[_0xf885('0x14')]&&!_['isNil'](_0x220dec[_0xf885('0x15')])){_0xcfe612[_0xf885('0x16')]['findOne']({'where':{'id':_0x220dec[_0xf885('0x17')]}})['then'](function(_0x17011a){if(_0x17011a){_0x17011a[_0xf885('0x18')]({'lastMsgAt':_0x220dec[_0xf885('0x19')],'lastMsgDirection':_0x220dec[_0xf885('0x11')][_0xf885('0x12')]()});}})[_0xf885('0x1a')](function(_0x58d81e){console[_0xf885('0x1b')](_0x58d81e);});}if(_0x220dec[_0xf885('0x11')]===_0xf885('0x13')&&!_0x220dec[_0xf885('0x14')]){var _0x3d67e2;_0xcfe612[_0xf885('0x1c')][_0xf885('0x1d')]({'where':{'id':_0x220dec[_0xf885('0x1e')]},'raw':!![]})[_0xf885('0x1f')](function(_0x3db169){_0x3d67e2=_0x3db169;if(_0x3d67e2&&_0x3d67e2[_0xf885('0x20')]){switch(_0x3d67e2[_0xf885('0x20')]){case _0xf885('0x21'):var _0x486200=require('twilio');if(_0x3d67e2[_0xf885('0x22')]&&_0x3d67e2['authToken']&&_0x3d67e2['phone']){var _0x476359=new _0x486200(_0x3d67e2[_0xf885('0x22')],_0x3d67e2[_0xf885('0x23')]);_0x476359['messages'][_0xf885('0x24')]({'body':_0x220dec['body'],'to':_0xf885('0x25')+_0x220dec[_0xf885('0x26')],'from':_0xf885('0x25')+_0x3d67e2[_0xf885('0x26')],'statusCallback':_0x3d67e2[_0xf885('0x27')]+_0xf885('0x28')+_0x220dec['id']+_0xf885('0x29')+_0x3d67e2[_0xf885('0x2a')]})['then'](function(_0x317b70){if(_0x317b70[_0xf885('0x2b')]){return _0x2aed8b['update']({'messageId':_0x317b70[_0xf885('0x2b')]});}})[_0xf885('0x1a')](function(_0x6c6d14){logger[_0xf885('0x1b')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xf885('0x2c'),_0xf885('0x21'),util[_0xf885('0x2d')](_0x6c6d14,{'showHidden':![],'depth':null}));});}else{logger[_0xf885('0x1b')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio',_0xf885('0x2e'));}break;case _0xf885('0x2f'):var _0x50e346=_0x3d67e2['accountSid'];var _0xc5a7f3=_0x3d67e2[_0xf885('0x23')];var _0x3d5f08=_0x3d67e2[_0xf885('0x30')]+_0xf885('0x31')+_0x50e346+_0xf885('0x32');var _0x53acf5={'to':[_0x220dec[_0xf885('0x26')]],'message':{'type':'text','text':_0x220dec[_0xf885('0x33')]}};var _0x8ab399={'method':'POST','uri':_0x3d5f08,'headers':{'Authorization':_0xf885('0x34')+_0xc5a7f3,'Content-Type':_0xf885('0x35')},'body':_0x53acf5,'json':!![]};rp(_0x8ab399)['then'](function(_0x599ffd){if(_0x599ffd[_0xf885('0x36')][0x0][_0xf885('0x37')]){return _0x2aed8b[_0xf885('0x18')]({'messageId':_0x599ffd['statuses'][0x0]['message_id']});}})[_0xf885('0x1a')](function(_0x430ee3){logger[_0xf885('0x38')](_0xf885('0x39'),_0x430ee3);});break;}}})[_0xf885('0x3a')](function(){_0x2253ff();});}else{_0x2253ff();}}},'charset':'utf8mb4','collate':_0xf885('0x3b')});}; \ No newline at end of file +var _0x1057=['WhatsappInteractionId','toLowerCase','catch','error','find','WhatsappAccountId','then','type','twilio','accountSid','authToken','phone','body','whatsapp:','/api/whatsapp/messages/','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','sinch','baseUrl','/whatsapp/v1/','text','POST','Bearer\x20','application/json','statuses','message_id','update','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','fti_whatsapp_messages','models','get','direction','out','UserId'];(function(_0x27a3cb,_0x4af597){var _0x54ff38=function(_0x3a82d2){while(--_0x3a82d2){_0x27a3cb['push'](_0x27a3cb['shift']());}};_0x54ff38(++_0x4af597);}(_0x1057,0xc3));var _0x7105=function(_0x4acae6,_0x3e1453){_0x4acae6=_0x4acae6-0x0;var _0x377c0f=_0x1057[_0x4acae6];return _0x377c0f;};'use strict';var _=require(_0x7105('0x0'));var util=require(_0x7105('0x1'));var logger=require(_0x7105('0x2'))(_0x7105('0x3'));var moment=require(_0x7105('0x4'));var BPromise=require('bluebird');var rp=require(_0x7105('0x5'));var fetch=require(_0x7105('0x6'));var fs=require('fs');var path=require(_0x7105('0x7'));var rimraf=require(_0x7105('0x8'));var config=require(_0x7105('0x9'));var attributes=require(_0x7105('0xa'));module[_0x7105('0xb')]=function(_0xcb314,_0x635835){return _0xcb314[_0x7105('0xc')]('WhatsappMessage',attributes,{'tableName':_0x7105('0xd'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x7105('0xe')]},{'name':_0x7105('0xf'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4cb415,_0x27a838,_0x45bf76){var _0x1c48fc=_0xcb314[_0x7105('0x10')];var _0x360faa=_0x4cb415[_0x7105('0x11')]({'plain':!![]});if(_0x360faa[_0x7105('0x12')]['toLowerCase']()==='in'||_0x360faa[_0x7105('0x12')]['toLowerCase']()===_0x7105('0x13')&&!_0x360faa['secret']&&!_['isNil'](_0x360faa[_0x7105('0x14')])){_0x1c48fc['WhatsappInteraction']['findOne']({'where':{'id':_0x360faa[_0x7105('0x15')]}})['then'](function(_0x571bb4){if(_0x571bb4){_0x571bb4['update']({'lastMsgAt':_0x360faa['createdAt'],'lastMsgDirection':_0x360faa['direction'][_0x7105('0x16')]()});}})[_0x7105('0x17')](function(_0x2b1174){console[_0x7105('0x18')](_0x2b1174);});}if(_0x360faa[_0x7105('0x12')]===_0x7105('0x13')&&!_0x360faa['secret']){var _0x497f0f;_0x1c48fc['WhatsappAccount'][_0x7105('0x19')]({'where':{'id':_0x360faa[_0x7105('0x1a')]},'raw':!![]})[_0x7105('0x1b')](function(_0x307126){_0x497f0f=_0x307126;if(_0x497f0f&&_0x497f0f[_0x7105('0x1c')]){switch(_0x497f0f[_0x7105('0x1c')]){case _0x7105('0x1d'):var _0x18e768=require(_0x7105('0x1d'));if(_0x497f0f[_0x7105('0x1e')]&&_0x497f0f[_0x7105('0x1f')]&&_0x497f0f[_0x7105('0x20')]){var _0x3d0eaf=new _0x18e768(_0x497f0f[_0x7105('0x1e')],_0x497f0f[_0x7105('0x1f')]);_0x3d0eaf['messages']['create']({'body':_0x360faa[_0x7105('0x21')],'to':_0x7105('0x22')+_0x360faa['phone'],'from':'whatsapp:'+_0x497f0f[_0x7105('0x20')],'statusCallback':_0x497f0f['remote']+_0x7105('0x23')+_0x360faa['id']+'/status?token='+_0x497f0f[_0x7105('0x24')]})[_0x7105('0x1b')](function(_0x2671ab){if(_0x2671ab[_0x7105('0x25')]){return _0x4cb415['update']({'messageId':_0x2671ab[_0x7105('0x25')]});}})[_0x7105('0x17')](function(_0x1c6d84){logger[_0x7105('0x18')](_0x7105('0x26'),_0x7105('0x27'),_0x7105('0x1d'),util[_0x7105('0x28')](_0x1c6d84,{'showHidden':![],'depth':null}));});}else{logger[_0x7105('0x18')](_0x7105('0x26'),_0x7105('0x27'),_0x7105('0x1d'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x7105('0x29'):var _0x24e441=_0x497f0f[_0x7105('0x1e')];var _0x5bda7c=_0x497f0f[_0x7105('0x1f')];var _0x402d98=_0x497f0f[_0x7105('0x2a')]+_0x7105('0x2b')+_0x24e441+'/messages/';var _0x5ab0e4={'to':[_0x360faa[_0x7105('0x20')]],'message':{'type':_0x7105('0x2c'),'text':_0x360faa[_0x7105('0x21')]}};var _0x368ca3={'method':_0x7105('0x2d'),'uri':_0x402d98,'headers':{'Authorization':_0x7105('0x2e')+_0x5bda7c,'Content-Type':_0x7105('0x2f')},'body':_0x5ab0e4,'json':!![]};rp(_0x368ca3)[_0x7105('0x1b')](function(_0x12afbf){if(_0x12afbf[_0x7105('0x30')][0x0][_0x7105('0x31')]){return _0x4cb415[_0x7105('0x32')]({'messageId':_0x12afbf[_0x7105('0x30')][0x0]['message_id']});}})[_0x7105('0x17')](function(_0x5a7ba3){logger['err']('WhatsappMessage,\x20%s',_0x5a7ba3);});break;}}})[_0x7105('0x33')](function(){_0x45bf76();});}else{_0x45bf76();}}},'charset':_0x7105('0x34'),'collate':_0x7105('0x35')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 1355b3a..c49b815 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 _0xb301=['then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register'];(function(_0x2b694f,_0xe958fe){var _0x1a00f4=function(_0x7726ac){while(--_0x7726ac){_0x2b694f['push'](_0x2b694f['shift']());}};_0x1a00f4(++_0xe958fe);}(_0xb301,0xd5));var _0x1b30=function(_0x106336,_0x4fbdc2){_0x106336=_0x106336-0x0;var _0x43ccab=_0xb301[_0x106336];return _0x43ccab;};'use strict';var _=require(_0x1b30('0x0'));var util=require(_0x1b30('0x1'));var moment=require(_0x1b30('0x2'));var BPromise=require(_0x1b30('0x3'));var rs=require(_0x1b30('0x4'));var fs=require('fs');var Redis=require(_0x1b30('0x5'));var db=require(_0x1b30('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1b30('0x7'))(_0x1b30('0x8'));var config=require(_0x1b30('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1b30('0xa')][_0x1b30('0xb')]({'port':0x232a});config['redis']=_[_0x1b30('0xc')](config[_0x1b30('0xd')],{'host':_0x1b30('0xe'),'port':0x18eb});var socket=require(_0x1b30('0xf'))(new Redis(config[_0x1b30('0xd')]));require(_0x1b30('0x10'))[_0x1b30('0x11')](socket);function respondWithRpcPromise(_0x16f511,_0x4798d4,_0x41541b){return new BPromise(function(_0x7dd3aa,_0x282166){return client['request'](_0x16f511,_0x41541b)[_0x1b30('0x12')](function(_0xf1f8bd){logger[_0x1b30('0x13')](_0x1b30('0x14'),_0x4798d4,_0x1b30('0x15'));logger['debug'](_0x1b30('0x16'),_0x4798d4,_0x1b30('0x15'),JSON['stringify'](_0xf1f8bd));if(_0xf1f8bd[_0x1b30('0x17')]){if(_0xf1f8bd[_0x1b30('0x17')][_0x1b30('0x18')]===0x1f4){logger['error'](_0x1b30('0x14'),_0x4798d4,_0xf1f8bd[_0x1b30('0x17')][_0x1b30('0x19')]);return _0x282166(_0xf1f8bd[_0x1b30('0x17')][_0x1b30('0x19')]);}logger['error'](_0x1b30('0x14'),_0x4798d4,_0xf1f8bd[_0x1b30('0x17')][_0x1b30('0x19')]);return _0x7dd3aa(_0xf1f8bd[_0x1b30('0x17')][_0x1b30('0x19')]);}else{logger['info'](_0x1b30('0x14'),_0x4798d4,_0x1b30('0x15'));_0x7dd3aa(_0xf1f8bd[_0x1b30('0x1a')][_0x1b30('0x19')]);}})[_0x1b30('0x1b')](function(_0x42d3b6){logger[_0x1b30('0x17')](_0x1b30('0x14'),_0x4798d4,_0x42d3b6);_0x282166(_0x42d3b6);});});}exports[_0x1b30('0x1c')]=function(_0x2f599b){var _0x1ed070=this;return new Promise(function(_0x1abe35,_0x1dd278){return db[_0x1b30('0x1d')][_0x1b30('0x1e')](_0x2f599b['body'],{'raw':_0x2f599b[_0x1b30('0x1f')]?_0x2f599b[_0x1b30('0x1f')][_0x1b30('0x20')]===undefined?!![]:![]:!![]})[_0x1b30('0x12')](function(_0x37302e){logger['info'](_0x1b30('0x1c'),_0x2f599b);logger['debug'](_0x1b30('0x1c'),_0x2f599b,JSON['stringify'](_0x37302e));_0x1abe35(_0x37302e);})[_0x1b30('0x1b')](function(_0x1d0b8a){logger['error'](_0x1b30('0x1c'),_0x1d0b8a['message'],_0x2f599b);_0x1dd278(_0x1ed070[_0x1b30('0x17')](0x1f4,_0x1d0b8a['message']));});});}; \ No newline at end of file +var _0x5b72=['WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','WhatsappMessage,\x20%s,\x20%s','message','result','CreateWhatsappMessage','WhatsappMessage','create','raw','info','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappMessage.socket','register','request','debug'];(function(_0xc62bf6,_0x54eac4){var _0x1c4fb5=function(_0x2af6b6){while(--_0x2af6b6){_0xc62bf6['push'](_0xc62bf6['shift']());}};_0x1c4fb5(++_0x54eac4);}(_0x5b72,0x185));var _0x25b7=function(_0x14580c,_0xa50d45){_0x14580c=_0x14580c-0x0;var _0x99542d=_0x5b72[_0x14580c];return _0x99542d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x25b7('0x0'));var BPromise=require(_0x25b7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x25b7('0x2'));var db=require(_0x25b7('0x3'))['db'];var utils=require(_0x25b7('0x4'));var logger=require(_0x25b7('0x5'))('rpc');var config=require(_0x25b7('0x6'));var jayson=require(_0x25b7('0x7'));var client=jayson[_0x25b7('0x8')][_0x25b7('0x9')]({'port':0x232a});config[_0x25b7('0xa')]=_[_0x25b7('0xb')](config[_0x25b7('0xa')],{'host':_0x25b7('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x25b7('0xd'))[_0x25b7('0xe')](socket);function respondWithRpcPromise(_0x346bc9,_0x10c494,_0x559fa6){return new BPromise(function(_0x54f201,_0x10b4be){return client[_0x25b7('0xf')](_0x346bc9,_0x559fa6)['then'](function(_0x549a06){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x10c494,'request\x20sent');logger[_0x25b7('0x10')](_0x25b7('0x11'),_0x10c494,'request\x20sent',JSON[_0x25b7('0x12')](_0x549a06));if(_0x549a06['error']){if(_0x549a06['error'][_0x25b7('0x13')]===0x1f4){logger[_0x25b7('0x14')](_0x25b7('0x15'),_0x10c494,_0x549a06[_0x25b7('0x14')][_0x25b7('0x16')]);return _0x10b4be(_0x549a06[_0x25b7('0x14')]['message']);}logger['error'](_0x25b7('0x15'),_0x10c494,_0x549a06['error'][_0x25b7('0x16')]);return _0x54f201(_0x549a06[_0x25b7('0x14')]['message']);}else{logger['info'](_0x25b7('0x15'),_0x10c494,'request\x20sent');_0x54f201(_0x549a06[_0x25b7('0x17')][_0x25b7('0x16')]);}})['catch'](function(_0x2c147d){logger[_0x25b7('0x14')](_0x25b7('0x15'),_0x10c494,_0x2c147d);_0x10b4be(_0x2c147d);});});}exports[_0x25b7('0x18')]=function(_0xd49e6b){var _0x310855=this;return new Promise(function(_0x7e06d6,_0x4c7ed1){return db[_0x25b7('0x19')][_0x25b7('0x1a')](_0xd49e6b['body'],{'raw':_0xd49e6b['options']?_0xd49e6b['options'][_0x25b7('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x4f9d6d){logger[_0x25b7('0x1c')](_0x25b7('0x18'),_0xd49e6b);logger['debug'](_0x25b7('0x18'),_0xd49e6b,JSON[_0x25b7('0x12')](_0x4f9d6d));_0x7e06d6(_0x4f9d6d);})['catch'](function(_0x47213d){logger['error'](_0x25b7('0x18'),_0x47213d['message'],_0xd49e6b);_0x4c7ed1(_0x310855[_0x25b7('0x14')](0x1f4,_0x47213d['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index f2abc9d..456d332 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 _0xa0ce=['register','length','whatsappMessage:','./whatsappMessage.events','save','remove','update','emit','removeListener'];(function(_0x43edad,_0x3933f3){var _0xf2ef85=function(_0x1cb68d){while(--_0x1cb68d){_0x43edad['push'](_0x43edad['shift']());}};_0xf2ef85(++_0x3933f3);}(_0xa0ce,0x135));var _0xea0c=function(_0x163748,_0x1400a2){_0x163748=_0x163748-0x0;var _0x47a2d6=_0xa0ce[_0x163748];return _0x47a2d6;};'use strict';var WhatsappMessageEvents=require(_0xea0c('0x0'));var events=[_0xea0c('0x1'),_0xea0c('0x2'),_0xea0c('0x3')];function createListener(_0x59e72f,_0x5dce25){return function(_0x196c01){_0x5dce25[_0xea0c('0x4')](_0x59e72f,_0x196c01);};}function removeListener(_0x13e62b,_0x4e4ae6){return function(){WhatsappMessageEvents[_0xea0c('0x5')](_0x13e62b,_0x4e4ae6);};}exports[_0xea0c('0x6')]=function(_0x2f4fdb){for(var _0x42e8c9=0x0,_0x338b26=events[_0xea0c('0x7')];_0x42e8c9<_0x338b26;_0x42e8c9++){var _0x3a4693=events[_0x42e8c9];var _0x56e585=createListener(_0xea0c('0x8')+_0x3a4693,_0x2f4fdb);WhatsappMessageEvents['on'](_0x3a4693,_0x56e585);}}; \ No newline at end of file +var _0xd4d8=['removeListener','whatsappMessage:','./whatsappMessage.events','save','remove','update'];(function(_0x11f5ff,_0xa0ef18){var _0x46eefb=function(_0x51872a){while(--_0x51872a){_0x11f5ff['push'](_0x11f5ff['shift']());}};_0x46eefb(++_0xa0ef18);}(_0xd4d8,0xb0));var _0x8d4d=function(_0x29ce14,_0x334166){_0x29ce14=_0x29ce14-0x0;var _0x48f289=_0xd4d8[_0x29ce14];return _0x48f289;};'use strict';var WhatsappMessageEvents=require(_0x8d4d('0x0'));var events=[_0x8d4d('0x1'),_0x8d4d('0x2'),_0x8d4d('0x3')];function createListener(_0x4a91b7,_0x48730c){return function(_0xd1080){_0x48730c['emit'](_0x4a91b7,_0xd1080);};}function removeListener(_0x17f2e3,_0x560ae0){return function(){WhatsappMessageEvents[_0x8d4d('0x4')](_0x17f2e3,_0x560ae0);};}exports['register']=function(_0x2285c8){for(var _0x33e8a1=0x0,_0x41d264=events['length'];_0x33e8a1<_0x41d264;_0x33e8a1++){var _0x3073e4=events[_0x33e8a1];var _0x4d5a51=createListener(_0x8d4d('0x5')+_0x3073e4,_0x2285c8);WhatsappMessageEvents['on'](_0x3073e4,_0x4d5a51);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 06bb5f6..6fec3ce 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 _0x22f3=['/:id/users','getAgents','post','create','addTeams','addAgents','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','describe','/:id','/:id/members','/:id/teams','getTeams'];(function(_0x5a320e,_0x1fbfac){var _0x2ac62b=function(_0x4f6ab4){while(--_0x4f6ab4){_0x5a320e['push'](_0x5a320e['shift']());}};_0x2ac62b(++_0x1fbfac);}(_0x22f3,0xc8));var _0x322f=function(_0x4df0ac,_0x18f735){_0x4df0ac=_0x4df0ac-0x0;var _0x1683d7=_0x22f3[_0x4df0ac];return _0x1683d7;};'use strict';var multer=require(_0x322f('0x0'));var util=require(_0x322f('0x1'));var path=require(_0x322f('0x2'));var timeout=require(_0x322f('0x3'));var express=require(_0x322f('0x4'));var router=express['Router']();var fs_extra=require(_0x322f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x322f('0x6'));var config=require(_0x322f('0x7'));var controller=require(_0x322f('0x8'));router[_0x322f('0x9')]('/',auth[_0x322f('0xa')](),controller['index']);router[_0x322f('0x9')]('/describe',auth[_0x322f('0xa')](),controller[_0x322f('0xb')]);router['get'](_0x322f('0xc'),auth[_0x322f('0xa')](),controller['show']);router[_0x322f('0x9')](_0x322f('0xd'),auth['isAuthenticated'](),controller['getMembers']);router[_0x322f('0x9')](_0x322f('0xe'),auth[_0x322f('0xa')](),controller[_0x322f('0xf')]);router[_0x322f('0x9')](_0x322f('0x10'),auth[_0x322f('0xa')](),controller[_0x322f('0x11')]);router[_0x322f('0x12')]('/',auth[_0x322f('0xa')](),controller[_0x322f('0x13')]);router[_0x322f('0x12')]('/:id/teams',auth['isAuthenticated'](),controller[_0x322f('0x14')]);router['post'](_0x322f('0x10'),auth[_0x322f('0xa')](),controller[_0x322f('0x15')]);router['put'](_0x322f('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x322f('0x16')](_0x322f('0xc'),auth[_0x322f('0xa')](),controller[_0x322f('0x17')]);router['delete'](_0x322f('0xe'),auth[_0x322f('0xa')](),controller[_0x322f('0x18')]);router['delete'](_0x322f('0x10'),auth[_0x322f('0xa')](),controller[_0x322f('0x19')]);module[_0x322f('0x1a')]=router; \ No newline at end of file +var _0xb502=['getAgents','post','create','/:id/teams','addTeams','put','delete','removeTeams','removeAgents','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','getTeams','/:id/users'];(function(_0x526f6d,_0x755026){var _0x10224d=function(_0x5cff1b){while(--_0x5cff1b){_0x526f6d['push'](_0x526f6d['shift']());}};_0x10224d(++_0x755026);}(_0xb502,0x1ae));var _0x2b50=function(_0x4cd940,_0x2bcca9){_0x4cd940=_0x4cd940-0x0;var _0x5667f7=_0xb502[_0x4cd940];return _0x5667f7;};'use strict';var multer=require(_0x2b50('0x0'));var util=require(_0x2b50('0x1'));var path=require('path');var timeout=require(_0x2b50('0x2'));var express=require('express');var router=express[_0x2b50('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2b50('0x4'));var interaction=require(_0x2b50('0x5'));var config=require(_0x2b50('0x6'));var controller=require(_0x2b50('0x7'));router[_0x2b50('0x8')]('/',auth[_0x2b50('0x9')](),controller[_0x2b50('0xa')]);router[_0x2b50('0x8')](_0x2b50('0xb'),auth[_0x2b50('0x9')](),controller[_0x2b50('0xc')]);router[_0x2b50('0x8')](_0x2b50('0xd'),auth['isAuthenticated'](),controller[_0x2b50('0xe')]);router[_0x2b50('0x8')]('/:id/members',auth['isAuthenticated'](),controller[_0x2b50('0xf')]);router['get']('/:id/teams',auth[_0x2b50('0x9')](),controller[_0x2b50('0x10')]);router[_0x2b50('0x8')](_0x2b50('0x11'),auth['isAuthenticated'](),controller[_0x2b50('0x12')]);router[_0x2b50('0x13')]('/',auth[_0x2b50('0x9')](),controller[_0x2b50('0x14')]);router['post'](_0x2b50('0x15'),auth[_0x2b50('0x9')](),controller[_0x2b50('0x16')]);router[_0x2b50('0x13')](_0x2b50('0x11'),auth[_0x2b50('0x9')](),controller['addAgents']);router[_0x2b50('0x17')](_0x2b50('0xd'),auth[_0x2b50('0x9')](),controller['update']);router['delete'](_0x2b50('0xd'),auth[_0x2b50('0x9')](),controller['destroy']);router[_0x2b50('0x18')](_0x2b50('0x15'),auth[_0x2b50('0x9')](),controller[_0x2b50('0x19')]);router['delete'](_0x2b50('0x11'),auth['isAuthenticated'](),controller[_0x2b50('0x1a')]);module[_0x2b50('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 8128a67..c0dbaaa 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 _0x9b00=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','INTEGER'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9b00,0xcc));var _0x09b0=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x9b00[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0x09b0('0x0'));module[_0x09b0('0x1')]={'name':{'type':Sequelize[_0x09b0('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x09b0('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x09b0('0x4')](_0x09b0('0x5'),_0x09b0('0x6'),_0x09b0('0x7'))},'description':{'type':Sequelize[_0x09b0('0x2')]}}; \ No newline at end of file +var _0xe062=['ENUM','roundrobin','STRING','sequelize','exports','name','INTEGER'];(function(_0xdd0313,_0x251c2b){var _0x2bd7e8=function(_0x340f1f){while(--_0x340f1f){_0xdd0313['push'](_0xdd0313['shift']());}};_0x2bd7e8(++_0x251c2b);}(_0xe062,0xd5));var _0x2e06=function(_0x3f1db8,_0x414ad8){_0x3f1db8=_0x3f1db8-0x0;var _0x50d176=_0xe062[_0x3f1db8];return _0x50d176;};'use strict';var Sequelize=require(_0x2e06('0x0'));module[_0x2e06('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2e06('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x2e06('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2e06('0x4')]('rrmemory','beepall',_0x2e06('0x5'))},'description':{'type':Sequelize[_0x2e06('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index d73c5f7..90c7f50 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 _0x128b=['updatedAt','getTeams','Team','nolimit','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','each','UserWhatsappQueue','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','every','TeamId','includes','all','union','compact','value','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','getAgents','findOne','pick','eml-format','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','end','status','offset','undefined','limit','count','Content-Range','apply','reject','update','then','WhatsappQueues','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','options','WhatsappQueue','includeAll','include','findAll','catch','show','params','find','create','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','describe','getMembers','WhatsappQueueId','filter','User','findAndCountAll','UserId','whatsappPause','rows','%s/%s','SIP','createdAt'];(function(_0x3e4cec,_0x19b0a1){var _0x1b71d5=function(_0x2e443a){while(--_0x2e443a){_0x3e4cec['push'](_0x3e4cec['shift']());}};_0x1b71d5(++_0x19b0a1);}(_0x128b,0x1ce));var _0xb128=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x128b[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0xb128('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb128('0x1'));var BPromise=require(_0xb128('0x2'));var Mustache=require(_0xb128('0x3'));var util=require(_0xb128('0x4'));var path=require(_0xb128('0x5'));var sox=require(_0xb128('0x6'));var csv=require('to-csv');var ejs=require(_0xb128('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb128('0x8'));var squel=require(_0xb128('0x9'));var crypto=require(_0xb128('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb128('0xb'));var querystring=require(_0xb128('0xc'));var Papa=require(_0xb128('0xd'));var Redis=require('ioredis');var authService=require(_0xb128('0xe'));var qs=require(_0xb128('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb128('0x10'))(_0xb128('0x11'));var utils=require(_0xb128('0x12'));var config=require(_0xb128('0x13'));var licenseUtil=require(_0xb128('0x14'));var db=require(_0xb128('0x15'))['db'];config[_0xb128('0x16')]=_['defaults'](config[_0xb128('0x16')],{'host':_0xb128('0x17'),'port':0x18eb});var socket=require(_0xb128('0x18'))(new Redis(config[_0xb128('0x16')]));require(_0xb128('0x19'))[_0xb128('0x1a')](socket);function respondWithStatusCode(_0x1c1873,_0x19fba6){_0x19fba6=_0x19fba6||0xcc;return function(_0x4d84ef){if(_0x4d84ef){return _0x1c1873[_0xb128('0x1b')](_0x19fba6);}return _0x1c1873['status'](_0x19fba6)[_0xb128('0x1c')]();};}function respondWithResult(_0x2a066d,_0x200f33){_0x200f33=_0x200f33||0xc8;return function(_0x505688){if(_0x505688){return _0x2a066d[_0xb128('0x1d')](_0x200f33)['json'](_0x505688);}};}function respondWithFilteredResult(_0x54fc36,_0x27b32d){return function(_0x3a15dc){if(_0x3a15dc){var _0x34a603=typeof _0x27b32d[_0xb128('0x1e')]===_0xb128('0x1f')&&typeof _0x27b32d[_0xb128('0x20')]==='undefined';var _0x21dd32=_0x3a15dc['count'];var _0x2aed83=_0x34a603?0x0:_0x27b32d[_0xb128('0x1e')];var _0x3b8753=_0x34a603?_0x3a15dc[_0xb128('0x21')]:_0x27b32d[_0xb128('0x1e')]+_0x27b32d[_0xb128('0x20')];var _0x3a495d;if(_0x3b8753>=_0x21dd32){_0x3b8753=_0x21dd32;_0x3a495d=0xc8;}else{_0x3a495d=0xce;}_0x54fc36[_0xb128('0x1d')](_0x3a495d);return _0x54fc36['set'](_0xb128('0x22'),_0x2aed83+'-'+_0x3b8753+'/'+_0x21dd32)['json'](_0x3a15dc);}return null;};}function patchUpdates(_0x6f57c){return function(_0x3a28e3){try{jsonpatch[_0xb128('0x23')](_0x3a28e3,_0x6f57c,!![]);}catch(_0x81bf5f){return BPromise[_0xb128('0x24')](_0x81bf5f);}return _0x3a28e3['save']();};}function saveUpdates(_0x20353b,_0x4eb1ca){return function(_0x2cef0d){if(_0x2cef0d){return _0x2cef0d[_0xb128('0x25')](_0x20353b)['then'](function(_0x230d0c){return _0x230d0c;});}return null;};}function removeEntity(_0xe04050,_0x4a6e4a){return function(_0x19b4e0){if(_0x19b4e0){return _0x19b4e0['destroy']()[_0xb128('0x26')](function(){var _0x12d13f=_0x19b4e0['get']({'plain':!![]});var _0x1246a2=_0xb128('0x27');return db[_0xb128('0x28')]['destroy']({'where':{'type':_0x1246a2,'resourceId':_0x12d13f['id']}})[_0xb128('0x26')](function(){return _0x19b4e0;});})[_0xb128('0x26')](function(){_0xe04050[_0xb128('0x1d')](0xcc)[_0xb128('0x1c')]();});}};}function handleEntityNotFound(_0x5f10df,_0x597958){return function(_0x284160){if(!_0x284160){_0x5f10df[_0xb128('0x1b')](0x194);}return _0x284160;};}function handleError(_0x5daed5,_0x411af4){_0x411af4=_0x411af4||0x1f4;return function(_0x24d1e3){logger[_0xb128('0x29')](_0x24d1e3[_0xb128('0x2a')]);if(_0x24d1e3[_0xb128('0x2b')]){delete _0x24d1e3[_0xb128('0x2b')];}_0x5daed5['status'](_0x411af4)[_0xb128('0x2c')](_0x24d1e3);};}exports[_0xb128('0x2d')]=function(_0x4b7f9e,_0x29d093){var _0x3b16b6={},_0xe480fd={},_0x227d3f={'count':0x0,'rows':[]};var _0x3de836=_[_0xb128('0x2e')](db['WhatsappQueue'][_0xb128('0x2f')],function(_0x3e6ca0){return{'name':_0x3e6ca0[_0xb128('0x30')],'type':_0x3e6ca0[_0xb128('0x31')][_0xb128('0x32')]};});_0xe480fd[_0xb128('0x33')]=_[_0xb128('0x2e')](_0x3de836,_0xb128('0x2b'));_0xe480fd[_0xb128('0x34')]=_[_0xb128('0x35')](_0x4b7f9e[_0xb128('0x34')]);_0xe480fd[_0xb128('0x36')]=_[_0xb128('0x37')](_0xe480fd[_0xb128('0x33')],_0xe480fd[_0xb128('0x34')]);_0x3b16b6[_0xb128('0x38')]=_[_0xb128('0x37')](_0xe480fd['model'],qs[_0xb128('0x39')](_0x4b7f9e[_0xb128('0x34')][_0xb128('0x39')]));_0x3b16b6[_0xb128('0x38')]=_0x3b16b6[_0xb128('0x38')][_0xb128('0x3a')]?_0x3b16b6[_0xb128('0x38')]:_0xe480fd['model'];if(!_0x4b7f9e[_0xb128('0x34')][_0xb128('0x3b')]('nolimit')){_0x3b16b6['limit']=qs[_0xb128('0x20')](_0x4b7f9e[_0xb128('0x34')][_0xb128('0x20')]);_0x3b16b6[_0xb128('0x1e')]=qs[_0xb128('0x1e')](_0x4b7f9e['query'][_0xb128('0x1e')]);}_0x3b16b6[_0xb128('0x3c')]=qs[_0xb128('0x3d')](_0x4b7f9e['query'][_0xb128('0x3d')]);_0x3b16b6[_0xb128('0x3e')]=qs[_0xb128('0x36')](_['pick'](_0x4b7f9e[_0xb128('0x34')],_0xe480fd[_0xb128('0x36')]),_0x3de836);if(_0x4b7f9e['query']['filter']){_0x3b16b6[_0xb128('0x3e')]=_['merge'](_0x3b16b6[_0xb128('0x3e')],{'$or':_[_0xb128('0x2e')](_0x3de836,function(_0x3d45b4){if(_0x3d45b4[_0xb128('0x31')]!=='VIRTUAL'){var _0x3d7481={};_0x3d7481[_0x3d45b4[_0xb128('0x2b')]]={'$like':'%'+_0x4b7f9e['query']['filter']+'%'};return _0x3d7481;}})});}_0x3b16b6=_[_0xb128('0x3f')]({},_0x3b16b6,_0x4b7f9e[_0xb128('0x40')]);var _0x1ed50e={'where':_0x3b16b6[_0xb128('0x3e')]};return db[_0xb128('0x41')][_0xb128('0x21')](_0x1ed50e)['then'](function(_0x18bab5){_0x227d3f[_0xb128('0x21')]=_0x18bab5;if(_0x4b7f9e[_0xb128('0x34')][_0xb128('0x42')]){_0x3b16b6[_0xb128('0x43')]=[{'all':!![]}];}return db[_0xb128('0x41')][_0xb128('0x44')](_0x3b16b6);})[_0xb128('0x26')](function(_0x1359fc){_0x227d3f['rows']=_0x1359fc;return _0x227d3f;})[_0xb128('0x26')](respondWithFilteredResult(_0x29d093,_0x3b16b6))[_0xb128('0x45')](handleError(_0x29d093,null));};exports[_0xb128('0x46')]=function(_0xf180c4,_0x468a5b){var _0x2bbc10={'raw':!![],'where':{'id':_0xf180c4[_0xb128('0x47')]['id']}},_0x285da5={};_0x285da5[_0xb128('0x33')]=_[_0xb128('0x35')](db[_0xb128('0x41')][_0xb128('0x2f')]);_0x285da5['query']=_[_0xb128('0x35')](_0xf180c4[_0xb128('0x34')]);_0x285da5[_0xb128('0x36')]=_[_0xb128('0x37')](_0x285da5[_0xb128('0x33')],_0x285da5['query']);_0x2bbc10[_0xb128('0x38')]=_['intersection'](_0x285da5[_0xb128('0x33')],qs[_0xb128('0x39')](_0xf180c4[_0xb128('0x34')][_0xb128('0x39')]));_0x2bbc10[_0xb128('0x38')]=_0x2bbc10[_0xb128('0x38')][_0xb128('0x3a')]?_0x2bbc10['attributes']:_0x285da5['model'];if(_0xf180c4[_0xb128('0x34')][_0xb128('0x42')]){_0x2bbc10[_0xb128('0x43')]=[{'all':!![]}];}_0x2bbc10=_[_0xb128('0x3f')]({},_0x2bbc10,_0xf180c4[_0xb128('0x40')]);return db['WhatsappQueue'][_0xb128('0x48')](_0x2bbc10)[_0xb128('0x26')](handleEntityNotFound(_0x468a5b,null))[_0xb128('0x26')](respondWithResult(_0x468a5b,null))[_0xb128('0x45')](handleError(_0x468a5b,null));};exports[_0xb128('0x49')]=function(_0xc8a11f,_0x451bcd){return db['WhatsappQueue']['create'](_0xc8a11f['body'],{})[_0xb128('0x26')](function(_0x2d169d){var _0x304649=_0xc8a11f[_0xb128('0x4a')][_0xb128('0x4b')]({'plain':!![]});if(!_0x304649)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x304649['role']===_0xb128('0x4a')){var _0x1a8df1=_0x2d169d[_0xb128('0x4b')]({'plain':!![]});var _0x199ce3=_0xb128('0x27');return db[_0xb128('0x4c')]['find']({'where':{'name':_0x199ce3,'userProfileId':_0x304649[_0xb128('0x4d')]},'raw':!![]})[_0xb128('0x26')](function(_0x4711e9){if(_0x4711e9&&_0x4711e9[_0xb128('0x4e')]===0x0){return db['UserProfileResource'][_0xb128('0x49')]({'name':_0x1a8df1[_0xb128('0x2b')],'resourceId':_0x1a8df1['id'],'type':_0x4711e9['name'],'sectionId':_0x4711e9['id']},{})[_0xb128('0x26')](function(){return _0x2d169d;});}else{return _0x2d169d;}})[_0xb128('0x45')](function(_0x29929b){logger[_0xb128('0x29')](_0xb128('0x4f'),_0x29929b);throw _0x29929b;});}return _0x2d169d;})[_0xb128('0x26')](respondWithResult(_0x451bcd,0xc9))[_0xb128('0x45')](handleError(_0x451bcd,null));};exports['update']=function(_0x4af720,_0x25f13f){if(_0x4af720[_0xb128('0x50')]['id']){delete _0x4af720['body']['id'];}return db[_0xb128('0x41')]['find']({'where':{'id':_0x4af720[_0xb128('0x47')]['id']}})['then'](handleEntityNotFound(_0x25f13f,null))[_0xb128('0x26')](saveUpdates(_0x4af720['body'],null))['then'](respondWithResult(_0x25f13f,null))[_0xb128('0x45')](handleError(_0x25f13f,null));};exports[_0xb128('0x51')]=function(_0x48273d,_0x3980b9){return db[_0xb128('0x41')]['find']({'where':{'id':_0x48273d[_0xb128('0x47')]['id']}})[_0xb128('0x26')](handleEntityNotFound(_0x3980b9,null))[_0xb128('0x26')](removeEntity(_0x3980b9,null))[_0xb128('0x45')](handleError(_0x3980b9,null));};exports[_0xb128('0x52')]=function(_0x110274,_0x59e2fb){return db[_0xb128('0x41')][_0xb128('0x52')]()['then'](respondWithResult(_0x59e2fb,null))[_0xb128('0x45')](handleError(_0x59e2fb,null));};exports[_0xb128('0x53')]=function(_0x28d8de,_0x184e73,_0x582dd5){var _0x5de825={'raw':!![],'where':{}},_0x4a91fc={},_0x19b034;return db[_0xb128('0x41')]['findOne']({'where':{'id':_0x28d8de[_0xb128('0x47')]['id']}})['then'](handleEntityNotFound(_0x184e73,null))['then'](function(_0x1bc1ee){if(_0x1bc1ee){_0x19b034=_0x1bc1ee[_0xb128('0x4b')]({'plain':!![]});_0x4a91fc[_0xb128('0x33')]=_[_0xb128('0x35')](db['UserWhatsappQueue']['rawAttributes']);_0x4a91fc[_0xb128('0x34')]=_[_0xb128('0x35')](_0x28d8de[_0xb128('0x34')]);_0x4a91fc['filters']=_[_0xb128('0x37')](_0x4a91fc[_0xb128('0x33')],_0x4a91fc['query']);_0x5de825[_0xb128('0x38')]=_[_0xb128('0x37')](_0x4a91fc[_0xb128('0x33')],qs['fields'](_0x28d8de[_0xb128('0x34')][_0xb128('0x39')]));_0x5de825[_0xb128('0x38')]=_0x5de825[_0xb128('0x38')][_0xb128('0x3a')]?_0x5de825[_0xb128('0x38')]:_0x4a91fc[_0xb128('0x33')];if(!_0x28d8de['query'][_0xb128('0x3b')]('nolimit')){_0x5de825[_0xb128('0x20')]=qs[_0xb128('0x20')](_0x28d8de[_0xb128('0x34')][_0xb128('0x20')]);_0x5de825[_0xb128('0x1e')]=qs['offset'](_0x28d8de[_0xb128('0x34')][_0xb128('0x1e')]);}_0x5de825['order']=qs[_0xb128('0x3d')](_0x28d8de[_0xb128('0x34')][_0xb128('0x3d')]);_0x5de825[_0xb128('0x3e')]=qs[_0xb128('0x36')](_['pick'](_0x28d8de['query'],_0x4a91fc[_0xb128('0x36')]));_0x5de825['where'][_0xb128('0x54')]=_0x1bc1ee['id'];if(_0x28d8de['query'][_0xb128('0x55')]){_0x5de825[_0xb128('0x3e')]=_[_0xb128('0x3f')](_0x5de825[_0xb128('0x3e')],{'$or':_[_0xb128('0x2e')](_0x5de825['attributes'],function(_0x4cb5ae){var _0x4fbe33={};_0x4fbe33[_0x4cb5ae]={'$like':'%'+_0x28d8de['query']['filter']+'%'};return _0x4fbe33;})});}_0x5de825=_[_0xb128('0x3f')]({},_0x5de825,_0x28d8de[_0xb128('0x40')]);return db['UserWhatsappQueue']['findAll'](_0x5de825);}})[_0xb128('0x26')](function(_0x54bf6f){if(_0x54bf6f){return db[_0xb128('0x56')][_0xb128('0x57')]({'where':{'id':_[_0xb128('0x2e')](_0x54bf6f,_0xb128('0x58')),'role':'agent'},'attributes':['id',_0xb128('0x2b'),_0xb128('0x59'),'updatedAt','createdAt']});}})[_0xb128('0x26')](function(_0x2e75f4){if(_0x2e75f4){return{'count':_0x2e75f4[_0xb128('0x21')],'rows':_[_0xb128('0x2e')](_0x2e75f4[_0xb128('0x5a')],function(_0x5e80af){return{'membername':_0x5e80af[_0xb128('0x2b')],'UserId':_0x5e80af['id'],'queue_name':_0x19b034['name'],'WhatsappQueueId':_0x19b034['id'],'interface':util['format'](_0xb128('0x5b'),_0xb128('0x5c'),_0x5e80af[_0xb128('0x2b')]),'penalty':0x0,'paused':_0x5e80af['whatsappPause'],'createdAt':_0x5e80af[_0xb128('0x5d')],'updatedAt':_0x5e80af[_0xb128('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb128('0x26')](respondWithFilteredResult(_0x184e73,_0x5de825))[_0xb128('0x45')](handleError(_0x184e73,null));};exports[_0xb128('0x5f')]=function(_0x478975,_0xa3b80c,_0x1a083f){var _0x1d350a={};var _0x4a1b84={};var _0x3ea054;var _0x9f18be;return db[_0xb128('0x41')]['findOne']({'where':{'id':_0x478975['params']['id']}})['then'](handleEntityNotFound(_0xa3b80c,null))[_0xb128('0x26')](function(_0x5482db){if(_0x5482db){_0x3ea054=_0x5482db;_0x4a1b84['model']=_[_0xb128('0x35')](db[_0xb128('0x60')][_0xb128('0x2f')]);_0x4a1b84[_0xb128('0x34')]=_[_0xb128('0x35')](_0x478975['query']);_0x4a1b84[_0xb128('0x36')]=_[_0xb128('0x37')](_0x4a1b84[_0xb128('0x33')],_0x4a1b84[_0xb128('0x34')]);_0x1d350a['attributes']=_['intersection'](_0x4a1b84[_0xb128('0x33')],qs['fields'](_0x478975[_0xb128('0x34')][_0xb128('0x39')]));_0x1d350a[_0xb128('0x38')]=_0x1d350a['attributes']['length']?_0x1d350a['attributes']:_0x4a1b84[_0xb128('0x33')];_0x1d350a['order']=qs[_0xb128('0x3d')](_0x478975[_0xb128('0x34')][_0xb128('0x3d')]);_0x1d350a[_0xb128('0x3e')]=qs['filters'](_['pick'](_0x478975[_0xb128('0x34')],_0x4a1b84[_0xb128('0x36')]));if(_0x478975[_0xb128('0x34')]['filter']){_0x1d350a[_0xb128('0x3e')]=_[_0xb128('0x3f')](_0x1d350a[_0xb128('0x3e')],{'$or':_['map'](_0x1d350a[_0xb128('0x38')],function(_0x16ef3c){var _0x80e7c3={};_0x80e7c3[_0x16ef3c]={'$like':'%'+_0x478975['query'][_0xb128('0x55')]+'%'};return _0x80e7c3;})});}_0x1d350a=_[_0xb128('0x3f')]({},_0x1d350a,_0x478975[_0xb128('0x40')]);return _0x3ea054['getTeams'](_0x1d350a);}})[_0xb128('0x26')](function(_0x386709){if(_0x386709){_0x9f18be=_0x386709[_0xb128('0x3a')];if(!_0x478975['query'][_0xb128('0x3b')](_0xb128('0x61'))){_0x1d350a[_0xb128('0x20')]=qs[_0xb128('0x20')](_0x478975[_0xb128('0x34')][_0xb128('0x20')]);_0x1d350a[_0xb128('0x1e')]=qs[_0xb128('0x1e')](_0x478975[_0xb128('0x34')]['offset']);}return _0x3ea054[_0xb128('0x5f')](_0x1d350a);}})[_0xb128('0x26')](function(_0x212dc6){if(_0x212dc6){return _0x212dc6?{'count':_0x9f18be,'rows':_0x212dc6}:null;}})[_0xb128('0x26')](respondWithResult(_0xa3b80c,null))[_0xb128('0x45')](handleError(_0xa3b80c,null));};exports[_0xb128('0x62')]=function(_0x501f85,_0x12561a,_0xdc7a4e){var _0x447e36=_0x501f85[_0xb128('0x50')][_0xb128('0x63')];return db[_0xb128('0x60')][_0xb128('0x44')]({'where':{'id':_0x447e36},'attributes':['id'],'include':[{'model':db[_0xb128('0x56')],'as':_0xb128('0x64'),'attributes':['id',_0xb128('0x2b'),_0xb128('0x65'),_0xb128('0x66'),_0xb128('0x67')],'raw':!![]}]})[_0xb128('0x26')](function(_0x42a094){if(_0x42a094){var _0x1d170b=_['flatMap'](_0x42a094,function(_0x173c8b){var _0x4ff32a=_0x173c8b[_0xb128('0x4b')]({'plain':!![]});return _0x4ff32a[_0xb128('0x64')];});return db[_0xb128('0x41')][_0xb128('0x48')]({'where':{'id':_0x501f85[_0xb128('0x47')]['id']}})[_0xb128('0x26')](function(_0x3d8206){return db[_0xb128('0x68')][_0xb128('0x69')](function(_0x3eafc5){return _0x3d8206['addTeams'](_0x447e36,{'transaction':_0x3eafc5})['then'](function(){return BPromise[_0xb128('0x6a')](_0x1d170b,function(_0x33f1dc){return db[_0xb128('0x6b')]['findOrCreate']({'where':{'UserId':_0x33f1dc['id'],'WhatsappQueueId':_0x501f85['params']['id']},'transaction':_0x3eafc5});});})[_0xb128('0x26')](function(){_0x1d170b[_0xb128('0x6c')](function(_0x59d7d7){socket[_0xb128('0x6d')](_0xb128('0x6e'),{'UserId':_0x59d7d7['id'],'WhatsappQueueId':_0x3d8206['id']});});});});});}})['then'](respondWithStatusCode(_0x12561a,null))[_0xb128('0x45')](handleError(_0x12561a,null));};exports[_0xb128('0x6f')]=function(_0x6e8de6,_0x5d6d1c,_0x2c9c3f){return db[_0xb128('0x60')]['findAll']({'where':{'id':_0x6e8de6['query'][_0xb128('0x63')]},'attributes':['id'],'include':[{'model':db[_0xb128('0x56')],'as':_0xb128('0x64'),'attributes':['id'],'raw':!![]}]})[_0xb128('0x26')](handleEntityNotFound(_0x5d6d1c,null))[_0xb128('0x26')](function(_0x2c9d71){var _0xf984c6=_[_0xb128('0x2e')](_0x2c9d71,'id');var _0x8b219d=[];var _0x2c8f8a=[];var _0x2bd597=squel[_0xb128('0x70')]();_0x2bd597[_0xb128('0x71')](_0xb128('0x72'))[_0xb128('0x73')](_0xb128('0x74'),'tq')[_0xb128('0x75')](_0xb128('0x76'),'ut',_0xb128('0x77'))[_0xb128('0x3e')](_0xb128('0x78'),_0x6e8de6[_0xb128('0x47')]['id']);for(var _0x31040e=0x0;_0x31040e<_0x2c9d71[_0xb128('0x3a')];_0x31040e+=0x1){let _0x48c30a=_0x2c9d71[_0x31040e];for(var _0x4f3209=0x0;_0x4f3209<_0x48c30a[_0xb128('0x64')][_0xb128('0x3a')];_0x4f3209+=0x1){let _0x39732e=_0x48c30a[_0xb128('0x64')][_0x4f3209];var _0x5bd2c0=_0x2bd597[_0xb128('0x79')]();_0x5bd2c0['where'](_0xb128('0x7a'),_0x39732e['id']);_0x2c8f8a['push'](db[_0xb128('0x68')]['query'](_0x5bd2c0['toString'](),{'type':db[_0xb128('0x68')][_0xb128('0x7b')]['SELECT']})['then'](function(_0x617f9){if(_0x617f9[_0xb128('0x3a')]===0x1){return _0x39732e['id'];}else{var _0x117cdd=_[_0xb128('0x7c')](_[_0xb128('0x2e')](_0x617f9,_0xb128('0x7d')),function(_0x3f7ad0){return _[_0xb128('0x7e')](_0xf984c6,_0x3f7ad0);});if(_0x117cdd){return _0x39732e['id'];}}}));}}return BPromise[_0xb128('0x7f')](_0x2c8f8a)[_0xb128('0x26')](function(_0x3f3037){_0x8b219d=_(_0x8b219d)[_0xb128('0x80')](_0x3f3037)[_0xb128('0x81')]()[_0xb128('0x82')]();return db[_0xb128('0x41')][_0xb128('0x48')]({'where':{'id':_0x6e8de6[_0xb128('0x47')]['id']}})[_0xb128('0x26')](function(_0x476695){return db[_0xb128('0x68')][_0xb128('0x69')](function(_0x1a261a){return _0x476695[_0xb128('0x6f')](_0x6e8de6[_0xb128('0x34')]['ids'],{'transaction':_0x1a261a})[_0xb128('0x26')](function(){if(!_['isEmpty'](_0x8b219d)){return _0x476695[_0xb128('0x83')](_0x8b219d,{'transaction':_0x1a261a});}})['then'](function(){_0x8b219d[_0xb128('0x6c')](function(_0x494fb1){socket['emit'](_0xb128('0x84'),{'UserId':_0x494fb1,'WhatsappQueueId':_0x476695['id']});});});});});});})[_0xb128('0x26')](respondWithStatusCode(_0x5d6d1c,null))['catch'](handleError(_0x5d6d1c,null));};exports[_0xb128('0x85')]=function(_0x22cec1,_0x3276b4,_0x183b84){return db[_0xb128('0x41')][_0xb128('0x48')]({'where':{'id':_0x22cec1['params']['id']}})['then'](handleEntityNotFound(_0x3276b4,null))[_0xb128('0x26')](function(_0x16a94a){if(_0x16a94a){return _0x16a94a[_0xb128('0x85')](_0x22cec1[_0xb128('0x50')][_0xb128('0x63')],_[_0xb128('0x86')](_0x22cec1[_0xb128('0x50')],['ids','id'])||{})[_0xb128('0x87')](function(_0x583308){for(var _0x1c1f1d=0x0;_0x1c1f1d<_0x22cec1[_0xb128('0x50')][_0xb128('0x63')]['length'];_0x1c1f1d+=0x1){socket[_0xb128('0x6d')](_0xb128('0x6e'),{'UserId':Number(_0x22cec1[_0xb128('0x50')][_0xb128('0x63')][_0x1c1f1d]),'WhatsappQueueId':Number(_0x22cec1['params']['id'])});}return _0x583308;});}})[_0xb128('0x26')](respondWithResult(_0x3276b4,null))[_0xb128('0x45')](handleError(_0x3276b4,null));};exports[_0xb128('0x83')]=function(_0x596120,_0x4a78dd,_0xc44de3){return db['WhatsappQueue'][_0xb128('0x48')]({'where':{'id':_0x596120[_0xb128('0x47')]['id']}})[_0xb128('0x26')](handleEntityNotFound(_0x4a78dd,null))['then'](function(_0x51c74b){if(_0x51c74b){return _0x51c74b[_0xb128('0x83')](_0x596120[_0xb128('0x34')][_0xb128('0x63')])[_0xb128('0x26')](function(){if(_['isArray'](_0x596120[_0xb128('0x34')][_0xb128('0x63')])){for(var _0x54a8d4=0x0;_0x54a8d4<_0x596120[_0xb128('0x34')]['ids'][_0xb128('0x3a')];_0x54a8d4+=0x1){socket[_0xb128('0x6d')]('userWhatsappQueue:remove',{'UserId':Number(_0x596120[_0xb128('0x34')][_0xb128('0x63')][_0x54a8d4]),'WhatsappQueueId':Number(_0x596120[_0xb128('0x47')]['id'])});}}else{socket[_0xb128('0x6d')](_0xb128('0x84'),{'UserId':Number(_0x596120['query']['ids']),'WhatsappQueueId':Number(_0x596120[_0xb128('0x47')]['id'])});}});}})['then'](respondWithStatusCode(_0x4a78dd,null))[_0xb128('0x45')](handleError(_0x4a78dd,null));};exports[_0xb128('0x88')]=function(_0x52ebce,_0x1d30e8,_0x13040d){var _0xa11a8b={};var _0x2b5d21={};var _0x2c2b67;var _0x4d7f18;return db[_0xb128('0x41')][_0xb128('0x89')]({'where':{'id':_0x52ebce[_0xb128('0x47')]['id']}})[_0xb128('0x26')](handleEntityNotFound(_0x1d30e8,null))['then'](function(_0x12c1f8){if(_0x12c1f8){_0x2c2b67=_0x12c1f8;_0x2b5d21['model']=_[_0xb128('0x35')](db[_0xb128('0x56')][_0xb128('0x2f')]);_0x2b5d21[_0xb128('0x34')]=_[_0xb128('0x35')](_0x52ebce['query']);_0x2b5d21[_0xb128('0x36')]=_[_0xb128('0x37')](_0x2b5d21['model'],_0x2b5d21[_0xb128('0x34')]);_0xa11a8b[_0xb128('0x38')]=_[_0xb128('0x37')](_0x2b5d21[_0xb128('0x33')],qs['fields'](_0x52ebce[_0xb128('0x34')][_0xb128('0x39')]));_0xa11a8b[_0xb128('0x38')]=_0xa11a8b[_0xb128('0x38')][_0xb128('0x3a')]?_0xa11a8b['attributes']:_0x2b5d21[_0xb128('0x33')];_0xa11a8b[_0xb128('0x3c')]=qs[_0xb128('0x3d')](_0x52ebce['query'][_0xb128('0x3d')]);_0xa11a8b[_0xb128('0x3e')]=qs['filters'](_[_0xb128('0x8a')](_0x52ebce['query'],_0x2b5d21[_0xb128('0x36')]));if(_0x52ebce[_0xb128('0x34')][_0xb128('0x55')]){_0xa11a8b[_0xb128('0x3e')]=_[_0xb128('0x3f')](_0xa11a8b['where'],{'$or':_[_0xb128('0x2e')](_0xa11a8b[_0xb128('0x38')],function(_0x3221ea){var _0x4b9762={};_0x4b9762[_0x3221ea]={'$like':'%'+_0x52ebce[_0xb128('0x34')]['filter']+'%'};return _0x4b9762;})});}_0xa11a8b=_[_0xb128('0x3f')]({},_0xa11a8b,_0x52ebce['options']);return _0x2c2b67[_0xb128('0x88')](_0xa11a8b);}})[_0xb128('0x26')](function(_0x500af1){if(_0x500af1){_0x4d7f18=_0x500af1[_0xb128('0x3a')];if(!_0x52ebce[_0xb128('0x34')][_0xb128('0x3b')](_0xb128('0x61'))){_0xa11a8b['limit']=qs[_0xb128('0x20')](_0x52ebce[_0xb128('0x34')][_0xb128('0x20')]);_0xa11a8b[_0xb128('0x1e')]=qs[_0xb128('0x1e')](_0x52ebce['query'][_0xb128('0x1e')]);}return _0x2c2b67['getAgents'](_0xa11a8b);}})['then'](function(_0x159ba3){if(_0x159ba3){return _0x159ba3?{'count':_0x4d7f18,'rows':_0x159ba3}:null;}})[_0xb128('0x26')](respondWithResult(_0x1d30e8,null))['catch'](handleError(_0x1d30e8,null));}; \ No newline at end of file +var _0x5fc8=['map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','pick','filter','where','VIRTUAL','merge','options','WhatsappQueue','count','includeAll','rows','catch','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','WhatsappQueueId','UserWhatsappQueue','findAll','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','format','%s/%s','SIP','getTeams','Team','sort','addTeams','ids','Agents','voicePause','interface','sequelize','each','findOrCreate','emit','removeTeams','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','TeamId','includes','all','union','compact','value','transaction','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','update','get','WhatsappQueues','destroy','then','error','stack','name','send','index'];(function(_0x2438e1,_0x59849b){var _0x4a3983=function(_0x19d5e7){while(--_0x19d5e7){_0x2438e1['push'](_0x2438e1['shift']());}};_0x4a3983(++_0x59849b);}(_0x5fc8,0x169));var _0x85fc=function(_0x164e63,_0xb096eb){_0x164e63=_0x164e63-0x0;var _0x3e5411=_0x5fc8[_0x164e63];return _0x3e5411;};'use strict';var emlformat=require(_0x85fc('0x0'));var rimraf=require(_0x85fc('0x1'));var zipdir=require(_0x85fc('0x2'));var jsonpatch=require(_0x85fc('0x3'));var rp=require(_0x85fc('0x4'));var moment=require('moment');var BPromise=require(_0x85fc('0x5'));var Mustache=require('mustache');var util=require(_0x85fc('0x6'));var path=require(_0x85fc('0x7'));var sox=require(_0x85fc('0x8'));var csv=require(_0x85fc('0x9'));var ejs=require(_0x85fc('0xa'));var fs=require('fs');var fs_extra=require(_0x85fc('0xb'));var _=require(_0x85fc('0xc'));var squel=require(_0x85fc('0xd'));var crypto=require('crypto');var jsforce=require(_0x85fc('0xe'));var deskjs=require(_0x85fc('0xf'));var toCsv=require(_0x85fc('0x9'));var querystring=require(_0x85fc('0x10'));var Papa=require(_0x85fc('0x11'));var Redis=require('ioredis');var authService=require(_0x85fc('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x85fc('0x13'));var hardwareService=require(_0x85fc('0x14'));var logger=require(_0x85fc('0x15'))('api');var utils=require(_0x85fc('0x16'));var config=require(_0x85fc('0x17'));var licenseUtil=require(_0x85fc('0x18'));var db=require('../../mysqldb')['db'];config[_0x85fc('0x19')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x85fc('0x1a'))(new Redis(config[_0x85fc('0x19')]));require(_0x85fc('0x1b'))[_0x85fc('0x1c')](socket);function respondWithStatusCode(_0x12cd4f,_0x473b60){_0x473b60=_0x473b60||0xcc;return function(_0x49128d){if(_0x49128d){return _0x12cd4f[_0x85fc('0x1d')](_0x473b60);}return _0x12cd4f[_0x85fc('0x1e')](_0x473b60)[_0x85fc('0x1f')]();};}function respondWithResult(_0x4f51bc,_0x1f4619){_0x1f4619=_0x1f4619||0xc8;return function(_0x21453e){if(_0x21453e){return _0x4f51bc[_0x85fc('0x1e')](_0x1f4619)[_0x85fc('0x20')](_0x21453e);}};}function respondWithFilteredResult(_0x257ad0,_0x2335a3){return function(_0x5216a0){if(_0x5216a0){var _0x58bb6b=typeof _0x2335a3[_0x85fc('0x21')]===_0x85fc('0x22')&&typeof _0x2335a3[_0x85fc('0x23')]===_0x85fc('0x22');var _0x165385=_0x5216a0['count'];var _0x6b2c27=_0x58bb6b?0x0:_0x2335a3[_0x85fc('0x21')];var _0x233457=_0x58bb6b?_0x5216a0['count']:_0x2335a3['offset']+_0x2335a3['limit'];var _0x3d005c;if(_0x233457>=_0x165385){_0x233457=_0x165385;_0x3d005c=0xc8;}else{_0x3d005c=0xce;}_0x257ad0['status'](_0x3d005c);return _0x257ad0[_0x85fc('0x24')]('Content-Range',_0x6b2c27+'-'+_0x233457+'/'+_0x165385)['json'](_0x5216a0);}return null;};}function patchUpdates(_0x3ecfdc){return function(_0x3f97ac){try{jsonpatch[_0x85fc('0x25')](_0x3f97ac,_0x3ecfdc,!![]);}catch(_0x1ac131){return BPromise[_0x85fc('0x26')](_0x1ac131);}return _0x3f97ac[_0x85fc('0x27')]();};}function saveUpdates(_0x17a955,_0x453962){return function(_0x3ded27){if(_0x3ded27){return _0x3ded27[_0x85fc('0x28')](_0x17a955)['then'](function(_0x5893a0){return _0x5893a0;});}return null;};}function removeEntity(_0xc4de0d,_0x13cc1e){return function(_0x29ce48){if(_0x29ce48){return _0x29ce48['destroy']()['then'](function(){var _0x45959b=_0x29ce48[_0x85fc('0x29')]({'plain':!![]});var _0x573c3c=_0x85fc('0x2a');return db['UserProfileResource'][_0x85fc('0x2b')]({'where':{'type':_0x573c3c,'resourceId':_0x45959b['id']}})['then'](function(){return _0x29ce48;});})[_0x85fc('0x2c')](function(){_0xc4de0d[_0x85fc('0x1e')](0xcc)[_0x85fc('0x1f')]();});}};}function handleEntityNotFound(_0x459b47,_0x21e116){return function(_0x4d3eb2){if(!_0x4d3eb2){_0x459b47[_0x85fc('0x1d')](0x194);}return _0x4d3eb2;};}function handleError(_0x48daf9,_0x5eb194){_0x5eb194=_0x5eb194||0x1f4;return function(_0x407237){logger[_0x85fc('0x2d')](_0x407237[_0x85fc('0x2e')]);if(_0x407237[_0x85fc('0x2f')]){delete _0x407237[_0x85fc('0x2f')];}_0x48daf9[_0x85fc('0x1e')](_0x5eb194)[_0x85fc('0x30')](_0x407237);};}exports[_0x85fc('0x31')]=function(_0x1bc114,_0x50f8b6){var _0x54f5fc={},_0x24cd5f={},_0x24014c={'count':0x0,'rows':[]};var _0x376086=_[_0x85fc('0x32')](db['WhatsappQueue'][_0x85fc('0x33')],function(_0xde8f6b){return{'name':_0xde8f6b[_0x85fc('0x34')],'type':_0xde8f6b[_0x85fc('0x35')]['key']};});_0x24cd5f[_0x85fc('0x36')]=_[_0x85fc('0x32')](_0x376086,'name');_0x24cd5f[_0x85fc('0x37')]=_[_0x85fc('0x38')](_0x1bc114['query']);_0x24cd5f[_0x85fc('0x39')]=_['intersection'](_0x24cd5f[_0x85fc('0x36')],_0x24cd5f[_0x85fc('0x37')]);_0x54f5fc['attributes']=_[_0x85fc('0x3a')](_0x24cd5f[_0x85fc('0x36')],qs[_0x85fc('0x3b')](_0x1bc114[_0x85fc('0x37')][_0x85fc('0x3b')]));_0x54f5fc[_0x85fc('0x3c')]=_0x54f5fc[_0x85fc('0x3c')][_0x85fc('0x3d')]?_0x54f5fc[_0x85fc('0x3c')]:_0x24cd5f[_0x85fc('0x36')];if(!_0x1bc114['query'][_0x85fc('0x3e')](_0x85fc('0x3f'))){_0x54f5fc['limit']=qs[_0x85fc('0x23')](_0x1bc114[_0x85fc('0x37')][_0x85fc('0x23')]);_0x54f5fc[_0x85fc('0x21')]=qs[_0x85fc('0x21')](_0x1bc114[_0x85fc('0x37')]['offset']);}_0x54f5fc[_0x85fc('0x40')]=qs['sort'](_0x1bc114[_0x85fc('0x37')]['sort']);_0x54f5fc['where']=qs[_0x85fc('0x39')](_[_0x85fc('0x41')](_0x1bc114[_0x85fc('0x37')],_0x24cd5f[_0x85fc('0x39')]),_0x376086);if(_0x1bc114[_0x85fc('0x37')][_0x85fc('0x42')]){_0x54f5fc[_0x85fc('0x43')]=_['merge'](_0x54f5fc[_0x85fc('0x43')],{'$or':_[_0x85fc('0x32')](_0x376086,function(_0x2cfd36){if(_0x2cfd36[_0x85fc('0x35')]!==_0x85fc('0x44')){var _0x857648={};_0x857648[_0x2cfd36[_0x85fc('0x2f')]]={'$like':'%'+_0x1bc114['query'][_0x85fc('0x42')]+'%'};return _0x857648;}})});}_0x54f5fc=_[_0x85fc('0x45')]({},_0x54f5fc,_0x1bc114[_0x85fc('0x46')]);var _0x5316fb={'where':_0x54f5fc[_0x85fc('0x43')]};return db[_0x85fc('0x47')]['count'](_0x5316fb)[_0x85fc('0x2c')](function(_0x5c4a2e){_0x24014c[_0x85fc('0x48')]=_0x5c4a2e;if(_0x1bc114['query'][_0x85fc('0x49')]){_0x54f5fc['include']=[{'all':!![]}];}return db['WhatsappQueue']['findAll'](_0x54f5fc);})['then'](function(_0x12ee30){_0x24014c[_0x85fc('0x4a')]=_0x12ee30;return _0x24014c;})[_0x85fc('0x2c')](respondWithFilteredResult(_0x50f8b6,_0x54f5fc))[_0x85fc('0x4b')](handleError(_0x50f8b6,null));};exports['show']=function(_0x220d06,_0x1f9af6){var _0x47d924={'raw':!![],'where':{'id':_0x220d06['params']['id']}},_0x1afbc1={};_0x1afbc1[_0x85fc('0x36')]=_[_0x85fc('0x38')](db['WhatsappQueue'][_0x85fc('0x33')]);_0x1afbc1[_0x85fc('0x37')]=_['keys'](_0x220d06[_0x85fc('0x37')]);_0x1afbc1[_0x85fc('0x39')]=_[_0x85fc('0x3a')](_0x1afbc1[_0x85fc('0x36')],_0x1afbc1['query']);_0x47d924[_0x85fc('0x3c')]=_[_0x85fc('0x3a')](_0x1afbc1['model'],qs[_0x85fc('0x3b')](_0x220d06[_0x85fc('0x37')][_0x85fc('0x3b')]));_0x47d924[_0x85fc('0x3c')]=_0x47d924[_0x85fc('0x3c')][_0x85fc('0x3d')]?_0x47d924[_0x85fc('0x3c')]:_0x1afbc1['model'];if(_0x220d06['query'][_0x85fc('0x49')]){_0x47d924[_0x85fc('0x4c')]=[{'all':!![]}];}_0x47d924=_[_0x85fc('0x45')]({},_0x47d924,_0x220d06[_0x85fc('0x46')]);return db[_0x85fc('0x47')][_0x85fc('0x4d')](_0x47d924)[_0x85fc('0x2c')](handleEntityNotFound(_0x1f9af6,null))[_0x85fc('0x2c')](respondWithResult(_0x1f9af6,null))[_0x85fc('0x4b')](handleError(_0x1f9af6,null));};exports[_0x85fc('0x4e')]=function(_0x522742,_0x599bdd){return db[_0x85fc('0x47')][_0x85fc('0x4e')](_0x522742[_0x85fc('0x4f')],{})[_0x85fc('0x2c')](function(_0x4dec96){var _0x2e3c0a=_0x522742[_0x85fc('0x50')][_0x85fc('0x29')]({'plain':!![]});if(!_0x2e3c0a)throw new Error(_0x85fc('0x51'));if(_0x2e3c0a[_0x85fc('0x52')]===_0x85fc('0x50')){var _0x209931=_0x4dec96[_0x85fc('0x29')]({'plain':!![]});var _0x598bd4=_0x85fc('0x2a');return db['UserProfileSection'][_0x85fc('0x4d')]({'where':{'name':_0x598bd4,'userProfileId':_0x2e3c0a[_0x85fc('0x53')]},'raw':!![]})[_0x85fc('0x2c')](function(_0x26cccd){if(_0x26cccd&&_0x26cccd[_0x85fc('0x54')]===0x0){return db[_0x85fc('0x55')][_0x85fc('0x4e')]({'name':_0x209931[_0x85fc('0x2f')],'resourceId':_0x209931['id'],'type':_0x26cccd[_0x85fc('0x2f')],'sectionId':_0x26cccd['id']},{})[_0x85fc('0x2c')](function(){return _0x4dec96;});}else{return _0x4dec96;}})[_0x85fc('0x4b')](function(_0x404af6){logger[_0x85fc('0x2d')](_0x85fc('0x56'),_0x404af6);throw _0x404af6;});}return _0x4dec96;})['then'](respondWithResult(_0x599bdd,0xc9))['catch'](handleError(_0x599bdd,null));};exports[_0x85fc('0x28')]=function(_0x46aaf9,_0x2d5be8){if(_0x46aaf9['body']['id']){delete _0x46aaf9[_0x85fc('0x4f')]['id'];}return db[_0x85fc('0x47')]['find']({'where':{'id':_0x46aaf9[_0x85fc('0x57')]['id']}})[_0x85fc('0x2c')](handleEntityNotFound(_0x2d5be8,null))[_0x85fc('0x2c')](saveUpdates(_0x46aaf9[_0x85fc('0x4f')],null))['then'](respondWithResult(_0x2d5be8,null))['catch'](handleError(_0x2d5be8,null));};exports['destroy']=function(_0x40f63d,_0x109258){return db[_0x85fc('0x47')]['find']({'where':{'id':_0x40f63d['params']['id']}})[_0x85fc('0x2c')](handleEntityNotFound(_0x109258,null))[_0x85fc('0x2c')](removeEntity(_0x109258,null))[_0x85fc('0x4b')](handleError(_0x109258,null));};exports['describe']=function(_0x75d2a9,_0x456915){return db[_0x85fc('0x47')][_0x85fc('0x58')]()['then'](respondWithResult(_0x456915,null))['catch'](handleError(_0x456915,null));};exports[_0x85fc('0x59')]=function(_0x157566,_0x5c296d,_0x5643bc){var _0x5219e2={'raw':!![],'where':{}},_0x4d0568={},_0x3c335d;return db['WhatsappQueue'][_0x85fc('0x5a')]({'where':{'id':_0x157566['params']['id']}})['then'](handleEntityNotFound(_0x5c296d,null))[_0x85fc('0x2c')](function(_0x2a690b){if(_0x2a690b){_0x3c335d=_0x2a690b[_0x85fc('0x29')]({'plain':!![]});_0x4d0568[_0x85fc('0x36')]=_[_0x85fc('0x38')](db['UserWhatsappQueue'][_0x85fc('0x33')]);_0x4d0568['query']=_[_0x85fc('0x38')](_0x157566[_0x85fc('0x37')]);_0x4d0568[_0x85fc('0x39')]=_[_0x85fc('0x3a')](_0x4d0568[_0x85fc('0x36')],_0x4d0568['query']);_0x5219e2[_0x85fc('0x3c')]=_[_0x85fc('0x3a')](_0x4d0568['model'],qs['fields'](_0x157566[_0x85fc('0x37')][_0x85fc('0x3b')]));_0x5219e2[_0x85fc('0x3c')]=_0x5219e2[_0x85fc('0x3c')]['length']?_0x5219e2[_0x85fc('0x3c')]:_0x4d0568['model'];if(!_0x157566[_0x85fc('0x37')][_0x85fc('0x3e')](_0x85fc('0x3f'))){_0x5219e2[_0x85fc('0x23')]=qs['limit'](_0x157566[_0x85fc('0x37')][_0x85fc('0x23')]);_0x5219e2[_0x85fc('0x21')]=qs[_0x85fc('0x21')](_0x157566[_0x85fc('0x37')][_0x85fc('0x21')]);}_0x5219e2['order']=qs['sort'](_0x157566['query']['sort']);_0x5219e2[_0x85fc('0x43')]=qs[_0x85fc('0x39')](_[_0x85fc('0x41')](_0x157566[_0x85fc('0x37')],_0x4d0568[_0x85fc('0x39')]));_0x5219e2[_0x85fc('0x43')][_0x85fc('0x5b')]=_0x2a690b['id'];if(_0x157566[_0x85fc('0x37')][_0x85fc('0x42')]){_0x5219e2['where']=_['merge'](_0x5219e2[_0x85fc('0x43')],{'$or':_['map'](_0x5219e2[_0x85fc('0x3c')],function(_0x3410bb){var _0x12b249={};_0x12b249[_0x3410bb]={'$like':'%'+_0x157566[_0x85fc('0x37')][_0x85fc('0x42')]+'%'};return _0x12b249;})});}_0x5219e2=_[_0x85fc('0x45')]({},_0x5219e2,_0x157566['options']);return db[_0x85fc('0x5c')][_0x85fc('0x5d')](_0x5219e2);}})[_0x85fc('0x2c')](function(_0x1ddf47){if(_0x1ddf47){return db[_0x85fc('0x5e')][_0x85fc('0x5f')]({'where':{'id':_[_0x85fc('0x32')](_0x1ddf47,_0x85fc('0x60')),'role':_0x85fc('0x61')},'attributes':['id',_0x85fc('0x2f'),_0x85fc('0x62'),_0x85fc('0x63'),'createdAt']});}})[_0x85fc('0x2c')](function(_0x3860bb){if(_0x3860bb){return{'count':_0x3860bb[_0x85fc('0x48')],'rows':_[_0x85fc('0x32')](_0x3860bb['rows'],function(_0x4677e3){return{'membername':_0x4677e3['name'],'UserId':_0x4677e3['id'],'queue_name':_0x3c335d[_0x85fc('0x2f')],'WhatsappQueueId':_0x3c335d['id'],'interface':util[_0x85fc('0x64')](_0x85fc('0x65'),_0x85fc('0x66'),_0x4677e3[_0x85fc('0x2f')]),'penalty':0x0,'paused':_0x4677e3[_0x85fc('0x62')],'createdAt':_0x4677e3['createdAt'],'updatedAt':_0x4677e3[_0x85fc('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x85fc('0x2c')](respondWithFilteredResult(_0x5c296d,_0x5219e2))[_0x85fc('0x4b')](handleError(_0x5c296d,null));};exports[_0x85fc('0x67')]=function(_0x34868c,_0x45188c,_0x5a62a3){var _0x1cb69d={};var _0x4c36ad={};var _0x26d90b;var _0xe275f5;return db[_0x85fc('0x47')]['findOne']({'where':{'id':_0x34868c[_0x85fc('0x57')]['id']}})['then'](handleEntityNotFound(_0x45188c,null))[_0x85fc('0x2c')](function(_0x52aecb){if(_0x52aecb){_0x26d90b=_0x52aecb;_0x4c36ad['model']=_['keys'](db[_0x85fc('0x68')][_0x85fc('0x33')]);_0x4c36ad[_0x85fc('0x37')]=_[_0x85fc('0x38')](_0x34868c[_0x85fc('0x37')]);_0x4c36ad[_0x85fc('0x39')]=_['intersection'](_0x4c36ad[_0x85fc('0x36')],_0x4c36ad[_0x85fc('0x37')]);_0x1cb69d[_0x85fc('0x3c')]=_[_0x85fc('0x3a')](_0x4c36ad['model'],qs[_0x85fc('0x3b')](_0x34868c[_0x85fc('0x37')][_0x85fc('0x3b')]));_0x1cb69d['attributes']=_0x1cb69d[_0x85fc('0x3c')][_0x85fc('0x3d')]?_0x1cb69d[_0x85fc('0x3c')]:_0x4c36ad[_0x85fc('0x36')];_0x1cb69d[_0x85fc('0x40')]=qs['sort'](_0x34868c[_0x85fc('0x37')][_0x85fc('0x69')]);_0x1cb69d[_0x85fc('0x43')]=qs[_0x85fc('0x39')](_[_0x85fc('0x41')](_0x34868c[_0x85fc('0x37')],_0x4c36ad[_0x85fc('0x39')]));if(_0x34868c['query'][_0x85fc('0x42')]){_0x1cb69d[_0x85fc('0x43')]=_['merge'](_0x1cb69d[_0x85fc('0x43')],{'$or':_[_0x85fc('0x32')](_0x1cb69d['attributes'],function(_0x134e25){var _0x471ca0={};_0x471ca0[_0x134e25]={'$like':'%'+_0x34868c[_0x85fc('0x37')][_0x85fc('0x42')]+'%'};return _0x471ca0;})});}_0x1cb69d=_[_0x85fc('0x45')]({},_0x1cb69d,_0x34868c[_0x85fc('0x46')]);return _0x26d90b[_0x85fc('0x67')](_0x1cb69d);}})[_0x85fc('0x2c')](function(_0x7f2da2){if(_0x7f2da2){_0xe275f5=_0x7f2da2['length'];if(!_0x34868c[_0x85fc('0x37')][_0x85fc('0x3e')]('nolimit')){_0x1cb69d[_0x85fc('0x23')]=qs[_0x85fc('0x23')](_0x34868c[_0x85fc('0x37')][_0x85fc('0x23')]);_0x1cb69d[_0x85fc('0x21')]=qs[_0x85fc('0x21')](_0x34868c['query'][_0x85fc('0x21')]);}return _0x26d90b[_0x85fc('0x67')](_0x1cb69d);}})[_0x85fc('0x2c')](function(_0x27d5b7){if(_0x27d5b7){return _0x27d5b7?{'count':_0xe275f5,'rows':_0x27d5b7}:null;}})['then'](respondWithResult(_0x45188c,null))['catch'](handleError(_0x45188c,null));};exports[_0x85fc('0x6a')]=function(_0x361061,_0x51d945,_0x19223f){var _0x3e4855=_0x361061[_0x85fc('0x4f')][_0x85fc('0x6b')];return db[_0x85fc('0x68')][_0x85fc('0x5d')]({'where':{'id':_0x3e4855},'attributes':['id'],'include':[{'model':db['User'],'as':_0x85fc('0x6c'),'attributes':['id','name','online',_0x85fc('0x6d'),_0x85fc('0x6e')],'raw':!![]}]})[_0x85fc('0x2c')](function(_0x12f47e){if(_0x12f47e){var _0x5920b1=_['flatMap'](_0x12f47e,function(_0x423604){var _0x2d314c=_0x423604['get']({'plain':!![]});return _0x2d314c[_0x85fc('0x6c')];});return db[_0x85fc('0x47')]['find']({'where':{'id':_0x361061[_0x85fc('0x57')]['id']}})[_0x85fc('0x2c')](function(_0x482f09){return db[_0x85fc('0x6f')]['transaction'](function(_0x3241b2){return _0x482f09[_0x85fc('0x6a')](_0x3e4855,{'transaction':_0x3241b2})[_0x85fc('0x2c')](function(){return BPromise[_0x85fc('0x70')](_0x5920b1,function(_0x522502){return db[_0x85fc('0x5c')][_0x85fc('0x71')]({'where':{'UserId':_0x522502['id'],'WhatsappQueueId':_0x361061[_0x85fc('0x57')]['id']},'transaction':_0x3241b2});});})[_0x85fc('0x2c')](function(){_0x5920b1['forEach'](function(_0x57e3e5){socket[_0x85fc('0x72')]('userWhatsappQueue:save',{'UserId':_0x57e3e5['id'],'WhatsappQueueId':_0x482f09['id']});});});});});}})[_0x85fc('0x2c')](respondWithStatusCode(_0x51d945,null))[_0x85fc('0x4b')](handleError(_0x51d945,null));};exports[_0x85fc('0x73')]=function(_0x49eb80,_0x1ae36d,_0x236d6f){return db['Team'][_0x85fc('0x5d')]({'where':{'id':_0x49eb80[_0x85fc('0x37')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x85fc('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x85fc('0x2c')](handleEntityNotFound(_0x1ae36d,null))[_0x85fc('0x2c')](function(_0x42ec29){var _0x5173d2=_['map'](_0x42ec29,'id');var _0x12385e=[];var _0x23a738=[];var _0xdd10f5=squel['select']();_0xdd10f5[_0x85fc('0x74')](_0x85fc('0x75'))[_0x85fc('0x76')]('team_has_whatsapp_queues','tq')['join'](_0x85fc('0x77'),'ut',_0x85fc('0x78'))[_0x85fc('0x43')]('WhatsappQueueId\x20=\x20?',_0x49eb80[_0x85fc('0x57')]['id']);for(var _0x3151cc=0x0;_0x3151cc<_0x42ec29['length'];_0x3151cc+=0x1){let _0x59c516=_0x42ec29[_0x3151cc];for(var _0x38e186=0x0;_0x38e186<_0x59c516[_0x85fc('0x6c')][_0x85fc('0x3d')];_0x38e186+=0x1){let _0x25327f=_0x59c516['Agents'][_0x38e186];var _0x28424c=_0xdd10f5['clone']();_0x28424c[_0x85fc('0x43')](_0x85fc('0x79'),_0x25327f['id']);_0x23a738[_0x85fc('0x7a')](db[_0x85fc('0x6f')][_0x85fc('0x37')](_0x28424c['toString'](),{'type':db[_0x85fc('0x6f')]['QueryTypes']['SELECT']})[_0x85fc('0x2c')](function(_0x21796a){if(_0x21796a[_0x85fc('0x3d')]===0x1){return _0x25327f['id'];}else{var _0x364ce9=_['every'](_[_0x85fc('0x32')](_0x21796a,_0x85fc('0x7b')),function(_0x3cdd93){return _[_0x85fc('0x7c')](_0x5173d2,_0x3cdd93);});if(_0x364ce9){return _0x25327f['id'];}}}));}}return BPromise[_0x85fc('0x7d')](_0x23a738)[_0x85fc('0x2c')](function(_0xbf69db){_0x12385e=_(_0x12385e)[_0x85fc('0x7e')](_0xbf69db)[_0x85fc('0x7f')]()[_0x85fc('0x80')]();return db[_0x85fc('0x47')][_0x85fc('0x4d')]({'where':{'id':_0x49eb80[_0x85fc('0x57')]['id']}})[_0x85fc('0x2c')](function(_0x1bf774){return db[_0x85fc('0x6f')][_0x85fc('0x81')](function(_0x12a671){return _0x1bf774['removeTeams'](_0x49eb80['query'][_0x85fc('0x6b')],{'transaction':_0x12a671})[_0x85fc('0x2c')](function(){if(!_['isEmpty'](_0x12385e)){return _0x1bf774[_0x85fc('0x82')](_0x12385e,{'transaction':_0x12a671});}})[_0x85fc('0x2c')](function(){_0x12385e[_0x85fc('0x83')](function(_0x3dd9cb){socket[_0x85fc('0x72')](_0x85fc('0x84'),{'UserId':_0x3dd9cb,'WhatsappQueueId':_0x1bf774['id']});});});});});});})['then'](respondWithStatusCode(_0x1ae36d,null))[_0x85fc('0x4b')](handleError(_0x1ae36d,null));};exports[_0x85fc('0x85')]=function(_0x2e3214,_0x284b22,_0x5a44cb){return db[_0x85fc('0x47')][_0x85fc('0x4d')]({'where':{'id':_0x2e3214[_0x85fc('0x57')]['id']}})[_0x85fc('0x2c')](handleEntityNotFound(_0x284b22,null))['then'](function(_0x5a66b0){if(_0x5a66b0){return _0x5a66b0[_0x85fc('0x85')](_0x2e3214['body'][_0x85fc('0x6b')],_[_0x85fc('0x86')](_0x2e3214[_0x85fc('0x4f')],[_0x85fc('0x6b'),'id'])||{})['spread'](function(_0x59424){for(var _0x2fa414=0x0;_0x2fa414<_0x2e3214[_0x85fc('0x4f')][_0x85fc('0x6b')]['length'];_0x2fa414+=0x1){socket[_0x85fc('0x72')]('userWhatsappQueue:save',{'UserId':Number(_0x2e3214[_0x85fc('0x4f')][_0x85fc('0x6b')][_0x2fa414]),'WhatsappQueueId':Number(_0x2e3214[_0x85fc('0x57')]['id'])});}return _0x59424;});}})[_0x85fc('0x2c')](respondWithResult(_0x284b22,null))[_0x85fc('0x4b')](handleError(_0x284b22,null));};exports[_0x85fc('0x82')]=function(_0x1bad3f,_0x3692e5,_0x3976e4){return db[_0x85fc('0x47')][_0x85fc('0x4d')]({'where':{'id':_0x1bad3f[_0x85fc('0x57')]['id']}})['then'](handleEntityNotFound(_0x3692e5,null))[_0x85fc('0x2c')](function(_0x3028d1){if(_0x3028d1){return _0x3028d1[_0x85fc('0x82')](_0x1bad3f[_0x85fc('0x37')][_0x85fc('0x6b')])[_0x85fc('0x2c')](function(){if(_[_0x85fc('0x87')](_0x1bad3f[_0x85fc('0x37')]['ids'])){for(var _0x40e619=0x0;_0x40e619<_0x1bad3f[_0x85fc('0x37')]['ids'][_0x85fc('0x3d')];_0x40e619+=0x1){socket[_0x85fc('0x72')]('userWhatsappQueue:remove',{'UserId':Number(_0x1bad3f[_0x85fc('0x37')][_0x85fc('0x6b')][_0x40e619]),'WhatsappQueueId':Number(_0x1bad3f[_0x85fc('0x57')]['id'])});}}else{socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x1bad3f[_0x85fc('0x37')][_0x85fc('0x6b')]),'WhatsappQueueId':Number(_0x1bad3f[_0x85fc('0x57')]['id'])});}});}})[_0x85fc('0x2c')](respondWithStatusCode(_0x3692e5,null))[_0x85fc('0x4b')](handleError(_0x3692e5,null));};exports[_0x85fc('0x88')]=function(_0x430944,_0x21f5c3,_0x366e16){var _0x40a4cd={};var _0x10eae1={};var _0x39e862;var _0x206474;return db[_0x85fc('0x47')]['findOne']({'where':{'id':_0x430944[_0x85fc('0x57')]['id']}})['then'](handleEntityNotFound(_0x21f5c3,null))[_0x85fc('0x2c')](function(_0x563778){if(_0x563778){_0x39e862=_0x563778;_0x10eae1[_0x85fc('0x36')]=_[_0x85fc('0x38')](db[_0x85fc('0x5e')][_0x85fc('0x33')]);_0x10eae1[_0x85fc('0x37')]=_[_0x85fc('0x38')](_0x430944[_0x85fc('0x37')]);_0x10eae1[_0x85fc('0x39')]=_[_0x85fc('0x3a')](_0x10eae1[_0x85fc('0x36')],_0x10eae1['query']);_0x40a4cd[_0x85fc('0x3c')]=_[_0x85fc('0x3a')](_0x10eae1[_0x85fc('0x36')],qs[_0x85fc('0x3b')](_0x430944[_0x85fc('0x37')][_0x85fc('0x3b')]));_0x40a4cd['attributes']=_0x40a4cd[_0x85fc('0x3c')]['length']?_0x40a4cd[_0x85fc('0x3c')]:_0x10eae1[_0x85fc('0x36')];_0x40a4cd['order']=qs['sort'](_0x430944[_0x85fc('0x37')][_0x85fc('0x69')]);_0x40a4cd['where']=qs[_0x85fc('0x39')](_[_0x85fc('0x41')](_0x430944['query'],_0x10eae1[_0x85fc('0x39')]));if(_0x430944['query'][_0x85fc('0x42')]){_0x40a4cd[_0x85fc('0x43')]=_['merge'](_0x40a4cd[_0x85fc('0x43')],{'$or':_['map'](_0x40a4cd[_0x85fc('0x3c')],function(_0x14051f){var _0x342784={};_0x342784[_0x14051f]={'$like':'%'+_0x430944['query'][_0x85fc('0x42')]+'%'};return _0x342784;})});}_0x40a4cd=_['merge']({},_0x40a4cd,_0x430944[_0x85fc('0x46')]);return _0x39e862[_0x85fc('0x88')](_0x40a4cd);}})[_0x85fc('0x2c')](function(_0x3afb69){if(_0x3afb69){_0x206474=_0x3afb69['length'];if(!_0x430944[_0x85fc('0x37')][_0x85fc('0x3e')](_0x85fc('0x3f'))){_0x40a4cd[_0x85fc('0x23')]=qs[_0x85fc('0x23')](_0x430944[_0x85fc('0x37')][_0x85fc('0x23')]);_0x40a4cd[_0x85fc('0x21')]=qs[_0x85fc('0x21')](_0x430944['query'][_0x85fc('0x21')]);}return _0x39e862[_0x85fc('0x88')](_0x40a4cd);}})[_0x85fc('0x2c')](function(_0x3b6c9a){if(_0x3b6c9a){return _0x3b6c9a?{'count':_0x206474,'rows':_0x3b6c9a}:null;}})[_0x85fc('0x2c')](respondWithResult(_0x21f5c3,null))['catch'](handleError(_0x21f5c3,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 01d1305..2a7f7f9 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 _0xe75a=['setMaxListeners','save','emit','exports','events','../../mysqldb'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xe75a,0x12a));var _0xae75=function(_0x28edda,_0xbd447a){_0x28edda=_0x28edda-0x0;var _0x21f4a4=_0xe75a[_0x28edda];return _0x21f4a4;};'use strict';var EventEmitter=require(_0xae75('0x0'));var WhatsappQueue=require(_0xae75('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xae75('0x2')](0x0);var events={'afterCreate':_0xae75('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1d8629){return function(_0x130b25,_0x4c1f83,_0x3b766c){WhatsappQueueEvents[_0xae75('0x4')](_0x1d8629+':'+_0x130b25['id'],_0x130b25);WhatsappQueueEvents[_0xae75('0x4')](_0x1d8629,_0x130b25);_0x3b766c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0xae75('0x5')]=WhatsappQueueEvents; \ No newline at end of file +var _0xdc1c=['hook','exports','../../mysqldb','save','update','remove','emit'];(function(_0x2cc594,_0x4d727b){var _0x4abff7=function(_0x22b01d){while(--_0x22b01d){_0x2cc594['push'](_0x2cc594['shift']());}};_0x4abff7(++_0x4d727b);}(_0xdc1c,0x160));var _0xcdc1=function(_0x21459c,_0x5cab60){_0x21459c=_0x21459c-0x0;var _0x850934=_0xdc1c[_0x21459c];return _0x850934;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xcdc1('0x0'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcdc1('0x1'),'afterUpdate':_0xcdc1('0x2'),'afterDestroy':_0xcdc1('0x3')};function emitEvent(_0x7ae946){return function(_0x333578,_0x2fffbc,_0x5f5548){WhatsappQueueEvents[_0xcdc1('0x4')](_0x7ae946+':'+_0x333578['id'],_0x333578);WhatsappQueueEvents[_0xcdc1('0x4')](_0x7ae946,_0x333578);_0x5f5548(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xcdc1('0x5')](e,emitEvent(event));}}module[_0xcdc1('0x6')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 4f66c51..9cd276e 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 _0xac62=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue'];(function(_0x3ff109,_0x2102dd){var _0x14b72f=function(_0x350fb2){while(--_0x350fb2){_0x3ff109['push'](_0x3ff109['shift']());}};_0x14b72f(++_0x2102dd);}(_0xac62,0x193));var _0x2ac6=function(_0xd62e7a,_0xac4f19){_0xd62e7a=_0xd62e7a-0x0;var _0x1bf0c8=_0xac62[_0xd62e7a];return _0x1bf0c8;};'use strict';var _=require(_0x2ac6('0x0'));var util=require(_0x2ac6('0x1'));var logger=require('../../config/logger')(_0x2ac6('0x2'));var moment=require(_0x2ac6('0x3'));var BPromise=require(_0x2ac6('0x4'));var rp=require(_0x2ac6('0x5'));var fs=require('fs');var path=require(_0x2ac6('0x6'));var rimraf=require(_0x2ac6('0x7'));var config=require(_0x2ac6('0x8'));var attributes=require(_0x2ac6('0x9'));module[_0x2ac6('0xa')]=function(_0x431c46,_0x15001e){return _0x431c46[_0x2ac6('0xb')](_0x2ac6('0xc'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e04=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','WhatsappQueue','whatsapp_queues','lodash'];(function(_0x509b99,_0x3ff1f0){var _0x383d46=function(_0x5cfcab){while(--_0x5cfcab){_0x509b99['push'](_0x509b99['shift']());}};_0x383d46(++_0x3ff1f0);}(_0x4e04,0x1b9));var _0x44e0=function(_0x126fb9,_0x122c59){_0x126fb9=_0x126fb9-0x0;var _0xc8a3b1=_0x4e04[_0x126fb9];return _0xc8a3b1;};'use strict';var _=require(_0x44e0('0x0'));var util=require(_0x44e0('0x1'));var logger=require(_0x44e0('0x2'))(_0x44e0('0x3'));var moment=require('moment');var BPromise=require(_0x44e0('0x4'));var rp=require(_0x44e0('0x5'));var fs=require('fs');var path=require(_0x44e0('0x6'));var rimraf=require(_0x44e0('0x7'));var config=require(_0x44e0('0x8'));var attributes=require(_0x44e0('0x9'));module[_0x44e0('0xa')]=function(_0x3e57cb,_0x55069e){return _0x3e57cb['define'](_0x44e0('0xb'),attributes,{'tableName':_0x44e0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index d89b193..b796fc6 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 _0x0b21=['message','info','result','catch','WhatsappQueue','findAll','options','raw','attributes','include','model','map','GetWhatsappQueue','ShowWhatsappQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./whatsappQueue.socket','register','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x825094,_0x5945ce){var _0x26fc83=function(_0x40919b){while(--_0x40919b){_0x825094['push'](_0x825094['shift']());}};_0x26fc83(++_0x5945ce);}(_0x0b21,0xb0));var _0x10b2=function(_0x112d62,_0x475677){_0x112d62=_0x112d62-0x0;var _0x17bca7=_0x0b21[_0x112d62];return _0x17bca7;};'use strict';var _=require(_0x10b2('0x0'));var util=require(_0x10b2('0x1'));var moment=require(_0x10b2('0x2'));var BPromise=require(_0x10b2('0x3'));var rs=require(_0x10b2('0x4'));var fs=require('fs');var Redis=require(_0x10b2('0x5'));var db=require(_0x10b2('0x6'))['db'];var utils=require(_0x10b2('0x7'));var logger=require(_0x10b2('0x8'))(_0x10b2('0x9'));var config=require(_0x10b2('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x10b2('0xb')][_0x10b2('0xc')]({'port':0x232a});config[_0x10b2('0xd')]=_['defaults'](config[_0x10b2('0xd')],{'host':_0x10b2('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x10b2('0xd')]));require(_0x10b2('0xf'))[_0x10b2('0x10')](socket);function respondWithRpcPromise(_0x48d059,_0x2b8e41,_0x469855){return new BPromise(function(_0xb1e15f,_0x1aa620){return client['request'](_0x48d059,_0x469855)[_0x10b2('0x11')](function(_0x4bf29a){logger['info'](_0x10b2('0x12'),_0x2b8e41,_0x10b2('0x13'));logger[_0x10b2('0x14')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x2b8e41,_0x10b2('0x13'),JSON[_0x10b2('0x15')](_0x4bf29a));if(_0x4bf29a[_0x10b2('0x16')]){if(_0x4bf29a[_0x10b2('0x16')][_0x10b2('0x17')]===0x1f4){logger[_0x10b2('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x2b8e41,_0x4bf29a[_0x10b2('0x16')][_0x10b2('0x18')]);return _0x1aa620(_0x4bf29a['error'][_0x10b2('0x18')]);}logger[_0x10b2('0x16')](_0x10b2('0x12'),_0x2b8e41,_0x4bf29a['error'][_0x10b2('0x18')]);return _0xb1e15f(_0x4bf29a[_0x10b2('0x16')][_0x10b2('0x18')]);}else{logger[_0x10b2('0x19')]('WhatsappQueue,\x20%s,\x20%s',_0x2b8e41,_0x10b2('0x13'));_0xb1e15f(_0x4bf29a[_0x10b2('0x1a')][_0x10b2('0x18')]);}})[_0x10b2('0x1b')](function(_0x226a7c){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x2b8e41,_0x226a7c);_0x1aa620(_0x226a7c);});});}exports['GetWhatsappQueue']=function(_0x25bebf){var _0x47e63e=this;return new Promise(function(_0x3ffb6f,_0x28d88a){return db[_0x10b2('0x1c')][_0x10b2('0x1d')]({'raw':_0x25bebf['options']?_0x25bebf[_0x10b2('0x1e')][_0x10b2('0x1f')]===undefined?!![]:![]:!![],'where':_0x25bebf[_0x10b2('0x1e')]?_0x25bebf[_0x10b2('0x1e')]['where']||null:null,'attributes':_0x25bebf[_0x10b2('0x1e')]?_0x25bebf[_0x10b2('0x1e')][_0x10b2('0x20')]||null:null,'limit':_0x25bebf[_0x10b2('0x1e')]?_0x25bebf[_0x10b2('0x1e')]['limit']||null:null,'include':_0x25bebf[_0x10b2('0x1e')]?_0x25bebf[_0x10b2('0x1e')][_0x10b2('0x21')]?_['map'](_0x25bebf['options'][_0x10b2('0x21')],function(_0x2c7ffd){return{'model':db[_0x2c7ffd[_0x10b2('0x22')]],'as':_0x2c7ffd['as'],'attributes':_0x2c7ffd[_0x10b2('0x20')],'include':_0x2c7ffd['include']?_[_0x10b2('0x23')](_0x2c7ffd[_0x10b2('0x21')],function(_0x5f4d11){return{'model':db[_0x5f4d11[_0x10b2('0x22')]],'as':_0x5f4d11['as'],'attributes':_0x5f4d11[_0x10b2('0x20')],'include':_0x5f4d11['include']?_[_0x10b2('0x23')](_0x5f4d11[_0x10b2('0x21')],function(_0x56f983){return{'model':db[_0x56f983[_0x10b2('0x22')]],'as':_0x56f983['as'],'attributes':_0x56f983[_0x10b2('0x20')]};}):[]};}):[]};}):[]:[]})[_0x10b2('0x11')](function(_0xd952ea){logger['info'](_0x10b2('0x24'),_0x25bebf);logger['debug']('GetWhatsappQueue',_0x25bebf,JSON['stringify'](_0xd952ea));_0x3ffb6f(_0xd952ea);})[_0x10b2('0x1b')](function(_0x290428){logger[_0x10b2('0x16')]('GetWhatsappQueue',_0x290428[_0x10b2('0x18')],_0x25bebf);_0x28d88a(_0x47e63e[_0x10b2('0x16')](0x1f4,_0x290428[_0x10b2('0x18')]));});});};exports[_0x10b2('0x25')]=function(_0x56c053){var _0x49b5cf=this;return new Promise(function(_0x130f3b,_0x5ac238){return db[_0x10b2('0x1c')][_0x10b2('0x26')]({'raw':_0x56c053[_0x10b2('0x1e')]?_0x56c053[_0x10b2('0x1e')][_0x10b2('0x1f')]===undefined?!![]:![]:!![],'where':_0x56c053['options']?_0x56c053[_0x10b2('0x1e')][_0x10b2('0x27')]||null:null,'attributes':_0x56c053[_0x10b2('0x1e')]?_0x56c053['options']['attributes']||null:null,'include':_0x56c053[_0x10b2('0x1e')]?_0x56c053[_0x10b2('0x1e')][_0x10b2('0x21')]?_[_0x10b2('0x23')](_0x56c053['options'][_0x10b2('0x21')],function(_0x10c849){return{'model':db[_0x10c849[_0x10b2('0x22')]],'as':_0x10c849['as'],'attributes':_0x10c849['attributes'],'include':_0x10c849[_0x10b2('0x21')]?_[_0x10b2('0x23')](_0x10c849[_0x10b2('0x21')],function(_0x4e0c99){return{'model':db[_0x4e0c99[_0x10b2('0x22')]],'as':_0x4e0c99['as'],'attributes':_0x4e0c99[_0x10b2('0x20')],'include':_0x4e0c99[_0x10b2('0x21')]?_[_0x10b2('0x23')](_0x4e0c99['include'],function(_0x2c3428){return{'model':db[_0x2c3428[_0x10b2('0x22')]],'as':_0x2c3428['as'],'attributes':_0x2c3428[_0x10b2('0x20')]};}):[]};}):[]};}):[]:[]})[_0x10b2('0x11')](function(_0xaf2e78){logger[_0x10b2('0x19')]('ShowWhatsappQueue',_0x56c053);logger[_0x10b2('0x14')](_0x10b2('0x25'),_0x56c053,JSON[_0x10b2('0x15')](_0xaf2e78));_0x130f3b(_0xaf2e78);})[_0x10b2('0x1b')](function(_0x30a732){logger['error'](_0x10b2('0x25'),_0x30a732[_0x10b2('0x18')],_0x56c053);_0x5ac238(_0x49b5cf['error'](0x1f4,_0x30a732[_0x10b2('0x18')]));});});}; \ No newline at end of file +var _0x3c7d=['model','GetWhatsappQueue','find','ShowWhatsappQueue','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappQueue','findAll','raw','options','where','attributes','limit','include','map'];(function(_0x270adf,_0x1daaa3){var _0x29eda9=function(_0x40afec){while(--_0x40afec){_0x270adf['push'](_0x270adf['shift']());}};_0x29eda9(++_0x1daaa3);}(_0x3c7d,0x16c));var _0xd3c7=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x3c7d[_0x1573ea];return _0x51c0e2;};'use strict';var _=require(_0xd3c7('0x0'));var util=require(_0xd3c7('0x1'));var moment=require('moment');var BPromise=require(_0xd3c7('0x2'));var rs=require(_0xd3c7('0x3'));var fs=require('fs');var Redis=require(_0xd3c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd3c7('0x5'))(_0xd3c7('0x6'));var config=require(_0xd3c7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd3c7('0x8')][_0xd3c7('0x9')]({'port':0x232a});config[_0xd3c7('0xa')]=_['defaults'](config[_0xd3c7('0xa')],{'host':_0xd3c7('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd3c7('0xa')]));require(_0xd3c7('0xc'))[_0xd3c7('0xd')](socket);function respondWithRpcPromise(_0x35f12d,_0x175473,_0x2aeb20){return new BPromise(function(_0x40e286,_0x48adad){return client[_0xd3c7('0xe')](_0x35f12d,_0x2aeb20)[_0xd3c7('0xf')](function(_0x29ef91){logger[_0xd3c7('0x10')](_0xd3c7('0x11'),_0x175473,_0xd3c7('0x12'));logger[_0xd3c7('0x13')](_0xd3c7('0x14'),_0x175473,'request\x20sent',JSON[_0xd3c7('0x15')](_0x29ef91));if(_0x29ef91[_0xd3c7('0x16')]){if(_0x29ef91[_0xd3c7('0x16')][_0xd3c7('0x17')]===0x1f4){logger[_0xd3c7('0x16')](_0xd3c7('0x11'),_0x175473,_0x29ef91[_0xd3c7('0x16')]['message']);return _0x48adad(_0x29ef91[_0xd3c7('0x16')][_0xd3c7('0x18')]);}logger['error'](_0xd3c7('0x11'),_0x175473,_0x29ef91[_0xd3c7('0x16')][_0xd3c7('0x18')]);return _0x40e286(_0x29ef91['error'][_0xd3c7('0x18')]);}else{logger['info'](_0xd3c7('0x11'),_0x175473,_0xd3c7('0x12'));_0x40e286(_0x29ef91[_0xd3c7('0x19')][_0xd3c7('0x18')]);}})[_0xd3c7('0x1a')](function(_0x498c6f){logger[_0xd3c7('0x16')](_0xd3c7('0x11'),_0x175473,_0x498c6f);_0x48adad(_0x498c6f);});});}exports['GetWhatsappQueue']=function(_0x3aa3f1){var _0x4c583e=this;return new Promise(function(_0x50378b,_0x1bae2b){return db[_0xd3c7('0x1b')][_0xd3c7('0x1c')]({'raw':_0x3aa3f1['options']?_0x3aa3f1['options'][_0xd3c7('0x1d')]===undefined?!![]:![]:!![],'where':_0x3aa3f1['options']?_0x3aa3f1[_0xd3c7('0x1e')][_0xd3c7('0x1f')]||null:null,'attributes':_0x3aa3f1[_0xd3c7('0x1e')]?_0x3aa3f1[_0xd3c7('0x1e')][_0xd3c7('0x20')]||null:null,'limit':_0x3aa3f1[_0xd3c7('0x1e')]?_0x3aa3f1[_0xd3c7('0x1e')][_0xd3c7('0x21')]||null:null,'include':_0x3aa3f1['options']?_0x3aa3f1[_0xd3c7('0x1e')][_0xd3c7('0x22')]?_[_0xd3c7('0x23')](_0x3aa3f1[_0xd3c7('0x1e')]['include'],function(_0x4b8874){return{'model':db[_0x4b8874[_0xd3c7('0x24')]],'as':_0x4b8874['as'],'attributes':_0x4b8874[_0xd3c7('0x20')],'include':_0x4b8874[_0xd3c7('0x22')]?_[_0xd3c7('0x23')](_0x4b8874[_0xd3c7('0x22')],function(_0xcb8979){return{'model':db[_0xcb8979['model']],'as':_0xcb8979['as'],'attributes':_0xcb8979['attributes'],'include':_0xcb8979[_0xd3c7('0x22')]?_['map'](_0xcb8979[_0xd3c7('0x22')],function(_0x4fb0f7){return{'model':db[_0x4fb0f7[_0xd3c7('0x24')]],'as':_0x4fb0f7['as'],'attributes':_0x4fb0f7[_0xd3c7('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd3c7('0xf')](function(_0x4a9049){logger[_0xd3c7('0x10')](_0xd3c7('0x25'),_0x3aa3f1);logger[_0xd3c7('0x13')](_0xd3c7('0x25'),_0x3aa3f1,JSON['stringify'](_0x4a9049));_0x50378b(_0x4a9049);})[_0xd3c7('0x1a')](function(_0xd292fa){logger['error']('GetWhatsappQueue',_0xd292fa[_0xd3c7('0x18')],_0x3aa3f1);_0x1bae2b(_0x4c583e['error'](0x1f4,_0xd292fa[_0xd3c7('0x18')]));});});};exports['ShowWhatsappQueue']=function(_0x14224c){var _0x174407=this;return new Promise(function(_0x4be312,_0x1fc9b1){return db[_0xd3c7('0x1b')][_0xd3c7('0x26')]({'raw':_0x14224c[_0xd3c7('0x1e')]?_0x14224c[_0xd3c7('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x14224c[_0xd3c7('0x1e')]?_0x14224c[_0xd3c7('0x1e')][_0xd3c7('0x1f')]||null:null,'attributes':_0x14224c['options']?_0x14224c['options'][_0xd3c7('0x20')]||null:null,'include':_0x14224c['options']?_0x14224c[_0xd3c7('0x1e')]['include']?_['map'](_0x14224c[_0xd3c7('0x1e')]['include'],function(_0x58285a){return{'model':db[_0x58285a[_0xd3c7('0x24')]],'as':_0x58285a['as'],'attributes':_0x58285a[_0xd3c7('0x20')],'include':_0x58285a[_0xd3c7('0x22')]?_[_0xd3c7('0x23')](_0x58285a[_0xd3c7('0x22')],function(_0x2bd59d){return{'model':db[_0x2bd59d['model']],'as':_0x2bd59d['as'],'attributes':_0x2bd59d[_0xd3c7('0x20')],'include':_0x2bd59d['include']?_[_0xd3c7('0x23')](_0x2bd59d[_0xd3c7('0x22')],function(_0x2c9594){return{'model':db[_0x2c9594[_0xd3c7('0x24')]],'as':_0x2c9594['as'],'attributes':_0x2c9594['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x246a47){logger['info'](_0xd3c7('0x27'),_0x14224c);logger[_0xd3c7('0x13')](_0xd3c7('0x27'),_0x14224c,JSON[_0xd3c7('0x15')](_0x246a47));_0x4be312(_0x246a47);})[_0xd3c7('0x1a')](function(_0x53144f){logger[_0xd3c7('0x16')](_0xd3c7('0x27'),_0x53144f[_0xd3c7('0x18')],_0x14224c);_0x1fc9b1(_0x174407['error'](0x1f4,_0x53144f['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index ffbfbe7..5712890 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 _0x5601=['update','removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save'];(function(_0x231d33,_0x187d2c){var _0x28f424=function(_0x39be67){while(--_0x39be67){_0x231d33['push'](_0x231d33['shift']());}};_0x28f424(++_0x187d2c);}(_0x5601,0xc2));var _0x1560=function(_0x4a4777,_0x4ce4b3){_0x4a4777=_0x4a4777-0x0;var _0x138f19=_0x5601[_0x4a4777];return _0x138f19;};'use strict';var WhatsappQueueEvents=require(_0x1560('0x0'));var events=[_0x1560('0x1'),'remove',_0x1560('0x2')];function createListener(_0x1698ec,_0x280f98){return function(_0x513c7b){_0x280f98['emit'](_0x1698ec,_0x513c7b);};}function removeListener(_0x2e1212,_0x130ae6){return function(){WhatsappQueueEvents[_0x1560('0x3')](_0x2e1212,_0x130ae6);};}exports[_0x1560('0x4')]=function(_0x419696){for(var _0x2fd618=0x0,_0x400a72=events[_0x1560('0x5')];_0x2fd618<_0x400a72;_0x2fd618++){var _0x4a862a=events[_0x2fd618];var _0x5ddda1=createListener(_0x1560('0x6')+_0x4a862a,_0x419696);WhatsappQueueEvents['on'](_0x4a862a,_0x5ddda1);}}; \ No newline at end of file +var _0x5634=['update','register','length','whatsappQueue:','./whatsappQueue.events','save','remove'];(function(_0x21f089,_0x5ebacd){var _0x59c5e7=function(_0x2af336){while(--_0x2af336){_0x21f089['push'](_0x21f089['shift']());}};_0x59c5e7(++_0x5ebacd);}(_0x5634,0x138));var _0x4563=function(_0x4b3c5d,_0x4c9ee1){_0x4b3c5d=_0x4b3c5d-0x0;var _0x5079ae=_0x5634[_0x4b3c5d];return _0x5079ae;};'use strict';var WhatsappQueueEvents=require(_0x4563('0x0'));var events=[_0x4563('0x1'),_0x4563('0x2'),_0x4563('0x3')];function createListener(_0x37527f,_0x4b1fd7){return function(_0x137b1f){_0x4b1fd7['emit'](_0x37527f,_0x137b1f);};}function removeListener(_0x1ff608,_0x2b102f){return function(){WhatsappQueueEvents['removeListener'](_0x1ff608,_0x2b102f);};}exports[_0x4563('0x4')]=function(_0x36355e){for(var _0x14fecc=0x0,_0x27ab03=events[_0x4563('0x5')];_0x14fecc<_0x27ab03;_0x14fecc++){var _0x348993=events[_0x14fecc];var _0x541f6f=createListener(_0x4563('0x6')+_0x348993,_0x36355e);WhatsappQueueEvents['on'](_0x348993,_0x541f6f);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index a778c8b..299f196 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 _0xaa50=['./whatsappQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x21353c,_0x98623c){var _0x173711=function(_0xa2278d){while(--_0xa2278d){_0x21353c['push'](_0x21353c['shift']());}};_0x173711(++_0x98623c);}(_0xaa50,0x19d));var _0x0aa5=function(_0x3e66e7,_0x45b745){_0x3e66e7=_0x3e66e7-0x0;var _0x3e8b25=_0xaa50[_0x3e66e7];return _0x3e8b25;};'use strict';var multer=require('multer');var util=require(_0x0aa5('0x0'));var path=require(_0x0aa5('0x1'));var timeout=require(_0x0aa5('0x2'));var express=require('express');var router=express[_0x0aa5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0aa5('0x4'));var interaction=require(_0x0aa5('0x5'));var config=require(_0x0aa5('0x6'));var controller=require(_0x0aa5('0x7'));router[_0x0aa5('0x8')]('/',auth[_0x0aa5('0x9')](),controller[_0x0aa5('0xa')]);router['get']('/describe',auth[_0x0aa5('0x9')](),controller[_0x0aa5('0xb')]);router[_0x0aa5('0x8')](_0x0aa5('0xc'),auth[_0x0aa5('0x9')](),controller[_0x0aa5('0xd')]);router[_0x0aa5('0xe')]('/',auth[_0x0aa5('0x9')](),controller[_0x0aa5('0xf')]);router[_0x0aa5('0x10')](_0x0aa5('0xc'),auth[_0x0aa5('0x9')](),controller[_0x0aa5('0x11')]);router[_0x0aa5('0x12')]('/:id',auth[_0x0aa5('0x9')](),controller[_0x0aa5('0x13')]);module[_0x0aa5('0x14')]=router; \ No newline at end of file +var _0x71cd=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','describe','show','put','/:id','isAuthenticated'];(function(_0x4a5e3a,_0x2a119b){var _0x1471af=function(_0x359b89){while(--_0x359b89){_0x4a5e3a['push'](_0x4a5e3a['shift']());}};_0x1471af(++_0x2a119b);}(_0x71cd,0x173));var _0xd71c=function(_0x55d911,_0x2b768c){_0x55d911=_0x55d911-0x0;var _0x3104c2=_0x71cd[_0x55d911];return _0x3104c2;};'use strict';var multer=require(_0xd71c('0x0'));var util=require(_0xd71c('0x1'));var path=require('path');var timeout=require(_0xd71c('0x2'));var express=require(_0xd71c('0x3'));var router=express[_0xd71c('0x4')]();var fs_extra=require(_0xd71c('0x5'));var auth=require(_0xd71c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd71c('0x7'));var controller=require('./whatsappQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0xd71c('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xd71c('0x9')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xd71c('0xa')](_0xd71c('0xb'),auth[_0xd71c('0xc')](),controller['update']);router[_0xd71c('0xd')]('/:id',auth[_0xd71c('0xc')](),controller[_0xd71c('0xe')]);module[_0xd71c('0xf')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index aefd474..b458653 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x107583,_0xe81b3){var _0x300546=function(_0x4c62a6){while(--_0x4c62a6){_0x107583['push'](_0x107583['shift']());}};_0x300546(++_0xe81b3);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x28d727,_0x35954f){var _0x357bf6=function(_0x12bba6){while(--_0x12bba6){_0x28d727['push'](_0x28d727['shift']());}};_0x357bf6(++_0x35954f);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 00e445d..d76207b 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 _0xb9a7=['include','rows','catch','show','params','rawAttributes','intersection','create','body','describe','rimraf','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','save','update','then','destroy','stack','map','WhatsappQueueReport','fieldName','type','key','model','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','name','options','includeAll'];(function(_0x51fe78,_0x5a290e){var _0x133fac=function(_0x2fa127){while(--_0x2fa127){_0x51fe78['push'](_0x51fe78['shift']());}};_0x133fac(++_0x5a290e);}(_0xb9a7,0x112));var _0x7b9a=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xb9a7[_0x8c43de];return _0xa6591b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7b9a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7b9a('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x7b9a('0x2'));var util=require(_0x7b9a('0x3'));var path=require(_0x7b9a('0x4'));var sox=require(_0x7b9a('0x5'));var csv=require(_0x7b9a('0x6'));var ejs=require(_0x7b9a('0x7'));var fs=require('fs');var fs_extra=require(_0x7b9a('0x8'));var _=require(_0x7b9a('0x9'));var squel=require(_0x7b9a('0xa'));var crypto=require(_0x7b9a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7b9a('0xc'));var toCsv=require(_0x7b9a('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7b9a('0xd'));var qs=require(_0x7b9a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b9a('0xf'));var logger=require('../../config/logger')(_0x7b9a('0x10'));var utils=require('../../config/utils');var config=require(_0x7b9a('0x11'));var licenseUtil=require(_0x7b9a('0x12'));var db=require(_0x7b9a('0x13'))['db'];function respondWithStatusCode(_0x5948ca,_0x32f616){_0x32f616=_0x32f616||0xcc;return function(_0xec5949){if(_0xec5949){return _0x5948ca['sendStatus'](_0x32f616);}return _0x5948ca[_0x7b9a('0x14')](_0x32f616)[_0x7b9a('0x15')]();};}function respondWithResult(_0x4b7ec0,_0xb157e5){_0xb157e5=_0xb157e5||0xc8;return function(_0xde180d){if(_0xde180d){return _0x4b7ec0[_0x7b9a('0x14')](_0xb157e5)[_0x7b9a('0x16')](_0xde180d);}};}function respondWithFilteredResult(_0x344fa7,_0x346daa){return function(_0x22a7e4){if(_0x22a7e4){var _0x35e602=typeof _0x346daa[_0x7b9a('0x17')]==='undefined'&&typeof _0x346daa[_0x7b9a('0x18')]==='undefined';var _0x123921=_0x22a7e4[_0x7b9a('0x19')];var _0x271263=_0x35e602?0x0:_0x346daa[_0x7b9a('0x17')];var _0x44a232=_0x35e602?_0x22a7e4[_0x7b9a('0x19')]:_0x346daa[_0x7b9a('0x17')]+_0x346daa[_0x7b9a('0x18')];var _0x2064a0;if(_0x44a232>=_0x123921){_0x44a232=_0x123921;_0x2064a0=0xc8;}else{_0x2064a0=0xce;}_0x344fa7[_0x7b9a('0x14')](_0x2064a0);return _0x344fa7[_0x7b9a('0x1a')](_0x7b9a('0x1b'),_0x271263+'-'+_0x44a232+'/'+_0x123921)[_0x7b9a('0x16')](_0x22a7e4);}return null;};}function patchUpdates(_0x58aed7){return function(_0x993048){try{jsonpatch['apply'](_0x993048,_0x58aed7,!![]);}catch(_0x1eacbc){return BPromise['reject'](_0x1eacbc);}return _0x993048[_0x7b9a('0x1c')]();};}function saveUpdates(_0x331ae6,_0x23d812){return function(_0x54fda7){if(_0x54fda7){return _0x54fda7[_0x7b9a('0x1d')](_0x331ae6)[_0x7b9a('0x1e')](function(_0x5705b2){return _0x5705b2;});}return null;};}function removeEntity(_0x35aca7,_0x374dca){return function(_0x269c07){if(_0x269c07){return _0x269c07[_0x7b9a('0x1f')]()[_0x7b9a('0x1e')](function(){_0x35aca7['status'](0xcc)[_0x7b9a('0x15')]();});}};}function handleEntityNotFound(_0x23219e,_0x5809f5){return function(_0x39b7ec){if(!_0x39b7ec){_0x23219e['sendStatus'](0x194);}return _0x39b7ec;};}function handleError(_0x31eb67,_0x3091ab){_0x3091ab=_0x3091ab||0x1f4;return function(_0x4c2271){logger['error'](_0x4c2271[_0x7b9a('0x20')]);if(_0x4c2271['name']){delete _0x4c2271['name'];}_0x31eb67[_0x7b9a('0x14')](_0x3091ab)['send'](_0x4c2271);};}exports['index']=function(_0x3847b4,_0x4d5880){var _0x5c89b6={},_0x314b6d={},_0x4fee38={'count':0x0,'rows':[]};var _0x1553ae=_[_0x7b9a('0x21')](db[_0x7b9a('0x22')]['rawAttributes'],function(_0x45ccf5){return{'name':_0x45ccf5[_0x7b9a('0x23')],'type':_0x45ccf5[_0x7b9a('0x24')][_0x7b9a('0x25')]};});_0x314b6d[_0x7b9a('0x26')]=_[_0x7b9a('0x21')](_0x1553ae,'name');_0x314b6d['query']=_[_0x7b9a('0x27')](_0x3847b4[_0x7b9a('0x28')]);_0x314b6d[_0x7b9a('0x29')]=_['intersection'](_0x314b6d[_0x7b9a('0x26')],_0x314b6d[_0x7b9a('0x28')]);_0x5c89b6['attributes']=_['intersection'](_0x314b6d[_0x7b9a('0x26')],qs[_0x7b9a('0x2a')](_0x3847b4['query'][_0x7b9a('0x2a')]));_0x5c89b6[_0x7b9a('0x2b')]=_0x5c89b6[_0x7b9a('0x2b')][_0x7b9a('0x2c')]?_0x5c89b6[_0x7b9a('0x2b')]:_0x314b6d['model'];if(!_0x3847b4[_0x7b9a('0x28')][_0x7b9a('0x2d')](_0x7b9a('0x2e'))){_0x5c89b6[_0x7b9a('0x18')]=qs[_0x7b9a('0x18')](_0x3847b4[_0x7b9a('0x28')]['limit']);_0x5c89b6['offset']=qs[_0x7b9a('0x17')](_0x3847b4[_0x7b9a('0x28')]['offset']);}_0x5c89b6[_0x7b9a('0x2f')]=qs[_0x7b9a('0x30')](_0x3847b4[_0x7b9a('0x28')]['sort']);_0x5c89b6[_0x7b9a('0x31')]=qs[_0x7b9a('0x29')](_['pick'](_0x3847b4['query'],_0x314b6d[_0x7b9a('0x29')]),_0x1553ae);if(_0x3847b4[_0x7b9a('0x28')][_0x7b9a('0x32')]){_0x5c89b6[_0x7b9a('0x31')]=_[_0x7b9a('0x33')](_0x5c89b6[_0x7b9a('0x31')],{'$or':_[_0x7b9a('0x21')](_0x1553ae,function(_0x380f4b){if(_0x380f4b['type']!==_0x7b9a('0x34')){var _0x5ac175={};_0x5ac175[_0x380f4b[_0x7b9a('0x35')]]={'$like':'%'+_0x3847b4[_0x7b9a('0x28')][_0x7b9a('0x32')]+'%'};return _0x5ac175;}})});}_0x5c89b6=_[_0x7b9a('0x33')]({},_0x5c89b6,_0x3847b4[_0x7b9a('0x36')]);var _0x89951b={'where':_0x5c89b6['where']};return db[_0x7b9a('0x22')][_0x7b9a('0x19')](_0x89951b)[_0x7b9a('0x1e')](function(_0x1bc1f0){_0x4fee38['count']=_0x1bc1f0;if(_0x3847b4[_0x7b9a('0x28')][_0x7b9a('0x37')]){_0x5c89b6[_0x7b9a('0x38')]=[{'all':!![]}];}return db[_0x7b9a('0x22')]['findAll'](_0x5c89b6);})[_0x7b9a('0x1e')](function(_0x53d89a){_0x4fee38[_0x7b9a('0x39')]=_0x53d89a;return _0x4fee38;})[_0x7b9a('0x1e')](respondWithFilteredResult(_0x4d5880,_0x5c89b6))[_0x7b9a('0x3a')](handleError(_0x4d5880,null));};exports[_0x7b9a('0x3b')]=function(_0x43fad0,_0x41f541){var _0x56e274={'raw':!![],'where':{'id':_0x43fad0[_0x7b9a('0x3c')]['id']}},_0x33edc6={};_0x33edc6[_0x7b9a('0x26')]=_['keys'](db['WhatsappQueueReport'][_0x7b9a('0x3d')]);_0x33edc6[_0x7b9a('0x28')]=_[_0x7b9a('0x27')](_0x43fad0[_0x7b9a('0x28')]);_0x33edc6[_0x7b9a('0x29')]=_[_0x7b9a('0x3e')](_0x33edc6['model'],_0x33edc6['query']);_0x56e274['attributes']=_[_0x7b9a('0x3e')](_0x33edc6[_0x7b9a('0x26')],qs['fields'](_0x43fad0[_0x7b9a('0x28')][_0x7b9a('0x2a')]));_0x56e274[_0x7b9a('0x2b')]=_0x56e274['attributes'][_0x7b9a('0x2c')]?_0x56e274['attributes']:_0x33edc6[_0x7b9a('0x26')];if(_0x43fad0[_0x7b9a('0x28')][_0x7b9a('0x37')]){_0x56e274[_0x7b9a('0x38')]=[{'all':!![]}];}_0x56e274=_[_0x7b9a('0x33')]({},_0x56e274,_0x43fad0['options']);return db[_0x7b9a('0x22')]['find'](_0x56e274)[_0x7b9a('0x1e')](handleEntityNotFound(_0x41f541,null))['then'](respondWithResult(_0x41f541,null))['catch'](handleError(_0x41f541,null));};exports[_0x7b9a('0x3f')]=function(_0x3727ef,_0x717d08){return db[_0x7b9a('0x22')][_0x7b9a('0x3f')](_0x3727ef[_0x7b9a('0x40')],{})[_0x7b9a('0x1e')](respondWithResult(_0x717d08,0xc9))[_0x7b9a('0x3a')](handleError(_0x717d08,null));};exports[_0x7b9a('0x1d')]=function(_0x5088c7,_0x1d7957){if(_0x5088c7[_0x7b9a('0x40')]['id']){delete _0x5088c7['body']['id'];}return db['WhatsappQueueReport']['find']({'where':{'id':_0x5088c7[_0x7b9a('0x3c')]['id']}})[_0x7b9a('0x1e')](handleEntityNotFound(_0x1d7957,null))[_0x7b9a('0x1e')](saveUpdates(_0x5088c7[_0x7b9a('0x40')],null))['then'](respondWithResult(_0x1d7957,null))[_0x7b9a('0x3a')](handleError(_0x1d7957,null));};exports[_0x7b9a('0x1f')]=function(_0x287dea,_0x33b200){return db[_0x7b9a('0x22')]['find']({'where':{'id':_0x287dea[_0x7b9a('0x3c')]['id']}})['then'](handleEntityNotFound(_0x33b200,null))[_0x7b9a('0x1e')](removeEntity(_0x33b200,null))[_0x7b9a('0x3a')](handleError(_0x33b200,null));};exports[_0x7b9a('0x41')]=function(_0x3f42a2,_0x52f2ca){return db[_0x7b9a('0x22')][_0x7b9a('0x41')]()[_0x7b9a('0x1e')](respondWithResult(_0x52f2ca,null))[_0x7b9a('0x3a')](handleError(_0x52f2ca,null));}; \ No newline at end of file +var _0x2e54=['catch','show','params','find','create','body','update','destroy','describe','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','error','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x3e6058,_0x1c7f30){var _0x3dc9cf=function(_0x158386){while(--_0x158386){_0x3e6058['push'](_0x3e6058['shift']());}};_0x3dc9cf(++_0x1c7f30);}(_0x2e54,0x1dd));var _0x42e5=function(_0x5a0317,_0x27e1ce){_0x5a0317=_0x5a0317-0x0;var _0x3f40f6=_0x2e54[_0x5a0317];return _0x3f40f6;};'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(){_0x37d10e[_0x42e5('0x19')](0xcc)[_0x42e5('0x1a')]();});}};}function handleEntityNotFound(_0x275c80,_0x4638bc){return function(_0x4f52b2){if(!_0x4f52b2){_0x275c80['sendStatus'](0x194);}return _0x4f52b2;};}function handleError(_0x3115e4,_0x534a26){_0x534a26=_0x534a26||0x1f4;return function(_0x56f812){logger[_0x42e5('0x25')](_0x56f812['stack']);if(_0x56f812[_0x42e5('0x26')]){delete _0x56f812[_0x42e5('0x26')];}_0x3115e4[_0x42e5('0x19')](_0x534a26)[_0x42e5('0x27')](_0x56f812);};}exports[_0x42e5('0x28')]=function(_0x2f1edc,_0x59a46b){var _0x3e2ea5={},_0x201d9e={},_0x39f763={'count':0x0,'rows':[]};var _0x2c53d4=_[_0x42e5('0x29')](db[_0x42e5('0x2a')][_0x42e5('0x2b')],function(_0x282cbf){return{'name':_0x282cbf[_0x42e5('0x2c')],'type':_0x282cbf[_0x42e5('0x2d')][_0x42e5('0x2e')]};});_0x201d9e[_0x42e5('0x2f')]=_[_0x42e5('0x29')](_0x2c53d4,'name');_0x201d9e[_0x42e5('0x30')]=_[_0x42e5('0x31')](_0x2f1edc[_0x42e5('0x30')]);_0x201d9e[_0x42e5('0x32')]=_['intersection'](_0x201d9e['model'],_0x201d9e[_0x42e5('0x30')]);_0x3e2ea5['attributes']=_[_0x42e5('0x33')](_0x201d9e['model'],qs[_0x42e5('0x34')](_0x2f1edc[_0x42e5('0x30')][_0x42e5('0x34')]));_0x3e2ea5['attributes']=_0x3e2ea5[_0x42e5('0x35')][_0x42e5('0x36')]?_0x3e2ea5['attributes']:_0x201d9e[_0x42e5('0x2f')];if(!_0x2f1edc['query'][_0x42e5('0x37')](_0x42e5('0x38'))){_0x3e2ea5[_0x42e5('0x1e')]=qs[_0x42e5('0x1e')](_0x2f1edc[_0x42e5('0x30')][_0x42e5('0x1e')]);_0x3e2ea5[_0x42e5('0x1c')]=qs['offset'](_0x2f1edc['query'][_0x42e5('0x1c')]);}_0x3e2ea5[_0x42e5('0x39')]=qs[_0x42e5('0x3a')](_0x2f1edc['query']['sort']);_0x3e2ea5['where']=qs['filters'](_[_0x42e5('0x3b')](_0x2f1edc[_0x42e5('0x30')],_0x201d9e[_0x42e5('0x32')]),_0x2c53d4);if(_0x2f1edc[_0x42e5('0x30')][_0x42e5('0x3c')]){_0x3e2ea5[_0x42e5('0x3d')]=_[_0x42e5('0x3e')](_0x3e2ea5[_0x42e5('0x3d')],{'$or':_['map'](_0x2c53d4,function(_0x260413){if(_0x260413['type']!==_0x42e5('0x3f')){var _0x343363={};_0x343363[_0x260413[_0x42e5('0x26')]]={'$like':'%'+_0x2f1edc[_0x42e5('0x30')][_0x42e5('0x3c')]+'%'};return _0x343363;}})});}_0x3e2ea5=_[_0x42e5('0x3e')]({},_0x3e2ea5,_0x2f1edc[_0x42e5('0x40')]);var _0x5ab9b8={'where':_0x3e2ea5[_0x42e5('0x3d')]};return db[_0x42e5('0x2a')]['count'](_0x5ab9b8)[_0x42e5('0x24')](function(_0x5e8f96){_0x39f763['count']=_0x5e8f96;if(_0x2f1edc['query'][_0x42e5('0x41')]){_0x3e2ea5[_0x42e5('0x42')]=[{'all':!![]}];}return db[_0x42e5('0x2a')][_0x42e5('0x43')](_0x3e2ea5);})[_0x42e5('0x24')](function(_0x77aa22){_0x39f763[_0x42e5('0x44')]=_0x77aa22;return _0x39f763;})['then'](respondWithFilteredResult(_0x59a46b,_0x3e2ea5))[_0x42e5('0x45')](handleError(_0x59a46b,null));};exports[_0x42e5('0x46')]=function(_0x5bec97,_0x398b73){var _0x1c697a={'raw':!![],'where':{'id':_0x5bec97[_0x42e5('0x47')]['id']}},_0x5db771={};_0x5db771[_0x42e5('0x2f')]=_[_0x42e5('0x31')](db[_0x42e5('0x2a')][_0x42e5('0x2b')]);_0x5db771['query']=_[_0x42e5('0x31')](_0x5bec97[_0x42e5('0x30')]);_0x5db771[_0x42e5('0x32')]=_[_0x42e5('0x33')](_0x5db771['model'],_0x5db771[_0x42e5('0x30')]);_0x1c697a[_0x42e5('0x35')]=_[_0x42e5('0x33')](_0x5db771[_0x42e5('0x2f')],qs[_0x42e5('0x34')](_0x5bec97[_0x42e5('0x30')][_0x42e5('0x34')]));_0x1c697a[_0x42e5('0x35')]=_0x1c697a['attributes'][_0x42e5('0x36')]?_0x1c697a['attributes']:_0x5db771['model'];if(_0x5bec97[_0x42e5('0x30')][_0x42e5('0x41')]){_0x1c697a[_0x42e5('0x42')]=[{'all':!![]}];}_0x1c697a=_[_0x42e5('0x3e')]({},_0x1c697a,_0x5bec97[_0x42e5('0x40')]);return db[_0x42e5('0x2a')][_0x42e5('0x48')](_0x1c697a)['then'](handleEntityNotFound(_0x398b73,null))[_0x42e5('0x24')](respondWithResult(_0x398b73,null))[_0x42e5('0x45')](handleError(_0x398b73,null));};exports[_0x42e5('0x49')]=function(_0x21a047,_0x1086b2){return db[_0x42e5('0x2a')][_0x42e5('0x49')](_0x21a047[_0x42e5('0x4a')],{})['then'](respondWithResult(_0x1086b2,0xc9))[_0x42e5('0x45')](handleError(_0x1086b2,null));};exports[_0x42e5('0x4b')]=function(_0x3616f4,_0x48757e){if(_0x3616f4[_0x42e5('0x4a')]['id']){delete _0x3616f4[_0x42e5('0x4a')]['id'];}return db[_0x42e5('0x2a')][_0x42e5('0x48')]({'where':{'id':_0x3616f4[_0x42e5('0x47')]['id']}})['then'](handleEntityNotFound(_0x48757e,null))[_0x42e5('0x24')](saveUpdates(_0x3616f4['body'],null))[_0x42e5('0x24')](respondWithResult(_0x48757e,null))[_0x42e5('0x45')](handleError(_0x48757e,null));};exports[_0x42e5('0x4c')]=function(_0x48b63b,_0x50f59c){return db['WhatsappQueueReport'][_0x42e5('0x48')]({'where':{'id':_0x48b63b[_0x42e5('0x47')]['id']}})[_0x42e5('0x24')](handleEntityNotFound(_0x50f59c,null))[_0x42e5('0x24')](removeEntity(_0x50f59c,null))['catch'](handleError(_0x50f59c,null));};exports[_0x42e5('0x4d')]=function(_0x26782e,_0x18cedc){return db['WhatsappQueueReport'][_0x42e5('0x4d')]()['then'](respondWithResult(_0x18cedc,null))[_0x42e5('0x45')](handleError(_0x18cedc,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 2d8f509..48bb2cb 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 _0x6936=['exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0x3db4d0,_0x3837be){var _0x544b4c=function(_0x1af69e){while(--_0x1af69e){_0x3db4d0['push'](_0x3db4d0['shift']());}};_0x544b4c(++_0x3837be);}(_0x6936,0x1f1));var _0x6693=function(_0x5553c0,_0xb5c790){_0x5553c0=_0x5553c0-0x0;var _0x91b68a=_0x6936[_0x5553c0];return _0x91b68a;};'use strict';var _=require(_0x6693('0x0'));var util=require(_0x6693('0x1'));var logger=require(_0x6693('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6693('0x3'));var fs=require('fs');var path=require(_0x6693('0x4'));var rimraf=require(_0x6693('0x5'));var config=require(_0x6693('0x6'));var attributes=require('./whatsappQueueReport.attributes');module[_0x6693('0x7')]=function(_0x33b382,_0x3f64ee){return _0x33b382[_0x6693('0x8')](_0x6693('0x9'),attributes,{'tableName':_0x6693('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x6693('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2952=['uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','WhatsappQueueReport','report_whatsapp_queue'];(function(_0x4e293d,_0x1077ca){var _0x43a61a=function(_0x18fc46){while(--_0x18fc46){_0x4e293d['push'](_0x4e293d['shift']());}};_0x43a61a(++_0x1077ca);}(_0x2952,0x17a));var _0x2295=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x2952[_0x5f3f88];return _0xd08119;};'use strict';var _=require('lodash');var util=require(_0x2295('0x0'));var logger=require(_0x2295('0x1'))(_0x2295('0x2'));var moment=require(_0x2295('0x3'));var BPromise=require(_0x2295('0x4'));var rp=require(_0x2295('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2295('0x6'));var config=require(_0x2295('0x7'));var attributes=require(_0x2295('0x8'));module[_0x2295('0x9')]=function(_0x941333,_0x3b2c27){return _0x941333['define'](_0x2295('0xa'),attributes,{'tableName':_0x2295('0xb'),'paranoid':![],'indexes':[{'name':_0x2295('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 7db9cbd..e58510a 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 _0xbee3=['request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappQueueReport,\x20%s,\x20%s','message','result','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','raw','catch','update','where','attributes','limit','UpdateWhatsappQueueReport','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0xbee3,0xe5));var _0x3bee=function(_0x50d19f,_0x270f72){_0x50d19f=_0x50d19f-0x0;var _0x204cca=_0xbee3[_0x50d19f];return _0x204cca;};'use strict';var _=require(_0x3bee('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3bee('0x1'));var db=require(_0x3bee('0x2'))['db'];var utils=require(_0x3bee('0x3'));var logger=require(_0x3bee('0x4'))(_0x3bee('0x5'));var config=require(_0x3bee('0x6'));var jayson=require(_0x3bee('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x48b3e9,_0x4bdc9b,_0x2678b6){return new BPromise(function(_0x1d29c8,_0x4b9545){return client[_0x3bee('0x8')](_0x48b3e9,_0x2678b6)[_0x3bee('0x9')](function(_0x2fa131){logger[_0x3bee('0xa')]('WhatsappQueueReport,\x20%s,\x20%s',_0x4bdc9b,_0x3bee('0xb'));logger[_0x3bee('0xc')](_0x3bee('0xd'),_0x4bdc9b,_0x3bee('0xb'),JSON[_0x3bee('0xe')](_0x2fa131));if(_0x2fa131[_0x3bee('0xf')]){if(_0x2fa131['error']['code']===0x1f4){logger[_0x3bee('0xf')](_0x3bee('0x10'),_0x4bdc9b,_0x2fa131[_0x3bee('0xf')][_0x3bee('0x11')]);return _0x4b9545(_0x2fa131['error']['message']);}logger[_0x3bee('0xf')](_0x3bee('0x10'),_0x4bdc9b,_0x2fa131[_0x3bee('0xf')][_0x3bee('0x11')]);return _0x1d29c8(_0x2fa131[_0x3bee('0xf')][_0x3bee('0x11')]);}else{logger[_0x3bee('0xa')](_0x3bee('0x10'),_0x4bdc9b,_0x3bee('0xb'));_0x1d29c8(_0x2fa131[_0x3bee('0x12')][_0x3bee('0x11')]);}})['catch'](function(_0x5e43a9){logger[_0x3bee('0xf')](_0x3bee('0x10'),_0x4bdc9b,_0x5e43a9);_0x4b9545(_0x5e43a9);});});}exports[_0x3bee('0x13')]=function(_0x49d51b){var _0x41baf2=this;return new Promise(function(_0x2907fe,_0x4ea0de){return db[_0x3bee('0x14')]['create'](_0x49d51b[_0x3bee('0x15')],{'raw':_0x49d51b['options']?_0x49d51b[_0x3bee('0x16')][_0x3bee('0x17')]===undefined?!![]:![]:!![]})[_0x3bee('0x9')](function(_0x17086f){logger[_0x3bee('0xa')](_0x3bee('0x13'),_0x49d51b);logger[_0x3bee('0xc')](_0x3bee('0x13'),_0x49d51b,JSON[_0x3bee('0xe')](_0x17086f));_0x2907fe(_0x17086f);})[_0x3bee('0x18')](function(_0x3b09d7){logger['error'](_0x3bee('0x13'),_0x3b09d7[_0x3bee('0x11')],_0x49d51b);_0x4ea0de(_0x41baf2[_0x3bee('0xf')](0x1f4,_0x3b09d7[_0x3bee('0x11')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x344442){var _0x171e00=this;return new Promise(function(_0x2f09b1,_0x4bd1cf){return db['WhatsappQueueReport'][_0x3bee('0x19')](_0x344442[_0x3bee('0x15')],{'raw':_0x344442[_0x3bee('0x16')]?_0x344442['options'][_0x3bee('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x344442[_0x3bee('0x16')]?_0x344442[_0x3bee('0x16')][_0x3bee('0x1a')]||null:null,'attributes':_0x344442[_0x3bee('0x16')]?_0x344442[_0x3bee('0x16')][_0x3bee('0x1b')]||null:null,'limit':_0x344442['options']?_0x344442[_0x3bee('0x16')][_0x3bee('0x1c')]||null:null})['then'](function(_0x375762){logger[_0x3bee('0xa')](_0x3bee('0x1d'),_0x344442);logger['debug'](_0x3bee('0x1d'),_0x344442,JSON[_0x3bee('0xe')](_0x375762));_0x2f09b1(_0x375762);})[_0x3bee('0x18')](function(_0x2b5937){logger[_0x3bee('0xf')]('UpdateWhatsappQueueReport',_0x2b5937[_0x3bee('0x11')],_0x344442);_0x4bd1cf(_0x171e00[_0x3bee('0xf')](0x1f4,_0x2b5937['message']));});});}; \ No newline at end of file +var _0xe475=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','WhatsappQueueReport','create','options','CreateWhatsappQueueReport','catch','update','body','raw','where','attributes','limit','UpdateWhatsappQueueReport','util'];(function(_0x56b8f9,_0x4d9fc9){var _0x4d8901=function(_0x3c3605){while(--_0x3c3605){_0x56b8f9['push'](_0x56b8f9['shift']());}};_0x4d8901(++_0x4d9fc9);}(_0xe475,0x117));var _0x5e47=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe475[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x5e47('0x0'));var moment=require(_0x5e47('0x1'));var BPromise=require(_0x5e47('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5e47('0x3'));var db=require(_0x5e47('0x4'))['db'];var utils=require(_0x5e47('0x5'));var logger=require(_0x5e47('0x6'))(_0x5e47('0x7'));var config=require(_0x5e47('0x8'));var jayson=require(_0x5e47('0x9'));var client=jayson[_0x5e47('0xa')][_0x5e47('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x158af6,_0x25824c,_0x88a23e){return new BPromise(function(_0x17e55a,_0x82cd31){return client[_0x5e47('0xc')](_0x158af6,_0x88a23e)[_0x5e47('0xd')](function(_0x58682f){logger[_0x5e47('0xe')](_0x5e47('0xf'),_0x25824c,_0x5e47('0x10'));logger[_0x5e47('0x11')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x25824c,_0x5e47('0x10'),JSON[_0x5e47('0x12')](_0x58682f));if(_0x58682f[_0x5e47('0x13')]){if(_0x58682f[_0x5e47('0x13')][_0x5e47('0x14')]===0x1f4){logger[_0x5e47('0x13')](_0x5e47('0xf'),_0x25824c,_0x58682f[_0x5e47('0x13')][_0x5e47('0x15')]);return _0x82cd31(_0x58682f[_0x5e47('0x13')][_0x5e47('0x15')]);}logger['error'](_0x5e47('0xf'),_0x25824c,_0x58682f[_0x5e47('0x13')][_0x5e47('0x15')]);return _0x17e55a(_0x58682f[_0x5e47('0x13')][_0x5e47('0x15')]);}else{logger[_0x5e47('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x25824c,_0x5e47('0x10'));_0x17e55a(_0x58682f[_0x5e47('0x16')][_0x5e47('0x15')]);}})['catch'](function(_0x492321){logger['error'](_0x5e47('0xf'),_0x25824c,_0x492321);_0x82cd31(_0x492321);});});}exports['CreateWhatsappQueueReport']=function(_0x1fc6f3){var _0x527b21=this;return new Promise(function(_0x2eceac,_0x625518){return db[_0x5e47('0x17')][_0x5e47('0x18')](_0x1fc6f3['body'],{'raw':_0x1fc6f3[_0x5e47('0x19')]?_0x1fc6f3['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x274901){logger[_0x5e47('0xe')](_0x5e47('0x1a'),_0x1fc6f3);logger[_0x5e47('0x11')](_0x5e47('0x1a'),_0x1fc6f3,JSON[_0x5e47('0x12')](_0x274901));_0x2eceac(_0x274901);})[_0x5e47('0x1b')](function(_0x3648af){logger[_0x5e47('0x13')](_0x5e47('0x1a'),_0x3648af['message'],_0x1fc6f3);_0x625518(_0x527b21[_0x5e47('0x13')](0x1f4,_0x3648af['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x46a7e1){var _0x45afdf=this;return new Promise(function(_0x3d92ce,_0x581fa8){return db[_0x5e47('0x17')][_0x5e47('0x1c')](_0x46a7e1[_0x5e47('0x1d')],{'raw':_0x46a7e1['options']?_0x46a7e1[_0x5e47('0x19')][_0x5e47('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46a7e1['options']?_0x46a7e1[_0x5e47('0x19')][_0x5e47('0x1f')]||null:null,'attributes':_0x46a7e1[_0x5e47('0x19')]?_0x46a7e1[_0x5e47('0x19')][_0x5e47('0x20')]||null:null,'limit':_0x46a7e1[_0x5e47('0x19')]?_0x46a7e1[_0x5e47('0x19')][_0x5e47('0x21')]||null:null})[_0x5e47('0xd')](function(_0xe7e285){logger[_0x5e47('0xe')]('UpdateWhatsappQueueReport',_0x46a7e1);logger['debug']('UpdateWhatsappQueueReport',_0x46a7e1,JSON[_0x5e47('0x12')](_0xe7e285));_0x3d92ce(_0xe7e285);})[_0x5e47('0x1b')](function(_0x2ec6cf){logger[_0x5e47('0x13')](_0x5e47('0x22'),_0x2ec6cf['message'],_0x46a7e1);_0x581fa8(_0x45afdf[_0x5e47('0x13')](0x1f4,_0x2ec6cf['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index edcfee8..d3f6831 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 _0x6f19=['isAuthenticated','get','/describe','describe','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller'];(function(_0x45a4a8,_0x5ea499){var _0x4b89d4=function(_0x79b79d){while(--_0x79b79d){_0x45a4a8['push'](_0x45a4a8['shift']());}};_0x4b89d4(++_0x5ea499);}(_0x6f19,0x158));var _0x96f1=function(_0xe3322,_0x596833){_0xe3322=_0xe3322-0x0;var _0x476214=_0x6f19[_0xe3322];return _0x476214;};'use strict';var multer=require(_0x96f1('0x0'));var util=require(_0x96f1('0x1'));var path=require('path');var timeout=require(_0x96f1('0x2'));var express=require(_0x96f1('0x3'));var router=express[_0x96f1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x96f1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x96f1('0x6'));var controller=require(_0x96f1('0x7'));router['get']('/',auth[_0x96f1('0x8')](),controller['index']);router[_0x96f1('0x9')](_0x96f1('0xa'),auth[_0x96f1('0x8')](),controller[_0x96f1('0xb')]);router[_0x96f1('0x9')](_0x96f1('0xc'),auth[_0x96f1('0x8')](),controller['show']);router['post']('/',auth[_0x96f1('0x8')](),controller['create']);router['put'](_0x96f1('0xc'),auth[_0x96f1('0x8')](),controller[_0x96f1('0xd')]);router[_0x96f1('0xe')](_0x96f1('0xc'),auth[_0x96f1('0x8')](),controller['destroy']);module[_0x96f1('0xf')]=router; \ No newline at end of file +var _0x59d0=['exports','multer','util','path','connect-timeout','express','Router','../../config/environment','get','index','/describe','isAuthenticated','describe','show','post','put','/:id','update','delete'];(function(_0x6b34a7,_0x21daf6){var _0x534e9a=function(_0x4dc6aa){while(--_0x4dc6aa){_0x6b34a7['push'](_0x6b34a7['shift']());}};_0x534e9a(++_0x21daf6);}(_0x59d0,0x144));var _0x059d=function(_0x482797,_0x26c58c){_0x482797=_0x482797-0x0;var _0x3f7a10=_0x59d0[_0x482797];return _0x3f7a10;};'use strict';var multer=require(_0x059d('0x0'));var util=require(_0x059d('0x1'));var path=require(_0x059d('0x2'));var timeout=require(_0x059d('0x3'));var express=require(_0x059d('0x4'));var router=express[_0x059d('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x059d('0x6'));var controller=require('./whatsappTransferReport.controller');router[_0x059d('0x7')]('/',auth['isAuthenticated'](),controller[_0x059d('0x8')]);router['get'](_0x059d('0x9'),auth[_0x059d('0xa')](),controller[_0x059d('0xb')]);router[_0x059d('0x7')]('/:id',auth[_0x059d('0xa')](),controller[_0x059d('0xc')]);router[_0x059d('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x059d('0xe')](_0x059d('0xf'),auth[_0x059d('0xa')](),controller[_0x059d('0x10')]);router[_0x059d('0x11')](_0x059d('0xf'),auth[_0x059d('0xa')](),controller['destroy']);module[_0x059d('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 75e0ef2..af0b46f 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 _0xa35e=['sequelize','STRING','ENUM','account','agent','queue','DATE'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa35e,0x111));var _0xea35=function(_0x2b1a9b,_0x4325e5){_0x2b1a9b=_0x2b1a9b-0x0;var _0x12ade0=_0xa35e[_0x2b1a9b];return _0x12ade0;};'use strict';var Sequelize=require(_0xea35('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xea35('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xea35('0x2')](_0xea35('0x3'),_0xea35('0x4'),_0xea35('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xea35('0x6')]}}; \ No newline at end of file +var _0xd4f4=['agent','queue','DATE','sequelize','exports','STRING','ENUM','account'];(function(_0x43c530,_0x3bbb0d){var _0xcd44b8=function(_0x2ef0d5){while(--_0x2ef0d5){_0x43c530['push'](_0x43c530['shift']());}};_0xcd44b8(++_0x3bbb0d);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x152e3c,_0x23c77d){_0x152e3c=_0x152e3c-0x0;var _0x4a04fc=_0xd4f4[_0x152e3c];return _0x4a04fc;};'use strict';var Sequelize=require(_0x4d4f('0x0'));module[_0x4d4f('0x1')]={'uniqueid':{'type':Sequelize[_0x4d4f('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4d4f('0x3')](_0x4d4f('0x4'),_0x4d4f('0x5'),_0x4d4f('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x4d4f('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 7a6b5cb..166b1ef 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 _0x4be1=['../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','end','status','undefined','limit','count','offset','set','json','save','then','error','stack','name','send','index','WhatsappTransferReport','rawAttributes','fieldName','map','keys','intersection','model','query','attributes','length','hasOwnProperty','nolimit','sort','where','filters','merge','type','VIRTUAL','filter','options','include','findAll','catch','show','params','fields','includeAll','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3a07f5,_0x357c50){var _0x1ae6b9=function(_0x18579e){while(--_0x18579e){_0x3a07f5['push'](_0x3a07f5['shift']());}};_0x1ae6b9(++_0x357c50);}(_0x4be1,0x10a));var _0x14be=function(_0x4080dd,_0x5b595d){_0x4080dd=_0x4080dd-0x0;var _0x4ecf85=_0x4be1[_0x4080dd];return _0x4ecf85;};'use strict';var emlformat=require(_0x14be('0x0'));var rimraf=require(_0x14be('0x1'));var zipdir=require(_0x14be('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x14be('0x3'));var moment=require('moment');var BPromise=require(_0x14be('0x4'));var Mustache=require('mustache');var util=require(_0x14be('0x5'));var path=require('path');var sox=require(_0x14be('0x6'));var csv=require(_0x14be('0x7'));var ejs=require(_0x14be('0x8'));var fs=require('fs');var fs_extra=require(_0x14be('0x9'));var _=require(_0x14be('0xa'));var squel=require('squel');var crypto=require(_0x14be('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x14be('0xc'));var toCsv=require(_0x14be('0x7'));var querystring=require('querystring');var Papa=require(_0x14be('0xd'));var Redis=require(_0x14be('0xe'));var authService=require(_0x14be('0xf'));var qs=require(_0x14be('0x10'));var as=require(_0x14be('0x11'));var hardwareService=require(_0x14be('0x12'));var logger=require(_0x14be('0x13'))(_0x14be('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x14be('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4955a4,_0x2425a6){_0x2425a6=_0x2425a6||0xcc;return function(_0x276f49){if(_0x276f49){return _0x4955a4[_0x14be('0x16')](_0x2425a6);}return _0x4955a4['status'](_0x2425a6)[_0x14be('0x17')]();};}function respondWithResult(_0x155e24,_0x566c88){_0x566c88=_0x566c88||0xc8;return function(_0x26956d){if(_0x26956d){return _0x155e24[_0x14be('0x18')](_0x566c88)['json'](_0x26956d);}};}function respondWithFilteredResult(_0x3b50ff,_0x485327){return function(_0x2f2ed0){if(_0x2f2ed0){var _0x1d911d=typeof _0x485327['offset']===_0x14be('0x19')&&typeof _0x485327[_0x14be('0x1a')]==='undefined';var _0x4d27ab=_0x2f2ed0[_0x14be('0x1b')];var _0x56334b=_0x1d911d?0x0:_0x485327[_0x14be('0x1c')];var _0x864eea=_0x1d911d?_0x2f2ed0['count']:_0x485327['offset']+_0x485327[_0x14be('0x1a')];var _0x50186b;if(_0x864eea>=_0x4d27ab){_0x864eea=_0x4d27ab;_0x50186b=0xc8;}else{_0x50186b=0xce;}_0x3b50ff['status'](_0x50186b);return _0x3b50ff[_0x14be('0x1d')]('Content-Range',_0x56334b+'-'+_0x864eea+'/'+_0x4d27ab)[_0x14be('0x1e')](_0x2f2ed0);}return null;};}function patchUpdates(_0xb167e){return function(_0x7d1c30){try{jsonpatch['apply'](_0x7d1c30,_0xb167e,!![]);}catch(_0x6f598c){return BPromise['reject'](_0x6f598c);}return _0x7d1c30[_0x14be('0x1f')]();};}function saveUpdates(_0x4dfb42,_0x471188){return function(_0x511710){if(_0x511710){return _0x511710['update'](_0x4dfb42)[_0x14be('0x20')](function(_0x17d517){return _0x17d517;});}return null;};}function removeEntity(_0x6e7fbf,_0x428b1e){return function(_0x494e54){if(_0x494e54){return _0x494e54['destroy']()[_0x14be('0x20')](function(){_0x6e7fbf[_0x14be('0x18')](0xcc)[_0x14be('0x17')]();});}};}function handleEntityNotFound(_0x326289,_0x271c6c){return function(_0x4ddd19){if(!_0x4ddd19){_0x326289[_0x14be('0x16')](0x194);}return _0x4ddd19;};}function handleError(_0x841fa4,_0xe363c7){_0xe363c7=_0xe363c7||0x1f4;return function(_0x56e105){logger[_0x14be('0x21')](_0x56e105[_0x14be('0x22')]);if(_0x56e105[_0x14be('0x23')]){delete _0x56e105[_0x14be('0x23')];}_0x841fa4[_0x14be('0x18')](_0xe363c7)[_0x14be('0x24')](_0x56e105);};}exports[_0x14be('0x25')]=function(_0x48287b,_0x3f2fa9){var _0x3dede9={},_0x4e6b13={},_0x437ebe={'count':0x0,'rows':[]};var _0x334eea=_['map'](db[_0x14be('0x26')][_0x14be('0x27')],function(_0x5649e1){return{'name':_0x5649e1[_0x14be('0x28')],'type':_0x5649e1['type']['key']};});_0x4e6b13['model']=_[_0x14be('0x29')](_0x334eea,_0x14be('0x23'));_0x4e6b13['query']=_[_0x14be('0x2a')](_0x48287b['query']);_0x4e6b13['filters']=_[_0x14be('0x2b')](_0x4e6b13[_0x14be('0x2c')],_0x4e6b13[_0x14be('0x2d')]);_0x3dede9[_0x14be('0x2e')]=_['intersection'](_0x4e6b13[_0x14be('0x2c')],qs['fields'](_0x48287b[_0x14be('0x2d')]['fields']));_0x3dede9['attributes']=_0x3dede9['attributes'][_0x14be('0x2f')]?_0x3dede9['attributes']:_0x4e6b13[_0x14be('0x2c')];if(!_0x48287b['query'][_0x14be('0x30')](_0x14be('0x31'))){_0x3dede9[_0x14be('0x1a')]=qs[_0x14be('0x1a')](_0x48287b[_0x14be('0x2d')][_0x14be('0x1a')]);_0x3dede9['offset']=qs[_0x14be('0x1c')](_0x48287b[_0x14be('0x2d')][_0x14be('0x1c')]);}_0x3dede9['order']=qs[_0x14be('0x32')](_0x48287b[_0x14be('0x2d')][_0x14be('0x32')]);_0x3dede9[_0x14be('0x33')]=qs['filters'](_['pick'](_0x48287b[_0x14be('0x2d')],_0x4e6b13[_0x14be('0x34')]),_0x334eea);if(_0x48287b[_0x14be('0x2d')]['filter']){_0x3dede9['where']=_[_0x14be('0x35')](_0x3dede9[_0x14be('0x33')],{'$or':_[_0x14be('0x29')](_0x334eea,function(_0xb5674a){if(_0xb5674a[_0x14be('0x36')]!==_0x14be('0x37')){var _0x5bc590={};_0x5bc590[_0xb5674a['name']]={'$like':'%'+_0x48287b[_0x14be('0x2d')][_0x14be('0x38')]+'%'};return _0x5bc590;}})});}_0x3dede9=_[_0x14be('0x35')]({},_0x3dede9,_0x48287b[_0x14be('0x39')]);var _0x4dccd2={'where':_0x3dede9[_0x14be('0x33')]};return db[_0x14be('0x26')][_0x14be('0x1b')](_0x4dccd2)['then'](function(_0x33b736){_0x437ebe['count']=_0x33b736;if(_0x48287b[_0x14be('0x2d')]['includeAll']){_0x3dede9[_0x14be('0x3a')]=[{'all':!![]}];}return db[_0x14be('0x26')][_0x14be('0x3b')](_0x3dede9);})[_0x14be('0x20')](function(_0x474d0a){_0x437ebe['rows']=_0x474d0a;return _0x437ebe;})[_0x14be('0x20')](respondWithFilteredResult(_0x3f2fa9,_0x3dede9))[_0x14be('0x3c')](handleError(_0x3f2fa9,null));};exports[_0x14be('0x3d')]=function(_0x487f20,_0x29eaea){var _0x5e0992={'raw':!![],'where':{'id':_0x487f20[_0x14be('0x3e')]['id']}},_0x183a41={};_0x183a41[_0x14be('0x2c')]=_['keys'](db[_0x14be('0x26')][_0x14be('0x27')]);_0x183a41[_0x14be('0x2d')]=_[_0x14be('0x2a')](_0x487f20[_0x14be('0x2d')]);_0x183a41[_0x14be('0x34')]=_[_0x14be('0x2b')](_0x183a41[_0x14be('0x2c')],_0x183a41[_0x14be('0x2d')]);_0x5e0992[_0x14be('0x2e')]=_[_0x14be('0x2b')](_0x183a41['model'],qs[_0x14be('0x3f')](_0x487f20[_0x14be('0x2d')][_0x14be('0x3f')]));_0x5e0992[_0x14be('0x2e')]=_0x5e0992[_0x14be('0x2e')][_0x14be('0x2f')]?_0x5e0992[_0x14be('0x2e')]:_0x183a41[_0x14be('0x2c')];if(_0x487f20[_0x14be('0x2d')][_0x14be('0x40')]){_0x5e0992[_0x14be('0x3a')]=[{'all':!![]}];}_0x5e0992=_[_0x14be('0x35')]({},_0x5e0992,_0x487f20[_0x14be('0x39')]);return db[_0x14be('0x26')][_0x14be('0x41')](_0x5e0992)['then'](handleEntityNotFound(_0x29eaea,null))[_0x14be('0x20')](respondWithResult(_0x29eaea,null))[_0x14be('0x3c')](handleError(_0x29eaea,null));};exports[_0x14be('0x42')]=function(_0x50d0cb,_0x4fd400){return db[_0x14be('0x26')][_0x14be('0x42')](_0x50d0cb[_0x14be('0x43')],{})['then'](respondWithResult(_0x4fd400,0xc9))[_0x14be('0x3c')](handleError(_0x4fd400,null));};exports[_0x14be('0x44')]=function(_0x4491d5,_0x1854b5){if(_0x4491d5['body']['id']){delete _0x4491d5[_0x14be('0x43')]['id'];}return db[_0x14be('0x26')][_0x14be('0x41')]({'where':{'id':_0x4491d5[_0x14be('0x3e')]['id']}})[_0x14be('0x20')](handleEntityNotFound(_0x1854b5,null))[_0x14be('0x20')](saveUpdates(_0x4491d5[_0x14be('0x43')],null))[_0x14be('0x20')](respondWithResult(_0x1854b5,null))[_0x14be('0x3c')](handleError(_0x1854b5,null));};exports[_0x14be('0x45')]=function(_0xc4db0c,_0x4b19b2){return db['WhatsappTransferReport'][_0x14be('0x41')]({'where':{'id':_0xc4db0c['params']['id']}})[_0x14be('0x20')](handleEntityNotFound(_0x4b19b2,null))[_0x14be('0x20')](removeEntity(_0x4b19b2,null))[_0x14be('0x3c')](handleError(_0x4b19b2,null));};exports[_0x14be('0x46')]=function(_0x1fbc5f,_0xc11d5b){return db[_0x14be('0x26')][_0x14be('0x46')]()['then'](respondWithResult(_0xc11d5b,null))[_0x14be('0x3c')](handleError(_0xc11d5b,null));}; \ No newline at end of file +var _0x1850=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','end','error','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','where','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','show','params','find','create','body','describe'];(function(_0x5d51be,_0x2d1764){var _0x5e899d=function(_0x4eff18){while(--_0x4eff18){_0x5d51be['push'](_0x5d51be['shift']());}};_0x5e899d(++_0x2d1764);}(_0x1850,0xe7));var _0x0185=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1850[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x0185('0x0'));var rimraf=require(_0x0185('0x1'));var zipdir=require(_0x0185('0x2'));var jsonpatch=require(_0x0185('0x3'));var rp=require(_0x0185('0x4'));var moment=require(_0x0185('0x5'));var BPromise=require(_0x0185('0x6'));var Mustache=require(_0x0185('0x7'));var util=require(_0x0185('0x8'));var path=require(_0x0185('0x9'));var sox=require(_0x0185('0xa'));var csv=require('to-csv');var ejs=require(_0x0185('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0185('0xc'));var squel=require(_0x0185('0xd'));var crypto=require(_0x0185('0xe'));var jsforce=require(_0x0185('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0185('0x10'));var querystring=require(_0x0185('0x11'));var Papa=require(_0x0185('0x12'));var Redis=require(_0x0185('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0185('0x14'));var hardwareService=require(_0x0185('0x15'));var logger=require(_0x0185('0x16'))(_0x0185('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0185('0x18'));var db=require(_0x0185('0x19'))['db'];function respondWithStatusCode(_0xdeb550,_0x5def4d){_0x5def4d=_0x5def4d||0xcc;return function(_0x3a3507){if(_0x3a3507){return _0xdeb550[_0x0185('0x1a')](_0x5def4d);}return _0xdeb550[_0x0185('0x1b')](_0x5def4d)['end']();};}function respondWithResult(_0xfb5355,_0x2cb4fb){_0x2cb4fb=_0x2cb4fb||0xc8;return function(_0x5594b7){if(_0x5594b7){return _0xfb5355['status'](_0x2cb4fb)[_0x0185('0x1c')](_0x5594b7);}};}function respondWithFilteredResult(_0x1d10b2,_0x5d4495){return function(_0x458cc6){if(_0x458cc6){var _0x1e7a56=typeof _0x5d4495[_0x0185('0x1d')]===_0x0185('0x1e')&&typeof _0x5d4495[_0x0185('0x1f')]==='undefined';var _0x17eae4=_0x458cc6[_0x0185('0x20')];var _0x25a8e0=_0x1e7a56?0x0:_0x5d4495['offset'];var _0x576c39=_0x1e7a56?_0x458cc6['count']:_0x5d4495[_0x0185('0x1d')]+_0x5d4495[_0x0185('0x1f')];var _0x2e5ebd;if(_0x576c39>=_0x17eae4){_0x576c39=_0x17eae4;_0x2e5ebd=0xc8;}else{_0x2e5ebd=0xce;}_0x1d10b2[_0x0185('0x1b')](_0x2e5ebd);return _0x1d10b2[_0x0185('0x21')](_0x0185('0x22'),_0x25a8e0+'-'+_0x576c39+'/'+_0x17eae4)['json'](_0x458cc6);}return null;};}function patchUpdates(_0x3b3a53){return function(_0x4042c6){try{jsonpatch[_0x0185('0x23')](_0x4042c6,_0x3b3a53,!![]);}catch(_0x16529c){return BPromise['reject'](_0x16529c);}return _0x4042c6['save']();};}function saveUpdates(_0x1fd469,_0x589637){return function(_0x440fd8){if(_0x440fd8){return _0x440fd8[_0x0185('0x24')](_0x1fd469)[_0x0185('0x25')](function(_0x32db3f){return _0x32db3f;});}return null;};}function removeEntity(_0x2b91a0,_0xc037d6){return function(_0x163052){if(_0x163052){return _0x163052[_0x0185('0x26')]()[_0x0185('0x25')](function(){_0x2b91a0[_0x0185('0x1b')](0xcc)[_0x0185('0x27')]();});}};}function handleEntityNotFound(_0x35d122,_0x39d888){return function(_0x35d5d5){if(!_0x35d5d5){_0x35d122[_0x0185('0x1a')](0x194);}return _0x35d5d5;};}function handleError(_0x5af075,_0x493fae){_0x493fae=_0x493fae||0x1f4;return function(_0x272707){logger[_0x0185('0x28')](_0x272707['stack']);if(_0x272707[_0x0185('0x29')]){delete _0x272707[_0x0185('0x29')];}_0x5af075['status'](_0x493fae)[_0x0185('0x2a')](_0x272707);};}exports[_0x0185('0x2b')]=function(_0x3c5178,_0x2c6737){var _0x5e24f4={},_0xf8e583={},_0x4b2481={'count':0x0,'rows':[]};var _0x85016b=_[_0x0185('0x2c')](db[_0x0185('0x2d')][_0x0185('0x2e')],function(_0x3cd92a){return{'name':_0x3cd92a[_0x0185('0x2f')],'type':_0x3cd92a[_0x0185('0x30')][_0x0185('0x31')]};});_0xf8e583['model']=_[_0x0185('0x2c')](_0x85016b,'name');_0xf8e583[_0x0185('0x32')]=_[_0x0185('0x33')](_0x3c5178[_0x0185('0x32')]);_0xf8e583['filters']=_[_0x0185('0x34')](_0xf8e583[_0x0185('0x35')],_0xf8e583[_0x0185('0x32')]);_0x5e24f4['attributes']=_[_0x0185('0x34')](_0xf8e583[_0x0185('0x35')],qs['fields'](_0x3c5178[_0x0185('0x32')][_0x0185('0x36')]));_0x5e24f4[_0x0185('0x37')]=_0x5e24f4[_0x0185('0x37')][_0x0185('0x38')]?_0x5e24f4['attributes']:_0xf8e583['model'];if(!_0x3c5178['query'][_0x0185('0x39')](_0x0185('0x3a'))){_0x5e24f4[_0x0185('0x1f')]=qs[_0x0185('0x1f')](_0x3c5178['query'][_0x0185('0x1f')]);_0x5e24f4['offset']=qs[_0x0185('0x1d')](_0x3c5178['query'][_0x0185('0x1d')]);}_0x5e24f4[_0x0185('0x3b')]=qs['sort'](_0x3c5178[_0x0185('0x32')][_0x0185('0x3c')]);_0x5e24f4['where']=qs[_0x0185('0x3d')](_['pick'](_0x3c5178[_0x0185('0x32')],_0xf8e583[_0x0185('0x3d')]),_0x85016b);if(_0x3c5178[_0x0185('0x32')]['filter']){_0x5e24f4[_0x0185('0x3e')]=_['merge'](_0x5e24f4['where'],{'$or':_[_0x0185('0x2c')](_0x85016b,function(_0x3080d1){if(_0x3080d1[_0x0185('0x30')]!==_0x0185('0x3f')){var _0x5e3a09={};_0x5e3a09[_0x3080d1['name']]={'$like':'%'+_0x3c5178[_0x0185('0x32')][_0x0185('0x40')]+'%'};return _0x5e3a09;}})});}_0x5e24f4=_[_0x0185('0x41')]({},_0x5e24f4,_0x3c5178[_0x0185('0x42')]);var _0x389183={'where':_0x5e24f4[_0x0185('0x3e')]};return db[_0x0185('0x2d')]['count'](_0x389183)[_0x0185('0x25')](function(_0x2ebcbc){_0x4b2481[_0x0185('0x20')]=_0x2ebcbc;if(_0x3c5178[_0x0185('0x32')][_0x0185('0x43')]){_0x5e24f4[_0x0185('0x44')]=[{'all':!![]}];}return db[_0x0185('0x2d')]['findAll'](_0x5e24f4);})[_0x0185('0x25')](function(_0x594ca6){_0x4b2481[_0x0185('0x45')]=_0x594ca6;return _0x4b2481;})[_0x0185('0x25')](respondWithFilteredResult(_0x2c6737,_0x5e24f4))[_0x0185('0x46')](handleError(_0x2c6737,null));};exports[_0x0185('0x47')]=function(_0x1651fa,_0x5d06c3){var _0x4ac6a4={'raw':!![],'where':{'id':_0x1651fa[_0x0185('0x48')]['id']}},_0x3b5849={};_0x3b5849[_0x0185('0x35')]=_[_0x0185('0x33')](db[_0x0185('0x2d')][_0x0185('0x2e')]);_0x3b5849[_0x0185('0x32')]=_[_0x0185('0x33')](_0x1651fa['query']);_0x3b5849['filters']=_[_0x0185('0x34')](_0x3b5849[_0x0185('0x35')],_0x3b5849[_0x0185('0x32')]);_0x4ac6a4[_0x0185('0x37')]=_['intersection'](_0x3b5849['model'],qs[_0x0185('0x36')](_0x1651fa['query'][_0x0185('0x36')]));_0x4ac6a4['attributes']=_0x4ac6a4[_0x0185('0x37')][_0x0185('0x38')]?_0x4ac6a4[_0x0185('0x37')]:_0x3b5849[_0x0185('0x35')];if(_0x1651fa[_0x0185('0x32')]['includeAll']){_0x4ac6a4[_0x0185('0x44')]=[{'all':!![]}];}_0x4ac6a4=_[_0x0185('0x41')]({},_0x4ac6a4,_0x1651fa['options']);return db[_0x0185('0x2d')][_0x0185('0x49')](_0x4ac6a4)[_0x0185('0x25')](handleEntityNotFound(_0x5d06c3,null))[_0x0185('0x25')](respondWithResult(_0x5d06c3,null))[_0x0185('0x46')](handleError(_0x5d06c3,null));};exports[_0x0185('0x4a')]=function(_0x355d0c,_0x3fbe0d){return db[_0x0185('0x2d')][_0x0185('0x4a')](_0x355d0c['body'],{})[_0x0185('0x25')](respondWithResult(_0x3fbe0d,0xc9))[_0x0185('0x46')](handleError(_0x3fbe0d,null));};exports[_0x0185('0x24')]=function(_0x46aae6,_0x3f72da){if(_0x46aae6[_0x0185('0x4b')]['id']){delete _0x46aae6['body']['id'];}return db[_0x0185('0x2d')][_0x0185('0x49')]({'where':{'id':_0x46aae6['params']['id']}})[_0x0185('0x25')](handleEntityNotFound(_0x3f72da,null))[_0x0185('0x25')](saveUpdates(_0x46aae6[_0x0185('0x4b')],null))[_0x0185('0x25')](respondWithResult(_0x3f72da,null))['catch'](handleError(_0x3f72da,null));};exports[_0x0185('0x26')]=function(_0x444948,_0x56111f){return db['WhatsappTransferReport']['find']({'where':{'id':_0x444948[_0x0185('0x48')]['id']}})[_0x0185('0x25')](handleEntityNotFound(_0x56111f,null))['then'](removeEntity(_0x56111f,null))['catch'](handleError(_0x56111f,null));};exports[_0x0185('0x4c')]=function(_0x452b3f,_0x1e4e9c){return db['WhatsappTransferReport']['describe']()[_0x0185('0x25')](respondWithResult(_0x1e4e9c,null))[_0x0185('0x46')](handleError(_0x1e4e9c,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index d223141..1face1b 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 _0xe6a7=['moment','bluebird','request-promise','path','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0xca877,_0x1ad358){var _0x3d7691=function(_0x57bc76){while(--_0x57bc76){_0xca877['push'](_0xca877['shift']());}};_0x3d7691(++_0x1ad358);}(_0xe6a7,0x128));var _0x7e6a=function(_0x33db5e,_0x4a807c){_0x33db5e=_0x33db5e-0x0;var _0x154c97=_0xe6a7[_0x33db5e];return _0x154c97;};'use strict';var _=require(_0x7e6a('0x0'));var util=require(_0x7e6a('0x1'));var logger=require(_0x7e6a('0x2'))(_0x7e6a('0x3'));var moment=require(_0x7e6a('0x4'));var BPromise=require(_0x7e6a('0x5'));var rp=require(_0x7e6a('0x6'));var fs=require('fs');var path=require(_0x7e6a('0x7'));var rimraf=require('rimraf');var config=require(_0x7e6a('0x8'));var attributes=require(_0x7e6a('0x9'));module[_0x7e6a('0xa')]=function(_0x4b913a,_0x416565){return _0x4b913a[_0x7e6a('0xb')](_0x7e6a('0xc'),attributes,{'tableName':_0x7e6a('0xd'),'paranoid':![],'indexes':[{'name':_0x7e6a('0xe'),'fields':[_0x7e6a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x258c=['WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappTransferReport.attributes','exports'];(function(_0x512ba2,_0x537a99){var _0xcc2991=function(_0x59957a){while(--_0x59957a){_0x512ba2['push'](_0x512ba2['shift']());}};_0xcc2991(++_0x537a99);}(_0x258c,0xe3));var _0xc258=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x258c[_0x29d94e];return _0x106237;};'use strict';var _=require(_0xc258('0x0'));var util=require(_0xc258('0x1'));var logger=require(_0xc258('0x2'))(_0xc258('0x3'));var moment=require(_0xc258('0x4'));var BPromise=require(_0xc258('0x5'));var rp=require(_0xc258('0x6'));var fs=require('fs');var path=require(_0xc258('0x7'));var rimraf=require('rimraf');var config=require(_0xc258('0x8'));var attributes=require(_0xc258('0x9'));module[_0xc258('0xa')]=function(_0x3aab18,_0x40ce2f){return _0x3aab18['define'](_0xc258('0xb'),attributes,{'tableName':_0xc258('0xc'),'paranoid':![],'indexes':[{'name':_0xc258('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 2eb92f7..24e1ec9 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 _0x9d6d=['info','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then'];(function(_0x81e39d,_0x4c3934){var _0x548fbb=function(_0x1adda5){while(--_0x1adda5){_0x81e39d['push'](_0x81e39d['shift']());}};_0x548fbb(++_0x4c3934);}(_0x9d6d,0xc2));var _0xd9d6=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x9d6d[_0x5b561d];return _0x431060;};'use strict';var _=require(_0xd9d6('0x0'));var util=require(_0xd9d6('0x1'));var moment=require(_0xd9d6('0x2'));var BPromise=require(_0xd9d6('0x3'));var rs=require(_0xd9d6('0x4'));var fs=require('fs');var Redis=require(_0xd9d6('0x5'));var db=require(_0xd9d6('0x6'))['db'];var utils=require(_0xd9d6('0x7'));var logger=require('../../config/logger')(_0xd9d6('0x8'));var config=require('../../config/environment');var jayson=require(_0xd9d6('0x9'));var client=jayson['client'][_0xd9d6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ee234,_0x528c28,_0x4e180b){return new BPromise(function(_0x396a08,_0x38c9b2){return client[_0xd9d6('0xb')](_0x1ee234,_0x4e180b)[_0xd9d6('0xc')](function(_0xab3e74){logger[_0xd9d6('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0x528c28,'request\x20sent');logger[_0xd9d6('0xe')](_0xd9d6('0xf'),_0x528c28,'request\x20sent',JSON['stringify'](_0xab3e74));if(_0xab3e74[_0xd9d6('0x10')]){if(_0xab3e74['error'][_0xd9d6('0x11')]===0x1f4){logger[_0xd9d6('0x10')](_0xd9d6('0x12'),_0x528c28,_0xab3e74['error']['message']);return _0x38c9b2(_0xab3e74[_0xd9d6('0x10')][_0xd9d6('0x13')]);}logger[_0xd9d6('0x10')](_0xd9d6('0x12'),_0x528c28,_0xab3e74['error'][_0xd9d6('0x13')]);return _0x396a08(_0xab3e74[_0xd9d6('0x10')][_0xd9d6('0x13')]);}else{logger[_0xd9d6('0xd')](_0xd9d6('0x12'),_0x528c28,_0xd9d6('0x14'));_0x396a08(_0xab3e74[_0xd9d6('0x15')][_0xd9d6('0x13')]);}})[_0xd9d6('0x16')](function(_0x4bf40f){logger['error'](_0xd9d6('0x12'),_0x528c28,_0x4bf40f);_0x38c9b2(_0x4bf40f);});});} \ No newline at end of file +var _0xb605=['client','http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xb605,0x160));var _0x5b60=function(_0x54ccd7,_0x3bc3ce){_0x54ccd7=_0x54ccd7-0x0;var _0x4e667b=_0xb605[_0x54ccd7];return _0x4e667b;};'use strict';var _=require(_0x5b60('0x0'));var util=require(_0x5b60('0x1'));var moment=require(_0x5b60('0x2'));var BPromise=require(_0x5b60('0x3'));var rs=require(_0x5b60('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5b60('0x5'))('rpc');var config=require(_0x5b60('0x6'));var jayson=require(_0x5b60('0x7'));var client=jayson[_0x5b60('0x8')][_0x5b60('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x586957,_0xe6f08b,_0x11be70){return new BPromise(function(_0x166359,_0x3df59e){return client['request'](_0x586957,_0x11be70)['then'](function(_0x24c92c){logger[_0x5b60('0xa')](_0x5b60('0xb'),_0xe6f08b,_0x5b60('0xc'));logger[_0x5b60('0xd')](_0x5b60('0xe'),_0xe6f08b,_0x5b60('0xc'),JSON['stringify'](_0x24c92c));if(_0x24c92c['error']){if(_0x24c92c['error'][_0x5b60('0xf')]===0x1f4){logger['error'](_0x5b60('0xb'),_0xe6f08b,_0x24c92c[_0x5b60('0x10')]['message']);return _0x3df59e(_0x24c92c['error'][_0x5b60('0x11')]);}logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0xe6f08b,_0x24c92c[_0x5b60('0x10')][_0x5b60('0x11')]);return _0x166359(_0x24c92c[_0x5b60('0x10')][_0x5b60('0x11')]);}else{logger[_0x5b60('0xa')](_0x5b60('0xb'),_0xe6f08b,_0x5b60('0xc'));_0x166359(_0x24c92c[_0x5b60('0x12')][_0x5b60('0x11')]);}})[_0x5b60('0x13')](function(_0x19a4ec){logger[_0x5b60('0x10')](_0x5b60('0xb'),_0xe6f08b,_0x19a4ec);_0x3df59e(_0x19a4ec);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 6a08776..42603a8 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa85c=['start','Online\x20apps:','map','filter','name','Offline\x20apps:','status','join','seedDB','./config/seedDB','default','./config/license','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','app','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','sequelize','then','listen','info'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0xa85c,0x12e));var _0xca85=function(_0x44b0de,_0x213afa){_0x44b0de=_0x44b0de-0x0;var _0x21da2a=_0xa85c[_0x44b0de];return _0x21da2a;};'use strict';var _=require(_0xca85('0x0'));var mysqldb=require(_0xca85('0x1'));var rpc=require('./rpc');var config=require('./config/environment');var logger=require('./config/logger')(_0xca85('0x2'));var pm2=require('./config/pm2');var pm2Config=require(_0xca85('0x3'));var schedule=require(_0xca85('0x4'));var chat=require('./config/schedule/chat');var whatsapp=require(_0xca85('0x5'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0xca85('0x6')]['sync']()[_0xca85('0x7')](function(){return rpc[_0xca85('0x8')]();})[_0xca85('0x7')](function(_0x3d013a){logger[_0xca85('0x9')](_0x3d013a);return chat['start']();})[_0xca85('0x7')](function(){return whatsapp['start']();})[_0xca85('0x7')](function(){return schedule['start']();})[_0xca85('0x7')](function(){return transcribe[_0xca85('0xa')]();})['then'](function(_0x534901){logger[_0xca85('0x9')](_0x534901);return pm2[_0xca85('0xa')](pm2Config);})[_0xca85('0x7')](function(_0x3fe959){logger[_0xca85('0x9')](_0xca85('0xb'),_[_0xca85('0xc')](_[_0xca85('0xd')](_0x3fe959,{'status':'online'}),_0xca85('0xe'))['join']());logger[_0xca85('0x9')](_0xca85('0xf'),_[_0xca85('0xc')](_[_0xca85('0xd')](_0x3fe959,function(_0x4f5f7e){return _0x4f5f7e[_0xca85('0x10')]!=='online';}),'name')[_0xca85('0x11')]()||'None');config[_0xca85('0x12')]&&require(_0xca85('0x13'))[_0xca85('0x14')]();require(_0xca85('0x15'))[_0xca85('0x14')]();})['catch'](function(_0x17130e){logger['error'](_0xca85('0x16'),_0x17130e);process[_0xca85('0x17')](0x1);});}main(); \ No newline at end of file +var _0xaad5=['./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','listen','info','start','Online\x20apps:','online','name','join','map','filter','status','None','seedDB','./config/seedDB','default','catch','error','exit','lodash','./mysqldb','./rpc','./config/logger','app'];(function(_0x3ef80b,_0x139ed8){var _0x25cae9=function(_0x38abfe){while(--_0x38abfe){_0x3ef80b['push'](_0x3ef80b['shift']());}};_0x25cae9(++_0x139ed8);}(_0xaad5,0x174));var _0x5aad=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xaad5[_0x3511d3];return _0x5d6321;};'use strict';var _=require(_0x5aad('0x0'));var mysqldb=require(_0x5aad('0x1'));var rpc=require(_0x5aad('0x2'));var config=require('./config/environment');var logger=require(_0x5aad('0x3'))(_0x5aad('0x4'));var pm2=require('./config/pm2');var pm2Config=require(_0x5aad('0x5'));var schedule=require(_0x5aad('0x6'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x5aad('0x7'));var transcribe=require(_0x5aad('0x8'));function main(){return mysqldb['db'][_0x5aad('0x9')][_0x5aad('0xa')]()[_0x5aad('0xb')](function(){return rpc[_0x5aad('0xc')]();})['then'](function(_0x2c9a99){logger[_0x5aad('0xd')](_0x2c9a99);return chat[_0x5aad('0xe')]();})['then'](function(){return whatsapp[_0x5aad('0xe')]();})[_0x5aad('0xb')](function(){return schedule[_0x5aad('0xe')]();})[_0x5aad('0xb')](function(){return transcribe[_0x5aad('0xe')]();})[_0x5aad('0xb')](function(_0x135292){logger['info'](_0x135292);return pm2[_0x5aad('0xe')](pm2Config);})['then'](function(_0x4ced35){logger['info'](_0x5aad('0xf'),_['map'](_['filter'](_0x4ced35,{'status':_0x5aad('0x10')}),_0x5aad('0x11'))[_0x5aad('0x12')]());logger[_0x5aad('0xd')]('Offline\x20apps:',_[_0x5aad('0x13')](_[_0x5aad('0x14')](_0x4ced35,function(_0x299f3f){return _0x299f3f[_0x5aad('0x15')]!==_0x5aad('0x10');}),_0x5aad('0x11'))[_0x5aad('0x12')]()||_0x5aad('0x16'));config[_0x5aad('0x17')]&&require(_0x5aad('0x18'))[_0x5aad('0x19')]();require('./config/license')['default']();})[_0x5aad('0x1a')](function(_0x3bb772){logger[_0x5aad('0x1b')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x3bb772);process[_0x5aad('0x1c')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 394d834..f221d1c 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 _0x31f8=['randomBytes','hex','floor','now','HS512','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','bluebird','util','moment','session','role','fullname','name','userpic','md5secret','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','passwordResetAt','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControl','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','ignorePauseForPreviewCalls','selectRecallMeCampaign','isChatInteractionAuthorized','user','ChatInteraction','params','closed','then','unmanaged','disposition','Unmanaged.','Forbidden.','isAuthenticated','authorization','startsWith','headers','Basic','User','find','authenticate','pass','json','Wrong\x20credentials.','catch','status','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','findOne','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','use','getLicense','update','Forbidden','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','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.','length','splice','encryptString','join','promisify','sign','secrets','payload','options','verify'];(function(_0x51e804,_0x4c4b89){var _0x40b251=function(_0x556ba1){while(--_0x556ba1){_0x51e804['push'](_0x51e804['shift']());}};_0x40b251(++_0x4c4b89);}(_0x31f8,0x86));var _0x831f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x31f8[_0x321bb2];return _0x9c12ed;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x831f('0x0'));var hardwareConf=require(_0x831f('0x1'));var licenseUtil=require(_0x831f('0x2'));var encryptor=require(_0x831f('0x3'));var _=require(_0x831f('0x4'));var jwt=require(_0x831f('0x5'));var expressJwt=require(_0x831f('0x6'));var compose=require(_0x831f('0x7'));var basicAuth=require(_0x831f('0x8'));var crypto=require('crypto');var BPromise=require(_0x831f('0x9'));var util=require(_0x831f('0xa'));var moment=require(_0x831f('0xb'));var validateJwt=expressJwt({'secret':config['secrets'][_0x831f('0xc')]});var userAttributes=['id',_0x831f('0xd'),_0x831f('0xe'),_0x831f('0xf'),'internal','email',_0x831f('0x10'),'permissions',_0x831f('0x11'),'voicePause',_0x831f('0x12'),_0x831f('0x13'),_0x831f('0x14'),_0x831f('0x15'),_0x831f('0x16'),_0x831f('0x17'),_0x831f('0x18'),_0x831f('0x19'),_0x831f('0x1a'),'crudPermissions','allowmessenger',_0x831f('0x1b'),'alias','phoneBarAutoAnswer',_0x831f('0x1c'),_0x831f('0x1d'),'phoneBarEnableRecording',_0x831f('0x1e'),_0x831f('0x1f'),'phoneBarExpires',_0x831f('0x20'),_0x831f('0x21'),'phoneBarRemoteControlPort','hotdesk',_0x831f('0x22'),_0x831f('0x23'),_0x831f('0x24'),'settingsEnabled',_0x831f('0x25'),_0x831f('0x26'),_0x831f('0x27'),'downloadAttachments',_0x831f('0x28'),_0x831f('0x29')];exports[_0x831f('0x2a')]=function(){return this['isAuthenticated'](!![])['use'](function(_0x2f8368,_0x1e872f,_0x63836a){if(_0x2f8368[_0x831f('0x2b')]){_0x63836a();}else{return db[_0x831f('0x2c')]['findOne']({'where':{'id':_0x2f8368[_0x831f('0x2d')]['id']},'attributes':['id',_0x831f('0x2e'),'disposition'],'raw':!![]})[_0x831f('0x2f')](function(_0x1e98f1){if(_0x1e98f1&&_0x1e98f1['closed']){return _0x1e872f['status'](_0x1e98f1['disposition']===_0x831f('0x30')?0x195:0x193)['json']({'message':_0x1e98f1[_0x831f('0x31')]===_0x831f('0x30')?_0x831f('0x32'):_0x831f('0x33')});}else{_0x63836a();}})['catch'](function(_0x2a5d53){_0x63836a(_0x2a5d53);});}});};exports[_0x831f('0x34')]=function isAuthenticated(_0x1998f3){return compose()['use'](function(_0x26bf62,_0x5b36a0,_0x2b7c8d){var _0x56a323;if(_0x26bf62['headers'][_0x831f('0x35')]){if(_[_0x831f('0x36')](_0x26bf62[_0x831f('0x37')][_0x831f('0x35')],_0x831f('0x38'))){var _0x26fabd=basicAuth(_0x26bf62);db[_0x831f('0x39')][_0x831f('0x3a')]({'where':{'name':_0x26fabd[_0x831f('0xf')]}})[_0x831f('0x2f')](function(_0x7209e6){if(!_0x7209e6||!_0x7209e6[_0x831f('0x3b')](_0x26fabd[_0x831f('0x3c')])){return _0x5b36a0['status'](0x191)[_0x831f('0x3d')]({'message':_0x831f('0x3e')});}_0x26bf62['user']={'id':_0x7209e6['id']};_0x2b7c8d();})[_0x831f('0x3f')](function(_0x18ad69){_0x2b7c8d(_0x18ad69);});}else if(_[_0x831f('0x36')](_0x26bf62['headers'][_0x831f('0x35')],'Bearer')){validateJwt(_0x26bf62,_0x5b36a0,_0x2b7c8d);}else{if(_0x1998f3){_0x2b7c8d();}else{return _0x5b36a0[_0x831f('0x40')](0x193)[_0x831f('0x3d')]({'message':_0x831f('0x41')});}}}else if(_0x26bf62[_0x831f('0x42')][_0x831f('0x43')]){try{var _0x5cfa92={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x831f('0x44')]()};verifyJwt(_0x26bf62[_0x831f('0x42')]['apikey'],_0x5cfa92)[_0x831f('0x2f')](function(_0x5693af){return db['User']['find']({'where':{'id':_0x5693af[_0x831f('0x45')]}})[_0x831f('0x2f')](function(_0x127776){_0x56a323=_0x127776;return db[_0x831f('0x46')][_0x831f('0x47')]({'where':{'id':0x1},'attributes':[_0x831f('0x48'),_0x831f('0x49')],'raw':!![]});})['then'](function(_0x3f338c){if(!_0x56a323||!_[_0x831f('0x4a')](_0x56a323[_0x831f('0x4b')],_0x5693af[_0x831f('0x4c')])){return _0x5b36a0[_0x831f('0x40')](0x191)[_0x831f('0x3d')]({'message':_0x831f('0x4d')});}if(_0x56a323[_0x831f('0x4e')]){return _0x5b36a0[_0x831f('0x40')](0x191)[_0x831f('0x3d')]({'message':_0x831f('0x4f')});}if(_0x56a323[_0x831f('0x50')]){if(_0x3f338c['blockDuration']>0x0){if(moment(_0x56a323[_0x831f('0x51')])[_0x831f('0x52')](_0x3f338c[_0x831f('0x49')],'minutes')>moment()){return _0x5b36a0[_0x831f('0x40')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x5b36a0[_0x831f('0x40')](0x191)[_0x831f('0x3d')]({'message':_0x831f('0x4f')});}}_0x26bf62[_0x831f('0x2b')]={'id':_0x56a323['id']};_0x2b7c8d();});})[_0x831f('0x3f')](function(){return _0x5b36a0[_0x831f('0x40')](0x191)['json']({'message':_0x831f('0x4f')});});}catch(_0x416419){_0x2b7c8d(_0x416419);}}else if(_0x1998f3){_0x2b7c8d();}else{return _0x5b36a0[_0x831f('0x40')](0x193)[_0x831f('0x3d')]({'message':_0x831f('0x41')});}})['use'](function(_0x19518c,_0x4c865d,_0x181218){if(_0x19518c['user']){db[_0x831f('0x39')][_0x831f('0x3a')]({'where':{'id':_0x19518c[_0x831f('0x2b')]['id']},'attributes':userAttributes})['then'](function(_0x28f68e){if(!_0x28f68e){return _0x4c865d['status'](0x194)['json']({'message':_0x831f('0x53')});}_0x19518c[_0x831f('0x2b')]=_0x28f68e;_0x181218();})[_0x831f('0x3f')](function(_0x2e766d){_0x181218(_0x2e766d);});}else if(_0x1998f3){_0x181218();}else{return _0x4c865d[_0x831f('0x40')](0x194)[_0x831f('0x3d')]({'message':_0x831f('0x54')});}});};exports[_0x831f('0x55')]=function canUpdate(){return compose()[_0x831f('0x56')](function(_0x115d67,_0x57b069,_0x292035){return licenseUtil[_0x831f('0x57')]()[_0x831f('0x2f')](function(_0x3ca6bc){if(_0x3ca6bc[_0x831f('0x58')]){_0x292035();}else{return _0x57b069['status'](0x193)[_0x831f('0x3d')]({'message':_0x831f('0x59')});}})[_0x831f('0x3f')](function(_0x112b0a){_0x292035(_0x112b0a);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()['use'](function(_0x4c9f9d,_0x5063d0,_0x1a1c6a){return licenseUtil[_0x831f('0x57')]()[_0x831f('0x2f')](function(_0x33e60e){if(_0x33e60e[_0x831f('0x5a')]){_0x1a1c6a();}else{return _0x5063d0[_0x831f('0x40')](0x193)[_0x831f('0x3d')]({'message':_0x831f('0x59')});}})[_0x831f('0x3f')](function(_0x2e697d){_0x1a1c6a(_0x2e697d);});});};exports[_0x831f('0x5b')]=function(_0x47d2fd,_0x18a248,_0x4c7c44){_0x47d2fd['isMiddleware']=!![];return _0x4c7c44();};exports[_0x831f('0x5c')]=function signToken(_0x26085d){return signJwt(_0x26085d);};exports[_0x831f('0x5d')]=function(_0x29ea29,_0x5b4cd9){if(!_0x29ea29[_0x831f('0x2b')]){return _0x5b4cd9[_0x831f('0x40')](0x194)[_0x831f('0x3d')]({'message':_0x831f('0x5e')});}var _0x9712b={'payload':{'id':_0x29ea29['user']['id'],'role':_0x29ea29[_0x831f('0x2b')][_0x831f('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x9712b)[_0x831f('0x2f')](function(_0x4291d2){_0x5b4cd9[_0x831f('0x5f')](_0x831f('0x60'),_0x4291d2);_0x5b4cd9[_0x831f('0x61')]('/dashboards/general');})[_0x831f('0x3f')](function(_0x22d51c){return _0x5b4cd9['status'](0x1f4)['send'](_0x22d51c);});};exports[_0x831f('0x62')]=function(_0x33063d){if(_['isNil'](_0x33063d[_0x831f('0x4b')])||_[_0x831f('0x63')](_0x33063d[_0x831f('0x64')])){return null;}else{return createJwt(_0x33063d);}};exports['generateApiKey']=function(_0x1d6d54){_0x1d6d54[_0x831f('0x4b')]=generateNonce();_0x1d6d54[_0x831f('0x64')]=generateIssuedAt();return createJwt(_0x1d6d54);};exports[_0x831f('0x65')]=function(_0x49d733,_0x3ae943){var _0x12d3c4=_0x49d733[_0x831f('0x42')][_0x831f('0x43')];if(_0x12d3c4){var _0x35b9a4={'nonce':_0x3ae943[_0x831f('0x4b')],'iat':_0x3ae943['apiKeyIat'],'audience':hardwareConf[_0x831f('0x44')](),'issuer':hardwareConf[_0x831f('0x44')]()};return verifyJwt(_0x12d3c4,_0x35b9a4)['then'](function(){return generateApiKey(_0x3ae943);});}else{throw{'message':_0x831f('0x66')};}};exports[_0x831f('0x67')]=function(_0x6d937b){var _0x1e310b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x1e310b[_0x831f('0x68')](_0x6d937b))throw new db[(_0x831f('0x69'))][(_0x831f('0x6a'))](_0x831f('0x6b'));return;};exports[_0x831f('0x6c')]=function(_0x1efe75,_0x3e6ed2,_0x136d7c){var _0x560b78=encryptor[_0x831f('0x6d')](_0x3e6ed2)[_0x831f('0x6e')](',');for(var _0x8325bb=0x0;_0x8325bb<_0x136d7c;_0x8325bb++){if(!_0x560b78[_0x8325bb])break;if(_0x1efe75['toLowerCase']()===_0x560b78[_0x8325bb][_0x831f('0x6f')]()){var _0x5cf93d=util['format'](_0x831f('0x70'),_0x136d7c);if(_0x136d7c===0x1){_0x5cf93d=_0x831f('0x71');}throw new db['Sequelize'][(_0x831f('0x6a'))](_0x5cf93d);}}return;};exports['updatePasswordsHistory']=function(_0x22ba7c,_0x1b45d8){var _0x39ff93=_0x1b45d8?encryptor['decryptString'](_0x1b45d8)['split'](','):[];if(_0x39ff93[_0x831f('0x72')]===0x5){_0x39ff93[_0x831f('0x73')](-0x1,0x1);}_0x39ff93['unshift'](_0x22ba7c);return encryptor[_0x831f('0x74')](_0x39ff93[_0x831f('0x75')](','));};function signJwt(_0x2409b3){var _0x32aec6=BPromise[_0x831f('0x76')](jwt[_0x831f('0x77')],{'context':jwt});var _0x3111b0=_0x2409b3['secret']||config[_0x831f('0x78')][_0x831f('0xc')];return new BPromise(function(_0x80288e,_0x279d6e){_0x32aec6(_0x2409b3[_0x831f('0x79')],_0x3111b0,_0x2409b3[_0x831f('0x7a')])['then'](function(_0xf481c0){_0x80288e(_0xf481c0);})['catch'](function(_0x40f601){_0x279d6e(_0x40f601);});});}function verifyJwt(_0x1162f8,_0x349430,_0x17d3f4){var _0x506576=BPromise[_0x831f('0x76')](jwt[_0x831f('0x7b')],{'context':jwt});var _0x513f79=_0x17d3f4||config[_0x831f('0x78')][_0x831f('0xc')];return new BPromise(function(_0x4492dd,_0x20ebc6){_0x506576(_0x1162f8,_0x513f79,_0x349430)['then'](function(_0x216924){_0x4492dd(_0x216924);})[_0x831f('0x3f')](function(_0x104a12){_0x20ebc6(_0x104a12);});});}function generateNonce(){return crypto[_0x831f('0x7c')](0x10)['toString'](_0x831f('0x7d'));}function generateIssuedAt(){return Math[_0x831f('0x7e')](Date[_0x831f('0x7f')]()/0x3e8)['toString']();}function createJwt(_0x5a6936){var _0x15f1b7={'payload':{'iat':_0x5a6936[_0x831f('0x64')],'nonce':_0x5a6936[_0x831f('0x4b')]},'options':{'algorithm':_0x831f('0x80'),'subject':_0x5a6936['id']['toString'](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x831f('0x44')]()}};return signJwt(_0x15f1b7)['then'](function(_0x555997){return{'iat':_0x5a6936[_0x831f('0x64')],'nonce':_0x5a6936[_0x831f('0x4b')],'token':_0x555997};});} \ No newline at end of file +var _0xe57f=['nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockedAt','add','Invalid\x20API\x20access\x20key','User','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyNonce','apiKeyIat','generateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','split','length','splice','unshift','encryptString','join','sign','secret','payload','options','promisify','verify','secrets','floor','toString','HS512','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','composable-middleware','basic-auth','crypto','bluebird','util','moment','session','role','fullname','name','internal','email','userpic','permissions','md5secret','faxPause','smsPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','selectRecallMeCampaign','isChatInteractionAuthorized','isAuthenticated','use','ChatInteraction','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','startsWith','authorization','find','authenticate','pass','Wrong\x20credentials.','user','Unknown\x20authorization\x20format','getUuid','query','apikey','sub','Setting','findOne','allowedLoginAttempts','blockDuration','isEqual'];(function(_0x1de5df,_0x828ae3){var _0x3f1c30=function(_0x5c790b){while(--_0x5c790b){_0x1de5df['push'](_0x1de5df['shift']());}};_0x3f1c30(++_0x828ae3);}(_0xe57f,0x1c8));var _0xfe57=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xe57f[_0x4565bf];return _0x5610ba;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0xfe57('0x0'));var hardwareConf=require(_0xfe57('0x1'));var licenseUtil=require(_0xfe57('0x2'));var encryptor=require(_0xfe57('0x3'));var _=require(_0xfe57('0x4'));var jwt=require(_0xfe57('0x5'));var expressJwt=require('express-jwt');var compose=require(_0xfe57('0x6'));var basicAuth=require(_0xfe57('0x7'));var crypto=require(_0xfe57('0x8'));var BPromise=require(_0xfe57('0x9'));var util=require(_0xfe57('0xa'));var moment=require(_0xfe57('0xb'));var validateJwt=expressJwt({'secret':config['secrets'][_0xfe57('0xc')]});var userAttributes=['id',_0xfe57('0xd'),_0xfe57('0xe'),_0xfe57('0xf'),_0xfe57('0x10'),_0xfe57('0x11'),_0xfe57('0x12'),_0xfe57('0x13'),_0xfe57('0x14'),'voicePause','chatPause','mailPause',_0xfe57('0x15'),_0xfe57('0x16'),'openchannelPause',_0xfe57('0x17'),_0xfe57('0x18'),_0xfe57('0x19'),_0xfe57('0x1a'),_0xfe57('0x1b'),_0xfe57('0x1c'),_0xfe57('0x1d'),_0xfe57('0x1e'),_0xfe57('0x1f'),'phoneBarAutoAnswerDelay',_0xfe57('0x20'),'phoneBarEnableRecording','phoneBarEnableDtmfTone',_0xfe57('0x21'),_0xfe57('0x22'),'phoneBarPrefixRequired',_0xfe57('0x23'),_0xfe57('0x24'),'hotdesk',_0xfe57('0x25'),_0xfe57('0x26'),'privacyEnabled','settingsEnabled',_0xfe57('0x27'),_0xfe57('0x28'),_0xfe57('0x29'),_0xfe57('0x2a'),'ignorePauseForPreviewCalls',_0xfe57('0x2b')];exports[_0xfe57('0x2c')]=function(){return this[_0xfe57('0x2d')](!![])[_0xfe57('0x2e')](function(_0x57846d,_0xae285,_0x3c4f04){if(_0x57846d['user']){_0x3c4f04();}else{return db[_0xfe57('0x2f')]['findOne']({'where':{'id':_0x57846d[_0xfe57('0x30')]['id']},'attributes':['id',_0xfe57('0x31'),_0xfe57('0x32')],'raw':!![]})[_0xfe57('0x33')](function(_0x281a39){if(_0x281a39&&_0x281a39[_0xfe57('0x31')]){return _0xae285[_0xfe57('0x34')](_0x281a39['disposition']===_0xfe57('0x35')?0x195:0x193)[_0xfe57('0x36')]({'message':_0x281a39[_0xfe57('0x32')]===_0xfe57('0x35')?_0xfe57('0x37'):_0xfe57('0x38')});}else{_0x3c4f04();}})[_0xfe57('0x39')](function(_0x153246){_0x3c4f04(_0x153246);});}});};exports[_0xfe57('0x2d')]=function isAuthenticated(_0x58f4d9){return compose()[_0xfe57('0x2e')](function(_0x4e0e9d,_0x3a88e4,_0x1679d5){var _0x57a2c9;if(_0x4e0e9d[_0xfe57('0x3a')]['authorization']){if(_[_0xfe57('0x3b')](_0x4e0e9d['headers'][_0xfe57('0x3c')],'Basic')){var _0x58ef6e=basicAuth(_0x4e0e9d);db['User'][_0xfe57('0x3d')]({'where':{'name':_0x58ef6e[_0xfe57('0xf')]}})[_0xfe57('0x33')](function(_0x21e8b3){if(!_0x21e8b3||!_0x21e8b3[_0xfe57('0x3e')](_0x58ef6e[_0xfe57('0x3f')])){return _0x3a88e4[_0xfe57('0x34')](0x191)[_0xfe57('0x36')]({'message':_0xfe57('0x40')});}_0x4e0e9d[_0xfe57('0x41')]={'id':_0x21e8b3['id']};_0x1679d5();})[_0xfe57('0x39')](function(_0x59a2ab){_0x1679d5(_0x59a2ab);});}else if(_['startsWith'](_0x4e0e9d[_0xfe57('0x3a')][_0xfe57('0x3c')],'Bearer')){validateJwt(_0x4e0e9d,_0x3a88e4,_0x1679d5);}else{if(_0x58f4d9){_0x1679d5();}else{return _0x3a88e4[_0xfe57('0x34')](0x193)[_0xfe57('0x36')]({'message':_0xfe57('0x42')});}}}else if(_0x4e0e9d['query']['apikey']){try{var _0x112a26={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xfe57('0x43')]()};verifyJwt(_0x4e0e9d[_0xfe57('0x44')][_0xfe57('0x45')],_0x112a26)[_0xfe57('0x33')](function(_0x231456){return db['User'][_0xfe57('0x3d')]({'where':{'id':_0x231456[_0xfe57('0x46')]}})[_0xfe57('0x33')](function(_0x394bb2){_0x57a2c9=_0x394bb2;return db[_0xfe57('0x47')][_0xfe57('0x48')]({'where':{'id':0x1},'attributes':[_0xfe57('0x49'),_0xfe57('0x4a')],'raw':!![]});})[_0xfe57('0x33')](function(_0x4dc3ef){if(!_0x57a2c9||!_[_0xfe57('0x4b')](_0x57a2c9['apiKeyNonce'],_0x231456[_0xfe57('0x4c')])){return _0x3a88e4['status'](0x191)['json']({'message':_0xfe57('0x4d')});}if(_0x57a2c9[_0xfe57('0x4e')]){return _0x3a88e4[_0xfe57('0x34')](0x191)[_0xfe57('0x36')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x57a2c9[_0xfe57('0x4f')]){if(_0x4dc3ef[_0xfe57('0x4a')]>0x0){if(moment(_0x57a2c9[_0xfe57('0x50')])[_0xfe57('0x51')](_0x4dc3ef[_0xfe57('0x4a')],'minutes')>moment()){return _0x3a88e4[_0xfe57('0x34')](0x191)[_0xfe57('0x36')]({'message':_0xfe57('0x52')});}}else{return _0x3a88e4['status'](0x191)[_0xfe57('0x36')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x4e0e9d[_0xfe57('0x41')]={'id':_0x57a2c9['id']};_0x1679d5();});})[_0xfe57('0x39')](function(){return _0x3a88e4['status'](0x191)[_0xfe57('0x36')]({'message':_0xfe57('0x52')});});}catch(_0x468627){_0x1679d5(_0x468627);}}else if(_0x58f4d9){_0x1679d5();}else{return _0x3a88e4[_0xfe57('0x34')](0x193)['json']({'message':_0xfe57('0x42')});}})['use'](function(_0x4e7384,_0x5eb8a3,_0x15a72a){if(_0x4e7384['user']){db[_0xfe57('0x53')][_0xfe57('0x3d')]({'where':{'id':_0x4e7384[_0xfe57('0x41')]['id']},'attributes':userAttributes})[_0xfe57('0x33')](function(_0x7ad5ba){if(!_0x7ad5ba){return _0x5eb8a3[_0xfe57('0x34')](0x194)[_0xfe57('0x36')]({'message':_0xfe57('0x54')});}_0x4e7384[_0xfe57('0x41')]=_0x7ad5ba;_0x15a72a();})[_0xfe57('0x39')](function(_0x442cc3){_0x15a72a(_0x442cc3);});}else if(_0x58f4d9){_0x15a72a();}else{return _0x5eb8a3[_0xfe57('0x34')](0x194)[_0xfe57('0x36')]({'message':_0xfe57('0x55')});}});};exports[_0xfe57('0x56')]=function canUpdate(){return compose()[_0xfe57('0x2e')](function(_0x4d7c89,_0x1e8719,_0x400ba8){return licenseUtil[_0xfe57('0x57')]()[_0xfe57('0x33')](function(_0x369c2e){if(_0x369c2e[_0xfe57('0x58')]){_0x400ba8();}else{return _0x1e8719['status'](0x193)['json']({'message':_0xfe57('0x59')});}})[_0xfe57('0x39')](function(_0x5daf06){_0x400ba8(_0x5daf06);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0xfe57('0x2e')](function(_0x1a566d,_0x5b531f,_0x19ac0b){return licenseUtil[_0xfe57('0x57')]()[_0xfe57('0x33')](function(_0x1cd1aa){if(_0x1cd1aa[_0xfe57('0x5a')]){_0x19ac0b();}else{return _0x5b531f[_0xfe57('0x34')](0x193)['json']({'message':_0xfe57('0x59')});}})[_0xfe57('0x39')](function(_0x1442e){_0x19ac0b(_0x1442e);});});};exports[_0xfe57('0x5b')]=function(_0x853b36,_0x5a7792,_0x8254c5){_0x853b36[_0xfe57('0x5b')]=!![];return _0x8254c5();};exports[_0xfe57('0x5c')]=function signToken(_0x517d34){return signJwt(_0x517d34);};exports[_0xfe57('0x5d')]=function(_0x30145a,_0x358c10){if(!_0x30145a[_0xfe57('0x41')]){return _0x358c10[_0xfe57('0x34')](0x194)['json']({'message':_0xfe57('0x5e')});}var _0x49a373={'payload':{'id':_0x30145a['user']['id'],'role':_0x30145a['user'][_0xfe57('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x49a373)['then'](function(_0xeb8d20){_0x358c10[_0xfe57('0x5f')](_0xfe57('0x60'),_0xeb8d20);_0x358c10[_0xfe57('0x61')](_0xfe57('0x62'));})[_0xfe57('0x39')](function(_0x350da4){return _0x358c10[_0xfe57('0x34')](0x1f4)[_0xfe57('0x63')](_0x350da4);});};exports[_0xfe57('0x64')]=function(_0x17de64){if(_[_0xfe57('0x65')](_0x17de64[_0xfe57('0x66')])||_[_0xfe57('0x65')](_0x17de64[_0xfe57('0x67')])){return null;}else{return createJwt(_0x17de64);}};exports[_0xfe57('0x68')]=function(_0x4e74a4){_0x4e74a4['apiKeyNonce']=generateNonce();_0x4e74a4[_0xfe57('0x67')]=generateIssuedAt();return createJwt(_0x4e74a4);};exports['regenerateApiKey']=function(_0x160b7b,_0x5d1453){var _0x1c0258=_0x160b7b[_0xfe57('0x44')]['apikey'];if(_0x1c0258){var _0x9c1b2a={'nonce':_0x5d1453[_0xfe57('0x66')],'iat':_0x5d1453['apiKeyIat'],'audience':hardwareConf[_0xfe57('0x43')](),'issuer':hardwareConf[_0xfe57('0x43')]()};return verifyJwt(_0x1c0258,_0x9c1b2a)['then'](function(){return generateApiKey(_0x5d1453);});}else{throw{'message':_0xfe57('0x69')};}};exports[_0xfe57('0x6a')]=function(_0x3f9059){var _0x416ef0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x416ef0['test'](_0x3f9059))throw new db[(_0xfe57('0x6b'))][(_0xfe57('0x6c'))](_0xfe57('0x6d'));return;};exports[_0xfe57('0x6e')]=function(_0x356d16,_0x4cfbab,_0x51abb9){var _0x269b49=encryptor[_0xfe57('0x6f')](_0x4cfbab)['split'](',');for(var _0x1953d7=0x0;_0x1953d7<_0x51abb9;_0x1953d7++){if(!_0x269b49[_0x1953d7])break;if(_0x356d16[_0xfe57('0x70')]()===_0x269b49[_0x1953d7][_0xfe57('0x70')]()){var _0xcdf901=util[_0xfe57('0x71')](_0xfe57('0x72'),_0x51abb9);if(_0x51abb9===0x1){_0xcdf901=_0xfe57('0x73');}throw new db[(_0xfe57('0x6b'))][(_0xfe57('0x6c'))](_0xcdf901);}}return;};exports[_0xfe57('0x74')]=function(_0xfbe27d,_0x5e86cf){var _0x2e87c1=_0x5e86cf?encryptor['decryptString'](_0x5e86cf)[_0xfe57('0x75')](','):[];if(_0x2e87c1[_0xfe57('0x76')]===0x5){_0x2e87c1[_0xfe57('0x77')](-0x1,0x1);}_0x2e87c1[_0xfe57('0x78')](_0xfbe27d);return encryptor[_0xfe57('0x79')](_0x2e87c1[_0xfe57('0x7a')](','));};function signJwt(_0x3f13f8){var _0x24a30d=BPromise['promisify'](jwt[_0xfe57('0x7b')],{'context':jwt});var _0x7d33f2=_0x3f13f8[_0xfe57('0x7c')]||config['secrets'][_0xfe57('0xc')];return new BPromise(function(_0x299bab,_0xa0e60a){_0x24a30d(_0x3f13f8[_0xfe57('0x7d')],_0x7d33f2,_0x3f13f8[_0xfe57('0x7e')])['then'](function(_0x1724c1){_0x299bab(_0x1724c1);})[_0xfe57('0x39')](function(_0xd4f862){_0xa0e60a(_0xd4f862);});});}function verifyJwt(_0x82fd25,_0x25faa5,_0x45e2d4){var _0x495c0e=BPromise[_0xfe57('0x7f')](jwt[_0xfe57('0x80')],{'context':jwt});var _0x1aebed=_0x45e2d4||config[_0xfe57('0x81')][_0xfe57('0xc')];return new BPromise(function(_0x266f14,_0x429470){_0x495c0e(_0x82fd25,_0x1aebed,_0x25faa5)[_0xfe57('0x33')](function(_0x14e87f){_0x266f14(_0x14e87f);})[_0xfe57('0x39')](function(_0x4730c7){_0x429470(_0x4730c7);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString']('hex');}function generateIssuedAt(){return Math[_0xfe57('0x82')](Date['now']()/0x3e8)[_0xfe57('0x83')]();}function createJwt(_0x326c6b){var _0x1e566b={'payload':{'iat':_0x326c6b[_0xfe57('0x67')],'nonce':_0x326c6b[_0xfe57('0x66')]},'options':{'algorithm':_0xfe57('0x84'),'subject':_0x326c6b['id'][_0xfe57('0x83')](),'issuer':hardwareConf[_0xfe57('0x43')](),'audience':hardwareConf[_0xfe57('0x43')]()}};return signJwt(_0x1e566b)[_0xfe57('0x33')](function(_0x172614){return{'iat':_0x326c6b[_0xfe57('0x67')],'nonce':_0x326c6b['apiKeyNonce'],'token':_0x172614};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 21c9cc1..c9d82d6 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 _0x0482=['filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','write','end','final','unlink','decryptFile','createDecipher','close','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','test'];(function(_0x29ba9d,_0x2ce79b){var _0x37b1d4=function(_0x4d5973){while(--_0x4d5973){_0x29ba9d['push'](_0x29ba9d['shift']());}};_0x37b1d4(++_0x2ce79b);}(_0x0482,0x1e4));var _0x2048=function(_0x592a9d,_0x434abb){_0x592a9d=_0x592a9d-0x0;var _0x59d2b3=_0x0482[_0x592a9d];return _0x59d2b3;};'use strict';var crypto=require(_0x2048('0x0'));var fs=require('fs');var BPromise=require(_0x2048('0x1'));var _=require('lodash');var config=require('../../config/environment');var logger=require('../../config/logger')('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x2048('0x2')][_0x2048('0x3')],'algorithm':_0x2048('0x4')};const fileOptions={'algorithm':_0x2048('0x5')};if(config['encrypt']&&config[_0x2048('0x6')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0x2048('0x6')][_0x2048('0x7')]);if(isSupported){fileOptions[_0x2048('0x7')]=config[_0x2048('0x6')][_0x2048('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x2048('0x8')](',\x20');logger[_0x2048('0x9')](config[_0x2048('0x6')][_0x2048('0x7')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x2e6aa2){return AES_SUPPORTED_RX[_0x2048('0xa')](_0x2e6aa2);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x2048('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0x4d8b78){return getSupportedCiphers()[_0x2048('0xc')](_0x4d8b78)>-0x1;}function combineOptions(_0x4c18da){var _0x157cc9={};for(var _0x467399 in fileOptions){if(fileOptions[_0x2048('0xd')](_0x467399)){_0x157cc9[_0x467399]=fileOptions[_0x467399];}}if(_0x4c18da){for(var _0xcdb23d in _0x4c18da){if(_0x4c18da[_0x2048('0xd')](_0xcdb23d)){_0x157cc9[_0xcdb23d]=_0x4c18da[_0xcdb23d];}}}return _0x157cc9;}exports[_0x2048('0xe')]=function(_0x1d63a1,_0x5734c6,_0x1fe43f,_0x379f5d){return new BPromise(function(_0x176609,_0x3fcd10){_0x379f5d=combineOptions(_0x379f5d);var _0x5949ce=new Buffer(_0x1fe43f);var _0x210967=fs[_0x2048('0xf')](_0x1d63a1);var _0x344d85=fs[_0x2048('0x10')](_0x5734c6);var _0x13ab4c=crypto[_0x2048('0x11')](_0x379f5d[_0x2048('0x7')],_0x5949ce);_0x210967['on'](_0x2048('0x12'),function(_0x97dfe8){var _0x1145dd=new Buffer(_0x13ab4c[_0x2048('0x13')](_0x97dfe8),_0x2048('0x14'));_0x344d85[_0x2048('0x15')](_0x1145dd);});_0x210967['on'](_0x2048('0x16'),function(){try{var _0x52ef35=new Buffer(_0x13ab4c[_0x2048('0x17')](_0x2048('0x14')),_0x2048('0x14'));_0x344d85[_0x2048('0x15')](_0x52ef35);_0x344d85[_0x2048('0x16')]();_0x344d85['on']('close',function(){return _0x176609(_0x5734c6);});}catch(_0x576ab9){fs[_0x2048('0x18')](_0x5734c6);return _0x3fcd10(_0x576ab9);}});});};exports[_0x2048('0x19')]=function(_0x124251,_0x40f053,_0xca1a60,_0x476e37){return new BPromise(function(_0x524bc9,_0x14cae0){_0x476e37=combineOptions(_0x476e37);var _0x44a6d2=new Buffer(_0xca1a60);var _0x46fe94=fs['createReadStream'](_0x124251);var _0x58fc97=fs[_0x2048('0x10')](_0x40f053);var _0x1806ed=crypto[_0x2048('0x1a')](_0x476e37[_0x2048('0x7')],_0x44a6d2);_0x46fe94['on'](_0x2048('0x12'),function(_0x38ad59){var _0x296ea0=new Buffer(_0x1806ed[_0x2048('0x13')](_0x38ad59),_0x2048('0x14'));_0x58fc97[_0x2048('0x15')](_0x296ea0);});_0x46fe94['on'](_0x2048('0x16'),function(){try{var _0x309f47=new Buffer(_0x1806ed[_0x2048('0x17')]('binary'),'binary');_0x58fc97[_0x2048('0x15')](_0x309f47);_0x58fc97[_0x2048('0x16')]();_0x58fc97['on'](_0x2048('0x1b'),function(){return _0x524bc9(_0x40f053);});}catch(_0x273bff){fs[_0x2048('0x18')](_0x40f053);return _0x14cae0(_0x273bff);}});});};exports[_0x2048('0x1c')]=function(_0x319e7e,_0x5271fd,_0x4e817e){var _0xdea8e8=_0x4e817e||stringOptions[_0x2048('0x7')];var _0x221465=_0x5271fd||stringOptions[_0x2048('0x1d')];var _0x3ed9a0=crypto[_0x2048('0x11')](_0xdea8e8,_0x221465);var _0xc5a55b=_0x3ed9a0[_0x2048('0x13')](_0x319e7e,_0x2048('0x1e'),_0x2048('0x1f'));_0xc5a55b+=_0x3ed9a0['final'](_0x2048('0x1f'));return _0xc5a55b;};exports[_0x2048('0x20')]=function(_0x2d6537,_0x5dccc4,_0xf6e3ac){var _0x2adf4c=_0xf6e3ac||stringOptions[_0x2048('0x7')];var _0x1c294a=_0x5dccc4||stringOptions['secret'];var _0x50b3b5=crypto[_0x2048('0x1a')](_0x2adf4c,_0x1c294a);var _0xb6060=_0x50b3b5[_0x2048('0x13')](_0x2d6537,_0x2048('0x1f'),_0x2048('0x1e'));_0xb6060+=_0x50b3b5[_0x2048('0x17')](_0x2048('0x1e'));return _0xb6060;}; \ No newline at end of file +var _0x6a99=['filter','indexOf','hasOwnProperty','createWriteStream','data','update','write','end','final','binary','close','decryptFile','unlink','encryptString','secret','base64','decryptString','createDecipher','utf8','crypto','bluebird','lodash','../../config/environment','../../config/logger','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers'];(function(_0x3c9c9d,_0x43e071){var _0x700a55=function(_0x4bb101){while(--_0x4bb101){_0x3c9c9d['push'](_0x3c9c9d['shift']());}};_0x700a55(++_0x43e071);}(_0x6a99,0x1cd));var _0x96a9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6a99[_0x20a584];return _0x4b41a8;};'use strict';var crypto=require(_0x96a9('0x0'));var fs=require('fs');var BPromise=require(_0x96a9('0x1'));var _=require(_0x96a9('0x2'));var config=require(_0x96a9('0x3'));var logger=require(_0x96a9('0x4'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x96a9('0x5')][_0x96a9('0x6')],'algorithm':_0x96a9('0x7')};const fileOptions={'algorithm':_0x96a9('0x8')};if(config[_0x96a9('0x9')]&&config[_0x96a9('0x9')][_0x96a9('0xa')]){var isSupported=isAlgorithmSupported(config[_0x96a9('0x9')]['algorithm']);if(isSupported){fileOptions[_0x96a9('0xa')]=config['encrypt'][_0x96a9('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x96a9('0xb')](',\x20');logger['error'](config[_0x96a9('0x9')][_0x96a9('0xa')],_0x96a9('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x4224a7){return AES_SUPPORTED_RX[_0x96a9('0xd')](_0x4224a7);}function getSupportedCiphers(){return crypto[_0x96a9('0xe')]()[_0x96a9('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x389409){return getSupportedCiphers()[_0x96a9('0x10')](_0x389409)>-0x1;}function combineOptions(_0x1e5a0d){var _0x386438={};for(var _0x9c4528 in fileOptions){if(fileOptions[_0x96a9('0x11')](_0x9c4528)){_0x386438[_0x9c4528]=fileOptions[_0x9c4528];}}if(_0x1e5a0d){for(var _0x50cdfb in _0x1e5a0d){if(_0x1e5a0d['hasOwnProperty'](_0x50cdfb)){_0x386438[_0x50cdfb]=_0x1e5a0d[_0x50cdfb];}}}return _0x386438;}exports['encryptFile']=function(_0x5a3d9e,_0x2a0c65,_0x2a525e,_0x59d9c4){return new BPromise(function(_0x3304f2,_0x4b1bf8){_0x59d9c4=combineOptions(_0x59d9c4);var _0x33e864=new Buffer(_0x2a525e);var _0x458925=fs['createReadStream'](_0x5a3d9e);var _0xae6d65=fs[_0x96a9('0x12')](_0x2a0c65);var _0x4d769c=crypto['createCipher'](_0x59d9c4[_0x96a9('0xa')],_0x33e864);_0x458925['on'](_0x96a9('0x13'),function(_0x290d36){var _0x4879b9=new Buffer(_0x4d769c[_0x96a9('0x14')](_0x290d36),'binary');_0xae6d65[_0x96a9('0x15')](_0x4879b9);});_0x458925['on'](_0x96a9('0x16'),function(){try{var _0x5bdc5a=new Buffer(_0x4d769c[_0x96a9('0x17')](_0x96a9('0x18')),'binary');_0xae6d65[_0x96a9('0x15')](_0x5bdc5a);_0xae6d65[_0x96a9('0x16')]();_0xae6d65['on'](_0x96a9('0x19'),function(){return _0x3304f2(_0x2a0c65);});}catch(_0x235f16){fs['unlink'](_0x2a0c65);return _0x4b1bf8(_0x235f16);}});});};exports[_0x96a9('0x1a')]=function(_0x3be50c,_0x7426ae,_0x5cddad,_0x5d50ec){return new BPromise(function(_0x209b1f,_0x393225){_0x5d50ec=combineOptions(_0x5d50ec);var _0x5ed5a=new Buffer(_0x5cddad);var _0x190488=fs['createReadStream'](_0x3be50c);var _0x2cc2ff=fs[_0x96a9('0x12')](_0x7426ae);var _0x45d44d=crypto['createDecipher'](_0x5d50ec[_0x96a9('0xa')],_0x5ed5a);_0x190488['on'](_0x96a9('0x13'),function(_0xe493a0){var _0x53fa0b=new Buffer(_0x45d44d[_0x96a9('0x14')](_0xe493a0),_0x96a9('0x18'));_0x2cc2ff[_0x96a9('0x15')](_0x53fa0b);});_0x190488['on'](_0x96a9('0x16'),function(){try{var _0x1b19ba=new Buffer(_0x45d44d[_0x96a9('0x17')](_0x96a9('0x18')),_0x96a9('0x18'));_0x2cc2ff[_0x96a9('0x15')](_0x1b19ba);_0x2cc2ff[_0x96a9('0x16')]();_0x2cc2ff['on'](_0x96a9('0x19'),function(){return _0x209b1f(_0x7426ae);});}catch(_0x4f283f){fs[_0x96a9('0x1b')](_0x7426ae);return _0x393225(_0x4f283f);}});});};exports[_0x96a9('0x1c')]=function(_0xbe03b8,_0x54eab2,_0x4a752b){var _0x10353d=_0x4a752b||stringOptions['algorithm'];var _0x53b369=_0x54eab2||stringOptions[_0x96a9('0x1d')];var _0x35a03b=crypto['createCipher'](_0x10353d,_0x53b369);var _0x11a0c0=_0x35a03b[_0x96a9('0x14')](_0xbe03b8,'utf8',_0x96a9('0x1e'));_0x11a0c0+=_0x35a03b[_0x96a9('0x17')](_0x96a9('0x1e'));return _0x11a0c0;};exports[_0x96a9('0x1f')]=function(_0x1b9521,_0x4aef52,_0x9f63ca){var _0x2ff6ab=_0x9f63ca||stringOptions[_0x96a9('0xa')];var _0x23e795=_0x4aef52||stringOptions[_0x96a9('0x1d')];var _0xeb3ae3=crypto[_0x96a9('0x20')](_0x2ff6ab,_0x23e795);var _0x3e11f9=_0xeb3ae3[_0x96a9('0x14')](_0x1b9521,_0x96a9('0x1e'),_0x96a9('0x21'));_0x3e11f9+=_0xeb3ae3[_0x96a9('0x17')](_0x96a9('0x21'));return _0x3e11f9;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 9a7f5c7..60b8252 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 _0x38b3=['length','existsSync','join','%s%d.%s','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','split','splitSizeCsv','then','query','QueryTypes','num','range','forEach','push','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.csv'];(function(_0x47571e,_0x4bc822){var _0x1ce20f=function(_0x35e0a8){while(--_0x35e0a8){_0x47571e['push'](_0x47571e['shift']());}};_0x1ce20f(++_0x4bc822);}(_0x38b3,0xfb));var _0x338b=function(_0x590759,_0x2139af){_0x590759=_0x590759-0x0;var _0x1a6bf4=_0x38b3[_0x590759];return _0x1a6bf4;};'use strict';var util=require(_0x338b('0x0'));var path=require(_0x338b('0x1'));var _=require(_0x338b('0x2'));var csv=require(_0x338b('0x3'));var fs=require('fs');var BPromise=require(_0x338b('0x4'));var zipdir=require(_0x338b('0x5'));var rimraf=require(_0x338b('0x6'));var db=require(_0x338b('0x7'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x338b('0x8'))(_0x338b('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x338b('0xa')][0x2]);var QUERY=process[_0x338b('0xa')][0x3];var PATH=process[_0x338b('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x13da7f,_0xeadfa){var _0x213796={'status':_0x13da7f};var _0x53ba5e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xeadfa){_0x213796['savename']=_0xeadfa;}return db[_0x338b('0xb')]['update'](_0x213796,_0x53ba5e);}function main(){var _0x41d608=0x1388;var _0x9eec0a;logger[_0x338b('0xc')](util[_0x338b('0xd')](_0x338b('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x338b('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x338b('0x10'),_0x338b('0x11')]})[_0x338b('0x12')](function(_0x539e61){if(_0x539e61){_0x9eec0a=_0x539e61;_0x41d608=_0x9eec0a[_0x338b('0x11')]||0x1388;}})[_0x338b('0x12')](function(){return dbH['sequelize'][_0x338b('0x13')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0x338b('0x14')]['SELECT']});})['then'](function(_0x2f5772){if(!_0x2f5772[0x0][_0x338b('0x15')]){return analyticExtractedReport('Empty');}var _0x2163a0=[];var _0x2cca38=0x0;if(_0x9eec0a[_0x338b('0x10')]){if(_0x2f5772&&_0x2f5772['length']){var _0x83818e=_[_0x338b('0x16')](_0x2f5772[0x0]['num']/_0x41d608);var _0x45970d=Number['isInteger'](_0x2f5772[0x0][_0x338b('0x15')]/_0x41d608)?_0x2f5772[0x0]['num']%_0x41d608:0x0;_0x83818e[_0x338b('0x17')](function(_0x5d6bfb){if(_0x5d6bfb>0x0){_0x2cca38+=_0x41d608;}_0x2163a0[_0x338b('0x18')](dbH[_0x338b('0x19')]['query'](util[_0x338b('0xd')](_0x338b('0x1a'),QUERY,_0x41d608,_0x2cca38),{'type':dbH['sequelize'][_0x338b('0x14')]['SELECT']}));});if(_0x45970d>0x0){_0x2cca38+=_0x41d608;_0x2163a0['push'](dbH[_0x338b('0x19')][_0x338b('0x13')](util[_0x338b('0xd')](_0x338b('0x1a'),QUERY,_0x45970d,_0x2cca38),{'type':dbH[_0x338b('0x19')][_0x338b('0x14')][_0x338b('0x1b')]}));}}}else{_0x2163a0[_0x338b('0x18')](dbH[_0x338b('0x19')][_0x338b('0x13')](QUERY,{'type':dbH['sequelize'][_0x338b('0x14')]['SELECT']}));}var _0x3c60fe=path[_0x338b('0x1c')](PATH);var _0x5eb5f1=path[_0x338b('0x1d')](PATH,_0x338b('0x1e'));var _0x3551da=_0x9eec0a[_0x338b('0x10')]&&_0x2163a0[_0x338b('0x1f')]>0x1;var _0xc7a18c=[];if(!fs[_0x338b('0x20')](path['join'](_0x3c60fe,_0x5eb5f1))&&_0x3551da){fs['mkdirSync'](path[_0x338b('0x21')](_0x3c60fe,_0x5eb5f1));}return BPromise['each'](_0x2163a0,function(_0x1095a5){_0xc7a18c['push'](_0x1095a5);})['then'](function(){for(var _0x48ab2b=0x0;_0x48ab2b<_0xc7a18c[_0x338b('0x1f')];_0x48ab2b+=0x1){var _0x9841a9;var _0x1487bb=_0xc7a18c[_0x48ab2b];if(_0x3551da){_0x9841a9=path['join'](_0x3c60fe,_0x5eb5f1,util[_0x338b('0xd')](_0x338b('0x22'),_0x5eb5f1,_0x48ab2b,_0x338b('0x23')));}else{_0x9841a9=path[_0x338b('0x21')](_0x3c60fe,util[_0x338b('0xd')](_0x338b('0x24'),_0x5eb5f1,'csv'));}fs[_0x338b('0x25')](_0x9841a9,csv(_0x1487bb));}})['then'](function(){if(_0x3551da){return new Promise(function(_0x54f977){zipdir(path['join'](_0x3c60fe,_0x5eb5f1),{'saveTo':path[_0x338b('0x21')](_0x3c60fe,util[_0x338b('0xd')]('%s.%s',_0x5eb5f1,_0x338b('0x26')))},function(_0x5baab9,_0x15c92a){rimraf(path[_0x338b('0x21')](_0x3c60fe,_0x5eb5f1),function(){});_0x54f977('zip\x20finished');});});}})[_0x338b('0x12')](function(){logger['info'](util[_0x338b('0xd')](_0x338b('0x27'),EXTRACTED_REPORT_ID,_0x338b('0x28')));return analyticExtractedReport('Completed',_0x3551da?util[_0x338b('0xd')](_0x338b('0x24'),_0x5eb5f1,_0x3551da?_0x338b('0x26'):_0x338b('0x23')):null);});})[_0x338b('0x29')](function(_0x1fa830){logger[_0x338b('0xc')](util[_0x338b('0xd')](_0x338b('0x2a'),EXTRACTED_REPORT_ID,_0x338b('0x28')),util[_0x338b('0x2b')](_0x1fa830,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x338b('0x2c'));})[_0x338b('0x2d')](function(){process[_0x338b('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x6f80=['lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','then','splitSizeCsv','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','split','existsSync','join','mkdirSync','each','%s%d.%s','csv','writeFileSync','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','exit','path'];(function(_0x361ac8,_0x5bd80b){var _0x54dd46=function(_0x1a2dbe){while(--_0x1a2dbe){_0x361ac8['push'](_0x361ac8['shift']());}};_0x54dd46(++_0x5bd80b);}(_0x6f80,0x103));var _0x06f8=function(_0x2b94b3,_0x46dea3){_0x2b94b3=_0x2b94b3-0x0;var _0x4356d4=_0x6f80[_0x2b94b3];return _0x4356d4;};'use strict';var util=require('util');var path=require(_0x06f8('0x0'));var _=require(_0x06f8('0x1'));var csv=require(_0x06f8('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x06f8('0x3'));var rimraf=require(_0x06f8('0x4'));var db=require(_0x06f8('0x5'))['db'];var dbH=require(_0x06f8('0x5'))[_0x06f8('0x6')];var logger=require(_0x06f8('0x7'))(_0x06f8('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x06f8('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x06f8('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x32b419,_0x245cc9){var _0x5be33d={'status':_0x32b419};var _0x399f48={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x245cc9){_0x5be33d[_0x06f8('0xa')]=_0x245cc9;}return db[_0x06f8('0xb')]['update'](_0x5be33d,_0x399f48);}function main(){var _0x57c104=0x1388;var _0x4bfaf9;logger[_0x06f8('0xc')](util[_0x06f8('0xd')](_0x06f8('0xe'),EXTRACTED_REPORT_ID,_0x06f8('0xf')));return db[_0x06f8('0x10')][_0x06f8('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeCsv']})[_0x06f8('0x12')](function(_0xad739d){if(_0xad739d){_0x4bfaf9=_0xad739d;_0x57c104=_0x4bfaf9[_0x06f8('0x13')]||0x1388;}})[_0x06f8('0x12')](function(){return dbH[_0x06f8('0x14')][_0x06f8('0x15')](util[_0x06f8('0xd')](_0x06f8('0x16'),QUERY),{'type':dbH['sequelize'][_0x06f8('0x17')][_0x06f8('0x18')]});})[_0x06f8('0x12')](function(_0x5a1375){if(!_0x5a1375[0x0][_0x06f8('0x19')]){return analyticExtractedReport(_0x06f8('0x1a'));}var _0x42806f=[];var _0x500063=0x0;if(_0x4bfaf9['split']){if(_0x5a1375&&_0x5a1375[_0x06f8('0x1b')]){var _0x5130c7=_[_0x06f8('0x1c')](_0x5a1375[0x0][_0x06f8('0x19')]/_0x57c104);var _0x121dd3=Number['isInteger'](_0x5a1375[0x0][_0x06f8('0x19')]/_0x57c104)?_0x5a1375[0x0][_0x06f8('0x19')]%_0x57c104:0x0;_0x5130c7[_0x06f8('0x1d')](function(_0x20b8e9){if(_0x20b8e9>0x0){_0x500063+=_0x57c104;}_0x42806f[_0x06f8('0x1e')](dbH[_0x06f8('0x14')][_0x06f8('0x15')](util[_0x06f8('0xd')](_0x06f8('0x1f'),QUERY,_0x57c104,_0x500063),{'type':dbH[_0x06f8('0x14')]['QueryTypes'][_0x06f8('0x18')]}));});if(_0x121dd3>0x0){_0x500063+=_0x57c104;_0x42806f['push'](dbH[_0x06f8('0x14')]['query'](util[_0x06f8('0xd')](_0x06f8('0x1f'),QUERY,_0x121dd3,_0x500063),{'type':dbH[_0x06f8('0x14')][_0x06f8('0x17')][_0x06f8('0x18')]}));}}}else{_0x42806f[_0x06f8('0x1e')](dbH[_0x06f8('0x14')][_0x06f8('0x15')](QUERY,{'type':dbH['sequelize'][_0x06f8('0x17')][_0x06f8('0x18')]}));}var _0x98b4b=path[_0x06f8('0x20')](PATH);var _0x3b0f43=path[_0x06f8('0x21')](PATH,_0x06f8('0x22'));var _0x8acf93=_0x4bfaf9[_0x06f8('0x23')]&&_0x42806f[_0x06f8('0x1b')]>0x1;var _0x9e394e=[];if(!fs[_0x06f8('0x24')](path[_0x06f8('0x25')](_0x98b4b,_0x3b0f43))&&_0x8acf93){fs[_0x06f8('0x26')](path[_0x06f8('0x25')](_0x98b4b,_0x3b0f43));}return BPromise[_0x06f8('0x27')](_0x42806f,function(_0x24ca80){_0x9e394e[_0x06f8('0x1e')](_0x24ca80);})[_0x06f8('0x12')](function(){for(var _0x182481=0x0;_0x182481<_0x9e394e['length'];_0x182481+=0x1){var _0x1fc78c;var _0x584cd0=_0x9e394e[_0x182481];if(_0x8acf93){_0x1fc78c=path[_0x06f8('0x25')](_0x98b4b,_0x3b0f43,util[_0x06f8('0xd')](_0x06f8('0x28'),_0x3b0f43,_0x182481,'csv'));}else{_0x1fc78c=path['join'](_0x98b4b,util[_0x06f8('0xd')]('%s.%s',_0x3b0f43,_0x06f8('0x29')));}fs[_0x06f8('0x2a')](_0x1fc78c,csv(_0x584cd0));}})[_0x06f8('0x12')](function(){if(_0x8acf93){return new Promise(function(_0x14e299){zipdir(path[_0x06f8('0x25')](_0x98b4b,_0x3b0f43),{'saveTo':path['join'](_0x98b4b,util['format'](_0x06f8('0x2b'),_0x3b0f43,_0x06f8('0x2c')))},function(_0x3d36c6,_0xfdf2c4){rimraf(path[_0x06f8('0x25')](_0x98b4b,_0x3b0f43),function(){});_0x14e299(_0x06f8('0x2d'));});});}})['then'](function(){logger['info'](util['format'](_0x06f8('0x2e'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x06f8('0x2f'),_0x8acf93?util['format']('%s.%s',_0x3b0f43,_0x8acf93?'zip':_0x06f8('0x29')):null);});})[_0x06f8('0x30')](function(_0x21ac2f){logger['info'](util[_0x06f8('0xd')](_0x06f8('0x31'),EXTRACTED_REPORT_ID,_0x06f8('0xf')),util['inspect'](_0x21ac2f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x06f8('0x32'));})['finally'](function(){process[_0x06f8('0x33')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 6ef806c..727fa33 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 _0x4661=['isInteger','query','sequelize','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.pdf','existsSync','mkdirSync','join','each','createPdfKitDocument','%s%d.%s','pdf','%s.%s','zip','zip\x20finished','PDF','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','finish','end','createPdfFromHTML','path','lodash','util','moment','html-to-pdfmake','zip-dir','rimraf','jsdom','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','map','tableHeader','pick','toString','value','auto','body','push','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','length','margin','\x20/\x20','Arial','black','right','num','Empty','Setting','find','split','then'];(function(_0x1a1222,_0x11619d){var _0x5267c8=function(_0x4ba286){while(--_0x4ba286){_0x1a1222['push'](_0x1a1222['shift']());}};_0x5267c8(++_0x11619d);}(_0x4661,0x12e));var _0x1466=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x4661[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x1466('0x0'));var fs=require('fs');var util=require(_0x1466('0x1'));var path=require('path');var moment=require(_0x1466('0x2'));var htmlToPdfmake=require(_0x1466('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x1466('0x4'));var rimraf=require(_0x1466('0x5'));var JSDOM=require(_0x1466('0x6'))['JSDOM'];var window=new JSDOM('')[_0x1466('0x7')];var BPromise=require(_0x1466('0x8'));var db=require(_0x1466('0x9'))['db'];var dbH=require(_0x1466('0x9'))[_0x1466('0xa')];var logger=require(_0x1466('0xb'))(_0x1466('0xc'));var EXTRACTED_REPORT_ID=Number(process[_0x1466('0xd')][0x2]);var QUERY=process[_0x1466('0xd')][0x3];var PATH=process[_0x1466('0xd')][0x4];var NAME=process[_0x1466('0xd')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x3477c0,_0x113a6b){var _0x1ef4b2={'status':_0x3477c0};var _0x5f0745={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x113a6b){_0x1ef4b2['savename']=_0x113a6b;}return db[_0x1466('0xe')]['update'](_0x1ef4b2,_0x5f0745);}function getHeaders(_0x873f6c){return _[_0x1466('0xf')](_0x873f6c,function(_0x1555bd){return{'text':_0x1555bd,'style':_0x1466('0x10')};});}function getRows(_0x11fa34,_0xff8908){return _[_0x1466('0xf')](_0xff8908,function(_0x500c01){return _(_0x500c01)[_0x1466('0x11')](_0x11fa34)[_0x1466('0xf')](function(_0x467ead){return _0x467ead?_[_0x1466('0x12')](_0x467ead):'';})[_0x1466('0x13')]();});}function createTable(_0x1db988,_0x19e55b){var _0xc177f0={'widths':_['fill'](Array(_0x1db988['length']),0x91),'heights':function(_0x16f6fd){return _0x16f6fd===0x0?_0x1466('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x1bb4df=getHeaders(_0x1db988);_0xc177f0[_0x1466('0x15')][_0x1466('0x16')](_0x1bb4df);var _0x170244=getRows(_0x1db988,_0x19e55b);_0xc177f0[_0x1466('0x15')]=_0xc177f0[_0x1466('0x15')]['concat'](_0x170244);return _0xc177f0;}function createTables(_0x32076f){var _0x4dd6db=[];var _0x176362=_['chunk'](Object[_0x1466('0x17')](_0x32076f[0x0]),0x5);_0x176362[_0x1466('0x18')](function(_0xb8ef6c){_0x4dd6db[_0x1466('0x16')](createTable(_0xb8ef6c,_0x32076f));});return _0x4dd6db;}function getPDFDocDefinition(_0x2480d5){var _0x2d5fec=util[_0x1466('0x19')](_0x1466('0x1a'),NAME,EXTRACTED_REPORT[_0x1466('0x1b')],moment(EXTRACTED_REPORT[_0x1466('0x1c')])[_0x1466('0x19')](FORMAT),moment(EXTRACTED_REPORT[_0x1466('0x1d')])[_0x1466('0x19')](FORMAT));var _0x40300c=[];for(var _0x240bb1=0x0;_0x240bb1<_0x2480d5[_0x1466('0x1e')];_0x240bb1++){var _0x540819=[];if(_0x240bb1===0x0){_0x540819[_0x1466('0x16')]({'text':_0x2d5fec,'style':'header'});}var _0x51fc23={'table':_0x2480d5[_0x240bb1]};if(_0x240bb1>0x0){_0x51fc23['pageBreak']='before';_0x51fc23[_0x1466('0x1f')]=[0x0,0x46,0x0,0x0];}_0x540819[_0x1466('0x16')](_0x51fc23);_0x40300c['push'](_0x540819);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x40300c,'footer':function(_0x3d19d5,_0x1b86cd){return{'text':_0x3d19d5['toString']()+_0x1466('0x20')+_0x1b86cd,'style':'footer'};},'defaultStyle':{'font':_0x1466('0x21')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x1466('0x22')},'footer':{'alignment':_0x1466('0x23'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x3ee1a4){var _0x358d08=0x1388;var _0x435026;if(!_0x3ee1a4[0x0][_0x1466('0x24')]){return analyticExtractedReport(_0x1466('0x25'));}return db[_0x1466('0x26')][_0x1466('0x27')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1466('0x28'),'splitSizePdf']})[_0x1466('0x29')](function(_0x1f826b){if(_0x1f826b){_0x435026=_0x1f826b;_0x358d08=_0x435026['splitSizePdf']||0x3e8;}})['then'](function(){var _0x478f81=[];var _0x4429b7=0x0;if(_0x435026['split']){if(_0x3ee1a4&&_0x3ee1a4[_0x1466('0x1e')]){var _0x5be0f9=_['range'](_0x3ee1a4[0x0][_0x1466('0x24')]/_0x358d08);var _0x4a0e66=Number[_0x1466('0x2a')](_0x3ee1a4[0x0]['num']/_0x358d08)?_0x3ee1a4[0x0][_0x1466('0x24')]%_0x358d08:0x0;_0x5be0f9['forEach'](function(_0x120642){if(_0x120642>0x0){_0x4429b7+=_0x358d08;}_0x478f81['push'](dbH['sequelize'][_0x1466('0x2b')](util[_0x1466('0x19')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x358d08,_0x4429b7),{'type':dbH[_0x1466('0x2c')][_0x1466('0x2d')][_0x1466('0x2e')]}));});if(_0x4a0e66>0x0){_0x4429b7+=_0x358d08;_0x478f81[_0x1466('0x16')](dbH[_0x1466('0x2c')][_0x1466('0x2b')](util[_0x1466('0x19')](_0x1466('0x2f'),QUERY,_0x4a0e66,_0x4429b7),{'type':dbH[_0x1466('0x2c')]['QueryTypes'][_0x1466('0x2e')]}));}}}else{_0x478f81[_0x1466('0x16')](dbH[_0x1466('0x2c')][_0x1466('0x2b')](QUERY,{'type':dbH[_0x1466('0x2c')][_0x1466('0x2d')]['SELECT']}));}var _0x2cedd7=path[_0x1466('0x30')](PATH);var _0x34c0e6=path[_0x1466('0x31')](PATH,_0x1466('0x32'));var _0x318720=_0x435026[_0x1466('0x28')]&&_0x478f81[_0x1466('0x1e')]>0x1;var _0x8d8fa2=[];if(!fs[_0x1466('0x33')](path['join'](_0x2cedd7,_0x34c0e6))&&_0x318720){fs[_0x1466('0x34')](path[_0x1466('0x35')](_0x2cedd7,_0x34c0e6));}return BPromise[_0x1466('0x36')](_0x478f81,function(_0x258288){_0x8d8fa2[_0x1466('0x16')](_0x258288);})[_0x1466('0x29')](function(){var _0x3aa229=[];for(var _0xb021e1=0x0;_0xb021e1<_0x8d8fa2[_0x1466('0x1e')];_0xb021e1+=0x1){var _0x380be4=_0x8d8fa2[_0xb021e1];var _0x42c74d=createTables(_['flatten'](_0x380be4));var _0x13f3fe;var _0x7bcacb=getPDFDocDefinition(_0x42c74d);var _0x4a9ad9=getPDFPrinter();var _0x2d5056=_0x4a9ad9[_0x1466('0x37')](_0x7bcacb);if(_0x318720){_0x13f3fe=path['join'](_0x2cedd7,_0x34c0e6,util[_0x1466('0x19')](_0x1466('0x38'),_0x34c0e6,_0xb021e1,_0x1466('0x39')));}else{_0x13f3fe=path['join'](_0x2cedd7,util['format'](_0x1466('0x3a'),_0x34c0e6,_0x1466('0x39')));}_0x3aa229[_0x1466('0x16')](writePDFDocument(_0x2d5056,_0x13f3fe));}return Promise['all'](_0x3aa229);})[_0x1466('0x29')](function(){if(_0x318720){return new Promise(function(_0x3f0c9d){zipdir(path[_0x1466('0x35')](_0x2cedd7,_0x34c0e6),{'saveTo':path[_0x1466('0x35')](_0x2cedd7,util[_0x1466('0x19')](_0x1466('0x3a'),_0x34c0e6,_0x1466('0x3b')))},function(){rimraf(path[_0x1466('0x35')](_0x2cedd7,_0x34c0e6),function(){});_0x3f0c9d(_0x1466('0x3c'));});});}})[_0x1466('0x29')](function(){if(!_0x318720)return;rimraf(path['join'](_0x2cedd7,_0x34c0e6),function(){});})[_0x1466('0x29')](function(){logger['info'](util[_0x1466('0x19')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x1466('0x3d')));return analyticExtractedReport('Completed',_0x318720?util[_0x1466('0x19')]('%s.%s',_0x34c0e6,_0x318720?_0x1466('0x3b'):_0x1466('0x39')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x1466('0x19')](_0x1466('0x3e'),EXTRACTED_REPORT_ID,_0x1466('0x3d')));return db[_0x1466('0xe')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x1466('0x29')](function(_0x59ace7){EXTRACTED_REPORT=_0x59ace7;return dbH[_0x1466('0x2c')][_0x1466('0x2b')](util[_0x1466('0x19')](_0x1466('0x3f'),QUERY),{'type':dbH[_0x1466('0x2c')]['QueryTypes']['SELECT']});})['then'](extractReport)[_0x1466('0x40')](function(_0x55e238){logger[_0x1466('0x41')](util[_0x1466('0x19')](_0x1466('0x42'),EXTRACTED_REPORT_ID,'PDF'),util[_0x1466('0x43')](_0x55e238,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1466('0x44'));})['finally'](function(){process[_0x1466('0x45')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x712dc2=new PdfPrinter({'Arial':{'normal':__dirname+_0x1466('0x46'),'bold':__dirname+_0x1466('0x47'),'italics':__dirname+_0x1466('0x48'),'bolditalics':__dirname+_0x1466('0x49')}});return _0x712dc2;}function getPDFDocDefinitionFromHTML(_0x580ee9,_0x121752){var _0x21df7c=util['format'](_0x1466('0x4a'),_0x121752['channel'],_0x121752[_0x1466('0x4b')]);var _0x1b52e5=moment()[_0x1466('0x19')](_0x1466('0x4c'))[_0x1466('0x12')]();var _0x2a7dce=htmlToPdfmake(_0x580ee9,{'window':window,'tableAutoSize':!![]});return{'content':[_0x2a7dce],'defaultStyle':{'font':_0x1466('0x21')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x1466('0x4d'),'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':_0x1466('0x4d')}},'header':function(){return[{'text':_0x1466('0x4e'),'style':'header'}];},'footer':function(_0x3dad5a,_0x39697e){return[{'text':util[_0x1466('0x19')](_0x1466('0x4f'),_0x21df7c,_0x3dad5a,_0x39697e,_0x1b52e5),'style':_0x1466('0x50')}];}};}function writePDFDocument(_0xf11b5c,_0x4c9dc1){return new Promise(function(_0x4f4677,_0x5d7602){var _0x172eff=_0xf11b5c[_0x1466('0x51')](fs['createWriteStream'](_0x4c9dc1));_0x172eff['on'](_0x1466('0x52'),function(){_0x4f4677(_0x1466('0x52'));});_0x172eff['on']('error',function(_0x5811a0){_0x5d7602(_0x5811a0);});_0xf11b5c[_0x1466('0x53')]();});}exports[_0x1466('0x54')]=function(_0xf0a41,_0x442bb6){var _0x63cec2=getPDFPrinter();var _0x1e4527=getPDFDocDefinitionFromHTML(_0xf0a41,_0x442bb6);var _0x3d27e7=_0x63cec2[_0x1466('0x37')](_0x1e4527);return writePDFDocument(_0x3d27e7,_0x442bb6[_0x1466('0x55')])['catch'](function(_0x53e278){throw _0x53e278;});}; \ No newline at end of file +var _0x7cb1=['lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','jsdom','window','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','fill','length','push','body','concat','chunk','keys','forEach','format','name','header','pageBreak','margin','landscape','footer','Arial','black','right','find','splitSizePdf','then','range','num','isInteger','sequelize','query','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.pdf','split','existsSync','each','flatten','join','%s%d.%s','pdf','all','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','end','createPdfFromHTML','createPdfKitDocument'];(function(_0x3816c2,_0xb221e1){var _0x144669=function(_0x149c29){while(--_0x149c29){_0x3816c2['push'](_0x3816c2['shift']());}};_0x144669(++_0xb221e1);}(_0x7cb1,0xb6));var _0x17cb=function(_0x330873,_0x1198b5){_0x330873=_0x330873-0x0;var _0x2ffd4d=_0x7cb1[_0x330873];return _0x2ffd4d;};'use strict';var _=require(_0x17cb('0x0'));var fs=require('fs');var util=require(_0x17cb('0x1'));var path=require(_0x17cb('0x2'));var moment=require(_0x17cb('0x3'));var htmlToPdfmake=require(_0x17cb('0x4'));var PdfPrinter=require(_0x17cb('0x5'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var JSDOM=require(_0x17cb('0x6'))['JSDOM'];var window=new JSDOM('')[_0x17cb('0x7')];var BPromise=require('bluebird');var db=require(_0x17cb('0x8'))['db'];var dbH=require(_0x17cb('0x8'))[_0x17cb('0x9')];var logger=require(_0x17cb('0xa'))(_0x17cb('0xb'));var EXTRACTED_REPORT_ID=Number(process[_0x17cb('0xc')][0x2]);var QUERY=process[_0x17cb('0xc')][0x3];var PATH=process[_0x17cb('0xc')][0x4];var NAME=process[_0x17cb('0xc')][0x5];var FORMAT=_0x17cb('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1193de,_0x3a4b11){var _0x11797c={'status':_0x1193de};var _0x595155={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3a4b11){_0x11797c[_0x17cb('0xe')]=_0x3a4b11;}return db[_0x17cb('0xf')][_0x17cb('0x10')](_0x11797c,_0x595155);}function getHeaders(_0x401a4a){return _[_0x17cb('0x11')](_0x401a4a,function(_0x4de889){return{'text':_0x4de889,'style':_0x17cb('0x12')};});}function getRows(_0x18783d,_0x15c7c7){return _[_0x17cb('0x11')](_0x15c7c7,function(_0xfe5fee){return _(_0xfe5fee)[_0x17cb('0x13')](_0x18783d)[_0x17cb('0x11')](function(_0x4d5ccc){return _0x4d5ccc?_[_0x17cb('0x14')](_0x4d5ccc):'';})[_0x17cb('0x15')]();});}function createTable(_0x1276b2,_0x4eb1bf){var _0x26b0b0={'widths':_[_0x17cb('0x16')](Array(_0x1276b2[_0x17cb('0x17')]),0x91),'heights':function(_0x29d635){return _0x29d635===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x5a227d=getHeaders(_0x1276b2);_0x26b0b0['body'][_0x17cb('0x18')](_0x5a227d);var _0x28df6f=getRows(_0x1276b2,_0x4eb1bf);_0x26b0b0[_0x17cb('0x19')]=_0x26b0b0[_0x17cb('0x19')][_0x17cb('0x1a')](_0x28df6f);return _0x26b0b0;}function createTables(_0x5cd507){var _0x30297f=[];var _0x3f582a=_[_0x17cb('0x1b')](Object[_0x17cb('0x1c')](_0x5cd507[0x0]),0x5);_0x3f582a[_0x17cb('0x1d')](function(_0x4580cf){_0x30297f[_0x17cb('0x18')](createTable(_0x4580cf,_0x5cd507));});return _0x30297f;}function getPDFDocDefinition(_0x505148){var _0x41dbe8=util[_0x17cb('0x1e')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x17cb('0x1f')],moment(EXTRACTED_REPORT['startDate'])[_0x17cb('0x1e')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x17cb('0x1e')](FORMAT));var _0x6ad508=[];for(var _0x2b390c=0x0;_0x2b390c<_0x505148['length'];_0x2b390c++){var _0x159bd9=[];if(_0x2b390c===0x0){_0x159bd9[_0x17cb('0x18')]({'text':_0x41dbe8,'style':_0x17cb('0x20')});}var _0xa923ab={'table':_0x505148[_0x2b390c]};if(_0x2b390c>0x0){_0xa923ab[_0x17cb('0x21')]='before';_0xa923ab[_0x17cb('0x22')]=[0x0,0x46,0x0,0x0];}_0x159bd9[_0x17cb('0x18')](_0xa923ab);_0x6ad508[_0x17cb('0x18')](_0x159bd9);}return{'pageSize':'A4','pageOrientation':_0x17cb('0x23'),'content':_0x6ad508,'footer':function(_0x54e8fe,_0x1cc596){return{'text':_0x54e8fe['toString']()+'\x20/\x20'+_0x1cc596,'style':_0x17cb('0x24')};},'defaultStyle':{'font':_0x17cb('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x17cb('0x26')},'footer':{'alignment':_0x17cb('0x27'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x5f4c8b){var _0x2fc526=0x1388;var _0x4fcebc;if(!_0x5f4c8b[0x0]['num']){return analyticExtractedReport('Empty');}return db['Setting'][_0x17cb('0x28')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x17cb('0x29')]})[_0x17cb('0x2a')](function(_0x15eb8d){if(_0x15eb8d){_0x4fcebc=_0x15eb8d;_0x2fc526=_0x4fcebc['splitSizePdf']||0x3e8;}})['then'](function(){var _0x43ad52=[];var _0x44ce64=0x0;if(_0x4fcebc['split']){if(_0x5f4c8b&&_0x5f4c8b[_0x17cb('0x17')]){var _0x3ef3e5=_[_0x17cb('0x2b')](_0x5f4c8b[0x0][_0x17cb('0x2c')]/_0x2fc526);var _0x3b2a17=Number[_0x17cb('0x2d')](_0x5f4c8b[0x0]['num']/_0x2fc526)?_0x5f4c8b[0x0][_0x17cb('0x2c')]%_0x2fc526:0x0;_0x3ef3e5[_0x17cb('0x1d')](function(_0x5ce1ba){if(_0x5ce1ba>0x0){_0x44ce64+=_0x2fc526;}_0x43ad52[_0x17cb('0x18')](dbH[_0x17cb('0x2e')][_0x17cb('0x2f')](util[_0x17cb('0x1e')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2fc526,_0x44ce64),{'type':dbH['sequelize'][_0x17cb('0x30')][_0x17cb('0x31')]}));});if(_0x3b2a17>0x0){_0x44ce64+=_0x2fc526;_0x43ad52[_0x17cb('0x18')](dbH[_0x17cb('0x2e')]['query'](util[_0x17cb('0x1e')](_0x17cb('0x32'),QUERY,_0x3b2a17,_0x44ce64),{'type':dbH['sequelize'][_0x17cb('0x30')][_0x17cb('0x31')]}));}}}else{_0x43ad52['push'](dbH[_0x17cb('0x2e')][_0x17cb('0x2f')](QUERY,{'type':dbH[_0x17cb('0x2e')][_0x17cb('0x30')]['SELECT']}));}var _0x445335=path[_0x17cb('0x33')](PATH);var _0x4c466b=path[_0x17cb('0x34')](PATH,_0x17cb('0x35'));var _0x40dcdf=_0x4fcebc[_0x17cb('0x36')]&&_0x43ad52[_0x17cb('0x17')]>0x1;var _0x51dc44=[];if(!fs[_0x17cb('0x37')](path['join'](_0x445335,_0x4c466b))&&_0x40dcdf){fs['mkdirSync'](path['join'](_0x445335,_0x4c466b));}return BPromise[_0x17cb('0x38')](_0x43ad52,function(_0x27d38c){_0x51dc44[_0x17cb('0x18')](_0x27d38c);})[_0x17cb('0x2a')](function(){var _0x3d92bb=[];for(var _0x242baf=0x0;_0x242baf<_0x51dc44[_0x17cb('0x17')];_0x242baf+=0x1){var _0x557329=_0x51dc44[_0x242baf];var _0x41e3fd=createTables(_[_0x17cb('0x39')](_0x557329));var _0x4dab17;var _0x517503=getPDFDocDefinition(_0x41e3fd);var _0x46f005=getPDFPrinter();var _0x4d646c=_0x46f005['createPdfKitDocument'](_0x517503);if(_0x40dcdf){_0x4dab17=path[_0x17cb('0x3a')](_0x445335,_0x4c466b,util[_0x17cb('0x1e')](_0x17cb('0x3b'),_0x4c466b,_0x242baf,'pdf'));}else{_0x4dab17=path[_0x17cb('0x3a')](_0x445335,util['format']('%s.%s',_0x4c466b,_0x17cb('0x3c')));}_0x3d92bb[_0x17cb('0x18')](writePDFDocument(_0x4d646c,_0x4dab17));}return Promise[_0x17cb('0x3d')](_0x3d92bb);})[_0x17cb('0x2a')](function(){if(_0x40dcdf){return new Promise(function(_0x1e93f0){zipdir(path[_0x17cb('0x3a')](_0x445335,_0x4c466b),{'saveTo':path[_0x17cb('0x3a')](_0x445335,util[_0x17cb('0x1e')](_0x17cb('0x3e'),_0x4c466b,_0x17cb('0x3f')))},function(){rimraf(path[_0x17cb('0x3a')](_0x445335,_0x4c466b),function(){});_0x1e93f0(_0x17cb('0x40'));});});}})['then'](function(){if(!_0x40dcdf)return;rimraf(path[_0x17cb('0x3a')](_0x445335,_0x4c466b),function(){});})[_0x17cb('0x2a')](function(){logger[_0x17cb('0x41')](util[_0x17cb('0x1e')](_0x17cb('0x42'),EXTRACTED_REPORT_ID,_0x17cb('0x43')));return analyticExtractedReport(_0x17cb('0x44'),_0x40dcdf?util[_0x17cb('0x1e')](_0x17cb('0x3e'),_0x4c466b,_0x40dcdf?'zip':_0x17cb('0x3c')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x17cb('0x41')](util[_0x17cb('0x1e')](_0x17cb('0x45'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x17cb('0xf')][_0x17cb('0x46')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x17cb('0x2a')](function(_0x33269b){EXTRACTED_REPORT=_0x33269b;return dbH[_0x17cb('0x2e')][_0x17cb('0x2f')](util[_0x17cb('0x1e')](_0x17cb('0x47'),QUERY),{'type':dbH[_0x17cb('0x2e')][_0x17cb('0x30')][_0x17cb('0x31')]});})[_0x17cb('0x2a')](extractReport)[_0x17cb('0x48')](function(_0x502f11){logger[_0x17cb('0x41')](util['format'](_0x17cb('0x49'),EXTRACTED_REPORT_ID,'PDF'),util[_0x17cb('0x4a')](_0x502f11,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x17cb('0x4b'));})[_0x17cb('0x4c')](function(){process[_0x17cb('0x4d')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x1e6680=new PdfPrinter({'Arial':{'normal':__dirname+_0x17cb('0x4e'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x1e6680;}function getPDFDocDefinitionFromHTML(_0x200093,_0x4c5663){var _0x3a0725=util[_0x17cb('0x1e')](_0x17cb('0x4f'),_0x4c5663[_0x17cb('0x50')],_0x4c5663[_0x17cb('0x51')]);var _0x16c80c=moment()[_0x17cb('0x1e')](_0x17cb('0x52'))[_0x17cb('0x14')]();var _0x4eb5aa=htmlToPdfmake(_0x200093,{'window':window,'tableAutoSize':!![]});return{'content':[_0x4eb5aa],'defaultStyle':{'font':_0x17cb('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x17cb('0x53'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x17cb('0x53'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x17cb('0x53')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x17cb('0x20')}];},'footer':function(_0x1ce748,_0x1b3c40){return[{'text':util['format'](_0x17cb('0x54'),_0x3a0725,_0x1ce748,_0x1b3c40,_0x16c80c),'style':'footer'}];}};}function writePDFDocument(_0x58cf11,_0x3427e7){return new Promise(function(_0x28cf5d,_0x41c63b){var _0x4850c2=_0x58cf11[_0x17cb('0x55')](fs[_0x17cb('0x56')](_0x3427e7));_0x4850c2['on'](_0x17cb('0x57'),function(){_0x28cf5d('finish');});_0x4850c2['on']('error',function(_0x5df71e){_0x41c63b(_0x5df71e);});_0x58cf11[_0x17cb('0x58')]();});}exports[_0x17cb('0x59')]=function(_0x17c019,_0x2c0297){var _0x17a03e=getPDFPrinter();var _0x52c8d5=getPDFDocDefinitionFromHTML(_0x17c019,_0x2c0297);var _0x2e9964=_0x17a03e[_0x17cb('0x5a')](_0x52c8d5);return writePDFDocument(_0x2e9964,_0x2c0297[_0x17cb('0x2')])['catch'](function(_0x3afc48){throw _0x3afc48;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 1031e10..77629b1 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 _0xc808=['../../config/logger','analytics','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','num','Empty','length','range','isInteger','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','writeFileSync','binary','zip','zip\x20finished','%s.%s','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','exit','util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH'];(function(_0x11abe0,_0x23bcc6){var _0x117940=function(_0x3746d8){while(--_0x3746d8){_0x11abe0['push'](_0x11abe0['shift']());}};_0x117940(++_0x23bcc6);}(_0xc808,0x97));var _0x8c80=function(_0x2b47ad,_0x55c7cc){_0x2b47ad=_0x2b47ad-0x0;var _0x1a2426=_0xc808[_0x2b47ad];return _0x1a2426;};'use strict';var util=require(_0x8c80('0x0'));var path=require(_0x8c80('0x1'));var _=require(_0x8c80('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x8c80('0x3'));var zipdir=require(_0x8c80('0x4'));var rimraf=require(_0x8c80('0x5'));var db=require(_0x8c80('0x6'))['db'];var dbH=require(_0x8c80('0x6'))[_0x8c80('0x7')];var logger=require(_0x8c80('0x8'))(_0x8c80('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x8c80('0xa')][0x2]);var QUERY=process[_0x8c80('0xa')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4f2902,_0xf929ab){var _0x5468a3={'status':_0x4f2902};var _0x2ec495={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xf929ab){_0x5468a3[_0x8c80('0xb')]=_0xf929ab;}return db['AnalyticExtractedReport'][_0x8c80('0xc')](_0x5468a3,_0x2ec495);}function main(){var _0x12a111=0x1388;var _0x3b8765;logger[_0x8c80('0xd')](util[_0x8c80('0xe')](_0x8c80('0xf'),EXTRACTED_REPORT_ID,_0x8c80('0x10')));return db[_0x8c80('0x11')][_0x8c80('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x8c80('0x13'),_0x8c80('0x14')]})[_0x8c80('0x15')](function(_0x1aa841){if(_0x1aa841){_0x3b8765=_0x1aa841;_0x12a111=_0x3b8765[_0x8c80('0x14')]||0x1388;}})['then'](function(){return dbH[_0x8c80('0x16')]['query'](util[_0x8c80('0xe')](_0x8c80('0x17'),QUERY),{'type':dbH[_0x8c80('0x16')]['QueryTypes']['SELECT']});})[_0x8c80('0x15')](function(_0x374c48){if(!_0x374c48[0x0][_0x8c80('0x18')]){return analyticExtractedReport(_0x8c80('0x19'));}var _0x314570=[];var _0x545b0f=0x0;if(_0x3b8765[_0x8c80('0x13')]){if(_0x374c48&&_0x374c48[_0x8c80('0x1a')]){var _0x498181=_[_0x8c80('0x1b')](_0x374c48[0x0]['num']/_0x12a111);var _0x384023=Number[_0x8c80('0x1c')](_0x374c48[0x0][_0x8c80('0x18')]/_0x12a111)?_0x374c48[0x0][_0x8c80('0x18')]%_0x12a111:0x0;_0x498181[_0x8c80('0x1d')](function(_0x541f88){if(_0x541f88>0x0){_0x545b0f+=_0x12a111;}_0x314570[_0x8c80('0x1e')](dbH[_0x8c80('0x16')][_0x8c80('0x1f')](util[_0x8c80('0xe')](_0x8c80('0x20'),QUERY,_0x12a111,_0x545b0f),{'type':dbH[_0x8c80('0x16')][_0x8c80('0x21')]['SELECT']}));});if(_0x384023>0x0){_0x545b0f+=_0x12a111;_0x314570['push'](dbH[_0x8c80('0x16')][_0x8c80('0x1f')](util[_0x8c80('0xe')](_0x8c80('0x20'),QUERY,_0x384023,_0x545b0f),{'type':dbH[_0x8c80('0x16')]['QueryTypes'][_0x8c80('0x22')]}));}}}else{_0x314570[_0x8c80('0x1e')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x8c80('0x16')][_0x8c80('0x21')][_0x8c80('0x22')]}));}var _0x3fcec3=path[_0x8c80('0x23')](PATH);var _0x157bb5=path[_0x8c80('0x24')](PATH,_0x8c80('0x25'));var _0x36e059=_0x3b8765[_0x8c80('0x13')]&&_0x314570['length']>0x1;var _0x11a075=[];if(!fs[_0x8c80('0x26')](path[_0x8c80('0x27')](_0x3fcec3,_0x157bb5))&&_0x36e059){fs[_0x8c80('0x28')](path['join'](_0x3fcec3,_0x157bb5));}return BPromise[_0x8c80('0x29')](_0x314570,function(_0x5b57ce){_0x11a075[_0x8c80('0x1e')](_0x5b57ce);})[_0x8c80('0x15')](function(){for(var _0x5d1d4c=0x0;_0x5d1d4c<_0x11a075['length'];_0x5d1d4c+=0x1){var _0x4c267c;var _0x4a4303=_0x11a075[_0x5d1d4c];if(_0x36e059){_0x4c267c=path['join'](_0x3fcec3,_0x157bb5,util['format'](_0x8c80('0x2a'),_0x157bb5,_0x5d1d4c,_0x8c80('0x2b')));}else{_0x4c267c=path[_0x8c80('0x27')](_0x3fcec3,util[_0x8c80('0xe')]('%s.%s',_0x157bb5,_0x8c80('0x2b')));}fs[_0x8c80('0x2c')](_0x4c267c,json2xls(_0x4a4303),_0x8c80('0x2d'));}})['then'](function(){if(_0x36e059){return new Promise(function(_0x35cd41){zipdir(path['join'](_0x3fcec3,_0x157bb5),{'saveTo':path[_0x8c80('0x27')](_0x3fcec3,util[_0x8c80('0xe')]('%s.%s',_0x157bb5,_0x8c80('0x2e')))},function(_0x41b527,_0x1b5c0e){rimraf(path[_0x8c80('0x27')](_0x3fcec3,_0x157bb5),function(){});_0x35cd41(_0x8c80('0x2f'));});});}})['then'](function(){logger[_0x8c80('0xd')](util[_0x8c80('0xe')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x8c80('0x10')));return analyticExtractedReport('Completed',_0x36e059?util['format'](_0x8c80('0x30'),_0x157bb5,_0x36e059?_0x8c80('0x2e'):'xlsx'):null);});})[_0x8c80('0x31')](function(_0x439dc4){logger['info'](util['format'](_0x8c80('0x32'),EXTRACTED_REPORT_ID,_0x8c80('0x10')),util['inspect'](_0x439dc4,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x8c80('0x33')](function(){process[_0x8c80('0x34')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xa6ac=['then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','length','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','path','json2xls','bluebird','zip-dir','../../mysqldb','../../config/logger','analytics','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','split','splitSizeXlsx'];(function(_0x5ea27c,_0x1ab085){var _0x49a664=function(_0x829505){while(--_0x829505){_0x5ea27c['push'](_0x5ea27c['shift']());}};_0x49a664(++_0x1ab085);}(_0xa6ac,0x1c5));var _0xca6a=function(_0x477950,_0x2465e9){_0x477950=_0x477950-0x0;var _0x25db25=_0xa6ac[_0x477950];return _0x25db25;};'use strict';var util=require('util');var path=require(_0xca6a('0x0'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0xca6a('0x1'));var BPromise=require(_0xca6a('0x2'));var zipdir=require(_0xca6a('0x3'));var rimraf=require('rimraf');var db=require(_0xca6a('0x4'))['db'];var dbH=require(_0xca6a('0x4'))['dbH'];var logger=require(_0xca6a('0x5'))(_0xca6a('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0xca6a('0x7')][0x2]);var QUERY=process[_0xca6a('0x7')][0x3];var PATH=process[_0xca6a('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x521d96,_0x3c61c2){var _0x4742c2={'status':_0x521d96};var _0x119396={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3c61c2){_0x4742c2[_0xca6a('0x8')]=_0x3c61c2;}return db['AnalyticExtractedReport'][_0xca6a('0x9')](_0x4742c2,_0x119396);}function main(){var _0x491828=0x1388;var _0x27bee6;logger[_0xca6a('0xa')](util[_0xca6a('0xb')](_0xca6a('0xc'),EXTRACTED_REPORT_ID,_0xca6a('0xd')));return db['Setting'][_0xca6a('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xca6a('0xf'),_0xca6a('0x10')]})[_0xca6a('0x11')](function(_0x5b108b){if(_0x5b108b){_0x27bee6=_0x5b108b;_0x491828=_0x27bee6[_0xca6a('0x10')]||0x1388;}})[_0xca6a('0x11')](function(){return dbH[_0xca6a('0x12')][_0xca6a('0x13')](util[_0xca6a('0xb')](_0xca6a('0x14'),QUERY),{'type':dbH['sequelize'][_0xca6a('0x15')][_0xca6a('0x16')]});})[_0xca6a('0x11')](function(_0x2ef1e3){if(!_0x2ef1e3[0x0][_0xca6a('0x17')]){return analyticExtractedReport(_0xca6a('0x18'));}var _0x3d8df0=[];var _0x4d0c94=0x0;if(_0x27bee6[_0xca6a('0xf')]){if(_0x2ef1e3&&_0x2ef1e3['length']){var _0x1f9158=_['range'](_0x2ef1e3[0x0]['num']/_0x491828);var _0x9422b6=Number['isInteger'](_0x2ef1e3[0x0]['num']/_0x491828)?_0x2ef1e3[0x0][_0xca6a('0x17')]%_0x491828:0x0;_0x1f9158['forEach'](function(_0x297286){if(_0x297286>0x0){_0x4d0c94+=_0x491828;}_0x3d8df0[_0xca6a('0x19')](dbH[_0xca6a('0x12')]['query'](util[_0xca6a('0xb')](_0xca6a('0x1a'),QUERY,_0x491828,_0x4d0c94),{'type':dbH['sequelize']['QueryTypes'][_0xca6a('0x16')]}));});if(_0x9422b6>0x0){_0x4d0c94+=_0x491828;_0x3d8df0[_0xca6a('0x19')](dbH[_0xca6a('0x12')][_0xca6a('0x13')](util[_0xca6a('0xb')](_0xca6a('0x1a'),QUERY,_0x9422b6,_0x4d0c94),{'type':dbH[_0xca6a('0x12')][_0xca6a('0x15')][_0xca6a('0x16')]}));}}}else{_0x3d8df0[_0xca6a('0x19')](dbH[_0xca6a('0x12')]['query'](QUERY,{'type':dbH[_0xca6a('0x12')]['QueryTypes'][_0xca6a('0x16')]}));}var _0x2f4e7e=path[_0xca6a('0x1b')](PATH);var _0x5058e4=path[_0xca6a('0x1c')](PATH,_0xca6a('0x1d'));var _0x44088e=_0x27bee6[_0xca6a('0xf')]&&_0x3d8df0[_0xca6a('0x1e')]>0x1;var _0x13f0d1=[];if(!fs['existsSync'](path[_0xca6a('0x1f')](_0x2f4e7e,_0x5058e4))&&_0x44088e){fs[_0xca6a('0x20')](path[_0xca6a('0x1f')](_0x2f4e7e,_0x5058e4));}return BPromise[_0xca6a('0x21')](_0x3d8df0,function(_0x233fdc){_0x13f0d1['push'](_0x233fdc);})[_0xca6a('0x11')](function(){for(var _0x5eaf5f=0x0;_0x5eaf5f<_0x13f0d1[_0xca6a('0x1e')];_0x5eaf5f+=0x1){var _0x3ac527;var _0x2009b7=_0x13f0d1[_0x5eaf5f];if(_0x44088e){_0x3ac527=path[_0xca6a('0x1f')](_0x2f4e7e,_0x5058e4,util[_0xca6a('0xb')](_0xca6a('0x22'),_0x5058e4,_0x5eaf5f,_0xca6a('0x23')));}else{_0x3ac527=path[_0xca6a('0x1f')](_0x2f4e7e,util[_0xca6a('0xb')](_0xca6a('0x24'),_0x5058e4,'xlsx'));}fs[_0xca6a('0x25')](_0x3ac527,json2xls(_0x2009b7),_0xca6a('0x26'));}})['then'](function(){if(_0x44088e){return new Promise(function(_0x6f2b77){zipdir(path['join'](_0x2f4e7e,_0x5058e4),{'saveTo':path['join'](_0x2f4e7e,util[_0xca6a('0xb')](_0xca6a('0x24'),_0x5058e4,_0xca6a('0x27')))},function(_0x3cd806,_0x58f13e){rimraf(path[_0xca6a('0x1f')](_0x2f4e7e,_0x5058e4),function(){});_0x6f2b77('zip\x20finished');});});}})['then'](function(){logger[_0xca6a('0xa')](util[_0xca6a('0xb')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xca6a('0xd')));return analyticExtractedReport(_0xca6a('0x28'),_0x44088e?util[_0xca6a('0xb')](_0xca6a('0x24'),_0x5058e4,_0x44088e?'zip':'xlsx'):null);});})[_0xca6a('0x29')](function(_0x20d830){logger[_0xca6a('0xa')](util['format'](_0xca6a('0x2a'),EXTRACTED_REPORT_ID,_0xca6a('0xd')),util[_0xca6a('0x2b')](_0x20d830,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xca6a('0x2c'));})[_0xca6a('0x2d')](function(){process[_0xca6a('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 043ee9a..880a2c3 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 _0x6fdc=['_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','indexOf','app','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime','last','concat','Hangup','sortBy','catch','error','rewrite','lodash','util','Interval','findAll','then','intervals','IntervalId','models','VoiceExtension','map','CAST(priority\x20AS\x20UNSIGNED)','filter','exten','queue','hasOwnProperty','priority','extensions','extension','push','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','recordingFormat','none'];(function(_0x472a66,_0xcc0bcd){var _0xf99cf1=function(_0x1ab69b){while(--_0x1ab69b){_0x472a66['push'](_0x472a66['shift']());}};_0xf99cf1(++_0xcc0bcd);}(_0x6fdc,0x1f4));var _0xc6fd=function(_0x4b6830,_0x2bf6fb){_0x4b6830=_0x4b6830-0x0;var _0x239e4a=_0x6fdc[_0x4b6830];return _0x239e4a;};'use strict';var _=require(_0xc6fd('0x0'));var util=require(_0xc6fd('0x1'));function rewrite(_0x8d8e63,_0xc63926){var _0x2d3aae=this;return _0x8d8e63['models'][_0xc6fd('0x2')][_0xc6fd('0x3')]({'raw':!![]})[_0xc6fd('0x4')](function(_0xcb7d3a){_0x2d3aae[_0xc6fd('0x5')]=_0xcb7d3a;return _0x8d8e63['models']['VoiceExtension'][_0xc6fd('0x3')]({'where':{'IntervalId':_0xc63926[_0xc6fd('0x6')]},'raw':!![]});})[_0xc6fd('0x4')](function(_0x18010d){return _0x8d8e63[_0xc6fd('0x7')][_0xc6fd('0x8')][_0xc6fd('0x3')]({'where':{'exten':{'$in':_['uniq'](_[_0xc6fd('0x9')](_0x18010d,'exten'))}},'order':[{'raw':_0xc6fd('0xa')}],'raw':!![]});})[_0xc6fd('0x4')](function(_0x416843){var _0x2a43b7=_[_0xc6fd('0xb')](_0x416843,{'priority':'1'});var _0x238e0d=_[_0xc6fd('0xb')](_0x416843,{'isApp':0x1});var _0x530a77=_['groupBy'](_0x238e0d,_0xc6fd('0xc'));var _0x40a63e=[_0xc6fd('0xd'),'playback'];var _0x155e7f=[];var _0x27d9a5=[];for(var _0x2b1b76 in _0x530a77){if(_0x530a77[_0xc6fd('0xe')](_0x2b1b76)){_0x2d3aae[_0xc6fd('0xf')]=0x2;_0x2d3aae[_0xc6fd('0x10')]=[];_0x2d3aae[_0xc6fd('0x11')]=_['find'](_0x2a43b7,{'exten':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0xc')]});_0x2d3aae[_0xc6fd('0x10')][_0xc6fd('0x12')]({'type':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0x13')],'app':_0xc6fd('0x14'),'appdata':util[_0xc6fd('0x15')](_0xc6fd('0x16'),_0x530a77[_0x2b1b76][0x0][_0xc6fd('0x13')]),'context':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0x17')],'exten':_0x530a77[_0x2b1b76][0x0]['exten'],'priority':_0x2d3aae['priority']++,'VoiceExtensionId':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0x18')]});if(_0x530a77[_0x2b1b76][0x0]['type']===_0xc6fd('0x19')){_0x2d3aae[_0xc6fd('0x10')][_0xc6fd('0x12')]({'type':_0x530a77[_0x2b1b76][0x0]['type'],'app':'Set','appdata':_0xc6fd('0x1a')+_0x530a77[_0x2b1b76][0x0][_0xc6fd('0x18')],'context':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0x17')],'exten':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0xc')],'priority':_0x2d3aae[_0xc6fd('0xf')]++,'VoiceExtensionId':_0x530a77[_0x2b1b76][0x0]['VoiceExtensionId']});}else if(_0x530a77[_0x2b1b76][0x0]['type']===_0xc6fd('0x1b')){if(_0x2d3aae[_0xc6fd('0x11')]){_0x2d3aae['extensions'][_0xc6fd('0x12')]({'type':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0x13')],'app':_0xc6fd('0x14'),'appdata':'CDR(destination)='+(_0x2d3aae[_0xc6fd('0x11')][_0xc6fd('0x1c')]?_0xc6fd('0x1d')+_0x2d3aae[_0xc6fd('0x11')][_0xc6fd('0x1c')]+'}':'${EXTEN}'),'context':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0x17')],'exten':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0xc')],'priority':_0x2d3aae[_0xc6fd('0xf')]++,'VoiceExtensionId':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0x18')]});}_0x2d3aae[_0xc6fd('0x10')][_0xc6fd('0x12')]({'type':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0x13')],'app':_0xc6fd('0x14'),'appdata':_0xc6fd('0x1a')+_0x530a77[_0x2b1b76][0x0][_0xc6fd('0x18')],'context':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0x17')],'exten':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0xc')],'priority':_0x2d3aae[_0xc6fd('0xf')]++,'VoiceExtensionId':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0x18')]});var _0x13387=_0x2d3aae['priority']++;_0x2d3aae[_0xc6fd('0x10')][_0xc6fd('0x12')]({'type':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0x13')],'app':_0xc6fd('0x1e'),'appdata':_0xc6fd('0x1f')+(_0x13387+0x2)+_0xc6fd('0x20')+(_0x13387+0x1)+')','context':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0x17')],'exten':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0xc')],'priority':_0x13387,'VoiceExtensionId':_0x530a77[_0x2b1b76][0x0]['VoiceExtensionId']});if(_0x2d3aae[_0xc6fd('0x11')]){_0x2d3aae[_0xc6fd('0x10')][_0xc6fd('0x12')]({'type':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0x13')],'app':'Set','appdata':_0x2d3aae[_0xc6fd('0x11')][_0xc6fd('0x1c')]?_0xc6fd('0x21')+_0x2d3aae[_0xc6fd('0x11')][_0xc6fd('0x1c')]+'}':'CDR(prefix)=noprefix','context':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0x17')],'exten':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0xc')],'priority':_0x2d3aae['priority']++,'VoiceExtensionId':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0x18')]});}_0x2d3aae[_0xc6fd('0x10')][_0xc6fd('0x12')]({'type':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0x13')],'app':_0xc6fd('0x14'),'appdata':'outboundrouteid='+_0x530a77[_0x2b1b76][0x0]['VoiceExtensionId'],'context':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0x17')],'exten':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0xc')],'priority':_0x2d3aae[_0xc6fd('0xf')]++,'VoiceExtensionId':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0x18')]});if(_0x2d3aae[_0xc6fd('0x11')]&&_0x2d3aae[_0xc6fd('0x11')][_0xc6fd('0xe')](_0xc6fd('0x22'))&&_0x2d3aae['extension'][_0xc6fd('0x22')]!==_0xc6fd('0x23')){_0x2d3aae[_0xc6fd('0x10')][_0xc6fd('0x12')]({'type':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0x13')],'app':'Set','appdata':_0xc6fd('0x24'),'context':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0x17')],'exten':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0xc')],'priority':_0x2d3aae[_0xc6fd('0xf')]++,'VoiceExtensionId':_0x530a77[_0x2b1b76][0x0]['VoiceExtensionId']});_0x2d3aae[_0xc6fd('0x10')][_0xc6fd('0x12')]({'type':_0x530a77[_0x2b1b76][0x0]['type'],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x2d3aae[_0xc6fd('0x11')][_0xc6fd('0x22')]||_0xc6fd('0x25'),'context':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0x17')],'exten':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0xc')],'priority':_0x2d3aae[_0xc6fd('0xf')]++,'VoiceExtensionId':_0x530a77[_0x2b1b76][0x0]['VoiceExtensionId']});}}_0x2d3aae[_0xc6fd('0x10')][_0xc6fd('0x12')]({'type':_0x530a77[_0x2b1b76][0x0]['type'],'app':_0xc6fd('0x14'),'appdata':_0xc6fd('0x26'),'context':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0x17')],'exten':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0xc')],'priority':_0x2d3aae[_0xc6fd('0xf')]++,'VoiceExtensionId':_0x530a77[_0x2b1b76][0x0]['VoiceExtensionId']});_0x2d3aae[_0xc6fd('0x10')][_0xc6fd('0x12')]({'type':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0x13')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0x17')],'exten':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0xc')],'priority':_0x2d3aae[_0xc6fd('0xf')]++,'VoiceExtensionId':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0x18')]});_0x2d3aae[_0xc6fd('0x10')][_0xc6fd('0x12')]({'type':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0x13')],'app':_0xc6fd('0x14'),'appdata':_0xc6fd('0x27'),'context':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0x17')],'exten':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0xc')],'priority':_0x2d3aae[_0xc6fd('0xf')]++,'VoiceExtensionId':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0x18')]});for(var _0x185702=0x0,_0xbaa216=0x0;_0x185702<_0x530a77[_0x2b1b76][_0xc6fd('0x28')];_0x185702+=0x1,_0xbaa216=0x0){var _0x11f0d2=_0x530a77[_0x2b1b76][_0x185702];if(_0x11f0d2[_0xc6fd('0x13')]){_0x11f0d2[_0xc6fd('0x13')]=_0x11f0d2['type'][_0xc6fd('0x29')]();}var _0x100f6c=[];var _0x3b2220=[];delete _0x11f0d2['id'];delete _0x11f0d2[_0xc6fd('0x2a')];delete _0x11f0d2[_0xc6fd('0x2b')];var _0x5792ab=_0x11f0d2[_0xc6fd('0x2c')]!==_0xc6fd('0x2d')?[_0x11f0d2[_0xc6fd('0x2c')]]:_0x11f0d2['IntervalId']?_[_0xc6fd('0x9')](_[_0xc6fd('0xb')](_0x2d3aae['intervals'],{'IntervalId':_0x11f0d2[_0xc6fd('0x6')]}),_0xc6fd('0x2c')):[];if(_0x11f0d2[_0xc6fd('0xe')](_0xc6fd('0x2e'))){if(_0x11f0d2[_0xc6fd('0x2e')]&&_0x11f0d2[_0xc6fd('0x2e')]!=='--'){_0x100f6c[_0xc6fd('0x12')]({'type':_0x11f0d2[_0xc6fd('0x13')],'app':_0xc6fd('0x14'),'appdata':_0xc6fd('0x2f')+_0x11f0d2[_0xc6fd('0x2e')],'context':_0x11f0d2[_0xc6fd('0x17')],'exten':_0x11f0d2[_0xc6fd('0xc')],'priority':_0x5792ab[_0xc6fd('0x28')]+_0x2d3aae[_0xc6fd('0xf')]+_0xbaa216++,'VoiceExtensionId':_0x11f0d2['VoiceExtensionId']});}}if(_0x11f0d2[_0xc6fd('0x13')]==='outbound'&&_0x11f0d2[_0xc6fd('0xe')](_0xc6fd('0x30'))){if(_0x11f0d2['callerID']){_0x100f6c[_0xc6fd('0x12')]({'type':_0x11f0d2[_0xc6fd('0x13')],'app':_0xc6fd('0x1e'),'appdata':_0xc6fd('0x31')+_0x11f0d2[_0xc6fd('0x30')]+')','context':_0x11f0d2[_0xc6fd('0x17')],'exten':_0x11f0d2[_0xc6fd('0xc')],'priority':_0x5792ab[_0xc6fd('0x28')]+_0x2d3aae['priority']+_0xbaa216++,'VoiceExtensionId':_0x11f0d2[_0xc6fd('0x18')]});}else{_0x100f6c[_0xc6fd('0x12')]({'type':_0x11f0d2[_0xc6fd('0x13')],'app':_0xc6fd('0x1e'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x11f0d2[_0xc6fd('0x17')],'exten':_0x11f0d2[_0xc6fd('0xc')],'priority':_0x5792ab[_0xc6fd('0x28')]+_0x2d3aae[_0xc6fd('0xf')]+_0xbaa216++,'VoiceExtensionId':_0x11f0d2[_0xc6fd('0x18')]});}}if(_0x11f0d2[_0xc6fd('0xe')]('answer')){if(_0x40a63e[_0xc6fd('0x32')](_0x11f0d2[_0xc6fd('0x33')][_0xc6fd('0x29')]())>=0x0&&_0x11f0d2[_0xc6fd('0x34')]!==_0xc6fd('0x35')){if(_0x11f0d2[_0xc6fd('0x36')]){_0x100f6c[_0xc6fd('0x12')]({'type':_0x11f0d2[_0xc6fd('0x13')],'app':_0xc6fd('0x1e'),'appdata':_0xc6fd('0x37'),'context':_0x11f0d2[_0xc6fd('0x17')],'exten':_0x11f0d2['exten'],'priority':_0x5792ab[_0xc6fd('0x28')]+_0x2d3aae['priority']+_0xbaa216++,'VoiceExtensionId':_0x11f0d2[_0xc6fd('0x18')]});_0x100f6c[_0xc6fd('0x12')]({'type':_0x11f0d2[_0xc6fd('0x13')],'app':_0xc6fd('0x14'),'appdata':_0xc6fd('0x38'),'context':_0x11f0d2[_0xc6fd('0x17')],'exten':_0x11f0d2[_0xc6fd('0xc')],'priority':_0x5792ab[_0xc6fd('0x28')]+_0x2d3aae['priority']+_0xbaa216++,'VoiceExtensionId':_0x11f0d2[_0xc6fd('0x18')]});}else{_0x100f6c[_0xc6fd('0x12')]({'type':_0x11f0d2[_0xc6fd('0x13')],'app':_0xc6fd('0x1e'),'appdata':_0xc6fd('0x39'),'context':_0x11f0d2['context'],'exten':_0x11f0d2[_0xc6fd('0xc')],'priority':_0x5792ab[_0xc6fd('0x28')]+_0x2d3aae['priority']+_0xbaa216++,'VoiceExtensionId':_0x11f0d2[_0xc6fd('0x18')]});_0x100f6c[_0xc6fd('0x12')]({'type':_0x11f0d2[_0xc6fd('0x13')],'app':_0xc6fd('0x14'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x11f0d2[_0xc6fd('0x17')],'exten':_0x11f0d2['exten'],'priority':_0x5792ab['length']+_0x2d3aae[_0xc6fd('0xf')]+_0xbaa216++,'VoiceExtensionId':_0x11f0d2['VoiceExtensionId']});}}}for(var _0x570d28=0x0;_0x570d28<_0x5792ab[_0xc6fd('0x28')];_0x570d28+=0x1){var _0x1e2323=_0x2d3aae[_0xc6fd('0xf')]+_0x5792ab[_0xc6fd('0x28')];var _0x310014=_0x570d28===_0x5792ab['length']-0x1?_0x2d3aae[_0xc6fd('0xf')]+_0x100f6c[_0xc6fd('0x28')]+_0x3b2220['length']+0x2:_0x2d3aae['priority']+_0x570d28+0x1;_0x100f6c[_0xc6fd('0x3a')](_0x570d28,0x0,{'type':_0x11f0d2[_0xc6fd('0x13')],'app':_0xc6fd('0x3b'),'appdata':_0x5792ab[_0x570d28]+'?'+_0x11f0d2[_0xc6fd('0x17')]+',${EXTEN},'+_0x1e2323+':'+_0x11f0d2[_0xc6fd('0x17')]+',${EXTEN},'+_0x310014,'exten':_0x11f0d2[_0xc6fd('0xc')],'context':_0x11f0d2[_0xc6fd('0x17')],'priority':_0x2d3aae[_0xc6fd('0xf')]+_0x570d28,'VoiceExtensionId':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0x18')]});}_0x11f0d2[_0xc6fd('0xf')]=_0x100f6c[_0xc6fd('0x28')]?_[_0xc6fd('0x3c')](_0x100f6c)[_0xc6fd('0xf')]+0x1:_0x2d3aae['priority'];_0x2d3aae[_0xc6fd('0xf')]=(_0x3b2220['length']?_[_0xc6fd('0x3c')](_0x3b2220)[_0xc6fd('0xf')]:_0x11f0d2[_0xc6fd('0xf')])+0x1;_0x2d3aae['extensions']=_[_0xc6fd('0x3d')](_0x2d3aae[_0xc6fd('0x10')],_0x100f6c,[_0x11f0d2],_0x3b2220);}_0x2d3aae[_0xc6fd('0x10')][_0xc6fd('0x12')]({'type':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0x13')],'app':_0xc6fd('0x3e'),'exten':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0xc')],'context':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0x17')],'priority':_0x2d3aae[_0xc6fd('0xf')],'VoiceExtensionId':_0x530a77[_0x2b1b76][0x0][_0xc6fd('0x18')]});_0x155e7f[_0xc6fd('0x12')](_0x530a77[_0x2b1b76][0x0][_0xc6fd('0x18')]);_0x27d9a5=_['concat'](_0x27d9a5,_0x2d3aae[_0xc6fd('0x10')]);}}return _0x8d8e63['transaction'](function(_0x3da1e9){return _0x8d8e63[_0xc6fd('0x7')]['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':{'$in':_0x155e7f}},'transaction':_0x3da1e9})['then'](function(_0x27657d){return _0x8d8e63[_0xc6fd('0x7')]['VoiceExtension']['bulkCreate'](_[_0xc6fd('0x3f')](_0x27d9a5,_0xc6fd('0xf')),{'transaction':_0x3da1e9});});});})[_0xc6fd('0x40')](function(_0x3d8e6f){console[_0xc6fd('0x41')](_0x3d8e6f);});}exports[_0xc6fd('0x42')]=rewrite; \ No newline at end of file +var _0x1107=['format','CDR(type)=%s','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','appType','custom','answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice',',${EXTEN},','last','Hangup','concat','transaction','destroy','bulkCreate','catch','rewrite','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','hasOwnProperty','priority','extensions','extension','find','exten','push','type','Set'];(function(_0x29d623,_0x1a5c9c){var _0x242e59=function(_0x2c78ab){while(--_0x2c78ab){_0x29d623['push'](_0x29d623['shift']());}};_0x242e59(++_0x1a5c9c);}(_0x1107,0x144));var _0x7110=function(_0x16e874,_0x154da0){_0x16e874=_0x16e874-0x0;var _0x5460d4=_0x1107[_0x16e874];return _0x5460d4;};'use strict';var _=require('lodash');var util=require('util');function rewrite(_0x2e1cae,_0x10dae0){var _0x194428=this;return _0x2e1cae[_0x7110('0x0')][_0x7110('0x1')][_0x7110('0x2')]({'raw':!![]})[_0x7110('0x3')](function(_0x51956c){_0x194428[_0x7110('0x4')]=_0x51956c;return _0x2e1cae[_0x7110('0x0')][_0x7110('0x5')][_0x7110('0x2')]({'where':{'IntervalId':_0x10dae0[_0x7110('0x6')]},'raw':!![]});})[_0x7110('0x3')](function(_0x4e8480){return _0x2e1cae['models']['VoiceExtension']['findAll']({'where':{'exten':{'$in':_[_0x7110('0x7')](_[_0x7110('0x8')](_0x4e8480,'exten'))}},'order':[{'raw':_0x7110('0x9')}],'raw':!![]});})['then'](function(_0x5525b3){var _0x2befb8=_[_0x7110('0xa')](_0x5525b3,{'priority':'1'});var _0xaf740b=_[_0x7110('0xa')](_0x5525b3,{'isApp':0x1});var _0x44cf11=_['groupBy'](_0xaf740b,'exten');var _0x1ca5f9=[_0x7110('0xb'),'playback'];var _0x3b0fa6=[];var _0x517d5a=[];for(var _0x14ba5d in _0x44cf11){if(_0x44cf11[_0x7110('0xc')](_0x14ba5d)){_0x194428[_0x7110('0xd')]=0x2;_0x194428[_0x7110('0xe')]=[];_0x194428[_0x7110('0xf')]=_[_0x7110('0x10')](_0x2befb8,{'exten':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x11')]});_0x194428['extensions'][_0x7110('0x12')]({'type':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x13')],'app':_0x7110('0x14'),'appdata':util[_0x7110('0x15')](_0x7110('0x16'),_0x44cf11[_0x14ba5d][0x0]['type']),'context':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x17')],'exten':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x11')],'priority':_0x194428[_0x7110('0xd')]++,'VoiceExtensionId':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x18')]});if(_0x44cf11[_0x14ba5d][0x0][_0x7110('0x13')]===_0x7110('0x19')){_0x194428['extensions'][_0x7110('0x12')]({'type':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x13')],'app':_0x7110('0x14'),'appdata':_0x7110('0x1a')+_0x44cf11[_0x14ba5d][0x0][_0x7110('0x18')],'context':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x17')],'exten':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x11')],'priority':_0x194428[_0x7110('0xd')]++,'VoiceExtensionId':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x18')]});}else if(_0x44cf11[_0x14ba5d][0x0][_0x7110('0x13')]===_0x7110('0x1b')){if(_0x194428[_0x7110('0xf')]){_0x194428['extensions'][_0x7110('0x12')]({'type':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x13')],'app':_0x7110('0x14'),'appdata':_0x7110('0x1c')+(_0x194428[_0x7110('0xf')][_0x7110('0x1d')]?_0x7110('0x1e')+_0x194428[_0x7110('0xf')][_0x7110('0x1d')]+'}':_0x7110('0x1f')),'context':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x17')],'exten':_0x44cf11[_0x14ba5d][0x0]['exten'],'priority':_0x194428['priority']++,'VoiceExtensionId':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x18')]});}_0x194428[_0x7110('0xe')]['push']({'type':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x13')],'app':'Set','appdata':_0x7110('0x1a')+_0x44cf11[_0x14ba5d][0x0][_0x7110('0x18')],'context':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x17')],'exten':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x11')],'priority':_0x194428[_0x7110('0xd')]++,'VoiceExtensionId':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x18')]});var _0xa46040=_0x194428[_0x7110('0xd')]++;_0x194428['extensions'][_0x7110('0x12')]({'type':_0x44cf11[_0x14ba5d][0x0]['type'],'app':_0x7110('0x20'),'appdata':_0x7110('0x21')+(_0xa46040+0x2)+_0x7110('0x22')+(_0xa46040+0x1)+')','context':_0x44cf11[_0x14ba5d][0x0]['context'],'exten':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x11')],'priority':_0xa46040,'VoiceExtensionId':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x18')]});if(_0x194428[_0x7110('0xf')]){_0x194428[_0x7110('0xe')][_0x7110('0x12')]({'type':_0x44cf11[_0x14ba5d][0x0]['type'],'app':'Set','appdata':_0x194428['extension'][_0x7110('0x1d')]?'CDR(prefix)=${EXTEN:0:'+_0x194428[_0x7110('0xf')][_0x7110('0x1d')]+'}':_0x7110('0x23'),'context':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x17')],'exten':_0x44cf11[_0x14ba5d][0x0]['exten'],'priority':_0x194428[_0x7110('0xd')]++,'VoiceExtensionId':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x18')]});}_0x194428[_0x7110('0xe')][_0x7110('0x12')]({'type':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x13')],'app':'Set','appdata':_0x7110('0x24')+_0x44cf11[_0x14ba5d][0x0]['VoiceExtensionId'],'context':_0x44cf11[_0x14ba5d][0x0]['context'],'exten':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x11')],'priority':_0x194428['priority']++,'VoiceExtensionId':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x18')]});if(_0x194428['extension']&&_0x194428[_0x7110('0xf')][_0x7110('0xc')]('recordingFormat')&&_0x194428[_0x7110('0xf')][_0x7110('0x25')]!==_0x7110('0x26')){_0x194428[_0x7110('0xe')][_0x7110('0x12')]({'type':_0x44cf11[_0x14ba5d][0x0]['type'],'app':_0x7110('0x14'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x44cf11[_0x14ba5d][0x0]['context'],'exten':_0x44cf11[_0x14ba5d][0x0]['exten'],'priority':_0x194428['priority']++,'VoiceExtensionId':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x18')]});_0x194428[_0x7110('0xe')][_0x7110('0x12')]({'type':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x13')],'app':_0x7110('0x14'),'appdata':_0x7110('0x27')+_0x194428[_0x7110('0xf')][_0x7110('0x25')]||_0x7110('0x28'),'context':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x17')],'exten':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x11')],'priority':_0x194428['priority']++,'VoiceExtensionId':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x18')]});}}_0x194428['extensions'][_0x7110('0x12')]({'type':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x13')],'app':'Set','appdata':_0x7110('0x29'),'context':_0x44cf11[_0x14ba5d][0x0]['context'],'exten':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x11')],'priority':_0x194428['priority']++,'VoiceExtensionId':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x18')]});_0x194428[_0x7110('0xe')][_0x7110('0x12')]({'type':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x13')],'app':_0x7110('0x14'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x17')],'exten':_0x44cf11[_0x14ba5d][0x0]['exten'],'priority':_0x194428['priority']++,'VoiceExtensionId':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x18')]});_0x194428[_0x7110('0xe')][_0x7110('0x12')]({'type':_0x44cf11[_0x14ba5d][0x0]['type'],'app':_0x7110('0x14'),'appdata':'MONITOR_OPTIONS=ab','context':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x17')],'exten':_0x44cf11[_0x14ba5d][0x0]['exten'],'priority':_0x194428['priority']++,'VoiceExtensionId':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x18')]});for(var _0x3ffd8a=0x0,_0x1af5fe=0x0;_0x3ffd8a<_0x44cf11[_0x14ba5d]['length'];_0x3ffd8a+=0x1,_0x1af5fe=0x0){var _0x5b3d2=_0x44cf11[_0x14ba5d][_0x3ffd8a];if(_0x5b3d2[_0x7110('0x13')]){_0x5b3d2[_0x7110('0x13')]=_0x5b3d2[_0x7110('0x13')][_0x7110('0x2a')]();}var _0x224601=[];var _0x1150dd=[];delete _0x5b3d2['id'];delete _0x5b3d2[_0x7110('0x2b')];delete _0x5b3d2[_0x7110('0x2c')];var _0x12375f=_0x5b3d2[_0x7110('0x2d')]!==_0x7110('0x2e')?[_0x5b3d2[_0x7110('0x2d')]]:_0x5b3d2[_0x7110('0x6')]?_[_0x7110('0x8')](_[_0x7110('0xa')](_0x194428['intervals'],{'IntervalId':_0x5b3d2[_0x7110('0x6')]}),_0x7110('0x2d')):[];if(_0x5b3d2[_0x7110('0xc')]('tag')){if(_0x5b3d2['tag']&&_0x5b3d2[_0x7110('0x2f')]!=='--'){_0x224601[_0x7110('0x12')]({'type':_0x5b3d2['type'],'app':_0x7110('0x14'),'appdata':_0x7110('0x30')+_0x5b3d2[_0x7110('0x2f')],'context':_0x5b3d2[_0x7110('0x17')],'exten':_0x5b3d2['exten'],'priority':_0x12375f[_0x7110('0x31')]+_0x194428['priority']+_0x1af5fe++,'VoiceExtensionId':_0x5b3d2['VoiceExtensionId']});}}if(_0x5b3d2[_0x7110('0x13')]===_0x7110('0x1b')&&_0x5b3d2[_0x7110('0xc')](_0x7110('0x32'))){if(_0x5b3d2[_0x7110('0x32')]){_0x224601[_0x7110('0x12')]({'type':_0x5b3d2[_0x7110('0x13')],'app':_0x7110('0x20'),'appdata':_0x7110('0x33')+_0x5b3d2[_0x7110('0x32')]+')','context':_0x5b3d2[_0x7110('0x17')],'exten':_0x5b3d2['exten'],'priority':_0x12375f[_0x7110('0x31')]+_0x194428[_0x7110('0xd')]+_0x1af5fe++,'VoiceExtensionId':_0x5b3d2[_0x7110('0x18')]});}else{_0x224601[_0x7110('0x12')]({'type':_0x5b3d2['type'],'app':_0x7110('0x20'),'appdata':_0x7110('0x34'),'context':_0x5b3d2[_0x7110('0x17')],'exten':_0x5b3d2[_0x7110('0x11')],'priority':_0x12375f[_0x7110('0x31')]+_0x194428[_0x7110('0xd')]+_0x1af5fe++,'VoiceExtensionId':_0x5b3d2['VoiceExtensionId']});}}if(_0x5b3d2['hasOwnProperty']('answer')){if(_0x1ca5f9[_0x7110('0x35')](_0x5b3d2[_0x7110('0x36')][_0x7110('0x2a')]())>=0x0&&_0x5b3d2[_0x7110('0x37')]!==_0x7110('0x38')){if(_0x5b3d2[_0x7110('0x39')]){_0x224601[_0x7110('0x12')]({'type':_0x5b3d2[_0x7110('0x13')],'app':_0x7110('0x20'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x5b3d2[_0x7110('0x17')],'exten':_0x5b3d2['exten'],'priority':_0x12375f[_0x7110('0x31')]+_0x194428[_0x7110('0xd')]+_0x1af5fe++,'VoiceExtensionId':_0x5b3d2[_0x7110('0x18')]});_0x224601[_0x7110('0x12')]({'type':_0x5b3d2[_0x7110('0x13')],'app':_0x7110('0x14'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x5b3d2['context'],'exten':_0x5b3d2[_0x7110('0x11')],'priority':_0x12375f[_0x7110('0x31')]+_0x194428[_0x7110('0xd')]+_0x1af5fe++,'VoiceExtensionId':_0x5b3d2[_0x7110('0x18')]});}else{_0x224601[_0x7110('0x12')]({'type':_0x5b3d2[_0x7110('0x13')],'app':'ExecIf','appdata':_0x7110('0x3a'),'context':_0x5b3d2[_0x7110('0x17')],'exten':_0x5b3d2['exten'],'priority':_0x12375f[_0x7110('0x31')]+_0x194428['priority']+_0x1af5fe++,'VoiceExtensionId':_0x5b3d2[_0x7110('0x18')]});_0x224601[_0x7110('0x12')]({'type':_0x5b3d2[_0x7110('0x13')],'app':_0x7110('0x14'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x5b3d2[_0x7110('0x17')],'exten':_0x5b3d2[_0x7110('0x11')],'priority':_0x12375f[_0x7110('0x31')]+_0x194428[_0x7110('0xd')]+_0x1af5fe++,'VoiceExtensionId':_0x5b3d2[_0x7110('0x18')]});}}}for(var _0x34640c=0x0;_0x34640c<_0x12375f[_0x7110('0x31')];_0x34640c+=0x1){var _0x2f8ce5=_0x194428[_0x7110('0xd')]+_0x12375f['length'];var _0x19808c=_0x34640c===_0x12375f['length']-0x1?_0x194428['priority']+_0x224601[_0x7110('0x31')]+_0x1150dd[_0x7110('0x31')]+0x2:_0x194428[_0x7110('0xd')]+_0x34640c+0x1;_0x224601[_0x7110('0x3b')](_0x34640c,0x0,{'type':_0x5b3d2[_0x7110('0x13')],'app':'GotoIfTime','appdata':_0x12375f[_0x34640c]+'?'+_0x5b3d2[_0x7110('0x17')]+_0x7110('0x3c')+_0x2f8ce5+':'+_0x5b3d2[_0x7110('0x17')]+_0x7110('0x3c')+_0x19808c,'exten':_0x5b3d2[_0x7110('0x11')],'context':_0x5b3d2[_0x7110('0x17')],'priority':_0x194428[_0x7110('0xd')]+_0x34640c,'VoiceExtensionId':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x18')]});}_0x5b3d2['priority']=_0x224601['length']?_['last'](_0x224601)[_0x7110('0xd')]+0x1:_0x194428['priority'];_0x194428[_0x7110('0xd')]=(_0x1150dd[_0x7110('0x31')]?_[_0x7110('0x3d')](_0x1150dd)[_0x7110('0xd')]:_0x5b3d2['priority'])+0x1;_0x194428[_0x7110('0xe')]=_['concat'](_0x194428[_0x7110('0xe')],_0x224601,[_0x5b3d2],_0x1150dd);}_0x194428['extensions'][_0x7110('0x12')]({'type':_0x44cf11[_0x14ba5d][0x0]['type'],'app':_0x7110('0x3e'),'exten':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x11')],'context':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x17')],'priority':_0x194428[_0x7110('0xd')],'VoiceExtensionId':_0x44cf11[_0x14ba5d][0x0][_0x7110('0x18')]});_0x3b0fa6[_0x7110('0x12')](_0x44cf11[_0x14ba5d][0x0][_0x7110('0x18')]);_0x517d5a=_[_0x7110('0x3f')](_0x517d5a,_0x194428['extensions']);}}return _0x2e1cae[_0x7110('0x40')](function(_0x24a6d4){return _0x2e1cae[_0x7110('0x0')]['VoiceExtension'][_0x7110('0x41')]({'where':{'VoiceExtensionId':{'$in':_0x3b0fa6}},'transaction':_0x24a6d4})[_0x7110('0x3')](function(_0x15a42c){return _0x2e1cae[_0x7110('0x0')][_0x7110('0x5')][_0x7110('0x42')](_['sortBy'](_0x517d5a,_0x7110('0xd')),{'transaction':_0x24a6d4});});});})[_0x7110('0x43')](function(_0x406277){console['error'](_0x406277);});}exports[_0x7110('0x44')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index b1ba6b8..b4ec6ba 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 _0x10c4=['VoiceQueueId','onlyIfOpen','then','catch','query','all','VoiceQueue','outbound','BlackLists','get','always','CampaignId','generalCheckHopper','finally','contact:csv_','resume','emit','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','CmContact','parse','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','Missing\x20filepath\x20parameter!','null','undefined','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','create','push','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','updatedAt','select','NOW()','scheduledAt','field','toString','createdAt','from','where','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ContactId','cm_contacts','deletedAt\x20IS\x20NULL','str','calleridnum','cm_hopper_final','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','cm_hopper_black','id\x20IN\x20?','findAll','dialCheckDuplicateType','CmList','Lists','sequelize'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x10c4,0xf3));var _0x410c=function(_0x3a6e25,_0x37fe2a){_0x3a6e25=_0x3a6e25-0x0;var _0x241ddf=_0x10c4[_0x3a6e25];return _0x241ddf;};'use strict';var BPromise=require(_0x410c('0x0'));var util=require('util');var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require(_0x410c('0x1'));var Redis=require(_0x410c('0x2'));var db=require(_0x410c('0x3'))['db'];var config=require(_0x410c('0x4'));var logger=require(_0x410c('0x5'))(_0x410c('0x6'));config[_0x410c('0x7')]=_[_0x410c('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x410c('0x9'))(new Redis(config[_0x410c('0x7')]));require(_0x410c('0xa'))[_0x410c('0xb')](socket);try{if(!process[_0x410c('0xc')][0x2]||process['argv'][0x2]==='undefined'||process[_0x410c('0xc')][0x2]==='null'){throw new Error(_0x410c('0xd'));}var FILEPATH=process[_0x410c('0xc')][0x2];if(!process[_0x410c('0xc')][0x3]||process[_0x410c('0xc')][0x3]==='undefined'||process[_0x410c('0xc')][0x3]===_0x410c('0xe')||!process[_0x410c('0xc')][0x4]||process[_0x410c('0xc')][0x4]===_0x410c('0xf')||process['argv'][0x4]===_0x410c('0xe')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x410c('0x10')](process[_0x410c('0xc')][0x3][_0x410c('0x11')](','),process['argv'][0x4][_0x410c('0x11')](','));if(!process[_0x410c('0xc')][0x5]||process[_0x410c('0xc')][0x5]===_0x410c('0xf')||process[_0x410c('0xc')][0x5]===_0x410c('0xe')){throw new Error(_0x410c('0x12'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x410c('0xc')][0x6]&&process['argv'][0x6]!==_0x410c('0xf')&&process[_0x410c('0xc')][0x6]!==_0x410c('0xe')?process[_0x410c('0xc')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x410c('0xc')][0x7]!=='undefined'&&process[_0x410c('0xc')][0x7]!==_0x410c('0xe')?process[_0x410c('0xc')][0x7]:null;if(!process['argv'][0x8]||process[_0x410c('0xc')][0x8]===_0x410c('0xf')||process['argv'][0x8]===_0x410c('0xe')){throw new Error(_0x410c('0x13'));}var SOCKET_TIMESTAMP=process[_0x410c('0xc')][0x8];}catch(_0x2b8dea){logger['error'](_0x2b8dea);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(_0x1170b1,_0x545bf5,_0x221739,_0x4ff0fb){var _0x5ed540={'message':_0x545bf5};_0x5ed540[_0x1170b1]=!![];if(_0x221739){_0x5ed540['contact']=_0x221739;}if(_0x4ff0fb){_0x5ed540['index']=_0x4ff0fb;}return _0x5ed540;}function isEmail(_0x3f8e04){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))*$/[_0x410c('0x14')](_0x3f8e04);}function checkRow(_0x29bd13,_0x58dfe1,_0x4e28aa){return new BPromise(function(_0x15dea7,_0x3a3cb3){if(_[_0x410c('0x15')](_0x29bd13)){return _0x3a3cb3(handleCheckRowError(_0x410c('0x16'),_0x410c('0x17'),null,_0x4e28aa));}if(_0x29bd13[_0x410c('0x18')]&&_0x29bd13[_0x410c('0x18')][_0x410c('0x19')]){var _0x3851f7=_[_0x410c('0x1a')](_0x29bd13[_0x410c('0x18')],_0x410c('0x1b'))[_0x410c('0x1c')](';');return _0x3a3cb3(handleCheckRowError(_0x410c('0x16'),_0x3851f7,null,_0x4e28aa));}var _0x3d906f={};for(var _0x8bbc03 in FIELDS){if(FIELDS[_0x410c('0x1d')](_0x8bbc03)&&FIELDS[_0x8bbc03]){_0x3d906f[_0x8bbc03]=_0x29bd13[_0x410c('0x1e')][0x0][FIELDS[_0x8bbc03]]||_0x29bd13[_0x410c('0x1e')][0x0]['\ufeff'+FIELDS[_0x8bbc03]];}}if(!_0x3d906f[_0x410c('0x1f')]){return _0x3a3cb3(handleCheckRowError(_0x410c('0x16'),_0x410c('0x20'),null,_0x4e28aa));}if(!_0x3d906f[_0x410c('0x21')]){return _0x3a3cb3(handleCheckRowError(_0x410c('0x16'),_0x410c('0x22'),null,_0x4e28aa));}if(_0x3d906f[_0x410c('0x23')]){var _0x5cf709=moment(_0x3d906f[_0x410c('0x23')],_0x410c('0x24'));if(!_0x5cf709[_0x410c('0x25')]()){return _0x3a3cb3(handleCheckRowError(_0x410c('0x16'),_0x410c('0x26'),null,_0x4e28aa));}}if(_0x3d906f['email']){if(!isEmail(_0x3d906f['email'])){return _0x3a3cb3(handleCheckRowError(_0x410c('0x16'),'email\x20format\x20is\x20not\x20valid!',null,_0x4e28aa));}}_0x3d906f[_0x410c('0x27')]=LISTID;_0x3d906f[_0x410c('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x410c('0x19')]&&_0x58dfe1){var _0x190823={};for(var _0x3823ed=0x0,_0x3661bd=DUPLICATES[_0x410c('0x19')];_0x3823ed<_0x3661bd;_0x3823ed+=0x1){_0x190823[DUPLICATES[_0x3823ed]]=_0x3d906f[DUPLICATES[_0x3823ed]];}var _0xfca940=_[_0x410c('0x29')](_0x58dfe1,_0x190823);if(_0xfca940){return _0x3a3cb3(handleCheckRowError(_0x410c('0x2a'),_0x410c('0x2b'),_0xfca940,_0x4e28aa));}}return db['CmContact'][_0x410c('0x2c')](_0x3d906f,{'raw':!![],'hooks':![],'fields':_['keys'](_0x3d906f)})['then'](function(_0x355810){if(DUPLICATES&&DUPLICATES[_0x410c('0x19')]&&_0x58dfe1){_0x58dfe1[_0x410c('0x2d')](_['pick'](_0x3d906f,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x355810['id'];return _0x15dea7();})['catch'](function(_0x4e5902){return _0x3a3cb3(handleCheckRowError(_0x410c('0x16'),_0x410c('0x2e')+(_0x4e5902[_0x410c('0x1b')]||JSON[_0x410c('0x2f')](_0x4e5902)),null,_0x4e28aa));});});}function checkHopper(){function _0x48c57a(){return function(_0x841906){logger['error'](_0x410c('0x30'),_0x410c('0x31'),util[_0x410c('0x32')](_0x841906,{'showHidden':![],'depth':null}));};}var _0x5e491b=function(_0x2ad5f6,_0x570f1b){var _0x5b0da8=squel[_0x410c('0x33')]()[_0x410c('0x34')](_0x410c('0x35'))[_0x410c('0x36')]([_0x410c('0x21'),'scheduledAt','ContactId','ListId',_0x570f1b,'createdAt',_0x410c('0x37')],squel[_0x410c('0x38')]()['field'](_0x410c('0x21'),_0x410c('0x21'))['field'](_0x410c('0x39'),_0x410c('0x3a'))['field']('id','ContactId')[_0x410c('0x3b')](LISTID[_0x410c('0x3c')](),_0x410c('0x27'))[_0x410c('0x3b')](_0x2ad5f6['id'][_0x410c('0x3c')](),_0x570f1b)[_0x410c('0x3b')](_0x410c('0x39'),_0x410c('0x3d'))[_0x410c('0x3b')](_0x410c('0x39'),_0x410c('0x37'))[_0x410c('0x3e')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x410c('0x3f')]('ListId\x20=\x20?',LISTID['toString']())[_0x410c('0x3f')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x410c('0x40'),squel[_0x410c('0x38')]()[_0x410c('0x3b')](_0x410c('0x21'))[_0x410c('0x3e')](_0x410c('0x35'))['where'](_0x570f1b+_0x410c('0x41'),_0x2ad5f6['id']['toString']())))[_0x410c('0x3c')]();return _0x5b0da8;};var _0x4c57e5=function(_0x44930c,_0x122841){var _0x1a2dea=squel[_0x410c('0x33')]()['into']('cm_hopper')['fromQuery']([_0x410c('0x21'),_0x410c('0x3a'),_0x410c('0x42'),_0x410c('0x27'),_0x122841,_0x410c('0x3d'),'updatedAt'],squel[_0x410c('0x38')]()['field'](_0x410c('0x21'),_0x410c('0x21'))[_0x410c('0x3b')](_0x410c('0x39'),_0x410c('0x3a'))['field']('id','ContactId')[_0x410c('0x3b')](LISTID[_0x410c('0x3c')](),'ListId')['field'](_0x44930c['id'][_0x410c('0x3c')](),_0x122841)[_0x410c('0x3b')](_0x410c('0x39'),_0x410c('0x3d'))[_0x410c('0x3b')](_0x410c('0x39'),_0x410c('0x37'))[_0x410c('0x3e')](_0x410c('0x43'))[_0x410c('0x3f')](_0x410c('0x44'))[_0x410c('0x3f')]('ListId\x20=\x20?',LISTID[_0x410c('0x3c')]())[_0x410c('0x3f')]('id\x20IN\x20?',squel[_0x410c('0x45')](hopperContacts))[_0x410c('0x3f')]('phone\x20IS\x20NOT\x20NULL')[_0x410c('0x3f')](_0x410c('0x40'),squel[_0x410c('0x38')]()[_0x410c('0x3b')](_0x410c('0x46'))['from'](_0x410c('0x47'))['where'](_0x122841+_0x410c('0x41'),_0x44930c['id'][_0x410c('0x3c')]()))[_0x410c('0x3f')](_0x410c('0x40'),squel[_0x410c('0x38')]()[_0x410c('0x3b')](_0x410c('0x21'))[_0x410c('0x3e')](_0x410c('0x35'))[_0x410c('0x3f')](_0x122841+_0x410c('0x41'),_0x44930c['id'][_0x410c('0x3c')]())))[_0x410c('0x3c')]();return _0x1a2dea;};function _0x501271(_0x3662f0,_0x19474e){var _0x37be2b=squel[_0x410c('0x33')]()[_0x410c('0x34')]('cm_hopper')[_0x410c('0x36')]([_0x410c('0x21'),'scheduledAt',_0x410c('0x42'),_0x410c('0x27'),_0x19474e,_0x410c('0x3d'),_0x410c('0x37')],squel[_0x410c('0x38')]()[_0x410c('0x3b')](_0x410c('0x21'),_0x410c('0x21'))[_0x410c('0x3b')](_0x410c('0x39'),_0x410c('0x3a'))[_0x410c('0x3b')]('id',_0x410c('0x42'))[_0x410c('0x3b')](LISTID['toString'](),_0x410c('0x27'))[_0x410c('0x3b')](_0x3662f0['id'][_0x410c('0x3c')](),_0x19474e)[_0x410c('0x3b')](_0x410c('0x39'),_0x410c('0x3d'))[_0x410c('0x3b')]('NOW()','updatedAt')[_0x410c('0x3e')](_0x410c('0x43'))[_0x410c('0x3f')]('deletedAt\x20IS\x20NULL')[_0x410c('0x3f')](_0x410c('0x48'),LISTID[_0x410c('0x3c')]())['where']('id\x20IN\x20?',squel['str'](hopperContacts))['where'](_0x410c('0x49')))[_0x410c('0x3c')]();return _0x37be2b;}function _0x2055a7(_0x2c7b4e,_0x1c43f1){var _0x57a3b3=squel[_0x410c('0x33')]()['into'](_0x410c('0x4a'))['fromQuery']([_0x410c('0x21'),_0x410c('0x42'),_0x410c('0x27'),_0x1c43f1,_0x410c('0x3d'),_0x410c('0x37')],squel[_0x410c('0x38')]()[_0x410c('0x3b')](_0x410c('0x21'),'phone')[_0x410c('0x3b')]('id',_0x410c('0x42'))[_0x410c('0x3b')](LISTID[_0x410c('0x3c')](),_0x410c('0x27'))[_0x410c('0x3b')](_0x2c7b4e['id'][_0x410c('0x3c')](),_0x1c43f1)[_0x410c('0x3b')](_0x410c('0x39'),_0x410c('0x3d'))[_0x410c('0x3b')](_0x410c('0x39'),_0x410c('0x37'))[_0x410c('0x3e')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x410c('0x3f')](_0x410c('0x48'),LISTID[_0x410c('0x3c')]())[_0x410c('0x3f')](_0x410c('0x4b'),squel['str'](hopperContacts))[_0x410c('0x3f')](_0x410c('0x49')))[_0x410c('0x3c')]();return _0x57a3b3;}return db['VoiceQueue'][_0x410c('0x4c')]({'where':{'type':'outbound'},'attributes':['id',_0x410c('0x4d')],'include':[{'model':db[_0x410c('0x4e')],'as':_0x410c('0x4f'),'where':{'id':LISTID}}]})['then'](function(_0x54a2e8){var _0x403cc9=[];if(_0x54a2e8){var _0x1d66e3;for(var _0x576926=0x0,_0x776135;_0x576926<_0x54a2e8['length'];_0x576926+=0x1){_0x776135=_0x54a2e8[_0x576926]['get']({'plain':!![]});switch(_0x776135[_0x410c('0x4d')]){case'always':_0x403cc9[_0x410c('0x2d')](db[_0x410c('0x50')]['query'](_0x4c57e5(_0x776135,_0x410c('0x51')))['then'](function(){})['catch'](_0x48c57a()));break;case _0x410c('0x52'):_0x403cc9[_0x410c('0x2d')](db[_0x410c('0x50')]['query'](_0x5e491b(_0x776135,'VoiceQueueId'))[_0x410c('0x53')](function(){})[_0x410c('0x54')](_0x48c57a()));break;default:_0x403cc9[_0x410c('0x2d')](db[_0x410c('0x50')][_0x410c('0x55')](_0x501271(_0x776135,_0x410c('0x51')))['then'](function(){})['catch'](_0x48c57a()));}}}return _0x403cc9;})[_0x410c('0x56')]()['then'](function(){return db[_0x410c('0x57')][_0x410c('0x4c')]({'where':{'type':_0x410c('0x58')},'attributes':['id'],'include':[{'model':db[_0x410c('0x4e')],'as':_0x410c('0x59'),'where':{'id':LISTID}}]})[_0x410c('0x53')](function(_0x169ef7){var _0x399222=[];if(_0x169ef7){var _0x2690ac;for(var _0x529179=0x0,_0x4e86df;_0x529179<_0x169ef7[_0x410c('0x19')];_0x529179+=0x1){_0x4e86df=_0x169ef7[_0x529179][_0x410c('0x5a')]({'plain':!![]});_0x399222['push'](db[_0x410c('0x50')][_0x410c('0x55')](_0x2055a7(_0x4e86df,'VoiceQueueId'))[_0x410c('0x53')](function(){})[_0x410c('0x54')](_0x48c57a()));}}return _0x399222;})[_0x410c('0x56')]();})[_0x410c('0x53')](function(){return db['Campaign'][_0x410c('0x4c')]({'attributes':['id',_0x410c('0x4d')],'include':[{'model':db[_0x410c('0x4e')],'as':_0x410c('0x4f'),'where':{'id':LISTID}}]})[_0x410c('0x53')](function(_0x48e6a8){var _0x14cf07=[];if(_0x48e6a8){for(var _0x515ea7=0x0,_0x168754;_0x515ea7<_0x48e6a8[_0x410c('0x19')];_0x515ea7+=0x1){_0x168754=_0x48e6a8[_0x515ea7][_0x410c('0x5a')]({'plain':!![]});switch(_0x168754['dialCheckDuplicateType']){case _0x410c('0x5b'):_0x14cf07['push'](db['sequelize'][_0x410c('0x55')](_0x4c57e5(_0x168754,'CampaignId'))[_0x410c('0x53')](function(){})[_0x410c('0x54')](_0x48c57a()));break;case _0x410c('0x52'):_0x14cf07[_0x410c('0x2d')](db[_0x410c('0x50')][_0x410c('0x55')](_0x5e491b(_0x168754,_0x410c('0x5c')))['then'](function(){})[_0x410c('0x54')](_0x48c57a()));break;default:_0x14cf07['push'](db[_0x410c('0x50')][_0x410c('0x55')](_0x501271(_0x168754,_0x410c('0x5c')))['then'](function(){})['catch'](_0x48c57a()));}}}return _0x14cf07;})[_0x410c('0x56')]();})[_0x410c('0x53')](function(){return db['Campaign'][_0x410c('0x4c')]({'attributes':['id'],'include':[{'model':db[_0x410c('0x4e')],'as':_0x410c('0x59'),'where':{'id':LISTID}}]})[_0x410c('0x53')](function(_0x18b42d){var _0x1205a7=[];if(_0x18b42d){for(var _0x3e85c2=0x0,_0x1d4021;_0x3e85c2<_0x18b42d[_0x410c('0x19')];_0x3e85c2+=0x1){_0x1d4021=_0x18b42d[_0x3e85c2][_0x410c('0x5a')]({'plain':!![]});_0x1205a7[_0x410c('0x2d')](db['sequelize']['query'](_0x2055a7(_0x1d4021,'CampaignId'))['then'](function(){})[_0x410c('0x54')](_0x48c57a()));}}return _0x1205a7;})['all']();})[_0x410c('0x54')](function(_0x18606c){logger[_0x410c('0x16')]('cmContact,\x20%s,\x20%s',_0x410c('0x5d'),_0x18606c['message']);});}var processPromises=function(_0x2a77da){return BPromise[_0x410c('0x56')](promises)[_0x410c('0x53')](function(_0x230c8c){})['catch'](function(_0x2e26e3){logger[_0x410c('0x16')]('Error\x20processing\x20rows\x20block:',JSON['stringify'](_0x2e26e3));})[_0x410c('0x5e')](function(){socket['emit'](_0x410c('0x5f')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2a77da){return _0x2a77da[_0x410c('0x60')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x410c('0x53')](function(){if(hopperContacts){return checkHopper();}})[_0x410c('0x53')](function(){socket[_0x410c('0x61')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x410c('0x62')](FILEPATH);}catch(_0x184b91){logger[_0x410c('0x16')](_0x410c('0x63'),JSON[_0x410c('0x2f')](_0x184b91));}finally{process[_0x410c('0x64')](0x0);}});};process['on'](_0x410c('0x65'),function(){logger[_0x410c('0x66')](_0x410c('0x67'));endCsv();});function main(){return BPromise['resolve']()[_0x410c('0x53')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x410c('0x68')][_0x410c('0x4c')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x41b478){var _0xf67a9c=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x410c('0x69')](_0xf67a9c,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3e2828,_0x562f23){total+=0x1;var _0x4f5f2c=total;promises[_0x410c('0x2d')](checkRow(_0x3e2828,_0x41b478,_0x4f5f2c)['then'](function(){success+=0x1;})['catch'](function(_0x217e08){if(_0x217e08['error']){errors+=0x1;delete _0x217e08['error'];}else if(_0x217e08['duplicate']){duplicates+=0x1;delete _0x217e08[_0x410c('0x2a')];}rows[_0x410c('0x2d')](_0x217e08);}));if(total%0xc8===0x0){_0x562f23['pause']();return processPromises(_0x562f23);}},'complete':function(){return processPromises()['then'](function(){logger[_0x410c('0x66')](_0x410c('0x6a'));endCsv();});},'error':function(_0x4e302f,_0x31277c){logger['info']('CSV\x20parse\x20error',JSON[_0x410c('0x2f')](_0x4e302f));endCsv();}});})[_0x410c('0x54')](function(_0xdb02c1){logger[_0x410c('0x16')](_0x410c('0x6b'),JSON[_0x410c('0x2f')](_0xdb02c1));});}main(); \ No newline at end of file +var _0xbc3f=['firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','Duplicate\x20Contact','create','keys','then','pick','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ListId\x20=\x20?','id\x20IN\x20?','str','cm_hopper_final','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','push','sequelize','VoiceQueueId','catch','query','all','always','CampaignId','onlyIfOpen','Campaign','BlackLists','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','emit','unlinkSync','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','CmContact','createReadStream','parse','duplicate','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','squel','papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','register','argv','undefined','null','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','errors','length','map','message','join','hasOwnProperty','data','firstName'];(function(_0x217f7e,_0x7ea43b){var _0x4ce5b7=function(_0x3089af){while(--_0x3089af){_0x217f7e['push'](_0x217f7e['shift']());}};_0x4ce5b7(++_0x7ea43b);}(_0xbc3f,0xc3));var _0xfbc3=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xbc3f[_0x122096];return _0x3d1966;};'use strict';var BPromise=require(_0xfbc3('0x0'));var util=require(_0xfbc3('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0xfbc3('0x2'));var Papa=require(_0xfbc3('0x3'));var Redis=require(_0xfbc3('0x4'));var db=require(_0xfbc3('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0xfbc3('0x6'))(_0xfbc3('0x7'));config[_0xfbc3('0x8')]=_[_0xfbc3('0x9')](config[_0xfbc3('0x8')],{'host':_0xfbc3('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfbc3('0x8')]));require('../../../api/cmContact/cmContact.socket')[_0xfbc3('0xb')](socket);try{if(!process[_0xfbc3('0xc')][0x2]||process[_0xfbc3('0xc')][0x2]===_0xfbc3('0xd')||process['argv'][0x2]===_0xfbc3('0xe')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0xfbc3('0xc')][0x2];if(!process[_0xfbc3('0xc')][0x3]||process[_0xfbc3('0xc')][0x3]===_0xfbc3('0xd')||process[_0xfbc3('0xc')][0x3]===_0xfbc3('0xe')||!process[_0xfbc3('0xc')][0x4]||process[_0xfbc3('0xc')][0x4]===_0xfbc3('0xd')||process[_0xfbc3('0xc')][0x4]===_0xfbc3('0xe')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0xfbc3('0xf')](process[_0xfbc3('0xc')][0x3][_0xfbc3('0x10')](','),process['argv'][0x4][_0xfbc3('0x10')](','));if(!process[_0xfbc3('0xc')][0x5]||process[_0xfbc3('0xc')][0x5]==='undefined'||process[_0xfbc3('0xc')][0x5]===_0xfbc3('0xe')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0xfbc3('0xc')][0x5];var COMPANYID=process[_0xfbc3('0xc')][0x6]&&process[_0xfbc3('0xc')][0x6]!==_0xfbc3('0xd')&&process[_0xfbc3('0xc')][0x6]!==_0xfbc3('0xe')?process['argv'][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process['argv'][0x7]!==_0xfbc3('0xd')&&process[_0xfbc3('0xc')][0x7]!==_0xfbc3('0xe')?process[_0xfbc3('0xc')][0x7]:null;if(!process[_0xfbc3('0xc')][0x8]||process[_0xfbc3('0xc')][0x8]===_0xfbc3('0xd')||process[_0xfbc3('0xc')][0x8]===_0xfbc3('0xe')){throw new Error(_0xfbc3('0x11'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x3f03ab){logger[_0xfbc3('0x12')](_0x3f03ab);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(_0x5298b8,_0x22dd5b,_0x4d5c15,_0x2307fe){var _0x23fbd5={'message':_0x22dd5b};_0x23fbd5[_0x5298b8]=!![];if(_0x4d5c15){_0x23fbd5[_0xfbc3('0x13')]=_0x4d5c15;}if(_0x2307fe){_0x23fbd5[_0xfbc3('0x14')]=_0x2307fe;}return _0x23fbd5;}function isEmail(_0x1ef780){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))*$/[_0xfbc3('0x15')](_0x1ef780);}function checkRow(_0x5dc390,_0x1b683c,_0x4954ea){return new BPromise(function(_0x37a2a9,_0x96f11a){if(_[_0xfbc3('0x16')](_0x5dc390)){return _0x96f11a(handleCheckRowError(_0xfbc3('0x12'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x4954ea));}if(_0x5dc390[_0xfbc3('0x17')]&&_0x5dc390[_0xfbc3('0x17')][_0xfbc3('0x18')]){var _0x42f58c=_[_0xfbc3('0x19')](_0x5dc390[_0xfbc3('0x17')],_0xfbc3('0x1a'))[_0xfbc3('0x1b')](';');return _0x96f11a(handleCheckRowError(_0xfbc3('0x12'),_0x42f58c,null,_0x4954ea));}var _0x14ec47={};for(var _0x1d7340 in FIELDS){if(FIELDS[_0xfbc3('0x1c')](_0x1d7340)&&FIELDS[_0x1d7340]){_0x14ec47[_0x1d7340]=_0x5dc390[_0xfbc3('0x1d')][0x0][FIELDS[_0x1d7340]]||_0x5dc390['data'][0x0]['\ufeff'+FIELDS[_0x1d7340]];}}if(!_0x14ec47[_0xfbc3('0x1e')]){return _0x96f11a(handleCheckRowError(_0xfbc3('0x12'),_0xfbc3('0x1f'),null,_0x4954ea));}if(!_0x14ec47['phone']){return _0x96f11a(handleCheckRowError('error',_0xfbc3('0x20'),null,_0x4954ea));}if(_0x14ec47[_0xfbc3('0x21')]){var _0x2d34c2=moment(_0x14ec47[_0xfbc3('0x21')],_0xfbc3('0x22'));if(!_0x2d34c2[_0xfbc3('0x23')]()){return _0x96f11a(handleCheckRowError(_0xfbc3('0x12'),_0xfbc3('0x24'),null,_0x4954ea));}}if(_0x14ec47[_0xfbc3('0x25')]){if(!isEmail(_0x14ec47[_0xfbc3('0x25')])){return _0x96f11a(handleCheckRowError(_0xfbc3('0x12'),_0xfbc3('0x26'),null,_0x4954ea));}}_0x14ec47[_0xfbc3('0x27')]=LISTID;_0x14ec47[_0xfbc3('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x1b683c){var _0x33a046={};for(var _0x686f03=0x0,_0x36bb53=DUPLICATES[_0xfbc3('0x18')];_0x686f03<_0x36bb53;_0x686f03+=0x1){_0x33a046[DUPLICATES[_0x686f03]]=_0x14ec47[DUPLICATES[_0x686f03]];}var _0x29514b=_['find'](_0x1b683c,_0x33a046);if(_0x29514b){return _0x96f11a(handleCheckRowError('duplicate',_0xfbc3('0x29'),_0x29514b,_0x4954ea));}}return db['CmContact'][_0xfbc3('0x2a')](_0x14ec47,{'raw':!![],'hooks':![],'fields':_[_0xfbc3('0x2b')](_0x14ec47)})[_0xfbc3('0x2c')](function(_0x3c24aa){if(DUPLICATES&&DUPLICATES[_0xfbc3('0x18')]&&_0x1b683c){_0x1b683c['push'](_[_0xfbc3('0x2d')](_0x14ec47,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3c24aa['id'];return _0x37a2a9();})['catch'](function(_0x920e45){return _0x96f11a(handleCheckRowError(_0xfbc3('0x12'),_0xfbc3('0x2e')+(_0x920e45[_0xfbc3('0x1a')]||JSON[_0xfbc3('0x2f')](_0x920e45)),null,_0x4954ea));});});}function checkHopper(){function _0x587054(){return function(_0x323031){logger[_0xfbc3('0x12')](_0xfbc3('0x30'),_0xfbc3('0x31'),util[_0xfbc3('0x32')](_0x323031,{'showHidden':![],'depth':null}));};}var _0x557b86=function(_0x2b52f1,_0x36f642){var _0x247d60=squel[_0xfbc3('0x33')]()[_0xfbc3('0x34')](_0xfbc3('0x35'))[_0xfbc3('0x36')]([_0xfbc3('0x37'),_0xfbc3('0x38'),_0xfbc3('0x39'),_0xfbc3('0x27'),_0x36f642,_0xfbc3('0x3a'),_0xfbc3('0x3b')],squel[_0xfbc3('0x3c')]()[_0xfbc3('0x3d')]('phone',_0xfbc3('0x37'))[_0xfbc3('0x3d')](_0xfbc3('0x3e'),_0xfbc3('0x38'))[_0xfbc3('0x3d')]('id','ContactId')[_0xfbc3('0x3d')](LISTID['toString'](),_0xfbc3('0x27'))['field'](_0x2b52f1['id'][_0xfbc3('0x3f')](),_0x36f642)['field'](_0xfbc3('0x3e'),_0xfbc3('0x3a'))[_0xfbc3('0x3d')](_0xfbc3('0x3e'),_0xfbc3('0x3b'))[_0xfbc3('0x40')](_0xfbc3('0x41'))[_0xfbc3('0x42')](_0xfbc3('0x43'))[_0xfbc3('0x42')]('ListId\x20=\x20?',LISTID[_0xfbc3('0x3f')]())[_0xfbc3('0x42')](_0xfbc3('0x44'))[_0xfbc3('0x42')](_0xfbc3('0x45'),squel['select']()[_0xfbc3('0x3d')](_0xfbc3('0x37'))[_0xfbc3('0x40')](_0xfbc3('0x35'))[_0xfbc3('0x42')](_0x36f642+_0xfbc3('0x46'),_0x2b52f1['id'][_0xfbc3('0x3f')]())))[_0xfbc3('0x3f')]();return _0x247d60;};var _0x4acf3d=function(_0x4fa39d,_0x58e492){var _0x1316cb=squel[_0xfbc3('0x33')]()[_0xfbc3('0x34')]('cm_hopper')['fromQuery']([_0xfbc3('0x37'),_0xfbc3('0x38'),_0xfbc3('0x39'),'ListId',_0x58e492,_0xfbc3('0x3a'),'updatedAt'],squel[_0xfbc3('0x3c')]()[_0xfbc3('0x3d')](_0xfbc3('0x37'),_0xfbc3('0x37'))['field']('NOW()',_0xfbc3('0x38'))['field']('id',_0xfbc3('0x39'))[_0xfbc3('0x3d')](LISTID[_0xfbc3('0x3f')](),_0xfbc3('0x27'))[_0xfbc3('0x3d')](_0x4fa39d['id'][_0xfbc3('0x3f')](),_0x58e492)[_0xfbc3('0x3d')](_0xfbc3('0x3e'),_0xfbc3('0x3a'))[_0xfbc3('0x3d')]('NOW()',_0xfbc3('0x3b'))[_0xfbc3('0x40')](_0xfbc3('0x41'))[_0xfbc3('0x42')]('deletedAt\x20IS\x20NULL')[_0xfbc3('0x42')](_0xfbc3('0x47'),LISTID[_0xfbc3('0x3f')]())['where'](_0xfbc3('0x48'),squel[_0xfbc3('0x49')](hopperContacts))[_0xfbc3('0x42')](_0xfbc3('0x44'))['where'](_0xfbc3('0x45'),squel[_0xfbc3('0x3c')]()[_0xfbc3('0x3d')]('calleridnum')[_0xfbc3('0x40')](_0xfbc3('0x4a'))[_0xfbc3('0x42')](_0x58e492+_0xfbc3('0x46'),_0x4fa39d['id'][_0xfbc3('0x3f')]()))['where'](_0xfbc3('0x45'),squel[_0xfbc3('0x3c')]()[_0xfbc3('0x3d')](_0xfbc3('0x37'))[_0xfbc3('0x40')](_0xfbc3('0x35'))[_0xfbc3('0x42')](_0x58e492+_0xfbc3('0x46'),_0x4fa39d['id'][_0xfbc3('0x3f')]())))['toString']();return _0x1316cb;};function _0x57fbba(_0x24df1f,_0xa2bacb){var _0x575334=squel[_0xfbc3('0x33')]()['into'](_0xfbc3('0x35'))[_0xfbc3('0x36')]([_0xfbc3('0x37'),_0xfbc3('0x38'),_0xfbc3('0x39'),_0xfbc3('0x27'),_0xa2bacb,_0xfbc3('0x3a'),_0xfbc3('0x3b')],squel[_0xfbc3('0x3c')]()[_0xfbc3('0x3d')]('phone','phone')[_0xfbc3('0x3d')](_0xfbc3('0x3e'),_0xfbc3('0x38'))['field']('id',_0xfbc3('0x39'))[_0xfbc3('0x3d')](LISTID[_0xfbc3('0x3f')](),_0xfbc3('0x27'))[_0xfbc3('0x3d')](_0x24df1f['id']['toString'](),_0xa2bacb)[_0xfbc3('0x3d')](_0xfbc3('0x3e'),_0xfbc3('0x3a'))[_0xfbc3('0x3d')](_0xfbc3('0x3e'),_0xfbc3('0x3b'))[_0xfbc3('0x40')](_0xfbc3('0x41'))[_0xfbc3('0x42')]('deletedAt\x20IS\x20NULL')[_0xfbc3('0x42')](_0xfbc3('0x47'),LISTID[_0xfbc3('0x3f')]())['where'](_0xfbc3('0x48'),squel[_0xfbc3('0x49')](hopperContacts))[_0xfbc3('0x42')](_0xfbc3('0x44')))[_0xfbc3('0x3f')]();return _0x575334;}function _0x5e69b3(_0x2b1b64,_0x4e3f87){var _0x2aad15=squel[_0xfbc3('0x33')]()[_0xfbc3('0x34')](_0xfbc3('0x4b'))[_0xfbc3('0x36')](['phone',_0xfbc3('0x39'),_0xfbc3('0x27'),_0x4e3f87,'createdAt',_0xfbc3('0x3b')],squel[_0xfbc3('0x3c')]()[_0xfbc3('0x3d')](_0xfbc3('0x37'),_0xfbc3('0x37'))[_0xfbc3('0x3d')]('id',_0xfbc3('0x39'))[_0xfbc3('0x3d')](LISTID[_0xfbc3('0x3f')](),_0xfbc3('0x27'))[_0xfbc3('0x3d')](_0x2b1b64['id'][_0xfbc3('0x3f')](),_0x4e3f87)[_0xfbc3('0x3d')](_0xfbc3('0x3e'),_0xfbc3('0x3a'))[_0xfbc3('0x3d')]('NOW()',_0xfbc3('0x3b'))[_0xfbc3('0x40')]('cm_contacts')[_0xfbc3('0x42')](_0xfbc3('0x43'))[_0xfbc3('0x42')](_0xfbc3('0x47'),LISTID[_0xfbc3('0x3f')]())[_0xfbc3('0x42')](_0xfbc3('0x48'),squel[_0xfbc3('0x49')](hopperContacts))[_0xfbc3('0x42')](_0xfbc3('0x44')))[_0xfbc3('0x3f')]();return _0x2aad15;}return db[_0xfbc3('0x4c')][_0xfbc3('0x4d')]({'where':{'type':_0xfbc3('0x4e')},'attributes':['id',_0xfbc3('0x4f')],'include':[{'model':db[_0xfbc3('0x50')],'as':_0xfbc3('0x51'),'where':{'id':LISTID}}]})['then'](function(_0x18317b){var _0x4c434b=[];if(_0x18317b){var _0x29029b;for(var _0x45a16c=0x0,_0xdd941c;_0x45a16c<_0x18317b[_0xfbc3('0x18')];_0x45a16c+=0x1){_0xdd941c=_0x18317b[_0x45a16c][_0xfbc3('0x52')]({'plain':!![]});switch(_0xdd941c[_0xfbc3('0x4f')]){case'always':_0x4c434b[_0xfbc3('0x53')](db[_0xfbc3('0x54')]['query'](_0x4acf3d(_0xdd941c,_0xfbc3('0x55')))[_0xfbc3('0x2c')](function(){})[_0xfbc3('0x56')](_0x587054()));break;case'onlyIfOpen':_0x4c434b[_0xfbc3('0x53')](db['sequelize'][_0xfbc3('0x57')](_0x557b86(_0xdd941c,_0xfbc3('0x55')))[_0xfbc3('0x2c')](function(){})[_0xfbc3('0x56')](_0x587054()));break;default:_0x4c434b[_0xfbc3('0x53')](db[_0xfbc3('0x54')][_0xfbc3('0x57')](_0x57fbba(_0xdd941c,_0xfbc3('0x55')))[_0xfbc3('0x2c')](function(){})['catch'](_0x587054()));}}}return _0x4c434b;})[_0xfbc3('0x58')]()[_0xfbc3('0x2c')](function(){return db[_0xfbc3('0x4c')][_0xfbc3('0x4d')]({'where':{'type':_0xfbc3('0x4e')},'attributes':['id'],'include':[{'model':db[_0xfbc3('0x50')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xfbc3('0x2c')](function(_0x5eff58){var _0x47c236=[];if(_0x5eff58){var _0x392110;for(var _0xe1c9b4=0x0,_0x445d88;_0xe1c9b4<_0x5eff58[_0xfbc3('0x18')];_0xe1c9b4+=0x1){_0x445d88=_0x5eff58[_0xe1c9b4][_0xfbc3('0x52')]({'plain':!![]});_0x47c236[_0xfbc3('0x53')](db['sequelize']['query'](_0x5e69b3(_0x445d88,_0xfbc3('0x55')))['then'](function(){})['catch'](_0x587054()));}}return _0x47c236;})[_0xfbc3('0x58')]();})['then'](function(){return db['Campaign'][_0xfbc3('0x4d')]({'attributes':['id',_0xfbc3('0x4f')],'include':[{'model':db[_0xfbc3('0x50')],'as':_0xfbc3('0x51'),'where':{'id':LISTID}}]})[_0xfbc3('0x2c')](function(_0x220595){var _0x156715=[];if(_0x220595){for(var _0x27b71f=0x0,_0x143cac;_0x27b71f<_0x220595['length'];_0x27b71f+=0x1){_0x143cac=_0x220595[_0x27b71f][_0xfbc3('0x52')]({'plain':!![]});switch(_0x143cac['dialCheckDuplicateType']){case _0xfbc3('0x59'):_0x156715['push'](db['sequelize'][_0xfbc3('0x57')](_0x4acf3d(_0x143cac,_0xfbc3('0x5a')))[_0xfbc3('0x2c')](function(){})[_0xfbc3('0x56')](_0x587054()));break;case _0xfbc3('0x5b'):_0x156715[_0xfbc3('0x53')](db[_0xfbc3('0x54')]['query'](_0x557b86(_0x143cac,_0xfbc3('0x5a')))[_0xfbc3('0x2c')](function(){})[_0xfbc3('0x56')](_0x587054()));break;default:_0x156715[_0xfbc3('0x53')](db[_0xfbc3('0x54')][_0xfbc3('0x57')](_0x57fbba(_0x143cac,_0xfbc3('0x5a')))[_0xfbc3('0x2c')](function(){})[_0xfbc3('0x56')](_0x587054()));}}}return _0x156715;})[_0xfbc3('0x58')]();})[_0xfbc3('0x2c')](function(){return db[_0xfbc3('0x5c')]['findAll']({'attributes':['id'],'include':[{'model':db[_0xfbc3('0x50')],'as':_0xfbc3('0x5d'),'where':{'id':LISTID}}]})['then'](function(_0xafa451){var _0x32f9f5=[];if(_0xafa451){for(var _0x164976=0x0,_0x212fcc;_0x164976<_0xafa451[_0xfbc3('0x18')];_0x164976+=0x1){_0x212fcc=_0xafa451[_0x164976][_0xfbc3('0x52')]({'plain':!![]});_0x32f9f5[_0xfbc3('0x53')](db[_0xfbc3('0x54')][_0xfbc3('0x57')](_0x5e69b3(_0x212fcc,_0xfbc3('0x5a')))['then'](function(){})[_0xfbc3('0x56')](_0x587054()));}}return _0x32f9f5;})[_0xfbc3('0x58')]();})[_0xfbc3('0x56')](function(_0x20b3f9){logger['error']('cmContact,\x20%s,\x20%s',_0xfbc3('0x5e'),_0x20b3f9['message']);});}var processPromises=function(_0x764b1){return BPromise[_0xfbc3('0x58')](promises)[_0xfbc3('0x2c')](function(_0x2a5511){})['catch'](function(_0x3a971f){logger[_0xfbc3('0x12')](_0xfbc3('0x5f'),JSON[_0xfbc3('0x2f')](_0x3a971f));})[_0xfbc3('0x60')](function(){socket['emit'](_0xfbc3('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x764b1){return _0x764b1[_0xfbc3('0x62')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0xfbc3('0x63')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xfbc3('0x64')](FILEPATH);}catch(_0x25c2c4){logger[_0xfbc3('0x12')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0xfbc3('0x2f')](_0x25c2c4));}finally{process[_0xfbc3('0x65')](0x0);}});};process['on'](_0xfbc3('0x66'),function(){logger[_0xfbc3('0x67')](_0xfbc3('0x68'));endCsv();});function main(){return BPromise[_0xfbc3('0x69')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0xfbc3('0x6a')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xfbc3('0x2c')](function(_0x141421){var _0x436456=fs[_0xfbc3('0x6b')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xfbc3('0x6c')](_0x436456,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4dbdd8,_0x8ec295){total+=0x1;var _0xa45c6=total;promises[_0xfbc3('0x53')](checkRow(_0x4dbdd8,_0x141421,_0xa45c6)[_0xfbc3('0x2c')](function(){success+=0x1;})[_0xfbc3('0x56')](function(_0x370ff0){if(_0x370ff0[_0xfbc3('0x12')]){errors+=0x1;delete _0x370ff0[_0xfbc3('0x12')];}else if(_0x370ff0[_0xfbc3('0x6d')]){duplicates+=0x1;delete _0x370ff0['duplicate'];}rows[_0xfbc3('0x53')](_0x370ff0);}));if(total%0xc8===0x0){_0x8ec295[_0xfbc3('0x6e')]();return processPromises(_0x8ec295);}},'complete':function(){return processPromises()[_0xfbc3('0x2c')](function(){logger[_0xfbc3('0x67')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x41b916,_0x5d8da2){logger[_0xfbc3('0x67')](_0xfbc3('0x6f'),JSON[_0xfbc3('0x2f')](_0x41b916));endCsv();}});})[_0xfbc3('0x56')](function(_0x43bce4){logger[_0xfbc3('0x12')](_0xfbc3('0x70'),JSON[_0xfbc3('0x2f')](_0x43bce4));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 98a937d..6ff4424 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 _0x1107=['ContactId','ListId\x20=\x20?','\x20=\x20?','concat','keys',')\x20NOT\x20IN\x20?','id\x20IN\x20?','group','toString','Received\x20SIGINT','message','errors','code','sequelize','spread','push','catch','error','main','stringify','start','binding','root','server/files/tmp','.csv','info','header','writeFileSync','parse','data','length','rows','hasOwnProperty','trim','scheduledat','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','email','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','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()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','campaigns_has_cm_blacklists','CampaignId','then','finish','affectedRows','exit','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','moment','squel','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.UserId','insert','cm_hopper','fromQuery','ListId','createdAt','updatedAt','priority','UserId','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.createdAt','into','cm_hopper_black'];(function(_0x526944,_0x37fe62){var _0x51d4be=function(_0x53c55e){while(--_0x53c55e){_0x526944['push'](_0x526944['shift']());}};_0x51d4be(++_0x37fe62);}(_0x1107,0xd8));var _0x7110=function(_0xf9cb7a,_0x155fd9){_0xf9cb7a=_0xf9cb7a-0x0;var _0x337245=_0x1107[_0xf9cb7a];return _0x337245;};'use strict';var fs=require('fs');var path=require(_0x7110('0x0'));var _=require(_0x7110('0x1'));var Papa=require(_0x7110('0x2'));var util=require('util');var BPromise=require('bluebird');var moment=require(_0x7110('0x3'));var squel=require(_0x7110('0x4'));var Redis=require('ioredis');var db=require(_0x7110('0x5'))['db'];var config=require(_0x7110('0x6'));var logger=require(_0x7110('0x7'))(_0x7110('0x8'));config[_0x7110('0x9')]=_[_0x7110('0xa')](config[_0x7110('0x9')],{'host':_0x7110('0xb'),'port':0x18eb});var socket=require(_0x7110('0xc'))(new Redis(config[_0x7110('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x7110('0xd')](_0x7110('0xe'));function isEmail(_0x271466){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x271466);}function selectNotIn(_0xf97144,_0x4ec77d,_0x400dc6,_0x19d729,_0x4f7cc8){return squel[_0x7110('0xf')]()[_0x7110('0x10')](_0x7110('0x11'))[_0x7110('0x12')](_0x19d729)[_0x7110('0x13')](_0x4ec77d,null,_0x4ec77d+_0x7110('0x14')+_0x19d729+'.'+_0x400dc6)[_0x7110('0x15')](_0x19d729+'.'+_0x400dc6+_0x7110('0x16')+_0xf97144+'.'+_0x400dc6)[_0x7110('0x15')](_0x4ec77d+'.dialCheckDuplicateType\x20IN\x20('+_0x4f7cc8[_0x7110('0x13')]()+')');}function insertCmHopper(_0x562b5a,_0x36c44d,_0x56b08b,_0x21cb1d,_0xaa3bf4){var _0x193613=[_0x7110('0x17'),_0x7110('0x18'),_0x7110('0x19'),_0x7110('0x1a'),_0x36c44d+'.'+_0x21cb1d,'cm_contacts.createdAt',_0x7110('0x1b'),'cm_contacts.priority',_0x7110('0x1c'),'\x22'+_0xaa3bf4+'\x22'];return squel[_0x7110('0x1d')]()['into'](_0x7110('0x1e'))[_0x7110('0x1f')]([_0x7110('0x11'),'scheduledat','ContactId',_0x7110('0x20'),_0x21cb1d,_0x7110('0x21'),_0x7110('0x22'),_0x7110('0x23'),_0x7110('0x24'),'recallme'],squel[_0x7110('0xf')]()[_0x7110('0x25')](_0x193613)[_0x7110('0x12')](_0x36c44d)[_0x7110('0x13')](_0x7110('0x26'),null,_0x7110('0x27')+_0x36c44d+_0x7110('0x28'))[_0x7110('0x13')](_0x56b08b,null,_0x56b08b+'.id\x20=\x20'+_0x36c44d+'.'+_0x21cb1d)[_0x7110('0x15')](_0x36c44d+'.CmListId\x20=\x20?',_0x562b5a)[_0x7110('0x15')](_0x7110('0x29'),NOW)[_0x7110('0x15')](_0x7110('0x2a'),selectNotIn(_0x36c44d,_0x56b08b,_0x21cb1d,'cm_hopper',[_0x7110('0x2b'),_0x7110('0x2c')]))[_0x7110('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x36c44d,_0x56b08b,_0x21cb1d,_0x7110('0x1e'),['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x427943,_0x1370c5,_0x16b03d,_0x14cae3){var _0x55f9f8=[_0x7110('0x17'),_0x7110('0x19'),_0x7110('0x1a'),_0x1370c5+'.'+_0x14cae3,_0x7110('0x2d'),_0x7110('0x1b')];return squel[_0x7110('0x1d')]()[_0x7110('0x2e')](_0x7110('0x2f'))[_0x7110('0x1f')]([_0x7110('0x11'),_0x7110('0x30'),_0x7110('0x20'),_0x14cae3,'createdAt','updatedAt'],squel[_0x7110('0xf')]()['fields'](_0x55f9f8)['from'](_0x1370c5)[_0x7110('0x13')](_0x7110('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x1370c5+_0x7110('0x28'))['join'](_0x16b03d,null,_0x16b03d+_0x7110('0x14')+_0x1370c5+'.'+_0x14cae3)[_0x7110('0x15')](_0x1370c5+'.CmListId\x20=\x20?',_0x427943)[_0x7110('0x15')](_0x7110('0x29'),NOW)[_0x7110('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7110('0xf')]()[_0x7110('0x10')](_0x7110('0x11'))[_0x7110('0x12')](_0x7110('0x2f'))[_0x7110('0x15')](_0x7110('0x31'),_0x427943)[_0x7110('0x15')](_0x14cae3+_0x7110('0x32'),_0x1370c5+'.'+_0x14cae3)))['toString']();}function insertCmContact(_0x4c60b0,_0x421bd6,_0x58d23e,_0x44ec87){var _0x22ff33=_[_0x7110('0x33')](_[_0x7110('0x34')](_0x44ec87),['ListId','CompanyId',_0x7110('0x21'),'updatedAt']);return squel[_0x7110('0x1d')]()[_0x7110('0x2e')]('cm_contacts')[_0x7110('0x1f')](_0x22ff33,squel['select']()[_0x7110('0x25')](_0x22ff33)[_0x7110('0x12')](_0x421bd6)[_0x7110('0x15')]('('+_0x58d23e[_0x7110('0x13')](',')+_0x7110('0x35'),squel['select']()[_0x7110('0x25')](_0x58d23e)[_0x7110('0x12')](_0x7110('0x26'))[_0x7110('0x15')](_0x7110('0x31'),_0x4c60b0)[_0x7110('0x15')]('deletedAt\x20IS\x20NULL'))[_0x7110('0x15')](_0x7110('0x36'),squel[_0x7110('0xf')]()['field']('MIN(id)','min_id')[_0x7110('0x12')](_0x421bd6)[_0x7110('0x37')](_0x58d23e[_0x7110('0x13')](','))))[_0x7110('0x38')]();}function handleStop(){logger['info'](_0x7110('0x39'));stopped=!![];}function handleUncaughtException(_0x329176){logger['error'](_0x329176[_0x7110('0x3a')]);process['exit'](0x1);}function handleError(_0x4e4cda,_0x4f537f){stats[_0x7110('0x3b')]['push']({'name':_0x4f537f[_0x7110('0x3c')],'message':_0x4f537f[_0x7110('0x3a')],'row':_0x4e4cda});}function handleQuery(_0xdedb23){logger['info'](_0xdedb23);return db[_0x7110('0x3d')]['query'](_0xdedb23)[_0x7110('0x3e')](function(_0x280a97){results[_0x7110('0x3f')](_0x280a97);})[_0x7110('0x40')](function(_0x42ce2a){logger[_0x7110('0x41')](_0x42ce2a[_0x7110('0x3a')]);});}function main(_0x5cd742,_0x368b1e,_0x4cfebc,_0x1494f5){logger['info'](_0x7110('0x42'),_0x5cd742,JSON[_0x7110('0x43')](_0x368b1e));process['send'](_0x7110('0x44'));var _0x14d1e6=_0x368b1e[_0x7110('0x45')];var _0x51c090=_0x368b1e['socket_timestamp'];var _0x159c4d=path['join'](config[_0x7110('0x46')],_0x7110('0x47'),_0x51c090+_0x7110('0x48'));var _0x1fd8fc=_[_0x7110('0x34')](_0x14d1e6)['join']();logger[_0x7110('0x49')](_0x7110('0x4a'),_0x1fd8fc);fs[_0x7110('0x4b')](_0x159c4d,_0x1fd8fc+'\x0a');Papa[_0x7110('0x4c')](fs['createReadStream'](_0x5cd742),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1bb7f3,_0x20650e){try{for(var _0x4ca881=0x0,_0x59c99a=[];_0x4ca881<_0x1bb7f3[_0x7110('0x4d')][_0x7110('0x4e')];_0x4ca881++){stats[_0x7110('0x4f')]+=0x1;if(_0x1bb7f3[_0x7110('0x3b')][_0x4ca881]){handleError(_0x1bb7f3[_0x7110('0x4d')][_0x4ca881],_0x1bb7f3['errors'][_0x4ca881]);}else{var _0x3fc1a2=[];for(var _0x5c1211 in _0x14d1e6){if(_0x14d1e6[_0x7110('0x50')](_0x5c1211)){if(_0x1bb7f3['data'][_0x4ca881][_0x14d1e6[_0x5c1211]]){var _0x162795=_[_0x7110('0x51')](_0x1bb7f3[_0x7110('0x4d')][_0x4ca881][_0x14d1e6[_0x5c1211]]['replace'](/"/g,'\x27'));switch(_0x5c1211){case _0x7110('0x52'):var _0x107c80=moment(_0x162795,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x107c80[_0x7110('0x53')]()){_0x59c99a[_0x7110('0x3f')]('\x22'+_0x162795+'\x22');}else{_0x3fc1a2[_0x7110('0x3f')](_0x7110('0x54'));}break;case _0x7110('0x23'):var _0x43883b=parseInt(_0x162795);_0x162795=_[_0x7110('0x55')](_0x43883b)||_0x43883b<0x0||_0x43883b>0x4?_0x1494f5?0x3:0x2:_0x43883b;_0x59c99a[_0x7110('0x3f')]('\x22'+_0x162795+'\x22');break;case'UserId':var _0x352446=parseInt(_0x162795);if(_[_0x7110('0x56')](_0x352446)&&_[_0x7110('0x57')](_0x4cfebc,_0x352446)){_0x59c99a[_0x7110('0x3f')]('\x22'+_0x352446+'\x22');}else{_0x3fc1a2['push']('agent\x20not\x20exists');}break;case _0x7110('0x58'):if(isEmail(_0x162795)){_0x59c99a[_0x7110('0x3f')]('\x22'+_0x162795+'\x22');}else{_0x3fc1a2[_0x7110('0x3f')](_0x7110('0x59'));}break;case'dateOfBirth':var _0x5be37e=moment(_0x162795,_0x7110('0x5a'),!![]);if(_0x5be37e[_0x7110('0x53')]()){_0x59c99a[_0x7110('0x3f')]('\x22'+_0x162795+'\x22');}else{_0x3fc1a2[_0x7110('0x3f')](_0x7110('0x5b'));}break;default:_0x59c99a[_0x7110('0x3f')]('\x22'+_0x162795+'\x22');}}else{switch(_0x5c1211){case _0x7110('0x5c'):case'phone':_0x3fc1a2[_0x7110('0x3f')](_0x5c1211+_0x7110('0x5d'));break;default:_0x59c99a[_0x7110('0x3f')]('\x22\x22');}}}}if(_0x3fc1a2['length']){handleError(_0x1bb7f3[_0x7110('0x4d')][_0x4ca881],{'code':_0x7110('0x5e'),'message':_0x3fc1a2[_0x7110('0x13')]()});}else{fs[_0x7110('0x5f')](_0x159c4d,_0x59c99a[_0x7110('0x13')]()+'\x0a');}_0x59c99a=[];}if(!(stats['rows']%0xc8)){socket[_0x7110('0x60')](_0x7110('0x61')+_0x51c090,stats);stats[_0x7110('0x3b')]=[];}}if(stopped){logger[_0x7110('0x49')](_0x7110('0x62'));_0x20650e[_0x7110('0x63')]();}}catch(_0x30902a){handleError(_0x1bb7f3[_0x7110('0x4d')][_0x4ca881],{'code':_0x7110('0x64'),'message':_0x30902a[_0x7110('0x3a')]});logger[_0x7110('0x41')]('step',_0x30902a[_0x7110('0x3a')]);}},'complete':function(){try{var _0x45de56=[];var _0x6cec1a=_0x7110('0x26');if(_0x368b1e[_0x7110('0x65')]&&_0x368b1e[_0x7110('0x65')]['length']){_0x6cec1a=_0x7110('0x66')+_0x51c090;_0x45de56[_0x7110('0x3f')](_0x7110('0x67')+_0x6cec1a+_0x7110('0x68'));}var _0x2727d6=util[_0x7110('0xd')](_0x7110('0x69'),_0x159c4d,_0x6cec1a,_0x1fd8fc,_0x368b1e[_0x7110('0x20')],_0x368b1e[_0x7110('0x6a')]||null,NOW,NOW);if(_[_0x7110('0x6b')](_0x14d1e6[_0x7110('0x52')])){_0x2727d6+=_0x7110('0x6c');}_0x45de56[_0x7110('0x3f')](_0x2727d6);if(_0x368b1e[_0x7110('0x65')]&&_0x368b1e[_0x7110('0x65')][_0x7110('0x4e')]){_0x45de56[_0x7110('0x3f')](insertCmContact(_0x368b1e[_0x7110('0x20')],_0x6cec1a,_0x368b1e[_0x7110('0x65')],_0x14d1e6));_0x45de56[_0x7110('0x3f')](_0x7110('0x6d')+_0x6cec1a+';');}_0x45de56['push'](insertCmHopper(_0x368b1e[_0x7110('0x20')],_0x7110('0x6e'),_0x7110('0x6f'),_0x7110('0x70'),_0x1494f5));_0x45de56[_0x7110('0x3f')](insertCmHopperBlack(_0x368b1e[_0x7110('0x20')],_0x7110('0x71'),_0x7110('0x6f'),_0x7110('0x70')));_0x45de56[_0x7110('0x3f')](insertCmHopper(_0x368b1e[_0x7110('0x20')],_0x7110('0x72'),_0x7110('0x73'),'CampaignId',_0x1494f5));_0x45de56[_0x7110('0x3f')](insertCmHopperBlack(_0x368b1e[_0x7110('0x20')],_0x7110('0x74'),_0x7110('0x73'),_0x7110('0x75')));BPromise['each'](_0x45de56,handleQuery)[_0x7110('0x76')](function(_0x677e93){stats[_0x7110('0x77')]=!![];stats[_0x7110('0x78')]=_0x368b1e[_0x7110('0x65')]&&_0x368b1e[_0x7110('0x65')][_0x7110('0x4e')]?results[0x2][_0x7110('0x78')]:results[0x0][_0x7110('0x78')];socket[_0x7110('0x60')](_0x7110('0x61')+_0x51c090,stats);fs['unlink'](_0x5cd742);fs['unlink'](_0x159c4d);process[_0x7110('0x79')](0x0);})[_0x7110('0x40')](function(_0x2597ea){logger['error'](_0x2597ea[_0x7110('0x3a')]);process[_0x7110('0x79')](0x1);});}catch(_0x5a2793){logger[_0x7110('0x41')](_0x7110('0x7a'),_0x5a2793[_0x7110('0x3a')]);process['exit'](0x1);}},'error':function(_0x203b24,_0x446279,_0x10925d,_0x4fd49c){throw new Error(_0x4fd49c);}});}function validate(){if(process[_0x7110('0x7b')]&&process[_0x7110('0x7b')]['length']<0x4){throw new Error(_0x7110('0x7c'));}var _0x5f2ce1=path[_0x7110('0x13')](config[_0x7110('0x46')],_0x7110('0x47'),process[_0x7110('0x7b')][0x2]);if(!fs[_0x7110('0x7d')](_0x5f2ce1)){throw new Error(_0x7110('0x7e'));}var _0xabd399={};try{_0xabd399=JSON[_0x7110('0x4c')](process['argv'][0x3]);if(!_0xabd399[_0x7110('0x45')]){throw new Error(_0x7110('0x7f'));}if(!_0xabd399['binding'][_0x7110('0x11')]){throw new Error('phone\x20is\x20mandatory');}if(!_0xabd399[_0x7110('0x45')][_0x7110('0x5c')]){throw new Error('firstName\x20is\x20mandatory');}var _0x4567e3=0x0;if(_0xabd399[_0x7110('0x45')][_0x7110('0x24')]){_0x4567e3=0x1;}if(!_0xabd399[_0x7110('0x20')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x1cc0a5){throw new Error(_0x7110('0x80'));}var _0x50e8d9=[];try{_0x50e8d9=_['map'](JSON[_0x7110('0x4c')](process[_0x7110('0x7b')][0x4]),'id');}catch(_0x1c8496){logger['info'](_0x7110('0x81'));}main(_0x5f2ce1,_0xabd399,_0x50e8d9,_0x4567e3);}validate();process['on'](_0x7110('0x82'),handleStop);process['on'](_0x7110('0x83'),handleUncaughtException); \ No newline at end of file +var _0x7efc=['socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','field','from','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','join','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','fromQuery','ContactId','ListId','createdAt','updatedAt','UserId','recallme','select','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','phone','cm_contacts.createdAt\x20=\x20?','cm_hopper_black','ListId\x20=\x20?','concat','keys','deletedAt\x20IS\x20NULL','min_id','Received\x20SIGINT','error','message','errors','push','code','info','sequelize','catch','main','stringify','send','start','binding','socket_timestamp','server/files/tmp','header','writeFileSync','createReadStream','length','rows','hasOwnProperty','data','trim','replace','scheduledat','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNumber','includes','agent\x20not\x20exists','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_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','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','voice_queues_has_cm_blacklists','VoiceQueueId','campaigns_has_cm_lists','campaigns','CampaignId','each','then','finish','affectedRows','emit','unlink','exit','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','SIGINT','uncaughtException','path','papaparse','util','bluebird','moment','ioredis','../../../config/environment','redis','defaults'];(function(_0x256022,_0x24f7d7){var _0x1f6466=function(_0x485043){while(--_0x485043){_0x256022['push'](_0x256022['shift']());}};_0x1f6466(++_0x24f7d7);}(_0x7efc,0x183));var _0xc7ef=function(_0x595bd1,_0xb1e7a){_0x595bd1=_0x595bd1-0x0;var _0xd0344f=_0x7efc[_0x595bd1];return _0xd0344f;};'use strict';var fs=require('fs');var path=require(_0xc7ef('0x0'));var _=require('lodash');var Papa=require(_0xc7ef('0x1'));var util=require(_0xc7ef('0x2'));var BPromise=require(_0xc7ef('0x3'));var moment=require(_0xc7ef('0x4'));var squel=require('squel');var Redis=require(_0xc7ef('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0xc7ef('0x6'));var logger=require('../../../config/logger')('import');config[_0xc7ef('0x7')]=_[_0xc7ef('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc7ef('0x9'))(new Redis(config[_0xc7ef('0x7')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xc7ef('0xa')](_0xc7ef('0xb'));function isEmail(_0x152e77){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))*$/[_0xc7ef('0xc')](_0x152e77);}function selectNotIn(_0x3f6ae2,_0x15223a,_0x304941,_0x5d5523,_0x25f151){return squel['select']()[_0xc7ef('0xd')]('phone')[_0xc7ef('0xe')](_0x5d5523)['join'](_0x15223a,null,_0x15223a+'.id\x20=\x20'+_0x5d5523+'.'+_0x304941)['where'](_0x5d5523+'.'+_0x304941+_0xc7ef('0xf')+_0x3f6ae2+'.'+_0x304941)[_0xc7ef('0x10')](_0x15223a+_0xc7ef('0x11')+_0x25f151[_0xc7ef('0x12')]()+')');}function insertCmHopper(_0x5175a0,_0x25a7df,_0x4a327e,_0x37217c,_0x1e1a53){var _0x2b04ae=[_0xc7ef('0x13'),_0xc7ef('0x14'),_0xc7ef('0x15'),_0xc7ef('0x16'),_0x25a7df+'.'+_0x37217c,_0xc7ef('0x17'),_0xc7ef('0x18'),'cm_contacts.priority',_0xc7ef('0x19'),'\x22'+_0x1e1a53+'\x22'];return squel[_0xc7ef('0x1a')]()[_0xc7ef('0x1b')]('cm_hopper')[_0xc7ef('0x1c')](['phone','scheduledat',_0xc7ef('0x1d'),_0xc7ef('0x1e'),_0x37217c,_0xc7ef('0x1f'),_0xc7ef('0x20'),'priority',_0xc7ef('0x21'),_0xc7ef('0x22')],squel[_0xc7ef('0x23')]()[_0xc7ef('0x24')](_0x2b04ae)[_0xc7ef('0xe')](_0x25a7df)['join'](_0xc7ef('0x25'),null,_0xc7ef('0x26')+_0x25a7df+_0xc7ef('0x27'))[_0xc7ef('0x12')](_0x4a327e,null,_0x4a327e+_0xc7ef('0x28')+_0x25a7df+'.'+_0x37217c)['where'](_0x25a7df+'.CmListId\x20=\x20?',_0x5175a0)['where']('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0xc7ef('0x29'),selectNotIn(_0x25a7df,_0x4a327e,_0x37217c,_0xc7ef('0x2a'),[_0xc7ef('0x2b'),_0xc7ef('0x2c')]))[_0xc7ef('0x10')](_0xc7ef('0x29'),selectNotIn(_0x25a7df,_0x4a327e,_0x37217c,_0xc7ef('0x2a'),[_0xc7ef('0x2b')])))[_0xc7ef('0x2d')]();}function insertCmHopperBlack(_0x4f23af,_0x4273b6,_0x1ba148,_0x189533){var _0x41d10b=['cm_contacts.phone',_0xc7ef('0x15'),'cm_contacts.ListId',_0x4273b6+'.'+_0x189533,_0xc7ef('0x17'),_0xc7ef('0x18')];return squel[_0xc7ef('0x1a')]()[_0xc7ef('0x1b')]('cm_hopper_black')[_0xc7ef('0x1c')]([_0xc7ef('0x2e'),'ContactId',_0xc7ef('0x1e'),_0x189533,_0xc7ef('0x1f'),_0xc7ef('0x20')],squel[_0xc7ef('0x23')]()[_0xc7ef('0x24')](_0x41d10b)[_0xc7ef('0xe')](_0x4273b6)[_0xc7ef('0x12')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x4273b6+_0xc7ef('0x27'))[_0xc7ef('0x12')](_0x1ba148,null,_0x1ba148+_0xc7ef('0x28')+_0x4273b6+'.'+_0x189533)[_0xc7ef('0x10')](_0x4273b6+'.CmListId\x20=\x20?',_0x4f23af)['where'](_0xc7ef('0x2f'),NOW)[_0xc7ef('0x10')](_0xc7ef('0x29'),squel[_0xc7ef('0x23')]()[_0xc7ef('0xd')](_0xc7ef('0x2e'))[_0xc7ef('0xe')](_0xc7ef('0x30'))[_0xc7ef('0x10')](_0xc7ef('0x31'),_0x4f23af)['where'](_0x189533+'\x20=\x20?',_0x4273b6+'.'+_0x189533)))['toString']();}function insertCmContact(_0x20b01b,_0xa46ca5,_0x38436d,_0xc12d35){var _0x35d01d=_[_0xc7ef('0x32')](_[_0xc7ef('0x33')](_0xc12d35),[_0xc7ef('0x1e'),'CompanyId','createdAt',_0xc7ef('0x20')]);return squel['insert']()[_0xc7ef('0x1b')](_0xc7ef('0x25'))[_0xc7ef('0x1c')](_0x35d01d,squel['select']()['fields'](_0x35d01d)[_0xc7ef('0xe')](_0xa46ca5)[_0xc7ef('0x10')]('('+_0x38436d[_0xc7ef('0x12')](',')+')\x20NOT\x20IN\x20?',squel[_0xc7ef('0x23')]()['fields'](_0x38436d)[_0xc7ef('0xe')]('cm_contacts')[_0xc7ef('0x10')](_0xc7ef('0x31'),_0x20b01b)['where'](_0xc7ef('0x34')))[_0xc7ef('0x10')]('id\x20IN\x20?',squel[_0xc7ef('0x23')]()[_0xc7ef('0xd')]('MIN(id)',_0xc7ef('0x35'))[_0xc7ef('0xe')](_0xa46ca5)['group'](_0x38436d[_0xc7ef('0x12')](','))))[_0xc7ef('0x2d')]();}function handleStop(){logger['info'](_0xc7ef('0x36'));stopped=!![];}function handleUncaughtException(_0x21efc1){logger[_0xc7ef('0x37')](_0x21efc1[_0xc7ef('0x38')]);process['exit'](0x1);}function handleError(_0x47d071,_0x1666d6){stats[_0xc7ef('0x39')][_0xc7ef('0x3a')]({'name':_0x1666d6[_0xc7ef('0x3b')],'message':_0x1666d6[_0xc7ef('0x38')],'row':_0x47d071});}function handleQuery(_0x284e58){logger[_0xc7ef('0x3c')](_0x284e58);return db[_0xc7ef('0x3d')]['query'](_0x284e58)['spread'](function(_0xb03e48){results['push'](_0xb03e48);})[_0xc7ef('0x3e')](function(_0x62f262){logger[_0xc7ef('0x37')](_0x62f262['message']);});}function main(_0x114d88,_0x26cac6,_0xf6a17e,_0x13ec91){logger['info'](_0xc7ef('0x3f'),_0x114d88,JSON[_0xc7ef('0x40')](_0x26cac6));process[_0xc7ef('0x41')](_0xc7ef('0x42'));var _0x3eb758=_0x26cac6[_0xc7ef('0x43')];var _0x3bd583=_0x26cac6[_0xc7ef('0x44')];var _0x5e0e1c=path[_0xc7ef('0x12')](config['root'],_0xc7ef('0x45'),_0x3bd583+'.csv');var _0x2313bf=_[_0xc7ef('0x33')](_0x3eb758)[_0xc7ef('0x12')]();logger[_0xc7ef('0x3c')](_0xc7ef('0x46'),_0x2313bf);fs[_0xc7ef('0x47')](_0x5e0e1c,_0x2313bf+'\x0a');Papa['parse'](fs[_0xc7ef('0x48')](_0x114d88),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3a1c5c,_0x15e67c){try{for(var _0x402413=0x0,_0x21a795=[];_0x402413<_0x3a1c5c['data'][_0xc7ef('0x49')];_0x402413++){stats[_0xc7ef('0x4a')]+=0x1;if(_0x3a1c5c[_0xc7ef('0x39')][_0x402413]){handleError(_0x3a1c5c['data'][_0x402413],_0x3a1c5c[_0xc7ef('0x39')][_0x402413]);}else{var _0x10b0b7=[];for(var _0x556f0b in _0x3eb758){if(_0x3eb758[_0xc7ef('0x4b')](_0x556f0b)){if(_0x3a1c5c[_0xc7ef('0x4c')][_0x402413][_0x3eb758[_0x556f0b]]){var _0x3271dd=_[_0xc7ef('0x4d')](_0x3a1c5c[_0xc7ef('0x4c')][_0x402413][_0x3eb758[_0x556f0b]][_0xc7ef('0x4e')](/"/g,'\x27'));switch(_0x556f0b){case _0xc7ef('0x4f'):var _0x1ece92=moment(_0x3271dd,_0xc7ef('0xb'),!![]);if(_0x1ece92[_0xc7ef('0x50')]()){_0x21a795['push']('\x22'+_0x3271dd+'\x22');}else{_0x10b0b7[_0xc7ef('0x3a')](_0xc7ef('0x51'));}break;case _0xc7ef('0x52'):var _0xbb2108=parseInt(_0x3271dd);_0x3271dd=_['isNaN'](_0xbb2108)||_0xbb2108<0x0||_0xbb2108>0x4?_0x13ec91?0x3:0x2:_0xbb2108;_0x21a795['push']('\x22'+_0x3271dd+'\x22');break;case'UserId':var _0xc4fb9a=parseInt(_0x3271dd);if(_[_0xc7ef('0x53')](_0xc4fb9a)&&_[_0xc7ef('0x54')](_0xf6a17e,_0xc4fb9a)){_0x21a795[_0xc7ef('0x3a')]('\x22'+_0xc4fb9a+'\x22');}else{_0x10b0b7[_0xc7ef('0x3a')](_0xc7ef('0x55'));}break;case'email':if(isEmail(_0x3271dd)){_0x21a795[_0xc7ef('0x3a')]('\x22'+_0x3271dd+'\x22');}else{_0x10b0b7[_0xc7ef('0x3a')]('email\x20wrong\x20format');}break;case _0xc7ef('0x56'):var _0x486180=moment(_0x3271dd,_0xc7ef('0x57'),!![]);if(_0x486180[_0xc7ef('0x50')]()){_0x21a795[_0xc7ef('0x3a')]('\x22'+_0x3271dd+'\x22');}else{_0x10b0b7['push'](_0xc7ef('0x58'));}break;default:_0x21a795[_0xc7ef('0x3a')]('\x22'+_0x3271dd+'\x22');}}else{switch(_0x556f0b){case _0xc7ef('0x59'):case _0xc7ef('0x2e'):_0x10b0b7[_0xc7ef('0x3a')](_0x556f0b+_0xc7ef('0x5a'));break;default:_0x21a795[_0xc7ef('0x3a')]('\x22\x22');}}}}if(_0x10b0b7[_0xc7ef('0x49')]){handleError(_0x3a1c5c[_0xc7ef('0x4c')][_0x402413],{'code':_0xc7ef('0x5b'),'message':_0x10b0b7[_0xc7ef('0x12')]()});}else{fs[_0xc7ef('0x5c')](_0x5e0e1c,_0x21a795[_0xc7ef('0x12')]()+'\x0a');}_0x21a795=[];}if(!(stats[_0xc7ef('0x4a')]%0xc8)){socket['emit'](_0xc7ef('0x5d')+_0x3bd583,stats);stats[_0xc7ef('0x39')]=[];}}if(stopped){logger[_0xc7ef('0x3c')](_0xc7ef('0x5e'));_0x15e67c[_0xc7ef('0x5f')]();}}catch(_0x12157d){handleError(_0x3a1c5c[_0xc7ef('0x4c')][_0x402413],{'code':_0xc7ef('0x60'),'message':_0x12157d[_0xc7ef('0x38')]});logger[_0xc7ef('0x37')](_0xc7ef('0x61'),_0x12157d[_0xc7ef('0x38')]);}},'complete':function(){try{var _0x25f771=[];var _0x42d16b='cm_contacts';if(_0x26cac6['duplicates']&&_0x26cac6[_0xc7ef('0x62')][_0xc7ef('0x49')]){_0x42d16b=_0xc7ef('0x63')+_0x3bd583;_0x25f771[_0xc7ef('0x3a')]('CREATE\x20TABLE\x20'+_0x42d16b+'\x20LIKE\x20cm_contacts;');}var _0x234059=util[_0xc7ef('0xa')](_0xc7ef('0x64'),_0x5e0e1c,_0x42d16b,_0x2313bf,_0x26cac6[_0xc7ef('0x1e')],_0x26cac6['CompanyId']||null,NOW,NOW);if(_[_0xc7ef('0x65')](_0x3eb758['scheduledat'])){_0x234059+=_0xc7ef('0x66');}_0x25f771[_0xc7ef('0x3a')](_0x234059);if(_0x26cac6[_0xc7ef('0x62')]&&_0x26cac6[_0xc7ef('0x62')][_0xc7ef('0x49')]){_0x25f771['push'](insertCmContact(_0x26cac6[_0xc7ef('0x1e')],_0x42d16b,_0x26cac6[_0xc7ef('0x62')],_0x3eb758));_0x25f771[_0xc7ef('0x3a')](_0xc7ef('0x67')+_0x42d16b+';');}_0x25f771[_0xc7ef('0x3a')](insertCmHopper(_0x26cac6[_0xc7ef('0x1e')],_0xc7ef('0x68'),_0xc7ef('0x69'),'VoiceQueueId',_0x13ec91));_0x25f771[_0xc7ef('0x3a')](insertCmHopperBlack(_0x26cac6[_0xc7ef('0x1e')],_0xc7ef('0x6a'),_0xc7ef('0x69'),_0xc7ef('0x6b')));_0x25f771[_0xc7ef('0x3a')](insertCmHopper(_0x26cac6[_0xc7ef('0x1e')],_0xc7ef('0x6c'),_0xc7ef('0x6d'),_0xc7ef('0x6e'),_0x13ec91));_0x25f771[_0xc7ef('0x3a')](insertCmHopperBlack(_0x26cac6[_0xc7ef('0x1e')],'campaigns_has_cm_blacklists','campaigns','CampaignId'));BPromise[_0xc7ef('0x6f')](_0x25f771,handleQuery)[_0xc7ef('0x70')](function(_0x2f50f4){stats[_0xc7ef('0x71')]=!![];stats[_0xc7ef('0x72')]=_0x26cac6[_0xc7ef('0x62')]&&_0x26cac6[_0xc7ef('0x62')][_0xc7ef('0x49')]?results[0x2][_0xc7ef('0x72')]:results[0x0]['affectedRows'];socket[_0xc7ef('0x73')](_0xc7ef('0x5d')+_0x3bd583,stats);fs['unlink'](_0x114d88);fs[_0xc7ef('0x74')](_0x5e0e1c);process[_0xc7ef('0x75')](0x0);})[_0xc7ef('0x3e')](function(_0xf1714b){logger[_0xc7ef('0x37')](_0xf1714b[_0xc7ef('0x38')]);process[_0xc7ef('0x75')](0x1);});}catch(_0x447938){logger[_0xc7ef('0x37')](_0xc7ef('0x76'),_0x447938['message']);process[_0xc7ef('0x75')](0x1);}},'error':function(_0x435229,_0x1e1afb,_0x17aa9e,_0x561ed1){throw new Error(_0x561ed1);}});}function validate(){if(process[_0xc7ef('0x77')]&&process[_0xc7ef('0x77')][_0xc7ef('0x49')]<0x4){throw new Error(_0xc7ef('0x78'));}var _0x1b5b30=path['join'](config['root'],_0xc7ef('0x45'),process[_0xc7ef('0x77')][0x2]);if(!fs[_0xc7ef('0x79')](_0x1b5b30)){throw new Error(_0xc7ef('0x7a'));}var _0x1dc1c4={};try{_0x1dc1c4=JSON['parse'](process[_0xc7ef('0x77')][0x3]);if(!_0x1dc1c4['binding']){throw new Error(_0xc7ef('0x7b'));}if(!_0x1dc1c4[_0xc7ef('0x43')]['phone']){throw new Error(_0xc7ef('0x7c'));}if(!_0x1dc1c4[_0xc7ef('0x43')][_0xc7ef('0x59')]){throw new Error(_0xc7ef('0x7d'));}var _0x1a4888=0x0;if(_0x1dc1c4['binding'][_0xc7ef('0x21')]){_0x1a4888=0x1;}if(!_0x1dc1c4[_0xc7ef('0x1e')]){throw new Error(_0xc7ef('0x7e'));}}catch(_0x991b3e){throw new Error(_0xc7ef('0x7f'));}var _0x5a4e02=[];try{_0x5a4e02=_[_0xc7ef('0x80')](JSON['parse'](process['argv'][0x4]),'id');}catch(_0x51ebe6){logger['info'](_0xc7ef('0x81'));}main(_0x1b5b30,_0x1dc1c4,_0x5a4e02,_0x1a4888);}validate();process['on'](_0xc7ef('0x82'),handleStop);process['on'](_0xc7ef('0x83'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 99a48de..c6abf5f 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 _0xe3a7=['Hold\x20Time','holdtime','Talk\x20Time','talktime','Member\x20Name','membername','UniqueId','starttime','answertime','Complete\x20Time','endtime','duration','Billable\x20Time','billableseconds','getSubjects','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','queue','variable','calleridnum','outbound','string','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','destexten','uniqueid','Date','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','agentcalledAt','Agent\x20Connect','Agent\x20Complete','agentcompleteAt'];(function(_0x152f01,_0x5d9997){var _0x31828b=function(_0x3513f3){while(--_0x3513f3){_0x152f01['push'](_0x152f01['shift']());}};_0x31828b(++_0x5d9997);}(_0xe3a7,0x191));var _0x7e3a=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xe3a7[_0x4b7b62];return _0x2280df;};'use strict';exports[_0x7e3a('0x0')]=function(_0x5a0f36,_0x5bba1b){var _0x20690b=[{'type':'string','content':_0x7e3a('0x1'),'variableName':null}];switch(_0x5a0f36[_0x7e3a('0x2')]()){case _0x7e3a('0x3'):switch(_0x5bba1b[_0x7e3a('0x2')]()){case _0x7e3a('0x4'):_0x20690b[_0x7e3a('0x5')]({'type':'variable','content':'','variableName':_0x7e3a('0x6')});_0x20690b[_0x7e3a('0x5')]({'type':_0x7e3a('0x7'),'content':'','variableName':_0x7e3a('0x8')});break;case _0x7e3a('0x9'):_0x20690b[_0x7e3a('0x5')]({'type':_0x7e3a('0xa'),'content':_0x7e3a('0xb'),'variableName':null});_0x20690b[_0x7e3a('0x5')]({'type':_0x7e3a('0x7'),'content':'','variableName':_0x7e3a('0xc')});break;}}return _0x20690b;};exports[_0x7e3a('0xd')]=function(_0x55a1f7,_0x325ff3){var _0x49e23c=[];switch(_0x55a1f7[_0x7e3a('0x2')]()){case _0x7e3a('0x3'):switch(_0x325ff3[_0x7e3a('0x2')]()){case _0x7e3a('0x4'):_0x49e23c=[{'type':_0x7e3a('0xa'),'content':_0x7e3a('0xe'),'key':null,'keyType':null,'variableName':null},{'type':_0x7e3a('0xf'),'content':'','key':_0x7e3a('0x10'),'keyType':_0x7e3a('0x7'),'variableName':'calleridnum'},{'type':'keyValue','content':'','key':_0x7e3a('0x11'),'keyType':_0x7e3a('0x7'),'variableName':'calleridname'},{'type':_0x7e3a('0xf'),'content':'','key':'Call\x20To','keyType':'variable','variableName':_0x7e3a('0x12')},{'type':_0x7e3a('0xf'),'content':'','key':'Queue','keyType':'variable','variableName':_0x7e3a('0x6')},{'type':_0x7e3a('0xf'),'content':'','key':'UniqueId','keyType':_0x7e3a('0x7'),'variableName':_0x7e3a('0x13')},{'type':_0x7e3a('0xf'),'content':'','key':_0x7e3a('0x14'),'keyType':'variable','variableName':'agentcalledAt'},{'type':_0x7e3a('0xa'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x7e3a('0xf'),'content':'','key':_0x7e3a('0x15'),'keyType':'variable','variableName':_0x7e3a('0x16')},{'type':_0x7e3a('0xf'),'content':'','key':_0x7e3a('0x17'),'keyType':_0x7e3a('0x7'),'variableName':_0x7e3a('0xc')},{'type':_0x7e3a('0xa'),'content':_0x7e3a('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0x7e3a('0xf'),'content':'','key':'Agent\x20Ring','keyType':_0x7e3a('0x7'),'variableName':_0x7e3a('0x19')},{'type':_0x7e3a('0xf'),'content':'','key':_0x7e3a('0x1a'),'keyType':_0x7e3a('0x7'),'variableName':'agentconnectAt'},{'type':_0x7e3a('0xf'),'content':'','key':_0x7e3a('0x1b'),'keyType':_0x7e3a('0x7'),'variableName':_0x7e3a('0x1c')},{'type':'keyValue','content':'','key':_0x7e3a('0x1d'),'keyType':_0x7e3a('0x7'),'variableName':_0x7e3a('0x1e')},{'type':_0x7e3a('0xf'),'content':'','key':_0x7e3a('0x1f'),'keyType':_0x7e3a('0x7'),'variableName':_0x7e3a('0x20')}];break;case'outbound':_0x49e23c=[{'type':_0x7e3a('0xa'),'content':_0x7e3a('0xe'),'variableName':null},{'type':_0x7e3a('0xf'),'content':'','key':'Called\x20Number','keyType':_0x7e3a('0x7'),'keyContent':'','variableName':_0x7e3a('0xc')},{'type':_0x7e3a('0xf'),'content':'','key':_0x7e3a('0x21'),'keyType':_0x7e3a('0x7'),'keyContent':'','variableName':_0x7e3a('0x22')},{'type':_0x7e3a('0xf'),'content':'','key':_0x7e3a('0x23'),'keyType':_0x7e3a('0x7'),'keyContent':'','variableName':_0x7e3a('0x13')},{'type':_0x7e3a('0xf'),'content':'','key':_0x7e3a('0x14'),'keyType':_0x7e3a('0x7'),'keyContent':'','variableName':_0x7e3a('0x24')},{'type':_0x7e3a('0xa'),'content':_0x7e3a('0x18')},{'type':'keyValue','content':'','key':'Answer\x20Time','keyType':_0x7e3a('0x7'),'keyContent':'','variableName':_0x7e3a('0x25')},{'type':_0x7e3a('0xf'),'content':'','key':_0x7e3a('0x26'),'keyType':_0x7e3a('0x7'),'keyContent':'','variableName':_0x7e3a('0x27')},{'type':_0x7e3a('0xf'),'content':'','key':'Duration','keyType':_0x7e3a('0x7'),'keyContent':'','variableName':_0x7e3a('0x28')},{'type':'keyValue','content':'','key':_0x7e3a('0x29'),'keyType':_0x7e3a('0x7'),'keyContent':'','variableName':_0x7e3a('0x2a')}];break;}}return _0x49e23c;}; \ No newline at end of file +var _0x610e=['destcalleridname','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Ring','agentcalledAt','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','membername','Date','starttime','Answer\x20Time','answertime','Duration','getSubjects','string','toLowerCase','voice','inbound','push','variable','calleridnum','outbound','Outbound\x20Call','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Queue','queue','UniqueId','uniqueid','***\x20Agent\x20Info\x20***','Agent\x20Name'];(function(_0x19326f,_0x2e133a){var _0x3fc2b3=function(_0x4a3153){while(--_0x4a3153){_0x19326f['push'](_0x19326f['shift']());}};_0x3fc2b3(++_0x2e133a);}(_0x610e,0xbc));var _0xe610=function(_0x1c1e26,_0x58213c){_0x1c1e26=_0x1c1e26-0x0;var _0x13d07f=_0x610e[_0x1c1e26];return _0x13d07f;};'use strict';exports[_0xe610('0x0')]=function(_0x433d62,_0x5ad69d){var _0xb91b10=[{'type':_0xe610('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x433d62[_0xe610('0x2')]()){case _0xe610('0x3'):switch(_0x5ad69d[_0xe610('0x2')]()){case _0xe610('0x4'):_0xb91b10[_0xe610('0x5')]({'type':_0xe610('0x6'),'content':'','variableName':'queue'});_0xb91b10[_0xe610('0x5')]({'type':'variable','content':'','variableName':_0xe610('0x7')});break;case _0xe610('0x8'):_0xb91b10[_0xe610('0x5')]({'type':_0xe610('0x1'),'content':_0xe610('0x9'),'variableName':null});_0xb91b10['push']({'type':_0xe610('0x6'),'content':'','variableName':'destcalleridnum'});break;}}return _0xb91b10;};exports[_0xe610('0xa')]=function(_0xa4cdec,_0x5cc5f7){var _0x4dc953=[];switch(_0xa4cdec[_0xe610('0x2')]()){case'voice':switch(_0x5cc5f7['toLowerCase']()){case'inbound':_0x4dc953=[{'type':_0xe610('0x1'),'content':_0xe610('0xb'),'key':null,'keyType':null,'variableName':null},{'type':_0xe610('0xc'),'content':'','key':_0xe610('0xd'),'keyType':'variable','variableName':_0xe610('0x7')},{'type':_0xe610('0xc'),'content':'','key':_0xe610('0xe'),'keyType':_0xe610('0x6'),'variableName':_0xe610('0xf')},{'type':_0xe610('0xc'),'content':'','key':'Call\x20To','keyType':'variable','variableName':'destexten'},{'type':_0xe610('0xc'),'content':'','key':_0xe610('0x10'),'keyType':'variable','variableName':_0xe610('0x11')},{'type':_0xe610('0xc'),'content':'','key':_0xe610('0x12'),'keyType':'variable','variableName':_0xe610('0x13')},{'type':_0xe610('0xc'),'content':'','key':'Date','keyType':'variable','variableName':'agentcalledAt'},{'type':'string','content':_0xe610('0x14'),'key':null,'keyType':null,'variableName':null},{'type':_0xe610('0xc'),'content':'','key':_0xe610('0x15'),'keyType':_0xe610('0x6'),'variableName':_0xe610('0x16')},{'type':'keyValue','content':'','key':'Agent\x20Number','keyType':_0xe610('0x6'),'variableName':_0xe610('0x17')},{'type':_0xe610('0x1'),'content':_0xe610('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0xe610('0xc'),'content':'','key':_0xe610('0x19'),'keyType':'variable','variableName':_0xe610('0x1a')},{'type':_0xe610('0xc'),'content':'','key':_0xe610('0x1b'),'keyType':_0xe610('0x6'),'variableName':_0xe610('0x1c')},{'type':_0xe610('0xc'),'content':'','key':_0xe610('0x1d'),'keyType':'variable','variableName':_0xe610('0x1e')},{'type':'keyValue','content':'','key':'Hold\x20Time','keyType':_0xe610('0x6'),'variableName':_0xe610('0x1f')},{'type':_0xe610('0xc'),'content':'','key':_0xe610('0x20'),'keyType':'variable','variableName':_0xe610('0x21')}];break;case _0xe610('0x8'):_0x4dc953=[{'type':_0xe610('0x1'),'content':_0xe610('0xb'),'variableName':null},{'type':_0xe610('0xc'),'content':'','key':_0xe610('0x22'),'keyType':_0xe610('0x6'),'keyContent':'','variableName':_0xe610('0x17')},{'type':'keyValue','content':'','key':_0xe610('0x23'),'keyType':_0xe610('0x6'),'keyContent':'','variableName':_0xe610('0x24')},{'type':'keyValue','content':'','key':_0xe610('0x12'),'keyType':_0xe610('0x6'),'keyContent':'','variableName':_0xe610('0x13')},{'type':_0xe610('0xc'),'content':'','key':_0xe610('0x25'),'keyType':_0xe610('0x6'),'keyContent':'','variableName':_0xe610('0x26')},{'type':_0xe610('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':_0xe610('0xc'),'content':'','key':_0xe610('0x27'),'keyType':_0xe610('0x6'),'keyContent':'','variableName':_0xe610('0x28')},{'type':_0xe610('0xc'),'content':'','key':'Complete\x20Time','keyType':_0xe610('0x6'),'keyContent':'','variableName':'endtime'},{'type':_0xe610('0xc'),'content':'','key':_0xe610('0x29'),'keyType':_0xe610('0x6'),'keyContent':'','variableName':'duration'},{'type':'keyValue','content':'','key':'Billable\x20Time','keyType':_0xe610('0x6'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x4dc953;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index f952dc8..815d45b 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 _0xec9c=['InteractionId','upperFirst','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','null','findOne','then','update','info','error','user','query','body','omit','html','phone','fax','mobile','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','sms-interactions','chat-interactions'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xec9c,0x123));var _0xcec9=function(_0x54c919,_0x1af5b9){_0x54c919=_0x54c919-0x0;var _0x7708a8=_0xec9c[_0x54c919];return _0x7708a8;};'use strict';var _=require('lodash');var db=require(_0xcec9('0x0'))['db'];var loggers={'openchannel':require(_0xcec9('0x1'))('openchannel-interactions'),'mail':require(_0xcec9('0x1'))(_0xcec9('0x2')),'fax':require(_0xcec9('0x1'))(_0xcec9('0x3')),'sms':require(_0xcec9('0x1'))(_0xcec9('0x4')),'chat':require(_0xcec9('0x1'))(_0xcec9('0x5')),'whatsapp':require(_0xcec9('0x1'))('whatsapp-interactions')};function getInteractionId(_0x59e166,_0x3f5026,_0x4d0249){if(_0x59e166&&_0x59e166[_['upperFirst'](_0x4d0249)+_0xcec9('0x6')]){return _0x59e166[_[_0xcec9('0x7')](_0x4d0249)+'InteractionId'];}else if(_0x59e166&&_0x59e166['id']){return _0x59e166['id'];}else if(_0x3f5026&&_0x3f5026['id']){return _0x3f5026['id'];}else{return _0xcec9('0x8');}}function log(_0x1f9fb1,_0x5ef779,_0x475087,_0x2f5caa,_0x484a8a,_0x5142ed){loggers[_0x484a8a[_0xcec9('0x9')]()][_0x1f9fb1](_0xcec9('0xa'),_0x5142ed[_0xcec9('0xb')](),_0x5ef779?_0x5ef779['id']:null,_0x5ef779?_0x5ef779['name']:null,_0x5ef779?_0x5ef779[_0xcec9('0xc')]:null,getInteractionId(_0x475087,_0x2f5caa,_0x484a8a),_0x475087?JSON['stringify'](_0x475087):_0xcec9('0xd'));}function updateUser(_0x565adb,_0x565dae,_0x596f42,_0x560241,_0x236620){db[_['upperFirst'](_0x560241)+'Interaction'][_0xcec9('0xe')]({'where':{'id':getInteractionId(_0x565dae,_0x596f42,_0x560241)}})[_0xcec9('0xf')](function(_0x699e5e){if(_0x699e5e){return _0x699e5e[_0xcec9('0x10')]({'UserId':_0x565adb?_0x565adb['id']:null});}})[_0xcec9('0xf')](function(_0x46b891){if(_0x46b891){log(_0xcec9('0x11'),_0x565adb,_0x565dae,_0x596f42,_0x560241,_0x236620);}})['catch'](function(){log(_0xcec9('0x12'),_0x565adb,_0x565dae,_0x596f42,_0x560241,_0x236620);});}exports['tracked']=function(_0x5c6319,_0x211f25){return function(_0x483a37,_0x31258b,_0x2d58c3){var _0x1e6e5b=_0x483a37[_0xcec9('0x13')];var _0x2618d5={};var _0x4a95dd=_0x483a37[_0xcec9('0x14')];if(_0x2618d5){_0x2618d5=_['clone'](_0x483a37[_0xcec9('0x15')]);_0x2618d5=_[_0xcec9('0x16')](_0x2618d5,[_0xcec9('0x15'),_0xcec9('0x17'),_0xcec9('0x18'),_0xcec9('0x19'),_0xcec9('0x1a')]);}updateUser(_0x1e6e5b,_0x2618d5,_0x4a95dd,_0x5c6319,_0x211f25);_0x2d58c3(null);};}; \ No newline at end of file +var _0x8282=['null','Interaction','findOne','then','update','info','catch','error','tracked','user','query','body','html','phone','fax','mobile','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','chat-interactions','upperFirst','InteractionId','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','stringify'];(function(_0x525adf,_0x3625d2){var _0x29af8d=function(_0xe16d54){while(--_0xe16d54){_0x525adf['push'](_0x525adf['shift']());}};_0x29af8d(++_0x3625d2);}(_0x8282,0x10c));var _0x2828=function(_0x265564,_0x1a3cdc){_0x265564=_0x265564-0x0;var _0x506d7e=_0x8282[_0x265564];return _0x506d7e;};'use strict';var _=require('lodash');var db=require(_0x2828('0x0'))['db'];var loggers={'openchannel':require(_0x2828('0x1'))('openchannel-interactions'),'mail':require('../../config/logger')(_0x2828('0x2')),'fax':require(_0x2828('0x1'))(_0x2828('0x3')),'sms':require(_0x2828('0x1'))('sms-interactions'),'chat':require(_0x2828('0x1'))(_0x2828('0x4')),'whatsapp':require('../../config/logger')('whatsapp-interactions')};function getInteractionId(_0x1ab06a,_0x5c5285,_0xf18904){if(_0x1ab06a&&_0x1ab06a[_[_0x2828('0x5')](_0xf18904)+_0x2828('0x6')]){return _0x1ab06a[_[_0x2828('0x5')](_0xf18904)+_0x2828('0x6')];}else if(_0x1ab06a&&_0x1ab06a['id']){return _0x1ab06a['id'];}else if(_0x5c5285&&_0x5c5285['id']){return _0x5c5285['id'];}else{return'unknown';}}function log(_0x2a1956,_0x1b57ea,_0x985501,_0x5c897c,_0x1a137e,_0x4e98fc){loggers[_0x1a137e[_0x2828('0x7')]()][_0x2a1956](_0x2828('0x8'),_0x4e98fc['toUpperCase'](),_0x1b57ea?_0x1b57ea['id']:null,_0x1b57ea?_0x1b57ea[_0x2828('0x9')]:null,_0x1b57ea?_0x1b57ea[_0x2828('0xa')]:null,getInteractionId(_0x985501,_0x5c897c,_0x1a137e),_0x985501?JSON[_0x2828('0xb')](_0x985501):_0x2828('0xc'));}function updateUser(_0x16a621,_0x10cbe8,_0x24def3,_0x5799f8,_0x352e69){db[_[_0x2828('0x5')](_0x5799f8)+_0x2828('0xd')][_0x2828('0xe')]({'where':{'id':getInteractionId(_0x10cbe8,_0x24def3,_0x5799f8)}})[_0x2828('0xf')](function(_0x1c9404){if(_0x1c9404){return _0x1c9404[_0x2828('0x10')]({'UserId':_0x16a621?_0x16a621['id']:null});}})[_0x2828('0xf')](function(_0xc0dc6f){if(_0xc0dc6f){log(_0x2828('0x11'),_0x16a621,_0x10cbe8,_0x24def3,_0x5799f8,_0x352e69);}})[_0x2828('0x12')](function(){log(_0x2828('0x13'),_0x16a621,_0x10cbe8,_0x24def3,_0x5799f8,_0x352e69);});}exports[_0x2828('0x14')]=function(_0x1f4ee1,_0x277afc){return function(_0x51b0b8,_0x4e3576,_0x292b8c){var _0x54974d=_0x51b0b8[_0x2828('0x15')];var _0x4a7923={};var _0x57e6c7=_0x51b0b8[_0x2828('0x16')];if(_0x4a7923){_0x4a7923=_['clone'](_0x51b0b8[_0x2828('0x17')]);_0x4a7923=_['omit'](_0x4a7923,[_0x2828('0x17'),_0x2828('0x18'),_0x2828('0x19'),_0x2828('0x1a'),_0x2828('0x1b')]);}updateUser(_0x54974d,_0x4a7923,_0x57e6c7,_0x1f4ee1,_0x277afc);_0x292b8c(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index d984beb..66ba775 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 _0x60ae=['admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','license','data1','split','createDecipher','format','%s:%s:%s','update','base64','utf8','use','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','User'];(function(_0x28b10c,_0x350c25){var _0x3b4034=function(_0x55dd84){while(--_0x55dd84){_0x28b10c['push'](_0x28b10c['shift']());}};_0x3b4034(++_0x350c25);}(_0x60ae,0xfd));var _0xe60a=function(_0xe6036b,_0x57ced5){_0xe6036b=_0xe6036b-0x0;var _0x9dd9e=_0x60ae[_0xe6036b];return _0x9dd9e;};'use strict';var crypto=require(_0xe60a('0x0'));var util=require(_0xe60a('0x1'));var compose=require(_0xe60a('0x2'));var db=require(_0xe60a('0x3'))['db'];var config=require(_0xe60a('0x4'));function getValueFromLicense(_0x34471b,_0x27c932){if(_0x34471b&&_0x27c932){if(_0x27c932['data1']&&_0x27c932[_0xe60a('0x5')]){var _0x924611=_0x27c932[_0xe60a('0x6')];var _0x2ef0b4=_0x27c932[_0xe60a('0x5')];var _0x5a6b85=_0x924611[_0xe60a('0x7')]('-')[0x4];var _0x5eddc8=_0x924611['split']('-')[0x0];var _0x1eb2ba=crypto[_0xe60a('0x8')]('aes-256-ctr',util[_0xe60a('0x9')](_0xe60a('0xa'),_0x5a6b85,_0x924611,_0x5eddc8));var _0x4552d5=_0x1eb2ba[_0xe60a('0xb')](_0x2ef0b4,_0xe60a('0xc'),_0xe60a('0xd'));_0x4552d5+=_0x1eb2ba['final'](_0xe60a('0xd'));var _0x5883ff=JSON['parse'](_0x4552d5);return _0x5883ff['hasOwnProperty'](_0x34471b)?_0x5883ff[_0x34471b]:null;}}return null;}function isLimit(_0x2d7d24,_0x4ef2c7,_0x5e40ae,_0x3779b4){var _0x380691=_0x4ef2c7;return compose()[_0xe60a('0xe')](function(_0x272d35,_0x229d7c,_0x264d97){return db['License'][_0xe60a('0xf')]({'where':{'id':0x1},'raw':!![]})[_0xe60a('0x10')](function(_0x9a22f8){var _0x183288=getValueFromLicense(_0x2d7d24,_0x9a22f8);return _0x183288?_0x183288:_0x380691;})[_0xe60a('0x10')](function(_0x590ea8){_0x380691=_0x590ea8;return _0x5e40ae[_0xe60a('0x11')](_0x3779b4);})[_0xe60a('0x10')](function(_0x160065){if(_0x160065>=_0x380691){return _0x229d7c[_0xe60a('0x12')](0x193)[_0xe60a('0x13')]({'message':util[_0xe60a('0x9')](_0xe60a('0x14'),_0x2d7d24)});}_0x264d97();})['catch'](function(_0x43807f){_0x264d97(_0x43807f);});});}function isUserLimit(){return isLimit('users',0x1,db[_0xe60a('0x15')],{'where':{'$or':[{'role':_0xe60a('0x16')},{'role':_0xe60a('0x17')}]}});}exports[_0xe60a('0x18')]=isUserLimit; \ No newline at end of file +var _0xea31=['json','catch','User','isUserLimit','crypto','composable-middleware','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','hasOwnProperty','use','License','findOne','then'];(function(_0x524db7,_0x10031b){var _0x466ef5=function(_0x223aef){while(--_0x223aef){_0x524db7['push'](_0x524db7['shift']());}};_0x466ef5(++_0x10031b);}(_0xea31,0x164));var _0x1ea3=function(_0x59db66,_0x47dbb9){_0x59db66=_0x59db66-0x0;var _0x3cda2b=_0xea31[_0x59db66];return _0x3cda2b;};'use strict';var crypto=require(_0x1ea3('0x0'));var util=require('util');var compose=require(_0x1ea3('0x1'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');function getValueFromLicense(_0x5ad686,_0x82d1c0){if(_0x5ad686&&_0x82d1c0){if(_0x82d1c0['data1']&&_0x82d1c0['license']){var _0x32c995=_0x82d1c0[_0x1ea3('0x2')];var _0x15204e=_0x82d1c0[_0x1ea3('0x3')];var _0x5985c3=_0x32c995['split']('-')[0x4];var _0x53fe96=_0x32c995[_0x1ea3('0x4')]('-')[0x0];var _0x48471d=crypto[_0x1ea3('0x5')](_0x1ea3('0x6'),util[_0x1ea3('0x7')](_0x1ea3('0x8'),_0x5985c3,_0x32c995,_0x53fe96));var _0x3cda94=_0x48471d[_0x1ea3('0x9')](_0x15204e,_0x1ea3('0xa'),_0x1ea3('0xb'));_0x3cda94+=_0x48471d[_0x1ea3('0xc')]('utf8');var _0x128010=JSON['parse'](_0x3cda94);return _0x128010[_0x1ea3('0xd')](_0x5ad686)?_0x128010[_0x5ad686]:null;}}return null;}function isLimit(_0x195e4c,_0x2885b0,_0x2b5944,_0x1e8a44){var _0x3e33f2=_0x2885b0;return compose()[_0x1ea3('0xe')](function(_0x25fa05,_0x2c28eb,_0x50b4c7){return db[_0x1ea3('0xf')][_0x1ea3('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x1ea3('0x11')](function(_0x1d7639){var _0x547158=getValueFromLicense(_0x195e4c,_0x1d7639);return _0x547158?_0x547158:_0x3e33f2;})[_0x1ea3('0x11')](function(_0x26d310){_0x3e33f2=_0x26d310;return _0x2b5944['count'](_0x1e8a44);})['then'](function(_0x426847){if(_0x426847>=_0x3e33f2){return _0x2c28eb['status'](0x193)[_0x1ea3('0x12')]({'message':util[_0x1ea3('0x7')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x195e4c)});}_0x50b4c7();})[_0x1ea3('0x13')](function(_0x12240d){_0x50b4c7(_0x12240d);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x1ea3('0x14')],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports[_0x1ea3('0x15')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 2a5f97c..5c2d45d 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 _0x1c5f=['$eq','$between','value','includes','$lte','add','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','start','pop','DATE','format','utcOffset','hours','seconds','lodash','parseSearch','sqlOperator','startsWith','[$or]','[$and]','replace','split','length','forEach','shift','filter','indexOf','conditions','buildExpression','operator'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1c5f,0x8c));var _0xf1c5=function(_0x4251cb,_0x11ddec){_0x4251cb=_0x4251cb-0x0;var _0x6a5186=_0x1c5f[_0x4251cb];return _0x6a5186;};'use strict';var _=require(_0xf1c5('0x0'));var moment=require('moment');exports[_0xf1c5('0x1')]=function(_0x4e4be7){var _0x3445c1={'conditions':[]};_0x3445c1[_0xf1c5('0x2')]=_[_0xf1c5('0x3')](_0x4e4be7,_0xf1c5('0x4'))?'or':'and';var _0x16eb44=_0x4e4be7['replace'](_0xf1c5('0x5'),'')[_0xf1c5('0x6')](_0xf1c5('0x4'),'')[_0xf1c5('0x7')]('||');for(var _0x169970=0x0;_0x169970<_0x16eb44[_0xf1c5('0x8')];_0x169970++){var _0x28eff9=_0x16eb44[_0x169970][_0xf1c5('0x7')](':=');var _0x525171=_0x28eff9[0x0];var _0x6cf403=_0x28eff9['slice'](0x1);_0x6cf403[_0xf1c5('0x9')](function(_0xd536f6){var _0x4d872e=_0xd536f6['split']('[')[_0xf1c5('0xa')]();var _0x37d6c9=_0xd536f6['match'](/\[(.*?)\]/g);_0x37d6c9[_0xf1c5('0x9')](function(_0x4b6169){var _0xeb7949=_0x4b6169[_0xf1c5('0x7')]('[')[_0xf1c5('0xb')](function(_0x533fc5){return _0x533fc5[_0xf1c5('0xc')](']')>-0x1;})['map'](function(_0x28f02d){return _0x28f02d[_0xf1c5('0x7')](']')[0x0];})[0x0];_0x3445c1[_0xf1c5('0xd')]['push']({'field':_0x525171,'operator':_0x4d872e,'value':_0xeb7949});});});}return _0x3445c1;};exports[_0xf1c5('0xe')]=function(_0x8e7458,_0x44e2a0,_0x429161){var _0x5f8638={};if(_0x44e2a0==='DATE'){if(_0x429161[_0xf1c5('0xf')]===_0xf1c5('0x10')){_0x429161[_0xf1c5('0xf')]=_0xf1c5('0x11');_0x429161['value']+=','+_0x429161[_0xf1c5('0x12')];}else if(_[_0xf1c5('0x13')](['$gt',_0xf1c5('0x14')],_0x429161['operator'])){_0x429161[_0xf1c5('0x12')]=moment(_0x429161[_0xf1c5('0x12')])[_0xf1c5('0x15')](0x1,'days')['format'](_0xf1c5('0x16'));}}if(_0x429161[_0xf1c5('0x17')]){_0x44e2a0=_0x429161[_0xf1c5('0x17')];_0x5f8638[_0xf1c5('0x18')]=_0xf1c5('0x19')+_0x8e7458+'.'+_0x429161[_0xf1c5('0x1a')]+_0xf1c5('0x1b')+_0x429161[_0xf1c5('0x17')]+')\x20'+parseOperator(_0x429161['operator']);}else{_0x5f8638['text']=_0x8e7458+'.'+_0x429161[_0xf1c5('0x1a')]+'\x20'+parseOperator(_0x429161[_0xf1c5('0xf')]);}if(_[_0xf1c5('0x13')]([_0xf1c5('0x1c'),_0xf1c5('0x1d')],_0x429161[_0xf1c5('0xf')]))_0x5f8638[_0xf1c5('0x18')]='('+_0x5f8638['text']+_0xf1c5('0x1e')+_0x8e7458+'.'+_0x429161['field']+_0xf1c5('0x1f');_0x5f8638['value']=parseValue(_0x44e2a0,_0x429161['operator'],_0x429161[_0xf1c5('0x12')]);return _0x5f8638;};function parseOperator(_0xd32b91){var _0x467bfc;switch(_0xd32b91){case _0xf1c5('0x20'):_0x467bfc='IN\x20?';break;case _0xf1c5('0x1d'):_0x467bfc=_0xf1c5('0x21');break;case _0xf1c5('0x10'):_0x467bfc=_0xf1c5('0x22');break;case _0xf1c5('0x1c'):_0x467bfc=_0xf1c5('0x23');break;case _0xf1c5('0x24'):case'$startsWith':case _0xf1c5('0x25'):_0x467bfc=_0xf1c5('0x26');break;case _0xf1c5('0x27'):_0x467bfc=_0xf1c5('0x28');break;case'$gt':_0x467bfc=_0xf1c5('0x29');break;case _0xf1c5('0x14'):_0x467bfc=_0xf1c5('0x2a');break;case _0xf1c5('0x2b'):_0x467bfc=_0xf1c5('0x2c');break;case _0xf1c5('0x11'):_0x467bfc='BETWEEN\x20?\x20AND\x20?';break;}return _0x467bfc;}function parseValue(_0x48f2bf,_0x4b3802,_0x5b3e5a){var _0x43ccb6={'start':undefined,'end':undefined};switch(_0x4b3802){case'$in':case'$notIn':_0x43ccb6['start']=_0x5b3e5a[_0xf1c5('0x7')](',');break;case'$substring':_0x43ccb6['start']='%'+_0x5b3e5a+'%';break;case'$startsWith':_0x43ccb6[_0xf1c5('0x2d')]=_0x5b3e5a+'%';break;case'$endsWith':_0x43ccb6['start']='%'+_0x5b3e5a;break;case'$between':var _0x121be2=_0x5b3e5a[_0xf1c5('0x7')](',');var _0x5b3e5a=_0x121be2[_0xf1c5('0xa')]();var _0x1bf134=_0x121be2[_0xf1c5('0x2e')]();if(_0x48f2bf===_0xf1c5('0x2f')){_0x5b3e5a=moment(_0x5b3e5a)['utcOffset'](0x0,!![])[_0xf1c5('0x30')]();_0x1bf134=moment(_0x1bf134)[_0xf1c5('0x31')](0x0,!![])[_0xf1c5('0x15')](0x17,_0xf1c5('0x32'))[_0xf1c5('0x15')](0x3b,'minutes')[_0xf1c5('0x15')](0x3b,_0xf1c5('0x33'))[_0xf1c5('0x30')]();}_0x43ccb6={'start':_0x5b3e5a,'end':_0x1bf134};break;default:_0x43ccb6[_0xf1c5('0x2d')]=_0x5b3e5a;break;}return _0x43ccb6;} \ No newline at end of file +var _0xe057=['YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','=\x20?','$ne','<>\x20?','$substring','$startsWith','$endsWith','$lt','<\x20?','$lte','<=\x20?','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','pop','DATE','utcOffset','hours','minutes','seconds','lodash','sqlOperator','[$or]','and','replace','[$and]','split','length','slice','forEach','shift','match','filter','map','buildExpression','$eq','operator','value','includes','add','days','format'];(function(_0x4d82ea,_0x4d459f){var _0x257f4a=function(_0x424c4f){while(--_0x424c4f){_0x4d82ea['push'](_0x4d82ea['shift']());}};_0x257f4a(++_0x4d459f);}(_0xe057,0x156));var _0x7e05=function(_0x678720,_0x5d1b39){_0x678720=_0x678720-0x0;var _0x17a4e5=_0xe057[_0x678720];return _0x17a4e5;};'use strict';var _=require(_0x7e05('0x0'));var moment=require('moment');exports['parseSearch']=function(_0x59ca74){var _0x33c9ab={'conditions':[]};_0x33c9ab[_0x7e05('0x1')]=_['startsWith'](_0x59ca74,_0x7e05('0x2'))?'or':_0x7e05('0x3');var _0x5d1fa2=_0x59ca74[_0x7e05('0x4')](_0x7e05('0x5'),'')[_0x7e05('0x4')](_0x7e05('0x2'),'')[_0x7e05('0x6')]('||');for(var _0x435a83=0x0;_0x435a83<_0x5d1fa2[_0x7e05('0x7')];_0x435a83++){var _0x59f4c0=_0x5d1fa2[_0x435a83][_0x7e05('0x6')](':=');var _0x30b7d6=_0x59f4c0[0x0];var _0x1e18c9=_0x59f4c0[_0x7e05('0x8')](0x1);_0x1e18c9[_0x7e05('0x9')](function(_0x599464){var _0x8d7d21=_0x599464[_0x7e05('0x6')]('[')[_0x7e05('0xa')]();var _0x342212=_0x599464[_0x7e05('0xb')](/\[(.*?)\]/g);_0x342212[_0x7e05('0x9')](function(_0x265032){var _0x528c02=_0x265032[_0x7e05('0x6')]('[')[_0x7e05('0xc')](function(_0x2d7e6d){return _0x2d7e6d['indexOf'](']')>-0x1;})[_0x7e05('0xd')](function(_0x11e59c){return _0x11e59c['split'](']')[0x0];})[0x0];_0x33c9ab['conditions']['push']({'field':_0x30b7d6,'operator':_0x8d7d21,'value':_0x528c02});});});}return _0x33c9ab;};exports[_0x7e05('0xe')]=function(_0x225969,_0x1aff13,_0x2a01ec){var _0x1b3ae9={};if(_0x1aff13==='DATE'){if(_0x2a01ec['operator']===_0x7e05('0xf')){_0x2a01ec[_0x7e05('0x10')]='$between';_0x2a01ec[_0x7e05('0x11')]+=','+_0x2a01ec[_0x7e05('0x11')];}else if(_[_0x7e05('0x12')](['$gt','$lte'],_0x2a01ec[_0x7e05('0x10')])){_0x2a01ec[_0x7e05('0x11')]=moment(_0x2a01ec[_0x7e05('0x11')])[_0x7e05('0x13')](0x1,_0x7e05('0x14'))[_0x7e05('0x15')](_0x7e05('0x16'));}}if(_0x2a01ec[_0x7e05('0x17')]){_0x1aff13=_0x2a01ec[_0x7e05('0x17')];_0x1b3ae9[_0x7e05('0x18')]=_0x7e05('0x19')+_0x225969+'.'+_0x2a01ec[_0x7e05('0x1a')]+_0x7e05('0x1b')+_0x2a01ec[_0x7e05('0x17')]+')\x20'+parseOperator(_0x2a01ec[_0x7e05('0x10')]);}else{_0x1b3ae9['text']=_0x225969+'.'+_0x2a01ec[_0x7e05('0x1a')]+'\x20'+parseOperator(_0x2a01ec[_0x7e05('0x10')]);}if(_[_0x7e05('0x12')](['$ne',_0x7e05('0x1c')],_0x2a01ec[_0x7e05('0x10')]))_0x1b3ae9[_0x7e05('0x18')]='('+_0x1b3ae9[_0x7e05('0x18')]+_0x7e05('0x1d')+_0x225969+'.'+_0x2a01ec[_0x7e05('0x1a')]+_0x7e05('0x1e');_0x1b3ae9[_0x7e05('0x11')]=parseValue(_0x1aff13,_0x2a01ec['operator'],_0x2a01ec[_0x7e05('0x11')]);return _0x1b3ae9;};function parseOperator(_0x526d30){var _0x12f1b8;switch(_0x526d30){case _0x7e05('0x1f'):_0x12f1b8='IN\x20?';break;case _0x7e05('0x1c'):_0x12f1b8='NOT\x20IN\x20?';break;case _0x7e05('0xf'):_0x12f1b8=_0x7e05('0x20');break;case _0x7e05('0x21'):_0x12f1b8=_0x7e05('0x22');break;case _0x7e05('0x23'):case _0x7e05('0x24'):case _0x7e05('0x25'):_0x12f1b8='LIKE\x20?';break;case _0x7e05('0x26'):_0x12f1b8=_0x7e05('0x27');break;case'$gt':_0x12f1b8='>\x20?';break;case _0x7e05('0x28'):_0x12f1b8=_0x7e05('0x29');break;case'$gte':_0x12f1b8=_0x7e05('0x2a');break;case _0x7e05('0x2b'):_0x12f1b8=_0x7e05('0x2c');break;}return _0x12f1b8;}function parseValue(_0x4c87ba,_0x487136,_0x4e359a){var _0x4f12af={'start':undefined,'end':undefined};switch(_0x487136){case _0x7e05('0x1f'):case _0x7e05('0x1c'):_0x4f12af['start']=_0x4e359a['split'](',');break;case _0x7e05('0x23'):_0x4f12af[_0x7e05('0x2d')]='%'+_0x4e359a+'%';break;case _0x7e05('0x24'):_0x4f12af[_0x7e05('0x2d')]=_0x4e359a+'%';break;case _0x7e05('0x25'):_0x4f12af['start']='%'+_0x4e359a;break;case _0x7e05('0x2b'):var _0x262653=_0x4e359a['split'](',');var _0x4e359a=_0x262653[_0x7e05('0xa')]();var _0x263ad9=_0x262653[_0x7e05('0x2e')]();if(_0x4c87ba===_0x7e05('0x2f')){_0x4e359a=moment(_0x4e359a)['utcOffset'](0x0,!![])[_0x7e05('0x15')]();_0x263ad9=moment(_0x263ad9)[_0x7e05('0x30')](0x0,!![])[_0x7e05('0x13')](0x17,_0x7e05('0x31'))[_0x7e05('0x13')](0x3b,_0x7e05('0x32'))[_0x7e05('0x13')](0x3b,_0x7e05('0x33'))['format']();}_0x4f12af={'start':_0x4e359a,'end':_0x263ad9};break;default:_0x4f12af[_0x7e05('0x2d')]=_0x4e359a;break;}return _0x4f12af;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 64a83e0..d5898ca 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 _0xd22b=['sort','map','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','omit','isObject','isString','length','isEmail','match','getFullTextValue','forEach','replace','includes','push','join','getOptions','query','$id','model','intersection','attributes','hasOwnProperty','nolimit','order','where','pick','filter','object','merge','VIRTUAL','lower','options','lodash','sequelize','moment','parse','keys','fields','split','filters','isEmpty','forOwn','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','limit','offset'];(function(_0x34d635,_0x2784fc){var _0x3ab288=function(_0x41589b){while(--_0x41589b){_0x34d635['push'](_0x34d635['shift']());}};_0x3ab288(++_0x2784fc);}(_0xd22b,0x11b));var _0xbd22=function(_0x50da8e,_0x3106df){_0x50da8e=_0x50da8e-0x0;var _0x2c01c2=_0xd22b[_0x50da8e];return _0x2c01c2;};'use strict';var _=require(_0xbd22('0x0'));var sequelize=require(_0xbd22('0x1'));var moment=require(_0xbd22('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x3b5a2f){var _0x1e6f99=['ne'];try{var _0x3f5cd9=JSON[_0xbd22('0x3')](_0x3b5a2f);var _0x52708a=Object[_0xbd22('0x4')](_0x3f5cd9)[0x0];return _0x1e6f99['includes'](_0x52708a);}catch(_0x18b1e8){return![];}}function getOperatorValue(_0x262ed9){var _0x390186=JSON[_0xbd22('0x3')](_0x262ed9);var _0x40180e=Object[_0xbd22('0x4')](_0x390186)[0x0];var _0x240268=_0x390186[_0x40180e];return{['$'+_0x40180e]:_0x240268};}exports[_0xbd22('0x5')]=function(_0x306377){var _0x3c99b3=null;if(_0x306377){_0x3c99b3=_0x306377[_0xbd22('0x6')](',');}return _0x3c99b3;};exports[_0xbd22('0x7')]=function(_0x3f8c09,_0x351d96){var _0xd99fc4={};if(!_[_0xbd22('0x8')](_0x3f8c09)){_[_0xbd22('0x9')](_0x3f8c09,function(_0x574631,_0x329d5c){try{if(_0x351d96){var _0x415cd8=_['find'](_0x351d96,{'name':_0x329d5c})||{};if(hasSequelizeOperator(_0x574631)){_0xd99fc4[_0x329d5c]=getOperatorValue(_0x574631);}else if(_0x415cd8['type']==='DATE'&&_[_0xbd22('0xa')](_0x574631)){var _0xc0c396=JSON[_0xbd22('0x3')](_0x574631);var _0x2f3314={'$gte':moment(moment(_0xc0c396[_0xbd22('0xb')])[_0xbd22('0xc')](_0xbd22('0xd')))[_0xbd22('0xe')]()['format'](),'$lte':moment(moment(_0xc0c396[_0xbd22('0xf')])[_0xbd22('0xc')](_0xbd22('0xd')))[_0xbd22('0xe')]()[_0xbd22('0x10')](0x1,'s')[_0xbd22('0xc')]()};_0xd99fc4[_0x329d5c]=_0x2f3314;}else if(_0x415cd8[_0xbd22('0x11')]===_0xbd22('0x12')){_0xd99fc4[_0x329d5c]=_0x574631;}else{_0xd99fc4[_0x329d5c]=_['isArray'](_0x574631)?_0x574631:JSON[_0xbd22('0x3')](_0x574631);}}else{_0xd99fc4[_0x329d5c]=_[_0xbd22('0x13')](_0x574631)?_0x574631:JSON[_0xbd22('0x3')](_0x574631);}}catch(_0x32528c){_0xd99fc4[_0x329d5c]=_0x574631[_0xbd22('0x6')](',');}});}return _0xd99fc4;};exports[_0xbd22('0x14')]=function(_0x2fdfe3){_0x2fdfe3=parseInt(_0x2fdfe3,0xa);if(!_0x2fdfe3||_0x2fdfe3<0x0){_0x2fdfe3=LIMIT_VALUE;}return _0x2fdfe3;};exports[_0xbd22('0x15')]=function(_0x54a1c6){_0x54a1c6=parseInt(_0x54a1c6,0xa);if(!_0x54a1c6||_0x54a1c6<0x0){_0x54a1c6=0x0;}return _0x54a1c6;};exports[_0xbd22('0x16')]=function(_0x54ad0e){var _0x4e0420,_0x37e220=null;if(_0x54ad0e){_0x4e0420=_0x54ad0e[_0xbd22('0x6')](',');_0x37e220=_[_0xbd22('0x17')](_0x4e0420,function(_0x4b1b3b){if(_0x4b1b3b[_0xbd22('0x18')]('-')===0x0){return[_0x4b1b3b===_0xbd22('0x19')?sequelize[_0xbd22('0x1a')](sequelize[_0xbd22('0x1b')](_0xbd22('0x19')),_0xbd22('0x1c')):_0x4b1b3b[_0xbd22('0x1d')](0x1),_0xbd22('0x1e')];}else{return[_0x4b1b3b===_0xbd22('0x19')?sequelize['cast'](sequelize[_0xbd22('0x1b')](_0xbd22('0x19')),_0xbd22('0x1c')):_0x4b1b3b,_0xbd22('0x1f')];}});}return _0x37e220;};exports['omit']=function(_0x37699d,_0x2585f1){if(_['isEmpty'](_0x37699d)){return _0x37699d;}if(_['isArray'](_0x37699d)){for(var _0x26247f=0x0;_0x26247f<_0x37699d['length'];_0x26247f+=0x1){_0x37699d[_0x26247f]=this[_0xbd22('0x20')](_0x37699d[_0x26247f],_0x2585f1);}return _0x37699d;}if(!_[_0xbd22('0x21')](_0x37699d)){return _0x37699d;}if(_[_0xbd22('0x22')](_0x2585f1)){_0x2585f1=[_0x2585f1];}if(!_['isArray'](_0x2585f1)){return _0x37699d;}for(var _0x1c978d=0x0;_0x1c978d<_0x2585f1[_0xbd22('0x23')];_0x1c978d+=0x1){_['unset'](_0x37699d,_0x2585f1[_0x1c978d]);}for(var _0x41d0fe in _0x37699d){if(_0x37699d['hasOwnProperty'](_0x41d0fe)){_0x37699d[_0x41d0fe]=this[_0xbd22('0x20')](_0x37699d[_0x41d0fe],_0x2585f1);}}return _0x37699d;};exports['isNumeric']=function(_0x1cc0c6){return _0x1cc0c6['match'](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0xbd22('0x24')]=function(_0x485f54){return _0x485f54[_0xbd22('0x25')](/^\S+@\S+$/)?!![]:![];};exports[_0xbd22('0x26')]=function(_0x238c0d){var _0x348cc8=[];_0x238c0d[_0xbd22('0x6')](/[ ,]+/)[_0xbd22('0x27')](function(_0x4ef54d){_0x4ef54d=_0x4ef54d[_0xbd22('0x28')](/([^:]")"+/g,'$1');_0x4ef54d='+'+_0x4ef54d+'*';if(_0x4ef54d[_0xbd22('0x29')]('@'))_0x4ef54d='\x22'+_0x4ef54d+'\x22';_0x348cc8[_0xbd22('0x2a')](_0x4ef54d);});return _0x348cc8[_0xbd22('0x2b')]('\x20');};exports[_0xbd22('0x2c')]=function(_0x8b1d1f,_0x4300e5,_0x473b4e){var _0x2713b0={},_0xce656c={};if(_0x4300e5[_0xbd22('0x2d')][_0xbd22('0x2e')]){_0x4300e5[_0xbd22('0x2d')]['id']=_0x4300e5['query'][_0xbd22('0x2e')];delete _0x4300e5[_0xbd22('0x2d')][_0xbd22('0x2e')];}_0x2713b0[_0xbd22('0x2f')]=_['map'](_0x8b1d1f,'name');_0x2713b0['query']=_['keys'](_0x4300e5[_0xbd22('0x2d')]);_0x2713b0[_0xbd22('0x7')]=_[_0xbd22('0x30')](_0x2713b0[_0xbd22('0x2f')],_0x2713b0[_0xbd22('0x2d')]);_0xce656c[_0xbd22('0x31')]=_[_0xbd22('0x30')](_0x2713b0[_0xbd22('0x2f')],this[_0xbd22('0x5')](_0x4300e5[_0xbd22('0x2d')]['fields']));_0xce656c[_0xbd22('0x31')]=_0xce656c[_0xbd22('0x31')][_0xbd22('0x23')]?_0xce656c[_0xbd22('0x31')]:_0x2713b0[_0xbd22('0x2f')];if(!_0x4300e5[_0xbd22('0x2d')][_0xbd22('0x32')](_0xbd22('0x33'))){_0xce656c[_0xbd22('0x14')]=this[_0xbd22('0x14')](_0x4300e5[_0xbd22('0x2d')][_0xbd22('0x14')]);_0xce656c['offset']=this[_0xbd22('0x15')](_0x4300e5[_0xbd22('0x2d')][_0xbd22('0x15')]);}_0xce656c[_0xbd22('0x34')]=this['sort'](_0x4300e5['query'][_0xbd22('0x16')]);_0xce656c[_0xbd22('0x35')]=this[_0xbd22('0x7')](_[_0xbd22('0x36')](_0x4300e5[_0xbd22('0x2d')],_0x2713b0[_0xbd22('0x7')]),_0x8b1d1f);if(_0x4300e5['query'][_0xbd22('0x37')]){var _0x38ffac=_0x8b1d1f;var _0x20c833=_0x4300e5['query']['filter'];if(typeof _0x20c833===_0xbd22('0x38')){_0x38ffac=_[_0xbd22('0x37')](_0x8b1d1f,function(_0x5e4219){return _['includes'](_0x20c833['columns'],_0x5e4219[_0xbd22('0x11')]);});_0x20c833=_0x20c833['value'];}_0xce656c[_0xbd22('0x35')]=_[_0xbd22('0x39')](_0xce656c[_0xbd22('0x35')],{'$or':_[_0xbd22('0x17')](_0x38ffac,function(_0x227a00){if(_0x227a00['type']!==_0xbd22('0x3a')){if(_0x473b4e){return sequelize[_0xbd22('0x35')](sequelize['fn'](_0xbd22('0x3b'),sequelize[_0xbd22('0x1b')](_0x227a00['name'])),{'$like':sequelize['fn']('lower','%'+_0x4300e5[_0xbd22('0x2d')][_0xbd22('0x37')]+'%')});}else{var _0x26fd69={};_0x26fd69[_0x227a00[_0xbd22('0x11')]]={'$like':'%'+_0x4300e5[_0xbd22('0x2d')][_0xbd22('0x37')]+'%'};return _0x26fd69;}}})});}_0xce656c=_['merge']({},_0xce656c,_0x4300e5[_0xbd22('0x3c')]);return _0xce656c;}; \ No newline at end of file +var _0xd1ad=['split','sort','map','priority','cast','col','unsigned','substr','DESC','ASC','omit','isEmpty','length','isString','hasOwnProperty','isNumeric','match','isEmail','getFullTextValue','forEach','replace','push','join','getOptions','query','$id','model','filters','intersection','attributes','nolimit','limit','offset','where','pick','filter','object','columns','name','value','merge','type','VIRTUAL','lower','sequelize','moment','parse','keys','includes','fields','forOwn','find','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','subtract','uniqueid','isArray'];(function(_0x221ded,_0x117817){var _0x55210a=function(_0xba8819){while(--_0xba8819){_0x221ded['push'](_0x221ded['shift']());}};_0x55210a(++_0x117817);}(_0xd1ad,0x1d7));var _0xdd1a=function(_0x22e47a,_0x4ea10c){_0x22e47a=_0x22e47a-0x0;var _0x15a12a=_0xd1ad[_0x22e47a];return _0x15a12a;};'use strict';var _=require('lodash');var sequelize=require(_0xdd1a('0x0'));var moment=require(_0xdd1a('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x3d38f4){var _0x36a3bb=['ne'];try{var _0x3445b0=JSON[_0xdd1a('0x2')](_0x3d38f4);var _0x2e6276=Object[_0xdd1a('0x3')](_0x3445b0)[0x0];return _0x36a3bb[_0xdd1a('0x4')](_0x2e6276);}catch(_0x3091cc){return![];}}function getOperatorValue(_0x18797d){var _0x419636=JSON['parse'](_0x18797d);var _0x1f0675=Object[_0xdd1a('0x3')](_0x419636)[0x0];var _0x5bf7a9=_0x419636[_0x1f0675];return{['$'+_0x1f0675]:_0x5bf7a9};}exports[_0xdd1a('0x5')]=function(_0x25b340){var _0x226672=null;if(_0x25b340){_0x226672=_0x25b340['split'](',');}return _0x226672;};exports['filters']=function(_0x5577c3,_0x27b12e){var _0xf52d5={};if(!_['isEmpty'](_0x5577c3)){_[_0xdd1a('0x6')](_0x5577c3,function(_0x1aab76,_0xe0957c){try{if(_0x27b12e){var _0x1a8c79=_[_0xdd1a('0x7')](_0x27b12e,{'name':_0xe0957c})||{};if(hasSequelizeOperator(_0x1aab76)){_0xf52d5[_0xe0957c]=getOperatorValue(_0x1aab76);}else if(_0x1a8c79['type']===_0xdd1a('0x8')&&_[_0xdd1a('0x9')](_0x1aab76)){var _0xd8ff49=JSON['parse'](_0x1aab76);var _0x30cd10={'$gte':moment(moment(_0xd8ff49[_0xdd1a('0xa')])[_0xdd1a('0xb')](_0xdd1a('0xc')))[_0xdd1a('0xd')]()[_0xdd1a('0xb')](),'$lte':moment(moment(_0xd8ff49['$lte'])[_0xdd1a('0xb')](_0xdd1a('0xc')))[_0xdd1a('0xd')]()[_0xdd1a('0xe')](0x1,'s')[_0xdd1a('0xb')]()};_0xf52d5[_0xe0957c]=_0x30cd10;}else if(_0x1a8c79['name']===_0xdd1a('0xf')){_0xf52d5[_0xe0957c]=_0x1aab76;}else{_0xf52d5[_0xe0957c]=_[_0xdd1a('0x10')](_0x1aab76)?_0x1aab76:JSON['parse'](_0x1aab76);}}else{_0xf52d5[_0xe0957c]=_[_0xdd1a('0x10')](_0x1aab76)?_0x1aab76:JSON[_0xdd1a('0x2')](_0x1aab76);}}catch(_0x1f66e2){_0xf52d5[_0xe0957c]=_0x1aab76[_0xdd1a('0x11')](',');}});}return _0xf52d5;};exports['limit']=function(_0x3cd1f9){_0x3cd1f9=parseInt(_0x3cd1f9,0xa);if(!_0x3cd1f9||_0x3cd1f9<0x0){_0x3cd1f9=LIMIT_VALUE;}return _0x3cd1f9;};exports['offset']=function(_0x3b4472){_0x3b4472=parseInt(_0x3b4472,0xa);if(!_0x3b4472||_0x3b4472<0x0){_0x3b4472=0x0;}return _0x3b4472;};exports[_0xdd1a('0x12')]=function(_0x3c27da){var _0x26c851,_0x57f907=null;if(_0x3c27da){_0x26c851=_0x3c27da[_0xdd1a('0x11')](',');_0x57f907=_[_0xdd1a('0x13')](_0x26c851,function(_0x1323af){if(_0x1323af['indexOf']('-')===0x0){return[_0x1323af===_0xdd1a('0x14')?sequelize[_0xdd1a('0x15')](sequelize[_0xdd1a('0x16')](_0xdd1a('0x14')),_0xdd1a('0x17')):_0x1323af[_0xdd1a('0x18')](0x1),_0xdd1a('0x19')];}else{return[_0x1323af==='priority'?sequelize[_0xdd1a('0x15')](sequelize[_0xdd1a('0x16')](_0xdd1a('0x14')),'unsigned'):_0x1323af,_0xdd1a('0x1a')];}});}return _0x57f907;};exports[_0xdd1a('0x1b')]=function(_0x156646,_0x60f617){if(_[_0xdd1a('0x1c')](_0x156646)){return _0x156646;}if(_[_0xdd1a('0x10')](_0x156646)){for(var _0x17098b=0x0;_0x17098b<_0x156646[_0xdd1a('0x1d')];_0x17098b+=0x1){_0x156646[_0x17098b]=this[_0xdd1a('0x1b')](_0x156646[_0x17098b],_0x60f617);}return _0x156646;}if(!_['isObject'](_0x156646)){return _0x156646;}if(_[_0xdd1a('0x1e')](_0x60f617)){_0x60f617=[_0x60f617];}if(!_[_0xdd1a('0x10')](_0x60f617)){return _0x156646;}for(var _0x49551f=0x0;_0x49551f<_0x60f617['length'];_0x49551f+=0x1){_['unset'](_0x156646,_0x60f617[_0x49551f]);}for(var _0x15b632 in _0x156646){if(_0x156646[_0xdd1a('0x1f')](_0x15b632)){_0x156646[_0x15b632]=this[_0xdd1a('0x1b')](_0x156646[_0x15b632],_0x60f617);}}return _0x156646;};exports[_0xdd1a('0x20')]=function(_0x18df8f){return _0x18df8f[_0xdd1a('0x21')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0xdd1a('0x22')]=function(_0x555ede){return _0x555ede[_0xdd1a('0x21')](/^\S+@\S+$/)?!![]:![];};exports[_0xdd1a('0x23')]=function(_0xab3b95){var _0x38fed1=[];_0xab3b95[_0xdd1a('0x11')](/[ ,]+/)[_0xdd1a('0x24')](function(_0x45f452){_0x45f452=_0x45f452[_0xdd1a('0x25')](/([^:]")"+/g,'$1');_0x45f452='+'+_0x45f452+'*';if(_0x45f452[_0xdd1a('0x4')]('@'))_0x45f452='\x22'+_0x45f452+'\x22';_0x38fed1[_0xdd1a('0x26')](_0x45f452);});return _0x38fed1[_0xdd1a('0x27')]('\x20');};exports[_0xdd1a('0x28')]=function(_0x55bfac,_0x4abb59,_0x512bbf){var _0x50e0e7={},_0xce2a58={};if(_0x4abb59[_0xdd1a('0x29')][_0xdd1a('0x2a')]){_0x4abb59[_0xdd1a('0x29')]['id']=_0x4abb59['query'][_0xdd1a('0x2a')];delete _0x4abb59[_0xdd1a('0x29')][_0xdd1a('0x2a')];}_0x50e0e7[_0xdd1a('0x2b')]=_[_0xdd1a('0x13')](_0x55bfac,'name');_0x50e0e7[_0xdd1a('0x29')]=_['keys'](_0x4abb59['query']);_0x50e0e7[_0xdd1a('0x2c')]=_[_0xdd1a('0x2d')](_0x50e0e7['model'],_0x50e0e7[_0xdd1a('0x29')]);_0xce2a58['attributes']=_['intersection'](_0x50e0e7['model'],this['fields'](_0x4abb59[_0xdd1a('0x29')][_0xdd1a('0x5')]));_0xce2a58['attributes']=_0xce2a58[_0xdd1a('0x2e')][_0xdd1a('0x1d')]?_0xce2a58[_0xdd1a('0x2e')]:_0x50e0e7['model'];if(!_0x4abb59[_0xdd1a('0x29')][_0xdd1a('0x1f')](_0xdd1a('0x2f'))){_0xce2a58['limit']=this[_0xdd1a('0x30')](_0x4abb59[_0xdd1a('0x29')][_0xdd1a('0x30')]);_0xce2a58[_0xdd1a('0x31')]=this['offset'](_0x4abb59[_0xdd1a('0x29')][_0xdd1a('0x31')]);}_0xce2a58['order']=this[_0xdd1a('0x12')](_0x4abb59[_0xdd1a('0x29')]['sort']);_0xce2a58[_0xdd1a('0x32')]=this['filters'](_[_0xdd1a('0x33')](_0x4abb59[_0xdd1a('0x29')],_0x50e0e7[_0xdd1a('0x2c')]),_0x55bfac);if(_0x4abb59[_0xdd1a('0x29')]['filter']){var _0x5d3f02=_0x55bfac;var _0x48dd3f=_0x4abb59['query'][_0xdd1a('0x34')];if(typeof _0x48dd3f===_0xdd1a('0x35')){_0x5d3f02=_[_0xdd1a('0x34')](_0x55bfac,function(_0x3be13f){return _[_0xdd1a('0x4')](_0x48dd3f[_0xdd1a('0x36')],_0x3be13f[_0xdd1a('0x37')]);});_0x48dd3f=_0x48dd3f[_0xdd1a('0x38')];}_0xce2a58[_0xdd1a('0x32')]=_[_0xdd1a('0x39')](_0xce2a58[_0xdd1a('0x32')],{'$or':_['map'](_0x5d3f02,function(_0x52f4bb){if(_0x52f4bb[_0xdd1a('0x3a')]!==_0xdd1a('0x3b')){if(_0x512bbf){return sequelize['where'](sequelize['fn'](_0xdd1a('0x3c'),sequelize[_0xdd1a('0x16')](_0x52f4bb[_0xdd1a('0x37')])),{'$like':sequelize['fn']('lower','%'+_0x4abb59['query'][_0xdd1a('0x34')]+'%')});}else{var _0x253416={};_0x253416[_0x52f4bb[_0xdd1a('0x37')]]={'$like':'%'+_0x4abb59[_0xdd1a('0x29')][_0xdd1a('0x34')]+'%'};return _0x253416;}}})});}_0xce2a58=_[_0xdd1a('0x39')]({},_0xce2a58,_0x4abb59['options']);return _0xce2a58;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 8e12094..675a9cb 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad2a=['cors','moment','./environment','default','env','production','set','appPath','join','public','test','root','client','use','json\x20replacer','toISOString','split','static','get','views','html','renderFile','view\x20engine','urlencoded','50mb','json','express','serve-favicon','body-parser','method-override','cookie-parser','errorhandler','path','passport'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xad2a,0xe6));var _0xaad2=function(_0x19b20e,_0x215b9d){_0x19b20e=_0x19b20e-0x0;var _0x599616=_0xad2a[_0x19b20e];return _0x599616;};'use strict';var express=require(_0xaad2('0x0'));var favicon=require(_0xaad2('0x1'));var bodyParser=require(_0xaad2('0x2'));var methodOverride=require(_0xaad2('0x3'));var cookieParser=require(_0xaad2('0x4'));var errorHandler=require(_0xaad2('0x5'));var path=require(_0xaad2('0x6'));var passport=require(_0xaad2('0x7'));var cors=require(_0xaad2('0x8'));var moment=require(_0xaad2('0x9'));var config=require(_0xaad2('0xa'));var db=require('../mysqldb')['db'];exports[_0xaad2('0xb')]=function(_0x49d32a){var _0x405f65=_0x49d32a['get'](_0xaad2('0xc'));if(_0x405f65===_0xaad2('0xd')){_0x49d32a[_0xaad2('0xe')](_0xaad2('0xf'),path[_0xaad2('0x10')](config['root'],_0xaad2('0x11')));}if(_0x405f65==='development'||_0x405f65===_0xaad2('0x12')){_0x49d32a[_0xaad2('0xe')](_0xaad2('0xf'),path['join'](config[_0xaad2('0x13')],_0xaad2('0x14')));_0x49d32a[_0xaad2('0x15')](errorHandler());}_0x49d32a[_0xaad2('0xe')](_0xaad2('0x16'),function(_0x46d95e,_0x3b74fe){if(this[_0x46d95e]instanceof Date){_0x3b74fe=this[_0x46d95e][_0xaad2('0x17')]()[_0xaad2('0x18')]('.')[0x0]+'Z';}return _0x3b74fe;});_0x49d32a[_0xaad2('0x15')](express[_0xaad2('0x19')](_0x49d32a[_0xaad2('0x1a')](_0xaad2('0xf'))));_0x49d32a[_0xaad2('0xe')](_0xaad2('0x1b'),config[_0xaad2('0x13')]+'/server/views');_0x49d32a['engine'](_0xaad2('0x1c'),require('ejs')[_0xaad2('0x1d')]);_0x49d32a['set'](_0xaad2('0x1e'),_0xaad2('0x1c'));_0x49d32a[_0xaad2('0x15')](bodyParser[_0xaad2('0x1f')]({'limit':_0xaad2('0x20'),'extended':!![]}));_0x49d32a[_0xaad2('0x15')](bodyParser[_0xaad2('0x21')]({'limit':_0xaad2('0x20')}));_0x49d32a[_0xaad2('0x15')](cors());_0x49d32a[_0xaad2('0x15')](methodOverride());_0x49d32a[_0xaad2('0x15')](cookieParser());_0x49d32a[_0xaad2('0x15')](passport['initialize']());}; \ No newline at end of file +var _0x4916=['body-parser','method-override','cookie-parser','errorhandler','path','passport','cors','moment','./environment','../mysqldb','default','get','env','production','join','public','development','set','appPath','root','json\x20replacer','split','static','/server/views','html','ejs','renderFile','view\x20engine','use','express','serve-favicon'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x4916,0x191));var _0x6491=function(_0x3c9955,_0x2eaee5){_0x3c9955=_0x3c9955-0x0;var _0xc84cfd=_0x4916[_0x3c9955];return _0xc84cfd;};'use strict';var express=require(_0x6491('0x0'));var favicon=require(_0x6491('0x1'));var bodyParser=require(_0x6491('0x2'));var methodOverride=require(_0x6491('0x3'));var cookieParser=require(_0x6491('0x4'));var errorHandler=require(_0x6491('0x5'));var path=require(_0x6491('0x6'));var passport=require(_0x6491('0x7'));var cors=require(_0x6491('0x8'));var moment=require(_0x6491('0x9'));var config=require(_0x6491('0xa'));var db=require(_0x6491('0xb'))['db'];exports[_0x6491('0xc')]=function(_0x1eb7a0){var _0x252af7=_0x1eb7a0[_0x6491('0xd')](_0x6491('0xe'));if(_0x252af7===_0x6491('0xf')){_0x1eb7a0['set']('appPath',path[_0x6491('0x10')](config['root'],_0x6491('0x11')));}if(_0x252af7===_0x6491('0x12')||_0x252af7==='test'){_0x1eb7a0[_0x6491('0x13')](_0x6491('0x14'),path['join'](config[_0x6491('0x15')],'client'));_0x1eb7a0['use'](errorHandler());}_0x1eb7a0[_0x6491('0x13')](_0x6491('0x16'),function(_0x16219f,_0x2e86f2){if(this[_0x16219f]instanceof Date){_0x2e86f2=this[_0x16219f]['toISOString']()[_0x6491('0x17')]('.')[0x0]+'Z';}return _0x2e86f2;});_0x1eb7a0['use'](express[_0x6491('0x18')](_0x1eb7a0[_0x6491('0xd')]('appPath')));_0x1eb7a0[_0x6491('0x13')]('views',config[_0x6491('0x15')]+_0x6491('0x19'));_0x1eb7a0['engine'](_0x6491('0x1a'),require(_0x6491('0x1b'))[_0x6491('0x1c')]);_0x1eb7a0[_0x6491('0x13')](_0x6491('0x1d'),_0x6491('0x1a'));_0x1eb7a0[_0x6491('0x1e')](bodyParser['urlencoded']({'limit':'50mb','extended':!![]}));_0x1eb7a0[_0x6491('0x1e')](bodyParser['json']({'limit':'50mb'}));_0x1eb7a0[_0x6491('0x1e')](cors());_0x1eb7a0[_0x6491('0x1e')](methodOverride());_0x1eb7a0[_0x6491('0x1e')](cookieParser());_0x1eb7a0[_0x6491('0x1e')](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 0b632ef..8f78f6b 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 _0xcd50=['md5','update','getUuid','licenseToken','test','utf8','macAddress','ipAddress','digest','hex','substring','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','IPv4','internal','concat','mac','00:00:00:00:00:00','address','127.0.0.1','cpus','map','join','createHash'];(function(_0x3603a9,_0x381ac2){var _0x5b4352=function(_0x5e1326){while(--_0x5e1326){_0x3603a9['push'](_0x3603a9['shift']());}};_0x5b4352(++_0x381ac2);}(_0xcd50,0xa1));var _0x0cd5=function(_0x5b06ae,_0x598641){_0x5b06ae=_0x5b06ae-0x0;var _0x1d7d11=_0xcd50[_0x5b06ae];return _0x1d7d11;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require(_0x0cd5('0x0'));var exec=require(_0x0cd5('0x1'))[_0x0cd5('0x2')];var config=require(_0x0cd5('0x3'));function getInterfaces(){var _0x56166a=[];var _0x1f4bac=os[_0x0cd5('0x4')]();var _0x54f5a3=_[_0x0cd5('0x5')](_[_0x0cd5('0x6')](_0x1f4bac));for(var _0x426634=0x0;_0x426634<_0x54f5a3[_0x0cd5('0x7')];_0x426634++){var _0x1263c7=_0x1f4bac[_0x54f5a3[_0x426634]]['filter'](function(_0xa3d51f){return _0xa3d51f['family']===_0x0cd5('0x8')&&_0xa3d51f[_0x0cd5('0x9')]===![];});_0x56166a=_0x56166a[_0x0cd5('0xa')](_0x1263c7);}return _0x56166a;}function getFirstInterface(){var _0x2bc0b7=_['head'](getInterfaces());return{'macAddress':_0x2bc0b7&&_0x2bc0b7[_0x0cd5('0xb')]?_0x2bc0b7[_0x0cd5('0xb')]:_0x0cd5('0xc'),'ipAddress':_0x2bc0b7&&_0x2bc0b7[_0x0cd5('0xd')]?_0x2bc0b7[_0x0cd5('0xd')]:_0x0cd5('0xe')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x5aaef2=_[_0x0cd5('0x5')](os[_0x0cd5('0xf')]()[_0x0cd5('0x10')](function(_0x48c5c2){return _0x48c5c2['model'];}))[_0x0cd5('0x11')](':');return crypto[_0x0cd5('0x12')](_0x0cd5('0x13'))[_0x0cd5('0x14')](_0x5aaef2)['digest']('hex');}exports[_0x0cd5('0x15')]=function(){var _0xe54cbf=os['platform']();var _0x256f21=/[0-9a-f-]{36}/;if(config[_0x0cd5('0x16')]&&_0x256f21[_0x0cd5('0x17')](config[_0x0cd5('0x16')])){return config[_0x0cd5('0x16')];}else if(_0xe54cbf==='win32'){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x0cd5('0x18')})['replace']('\x0d\x0a','');}else{var _0xcb854a=getFirstInterface();var _0xd78b93=getCPUhash();var _0x447142=_0xd78b93+'|'+os['hostname']()+'|'+_0xcb854a[_0x0cd5('0x19')]+'|'+_0xcb854a[_0x0cd5('0x1a')];var _0x1a4ae0=crypto[_0x0cd5('0x12')](_0x0cd5('0x13'))[_0x0cd5('0x14')](_0x447142)[_0x0cd5('0x1b')](_0x0cd5('0x1c'));return _0x1a4ae0['substring'](0x0,0x8)+'-'+_0x1a4ae0[_0x0cd5('0x1d')](0x8,0xc)+'-'+_0x1a4ae0[_0x0cd5('0x1d')](0xc,0x10)+'-'+_0x1a4ae0[_0x0cd5('0x1d')](0x10,0x14)+'-'+_0x1a4ae0[_0x0cd5('0x1d')](0x14);}}; \ No newline at end of file +var _0x9be0=['hostname','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','getFirstInterface','cpus','map','model','join','md5','update','digest','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace'];(function(_0x2718c7,_0x5a1636){var _0x59d89c=function(_0x4d4f49){while(--_0x4d4f49){_0x2718c7['push'](_0x2718c7['shift']());}};_0x59d89c(++_0x5a1636);}(_0x9be0,0x16c));var _0x09be=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x9be0[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x09be('0x0'));var os=require('os');var crypto=require(_0x09be('0x1'));var machine=require(_0x09be('0x2'));var exec=require(_0x09be('0x3'))[_0x09be('0x4')];var config=require(_0x09be('0x5'));function getInterfaces(){var _0x5e480f=[];var _0x295cfd=os[_0x09be('0x6')]();var _0x51bc70=_[_0x09be('0x7')](_[_0x09be('0x8')](_0x295cfd));for(var _0x2edb82=0x0;_0x2edb82<_0x51bc70[_0x09be('0x9')];_0x2edb82++){var _0x35a67a=_0x295cfd[_0x51bc70[_0x2edb82]][_0x09be('0xa')](function(_0x16643d){return _0x16643d[_0x09be('0xb')]===_0x09be('0xc')&&_0x16643d[_0x09be('0xd')]===![];});_0x5e480f=_0x5e480f[_0x09be('0xe')](_0x35a67a);}return _0x5e480f;}function getFirstInterface(){var _0x1677f3=_[_0x09be('0xf')](getInterfaces());return{'macAddress':_0x1677f3&&_0x1677f3[_0x09be('0x10')]?_0x1677f3[_0x09be('0x10')]:_0x09be('0x11'),'ipAddress':_0x1677f3&&_0x1677f3['address']?_0x1677f3[_0x09be('0x12')]:'127.0.0.1'};}exports[_0x09be('0x13')]=getFirstInterface;function getCPUhash(){var _0xd2c950=_[_0x09be('0x7')](os[_0x09be('0x14')]()[_0x09be('0x15')](function(_0x5b8f03){return _0x5b8f03[_0x09be('0x16')];}))[_0x09be('0x17')](':');return crypto['createHash'](_0x09be('0x18'))[_0x09be('0x19')](_0xd2c950)[_0x09be('0x1a')](_0x09be('0x1b'));}exports[_0x09be('0x1c')]=function(){var _0x451cf3=os[_0x09be('0x1d')]();var _0x5bb190=/[0-9a-f-]{36}/;if(config[_0x09be('0x1e')]&&_0x5bb190[_0x09be('0x1f')](config[_0x09be('0x1e')])){return config['licenseToken'];}else if(_0x451cf3===_0x09be('0x20')){return exec(_0x09be('0x21'),{'encoding':_0x09be('0x22')})[_0x09be('0x23')]('\x0d\x0a','');}else{var _0x3a0130=getFirstInterface();var _0x20fe89=getCPUhash();var _0x148bb9=_0x20fe89+'|'+os[_0x09be('0x24')]()+'|'+_0x3a0130[_0x09be('0x25')]+'|'+_0x3a0130[_0x09be('0x26')];var _0x4dba8d=crypto['createHash'](_0x09be('0x18'))[_0x09be('0x19')](_0x148bb9)['digest'](_0x09be('0x1b'));return _0x4dba8d[_0x09be('0x27')](0x0,0x8)+'-'+_0x4dba8d['substring'](0x8,0xc)+'-'+_0x4dba8d[_0x09be('0x27')](0xc,0x10)+'-'+_0x4dba8d['substring'](0x10,0x14)+'-'+_0x4dba8d[_0x09be('0x27')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index a5331c5..67913ca 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 _0x6c07=['GET','then','catch','get','data2','data1','active','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','spread','default','moment','request-promise','bluebird','pkginfo','version','../../components/encryptor','../logger','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x6c07,0x1b7));var _0x76c0=function(_0x254330,_0x1d6d4a){_0x254330=_0x254330-0x0;var _0x489771=_0x6c07[_0x254330];return _0x489771;};'use strict';var util=require('util');var moment=require(_0x76c0('0x0'));var rp=require(_0x76c0('0x1'));var BPromise=require(_0x76c0('0x2'));var pkginfo=require(_0x76c0('0x3'))(module,_0x76c0('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x76c0('0x5'));var hardware=require('./hardware');var logger=require(_0x76c0('0x6'))('license');var HOST=_0x76c0('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x2216b8){return new BPromise(function(_0x104f74,_0x1b66e5){var _0x580600=util[_0x76c0('0x8')](_0x76c0('0x9'),HOST,_0x2216b8,module[_0x76c0('0xa')]['version']);if(oldToken){_0x580600=util[_0x76c0('0x8')](_0x76c0('0xb'),HOST,_0x2216b8,module[_0x76c0('0xa')]['version'],oldToken);}var _0x45c517={'uri':_0x580600,'method':_0x76c0('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x45c517)[_0x76c0('0xd')](function(_0x18c75a){_0x104f74(_0x18c75a);})[_0x76c0('0xe')](function(_0x130576){_0x1b66e5(_0x130576);});});}function manageLicense(_0x1196ab,_0x17f922){var _0x52747e=_0x17f922[_0x76c0('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x52747e['data1']!==_0x1196ab&&!_0x52747e[_0x76c0('0x10')]){oldToken=_0x52747e[_0x76c0('0x11')];}httpRequest(_0x1196ab)['then'](function(_0x2d20ec){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x2d20ec[_0x76c0('0x12')]){isOldTokenSent=![];if(!_0x52747e[_0x76c0('0x13')]&&_0x52747e[_0x76c0('0x13')]!=_0x2d20ec['license']||_0x52747e[_0x76c0('0x13')]&&_0x52747e['data2']){logger[_0x76c0('0x14')](_0x76c0('0x15'));}if(_0x52747e[_0x76c0('0x13')]&&!_0x52747e[_0x76c0('0x10')]&&_0x52747e[_0x76c0('0x13')]!=_0x2d20ec[_0x76c0('0x13')]){logger[_0x76c0('0x14')](_0x76c0('0x16'));}if(_0x52747e['license']&&!_0x52747e[_0x76c0('0x10')]&&_0x52747e[_0x76c0('0x13')]==_0x2d20ec[_0x76c0('0x13')]){return _0x17f922;}return _0x17f922[_0x76c0('0x17')]({'data1':_0x1196ab,'data2':null,'license':_0x2d20ec[_0x76c0('0x13')]});}else{if(_0x2d20ec[_0x76c0('0x13')]||_0x52747e[_0x76c0('0x13')]){if(!_0x52747e[_0x76c0('0x10')]){if(_0x52747e['data1']==_0x1196ab){GRAY_PERIOD_REASON=_0x76c0('0x18');logger[_0x76c0('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x76c0('0x19');logger[_0x76c0('0x14')](_0x76c0('0x1a'),_0x52747e['data1'],_0x1196ab);}logger['info'](_0x76c0('0x1b'),GRAY_PERIOD_REASON[_0x76c0('0x1c')](),moment()['format'](_0x76c0('0x1d')));return _0x17f922[_0x76c0('0x17')]({'data2':encryptor['encryptString'](moment()[_0x76c0('0x8')](_0x76c0('0x1d')))});}else{if(moment()[_0x76c0('0x1e')](encryptor['decryptString'](_0x52747e['data2']),_0x76c0('0x1f'))>DAYS){logger['info'](_0x76c0('0x20'),moment()[_0x76c0('0x8')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x17f922[_0x76c0('0x17')]({'data1':_0x1196ab,'data2':null,'license':null});}}}else{if(_0x52747e[_0x76c0('0x11')]!=_0x1196ab){logger['info'](_0x76c0('0x1a'),_0x52747e[_0x76c0('0x11')],_0x1196ab);return _0x17f922[_0x76c0('0x17')]({'data1':_0x1196ab,'data2':null,'license':null});}}}return _0x17f922;})[_0x76c0('0xd')](function(_0x2463c7){_0x17f922=_0x2463c7;})['catch'](function(_0x535a5c){logger[_0x76c0('0x21')](_0x535a5c[_0x76c0('0x22')]);})[_0x76c0('0x23')](function(){setTimeout(function(){manageLicense(hardware[_0x76c0('0x24')](),_0x17f922);},TIME);});}function defaultLicense(){var _0x3626b9=hardware[_0x76c0('0x24')]();if(_0x3626b9){return db[_0x76c0('0x25')][_0x76c0('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0x3626b9}})[_0x76c0('0x27')](function(_0x3e9b51,_0x165c7d){logger['info']('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x3626b9);manageLicense(_0x3626b9,_0x3e9b51);})[_0x76c0('0xe')](function(_0x4c1c78){logger['error'](_0x4c1c78['message']);});}}exports[_0x76c0('0x28')]=defaultLicense; \ No newline at end of file +var _0x629d=['toUpperCase','update','encryptString','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','getUuid','findOrCreate','spread','default','util','moment','request-promise','bluebird','../../mysqldb','../../components/encryptor','./hardware','../logger','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','active','license','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s'];(function(_0x1e255a,_0x1f3aaa){var _0x486680=function(_0x117d2f){while(--_0x117d2f){_0x1e255a['push'](_0x1e255a['shift']());}};_0x486680(++_0x1f3aaa);}(_0x629d,0x110));var _0xd629=function(_0x2acb77,_0x272b50){_0x2acb77=_0x2acb77-0x0;var _0x11c4ad=_0x629d[_0x2acb77];return _0x11c4ad;};'use strict';var util=require(_0xd629('0x0'));var moment=require(_0xd629('0x1'));var rp=require(_0xd629('0x2'));var BPromise=require(_0xd629('0x3'));var pkginfo=require('pkginfo')(module,'version');var db=require(_0xd629('0x4'))['db'];var encryptor=require(_0xd629('0x5'));var hardware=require(_0xd629('0x6'));var logger=require(_0xd629('0x7'))('license');var HOST=_0xd629('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x1052d9){return new BPromise(function(_0x3384ec,_0x46b78b){var _0x459bb2=util[_0xd629('0x9')](_0xd629('0xa'),HOST,_0x1052d9,module[_0xd629('0xb')][_0xd629('0xc')]);if(oldToken){_0x459bb2=util[_0xd629('0x9')](_0xd629('0xd'),HOST,_0x1052d9,module['exports']['version'],oldToken);}var _0x4e8019={'uri':_0x459bb2,'method':_0xd629('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x4e8019)[_0xd629('0xf')](function(_0x3e5425){_0x3384ec(_0x3e5425);})[_0xd629('0x10')](function(_0x126acc){_0x46b78b(_0x126acc);});});}function manageLicense(_0x5eb11c,_0x48fe52){var _0x44fc7d=_0x48fe52[_0xd629('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x44fc7d[_0xd629('0x12')]!==_0x5eb11c&&!_0x44fc7d['data2']){oldToken=_0x44fc7d[_0xd629('0x12')];}httpRequest(_0x5eb11c)[_0xd629('0xf')](function(_0x296647){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x296647[_0xd629('0x13')]){isOldTokenSent=![];if(!_0x44fc7d[_0xd629('0x14')]&&_0x44fc7d[_0xd629('0x14')]!=_0x296647[_0xd629('0x14')]||_0x44fc7d[_0xd629('0x14')]&&_0x44fc7d[_0xd629('0x15')]){logger[_0xd629('0x16')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x44fc7d[_0xd629('0x14')]&&!_0x44fc7d[_0xd629('0x15')]&&_0x44fc7d['license']!=_0x296647['license']){logger[_0xd629('0x16')](_0xd629('0x17'));}if(_0x44fc7d['license']&&!_0x44fc7d[_0xd629('0x15')]&&_0x44fc7d['license']==_0x296647[_0xd629('0x14')]){return _0x48fe52;}return _0x48fe52['update']({'data1':_0x5eb11c,'data2':null,'license':_0x296647[_0xd629('0x14')]});}else{if(_0x296647[_0xd629('0x14')]||_0x44fc7d[_0xd629('0x14')]){if(!_0x44fc7d[_0xd629('0x15')]){if(_0x44fc7d[_0xd629('0x12')]==_0x5eb11c){GRAY_PERIOD_REASON=_0xd629('0x18');logger[_0xd629('0x16')](_0xd629('0x19'));}else{GRAY_PERIOD_REASON=_0xd629('0x1a');logger[_0xd629('0x16')](_0xd629('0x1b'),_0x44fc7d['data1'],_0x5eb11c);}logger[_0xd629('0x16')](_0xd629('0x1c'),GRAY_PERIOD_REASON[_0xd629('0x1d')](),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x48fe52[_0xd629('0x1e')]({'data2':encryptor[_0xd629('0x1f')](moment()[_0xd629('0x9')](_0xd629('0x20')))});}else{if(moment()[_0xd629('0x21')](encryptor[_0xd629('0x22')](_0x44fc7d[_0xd629('0x15')]),_0xd629('0x23'))>DAYS){logger[_0xd629('0x16')](_0xd629('0x24'),moment()['format'](_0xd629('0x20')));isOldTokenSent=![];return _0x48fe52[_0xd629('0x1e')]({'data1':_0x5eb11c,'data2':null,'license':null});}}}else{if(_0x44fc7d[_0xd629('0x12')]!=_0x5eb11c){logger[_0xd629('0x16')](_0xd629('0x1b'),_0x44fc7d['data1'],_0x5eb11c);return _0x48fe52[_0xd629('0x1e')]({'data1':_0x5eb11c,'data2':null,'license':null});}}}return _0x48fe52;})[_0xd629('0xf')](function(_0x15acbd){_0x48fe52=_0x15acbd;})['catch'](function(_0x3edc3f){logger[_0xd629('0x25')](_0x3edc3f[_0xd629('0x26')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0xd629('0x27')](),_0x48fe52);},TIME);});}function defaultLicense(){var _0x414316=hardware[_0xd629('0x27')]();if(_0x414316){return db['License'][_0xd629('0x28')]({'where':{'id':0x1},'defaults':{'data1':_0x414316}})[_0xd629('0x29')](function(_0x5b6695,_0x46fa5b){logger[_0xd629('0x16')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x414316);manageLicense(_0x414316,_0x5b6695);})[_0xd629('0x10')](function(_0x5ebc34){logger[_0xd629('0x25')](_0x5ebc34[_0xd629('0x26')]);});}}exports[_0xd629('0x2a')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index a4498c1..2990bb6 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 _0x5133=['users','telephones','admin','countBy','telephone','License\x20limit\x20reached\x20for\x20telephones','util','moment','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Breaking\x20license','getUuid','License','find','defaults','then','catch','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','decryptString','%s:%s:%s','demo','uuid','machineUuid','gray','add','days','message','role','sequelize','col','count','user'];(function(_0x269c51,_0x2b7f90){var _0x568d09=function(_0x422c59){while(--_0x422c59){_0x269c51['push'](_0x269c51['shift']());}};_0x568d09(++_0x2b7f90);}(_0x5133,0xc4));var _0x3513=function(_0x9e8780,_0x3b0bab){_0x9e8780=_0x9e8780-0x0;var _0x5cdfaa=_0x5133[_0x9e8780];return _0x5cdfaa;};'use strict';var util=require(_0x3513('0x0'));var _=require('lodash');var moment=require(_0x3513('0x1'));var BPromise=require('bluebird');var hardware=require('./hardware');var encryptor=require(_0x3513('0x2'));var db=require(_0x3513('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x3513('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x3513('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x3513('0x5'),'machineUuid':hardware[_0x3513('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4de941){return new BPromise(function(_0x45b200,_0x3fa1ca){return db[_0x3513('0x7')][_0x3513('0x8')](_[_0x3513('0x9')](_0x4de941,{'raw':!![],'where':{'id':0x1}}))[_0x3513('0xa')](function(_0x3ec795){return checkLicense(_0x3ec795,null);})['then'](function(_0x339eec){_0x45b200(_0x339eec);return;})[_0x3513('0xb')](function(_0x2ff5de){_0x3fa1ca(_0x2ff5de);});});}function checkLicense(_0x2b7c41,_0x129e2f){if(!_0x2b7c41){demoLicense['uuid']=_0x2b7c41['data1'];return demoLicense;}try{var _0x47cd0e=_0x129e2f||_0x2b7c41[_0x3513('0xc')];if(_[_0x3513('0xd')](_0x47cd0e)){throw new Error(_0x3513('0xe'));}var _0x7fd6f8=_0x2b7c41[_0x3513('0xf')];var _0x9b1b32=_0x2b7c41[_0x3513('0x10')];var _0x398764=_0x7fd6f8[_0x3513('0x11')]('-')[0x4];var _0x2ecb64=_0x7fd6f8[_0x3513('0x11')]('-')[0x0];var _0x6323ed=encryptor[_0x3513('0x12')](_0x47cd0e,util['format'](_0x3513('0x13'),_0x398764,_0x7fd6f8,_0x2ecb64));var _0x51731b=JSON['parse'](_0x6323ed);_0x51731b[_0x3513('0x14')]=![];_0x51731b[_0x3513('0x15')]=_0x7fd6f8;_0x51731b[_0x3513('0x16')]=hardware['getUuid']();if(_0x9b1b32){var _0x12e663=encryptor[_0x3513('0x12')](_0x9b1b32);_0x51731b[_0x3513('0x17')]=_0x12e663;_0x51731b['deadline']=moment(_0x12e663)[_0x3513('0x18')](0x7,_0x3513('0x19'))['format']();_0x51731b['grayReason']=_0x51731b[_0x3513('0x15')]!=_0x51731b['machineUuid']?'changed':'disabled';}return _0x51731b;}catch(_0x2996f8){breakingLicense[_0x3513('0x15')]=_0x2b7c41[_0x3513('0xf')];breakingLicense['message']=_0x2996f8[_0x3513('0x1a')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x182e1d,_0x1d8e5a){getLicense()['then'](function(_0x2f36dc){return db['User']['findAll']({'attributes':[_0x3513('0x1b'),[db[_0x3513('0x1c')]['fn']('COUNT',db[_0x3513('0x1c')][_0x3513('0x1d')]('role')),_0x3513('0x1e')]],'group':_0x3513('0x1b'),'where':{'role':{'$or':['admin',_0x3513('0x1f'),'telephone']}},'raw':!![]})[_0x3513('0xa')](function(_0x1daaad){var _0x44a3ce={'user':_0x2f36dc[_0x3513('0x20')]||0x0,'telephone':_0x2f36dc[_0x3513('0x21')]||0x0};_0x1daaad['forEach'](function(_0x5a437d){var _0x5235c0=_0x5a437d['role']===_0x3513('0x22')?_0x3513('0x1f'):_0x5a437d[_0x3513('0x1b')];_0x44a3ce[_0x5235c0]-=_0x5a437d['count'];if(_0x44a3ce[_0x5235c0]<0x0)_0x44a3ce[_0x5235c0]=0x0;});_0x182e1d(_0x44a3ce);return;});})[_0x3513('0xb')](function(_0xb017){_0x1d8e5a(_0xb017);});});}function checkUserLimits(_0x55c3e7){return new BPromise(function(_0xd80006,_0x4e3161){getLimits()[_0x3513('0xa')](function(_0x28b673){var _0x5e9c36=_['pick'](_[_0x3513('0x23')](_0x55c3e7,_0x3513('0x1b')),['admin',_0x3513('0x1f'),'telephone']);var _0x6c7cee=(_0x5e9c36[_0x3513('0x22')]||0x0)+(_0x5e9c36['user']||0x0);var _0xc7bba8=_0x5e9c36[_0x3513('0x24')]||0x0;if(_0x6c7cee>_0x28b673[_0x3513('0x1f')])return _0x4e3161('License\x20limit\x20reached\x20for\x20users');if(_0xc7bba8>_0x28b673['telephone'])return _0x4e3161(_0x3513('0x25'));return _0xd80006();})[_0x3513('0xb')](function(_0x31734a){_0x4e3161(_0x31734a);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x7c16=['add','days','grayReason','changed','disabled','message','User','findAll','sequelize','col','role','count','telephone','users','telephones','forEach','admin','user','pick','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','2027-01-01T00:00:00.000Z','getUuid','License','find','defaults','then','catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','parse','demo','uuid','machineUuid','gray'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7c16,0xf6));var _0x67c1=function(_0xda21e8,_0x19d184){_0xda21e8=_0xda21e8-0x0;var _0x28904b=_0x7c16[_0xda21e8];return _0x28904b;};'use strict';var util=require(_0x67c1('0x0'));var _=require(_0x67c1('0x1'));var moment=require(_0x67c1('0x2'));var BPromise=require(_0x67c1('0x3'));var hardware=require('./hardware');var encryptor=require('../../components/encryptor');var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x67c1('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x67c1('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x67c1('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x67c1('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x25503e){return new BPromise(function(_0x17b2e0,_0x1bd629){return db[_0x67c1('0x6')][_0x67c1('0x7')](_[_0x67c1('0x8')](_0x25503e,{'raw':!![],'where':{'id':0x1}}))[_0x67c1('0x9')](function(_0x596496){return checkLicense(_0x596496,null);})['then'](function(_0x47622c){_0x17b2e0(_0x47622c);return;})[_0x67c1('0xa')](function(_0xb05c9b){_0x1bd629(_0xb05c9b);});});}function checkLicense(_0x59919a,_0x4c92c5){if(!_0x59919a){demoLicense['uuid']=_0x59919a[_0x67c1('0xb')];return demoLicense;}try{var _0x56c057=_0x4c92c5||_0x59919a[_0x67c1('0xc')];if(_[_0x67c1('0xd')](_0x56c057)){throw new Error(_0x67c1('0xe'));}var _0x5d579b=_0x59919a[_0x67c1('0xb')];var _0x1934d1=_0x59919a[_0x67c1('0xf')];var _0x4e8a35=_0x5d579b[_0x67c1('0x10')]('-')[0x4];var _0x242bc8=_0x5d579b['split']('-')[0x0];var _0x86693=encryptor[_0x67c1('0x11')](_0x56c057,util[_0x67c1('0x12')]('%s:%s:%s',_0x4e8a35,_0x5d579b,_0x242bc8));var _0x1e189e=JSON[_0x67c1('0x13')](_0x86693);_0x1e189e[_0x67c1('0x14')]=![];_0x1e189e[_0x67c1('0x15')]=_0x5d579b;_0x1e189e[_0x67c1('0x16')]=hardware[_0x67c1('0x5')]();if(_0x1934d1){var _0x449d9d=encryptor['decryptString'](_0x1934d1);_0x1e189e[_0x67c1('0x17')]=_0x449d9d;_0x1e189e['deadline']=moment(_0x449d9d)[_0x67c1('0x18')](0x7,_0x67c1('0x19'))[_0x67c1('0x12')]();_0x1e189e[_0x67c1('0x1a')]=_0x1e189e[_0x67c1('0x15')]!=_0x1e189e[_0x67c1('0x16')]?_0x67c1('0x1b'):_0x67c1('0x1c');}return _0x1e189e;}catch(_0x15f0e7){breakingLicense[_0x67c1('0x15')]=_0x59919a['data1'];breakingLicense[_0x67c1('0x1d')]=_0x15f0e7[_0x67c1('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x10f2c9,_0x1f7b83){getLicense()[_0x67c1('0x9')](function(_0x430101){return db[_0x67c1('0x1e')][_0x67c1('0x1f')]({'attributes':['role',[db[_0x67c1('0x20')]['fn']('COUNT',db[_0x67c1('0x20')][_0x67c1('0x21')](_0x67c1('0x22'))),_0x67c1('0x23')]],'group':'role','where':{'role':{'$or':['admin','user',_0x67c1('0x24')]}},'raw':!![]})[_0x67c1('0x9')](function(_0x2cb378){var _0x41b762={'user':_0x430101[_0x67c1('0x25')]||0x0,'telephone':_0x430101[_0x67c1('0x26')]||0x0};_0x2cb378[_0x67c1('0x27')](function(_0x2deb34){var _0x2710dc=_0x2deb34[_0x67c1('0x22')]===_0x67c1('0x28')?_0x67c1('0x29'):_0x2deb34[_0x67c1('0x22')];_0x41b762[_0x2710dc]-=_0x2deb34[_0x67c1('0x23')];if(_0x41b762[_0x2710dc]<0x0)_0x41b762[_0x2710dc]=0x0;});_0x10f2c9(_0x41b762);return;});})[_0x67c1('0xa')](function(_0x46588f){_0x1f7b83(_0x46588f);});});}function checkUserLimits(_0x25bcf2){return new BPromise(function(_0x1c88b3,_0x3486b2){getLimits()['then'](function(_0x4a22b3){var _0x1d48a5=_[_0x67c1('0x2a')](_['countBy'](_0x25bcf2,'role'),[_0x67c1('0x28'),_0x67c1('0x29'),_0x67c1('0x24')]);var _0x545eb2=(_0x1d48a5[_0x67c1('0x28')]||0x0)+(_0x1d48a5[_0x67c1('0x29')]||0x0);var _0x310527=_0x1d48a5[_0x67c1('0x24')]||0x0;if(_0x545eb2>_0x4a22b3[_0x67c1('0x29')])return _0x3486b2('License\x20limit\x20reached\x20for\x20users');if(_0x310527>_0x4a22b3[_0x67c1('0x24')])return _0x3486b2(_0x67c1('0x2b'));return _0x1c88b3();})[_0x67c1('0xa')](function(_0x350fe5){_0x3486b2(_0x350fe5);});});}module[_0x67c1('0x2c')]={'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 a551673..8399df8 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 _0xa30a=['http://localhost:9000','myappanuglar-secret','secret','exports'];(function(_0x53cb8b,_0x1074de){var _0x5a7658=function(_0xc3b5c9){while(--_0xc3b5c9){_0x53cb8b['push'](_0x53cb8b['shift']());}};_0x5a7658(++_0x1074de);}(_0xa30a,0xd7));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';module[_0xaa30('0x0')]={'DOMAIN':_0xaa30('0x1'),'SESSION_SECRET':_0xaa30('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xaa30('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x1a85=['secret','myappanuglar-secret','app-id'];(function(_0x40c1d2,_0xf59433){var _0x8d0993=function(_0x434bf7){while(--_0x434bf7){_0x40c1d2['push'](_0x40c1d2['shift']());}};_0x8d0993(++_0xf59433);}(_0x1a85,0x178));var _0x51a8=function(_0x6c0833,_0x59e073){_0x6c0833=_0x6c0833-0x0;var _0x25d75b=_0x1a85[_0x6c0833];return _0x25d75b;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x51a8('0x0'),'GOOGLE_ID':_0x51a8('0x1'),'GOOGLE_SECRET':_0x51a8('0x2'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index e1ec04e..3e24016 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2086=['INFO','join','/var','log','xcally','%s-%s.log','message','replace','{{{','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','toUpperCase','exports','File','%s-%s','error','transports','info','Console','debugLevel','moment','winston','path'];(function(_0x5e3701,_0x596265){var _0x345dcf=function(_0x5eb12a){while(--_0x5eb12a){_0x5e3701['push'](_0x5e3701['shift']());}};_0x345dcf(++_0x596265);}(_0x2086,0x165));var _0x6208=function(_0x490319,_0x7c50af){_0x490319=_0x490319-0x0;var _0x24b6ed=_0x2086[_0x490319];return _0x24b6ed;};'use strict';var moment=require(_0x6208('0x0'));var winston=require(_0x6208('0x1'));var util=require('util');var path=require(_0x6208('0x2'));var debugLevel=_0x6208('0x3');function filename(_0x5adb71,_0x52df5d){return path[_0x6208('0x4')](_0x6208('0x5'),_0x6208('0x6'),_0x6208('0x7'),util['format'](_0x6208('0x8'),_0x5adb71,_0x52df5d));}function formatter(_0x3c3573,_0x17b6ef){_0x17b6ef[_0x6208('0x9')]=_0x17b6ef['message'][_0x6208('0xa')](/@@{/g,_0x6208('0xb'))[_0x6208('0xa')](/}@@/g,_0x6208('0xc'))[_0x6208('0xa')](/@{/g,'{{')[_0x6208('0xa')](/}@/g,'}}');return util[_0x6208('0xd')](_0x6208('0xe'),moment()[_0x6208('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),_0x17b6ef['level'][_0x6208('0xf')](),_0x3c3573,_0x17b6ef['message']);}module[_0x6208('0x10')]=function(_0x136441){return new winston['Logger']({'transports':[new winston['transports'][(_0x6208('0x11'))]({'name':util[_0x6208('0xd')](_0x6208('0x12'),_0x136441,'error'),'filename':filename(_0x136441,_0x6208('0x13')),'level':_0x6208('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2d8ce3){return formatter(_0x136441,_0x2d8ce3);}}),new winston[(_0x6208('0x14'))]['File']({'name':util[_0x6208('0xd')](_0x6208('0x12'),_0x136441,_0x6208('0x15')),'filename':filename(_0x136441,_0x6208('0x15')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x59412b){return formatter(_0x136441,_0x59412b);}}),new winston[(_0x6208('0x14'))][(_0x6208('0x16'))]({'level':process['env'][_0x6208('0x17')]||debugLevel,'json':![],'formatter':function(_0x292786){return formatter(_0x136441,_0x292786);}})]});}; \ No newline at end of file +var _0xf53e=['debugLevel','moment','winston','util','path','join','/var','log','xcally','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','Logger','transports','%s-%s','error','File','info','Console','env'];(function(_0x5f5fae,_0x3e67d6){var _0x336802=function(_0x4362d8){while(--_0x4362d8){_0x5f5fae['push'](_0x5f5fae['shift']());}};_0x336802(++_0x3e67d6);}(_0xf53e,0x17b));var _0xef53=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf53e[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0xef53('0x0'));var winston=require(_0xef53('0x1'));var util=require(_0xef53('0x2'));var path=require(_0xef53('0x3'));var debugLevel='INFO';function filename(_0x5c42e6,_0x353d76){return path[_0xef53('0x4')](_0xef53('0x5'),_0xef53('0x6'),_0xef53('0x7'),util[_0xef53('0x8')](_0xef53('0x9'),_0x5c42e6,_0x353d76));}function formatter(_0x5c9223,_0x3d5f12){_0x3d5f12[_0xef53('0xa')]=_0x3d5f12[_0xef53('0xa')][_0xef53('0xb')](/@@{/g,_0xef53('0xc'))[_0xef53('0xb')](/}@@/g,_0xef53('0xd'))[_0xef53('0xb')](/@{/g,'{{')[_0xef53('0xb')](/}@/g,'}}');return util[_0xef53('0x8')](_0xef53('0xe'),moment()[_0xef53('0x8')](_0xef53('0xf')),_0x3d5f12[_0xef53('0x10')][_0xef53('0x11')](),_0x5c9223,_0x3d5f12['message']);}module['exports']=function(_0x2a3e53){return new winston[(_0xef53('0x12'))]({'transports':[new winston[(_0xef53('0x13'))]['File']({'name':util[_0xef53('0x8')](_0xef53('0x14'),_0x2a3e53,_0xef53('0x15')),'filename':filename(_0x2a3e53,_0xef53('0x15')),'level':_0xef53('0x15'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x35f905){return formatter(_0x2a3e53,_0x35f905);}}),new winston['transports'][(_0xef53('0x16'))]({'name':util[_0xef53('0x8')]('%s-%s',_0x2a3e53,_0xef53('0x17')),'filename':filename(_0x2a3e53,_0xef53('0x17')),'level':_0xef53('0x17'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1eb7cd){return formatter(_0x2a3e53,_0x1eb7cd);}}),new winston[(_0xef53('0x13'))][(_0xef53('0x18'))]({'level':process[_0xef53('0x19')][_0xef53('0x1a')]||debugLevel,'json':![],'formatter':function(_0x36d5b1){return formatter(_0x2a3e53,_0x36d5b1);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 090ed18..92d8027 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 _0x5d42=['../../services/express/index.js','ami','join','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','exports','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5d42,0x19f));var _0x25d4=function(_0x2c2cd6,_0x634b09){_0x2c2cd6=_0x2c2cd6-0x0;var _0xf9b0fc=_0x5d42[_0x2c2cd6];return _0xf9b0fc;};'use strict';var path=require(_0x25d4('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path['join'](__dirname,_0x25d4('0x1'))},{'name':_0x25d4('0x2'),'script':path[_0x25d4('0x3')](__dirname,_0x25d4('0x4'))},{'name':_0x25d4('0x5'),'script':path[_0x25d4('0x3')](__dirname,_0x25d4('0x6'))},{'name':_0x25d4('0x7'),'script':path[_0x25d4('0x3')](__dirname,_0x25d4('0x8'))},{'name':_0x25d4('0x9'),'script':path[_0x25d4('0x3')](__dirname,_0x25d4('0xa'))},{'name':_0x25d4('0xb'),'script':path[_0x25d4('0x3')](__dirname,'../../services/xdr/index.js')}]};module[_0x25d4('0xc')]=config; \ No newline at end of file +var _0x9188=['email','../../services/email/index.js','routing','../../services/routing/index.js','exports','path','join','../../services/express/index.js','ami','../../services/ami/index.js'];(function(_0x5a7912,_0x574e23){var _0x4a3648=function(_0x5e3c1f){while(--_0x5e3c1f){_0x5a7912['push'](_0x5a7912['shift']());}};_0x4a3648(++_0x574e23);}(_0x9188,0xb9));var _0x8918=function(_0x198391,_0xa5fc10){_0x198391=_0x198391-0x0;var _0xcb3c41=_0x9188[_0x198391];return _0xcb3c41;};'use strict';var path=require(_0x8918('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0x8918('0x1')](__dirname,_0x8918('0x2'))},{'name':_0x8918('0x3'),'script':path['join'](__dirname,_0x8918('0x4'))},{'name':'agi','script':path[_0x8918('0x1')](__dirname,'../../services/agi/index.js')},{'name':_0x8918('0x5'),'script':path['join'](__dirname,_0x8918('0x6'))},{'name':_0x8918('0x7'),'script':path['join'](__dirname,_0x8918('0x8'))},{'name':'xdr','script':path[_0x8918('0x1')](__dirname,'../../services/xdr/index.js')}]};module[_0x8918('0x9')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 82eb4a1..5760899 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 _0x3d54=['connected','start','then','disconnect','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connect'];(function(_0x5b549f,_0xec14cf){var _0x143bc0=function(_0x316570){while(--_0x316570){_0x5b549f['push'](_0x5b549f['shift']());}};_0x143bc0(++_0xec14cf);}(_0x3d54,0x96));var _0x43d5=function(_0x638368,_0x1d07ed){_0x638368=_0x638368-0x0;var _0x32bd24=_0x3d54[_0x638368];return _0x32bd24;};'use strict';var pm2=require(_0x43d5('0x0'));var BPromise=require(_0x43d5('0x1'));var config=require(_0x43d5('0x2'));function connect(){return new BPromise(function(_0x221717,_0x54dd43){return pm2[_0x43d5('0x3')](function(_0x22bed7){if(_0x22bed7){return _0x54dd43(_0x22bed7);}return _0x221717(_0x43d5('0x4'));});});};exports[_0x43d5('0x5')]=function(_0xde872f){return connect()[_0x43d5('0x6')](function(){return new BPromise(function(_0x2d97d3,_0x274edd){return pm2[_0x43d5('0x5')](_0xde872f,function(_0x23eb77,_0x49c46a){if(_0x23eb77){return _0x274edd(_0x23eb77);}pm2['disconnect']();return _0x2d97d3(_0x49c46a);});});});};exports['stop']=function(_0xa8ee26){return connect()[_0x43d5('0x6')](function(){return new BPromise(function(_0x5350d1,_0x8e0dfd){return pm2['stop'](_0xa8ee26,function(_0x1605cd,_0x5ccf7e){if(_0x1605cd){return _0x8e0dfd(_0x1605cd);}pm2[_0x43d5('0x7')]();return _0x5350d1(_0x5ccf7e);});});});};exports[_0x43d5('0x8')]=function(_0x94aa9c){return connect()['then'](function(){return new BPromise(function(_0xf4a2dd,_0x101031){return pm2[_0x43d5('0x8')](_0x94aa9c,function(_0x59296d,_0x56567a){if(_0x59296d){return _0x101031(_0x59296d);}pm2[_0x43d5('0x7')]();return _0xf4a2dd(_0x56567a);});});});};exports['list']=function(){return connect()[_0x43d5('0x6')](function(){return new BPromise(function(_0x5006cb,_0x46f054){return pm2[_0x43d5('0x9')](function(_0x26cbfc,_0x4aec88){if(_0x26cbfc){return _0x46f054(_0x26cbfc);}pm2['disconnect']();return _0x5006cb(_0x4aec88);});});});};exports[_0x43d5('0xa')]=function(_0x1c48b6){return connect()[_0x43d5('0x6')](function(){return new BPromise(function(_0x41f593,_0x2c76ec){return pm2[_0x43d5('0xa')](_0x1c48b6,function(_0x19575e,_0x56f91a){if(_0x19575e){return _0x2c76ec(_0x19575e);}pm2[_0x43d5('0x7')]();return _0x41f593(_0x56f91a);});});});};exports[_0x43d5('0xb')]=function(_0x19e36e){return connect()[_0x43d5('0x6')](function(){return new BPromise(function(_0x3741da,_0x274927){return pm2[_0x43d5('0xb')](_0x19e36e,function(_0x1ffb28,_0x2873e8){if(_0x1ffb28){return _0x274927(_0x1ffb28);}pm2['disconnect']();return _0x3741da(_0x2873e8);});});});};exports[_0x43d5('0xc')]=function(){return connect()[_0x43d5('0x6')](function(){return new BPromise(function(_0x2712f6,_0xb417f7){return pm2[_0x43d5('0xc')](function(_0x3de0d3){if(_0x3de0d3){return _0xb417f7(_0x3de0d3);}return _0x2712f6(_0x43d5('0xd'));});});});}; \ No newline at end of file +var _0xafd3=['pm2','./config','start','then','stop','disconnect','restart','list','describe','delete','saved'];(function(_0x465893,_0x282856){var _0xde14bc=function(_0x539be7){while(--_0x539be7){_0x465893['push'](_0x465893['shift']());}};_0xde14bc(++_0x282856);}(_0xafd3,0xb0));var _0x3afd=function(_0x2142c8,_0x3001eb){_0x2142c8=_0x2142c8-0x0;var _0x4286e9=_0xafd3[_0x2142c8];return _0x4286e9;};'use strict';var pm2=require(_0x3afd('0x0'));var BPromise=require('bluebird');var config=require(_0x3afd('0x1'));function connect(){return new BPromise(function(_0x113182,_0x320a74){return pm2['connect'](function(_0xefc9b2){if(_0xefc9b2){return _0x320a74(_0xefc9b2);}return _0x113182('connected');});});};exports[_0x3afd('0x2')]=function(_0x42f97f){return connect()[_0x3afd('0x3')](function(){return new BPromise(function(_0x943d1d,_0x16ce76){return pm2['start'](_0x42f97f,function(_0x165182,_0x3211ed){if(_0x165182){return _0x16ce76(_0x165182);}pm2['disconnect']();return _0x943d1d(_0x3211ed);});});});};exports[_0x3afd('0x4')]=function(_0x3f5dbe){return connect()['then'](function(){return new BPromise(function(_0xa0935c,_0xbcfa31){return pm2['stop'](_0x3f5dbe,function(_0x3dd1e0,_0x4ccc9b){if(_0x3dd1e0){return _0xbcfa31(_0x3dd1e0);}pm2[_0x3afd('0x5')]();return _0xa0935c(_0x4ccc9b);});});});};exports[_0x3afd('0x6')]=function(_0x1fa6a9){return connect()[_0x3afd('0x3')](function(){return new BPromise(function(_0x1b2892,_0x5a2095){return pm2[_0x3afd('0x6')](_0x1fa6a9,function(_0x15c7ee,_0x5ac767){if(_0x15c7ee){return _0x5a2095(_0x15c7ee);}pm2['disconnect']();return _0x1b2892(_0x5ac767);});});});};exports[_0x3afd('0x7')]=function(){return connect()[_0x3afd('0x3')](function(){return new BPromise(function(_0x43a122,_0x5b8616){return pm2['list'](function(_0x1deed9,_0x468931){if(_0x1deed9){return _0x5b8616(_0x1deed9);}pm2[_0x3afd('0x5')]();return _0x43a122(_0x468931);});});});};exports[_0x3afd('0x8')]=function(_0x3899ca){return connect()[_0x3afd('0x3')](function(){return new BPromise(function(_0x3c1b52,_0x4b7f39){return pm2['describe'](_0x3899ca,function(_0x454394,_0x128eb6){if(_0x454394){return _0x4b7f39(_0x454394);}pm2[_0x3afd('0x5')]();return _0x3c1b52(_0x128eb6);});});});};exports[_0x3afd('0x9')]=function(_0x15d048){return connect()[_0x3afd('0x3')](function(){return new BPromise(function(_0x1ae362,_0x4f03cb){return pm2[_0x3afd('0x9')](_0x15d048,function(_0x17cdc1,_0x4f885a){if(_0x17cdc1){return _0x4f03cb(_0x17cdc1);}pm2[_0x3afd('0x5')]();return _0x1ae362(_0x4f885a);});});});};exports['dump']=function(){return connect()['then'](function(){return new BPromise(function(_0x44ee02,_0x3d4047){return pm2['dump'](function(_0xde975c){if(_0xde975c){return _0x3d4047(_0xde975c);}return _0x44ee02(_0x3afd('0xa'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index be71765..80bf5ab 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 _0x93bf=['redis','localhost','socket.io-emitter','Setting','find','chatTimeout','findAll','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','update','system','timeout','format','then','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','util','../../config/environment','schedule'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x93bf,0x124));var _0xf93b=function(_0xa2c44,_0x2290d1){_0xa2c44=_0xa2c44-0x0;var _0x59d9af=_0x93bf[_0xa2c44];return _0x59d9af;};'use strict';var _=require(_0xf93b('0x0'));var moment=require(_0xf93b('0x1'));var Redis=require('ioredis');var util=require(_0xf93b('0x2'));var config=require(_0xf93b('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0xf93b('0x4'));config[_0xf93b('0x5')]=_['defaults'](config[_0xf93b('0x5')],{'host':_0xf93b('0x6'),'port':0x18eb});var io=require(_0xf93b('0x7'))(new Redis(config[_0xf93b('0x5')]));function closeInteractions(){var _0x443bf6=0x0;var _0x19e980=[];return db[_0xf93b('0x8')][_0xf93b('0x9')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x526a82){_0x443bf6=_0x526a82[_0xf93b('0xa')];if(_0x443bf6){return db['ChatInteraction'][_0xf93b('0xb')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xf93b('0xc')](_0x526a82['chatTimeout'],_0xf93b('0xd'))}}});}else{return[];}})['then'](function(_0xfac9a8){if(_0xfac9a8&&_0xfac9a8[_0xf93b('0xe')]){_0x19e980=_[_0xf93b('0xf')](_0xfac9a8||[],'id');logger[_0xf93b('0x10')](_0xf93b('0x11'),_0x19e980[_0xf93b('0x12')]());return db[_0xf93b('0x13')][_0xf93b('0x14')]({'closeReason':_0xf93b('0x15'),'disposition':_0xf93b('0x16'),'closed':!![],'closedAt':moment()[_0xf93b('0x17')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x19e980}});}})[_0xf93b('0x18')](function(){if(_0x19e980&&_0x19e980[_0xf93b('0xe')]){logger[_0xf93b('0x10')](_0xf93b('0x19'),_0x19e980[_0xf93b('0x12')]());for(var _0x45fdd6=0x0;_0x45fdd6<_0x19e980[_0xf93b('0xe')];_0x45fdd6++){io[_0xf93b('0x1a')](_0xf93b('0x1b'),{'id':_0x19e980[_0x45fdd6],'closed':!![]});}}})[_0xf93b('0x1c')](function(_0x2adf54){logger[_0xf93b('0x1d')](_0xf93b('0x1e'),_0x2adf54?util[_0xf93b('0x1f')](_0x2adf54,{'showHidden':![],'depth':null}):'');});}exports[_0xf93b('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x2bf1=['minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','ioredis','util','../../config/environment','../logger','redis','defaults','socket.io-emitter','Setting','find','then','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x2bf1,0x1b1));var _0x12bf=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x2bf1[_0x5608a3];return _0x1ed50a;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0x12bf('0x0'));var util=require(_0x12bf('0x1'));var config=require(_0x12bf('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x12bf('0x3'))('schedule');config[_0x12bf('0x4')]=_[_0x12bf('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x12bf('0x6'))(new Redis(config[_0x12bf('0x4')]));function closeInteractions(){var _0x37e4a0=0x0;var _0x3fce63=[];return db[_0x12bf('0x7')][_0x12bf('0x8')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x12bf('0x9')](function(_0x10c93d){_0x37e4a0=_0x10c93d[_0x12bf('0xa')];if(_0x37e4a0){return db[_0x12bf('0xb')][_0x12bf('0xc')]({'raw':!![],'attributes':['id',_0x12bf('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x12bf('0xe')](_0x10c93d[_0x12bf('0xa')],_0x12bf('0xf'))}}});}else{return[];}})[_0x12bf('0x9')](function(_0x5337bf){if(_0x5337bf&&_0x5337bf[_0x12bf('0x10')]){_0x3fce63=_[_0x12bf('0x11')](_0x5337bf||[],'id');logger[_0x12bf('0x12')](_0x12bf('0x13'),_0x3fce63[_0x12bf('0x14')]());return db[_0x12bf('0xb')][_0x12bf('0x15')]({'closeReason':_0x12bf('0x16'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x12bf('0x17')](_0x12bf('0x18'))},{'where':{'id':_0x3fce63}});}})[_0x12bf('0x9')](function(){if(_0x3fce63&&_0x3fce63[_0x12bf('0x10')]){logger['info']('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x3fce63[_0x12bf('0x14')]());for(var _0x4c2632=0x0;_0x4c2632<_0x3fce63[_0x12bf('0x10')];_0x4c2632++){io[_0x12bf('0x19')](_0x12bf('0x1a'),{'id':_0x3fce63[_0x4c2632],'closed':!![]});}}})[_0x12bf('0x1b')](function(_0x12c951){logger[_0x12bf('0x1c')](_0x12bf('0x1d'),_0x12c951?util[_0x12bf('0x1e')](_0x12c951,{'showHidden':![],'depth':null}):'');});}exports[_0x12bf('0x1f')]=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 f4d8fde..4a1f79a 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 _0xd37f=['request','SendMail','then','error\x20mail','email\x20sent','catch','error','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','exec\x20custom\x20report\x20id:%s','CustomReportId','runReport','Schedule','findAll','MailServerOut','keys','jobs','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','index','my\x20id','resolve','run\x20job','cron','startAt','endAt','add','start','add\x20cron','active','isBetween','update','update\x20cron','stop\x20cron','run','util','path','moment','cron-job-manager','bluebird','../logger','schedule','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','name','email','bcc','format','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','status','Sent','message','attachments','text','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','info','empty\x20file,\x20email\x20not\x20sent'];(function(_0x58d3cc,_0x515d61){var _0x5c86eb=function(_0x3ba16b){while(--_0x3ba16b){_0x58d3cc['push'](_0x58d3cc['shift']());}};_0x5c86eb(++_0x515d61);}(_0xd37f,0x1e8));var _0xfd37=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xd37f[_0xa1e3e3];return _0xc980e9;};'use strict';var fs=require('fs');var util=require(_0xfd37('0x0'));var path=require(_0xfd37('0x1'));var _=require('lodash');var moment=require(_0xfd37('0x2'));var CronJobManager=require(_0xfd37('0x3'));var jayson=require('jayson/promise');var BPromise=require(_0xfd37('0x4'));var logger=require(_0xfd37('0x5'))(_0xfd37('0x6'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0xfd37('0x7'));var client=jayson['client'][_0xfd37('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x10acd0,_0x4dab20){return function(){logger['info']('Try\x20to\x20send\x20a\x20mail\x20to',_0x10acd0['email']);var _0x1f6628=!![];var _0x39b198={'tls':{'rejectUnauthorized':![]}};if(_0x10acd0[_0xfd37('0x9')][_0xfd37('0xa')]['service']){_0x39b198[_0xfd37('0xb')]=_0x10acd0[_0xfd37('0x9')][_0xfd37('0xa')][_0xfd37('0xb')];}else{_0x39b198['host']=_0x10acd0[_0xfd37('0x9')][_0xfd37('0xa')][_0xfd37('0xc')];_0x39b198[_0xfd37('0xd')]=_0x10acd0[_0xfd37('0x9')][_0xfd37('0xa')][_0xfd37('0xd')];_0x39b198[_0xfd37('0xe')]=_0x10acd0[_0xfd37('0x9')]['Smtp'][_0xfd37('0xe')];}if(_0x10acd0[_0xfd37('0x9')][_0xfd37('0xa')][_0xfd37('0xf')]){_0x39b198[_0xfd37('0x10')]={'user':_0x10acd0[_0xfd37('0x9')][_0xfd37('0xa')][_0xfd37('0x11')],'pass':_0x10acd0[_0xfd37('0x9')][_0xfd37('0xa')][_0xfd37('0x12')]};}var _0x1b8b90={'account':_0x39b198,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x10acd0['MailAccount'][_0xfd37('0x13')],_0x10acd0[_0xfd37('0x9')][_0xfd37('0x14')]||_0x10acd0[_0xfd37('0x9')][_0xfd37('0xa')][_0xfd37('0x11')]),'to':_0x10acd0[_0xfd37('0x14')],'cc':_0x10acd0['cc'],'bcc':_0x10acd0[_0xfd37('0x15')],'subject':util[_0xfd37('0x16')](_0xfd37('0x17'),_0x4dab20[_0xfd37('0x13')],_0x10acd0['subtractNumber'],_0x10acd0[_0xfd37('0x18')])}};var _0x3c85fc=path[_0xfd37('0x19')](__dirname,_0xfd37('0x1a'));var _0x38fff5=_0x4dab20[_0xfd37('0x1b')];var _0xe0ae54=util[_0xfd37('0x16')](_0xfd37('0x1c'),path[_0xfd37('0x1d')](_0x4dab20[_0xfd37('0x1b')],path[_0xfd37('0x1e')](_0x4dab20[_0xfd37('0x1b')])),'zip');var _0x5e98ba=path[_0xfd37('0x19')](_0x3c85fc,_0x38fff5);var _0x513851=path[_0xfd37('0x19')](_0x3c85fc,_0xe0ae54);if(fs['existsSync'](_0x5e98ba)){_0x4dab20[_0xfd37('0x1f')]=_0xfd37('0x20');_0x1b8b90[_0xfd37('0x21')][_0xfd37('0x22')]=[{'filename':_0x38fff5,'path':_0x5e98ba}];_0x1b8b90['message'][_0xfd37('0x23')]=util['format']('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xfd37('0x24')](_0x4dab20,null,0x2));}else if(fs['existsSync'](_0x513851)){_0x4dab20[_0xfd37('0x1f')]=_0xfd37('0x20');_0x1b8b90[_0xfd37('0x21')][_0xfd37('0x22')]=[{'filename':_0xe0ae54,'path':_0x513851}];}else{_0x1b8b90['message']['text']=_0xfd37('0x25');if(!_0x10acd0['sendIfEmpty']){_0x1f6628=![];logger[_0xfd37('0x26')](_0xfd37('0x27'));}}if(_0x1f6628){return client[_0xfd37('0x28')](_0xfd37('0x29'),_0x1b8b90)[_0xfd37('0x2a')](function(_0x71ba11){if(_0x71ba11['error']){return logger['error'](_0xfd37('0x2b'),JSON['stringify'](_0x71ba11));}return logger['info'](_0xfd37('0x2c'));})[_0xfd37('0x2d')](function(_0x445926){return logger['error'](_0xfd37('0x2b'),JSON[_0xfd37('0x24')](_0x445926));});}};}function handleError(){return function(_0x16d8db){return logger[_0xfd37('0x2e')](JSON[_0xfd37('0x24')](_0x16d8db));};}function handleResult(_0x3c2737){return function(_0x4b3e5e){logger[_0xfd37('0x26')](_0xfd37('0x2f'),JSON['stringify'](_0x4b3e5e));if(_0x3c2737[_0xfd37('0x9')]&&_0x3c2737[_0xfd37('0x9')][_0xfd37('0xa')]&&!_[_0xfd37('0x30')](_0x3c2737[_0xfd37('0x14')])){setTimeout(handleSendEmail(_0x3c2737,_0x4b3e5e),0x3c*0x3e8);}};}function handleJob(_0x357db7){return function(){try{if(_[_0xfd37('0x30')](_0x357db7[_0xfd37('0x31')])){return logger['info'](_0xfd37('0x32'));}if(_[_0xfd37('0x30')](_0x357db7['subtractUnit'])){return logger[_0xfd37('0x26')]('subtractUnit\x20null\x20or\x20undefined');}var _0x10204a={'startDate':moment()[_0xfd37('0x33')](_0x357db7[_0xfd37('0x31')],_0x357db7[_0xfd37('0x18')])[_0xfd37('0x16')](_0xfd37('0x34')),'endDate':moment()['format'](_0xfd37('0x34')),'type':'scheduled','output':_0x357db7[_0xfd37('0x35')],'name':_0x357db7[_0xfd37('0x13')]};if(!_['isNil'](_0x357db7[_0xfd37('0x36')])){logger[_0xfd37('0x26')](_0xfd37('0x37'),_0x357db7[_0xfd37('0x36')]);return analyticDefaultReportController['runReport']({'id':_0x357db7[_0xfd37('0x36')]},_0x10204a)[_0xfd37('0x2a')](handleResult(_0x357db7))[_0xfd37('0x2d')](handleError());}if(!_['isNil'](_0x357db7['CustomReportId'])){logger[_0xfd37('0x26')](_0xfd37('0x38'),_0x357db7[_0xfd37('0x39')]);return analyticCustomReportController[_0xfd37('0x3a')]({'id':_0x357db7[_0xfd37('0x39')]},_0x10204a)[_0xfd37('0x2a')](handleResult(_0x357db7))[_0xfd37('0x2d')](handleError());}}catch(_0x41e484){logger[_0xfd37('0x2e')](JSON[_0xfd37('0x24')](_0x41e484));}return logger['info']('no\x20report\x20id');};}function getJobs(_0xdd663a){var _0x197c24={};if(_0xdd663a){_0x197c24['id']=_0xdd663a;}return db[_0xfd37('0x3b')][_0xfd37('0x3c')]({'where':_0x197c24,'include':[{'model':db[_0xfd37('0x9')],'attributes':['id','name',_0xfd37('0x14')],'include':[{'model':db[_0xfd37('0x3d')],'as':_0xfd37('0xa')}]}]})[_0xfd37('0x2a')](function(_0x4e2c4a){var _0x58dbfd=_[_0xfd37('0x3e')](manager[_0xfd37('0x3f')]);var _0x40582e=_['map'](_0x4e2c4a,function(_0x1b99ca){return _0x1b99ca['id'][_0xfd37('0x40')]();});var _0x41c539=_[_0xfd37('0x41')](_0x4e2c4a,function(_0x4cf6fc){return _0x4cf6fc['id'][_0xfd37('0x40')]();});var _0x482695=_0xdd663a?_0x40582e:_[_0xfd37('0x42')](_0x40582e,_0x58dbfd);var _0x154cc9=_[_0xfd37('0x43')](_0x40582e,_0x58dbfd);var _0x429702=_[_0xfd37('0x42')](_0x58dbfd,_0x40582e);var _0x12fb73;var _0x3ef5c8;for(_0x12fb73=0x0;_0x12fb73<_0x429702[_0xfd37('0x44')]&&!_0xdd663a;_0x12fb73+=0x1){_0x3ef5c8=_0x429702[_0x12fb73][_0xfd37('0x40')]();if(manager[_0xfd37('0x45')](_0x3ef5c8)){manager[_0xfd37('0x46')](_0x3ef5c8);manager[_0xfd37('0x47')](_0x3ef5c8);logger['info']('delete\x20cron',_0x3ef5c8);}}logger[_0xfd37('0x26')]('toRun',JSON['stringify'](_0x482695));for(_0x12fb73=0x0;_0x12fb73<_0x482695[_0xfd37('0x44')];_0x12fb73+=0x1){_0x3ef5c8=_0x482695[_0x12fb73][_0xfd37('0x40')]();logger[_0xfd37('0x26')](_0xfd37('0x48'),_0x3ef5c8);if(_0xdd663a){logger[_0xfd37('0x26')](_0xfd37('0x49'),_0xdd663a);logger['info'](JSON[_0xfd37('0x24')](_0x41c539[_0x3ef5c8]));BPromise[_0xfd37('0x4a')]()[_0xfd37('0x2a')](handleJob(_0x41c539[_0x3ef5c8]));logger[_0xfd37('0x26')](_0xfd37('0x4b'),_0x41c539[_0x3ef5c8][_0xfd37('0x13')],_0x41c539[_0x3ef5c8][_0xfd37('0x4c')]);}else if(_0x41c539[_0x3ef5c8]['cron']&&_0x41c539[_0x3ef5c8]['active']&&moment()['isBetween'](_0x41c539[_0x3ef5c8][_0xfd37('0x4d')],_0x41c539[_0x3ef5c8][_0xfd37('0x4e')])){manager[_0xfd37('0x4f')](_0x3ef5c8,_0x41c539[_0x3ef5c8][_0xfd37('0x4c')],handleJob(_0x41c539[_0x3ef5c8]));manager[_0xfd37('0x50')](_0x3ef5c8);logger[_0xfd37('0x26')](_0xfd37('0x51'),_0x41c539[_0x3ef5c8][_0xfd37('0x13')],_0x41c539[_0x3ef5c8][_0xfd37('0x4c')]);}else if(manager[_0xfd37('0x45')](_0x3ef5c8)){manager[_0xfd37('0x46')](_0x3ef5c8);manager['deleteJob'](_0x3ef5c8);logger[_0xfd37('0x26')]('stop\x20cron',_0x41c539[_0x3ef5c8]['name'],_0x41c539[_0x3ef5c8]['cron']);}}for(_0x12fb73=0x0,_0x3ef5c8;_0x12fb73<_0x154cc9['length']&&!_0xdd663a;_0x12fb73+=0x1){_0x3ef5c8=_0x154cc9[_0x12fb73][_0xfd37('0x40')]();if(manager[_0xfd37('0x45')](_0x3ef5c8)){if(_0x41c539[_0x3ef5c8][_0xfd37('0x4c')]&&_0x41c539[_0x3ef5c8][_0xfd37('0x52')]&&moment()[_0xfd37('0x53')](_0x41c539[_0x3ef5c8]['startAt'],_0x41c539[_0x3ef5c8][_0xfd37('0x4e')])){manager[_0xfd37('0x54')](_0x3ef5c8,_0x41c539[_0x3ef5c8][_0xfd37('0x4c')],handleJob(_0x41c539[_0x3ef5c8]));logger[_0xfd37('0x26')](_0xfd37('0x55'),_0x41c539[_0x3ef5c8]['name'],_0x41c539[_0x3ef5c8][_0xfd37('0x4c')]);}else{manager[_0xfd37('0x46')](_0x3ef5c8);manager['deleteJob'](_0x3ef5c8);logger['info'](_0xfd37('0x56'),_0x41c539[_0x3ef5c8]['name'],_0x41c539[_0x3ef5c8][_0xfd37('0x4c')]);}}}})[_0xfd37('0x2d')](function(_0x88906d){logger[_0xfd37('0x2e')](JSON[_0xfd37('0x24')](_0x88906d));});}exports[_0xfd37('0x57')]=function(_0x49a72e){return getJobs(_0x49a72e);};exports[_0xfd37('0x50')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x4218=['Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','Sent','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','stringify','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','findAll','MailServerOut','keys','jobs','map','keyBy','toString','difference','intersection','length','exists','stop','deleteJob','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','endAt','start','add\x20cron','stop\x20cron','update','update\x20cron','run','util','path','lodash','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','info','MailAccount','Smtp','service','host','port','secure','auth','user','format','\x22%s\x22\x20<%s>','name','email','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','../../files/reports','savename','basename','zip','join','existsSync','status','message','text'];(function(_0x58d1b9,_0x47c0c4){var _0x3d78c7=function(_0x90dc49){while(--_0x90dc49){_0x58d1b9['push'](_0x58d1b9['shift']());}};_0x3d78c7(++_0x47c0c4);}(_0x4218,0xec));var _0x8421=function(_0x17dfd2,_0x296c7b){_0x17dfd2=_0x17dfd2-0x0;var _0x51a8d6=_0x4218[_0x17dfd2];return _0x51a8d6;};'use strict';var fs=require('fs');var util=require(_0x8421('0x0'));var path=require(_0x8421('0x1'));var _=require(_0x8421('0x2'));var moment=require('moment');var CronJobManager=require(_0x8421('0x3'));var jayson=require(_0x8421('0x4'));var BPromise=require(_0x8421('0x5'));var logger=require(_0x8421('0x6'))(_0x8421('0x7'));var db=require(_0x8421('0x8'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x8421('0x9'));var client=jayson[_0x8421('0xa')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x11b7df,_0x133530){return function(){logger[_0x8421('0xb')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x11b7df['email']);var _0x114b60=!![];var _0x37d054={'tls':{'rejectUnauthorized':![]}};if(_0x11b7df[_0x8421('0xc')][_0x8421('0xd')][_0x8421('0xe')]){_0x37d054[_0x8421('0xe')]=_0x11b7df[_0x8421('0xc')][_0x8421('0xd')][_0x8421('0xe')];}else{_0x37d054[_0x8421('0xf')]=_0x11b7df[_0x8421('0xc')]['Smtp']['host'];_0x37d054['port']=_0x11b7df[_0x8421('0xc')]['Smtp'][_0x8421('0x10')];_0x37d054[_0x8421('0x11')]=_0x11b7df[_0x8421('0xc')][_0x8421('0xd')]['secure'];}if(_0x11b7df[_0x8421('0xc')][_0x8421('0xd')]['authentication']){_0x37d054[_0x8421('0x12')]={'user':_0x11b7df[_0x8421('0xc')][_0x8421('0xd')][_0x8421('0x13')],'pass':_0x11b7df[_0x8421('0xc')][_0x8421('0xd')]['pass']};}var _0x29dac9={'account':_0x37d054,'message':{'from':util[_0x8421('0x14')](_0x8421('0x15'),_0x11b7df[_0x8421('0xc')][_0x8421('0x16')],_0x11b7df['MailAccount'][_0x8421('0x17')]||_0x11b7df[_0x8421('0xc')][_0x8421('0xd')][_0x8421('0x13')]),'to':_0x11b7df[_0x8421('0x17')],'cc':_0x11b7df['cc'],'bcc':_0x11b7df[_0x8421('0x18')],'subject':util[_0x8421('0x14')](_0x8421('0x19'),_0x133530['name'],_0x11b7df[_0x8421('0x1a')],_0x11b7df[_0x8421('0x1b')])}};var _0x463f44=path['join'](__dirname,_0x8421('0x1c'));var _0x1df2ac=_0x133530[_0x8421('0x1d')];var _0x93e48c=util['format']('%s.%s',path[_0x8421('0x1e')](_0x133530['savename'],path['extname'](_0x133530[_0x8421('0x1d')])),_0x8421('0x1f'));var _0x9028ee=path[_0x8421('0x20')](_0x463f44,_0x1df2ac);var _0x144133=path[_0x8421('0x20')](_0x463f44,_0x93e48c);if(fs[_0x8421('0x21')](_0x9028ee)){_0x133530[_0x8421('0x22')]='Sent';_0x29dac9[_0x8421('0x23')]['attachments']=[{'filename':_0x1df2ac,'path':_0x9028ee}];_0x29dac9[_0x8421('0x23')][_0x8421('0x24')]=util['format'](_0x8421('0x25'),JSON['stringify'](_0x133530,null,0x2));}else if(fs[_0x8421('0x21')](_0x144133)){_0x133530[_0x8421('0x22')]=_0x8421('0x26');_0x29dac9[_0x8421('0x23')]['attachments']=[{'filename':_0x93e48c,'path':_0x144133}];}else{_0x29dac9[_0x8421('0x23')][_0x8421('0x24')]=_0x8421('0x27');if(!_0x11b7df[_0x8421('0x28')]){_0x114b60=![];logger['info'](_0x8421('0x29'));}}if(_0x114b60){return client[_0x8421('0x2a')](_0x8421('0x2b'),_0x29dac9)[_0x8421('0x2c')](function(_0xa0f226){if(_0xa0f226[_0x8421('0x2d')]){return logger['error'](_0x8421('0x2e'),JSON['stringify'](_0xa0f226));}return logger[_0x8421('0xb')](_0x8421('0x2f'));})[_0x8421('0x30')](function(_0x5b62ad){return logger[_0x8421('0x2d')]('error\x20mail',JSON[_0x8421('0x31')](_0x5b62ad));});}};}function handleError(){return function(_0x329ddf){return logger['error'](JSON['stringify'](_0x329ddf));};}function handleResult(_0x91f1a1){return function(_0x218aaf){logger['info'](_0x8421('0x32'),JSON['stringify'](_0x218aaf));if(_0x91f1a1[_0x8421('0xc')]&&_0x91f1a1[_0x8421('0xc')][_0x8421('0xd')]&&!_[_0x8421('0x33')](_0x91f1a1['email'])){setTimeout(handleSendEmail(_0x91f1a1,_0x218aaf),0x3c*0x3e8);}};}function handleJob(_0x1b8ed5){return function(){try{if(_[_0x8421('0x33')](_0x1b8ed5[_0x8421('0x1a')])){return logger[_0x8421('0xb')](_0x8421('0x34'));}if(_['isNil'](_0x1b8ed5['subtractUnit'])){return logger['info'](_0x8421('0x35'));}var _0x56f7a1={'startDate':moment()[_0x8421('0x36')](_0x1b8ed5[_0x8421('0x1a')],_0x1b8ed5[_0x8421('0x1b')])[_0x8421('0x14')](_0x8421('0x37')),'endDate':moment()[_0x8421('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x8421('0x38'),'output':_0x1b8ed5[_0x8421('0x39')],'name':_0x1b8ed5[_0x8421('0x16')]};if(!_[_0x8421('0x33')](_0x1b8ed5[_0x8421('0x3a')])){logger[_0x8421('0xb')](_0x8421('0x3b'),_0x1b8ed5[_0x8421('0x3a')]);return analyticDefaultReportController[_0x8421('0x3c')]({'id':_0x1b8ed5[_0x8421('0x3a')]},_0x56f7a1)[_0x8421('0x2c')](handleResult(_0x1b8ed5))['catch'](handleError());}if(!_[_0x8421('0x33')](_0x1b8ed5['CustomReportId'])){logger[_0x8421('0xb')](_0x8421('0x3d'),_0x1b8ed5['CustomReportId']);return analyticCustomReportController[_0x8421('0x3c')]({'id':_0x1b8ed5[_0x8421('0x3e')]},_0x56f7a1)[_0x8421('0x2c')](handleResult(_0x1b8ed5))['catch'](handleError());}}catch(_0x19d42b){logger[_0x8421('0x2d')](JSON[_0x8421('0x31')](_0x19d42b));}return logger[_0x8421('0xb')]('no\x20report\x20id');};}function getJobs(_0x1eb7fd){var _0x2b5be1={};if(_0x1eb7fd){_0x2b5be1['id']=_0x1eb7fd;}return db['Schedule'][_0x8421('0x3f')]({'where':_0x2b5be1,'include':[{'model':db['MailAccount'],'attributes':['id',_0x8421('0x16'),_0x8421('0x17')],'include':[{'model':db[_0x8421('0x40')],'as':_0x8421('0xd')}]}]})[_0x8421('0x2c')](function(_0x3ae339){var _0x383e45=_[_0x8421('0x41')](manager[_0x8421('0x42')]);var _0x1b6716=_[_0x8421('0x43')](_0x3ae339,function(_0x314410){return _0x314410['id']['toString']();});var _0x3277d9=_[_0x8421('0x44')](_0x3ae339,function(_0x4e4c17){return _0x4e4c17['id'][_0x8421('0x45')]();});var _0xc1e57=_0x1eb7fd?_0x1b6716:_[_0x8421('0x46')](_0x1b6716,_0x383e45);var _0x20eec3=_[_0x8421('0x47')](_0x1b6716,_0x383e45);var _0x4aa696=_[_0x8421('0x46')](_0x383e45,_0x1b6716);var _0x428e8c;var _0x54dd50;for(_0x428e8c=0x0;_0x428e8c<_0x4aa696[_0x8421('0x48')]&&!_0x1eb7fd;_0x428e8c+=0x1){_0x54dd50=_0x4aa696[_0x428e8c][_0x8421('0x45')]();if(manager[_0x8421('0x49')](_0x54dd50)){manager[_0x8421('0x4a')](_0x54dd50);manager[_0x8421('0x4b')](_0x54dd50);logger['info']('delete\x20cron',_0x54dd50);}}logger['info'](_0x8421('0x4c'),JSON[_0x8421('0x31')](_0xc1e57));for(_0x428e8c=0x0;_0x428e8c<_0xc1e57[_0x8421('0x48')];_0x428e8c+=0x1){_0x54dd50=_0xc1e57[_0x428e8c][_0x8421('0x45')]();logger[_0x8421('0xb')](_0x8421('0x4d'),_0x54dd50);if(_0x1eb7fd){logger[_0x8421('0xb')](_0x8421('0x4e'),_0x1eb7fd);logger[_0x8421('0xb')](JSON[_0x8421('0x31')](_0x3277d9[_0x54dd50]));BPromise[_0x8421('0x4f')]()['then'](handleJob(_0x3277d9[_0x54dd50]));logger[_0x8421('0xb')](_0x8421('0x50'),_0x3277d9[_0x54dd50][_0x8421('0x16')],_0x3277d9[_0x54dd50]['cron']);}else if(_0x3277d9[_0x54dd50][_0x8421('0x51')]&&_0x3277d9[_0x54dd50][_0x8421('0x52')]&&moment()[_0x8421('0x53')](_0x3277d9[_0x54dd50]['startAt'],_0x3277d9[_0x54dd50][_0x8421('0x54')])){manager['add'](_0x54dd50,_0x3277d9[_0x54dd50]['cron'],handleJob(_0x3277d9[_0x54dd50]));manager[_0x8421('0x55')](_0x54dd50);logger[_0x8421('0xb')](_0x8421('0x56'),_0x3277d9[_0x54dd50][_0x8421('0x16')],_0x3277d9[_0x54dd50][_0x8421('0x51')]);}else if(manager[_0x8421('0x49')](_0x54dd50)){manager[_0x8421('0x4a')](_0x54dd50);manager[_0x8421('0x4b')](_0x54dd50);logger[_0x8421('0xb')](_0x8421('0x57'),_0x3277d9[_0x54dd50][_0x8421('0x16')],_0x3277d9[_0x54dd50][_0x8421('0x51')]);}}for(_0x428e8c=0x0,_0x54dd50;_0x428e8c<_0x20eec3[_0x8421('0x48')]&&!_0x1eb7fd;_0x428e8c+=0x1){_0x54dd50=_0x20eec3[_0x428e8c][_0x8421('0x45')]();if(manager[_0x8421('0x49')](_0x54dd50)){if(_0x3277d9[_0x54dd50][_0x8421('0x51')]&&_0x3277d9[_0x54dd50][_0x8421('0x52')]&&moment()['isBetween'](_0x3277d9[_0x54dd50]['startAt'],_0x3277d9[_0x54dd50][_0x8421('0x54')])){manager[_0x8421('0x58')](_0x54dd50,_0x3277d9[_0x54dd50]['cron'],handleJob(_0x3277d9[_0x54dd50]));logger[_0x8421('0xb')](_0x8421('0x59'),_0x3277d9[_0x54dd50][_0x8421('0x16')],_0x3277d9[_0x54dd50][_0x8421('0x51')]);}else{manager[_0x8421('0x4a')](_0x54dd50);manager[_0x8421('0x4b')](_0x54dd50);logger[_0x8421('0xb')](_0x8421('0x57'),_0x3277d9[_0x54dd50][_0x8421('0x16')],_0x3277d9[_0x54dd50][_0x8421('0x51')]);}}}})[_0x8421('0x30')](function(_0x4954db){logger[_0x8421('0x2d')](JSON[_0x8421('0x31')](_0x4954db));});}exports[_0x8421('0x5a')]=function(_0x1d1977){return getJobs(_0x1d1977);};exports[_0x8421('0x55')]=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 56994db..f7a3e71 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 _0x3264=['TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','info','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','sentiment','sentimentAccountId','language','bucket','Sequelize','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','Positive','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','forEach','push','all','start','aws-sdk','request-promise','util','bluebird','transcribe','TranscribeService','getTranscriptionJob','Comprehend','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText'];(function(_0x952fa,_0x11d816){var _0x3f4301=function(_0x298668){while(--_0x298668){_0x952fa['push'](_0x952fa['shift']());}};_0x3f4301(++_0x11d816);}(_0x3264,0x7f));var _0x4326=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x3264[_0x543084];return _0x306a57;};var _=require('lodash');var AWS=require(_0x4326('0x0'));var rp=require(_0x4326('0x1'));var util=require(_0x4326('0x2'));var BPromise=require(_0x4326('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x4326('0x4'));function getTranscriptionJob(_0x510181,_0x5555ac,_0x27ff99,_0x34ce4f){return new Promise(function(_0xed0465,_0x3f8d4e){var _0x56bcce=new AWS[(_0x4326('0x5'))]({'accessKeyId':_0x5555ac,'secretAccessKey':_0x510181,'region':_0x27ff99});_0x56bcce[_0x4326('0x6')]({'TranscriptionJobName':_0x34ce4f},function(_0x22071c,_0x129365){if(_0x22071c){return _0x3f8d4e(_0x22071c);}else{return _0xed0465(_0x129365);}});});}function sentiment(_0x7a4796,_0x2b3f1e,_0x1609f,_0x5cde0b,_0x58bade){return new Promise(function(_0x51323a,_0x97d63e){var _0x9daa3f=new AWS[(_0x4326('0x7'))]({'accessKeyId':_0x2b3f1e,'secretAccessKey':_0x7a4796,'region':_0x1609f});_0x9daa3f['detectSentiment']({'Text':_0x5cde0b,'LanguageCode':_0x58bade['substring'](0x0,0x2)},function(_0x1bc3ff,_0x4d6d36){if(_0x1bc3ff){return _0x97d63e(_0x1bc3ff);}else{return _0x51323a(_0x4d6d36);}});});}function checkTranscribeJob(_0xd45b39,_0x2893f1,_0x3515af){var _0x4f8f3d;return new BPromise(function(_0x5f17ac,_0x1087d9){logger['info'](util['format'](_0x4326('0x8'),_0xd45b39['id'],_0xd45b39[_0x4326('0x9')]));return getTranscriptionJob(_0x3515af[_0x4326('0xa')],_0x3515af[_0x4326('0xb')],_0x2893f1['transcribeRegion'],_0xd45b39[_0x4326('0x9')])[_0x4326('0xc')](function(_0x33112f){logger['info'](util[_0x4326('0xd')](_0x4326('0xe'),_0xd45b39['id'],_0xd45b39[_0x4326('0x9')],_0x33112f[_0x4326('0xf')]['TranscriptionJobStatus']));if(!_0xd45b39[_0x4326('0x10')]){switch(_0x33112f['TranscriptionJob'][_0x4326('0x11')]){case _0x4326('0x12'):var _0x35f24b={'transcribeStatus':_0x33112f[_0x4326('0xf')][_0x4326('0x11')],'fileUri':_0x33112f['TranscriptionJob'][_0x4326('0x13')][_0x4326('0x14')]};logger['info'](util[_0x4326('0xd')](_0x4326('0x15'),_0xd45b39['id']));return rp({'uri':_0x33112f[_0x4326('0xf')]['Transcript'][_0x4326('0x14')],'json':!![]})[_0x4326('0xc')](function(_0xde8632){logger[_0x4326('0x16')](util[_0x4326('0xd')](_0x4326('0x17'),_0xd45b39['id']));if(_0xde8632&&_0xde8632[_0x4326('0x18')]&&_0xde8632[_0x4326('0x18')]['transcripts']&&_0xde8632[_0x4326('0x18')][_0x4326('0x19')]['length']){_0x35f24b[_0x4326('0x10')]='';for(var _0x3d5e8f=0x0;_0x3d5e8f<_0xde8632[_0x4326('0x18')][_0x4326('0x19')][_0x4326('0x1a')];_0x3d5e8f++){_0x35f24b['fileText']+=_0xde8632['results'][_0x4326('0x19')][_0x3d5e8f][_0x4326('0x1b')]+'';}}return _0xd45b39[_0x4326('0x1c')](_0x35f24b);})[_0x4326('0xc')](function(){logger['info'](util[_0x4326('0xd')](_0x4326('0x1d'),_0xd45b39['id']));if(!_0xd45b39[_0x4326('0x1e')]){throw new db['Sequelize'][(_0x4326('0x1f'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x2893f1[_0x4326('0x20')]||!_0x2893f1[_0x4326('0x21')]||!_0x2893f1['sentimentRegion']||!_0x2893f1[_0x4326('0x22')]||!_0x2893f1[_0x4326('0x23')]){throw new db[(_0x4326('0x24'))][(_0x4326('0x1f'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x35f24b['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x2893f1[_0x4326('0x21')]===_0x3515af['id']){return _0x3515af;}else{return db[_0x4326('0x25')][_0x4326('0x26')]({'where':{'id':_settings[_0x4326('0x21')]}});}})[_0x4326('0xc')](function(_0x2d0d14){if(!_0x2d0d14){throw new db[(_0x4326('0x24'))][(_0x4326('0x1f'))](_0x4326('0x27'));}if(!_0x2d0d14[_0x4326('0xa')]||!_0x2d0d14['data2']){throw new db[(_0x4326('0x24'))][(_0x4326('0x1f'))](_0x4326('0x28'));}_0x4f8f3d=_0x2d0d14;logger[_0x4326('0x16')](util['format'](_0x4326('0x29'),_0xd45b39['id']));return sentiment(_0x4f8f3d[_0x4326('0xa')],_0x4f8f3d[_0x4326('0xb')],_0x2893f1[_0x4326('0x2a')],_0x35f24b[_0x4326('0x10')],_0x2893f1[_0x4326('0x22')]);})['then'](function(_0x40c1a0){logger[_0x4326('0x16')](util[_0x4326('0xd')](_0x4326('0x2b'),_0xd45b39['id']));return _0xd45b39[_0x4326('0x1c')]({'sentiment':_0x40c1a0[_0x4326('0x2c')],'sPositive':_0x40c1a0[_0x4326('0x2d')]['Positive'],'sNegative':_0x40c1a0['SentimentScore'][_0x4326('0x2e')],'sMixed':_0x40c1a0['SentimentScore'][_0x4326('0x2f')],'sNeutral':_0x40c1a0[_0x4326('0x2d')][_0x4326('0x30')]});})[_0x4326('0xc')](function(){logger['info'](util['format'](_0x4326('0x1d'),_0xd45b39['id']));_0x5f17ac();});case _0x4326('0x31'):return _0xd45b39['update']({'transcribeStatus':_0x4326('0x31'),'failureReason':_0x33112f[_0x4326('0xf')][_0x4326('0x32')]})[_0x4326('0xc')](function(){logger[_0x4326('0x16')](util[_0x4326('0xd')](_0x4326('0x1d'),_0xd45b39['id']));_0x5f17ac();});default:logger[_0x4326('0x16')](util[_0x4326('0xd')](_0x4326('0x33'),_0xd45b39['id']));break;}}else{return BPromise['resolve']()['then'](function(){if(!_0xd45b39['tempSentiment']){throw new db[(_0x4326('0x24'))][(_0x4326('0x1f'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x2893f1[_0x4326('0x20')]||!_0x2893f1[_0x4326('0x21')]||!_0x2893f1[_0x4326('0x2a')]||!_0x2893f1[_0x4326('0x22')]||!_0x2893f1[_0x4326('0x23')]){throw new db['Sequelize'][(_0x4326('0x1f'))](_0x4326('0x34'));}if(!_0xd45b39[_0x4326('0x10')]){throw new Error(_0x4326('0x35'));}if(_0x2893f1[_0x4326('0x21')]===_0x3515af['id']){return _0x3515af;}else{return db[_0x4326('0x25')][_0x4326('0x26')]({'where':{'id':_settings[_0x4326('0x21')]}});}})[_0x4326('0xc')](function(_0x52d0d1){if(!_0x52d0d1){throw new db[(_0x4326('0x24'))][(_0x4326('0x1f'))](_0x4326('0x27'));}if(!_0x52d0d1['data1']||!_0x52d0d1[_0x4326('0xb')]){throw new db['Sequelize'][(_0x4326('0x1f'))](_0x4326('0x28'));}_0x4f8f3d=_0x52d0d1;logger[_0x4326('0x16')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0xd45b39['id']));return sentiment(_0x4f8f3d[_0x4326('0xa')],_0x4f8f3d[_0x4326('0xb')],_0x2893f1[_0x4326('0x2a')],_0xd45b39['fileText'],_0x2893f1[_0x4326('0x22')]);})[_0x4326('0xc')](function(_0x140651){logger[_0x4326('0x16')](util[_0x4326('0xd')](_0x4326('0x2b'),_0xd45b39['id']));return _0xd45b39[_0x4326('0x1c')]({'sentiment':_0x140651['Sentiment'],'sPositive':_0x140651[_0x4326('0x2d')][_0x4326('0x36')],'sNegative':_0x140651[_0x4326('0x2d')][_0x4326('0x2e')],'sMixed':_0x140651['SentimentScore']['Mixed'],'sNeutral':_0x140651[_0x4326('0x2d')][_0x4326('0x30')],'transcribeStatus':'COMPLETED'});})[_0x4326('0xc')](function(){logger[_0x4326('0x16')](util[_0x4326('0xd')](_0x4326('0x1d'),_0xd45b39['id']));_0x5f17ac();});}})[_0x4326('0x37')](function(_0x5d5983){if(_0x5d5983){if(!_0x5d5983['name']||_0x5d5983[_0x4326('0x38')]!==_0x4326('0x39')){logger[_0x4326('0x3a')](util[_0x4326('0xd')](_0x4326('0x3b'),_0xd45b39['id']),util[_0x4326('0x3c')](_0x5d5983,{'showHidden':![],'depth':null}));}}_0x5f17ac();});});}function checkTranscribe(){var _0x42cfac;var _0x491d3f;var _0x20796e;return db[_0x4326('0x3d')][_0x4326('0x3e')]({'where':{'transcribeStatus':_0x4326('0x3f')}})[_0x4326('0xc')](function(_0x487c7f){if(!_0x487c7f||!_0x487c7f['length']){throw new db[(_0x4326('0x24'))][(_0x4326('0x1f'))](_0x4326('0x40'));}_0x42cfac=_0x487c7f;return db['Setting'][_0x4326('0x26')]({'where':{'id':0x1}});})[_0x4326('0xc')](function(_0x264744){if(!_0x264744){throw new db[(_0x4326('0x24'))][(_0x4326('0x1f'))]('Settings\x20not\x20available');}_0x491d3f=_0x264744;if(!_0x491d3f[_0x4326('0x4')]||!_0x491d3f[_0x4326('0x41')]||!_0x491d3f[_0x4326('0x42')]||!_0x491d3f[_0x4326('0x22')]||!_0x491d3f['bucket']){throw new db['Sequelize'][(_0x4326('0x1f'))](_0x4326('0x43'));}return db['CloudProvider'][_0x4326('0x26')]({'where':{'id':_0x491d3f[_0x4326('0x41')]}});})['then'](function(_0x234f18){if(!_0x234f18){throw new db[(_0x4326('0x24'))][(_0x4326('0x1f'))](_0x4326('0x27'));}if(!_0x234f18['data1']||!_0x234f18[_0x4326('0xb')]){throw new db['Sequelize'][(_0x4326('0x1f'))](_0x4326('0x28'));}_0x20796e=_0x234f18;var _0x48c7ce=[];_0x42cfac[_0x4326('0x44')](function(_0x59a0be){_0x48c7ce[_0x4326('0x45')](checkTranscribeJob(_0x59a0be,_0x491d3f,_0x20796e));});return BPromise[_0x4326('0x46')](_0x48c7ce);})['catch'](function(_0x10c890){if(_0x10c890){if(!_0x10c890['name']||_0x10c890[_0x4326('0x38')]!==_0x4326('0x39')){logger[_0x4326('0x3a')](util[_0x4326('0x3c')](_0x10c890,{'showHidden':![],'depth':null}));}}});}exports[_0x4326('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x7633=['transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','sentiment','sentimentAccountId','sentimentRegion','bucket','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','language','Cloud\x20Provider\x20not\x20configured','Neutral','catch','SequelizeValidationError','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','name','inspect','lodash','aws-sdk','request-promise','util','bluebird','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length'];(function(_0x590851,_0x496bee){var _0x3b0115=function(_0x5140cc){while(--_0x5140cc){_0x590851['push'](_0x590851['shift']());}};_0x3b0115(++_0x496bee);}(_0x7633,0x1c4));var _0x3763=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x7633[_0x1035c1];return _0x308d67;};var _=require(_0x3763('0x0'));var AWS=require(_0x3763('0x1'));var rp=require(_0x3763('0x2'));var util=require(_0x3763('0x3'));var BPromise=require(_0x3763('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x3763('0x5'))(_0x3763('0x6'));function getTranscriptionJob(_0x56a283,_0x5f4eb8,_0xa0f328,_0x5bfba6){return new Promise(function(_0x50585d,_0x396634){var _0x8a2d3e=new AWS[(_0x3763('0x7'))]({'accessKeyId':_0x5f4eb8,'secretAccessKey':_0x56a283,'region':_0xa0f328});_0x8a2d3e[_0x3763('0x8')]({'TranscriptionJobName':_0x5bfba6},function(_0x50b634,_0x550b39){if(_0x50b634){return _0x396634(_0x50b634);}else{return _0x50585d(_0x550b39);}});});}function sentiment(_0x232c86,_0x277d34,_0x4aa292,_0x5c872d,_0x44dc63){return new Promise(function(_0x1a83bb,_0x401909){var _0x29ec1c=new AWS[(_0x3763('0x9'))]({'accessKeyId':_0x277d34,'secretAccessKey':_0x232c86,'region':_0x4aa292});_0x29ec1c[_0x3763('0xa')]({'Text':_0x5c872d,'LanguageCode':_0x44dc63[_0x3763('0xb')](0x0,0x2)},function(_0x4b3226,_0x2cf053){if(_0x4b3226){return _0x401909(_0x4b3226);}else{return _0x1a83bb(_0x2cf053);}});});}function checkTranscribeJob(_0xa9aff3,_0x11d390,_0x52728b){var _0x59980c;return new BPromise(function(_0x10602e,_0x58e8c9){logger[_0x3763('0xc')](util[_0x3763('0xd')](_0x3763('0xe'),_0xa9aff3['id'],_0xa9aff3[_0x3763('0xf')]));return getTranscriptionJob(_0x52728b[_0x3763('0x10')],_0x52728b[_0x3763('0x11')],_0x11d390[_0x3763('0x12')],_0xa9aff3['transcribeName'])[_0x3763('0x13')](function(_0x368434){logger[_0x3763('0xc')](util['format']('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0xa9aff3['id'],_0xa9aff3['transcribeName'],_0x368434[_0x3763('0x14')][_0x3763('0x15')]));if(!_0xa9aff3[_0x3763('0x16')]){switch(_0x368434[_0x3763('0x14')][_0x3763('0x15')]){case _0x3763('0x17'):var _0x461924={'transcribeStatus':_0x368434['TranscriptionJob'][_0x3763('0x15')],'fileUri':_0x368434[_0x3763('0x14')][_0x3763('0x18')][_0x3763('0x19')]};logger['info'](util['format'](_0x3763('0x1a'),_0xa9aff3['id']));return rp({'uri':_0x368434[_0x3763('0x14')][_0x3763('0x18')][_0x3763('0x19')],'json':!![]})['then'](function(_0x36ff74){logger['info'](util[_0x3763('0xd')](_0x3763('0x1b'),_0xa9aff3['id']));if(_0x36ff74&&_0x36ff74['results']&&_0x36ff74[_0x3763('0x1c')][_0x3763('0x1d')]&&_0x36ff74[_0x3763('0x1c')][_0x3763('0x1d')][_0x3763('0x1e')]){_0x461924[_0x3763('0x16')]='';for(var _0x6ebb90=0x0;_0x6ebb90<_0x36ff74['results']['transcripts']['length'];_0x6ebb90++){_0x461924[_0x3763('0x16')]+=_0x36ff74[_0x3763('0x1c')][_0x3763('0x1d')][_0x6ebb90][_0x3763('0x1f')]+'';}}return _0xa9aff3[_0x3763('0x20')](_0x461924);})[_0x3763('0x13')](function(){logger[_0x3763('0xc')](util[_0x3763('0xd')](_0x3763('0x21'),_0xa9aff3['id']));if(!_0xa9aff3[_0x3763('0x22')]){throw new db[(_0x3763('0x23'))][(_0x3763('0x24'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x11d390[_0x3763('0x25')]||!_0x11d390[_0x3763('0x26')]||!_0x11d390[_0x3763('0x27')]||!_0x11d390['language']||!_0x11d390[_0x3763('0x28')]){throw new db[(_0x3763('0x23'))][(_0x3763('0x24'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x461924[_0x3763('0x16')]){throw new Error(_0x3763('0x29'));}if(_0x11d390[_0x3763('0x26')]===_0x52728b['id']){return _0x52728b;}else{return db[_0x3763('0x2a')][_0x3763('0x2b')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x325b59){if(!_0x325b59){throw new db[(_0x3763('0x23'))][(_0x3763('0x24'))](_0x3763('0x2c'));}if(!_0x325b59[_0x3763('0x10')]||!_0x325b59[_0x3763('0x11')]){throw new db[(_0x3763('0x23'))][(_0x3763('0x24'))]('Cloud\x20Provider\x20not\x20configured');}_0x59980c=_0x325b59;logger[_0x3763('0xc')](util[_0x3763('0xd')](_0x3763('0x2d'),_0xa9aff3['id']));return sentiment(_0x59980c[_0x3763('0x10')],_0x59980c['data2'],_0x11d390['sentimentRegion'],_0x461924['fileText'],_0x11d390['language']);})[_0x3763('0x13')](function(_0x464ef8){logger['info'](util[_0x3763('0xd')](_0x3763('0x2e'),_0xa9aff3['id']));return _0xa9aff3['update']({'sentiment':_0x464ef8[_0x3763('0x2f')],'sPositive':_0x464ef8[_0x3763('0x30')][_0x3763('0x31')],'sNegative':_0x464ef8[_0x3763('0x30')][_0x3763('0x32')],'sMixed':_0x464ef8[_0x3763('0x30')][_0x3763('0x33')],'sNeutral':_0x464ef8[_0x3763('0x30')]['Neutral']});})[_0x3763('0x13')](function(){logger[_0x3763('0xc')](util['format'](_0x3763('0x21'),_0xa9aff3['id']));_0x10602e();});case _0x3763('0x34'):return _0xa9aff3[_0x3763('0x20')]({'transcribeStatus':'FAILED','failureReason':_0x368434[_0x3763('0x14')]['FailureReason']})[_0x3763('0x13')](function(){logger['info'](util[_0x3763('0xd')](_0x3763('0x21'),_0xa9aff3['id']));_0x10602e();});default:logger['info'](util[_0x3763('0xd')](_0x3763('0x35'),_0xa9aff3['id']));break;}}else{return BPromise[_0x3763('0x36')]()[_0x3763('0x13')](function(){if(!_0xa9aff3['tempSentiment']){throw new db[(_0x3763('0x23'))][(_0x3763('0x24'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x11d390[_0x3763('0x25')]||!_0x11d390[_0x3763('0x26')]||!_0x11d390['sentimentRegion']||!_0x11d390[_0x3763('0x37')]||!_0x11d390[_0x3763('0x28')]){throw new db[(_0x3763('0x23'))][(_0x3763('0x24'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0xa9aff3[_0x3763('0x16')]){throw new Error(_0x3763('0x29'));}if(_0x11d390[_0x3763('0x26')]===_0x52728b['id']){return _0x52728b;}else{return db[_0x3763('0x2a')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x58439b){if(!_0x58439b){throw new db['Sequelize'][(_0x3763('0x24'))](_0x3763('0x2c'));}if(!_0x58439b[_0x3763('0x10')]||!_0x58439b['data2']){throw new db[(_0x3763('0x23'))][(_0x3763('0x24'))](_0x3763('0x38'));}_0x59980c=_0x58439b;logger[_0x3763('0xc')](util[_0x3763('0xd')](_0x3763('0x2d'),_0xa9aff3['id']));return sentiment(_0x59980c[_0x3763('0x10')],_0x59980c[_0x3763('0x11')],_0x11d390[_0x3763('0x27')],_0xa9aff3[_0x3763('0x16')],_0x11d390[_0x3763('0x37')]);})['then'](function(_0x587f83){logger['info'](util[_0x3763('0xd')](_0x3763('0x2e'),_0xa9aff3['id']));return _0xa9aff3[_0x3763('0x20')]({'sentiment':_0x587f83[_0x3763('0x2f')],'sPositive':_0x587f83['SentimentScore'][_0x3763('0x31')],'sNegative':_0x587f83['SentimentScore'][_0x3763('0x32')],'sMixed':_0x587f83[_0x3763('0x30')][_0x3763('0x33')],'sNeutral':_0x587f83[_0x3763('0x30')][_0x3763('0x39')],'transcribeStatus':_0x3763('0x17')});})[_0x3763('0x13')](function(){logger['info'](util[_0x3763('0xd')](_0x3763('0x21'),_0xa9aff3['id']));_0x10602e();});}})[_0x3763('0x3a')](function(_0x426b7c){if(_0x426b7c){if(!_0x426b7c['name']||_0x426b7c['name']!==_0x3763('0x3b')){logger['error'](util[_0x3763('0xd')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0xa9aff3['id']),util['inspect'](_0x426b7c,{'showHidden':![],'depth':null}));}}_0x10602e();});});}function checkTranscribe(){var _0x32b0a3;var _0x3b1fea;var _0x1be9fb;return db[_0x3763('0x3c')][_0x3763('0x3d')]({'where':{'transcribeStatus':_0x3763('0x3e')}})[_0x3763('0x13')](function(_0x49dcad){if(!_0x49dcad||!_0x49dcad[_0x3763('0x1e')]){throw new db[(_0x3763('0x23'))][(_0x3763('0x24'))](_0x3763('0x3f'));}_0x32b0a3=_0x49dcad;return db[_0x3763('0x40')]['findOne']({'where':{'id':0x1}});})[_0x3763('0x13')](function(_0x197a9d){if(!_0x197a9d){throw new db[(_0x3763('0x23'))]['ValidationError'](_0x3763('0x41'));}_0x3b1fea=_0x197a9d;if(!_0x3b1fea[_0x3763('0x6')]||!_0x3b1fea['transcribeAccountId']||!_0x3b1fea[_0x3763('0x12')]||!_0x3b1fea['language']||!_0x3b1fea[_0x3763('0x28')]){throw new db[(_0x3763('0x23'))]['ValidationError']('Transcribe\x20not\x20configured');}return db['CloudProvider'][_0x3763('0x2b')]({'where':{'id':_0x3b1fea[_0x3763('0x42')]}});})[_0x3763('0x13')](function(_0x281547){if(!_0x281547){throw new db[(_0x3763('0x23'))][(_0x3763('0x24'))](_0x3763('0x2c'));}if(!_0x281547[_0x3763('0x10')]||!_0x281547['data2']){throw new db[(_0x3763('0x23'))]['ValidationError'](_0x3763('0x38'));}_0x1be9fb=_0x281547;var _0x21975b=[];_0x32b0a3['forEach'](function(_0x20c5ef){_0x21975b['push'](checkTranscribeJob(_0x20c5ef,_0x3b1fea,_0x1be9fb));});return BPromise['all'](_0x21975b);})[_0x3763('0x3a')](function(_0x1bd1f4){if(_0x1bd1f4){if(!_0x1bd1f4[_0x3763('0x43')]||_0x1bd1f4['name']!==_0x3763('0x3b')){logger['error'](util[_0x3763('0x44')](_0x1bd1f4,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 07eee31..1ed8fb2 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 _0xc7ca=['timeout','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','util','../../config/environment','../../mysqldb','../logger','redis','defaults','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','hours','then','length','map','info','join','update','system'];(function(_0x9fe99b,_0x4e2c9c){var _0x42084e=function(_0x345f19){while(--_0x345f19){_0x9fe99b['push'](_0x9fe99b['shift']());}};_0x42084e(++_0x4e2c9c);}(_0xc7ca,0x1c8));var _0xac7c=function(_0x832eb0,_0x5e1d5a){_0x832eb0=_0x832eb0-0x0;var _0x5a2499=_0xc7ca[_0x832eb0];return _0x5a2499;};'use strict';var _=require(_0xac7c('0x0'));var moment=require(_0xac7c('0x1'));var Redis=require('ioredis');var util=require(_0xac7c('0x2'));var config=require(_0xac7c('0x3'));var db=require(_0xac7c('0x4'))['db'];var logger=require(_0xac7c('0x5'))('schedule');config[_0xac7c('0x6')]=_[_0xac7c('0x7')](config[_0xac7c('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xac7c('0x8'))(new Redis(config[_0xac7c('0x6')]));function closeInteractions(){var _0x2d989e=[];return db[_0xac7c('0x9')][_0xac7c('0xa')]({'raw':!![],'attributes':['id',_0xac7c('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xac7c('0xc'))}}})[_0xac7c('0xd')](function(_0x1fc676){if(_0x1fc676&&_0x1fc676[_0xac7c('0xe')]){_0x2d989e=_[_0xac7c('0xf')](_0x1fc676||[],'id');logger[_0xac7c('0x10')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x2d989e[_0xac7c('0x11')]());return db['WhatsappInteraction'][_0xac7c('0x12')]({'closeReason':_0xac7c('0x13'),'disposition':_0xac7c('0x14'),'closed':!![],'closedAt':moment()['format'](_0xac7c('0x15'))},{'where':{'id':_0x2d989e}});}})[_0xac7c('0xd')](function(){if(_0x2d989e&&_0x2d989e[_0xac7c('0xe')]){logger[_0xac7c('0x10')](_0xac7c('0x16'),_0x2d989e[_0xac7c('0x11')]());for(var _0x62342a=0x0;_0x62342a<_0x2d989e[_0xac7c('0xe')];_0x62342a++){io[_0xac7c('0x17')](_0xac7c('0x18'),{'id':_0x2d989e[_0x62342a],'closed':!![]});}}})['catch'](function(_0x13e74c){logger[_0xac7c('0x19')](_0xac7c('0x1a'),_0x13e74c?util[_0xac7c('0x1b')](_0x13e74c,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x5302=['socket.io-emitter','findAll','lastMsgAt','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','ioredis','util','../logger','redis','localhost'];(function(_0x203574,_0x2261d3){var _0x5e9de5=function(_0x7840f6){while(--_0x7840f6){_0x203574['push'](_0x203574['shift']());}};_0x5e9de5(++_0x2261d3);}(_0x5302,0x1b5));var _0x2530=function(_0x3f5522,_0x28e324){_0x3f5522=_0x3f5522-0x0;var _0x4731f1=_0x5302[_0x3f5522];return _0x4731f1;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0x2530('0x0'));var util=require(_0x2530('0x1'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0x2530('0x2'))('schedule');config[_0x2530('0x3')]=_['defaults'](config[_0x2530('0x3')],{'host':_0x2530('0x4'),'port':0x18eb});var io=require(_0x2530('0x5'))(new Redis(config[_0x2530('0x3')]));function closeInteractions(){var _0x9f762=[];return db['WhatsappInteraction'][_0x2530('0x6')]({'raw':!![],'attributes':['id',_0x2530('0x7')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x2530('0x8')](0x18,_0x2530('0x9'))}}})[_0x2530('0xa')](function(_0x166848){if(_0x166848&&_0x166848[_0x2530('0xb')]){_0x9f762=_[_0x2530('0xc')](_0x166848||[],'id');logger[_0x2530('0xd')](_0x2530('0xe'),_0x9f762[_0x2530('0xf')]());return db[_0x2530('0x10')][_0x2530('0x11')]({'closeReason':_0x2530('0x12'),'disposition':_0x2530('0x13'),'closed':!![],'closedAt':moment()[_0x2530('0x14')](_0x2530('0x15'))},{'where':{'id':_0x9f762}});}})['then'](function(){if(_0x9f762&&_0x9f762[_0x2530('0xb')]){logger[_0x2530('0xd')](_0x2530('0x16'),_0x9f762[_0x2530('0xf')]());for(var _0x31a4b9=0x0;_0x31a4b9<_0x9f762[_0x2530('0xb')];_0x31a4b9++){io[_0x2530('0x17')]('whatsappInteraction:update',{'id':_0x9f762[_0x31a4b9],'closed':!![]});}}})['catch'](function(_0x5cd66b){logger['error'](_0x2530('0x18'),_0x5cd66b?util[_0x2530('0x19')](_0x5cd66b,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 9a21c2c..9bf5082 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8bd3=['../mysqldb','innocenzo.biondo','@xcally.com','push','now','Biondo','destroy','CmContact','then','log','finished\x20populating','contacts1','CmHopper','hopper1','bulkCreate','contacts2','catch','util'];(function(_0x165ffe,_0x3b54c5){var _0x514c6a=function(_0x3d82ac){while(--_0x3d82ac){_0x165ffe['push'](_0x165ffe['shift']());}};_0x514c6a(++_0x3b54c5);}(_0x8bd3,0x1e5));var _0x38bd=function(_0x19635f,_0x564859){_0x19635f=_0x19635f-0x0;var _0x482132=_0x8bd3[_0x19635f];return _0x482132;};'use strict';var util=require(_0x38bd('0x0'));var db=require(_0x38bd('0x1'))['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':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x38bd('0x2')+i+_0x38bd('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x38bd('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x38bd('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x38bd('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x38bd('0x4')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x38bd('0x6')+i,'phone':0xf879fb460+i,'email':_0x38bd('0x2')+i+_0x38bd('0x3')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x38bd('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x38bd('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x38bd('0x5')]()});}db['CmContact'][_0x38bd('0x7')]({'where':{}})['then'](function(){return db[_0x38bd('0x8')]['bulkCreate'](contacts);})[_0x38bd('0x9')](function(){console[_0x38bd('0xa')](_0x38bd('0xb'),_0x38bd('0xc'));return db[_0x38bd('0xd')][_0x38bd('0x7')]({'where':{}});})[_0x38bd('0x9')](function(){return db['CmHopper']['bulkCreate'](hopper);})[_0x38bd('0x9')](function(){console[_0x38bd('0xa')](_0x38bd('0xb'),_0x38bd('0xe'));return db[_0x38bd('0x8')][_0x38bd('0xf')](contacts2);})[_0x38bd('0x9')](function(){console[_0x38bd('0xa')]('finished\x20populating',_0x38bd('0x10'));return db[_0x38bd('0xd')][_0x38bd('0xf')](hopper2);})[_0x38bd('0x9')](function(){console[_0x38bd('0xa')](_0x38bd('0xb'),'hopper2');})[_0x38bd('0x11')](function(_0x145a0a){console[_0x38bd('0xa')](_0x145a0a);}); \ No newline at end of file +var _0x20fc=['CmContact','bulkCreate','log','finished\x20populating','CmHopper','hopper1','contacts2','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','destroy','then'];(function(_0x391f9c,_0x24aec0){var _0x569150=function(_0x4ee19c){while(--_0x4ee19c){_0x391f9c['push'](_0x391f9c['shift']());}};_0x569150(++_0x24aec0);}(_0x20fc,0xed));var _0xc20f=function(_0x214266,_0x1f6f52){_0x214266=_0x214266-0x0;var _0x568f75=_0x20fc[_0x214266];return _0x568f75;};'use strict';var util=require(_0xc20f('0x0'));var db=require(_0xc20f('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xc20f('0x2')]({'id':i,'firstName':_0xc20f('0x3')+i,'lastName':_0xc20f('0x4')+i,'phone':0xf879fb460+i,'email':_0xc20f('0x5')+i+_0xc20f('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xc20f('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xc20f('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xc20f('0x7')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xc20f('0x2')]({'id':i,'firstName':_0xc20f('0x3')+i,'lastName':_0xc20f('0x4')+i,'phone':0xf879fb460+i,'email':_0xc20f('0x5')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xc20f('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xc20f('0x7')]()});}db['CmContact'][_0xc20f('0x8')]({'where':{}})[_0xc20f('0x9')](function(){return db[_0xc20f('0xa')][_0xc20f('0xb')](contacts);})[_0xc20f('0x9')](function(){console[_0xc20f('0xc')](_0xc20f('0xd'),'contacts1');return db[_0xc20f('0xe')][_0xc20f('0x8')]({'where':{}});})[_0xc20f('0x9')](function(){return db[_0xc20f('0xe')]['bulkCreate'](hopper);})[_0xc20f('0x9')](function(){console['log'](_0xc20f('0xd'),_0xc20f('0xf'));return db['CmContact']['bulkCreate'](contacts2);})[_0xc20f('0x9')](function(){console[_0xc20f('0xc')](_0xc20f('0xd'),_0xc20f('0x10'));return db['CmHopper'][_0xc20f('0xb')](hopper2);})[_0xc20f('0x9')](function(){console[_0xc20f('0xc')](_0xc20f('0xd'),_0xc20f('0x11'));})[_0xc20f('0x12')](function(_0x3d2ccf){console[_0xc20f('0xc')](_0x3d2ccf);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index b2025d4..4455136 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1f47=['User','bulkCreate','then','log','util','../mysqldb','push','format','%s%s','agent','password','friend','udp','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0x1f47,0x19c));var _0x71f4=function(_0x4a492c,_0x34f3da){_0x4a492c=_0x4a492c-0x0;var _0x2311c3=_0x1f47[_0x4a492c];return _0x2311c3;};'use strict';var util=require(_0x71f4('0x0'));var db=require(_0x71f4('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x71f4('0x2')]({'name':util[_0x71f4('0x3')](_0x71f4('0x4'),_0x71f4('0x5'),i),'fullname':util[_0x71f4('0x3')](_0x71f4('0x4'),_0x71f4('0x5'),i),'email':util['format']('%s%s@xcally.com',_0x71f4('0x5'),i),'role':'agent','password':_0x71f4('0x6'),'internal':0xfa0+i,'type':_0x71f4('0x7'),'transport':[_0x71f4('0x8'),'ws','wss'],'disallow':['all'],'allow':['ulaw'],'defaultuser':util[_0x71f4('0x3')](_0x71f4('0x4'),_0x71f4('0x5'),i),'encryption':_0x71f4('0x9'),'avpf':_0x71f4('0x9'),'force_avp':_0x71f4('0x9'),'icesupport':_0x71f4('0x9'),'dtlsenable':_0x71f4('0x9'),'dtlsverify':'no','dtlscertfile':_0x71f4('0xa'),'dtlsprivatekey':_0x71f4('0xb'),'dtlssetup':_0x71f4('0xc'),'callerid':util[_0x71f4('0x3')]('\x22%s\x22\x20<%s>',util[_0x71f4('0x3')](_0x71f4('0x4'),_0x71f4('0x5'),i),0xfa0+i)});}db[_0x71f4('0xd')][_0x71f4('0xe')](users)[_0x71f4('0xf')](function(){console[_0x71f4('0x10')]('add\x20user');})['catch'](function(_0x3d05a1){console[_0x71f4('0x10')](_0x3d05a1);}); \ No newline at end of file +var _0xa2f6=['agent','%s%s@xcally.com','password','udp','wss','all','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','format','%s%s'];(function(_0x103bae,_0xf11712){var _0x56cc11=function(_0x43bd8d){while(--_0x43bd8d){_0x103bae['push'](_0x103bae['shift']());}};_0x56cc11(++_0xf11712);}(_0xa2f6,0x1df));var _0x6a2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa2f6[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x6a2f('0x0'));var db=require(_0x6a2f('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x6a2f('0x2')](_0x6a2f('0x3'),_0x6a2f('0x4'),i),'fullname':util[_0x6a2f('0x2')](_0x6a2f('0x3'),_0x6a2f('0x4'),i),'email':util[_0x6a2f('0x2')](_0x6a2f('0x5'),_0x6a2f('0x4'),i),'role':_0x6a2f('0x4'),'password':_0x6a2f('0x6'),'internal':0xfa0+i,'type':'friend','transport':[_0x6a2f('0x7'),'ws',_0x6a2f('0x8')],'disallow':[_0x6a2f('0x9')],'allow':['ulaw'],'defaultuser':util['format']('%s%s',_0x6a2f('0x4'),i),'encryption':_0x6a2f('0xa'),'avpf':_0x6a2f('0xa'),'force_avp':_0x6a2f('0xa'),'icesupport':_0x6a2f('0xa'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x6a2f('0xb'),'dtlsprivatekey':_0x6a2f('0xc'),'dtlssetup':_0x6a2f('0xd'),'callerid':util[_0x6a2f('0x2')](_0x6a2f('0xe'),util[_0x6a2f('0x2')](_0x6a2f('0x3'),_0x6a2f('0x4'),i),0xfa0+i)});}db[_0x6a2f('0xf')][_0x6a2f('0x10')](users)[_0x6a2f('0x11')](function(){console[_0x6a2f('0x12')](_0x6a2f('0x13'));})[_0x6a2f('0x14')](function(_0x31bf71){console[_0x6a2f('0x12')](_0x31bf71);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index b126eeb..7d1362d 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x794b=['push','FaxQueue','SmsQueue','MailQueue','WhatsappQueue','user','OpenchannelQueue','Trunk','IvrCampaigns','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','all','voice','chat','fax','sms','mail','telephone:%s','campaign:%s:%s','ChatInteractions','removeChatInteractions','emit','leave','removeMailInteractions','FaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','setMaxListeners','address','request','connection','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','nsp','disconnect','CONNECTED','lodash','util','../mysqldb','./environment','User','name','telephone','agent','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','UserProfileResource','resourceId','map','where','role','Campaign','type','format','Agents','length','user:%s','handshake','query','userProfileId','ChatInteraction','MailInteraction','MailInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteractions','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','ChatQueue'];(function(_0x18bd2a,_0x3f93f0){var _0x546f18=function(_0xfab88f){while(--_0xfab88f){_0x18bd2a['push'](_0x18bd2a['shift']());}};_0x546f18(++_0x3f93f0);}(_0x794b,0x1c2));var _0xb794=function(_0x43190d,_0x375400){_0x43190d=_0x43190d-0x0;var _0x109c98=_0x794b[_0x43190d];return _0x109c98;};'use strict';var _=require(_0xb794('0x0'));var util=require(_0xb794('0x1'));var BPromise=require('bluebird');var db=require(_0xb794('0x2'))['db'];var config=require(_0xb794('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':'Agents','model':db[_0xb794('0x4')],'attributes':['id',_0xb794('0x5'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xb794('0x5')],'where':{'role':_0xb794('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0xb794('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0xb794('0x5')],'where':{'role':_0xb794('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xb794('0x5'),'type'],'where':{'type':_0xb794('0x8')}};function getAssociatedResources(_0xa67b25,_0x6c1ec7,_0xc3dde7){return db[_0xb794('0x9')][_0xb794('0xa')]({'where':{'name':_0xa67b25,'userProfileId':_0x6c1ec7},'raw':!![]})[_0xb794('0xb')](function(_0x1f224a){if(_0x1f224a){if(_0x1f224a[_0xb794('0xc')]){switch(_0xa67b25){case _0xb794('0xd'):case _0xb794('0xe'):case _0xb794('0xf'):case _0xb794('0x10'):case _0xb794('0x11'):case _0xb794('0x12'):case _0xb794('0x13'):return db[_0xc3dde7][_0xb794('0x14')](queryQueues);case _0xb794('0x15'):return db[_0xc3dde7][_0xb794('0x14')](queryTelephones);case _0xb794('0x16'):return db[_0xc3dde7][_0xb794('0x14')](queryTrunks);case'IvrCampaigns':return db[_0xc3dde7][_0xb794('0x14')](queryCampaigns);}}else{return db[_0xb794('0x17')][_0xb794('0x14')]({'attributes':[_0xb794('0x18')],'where':{'sectionId':_0x1f224a['id']},'raw':!![]})[_0xb794('0xb')](function(_0x469618){if(_0x469618){var _0x558bc1={'where':{'id':_[_0xb794('0x19')](_0x469618,_0xb794('0x18'))},'raw':!![]};switch(_0xc3dde7){case'User':_0x558bc1[_0xb794('0x1a')][_0xb794('0x1b')]='telephone';break;case _0xb794('0x1c'):_0x558bc1[_0xb794('0x1a')][_0xb794('0x1d')]='ivr';break;}return db[_0xc3dde7][_0xb794('0x14')](_0x558bc1);}else{return[];}});}}else{return[];}})[_0xb794('0xb')](function(_0x5494e7){return _0x5494e7;});}function joinOrLeaveQueues(_0x10d905,_0x22d126,_0x3d9fc4,_0x324903){_0x10d905[_0x22d126](util[_0xb794('0x1e')]('%s:queue:%s',_0x3d9fc4,_0x324903[_0xb794('0x5')]));if(_0x324903[_0xb794('0x1f')]){for(var _0x4c2156=0x0;_0x4c2156<_0x324903[_0xb794('0x1f')][_0xb794('0x20')];_0x4c2156+=0x1){_0x10d905[_0x22d126](util[_0xb794('0x1e')](_0xb794('0x21'),_0x324903[_0xb794('0x1f')][_0x4c2156][_0xb794('0x5')]));}}}function joinOrLeave(_0x375b41,_0x45ddac,_0x425a47){var _0x43e077;if(_0x375b41[_0xb794('0x22')][_0xb794('0x23')]['id']){db[_0xb794('0x4')]['find']({'attributes':['id',_0xb794('0x5'),_0xb794('0x1b'),_0xb794('0x24')],'where':{'id':_0x375b41['handshake']['query']['id']},'include':[{'model':db[_0xb794('0x25')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb794('0x26')],'as':_0xb794('0x27'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb794('0x28')],'as':_0xb794('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xb794('0x2a')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0xb794('0x2b'),'attributes':['id'],'raw':!![]}]})[_0xb794('0xb')](function(_0x45d4d0){if(_0x45d4d0){_0x43e077=_0x45d4d0;_0x375b41[_0x45ddac](util[_0xb794('0x1e')](_0xb794('0x21'),_0x45d4d0[_0xb794('0x5')]));var _0x479476=[];switch(_0x45d4d0['role']){case'admin':_0x375b41[_0x45ddac](_0xb794('0x2c'));_0x375b41[_0x45ddac](_0xb794('0x2d'));if(queryQueues[_0xb794('0x2e')]('include')){delete queryQueues[_0xb794('0x2f')];}_0x479476['push'](db[_0xb794('0x30')][_0xb794('0x14')](queryQueues));_0x479476['push'](db[_0xb794('0x31')]['findAll'](queryQueues));_0x479476[_0xb794('0x32')](db[_0xb794('0x33')]['findAll'](queryQueues));_0x479476[_0xb794('0x32')](db[_0xb794('0x34')][_0xb794('0x14')](queryQueues));_0x479476[_0xb794('0x32')](db[_0xb794('0x35')][_0xb794('0x14')](queryQueues));_0x479476[_0xb794('0x32')](db['OpenchannelQueue'][_0xb794('0x14')](queryQueues));_0x479476['push'](db[_0xb794('0x36')]['findAll'](queryQueues));_0x479476[_0xb794('0x32')](db[_0xb794('0x4')][_0xb794('0x14')](queryTelephones));_0x479476['push'](db['Trunk'][_0xb794('0x14')](queryTrunks));_0x479476[_0xb794('0x32')](db[_0xb794('0x1c')]['findAll'](queryCampaigns));_0x479476[_0xb794('0x32')](db[_0xb794('0x4')][_0xb794('0x14')](queryAgents));break;case _0xb794('0x37'):_0x375b41[_0x45ddac](_0xb794('0x2c'));_0x375b41[_0x45ddac]('voice:outbound');_0x479476[_0xb794('0x32')](getAssociatedResources(_0xb794('0xd'),_0x45d4d0[_0xb794('0x24')],_0xb794('0x30')));_0x479476['push'](getAssociatedResources(_0xb794('0xe'),_0x45d4d0[_0xb794('0x24')],_0xb794('0x31')));_0x479476['push'](getAssociatedResources('FaxQueues',_0x45d4d0[_0xb794('0x24')],_0xb794('0x33')));_0x479476['push'](getAssociatedResources(_0xb794('0x10'),_0x45d4d0[_0xb794('0x24')],_0xb794('0x34')));_0x479476['push'](getAssociatedResources(_0xb794('0x11'),_0x45d4d0[_0xb794('0x24')],_0xb794('0x35')));_0x479476[_0xb794('0x32')](getAssociatedResources(_0xb794('0x12'),_0x45d4d0[_0xb794('0x24')],_0xb794('0x38')));_0x479476[_0xb794('0x32')](getAssociatedResources(_0xb794('0x13'),_0x45d4d0['userProfileId'],'WhatsappQueue'));_0x479476[_0xb794('0x32')](getAssociatedResources('Telephones',_0x45d4d0[_0xb794('0x24')],_0xb794('0x4')));_0x479476[_0xb794('0x32')](getAssociatedResources(_0xb794('0x16'),_0x45d4d0['userProfileId'],_0xb794('0x39')));_0x479476['push'](getAssociatedResources(_0xb794('0x3a'),_0x45d4d0[_0xb794('0x24')],_0xb794('0x1c')));_0x479476[_0xb794('0x32')](db[_0xb794('0x4')]['findAll'](queryAgents));break;case _0xb794('0x7'):_0x375b41[_0x45ddac](_0xb794('0x2c'));_0x375b41[_0x45ddac](_0xb794('0x2d'));_0x479476[_0xb794('0x32')](_0x45d4d0[_0xb794('0x3b')]({'attributes':['id',_0xb794('0x5')]}));_0x479476[_0xb794('0x32')](_0x45d4d0[_0xb794('0x3c')]({'attributes':['id',_0xb794('0x5')]}));_0x479476[_0xb794('0x32')](_0x45d4d0[_0xb794('0x3d')]({'attributes':['id',_0xb794('0x5')]}));_0x479476['push'](_0x45d4d0['getSmsQueues']({'attributes':['id','name']}));_0x479476['push'](_0x45d4d0[_0xb794('0x3e')]({'attributes':['id','name']}));_0x479476[_0xb794('0x32')](_0x45d4d0[_0xb794('0x3f')]({'attributes':['id',_0xb794('0x5')]}));_0x479476[_0xb794('0x32')](_0x45d4d0['getWhatsappQueues']({'attributes':['id','name']}));break;}return BPromise[_0xb794('0x40')](_0x479476);}})['then'](function(_0x5e1a47){if(_0x5e1a47&&_0x5e1a47['length']){for(var _0x4c99a9=0x0;_0x4c99a9<_0x5e1a47[_0xb794('0x20')];_0x4c99a9+=0x1){for(var _0x4253c0=0x0;_0x4253c0<_0x5e1a47[_0x4c99a9][_0xb794('0x20')];_0x4253c0+=0x1){switch(_0x4c99a9){case 0x0:joinOrLeaveQueues(_0x375b41,_0x45ddac,_0xb794('0x41'),_0x5e1a47[_0x4c99a9][_0x4253c0]);break;case 0x1:joinOrLeaveQueues(_0x375b41,_0x45ddac,_0xb794('0x42'),_0x5e1a47[_0x4c99a9][_0x4253c0]);break;case 0x2:joinOrLeaveQueues(_0x375b41,_0x45ddac,_0xb794('0x43'),_0x5e1a47[_0x4c99a9][_0x4253c0]);break;case 0x3:joinOrLeaveQueues(_0x375b41,_0x45ddac,_0xb794('0x44'),_0x5e1a47[_0x4c99a9][_0x4253c0]);break;case 0x4:joinOrLeaveQueues(_0x375b41,_0x45ddac,_0xb794('0x45'),_0x5e1a47[_0x4c99a9][_0x4253c0]);break;case 0x5:joinOrLeaveQueues(_0x375b41,_0x45ddac,'openchannel',_0x5e1a47[_0x4c99a9][_0x4253c0]);break;case 0x6:joinOrLeaveQueues(_0x375b41,_0x45ddac,'whatsapp',_0x5e1a47[_0x4c99a9][_0x4253c0]);break;case 0x7:if(_0x43e077[_0xb794('0x1b')]!=='agent')_0x375b41[_0x45ddac](util[_0xb794('0x1e')](_0xb794('0x46'),_0x5e1a47[_0x4c99a9][_0x4253c0][_0xb794('0x5')]));break;case 0x8:if(_0x43e077[_0xb794('0x1b')]!=='agent')_0x375b41[_0x45ddac](util[_0xb794('0x1e')]('trunk:%s',_0x5e1a47[_0x4c99a9][_0x4253c0]['name']));break;case 0x9:if(_0x43e077[_0xb794('0x1b')]!=='agent')_0x375b41[_0x45ddac](util['format'](_0xb794('0x47'),_0x5e1a47[_0x4c99a9][_0x4253c0][_0xb794('0x1d')],_0x5e1a47[_0x4c99a9][_0x4253c0][_0xb794('0x5')]));break;case 0xa:_0x375b41[_0x45ddac](util['format']('user:%s',_0x5e1a47[_0x4c99a9][_0x4253c0]['name']));break;}}}}})[_0xb794('0xb')](function(){if(_0x45ddac==='leave'){var _0x32015b=_[_0xb794('0x19')](_0x43e077[_0xb794('0x48')],'id');return _0x43e077[_0xb794('0x49')](_0x32015b)[_0xb794('0xb')](function(){for(var _0x2c835c=0x0;_0x2c835c<_0x32015b[_0xb794('0x20')];_0x2c835c+=0x1){_0x425a47[_0xb794('0x4a')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x32015b[_0x2c835c]),'UserId':Number(_0x43e077['id'])});}});}})[_0xb794('0xb')](function(){if(_0x45ddac===_0xb794('0x4b')){var _0x4a5d23=_[_0xb794('0x19')](_0x43e077['MailInteractions'],'id');return _0x43e077[_0xb794('0x4c')](_0x4a5d23)['then'](function(){for(var _0x267691=0x0;_0x267691<_0x4a5d23[_0xb794('0x20')];_0x267691+=0x1){_0x425a47[_0xb794('0x4a')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x4a5d23[_0x267691]),'UserId':Number(_0x43e077['id'])});}});}})['then'](function(){if(_0x45ddac==='leave'){var _0x201f6b=_[_0xb794('0x19')](_0x43e077[_0xb794('0x4d')],'id');return _0x43e077['removeFaxInteractions'](_0x201f6b)[_0xb794('0xb')](function(){for(var _0x1e6ceb=0x0;_0x1e6ceb<_0x201f6b['length'];_0x1e6ceb+=0x1){_0x425a47[_0xb794('0x4a')](_0xb794('0x4e'),{'FaxInteractionId':Number(_0x201f6b[_0x1e6ceb]),'UserId':Number(_0x43e077['id'])});}});}})[_0xb794('0xb')](function(){if(_0x45ddac===_0xb794('0x4b')){var _0xb8b60a=_[_0xb794('0x19')](_0x43e077[_0xb794('0x29')],'id');return _0x43e077[_0xb794('0x4f')](_0xb8b60a)['then'](function(){for(var _0x24e9ef=0x0;_0x24e9ef<_0xb8b60a[_0xb794('0x20')];_0x24e9ef+=0x1){_0x425a47['emit'](_0xb794('0x50'),{'SmsInteractionId':Number(_0xb8b60a[_0x24e9ef]),'UserId':Number(_0x43e077['id'])});}});}})[_0xb794('0xb')](function(){if(_0x45ddac===_0xb794('0x4b')){var _0x57dd13=_[_0xb794('0x19')](_0x43e077[_0xb794('0x51')],'id');return _0x43e077[_0xb794('0x52')](_0x57dd13)[_0xb794('0xb')](function(){for(var _0x20a47a=0x0;_0x20a47a<_0x57dd13[_0xb794('0x20')];_0x20a47a+=0x1){_0x425a47[_0xb794('0x4a')](_0xb794('0x53'),{'OpenchannelInteractionId':Number(_0x57dd13[_0x20a47a]),'UserId':Number(_0x43e077['id'])});}});}})[_0xb794('0xb')](function(){if(_0x45ddac===_0xb794('0x4b')){var _0xf80aad=_['map'](_0x43e077[_0xb794('0x2b')],'id');return _0x43e077[_0xb794('0x54')](_0xf80aad)[_0xb794('0xb')](function(){for(var _0x389c0=0x0;_0x389c0<_0xf80aad[_0xb794('0x20')];_0x389c0+=0x1){_0x425a47[_0xb794('0x4a')](_0xb794('0x55'),{'WhatsappInteractionId':Number(_0xf80aad[_0x389c0]),'UserId':Number(_0x43e077['id'])});}});}})[_0xb794('0x56')](function(_0x171fa7){_0x375b41['log'](_0x171fa7);});}}function onDisconnect(_0xdf067d,_0xf2353){joinOrLeave(_0xdf067d,_0xb794('0x4b'),_0xf2353);}function onConnect(_0x439e86){joinOrLeave(_0x439e86,_0xb794('0x57'));}exports['default']=function(_0x2b4839){_0x2b4839['on']('connection',function(_0x1953ab){_0x1953ab[_0xb794('0x58')](0x0);_0x1953ab[_0xb794('0x59')]=_0x1953ab[_0xb794('0x5a')][_0xb794('0x5b')][_0xb794('0x5c')]+':'+_0x1953ab[_0xb794('0x5a')][_0xb794('0x5b')][_0xb794('0x5d')];_0x1953ab[_0xb794('0x5e')]=new Date();_0x1953ab[_0xb794('0x5f')]=function(_0x49e08d){console['log'](_0xb794('0x60')+_0x1953ab[_0xb794('0x61')][_0xb794('0x5')]+'['+_0x1953ab[_0xb794('0x59')]+']',_0x49e08d);};_0x1953ab['on'](_0xb794('0x62'),function(){onDisconnect(_0x1953ab,_0x2b4839);_0x1953ab['log']('DISCONNECTED');});onConnect(_0x1953ab);_0x1953ab['log'](_0xb794('0x63'));});}; \ No newline at end of file +var _0x59ee=['voice','chat','openchannel','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','setMaxListeners','address','request','connection','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','util','../mysqldb','name','Agents','User','role','agent','telephone','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','FaxQueues','SmsQueues','OpenchannelQueues','findAll','Telephones','UserProfileResource','resourceId','map','where','type','format','length','user:%s','handshake','query','find','userProfileId','ChatInteractions','MailInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','admin','voice:outbound','hasOwnProperty','include','push','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Campaign','user','voice:inbound','VoiceQueue','ChatQueues','ChatQueue','WhatsappQueues','Trunks','IvrCampaigns','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getWhatsappQueues','all'];(function(_0x25a547,_0x50fe9e){var _0x1553b6=function(_0x24202e){while(--_0x24202e){_0x25a547['push'](_0x25a547['shift']());}};_0x1553b6(++_0x50fe9e);}(_0x59ee,0x1a0));var _0xe59e=function(_0x4c3267,_0xf2b77){_0x4c3267=_0x4c3267-0x0;var _0xfa5c9=_0x59ee[_0x4c3267];return _0xfa5c9;};'use strict';var _=require('lodash');var util=require(_0xe59e('0x0'));var BPromise=require('bluebird');var db=require(_0xe59e('0x1'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0xe59e('0x2')],'include':[{'as':_0xe59e('0x3'),'model':db[_0xe59e('0x4')],'attributes':['id',_0xe59e('0x2'),_0xe59e('0x5')],'raw':!![],'where':{'role':_0xe59e('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xe59e('0x2')],'where':{'role':_0xe59e('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0xe59e('0x2')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xe59e('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xe59e('0x2'),'type'],'where':{'type':_0xe59e('0x8')}};function getAssociatedResources(_0x540a6b,_0x57478b,_0x27e742){return db[_0xe59e('0x9')][_0xe59e('0xa')]({'where':{'name':_0x540a6b,'userProfileId':_0x57478b},'raw':!![]})[_0xe59e('0xb')](function(_0x35fa7b){if(_0x35fa7b){if(_0x35fa7b[_0xe59e('0xc')]){switch(_0x540a6b){case _0xe59e('0xd'):case'ChatQueues':case _0xe59e('0xe'):case _0xe59e('0xf'):case'MailQueues':case _0xe59e('0x10'):case'WhatsappQueues':return db[_0x27e742][_0xe59e('0x11')](queryQueues);case _0xe59e('0x12'):return db[_0x27e742]['findAll'](queryTelephones);case'Trunks':return db[_0x27e742][_0xe59e('0x11')](queryTrunks);case'IvrCampaigns':return db[_0x27e742][_0xe59e('0x11')](queryCampaigns);}}else{return db[_0xe59e('0x13')][_0xe59e('0x11')]({'attributes':[_0xe59e('0x14')],'where':{'sectionId':_0x35fa7b['id']},'raw':!![]})[_0xe59e('0xb')](function(_0x1e3c28){if(_0x1e3c28){var _0x3f17ff={'where':{'id':_[_0xe59e('0x15')](_0x1e3c28,_0xe59e('0x14'))},'raw':!![]};switch(_0x27e742){case _0xe59e('0x4'):_0x3f17ff[_0xe59e('0x16')][_0xe59e('0x5')]=_0xe59e('0x7');break;case'Campaign':_0x3f17ff[_0xe59e('0x16')][_0xe59e('0x17')]=_0xe59e('0x8');break;}return db[_0x27e742][_0xe59e('0x11')](_0x3f17ff);}else{return[];}});}}else{return[];}})[_0xe59e('0xb')](function(_0xb7973f){return _0xb7973f;});}function joinOrLeaveQueues(_0x5e7e65,_0x573c43,_0x5db607,_0x2da542){_0x5e7e65[_0x573c43](util[_0xe59e('0x18')]('%s:queue:%s',_0x5db607,_0x2da542[_0xe59e('0x2')]));if(_0x2da542[_0xe59e('0x3')]){for(var _0x19d5e3=0x0;_0x19d5e3<_0x2da542['Agents'][_0xe59e('0x19')];_0x19d5e3+=0x1){_0x5e7e65[_0x573c43](util['format'](_0xe59e('0x1a'),_0x2da542[_0xe59e('0x3')][_0x19d5e3]['name']));}}}function joinOrLeave(_0x2ea560,_0x203b40,_0x361b94){var _0x59fb46;if(_0x2ea560[_0xe59e('0x1b')][_0xe59e('0x1c')]['id']){db['User'][_0xe59e('0x1d')]({'attributes':['id',_0xe59e('0x2'),_0xe59e('0x5'),_0xe59e('0x1e')],'where':{'id':_0x2ea560[_0xe59e('0x1b')]['query']['id']},'include':[{'model':db['ChatInteraction'],'as':_0xe59e('0x1f'),'attributes':['id'],'raw':!![]},{'model':db[_0xe59e('0x20')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0xe59e('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0xe59e('0x22')],'as':_0xe59e('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xe59e('0x24')],'as':_0xe59e('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xe59e('0x26')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0xe59e('0xb')](function(_0x4be7d6){if(_0x4be7d6){_0x59fb46=_0x4be7d6;_0x2ea560[_0x203b40](util[_0xe59e('0x18')](_0xe59e('0x1a'),_0x4be7d6[_0xe59e('0x2')]));var _0x427524=[];switch(_0x4be7d6[_0xe59e('0x5')]){case _0xe59e('0x27'):_0x2ea560[_0x203b40]('voice:inbound');_0x2ea560[_0x203b40](_0xe59e('0x28'));if(queryQueues[_0xe59e('0x29')](_0xe59e('0x2a'))){delete queryQueues[_0xe59e('0x2a')];}_0x427524[_0xe59e('0x2b')](db['VoiceQueue'][_0xe59e('0x11')](queryQueues));_0x427524[_0xe59e('0x2b')](db['ChatQueue']['findAll'](queryQueues));_0x427524[_0xe59e('0x2b')](db[_0xe59e('0x2c')]['findAll'](queryQueues));_0x427524[_0xe59e('0x2b')](db[_0xe59e('0x2d')]['findAll'](queryQueues));_0x427524[_0xe59e('0x2b')](db[_0xe59e('0x2e')]['findAll'](queryQueues));_0x427524[_0xe59e('0x2b')](db[_0xe59e('0x2f')][_0xe59e('0x11')](queryQueues));_0x427524[_0xe59e('0x2b')](db[_0xe59e('0x30')][_0xe59e('0x11')](queryQueues));_0x427524[_0xe59e('0x2b')](db['User'][_0xe59e('0x11')](queryTelephones));_0x427524[_0xe59e('0x2b')](db['Trunk'][_0xe59e('0x11')](queryTrunks));_0x427524[_0xe59e('0x2b')](db[_0xe59e('0x31')]['findAll'](queryCampaigns));_0x427524[_0xe59e('0x2b')](db[_0xe59e('0x4')][_0xe59e('0x11')](queryAgents));break;case _0xe59e('0x32'):_0x2ea560[_0x203b40](_0xe59e('0x33'));_0x2ea560[_0x203b40]('voice:outbound');_0x427524[_0xe59e('0x2b')](getAssociatedResources('VoiceQueues',_0x4be7d6[_0xe59e('0x1e')],_0xe59e('0x34')));_0x427524[_0xe59e('0x2b')](getAssociatedResources(_0xe59e('0x35'),_0x4be7d6['userProfileId'],_0xe59e('0x36')));_0x427524[_0xe59e('0x2b')](getAssociatedResources(_0xe59e('0xe'),_0x4be7d6[_0xe59e('0x1e')],_0xe59e('0x2c')));_0x427524['push'](getAssociatedResources(_0xe59e('0xf'),_0x4be7d6['userProfileId'],_0xe59e('0x2d')));_0x427524['push'](getAssociatedResources('MailQueues',_0x4be7d6[_0xe59e('0x1e')],_0xe59e('0x2e')));_0x427524[_0xe59e('0x2b')](getAssociatedResources('OpenchannelQueues',_0x4be7d6[_0xe59e('0x1e')],_0xe59e('0x2f')));_0x427524[_0xe59e('0x2b')](getAssociatedResources(_0xe59e('0x37'),_0x4be7d6[_0xe59e('0x1e')],_0xe59e('0x30')));_0x427524[_0xe59e('0x2b')](getAssociatedResources('Telephones',_0x4be7d6['userProfileId'],'User'));_0x427524[_0xe59e('0x2b')](getAssociatedResources(_0xe59e('0x38'),_0x4be7d6[_0xe59e('0x1e')],'Trunk'));_0x427524[_0xe59e('0x2b')](getAssociatedResources(_0xe59e('0x39'),_0x4be7d6[_0xe59e('0x1e')],_0xe59e('0x31')));_0x427524[_0xe59e('0x2b')](db['User'][_0xe59e('0x11')](queryAgents));break;case _0xe59e('0x6'):_0x2ea560[_0x203b40]('voice:inbound');_0x2ea560[_0x203b40](_0xe59e('0x28'));_0x427524[_0xe59e('0x2b')](_0x4be7d6[_0xe59e('0x3a')]({'attributes':['id',_0xe59e('0x2')]}));_0x427524[_0xe59e('0x2b')](_0x4be7d6[_0xe59e('0x3b')]({'attributes':['id',_0xe59e('0x2')]}));_0x427524[_0xe59e('0x2b')](_0x4be7d6['getFaxQueues']({'attributes':['id',_0xe59e('0x2')]}));_0x427524[_0xe59e('0x2b')](_0x4be7d6[_0xe59e('0x3c')]({'attributes':['id',_0xe59e('0x2')]}));_0x427524[_0xe59e('0x2b')](_0x4be7d6[_0xe59e('0x3d')]({'attributes':['id',_0xe59e('0x2')]}));_0x427524[_0xe59e('0x2b')](_0x4be7d6['getOpenchannelQueues']({'attributes':['id','name']}));_0x427524[_0xe59e('0x2b')](_0x4be7d6[_0xe59e('0x3e')]({'attributes':['id','name']}));break;}return BPromise[_0xe59e('0x3f')](_0x427524);}})[_0xe59e('0xb')](function(_0x893eb9){if(_0x893eb9&&_0x893eb9[_0xe59e('0x19')]){for(var _0x23ee61=0x0;_0x23ee61<_0x893eb9['length'];_0x23ee61+=0x1){for(var _0x47eedf=0x0;_0x47eedf<_0x893eb9[_0x23ee61]['length'];_0x47eedf+=0x1){switch(_0x23ee61){case 0x0:joinOrLeaveQueues(_0x2ea560,_0x203b40,_0xe59e('0x40'),_0x893eb9[_0x23ee61][_0x47eedf]);break;case 0x1:joinOrLeaveQueues(_0x2ea560,_0x203b40,_0xe59e('0x41'),_0x893eb9[_0x23ee61][_0x47eedf]);break;case 0x2:joinOrLeaveQueues(_0x2ea560,_0x203b40,'fax',_0x893eb9[_0x23ee61][_0x47eedf]);break;case 0x3:joinOrLeaveQueues(_0x2ea560,_0x203b40,'sms',_0x893eb9[_0x23ee61][_0x47eedf]);break;case 0x4:joinOrLeaveQueues(_0x2ea560,_0x203b40,'mail',_0x893eb9[_0x23ee61][_0x47eedf]);break;case 0x5:joinOrLeaveQueues(_0x2ea560,_0x203b40,_0xe59e('0x42'),_0x893eb9[_0x23ee61][_0x47eedf]);break;case 0x6:joinOrLeaveQueues(_0x2ea560,_0x203b40,'whatsapp',_0x893eb9[_0x23ee61][_0x47eedf]);break;case 0x7:if(_0x59fb46[_0xe59e('0x5')]!==_0xe59e('0x6'))_0x2ea560[_0x203b40](util[_0xe59e('0x18')](_0xe59e('0x43'),_0x893eb9[_0x23ee61][_0x47eedf]['name']));break;case 0x8:if(_0x59fb46[_0xe59e('0x5')]!==_0xe59e('0x6'))_0x2ea560[_0x203b40](util['format'](_0xe59e('0x44'),_0x893eb9[_0x23ee61][_0x47eedf][_0xe59e('0x2')]));break;case 0x9:if(_0x59fb46[_0xe59e('0x5')]!=='agent')_0x2ea560[_0x203b40](util[_0xe59e('0x18')](_0xe59e('0x45'),_0x893eb9[_0x23ee61][_0x47eedf]['type'],_0x893eb9[_0x23ee61][_0x47eedf][_0xe59e('0x2')]));break;case 0xa:_0x2ea560[_0x203b40](util[_0xe59e('0x18')]('user:%s',_0x893eb9[_0x23ee61][_0x47eedf][_0xe59e('0x2')]));break;}}}}})[_0xe59e('0xb')](function(){if(_0x203b40===_0xe59e('0x46')){var _0x4e0341=_[_0xe59e('0x15')](_0x59fb46[_0xe59e('0x1f')],'id');return _0x59fb46[_0xe59e('0x47')](_0x4e0341)[_0xe59e('0xb')](function(){for(var _0x2c7fd7=0x0;_0x2c7fd7<_0x4e0341['length'];_0x2c7fd7+=0x1){_0x361b94[_0xe59e('0x48')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x4e0341[_0x2c7fd7]),'UserId':Number(_0x59fb46['id'])});}});}})[_0xe59e('0xb')](function(){if(_0x203b40===_0xe59e('0x46')){var _0x598c90=_[_0xe59e('0x15')](_0x59fb46['MailInteractions'],'id');return _0x59fb46[_0xe59e('0x49')](_0x598c90)[_0xe59e('0xb')](function(){for(var _0x21030e=0x0;_0x21030e<_0x598c90[_0xe59e('0x19')];_0x21030e+=0x1){_0x361b94[_0xe59e('0x48')](_0xe59e('0x4a'),{'MailInteractionId':Number(_0x598c90[_0x21030e]),'UserId':Number(_0x59fb46['id'])});}});}})[_0xe59e('0xb')](function(){if(_0x203b40===_0xe59e('0x46')){var _0x290e5e=_[_0xe59e('0x15')](_0x59fb46[_0xe59e('0x21')],'id');return _0x59fb46['removeFaxInteractions'](_0x290e5e)['then'](function(){for(var _0x5a59df=0x0;_0x5a59df<_0x290e5e['length'];_0x5a59df+=0x1){_0x361b94[_0xe59e('0x48')](_0xe59e('0x4b'),{'FaxInteractionId':Number(_0x290e5e[_0x5a59df]),'UserId':Number(_0x59fb46['id'])});}});}})[_0xe59e('0xb')](function(){if(_0x203b40===_0xe59e('0x46')){var _0x22619d=_['map'](_0x59fb46[_0xe59e('0x23')],'id');return _0x59fb46['removeSmsInteractions'](_0x22619d)[_0xe59e('0xb')](function(){for(var _0x20375a=0x0;_0x20375a<_0x22619d[_0xe59e('0x19')];_0x20375a+=0x1){_0x361b94[_0xe59e('0x48')](_0xe59e('0x4c'),{'SmsInteractionId':Number(_0x22619d[_0x20375a]),'UserId':Number(_0x59fb46['id'])});}});}})[_0xe59e('0xb')](function(){if(_0x203b40===_0xe59e('0x46')){var _0x54418a=_[_0xe59e('0x15')](_0x59fb46[_0xe59e('0x25')],'id');return _0x59fb46[_0xe59e('0x4d')](_0x54418a)['then'](function(){for(var _0x321e16=0x0;_0x321e16<_0x54418a[_0xe59e('0x19')];_0x321e16+=0x1){_0x361b94[_0xe59e('0x48')](_0xe59e('0x4e'),{'OpenchannelInteractionId':Number(_0x54418a[_0x321e16]),'UserId':Number(_0x59fb46['id'])});}});}})[_0xe59e('0xb')](function(){if(_0x203b40==='leave'){var _0x4dc578=_['map'](_0x59fb46['WhatsappInteractions'],'id');return _0x59fb46[_0xe59e('0x4f')](_0x4dc578)[_0xe59e('0xb')](function(){for(var _0x33e296=0x0;_0x33e296<_0x4dc578['length'];_0x33e296+=0x1){_0x361b94['emit'](_0xe59e('0x50'),{'WhatsappInteractionId':Number(_0x4dc578[_0x33e296]),'UserId':Number(_0x59fb46['id'])});}});}})[_0xe59e('0x51')](function(_0x303cec){_0x2ea560[_0xe59e('0x52')](_0x303cec);});}}function onDisconnect(_0x1c3079,_0x5cb0a0){joinOrLeave(_0x1c3079,_0xe59e('0x46'),_0x5cb0a0);}function onConnect(_0x3d5cdd){joinOrLeave(_0x3d5cdd,_0xe59e('0x53'));}exports[_0xe59e('0x54')]=function(_0x34d287){_0x34d287['on']('connection',function(_0x47b5f5){_0x47b5f5[_0xe59e('0x55')](0x0);_0x47b5f5[_0xe59e('0x56')]=_0x47b5f5[_0xe59e('0x57')][_0xe59e('0x58')][_0xe59e('0x59')]+':'+_0x47b5f5[_0xe59e('0x57')][_0xe59e('0x58')][_0xe59e('0x5a')];_0x47b5f5[_0xe59e('0x5b')]=new Date();_0x47b5f5[_0xe59e('0x52')]=function(_0x281223){console[_0xe59e('0x52')](_0xe59e('0x5c')+_0x47b5f5[_0xe59e('0x5d')]['name']+'['+_0x47b5f5[_0xe59e('0x56')]+']',_0x281223);};_0x47b5f5['on'](_0xe59e('0x5e'),function(){onDisconnect(_0x47b5f5,_0x34d287);_0x47b5f5[_0xe59e('0x52')](_0xe59e('0x5f'));});onConnect(_0x47b5f5);_0x47b5f5[_0xe59e('0x52')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 2ebda58..6b7faf4 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 _0x8d98=['condition','util','../../mysqldb','jayson/promise','../logger','triggers','client','http','Chat','ChatInteraction','afterCreate','afterUpdate','closedinteraction','ChatMessage','newmessage','Sms','SmsInteraction','newinteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','OpenchannelInteraction','Openchannel','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','code','catch','get','motionChannel','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','query','Sequelize','SELECT','contact','UserId','format','SIP/%s','name','agent','channel','incomingmessage','outgoingmessage','AfterCreateMessage','event','opened','resolve','QueryTypes','interface','AfterCreate','changed','closed','substatus','sequelize','AfterUpdate','find','fullname','internal','length','hasOwnProperty','model','hook','callback','toLowerCase'];(function(_0x47f4c2,_0x134e7b){var _0x22c63e=function(_0x5b8572){while(--_0x5b8572){_0x47f4c2['push'](_0x47f4c2['shift']());}};_0x22c63e(++_0x134e7b);}(_0x8d98,0x135));var _0x88d9=function(_0x181e15,_0x1d97ab){_0x181e15=_0x181e15-0x0;var _0x13a771=_0x8d98[_0x181e15];return _0x13a771;};'use strict';var util=require(_0x88d9('0x0'));var db=require(_0x88d9('0x1'))['db'];var jayson=require(_0x88d9('0x2'));var logger=require(_0x88d9('0x3'))(_0x88d9('0x4'));var client=jayson[_0x88d9('0x5')][_0x88d9('0x6')]({'port':0x232a});var triggers=[{'channel':_0x88d9('0x7'),'model':_0x88d9('0x8'),'event':_0x88d9('0x9'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x88d9('0x7'),'model':_0x88d9('0x8'),'event':_0x88d9('0xa'),'condition':_0x88d9('0xb'),'callback':afterUpdate},{'channel':_0x88d9('0x7'),'model':_0x88d9('0xc'),'event':_0x88d9('0x9'),'condition':_0x88d9('0xd'),'callback':afterCreateMessage},{'channel':_0x88d9('0xe'),'model':_0x88d9('0xf'),'event':_0x88d9('0x9'),'condition':_0x88d9('0x10'),'callback':afterCreate},{'channel':'Sms','model':'SmsInteraction','event':_0x88d9('0xa'),'condition':_0x88d9('0xb'),'callback':afterUpdate},{'channel':_0x88d9('0xe'),'model':_0x88d9('0x11'),'event':_0x88d9('0x9'),'condition':_0x88d9('0xd'),'callback':afterCreateMessage},{'channel':_0x88d9('0x12'),'model':_0x88d9('0x13'),'event':_0x88d9('0x9'),'condition':_0x88d9('0x10'),'callback':afterCreate},{'channel':'Whatsapp','model':_0x88d9('0x13'),'event':_0x88d9('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x88d9('0x12'),'model':_0x88d9('0x14'),'event':_0x88d9('0x9'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x88d9('0x15'),'model':_0x88d9('0x16'),'event':'afterCreate','condition':_0x88d9('0x10'),'callback':afterCreate},{'channel':'Fax','model':'FaxInteraction','event':_0x88d9('0xa'),'condition':_0x88d9('0xb'),'callback':afterUpdate},{'channel':_0x88d9('0x15'),'model':_0x88d9('0x17'),'event':'afterCreate','condition':_0x88d9('0xd'),'callback':afterCreateMessage},{'channel':_0x88d9('0x18'),'model':_0x88d9('0x19'),'event':_0x88d9('0x9'),'condition':_0x88d9('0x10'),'callback':afterCreate},{'channel':_0x88d9('0x18'),'model':_0x88d9('0x19'),'event':_0x88d9('0xa'),'condition':_0x88d9('0xb'),'callback':afterUpdate},{'channel':_0x88d9('0x18'),'model':_0x88d9('0x1a'),'event':_0x88d9('0x9'),'condition':_0x88d9('0xd'),'callback':afterCreateMessage},{'channel':'Openchannel','model':_0x88d9('0x1b'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x88d9('0x1c'),'model':_0x88d9('0x1b'),'event':_0x88d9('0xa'),'condition':_0x88d9('0xb'),'callback':afterUpdate},{'channel':_0x88d9('0x1c'),'model':_0x88d9('0x1d'),'event':_0x88d9('0x9'),'condition':_0x88d9('0xd'),'callback':afterCreateMessage}];function request(_0x4ef9d7){return client[_0x88d9('0x1e')](_0x88d9('0x1f'),_0x4ef9d7)[_0x88d9('0x20')](function(_0x4f93d2){logger[_0x88d9('0x21')](_0x88d9('0x22'),'EventManager',_0x4f93d2);if(_0x4f93d2[_0x88d9('0x23')]){if(_0x4f93d2[_0x88d9('0x23')][_0x88d9('0x24')]===0x1f4){logger[_0x88d9('0x23')](_0x88d9('0x22'),_0x88d9('0x1f'),_0x4f93d2[_0x88d9('0x23')]);}}})[_0x88d9('0x25')](function(_0x3d010d){logger['error'](_0x88d9('0x22'),'EventManager',_0x3d010d);});}function afterCreateMessage(_0x53aa4c){return function(_0x26cb25){_0x26cb25=_0x26cb25[_0x88d9('0x26')]({'plain':!![]});_0x26cb25['channel']=_0x53aa4c;_0x26cb25[_0x88d9('0x27')]=_0x53aa4c;_0x26cb25['event']=_0x26cb25['direction'];Promise['resolve']()[_0x88d9('0x20')](function(){if(typeof _0x26cb25['ContactId']===_0x88d9('0x28'))return null;var _0x51f1b3=_0x88d9('0x29')+_0x26cb25[_0x88d9('0x2a')];return db['sequelize'][_0x88d9('0x2b')](_0x51f1b3,{'type':db[_0x88d9('0x2c')]['QueryTypes'][_0x88d9('0x2d')],'raw':!![]});})[_0x88d9('0x20')](function(_0x574362){if(_0x574362){_0x26cb25[_0x88d9('0x2e')]=_0x574362[0x0];}if(typeof _0x26cb25['UserId']==='undefined')return;return getAgent(_0x26cb25[_0x88d9('0x2f')]);})[_0x88d9('0x20')](function(_0x3d541b){if(_0x3d541b){_0x26cb25['interface']=util[_0x88d9('0x30')](_0x88d9('0x31'),_0x3d541b[_0x88d9('0x32')]);_0x26cb25[_0x88d9('0x33')]=_0x3d541b;_0x26cb25[_0x88d9('0x34')]=_0x53aa4c;return request({'event':_0x88d9('0x35'),'message':_0x26cb25});}else{return request({'event':_0x88d9('0x36'),'message':_0x26cb25});}})[_0x88d9('0x25')](function(_0x44d5aa){logger[_0x88d9('0x23')]('Trigger,\x20%s',_0x88d9('0x37'),_0x44d5aa);});};}function afterCreate(_0x3b72e9,_0x54b4f6){return function(_0xebfbdd){_0xebfbdd=_0xebfbdd[_0x88d9('0x26')]({'plain':!![]});_0xebfbdd[_0x88d9('0x34')]=_0x3b72e9;_0xebfbdd[_0x88d9('0x27')]=_0x3b72e9;_0xebfbdd[_0x88d9('0x38')]=_0x88d9('0x39');Promise[_0x88d9('0x3a')]()[_0x88d9('0x20')](function(){var _0x9370c6=_0x88d9('0x29')+_0xebfbdd[_0x88d9('0x2a')];return db['sequelize']['query'](_0x9370c6,{'type':db[_0x88d9('0x2c')][_0x88d9('0x3b')][_0x88d9('0x2d')],'raw':!![]});})[_0x88d9('0x20')](function(_0x5d91a0){if(_0x5d91a0){_0xebfbdd['contact']=_0x5d91a0[0x0];}if(typeof _0xebfbdd[_0x88d9('0x2f')]===_0x88d9('0x28'))return;return getAgent(_0xebfbdd['UserId']);})[_0x88d9('0x20')](function(_0xc78e8b){if(_0xc78e8b){_0xebfbdd[_0x88d9('0x3c')]=util[_0x88d9('0x30')](_0x88d9('0x31'),_0xc78e8b[_0x88d9('0x32')]);_0xebfbdd['agent']=_0xc78e8b;}return request({'event':_0x54b4f6,'message':_0xebfbdd});})[_0x88d9('0x25')](function(_0x35e174){logger[_0x88d9('0x23')](_0x88d9('0x22'),_0x88d9('0x3d'),_0x35e174);});};}function afterUpdate(_0x5bc160){return function(_0x5f009c){var _0x2b44fa=_0x5f009c[_0x88d9('0x3e')]('closed')&&_0x5f009c[_0x88d9('0x3f')];var _0x3660db=_0x5f009c[_0x88d9('0x3e')](_0x88d9('0x40'));if(_0x2b44fa||_0x3660db){var _0x3c21c6=_0x2b44fa?_0x88d9('0xb'):'substatus';var _0x195dc5=_0x5f009c[_0x88d9('0x26')]({'plain':!![]});_0x195dc5['channel']=_0x5bc160;_0x195dc5['motionChannel']=_0x5bc160;_0x195dc5['event']=_0x2b44fa?_0x88d9('0x3f'):'substatus';var _0x3bc9f3='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x195dc5[_0x88d9('0x2a')];return db[_0x88d9('0x41')][_0x88d9('0x2b')](_0x3bc9f3,{'type':db[_0x88d9('0x2c')][_0x88d9('0x3b')][_0x88d9('0x2d')],'raw':!![]})[_0x88d9('0x20')](function(_0x1f93b6){if(_0x1f93b6){_0x195dc5[_0x88d9('0x2e')]=_0x1f93b6[0x0];}if(typeof _0x195dc5[_0x88d9('0x2f')]==='undefined')return;return getAgent(_0x195dc5[_0x88d9('0x2f')]);})['then'](function(_0x49c1cd){if(_0x49c1cd){_0x195dc5[_0x88d9('0x3c')]=util['format'](_0x88d9('0x31'),_0x49c1cd[_0x88d9('0x32')]);_0x195dc5[_0x88d9('0x33')]=_0x49c1cd;}return request({'event':_0x3c21c6,'message':_0x195dc5});})[_0x88d9('0x25')](function(_0x5cf316){logger[_0x88d9('0x23')]('Trigger,\x20%s',_0x88d9('0x42'),_0x5cf316);});}};}function getAgent(_0xf0cca3){return db['User'][_0x88d9('0x43')]({'where':{'id':_0xf0cca3},'attributes':['id',_0x88d9('0x32'),_0x88d9('0x44'),'email',_0x88d9('0x45')],'raw':!![]})[_0x88d9('0x20')](function(_0x4979bd){return _0x4979bd;});}exports['default']=function(){for(var _0x57c985=0x0;_0x57c985=_0xbc8f89[_0x7c85('0x13')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x33ce8c(_0x169624);})[_0x7c85('0x14')](function(_0x5b6371){_0x54f919(_0x5b6371);});});}; \ No newline at end of file +var _0xbbca=['chat','fax','openchannel','isValidChannel','toLowerCase','includes','isUndefined','getLicense','role','agent','User','count','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','../mysqldb','./license/util','voice'];(function(_0x7880d2,_0x32e7d6){var _0x35ebbe=function(_0x5c27fa){while(--_0x5c27fa){_0x7880d2['push'](_0x7880d2['shift']());}};_0x35ebbe(++_0x32e7d6);}(_0xbbca,0x94));var _0xabbc=function(_0x291b70,_0x1bc6db){_0x291b70=_0x291b70-0x0;var _0x40770b=_0xbbca[_0x291b70];return _0x40770b;};'use strict';var _=require(_0xabbc('0x0'));var BPromise=require('bluebird');var db=require(_0xabbc('0x1'))['db'];var util=require(_0xabbc('0x2'));var channels=[_0xabbc('0x3'),'mail',_0xabbc('0x4'),_0xabbc('0x5'),'sms','whatsapp',_0xabbc('0x6')];exports['getChannels']=function(){return channels;};exports[_0xabbc('0x7')]=function(_0x4f6433){_0x4f6433=_0x4f6433[_0xabbc('0x8')]();return _[_0xabbc('0x9')](channels,_0x4f6433);};exports['clearBlockUser']=function(_0x59df42,_0x3ee006,_0x2e8b39,_0x277401){var _0x218cad={'loginAttempts':_0x3ee006,'blocked':_0x2e8b39};if(!_[_0xabbc('0xa')](_0x277401)){_0x218cad['blockedAt']=_0x277401;}return _0x59df42['updateAttributes'](_0x218cad);};exports[_0xabbc('0xb')]=function(_0x56e0f6){return new BPromise(function(_0x4af5ff,_0x15d503){var _0x363c68=0x0;if(_0x56e0f6[_0xabbc('0xc')]!==_0xabbc('0xd')){_0x4af5ff(_0x56e0f6);}db[_0xabbc('0xe')][_0xabbc('0xf')]({'where':{'role':_0xabbc('0xd'),'online':!![],'id':{'$ne':_0x56e0f6['id']}}})['then'](function(_0x3174eb){_0x363c68=_0x3174eb;return util['getLicense']();})['then'](function(_0x1152ef){if(_0x1152ef&&_0x1152ef['agents']&&_0x363c68>=_0x1152ef[_0xabbc('0x10')]){throw Error(_0xabbc('0x11'));}_0x4af5ff(_0x56e0f6);})[_0xabbc('0x12')](function(_0x4c2f32){_0x15d503(_0x4c2f32);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 12b2711..7cf5f36 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb84=['render','json','send','404','status'];(function(_0x3c2b2e,_0x3e6e53){var _0x27a338=function(_0x40d29d){while(--_0x40d29d){_0x3c2b2e['push'](_0x3c2b2e['shift']());}};_0x27a338(++_0x3e6e53);}(_0xdb84,0xa8));var _0x4db8=function(_0x32e9c,_0x3b9bed){_0x32e9c=_0x32e9c-0x0;var _0x306562=_0xdb84[_0x32e9c];return _0x306562;};'use strict';module['exports'][0x194]=function pageNotFound(_0x4356a5,_0x46ca70){var _0x566868=_0x4db8('0x0');var _0x30e72d=0x194;var _0x107557={'status':_0x30e72d};_0x46ca70[_0x4db8('0x1')](_0x107557[_0x4db8('0x1')]);_0x46ca70[_0x4db8('0x2')](_0x566868,{},function(_0x229794,_0x272030){if(_0x229794){return _0x46ca70[_0x4db8('0x1')](_0x107557[_0x4db8('0x1')])[_0x4db8('0x3')](_0x107557);}_0x46ca70[_0x4db8('0x4')](_0x272030);});}; \ No newline at end of file +var _0xd9ac=['404','render','status','send','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xd9ac,0xd6));var _0xcd9a=function(_0xa48080,_0x2b9cb8){_0xa48080=_0xa48080-0x0;var _0x31bad7=_0xd9ac[_0xa48080];return _0x31bad7;};'use strict';module[_0xcd9a('0x0')][0x194]=function pageNotFound(_0x38ded2,_0x19325e){var _0x4aab60=_0xcd9a('0x1');var _0x2181c9=0x194;var _0xb52d2f={'status':_0x2181c9};_0x19325e['status'](_0xb52d2f['status']);_0x19325e[_0xcd9a('0x2')](_0x4aab60,{},function(_0x59461a,_0x200abf){if(_0x59461a){return _0x19325e[_0xcd9a('0x3')](_0xb52d2f[_0xcd9a('0x3')])['json'](_0xb52d2f);}_0x19325e[_0xcd9a('0x4')](_0x200abf);});}; \ No newline at end of file diff --git a/server/migrations/2.5.38.js b/server/migrations/2.5.38.js new file mode 100644 index 0000000..22df2f1 --- /dev/null +++ b/server/migrations/2.5.38.js @@ -0,0 +1,165 @@ +'use strict'; + +var BPromise = require('bluebird'); +var util = require('util'); + +var logger = require('../config/logger')('migration'); + +var Sequence = function() {}; + +Sequence.prototype.enqueue = function(fn) { + this.tail = this.tail ? this.tail.finally(fn) : fn(); +}; + +var Migration = function(queryInterface) { + this.queryInterface = queryInterface; + this.sequence = new Sequence(); +}; + +Migration.prototype.changeColumn = function(table, column, type) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .changeColumn(table, column, type) + .then(function() { + logger.info('Changed column %s in table %s', column, table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.addColumn = function(table, column, type) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .addColumn(table, column, type) + .then(function() { + logger.info('Added column %s to %s', column, table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.dropTable = function(table) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .dropTable(table, { + force: true + }) + .then(function() { + logger.info('table dropped %s', table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.addIndex = function(table, column, indexName) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .addIndex(table, column, { + indexName: indexName + }) + .then(function() { + logger.info('addIndex %s %s %s', table, column.join(','), indexName); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.removeIndex = function(table, indexName) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .removeIndex(table, indexName) + .then(function() { + logger.info('removeIndex %s %s', table, indexName); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.query = function(sql) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface.sequelize + .query(sql) + .then(function() { + logger.info('query %s', sql); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.removeColumn = function(table, column) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .removeColumn(table, column) + .then(function() { + logger.info('Removed column %s from %s', column, table); + }) + .catch(function(err) { + logger.info( + util.inspect(err, { + showHidden: false, + depth: null + }) + ); + }); + }); +}; + +Migration.prototype.renameColumn = function(table, oldColumn, newColumn) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .renameColumn(table, oldColumn, newColumn) + .then(function() { + logger.info('Renamed column from %s to %s on %s', oldColumn, newColumn, table); + }) + .catch(function(err) { + logger.info( + util.inspect(err, { + showHidden: false, + depth: null + }) + ); + }); + }); +}; + +Migration.prototype.final = function(resolve) { + this.sequence.enqueue(function() { + return resolve(); + }); +}; + +module.exports = { + up: function(queryInterface, Sequelize) { + return new BPromise(function(resolve) { + var migration = new Migration(queryInterface); + + // START FINAL + migration.final(resolve); + // END FINAL + }); + }, + + down: function(queryInterface, Sequelize) { + // var migration = new Migration(queryInterface); + } +}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 3c7716c..5f73b93 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x22fb=['../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Automation','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../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','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','Team','License','../api/license/license.model','../api/campaign/campaign.model','Migration','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','UserProfile','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','User','cascade','UserId','hasMany','VoiceRecording','UserVoiceQueueRt','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteraction','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','chat_group_has_users','belongsToMany','CmContact','Contacts','cm_user_has_contacts','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','SmsInteractions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefix','VoicePrefixes','MailQueues','ChatQueues','FaxQueues','SmsQueue','UserSmsQueue','OpenchannelQueues','WhatsappQueue','WhatsappQueues','cm_user_has_lists','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','VoiceQueueId','Hoppers','HopperHistories','JscriptySessions','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','Agents','Teams','TeamVoiceQueue','BlackLists','voice_queues_has_cm_blacklists','mailboxuser','mailbox','VoiceCallReport','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','hasOne','Imap','CannedAnswer','Messages','Interactions','List','TemplateId','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','ListId','DashboardItem','Dispositions','FaxAccountId','Answers','FaxApplication','Exntensions','fax_interaction_has_tags','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','Interaction','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelInteractionId','openchannel_interaction_has_tags','AttachmentId','OpenchannelQueueId','team_has_openchannel_queues','ProactiveActions','ChatMessage','OpenchannelQueueReport','ChatApplication','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','Members','CmHopper','Company','CompanyId','cm_contact_has_tags','Campaign','CampaignId','Condition','All','OneAll','AutomationAllId','Any','OneAny','Actions','AutomationId','Intervals','MailApplications','ChatApplications','FaxApplications','Schedule','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','Trigger','TriggerAllId','AnyConditions','TriggerAnyId','Action','TriggerId','Fields','MetricId','Configurations','AccountId','Subjects','Descriptions','Subject','SubjectId','Description','DescriptionId','Field','FieldId','VariableId','DeskConfiguration','int_desk_configuration_has_tags','ZohoField','ZendeskAccount','int_zendesk_configuration_has_tags','FreshdeskConfiguration','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerField','ServicenowAccount','FromId','ToId','ProjectId','SmsQueues','team_has_whatsapp_queues','HopperBlacks','TrunkId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromUserId','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAccount','FromAgent','ToChatQueueId','ToQueue','ToChatWebsiteId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CmCustomField','CustomFields','Queues','voice_queues_has_cm_lists','UserProfileSection','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId','lodash','determine','sequelize','defaultsDeep','motion2','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','sequelizeHistory','xcall','options','database','username','password','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../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','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','OpenchannelApplication','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model'];(function(_0x5090ce,_0x311fbb){var _0x51344a=function(_0x4db676){while(--_0x4db676){_0x5090ce['push'](_0x5090ce['shift']());}};_0x51344a(++_0x311fbb);}(_0x22fb,0x192));var _0xb22f=function(_0x1830ef,_0x372e51){_0x1830ef=_0x1830ef-0x0;var _0x22c1ab=_0x22fb[_0x1830ef];return _0x22c1ab;};'use strict';var config=require('../config/environment');var Sequelize=require('sequelize');var _=require(_0xb22f('0x0'));var jstz=require('jstz');var timezone=jstz[_0xb22f('0x1')]();config[_0xb22f('0x2')]=_[_0xb22f('0x3')](config[_0xb22f('0x2')],{'database':_0xb22f('0x4'),'username':'xcall','password':_0xb22f('0x5'),'options':{'host':_0xb22f('0x6'),'port':0xcea,'dialect':_0xb22f('0x7'),'dialectOptions':{'charset':_0xb22f('0x8')},'logging':![],'timezone':timezone[_0xb22f('0x9')](),'define':{'charset':_0xb22f('0xa'),'collate':'utf8_general_ci'}}});config[_0xb22f('0xb')]=_[_0xb22f('0x3')](config[_0xb22f('0xb')],{'database':_0xb22f('0x4'),'username':_0xb22f('0xc'),'password':_0xb22f('0x5'),'options':{'host':_0xb22f('0x6'),'port':0xcea,'dialect':_0xb22f('0x7'),'dialectOptions':{'charset':_0xb22f('0x8')},'logging':![],'timezone':timezone[_0xb22f('0x9')](),'define':{'charset':_0xb22f('0xa'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0xb22f('0x2')]['username'],config['sequelize']['password'],config[_0xb22f('0x2')][_0xb22f('0xd')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xb22f('0xb')][_0xb22f('0xe')],config[_0xb22f('0xb')][_0xb22f('0xf')],config['sequelizeHistory'][_0xb22f('0x10')],config['sequelizeHistory'][_0xb22f('0xd')])};db['User']=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0x12'));db[_0xb22f('0x13')]=db[_0xb22f('0x2')]['import'](_0xb22f('0x14'));db['VoiceContext']=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0x15'));db[_0xb22f('0x16')]=db[_0xb22f('0x2')][_0xb22f('0x11')]('../api/voiceExtension/voiceExtension.model');db[_0xb22f('0x17')]=db['sequelize'][_0xb22f('0x11')](_0xb22f('0x18'));db[_0xb22f('0x19')]=db[_0xb22f('0x2')][_0xb22f('0x11')]('../api/voiceQueue/voiceQueue.model');db['VoiceRecording']=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0x1a'));db[_0xb22f('0x1b')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0x1c'));db[_0xb22f('0x1d')]=db['sequelize']['import'](_0xb22f('0x1e'));db[_0xb22f('0x1f')]=db['sequelize'][_0xb22f('0x11')](_0xb22f('0x20'));db['VoiceCallReport']=db[_0xb22f('0x2')][_0xb22f('0x11')]('../api/voiceCallReport/voiceCallReport.model');db[_0xb22f('0x21')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0x22'));db[_0xb22f('0x23')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0x24'));db['VoiceQueueReport']=db['sequelize']['import'](_0xb22f('0x25'));db['MemberReport']=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0x26'));db[_0xb22f('0x27')]=db[_0xb22f('0x2')]['import']('../api/trunk/trunk.model');db[_0xb22f('0x28')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0x29'));db['UserVoiceQueueRt']=db[_0xb22f('0x2')][_0xb22f('0x11')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0xb22f('0x2a')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0x2b'));db[_0xb22f('0x2c')]=db['sequelize']['import'](_0xb22f('0x2d'));db[_0xb22f('0x2e')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0x2f'));db[_0xb22f('0x30')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0x31'));db['UserSmsQueue']=db[_0xb22f('0x2')]['import']('../api/userSmsQueue/userSmsQueue.model');db[_0xb22f('0x32')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0x33'));db[_0xb22f('0x34')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0x35'));db[_0xb22f('0x36')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0x37'));db[_0xb22f('0x38')]=db['sequelize']['import'](_0xb22f('0x39'));db[_0xb22f('0x3a')]=db[_0xb22f('0x2')]['import'](_0xb22f('0x3b'));db[_0xb22f('0x3c')]=db['sequelize']['import'](_0xb22f('0x3d'));db['MailSubstatus']=db[_0xb22f('0x2')]['import'](_0xb22f('0x3e'));db[_0xb22f('0x3f')]=db[_0xb22f('0x2')]['import'](_0xb22f('0x40'));db[_0xb22f('0x41')]=db[_0xb22f('0x2')]['import'](_0xb22f('0x42'));db[_0xb22f('0x43')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0x44'));db[_0xb22f('0x45')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0x46'));db[_0xb22f('0x47')]=db['sequelize'][_0xb22f('0x11')](_0xb22f('0x48'));db['DashboardItem']=db[_0xb22f('0x2')]['import']('../api/dashboardItem/dashboardItem.model');db[_0xb22f('0x49')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0x4a'));db['FaxApplication']=db[_0xb22f('0x2')]['import'](_0xb22f('0x4b'));db[_0xb22f('0x4c')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0x4d'));db[_0xb22f('0x4e')]=db['sequelize'][_0xb22f('0x11')]('../api/faxMessage/faxMessage.model');db[_0xb22f('0x4f')]=db[_0xb22f('0x2')]['import'](_0xb22f('0x50'));db[_0xb22f('0x51')]=db['sequelize']['import'](_0xb22f('0x52'));db['SmsAccount']=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0x53'));db[_0xb22f('0x54')]=db['sequelize'][_0xb22f('0x11')](_0xb22f('0x55'));db['SmsInteraction']=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0x56'));db[_0xb22f('0x57')]=db[_0xb22f('0x2')]['import'](_0xb22f('0x58'));db['SmsQueue']=db['sequelize'][_0xb22f('0x11')](_0xb22f('0x59'));db[_0xb22f('0x5a')]=db[_0xb22f('0x2')][_0xb22f('0x11')]('../api/openchannelAccount/openchannelAccount.model');db[_0xb22f('0x5b')]=db['sequelize'][_0xb22f('0x11')]('../api/openchannelApplication/openchannelApplication.model');db[_0xb22f('0x5c')]=db[_0xb22f('0x2')][_0xb22f('0x11')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0xb22f('0x5d')]=db[_0xb22f('0x2')]['import'](_0xb22f('0x5e'));db[_0xb22f('0x5f')]=db['sequelize']['import'](_0xb22f('0x60'));db[_0xb22f('0x61')]=db['sequelize'][_0xb22f('0x11')](_0xb22f('0x62'));db['OpenchannelQueueReport']=db['sequelize'][_0xb22f('0x11')](_0xb22f('0x63'));db['ChatApplication']=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0x64'));db[_0xb22f('0x65')]=db['sequelize'][_0xb22f('0x11')](_0xb22f('0x66'));db['ChatMessage']=db['sequelize'][_0xb22f('0x11')](_0xb22f('0x67'));db[_0xb22f('0x68')]=db[_0xb22f('0x2')]['import'](_0xb22f('0x69'));db[_0xb22f('0x6a')]=db['sequelize'][_0xb22f('0x11')](_0xb22f('0x6b'));db[_0xb22f('0x6c')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0x6d'));db[_0xb22f('0x6e')]=db['sequelize'][_0xb22f('0x11')](_0xb22f('0x6f'));db[_0xb22f('0x70')]=db[_0xb22f('0x2')][_0xb22f('0x11')]('../api/cmCompany/cmCompany.model');db['CmContact']=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0x71'));db['CmHopper']=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0x72'));db[_0xb22f('0x73')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0x74'));db[_0xb22f('0x75')]=db['sequelize']['import'](_0xb22f('0x76'));db[_0xb22f('0x77')]=db['sequelize']['import'](_0xb22f('0x78'));db[_0xb22f('0x79')]=db['sequelize']['import'](_0xb22f('0x7a'));db['CmCustomField']=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0x7b'));db['Action']=db['sequelize'][_0xb22f('0x11')]('../api/action/action.model');db[_0xb22f('0x7c')]=db[_0xb22f('0x2')][_0xb22f('0x11')]('../api/automation/automation.model');db['CannedAnswer']=db[_0xb22f('0x2')]['import'](_0xb22f('0x7d'));db[_0xb22f('0x7e')]=db[_0xb22f('0x2')]['import'](_0xb22f('0x7f'));db['Condition']=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0x80'));db[_0xb22f('0x81')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0x82'));db[_0xb22f('0x83')]=db[_0xb22f('0x2')]['import'](_0xb22f('0x84'));db[_0xb22f('0x85')]=db[_0xb22f('0x2')]['import'](_0xb22f('0x86'));db[_0xb22f('0x87')]=db[_0xb22f('0x2')][_0xb22f('0x11')]('../api/voiceQueuesLog/voiceQueuesLog.model');db['Schedule']=db[_0xb22f('0x2')]['import'](_0xb22f('0x88'));db[_0xb22f('0x89')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0x8a'));db[_0xb22f('0x8b')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0x8c'));db[_0xb22f('0x8d')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0x8e'));db['Trigger']=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0x8f'));db[_0xb22f('0x90')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0x91'));db[_0xb22f('0x92')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0x93'));db[_0xb22f('0x94')]=db['sequelize']['import']('../api/integrationReport/integrationReport.model');db[_0xb22f('0x95')]=db[_0xb22f('0x2')]['import'](_0xb22f('0x96'));db[_0xb22f('0x97')]=db['sequelize'][_0xb22f('0x11')](_0xb22f('0x98'));db[_0xb22f('0x99')]=db[_0xb22f('0x2')][_0xb22f('0x11')]('../api/analyticExtractedReport/analyticExtractedReport.model');db['AnalyticMetric']=db['sequelize'][_0xb22f('0x11')](_0xb22f('0x9a'));db[_0xb22f('0x9b')]=db['sequelize'][_0xb22f('0x11')](_0xb22f('0x9c'));db['AnalyticTreeReport']=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0x9d'));db[_0xb22f('0x9e')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0x9f'));db[_0xb22f('0xa0')]=db[_0xb22f('0x2')][_0xb22f('0x11')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0xb22f('0xa1')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0xa2'));db[_0xb22f('0xa3')]=db[_0xb22f('0x2')][_0xb22f('0x11')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0xb22f('0xa4')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0xa5'));db[_0xb22f('0xa6')]=db[_0xb22f('0x2')]['import'](_0xb22f('0xa7'));db[_0xb22f('0xa8')]=db['sequelize'][_0xb22f('0x11')]('../api/intDeskAccount/intDeskAccount.model');db['DeskConfiguration']=db['sequelize'][_0xb22f('0x11')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0xb22f('0xa9')]=db['sequelize']['import'](_0xb22f('0xaa'));db[_0xb22f('0xab')]=db['sequelize']['import'](_0xb22f('0xac'));db[_0xb22f('0xad')]=db['sequelize'][_0xb22f('0x11')]('../api/intZohoConfiguration/intZohoConfiguration.model');db['ZohoField']=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0xae'));db['ZendeskAccount']=db['sequelize']['import'](_0xb22f('0xaf'));db[_0xb22f('0xb0')]=db[_0xb22f('0x2')][_0xb22f('0x11')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0xb22f('0xb1')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0xb2'));db[_0xb22f('0xb3')]=db['sequelize'][_0xb22f('0x11')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0xb4'));db['FreshdeskField']=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0xb5'));db[_0xb22f('0xb6')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0xb7'));db[_0xb22f('0xb8')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0xb9'));db['VtigerField']=db['sequelize'][_0xb22f('0x11')](_0xb22f('0xba'));db['ServicenowAccount']=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0xbb'));db[_0xb22f('0xbc')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0xbd'));db[_0xb22f('0xbe')]=db['sequelize'][_0xb22f('0x11')](_0xb22f('0xbf'));db[_0xb22f('0xc0')]=db['sequelize'][_0xb22f('0x11')](_0xb22f('0xc1'));db[_0xb22f('0xc2')]=db['sequelize'][_0xb22f('0x11')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0xb22f('0xc3')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0xc4'));db[_0xb22f('0xc5')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0xc6'));db[_0xb22f('0xc7')]=db['sequelize'][_0xb22f('0x11')](_0xb22f('0xc8'));db[_0xb22f('0xc9')]=db['sequelize'][_0xb22f('0x11')]('../api/intFreshsalesField/intFreshsalesField.model');db['Integration']=db['sequelize'][_0xb22f('0x11')](_0xb22f('0x93'));db[_0xb22f('0xca')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0xcb'));db[_0xb22f('0xcc')]=db['sequelize'][_0xb22f('0x11')](_0xb22f('0xcd'));db[_0xb22f('0xce')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0xcf'));db[_0xb22f('0xd0')]=db[_0xb22f('0x2')]['import'](_0xb22f('0xd1'));db[_0xb22f('0xd2')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0xd3'));db[_0xb22f('0xd4')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0xd5'));db[_0xb22f('0xd6')]=db[_0xb22f('0x2')]['import'](_0xb22f('0xd7'));db['SquareReport']=db[_0xb22f('0x2')][_0xb22f('0x11')]('../api/squareReport/squareReport.model');db['SquareDetailsReport']=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0xd8'));db[_0xb22f('0xd9')]=db[_0xb22f('0x2')][_0xb22f('0x11')]('../api/jscriptyProject/jscriptyProject.model');db[_0xb22f('0xda')]=db['sequelize'][_0xb22f('0x11')]('../api/setting/setting.model');db['SquareOdbc']=db[_0xb22f('0x2')]['import'](_0xb22f('0xdb'));db[_0xb22f('0xdc')]=db[_0xb22f('0x2')]['import'](_0xb22f('0xdd'));db[_0xb22f('0xde')]=db[_0xb22f('0x2')][_0xb22f('0x11')]('../api/squareRecording/squareRecording.model');db[_0xb22f('0xdf')]=db[_0xb22f('0x2')]['import']('../api/squareMessage/squareMessage.model');db[_0xb22f('0xe0')]=db[_0xb22f('0x2')]['import']('../api/team/team.model');db[_0xb22f('0xe1')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0xe2'));db['Campaign']=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0xe3'));db[_0xb22f('0xe4')]=db[_0xb22f('0x2')][_0xb22f('0x11')]('../api/migration/migration.model');db[_0xb22f('0xe5')]=db['sequelize']['import'](_0xb22f('0xe6'));db['Plugin']=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0xe7'));db[_0xb22f('0xe8')]=db['sequelize'][_0xb22f('0x11')](_0xb22f('0xe9'));db[_0xb22f('0xea')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0xeb'));db[_0xb22f('0xec')]=db['sequelize']['import'](_0xb22f('0xed'));db['OpenchannelTransferReport']=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0xee'));db[_0xb22f('0xef')]=db[_0xb22f('0x2')][_0xb22f('0x11')]('../api/smsTransferReport/smsTransferReport.model');db[_0xb22f('0xf0')]=db[_0xb22f('0x2')][_0xb22f('0x11')]('../api/cmList/cmList.model');db['VoicePrefix']=db[_0xb22f('0x2')]['import']('../api/voicePrefix/voicePrefix.model');db[_0xb22f('0xf1')]=db[_0xb22f('0x2')][_0xb22f('0x11')]('../api/userProfile/userProfile.model');db['UserProfileSection']=db[_0xb22f('0x2')][_0xb22f('0x11')]('../api/userProfileSection/userProfileSection.model');db['UserProfileResource']=db['sequelize'][_0xb22f('0x11')](_0xb22f('0xf2'));db[_0xb22f('0xf3')]=db[_0xb22f('0x2')]['import'](_0xb22f('0xf4'));db['WhatsappAccount']=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0xf5'));db[_0xb22f('0xf6')]=db[_0xb22f('0x2')]['import']('../api/whatsappApplication/whatsappApplication.model');db[_0xb22f('0xf7')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0xf8'));db['WhatsappMessage']=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0xf9'));db[_0xb22f('0xfa')]=db[_0xb22f('0x2')]['import']('../api/whatsappQueueReport/whatsappQueueReport.model');db['WhatsappTransferReport']=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0xfb'));db['WhatsappQueue']=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0xfc'));db[_0xb22f('0xfd')]=db[_0xb22f('0x2')][_0xb22f('0x11')](_0xb22f('0xfe'));db['TeamVoiceQueue']=db['sequelize']['import'](_0xb22f('0xff'));db[_0xb22f('0x100')]=db['sequelize'][_0xb22f('0x11')](_0xb22f('0x101'));db[_0xb22f('0x102')]=db[_0xb22f('0x2')]['import'](_0xb22f('0x103'));db[_0xb22f('0x104')]['hasOne'](db[_0xb22f('0x1d')],{'as':_0xb22f('0x1d'),'onDelete':_0xb22f('0x105'),'foreignKey':_0xb22f('0x106')});db[_0xb22f('0x104')][_0xb22f('0x107')](db[_0xb22f('0x108')],{'as':'Recordings','foreignKey':_0xb22f('0x106')});db['User'][_0xb22f('0x107')](db[_0xb22f('0x109')],{'as':_0xb22f('0x10a'),'foreignKey':_0xb22f('0x106')});db[_0xb22f('0x104')][_0xb22f('0x107')](db[_0xb22f('0x16')],{'as':_0xb22f('0x10b'),'onDelete':'cascade','hooks':!![]});db[_0xb22f('0x104')][_0xb22f('0x107')](db[_0xb22f('0x75')],{'as':_0xb22f('0x10c'),'foreignKey':'UserId'});db[_0xb22f('0x104')][_0xb22f('0x107')](db[_0xb22f('0x77')],{'as':_0xb22f('0x10d'),'foreignKey':_0xb22f('0x106')});db[_0xb22f('0x104')]['hasMany'](db['ReportAgentPreview'],{'as':_0xb22f('0x79'),'foreignKey':_0xb22f('0x106')});db[_0xb22f('0x104')]['hasMany'](db['OpenchannelInteraction'],{'as':_0xb22f('0x10e'),'foreignKey':_0xb22f('0x106')});db[_0xb22f('0x104')]['hasMany'](db['ChatInteraction'],{'as':_0xb22f('0x10f'),'foreignKey':_0xb22f('0x106')});db[_0xb22f('0x104')][_0xb22f('0x107')](db[_0xb22f('0x110')],{'as':'SmsInteractions','foreignKey':'UserId'});db[_0xb22f('0x104')][_0xb22f('0x107')](db[_0xb22f('0x4c')],{'as':_0xb22f('0x111'),'foreignKey':'UserId'});db[_0xb22f('0x104')][_0xb22f('0x107')](db[_0xb22f('0x3f')],{'as':_0xb22f('0x112'),'foreignKey':_0xb22f('0x106')});db['User']['hasMany'](db['WhatsappInteraction'],{'as':_0xb22f('0x113'),'foreignKey':_0xb22f('0x106')});db[_0xb22f('0x104')][_0xb22f('0x107')](db[_0xb22f('0xf3')],{'as':_0xb22f('0x114'),'foreignKey':_0xb22f('0x115')});db['User'][_0xb22f('0x116')](db[_0xb22f('0xf1')],{'as':_0xb22f('0xf1'),'foreignKey':_0xb22f('0x117')});db[_0xb22f('0x104')]['belongsToMany'](db[_0xb22f('0x6c')],{'as':'Groups','through':_0xb22f('0x118')});db[_0xb22f('0x104')][_0xb22f('0x119')](db[_0xb22f('0x11a')],{'as':_0xb22f('0x11b'),'through':_0xb22f('0x11c')});db['User'][_0xb22f('0x119')](db['CmList'],{'as':'Lists','through':'cm_user_has_lists'});db[_0xb22f('0x104')][_0xb22f('0x119')](db[_0xb22f('0xe0')],{'through':_0xb22f('0x11d')});db[_0xb22f('0x104')][_0xb22f('0x119')](db[_0xb22f('0x3f')],{'as':_0xb22f('0x112'),'through':_0xb22f('0x11e')});db[_0xb22f('0x104')][_0xb22f('0x119')](db['ChatInteraction'],{'as':_0xb22f('0x10f'),'through':_0xb22f('0x11f')});db[_0xb22f('0x104')][_0xb22f('0x119')](db['FaxInteraction'],{'as':_0xb22f('0x111'),'through':_0xb22f('0x120')});db[_0xb22f('0x104')][_0xb22f('0x119')](db[_0xb22f('0x110')],{'as':_0xb22f('0x121'),'through':'user_has_sms_interactions'});db[_0xb22f('0x104')][_0xb22f('0x119')](db[_0xb22f('0x5c')],{'as':_0xb22f('0x10e'),'through':_0xb22f('0x122')});db[_0xb22f('0x104')][_0xb22f('0x119')](db[_0xb22f('0xf7')],{'as':_0xb22f('0x113'),'through':_0xb22f('0x123')});db[_0xb22f('0x104')][_0xb22f('0x119')](db[_0xb22f('0x19')],{'as':_0xb22f('0x124'),'through':_0xb22f('0x2a'),'required':![]});db[_0xb22f('0x104')][_0xb22f('0x119')](db[_0xb22f('0x125')],{'as':_0xb22f('0x126'),'through':_0xb22f('0x102'),'required':![]});db[_0xb22f('0x104')][_0xb22f('0x119')](db[_0xb22f('0x3c')],{'as':_0xb22f('0x127'),'through':_0xb22f('0x2e'),'required':![]});db[_0xb22f('0x104')][_0xb22f('0x119')](db[_0xb22f('0x6a')],{'as':_0xb22f('0x128'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0xb22f('0x104')][_0xb22f('0x119')](db[_0xb22f('0x4f')],{'as':_0xb22f('0x129'),'through':_0xb22f('0x30'),'required':![]});db[_0xb22f('0x104')][_0xb22f('0x119')](db[_0xb22f('0x12a')],{'as':'SmsQueues','through':_0xb22f('0x12b'),'required':![]});db[_0xb22f('0x104')]['belongsToMany'](db[_0xb22f('0x5f')],{'as':_0xb22f('0x12c'),'through':_0xb22f('0x32'),'required':![]});db[_0xb22f('0x104')][_0xb22f('0x119')](db[_0xb22f('0x12d')],{'as':_0xb22f('0x12e'),'through':_0xb22f('0x34'),'required':![]});db[_0xb22f('0x104')][_0xb22f('0x119')](db[_0xb22f('0xf0')],{'through':_0xb22f('0x12f')});db[_0xb22f('0x104')][_0xb22f('0x119')](db[_0xb22f('0x61')],{'as':_0xb22f('0x130'),'through':_0xb22f('0x131')});db[_0xb22f('0x104')]['belongsToMany'](db['FaxAccount'],{'as':'FaxAccounts','through':_0xb22f('0x132')});db['User']['belongsToMany'](db[_0xb22f('0x3a')],{'as':'MailAccounts','through':_0xb22f('0x133')});db['User']['belongsToMany'](db[_0xb22f('0x5a')],{'as':_0xb22f('0x134'),'through':'user_has_openchannel_accounts'});db[_0xb22f('0x104')]['belongsToMany'](db[_0xb22f('0x135')],{'as':_0xb22f('0x136'),'through':_0xb22f('0x137')});db[_0xb22f('0x104')]['belongsToMany'](db[_0xb22f('0x138')],{'as':_0xb22f('0x139'),'through':_0xb22f('0x13a')});db['User']['belongsToMany'](db[_0xb22f('0xdc')],{'as':_0xb22f('0x13b'),'through':_0xb22f('0x13c')});db[_0xb22f('0x13')]['hasMany'](db[_0xb22f('0x16')],{'as':_0xb22f('0x13d'),'onDelete':_0xb22f('0x105'),'foreignKey':_0xb22f('0x13e')});db[_0xb22f('0x13f')]['hasMany'](db[_0xb22f('0x16')],{'onDelete':_0xb22f('0x105')});db[_0xb22f('0x16')][_0xb22f('0x107')](db[_0xb22f('0x16')],{'as':_0xb22f('0x140'),'onDelete':_0xb22f('0x105')});db['VoiceMusicOnHold']['belongsToMany'](db['Sound'],{'as':_0xb22f('0x141'),'through':_0xb22f('0x142')});db[_0xb22f('0x19')][_0xb22f('0x107')](db[_0xb22f('0x109')],{'as':'Members','foreignKey':_0xb22f('0x143')});db[_0xb22f('0x19')][_0xb22f('0x107')](db['CmHopper'],{'as':_0xb22f('0x144'),'foreignKey':_0xb22f('0x143')});db[_0xb22f('0x19')][_0xb22f('0x107')](db[_0xb22f('0x75')],{'as':_0xb22f('0x10c'),'foreignKey':_0xb22f('0x143')});db[_0xb22f('0x19')]['hasMany'](db[_0xb22f('0x77')],{'as':_0xb22f('0x145'),'foreignKey':'VoiceQueueId'});db[_0xb22f('0x19')][_0xb22f('0x107')](db[_0xb22f('0x79')],{'as':_0xb22f('0x79'),'foreignKey':_0xb22f('0x143')});db['VoiceQueue'][_0xb22f('0x107')](db[_0xb22f('0x73')],{'as':'HopperBlacks','foreignKey':'VoiceQueueId'});db[_0xb22f('0x19')][_0xb22f('0x107')](db[_0xb22f('0xd4')],{'as':_0xb22f('0x146'),'foreignKey':_0xb22f('0x143')});db['VoiceQueue'][_0xb22f('0x116')](db[_0xb22f('0x27')],{'as':_0xb22f('0x27'),'foreignKey':'TrunkId'});db[_0xb22f('0x19')][_0xb22f('0x116')](db[_0xb22f('0x27')],{'as':'TrunkBackup','foreignKey':_0xb22f('0x147')});db[_0xb22f('0x19')][_0xb22f('0x116')](db['Interval'],{'as':'Interval','foreignKey':_0xb22f('0x148')});db[_0xb22f('0x19')][_0xb22f('0x116')](db['Pause'],{'as':_0xb22f('0x149'),'foreignKey':_0xb22f('0x14a')});db['VoiceQueue']['belongsToMany'](db['CmList'],{'as':_0xb22f('0x14b'),'through':'voice_queues_has_cm_lists'});db['VoiceQueue'][_0xb22f('0x119')](db[_0xb22f('0x104')],{'as':_0xb22f('0x14c'),'through':'UserVoiceQueue'});db['VoiceQueue']['belongsToMany'](db[_0xb22f('0xe0')],{'as':_0xb22f('0x14d'),'through':_0xb22f('0x14e')});db[_0xb22f('0x19')]['belongsToMany'](db[_0xb22f('0xf0')],{'as':_0xb22f('0x14f'),'through':_0xb22f('0x150')});db['VoiceRecording'][_0xb22f('0x116')](db[_0xb22f('0x104')],{'as':'User','foreignKey':_0xb22f('0x106')});db[_0xb22f('0x1b')][_0xb22f('0x116')](db[_0xb22f('0x104')],{'as':_0xb22f('0x104'),'foreignKey':_0xb22f('0x106')});db[_0xb22f('0x1d')][_0xb22f('0x107')](db[_0xb22f('0x1f')],{'as':'Messages','onDelete':_0xb22f('0x105'),'foreignKey':_0xb22f('0x151'),'sourceKey':_0xb22f('0x152')});db[_0xb22f('0x1f')][_0xb22f('0x116')](db[_0xb22f('0x1d')],{'foreignKey':_0xb22f('0x151'),'targetKey':_0xb22f('0x152')});db[_0xb22f('0x153')][_0xb22f('0x107')](db['VoiceQueueReport'],{'as':_0xb22f('0x154'),'foreignKey':_0xb22f('0x155'),'constraints':![]});db[_0xb22f('0x153')][_0xb22f('0x107')](db[_0xb22f('0x23')],{'as':_0xb22f('0x156'),'foreignKey':_0xb22f('0x155'),'constraints':![]});db['VoiceCallReport'][_0xb22f('0x116')](db['User'],{'as':'User','foreignKey':_0xb22f('0x106')});db[_0xb22f('0x153')][_0xb22f('0x116')](db[_0xb22f('0x11a')],{'as':_0xb22f('0x157'),'foreignKey':_0xb22f('0x158')});db[_0xb22f('0x36')][_0xb22f('0x116')](db[_0xb22f('0x3a')],{'as':_0xb22f('0x3a'),'foreignKey':'MailAccountId'});db[_0xb22f('0x38')][_0xb22f('0x116')](db[_0xb22f('0x3a')],{'as':_0xb22f('0x3a'),'foreignKey':_0xb22f('0x159')});db[_0xb22f('0x3a')][_0xb22f('0x15a')](db[_0xb22f('0x36')],{'as':_0xb22f('0x15b'),'onDelete':_0xb22f('0x105')});db[_0xb22f('0x3a')]['hasOne'](db[_0xb22f('0x38')],{'as':'Smtp','onDelete':_0xb22f('0x105')});db[_0xb22f('0x3a')][_0xb22f('0x107')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xb22f('0x159'),'onDelete':_0xb22f('0x105')});db[_0xb22f('0x3a')][_0xb22f('0x107')](db[_0xb22f('0x15c')],{'as':'Answers','foreignKey':'MailAccountId'});db[_0xb22f('0x3a')][_0xb22f('0x107')](db[_0xb22f('0x41')],{'as':_0xb22f('0x15d'),'foreignKey':_0xb22f('0x159')});db[_0xb22f('0x3a')][_0xb22f('0x107')](db[_0xb22f('0x3f')],{'as':_0xb22f('0x15e')});db[_0xb22f('0x3a')][_0xb22f('0x107')](db['MailApplication'],{'as':_0xb22f('0x140')});db[_0xb22f('0x3a')][_0xb22f('0x116')](db[_0xb22f('0xf0')],{'as':_0xb22f('0x15f'),'foreignKey':'ListId'});db[_0xb22f('0x3a')]['belongsTo'](db[_0xb22f('0x8d')],{'as':'Template','foreignKey':_0xb22f('0x160')});db[_0xb22f('0x3a')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xb22f('0x14a')});db['MailAccount']['belongsToMany'](db[_0xb22f('0x104')],{'as':_0xb22f('0x14c'),'through':'user_has_mail_accounts'});db[_0xb22f('0x3c')][_0xb22f('0x119')](db[_0xb22f('0x104')],{'as':_0xb22f('0x14c'),'through':_0xb22f('0x2e')});db[_0xb22f('0x3c')][_0xb22f('0x119')](db['Team'],{'through':_0xb22f('0x161'),'as':'Teams'});db[_0xb22f('0x3f')]['hasMany'](db[_0xb22f('0x41')],{'as':_0xb22f('0x15d'),'onDelete':'cascade','foreignKey':_0xb22f('0x162')});db['MailInteraction'][_0xb22f('0x116')](db[_0xb22f('0x3a')],{'as':_0xb22f('0x163'),'foreignKey':_0xb22f('0x159')});db[_0xb22f('0x3f')][_0xb22f('0x116')](db[_0xb22f('0x11a')],{'as':_0xb22f('0x157'),'foreignKey':_0xb22f('0x158')});db[_0xb22f('0x3f')][_0xb22f('0x116')](db[_0xb22f('0x104')],{'as':_0xb22f('0x164'),'foreignKey':'UserId'});db[_0xb22f('0x3f')][_0xb22f('0x119')](db['Tag'],{'through':_0xb22f('0x165'),'as':_0xb22f('0x166')});db[_0xb22f('0x3f')]['belongsToMany'](db[_0xb22f('0x8b')],{'through':_0xb22f('0x165'),'as':_0xb22f('0x167')});db[_0xb22f('0x3f')]['belongsToMany'](db[_0xb22f('0x104')],{'as':_0xb22f('0x168'),'through':_0xb22f('0x11e'),'foreignKey':_0xb22f('0x162')});db[_0xb22f('0x41')]['hasMany'](db[_0xb22f('0xe5')],{'as':_0xb22f('0x169'),'onDelete':_0xb22f('0x105')});db[_0xb22f('0x41')][_0xb22f('0x116')](db[_0xb22f('0x104')],{'as':_0xb22f('0x104')});db['MailMessage'][_0xb22f('0x116')](db[_0xb22f('0x11a')],{'onDelete':'cascade','as':_0xb22f('0x157')});db[_0xb22f('0x41')][_0xb22f('0x116')](db[_0xb22f('0x3f')],{'as':'Interaction','foreignKey':'MailInteractionId'});db[_0xb22f('0x41')][_0xb22f('0x116')](db[_0xb22f('0x3a')],{'as':'Account','foreignKey':_0xb22f('0x159')});db[_0xb22f('0x41')][_0xb22f('0x116')](db[_0xb22f('0x61')],{'as':_0xb22f('0x61'),'foreignKey':_0xb22f('0x16a')});db[_0xb22f('0x41')][_0xb22f('0x116')](db[_0xb22f('0x68')],{'as':'ChatOfflineMessage','foreignKey':_0xb22f('0x16b')});db[_0xb22f('0x43')][_0xb22f('0x116')](db[_0xb22f('0x104')],{'onDelete':'restrict'});db[_0xb22f('0x43')][_0xb22f('0x116')](db[_0xb22f('0x3c')],{'onDelete':'restrict'});db[_0xb22f('0x43')][_0xb22f('0x116')](db['MailAccount'],{'onDelete':_0xb22f('0x16c')});db[_0xb22f('0x43')]['belongsTo'](db[_0xb22f('0x81')],{'onDelete':_0xb22f('0x16c'),'foreignKey':'IntervalId'});db[_0xb22f('0x43')][_0xb22f('0x116')](db[_0xb22f('0x8b')],{'onDelete':_0xb22f('0x16c'),'foreignKey':_0xb22f('0x16d')});db[_0xb22f('0x45')][_0xb22f('0x116')](db[_0xb22f('0x3a')],{});db[_0xb22f('0x45')]['belongsTo'](db[_0xb22f('0xf0')],{'as':_0xb22f('0x15f'),'foreignKey':_0xb22f('0x16e')});db[_0xb22f('0x45')]['belongsTo'](db[_0xb22f('0x11a')],{'as':_0xb22f('0x157'),'foreignKey':_0xb22f('0x158')});db[_0xb22f('0x45')][_0xb22f('0x116')](db['MailInteraction'],{});db['MailQueueReport'][_0xb22f('0x116')](db[_0xb22f('0x41')],{});db[_0xb22f('0x45')][_0xb22f('0x116')](db['User'],{});db[_0xb22f('0x45')][_0xb22f('0x116')](db[_0xb22f('0x3c')],{});db[_0xb22f('0x47')][_0xb22f('0x107')](db[_0xb22f('0x16f')],{'as':'Items','onDelete':_0xb22f('0x105')});db[_0xb22f('0x49')][_0xb22f('0x107')](db['Disposition'],{'as':_0xb22f('0x170'),'foreignKey':_0xb22f('0x171'),'onDelete':_0xb22f('0x105')});db['FaxAccount'][_0xb22f('0x107')](db[_0xb22f('0x15c')],{'as':_0xb22f('0x172'),'foreignKey':_0xb22f('0x171')});db['FaxAccount'][_0xb22f('0x107')](db[_0xb22f('0x4c')],{'as':'Interactions'});db[_0xb22f('0x49')][_0xb22f('0x107')](db[_0xb22f('0x173')],{'as':'Applications'});db[_0xb22f('0x49')]['hasMany'](db[_0xb22f('0x16')],{'as':_0xb22f('0x174'),'onDelete':_0xb22f('0x105')});db['FaxAccount']['hasMany'](db['FaxMessage'],{'as':_0xb22f('0x15d')});db[_0xb22f('0x49')][_0xb22f('0x116')](db[_0xb22f('0x27')],{'as':_0xb22f('0x27')});db[_0xb22f('0x49')]['belongsTo'](db[_0xb22f('0xf0')],{'as':_0xb22f('0x15f'),'foreignKey':_0xb22f('0x16e')});db[_0xb22f('0x49')][_0xb22f('0x116')](db[_0xb22f('0x83')],{'as':_0xb22f('0x149'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xb22f('0x49')][_0xb22f('0x119')](db[_0xb22f('0x104')],{'as':_0xb22f('0x14c'),'through':'user_has_fax_accounts'});db[_0xb22f('0x173')][_0xb22f('0x116')](db[_0xb22f('0x104')],{'onDelete':'restrict'});db[_0xb22f('0x173')][_0xb22f('0x116')](db[_0xb22f('0x4f')],{'onDelete':_0xb22f('0x16c')});db['FaxApplication'][_0xb22f('0x116')](db[_0xb22f('0x49')],{'onDelete':'restrict'});db[_0xb22f('0x173')][_0xb22f('0x116')](db[_0xb22f('0x8b')],{'onDelete':'restrict','foreignKey':_0xb22f('0x16d')});db[_0xb22f('0x4c')][_0xb22f('0x107')](db['FaxMessage'],{'as':_0xb22f('0x15d'),'onDelete':_0xb22f('0x105'),'foreignKey':'FaxInteractionId'});db[_0xb22f('0x4c')][_0xb22f('0x116')](db['FaxAccount'],{'as':_0xb22f('0x163'),'foreignKey':'FaxAccountId'});db[_0xb22f('0x4c')][_0xb22f('0x116')](db[_0xb22f('0x11a')],{'as':_0xb22f('0x157'),'foreignKey':_0xb22f('0x158')});db['FaxInteraction'][_0xb22f('0x116')](db['User'],{'as':_0xb22f('0x164'),'foreignKey':'UserId'});db[_0xb22f('0x4c')][_0xb22f('0x119')](db[_0xb22f('0x8b')],{'through':_0xb22f('0x175'),'as':_0xb22f('0x166')});db[_0xb22f('0x4c')]['belongsToMany'](db[_0xb22f('0x8b')],{'through':'fax_interaction_has_tags','as':'ThroughTags'});db[_0xb22f('0x4c')]['belongsToMany'](db[_0xb22f('0x104')],{'as':_0xb22f('0x168'),'through':_0xb22f('0x120'),'foreignKey':'FaxInteractionId'});db['FaxMessage'][_0xb22f('0x116')](db[_0xb22f('0x104')],{'onDelete':_0xb22f('0x105'),'as':_0xb22f('0x104')});db[_0xb22f('0x4e')][_0xb22f('0x116')](db['FaxInteraction'],{'as':'Interaction','foreignKey':'FaxInteractionId'});db['FaxMessage']['belongsTo'](db[_0xb22f('0x11a')],{'onDelete':_0xb22f('0x105'),'as':_0xb22f('0x157')});db[_0xb22f('0x4e')]['belongsTo'](db[_0xb22f('0xe5')],{'as':_0xb22f('0xe5'),'foreignKey':'AttachmentId'});db['FaxMessage']['belongsTo'](db[_0xb22f('0x49')],{'as':'Account','foreignKey':_0xb22f('0x171')});db['FaxQueue'][_0xb22f('0x119')](db[_0xb22f('0x104')],{'as':'Agents','through':'UserFaxQueue'});db[_0xb22f('0x4f')][_0xb22f('0x119')](db['Team'],{'through':_0xb22f('0x176'),'as':_0xb22f('0x14d')});db[_0xb22f('0x51')]['belongsTo'](db[_0xb22f('0x49')],{});db['FaxQueueReport'][_0xb22f('0x116')](db[_0xb22f('0xf0')],{'as':'List','foreignKey':_0xb22f('0x16e')});db['FaxQueueReport'][_0xb22f('0x116')](db['CmContact'],{'as':_0xb22f('0x157'),'foreignKey':'ContactId'});db[_0xb22f('0x51')][_0xb22f('0x116')](db['FaxInteraction'],{});db[_0xb22f('0x51')]['belongsTo'](db['FaxMessage'],{});db[_0xb22f('0x51')]['belongsTo'](db[_0xb22f('0x104')],{});db['FaxQueueReport'][_0xb22f('0x116')](db[_0xb22f('0x4f')],{});db[_0xb22f('0x135')][_0xb22f('0x107')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xb22f('0x177'),'onDelete':_0xb22f('0x105')});db[_0xb22f('0x135')][_0xb22f('0x107')](db[_0xb22f('0x15c')],{'as':'Answers','foreignKey':_0xb22f('0x177')});db[_0xb22f('0x135')][_0xb22f('0x107')](db[_0xb22f('0x57')],{'as':_0xb22f('0x15d'),'foreignKey':'SmsAccountId'});db[_0xb22f('0x135')][_0xb22f('0x107')](db[_0xb22f('0x110')],{'as':'Interactions'});db[_0xb22f('0x135')][_0xb22f('0x107')](db[_0xb22f('0x54')],{'as':'Applications'});db[_0xb22f('0x135')][_0xb22f('0x116')](db[_0xb22f('0xf0')],{'as':_0xb22f('0x15f'),'foreignKey':_0xb22f('0x16e')});db[_0xb22f('0x135')][_0xb22f('0x116')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xb22f('0x14a')});db['SmsAccount'][_0xb22f('0x119')](db['User'],{'as':_0xb22f('0x14c'),'through':_0xb22f('0x137')});db[_0xb22f('0x54')]['belongsTo'](db['User'],{'onDelete':_0xb22f('0x16c')});db[_0xb22f('0x54')]['belongsTo'](db[_0xb22f('0x12a')],{'onDelete':_0xb22f('0x16c')});db[_0xb22f('0x54')][_0xb22f('0x116')](db[_0xb22f('0x135')],{'onDelete':_0xb22f('0x16c')});db[_0xb22f('0x54')]['belongsTo'](db['Interval'],{'onDelete':_0xb22f('0x16c'),'foreignKey':_0xb22f('0x148')});db[_0xb22f('0x54')][_0xb22f('0x116')](db['Tag'],{'onDelete':_0xb22f('0x16c'),'foreignKey':'TagId'});db['SmsInteraction'][_0xb22f('0x107')](db['SmsMessage'],{'as':_0xb22f('0x15d'),'onDelete':_0xb22f('0x105'),'foreignKey':_0xb22f('0x178')});db['SmsInteraction']['belongsTo'](db[_0xb22f('0x135')],{'as':_0xb22f('0x163'),'foreignKey':_0xb22f('0x177')});db[_0xb22f('0x110')][_0xb22f('0x116')](db[_0xb22f('0x11a')],{'as':_0xb22f('0x157'),'foreignKey':_0xb22f('0x158')});db['SmsInteraction'][_0xb22f('0x116')](db[_0xb22f('0x104')],{'as':_0xb22f('0x164'),'foreignKey':_0xb22f('0x106')});db['SmsInteraction'][_0xb22f('0x119')](db[_0xb22f('0x8b')],{'through':_0xb22f('0x179'),'as':_0xb22f('0x166')});db[_0xb22f('0x110')][_0xb22f('0x119')](db[_0xb22f('0x8b')],{'through':_0xb22f('0x179'),'as':_0xb22f('0x167')});db['SmsInteraction'][_0xb22f('0x119')](db[_0xb22f('0x104')],{'as':_0xb22f('0x168'),'through':_0xb22f('0x17a'),'foreignKey':_0xb22f('0x178')});db[_0xb22f('0x57')][_0xb22f('0x116')](db[_0xb22f('0x104')],{'as':_0xb22f('0x104')});db[_0xb22f('0x57')][_0xb22f('0x116')](db[_0xb22f('0x11a')],{'onDelete':'cascade','as':'Contact'});db[_0xb22f('0x57')][_0xb22f('0x116')](db['SmsInteraction'],{'onDelete':_0xb22f('0x105'),'as':_0xb22f('0x17b'),'foreignKey':'SmsInteractionId'});db[_0xb22f('0x57')]['belongsTo'](db[_0xb22f('0x135')],{'as':_0xb22f('0x163'),'foreignKey':_0xb22f('0x177')});db[_0xb22f('0x12a')][_0xb22f('0x119')](db[_0xb22f('0x104')],{'as':_0xb22f('0x14c'),'through':_0xb22f('0x12b'),'foreignKey':_0xb22f('0x17c')});db[_0xb22f('0x12a')][_0xb22f('0x119')](db['Team'],{'through':_0xb22f('0x17d'),'as':'Teams'});db[_0xb22f('0x5a')][_0xb22f('0x107')](db[_0xb22f('0x7e')],{'as':_0xb22f('0x170'),'foreignKey':'OpenchannelAccountId','onDelete':_0xb22f('0x105')});db[_0xb22f('0x5a')][_0xb22f('0x107')](db[_0xb22f('0x15c')],{'as':'Answers','foreignKey':_0xb22f('0x17e')});db[_0xb22f('0x5a')][_0xb22f('0x107')](db[_0xb22f('0x5c')],{'as':'Interactions','foreignKey':_0xb22f('0x17e')});db[_0xb22f('0x5a')]['hasMany'](db[_0xb22f('0x5d')],{'as':_0xb22f('0x15d'),'foreignKey':_0xb22f('0x17e')});db['OpenchannelAccount'][_0xb22f('0x107')](db[_0xb22f('0x5b')],{'as':_0xb22f('0x140'),'foreignKey':'OpenchannelAccountId'});db[_0xb22f('0x5a')][_0xb22f('0x116')](db[_0xb22f('0xf0')],{'as':_0xb22f('0x15f'),'foreignKey':_0xb22f('0x16e')});db[_0xb22f('0x5a')]['belongsTo'](db[_0xb22f('0x83')],{'as':_0xb22f('0x149'),'foreignKey':_0xb22f('0x14a')});db[_0xb22f('0x5a')][_0xb22f('0x119')](db[_0xb22f('0x104')],{'as':_0xb22f('0x14c'),'through':_0xb22f('0x17f')});db[_0xb22f('0x5b')][_0xb22f('0x116')](db[_0xb22f('0x104')],{'onDelete':_0xb22f('0x16c')});db['OpenchannelApplication'][_0xb22f('0x116')](db[_0xb22f('0x5f')],{'onDelete':'restrict','foreignKey':'OpenchannelQueueId'});db[_0xb22f('0x5b')][_0xb22f('0x116')](db['OpenchannelAccount'],{'onDelete':_0xb22f('0x16c'),'foreignKey':_0xb22f('0x17e')});db[_0xb22f('0x5b')][_0xb22f('0x116')](db['Interval'],{'onDelete':_0xb22f('0x16c'),'foreignKey':'IntervalId'});db[_0xb22f('0x5b')]['belongsTo'](db[_0xb22f('0x8b')],{'onDelete':_0xb22f('0x16c'),'foreignKey':_0xb22f('0x16d')});db[_0xb22f('0x5c')][_0xb22f('0x107')](db[_0xb22f('0x5d')],{'as':_0xb22f('0x15d'),'onDelete':'cascade','foreignKey':_0xb22f('0x180')});db[_0xb22f('0x5c')][_0xb22f('0x116')](db[_0xb22f('0x5a')],{'as':_0xb22f('0x163'),'foreignKey':_0xb22f('0x17e')});db[_0xb22f('0x5c')][_0xb22f('0x116')](db['CmContact'],{'as':_0xb22f('0x157'),'foreignKey':_0xb22f('0x158')});db[_0xb22f('0x5c')][_0xb22f('0x116')](db[_0xb22f('0x104')],{'as':'Owner','foreignKey':_0xb22f('0x106')});db[_0xb22f('0x5c')][_0xb22f('0x119')](db[_0xb22f('0x8b')],{'through':_0xb22f('0x181'),'as':_0xb22f('0x166')});db[_0xb22f('0x5c')][_0xb22f('0x119')](db[_0xb22f('0x8b')],{'through':'openchannel_interaction_has_tags','as':'ThroughTags'});db[_0xb22f('0x5c')][_0xb22f('0x119')](db[_0xb22f('0x104')],{'as':'Users','through':_0xb22f('0x122'),'foreignKey':'OpenchannelInteractionId'});db[_0xb22f('0x5d')][_0xb22f('0x116')](db[_0xb22f('0x104')],{'onDelete':_0xb22f('0x105'),'as':_0xb22f('0x104')});db[_0xb22f('0x5d')]['belongsTo'](db[_0xb22f('0x11a')],{'onDelete':'cascade','as':_0xb22f('0x157')});db[_0xb22f('0x5d')][_0xb22f('0x116')](db[_0xb22f('0x5c')],{'onDelete':_0xb22f('0x105'),'as':_0xb22f('0x17b'),'foreignKey':_0xb22f('0x180')});db[_0xb22f('0x5d')]['belongsTo'](db[_0xb22f('0xe5')],{'as':_0xb22f('0xe5'),'foreignKey':_0xb22f('0x182')});db[_0xb22f('0x5d')][_0xb22f('0x116')](db[_0xb22f('0x5a')],{'as':_0xb22f('0x163'),'foreignKey':_0xb22f('0x17e')});db['OpenchannelQueue'][_0xb22f('0x119')](db[_0xb22f('0x104')],{'as':'Agents','through':_0xb22f('0x32'),'foreignKey':_0xb22f('0x183')});db[_0xb22f('0x5f')][_0xb22f('0x119')](db[_0xb22f('0xe0')],{'through':_0xb22f('0x184'),'as':_0xb22f('0x14d')});db[_0xb22f('0x61')]['hasMany'](db['Disposition'],{'as':_0xb22f('0x170'),'foreignKey':_0xb22f('0x16a'),'onDelete':_0xb22f('0x105')});db[_0xb22f('0x61')]['hasMany'](db[_0xb22f('0x15c')],{'as':'Answers','foreignKey':_0xb22f('0x16a')});db[_0xb22f('0x61')][_0xb22f('0x107')](db[_0xb22f('0x6e')],{'as':_0xb22f('0x185')});db[_0xb22f('0x61')][_0xb22f('0x107')](db[_0xb22f('0x65')],{'as':_0xb22f('0x15e')});db[_0xb22f('0x61')]['hasMany'](db['ChatApplication'],{'as':'Applications'});db[_0xb22f('0x61')][_0xb22f('0x107')](db[_0xb22f('0x186')],{'as':_0xb22f('0x15d')});db[_0xb22f('0x61')]['belongsTo'](db[_0xb22f('0xf0')],{'as':_0xb22f('0x15f'),'foreignKey':_0xb22f('0x16e')});db[_0xb22f('0x61')][_0xb22f('0x116')](db[_0xb22f('0x81')],{'as':_0xb22f('0x81'),'foreignKey':_0xb22f('0x148')});db[_0xb22f('0x61')][_0xb22f('0x116')](db[_0xb22f('0x3a')],{'as':_0xb22f('0x3a'),'foreignKey':'MailAccountId'});db[_0xb22f('0x61')][_0xb22f('0x116')](db[_0xb22f('0x83')],{'as':_0xb22f('0x149'),'foreignKey':_0xb22f('0x14a')});db['ChatWebsite'][_0xb22f('0x119')](db[_0xb22f('0x104')],{'as':'Agents','through':_0xb22f('0x131')});db[_0xb22f('0x187')][_0xb22f('0x116')](db[_0xb22f('0x5a')],{});db[_0xb22f('0x187')][_0xb22f('0x116')](db[_0xb22f('0xf0')],{'as':'List','foreignKey':'ListId'});db[_0xb22f('0x187')][_0xb22f('0x116')](db['CmContact'],{'as':'Contact','foreignKey':_0xb22f('0x158')});db['OpenchannelQueueReport'][_0xb22f('0x116')](db[_0xb22f('0x5c')],{});db[_0xb22f('0x187')][_0xb22f('0x116')](db[_0xb22f('0x5d')],{});db[_0xb22f('0x187')][_0xb22f('0x116')](db['User'],{});db[_0xb22f('0x187')][_0xb22f('0x116')](db['OpenchannelQueue'],{});db[_0xb22f('0x188')][_0xb22f('0x116')](db[_0xb22f('0x104')],{'as':_0xb22f('0x189'),'foreignKey':_0xb22f('0x106'),'onDelete':_0xb22f('0x16c')});db[_0xb22f('0x188')][_0xb22f('0x116')](db[_0xb22f('0x6a')],{'as':_0xb22f('0x18a'),'foreignKey':_0xb22f('0x18b'),'onDelete':'restrict'});db['ChatApplication'][_0xb22f('0x116')](db[_0xb22f('0x61')],{'as':_0xb22f('0x18c'),'foreignKey':_0xb22f('0x16a'),'onDelete':'restrict'});db['ChatApplication'][_0xb22f('0x116')](db[_0xb22f('0x8b')],{'onDelete':_0xb22f('0x16c'),'foreignKey':_0xb22f('0x16d')});db[_0xb22f('0x65')][_0xb22f('0x107')](db[_0xb22f('0x186')],{'as':_0xb22f('0x15d'),'onDelete':_0xb22f('0x105'),'foreignKey':_0xb22f('0x18d')});db[_0xb22f('0x65')][_0xb22f('0x116')](db['ChatWebsite'],{'as':'Account','foreignKey':_0xb22f('0x16a')});db['ChatInteraction']['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xb22f('0x158')});db[_0xb22f('0x65')]['belongsTo'](db['User'],{'as':_0xb22f('0x164'),'foreignKey':_0xb22f('0x106')});db[_0xb22f('0x65')][_0xb22f('0x119')](db[_0xb22f('0x8b')],{'through':_0xb22f('0x18e'),'as':_0xb22f('0x166')});db[_0xb22f('0x65')][_0xb22f('0x119')](db[_0xb22f('0x8b')],{'through':_0xb22f('0x18e'),'as':'ThroughTags'});db[_0xb22f('0x65')][_0xb22f('0x119')](db[_0xb22f('0x104')],{'as':_0xb22f('0x168'),'through':_0xb22f('0x11f'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0xb22f('0x116')](db[_0xb22f('0x104')],{'onDelete':_0xb22f('0x105'),'as':_0xb22f('0x104')});db[_0xb22f('0x186')][_0xb22f('0x116')](db['CmContact'],{'onDelete':_0xb22f('0x105'),'as':_0xb22f('0x157'),'foreignKey':'ContactId'});db[_0xb22f('0x186')]['belongsTo'](db[_0xb22f('0x65')],{'onDelete':_0xb22f('0x105'),'as':_0xb22f('0x17b'),'foreignKey':_0xb22f('0x18d')});db[_0xb22f('0x186')][_0xb22f('0x116')](db[_0xb22f('0xe5')],{'as':_0xb22f('0xe5'),'foreignKey':_0xb22f('0x182')});db['ChatMessage'][_0xb22f('0x116')](db[_0xb22f('0x61')],{'as':_0xb22f('0x163'),'foreignKey':_0xb22f('0x16a')});db[_0xb22f('0x68')]['hasMany'](db['Attachment'],{'as':'Attachments','foreignKey':_0xb22f('0x16b'),'onDelete':_0xb22f('0x105'),'hooks':!![]});db[_0xb22f('0x68')][_0xb22f('0x116')](db[_0xb22f('0x11a')],{'onDelete':_0xb22f('0x105'),'as':_0xb22f('0x157'),'foreignKey':_0xb22f('0x158')});db['ChatOfflineMessage'][_0xb22f('0x116')](db['ChatWebsite'],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0xb22f('0x6a')][_0xb22f('0x119')](db[_0xb22f('0x104')],{'as':'Agents','through':_0xb22f('0x2c'),'hooks':!![]});db[_0xb22f('0x6a')]['belongsToMany'](db['Team'],{'through':_0xb22f('0x18f'),'as':_0xb22f('0x14d')});db[_0xb22f('0x6c')][_0xb22f('0x107')](db['ChatInternalMessage'],{'as':_0xb22f('0x15d'),'foreignKey':_0xb22f('0x190'),'onDelete':'cascade'});db['ChatGroup']['belongsToMany'](db[_0xb22f('0x104')],{'as':_0xb22f('0x191'),'through':_0xb22f('0x118')});db[_0xb22f('0x6e')][_0xb22f('0x116')](db[_0xb22f('0x61')],{'as':'Website','foreignKey':_0xb22f('0x16a')});db['CmCompany'][_0xb22f('0x107')](db[_0xb22f('0x11a')],{'as':_0xb22f('0x11b'),'foreignKey':'CompanyId'});db[_0xb22f('0x11a')][_0xb22f('0x107')](db[_0xb22f('0x192')],{'as':_0xb22f('0x144'),'foreignKey':_0xb22f('0x158')});db[_0xb22f('0x11a')][_0xb22f('0x107')](db[_0xb22f('0x75')],{'as':_0xb22f('0x10c'),'foreignKey':_0xb22f('0x158')});db[_0xb22f('0x11a')][_0xb22f('0x107')](db[_0xb22f('0x77')],{'as':_0xb22f('0x145'),'foreignKey':'ContactId'});db['CmContact'][_0xb22f('0x107')](db['ReportAgentPreview'],{'as':_0xb22f('0x79'),'foreignKey':_0xb22f('0x158')});db[_0xb22f('0x11a')][_0xb22f('0x107')](db[_0xb22f('0xd4')],{'as':_0xb22f('0x146'),'foreignKey':'ContactId'});db[_0xb22f('0x11a')][_0xb22f('0x107')](db[_0xb22f('0x5c')],{'as':_0xb22f('0x10e'),'foreignKey':_0xb22f('0x158'),'onDelete':_0xb22f('0x16c')});db[_0xb22f('0x11a')]['hasMany'](db[_0xb22f('0x65')],{'as':_0xb22f('0x10f'),'foreignKey':_0xb22f('0x158'),'onDelete':'restrict'});db[_0xb22f('0x11a')][_0xb22f('0x107')](db[_0xb22f('0x110')],{'as':_0xb22f('0x121'),'foreignKey':_0xb22f('0x158'),'onDelete':_0xb22f('0x16c')});db[_0xb22f('0x11a')][_0xb22f('0x107')](db[_0xb22f('0x4c')],{'as':_0xb22f('0x111'),'foreignKey':'ContactId','onDelete':_0xb22f('0x16c')});db['CmContact'][_0xb22f('0x107')](db['MailInteraction'],{'as':_0xb22f('0x112'),'foreignKey':'ContactId','onDelete':'restrict'});db['CmContact']['belongsTo'](db['CmCompany'],{'as':_0xb22f('0x193'),'foreignKey':_0xb22f('0x194')});db['CmContact'][_0xb22f('0x116')](db[_0xb22f('0xf0')],{'as':_0xb22f('0x15f'),'foreignKey':_0xb22f('0x16e'),'onDelete':_0xb22f('0x105')});db[_0xb22f('0x11a')][_0xb22f('0x119')](db[_0xb22f('0x104')],{'as':_0xb22f('0x168'),'through':'cm_user_has_contacts'});db[_0xb22f('0x11a')][_0xb22f('0x119')](db[_0xb22f('0x8b')],{'as':_0xb22f('0x166'),'through':_0xb22f('0x195')});db[_0xb22f('0x11a')][_0xb22f('0x119')](db[_0xb22f('0x8b')],{'through':_0xb22f('0x195'),'as':_0xb22f('0x167')});db[_0xb22f('0x192')][_0xb22f('0x116')](db['CmContact'],{'as':_0xb22f('0x157'),'foreignKey':'ContactId','onDelete':_0xb22f('0x105')});db[_0xb22f('0x192')][_0xb22f('0x116')](db[_0xb22f('0xf0')],{'as':'List','foreignKey':_0xb22f('0x16e'),'onDelete':_0xb22f('0x105')});db[_0xb22f('0x192')]['belongsTo'](db[_0xb22f('0x104')],{'as':_0xb22f('0x189'),'foreignKey':'UserId'});db['CmHopper'][_0xb22f('0x116')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0xb22f('0x143'),'onDelete':_0xb22f('0x105')});db[_0xb22f('0x192')][_0xb22f('0x116')](db[_0xb22f('0x196')],{'as':_0xb22f('0x196'),'foreignKey':_0xb22f('0x197'),'onDelete':_0xb22f('0x105')});db[_0xb22f('0x192')][_0xb22f('0x116')](db['User'],{'as':_0xb22f('0x164'),'foreignKey':'OwnerId'});db[_0xb22f('0x73')][_0xb22f('0x116')](db[_0xb22f('0x11a')],{'as':_0xb22f('0x157'),'foreignKey':_0xb22f('0x158'),'onDelete':'cascade'});db[_0xb22f('0x73')][_0xb22f('0x116')](db[_0xb22f('0xf0')],{'as':_0xb22f('0x15f'),'foreignKey':'ListId','onDelete':_0xb22f('0x105')});db[_0xb22f('0x73')][_0xb22f('0x116')](db[_0xb22f('0x19')],{'as':_0xb22f('0x18a'),'foreignKey':_0xb22f('0x143'),'onDelete':'cascade'});db['CmHopperBlack']['belongsTo'](db[_0xb22f('0x196')],{'as':_0xb22f('0x196'),'foreignKey':_0xb22f('0x197'),'onDelete':_0xb22f('0x105')});db[_0xb22f('0x7c')][_0xb22f('0x107')](db[_0xb22f('0x198')],{'as':{'plural':_0xb22f('0x199'),'singular':_0xb22f('0x19a')},'foreignKey':_0xb22f('0x19b'),'onDelete':_0xb22f('0x105'),'hooks':!![]});db['Automation'][_0xb22f('0x107')](db[_0xb22f('0x198')],{'as':{'plural':_0xb22f('0x19c'),'singular':_0xb22f('0x19d')},'foreignKey':'AutomationAnyId','onDelete':'cascade','hooks':!![]});db[_0xb22f('0x7c')][_0xb22f('0x107')](db['Action'],{'as':_0xb22f('0x19e'),'foreignKey':_0xb22f('0x19f'),'onDelete':'cascade','hooks':!![]});db['Disposition']['hasMany'](db[_0xb22f('0x7e')],{'as':_0xb22f('0x170'),'foreignKey':'ParentId','onDelete':'cascade'});db[_0xb22f('0x81')][_0xb22f('0x107')](db[_0xb22f('0x81')],{'as':_0xb22f('0x1a0'),'foreignKey':_0xb22f('0x148'),'onDelete':_0xb22f('0x105'),'hooks':!![],'required':![]});db[_0xb22f('0x81')]['hasMany'](db['VoiceExtension'],{'as':_0xb22f('0x10b'),'foreignKey':_0xb22f('0x148'),'onDelete':_0xb22f('0x16c')});db['Interval'][_0xb22f('0x107')](db[_0xb22f('0x43')],{'as':_0xb22f('0x1a1'),'foreignKey':_0xb22f('0x148')});db[_0xb22f('0x81')][_0xb22f('0x107')](db[_0xb22f('0x188')],{'as':_0xb22f('0x1a2'),'foreignKey':'IntervalId'});db[_0xb22f('0x81')]['hasMany'](db['FaxApplication'],{'as':_0xb22f('0x1a3'),'foreignKey':_0xb22f('0x148')});db['Interval'][_0xb22f('0x107')](db[_0xb22f('0x54')],{'as':'SmsApplications','foreignKey':'IntervalId'});db['Schedule'][_0xb22f('0x116')](db[_0xb22f('0x3a')],{});db[_0xb22f('0x1a4')][_0xb22f('0x116')](db[_0xb22f('0x97')],{'foreignKey':_0xb22f('0x1a5')});db[_0xb22f('0x1a4')]['belongsTo'](db[_0xb22f('0x95')],{'foreignKey':_0xb22f('0x1a6')});db[_0xb22f('0x89')]['belongsToMany'](db[_0xb22f('0x17')],{'as':_0xb22f('0x1a7'),'through':_0xb22f('0x142'),'onDelete':_0xb22f('0x16c')});db['Tag'][_0xb22f('0x119')](db[_0xb22f('0x11a')],{'through':_0xb22f('0x195')});db[_0xb22f('0x8b')]['belongsToMany'](db[_0xb22f('0x65')],{'through':'chat_interaction_has_tags'});db['Tag'][_0xb22f('0x119')](db[_0xb22f('0x3f')],{'through':_0xb22f('0x165')});db[_0xb22f('0x8b')][_0xb22f('0x119')](db[_0xb22f('0x110')],{'through':_0xb22f('0x179')});db[_0xb22f('0x8b')][_0xb22f('0x119')](db[_0xb22f('0x4c')],{'through':_0xb22f('0x175')});db['Tag'][_0xb22f('0x119')](db['OpenchannelInteraction'],{'through':_0xb22f('0x181')});db[_0xb22f('0x8b')][_0xb22f('0x119')](db[_0xb22f('0xf7')],{'through':_0xb22f('0x1a8')});db[_0xb22f('0x1a9')][_0xb22f('0x107')](db['Condition'],{'as':{'plural':'AllConditions','singular':'AllCondition'},'foreignKey':_0xb22f('0x1aa'),'onDelete':_0xb22f('0x105'),'hooks':!![]});db['Trigger'][_0xb22f('0x107')](db['Condition'],{'as':{'plural':_0xb22f('0x1ab'),'singular':'AnyCondition'},'foreignKey':_0xb22f('0x1ac'),'onDelete':'cascade','hooks':!![]});db[_0xb22f('0x1a9')][_0xb22f('0x107')](db[_0xb22f('0x1ad')],{'as':_0xb22f('0x19e'),'foreignKey':_0xb22f('0x1ae'),'onDelete':_0xb22f('0x105'),'hooks':!![]});db[_0xb22f('0x95')][_0xb22f('0x107')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0xb22f('0x105'),'foreignKey':_0xb22f('0x1a6'),'hooks':!![]});db[_0xb22f('0x97')][_0xb22f('0x107')](db[_0xb22f('0x9b')],{'as':_0xb22f('0x1af'),'onDelete':_0xb22f('0x105'),'foreignKey':'DefaultReportId'});db['AnalyticMetric'][_0xb22f('0x107')](db[_0xb22f('0x9b')],{'as':'Fields','onDelete':_0xb22f('0x105'),'foreignKey':'MetricId'});db[_0xb22f('0x9b')][_0xb22f('0x116')](db['AnalyticMetric'],{'foreignKey':_0xb22f('0x1b0')});db[_0xb22f('0x9e')]['hasMany'](db[_0xb22f('0xa0')],{'as':_0xb22f('0x1b1'),'onDelete':_0xb22f('0x105'),'foreignKey':_0xb22f('0x1b2')});db[_0xb22f('0xa0')][_0xb22f('0x107')](db[_0xb22f('0xa1')],{'as':_0xb22f('0x1b3'),'onDelete':_0xb22f('0x105'),'foreignKey':'SubjectId'});db[_0xb22f('0xa0')][_0xb22f('0x107')](db['SalesforceField'],{'as':_0xb22f('0x1b4'),'onDelete':_0xb22f('0x105'),'foreignKey':'DescriptionId'});db[_0xb22f('0xa0')]['hasMany'](db['SalesforceField'],{'as':_0xb22f('0x1af'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0xb22f('0xa0')]['belongsTo'](db[_0xb22f('0x9e')],{'as':_0xb22f('0x163'),'foreignKey':_0xb22f('0x1b2')});db['SalesforceField']['hasMany'](db[_0xb22f('0xa1')],{'as':_0xb22f('0x1b5'),'foreignKey':_0xb22f('0x1b6')});db[_0xb22f('0xa1')]['hasMany'](db[_0xb22f('0xa1')],{'as':_0xb22f('0x1b7'),'foreignKey':_0xb22f('0x1b8')});db[_0xb22f('0xa1')][_0xb22f('0x107')](db[_0xb22f('0xa1')],{'as':_0xb22f('0x1b9'),'foreignKey':_0xb22f('0x1ba')});db[_0xb22f('0xa1')]['belongsTo'](db[_0xb22f('0x90')],{'as':_0xb22f('0x90'),'foreignKey':'VariableId'});db[_0xb22f('0xa3')][_0xb22f('0x107')](db[_0xb22f('0xa4')],{'as':_0xb22f('0x1b1'),'onDelete':_0xb22f('0x105'),'foreignKey':'AccountId'});db['SugarcrmConfiguration'][_0xb22f('0x107')](db['SugarcrmField'],{'as':_0xb22f('0x1b3'),'onDelete':_0xb22f('0x105'),'foreignKey':_0xb22f('0x1b6')});db['SugarcrmConfiguration'][_0xb22f('0x107')](db[_0xb22f('0xa6')],{'as':_0xb22f('0x1b4'),'onDelete':_0xb22f('0x105'),'foreignKey':_0xb22f('0x1b8')});db[_0xb22f('0xa4')]['hasMany'](db[_0xb22f('0xa6')],{'as':_0xb22f('0x1af'),'onDelete':'cascade','foreignKey':_0xb22f('0x1ba')});db[_0xb22f('0xa4')][_0xb22f('0x116')](db[_0xb22f('0xa3')],{'as':_0xb22f('0x163'),'foreignKey':_0xb22f('0x1b2')});db[_0xb22f('0xa6')][_0xb22f('0x107')](db[_0xb22f('0xa6')],{'as':_0xb22f('0x1b5'),'foreignKey':_0xb22f('0x1b6')});db['SugarcrmField']['hasMany'](db[_0xb22f('0xa6')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xb22f('0xa6')][_0xb22f('0x107')](db['SugarcrmField'],{'as':_0xb22f('0x1b9'),'foreignKey':_0xb22f('0x1ba')});db[_0xb22f('0xa6')][_0xb22f('0x116')](db[_0xb22f('0x90')],{'as':'Variable','foreignKey':_0xb22f('0x1bb')});db['DeskAccount'][_0xb22f('0x107')](db[_0xb22f('0x1bc')],{'as':_0xb22f('0x1b1'),'onDelete':_0xb22f('0x105'),'foreignKey':'AccountId'});db[_0xb22f('0x1bc')][_0xb22f('0x107')](db[_0xb22f('0xa9')],{'as':'Subjects','onDelete':_0xb22f('0x105'),'foreignKey':_0xb22f('0x1b6')});db[_0xb22f('0x1bc')][_0xb22f('0x107')](db[_0xb22f('0xa9')],{'as':'Descriptions','onDelete':_0xb22f('0x105'),'foreignKey':_0xb22f('0x1b8')});db[_0xb22f('0x1bc')]['hasMany'](db[_0xb22f('0xa9')],{'as':_0xb22f('0x1af'),'onDelete':_0xb22f('0x105'),'foreignKey':_0xb22f('0x1ba')});db[_0xb22f('0x1bc')][_0xb22f('0x116')](db[_0xb22f('0xa8')],{'as':_0xb22f('0x163'),'foreignKey':'AccountId'});db[_0xb22f('0x1bc')][_0xb22f('0x119')](db[_0xb22f('0x8b')],{'through':_0xb22f('0x1bd')});db[_0xb22f('0xa9')][_0xb22f('0x107')](db[_0xb22f('0xa9')],{'as':_0xb22f('0x1b5'),'foreignKey':_0xb22f('0x1b6')});db[_0xb22f('0xa9')]['hasMany'](db[_0xb22f('0xa9')],{'as':'Description','foreignKey':_0xb22f('0x1b8')});db['DeskField']['hasMany'](db[_0xb22f('0xa9')],{'as':_0xb22f('0x1b9'),'foreignKey':_0xb22f('0x1ba')});db[_0xb22f('0xa9')][_0xb22f('0x116')](db[_0xb22f('0x90')],{'as':_0xb22f('0x90'),'foreignKey':'VariableId'});db[_0xb22f('0xab')][_0xb22f('0x107')](db[_0xb22f('0xad')],{'as':_0xb22f('0x1b1'),'onDelete':_0xb22f('0x105'),'foreignKey':_0xb22f('0x1b2')});db[_0xb22f('0xad')][_0xb22f('0x107')](db[_0xb22f('0x1be')],{'as':'Subjects','onDelete':_0xb22f('0x105'),'foreignKey':_0xb22f('0x1b6')});db[_0xb22f('0xad')][_0xb22f('0x107')](db[_0xb22f('0x1be')],{'as':_0xb22f('0x1b4'),'onDelete':'cascade','foreignKey':_0xb22f('0x1b8')});db[_0xb22f('0xad')][_0xb22f('0x107')](db[_0xb22f('0x1be')],{'as':_0xb22f('0x1af'),'onDelete':'cascade','foreignKey':_0xb22f('0x1ba')});db['ZohoConfiguration'][_0xb22f('0x116')](db[_0xb22f('0xab')],{'as':_0xb22f('0x163'),'foreignKey':_0xb22f('0x1b2')});db['ZohoField'][_0xb22f('0x107')](db[_0xb22f('0x1be')],{'as':_0xb22f('0x1b5'),'foreignKey':'SubjectId'});db[_0xb22f('0x1be')][_0xb22f('0x107')](db[_0xb22f('0x1be')],{'as':_0xb22f('0x1b7'),'foreignKey':_0xb22f('0x1b8')});db[_0xb22f('0x1be')][_0xb22f('0x107')](db[_0xb22f('0x1be')],{'as':_0xb22f('0x1b9'),'foreignKey':'FieldId'});db['ZohoField']['belongsTo'](db[_0xb22f('0x90')],{'as':_0xb22f('0x90'),'foreignKey':'VariableId'});db['ZendeskAccount'][_0xb22f('0x107')](db['ZendeskConfiguration'],{'as':_0xb22f('0x1b1'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xb22f('0xb0')][_0xb22f('0x107')](db['ZendeskField'],{'as':_0xb22f('0x1b3'),'foreignKey':'SubjectId'});db[_0xb22f('0xb0')]['hasMany'](db[_0xb22f('0xb1')],{'as':_0xb22f('0x1b4'),'foreignKey':_0xb22f('0x1b8')});db[_0xb22f('0xb0')][_0xb22f('0x107')](db[_0xb22f('0xb1')],{'as':'Fields','foreignKey':_0xb22f('0x1ba')});db['ZendeskConfiguration']['belongsTo'](db[_0xb22f('0x1bf')],{'as':_0xb22f('0x163'),'foreignKey':_0xb22f('0x1b2')});db[_0xb22f('0xb0')][_0xb22f('0x119')](db[_0xb22f('0x8b')],{'through':_0xb22f('0x1c0')});db[_0xb22f('0xb1')]['hasMany'](db[_0xb22f('0xb1')],{'as':'Subject','foreignKey':_0xb22f('0x1b6')});db[_0xb22f('0xb1')][_0xb22f('0x107')](db[_0xb22f('0xb1')],{'as':_0xb22f('0x1b7'),'foreignKey':_0xb22f('0x1b8')});db['ZendeskField'][_0xb22f('0x107')](db[_0xb22f('0xb1')],{'as':_0xb22f('0x1b9'),'foreignKey':_0xb22f('0x1ba')});db['ZendeskField'][_0xb22f('0x116')](db['Variable'],{'as':_0xb22f('0x90'),'foreignKey':_0xb22f('0x1bb')});db[_0xb22f('0xb3')]['hasMany'](db[_0xb22f('0x1c1')],{'as':_0xb22f('0x1b1'),'onDelete':'cascade','foreignKey':_0xb22f('0x1b2')});db[_0xb22f('0x1c1')]['hasMany'](db[_0xb22f('0x1c2')],{'as':'Subjects','onDelete':_0xb22f('0x105'),'foreignKey':_0xb22f('0x1b6')});db[_0xb22f('0x1c1')][_0xb22f('0x107')](db[_0xb22f('0x1c2')],{'as':_0xb22f('0x1b4'),'onDelete':_0xb22f('0x105'),'foreignKey':'DescriptionId'});db[_0xb22f('0x1c1')][_0xb22f('0x107')](db['FreshdeskField'],{'as':_0xb22f('0x1af'),'onDelete':_0xb22f('0x105'),'foreignKey':_0xb22f('0x1ba')});db[_0xb22f('0x1c1')][_0xb22f('0x116')](db[_0xb22f('0xb3')],{'as':_0xb22f('0x163'),'foreignKey':_0xb22f('0x1b2')});db[_0xb22f('0x1c1')][_0xb22f('0x119')](db[_0xb22f('0x8b')],{'through':_0xb22f('0x1c3')});db[_0xb22f('0x1c2')][_0xb22f('0x107')](db[_0xb22f('0x1c2')],{'as':_0xb22f('0x1b5'),'foreignKey':'SubjectId'});db[_0xb22f('0x1c2')]['hasMany'](db[_0xb22f('0x1c2')],{'as':_0xb22f('0x1b7'),'foreignKey':_0xb22f('0x1b8')});db[_0xb22f('0x1c2')][_0xb22f('0x107')](db[_0xb22f('0x1c2')],{'as':'Field','foreignKey':_0xb22f('0x1ba')});db['FreshdeskField'][_0xb22f('0x116')](db[_0xb22f('0x90')],{'as':_0xb22f('0x90'),'foreignKey':_0xb22f('0x1bb')});db[_0xb22f('0xb6')][_0xb22f('0x107')](db['VtigerConfiguration'],{'as':_0xb22f('0x1b1'),'onDelete':_0xb22f('0x105'),'foreignKey':_0xb22f('0x1b2')});db[_0xb22f('0xb8')]['hasMany'](db[_0xb22f('0x1c4')],{'as':_0xb22f('0x1b3'),'foreignKey':_0xb22f('0x1b6')});db[_0xb22f('0xb8')][_0xb22f('0x107')](db['VtigerField'],{'as':_0xb22f('0x1b4'),'foreignKey':_0xb22f('0x1b8')});db['VtigerConfiguration'][_0xb22f('0x107')](db[_0xb22f('0x1c4')],{'as':_0xb22f('0x1af'),'foreignKey':_0xb22f('0x1ba')});db[_0xb22f('0xb8')]['belongsTo'](db[_0xb22f('0xb6')],{'as':_0xb22f('0x163'),'foreignKey':_0xb22f('0x1b2')});db[_0xb22f('0x1c4')][_0xb22f('0x107')](db[_0xb22f('0x1c4')],{'as':_0xb22f('0x1b5'),'foreignKey':'SubjectId'});db[_0xb22f('0x1c4')]['hasMany'](db[_0xb22f('0x1c4')],{'as':_0xb22f('0x1b7'),'foreignKey':'DescriptionId'});db['VtigerField'][_0xb22f('0x107')](db['VtigerField'],{'as':'Field','foreignKey':_0xb22f('0x1ba')});db[_0xb22f('0x1c4')][_0xb22f('0x116')](db['Variable'],{'as':_0xb22f('0x90'),'foreignKey':'VariableId'});db[_0xb22f('0x1c5')][_0xb22f('0x107')](db['ServicenowConfiguration'],{'as':_0xb22f('0x1b1'),'onDelete':_0xb22f('0x105'),'foreignKey':_0xb22f('0x1b2')});db[_0xb22f('0xbc')][_0xb22f('0x107')](db[_0xb22f('0xbe')],{'as':_0xb22f('0x1b3'),'foreignKey':_0xb22f('0x1b6')});db[_0xb22f('0xbc')][_0xb22f('0x107')](db[_0xb22f('0xbe')],{'as':_0xb22f('0x1b4'),'foreignKey':_0xb22f('0x1b8')});db[_0xb22f('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0xb22f('0x1af'),'foreignKey':_0xb22f('0x1ba')});db[_0xb22f('0xbc')][_0xb22f('0x116')](db[_0xb22f('0x1c5')],{'as':'Account','foreignKey':'AccountId'});db['ServicenowField'][_0xb22f('0x107')](db['ServicenowField'],{'as':_0xb22f('0x1b5'),'foreignKey':_0xb22f('0x1b6')});db[_0xb22f('0xbe')][_0xb22f('0x107')](db[_0xb22f('0xbe')],{'as':_0xb22f('0x1b7'),'foreignKey':'DescriptionId'});db['ServicenowField'][_0xb22f('0x107')](db[_0xb22f('0xbe')],{'as':_0xb22f('0x1b9'),'foreignKey':'FieldId'});db[_0xb22f('0xbe')][_0xb22f('0x116')](db[_0xb22f('0x90')],{'as':_0xb22f('0x90'),'foreignKey':'VariableId'});db['Dynamics365Account']['hasMany'](db['Dynamics365Configuration'],{'as':_0xb22f('0x1b1'),'onDelete':_0xb22f('0x105'),'foreignKey':_0xb22f('0x1b2')});db[_0xb22f('0xc2')][_0xb22f('0x107')](db[_0xb22f('0xc3')],{'as':_0xb22f('0x1b3'),'onDelete':_0xb22f('0x105'),'foreignKey':_0xb22f('0x1b6')});db[_0xb22f('0xc2')][_0xb22f('0x107')](db[_0xb22f('0xc3')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0xb22f('0x1b8')});db[_0xb22f('0xc2')]['hasMany'](db[_0xb22f('0xc3')],{'as':_0xb22f('0x1af'),'onDelete':_0xb22f('0x105'),'foreignKey':'FieldId'});db[_0xb22f('0xc2')][_0xb22f('0x116')](db[_0xb22f('0xc0')],{'as':_0xb22f('0x163'),'foreignKey':_0xb22f('0x1b2')});db[_0xb22f('0xc3')]['hasMany'](db[_0xb22f('0xc3')],{'as':_0xb22f('0x1b5'),'foreignKey':_0xb22f('0x1b6')});db[_0xb22f('0xc3')][_0xb22f('0x107')](db[_0xb22f('0xc3')],{'as':_0xb22f('0x1b7'),'foreignKey':_0xb22f('0x1b8')});db[_0xb22f('0xc3')]['hasMany'](db[_0xb22f('0xc3')],{'as':_0xb22f('0x1b9'),'foreignKey':_0xb22f('0x1ba')});db['Dynamics365Field'][_0xb22f('0x116')](db[_0xb22f('0x90')],{'as':'Variable','foreignKey':'VariableId'});db['FreshsalesAccount'][_0xb22f('0x107')](db['FreshsalesConfiguration'],{'as':_0xb22f('0x1b1'),'onDelete':_0xb22f('0x105'),'foreignKey':'AccountId'});db[_0xb22f('0xc7')]['hasMany'](db['FreshsalesField'],{'as':_0xb22f('0x1b3'),'foreignKey':'SubjectId'});db[_0xb22f('0xc7')][_0xb22f('0x107')](db['FreshsalesField'],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0xb22f('0xc7')]['hasMany'](db[_0xb22f('0xc9')],{'as':_0xb22f('0x1af'),'foreignKey':_0xb22f('0x1ba')});db[_0xb22f('0xc7')][_0xb22f('0x116')](db[_0xb22f('0xc5')],{'as':_0xb22f('0x163'),'foreignKey':'AccountId'});db[_0xb22f('0xc9')][_0xb22f('0x107')](db[_0xb22f('0xc9')],{'as':'Subject','foreignKey':_0xb22f('0x1b6')});db[_0xb22f('0xc9')][_0xb22f('0x107')](db[_0xb22f('0xc9')],{'as':_0xb22f('0x1b7'),'foreignKey':_0xb22f('0x1b8')});db[_0xb22f('0xc9')][_0xb22f('0x107')](db[_0xb22f('0xc9')],{'as':'Field','foreignKey':_0xb22f('0x1ba')});db[_0xb22f('0xc9')]['belongsTo'](db[_0xb22f('0x90')],{'as':'Variable','foreignKey':_0xb22f('0x1bb')});db[_0xb22f('0xcc')][_0xb22f('0x116')](db[_0xb22f('0x61')],{});db[_0xb22f('0xcc')][_0xb22f('0x116')](db[_0xb22f('0xf0')],{'as':_0xb22f('0x15f'),'foreignKey':_0xb22f('0x16e')});db[_0xb22f('0xcc')][_0xb22f('0x116')](db[_0xb22f('0x11a')],{'as':_0xb22f('0x157'),'foreignKey':_0xb22f('0x158')});db['ChatQueueReport'][_0xb22f('0x116')](db[_0xb22f('0x65')],{});db[_0xb22f('0xcc')][_0xb22f('0x116')](db[_0xb22f('0x186')],{});db[_0xb22f('0xcc')][_0xb22f('0x116')](db[_0xb22f('0x104')],{});db[_0xb22f('0xcc')][_0xb22f('0x116')](db[_0xb22f('0x6a')],{});db[_0xb22f('0xce')][_0xb22f('0x116')](db[_0xb22f('0x104')],{'onDelete':'cascade','foreignKey':_0xb22f('0x1c6')});db[_0xb22f('0xce')][_0xb22f('0x116')](db[_0xb22f('0x104')],{'onDelete':_0xb22f('0x105'),'foreignKey':_0xb22f('0x1c7')});db[_0xb22f('0xd4')][_0xb22f('0x107')](db['JscriptyQuestionReport'],{'foreignKey':'SessionId','onDelete':'cascade'});db['JscriptySessionReport'][_0xb22f('0x107')](db[_0xb22f('0xd0')],{'foreignKey':'SessionId','onDelete':_0xb22f('0x105')});db[_0xb22f('0xd6')]['belongsTo'](db['SmsAccount'],{});db[_0xb22f('0xd6')][_0xb22f('0x116')](db[_0xb22f('0xf0')],{'as':'List','foreignKey':_0xb22f('0x16e')});db[_0xb22f('0xd6')]['belongsTo'](db[_0xb22f('0x11a')],{'as':_0xb22f('0x157'),'foreignKey':'ContactId'});db[_0xb22f('0xd6')][_0xb22f('0x116')](db['SmsInteraction'],{});db[_0xb22f('0xd6')][_0xb22f('0x116')](db[_0xb22f('0x57')],{});db[_0xb22f('0xd6')][_0xb22f('0x116')](db[_0xb22f('0x104')],{});db[_0xb22f('0xd6')]['belongsTo'](db[_0xb22f('0x12a')],{});db['JscriptyProject'][_0xb22f('0x107')](db[_0xb22f('0xd4')],{'foreignKey':'ProjectId'});db[_0xb22f('0xd9')][_0xb22f('0x107')](db['JscriptyQuestionReport'],{'foreignKey':_0xb22f('0x1c8')});db[_0xb22f('0xd9')][_0xb22f('0x107')](db[_0xb22f('0xd0')],{'foreignKey':_0xb22f('0x1c8')});db[_0xb22f('0xdc')]['belongsToMany'](db[_0xb22f('0x104')],{'as':_0xb22f('0x168'),'through':'user_has_square_projects'});db[_0xb22f('0xe0')][_0xb22f('0x119')](db['User'],{'as':'Agents','through':_0xb22f('0x11d')});db[_0xb22f('0xe0')]['belongsToMany'](db[_0xb22f('0x19')],{'through':_0xb22f('0x14e'),'as':_0xb22f('0x124')});db['Team'][_0xb22f('0x119')](db[_0xb22f('0x3c')],{'through':_0xb22f('0x161'),'as':'MailQueues'});db[_0xb22f('0xe0')][_0xb22f('0x119')](db[_0xb22f('0x6a')],{'through':_0xb22f('0x18f'),'as':_0xb22f('0x128')});db[_0xb22f('0xe0')][_0xb22f('0x119')](db[_0xb22f('0x4f')],{'through':_0xb22f('0x176'),'as':_0xb22f('0x129')});db[_0xb22f('0xe0')][_0xb22f('0x119')](db[_0xb22f('0x12a')],{'through':'team_has_sms_queues','as':_0xb22f('0x1c9')});db['Team'][_0xb22f('0x119')](db[_0xb22f('0x5f')],{'through':_0xb22f('0x184'),'as':_0xb22f('0x12c')});db['Team'][_0xb22f('0x119')](db[_0xb22f('0x12d')],{'through':_0xb22f('0x1ca'),'as':_0xb22f('0x12e')});db[_0xb22f('0xe0')][_0xb22f('0x119')](db[_0xb22f('0x125')],{'through':'TeamVoicePrefix','as':'VoicePrefixes'});db[_0xb22f('0x196')][_0xb22f('0x107')](db['CmHopper'],{'as':_0xb22f('0x144'),'foreignKey':_0xb22f('0x197')});db[_0xb22f('0x196')][_0xb22f('0x107')](db['CmHopperFinal'],{'as':_0xb22f('0x10c'),'foreignKey':_0xb22f('0x197')});db['Campaign']['hasMany'](db['CmHopperHistory'],{'as':_0xb22f('0x145'),'foreignKey':_0xb22f('0x197')});db[_0xb22f('0x196')][_0xb22f('0x107')](db[_0xb22f('0x73')],{'as':_0xb22f('0x1cb'),'foreignKey':'CampaignId'});db['Campaign'][_0xb22f('0x116')](db[_0xb22f('0x27')],{'as':'Trunk','foreignKey':_0xb22f('0x1cc')});db['Campaign']['belongsTo'](db[_0xb22f('0x27')],{'as':'TrunkBackup','foreignKey':_0xb22f('0x147')});db['Campaign']['belongsTo'](db['Interval'],{'as':_0xb22f('0x81'),'foreignKey':_0xb22f('0x148')});db[_0xb22f('0x196')][_0xb22f('0x116')](db[_0xb22f('0xdc')],{'as':_0xb22f('0xdc'),'foreignKey':_0xb22f('0x1cd')});db[_0xb22f('0x196')]['belongsToMany'](db[_0xb22f('0xf0')],{'as':_0xb22f('0x14b'),'through':_0xb22f('0x1ce')});db[_0xb22f('0x196')][_0xb22f('0x119')](db[_0xb22f('0xf0')],{'as':_0xb22f('0x14f'),'through':_0xb22f('0x1cf')});db['Attachment'][_0xb22f('0x116')](db[_0xb22f('0x68')],{'as':_0xb22f('0x68'),'foreignKey':_0xb22f('0x16b')});db[_0xb22f('0xe8')][_0xb22f('0x116')](db[_0xb22f('0x41')],{});db[_0xb22f('0xe8')][_0xb22f('0x116')](db[_0xb22f('0x3f')],{});db[_0xb22f('0xe8')][_0xb22f('0x116')](db[_0xb22f('0x3a')],{'foreignKey':_0xb22f('0x1d0'),'as':'FromAccount'});db[_0xb22f('0xe8')]['belongsTo'](db[_0xb22f('0x104')],{'foreignKey':_0xb22f('0x1d1'),'as':'FromAgent'});db[_0xb22f('0xe8')][_0xb22f('0x116')](db[_0xb22f('0x104')],{'foreignKey':_0xb22f('0x1d2'),'as':_0xb22f('0x1d3')});db[_0xb22f('0xe8')][_0xb22f('0x116')](db['MailQueue'],{'foreignKey':_0xb22f('0x1d4'),'as':'ToQueue'});db[_0xb22f('0xe8')][_0xb22f('0x116')](db[_0xb22f('0x3a')],{'foreignKey':_0xb22f('0x1d5'),'as':_0xb22f('0x1d6')});db[_0xb22f('0xea')][_0xb22f('0x116')](db['ChatMessage'],{});db[_0xb22f('0xea')][_0xb22f('0x116')](db[_0xb22f('0x65')],{});db[_0xb22f('0xea')][_0xb22f('0x116')](db[_0xb22f('0x61')],{'foreignKey':_0xb22f('0x1d7'),'as':_0xb22f('0x1d8')});db[_0xb22f('0xea')][_0xb22f('0x116')](db[_0xb22f('0x104')],{'foreignKey':'FromUserId','as':_0xb22f('0x1d9')});db[_0xb22f('0xea')][_0xb22f('0x116')](db[_0xb22f('0x104')],{'foreignKey':_0xb22f('0x1d2'),'as':_0xb22f('0x1d3')});db[_0xb22f('0xea')][_0xb22f('0x116')](db['ChatQueue'],{'foreignKey':_0xb22f('0x1da'),'as':_0xb22f('0x1db')});db[_0xb22f('0xea')][_0xb22f('0x116')](db[_0xb22f('0x61')],{'foreignKey':_0xb22f('0x1dc'),'as':_0xb22f('0x1d6')});db['FaxTransferReport'][_0xb22f('0x116')](db['FaxMessage'],{});db[_0xb22f('0xec')]['belongsTo'](db['FaxInteraction'],{});db[_0xb22f('0xec')][_0xb22f('0x116')](db[_0xb22f('0x49')],{'foreignKey':'FromFaxAccountId','as':'FromAccount'});db[_0xb22f('0xec')]['belongsTo'](db[_0xb22f('0x104')],{'foreignKey':_0xb22f('0x1d1'),'as':_0xb22f('0x1d9')});db['FaxTransferReport']['belongsTo'](db[_0xb22f('0x104')],{'foreignKey':_0xb22f('0x1d2'),'as':'ToAgent'});db[_0xb22f('0xec')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0xb22f('0x1dd'),'as':_0xb22f('0x1db')});db[_0xb22f('0xec')]['belongsTo'](db['FaxAccount'],{'foreignKey':_0xb22f('0x1de'),'as':_0xb22f('0x1d6')});db['OpenchannelTransferReport'][_0xb22f('0x116')](db[_0xb22f('0x5d')],{});db[_0xb22f('0x1df')][_0xb22f('0x116')](db[_0xb22f('0x5c')],{});db[_0xb22f('0x1df')][_0xb22f('0x116')](db[_0xb22f('0x5a')],{'foreignKey':_0xb22f('0x1e0'),'as':_0xb22f('0x1d8')});db[_0xb22f('0x1df')]['belongsTo'](db['User'],{'foreignKey':_0xb22f('0x1d1'),'as':_0xb22f('0x1d9')});db[_0xb22f('0x1df')][_0xb22f('0x116')](db[_0xb22f('0x104')],{'foreignKey':_0xb22f('0x1d2'),'as':_0xb22f('0x1d3')});db[_0xb22f('0x1df')]['belongsTo'](db[_0xb22f('0x5f')],{'foreignKey':_0xb22f('0x1e1'),'as':_0xb22f('0x1db')});db[_0xb22f('0x1df')][_0xb22f('0x116')](db[_0xb22f('0x5a')],{'foreignKey':_0xb22f('0x1e2'),'as':_0xb22f('0x1d6')});db[_0xb22f('0xef')][_0xb22f('0x116')](db['SmsMessage'],{});db[_0xb22f('0xef')]['belongsTo'](db[_0xb22f('0x110')],{});db['SmsTransferReport'][_0xb22f('0x116')](db[_0xb22f('0x135')],{'foreignKey':_0xb22f('0x1e3'),'as':_0xb22f('0x1d8')});db['SmsTransferReport'][_0xb22f('0x116')](db[_0xb22f('0x104')],{'foreignKey':_0xb22f('0x1d1'),'as':_0xb22f('0x1d9')});db[_0xb22f('0xef')][_0xb22f('0x116')](db[_0xb22f('0x104')],{'foreignKey':_0xb22f('0x1d2'),'as':_0xb22f('0x1d3')});db[_0xb22f('0xef')][_0xb22f('0x116')](db[_0xb22f('0x12a')],{'foreignKey':_0xb22f('0x1e4'),'as':_0xb22f('0x1db')});db[_0xb22f('0xef')][_0xb22f('0x116')](db[_0xb22f('0x135')],{'foreignKey':_0xb22f('0x1e5'),'as':_0xb22f('0x1d6')});db[_0xb22f('0xf0')][_0xb22f('0x107')](db['Disposition'],{'as':'Dispositions','foreignKey':'ListId','onDelete':_0xb22f('0x105')});db[_0xb22f('0xf0')][_0xb22f('0x107')](db[_0xb22f('0x1e6')],{'as':_0xb22f('0x1e7'),'foreignKey':_0xb22f('0x16e')});db['CmList'][_0xb22f('0x107')](db[_0xb22f('0x11a')],{'as':_0xb22f('0x11b'),'onDelete':'cascade','foreignKey':_0xb22f('0x16e')});db[_0xb22f('0xf0')]['hasMany'](db[_0xb22f('0x75')],{'as':'HopperFinals','foreignKey':_0xb22f('0x16e')});db['CmList'][_0xb22f('0x107')](db[_0xb22f('0x77')],{'as':_0xb22f('0x10d'),'foreignKey':'ListId'});db[_0xb22f('0xf0')][_0xb22f('0x107')](db[_0xb22f('0x79')],{'as':'ReportAgentPreview','foreignKey':_0xb22f('0x16e')});db[_0xb22f('0xf0')][_0xb22f('0x119')](db[_0xb22f('0x19')],{'as':_0xb22f('0x1e8'),'through':_0xb22f('0x1e9')});db[_0xb22f('0xf0')]['belongsToMany'](db[_0xb22f('0x104')],{'as':_0xb22f('0x14c'),'through':_0xb22f('0x12f')});db[_0xb22f('0x125')]['hasMany'](db['VoiceExtension'],{'as':_0xb22f('0x10b'),'onDelete':'cascade'});db[_0xb22f('0x125')][_0xb22f('0x119')](db['User'],{'as':_0xb22f('0x14c'),'through':_0xb22f('0x102')});db[_0xb22f('0x125')][_0xb22f('0x119')](db[_0xb22f('0xe0')],{'through':'TeamVoicePrefix','as':'Teams'});db[_0xb22f('0xf1')]['hasMany'](db[_0xb22f('0x104')],{'as':'Users','foreignKey':'userProfileId'});db[_0xb22f('0xf1')][_0xb22f('0x107')](db[_0xb22f('0x1ea')],{'as':_0xb22f('0x1eb'),'foreignKey':_0xb22f('0x117'),'onDelete':_0xb22f('0x105')});db[_0xb22f('0x1ea')][_0xb22f('0x107')](db[_0xb22f('0x1ec')],{'as':_0xb22f('0x1ed'),'foreignKey':_0xb22f('0x1ee'),'onDelete':_0xb22f('0x105')});db[_0xb22f('0x138')][_0xb22f('0x107')](db[_0xb22f('0x7e')],{'as':_0xb22f('0x170'),'foreignKey':_0xb22f('0x1ef'),'onDelete':_0xb22f('0x105')});db[_0xb22f('0x138')][_0xb22f('0x107')](db[_0xb22f('0x15c')],{'as':'Answers','foreignKey':_0xb22f('0x1ef')});db['WhatsappAccount'][_0xb22f('0x107')](db[_0xb22f('0x1f0')],{'as':_0xb22f('0x15d'),'foreignKey':'WhatsappAccountId'});db[_0xb22f('0x138')][_0xb22f('0x107')](db[_0xb22f('0xf7')],{'as':'Interactions'});db[_0xb22f('0x138')][_0xb22f('0x107')](db[_0xb22f('0xf6')],{'as':_0xb22f('0x140')});db[_0xb22f('0x138')][_0xb22f('0x116')](db[_0xb22f('0xf0')],{'as':_0xb22f('0x15f'),'foreignKey':'ListId'});db['WhatsappAccount'][_0xb22f('0x116')](db[_0xb22f('0x83')],{'as':_0xb22f('0x149'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xb22f('0x138')][_0xb22f('0x119')](db[_0xb22f('0x104')],{'as':_0xb22f('0x14c'),'through':_0xb22f('0x13a')});db[_0xb22f('0xf6')][_0xb22f('0x116')](db[_0xb22f('0x104')],{'onDelete':_0xb22f('0x16c')});db['WhatsappApplication']['belongsTo'](db['WhatsappQueue'],{'onDelete':_0xb22f('0x16c')});db[_0xb22f('0xf6')][_0xb22f('0x116')](db[_0xb22f('0x138')],{'onDelete':_0xb22f('0x16c')});db[_0xb22f('0xf6')][_0xb22f('0x116')](db[_0xb22f('0x81')],{'onDelete':_0xb22f('0x16c'),'foreignKey':_0xb22f('0x148')});db['WhatsappApplication'][_0xb22f('0x116')](db[_0xb22f('0x8b')],{'onDelete':_0xb22f('0x16c'),'foreignKey':_0xb22f('0x16d')});db['WhatsappInteraction'][_0xb22f('0x107')](db[_0xb22f('0x1f0')],{'as':_0xb22f('0x15d'),'onDelete':_0xb22f('0x105'),'foreignKey':'WhatsappInteractionId'});db[_0xb22f('0xf7')][_0xb22f('0x116')](db['WhatsappAccount'],{'as':_0xb22f('0x163'),'foreignKey':_0xb22f('0x1ef')});db[_0xb22f('0xf7')][_0xb22f('0x116')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db['WhatsappInteraction'][_0xb22f('0x116')](db[_0xb22f('0x104')],{'as':_0xb22f('0x164'),'foreignKey':_0xb22f('0x106')});db[_0xb22f('0xf7')][_0xb22f('0x119')](db[_0xb22f('0x8b')],{'through':_0xb22f('0x1a8'),'as':_0xb22f('0x166')});db[_0xb22f('0xf7')][_0xb22f('0x119')](db['Tag'],{'through':_0xb22f('0x1a8'),'as':_0xb22f('0x167')});db['WhatsappInteraction'][_0xb22f('0x119')](db[_0xb22f('0x104')],{'as':_0xb22f('0x168'),'through':_0xb22f('0x123'),'foreignKey':_0xb22f('0x1f1')});db[_0xb22f('0x1f0')]['belongsTo'](db[_0xb22f('0x104')],{'as':'User'});db[_0xb22f('0x1f0')]['belongsTo'](db[_0xb22f('0x11a')],{'onDelete':_0xb22f('0x105'),'as':_0xb22f('0x157')});db[_0xb22f('0x1f0')][_0xb22f('0x116')](db[_0xb22f('0xf7')],{'onDelete':_0xb22f('0x105'),'as':_0xb22f('0x17b'),'foreignKey':'WhatsappInteractionId'});db[_0xb22f('0x1f0')]['belongsTo'](db[_0xb22f('0x138')],{'as':_0xb22f('0x163'),'foreignKey':_0xb22f('0x1ef')});db[_0xb22f('0xfa')][_0xb22f('0x116')](db[_0xb22f('0x138')],{});db[_0xb22f('0xfa')]['belongsTo'](db[_0xb22f('0xf0')],{'as':_0xb22f('0x15f'),'foreignKey':_0xb22f('0x16e')});db['WhatsappQueueReport'][_0xb22f('0x116')](db['CmContact'],{'as':_0xb22f('0x157'),'foreignKey':_0xb22f('0x158')});db[_0xb22f('0xfa')][_0xb22f('0x116')](db[_0xb22f('0xf7')],{});db['WhatsappQueueReport'][_0xb22f('0x116')](db[_0xb22f('0x12d')],{});db['WhatsappQueueReport'][_0xb22f('0x116')](db[_0xb22f('0x1f0')],{});db[_0xb22f('0xfa')][_0xb22f('0x116')](db[_0xb22f('0x104')],{});db[_0xb22f('0x1f2')]['belongsTo'](db[_0xb22f('0x1f0')],{});db['WhatsappTransferReport'][_0xb22f('0x116')](db[_0xb22f('0xf7')],{});db[_0xb22f('0x1f2')][_0xb22f('0x116')](db[_0xb22f('0x138')],{'foreignKey':_0xb22f('0x1f3'),'as':'FromAccount'});db[_0xb22f('0x1f2')][_0xb22f('0x116')](db[_0xb22f('0x138')],{'foreignKey':_0xb22f('0x1f4'),'as':_0xb22f('0x1d6')});db[_0xb22f('0x1f2')][_0xb22f('0x116')](db['WhatsappQueue'],{'foreignKey':'ToQueueId','as':'ToQueue'});db[_0xb22f('0x1f2')][_0xb22f('0x116')](db[_0xb22f('0x104')],{'foreignKey':_0xb22f('0x1d1'),'as':_0xb22f('0x1d9')});db[_0xb22f('0x1f2')][_0xb22f('0x116')](db[_0xb22f('0x104')],{'foreignKey':_0xb22f('0x1d2'),'as':_0xb22f('0x1d3')});db[_0xb22f('0x12d')]['belongsToMany'](db[_0xb22f('0x104')],{'as':_0xb22f('0x14c'),'through':_0xb22f('0x34'),'foreignKey':_0xb22f('0x1f5')});db[_0xb22f('0x12d')][_0xb22f('0x119')](db[_0xb22f('0xe0')],{'through':_0xb22f('0x1ca'),'as':_0xb22f('0x14d')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xd64b=['user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteractions','user_has_whatsapp_interactions','MailQueues','UserMailQueue','ChatQueues','UserChatQueue','FaxQueues','UserFaxQueue','SmsQueues','OpenchannelQueues','WhatsappQueue','WhatsappQueues','user_has_chat_websites','FaxAccount','user_has_mail_accounts','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProject','SpiedAgents','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperHistories','HopperBlacks','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','Pause','Lists','voice_queues_has_cm_lists','Agents','voice_queues_has_cm_blacklists','VoiceMailMessage','Messages','mailboxuser','mailbox','uniqueid','AgentReports','Contact','ContactId','MailAccountId','hasOne','Smtp','Dispositions','Answers','Interactions','List','TemplateId','Teams','MailInteractionId','Account','Owner','Tags','mail_interaction_has_tags','ThroughTags','Users','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','restrict','MailQueueReport','ListId','Items','FaxAccountId','Exntensions','mandatoryDispositionPause','mandatoryDispositionPauseId','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','TagId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','OpenchannelAccountId','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','OpenchannelQueueReport','Queue','Website','ChatInteractionId','chat_interaction_has_tags','chat_group_has_users','CompanyId','Hoppers','JscriptySessionReport','Company','cm_contact_has_tags','Agent','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','Intervals','Extensions','MailApplications','FaxApplications','SmsApplications','Sound','Mohs','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerId','CustomReportId','Fields','DefaultReportId','MetricId','SalesforceConfiguration','Configurations','AccountId','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','VariableId','SugarcrmConfiguration','Subjects','Field','int_desk_configuration_has_tags','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','ServicenowAccount','Dynamics365Configuration','FromId','ToId','JscriptyQuestionReport','SessionId','JscriptyAnswerReport','ProjectId','user_has_square_projects','VoiceQueues','team_has_mail_queues','team_has_sms_queues','team_has_whatsapp_queues','VoicePrefixes','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','FaxTransferReport','ToFaxQueueId','FromOpenchannelAccountId','FromAccount','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','UserProfileSections','Resources','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','whatsapp_interaction_has_tags','WhatsappQueueReport','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','../config/environment','lodash','determine','sequelize','defaultsDeep','motion2','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','xC@LL1234','127.0.0.1','mysql','password','options','database','username','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','FaxQueue','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.model','../api/pause/pause.model','Cdr','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowConfiguration','../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','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','OpenchannelTransferReport','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','TeamVoiceQueue','TeamVoicePrefix','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','VoiceMail','cascade','UserId','hasMany','VoiceQueuesRt','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','MailInteractions','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','Contacts','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions'];(function(_0x28d417,_0x253557){var _0x5b96f4=function(_0x1702db){while(--_0x1702db){_0x28d417['push'](_0x28d417['shift']());}};_0x5b96f4(++_0x253557);}(_0xd64b,0xc1));var _0xbd64=function(_0x48eef4,_0x54ca8f){_0x48eef4=_0x48eef4-0x0;var _0xbcb029=_0xd64b[_0x48eef4];return _0xbcb029;};'use strict';var config=require(_0xbd64('0x0'));var Sequelize=require('sequelize');var _=require(_0xbd64('0x1'));var jstz=require('jstz');var timezone=jstz[_0xbd64('0x2')]();config[_0xbd64('0x3')]=_[_0xbd64('0x4')](config[_0xbd64('0x3')],{'database':_0xbd64('0x5'),'username':'xcall','password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xbd64('0x6')},'logging':![],'timezone':timezone[_0xbd64('0x7')](),'define':{'charset':_0xbd64('0x8'),'collate':_0xbd64('0x9')}}});config[_0xbd64('0xa')]=_[_0xbd64('0x4')](config[_0xbd64('0xa')],{'database':'motion2','username':'xcall','password':_0xbd64('0xb'),'options':{'host':_0xbd64('0xc'),'port':0xcea,'dialect':_0xbd64('0xd'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xbd64('0x7')](),'define':{'charset':_0xbd64('0x8'),'collate':_0xbd64('0x9')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xbd64('0x3')]['database'],config[_0xbd64('0x3')]['username'],config[_0xbd64('0x3')][_0xbd64('0xe')],config[_0xbd64('0x3')][_0xbd64('0xf')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xbd64('0xa')][_0xbd64('0x10')],config[_0xbd64('0xa')][_0xbd64('0x11')],config[_0xbd64('0xa')]['password'],config[_0xbd64('0xa')][_0xbd64('0xf')])};db[_0xbd64('0x12')]=db[_0xbd64('0x3')][_0xbd64('0x13')]('../api/user/user.model');db[_0xbd64('0x14')]=db['sequelize'][_0xbd64('0x13')](_0xbd64('0x15'));db[_0xbd64('0x16')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0x17'));db[_0xbd64('0x18')]=db[_0xbd64('0x3')]['import'](_0xbd64('0x19'));db[_0xbd64('0x1a')]=db['sequelize']['import'](_0xbd64('0x1b'));db[_0xbd64('0x1c')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0x1d'));db[_0xbd64('0x1e')]=db['sequelize']['import'](_0xbd64('0x1f'));db[_0xbd64('0x20')]=db[_0xbd64('0x3')][_0xbd64('0x13')]('../api/screenRecording/screenRecording.model');db['VoiceMail']=db[_0xbd64('0x3')]['import'](_0xbd64('0x21'));db['VoiceMailMessage']=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0x22'));db[_0xbd64('0x23')]=db['sequelize'][_0xbd64('0x13')](_0xbd64('0x24'));db[_0xbd64('0x25')]=db[_0xbd64('0x3')]['import']('../api/voiceDialReport/voiceDialReport.model');db[_0xbd64('0x26')]=db['sequelize']['import'](_0xbd64('0x27'));db['VoiceQueueReport']=db[_0xbd64('0x3')]['import'](_0xbd64('0x28'));db['MemberReport']=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0x29'));db[_0xbd64('0x2a')]=db[_0xbd64('0x3')][_0xbd64('0x13')]('../api/trunk/trunk.model');db[_0xbd64('0x2b')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0x2c'));db[_0xbd64('0x2d')]=db[_0xbd64('0x3')]['import']('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0xbd64('0x2e')]=db['sequelize'][_0xbd64('0x13')](_0xbd64('0x2f'));db['UserChatQueue']=db['sequelize'][_0xbd64('0x13')]('../api/userChatQueue/userChatQueue.model');db['UserMailQueue']=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0x30'));db['UserFaxQueue']=db[_0xbd64('0x3')]['import'](_0xbd64('0x31'));db[_0xbd64('0x32')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0x33'));db[_0xbd64('0x34')]=db['sequelize']['import'](_0xbd64('0x35'));db[_0xbd64('0x36')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0x37'));db[_0xbd64('0x38')]=db['sequelize']['import'](_0xbd64('0x39'));db[_0xbd64('0x3a')]=db[_0xbd64('0x3')]['import']('../api/mailServerOut/mailServerOut.model');db[_0xbd64('0x3b')]=db['sequelize'][_0xbd64('0x13')]('../api/mailAccount/mailAccount.model');db[_0xbd64('0x3c')]=db[_0xbd64('0x3')]['import'](_0xbd64('0x3d'));db['MailSubstatus']=db['sequelize'][_0xbd64('0x13')](_0xbd64('0x3e'));db[_0xbd64('0x3f')]=db['sequelize']['import']('../api/mailInteraction/mailInteraction.model');db[_0xbd64('0x40')]=db[_0xbd64('0x3')]['import'](_0xbd64('0x41'));db[_0xbd64('0x42')]=db[_0xbd64('0x3')][_0xbd64('0x13')]('../api/mailApplication/mailApplication.model');db['MailQueueReport']=db[_0xbd64('0x3')]['import']('../api/mailQueueReport/mailQueueReport.model');db[_0xbd64('0x43')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0x44'));db[_0xbd64('0x45')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0x46'));db['FaxAccount']=db[_0xbd64('0x3')][_0xbd64('0x13')]('../api/faxAccount/faxAccount.model');db[_0xbd64('0x47')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0x48'));db[_0xbd64('0x49')]=db[_0xbd64('0x3')][_0xbd64('0x13')]('../api/faxInteraction/faxInteraction.model');db[_0xbd64('0x4a')]=db['sequelize'][_0xbd64('0x13')]('../api/faxMessage/faxMessage.model');db[_0xbd64('0x4b')]=db[_0xbd64('0x3')][_0xbd64('0x13')]('../api/faxQueue/faxQueue.model');db[_0xbd64('0x4c')]=db['sequelize']['import']('../api/faxQueueReport/faxQueueReport.model');db[_0xbd64('0x4d')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0x4e'));db[_0xbd64('0x4f')]=db[_0xbd64('0x3')][_0xbd64('0x13')]('../api/smsApplication/smsApplication.model');db[_0xbd64('0x50')]=db[_0xbd64('0x3')][_0xbd64('0x13')]('../api/smsInteraction/smsInteraction.model');db[_0xbd64('0x51')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0x52'));db[_0xbd64('0x53')]=db['sequelize'][_0xbd64('0x13')](_0xbd64('0x54'));db[_0xbd64('0x55')]=db[_0xbd64('0x3')]['import']('../api/openchannelAccount/openchannelAccount.model');db[_0xbd64('0x56')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0x57'));db[_0xbd64('0x58')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0x59'));db[_0xbd64('0x5a')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0x5b'));db[_0xbd64('0x5c')]=db[_0xbd64('0x3')][_0xbd64('0x13')]('../api/openchannelQueue/openchannelQueue.model');db[_0xbd64('0x5d')]=db['sequelize']['import']('../api/chatWebsite/chatWebsite.model');db['OpenchannelQueueReport']=db[_0xbd64('0x3')][_0xbd64('0x13')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0xbd64('0x5e')]=db[_0xbd64('0x3')][_0xbd64('0x13')]('../api/chatApplication/chatApplication.model');db[_0xbd64('0x5f')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0x60'));db[_0xbd64('0x61')]=db[_0xbd64('0x3')]['import']('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0x62'));db[_0xbd64('0x63')]=db['sequelize'][_0xbd64('0x13')](_0xbd64('0x64'));db[_0xbd64('0x65')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0x66'));db['ChatProactiveAction']=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0x67'));db[_0xbd64('0x68')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0x69'));db[_0xbd64('0x6a')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0x6b'));db[_0xbd64('0x6c')]=db['sequelize']['import'](_0xbd64('0x6d'));db[_0xbd64('0x6e')]=db['sequelize']['import'](_0xbd64('0x6f'));db[_0xbd64('0x70')]=db['sequelize'][_0xbd64('0x13')](_0xbd64('0x71'));db[_0xbd64('0x72')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0x73'));db[_0xbd64('0x74')]=db[_0xbd64('0x3')][_0xbd64('0x13')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0xbd64('0x75')]=db[_0xbd64('0x3')][_0xbd64('0x13')]('../api/cmCustomField/cmCustomField.model');db[_0xbd64('0x76')]=db[_0xbd64('0x3')]['import'](_0xbd64('0x77'));db[_0xbd64('0x78')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0x79'));db[_0xbd64('0x7a')]=db['sequelize'][_0xbd64('0x13')](_0xbd64('0x7b'));db[_0xbd64('0x7c')]=db[_0xbd64('0x3')]['import'](_0xbd64('0x7d'));db[_0xbd64('0x7e')]=db['sequelize'][_0xbd64('0x13')]('../api/condition/condition.model');db[_0xbd64('0x7f')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0x80'));db['Pause']=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0x81'));db[_0xbd64('0x82')]=db[_0xbd64('0x3')][_0xbd64('0x13')]('../api/cdr/cdr.model');db['VoiceQueuesLog']=db['sequelize'][_0xbd64('0x13')](_0xbd64('0x83'));db[_0xbd64('0x84')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0x85'));db['Sound']=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0x86'));db[_0xbd64('0x87')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0x88'));db[_0xbd64('0x89')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0x8a'));db[_0xbd64('0x8b')]=db['sequelize']['import'](_0xbd64('0x8c'));db[_0xbd64('0x8d')]=db[_0xbd64('0x3')]['import'](_0xbd64('0x8e'));db['Integration']=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0x8f'));db[_0xbd64('0x90')]=db['sequelize'][_0xbd64('0x13')]('../api/integrationReport/integrationReport.model');db[_0xbd64('0x91')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0x92'));db[_0xbd64('0x93')]=db['sequelize'][_0xbd64('0x13')](_0xbd64('0x94'));db['AnalyticExtractedReport']=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0x95'));db[_0xbd64('0x96')]=db['sequelize'][_0xbd64('0x13')]('../api/analyticMetric/analyticMetric.model');db[_0xbd64('0x97')]=db[_0xbd64('0x3')][_0xbd64('0x13')]('../api/analyticFieldReport/analyticFieldReport.model');db['AnalyticTreeReport']=db['sequelize']['import'](_0xbd64('0x98'));db[_0xbd64('0x99')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0x9a'));db['SalesforceConfiguration']=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0x9b'));db[_0xbd64('0x9c')]=db[_0xbd64('0x3')]['import'](_0xbd64('0x9d'));db[_0xbd64('0x9e')]=db[_0xbd64('0x3')][_0xbd64('0x13')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db['SugarcrmConfiguration']=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0x9f'));db[_0xbd64('0xa0')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0xa1'));db[_0xbd64('0xa2')]=db['sequelize'][_0xbd64('0x13')]('../api/intDeskAccount/intDeskAccount.model');db[_0xbd64('0xa3')]=db[_0xbd64('0x3')][_0xbd64('0x13')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0xbd64('0xa4')]=db['sequelize']['import'](_0xbd64('0xa5'));db[_0xbd64('0xa6')]=db[_0xbd64('0x3')]['import'](_0xbd64('0xa7'));db[_0xbd64('0xa8')]=db[_0xbd64('0x3')][_0xbd64('0x13')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0xbd64('0xa9')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0xaa'));db[_0xbd64('0xab')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0xac'));db[_0xbd64('0xad')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0xae'));db[_0xbd64('0xaf')]=db[_0xbd64('0x3')]['import']('../api/intZendeskField/intZendeskField.model');db[_0xbd64('0xb0')]=db[_0xbd64('0x3')][_0xbd64('0x13')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0xbd64('0xb1')]=db['sequelize'][_0xbd64('0x13')](_0xbd64('0xb2'));db[_0xbd64('0xb3')]=db[_0xbd64('0x3')]['import'](_0xbd64('0xb4'));db[_0xbd64('0xb5')]=db['sequelize'][_0xbd64('0x13')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0xbd64('0xb6')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0xb7'));db[_0xbd64('0xb8')]=db[_0xbd64('0x3')]['import'](_0xbd64('0xb9'));db['ServicenowAccount']=db[_0xbd64('0x3')][_0xbd64('0x13')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0xbd64('0xba')]=db['sequelize'][_0xbd64('0x13')](_0xbd64('0xbb'));db[_0xbd64('0xbc')]=db['sequelize'][_0xbd64('0x13')](_0xbd64('0xbd'));db[_0xbd64('0xbe')]=db[_0xbd64('0x3')][_0xbd64('0x13')]('../api/intDynamics365Account/intDynamics365Account.model');db['Dynamics365Configuration']=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0xbf'));db[_0xbd64('0xc0')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0xc1'));db[_0xbd64('0xc2')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0xc3'));db[_0xbd64('0xc4')]=db[_0xbd64('0x3')]['import'](_0xbd64('0xc5'));db[_0xbd64('0xc6')]=db['sequelize'][_0xbd64('0x13')](_0xbd64('0xc7'));db[_0xbd64('0xc8')]=db[_0xbd64('0x3')]['import']('../api/integration/integration.model');db[_0xbd64('0xc9')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0xca'));db[_0xbd64('0xcb')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0xcc'));db[_0xbd64('0xcd')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0xce'));db['JscriptyAnswerReport']=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0xcf'));db['JscriptyQuestionReport']=db['sequelize'][_0xbd64('0x13')](_0xbd64('0xd0'));db['JscriptySessionReport']=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0xd1'));db[_0xbd64('0xd2')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0xd3'));db[_0xbd64('0xd4')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0xd5'));db[_0xbd64('0xd6')]=db['sequelize'][_0xbd64('0x13')]('../api/squareReportDetail/squareReportDetail.model');db[_0xbd64('0xd7')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0xd8'));db[_0xbd64('0xd9')]=db['sequelize'][_0xbd64('0x13')](_0xbd64('0xda'));db[_0xbd64('0xdb')]=db[_0xbd64('0x3')]['import'](_0xbd64('0xdc'));db['SquareProject']=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0xdd'));db[_0xbd64('0xde')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0xdf'));db['SquareMessage']=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0xe0'));db[_0xbd64('0xe1')]=db['sequelize'][_0xbd64('0x13')](_0xbd64('0xe2'));db[_0xbd64('0xe3')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0xe4'));db[_0xbd64('0xe5')]=db['sequelize'][_0xbd64('0x13')]('../api/campaign/campaign.model');db[_0xbd64('0xe6')]=db['sequelize']['import'](_0xbd64('0xe7'));db[_0xbd64('0xe8')]=db[_0xbd64('0x3')]['import'](_0xbd64('0xe9'));db['Plugin']=db[_0xbd64('0x3')]['import']('../api/plugin/plugin.model');db[_0xbd64('0xea')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0xeb'));db[_0xbd64('0xec')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0xed'));db['FaxTransferReport']=db['sequelize'][_0xbd64('0x13')]('../api/faxTransferReport/faxTransferReport.model');db[_0xbd64('0xee')]=db[_0xbd64('0x3')][_0xbd64('0x13')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0xbd64('0xef')]=db[_0xbd64('0x3')]['import'](_0xbd64('0xf0'));db[_0xbd64('0xf1')]=db['sequelize']['import'](_0xbd64('0xf2'));db[_0xbd64('0xf3')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0xf4'));db[_0xbd64('0xf5')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0xf6'));db[_0xbd64('0xf7')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0xf8'));db[_0xbd64('0xf9')]=db[_0xbd64('0x3')]['import'](_0xbd64('0xfa'));db['UserNotification']=db[_0xbd64('0x3')][_0xbd64('0x13')]('../api/userNotification/userNotification.model');db[_0xbd64('0xfb')]=db['sequelize'][_0xbd64('0x13')](_0xbd64('0xfc'));db[_0xbd64('0xfd')]=db[_0xbd64('0x3')]['import'](_0xbd64('0xfe'));db[_0xbd64('0xff')]=db[_0xbd64('0x3')][_0xbd64('0x13')]('../api/whatsappInteraction/whatsappInteraction.model');db['WhatsappMessage']=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0x100'));db['WhatsappQueueReport']=db[_0xbd64('0x3')]['import'](_0xbd64('0x101'));db[_0xbd64('0x102')]=db[_0xbd64('0x3')][_0xbd64('0x13')](_0xbd64('0x103'));db['WhatsappQueue']=db['sequelize'][_0xbd64('0x13')](_0xbd64('0x104'));db[_0xbd64('0x105')]=db['sequelize'][_0xbd64('0x13')]('../api/cloudProvider/cloudProvider.model');db[_0xbd64('0x106')]=db[_0xbd64('0x3')][_0xbd64('0x13')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0xbd64('0x107')]=db[_0xbd64('0x3')]['import']('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0xbd64('0x108')]=db['sequelize']['import'](_0xbd64('0x109'));db[_0xbd64('0x12')]['hasOne'](db[_0xbd64('0x10a')],{'as':'VoiceMail','onDelete':_0xbd64('0x10b'),'foreignKey':_0xbd64('0x10c')});db[_0xbd64('0x12')]['hasMany'](db[_0xbd64('0x1e')],{'as':'Recordings','foreignKey':'UserId'});db['User'][_0xbd64('0x10d')](db[_0xbd64('0x2d')],{'as':_0xbd64('0x10e'),'foreignKey':'UserId'});db[_0xbd64('0x12')]['hasMany'](db[_0xbd64('0x18')],{'as':'Extensions','onDelete':'cascade','hooks':!![]});db['User'][_0xbd64('0x10d')](db[_0xbd64('0x70')],{'as':_0xbd64('0x10f'),'foreignKey':_0xbd64('0x10c')});db['User'][_0xbd64('0x10d')](db[_0xbd64('0x72')],{'as':_0xbd64('0x110'),'foreignKey':'UserId'});db[_0xbd64('0x12')]['hasMany'](db[_0xbd64('0x74')],{'as':_0xbd64('0x74'),'foreignKey':_0xbd64('0x10c')});db[_0xbd64('0x12')][_0xbd64('0x10d')](db[_0xbd64('0x58')],{'as':_0xbd64('0x111'),'foreignKey':_0xbd64('0x10c')});db[_0xbd64('0x12')][_0xbd64('0x10d')](db[_0xbd64('0x5f')],{'as':_0xbd64('0x112'),'foreignKey':_0xbd64('0x10c')});db['User']['hasMany'](db[_0xbd64('0x50')],{'as':_0xbd64('0x113'),'foreignKey':_0xbd64('0x10c')});db[_0xbd64('0x12')]['hasMany'](db[_0xbd64('0x49')],{'as':'FaxInteractions','foreignKey':_0xbd64('0x10c')});db['User']['hasMany'](db[_0xbd64('0x3f')],{'as':_0xbd64('0x114'),'foreignKey':'UserId'});db[_0xbd64('0x12')]['hasMany'](db[_0xbd64('0xff')],{'as':'WhatsappInteractions','foreignKey':_0xbd64('0x10c')});db[_0xbd64('0x12')][_0xbd64('0x10d')](db['UserNotification'],{'as':_0xbd64('0x115'),'foreignKey':_0xbd64('0x116')});db[_0xbd64('0x12')][_0xbd64('0x117')](db[_0xbd64('0xf5')],{'as':_0xbd64('0xf5'),'foreignKey':_0xbd64('0x118')});db['User'][_0xbd64('0x119')](db[_0xbd64('0x65')],{'as':'Groups','through':'chat_group_has_users'});db['User'][_0xbd64('0x119')](db[_0xbd64('0x6a')],{'as':_0xbd64('0x11a'),'through':'cm_user_has_contacts'});db[_0xbd64('0x12')]['belongsToMany'](db[_0xbd64('0xf1')],{'as':'Lists','through':_0xbd64('0x11b')});db[_0xbd64('0x12')][_0xbd64('0x119')](db[_0xbd64('0xe1')],{'through':_0xbd64('0x11c')});db[_0xbd64('0x12')][_0xbd64('0x119')](db[_0xbd64('0x3f')],{'as':_0xbd64('0x114'),'through':_0xbd64('0x11d')});db[_0xbd64('0x12')]['belongsToMany'](db[_0xbd64('0x5f')],{'as':_0xbd64('0x112'),'through':_0xbd64('0x11e')});db[_0xbd64('0x12')][_0xbd64('0x119')](db[_0xbd64('0x49')],{'as':_0xbd64('0x11f'),'through':_0xbd64('0x120')});db[_0xbd64('0x12')]['belongsToMany'](db['SmsInteraction'],{'as':_0xbd64('0x113'),'through':_0xbd64('0x121')});db['User'][_0xbd64('0x119')](db[_0xbd64('0x58')],{'as':'OpenchannelInteractions','through':_0xbd64('0x122')});db['User'][_0xbd64('0x119')](db[_0xbd64('0xff')],{'as':_0xbd64('0x123'),'through':_0xbd64('0x124')});db[_0xbd64('0x12')]['belongsToMany'](db['VoiceQueue'],{'as':'VoiceQueues','through':'UserVoiceQueue','required':![]});db[_0xbd64('0x12')]['belongsToMany'](db[_0xbd64('0xf3')],{'as':'VoicePrefixes','through':'UserVoicePrefix','required':![]});db[_0xbd64('0x12')][_0xbd64('0x119')](db[_0xbd64('0x3c')],{'as':_0xbd64('0x125'),'through':_0xbd64('0x126'),'required':![]});db[_0xbd64('0x12')][_0xbd64('0x119')](db[_0xbd64('0x63')],{'as':_0xbd64('0x127'),'through':_0xbd64('0x128'),'required':![],'hooks':!![]});db[_0xbd64('0x12')][_0xbd64('0x119')](db['FaxQueue'],{'as':_0xbd64('0x129'),'through':_0xbd64('0x12a'),'required':![]});db[_0xbd64('0x12')][_0xbd64('0x119')](db[_0xbd64('0x53')],{'as':_0xbd64('0x12b'),'through':'UserSmsQueue','required':![]});db[_0xbd64('0x12')][_0xbd64('0x119')](db[_0xbd64('0x5c')],{'as':_0xbd64('0x12c'),'through':'UserOpenchannelQueue','required':![]});db[_0xbd64('0x12')][_0xbd64('0x119')](db[_0xbd64('0x12d')],{'as':_0xbd64('0x12e'),'through':'UserWhatsappQueue','required':![]});db[_0xbd64('0x12')]['belongsToMany'](db['CmList'],{'through':'cm_user_has_lists'});db[_0xbd64('0x12')][_0xbd64('0x119')](db['ChatWebsite'],{'as':'ChatWebsites','through':_0xbd64('0x12f')});db[_0xbd64('0x12')][_0xbd64('0x119')](db[_0xbd64('0x130')],{'as':'FaxAccounts','through':'user_has_fax_accounts'});db[_0xbd64('0x12')]['belongsToMany'](db[_0xbd64('0x3b')],{'as':'MailAccounts','through':_0xbd64('0x131')});db[_0xbd64('0x12')][_0xbd64('0x119')](db[_0xbd64('0x55')],{'as':'OpenchannelAccounts','through':_0xbd64('0x132')});db[_0xbd64('0x12')][_0xbd64('0x119')](db[_0xbd64('0x4d')],{'as':'SmsAccounts','through':_0xbd64('0x133')});db[_0xbd64('0x12')][_0xbd64('0x119')](db[_0xbd64('0xfb')],{'as':_0xbd64('0x134'),'through':_0xbd64('0x135')});db[_0xbd64('0x12')][_0xbd64('0x119')](db[_0xbd64('0x136')],{'as':'SquareProjects','through':'user_has_square_projects'});db[_0xbd64('0x14')]['hasMany'](db[_0xbd64('0x18')],{'as':_0xbd64('0x137'),'onDelete':_0xbd64('0x10b'),'foreignKey':'ChanSpyId'});db['VoiceContext'][_0xbd64('0x10d')](db[_0xbd64('0x18')],{'onDelete':_0xbd64('0x10b')});db[_0xbd64('0x18')][_0xbd64('0x10d')](db[_0xbd64('0x18')],{'as':_0xbd64('0x138'),'onDelete':_0xbd64('0x10b')});db[_0xbd64('0x1a')]['belongsToMany'](db['Sound'],{'as':_0xbd64('0x139'),'through':_0xbd64('0x13a')});db[_0xbd64('0x1c')][_0xbd64('0x10d')](db['UserVoiceQueueRt'],{'as':_0xbd64('0x13b'),'foreignKey':'VoiceQueueId'});db[_0xbd64('0x1c')]['hasMany'](db[_0xbd64('0x6c')],{'as':'Hoppers','foreignKey':_0xbd64('0x13c')});db[_0xbd64('0x1c')][_0xbd64('0x10d')](db[_0xbd64('0x70')],{'as':_0xbd64('0x10f'),'foreignKey':_0xbd64('0x13c')});db['VoiceQueue'][_0xbd64('0x10d')](db['CmHopperHistory'],{'as':_0xbd64('0x13d'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xbd64('0x10d')](db[_0xbd64('0x74')],{'as':_0xbd64('0x74'),'foreignKey':'VoiceQueueId'});db[_0xbd64('0x1c')][_0xbd64('0x10d')](db[_0xbd64('0x6e')],{'as':_0xbd64('0x13e'),'foreignKey':_0xbd64('0x13c')});db['VoiceQueue'][_0xbd64('0x10d')](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':_0xbd64('0x13c')});db[_0xbd64('0x1c')][_0xbd64('0x117')](db[_0xbd64('0x2a')],{'as':_0xbd64('0x2a'),'foreignKey':_0xbd64('0x13f')});db[_0xbd64('0x1c')][_0xbd64('0x117')](db[_0xbd64('0x2a')],{'as':_0xbd64('0x140'),'foreignKey':_0xbd64('0x141')});db['VoiceQueue'][_0xbd64('0x117')](db[_0xbd64('0x7f')],{'as':_0xbd64('0x7f'),'foreignKey':_0xbd64('0x142')});db['VoiceQueue'][_0xbd64('0x117')](db[_0xbd64('0x143')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xbd64('0x1c')][_0xbd64('0x119')](db[_0xbd64('0xf1')],{'as':_0xbd64('0x144'),'through':_0xbd64('0x145')});db[_0xbd64('0x1c')]['belongsToMany'](db[_0xbd64('0x12')],{'as':_0xbd64('0x146'),'through':_0xbd64('0x2e')});db[_0xbd64('0x1c')]['belongsToMany'](db[_0xbd64('0xe1')],{'as':'Teams','through':_0xbd64('0x106')});db[_0xbd64('0x1c')][_0xbd64('0x119')](db[_0xbd64('0xf1')],{'as':'BlackLists','through':_0xbd64('0x147')});db['VoiceRecording'][_0xbd64('0x117')](db['User'],{'as':_0xbd64('0x12'),'foreignKey':'UserId'});db[_0xbd64('0x20')][_0xbd64('0x117')](db['User'],{'as':_0xbd64('0x12'),'foreignKey':_0xbd64('0x10c')});db['VoiceMail'][_0xbd64('0x10d')](db[_0xbd64('0x148')],{'as':_0xbd64('0x149'),'onDelete':'cascade','foreignKey':_0xbd64('0x14a'),'sourceKey':_0xbd64('0x14b')});db[_0xbd64('0x148')]['belongsTo'](db[_0xbd64('0x10a')],{'foreignKey':_0xbd64('0x14a'),'targetKey':'mailbox'});db['VoiceCallReport'][_0xbd64('0x10d')](db['VoiceQueueReport'],{'as':'QueueCalls','foreignKey':_0xbd64('0x14c'),'constraints':![]});db[_0xbd64('0x23')][_0xbd64('0x10d')](db['VoiceAgentReport'],{'as':_0xbd64('0x14d'),'foreignKey':'uniqueid','constraints':![]});db[_0xbd64('0x23')]['belongsTo'](db[_0xbd64('0x12')],{'as':_0xbd64('0x12'),'foreignKey':'UserId'});db[_0xbd64('0x23')][_0xbd64('0x117')](db[_0xbd64('0x6a')],{'as':_0xbd64('0x14e'),'foreignKey':_0xbd64('0x14f')});db[_0xbd64('0x38')]['belongsTo'](db[_0xbd64('0x3b')],{'as':_0xbd64('0x3b'),'foreignKey':_0xbd64('0x150')});db[_0xbd64('0x3a')][_0xbd64('0x117')](db[_0xbd64('0x3b')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0xbd64('0x3b')][_0xbd64('0x151')](db[_0xbd64('0x38')],{'as':'Imap','onDelete':_0xbd64('0x10b')});db[_0xbd64('0x3b')][_0xbd64('0x151')](db[_0xbd64('0x3a')],{'as':_0xbd64('0x152'),'onDelete':_0xbd64('0x10b')});db[_0xbd64('0x3b')]['hasMany'](db[_0xbd64('0x7c')],{'as':_0xbd64('0x153'),'foreignKey':_0xbd64('0x150'),'onDelete':_0xbd64('0x10b')});db['MailAccount']['hasMany'](db['CannedAnswer'],{'as':_0xbd64('0x154'),'foreignKey':'MailAccountId'});db[_0xbd64('0x3b')][_0xbd64('0x10d')](db[_0xbd64('0x40')],{'as':'Messages','foreignKey':_0xbd64('0x150')});db[_0xbd64('0x3b')][_0xbd64('0x10d')](db[_0xbd64('0x3f')],{'as':_0xbd64('0x155')});db[_0xbd64('0x3b')][_0xbd64('0x10d')](db[_0xbd64('0x42')],{'as':_0xbd64('0x138')});db[_0xbd64('0x3b')][_0xbd64('0x117')](db[_0xbd64('0xf1')],{'as':_0xbd64('0x156'),'foreignKey':'ListId'});db[_0xbd64('0x3b')]['belongsTo'](db[_0xbd64('0x89')],{'as':_0xbd64('0x89'),'foreignKey':_0xbd64('0x157')});db[_0xbd64('0x3b')][_0xbd64('0x117')](db[_0xbd64('0x143')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['MailAccount']['belongsToMany'](db[_0xbd64('0x12')],{'as':_0xbd64('0x146'),'through':_0xbd64('0x131')});db[_0xbd64('0x3c')][_0xbd64('0x119')](db[_0xbd64('0x12')],{'as':_0xbd64('0x146'),'through':_0xbd64('0x126')});db['MailQueue'][_0xbd64('0x119')](db[_0xbd64('0xe1')],{'through':'team_has_mail_queues','as':_0xbd64('0x158')});db[_0xbd64('0x3f')][_0xbd64('0x10d')](db[_0xbd64('0x40')],{'as':_0xbd64('0x149'),'onDelete':_0xbd64('0x10b'),'foreignKey':_0xbd64('0x159')});db[_0xbd64('0x3f')][_0xbd64('0x117')](db[_0xbd64('0x3b')],{'as':_0xbd64('0x15a'),'foreignKey':'MailAccountId'});db[_0xbd64('0x3f')][_0xbd64('0x117')](db[_0xbd64('0x6a')],{'as':'Contact','foreignKey':_0xbd64('0x14f')});db['MailInteraction'][_0xbd64('0x117')](db[_0xbd64('0x12')],{'as':_0xbd64('0x15b'),'foreignKey':'UserId'});db['MailInteraction'][_0xbd64('0x119')](db[_0xbd64('0x87')],{'through':'mail_interaction_has_tags','as':_0xbd64('0x15c')});db['MailInteraction'][_0xbd64('0x119')](db[_0xbd64('0x87')],{'through':_0xbd64('0x15d'),'as':_0xbd64('0x15e')});db[_0xbd64('0x3f')][_0xbd64('0x119')](db[_0xbd64('0x12')],{'as':_0xbd64('0x15f'),'through':_0xbd64('0x11d'),'foreignKey':_0xbd64('0x159')});db['MailMessage']['hasMany'](db[_0xbd64('0xe8')],{'as':_0xbd64('0x160'),'onDelete':'cascade'});db[_0xbd64('0x40')][_0xbd64('0x117')](db[_0xbd64('0x12')],{'as':_0xbd64('0x12')});db['MailMessage'][_0xbd64('0x117')](db[_0xbd64('0x6a')],{'onDelete':_0xbd64('0x10b'),'as':'Contact'});db['MailMessage'][_0xbd64('0x117')](db[_0xbd64('0x3f')],{'as':_0xbd64('0x161'),'foreignKey':'MailInteractionId'});db[_0xbd64('0x40')]['belongsTo'](db[_0xbd64('0x3b')],{'as':'Account','foreignKey':_0xbd64('0x150')});db['MailMessage'][_0xbd64('0x117')](db[_0xbd64('0x5d')],{'as':_0xbd64('0x5d'),'foreignKey':_0xbd64('0x162')});db['MailMessage'][_0xbd64('0x117')](db[_0xbd64('0x163')],{'as':_0xbd64('0x163'),'foreignKey':_0xbd64('0x164')});db[_0xbd64('0x42')][_0xbd64('0x117')](db[_0xbd64('0x12')],{'onDelete':_0xbd64('0x165')});db[_0xbd64('0x42')][_0xbd64('0x117')](db[_0xbd64('0x3c')],{'onDelete':'restrict'});db[_0xbd64('0x42')][_0xbd64('0x117')](db['MailAccount'],{'onDelete':'restrict'});db[_0xbd64('0x42')][_0xbd64('0x117')](db['Interval'],{'onDelete':_0xbd64('0x165'),'foreignKey':_0xbd64('0x142')});db[_0xbd64('0x42')]['belongsTo'](db[_0xbd64('0x87')],{'onDelete':_0xbd64('0x165'),'foreignKey':'TagId'});db[_0xbd64('0x166')][_0xbd64('0x117')](db[_0xbd64('0x3b')],{});db[_0xbd64('0x166')][_0xbd64('0x117')](db[_0xbd64('0xf1')],{'as':_0xbd64('0x156'),'foreignKey':_0xbd64('0x167')});db[_0xbd64('0x166')]['belongsTo'](db['CmContact'],{'as':_0xbd64('0x14e'),'foreignKey':'ContactId'});db[_0xbd64('0x166')]['belongsTo'](db[_0xbd64('0x3f')],{});db['MailQueueReport'][_0xbd64('0x117')](db[_0xbd64('0x40')],{});db['MailQueueReport'][_0xbd64('0x117')](db[_0xbd64('0x12')],{});db[_0xbd64('0x166')][_0xbd64('0x117')](db[_0xbd64('0x3c')],{});db[_0xbd64('0x43')][_0xbd64('0x10d')](db[_0xbd64('0x45')],{'as':_0xbd64('0x168'),'onDelete':_0xbd64('0x10b')});db[_0xbd64('0x130')][_0xbd64('0x10d')](db[_0xbd64('0x7c')],{'as':_0xbd64('0x153'),'foreignKey':_0xbd64('0x169'),'onDelete':_0xbd64('0x10b')});db[_0xbd64('0x130')][_0xbd64('0x10d')](db[_0xbd64('0x7a')],{'as':'Answers','foreignKey':_0xbd64('0x169')});db[_0xbd64('0x130')][_0xbd64('0x10d')](db['FaxInteraction'],{'as':_0xbd64('0x155')});db[_0xbd64('0x130')][_0xbd64('0x10d')](db[_0xbd64('0x47')],{'as':_0xbd64('0x138')});db[_0xbd64('0x130')][_0xbd64('0x10d')](db[_0xbd64('0x18')],{'as':_0xbd64('0x16a'),'onDelete':_0xbd64('0x10b')});db[_0xbd64('0x130')][_0xbd64('0x10d')](db[_0xbd64('0x4a')],{'as':_0xbd64('0x149')});db[_0xbd64('0x130')]['belongsTo'](db[_0xbd64('0x2a')],{'as':_0xbd64('0x2a')});db[_0xbd64('0x130')]['belongsTo'](db[_0xbd64('0xf1')],{'as':_0xbd64('0x156'),'foreignKey':_0xbd64('0x167')});db[_0xbd64('0x130')][_0xbd64('0x117')](db[_0xbd64('0x143')],{'as':_0xbd64('0x16b'),'foreignKey':_0xbd64('0x16c')});db[_0xbd64('0x130')][_0xbd64('0x119')](db['User'],{'as':_0xbd64('0x146'),'through':'user_has_fax_accounts'});db[_0xbd64('0x47')]['belongsTo'](db[_0xbd64('0x12')],{'onDelete':_0xbd64('0x165')});db[_0xbd64('0x47')][_0xbd64('0x117')](db[_0xbd64('0x4b')],{'onDelete':_0xbd64('0x165')});db[_0xbd64('0x47')][_0xbd64('0x117')](db[_0xbd64('0x130')],{'onDelete':_0xbd64('0x165')});db[_0xbd64('0x47')][_0xbd64('0x117')](db[_0xbd64('0x87')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xbd64('0x49')][_0xbd64('0x10d')](db[_0xbd64('0x4a')],{'as':_0xbd64('0x149'),'onDelete':_0xbd64('0x10b'),'foreignKey':_0xbd64('0x16d')});db['FaxInteraction'][_0xbd64('0x117')](db['FaxAccount'],{'as':_0xbd64('0x15a'),'foreignKey':_0xbd64('0x169')});db['FaxInteraction'][_0xbd64('0x117')](db[_0xbd64('0x6a')],{'as':_0xbd64('0x14e'),'foreignKey':_0xbd64('0x14f')});db[_0xbd64('0x49')][_0xbd64('0x117')](db[_0xbd64('0x12')],{'as':'Owner','foreignKey':'UserId'});db['FaxInteraction'][_0xbd64('0x119')](db[_0xbd64('0x87')],{'through':_0xbd64('0x16e'),'as':_0xbd64('0x15c')});db['FaxInteraction'][_0xbd64('0x119')](db['Tag'],{'through':'fax_interaction_has_tags','as':'ThroughTags'});db['FaxInteraction'][_0xbd64('0x119')](db[_0xbd64('0x12')],{'as':_0xbd64('0x15f'),'through':_0xbd64('0x120'),'foreignKey':_0xbd64('0x16d')});db['FaxMessage'][_0xbd64('0x117')](db[_0xbd64('0x12')],{'onDelete':'cascade','as':'User'});db[_0xbd64('0x4a')]['belongsTo'](db[_0xbd64('0x49')],{'as':_0xbd64('0x161'),'foreignKey':_0xbd64('0x16d')});db[_0xbd64('0x4a')][_0xbd64('0x117')](db[_0xbd64('0x6a')],{'onDelete':_0xbd64('0x10b'),'as':_0xbd64('0x14e')});db[_0xbd64('0x4a')][_0xbd64('0x117')](db[_0xbd64('0xe8')],{'as':_0xbd64('0xe8'),'foreignKey':_0xbd64('0x16f')});db[_0xbd64('0x4a')]['belongsTo'](db[_0xbd64('0x130')],{'as':'Account','foreignKey':_0xbd64('0x169')});db['FaxQueue'][_0xbd64('0x119')](db[_0xbd64('0x12')],{'as':'Agents','through':_0xbd64('0x12a')});db[_0xbd64('0x4b')][_0xbd64('0x119')](db['Team'],{'through':_0xbd64('0x170'),'as':_0xbd64('0x158')});db[_0xbd64('0x4c')][_0xbd64('0x117')](db[_0xbd64('0x130')],{});db['FaxQueueReport'][_0xbd64('0x117')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0xbd64('0x4c')]['belongsTo'](db[_0xbd64('0x6a')],{'as':_0xbd64('0x14e'),'foreignKey':_0xbd64('0x14f')});db[_0xbd64('0x4c')][_0xbd64('0x117')](db['FaxInteraction'],{});db[_0xbd64('0x4c')]['belongsTo'](db[_0xbd64('0x4a')],{});db[_0xbd64('0x4c')]['belongsTo'](db[_0xbd64('0x12')],{});db[_0xbd64('0x4c')][_0xbd64('0x117')](db[_0xbd64('0x4b')],{});db[_0xbd64('0x4d')][_0xbd64('0x10d')](db[_0xbd64('0x7c')],{'as':_0xbd64('0x153'),'foreignKey':_0xbd64('0x171'),'onDelete':'cascade'});db[_0xbd64('0x4d')]['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':_0xbd64('0x171')});db['SmsAccount'][_0xbd64('0x10d')](db['SmsMessage'],{'as':_0xbd64('0x149'),'foreignKey':'SmsAccountId'});db[_0xbd64('0x4d')][_0xbd64('0x10d')](db[_0xbd64('0x50')],{'as':_0xbd64('0x155')});db[_0xbd64('0x4d')]['hasMany'](db[_0xbd64('0x4f')],{'as':_0xbd64('0x138')});db[_0xbd64('0x4d')]['belongsTo'](db[_0xbd64('0xf1')],{'as':_0xbd64('0x156'),'foreignKey':_0xbd64('0x167')});db[_0xbd64('0x4d')][_0xbd64('0x117')](db[_0xbd64('0x143')],{'as':'mandatoryDispositionPause','foreignKey':_0xbd64('0x16c')});db[_0xbd64('0x4d')][_0xbd64('0x119')](db[_0xbd64('0x12')],{'as':_0xbd64('0x146'),'through':_0xbd64('0x133')});db[_0xbd64('0x4f')][_0xbd64('0x117')](db[_0xbd64('0x12')],{'onDelete':_0xbd64('0x165')});db[_0xbd64('0x4f')]['belongsTo'](db[_0xbd64('0x53')],{'onDelete':_0xbd64('0x165')});db[_0xbd64('0x4f')][_0xbd64('0x117')](db[_0xbd64('0x4d')],{'onDelete':_0xbd64('0x165')});db[_0xbd64('0x4f')]['belongsTo'](db['Interval'],{'onDelete':'restrict','foreignKey':_0xbd64('0x142')});db[_0xbd64('0x4f')][_0xbd64('0x117')](db[_0xbd64('0x87')],{'onDelete':_0xbd64('0x165'),'foreignKey':_0xbd64('0x172')});db[_0xbd64('0x50')][_0xbd64('0x10d')](db[_0xbd64('0x51')],{'as':_0xbd64('0x149'),'onDelete':_0xbd64('0x10b'),'foreignKey':_0xbd64('0x173')});db[_0xbd64('0x50')][_0xbd64('0x117')](db[_0xbd64('0x4d')],{'as':_0xbd64('0x15a'),'foreignKey':'SmsAccountId'});db[_0xbd64('0x50')][_0xbd64('0x117')](db[_0xbd64('0x6a')],{'as':_0xbd64('0x14e'),'foreignKey':'ContactId'});db['SmsInteraction'][_0xbd64('0x117')](db[_0xbd64('0x12')],{'as':_0xbd64('0x15b'),'foreignKey':'UserId'});db[_0xbd64('0x50')]['belongsToMany'](db[_0xbd64('0x87')],{'through':_0xbd64('0x174'),'as':_0xbd64('0x15c')});db[_0xbd64('0x50')][_0xbd64('0x119')](db[_0xbd64('0x87')],{'through':_0xbd64('0x174'),'as':_0xbd64('0x15e')});db[_0xbd64('0x50')][_0xbd64('0x119')](db[_0xbd64('0x12')],{'as':_0xbd64('0x15f'),'through':_0xbd64('0x121'),'foreignKey':_0xbd64('0x173')});db[_0xbd64('0x51')][_0xbd64('0x117')](db[_0xbd64('0x12')],{'as':_0xbd64('0x12')});db['SmsMessage'][_0xbd64('0x117')](db['CmContact'],{'onDelete':_0xbd64('0x10b'),'as':_0xbd64('0x14e')});db[_0xbd64('0x51')][_0xbd64('0x117')](db[_0xbd64('0x50')],{'onDelete':_0xbd64('0x10b'),'as':_0xbd64('0x161'),'foreignKey':'SmsInteractionId'});db[_0xbd64('0x51')][_0xbd64('0x117')](db['SmsAccount'],{'as':'Account','foreignKey':'SmsAccountId'});db[_0xbd64('0x53')][_0xbd64('0x119')](db['User'],{'as':'Agents','through':_0xbd64('0x32'),'foreignKey':_0xbd64('0x175')});db[_0xbd64('0x53')][_0xbd64('0x119')](db[_0xbd64('0xe1')],{'through':'team_has_sms_queues','as':_0xbd64('0x158')});db[_0xbd64('0x55')][_0xbd64('0x10d')](db['Disposition'],{'as':_0xbd64('0x153'),'foreignKey':'OpenchannelAccountId','onDelete':'cascade'});db['OpenchannelAccount'][_0xbd64('0x10d')](db[_0xbd64('0x7a')],{'as':'Answers','foreignKey':'OpenchannelAccountId'});db[_0xbd64('0x55')][_0xbd64('0x10d')](db[_0xbd64('0x58')],{'as':_0xbd64('0x155'),'foreignKey':_0xbd64('0x176')});db[_0xbd64('0x55')][_0xbd64('0x10d')](db[_0xbd64('0x5a')],{'as':'Messages','foreignKey':_0xbd64('0x176')});db['OpenchannelAccount']['hasMany'](db[_0xbd64('0x56')],{'as':_0xbd64('0x138'),'foreignKey':_0xbd64('0x176')});db[_0xbd64('0x55')]['belongsTo'](db[_0xbd64('0xf1')],{'as':_0xbd64('0x156'),'foreignKey':_0xbd64('0x167')});db[_0xbd64('0x55')][_0xbd64('0x117')](db[_0xbd64('0x143')],{'as':'mandatoryDispositionPause','foreignKey':_0xbd64('0x16c')});db['OpenchannelAccount'][_0xbd64('0x119')](db['User'],{'as':_0xbd64('0x146'),'through':'user_has_openchannel_accounts'});db[_0xbd64('0x56')][_0xbd64('0x117')](db[_0xbd64('0x12')],{'onDelete':_0xbd64('0x165')});db[_0xbd64('0x56')][_0xbd64('0x117')](db[_0xbd64('0x5c')],{'onDelete':_0xbd64('0x165'),'foreignKey':_0xbd64('0x177')});db[_0xbd64('0x56')][_0xbd64('0x117')](db[_0xbd64('0x55')],{'onDelete':_0xbd64('0x165'),'foreignKey':'OpenchannelAccountId'});db[_0xbd64('0x56')][_0xbd64('0x117')](db[_0xbd64('0x7f')],{'onDelete':'restrict','foreignKey':_0xbd64('0x142')});db['OpenchannelApplication'][_0xbd64('0x117')](db['Tag'],{'onDelete':_0xbd64('0x165'),'foreignKey':'TagId'});db[_0xbd64('0x58')][_0xbd64('0x10d')](db['OpenchannelMessage'],{'as':'Messages','onDelete':_0xbd64('0x10b'),'foreignKey':'OpenchannelInteractionId'});db[_0xbd64('0x58')][_0xbd64('0x117')](db['OpenchannelAccount'],{'as':_0xbd64('0x15a'),'foreignKey':_0xbd64('0x176')});db[_0xbd64('0x58')][_0xbd64('0x117')](db[_0xbd64('0x6a')],{'as':'Contact','foreignKey':'ContactId'});db[_0xbd64('0x58')][_0xbd64('0x117')](db[_0xbd64('0x12')],{'as':_0xbd64('0x15b'),'foreignKey':'UserId'});db[_0xbd64('0x58')][_0xbd64('0x119')](db[_0xbd64('0x87')],{'through':_0xbd64('0x178'),'as':_0xbd64('0x15c')});db[_0xbd64('0x58')][_0xbd64('0x119')](db[_0xbd64('0x87')],{'through':_0xbd64('0x178'),'as':_0xbd64('0x15e')});db[_0xbd64('0x58')][_0xbd64('0x119')](db[_0xbd64('0x12')],{'as':_0xbd64('0x15f'),'through':'user_has_openchannel_interactions','foreignKey':_0xbd64('0x179')});db[_0xbd64('0x5a')][_0xbd64('0x117')](db['User'],{'onDelete':'cascade','as':'User'});db[_0xbd64('0x5a')][_0xbd64('0x117')](db[_0xbd64('0x6a')],{'onDelete':_0xbd64('0x10b'),'as':_0xbd64('0x14e')});db[_0xbd64('0x5a')][_0xbd64('0x117')](db[_0xbd64('0x58')],{'onDelete':_0xbd64('0x10b'),'as':'Interaction','foreignKey':_0xbd64('0x179')});db[_0xbd64('0x5a')][_0xbd64('0x117')](db['Attachment'],{'as':_0xbd64('0xe8'),'foreignKey':'AttachmentId'});db[_0xbd64('0x5a')][_0xbd64('0x117')](db[_0xbd64('0x55')],{'as':_0xbd64('0x15a'),'foreignKey':'OpenchannelAccountId'});db[_0xbd64('0x5c')][_0xbd64('0x119')](db[_0xbd64('0x12')],{'as':_0xbd64('0x146'),'through':_0xbd64('0x34'),'foreignKey':_0xbd64('0x177')});db['OpenchannelQueue'][_0xbd64('0x119')](db[_0xbd64('0xe1')],{'through':_0xbd64('0x17a'),'as':_0xbd64('0x158')});db[_0xbd64('0x5d')]['hasMany'](db['Disposition'],{'as':_0xbd64('0x153'),'foreignKey':'ChatWebsiteId','onDelete':_0xbd64('0x10b')});db['ChatWebsite'][_0xbd64('0x10d')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0xbd64('0x162')});db['ChatWebsite'][_0xbd64('0x10d')](db[_0xbd64('0x17b')],{'as':_0xbd64('0x17c')});db['ChatWebsite'][_0xbd64('0x10d')](db[_0xbd64('0x5f')],{'as':'Interactions'});db[_0xbd64('0x5d')][_0xbd64('0x10d')](db['ChatApplication'],{'as':_0xbd64('0x138')});db[_0xbd64('0x5d')][_0xbd64('0x10d')](db[_0xbd64('0x61')],{'as':_0xbd64('0x149')});db[_0xbd64('0x5d')][_0xbd64('0x117')](db[_0xbd64('0xf1')],{'as':_0xbd64('0x156'),'foreignKey':_0xbd64('0x167')});db[_0xbd64('0x5d')]['belongsTo'](db[_0xbd64('0x7f')],{'as':_0xbd64('0x7f'),'foreignKey':'IntervalId'});db['ChatWebsite']['belongsTo'](db[_0xbd64('0x3b')],{'as':'MailAccount','foreignKey':_0xbd64('0x150')});db[_0xbd64('0x5d')][_0xbd64('0x117')](db[_0xbd64('0x143')],{'as':'mandatoryDispositionPause','foreignKey':_0xbd64('0x16c')});db[_0xbd64('0x5d')][_0xbd64('0x119')](db[_0xbd64('0x12')],{'as':_0xbd64('0x146'),'through':_0xbd64('0x12f')});db['OpenchannelQueueReport'][_0xbd64('0x117')](db['OpenchannelAccount'],{});db[_0xbd64('0x17d')][_0xbd64('0x117')](db[_0xbd64('0xf1')],{'as':'List','foreignKey':_0xbd64('0x167')});db['OpenchannelQueueReport'][_0xbd64('0x117')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0xbd64('0x17d')][_0xbd64('0x117')](db['OpenchannelInteraction'],{});db[_0xbd64('0x17d')]['belongsTo'](db[_0xbd64('0x5a')],{});db[_0xbd64('0x17d')]['belongsTo'](db[_0xbd64('0x12')],{});db[_0xbd64('0x17d')][_0xbd64('0x117')](db[_0xbd64('0x5c')],{});db['ChatApplication']['belongsTo'](db[_0xbd64('0x12')],{'as':'Agent','foreignKey':_0xbd64('0x10c'),'onDelete':_0xbd64('0x165')});db[_0xbd64('0x5e')][_0xbd64('0x117')](db[_0xbd64('0x63')],{'as':_0xbd64('0x17e'),'foreignKey':'ChatQueueId','onDelete':_0xbd64('0x165')});db['ChatApplication'][_0xbd64('0x117')](db[_0xbd64('0x5d')],{'as':_0xbd64('0x17f'),'foreignKey':_0xbd64('0x162'),'onDelete':'restrict'});db[_0xbd64('0x5e')][_0xbd64('0x117')](db[_0xbd64('0x87')],{'onDelete':_0xbd64('0x165'),'foreignKey':_0xbd64('0x172')});db['ChatInteraction'][_0xbd64('0x10d')](db['ChatMessage'],{'as':_0xbd64('0x149'),'onDelete':'cascade','foreignKey':_0xbd64('0x180')});db['ChatInteraction'][_0xbd64('0x117')](db[_0xbd64('0x5d')],{'as':_0xbd64('0x15a'),'foreignKey':_0xbd64('0x162')});db[_0xbd64('0x5f')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xbd64('0x14f')});db['ChatInteraction']['belongsTo'](db[_0xbd64('0x12')],{'as':_0xbd64('0x15b'),'foreignKey':_0xbd64('0x10c')});db[_0xbd64('0x5f')][_0xbd64('0x119')](db[_0xbd64('0x87')],{'through':_0xbd64('0x181'),'as':_0xbd64('0x15c')});db[_0xbd64('0x5f')][_0xbd64('0x119')](db[_0xbd64('0x87')],{'through':_0xbd64('0x181'),'as':_0xbd64('0x15e')});db['ChatInteraction'][_0xbd64('0x119')](db[_0xbd64('0x12')],{'as':_0xbd64('0x15f'),'through':'user_has_chat_interactions','foreignKey':_0xbd64('0x180')});db[_0xbd64('0x61')][_0xbd64('0x117')](db[_0xbd64('0x12')],{'onDelete':_0xbd64('0x10b'),'as':_0xbd64('0x12')});db['ChatMessage'][_0xbd64('0x117')](db[_0xbd64('0x6a')],{'onDelete':_0xbd64('0x10b'),'as':'Contact','foreignKey':'ContactId'});db[_0xbd64('0x61')][_0xbd64('0x117')](db[_0xbd64('0x5f')],{'onDelete':_0xbd64('0x10b'),'as':_0xbd64('0x161'),'foreignKey':_0xbd64('0x180')});db['ChatMessage']['belongsTo'](db[_0xbd64('0xe8')],{'as':_0xbd64('0xe8'),'foreignKey':_0xbd64('0x16f')});db['ChatMessage'][_0xbd64('0x117')](db[_0xbd64('0x5d')],{'as':_0xbd64('0x15a'),'foreignKey':'ChatWebsiteId'});db['ChatOfflineMessage'][_0xbd64('0x10d')](db[_0xbd64('0xe8')],{'as':_0xbd64('0x160'),'foreignKey':_0xbd64('0x164'),'onDelete':_0xbd64('0x10b'),'hooks':!![]});db['ChatOfflineMessage'][_0xbd64('0x117')](db[_0xbd64('0x6a')],{'onDelete':_0xbd64('0x10b'),'as':_0xbd64('0x14e'),'foreignKey':'ContactId'});db[_0xbd64('0x163')]['belongsTo'](db[_0xbd64('0x5d')],{'as':'Account','foreignKey':_0xbd64('0x162')});db[_0xbd64('0x63')][_0xbd64('0x119')](db['User'],{'as':_0xbd64('0x146'),'through':_0xbd64('0x128'),'hooks':!![]});db[_0xbd64('0x63')][_0xbd64('0x119')](db[_0xbd64('0xe1')],{'through':'team_has_chat_queues','as':_0xbd64('0x158')});db[_0xbd64('0x65')]['hasMany'](db['ChatInternalMessage'],{'as':'Messages','foreignKey':'ChatGroupId','onDelete':_0xbd64('0x10b')});db[_0xbd64('0x65')][_0xbd64('0x119')](db['User'],{'as':'Members','through':_0xbd64('0x182')});db[_0xbd64('0x17b')][_0xbd64('0x117')](db[_0xbd64('0x5d')],{'as':_0xbd64('0x17f'),'foreignKey':_0xbd64('0x162')});db[_0xbd64('0x68')]['hasMany'](db[_0xbd64('0x6a')],{'as':_0xbd64('0x11a'),'foreignKey':_0xbd64('0x183')});db[_0xbd64('0x6a')][_0xbd64('0x10d')](db[_0xbd64('0x6c')],{'as':_0xbd64('0x184'),'foreignKey':'ContactId'});db[_0xbd64('0x6a')][_0xbd64('0x10d')](db[_0xbd64('0x70')],{'as':'HopperFinals','foreignKey':'ContactId'});db['CmContact'][_0xbd64('0x10d')](db[_0xbd64('0x72')],{'as':_0xbd64('0x13d'),'foreignKey':_0xbd64('0x14f')});db[_0xbd64('0x6a')][_0xbd64('0x10d')](db['ReportAgentPreview'],{'as':_0xbd64('0x74'),'foreignKey':_0xbd64('0x14f')});db[_0xbd64('0x6a')][_0xbd64('0x10d')](db[_0xbd64('0x185')],{'as':'JscriptySessions','foreignKey':_0xbd64('0x14f')});db['CmContact'][_0xbd64('0x10d')](db[_0xbd64('0x58')],{'as':_0xbd64('0x111'),'foreignKey':'ContactId','onDelete':_0xbd64('0x165')});db['CmContact'][_0xbd64('0x10d')](db[_0xbd64('0x5f')],{'as':'ChatInteractions','foreignKey':'ContactId','onDelete':_0xbd64('0x165')});db[_0xbd64('0x6a')][_0xbd64('0x10d')](db[_0xbd64('0x50')],{'as':_0xbd64('0x113'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0xbd64('0x6a')][_0xbd64('0x10d')](db[_0xbd64('0x49')],{'as':_0xbd64('0x11f'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0xbd64('0x6a')]['hasMany'](db[_0xbd64('0x3f')],{'as':_0xbd64('0x114'),'foreignKey':'ContactId','onDelete':_0xbd64('0x165')});db[_0xbd64('0x6a')][_0xbd64('0x117')](db[_0xbd64('0x68')],{'as':_0xbd64('0x186'),'foreignKey':_0xbd64('0x183')});db['CmContact'][_0xbd64('0x117')](db[_0xbd64('0xf1')],{'as':'List','foreignKey':'ListId','onDelete':_0xbd64('0x10b')});db[_0xbd64('0x6a')]['belongsToMany'](db['User'],{'as':_0xbd64('0x15f'),'through':'cm_user_has_contacts'});db[_0xbd64('0x6a')][_0xbd64('0x119')](db[_0xbd64('0x87')],{'as':'Tags','through':'cm_contact_has_tags'});db[_0xbd64('0x6a')][_0xbd64('0x119')](db['Tag'],{'through':_0xbd64('0x187'),'as':_0xbd64('0x15e')});db[_0xbd64('0x6c')][_0xbd64('0x117')](db[_0xbd64('0x6a')],{'as':'Contact','foreignKey':_0xbd64('0x14f'),'onDelete':_0xbd64('0x10b')});db[_0xbd64('0x6c')][_0xbd64('0x117')](db['CmList'],{'as':'List','foreignKey':'ListId','onDelete':_0xbd64('0x10b')});db[_0xbd64('0x6c')][_0xbd64('0x117')](db[_0xbd64('0x12')],{'as':_0xbd64('0x188'),'foreignKey':_0xbd64('0x10c')});db['CmHopper'][_0xbd64('0x117')](db[_0xbd64('0x1c')],{'as':_0xbd64('0x17e'),'foreignKey':_0xbd64('0x13c'),'onDelete':'cascade'});db['CmHopper'][_0xbd64('0x117')](db[_0xbd64('0xe5')],{'as':_0xbd64('0xe5'),'foreignKey':_0xbd64('0x189'),'onDelete':_0xbd64('0x10b')});db[_0xbd64('0x6c')][_0xbd64('0x117')](db[_0xbd64('0x12')],{'as':_0xbd64('0x15b'),'foreignKey':_0xbd64('0x18a')});db[_0xbd64('0x6e')][_0xbd64('0x117')](db['CmContact'],{'as':_0xbd64('0x14e'),'foreignKey':_0xbd64('0x14f'),'onDelete':'cascade'});db[_0xbd64('0x6e')][_0xbd64('0x117')](db[_0xbd64('0xf1')],{'as':'List','foreignKey':_0xbd64('0x167'),'onDelete':_0xbd64('0x10b')});db[_0xbd64('0x6e')]['belongsTo'](db[_0xbd64('0x1c')],{'as':_0xbd64('0x17e'),'foreignKey':_0xbd64('0x13c'),'onDelete':_0xbd64('0x10b')});db[_0xbd64('0x6e')]['belongsTo'](db['Campaign'],{'as':'Campaign','foreignKey':_0xbd64('0x189'),'onDelete':'cascade'});db[_0xbd64('0x78')][_0xbd64('0x10d')](db['Condition'],{'as':{'plural':_0xbd64('0x18b'),'singular':_0xbd64('0x18c')},'foreignKey':_0xbd64('0x18d'),'onDelete':_0xbd64('0x10b'),'hooks':!![]});db[_0xbd64('0x78')][_0xbd64('0x10d')](db[_0xbd64('0x7e')],{'as':{'plural':_0xbd64('0x18e'),'singular':_0xbd64('0x18f')},'foreignKey':_0xbd64('0x190'),'onDelete':_0xbd64('0x10b'),'hooks':!![]});db[_0xbd64('0x78')][_0xbd64('0x10d')](db[_0xbd64('0x76')],{'as':_0xbd64('0x191'),'foreignKey':'AutomationId','onDelete':_0xbd64('0x10b'),'hooks':!![]});db[_0xbd64('0x7c')]['hasMany'](db[_0xbd64('0x7c')],{'as':_0xbd64('0x153'),'foreignKey':'ParentId','onDelete':'cascade'});db[_0xbd64('0x7f')][_0xbd64('0x10d')](db['Interval'],{'as':_0xbd64('0x192'),'foreignKey':_0xbd64('0x142'),'onDelete':_0xbd64('0x10b'),'hooks':!![],'required':![]});db[_0xbd64('0x7f')][_0xbd64('0x10d')](db['VoiceExtension'],{'as':_0xbd64('0x193'),'foreignKey':'IntervalId','onDelete':_0xbd64('0x165')});db['Interval'][_0xbd64('0x10d')](db[_0xbd64('0x42')],{'as':_0xbd64('0x194'),'foreignKey':_0xbd64('0x142')});db['Interval']['hasMany'](db[_0xbd64('0x5e')],{'as':'ChatApplications','foreignKey':'IntervalId'});db['Interval'][_0xbd64('0x10d')](db['FaxApplication'],{'as':_0xbd64('0x195'),'foreignKey':_0xbd64('0x142')});db[_0xbd64('0x7f')][_0xbd64('0x10d')](db[_0xbd64('0x4f')],{'as':_0xbd64('0x196'),'foreignKey':_0xbd64('0x142')});db[_0xbd64('0x84')]['belongsTo'](db[_0xbd64('0x3b')],{});db['Schedule'][_0xbd64('0x117')](db[_0xbd64('0x93')],{'foreignKey':'DefaultReportId'});db[_0xbd64('0x84')][_0xbd64('0x117')](db['AnalyticCustomReport'],{'foreignKey':'CustomReportId'});db[_0xbd64('0x197')][_0xbd64('0x119')](db[_0xbd64('0x1a')],{'as':_0xbd64('0x198'),'through':_0xbd64('0x13a'),'onDelete':_0xbd64('0x165')});db[_0xbd64('0x87')][_0xbd64('0x119')](db[_0xbd64('0x6a')],{'through':_0xbd64('0x187')});db[_0xbd64('0x87')][_0xbd64('0x119')](db[_0xbd64('0x5f')],{'through':_0xbd64('0x181')});db[_0xbd64('0x87')][_0xbd64('0x119')](db['MailInteraction'],{'through':_0xbd64('0x15d')});db[_0xbd64('0x87')][_0xbd64('0x119')](db[_0xbd64('0x50')],{'through':'sms_interaction_has_tags'});db[_0xbd64('0x87')][_0xbd64('0x119')](db[_0xbd64('0x49')],{'through':'fax_interaction_has_tags'});db[_0xbd64('0x87')]['belongsToMany'](db['OpenchannelInteraction'],{'through':_0xbd64('0x178')});db[_0xbd64('0x87')][_0xbd64('0x119')](db[_0xbd64('0xff')],{'through':'whatsapp_interaction_has_tags'});db[_0xbd64('0x8b')]['hasMany'](db[_0xbd64('0x7e')],{'as':{'plural':'AllConditions','singular':_0xbd64('0x199')},'foreignKey':_0xbd64('0x19a'),'onDelete':_0xbd64('0x10b'),'hooks':!![]});db['Trigger'][_0xbd64('0x10d')](db['Condition'],{'as':{'plural':_0xbd64('0x19b'),'singular':_0xbd64('0x19c')},'foreignKey':'TriggerAnyId','onDelete':_0xbd64('0x10b'),'hooks':!![]});db[_0xbd64('0x8b')][_0xbd64('0x10d')](db[_0xbd64('0x76')],{'as':'Actions','foreignKey':_0xbd64('0x19d'),'onDelete':_0xbd64('0x10b'),'hooks':!![]});db[_0xbd64('0x91')]['hasMany'](db[_0xbd64('0x97')],{'as':'Fields','onDelete':_0xbd64('0x10b'),'foreignKey':_0xbd64('0x19e'),'hooks':!![]});db[_0xbd64('0x93')][_0xbd64('0x10d')](db[_0xbd64('0x97')],{'as':_0xbd64('0x19f'),'onDelete':_0xbd64('0x10b'),'foreignKey':_0xbd64('0x1a0')});db['AnalyticMetric'][_0xbd64('0x10d')](db[_0xbd64('0x97')],{'as':_0xbd64('0x19f'),'onDelete':_0xbd64('0x10b'),'foreignKey':'MetricId'});db['AnalyticFieldReport'][_0xbd64('0x117')](db[_0xbd64('0x96')],{'foreignKey':_0xbd64('0x1a1')});db[_0xbd64('0x99')][_0xbd64('0x10d')](db[_0xbd64('0x1a2')],{'as':_0xbd64('0x1a3'),'onDelete':'cascade','foreignKey':_0xbd64('0x1a4')});db['SalesforceConfiguration'][_0xbd64('0x10d')](db['SalesforceField'],{'as':'Subjects','onDelete':_0xbd64('0x10b'),'foreignKey':_0xbd64('0x1a5')});db['SalesforceConfiguration'][_0xbd64('0x10d')](db['SalesforceField'],{'as':_0xbd64('0x1a6'),'onDelete':_0xbd64('0x10b'),'foreignKey':_0xbd64('0x1a7')});db[_0xbd64('0x1a2')][_0xbd64('0x10d')](db['SalesforceField'],{'as':_0xbd64('0x19f'),'onDelete':'cascade','foreignKey':_0xbd64('0x1a8')});db['SalesforceConfiguration']['belongsTo'](db[_0xbd64('0x99')],{'as':_0xbd64('0x15a'),'foreignKey':'AccountId'});db[_0xbd64('0x9c')][_0xbd64('0x10d')](db['SalesforceField'],{'as':_0xbd64('0x1a9'),'foreignKey':'SubjectId'});db['SalesforceField'][_0xbd64('0x10d')](db[_0xbd64('0x9c')],{'as':_0xbd64('0x1aa'),'foreignKey':'DescriptionId'});db[_0xbd64('0x9c')][_0xbd64('0x10d')](db[_0xbd64('0x9c')],{'as':'Field','foreignKey':'FieldId'});db[_0xbd64('0x9c')][_0xbd64('0x117')](db[_0xbd64('0x8d')],{'as':_0xbd64('0x8d'),'foreignKey':_0xbd64('0x1ab')});db[_0xbd64('0x9e')][_0xbd64('0x10d')](db[_0xbd64('0x1ac')],{'as':_0xbd64('0x1a3'),'onDelete':'cascade','foreignKey':_0xbd64('0x1a4')});db['SugarcrmConfiguration'][_0xbd64('0x10d')](db['SugarcrmField'],{'as':_0xbd64('0x1ad'),'onDelete':_0xbd64('0x10b'),'foreignKey':'SubjectId'});db['SugarcrmConfiguration'][_0xbd64('0x10d')](db['SugarcrmField'],{'as':_0xbd64('0x1a6'),'onDelete':_0xbd64('0x10b'),'foreignKey':_0xbd64('0x1a7')});db[_0xbd64('0x1ac')]['hasMany'](db[_0xbd64('0xa0')],{'as':_0xbd64('0x19f'),'onDelete':_0xbd64('0x10b'),'foreignKey':'FieldId'});db[_0xbd64('0x1ac')][_0xbd64('0x117')](db[_0xbd64('0x9e')],{'as':_0xbd64('0x15a'),'foreignKey':_0xbd64('0x1a4')});db['SugarcrmField'][_0xbd64('0x10d')](db[_0xbd64('0xa0')],{'as':_0xbd64('0x1a9'),'foreignKey':_0xbd64('0x1a5')});db['SugarcrmField'][_0xbd64('0x10d')](db[_0xbd64('0xa0')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xbd64('0xa0')][_0xbd64('0x10d')](db['SugarcrmField'],{'as':_0xbd64('0x1ae'),'foreignKey':'FieldId'});db[_0xbd64('0xa0')][_0xbd64('0x117')](db[_0xbd64('0x8d')],{'as':'Variable','foreignKey':_0xbd64('0x1ab')});db[_0xbd64('0xa2')][_0xbd64('0x10d')](db['DeskConfiguration'],{'as':_0xbd64('0x1a3'),'onDelete':'cascade','foreignKey':_0xbd64('0x1a4')});db[_0xbd64('0xa3')][_0xbd64('0x10d')](db[_0xbd64('0xa4')],{'as':_0xbd64('0x1ad'),'onDelete':_0xbd64('0x10b'),'foreignKey':_0xbd64('0x1a5')});db[_0xbd64('0xa3')]['hasMany'](db['DeskField'],{'as':'Descriptions','onDelete':_0xbd64('0x10b'),'foreignKey':_0xbd64('0x1a7')});db[_0xbd64('0xa3')]['hasMany'](db[_0xbd64('0xa4')],{'as':_0xbd64('0x19f'),'onDelete':_0xbd64('0x10b'),'foreignKey':'FieldId'});db['DeskConfiguration']['belongsTo'](db[_0xbd64('0xa2')],{'as':_0xbd64('0x15a'),'foreignKey':_0xbd64('0x1a4')});db['DeskConfiguration']['belongsToMany'](db['Tag'],{'through':_0xbd64('0x1af')});db[_0xbd64('0xa4')]['hasMany'](db['DeskField'],{'as':_0xbd64('0x1a9'),'foreignKey':_0xbd64('0x1a5')});db[_0xbd64('0xa4')][_0xbd64('0x10d')](db[_0xbd64('0xa4')],{'as':_0xbd64('0x1aa'),'foreignKey':_0xbd64('0x1a7')});db[_0xbd64('0xa4')][_0xbd64('0x10d')](db[_0xbd64('0xa4')],{'as':_0xbd64('0x1ae'),'foreignKey':_0xbd64('0x1a8')});db[_0xbd64('0xa4')][_0xbd64('0x117')](db['Variable'],{'as':'Variable','foreignKey':_0xbd64('0x1ab')});db[_0xbd64('0xa6')][_0xbd64('0x10d')](db[_0xbd64('0xa8')],{'as':'Configurations','onDelete':_0xbd64('0x10b'),'foreignKey':_0xbd64('0x1a4')});db['ZohoConfiguration'][_0xbd64('0x10d')](db['ZohoField'],{'as':_0xbd64('0x1ad'),'onDelete':_0xbd64('0x10b'),'foreignKey':_0xbd64('0x1a5')});db[_0xbd64('0xa8')]['hasMany'](db[_0xbd64('0xa9')],{'as':_0xbd64('0x1a6'),'onDelete':_0xbd64('0x10b'),'foreignKey':_0xbd64('0x1a7')});db[_0xbd64('0xa8')][_0xbd64('0x10d')](db[_0xbd64('0xa9')],{'as':_0xbd64('0x19f'),'onDelete':'cascade','foreignKey':_0xbd64('0x1a8')});db[_0xbd64('0xa8')][_0xbd64('0x117')](db[_0xbd64('0xa6')],{'as':_0xbd64('0x15a'),'foreignKey':_0xbd64('0x1a4')});db[_0xbd64('0xa9')]['hasMany'](db[_0xbd64('0xa9')],{'as':_0xbd64('0x1a9'),'foreignKey':_0xbd64('0x1a5')});db[_0xbd64('0xa9')][_0xbd64('0x10d')](db[_0xbd64('0xa9')],{'as':_0xbd64('0x1aa'),'foreignKey':_0xbd64('0x1a7')});db[_0xbd64('0xa9')][_0xbd64('0x10d')](db['ZohoField'],{'as':_0xbd64('0x1ae'),'foreignKey':_0xbd64('0x1a8')});db[_0xbd64('0xa9')][_0xbd64('0x117')](db[_0xbd64('0x8d')],{'as':'Variable','foreignKey':_0xbd64('0x1ab')});db[_0xbd64('0xab')][_0xbd64('0x10d')](db[_0xbd64('0xad')],{'as':_0xbd64('0x1a3'),'onDelete':_0xbd64('0x10b'),'foreignKey':_0xbd64('0x1a4')});db['ZendeskConfiguration'][_0xbd64('0x10d')](db[_0xbd64('0xaf')],{'as':_0xbd64('0x1ad'),'foreignKey':_0xbd64('0x1a5')});db[_0xbd64('0xad')][_0xbd64('0x10d')](db[_0xbd64('0xaf')],{'as':_0xbd64('0x1a6'),'foreignKey':_0xbd64('0x1a7')});db['ZendeskConfiguration'][_0xbd64('0x10d')](db[_0xbd64('0xaf')],{'as':_0xbd64('0x19f'),'foreignKey':_0xbd64('0x1a8')});db['ZendeskConfiguration'][_0xbd64('0x117')](db['ZendeskAccount'],{'as':_0xbd64('0x15a'),'foreignKey':_0xbd64('0x1a4')});db[_0xbd64('0xad')][_0xbd64('0x119')](db[_0xbd64('0x87')],{'through':_0xbd64('0x1b0')});db[_0xbd64('0xaf')]['hasMany'](db[_0xbd64('0xaf')],{'as':_0xbd64('0x1a9'),'foreignKey':_0xbd64('0x1a5')});db[_0xbd64('0xaf')]['hasMany'](db[_0xbd64('0xaf')],{'as':_0xbd64('0x1aa'),'foreignKey':'DescriptionId'});db[_0xbd64('0xaf')][_0xbd64('0x10d')](db[_0xbd64('0xaf')],{'as':_0xbd64('0x1ae'),'foreignKey':'FieldId'});db[_0xbd64('0xaf')][_0xbd64('0x117')](db[_0xbd64('0x8d')],{'as':_0xbd64('0x8d'),'foreignKey':_0xbd64('0x1ab')});db[_0xbd64('0xb0')][_0xbd64('0x10d')](db[_0xbd64('0xb1')],{'as':_0xbd64('0x1a3'),'onDelete':_0xbd64('0x10b'),'foreignKey':_0xbd64('0x1a4')});db[_0xbd64('0xb1')]['hasMany'](db[_0xbd64('0xb3')],{'as':_0xbd64('0x1ad'),'onDelete':'cascade','foreignKey':_0xbd64('0x1a5')});db[_0xbd64('0xb1')][_0xbd64('0x10d')](db[_0xbd64('0xb3')],{'as':_0xbd64('0x1a6'),'onDelete':_0xbd64('0x10b'),'foreignKey':_0xbd64('0x1a7')});db[_0xbd64('0xb1')][_0xbd64('0x10d')](db[_0xbd64('0xb3')],{'as':_0xbd64('0x19f'),'onDelete':_0xbd64('0x10b'),'foreignKey':'FieldId'});db['FreshdeskConfiguration'][_0xbd64('0x117')](db[_0xbd64('0xb0')],{'as':_0xbd64('0x15a'),'foreignKey':_0xbd64('0x1a4')});db['FreshdeskConfiguration'][_0xbd64('0x119')](db['Tag'],{'through':_0xbd64('0x1b1')});db[_0xbd64('0xb3')]['hasMany'](db['FreshdeskField'],{'as':_0xbd64('0x1a9'),'foreignKey':_0xbd64('0x1a5')});db[_0xbd64('0xb3')][_0xbd64('0x10d')](db[_0xbd64('0xb3')],{'as':_0xbd64('0x1aa'),'foreignKey':_0xbd64('0x1a7')});db['FreshdeskField'][_0xbd64('0x10d')](db[_0xbd64('0xb3')],{'as':_0xbd64('0x1ae'),'foreignKey':_0xbd64('0x1a8')});db[_0xbd64('0xb3')][_0xbd64('0x117')](db['Variable'],{'as':_0xbd64('0x8d'),'foreignKey':_0xbd64('0x1ab')});db['VtigerAccount'][_0xbd64('0x10d')](db[_0xbd64('0xb6')],{'as':_0xbd64('0x1a3'),'onDelete':_0xbd64('0x10b'),'foreignKey':'AccountId'});db[_0xbd64('0xb6')][_0xbd64('0x10d')](db[_0xbd64('0xb8')],{'as':_0xbd64('0x1ad'),'foreignKey':_0xbd64('0x1a5')});db[_0xbd64('0xb6')][_0xbd64('0x10d')](db['VtigerField'],{'as':_0xbd64('0x1a6'),'foreignKey':_0xbd64('0x1a7')});db[_0xbd64('0xb6')][_0xbd64('0x10d')](db[_0xbd64('0xb8')],{'as':_0xbd64('0x19f'),'foreignKey':_0xbd64('0x1a8')});db[_0xbd64('0xb6')][_0xbd64('0x117')](db[_0xbd64('0xb5')],{'as':'Account','foreignKey':_0xbd64('0x1a4')});db[_0xbd64('0xb8')][_0xbd64('0x10d')](db[_0xbd64('0xb8')],{'as':_0xbd64('0x1a9'),'foreignKey':_0xbd64('0x1a5')});db[_0xbd64('0xb8')][_0xbd64('0x10d')](db[_0xbd64('0xb8')],{'as':_0xbd64('0x1aa'),'foreignKey':_0xbd64('0x1a7')});db[_0xbd64('0xb8')][_0xbd64('0x10d')](db['VtigerField'],{'as':_0xbd64('0x1ae'),'foreignKey':'FieldId'});db[_0xbd64('0xb8')][_0xbd64('0x117')](db[_0xbd64('0x8d')],{'as':_0xbd64('0x8d'),'foreignKey':'VariableId'});db[_0xbd64('0x1b2')]['hasMany'](db[_0xbd64('0xba')],{'as':_0xbd64('0x1a3'),'onDelete':_0xbd64('0x10b'),'foreignKey':'AccountId'});db[_0xbd64('0xba')][_0xbd64('0x10d')](db[_0xbd64('0xbc')],{'as':_0xbd64('0x1ad'),'foreignKey':_0xbd64('0x1a5')});db[_0xbd64('0xba')]['hasMany'](db[_0xbd64('0xbc')],{'as':_0xbd64('0x1a6'),'foreignKey':_0xbd64('0x1a7')});db[_0xbd64('0xba')]['hasMany'](db['ServicenowField'],{'as':_0xbd64('0x19f'),'foreignKey':_0xbd64('0x1a8')});db[_0xbd64('0xba')][_0xbd64('0x117')](db[_0xbd64('0x1b2')],{'as':_0xbd64('0x15a'),'foreignKey':_0xbd64('0x1a4')});db[_0xbd64('0xbc')]['hasMany'](db[_0xbd64('0xbc')],{'as':'Subject','foreignKey':_0xbd64('0x1a5')});db[_0xbd64('0xbc')][_0xbd64('0x10d')](db[_0xbd64('0xbc')],{'as':_0xbd64('0x1aa'),'foreignKey':'DescriptionId'});db[_0xbd64('0xbc')]['hasMany'](db[_0xbd64('0xbc')],{'as':_0xbd64('0x1ae'),'foreignKey':_0xbd64('0x1a8')});db[_0xbd64('0xbc')][_0xbd64('0x117')](db['Variable'],{'as':_0xbd64('0x8d'),'foreignKey':'VariableId'});db[_0xbd64('0xbe')]['hasMany'](db[_0xbd64('0x1b3')],{'as':_0xbd64('0x1a3'),'onDelete':_0xbd64('0x10b'),'foreignKey':_0xbd64('0x1a4')});db[_0xbd64('0x1b3')][_0xbd64('0x10d')](db[_0xbd64('0xc0')],{'as':_0xbd64('0x1ad'),'onDelete':_0xbd64('0x10b'),'foreignKey':'SubjectId'});db[_0xbd64('0x1b3')][_0xbd64('0x10d')](db[_0xbd64('0xc0')],{'as':'Descriptions','onDelete':_0xbd64('0x10b'),'foreignKey':'DescriptionId'});db[_0xbd64('0x1b3')]['hasMany'](db[_0xbd64('0xc0')],{'as':_0xbd64('0x19f'),'onDelete':_0xbd64('0x10b'),'foreignKey':_0xbd64('0x1a8')});db[_0xbd64('0x1b3')][_0xbd64('0x117')](db[_0xbd64('0xbe')],{'as':_0xbd64('0x15a'),'foreignKey':_0xbd64('0x1a4')});db[_0xbd64('0xc0')][_0xbd64('0x10d')](db[_0xbd64('0xc0')],{'as':_0xbd64('0x1a9'),'foreignKey':_0xbd64('0x1a5')});db[_0xbd64('0xc0')][_0xbd64('0x10d')](db[_0xbd64('0xc0')],{'as':_0xbd64('0x1aa'),'foreignKey':_0xbd64('0x1a7')});db['Dynamics365Field']['hasMany'](db['Dynamics365Field'],{'as':'Field','foreignKey':'FieldId'});db['Dynamics365Field']['belongsTo'](db['Variable'],{'as':_0xbd64('0x8d'),'foreignKey':_0xbd64('0x1ab')});db[_0xbd64('0xc2')][_0xbd64('0x10d')](db[_0xbd64('0xc4')],{'as':_0xbd64('0x1a3'),'onDelete':'cascade','foreignKey':_0xbd64('0x1a4')});db['FreshsalesConfiguration'][_0xbd64('0x10d')](db[_0xbd64('0xc6')],{'as':_0xbd64('0x1ad'),'foreignKey':_0xbd64('0x1a5')});db['FreshsalesConfiguration'][_0xbd64('0x10d')](db[_0xbd64('0xc6')],{'as':'Descriptions','foreignKey':_0xbd64('0x1a7')});db['FreshsalesConfiguration']['hasMany'](db[_0xbd64('0xc6')],{'as':'Fields','foreignKey':'FieldId'});db['FreshsalesConfiguration'][_0xbd64('0x117')](db[_0xbd64('0xc2')],{'as':_0xbd64('0x15a'),'foreignKey':_0xbd64('0x1a4')});db[_0xbd64('0xc6')][_0xbd64('0x10d')](db[_0xbd64('0xc6')],{'as':_0xbd64('0x1a9'),'foreignKey':_0xbd64('0x1a5')});db[_0xbd64('0xc6')][_0xbd64('0x10d')](db[_0xbd64('0xc6')],{'as':_0xbd64('0x1aa'),'foreignKey':_0xbd64('0x1a7')});db[_0xbd64('0xc6')]['hasMany'](db[_0xbd64('0xc6')],{'as':_0xbd64('0x1ae'),'foreignKey':_0xbd64('0x1a8')});db['FreshsalesField']['belongsTo'](db[_0xbd64('0x8d')],{'as':'Variable','foreignKey':_0xbd64('0x1ab')});db[_0xbd64('0xcb')][_0xbd64('0x117')](db[_0xbd64('0x5d')],{});db['ChatQueueReport'][_0xbd64('0x117')](db['CmList'],{'as':_0xbd64('0x156'),'foreignKey':_0xbd64('0x167')});db[_0xbd64('0xcb')][_0xbd64('0x117')](db[_0xbd64('0x6a')],{'as':_0xbd64('0x14e'),'foreignKey':'ContactId'});db['ChatQueueReport']['belongsTo'](db[_0xbd64('0x5f')],{});db['ChatQueueReport'][_0xbd64('0x117')](db[_0xbd64('0x61')],{});db['ChatQueueReport'][_0xbd64('0x117')](db['User'],{});db[_0xbd64('0xcb')][_0xbd64('0x117')](db[_0xbd64('0x63')],{});db[_0xbd64('0xcd')][_0xbd64('0x117')](db[_0xbd64('0x12')],{'onDelete':'cascade','foreignKey':_0xbd64('0x1b4')});db[_0xbd64('0xcd')][_0xbd64('0x117')](db['User'],{'onDelete':_0xbd64('0x10b'),'foreignKey':_0xbd64('0x1b5')});db[_0xbd64('0x185')][_0xbd64('0x10d')](db[_0xbd64('0x1b6')],{'foreignKey':_0xbd64('0x1b7'),'onDelete':_0xbd64('0x10b')});db[_0xbd64('0x185')][_0xbd64('0x10d')](db[_0xbd64('0x1b8')],{'foreignKey':_0xbd64('0x1b7'),'onDelete':_0xbd64('0x10b')});db['SmsQueueReport'][_0xbd64('0x117')](db['SmsAccount'],{});db['SmsQueueReport'][_0xbd64('0x117')](db[_0xbd64('0xf1')],{'as':_0xbd64('0x156'),'foreignKey':'ListId'});db['SmsQueueReport'][_0xbd64('0x117')](db[_0xbd64('0x6a')],{'as':'Contact','foreignKey':'ContactId'});db[_0xbd64('0xd2')][_0xbd64('0x117')](db[_0xbd64('0x50')],{});db[_0xbd64('0xd2')][_0xbd64('0x117')](db['SmsMessage'],{});db[_0xbd64('0xd2')][_0xbd64('0x117')](db['User'],{});db[_0xbd64('0xd2')][_0xbd64('0x117')](db[_0xbd64('0x53')],{});db[_0xbd64('0xd7')][_0xbd64('0x10d')](db[_0xbd64('0x185')],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0xbd64('0x10d')](db['JscriptyQuestionReport'],{'foreignKey':_0xbd64('0x1b9')});db[_0xbd64('0xd7')][_0xbd64('0x10d')](db['JscriptyAnswerReport'],{'foreignKey':_0xbd64('0x1b9')});db[_0xbd64('0x136')][_0xbd64('0x119')](db[_0xbd64('0x12')],{'as':'Users','through':_0xbd64('0x1ba')});db[_0xbd64('0xe1')][_0xbd64('0x119')](db['User'],{'as':_0xbd64('0x146'),'through':_0xbd64('0x11c')});db['Team']['belongsToMany'](db[_0xbd64('0x1c')],{'through':'TeamVoiceQueue','as':_0xbd64('0x1bb')});db[_0xbd64('0xe1')][_0xbd64('0x119')](db[_0xbd64('0x3c')],{'through':_0xbd64('0x1bc'),'as':_0xbd64('0x125')});db[_0xbd64('0xe1')][_0xbd64('0x119')](db[_0xbd64('0x63')],{'through':'team_has_chat_queues','as':_0xbd64('0x127')});db[_0xbd64('0xe1')][_0xbd64('0x119')](db[_0xbd64('0x4b')],{'through':_0xbd64('0x170'),'as':_0xbd64('0x129')});db[_0xbd64('0xe1')][_0xbd64('0x119')](db[_0xbd64('0x53')],{'through':_0xbd64('0x1bd'),'as':_0xbd64('0x12b')});db[_0xbd64('0xe1')][_0xbd64('0x119')](db[_0xbd64('0x5c')],{'through':_0xbd64('0x17a'),'as':_0xbd64('0x12c')});db[_0xbd64('0xe1')]['belongsToMany'](db[_0xbd64('0x12d')],{'through':_0xbd64('0x1be'),'as':_0xbd64('0x12e')});db[_0xbd64('0xe1')][_0xbd64('0x119')](db['VoicePrefix'],{'through':_0xbd64('0x107'),'as':_0xbd64('0x1bf')});db[_0xbd64('0xe5')][_0xbd64('0x10d')](db[_0xbd64('0x6c')],{'as':_0xbd64('0x184'),'foreignKey':_0xbd64('0x189')});db[_0xbd64('0xe5')]['hasMany'](db['CmHopperFinal'],{'as':_0xbd64('0x10f'),'foreignKey':_0xbd64('0x189')});db[_0xbd64('0xe5')][_0xbd64('0x10d')](db[_0xbd64('0x72')],{'as':'HopperHistories','foreignKey':_0xbd64('0x189')});db['Campaign']['hasMany'](db[_0xbd64('0x6e')],{'as':_0xbd64('0x13e'),'foreignKey':_0xbd64('0x189')});db[_0xbd64('0xe5')]['belongsTo'](db['Trunk'],{'as':_0xbd64('0x2a'),'foreignKey':'TrunkId'});db['Campaign'][_0xbd64('0x117')](db[_0xbd64('0x2a')],{'as':_0xbd64('0x140'),'foreignKey':_0xbd64('0x141')});db[_0xbd64('0xe5')][_0xbd64('0x117')](db[_0xbd64('0x7f')],{'as':_0xbd64('0x7f'),'foreignKey':_0xbd64('0x142')});db[_0xbd64('0xe5')]['belongsTo'](db[_0xbd64('0x136')],{'as':_0xbd64('0x136'),'foreignKey':_0xbd64('0x1c0')});db[_0xbd64('0xe5')]['belongsToMany'](db[_0xbd64('0xf1')],{'as':_0xbd64('0x144'),'through':_0xbd64('0x1c1')});db['Campaign'][_0xbd64('0x119')](db[_0xbd64('0xf1')],{'as':'BlackLists','through':_0xbd64('0x1c2')});db['Attachment']['belongsTo'](db['ChatOfflineMessage'],{'as':_0xbd64('0x163'),'foreignKey':'ChatOfflineMessageId'});db['MailTransferReport'][_0xbd64('0x117')](db['MailMessage'],{});db[_0xbd64('0xea')][_0xbd64('0x117')](db[_0xbd64('0x3f')],{});db[_0xbd64('0xea')][_0xbd64('0x117')](db[_0xbd64('0x3b')],{'foreignKey':_0xbd64('0x1c3'),'as':'FromAccount'});db['MailTransferReport']['belongsTo'](db[_0xbd64('0x12')],{'foreignKey':'FromUserId','as':_0xbd64('0x1c4')});db[_0xbd64('0xea')][_0xbd64('0x117')](db[_0xbd64('0x12')],{'foreignKey':_0xbd64('0x1c5'),'as':_0xbd64('0x1c6')});db['MailTransferReport'][_0xbd64('0x117')](db['MailQueue'],{'foreignKey':_0xbd64('0x1c7'),'as':_0xbd64('0x1c8')});db[_0xbd64('0xea')][_0xbd64('0x117')](db[_0xbd64('0x3b')],{'foreignKey':'ToMailAccountId','as':_0xbd64('0x1c9')});db[_0xbd64('0xec')]['belongsTo'](db['ChatMessage'],{});db['ChatTransferReport'][_0xbd64('0x117')](db[_0xbd64('0x5f')],{});db[_0xbd64('0xec')][_0xbd64('0x117')](db['ChatWebsite'],{'foreignKey':_0xbd64('0x1ca'),'as':'FromAccount'});db['ChatTransferReport'][_0xbd64('0x117')](db[_0xbd64('0x12')],{'foreignKey':_0xbd64('0x1cb'),'as':_0xbd64('0x1c4')});db[_0xbd64('0xec')][_0xbd64('0x117')](db['User'],{'foreignKey':_0xbd64('0x1c5'),'as':_0xbd64('0x1c6')});db['ChatTransferReport'][_0xbd64('0x117')](db[_0xbd64('0x63')],{'foreignKey':_0xbd64('0x1cc'),'as':_0xbd64('0x1c8')});db[_0xbd64('0xec')][_0xbd64('0x117')](db[_0xbd64('0x5d')],{'foreignKey':'ToChatWebsiteId','as':_0xbd64('0x1c9')});db[_0xbd64('0x1cd')][_0xbd64('0x117')](db[_0xbd64('0x4a')],{});db[_0xbd64('0x1cd')][_0xbd64('0x117')](db[_0xbd64('0x49')],{});db[_0xbd64('0x1cd')]['belongsTo'](db['FaxAccount'],{'foreignKey':'FromFaxAccountId','as':'FromAccount'});db[_0xbd64('0x1cd')]['belongsTo'](db['User'],{'foreignKey':_0xbd64('0x1cb'),'as':'FromAgent'});db['FaxTransferReport'][_0xbd64('0x117')](db[_0xbd64('0x12')],{'foreignKey':_0xbd64('0x1c5'),'as':'ToAgent'});db[_0xbd64('0x1cd')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0xbd64('0x1ce'),'as':'ToQueue'});db[_0xbd64('0x1cd')][_0xbd64('0x117')](db['FaxAccount'],{'foreignKey':'ToFaxAccountId','as':_0xbd64('0x1c9')});db[_0xbd64('0xee')][_0xbd64('0x117')](db[_0xbd64('0x5a')],{});db[_0xbd64('0xee')][_0xbd64('0x117')](db[_0xbd64('0x58')],{});db[_0xbd64('0xee')]['belongsTo'](db[_0xbd64('0x55')],{'foreignKey':_0xbd64('0x1cf'),'as':_0xbd64('0x1d0')});db[_0xbd64('0xee')][_0xbd64('0x117')](db['User'],{'foreignKey':'FromUserId','as':_0xbd64('0x1c4')});db['OpenchannelTransferReport'][_0xbd64('0x117')](db[_0xbd64('0x12')],{'foreignKey':_0xbd64('0x1c5'),'as':_0xbd64('0x1c6')});db[_0xbd64('0xee')][_0xbd64('0x117')](db[_0xbd64('0x5c')],{'foreignKey':'ToOpenchannelQueueId','as':_0xbd64('0x1c8')});db[_0xbd64('0xee')]['belongsTo'](db[_0xbd64('0x55')],{'foreignKey':_0xbd64('0x1d1'),'as':'ToAccount'});db[_0xbd64('0xef')][_0xbd64('0x117')](db[_0xbd64('0x51')],{});db[_0xbd64('0xef')][_0xbd64('0x117')](db['SmsInteraction'],{});db[_0xbd64('0xef')][_0xbd64('0x117')](db[_0xbd64('0x4d')],{'foreignKey':_0xbd64('0x1d2'),'as':_0xbd64('0x1d0')});db[_0xbd64('0xef')][_0xbd64('0x117')](db['User'],{'foreignKey':_0xbd64('0x1cb'),'as':_0xbd64('0x1c4')});db[_0xbd64('0xef')][_0xbd64('0x117')](db[_0xbd64('0x12')],{'foreignKey':_0xbd64('0x1c5'),'as':_0xbd64('0x1c6')});db[_0xbd64('0xef')]['belongsTo'](db['SmsQueue'],{'foreignKey':_0xbd64('0x1d3'),'as':'ToQueue'});db[_0xbd64('0xef')]['belongsTo'](db[_0xbd64('0x4d')],{'foreignKey':_0xbd64('0x1d4'),'as':_0xbd64('0x1c9')});db[_0xbd64('0xf1')]['hasMany'](db['Disposition'],{'as':_0xbd64('0x153'),'foreignKey':_0xbd64('0x167'),'onDelete':_0xbd64('0x10b')});db[_0xbd64('0xf1')][_0xbd64('0x10d')](db[_0xbd64('0x75')],{'as':_0xbd64('0x1d5'),'foreignKey':_0xbd64('0x167')});db[_0xbd64('0xf1')][_0xbd64('0x10d')](db[_0xbd64('0x6a')],{'as':_0xbd64('0x11a'),'onDelete':_0xbd64('0x10b'),'foreignKey':_0xbd64('0x167')});db[_0xbd64('0xf1')][_0xbd64('0x10d')](db['CmHopperFinal'],{'as':_0xbd64('0x10f'),'foreignKey':_0xbd64('0x167')});db[_0xbd64('0xf1')][_0xbd64('0x10d')](db[_0xbd64('0x72')],{'as':_0xbd64('0x110'),'foreignKey':_0xbd64('0x167')});db[_0xbd64('0xf1')][_0xbd64('0x10d')](db[_0xbd64('0x74')],{'as':_0xbd64('0x74'),'foreignKey':'ListId'});db[_0xbd64('0xf1')][_0xbd64('0x119')](db[_0xbd64('0x1c')],{'as':_0xbd64('0x1d6'),'through':_0xbd64('0x145')});db['CmList']['belongsToMany'](db[_0xbd64('0x12')],{'as':_0xbd64('0x146'),'through':_0xbd64('0x11b')});db[_0xbd64('0xf3')][_0xbd64('0x10d')](db['VoiceExtension'],{'as':_0xbd64('0x193'),'onDelete':'cascade'});db[_0xbd64('0xf3')]['belongsToMany'](db[_0xbd64('0x12')],{'as':'Agents','through':_0xbd64('0x108')});db[_0xbd64('0xf3')]['belongsToMany'](db[_0xbd64('0xe1')],{'through':_0xbd64('0x107'),'as':_0xbd64('0x158')});db['UserProfile']['hasMany'](db[_0xbd64('0x12')],{'as':_0xbd64('0x15f'),'foreignKey':_0xbd64('0x118')});db[_0xbd64('0xf5')][_0xbd64('0x10d')](db[_0xbd64('0xf7')],{'as':_0xbd64('0x1d7'),'foreignKey':_0xbd64('0x118'),'onDelete':_0xbd64('0x10b')});db[_0xbd64('0xf7')][_0xbd64('0x10d')](db[_0xbd64('0xf9')],{'as':_0xbd64('0x1d8'),'foreignKey':'sectionId','onDelete':_0xbd64('0x10b')});db[_0xbd64('0xfb')][_0xbd64('0x10d')](db[_0xbd64('0x7c')],{'as':_0xbd64('0x153'),'foreignKey':_0xbd64('0x1d9'),'onDelete':_0xbd64('0x10b')});db['WhatsappAccount'][_0xbd64('0x10d')](db[_0xbd64('0x7a')],{'as':_0xbd64('0x154'),'foreignKey':_0xbd64('0x1d9')});db['WhatsappAccount'][_0xbd64('0x10d')](db[_0xbd64('0x1da')],{'as':'Messages','foreignKey':'WhatsappAccountId'});db[_0xbd64('0xfb')]['hasMany'](db[_0xbd64('0xff')],{'as':_0xbd64('0x155')});db[_0xbd64('0xfb')]['hasMany'](db[_0xbd64('0xfd')],{'as':_0xbd64('0x138')});db[_0xbd64('0xfb')][_0xbd64('0x117')](db[_0xbd64('0xf1')],{'as':_0xbd64('0x156'),'foreignKey':'ListId'});db[_0xbd64('0xfb')]['belongsTo'](db[_0xbd64('0x143')],{'as':_0xbd64('0x16b'),'foreignKey':'mandatoryDispositionPauseId'});db['WhatsappAccount'][_0xbd64('0x119')](db[_0xbd64('0x12')],{'as':_0xbd64('0x146'),'through':_0xbd64('0x135')});db[_0xbd64('0xfd')][_0xbd64('0x117')](db[_0xbd64('0x12')],{'onDelete':_0xbd64('0x165')});db[_0xbd64('0xfd')]['belongsTo'](db[_0xbd64('0x12d')],{'onDelete':_0xbd64('0x165')});db[_0xbd64('0xfd')][_0xbd64('0x117')](db[_0xbd64('0xfb')],{'onDelete':_0xbd64('0x165')});db['WhatsappApplication'][_0xbd64('0x117')](db[_0xbd64('0x7f')],{'onDelete':_0xbd64('0x165'),'foreignKey':_0xbd64('0x142')});db['WhatsappApplication'][_0xbd64('0x117')](db[_0xbd64('0x87')],{'onDelete':_0xbd64('0x165'),'foreignKey':_0xbd64('0x172')});db['WhatsappInteraction'][_0xbd64('0x10d')](db['WhatsappMessage'],{'as':_0xbd64('0x149'),'onDelete':_0xbd64('0x10b'),'foreignKey':_0xbd64('0x1db')});db['WhatsappInteraction'][_0xbd64('0x117')](db[_0xbd64('0xfb')],{'as':_0xbd64('0x15a'),'foreignKey':_0xbd64('0x1d9')});db['WhatsappInteraction'][_0xbd64('0x117')](db['CmContact'],{'as':_0xbd64('0x14e'),'foreignKey':_0xbd64('0x14f')});db[_0xbd64('0xff')][_0xbd64('0x117')](db[_0xbd64('0x12')],{'as':'Owner','foreignKey':_0xbd64('0x10c')});db[_0xbd64('0xff')][_0xbd64('0x119')](db[_0xbd64('0x87')],{'through':_0xbd64('0x1dc'),'as':_0xbd64('0x15c')});db[_0xbd64('0xff')][_0xbd64('0x119')](db[_0xbd64('0x87')],{'through':_0xbd64('0x1dc'),'as':'ThroughTags'});db['WhatsappInteraction'][_0xbd64('0x119')](db[_0xbd64('0x12')],{'as':_0xbd64('0x15f'),'through':_0xbd64('0x124'),'foreignKey':_0xbd64('0x1db')});db[_0xbd64('0x1da')][_0xbd64('0x117')](db[_0xbd64('0x12')],{'as':_0xbd64('0x12')});db[_0xbd64('0x1da')][_0xbd64('0x117')](db['CmContact'],{'onDelete':_0xbd64('0x10b'),'as':_0xbd64('0x14e')});db[_0xbd64('0x1da')][_0xbd64('0x117')](db[_0xbd64('0xff')],{'onDelete':_0xbd64('0x10b'),'as':_0xbd64('0x161'),'foreignKey':_0xbd64('0x1db')});db['WhatsappMessage']['belongsTo'](db[_0xbd64('0xfb')],{'as':'Account','foreignKey':_0xbd64('0x1d9')});db[_0xbd64('0x1dd')][_0xbd64('0x117')](db[_0xbd64('0xfb')],{});db['WhatsappQueueReport'][_0xbd64('0x117')](db[_0xbd64('0xf1')],{'as':_0xbd64('0x156'),'foreignKey':_0xbd64('0x167')});db[_0xbd64('0x1dd')][_0xbd64('0x117')](db[_0xbd64('0x6a')],{'as':'Contact','foreignKey':_0xbd64('0x14f')});db[_0xbd64('0x1dd')][_0xbd64('0x117')](db['WhatsappInteraction'],{});db[_0xbd64('0x1dd')]['belongsTo'](db[_0xbd64('0x12d')],{});db[_0xbd64('0x1dd')][_0xbd64('0x117')](db[_0xbd64('0x1da')],{});db['WhatsappQueueReport']['belongsTo'](db[_0xbd64('0x12')],{});db[_0xbd64('0x102')][_0xbd64('0x117')](db[_0xbd64('0x1da')],{});db[_0xbd64('0x102')][_0xbd64('0x117')](db[_0xbd64('0xff')],{});db[_0xbd64('0x102')][_0xbd64('0x117')](db[_0xbd64('0xfb')],{'foreignKey':_0xbd64('0x1de'),'as':'FromAccount'});db[_0xbd64('0x102')]['belongsTo'](db[_0xbd64('0xfb')],{'foreignKey':'ToWhatsappAccountId','as':_0xbd64('0x1c9')});db[_0xbd64('0x102')][_0xbd64('0x117')](db[_0xbd64('0x12d')],{'foreignKey':_0xbd64('0x1df'),'as':_0xbd64('0x1c8')});db[_0xbd64('0x102')][_0xbd64('0x117')](db[_0xbd64('0x12')],{'foreignKey':'FromUserId','as':_0xbd64('0x1c4')});db[_0xbd64('0x102')]['belongsTo'](db[_0xbd64('0x12')],{'foreignKey':'ToUserId','as':_0xbd64('0x1c6')});db[_0xbd64('0x12d')][_0xbd64('0x119')](db['User'],{'as':_0xbd64('0x146'),'through':_0xbd64('0x36'),'foreignKey':_0xbd64('0x1e0')});db[_0xbd64('0x12d')]['belongsToMany'](db[_0xbd64('0xe1')],{'through':_0xbd64('0x1be'),'as':_0xbd64('0x158')});module[_0xbd64('0x1e1')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 54820fc..87606e3 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a0b=['./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/interactions','./api/smsInteraction','/api/sms/queues','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','./api/automation','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/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/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','./api/realtime','/api/auth/local','/api/auth/google','./api/jira','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','/api/webbar','./api/webbar','static','join','root','/apidoc','/www','/demo','/snippet','3.0.0','/server/files/plugins','route','get','sendFile','appPath','/index.html','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientSecret','securityToken','code','accessKey','token','channelSecret','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','accountSid','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','isString','@@{','}@@','includes','replace','express','express-winston','./errors','./config/environment','./config/logger','api','auth','./safe-template','safeTemplate','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','body','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','name','role','inspect','device','agent_id','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','/api/fax/applications','/api/fax/interactions'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x9a0b,0xff));var _0xb9a0=function(_0x4c94c7,_0x1124b6){_0x4c94c7=_0x4c94c7-0x0;var _0xbc8bc0=_0x9a0b[_0x4c94c7];return _0xbc8bc0;};'use strict';var _=require('lodash');var path=require('path');var express=require(_0xb9a0('0x0'));var ewinston=require(_0xb9a0('0x1'));var util=require('util');var errors=require(_0xb9a0('0x2'));var config=require(_0xb9a0('0x3'));var logger=require(_0xb9a0('0x4'))(_0xb9a0('0x5'));var authLogger=require(_0xb9a0('0x4'))(_0xb9a0('0x6'));var safeTemplate=require(_0xb9a0('0x7'))[_0xb9a0('0x8')];exports[_0xb9a0('0x9')]=function(_0x2a1136){_0x2a1136[_0xb9a0('0xa')](ewinston[_0xb9a0('0xb')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x1d119d,_0x4bb082){var _0x5c6cb9=_0xb9a0('0xc');if(!_[_0xb9a0('0xd')](_0x1d119d['body'])){_0x5c6cb9+=_0xb9a0('0xe');var _0x5c63c6=_0x1d119d[_0xb9a0('0xf')];maskSensitiveData(_0x5c63c6);}return safeTemplate(util[_0xb9a0('0x10')](_0x5c6cb9,_0x1d119d[_0xb9a0('0x11')],_0x1d119d[_0xb9a0('0x12')][_0xb9a0('0x13')]?_0x1d119d[_0xb9a0('0x12')][_0xb9a0('0x13')]:_0x1d119d[_0xb9a0('0x14')][_0xb9a0('0x15')]||_0x1d119d['ip'],_0x1d119d[_0xb9a0('0x16')],_0x4bb082[_0xb9a0('0x17')],_0x4bb082[_0xb9a0('0x18')],_0x1d119d[_0xb9a0('0x19')]?_0x1d119d[_0xb9a0('0x19')]['id']:null,_0x1d119d[_0xb9a0('0x19')]?_0x1d119d[_0xb9a0('0x19')][_0xb9a0('0x1a')]:null,_0x1d119d['user']?_0x1d119d[_0xb9a0('0x19')][_0xb9a0('0x1b')]:null,_0x5c63c6?util[_0xb9a0('0x1c')](_0x5c63c6,![],null):''));}}));_0x2a1136[_0xb9a0('0xa')](ewinston[_0xb9a0('0xb')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x280365,_0x2accf0){var _0x2d559d='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x280365[_0xb9a0('0xf')]&&_0x280365[_0xb9a0('0xf')][_0xb9a0('0x1d')]&&_0x280365[_0xb9a0('0xf')][_0xb9a0('0x1e')]){_0x2d559d='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xb9a0('0x10')](_0x2d559d,_0x280365[_0xb9a0('0x11')],_0x280365[_0xb9a0('0x12')][_0xb9a0('0x13')]?_0x280365['headers'][_0xb9a0('0x13')]:_0x280365['connection'][_0xb9a0('0x15')]||_0x280365['ip'],_0x280365[_0xb9a0('0x16')],_0x2accf0[_0xb9a0('0x17')],_0x2accf0[_0xb9a0('0x18')],_0x280365['user']?_0x280365[_0xb9a0('0x19')]['id']:null,_0x280365[_0xb9a0('0x19')]?_0x280365['user'][_0xb9a0('0x1a')]:null,_0x280365[_0xb9a0('0x19')]?_0x280365[_0xb9a0('0x19')][_0xb9a0('0x1b')]:null,_0x280365[_0xb9a0('0xf')]&&_0x280365['body'][_0xb9a0('0x1d')]?_0x280365['body'][_0xb9a0('0x1d')]:_0xb9a0('0x1f'),_0x280365[_0xb9a0('0xf')]&&_0x280365['body'][_0xb9a0('0x1e')]?_0x280365['body'][_0xb9a0('0x1e')]:'',_0x280365[_0xb9a0('0xf')]&&_0x280365[_0xb9a0('0xf')][_0xb9a0('0x20')]?_0x280365[_0xb9a0('0xf')][_0xb9a0('0x20')]:'');},'ignoreRoute':function(_0x3451af){var _0x1611e6=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1611e6[_0xb9a0('0x21')](_0x3451af[_0xb9a0('0x16')]);}}));_0x2a1136['use'](_0xb9a0('0x22'),require(_0xb9a0('0x23')));_0x2a1136['use'](_0xb9a0('0x24'),require(_0xb9a0('0x25')));_0x2a1136[_0xb9a0('0xa')]('/api/voice/contexts',require(_0xb9a0('0x26')));_0x2a1136[_0xb9a0('0xa')]('/api/voice/extensions',require(_0xb9a0('0x27')));_0x2a1136[_0xb9a0('0xa')]('/api/voice/mohs',require(_0xb9a0('0x28')));_0x2a1136['use'](_0xb9a0('0x29'),require(_0xb9a0('0x2a')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x2b'),require(_0xb9a0('0x2c')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x2d'),require(_0xb9a0('0x2e')));_0x2a1136[_0xb9a0('0xa')]('/api/voice/mails',require(_0xb9a0('0x2f')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x30'),require(_0xb9a0('0x31')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x32'),require('./api/voiceCallReport'));_0x2a1136[_0xb9a0('0xa')]('/api/voice/dials/reports',require(_0xb9a0('0x33')));_0x2a1136[_0xb9a0('0xa')]('/api/voice/agents/reports',require(_0xb9a0('0x34')));_0x2a1136['use'](_0xb9a0('0x35'),require(_0xb9a0('0x36')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x37'),require('./api/memberReport'));_0x2a1136[_0xb9a0('0xa')]('/api/trunks',require(_0xb9a0('0x38')));_0x2a1136[_0xb9a0('0xa')]('/api/voice/transfers/reports',require(_0xb9a0('0x39')));_0x2a1136['use'](_0xb9a0('0x3a'),require(_0xb9a0('0x3b')));_0x2a1136['use']('/api/mail/accounts',require(_0xb9a0('0x3c')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x3d'),require('./api/mailQueue'));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x3e'),require(_0xb9a0('0x3f')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x40'),require('./api/mailInteraction'));_0x2a1136['use']('/api/mail/messages',require('./api/mailMessage'));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x41'),require(_0xb9a0('0x42')));_0x2a1136['use']('/api/mail/reports/queue',require(_0xb9a0('0x43')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x44'),require(_0xb9a0('0x45')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x46'),require('./api/dashboardItem'));_0x2a1136['use'](_0xb9a0('0x47'),require('./api/faxAccount'));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x48'),require('./api/faxApplication'));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x49'),require(_0xb9a0('0x4a')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x4b'),require('./api/faxMessage'));_0x2a1136['use'](_0xb9a0('0x4c'),require(_0xb9a0('0x4d')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x4e'),require(_0xb9a0('0x4f')));_0x2a1136[_0xb9a0('0xa')]('/api/sms/accounts',require('./api/smsAccount'));_0x2a1136['use']('/api/sms/applications',require('./api/smsApplication'));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x50'),require(_0xb9a0('0x51')));_0x2a1136[_0xb9a0('0xa')]('/api/sms/messages',require('./api/smsMessage'));_0x2a1136['use'](_0xb9a0('0x52'),require('./api/smsQueue'));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x53'),require('./api/openchannelAccount'));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x54'),require(_0xb9a0('0x55')));_0x2a1136[_0xb9a0('0xa')]('/api/openchannel/interactions',require(_0xb9a0('0x56')));_0x2a1136['use'](_0xb9a0('0x57'),require(_0xb9a0('0x58')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x59'),require('./api/openchannelQueue'));_0x2a1136[_0xb9a0('0xa')]('/api/chat/websites',require('./api/chatWebsite'));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x5a'),require('./api/openchannelQueueReport'));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x5b'),require(_0xb9a0('0x5c')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x5d'),require(_0xb9a0('0x5e')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x5f'),require(_0xb9a0('0x60')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x61'),require(_0xb9a0('0x62')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x63'),require(_0xb9a0('0x64')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x65'),require('./api/chatGroup'));_0x2a1136[_0xb9a0('0xa')]('/api/chat/proactive_actions',require('./api/chatProactiveAction'));_0x2a1136[_0xb9a0('0xa')]('/api/cm/companies',require('./api/cmCompany'));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x66'),require(_0xb9a0('0x67')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x68'),require(_0xb9a0('0x69')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x6a'),require('./api/cmHopperBlack'));_0x2a1136['use']('/api/cm/hopper_final',require(_0xb9a0('0x6b')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x6c'),require(_0xb9a0('0x6d')));_0x2a1136['use'](_0xb9a0('0x6e'),require(_0xb9a0('0x6f')));_0x2a1136['use'](_0xb9a0('0x70'),require(_0xb9a0('0x71')));_0x2a1136[_0xb9a0('0xa')]('/api/automations',require(_0xb9a0('0x72')));_0x2a1136['use']('/api/canned_answers',require(_0xb9a0('0x73')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x74'),require(_0xb9a0('0x75')));_0x2a1136['use'](_0xb9a0('0x76'),require(_0xb9a0('0x77')));_0x2a1136['use'](_0xb9a0('0x78'),require(_0xb9a0('0x79')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x7a'),require(_0xb9a0('0x7b')));_0x2a1136[_0xb9a0('0xa')]('/api/cdr',require(_0xb9a0('0x7c')));_0x2a1136[_0xb9a0('0xa')]('/api/voiceQueuesLog',require(_0xb9a0('0x7d')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x7e'),require(_0xb9a0('0x7f')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x80'),require(_0xb9a0('0x81')));_0x2a1136['use'](_0xb9a0('0x82'),require(_0xb9a0('0x83')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x84'),require(_0xb9a0('0x85')));_0x2a1136['use'](_0xb9a0('0x86'),require(_0xb9a0('0x87')));_0x2a1136[_0xb9a0('0xa')]('/api/variables',require('./api/variable'));_0x2a1136[_0xb9a0('0xa')]('/api/integrations',require('./api/integration'));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x88'),require(_0xb9a0('0x89')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x8a'),require(_0xb9a0('0x8b')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x8c'),require(_0xb9a0('0x8d')));_0x2a1136['use'](_0xb9a0('0x8e'),require(_0xb9a0('0x8f')));_0x2a1136[_0xb9a0('0xa')]('/api/analytics/metrics',require(_0xb9a0('0x90')));_0x2a1136['use'](_0xb9a0('0x91'),require(_0xb9a0('0x92')));_0x2a1136['use'](_0xb9a0('0x93'),require(_0xb9a0('0x94')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x95'),require(_0xb9a0('0x96')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x97'),require(_0xb9a0('0x98')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x99'),require('./api/intSalesforceField'));_0x2a1136['use']('/api/integrations/sugarcrm/accounts',require(_0xb9a0('0x9a')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x9b'),require(_0xb9a0('0x9c')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x9d'),require(_0xb9a0('0x9e')));_0x2a1136['use'](_0xb9a0('0x9f'),require('./api/intDeskAccount'));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0xa0'),require(_0xb9a0('0xa1')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0xa2'),require(_0xb9a0('0xa3')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0xa4'),require(_0xb9a0('0xa5')));_0x2a1136['use'](_0xb9a0('0xa6'),require(_0xb9a0('0xa7')));_0x2a1136['use']('/api/integrations/zoho/fields',require(_0xb9a0('0xa8')));_0x2a1136[_0xb9a0('0xa')]('/api/integrations/zendesk/accounts',require('./api/intZendeskAccount'));_0x2a1136[_0xb9a0('0xa')]('/api/integrations/zendesk/configurations',require(_0xb9a0('0xa9')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0xaa'),require(_0xb9a0('0xab')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0xac'),require('./api/intFreshdeskAccount'));_0x2a1136[_0xb9a0('0xa')]('/api/integrations/freshdesk/configurations',require(_0xb9a0('0xad')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0xae'),require(_0xb9a0('0xaf')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0xb0'),require(_0xb9a0('0xb1')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0xb2'),require(_0xb9a0('0xb3')));_0x2a1136['use']('/api/integrations/vtiger/fields',require(_0xb9a0('0xb4')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0xb5'),require(_0xb9a0('0xb6')));_0x2a1136['use'](_0xb9a0('0xb7'),require(_0xb9a0('0xb8')));_0x2a1136['use'](_0xb9a0('0xb9'),require(_0xb9a0('0xba')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0xbb'),require('./api/intDynamics365Account'));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0xbc'),require(_0xb9a0('0xbd')));_0x2a1136[_0xb9a0('0xa')]('/api/integrations/dynamics365/fields',require('./api/intDynamics365Field'));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0xbe'),require(_0xb9a0('0xbf')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0xc0'),require(_0xb9a0('0xc1')));_0x2a1136['use'](_0xb9a0('0xc2'),require(_0xb9a0('0xc3')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0xc4'),require(_0xb9a0('0xc5')));_0x2a1136['use']('/api/chat/reports/queue',require(_0xb9a0('0xc6')));_0x2a1136[_0xb9a0('0xa')]('/api/chat/internal/messages',require(_0xb9a0('0xc7')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0xc8'),require(_0xb9a0('0xc9')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0xca'),require('./api/jscriptyQuestionReport'));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0xcb'),require(_0xb9a0('0xcc')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0xcd'),require('./api/smsQueueReport'));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0xce'),require(_0xb9a0('0xcf')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0xd0'),require(_0xb9a0('0xd1')));_0x2a1136['use'](_0xb9a0('0xd2'),require(_0xb9a0('0xd3')));_0x2a1136[_0xb9a0('0xa')]('/api/settings',require('./api/setting'));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0xd4'),require(_0xb9a0('0xd5')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0xd6'),require(_0xb9a0('0xd7')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0xd8'),require(_0xb9a0('0xd9')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0xda'),require(_0xb9a0('0xdb')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0xdc'),require('./api/team'));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0xdd'),require(_0xb9a0('0xde')));_0x2a1136['use'](_0xb9a0('0xdf'),require(_0xb9a0('0xe0')));_0x2a1136['use'](_0xb9a0('0xe1'),require('./api/migration'));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0xe2'),require('./api/attachment'));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0xe3'),require(_0xb9a0('0xe4')));_0x2a1136['use'](_0xb9a0('0xe5'),require(_0xb9a0('0xe6')));_0x2a1136['use'](_0xb9a0('0xe7'),require(_0xb9a0('0xe8')));_0x2a1136['use'](_0xb9a0('0xe9'),require('./api/faxTransferReport'));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0xea'),require('./api/openchannelTransferReport'));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0xeb'),require(_0xb9a0('0xec')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0xed'),require(_0xb9a0('0xee')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0xef'),require(_0xb9a0('0xf0')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0xf1'),require(_0xb9a0('0xf2')));_0x2a1136[_0xb9a0('0xa')]('/api/userProfile/sections',require(_0xb9a0('0xf3')));_0x2a1136['use'](_0xb9a0('0xf4'),require(_0xb9a0('0xf5')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0xf6'),require(_0xb9a0('0xf7')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0xf8'),require('./api/whatsappAccount'));_0x2a1136['use']('/api/whatsapp/applications',require(_0xb9a0('0xf9')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0xfa'),require(_0xb9a0('0xfb')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0xfc'),require(_0xb9a0('0xfd')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0xfe'),require(_0xb9a0('0xff')));_0x2a1136['use']('/api/whatsapp/reports/transfer',require(_0xb9a0('0x100')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x101'),require(_0xb9a0('0x102')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x103'),require(_0xb9a0('0x104')));_0x2a1136[_0xb9a0('0xa')]('/api/realtime',require(_0xb9a0('0x105')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x106'),require('./api/authLocal'));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x107'),require('./api/authGoogle'));_0x2a1136[_0xb9a0('0xa')]('/api/jira',require(_0xb9a0('0x108')));_0x2a1136[_0xb9a0('0xa')]('/api/rpc',require(_0xb9a0('0x109')));_0x2a1136[_0xb9a0('0xa')]('/api/version',require(_0xb9a0('0x10a')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x10b'),require(_0xb9a0('0x10c')));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x10d'),require('./api/pm2'));_0x2a1136['use'](_0xb9a0('0x10e'),require(_0xb9a0('0x10f')));_0x2a1136[_0xb9a0('0xa')]('/apidoc',express[_0xb9a0('0x110')](path[_0xb9a0('0x111')](config[_0xb9a0('0x112')],_0xb9a0('0x113'))));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x114'),express[_0xb9a0('0x110')](path[_0xb9a0('0x111')](config[_0xb9a0('0x112')],_0xb9a0('0x114'))));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x115'),express[_0xb9a0('0x110')](path[_0xb9a0('0x111')](config[_0xb9a0('0x112')],_0xb9a0('0x115'))));_0x2a1136[_0xb9a0('0xa')](_0xb9a0('0x116'),express[_0xb9a0('0x110')](path['join'](config[_0xb9a0('0x112')],'snippet',_0xb9a0('0x117'))));_0x2a1136[_0xb9a0('0xa')]('/plugins',express[_0xb9a0('0x110')](path[_0xb9a0('0x111')](config[_0xb9a0('0x112')],_0xb9a0('0x118'))));_0x2a1136['route']('/:url(api|auth|components|app|bower_components|assets)/*')['get'](errors[0x194]);_0x2a1136[_0xb9a0('0x119')]('/*')[_0xb9a0('0x11a')](function(_0x10ea52,_0x54d908){_0x54d908[_0xb9a0('0x11b')](path['resolve'](_0x2a1136[_0xb9a0('0x11a')](_0xb9a0('0x11c'))+_0xb9a0('0x11d')));});};var sensitiveFields=[_0xb9a0('0x11e'),_0xb9a0('0x11f'),_0xb9a0('0x120'),_0xb9a0('0x121'),_0xb9a0('0x122'),_0xb9a0('0x123'),_0xb9a0('0x124'),_0xb9a0('0x125'),_0xb9a0('0x126'),_0xb9a0('0x127'),_0xb9a0('0x128'),'clientId',_0xb9a0('0x129'),_0xb9a0('0x12a'),_0xb9a0('0x12b'),_0xb9a0('0x12c'),'tenantId',_0xb9a0('0x12d'),_0xb9a0('0x12e'),'accessToken',_0xb9a0('0x12f'),_0xb9a0('0x130'),_0xb9a0('0x131'),_0xb9a0('0x132'),_0xb9a0('0x133'),_0xb9a0('0x134'),'calleridnum',_0xb9a0('0x135'),_0xb9a0('0x136'),_0xb9a0('0x137'),_0xb9a0('0x138'),_0xb9a0('0x139'),_0xb9a0('0x13a'),_0xb9a0('0x13b'),_0xb9a0('0x19'),'pass',_0xb9a0('0x13c'),_0xb9a0('0x13d'),_0xb9a0('0x13e'),_0xb9a0('0x13f'),_0xb9a0('0x140'),_0xb9a0('0x141')];function maskSensitiveData(_0x25c35b){var _0x41995a=/(?!^)[\s\S](?!$)/g;if(!_[_0xb9a0('0x142')](_0x25c35b))return;for(var _0x1d26f0 in _0x25c35b){if(_[_0xb9a0('0x143')](_0x25c35b[_0x1d26f0])){for(var _0x4face8=0x0;_0x4face8<_0x25c35b[_0x1d26f0]['length'];_0x4face8++){maskSensitiveData(_0x25c35b[_0x1d26f0][_0x4face8]);}}else if(_[_0xb9a0('0x142')](_0x25c35b[_0x1d26f0])){maskSensitiveData(_0x25c35b[_0x1d26f0]);}else if(_[_0xb9a0('0x144')](_0x25c35b[_0x1d26f0])){_0x25c35b[_0x1d26f0]=_0x25c35b[_0x1d26f0]['replace'](/{{{/g,_0xb9a0('0x145'))['replace'](/}}}/g,_0xb9a0('0x146'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0xb9a0('0x147')](sensitiveFields,_0x1d26f0)){_0x25c35b[_0x1d26f0]=_0x25c35b[_0x1d26f0][_0xb9a0('0x148')](_0x41995a,'*');}}}} \ No newline at end of file +var _0x9d95=['/api/jscripty/questions/reports','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','./api/setting','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','/api/square/messages','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/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/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/userProfiles','./api/userProfileSection','/api/userProfile/resources','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','/api/pm2','./api/pm2','./api/webbar','join','/www','static','root','/demo','snippet','3.0.0','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','password','newPassword','apiKey','lastName','street','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessToken','accessTokenSecret','authToken','consumerSecret','membername','calleridname','calleridnum','exten','privateKey','secretaccesskey','accountSid','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','}@@','replace','includes','lodash','path','express','util','./errors','./config/environment','./config/logger','api','auth','./safe-template','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','name','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','role','agent_name','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/queues','./api/voiceQueue','/api/screen/recordings','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/sound','/api/tags','./api/tag','/api/triggers','/api/variables','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/chat/reports/queue','./api/chatInternalMessage'];(function(_0x5cde61,_0x5aab83){var _0x626d0=function(_0x500bac){while(--_0x500bac){_0x5cde61['push'](_0x5cde61['shift']());}};_0x626d0(++_0x5aab83);}(_0x9d95,0x1b1));var _0x59d9=function(_0x4dde85,_0x3240a0){_0x4dde85=_0x4dde85-0x0;var _0x4cf081=_0x9d95[_0x4dde85];return _0x4cf081;};'use strict';var _=require(_0x59d9('0x0'));var path=require(_0x59d9('0x1'));var express=require(_0x59d9('0x2'));var ewinston=require('express-winston');var util=require(_0x59d9('0x3'));var errors=require(_0x59d9('0x4'));var config=require(_0x59d9('0x5'));var logger=require(_0x59d9('0x6'))(_0x59d9('0x7'));var authLogger=require('./config/logger')(_0x59d9('0x8'));var safeTemplate=require(_0x59d9('0x9'))['safeTemplate'];exports[_0x59d9('0xa')]=function(_0x4295ac){_0x4295ac[_0x59d9('0xb')](ewinston[_0x59d9('0xc')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x2e2cf6,_0x2c4347){var _0x443633=_0x59d9('0xd');if(!_[_0x59d9('0xe')](_0x2e2cf6[_0x59d9('0xf')])){_0x443633+=_0x59d9('0x10');var _0x7c5f59=_0x2e2cf6[_0x59d9('0xf')];maskSensitiveData(_0x7c5f59);}return safeTemplate(util[_0x59d9('0x11')](_0x443633,_0x2e2cf6[_0x59d9('0x12')],_0x2e2cf6[_0x59d9('0x13')][_0x59d9('0x14')]?_0x2e2cf6[_0x59d9('0x13')][_0x59d9('0x14')]:_0x2e2cf6[_0x59d9('0x15')][_0x59d9('0x16')]||_0x2e2cf6['ip'],_0x2e2cf6[_0x59d9('0x17')],_0x2c4347[_0x59d9('0x18')],_0x2c4347[_0x59d9('0x19')],_0x2e2cf6[_0x59d9('0x1a')]?_0x2e2cf6[_0x59d9('0x1a')]['id']:null,_0x2e2cf6[_0x59d9('0x1a')]?_0x2e2cf6[_0x59d9('0x1a')][_0x59d9('0x1b')]:null,_0x2e2cf6[_0x59d9('0x1a')]?_0x2e2cf6[_0x59d9('0x1a')]['role']:null,_0x7c5f59?util[_0x59d9('0x1c')](_0x7c5f59,![],null):''));}}));_0x4295ac[_0x59d9('0xb')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x5b39e3,_0x56ed12){var _0x82751=_0x59d9('0x1d');if(_0x5b39e3[_0x59d9('0xf')]&&_0x5b39e3[_0x59d9('0xf')][_0x59d9('0x1e')]&&_0x5b39e3[_0x59d9('0xf')][_0x59d9('0x1f')]){_0x82751=_0x59d9('0x20');}return util[_0x59d9('0x11')](_0x82751,_0x5b39e3[_0x59d9('0x12')],_0x5b39e3[_0x59d9('0x13')][_0x59d9('0x14')]?_0x5b39e3['headers']['x-forwarded-for']:_0x5b39e3['connection'][_0x59d9('0x16')]||_0x5b39e3['ip'],_0x5b39e3[_0x59d9('0x17')],_0x56ed12['statusCode'],_0x56ed12[_0x59d9('0x19')],_0x5b39e3['user']?_0x5b39e3[_0x59d9('0x1a')]['id']:null,_0x5b39e3[_0x59d9('0x1a')]?_0x5b39e3[_0x59d9('0x1a')][_0x59d9('0x1b')]:null,_0x5b39e3[_0x59d9('0x1a')]?_0x5b39e3[_0x59d9('0x1a')][_0x59d9('0x21')]:null,_0x5b39e3[_0x59d9('0xf')]&&_0x5b39e3[_0x59d9('0xf')]['device']?_0x5b39e3[_0x59d9('0xf')][_0x59d9('0x1e')]:'other',_0x5b39e3[_0x59d9('0xf')]&&_0x5b39e3[_0x59d9('0xf')][_0x59d9('0x1f')]?_0x5b39e3[_0x59d9('0xf')][_0x59d9('0x1f')]:'',_0x5b39e3[_0x59d9('0xf')]&&_0x5b39e3['body'][_0x59d9('0x22')]?_0x5b39e3['body'][_0x59d9('0x22')]:'');},'ignoreRoute':function(_0x6b6fdd){var _0x88ccac=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x88ccac['test'](_0x6b6fdd[_0x59d9('0x17')]);}}));_0x4295ac[_0x59d9('0xb')]('/api/users',require(_0x59d9('0x23')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x24'),require(_0x59d9('0x25')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x26'),require('./api/voiceContext'));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x27'),require(_0x59d9('0x28')));_0x4295ac[_0x59d9('0xb')]('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x29'),require(_0x59d9('0x2a')));_0x4295ac[_0x59d9('0xb')]('/api/voice/recordings',require('./api/voiceRecording'));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x2b'),require('./api/screenRecording'));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x2c'),require(_0x59d9('0x2d')));_0x4295ac['use'](_0x59d9('0x2e'),require(_0x59d9('0x2f')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x30'),require(_0x59d9('0x31')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x32'),require(_0x59d9('0x33')));_0x4295ac['use']('/api/voice/agents/reports',require(_0x59d9('0x34')));_0x4295ac['use']('/api/voice/queues/reports',require(_0x59d9('0x35')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x36'),require('./api/memberReport'));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x37'),require('./api/trunk'));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x38'),require(_0x59d9('0x39')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x3a'),require(_0x59d9('0x3b')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x3c'),require('./api/mailAccount'));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x3d'),require(_0x59d9('0x3e')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x3f'),require(_0x59d9('0x40')));_0x4295ac['use']('/api/mail/interactions',require(_0x59d9('0x41')));_0x4295ac[_0x59d9('0xb')]('/api/mail/messages',require(_0x59d9('0x42')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x43'),require(_0x59d9('0x44')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x45'),require(_0x59d9('0x46')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x47'),require(_0x59d9('0x48')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x49'),require(_0x59d9('0x4a')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x4b'),require(_0x59d9('0x4c')));_0x4295ac[_0x59d9('0xb')]('/api/fax/applications',require('./api/faxApplication'));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x4d'),require(_0x59d9('0x4e')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x4f'),require(_0x59d9('0x50')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x51'),require('./api/faxQueue'));_0x4295ac['use']('/api/fax/reports/queue',require(_0x59d9('0x52')));_0x4295ac['use'](_0x59d9('0x53'),require(_0x59d9('0x54')));_0x4295ac['use'](_0x59d9('0x55'),require(_0x59d9('0x56')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x57'),require(_0x59d9('0x58')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x59'),require(_0x59d9('0x5a')));_0x4295ac[_0x59d9('0xb')]('/api/sms/queues',require(_0x59d9('0x5b')));_0x4295ac['use']('/api/openchannel/accounts',require(_0x59d9('0x5c')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x5d'),require(_0x59d9('0x5e')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x5f'),require(_0x59d9('0x60')));_0x4295ac['use'](_0x59d9('0x61'),require(_0x59d9('0x62')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x63'),require('./api/openchannelQueue'));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x64'),require(_0x59d9('0x65')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x66'),require(_0x59d9('0x67')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x68'),require(_0x59d9('0x69')));_0x4295ac['use'](_0x59d9('0x6a'),require(_0x59d9('0x6b')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x6c'),require(_0x59d9('0x6d')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x6e'),require(_0x59d9('0x6f')));_0x4295ac['use']('/api/chat/queues',require('./api/chatQueue'));_0x4295ac['use'](_0x59d9('0x70'),require(_0x59d9('0x71')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x72'),require(_0x59d9('0x73')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x74'),require(_0x59d9('0x75')));_0x4295ac['use']('/api/cm/contacts',require(_0x59d9('0x76')));_0x4295ac[_0x59d9('0xb')]('/api/cm/hopper',require(_0x59d9('0x77')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x78'),require(_0x59d9('0x79')));_0x4295ac[_0x59d9('0xb')]('/api/cm/hopper_final',require('./api/cmHopperFinal'));_0x4295ac['use'](_0x59d9('0x7a'),require(_0x59d9('0x7b')));_0x4295ac[_0x59d9('0xb')]('/api/cm/custom_fields',require(_0x59d9('0x7c')));_0x4295ac['use']('/api/actions',require('./api/action'));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x7d'),require(_0x59d9('0x7e')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x7f'),require(_0x59d9('0x80')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x81'),require('./api/disposition'));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x82'),require(_0x59d9('0x83')));_0x4295ac['use'](_0x59d9('0x84'),require(_0x59d9('0x85')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x86'),require(_0x59d9('0x87')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x88'),require(_0x59d9('0x89')));_0x4295ac['use'](_0x59d9('0x8a'),require(_0x59d9('0x8b')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x8c'),require('./api/schedule'));_0x4295ac['use']('/api/sounds',require(_0x59d9('0x8d')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x8e'),require(_0x59d9('0x8f')));_0x4295ac[_0x59d9('0xb')]('/api/templates',require('./api/template'));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x90'),require('./api/trigger'));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x91'),require('./api/variable'));_0x4295ac[_0x59d9('0xb')]('/api/integrations',require(_0x59d9('0x92')));_0x4295ac['use']('/api/integrations/reports',require(_0x59d9('0x93')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x94'),require(_0x59d9('0x95')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x96'),require(_0x59d9('0x97')));_0x4295ac['use'](_0x59d9('0x98'),require(_0x59d9('0x99')));_0x4295ac['use']('/api/analytics/metrics',require(_0x59d9('0x9a')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x9b'),require('./api/analyticFieldReport'));_0x4295ac['use']('/api/analytics/tree_reports',require(_0x59d9('0x9c')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x9d'),require(_0x59d9('0x9e')));_0x4295ac['use'](_0x59d9('0x9f'),require(_0x59d9('0xa0')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0xa1'),require(_0x59d9('0xa2')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0xa3'),require('./api/intSugarcrmAccount'));_0x4295ac[_0x59d9('0xb')](_0x59d9('0xa4'),require(_0x59d9('0xa5')));_0x4295ac[_0x59d9('0xb')]('/api/integrations/sugarcrm/fields',require(_0x59d9('0xa6')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0xa7'),require(_0x59d9('0xa8')));_0x4295ac[_0x59d9('0xb')]('/api/integrations/desk/configurations',require(_0x59d9('0xa9')));_0x4295ac[_0x59d9('0xb')]('/api/integrations/desk/fields',require('./api/intDeskField'));_0x4295ac[_0x59d9('0xb')](_0x59d9('0xaa'),require(_0x59d9('0xab')));_0x4295ac[_0x59d9('0xb')]('/api/integrations/zoho/configurations',require(_0x59d9('0xac')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0xad'),require(_0x59d9('0xae')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0xaf'),require(_0x59d9('0xb0')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0xb1'),require('./api/intZendeskConfiguration'));_0x4295ac['use'](_0x59d9('0xb2'),require(_0x59d9('0xb3')));_0x4295ac['use']('/api/integrations/freshdesk/accounts',require(_0x59d9('0xb4')));_0x4295ac[_0x59d9('0xb')]('/api/integrations/freshdesk/configurations',require(_0x59d9('0xb5')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0xb6'),require('./api/intFreshdeskField'));_0x4295ac[_0x59d9('0xb')](_0x59d9('0xb7'),require('./api/intVtigerAccount'));_0x4295ac[_0x59d9('0xb')]('/api/integrations/vtiger/configurations',require(_0x59d9('0xb8')));_0x4295ac['use']('/api/integrations/vtiger/fields',require(_0x59d9('0xb9')));_0x4295ac['use'](_0x59d9('0xba'),require(_0x59d9('0xbb')));_0x4295ac['use']('/api/integrations/servicenow/configurations',require('./api/intServicenowConfiguration'));_0x4295ac[_0x59d9('0xb')](_0x59d9('0xbc'),require(_0x59d9('0xbd')));_0x4295ac[_0x59d9('0xb')]('/api/integrations/dynamics365/accounts',require(_0x59d9('0xbe')));_0x4295ac[_0x59d9('0xb')]('/api/integrations/dynamics365/configurations',require(_0x59d9('0xbf')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0xc0'),require('./api/intDynamics365Field'));_0x4295ac[_0x59d9('0xb')](_0x59d9('0xc1'),require(_0x59d9('0xc2')));_0x4295ac[_0x59d9('0xb')]('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0x4295ac[_0x59d9('0xb')]('/api/integrations/freshsales/fields',require('./api/intFreshsalesField'));_0x4295ac[_0x59d9('0xb')]('/api/networks',require('./api/network'));_0x4295ac[_0x59d9('0xb')](_0x59d9('0xc3'),require('./api/chatQueueReport'));_0x4295ac['use']('/api/chat/internal/messages',require(_0x59d9('0xc4')));_0x4295ac['use']('/api/jscripty/answers/reports',require('./api/jscriptyAnswerReport'));_0x4295ac[_0x59d9('0xb')](_0x59d9('0xc5'),require('./api/jscriptyQuestionReport'));_0x4295ac[_0x59d9('0xb')](_0x59d9('0xc6'),require(_0x59d9('0xc7')));_0x4295ac['use'](_0x59d9('0xc8'),require(_0x59d9('0xc9')));_0x4295ac[_0x59d9('0xb')]('/api/square/reports',require(_0x59d9('0xca')));_0x4295ac[_0x59d9('0xb')]('/api/square/details/reports',require(_0x59d9('0xcb')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0xcc'),require(_0x59d9('0xcd')));_0x4295ac[_0x59d9('0xb')]('/api/settings',require(_0x59d9('0xce')));_0x4295ac[_0x59d9('0xb')]('/api/square/odbc',require(_0x59d9('0xcf')));_0x4295ac['use'](_0x59d9('0xd0'),require(_0x59d9('0xd1')));_0x4295ac['use'](_0x59d9('0xd2'),require('./api/squareRecording'));_0x4295ac[_0x59d9('0xb')](_0x59d9('0xd3'),require('./api/squareMessage'));_0x4295ac[_0x59d9('0xb')]('/api/teams',require(_0x59d9('0xd4')));_0x4295ac['use'](_0x59d9('0xd5'),require(_0x59d9('0xd6')));_0x4295ac['use'](_0x59d9('0xd7'),require(_0x59d9('0xd8')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0xd9'),require('./api/migration'));_0x4295ac[_0x59d9('0xb')]('/api/attachments',require(_0x59d9('0xda')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0xdb'),require(_0x59d9('0xdc')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0xdd'),require(_0x59d9('0xde')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0xdf'),require(_0x59d9('0xe0')));_0x4295ac['use'](_0x59d9('0xe1'),require('./api/faxTransferReport'));_0x4295ac[_0x59d9('0xb')](_0x59d9('0xe2'),require(_0x59d9('0xe3')));_0x4295ac['use']('/api/sms/reports/transfer',require(_0x59d9('0xe4')));_0x4295ac['use'](_0x59d9('0xe5'),require(_0x59d9('0xe6')));_0x4295ac[_0x59d9('0xb')]('/api/voice/prefixes',require('./api/voicePrefix'));_0x4295ac[_0x59d9('0xb')](_0x59d9('0xe7'),require('./api/userProfile'));_0x4295ac[_0x59d9('0xb')]('/api/userProfile/sections',require(_0x59d9('0xe8')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0xe9'),require('./api/userProfileResource'));_0x4295ac[_0x59d9('0xb')](_0x59d9('0xea'),require(_0x59d9('0xeb')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0xec'),require(_0x59d9('0xed')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0xee'),require(_0x59d9('0xef')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0xf0'),require(_0x59d9('0xf1')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0xf2'),require('./api/whatsappMessage'));_0x4295ac['use'](_0x59d9('0xf3'),require(_0x59d9('0xf4')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0xf5'),require('./api/whatsappTransferReport'));_0x4295ac[_0x59d9('0xb')](_0x59d9('0xf6'),require(_0x59d9('0xf7')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0xf8'),require(_0x59d9('0xf9')));_0x4295ac['use'](_0x59d9('0xfa'),require('./api/realtime'));_0x4295ac[_0x59d9('0xb')]('/api/auth/local',require('./api/authLocal'));_0x4295ac[_0x59d9('0xb')](_0x59d9('0xfb'),require(_0x59d9('0xfc')));_0x4295ac['use'](_0x59d9('0xfd'),require(_0x59d9('0xfe')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0xff'),require(_0x59d9('0x100')));_0x4295ac['use'](_0x59d9('0x101'),require(_0x59d9('0x102')));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x103'),require('./api/system'));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x104'),require(_0x59d9('0x105')));_0x4295ac[_0x59d9('0xb')]('/api/webbar',require(_0x59d9('0x106')));_0x4295ac['use']('/apidoc',express['static'](path[_0x59d9('0x107')](config['root'],'/apidoc')));_0x4295ac['use'](_0x59d9('0x108'),express[_0x59d9('0x109')](path['join'](config[_0x59d9('0x10a')],_0x59d9('0x108'))));_0x4295ac[_0x59d9('0xb')](_0x59d9('0x10b'),express[_0x59d9('0x109')](path['join'](config['root'],_0x59d9('0x10b'))));_0x4295ac[_0x59d9('0xb')]('/snippet',express['static'](path[_0x59d9('0x107')](config[_0x59d9('0x10a')],_0x59d9('0x10c'),_0x59d9('0x10d'))));_0x4295ac['use']('/plugins',express['static'](path[_0x59d9('0x107')](config[_0x59d9('0x10a')],_0x59d9('0x10e'))));_0x4295ac[_0x59d9('0x10f')](_0x59d9('0x110'))['get'](errors[0x194]);_0x4295ac['route']('/*')[_0x59d9('0x111')](function(_0x35788b,_0x5bf8fd){_0x5bf8fd[_0x59d9('0x112')](path[_0x59d9('0x113')](_0x4295ac[_0x59d9('0x111')](_0x59d9('0x114'))+_0x59d9('0x115')));});};var sensitiveFields=['username',_0x59d9('0x116'),_0x59d9('0x117'),_0x59d9('0x118'),'firstName',_0x59d9('0x119'),_0x59d9('0x11a'),'phone','mobile',_0x59d9('0x11b'),_0x59d9('0x11c'),_0x59d9('0x11d'),_0x59d9('0x11e'),_0x59d9('0x11f'),_0x59d9('0x120'),_0x59d9('0x121'),_0x59d9('0x122'),'token',_0x59d9('0x123'),_0x59d9('0x124'),_0x59d9('0x125'),_0x59d9('0x126'),'consumerKey',_0x59d9('0x127'),_0x59d9('0x128'),_0x59d9('0x129'),_0x59d9('0x12a'),_0x59d9('0x12b'),'vidaooApiKey','clientEmail',_0x59d9('0x12c'),'accesskeyid',_0x59d9('0x12d'),'key','user','pass',_0x59d9('0x12e'),_0x59d9('0x12f'),_0x59d9('0x130'),_0x59d9('0x131'),_0x59d9('0x132'),_0x59d9('0x133')];function maskSensitiveData(_0x413f07){var _0x50336c=/(?!^)[\s\S](?!$)/g;if(!_[_0x59d9('0x134')](_0x413f07))return;for(var _0x3a5fa0 in _0x413f07){if(_[_0x59d9('0x135')](_0x413f07[_0x3a5fa0])){for(var _0x8736b7=0x0;_0x8736b7<_0x413f07[_0x3a5fa0][_0x59d9('0x136')];_0x8736b7++){maskSensitiveData(_0x413f07[_0x3a5fa0][_0x8736b7]);}}else if(_[_0x59d9('0x134')](_0x413f07[_0x3a5fa0])){maskSensitiveData(_0x413f07[_0x3a5fa0]);}else if(_[_0x59d9('0x137')](_0x413f07[_0x3a5fa0])){_0x413f07[_0x3a5fa0]=_0x413f07[_0x3a5fa0]['replace'](/{{{/g,'@@{')['replace'](/}}}/g,_0x59d9('0x138'))[_0x59d9('0x139')](/{{/g,'@{')[_0x59d9('0x139')](/}}/g,'}@');if(_[_0x59d9('0x13a')](sensitiveFields,_0x3a5fa0)){_0x413f07[_0x3a5fa0]=_0x413f07[_0x3a5fa0][_0x59d9('0x139')](_0x50336c,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 4558096..5fe9fe2 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe48d=['../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.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/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.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/mailQueue/mailQueue.rpc'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xe48d,0x19a));var _0xde48=function(_0x34da0f,_0x1b8c60){_0x34da0f=_0x34da0f-0x0;var _0x203145=_0xe48d[_0x34da0f];return _0x203145;};'use strict';var jayson=require(_0xde48('0x0'));var BPromise=require(_0xde48('0x1'));var _=require(_0xde48('0x2'));var config=require('../config/environment');exports[_0xde48('0x3')]=function(){return new BPromise(function(_0x4d5bfe,_0x3bf3cb){var _0x1b5b7f={};_0x1b5b7f=_['merge'](_0x1b5b7f,require('../api/user/user.rpc'));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x5')));_0x1b5b7f=_['merge'](_0x1b5b7f,require(_0xde48('0x6')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x7')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x8')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x1b5b7f=_['merge'](_0x1b5b7f,require(_0xde48('0x9')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0xa')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0xb')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0xc')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0xd')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0xe')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require('../api/mailAccount/mailAccount.rpc'));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0xf')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x10')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x11')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require('../api/mailApplication/mailApplication.rpc'));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x12')));_0x1b5b7f=_['merge'](_0x1b5b7f,require(_0xde48('0x13')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x14')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require('../api/faxInteraction/faxInteraction.rpc'));_0x1b5b7f=_['merge'](_0x1b5b7f,require(_0xde48('0x15')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x16')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x17')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x18')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x19')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x1a')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x1b')));_0x1b5b7f=_['merge'](_0x1b5b7f,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x1b5b7f=_['merge'](_0x1b5b7f,require(_0xde48('0x1c')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x1d')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x1e')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x1f')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x20')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x21')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x22')));_0x1b5b7f=_['merge'](_0x1b5b7f,require(_0xde48('0x23')));_0x1b5b7f=_['merge'](_0x1b5b7f,require('../api/cmHopper/cmHopper.rpc'));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x24')));_0x1b5b7f=_['merge'](_0x1b5b7f,require(_0xde48('0x25')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x26')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x27')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x28')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x29')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x2a')));_0x1b5b7f=_['merge'](_0x1b5b7f,require(_0xde48('0x2b')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x2c')));_0x1b5b7f=_['merge'](_0x1b5b7f,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x2d')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x2e')));_0x1b5b7f=_['merge'](_0x1b5b7f,require(_0xde48('0x2f')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x30')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x31')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x32')));_0x1b5b7f=_['merge'](_0x1b5b7f,require(_0xde48('0x33')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x34')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x35')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x36')));_0x1b5b7f=_['merge'](_0x1b5b7f,require(_0xde48('0x37')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x38')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require('../api/setting/setting.rpc'));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x39')));_0x1b5b7f=_['merge'](_0x1b5b7f,require(_0xde48('0x3a')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x3b')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require('../api/squareMessage/squareMessage.rpc'));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x3c')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require('../api/attachment/attachment.rpc'));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x3d')));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require(_0xde48('0x3e')));_0x1b5b7f=_['merge'](_0x1b5b7f,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x1b5b7f=_[_0xde48('0x4')](_0x1b5b7f,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x1b5b7f=_['merge'](_0x1b5b7f,require(_0xde48('0x3f')));var _0x528978=jayson['server'](_0x1b5b7f)[_0xde48('0x40')]();var _0x3383c5=config[_0xde48('0x41')][_0xde48('0x42')]||config[_0xde48('0x42')]+0x1;var _0x5a5b9c=config[_0xde48('0x41')]['ip']||'localhost';_0x528978['on']('error',function(_0x1c59f2){return _0x3bf3cb(_0x1c59f2);});_0x528978[_0xde48('0x3')](_0x3383c5,_0x5a5b9c,function(){console['log'](_0xde48('0x43'),_0x5a5b9c,_0x3383c5);require(_0xde48('0x44'))[_0xde48('0x45')]();return _0x4d5bfe(_0xde48('0x46')+_0x5a5b9c+':'+_0x3383c5);});});}; \ No newline at end of file +var _0xcb4f=['../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/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','port','rpc','localhost','error','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc'];(function(_0x4fc781,_0x9385e8){var _0xc0f802=function(_0xb6c717){while(--_0xb6c717){_0x4fc781['push'](_0x4fc781['shift']());}};_0xc0f802(++_0x9385e8);}(_0xcb4f,0x124));var _0xfcb4=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xcb4f[_0x33032e];return _0x13316b;};'use strict';var jayson=require(_0xfcb4('0x0'));var BPromise=require(_0xfcb4('0x1'));var _=require(_0xfcb4('0x2'));var config=require(_0xfcb4('0x3'));exports[_0xfcb4('0x4')]=function(){return new BPromise(function(_0x524990,_0x6cbf72){var _0x3c8842={};_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require('../api/user/user.rpc'));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x6')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x7')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require('../api/voiceRecording/voiceRecording.rpc'));_0x3c8842=_['merge'](_0x3c8842,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x8')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x9')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0xa')));_0x3c8842=_['merge'](_0x3c8842,require(_0xfcb4('0xb')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require('../api/trunk/trunk.rpc'));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0xc')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0xd')));_0x3c8842=_['merge'](_0x3c8842,require('../api/mailServerIn/mailServerIn.rpc'));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0xe')));_0x3c8842=_['merge'](_0x3c8842,require(_0xfcb4('0xf')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x10')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x11')));_0x3c8842=_['merge'](_0x3c8842,require(_0xfcb4('0x12')));_0x3c8842=_['merge'](_0x3c8842,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x13')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x14')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require('../api/faxInteraction/faxInteraction.rpc'));_0x3c8842=_['merge'](_0x3c8842,require('../api/faxMessage/faxMessage.rpc'));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x15')));_0x3c8842=_['merge'](_0x3c8842,require(_0xfcb4('0x16')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x17')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x18')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x19')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x1a')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x1b')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x3c8842=_['merge'](_0x3c8842,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x3c8842=_['merge'](_0x3c8842,require(_0xfcb4('0x1c')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x1d')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x1e')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x1f')));_0x3c8842=_['merge'](_0x3c8842,require(_0xfcb4('0x20')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x21')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require('../api/cmHopper/cmHopper.rpc'));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x22')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x23')));_0x3c8842=_['merge'](_0x3c8842,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x24')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x25')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x26')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x27')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require('../api/template/template.rpc'));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require('../api/trigger/trigger.rpc'));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x28')));_0x3c8842=_['merge'](_0x3c8842,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x29')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x2a')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x2b')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x2c')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x2d')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x2e')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x2f')));_0x3c8842=_['merge'](_0x3c8842,require(_0xfcb4('0x30')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x31')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x32')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x33')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x34')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x35')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x36')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x37')));_0x3c8842=_['merge'](_0x3c8842,require(_0xfcb4('0x38')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x39')));_0x3c8842=_['merge'](_0x3c8842,require('../api/squareMessage/squareMessage.rpc'));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require('../api/campaign/campaign.rpc'));_0x3c8842=_['merge'](_0x3c8842,require(_0xfcb4('0x3a')));_0x3c8842=_['merge'](_0x3c8842,require(_0xfcb4('0x3b')));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x3c8842=_['merge'](_0x3c8842,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x3c8842=_['merge'](_0x3c8842,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x3c8842=_[_0xfcb4('0x5')](_0x3c8842,require(_0xfcb4('0x3c')));var _0xbbd650=jayson[_0xfcb4('0x3d')](_0x3c8842)['http']();var _0xc62908=config['rpc'][_0xfcb4('0x3e')]||config[_0xfcb4('0x3e')]+0x1;var _0x4939bd=config[_0xfcb4('0x3f')]['ip']||_0xfcb4('0x40');_0xbbd650['on'](_0xfcb4('0x41'),function(_0x4e2e35){return _0x6cbf72(_0x4e2e35);});_0xbbd650[_0xfcb4('0x4')](_0xc62908,_0x4939bd,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x4939bd,_0xc62908);require(_0xfcb4('0x42'))['default']();return _0x524990(_0xfcb4('0x43')+_0x4939bd+':'+_0xc62908);});});}; \ No newline at end of file diff --git a/server/safe-template.js b/server/safe-template.js index 4d8fb0e..2426643 100644 --- a/server/safe-template.js +++ b/server/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4cf8=['safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','isArray','map','isPlainObject','exports'];(function(_0x2ab27b,_0x4089b1){var _0x8d427f=function(_0x259157){while(--_0x259157){_0x2ab27b['push'](_0x2ab27b['shift']());}};_0x8d427f(++_0x4089b1);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x45d5ef,_0x10c29b){_0x45d5ef=_0x45d5ef-0x0;var _0x474d19=_0x4cf8[_0x45d5ef];return _0x474d19;};var _=require(_0x84cf('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2d03b6){return _0x2d03b6==='{{'?_0x84cf('0x1'):_0x84cf('0x2');}function safeTemplate(_0xae953){var _0x28455b=_0xae953;if(typeof _0xae953===_0x84cf('0x3')){_0x28455b=_0xae953[_0x84cf('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x84cf('0x5')](_0xae953)){_0x28455b=_0xae953[_0x84cf('0x6')](function(_0x5844d7){return safeTemplate(_0x5844d7);});}else if(_[_0x84cf('0x7')](_0xae953)){_0x28455b=Object['keys'](_0xae953)['reduce'](function(_0x455345,_0x56c5cc){_0x455345[_0x56c5cc]=safeTemplate(_0xae953[_0x56c5cc]);return _0x455345;},{});}return _0x28455b;}module[_0x84cf('0x8')][_0x84cf('0x9')]=safeTemplate; \ No newline at end of file +var _0x087b=['exports','safeTemplate','lodash','string','replace','isArray','map','isPlainObject','keys','reduce'];(function(_0x1f00d5,_0x293410){var _0x4011ad=function(_0x501fa3){while(--_0x501fa3){_0x1f00d5['push'](_0x1f00d5['shift']());}};_0x4011ad(++_0x293410);}(_0x087b,0x11a));var _0xb087=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x087b[_0x5f0089];return _0x193892;};var _=require(_0xb087('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x35e3d3){return _0x35e3d3==='{{'?'{\x20{\x20':'\x20}\x20}';}function safeTemplate(_0x40e6d6){var _0x5aa7a8=_0x40e6d6;if(typeof _0x40e6d6===_0xb087('0x1')){_0x5aa7a8=_0x40e6d6[_0xb087('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xb087('0x3')](_0x40e6d6)){_0x5aa7a8=_0x40e6d6[_0xb087('0x4')](function(_0x183efd){return safeTemplate(_0x183efd);});}else if(_[_0xb087('0x5')](_0x40e6d6)){_0x5aa7a8=Object[_0xb087('0x6')](_0x40e6d6)[_0xb087('0x7')](function(_0xecf080,_0x36ac30){_0xecf080[_0x36ac30]=safeTemplate(_0x40e6d6[_0x36ac30]);return _0xecf080;},{});}return _0x5aa7a8;}module[_0xb087('0x8')][_0xb087('0x9')]=safeTemplate; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index ed2c764..bfe2e70 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 _0x782f=['exports','util','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','toLowerCase','hangup','emit','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','result=','indexOf','substr','startsWith','split','length','match','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','command','write','sendRequest','sync','prototype','answer','ANSWER','getData','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','exec','isArray','format','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setPriority','SET\x20PRIORITY\x20%s','setVariable','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayDigits','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s'];(function(_0x38e9c7,_0x37c439){var _0xe72d3a=function(_0x353490){while(--_0x353490){_0x38e9c7['push'](_0x38e9c7['shift']());}};_0xe72d3a(++_0x37c439);}(_0x782f,0x1f2));var _0xf782=function(_0x338f64,_0x5793e3){_0x338f64=_0x338f64-0x0;var _0x104b9b=_0x782f[_0x338f64];return _0x104b9b;};'use strict';var util=require(_0xf782('0x0'));var _=require('lodash');var EventEmitter=require('events')[_0xf782('0x1')];var AGIReply=require(_0xf782('0x2'));var AGIError=require(_0xf782('0x3'));function AGIChannel(_0x2fc7bf){var _0x2a0b3e=this,_0x1f17d3=new AGIReply(),_0x56b1d7=![],_0x3976c4={};EventEmitter[_0xf782('0x4')](_0x2a0b3e);_0x2fc7bf[_0xf782('0x5')](_0xf782('0x6'));_0x2fc7bf[_0xf782('0x7')](0x8*0x3c*0x3c*0x3e8);_0x1f17d3['setEncoding'](_0xf782('0x6'));_0x1f17d3['on']('headers',function(_0x39cbce){for(var _0x4b285a in _0x39cbce){_0x2a0b3e[_0x4b285a]=_0x39cbce[_0x4b285a];}_0x2a0b3e['emit']('ready');});_0x1f17d3['on']('line',function(_0x30dc0a){if(_0x30dc0a[_0xf782('0x8')]()==_0xf782('0x9')){_0x2a0b3e[_0xf782('0xa')](_0xf782('0x9'));return;}if(_0x30dc0a[_0xf782('0xb')](0x0,0xb)==_0xf782('0xc')){_0x56b1d7=!![];}if(_0x56b1d7){_0x3976c4['rx']+=_0x30dc0a+'\x0a';if(_0x30dc0a[_0xf782('0xd')](_0xf782('0xe'))!=-0x1){_0x56b1d7=![];}}else{_0x3976c4['rx']=_0x30dc0a;}if(_0x56b1d7){return;}if(typeof _0x3976c4['cb']==_0xf782('0xf')){var _0x22ebfa=_0x3976c4['rx'][_0xf782('0xb')](0x0,0x3),_0x358bd4=null,_0x51c487=null;_0x22ebfa=parseInt(_0x22ebfa);if(isNaN(_0x22ebfa)){_0x3976c4['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xf782('0x10')});return;}if(_0x22ebfa!=0xc8){_0x3976c4['cb'](null,{'code':_0x22ebfa,'result':-0x1,'extra':'KO'});return;}_0x358bd4=_0x3976c4['rx'][_0xf782('0xb')](0x4)['replace'](_0xf782('0x11'),'');if(_0x358bd4[_0xf782('0x12')]('\x20')!=-0x1){_0x358bd4=_0x358bd4[_0xf782('0x13')](0x0,_0x358bd4[_0xf782('0x12')]('\x20'));}if(_[_0xf782('0x14')](_0x358bd4,'-1')){_0x358bd4=parseInt(_0x358bd4);}_0x51c487=_0x3976c4['rx'][_0xf782('0x15')]('\x20');if(_0x51c487['length']==0x3){_0x51c487=_0x51c487[0x2]['substring'](0x1,_0x51c487[0x2][_0xf782('0x16')]-0x1);}else if(_0x51c487[_0xf782('0x16')]>0x3){var _0x189ee2=/\((.+)\)/;var _0x12d391=_0x3976c4['rx'][_0xf782('0x17')](_0x189ee2);if(_0x12d391){_0x51c487=_0x12d391[0x1];}else{_0x51c487=null;}}else{_0x51c487=null;}_0x3976c4['cb'](null,{'code':_0x22ebfa,'result':_0x358bd4,'extra':_0x51c487});}});_0x2fc7bf['on'](_0xf782('0x18'),function(_0x304993){_0x2a0b3e['emit']('error',new AGIError('E_AGI_SOCKET_ERROR',_0x304993[_0xf782('0x19')]));});_0x2fc7bf['on']('close',function(){_0x2a0b3e[_0xf782('0xa')](_0xf782('0x1a'),new AGIError(_0xf782('0x1b')));});_0x2fc7bf['on'](_0xf782('0x1c'),function(){_0x2a0b3e[_0xf782('0xa')]('timeout',new AGIError(_0xf782('0x1d')));_0x2fc7bf[_0xf782('0x1e')]();});_0x2fc7bf['pipe'](_0x1f17d3);this[_0xf782('0x1f')]=function(_0x54f947,_0x44a02f){var _0x54f947=_0x54f947||'',_0x44a02f=typeof _0x44a02f=='function'?_0x44a02f:new Function();_0x3976c4={'tx':_0x54f947,'rx':'','cb':_0x44a02f};_0x2fc7bf[_0xf782('0x20')](_0x54f947+'\x0a');},this['close']=function(){_0x2fc7bf['destroy']();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel['prototype'][_0xf782('0x21')]=function(_0x5e3215){return this[_0xf782('0x1f')][_0xf782('0x22')](this,_0x5e3215);};AGIChannel[_0xf782('0x23')][_0xf782('0x24')]=function(){return this[_0xf782('0x21')](_0xf782('0x25'));};AGIChannel[_0xf782('0x23')][_0xf782('0x26')]=function(_0x2e4b9e,_0x4a3a39,_0x461f33){_0x2e4b9e=_0x2e4b9e===undefined?'beep':_0x2e4b9e;_0x4a3a39=_0x4a3a39===undefined?'5':_0x4a3a39;_0x461f33=_0x461f33===undefined?'1':_0x461f33;return this[_0xf782('0x21')](util['format'](_0xf782('0x27'),_0x2e4b9e,_0x4a3a39*0x3e8,_0x461f33));};AGIChannel[_0xf782('0x23')][_0xf782('0x28')]=function(_0x2daefb){_0x2daefb=_0x2daefb||'NO\x20MESSAGE';return this[_0xf782('0x21')](util['format'](_0xf782('0x29'),_0x2daefb));};AGIChannel['prototype'][_0xf782('0x2a')]=function(_0x2eab83,_0x46ff3d){if(_[_0xf782('0x2b')](_0x46ff3d)){return this[_0xf782('0x21')](util[_0xf782('0x2c')](_0xf782('0x2d'),_0x2eab83,_0x46ff3d['join'](',')));}return this[_0xf782('0x21')](util['format'](_0xf782('0x2d'),_0x2eab83,_0x46ff3d));};AGIChannel['prototype'][_0xf782('0x2e')]=function(_0x593bdf){return this[_0xf782('0x21')](util[_0xf782('0x2c')](_0xf782('0x2f'),_0x593bdf));};AGIChannel[_0xf782('0x23')]['setExtension']=function(_0x524555){return this[_0xf782('0x21')](util[_0xf782('0x2c')]('SET\x20EXTENSION\x20%s',_0x524555));};AGIChannel[_0xf782('0x23')][_0xf782('0x30')]=function(_0x126e48){return this[_0xf782('0x21')](util[_0xf782('0x2c')](_0xf782('0x31'),_0x126e48));};AGIChannel['prototype'][_0xf782('0x9')]=function(){return this[_0xf782('0x21')]('HANGUP');};AGIChannel[_0xf782('0x23')][_0xf782('0x32')]=function(_0x1a95a8,_0x2548e5){var _0x69a7b=_['isBoolean'](_0x2548e5)||_['isNumber'](_0x2548e5)?_0x2548e5[_0xf782('0x33')]():_0x2548e5;return this[_0xf782('0x21')](util[_0xf782('0x2c')](_0xf782('0x34'),_0x1a95a8,_0x69a7b?_0x69a7b['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xf782('0x23')][_0xf782('0x35')]=function(_0x32fde4,_0x2a8fc9){return this['sendRequest'](util['format']('SAY\x20NUMBER\x20%s\x20%s',_0x32fde4,_0x2a8fc9));};AGIChannel[_0xf782('0x23')][_0xf782('0x36')]=function(_0x4adab9,_0x21a8e2){return this[_0xf782('0x21')](util[_0xf782('0x2c')]('SAY\x20DIGITS\x20%s\x20%s',_0x4adab9,_0x21a8e2));};AGIChannel[_0xf782('0x23')]['sayPhonetic']=function(_0x21a9d8,_0x57e4bb){return this[_0xf782('0x21')](util['format'](_0xf782('0x37'),_0x21a9d8,_0x57e4bb));};AGIChannel['prototype'][_0xf782('0x38')]=function(_0x121be2,_0x1eed33,_0x5a88d0){_0x1eed33=_0x1eed33||this[_0xf782('0x39')];_0x5a88d0=_0x5a88d0||0x1;this['setContext'](_0x121be2);this[_0xf782('0x3a')](_0x1eed33);this[_0xf782('0x30')](_0x5a88d0);return this[_0xf782('0x28')](util[_0xf782('0x2c')](_0xf782('0x3b'),_0x121be2,_0x1eed33,_0x5a88d0));};AGIChannel[_0xf782('0x23')][_0xf782('0x3c')]=function(_0x36a13f){return this[_0xf782('0x21')](util[_0xf782('0x2c')](_0xf782('0x3d'),_0x36a13f));};AGIChannel[_0xf782('0x23')]['recordFile']=function(_0x45f2f0,_0x1fd93f,_0x97d21f,_0x116f5a,_0x2dac5b,_0x3c17af){_0x1fd93f=_0x1fd93f||_0xf782('0x3e');_0x97d21f=_0x97d21f||'';_0x116f5a=_0x116f5a===undefined?-0x1:_0x116f5a==='-1'?-0x1:_0x116f5a*0x3e8;_0x2dac5b=_0x2dac5b===undefined?'':'s='+_0x2dac5b;_0x3c17af=_0x3c17af?_0xf782('0x3f'):'';return this['sendRequest'](util[_0xf782('0x2c')](_0xf782('0x40'),_0x45f2f0,_0x1fd93f,_0x97d21f,_0x116f5a,_0x3c17af,_0x2dac5b));};AGIChannel[_0xf782('0x23')][_0xf782('0x41')]=function(_0x40d003,_0x2d4ae0){_0x2d4ae0=_0x2d4ae0||'';return this[_0xf782('0x21')](util[_0xf782('0x2c')](_0xf782('0x42'),_0x40d003,_0x2d4ae0));};AGIChannel['prototype'][_0xf782('0x43')]=function(_0x34b2b7){return this[_0xf782('0x2a')](_0xf782('0x44'),_0x34b2b7);};AGIChannel[_0xf782('0x23')]['wait']=function(_0x46fb2e){return this[_0xf782('0x2a')]('WAIT',_0x46fb2e);};AGIChannel[_0xf782('0x23')]['error']=function(_0x2a2105,_0xbb87f2){this[_0xf782('0x28')](util[_0xf782('0x2c')](_0xf782('0x45'),_0x2a2105['id'],_0x2a2105['label'],_0xbb87f2));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xf782('0x46')]=AGIChannel; \ No newline at end of file +var _0x342e=['answer','ANSWER','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','isNumber','toString','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setPriority','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','lodash','events','./reply','./error','call','setEncoding','utf8','setTimeout','emit','ready','line','toLowerCase','hangup','substring','search','520\x20End\x20of\x20proper','function','result=','indexOf','substr','startsWith','split','length','error','E_AGI_SOCKET_ERROR','code','close','timeout','destroy','pipe','command','write','inherits','sendRequest','sync','prototype'];(function(_0x211632,_0x378e2e){var _0x5a1da1=function(_0x44aff2){while(--_0x44aff2){_0x211632['push'](_0x211632['shift']());}};_0x5a1da1(++_0x378e2e);}(_0x342e,0x19e));var _0xe342=function(_0x2f71f6,_0x3a1f4d){_0x2f71f6=_0x2f71f6-0x0;var _0x2b23ea=_0x342e[_0x2f71f6];return _0x2b23ea;};'use strict';var util=require('util');var _=require(_0xe342('0x0'));var EventEmitter=require(_0xe342('0x1'))['EventEmitter'];var AGIReply=require(_0xe342('0x2'));var AGIError=require(_0xe342('0x3'));function AGIChannel(_0xfe51e5){var _0x326df2=this,_0x30dc1f=new AGIReply(),_0x28e5bb=![],_0x295a74={};EventEmitter[_0xe342('0x4')](_0x326df2);_0xfe51e5[_0xe342('0x5')](_0xe342('0x6'));_0xfe51e5[_0xe342('0x7')](0x8*0x3c*0x3c*0x3e8);_0x30dc1f[_0xe342('0x5')](_0xe342('0x6'));_0x30dc1f['on']('headers',function(_0x51fc15){for(var _0x4a30dc in _0x51fc15){_0x326df2[_0x4a30dc]=_0x51fc15[_0x4a30dc];}_0x326df2[_0xe342('0x8')](_0xe342('0x9'));});_0x30dc1f['on'](_0xe342('0xa'),function(_0x314bc9){if(_0x314bc9[_0xe342('0xb')]()==_0xe342('0xc')){_0x326df2[_0xe342('0x8')]('hangup');return;}if(_0x314bc9[_0xe342('0xd')](0x0,0xb)=='520-Invalid'){_0x28e5bb=!![];}if(_0x28e5bb){_0x295a74['rx']+=_0x314bc9+'\x0a';if(_0x314bc9[_0xe342('0xe')](_0xe342('0xf'))!=-0x1){_0x28e5bb=![];}}else{_0x295a74['rx']=_0x314bc9;}if(_0x28e5bb){return;}if(typeof _0x295a74['cb']==_0xe342('0x10')){var _0x4aa167=_0x295a74['rx'][_0xe342('0xd')](0x0,0x3),_0xe81bc6=null,_0x1f9483=null;_0x4aa167=parseInt(_0x4aa167);if(isNaN(_0x4aa167)){_0x295a74['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x4aa167!=0xc8){_0x295a74['cb'](null,{'code':_0x4aa167,'result':-0x1,'extra':'KO'});return;}_0xe81bc6=_0x295a74['rx'][_0xe342('0xd')](0x4)['replace'](_0xe342('0x11'),'');if(_0xe81bc6[_0xe342('0x12')]('\x20')!=-0x1){_0xe81bc6=_0xe81bc6[_0xe342('0x13')](0x0,_0xe81bc6[_0xe342('0x12')]('\x20'));}if(_[_0xe342('0x14')](_0xe81bc6,'-1')){_0xe81bc6=parseInt(_0xe81bc6);}_0x1f9483=_0x295a74['rx'][_0xe342('0x15')]('\x20');if(_0x1f9483['length']==0x3){_0x1f9483=_0x1f9483[0x2][_0xe342('0xd')](0x1,_0x1f9483[0x2][_0xe342('0x16')]-0x1);}else if(_0x1f9483[_0xe342('0x16')]>0x3){var _0x5ce40c=/\((.+)\)/;var _0x5e954b=_0x295a74['rx']['match'](_0x5ce40c);if(_0x5e954b){_0x1f9483=_0x5e954b[0x1];}else{_0x1f9483=null;}}else{_0x1f9483=null;}_0x295a74['cb'](null,{'code':_0x4aa167,'result':_0xe81bc6,'extra':_0x1f9483});}});_0xfe51e5['on'](_0xe342('0x17'),function(_0x20c3da){_0x326df2[_0xe342('0x8')](_0xe342('0x17'),new AGIError(_0xe342('0x18'),_0x20c3da[_0xe342('0x19')]));});_0xfe51e5['on'](_0xe342('0x1a'),function(){_0x326df2['emit']('close',new AGIError('E_AGI_SOCKET_CLOSE'));});_0xfe51e5['on'](_0xe342('0x1b'),function(){_0x326df2[_0xe342('0x8')]('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0xfe51e5[_0xe342('0x1c')]();});_0xfe51e5[_0xe342('0x1d')](_0x30dc1f);this[_0xe342('0x1e')]=function(_0x102bd9,_0xcd66b){var _0x102bd9=_0x102bd9||'',_0xcd66b=typeof _0xcd66b==_0xe342('0x10')?_0xcd66b:new Function();_0x295a74={'tx':_0x102bd9,'rx':'','cb':_0xcd66b};_0xfe51e5[_0xe342('0x1f')](_0x102bd9+'\x0a');},this['close']=function(){_0xfe51e5['destroy']();};}util[_0xe342('0x20')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0xe342('0x21')]=function(_0x3e08b7){return this[_0xe342('0x1e')][_0xe342('0x22')](this,_0x3e08b7);};AGIChannel[_0xe342('0x23')][_0xe342('0x24')]=function(){return this[_0xe342('0x21')](_0xe342('0x25'));};AGIChannel[_0xe342('0x23')]['getData']=function(_0x1471e4,_0x6b26bf,_0x18e958){_0x1471e4=_0x1471e4===undefined?'beep':_0x1471e4;_0x6b26bf=_0x6b26bf===undefined?'5':_0x6b26bf;_0x18e958=_0x18e958===undefined?'1':_0x18e958;return this[_0xe342('0x21')](util[_0xe342('0x26')](_0xe342('0x27'),_0x1471e4,_0x6b26bf*0x3e8,_0x18e958));};AGIChannel['prototype'][_0xe342('0x28')]=function(_0x2c5d70){_0x2c5d70=_0x2c5d70||'NO\x20MESSAGE';return this[_0xe342('0x21')](util[_0xe342('0x26')]('VERBOSE\x20\x22%s\x22',_0x2c5d70));};AGIChannel[_0xe342('0x23')][_0xe342('0x29')]=function(_0x41d3b1,_0x444678){if(_[_0xe342('0x2a')](_0x444678)){return this['sendRequest'](util[_0xe342('0x26')](_0xe342('0x2b'),_0x41d3b1,_0x444678[_0xe342('0x2c')](',')));}return this['sendRequest'](util[_0xe342('0x26')](_0xe342('0x2b'),_0x41d3b1,_0x444678));};AGIChannel[_0xe342('0x23')][_0xe342('0x2d')]=function(_0x29eaee){return this[_0xe342('0x21')](util[_0xe342('0x26')](_0xe342('0x2e'),_0x29eaee));};AGIChannel[_0xe342('0x23')][_0xe342('0x2f')]=function(_0x4ee01a){return this[_0xe342('0x21')](util[_0xe342('0x26')](_0xe342('0x30'),_0x4ee01a));};AGIChannel[_0xe342('0x23')]['setPriority']=function(_0x32f87d){return this[_0xe342('0x21')](util['format'](_0xe342('0x31'),_0x32f87d));};AGIChannel[_0xe342('0x23')]['hangup']=function(){return this['sendRequest'](_0xe342('0x32'));};AGIChannel[_0xe342('0x23')]['setVariable']=function(_0x45564a,_0x5ff5aa){var _0x3ae4e9=_['isBoolean'](_0x5ff5aa)||_[_0xe342('0x33')](_0x5ff5aa)?_0x5ff5aa['toString']():_0x5ff5aa;return this[_0xe342('0x21')](util['format']('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x45564a,_0x3ae4e9?_0x3ae4e9[_0xe342('0x34')]()[_0xe342('0x35')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xe342('0x23')][_0xe342('0x36')]=function(_0x1a3eda,_0x52c7b0){return this[_0xe342('0x21')](util[_0xe342('0x26')](_0xe342('0x37'),_0x1a3eda,_0x52c7b0));};AGIChannel['prototype']['sayDigits']=function(_0x3bf76e,_0x2b67a1){return this['sendRequest'](util[_0xe342('0x26')](_0xe342('0x38'),_0x3bf76e,_0x2b67a1));};AGIChannel[_0xe342('0x23')][_0xe342('0x39')]=function(_0x4afa88,_0x43fc59){return this['sendRequest'](util[_0xe342('0x26')](_0xe342('0x3a'),_0x4afa88,_0x43fc59));};AGIChannel[_0xe342('0x23')][_0xe342('0x3b')]=function(_0x34e9f4,_0x48b84c,_0x557e61){_0x48b84c=_0x48b84c||this['extension'];_0x557e61=_0x557e61||0x1;this[_0xe342('0x2d')](_0x34e9f4);this['setExtension'](_0x48b84c);this[_0xe342('0x3c')](_0x557e61);return this[_0xe342('0x28')](util[_0xe342('0x26')](_0xe342('0x3d'),_0x34e9f4,_0x48b84c,_0x557e61));};AGIChannel['prototype']['getVariable']=function(_0x47b382){return this[_0xe342('0x21')](util[_0xe342('0x26')](_0xe342('0x3e'),_0x47b382));};AGIChannel[_0xe342('0x23')][_0xe342('0x3f')]=function(_0x3d0d21,_0x32a046,_0xd4826c,_0x47b70f,_0x3df02c,_0x5d5c1e){_0x32a046=_0x32a046||_0xe342('0x40');_0xd4826c=_0xd4826c||'';_0x47b70f=_0x47b70f===undefined?-0x1:_0x47b70f==='-1'?-0x1:_0x47b70f*0x3e8;_0x3df02c=_0x3df02c===undefined?'':'s='+_0x3df02c;_0x5d5c1e=_0x5d5c1e?_0xe342('0x41'):'';return this[_0xe342('0x21')](util[_0xe342('0x26')](_0xe342('0x42'),_0x3d0d21,_0x32a046,_0xd4826c,_0x47b70f,_0x5d5c1e,_0x3df02c));};AGIChannel[_0xe342('0x23')][_0xe342('0x43')]=function(_0x7e8fd7,_0x3218c4){_0x3218c4=_0x3218c4||'';return this['sendRequest'](util['format'](_0xe342('0x44'),_0x7e8fd7,_0x3218c4));};AGIChannel[_0xe342('0x23')][_0xe342('0x45')]=function(_0x5dea41){return this[_0xe342('0x29')](_0xe342('0x46'),_0x5dea41);};AGIChannel[_0xe342('0x23')][_0xe342('0x47')]=function(_0xcbe1aa){return this[_0xe342('0x29')](_0xe342('0x48'),_0xcbe1aa);};AGIChannel[_0xe342('0x23')]['error']=function(_0x2f509d,_0x18d6ca){this['noop'](util[_0xe342('0x26')](_0xe342('0x49'),_0x2f509d['id'],_0x2f509d[_0xe342('0x4a')],_0x18d6ca));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 9807c02..95fc6fb 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 _0xbf4e=['message','name','exports','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbf4e,0x18a));var _0xebf4=function(_0x2444a1,_0x2226fc){_0x2444a1=_0x2444a1-0x0;var _0x32d832=_0xbf4e[_0x2444a1];return _0x32d832;};'use strict';var util=require(_0xebf4('0x0'));var error={'E_AGI_UNDEFINED':_0xebf4('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xebf4('0x2'),'E_AGI_SERVER_CLOSE':_0xebf4('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xebf4('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xebf4('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0xebf4('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xebf4('0x7'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xebf4('0x8'),'E_AGI_IVR_ENTRY':_0xebf4('0x9')};function AGIError(_0x48ca83){var _0x48ca83=_0x48ca83||null,_0x20c3c6=_0x20c3c6||[],_0xda469b=0x1,_0x14e83f='';if(!error[_0x48ca83]){_0x48ca83=_0xebf4('0xa');}_0x20c3c6[_0xebf4('0xb')](error[_0x48ca83]);while(arguments[_0xda469b]){_0x20c3c6[_0xebf4('0xb')](arguments[_0xda469b]);_0xda469b++;}_0x14e83f=util[_0xebf4('0xc')][_0xebf4('0xd')](util,_0x20c3c6);this[_0xebf4('0xe')]=_0x14e83f;this[_0xebf4('0xf')]=_0x48ca83;}module[_0xebf4('0x10')]=AGIError; \ No newline at end of file +var _0x0828=['Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','name','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x0828,0x11b));var _0x8082=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x0828[_0x53ccf2];return _0x5a2964;};'use strict';var util=require(_0x8082('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x8082('0x1'),'E_AGI_SERVER_ERROR':_0x8082('0x2'),'E_AGI_SERVER_CLOSE':_0x8082('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x8082('0x4'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x8082('0x5'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x8082('0x6'),'E_AGI_IVR_ENTRY':_0x8082('0x7')};function AGIError(_0x34750a){var _0x34750a=_0x34750a||null,_0x3bef33=_0x3bef33||[],_0x52972b=0x1,_0x465071='';if(!error[_0x34750a]){_0x34750a=_0x8082('0x8');}_0x3bef33[_0x8082('0x9')](error[_0x34750a]);while(arguments[_0x52972b]){_0x3bef33[_0x8082('0x9')](arguments[_0x52972b]);_0x52972b++;}_0x465071=util['format'][_0x8082('0xa')](util,_0x3bef33);this['message']=_0x465071;this[_0x8082('0xb')]=_0x34750a;}module[_0x8082('0xc')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index d9035c5..c87ad6b 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 _0xe8c6=['info','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','target','default','includes','condition\x20not\x20found','exports','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','push','size','getVertex','traverseBFS','no\x20vertex\x20found'];(function(_0x39936b,_0x13515e){var _0x39bfaf=function(_0x4a3b9e){while(--_0x4a3b9e){_0x39936b['push'](_0x39936b['shift']());}};_0x39bfaf(++_0x13515e);}(_0xe8c6,0x1bc));var _0x6e8c=function(_0x5ef55c,_0x2e46f0){_0x5ef55c=_0x5ef55c-0x0;var _0x881911=_0xe8c6[_0x5ef55c];return _0x881911;};'use strict';var _=require('lodash');var logger=require(_0x6e8c('0x0'))(_0x6e8c('0x1'));var verticesWithRetry=[_0x6e8c('0x2'),_0x6e8c('0x3'),_0x6e8c('0x4')];var Graph=function(){this[_0x6e8c('0x5')]={};this[_0x6e8c('0x6')]={};this[_0x6e8c('0x7')]=0x0;};Graph[_0x6e8c('0x8')][_0x6e8c('0x9')]=function(_0x41c343){this['vertices'][_0x41c343['id']]=_0x41c343;this[_0x6e8c('0x6')][_0x41c343['id']]=[];};Graph[_0x6e8c('0x8')]['addEdge']=function(_0x2aff6b,_0x304fd0,_0xa14db9){this[_0x6e8c('0x6')][_0x2aff6b][_0x6e8c('0xa')]({'target':_0x304fd0,'condition':_0xa14db9});this['numberOfEdges']+=0x1;};Graph[_0x6e8c('0x8')][_0x6e8c('0xb')]=function(){return _[_0x6e8c('0xb')](this[_0x6e8c('0x5')]);};Graph[_0x6e8c('0x8')]['relations']=function(){return this[_0x6e8c('0x7')];};Graph[_0x6e8c('0x8')][_0x6e8c('0xc')]=function(_0x1b1da5){return this[_0x6e8c('0x5')][_0x1b1da5];};Graph[_0x6e8c('0x8')][_0x6e8c('0xd')]=function(_0x5c7a2f,_0x170757){if(!this[_0x6e8c('0x5')][_0x5c7a2f]){return logger['info'](_0x6e8c('0xe'));}var _0x5e581f=_0x170757(this[_0x6e8c('0x5')][_0x5c7a2f]);if(!_0x5e581f){return logger[_0x6e8c('0xf')]('stop\x20traverse');}if(this[_0x6e8c('0x6')][_0x5c7a2f][_0x6e8c('0x10')]===0x0){return logger[_0x6e8c('0xf')](_0x6e8c('0x11'));}for(var _0x18ee97=0x0,_0x572f82=[],_0x120a47=![];_0x18ee97\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[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','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','./server','listening','connection','xml2json','lodash','syncho','util','../../config/environment','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','defaults','127.0.0.1','error','stack','log','port','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','info','callerid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','uniqueid','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','omit','mxCell','isArray','length','source','target','catch','createSquareReport','then','indexOf','debug','stringify','calleridname','close'];(function(_0x43b08,_0x15f967){var _0x5e05f4=function(_0x4bb0cb){while(--_0x4bb0cb){_0x43b08['push'](_0x43b08['shift']());}};_0x5e05f4(++_0x15f967);}(_0x4268,0x77));var _0x8426=function(_0x23afe6,_0xadb445){_0x23afe6=_0x23afe6-0x0;var _0x26751f=_0x4268[_0x23afe6];return _0x26751f;};'use strict';var parser=require(_0x8426('0x0'));var _=require(_0x8426('0x1'));var syncho=require(_0x8426('0x2'));var util=require(_0x8426('0x3'));var moment=require('moment');var config=require(_0x8426('0x4'));var logger=require(_0x8426('0x5'))(_0x8426('0x6'));var utilLicense=require('../../config/license/util');var rpc=require(_0x8426('0x7'));var mailRpc=require(_0x8426('0x8'));var Graph=require(_0x8426('0x9'));var Vertices=require(_0x8426('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x8426('0x6')]=_[_0x8426('0xb')](config[_0x8426('0x6')],{'ip':_0x8426('0xc'),'port':0x11dd});function connectionHandler(_0x5b0e75){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x5b0e75);agiHandler(_0x5b0e75);}catch(_0xb8aa1f){logger[_0x8426('0xd')](_0xb8aa1f[_0x8426('0xe')]);}});});}function listeningHandler(){console[_0x8426('0xf')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x8426('0x6')][_0x8426('0x10')]);logger['info'](util[_0x8426('0x11')](_0x8426('0x12'),config[_0x8426('0x6')]['ip'],config[_0x8426('0x6')][_0x8426('0x10')]));}function errorHandler(_0x4ec2c3){if(_0x4ec2c3&&_0x4ec2c3[_0x8426('0x13')]&&_0x4ec2c3[_0x8426('0x14')]){logger['error'](util[_0x8426('0x11')](_0x8426('0x15'),_0x4ec2c3[_0x8426('0x13')],_0x4ec2c3[_0x8426('0x14')]));}else{logger[_0x8426('0xd')](util['format'](_0x8426('0x16'),_0x4ec2c3[_0x8426('0xe')]));}}function closeHandler(){logger[_0x8426('0x17')](util['format']('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this['calleridname'],this[_0x8426('0x18')],this['dnid'],this['uniqueid']));try{createSquareReport(this);}catch(_0x2d4d76){logger[_0x8426('0xd')](_0x2d4d76[_0x8426('0xe')]);}}function timeoutHandler(){logger[_0x8426('0x17')](util[_0x8426('0x11')](_0x8426('0x19'),this[_0x8426('0x1a')],this['calleridname'],this[_0x8426('0x18')],this[_0x8426('0x1b')],this[_0x8426('0x1c')]));}function hangupHandler(){logger['info'](util[_0x8426('0x11')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x8426('0x1a')],this['calleridname'],this['callerid'],this[_0x8426('0x1b')],this[_0x8426('0x1c')]));this[_0x8426('0x1d')]=!![];}function getRoot(_0x2800f5){return parser[_0x8426('0x1e')](_0x2800f5,{'object':!![]})[_0x8426('0x1f')][_0x8426('0x20')];}function addVertex(_0x4273a8,_0x2853da,_0x17fa7f){_0x2853da[_0x8426('0x21')]=_0x17fa7f;if(_0x2853da[_0x8426('0x22')](_0x8426('0x23'))){_0x2853da[_0x8426('0x24')]=parseInt(_0x2853da[_0x8426('0x23')],0xa);}_0x4273a8['addVertex'](_[_0x8426('0x25')](_0x2853da,_0x8426('0x26')));}function initGraph(_0x27f196,_0x2b6f89){var _0x34d779=new Graph();for(var _0x24c793 in _0x27f196){if(_0x27f196['hasOwnProperty'](_0x24c793)){if(_[_0x8426('0x27')](_0x27f196[_0x24c793])){for(var _0x430539=0x0;_0x430539<_0x27f196[_0x24c793]['length'];_0x430539+=0x1){addVertex(_0x34d779,_0x27f196[_0x24c793][_0x430539],_0x24c793);}}else{addVertex(_0x34d779,_0x27f196[_0x24c793],_0x24c793);}}}for(var _0x5748bd=0x0;_0x5748bd<_0x2b6f89[_0x8426('0x28')];_0x5748bd+=0x1){if(_0x2b6f89[_0x5748bd][_0x8426('0x29')]&&_0x2b6f89[_0x5748bd][_0x8426('0x2a')]){_0x34d779['addEdge'](_0x2b6f89[_0x5748bd][_0x8426('0x29')],_0x2b6f89[_0x5748bd][_0x8426('0x2a')],_0x2b6f89[_0x5748bd]['value']);}}return _0x34d779;}function getSquareProject(_0x5acc51,_0x255cd6){rpc['getSquareProject'](_0x5acc51)['then'](function(_0x4b9140){_0x255cd6(null,_0x4b9140);})[_0x8426('0x2b')](function(_0x3ae3d5){_0x255cd6(null,_0x3ae3d5);});}function createSquareReport(_0x5d65ed,_0x14978d){rpc[_0x8426('0x2c')](_0x5d65ed)[_0x8426('0x2d')](function(_0x359277){if(_0x14978d){_0x14978d(null,_0x359277);}})[_0x8426('0x2b')](function(_0x3d1591){if(_0x14978d){_0x14978d(null,_0x3d1591);}});}function setChannelVariables(_0x16cd24){for(var _0x17f07d in _0x16cd24){if(_0x16cd24['hasOwnProperty'](_0x17f07d)){if(_0x17f07d[_0x8426('0x2e')]('agi_')===0x0){_0x16cd24[_0x17f07d['substring'](0x4)]=_0x16cd24[_0x17f07d];delete _0x16cd24[_0x17f07d];}}}}function getLogFromObject(_0x21b526){return util['inspect'](_0x21b526,{'showHidden':![],'depth':null});}function agiHandler(_0x457c51){var _0x4fa165,_0x5cd62b,_0x26b2ed,_0x1d0cf5,_0x4f2dec;logger[_0x8426('0x2f')]('variables',JSON[_0x8426('0x30')](_0x457c51,null,0x2));logger[_0x8426('0x17')](util[_0x8426('0x11')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x457c51[_0x8426('0x1a')],_0x457c51[_0x8426('0x31')],_0x457c51[_0x8426('0x18')],_0x457c51[_0x8426('0x1b')],_0x457c51[_0x8426('0x1c')]));_0x457c51['on'](_0x8426('0xd'),errorHandler);_0x457c51['on'](_0x8426('0x32'),closeHandler);_0x457c51['on']('timeout',timeoutHandler);_0x457c51['evtHangup']=![];_0x457c51['on'](_0x8426('0x33'),hangupHandler);var _0xc5e689=getSquareProject[_0x8426('0x34')](null,_0x457c51[_0x8426('0x1a')]);if(_0xc5e689){if(_0xc5e689[_0x8426('0x35')]){_0x4fa165=getRoot(_0xc5e689[_0x8426('0x35')]);if(_0x4fa165&&_0x4fa165[_0x8426('0x36')]){logger[_0x8426('0x2f')](_0x8426('0x20'),JSON[_0x8426('0x30')](_0x4fa165,null,0x2));_0x457c51[_0x8426('0x37')]=moment()[_0x8426('0x11')](_0x8426('0x38'));_0x5cd62b=initGraph(_['omit'](_0x4fa165,'mxCell'),_0x4fa165[_0x8426('0x26')]);_0x26b2ed=new Vertices(_0x457c51,rpc,mailRpc);logger[_0x8426('0x17')](util[_0x8426('0x11')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x457c51[_0x8426('0x1a')],_0x457c51[_0x8426('0x31')],_0x457c51['callerid'],_0x457c51[_0x8426('0x1b')],_0x457c51[_0x8426('0x1c')]));_0x5cd62b[_0x8426('0x39')](_0x4fa165[_0x8426('0x36')]['id'],function(_0x4cff71){try{_0x4cff71=_0x26b2ed[_0x8426('0x3a')](_0x4cff71);logger['debug'](_0x8426('0x3b'),JSON[_0x8426('0x30')](_0x4cff71,null,0x2));if(_0x4cff71[_0x8426('0x21')]===_0x8426('0x3c')){logger[_0x8426('0x17')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x457c51[_0x8426('0x3d')]=_0x4cff71[_0x8426('0x3d')]||_0x457c51[_0x8426('0x3d')];_0x457c51[_0x8426('0x3e')]=_0x4cff71[_0x8426('0x3e')];_0x457c51[_0x8426('0x3f')]=_0x4cff71[_0x8426('0x3f')]?_0x4cff71[_0x8426('0x3f')]-0x1:0x1;return null;}else if(_0x4cff71&&_0x26b2ed[_0x4cff71['agicommand']]){_0x4f2dec=_0x26b2ed[_0x4cff71['agicommand']](_0x4cff71);logger['info'](_0x8426('0x40'),JSON['stringify'](_0x4f2dec,null,0x2));if(_0x4f2dec&&_0x4f2dec[_0x8426('0x41')]===AGI_CODE_SUCCESS&&_0x4f2dec['result']!==AGI_RESULT_ERROR&&!_0x457c51[_0x8426('0x1d')]){logger['debug'](_0x8426('0x40'),getLogFromObject(_0x4f2dec));return _[_0x8426('0x42')](_0x4f2dec[_0x8426('0x43')])?null:_0x4f2dec['result'][_0x8426('0x44')]();}else{logger[_0x8426('0xd')](_0x8426('0x40'),getLogFromObject(_0x4f2dec));return null;}}else{logger[_0x8426('0xd')](_0x8426('0x45'));return null;}}catch(_0x55b2e4){logger[_0x8426('0xd')](_0x55b2e4['stack']);return null;}});if(_0x4fa165[_0x8426('0x46')]){logger['info'](util[_0x8426('0x11')](_0x8426('0x47'),_0x457c51['arg_1'],_0x457c51[_0x8426('0x31')],_0x457c51[_0x8426('0x18')],_0x457c51[_0x8426('0x1b')],_0x457c51[_0x8426('0x1c')]));_0x5cd62b['traverseBFS'](_0x4fa165[_0x8426('0x46')]['id'],function(_0x4b644e){try{_0x4b644e=_0x26b2ed['clear'](_0x4b644e);logger[_0x8426('0x2f')](_0x8426('0x3b'),JSON[_0x8426('0x30')](_0x4b644e,null,0x2));if(_0x4b644e&&_0x26b2ed[_0x4b644e['agicommand']]){_0x4f2dec=_0x26b2ed[_0x4b644e[_0x8426('0x21')]](_0x4b644e);if(_0x4f2dec){logger[_0x8426('0x2f')](_0x8426('0x40'),getLogFromObject(_0x4f2dec));return _[_0x8426('0x42')](_0x4f2dec[_0x8426('0x43')])?null:_0x4f2dec['result'][_0x8426('0x44')]();}else{logger[_0x8426('0xd')](_0x8426('0x40'),getLogFromObject(_0x4f2dec));return null;}}else{logger['error'](_0x8426('0x45'));return null;}}catch(_0x24c7c0){logger['error'](_0x24c7c0[_0x8426('0xe')]);return null;}});}logger[_0x8426('0x17')](util[_0x8426('0x11')](_0x8426('0x48'),_0x457c51[_0x8426('0x1a')],_0x457c51['calleridname'],_0x457c51[_0x8426('0x18')],_0x457c51[_0x8426('0x1b')],_0x457c51['uniqueid']));logger[_0x8426('0x17')](util[_0x8426('0x11')](_0x8426('0x49'),_0x457c51[_0x8426('0x3d')],_0x457c51['extension'],parseInt(_0x457c51[_0x8426('0x3f')],0xa)+0x1));_0x457c51[_0x8426('0x4a')](_0x457c51[_0x8426('0x3d')],_0x457c51['extension'],parseInt(_0x457c51[_0x8426('0x3f')],0xa)+0x1);_0x457c51[_0x8426('0x32')]();}}else{logger['error'](util[_0x8426('0x11')](_0x8426('0x4b'),_0x457c51[_0x8426('0x1a')]));_0x457c51[_0x8426('0x4a')](_0x457c51[_0x8426('0x3d')],_0x457c51[_0x8426('0x3e')],parseInt(_0x457c51[_0x8426('0x3f')],0xa)+0x1);_0x457c51[_0x8426('0x32')]();}}else{logger[_0x8426('0xd')](util[_0x8426('0x11')](_0x8426('0x4c'),_0x457c51[_0x8426('0x1a')]));_0x457c51[_0x8426('0x4a')](_0x457c51[_0x8426('0x3d')],_0x457c51[_0x8426('0x3e')],parseInt(_0x457c51['priority'],0xa)+0x1);_0x457c51[_0x8426('0x32')]();}}function main(){var _0x4214c7;return utilLicense['getLicense']()[_0x8426('0x2d')](function(_0x274196){if(_0x274196){if(_0x274196[_0x8426('0x4d')]){if(_0x274196[_0x8426('0x4e')]&&_0x274196[_0x8426('0x4e')]>0x0){logger['info'](util[_0x8426('0x11')](_0x8426('0x4f'),_0x274196[_0x8426('0x4e')]));_0x4214c7=_0x274196[_0x8426('0x4e')];}else{logger[_0x8426('0x17')](_0x8426('0x50'));}}else{logger[_0x8426('0x17')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x4214c7=-0x1;}}})[_0x8426('0x2b')](function(_0x1d0e34){logger[_0x8426('0xd')](_0x8426('0x51'),_0x1d0e34[_0x8426('0xe')]);})[_0x8426('0x46')](function(){var _0x332af7=require(_0x8426('0x52'))(config[_0x8426('0x6')][_0x8426('0x10')],config['agi']['ip'],_0x4214c7);_0x332af7['on'](_0x8426('0xd'),errorHandler);_0x332af7['on'](_0x8426('0x53'),listeningHandler);_0x332af7['on'](_0x8426('0x54'),connectionHandler);_0x332af7['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0xfba9=['length','source','target','addEdge','value','getSquareProject','then','catch','createSquareReport','indexOf','agi_','inspect','debug','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','production','start','root','stringify','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','isUndefined','result','toString','agicommand\x20not\x20found','finally','[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\x20found','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','listening','connection','xml2json','lodash','syncho','util','moment','../../config/environment','agi','./rpc','./vertices','defaults','nextTick','error','stack','log','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','[%s]\x20%s','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray'];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0xfba9,0xde));var _0x9fba=function(_0x1e4d97,_0x31b63e){_0x1e4d97=_0x1e4d97-0x0;var _0x3194e3=_0xfba9[_0x1e4d97];return _0x3194e3;};'use strict';var parser=require(_0x9fba('0x0'));var _=require(_0x9fba('0x1'));var syncho=require(_0x9fba('0x2'));var util=require(_0x9fba('0x3'));var moment=require(_0x9fba('0x4'));var config=require(_0x9fba('0x5'));var logger=require('../../config/logger')(_0x9fba('0x6'));var utilLicense=require('../../config/license/util');var rpc=require(_0x9fba('0x7'));var mailRpc=require('./mailRpc');var Graph=require('./graph');var Vertices=require(_0x9fba('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0x9fba('0x9')](config[_0x9fba('0x6')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x13a7b5){process[_0x9fba('0xa')](function(){syncho(function(){try{setChannelVariables(_0x13a7b5);agiHandler(_0x13a7b5);}catch(_0x3570fd){logger[_0x9fba('0xb')](_0x3570fd[_0x9fba('0xc')]);}});});}function listeningHandler(){console[_0x9fba('0xd')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi'][_0x9fba('0xe')]);logger[_0x9fba('0xf')](util[_0x9fba('0x10')](_0x9fba('0x11'),config[_0x9fba('0x6')]['ip'],config['agi'][_0x9fba('0xe')]));}function errorHandler(_0x33b47d){if(_0x33b47d&&_0x33b47d['name']&&_0x33b47d['message']){logger[_0x9fba('0xb')](util[_0x9fba('0x10')](_0x9fba('0x12'),_0x33b47d['name'],_0x33b47d[_0x9fba('0x13')]));}else{logger[_0x9fba('0xb')](util[_0x9fba('0x10')](_0x9fba('0x14'),_0x33b47d[_0x9fba('0xc')]));}}function closeHandler(){logger['info'](util[_0x9fba('0x10')](_0x9fba('0x15'),this[_0x9fba('0x16')],this[_0x9fba('0x17')],this[_0x9fba('0x18')],this[_0x9fba('0x19')],this[_0x9fba('0x1a')]));try{createSquareReport(this);}catch(_0x30293d){logger[_0x9fba('0xb')](_0x30293d[_0x9fba('0xc')]);}}function timeoutHandler(){logger[_0x9fba('0xf')](util[_0x9fba('0x10')](_0x9fba('0x1b'),this[_0x9fba('0x16')],this[_0x9fba('0x17')],this[_0x9fba('0x18')],this['dnid'],this[_0x9fba('0x1a')]));}function hangupHandler(){logger[_0x9fba('0xf')](util['format'](_0x9fba('0x1c'),this['arg_1'],this[_0x9fba('0x17')],this[_0x9fba('0x18')],this[_0x9fba('0x19')],this[_0x9fba('0x1a')]));this[_0x9fba('0x1d')]=!![];}function getRoot(_0x23cb46){return parser[_0x9fba('0x1e')](_0x23cb46,{'object':!![]})['mxGraphModel']['root'];}function addVertex(_0x16885e,_0x4683df,_0x43b65c){_0x4683df[_0x9fba('0x1f')]=_0x43b65c;if(_0x4683df[_0x9fba('0x20')](_0x9fba('0x21'))){_0x4683df[_0x9fba('0x22')]=parseInt(_0x4683df[_0x9fba('0x21')],0xa);}_0x16885e[_0x9fba('0x23')](_[_0x9fba('0x24')](_0x4683df,_0x9fba('0x25')));}function initGraph(_0x445582,_0x27ae62){var _0x293f04=new Graph();for(var _0x434f39 in _0x445582){if(_0x445582[_0x9fba('0x20')](_0x434f39)){if(_[_0x9fba('0x26')](_0x445582[_0x434f39])){for(var _0x10d961=0x0;_0x10d961<_0x445582[_0x434f39][_0x9fba('0x27')];_0x10d961+=0x1){addVertex(_0x293f04,_0x445582[_0x434f39][_0x10d961],_0x434f39);}}else{addVertex(_0x293f04,_0x445582[_0x434f39],_0x434f39);}}}for(var _0x26b626=0x0;_0x26b626<_0x27ae62['length'];_0x26b626+=0x1){if(_0x27ae62[_0x26b626][_0x9fba('0x28')]&&_0x27ae62[_0x26b626][_0x9fba('0x29')]){_0x293f04[_0x9fba('0x2a')](_0x27ae62[_0x26b626][_0x9fba('0x28')],_0x27ae62[_0x26b626][_0x9fba('0x29')],_0x27ae62[_0x26b626][_0x9fba('0x2b')]);}}return _0x293f04;}function getSquareProject(_0x2b5f88,_0x189ad0){rpc[_0x9fba('0x2c')](_0x2b5f88)[_0x9fba('0x2d')](function(_0x39286c){_0x189ad0(null,_0x39286c);})[_0x9fba('0x2e')](function(_0x1e7e22){_0x189ad0(null,_0x1e7e22);});}function createSquareReport(_0x3a7a38,_0x1de6ee){rpc[_0x9fba('0x2f')](_0x3a7a38)[_0x9fba('0x2d')](function(_0x2d3453){if(_0x1de6ee){_0x1de6ee(null,_0x2d3453);}})[_0x9fba('0x2e')](function(_0x293f41){if(_0x1de6ee){_0x1de6ee(null,_0x293f41);}});}function setChannelVariables(_0x44f75b){for(var _0x5aaedf in _0x44f75b){if(_0x44f75b[_0x9fba('0x20')](_0x5aaedf)){if(_0x5aaedf[_0x9fba('0x30')](_0x9fba('0x31'))===0x0){_0x44f75b[_0x5aaedf['substring'](0x4)]=_0x44f75b[_0x5aaedf];delete _0x44f75b[_0x5aaedf];}}}}function getLogFromObject(_0x2ff4ff){return util[_0x9fba('0x32')](_0x2ff4ff,{'showHidden':![],'depth':null});}function agiHandler(_0x5279af){var _0x3a34e6,_0x296eba,_0x87fec9,_0x2dc683,_0x13ea3b;logger[_0x9fba('0x33')](_0x9fba('0x34'),JSON['stringify'](_0x5279af,null,0x2));logger[_0x9fba('0xf')](util['format'](_0x9fba('0x35'),_0x5279af[_0x9fba('0x16')],_0x5279af['calleridname'],_0x5279af[_0x9fba('0x18')],_0x5279af[_0x9fba('0x19')],_0x5279af[_0x9fba('0x1a')]));_0x5279af['on'](_0x9fba('0xb'),errorHandler);_0x5279af['on'](_0x9fba('0x36'),closeHandler);_0x5279af['on'](_0x9fba('0x37'),timeoutHandler);_0x5279af['evtHangup']=![];_0x5279af['on'](_0x9fba('0x38'),hangupHandler);var _0x310271=getSquareProject['sync'](null,_0x5279af[_0x9fba('0x16')]);if(_0x310271){if(_0x310271['production']){_0x3a34e6=getRoot(_0x310271[_0x9fba('0x39')]);if(_0x3a34e6&&_0x3a34e6[_0x9fba('0x3a')]){logger[_0x9fba('0x33')](_0x9fba('0x3b'),JSON[_0x9fba('0x3c')](_0x3a34e6,null,0x2));_0x5279af['joinAt']=moment()[_0x9fba('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x296eba=initGraph(_['omit'](_0x3a34e6,_0x9fba('0x25')),_0x3a34e6[_0x9fba('0x25')]);_0x87fec9=new Vertices(_0x5279af,rpc,mailRpc);logger[_0x9fba('0xf')](util[_0x9fba('0x10')](_0x9fba('0x3d'),_0x5279af[_0x9fba('0x16')],_0x5279af[_0x9fba('0x17')],_0x5279af['callerid'],_0x5279af[_0x9fba('0x19')],_0x5279af[_0x9fba('0x1a')]));_0x296eba[_0x9fba('0x3e')](_0x3a34e6[_0x9fba('0x3a')]['id'],function(_0x1e1547){try{_0x1e1547=_0x87fec9[_0x9fba('0x3f')](_0x1e1547);logger['debug'](_0x9fba('0x40'),JSON[_0x9fba('0x3c')](_0x1e1547,null,0x2));if(_0x1e1547[_0x9fba('0x1f')]===_0x9fba('0x41')){logger[_0x9fba('0xf')](_0x9fba('0x42'));_0x5279af[_0x9fba('0x43')]=_0x1e1547['context']||_0x5279af['context'];_0x5279af[_0x9fba('0x44')]=_0x1e1547[_0x9fba('0x44')];_0x5279af[_0x9fba('0x45')]=_0x1e1547['priority']?_0x1e1547[_0x9fba('0x45')]-0x1:0x1;return null;}else if(_0x1e1547&&_0x87fec9[_0x1e1547['agicommand']]){_0x13ea3b=_0x87fec9[_0x1e1547[_0x9fba('0x1f')]](_0x1e1547);logger[_0x9fba('0xf')](_0x9fba('0x46'),JSON[_0x9fba('0x3c')](_0x13ea3b,null,0x2));if(_0x13ea3b&&_0x13ea3b[_0x9fba('0x47')]===AGI_CODE_SUCCESS&&_0x13ea3b['result']!==AGI_RESULT_ERROR&&!_0x5279af[_0x9fba('0x1d')]){logger[_0x9fba('0x33')]('response',getLogFromObject(_0x13ea3b));return _[_0x9fba('0x48')](_0x13ea3b[_0x9fba('0x49')])?null:_0x13ea3b[_0x9fba('0x49')][_0x9fba('0x4a')]();}else{logger['error']('response',getLogFromObject(_0x13ea3b));return null;}}else{logger['error'](_0x9fba('0x4b'));return null;}}catch(_0x590c0c){logger[_0x9fba('0xb')](_0x590c0c[_0x9fba('0xc')]);return null;}});if(_0x3a34e6[_0x9fba('0x4c')]){logger[_0x9fba('0xf')](util[_0x9fba('0x10')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5279af[_0x9fba('0x16')],_0x5279af[_0x9fba('0x17')],_0x5279af[_0x9fba('0x18')],_0x5279af['dnid'],_0x5279af[_0x9fba('0x1a')]));_0x296eba[_0x9fba('0x3e')](_0x3a34e6['finally']['id'],function(_0x125fa2){try{_0x125fa2=_0x87fec9[_0x9fba('0x3f')](_0x125fa2);logger[_0x9fba('0x33')]('vertex',JSON[_0x9fba('0x3c')](_0x125fa2,null,0x2));if(_0x125fa2&&_0x87fec9[_0x125fa2[_0x9fba('0x1f')]]){_0x13ea3b=_0x87fec9[_0x125fa2[_0x9fba('0x1f')]](_0x125fa2);if(_0x13ea3b){logger['debug'](_0x9fba('0x46'),getLogFromObject(_0x13ea3b));return _['isUndefined'](_0x13ea3b[_0x9fba('0x49')])?null:_0x13ea3b[_0x9fba('0x49')][_0x9fba('0x4a')]();}else{logger[_0x9fba('0xb')]('response',getLogFromObject(_0x13ea3b));return null;}}else{logger[_0x9fba('0xb')](_0x9fba('0x4b'));return null;}}catch(_0x587c27){logger[_0x9fba('0xb')](_0x587c27['stack']);return null;}});}logger[_0x9fba('0xf')](util[_0x9fba('0x10')](_0x9fba('0x4d'),_0x5279af['arg_1'],_0x5279af[_0x9fba('0x17')],_0x5279af[_0x9fba('0x18')],_0x5279af[_0x9fba('0x19')],_0x5279af['uniqueid']));logger[_0x9fba('0xf')](util[_0x9fba('0x10')](_0x9fba('0x4e'),_0x5279af[_0x9fba('0x43')],_0x5279af[_0x9fba('0x44')],parseInt(_0x5279af[_0x9fba('0x45')],0xa)+0x1));_0x5279af['continueAt'](_0x5279af[_0x9fba('0x43')],_0x5279af[_0x9fba('0x44')],parseInt(_0x5279af[_0x9fba('0x45')],0xa)+0x1);_0x5279af[_0x9fba('0x36')]();}}else{logger['error'](util['format']('Project\x20%s\x20not\x20published',_0x5279af[_0x9fba('0x16')]));_0x5279af[_0x9fba('0x4f')](_0x5279af[_0x9fba('0x43')],_0x5279af['extension'],parseInt(_0x5279af[_0x9fba('0x45')],0xa)+0x1);_0x5279af[_0x9fba('0x36')]();}}else{logger['error'](util['format'](_0x9fba('0x50'),_0x5279af['arg_1']));_0x5279af[_0x9fba('0x4f')](_0x5279af['context'],_0x5279af['extension'],parseInt(_0x5279af[_0x9fba('0x45')],0xa)+0x1);_0x5279af['close']();}}function main(){var _0xac9bde;return utilLicense['getLicense']()[_0x9fba('0x2d')](function(_0x3edf87){if(_0x3edf87){if(_0x3edf87['voice']){if(_0x3edf87[_0x9fba('0x51')]&&_0x3edf87[_0x9fba('0x51')]>0x0){logger[_0x9fba('0xf')](util[_0x9fba('0x10')](_0x9fba('0x52'),_0x3edf87[_0x9fba('0x51')]));_0xac9bde=_0x3edf87[_0x9fba('0x51')];}else{logger[_0x9fba('0xf')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x9fba('0xf')](_0x9fba('0x53'));_0xac9bde=-0x1;}}})['catch'](function(_0x168ed3){logger[_0x9fba('0xb')](_0x9fba('0x54'),_0x168ed3[_0x9fba('0xc')]);})[_0x9fba('0x4c')](function(){var _0x2f8cb6=require('./server')(config[_0x9fba('0x6')][_0x9fba('0xe')],config[_0x9fba('0x6')]['ip'],_0xac9bde);_0x2f8cb6['on'](_0x9fba('0xb'),errorHandler);_0x2f8cb6['on'](_0x9fba('0x55'),listeningHandler);_0x2f8cb6['on'](_0x9fba('0x56'),connectionHandler);_0x2f8cb6['on'](_0x9fba('0x36'),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 3e63cfc..4161fe5 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 _0xfc13=['sendMailMessage','bluebird','jayson/promise','client','http','error','result','catch'];(function(_0x93a1ab,_0x1f4f00){var _0x215766=function(_0x3b4c7f){while(--_0x3b4c7f){_0x93a1ab['push'](_0x93a1ab['shift']());}};_0x215766(++_0x1f4f00);}(_0xfc13,0x141));var _0x3fc1=function(_0x18c703,_0x2d2ea3){_0x18c703=_0x18c703-0x0;var _0x4cb3c9=_0xfc13[_0x18c703];return _0x4cb3c9;};'use strict';var BPromise=require(_0x3fc1('0x0'));var jayson=require(_0x3fc1('0x1'));var client=jayson[_0x3fc1('0x2')][_0x3fc1('0x3')]({'port':0x232b});function request(_0x53dab1,_0x1694c4){return new BPromise(function(_0x523f09,_0x249374){return client['request'](_0x53dab1,_0x1694c4)['then'](function(_0x5ee416){if(_0x5ee416[_0x3fc1('0x4')]){return _0x249374(_0x5ee416[_0x3fc1('0x4')]['message']);}else{return _0x523f09(_0x5ee416[_0x3fc1('0x5')]);}})[_0x3fc1('0x6')](function(_0x5e8f9b){return _0x249374(_0x5e8f9b);});});}exports[_0x3fc1('0x7')]=function(_0x222932,_0x2f3d36){return request('SendMail',{'account':_0x222932,'message':_0x2f3d36});}; \ No newline at end of file +var _0xd206=['bluebird','jayson/promise','client','http','request','then','error','message','catch','sendMailMessage'];(function(_0x5e8584,_0x4616ca){var _0x987a6b=function(_0x130e33){while(--_0x130e33){_0x5e8584['push'](_0x5e8584['shift']());}};_0x987a6b(++_0x4616ca);}(_0xd206,0xb4));var _0x6d20=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xd206[_0x42bdad];return _0x122626;};'use strict';var BPromise=require(_0x6d20('0x0'));var jayson=require(_0x6d20('0x1'));var client=jayson[_0x6d20('0x2')][_0x6d20('0x3')]({'port':0x232b});function request(_0x114613,_0x36659a){return new BPromise(function(_0x5e0d0e,_0x5bbdf7){return client[_0x6d20('0x4')](_0x114613,_0x36659a)[_0x6d20('0x5')](function(_0x5827aa){if(_0x5827aa[_0x6d20('0x6')]){return _0x5bbdf7(_0x5827aa[_0x6d20('0x6')][_0x6d20('0x7')]);}else{return _0x5e0d0e(_0x5827aa['result']);}})[_0x6d20('0x8')](function(_0x52abd3){return _0x5bbdf7(_0x52abd3);});});}exports[_0x6d20('0x9')]=function(_0x4c490c,_0x213149){return request('SendMail',{'account':_0x4c490c,'message':_0x213149});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index d968eb7..50e7569 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 _0xa130=['_inBody','\x0d\x0a\x0d\x0a','toString','indexOf','substring','split','slice','trim','length','emit','line','util','stream','Transform','call','_localBuffer'];(function(_0x4d3517,_0x185552){var _0x31ed16=function(_0x5c88cc){while(--_0x5c88cc){_0x4d3517['push'](_0x4d3517['shift']());}};_0x31ed16(++_0x185552);}(_0xa130,0x1cb));var _0x0a13=function(_0xa322b1,_0x460c8e){_0xa322b1=_0xa322b1-0x0;var _0x34f62c=_0xa130[_0xa322b1];return _0x34f62c;};'use strict';var util=require(_0x0a13('0x0'));var Transform=require(_0x0a13('0x1'))[_0x0a13('0x2')];function AGIReply(_0x451c08){Transform[_0x0a13('0x3')](this,_0x451c08);this[_0x0a13('0x4')]='';this[_0x0a13('0x5')]=![];}util['inherits'](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x50267e,_0x2aa5eb,_0x3f3523){var _0x12a8aa='\x0a',_0x4e4261=['\x0a\x0a',_0x0a13('0x6')],_0x53b261=-0x1,_0x3b1d82=-0x1,_0x29414c='',_0x48eab0=0x0,_0x55dfc9='',_0x236c40='';this[_0x0a13('0x4')]+=_0x50267e[_0x0a13('0x7')]();_0x55dfc9=this[_0x0a13('0x4')];if(!this['_inBody']){_0x48eab0=0x0;while(_0x4e4261[_0x48eab0]){while((_0x3b1d82=_0x55dfc9[_0x0a13('0x8')](_0x4e4261[_0x48eab0]))!=-0x1){_0x29414c=_0x4e4261[_0x48eab0];_0x236c40=_0x55dfc9[_0x0a13('0x9')](0x0,_0x3b1d82);_0x55dfc9=_0x55dfc9[_0x0a13('0x9')](_0x3b1d82+_0x29414c['length']);var _0x2cb27e=_0x236c40[_0x0a13('0xa')](_0x12a8aa),_0x27108e=0x0,_0x458f3b={},_0x422d4e='',_0xbc59bd='',_0x28b698=-0x1;while(_0x2cb27e[_0x27108e]){_0x28b698=_0x2cb27e[_0x27108e][_0x0a13('0x8')](':');if(_0x28b698!=-0x1){_0x422d4e=_0x2cb27e[_0x27108e][_0x0a13('0xb')](0x0,_0x28b698)[_0x0a13('0xc')]();_0xbc59bd=_0x2cb27e[_0x27108e][_0x0a13('0xb')](_0x28b698+0x1)[_0x0a13('0xc')]();if(_0x422d4e[_0x0a13('0xd')]>0x0){_0x458f3b[_0x422d4e]=_0xbc59bd;}}else{}_0x27108e++;}this['emit']('headers',_0x458f3b);this[_0x0a13('0x5')]=!![];}_0x48eab0++;}this['_localBuffer']=_0x55dfc9;}else{while((_0x53b261=_0x55dfc9[_0x0a13('0x8')](_0x12a8aa))!=-0x1){_0x236c40=_0x55dfc9[_0x0a13('0x9')](0x0,_0x53b261);this[_0x0a13('0xe')](_0x0a13('0xf'),_0x236c40);_0x55dfc9=_0x55dfc9[_0x0a13('0x9')](_0x53b261+_0x12a8aa[_0x0a13('0xd')]);}this[_0x0a13('0x4')]=_0x55dfc9;}_0x3f3523();};module['exports']=AGIReply; \ No newline at end of file +var _0x5712=['util','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','slice','trim','emit','headers','exports'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x5712,0x140));var _0x2571=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x5712[_0x3bf83f];return _0x22c4a9;};'use strict';var util=require(_0x2571('0x0'));var Transform=require(_0x2571('0x1'))[_0x2571('0x2')];function AGIReply(_0x2e56c3){Transform[_0x2571('0x3')](this,_0x2e56c3);this[_0x2571('0x4')]='';this[_0x2571('0x5')]=![];}util[_0x2571('0x6')](AGIReply,Transform);AGIReply[_0x2571('0x7')][_0x2571('0x8')]=function(_0x53f883,_0x49d593,_0x4713ad){var _0x50fc72='\x0a',_0x3e19b2=['\x0a\x0a',_0x2571('0x9')],_0x251ee6=-0x1,_0x3ca885=-0x1,_0x204ecc='',_0xda659a=0x0,_0x26355f='',_0x4b5bde='';this['_localBuffer']+=_0x53f883[_0x2571('0xa')]();_0x26355f=this[_0x2571('0x4')];if(!this[_0x2571('0x5')]){_0xda659a=0x0;while(_0x3e19b2[_0xda659a]){while((_0x3ca885=_0x26355f[_0x2571('0xb')](_0x3e19b2[_0xda659a]))!=-0x1){_0x204ecc=_0x3e19b2[_0xda659a];_0x4b5bde=_0x26355f[_0x2571('0xc')](0x0,_0x3ca885);_0x26355f=_0x26355f[_0x2571('0xc')](_0x3ca885+_0x204ecc[_0x2571('0xd')]);var _0x1026bc=_0x4b5bde[_0x2571('0xe')](_0x50fc72),_0x512039=0x0,_0x5a8615={},_0x33d3ed='',_0x1ab846='',_0x10823d=-0x1;while(_0x1026bc[_0x512039]){_0x10823d=_0x1026bc[_0x512039][_0x2571('0xb')](':');if(_0x10823d!=-0x1){_0x33d3ed=_0x1026bc[_0x512039][_0x2571('0xf')](0x0,_0x10823d)[_0x2571('0x10')]();_0x1ab846=_0x1026bc[_0x512039][_0x2571('0xf')](_0x10823d+0x1)[_0x2571('0x10')]();if(_0x33d3ed[_0x2571('0xd')]>0x0){_0x5a8615[_0x33d3ed]=_0x1ab846;}}else{}_0x512039++;}this[_0x2571('0x11')](_0x2571('0x12'),_0x5a8615);this['_inBody']=!![];}_0xda659a++;}this[_0x2571('0x4')]=_0x26355f;}else{while((_0x251ee6=_0x26355f['indexOf'](_0x50fc72))!=-0x1){_0x4b5bde=_0x26355f['substring'](0x0,_0x251ee6);this['emit']('line',_0x4b5bde);_0x26355f=_0x26355f[_0x2571('0xc')](_0x251ee6+_0x50fc72[_0x2571('0xd')]);}this[_0x2571('0x4')]=_0x26355f;}_0x4713ad();};module[_0x2571('0x13')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index dadbc08..80c6811 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 _0x38d1=['createCmContact','ShowCmHopper','phone','ListId','getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','agentUnpause','agentLogout','LogoutUser','bluebird','client','http','request','then','error','message','result','ShowSquareProject','ShowMailAccount','MailServerOut','email','getSquareProjectById','name','getVoiceQueueById','ShowVoiceQueue','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getTrunkById','getSoundById','ShowSound','save_name','getIntervalById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage'];(function(_0x29b2d0,_0x73bf4b){var _0x4af937=function(_0x1b19c9){while(--_0x1b19c9){_0x29b2d0['push'](_0x29b2d0['shift']());}};_0x4af937(++_0x73bf4b);}(_0x38d1,0x16a));var _0x138d=function(_0x19f481,_0x389920){_0x19f481=_0x19f481-0x0;var _0x539279=_0x38d1[_0x19f481];return _0x539279;};'use strict';var BPromise=require(_0x138d('0x0'));var moment=require('moment');var _=require('lodash');var util=require('util');var jayson=require('jayson/promise');var client=jayson[_0x138d('0x1')][_0x138d('0x2')]({'port':0x2329});function request(_0x729414,_0x162683){return new BPromise(function(_0x2ef5c1,_0xe2bccc){return client[_0x138d('0x3')](_0x729414,_0x162683)[_0x138d('0x4')](function(_0x15f1fa){if(_0x15f1fa[_0x138d('0x5')]){return _0xe2bccc(_0x15f1fa[_0x138d('0x5')][_0x138d('0x6')]);}else{return _0x2ef5c1(_0x15f1fa[_0x138d('0x7')]);}})['catch'](function(_0x28cadb){return _0xe2bccc(_0x28cadb);});});}exports['getSquareProject']=function(_0x95dd61){return request(_0x138d('0x8'),{'options':{'raw':![],'where':{'name':_0x95dd61},'attributes':['production']}});};exports['getMailAccountById']=function(_0x43a929){return request(_0x138d('0x9'),{'options':{'raw':![],'where':{'id':_0x43a929},'include':[{'model':_0x138d('0xa'),'as':'Smtp'}],'attributes':['id','name',_0x138d('0xb')]}});};exports[_0x138d('0xc')]=function(_0x4cad5a){return request(_0x138d('0x8'),{'options':{'where':{'id':_0x4cad5a},'attributes':[_0x138d('0xd')]}});};exports[_0x138d('0xe')]=function(_0x4d5f54){return request(_0x138d('0xf'),{'options':{'where':{'id':_0x4d5f54},'attributes':['name']}});};exports['getVariableById']=function(_0x283c2e){return request('ShowVariable',{'options':{'where':{'id':_0x283c2e},'attributes':['name']}});};exports[_0x138d('0x10')]=function(_0x4714ed){return request(_0x138d('0x11'),{'options':{'where':{'id':_0x4714ed},'attributes':[_0x138d('0x12')]}});};exports[_0x138d('0x13')]=function(_0x5209d5){return request(_0x138d('0x14'),{'options':{'where':{'id':_0x5209d5},'attributes':[_0x138d('0xd')]}});};exports[_0x138d('0x15')]=function(_0x5888a6){return request('ShowTrunk',{'options':{'where':{'id':_0x5888a6},'attributes':[_0x138d('0xd')]}});};exports[_0x138d('0x16')]=function(_0x20a302){return request(_0x138d('0x17'),{'options':{'where':{'id':_0x20a302},'attributes':[_0x138d('0x18')]}});};exports[_0x138d('0x19')]=function(_0x3c9f66){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x3c9f66},'include':[{'model':'Interval','as':'Intervals'}]}});};exports['getSmsAccountById']=function(_0x36c047){return request(_0x138d('0x1a'),{'options':{'where':{'id':_0x36c047},'attributes':['id',_0x138d('0xd')]}});};exports[_0x138d('0x1b')]=function(_0x143cf0){return request('CreateSmsMessage',{'body':_0x143cf0});};exports[_0x138d('0x1c')]=function(_0x41527e){return request(_0x138d('0x1d'),{'body':_0x41527e});};exports[_0x138d('0x1e')]=function(_0xb78d8c){return request(_0x138d('0x1f'),{'body':_['merge'](_0xb78d8c,{'project_name':_0xb78d8c[_0x138d('0x20')],'prev_project_name':_0xb78d8c[_0x138d('0x21')]||'','is_subproject':_0xb78d8c['arg_2']?!![]:![],'leaveAt':moment()[_0x138d('0x22')](_0x138d('0x23'))})});};exports[_0x138d('0x24')]=function(_0x49235d){return request('CreateSquareRecording',{'body':_0x49235d});};exports[_0x138d('0x25')]=function(_0x54e019){return request('CreateSquareMessage',{'body':_0x54e019});};exports[_0x138d('0x26')]=function(_0x5a65d6){return request(_0x138d('0x27'),{'options':{'raw':![],'where':{'phone':_0x5a65d6[_0x138d('0x28')],'ListId':_0x5a65d6[_0x138d('0x29')]}}})['then'](function(_0x944f70){if(_0x944f70){return _0x944f70;}return request('CreateCmContact',{'body':_0x5a65d6});});};exports[_0x138d('0x2a')]=function(_0x169d9a){return request(_0x138d('0x2b'),{'options':{'where':{'id':_0x169d9a},'attributes':[_0x138d('0xd')]}});};exports[_0x138d('0x2c')]=function(_0x1a5cfa,_0x310f86){return request(_0x138d('0x2d'),{'body':{'interface':_0x310f86},'options':{'where':_0x1a5cfa}});};exports['agentPause']=function(_0x1914de,_0x54ff6a,_0x31346a){return request(_0x138d('0x2e'),{'body':{'type':_0x54ff6a,'uniqueid':_0x31346a},'options':{'where':_0x1914de}});};exports[_0x138d('0x2f')]=function(_0x51d726){return request('UnpauseUser',{'body':{},'options':{'where':_0x51d726}});};exports[_0x138d('0x30')]=function(_0x31c745){return request(_0x138d('0x31'),{'body':{},'options':{'where':_0x31c745}});}; \ No newline at end of file +var _0xd6c3=['ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','email','getSquareProjectById','name','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','save_name','getIntervalById','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','bluebird','util','jayson/promise','client','http','request','then','error','message','result','getSquareProject'];(function(_0x439a35,_0x568884){var _0x4e59e0=function(_0x755e7b){while(--_0x755e7b){_0x439a35['push'](_0x439a35['shift']());}};_0x4e59e0(++_0x568884);}(_0xd6c3,0xe1));var _0x3d6c=function(_0x8fcff8,_0x1966d9){_0x8fcff8=_0x8fcff8-0x0;var _0x4150a6=_0xd6c3[_0x8fcff8];return _0x4150a6;};'use strict';var BPromise=require(_0x3d6c('0x0'));var moment=require('moment');var _=require('lodash');var util=require(_0x3d6c('0x1'));var jayson=require(_0x3d6c('0x2'));var client=jayson[_0x3d6c('0x3')][_0x3d6c('0x4')]({'port':0x2329});function request(_0x14219a,_0x63bb75){return new BPromise(function(_0x5e085b,_0x138e0c){return client[_0x3d6c('0x5')](_0x14219a,_0x63bb75)[_0x3d6c('0x6')](function(_0x3b7647){if(_0x3b7647[_0x3d6c('0x7')]){return _0x138e0c(_0x3b7647[_0x3d6c('0x7')][_0x3d6c('0x8')]);}else{return _0x5e085b(_0x3b7647[_0x3d6c('0x9')]);}})['catch'](function(_0xd78816){return _0x138e0c(_0xd78816);});});}exports[_0x3d6c('0xa')]=function(_0x451527){return request(_0x3d6c('0xb'),{'options':{'raw':![],'where':{'name':_0x451527},'attributes':[_0x3d6c('0xc')]}});};exports[_0x3d6c('0xd')]=function(_0x5d5c6f){return request(_0x3d6c('0xe'),{'options':{'raw':![],'where':{'id':_0x5d5c6f},'include':[{'model':_0x3d6c('0xf'),'as':_0x3d6c('0x10')}],'attributes':['id','name',_0x3d6c('0x11')]}});};exports[_0x3d6c('0x12')]=function(_0x14757c){return request(_0x3d6c('0xb'),{'options':{'where':{'id':_0x14757c},'attributes':[_0x3d6c('0x13')]}});};exports[_0x3d6c('0x14')]=function(_0xe36c21){return request('ShowVoiceQueue',{'options':{'where':{'id':_0xe36c21},'attributes':['name']}});};exports[_0x3d6c('0x15')]=function(_0x167740){return request(_0x3d6c('0x16'),{'options':{'where':{'id':_0x167740},'attributes':[_0x3d6c('0x13')]}});};exports[_0x3d6c('0x17')]=function(_0x2cbc82){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x2cbc82},'attributes':[_0x3d6c('0x18')]}});};exports[_0x3d6c('0x19')]=function(_0x3d17d0){return request(_0x3d6c('0x1a'),{'options':{'where':{'id':_0x3d17d0},'attributes':[_0x3d6c('0x13')]}});};exports[_0x3d6c('0x1b')]=function(_0x5af434){return request(_0x3d6c('0x1c'),{'options':{'where':{'id':_0x5af434},'attributes':[_0x3d6c('0x13')]}});};exports[_0x3d6c('0x1d')]=function(_0x3deb6f){return request('ShowSound',{'options':{'where':{'id':_0x3deb6f},'attributes':[_0x3d6c('0x1e')]}});};exports[_0x3d6c('0x1f')]=function(_0x120679){return request(_0x3d6c('0x20'),{'options':{'raw':![],'where':{'id':_0x120679},'include':[{'model':'Interval','as':_0x3d6c('0x21')}]}});};exports[_0x3d6c('0x22')]=function(_0xca8298){return request(_0x3d6c('0x23'),{'options':{'where':{'id':_0xca8298},'attributes':['id',_0x3d6c('0x13')]}});};exports[_0x3d6c('0x24')]=function(_0x16b3a8){return request(_0x3d6c('0x25'),{'body':_0x16b3a8});};exports[_0x3d6c('0x26')]=function(_0x6115b9){return request(_0x3d6c('0x27'),{'body':_0x6115b9});};exports[_0x3d6c('0x28')]=function(_0x30b02c){return request(_0x3d6c('0x29'),{'body':_[_0x3d6c('0x2a')](_0x30b02c,{'project_name':_0x30b02c[_0x3d6c('0x2b')],'prev_project_name':_0x30b02c[_0x3d6c('0x2c')]||'','is_subproject':_0x30b02c[_0x3d6c('0x2c')]?!![]:![],'leaveAt':moment()[_0x3d6c('0x2d')](_0x3d6c('0x2e'))})});};exports[_0x3d6c('0x2f')]=function(_0xd69f0d){return request('CreateSquareRecording',{'body':_0xd69f0d});};exports[_0x3d6c('0x30')]=function(_0x58b0a7){return request('CreateSquareMessage',{'body':_0x58b0a7});};exports[_0x3d6c('0x31')]=function(_0x251897){return request(_0x3d6c('0x32'),{'options':{'raw':![],'where':{'phone':_0x251897[_0x3d6c('0x33')],'ListId':_0x251897[_0x3d6c('0x34')]}}})[_0x3d6c('0x6')](function(_0x51b821){if(_0x51b821){return _0x51b821;}return request(_0x3d6c('0x35'),{'body':_0x251897});});};exports[_0x3d6c('0x36')]=function(_0x4a3c99){return request(_0x3d6c('0x37'),{'options':{'where':{'id':_0x4a3c99},'attributes':[_0x3d6c('0x13')]}});};exports[_0x3d6c('0x38')]=function(_0x14751c,_0x5880f7){return request(_0x3d6c('0x39'),{'body':{'interface':_0x5880f7},'options':{'where':_0x14751c}});};exports['agentPause']=function(_0x3013c7,_0x4a11ae,_0x7457d9){return request(_0x3d6c('0x3a'),{'body':{'type':_0x4a11ae,'uniqueid':_0x7457d9},'options':{'where':_0x3013c7}});};exports['agentUnpause']=function(_0x25b5c5){return request('UnpauseUser',{'body':{},'options':{'where':_0x25b5c5}});};exports['agentLogout']=function(_0x42a1d5){return request('LogoutUser',{'body':{},'options':{'where':_0x42a1d5}});}; \ 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 28cfe96..7230651 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 polly=require('./polly');var lex=require('./lex');module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x36b2=['./lex','exports','./polly'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x36b2,0x6b));var _0x236b=function(_0x4097ed,_0x348343){_0x4097ed=_0x4097ed-0x0;var _0x4a8759=_0x36b2[_0x4097ed];return _0x4a8759;};var polly=require(_0x236b('0x0'));var lex=require(_0x236b('0x1'));module[_0x236b('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index a21fc37..92a4d13 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','./lib/api'];(function(_0xf36a9a,_0x4c7dd1){var _0x296cd3=function(_0x1dd5fa){while(--_0x1dd5fa){_0xf36a9a['push'](_0xf36a9a['shift']());}};_0x296cd3(++_0x4c7dd1);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var lex=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]=function(_0x5a55a3,_0x585166,_0x4b72b0,_0x3ff8df,_0x5b9b89,_0x43bca1){return lex(_0x5a55a3,_0x585166,_0x4b72b0,_0x3ff8df,_0x5b9b89,_0x43bca1);}; \ No newline at end of file +var _0xd64b=['./lib/api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd64b,0xc1));var _0xbd64=function(_0xced98a,_0x5cb79a){_0xced98a=_0xced98a-0x0;var _0x2055db=_0xd64b[_0xced98a];return _0x2055db;};'use strict';var lex=require(_0xbd64('0x0'));module['exports']=function(_0xf0de04,_0x4bfb7c,_0x30b9b3,_0xcbecd5,_0x64bd3b,_0x3f1f05){return lex(_0xf0de04,_0x4bfb7c,_0x30b9b3,_0xcbecd5,_0x64bd3b,_0x3f1f05);}; \ 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 cac5d49..2f65b38 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(_0x221eaa,_0x23e9ce){var _0x4a8ec0=function(_0x380d85){while(--_0x380d85){_0x221eaa['push'](_0x221eaa['shift']());}};_0x4a8ec0(++_0x23e9ce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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(_0x10b7a5,_0x5f4c65){var _0x5dbc8e=function(_0x3ad144){while(--_0x3ad144){_0x10b7a5['push'](_0x10b7a5['shift']());}};_0x5dbc8e(++_0x5f4c65);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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 ccaf9f3..c679efc 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 _0x47f8=['exports'];(function(_0x2b3795,_0x573293){var _0x34291a=function(_0x42fc27){while(--_0x42fc27){_0x2b3795['push'](_0x2b3795['shift']());}};_0x34291a(++_0x573293);}(_0x47f8,0x1f2));var _0x847f=function(_0x39b6aa,_0x4b2402){_0x39b6aa=_0x39b6aa-0x0;var _0x19f6d3=_0x47f8[_0x39b6aa];return _0x19f6d3;};'use strict';var polly=require('./lib/api');module[_0x847f('0x0')]=function(_0x48dc1b,_0x4e44f8,_0x1c88cf,_0x39fed2,_0xa47ca2,_0x294acc,_0x37db61){return polly(_0x48dc1b,_0x4e44f8,_0x1c88cf,_0x39fed2,_0xa47ca2,_0x294acc,_0x37db61);}; \ No newline at end of file +var _0xb889=['exports','./lib/api'];(function(_0x3dbe83,_0x4e82a1){var _0x42931f=function(_0x54d04c){while(--_0x54d04c){_0x3dbe83['push'](_0x3dbe83['shift']());}};_0x42931f(++_0x4e82a1);}(_0xb889,0xbf));var _0x9b88=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0xb889[_0xc8a931];return _0x28bd27;};'use strict';var polly=require(_0x9b88('0x0'));module[_0x9b88('0x1')]=function(_0x3d2dc1,_0x1ca003,_0x4a6ba2,_0x353239,_0x14105f,_0x5e1b65,_0x302efb){return polly(_0x3d2dc1,_0x1ca003,_0x4a6ba2,_0x353239,_0x14105f,_0x5e1b65,_0x302efb);}; \ 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 3085e67..4aca05c 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 _0xffb6=['Polly','text','mp3','aws-sdk','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x5ccf68,_0x3a51cf){var _0x1ba6c8=function(_0x5121e2){while(--_0x5121e2){_0x5ccf68['push'](_0x5ccf68['shift']());}};_0x1ba6c8(++_0x3a51cf);}(_0xffb6,0xcb));var _0x6ffb=function(_0x1cd599,_0x53ddb2){_0x1cd599=_0x1cd599-0x0;var _0x10acbd=_0xffb6[_0x1cd599];return _0x10acbd;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require('bluebird');var rs=require('randomstring');var AWS=require(_0x6ffb('0x0'));function pollyResult(_0x2b4b0b,_0x44e148,_0x1facd3){return new BPromise(function(_0x2e52e9,_0x533d9f){_0x2b4b0b['synthesizeSpeech'](_0x44e148,function(_0x1ab0a2,_0x211285){if(_0x1ab0a2){_0x533d9f(_0x1ab0a2);}else if(_0x211285){if(_0x211285[_0x6ffb('0x1')]instanceof Buffer){fs[_0x6ffb('0x2')](_0x1facd3,_0x211285[_0x6ffb('0x1')],function(_0x5b4144){if(_0x5b4144){_0x533d9f(_0x5b4144);}else{_0x2e52e9();}});}else{_0x533d9f(new Error(_0x6ffb('0x3')));}}else{_0x533d9f(new Error(_0x6ffb('0x4')));}});});}module['exports']=function(_0x3010fc,_0x4c1dce,_0x3e50bb,_0x33293d,_0x2f8a5a,_0xd59a22,_0x4c321b){var _0x38205b=new AWS[(_0x6ffb('0x5'))]({'accessKeyId':_0x3010fc,'secretAccessKey':_0x4c1dce,'region':_0x3e50bb});var _0x37501d={'Text':_0x2f8a5a,'TextType':_0xd59a22||_0x6ffb('0x6'),'OutputFormat':_0x6ffb('0x7'),'VoiceId':_0x33293d};return pollyResult(_0x38205b,_0x37501d,_0x4c321b);}; \ No newline at end of file +var _0xe9c1=['No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird','synthesizeSpeech','AudioStream'];(function(_0x71ef8b,_0x393646){var _0x158eb2=function(_0x5526c2){while(--_0x5526c2){_0x71ef8b['push'](_0x71ef8b['shift']());}};_0x158eb2(++_0x393646);}(_0xe9c1,0x95));var _0x1e9c=function(_0x1858a2,_0x16d97a){_0x1858a2=_0x1858a2-0x0;var _0x313ac5=_0xe9c1[_0x1858a2];return _0x313ac5;};'use strict';var fs=require('fs');var path=require(_0x1e9c('0x0'));var BPromise=require(_0x1e9c('0x1'));var rs=require('randomstring');var AWS=require('aws-sdk');function pollyResult(_0x49d538,_0x4912d7,_0x48f40d){return new BPromise(function(_0x28ced4,_0x170043){_0x49d538[_0x1e9c('0x2')](_0x4912d7,function(_0x275fe7,_0x47e13d){if(_0x275fe7){_0x170043(_0x275fe7);}else if(_0x47e13d){if(_0x47e13d[_0x1e9c('0x3')]instanceof Buffer){fs['writeFile'](_0x48f40d,_0x47e13d[_0x1e9c('0x3')],function(_0x186436){if(_0x186436){_0x170043(_0x186436);}else{_0x28ced4();}});}else{_0x170043(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x170043(new Error(_0x1e9c('0x4')));}});});}module[_0x1e9c('0x5')]=function(_0x17353e,_0x5d04cd,_0x3bb2ae,_0x4d11a2,_0x5067e2,_0xc9155f,_0x5ea0fe){var _0x432708=new AWS[(_0x1e9c('0x6'))]({'accessKeyId':_0x17353e,'secretAccessKey':_0x5d04cd,'region':_0x3bb2ae});var _0x9b95d0={'Text':_0x5067e2,'TextType':_0xc9155f||_0x1e9c('0x7'),'OutputFormat':_0x1e9c('0x8'),'VoiceId':_0x4d11a2};return pollyResult(_0x432708,_0x9b95d0,_0x5ea0fe);}; \ 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 4d4df8b..8272b9d 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 _0x38b9=['./lib/api','exports'];(function(_0x3daee5,_0x4674b1){var _0x5ab584=function(_0x2ff1c6){while(--_0x2ff1c6){_0x3daee5['push'](_0x3daee5['shift']());}};_0x5ab584(++_0x4674b1);}(_0x38b9,0x18a));var _0x938b=function(_0x3a77be,_0x2cd9a3){_0x3a77be=_0x3a77be-0x0;var _0x17a50b=_0x38b9[_0x3a77be];return _0x17a50b;};'use strict';var asr=require(_0x938b('0x0'));module[_0x938b('0x1')]=function(_0x12e09f,_0x39ce65,_0x3a2060,_0x52bffc){return asr(_0x12e09f,_0x39ce65,_0x3a2060);}; \ No newline at end of file +'use strict';var asr=require('./lib/api');module['exports']=function(_0x2d19d3,_0x2407bf,_0x138e57,_0x3610fb){return asr(_0x2d19d3,_0x2407bf,_0x138e57);}; \ 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 ee37220..0cbd8f5 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 _0x073e=['undefined','readFileSync','toString','base64','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string','length','key\x20should\x20be\x20a\x20string'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x073e,0x181));var _0xe073=function(_0x4dd943,_0x5f379e){_0x4dd943=_0x4dd943-0x0;var _0x4e06ee=_0x073e[_0x4dd943];return _0x4e06ee;};'use strict';var url=require(_0xe073('0x0'));var BPromise=require(_0xe073('0x1'));var fs=require('fs');var host=_0xe073('0x2');module[_0xe073('0x3')]=function(_0x4a6f42,_0x488838,_0x4e8df8){return new BPromise(function(_0x3eff57,_0x4534b6){var _0x29444b;if(typeof _0x4a6f42!=='string'||_0x4a6f42['length']===0x0){return _0x4534b6('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x488838!==_0xe073('0x4')||_0x488838[_0xe073('0x5')]===0x0){return _0x4534b6(_0xe073('0x6'));}if(typeof _0x4e8df8!==_0xe073('0x7')&&(typeof _0x4e8df8!==_0xe073('0x4')||_0x4e8df8[_0xe073('0x5')]===0x0)){return _0x4534b6('lang\x20should\x20be\x20a\x20string');}try{_0x29444b=fs[_0xe073('0x8')](_0x4a6f42)[_0xe073('0x9')](_0xe073('0xa'));}catch(_0x118048){return _0x4534b6(_0x118048);}return _0x3eff57({'method':'POST','uri':host+_0xe073('0xb')+_0x488838,'body':{'config':{'encoding':_0xe073('0xc'),'sampleRateHertz':_0xe073('0xd'),'languageCode':_0x4e8df8},'audio':{'content':_0x29444b}},'json':!![]});});}; \ No newline at end of file +var _0x9c5e=['LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','length','filepath\x20should\x20be\x20a\x20string','string','undefined','lang\x20should\x20be\x20a\x20string','base64','POST','/v1/speech:recognize?key='];(function(_0x56ebe7,_0x1b57d0){var _0x4e9760=function(_0x509207){while(--_0x509207){_0x56ebe7['push'](_0x56ebe7['shift']());}};_0x4e9760(++_0x1b57d0);}(_0x9c5e,0x9c));var _0xe9c5=function(_0x36ad5a,_0x5e57d4){_0x36ad5a=_0x36ad5a-0x0;var _0x121899=_0x9c5e[_0x36ad5a];return _0x121899;};'use strict';var url=require(_0xe9c5('0x0'));var BPromise=require(_0xe9c5('0x1'));var fs=require('fs');var host=_0xe9c5('0x2');module[_0xe9c5('0x3')]=function(_0x2ce33e,_0x5a6ce5,_0x51e921){return new BPromise(function(_0x595373,_0x120d2f){var _0x13d5d7;if(typeof _0x2ce33e!=='string'||_0x2ce33e[_0xe9c5('0x4')]===0x0){return _0x120d2f(_0xe9c5('0x5'));}if(typeof _0x5a6ce5!==_0xe9c5('0x6')||_0x5a6ce5[_0xe9c5('0x4')]===0x0){return _0x120d2f('key\x20should\x20be\x20a\x20string');}if(typeof _0x51e921!==_0xe9c5('0x7')&&(typeof _0x51e921!==_0xe9c5('0x6')||_0x51e921[_0xe9c5('0x4')]===0x0)){return _0x120d2f(_0xe9c5('0x8'));}try{_0x13d5d7=fs['readFileSync'](_0x2ce33e)['toString'](_0xe9c5('0x9'));}catch(_0x322bc4){return _0x120d2f(_0x322bc4);}return _0x595373({'method':_0xe9c5('0xa'),'uri':host+_0xe9c5('0xb')+_0x5a6ce5,'body':{'config':{'encoding':_0xe9c5('0xc'),'sampleRateHertz':_0xe9c5('0xd'),'languageCode':_0x51e921},'audio':{'content':_0x13d5d7}},'json':!![]});});}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/index.js b/server/services/agi/scripts/google/index.js index 10cb4be..91fae55 100644 --- a/server/services/agi/scripts/google/index.js +++ b/server/services/agi/scripts/google/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file +var _0xc655=['./asr','exports'];(function(_0x5371a6,_0x28c6d0){var _0x57840e=function(_0x55f225){while(--_0x55f225){_0x5371a6['push'](_0x5371a6['shift']());}};_0x57840e(++_0x28c6d0);}(_0xc655,0x1ac));var _0x5c65=function(_0x26c0c7,_0xa1821d){_0x26c0c7=_0x26c0c7-0x0;var _0x41f574=_0xc655[_0x26c0c7];return _0x41f574;};var asr=require(_0x5c65('0x0'));module[_0x5c65('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 c8d4ba9..7aebbad 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 _0x2668=['info','finish\x20download\x20file','error','unlink','download\x20error','pipe','end','https:','host','transcode','wav','error\x20convert','finish\x20to\x20convert','resolve','tmp','generate','writeFileSync','base64','then','chmodSync','777','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','voice','audioConfig','MP3','POST','from','writeFile','.wav','googleCloudTTS\x20path','split','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','data','length','lang\x20\x22','\x22\x20might\x20not\x20exist','.mp3','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','name','result','source','resolvedQuery','action','fulfillment','speech','score','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','queryResult','diagnosticInfo','fields','end_conversation','boolValue','intent','displayName','languageCode','queryText','responseId','fulfillmentText','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','apiai-promise','bluebird','http','https','md5','path','querystring','request-promise','randomstring','parse','./google','./sestek','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','protocol','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish'];(function(_0x52f80b,_0xcf9bb7){var _0x175020=function(_0x100fe6){while(--_0x100fe6){_0x52f80b['push'](_0x52f80b['shift']());}};_0x175020(++_0xcf9bb7);}(_0x2668,0xee));var _0x8266=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x2668[_0x34843e];return _0x598f7f;};'use strict';var apiai=require(_0x8266('0x0'));var BPromise=require(_0x8266('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x8266('0x2'));var https=require(_0x8266('0x3'));var md5=require(_0x8266('0x4'));var path=require(_0x8266('0x5'));var querystring=require(_0x8266('0x6'));var rp=require(_0x8266('0x7'));var rs=require(_0x8266('0x8'));var sox=require('sox');var tts=require('google-tts-api');var urlParse=require('url')[_0x8266('0x9')];var util=require('util');var aws=require('./aws');var google=require(_0x8266('0xa'));var sestek=require(_0x8266('0xb'));var tilde=require(_0x8266('0xc'));var logger=require(_0x8266('0xd'))('agi');var ISPEECH_API=_0x8266('0xe');function downloadFile(_0x331a24,_0x365a90){return new BPromise(function(_0x412f43,_0x5dd609){var _0x232649=urlParse(_0x331a24);var _0x2a912f=_0x232649[_0x8266('0xf')]==='https:'?https:http;var _0x33122f={'host':_0x232649['host'],'path':_0x232649[_0x8266('0x5')],'headers':{'user-agent':_0x8266('0x10')}};_0x2a912f[_0x8266('0x11')](_0x33122f,function(_0x19e048){if(_0x19e048[_0x8266('0x12')]!==0xc8){logger['error'](_0x8266('0x13')+_0x331a24+_0x8266('0x14')+_0x19e048[_0x8266('0x12')]+'\x20('+_0x19e048[_0x8266('0x15')]+')');_0x5dd609(new Error(_0x8266('0x13')+_0x331a24+_0x8266('0x14')+_0x19e048[_0x8266('0x12')]+'\x20('+_0x19e048[_0x8266('0x15')]+')'));return;}var _0x297ec5=fs[_0x8266('0x16')](_0x365a90);_0x297ec5['on'](_0x8266('0x17'),function(){logger[_0x8266('0x18')](_0x8266('0x19'));_0x297ec5['close'](_0x412f43);});_0x297ec5['on'](_0x8266('0x1a'),function(_0xf2e508){fs[_0x8266('0x1b')](_0x365a90);logger[_0x8266('0x1a')](_0x8266('0x1c'),_0xf2e508);_0x5dd609(_0xf2e508);});_0x19e048[_0x8266('0x1d')](_0x297ec5);})['on']('error',function(_0x2a9f26){logger[_0x8266('0x1a')](_0x2a9f26);_0x5dd609(_0x2a9f26);})[_0x8266('0x1e')]();});}function uploadFile(_0x151fa8){return new BPromise(function(_0x582d81,_0x13be40){var _0x23dc28=urlParse(_0x151fa8);var _0x48b872=_0x23dc28[_0x8266('0xf')]===_0x8266('0x1f')?https:http;var _0x284f72={'host':_0x23dc28[_0x8266('0x20')],'path':_0x23dc28[_0x8266('0x5')],'headers':{'user-agent':_0x8266('0x10')}};_0x48b872[_0x8266('0x11')](_0x284f72,function(_0x4cb137){if(_0x4cb137[_0x8266('0x12')]!==0xc8){_0x13be40(new Error(_0x8266('0x13')+_0x151fa8+'\x20failed,\x20status\x20code\x20=\x20'+_0x4cb137[_0x8266('0x12')]+'\x20('+_0x4cb137['statusMessage']+')'));return;}var _0x15a6bb='';_0x4cb137['on']('data',function(_0x4e9c97){_0x15a6bb+=_0x4e9c97;});_0x4cb137['on'](_0x8266('0x1e'),function(){_0x582d81(_0x15a6bb);});})['on'](_0x8266('0x1a'),function(_0x415e2b){_0x13be40(_0x415e2b);})['end']();});}function convertFile(_0x2b2827,_0x161241){return new BPromise(function(_0x39d879,_0x536f39){var _0x44a5cf=sox[_0x8266('0x21')](_0x2b2827,_0x161241,{'sampleRate':0x1f40,'format':_0x8266('0x22'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x44a5cf['on'](_0x8266('0x1a'),function(_0x7ecdd5){logger['error'](_0x8266('0x23'),_0x7ecdd5);_0x536f39(_0x7ecdd5);});_0x44a5cf['on'](_0x8266('0x1e'),function(){logger[_0x8266('0x18')](_0x8266('0x24'));_0x39d879();});_0x44a5cf['start']();});}function base64Decode(_0x2870c1,_0x505d3b){var _0x3287c1=path[_0x8266('0x25')](__dirname,_0x8266('0x26'),rs[_0x8266('0x27')](0x4)+'.wav');fs[_0x8266('0x28')](_0x3287c1,_0x2870c1,_0x8266('0x29'));return convertFile(_0x3287c1,_0x505d3b)[_0x8266('0x2a')](function(){try{fs['unlink'](_0x3287c1);fs[_0x8266('0x2b')](_0x505d3b,_0x8266('0x2c'));}catch(_0x429e05){logger[_0x8266('0x1a')](_0x429e05);}return _0x505d3b['split']('.')[0x0];});}function base64Encode(_0xa83cb1){var _0x2e3338=fs[_0x8266('0x2d')](_0xa83cb1);return new Buffer(_0x2e3338)['toString']('base64');}exports[_0x8266('0x2e')]=function(_0x39ea31,_0x403b43,_0x55183f,_0xc75355,_0x332289,_0x105ba2){var _0x1ac56f,_0x678fed;var _0x3e2e10=_0x8266('0x2f');var _0x186282='?key='+_0x39ea31;var _0x391012={};if(_0x403b43===_0x8266('0x30')){_0x391012[_0x8266('0x31')]={'ssml':_0x55183f};}else{_0x391012['input']={'text':_0x55183f};};_0x391012[_0x8266('0x32')]={'languageCode':_0xc75355,'ssmlGender':_0x332289};_0x391012[_0x8266('0x33')]={'audioEncoding':_0x8266('0x34'),'sampleRateHertz':0x1f40};var _0xd86bea={'url':_0x3e2e10+'text:synthesize'+_0x186282,'method':_0x8266('0x35'),'json':!![],'body':_0x391012};return rp(_0xd86bea)[_0x8266('0x2a')](function(_0x565964){return new BPromise(function(_0x2b061a,_0x658495){_0x1ac56f=path[_0x8266('0x25')](__dirname,'tmp',rs['generate'](0x4)+'.mp3');var _0x359dd2=Buffer[_0x8266('0x36')](_0x565964['audioContent'],_0x8266('0x29'));return fs[_0x8266('0x37')](_0x1ac56f,_0x359dd2,function(_0x5f582a){_0x658495(_0x5f582a);},function(_0xa1f332){fs[_0x8266('0x2b')](_0x1ac56f,_0x8266('0x2c'));_0x2b061a(_0xa1f332);});});})['then'](function(_0x1178a9){_0x678fed=path[_0x8266('0x25')](__dirname,_0x8266('0x26'),rs[_0x8266('0x27')](0x4)+_0x8266('0x38'));return convertFile(_0x1ac56f,_0x678fed);})[_0x8266('0x2a')](function(){try{fs['unlink'](_0x1ac56f);fs['chmodSync'](_0x678fed,_0x8266('0x2c'));}catch(_0x440016){logger[_0x8266('0x1a')](_0x440016);}logger['info'](_0x8266('0x39'),_0x678fed['split']('.')[0x0]);return _0x678fed[_0x8266('0x3a')]('.')[0x0];});};exports['googleTTS']=function(_0x38f2e2,_0x2d03af){var _0x48263a=_0x8266('0x3b');var _0x29a6ed,_0x41da7d;var _0x159892;var _0x1f6c93={'encoding':'utf8','method':_0x8266('0x35'),'timeout':0x2710,'url':_0x48263a,'headers':{'Content-Type':_0x8266('0x3c')},'body':_0x8266('0x3d')+encodeURIComponent(JSON[_0x8266('0x3e')]([[['jQ1olc',JSON['stringify']([_0x38f2e2,_0x2d03af||'en',![],_0x8266('0x3f')]),null,_0x8266('0x40')]]]))};return rp(_0x1f6c93)[_0x8266('0x2a')](function(_0x11cf42){try{_0x159892=eval(_0x11cf42[_0x8266('0x41')](0x5))[0x0][0x2];}catch(_0x49292a){throw new Error(_0x8266('0x42')+_0x11cf42[_0x8266('0x43')]);}if(!_0x159892){if(_0x38f2e2[_0x8266('0x44')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x8266('0x45')+_0x2d03af+_0x8266('0x46'));}}try{_0x159892=eval(_0x159892)[0x0];}catch(_0x21ae10){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x8266('0x43')]);}const _0x511373=_0x159892;_0x29a6ed=path['resolve'](__dirname,_0x8266('0x26'),rs['generate'](0x4)+_0x8266('0x47'));fs[_0x8266('0x28')](_0x29a6ed,_0x159892,{'encoding':_0x8266('0x29')});_0x41da7d=path[_0x8266('0x25')](__dirname,_0x8266('0x26'),rs[_0x8266('0x27')](0x4)+_0x8266('0x38'));return convertFile(_0x29a6ed,_0x41da7d);})[_0x8266('0x2a')](function(){try{fs[_0x8266('0x1b')](_0x29a6ed);fs[_0x8266('0x2b')](_0x41da7d,_0x8266('0x2c'));}catch(_0x1b463e){logger['error'](_0x1b463e);}logger['info'](_0x8266('0x48'),_0x41da7d['split']('.')[0x0]);return _0x41da7d['split']('.')[0x0];});};exports[_0x8266('0x49')]=function(_0xdea293,_0x383a6b,_0x5ec7a5){return google[_0x8266('0x4a')](_0xdea293,_0x383a6b,_0x5ec7a5)[_0x8266('0x2a')](function(_0x54645d){logger[_0x8266('0x18')](_0x54645d['uri']);return rp(_0x54645d);})['then'](function(_0x2086b1){var _0x3e2ca5='';var _0x1f7db0=0x0;try{fs[_0x8266('0x1b')](_0xdea293);}catch(_0x18d972){logger[_0x8266('0x1a')](_0x18d972);}if(_0x2086b1&&_0x2086b1[_0x8266('0x4b')]){_0x3e2ca5=_0x2086b1[_0x8266('0x4b')][_0x8266('0x4c')](function(_0x11b2f8){return _0x11b2f8&&_0x11b2f8[_0x8266('0x4d')][0x0]&&_0x11b2f8[_0x8266('0x4d')][0x0][_0x8266('0x4e')]?_0x11b2f8[_0x8266('0x4d')][0x0][_0x8266('0x4e')]:'';})[_0x8266('0x4f')]('\x0a');_0x1f7db0=_0x2086b1[_0x8266('0x4b')]['map'](function(_0x576e1a){return _0x576e1a&&_0x576e1a[_0x8266('0x4d')][0x0]&&_0x576e1a[_0x8266('0x4d')][0x0]['confidence']?_0x576e1a['alternatives'][0x0][_0x8266('0x50')]:0x0;})[_0x8266('0x4f')]('\x0a');}logger[_0x8266('0x18')]('googleASR\x20transcription',_0x3e2ca5);logger[_0x8266('0x18')](_0x8266('0x51'),_0x1f7db0);return{'transcript':_0x3e2ca5,'confidence':_0x1f7db0};})[_0x8266('0x52')](function(_0x1fa03c){logger['error']('[%s]\x20%s:%s',_0x1fa03c[_0x8266('0x12')],_0x1fa03c[_0x8266('0x53')],_0x1fa03c['message']);});};exports['googleDialogflow']=function(_0x58df09,_0x35da43,_0x3f9e50,_0x51e628){var _0x515579=apiai(_0x35da43,{'language':_0x51e628||'en'});return _0x515579['textRequest'](_0x3f9e50,{'sessionId':md5(_0x58df09)})[_0x8266('0x2a')](function(_0x4a64c8){logger[_0x8266('0x18')](JSON[_0x8266('0x3e')](_0x4a64c8));return{'source':_0x4a64c8[_0x8266('0x54')][_0x8266('0x55')],'resolvedQuery':_0x4a64c8[_0x8266('0x54')][_0x8266('0x56')],'action':_0x4a64c8[_0x8266('0x54')][_0x8266('0x57')],'actionIncomplete':_0x4a64c8['result']['actionIncomplete'],'speech':_0x4a64c8[_0x8266('0x54')][_0x8266('0x58')][_0x8266('0x59')],'score':_0x4a64c8[_0x8266('0x54')][_0x8266('0x5a')],'statusCode':_0x4a64c8['status'][_0x8266('0x5b')],'endConversation':_0x4a64c8[_0x8266('0x54')][_0x8266('0x5c')][_0x8266('0x5d')]||![],'isFallbackIntent':_0x4a64c8[_0x8266('0x54')][_0x8266('0x5c')][_0x8266('0x5e')]};});};exports[_0x8266('0x5f')]=function(_0x56cc04,_0x103c41,_0x3b95f3,_0x4efe33,_0x539631,_0x15d804){var _0x94f360=_0x4efe33[_0x8266('0x60')](/\\n/g,'\x0a');var _0x468b25={'credentials':{'private_key':_0x94f360,'client_email':_0x3b95f3}};var _0x5c7ba2=new dialogflow[(_0x8266('0x61'))](_0x468b25);var _0x234280=_0x5c7ba2[_0x8266('0x62')](_0x103c41,md5(_0x56cc04));var _0x25b6bb={'session':_0x234280,'queryInput':{'text':{'text':_0x539631,'languageCode':_0x15d804}}};return _0x5c7ba2[_0x8266('0x63')](_0x25b6bb)[_0x8266('0x2a')](function(_0x253a26){if(_0x253a26&&_0x253a26[_0x8266('0x44')]){logger[_0x8266('0x18')]('Dialogflow\x20V2\x20response:',JSON[_0x8266('0x3e')](_0x253a26));var _0xdba3fa=_0x253a26[0x0];if(_0xdba3fa){var _0x1edac5={'action':_0xdba3fa[_0x8266('0x64')][_0x8266('0x57')],'allRequiredParamsPresent':_0xdba3fa[_0x8266('0x64')]['allRequiredParamsPresent'],'endConversation':_0xdba3fa[_0x8266('0x64')][_0x8266('0x65')]&&_0xdba3fa[_0x8266('0x64')][_0x8266('0x65')]['fields']?_0xdba3fa['queryResult'][_0x8266('0x65')][_0x8266('0x66')][_0x8266('0x67')][_0x8266('0x68')]:![],'fulfillmentText':_0xdba3fa['queryResult']['fulfillmentText'],'intentName':_0xdba3fa[_0x8266('0x64')][_0x8266('0x69')][_0x8266('0x53')],'intentDisplayName':_0xdba3fa['queryResult'][_0x8266('0x69')][_0x8266('0x6a')],'isFallbackIntent':_0xdba3fa[_0x8266('0x64')][_0x8266('0x69')]['isFallback'],'languageCode':_0xdba3fa[_0x8266('0x64')][_0x8266('0x6b')],'queryText':_0xdba3fa[_0x8266('0x64')][_0x8266('0x6c')],'responseId':_0xdba3fa[_0x8266('0x6d')],'score':_0xdba3fa[_0x8266('0x64')]['intentDetectionConfidence'],'speech':_0xdba3fa[_0x8266('0x64')][_0x8266('0x6e')],'providerResponse':JSON[_0x8266('0x3e')](_0x253a26)};return _0x1edac5;}}});};exports['tildeASR']=function(_0x256c2d,_0x2098aa,_0x1c319f,_0x3a0143){return tilde[_0x8266('0x4a')](_0x256c2d,_0x2098aa,_0x1c319f,_0x3a0143)[_0x8266('0x2a')](function(_0xe3f816){try{fs[_0x8266('0x1b')](_0x256c2d);}catch(_0x271a3e){logger['error'](_0x271a3e);}logger[_0x8266('0x18')](_0x8266('0x6f'),_0xe3f816[_0x8266('0x4e')]);logger[_0x8266('0x18')](_0x8266('0x70'),_0xe3f816[_0x8266('0x50')]);return _0xe3f816;});};exports[_0x8266('0x71')]=function(_0x1a66a3,_0x35dc93,_0x357feb,_0x346e07,_0x58f488,_0x356bc0){var _0x3c1f7d=path[_0x8266('0x25')](__dirname,_0x8266('0x26'),rs[_0x8266('0x27')](0x4)+'.mp3');var _0x56d1b4;return aws['polly'](_0x1a66a3,_0x35dc93,_0x357feb,_0x346e07,_0x58f488,_0x356bc0,_0x3c1f7d)[_0x8266('0x2a')](function(){_0x56d1b4=path[_0x8266('0x25')](__dirname,_0x8266('0x26'),rs['generate'](0x4)+_0x8266('0x38'));return convertFile(_0x3c1f7d,_0x56d1b4);})['then'](function(){try{fs[_0x8266('0x1b')](_0x3c1f7d);fs[_0x8266('0x2b')](_0x56d1b4,'777');}catch(_0x5148e7){logger[_0x8266('0x1a')](_0x5148e7);}return _0x56d1b4[_0x8266('0x3a')]('.')[0x0];});};exports['awsLex']=function(_0x8e3e22,_0x41e494,_0x499064,_0x5af314,_0x5b4eec,_0x13eefd){return aws[_0x8266('0x72')](_0x8e3e22,_0x41e494,_0x499064,_0x5af314,_0x5b4eec,_0x13eefd)['then'](function(_0x537658){logger[_0x8266('0x18')](JSON[_0x8266('0x3e')](_0x537658));return _0x537658;});};exports[_0x8266('0x73')]=function(_0x19dc7a,_0x30d64c,_0x419816,_0x4eea8a){var _0x2684f7=util[_0x8266('0x74')](_0x8266('0x75'),ISPEECH_API,_0x19dc7a,encodeURIComponent(_0x30d64c),_0x419816,_0x4eea8a);var _0x155e0b=path['resolve'](__dirname,_0x8266('0x26'),rs[_0x8266('0x27')](0x4)+_0x8266('0x47'));var _0x292d05;return downloadFile(_0x2684f7,_0x155e0b)[_0x8266('0x2a')](function(){_0x292d05=path[_0x8266('0x25')](__dirname,_0x8266('0x26'),rs[_0x8266('0x27')](0x4)+'.wav');return convertFile(_0x155e0b,_0x292d05);})['then'](function(){try{fs['unlink'](_0x155e0b);fs[_0x8266('0x2b')](_0x292d05,_0x8266('0x2c'));}catch(_0x3dbcfb){logger['error'](_0x3dbcfb);}return _0x292d05[_0x8266('0x3a')]('.')[0x0];});};exports[_0x8266('0x76')]=function(_0x25b582,_0x18db82,_0x357e90,_0x4e8b42){var _0x45ce60=util[_0x8266('0x74')](_0x8266('0x77'),ISPEECH_API,_0x18db82,_0x357e90,base64Encode(_0x25b582),_0x4e8b42?util[_0x8266('0x74')](_0x8266('0x78'),encodeURIComponent(_0x4e8b42)):_0x8266('0x79'));return uploadFile(_0x45ce60)[_0x8266('0x2a')](function(_0x239286){return querystring[_0x8266('0x9')](_0x239286);});};exports[_0x8266('0x7a')]=function(_0x4df8c2,_0x4d4a56){return sestek[_0x8266('0x7b')](_0x4df8c2,_0x4d4a56)[_0x8266('0x2a')](function(_0x1ad75f){logger['info'](JSON[_0x8266('0x3e')](_0x1ad75f));var _0x3f8c53={'speech':_0x1ad75f[_0x8266('0x7c')],'action':_0x1ad75f[_0x8266('0x7d')]?_0x1ad75f[_0x8266('0x7d')][_0x8266('0x7e')]:undefined,'actiondata':_0x1ad75f[_0x8266('0x7d')]?_0x1ad75f[_0x8266('0x7d')][_0x8266('0x7f')]:undefined};if(_0x1ad75f['channelData']&&_0x1ad75f[_0x8266('0x7d')]['AudioFromTts']){return base64Decode(_0x1ad75f[_0x8266('0x7d')][_0x8266('0x80')][_0x8266('0x81')],path[_0x8266('0x25')](__dirname,_0x8266('0x26'),rs['generate'](0x4)+_0x8266('0x38')))[_0x8266('0x2a')](function(_0x1174f9){_0x3f8c53[_0x8266('0x82')]=_0x1174f9;return _0x3f8c53;});}return _0x3f8c53;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0xc525=['close','unlink','download\x20error','pipe','end','https:','get','data','transcode','wav','error\x20convert','start','tmp','generate','.wav','writeFileSync','base64','chmodSync','777','readFileSync','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','then','resolve','.mp3','googleCloudTTS\x20path','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','parse\x20response\x20failed:\x0a','length','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','textRequest','source','resolvedQuery','result','action','speech','score','status','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','name','displayName','isFallback','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','parse','sestekNDA','nda','text','channelData','CustomAction','AudioFromTts','Data','dirName','apiai-promise','bluebird','http','https','querystring','request-promise','sox','google-tts-api','url','util','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0xc525,0x6e));var _0x5c52=function(_0x32cd9e,_0x142dbb){_0x32cd9e=_0x32cd9e-0x0;var _0x4d22f3=_0xc525[_0x32cd9e];return _0x4d22f3;};'use strict';var apiai=require(_0x5c52('0x0'));var BPromise=require(_0x5c52('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x5c52('0x2'));var https=require(_0x5c52('0x3'));var md5=require('md5');var path=require('path');var querystring=require(_0x5c52('0x4'));var rp=require(_0x5c52('0x5'));var rs=require('randomstring');var sox=require(_0x5c52('0x6'));var tts=require(_0x5c52('0x7'));var urlParse=require(_0x5c52('0x8'))['parse'];var util=require(_0x5c52('0x9'));var aws=require('./aws');var google=require(_0x5c52('0xa'));var sestek=require(_0x5c52('0xb'));var tilde=require(_0x5c52('0xc'));var logger=require(_0x5c52('0xd'))(_0x5c52('0xe'));var ISPEECH_API=_0x5c52('0xf');function downloadFile(_0x420c6c,_0x36adb8){return new BPromise(function(_0x376455,_0x14e5a8){var _0x21ea99=urlParse(_0x420c6c);var _0x525f88=_0x21ea99[_0x5c52('0x10')]==='https:'?https:http;var _0xe97f7f={'host':_0x21ea99[_0x5c52('0x11')],'path':_0x21ea99['path'],'headers':{'user-agent':_0x5c52('0x12')}};_0x525f88['get'](_0xe97f7f,function(_0x3c47ed){if(_0x3c47ed[_0x5c52('0x13')]!==0xc8){logger[_0x5c52('0x14')](_0x5c52('0x15')+_0x420c6c+_0x5c52('0x16')+_0x3c47ed[_0x5c52('0x13')]+'\x20('+_0x3c47ed[_0x5c52('0x17')]+')');_0x14e5a8(new Error(_0x5c52('0x15')+_0x420c6c+_0x5c52('0x16')+_0x3c47ed[_0x5c52('0x13')]+'\x20('+_0x3c47ed[_0x5c52('0x17')]+')'));return;}var _0x13f2b1=fs[_0x5c52('0x18')](_0x36adb8);_0x13f2b1['on'](_0x5c52('0x19'),function(){logger[_0x5c52('0x1a')]('finish\x20download\x20file');_0x13f2b1[_0x5c52('0x1b')](_0x376455);});_0x13f2b1['on'](_0x5c52('0x14'),function(_0x5f34bc){fs[_0x5c52('0x1c')](_0x36adb8);logger['error'](_0x5c52('0x1d'),_0x5f34bc);_0x14e5a8(_0x5f34bc);});_0x3c47ed[_0x5c52('0x1e')](_0x13f2b1);})['on'](_0x5c52('0x14'),function(_0x5b2fd3){logger[_0x5c52('0x14')](_0x5b2fd3);_0x14e5a8(_0x5b2fd3);})[_0x5c52('0x1f')]();});}function uploadFile(_0x5d5703){return new BPromise(function(_0x36e298,_0x5ecd80){var _0x580d7a=urlParse(_0x5d5703);var _0x24d3a6=_0x580d7a[_0x5c52('0x10')]===_0x5c52('0x20')?https:http;var _0xedab08={'host':_0x580d7a[_0x5c52('0x11')],'path':_0x580d7a['path'],'headers':{'user-agent':_0x5c52('0x12')}};_0x24d3a6[_0x5c52('0x21')](_0xedab08,function(_0xd468c7){if(_0xd468c7[_0x5c52('0x13')]!==0xc8){_0x5ecd80(new Error(_0x5c52('0x15')+_0x5d5703+_0x5c52('0x16')+_0xd468c7['statusCode']+'\x20('+_0xd468c7[_0x5c52('0x17')]+')'));return;}var _0xd25fcd='';_0xd468c7['on'](_0x5c52('0x22'),function(_0x5774ec){_0xd25fcd+=_0x5774ec;});_0xd468c7['on']('end',function(){_0x36e298(_0xd25fcd);});})['on'](_0x5c52('0x14'),function(_0x5f16b6){_0x5ecd80(_0x5f16b6);})[_0x5c52('0x1f')]();});}function convertFile(_0xfc8509,_0x221d9a){return new BPromise(function(_0x101945,_0x567b83){var _0x4a21bc=sox[_0x5c52('0x23')](_0xfc8509,_0x221d9a,{'sampleRate':0x1f40,'format':_0x5c52('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4a21bc['on'](_0x5c52('0x14'),function(_0x348480){logger[_0x5c52('0x14')](_0x5c52('0x25'),_0x348480);_0x567b83(_0x348480);});_0x4a21bc['on']('end',function(){logger[_0x5c52('0x1a')]('finish\x20to\x20convert');_0x101945();});_0x4a21bc[_0x5c52('0x26')]();});}function base64Decode(_0x1b7350,_0x33d08b){var _0x147e9e=path['resolve'](__dirname,_0x5c52('0x27'),rs[_0x5c52('0x28')](0x4)+_0x5c52('0x29'));fs[_0x5c52('0x2a')](_0x147e9e,_0x1b7350,_0x5c52('0x2b'));return convertFile(_0x147e9e,_0x33d08b)['then'](function(){try{fs[_0x5c52('0x1c')](_0x147e9e);fs[_0x5c52('0x2c')](_0x33d08b,_0x5c52('0x2d'));}catch(_0x1f559e){logger[_0x5c52('0x14')](_0x1f559e);}return _0x33d08b['split']('.')[0x0];});}function base64Encode(_0xf2f515){var _0x539604=fs[_0x5c52('0x2e')](_0xf2f515);return new Buffer(_0x539604)['toString']('base64');}exports['googleCloudTTS']=function(_0x3599f5,_0x4fe609,_0x24b50b,_0x258275,_0x254a1c,_0x3ad850){var _0xe621e0,_0x247754;var _0x5001be='https://texttospeech.googleapis.com/v1/';var _0x5592c2=_0x5c52('0x2f')+_0x3599f5;var _0x4ba543={};if(_0x4fe609===_0x5c52('0x30')){_0x4ba543[_0x5c52('0x31')]={'ssml':_0x24b50b};}else{_0x4ba543[_0x5c52('0x31')]={'text':_0x24b50b};};_0x4ba543[_0x5c52('0x32')]={'languageCode':_0x258275,'ssmlGender':_0x254a1c};_0x4ba543[_0x5c52('0x33')]={'audioEncoding':_0x5c52('0x34'),'sampleRateHertz':0x1f40};var _0x2fcff9={'url':_0x5001be+_0x5c52('0x35')+_0x5592c2,'method':_0x5c52('0x36'),'json':!![],'body':_0x4ba543};return rp(_0x2fcff9)[_0x5c52('0x37')](function(_0x53429d){return new BPromise(function(_0x5a5349,_0x1f8c41){_0xe621e0=path[_0x5c52('0x38')](__dirname,_0x5c52('0x27'),rs['generate'](0x4)+_0x5c52('0x39'));var _0x2eacb8=Buffer['from'](_0x53429d['audioContent'],_0x5c52('0x2b'));return fs['writeFile'](_0xe621e0,_0x2eacb8,function(_0x4cf206){_0x1f8c41(_0x4cf206);},function(_0x16581f){fs[_0x5c52('0x2c')](_0xe621e0,'777');_0x5a5349(_0x16581f);});});})[_0x5c52('0x37')](function(_0xfe3531){_0x247754=path['resolve'](__dirname,'tmp',rs[_0x5c52('0x28')](0x4)+_0x5c52('0x29'));return convertFile(_0xe621e0,_0x247754);})[_0x5c52('0x37')](function(){try{fs['unlink'](_0xe621e0);fs[_0x5c52('0x2c')](_0x247754,_0x5c52('0x2d'));}catch(_0x172c96){logger[_0x5c52('0x14')](_0x172c96);}logger['info'](_0x5c52('0x3a'),_0x247754['split']('.')[0x0]);return _0x247754[_0x5c52('0x3b')]('.')[0x0];});};exports[_0x5c52('0x3c')]=function(_0x266101,_0x2bcb3f){var _0x2b6d9b=_0x5c52('0x3d');var _0x5581cc,_0x3b1b02;var _0x3bf69f;var _0x42382c={'encoding':_0x5c52('0x3e'),'method':_0x5c52('0x36'),'timeout':0x2710,'url':_0x2b6d9b,'headers':{'Content-Type':_0x5c52('0x3f')},'body':_0x5c52('0x40')+encodeURIComponent(JSON[_0x5c52('0x41')]([[[_0x5c52('0x42'),JSON[_0x5c52('0x41')]([_0x266101,_0x2bcb3f||'en',![],_0x5c52('0x43')]),null,_0x5c52('0x44')]]]))};return rp(_0x42382c)[_0x5c52('0x37')](function(_0xfcd3bd){try{_0x3bf69f=eval(_0xfcd3bd['slice'](0x5))[0x0][0x2];}catch(_0x8939e7){throw new Error(_0x5c52('0x45')+_0xfcd3bd[_0x5c52('0x22')]);}if(!_0x3bf69f){if(_0x266101[_0x5c52('0x46')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x5c52('0x47')+_0x2bcb3f+_0x5c52('0x48'));}}try{_0x3bf69f=eval(_0x3bf69f)[0x0];}catch(_0xb65d1d){throw new Error(_0x5c52('0x45')+res[_0x5c52('0x22')]);}const _0x5e8802=_0x3bf69f;_0x5581cc=path['resolve'](__dirname,_0x5c52('0x27'),rs[_0x5c52('0x28')](0x4)+_0x5c52('0x39'));fs[_0x5c52('0x2a')](_0x5581cc,_0x3bf69f,{'encoding':_0x5c52('0x2b')});_0x3b1b02=path[_0x5c52('0x38')](__dirname,_0x5c52('0x27'),rs['generate'](0x4)+'.wav');return convertFile(_0x5581cc,_0x3b1b02);})[_0x5c52('0x37')](function(){try{fs[_0x5c52('0x1c')](_0x5581cc);fs['chmodSync'](_0x3b1b02,_0x5c52('0x2d'));}catch(_0x5dcbec){logger[_0x5c52('0x14')](_0x5dcbec);}logger[_0x5c52('0x1a')](_0x5c52('0x49'),_0x3b1b02[_0x5c52('0x3b')]('.')[0x0]);return _0x3b1b02[_0x5c52('0x3b')]('.')[0x0];});};exports[_0x5c52('0x4a')]=function(_0x5f3ba6,_0x389375,_0x59a3a1){return google[_0x5c52('0x4b')](_0x5f3ba6,_0x389375,_0x59a3a1)[_0x5c52('0x37')](function(_0x404ca4){logger['info'](_0x404ca4['uri']);return rp(_0x404ca4);})[_0x5c52('0x37')](function(_0x3f2e40){var _0x5a72aa='';var _0x112777=0x0;try{fs[_0x5c52('0x1c')](_0x5f3ba6);}catch(_0x22c7af){logger[_0x5c52('0x14')](_0x22c7af);}if(_0x3f2e40&&_0x3f2e40[_0x5c52('0x4c')]){_0x5a72aa=_0x3f2e40[_0x5c52('0x4c')][_0x5c52('0x4d')](function(_0x5714fe){return _0x5714fe&&_0x5714fe[_0x5c52('0x4e')][0x0]&&_0x5714fe[_0x5c52('0x4e')][0x0][_0x5c52('0x4f')]?_0x5714fe[_0x5c52('0x4e')][0x0][_0x5c52('0x4f')]:'';})[_0x5c52('0x50')]('\x0a');_0x112777=_0x3f2e40[_0x5c52('0x4c')][_0x5c52('0x4d')](function(_0x4a24d2){return _0x4a24d2&&_0x4a24d2[_0x5c52('0x4e')][0x0]&&_0x4a24d2[_0x5c52('0x4e')][0x0][_0x5c52('0x51')]?_0x4a24d2['alternatives'][0x0][_0x5c52('0x51')]:0x0;})[_0x5c52('0x50')]('\x0a');}logger[_0x5c52('0x1a')](_0x5c52('0x52'),_0x5a72aa);logger['info'](_0x5c52('0x53'),_0x112777);return{'transcript':_0x5a72aa,'confidence':_0x112777};})[_0x5c52('0x54')](function(_0x5a36aa){logger[_0x5c52('0x14')](_0x5c52('0x55'),_0x5a36aa['statusCode'],_0x5a36aa['name'],_0x5a36aa[_0x5c52('0x56')]);});};exports[_0x5c52('0x57')]=function(_0x407cf3,_0x4e5a8a,_0xbd9717,_0x8ed41d){var _0x3014f3=apiai(_0x4e5a8a,{'language':_0x8ed41d||'en'});return _0x3014f3[_0x5c52('0x58')](_0xbd9717,{'sessionId':md5(_0x407cf3)})[_0x5c52('0x37')](function(_0x1418f2){logger[_0x5c52('0x1a')](JSON[_0x5c52('0x41')](_0x1418f2));return{'source':_0x1418f2['result'][_0x5c52('0x59')],'resolvedQuery':_0x1418f2['result'][_0x5c52('0x5a')],'action':_0x1418f2[_0x5c52('0x5b')][_0x5c52('0x5c')],'actionIncomplete':_0x1418f2['result']['actionIncomplete'],'speech':_0x1418f2[_0x5c52('0x5b')]['fulfillment'][_0x5c52('0x5d')],'score':_0x1418f2['result'][_0x5c52('0x5e')],'statusCode':_0x1418f2[_0x5c52('0x5f')]['code'],'endConversation':_0x1418f2[_0x5c52('0x5b')][_0x5c52('0x60')][_0x5c52('0x61')]||![],'isFallbackIntent':_0x1418f2['result'][_0x5c52('0x60')][_0x5c52('0x62')]};});};exports[_0x5c52('0x63')]=function(_0x2b232d,_0x4e5065,_0x5899c1,_0x5a7064,_0x25aa09,_0x5056b7){var _0x3870fe=_0x5a7064[_0x5c52('0x64')](/\\n/g,'\x0a');var _0x592e0d={'credentials':{'private_key':_0x3870fe,'client_email':_0x5899c1}};var _0x4dc889=new dialogflow[(_0x5c52('0x65'))](_0x592e0d);var _0x133aee=_0x4dc889['sessionPath'](_0x4e5065,md5(_0x2b232d));var _0x313a7d={'session':_0x133aee,'queryInput':{'text':{'text':_0x25aa09,'languageCode':_0x5056b7}}};return _0x4dc889['detectIntent'](_0x313a7d)[_0x5c52('0x37')](function(_0xbfa2c){if(_0xbfa2c&&_0xbfa2c['length']){logger[_0x5c52('0x1a')](_0x5c52('0x66'),JSON[_0x5c52('0x41')](_0xbfa2c));var _0x368e2c=_0xbfa2c[0x0];if(_0x368e2c){var _0xd8bc79={'action':_0x368e2c[_0x5c52('0x67')][_0x5c52('0x5c')],'allRequiredParamsPresent':_0x368e2c['queryResult'][_0x5c52('0x68')],'endConversation':_0x368e2c[_0x5c52('0x67')][_0x5c52('0x69')]&&_0x368e2c[_0x5c52('0x67')]['diagnosticInfo'][_0x5c52('0x6a')]?_0x368e2c['queryResult']['diagnosticInfo'][_0x5c52('0x6a')][_0x5c52('0x6b')][_0x5c52('0x6c')]:![],'fulfillmentText':_0x368e2c[_0x5c52('0x67')][_0x5c52('0x6d')],'intentName':_0x368e2c[_0x5c52('0x67')][_0x5c52('0x6e')][_0x5c52('0x6f')],'intentDisplayName':_0x368e2c[_0x5c52('0x67')][_0x5c52('0x6e')][_0x5c52('0x70')],'isFallbackIntent':_0x368e2c[_0x5c52('0x67')][_0x5c52('0x6e')][_0x5c52('0x71')],'languageCode':_0x368e2c[_0x5c52('0x67')]['languageCode'],'queryText':_0x368e2c[_0x5c52('0x67')][_0x5c52('0x72')],'responseId':_0x368e2c[_0x5c52('0x73')],'score':_0x368e2c[_0x5c52('0x67')][_0x5c52('0x74')],'speech':_0x368e2c[_0x5c52('0x67')][_0x5c52('0x6d')],'providerResponse':JSON[_0x5c52('0x41')](_0xbfa2c)};return _0xd8bc79;}}});};exports[_0x5c52('0x75')]=function(_0x1bd79f,_0x5a19f4,_0x5a44ee,_0x2fd87f){return tilde[_0x5c52('0x4b')](_0x1bd79f,_0x5a19f4,_0x5a44ee,_0x2fd87f)[_0x5c52('0x37')](function(_0x3219b4){try{fs[_0x5c52('0x1c')](_0x1bd79f);}catch(_0x3fc4ed){logger[_0x5c52('0x14')](_0x3fc4ed);}logger['info'](_0x5c52('0x76'),_0x3219b4[_0x5c52('0x4f')]);logger[_0x5c52('0x1a')](_0x5c52('0x77'),_0x3219b4[_0x5c52('0x51')]);return _0x3219b4;});};exports['awsPolly']=function(_0x298e28,_0x442931,_0x3d83e3,_0x313951,_0x312fe6,_0x4156b0){var _0xdf4c7a=path[_0x5c52('0x38')](__dirname,'tmp',rs[_0x5c52('0x28')](0x4)+_0x5c52('0x39'));var _0x4678b8;return aws['polly'](_0x298e28,_0x442931,_0x3d83e3,_0x313951,_0x312fe6,_0x4156b0,_0xdf4c7a)[_0x5c52('0x37')](function(){_0x4678b8=path[_0x5c52('0x38')](__dirname,_0x5c52('0x27'),rs[_0x5c52('0x28')](0x4)+_0x5c52('0x29'));return convertFile(_0xdf4c7a,_0x4678b8);})[_0x5c52('0x37')](function(){try{fs[_0x5c52('0x1c')](_0xdf4c7a);fs[_0x5c52('0x2c')](_0x4678b8,'777');}catch(_0x5b66c2){logger[_0x5c52('0x14')](_0x5b66c2);}return _0x4678b8['split']('.')[0x0];});};exports[_0x5c52('0x78')]=function(_0xf6a454,_0x5ef92d,_0x4a92a0,_0x37d15e,_0x4a560b,_0x300193){return aws[_0x5c52('0x79')](_0xf6a454,_0x5ef92d,_0x4a92a0,_0x37d15e,_0x4a560b,_0x300193)[_0x5c52('0x37')](function(_0x1c09c6){logger[_0x5c52('0x1a')](JSON[_0x5c52('0x41')](_0x1c09c6));return _0x1c09c6;});};exports[_0x5c52('0x7a')]=function(_0x286bb1,_0x121bd9,_0x59964a,_0x164844){var _0x1af4ec=util[_0x5c52('0x7b')](_0x5c52('0x7c'),ISPEECH_API,_0x286bb1,encodeURIComponent(_0x121bd9),_0x59964a,_0x164844);var _0x554cc3=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x5c52('0x39'));var _0x3b86e3;return downloadFile(_0x1af4ec,_0x554cc3)['then'](function(){_0x3b86e3=path[_0x5c52('0x38')](__dirname,_0x5c52('0x27'),rs[_0x5c52('0x28')](0x4)+_0x5c52('0x29'));return convertFile(_0x554cc3,_0x3b86e3);})[_0x5c52('0x37')](function(){try{fs[_0x5c52('0x1c')](_0x554cc3);fs[_0x5c52('0x2c')](_0x3b86e3,_0x5c52('0x2d'));}catch(_0x3a863d){logger['error'](_0x3a863d);}return _0x3b86e3['split']('.')[0x0];});};exports[_0x5c52('0x7d')]=function(_0x17b060,_0x3cdcea,_0x5d338f,_0x2f4d49){var _0x7752b6=util[_0x5c52('0x7b')](_0x5c52('0x7e'),ISPEECH_API,_0x3cdcea,_0x5d338f,base64Encode(_0x17b060),_0x2f4d49?util[_0x5c52('0x7b')](_0x5c52('0x7f'),encodeURIComponent(_0x2f4d49)):'freeform=3');return uploadFile(_0x7752b6)[_0x5c52('0x37')](function(_0x4a3fca){return querystring[_0x5c52('0x80')](_0x4a3fca);});};exports[_0x5c52('0x81')]=function(_0x1960d4,_0x1c2d39){return sestek[_0x5c52('0x82')](_0x1960d4,_0x1c2d39)[_0x5c52('0x37')](function(_0x2e9580){logger[_0x5c52('0x1a')](JSON[_0x5c52('0x41')](_0x2e9580));var _0x2cb1ad={'speech':_0x2e9580[_0x5c52('0x83')],'action':_0x2e9580[_0x5c52('0x84')]?_0x2e9580[_0x5c52('0x84')][_0x5c52('0x85')]:undefined,'actiondata':_0x2e9580['channelData']?_0x2e9580['channelData']['CustomActionData']:undefined};if(_0x2e9580[_0x5c52('0x84')]&&_0x2e9580[_0x5c52('0x84')]['AudioFromTts']){return base64Decode(_0x2e9580[_0x5c52('0x84')][_0x5c52('0x86')][_0x5c52('0x87')],path[_0x5c52('0x38')](__dirname,_0x5c52('0x27'),rs[_0x5c52('0x28')](0x4)+_0x5c52('0x29')))[_0x5c52('0x37')](function(_0x3409c3){_0x2cb1ad['audiofile']=_0x3409c3;return _0x2cb1ad;});}return _0x2cb1ad;});};exports[_0x5c52('0x88')]=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 e5ad44d..9bbb8f3 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 _0x11cf=['./nda'];(function(_0x280645,_0x322f2d){var _0xe648a8=function(_0x29f65b){while(--_0x29f65b){_0x280645['push'](_0x280645['shift']());}};_0xe648a8(++_0x322f2d);}(_0x11cf,0x1dc));var _0xf11c=function(_0x17afa6,_0x3dd9ee){_0x17afa6=_0x17afa6-0x0;var _0x5f3990=_0x11cf[_0x17afa6];return _0x5f3990;};var nda=require(_0xf11c('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x31b8=['./nda','exports'];(function(_0x39d8fd,_0x266522){var _0x184a2b=function(_0x2e4f78){while(--_0x2e4f78){_0x39d8fd['push'](_0x39d8fd['shift']());}};_0x184a2b(++_0x266522);}(_0x31b8,0x102));var _0x831b=function(_0x23d2de,_0x2d7a50){_0x23d2de=_0x23d2de-0x0;var _0x28f315=_0x31b8[_0x23d2de];return _0x28f315;};var nda=require(_0x831b('0x0'));module[_0x831b('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index b432f57..a6e836c 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 _0x1ddc=['message','Nda','uniqueid','callerid','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','stringify','url','../../../../../config/logger','agi','POST','resolve','/token','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run'];(function(_0x163040,_0x38a58c){var _0x364667=function(_0x3b104f){while(--_0x3b104f){_0x163040['push'](_0x163040['shift']());}};_0x364667(++_0x38a58c);}(_0x1ddc,0x6e));var _0xc1dd=function(_0x2bc90b,_0x29ba5e){_0x2bc90b=_0x2bc90b-0x0;var _0x2c0d67=_0x1ddc[_0x2bc90b];return _0x2c0d67;};'use strict';var rp=require('request-promise');var url=require(_0xc1dd('0x0'));var logger=require(_0xc1dd('0x1'))(_0xc1dd('0x2'));module['exports']=function(_0x249132,_0x1da287){var _0x5db75e={'method':_0xc1dd('0x3'),'uri':url[_0xc1dd('0x4')](_0x1da287['ndauth_url'],_0xc1dd('0x5')),'form':{'grant_type':_0xc1dd('0x6'),'username':_0x1da287['username'],'password':_0x1da287[_0xc1dd('0x6')]},'json':!![]};return rp(_0x5db75e)[_0xc1dd('0x7')](function(_0x593de5){var _0x54819b={'method':_0xc1dd('0x3'),'uri':url[_0xc1dd('0x4')](_0x1da287[_0xc1dd('0x8')],_0xc1dd('0x9')),'body':{'type':_0x1da287['ndaactivity_type']||_0xc1dd('0xa'),'channelId':_0xc1dd('0xb'),'conversation':{'id':_0x249132[_0xc1dd('0xc')]},'from':{'id':_0x249132[_0xc1dd('0xd')],'name':_0x249132['calleridname']},'recipient':{'id':_0x249132[_0xc1dd('0xe')],'name':_0x249132[_0xc1dd('0xf')]},'text':_0x1da287[_0xc1dd('0x10')],'channelData':{}},'headers':{'Authorization':_0xc1dd('0x11')+_0x593de5[_0xc1dd('0x12')]},'json':!![]};if(_0x1da287[_0xc1dd('0x13')]){_0x54819b[_0xc1dd('0x14')][_0xc1dd('0x15')][_0xc1dd('0x16')]=_0x1da287[_0xc1dd('0x13')];}if(_0x1da287[_0xc1dd('0x17')]=='1'){_0x54819b['body'][_0xc1dd('0x15')][_0xc1dd('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xc1dd('0x19')};}if(_0x1da287[_0xc1dd('0x1a')]){_0x54819b[_0xc1dd('0x14')]['channelData'][_0xc1dd('0x1b')]=_0x1da287[_0xc1dd('0x1a')];if(_0x1da287[_0xc1dd('0x1c')]){_0x54819b[_0xc1dd('0x14')]['channelData']['CustomActionData']=_0x1da287[_0xc1dd('0x1c')];}}logger['info'](JSON[_0xc1dd('0x1d')](_0x54819b));return rp(_0x54819b);});}; \ No newline at end of file +var _0xb377=['ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','callerid','calleridname','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password'];(function(_0x40672d,_0x316df5){var _0x731e51=function(_0x103e27){while(--_0x103e27){_0x40672d['push'](_0x40672d['shift']());}};_0x731e51(++_0x316df5);}(_0xb377,0x1b6));var _0x7b37=function(_0x720bbb,_0x4d4164){_0x720bbb=_0x720bbb-0x0;var _0x5799e1=_0xb377[_0x720bbb];return _0x5799e1;};'use strict';var rp=require(_0x7b37('0x0'));var url=require(_0x7b37('0x1'));var logger=require(_0x7b37('0x2'))(_0x7b37('0x3'));module[_0x7b37('0x4')]=function(_0x36868b,_0x15bc68){var _0x3c4851={'method':_0x7b37('0x5'),'uri':url[_0x7b37('0x6')](_0x15bc68[_0x7b37('0x7')],_0x7b37('0x8')),'form':{'grant_type':'password','username':_0x15bc68['username'],'password':_0x15bc68[_0x7b37('0x9')]},'json':!![]};return rp(_0x3c4851)['then'](function(_0x5afdb8){var _0x3de992={'method':_0x7b37('0x5'),'uri':url[_0x7b37('0x6')](_0x15bc68[_0x7b37('0xa')],_0x7b37('0xb')),'body':{'type':_0x15bc68[_0x7b37('0xc')]||_0x7b37('0xd'),'channelId':_0x7b37('0xe'),'conversation':{'id':_0x36868b['uniqueid']},'from':{'id':_0x36868b[_0x7b37('0xf')],'name':_0x36868b[_0x7b37('0x10')]},'recipient':{'id':_0x36868b['dnid'],'name':_0x36868b['extension']},'text':_0x15bc68[_0x7b37('0x11')],'channelData':{}},'headers':{'Authorization':_0x7b37('0x12')+_0x5afdb8[_0x7b37('0x13')]},'json':!![]};if(_0x15bc68[_0x7b37('0x14')]){_0x3de992[_0x7b37('0x15')][_0x7b37('0x16')][_0x7b37('0x17')]=_0x15bc68[_0x7b37('0x14')];}if(_0x15bc68[_0x7b37('0x18')]=='1'){_0x3de992[_0x7b37('0x15')][_0x7b37('0x16')][_0x7b37('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x7b37('0x1a')};}if(_0x15bc68[_0x7b37('0x1b')]){_0x3de992[_0x7b37('0x15')][_0x7b37('0x16')][_0x7b37('0x1c')]=_0x15bc68['custom_action'];if(_0x15bc68['custom_action_data']){_0x3de992[_0x7b37('0x15')]['channelData']['CustomActionData']=_0x15bc68[_0x7b37('0x1d')];}}logger[_0x7b37('0x1e')](JSON[_0x7b37('0x1f')](_0x3de992));return rp(_0x3de992);});}; \ 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 cf027ae..9056c2b 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. * // * * // ************************************************************************* -'use strict';var asr=require('./lib/api');module['exports']=function(_0x37c13f,_0x16d3c3,_0xf51781,_0x26c245){return asr(_0x37c13f,_0x16d3c3,_0xf51781,_0x26c245);}; \ No newline at end of file +var _0xeae0=['exports','./lib/api'];(function(_0x3fa73a,_0xf555ca){var _0x335c25=function(_0xe6dd9b){while(--_0xe6dd9b){_0x3fa73a['push'](_0x3fa73a['shift']());}};_0x335c25(++_0xf555ca);}(_0xeae0,0x1b9));var _0x0eae=function(_0x1e4177,_0x26a73a){_0x1e4177=_0x1e4177-0x0;var _0xa6e76c=_0xeae0[_0x1e4177];return _0xa6e76c;};'use strict';var asr=require(_0x0eae('0x0'));module[_0x0eae('0x1')]=function(_0x56b103,_0x4260a4,_0x1a71e4,_0x2ee8e0){return asr(_0x56b103,_0x4260a4,_0x1a71e4,_0x2ee8e0);}; \ 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 b845d71..9d826c1 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 _0xe7b0=['All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','crypto','../../../../../../config/logger','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.'];(function(_0x206125,_0x4aabc5){var _0x2f0f15=function(_0x2ccb19){while(--_0x2ccb19){_0x206125['push'](_0x206125['shift']());}};_0x2f0f15(++_0x4aabc5);}(_0xe7b0,0xab));var _0x0e7b=function(_0x4e77c6,_0x4c359c){_0x4e77c6=_0x4e77c6-0x0;var _0x3e326c=_0xe7b0[_0x4e77c6];return _0x3e326c;};'use strict';var BPromise=require(_0x0e7b('0x0'));var _=require(_0x0e7b('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x0e7b('0x2'));var logger=require(_0x0e7b('0x3'))(_0x0e7b('0x4'));module['exports']=function(_0x1d1650,_0x1d4645,_0x2a5548,_0xa0ec99){return new BPromise(function(_0x5a188e,_0x230281){logger[_0x0e7b('0x5')](_0x0e7b('0x6'),_0xa0ec99||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x1384aa=new WebSocket(_0xa0ec99||_0x0e7b('0x7'),{'perMessageDeflate':![]});var _0x65422c='';var _0x20a0dc='0';var _0x5e0415='1';var _0x2d1be9=_0x0e7b('0x8');function _0x49f5b7(_0x35c5d0){var _0x3e9656=crypto['createHash'](_0x0e7b('0x9'));_0x3e9656[_0x0e7b('0xa')](_0x35c5d0);return _0x3e9656[_0x0e7b('0xb')]('hex');}function _0x18f3e4(){try{logger[_0x0e7b('0x5')](_0x0e7b('0xc'));var _0x98ddf5=moment()[_0x0e7b('0xd')]();var _0x460357=_0x49f5b7(_0x98ddf5+_0x1d4645+_0x2a5548);_0x1384aa[_0x0e7b('0xe')](JSON[_0x0e7b('0xf')]({'appID':_0x1d4645,'timestamp':_0x98ddf5,'appKey':_0x460357}));var _0x25b60d=fs[_0x0e7b('0x10')](_0x1d1650);_0x25b60d['on'](_0x0e7b('0x11'),function(_0x26cdbf){_0x1384aa['send'](_0x26cdbf);});_0x25b60d['on'](_0x0e7b('0x12'),function(){_0x1384aa['send'](_0x0e7b('0x13'));});}catch(_0x1baf87){logger[_0x0e7b('0x14')](_0x0e7b('0x15'),JSON['stringify'](_0x1baf87));_0x1384aa[_0x0e7b('0x16')]();}}function _0x56167d(_0x33f0f6){try{if(_0x33f0f6){var _0x4ef6e3=JSON[_0x0e7b('0x17')](_0x33f0f6);switch(_0x4ef6e3[_0x0e7b('0x18')]){case 0x0:if(_0x4ef6e3[_0x0e7b('0x19')]){if(_0x4ef6e3['result'][_0x0e7b('0x1a')]){logger[_0x0e7b('0x5')]('Tilde\x20ASR\x20hypoteses',JSON[_0x0e7b('0xf')](_0x4ef6e3['result'][_0x0e7b('0x1b')]));_0x65422c=_0x4ef6e3['result'][_0x0e7b('0x1b')][0x0][_0x0e7b('0x1c')];_0x20a0dc=_0x4ef6e3['result'][_0x0e7b('0x1b')][0x0][_0x0e7b('0x1d')];_0x5e0415='0';_0x2d1be9=_0x0e7b('0x1e');_0x1384aa[_0x0e7b('0x16')]();}}break;case 0x1:logger[_0x0e7b('0x5')](_0x0e7b('0x8'));_0x5e0415='1';_0x2d1be9=_0x0e7b('0x8');break;case 0x2:logger[_0x0e7b('0x5')](_0x0e7b('0x1f'));_0x5e0415='2';_0x2d1be9='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x0e7b('0x5')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x5e0415='9';_0x2d1be9=_0x0e7b('0x20');break;case 0xa:logger[_0x0e7b('0x5')](_0x0e7b('0x21'));_0x5e0415='10';_0x2d1be9=_0x0e7b('0x21');break;case 0xb:logger['info'](_0x0e7b('0x22'));_0x5e0415='11';_0x2d1be9=_0x0e7b('0x22');}}}catch(_0x27b009){logger['error'](_0x0e7b('0x23'),JSON['stringify'](_0x27b009));_0x1384aa[_0x0e7b('0x16')]();}}function _0x378200(){logger[_0x0e7b('0x5')]('Close\x20Tilde\x20ASR\x20socket');_0x5a188e({'transcript':_0x65422c,'confidence':_0x20a0dc,'status':_0x5e0415,'status_message':_0x2d1be9});}function _0x29badb(_0x3042dc){logger[_0x0e7b('0x14')](_0x0e7b('0x24'));if(!_[_0x0e7b('0x25')](_0x3042dc)){logger['error'](_[_0x0e7b('0x26')](_0x3042dc)?JSON[_0x0e7b('0xf')](_0x3042dc):_0x3042dc);}}_0x1384aa['on'](_0x0e7b('0x27'),_0x18f3e4);_0x1384aa['on'](_0x0e7b('0x28'),_0x56167d);_0x1384aa['on'](_0x0e7b('0x12'),_0x378200);_0x1384aa['on'](_0x0e7b('0x14'),_0x29badb);});}; \ No newline at end of file +var _0xd3c9=['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','message','bluebird','lodash','crypto','../../../../../../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','createHash','sha1','update','digest','hex','unix','send','stringify','createReadStream','close','EOS','error','terminate','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.'];(function(_0x2dae70,_0x1ad278){var _0x22690f=function(_0x4e882d){while(--_0x4e882d){_0x2dae70['push'](_0x2dae70['shift']());}};_0x22690f(++_0x1ad278);}(_0xd3c9,0x110));var _0x9d3c=function(_0x100b2f,_0x3c84ba){_0x100b2f=_0x100b2f-0x0;var _0x282752=_0xd3c9[_0x100b2f];return _0x282752;};'use strict';var BPromise=require(_0x9d3c('0x0'));var _=require(_0x9d3c('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x9d3c('0x2'));var logger=require(_0x9d3c('0x3'))(_0x9d3c('0x4'));module[_0x9d3c('0x5')]=function(_0x53f98e,_0x5865bc,_0x47a143,_0x3e964f){return new BPromise(function(_0x3cefb9,_0x3efdcb){logger[_0x9d3c('0x6')](_0x9d3c('0x7'),_0x3e964f||_0x9d3c('0x8'));var _0x5885aa=new WebSocket(_0x3e964f||_0x9d3c('0x8'),{'perMessageDeflate':![]});var _0x2266cf='';var _0x55875d='0';var _0x1db0db='1';var _0x1afff9=_0x9d3c('0x9');function _0x2632b0(_0x3d09d5){var _0x1b00bb=crypto[_0x9d3c('0xa')](_0x9d3c('0xb'));_0x1b00bb[_0x9d3c('0xc')](_0x3d09d5);return _0x1b00bb[_0x9d3c('0xd')](_0x9d3c('0xe'));}function _0x3e66a5(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0x287ea2=moment()[_0x9d3c('0xf')]();var _0x34b9a2=_0x2632b0(_0x287ea2+_0x5865bc+_0x47a143);_0x5885aa[_0x9d3c('0x10')](JSON[_0x9d3c('0x11')]({'appID':_0x5865bc,'timestamp':_0x287ea2,'appKey':_0x34b9a2}));var _0x550518=fs[_0x9d3c('0x12')](_0x53f98e);_0x550518['on']('data',function(_0x217c11){_0x5885aa[_0x9d3c('0x10')](_0x217c11);});_0x550518['on'](_0x9d3c('0x13'),function(){_0x5885aa[_0x9d3c('0x10')](_0x9d3c('0x14'));});}catch(_0x2159d8){logger[_0x9d3c('0x15')]('Tilde\x20ASR\x20send\x20error',JSON[_0x9d3c('0x11')](_0x2159d8));_0x5885aa[_0x9d3c('0x16')]();}}function _0x2c7417(_0x4d7ae7){try{if(_0x4d7ae7){var _0x477553=JSON['parse'](_0x4d7ae7);switch(_0x477553[_0x9d3c('0x17')]){case 0x0:if(_0x477553[_0x9d3c('0x18')]){if(_0x477553[_0x9d3c('0x18')][_0x9d3c('0x19')]){logger[_0x9d3c('0x6')](_0x9d3c('0x1a'),JSON[_0x9d3c('0x11')](_0x477553['result'][_0x9d3c('0x1b')]));_0x2266cf=_0x477553['result'][_0x9d3c('0x1b')][0x0]['transcript'];_0x55875d=_0x477553[_0x9d3c('0x18')][_0x9d3c('0x1b')][0x0][_0x9d3c('0x1c')];_0x1db0db='0';_0x1afff9=_0x9d3c('0x1d');_0x5885aa['terminate']();}}break;case 0x1:logger['info'](_0x9d3c('0x9'));_0x1db0db='1';_0x1afff9=_0x9d3c('0x9');break;case 0x2:logger[_0x9d3c('0x6')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x1db0db='2';_0x1afff9=_0x9d3c('0x1e');break;case 0x9:logger[_0x9d3c('0x6')](_0x9d3c('0x1f'));_0x1db0db='9';_0x1afff9='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x9d3c('0x6')](_0x9d3c('0x20'));_0x1db0db='10';_0x1afff9=_0x9d3c('0x20');break;case 0xb:logger[_0x9d3c('0x6')](_0x9d3c('0x21'));_0x1db0db='11';_0x1afff9='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x226bba){logger[_0x9d3c('0x15')](_0x9d3c('0x22'),JSON['stringify'](_0x226bba));_0x5885aa[_0x9d3c('0x16')]();}}function _0xf3f8a6(){logger[_0x9d3c('0x6')](_0x9d3c('0x23'));_0x3cefb9({'transcript':_0x2266cf,'confidence':_0x55875d,'status':_0x1db0db,'status_message':_0x1afff9});}function _0xf67feb(_0x58ef27){logger['error']('Error\x20Tilde\x20ASR\x20socket');if(!_['isNil'](_0x58ef27)){logger[_0x9d3c('0x15')](_[_0x9d3c('0x24')](_0x58ef27)?JSON[_0x9d3c('0x11')](_0x58ef27):_0x58ef27);}}_0x5885aa['on']('open',_0x3e66a5);_0x5885aa['on'](_0x9d3c('0x25'),_0x2c7417);_0x5885aa['on'](_0x9d3c('0x13'),_0xf3f8a6);_0x5885aa['on']('error',_0xf67feb);});}; \ 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 b52065a..c07559d 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 _0x38fe=['./asr'];(function(_0x3f36bc,_0x30d5d1){var _0x543ab5=function(_0xa0e9a2){while(--_0xa0e9a2){_0x3f36bc['push'](_0x3f36bc['shift']());}};_0x543ab5(++_0x30d5d1);}(_0x38fe,0x198));var _0xe38f=function(_0x4dea16,_0x227a57){_0x4dea16=_0x4dea16-0x0;var _0x5a6ce4=_0x38fe[_0x4dea16];return _0x5a6ce4;};var asr=require(_0xe38f('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0xf055=['exports','./asr'];(function(_0x5d7aea,_0xf498b9){var _0x3f61c8=function(_0x937752){while(--_0x937752){_0x5d7aea['push'](_0x5d7aea['shift']());}};_0x3f61c8(++_0xf498b9);}(_0xf055,0xe1));var _0x5f05=function(_0xf3e4a0,_0x16a172){_0xf3e4a0=_0xf3e4a0-0x0;var _0x43f1cc=_0xf055[_0xf3e4a0];return _0x43f1cc;};var asr=require(_0x5f05('0x0'));module[_0x5f05('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index af04558..4aeb216 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 _0xc1ef=['ready','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','./error','./channel','127.0.0.1','emit','listen','listening','connection','error','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','E_AGI_SERVER_MAXCONNECTION'];(function(_0x344a65,_0x1b89c4){var _0x1fc9ce=function(_0x14996e){while(--_0x14996e){_0x344a65['push'](_0x344a65['shift']());}};_0x1fc9ce(++_0x1b89c4);}(_0xc1ef,0x182));var _0xfc1e=function(_0xdade7e,_0x3e99e0){_0xdade7e=_0xdade7e-0x0;var _0x29f5ff=_0xc1ef[_0xdade7e];return _0x29f5ff;};'use strict';var util=require(_0xfc1e('0x0'));var net=require(_0xfc1e('0x1'));var EventEmitter=require('events')['EventEmitter'];var AGIError=require(_0xfc1e('0x2'));var AGIChannel=require(_0xfc1e('0x3'));var AGIServer=function(_0x5406da,_0x325aae,_0x26483f){var _0x5a9650=this,_0x5406da=_0x5406da||0x11dd,_0x325aae=_0x325aae||_0xfc1e('0x4'),_0x16dd65=null,_0xd020ba=0x0;EventEmitter['call'](_0x5a9650);function _0x3095e4(){if(!_0x5406da){_0x5a9650[_0xfc1e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x16dd65=net['createServer']();_0x16dd65[_0xfc1e('0x6')](_0x5406da,_0x325aae);_0x16dd65['on'](_0xfc1e('0x7'),function(){_0x5a9650['emit'](_0xfc1e('0x7'));});_0x16dd65['on'](_0xfc1e('0x8'),function(_0x3f17a1){_0x16dd65['getConnections'](function(_0x3f1054,_0x2e6f39){if(_0x3f1054){_0x5a9650[_0xfc1e('0x5')](_0xfc1e('0x9'),new AGIError(_0xfc1e('0xa'),_0x3f1054));}else if(_0x26483f&&_0x26483f<0x0){_0x5a9650[_0xfc1e('0x5')](_0xfc1e('0x9'),new AGIError(_0xfc1e('0xb')));_0x3f17a1['destroy']();}else if(_0x26483f&&_0x26483f>0x0&&_0x26483f<_0x2e6f39){_0xd020ba+=0x1;_0x5a9650[_0xfc1e('0x5')](_0xfc1e('0x9'),new AGIError(_0xfc1e('0xc'),_0xd020ba));_0x3f17a1['destroy']();}else{var _0x398aef=new AGIChannel(_0x3f17a1);_0x398aef['on'](_0xfc1e('0xd'),function(){_0x5a9650['emit'](_0xfc1e('0x8'),_0x398aef);});}});});_0x16dd65['on'](_0xfc1e('0x9'),function(_0x2533f2){_0x5a9650['emit'](_0xfc1e('0x9'),new AGIError('E_AGI_SERVER_ERROR',_0x2533f2['code']));});_0x16dd65['on'](_0xfc1e('0xe'),function(){_0x5a9650[_0xfc1e('0x5')](_0xfc1e('0xe'),new AGIError(_0xfc1e('0xf')));});}process[_0xfc1e('0x10')](function(){_0x3095e4();});};util[_0xfc1e('0x11')](AGIServer,EventEmitter);module[_0xfc1e('0x12')]=function(_0x50f97f,_0x5978a1,_0x5b168a){return new AGIServer(_0x50f97f,_0x5978a1,_0x5b168a);}; \ No newline at end of file +var _0xf6fb=['E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','events','./error','./channel','call','emit','createServer','listening','E_AGI_SERVER_ERROR','error','E_AGI_SERVER_VOICE_DISABLED','destroy','ready','connection','close'];(function(_0x2e40f5,_0x4c5d49){var _0x16b46f=function(_0x4f37c3){while(--_0x4f37c3){_0x2e40f5['push'](_0x2e40f5['shift']());}};_0x16b46f(++_0x4c5d49);}(_0xf6fb,0xf4));var _0xbf6f=function(_0x1c8b1d,_0x19f62f){_0x1c8b1d=_0x1c8b1d-0x0;var _0x942de9=_0xf6fb[_0x1c8b1d];return _0x942de9;};'use strict';var util=require(_0xbf6f('0x0'));var net=require(_0xbf6f('0x1'));var EventEmitter=require(_0xbf6f('0x2'))['EventEmitter'];var AGIError=require(_0xbf6f('0x3'));var AGIChannel=require(_0xbf6f('0x4'));var AGIServer=function(_0x4640e7,_0x312ee5,_0x85ad9){var _0x3c9ab0=this,_0x4640e7=_0x4640e7||0x11dd,_0x312ee5=_0x312ee5||'127.0.0.1',_0x35f507=null,_0x5ad888=0x0;EventEmitter[_0xbf6f('0x5')](_0x3c9ab0);function _0x3fd333(){if(!_0x4640e7){_0x3c9ab0[_0xbf6f('0x6')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x35f507=net[_0xbf6f('0x7')]();_0x35f507['listen'](_0x4640e7,_0x312ee5);_0x35f507['on']('listening',function(){_0x3c9ab0[_0xbf6f('0x6')](_0xbf6f('0x8'));});_0x35f507['on']('connection',function(_0x13d200){_0x35f507['getConnections'](function(_0x217147,_0xb5c83b){if(_0x217147){_0x3c9ab0[_0xbf6f('0x6')]('error',new AGIError(_0xbf6f('0x9'),_0x217147));}else if(_0x85ad9&&_0x85ad9<0x0){_0x3c9ab0[_0xbf6f('0x6')](_0xbf6f('0xa'),new AGIError(_0xbf6f('0xb')));_0x13d200[_0xbf6f('0xc')]();}else if(_0x85ad9&&_0x85ad9>0x0&&_0x85ad9<_0xb5c83b){_0x5ad888+=0x1;_0x3c9ab0[_0xbf6f('0x6')](_0xbf6f('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x5ad888));_0x13d200['destroy']();}else{var _0x38dfaf=new AGIChannel(_0x13d200);_0x38dfaf['on'](_0xbf6f('0xd'),function(){_0x3c9ab0[_0xbf6f('0x6')](_0xbf6f('0xe'),_0x38dfaf);});}});});_0x35f507['on'](_0xbf6f('0xa'),function(_0x4a9391){_0x3c9ab0[_0xbf6f('0x6')](_0xbf6f('0xa'),new AGIError(_0xbf6f('0x9'),_0x4a9391['code']));});_0x35f507['on']('close',function(){_0x3c9ab0['emit'](_0xbf6f('0xf'),new AGIError(_0xbf6f('0x10')));});}process[_0xbf6f('0x11')](function(){_0x3fd333();});};util[_0xbf6f('0x12')](AGIServer,EventEmitter);module[_0xbf6f('0x13')]=function(_0x57f21f,_0x8f5896,_0x1fdad6){return new AGIServer(_0x57f21f,_0x8f5896,_0x1fdad6);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index de5dc63..6bea9ee 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 _0x24ee=['Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','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','getSquareOdbc','odbc_id','no\x20query\x20configured','replace','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','setVariable','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','opts','Executed\x20command\x20%s','dialogflow','speech','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','Trying\x20DialogflowV2:\x20%s','providerResponse','DIALOGFLOW_%s','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','bot','out','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','first','getsecretdigits','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','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','unlink','.wav','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','message','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','%s/recordings/%s','beep','NOBEEP','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','recordFile','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','intKey','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','streamFile','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','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','AGENT\x20%s\x20NOT\x20FOUND\x20BY','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','failure','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','position','record','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','Response:','inspect','%s_STATUS_CODE','200','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','Smtp','user','bcc','subject','service','host','port','secure','authentication','auth','pass','template_id','debug','sendMail\x20message','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','apiKey','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','googleTTS','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','shelljs','mustache','request-promise','../../config/logger','./scripts','rawHeaders','rawBody','menu','getdigits','channel','mailRpc','prototype','getVariable','rpc','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','map','interval','format','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','agicommand','arg_1','callerid','createSquareRecording','uniqueid','calleridname','context','extension','priority','accountcode','dnid','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','isNil','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','agentPause','agentUnpause','agentLogout','agent','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','audioEncoding','google_tts_language','url','method','number','timeout','includes','POST','PUT','toUpperCase','body','parse','computedVariables','sync','uri','render','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_secret_access_key','awsLex','aws_bot_name','googleASR','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','%s.%s','saveRestApiResult','split','replaceAll','extra','result','isConfigured','maxRetry','retry','mrcpsynth','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','getAndSetVariable','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','no\x20list\x20selected','delay','add','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts'];(function(_0xf973b7,_0x46699f){var _0x499087=function(_0x45b42f){while(--_0x45b42f){_0xf973b7['push'](_0xf973b7['shift']());}};_0x499087(++_0x46699f);}(_0x24ee,0x109));var _0xe24e=function(_0x17cb63,_0x4c0e90){_0x17cb63=_0x17cb63-0x0;var _0x4340bc=_0x24ee[_0x17cb63];return _0x4340bc;};'use strict';var fs=require('fs');var path=require(_0xe24e('0x0'));var util=require('util');var _=require('lodash');var sh=require(_0xe24e('0x1'));var odbc=require('odbc')();var rs=require('randomstring');var moment=require('moment');var Mustache=require(_0xe24e('0x2'));var rp=require(_0xe24e('0x3'));var logger=require(_0xe24e('0x4'))('agi');var config=require('../../config/environment');var scripts=require(_0xe24e('0x5'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0xe24e('0x6'),_0xe24e('0x7')];var verticesWithRetry=[_0xe24e('0x8'),_0xe24e('0x9'),'getsecretdigits'];var AGIVertices=function(_0x7d15cb,_0x413ac3,_0x4821f4){this[_0xe24e('0xa')]=_0x7d15cb;this['rpc']=_0x413ac3;this[_0xe24e('0xb')]=_0x4821f4;};AGIVertices[_0xe24e('0xc')][_0xe24e('0xd')]=function(_0x5cbf57,_0xae9863){this[_0xe24e('0xe')]['getVariableById'](_0x5cbf57)[_0xe24e('0xf')](function(_0x2d4d1b){_0xae9863(null,_0x2d4d1b?_0x2d4d1b[_0xe24e('0x10')]:![]);})[_0xe24e('0x11')](function(_0x5a0c84){_0xae9863(_0x5a0c84);});};AGIVertices['prototype'][_0xe24e('0x12')]=function(_0x3e169e,_0x297caa){this[_0xe24e('0xe')][_0xe24e('0x13')](_0x3e169e)['then'](function(_0x15b1ed){_0x297caa(null,_0x15b1ed?_0x15b1ed[_0xe24e('0x10')]:![]);})['catch'](function(_0x436b58){_0x297caa(_0x436b58);});};AGIVertices[_0xe24e('0xc')][_0xe24e('0x14')]=function(_0x332486,_0x50e439){this['rpc'][_0xe24e('0x15')](_0x332486)['then'](function(_0x3bfcf6){_0x50e439(null,_0x3bfcf6?_0x3bfcf6[_0xe24e('0x10')]:![]);})['catch'](function(_0x501805){_0x50e439(_0x501805);});};AGIVertices[_0xe24e('0xc')]['getSquareOdbc']=function(_0x5f27ef,_0x47e921){this[_0xe24e('0xe')][_0xe24e('0x16')](_0x5f27ef)['then'](function(_0x58f0aa){_0x47e921(null,_0x58f0aa?_0x58f0aa['dsn']:![]);})[_0xe24e('0x11')](function(_0x586bec){_0x47e921(_0x586bec);});};AGIVertices[_0xe24e('0xc')][_0xe24e('0x17')]=function(_0x39dade,_0x215eef){this[_0xe24e('0xe')][_0xe24e('0x18')](_0x39dade)[_0xe24e('0xf')](function(_0x2bb435){_0x215eef(null,_0x2bb435?_0x2bb435[_0xe24e('0x10')]:![]);})[_0xe24e('0x11')](function(_0x4ddb8f){_0x215eef(_0x4ddb8f);});};AGIVertices[_0xe24e('0xc')][_0xe24e('0x19')]=function(_0x1fb6fe,_0x309e2d){this[_0xe24e('0xe')][_0xe24e('0x1a')](_0x1fb6fe)[_0xe24e('0xf')](function(_0x50e593){_0x309e2d(null,_0x50e593?_0x50e593['name']:![]);})['catch'](function(_0x54a059){_0x309e2d(_0x54a059);});};AGIVertices[_0xe24e('0xc')][_0xe24e('0x1b')]=function(_0x3a1264,_0x5c58a3){var _0x4394e8=this;this[_0xe24e('0xe')][_0xe24e('0x1c')](_0x3a1264)[_0xe24e('0xf')](function(_0x542d3c){_0x5c58a3(null,_0x542d3c?_0x4394e8[_0xe24e('0x1d')](_0x542d3c[_0xe24e('0x1e')]):![]);})['catch'](function(_0x30ace1){_0x5c58a3(_0x30ace1);});};AGIVertices[_0xe24e('0xc')][_0xe24e('0x1f')]=function(_0x2836fc,_0x5f5736){this[_0xe24e('0xe')][_0xe24e('0x20')](_0x2836fc)[_0xe24e('0xf')](function(_0x358acd){_0x5f5736(null,_0x358acd?_0x358acd:![]);})[_0xe24e('0x11')](function(_0x110d48){_0x5f5736(_0x110d48);});};AGIVertices['prototype'][_0xe24e('0x21')]=function(_0x355dde,_0xec20ce,_0x1525c4){this[_0xe24e('0xb')][_0xe24e('0x21')](_0x355dde,_0xec20ce)['then'](function(){_0x1525c4(null);})[_0xe24e('0x11')](function(_0x4b5f89){_0x1525c4(_0x4b5f89);});};AGIVertices[_0xe24e('0xc')][_0xe24e('0x22')]=function(_0x479b3f,_0x2fbfa9){this['rpc'][_0xe24e('0x23')](_0x479b3f)[_0xe24e('0xf')](function(_0x58ab4d){if(_0x58ab4d){if(_0x58ab4d[_0xe24e('0x24')]){_0x2fbfa9(null,[_0x58ab4d['interval']]);}else{_0x2fbfa9(null,_[_0xe24e('0x25')](_0x58ab4d['Intervals'],_0xe24e('0x26')));}}else{_0x2fbfa9(null,![]);}})[_0xe24e('0x11')](function(_0x1f67f0){_0x2fbfa9(_0x1f67f0);});};AGIVertices[_0xe24e('0xc')][_0xe24e('0x1d')]=function(_0x572499){return util[_0xe24e('0x27')](_0xe24e('0x28'),FILES_PATH,_0x572499);};AGIVertices[_0xe24e('0xc')][_0xe24e('0x29')]=function(_0x22f122,_0xdea705,_0x4cbacb){odbc['open'](_0x22f122,function(_0x542c32){if(_0x542c32){logger[_0xe24e('0x2a')](_0xe24e('0x2b'),_0x542c32);_0x4cbacb(_0x542c32);}else{logger[_0xe24e('0x2c')](_0xe24e('0x2d'));odbc[_0xe24e('0x2e')](_0xdea705,function(_0x407b0f,_0x192237){if(_0x407b0f){logger[_0xe24e('0x2c')]('Error\x20executing\x20query\x20%s',_0xdea705);_0x4cbacb(_0x407b0f);}else{logger['info'](_0xe24e('0x2f'),_0xdea705);odbc[_0xe24e('0x30')](function(_0x5d19fb){if(_0x5d19fb){logger[_0xe24e('0x2a')](_0xe24e('0x31'),_0x5d19fb);}_0x4cbacb(null,_0x192237);});}});}});};AGIVertices[_0xe24e('0xc')][_0xe24e('0x32')]=function(_0x5acceb,_0x3e2230){this[_0xe24e('0xe')][_0xe24e('0x33')](_0x5acceb)['then'](function(_0x25c787){_0x3e2230(null,_0x25c787?_0x25c787:![]);})['catch'](function(_0x29805d){_0x3e2230(_0x29805d);});};AGIVertices[_0xe24e('0xc')][_0xe24e('0x34')]=function(_0x301fab,_0x429ff1){this[_0xe24e('0xe')][_0xe24e('0x34')](_0x301fab)[_0xe24e('0xf')](function(_0x33ef63){_0x429ff1(null,_0x33ef63);})[_0xe24e('0x11')](function(_0x30452e){_0x429ff1(_0x30452e);});};AGIVertices[_0xe24e('0xc')]['createSquareDetailsReport']=function(_0x264ff8,_0x5ca958,_0x4c61fc){this['rpc'][_0xe24e('0x35')]({'uniqueid':this['channel']['uniqueid'],'node':_0x264ff8[_0xe24e('0x36')],'application':_0x264ff8[_0xe24e('0x37')],'data':_0x5ca958||null,'project_name':this[_0xe24e('0xa')][_0xe24e('0x38')],'callerid':this['channel'][_0xe24e('0x39')]})[_0xe24e('0xf')](function(_0x486ba2){if(_0x4c61fc){_0x4c61fc(null,_0x486ba2);}})['catch'](function(_0x5a8702){if(_0x4c61fc){_0x4c61fc(_0x5a8702);}});};AGIVertices['prototype'][_0xe24e('0x3a')]=function(_0x49baf0,_0x53be76,_0x10be65,_0x3303e0){this[_0xe24e('0xe')][_0xe24e('0x3a')]({'uniqueid':this[_0xe24e('0xa')][_0xe24e('0x3b')],'callerid':this[_0xe24e('0xa')][_0xe24e('0x39')],'calleridname':this['channel'][_0xe24e('0x3c')],'context':this[_0xe24e('0xa')][_0xe24e('0x3d')],'extension':this['channel'][_0xe24e('0x3e')],'priority':this[_0xe24e('0xa')][_0xe24e('0x3f')],'accountcode':this['channel'][_0xe24e('0x40')],'dnid':this[_0xe24e('0xa')][_0xe24e('0x41')],'projectName':this[_0xe24e('0xa')][_0xe24e('0x38')],'saveName':_0x53be76,'filename':_0x49baf0['file']||_0x53be76,'savePath':_0x10be65})[_0xe24e('0xf')](function(_0x21b41d){_0x3303e0(null,_0x21b41d);})[_0xe24e('0x11')](function(_0x302380){_0x3303e0(_0x302380);});};AGIVertices[_0xe24e('0xc')][_0xe24e('0x42')]=function(_0x39e6c0,_0x4f36e3,_0xc9fbc3,_0x4455d1,_0x41363a){this[_0xe24e('0xe')][_0xe24e('0x42')]({'uniqueid':this['channel'][_0xe24e('0x3b')],'body':_0x39e6c0,'direction':_0x4f36e3,'providerName':_0xc9fbc3,'providerResponse':_0x4455d1})['then'](function(_0x381ff5){if(_0x41363a){_0x41363a(null,_0x381ff5);}})[_0xe24e('0x11')](function(_0x58cea8){if(_0x41363a){_0x41363a(_0x58cea8);}});};AGIVertices[_0xe24e('0xc')][_0xe24e('0x43')]=function(_0x4a812d,_0x33493d){this['rpc'][_0xe24e('0x43')]({'firstName':_[_0xe24e('0x44')](_0x4a812d[_0xe24e('0x10')])||_['isNil'](_0x4a812d[_0xe24e('0x10')])?_0xe24e('0x45')+Math[_0xe24e('0x46')]():_0x4a812d[_0xe24e('0x10')],'lastName':_[_0xe24e('0x44')](_0x4a812d[_0xe24e('0x47')])||_[_0xe24e('0x48')](_0x4a812d[_0xe24e('0x47')])?null:_0x4a812d[_0xe24e('0x47')],'phone':_0x4a812d[_0xe24e('0x49')],'ListId':_0x4a812d[_0xe24e('0x4a')],'scheduledat':_0x4a812d[_0xe24e('0x4b')],'callbackUniqueid':this[_0xe24e('0xa')][_0xe24e('0x3b')],'tags':_0xe24e('0x4c'),'description':_0xe24e('0x4d')+_0x4a812d[_0xe24e('0x4b')][_0xe24e('0x4e')](),'priority':_0x4a812d[_0xe24e('0x4f')]})[_0xe24e('0xf')](function(_0x5e6a72){_0x33493d(null,_0x5e6a72);})[_0xe24e('0x11')](function(_0x3216f0){_0x33493d(_0x3216f0);});};AGIVertices['prototype'][_0xe24e('0x50')]=function(_0x2284d7,_0x304bb6){this[_0xe24e('0xe')]['getPauseById'](_0x2284d7)['then'](function(_0x5ca27c){_0x304bb6(null,_0x5ca27c?_0x5ca27c[_0xe24e('0x10')]:![]);})[_0xe24e('0x11')](function(_0xba48c7){_0x304bb6(_0xba48c7);});};AGIVertices['prototype'][_0xe24e('0x51')]=function(_0x53c207,_0x3cf498,_0xde526){var _0x3c30e3={'role':'agent'};_0x3c30e3[_0x53c207]=this['channel'][_0xe24e('0x39')];this[_0xe24e('0xe')][_0xe24e('0x51')](_0x3c30e3,_0x3cf498,this[_0xe24e('0xa')]['uniqueid'])[_0xe24e('0xf')](function(_0x29752b){_0xde526(null,_[_0xe24e('0x48')](_0x29752b)?![]:!![]);})['catch'](function(_0x24c9c3){logger['error'](_0x24c9c3);_0xde526(null,![]);});};AGIVertices[_0xe24e('0xc')][_0xe24e('0x52')]=function(_0x33a997,_0x48e8d2){var _0x414dcd={'role':'agent'};_0x414dcd[_0x33a997]=this['channel'][_0xe24e('0x39')];this['rpc'][_0xe24e('0x52')](_0x414dcd)[_0xe24e('0xf')](function(_0x6d559e){_0x48e8d2(null,_['isNil'](_0x6d559e)?![]:!![]);})[_0xe24e('0x11')](function(_0x45c962){logger[_0xe24e('0x2a')](_0x45c962);_0x48e8d2(null,![]);});};AGIVertices[_0xe24e('0xc')][_0xe24e('0x53')]=function(_0x23bcdf,_0x52aa21){var _0x108b8b={'role':_0xe24e('0x54')};_0x108b8b[_0x23bcdf]=this[_0xe24e('0xa')][_0xe24e('0x39')];this[_0xe24e('0xe')][_0xe24e('0x53')](_0x108b8b)[_0xe24e('0xf')](function(_0x2f97d7){_0x52aa21(null,_[_0xe24e('0x48')](_0x2f97d7)?![]:!![]);})['catch'](function(_0x23f012){logger['error'](_0x23f012);_0x52aa21(null,![]);});};AGIVertices[_0xe24e('0xc')][_0xe24e('0x55')]=function(_0x399797,_0x58e82a){var _0x44e885={'role':_0xe24e('0x54')};_0x44e885[_0x399797]=this[_0xe24e('0xa')][_0xe24e('0x39')];var _0x4463fd=_0x399797!=_0xe24e('0x56')?util['format'](_0xe24e('0x57'),_0xe24e('0x58'),this['channel'][_0xe24e('0x39')]):undefined;this[_0xe24e('0xe')]['agentLogin'](_0x44e885,_0x4463fd)[_0xe24e('0xf')](function(_0xa0524c){_0x58e82a(null,_[_0xe24e('0x48')](_0xa0524c)?![]:!![]);})['catch'](function(_0x1919e7){logger[_0xe24e('0x2a')](_0x1919e7);_0x58e82a(null,![]);});};AGIVertices[_0xe24e('0xc')][_0xe24e('0x59')]=function(_0x5c7207,_0x2f72b4){sh[_0xe24e('0x5a')](_[_0xe24e('0x5b')](_0x5c7207),function(_0x4e3b0c,_0xba9dc6){var _0x5e9879=_0xba9dc6['replace'](/(\r\n|\n|\r)/gm,'');_0x2f72b4(null,_0x5e9879);});};AGIVertices[_0xe24e('0xc')][_0xe24e('0x5c')]=function(_0x309993,_0x4d0384){scripts[_0xe24e('0x5c')](_0x309993['apiKey'],_0x309993[_0xe24e('0x5d')]||_0xe24e('0x5e'),_0x309993[_0xe24e('0x5e')],_0x309993[_0xe24e('0x5f')]||_0xe24e('0x60'),_0x309993['ssmlGender']||'MALE',_0x309993[_0xe24e('0x61')]||'MP3')[_0xe24e('0xf')](function(_0x45168c){_0x4d0384(null,_0x45168c);})[_0xe24e('0x11')](function(_0x2ecc36){_0x4d0384(_0x2ecc36);});};AGIVertices[_0xe24e('0xc')]['googleTTS']=function(_0x4efcb2,_0xb11c4f){scripts['googleTTS'](_0x4efcb2['text'],_0x4efcb2[_0xe24e('0x62')]||'en',0x1)[_0xe24e('0xf')](function(_0x3956ab){_0xb11c4f(null,_0x3956ab);})[_0xe24e('0x11')](function(_0x1acaf5){_0xb11c4f(_0x1acaf5);});};AGIVertices[_0xe24e('0xc')]['restAPI']=function(_0x6b4cbe,_0xd54b18){var _0x3afc7d={'uri':_0x6b4cbe[_0xe24e('0x63')],'method':_0x6b4cbe[_0xe24e('0x64')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x6b4cbe['timeout'])===_0xe24e('0x65')&&parseInt(_0x6b4cbe[_0xe24e('0x66')])>=0x1?parseInt(_0x6b4cbe['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xe24e('0x67')]([_0xe24e('0x68'),_0xe24e('0x69')],_0x3afc7d[_0xe24e('0x64')][_0xe24e('0x6a')]())){try{_0x3afc7d[_0xe24e('0x6b')]=_0x6b4cbe[_0xe24e('0x7')]?JSON[_0xe24e('0x6c')](_0x6b4cbe[_0xe24e('0x7')]):{};}catch(_0x1408f3){logger[_0xe24e('0x2a')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1408f3);}}try{_0x3afc7d['headers']=_0x6b4cbe[_0xe24e('0x6')]?JSON[_0xe24e('0x6c')](_0x6b4cbe['rawHeaders']):{};}catch(_0xbaba7d){logger[_0xe24e('0x2a')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0xbaba7d);}if(_0x6b4cbe[_0xe24e('0x6d')]){try{var _0x1bfcec=require(_0x6b4cbe[_0xe24e('0x6d')])[_0xe24e('0x6e')](this,_0x3afc7d);_0x3afc7d[_0xe24e('0x6f')]=Mustache[_0xe24e('0x70')](_0x6b4cbe[_0xe24e('0x63')],_0x1bfcec,{},['$$','$$']);if(_0x3afc7d[_0xe24e('0x71')]){_0x3afc7d['headers']=JSON[_0xe24e('0x6c')](Mustache['render'](JSON[_0xe24e('0x72')](_0x3afc7d[_0xe24e('0x71')]),_0x1bfcec,{},['$$','$$']));}if(_0x3afc7d['body']){_0x3afc7d[_0xe24e('0x6b')]=JSON[_0xe24e('0x6c')](Mustache['render'](JSON[_0xe24e('0x72')](_0x3afc7d['body']),_0x1bfcec,{},['$$','$$']));}}catch(_0x379f54){logger['error'](_0xe24e('0x73'),_0x379f54);}}rp(_0x3afc7d)[_0xe24e('0xf')](function(_0x28b12e){var _0x3f2536={'statusCode':_0x28b12e[_0xe24e('0x74')]||0xc8,'statusMessage':_0x28b12e['statusMessage']||'OK','headers':_0x28b12e[_0xe24e('0x71')]||{},'body':_0x28b12e[_0xe24e('0x6b')]||{}};_0xd54b18(null,_0x3f2536);})['catch'](function(_0x466c57){var _0x2e9c2b={'statusCode':_0x466c57[_0xe24e('0x74')]||0x1f4,'statusMessage':_0x466c57['message']||_0xe24e('0x75'),'headers':_0x466c57[_0xe24e('0x76')][_0xe24e('0x71')]||{},'body':_0x466c57[_0xe24e('0x76')][_0xe24e('0x6b')]||{}};_0xd54b18(null,_0x2e9c2b);});};AGIVertices[_0xe24e('0xc')][_0xe24e('0x77')]=function(_0x49b2f0,_0x106e90){scripts[_0xe24e('0x77')](this['channel']['uniqueid'],_0x49b2f0[_0xe24e('0x78')],_0x49b2f0['text'],_0x49b2f0[_0xe24e('0x79')]||'en')['then'](function(_0xcf52c5){_0x106e90(null,_0xcf52c5);})[_0xe24e('0x11')](function(_0xe8e228){_0x106e90(_0xe8e228);});};AGIVertices[_0xe24e('0xc')][_0xe24e('0x7a')]=function(_0x3341f1,_0x59fdc4){scripts[_0xe24e('0x7a')](this[_0xe24e('0xa')]['uniqueid'],_0x3341f1[_0xe24e('0x7b')],_0x3341f1[_0xe24e('0x7c')],_0x3341f1[_0xe24e('0x7d')],_0x3341f1[_0xe24e('0x5e')],_0x3341f1[_0xe24e('0x7e')]||'en')[_0xe24e('0xf')](function(_0xf4bd6a){_0x59fdc4(null,_0xf4bd6a);})[_0xe24e('0x11')](function(_0x3a05ac){_0x59fdc4(_0x3a05ac);});};AGIVertices[_0xe24e('0xc')][_0xe24e('0x7f')]=function(_0x10d5a7,_0x18197a){scripts[_0xe24e('0x7f')](this[_0xe24e('0xa')],_0x10d5a7)['then'](function(_0x5651c1){_0x18197a(null,_0x5651c1);})[_0xe24e('0x11')](function(_0x374ab6){_0x18197a(_0x374ab6);});};AGIVertices['prototype'][_0xe24e('0x80')]=function(_0x4de08e,_0x172952){scripts['ispeechTTS'](_0x4de08e[_0xe24e('0x78')],_0x4de08e['text'],_0x4de08e['ispeech_tts_language']||_0xe24e('0x60'),_0x4de08e[_0xe24e('0x81')])[_0xe24e('0xf')](function(_0x5d2d01){_0x172952(null,_0x5d2d01);})['catch'](function(_0xc5496a){_0x172952(_0xc5496a);});};AGIVertices[_0xe24e('0xc')][_0xe24e('0x82')]=function(_0x292ee7,_0x3b2a2b,_0x17a9d3){scripts[_0xe24e('0x82')](_0x3b2a2b,_0x292ee7['key'],_0x292ee7[_0xe24e('0x83')]||'en-US',this['isConfigured'](_0x292ee7[_0xe24e('0x84')])?_0x292ee7[_0xe24e('0x84')]:undefined)[_0xe24e('0xf')](function(_0x44d830){_0x17a9d3(null,_0x44d830);})['catch'](function(_0x18aec3){_0x17a9d3(_0x18aec3);});};AGIVertices['prototype'][_0xe24e('0x85')]=function(_0x375cf6,_0x1df871){scripts[_0xe24e('0x85')](_0x375cf6[_0xe24e('0x86')],_0x375cf6[_0xe24e('0x87')],_0x375cf6['aws_polly_region'],_0x375cf6['aws_polly_voice']||'Amy',_0x375cf6['text'],_0x375cf6['aws_text_type']||_0xe24e('0x5e'))[_0xe24e('0xf')](function(_0x2524c2){_0x1df871(null,_0x2524c2);})[_0xe24e('0x11')](function(_0x17af74){_0x1df871(_0x17af74);});};AGIVertices['prototype'][_0xe24e('0x88')]=function(_0x29ea64,_0x2ec93a){scripts[_0xe24e('0x88')](this[_0xe24e('0xa')][_0xe24e('0x3b')],_0x29ea64[_0xe24e('0x86')],_0x29ea64['aws_secret_access_key'],_0x29ea64['aws_lex_region'],_0x29ea64[_0xe24e('0x5e')],_0x29ea64[_0xe24e('0x89')])['then'](function(_0x3cbd86){_0x2ec93a(null,_0x3cbd86);})['catch'](function(_0x7a2b9e){_0x2ec93a(_0x7a2b9e);});};AGIVertices['prototype'][_0xe24e('0x8a')]=function(_0x2c352d,_0x13cb8f,_0x524fa5){scripts[_0xe24e('0x8a')](_0x13cb8f,_0x2c352d[_0xe24e('0x78')],_0x2c352d['google_asr_language']||_0xe24e('0x60'))['then'](function(_0x3e4b2d){_0x524fa5(null,_0x3e4b2d);})[_0xe24e('0x11')](function(_0xf47e1a){_0x524fa5(_0xf47e1a);});};AGIVertices[_0xe24e('0xc')][_0xe24e('0x8b')]=function(_0x38c172,_0x35a549,_0x27e834){scripts[_0xe24e('0x8b')](_0x35a549,_0x38c172[_0xe24e('0x8c')],_0x38c172[_0xe24e('0x8d')],_0x38c172[_0xe24e('0x6f')])[_0xe24e('0xf')](function(_0x514061){_0x27e834(null,_0x514061);})[_0xe24e('0x11')](function(_0xd6ea07){_0x27e834(_0xd6ea07);});};AGIVertices['prototype'][_0xe24e('0x8e')]=function(_0xb2818b){var _0x3e68b5=_[_0xe24e('0x67')](verticesWithRetry,_0xb2818b[_0xe24e('0x37')])?_0xb2818b:_[_0xe24e('0x8f')](_0xb2818b);for(var _0x70c26 in _0x3e68b5){if(_0x3e68b5[_0xe24e('0x90')](_0x70c26)){if(_0x3e68b5[_0x70c26]&&_[_0xe24e('0x91')](_0x3e68b5[_0x70c26])){if(_[_0xe24e('0x67')](recursiveMapAttributes,_0x70c26)){_0x3e68b5[_0x70c26]=this[_0xe24e('0x92')](_0x3e68b5[_0x70c26]);}else{_0x3e68b5[_0x70c26]=this[_0xe24e('0x93')](_0x3e68b5[_0x70c26]);}}}}return _0x3e68b5;};AGIVertices[_0xe24e('0xc')][_0xe24e('0x94')]=function(_0x28a823){for(var _0x2c05bf in _0x28a823){if(_0x28a823[_0xe24e('0x90')](_0x2c05bf)){if(_[_0xe24e('0x95')](_0x28a823[_0x2c05bf])){this[_0xe24e('0x94')](_0x28a823[_0x2c05bf]);}else if(_[_0xe24e('0x96')](_0x28a823[_0x2c05bf])){for(var _0x10e058=0x0;_0x10e058<_0x28a823[_0x2c05bf][_0xe24e('0x97')];_0x10e058++){this['recursiveNodeIndex'](_0x28a823[_0x2c05bf][_0x10e058]);}}else if(_[_0xe24e('0x91')](_0x28a823[_0x2c05bf])){_0x28a823[_0x2c05bf]=this[_0xe24e('0x93')](_0x28a823[_0x2c05bf]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0x1b85ab,_0x17a869){for(var _0x220433 in _0x1b85ab){if(_0x1b85ab[_0xe24e('0x90')](_0x220433)){if(_[_0xe24e('0x95')](_0x1b85ab[_0x220433])){if(!_[_0xe24e('0x44')](_0x1b85ab[_0x220433])){this['saveRestApiResult'](_0x1b85ab[_0x220433],util['format'](_0xe24e('0x98'),_0x17a869,_0x220433));}}else if(_[_0xe24e('0x96')](_0x1b85ab[_0x220433])){for(var _0x10e5fb=0x0;_0x10e5fb<_0x1b85ab[_0x220433][_0xe24e('0x97')];_0x10e5fb++){this[_0xe24e('0x99')](_0x1b85ab[_0x220433][_0x10e5fb],util[_0xe24e('0x27')](_0xe24e('0x98'),_0x17a869,_0x220433+'['+_0x10e5fb+']'));}}else{if(!_['isNil'](_0x1b85ab[_0x220433])){this[_0xe24e('0xa')]['setVariable'](util[_0xe24e('0x27')]('%s.%s',_0x17a869,_0x220433),_0x1b85ab[_0x220433]);}}}}};AGIVertices[_0xe24e('0xc')]['replaceObjectAllVariables']=function(_0xf86ebd){try{var _0x4d6ba9=JSON['parse'](_0xf86ebd);this[_0xe24e('0x94')](_0x4d6ba9);return JSON[_0xe24e('0x72')](_0x4d6ba9);}catch(_0x2307ab){return this[_0xe24e('0x93')](_0xf86ebd);}};AGIVertices[_0xe24e('0xc')][_0xe24e('0x93')]=function(_0x2d30b0){var _0x577b2c=_0x2d30b0[_0xe24e('0x9a')]('{');for(var _0x2329e6=0x1;_0x2329e6<_0x577b2c[_0xe24e('0x97')];_0x2329e6+=0x1){var _0x3e1f5d=_0x577b2c[_0x2329e6]['split']('}');if(_0x3e1f5d[_0xe24e('0x97')]>0x1){_0x2d30b0=_0x2d30b0[_0xe24e('0x9b')]('{'+_0x3e1f5d[0x0]+'}',this[_0xe24e('0xa')]['getVariable'](_0x3e1f5d[0x0])[_0xe24e('0x9c')]||_0x3e1f5d[0x0]);}}if(_0x577b2c[_0xe24e('0x97')]===0x1){return _0x2d30b0[_0xe24e('0x4e')]();}return this[_0xe24e('0x93')](_0x2d30b0);};AGIVertices[_0xe24e('0xc')]['getAndSetVariable']=function(_0x17b149,_0x369b17){var _0x5af4ac=this[_0xe24e('0xa')][_0xe24e('0xd')](_0x17b149);if(_0x5af4ac[_0xe24e('0x9d')]===-0x1){return _0x5af4ac;}logger['info'](util[_0xe24e('0x27')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x369b17,_0x5af4ac[_0xe24e('0x9c')]));return this[_0xe24e('0xa')]['setVariable'](_0x369b17,_0x5af4ac['extra']);};AGIVertices[_0xe24e('0xc')][_0xe24e('0x9e')]=function(_0x78456a){return _0x78456a&&_0x78456a!=='0'&&_0x78456a!=='-1'&&_0x78456a!=='';};AGIVertices['prototype'][_0xe24e('0x9f')]=function(_0x51b86a){this[_0xe24e('0x35')][_0xe24e('0x6e')](this,_0x51b86a,'-');_0x51b86a[_0xe24e('0xa0')]=_0x51b86a[_0xe24e('0x9f')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xe24e('0xc')][_0xe24e('0xa1')]=function(_0x4b5a87){logger[_0xe24e('0x2c')](util[_0xe24e('0x27')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x4b5a87[_0xe24e('0x36')]));if(!this[_0xe24e('0x9e')](_0x4b5a87[_0xe24e('0x5e')])){return this[_0xe24e('0xa')][_0xe24e('0xa2')](_0xe24e('0xa3'));}var _0x5c9224='\x22'+_0x4b5a87['text']+'\x22';if(this[_0xe24e('0x9e')](_0x4b5a87[_0xe24e('0x76')])){_0x5c9224+=','+_0x4b5a87[_0xe24e('0x76')];}var _0x4660e1=this[_0xe24e('0xa')][_0xe24e('0x5a')](_0xe24e('0xa4'),_0x5c9224);if(_0x4660e1[_0xe24e('0x9d')]===-0x1){return _0x4660e1;}return this['channel']['noop'](util[_0xe24e('0x27')](_0xe24e('0xa5'),_0x5c9224));};AGIVertices[_0xe24e('0xc')][_0xe24e('0xa6')]=function(_0x556ef1){logger[_0xe24e('0x2c')](util[_0xe24e('0x27')](_0xe24e('0xa7'),_0x556ef1[_0xe24e('0x36')]));if(!this['isConfigured'](_0x556ef1['grammar'])){return this[_0xe24e('0xa')][_0xe24e('0xa2')](_0xe24e('0xa8'));}var _0x266c89=_0x556ef1[_0xe24e('0xa9')];if(this[_0xe24e('0x9e')](_0x556ef1[_0xe24e('0x76')])){_0x266c89+=','+_0x556ef1[_0xe24e('0x76')];}var _0x8b4b9b=this['channel'][_0xe24e('0x5a')](_0xe24e('0xaa'),_0x266c89);if(_0x8b4b9b['result']===-0x1){return _0x8b4b9b;}var _0x1b89b3=this['getAndSetVariable'](_0xe24e('0xab'),_0xe24e('0xac'));if(_0x1b89b3['result']===-0x1){return _0x1b89b3;}var _0x19e448=this[_0xe24e('0xad')]('RECOG_INPUT()',_0xe24e('0xae'));if(_0x19e448[_0xe24e('0x9d')]===-0x1){return _0x19e448;}var _0x483af3=this[_0xe24e('0xad')](_0xe24e('0xaf'),_0xe24e('0xb0'));if(_0x483af3['result']===-0x1){return _0x483af3;}return this['channel'][_0xe24e('0xa2')](util[_0xe24e('0x27')](_0xe24e('0xb1'),_0x266c89));};AGIVertices[_0xe24e('0xc')][_0xe24e('0xb2')]=function(_0x1ea00e){logger[_0xe24e('0x2c')](util[_0xe24e('0x27')](_0xe24e('0xb3'),_0x1ea00e['label']));return this[_0xe24e('0xa')][_0xe24e('0xb2')]([_0x1ea00e['command'],_0x1ea00e[_0xe24e('0xb4')]]);};AGIVertices[_0xe24e('0xc')][_0xe24e('0xb5')]=function(_0x41deb5){logger['info'](util[_0xe24e('0x27')](_0xe24e('0xb6'),_0x41deb5['label']));if(this['isConfigured'](_0x41deb5[_0xe24e('0x66')])){logger[_0xe24e('0x2c')](util[_0xe24e('0x27')](_0xe24e('0xb7'),_0x41deb5[_0xe24e('0x66')]));var _0xe63bb4=this['channel'][_0xe24e('0xb8')](_0x41deb5[_0xe24e('0x66')]);if(_0xe63bb4[_0xe24e('0x9d')]===-0x1){return _0xe63bb4;}}return this[_0xe24e('0xa')]['answer']();};AGIVertices[_0xe24e('0xc')][_0xe24e('0x4c')]=function(_0x3215c6){logger[_0xe24e('0x2c')](util['format']('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x3215c6[_0xe24e('0x36')]));if(!this[_0xe24e('0x9e')](_0x3215c6['list_id'])){return this[_0xe24e('0xa')]['error'](_0x3215c6,_0xe24e('0xb9'));}_0x3215c6[_0xe24e('0x4b')]=moment();if(this[_0xe24e('0x9e')](_0x3215c6[_0xe24e('0xba')])){_0x3215c6[_0xe24e('0x4b')]=moment()[_0xe24e('0xbb')](_0x3215c6[_0xe24e('0xba')],'minutes');}if(!this[_0xe24e('0x9e')](_0x3215c6[_0xe24e('0x4f')])){_0x3215c6[_0xe24e('0x4f')]=0x2;}this['createCmContact']['sync'](this,_0x3215c6);return this[_0xe24e('0xa')][_0xe24e('0xa2')](util[_0xe24e('0x27')](_0xe24e('0xbc'),_0x3215c6[_0xe24e('0x49')],_0x3215c6['list_id'],_0x3215c6[_0xe24e('0x4b')]));};AGIVertices[_0xe24e('0xc')][_0xe24e('0xbd')]=function(_0x1928f4){logger[_0xe24e('0x2c')](util['format'](_0xe24e('0xbe'),_0x1928f4[_0xe24e('0x36')]));var _0xdda954=this[_0xe24e('0xa')][_0xe24e('0x5a')](_0x1928f4[_0xe24e('0xbf')],_0x1928f4[_0xe24e('0x76')]);if(_0xdda954[_0xe24e('0x9d')]===-0x1){return _0xdda954;}return this[_0xe24e('0xa')][_0xe24e('0xa2')](util['format'](_0xe24e('0xc0'),_0x1928f4[_0xe24e('0xbf')],_0x1928f4[_0xe24e('0x76')]));};AGIVertices['prototype'][_0xe24e('0xc1')]=function(_0x3e5e63){logger[_0xe24e('0x2c')](util[_0xe24e('0x27')](_0xe24e('0xc2'),_0x3e5e63[_0xe24e('0x36')]));if(!this[_0xe24e('0x9e')](_0x3e5e63[_0xe24e('0x5e')])){return this[_0xe24e('0xa')][_0xe24e('0xa2')](_0xe24e('0xa3'));}var _0x989278='\x22'+_0x3e5e63['text']+'\x22';if(this['isConfigured'](_0x3e5e63['options'])){_0x989278+=','+_0x3e5e63[_0xe24e('0x76')];}var _0x57036c=this[_0xe24e('0xa')]['exec'](_0xe24e('0xa4'),_0x989278);if(_0x57036c['result']===-0x1){return _0x57036c;}return this[_0xe24e('0xa')]['noop'](util[_0xe24e('0x27')]('Executed\x20command\x20MRCPSynth\x20%s',_0x989278));};AGIVertices['prototype'][_0xe24e('0xc3')]=function(_0x5d32e7){logger['info'](util[_0xe24e('0x27')](_0xe24e('0xc4'),_0x5d32e7[_0xe24e('0x36')]));if(!this[_0xe24e('0x9e')](_0x5d32e7[_0xe24e('0x5e')])){return this[_0xe24e('0xa')][_0xe24e('0xa2')](_0xe24e('0xa3'));}var _0x1dc0fe='\x22'+_0x5d32e7[_0xe24e('0x5e')]+'\x22';if(this[_0xe24e('0x9e')](_0x5d32e7['options'])){_0x1dc0fe+=','+_0x5d32e7[_0xe24e('0x76')];}var _0x5e9716=this[_0xe24e('0xa')][_0xe24e('0x5a')]('MRCPSynth',_0x1dc0fe);if(_0x5e9716[_0xe24e('0x9d')]===-0x1){return _0x5e9716;}return this[_0xe24e('0xa')]['noop'](util['format'](_0xe24e('0xa5'),_0x1dc0fe));};AGIVertices[_0xe24e('0xc')][_0xe24e('0xc5')]=function(_0x2525cb){logger[_0xe24e('0x2c')](util[_0xe24e('0x27')](_0xe24e('0xc6'),_0x2525cb['label']));if(!this[_0xe24e('0x9e')](_0x2525cb[_0xe24e('0xa9')])){return this['channel'][_0xe24e('0xa2')]('no\x20grammar\x20configured');}var _0x1c3285=_0x2525cb[_0xe24e('0xa9')];if(this[_0xe24e('0x9e')](_0x2525cb[_0xe24e('0x76')])){_0x1c3285+=','+_0x2525cb[_0xe24e('0x76')];}var _0x4eb0bb=this[_0xe24e('0xa')][_0xe24e('0x5a')]('MRCPRecog',_0x1c3285);if(_0x4eb0bb[_0xe24e('0x9d')]===-0x1){return _0x4eb0bb;}var _0x2c84eb=this[_0xe24e('0xad')]('RECOG_CONFIDENCE()',_0xe24e('0xc7'));if(_0x2c84eb[_0xe24e('0x9d')]===-0x1){return _0x2c84eb;}var _0x3bbae6=this['getAndSetVariable'](_0xe24e('0xc8'),_0xe24e('0xc9'));if(_0x3bbae6[_0xe24e('0x9d')]===-0x1){return _0x3bbae6;}var _0x41af89=this[_0xe24e('0xad')](_0xe24e('0xaf'),'LUMENVOX_ASR_INSTANCE');if(_0x41af89['result']===-0x1){return _0x41af89;}return this[_0xe24e('0xa')][_0xe24e('0xa2')](util['format'](_0xe24e('0xb1'),_0x1c3285));};AGIVertices['prototype']['sestekasr']=function(_0x496939){logger[_0xe24e('0x2c')](util[_0xe24e('0x27')](_0xe24e('0xca'),_0x496939[_0xe24e('0x36')]));if(!this['isConfigured'](_0x496939[_0xe24e('0xa9')])){return this[_0xe24e('0xa')]['noop'](_0xe24e('0xa8'));}var _0x1a7eba=_0x496939['grammar'];if(this[_0xe24e('0x9e')](_0x496939[_0xe24e('0x76')])){_0x1a7eba+=','+_0x496939[_0xe24e('0x76')];}var _0x1ffe56=this[_0xe24e('0xa')]['exec']('MRCPRecog',_0x1a7eba);if(_0x1ffe56[_0xe24e('0x9d')]===-0x1){return _0x1ffe56;}var _0x381dbd=this[_0xe24e('0xad')](_0xe24e('0xab'),_0xe24e('0xcb'));if(_0x381dbd[_0xe24e('0x9d')]===-0x1){return _0x381dbd;}var _0x30cd17=this[_0xe24e('0xad')](_0xe24e('0xc8'),_0xe24e('0xcc'));if(_0x30cd17['result']===-0x1){return _0x30cd17;}var _0x277360=this[_0xe24e('0xad')](_0xe24e('0xaf'),_0xe24e('0xcd'));if(_0x277360[_0xe24e('0x9d')]===-0x1){return _0x277360;}return this[_0xe24e('0xa')]['noop'](util[_0xe24e('0x27')](_0xe24e('0xb1'),_0x1a7eba));};AGIVertices['prototype'][_0xe24e('0xce')]=function(_0x57c56f){logger[_0xe24e('0x2c')](util[_0xe24e('0x27')](_0xe24e('0xcf'),_0x57c56f[_0xe24e('0x36')]));if(!this[_0xe24e('0x9e')](_0x57c56f['odbc_id'])){return this[_0xe24e('0xa')][_0xe24e('0x2a')](_0x57c56f,_0xe24e('0xd0'));}var _0x137f4f=this[_0xe24e('0xd1')]['sync'](this,_0x57c56f[_0xe24e('0xd2')]);if(!_0x137f4f){return this[_0xe24e('0xa')][_0xe24e('0x2a')](_0x57c56f,'no\x20odbc\x20database\x20found');}if(!this['isConfigured'](_0x57c56f[_0xe24e('0x2e')])){return this[_0xe24e('0xa')][_0xe24e('0x2a')](_0x57c56f,_0xe24e('0xd3'));}var _0xb69b14=_0x57c56f[_0xe24e('0x2e')][_0xe24e('0xd4')](/(\r\n|\n|\r)/gm,'\x20');this[_0xe24e('0xa')][_0xe24e('0xa2')](util[_0xe24e('0x27')]('query:\x20%s',_0xb69b14));var _0x38aad9=this[_0xe24e('0x29')]['sync'](this,_0x137f4f,_0xb69b14);this[_0xe24e('0x35')][_0xe24e('0x6e')](this,_0x57c56f,_0xb69b14);if(!this['isConfigured'](_0x57c56f[_0xe24e('0xd5')])){return this['channel'][_0xe24e('0xa2')](_0xe24e('0xd6'));}var _0x53f812=this[_0xe24e('0xd')]['sync'](this,_0x57c56f[_0xe24e('0xd5')]);if(!_0x53f812){return this[_0xe24e('0xa')]['error'](_0x57c56f,_0xe24e('0xd7'));}var _0x14ff38=this;_0x38aad9[_0xe24e('0xd8')](function(_0x585ae6,_0xc774f0){Object[_0xe24e('0xd9')](_0x585ae6)[_0xe24e('0xd8')](function(_0xdd28eb){_0x14ff38[_0xe24e('0xa')]['setVariable'](util[_0xe24e('0x27')](_0xe24e('0xda'),_0x53f812,_0xc774f0,_0xdd28eb),_0x585ae6[_0xdd28eb]);});});this[_0xe24e('0xa')][_0xe24e('0xdb')](util[_0xe24e('0x27')]('%s_ROWS_COUNT',_0x53f812),_0x38aad9[_0xe24e('0x97')]);return this[_0xe24e('0xa')][_0xe24e('0xa2')](util[_0xe24e('0x27')](_0xe24e('0xdc'),_0x53f812));};AGIVertices[_0xe24e('0xc')][_0xe24e('0xdd')]=function(_0x5e00c1){logger['debug'](util[_0xe24e('0x27')](_0xe24e('0xde'),_0x5e00c1[_0xe24e('0x36')]));if(!this[_0xe24e('0x9e')](_0x5e00c1[_0xe24e('0xdf')])){return this[_0xe24e('0xa')][_0xe24e('0x2a')](_0x5e00c1,_0xe24e('0xe0'));}var _0xdc3a7=this[_0xe24e('0x17')][_0xe24e('0x6e')](this,_0x5e00c1[_0xe24e('0xdf')]);if(!_0xdc3a7){return this['channel'][_0xe24e('0x2a')](_0x5e00c1,_0xe24e('0xe1'));}var _0x1d816c=this[_0xe24e('0xa')][_0xe24e('0x5a')](_0xe24e('0xe2'),[util[_0xe24e('0x27')]('SIP/%s',_0xdc3a7),_0x5e00c1[_0xe24e('0x66')],_0x5e00c1[_0xe24e('0xe3')],_0x5e00c1[_0xe24e('0x63')]]);if(_0x1d816c[_0xe24e('0x9d')]===-0x1){return _0x1d816c;}return this[_0xe24e('0xa')][_0xe24e('0xa2')](util[_0xe24e('0x27')](_0xe24e('0xe4'),'DIAL'));};AGIVertices[_0xe24e('0xc')][_0xe24e('0xe5')]=function(_0x2687a4){logger[_0xe24e('0x2c')](util[_0xe24e('0x27')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x2687a4[_0xe24e('0x36')]));if(!this[_0xe24e('0x9e')](_0x2687a4[_0xe24e('0x78')])){return this[_0xe24e('0xa')][_0xe24e('0xa2')]('no\x20key\x20configured');}if(!this[_0xe24e('0x9e')](_0x2687a4['text'])){return this[_0xe24e('0xa')][_0xe24e('0xa2')](_0xe24e('0xa3'));}this[_0xe24e('0xa')]['bot']=!![];this[_0xe24e('0x35')](_0x2687a4);this[_0xe24e('0x42')](_0x2687a4[_0xe24e('0x5e')],'in','','');this[_0xe24e('0xa')]['noop'](util[_0xe24e('0x27')]('Trying\x20Dialogflow:\x20%s',_0x2687a4['text']));var _0x4da62e=this[_0xe24e('0x77')][_0xe24e('0x6e')](this,_0x2687a4);if(_0x4da62e){for(var _0xd88803 in _0x4da62e){if(_0x4da62e['hasOwnProperty'](_0xd88803)){this[_0xe24e('0xa')]['setVariable'](util[_0xe24e('0x27')]('DIALOGFLOW_%s',_0xd88803[_0xe24e('0x6a')]()),_0x4da62e[_0xd88803]);}}this[_0xe24e('0x42')](_0x4da62e[_0xe24e('0xe6')],'out',_0xe24e('0xe5'),'');return this[_0xe24e('0xa')][_0xe24e('0xa2')](util[_0xe24e('0x27')](_0xe24e('0xe7'),_0x4da62e[_0xe24e('0xe6')]));}return this[_0xe24e('0xa')][_0xe24e('0x2a')](_0x2687a4,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0xe24e('0xc')][_0xe24e('0xe8')]=function(_0x33426c){logger[_0xe24e('0x2c')](util[_0xe24e('0x27')](_0xe24e('0xe9'),_0x33426c[_0xe24e('0x36')]));if(!this[_0xe24e('0x9e')](_0x33426c['dialogflowV2_project_id'])){return this[_0xe24e('0xa')]['noop']('no\x20project_id\x20configured');}if(!this[_0xe24e('0x9e')](_0x33426c['client_email'])){return this[_0xe24e('0xa')][_0xe24e('0xa2')]('no\x20client_email\x20configured');}if(!this[_0xe24e('0x9e')](_0x33426c[_0xe24e('0x7d')])){return this[_0xe24e('0xa')][_0xe24e('0xa2')]('no\x20private_key\x20configured');}if(!this['isConfigured'](_0x33426c['dialogflowV2_language'])){return this[_0xe24e('0xa')][_0xe24e('0xa2')]('no\x20anguage\x20configured');}if(!this[_0xe24e('0x9e')](_0x33426c[_0xe24e('0x5e')])){return this[_0xe24e('0xa')][_0xe24e('0xa2')](_0xe24e('0xa3'));}this[_0xe24e('0xa')]['bot']=!![];this['createSquareDetailsReport'](_0x33426c);this['createSquareMessage'](_0x33426c[_0xe24e('0x5e')],'in','','');this['channel'][_0xe24e('0xa2')](util[_0xe24e('0x27')](_0xe24e('0xea'),_0x33426c[_0xe24e('0x5e')]));var _0x5462bf=this[_0xe24e('0x7a')]['sync'](this,_0x33426c);if(_0x5462bf){for(var _0x416ad4 in _0x5462bf){if(_0x5462bf['hasOwnProperty'](_0x416ad4)){if(_0x416ad4!==_0xe24e('0xeb')){this[_0xe24e('0xa')][_0xe24e('0xdb')](util[_0xe24e('0x27')](_0xe24e('0xec'),_0x416ad4[_0xe24e('0x6a')]()),_0x5462bf[_0x416ad4]);}}}this['createSquareMessage'](_0x5462bf['speech'],'out',_0xe24e('0xe8'),_0x5462bf[_0xe24e('0xeb')]);return this[_0xe24e('0xa')][_0xe24e('0xa2')](util[_0xe24e('0x27')](_0xe24e('0xed'),_0x5462bf['speech']));}return this[_0xe24e('0xa')][_0xe24e('0x2a')](_0x33426c,_0xe24e('0xee'));};AGIVertices[_0xe24e('0xc')][_0xe24e('0xef')]=function(_0x57ea97){logger[_0xe24e('0x2c')](util['format']('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x57ea97[_0xe24e('0x36')]));if(!this[_0xe24e('0x9e')](_0x57ea97[_0xe24e('0xf0')])){return this[_0xe24e('0xa')]['noop'](_0xe24e('0xf1'));}if(!this['isConfigured'](_0x57ea97['username'])){return this[_0xe24e('0xa')][_0xe24e('0xa2')](_0xe24e('0xf2'));}if(!this[_0xe24e('0x9e')](_0x57ea97[_0xe24e('0xf3')])){return this[_0xe24e('0xa')]['noop'](_0xe24e('0xf4'));}if(!this['isConfigured'](_0x57ea97[_0xe24e('0xf5')])){return this['channel']['noop'](_0xe24e('0xa3'));}this[_0xe24e('0xa')][_0xe24e('0xf6')]=!![];this[_0xe24e('0x35')](_0x57ea97);this[_0xe24e('0x42')](_0x57ea97['text'],'in','','');this[_0xe24e('0xa')]['noop'](util[_0xe24e('0x27')]('Trying\x20SestekNDA:\x20%s',_0x57ea97['text']));var _0x4941f1=this[_0xe24e('0x7f')][_0xe24e('0x6e')](this,_0x57ea97);if(_0x4941f1){for(var _0x124121 in _0x4941f1){if(_0x4941f1[_0xe24e('0x90')](_0x124121)){this['channel'][_0xe24e('0xdb')](util[_0xe24e('0x27')]('SESTEK_NDA_%s',_0x124121[_0xe24e('0x6a')]()),_0x4941f1[_0x124121]);}}this[_0xe24e('0x42')](_0x4941f1['speech'],_0xe24e('0xf7'),_0xe24e('0xef'),'');if(_0x4941f1['audiofile']){this[_0xe24e('0xa')]['noop'](util['format'](_0xe24e('0xf8'),_0x4941f1['audiofile']));var _0x3d2cd6=this[_0xe24e('0xa')]['streamFile'](_0x4941f1['audiofile']);try{fs['unlink'](_0x4941f1[_0xe24e('0xf9')]+'.wav');}catch(_0x5d13e4){logger[_0xe24e('0x2a')](_0x5d13e4);}return _0x3d2cd6;}else{return this[_0xe24e('0xa')][_0xe24e('0xa2')](util[_0xe24e('0x27')](_0xe24e('0xfa'),_0x4941f1['speech']));}}return this[_0xe24e('0xa')]['error'](_0x57ea97,_0xe24e('0xfb'));};AGIVertices[_0xe24e('0xc')][_0xe24e('0xfc')]=function(_0x56dff8){logger[_0xe24e('0x2c')](util[_0xe24e('0x27')](_0xe24e('0xfd'),_0x56dff8[_0xe24e('0x36')]));return this['channel'][_0xe24e('0xa2')](_0xe24e('0xfc'));};AGIVertices[_0xe24e('0xc')]['ext_dial']=function(_0x2621eb){logger[_0xe24e('0x2c')](util[_0xe24e('0x27')](_0xe24e('0xfe'),_0x2621eb[_0xe24e('0x36')]));var _0x480dca='';if(_0x2621eb[_0xe24e('0xff')]){if(!this[_0xe24e('0x9e')](_0x2621eb['trunk_id'])){return this[_0xe24e('0xa')][_0xe24e('0x2a')](_0x2621eb,_0xe24e('0x100'));}else{var _0x555692=parseInt(_0x2621eb[_0xe24e('0xff')],0xa);if(isNaN(_0x555692)){_0x480dca=_0x2621eb['trunk_id'];}else{_0x480dca=this[_0xe24e('0x19')][_0xe24e('0x6e')](this,_0x2621eb[_0xe24e('0xff')]);if(!_0x480dca){return this[_0xe24e('0xa')][_0xe24e('0x2a')](_0x2621eb,_0xe24e('0x101'));}}}}else if(_0x2621eb['trunk_name']){_0x480dca=_0x2621eb[_0xe24e('0x102')];}else{return this[_0xe24e('0xa')][_0xe24e('0x2a')](_0x2621eb,'no\x20trunk\x20selected');}var _0x35dd6c=this[_0xe24e('0xa')][_0xe24e('0x5a')]('DIAL',[util[_0xe24e('0x27')](_0xe24e('0x103'),_0x480dca,_0x2621eb[_0xe24e('0x49')]),_0x2621eb[_0xe24e('0x66')],_0x2621eb[_0xe24e('0xe3')],_0x2621eb[_0xe24e('0x63')]]);if(_0x35dd6c[_0xe24e('0x9d')]===-0x1){return _0x35dd6c;}return this[_0xe24e('0xa')]['noop'](util[_0xe24e('0x27')]('Executed\x20command\x20%s','DIAL'));};AGIVertices['prototype'][_0xe24e('0x104')]=function(_0x35a6f9){logger[_0xe24e('0x2c')](util[_0xe24e('0x27')](_0xe24e('0x105'),_0x35a6f9[_0xe24e('0x36')]));return this[_0xe24e('0xa')][_0xe24e('0xa2')](_0xe24e('0x104'));};AGIVertices['prototype'][_0xe24e('0x9')]=function(_0x214d08){logger['info'](util[_0xe24e('0x27')](_0xe24e('0x106'),_0x214d08[_0xe24e('0x36')]));if(_0x214d08[_0xe24e('0xa0')]===0x0){return this[_0xe24e('0x9f')](_0x214d08);}_0x214d08[_0xe24e('0xa0')]-=0x1;if(!this[_0xe24e('0x9e')](_0x214d08[_0xe24e('0x107')])){return this[_0xe24e('0xa')][_0xe24e('0x2a')](_0x214d08,_0xe24e('0x108'));}var _0xbaafa=this[_0xe24e('0x1b')]['sync'](this,_0x214d08[_0xe24e('0x107')]);if(!_0xbaafa){return this[_0xe24e('0xa')]['error'](_0x214d08,_0xe24e('0x109'));}if(!this['isConfigured'](_0x214d08[_0xe24e('0xd5')])){return this[_0xe24e('0xa')][_0xe24e('0x2a')](_0xe24e('0xd6'));}var _0xbfeb0e=this['channel'][_0xe24e('0x10a')](_0xbaafa,_0x214d08[_0xe24e('0x10b')],_0x214d08[_0xe24e('0x10c')]);var _0x61ff1d=_0xbfeb0e['result']?_0xbfeb0e['result'][_0xe24e('0x4e')]():'';logger['info'](_0xe24e('0x10d'),JSON['stringify'](_0xbfeb0e));if(_0xbfeb0e[_0xe24e('0x9d')]===-0x1){this[_0xe24e('0x35')]['sync'](this,_0x214d08,_0x61ff1d);return _0xbfeb0e;}else if(_0xbfeb0e[_0xe24e('0x9c')]===_0xe24e('0x66')){_0xbfeb0e[_0xe24e('0x9d')]=_0x61ff1d[_0xe24e('0x97')]>=parseInt(_0x214d08[_0xe24e('0x10e')])?'x':'i';}else{_0xbfeb0e['result']=_0x61ff1d[_0xe24e('0x97')]>=parseInt(_0x214d08['mindigit'])&&_0x61ff1d[_0xe24e('0x97')]<=parseInt(_0x214d08['maxdigit'])?'x':'i';}var _0x14252b=this[_0xe24e('0xd')][_0xe24e('0x6e')](this,_0x214d08[_0xe24e('0xd5')]);if(!_0x14252b){return this[_0xe24e('0xa')][_0xe24e('0x2a')](_0x214d08,_0xe24e('0xd7'));}this[_0xe24e('0xa')][_0xe24e('0xdb')](_0x14252b,_0x61ff1d);if(this[_0xe24e('0x9e')](_0x214d08[_0xe24e('0x10f')])){var _0x3c7ba6=parseInt(_0x214d08['hiddendigitsnum'],0xa);var _0x26d7f5=rs[_0xe24e('0x110')]({'charset':'*','length':_0x3c7ba6});var _0xa6906d=_0x61ff1d[_0xe24e('0x97')];if(_0xa6906d>0x0){if(_0xa6906d>_0x3c7ba6){this[_0xe24e('0x35')][_0xe24e('0x6e')](this,_0x214d08,_0x214d08['hiddendigitspos']===_0xe24e('0x111')?_0x26d7f5+_0x61ff1d['substr'](_0x3c7ba6):_0x61ff1d['substr'](0x0,_0xa6906d-_0x3c7ba6)+_0x26d7f5);}else{this[_0xe24e('0x35')][_0xe24e('0x6e')](this,_0x214d08,rs[_0xe24e('0x110')]({'charset':'*','length':_0xa6906d}));}}else{this[_0xe24e('0x35')]['sync'](this,_0x214d08,'');}}else{this[_0xe24e('0x35')][_0xe24e('0x6e')](this,_0x214d08,_0x61ff1d);}return _0xbfeb0e;};AGIVertices[_0xe24e('0xc')][_0xe24e('0x112')]=function(_0x256358){logger[_0xe24e('0x2c')](util[_0xe24e('0x27')](_0xe24e('0x113'),_0x256358[_0xe24e('0x36')]));return this[_0xe24e('0x9')](_0x256358);};AGIVertices['prototype'][_0xe24e('0x114')]=function(_0x6d8b05){logger[_0xe24e('0x2c')](util[_0xe24e('0x27')](_0xe24e('0x115'),_0x6d8b05[_0xe24e('0x36')]));this[_0xe24e('0x35')][_0xe24e('0x6e')](this,_0x6d8b05,_0x6d8b05[_0xe24e('0x116')]);return this['channel'][_0xe24e('0xa2')](util[_0xe24e('0x27')](_0xe24e('0x117'),_0x6d8b05['goalname']));};AGIVertices[_0xe24e('0xc')][_0xe24e('0x118')]=function(_0x365135){logger[_0xe24e('0x2c')](util[_0xe24e('0x27')](_0xe24e('0x119'),_0x365135[_0xe24e('0x36')]));if(!this['isConfigured'](_0x365135['aws_access_key_id'])||!this[_0xe24e('0x9e')](_0x365135[_0xe24e('0x87')])){return this[_0xe24e('0xa')][_0xe24e('0xa2')](_0xe24e('0x11a'));}if(!this[_0xe24e('0x9e')](_0x365135[_0xe24e('0x5e')])){return this['channel'][_0xe24e('0xa2')]('no\x20text\x20configured');}this[_0xe24e('0xa')][_0xe24e('0xa2')](util[_0xe24e('0x27')]('Trying\x20aws\x20Polly\x20%s',_0x365135[_0xe24e('0x5e')]));var _0x1888f5=this[_0xe24e('0x85')][_0xe24e('0x6e')](this,_0x365135);if(_0x1888f5){this['channel'][_0xe24e('0xa2')](util[_0xe24e('0x27')](_0xe24e('0x11b'),_0x1888f5));var _0x4978b0=this[_0xe24e('0xa')]['streamFile'](_0x1888f5);try{fs[_0xe24e('0x11c')](_0x1888f5+_0xe24e('0x11d'));}catch(_0x5c6a30){logger[_0xe24e('0x2a')](_0x5c6a30);}return _0x4978b0;}return this[_0xe24e('0xa')][_0xe24e('0x2a')](_0x365135,_0xe24e('0x11e'));};AGIVertices[_0xe24e('0xc')][_0xe24e('0x11f')]=function(_0x9e7f5){logger[_0xe24e('0x2c')](util['format'](_0xe24e('0x120'),_0x9e7f5[_0xe24e('0x36')]));if(!this[_0xe24e('0x9e')](_0x9e7f5[_0xe24e('0x86')])||!this['isConfigured'](_0x9e7f5['aws_secret_access_key'])){return this[_0xe24e('0xa')][_0xe24e('0xa2')](_0xe24e('0x11a'));}if(!this[_0xe24e('0x9e')](_0x9e7f5['aws_bot_name'])){return this[_0xe24e('0xa')][_0xe24e('0xa2')](_0xe24e('0x121'));}if(!this['isConfigured'](_0x9e7f5[_0xe24e('0x5e')])){return this[_0xe24e('0xa')][_0xe24e('0xa2')]('no\x20text\x20configured');}this[_0xe24e('0xa')]['bot']=!![];this[_0xe24e('0x35')](_0x9e7f5);this['createSquareMessage'](_0x9e7f5[_0xe24e('0x5e')],'in','','');this[_0xe24e('0xa')]['noop'](util[_0xe24e('0x27')](_0xe24e('0x122'),_0x9e7f5[_0xe24e('0x5e')]));var _0x2ac94f=this[_0xe24e('0x88')][_0xe24e('0x6e')](this,_0x9e7f5);if(_0x2ac94f){for(var _0x52a3ab in _0x2ac94f){if(_0x2ac94f['hasOwnProperty'](_0x52a3ab)&&_['isString'](_0x2ac94f[_0x52a3ab])){this[_0xe24e('0xa')]['setVariable'](util['format'](_0xe24e('0x123'),_0x52a3ab[_0xe24e('0x6a')]()),_0x2ac94f[_0x52a3ab]);}}if(_[_0xe24e('0x48')](_0x2ac94f['message'])){return this[_0xe24e('0xa')][_0xe24e('0xa2')](_0xe24e('0x124'));}else{this[_0xe24e('0x42')](_0x2ac94f[_0xe24e('0x125')],_0xe24e('0xf7'),'amazonlex','');return this['channel'][_0xe24e('0xa2')](util[_0xe24e('0x27')](_0xe24e('0x126'),_0x2ac94f['message']));}}return this[_0xe24e('0xa')][_0xe24e('0x2a')](_0x9e7f5,_0xe24e('0x127'));};AGIVertices[_0xe24e('0xc')][_0xe24e('0x128')]=function(_0x981caa){logger['info'](util[_0xe24e('0x27')](_0xe24e('0x129'),_0x981caa[_0xe24e('0x36')],_0x981caa[_0xe24e('0x66')]));if(!this[_0xe24e('0x9e')](_0x981caa[_0xe24e('0x78')])){return this['channel'][_0xe24e('0xa2')](_0xe24e('0x12a'));}var _0x337862=_0xe24e('0x12b');var _0x4a0b47=util[_0xe24e('0x27')](_0xe24e('0x12c'),FILES_PATH,rs[_0xe24e('0x110')](0x4));var _0x1bff7e=util[_0xe24e('0x27')](_0xe24e('0x98'),_0x4a0b47,_0x337862);var _0x1b3bd9=!![];if(_0x981caa[_0xe24e('0x12d')]===_0xe24e('0x12e')){_0x1b3bd9=![];}var _0x437d30=this[_0xe24e('0xa')]['recordFile'](_0x4a0b47,_0x337862,_0x981caa['intKey'],_0x981caa[_0xe24e('0x66')],undefined,_0x1b3bd9);if(_0x437d30['result']!==-0x1){this[_0xe24e('0xa')][_0xe24e('0xa2')](util[_0xe24e('0x27')]('google\x20%s\x20file\x20created',_0x1bff7e));var _0x4efce6=this[_0xe24e('0x8a')][_0xe24e('0x6e')](this,_0x981caa,_0x1bff7e);if(_0x4efce6){for(var _0x425177 in _0x4efce6){if(_0x4efce6[_0xe24e('0x90')](_0x425177)){this[_0xe24e('0xa')][_0xe24e('0xdb')](util['format'](_0xe24e('0x12f'),_0x425177[_0xe24e('0x6a')]()),_0x4efce6[_0x425177]);}}return this[_0xe24e('0xa')][_0xe24e('0xa2')](util['format'](_0xe24e('0x130'),JSON[_0xe24e('0x72')](_0x4efce6)));}}return _0x437d30;};AGIVertices['prototype'][_0xe24e('0x131')]=function(_0x170e5a){logger[_0xe24e('0x2c')](util['format']('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x170e5a[_0xe24e('0x36')]));if(!this['isConfigured'](_0x170e5a['appid'])){return this['channel'][_0xe24e('0xa2')]('no\x20appid\x20configured');}if(!this[_0xe24e('0x9e')](_0x170e5a['appsecret'])){return this['channel'][_0xe24e('0xa2')]('no\x20appsecret\x20configured');}var _0x3f2317='wav';var _0x29ba0c=util[_0xe24e('0x27')](_0xe24e('0x12c'),FILES_PATH,rs[_0xe24e('0x110')](0x4));var _0x19e4cb=util[_0xe24e('0x27')](_0xe24e('0x98'),_0x29ba0c,_0x3f2317);var _0x7d3393=!![];if(_0x170e5a[_0xe24e('0x12d')]===_0xe24e('0x12e')){_0x7d3393=![];}var _0x4f8b5a=this[_0xe24e('0xa')][_0xe24e('0x132')](_0x29ba0c,_0x3f2317,_0x170e5a['intKey'],_0x170e5a['timeout'],undefined,_0x7d3393);if(_0x4f8b5a[_0xe24e('0x9d')]!==-0x1){this[_0xe24e('0xa')][_0xe24e('0xa2')](util['format'](_0xe24e('0x133'),_0x19e4cb));var _0x4f8a86=this[_0xe24e('0x8b')][_0xe24e('0x6e')](this,_0x170e5a,_0x19e4cb);if(_0x4f8a86){for(var _0x17e68c in _0x4f8a86){if(_0x4f8a86['hasOwnProperty'](_0x17e68c)){this[_0xe24e('0xa')][_0xe24e('0xdb')](util['format']('TILDE_ASR_%s',_0x17e68c[_0xe24e('0x6a')]()),_0x4f8a86[_0x17e68c]);}}return this[_0xe24e('0xa')][_0xe24e('0xa2')](util[_0xe24e('0x27')](_0xe24e('0x134'),JSON[_0xe24e('0x72')](_0x4f8a86)));}}return _0x4f8b5a;};AGIVertices[_0xe24e('0xc')][_0xe24e('0x135')]=function(_0x1fb2b3){logger[_0xe24e('0x2c')](util[_0xe24e('0x27')](_0xe24e('0x136'),_0x1fb2b3[_0xe24e('0x36')]));return this[_0xe24e('0xa')][_0xe24e('0x137')](_0x1fb2b3[_0xe24e('0x3d')],_0x1fb2b3['extension'],_0x1fb2b3[_0xe24e('0x3f')]);};AGIVertices[_0xe24e('0xc')][_0xe24e('0x138')]=function(_0x33382d){logger['info'](util[_0xe24e('0x27')](_0xe24e('0x139'),_0x33382d[_0xe24e('0x36')]));if(!this[_0xe24e('0x9e')](_0x33382d['condition'])){return this[_0xe24e('0xa')]['error'](_0x33382d,_0xe24e('0x13a'));}try{var _0x2b4c6a=eval(_0x33382d[_0xe24e('0x13b')])?_0xe24e('0x13c'):'false';this['channel'][_0xe24e('0xa2')](util[_0xe24e('0x27')](_0xe24e('0x13d'),_0x33382d['condition'],_0x2b4c6a));return{'code':0xc8,'result':_0x2b4c6a};}catch(_0xc59fe){return{'code':0xc8,'result':_0xe24e('0x13e')};}};AGIVertices[_0xe24e('0xc')][_0xe24e('0x13f')]=function(_0x55426b){logger['info'](util[_0xe24e('0x27')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x55426b[_0xe24e('0x36')]));if(!this[_0xe24e('0x9e')](_0x55426b['interval_id'])){return this[_0xe24e('0xa')][_0xe24e('0x2a')](_0x55426b,_0xe24e('0x140'));}var _0x276dbd=this['getIntervals'][_0xe24e('0x6e')](this,_0x55426b[_0xe24e('0x141')]);if(!_0x276dbd){return this['channel'][_0xe24e('0x2a')](_0x55426b,_0xe24e('0x142'));}for(var _0x3d560c=0x0;_0x3d560c<_0x276dbd[_0xe24e('0x97')];_0x3d560c+=0x1){var _0x128f0b=this[_0xe24e('0xa')][_0xe24e('0xd')](util['format']('IFTIME(%s?true:false)',_0x276dbd[_0x3d560c]));if(_0x128f0b['result']===-0x1){return _0x128f0b;}logger[_0xe24e('0x2c')](util[_0xe24e('0x27')](_0xe24e('0x143'),_0x276dbd[_0x3d560c],_0x128f0b['extra']));if(_0x128f0b[_0xe24e('0x9c')]===_0xe24e('0x13c')){logger[_0xe24e('0x2c')](util['format'](_0xe24e('0x143'),_0x276dbd[_0x3d560c],_0xe24e('0x13c')));this['channel'][_0xe24e('0xa2')](util[_0xe24e('0x27')](_0xe24e('0x143'),_0x276dbd[_0x3d560c],'true'));return{'code':0xc8,'result':_0xe24e('0x13c')};}else{logger[_0xe24e('0x2c')](util[_0xe24e('0x27')](_0xe24e('0x143'),_0x276dbd[_0x3d560c],_0xe24e('0x13e')));this[_0xe24e('0xa')][_0xe24e('0xa2')](util[_0xe24e('0x27')](_0xe24e('0x143'),_0x276dbd[_0x3d560c],'false'));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0xe24e('0xc')]['hangup']=function(_0x5df967){logger[_0xe24e('0x2c')](util['format'](_0xe24e('0x144'),_0x5df967[_0xe24e('0x36')]));return this[_0xe24e('0xa')][_0xe24e('0x145')]();};AGIVertices['prototype']['ispeechasr']=function(_0x26cd94){logger[_0xe24e('0x2c')](util[_0xe24e('0x27')](_0xe24e('0x146'),_0x26cd94[_0xe24e('0x36')]));if(!this[_0xe24e('0x9e')](_0x26cd94['key'])){return this['channel'][_0xe24e('0xa2')]('no\x20key\x20configured');}var _0x43bf7e=_0xe24e('0x12b');var _0x12df28=util[_0xe24e('0x27')](_0xe24e('0x12c'),FILES_PATH,rs['generate'](0x4));var _0x2474d5=util['format']('%s.%s',_0x12df28,_0x43bf7e);var _0x24e94=!![];if(_0x26cd94[_0xe24e('0x12d')]===_0xe24e('0x12e')){_0x24e94=![];}var _0x12b247=this[_0xe24e('0xa')][_0xe24e('0x132')](_0x12df28,_0x43bf7e,_0x26cd94[_0xe24e('0x147')],_0x26cd94[_0xe24e('0x66')],undefined,_0x24e94);if(_0x12b247['result']!==-0x1){this[_0xe24e('0xa')][_0xe24e('0xa2')](util['format']('ispeech\x20%s\x20file\x20created',_0x2474d5));var _0x2db5b8=this[_0xe24e('0x82')][_0xe24e('0x6e')](this,_0x26cd94,_0x2474d5);if(_0x2db5b8){for(var _0x22f3df in _0x2db5b8){if(_0x2db5b8[_0xe24e('0x90')](_0x22f3df)){this[_0xe24e('0xa')]['setVariable'](util['format'](_0xe24e('0x148'),_0x22f3df[_0xe24e('0x6a')]()),_0x2db5b8[_0x22f3df]);}}return this[_0xe24e('0xa')][_0xe24e('0xa2')](util[_0xe24e('0x27')](_0xe24e('0x149'),JSON[_0xe24e('0x72')](_0x2db5b8)));}}return _0x12b247;};AGIVertices[_0xe24e('0xc')]['ispeechtts']=function(_0x1645cb){logger[_0xe24e('0x2c')](util[_0xe24e('0x27')](_0xe24e('0x14a'),_0x1645cb[_0xe24e('0x36')]));if(!this[_0xe24e('0x9e')](_0x1645cb[_0xe24e('0x78')])){return this['channel'][_0xe24e('0xa2')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x1645cb[_0xe24e('0x5e')])){return this[_0xe24e('0xa')][_0xe24e('0xa2')](_0xe24e('0xa3'));}this[_0xe24e('0xa')][_0xe24e('0xa2')](util[_0xe24e('0x27')](_0xe24e('0x14b'),_0x1645cb[_0xe24e('0x5e')]));var _0x4a5954=this[_0xe24e('0x80')][_0xe24e('0x6e')](this,_0x1645cb);if(_0x4a5954){this[_0xe24e('0xa')]['noop'](util['format'](_0xe24e('0x14c'),_0x4a5954));var _0x378a60=this[_0xe24e('0xa')][_0xe24e('0x14d')](_0x4a5954,_0x1645cb[_0xe24e('0x147')]);try{fs[_0xe24e('0x11c')](_0x4a5954+_0xe24e('0x11d'));}catch(_0x2e3193){logger[_0xe24e('0x2a')](_0x2e3193);}return _0x378a60;}return this[_0xe24e('0xa')][_0xe24e('0x2a')](_0x1645cb,_0xe24e('0x14e'));};AGIVertices['prototype'][_0xe24e('0x14f')]=function(_0x20ade3){logger[_0xe24e('0x2c')](util['format'](_0xe24e('0x150'),_0x20ade3[_0xe24e('0x36')]));if(!this[_0xe24e('0x9e')](_0x20ade3[_0xe24e('0x151')])){return this[_0xe24e('0xa')]['error'](_0x20ade3,_0xe24e('0x152'));}logger[_0xe24e('0x2c')](util[_0xe24e('0x27')](_0xe24e('0x153'),this[_0xe24e('0xa')][_0xe24e('0x39')],_0x20ade3[_0xe24e('0x151')]));var _0x2e5b69=this[_0xe24e('0x55')][_0xe24e('0x6e')](this,_0x20ade3[_0xe24e('0x151')]);if(_0x2e5b69){logger['info'](util['format'](_0xe24e('0x154'),this[_0xe24e('0xa')][_0xe24e('0x39')],_0x20ade3[_0xe24e('0x151')]));this[_0xe24e('0xa')][_0xe24e('0xa2')](util[_0xe24e('0x27')](_0xe24e('0x154'),this['channel'][_0xe24e('0x39')],_0x20ade3[_0xe24e('0x151')]));return{'code':0xc8,'result':_0xe24e('0x155')};}else{logger[_0xe24e('0x2c')](util[_0xe24e('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xe24e('0xa')]['callerid'],_0x20ade3[_0xe24e('0x151')]));this['channel'][_0xe24e('0xa2')](util[_0xe24e('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xe24e('0x39')],_0x20ade3[_0xe24e('0x151')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xe24e('0xc')][_0xe24e('0x156')]=function(_0x1b1ef1){logger[_0xe24e('0x2c')](util[_0xe24e('0x27')](_0xe24e('0x157'),_0x1b1ef1[_0xe24e('0x36')]));if(!this[_0xe24e('0x9e')](_0x1b1ef1[_0xe24e('0x151')])){return this['channel'][_0xe24e('0x2a')](_0x1b1ef1,_0xe24e('0x152'));}logger[_0xe24e('0x2c')](util[_0xe24e('0x27')](_0xe24e('0x153'),this[_0xe24e('0xa')][_0xe24e('0x39')],_0x1b1ef1[_0xe24e('0x151')]));var _0x4ecb66=this[_0xe24e('0x53')][_0xe24e('0x6e')](this,_0x1b1ef1[_0xe24e('0x151')]);if(_0x4ecb66){logger[_0xe24e('0x2c')](util[_0xe24e('0x27')](_0xe24e('0x154'),this[_0xe24e('0xa')][_0xe24e('0x39')],_0x1b1ef1[_0xe24e('0x151')]));this[_0xe24e('0xa')][_0xe24e('0xa2')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x1b1ef1[_0xe24e('0x151')]));return{'code':0xc8,'result':_0xe24e('0x155')};}else{logger[_0xe24e('0x2c')](util[_0xe24e('0x27')](_0xe24e('0x158'),this['channel'][_0xe24e('0x39')],_0x1b1ef1[_0xe24e('0x151')]));this['channel'][_0xe24e('0xa2')](util['format'](_0xe24e('0x158'),this[_0xe24e('0xa')]['callerid'],_0x1b1ef1['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xe24e('0xc')][_0xe24e('0x159')]=function(_0x2a739f){logger[_0xe24e('0x2c')](util[_0xe24e('0x27')](_0xe24e('0x15a'),_0x2a739f[_0xe24e('0x36')]));if(!this['isConfigured'](_0x2a739f[_0xe24e('0x15b')])){return this['channel'][_0xe24e('0x2a')](_0x2a739f,_0xe24e('0x15c'));}this['channel'][_0xe24e('0xa2')](util['format']('math\x20%s',_0x2a739f[_0xe24e('0x15b')]));var _0x485eb0=eval(_0x2a739f[_0xe24e('0x15b')]);if(!this[_0xe24e('0x9e')](_0x2a739f['variable_id'])){return this[_0xe24e('0xa')][_0xe24e('0xa2')](_0xe24e('0xd6'));}var _0xfe71aa=this[_0xe24e('0xd')]['sync'](this,_0x2a739f[_0xe24e('0xd5')]);if(!_0xfe71aa){return this['channel'][_0xe24e('0x2a')](_0x2a739f,_0xe24e('0xd7'));}if(_[_0xe24e('0x96')](_0x485eb0)){var _0x2eebb3=this;_0x485eb0[_0xe24e('0xd8')](function(_0x28def9,_0x40f7f4){_0x2eebb3[_0xe24e('0xa')]['setVariable'](util[_0xe24e('0x27')](_0xe24e('0x15d'),_0xfe71aa,_0x40f7f4),_0x28def9);});return this[_0xe24e('0xa')][_0xe24e('0xa2')](util[_0xe24e('0x27')]('variable\x20%s[key]\x20set',_0xfe71aa));}else{return this[_0xe24e('0xa')][_0xe24e('0xdb')](_0xfe71aa,_0x485eb0);}};AGIVertices[_0xe24e('0xc')]['menu']=function(_0x5702d1){logger['info'](util[_0xe24e('0x27')](_0xe24e('0x15e'),_0x5702d1[_0xe24e('0x36')]));if(_0x5702d1[_0xe24e('0xa0')]===0x0){return this[_0xe24e('0x9f')](_0x5702d1);}_0x5702d1[_0xe24e('0xa0')]-=0x1;if(!this['isConfigured'](_0x5702d1[_0xe24e('0x107')])){return this['channel'][_0xe24e('0x2a')](_0x5702d1,_0xe24e('0x108'));}var _0x29e543=this['getSound'][_0xe24e('0x6e')](this,_0x5702d1[_0xe24e('0x107')]);if(!_0x29e543){return this['channel'][_0xe24e('0x2a')](_0x5702d1,_0xe24e('0x109'));}var _0x52ca98=this['channel'][_0xe24e('0x10a')](_0x29e543,_0x5702d1['response'],_0x5702d1['digit']);var _0x57a184=_0x52ca98['result'];if(_0x52ca98[_0xe24e('0x9d')]===-0x1){this[_0xe24e('0x35')][_0xe24e('0x6e')](this,_0x5702d1,'-1');return _0x52ca98;}else if(_0x52ca98[_0xe24e('0x9c')]===_0xe24e('0x66')){_0x52ca98[_0xe24e('0x9d')]=_0x52ca98[_0xe24e('0x9d')][_0xe24e('0x97')]>0x0?_0x52ca98[_0xe24e('0x9d')]:'t';}else if(_[_0xe24e('0x44')](_0x52ca98['result'])){_0x52ca98[_0xe24e('0x9d')]='#';_0x57a184='#';}if(!this[_0xe24e('0x9e')](_0x5702d1[_0xe24e('0xd5')])){this[_0xe24e('0xa')]['noop'](_0xe24e('0xd6'));}else{var _0x4d9cbe=this[_0xe24e('0xd')]['sync'](this,_0x5702d1[_0xe24e('0xd5')]);if(!_0x4d9cbe){return this[_0xe24e('0xa')][_0xe24e('0x2a')](_0x5702d1,_0xe24e('0xd7'));}this['channel'][_0xe24e('0xdb')](_0x4d9cbe,_0x57a184);}this['createSquareDetailsReport'][_0xe24e('0x6e')](this,_0x5702d1,_0x57a184);return _0x52ca98;};AGIVertices[_0xe24e('0xc')][_0xe24e('0xa2')]=function(_0x1ba68d){logger[_0xe24e('0x2c')](util[_0xe24e('0x27')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x1ba68d[_0xe24e('0x36')]));return this[_0xe24e('0xa')]['noop'](_0x1ba68d[_0xe24e('0x15f')]||_0x1ba68d[_0xe24e('0x36')]);};AGIVertices[_0xe24e('0xc')][_0xe24e('0x160')]=function(_0x1f6668){logger[_0xe24e('0x2c')](util[_0xe24e('0x27')](_0xe24e('0x161'),_0x1f6668[_0xe24e('0x36')]));if(!this[_0xe24e('0x9e')](_0x1f6668['findBy'])){return this[_0xe24e('0xa')][_0xe24e('0x2a')](_0x1f6668,'no\x20find\x20by\x20configured');}logger[_0xe24e('0x2c')](util[_0xe24e('0x27')](_0xe24e('0x153'),this['channel'][_0xe24e('0x39')],_0x1f6668['findBy']));var _0x4b46d3=this[_0xe24e('0x50')]['sync'](this,_0x1f6668[_0xe24e('0x162')]);var _0x1170b9=this[_0xe24e('0x51')]['sync'](this,_0x1f6668[_0xe24e('0x151')],_0x4b46d3);if(_0x1170b9){logger[_0xe24e('0x2c')](util[_0xe24e('0x27')](_0xe24e('0x154'),this['channel'][_0xe24e('0x39')],_0x1f6668[_0xe24e('0x151')]));this[_0xe24e('0xa')][_0xe24e('0xa2')](util[_0xe24e('0x27')](_0xe24e('0x154'),this[_0xe24e('0xa')][_0xe24e('0x39')],_0x1f6668[_0xe24e('0x151')]));return{'code':0xc8,'result':'success'};}else{logger[_0xe24e('0x2c')](util['format'](_0xe24e('0x158'),this[_0xe24e('0xa')][_0xe24e('0x39')],_0x1f6668['findBy']));this[_0xe24e('0xa')][_0xe24e('0xa2')](util[_0xe24e('0x27')](_0xe24e('0x154'),this[_0xe24e('0xa')][_0xe24e('0x39')],_0x1f6668['findBy']));return{'code':0xc8,'result':_0xe24e('0x163')};}};AGIVertices[_0xe24e('0xc')][_0xe24e('0x164')]=function(_0x52b96c){logger[_0xe24e('0x2c')](util[_0xe24e('0x27')](_0xe24e('0x165'),_0x52b96c['label']));if(!this[_0xe24e('0x9e')](_0x52b96c['file_id'])){return this[_0xe24e('0xa')]['error'](_0x52b96c,_0xe24e('0x108'));}var _0x4f49ce=this['getSound'][_0xe24e('0x6e')](this,_0x52b96c[_0xe24e('0x107')]);if(!_0x4f49ce){return this[_0xe24e('0xa')][_0xe24e('0x2a')](_0x52b96c,'no\x20file\x20audio\x20found');}var _0x87fefa=this[_0xe24e('0xa')][_0xe24e('0x5a')](_0xe24e('0x166'),[_0x4f49ce,_0x52b96c[_0xe24e('0xe3')]]);if(_0x87fefa[_0xe24e('0x9d')]===-0x1){return _0x87fefa;}return this[_0xe24e('0xa')][_0xe24e('0xa2')](util[_0xe24e('0x27')](_0xe24e('0xc0'),_0xe24e('0x166'),_0x4f49ce));};AGIVertices[_0xe24e('0xc')][_0xe24e('0x167')]=function(_0x51b8c4){logger[_0xe24e('0x2c')](util[_0xe24e('0x27')](_0xe24e('0x168'),_0x51b8c4[_0xe24e('0x36')]));if(!this[_0xe24e('0x9e')](_0x51b8c4[_0xe24e('0x169')])){return this['channel'][_0xe24e('0x2a')](_0x51b8c4,_0xe24e('0x16a'));}var _0x3d3e2c='';var _0x3bb0e5=parseInt(_0x51b8c4[_0xe24e('0x169')],0xa);if(isNaN(_0x3bb0e5)){_0x3d3e2c=_0x51b8c4['queue_id'];}else{_0x3d3e2c=this['getVoiceQueue'][_0xe24e('0x6e')](this,_0x51b8c4['queue_id']);if(!_0x3d3e2c){return this[_0xe24e('0xa')][_0xe24e('0x2a')](_0x51b8c4,_0xe24e('0x16b'));}}var _0x1e50f6='';if(this[_0xe24e('0x9e')](_0x51b8c4['file_id'])){var _0x14fb25=this[_0xe24e('0x1b')]['sync'](this,_0x51b8c4[_0xe24e('0x107')]);if(_0x14fb25){_0x1e50f6=_0x14fb25;}}this[_0xe24e('0x35')][_0xe24e('0x6e')](this,_0x51b8c4,_0x3d3e2c);if(_0x51b8c4['opts'][_0xe24e('0x16c')]('x')<0x0){_0x51b8c4['opts']+='x';}if(_0x51b8c4[_0xe24e('0xe3')]['indexOf']('X')<0x0){_0x51b8c4['opts']+='X';}this['channel'][_0xe24e('0xdb')](_0xe24e('0x16d'),_0x3d3e2c?_0x3d3e2c[_0xe24e('0x16e')]():'');var _0x27678d=this[_0xe24e('0xa')][_0xe24e('0x5a')](_0xe24e('0x16f'),[_0x3d3e2c,_0x51b8c4['opts'],_0x51b8c4['url'],_0x1e50f6,_0x51b8c4['timeout'],_0x51b8c4[_0xe24e('0xb2')],_0x51b8c4[_0xe24e('0x170')],_0x51b8c4['gosub'],'',_0x51b8c4[_0xe24e('0x171')]]);if(_0x27678d[_0xe24e('0x9d')]===-0x1){return _0x27678d;}return this[_0xe24e('0xa')][_0xe24e('0xa2')](util[_0xe24e('0x27')](_0xe24e('0xc0'),_0xe24e('0x16f'),_0x3d3e2c));};AGIVertices[_0xe24e('0xc')][_0xe24e('0x172')]=function(_0x304278){logger[_0xe24e('0x2c')](util[_0xe24e('0x27')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x304278[_0xe24e('0x36')]));var _0x1e8519=_0x304278[_0xe24e('0x173')]||_0xe24e('0x12b');var _0x2ebdd1=util[_0xe24e('0x27')]('%s_%s',this['channel'][_0xe24e('0x3b')],rs['generate'](0x5));var _0x267dca=util[_0xe24e('0x27')](_0xe24e('0x174'),FILES_PATH,_0x2ebdd1,_0x1e8519);var _0x36097d=util[_0xe24e('0x27')](_0xe24e('0x12c'),FILES_PATH,_0x2ebdd1);this[_0xe24e('0x3a')]['sync'](this,_0x304278,_0x2ebdd1,_0x267dca);this[_0xe24e('0xa')][_0xe24e('0xdb')](_0xe24e('0x175'),_0x2ebdd1);logger['info'](_0xe24e('0x176'),_0x36097d,_0x1e8519,_0x304278[_0xe24e('0x177')],_0x304278[_0xe24e('0x66')]);return this[_0xe24e('0xa')][_0xe24e('0x132')](_0x36097d,_0x1e8519,_0x304278[_0xe24e('0x177')],_0x304278[_0xe24e('0x66')],undefined,!![]);};AGIVertices[_0xe24e('0xc')]['restapi']=function(_0x5759ea){logger['info'](util[_0xe24e('0x27')](_0xe24e('0x178'),_0x5759ea[_0xe24e('0x36')]));if(!this[_0xe24e('0x9e')](_0x5759ea[_0xe24e('0x63')])){return this[_0xe24e('0xa')]['noop'](_0xe24e('0x179'));}var _0x322859=this[_0xe24e('0x17a')][_0xe24e('0x6e')](this,_0x5759ea);logger['info'](util[_0xe24e('0x27')](_0xe24e('0x17b'),util[_0xe24e('0x17c')](_0x322859,{'showHidden':![],'depth':null})));if(!this[_0xe24e('0x9e')](_0x5759ea[_0xe24e('0xd5')])){return this[_0xe24e('0xa')]['noop']('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x82562d=this[_0xe24e('0xd')][_0xe24e('0x6e')](this,_0x5759ea[_0xe24e('0xd5')]);if(!_0x82562d){return this[_0xe24e('0xa')][_0xe24e('0x2a')](_0x5759ea,_0xe24e('0xd7'));}this[_0xe24e('0xa')][_0xe24e('0xdb')](util[_0xe24e('0x27')](_0xe24e('0x17d'),_0x82562d),_0x322859[_0xe24e('0x74')]?_0x322859[_0xe24e('0x74')]:_0xe24e('0x17e'));this['channel'][_0xe24e('0xdb')](util[_0xe24e('0x27')]('%s_STATUS_MESSAGE',_0x82562d),_0x322859[_0xe24e('0x17f')]?_0x322859['statusMessage']:'OK');if(_0x322859[_0xe24e('0x6b')]){try{this['saveRestApiResult'](_0x322859[_0xe24e('0x6b')],_0x82562d);}catch(_0x47e84e){logger[_0xe24e('0x2a')](util['format'](_0xe24e('0x180'),_0x82562d));}}return this[_0xe24e('0xa')][_0xe24e('0xa2')](util[_0xe24e('0x27')](_0xe24e('0xdc'),_0x82562d));};AGIVertices[_0xe24e('0xc')][_0xe24e('0x181')]=function(_0x161207){logger[_0xe24e('0x2c')](util[_0xe24e('0x27')](_0xe24e('0x182'),_0x161207[_0xe24e('0x36')]));return this['channel']['sayDigits'](_0x161207[_0xe24e('0x183')][_0xe24e('0xd4')](/\s+/g,''),_0x161207[_0xe24e('0x177')]);};AGIVertices['prototype'][_0xe24e('0x184')]=function(_0x4f3996){logger[_0xe24e('0x2c')](util[_0xe24e('0x27')](_0xe24e('0x185'),_0x4f3996[_0xe24e('0x36')]));return this[_0xe24e('0xa')]['sayNumber'](_0x4f3996[_0xe24e('0x65')]['replace'](/\s+/g,''),_0x4f3996[_0xe24e('0x177')]);};AGIVertices[_0xe24e('0xc')][_0xe24e('0x186')]=function(_0x13c1ad){logger[_0xe24e('0x2c')](util[_0xe24e('0x27')](_0xe24e('0x187'),_0x13c1ad[_0xe24e('0x36')]));return this[_0xe24e('0xa')][_0xe24e('0x188')](_0x13c1ad[_0xe24e('0x5e')],_0x13c1ad[_0xe24e('0x177')]);};AGIVertices['prototype'][_0xe24e('0x189')]=function(_0x3351c7){logger[_0xe24e('0x2c')](util[_0xe24e('0x27')](_0xe24e('0x18a'),_0x3351c7[_0xe24e('0x36')]));if(!this[_0xe24e('0x9e')](_0x3351c7[_0xe24e('0x18b')])){return this[_0xe24e('0xa')][_0xe24e('0xa2')](_0xe24e('0x18c'));}var _0x1a1124=this[_0xe24e('0x1f')][_0xe24e('0x6e')](this,_0x3351c7[_0xe24e('0x18b')]);if(!_0x1a1124||!_0x1a1124['Smtp']){return this[_0xe24e('0xa')][_0xe24e('0x2a')](_0x3351c7,_0xe24e('0x18d'));}var _0x4c7fb6={'from':util['format'](_0xe24e('0x18e'),_0x1a1124[_0xe24e('0x10')],_0x1a1124['email']||_0x1a1124[_0xe24e('0x18f')][_0xe24e('0x190')]),'to':_0x3351c7['to']||'','cc':_0x3351c7['cc']||'','bcc':_0x3351c7[_0xe24e('0x191')]||'','subject':_0x3351c7[_0xe24e('0x192')],'html':_0x3351c7[_0xe24e('0x5e')],'text':_0x3351c7['text']};var _0x3d26df={'tls':{'rejectUnauthorized':![]}};if(_0x1a1124['Smtp']['service']){_0x3d26df[_0xe24e('0x193')]=_0x1a1124[_0xe24e('0x18f')]['service'];}else{_0x3d26df['host']=_0x1a1124[_0xe24e('0x18f')][_0xe24e('0x194')];_0x3d26df[_0xe24e('0x195')]=_0x1a1124['Smtp'][_0xe24e('0x195')];_0x3d26df[_0xe24e('0x196')]=_0x1a1124[_0xe24e('0x18f')][_0xe24e('0x196')];}if(_0x1a1124['Smtp'][_0xe24e('0x197')]){_0x3d26df[_0xe24e('0x198')]={'user':_0x1a1124[_0xe24e('0x18f')][_0xe24e('0x190')],'pass':_0x1a1124[_0xe24e('0x18f')][_0xe24e('0x199')]};}if(this[_0xe24e('0x9e')](_0x3351c7[_0xe24e('0x19a')])){}logger[_0xe24e('0x19b')](_0xe24e('0x19c'),JSON['stringify'](_0x4c7fb6));this[_0xe24e('0x35')]['sync'](this,_0x3351c7,_0x3351c7[_0xe24e('0x18b')]);this['channel'][_0xe24e('0xa2')](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0x1a1124[_0xe24e('0x10')]));this[_0xe24e('0x21')][_0xe24e('0x6e')](this,_0x3d26df,_0x4c7fb6);return this[_0xe24e('0xa')][_0xe24e('0xa2')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xe24e('0xc')][_0xe24e('0x19d')]=function(_0x1ceaa3){logger[_0xe24e('0x2c')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x1ceaa3[_0xe24e('0x36')]));return this[_0xe24e('0xa')][_0xe24e('0xa2')](_0xe24e('0x19e'));};AGIVertices[_0xe24e('0xc')][_0xe24e('0x19f')]=function(_0x42ce42){logger[_0xe24e('0x2c')](util[_0xe24e('0x27')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x42ce42[_0xe24e('0x36')]));if(!this[_0xe24e('0x9e')](_0x42ce42[_0xe24e('0x1a0')])){return this[_0xe24e('0xa')]['noop'](_0xe24e('0x1a1'));}var _0x4a7295=this[_0xe24e('0x32')][_0xe24e('0x6e')](this,_0x42ce42['sms_account_id']);if(!_0x4a7295){return this[_0xe24e('0xa')][_0xe24e('0x2a')](_0x42ce42,'no\x20sms\x20account\x20found');}var _0x556d19={'body':_0x42ce42['sms_text'],'phone':_0x42ce42['to']||'','SmsAccountId':_0x4a7295['id']};logger[_0xe24e('0x19b')](_0xe24e('0x1a2'),JSON[_0xe24e('0x72')](_0x556d19));this[_0xe24e('0x35')][_0xe24e('0x6e')](this,_0x42ce42,_0x42ce42[_0xe24e('0x1a0')]);this['channel'][_0xe24e('0xa2')](util[_0xe24e('0x27')](_0xe24e('0x1a3'),_0x4a7295[_0xe24e('0x10')]));this['createSmsMessage'][_0xe24e('0x6e')](this,_0x556d19);return this[_0xe24e('0xa')][_0xe24e('0xa2')](_0xe24e('0x1a4'));};AGIVertices[_0xe24e('0xc')][_0xe24e('0x1a5')]=function(_0x411f26){logger['info'](util[_0xe24e('0x27')](_0xe24e('0x1a6'),_0x411f26[_0xe24e('0x36')]));if(!this[_0xe24e('0x9e')](_0x411f26[_0xe24e('0xd5')])){return this[_0xe24e('0xa')][_0xe24e('0x2a')](_0x411f26,'no\x20variable\x20selected');}var _0x1b3665=this['getVariable']['sync'](this,_0x411f26[_0xe24e('0xd5')]);if(!_0x1b3665){return this[_0xe24e('0xa')][_0xe24e('0x2a')](_0x411f26,'no\x20variable\x20found');}return this[_0xe24e('0xa')][_0xe24e('0xdb')](_0x1b3665,_0x411f26[_0xe24e('0x1a7')]);};AGIVertices[_0xe24e('0xc')][_0xe24e('0x1a8')]=function(_0x3757f4){logger[_0xe24e('0x2c')](util[_0xe24e('0x27')](_0xe24e('0x1a9'),_0x3757f4[_0xe24e('0x36')]));this[_0xe24e('0xa')]['noop'](_0xe24e('0x1aa'));if(_0x3757f4[_0xe24e('0xb5')]===_0xe24e('0x1ab')){this[_0xe24e('0xa')]['noop'](_0xe24e('0x1ac'));return this[_0xe24e('0xa')][_0xe24e('0xb5')]();}return this[_0xe24e('0xa')][_0xe24e('0xa2')](_0xe24e('0x1ad'));};AGIVertices['prototype'][_0xe24e('0x1ae')]=function(_0xa29cf1){logger[_0xe24e('0x2c')](util['format']('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0xa29cf1[_0xe24e('0x36')]));if(!this['isConfigured'](_0xa29cf1[_0xe24e('0x1af')])){return this[_0xe24e('0xa')]['error'](_0xa29cf1,_0xe24e('0x1b0'));}var _0x59fe99=this[_0xe24e('0x14')][_0xe24e('0x6e')](this,_0xa29cf1[_0xe24e('0x1af')]);if(!this['isConfigured'](_0x59fe99)){return this[_0xe24e('0xa')][_0xe24e('0x2a')](_0xa29cf1,util[_0xe24e('0x27')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0xa29cf1[_0xe24e('0x1af')]));}if(_0x59fe99===this[_0xe24e('0xa')][_0xe24e('0x38')]){return this[_0xe24e('0xa')][_0xe24e('0x2a')](_0xa29cf1,_0xe24e('0x1b1'));}this['createSquareDetailsReport']['sync'](this,_0xa29cf1,_0x59fe99);var _0x53abb4=this[_0xe24e('0xa')]['exec'](_0xe24e('0x1b2'),util['format'](_0xe24e('0x1b3'),config[_0xe24e('0xb2')][_0xe24e('0x194')]||_0xe24e('0x1b4'),_0x59fe99,this['channel']['arg_1']));if(_0x53abb4[_0xe24e('0x9d')]===-0x1){return _0x53abb4;}return this[_0xe24e('0xa')][_0xe24e('0xa2')](util[_0xe24e('0x27')](_0xe24e('0xc0'),'AGI',_0x59fe99));};AGIVertices[_0xe24e('0xc')][_0xe24e('0x1b5')]=function(_0x4c1b5f){logger[_0xe24e('0x2c')](util[_0xe24e('0x27')](_0xe24e('0x1b6'),_0x4c1b5f[_0xe24e('0x36')]));var _0x2e666d=this[_0xe24e('0x59')][_0xe24e('0x6e')](this,_0x4c1b5f[_0xe24e('0x1b7')]);this[_0xe24e('0x35')]['sync'](this,_0x4c1b5f,_0x4c1b5f['command']);if(this['isConfigured'](_0x4c1b5f[_0xe24e('0xd5')])){var _0xb96dd7=this['getVariable'][_0xe24e('0x6e')](this,_0x4c1b5f[_0xe24e('0xd5')]);if(_0xb96dd7){this[_0xe24e('0xa')][_0xe24e('0xdb')](_0xb96dd7,_0x2e666d);return this[_0xe24e('0xa')]['noop'](util[_0xe24e('0x27')](_0xe24e('0x1b8'),_0x4c1b5f[_0xe24e('0x1b7')],_0xb96dd7));}}return this[_0xe24e('0xa')]['noop'](util[_0xe24e('0x27')](_0xe24e('0x1b9'),_0x4c1b5f[_0xe24e('0x1b7')]));};AGIVertices[_0xe24e('0xc')]['google_cloud_tts']=function(_0x3b42c5){logger[_0xe24e('0x2c')](util[_0xe24e('0x27')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x3b42c5[_0xe24e('0x36')]));_0x3b42c5[_0xe24e('0x5e')]=_0x3b42c5[_0xe24e('0x5e')][_0xe24e('0xd4')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x3b42c5[_0xe24e('0x1ba')])){return this[_0xe24e('0xa')][_0xe24e('0xa2')](_0xe24e('0x1bb'));}if(!this[_0xe24e('0x9e')](_0x3b42c5[_0xe24e('0x5e')])){return this['channel'][_0xe24e('0xa2')](_0xe24e('0xa3'));}this['channel']['noop'](util[_0xe24e('0x27')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x3b42c5[_0xe24e('0x5e')]));var _0x15698f=this[_0xe24e('0x5c')][_0xe24e('0x6e')](this,_0x3b42c5);if(_0x15698f){this[_0xe24e('0xa')][_0xe24e('0xa2')](util[_0xe24e('0x27')](_0xe24e('0x1bc'),_0x15698f));var _0x58241b=this['channel'][_0xe24e('0x14d')](_0x15698f);try{fs[_0xe24e('0x11c')](_0x15698f+'.wav');}catch(_0x3b210a){logger[_0xe24e('0x2a')](_0x3b210a);}return _0x58241b;}return this[_0xe24e('0xa')][_0xe24e('0x2a')](_0x3b42c5,_0xe24e('0x1bd'));};AGIVertices['prototype'][_0xe24e('0x1be')]=function(_0x402a8d){logger[_0xe24e('0x2c')](util['format']('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x402a8d[_0xe24e('0x36')]));_0x402a8d['text']=_0x402a8d[_0xe24e('0x5e')][_0xe24e('0xd4')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x402a8d['text'])){return this[_0xe24e('0xa')][_0xe24e('0xa2')](_0xe24e('0xa3'));}this[_0xe24e('0xa')]['noop'](util[_0xe24e('0x27')](_0xe24e('0x1bf'),_0x402a8d[_0xe24e('0x5e')]));var _0xa338a3=this[_0xe24e('0x1c0')]['sync'](this,_0x402a8d);if(_0xa338a3){this['channel'][_0xe24e('0xa2')](util[_0xe24e('0x27')](_0xe24e('0x1c1'),_0xa338a3));var _0x47f440=this[_0xe24e('0xa')]['streamFile'](_0xa338a3);try{fs[_0xe24e('0x11c')](_0xa338a3+_0xe24e('0x11d'));}catch(_0x513bb9){logger['error'](_0x513bb9);}return _0x47f440;}return this[_0xe24e('0xa')][_0xe24e('0x2a')](_0x402a8d,_0xe24e('0x1c2'));};AGIVertices[_0xe24e('0xc')]['unpause']=function(_0x2ab627){logger['info'](util['format'](_0xe24e('0x1c3'),_0x2ab627['label']));if(!this['isConfigured'](_0x2ab627[_0xe24e('0x151')])){return this[_0xe24e('0xa')][_0xe24e('0x2a')](_0x2ab627,_0xe24e('0x152'));}logger[_0xe24e('0x2c')](util['format'](_0xe24e('0x153'),this[_0xe24e('0xa')][_0xe24e('0x39')],_0x2ab627[_0xe24e('0x151')]));var _0x3f10be=this['agentUnpause'][_0xe24e('0x6e')](this,_0x2ab627[_0xe24e('0x151')]);if(_0x3f10be){logger[_0xe24e('0x2c')](util['format'](_0xe24e('0x154'),this[_0xe24e('0xa')]['callerid'],_0x2ab627[_0xe24e('0x151')]));this[_0xe24e('0xa')][_0xe24e('0xa2')](util[_0xe24e('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xe24e('0xa')][_0xe24e('0x39')],_0x2ab627[_0xe24e('0x151')]));return{'code':0xc8,'result':_0xe24e('0x155')};}else{logger[_0xe24e('0x2c')](util[_0xe24e('0x27')](_0xe24e('0x158'),this['channel'][_0xe24e('0x39')],_0x2ab627[_0xe24e('0x151')]));this[_0xe24e('0xa')][_0xe24e('0xa2')](util[_0xe24e('0x27')](_0xe24e('0x158'),this[_0xe24e('0xa')]['callerid'],_0x2ab627[_0xe24e('0x151')]));return{'code':0xc8,'result':_0xe24e('0x163')};}};AGIVertices[_0xe24e('0xc')]['voicemail']=function(_0x4dcc46){logger['info'](util[_0xe24e('0x27')](_0xe24e('0x1c4'),_0x4dcc46[_0xe24e('0x36')]));var _0x5d8dd8=this['channel'][_0xe24e('0x5a')](_0xe24e('0x1c5'),[_0x4dcc46[_0xe24e('0x1c6')],_0x4dcc46[_0xe24e('0x76')]]);if(_0x5d8dd8[_0xe24e('0x9d')]===-0x1){return _0x5d8dd8;}return this[_0xe24e('0xa')][_0xe24e('0xa2')](util[_0xe24e('0x27')]('Executed\x20command\x20%s\x20%s',_0xe24e('0x1c5'),_0x4dcc46[_0xe24e('0x1c6')]));};AGIVertices[_0xe24e('0xc')][_0xe24e('0x1c7')]=function(_0x56b3fd){logger[_0xe24e('0x2c')](util[_0xe24e('0x27')](_0xe24e('0x1c8'),_0x56b3fd[_0xe24e('0x36')]));if(!this[_0xe24e('0x9e')](_0x56b3fd[_0xe24e('0xd5')])){return this[_0xe24e('0xa')][_0xe24e('0x2a')](_0x56b3fd,'no\x20variable\x20selected');}var _0x2169d4=this[_0xe24e('0xd')][_0xe24e('0x6e')](this,_0x56b3fd[_0xe24e('0xd5')]);if(!_0x2169d4){return this[_0xe24e('0xa')]['error'](_0x56b3fd,_0xe24e('0xd7'));}var _0x4ceef0=this['channel']['getVariable'](_0x2169d4);return{'code':0xc8,'result':_0x4ceef0[_0xe24e('0x9c')]?_0x4ceef0[_0xe24e('0x9c')]:'-'};};String[_0xe24e('0xc')][_0xe24e('0x9b')]=function(_0xb58b47,_0x4cd5a4){return this[_0xe24e('0x9a')](_0xb58b47)[_0xe24e('0x1c9')](_0x4cd5a4);};module[_0xe24e('0x1ca')]=AGIVertices; \ No newline at end of file +var _0x1ed5=['catch','getSquareProject','getSquareOdbc','getSquareOdbcById','getUserById','getTrunk','getSound','getSoundById','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','IntervalId','Intervals','interval','format','getQueryOdbc','open','error','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','callerid','createSquareRecording','calleridname','context','extension','accountcode','dnid','arg_1','file','createSquareMessage','createCmContact','isNil','callback_','random','lastName','phone','list_id','scheduledAt','toString','callback_priority','getPause','getPauseById','agent','agentPause','agentUnpause','agentLogout','%s/%s@from-sip/n','LOCAL','shellCommand','googleCloudTTS','text','languageCode','ssmlGender','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','body','parse','rawBody','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','stringify','statusCode','statusMessage','message','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','sestekNDA','ispeechTTS','speed','ispeechASR','ispeech_asr_language','en-US','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','googleASR','tildeASR','appid','uri','isString','replaceObjectAllVariables','replaceAllVariables','hasOwnProperty','isPlainObject','recursiveNodeIndex','isArray','saveRestApiResult','%s.%s','length','setVariable','split','replaceAll','extra','getAndSetVariable','getVariable','result','info','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','options','noop','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_INPUT()','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','callback','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','exec','Executed\x20command\x20%s\x20%s','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','opts','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','dialogflowV2_language','bot','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','audiofile','.wav','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','trunk_name','SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','maxRetry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','first','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','no\x20appid\x20configured','no\x20appsecret\x20configured','beep','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','gotoif','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','agentLogin','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','digit','isEmpty','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue_id','indexOf','XMCS-QUEUE','toLowerCase','macro','gosub','position','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','email','user','subject','service','host','port','secure','authentication','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','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','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','getdigits','rpc','mailRpc','prototype','getVariableById','then','getVoiceQueue','getVoiceQueueById','name'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x1ed5,0x1ae));var _0x51ed=function(_0x42182d,_0x125b1a){_0x42182d=_0x42182d-0x0;var _0x26459b=_0x1ed5[_0x42182d];return _0x26459b;};'use strict';var fs=require('fs');var path=require(_0x51ed('0x0'));var util=require(_0x51ed('0x1'));var _=require(_0x51ed('0x2'));var sh=require(_0x51ed('0x3'));var odbc=require(_0x51ed('0x4'))();var rs=require(_0x51ed('0x5'));var moment=require(_0x51ed('0x6'));var Mustache=require(_0x51ed('0x7'));var rp=require(_0x51ed('0x8'));var logger=require(_0x51ed('0x9'))(_0x51ed('0xa'));var config=require(_0x51ed('0xb'));var scripts=require(_0x51ed('0xc'));var FILES_PATH=_0x51ed('0xd');var recursiveMapAttributes=[_0x51ed('0xe'),'rawBody'];var verticesWithRetry=['menu',_0x51ed('0xf'),'getsecretdigits'];var AGIVertices=function(_0x2d8540,_0x3637cb,_0x522881){this['channel']=_0x2d8540;this[_0x51ed('0x10')]=_0x3637cb;this[_0x51ed('0x11')]=_0x522881;};AGIVertices[_0x51ed('0x12')]['getVariable']=function(_0x56a830,_0x48b439){this[_0x51ed('0x10')][_0x51ed('0x13')](_0x56a830)[_0x51ed('0x14')](function(_0x2d3086){_0x48b439(null,_0x2d3086?_0x2d3086['name']:![]);})['catch'](function(_0x30beea){_0x48b439(_0x30beea);});};AGIVertices[_0x51ed('0x12')][_0x51ed('0x15')]=function(_0x325663,_0x5958bc){this[_0x51ed('0x10')][_0x51ed('0x16')](_0x325663)[_0x51ed('0x14')](function(_0xe4823e){_0x5958bc(null,_0xe4823e?_0xe4823e[_0x51ed('0x17')]:![]);})[_0x51ed('0x18')](function(_0x5db8fc){_0x5958bc(_0x5db8fc);});};AGIVertices[_0x51ed('0x12')][_0x51ed('0x19')]=function(_0x1dff89,_0xaa7ec){this['rpc']['getSquareProjectById'](_0x1dff89)['then'](function(_0xcadc48){_0xaa7ec(null,_0xcadc48?_0xcadc48[_0x51ed('0x17')]:![]);})[_0x51ed('0x18')](function(_0x38f20e){_0xaa7ec(_0x38f20e);});};AGIVertices[_0x51ed('0x12')][_0x51ed('0x1a')]=function(_0x393f81,_0x184f90){this['rpc'][_0x51ed('0x1b')](_0x393f81)[_0x51ed('0x14')](function(_0x461880){_0x184f90(null,_0x461880?_0x461880['dsn']:![]);})['catch'](function(_0x4a4c58){_0x184f90(_0x4a4c58);});};AGIVertices['prototype']['getUser']=function(_0x3d7b8b,_0x1dfec8){this['rpc'][_0x51ed('0x1c')](_0x3d7b8b)[_0x51ed('0x14')](function(_0x4736a2){_0x1dfec8(null,_0x4736a2?_0x4736a2[_0x51ed('0x17')]:![]);})[_0x51ed('0x18')](function(_0x3f29da){_0x1dfec8(_0x3f29da);});};AGIVertices[_0x51ed('0x12')][_0x51ed('0x1d')]=function(_0x559755,_0x13ea13){this['rpc']['getTrunkById'](_0x559755)['then'](function(_0x23e15d){_0x13ea13(null,_0x23e15d?_0x23e15d[_0x51ed('0x17')]:![]);})[_0x51ed('0x18')](function(_0x5ee7f6){_0x13ea13(_0x5ee7f6);});};AGIVertices[_0x51ed('0x12')][_0x51ed('0x1e')]=function(_0x369a40,_0x4c2ab0){var _0x586fd3=this;this[_0x51ed('0x10')][_0x51ed('0x1f')](_0x369a40)[_0x51ed('0x14')](function(_0x31d962){_0x4c2ab0(null,_0x31d962?_0x586fd3[_0x51ed('0x20')](_0x31d962['save_name']):![]);})[_0x51ed('0x18')](function(_0x34889d){_0x4c2ab0(_0x34889d);});};AGIVertices[_0x51ed('0x12')][_0x51ed('0x21')]=function(_0x4c9ae4,_0x59c2c3){this[_0x51ed('0x10')][_0x51ed('0x22')](_0x4c9ae4)['then'](function(_0xcd4a07){_0x59c2c3(null,_0xcd4a07?_0xcd4a07:![]);})[_0x51ed('0x18')](function(_0x275122){_0x59c2c3(_0x275122);});};AGIVertices[_0x51ed('0x12')][_0x51ed('0x23')]=function(_0x10b6e6,_0x3c310c,_0x1d97a6){this[_0x51ed('0x11')][_0x51ed('0x23')](_0x10b6e6,_0x3c310c)['then'](function(){_0x1d97a6(null);})[_0x51ed('0x18')](function(_0xefcc2e){_0x1d97a6(_0xefcc2e);});};AGIVertices[_0x51ed('0x12')]['getIntervals']=function(_0x29f730,_0x84c95a){this[_0x51ed('0x10')]['getIntervalById'](_0x29f730)['then'](function(_0x4b2432){if(_0x4b2432){if(_0x4b2432[_0x51ed('0x24')]){_0x84c95a(null,[_0x4b2432['interval']]);}else{_0x84c95a(null,_['map'](_0x4b2432[_0x51ed('0x25')],_0x51ed('0x26')));}}else{_0x84c95a(null,![]);}})[_0x51ed('0x18')](function(_0x4982b2){_0x84c95a(_0x4982b2);});};AGIVertices[_0x51ed('0x12')][_0x51ed('0x20')]=function(_0x4e212b){return util[_0x51ed('0x27')]('%s/sounds/converted/%s',FILES_PATH,_0x4e212b);};AGIVertices['prototype'][_0x51ed('0x28')]=function(_0x32ec4b,_0x1966cb,_0x312bb3){odbc[_0x51ed('0x29')](_0x32ec4b,function(_0x333f02){if(_0x333f02){logger[_0x51ed('0x2a')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x333f02);_0x312bb3(_0x333f02);}else{logger['info'](_0x51ed('0x2b'));odbc['query'](_0x1966cb,function(_0xb2456e,_0x533f6f){if(_0xb2456e){logger['info'](_0x51ed('0x2c'),_0x1966cb);_0x312bb3(_0xb2456e);}else{logger['info'](_0x51ed('0x2d'),_0x1966cb);odbc[_0x51ed('0x2e')](function(_0x4a3f9a){if(_0x4a3f9a){logger['error'](_0x51ed('0x2f'),_0x4a3f9a);}_0x312bb3(null,_0x533f6f);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0xf9b94,_0x29525f){this[_0x51ed('0x10')][_0x51ed('0x30')](_0xf9b94)[_0x51ed('0x14')](function(_0x33cbaa){_0x29525f(null,_0x33cbaa?_0x33cbaa:![]);})[_0x51ed('0x18')](function(_0xcdda0a){_0x29525f(_0xcdda0a);});};AGIVertices['prototype'][_0x51ed('0x31')]=function(_0x15f6d6,_0xfdd6f2){this[_0x51ed('0x10')][_0x51ed('0x31')](_0x15f6d6)[_0x51ed('0x14')](function(_0x51a302){_0xfdd6f2(null,_0x51a302);})['catch'](function(_0x5db2cf){_0xfdd6f2(_0x5db2cf);});};AGIVertices['prototype'][_0x51ed('0x32')]=function(_0x42a193,_0x35a0d3,_0x390810){this[_0x51ed('0x10')]['createSquareDetailsReport']({'uniqueid':this[_0x51ed('0x33')][_0x51ed('0x34')],'node':_0x42a193[_0x51ed('0x35')],'application':_0x42a193[_0x51ed('0x36')],'data':_0x35a0d3||null,'project_name':this['channel']['arg_1'],'callerid':this[_0x51ed('0x33')][_0x51ed('0x37')]})['then'](function(_0x398da2){if(_0x390810){_0x390810(null,_0x398da2);}})[_0x51ed('0x18')](function(_0x2d31f2){if(_0x390810){_0x390810(_0x2d31f2);}});};AGIVertices[_0x51ed('0x12')][_0x51ed('0x38')]=function(_0x32dfc9,_0x5b5981,_0x25b4c9,_0x3f170e){this[_0x51ed('0x10')]['createSquareRecording']({'uniqueid':this[_0x51ed('0x33')]['uniqueid'],'callerid':this[_0x51ed('0x33')][_0x51ed('0x37')],'calleridname':this[_0x51ed('0x33')][_0x51ed('0x39')],'context':this[_0x51ed('0x33')][_0x51ed('0x3a')],'extension':this['channel'][_0x51ed('0x3b')],'priority':this[_0x51ed('0x33')]['priority'],'accountcode':this[_0x51ed('0x33')][_0x51ed('0x3c')],'dnid':this[_0x51ed('0x33')][_0x51ed('0x3d')],'projectName':this[_0x51ed('0x33')][_0x51ed('0x3e')],'saveName':_0x5b5981,'filename':_0x32dfc9[_0x51ed('0x3f')]||_0x5b5981,'savePath':_0x25b4c9})[_0x51ed('0x14')](function(_0x19e046){_0x3f170e(null,_0x19e046);})[_0x51ed('0x18')](function(_0x4ba0ad){_0x3f170e(_0x4ba0ad);});};AGIVertices[_0x51ed('0x12')]['createSquareMessage']=function(_0x247e41,_0x275fa8,_0x443d86,_0x3981e4,_0x339c4e){this[_0x51ed('0x10')][_0x51ed('0x40')]({'uniqueid':this[_0x51ed('0x33')][_0x51ed('0x34')],'body':_0x247e41,'direction':_0x275fa8,'providerName':_0x443d86,'providerResponse':_0x3981e4})[_0x51ed('0x14')](function(_0x156a5f){if(_0x339c4e){_0x339c4e(null,_0x156a5f);}})[_0x51ed('0x18')](function(_0x153046){if(_0x339c4e){_0x339c4e(_0x153046);}});};AGIVertices['prototype']['createCmContact']=function(_0x3f0a7a,_0x5c4941){this['rpc'][_0x51ed('0x41')]({'firstName':_['isEmpty'](_0x3f0a7a[_0x51ed('0x17')])||_[_0x51ed('0x42')](_0x3f0a7a['name'])?_0x51ed('0x43')+Math[_0x51ed('0x44')]():_0x3f0a7a[_0x51ed('0x17')],'lastName':_['isEmpty'](_0x3f0a7a['lastName'])||_[_0x51ed('0x42')](_0x3f0a7a[_0x51ed('0x45')])?null:_0x3f0a7a[_0x51ed('0x45')],'phone':_0x3f0a7a[_0x51ed('0x46')],'ListId':_0x3f0a7a[_0x51ed('0x47')],'scheduledat':_0x3f0a7a[_0x51ed('0x48')],'callbackUniqueid':this[_0x51ed('0x33')]['uniqueid'],'tags':'callback','description':'Callback\x20scheduled\x20at\x20'+_0x3f0a7a['scheduledAt'][_0x51ed('0x49')](),'priority':_0x3f0a7a[_0x51ed('0x4a')]})['then'](function(_0x5412bd){_0x5c4941(null,_0x5412bd);})[_0x51ed('0x18')](function(_0xaf769d){_0x5c4941(_0xaf769d);});};AGIVertices[_0x51ed('0x12')][_0x51ed('0x4b')]=function(_0xacac8a,_0x530a65){this[_0x51ed('0x10')][_0x51ed('0x4c')](_0xacac8a)[_0x51ed('0x14')](function(_0x52dc05){_0x530a65(null,_0x52dc05?_0x52dc05[_0x51ed('0x17')]:![]);})['catch'](function(_0x57baab){_0x530a65(_0x57baab);});};AGIVertices['prototype']['agentPause']=function(_0x525ae4,_0x165785,_0x26dcfc){var _0x2b31a9={'role':_0x51ed('0x4d')};_0x2b31a9[_0x525ae4]=this[_0x51ed('0x33')]['callerid'];this[_0x51ed('0x10')][_0x51ed('0x4e')](_0x2b31a9,_0x165785,this['channel'][_0x51ed('0x34')])[_0x51ed('0x14')](function(_0x1b745e){_0x26dcfc(null,_[_0x51ed('0x42')](_0x1b745e)?![]:!![]);})[_0x51ed('0x18')](function(_0x3205de){logger[_0x51ed('0x2a')](_0x3205de);_0x26dcfc(null,![]);});};AGIVertices[_0x51ed('0x12')]['agentUnpause']=function(_0x307f3c,_0x4a7d1d){var _0x417b4f={'role':_0x51ed('0x4d')};_0x417b4f[_0x307f3c]=this['channel']['callerid'];this['rpc'][_0x51ed('0x4f')](_0x417b4f)['then'](function(_0x13855c){_0x4a7d1d(null,_[_0x51ed('0x42')](_0x13855c)?![]:!![]);})['catch'](function(_0xe426a5){logger[_0x51ed('0x2a')](_0xe426a5);_0x4a7d1d(null,![]);});};AGIVertices['prototype'][_0x51ed('0x50')]=function(_0x34dc0d,_0x4e3f53){var _0x8b8170={'role':_0x51ed('0x4d')};_0x8b8170[_0x34dc0d]=this[_0x51ed('0x33')][_0x51ed('0x37')];this[_0x51ed('0x10')][_0x51ed('0x50')](_0x8b8170)['then'](function(_0x2ba6e4){_0x4e3f53(null,_['isNil'](_0x2ba6e4)?![]:!![]);})[_0x51ed('0x18')](function(_0x567877){logger['error'](_0x567877);_0x4e3f53(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x33eb3f,_0x4da472){var _0x4104b1={'role':_0x51ed('0x4d')};_0x4104b1[_0x33eb3f]=this[_0x51ed('0x33')]['callerid'];var _0xc5e491=_0x33eb3f!='internal'?util[_0x51ed('0x27')](_0x51ed('0x51'),_0x51ed('0x52'),this[_0x51ed('0x33')][_0x51ed('0x37')]):undefined;this['rpc']['agentLogin'](_0x4104b1,_0xc5e491)[_0x51ed('0x14')](function(_0x524121){_0x4da472(null,_[_0x51ed('0x42')](_0x524121)?![]:!![]);})[_0x51ed('0x18')](function(_0x5f3237){logger[_0x51ed('0x2a')](_0x5f3237);_0x4da472(null,![]);});};AGIVertices[_0x51ed('0x12')][_0x51ed('0x53')]=function(_0x234094,_0xd70653){sh['exec'](_['trim'](_0x234094),function(_0x2ee4ac,_0x2a489b){var _0x3ee5e6=_0x2a489b['replace'](/(\r\n|\n|\r)/gm,'');_0xd70653(null,_0x3ee5e6);});};AGIVertices[_0x51ed('0x12')][_0x51ed('0x54')]=function(_0x14fbf5,_0x5eef55){scripts[_0x51ed('0x54')](_0x14fbf5['apiKey'],_0x14fbf5['google_cloud_tts_text_type']||_0x51ed('0x55'),_0x14fbf5[_0x51ed('0x55')],_0x14fbf5[_0x51ed('0x56')]||'en-US',_0x14fbf5[_0x51ed('0x57')]||'MALE',_0x14fbf5['audioEncoding']||'MP3')['then'](function(_0x21feb2){_0x5eef55(null,_0x21feb2);})[_0x51ed('0x18')](function(_0x33c9a1){_0x5eef55(_0x33c9a1);});};AGIVertices[_0x51ed('0x12')][_0x51ed('0x58')]=function(_0x39920b,_0x1fea2a){scripts[_0x51ed('0x58')](_0x39920b['text'],_0x39920b[_0x51ed('0x59')]||'en',0x1)[_0x51ed('0x14')](function(_0x2a8a71){_0x1fea2a(null,_0x2a8a71);})[_0x51ed('0x18')](function(_0x1ee3dd){_0x1fea2a(_0x1ee3dd);});};AGIVertices[_0x51ed('0x12')][_0x51ed('0x5a')]=function(_0x40a59d,_0x4ee545){var _0x4a84a8={'uri':_0x40a59d[_0x51ed('0x5b')],'method':_0x40a59d[_0x51ed('0x5c')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x40a59d[_0x51ed('0x5d')])===_0x51ed('0x5e')&&parseInt(_0x40a59d[_0x51ed('0x5d')])>=0x1?parseInt(_0x40a59d[_0x51ed('0x5d')])*0x3e8:0x5*0x3e8};if(_[_0x51ed('0x5f')]([_0x51ed('0x60'),_0x51ed('0x61')],_0x4a84a8['method']['toUpperCase']())){try{_0x4a84a8[_0x51ed('0x62')]=_0x40a59d['rawBody']?JSON[_0x51ed('0x63')](_0x40a59d[_0x51ed('0x64')]):{};}catch(_0x48b830){logger[_0x51ed('0x2a')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x48b830);}}try{_0x4a84a8[_0x51ed('0x65')]=_0x40a59d[_0x51ed('0xe')]?JSON['parse'](_0x40a59d[_0x51ed('0xe')]):{};}catch(_0x42ca32){logger['error'](_0x51ed('0x66'),_0x42ca32);}if(_0x40a59d[_0x51ed('0x67')]){try{var _0x145d98=require(_0x40a59d[_0x51ed('0x67')])[_0x51ed('0x68')](this,_0x4a84a8);_0x4a84a8['uri']=Mustache[_0x51ed('0x69')](_0x40a59d['url'],_0x145d98,{},['$$','$$']);if(_0x4a84a8[_0x51ed('0x65')]){_0x4a84a8[_0x51ed('0x65')]=JSON[_0x51ed('0x63')](Mustache[_0x51ed('0x69')](JSON[_0x51ed('0x6a')](_0x4a84a8['headers']),_0x145d98,{},['$$','$$']));}if(_0x4a84a8[_0x51ed('0x62')]){_0x4a84a8[_0x51ed('0x62')]=JSON[_0x51ed('0x63')](Mustache[_0x51ed('0x69')](JSON[_0x51ed('0x6a')](_0x4a84a8[_0x51ed('0x62')]),_0x145d98,{},['$$','$$']));}}catch(_0x1b93cb){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1b93cb);}}rp(_0x4a84a8)[_0x51ed('0x14')](function(_0x22dabd){var _0x53b78b={'statusCode':_0x22dabd[_0x51ed('0x6b')]||0xc8,'statusMessage':_0x22dabd[_0x51ed('0x6c')]||'OK','headers':_0x22dabd[_0x51ed('0x65')]||{},'body':_0x22dabd['body']||{}};_0x4ee545(null,_0x53b78b);})[_0x51ed('0x18')](function(_0x12d73c){var _0x6bfe81={'statusCode':_0x12d73c[_0x51ed('0x6b')]||0x1f4,'statusMessage':_0x12d73c[_0x51ed('0x6d')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x12d73c['options'][_0x51ed('0x65')]||{},'body':_0x12d73c['options'][_0x51ed('0x62')]||{}};_0x4ee545(null,_0x6bfe81);});};AGIVertices[_0x51ed('0x12')][_0x51ed('0x6e')]=function(_0x460397,_0x16c6cc){scripts[_0x51ed('0x6e')](this[_0x51ed('0x33')][_0x51ed('0x34')],_0x460397[_0x51ed('0x6f')],_0x460397[_0x51ed('0x55')],_0x460397[_0x51ed('0x70')]||'en')[_0x51ed('0x14')](function(_0x53d8c2){_0x16c6cc(null,_0x53d8c2);})['catch'](function(_0x2d4b1e){_0x16c6cc(_0x2d4b1e);});};AGIVertices['prototype'][_0x51ed('0x71')]=function(_0x13f8c9,_0x28dbdc){scripts[_0x51ed('0x71')](this[_0x51ed('0x33')][_0x51ed('0x34')],_0x13f8c9['dialogflowV2_project_id'],_0x13f8c9[_0x51ed('0x72')],_0x13f8c9['private_key'],_0x13f8c9[_0x51ed('0x55')],_0x13f8c9['dialogflowV2_language']||'en')['then'](function(_0x2d138d){_0x28dbdc(null,_0x2d138d);})[_0x51ed('0x18')](function(_0x1e6a03){_0x28dbdc(_0x1e6a03);});};AGIVertices[_0x51ed('0x12')][_0x51ed('0x73')]=function(_0x17a493,_0x38b96f){scripts[_0x51ed('0x73')](this['channel'],_0x17a493)[_0x51ed('0x14')](function(_0x1cddf0){_0x38b96f(null,_0x1cddf0);})[_0x51ed('0x18')](function(_0x318aab){_0x38b96f(_0x318aab);});};AGIVertices[_0x51ed('0x12')][_0x51ed('0x74')]=function(_0x46ca89,_0x1997a8){scripts[_0x51ed('0x74')](_0x46ca89[_0x51ed('0x6f')],_0x46ca89[_0x51ed('0x55')],_0x46ca89['ispeech_tts_language']||'en-US',_0x46ca89[_0x51ed('0x75')])[_0x51ed('0x14')](function(_0x4a3790){_0x1997a8(null,_0x4a3790);})[_0x51ed('0x18')](function(_0x4245ab){_0x1997a8(_0x4245ab);});};AGIVertices[_0x51ed('0x12')]['ispeechASR']=function(_0x350721,_0x5ba043,_0x2709de){scripts[_0x51ed('0x76')](_0x5ba043,_0x350721[_0x51ed('0x6f')],_0x350721[_0x51ed('0x77')]||_0x51ed('0x78'),this[_0x51ed('0x79')](_0x350721[_0x51ed('0x7a')])?_0x350721[_0x51ed('0x7a')]:undefined)['then'](function(_0x53ec52){_0x2709de(null,_0x53ec52);})['catch'](function(_0x7cbf09){_0x2709de(_0x7cbf09);});};AGIVertices['prototype'][_0x51ed('0x7b')]=function(_0x33f762,_0x4be008){scripts['awsPolly'](_0x33f762[_0x51ed('0x7c')],_0x33f762[_0x51ed('0x7d')],_0x33f762[_0x51ed('0x7e')],_0x33f762[_0x51ed('0x7f')]||_0x51ed('0x80'),_0x33f762[_0x51ed('0x55')],_0x33f762[_0x51ed('0x81')]||_0x51ed('0x55'))[_0x51ed('0x14')](function(_0x642c73){_0x4be008(null,_0x642c73);})['catch'](function(_0x26966e){_0x4be008(_0x26966e);});};AGIVertices[_0x51ed('0x12')][_0x51ed('0x82')]=function(_0x35a89c,_0x746436){scripts[_0x51ed('0x82')](this[_0x51ed('0x33')][_0x51ed('0x34')],_0x35a89c[_0x51ed('0x7c')],_0x35a89c[_0x51ed('0x7d')],_0x35a89c[_0x51ed('0x83')],_0x35a89c[_0x51ed('0x55')],_0x35a89c['aws_bot_name'])[_0x51ed('0x14')](function(_0x1b8473){_0x746436(null,_0x1b8473);})[_0x51ed('0x18')](function(_0x198141){_0x746436(_0x198141);});};AGIVertices['prototype']['googleASR']=function(_0x241b51,_0x5e4dc0,_0x372e04){scripts[_0x51ed('0x84')](_0x5e4dc0,_0x241b51['key'],_0x241b51['google_asr_language']||_0x51ed('0x78'))[_0x51ed('0x14')](function(_0x51fbc1){_0x372e04(null,_0x51fbc1);})['catch'](function(_0x11c5f5){_0x372e04(_0x11c5f5);});};AGIVertices['prototype'][_0x51ed('0x85')]=function(_0x18a77f,_0x339c8b,_0x248f33){scripts[_0x51ed('0x85')](_0x339c8b,_0x18a77f[_0x51ed('0x86')],_0x18a77f['appsecret'],_0x18a77f[_0x51ed('0x87')])[_0x51ed('0x14')](function(_0x101a6b){_0x248f33(null,_0x101a6b);})[_0x51ed('0x18')](function(_0x11b318){_0x248f33(_0x11b318);});};AGIVertices[_0x51ed('0x12')]['clear']=function(_0x25ea3f){var _0x1bf8b3=_[_0x51ed('0x5f')](verticesWithRetry,_0x25ea3f[_0x51ed('0x36')])?_0x25ea3f:_['clone'](_0x25ea3f);for(var _0x4b9e43 in _0x1bf8b3){if(_0x1bf8b3['hasOwnProperty'](_0x4b9e43)){if(_0x1bf8b3[_0x4b9e43]&&_[_0x51ed('0x88')](_0x1bf8b3[_0x4b9e43])){if(_[_0x51ed('0x5f')](recursiveMapAttributes,_0x4b9e43)){_0x1bf8b3[_0x4b9e43]=this[_0x51ed('0x89')](_0x1bf8b3[_0x4b9e43]);}else{_0x1bf8b3[_0x4b9e43]=this[_0x51ed('0x8a')](_0x1bf8b3[_0x4b9e43]);}}}}return _0x1bf8b3;};AGIVertices['prototype']['recursiveNodeIndex']=function(_0x9f80ff){for(var _0x2779bb in _0x9f80ff){if(_0x9f80ff[_0x51ed('0x8b')](_0x2779bb)){if(_[_0x51ed('0x8c')](_0x9f80ff[_0x2779bb])){this[_0x51ed('0x8d')](_0x9f80ff[_0x2779bb]);}else if(_[_0x51ed('0x8e')](_0x9f80ff[_0x2779bb])){for(var _0xb3f1d3=0x0;_0xb3f1d3<_0x9f80ff[_0x2779bb]['length'];_0xb3f1d3++){this['recursiveNodeIndex'](_0x9f80ff[_0x2779bb][_0xb3f1d3]);}}else if(_['isString'](_0x9f80ff[_0x2779bb])){_0x9f80ff[_0x2779bb]=this[_0x51ed('0x8a')](_0x9f80ff[_0x2779bb]);}}}};AGIVertices[_0x51ed('0x12')][_0x51ed('0x8f')]=function(_0x390487,_0x320c3a){for(var _0x3d7b25 in _0x390487){if(_0x390487['hasOwnProperty'](_0x3d7b25)){if(_[_0x51ed('0x8c')](_0x390487[_0x3d7b25])){if(!_['isEmpty'](_0x390487[_0x3d7b25])){this[_0x51ed('0x8f')](_0x390487[_0x3d7b25],util[_0x51ed('0x27')](_0x51ed('0x90'),_0x320c3a,_0x3d7b25));}}else if(_[_0x51ed('0x8e')](_0x390487[_0x3d7b25])){for(var _0x38a12b=0x0;_0x38a12b<_0x390487[_0x3d7b25][_0x51ed('0x91')];_0x38a12b++){this[_0x51ed('0x8f')](_0x390487[_0x3d7b25][_0x38a12b],util[_0x51ed('0x27')](_0x51ed('0x90'),_0x320c3a,_0x3d7b25+'['+_0x38a12b+']'));}}else{if(!_[_0x51ed('0x42')](_0x390487[_0x3d7b25])){this[_0x51ed('0x33')][_0x51ed('0x92')](util['format'](_0x51ed('0x90'),_0x320c3a,_0x3d7b25),_0x390487[_0x3d7b25]);}}}}};AGIVertices[_0x51ed('0x12')][_0x51ed('0x89')]=function(_0x4a451f){try{var _0x42d28c=JSON[_0x51ed('0x63')](_0x4a451f);this[_0x51ed('0x8d')](_0x42d28c);return JSON['stringify'](_0x42d28c);}catch(_0x3183c7){return this[_0x51ed('0x8a')](_0x4a451f);}};AGIVertices[_0x51ed('0x12')][_0x51ed('0x8a')]=function(_0x322055){var _0x2819fa=_0x322055[_0x51ed('0x93')]('{');for(var _0x5e794a=0x1;_0x5e794a<_0x2819fa[_0x51ed('0x91')];_0x5e794a+=0x1){var _0x545e53=_0x2819fa[_0x5e794a][_0x51ed('0x93')]('}');if(_0x545e53[_0x51ed('0x91')]>0x1){_0x322055=_0x322055[_0x51ed('0x94')]('{'+_0x545e53[0x0]+'}',this[_0x51ed('0x33')]['getVariable'](_0x545e53[0x0])[_0x51ed('0x95')]||_0x545e53[0x0]);}}if(_0x2819fa['length']===0x1){return _0x322055['toString']();}return this[_0x51ed('0x8a')](_0x322055);};AGIVertices[_0x51ed('0x12')][_0x51ed('0x96')]=function(_0x559219,_0x337879){var _0x93ce6=this[_0x51ed('0x33')][_0x51ed('0x97')](_0x559219);if(_0x93ce6[_0x51ed('0x98')]===-0x1){return _0x93ce6;}logger[_0x51ed('0x99')](util[_0x51ed('0x27')](_0x51ed('0x9a'),_0x337879,_0x93ce6[_0x51ed('0x95')]));return this[_0x51ed('0x33')]['setVariable'](_0x337879,_0x93ce6['extra']);};AGIVertices[_0x51ed('0x12')][_0x51ed('0x79')]=function(_0x2b068b){return _0x2b068b&&_0x2b068b!=='0'&&_0x2b068b!=='-1'&&_0x2b068b!=='';};AGIVertices[_0x51ed('0x12')]['maxRetry']=function(_0x2a4b30){this[_0x51ed('0x32')][_0x51ed('0x68')](this,_0x2a4b30,'-');_0x2a4b30[_0x51ed('0x9b')]=_0x2a4b30['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x51ed('0x12')]['mrcpsynth']=function(_0x1207cf){logger[_0x51ed('0x99')](util['format'](_0x51ed('0x9c'),_0x1207cf[_0x51ed('0x35')]));if(!this[_0x51ed('0x79')](_0x1207cf[_0x51ed('0x55')])){return this[_0x51ed('0x33')]['noop'](_0x51ed('0x9d'));}var _0x21fe86='\x22'+_0x1207cf[_0x51ed('0x55')]+'\x22';if(this['isConfigured'](_0x1207cf['options'])){_0x21fe86+=','+_0x1207cf[_0x51ed('0x9e')];}var _0x20eaa4=this[_0x51ed('0x33')]['exec']('MRCPSynth',_0x21fe86);if(_0x20eaa4[_0x51ed('0x98')]===-0x1){return _0x20eaa4;}return this['channel'][_0x51ed('0x9f')](util[_0x51ed('0x27')](_0x51ed('0xa0'),_0x21fe86));};AGIVertices[_0x51ed('0x12')]['mrcprecog']=function(_0x52c609){logger[_0x51ed('0x99')](util[_0x51ed('0x27')](_0x51ed('0xa1'),_0x52c609['label']));if(!this[_0x51ed('0x79')](_0x52c609['grammar'])){return this[_0x51ed('0x33')][_0x51ed('0x9f')](_0x51ed('0xa2'));}var _0xf92f71=_0x52c609[_0x51ed('0xa3')];if(this[_0x51ed('0x79')](_0x52c609[_0x51ed('0x9e')])){_0xf92f71+=','+_0x52c609[_0x51ed('0x9e')];}var _0x8b0728=this[_0x51ed('0x33')]['exec'](_0x51ed('0xa4'),_0xf92f71);if(_0x8b0728['result']===-0x1){return _0x8b0728;}var _0x1f32f9=this[_0x51ed('0x96')]('RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE');if(_0x1f32f9[_0x51ed('0x98')]===-0x1){return _0x1f32f9;}var _0x91dfe8=this[_0x51ed('0x96')](_0x51ed('0xa5'),'MRCP_RECOG_TRANSCRIPT');if(_0x91dfe8['result']===-0x1){return _0x91dfe8;}var _0x18f599=this[_0x51ed('0x96')](_0x51ed('0xa6'),'MRCP_RECOG_INSTANCE');if(_0x18f599[_0x51ed('0x98')]===-0x1){return _0x18f599;}return this['channel'][_0x51ed('0x9f')](util[_0x51ed('0x27')](_0x51ed('0xa7'),_0xf92f71));};AGIVertices[_0x51ed('0x12')][_0x51ed('0xa')]=function(_0x9560eb){logger[_0x51ed('0x99')](util[_0x51ed('0x27')](_0x51ed('0xa8'),_0x9560eb[_0x51ed('0x35')]));return this[_0x51ed('0x33')][_0x51ed('0xa')]([_0x9560eb[_0x51ed('0xa9')],_0x9560eb[_0x51ed('0xaa')]]);};AGIVertices[_0x51ed('0x12')][_0x51ed('0xab')]=function(_0x348b76){logger['info'](util['format'](_0x51ed('0xac'),_0x348b76[_0x51ed('0x35')]));if(this[_0x51ed('0x79')](_0x348b76[_0x51ed('0x5d')])){logger[_0x51ed('0x99')](util['format'](_0x51ed('0xad'),_0x348b76[_0x51ed('0x5d')]));var _0x5ac010=this[_0x51ed('0x33')]['wait'](_0x348b76[_0x51ed('0x5d')]);if(_0x5ac010[_0x51ed('0x98')]===-0x1){return _0x5ac010;}}return this[_0x51ed('0x33')][_0x51ed('0xab')]();};AGIVertices[_0x51ed('0x12')][_0x51ed('0xae')]=function(_0x504e3b){logger[_0x51ed('0x99')](util['format']('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x504e3b[_0x51ed('0x35')]));if(!this['isConfigured'](_0x504e3b[_0x51ed('0x47')])){return this[_0x51ed('0x33')][_0x51ed('0x2a')](_0x504e3b,_0x51ed('0xaf'));}_0x504e3b['scheduledAt']=moment();if(this[_0x51ed('0x79')](_0x504e3b[_0x51ed('0xb0')])){_0x504e3b['scheduledAt']=moment()[_0x51ed('0xb1')](_0x504e3b[_0x51ed('0xb0')],_0x51ed('0xb2'));}if(!this[_0x51ed('0x79')](_0x504e3b[_0x51ed('0x4a')])){_0x504e3b[_0x51ed('0x4a')]=0x2;}this[_0x51ed('0x41')][_0x51ed('0x68')](this,_0x504e3b);return this[_0x51ed('0x33')][_0x51ed('0x9f')](util[_0x51ed('0x27')](_0x51ed('0xb3'),_0x504e3b[_0x51ed('0x46')],_0x504e3b[_0x51ed('0x47')],_0x504e3b[_0x51ed('0x48')]));};AGIVertices['prototype']['custom_app']=function(_0x2583a5){logger[_0x51ed('0x99')](util[_0x51ed('0x27')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x2583a5['label']));var _0x4918a5=this[_0x51ed('0x33')][_0x51ed('0xb4')](_0x2583a5['application'],_0x2583a5[_0x51ed('0x9e')]);if(_0x4918a5['result']===-0x1){return _0x4918a5;}return this[_0x51ed('0x33')][_0x51ed('0x9f')](util[_0x51ed('0x27')](_0x51ed('0xb5'),_0x2583a5[_0x51ed('0xb6')],_0x2583a5[_0x51ed('0x9e')]));};AGIVertices[_0x51ed('0x12')]['lumenvoxtts']=function(_0xc2fa58){logger[_0x51ed('0x99')](util[_0x51ed('0x27')](_0x51ed('0xb7'),_0xc2fa58[_0x51ed('0x35')]));if(!this[_0x51ed('0x79')](_0xc2fa58[_0x51ed('0x55')])){return this['channel'][_0x51ed('0x9f')](_0x51ed('0x9d'));}var _0x324ef5='\x22'+_0xc2fa58[_0x51ed('0x55')]+'\x22';if(this['isConfigured'](_0xc2fa58[_0x51ed('0x9e')])){_0x324ef5+=','+_0xc2fa58[_0x51ed('0x9e')];}var _0x2f8de2=this[_0x51ed('0x33')][_0x51ed('0xb4')]('MRCPSynth',_0x324ef5);if(_0x2f8de2[_0x51ed('0x98')]===-0x1){return _0x2f8de2;}return this[_0x51ed('0x33')][_0x51ed('0x9f')](util['format'](_0x51ed('0xa0'),_0x324ef5));};AGIVertices[_0x51ed('0x12')][_0x51ed('0xb8')]=function(_0x52d77c){logger[_0x51ed('0x99')](util['format'](_0x51ed('0xb9'),_0x52d77c[_0x51ed('0x35')]));if(!this[_0x51ed('0x79')](_0x52d77c[_0x51ed('0x55')])){return this['channel'][_0x51ed('0x9f')]('no\x20text\x20configured');}var _0x12c982='\x22'+_0x52d77c['text']+'\x22';if(this[_0x51ed('0x79')](_0x52d77c[_0x51ed('0x9e')])){_0x12c982+=','+_0x52d77c[_0x51ed('0x9e')];}var _0x263865=this['channel'][_0x51ed('0xb4')]('MRCPSynth',_0x12c982);if(_0x263865[_0x51ed('0x98')]===-0x1){return _0x263865;}return this[_0x51ed('0x33')]['noop'](util[_0x51ed('0x27')](_0x51ed('0xa0'),_0x12c982));};AGIVertices['prototype']['lumenvoxasr']=function(_0x1d5661){logger[_0x51ed('0x99')](util[_0x51ed('0x27')](_0x51ed('0xba'),_0x1d5661[_0x51ed('0x35')]));if(!this[_0x51ed('0x79')](_0x1d5661[_0x51ed('0xa3')])){return this[_0x51ed('0x33')][_0x51ed('0x9f')]('no\x20grammar\x20configured');}var _0x561dcd=_0x1d5661[_0x51ed('0xa3')];if(this[_0x51ed('0x79')](_0x1d5661[_0x51ed('0x9e')])){_0x561dcd+=','+_0x1d5661['options'];}var _0x637160=this[_0x51ed('0x33')][_0x51ed('0xb4')](_0x51ed('0xa4'),_0x561dcd);if(_0x637160['result']===-0x1){return _0x637160;}var _0x216957=this['getAndSetVariable'](_0x51ed('0xbb'),_0x51ed('0xbc'));if(_0x216957[_0x51ed('0x98')]===-0x1){return _0x216957;}var _0x2d53f5=this['getAndSetVariable']('RECOG_INPUT()',_0x51ed('0xbd'));if(_0x2d53f5[_0x51ed('0x98')]===-0x1){return _0x2d53f5;}var _0x188ac9=this[_0x51ed('0x96')](_0x51ed('0xa6'),_0x51ed('0xbe'));if(_0x188ac9[_0x51ed('0x98')]===-0x1){return _0x188ac9;}return this['channel'][_0x51ed('0x9f')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x561dcd));};AGIVertices[_0x51ed('0x12')][_0x51ed('0xbf')]=function(_0x5d7669){logger[_0x51ed('0x99')](util[_0x51ed('0x27')](_0x51ed('0xc0'),_0x5d7669['label']));if(!this[_0x51ed('0x79')](_0x5d7669['grammar'])){return this[_0x51ed('0x33')][_0x51ed('0x9f')](_0x51ed('0xa2'));}var _0x3127bb=_0x5d7669[_0x51ed('0xa3')];if(this[_0x51ed('0x79')](_0x5d7669[_0x51ed('0x9e')])){_0x3127bb+=','+_0x5d7669[_0x51ed('0x9e')];}var _0x5af348=this[_0x51ed('0x33')]['exec'](_0x51ed('0xa4'),_0x3127bb);if(_0x5af348[_0x51ed('0x98')]===-0x1){return _0x5af348;}var _0x5cea73=this['getAndSetVariable'](_0x51ed('0xbb'),'SESTEK_ASR_CONFIDENCE');if(_0x5cea73['result']===-0x1){return _0x5cea73;}var _0x2a22b1=this[_0x51ed('0x96')](_0x51ed('0xa5'),'SESTEK_ASR_TRANSCRIPT');if(_0x2a22b1['result']===-0x1){return _0x2a22b1;}var _0x1ca588=this['getAndSetVariable']('RECOG_INSTANCE()',_0x51ed('0xc1'));if(_0x1ca588[_0x51ed('0x98')]===-0x1){return _0x1ca588;}return this[_0x51ed('0x33')][_0x51ed('0x9f')](util[_0x51ed('0x27')](_0x51ed('0xa7'),_0x3127bb));};AGIVertices[_0x51ed('0x12')][_0x51ed('0xc2')]=function(_0x11a3a2){logger[_0x51ed('0x99')](util['format'](_0x51ed('0xc3'),_0x11a3a2['label']));if(!this[_0x51ed('0x79')](_0x11a3a2[_0x51ed('0xc4')])){return this[_0x51ed('0x33')][_0x51ed('0x2a')](_0x11a3a2,_0x51ed('0xc5'));}var _0x1e7709=this[_0x51ed('0x1a')][_0x51ed('0x68')](this,_0x11a3a2[_0x51ed('0xc4')]);if(!_0x1e7709){return this[_0x51ed('0x33')][_0x51ed('0x2a')](_0x11a3a2,_0x51ed('0xc6'));}if(!this[_0x51ed('0x79')](_0x11a3a2['query'])){return this['channel']['error'](_0x11a3a2,_0x51ed('0xc7'));}var _0x226bde=_0x11a3a2['query'][_0x51ed('0xc8')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x51ed('0x9f')](util[_0x51ed('0x27')](_0x51ed('0xc9'),_0x226bde));var _0x133f32=this[_0x51ed('0x28')]['sync'](this,_0x1e7709,_0x226bde);this['createSquareDetailsReport']['sync'](this,_0x11a3a2,_0x226bde);if(!this['isConfigured'](_0x11a3a2[_0x51ed('0xca')])){return this['channel'][_0x51ed('0x9f')](_0x51ed('0xcb'));}var _0x52c68f=this['getVariable'][_0x51ed('0x68')](this,_0x11a3a2[_0x51ed('0xca')]);if(!_0x52c68f){return this['channel']['error'](_0x11a3a2,'no\x20variable\x20found');}var _0x4b5e3b=this;_0x133f32[_0x51ed('0xcc')](function(_0x1b22cb,_0xd00c34){Object[_0x51ed('0xcd')](_0x1b22cb)[_0x51ed('0xcc')](function(_0x2b66db){_0x4b5e3b['channel'][_0x51ed('0x92')](util['format'](_0x51ed('0xce'),_0x52c68f,_0xd00c34,_0x2b66db),_0x1b22cb[_0x2b66db]);});});this[_0x51ed('0x33')][_0x51ed('0x92')](util['format'](_0x51ed('0xcf'),_0x52c68f),_0x133f32[_0x51ed('0x91')]);return this['channel']['noop'](util[_0x51ed('0x27')](_0x51ed('0xd0'),_0x52c68f));};AGIVertices[_0x51ed('0x12')][_0x51ed('0xd1')]=function(_0x199c4d){logger[_0x51ed('0xd2')](util[_0x51ed('0x27')](_0x51ed('0xd3'),_0x199c4d[_0x51ed('0x35')]));if(!this[_0x51ed('0x79')](_0x199c4d[_0x51ed('0xd4')])){return this['channel'][_0x51ed('0x2a')](_0x199c4d,_0x51ed('0xd5'));}var _0x5aac3e=this['getUser'][_0x51ed('0x68')](this,_0x199c4d['sip_id']);if(!_0x5aac3e){return this['channel'][_0x51ed('0x2a')](_0x199c4d,_0x51ed('0xd6'));}var _0x1d12dd=this[_0x51ed('0x33')][_0x51ed('0xb4')]('DIAL',[util[_0x51ed('0x27')](_0x51ed('0xd7'),_0x5aac3e),_0x199c4d[_0x51ed('0x5d')],_0x199c4d[_0x51ed('0xd8')],_0x199c4d[_0x51ed('0x5b')]]);if(_0x1d12dd['result']===-0x1){return _0x1d12dd;}return this[_0x51ed('0x33')][_0x51ed('0x9f')](util[_0x51ed('0x27')]('Executed\x20command\x20%s',_0x51ed('0xd9')));};AGIVertices[_0x51ed('0x12')][_0x51ed('0xda')]=function(_0x1a6f87){logger[_0x51ed('0x99')](util[_0x51ed('0x27')](_0x51ed('0xdb'),_0x1a6f87['label']));if(!this[_0x51ed('0x79')](_0x1a6f87['key'])){return this[_0x51ed('0x33')][_0x51ed('0x9f')](_0x51ed('0xdc'));}if(!this['isConfigured'](_0x1a6f87[_0x51ed('0x55')])){return this['channel'][_0x51ed('0x9f')](_0x51ed('0x9d'));}this[_0x51ed('0x33')]['bot']=!![];this['createSquareDetailsReport'](_0x1a6f87);this[_0x51ed('0x40')](_0x1a6f87['text'],'in','','');this['channel'][_0x51ed('0x9f')](util[_0x51ed('0x27')]('Trying\x20Dialogflow:\x20%s',_0x1a6f87[_0x51ed('0x55')]));var _0x4e517d=this[_0x51ed('0x6e')][_0x51ed('0x68')](this,_0x1a6f87);if(_0x4e517d){for(var _0x197997 in _0x4e517d){if(_0x4e517d[_0x51ed('0x8b')](_0x197997)){this[_0x51ed('0x33')][_0x51ed('0x92')](util[_0x51ed('0x27')](_0x51ed('0xdd'),_0x197997[_0x51ed('0xde')]()),_0x4e517d[_0x197997]);}}this[_0x51ed('0x40')](_0x4e517d[_0x51ed('0xdf')],_0x51ed('0xe0'),_0x51ed('0xda'),'');return this[_0x51ed('0x33')][_0x51ed('0x9f')](util[_0x51ed('0x27')](_0x51ed('0xe1'),_0x4e517d['speech']));}return this[_0x51ed('0x33')]['error'](_0x1a6f87,_0x51ed('0xe2'));};AGIVertices[_0x51ed('0x12')][_0x51ed('0xe3')]=function(_0x53c46b){logger[_0x51ed('0x99')](util[_0x51ed('0x27')](_0x51ed('0xe4'),_0x53c46b[_0x51ed('0x35')]));if(!this[_0x51ed('0x79')](_0x53c46b['dialogflowV2_project_id'])){return this[_0x51ed('0x33')][_0x51ed('0x9f')](_0x51ed('0xe5'));}if(!this[_0x51ed('0x79')](_0x53c46b['client_email'])){return this[_0x51ed('0x33')]['noop'](_0x51ed('0xe6'));}if(!this['isConfigured'](_0x53c46b[_0x51ed('0xe7')])){return this['channel'][_0x51ed('0x9f')]('no\x20private_key\x20configured');}if(!this['isConfigured'](_0x53c46b[_0x51ed('0xe8')])){return this['channel'][_0x51ed('0x9f')]('no\x20anguage\x20configured');}if(!this[_0x51ed('0x79')](_0x53c46b['text'])){return this[_0x51ed('0x33')][_0x51ed('0x9f')](_0x51ed('0x9d'));}this['channel'][_0x51ed('0xe9')]=!![];this[_0x51ed('0x32')](_0x53c46b);this['createSquareMessage'](_0x53c46b[_0x51ed('0x55')],'in','','');this[_0x51ed('0x33')][_0x51ed('0x9f')](util['format']('Trying\x20DialogflowV2:\x20%s',_0x53c46b[_0x51ed('0x55')]));var _0x2dbc49=this['googleDialogflowV2'][_0x51ed('0x68')](this,_0x53c46b);if(_0x2dbc49){for(var _0x1049e2 in _0x2dbc49){if(_0x2dbc49[_0x51ed('0x8b')](_0x1049e2)){if(_0x1049e2!=='providerResponse'){this[_0x51ed('0x33')][_0x51ed('0x92')](util[_0x51ed('0x27')]('DIALOGFLOW_%s',_0x1049e2[_0x51ed('0xde')]()),_0x2dbc49[_0x1049e2]);}}}this[_0x51ed('0x40')](_0x2dbc49[_0x51ed('0xdf')],_0x51ed('0xe0'),'dialogflowV2',_0x2dbc49[_0x51ed('0xea')]);return this[_0x51ed('0x33')][_0x51ed('0x9f')](util[_0x51ed('0x27')](_0x51ed('0xeb'),_0x2dbc49[_0x51ed('0xdf')]));}return this[_0x51ed('0x33')][_0x51ed('0x2a')](_0x53c46b,_0x51ed('0xec'));};AGIVertices[_0x51ed('0x12')]['sesteknda']=function(_0x50029b){logger['info'](util[_0x51ed('0x27')](_0x51ed('0xed'),_0x50029b[_0x51ed('0x35')]));if(!this[_0x51ed('0x79')](_0x50029b[_0x51ed('0xee')])){return this[_0x51ed('0x33')][_0x51ed('0x9f')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x51ed('0x79')](_0x50029b[_0x51ed('0xef')])){return this[_0x51ed('0x33')][_0x51ed('0x9f')](_0x51ed('0xf0'));}if(!this[_0x51ed('0x79')](_0x50029b[_0x51ed('0xf1')])){return this['channel']['noop'](_0x51ed('0xf2'));}if(!this['isConfigured'](_0x50029b[_0x51ed('0xf3')])){return this['channel'][_0x51ed('0x9f')](_0x51ed('0x9d'));}this['channel'][_0x51ed('0xe9')]=!![];this[_0x51ed('0x32')](_0x50029b);this['createSquareMessage'](_0x50029b['text'],'in','','');this[_0x51ed('0x33')][_0x51ed('0x9f')](util[_0x51ed('0x27')](_0x51ed('0xf4'),_0x50029b['text']));var _0x150265=this['sestekNDA'][_0x51ed('0x68')](this,_0x50029b);if(_0x150265){for(var _0x5d8aa1 in _0x150265){if(_0x150265[_0x51ed('0x8b')](_0x5d8aa1)){this[_0x51ed('0x33')][_0x51ed('0x92')](util[_0x51ed('0x27')](_0x51ed('0xf5'),_0x5d8aa1[_0x51ed('0xde')]()),_0x150265[_0x5d8aa1]);}}this['createSquareMessage'](_0x150265['speech'],_0x51ed('0xe0'),_0x51ed('0xf6'),'');if(_0x150265['audiofile']){this[_0x51ed('0x33')]['noop'](util[_0x51ed('0x27')](_0x51ed('0xf7'),_0x150265['audiofile']));var _0x426f2e=this[_0x51ed('0x33')][_0x51ed('0xf8')](_0x150265[_0x51ed('0xf9')]);try{fs['unlink'](_0x150265['audiofile']+_0x51ed('0xfa'));}catch(_0x9b44a8){logger[_0x51ed('0x2a')](_0x9b44a8);}return _0x426f2e;}else{return this[_0x51ed('0x33')][_0x51ed('0x9f')](util['format']('SestekNDA\x20Result\x20%s',_0x150265[_0x51ed('0xdf')]));}}return this[_0x51ed('0x33')][_0x51ed('0x2a')](_0x50029b,_0x51ed('0xfb'));};AGIVertices[_0x51ed('0x12')]['end']=function(_0x49e618){logger[_0x51ed('0x99')](util[_0x51ed('0x27')](_0x51ed('0xfc'),_0x49e618[_0x51ed('0x35')]));return this[_0x51ed('0x33')][_0x51ed('0x9f')]('end');};AGIVertices[_0x51ed('0x12')][_0x51ed('0xfd')]=function(_0x18c9ed){logger[_0x51ed('0x99')](util[_0x51ed('0x27')](_0x51ed('0xfe'),_0x18c9ed[_0x51ed('0x35')]));var _0x12933e='';if(_0x18c9ed[_0x51ed('0xff')]){if(!this[_0x51ed('0x79')](_0x18c9ed['trunk_id'])){return this[_0x51ed('0x33')][_0x51ed('0x2a')](_0x18c9ed,'no\x20trunk\x20selected');}else{var _0x1b097a=parseInt(_0x18c9ed[_0x51ed('0xff')],0xa);if(isNaN(_0x1b097a)){_0x12933e=_0x18c9ed[_0x51ed('0xff')];}else{_0x12933e=this['getTrunk']['sync'](this,_0x18c9ed[_0x51ed('0xff')]);if(!_0x12933e){return this[_0x51ed('0x33')]['error'](_0x18c9ed,'no\x20trunk\x20found');}}}}else if(_0x18c9ed[_0x51ed('0x100')]){_0x12933e=_0x18c9ed[_0x51ed('0x100')];}else{return this[_0x51ed('0x33')][_0x51ed('0x2a')](_0x18c9ed,'no\x20trunk\x20selected');}var _0x4fe57a=this[_0x51ed('0x33')][_0x51ed('0xb4')](_0x51ed('0xd9'),[util[_0x51ed('0x27')](_0x51ed('0x101'),_0x12933e,_0x18c9ed['phone']),_0x18c9ed[_0x51ed('0x5d')],_0x18c9ed[_0x51ed('0xd8')],_0x18c9ed[_0x51ed('0x5b')]]);if(_0x4fe57a[_0x51ed('0x98')]===-0x1){return _0x4fe57a;}return this[_0x51ed('0x33')]['noop'](util['format'](_0x51ed('0x102'),_0x51ed('0xd9')));};AGIVertices[_0x51ed('0x12')]['finally']=function(_0x31f766){logger[_0x51ed('0x99')](util[_0x51ed('0x27')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x31f766['label']));return this[_0x51ed('0x33')][_0x51ed('0x9f')](_0x51ed('0x103'));};AGIVertices[_0x51ed('0x12')]['getdigits']=function(_0x243d4a){logger[_0x51ed('0x99')](util[_0x51ed('0x27')](_0x51ed('0x104'),_0x243d4a[_0x51ed('0x35')]));if(_0x243d4a[_0x51ed('0x9b')]===0x0){return this[_0x51ed('0x105')](_0x243d4a);}_0x243d4a[_0x51ed('0x9b')]-=0x1;if(!this['isConfigured'](_0x243d4a[_0x51ed('0x106')])){return this[_0x51ed('0x33')][_0x51ed('0x2a')](_0x243d4a,_0x51ed('0x107'));}var _0x18241c=this[_0x51ed('0x1e')]['sync'](this,_0x243d4a[_0x51ed('0x106')]);if(!_0x18241c){return this['channel'][_0x51ed('0x2a')](_0x243d4a,_0x51ed('0x108'));}if(!this[_0x51ed('0x79')](_0x243d4a[_0x51ed('0xca')])){return this[_0x51ed('0x33')][_0x51ed('0x2a')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x2243f0=this[_0x51ed('0x33')][_0x51ed('0x109')](_0x18241c,_0x243d4a[_0x51ed('0x10a')],_0x243d4a[_0x51ed('0x10b')]);var _0x5cb19b=_0x2243f0[_0x51ed('0x98')]?_0x2243f0[_0x51ed('0x98')][_0x51ed('0x49')]():'';logger[_0x51ed('0x99')]('test',JSON[_0x51ed('0x6a')](_0x2243f0));if(_0x2243f0[_0x51ed('0x98')]===-0x1){this[_0x51ed('0x32')][_0x51ed('0x68')](this,_0x243d4a,_0x5cb19b);return _0x2243f0;}else if(_0x2243f0[_0x51ed('0x95')]==='timeout'){_0x2243f0['result']=_0x5cb19b['length']>=parseInt(_0x243d4a['mindigit'])?'x':'i';}else{_0x2243f0['result']=_0x5cb19b['length']>=parseInt(_0x243d4a[_0x51ed('0x10c')])&&_0x5cb19b['length']<=parseInt(_0x243d4a[_0x51ed('0x10b')])?'x':'i';}var _0x49a44a=this['getVariable'][_0x51ed('0x68')](this,_0x243d4a[_0x51ed('0xca')]);if(!_0x49a44a){return this[_0x51ed('0x33')][_0x51ed('0x2a')](_0x243d4a,_0x51ed('0x10d'));}this[_0x51ed('0x33')][_0x51ed('0x92')](_0x49a44a,_0x5cb19b);if(this[_0x51ed('0x79')](_0x243d4a[_0x51ed('0x10e')])){var _0x1430ba=parseInt(_0x243d4a[_0x51ed('0x10e')],0xa);var _0x469d3f=rs[_0x51ed('0x10f')]({'charset':'*','length':_0x1430ba});var _0x203df7=_0x5cb19b[_0x51ed('0x91')];if(_0x203df7>0x0){if(_0x203df7>_0x1430ba){this[_0x51ed('0x32')]['sync'](this,_0x243d4a,_0x243d4a['hiddendigitspos']===_0x51ed('0x110')?_0x469d3f+_0x5cb19b[_0x51ed('0x111')](_0x1430ba):_0x5cb19b[_0x51ed('0x111')](0x0,_0x203df7-_0x1430ba)+_0x469d3f);}else{this['createSquareDetailsReport']['sync'](this,_0x243d4a,rs[_0x51ed('0x10f')]({'charset':'*','length':_0x203df7}));}}else{this[_0x51ed('0x32')][_0x51ed('0x68')](this,_0x243d4a,'');}}else{this[_0x51ed('0x32')]['sync'](this,_0x243d4a,_0x5cb19b);}return _0x2243f0;};AGIVertices['prototype'][_0x51ed('0x112')]=function(_0x215402){logger[_0x51ed('0x99')](util[_0x51ed('0x27')](_0x51ed('0x113'),_0x215402[_0x51ed('0x35')]));return this[_0x51ed('0xf')](_0x215402);};AGIVertices[_0x51ed('0x12')][_0x51ed('0x114')]=function(_0x26a96b){logger[_0x51ed('0x99')](util[_0x51ed('0x27')](_0x51ed('0x115'),_0x26a96b[_0x51ed('0x35')]));this[_0x51ed('0x32')][_0x51ed('0x68')](this,_0x26a96b,_0x26a96b[_0x51ed('0x116')]);return this[_0x51ed('0x33')][_0x51ed('0x9f')](util[_0x51ed('0x27')](_0x51ed('0x117'),_0x26a96b[_0x51ed('0x116')]));};AGIVertices[_0x51ed('0x12')][_0x51ed('0x118')]=function(_0x1d2489){logger[_0x51ed('0x99')](util[_0x51ed('0x27')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x1d2489['label']));if(!this[_0x51ed('0x79')](_0x1d2489['aws_access_key_id'])||!this[_0x51ed('0x79')](_0x1d2489['aws_secret_access_key'])){return this[_0x51ed('0x33')]['noop'](_0x51ed('0x119'));}if(!this[_0x51ed('0x79')](_0x1d2489['text'])){return this[_0x51ed('0x33')]['noop'](_0x51ed('0x9d'));}this[_0x51ed('0x33')]['noop'](util[_0x51ed('0x27')](_0x51ed('0x11a'),_0x1d2489[_0x51ed('0x55')]));var _0x52507c=this[_0x51ed('0x7b')]['sync'](this,_0x1d2489);if(_0x52507c){this[_0x51ed('0x33')][_0x51ed('0x9f')](util[_0x51ed('0x27')](_0x51ed('0x11b'),_0x52507c));var _0x806b5b=this['channel'][_0x51ed('0xf8')](_0x52507c);try{fs[_0x51ed('0x11c')](_0x52507c+_0x51ed('0xfa'));}catch(_0xe4a831){logger['error'](_0xe4a831);}return _0x806b5b;}return this[_0x51ed('0x33')][_0x51ed('0x2a')](_0x1d2489,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x51ed('0x12')][_0x51ed('0x11d')]=function(_0x5bac41){logger[_0x51ed('0x99')](util[_0x51ed('0x27')](_0x51ed('0x11e'),_0x5bac41[_0x51ed('0x35')]));if(!this['isConfigured'](_0x5bac41[_0x51ed('0x7c')])||!this['isConfigured'](_0x5bac41[_0x51ed('0x7d')])){return this[_0x51ed('0x33')][_0x51ed('0x9f')](_0x51ed('0x119'));}if(!this[_0x51ed('0x79')](_0x5bac41[_0x51ed('0x11f')])){return this[_0x51ed('0x33')][_0x51ed('0x9f')](_0x51ed('0x120'));}if(!this['isConfigured'](_0x5bac41[_0x51ed('0x55')])){return this[_0x51ed('0x33')][_0x51ed('0x9f')]('no\x20text\x20configured');}this[_0x51ed('0x33')][_0x51ed('0xe9')]=!![];this[_0x51ed('0x32')](_0x5bac41);this[_0x51ed('0x40')](_0x5bac41[_0x51ed('0x55')],'in','','');this['channel'][_0x51ed('0x9f')](util[_0x51ed('0x27')]('Trying\x20Amazon\x20Lex:\x20%s',_0x5bac41['text']));var _0x44351e=this[_0x51ed('0x82')][_0x51ed('0x68')](this,_0x5bac41);if(_0x44351e){for(var _0x5658ba in _0x44351e){if(_0x44351e[_0x51ed('0x8b')](_0x5658ba)&&_['isString'](_0x44351e[_0x5658ba])){this['channel'][_0x51ed('0x92')](util['format']('AWS_LEX_%s',_0x5658ba['toUpperCase']()),_0x44351e[_0x5658ba]);}}if(_['isNil'](_0x44351e['message'])){return this[_0x51ed('0x33')][_0x51ed('0x9f')](_0x51ed('0x121'));}else{this[_0x51ed('0x40')](_0x44351e[_0x51ed('0x6d')],_0x51ed('0xe0'),'amazonlex','');return this[_0x51ed('0x33')][_0x51ed('0x9f')](util[_0x51ed('0x27')](_0x51ed('0x122'),_0x44351e[_0x51ed('0x6d')]));}}return this[_0x51ed('0x33')]['error'](_0x5bac41,_0x51ed('0x123'));};AGIVertices[_0x51ed('0x12')]['googleasr']=function(_0x35d672){logger[_0x51ed('0x99')](util[_0x51ed('0x27')](_0x51ed('0x124'),_0x35d672[_0x51ed('0x35')],_0x35d672[_0x51ed('0x5d')]));if(!this['isConfigured'](_0x35d672[_0x51ed('0x6f')])){return this[_0x51ed('0x33')][_0x51ed('0x9f')](_0x51ed('0xdc'));}var _0x3114d3=_0x51ed('0x125');var _0x58c401=util[_0x51ed('0x27')](_0x51ed('0x126'),FILES_PATH,rs[_0x51ed('0x10f')](0x4));var _0xe9b069=util[_0x51ed('0x27')](_0x51ed('0x90'),_0x58c401,_0x3114d3);var _0x37405a=!![];if(_0x35d672['beep']===_0x51ed('0x127')){_0x37405a=![];}var _0x4086e2=this['channel'][_0x51ed('0x128')](_0x58c401,_0x3114d3,_0x35d672[_0x51ed('0x129')],_0x35d672['timeout'],undefined,_0x37405a);if(_0x4086e2[_0x51ed('0x98')]!==-0x1){this['channel'][_0x51ed('0x9f')](util['format']('google\x20%s\x20file\x20created',_0xe9b069));var _0x15700d=this[_0x51ed('0x84')][_0x51ed('0x68')](this,_0x35d672,_0xe9b069);if(_0x15700d){for(var _0x42590f in _0x15700d){if(_0x15700d[_0x51ed('0x8b')](_0x42590f)){this[_0x51ed('0x33')][_0x51ed('0x92')](util[_0x51ed('0x27')](_0x51ed('0x12a'),_0x42590f[_0x51ed('0xde')]()),_0x15700d[_0x42590f]);}}return this[_0x51ed('0x33')][_0x51ed('0x9f')](util[_0x51ed('0x27')](_0x51ed('0x12b'),JSON[_0x51ed('0x6a')](_0x15700d)));}}return _0x4086e2;};AGIVertices['prototype']['tildeasr']=function(_0x5c8b9c){logger['info'](util[_0x51ed('0x27')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x5c8b9c['label']));if(!this[_0x51ed('0x79')](_0x5c8b9c[_0x51ed('0x86')])){return this[_0x51ed('0x33')][_0x51ed('0x9f')](_0x51ed('0x12c'));}if(!this['isConfigured'](_0x5c8b9c['appsecret'])){return this[_0x51ed('0x33')][_0x51ed('0x9f')](_0x51ed('0x12d'));}var _0x13b99b='wav';var _0x5d3b61=util[_0x51ed('0x27')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x4578f9=util['format'](_0x51ed('0x90'),_0x5d3b61,_0x13b99b);var _0x334479=!![];if(_0x5c8b9c[_0x51ed('0x12e')]==='NOBEEP'){_0x334479=![];}var _0x4a5f65=this[_0x51ed('0x33')]['recordFile'](_0x5d3b61,_0x13b99b,_0x5c8b9c['intKey'],_0x5c8b9c['timeout'],undefined,_0x334479);if(_0x4a5f65[_0x51ed('0x98')]!==-0x1){this[_0x51ed('0x33')][_0x51ed('0x9f')](util[_0x51ed('0x27')]('tilde\x20%s\x20file\x20created',_0x4578f9));var _0x59d987=this['tildeASR']['sync'](this,_0x5c8b9c,_0x4578f9);if(_0x59d987){for(var _0x5a04d4 in _0x59d987){if(_0x59d987['hasOwnProperty'](_0x5a04d4)){this[_0x51ed('0x33')]['setVariable'](util['format'](_0x51ed('0x12f'),_0x5a04d4[_0x51ed('0xde')]()),_0x59d987[_0x5a04d4]);}}return this['channel'][_0x51ed('0x9f')](util[_0x51ed('0x27')](_0x51ed('0x130'),JSON[_0x51ed('0x6a')](_0x59d987)));}}return _0x4a5f65;};AGIVertices[_0x51ed('0x12')][_0x51ed('0x131')]=function(_0x12173e){logger[_0x51ed('0x99')](util[_0x51ed('0x27')](_0x51ed('0x132'),_0x12173e[_0x51ed('0x35')]));return this[_0x51ed('0x33')][_0x51ed('0x133')](_0x12173e[_0x51ed('0x3a')],_0x12173e['extension'],_0x12173e[_0x51ed('0x134')]);};AGIVertices[_0x51ed('0x12')][_0x51ed('0x135')]=function(_0x3eecb5){logger[_0x51ed('0x99')](util[_0x51ed('0x27')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x3eecb5['label']));if(!this[_0x51ed('0x79')](_0x3eecb5[_0x51ed('0x136')])){return this[_0x51ed('0x33')][_0x51ed('0x2a')](_0x3eecb5,_0x51ed('0x137'));}try{var _0xf57d28=eval(_0x3eecb5['condition'])?_0x51ed('0x138'):_0x51ed('0x139');this['channel'][_0x51ed('0x9f')](util[_0x51ed('0x27')](_0x51ed('0x13a'),_0x3eecb5[_0x51ed('0x136')],_0xf57d28));return{'code':0xc8,'result':_0xf57d28};}catch(_0x5d2c1f){return{'code':0xc8,'result':_0x51ed('0x139')};}};AGIVertices[_0x51ed('0x12')][_0x51ed('0x13b')]=function(_0x106f54){logger[_0x51ed('0x99')](util[_0x51ed('0x27')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x106f54[_0x51ed('0x35')]));if(!this[_0x51ed('0x79')](_0x106f54[_0x51ed('0x13c')])){return this[_0x51ed('0x33')][_0x51ed('0x2a')](_0x106f54,_0x51ed('0x13d'));}var _0x20fc76=this[_0x51ed('0x13e')][_0x51ed('0x68')](this,_0x106f54['interval_id']);if(!_0x20fc76){return this[_0x51ed('0x33')][_0x51ed('0x2a')](_0x106f54,_0x51ed('0x13f'));}for(var _0x118d85=0x0;_0x118d85<_0x20fc76[_0x51ed('0x91')];_0x118d85+=0x1){var _0x5ae80a=this[_0x51ed('0x33')][_0x51ed('0x97')](util['format'](_0x51ed('0x140'),_0x20fc76[_0x118d85]));if(_0x5ae80a[_0x51ed('0x98')]===-0x1){return _0x5ae80a;}logger[_0x51ed('0x99')](util['format']('IFTIME\x20%s\x20%s',_0x20fc76[_0x118d85],_0x5ae80a[_0x51ed('0x95')]));if(_0x5ae80a[_0x51ed('0x95')]===_0x51ed('0x138')){logger['info'](util[_0x51ed('0x27')]('IFTIME\x20%s\x20%s',_0x20fc76[_0x118d85],'true'));this[_0x51ed('0x33')][_0x51ed('0x9f')](util['format']('IFTIME\x20%s\x20%s',_0x20fc76[_0x118d85],_0x51ed('0x138')));return{'code':0xc8,'result':'true'};}else{logger[_0x51ed('0x99')](util[_0x51ed('0x27')](_0x51ed('0x141'),_0x20fc76[_0x118d85],_0x51ed('0x139')));this[_0x51ed('0x33')][_0x51ed('0x9f')](util[_0x51ed('0x27')]('IFTIME\x20%s\x20%s',_0x20fc76[_0x118d85],_0x51ed('0x139')));}}return{'code':0xc8,'result':_0x51ed('0x139')};};AGIVertices['prototype'][_0x51ed('0x142')]=function(_0x10661b){logger['info'](util[_0x51ed('0x27')](_0x51ed('0x143'),_0x10661b[_0x51ed('0x35')]));return this[_0x51ed('0x33')]['hangup']();};AGIVertices['prototype']['ispeechasr']=function(_0x2ae9df){logger['info'](util[_0x51ed('0x27')](_0x51ed('0x144'),_0x2ae9df[_0x51ed('0x35')]));if(!this['isConfigured'](_0x2ae9df[_0x51ed('0x6f')])){return this['channel']['noop'](_0x51ed('0xdc'));}var _0x21f8fc=_0x51ed('0x125');var _0x37adf2=util[_0x51ed('0x27')](_0x51ed('0x126'),FILES_PATH,rs[_0x51ed('0x10f')](0x4));var _0x84f3b0=util[_0x51ed('0x27')]('%s.%s',_0x37adf2,_0x21f8fc);var _0x18bffd=!![];if(_0x2ae9df[_0x51ed('0x12e')]===_0x51ed('0x127')){_0x18bffd=![];}var _0x14ef9a=this[_0x51ed('0x33')][_0x51ed('0x128')](_0x37adf2,_0x21f8fc,_0x2ae9df[_0x51ed('0x129')],_0x2ae9df[_0x51ed('0x5d')],undefined,_0x18bffd);if(_0x14ef9a[_0x51ed('0x98')]!==-0x1){this[_0x51ed('0x33')][_0x51ed('0x9f')](util[_0x51ed('0x27')](_0x51ed('0x145'),_0x84f3b0));var _0x2cbcdc=this[_0x51ed('0x76')][_0x51ed('0x68')](this,_0x2ae9df,_0x84f3b0);if(_0x2cbcdc){for(var _0x51a10a in _0x2cbcdc){if(_0x2cbcdc[_0x51ed('0x8b')](_0x51a10a)){this[_0x51ed('0x33')][_0x51ed('0x92')](util[_0x51ed('0x27')](_0x51ed('0x146'),_0x51a10a[_0x51ed('0xde')]()),_0x2cbcdc[_0x51a10a]);}}return this['channel'][_0x51ed('0x9f')](util[_0x51ed('0x27')](_0x51ed('0x147'),JSON[_0x51ed('0x6a')](_0x2cbcdc)));}}return _0x14ef9a;};AGIVertices['prototype'][_0x51ed('0x148')]=function(_0x55ff70){logger[_0x51ed('0x99')](util[_0x51ed('0x27')](_0x51ed('0x149'),_0x55ff70[_0x51ed('0x35')]));if(!this[_0x51ed('0x79')](_0x55ff70[_0x51ed('0x6f')])){return this[_0x51ed('0x33')]['noop'](_0x51ed('0xdc'));}if(!this[_0x51ed('0x79')](_0x55ff70[_0x51ed('0x55')])){return this[_0x51ed('0x33')][_0x51ed('0x9f')](_0x51ed('0x9d'));}this[_0x51ed('0x33')]['noop'](util[_0x51ed('0x27')]('Trying\x20ispeech\x20TTS\x20%s',_0x55ff70[_0x51ed('0x55')]));var _0x25e36e=this[_0x51ed('0x74')][_0x51ed('0x68')](this,_0x55ff70);if(_0x25e36e){this[_0x51ed('0x33')][_0x51ed('0x9f')](util[_0x51ed('0x27')]('ispeech\x20%s\x20file\x20created',_0x25e36e));var _0x49c97c=this[_0x51ed('0x33')][_0x51ed('0xf8')](_0x25e36e,_0x55ff70[_0x51ed('0x129')]);try{fs[_0x51ed('0x11c')](_0x25e36e+_0x51ed('0xfa'));}catch(_0x11e672){logger[_0x51ed('0x2a')](_0x11e672);}return _0x49c97c;}return this[_0x51ed('0x33')][_0x51ed('0x2a')](_0x55ff70,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype']['login']=function(_0x1f9e61){logger[_0x51ed('0x99')](util[_0x51ed('0x27')](_0x51ed('0x14a'),_0x1f9e61[_0x51ed('0x35')]));if(!this['isConfigured'](_0x1f9e61[_0x51ed('0x14b')])){return this[_0x51ed('0x33')]['error'](_0x1f9e61,_0x51ed('0x14c'));}logger[_0x51ed('0x99')](util[_0x51ed('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x51ed('0x33')][_0x51ed('0x37')],_0x1f9e61[_0x51ed('0x14b')]));var _0x5cb86d=this[_0x51ed('0x14d')][_0x51ed('0x68')](this,_0x1f9e61['findBy']);if(_0x5cb86d){logger['info'](util[_0x51ed('0x27')](_0x51ed('0x14e'),this[_0x51ed('0x33')][_0x51ed('0x37')],_0x1f9e61['findBy']));this[_0x51ed('0x33')]['noop'](util['format'](_0x51ed('0x14e'),this['channel']['callerid'],_0x1f9e61['findBy']));return{'code':0xc8,'result':_0x51ed('0x14f')};}else{logger[_0x51ed('0x99')](util[_0x51ed('0x27')](_0x51ed('0x150'),this[_0x51ed('0x33')][_0x51ed('0x37')],_0x1f9e61[_0x51ed('0x14b')]));this[_0x51ed('0x33')][_0x51ed('0x9f')](util[_0x51ed('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x51ed('0x33')]['callerid'],_0x1f9e61[_0x51ed('0x14b')]));return{'code':0xc8,'result':_0x51ed('0x151')};}};AGIVertices['prototype'][_0x51ed('0x152')]=function(_0x35f454){logger[_0x51ed('0x99')](util['format'](_0x51ed('0x153'),_0x35f454[_0x51ed('0x35')]));if(!this[_0x51ed('0x79')](_0x35f454[_0x51ed('0x14b')])){return this[_0x51ed('0x33')]['error'](_0x35f454,_0x51ed('0x14c'));}logger[_0x51ed('0x99')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x51ed('0x33')][_0x51ed('0x37')],_0x35f454[_0x51ed('0x14b')]));var _0x4c5fc6=this[_0x51ed('0x50')][_0x51ed('0x68')](this,_0x35f454['findBy']);if(_0x4c5fc6){logger[_0x51ed('0x99')](util[_0x51ed('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x51ed('0x37')],_0x35f454[_0x51ed('0x14b')]));this[_0x51ed('0x33')][_0x51ed('0x9f')](util[_0x51ed('0x27')](_0x51ed('0x14e'),this[_0x51ed('0x33')][_0x51ed('0x37')],_0x35f454['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x51ed('0x99')](util[_0x51ed('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x51ed('0x33')][_0x51ed('0x37')],_0x35f454[_0x51ed('0x14b')]));this[_0x51ed('0x33')]['noop'](util[_0x51ed('0x27')](_0x51ed('0x150'),this[_0x51ed('0x33')][_0x51ed('0x37')],_0x35f454[_0x51ed('0x14b')]));return{'code':0xc8,'result':_0x51ed('0x151')};}};AGIVertices['prototype'][_0x51ed('0x154')]=function(_0x4d99f9){logger['info'](util[_0x51ed('0x27')](_0x51ed('0x155'),_0x4d99f9[_0x51ed('0x35')]));if(!this[_0x51ed('0x79')](_0x4d99f9[_0x51ed('0x156')])){return this[_0x51ed('0x33')][_0x51ed('0x2a')](_0x4d99f9,_0x51ed('0x157'));}this[_0x51ed('0x33')][_0x51ed('0x9f')](util[_0x51ed('0x27')](_0x51ed('0x158'),_0x4d99f9[_0x51ed('0x156')]));var _0x57a521=eval(_0x4d99f9['operation']);if(!this[_0x51ed('0x79')](_0x4d99f9[_0x51ed('0xca')])){return this['channel'][_0x51ed('0x9f')](_0x51ed('0xcb'));}var _0x40637e=this[_0x51ed('0x97')][_0x51ed('0x68')](this,_0x4d99f9[_0x51ed('0xca')]);if(!_0x40637e){return this[_0x51ed('0x33')][_0x51ed('0x2a')](_0x4d99f9,'no\x20variable\x20found');}if(_[_0x51ed('0x8e')](_0x57a521)){var _0x29cb9a=this;_0x57a521['forEach'](function(_0x519ae8,_0x37b8c2){_0x29cb9a[_0x51ed('0x33')][_0x51ed('0x92')](util[_0x51ed('0x27')](_0x51ed('0x159'),_0x40637e,_0x37b8c2),_0x519ae8);});return this[_0x51ed('0x33')]['noop'](util['format'](_0x51ed('0x15a'),_0x40637e));}else{return this[_0x51ed('0x33')]['setVariable'](_0x40637e,_0x57a521);}};AGIVertices[_0x51ed('0x12')][_0x51ed('0x15b')]=function(_0x1881f5){logger['info'](util[_0x51ed('0x27')](_0x51ed('0x15c'),_0x1881f5[_0x51ed('0x35')]));if(_0x1881f5[_0x51ed('0x9b')]===0x0){return this[_0x51ed('0x105')](_0x1881f5);}_0x1881f5[_0x51ed('0x9b')]-=0x1;if(!this[_0x51ed('0x79')](_0x1881f5[_0x51ed('0x106')])){return this['channel'][_0x51ed('0x2a')](_0x1881f5,_0x51ed('0x107'));}var _0x3bf96d=this['getSound']['sync'](this,_0x1881f5[_0x51ed('0x106')]);if(!_0x3bf96d){return this['channel'][_0x51ed('0x2a')](_0x1881f5,_0x51ed('0x108'));}var _0x24d05b=this[_0x51ed('0x33')][_0x51ed('0x109')](_0x3bf96d,_0x1881f5[_0x51ed('0x10a')],_0x1881f5[_0x51ed('0x15d')]);var _0x31a112=_0x24d05b[_0x51ed('0x98')];if(_0x24d05b[_0x51ed('0x98')]===-0x1){this[_0x51ed('0x32')][_0x51ed('0x68')](this,_0x1881f5,'-1');return _0x24d05b;}else if(_0x24d05b[_0x51ed('0x95')]===_0x51ed('0x5d')){_0x24d05b[_0x51ed('0x98')]=_0x24d05b[_0x51ed('0x98')]['length']>0x0?_0x24d05b[_0x51ed('0x98')]:'t';}else if(_[_0x51ed('0x15e')](_0x24d05b['result'])){_0x24d05b[_0x51ed('0x98')]='#';_0x31a112='#';}if(!this['isConfigured'](_0x1881f5['variable_id'])){this[_0x51ed('0x33')]['noop'](_0x51ed('0xcb'));}else{var _0x17558e=this[_0x51ed('0x97')]['sync'](this,_0x1881f5[_0x51ed('0xca')]);if(!_0x17558e){return this['channel'][_0x51ed('0x2a')](_0x1881f5,'no\x20variable\x20found');}this[_0x51ed('0x33')][_0x51ed('0x92')](_0x17558e,_0x31a112);}this[_0x51ed('0x32')]['sync'](this,_0x1881f5,_0x31a112);return _0x24d05b;};AGIVertices[_0x51ed('0x12')][_0x51ed('0x9f')]=function(_0x5a400a){logger[_0x51ed('0x99')](util[_0x51ed('0x27')](_0x51ed('0x15f'),_0x5a400a[_0x51ed('0x35')]));return this[_0x51ed('0x33')][_0x51ed('0x9f')](_0x5a400a[_0x51ed('0x160')]||_0x5a400a[_0x51ed('0x35')]);};AGIVertices[_0x51ed('0x12')]['pause']=function(_0x4aef4b){logger['info'](util[_0x51ed('0x27')](_0x51ed('0x161'),_0x4aef4b[_0x51ed('0x35')]));if(!this[_0x51ed('0x79')](_0x4aef4b['findBy'])){return this['channel']['error'](_0x4aef4b,'no\x20find\x20by\x20configured');}logger[_0x51ed('0x99')](util[_0x51ed('0x27')](_0x51ed('0x162'),this[_0x51ed('0x33')][_0x51ed('0x37')],_0x4aef4b[_0x51ed('0x14b')]));var _0x1c0ef6=this['getPause']['sync'](this,_0x4aef4b[_0x51ed('0x163')]);var _0x510a9e=this['agentPause'][_0x51ed('0x68')](this,_0x4aef4b[_0x51ed('0x14b')],_0x1c0ef6);if(_0x510a9e){logger[_0x51ed('0x99')](util[_0x51ed('0x27')](_0x51ed('0x14e'),this[_0x51ed('0x33')][_0x51ed('0x37')],_0x4aef4b[_0x51ed('0x14b')]));this[_0x51ed('0x33')][_0x51ed('0x9f')](util['format'](_0x51ed('0x14e'),this[_0x51ed('0x33')][_0x51ed('0x37')],_0x4aef4b[_0x51ed('0x14b')]));return{'code':0xc8,'result':_0x51ed('0x14f')};}else{logger['info'](util[_0x51ed('0x27')](_0x51ed('0x150'),this[_0x51ed('0x33')]['callerid'],_0x4aef4b[_0x51ed('0x14b')]));this[_0x51ed('0x33')][_0x51ed('0x9f')](util[_0x51ed('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x51ed('0x37')],_0x4aef4b['findBy']));return{'code':0xc8,'result':_0x51ed('0x151')};}};AGIVertices[_0x51ed('0x12')]['playback']=function(_0x587f93){logger[_0x51ed('0x99')](util['format'](_0x51ed('0x164'),_0x587f93['label']));if(!this['isConfigured'](_0x587f93[_0x51ed('0x106')])){return this[_0x51ed('0x33')][_0x51ed('0x2a')](_0x587f93,_0x51ed('0x107'));}var _0x826dcd=this[_0x51ed('0x1e')]['sync'](this,_0x587f93['file_id']);if(!_0x826dcd){return this['channel']['error'](_0x587f93,_0x51ed('0x108'));}var _0xb716f2=this[_0x51ed('0x33')][_0x51ed('0xb4')](_0x51ed('0x165'),[_0x826dcd,_0x587f93['opts']]);if(_0xb716f2[_0x51ed('0x98')]===-0x1){return _0xb716f2;}return this[_0x51ed('0x33')][_0x51ed('0x9f')](util[_0x51ed('0x27')](_0x51ed('0xb5'),_0x51ed('0x165'),_0x826dcd));};AGIVertices['prototype']['queue']=function(_0x27af7f){logger['info'](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x27af7f[_0x51ed('0x35')]));if(!this[_0x51ed('0x79')](_0x27af7f['queue_id'])){return this['channel'][_0x51ed('0x2a')](_0x27af7f,'no\x20queue\x20selected');}var _0x135076='';var _0x4c90d9=parseInt(_0x27af7f[_0x51ed('0x166')],0xa);if(isNaN(_0x4c90d9)){_0x135076=_0x27af7f[_0x51ed('0x166')];}else{_0x135076=this[_0x51ed('0x15')][_0x51ed('0x68')](this,_0x27af7f[_0x51ed('0x166')]);if(!_0x135076){return this['channel'][_0x51ed('0x2a')](_0x27af7f,'no\x20queue\x20found');}}var _0x4af10d='';if(this[_0x51ed('0x79')](_0x27af7f['file_id'])){var _0x399cd1=this[_0x51ed('0x1e')][_0x51ed('0x68')](this,_0x27af7f['file_id']);if(_0x399cd1){_0x4af10d=_0x399cd1;}}this[_0x51ed('0x32')]['sync'](this,_0x27af7f,_0x135076);if(_0x27af7f['opts'][_0x51ed('0x167')]('x')<0x0){_0x27af7f[_0x51ed('0xd8')]+='x';}if(_0x27af7f['opts'][_0x51ed('0x167')]('X')<0x0){_0x27af7f[_0x51ed('0xd8')]+='X';}this['channel'][_0x51ed('0x92')](_0x51ed('0x168'),_0x135076?_0x135076[_0x51ed('0x169')]():'');var _0x24f1dd=this[_0x51ed('0x33')][_0x51ed('0xb4')]('QUEUE',[_0x135076,_0x27af7f[_0x51ed('0xd8')],_0x27af7f[_0x51ed('0x5b')],_0x4af10d,_0x27af7f[_0x51ed('0x5d')],_0x27af7f[_0x51ed('0xa')],_0x27af7f[_0x51ed('0x16a')],_0x27af7f[_0x51ed('0x16b')],'',_0x27af7f[_0x51ed('0x16c')]]);if(_0x24f1dd[_0x51ed('0x98')]===-0x1){return _0x24f1dd;}return this[_0x51ed('0x33')][_0x51ed('0x9f')](util[_0x51ed('0x27')]('Executed\x20command\x20%s\x20%s',_0x51ed('0x16d'),_0x135076));};AGIVertices['prototype'][_0x51ed('0x16e')]=function(_0x2c5764){logger[_0x51ed('0x99')](util[_0x51ed('0x27')](_0x51ed('0x16f'),_0x2c5764['label']));var _0x14608c=_0x2c5764['recordingFormat']||'wav';var _0x3754e8=util['format'](_0x51ed('0x170'),this[_0x51ed('0x33')][_0x51ed('0x34')],rs[_0x51ed('0x10f')](0x5));var _0x417551=util[_0x51ed('0x27')](_0x51ed('0x171'),FILES_PATH,_0x3754e8,_0x14608c);var _0x51b16a=util[_0x51ed('0x27')](_0x51ed('0x126'),FILES_PATH,_0x3754e8);this[_0x51ed('0x38')][_0x51ed('0x68')](this,_0x2c5764,_0x3754e8,_0x417551);this[_0x51ed('0x33')][_0x51ed('0x92')]('RECORDING_SAVENAME',_0x3754e8);logger[_0x51ed('0x99')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x51b16a,_0x14608c,_0x2c5764[_0x51ed('0x172')],_0x2c5764['timeout']);return this[_0x51ed('0x33')]['recordFile'](_0x51b16a,_0x14608c,_0x2c5764[_0x51ed('0x172')],_0x2c5764['timeout'],undefined,!![]);};AGIVertices[_0x51ed('0x12')][_0x51ed('0x173')]=function(_0x599646){logger[_0x51ed('0x99')](util[_0x51ed('0x27')](_0x51ed('0x174'),_0x599646[_0x51ed('0x35')]));if(!this[_0x51ed('0x79')](_0x599646[_0x51ed('0x5b')])){return this[_0x51ed('0x33')][_0x51ed('0x9f')](_0x51ed('0x175'));}var _0x111bdd=this['restAPI']['sync'](this,_0x599646);logger[_0x51ed('0x99')](util[_0x51ed('0x27')]('Response:',util[_0x51ed('0x176')](_0x111bdd,{'showHidden':![],'depth':null})));if(!this[_0x51ed('0x79')](_0x599646[_0x51ed('0xca')])){return this[_0x51ed('0x33')][_0x51ed('0x9f')](_0x51ed('0x177'));}var _0x27408c=this[_0x51ed('0x97')]['sync'](this,_0x599646[_0x51ed('0xca')]);if(!_0x27408c){return this['channel'][_0x51ed('0x2a')](_0x599646,_0x51ed('0x10d'));}this[_0x51ed('0x33')][_0x51ed('0x92')](util['format'](_0x51ed('0x178'),_0x27408c),_0x111bdd[_0x51ed('0x6b')]?_0x111bdd[_0x51ed('0x6b')]:_0x51ed('0x179'));this[_0x51ed('0x33')]['setVariable'](util[_0x51ed('0x27')](_0x51ed('0x17a'),_0x27408c),_0x111bdd[_0x51ed('0x6c')]?_0x111bdd['statusMessage']:'OK');if(_0x111bdd[_0x51ed('0x62')]){try{this[_0x51ed('0x8f')](_0x111bdd[_0x51ed('0x62')],_0x27408c);}catch(_0x4a5ac7){logger[_0x51ed('0x2a')](util[_0x51ed('0x27')](_0x51ed('0x17b'),_0x27408c));}}return this[_0x51ed('0x33')][_0x51ed('0x9f')](util[_0x51ed('0x27')](_0x51ed('0xd0'),_0x27408c));};AGIVertices['prototype'][_0x51ed('0x17c')]=function(_0x4badf8){logger[_0x51ed('0x99')](util['format'](_0x51ed('0x17d'),_0x4badf8[_0x51ed('0x35')]));return this[_0x51ed('0x33')][_0x51ed('0x17e')](_0x4badf8['digits']['replace'](/\s+/g,''),_0x4badf8[_0x51ed('0x172')]);};AGIVertices[_0x51ed('0x12')][_0x51ed('0x17f')]=function(_0x39151a){logger[_0x51ed('0x99')](util['format'](_0x51ed('0x180'),_0x39151a[_0x51ed('0x35')]));return this[_0x51ed('0x33')][_0x51ed('0x181')](_0x39151a[_0x51ed('0x5e')][_0x51ed('0xc8')](/\s+/g,''),_0x39151a[_0x51ed('0x172')]);};AGIVertices[_0x51ed('0x12')][_0x51ed('0x182')]=function(_0x512173){logger['info'](util[_0x51ed('0x27')](_0x51ed('0x183'),_0x512173[_0x51ed('0x35')]));return this['channel'][_0x51ed('0x184')](_0x512173['text'],_0x512173[_0x51ed('0x172')]);};AGIVertices[_0x51ed('0x12')][_0x51ed('0x185')]=function(_0x2af709){logger['info'](util[_0x51ed('0x27')](_0x51ed('0x186'),_0x2af709[_0x51ed('0x35')]));if(!this[_0x51ed('0x79')](_0x2af709[_0x51ed('0x187')])){return this[_0x51ed('0x33')]['noop'](_0x51ed('0x188'));}var _0x320d63=this['getMailAccount'][_0x51ed('0x68')](this,_0x2af709[_0x51ed('0x187')]);if(!_0x320d63||!_0x320d63[_0x51ed('0x189')]){return this['channel']['error'](_0x2af709,_0x51ed('0x18a'));}var _0x226b4b={'from':util[_0x51ed('0x27')]('\x22%s\x22\x20<%s>',_0x320d63[_0x51ed('0x17')],_0x320d63[_0x51ed('0x18b')]||_0x320d63['Smtp'][_0x51ed('0x18c')]),'to':_0x2af709['to']||'','cc':_0x2af709['cc']||'','bcc':_0x2af709['bcc']||'','subject':_0x2af709[_0x51ed('0x18d')],'html':_0x2af709[_0x51ed('0x55')],'text':_0x2af709[_0x51ed('0x55')]};var _0x1d6ee3={'tls':{'rejectUnauthorized':![]}};if(_0x320d63['Smtp'][_0x51ed('0x18e')]){_0x1d6ee3[_0x51ed('0x18e')]=_0x320d63[_0x51ed('0x189')][_0x51ed('0x18e')];}else{_0x1d6ee3[_0x51ed('0x18f')]=_0x320d63[_0x51ed('0x189')]['host'];_0x1d6ee3[_0x51ed('0x190')]=_0x320d63[_0x51ed('0x189')][_0x51ed('0x190')];_0x1d6ee3[_0x51ed('0x191')]=_0x320d63[_0x51ed('0x189')]['secure'];}if(_0x320d63[_0x51ed('0x189')][_0x51ed('0x192')]){_0x1d6ee3['auth']={'user':_0x320d63[_0x51ed('0x189')][_0x51ed('0x18c')],'pass':_0x320d63[_0x51ed('0x189')][_0x51ed('0x193')]};}if(this['isConfigured'](_0x2af709[_0x51ed('0x194')])){}logger[_0x51ed('0xd2')](_0x51ed('0x195'),JSON[_0x51ed('0x6a')](_0x226b4b));this[_0x51ed('0x32')][_0x51ed('0x68')](this,_0x2af709,_0x2af709[_0x51ed('0x187')]);this[_0x51ed('0x33')][_0x51ed('0x9f')](util[_0x51ed('0x27')](_0x51ed('0x196'),_0x320d63[_0x51ed('0x17')]));this[_0x51ed('0x23')][_0x51ed('0x68')](this,_0x1d6ee3,_0x226b4b);return this[_0x51ed('0x33')][_0x51ed('0x9f')](_0x51ed('0x197'));};AGIVertices[_0x51ed('0x12')][_0x51ed('0x198')]=function(_0x1baec0){logger[_0x51ed('0x99')](util['format'](_0x51ed('0x199'),_0x1baec0[_0x51ed('0x35')]));return this['channel'][_0x51ed('0x9f')](_0x51ed('0x19a'));};AGIVertices[_0x51ed('0x12')][_0x51ed('0x19b')]=function(_0x23e043){logger[_0x51ed('0x99')](util[_0x51ed('0x27')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x23e043['label']));if(!this[_0x51ed('0x79')](_0x23e043[_0x51ed('0x19c')])){return this[_0x51ed('0x33')][_0x51ed('0x9f')](_0x51ed('0x19d'));}var _0x1313bb=this[_0x51ed('0x19e')]['sync'](this,_0x23e043[_0x51ed('0x19c')]);if(!_0x1313bb){return this[_0x51ed('0x33')][_0x51ed('0x2a')](_0x23e043,'no\x20sms\x20account\x20found');}var _0x350348={'body':_0x23e043[_0x51ed('0x19f')],'phone':_0x23e043['to']||'','SmsAccountId':_0x1313bb['id']};logger['debug'](_0x51ed('0x1a0'),JSON[_0x51ed('0x6a')](_0x350348));this[_0x51ed('0x32')][_0x51ed('0x68')](this,_0x23e043,_0x23e043['sms_account_id']);this['channel']['noop'](util[_0x51ed('0x27')](_0x51ed('0x1a1'),_0x1313bb['name']));this[_0x51ed('0x31')][_0x51ed('0x68')](this,_0x350348);return this['channel'][_0x51ed('0x9f')](_0x51ed('0x1a2'));};AGIVertices[_0x51ed('0x12')][_0x51ed('0x1a3')]=function(_0x217e1b){logger[_0x51ed('0x99')](util[_0x51ed('0x27')](_0x51ed('0x1a4'),_0x217e1b[_0x51ed('0x35')]));if(!this['isConfigured'](_0x217e1b[_0x51ed('0xca')])){return this[_0x51ed('0x33')][_0x51ed('0x2a')](_0x217e1b,_0x51ed('0x1a5'));}var _0xb0f668=this[_0x51ed('0x97')][_0x51ed('0x68')](this,_0x217e1b[_0x51ed('0xca')]);if(!_0xb0f668){return this['channel'][_0x51ed('0x2a')](_0x217e1b,_0x51ed('0x10d'));}return this[_0x51ed('0x33')][_0x51ed('0x92')](_0xb0f668,_0x217e1b[_0x51ed('0x1a6')]);};AGIVertices[_0x51ed('0x12')]['start']=function(_0x3671f3){logger['info'](util[_0x51ed('0x27')](_0x51ed('0x1a7'),_0x3671f3['label']));this[_0x51ed('0x33')][_0x51ed('0x9f')](_0x51ed('0x1a8'));if(_0x3671f3[_0x51ed('0xab')]===_0x51ed('0x1a9')){this['channel']['noop']('Answer');return this[_0x51ed('0x33')]['answer']();}return this[_0x51ed('0x33')][_0x51ed('0x9f')](_0x51ed('0x1aa'));};AGIVertices[_0x51ed('0x12')][_0x51ed('0x1ab')]=function(_0x38639e){logger['info'](util['format'](_0x51ed('0x1ac'),_0x38639e[_0x51ed('0x35')]));if(!this[_0x51ed('0x79')](_0x38639e[_0x51ed('0x1ad')])){return this['channel']['error'](_0x38639e,_0x51ed('0x1ae'));}var _0x1edc3c=this['getSquareProject'][_0x51ed('0x68')](this,_0x38639e[_0x51ed('0x1ad')]);if(!this[_0x51ed('0x79')](_0x1edc3c)){return this[_0x51ed('0x33')]['error'](_0x38639e,util[_0x51ed('0x27')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x38639e[_0x51ed('0x1ad')]));}if(_0x1edc3c===this[_0x51ed('0x33')][_0x51ed('0x3e')]){return this[_0x51ed('0x33')][_0x51ed('0x2a')](_0x38639e,_0x51ed('0x1af'));}this[_0x51ed('0x32')][_0x51ed('0x68')](this,_0x38639e,_0x1edc3c);var _0x49971e=this[_0x51ed('0x33')]['exec']('AGI',util['format'](_0x51ed('0x1b0'),config[_0x51ed('0xa')]['host']||'127.0.0.1',_0x1edc3c,this[_0x51ed('0x33')][_0x51ed('0x3e')]));if(_0x49971e[_0x51ed('0x98')]===-0x1){return _0x49971e;}return this[_0x51ed('0x33')][_0x51ed('0x9f')](util[_0x51ed('0x27')](_0x51ed('0xb5'),'AGI',_0x1edc3c));};AGIVertices['prototype']['system']=function(_0x59148f){logger[_0x51ed('0x99')](util[_0x51ed('0x27')](_0x51ed('0x1b1'),_0x59148f[_0x51ed('0x35')]));var _0x571dbe=this[_0x51ed('0x53')][_0x51ed('0x68')](this,_0x59148f[_0x51ed('0xa9')]);this[_0x51ed('0x32')]['sync'](this,_0x59148f,_0x59148f[_0x51ed('0xa9')]);if(this[_0x51ed('0x79')](_0x59148f[_0x51ed('0xca')])){var _0x541069=this[_0x51ed('0x97')]['sync'](this,_0x59148f[_0x51ed('0xca')]);if(_0x541069){this[_0x51ed('0x33')][_0x51ed('0x92')](_0x541069,_0x571dbe);return this[_0x51ed('0x33')][_0x51ed('0x9f')](util['format'](_0x51ed('0x1b2'),_0x59148f[_0x51ed('0xa9')],_0x541069));}}return this['channel'][_0x51ed('0x9f')](util[_0x51ed('0x27')](_0x51ed('0x1b3'),_0x59148f[_0x51ed('0xa9')]));};AGIVertices['prototype'][_0x51ed('0x1b4')]=function(_0x59df26){logger[_0x51ed('0x99')](util[_0x51ed('0x27')](_0x51ed('0x1b5'),_0x59df26[_0x51ed('0x35')]));_0x59df26[_0x51ed('0x55')]=_0x59df26[_0x51ed('0x55')][_0x51ed('0xc8')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x51ed('0x79')](_0x59df26[_0x51ed('0x1b6')])){return this['channel'][_0x51ed('0x9f')](_0x51ed('0x1b7'));}if(!this[_0x51ed('0x79')](_0x59df26[_0x51ed('0x55')])){return this[_0x51ed('0x33')][_0x51ed('0x9f')](_0x51ed('0x9d'));}this[_0x51ed('0x33')][_0x51ed('0x9f')](util[_0x51ed('0x27')](_0x51ed('0x1b8'),_0x59df26[_0x51ed('0x55')]));var _0x5981eb=this[_0x51ed('0x54')]['sync'](this,_0x59df26);if(_0x5981eb){this[_0x51ed('0x33')][_0x51ed('0x9f')](util[_0x51ed('0x27')](_0x51ed('0x1b9'),_0x5981eb));var _0x3c764f=this[_0x51ed('0x33')][_0x51ed('0xf8')](_0x5981eb);try{fs[_0x51ed('0x11c')](_0x5981eb+_0x51ed('0xfa'));}catch(_0x560211){logger['error'](_0x560211);}return _0x3c764f;}return this[_0x51ed('0x33')]['error'](_0x59df26,_0x51ed('0x1ba'));};AGIVertices[_0x51ed('0x12')][_0x51ed('0x1bb')]=function(_0x49c47a){logger['info'](util[_0x51ed('0x27')](_0x51ed('0x1bc'),_0x49c47a[_0x51ed('0x35')]));_0x49c47a['text']=_0x49c47a[_0x51ed('0x55')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x49c47a['text'])){return this['channel'][_0x51ed('0x9f')](_0x51ed('0x9d'));}this[_0x51ed('0x33')]['noop'](util['format']('Trying\x20Google\x20TTS\x20%s',_0x49c47a[_0x51ed('0x55')]));var _0x2b1a3f=this[_0x51ed('0x58')]['sync'](this,_0x49c47a);if(_0x2b1a3f){this[_0x51ed('0x33')][_0x51ed('0x9f')](util[_0x51ed('0x27')](_0x51ed('0x1bd'),_0x2b1a3f));var _0x3a578b=this[_0x51ed('0x33')][_0x51ed('0xf8')](_0x2b1a3f);try{fs[_0x51ed('0x11c')](_0x2b1a3f+_0x51ed('0xfa'));}catch(_0x5defd0){logger[_0x51ed('0x2a')](_0x5defd0);}return _0x3a578b;}return this[_0x51ed('0x33')][_0x51ed('0x2a')](_0x49c47a,_0x51ed('0x1be'));};AGIVertices[_0x51ed('0x12')][_0x51ed('0x1bf')]=function(_0x844588){logger[_0x51ed('0x99')](util[_0x51ed('0x27')](_0x51ed('0x1c0'),_0x844588[_0x51ed('0x35')]));if(!this['isConfigured'](_0x844588[_0x51ed('0x14b')])){return this[_0x51ed('0x33')][_0x51ed('0x2a')](_0x844588,_0x51ed('0x14c'));}logger[_0x51ed('0x99')](util[_0x51ed('0x27')](_0x51ed('0x162'),this[_0x51ed('0x33')][_0x51ed('0x37')],_0x844588['findBy']));var _0x31a409=this['agentUnpause'][_0x51ed('0x68')](this,_0x844588[_0x51ed('0x14b')]);if(_0x31a409){logger[_0x51ed('0x99')](util['format'](_0x51ed('0x14e'),this[_0x51ed('0x33')][_0x51ed('0x37')],_0x844588[_0x51ed('0x14b')]));this['channel']['noop'](util[_0x51ed('0x27')](_0x51ed('0x14e'),this[_0x51ed('0x33')]['callerid'],_0x844588[_0x51ed('0x14b')]));return{'code':0xc8,'result':_0x51ed('0x14f')};}else{logger[_0x51ed('0x99')](util[_0x51ed('0x27')](_0x51ed('0x150'),this[_0x51ed('0x33')][_0x51ed('0x37')],_0x844588[_0x51ed('0x14b')]));this[_0x51ed('0x33')]['noop'](util[_0x51ed('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x51ed('0x33')][_0x51ed('0x37')],_0x844588[_0x51ed('0x14b')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x51ed('0x12')][_0x51ed('0x1c1')]=function(_0x3cdf27){logger['info'](util[_0x51ed('0x27')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x3cdf27['label']));var _0x52fb3a=this['channel'][_0x51ed('0xb4')](_0x51ed('0x1c2'),[_0x3cdf27['mailbox'],_0x3cdf27[_0x51ed('0x9e')]]);if(_0x52fb3a[_0x51ed('0x98')]===-0x1){return _0x52fb3a;}return this['channel']['noop'](util[_0x51ed('0x27')]('Executed\x20command\x20%s\x20%s',_0x51ed('0x1c2'),_0x3cdf27['mailbox']));};AGIVertices['prototype']['vswitch']=function(_0x3a05ab){logger['info'](util[_0x51ed('0x27')](_0x51ed('0x1c3'),_0x3a05ab[_0x51ed('0x35')]));if(!this[_0x51ed('0x79')](_0x3a05ab['variable_id'])){return this['channel']['error'](_0x3a05ab,_0x51ed('0x1a5'));}var _0x76c838=this[_0x51ed('0x97')][_0x51ed('0x68')](this,_0x3a05ab[_0x51ed('0xca')]);if(!_0x76c838){return this[_0x51ed('0x33')]['error'](_0x3a05ab,_0x51ed('0x10d'));}var _0x309a20=this[_0x51ed('0x33')][_0x51ed('0x97')](_0x76c838);return{'code':0xc8,'result':_0x309a20[_0x51ed('0x95')]?_0x309a20['extra']:'-'};};String['prototype']['replaceAll']=function(_0x57832a,_0x1ea9fa){return this[_0x51ed('0x93')](_0x57832a)[_0x51ed('0x1c4')](_0x1ea9fa);};module[_0x51ed('0x1c5')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index e4a1a70..7146040 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 _0x3a41=['[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','destlinkedid','[ACW][syncAgentConnect]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','syncAgentRingNoAnswer','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','syncHangupRequest','syncHangup','agentringnoanswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','lastPauseAt','timer','update','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause'];(function(_0x43444b,_0x8cf95b){var _0x392fe5=function(_0x7a1a82){while(--_0x7a1a82){_0x43444b['push'](_0x43444b['shift']());}};_0x392fe5(++_0x8cf95b);}(_0x3a41,0xc8));var _0x13a4=function(_0x19c6a6,_0x36701d){_0x19c6a6=_0x19c6a6-0x0;var _0x29014=_0x3a41[_0x19c6a6];return _0x29014;};'use strict';var util=require(_0x13a4('0x0'));var _=require(_0x13a4('0x1'));var moment=require('moment');var ami=require(_0x13a4('0x2'));var logger=require(_0x13a4('0x3'))(_0x13a4('0x4'));var RpcUser=require(_0x13a4('0x5'));var RpcVoiceAgentReport=require(_0x13a4('0x6'));function Acw(_0x5ca5a7){this[_0x13a4('0x7')]=_0x5ca5a7['voiceQueues'];this[_0x13a4('0x8')]=_0x5ca5a7[_0x13a4('0x8')];this[_0x13a4('0x9')]=_0x5ca5a7[_0x13a4('0x9')];this[_0x13a4('0xa')]={};ami['on'](_0x13a4('0xb'),this[_0x13a4('0xc')][_0x13a4('0xd')](this));ami['on']('hanguprequest',this[_0x13a4('0xe')][_0x13a4('0xd')](this));ami['on']('hangup',this[_0x13a4('0xf')]['bind'](this));ami['on'](_0x13a4('0x10'),this['syncAgentRingNoAnswer'][_0x13a4('0xd')](this));ami['on']('attendedtransfer',this[_0x13a4('0x11')]['bind'](this));ami['on'](_0x13a4('0x12'),this[_0x13a4('0x13')][_0x13a4('0xd')](this));ami['on'](_0x13a4('0x14'),this[_0x13a4('0x15')]['bind'](this));}function getDiff(_0x2958eb){var _0x20e0a9=moment()[_0x13a4('0x16')](0x0);var _0x22b1ba=moment(_0x2958eb)['milliseconds'](0x0);return _0x20e0a9[_0x13a4('0x17')](_0x22b1ba,_0x13a4('0x18'));}Acw[_0x13a4('0x19')][_0x13a4('0x1a')]=function(_0xf0051){try{var _0x515a24=this;var _0x4353bb=this[_0x13a4('0xa')][_0xf0051][_0x13a4('0x1b')];var _0x4e515d=this[_0x13a4('0xa')][_0xf0051][_0x13a4('0x1c')];var _0x443331=this[_0x13a4('0x7')][_0x4e515d];var _0x2a0809=![];var _0x404cae=_0x13a4('0x1d');if(_0x443331[_0x13a4('0x1e')]){if(_0x443331[_0x13a4('0x1f')]['name']){_0x2a0809=!![];_0x404cae=_0x443331['mandatoryDispositionPause'][_0x13a4('0x20')];}}ami[_0x13a4('0x21')]({'action':'QueuePause','interface':_0x4353bb,'paused':!![],'reason':_0x404cae})[_0x13a4('0x22')](function(_0x2221d3){if(_0x515a24[_0x13a4('0x8')][_0x4353bb]){return RpcUser[_0x13a4('0x23')](_0x515a24['agents'][_0x4353bb]['id'])[_0x13a4('0x22')](function(_0x5f2870){if(_0x5f2870&&!_0x5f2870[_0x13a4('0x24')]){logger[_0x13a4('0x25')](_0x13a4('0x26'),_0xf0051,_0x4353bb,_0x4e515d);var _0x4c66dd=_0x515a24['channels'][_0xf0051][_0x13a4('0x27')]&&_0x515a24[_0x13a4('0xa')][_0xf0051]['destlinkedid']?_0x515a24[_0x13a4('0xa')][_0xf0051]['destlinkedid']:_0xf0051;return RpcUser[_0x13a4('0x28')](_0x515a24['agents'][_0x4353bb],_0x404cae,_0x4c66dd)[_0x13a4('0x22')](function(_0x4ac4e5){if(!_0x2a0809){_0x515a24[_0x13a4('0x9')][_0x4353bb]={};logger[_0x13a4('0x25')](_0x13a4('0x29'),_0xf0051,_0x515a24[_0x13a4('0x7')][_0x4e515d][_0x13a4('0x2a')],_0x4353bb,_0x4e515d);_0x515a24[_0x13a4('0x9')][_0x4353bb]['timer']=setTimeout(_0x515a24[_0x13a4('0x2b')][_0x13a4('0xd')](_0x515a24,_0x4353bb),_0x515a24[_0x13a4('0x7')][_0x4e515d]['acwTimeout']*0x3e8);_0x515a24[_0x13a4('0x9')][_0x4353bb]['lastPauseAt']=moment()[_0x13a4('0x2c')](_0x13a4('0x2d'));_0x515a24[_0x13a4('0x9')][_0x4353bb][_0x13a4('0x2e')]=_0xf0051;_0x515a24[_0x13a4('0x9')][_0x4353bb][_0x13a4('0x1c')]=_0x4e515d;_0x515a24[_0x13a4('0x9')][_0x4353bb][_0x13a4('0x2f')]=function(){var _0x4fe875=getDiff(_0x515a24[_0x13a4('0x9')][_0x4353bb][_0x13a4('0x30')]);clearTimeout(_0x515a24[_0x13a4('0x9')][_0x4353bb]['timer']);_0x515a24[_0x13a4('0x9')][_0x4353bb][_0x13a4('0x31')]=![];RpcVoiceAgentReport[_0x13a4('0x32')]({'acwtime':_0x4fe875},_0x515a24[_0x13a4('0x9')][_0x4353bb][_0x13a4('0x2e')],_0x4353bb)[_0x13a4('0x22')](function(_0x74e604){logger[_0x13a4('0x25')](_0x13a4('0x33'),_0xf0051,_0x4fe875,_0x74e604);})[_0x13a4('0x34')](function(_0x5a9f70){logger['error'](_0x13a4('0x35'),_0xf0051,_0x5a9f70);});delete _0x515a24[_0x13a4('0x9')][_0x4353bb];};}});}else{logger['info'](_0x13a4('0x36'),_0xf0051,_0x4353bb,_0x4e515d);}});}})[_0x13a4('0x34')](function(_0x4205f5){logger[_0x13a4('0x37')](_0x13a4('0x29'),_0xf0051,_0x515a24[_0x13a4('0x7')][_0x4e515d][_0x13a4('0x2a')],_0x4353bb,_0x4e515d);})[_0x13a4('0x38')](function(){delete _0x515a24['channels'][_0xf0051];});}catch(_0x29a5b8){logger[_0x13a4('0x37')](_0x13a4('0x39'),_0x29a5b8[_0x13a4('0x3a')]);}};Acw[_0x13a4('0x19')][_0x13a4('0x2b')]=function(_0x36bf91){try{var _0xdd55a=this;if(_0xdd55a['timers'][_0x36bf91]){_0xdd55a[_0x13a4('0x9')][_0x36bf91][_0x13a4('0x31')]=![];var _0x253368=_0xdd55a['timers'][_0x36bf91][_0x13a4('0x2e')];var _0x46c11e=_0xdd55a[_0x13a4('0x9')][_0x36bf91][_0x13a4('0x1c')];var _0x1367b5=_0xdd55a[_0x13a4('0x7')][_0x46c11e][_0x13a4('0x2a')];logger[_0x13a4('0x25')](_0x13a4('0x3b'),_0x253368,_0x36bf91);RpcUser[_0x13a4('0x3c')](this[_0x13a4('0x8')][_0x36bf91]);RpcVoiceAgentReport[_0x13a4('0x32')]({'acwtime':_0x1367b5,'agentacw':!![]},_0x253368,_0x36bf91)[_0x13a4('0x22')](function(_0x34a724){logger[_0x13a4('0x25')]('[%s][UPDATE][ACWTIME:%s]',_0x253368,_0x1367b5,_0x34a724);})['catch'](function(_0x15cf81){logger[_0x13a4('0x37')](_0x13a4('0x35'),_0x253368,_0x15cf81);});}else{logger['error'](_0x13a4('0x3d'),_0x36bf91);if(_0xdd55a[_0x13a4('0x9')]){logger[_0x13a4('0x25')]('[ACW][TIMERS]',JSON[_0x13a4('0x3e')](_0xdd55a[_0x13a4('0x9')]));}}}catch(_0xf5fda){logger['error']('[ACW][STOP]\x20%s',_0xf5fda[_0x13a4('0x3a')]);}};Acw[_0x13a4('0x19')][_0x13a4('0xc')]=function(_0x579d82){try{if(this[_0x13a4('0x7')][_0x579d82[_0x13a4('0x1c')]]&&(this[_0x13a4('0x7')][_0x579d82['queue']][_0x13a4('0x4')]||this['voiceQueues'][_0x579d82[_0x13a4('0x1c')]][_0x13a4('0x1e')])){if(this['agents'][_0x579d82[_0x13a4('0x1b')]]){this[_0x13a4('0xa')][_0x579d82['uniqueid']]={'queue':_0x579d82[_0x13a4('0x1c')],'interface':_0x579d82[_0x13a4('0x1b')],'destlinkedid':_0x579d82[_0x13a4('0x3f')]};}}}catch(_0x4966d1){logger['error'](_0x13a4('0x40'),_0x4966d1[_0x13a4('0x3a')]);}};Acw[_0x13a4('0x19')][_0x13a4('0x15')]=function(_0x5b48e7){try{if(this[_0x13a4('0x7')][_0x5b48e7[_0x13a4('0x1c')]]&&(this[_0x13a4('0x7')][_0x5b48e7['queue']][_0x13a4('0x4')]||this[_0x13a4('0x7')][_0x5b48e7[_0x13a4('0x1c')]]['mandatoryDisposition'])){if(this['agents'][_0x5b48e7['interface']]){this[_0x13a4('0xa')][_0x5b48e7[_0x13a4('0x2e')]]={'queue':_0x5b48e7[_0x13a4('0x1c')],'interface':_0x5b48e7[_0x13a4('0x1b')]};}}}catch(_0x3368c3){logger[_0x13a4('0x37')]('[ACW][syncAgentConnectPreview]\x20%s',_0x3368c3[_0x13a4('0x3a')]);}};Acw[_0x13a4('0x19')]['syncHangupRequest']=function(_0x54fe44){try{if(this[_0x13a4('0xa')][_0x54fe44[_0x13a4('0x2e')]]&&_[_0x13a4('0x41')](this[_0x13a4('0xa')][_0x54fe44[_0x13a4('0x2e')]][_0x13a4('0x27')])){logger[_0x13a4('0x25')]('[%s][HANGUP:UNIQUEID]',_0x54fe44[_0x13a4('0x2e')]);this['startAcw'](_0x54fe44[_0x13a4('0x2e')]);}else if(this[_0x13a4('0xa')][_0x54fe44[_0x13a4('0x42')]]&&_[_0x13a4('0x41')](this[_0x13a4('0xa')][_0x54fe44['linkedid']][_0x13a4('0x27')])){logger[_0x13a4('0x25')](_0x13a4('0x43'),_0x54fe44[_0x13a4('0x42')]);this[_0x13a4('0x1a')](_0x54fe44[_0x13a4('0x42')]);}}catch(_0x47f74d){logger[_0x13a4('0x37')](_0x13a4('0x44'),_0x47f74d[_0x13a4('0x3a')]);}};Acw[_0x13a4('0x19')][_0x13a4('0xf')]=function(_0x3713da){try{if(this[_0x13a4('0xa')][_0x3713da['uniqueid']]&&this[_0x13a4('0xa')][_0x3713da[_0x13a4('0x2e')]][_0x13a4('0x27')]){logger[_0x13a4('0x25')](_0x13a4('0x45'),_0x3713da[_0x13a4('0x2e')]);this['startAcw'](_0x3713da[_0x13a4('0x2e')]);}else if(this['channels'][_0x3713da[_0x13a4('0x42')]]&&this[_0x13a4('0xa')][_0x3713da[_0x13a4('0x42')]][_0x13a4('0x27')]){logger[_0x13a4('0x25')](_0x13a4('0x46'),_0x3713da[_0x13a4('0x42')]);this[_0x13a4('0x1a')](_0x3713da[_0x13a4('0x42')]);}}catch(_0x27bee6){logger[_0x13a4('0x37')](_0x13a4('0x47'),_0x27bee6[_0x13a4('0x3a')]);}};Acw[_0x13a4('0x19')][_0x13a4('0x11')]=function(_0x321fe7){try{if(!_[_0x13a4('0x48')](this[_0x13a4('0xa')][_0x321fe7[_0x13a4('0x49')]])){this[_0x13a4('0x1a')](_0x321fe7['transfereeuniqueid']);if(this[_0x13a4('0xa')][_0x321fe7['secondtransfereruniqueid']]){this[_0x13a4('0xa')][_0x321fe7['secondtransfereruniqueid']][_0x13a4('0x27')]=!![];this[_0x13a4('0xa')][_0x321fe7['transfertargetuniqueid']]=this[_0x13a4('0xa')][_0x321fe7[_0x13a4('0x4a')]];delete this['channels'][_0x321fe7[_0x13a4('0x4a')]];}}else if(!_[_0x13a4('0x48')](this[_0x13a4('0xa')][_0x321fe7['transfertargetuniqueid']])){this['startAcw'](_0x321fe7[_0x13a4('0x4b')]);if(this[_0x13a4('0xa')][_0x321fe7[_0x13a4('0x4c')]]){this['channels'][_0x321fe7[_0x13a4('0x4c')]][_0x13a4('0x27')]=!![];this[_0x13a4('0xa')][_0x321fe7[_0x13a4('0x49')]]=this[_0x13a4('0xa')][_0x321fe7['origtransfereruniqueid']];delete this[_0x13a4('0xa')][_0x321fe7['origtransfereruniqueid']];}}}catch(_0x2b28a6){logger[_0x13a4('0x37')](_0x13a4('0x4d'),_0x2b28a6['message']);}};Acw[_0x13a4('0x19')][_0x13a4('0x13')]=function(_0x1270cc){try{if(this[_0x13a4('0xa')][_0x1270cc['transfereruniqueid']]){logger[_0x13a4('0x25')](_0x13a4('0x4e'),JSON[_0x13a4('0x3e')](_0x1270cc[_0x13a4('0x4f')]));this[_0x13a4('0x1a')](_0x1270cc[_0x13a4('0x4f')]);}else if(this[_0x13a4('0xa')][_0x1270cc[_0x13a4('0x50')]]){logger['info'](_0x13a4('0x51'),JSON[_0x13a4('0x3e')](_0x1270cc[_0x13a4('0x50')]));this[_0x13a4('0x1a')](_0x1270cc[_0x13a4('0x50')]);}}catch(_0x57f550){logger[_0x13a4('0x37')]('[ACW][syncBlindTransfer]\x20%s',_0x57f550[_0x13a4('0x3a')]);}};Acw[_0x13a4('0x19')][_0x13a4('0x52')]=function(_0x2c5dc4){try{if(this[_0x13a4('0x7')][_0x2c5dc4[_0x13a4('0x1c')]]&&this['voiceQueues'][_0x2c5dc4[_0x13a4('0x1c')]]['autopause']==='all'){if(this['agents'][_0x2c5dc4[_0x13a4('0x1b')]]){logger[_0x13a4('0x25')](_0x13a4('0x53'),_0x2c5dc4[_0x13a4('0x2e')],_0x2c5dc4[_0x13a4('0x1b')],_0x2c5dc4[_0x13a4('0x1c')]);return RpcUser[_0x13a4('0x28')](this[_0x13a4('0x8')][_0x2c5dc4[_0x13a4('0x1b')]],_0x13a4('0x54'),_0x2c5dc4[_0x13a4('0x2e')]);}}}catch(_0x20c95d){logger[_0x13a4('0x37')](_0x13a4('0x55'),_0x20c95d[_0x13a4('0x3a')]);}};module[_0x13a4('0x56')]=Acw; \ No newline at end of file +var _0xeb97=['stopAcw','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][TIMERS]','syncAgentConnect','uniqueid','[ACW][syncAgentConnect]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','agents','timers','agentconnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','startAcw','channels','interface','voiceQueues','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','queue','updateAcw','timer','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','finally','[ACW][START]\x20%s','message','prototype'];(function(_0x36f47c,_0x38ef4d){var _0x296c55=function(_0x403eec){while(--_0x403eec){_0x36f47c['push'](_0x36f47c['shift']());}};_0x296c55(++_0x38ef4d);}(_0xeb97,0x182));var _0x7eb9=function(_0x27e4df,_0x1202a7){_0x27e4df=_0x27e4df-0x0;var _0x20696c=_0xeb97[_0x27e4df];return _0x20696c;};'use strict';var util=require('util');var _=require(_0x7eb9('0x0'));var moment=require(_0x7eb9('0x1'));var ami=require(_0x7eb9('0x2'));var logger=require(_0x7eb9('0x3'))(_0x7eb9('0x4'));var RpcUser=require(_0x7eb9('0x5'));var RpcVoiceAgentReport=require(_0x7eb9('0x6'));function Acw(_0x17b079){this['voiceQueues']=_0x17b079['voiceQueues'];this['agents']=_0x17b079[_0x7eb9('0x7')];this[_0x7eb9('0x8')]=_0x17b079['timers'];this['channels']={};ami['on'](_0x7eb9('0x9'),this['syncAgentConnect'][_0x7eb9('0xa')](this));ami['on'](_0x7eb9('0xb'),this[_0x7eb9('0xc')][_0x7eb9('0xa')](this));ami['on'](_0x7eb9('0xd'),this[_0x7eb9('0xe')][_0x7eb9('0xa')](this));ami['on'](_0x7eb9('0xf'),this[_0x7eb9('0x10')][_0x7eb9('0xa')](this));ami['on'](_0x7eb9('0x11'),this['syncAttendedTransfer'][_0x7eb9('0xa')](this));ami['on'](_0x7eb9('0x12'),this['syncBlindTransfer']['bind'](this));ami['on'](_0x7eb9('0x13'),this[_0x7eb9('0x14')][_0x7eb9('0xa')](this));}function getDiff(_0xc64a18){var _0x1fa670=moment()[_0x7eb9('0x15')](0x0);var _0x4d19e6=moment(_0xc64a18)['milliseconds'](0x0);return _0x1fa670['diff'](_0x4d19e6,_0x7eb9('0x16'));}Acw['prototype'][_0x7eb9('0x17')]=function(_0x3b1372){try{var _0x3b1c27=this;var _0x36f3da=this[_0x7eb9('0x18')][_0x3b1372][_0x7eb9('0x19')];var _0x15b4d5=this[_0x7eb9('0x18')][_0x3b1372]['queue'];var _0x314ac9=this[_0x7eb9('0x1a')][_0x15b4d5];var _0xd3e9c9=![];var _0x18e5c2=_0x7eb9('0x1b');if(_0x314ac9[_0x7eb9('0x1c')]){if(_0x314ac9[_0x7eb9('0x1d')][_0x7eb9('0x1e')]){_0xd3e9c9=!![];_0x18e5c2=_0x314ac9['mandatoryDispositionPause'][_0x7eb9('0x1e')];}}ami[_0x7eb9('0x1f')]({'action':_0x7eb9('0x20'),'interface':_0x36f3da,'paused':!![],'reason':_0x18e5c2})[_0x7eb9('0x21')](function(_0x12aabf){if(_0x3b1c27['agents'][_0x36f3da]){return RpcUser[_0x7eb9('0x22')](_0x3b1c27['agents'][_0x36f3da]['id'])[_0x7eb9('0x21')](function(_0x3188fc){if(_0x3188fc&&!_0x3188fc[_0x7eb9('0x23')]){logger[_0x7eb9('0x24')](_0x7eb9('0x25'),_0x3b1372,_0x36f3da,_0x15b4d5);var _0x191603=_0x3b1c27['channels'][_0x3b1372][_0x7eb9('0x26')]&&_0x3b1c27[_0x7eb9('0x18')][_0x3b1372][_0x7eb9('0x27')]?_0x3b1c27['channels'][_0x3b1372]['destlinkedid']:_0x3b1372;return RpcUser[_0x7eb9('0x28')](_0x3b1c27['agents'][_0x36f3da],_0x18e5c2,_0x191603)[_0x7eb9('0x21')](function(_0x2ddd9c){if(!_0xd3e9c9){_0x3b1c27['timers'][_0x36f3da]={};logger[_0x7eb9('0x24')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x3b1372,_0x3b1c27[_0x7eb9('0x1a')][_0x15b4d5]['acwTimeout'],_0x36f3da,_0x15b4d5);_0x3b1c27[_0x7eb9('0x8')][_0x36f3da]['timer']=setTimeout(_0x3b1c27['stopAcw']['bind'](_0x3b1c27,_0x36f3da),_0x3b1c27[_0x7eb9('0x1a')][_0x15b4d5]['acwTimeout']*0x3e8);_0x3b1c27[_0x7eb9('0x8')][_0x36f3da][_0x7eb9('0x29')]=moment()[_0x7eb9('0x2a')](_0x7eb9('0x2b'));_0x3b1c27[_0x7eb9('0x8')][_0x36f3da]['uniqueid']=_0x3b1372;_0x3b1c27['timers'][_0x36f3da][_0x7eb9('0x2c')]=_0x15b4d5;_0x3b1c27['timers'][_0x36f3da][_0x7eb9('0x2d')]=function(){var _0x89f968=getDiff(_0x3b1c27[_0x7eb9('0x8')][_0x36f3da][_0x7eb9('0x29')]);clearTimeout(_0x3b1c27[_0x7eb9('0x8')][_0x36f3da]['timer']);_0x3b1c27['timers'][_0x36f3da][_0x7eb9('0x2e')]=![];RpcVoiceAgentReport[_0x7eb9('0x2f')]({'acwtime':_0x89f968},_0x3b1c27[_0x7eb9('0x8')][_0x36f3da]['uniqueid'],_0x36f3da)[_0x7eb9('0x21')](function(_0x348ef7){logger[_0x7eb9('0x24')](_0x7eb9('0x30'),_0x3b1372,_0x89f968,_0x348ef7);})[_0x7eb9('0x31')](function(_0x5edcb4){logger[_0x7eb9('0x32')](_0x7eb9('0x33'),_0x3b1372,_0x5edcb4);});delete _0x3b1c27['timers'][_0x36f3da];};}});}else{logger['info'](_0x7eb9('0x34'),_0x3b1372,_0x36f3da,_0x15b4d5);}});}})[_0x7eb9('0x31')](function(_0xd8e1fd){logger[_0x7eb9('0x32')](_0x7eb9('0x35'),_0x3b1372,_0x3b1c27['voiceQueues'][_0x15b4d5][_0x7eb9('0x36')],_0x36f3da,_0x15b4d5);})[_0x7eb9('0x37')](function(){delete _0x3b1c27[_0x7eb9('0x18')][_0x3b1372];});}catch(_0x5e3d27){logger['error'](_0x7eb9('0x38'),_0x5e3d27[_0x7eb9('0x39')]);}};Acw[_0x7eb9('0x3a')][_0x7eb9('0x3b')]=function(_0x128205){try{var _0x20eb05=this;if(_0x20eb05[_0x7eb9('0x8')][_0x128205]){_0x20eb05[_0x7eb9('0x8')][_0x128205][_0x7eb9('0x2e')]=![];var _0x58a171=_0x20eb05[_0x7eb9('0x8')][_0x128205]['uniqueid'];var _0x440b4b=_0x20eb05['timers'][_0x128205]['queue'];var _0x51d7e8=_0x20eb05['voiceQueues'][_0x440b4b][_0x7eb9('0x36')];logger[_0x7eb9('0x24')](_0x7eb9('0x3c'),_0x58a171,_0x128205);RpcUser[_0x7eb9('0x3d')](this[_0x7eb9('0x7')][_0x128205]);RpcVoiceAgentReport[_0x7eb9('0x2f')]({'acwtime':_0x51d7e8,'agentacw':!![]},_0x58a171,_0x128205)[_0x7eb9('0x21')](function(_0xffc402){logger[_0x7eb9('0x24')]('[%s][UPDATE][ACWTIME:%s]',_0x58a171,_0x51d7e8,_0xffc402);})['catch'](function(_0x280f96){logger[_0x7eb9('0x32')](_0x7eb9('0x33'),_0x58a171,_0x280f96);});}else{logger[_0x7eb9('0x32')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x128205);if(_0x20eb05[_0x7eb9('0x8')]){logger['info'](_0x7eb9('0x3e'),JSON['stringify'](_0x20eb05[_0x7eb9('0x8')]));}}}catch(_0x3f96a4){logger['error']('[ACW][STOP]\x20%s',_0x3f96a4['message']);}};Acw[_0x7eb9('0x3a')][_0x7eb9('0x3f')]=function(_0x4ed6d){try{if(this[_0x7eb9('0x1a')][_0x4ed6d[_0x7eb9('0x2c')]]&&(this[_0x7eb9('0x1a')][_0x4ed6d['queue']][_0x7eb9('0x4')]||this[_0x7eb9('0x1a')][_0x4ed6d[_0x7eb9('0x2c')]][_0x7eb9('0x1c')])){if(this[_0x7eb9('0x7')][_0x4ed6d[_0x7eb9('0x19')]]){this[_0x7eb9('0x18')][_0x4ed6d[_0x7eb9('0x40')]]={'queue':_0x4ed6d[_0x7eb9('0x2c')],'interface':_0x4ed6d[_0x7eb9('0x19')],'destlinkedid':_0x4ed6d[_0x7eb9('0x27')]};}}}catch(_0x39d018){logger[_0x7eb9('0x32')](_0x7eb9('0x41'),_0x39d018[_0x7eb9('0x39')]);}};Acw[_0x7eb9('0x3a')][_0x7eb9('0x14')]=function(_0x5a498e){try{if(this[_0x7eb9('0x1a')][_0x5a498e[_0x7eb9('0x2c')]]&&(this[_0x7eb9('0x1a')][_0x5a498e[_0x7eb9('0x2c')]][_0x7eb9('0x4')]||this[_0x7eb9('0x1a')][_0x5a498e[_0x7eb9('0x2c')]][_0x7eb9('0x1c')])){if(this[_0x7eb9('0x7')][_0x5a498e['interface']]){this[_0x7eb9('0x18')][_0x5a498e[_0x7eb9('0x40')]]={'queue':_0x5a498e[_0x7eb9('0x2c')],'interface':_0x5a498e[_0x7eb9('0x19')]};}}}catch(_0x182d73){logger['error']('[ACW][syncAgentConnectPreview]\x20%s',_0x182d73['message']);}};Acw['prototype'][_0x7eb9('0xc')]=function(_0x532d42){try{if(this['channels'][_0x532d42[_0x7eb9('0x40')]]&&_[_0x7eb9('0x42')](this['channels'][_0x532d42[_0x7eb9('0x40')]][_0x7eb9('0x26')])){logger[_0x7eb9('0x24')]('[%s][HANGUP:UNIQUEID]',_0x532d42['uniqueid']);this[_0x7eb9('0x17')](_0x532d42['uniqueid']);}else if(this['channels'][_0x532d42[_0x7eb9('0x43')]]&&_[_0x7eb9('0x42')](this['channels'][_0x532d42['linkedid']][_0x7eb9('0x26')])){logger[_0x7eb9('0x24')](_0x7eb9('0x44'),_0x532d42[_0x7eb9('0x43')]);this[_0x7eb9('0x17')](_0x532d42[_0x7eb9('0x43')]);}}catch(_0x1d8baa){logger['error']('[ACW][syncHangupRequest]\x20%s',_0x1d8baa[_0x7eb9('0x39')]);}};Acw[_0x7eb9('0x3a')][_0x7eb9('0xe')]=function(_0x3de2a8){try{if(this[_0x7eb9('0x18')][_0x3de2a8[_0x7eb9('0x40')]]&&this[_0x7eb9('0x18')][_0x3de2a8[_0x7eb9('0x40')]][_0x7eb9('0x26')]){logger['info'](_0x7eb9('0x45'),_0x3de2a8['uniqueid']);this[_0x7eb9('0x17')](_0x3de2a8[_0x7eb9('0x40')]);}else if(this[_0x7eb9('0x18')][_0x3de2a8[_0x7eb9('0x43')]]&&this[_0x7eb9('0x18')][_0x3de2a8['linkedid']]['attended']){logger[_0x7eb9('0x24')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x3de2a8[_0x7eb9('0x43')]);this[_0x7eb9('0x17')](_0x3de2a8[_0x7eb9('0x43')]);}}catch(_0x5a5973){logger['error'](_0x7eb9('0x46'),_0x5a5973[_0x7eb9('0x39')]);}};Acw['prototype'][_0x7eb9('0x47')]=function(_0xde7f64){try{if(!_[_0x7eb9('0x48')](this[_0x7eb9('0x18')][_0xde7f64[_0x7eb9('0x49')]])){this[_0x7eb9('0x17')](_0xde7f64['transfereeuniqueid']);if(this[_0x7eb9('0x18')][_0xde7f64['secondtransfereruniqueid']]){this[_0x7eb9('0x18')][_0xde7f64[_0x7eb9('0x4a')]][_0x7eb9('0x26')]=!![];this[_0x7eb9('0x18')][_0xde7f64[_0x7eb9('0x4b')]]=this['channels'][_0xde7f64[_0x7eb9('0x4a')]];delete this[_0x7eb9('0x18')][_0xde7f64[_0x7eb9('0x4a')]];}}else if(!_[_0x7eb9('0x48')](this[_0x7eb9('0x18')][_0xde7f64[_0x7eb9('0x4b')]])){this[_0x7eb9('0x17')](_0xde7f64['transfertargetuniqueid']);if(this['channels'][_0xde7f64[_0x7eb9('0x4c')]]){this['channels'][_0xde7f64[_0x7eb9('0x4c')]][_0x7eb9('0x26')]=!![];this['channels'][_0xde7f64[_0x7eb9('0x49')]]=this['channels'][_0xde7f64[_0x7eb9('0x4c')]];delete this[_0x7eb9('0x18')][_0xde7f64[_0x7eb9('0x4c')]];}}}catch(_0x3cc1eb){logger[_0x7eb9('0x32')](_0x7eb9('0x4d'),_0x3cc1eb[_0x7eb9('0x39')]);}};Acw[_0x7eb9('0x3a')]['syncBlindTransfer']=function(_0x4c007b){try{if(this['channels'][_0x4c007b[_0x7eb9('0x4e')]]){logger['info'](_0x7eb9('0x4f'),JSON[_0x7eb9('0x50')](_0x4c007b[_0x7eb9('0x4e')]));this['startAcw'](_0x4c007b[_0x7eb9('0x4e')]);}else if(this[_0x7eb9('0x18')][_0x4c007b[_0x7eb9('0x51')]]){logger[_0x7eb9('0x24')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x7eb9('0x50')](_0x4c007b[_0x7eb9('0x51')]));this[_0x7eb9('0x17')](_0x4c007b[_0x7eb9('0x51')]);}}catch(_0x496bf4){logger['error'](_0x7eb9('0x52'),_0x496bf4['message']);}};Acw[_0x7eb9('0x3a')]['syncAgentRingNoAnswer']=function(_0x46903d){try{if(this['voiceQueues'][_0x46903d[_0x7eb9('0x2c')]]&&this['voiceQueues'][_0x46903d[_0x7eb9('0x2c')]][_0x7eb9('0x53')]===_0x7eb9('0x54')){if(this['agents'][_0x46903d[_0x7eb9('0x19')]]){logger[_0x7eb9('0x24')](_0x7eb9('0x55'),_0x46903d[_0x7eb9('0x40')],_0x46903d[_0x7eb9('0x19')],_0x46903d['queue']);return RpcUser[_0x7eb9('0x28')](this[_0x7eb9('0x7')][_0x46903d['interface']],_0x7eb9('0x56'),_0x46903d['uniqueid']);}}}catch(_0x7d5b29){logger[_0x7eb9('0x32')](_0x7eb9('0x57'),_0x7d5b29[_0x7eb9('0x39')]);}};module[_0x7eb9('0x58')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index a700497..baac747 100644 --- a/server/services/ami/ami.js +++ b/server/services/ami/ami.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['../../config/environment','asterisk','port','username','password','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','format','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionQueueSummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','close','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','then','actionSipPeerStatus','catch','[ami.js][fullybooted]','once','asterisk-manager','moment','lodash','../../config/logger','ami'];(function(_0x265d3e,_0x3f2181){var _0x42bb03=function(_0x41aad9){while(--_0x41aad9){_0x265d3e['push'](_0x265d3e['shift']());}};_0x42bb03(++_0x3f2181);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3fd531,_0x538738){_0x3fd531=_0x3fd531-0x0;var _0x5bd9db=_0x0b0e[_0x3fd531];return _0x5bd9db;};'use strict';var Manager=require(_0xe0b0('0x0'));var BPromise=require('bluebird');var moment=require(_0xe0b0('0x1'));var util=require('util');var _=require(_0xe0b0('0x2'));var logger=require(_0xe0b0('0x3'))(_0xe0b0('0x4'));var config=require(_0xe0b0('0x5'));var ami=new Manager(config[_0xe0b0('0x6')][_0xe0b0('0x7')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')][_0xe0b0('0x9')],!![]);ami['keepConnected']();ami['Action']=BPromise[_0xe0b0('0xa')](ami[_0xe0b0('0xb')]);function error(_0xc4a085){logger[_0xe0b0('0xc')](util['format'](_0xe0b0('0xd'),config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')]['port'],util[_0xe0b0('0xe')](_0xc4a085,![],null)));}function close(){logger[_0xe0b0('0xc')](util[_0xe0b0('0xf')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x11')});};};ami[_0xe0b0('0x12')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x13')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'sippeerstatus'});};};ami[_0xe0b0('0x14')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'queuesummary'});};};ami[_0xe0b0('0x15')]=function(){return function(){return ami['Action']({'action':_0xe0b0('0x16')});};};function connect(_0x100204){logger['info'](util['format'](_0xe0b0('0x17'),config['asterisk']['username'],config['asterisk']['ip'],config[_0xe0b0('0x6')]['port']));ami['once'](_0xe0b0('0xc'),error);ami['once'](_0xe0b0('0x18'),close);}ami['on']('connect',connect);ami['on'](_0xe0b0('0x19'),function(_0x1cd7c4){logger[_0xe0b0('0x1a')](util[_0xe0b0('0xf')](_0xe0b0('0x1b'),config['asterisk']['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')],util[_0xe0b0('0xe')](_0x1cd7c4,![],null)));});ami['on']('fullybooted',function(_0x170ad8){logger['info'](util[_0xe0b0('0xf')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')]));return BPromise['resolve']()[_0xe0b0('0x1c')](ami['actionSipShowRegistry']())[_0xe0b0('0x1c')](ami[_0xe0b0('0x12')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x1d')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x14')]())['then'](ami[_0xe0b0('0x15')]())[_0xe0b0('0x1e')](function(_0x5b7a64){logger[_0xe0b0('0xc')](_0xe0b0('0x1f'),util[_0xe0b0('0xe')](_0x5b7a64,{'showHidden':![],'depth':null}));});});ami[_0xe0b0('0x20')](_0xe0b0('0xc'),error);ami[_0xe0b0('0x20')](_0xe0b0('0x18'),close);module['exports']=ami; \ No newline at end of file +var _0x757a=['devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','once','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','[ami.js][fullybooted]','close','exports','bluebird','moment','ami','../../config/environment','asterisk','port','password','Action','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','actionSipShowRegistry','actionDeviceStateList'];(function(_0x3f7d36,_0x1b1474){var _0x1d5259=function(_0x29140c){while(--_0x29140c){_0x3f7d36['push'](_0x3f7d36['shift']());}};_0x1d5259(++_0x1b1474);}(_0x757a,0xde));var _0xa757=function(_0x16d92c,_0x4ebb47){_0x16d92c=_0x16d92c-0x0;var _0xefaf50=_0x757a[_0x16d92c];return _0xefaf50;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var util=require('util');var _=require('lodash');var logger=require('../../config/logger')(_0xa757('0x2'));var config=require(_0xa757('0x3'));var ami=new Manager(config[_0xa757('0x4')][_0xa757('0x5')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')]['username'],config[_0xa757('0x4')][_0xa757('0x6')],!![]);ami['keepConnected']();ami[_0xa757('0x7')]=BPromise[_0xa757('0x8')](ami[_0xa757('0x9')]);function error(_0x1a95ee){logger[_0xa757('0xa')](util['format'](_0xa757('0xb'),config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')],util[_0xa757('0xd')](_0x1a95ee,![],null)));}function close(){logger['error'](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk']['username'],config[_0xa757('0x4')]['ip'],config['asterisk']['port']));}ami[_0xa757('0xe')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0xa757('0xf')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x10')});};};ami[_0xa757('0x11')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x12')});};};ami[_0xa757('0x13')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x14')});};};ami[_0xa757('0x15')]=function(){return function(){return ami['Action']({'action':_0xa757('0x16')});};};function connect(_0x44eab8){logger[_0xa757('0x17')](util['format']('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')]));ami[_0xa757('0x18')]('error',error);ami[_0xa757('0x18')]('close',close);}ami['on'](_0xa757('0x19'),connect);ami['on'](_0xa757('0x1a'),function(_0x14014c){logger[_0xa757('0x17')](util['format']('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')],util[_0xa757('0xd')](_0x14014c,![],null)));});ami['on'](_0xa757('0x1b'),function(_0x21f1af){logger[_0xa757('0x17')](util['format'](_0xa757('0x1c'),config['asterisk'][_0xa757('0xc')],config['asterisk']['ip'],config[_0xa757('0x4')][_0xa757('0x5')]));return BPromise[_0xa757('0x1d')]()['then'](ami[_0xa757('0xe')]())[_0xa757('0x1e')](ami[_0xa757('0xf')]())[_0xa757('0x1e')](ami['actionSipPeerStatus']())[_0xa757('0x1e')](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())['catch'](function(_0xfdf69d){logger['error'](_0xa757('0x1f'),util[_0xa757('0xd')](_0xfdf69d,{'showHidden':![],'depth':null}));});});ami['once'](_0xa757('0xa'),error);ami['once'](_0xa757('0x20'),close);module[_0xa757('0x21')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index ba7d40e..9b5328a 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0x49a1a0,_0x48f776){var _0x518a4f=function(_0x313633){while(--_0x313633){_0x49a1a0['push'](_0x49a1a0['shift']());}};_0x518a4f(++_0x48f776);}(_0xb7e7,0x121));var _0x7b7e=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0xb7e7[_0x42bc91];return _0x3f5507;};'use strict';var jayson=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b7e('0x1'))('ami');var client=jayson[_0x7b7e('0x2')]['http']({'port':0x2329});client[_0x7b7e('0x3')]=function(_0x556d68,_0x31d0ed){return new BPromise(function(_0x118577,_0x1d9384){return client['request'](_0x556d68,_0x31d0ed)['then'](function(_0x333fa4){logger[_0x7b7e('0x4')](_0x7b7e('0x5'),'memberReport',_0x556d68,_0x31d0ed,_0x333fa4);if(_0x333fa4[_0x7b7e('0x6')]){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x333fa4[_0x7b7e('0x6')][_0x7b7e('0x8')],_0x31d0ed);return _0x1d9384(_0x333fa4[_0x7b7e('0x6')]['message']);}else{return _0x118577(_0x333fa4[_0x7b7e('0x9')]);}})[_0x7b7e('0xa')](function(_0x10a666){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x10a666,_0x31d0ed);return _0x1d9384(_0x10a666);});});};module[_0x7b7e('0xb')]=client; \ No newline at end of file +var _0xb43b=['catch','exports','jayson/promise','bluebird','ami','client','http','rpc','memberReport','error','message','result'];(function(_0x4ef11c,_0x387510){var _0x1c3026=function(_0x582d43){while(--_0x582d43){_0x4ef11c['push'](_0x4ef11c['shift']());}};_0x1c3026(++_0x387510);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2cf1e3,_0x1bbacc){_0x2cf1e3=_0x2cf1e3-0x0;var _0x4373a6=_0xb43b[_0x2cf1e3];return _0x4373a6;};'use strict';var jayson=require(_0xbb43('0x0'));var BPromise=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var client=jayson[_0xbb43('0x3')][_0xbb43('0x4')]({'port':0x2329});client['Request']=function(_0x131e9e,_0x41aff6){return new BPromise(function(_0x351254,_0x16432a){return client['request'](_0x131e9e,_0x41aff6)['then'](function(_0x378df5){logger['debug'](_0xbb43('0x5'),_0xbb43('0x6'),_0x131e9e,_0x41aff6,_0x378df5);if(_0x378df5[_0xbb43('0x7')]){logger[_0xbb43('0x7')](_0xbb43('0x5'),'memberReport',_0x131e9e,_0x378df5[_0xbb43('0x7')][_0xbb43('0x8')],_0x41aff6);return _0x16432a(_0x378df5['error'][_0xbb43('0x8')]);}else{return _0x351254(_0x378df5[_0xbb43('0x9')]);}})[_0xbb43('0xa')](function(_0x5e3611){logger[_0xbb43('0x7')](_0xbb43('0x5'),'memberReport',_0x131e9e,_0x5e3611,_0x41aff6);return _0x16432a(_0x5e3611);});});};module[_0xbb43('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 93e31b3..d8b5c17 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 _0x31af=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','format','\x22%s\x22\x20<%s>','dialCutDigit','substring','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','number','queue','active','type','dialQueueTimeout','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x1d3e7a,_0x477358){var _0x325f80=function(_0x1eb331){while(--_0x1eb331){_0x1d3e7a['push'](_0x1d3e7a['shift']());}};_0x325f80(++_0x477358);}(_0x31af,0x1aa));var _0xf31a=function(_0x5ac4dc,_0x16db3a){_0x5ac4dc=_0x5ac4dc-0x0;var _0xd590dd=_0x31af[_0x5ac4dc];return _0xd590dd;};'use strict';var util=require(_0xf31a('0x0'));var _=require(_0xf31a('0x1'));var moment=require(_0xf31a('0x2'));function checkNameSurname(_0x344ff8,_0x5ba92f,_0x1c800b){var _0x1c8f58='';if(!_[_0xf31a('0x3')](_0x5ba92f)&&_0xf31a('0x4')===typeof _0x5ba92f){_0x1c8f58+=_0x5ba92f;}if(!_[_0xf31a('0x3')](_0x1c800b)&&_0xf31a('0x4')===typeof _0x1c800b){_0x1c8f58+='\x20'+_0x1c800b;}if(_0x1c8f58!==''){return _0x1c8f58;}return _0x344ff8;}function Action(_0x599e4a,_0x1457fb,_0x289487){this[_0xf31a('0x5')]=_0x599e4a;this[_0xf31a('0x6')]=_0x289487||undefined;this[_0xf31a('0x7')]=checkNameSurname(_0x1457fb[_0xf31a('0x8')][_0xf31a('0x9')],_0x1457fb[_0xf31a('0x8')][_0xf31a('0xa')],_0x1457fb[_0xf31a('0x8')]['lastName']);this[_0xf31a('0xb')]=_0x1457fb['Contact'][_0xf31a('0x9')];this[_0xf31a('0xc')]=_0x599e4a[_0xf31a('0x7')];this[_0xf31a('0xd')]=_0x1457fb['active']||![];this[_0xf31a('0xe')]=_0x599e4a[_0xf31a('0xe')];this[_0xf31a('0xf')]=_0x599e4a[_0xf31a('0xf')]||0x3;this['scheduledat']=_0x1457fb['scheduledat'];this[_0xf31a('0x10')]=_0x1457fb[_0xf31a('0x10')];this[_0xf31a('0x11')]=_0x1457fb['countcongestionretry'];this[_0xf31a('0x12')]=_0x1457fb[_0xf31a('0x12')];this[_0xf31a('0x13')]=_0x1457fb[_0xf31a('0x13')];this[_0xf31a('0x14')]=_0x1457fb[_0xf31a('0x14')];this['countabandonedretry']=_0x1457fb[_0xf31a('0x15')];this[_0xf31a('0x16')]=_0x1457fb[_0xf31a('0x16')];this[_0xf31a('0x17')]=_0x1457fb[_0xf31a('0x17')];this['ContactId']=_0x1457fb[_0xf31a('0x18')];this[_0xf31a('0x19')]=_0x1457fb['ListId'];this[_0xf31a('0x1a')]=_0x1457fb[_0xf31a('0x1a')];this[_0xf31a('0x1b')]=_0x1457fb[_0xf31a('0x1b')];this[_0xf31a('0x1c')]=_0x1457fb['CampaignId'];this[_0xf31a('0x1d')]=_0x1457fb['id'];this[_0xf31a('0x1e')]=_0x1457fb[_0xf31a('0x8')][_0xf31a('0xa')]||'';this[_0xf31a('0x1f')]=moment()['format'](_0xf31a('0x20'));this['callback']=_0x1457fb[_0xf31a('0x21')];this[_0xf31a('0x22')]=_0x1457fb[_0xf31a('0x22')];this[_0xf31a('0x23')]=_0x1457fb[_0xf31a('0x23')];this[_0xf31a('0x24')]=_0x1457fb[_0xf31a('0x24')];this[_0xf31a('0x25')]='';this[_0xf31a('0x26')]='';}Action[_0xf31a('0x27')]['getCaller']=function(){return util[_0xf31a('0x28')](_0xf31a('0x29'),this[_0xf31a('0x7')],this[_0xf31a('0x5')][_0xf31a('0x2a')]>0x0?this[_0xf31a('0xb')][_0xf31a('0x2b')](this[_0xf31a('0x5')][_0xf31a('0x2a')]):this[_0xf31a('0xb')]);};Action[_0xf31a('0x27')]['getQueue']=function(){return this[_0xf31a('0xc')];};module[_0xf31a('0x2c')]=Action; \ No newline at end of file +var _0x56cc=['active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','starttime','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','format','dialCutDigit','substring','exports','isNil','string','voiceQueue','uniqueid','Contact','phone','lastName','number','queue','name'];(function(_0x482251,_0xe89607){var _0x3a0a37=function(_0x1931f7){while(--_0x1931f7){_0x482251['push'](_0x482251['shift']());}};_0x3a0a37(++_0xe89607);}(_0x56cc,0xa2));var _0xc56c=function(_0x382666,_0x299fa8){_0x382666=_0x382666-0x0;var _0x3a55b1=_0x56cc[_0x382666];return _0x3a55b1;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x3c0a99,_0x5b1e9a,_0x346905){var _0x2e2181='';if(!_[_0xc56c('0x0')](_0x5b1e9a)&&_0xc56c('0x1')===typeof _0x5b1e9a){_0x2e2181+=_0x5b1e9a;}if(!_['isNil'](_0x346905)&&_0xc56c('0x1')===typeof _0x346905){_0x2e2181+='\x20'+_0x346905;}if(_0x2e2181!==''){return _0x2e2181;}return _0x3c0a99;}function Action(_0x1d1292,_0x2346d8,_0x9a5a80){this[_0xc56c('0x2')]=_0x1d1292;this[_0xc56c('0x3')]=_0x9a5a80||undefined;this['name']=checkNameSurname(_0x2346d8[_0xc56c('0x4')][_0xc56c('0x5')],_0x2346d8[_0xc56c('0x4')]['firstName'],_0x2346d8[_0xc56c('0x4')][_0xc56c('0x6')]);this[_0xc56c('0x7')]=_0x2346d8[_0xc56c('0x4')][_0xc56c('0x5')];this[_0xc56c('0x8')]=_0x1d1292[_0xc56c('0x9')];this[_0xc56c('0xa')]=_0x2346d8[_0xc56c('0xa')]||![];this['type']=_0x1d1292[_0xc56c('0xb')];this[_0xc56c('0xc')]=_0x1d1292['dialQueueTimeout']||0x3;this['scheduledat']=_0x2346d8[_0xc56c('0xd')];this['countbusyretry']=_0x2346d8[_0xc56c('0xe')];this[_0xc56c('0xf')]=_0x2346d8[_0xc56c('0xf')];this[_0xc56c('0x10')]=_0x2346d8[_0xc56c('0x10')];this[_0xc56c('0x11')]=_0x2346d8[_0xc56c('0x11')];this[_0xc56c('0x12')]=_0x2346d8['countdropretry'];this[_0xc56c('0x13')]=_0x2346d8['countabandonedretry'];this['countmachineretry']=_0x2346d8[_0xc56c('0x14')];this[_0xc56c('0x15')]=_0x2346d8[_0xc56c('0x15')];this[_0xc56c('0x16')]=_0x2346d8[_0xc56c('0x16')];this[_0xc56c('0x17')]=_0x2346d8['ListId'];this[_0xc56c('0x18')]=_0x2346d8[_0xc56c('0x18')];this['VoiceQueueId']=_0x2346d8[_0xc56c('0x19')];this['CampaignId']=_0x2346d8[_0xc56c('0x1a')];this[_0xc56c('0x1b')]=_0x2346d8['id'];this[_0xc56c('0x1c')]=_0x2346d8[_0xc56c('0x4')][_0xc56c('0x1d')]||'';this[_0xc56c('0x1e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['callback']=_0x2346d8[_0xc56c('0x1f')];this[_0xc56c('0x20')]=_0x2346d8[_0xc56c('0x20')];this['callbackat']=_0x2346d8[_0xc56c('0x21')];this[_0xc56c('0x22')]=_0x2346d8[_0xc56c('0x22')];this[_0xc56c('0x23')]='';this[_0xc56c('0x24')]='';}Action[_0xc56c('0x25')][_0xc56c('0x26')]=function(){return util[_0xc56c('0x27')]('\x22%s\x22\x20<%s>',this[_0xc56c('0x9')],this[_0xc56c('0x2')][_0xc56c('0x28')]>0x0?this[_0xc56c('0x7')][_0xc56c('0x29')](this[_0xc56c('0x2')][_0xc56c('0x28')]):this[_0xc56c('0x7')]);};Action[_0xc56c('0x25')]['getQueue']=function(){return this['queue'];};module[_0xc56c('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 8f4e9d1..e5a65b9 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 _0xb3e1=['starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','seconds','state','statedesc','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','number'];(function(_0x1e7e97,_0x1ec417){var _0x494436=function(_0x560a72){while(--_0x560a72){_0x1e7e97['push'](_0x1e7e97['shift']());}};_0x494436(++_0x1ec417);}(_0xb3e1,0x13a));var _0x1b3e=function(_0x56a871,_0x18b7fe){_0x56a871=_0x56a871-0x0;var _0x124954=_0xb3e1[_0x56a871];return _0x124954;};'use strict';var util=require('util');var _=require(_0x1b3e('0x0'));var moment=require(_0x1b3e('0x1'));function getSeconds(_0xb26b6c,_0x568732){var _0x4297e6=moment(_0xb26b6c)[_0x1b3e('0x2')](0x0);var _0xfc01ed=moment(_0x568732)['milliseconds'](0x0);return _0x4297e6['diff'](_0xfc01ed,_0x1b3e('0x3'));}function AgentComplete(_0xc255e2,_0x4806f5){this[_0x1b3e('0x4')]=0x4;this[_0x1b3e('0x5')]='Answer';this[_0x1b3e('0x6')]=_0xc255e2[_0x1b3e('0x6')];this[_0x1b3e('0x7')]=_0xc255e2[_0x1b3e('0x7')];this['campaigntype']=_0xc255e2[_0x1b3e('0x7')]===_0x1b3e('0x8')?_0x1b3e('0x9'):_0xc255e2[_0x1b3e('0x7')];this[_0x1b3e('0xa')]=_0xc255e2['countbusyretry'];this[_0x1b3e('0xb')]=_0xc255e2[_0x1b3e('0xb')];this[_0x1b3e('0xc')]=_0xc255e2['countnoanswerretry'];this[_0x1b3e('0xd')]=_0xc255e2[_0x1b3e('0xa')]+_0xc255e2[_0x1b3e('0xb')]+_0xc255e2[_0x1b3e('0xc')]+_0xc255e2[_0x1b3e('0xe')]+_0xc255e2[_0x1b3e('0xf')]+_0xc255e2['countabandonedretry']+_0xc255e2[_0x1b3e('0x10')]+_0xc255e2['countagentrejectretry'];this[_0x1b3e('0xe')]=_0xc255e2[_0x1b3e('0xe')];this[_0x1b3e('0xf')]=_0xc255e2[_0x1b3e('0xf')];this[_0x1b3e('0x11')]=_0xc255e2[_0x1b3e('0x11')];this[_0x1b3e('0x10')]=_0xc255e2['countmachineretry'];this[_0x1b3e('0x12')]=_0xc255e2[_0x1b3e('0x12')];this[_0x1b3e('0x13')]=_0x4806f5[_0x1b3e('0x13')];this[_0x1b3e('0x14')]=_0xc255e2['name'];this['calleridnum']=_0xc255e2[_0x1b3e('0x15')];this[_0x1b3e('0x16')]=_0xc255e2['starttime'];this[_0x1b3e('0x17')]=_0xc255e2[_0x1b3e('0x17')];this[_0x1b3e('0x18')]=_0xc255e2[_0x1b3e('0x18')];this[_0x1b3e('0x19')]=moment()[_0x1b3e('0x1a')](_0x1b3e('0x1b'));this[_0x1b3e('0x1c')]=getSeconds(_0xc255e2[_0x1b3e('0x17')],_0xc255e2[_0x1b3e('0x16')]);this['holdtime']=getSeconds(_0xc255e2[_0x1b3e('0x18')],_0xc255e2[_0x1b3e('0x17')]);this['talktime']=getSeconds(this['endtime'],_0xc255e2[_0x1b3e('0x18')]);this['queue']=_0x4806f5[_0x1b3e('0x9')];this['membername']=_0x4806f5[_0x1b3e('0x1d')];this[_0x1b3e('0x1e')]=_0x4806f5[_0x1b3e('0x1e')];this[_0x1b3e('0x1f')]=_0xc255e2['callback'];this['callbackuniqueid']=_0xc255e2[_0x1b3e('0x20')];this[_0x1b3e('0x21')]=_0xc255e2[_0x1b3e('0x21')];this[_0x1b3e('0x22')]=_0xc255e2[_0x1b3e('0x22')];this[_0x1b3e('0x23')]=_0xc255e2['ContactId'];this[_0x1b3e('0x24')]=_0xc255e2['ListId'];this[_0x1b3e('0x25')]=_0xc255e2[_0x1b3e('0x25')];this['VoiceQueueId']=_0xc255e2[_0x1b3e('0x26')];this['CampaignId']=_0xc255e2['CampaignId'];this[_0x1b3e('0x27')]=_0xc255e2[_0x1b3e('0x27')]||'';this[_0x1b3e('0x28')]=_0xc255e2[_0x1b3e('0x28')]||'';}module[_0x1b3e('0x29')]=AgentComplete; \ No newline at end of file +var _0xe05d=['diff','seconds','state','statedesc','Answer','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds'];(function(_0x5d4c9a,_0x45b1c7){var _0x5c938c=function(_0x324277){while(--_0x324277){_0x5d4c9a['push'](_0x5d4c9a['shift']());}};_0x5c938c(++_0x45b1c7);}(_0xe05d,0x1d2));var _0xde05=function(_0xd7a497,_0x2a2ee6){_0xd7a497=_0xd7a497-0x0;var _0x309722=_0xe05d[_0xd7a497];return _0x309722;};'use strict';var util=require(_0xde05('0x0'));var _=require(_0xde05('0x1'));var moment=require(_0xde05('0x2'));function getSeconds(_0x33d6b3,_0x28eb6c){var _0xc5c7f6=moment(_0x33d6b3)[_0xde05('0x3')](0x0);var _0xcd6f35=moment(_0x28eb6c)[_0xde05('0x3')](0x0);return _0xc5c7f6[_0xde05('0x4')](_0xcd6f35,_0xde05('0x5'));}function AgentComplete(_0x376870,_0x7d62df){this[_0xde05('0x6')]=0x4;this[_0xde05('0x7')]=_0xde05('0x8');this[_0xde05('0x9')]=_0x376870[_0xde05('0x9')];this['type']=_0x376870[_0xde05('0xa')];this['campaigntype']=_0x376870[_0xde05('0xa')]===_0xde05('0xb')?'queue':_0x376870[_0xde05('0xa')];this[_0xde05('0xc')]=_0x376870[_0xde05('0xc')];this[_0xde05('0xd')]=_0x376870[_0xde05('0xd')];this['countnoanswerretry']=_0x376870[_0xde05('0xe')];this[_0xde05('0xf')]=_0x376870[_0xde05('0xc')]+_0x376870[_0xde05('0xd')]+_0x376870[_0xde05('0xe')]+_0x376870[_0xde05('0x10')]+_0x376870[_0xde05('0x11')]+_0x376870[_0xde05('0x12')]+_0x376870['countmachineretry']+_0x376870[_0xde05('0x13')];this[_0xde05('0x10')]=_0x376870['countnosuchnumberretry'];this['countdropretry']=_0x376870['countdropretry'];this[_0xde05('0x12')]=_0x376870['countabandonedretry'];this[_0xde05('0x14')]=_0x376870['countmachineretry'];this[_0xde05('0x13')]=_0x376870['countagentrejectretry'];this[_0xde05('0x15')]=_0x7d62df['uniqueid'];this['calleridname']=_0x376870[_0xde05('0x16')];this[_0xde05('0x17')]=_0x376870[_0xde05('0x18')];this[_0xde05('0x19')]=_0x376870[_0xde05('0x19')];this[_0xde05('0x1a')]=_0x376870[_0xde05('0x1a')];this[_0xde05('0x1b')]=_0x376870['answertime'];this[_0xde05('0x1c')]=moment()[_0xde05('0x1d')](_0xde05('0x1e'));this[_0xde05('0x1f')]=getSeconds(_0x376870[_0xde05('0x1a')],_0x376870[_0xde05('0x19')]);this[_0xde05('0x20')]=getSeconds(_0x376870[_0xde05('0x1b')],_0x376870[_0xde05('0x1a')]);this['talktime']=getSeconds(this[_0xde05('0x1c')],_0x376870['answertime']);this[_0xde05('0x21')]=_0x7d62df[_0xde05('0x21')];this['membername']=_0x7d62df[_0xde05('0x22')];this[_0xde05('0x23')]=_0x7d62df['reason'];this[_0xde05('0x24')]=_0x376870[_0xde05('0x24')];this[_0xde05('0x25')]=_0x376870[_0xde05('0x25')];this['callbackat']=_0x376870[_0xde05('0x26')];this[_0xde05('0x27')]=_0x376870[_0xde05('0x27')];this[_0xde05('0x28')]=_0x376870['ContactId'];this[_0xde05('0x29')]=_0x376870['ListId'];this['UserId']=_0x376870[_0xde05('0x2a')];this['VoiceQueueId']=_0x376870['VoiceQueueId'];this['CampaignId']=_0x376870[_0xde05('0x2b')];this[_0xde05('0x2c')]=_0x376870[_0xde05('0x2c')]||'';this[_0xde05('0x2d')]=_0x376870[_0xde05('0x2d')]||'';}module[_0xde05('0x2e')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index e18219b..df5128a 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 _0x81bd=['CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x1a3243,_0x201872){var _0x33f2ca=function(_0x59d32e){while(--_0x59d32e){_0x1a3243['push'](_0x1a3243['shift']());}};_0x33f2ca(++_0x201872);}(_0x81bd,0x7c));var _0xd81b=function(_0x594821,_0x153b6c){_0x594821=_0x594821-0x0;var _0x139112=_0x81bd[_0x594821];return _0x139112;};'use strict';var util=require(_0xd81b('0x0'));var _=require(_0xd81b('0x1'));var moment=require(_0xd81b('0x2'));function getSeconds(_0x2337b1,_0x2d27cb){var _0x2ec03a=moment(_0x2337b1)[_0xd81b('0x3')](0x0);var _0x54e096=moment(_0x2d27cb)[_0xd81b('0x3')](0x0);return _0x2ec03a[_0xd81b('0x4')](_0x54e096,_0xd81b('0x5'));}function Final(_0x4d8e7e){this[_0xd81b('0x6')]=_0x4d8e7e[_0xd81b('0x6')];this[_0xd81b('0x7')]=_0x4d8e7e['scheduledat'];this['type']=_0x4d8e7e[_0xd81b('0x8')];this['campaigntype']=_0x4d8e7e[_0xd81b('0x8')]===_0xd81b('0x9')?_0xd81b('0xa'):_0x4d8e7e[_0xd81b('0x8')];this[_0xd81b('0xb')]=_0x4d8e7e[_0xd81b('0xb')];this[_0xd81b('0xc')]=_0x4d8e7e[_0xd81b('0xc')];this[_0xd81b('0xd')]=_0x4d8e7e[_0xd81b('0xd')];this[_0xd81b('0xe')]=_0x4d8e7e[_0xd81b('0xb')]+_0x4d8e7e[_0xd81b('0xc')]+_0x4d8e7e['countnoanswerretry']+_0x4d8e7e[_0xd81b('0xf')]+_0x4d8e7e['countdropretry']+_0x4d8e7e[_0xd81b('0x10')]+_0x4d8e7e[_0xd81b('0x11')]+_0x4d8e7e['countagentrejectretry'];this[_0xd81b('0xf')]=_0x4d8e7e['countnosuchnumberretry'];this[_0xd81b('0x12')]=_0x4d8e7e[_0xd81b('0x12')];this[_0xd81b('0x10')]=_0x4d8e7e[_0xd81b('0x10')];this[_0xd81b('0x11')]=_0x4d8e7e['countmachineretry'];this[_0xd81b('0x13')]=_0x4d8e7e[_0xd81b('0x13')];this['queue']=_0x4d8e7e[_0xd81b('0xa')];this[_0xd81b('0x14')]=_0x4d8e7e[_0xd81b('0x14')];this[_0xd81b('0x15')]=_0x4d8e7e[_0xd81b('0x15')];this[_0xd81b('0x16')]=_0x4d8e7e[_0xd81b('0x16')];this[_0xd81b('0x17')]=_0x4d8e7e[_0xd81b('0x17')];this[_0xd81b('0x18')]=_0x4d8e7e[_0xd81b('0x17')];this[_0xd81b('0x19')]=_0x4d8e7e[_0xd81b('0x19')]||0x0;this[_0xd81b('0x1a')]=_0x4d8e7e[_0xd81b('0x1a')]||0x0;this[_0xd81b('0x1b')]=_0x4d8e7e['talktime']||0x0;this['callback']=_0x4d8e7e[_0xd81b('0x1c')];this[_0xd81b('0x1d')]=_0x4d8e7e[_0xd81b('0x1d')];this['callbackat']=_0x4d8e7e[_0xd81b('0x1e')];this[_0xd81b('0x1f')]=_0x4d8e7e['recallme'];this[_0xd81b('0x20')]=_0x4d8e7e[_0xd81b('0x20')];this[_0xd81b('0x21')]=_0x4d8e7e[_0xd81b('0x21')];this[_0xd81b('0x22')]=_0x4d8e7e[_0xd81b('0x22')];this[_0xd81b('0x23')]=_0x4d8e7e[_0xd81b('0x23')];this[_0xd81b('0x24')]=_0x4d8e7e[_0xd81b('0x24')];this[_0xd81b('0x25')]=_0x4d8e7e[_0xd81b('0x25')]||'';this['originatecalleridname']=_0x4d8e7e[_0xd81b('0x26')]||'';}module[_0xd81b('0x27')]=Final; \ No newline at end of file +var _0xae24=['countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','seconds','uniqueid','scheduledat','campaigntype','queue','type','countbusyretry'];(function(_0x2fa9ef,_0x11eb49){var _0x40a7db=function(_0x387c7c){while(--_0x387c7c){_0x2fa9ef['push'](_0x2fa9ef['shift']());}};_0x40a7db(++_0x11eb49);}(_0xae24,0x182));var _0x4ae2=function(_0x43cda3,_0x27f87c){_0x43cda3=_0x43cda3-0x0;var _0x2760f9=_0xae24[_0x43cda3];return _0x2760f9;};'use strict';var util=require(_0x4ae2('0x0'));var _=require('lodash');var moment=require(_0x4ae2('0x1'));function getSeconds(_0x4997b0,_0xf4c45d){var _0x1bf293=moment(_0x4997b0)['milliseconds'](0x0);var _0x5b6f4d=moment(_0xf4c45d)[_0x4ae2('0x2')](0x0);return _0x1bf293['diff'](_0x5b6f4d,_0x4ae2('0x3'));}function Final(_0xf26f45){this[_0x4ae2('0x4')]=_0xf26f45[_0x4ae2('0x4')];this[_0x4ae2('0x5')]=_0xf26f45[_0x4ae2('0x5')];this['type']=_0xf26f45['type'];this[_0x4ae2('0x6')]=_0xf26f45['type']==='outbound'?_0x4ae2('0x7'):_0xf26f45[_0x4ae2('0x8')];this['countbusyretry']=_0xf26f45[_0x4ae2('0x9')];this[_0x4ae2('0xa')]=_0xf26f45[_0x4ae2('0xa')];this[_0x4ae2('0xb')]=_0xf26f45['countnoanswerretry'];this[_0x4ae2('0xc')]=_0xf26f45[_0x4ae2('0x9')]+_0xf26f45[_0x4ae2('0xa')]+_0xf26f45['countnoanswerretry']+_0xf26f45[_0x4ae2('0xd')]+_0xf26f45[_0x4ae2('0xe')]+_0xf26f45[_0x4ae2('0xf')]+_0xf26f45[_0x4ae2('0x10')]+_0xf26f45[_0x4ae2('0x11')];this[_0x4ae2('0xd')]=_0xf26f45[_0x4ae2('0xd')];this[_0x4ae2('0xe')]=_0xf26f45[_0x4ae2('0xe')];this['countabandonedretry']=_0xf26f45['countabandonedretry'];this['countmachineretry']=_0xf26f45[_0x4ae2('0x10')];this[_0x4ae2('0x11')]=_0xf26f45['countagentrejectretry'];this[_0x4ae2('0x7')]=_0xf26f45[_0x4ae2('0x7')];this[_0x4ae2('0x12')]=_0xf26f45[_0x4ae2('0x12')];this[_0x4ae2('0x13')]=_0xf26f45[_0x4ae2('0x13')];this[_0x4ae2('0x14')]=_0xf26f45[_0x4ae2('0x14')];this[_0x4ae2('0x15')]=_0xf26f45[_0x4ae2('0x15')];this['endtime']=_0xf26f45['responsetime'];this[_0x4ae2('0x16')]=_0xf26f45[_0x4ae2('0x16')]||0x0;this['holdtime']=_0xf26f45[_0x4ae2('0x17')]||0x0;this[_0x4ae2('0x18')]=_0xf26f45[_0x4ae2('0x18')]||0x0;this[_0x4ae2('0x19')]=_0xf26f45[_0x4ae2('0x19')];this['callbackuniqueid']=_0xf26f45[_0x4ae2('0x1a')];this['callbackat']=_0xf26f45['callbackat'];this[_0x4ae2('0x1b')]=_0xf26f45[_0x4ae2('0x1b')];this[_0x4ae2('0x1c')]=_0xf26f45[_0x4ae2('0x1c')];this[_0x4ae2('0x1d')]=_0xf26f45['ListId'];this[_0x4ae2('0x1e')]=_0xf26f45['UserId'];this[_0x4ae2('0x1f')]=_0xf26f45[_0x4ae2('0x1f')];this[_0x4ae2('0x20')]=_0xf26f45['CampaignId'];this[_0x4ae2('0x21')]=_0xf26f45[_0x4ae2('0x21')]||'';this[_0x4ae2('0x22')]=_0xf26f45[_0x4ae2('0x22')]||'';}module[_0x4ae2('0x23')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index b6f3719..b2040b4 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 _0x89fc=['type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridnum','number','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','starttime','holdtime','IVR','reason','cause-txt','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','milliseconds','diff','Answer','scheduledat'];(function(_0x16b12b,_0x2859e0){var _0x359fca=function(_0x54b396){while(--_0x54b396){_0x16b12b['push'](_0x16b12b['shift']());}};_0x359fca(++_0x2859e0);}(_0x89fc,0x1b3));var _0xc89f=function(_0x58587f,_0x2fa359){_0x58587f=_0x58587f-0x0;var _0x1c086d=_0x89fc[_0x58587f];return _0x1c086d;};'use strict';var util=require(_0xc89f('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x287204,_0x12afc9){var _0x44b18a=moment(_0x287204)[_0xc89f('0x1')](0x0);var _0x2827c1=moment(_0x12afc9)[_0xc89f('0x1')](0x0);return _0x44b18a[_0xc89f('0x2')](_0x2827c1,'seconds');}function Hangup(_0x14c20a,_0x13cb09){this['state']=0x4;this['statedesc']=_0xc89f('0x3');this[_0xc89f('0x4')]=_0x14c20a[_0xc89f('0x4')];this[_0xc89f('0x5')]=_0x14c20a[_0xc89f('0x5')];this[_0xc89f('0x6')]=_0x14c20a[_0xc89f('0x5')]===_0xc89f('0x7')?_0xc89f('0x8'):_0x14c20a[_0xc89f('0x5')];this[_0xc89f('0x9')]=_0x14c20a[_0xc89f('0x9')];this[_0xc89f('0xa')]=_0x14c20a[_0xc89f('0xa')];this[_0xc89f('0xb')]=_0x14c20a['countnoanswerretry'];this[_0xc89f('0xc')]=_0x14c20a[_0xc89f('0x9')]+_0x14c20a[_0xc89f('0xa')]+_0x14c20a['countnoanswerretry']+_0x14c20a[_0xc89f('0xd')]+_0x14c20a[_0xc89f('0xe')]+_0x14c20a[_0xc89f('0xf')]+_0x14c20a['countmachineretry']+_0x14c20a[_0xc89f('0x10')];this[_0xc89f('0xd')]=_0x14c20a[_0xc89f('0xd')];this[_0xc89f('0xe')]=_0x14c20a[_0xc89f('0xe')];this[_0xc89f('0xf')]=_0x14c20a['countabandonedretry'];this[_0xc89f('0x11')]=_0x14c20a['countmachineretry'];this[_0xc89f('0x10')]=_0x14c20a[_0xc89f('0x10')];this[_0xc89f('0x12')]=_0x13cb09[_0xc89f('0x12')];this['calleridname']=_0x14c20a['name'];this[_0xc89f('0x13')]=_0x14c20a[_0xc89f('0x14')];this['starttime']=_0x14c20a['starttime'];this[_0xc89f('0x15')]=_0x14c20a[_0xc89f('0x15')];this[_0xc89f('0x16')]=moment()[_0xc89f('0x17')](_0xc89f('0x18'));this[_0xc89f('0x19')]=getSeconds(_0x14c20a[_0xc89f('0x15')],_0x14c20a[_0xc89f('0x1a')]);this[_0xc89f('0x1b')]=0x0;this['talktime']=getSeconds(this[_0xc89f('0x16')],_0x14c20a[_0xc89f('0x15')]);this[_0xc89f('0x8')]=_0x14c20a[_0xc89f('0x8')];this['membername']=_0xc89f('0x1c');this[_0xc89f('0x1d')]=_0x13cb09[_0xc89f('0x1e')];this[_0xc89f('0x1f')]=_0x14c20a[_0xc89f('0x1f')];this['callbackuniqueid']=_0x14c20a['callbackuniqueid'];this['callbackat']=_0x14c20a[_0xc89f('0x20')];this[_0xc89f('0x21')]=_0x14c20a[_0xc89f('0x21')];this[_0xc89f('0x22')]=_0x14c20a[_0xc89f('0x22')];this[_0xc89f('0x23')]=_0x14c20a[_0xc89f('0x23')];this[_0xc89f('0x24')]=_0x14c20a[_0xc89f('0x24')];this[_0xc89f('0x25')]=_0x14c20a['VoiceQueueId'];this[_0xc89f('0x26')]=_0x14c20a[_0xc89f('0x26')];}module[_0xc89f('0x27')]=Hangup; \ No newline at end of file +var _0xa16c=['IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','state','Answer','scheduledat','type','campaigntype','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','name','calleridnum','number','starttime','responsetime','holdtime','talktime','endtime','queue'];(function(_0x5eaca5,_0x5effb5){var _0x15baf6=function(_0x1239b3){while(--_0x1239b3){_0x5eaca5['push'](_0x5eaca5['shift']());}};_0x15baf6(++_0x5effb5);}(_0xa16c,0xde));var _0xca16=function(_0x3650e7,_0x5aedcf){_0x3650e7=_0x3650e7-0x0;var _0x214054=_0xa16c[_0x3650e7];return _0x214054;};'use strict';var util=require(_0xca16('0x0'));var _=require(_0xca16('0x1'));var moment=require(_0xca16('0x2'));function getSeconds(_0x283b6f,_0xc40e07){var _0x246dea=moment(_0x283b6f)[_0xca16('0x3')](0x0);var _0x3a0560=moment(_0xc40e07)[_0xca16('0x3')](0x0);return _0x246dea[_0xca16('0x4')](_0x3a0560,_0xca16('0x5'));}function Hangup(_0x13200f,_0x33d667){this[_0xca16('0x6')]=0x4;this['statedesc']=_0xca16('0x7');this[_0xca16('0x8')]=_0x13200f[_0xca16('0x8')];this['type']=_0x13200f[_0xca16('0x9')];this[_0xca16('0xa')]=_0x13200f['type']==='outbound'?'queue':_0x13200f[_0xca16('0x9')];this[_0xca16('0xb')]=_0x13200f['countbusyretry'];this['countcongestionretry']=_0x13200f['countcongestionretry'];this[_0xca16('0xc')]=_0x13200f[_0xca16('0xc')];this[_0xca16('0xd')]=_0x13200f[_0xca16('0xb')]+_0x13200f[_0xca16('0xe')]+_0x13200f['countnoanswerretry']+_0x13200f[_0xca16('0xf')]+_0x13200f[_0xca16('0x10')]+_0x13200f[_0xca16('0x11')]+_0x13200f['countmachineretry']+_0x13200f[_0xca16('0x12')];this[_0xca16('0xf')]=_0x13200f[_0xca16('0xf')];this['countdropretry']=_0x13200f[_0xca16('0x10')];this[_0xca16('0x11')]=_0x13200f[_0xca16('0x11')];this[_0xca16('0x13')]=_0x13200f['countmachineretry'];this['countagentrejectretry']=_0x13200f[_0xca16('0x12')];this['uniqueid']=_0x33d667['uniqueid'];this[_0xca16('0x14')]=_0x13200f[_0xca16('0x15')];this[_0xca16('0x16')]=_0x13200f[_0xca16('0x17')];this[_0xca16('0x18')]=_0x13200f[_0xca16('0x18')];this['responsetime']=_0x13200f[_0xca16('0x19')];this['endtime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=getSeconds(_0x13200f[_0xca16('0x19')],_0x13200f[_0xca16('0x18')]);this[_0xca16('0x1a')]=0x0;this[_0xca16('0x1b')]=getSeconds(this[_0xca16('0x1c')],_0x13200f[_0xca16('0x19')]);this[_0xca16('0x1d')]=_0x13200f[_0xca16('0x1d')];this['membername']=_0xca16('0x1e');this[_0xca16('0x1f')]=_0x33d667[_0xca16('0x20')];this['callback']=_0x13200f[_0xca16('0x21')];this[_0xca16('0x22')]=_0x13200f['callbackuniqueid'];this[_0xca16('0x23')]=_0x13200f[_0xca16('0x23')];this[_0xca16('0x24')]=_0x13200f[_0xca16('0x24')];this[_0xca16('0x25')]=_0x13200f['ContactId'];this['ListId']=_0x13200f['ListId'];this[_0xca16('0x26')]=_0x13200f[_0xca16('0x26')];this[_0xca16('0x27')]=_0x13200f[_0xca16('0x27')];this[_0xca16('0x28')]=_0x13200f[_0xca16('0x28')];}module[_0xca16('0x29')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index c0059cf..2ee0265 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 _0xeb05=['type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','calleridname','number','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','scheduledat'];(function(_0x41fe82,_0x54b812){var _0x4f2d17=function(_0x1f5763){while(--_0x1f5763){_0x41fe82['push'](_0x41fe82['shift']());}};_0x4f2d17(++_0x54b812);}(_0xeb05,0x136));var _0x5eb0=function(_0x3620e3,_0x4186ff){_0x3620e3=_0x3620e3-0x0;var _0x1463a3=_0xeb05[_0x3620e3];return _0x1463a3;};'use strict';var util=require('util');var _=require(_0x5eb0('0x0'));var moment=require(_0x5eb0('0x1'));function getSeconds(_0x32536b,_0x18a3f9){var _0x4159c1=moment(_0x32536b)[_0x5eb0('0x2')](0x0);var _0x1da958=moment(_0x18a3f9)[_0x5eb0('0x2')](0x0);return _0x4159c1[_0x5eb0('0x3')](_0x1da958,'seconds');}function History(_0x3ac84b){this['uniqueid']=_0x3ac84b['uniqueid'];this[_0x5eb0('0x4')]=_0x3ac84b[_0x5eb0('0x4')]||undefined;this[_0x5eb0('0x5')]=_0x3ac84b[_0x5eb0('0x5')];this[_0x5eb0('0x6')]=_0x3ac84b[_0x5eb0('0x5')]==='outbound'?_0x5eb0('0x7'):_0x3ac84b[_0x5eb0('0x5')];this[_0x5eb0('0x8')]=_0x3ac84b[_0x5eb0('0x8')];this['countcongestionretry']=_0x3ac84b[_0x5eb0('0x9')];this[_0x5eb0('0xa')]=_0x3ac84b[_0x5eb0('0xa')];this[_0x5eb0('0xb')]=_0x3ac84b[_0x5eb0('0x8')]+_0x3ac84b[_0x5eb0('0x9')]+_0x3ac84b['countnoanswerretry']+_0x3ac84b['countnosuchnumberretry']+_0x3ac84b[_0x5eb0('0xc')]+_0x3ac84b[_0x5eb0('0xd')]+_0x3ac84b['countmachineretry']+_0x3ac84b[_0x5eb0('0xe')];this[_0x5eb0('0xf')]=_0x3ac84b['countnosuchnumberretry'];this[_0x5eb0('0xc')]=_0x3ac84b['countdropretry'];this[_0x5eb0('0xd')]=_0x3ac84b['countabandonedretry'];this[_0x5eb0('0x10')]=_0x3ac84b[_0x5eb0('0x10')];this[_0x5eb0('0xe')]=_0x3ac84b['countagentrejectretry'];this[_0x5eb0('0x7')]=_0x3ac84b[_0x5eb0('0x7')];this[_0x5eb0('0x11')]=_0x3ac84b['name'];this['calleridnum']=_0x3ac84b[_0x5eb0('0x12')];this[_0x5eb0('0x13')]=_0x3ac84b[_0x5eb0('0x13')];this[_0x5eb0('0x14')]=_0x3ac84b[_0x5eb0('0x14')];this[_0x5eb0('0x15')]=_0x3ac84b['responsetime'];this[_0x5eb0('0x16')]=getSeconds(_0x3ac84b[_0x5eb0('0x14')],_0x3ac84b[_0x5eb0('0x13')]);this['holdtime']=0x0;this[_0x5eb0('0x17')]=0x0;this[_0x5eb0('0x18')]=_0x3ac84b[_0x5eb0('0x18')];this['callbackuniqueid']=_0x3ac84b[_0x5eb0('0x19')];this[_0x5eb0('0x1a')]=_0x3ac84b[_0x5eb0('0x1a')];this[_0x5eb0('0x1b')]=_0x3ac84b[_0x5eb0('0x1b')];this['ContactId']=_0x3ac84b[_0x5eb0('0x1c')];this['ListId']=_0x3ac84b[_0x5eb0('0x1d')];this['UserId']=_0x3ac84b['UserId'];this[_0x5eb0('0x1e')]=_0x3ac84b[_0x5eb0('0x1e')];this[_0x5eb0('0x1f')]=_0x3ac84b[_0x5eb0('0x1f')];this[_0x5eb0('0x20')]=_0x3ac84b[_0x5eb0('0x20')]||'';this[_0x5eb0('0x21')]=_0x3ac84b[_0x5eb0('0x21')]||'';}module[_0x5eb0('0x22')]=History; \ No newline at end of file +var _0x5a1d=['talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','name','calleridnum','starttime','responsetime','endtime','ringtime'];(function(_0x2f92d9,_0x27e435){var _0x33b33a=function(_0x1956e6){while(--_0x1956e6){_0x2f92d9['push'](_0x2f92d9['shift']());}};_0x33b33a(++_0x27e435);}(_0x5a1d,0x11e));var _0xd5a1=function(_0x8c553f,_0x5753c2){_0x8c553f=_0x8c553f-0x0;var _0x330a49=_0x5a1d[_0x8c553f];return _0x330a49;};'use strict';var util=require(_0xd5a1('0x0'));var _=require(_0xd5a1('0x1'));var moment=require(_0xd5a1('0x2'));function getSeconds(_0x3cddf4,_0x452dc9){var _0x4fa8f3=moment(_0x3cddf4)[_0xd5a1('0x3')](0x0);var _0x4cc80a=moment(_0x452dc9)['milliseconds'](0x0);return _0x4fa8f3[_0xd5a1('0x4')](_0x4cc80a,_0xd5a1('0x5'));}function History(_0x234eb5){this[_0xd5a1('0x6')]=_0x234eb5[_0xd5a1('0x6')];this['scheduledat']=_0x234eb5[_0xd5a1('0x7')]||undefined;this['type']=_0x234eb5[_0xd5a1('0x8')];this[_0xd5a1('0x9')]=_0x234eb5['type']==='outbound'?'queue':_0x234eb5[_0xd5a1('0x8')];this[_0xd5a1('0xa')]=_0x234eb5[_0xd5a1('0xa')];this['countcongestionretry']=_0x234eb5[_0xd5a1('0xb')];this[_0xd5a1('0xc')]=_0x234eb5[_0xd5a1('0xc')];this[_0xd5a1('0xd')]=_0x234eb5[_0xd5a1('0xa')]+_0x234eb5[_0xd5a1('0xb')]+_0x234eb5[_0xd5a1('0xc')]+_0x234eb5[_0xd5a1('0xe')]+_0x234eb5[_0xd5a1('0xf')]+_0x234eb5[_0xd5a1('0x10')]+_0x234eb5[_0xd5a1('0x11')]+_0x234eb5[_0xd5a1('0x12')];this[_0xd5a1('0xe')]=_0x234eb5['countnosuchnumberretry'];this['countdropretry']=_0x234eb5[_0xd5a1('0xf')];this[_0xd5a1('0x10')]=_0x234eb5['countabandonedretry'];this[_0xd5a1('0x11')]=_0x234eb5[_0xd5a1('0x11')];this['countagentrejectretry']=_0x234eb5[_0xd5a1('0x12')];this[_0xd5a1('0x13')]=_0x234eb5[_0xd5a1('0x13')];this['calleridname']=_0x234eb5[_0xd5a1('0x14')];this[_0xd5a1('0x15')]=_0x234eb5['number'];this[_0xd5a1('0x16')]=_0x234eb5[_0xd5a1('0x16')];this[_0xd5a1('0x17')]=_0x234eb5['responsetime'];this[_0xd5a1('0x18')]=_0x234eb5[_0xd5a1('0x17')];this[_0xd5a1('0x19')]=getSeconds(_0x234eb5['responsetime'],_0x234eb5[_0xd5a1('0x16')]);this['holdtime']=0x0;this[_0xd5a1('0x1a')]=0x0;this['callback']=_0x234eb5[_0xd5a1('0x1b')];this[_0xd5a1('0x1c')]=_0x234eb5['callbackuniqueid'];this['callbackat']=_0x234eb5[_0xd5a1('0x1d')];this['recallme']=_0x234eb5[_0xd5a1('0x1e')];this[_0xd5a1('0x1f')]=_0x234eb5[_0xd5a1('0x1f')];this[_0xd5a1('0x20')]=_0x234eb5['ListId'];this['UserId']=_0x234eb5[_0xd5a1('0x21')];this[_0xd5a1('0x22')]=_0x234eb5[_0xd5a1('0x22')];this[_0xd5a1('0x23')]=_0x234eb5['CampaignId'];this[_0xd5a1('0x24')]=_0x234eb5[_0xd5a1('0x24')]||'';this[_0xd5a1('0x25')]=_0x234eb5[_0xd5a1('0x25')]||'';}module[_0xd5a1('0x26')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 428dce6..dfee0bb 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 _0x1ff7=['getQueue','isSuccess','response','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','object','evt\x20is\x20undefine','reason','NoSuchNumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','agentreject','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Success','contact\x20not\x20moved','round','predictiveIntervalMaxThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','Unknown\x20Predictive','[getDataPredictive]','outboundQueuePauses','[CatchErlangB]','busyFactor','check\x20failure','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','dialRecallMeTimeout','Agent','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','[countReScheduled]\x20','RUNNING','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','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','---------------------------','Ts\x20=\x20','[abandonmentRate]','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[busyFactor]','Umin\x20=\x20','exports','util','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','env','XCALLY_IP_AGI','rrmemory','roundrobin','prototype','tail','sequence','preview','voiceQueues','campaigns','agents','maxNumberOriginate','channels','contactsId','optionPredictive','startPredictive','startProgressive','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','isEmpty','Intervals','Error','milliseconds','diff','type','outbound','strategy','answered','available','pTalking','sumBillable','sumHoldTime','talking','total','unmanaged','waiting','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','stringify','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\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\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','seconds','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','\x22%s\x22\x20<%s>','string','\x22\x22\x20<>','error','inspect','stack','originated','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','state','statedesc','endtime','clearZombieChannels','uniqueId','[uniqueid]','actions','enqueue','isNil','Action','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','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','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isTrunkReachable','SIP/%s','status','reachable','trunks','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','value','membername','AMD','emit','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','MACHINE','outboundAnswerAgiCallsDay','Machine','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','add','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','HANGUP','[syncHangupInAMDIvr][createHistory]','dialMachineRetryFrequency','minutes','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','cause-txt','Unknow','dialQueueProject2','dialAgiAfterHangupAgent','answertime','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','Drop','TIMEOUT','countdropretry','dialDropMaxRetry','queueCallerAbandonCreateState','dialDropRetryFrequency','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','Abandoned','dropreason','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncQueueMember','actionid','locked','paused','stateinterface','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','syncQueueStatusComplete','run','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','Agent:\x20','[Catch][Preview][syncQueueStatusComplete]','finally','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','resetActiveCalls','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','iftime\x20%s,%s','interval','timezones','content','indexOf','true','command','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialActive','loggedIn','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','checkDialMethod','[syncQueueSummary]','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','%s%s','XMD-','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','originate','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','[originateError]:\x20%s','OriginateError','[originate][error]'];(function(_0x4c1d61,_0x3d1cc0){var _0x3b470f=function(_0x1bf9d1){while(--_0x1bf9d1){_0x4c1d61['push'](_0x4c1d61['shift']());}};_0x3b470f(++_0x3d1cc0);}(_0x1ff7,0x7f));var _0x71ff=function(_0xbded9d,_0x694a44){_0xbded9d=_0xbded9d-0x0;var _0x3ac737=_0x1ff7[_0xbded9d];return _0x3ac737;};'use strict';var util=require(_0x71ff('0x0'));var _=require('lodash');var BPromise=require(_0x71ff('0x1'));var uuid=require(_0x71ff('0x2'));var moment=require(_0x71ff('0x3'));var rr=require('rr');var md5=require(_0x71ff('0x4'));var Redis=require(_0x71ff('0x5'));var ut=require(_0x71ff('0x6'));var config=require('../../../config/environment/');var logger=require(_0x71ff('0x7'))(_0x71ff('0x8'));var loggerBooked=require(_0x71ff('0x7'))(_0x71ff('0x9'));var loggerPredictive=require(_0x71ff('0x7'))(_0x71ff('0xa'));var loggerPredictiveCalls=require(_0x71ff('0x7'))(_0x71ff('0xb'));var loggerSyncQueueSummary=require(_0x71ff('0x7'))(_0x71ff('0xc'));var ami=require(_0x71ff('0xd'));config[_0x71ff('0xe')]=_[_0x71ff('0xf')](config['redis'],{'host':_0x71ff('0x10'),'port':0x18eb});var io=require(_0x71ff('0x11'))(new Redis(config[_0x71ff('0xe')]));var cmHopper=require(_0x71ff('0x12'));var cmHopperHistory=require(_0x71ff('0x13'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x71ff('0x14'));var Action=require(_0x71ff('0x15'));var History=require(_0x71ff('0x16'));var Final=require(_0x71ff('0x17'));var AgentComplete=require(_0x71ff('0x18'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require('./hangup');var ipAgi=process[_0x71ff('0x19')][_0x71ff('0x1a')]||'127.0.0.1';var strategy={'rrmemory':_0x71ff('0x1b'),'roundrobin':_0x71ff('0x1c')};var Sequence=function(){};Sequence[_0x71ff('0x1d')]['enqueue']=function(_0x2fd639){this[_0x71ff('0x1e')]=this['tail']?this['tail']['finally'](_0x2fd639):_0x2fd639();};function Dialer(_0x2cf289,_0xb8c401){this[_0x71ff('0x1f')]=new Sequence();this[_0x71ff('0x20')]=_0xb8c401;this['voiceQueues']=_0x2cf289[_0x71ff('0x21')];this['campaigns']=_0x2cf289[_0x71ff('0x22')];this[_0x71ff('0x23')]=_0x2cf289[_0x71ff('0x23')];this['trunks']=_0x2cf289['trunks'];this['maxNumberOriginate']=config[_0x71ff('0x24')]||0x2;this[_0x71ff('0x25')]={};this['actions']={};this[_0x71ff('0x26')]={};this['uniqueId']={};this[_0x71ff('0x27')]={};this[_0x71ff('0x28')]={};this[_0x71ff('0x29')]={};this['ivrOriginated']={};this[_0x71ff('0x2a')]={};this[_0x71ff('0x2b')]={};ami['on'](_0x71ff('0x2c'),this[_0x71ff('0x2d')][_0x71ff('0x2e')](this));ami['on'](_0x71ff('0x2f'),this['syncQueueCallerAbandon'][_0x71ff('0x2e')](this));ami['on'](_0x71ff('0x30'),this[_0x71ff('0x31')][_0x71ff('0x2e')](this));ami['on'](_0x71ff('0x32'),this[_0x71ff('0x33')][_0x71ff('0x2e')](this));ami['on'](_0x71ff('0x34'),this[_0x71ff('0xc')][_0x71ff('0x2e')](this));ami['on'](_0x71ff('0x35'),this[_0x71ff('0x36')][_0x71ff('0x2e')](this));ami['on'](_0x71ff('0x37'),this[_0x71ff('0x38')]['bind'](this));ami['on'](_0x71ff('0x39'),this[_0x71ff('0x3a')][_0x71ff('0x2e')](this));ami['on'](_0x71ff('0x3b'),this['syncQueueMember'][_0x71ff('0x2e')](this));ami['on'](_0x71ff('0x3c'),this['syncQueueStatusComplete']['bind'](this));this[_0x71ff('0x3d')]();this[_0x71ff('0x3e')]();}function isNotNull(_0x997f48){return _0x997f48!==null&&!_[_0x71ff('0x3f')](_0x997f48);}function checkIsLoggedIn(_0x17fce0,_0xdb8085){return function(){if(_0xdb8085<=0x0){_0x17fce0[_0x71ff('0x40')]='AGENTS_NOT_LOGGED';throw _0x17fce0[_0x71ff('0x41')]+_0x71ff('0x42');}};}function isActive(_0x3f63f3){return _0x3f63f3;}function checkIsActive(_0x23b717,_0xd4cbbc){return function(){if(!isActive(_0xd4cbbc)){_0x23b717[_0x71ff('0x40')]=_0x71ff('0x43');throw _0x23b717[_0x71ff('0x41')]+_0x71ff('0x44');}};}function checkInterval(_0xb5f1b8){return function(){if(!isNotNull(_0xb5f1b8[_0x71ff('0x45')])){_0xb5f1b8[_0x71ff('0x40')]=_0x71ff('0x46');throw _0xb5f1b8[_0x71ff('0x41')]+_0x71ff('0x47');}if(!isNotNull(_0xb5f1b8[_0x71ff('0x45')]['Intervals'])){_0xb5f1b8[_0x71ff('0x40')]=_0x71ff('0x46');throw _0xb5f1b8[_0x71ff('0x41')]+_0x71ff('0x47');}if(!isNotNull(_[_0x71ff('0x48')](_0xb5f1b8[_0x71ff('0x45')][_0x71ff('0x49')]))){_0xb5f1b8[_0x71ff('0x40')]=_0x71ff('0x46');throw _0xb5f1b8[_0x71ff('0x41')]+_0x71ff('0x47');}};}function msgResponse(_0x4a138d,_0x262244,_0x126468){return{'action':_0x4a138d,'response':_0x262244,'message':_0x126468,'stack':_0x126468};}function myreject(_0x1390a6){return function(_0x3f4770){return _0x1390a6(msgResponse('[ifTime][Action]',_0x71ff('0x4a'),JSON['stringify'](_0x3f4770)));};}function getSeconds(_0x4eadc2,_0x16756d){var _0x1fc9a9=moment(_0x4eadc2)[_0x71ff('0x4b')](0x0);var _0x4460c=moment(_0x16756d)[_0x71ff('0x4b')](0x0);return _0x1fc9a9[_0x71ff('0x4c')](_0x4460c,'seconds');}function emit(_0x36cde8,_0x330459,_0x5da1c8){io['to'](_0x36cde8)['emit'](_0x330459,_0x5da1c8);}function emitVoiceQueueSummary(_0x2e791d){if(_0x2e791d[_0x71ff('0x4d')]===_0x71ff('0x4e')){var _0x4f1a45={'id':_0x2e791d['id'],'name':_0x2e791d[_0x71ff('0x41')],'strategy':_0x2e791d[_0x71ff('0x4f')],'answered':_0x2e791d[_0x71ff('0x50')],'available':_0x2e791d[_0x71ff('0x51')],'loggedIn':_0x2e791d['loggedIn'],'pTalking':_0x2e791d[_0x71ff('0x52')],'sumBillable':_0x2e791d[_0x71ff('0x53')],'sumDuration':_0x2e791d['sumDuration'],'sumHoldTime':_0x2e791d[_0x71ff('0x54')]||0x0,'talking':_0x2e791d[_0x71ff('0x55')],'total':_0x2e791d[_0x71ff('0x56')],'type':_0x2e791d['type'],'unmanaged':_0x2e791d[_0x71ff('0x57')],'abandoned':_0x2e791d['abandoned'],'waiting':_0x2e791d[_0x71ff('0x58')],'loggedInDb':_0x2e791d['loggedInDb'],'dialActive':_0x2e791d['dialActive'],'dialMethod':_0x2e791d[_0x71ff('0x59')],'dialOriginateCallerIdName':_0x2e791d[_0x71ff('0x5a')],'dialOriginateCallerIdNumber':_0x2e791d[_0x71ff('0x5b')],'dialOriginateTimeout':_0x2e791d[_0x71ff('0x5c')],'dialPrefix':_0x2e791d['dialPrefix'],'outboundAnswerAgiCallsDay':_0x2e791d['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x2e791d[_0x71ff('0x5d')],'outboundBlacklistCallsDay':_0x2e791d[_0x71ff('0x5e')],'outboundBusyCallsDay':_0x2e791d[_0x71ff('0x5f')],'outboundCongestionCallsDay':_0x2e791d[_0x71ff('0x60')],'outboundDropCallsDayACS':_0x2e791d['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x2e791d[_0x71ff('0x61')],'outboundDropCallsDayTimeout':_0x2e791d[_0x71ff('0x62')],'outboundNoAnswerCallsDay':_0x2e791d[_0x71ff('0x63')],'outboundNoSuchCallsDay':_0x2e791d[_0x71ff('0x64')],'outboundOriginateFailureCallsDay':_0x2e791d[_0x71ff('0x65')],'outboundReCallsDay':_0x2e791d[_0x71ff('0x66')],'outboundRejectCallsDay':_0x2e791d['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x2e791d[_0x71ff('0x67')],'predictiveIntervalAnsweredCalls':_0x2e791d[_0x71ff('0x68')],'predictiveIntervalAvgHoldtime':_0x2e791d[_0x71ff('0x69')],'predictiveIntervalAvgTalktime':_0x2e791d[_0x71ff('0x6a')],'predictiveIntervalDroppedCallsCallersExit':_0x2e791d[_0x71ff('0x6b')],'predictiveIntervalDroppedCallsTimeout':_0x2e791d[_0x71ff('0x6c')],'predictiveIntervalErlangCalls':_0x2e791d[_0x71ff('0x6d')],'predictiveIntervalErlangCallsDroppedCalls':_0x2e791d[_0x71ff('0x6e')],'predictiveIntervalHitRate':_0x2e791d[_0x71ff('0x6f')],'predictiveIntervalMultiplicativeFactor':_0x2e791d[_0x71ff('0x70')],'predictiveIntervalPauses':_0x2e791d[_0x71ff('0x71')],'predictiveIntervalAvailable':_0x2e791d[_0x71ff('0x72')],'predictiveIntervalTotalCalls':_0x2e791d[_0x71ff('0x73')],'message':_0x2e791d[_0x71ff('0x40')],'originated':_0x2e791d['originated'],'erlangCalls':_0x2e791d[_0x71ff('0x74')],'erlangCallToSecond':_0x2e791d[_0x71ff('0x75')],'erlangAbandonmentRate':_0x2e791d[_0x71ff('0x76')],'erlangBusyFactor':_0x2e791d[_0x71ff('0x77')],'startPredictive':_0x2e791d[_0x71ff('0x28')],'startProgressive':_0x2e791d[_0x71ff('0x29')]};if(_0x2e791d[_0x71ff('0x78')]){_0x4f1a45['Trunk']={'id':_0x2e791d['Trunk']['id'],'name':_0x2e791d[_0x71ff('0x78')][_0x71ff('0x41')],'active':_0x2e791d[_0x71ff('0x78')][_0x71ff('0x79')],'callerid':_0x2e791d[_0x71ff('0x78')][_0x71ff('0x7a')]};}if(_0x2e791d[_0x71ff('0x45')]){_0x4f1a45[_0x71ff('0x45')]={'id':_0x2e791d['Interval']['id'],'name':_0x2e791d['Interval'][_0x71ff('0x41')]};}var _0x36999f=md5(JSON[_0x71ff('0x7b')](_0x4f1a45));if(_0x2e791d['md5']!==_0x36999f){_0x2e791d[_0x71ff('0x4')]=_0x36999f;emit(util[_0x71ff('0x7c')](_0x71ff('0x7d'),_0x4f1a45[_0x71ff('0x41')]),_0x71ff('0x7e'),_0x4f1a45);}}}function emitCampaignSummary(_0x53139c){if(_0x53139c[_0x71ff('0x4d')]===_0x71ff('0x7f')){emit(util['format'](_0x71ff('0x80'),_0x53139c[_0x71ff('0x41')]),_0x71ff('0x81'),_0x53139c);}}function checkGetDataPredictive(_0x1b862b){if(isNotNull(_0x1b862b)&&!_[_0x71ff('0x48')](_0x1b862b)){loggerPredictive[_0x71ff('0x82')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x71ff('0x82')](_0x71ff('0x83'),_0x1b862b[_0x71ff('0x73')]);loggerPredictive[_0x71ff('0x82')](_0x71ff('0x84'),_0x1b862b[_0x71ff('0x68')]);loggerPredictive[_0x71ff('0x82')](_0x71ff('0x85'),_0x1b862b['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x71ff('0x82')](_0x71ff('0x86'),_0x1b862b[_0x71ff('0x6b')]);loggerPredictive[_0x71ff('0x82')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1b862b['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x71ff('0x82')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1b862b[_0x71ff('0x6a')]);loggerPredictive['info']('---------------------------');if(_0x1b862b[_0x71ff('0x73')]>0x0){if(!_[_0x71ff('0x3f')](_0x1b862b[_0x71ff('0x6a')])&&_0x1b862b[_0x71ff('0x6a')]>0x0){return!![];}loggerPredictive[_0x71ff('0x82')](_0x71ff('0x87'));if(!_[_0x71ff('0x3f')](_0x1b862b[_0x71ff('0x69')])&&_0x1b862b[_0x71ff('0x69')]>0x0){return!![];}loggerPredictive['info'](_0x71ff('0x88'));}else{loggerPredictive[_0x71ff('0x82')](_0x71ff('0x89'));}}else{loggerPredictive[_0x71ff('0x82')](_0x71ff('0x8a'));}return![];}function mergeDataErlangB(_0x2f162e){return function(_0x3d7a5e){loggerPredictive[_0x71ff('0x82')](_0x71ff('0x8b'));loggerPredictive[_0x71ff('0x82')](_0x71ff('0x8c'),_0x3d7a5e[_0x71ff('0x74')]);loggerPredictive[_0x71ff('0x82')](_0x71ff('0x8d'),_0x3d7a5e[_0x71ff('0x75')]);loggerPredictive[_0x71ff('0x82')](_0x71ff('0x8e'),_0x3d7a5e['erlangAbandonmentRate']);loggerPredictive[_0x71ff('0x82')](_0x71ff('0x8f'),_0x3d7a5e[_0x71ff('0x77')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3d7a5e[_0x71ff('0x76')]);loggerPredictive[_0x71ff('0x82')]('---------------------------');_[_0x71ff('0x90')](_0x2f162e,_0x3d7a5e);};}function getDiff(_0xa65d6d){var _0x4ad922=moment()[_0x71ff('0x4b')](0x0);var _0x4d3acb=moment(_0xa65d6d)[_0x71ff('0x4b')](0x0);return _0x4ad922[_0x71ff('0x4c')](_0x4d3acb,_0x71ff('0x91'));}function ifInterval(_0x327736,_0x34207b){if(_['isUndefined'](_0x34207b)){return![];}return getDiff(_0x34207b)<_0x327736*0x3c;}function freeVariablesPredictive(_0x569dd2){if(isNotNull(_0x569dd2)){if(!_[_0x71ff('0x3f')](_0x569dd2[_0x71ff('0x29')])){_0x569dd2[_0x71ff('0x29')]=undefined;loggerPredictive[_0x71ff('0x82')](_0x569dd2[_0x71ff('0x41')],_0x71ff('0x92'));}if(!_[_0x71ff('0x3f')](_0x569dd2[_0x71ff('0x28')])){_0x569dd2[_0x71ff('0x28')]=undefined;loggerPredictive[_0x71ff('0x82')](_0x569dd2[_0x71ff('0x41')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x71ff('0x3f')](_0x569dd2[_0x71ff('0x93')])){clearInterval(_0x569dd2[_0x71ff('0x93')]);_0x569dd2[_0x71ff('0x93')]=undefined;loggerPredictive['info'](_0x569dd2[_0x71ff('0x41')],_0x71ff('0x94'));}}}function erlangb(_0x9a879,_0x5727e9){if(_0x5727e9===0x0){return 0x0;}var _0x49199d=0x1;for(var _0x152374=0x1;_0x152374<=_0x5727e9;_0x152374+=0x1){_0x49199d=0x1+_0x49199d*_0x152374/_0x9a879;}return 0x1/_0x49199d;}function isVoiceQueueOutbound(_0x4f1f01){return _0x4f1f01==='outbound';}function isNotPreview(_0x194467){return _0x194467!==_0x71ff('0x20');}function isCampaignIvr(_0x1d009a){return _0x1d009a===_0x71ff('0x7f');}function getCallerId(_0xb56c2e,_0x384cd0,_0x38ce39){if(!_[_0x71ff('0x3f')](_0x38ce39)&&typeof _0x38ce39==='string'&&!_[_0x71ff('0x48')](_0x38ce39)){if(!_[_0x71ff('0x3f')](_0x384cd0)&&typeof _0x384cd0==='string'&&!_[_0x71ff('0x48')](_0x384cd0)){return util[_0x71ff('0x7c')](_0x71ff('0x95'),_0x384cd0,_0x38ce39);}return util['format']('\x22%s\x22\x20<%s>',_0x38ce39,_0x38ce39);}if(!_['isUndefined'](_0xb56c2e)&&typeof _0xb56c2e===_0x71ff('0x96')&&!_[_0x71ff('0x48')](_0xb56c2e)){return _0xb56c2e;}return _0x71ff('0x97');}function loggerCatchQueueSummary(_0x31f516,_0x11d16f){return function(_0x2d5db1){freeVariablesPredictive(_0x11d16f);emitVoiceQueueSummary(_0x11d16f);emitCampaignSummary(_0x11d16f);loggerSyncQueueSummary[_0x71ff('0x98')](_0x31f516,util[_0x71ff('0x99')](_0x2d5db1,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x52b42f,_0x2a8db6){return function(_0x10e5b0){loggerPredictive[_0x71ff('0x98')](_0x2a8db6['name'],_0x52b42f);loggerPredictive[_0x71ff('0x98')](_0x10e5b0[_0x71ff('0x9a')]);freeVariablesPredictive(_0x2a8db6);};}function loggerCatch(_0x217303){return function(_0x4129ef){logger[_0x71ff('0x98')](_0x217303,util[_0x71ff('0x99')](_0x4129ef,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x30f7a0){return _0x30f7a0&&!_['isUndefined'](_0x30f7a0)&&_0x30f7a0['length']>0x0;}function decremetOriginate(_0x4968f7){if(!_[_0x71ff('0x3f')](_0x4968f7)&&_0x4968f7!==null){if(typeof _0x4968f7[_0x71ff('0x9b')]!==_0x71ff('0x9c')){if(_0x4968f7['originated']>0x0){_0x4968f7[_0x71ff('0x9b')]-=0x1;}else{logger[_0x71ff('0x98')](_0x71ff('0x9d'));}}}else{logger[_0x71ff('0x98')](_0x71ff('0x9e'));}}function checkContactLowerLimitOriginate(_0x3f6792,_0x273d3c,_0x49e1a1){if(_0x273d3c>_0x49e1a1){for(var _0x27d5ec=0x0;_0x27d5ec<_0x273d3c-_0x49e1a1;_0x27d5ec+=0x1){decremetOriginate(_0x3f6792);}}}function loggerGetContactDialer(_0x2625e7,_0x1329d9,_0x12f47f){return function(_0x290b74){checkContactLowerLimitOriginate(_0x1329d9,_0x12f47f,0x0);logger[_0x71ff('0x98')](_0x2625e7,util[_0x71ff('0x99')](_0x290b74,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x4d2c03){return function(_0x23c493){if(isNotNull(_0x23c493)&&isNotNull(_0x23c493[0x0])){if(_0x23c493[0x0][_0x71ff('0x9f')]>0x0){_0x4d2c03[_0x71ff('0x40')]=_0x71ff('0xa0');logger[_0x71ff('0x82')](_0x71ff('0xa1')+_0x4d2c03[_0x71ff('0x41')],_0x23c493[0x0]['contactsRescheduled'],_0x71ff('0xa2'));}else{_0x4d2c03[_0x71ff('0x40')]=_0x71ff('0xa3');logger[_0x71ff('0x82')]('[getContactDialer2][Empty]'+_0x4d2c03[_0x71ff('0x41')]);}}};}function notSendMessagesQueue(_0x28fe46){if(_0x28fe46[_0x71ff('0xa4')]){freeVariablesPredictive(_0x28fe46);if(_0x28fe46['originated']===0x0&&_0x28fe46['talking']===0x0&&_0x28fe46['waiting']===0x0&&(_0x28fe46['pTalking']||0x0)===0x0){_0x28fe46[_0x71ff('0xa4')]=![];_0x28fe46[_0x71ff('0x51')]=0x0;_0x28fe46[_0x71ff('0x40')]=_0x71ff('0x43');loggerSyncQueueSummary[_0x71ff('0x98')](_0x71ff('0xa5'),_0x28fe46[_0x71ff('0x41')],_0x71ff('0xa6'));}else{_0x28fe46['message']=_0x71ff('0xa7');loggerSyncQueueSummary[_0x71ff('0x98')](_0x71ff('0xa5'),_0x28fe46[_0x71ff('0x41')],'is\x20disactive');}emitVoiceQueueSummary(_0x28fe46);}}function notSendMessagesCampaign(_0x24a7e1){if(_0x24a7e1['sendMessageOneNotActive']){if(_0x24a7e1[_0x71ff('0x9b')]===0x0){_0x24a7e1[_0x71ff('0xa4')]=![];_0x24a7e1[_0x71ff('0x40')]=_0x71ff('0x43');loggerSyncQueueSummary[_0x71ff('0x98')](_0x71ff('0xa8'),_0x24a7e1['name'],_0x71ff('0xa6'));}else{_0x24a7e1[_0x71ff('0x40')]=_0x71ff('0xa7');loggerSyncQueueSummary['error'](_0x71ff('0xa8'),_0x24a7e1[_0x71ff('0x41')],_0x71ff('0xa9'));}emitCampaignSummary(_0x24a7e1);}}function createObjHistory(_0x18b536,_0x5a4a4c,_0x41cc53,_0x3da999,_0x1de62a){_0x18b536[_0x71ff('0x40')]=_0x41cc53;var _0x3a55c0=new Action(_0x18b536,_0x5a4a4c);var _0xe5a387=new History(_0x3a55c0);_0xe5a387[_0x71ff('0xaa')]=_0x3da999;_0xe5a387[_0x71ff('0xab')]=_0x1de62a;_0xe5a387[_0x71ff('0xac')]=_0x3a55c0['starttime'];return _0xe5a387;}Dialer[_0x71ff('0x1d')][_0x71ff('0x3e')]=function(){var _0x53bcfb=this;setInterval(function(){_0x53bcfb[_0x71ff('0xad')](_0x53bcfb[_0x71ff('0xae')],_0x71ff('0xaf'));_0x53bcfb[_0x71ff('0xad')](_0x53bcfb[_0x71ff('0xb0')],'[actions]');},0x32c8);};Dialer[_0x71ff('0x1d')][_0x71ff('0xad')]=function(_0x45435c,_0x34c144){var _0x3c6b5e=this;for(var _0x8d11b0 in _0x45435c){if(typeof _0x45435c[_0x8d11b0]!==_0x71ff('0x9c')){this['sequence'][_0x71ff('0xb1')](function(){if(!_[_0x71ff('0xb2')](_0x45435c[_0x8d11b0])){return ami[_0x71ff('0xb3')]({'action':'status','channel':_0x45435c[_0x8d11b0][_0x71ff('0xb4')]})[_0x71ff('0xb5')](function(_0x34f8d4){if(_0x34f8d4[_0x71ff('0x40')]===_0x71ff('0xb6')){setTimeout(function(){if(_0x45435c[_0x8d11b0]&&_0x45435c[_0x8d11b0][_0x71ff('0x4d')]!==_0x71ff('0x7f')){_0x3c6b5e[_0x71ff('0xb7')](_0x3c6b5e[_0x71ff('0x21')][_0x45435c[_0x8d11b0][_0x71ff('0xb8')]]);logger[_0x71ff('0x98')](_0x71ff('0xb9'),_0x34c144,_0x8d11b0,_0x45435c[_0x8d11b0][_0x71ff('0xb8')]);delete _0x45435c[_0x8d11b0];}if(_0x45435c[_0x8d11b0]&&_0x45435c[_0x8d11b0]['type']===_0x71ff('0x7f')){_0x3c6b5e[_0x71ff('0xb7')](_0x3c6b5e['campaigns'][_0x45435c[_0x8d11b0]['queue']]);logger[_0x71ff('0x98')](_0x71ff('0xba'),_0x34c144,_0x8d11b0,_0x45435c[_0x8d11b0][_0x71ff('0xb8')]);delete _0x45435c[_0x8d11b0];}},0x2328);}});}});}}};Dialer[_0x71ff('0x1d')][_0x71ff('0xbb')]=function(_0x11e2f7){return BPromise[_0x71ff('0xbc')]()[_0x71ff('0xbd')](cmHopper['countReScheduled'](_0x11e2f7))[_0x71ff('0xb5')](loggerCatch('[countReScheduled]\x20'));};Dialer['prototype'][_0x71ff('0xbe')]=function(_0x18850){return BPromise[_0x71ff('0xbc')]()[_0x71ff('0xbd')](cmHopperBlack[_0x71ff('0xbe')](_0x18850))['catch'](loggerCatch(_0x71ff('0xbf')));};Dialer[_0x71ff('0x1d')]['checkIsBlackListIvr']=function(_0x4a300c){return BPromise[_0x71ff('0xbc')]()[_0x71ff('0xbd')](cmHopperBlack[_0x71ff('0xc0')](_0x4a300c))[_0x71ff('0xb5')](loggerCatch(_0x71ff('0xc1')));};Dialer[_0x71ff('0x1d')][_0x71ff('0xc2')]=function(_0x15d8a6){return BPromise[_0x71ff('0xbc')]()['then'](cmHopperHistory[_0x71ff('0xc3')](_0x15d8a6))[_0x71ff('0xb5')](loggerCatch(_0x71ff('0xc4')));};Dialer['prototype']['rescheduleContact']=function(_0x2e5667){return BPromise[_0x71ff('0xbc')]()[_0x71ff('0xbd')](cmHopper[_0x71ff('0xc5')](_0x2e5667))['catch'](loggerCatch(_0x71ff('0xc6')));};Dialer[_0x71ff('0x1d')][_0x71ff('0xc7')]=function(_0x247c29,_0x386bc2,_0x2618c3){return BPromise[_0x71ff('0xbc')]()[_0x71ff('0xbd')](cmHopper[_0x71ff('0xc7')](_0x247c29,_0x386bc2,_0x2618c3))[_0x71ff('0xb5')](loggerCatch(_0x71ff('0xc8')));};Dialer[_0x71ff('0x1d')][_0x71ff('0xc9')]=function(_0x4e2b8a,_0x447040,_0x5ddbfa,_0x41e93e,_0x10c830){return BPromise[_0x71ff('0xbc')]()[_0x71ff('0xbd')](cmHopper[_0x71ff('0xc9')](_0x4e2b8a,_0x447040,_0x5ddbfa,_0x41e93e))[_0x71ff('0xb5')](function(_0x5f555e){_0x10c830[_0x71ff('0xca')]-=_0x5ddbfa;_0x10c830[_0x71ff('0xca')]=_0x10c830[_0x71ff('0xca')]>0x0?_0x10c830['temp']:0x0;loggerCatch(_0x71ff('0xcb'))(_0x5f555e);});};Dialer[_0x71ff('0x1d')][_0x71ff('0xcc')]=function(_0x204d59,_0x1af2eb,_0x54b292,_0x181520){return BPromise['resolve']()[_0x71ff('0xbd')](cmHopper[_0x71ff('0xcc')](_0x204d59,_0x1af2eb,_0x54b292))[_0x71ff('0xb5')](function(_0x3e5959){_0x181520[_0x71ff('0xca')]-=_0x1af2eb;_0x181520['temp']=_0x181520['temp']>0x0?_0x181520[_0x71ff('0xca')]:0x0;loggerCatch(_0x71ff('0xcd'))(_0x3e5959);});};Dialer[_0x71ff('0x1d')]['getVoiceQueueRtPauses']=function(_0x15a603){return BPromise[_0x71ff('0xbc')]()[_0x71ff('0xbd')](voiceQueueRt[_0x71ff('0xce')](_0x15a603))['catch'](loggerCatch(_0x71ff('0xcf')));};Dialer[_0x71ff('0x1d')][_0x71ff('0xd0')]=function(_0x36e7ea){return BPromise[_0x71ff('0xbc')]()[_0x71ff('0xbd')](cmHopper[_0x71ff('0xd0')](_0x36e7ea))[_0x71ff('0xb5')](loggerCatch(_0x71ff('0xd1')));};Dialer[_0x71ff('0x1d')]['createHistory']=function(_0x12a9ba){return BPromise[_0x71ff('0xbc')]()[_0x71ff('0xbd')](cmHopperHistory[_0x71ff('0xd2')](_0x12a9ba))[_0x71ff('0xb5')](loggerCatch('[createHistory]\x20'));};Dialer[_0x71ff('0x1d')][_0x71ff('0xb7')]=function(_0x5aad29){if(!_['isUndefined'](_0x5aad29)&&_0x5aad29!==null){if(typeof _0x5aad29[_0x71ff('0x9b')]!==_0x71ff('0x9c')){if(_0x5aad29['originated']>0x0){_0x5aad29[_0x71ff('0x9b')]-=0x1;}else{logger['error'](_0x71ff('0xd3'));}}}else{logger[_0x71ff('0x98')](_0x71ff('0xd4'));}};Dialer[_0x71ff('0x1d')][_0x71ff('0xd5')]=function(_0x2170fc,_0x394cb9){var _0x47f435=this;return function(_0x574ddc){_0x47f435['updateOriginated'](_0x394cb9);logger[_0x71ff('0x98')](_0x2170fc,util['inspect'](_0x574ddc,{'showHidden':![],'depth':null}));};};Dialer[_0x71ff('0x1d')][_0x71ff('0xd6')]=function(_0x453c85,_0x113488,_0x1ff4bd){var _0x420a25={'state':0x19,'statedesc':_0x71ff('0xd7')};this[_0x71ff('0xb7')](_0x113488);this[_0x71ff('0xd8')](_[_0x71ff('0x90')](_0x420a25,_[_0x71ff('0xd9')](_0x1ff4bd,[_0x71ff('0xda'),_0x71ff('0xdb'),_0x71ff('0xdc'),_0x71ff('0xdd'),_0x71ff('0xde')])),_0x71ff('0xdf'),_0x71ff('0xe0'));logger[_0x71ff('0x98')](_0x453c85);};Dialer[_0x71ff('0x1d')]['isSuccess']=function(_0x24e206){return _0x24e206==='Success';};Dialer['prototype'][_0x71ff('0xe1')]=function(_0x4e17fd){return!_[_0x71ff('0x3f')](_0x4e17fd)&&_0x4e17fd&&!_[_0x71ff('0x3f')](_0x4e17fd[_0x71ff('0x41')])&&!_[_0x71ff('0x3f')](_0x4e17fd[_0x71ff('0x79')])&&_0x4e17fd[_0x71ff('0x79')]&&(this['trunks'][util[_0x71ff('0x7c')](_0x71ff('0xe2'),_0x4e17fd[_0x71ff('0x41')])][_0x71ff('0xe3')]===_0x71ff('0xe4')||this[_0x71ff('0xe5')][util[_0x71ff('0x7c')](_0x71ff('0xe2'),_0x4e17fd[_0x71ff('0x41')])]['status']===_0x71ff('0xe6'));};Dialer['prototype'][_0x71ff('0xd8')]=function(_0x34ac27,_0x2839d1,_0x1a406b){this[_0x71ff('0xd2')](_0x34ac27)[_0x71ff('0xb5')](loggerCatch(_0x2839d1));this[_0x71ff('0xd0')](_0x34ac27)[_0x71ff('0xb5')](loggerCatch(_0x1a406b));};Dialer['prototype']['syncVarSet']=function(_0x872d96){var _0x39cbf8=this[_0x71ff('0xae')][_0x872d96[_0x71ff('0xe7')]];var _0x23f57b;if(!_['isNil'](_0x872d96)&&!_[_0x71ff('0xb2')](_0x872d96['variable'])&&!_['isNil'](_0x872d96[_0x71ff('0xe8')][_0x71ff('0xe9')])&&_0x872d96[_0x71ff('0xea')]===_0x71ff('0xeb')&&_0x39cbf8){if(_0x39cbf8['type']!==_0x71ff('0x7f')&&this[_0x71ff('0x21')][_0x39cbf8['queue']]['dialAMDActive']&&_0x872d96[_0x71ff('0xec')]==='HANGUP'){delete this[_0x71ff('0xae')][_0x872d96[_0x71ff('0xe7')]];this[_0x71ff('0xb7')](this['voiceQueues'][_0x39cbf8[_0x71ff('0xb8')]]);this[_0x71ff('0x21')][_0x39cbf8[_0x71ff('0xb8')]][_0x71ff('0x5d')]+=0x1;this[_0x71ff('0x21')][_0x39cbf8[_0x71ff('0xb8')]]['outboundAnswerAgiCallsDay']+=0x1;_0x23f57b=new Hangup(_0x39cbf8,_0x872d96);_0x23f57b[_0x71ff('0xaa')]=0x12;_0x23f57b[_0x71ff('0xab')]='HangupInAMD';_0x23f57b[_0x71ff('0xed')]=_0x71ff('0xee');ami[_0x71ff('0xef')](_0x71ff('0xf0'),ut[_0x71ff('0xf1')](_0x23f57b,_0x71ff('0xf2')));this['saveInDb'](_0x23f57b,_0x71ff('0xf3'),_0x71ff('0xf4'));}if(_0x39cbf8[_0x71ff('0x4d')]!=='ivr'&&this[_0x71ff('0x21')][_0x39cbf8[_0x71ff('0xb8')]][_0x71ff('0xf5')]&&_0x872d96[_0x71ff('0xec')]===_0x71ff('0xf6')){var _0x14453d=this;return new BPromise(function(_0x2c0a58,_0x485e8b){delete _0x14453d['uniqueId'][_0x872d96[_0x71ff('0xe7')]];_0x14453d[_0x71ff('0xb7')](_0x14453d[_0x71ff('0x21')][_0x39cbf8[_0x71ff('0xb8')]]);_0x14453d[_0x71ff('0x21')][_0x39cbf8[_0x71ff('0xb8')]][_0x71ff('0x5d')]+=0x1;_0x14453d[_0x71ff('0x21')][_0x39cbf8[_0x71ff('0xb8')]][_0x71ff('0xf7')]+=0x1;var _0x3799d4=_0x14453d[_0x71ff('0x21')][_0x39cbf8[_0x71ff('0xb8')]];var _0x41df69=new Hangup(_0x39cbf8,_0x872d96);_0x41df69[_0x71ff('0xaa')]=0x13;_0x41df69[_0x71ff('0xab')]=_0x71ff('0xf8');_0x41df69['membername']='AMD';_0x41df69[_0x71ff('0xf9')]+=0x1;_0x41df69[_0x71ff('0xfa')]+=0x1;_0x41df69['amd']=!![];ami[_0x71ff('0xef')](_0x71ff('0xf0'),ut[_0x71ff('0xf1')](_0x41df69,'amd'));_0x14453d[_0x71ff('0xd2')](_0x41df69)[_0x71ff('0xb5')](loggerCatch(_0x71ff('0xfb')));if(_0x41df69[_0x71ff('0xfc')]+_0x41df69[_0x71ff('0xfd')]+_0x41df69[_0x71ff('0xfe')]+_0x41df69[_0x71ff('0xff')]+_0x41df69['countdropretry']+_0x41df69[_0x71ff('0x100')]+_0x41df69[_0x71ff('0xf9')]+_0x41df69[_0x71ff('0x101')]>=_0x3799d4[_0x71ff('0x102')]){_0x14453d[_0x71ff('0x103')](_0x41df69,_0x2c0a58,_0x485e8b,_0x71ff('0x104'));}else{if(_0x41df69[_0x71ff('0xf9')]>=_0x3799d4[_0x71ff('0x105')]){_0x14453d[_0x71ff('0x106')](_0x41df69,_0x2c0a58,_0x485e8b,'reason\x2019\x20machine....');}else{_0x14453d['rescheduleContact']({'active':![],'countmachineretry':_0x41df69[_0x71ff('0xf9')],'scheduledat':moment()[_0x71ff('0x107')](_0x3799d4['dialMachineRetryFrequency'],'minutes')['format'](_0x71ff('0x108')),'ContactId':_0x41df69[_0x71ff('0xda')],'ListId':_0x41df69['ListId'],'VoiceQueueId':_0x41df69[_0x71ff('0xdd')]||undefined,'CampaignId':_0x41df69[_0x71ff('0xde')]||undefined})[_0x71ff('0xb5')](loggerCatch(_0x71ff('0x109')));_0x2c0a58({'reschedule':0x1});}}});}if(_0x39cbf8[_0x71ff('0x4d')]===_0x71ff('0x7f')&&this[_0x71ff('0x22')][_0x39cbf8[_0x71ff('0xb8')]]['dialAMDActive']&&_0x872d96[_0x71ff('0xec')]===_0x71ff('0x10a')){delete this[_0x71ff('0xae')][_0x872d96[_0x71ff('0xe7')]];this[_0x71ff('0xb7')](this['campaigns'][_0x39cbf8['queue']]);_0x23f57b=new Hangup(_0x39cbf8,_0x872d96);_0x23f57b[_0x71ff('0xaa')]=0x12;_0x23f57b['statedesc']='HangupInAMD';_0x23f57b[_0x71ff('0xed')]=_0x71ff('0xee');ami[_0x71ff('0xef')](_0x71ff('0xf0'),ut['buildObj'](_0x23f57b,_0x71ff('0xf2')));this[_0x71ff('0xd8')](_0x23f57b,_0x71ff('0x10b'),'[syncHangupInAMDIvr]');}if(_0x39cbf8[_0x71ff('0x4d')]===_0x71ff('0x7f')&&this[_0x71ff('0x22')][_0x39cbf8[_0x71ff('0xb8')]][_0x71ff('0xf5')]&&_0x872d96[_0x71ff('0xec')]===_0x71ff('0xf6')){var _0x14453d=this;return new BPromise(function(_0x2a15b0,_0x26a09f){delete _0x14453d[_0x71ff('0xae')][_0x872d96[_0x71ff('0xe7')]];_0x14453d[_0x71ff('0xb7')](_0x14453d[_0x71ff('0x22')][_0x39cbf8[_0x71ff('0xb8')]]);_0x14453d[_0x71ff('0x22')][_0x39cbf8[_0x71ff('0xb8')]][_0x71ff('0x5d')]+=0x1;_0x14453d[_0x71ff('0x22')][_0x39cbf8[_0x71ff('0xb8')]][_0x71ff('0xf7')]+=0x1;var _0x2bb749=_0x14453d[_0x71ff('0x22')][_0x39cbf8[_0x71ff('0xb8')]];var _0x43980c=new Hangup(_0x39cbf8,_0x872d96);_0x43980c['state']=0x13;_0x43980c[_0x71ff('0xab')]=_0x71ff('0xf8');_0x43980c[_0x71ff('0xed')]='AMD';_0x43980c[_0x71ff('0xf9')]+=0x1;_0x43980c[_0x71ff('0xfa')]+=0x1;_0x43980c['amd']=!![];ami[_0x71ff('0xef')]('custom:amd',ut[_0x71ff('0xf1')](_0x43980c,'amd'));_0x14453d[_0x71ff('0xd2')](_0x43980c)[_0x71ff('0xb5')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x43980c[_0x71ff('0xfc')]+_0x43980c['countcongestionretry']+_0x43980c[_0x71ff('0xfe')]+_0x43980c['countnosuchnumberretry']+_0x43980c['countdropretry']+_0x43980c[_0x71ff('0x100')]+_0x43980c[_0x71ff('0xf9')]+_0x43980c[_0x71ff('0x101')]>=_0x2bb749['dialGlobalMaxRetry']){_0x14453d['stateGlobal'](_0x43980c,_0x2a15b0,_0x26a09f,'reason19\x20machine....');}else{if(_0x43980c['countmachineretry']>=_0x2bb749[_0x71ff('0x105')]){_0x14453d['createStateFinal'](_0x43980c,_0x2a15b0,_0x26a09f,'reason\x2019\x20machine....');}else{_0x14453d[_0x71ff('0xc5')]({'active':![],'countmachineretry':_0x43980c[_0x71ff('0xf9')],'scheduledat':moment()[_0x71ff('0x107')](_0x2bb749[_0x71ff('0x10c')],_0x71ff('0x10d'))['format'](_0x71ff('0x108')),'ContactId':_0x43980c['ContactId'],'ListId':_0x43980c[_0x71ff('0xdb')],'VoiceQueueId':_0x43980c[_0x71ff('0xdd')]||undefined,'CampaignId':_0x43980c[_0x71ff('0xde')]||undefined})[_0x71ff('0xb5')](loggerCatch(_0x71ff('0x109')));_0x2a15b0({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x71ff('0x36')]=function(_0x5389b2){var _0x59f054=this[_0x71ff('0xae')][_0x5389b2['uniqueid']];var _0x37f489=this;var _0x31e624;if(_0x59f054&&_0x59f054[_0x71ff('0x4d')]===_0x71ff('0x7f')){delete this[_0x71ff('0xae')][_0x5389b2['uniqueid']];this[_0x71ff('0xb7')](this[_0x71ff('0x22')][_0x59f054[_0x71ff('0xb8')]]);this['campaigns'][_0x59f054[_0x71ff('0xb8')]][_0x71ff('0x10e')]+=0x1;_0x31e624=new Hangup(_0x59f054,_0x5389b2);this[_0x71ff('0xd2')](_0x31e624)[_0x71ff('0xb5')](loggerCatch(_0x71ff('0x10f')));this[_0x71ff('0xd0')](_0x31e624)[_0x71ff('0xb5')](loggerCatch(_0x71ff('0x110')));}if(_0x59f054&&_0x59f054[_0x71ff('0x4d')]!==_0x71ff('0x7f')&&isNotNull(this[_0x71ff('0x21')][_0x59f054[_0x71ff('0xb8')]]['dialQueueProject'])){delete this['uniqueId'][_0x5389b2[_0x71ff('0xe7')]];this[_0x71ff('0xb7')](this[_0x71ff('0x21')][_0x59f054[_0x71ff('0xb8')]]);this['voiceQueues'][_0x59f054[_0x71ff('0xb8')]]['outboundAnswerCallsDay']+=0x1;this[_0x71ff('0x21')][_0x59f054[_0x71ff('0xb8')]][_0x71ff('0xf7')]+=0x1;_0x31e624=new Hangup(_0x59f054,_0x5389b2);_0x31e624[_0x71ff('0xaa')]=0x10;_0x31e624['statedesc']=_0x71ff('0x111');_0x31e624['membername']=_0x71ff('0x112');this[_0x71ff('0xd2')](_0x31e624)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x31e624)[_0x71ff('0xb5')](loggerCatch(_0x71ff('0x110')));}if(_0x59f054&&_0x59f054[_0x71ff('0x4d')]!=='ivr'&&!isNotNull(this['voiceQueues'][_0x59f054[_0x71ff('0xb8')]]['dialQueueProject'])){delete this[_0x71ff('0xae')][_0x5389b2[_0x71ff('0xe7')]];this['updateOriginated'](this[_0x71ff('0x21')][_0x59f054[_0x71ff('0xb8')]]);this['voiceQueues'][_0x59f054[_0x71ff('0xb8')]][_0x71ff('0x67')]+=0x1;_0x31e624=new Hangup(_0x59f054,_0x5389b2);_0x31e624[_0x71ff('0xaa')]=0xc;_0x31e624[_0x71ff('0xab')]=_0x5389b2[_0x71ff('0x113')];_0x31e624[_0x71ff('0xed')]=_0x71ff('0x114');this[_0x71ff('0xd2')](_0x31e624)[_0x71ff('0xb5')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x71ff('0xd0')](_0x31e624)[_0x71ff('0xb5')](loggerCatch(_0x71ff('0x110')));}};Dialer[_0x71ff('0x1d')][_0x71ff('0x33')]=function(_0x54767a){var _0x16cbf3=this[_0x71ff('0xae')][_0x54767a[_0x71ff('0xe7')]];var _0x46160f=this;if(this[_0x71ff('0x21')][_0x54767a[_0x71ff('0xb8')]]){if(_0x16cbf3&&_0x16cbf3['type']!=='ivr'){delete this[_0x71ff('0xae')][_0x54767a[_0x71ff('0xe7')]];this['voiceQueues'][_0x54767a[_0x71ff('0xb8')]][_0x71ff('0x5d')]+=0x1;var _0x2c7219=new AgentComplete(_0x16cbf3,_0x54767a);if(_0x54767a['reason']==='agent'){_0x2c7219['agiafterat']=this[_0x71ff('0x21')][_0x54767a[_0x71ff('0xb8')]][_0x71ff('0x115')]&&this['voiceQueues'][_0x54767a[_0x71ff('0xb8')]][_0x71ff('0x116')]?moment()[_0x71ff('0x7c')](_0x71ff('0x108')):undefined;}this[_0x71ff('0xd2')](_0x2c7219)[_0x71ff('0xb5')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x71ff('0xd0')](_0x2c7219)[_0x71ff('0xb5')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x71ff('0x1d')][_0x71ff('0x2d')]=function(_0x48aa37){if(this['voiceQueues'][_0x48aa37[_0x71ff('0xb8')]]){if(this[_0x71ff('0xae')][_0x48aa37['uniqueid']]&&this[_0x71ff('0xae')][_0x48aa37[_0x71ff('0xe7')]]['type']!==_0x71ff('0x7f')){this[_0x71ff('0xb7')](this[_0x71ff('0x21')][_0x48aa37['queue']]);this[_0x71ff('0xae')][_0x48aa37['uniqueid']][_0x71ff('0x117')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x71ff('0x1d')]['queueCallerAbandonCreateState']=function(_0x298285){this[_0x71ff('0xd2')](_0x298285)['catch'](loggerCatch(_0x71ff('0x118')));this[_0x71ff('0xd0')](_0x298285)[_0x71ff('0xb5')](loggerCatch(_0x71ff('0x119')));};Dialer[_0x71ff('0x1d')][_0x71ff('0x11a')]=function(_0x6bd505){var _0x20ff39=this[_0x71ff('0xae')][_0x6bd505['uniqueid']];var _0x359b30=this;if(this[_0x71ff('0x21')][_0x6bd505['queue']]){if(_0x20ff39&&_0x20ff39[_0x71ff('0x4d')]!==_0x71ff('0x7f')){delete this[_0x71ff('0xae')][_0x6bd505[_0x71ff('0xe7')]];this[_0x71ff('0xb7')](this['voiceQueues'][_0x6bd505['queue']]);_0x20ff39[_0x71ff('0x11b')]=moment()[_0x71ff('0x7c')](_0x71ff('0x108'));var _0x2ee7b5=new QueueCallerAbandon(_0x20ff39,_0x6bd505);if(getSeconds(_0x20ff39[_0x71ff('0x11b')],_0x20ff39[_0x71ff('0x11c')])>=_0x20ff39[_0x71ff('0x11d')]){this['voiceQueues'][_0x6bd505[_0x71ff('0xb8')]][_0x71ff('0x6c')]+=0x1;this[_0x71ff('0x21')][_0x6bd505[_0x71ff('0xb8')]][_0x71ff('0x62')]+=0x1;this[_0x71ff('0x21')][_0x6bd505[_0x71ff('0xb8')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x2ee7b5[_0x71ff('0xaa')]=0xa;_0x2ee7b5[_0x71ff('0xab')]=_0x71ff('0x11e');_0x2ee7b5['dropreason']=_0x71ff('0x11f');_0x2ee7b5['agiafterat']=this[_0x71ff('0x21')][_0x6bd505[_0x71ff('0xb8')]]['dialQueueProject2']?moment()[_0x71ff('0x7c')](_0x71ff('0x108')):undefined;_0x2ee7b5[_0x71ff('0x120')]+=0x1;_0x2ee7b5[_0x71ff('0xfa')]+=0x1;if(_0x2ee7b5['countdropretry']>=this[_0x71ff('0x21')][_0x6bd505['queue']][_0x71ff('0x121')]){this[_0x71ff('0x122')](_0x2ee7b5);}else{this[_0x71ff('0xc5')]({'active':![],'countdropretry':_0x2ee7b5[_0x71ff('0x120')],'scheduledat':moment()[_0x71ff('0x107')](this[_0x71ff('0x21')][_0x6bd505[_0x71ff('0xb8')]][_0x71ff('0x123')],_0x71ff('0x10d'))[_0x71ff('0x7c')](_0x71ff('0x108')),'ContactId':_0x20ff39['ContactId'],'ListId':_0x20ff39[_0x71ff('0xdb')],'VoiceQueueId':_0x20ff39['VoiceQueueId']||undefined,'CampaignId':_0x20ff39['CampaignId']||undefined})[_0x71ff('0xb5')](loggerCatch(_0x71ff('0x124')));var _0x5be217=new History(_0x2ee7b5);_0x5be217[_0x71ff('0xaa')]=0xa;_0x5be217[_0x71ff('0xab')]='Drop';_0x5be217[_0x71ff('0x125')]=moment()[_0x71ff('0x7c')](_0x71ff('0x108'));_0x5be217[_0x71ff('0xac')]=_0x5be217[_0x71ff('0x125')];_0x5be217[_0x71ff('0x126')]=_0x2ee7b5['calleridname'];_0x5be217[_0x71ff('0x127')]=_0x2ee7b5[_0x71ff('0x127')];this[_0x71ff('0xd2')](_0x5be217)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0x71ff('0x21')][_0x6bd505[_0x71ff('0xb8')]][_0x71ff('0x6b')]+=0x1;this[_0x71ff('0x21')][_0x6bd505[_0x71ff('0xb8')]][_0x71ff('0x61')]+=0x1;_0x2ee7b5['state']=0xb;_0x2ee7b5['statedesc']=_0x71ff('0x128');_0x2ee7b5[_0x71ff('0x129')]=_0x71ff('0x12a');_0x2ee7b5[_0x71ff('0x100')]+=0x1;_0x2ee7b5['countglobal']+=0x1;if(_0x2ee7b5[_0x71ff('0x100')]>=this['voiceQueues'][_0x6bd505[_0x71ff('0xb8')]][_0x71ff('0x12b')]){this[_0x71ff('0x122')](_0x2ee7b5);}else{this[_0x71ff('0xc5')]({'active':![],'countabandonedretry':_0x2ee7b5['countabandonedretry'],'scheduledat':moment()[_0x71ff('0x107')](this['voiceQueues'][_0x6bd505[_0x71ff('0xb8')]][_0x71ff('0x12c')],_0x71ff('0x10d'))[_0x71ff('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x20ff39[_0x71ff('0xda')],'ListId':_0x20ff39[_0x71ff('0xdb')],'VoiceQueueId':_0x20ff39[_0x71ff('0xdd')]||undefined,'CampaignId':_0x20ff39['CampaignId']||undefined})[_0x71ff('0xb5')](loggerCatch(_0x71ff('0x12d')));var _0x5be217=new History(_0x2ee7b5);_0x5be217[_0x71ff('0xaa')]=0xb;_0x5be217[_0x71ff('0xab')]=_0x71ff('0x128');_0x5be217[_0x71ff('0x125')]=moment()[_0x71ff('0x7c')](_0x71ff('0x108'));_0x5be217[_0x71ff('0xac')]=_0x5be217[_0x71ff('0x125')];_0x5be217[_0x71ff('0x126')]=_0x2ee7b5[_0x71ff('0x126')];_0x5be217['calleridnum']=_0x2ee7b5[_0x71ff('0x127')];this[_0x71ff('0xd2')](_0x5be217)[_0x71ff('0xb5')](loggerCatch(_0x71ff('0x12e')));}}}}};Dialer[_0x71ff('0x1d')][_0x71ff('0x38')]=function(_0x38e10b){if(this[_0x71ff('0xb0')][_0x38e10b['uniqueid']]){this['actions'][_0x38e10b[_0x71ff('0xe7')]]['channel']=_0x38e10b['channel'];}if(this[_0x71ff('0xae')][_0x38e10b[_0x71ff('0xe7')]]){this[_0x71ff('0xae')][_0x38e10b[_0x71ff('0xe7')]][_0x71ff('0xb4')]=_0x38e10b[_0x71ff('0xb4')];}};Dialer['prototype'][_0x71ff('0x12f')]=function(_0xbaf317){if(strategy[this[_0x71ff('0x21')][this[_0x71ff('0xb0')][_0xbaf317['actionid']][_0x71ff('0xb8')]][_0x71ff('0x4f')]]===_0x71ff('0x1c')){if(this[_0x71ff('0xb0')][_0xbaf317[_0x71ff('0x130')]]&&_['isNil'](this[_0x71ff('0xb0')][_0xbaf317[_0x71ff('0x130')]][_0x71ff('0x131')])&&_0xbaf317[_0x71ff('0xe3')]==='1'&&_0xbaf317[_0x71ff('0x132')]==='0'){if(this[_0x71ff('0x23')][_0xbaf317[_0x71ff('0x133')]]){if(!this[_0x71ff('0x23')][_0xbaf317['stateinterface']][_0x71ff('0x131')]){this[_0x71ff('0x23')][_0xbaf317['stateinterface']]['locked']=!![];this[_0x71ff('0xb0')][_0xbaf317[_0x71ff('0x130')]][_0x71ff('0x131')]=!![];this['actions'][_0xbaf317[_0x71ff('0x130')]][_0x71ff('0x133')]=_0xbaf317[_0x71ff('0x133')];}}}}else if((strategy[this['voiceQueues'][this[_0x71ff('0xb0')][_0xbaf317[_0x71ff('0x130')]][_0x71ff('0xb8')]][_0x71ff('0x4f')]]||_0x71ff('0x1b'))===_0x71ff('0x1b')){if(this[_0x71ff('0xb0')][_0xbaf317[_0x71ff('0x130')]]){if(this[_0x71ff('0x23')][_0xbaf317[_0x71ff('0x133')]]){this['actions'][_0xbaf317[_0x71ff('0x130')]]['stateinterface']=_0xbaf317[_0x71ff('0x133')];if(_[_0x71ff('0xb2')](this[_0x71ff('0x2a')][this[_0x71ff('0xb0')][_0xbaf317[_0x71ff('0x130')]][_0x71ff('0xb8')]])){this['queueBooked'][this[_0x71ff('0xb0')][_0xbaf317[_0x71ff('0x130')]][_0x71ff('0xb8')]]=[];}this[_0x71ff('0x2a')][this[_0x71ff('0xb0')][_0xbaf317[_0x71ff('0x130')]][_0x71ff('0xb8')]][_0x71ff('0x134')](_[_0x71ff('0x90')](_['pick'](this['actions'][_0xbaf317[_0x71ff('0x130')]],[_0x71ff('0x135'),'stateinterface']),{'status':_0xbaf317[_0x71ff('0xe3')],'paused':_0xbaf317[_0x71ff('0x132')]}));}}}};function unlockQueueStatus(_0x39b81e,_0x26fbc3){setTimeout(function(){if(_[_0x71ff('0x3f')](_0x39b81e[_0x71ff('0x136')])){loggerBooked['error'](_0x71ff('0x137'),_0x26fbc3);}_0x39b81e['queueStatusComplete']=!![];loggerBooked[_0x71ff('0x82')](_0x71ff('0x138'),_0x26fbc3,JSON[_0x71ff('0x7b')](_['pick'](_0x39b81e,[_0x71ff('0x41'),_0x71ff('0x136')])));},0x1f3);}Dialer[_0x71ff('0x1d')][_0x71ff('0x139')]=function(_0x2b5fe9){var _0x4e51c9=this;var _0xed47e7=_0x4e51c9['voiceQueues'][_0x4e51c9[_0x71ff('0xb0')][_0x2b5fe9[_0x71ff('0x130')]][_0x71ff('0xb8')]];if(strategy[this[_0x71ff('0x21')][this[_0x71ff('0xb0')][_0x2b5fe9[_0x71ff('0x130')]]['queue']][_0x71ff('0x4f')]]===_0x71ff('0x1c')){if(this['actions'][_0x2b5fe9[_0x71ff('0x130')]]&&this[_0x71ff('0xb0')][_0x2b5fe9[_0x71ff('0x130')]][_0x71ff('0x133')]){this[_0x71ff('0x20')][_0x71ff('0x13a')](this[_0x71ff('0xb0')][_0x2b5fe9[_0x71ff('0x130')]][_0x71ff('0x135')],this[_0x71ff('0xb0')][_0x2b5fe9['actionid']]['stateinterface'])[_0x71ff('0xb5')](function(_0x421ab3){logger[_0x71ff('0x98')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x71ff('0x99')](_0x421ab3,{'showHidden':![],'depth':null}));})['finally'](function(){_0x4e51c9['updateOriginated'](_0x4e51c9[_0x71ff('0x21')][_0x4e51c9[_0x71ff('0xb0')][_0x2b5fe9[_0x71ff('0x130')]][_0x71ff('0xb8')]]);_0x4e51c9['agents'][_0x4e51c9[_0x71ff('0xb0')][_0x2b5fe9[_0x71ff('0x130')]]['stateinterface']]['locked']=![];delete _0x4e51c9['actions'][_0x2b5fe9['actionid']];unlockQueueStatus(_0xed47e7);});}else{this[_0x71ff('0xb7')](this[_0x71ff('0x21')][this[_0x71ff('0xb0')][_0x2b5fe9[_0x71ff('0x130')]][_0x71ff('0xb8')]]);this[_0x71ff('0xc5')]({'active':![],'ContactId':this[_0x71ff('0xb0')][_0x2b5fe9[_0x71ff('0x130')]]['ContactId'],'ListId':this['actions'][_0x2b5fe9[_0x71ff('0x130')]][_0x71ff('0xdb')],'VoiceQueueId':this[_0x71ff('0xb0')][_0x2b5fe9[_0x71ff('0x130')]][_0x71ff('0xdd')]||undefined,'CampaignId':this['actions'][_0x2b5fe9[_0x71ff('0x130')]][_0x71ff('0xde')]||undefined})[_0x71ff('0xb5')](loggerCatch(_0x71ff('0x13b')));delete this[_0x71ff('0xb0')][_0x2b5fe9[_0x71ff('0x130')]];unlockQueueStatus(_0xed47e7);}}else if((strategy[this['voiceQueues'][this[_0x71ff('0xb0')][_0x2b5fe9[_0x71ff('0x130')]][_0x71ff('0xb8')]][_0x71ff('0x4f')]]||_0x71ff('0x1b'))===_0x71ff('0x1b')){var _0x12bd0b;if(this[_0x71ff('0xb0')][_0x2b5fe9[_0x71ff('0x130')]]&&!_['isEmpty'](this[_0x71ff('0x2a')][this[_0x71ff('0xb0')][_0x2b5fe9['actionid']][_0x71ff('0xb8')]])){if(this[_0x71ff('0x2b')][_0x4e51c9[_0x71ff('0xb0')][_0x2b5fe9[_0x71ff('0x130')]][_0x71ff('0xb8')]]){this[_0x71ff('0x2b')][_0x4e51c9[_0x71ff('0xb0')][_0x2b5fe9['actionid']][_0x71ff('0xb8')]]=this[_0x71ff('0x2b')][this['actions'][_0x2b5fe9[_0x71ff('0x130')]][_0x71ff('0xb8')]]?this[_0x71ff('0x2b')][this['actions'][_0x2b5fe9[_0x71ff('0x130')]][_0x71ff('0xb8')]]:this[_0x71ff('0x2a')][this[_0x71ff('0xb0')][_0x2b5fe9['actionid']][_0x71ff('0xb8')]]?this['queueBooked'][this[_0x71ff('0xb0')][_0x2b5fe9[_0x71ff('0x130')]][_0x71ff('0xb8')]][_0x71ff('0x13c')]||0x0:0x0;}this[_0x71ff('0x2a')][this[_0x71ff('0xb0')][_0x2b5fe9[_0x71ff('0x130')]][_0x71ff('0xb8')]][_0x71ff('0x13c')]=this[_0x71ff('0x2b')][this[_0x71ff('0xb0')][_0x2b5fe9['actionid']][_0x71ff('0xb8')]];for(var _0x3ddb83=0x0;_0x3ddb83=0x0;})[_0x71ff('0xb5')](myreject(_0x1264d0)));}}else{_0x33fc7f[_0x71ff('0x134')](ami[_0x71ff('0xb3')]({'action':_0x71ff('0x15b'),'command':util[_0x71ff('0x7c')]('iftime\x20%s,%s',_0x38d8c7,!_['isUndefined'](config[_0x71ff('0x157')][_0x160c3a])?_0x160c3a:'')})[_0x71ff('0xbd')](function(_0x187d1f){return _0x187d1f[_0x71ff('0x158')][_0x71ff('0x159')](_0x71ff('0x15a'))>=0x0;})[_0x71ff('0xb5')](myreject(_0x1264d0)));}BPromise[_0x71ff('0x15c')](_0x33fc7f)[_0x71ff('0xbd')](function(_0x419f6c){var _0xedd6f5=_['some'](_0x419f6c);if(_0xedd6f5){return _0x5d0569(_0xedd6f5);}else{_0x51b01f[_0x71ff('0x40')]=_0x1343d7?_0x71ff('0x15d'):_0x71ff('0x15e');return _0x1264d0(msgResponse('[ifTime][promiseAll]',_0x71ff('0x14f'),_0x71ff('0x15f')+_0x1343d7+'\x20'+_0x1dba56+_0x71ff('0x160')+util['inspect'](_0x38d8c7,{'showHidden':![],'depth':null})+_0x71ff('0x161')+_0x160c3a));}})[_0x71ff('0xb5')](function(_0x28d978){return _0x1264d0(msgResponse(_0x71ff('0x14d'),_0x71ff('0x14f'),JSON[_0x71ff('0x7b')](_0x28d978)));});});};Dialer[_0x71ff('0x1d')]['checkDialMethod']=function(_0x2f64c3){var _0x210fff=this;return function(){switch(_0x2f64c3['dialMethod']){case _0x71ff('0x162'):freeVariablesPredictive(_0x2f64c3);_0x210fff[_0x71ff('0x163')](_0x2f64c3,0x1);break;case _0x71ff('0x164'):freeVariablesPredictive(_0x2f64c3);_0x210fff[_0x71ff('0x163')](_0x2f64c3,_0x2f64c3[_0x71ff('0x165')]);break;case'predictive':_0x210fff[_0x71ff('0xa')](_0x2f64c3);break;case _0x71ff('0x9'):freeVariablesPredictive(_0x2f64c3);_0x210fff[_0x71ff('0x163')](_0x2f64c3,0x1);break;default:freeVariablesPredictive(_0x2f64c3);logger[_0x71ff('0x98')](_0x71ff('0x166'),_0x2f64c3[_0x71ff('0x41')],_0x71ff('0x167'));}};};Dialer[_0x71ff('0x1d')][_0x71ff('0x168')]=function(_0x55b1f0){var _0x189bf1=this;return function(){_0x189bf1[_0x71ff('0x169')](_0x55b1f0);};};Dialer['prototype']['syncQueueSummary']=function(_0x2c6735){var _0x377fec=this;if(isNotPreview(_0x2c6735[_0x71ff('0x59')])){if(isVoiceQueueOutbound(_0x2c6735[_0x71ff('0x4d')])&&isActive(_0x2c6735[_0x71ff('0x16a')])){_0x2c6735['sendMessageOneNotActive']=!![];BPromise[_0x71ff('0xbc')]()[_0x71ff('0xbd')](checkIsLoggedIn(_0x2c6735,_0x2c6735[_0x71ff('0x16b')]))[_0x71ff('0xbd')](checkIsActive(_0x2c6735,_0x2c6735[_0x71ff('0x16a')]))[_0x71ff('0xbd')](checkInterval(_0x2c6735))['then'](_0x377fec[_0x71ff('0x16c')](_0x2c6735))[_0x71ff('0xbd')](_0x377fec[_0x71ff('0x14c')](_0x2c6735[_0x71ff('0x16d')],_0x2c6735[_0x71ff('0x16e')],_0x2c6735[_0x71ff('0x41')],_0x2c6735))[_0x71ff('0xbd')](_0x377fec[_0x71ff('0x14e')](_0x2c6735['Interval'],_0x2c6735['dialTimezone'],_0x2c6735['name'],_0x2c6735))[_0x71ff('0xbd')](_0x377fec[_0x71ff('0x16f')](_0x2c6735))[_0x71ff('0xb5')](loggerCatchQueueSummary(_0x71ff('0x170'),_0x2c6735));}else{notSendMessagesQueue(_0x2c6735);}}else{freeVariablesPredictive(_0x2c6735);}};Dialer[_0x71ff('0x1d')]['syncCampaigns']=function(){var _0x4bdb99=this;var _0x16f00f;for(var _0x548f0b in this[_0x71ff('0x22')]){if(typeof this[_0x71ff('0x22')][_0x548f0b]!==_0x71ff('0x9c')){_0x16f00f=this[_0x71ff('0x22')][_0x548f0b];if(isCampaignIvr(_0x16f00f['type'])&&isActive(_0x16f00f[_0x71ff('0x79')])){_0x16f00f[_0x71ff('0xa4')]=!![];BPromise['resolve']()[_0x71ff('0xbd')](checkIsActive(_0x16f00f,_0x16f00f[_0x71ff('0x79')]))['then'](checkInterval(_0x16f00f))[_0x71ff('0xbd')](_0x4bdb99[_0x71ff('0x16c')](_0x16f00f))[_0x71ff('0xbd')](_0x4bdb99[_0x71ff('0x14c')](_0x16f00f[_0x71ff('0x16d')],_0x16f00f[_0x71ff('0x16e')],_0x16f00f[_0x71ff('0x41')],_0x16f00f))[_0x71ff('0xbd')](_0x4bdb99[_0x71ff('0x14e')](_0x16f00f[_0x71ff('0x45')],_0x16f00f[_0x71ff('0x16e')],_0x16f00f[_0x71ff('0x41')],_0x16f00f))['then'](_0x4bdb99[_0x71ff('0x168')](_0x16f00f))['catch'](loggerCatchQueueSummary(_0x71ff('0x171'),_0x16f00f));}else{notSendMessagesCampaign(_0x16f00f);}}}};function getCallerIdRandom(_0x11a520,_0x27a266){var _0x16120c;var _0x3309a7;var _0x3d5eaf;if(_0x27a266<=0x0){_0x27a266=0x1;}_0x16120c=new RegExp(_0x71ff('0x172')+_0x27a266+'}$');_0x3309a7=Math[_0x71ff('0x173')](0xa,_0x27a266-0x1);_0x3d5eaf=Math[_0x71ff('0x173')](0xa,_0x27a266)-0x1;return util[_0x71ff('0x7c')]('%s',_[_0x71ff('0x174')](_0x11a520,_0x16120c,_[_0x71ff('0x175')](_0x3309a7,_0x3d5eaf)));}function extractCalleridName(_0x473b37){var _0x1ef30a=_0x473b37[_0x71ff('0x176')](/"(.*?)"/);return _0x1ef30a?_0x1ef30a[0x1]:_0x473b37;}function extractCalleridNumber(_0x5cf524){var _0x236c58=_0x5cf524[_0x71ff('0x176')](/<(.*?)>/);return _0x236c58?_0x236c58[0x1]:_0x5cf524;}Dialer[_0x71ff('0x1d')][_0x71ff('0x177')]=function(_0x5f316a,_0x1f11f9){var _0x38a007=this;var _0xcc941d=uuid['v4']();this['actions'][_0xcc941d]=new Action(_0x5f316a,_0x1f11f9,_0xcc941d);return new BPromise(function(_0x565568,_0x16fc6c){if(_['isUndefined'](_0x5f316a)&&typeof _0x5f316a!=='object'){return _0x16fc6c(msgResponse('originate',_0x71ff('0x14f'),_0x71ff('0x178')));}if(_[_0x71ff('0x3f')](_0x1f11f9[_0x71ff('0x179')][_0x71ff('0x17a')])||_0x1f11f9['Contact'][_0x71ff('0x17a')]===null){return _0x16fc6c(msgResponse('originate',_0x71ff('0x14f'),_0x71ff('0x17b')));}var _0x463dd2={'XMD-CALLERID':_0x38a007[_0x71ff('0xb0')][_0xcc941d][_0x71ff('0x17c')](),'XMD-AGI':_0x5f316a[_0x71ff('0x17d')]?util['format'](_0x71ff('0x17e'),ipAgi,_0x5f316a[_0x71ff('0x17d')]):_0x71ff('0x17f'),'XMD-AGIAFTER':_0x5f316a[_0x71ff('0x115')]?util[_0x71ff('0x7c')](_0x71ff('0x17e'),ipAgi,_0x5f316a['dialQueueProject2']):_0x71ff('0x17f'),'XMD-QUEUE':_0x5f316a[_0x71ff('0x4d')]===_0x71ff('0x4e')?util[_0x71ff('0x7c')]('\x22%s,%s%s,,,%s\x22',_0x5f316a[_0x71ff('0x41')],_0x5f316a[_0x71ff('0x180')]||'',_0x5f316a['dialAgiAfterHangupAgent']?'c':'',_0x5f316a[_0x71ff('0x11d')]||0x3):_0x71ff('0x17f'),'XMD-CONTACTID':_0x1f11f9[_0x71ff('0xda')],'XMD-CDRTYPE':_0x71ff('0x8'),'CALLERID(all)':_0x38a007['actions'][_0xcc941d][_0x71ff('0x17c')](),'XMD-AMD':_0x5f316a[_0x71ff('0xf5')]?_0x71ff('0x181'):_0x71ff('0x17f'),'XMD-DESTINATION':_0x71ff('0xeb')};if(_0x5f316a[_0x71ff('0xf5')]){_0x463dd2[_0x71ff('0x182')]=_0x5f316a[_0x71ff('0x183')]||0x9c4;_0x463dd2['XMD-AMDGREETING']=_0x5f316a['dialAMDGreeting']||0x5dc;_0x463dd2[_0x71ff('0x184')]=_0x5f316a[_0x71ff('0x185')]||0x320;_0x463dd2[_0x71ff('0x186')]=_0x5f316a['dialAMDTotalAnalysisTime']||0x1388;_0x463dd2[_0x71ff('0x187')]=_0x5f316a['dialAMDMinWordLength']||0x64;_0x463dd2['XMD-AMDBETWEENWORDSSILENCE']=_0x5f316a[_0x71ff('0x188')]||0x32;_0x463dd2[_0x71ff('0x189')]=_0x5f316a[_0x71ff('0x18a')]||0x3;_0x463dd2[_0x71ff('0x18b')]=_0x5f316a[_0x71ff('0x18c')]||0x100;_0x463dd2['XMD-AMDMAXIMUMWORDLENGTH']=_0x5f316a['dialAMDMaximumWordLength']||0x1388;}if(_0x5f316a['type']===_0x71ff('0x4e')){_0x463dd2[_0x71ff('0x18d')]=_0x1f11f9[_0x71ff('0xdd')];}else{_0x463dd2[_0x71ff('0x18e')]=_0x1f11f9[_0x71ff('0xde')];}for(var _0x210f65 in _0x1f11f9[_0x71ff('0x179')]){if(typeof _0x1f11f9[_0x71ff('0x179')][_0x210f65]!==_0x71ff('0x9c')){if(isNotNull(_0x1f11f9[_0x71ff('0x179')][_0x210f65])&&_0x210f65!=='id'&&_0x210f65!==_0x71ff('0x18f')&&_0x210f65!==_0x71ff('0x190')&&_0x210f65!=='updatedAt'){_0x463dd2[util[_0x71ff('0x7c')](_0x71ff('0x191'),_0x71ff('0x192'),_['toUpper'](_0x210f65))]=_0x1f11f9[_0x71ff('0x179')][_0x210f65];}}}var _0x1f1c10=_0x38a007['isTrunkReachable'](_0x5f316a[_0x71ff('0x78')])?getCallerId(_0x5f316a['Trunk']['callerid'],_0x5f316a[_0x71ff('0x5a')],_0x5f316a['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x5f316a[_0x71ff('0x5b')],_0x5f316a[_0x71ff('0x193')]):_0x5f316a['dialOriginateCallerIdNumber']):getCallerId(_[_0x71ff('0xb2')](_0x5f316a['TrunkBackup'])?_0x5f316a[_0x71ff('0x78')][_0x71ff('0x7a')]:_0x5f316a[_0x71ff('0x149')][_0x71ff('0x7a')],_0x5f316a[_0x71ff('0x5a')],_0x5f316a['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x5f316a['dialOriginateCallerIdNumber'],_0x5f316a[_0x71ff('0x193')]):_0x5f316a['dialOriginateCallerIdNumber']);if(_0x1f1c10){_0x463dd2[_0x71ff('0x194')]=_0x38a007['actions'][_0xcc941d][_0x71ff('0x195')]=extractCalleridName(_0x1f1c10);_0x463dd2[_0x71ff('0x196')]=_0x38a007[_0x71ff('0xb0')][_0xcc941d][_0x71ff('0x197')]=extractCalleridNumber(_0x1f1c10);}return ami[_0x71ff('0xb3')]({'actionid':_0xcc941d,'action':_0x71ff('0x198'),'channel':_0x38a007['isTrunkReachable'](_0x5f316a[_0x71ff('0x78')])?util[_0x71ff('0x7c')](_0x71ff('0x199'),_0x5f316a['Trunk'][_0x71ff('0x41')],isNotNull(_0x5f316a['dialPrefix'])?_0x5f316a[_0x71ff('0x19a')]['trim']()||'':'',_0x5f316a[_0x71ff('0x19b')]>0x0?_0x1f11f9[_0x71ff('0x179')][_0x71ff('0x17a')][_0x71ff('0x19c')](_0x5f316a[_0x71ff('0x19b')]):_0x1f11f9['Contact'][_0x71ff('0x17a')]):util['format'](_0x71ff('0x199'),_['isNil'](_0x5f316a['TrunkBackup'])?_0x5f316a['Trunk']['name']:_0x5f316a[_0x71ff('0x149')][_0x71ff('0x41')],isNotNull(_0x5f316a['dialPrefix'])?_0x5f316a[_0x71ff('0x19a')]['trim']()||'':'',_0x5f316a['dialCutDigit']>0x0?_0x1f11f9[_0x71ff('0x179')][_0x71ff('0x17a')]['substring'](_0x5f316a[_0x71ff('0x19b')]):_0x1f11f9[_0x71ff('0x179')][_0x71ff('0x17a')]),'callerid':_0x1f1c10,'Exten':'xcally-motion-dialer','Context':'from-sip','Priority':'1','variable':_0x463dd2,'timeout':(_0x5f316a[_0x71ff('0x5c')]||0x1e)*0x3e8,'async':!![],'channelid':_0xcc941d})[_0x71ff('0xbd')](function(_0x25a2b2){return _0x565568(_0x25a2b2);})['catch'](function(_0x2126bc){_0x5f316a[_0x71ff('0x65')]+=0x1;var _0xbefc90=new History(_0x38a007[_0x71ff('0xb0')][_0xcc941d]);logger['error'](util['format'](_0x71ff('0x19d'),JSON['stringify'](_0x2126bc)));_0xbefc90[_0x71ff('0xaa')]=0xe;_0xbefc90[_0x71ff('0xab')]=_0x71ff('0x19e');_0xbefc90['starttime']=moment()[_0x71ff('0x7c')](_0x71ff('0x108'));_0xbefc90[_0x71ff('0xac')]=_0xbefc90[_0x71ff('0x125')];_0x38a007[_0x71ff('0xd2')](_0xbefc90)['catch'](loggerCatch(_0x71ff('0x19f')));_0x38a007['moveContactManagedDialer'](_0xbefc90)[_0x71ff('0xb5')](loggerCatch(_0x71ff('0x19f')))[_0x71ff('0x142')](function(){delete _0x38a007['actions'][_0xcc941d];return _0x16fc6c(msgResponse(_0x71ff('0x198'),_0x71ff('0x4a'),'originate\x20action\x20Error'));});});});};Dialer[_0x71ff('0x1d')][_0x71ff('0x31')]=function(_0x2cc8e3){var _0x472e33=this[_0x71ff('0xb0')][_0x2cc8e3['actionid']];if(_0x472e33){delete this['actions'][_0x2cc8e3['actionid']];_0x472e33['responsetime']=moment()[_0x71ff('0x7c')](_0x71ff('0x108'));var _0x25cbe3=_0x472e33[_0x71ff('0x4d')]===_0x71ff('0x7f')?this[_0x71ff('0x22')][_0x472e33['queue']]:this[_0x71ff('0x21')][_0x472e33[_0x71ff('0x1a0')]()];if(!this[_0x71ff('0x1a1')](_0x2cc8e3[_0x71ff('0x1a2')])){this[_0x71ff('0xb7')](_0x25cbe3);return this[_0x71ff('0x1a3')](_0x472e33,_0x25cbe3,_0x2cc8e3)['catch'](loggerCatch(_0x71ff('0x1a4')));}this['uniqueId'][_0x2cc8e3[_0x71ff('0xe7')]]=_0x472e33;}};Dialer[_0x71ff('0x1d')]['checkRetriveMax']=function(_0x5a3c61,_0x16d3d8,_0x1da2c7){var _0x16e96e=new History(_0x16d3d8);if(_0x16e96e['countbusyretry']+_0x16e96e[_0x71ff('0xfd')]+_0x16e96e[_0x71ff('0xfe')]+_0x16e96e['countnosuchnumberretry']+_0x16e96e['countdropretry']+_0x16e96e[_0x71ff('0x100')]+_0x16e96e['countmachineretry']+_0x16e96e['countagentrejectretry']>=_0x1da2c7[_0x71ff('0x102')]-0x1){return!![];}switch(_0x5a3c61){case 0x3:if(_0x16e96e[_0x71ff('0xfe')]>=_0x1da2c7[_0x71ff('0x1a5')]-0x1){return!![];}this[_0x71ff('0xc5')]({'active':![],'countnoanswerretry':_0x16e96e['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x71ff('0x107')](_0x1da2c7[_0x71ff('0x1a6')],_0x71ff('0x10d'))[_0x71ff('0x7c')](_0x71ff('0x108')),'ContactId':_0x16e96e['ContactId'],'ListId':_0x16e96e[_0x71ff('0xdb')],'VoiceQueueId':_0x16e96e[_0x71ff('0xdd')]||undefined,'CampaignId':_0x16e96e[_0x71ff('0xde')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x16e96e[_0x71ff('0xfc')]>=_0x1da2c7[_0x71ff('0x1a7')]-0x1){return!![];}this[_0x71ff('0xc5')]({'active':![],'countbusyretry':_0x16e96e[_0x71ff('0xfc')]+=0x1,'scheduledat':moment()[_0x71ff('0x107')](_0x1da2c7[_0x71ff('0x1a8')],_0x71ff('0x10d'))[_0x71ff('0x7c')](_0x71ff('0x108')),'ContactId':_0x16e96e[_0x71ff('0xda')],'ListId':_0x16e96e['ListId'],'VoiceQueueId':_0x16e96e[_0x71ff('0xdd')]||undefined,'CampaignId':_0x16e96e[_0x71ff('0xde')]||undefined})[_0x71ff('0xb5')](loggerCatch(_0x71ff('0x1a9')));break;case 0x8:if(_0x16e96e[_0x71ff('0xfd')]>=_0x1da2c7[_0x71ff('0x1aa')]-0x1){return!![];}this[_0x71ff('0xc5')]({'active':![],'countcongestionretry':_0x16e96e[_0x71ff('0xfd')]+=0x1,'scheduledat':moment()[_0x71ff('0x107')](_0x1da2c7[_0x71ff('0x1ab')],_0x71ff('0x10d'))[_0x71ff('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x16e96e['ContactId'],'ListId':_0x16e96e[_0x71ff('0xdb')],'VoiceQueueId':_0x16e96e[_0x71ff('0xdd')]||undefined,'CampaignId':_0x16e96e['CampaignId']||undefined})[_0x71ff('0xb5')](loggerCatch(_0x71ff('0x1ac')));break;case 0x0:if(_0x16e96e[_0x71ff('0xff')]>=_0x1da2c7[_0x71ff('0x1ad')]-0x1){return!![];}else{this[_0x71ff('0xc5')]({'active':![],'countnosuchnumberretry':_0x16e96e['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x71ff('0x107')](_0x1da2c7[_0x71ff('0x1ae')],_0x71ff('0x10d'))[_0x71ff('0x7c')](_0x71ff('0x108')),'ContactId':_0x16e96e['ContactId'],'ListId':_0x16e96e[_0x71ff('0xdb')],'VoiceQueueId':_0x16e96e[_0x71ff('0xdd')]||undefined,'CampaignId':_0x16e96e[_0x71ff('0xde')]||undefined})[_0x71ff('0xb5')](loggerCatch(_0x71ff('0x1af')));}break;case 0xa:if(_0x16e96e[_0x71ff('0x120')]>=_0x1da2c7[_0x71ff('0x121')]-0x1){return!![];}this[_0x71ff('0xc5')]({'active':![],'countdropretry':_0x16e96e[_0x71ff('0x120')]+=0x1,'scheduledat':moment()['add'](_0x1da2c7[_0x71ff('0x123')],_0x71ff('0x10d'))['format'](_0x71ff('0x108')),'ContactId':_0x16e96e['ContactId'],'ListId':_0x16e96e[_0x71ff('0xdb')],'VoiceQueueId':_0x16e96e['VoiceQueueId']||undefined,'CampaignId':_0x16e96e[_0x71ff('0xde')]||undefined})[_0x71ff('0xb5')](loggerCatch(_0x71ff('0x124')));break;case 0xb:if(_0x16e96e[_0x71ff('0x100')]>=_0x1da2c7[_0x71ff('0x12b')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x16e96e[_0x71ff('0x100')]+=0x1,'scheduledat':moment()[_0x71ff('0x107')](_0x1da2c7[_0x71ff('0x12c')],_0x71ff('0x10d'))[_0x71ff('0x7c')](_0x71ff('0x108')),'ContactId':_0x16e96e[_0x71ff('0xda')],'ListId':_0x16e96e['ListId'],'VoiceQueueId':_0x16e96e[_0x71ff('0xdd')]||undefined,'CampaignId':_0x16e96e[_0x71ff('0xde')]||undefined})[_0x71ff('0xb5')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x16e96e[_0x71ff('0xf9')]>=_0x1da2c7[_0x71ff('0x105')]-0x1){return!![];}this[_0x71ff('0xc5')]({'active':![],'countmachineretry':_0x16e96e[_0x71ff('0xf9')]+=0x1,'scheduledat':moment()[_0x71ff('0x107')](_0x1da2c7[_0x71ff('0x10c')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x16e96e[_0x71ff('0xda')],'ListId':_0x16e96e[_0x71ff('0xdb')],'VoiceQueueId':_0x16e96e[_0x71ff('0xdd')]||undefined,'CampaignId':_0x16e96e[_0x71ff('0xde')]||undefined})[_0x71ff('0xb5')](loggerCatch(_0x71ff('0x109')));break;case 0x14:if(_0x16e96e[_0x71ff('0x101')]>=_0x1da2c7['dialAgentRejectMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x16e96e[_0x71ff('0x101')]+=0x1,'scheduledat':moment()['add'](_0x1da2c7[_0x71ff('0x1b0')],_0x71ff('0x10d'))[_0x71ff('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x16e96e[_0x71ff('0xda')],'ListId':_0x16e96e[_0x71ff('0xdb')],'VoiceQueueId':_0x16e96e[_0x71ff('0xdd')]||undefined,'CampaignId':_0x16e96e[_0x71ff('0xde')]||undefined})[_0x71ff('0xb5')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x71ff('0x1d')][_0x71ff('0x1a3')]=function(_0x1e9eee,_0x911c17,_0x5f3ae5){var _0x4d3007=this;var _0x775d4e=new History(_0x1e9eee);return new BPromise(function(_0x258b56,_0x27a3f4){if(_[_0x71ff('0x3f')](_0x911c17)&&typeof _0x911c17!=='object'){return _0x27a3f4(msgResponse(_0x71ff('0x1b1'),'Failure',_0x71ff('0x1b2')));}if(_[_0x71ff('0x3f')](_0x5f3ae5)&&typeof _0x5f3ae5!==_0x71ff('0x1b3')){return _0x27a3f4(msgResponse(_0x71ff('0x1b1'),_0x71ff('0x14f'),_0x71ff('0x1b4')));}switch(_0x5f3ae5[_0x71ff('0x1b5')]){case'0':_0x911c17['outboundNoSuchCallsDay']+=0x1;_0x775d4e[_0x71ff('0xaa')]=0x0;_0x775d4e[_0x71ff('0xab')]=_0x71ff('0x1b6');_0x775d4e[_0x71ff('0xff')]+=0x1;_0x775d4e[_0x71ff('0xfa')]+=0x1;ami[_0x71ff('0xef')]('custom:agentnosuchnumber',ut[_0x71ff('0xf1')](_0x1e9eee,_0x71ff('0x1b7')));_0x4d3007['createHistory'](_0x775d4e)[_0x71ff('0xb5')](loggerCatch(_0x71ff('0xfb')));if(_0x4d3007[_0x71ff('0x1b8')](0x0,_0x1e9eee,_0x911c17)){if(_0x775d4e[_0x71ff('0xff')]>=_0x911c17[_0x71ff('0x1ad')]){_0x4d3007[_0x71ff('0x106')](_0x775d4e,_0x258b56,_0x27a3f4,_0x71ff('0x1b9'));}else{_0x4d3007[_0x71ff('0x103')](_0x775d4e,_0x258b56,_0x27a3f4,_0x71ff('0x1b9'));}}break;case'3':_0x911c17[_0x71ff('0x63')]+=0x1;_0x775d4e[_0x71ff('0xaa')]=0x3;_0x775d4e['statedesc']=_0x71ff('0x1ba');_0x775d4e[_0x71ff('0xfe')]+=0x1;_0x775d4e[_0x71ff('0xfa')]+=0x1;ami[_0x71ff('0xef')](_0x71ff('0x1bb'),ut[_0x71ff('0xf1')](_0x1e9eee,'noanswer'));_0x4d3007[_0x71ff('0xd2')](_0x775d4e)[_0x71ff('0xb5')](loggerCatch(_0x71ff('0x1bc')));if(_0x4d3007[_0x71ff('0x1b8')](0x3,_0x1e9eee,_0x911c17)){if(_0x775d4e[_0x71ff('0xfe')]>=_0x911c17[_0x71ff('0x1a5')]){_0x4d3007[_0x71ff('0x106')](_0x775d4e,_0x258b56,_0x27a3f4,_0x71ff('0x1bd'));}else{_0x4d3007[_0x71ff('0x103')](_0x775d4e,_0x258b56,_0x27a3f4,_0x71ff('0x1bd'));}}break;case'5':_0x911c17[_0x71ff('0x5f')]+=0x1;_0x775d4e['state']=0x5;_0x775d4e['statedesc']=_0x71ff('0x1be');_0x775d4e[_0x71ff('0xfc')]+=0x1;_0x775d4e['countglobal']+=0x1;ami[_0x71ff('0xef')](_0x71ff('0x1bf'),ut[_0x71ff('0xf1')](_0x1e9eee,_0x71ff('0x1c0')));_0x4d3007[_0x71ff('0xd2')](_0x775d4e)['catch'](loggerCatch(_0x71ff('0x1c1')));if(_0x4d3007['checkRetriveMax'](0x5,_0x1e9eee,_0x911c17)){if(_0x775d4e[_0x71ff('0xfc')]>=_0x911c17[_0x71ff('0x1a7')]){_0x4d3007[_0x71ff('0x106')](_0x775d4e,_0x258b56,_0x27a3f4,_0x71ff('0x1c2'));}else{_0x4d3007[_0x71ff('0x103')](_0x775d4e,_0x258b56,_0x27a3f4,'reason\x205\x20busy');}}break;case'8':_0x911c17[_0x71ff('0x60')]+=0x1;_0x775d4e['state']=0x8;_0x775d4e['statedesc']=_0x71ff('0x1c3');_0x775d4e[_0x71ff('0xfd')]+=0x1;_0x775d4e['countglobal']+=0x1;ami[_0x71ff('0xef')](_0x71ff('0x1c4'),ut[_0x71ff('0xf1')](_0x1e9eee,'congestion'));_0x4d3007['createHistory'](_0x775d4e)['catch'](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x4d3007[_0x71ff('0x1b8')](0x8,_0x1e9eee,_0x911c17)){if(_0x775d4e[_0x71ff('0xfd')]>=_0x911c17['dialCongestionMaxRetry']){_0x4d3007[_0x71ff('0x106')](_0x775d4e,_0x258b56,_0x27a3f4,'reason\x208\x20congestion');}else{_0x4d3007[_0x71ff('0x103')](_0x775d4e,_0x258b56,_0x27a3f4,'reason\x208\x20congestion');}}break;case'11':_0x911c17[_0x71ff('0x1c5')]+=0x1;_0x775d4e[_0x71ff('0xaa')]=0xb;_0x775d4e['statedesc']='Abandoned';_0x775d4e[_0x71ff('0x100')]+=0x1;_0x775d4e[_0x71ff('0xfa')]+=0x1;_0x4d3007[_0x71ff('0xd2')](_0x775d4e)['catch'](loggerCatch(_0x71ff('0x12e')));if(_0x4d3007[_0x71ff('0x1b8')](0xb,_0x1e9eee,_0x911c17)){if(_0x775d4e[_0x71ff('0x100')]>=_0x911c17['dialAbandonedMaxRetry']){_0x4d3007[_0x71ff('0x106')](_0x775d4e,_0x258b56,_0x27a3f4,_0x71ff('0x1c6'));}else{_0x4d3007[_0x71ff('0x103')](_0x775d4e,_0x258b56,_0x27a3f4,_0x71ff('0x1c6'));}}break;case'20':_0x911c17['outboundRejectCallsDay']+=0x1;_0x775d4e[_0x71ff('0xaa')]=0x14;_0x775d4e[_0x71ff('0xab')]=_0x71ff('0x1c7');_0x775d4e[_0x71ff('0x101')]+=0x1;_0x775d4e[_0x71ff('0xfa')]+=0x1;ami[_0x71ff('0xef')]('custom:agentreject',ut[_0x71ff('0xf1')](_0x1e9eee,_0x71ff('0x1c8')));_0x4d3007['createHistory'](_0x775d4e)[_0x71ff('0xb5')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x4d3007['checkRetriveMax'](0x14,_0x1e9eee,_0x911c17)){if(_0x775d4e[_0x71ff('0x101')]>=_0x911c17[_0x71ff('0x1c9')]){_0x4d3007[_0x71ff('0x106')](_0x775d4e,_0x258b56,_0x27a3f4,'reason\x2020\x20agentreject');}else{_0x4d3007[_0x71ff('0x103')](_0x775d4e,_0x258b56,_0x27a3f4,_0x71ff('0x1ca'));}}break;default:_0x911c17[_0x71ff('0x67')]+=0x1;_0x775d4e[_0x71ff('0xaa')]=0xc;_0x775d4e[_0x71ff('0xab')]=_0x5f3ae5['reason'];_0x4d3007['createHistory'](_0x775d4e)[_0x71ff('0xb5')](loggerCatch(_0x71ff('0x1cb')));if(_0x4d3007['checkRetriveMax'](_0x5f3ae5['reason'],_0x1e9eee,_0x911c17)){if(_0x775d4e[_0x71ff('0xfc')]+_0x775d4e[_0x71ff('0xfd')]+_0x775d4e[_0x71ff('0xfe')]+_0x775d4e[_0x71ff('0xff')]+_0x775d4e[_0x71ff('0x120')]+_0x775d4e['countabandonedretry']+_0x775d4e['countmachineretry']+_0x775d4e[_0x71ff('0x101')]>=_0x911c17['dialGlobalMaxRetry']){_0x4d3007[_0x71ff('0x103')](_0x775d4e,_0x258b56,_0x27a3f4,_0x5f3ae5[_0x71ff('0x1b5')]);}else{_0x4d3007['createStateFinal'](_0x775d4e,_0x258b56,_0x27a3f4,_0x5f3ae5[_0x71ff('0x1b5')]);}}}});};Dialer[_0x71ff('0x1d')][_0x71ff('0x103')]=function(_0x4cfdb1,_0x2001df,_0x2f3762,_0x288fa1){var _0x280197=new Final(_0x4cfdb1);_0x280197[_0x71ff('0xaa')]=0xf;_0x280197[_0x71ff('0xab')]='Global';this[_0x71ff('0x106')](_0x280197,_0x2001df,_0x2f3762,_0x288fa1);};Dialer['prototype'][_0x71ff('0x106')]=function(_0x121b73,_0x3cd75c,_0x279313,_0x317021){this[_0x71ff('0xd0')](_0x121b73)[_0x71ff('0xbd')](function(){return _0x3cd75c(msgResponse(_0x71ff('0x1b1'),_0x71ff('0x1cc'),_0x317021));})[_0x71ff('0xb5')](function(){return _0x279313(msgResponse('[moveContactManagedDialer][0]','Failure',_0x71ff('0x1cd')));});};Dialer[_0x71ff('0x1d')]['predictive']=function(_0x234525){var _0x44cc6a=_0x234525['dialPredictiveOptimizationPercentage']/0x64;var _0x24d07f=_0x234525[_0x71ff('0x62')]/(_0x234525[_0x71ff('0x62')]+_0x234525[_0x71ff('0x5d')]);var _0x674938=Math[_0x71ff('0x1ce')](_0x234525[_0x71ff('0x72')]*(_0x234525[_0x71ff('0x1cf')]/0x64));var _0x1b1a30=Math['round'](_0x234525[_0x71ff('0x72')]*(_0x234525['predictiveIntervalMinThreshold']/0x64));var _0x105fb9=_0x234525[_0x71ff('0x51')]+_0x234525[_0x71ff('0x55')];var _0x33bb23=Math[_0x71ff('0x1d0')](_0x234525[_0x71ff('0x74')]*_0x234525[_0x71ff('0x76')]*_0x234525['predictiveIntervalHitRate']*_0x234525[_0x71ff('0x70')]);if(_['isUndefined'](_0x234525[_0x71ff('0x29')])){if(!_[_0x71ff('0x3f')](_0x234525[_0x71ff('0x28')])){_0x234525[_0x71ff('0x28')]=undefined;loggerPredictive[_0x71ff('0x98')](_0x71ff('0x1d1'),_0x71ff('0x1d2'));}if(!_[_0x71ff('0x3f')](_0x234525[_0x71ff('0x93')])){loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0x71ff('0x1d3'));clearInterval(_0x234525[_0x71ff('0x93')]);_0x234525[_0x71ff('0x93')]=undefined;}_0x234525['startProgressive']=moment()[_0x71ff('0x7c')](_0x71ff('0x108'));loggerPredictive['info'](_0x234525[_0x71ff('0x41')],'collection\x20data\x20in\x20progressive\x20at',_0x234525[_0x71ff('0x29')]);this[_0x71ff('0x163')](_0x234525,0x1);}else if(ifInterval(_0x234525[_0x71ff('0x1d4')],_0x234525[_0x71ff('0x29')])){this[_0x71ff('0x163')](_0x234525,0x1);loggerPredictiveCalls[_0x71ff('0x82')](_0x71ff('0x1d5'),_0x234525[_0x71ff('0x29')],_0x234525[_0x71ff('0x41')]);_0x234525['erlangCalls']=0x0;_0x234525['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x44cc6a<_0x24d07f&&_0x234525[_0x71ff('0x1d6')]===_0x71ff('0x1d7')){freeVariablesPredictive(_0x234525);loggerPredictive[_0x71ff('0x82')](_0x71ff('0x1d8'),_0x71ff('0x1d9'),_0x24d07f,_0x71ff('0x29'),_0x234525[_0x71ff('0x41')]);}else if(_0x33bb23<_0x234525[_0x71ff('0x6e')]&&_0x234525[_0x71ff('0x1d6')]===_0x71ff('0x1d7')){freeVariablesPredictive(_0x234525);loggerPredictive[_0x71ff('0x82')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20',_0x33bb23,'Drop\x20in\x20this\x20interval',_0x234525[_0x71ff('0x6e')],_0x71ff('0x29'),_0x234525[_0x71ff('0x41')]);}else if(!ifInterval(_0x234525[_0x71ff('0x1d4')],_0x234525[_0x71ff('0x29')])&&_['isUndefined'](_0x234525[_0x71ff('0x28')])&&!_[_0x71ff('0x3f')](_0x234525[_0x71ff('0x29')])){_0x234525[_0x71ff('0x28')]=moment()[_0x71ff('0x7c')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x234525[_0x71ff('0x41')],_0x71ff('0x1da'),_0x234525[_0x71ff('0x28')]);this[_0x71ff('0xc2')](_0x234525[_0x71ff('0x1d4')])[_0x71ff('0xbd')](this[_0x71ff('0x1db')](_0x234525))['then'](mergeDataErlangB(_0x234525))[_0x71ff('0xbd')](this[_0x71ff('0x1dc')](_0x234525))[_0x71ff('0xb5')](loggerCatchPredictive(_0x71ff('0x1dd'),_0x234525));}else if(!ifInterval(_0x234525[_0x71ff('0x1d4')],_0x234525[_0x71ff('0x28')])){_0x234525[_0x71ff('0x6e')]=0x0;_0x234525[_0x71ff('0x28')]=moment()[_0x71ff('0x7c')](_0x71ff('0x108'));loggerPredictive[_0x71ff('0x82')](_0x234525[_0x71ff('0x41')],'recalculate\x20predictive\x20at',_0x234525[_0x71ff('0x28')]);clearInterval(_0x234525[_0x71ff('0x93')]);_0x234525['handlePredictive']=undefined;this['averageHandleTime'](_0x234525[_0x71ff('0x1d4')])['then'](this[_0x71ff('0x1db')](_0x234525))[_0x71ff('0xbd')](mergeDataErlangB(_0x234525))[_0x71ff('0xbd')](this['startMethodPredictive'](_0x234525))['catch'](loggerCatchPredictive(_0x71ff('0x1de'),_0x234525));}else if(_0x234525[_0x71ff('0x72')]&&_0x105fb9<_0x234525['predictiveIntervalAvailable']-_0x1b1a30){freeVariablesPredictive(_0x234525);loggerPredictive[_0x71ff('0x82')](_0x234525[_0x71ff('0x41')],_0x71ff('0x1df'),_0x105fb9,_0x71ff('0x1e0'),_0x234525[_0x71ff('0x72')],'-',_0x1b1a30,'=',_0x234525[_0x71ff('0x72')]-_0x1b1a30,')');}else if(_0x234525[_0x71ff('0x72')]&&_0x105fb9>_0x234525['predictiveIntervalAvailable']+_0x674938){freeVariablesPredictive(_0x234525);loggerPredictive[_0x71ff('0x82')](_0x234525[_0x71ff('0x41')],_0x71ff('0x1df'),_0x105fb9,')\x20are\x20more\x20than\x20threshold\x20(',_0x234525[_0x71ff('0x72')],'+',_0x674938,'=',_0x234525[_0x71ff('0x72')]+_0x674938,')');}};Dialer['prototype']['getDataPredictive']=function(_0xa45c71){var _0x3b9a34=this;return function(_0x5b74fd){return new BPromise(function(_0x4b4f96,_0xed3e08){_[_0x71ff('0x90')](_0xa45c71,_0x5b74fd[0x0]);if(checkGetDataPredictive(_0x5b74fd[0x0])){var _0xc0667f=_0xa45c71[_0x71ff('0x72')]=_0xa45c71[_0x71ff('0x55')]+_0xa45c71[_0x71ff('0x51')];var _0x203234=_0xa45c71[_0x71ff('0x1d4')]*0x3c;var _0x4da3ce=_0x5b74fd[0x0][_0x71ff('0x6a')]+_0x5b74fd[0x0][_0x71ff('0x69')];var _0x26fb65=(_0x5b74fd[0x0][_0x71ff('0x68')]+_0x5b74fd[0x0][_0x71ff('0x6c')]+_0x5b74fd[0x0][_0x71ff('0x6b')])/_0x5b74fd[0x0]['predictiveIntervalTotalCalls'];_0xa45c71[_0x71ff('0x6f')]=_0x26fb65>0x0?_0x26fb65:0x1;switch(_0xa45c71[_0x71ff('0x1d6')]){case _0x71ff('0x1d7'):var _0x259c1e=_0xa45c71[_0x71ff('0x1e1')]/0x64;return _0x3b9a34[_0x71ff('0x1e2')](_0xc0667f,_0x203234,_0x4da3ce,_0x26fb65,_0x259c1e)['then'](function(_0x3048bd){return _0x4b4f96(_0x3048bd);});case _0x71ff('0x1e3'):var _0x2d0743=_0xa45c71['dialPredictiveOptimizationPercentage']/0x64;return _0x3b9a34['busyFactor'](_0xc0667f,_0x203234,_0x4da3ce,_0x26fb65,_0x2d0743)[_0x71ff('0xbd')](function(_0x11c068){return _0x4b4f96(_0x11c068);});default:return _0xed3e08(msgResponse('[getDataPredictive]',_0x71ff('0x14f'),_0x71ff('0x1e4')));}}else{return _0xed3e08(msgResponse(_0x71ff('0x1e5'),'Failure','check\x20failure'));}});};};Dialer[_0x71ff('0x1d')]['getDataPredictiveOld']=function(_0x251e1a){var _0x3e78a5=this;return function(_0x481dad){return new BPromise(function(_0x17cc53,_0x661f31){_['merge'](_0x251e1a,_0x481dad[0x0]);if(checkGetDataPredictive(_0x481dad[0x0])){loggerPredictive[_0x71ff('0x82')](JSON[_0x71ff('0x7b')](_0x481dad[0x0]));if(_0x251e1a['dialPredictiveOptimization']===_0x71ff('0x1d7')){return _0x3e78a5[_0x71ff('0xce')](_0x251e1a['id'])[_0x71ff('0xbd')](function(_0x30e37a){var _0x3cf8e5=_0x251e1a[_0x71ff('0x16b')]-_0x30e37a[0x0]['outboundQueuePauses'];var _0x1470b5=_0x251e1a['dialPredictiveInterval']*0x3c;var _0x4e24f6=_0x481dad[0x0]['predictiveIntervalAvgTalktime']+_0x481dad[0x0][_0x71ff('0x69')];var _0x52eef7=(_0x481dad[0x0][_0x71ff('0x68')]+_0x481dad[0x0][_0x71ff('0x6c')]+_0x481dad[0x0][_0x71ff('0x6b')])/_0x481dad[0x0][_0x71ff('0x73')];var _0x547acf=_0x251e1a[_0x71ff('0x1e1')]/0x64;_0x251e1a[_0x71ff('0x71')]=_0x30e37a[0x0][_0x71ff('0x1e6')]||0x0;_0x251e1a[_0x71ff('0x6f')]=_0x52eef7>0x0?_0x52eef7:0x1;return _0x3e78a5['abandonmentRate'](_0x3cf8e5,_0x1470b5,_0x4e24f6,_0x52eef7,_0x547acf);})[_0x71ff('0xbd')](function(_0x54ab05){return _0x17cc53(_0x54ab05);})['catch'](function(_0x3e149f){return _0x661f31(msgResponse(_0x71ff('0x1e7'),_0x71ff('0x14f'),JSON['stringify'](_0x3e149f)));});}if(_0x251e1a[_0x71ff('0x1d6')]==='agentBusyFactor'){return _0x3e78a5[_0x71ff('0xce')](_0x251e1a['id'])[_0x71ff('0xbd')](function(_0x32eb1a){var _0x195a2c=_0x251e1a[_0x71ff('0x16b')]-_0x32eb1a[0x0]['outboundQueuePauses'];var _0x5e1f4d=_0x251e1a['dialPredictiveInterval']*0x3c;var _0x47044a=_0x481dad[0x0][_0x71ff('0x6a')]+_0x481dad[0x0]['predictiveIntervalAvgHoldtime'];var _0x3d6ec4=(_0x481dad[0x0]['predictiveIntervalAnsweredCalls']+_0x481dad[0x0][_0x71ff('0x6c')]+_0x481dad[0x0][_0x71ff('0x6b')])/_0x481dad[0x0][_0x71ff('0x73')];var _0x4fd32b=_0x251e1a[_0x71ff('0x1e1')]/0x64;_0x251e1a[_0x71ff('0x71')]=_0x32eb1a[0x0][_0x71ff('0x1e6')]||0x0;_0x251e1a[_0x71ff('0x6f')]=_0x3d6ec4>0x0?_0x3d6ec4:0x1;return _0x3e78a5[_0x71ff('0x1e8')](_0x195a2c,_0x5e1f4d,_0x47044a,_0x3d6ec4,_0x4fd32b);})[_0x71ff('0xbd')](function(_0x118a45){return _0x17cc53(_0x118a45);})[_0x71ff('0xb5')](function(_0x197432){return _0x661f31(msgResponse(_0x71ff('0x1e7'),_0x71ff('0x14f'),JSON[_0x71ff('0x7b')](_0x197432)));});}}else{return _0x661f31(msgResponse(_0x71ff('0x1e5'),_0x71ff('0x14f'),_0x71ff('0x1e9')));}});};};Dialer[_0x71ff('0x1d')][_0x71ff('0x1dc')]=function(_0x51e9c3){var _0x45518c=this;return function(){var _0x1a0e13=0x0;var _0x536c12=Math[_0x71ff('0x1d0')](_0x51e9c3[_0x71ff('0x75')]*0x3e8);if(_0x536c12>0x0){_0x536c12=_0x536c12<0x64?0x64:_0x536c12;loggerPredictive[_0x71ff('0x82')](_0x51e9c3[_0x71ff('0x41')],'one\x20call\x20every:',_0x536c12,'milliseconds');_0x51e9c3['handlePredictive']=setInterval(function(){_0x45518c['handlePredictive'](_0x51e9c3);loggerPredictiveCalls[_0x71ff('0x82')](_0x71ff('0x1ea'),_0x1a0e13+=0x1);},_0x536c12);}else{loggerPredictive[_0x71ff('0x82')](_0x51e9c3[_0x71ff('0x41')],_0x71ff('0x1eb'));}};};Dialer[_0x71ff('0x1d')]['checkContactBlack']=function(_0x84b392,_0x5365ab){var _0x8f0b1=this;return function(_0x36c24d){if(_['isEmpty'](_0x36c24d)){if(_[_0x71ff('0xb2')](_0x5365ab[_0x71ff('0xdc')])||!_0x5365ab[_0x71ff('0x1ec')]){if(_0x84b392[_0x71ff('0x59')]==='booked'){_0x84b392[_0x71ff('0x136')]=_[_0x71ff('0x3f')](_0x84b392['queueStatusComplete'])?!![]:_0x84b392[_0x71ff('0x136')];var _0x1b0487=uuid['v4']();_0x8f0b1[_0x71ff('0xb0')][_0x1b0487]=new Action(_0x84b392,_0x5365ab,_0x1b0487);loggerBooked[_0x71ff('0x82')](_0x71ff('0x1ed'),_0x1b0487,_0x71ff('0x1ee'),JSON[_0x71ff('0x7b')](_0x84b392[_0x71ff('0x136')]),_0x71ff('0x1ef'),_0x84b392[_0x71ff('0x41')]);if(_0x84b392[_0x71ff('0x136')]){_0x84b392[_0x71ff('0x136')]=![];_0x8f0b1['queueBooked'][_0x8f0b1[_0x71ff('0xb0')][_0x1b0487][_0x71ff('0xb8')]]=[];ami['Action']({'actionid':_0x1b0487,'action':'queuestatus','queue':_0x84b392[_0x71ff('0x41')]})[_0x71ff('0xb5')](function(){_0x8f0b1['updateOriginated'](_0x84b392);_0x8f0b1['rescheduleContact']({'active':![],'ContactId':_0x8f0b1[_0x71ff('0xb0')][_0x1b0487][_0x71ff('0xda')],'ListId':_0x8f0b1[_0x71ff('0xb0')][_0x1b0487][_0x71ff('0xdb')],'VoiceQueueId':_0x8f0b1[_0x71ff('0xb0')][_0x1b0487][_0x71ff('0xdd')]||undefined,'CampaignId':_0x8f0b1[_0x71ff('0xb0')][_0x1b0487][_0x71ff('0xde')]||undefined})[_0x71ff('0xb5')](loggerCatch(_0x71ff('0x1f0')));delete _0x8f0b1[_0x71ff('0xb0')][_0x1b0487];});}else{loggerBooked[_0x71ff('0x82')](_0x71ff('0x1f1'),JSON[_0x71ff('0x7b')](_0x84b392[_0x71ff('0x136')]),'Queue:\x20',_0x84b392['name']);_0x8f0b1[_0x71ff('0xb7')](_0x84b392);_0x8f0b1[_0x71ff('0xc5')]({'active':![],'ContactId':_0x8f0b1['actions'][_0x1b0487][_0x71ff('0xda')],'ListId':_0x8f0b1[_0x71ff('0xb0')][_0x1b0487][_0x71ff('0xdb')],'VoiceQueueId':_0x8f0b1['actions'][_0x1b0487][_0x71ff('0xdd')]||undefined,'CampaignId':_0x8f0b1[_0x71ff('0xb0')][_0x1b0487]['CampaignId']||undefined})[_0x71ff('0xb5')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x8f0b1['actions'][_0x1b0487];}}else{return _0x8f0b1[_0x71ff('0x177')](_0x84b392,_0x5365ab);}}else{if(getDiff(_0x5365ab['scheduledat'])<_0x84b392[_0x71ff('0x1f2')]*0x3c){if(_0x5365ab[_0x71ff('0x1f3')]&&!_0x5365ab[_0x71ff('0x1f3')]['voicePause']){_0x8f0b1[_0x71ff('0x20')][_0x71ff('0x13a')](_0x5365ab['id'])[_0x71ff('0x142')](function(){_0x8f0b1[_0x71ff('0xb7')](_0x84b392);});}else{_0x8f0b1[_0x71ff('0xc7')]({'active':![]},_0x5365ab['id'],0x1)[_0x71ff('0x142')](function(){_0x8f0b1[_0x71ff('0xb7')](_0x84b392);});}}else{_0x84b392[_0x71ff('0x66')]+=0x1;_0x8f0b1[_0x71ff('0xb7')](_0x84b392);if(_0x84b392['dialRecallInQueue']){_0x8f0b1[_0x71ff('0xc5')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5365ab[_0x71ff('0xda')],'ListId':_0x5365ab[_0x71ff('0xdb')],'VoiceQueueId':_0x5365ab[_0x71ff('0xdd')]||undefined,'CampaignId':_0x5365ab[_0x71ff('0xde')]||undefined})[_0x71ff('0xb5')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x8f0b1[_0x71ff('0xd2')](createObjHistory(_0x84b392,_0x5365ab,_0x71ff('0x1f4'),0x17,'RecallInQueue'))['catch'](loggerCatch(_0x71ff('0x1f5')));}else{_0x8f0b1[_0x71ff('0xd8')](createObjHistory(_0x84b392,_0x5365ab,_0x71ff('0x1f6'),0x16,_0x71ff('0x1f7')),_0x71ff('0x1f8'),'[Originate][HistoryRecallClose]');}}}}else{_0x84b392[_0x71ff('0x5e')]+=0x1;_0x8f0b1['saveInDb'](createObjHistory(_0x84b392,_0x5365ab,_0x71ff('0x1f9'),0xd,_0x71ff('0x1fa')),_0x71ff('0x1fb'),_0x71ff('0x1fc'));throw _0x71ff('0x1fd');}};};Dialer[_0x71ff('0x1d')][_0x71ff('0x169')]=function(_0xd0b022){var _0x594d78=this;var _0xbb1cf8=_0xd0b022[_0x71ff('0x1fe')]-_0xd0b022[_0x71ff('0x9b')]-_0xd0b022[_0x71ff('0xca')];emitCampaignSummary(_0xd0b022);if(_0xbb1cf8>0x0){if(_0xbb1cf8>this[_0x71ff('0x24')]){_0xbb1cf8=this[_0x71ff('0x24')];}_0xd0b022[_0x71ff('0xca')]+=_0xbb1cf8;this['getContactDialerIvr'](_0xd0b022['id'],_0xbb1cf8,_0xd0b022[_0x71ff('0x1ff')],_0xd0b022)[_0x71ff('0xbd')](function(_0x2f9c9c){_0xd0b022[_0x71ff('0xca')]-=_0xbb1cf8;_0xd0b022[_0x71ff('0xca')]=_0xd0b022[_0x71ff('0xca')]>0x0?_0xd0b022['temp']:0x0;if(!checkContactEmpty(_0x2f9c9c)){_0xd0b022['message']=_0x71ff('0xa3');logger['info'](_0x71ff('0x200')+_0xd0b022['name']);}else{_0xd0b022[_0x71ff('0x9b')]+=_0x2f9c9c[_0x71ff('0x13d')];_0xd0b022[_0x71ff('0x40')]='RUNNING';for(var _0x4088f4=0x0;_0x4088f4<_0x2f9c9c[_0x71ff('0x13d')];_0x4088f4+=0x1){_0xd0b022[_0x71ff('0x201')]+=0x1;if(_[_0x71ff('0xb2')](_0x2f9c9c[_0x4088f4])||_[_0x71ff('0xb2')](_0x2f9c9c[_0x4088f4][_0x71ff('0x179')])||_[_0x71ff('0xb2')](_0x2f9c9c[_0x4088f4][_0x71ff('0x179')][_0x71ff('0x17a')])){_0x594d78['emptyContact'](_0x71ff('0x202'),_0xd0b022,_0x2f9c9c[_0x4088f4]);}else{_0x594d78['checkIsBlackListIvr'](_[_0x71ff('0xd9')](_0x2f9c9c[_0x4088f4],[_0x71ff('0xde'),_0x71ff('0x203')]))['then'](_0x594d78[_0x71ff('0x204')](_0xd0b022,_0x2f9c9c[_0x4088f4]))[_0x71ff('0xb5')](_0x594d78[_0x71ff('0xd5')](_0x71ff('0x205'),_0xd0b022));}}}})[_0x71ff('0xb5')](loggerGetContactDialer(_0x71ff('0x206'),_0xd0b022,_0xbb1cf8));}};Dialer[_0x71ff('0x1d')]['handlePower']=function(_0x4665f4,_0x2da383){var _0x1532fb=this;var _0x3d1b77=[];var _0x4c06ec=_0x2da383>=0x1?_0x2da383:0x1;if(_0x4665f4['dialMethod']===_0x71ff('0x9')){_0x4c06ec=0x1;}var _0x85d4bb=Math['floor'](_0x4665f4[_0x71ff('0x51')]*_0x4c06ec)-_0x4665f4[_0x71ff('0x9b')]-_0x4665f4[_0x71ff('0xca')];emitVoiceQueueSummary(_0x4665f4);if(_0x4665f4[_0x71ff('0x207')]>0x0){var _0x550d80=_0x4665f4[_0x71ff('0x207')]-_0x4665f4[_0x71ff('0x9b')]-_0x4665f4[_0x71ff('0x55')]-_0x4665f4[_0x71ff('0xca')]-_0x4665f4[_0x71ff('0x52')];if(_0x85d4bb>_0x550d80){_0x85d4bb=_0x550d80;}}if(_0x85d4bb>0x0){if(_0x4665f4[_0x71ff('0x59')]===_0x71ff('0x9')){_0x85d4bb=0x1;}if(_0x85d4bb>this['maxNumberOriginate']){_0x85d4bb=this[_0x71ff('0x24')];}_0x4665f4[_0x71ff('0xca')]+=_0x85d4bb;for(var _0x365749 in this['agents']){if(typeof this['agents'][_0x365749]!==_0x71ff('0x9c')){if(this[_0x71ff('0x23')][_0x365749][_0x71ff('0xaa')]===_0x71ff('0x208')&&this[_0x71ff('0x23')][_0x365749][_0x71ff('0xe3')]===_0x71ff('0xe4')){_0x3d1b77[_0x71ff('0x134')](this[_0x71ff('0x23')][_0x365749]['id']);}}}this[_0x71ff('0xc9')](_0x4665f4['id'],_0x3d1b77,_0x85d4bb,_0x4665f4[_0x71ff('0x1ff')],_0x4665f4)[_0x71ff('0xbd')](function(_0x488d89){_0x4665f4['temp']-=_0x85d4bb;_0x4665f4['temp']=_0x4665f4[_0x71ff('0xca')]>0x0?_0x4665f4['temp']:0x0;if(!checkContactEmpty(_0x488d89)){_0x1532fb['countReScheduled'](_0x4665f4)[_0x71ff('0xbd')](sendMessageReschedule(_0x4665f4))[_0x71ff('0xb5')](loggerCatch(_0x71ff('0x209')));}else{_0x4665f4[_0x71ff('0x9b')]+=_0x488d89['length'];_0x4665f4[_0x71ff('0x40')]=_0x4665f4[_0x71ff('0x59')]===_0x71ff('0x9')?'ACTIVE':_0x71ff('0x20a');for(var _0x4c2290=0x0;_0x4c2290<_0x488d89[_0x71ff('0x13d')];_0x4c2290+=0x1){if(_[_0x71ff('0xb2')](_0x488d89[_0x4c2290])||_['isNil'](_0x488d89[_0x4c2290][_0x71ff('0x179')])||_[_0x71ff('0xb2')](_0x488d89[_0x4c2290][_0x71ff('0x179')]['phone'])){_0x1532fb[_0x71ff('0xd6')](_0x71ff('0x202'),_0x4665f4,_0x488d89[_0x4c2290]);}else{_0x1532fb[_0x71ff('0xbe')](_[_0x71ff('0xd9')](_0x488d89[_0x4c2290],[_0x71ff('0xdd'),'Contact.phone']))[_0x71ff('0xbd')](_0x1532fb[_0x71ff('0x204')](_0x4665f4,_0x488d89[_0x4c2290]))[_0x71ff('0xb5')](_0x1532fb[_0x71ff('0xd5')](_0x71ff('0x202'),_0x4665f4));}}}})['catch'](loggerGetContactDialer(_0x71ff('0x20b'),_0x4665f4,_0x85d4bb));}};Dialer[_0x71ff('0x1d')]['handlePredictive']=function(_0x55a124){if(_0x55a124[_0x71ff('0x207')]>0x0){var _0x40608f=_0x55a124[_0x71ff('0x207')]-_0x55a124[_0x71ff('0x9b')]-_0x55a124['talking'];if(_0x40608f>0x0){this[_0x71ff('0x20c')](_0x55a124);}else{loggerPredictiveCalls[_0x71ff('0x82')](_0x71ff('0x20d'));}}else{this[_0x71ff('0x20c')](_0x55a124);}};Dialer[_0x71ff('0x1d')][_0x71ff('0x20c')]=function(_0x1c1514){var _0x329d45=this;var _0x5ddf56=[];_0x1c1514['originated']+=0x1;for(var _0x5196bb in this[_0x71ff('0x23')]){if(typeof this[_0x71ff('0x23')][_0x5196bb]!==_0x71ff('0x9c')){if(this['agents'][_0x5196bb][_0x71ff('0xaa')]==='not_inuse'&&this[_0x71ff('0x23')][_0x5196bb][_0x71ff('0xe3')]==='reachable'){_0x5ddf56['push'](this[_0x71ff('0x23')][_0x5196bb]['id']);}}}this[_0x71ff('0xc9')](_0x1c1514['id'],_0x5ddf56,0x1,_0x1c1514[_0x71ff('0x1ff')],_0x1c1514)[_0x71ff('0xbd')](function(_0xf37731){if(!checkContactEmpty(_0xf37731)){checkContactLowerLimitOriginate(_0x1c1514,0x1,0x0);_0x329d45[_0x71ff('0xbb')](_0x1c1514)['then'](sendMessageReschedule(_0x1c1514))[_0x71ff('0xb5')](loggerCatch(_0x71ff('0x209')));}else{_0x1c1514['message']=_0x71ff('0x20a');if(_['isNil'](_0xf37731[0x0])||_[_0x71ff('0xb2')](_0xf37731[0x0][_0x71ff('0x179')])||_[_0x71ff('0xb2')](_0xf37731[0x0][_0x71ff('0x179')][_0x71ff('0x17a')])){_0x329d45[_0x71ff('0xd6')]('[actionOriginate]\x20',_0x1c1514,_0xf37731[0x0]);}else{_0x329d45[_0x71ff('0xbe')](_[_0x71ff('0xd9')](_0xf37731[0x0],[_0x71ff('0xdd'),_0x71ff('0x203')]))[_0x71ff('0xbd')](_0x329d45['checkContactBlack'](_0x1c1514,_0xf37731[0x0]))['catch'](_0x329d45[_0x71ff('0xd5')]('[actionOriginatePredictive]\x20',_0x1c1514));}}})[_0x71ff('0xb5')](loggerGetContactDialer('[getContactDialerPredictive]',_0x1c1514,0x1));emitVoiceQueueSummary(_0x1c1514);};Dialer[_0x71ff('0x1d')][_0x71ff('0x1e2')]=function(_0x387baa,_0x3a5bce,_0x49a4a6,_0x539dfa,_0x468cd4,_0x5d1103){loggerPredictive[_0x71ff('0x82')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x71ff('0x82')](_0x71ff('0x20e'),_0x387baa);loggerPredictive[_0x71ff('0x82')](_0x71ff('0x20f'),_0x3a5bce);loggerPredictive[_0x71ff('0x82')](_0x71ff('0x210'),_0x49a4a6);loggerPredictive['info'](_0x71ff('0x211'),_0x539dfa);loggerPredictive['info'](_0x71ff('0x212'),_0x468cd4);loggerPredictive['info'](_0x71ff('0x213'));return new BPromise(function(_0x5b3f30,_0x1da66d){if(_0x387baa<=0x0||isNaN(_0x387baa)){return _0x1da66d(msgResponse('[abandonmentRate]',_0x71ff('0x4a'),'m\x20=\x20'+_0x387baa));}if(_0x49a4a6<=0x0||isNaN(_0x49a4a6)){return _0x1da66d(msgResponse('[abandonmentRate]','Error',_0x71ff('0x214')+_0x49a4a6));}if(_0x539dfa<=0x0||isNaN(_0x539dfa)){return _0x1da66d(msgResponse(_0x71ff('0x215'),_0x71ff('0x4a'),_0x71ff('0x216')+_0x539dfa));}if(_0x3a5bce<=0x0||isNaN(_0x3a5bce)){return _0x1da66d(msgResponse(_0x71ff('0x215'),'Error',_0x71ff('0x217')+_0x3a5bce));}if(_0x468cd4<=0x0||isNaN(_0x468cd4)){return _0x1da66d(msgResponse(_0x71ff('0x215'),'Error',_0x71ff('0x218')+_0x468cd4));}_0x5d1103=_0x5d1103||0x0;var _0x52790d=0x1/_0x49a4a6;var _0x1e40b9=0x0;var _0x4fafe6=0x0;var _0x454773=0x0;var _0x89ba5a=0x0;for(var _0x427d63=0x0;_0x454773<_0x468cd4;_0x427d63+=0x1){_0x4fafe6=_0x427d63/_0x3a5bce;_0x1e40b9=(_0x539dfa*_0x4fafe6+_0x5d1103)/_0x52790d;_0x454773=erlangb(_0x1e40b9,_0x387baa);_0x89ba5a=_0x1e40b9/_0x387baa*(0x1-erlangb(_0x1e40b9,_0x387baa));}return _0x5b3f30({'erlangCalls':_0x427d63,'erlangCallToSecond':_0x3a5bce/_0x427d63,'erlangAbandonmentRate':_0x454773,'erlangBusyFactor':_0x89ba5a});});};Dialer['prototype'][_0x71ff('0x1e8')]=function(_0x4288a0,_0x9fda20,_0x3d9de8,_0x4bb16b,_0x133b76,_0x4bc37a){loggerPredictive['info'](_0x71ff('0x219'));loggerPredictive[_0x71ff('0x82')](_0x71ff('0x20e'),_0x4288a0);loggerPredictive[_0x71ff('0x82')](_0x71ff('0x20f'),_0x9fda20);loggerPredictive[_0x71ff('0x82')]('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',_0x3d9de8);loggerPredictive[_0x71ff('0x82')](_0x71ff('0x211'),_0x4bb16b);loggerPredictive[_0x71ff('0x82')](_0x71ff('0x21a'),_0x133b76);loggerPredictive[_0x71ff('0x82')](_0x71ff('0x213'));return new BPromise(function(_0x265fa3,_0x36e648){if(_0x4288a0<=0x0||isNaN(_0x4288a0)){return _0x36e648(msgResponse('[busyFactor]',_0x71ff('0x4a'),_0x71ff('0x21b')+_0x4288a0));}if(_0x3d9de8<=0x0||isNaN(_0x3d9de8)){return _0x36e648(msgResponse(_0x71ff('0x21c'),'Error',_0x71ff('0x214')+_0x3d9de8));}if(_0x4bb16b<=0x0||isNaN(_0x4bb16b)){return _0x36e648(msgResponse(_0x71ff('0x21c'),_0x71ff('0x4a'),_0x71ff('0x216')+_0x4bb16b));}if(_0x9fda20<=0x0||isNaN(_0x9fda20)){return _0x36e648(msgResponse(_0x71ff('0x21c'),'Error',_0x71ff('0x217')+_0x9fda20));}if(_0x133b76<=0x0||isNaN(_0x133b76)){return _0x36e648(msgResponse('[busyFactor]',_0x71ff('0x4a'),_0x71ff('0x21d')+_0x133b76));}_0x4bc37a=_0x4bc37a||0x0;var _0x55c7f6=0x1/_0x3d9de8;var _0x3a0762=0x0;var _0x2888c8=0x0;var _0x4f337a=0x0;var _0x38eeac=0x0;for(var _0x13c108=0x0;_0x38eeac<_0x133b76;_0x13c108+=0x1){_0x2888c8=_0x13c108/_0x9fda20;_0x3a0762=(_0x4bb16b*_0x2888c8+_0x4bc37a)/_0x55c7f6;_0x4f337a=erlangb(_0x3a0762,_0x4288a0);_0x38eeac=_0x3a0762/_0x4288a0*(0x1-erlangb(_0x3a0762,_0x4288a0));}return _0x265fa3({'erlangCalls':_0x13c108,'erlangCallToSecond':_0x9fda20/_0x13c108,'erlangAbandonmentRate':_0x4f337a,'erlangBusyFactor':_0x38eeac});});};module[_0x71ff('0x21e')]=Dialer; \ No newline at end of file +var _0x2a5b=['[syncAgentComplete][createHistory][0]','reason19\x20machine....','AnswerAGI','AGI','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dropreason','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','Drop','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','roundrobin','actionid','locked','paused','stateinterface','rrmemory','push','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','run','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','iftime\x20%s,%s','interval','content','indexOf','true','some','GLOBAL_INTERVAL_IS_OVERTIME','\x20Interval\x20is\x20overtime:\x20','checkDialMethod','progressive','power','dialPowerLevel','predictive','booked','handlePower','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialActive','dialGlobalInterval','dialTimezone','[syncQueueSummary]','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','Contact','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','getCaller','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','%s%s','XMD-','toUpper','callerid','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialAgentRejectMaxRetry','countagentrejectretry','dialAgentRejectRetryFrequency','[callProgressDetecting]','reason','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','Busy','busy','reason\x205\x20busy','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','averageHandleTime','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','floor','one\x20call\x20every:','[handlePredictive]','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','checkIsBlackListIvr','Contact.phone','[getContactCampaign2]','dialLimitQueue','not_inuse','[countReScheduled]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Error','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','[busyFactor]','m\x20=\x20','interval\x20=\x20','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictiveCalls','../ami','redis','defaults','socket.io-emitter','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startProgressive','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','hangup','syncHangup','newexten','syncNewExten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','[ifTime][Action]','stringify','milliseconds','emit','type','outbound','strategy','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','Trunk','active','voice:queue:%s','format','campaign:ivr:%s','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','diff','clearing\x20variable\x20start\x20progressive','startPredictive','clearing\x20variable\x20start\x20predictive','handlePredictive','ivr','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','undefined','contactsRescheduled','RESCHEDULED_CONTACTS','contacts','[getContactDialer2][Empty]','sendMessageOneNotActive','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','starttime','clearZombieChannels','[uniqueid]','actions','enqueue','Action','status','channel','No\x20such\x20channel','queue','[Dialer][checkChannel]','updateOriginated','then','countReScheduled','catch','checkIsBlackList','resolve','[checkIsBlackList]\x20','[checkIsBlackListIvr]\x20','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','saveInDb','pick','ListId','UserId','CampaignId','[emptyContact][createHistory]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','uniqueid','isNil','variable','amdstatus','xcally-motion-dialer','value','membername','AMD','buildObj','[syncHangupInAMD]','dialAMDActive','MACHINE','Machine','countmachineretry','countglobal','custom:amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','dialGlobalMaxRetry','stateGlobal','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ContactId','VoiceQueueId','[rescheduleContact][Machine]','HANGUP','HangupInAMD','amd','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]'];(function(_0x3bb959,_0x5f873c){var _0x3f3a16=function(_0x51e355){while(--_0x51e355){_0x3bb959['push'](_0x3bb959['shift']());}};_0x3f3a16(++_0x5f873c);}(_0x2a5b,0x11c));var _0xb2a5=function(_0x1ab180,_0x382b2c){_0x1ab180=_0x1ab180-0x0;var _0xfb2c2d=_0x2a5b[_0x1ab180];return _0xfb2c2d;};'use strict';var util=require(_0xb2a5('0x0'));var _=require(_0xb2a5('0x1'));var BPromise=require(_0xb2a5('0x2'));var uuid=require(_0xb2a5('0x3'));var moment=require(_0xb2a5('0x4'));var rr=require('rr');var md5=require(_0xb2a5('0x5'));var Redis=require(_0xb2a5('0x6'));var ut=require(_0xb2a5('0x7'));var config=require(_0xb2a5('0x8'));var logger=require(_0xb2a5('0x9'))(_0xb2a5('0xa'));var loggerBooked=require(_0xb2a5('0x9'))('booked');var loggerPredictive=require(_0xb2a5('0x9'))('predictive');var loggerPredictiveCalls=require(_0xb2a5('0x9'))(_0xb2a5('0xb'));var loggerSyncQueueSummary=require(_0xb2a5('0x9'))('syncQueueSummary');var ami=require(_0xb2a5('0xc'));config[_0xb2a5('0xd')]=_[_0xb2a5('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xb2a5('0xf'))(new Redis(config[_0xb2a5('0xd')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0xb2a5('0x10'));var cmHopperBlack=require(_0xb2a5('0x11'));var voiceQueueRt=require(_0xb2a5('0x12'));var Action=require(_0xb2a5('0x13'));var History=require(_0xb2a5('0x14'));var Final=require(_0xb2a5('0x15'));var AgentComplete=require(_0xb2a5('0x16'));var QueueCallerAbandon=require(_0xb2a5('0x17'));var Hangup=require(_0xb2a5('0x18'));var ipAgi=process[_0xb2a5('0x19')][_0xb2a5('0x1a')]||'127.0.0.1';var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0xb2a5('0x1b')]['enqueue']=function(_0x370f75){this[_0xb2a5('0x1c')]=this[_0xb2a5('0x1c')]?this[_0xb2a5('0x1c')][_0xb2a5('0x1d')](_0x370f75):_0x370f75();};function Dialer(_0x4cea91,_0x2d16a9){this[_0xb2a5('0x1e')]=new Sequence();this[_0xb2a5('0x1f')]=_0x2d16a9;this[_0xb2a5('0x20')]=_0x4cea91['voiceQueues'];this[_0xb2a5('0x21')]=_0x4cea91['campaigns'];this[_0xb2a5('0x22')]=_0x4cea91[_0xb2a5('0x22')];this['trunks']=_0x4cea91[_0xb2a5('0x23')];this[_0xb2a5('0x24')]=config[_0xb2a5('0x24')]||0x2;this[_0xb2a5('0x25')]={};this['actions']={};this[_0xb2a5('0x26')]={};this[_0xb2a5('0x27')]={};this[_0xb2a5('0x28')]={};this['startPredictive']={};this[_0xb2a5('0x29')]={};this['ivrOriginated']={};this[_0xb2a5('0x2a')]={};this[_0xb2a5('0x2b')]={};ami['on'](_0xb2a5('0x2c'),this[_0xb2a5('0x2d')][_0xb2a5('0x2e')](this));ami['on'](_0xb2a5('0x2f'),this[_0xb2a5('0x30')]['bind'](this));ami['on'](_0xb2a5('0x31'),this[_0xb2a5('0x32')][_0xb2a5('0x2e')](this));ami['on'](_0xb2a5('0x33'),this[_0xb2a5('0x34')][_0xb2a5('0x2e')](this));ami['on'](_0xb2a5('0x35'),this[_0xb2a5('0x36')]['bind'](this));ami['on'](_0xb2a5('0x37'),this[_0xb2a5('0x38')][_0xb2a5('0x2e')](this));ami['on'](_0xb2a5('0x39'),this[_0xb2a5('0x3a')][_0xb2a5('0x2e')](this));ami['on']('varset',this[_0xb2a5('0x3b')][_0xb2a5('0x2e')](this));ami['on'](_0xb2a5('0x3c'),this[_0xb2a5('0x3d')][_0xb2a5('0x2e')](this));ami['on'](_0xb2a5('0x3e'),this[_0xb2a5('0x3f')][_0xb2a5('0x2e')](this));this[_0xb2a5('0x40')]();this[_0xb2a5('0x41')]();}function isNotNull(_0x1a1de9){return _0x1a1de9!==null&&!_[_0xb2a5('0x42')](_0x1a1de9);}function checkIsLoggedIn(_0x160a13,_0x4f5a8f){return function(){if(_0x4f5a8f<=0x0){_0x160a13[_0xb2a5('0x43')]=_0xb2a5('0x44');throw _0x160a13[_0xb2a5('0x45')]+_0xb2a5('0x46');}};}function isActive(_0x536da2){return _0x536da2;}function checkIsActive(_0x2a8128,_0x1d8534){return function(){if(!isActive(_0x1d8534)){_0x2a8128['message']=_0xb2a5('0x47');throw _0x2a8128[_0xb2a5('0x45')]+_0xb2a5('0x48');}};}function checkInterval(_0x2f0d7c){return function(){if(!isNotNull(_0x2f0d7c[_0xb2a5('0x49')])){_0x2f0d7c[_0xb2a5('0x43')]=_0xb2a5('0x4a');throw _0x2f0d7c[_0xb2a5('0x45')]+_0xb2a5('0x4b');}if(!isNotNull(_0x2f0d7c['Interval'][_0xb2a5('0x4c')])){_0x2f0d7c['message']=_0xb2a5('0x4a');throw _0x2f0d7c[_0xb2a5('0x45')]+_0xb2a5('0x4b');}if(!isNotNull(_['isEmpty'](_0x2f0d7c[_0xb2a5('0x49')][_0xb2a5('0x4c')]))){_0x2f0d7c[_0xb2a5('0x43')]='INTERVAL_IS_NULL';throw _0x2f0d7c['name']+_0xb2a5('0x4b');}};}function msgResponse(_0x4f0531,_0x3a5d12,_0x2a09c2){return{'action':_0x4f0531,'response':_0x3a5d12,'message':_0x2a09c2,'stack':_0x2a09c2};}function myreject(_0xe1be32){return function(_0x4f5710){return _0xe1be32(msgResponse(_0xb2a5('0x4d'),'Error',JSON[_0xb2a5('0x4e')](_0x4f5710)));};}function getSeconds(_0x2fa71c,_0x188bf0){var _0x30fbb5=moment(_0x2fa71c)[_0xb2a5('0x4f')](0x0);var _0x3c3285=moment(_0x188bf0)[_0xb2a5('0x4f')](0x0);return _0x30fbb5['diff'](_0x3c3285,'seconds');}function emit(_0x4d93b9,_0x15c9d9,_0x23b3ae){io['to'](_0x4d93b9)[_0xb2a5('0x50')](_0x15c9d9,_0x23b3ae);}function emitVoiceQueueSummary(_0x3b1c6f){if(_0x3b1c6f[_0xb2a5('0x51')]===_0xb2a5('0x52')){var _0x29b0cf={'id':_0x3b1c6f['id'],'name':_0x3b1c6f[_0xb2a5('0x45')],'strategy':_0x3b1c6f[_0xb2a5('0x53')],'answered':_0x3b1c6f['answered'],'available':_0x3b1c6f[_0xb2a5('0x54')],'loggedIn':_0x3b1c6f[_0xb2a5('0x55')],'pTalking':_0x3b1c6f[_0xb2a5('0x56')],'sumBillable':_0x3b1c6f[_0xb2a5('0x57')],'sumDuration':_0x3b1c6f[_0xb2a5('0x58')],'sumHoldTime':_0x3b1c6f[_0xb2a5('0x59')]||0x0,'talking':_0x3b1c6f[_0xb2a5('0x5a')],'total':_0x3b1c6f['total'],'type':_0x3b1c6f[_0xb2a5('0x51')],'unmanaged':_0x3b1c6f[_0xb2a5('0x5b')],'abandoned':_0x3b1c6f[_0xb2a5('0x5c')],'waiting':_0x3b1c6f[_0xb2a5('0x5d')],'loggedInDb':_0x3b1c6f[_0xb2a5('0x5e')],'dialActive':_0x3b1c6f['dialActive'],'dialMethod':_0x3b1c6f[_0xb2a5('0x5f')],'dialOriginateCallerIdName':_0x3b1c6f[_0xb2a5('0x60')],'dialOriginateCallerIdNumber':_0x3b1c6f[_0xb2a5('0x61')],'dialOriginateTimeout':_0x3b1c6f[_0xb2a5('0x62')],'dialPrefix':_0x3b1c6f[_0xb2a5('0x63')],'outboundAnswerAgiCallsDay':_0x3b1c6f[_0xb2a5('0x64')],'outboundAnswerCallsDay':_0x3b1c6f[_0xb2a5('0x65')],'outboundBlacklistCallsDay':_0x3b1c6f['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x3b1c6f[_0xb2a5('0x66')],'outboundCongestionCallsDay':_0x3b1c6f[_0xb2a5('0x67')],'outboundDropCallsDayACS':_0x3b1c6f['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x3b1c6f[_0xb2a5('0x68')],'outboundDropCallsDayTimeout':_0x3b1c6f[_0xb2a5('0x69')],'outboundNoAnswerCallsDay':_0x3b1c6f[_0xb2a5('0x6a')],'outboundNoSuchCallsDay':_0x3b1c6f[_0xb2a5('0x6b')],'outboundOriginateFailureCallsDay':_0x3b1c6f['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x3b1c6f[_0xb2a5('0x6c')],'outboundRejectCallsDay':_0x3b1c6f[_0xb2a5('0x6d')],'outboundUnknownCallsDay':_0x3b1c6f[_0xb2a5('0x6e')],'predictiveIntervalAnsweredCalls':_0x3b1c6f[_0xb2a5('0x6f')],'predictiveIntervalAvgHoldtime':_0x3b1c6f['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x3b1c6f[_0xb2a5('0x70')],'predictiveIntervalDroppedCallsCallersExit':_0x3b1c6f[_0xb2a5('0x71')],'predictiveIntervalDroppedCallsTimeout':_0x3b1c6f[_0xb2a5('0x72')],'predictiveIntervalErlangCalls':_0x3b1c6f['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x3b1c6f[_0xb2a5('0x73')],'predictiveIntervalHitRate':_0x3b1c6f[_0xb2a5('0x74')],'predictiveIntervalMultiplicativeFactor':_0x3b1c6f[_0xb2a5('0x75')],'predictiveIntervalPauses':_0x3b1c6f[_0xb2a5('0x76')],'predictiveIntervalAvailable':_0x3b1c6f[_0xb2a5('0x77')],'predictiveIntervalTotalCalls':_0x3b1c6f[_0xb2a5('0x78')],'message':_0x3b1c6f[_0xb2a5('0x43')],'originated':_0x3b1c6f[_0xb2a5('0x79')],'erlangCalls':_0x3b1c6f[_0xb2a5('0x7a')],'erlangCallToSecond':_0x3b1c6f[_0xb2a5('0x7b')],'erlangAbandonmentRate':_0x3b1c6f['erlangAbandonmentRate'],'erlangBusyFactor':_0x3b1c6f[_0xb2a5('0x7c')],'startPredictive':_0x3b1c6f['startPredictive'],'startProgressive':_0x3b1c6f[_0xb2a5('0x29')]};if(_0x3b1c6f[_0xb2a5('0x7d')]){_0x29b0cf[_0xb2a5('0x7d')]={'id':_0x3b1c6f[_0xb2a5('0x7d')]['id'],'name':_0x3b1c6f[_0xb2a5('0x7d')][_0xb2a5('0x45')],'active':_0x3b1c6f[_0xb2a5('0x7d')][_0xb2a5('0x7e')],'callerid':_0x3b1c6f[_0xb2a5('0x7d')]['callerid']};}if(_0x3b1c6f[_0xb2a5('0x49')]){_0x29b0cf['Interval']={'id':_0x3b1c6f[_0xb2a5('0x49')]['id'],'name':_0x3b1c6f[_0xb2a5('0x49')]['name']};}var _0x532291=md5(JSON[_0xb2a5('0x4e')](_0x29b0cf));if(_0x3b1c6f[_0xb2a5('0x5')]!==_0x532291){_0x3b1c6f['md5']=_0x532291;emit(util['format'](_0xb2a5('0x7f'),_0x29b0cf[_0xb2a5('0x45')]),'voice_queue:save',_0x29b0cf);}}}function emitCampaignSummary(_0x3b1753){if(_0x3b1753[_0xb2a5('0x51')]==='ivr'){emit(util[_0xb2a5('0x80')](_0xb2a5('0x81'),_0x3b1753['name']),'campaign:save',_0x3b1753);}}function checkGetDataPredictive(_0x426ddd){if(isNotNull(_0x426ddd)&&!_[_0xb2a5('0x82')](_0x426ddd)){loggerPredictive[_0xb2a5('0x83')](_0xb2a5('0x84'));loggerPredictive['info'](_0xb2a5('0x85'),_0x426ddd['predictiveIntervalTotalCalls']);loggerPredictive[_0xb2a5('0x83')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x426ddd[_0xb2a5('0x6f')]);loggerPredictive[_0xb2a5('0x83')](_0xb2a5('0x86'),_0x426ddd[_0xb2a5('0x72')]);loggerPredictive['info']('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x426ddd['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive['info'](_0xb2a5('0x87'),_0x426ddd['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xb2a5('0x83')](_0xb2a5('0x88'),_0x426ddd['predictiveIntervalAvgTalktime']);loggerPredictive[_0xb2a5('0x83')](_0xb2a5('0x89'));if(_0x426ddd[_0xb2a5('0x78')]>0x0){if(!_[_0xb2a5('0x42')](_0x426ddd[_0xb2a5('0x70')])&&_0x426ddd[_0xb2a5('0x70')]>0x0){return!![];}loggerPredictive[_0xb2a5('0x83')](_0xb2a5('0x8a'));if(!_[_0xb2a5('0x42')](_0x426ddd[_0xb2a5('0x8b')])&&_0x426ddd[_0xb2a5('0x8b')]>0x0){return!![];}loggerPredictive[_0xb2a5('0x83')](_0xb2a5('0x8c'));}else{loggerPredictive[_0xb2a5('0x83')](_0xb2a5('0x8d'));}}else{loggerPredictive[_0xb2a5('0x83')](_0xb2a5('0x8e'));}return![];}function mergeDataErlangB(_0x2320db){return function(_0x20b79f){loggerPredictive[_0xb2a5('0x83')](_0xb2a5('0x8f'));loggerPredictive[_0xb2a5('0x83')](_0xb2a5('0x90'),_0x20b79f[_0xb2a5('0x7a')]);loggerPredictive[_0xb2a5('0x83')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x20b79f[_0xb2a5('0x7b')]);loggerPredictive[_0xb2a5('0x83')](_0xb2a5('0x91'),_0x20b79f[_0xb2a5('0x92')]);loggerPredictive['info'](_0xb2a5('0x93'),_0x20b79f[_0xb2a5('0x7c')]);loggerPredictive[_0xb2a5('0x83')](_0xb2a5('0x91'),_0x20b79f[_0xb2a5('0x92')]);loggerPredictive[_0xb2a5('0x83')](_0xb2a5('0x89'));_[_0xb2a5('0x94')](_0x2320db,_0x20b79f);};}function getDiff(_0x4f70a1){var _0x1f4837=moment()['milliseconds'](0x0);var _0x241acd=moment(_0x4f70a1)[_0xb2a5('0x4f')](0x0);return _0x1f4837[_0xb2a5('0x95')](_0x241acd,'seconds');}function ifInterval(_0x28e18a,_0xda0662){if(_[_0xb2a5('0x42')](_0xda0662)){return![];}return getDiff(_0xda0662)<_0x28e18a*0x3c;}function freeVariablesPredictive(_0x49ae6d){if(isNotNull(_0x49ae6d)){if(!_[_0xb2a5('0x42')](_0x49ae6d[_0xb2a5('0x29')])){_0x49ae6d[_0xb2a5('0x29')]=undefined;loggerPredictive['info'](_0x49ae6d[_0xb2a5('0x45')],_0xb2a5('0x96'));}if(!_['isUndefined'](_0x49ae6d['startPredictive'])){_0x49ae6d[_0xb2a5('0x97')]=undefined;loggerPredictive['info'](_0x49ae6d[_0xb2a5('0x45')],_0xb2a5('0x98'));}if(!_[_0xb2a5('0x42')](_0x49ae6d[_0xb2a5('0x99')])){clearInterval(_0x49ae6d[_0xb2a5('0x99')]);_0x49ae6d['handlePredictive']=undefined;loggerPredictive[_0xb2a5('0x83')](_0x49ae6d[_0xb2a5('0x45')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x160f2c,_0x1be8b8){if(_0x1be8b8===0x0){return 0x0;}var _0x2e13b3=0x1;for(var _0x235d74=0x1;_0x235d74<=_0x1be8b8;_0x235d74+=0x1){_0x2e13b3=0x1+_0x2e13b3*_0x235d74/_0x160f2c;}return 0x1/_0x2e13b3;}function isVoiceQueueOutbound(_0x15fdb6){return _0x15fdb6===_0xb2a5('0x52');}function isNotPreview(_0x4866bc){return _0x4866bc!==_0xb2a5('0x1f');}function isCampaignIvr(_0x291172){return _0x291172===_0xb2a5('0x9a');}function getCallerId(_0x4642e3,_0x46a5db,_0x27b589){if(!_[_0xb2a5('0x42')](_0x27b589)&&typeof _0x27b589===_0xb2a5('0x9b')&&!_['isEmpty'](_0x27b589)){if(!_[_0xb2a5('0x42')](_0x46a5db)&&typeof _0x46a5db===_0xb2a5('0x9b')&&!_[_0xb2a5('0x82')](_0x46a5db)){return util[_0xb2a5('0x80')](_0xb2a5('0x9c'),_0x46a5db,_0x27b589);}return util['format'](_0xb2a5('0x9c'),_0x27b589,_0x27b589);}if(!_[_0xb2a5('0x42')](_0x4642e3)&&typeof _0x4642e3===_0xb2a5('0x9b')&&!_[_0xb2a5('0x82')](_0x4642e3)){return _0x4642e3;}return _0xb2a5('0x9d');}function loggerCatchQueueSummary(_0x29893e,_0x4b9e9a){return function(_0x26271f){freeVariablesPredictive(_0x4b9e9a);emitVoiceQueueSummary(_0x4b9e9a);emitCampaignSummary(_0x4b9e9a);loggerSyncQueueSummary[_0xb2a5('0x9e')](_0x29893e,util[_0xb2a5('0x9f')](_0x26271f,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x8cc8cd,_0x5080e2){return function(_0x4f90c8){loggerPredictive['error'](_0x5080e2[_0xb2a5('0x45')],_0x8cc8cd);loggerPredictive['error'](_0x4f90c8[_0xb2a5('0xa0')]);freeVariablesPredictive(_0x5080e2);};}function loggerCatch(_0x394f8d){return function(_0xb5b046){logger['error'](_0x394f8d,util[_0xb2a5('0x9f')](_0xb5b046,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x58072a){return _0x58072a&&!_[_0xb2a5('0x42')](_0x58072a)&&_0x58072a[_0xb2a5('0xa1')]>0x0;}function decremetOriginate(_0x1740b5){if(!_[_0xb2a5('0x42')](_0x1740b5)&&_0x1740b5!==null){if(typeof _0x1740b5[_0xb2a5('0x79')]!==_0xb2a5('0xa2')){if(_0x1740b5[_0xb2a5('0x79')]>0x0){_0x1740b5[_0xb2a5('0x79')]-=0x1;}else{logger[_0xb2a5('0x9e')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xb2a5('0x9e')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x4af23d,_0x19885b,_0x1a3c50){if(_0x19885b>_0x1a3c50){for(var _0x3f2dc1=0x0;_0x3f2dc1<_0x19885b-_0x1a3c50;_0x3f2dc1+=0x1){decremetOriginate(_0x4af23d);}}}function loggerGetContactDialer(_0x240ada,_0x4bb422,_0xf7d656){return function(_0x30c06b){checkContactLowerLimitOriginate(_0x4bb422,_0xf7d656,0x0);logger[_0xb2a5('0x9e')](_0x240ada,util[_0xb2a5('0x9f')](_0x30c06b,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x247fff){return function(_0x380f36){if(isNotNull(_0x380f36)&&isNotNull(_0x380f36[0x0])){if(_0x380f36[0x0][_0xb2a5('0xa3')]>0x0){_0x247fff[_0xb2a5('0x43')]=_0xb2a5('0xa4');logger[_0xb2a5('0x83')]('[getContactDialer2][ReScheduled]'+_0x247fff[_0xb2a5('0x45')],_0x380f36[0x0][_0xb2a5('0xa3')],_0xb2a5('0xa5'));}else{_0x247fff[_0xb2a5('0x43')]='AVAILABLE_CONTACTS_FINISHED';logger[_0xb2a5('0x83')](_0xb2a5('0xa6')+_0x247fff[_0xb2a5('0x45')]);}}};}function notSendMessagesQueue(_0x1755c7){if(_0x1755c7[_0xb2a5('0xa7')]){freeVariablesPredictive(_0x1755c7);if(_0x1755c7[_0xb2a5('0x79')]===0x0&&_0x1755c7[_0xb2a5('0x5a')]===0x0&&_0x1755c7[_0xb2a5('0x5d')]===0x0&&(_0x1755c7[_0xb2a5('0x56')]||0x0)===0x0){_0x1755c7[_0xb2a5('0xa7')]=![];_0x1755c7['available']=0x0;_0x1755c7['message']=_0xb2a5('0x47');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x1755c7[_0xb2a5('0x45')],_0xb2a5('0xa8'));}else{_0x1755c7['message']=_0xb2a5('0xa9');loggerSyncQueueSummary[_0xb2a5('0x9e')](_0xb2a5('0xaa'),_0x1755c7[_0xb2a5('0x45')],_0xb2a5('0xab'));}emitVoiceQueueSummary(_0x1755c7);}}function notSendMessagesCampaign(_0x3bd0b1){if(_0x3bd0b1[_0xb2a5('0xa7')]){if(_0x3bd0b1[_0xb2a5('0x79')]===0x0){_0x3bd0b1[_0xb2a5('0xa7')]=![];_0x3bd0b1['message']=_0xb2a5('0x47');loggerSyncQueueSummary[_0xb2a5('0x9e')](_0xb2a5('0xac'),_0x3bd0b1[_0xb2a5('0x45')],_0xb2a5('0xa8'));}else{_0x3bd0b1[_0xb2a5('0x43')]=_0xb2a5('0xa9');loggerSyncQueueSummary['error'](_0xb2a5('0xac'),_0x3bd0b1['name'],_0xb2a5('0xab'));}emitCampaignSummary(_0x3bd0b1);}}function createObjHistory(_0x47dfb4,_0x1d5391,_0x341ae7,_0x3e754c,_0x533707){_0x47dfb4[_0xb2a5('0x43')]=_0x341ae7;var _0x1219e6=new Action(_0x47dfb4,_0x1d5391);var _0x419c7d=new History(_0x1219e6);_0x419c7d[_0xb2a5('0xad')]=_0x3e754c;_0x419c7d[_0xb2a5('0xae')]=_0x533707;_0x419c7d['endtime']=_0x1219e6[_0xb2a5('0xaf')];return _0x419c7d;}Dialer['prototype']['loopClearZombieChannels']=function(){var _0xa06993=this;setInterval(function(){_0xa06993[_0xb2a5('0xb0')](_0xa06993[_0xb2a5('0x27')],_0xb2a5('0xb1'));_0xa06993['clearZombieChannels'](_0xa06993[_0xb2a5('0xb2')],'[actions]');},0x32c8);};Dialer[_0xb2a5('0x1b')][_0xb2a5('0xb0')]=function(_0x5da42c,_0x345852){var _0x29139c=this;for(var _0x2e7a7d in _0x5da42c){if(typeof _0x5da42c[_0x2e7a7d]!==_0xb2a5('0xa2')){this[_0xb2a5('0x1e')][_0xb2a5('0xb3')](function(){if(!_['isNil'](_0x5da42c[_0x2e7a7d])){return ami[_0xb2a5('0xb4')]({'action':_0xb2a5('0xb5'),'channel':_0x5da42c[_0x2e7a7d][_0xb2a5('0xb6')]})['catch'](function(_0x4d3d49){if(_0x4d3d49['message']===_0xb2a5('0xb7')){setTimeout(function(){if(_0x5da42c[_0x2e7a7d]&&_0x5da42c[_0x2e7a7d]['type']!==_0xb2a5('0x9a')){_0x29139c['updateOriginated'](_0x29139c[_0xb2a5('0x20')][_0x5da42c[_0x2e7a7d][_0xb2a5('0xb8')]]);logger['error'](_0xb2a5('0xb9'),_0x345852,_0x2e7a7d,_0x5da42c[_0x2e7a7d][_0xb2a5('0xb8')]);delete _0x5da42c[_0x2e7a7d];}if(_0x5da42c[_0x2e7a7d]&&_0x5da42c[_0x2e7a7d]['type']==='ivr'){_0x29139c[_0xb2a5('0xba')](_0x29139c[_0xb2a5('0x21')][_0x5da42c[_0x2e7a7d]['queue']]);logger[_0xb2a5('0x9e')]('[Dialer][checkChannel][ivr]',_0x345852,_0x2e7a7d,_0x5da42c[_0x2e7a7d][_0xb2a5('0xb8')]);delete _0x5da42c[_0x2e7a7d];}},0x2328);}});}});}}};Dialer[_0xb2a5('0x1b')]['countReScheduled']=function(_0x27bb73){return BPromise['resolve']()[_0xb2a5('0xbb')](cmHopper[_0xb2a5('0xbc')](_0x27bb73))[_0xb2a5('0xbd')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0xb2a5('0x1b')][_0xb2a5('0xbe')]=function(_0xac6c68){return BPromise[_0xb2a5('0xbf')]()[_0xb2a5('0xbb')](cmHopperBlack[_0xb2a5('0xbe')](_0xac6c68))[_0xb2a5('0xbd')](loggerCatch(_0xb2a5('0xc0')));};Dialer[_0xb2a5('0x1b')]['checkIsBlackListIvr']=function(_0x3e9872){return BPromise[_0xb2a5('0xbf')]()[_0xb2a5('0xbb')](cmHopperBlack['checkIsBlackListIvr'](_0x3e9872))[_0xb2a5('0xbd')](loggerCatch(_0xb2a5('0xc1')));};Dialer[_0xb2a5('0x1b')]['averageHandleTime']=function(_0xee1c9e){return BPromise['resolve']()['then'](cmHopperHistory['avgHandleTime'](_0xee1c9e))[_0xb2a5('0xbd')](loggerCatch(_0xb2a5('0xc2')));};Dialer[_0xb2a5('0x1b')][_0xb2a5('0xc3')]=function(_0x3aa88d){return BPromise[_0xb2a5('0xbf')]()['then'](cmHopper[_0xb2a5('0xc3')](_0x3aa88d))[_0xb2a5('0xbd')](loggerCatch(_0xb2a5('0xc4')));};Dialer[_0xb2a5('0x1b')][_0xb2a5('0xc5')]=function(_0x308b1f,_0x4cb70d,_0x1ae726){return BPromise[_0xb2a5('0xbf')]()[_0xb2a5('0xbb')](cmHopper['unlockContact'](_0x308b1f,_0x4cb70d,_0x1ae726))[_0xb2a5('0xbd')](loggerCatch(_0xb2a5('0xc6')));};Dialer[_0xb2a5('0x1b')][_0xb2a5('0xc7')]=function(_0x57301f,_0x2b03be,_0xa79a17,_0x21a07b,_0x59df70){return BPromise[_0xb2a5('0xbf')]()[_0xb2a5('0xbb')](cmHopper['getContactDialer'](_0x57301f,_0x2b03be,_0xa79a17,_0x21a07b))[_0xb2a5('0xbd')](function(_0x2c58ee){_0x59df70[_0xb2a5('0xc8')]-=_0xa79a17;_0x59df70[_0xb2a5('0xc8')]=_0x59df70[_0xb2a5('0xc8')]>0x0?_0x59df70[_0xb2a5('0xc8')]:0x0;loggerCatch(_0xb2a5('0xc9'))(_0x2c58ee);});};Dialer[_0xb2a5('0x1b')][_0xb2a5('0xca')]=function(_0x1fe25d,_0x268f5c,_0x1099f8,_0x2e30a){return BPromise[_0xb2a5('0xbf')]()[_0xb2a5('0xbb')](cmHopper[_0xb2a5('0xca')](_0x1fe25d,_0x268f5c,_0x1099f8))[_0xb2a5('0xbd')](function(_0x3be23f){_0x2e30a[_0xb2a5('0xc8')]-=_0x268f5c;_0x2e30a['temp']=_0x2e30a[_0xb2a5('0xc8')]>0x0?_0x2e30a[_0xb2a5('0xc8')]:0x0;loggerCatch(_0xb2a5('0xcb'))(_0x3be23f);});};Dialer[_0xb2a5('0x1b')][_0xb2a5('0xcc')]=function(_0x4ae1c9){return BPromise['resolve']()[_0xb2a5('0xbb')](voiceQueueRt[_0xb2a5('0xcc')](_0x4ae1c9))[_0xb2a5('0xbd')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0xb2a5('0x1b')][_0xb2a5('0xcd')]=function(_0x575463){return BPromise['resolve']()[_0xb2a5('0xbb')](cmHopper[_0xb2a5('0xcd')](_0x575463))[_0xb2a5('0xbd')](loggerCatch(_0xb2a5('0xce')));};Dialer[_0xb2a5('0x1b')][_0xb2a5('0xcf')]=function(_0x4cc982){return BPromise[_0xb2a5('0xbf')]()['then'](cmHopperHistory[_0xb2a5('0xcf')](_0x4cc982))[_0xb2a5('0xbd')](loggerCatch(_0xb2a5('0xd0')));};Dialer[_0xb2a5('0x1b')][_0xb2a5('0xba')]=function(_0x610e8d){if(!_[_0xb2a5('0x42')](_0x610e8d)&&_0x610e8d!==null){if(typeof _0x610e8d['originated']!==_0xb2a5('0xa2')){if(_0x610e8d[_0xb2a5('0x79')]>0x0){_0x610e8d['originated']-=0x1;}else{logger[_0xb2a5('0x9e')](_0xb2a5('0xd1'));}}}else{logger[_0xb2a5('0x9e')](_0xb2a5('0xd2'));}};Dialer['prototype'][_0xb2a5('0xd3')]=function(_0x4c6a58,_0x89b32b){var _0x34693b=this;return function(_0x998fe8){_0x34693b[_0xb2a5('0xba')](_0x89b32b);logger['error'](_0x4c6a58,util[_0xb2a5('0x9f')](_0x998fe8,{'showHidden':![],'depth':null}));};};Dialer[_0xb2a5('0x1b')]['emptyContact']=function(_0x1c061a,_0x138829,_0x182953){var _0x56190b={'state':0x19,'statedesc':_0xb2a5('0xd4')};this[_0xb2a5('0xba')](_0x138829);this[_0xb2a5('0xd5')](_[_0xb2a5('0x94')](_0x56190b,_[_0xb2a5('0xd6')](_0x182953,['ContactId',_0xb2a5('0xd7'),_0xb2a5('0xd8'),'VoiceQueueId',_0xb2a5('0xd9')])),_0xb2a5('0xda'),'[emptyContact]');logger[_0xb2a5('0x9e')](_0x1c061a);};Dialer[_0xb2a5('0x1b')][_0xb2a5('0xdb')]=function(_0x484c43){return _0x484c43===_0xb2a5('0xdc');};Dialer[_0xb2a5('0x1b')][_0xb2a5('0xdd')]=function(_0x12c028){return!_[_0xb2a5('0x42')](_0x12c028)&&_0x12c028&&!_[_0xb2a5('0x42')](_0x12c028[_0xb2a5('0x45')])&&!_[_0xb2a5('0x42')](_0x12c028['active'])&&_0x12c028[_0xb2a5('0x7e')]&&(this[_0xb2a5('0x23')][util[_0xb2a5('0x80')](_0xb2a5('0xde'),_0x12c028[_0xb2a5('0x45')])]['status']===_0xb2a5('0xdf')||this[_0xb2a5('0x23')][util[_0xb2a5('0x80')]('SIP/%s',_0x12c028[_0xb2a5('0x45')])][_0xb2a5('0xb5')]===_0xb2a5('0xe0'));};Dialer[_0xb2a5('0x1b')]['saveInDb']=function(_0x4acd22,_0x195b68,_0xb14d63){this[_0xb2a5('0xcf')](_0x4acd22)[_0xb2a5('0xbd')](loggerCatch(_0x195b68));this[_0xb2a5('0xcd')](_0x4acd22)[_0xb2a5('0xbd')](loggerCatch(_0xb14d63));};Dialer[_0xb2a5('0x1b')]['syncVarSet']=function(_0x41b27f){var _0x5a01df=this[_0xb2a5('0x27')][_0x41b27f[_0xb2a5('0xe1')]];var _0x56d39a;if(!_[_0xb2a5('0xe2')](_0x41b27f)&&!_[_0xb2a5('0xe2')](_0x41b27f['variable'])&&!_[_0xb2a5('0xe2')](_0x41b27f[_0xb2a5('0xe3')][_0xb2a5('0xe4')])&&_0x41b27f['exten']===_0xb2a5('0xe5')&&_0x5a01df){if(_0x5a01df[_0xb2a5('0x51')]!=='ivr'&&this['voiceQueues'][_0x5a01df[_0xb2a5('0xb8')]]['dialAMDActive']&&_0x41b27f[_0xb2a5('0xe6')]==='HANGUP'){delete this[_0xb2a5('0x27')][_0x41b27f[_0xb2a5('0xe1')]];this['updateOriginated'](this[_0xb2a5('0x20')][_0x5a01df[_0xb2a5('0xb8')]]);this[_0xb2a5('0x20')][_0x5a01df['queue']][_0xb2a5('0x65')]+=0x1;this[_0xb2a5('0x20')][_0x5a01df[_0xb2a5('0xb8')]]['outboundAnswerAgiCallsDay']+=0x1;_0x56d39a=new Hangup(_0x5a01df,_0x41b27f);_0x56d39a[_0xb2a5('0xad')]=0x12;_0x56d39a[_0xb2a5('0xae')]='HangupInAMD';_0x56d39a[_0xb2a5('0xe7')]=_0xb2a5('0xe8');ami['emit']('custom:amd',ut[_0xb2a5('0xe9')](_0x56d39a,'amd'));this[_0xb2a5('0xd5')](_0x56d39a,'[syncHangupInAMD][createHistory]',_0xb2a5('0xea'));}if(_0x5a01df[_0xb2a5('0x51')]!==_0xb2a5('0x9a')&&this[_0xb2a5('0x20')][_0x5a01df['queue']][_0xb2a5('0xeb')]&&_0x41b27f[_0xb2a5('0xe6')]===_0xb2a5('0xec')){var _0x26fdb5=this;return new BPromise(function(_0x509b59,_0x1f78c5){delete _0x26fdb5[_0xb2a5('0x27')][_0x41b27f['uniqueid']];_0x26fdb5[_0xb2a5('0xba')](_0x26fdb5[_0xb2a5('0x20')][_0x5a01df[_0xb2a5('0xb8')]]);_0x26fdb5[_0xb2a5('0x20')][_0x5a01df[_0xb2a5('0xb8')]][_0xb2a5('0x65')]+=0x1;_0x26fdb5['voiceQueues'][_0x5a01df[_0xb2a5('0xb8')]][_0xb2a5('0x64')]+=0x1;var _0x2b2ddb=_0x26fdb5[_0xb2a5('0x20')][_0x5a01df[_0xb2a5('0xb8')]];var _0x3a514e=new Hangup(_0x5a01df,_0x41b27f);_0x3a514e['state']=0x13;_0x3a514e[_0xb2a5('0xae')]=_0xb2a5('0xed');_0x3a514e[_0xb2a5('0xe7')]=_0xb2a5('0xe8');_0x3a514e[_0xb2a5('0xee')]+=0x1;_0x3a514e[_0xb2a5('0xef')]+=0x1;_0x3a514e['amd']=!![];ami[_0xb2a5('0x50')](_0xb2a5('0xf0'),ut['buildObj'](_0x3a514e,'amd'));_0x26fdb5[_0xb2a5('0xcf')](_0x3a514e)[_0xb2a5('0xbd')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x3a514e[_0xb2a5('0xf1')]+_0x3a514e[_0xb2a5('0xf2')]+_0x3a514e[_0xb2a5('0xf3')]+_0x3a514e[_0xb2a5('0xf4')]+_0x3a514e[_0xb2a5('0xf5')]+_0x3a514e[_0xb2a5('0xf6')]+_0x3a514e[_0xb2a5('0xee')]+_0x3a514e['countagentrejectretry']>=_0x2b2ddb[_0xb2a5('0xf7')]){_0x26fdb5[_0xb2a5('0xf8')](_0x3a514e,_0x509b59,_0x1f78c5,'reason19\x20machine....');}else{if(_0x3a514e['countmachineretry']>=_0x2b2ddb['dialMachineMaxRetry']){_0x26fdb5[_0xb2a5('0xf9')](_0x3a514e,_0x509b59,_0x1f78c5,_0xb2a5('0xfa'));}else{_0x26fdb5[_0xb2a5('0xc3')]({'active':![],'countmachineretry':_0x3a514e[_0xb2a5('0xee')],'scheduledat':moment()[_0xb2a5('0xfb')](_0x2b2ddb[_0xb2a5('0xfc')],_0xb2a5('0xfd'))['format'](_0xb2a5('0xfe')),'ContactId':_0x3a514e[_0xb2a5('0xff')],'ListId':_0x3a514e[_0xb2a5('0xd7')],'VoiceQueueId':_0x3a514e[_0xb2a5('0x100')]||undefined,'CampaignId':_0x3a514e['CampaignId']||undefined})[_0xb2a5('0xbd')](loggerCatch(_0xb2a5('0x101')));_0x509b59({'reschedule':0x1});}}});}if(_0x5a01df[_0xb2a5('0x51')]===_0xb2a5('0x9a')&&this[_0xb2a5('0x21')][_0x5a01df[_0xb2a5('0xb8')]][_0xb2a5('0xeb')]&&_0x41b27f[_0xb2a5('0xe6')]===_0xb2a5('0x102')){delete this[_0xb2a5('0x27')][_0x41b27f[_0xb2a5('0xe1')]];this[_0xb2a5('0xba')](this['campaigns'][_0x5a01df['queue']]);_0x56d39a=new Hangup(_0x5a01df,_0x41b27f);_0x56d39a[_0xb2a5('0xad')]=0x12;_0x56d39a[_0xb2a5('0xae')]=_0xb2a5('0x103');_0x56d39a[_0xb2a5('0xe7')]=_0xb2a5('0xe8');ami[_0xb2a5('0x50')]('custom:amd',ut[_0xb2a5('0xe9')](_0x56d39a,_0xb2a5('0x104')));this[_0xb2a5('0xd5')](_0x56d39a,_0xb2a5('0x105'),_0xb2a5('0x106'));}if(_0x5a01df[_0xb2a5('0x51')]===_0xb2a5('0x9a')&&this[_0xb2a5('0x21')][_0x5a01df[_0xb2a5('0xb8')]][_0xb2a5('0xeb')]&&_0x41b27f[_0xb2a5('0xe6')]==='MACHINE'){var _0x26fdb5=this;return new BPromise(function(_0x34c7f7,_0x1732c5){delete _0x26fdb5[_0xb2a5('0x27')][_0x41b27f['uniqueid']];_0x26fdb5[_0xb2a5('0xba')](_0x26fdb5[_0xb2a5('0x21')][_0x5a01df[_0xb2a5('0xb8')]]);_0x26fdb5['campaigns'][_0x5a01df[_0xb2a5('0xb8')]][_0xb2a5('0x65')]+=0x1;_0x26fdb5[_0xb2a5('0x21')][_0x5a01df[_0xb2a5('0xb8')]][_0xb2a5('0x64')]+=0x1;var _0x2a2fdc=_0x26fdb5[_0xb2a5('0x21')][_0x5a01df['queue']];var _0xd8605b=new Hangup(_0x5a01df,_0x41b27f);_0xd8605b[_0xb2a5('0xad')]=0x13;_0xd8605b[_0xb2a5('0xae')]=_0xb2a5('0xed');_0xd8605b[_0xb2a5('0xe7')]=_0xb2a5('0xe8');_0xd8605b[_0xb2a5('0xee')]+=0x1;_0xd8605b[_0xb2a5('0xef')]+=0x1;_0xd8605b['amd']=!![];ami['emit']('custom:amd',ut[_0xb2a5('0xe9')](_0xd8605b,_0xb2a5('0x104')));_0x26fdb5[_0xb2a5('0xcf')](_0xd8605b)[_0xb2a5('0xbd')](loggerCatch(_0xb2a5('0x107')));if(_0xd8605b['countbusyretry']+_0xd8605b[_0xb2a5('0xf2')]+_0xd8605b[_0xb2a5('0xf3')]+_0xd8605b[_0xb2a5('0xf4')]+_0xd8605b[_0xb2a5('0xf5')]+_0xd8605b[_0xb2a5('0xf6')]+_0xd8605b[_0xb2a5('0xee')]+_0xd8605b['countagentrejectretry']>=_0x2a2fdc[_0xb2a5('0xf7')]){_0x26fdb5[_0xb2a5('0xf8')](_0xd8605b,_0x34c7f7,_0x1732c5,_0xb2a5('0x108'));}else{if(_0xd8605b['countmachineretry']>=_0x2a2fdc['dialMachineMaxRetry']){_0x26fdb5['createStateFinal'](_0xd8605b,_0x34c7f7,_0x1732c5,'reason\x2019\x20machine....');}else{_0x26fdb5[_0xb2a5('0xc3')]({'active':![],'countmachineretry':_0xd8605b[_0xb2a5('0xee')],'scheduledat':moment()['add'](_0x2a2fdc['dialMachineRetryFrequency'],_0xb2a5('0xfd'))[_0xb2a5('0x80')](_0xb2a5('0xfe')),'ContactId':_0xd8605b[_0xb2a5('0xff')],'ListId':_0xd8605b[_0xb2a5('0xd7')],'VoiceQueueId':_0xd8605b[_0xb2a5('0x100')]||undefined,'CampaignId':_0xd8605b['CampaignId']||undefined})[_0xb2a5('0xbd')](loggerCatch(_0xb2a5('0x101')));_0x34c7f7({'reschedule':0x1});}}});}}};Dialer[_0xb2a5('0x1b')][_0xb2a5('0x38')]=function(_0x4ded8d){var _0x4ca0d6=this[_0xb2a5('0x27')][_0x4ded8d['uniqueid']];var _0x52dcb1=this;var _0x2140cd;if(_0x4ca0d6&&_0x4ca0d6[_0xb2a5('0x51')]===_0xb2a5('0x9a')){delete this[_0xb2a5('0x27')][_0x4ded8d[_0xb2a5('0xe1')]];this[_0xb2a5('0xba')](this[_0xb2a5('0x21')][_0x4ca0d6[_0xb2a5('0xb8')]]);this['campaigns'][_0x4ca0d6[_0xb2a5('0xb8')]]['ivrAnswerCallsDay']+=0x1;_0x2140cd=new Hangup(_0x4ca0d6,_0x4ded8d);this[_0xb2a5('0xcf')](_0x2140cd)[_0xb2a5('0xbd')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xb2a5('0xcd')](_0x2140cd)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x4ca0d6&&_0x4ca0d6[_0xb2a5('0x51')]!==_0xb2a5('0x9a')&&isNotNull(this[_0xb2a5('0x20')][_0x4ca0d6[_0xb2a5('0xb8')]]['dialQueueProject'])){delete this[_0xb2a5('0x27')][_0x4ded8d['uniqueid']];this[_0xb2a5('0xba')](this[_0xb2a5('0x20')][_0x4ca0d6[_0xb2a5('0xb8')]]);this[_0xb2a5('0x20')][_0x4ca0d6[_0xb2a5('0xb8')]][_0xb2a5('0x65')]+=0x1;this[_0xb2a5('0x20')][_0x4ca0d6['queue']][_0xb2a5('0x64')]+=0x1;_0x2140cd=new Hangup(_0x4ca0d6,_0x4ded8d);_0x2140cd['state']=0x10;_0x2140cd['statedesc']=_0xb2a5('0x109');_0x2140cd['membername']=_0xb2a5('0x10a');this[_0xb2a5('0xcf')](_0x2140cd)['catch'](loggerCatch(_0xb2a5('0x10b')));this['moveContactManagedDialer'](_0x2140cd)[_0xb2a5('0xbd')](loggerCatch(_0xb2a5('0x10c')));}if(_0x4ca0d6&&_0x4ca0d6[_0xb2a5('0x51')]!==_0xb2a5('0x9a')&&!isNotNull(this['voiceQueues'][_0x4ca0d6['queue']][_0xb2a5('0x10d')])){delete this[_0xb2a5('0x27')][_0x4ded8d[_0xb2a5('0xe1')]];this[_0xb2a5('0xba')](this[_0xb2a5('0x20')][_0x4ca0d6[_0xb2a5('0xb8')]]);this[_0xb2a5('0x20')][_0x4ca0d6['queue']][_0xb2a5('0x6e')]+=0x1;_0x2140cd=new Hangup(_0x4ca0d6,_0x4ded8d);_0x2140cd[_0xb2a5('0xad')]=0xc;_0x2140cd[_0xb2a5('0xae')]=_0x4ded8d['cause-txt'];_0x2140cd['membername']='Unknow';this[_0xb2a5('0xcf')](_0x2140cd)[_0xb2a5('0xbd')](loggerCatch(_0xb2a5('0x10b')));this['moveContactManagedDialer'](_0x2140cd)[_0xb2a5('0xbd')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0xb2a5('0x1b')]['syncAgentComplete']=function(_0x4c373d){var _0x1ecb51=this['uniqueId'][_0x4c373d['uniqueid']];var _0x4052e1=this;if(this[_0xb2a5('0x20')][_0x4c373d[_0xb2a5('0xb8')]]){if(_0x1ecb51&&_0x1ecb51[_0xb2a5('0x51')]!==_0xb2a5('0x9a')){delete this[_0xb2a5('0x27')][_0x4c373d[_0xb2a5('0xe1')]];this[_0xb2a5('0x20')][_0x4c373d['queue']][_0xb2a5('0x65')]+=0x1;var _0x5938e1=new AgentComplete(_0x1ecb51,_0x4c373d);if(_0x4c373d['reason']===_0xb2a5('0x10e')){_0x5938e1[_0xb2a5('0x10f')]=this[_0xb2a5('0x20')][_0x4c373d['queue']][_0xb2a5('0x110')]&&this[_0xb2a5('0x20')][_0x4c373d[_0xb2a5('0xb8')]][_0xb2a5('0x111')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0xb2a5('0xcf')](_0x5938e1)['catch'](loggerCatch(_0xb2a5('0x112')));this[_0xb2a5('0xcd')](_0x5938e1)[_0xb2a5('0xbd')](loggerCatch(_0xb2a5('0x113')));}}};Dialer[_0xb2a5('0x1b')][_0xb2a5('0x2d')]=function(_0x22e2d5){if(this[_0xb2a5('0x20')][_0x22e2d5[_0xb2a5('0xb8')]]){if(this[_0xb2a5('0x27')][_0x22e2d5[_0xb2a5('0xe1')]]&&this[_0xb2a5('0x27')][_0x22e2d5[_0xb2a5('0xe1')]]['type']!==_0xb2a5('0x9a')){this[_0xb2a5('0xba')](this['voiceQueues'][_0x22e2d5[_0xb2a5('0xb8')]]);this['uniqueId'][_0x22e2d5['uniqueid']][_0xb2a5('0x114')]=moment()[_0xb2a5('0x80')](_0xb2a5('0xfe'));}}};Dialer[_0xb2a5('0x1b')][_0xb2a5('0x115')]=function(_0x35efa1){this['createHistory'](_0x35efa1)['catch'](loggerCatch(_0xb2a5('0x112')));this[_0xb2a5('0xcd')](_0x35efa1)[_0xb2a5('0xbd')](loggerCatch(_0xb2a5('0x116')));};Dialer[_0xb2a5('0x1b')][_0xb2a5('0x30')]=function(_0xf81cbb){var _0x19156c=this[_0xb2a5('0x27')][_0xf81cbb['uniqueid']];var _0x7994b7=this;if(this[_0xb2a5('0x20')][_0xf81cbb[_0xb2a5('0xb8')]]){if(_0x19156c&&_0x19156c[_0xb2a5('0x51')]!==_0xb2a5('0x9a')){delete this['uniqueId'][_0xf81cbb['uniqueid']];this[_0xb2a5('0xba')](this['voiceQueues'][_0xf81cbb[_0xb2a5('0xb8')]]);_0x19156c['droptime']=moment()[_0xb2a5('0x80')](_0xb2a5('0xfe'));var _0x27295e=new QueueCallerAbandon(_0x19156c,_0xf81cbb);if(getSeconds(_0x19156c[_0xb2a5('0x117')],_0x19156c[_0xb2a5('0x118')])>=_0x19156c['dialQueueTimeout']){this['voiceQueues'][_0xf81cbb[_0xb2a5('0xb8')]][_0xb2a5('0x72')]+=0x1;this[_0xb2a5('0x20')][_0xf81cbb[_0xb2a5('0xb8')]][_0xb2a5('0x69')]+=0x1;this[_0xb2a5('0x20')][_0xf81cbb[_0xb2a5('0xb8')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x27295e['state']=0xa;_0x27295e[_0xb2a5('0xae')]='Drop';_0x27295e[_0xb2a5('0x119')]=_0xb2a5('0x11a');_0x27295e[_0xb2a5('0x10f')]=this[_0xb2a5('0x20')][_0xf81cbb[_0xb2a5('0xb8')]][_0xb2a5('0x110')]?moment()[_0xb2a5('0x80')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x27295e[_0xb2a5('0xf5')]+=0x1;_0x27295e[_0xb2a5('0xef')]+=0x1;if(_0x27295e[_0xb2a5('0xf5')]>=this[_0xb2a5('0x20')][_0xf81cbb[_0xb2a5('0xb8')]][_0xb2a5('0x11b')]){this[_0xb2a5('0x115')](_0x27295e);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x27295e[_0xb2a5('0xf5')],'scheduledat':moment()[_0xb2a5('0xfb')](this['voiceQueues'][_0xf81cbb[_0xb2a5('0xb8')]][_0xb2a5('0x11c')],_0xb2a5('0xfd'))[_0xb2a5('0x80')](_0xb2a5('0xfe')),'ContactId':_0x19156c[_0xb2a5('0xff')],'ListId':_0x19156c[_0xb2a5('0xd7')],'VoiceQueueId':_0x19156c[_0xb2a5('0x100')]||undefined,'CampaignId':_0x19156c[_0xb2a5('0xd9')]||undefined})[_0xb2a5('0xbd')](loggerCatch(_0xb2a5('0x11d')));var _0x2e1a50=new History(_0x27295e);_0x2e1a50[_0xb2a5('0xad')]=0xa;_0x2e1a50[_0xb2a5('0xae')]=_0xb2a5('0x11e');_0x2e1a50[_0xb2a5('0xaf')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2e1a50[_0xb2a5('0x11f')]=_0x2e1a50[_0xb2a5('0xaf')];_0x2e1a50['calleridname']=_0x27295e[_0xb2a5('0x120')];_0x2e1a50[_0xb2a5('0x121')]=_0x27295e[_0xb2a5('0x121')];this[_0xb2a5('0xcf')](_0x2e1a50)[_0xb2a5('0xbd')](loggerCatch(_0xb2a5('0x122')));}}else{this['voiceQueues'][_0xf81cbb[_0xb2a5('0xb8')]][_0xb2a5('0x71')]+=0x1;this[_0xb2a5('0x20')][_0xf81cbb[_0xb2a5('0xb8')]]['outboundDropCallsDayCallersExit']+=0x1;_0x27295e[_0xb2a5('0xad')]=0xb;_0x27295e['statedesc']=_0xb2a5('0x123');_0x27295e[_0xb2a5('0x119')]=_0xb2a5('0x124');_0x27295e[_0xb2a5('0xf6')]+=0x1;_0x27295e[_0xb2a5('0xef')]+=0x1;if(_0x27295e[_0xb2a5('0xf6')]>=this[_0xb2a5('0x20')][_0xf81cbb['queue']]['dialAbandonedMaxRetry']){this[_0xb2a5('0x115')](_0x27295e);}else{this[_0xb2a5('0xc3')]({'active':![],'countabandonedretry':_0x27295e[_0xb2a5('0xf6')],'scheduledat':moment()[_0xb2a5('0xfb')](this[_0xb2a5('0x20')][_0xf81cbb[_0xb2a5('0xb8')]][_0xb2a5('0x125')],_0xb2a5('0xfd'))[_0xb2a5('0x80')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x19156c[_0xb2a5('0xff')],'ListId':_0x19156c[_0xb2a5('0xd7')],'VoiceQueueId':_0x19156c[_0xb2a5('0x100')]||undefined,'CampaignId':_0x19156c[_0xb2a5('0xd9')]||undefined})['catch'](loggerCatch(_0xb2a5('0x126')));var _0x2e1a50=new History(_0x27295e);_0x2e1a50[_0xb2a5('0xad')]=0xb;_0x2e1a50[_0xb2a5('0xae')]=_0xb2a5('0x123');_0x2e1a50['starttime']=moment()[_0xb2a5('0x80')](_0xb2a5('0xfe'));_0x2e1a50['endtime']=_0x2e1a50[_0xb2a5('0xaf')];_0x2e1a50[_0xb2a5('0x120')]=_0x27295e[_0xb2a5('0x120')];_0x2e1a50[_0xb2a5('0x121')]=_0x27295e[_0xb2a5('0x121')];this['createHistory'](_0x2e1a50)[_0xb2a5('0xbd')](loggerCatch(_0xb2a5('0x127')));}}}}};Dialer['prototype']['syncNewExten']=function(_0x454090){if(this[_0xb2a5('0xb2')][_0x454090['uniqueid']]){this[_0xb2a5('0xb2')][_0x454090[_0xb2a5('0xe1')]][_0xb2a5('0xb6')]=_0x454090[_0xb2a5('0xb6')];}if(this[_0xb2a5('0x27')][_0x454090[_0xb2a5('0xe1')]]){this['uniqueId'][_0x454090[_0xb2a5('0xe1')]]['channel']=_0x454090[_0xb2a5('0xb6')];}};Dialer[_0xb2a5('0x1b')][_0xb2a5('0x3d')]=function(_0x780744){if(strategy[this['voiceQueues'][this[_0xb2a5('0xb2')][_0x780744['actionid']][_0xb2a5('0xb8')]]['strategy']]===_0xb2a5('0x128')){if(this['actions'][_0x780744[_0xb2a5('0x129')]]&&_[_0xb2a5('0xe2')](this[_0xb2a5('0xb2')][_0x780744['actionid']][_0xb2a5('0x12a')])&&_0x780744[_0xb2a5('0xb5')]==='1'&&_0x780744[_0xb2a5('0x12b')]==='0'){if(this[_0xb2a5('0x22')][_0x780744['stateinterface']]){if(!this['agents'][_0x780744[_0xb2a5('0x12c')]][_0xb2a5('0x12a')]){this['agents'][_0x780744[_0xb2a5('0x12c')]][_0xb2a5('0x12a')]=!![];this['actions'][_0x780744[_0xb2a5('0x129')]][_0xb2a5('0x12a')]=!![];this[_0xb2a5('0xb2')][_0x780744[_0xb2a5('0x129')]]['stateinterface']=_0x780744['stateinterface'];}}}}else if((strategy[this[_0xb2a5('0x20')][this[_0xb2a5('0xb2')][_0x780744[_0xb2a5('0x129')]][_0xb2a5('0xb8')]]['strategy']]||'rrmemory')===_0xb2a5('0x12d')){if(this['actions'][_0x780744[_0xb2a5('0x129')]]){if(this[_0xb2a5('0x22')][_0x780744[_0xb2a5('0x12c')]]){this['actions'][_0x780744['actionid']][_0xb2a5('0x12c')]=_0x780744[_0xb2a5('0x12c')];if(_[_0xb2a5('0xe2')](this[_0xb2a5('0x2a')][this[_0xb2a5('0xb2')][_0x780744['actionid']][_0xb2a5('0xb8')]])){this[_0xb2a5('0x2a')][this[_0xb2a5('0xb2')][_0x780744[_0xb2a5('0x129')]][_0xb2a5('0xb8')]]=[];}this[_0xb2a5('0x2a')][this[_0xb2a5('0xb2')][_0x780744[_0xb2a5('0x129')]]['queue']][_0xb2a5('0x12e')](_['merge'](_[_0xb2a5('0xd6')](this[_0xb2a5('0xb2')][_0x780744[_0xb2a5('0x129')]],[_0xb2a5('0x12f'),_0xb2a5('0x12c')]),{'status':_0x780744[_0xb2a5('0xb5')],'paused':_0x780744[_0xb2a5('0x12b')]}));}}}};function unlockQueueStatus(_0x416ed5,_0x2bcdb1){setTimeout(function(){if(_[_0xb2a5('0x42')](_0x416ed5[_0xb2a5('0x130')])){loggerBooked[_0xb2a5('0x9e')]('[unlockQueueStatus][undefined]',_0x2bcdb1);}_0x416ed5['queueStatusComplete']=!![];loggerBooked['info'](_0xb2a5('0x131'),_0x2bcdb1,JSON['stringify'](_[_0xb2a5('0xd6')](_0x416ed5,[_0xb2a5('0x45'),_0xb2a5('0x130')])));},0x1f3);}Dialer[_0xb2a5('0x1b')][_0xb2a5('0x3f')]=function(_0x429774){var _0x5ee09e=this;var _0x1e35f6=_0x5ee09e[_0xb2a5('0x20')][_0x5ee09e[_0xb2a5('0xb2')][_0x429774[_0xb2a5('0x129')]][_0xb2a5('0xb8')]];if(strategy[this[_0xb2a5('0x20')][this[_0xb2a5('0xb2')][_0x429774['actionid']][_0xb2a5('0xb8')]][_0xb2a5('0x53')]]===_0xb2a5('0x128')){if(this[_0xb2a5('0xb2')][_0x429774['actionid']]&&this[_0xb2a5('0xb2')][_0x429774['actionid']][_0xb2a5('0x12c')]){this[_0xb2a5('0x1f')][_0xb2a5('0x132')](this[_0xb2a5('0xb2')][_0x429774[_0xb2a5('0x129')]][_0xb2a5('0x12f')],this[_0xb2a5('0xb2')][_0x429774['actionid']][_0xb2a5('0x12c')])[_0xb2a5('0xbd')](function(_0x4ede6f){logger[_0xb2a5('0x9e')]('[Catch][Preview][syncQueueStatusComplete]',util[_0xb2a5('0x9f')](_0x4ede6f,{'showHidden':![],'depth':null}));})['finally'](function(){_0x5ee09e[_0xb2a5('0xba')](_0x5ee09e[_0xb2a5('0x20')][_0x5ee09e[_0xb2a5('0xb2')][_0x429774[_0xb2a5('0x129')]][_0xb2a5('0xb8')]]);_0x5ee09e['agents'][_0x5ee09e[_0xb2a5('0xb2')][_0x429774[_0xb2a5('0x129')]][_0xb2a5('0x12c')]]['locked']=![];delete _0x5ee09e['actions'][_0x429774['actionid']];unlockQueueStatus(_0x1e35f6);});}else{this[_0xb2a5('0xba')](this[_0xb2a5('0x20')][this[_0xb2a5('0xb2')][_0x429774[_0xb2a5('0x129')]]['queue']]);this[_0xb2a5('0xc3')]({'active':![],'ContactId':this[_0xb2a5('0xb2')][_0x429774[_0xb2a5('0x129')]][_0xb2a5('0xff')],'ListId':this[_0xb2a5('0xb2')][_0x429774[_0xb2a5('0x129')]]['ListId'],'VoiceQueueId':this['actions'][_0x429774[_0xb2a5('0x129')]]['VoiceQueueId']||undefined,'CampaignId':this[_0xb2a5('0xb2')][_0x429774[_0xb2a5('0x129')]][_0xb2a5('0xd9')]||undefined})[_0xb2a5('0xbd')](loggerCatch(_0xb2a5('0x133')));delete this[_0xb2a5('0xb2')][_0x429774[_0xb2a5('0x129')]];unlockQueueStatus(_0x1e35f6);}}else if((strategy[this['voiceQueues'][this[_0xb2a5('0xb2')][_0x429774[_0xb2a5('0x129')]]['queue']][_0xb2a5('0x53')]]||'rrmemory')===_0xb2a5('0x12d')){var _0x49e6d4;if(this[_0xb2a5('0xb2')][_0x429774['actionid']]&&!_[_0xb2a5('0x82')](this[_0xb2a5('0x2a')][this[_0xb2a5('0xb2')][_0x429774[_0xb2a5('0x129')]]['queue']])){if(this[_0xb2a5('0x2b')][_0x5ee09e[_0xb2a5('0xb2')][_0x429774['actionid']][_0xb2a5('0xb8')]]){this['queueBookedRR'][_0x5ee09e['actions'][_0x429774[_0xb2a5('0x129')]][_0xb2a5('0xb8')]]=this[_0xb2a5('0x2b')][this['actions'][_0x429774[_0xb2a5('0x129')]][_0xb2a5('0xb8')]]?this[_0xb2a5('0x2b')][this[_0xb2a5('0xb2')][_0x429774[_0xb2a5('0x129')]][_0xb2a5('0xb8')]]:this[_0xb2a5('0x2a')][this[_0xb2a5('0xb2')][_0x429774[_0xb2a5('0x129')]][_0xb2a5('0xb8')]]?this[_0xb2a5('0x2a')][this[_0xb2a5('0xb2')][_0x429774[_0xb2a5('0x129')]]['queue']][_0xb2a5('0x134')]||0x0:0x0;}this[_0xb2a5('0x2a')][this['actions'][_0x429774[_0xb2a5('0x129')]][_0xb2a5('0xb8')]][_0xb2a5('0x134')]=this[_0xb2a5('0x2b')][this[_0xb2a5('0xb2')][_0x429774[_0xb2a5('0x129')]][_0xb2a5('0xb8')]];for(var _0x26be8a=0x0;_0x26be8a=0x0;})[_0xb2a5('0xbd')](myreject(_0x1c98cc)));}}else{_0x4aa685[_0xb2a5('0x12e')](ami[_0xb2a5('0xb4')]({'action':'command','command':util[_0xb2a5('0x80')](_0xb2a5('0x14d'),_0x3a3ec9,!_[_0xb2a5('0x42')](config[_0xb2a5('0x149')][_0x3a7da4])?_0x3a7da4:'')})[_0xb2a5('0xbb')](function(_0x7c84aa){return _0x7c84aa['content'][_0xb2a5('0x150')](_0xb2a5('0x151'))>=0x0;})[_0xb2a5('0xbd')](myreject(_0x1c98cc)));}BPromise['all'](_0x4aa685)[_0xb2a5('0xbb')](function(_0x78f0a1){var _0x558890=_[_0xb2a5('0x152')](_0x78f0a1);if(_0x558890){return _0x43572c(_0x558890);}else{_0x573d6d[_0xb2a5('0x43')]=_0xf34c5b?_0xb2a5('0x153'):'INTERVAL_IS_OVERTIME';return _0x1c98cc(msgResponse('[ifTime][promiseAll]','Failure','Global:\x20'+_0xf34c5b+'\x20'+_0x5cc346+_0xb2a5('0x154')+util[_0xb2a5('0x9f')](_0x3a3ec9,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x3a7da4));}})['catch'](function(_0x1f8c9f){return _0x1c98cc(msgResponse(_0xb2a5('0x144'),_0xb2a5('0x146'),JSON['stringify'](_0x1f8c9f)));});});};Dialer['prototype'][_0xb2a5('0x155')]=function(_0x4b1a38){var _0x5d89a5=this;return function(){switch(_0x4b1a38['dialMethod']){case _0xb2a5('0x156'):freeVariablesPredictive(_0x4b1a38);_0x5d89a5['handlePower'](_0x4b1a38,0x1);break;case _0xb2a5('0x157'):freeVariablesPredictive(_0x4b1a38);_0x5d89a5['handlePower'](_0x4b1a38,_0x4b1a38[_0xb2a5('0x158')]);break;case _0xb2a5('0x159'):_0x5d89a5[_0xb2a5('0x159')](_0x4b1a38);break;case _0xb2a5('0x15a'):freeVariablesPredictive(_0x4b1a38);_0x5d89a5[_0xb2a5('0x15b')](_0x4b1a38,0x1);break;default:freeVariablesPredictive(_0x4b1a38);logger[_0xb2a5('0x9e')](_0xb2a5('0x15c'),_0x4b1a38['name'],_0xb2a5('0x15d'));}};};Dialer['prototype'][_0xb2a5('0x15e')]=function(_0x207ed5){var _0x32310c=this;return function(){_0x32310c[_0xb2a5('0x15f')](_0x207ed5);};};Dialer[_0xb2a5('0x1b')][_0xb2a5('0x36')]=function(_0x27406b){var _0x4eede9=this;if(isNotPreview(_0x27406b['dialMethod'])){if(isVoiceQueueOutbound(_0x27406b[_0xb2a5('0x51')])&&isActive(_0x27406b[_0xb2a5('0x160')])){_0x27406b[_0xb2a5('0xa7')]=!![];BPromise[_0xb2a5('0xbf')]()['then'](checkIsLoggedIn(_0x27406b,_0x27406b[_0xb2a5('0x55')]))[_0xb2a5('0xbb')](checkIsActive(_0x27406b,_0x27406b[_0xb2a5('0x160')]))[_0xb2a5('0xbb')](checkInterval(_0x27406b))['then'](_0x4eede9['checkIsTrunkReachable'](_0x27406b))[_0xb2a5('0xbb')](_0x4eede9[_0xb2a5('0x143')](_0x27406b[_0xb2a5('0x161')],_0x27406b[_0xb2a5('0x162')],_0x27406b[_0xb2a5('0x45')],_0x27406b))[_0xb2a5('0xbb')](_0x4eede9[_0xb2a5('0x145')](_0x27406b[_0xb2a5('0x49')],_0x27406b['dialTimezone'],_0x27406b[_0xb2a5('0x45')],_0x27406b))[_0xb2a5('0xbb')](_0x4eede9[_0xb2a5('0x155')](_0x27406b))[_0xb2a5('0xbd')](loggerCatchQueueSummary(_0xb2a5('0x163'),_0x27406b));}else{notSendMessagesQueue(_0x27406b);}}else{freeVariablesPredictive(_0x27406b);}};Dialer[_0xb2a5('0x1b')][_0xb2a5('0x13f')]=function(){var _0x3e358f=this;var _0x23e905;for(var _0x1c9992 in this[_0xb2a5('0x21')]){if(typeof this['campaigns'][_0x1c9992]!==_0xb2a5('0xa2')){_0x23e905=this['campaigns'][_0x1c9992];if(isCampaignIvr(_0x23e905['type'])&&isActive(_0x23e905[_0xb2a5('0x7e')])){_0x23e905['sendMessageOneNotActive']=!![];BPromise[_0xb2a5('0xbf')]()[_0xb2a5('0xbb')](checkIsActive(_0x23e905,_0x23e905['active']))['then'](checkInterval(_0x23e905))[_0xb2a5('0xbb')](_0x3e358f['checkIsTrunkReachable'](_0x23e905))[_0xb2a5('0xbb')](_0x3e358f[_0xb2a5('0x143')](_0x23e905[_0xb2a5('0x161')],_0x23e905[_0xb2a5('0x162')],_0x23e905['name'],_0x23e905))['then'](_0x3e358f['checkIfTimeIntervals'](_0x23e905['Interval'],_0x23e905[_0xb2a5('0x162')],_0x23e905[_0xb2a5('0x45')],_0x23e905))[_0xb2a5('0xbb')](_0x3e358f[_0xb2a5('0x15e')](_0x23e905))[_0xb2a5('0xbd')](loggerCatchQueueSummary(_0xb2a5('0x164'),_0x23e905));}else{notSendMessagesCampaign(_0x23e905);}}}};function getCallerIdRandom(_0x550048,_0x2e286e){var _0x5e80d7;var _0x2d874d;var _0x1cf1f5;if(_0x2e286e<=0x0){_0x2e286e=0x1;}_0x5e80d7=new RegExp(_0xb2a5('0x165')+_0x2e286e+'}$');_0x2d874d=Math[_0xb2a5('0x166')](0xa,_0x2e286e-0x1);_0x1cf1f5=Math[_0xb2a5('0x166')](0xa,_0x2e286e)-0x1;return util[_0xb2a5('0x80')]('%s',_[_0xb2a5('0x167')](_0x550048,_0x5e80d7,_[_0xb2a5('0x168')](_0x2d874d,_0x1cf1f5)));}function extractCalleridName(_0x33925f){var _0x5aa032=_0x33925f[_0xb2a5('0x169')](/"(.*?)"/);return _0x5aa032?_0x5aa032[0x1]:_0x33925f;}function extractCalleridNumber(_0x5ac18e){var _0x4dc2a1=_0x5ac18e['match'](/<(.*?)>/);return _0x4dc2a1?_0x4dc2a1[0x1]:_0x5ac18e;}Dialer[_0xb2a5('0x1b')][_0xb2a5('0x16a')]=function(_0x36aac8,_0xc349d){var _0x474716=this;var _0x50ea11=uuid['v4']();this[_0xb2a5('0xb2')][_0x50ea11]=new Action(_0x36aac8,_0xc349d,_0x50ea11);return new BPromise(function(_0x3f622a,_0x4c965e){if(_[_0xb2a5('0x42')](_0x36aac8)&&typeof _0x36aac8!==_0xb2a5('0x16b')){return _0x4c965e(msgResponse(_0xb2a5('0x16c'),_0xb2a5('0x146'),_0xb2a5('0x16d')));}if(_[_0xb2a5('0x42')](_0xc349d['Contact'][_0xb2a5('0x16e')])||_0xc349d[_0xb2a5('0x16f')][_0xb2a5('0x16e')]===null){return _0x4c965e(msgResponse('originate',_0xb2a5('0x146'),_0xb2a5('0x170')));}var _0x4255bc={'XMD-CALLERID':_0x474716[_0xb2a5('0xb2')][_0x50ea11]['getCaller'](),'XMD-AGI':_0x36aac8['dialQueueProject']?util[_0xb2a5('0x80')](_0xb2a5('0x171'),ipAgi,_0x36aac8['dialQueueProject']):_0xb2a5('0x172'),'XMD-AGIAFTER':_0x36aac8[_0xb2a5('0x110')]?util[_0xb2a5('0x80')]('\x22agi://%s/square,%s\x22',ipAgi,_0x36aac8[_0xb2a5('0x110')]):_0xb2a5('0x172'),'XMD-QUEUE':_0x36aac8[_0xb2a5('0x51')]===_0xb2a5('0x52')?util[_0xb2a5('0x80')](_0xb2a5('0x173'),_0x36aac8[_0xb2a5('0x45')],_0x36aac8[_0xb2a5('0x174')]||'',_0x36aac8['dialAgiAfterHangupAgent']?'c':'',_0x36aac8[_0xb2a5('0x175')]||0x3):_0xb2a5('0x172'),'XMD-CONTACTID':_0xc349d['ContactId'],'XMD-CDRTYPE':_0xb2a5('0xa'),'CALLERID(all)':_0x474716['actions'][_0x50ea11][_0xb2a5('0x176')](),'XMD-AMD':_0x36aac8['dialAMDActive']?_0xb2a5('0x177'):_0xb2a5('0x172'),'XMD-DESTINATION':_0xb2a5('0xe5')};if(_0x36aac8[_0xb2a5('0xeb')]){_0x4255bc[_0xb2a5('0x178')]=_0x36aac8[_0xb2a5('0x179')]||0x9c4;_0x4255bc[_0xb2a5('0x17a')]=_0x36aac8['dialAMDGreeting']||0x5dc;_0x4255bc[_0xb2a5('0x17b')]=_0x36aac8[_0xb2a5('0x17c')]||0x320;_0x4255bc[_0xb2a5('0x17d')]=_0x36aac8[_0xb2a5('0x17e')]||0x1388;_0x4255bc['XMD-AMDMINWORDLENGTH']=_0x36aac8[_0xb2a5('0x17f')]||0x64;_0x4255bc[_0xb2a5('0x180')]=_0x36aac8['dialAMDBetweenWordsSilence']||0x32;_0x4255bc[_0xb2a5('0x181')]=_0x36aac8['dialAMDMaximumNumberOfWords']||0x3;_0x4255bc['XMD-AMDSILENCETHRESHOLD']=_0x36aac8[_0xb2a5('0x182')]||0x100;_0x4255bc[_0xb2a5('0x183')]=_0x36aac8[_0xb2a5('0x184')]||0x1388;}if(_0x36aac8[_0xb2a5('0x51')]===_0xb2a5('0x52')){_0x4255bc[_0xb2a5('0x185')]=_0xc349d[_0xb2a5('0x100')];}else{_0x4255bc[_0xb2a5('0x186')]=_0xc349d['CampaignId'];}for(var _0x4891a3 in _0xc349d['Contact']){if(typeof _0xc349d[_0xb2a5('0x16f')][_0x4891a3]!==_0xb2a5('0xa2')){if(isNotNull(_0xc349d[_0xb2a5('0x16f')][_0x4891a3])&&_0x4891a3!=='id'&&_0x4891a3!==_0xb2a5('0x187')&&_0x4891a3!==_0xb2a5('0x188')&&_0x4891a3!=='updatedAt'){_0x4255bc[util[_0xb2a5('0x80')](_0xb2a5('0x189'),_0xb2a5('0x18a'),_[_0xb2a5('0x18b')](_0x4891a3))]=_0xc349d['Contact'][_0x4891a3];}}}var _0x1a2254=_0x474716['isTrunkReachable'](_0x36aac8[_0xb2a5('0x7d')])?getCallerId(_0x36aac8[_0xb2a5('0x7d')][_0xb2a5('0x18c')],_0x36aac8[_0xb2a5('0x60')],_0x36aac8[_0xb2a5('0x18d')]>0x0?getCallerIdRandom(_0x36aac8[_0xb2a5('0x61')],_0x36aac8[_0xb2a5('0x18d')]):_0x36aac8[_0xb2a5('0x61')]):getCallerId(_[_0xb2a5('0xe2')](_0x36aac8[_0xb2a5('0x18e')])?_0x36aac8[_0xb2a5('0x7d')]['callerid']:_0x36aac8[_0xb2a5('0x18e')][_0xb2a5('0x18c')],_0x36aac8[_0xb2a5('0x60')],_0x36aac8[_0xb2a5('0x18d')]>0x0?getCallerIdRandom(_0x36aac8[_0xb2a5('0x61')],_0x36aac8[_0xb2a5('0x18d')]):_0x36aac8['dialOriginateCallerIdNumber']);if(_0x1a2254){_0x4255bc[_0xb2a5('0x18f')]=_0x474716[_0xb2a5('0xb2')][_0x50ea11]['originatecalleridname']=extractCalleridName(_0x1a2254);_0x4255bc[_0xb2a5('0x190')]=_0x474716[_0xb2a5('0xb2')][_0x50ea11][_0xb2a5('0x191')]=extractCalleridNumber(_0x1a2254);}return ami[_0xb2a5('0xb4')]({'actionid':_0x50ea11,'action':_0xb2a5('0x16c'),'channel':_0x474716[_0xb2a5('0xdd')](_0x36aac8[_0xb2a5('0x7d')])?util[_0xb2a5('0x80')](_0xb2a5('0x192'),_0x36aac8[_0xb2a5('0x7d')]['name'],isNotNull(_0x36aac8['dialPrefix'])?_0x36aac8[_0xb2a5('0x63')][_0xb2a5('0x193')]()||'':'',_0x36aac8[_0xb2a5('0x194')]>0x0?_0xc349d[_0xb2a5('0x16f')][_0xb2a5('0x16e')][_0xb2a5('0x195')](_0x36aac8['dialCutDigit']):_0xc349d[_0xb2a5('0x16f')][_0xb2a5('0x16e')]):util[_0xb2a5('0x80')]('SIP/%s/%s%s',_['isNil'](_0x36aac8['TrunkBackup'])?_0x36aac8[_0xb2a5('0x7d')][_0xb2a5('0x45')]:_0x36aac8[_0xb2a5('0x18e')]['name'],isNotNull(_0x36aac8[_0xb2a5('0x63')])?_0x36aac8[_0xb2a5('0x63')]['trim']()||'':'',_0x36aac8[_0xb2a5('0x194')]>0x0?_0xc349d[_0xb2a5('0x16f')][_0xb2a5('0x16e')][_0xb2a5('0x195')](_0x36aac8[_0xb2a5('0x194')]):_0xc349d[_0xb2a5('0x16f')]['phone']),'callerid':_0x1a2254,'Exten':_0xb2a5('0xe5'),'Context':_0xb2a5('0x196'),'Priority':'1','variable':_0x4255bc,'timeout':(_0x36aac8[_0xb2a5('0x62')]||0x1e)*0x3e8,'async':!![],'channelid':_0x50ea11})[_0xb2a5('0xbb')](function(_0x2060da){return _0x3f622a(_0x2060da);})[_0xb2a5('0xbd')](function(_0x2e95a0){_0x36aac8['outboundOriginateFailureCallsDay']+=0x1;var _0x545b9a=new History(_0x474716['actions'][_0x50ea11]);logger[_0xb2a5('0x9e')](util[_0xb2a5('0x80')](_0xb2a5('0x197'),JSON[_0xb2a5('0x4e')](_0x2e95a0)));_0x545b9a['state']=0xe;_0x545b9a[_0xb2a5('0xae')]=_0xb2a5('0x198');_0x545b9a['starttime']=moment()[_0xb2a5('0x80')](_0xb2a5('0xfe'));_0x545b9a[_0xb2a5('0x11f')]=_0x545b9a[_0xb2a5('0xaf')];_0x474716[_0xb2a5('0xcf')](_0x545b9a)['catch'](loggerCatch('[originate][error]'));_0x474716[_0xb2a5('0xcd')](_0x545b9a)[_0xb2a5('0xbd')](loggerCatch('[originate][error]'))[_0xb2a5('0x1d')](function(){delete _0x474716['actions'][_0x50ea11];return _0x4c965e(msgResponse(_0xb2a5('0x16c'),'Error','originate\x20action\x20Error'));});});});};Dialer[_0xb2a5('0x1b')]['syncOriginateResponse']=function(_0x1b952c){var _0x40efbc=this[_0xb2a5('0xb2')][_0x1b952c[_0xb2a5('0x129')]];if(_0x40efbc){delete this['actions'][_0x1b952c['actionid']];_0x40efbc[_0xb2a5('0x118')]=moment()[_0xb2a5('0x80')]('YYYY-MM-DD\x20HH:mm:ss');var _0x5a390e=_0x40efbc[_0xb2a5('0x51')]===_0xb2a5('0x9a')?this[_0xb2a5('0x21')][_0x40efbc[_0xb2a5('0xb8')]]:this[_0xb2a5('0x20')][_0x40efbc[_0xb2a5('0x199')]()];if(!this['isSuccess'](_0x1b952c[_0xb2a5('0x19a')])){this[_0xb2a5('0xba')](_0x5a390e);return this[_0xb2a5('0x19b')](_0x40efbc,_0x5a390e,_0x1b952c)[_0xb2a5('0xbd')](loggerCatch(_0xb2a5('0x19c')));}this[_0xb2a5('0x27')][_0x1b952c[_0xb2a5('0xe1')]]=_0x40efbc;}};Dialer['prototype'][_0xb2a5('0x19d')]=function(_0x5ca4df,_0x253786,_0x1ffd3f){var _0x23c650=new History(_0x253786);if(_0x23c650['countbusyretry']+_0x23c650[_0xb2a5('0xf2')]+_0x23c650[_0xb2a5('0xf3')]+_0x23c650[_0xb2a5('0xf4')]+_0x23c650['countdropretry']+_0x23c650[_0xb2a5('0xf6')]+_0x23c650[_0xb2a5('0xee')]+_0x23c650['countagentrejectretry']>=_0x1ffd3f[_0xb2a5('0xf7')]-0x1){return!![];}switch(_0x5ca4df){case 0x3:if(_0x23c650[_0xb2a5('0xf3')]>=_0x1ffd3f['dialNoAnswerMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x23c650[_0xb2a5('0xf3')]+=0x1,'scheduledat':moment()[_0xb2a5('0xfb')](_0x1ffd3f[_0xb2a5('0x19e')],_0xb2a5('0xfd'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x23c650[_0xb2a5('0xff')],'ListId':_0x23c650[_0xb2a5('0xd7')],'VoiceQueueId':_0x23c650[_0xb2a5('0x100')]||undefined,'CampaignId':_0x23c650['CampaignId']||undefined})[_0xb2a5('0xbd')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x23c650['countbusyretry']>=_0x1ffd3f[_0xb2a5('0x19f')]-0x1){return!![];}this[_0xb2a5('0xc3')]({'active':![],'countbusyretry':_0x23c650[_0xb2a5('0xf1')]+=0x1,'scheduledat':moment()[_0xb2a5('0xfb')](_0x1ffd3f[_0xb2a5('0x1a0')],_0xb2a5('0xfd'))['format'](_0xb2a5('0xfe')),'ContactId':_0x23c650[_0xb2a5('0xff')],'ListId':_0x23c650[_0xb2a5('0xd7')],'VoiceQueueId':_0x23c650[_0xb2a5('0x100')]||undefined,'CampaignId':_0x23c650[_0xb2a5('0xd9')]||undefined})[_0xb2a5('0xbd')](loggerCatch(_0xb2a5('0x1a1')));break;case 0x8:if(_0x23c650[_0xb2a5('0xf2')]>=_0x1ffd3f[_0xb2a5('0x1a2')]-0x1){return!![];}this[_0xb2a5('0xc3')]({'active':![],'countcongestionretry':_0x23c650[_0xb2a5('0xf2')]+=0x1,'scheduledat':moment()[_0xb2a5('0xfb')](_0x1ffd3f[_0xb2a5('0x1a3')],_0xb2a5('0xfd'))[_0xb2a5('0x80')](_0xb2a5('0xfe')),'ContactId':_0x23c650[_0xb2a5('0xff')],'ListId':_0x23c650['ListId'],'VoiceQueueId':_0x23c650[_0xb2a5('0x100')]||undefined,'CampaignId':_0x23c650['CampaignId']||undefined})[_0xb2a5('0xbd')](loggerCatch(_0xb2a5('0x1a4')));break;case 0x0:if(_0x23c650[_0xb2a5('0xf4')]>=_0x1ffd3f[_0xb2a5('0x1a5')]-0x1){return!![];}else{this[_0xb2a5('0xc3')]({'active':![],'countnosuchnumberretry':_0x23c650[_0xb2a5('0xf4')]+=0x1,'scheduledat':moment()[_0xb2a5('0xfb')](_0x1ffd3f[_0xb2a5('0x1a6')],_0xb2a5('0xfd'))[_0xb2a5('0x80')](_0xb2a5('0xfe')),'ContactId':_0x23c650[_0xb2a5('0xff')],'ListId':_0x23c650[_0xb2a5('0xd7')],'VoiceQueueId':_0x23c650['VoiceQueueId']||undefined,'CampaignId':_0x23c650[_0xb2a5('0xd9')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x23c650[_0xb2a5('0xf5')]>=_0x1ffd3f[_0xb2a5('0x11b')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x23c650['countdropretry']+=0x1,'scheduledat':moment()[_0xb2a5('0xfb')](_0x1ffd3f[_0xb2a5('0x11c')],_0xb2a5('0xfd'))['format'](_0xb2a5('0xfe')),'ContactId':_0x23c650['ContactId'],'ListId':_0x23c650[_0xb2a5('0xd7')],'VoiceQueueId':_0x23c650[_0xb2a5('0x100')]||undefined,'CampaignId':_0x23c650[_0xb2a5('0xd9')]||undefined})[_0xb2a5('0xbd')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x23c650[_0xb2a5('0xf6')]>=_0x1ffd3f[_0xb2a5('0x1a7')]-0x1){return!![];}this[_0xb2a5('0xc3')]({'active':![],'countabandonedretry':_0x23c650['countabandonedretry']+=0x1,'scheduledat':moment()[_0xb2a5('0xfb')](_0x1ffd3f[_0xb2a5('0x125')],_0xb2a5('0xfd'))[_0xb2a5('0x80')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x23c650[_0xb2a5('0xff')],'ListId':_0x23c650[_0xb2a5('0xd7')],'VoiceQueueId':_0x23c650[_0xb2a5('0x100')]||undefined,'CampaignId':_0x23c650['CampaignId']||undefined})[_0xb2a5('0xbd')](loggerCatch(_0xb2a5('0x126')));break;case 0x13:if(_0x23c650[_0xb2a5('0xee')]>=_0x1ffd3f[_0xb2a5('0x1a8')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x23c650[_0xb2a5('0xee')]+=0x1,'scheduledat':moment()[_0xb2a5('0xfb')](_0x1ffd3f[_0xb2a5('0xfc')],_0xb2a5('0xfd'))['format'](_0xb2a5('0xfe')),'ContactId':_0x23c650['ContactId'],'ListId':_0x23c650['ListId'],'VoiceQueueId':_0x23c650[_0xb2a5('0x100')]||undefined,'CampaignId':_0x23c650['CampaignId']||undefined})[_0xb2a5('0xbd')](loggerCatch(_0xb2a5('0x101')));break;case 0x14:if(_0x23c650['countagentrejectretry']>=_0x1ffd3f[_0xb2a5('0x1a9')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x23c650[_0xb2a5('0x1aa')]+=0x1,'scheduledat':moment()[_0xb2a5('0xfb')](_0x1ffd3f[_0xb2a5('0x1ab')],_0xb2a5('0xfd'))[_0xb2a5('0x80')](_0xb2a5('0xfe')),'ContactId':_0x23c650[_0xb2a5('0xff')],'ListId':_0x23c650[_0xb2a5('0xd7')],'VoiceQueueId':_0x23c650[_0xb2a5('0x100')]||undefined,'CampaignId':_0x23c650[_0xb2a5('0xd9')]||undefined})[_0xb2a5('0xbd')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer['prototype'][_0xb2a5('0x19b')]=function(_0x2d8000,_0x5b6b5d,_0x447ea6){var _0x45185e=this;var _0x274754=new History(_0x2d8000);return new BPromise(function(_0x41c020,_0x593b03){if(_[_0xb2a5('0x42')](_0x5b6b5d)&&typeof _0x5b6b5d!==_0xb2a5('0x16b')){return _0x593b03(msgResponse(_0xb2a5('0x1ac'),_0xb2a5('0x146'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0x447ea6)&&typeof _0x447ea6!==_0xb2a5('0x16b')){return _0x593b03(msgResponse(_0xb2a5('0x1ac'),_0xb2a5('0x146'),'evt\x20is\x20undefine'));}switch(_0x447ea6[_0xb2a5('0x1ad')]){case'0':_0x5b6b5d[_0xb2a5('0x6b')]+=0x1;_0x274754[_0xb2a5('0xad')]=0x0;_0x274754['statedesc']=_0xb2a5('0x1ae');_0x274754[_0xb2a5('0xf4')]+=0x1;_0x274754[_0xb2a5('0xef')]+=0x1;ami[_0xb2a5('0x50')](_0xb2a5('0x1af'),ut['buildObj'](_0x2d8000,_0xb2a5('0x1b0')));_0x45185e[_0xb2a5('0xcf')](_0x274754)[_0xb2a5('0xbd')](loggerCatch(_0xb2a5('0x107')));if(_0x45185e[_0xb2a5('0x19d')](0x0,_0x2d8000,_0x5b6b5d)){if(_0x274754[_0xb2a5('0xf4')]>=_0x5b6b5d[_0xb2a5('0x1a5')]){_0x45185e[_0xb2a5('0xf9')](_0x274754,_0x41c020,_0x593b03,_0xb2a5('0x1b1'));}else{_0x45185e['stateGlobal'](_0x274754,_0x41c020,_0x593b03,_0xb2a5('0x1b1'));}}break;case'3':_0x5b6b5d[_0xb2a5('0x6a')]+=0x1;_0x274754[_0xb2a5('0xad')]=0x3;_0x274754[_0xb2a5('0xae')]=_0xb2a5('0x1b2');_0x274754[_0xb2a5('0xf3')]+=0x1;_0x274754[_0xb2a5('0xef')]+=0x1;ami[_0xb2a5('0x50')](_0xb2a5('0x1b3'),ut[_0xb2a5('0xe9')](_0x2d8000,_0xb2a5('0x1b4')));_0x45185e[_0xb2a5('0xcf')](_0x274754)[_0xb2a5('0xbd')](loggerCatch(_0xb2a5('0x1b5')));if(_0x45185e[_0xb2a5('0x19d')](0x3,_0x2d8000,_0x5b6b5d)){if(_0x274754[_0xb2a5('0xf3')]>=_0x5b6b5d[_0xb2a5('0x1b6')]){_0x45185e[_0xb2a5('0xf9')](_0x274754,_0x41c020,_0x593b03,_0xb2a5('0x1b7'));}else{_0x45185e['stateGlobal'](_0x274754,_0x41c020,_0x593b03,_0xb2a5('0x1b7'));}}break;case'5':_0x5b6b5d[_0xb2a5('0x66')]+=0x1;_0x274754['state']=0x5;_0x274754[_0xb2a5('0xae')]=_0xb2a5('0x1b8');_0x274754[_0xb2a5('0xf1')]+=0x1;_0x274754[_0xb2a5('0xef')]+=0x1;ami[_0xb2a5('0x50')]('custom:agentbusy',ut[_0xb2a5('0xe9')](_0x2d8000,_0xb2a5('0x1b9')));_0x45185e['createHistory'](_0x274754)[_0xb2a5('0xbd')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x45185e['checkRetriveMax'](0x5,_0x2d8000,_0x5b6b5d)){if(_0x274754[_0xb2a5('0xf1')]>=_0x5b6b5d[_0xb2a5('0x19f')]){_0x45185e['createStateFinal'](_0x274754,_0x41c020,_0x593b03,_0xb2a5('0x1ba'));}else{_0x45185e[_0xb2a5('0xf8')](_0x274754,_0x41c020,_0x593b03,_0xb2a5('0x1ba'));}}break;case'8':_0x5b6b5d[_0xb2a5('0x67')]+=0x1;_0x274754[_0xb2a5('0xad')]=0x8;_0x274754['statedesc']='Congestion';_0x274754[_0xb2a5('0xf2')]+=0x1;_0x274754[_0xb2a5('0xef')]+=0x1;ami[_0xb2a5('0x50')](_0xb2a5('0x1bb'),ut[_0xb2a5('0xe9')](_0x2d8000,_0xb2a5('0x1bc')));_0x45185e[_0xb2a5('0xcf')](_0x274754)[_0xb2a5('0xbd')](loggerCatch(_0xb2a5('0x1bd')));if(_0x45185e[_0xb2a5('0x19d')](0x8,_0x2d8000,_0x5b6b5d)){if(_0x274754[_0xb2a5('0xf2')]>=_0x5b6b5d['dialCongestionMaxRetry']){_0x45185e['createStateFinal'](_0x274754,_0x41c020,_0x593b03,'reason\x208\x20congestion');}else{_0x45185e[_0xb2a5('0xf8')](_0x274754,_0x41c020,_0x593b03,'reason\x208\x20congestion');}}break;case'11':_0x5b6b5d[_0xb2a5('0x1be')]+=0x1;_0x274754[_0xb2a5('0xad')]=0xb;_0x274754[_0xb2a5('0xae')]=_0xb2a5('0x123');_0x274754[_0xb2a5('0xf6')]+=0x1;_0x274754[_0xb2a5('0xef')]+=0x1;_0x45185e[_0xb2a5('0xcf')](_0x274754)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x45185e[_0xb2a5('0x19d')](0xb,_0x2d8000,_0x5b6b5d)){if(_0x274754[_0xb2a5('0xf6')]>=_0x5b6b5d[_0xb2a5('0x1a7')]){_0x45185e[_0xb2a5('0xf9')](_0x274754,_0x41c020,_0x593b03,_0xb2a5('0x1bf'));}else{_0x45185e['stateGlobal'](_0x274754,_0x41c020,_0x593b03,_0xb2a5('0x1bf'));}}break;case'20':_0x5b6b5d[_0xb2a5('0x6d')]+=0x1;_0x274754[_0xb2a5('0xad')]=0x14;_0x274754[_0xb2a5('0xae')]=_0xb2a5('0x1c0');_0x274754[_0xb2a5('0x1aa')]+=0x1;_0x274754['countglobal']+=0x1;ami[_0xb2a5('0x50')](_0xb2a5('0x1c1'),ut[_0xb2a5('0xe9')](_0x2d8000,_0xb2a5('0x1c2')));_0x45185e['createHistory'](_0x274754)[_0xb2a5('0xbd')](loggerCatch(_0xb2a5('0x1c3')));if(_0x45185e[_0xb2a5('0x19d')](0x14,_0x2d8000,_0x5b6b5d)){if(_0x274754[_0xb2a5('0x1aa')]>=_0x5b6b5d[_0xb2a5('0x1a9')]){_0x45185e[_0xb2a5('0xf9')](_0x274754,_0x41c020,_0x593b03,_0xb2a5('0x1c4'));}else{_0x45185e[_0xb2a5('0xf8')](_0x274754,_0x41c020,_0x593b03,_0xb2a5('0x1c4'));}}break;default:_0x5b6b5d[_0xb2a5('0x6e')]+=0x1;_0x274754[_0xb2a5('0xad')]=0xc;_0x274754[_0xb2a5('0xae')]=_0x447ea6['reason'];_0x45185e[_0xb2a5('0xcf')](_0x274754)[_0xb2a5('0xbd')](loggerCatch(_0xb2a5('0x1c5')));if(_0x45185e['checkRetriveMax'](_0x447ea6[_0xb2a5('0x1ad')],_0x2d8000,_0x5b6b5d)){if(_0x274754[_0xb2a5('0xf1')]+_0x274754['countcongestionretry']+_0x274754[_0xb2a5('0xf3')]+_0x274754[_0xb2a5('0xf4')]+_0x274754[_0xb2a5('0xf5')]+_0x274754[_0xb2a5('0xf6')]+_0x274754[_0xb2a5('0xee')]+_0x274754[_0xb2a5('0x1aa')]>=_0x5b6b5d['dialGlobalMaxRetry']){_0x45185e[_0xb2a5('0xf8')](_0x274754,_0x41c020,_0x593b03,_0x447ea6[_0xb2a5('0x1ad')]);}else{_0x45185e[_0xb2a5('0xf9')](_0x274754,_0x41c020,_0x593b03,_0x447ea6[_0xb2a5('0x1ad')]);}}}});};Dialer[_0xb2a5('0x1b')]['stateGlobal']=function(_0x3ef558,_0x55b762,_0x22fbee,_0x4e6d28){var _0x3ba259=new Final(_0x3ef558);_0x3ba259[_0xb2a5('0xad')]=0xf;_0x3ba259[_0xb2a5('0xae')]=_0xb2a5('0x1c6');this['createStateFinal'](_0x3ba259,_0x55b762,_0x22fbee,_0x4e6d28);};Dialer[_0xb2a5('0x1b')][_0xb2a5('0xf9')]=function(_0x17ad97,_0x527a9b,_0xaef86e,_0x4623e4){this[_0xb2a5('0xcd')](_0x17ad97)[_0xb2a5('0xbb')](function(){return _0x527a9b(msgResponse(_0xb2a5('0x1ac'),'Success',_0x4623e4));})[_0xb2a5('0xbd')](function(){return _0xaef86e(msgResponse(_0xb2a5('0x1c7'),_0xb2a5('0x146'),_0xb2a5('0x1c8')));});};Dialer[_0xb2a5('0x1b')]['predictive']=function(_0x11ea0f){var _0x1a39fd=_0x11ea0f[_0xb2a5('0x1c9')]/0x64;var _0x186d46=_0x11ea0f['outboundDropCallsDayTimeout']/(_0x11ea0f[_0xb2a5('0x69')]+_0x11ea0f[_0xb2a5('0x65')]);var _0x53b7ec=Math[_0xb2a5('0x1ca')](_0x11ea0f[_0xb2a5('0x77')]*(_0x11ea0f[_0xb2a5('0x1cb')]/0x64));var _0x2335c2=Math[_0xb2a5('0x1ca')](_0x11ea0f[_0xb2a5('0x77')]*(_0x11ea0f['predictiveIntervalMinThreshold']/0x64));var _0x27a2ca=_0x11ea0f[_0xb2a5('0x54')]+_0x11ea0f[_0xb2a5('0x5a')];var _0x383f82=Math['floor'](_0x11ea0f[_0xb2a5('0x7a')]*_0x11ea0f['erlangAbandonmentRate']*_0x11ea0f['predictiveIntervalHitRate']*_0x11ea0f[_0xb2a5('0x75')]);if(_[_0xb2a5('0x42')](_0x11ea0f['startProgressive'])){if(!_['isUndefined'](_0x11ea0f[_0xb2a5('0x97')])){_0x11ea0f[_0xb2a5('0x97')]=undefined;loggerPredictive[_0xb2a5('0x9e')](_0xb2a5('0x1cc'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0xb2a5('0x42')](_0x11ea0f[_0xb2a5('0x99')])){loggerPredictive[_0xb2a5('0x9e')]('[startMethodPredictive][StartProgressive]',_0xb2a5('0x1cd'));clearInterval(_0x11ea0f['handlePredictive']);_0x11ea0f['handlePredictive']=undefined;}_0x11ea0f[_0xb2a5('0x29')]=moment()[_0xb2a5('0x80')](_0xb2a5('0xfe'));loggerPredictive['info'](_0x11ea0f[_0xb2a5('0x45')],'collection\x20data\x20in\x20progressive\x20at',_0x11ea0f[_0xb2a5('0x29')]);this[_0xb2a5('0x15b')](_0x11ea0f,0x1);}else if(ifInterval(_0x11ea0f[_0xb2a5('0x1ce')],_0x11ea0f[_0xb2a5('0x29')])){this[_0xb2a5('0x15b')](_0x11ea0f,0x1);loggerPredictiveCalls[_0xb2a5('0x83')](_0xb2a5('0x1cf'),_0x11ea0f[_0xb2a5('0x29')],_0x11ea0f[_0xb2a5('0x45')]);_0x11ea0f['erlangCalls']=0x0;_0x11ea0f[_0xb2a5('0x73')]=0x0;}else if(_0x1a39fd<_0x186d46&&_0x11ea0f[_0xb2a5('0x1d0')]===_0xb2a5('0x1d1')){freeVariablesPredictive(_0x11ea0f);loggerPredictive[_0xb2a5('0x83')](_0xb2a5('0x1d2'),_0xb2a5('0x1d3'),_0x186d46,_0xb2a5('0x29'),_0x11ea0f[_0xb2a5('0x45')]);}else if(_0x383f82<_0x11ea0f[_0xb2a5('0x73')]&&_0x11ea0f[_0xb2a5('0x1d0')]===_0xb2a5('0x1d1')){freeVariablesPredictive(_0x11ea0f);loggerPredictive[_0xb2a5('0x83')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0xb2a5('0x1d4'),_0x383f82,_0xb2a5('0x1d5'),_0x11ea0f[_0xb2a5('0x73')],_0xb2a5('0x29'),_0x11ea0f[_0xb2a5('0x45')]);}else if(!ifInterval(_0x11ea0f[_0xb2a5('0x1ce')],_0x11ea0f[_0xb2a5('0x29')])&&_['isUndefined'](_0x11ea0f['startPredictive'])&&!_['isUndefined'](_0x11ea0f[_0xb2a5('0x29')])){_0x11ea0f['startPredictive']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x11ea0f[_0xb2a5('0x45')],'started\x20in\x20predictive\x20at',_0x11ea0f[_0xb2a5('0x97')]);this[_0xb2a5('0x1d6')](_0x11ea0f[_0xb2a5('0x1ce')])['then'](this['getDataPredictive'](_0x11ea0f))[_0xb2a5('0xbb')](mergeDataErlangB(_0x11ea0f))[_0xb2a5('0xbb')](this[_0xb2a5('0x1d7')](_0x11ea0f))['catch'](loggerCatchPredictive(_0xb2a5('0x1d8'),_0x11ea0f));}else if(!ifInterval(_0x11ea0f[_0xb2a5('0x1ce')],_0x11ea0f['startPredictive'])){_0x11ea0f[_0xb2a5('0x73')]=0x0;_0x11ea0f[_0xb2a5('0x97')]=moment()['format'](_0xb2a5('0xfe'));loggerPredictive[_0xb2a5('0x83')](_0x11ea0f['name'],_0xb2a5('0x1d9'),_0x11ea0f[_0xb2a5('0x97')]);clearInterval(_0x11ea0f['handlePredictive']);_0x11ea0f[_0xb2a5('0x99')]=undefined;this[_0xb2a5('0x1d6')](_0x11ea0f[_0xb2a5('0x1ce')])[_0xb2a5('0xbb')](this[_0xb2a5('0x1da')](_0x11ea0f))[_0xb2a5('0xbb')](mergeDataErlangB(_0x11ea0f))[_0xb2a5('0xbb')](this['startMethodPredictive'](_0x11ea0f))[_0xb2a5('0xbd')](loggerCatchPredictive(_0xb2a5('0x1db'),_0x11ea0f));}else if(_0x11ea0f[_0xb2a5('0x77')]&&_0x27a2ca<_0x11ea0f[_0xb2a5('0x77')]-_0x2335c2){freeVariablesPredictive(_0x11ea0f);loggerPredictive[_0xb2a5('0x83')](_0x11ea0f[_0xb2a5('0x45')],_0xb2a5('0x1dc'),_0x27a2ca,_0xb2a5('0x1dd'),_0x11ea0f[_0xb2a5('0x77')],'-',_0x2335c2,'=',_0x11ea0f['predictiveIntervalAvailable']-_0x2335c2,')');}else if(_0x11ea0f[_0xb2a5('0x77')]&&_0x27a2ca>_0x11ea0f['predictiveIntervalAvailable']+_0x53b7ec){freeVariablesPredictive(_0x11ea0f);loggerPredictive[_0xb2a5('0x83')](_0x11ea0f[_0xb2a5('0x45')],_0xb2a5('0x1dc'),_0x27a2ca,_0xb2a5('0x1de'),_0x11ea0f[_0xb2a5('0x77')],'+',_0x53b7ec,'=',_0x11ea0f[_0xb2a5('0x77')]+_0x53b7ec,')');}};Dialer[_0xb2a5('0x1b')][_0xb2a5('0x1da')]=function(_0x47ed0e){var _0xc59c70=this;return function(_0x34a6aa){return new BPromise(function(_0x139f89,_0x3a1bb8){_[_0xb2a5('0x94')](_0x47ed0e,_0x34a6aa[0x0]);if(checkGetDataPredictive(_0x34a6aa[0x0])){var _0x2e5996=_0x47ed0e[_0xb2a5('0x77')]=_0x47ed0e[_0xb2a5('0x5a')]+_0x47ed0e['available'];var _0x513c37=_0x47ed0e['dialPredictiveInterval']*0x3c;var _0x453d4c=_0x34a6aa[0x0][_0xb2a5('0x70')]+_0x34a6aa[0x0][_0xb2a5('0x8b')];var _0x529ee3=(_0x34a6aa[0x0][_0xb2a5('0x6f')]+_0x34a6aa[0x0][_0xb2a5('0x72')]+_0x34a6aa[0x0][_0xb2a5('0x71')])/_0x34a6aa[0x0][_0xb2a5('0x78')];_0x47ed0e[_0xb2a5('0x74')]=_0x529ee3>0x0?_0x529ee3:0x1;switch(_0x47ed0e['dialPredictiveOptimization']){case _0xb2a5('0x1d1'):var _0x4ed197=_0x47ed0e[_0xb2a5('0x1c9')]/0x64;return _0xc59c70[_0xb2a5('0x1df')](_0x2e5996,_0x513c37,_0x453d4c,_0x529ee3,_0x4ed197)[_0xb2a5('0xbb')](function(_0x45d568){return _0x139f89(_0x45d568);});case _0xb2a5('0x1e0'):var _0x43795c=_0x47ed0e[_0xb2a5('0x1c9')]/0x64;return _0xc59c70[_0xb2a5('0x1e1')](_0x2e5996,_0x513c37,_0x453d4c,_0x529ee3,_0x43795c)[_0xb2a5('0xbb')](function(_0x3ba7f3){return _0x139f89(_0x3ba7f3);});default:return _0x3a1bb8(msgResponse(_0xb2a5('0x1e2'),'Failure',_0xb2a5('0x1e3')));}}else{return _0x3a1bb8(msgResponse(_0xb2a5('0x1e2'),_0xb2a5('0x146'),_0xb2a5('0x1e4')));}});};};Dialer[_0xb2a5('0x1b')][_0xb2a5('0x1e5')]=function(_0x31589a){var _0x4d0e49=this;return function(_0x3b8c12){return new BPromise(function(_0x3f7c6a,_0x2ac629){_[_0xb2a5('0x94')](_0x31589a,_0x3b8c12[0x0]);if(checkGetDataPredictive(_0x3b8c12[0x0])){loggerPredictive[_0xb2a5('0x83')](JSON[_0xb2a5('0x4e')](_0x3b8c12[0x0]));if(_0x31589a['dialPredictiveOptimization']===_0xb2a5('0x1d1')){return _0x4d0e49['getVoiceQueueRtPauses'](_0x31589a['id'])[_0xb2a5('0xbb')](function(_0xbcd105){var _0x100300=_0x31589a[_0xb2a5('0x55')]-_0xbcd105[0x0]['outboundQueuePauses'];var _0x13dec7=_0x31589a[_0xb2a5('0x1ce')]*0x3c;var _0x43ae17=_0x3b8c12[0x0][_0xb2a5('0x70')]+_0x3b8c12[0x0][_0xb2a5('0x8b')];var _0x179cb0=(_0x3b8c12[0x0][_0xb2a5('0x6f')]+_0x3b8c12[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x3b8c12[0x0][_0xb2a5('0x71')])/_0x3b8c12[0x0]['predictiveIntervalTotalCalls'];var _0x256f28=_0x31589a[_0xb2a5('0x1c9')]/0x64;_0x31589a[_0xb2a5('0x76')]=_0xbcd105[0x0][_0xb2a5('0x1e6')]||0x0;_0x31589a[_0xb2a5('0x74')]=_0x179cb0>0x0?_0x179cb0:0x1;return _0x4d0e49['abandonmentRate'](_0x100300,_0x13dec7,_0x43ae17,_0x179cb0,_0x256f28);})['then'](function(_0x59be1b){return _0x3f7c6a(_0x59be1b);})[_0xb2a5('0xbd')](function(_0x3457f7){return _0x2ac629(msgResponse(_0xb2a5('0x1e7'),_0xb2a5('0x146'),JSON[_0xb2a5('0x4e')](_0x3457f7)));});}if(_0x31589a[_0xb2a5('0x1d0')]===_0xb2a5('0x1e0')){return _0x4d0e49[_0xb2a5('0xcc')](_0x31589a['id'])['then'](function(_0x18982b){var _0x505b74=_0x31589a[_0xb2a5('0x55')]-_0x18982b[0x0][_0xb2a5('0x1e6')];var _0x444fff=_0x31589a['dialPredictiveInterval']*0x3c;var _0x370cfc=_0x3b8c12[0x0][_0xb2a5('0x70')]+_0x3b8c12[0x0][_0xb2a5('0x8b')];var _0x4d16a9=(_0x3b8c12[0x0][_0xb2a5('0x6f')]+_0x3b8c12[0x0][_0xb2a5('0x72')]+_0x3b8c12[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x3b8c12[0x0][_0xb2a5('0x78')];var _0x117534=_0x31589a[_0xb2a5('0x1c9')]/0x64;_0x31589a[_0xb2a5('0x76')]=_0x18982b[0x0][_0xb2a5('0x1e6')]||0x0;_0x31589a['predictiveIntervalHitRate']=_0x4d16a9>0x0?_0x4d16a9:0x1;return _0x4d0e49[_0xb2a5('0x1e1')](_0x505b74,_0x444fff,_0x370cfc,_0x4d16a9,_0x117534);})['then'](function(_0x38102d){return _0x3f7c6a(_0x38102d);})[_0xb2a5('0xbd')](function(_0x470269){return _0x2ac629(msgResponse(_0xb2a5('0x1e7'),_0xb2a5('0x146'),JSON[_0xb2a5('0x4e')](_0x470269)));});}}else{return _0x2ac629(msgResponse(_0xb2a5('0x1e2'),_0xb2a5('0x146'),_0xb2a5('0x1e4')));}});};};Dialer[_0xb2a5('0x1b')][_0xb2a5('0x1d7')]=function(_0x5d8906){var _0x178d9d=this;return function(){var _0x172530=0x0;var _0x568bbe=Math[_0xb2a5('0x1e8')](_0x5d8906[_0xb2a5('0x7b')]*0x3e8);if(_0x568bbe>0x0){_0x568bbe=_0x568bbe<0x64?0x64:_0x568bbe;loggerPredictive['info'](_0x5d8906[_0xb2a5('0x45')],_0xb2a5('0x1e9'),_0x568bbe,_0xb2a5('0x4f'));_0x5d8906[_0xb2a5('0x99')]=setInterval(function(){_0x178d9d[_0xb2a5('0x99')](_0x5d8906);loggerPredictiveCalls[_0xb2a5('0x83')](_0xb2a5('0x1ea'),_0x172530+=0x1);},_0x568bbe);}else{loggerPredictive[_0xb2a5('0x83')](_0x5d8906[_0xb2a5('0x45')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xb2a5('0x1b')][_0xb2a5('0x1eb')]=function(_0x30589d,_0x1e691d){var _0xec68ed=this;return function(_0x3b3a45){if(_[_0xb2a5('0x82')](_0x3b3a45)){if(_[_0xb2a5('0xe2')](_0x1e691d[_0xb2a5('0xd8')])||!_0x1e691d[_0xb2a5('0x1ec')]){if(_0x30589d[_0xb2a5('0x5f')]==='booked'){_0x30589d[_0xb2a5('0x130')]=_[_0xb2a5('0x42')](_0x30589d[_0xb2a5('0x130')])?!![]:_0x30589d['queueStatusComplete'];var _0x3ccbdb=uuid['v4']();_0xec68ed[_0xb2a5('0xb2')][_0x3ccbdb]=new Action(_0x30589d,_0x1e691d,_0x3ccbdb);loggerBooked['info'](_0xb2a5('0x1ed'),_0x3ccbdb,_0xb2a5('0x1ee'),JSON['stringify'](_0x30589d[_0xb2a5('0x130')]),_0xb2a5('0x1ef'),_0x30589d[_0xb2a5('0x45')]);if(_0x30589d['queueStatusComplete']){_0x30589d[_0xb2a5('0x130')]=![];_0xec68ed['queueBooked'][_0xec68ed[_0xb2a5('0xb2')][_0x3ccbdb]['queue']]=[];ami['Action']({'actionid':_0x3ccbdb,'action':_0xb2a5('0x1f0'),'queue':_0x30589d[_0xb2a5('0x45')]})[_0xb2a5('0xbd')](function(){_0xec68ed[_0xb2a5('0xba')](_0x30589d);_0xec68ed[_0xb2a5('0xc3')]({'active':![],'ContactId':_0xec68ed['actions'][_0x3ccbdb][_0xb2a5('0xff')],'ListId':_0xec68ed[_0xb2a5('0xb2')][_0x3ccbdb][_0xb2a5('0xd7')],'VoiceQueueId':_0xec68ed[_0xb2a5('0xb2')][_0x3ccbdb][_0xb2a5('0x100')]||undefined,'CampaignId':_0xec68ed[_0xb2a5('0xb2')][_0x3ccbdb]['CampaignId']||undefined})[_0xb2a5('0xbd')](loggerCatch(_0xb2a5('0x1f1')));delete _0xec68ed[_0xb2a5('0xb2')][_0x3ccbdb];});}else{loggerBooked[_0xb2a5('0x83')](_0xb2a5('0x1f2'),JSON[_0xb2a5('0x4e')](_0x30589d[_0xb2a5('0x130')]),'Queue:\x20',_0x30589d[_0xb2a5('0x45')]);_0xec68ed[_0xb2a5('0xba')](_0x30589d);_0xec68ed['rescheduleContact']({'active':![],'ContactId':_0xec68ed[_0xb2a5('0xb2')][_0x3ccbdb][_0xb2a5('0xff')],'ListId':_0xec68ed['actions'][_0x3ccbdb][_0xb2a5('0xd7')],'VoiceQueueId':_0xec68ed[_0xb2a5('0xb2')][_0x3ccbdb][_0xb2a5('0x100')]||undefined,'CampaignId':_0xec68ed[_0xb2a5('0xb2')][_0x3ccbdb]['CampaignId']||undefined})[_0xb2a5('0xbd')](loggerCatch(_0xb2a5('0x1f1')));delete _0xec68ed[_0xb2a5('0xb2')][_0x3ccbdb];}}else{return _0xec68ed[_0xb2a5('0x16a')](_0x30589d,_0x1e691d);}}else{if(getDiff(_0x1e691d[_0xb2a5('0x1f3')])<_0x30589d[_0xb2a5('0x1f4')]*0x3c){if(_0x1e691d['Agent']&&!_0x1e691d[_0xb2a5('0x1f5')][_0xb2a5('0x1f6')]){_0xec68ed[_0xb2a5('0x1f')][_0xb2a5('0x132')](_0x1e691d['id'])['finally'](function(){_0xec68ed[_0xb2a5('0xba')](_0x30589d);});}else{_0xec68ed['unlockContact']({'active':![]},_0x1e691d['id'],0x1)['finally'](function(){_0xec68ed[_0xb2a5('0xba')](_0x30589d);});}}else{_0x30589d[_0xb2a5('0x6c')]+=0x1;_0xec68ed['updateOriginated'](_0x30589d);if(_0x30589d['dialRecallInQueue']){_0xec68ed[_0xb2a5('0xc3')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1e691d['ContactId'],'ListId':_0x1e691d[_0xb2a5('0xd7')],'VoiceQueueId':_0x1e691d[_0xb2a5('0x100')]||undefined,'CampaignId':_0x1e691d[_0xb2a5('0xd9')]||undefined})['catch'](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0xec68ed[_0xb2a5('0xcf')](createObjHistory(_0x30589d,_0x1e691d,'RECALLINQUEUE',0x17,_0xb2a5('0x1f7')))['catch'](loggerCatch(_0xb2a5('0x1f8')));}else{_0xec68ed['saveInDb'](createObjHistory(_0x30589d,_0x1e691d,_0xb2a5('0x1f9'),0x16,_0xb2a5('0x1fa')),_0xb2a5('0x1fb'),_0xb2a5('0x1fc'));}}}}else{_0x30589d[_0xb2a5('0x1fd')]+=0x1;_0xec68ed[_0xb2a5('0xd5')](createObjHistory(_0x30589d,_0x1e691d,_0xb2a5('0x1fe'),0xd,_0xb2a5('0x1ff')),_0xb2a5('0x200'),_0xb2a5('0x201'));throw _0xb2a5('0x202');}};};Dialer['prototype'][_0xb2a5('0x15f')]=function(_0x25c07b){var _0x686c3=this;var _0x42f797=_0x25c07b[_0xb2a5('0x203')]-_0x25c07b['originated']-_0x25c07b['temp'];emitCampaignSummary(_0x25c07b);if(_0x42f797>0x0){if(_0x42f797>this['maxNumberOriginate']){_0x42f797=this[_0xb2a5('0x24')];}_0x25c07b[_0xb2a5('0xc8')]+=_0x42f797;this[_0xb2a5('0xca')](_0x25c07b['id'],_0x42f797,_0x25c07b[_0xb2a5('0x204')],_0x25c07b)['then'](function(_0x253ac1){_0x25c07b[_0xb2a5('0xc8')]-=_0x42f797;_0x25c07b[_0xb2a5('0xc8')]=_0x25c07b[_0xb2a5('0xc8')]>0x0?_0x25c07b[_0xb2a5('0xc8')]:0x0;if(!checkContactEmpty(_0x253ac1)){_0x25c07b[_0xb2a5('0x43')]='AVAILABLE_CONTACTS_FINISHED';logger[_0xb2a5('0x83')]('[getContactCampaign2][Empty]'+_0x25c07b[_0xb2a5('0x45')]);}else{_0x25c07b[_0xb2a5('0x79')]+=_0x253ac1[_0xb2a5('0xa1')];_0x25c07b[_0xb2a5('0x43')]=_0xb2a5('0x205');for(var _0x5d88d4=0x0;_0x5d88d4<_0x253ac1[_0xb2a5('0xa1')];_0x5d88d4+=0x1){_0x25c07b[_0xb2a5('0x206')]+=0x1;if(_[_0xb2a5('0xe2')](_0x253ac1[_0x5d88d4])||_['isNil'](_0x253ac1[_0x5d88d4][_0xb2a5('0x16f')])||_[_0xb2a5('0xe2')](_0x253ac1[_0x5d88d4][_0xb2a5('0x16f')]['phone'])){_0x686c3[_0xb2a5('0x207')](_0xb2a5('0x208'),_0x25c07b,_0x253ac1[_0x5d88d4]);}else{_0x686c3[_0xb2a5('0x209')](_[_0xb2a5('0xd6')](_0x253ac1[_0x5d88d4],['CampaignId',_0xb2a5('0x20a')]))[_0xb2a5('0xbb')](_0x686c3[_0xb2a5('0x1eb')](_0x25c07b,_0x253ac1[_0x5d88d4]))[_0xb2a5('0xbd')](_0x686c3[_0xb2a5('0xd3')]('[actionOriginateIvr]\x20',_0x25c07b));}}}})[_0xb2a5('0xbd')](loggerGetContactDialer(_0xb2a5('0x20b'),_0x25c07b,_0x42f797));}};Dialer[_0xb2a5('0x1b')][_0xb2a5('0x15b')]=function(_0x51d524,_0x95a341){var _0x283654=this;var _0x2bfd35=[];var _0x17431a=_0x95a341>=0x1?_0x95a341:0x1;if(_0x51d524[_0xb2a5('0x5f')]===_0xb2a5('0x15a')){_0x17431a=0x1;}var _0x394736=Math[_0xb2a5('0x1e8')](_0x51d524[_0xb2a5('0x54')]*_0x17431a)-_0x51d524[_0xb2a5('0x79')]-_0x51d524[_0xb2a5('0xc8')];emitVoiceQueueSummary(_0x51d524);if(_0x51d524[_0xb2a5('0x20c')]>0x0){var _0x43258a=_0x51d524['dialLimitQueue']-_0x51d524['originated']-_0x51d524[_0xb2a5('0x5a')]-_0x51d524[_0xb2a5('0xc8')]-_0x51d524['pTalking'];if(_0x394736>_0x43258a){_0x394736=_0x43258a;}}if(_0x394736>0x0){if(_0x51d524[_0xb2a5('0x5f')]==='booked'){_0x394736=0x1;}if(_0x394736>this[_0xb2a5('0x24')]){_0x394736=this['maxNumberOriginate'];}_0x51d524[_0xb2a5('0xc8')]+=_0x394736;for(var _0x100807 in this[_0xb2a5('0x22')]){if(typeof this[_0xb2a5('0x22')][_0x100807]!=='undefined'){if(this[_0xb2a5('0x22')][_0x100807][_0xb2a5('0xad')]===_0xb2a5('0x20d')&&this[_0xb2a5('0x22')][_0x100807][_0xb2a5('0xb5')]===_0xb2a5('0xdf')){_0x2bfd35['push'](this['agents'][_0x100807]['id']);}}}this[_0xb2a5('0xc7')](_0x51d524['id'],_0x2bfd35,_0x394736,_0x51d524['dialOrderByScheduledAt'],_0x51d524)[_0xb2a5('0xbb')](function(_0x1f4e72){_0x51d524[_0xb2a5('0xc8')]-=_0x394736;_0x51d524[_0xb2a5('0xc8')]=_0x51d524[_0xb2a5('0xc8')]>0x0?_0x51d524['temp']:0x0;if(!checkContactEmpty(_0x1f4e72)){_0x283654['countReScheduled'](_0x51d524)[_0xb2a5('0xbb')](sendMessageReschedule(_0x51d524))['catch'](loggerCatch(_0xb2a5('0x20e')));}else{_0x51d524['originated']+=_0x1f4e72[_0xb2a5('0xa1')];_0x51d524['message']=_0x51d524[_0xb2a5('0x5f')]===_0xb2a5('0x15a')?'ACTIVE':'RUNNING';for(var _0x4987e7=0x0;_0x4987e7<_0x1f4e72['length'];_0x4987e7+=0x1){if(_['isNil'](_0x1f4e72[_0x4987e7])||_[_0xb2a5('0xe2')](_0x1f4e72[_0x4987e7][_0xb2a5('0x16f')])||_[_0xb2a5('0xe2')](_0x1f4e72[_0x4987e7][_0xb2a5('0x16f')]['phone'])){_0x283654[_0xb2a5('0x207')](_0xb2a5('0x208'),_0x51d524,_0x1f4e72[_0x4987e7]);}else{_0x283654[_0xb2a5('0xbe')](_[_0xb2a5('0xd6')](_0x1f4e72[_0x4987e7],['VoiceQueueId','Contact.phone']))[_0xb2a5('0xbb')](_0x283654['checkContactBlack'](_0x51d524,_0x1f4e72[_0x4987e7]))['catch'](_0x283654[_0xb2a5('0xd3')](_0xb2a5('0x208'),_0x51d524));}}}})[_0xb2a5('0xbd')](loggerGetContactDialer(_0xb2a5('0x20f'),_0x51d524,_0x394736));}};Dialer[_0xb2a5('0x1b')][_0xb2a5('0x99')]=function(_0x129fee){if(_0x129fee[_0xb2a5('0x20c')]>0x0){var _0x58d6a0=_0x129fee[_0xb2a5('0x20c')]-_0x129fee[_0xb2a5('0x79')]-_0x129fee['talking'];if(_0x58d6a0>0x0){this[_0xb2a5('0x210')](_0x129fee);}else{loggerPredictiveCalls[_0xb2a5('0x83')](_0xb2a5('0x211'));}}else{this[_0xb2a5('0x210')](_0x129fee);}};Dialer['prototype']['tryOriginatePredictive']=function(_0x59d1f6){var _0x3e7c21=this;var _0x1d8a71=[];_0x59d1f6[_0xb2a5('0x79')]+=0x1;for(var _0x2760f7 in this[_0xb2a5('0x22')]){if(typeof this[_0xb2a5('0x22')][_0x2760f7]!=='undefined'){if(this[_0xb2a5('0x22')][_0x2760f7][_0xb2a5('0xad')]===_0xb2a5('0x20d')&&this[_0xb2a5('0x22')][_0x2760f7][_0xb2a5('0xb5')]==='reachable'){_0x1d8a71[_0xb2a5('0x12e')](this[_0xb2a5('0x22')][_0x2760f7]['id']);}}}this[_0xb2a5('0xc7')](_0x59d1f6['id'],_0x1d8a71,0x1,_0x59d1f6[_0xb2a5('0x204')],_0x59d1f6)['then'](function(_0x3a7b72){if(!checkContactEmpty(_0x3a7b72)){checkContactLowerLimitOriginate(_0x59d1f6,0x1,0x0);_0x3e7c21[_0xb2a5('0xbc')](_0x59d1f6)[_0xb2a5('0xbb')](sendMessageReschedule(_0x59d1f6))[_0xb2a5('0xbd')](loggerCatch(_0xb2a5('0x20e')));}else{_0x59d1f6[_0xb2a5('0x43')]=_0xb2a5('0x205');if(_[_0xb2a5('0xe2')](_0x3a7b72[0x0])||_[_0xb2a5('0xe2')](_0x3a7b72[0x0][_0xb2a5('0x16f')])||_[_0xb2a5('0xe2')](_0x3a7b72[0x0][_0xb2a5('0x16f')][_0xb2a5('0x16e')])){_0x3e7c21['emptyContact'](_0xb2a5('0x208'),_0x59d1f6,_0x3a7b72[0x0]);}else{_0x3e7c21[_0xb2a5('0xbe')](_[_0xb2a5('0xd6')](_0x3a7b72[0x0],[_0xb2a5('0x100'),_0xb2a5('0x20a')]))[_0xb2a5('0xbb')](_0x3e7c21['checkContactBlack'](_0x59d1f6,_0x3a7b72[0x0]))[_0xb2a5('0xbd')](_0x3e7c21[_0xb2a5('0xd3')](_0xb2a5('0x212'),_0x59d1f6));}}})['catch'](loggerGetContactDialer(_0xb2a5('0x213'),_0x59d1f6,0x1));emitVoiceQueueSummary(_0x59d1f6);};Dialer[_0xb2a5('0x1b')][_0xb2a5('0x1df')]=function(_0x7a78d5,_0x5af271,_0x24c30b,_0x5daba9,_0x50369d,_0x341c21){loggerPredictive['info'](_0xb2a5('0x214'));loggerPredictive[_0xb2a5('0x83')](_0xb2a5('0x215'),_0x7a78d5);loggerPredictive['info'](_0xb2a5('0x216'),_0x5af271);loggerPredictive[_0xb2a5('0x83')](_0xb2a5('0x217'),_0x24c30b);loggerPredictive[_0xb2a5('0x83')](_0xb2a5('0x218'),_0x5daba9);loggerPredictive[_0xb2a5('0x83')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x50369d);loggerPredictive['info']('---------------------------');return new BPromise(function(_0x45a78f,_0x1eb08d){if(_0x7a78d5<=0x0||isNaN(_0x7a78d5)){return _0x1eb08d(msgResponse(_0xb2a5('0x219'),_0xb2a5('0x21a'),'m\x20=\x20'+_0x7a78d5));}if(_0x24c30b<=0x0||isNaN(_0x24c30b)){return _0x1eb08d(msgResponse(_0xb2a5('0x219'),_0xb2a5('0x21a'),_0xb2a5('0x21b')+_0x24c30b));}if(_0x5daba9<=0x0||isNaN(_0x5daba9)){return _0x1eb08d(msgResponse(_0xb2a5('0x219'),'Error',_0xb2a5('0x21c')+_0x5daba9));}if(_0x5af271<=0x0||isNaN(_0x5af271)){return _0x1eb08d(msgResponse(_0xb2a5('0x219'),_0xb2a5('0x21a'),'interval\x20=\x20'+_0x5af271));}if(_0x50369d<=0x0||isNaN(_0x50369d)){return _0x1eb08d(msgResponse(_0xb2a5('0x219'),_0xb2a5('0x21a'),_0xb2a5('0x21d')+_0x50369d));}_0x341c21=_0x341c21||0x0;var _0x24d1f0=0x1/_0x24c30b;var _0x5aab4e=0x0;var _0x500f2a=0x0;var _0x216d19=0x0;var _0xc7b366=0x0;for(var _0x1185c3=0x0;_0x216d19<_0x50369d;_0x1185c3+=0x1){_0x500f2a=_0x1185c3/_0x5af271;_0x5aab4e=(_0x5daba9*_0x500f2a+_0x341c21)/_0x24d1f0;_0x216d19=erlangb(_0x5aab4e,_0x7a78d5);_0xc7b366=_0x5aab4e/_0x7a78d5*(0x1-erlangb(_0x5aab4e,_0x7a78d5));}return _0x45a78f({'erlangCalls':_0x1185c3,'erlangCallToSecond':_0x5af271/_0x1185c3,'erlangAbandonmentRate':_0x216d19,'erlangBusyFactor':_0xc7b366});});};Dialer['prototype'][_0xb2a5('0x1e1')]=function(_0x16abe1,_0x2f7319,_0x526e4d,_0x49e0aa,_0x3c8368,_0x5d5619){loggerPredictive['info'](_0xb2a5('0x21e'));loggerPredictive[_0xb2a5('0x83')](_0xb2a5('0x215'),_0x16abe1);loggerPredictive[_0xb2a5('0x83')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2f7319);loggerPredictive[_0xb2a5('0x83')](_0xb2a5('0x217'),_0x526e4d);loggerPredictive[_0xb2a5('0x83')](_0xb2a5('0x218'),_0x49e0aa);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',_0x3c8368);loggerPredictive['info'](_0xb2a5('0x89'));return new BPromise(function(_0x4a3b4a,_0x152af8){if(_0x16abe1<=0x0||isNaN(_0x16abe1)){return _0x152af8(msgResponse(_0xb2a5('0x21f'),_0xb2a5('0x21a'),_0xb2a5('0x220')+_0x16abe1));}if(_0x526e4d<=0x0||isNaN(_0x526e4d)){return _0x152af8(msgResponse(_0xb2a5('0x21f'),'Error',_0xb2a5('0x21b')+_0x526e4d));}if(_0x49e0aa<=0x0||isNaN(_0x49e0aa)){return _0x152af8(msgResponse('[busyFactor]',_0xb2a5('0x21a'),_0xb2a5('0x21c')+_0x49e0aa));}if(_0x2f7319<=0x0||isNaN(_0x2f7319)){return _0x152af8(msgResponse(_0xb2a5('0x21f'),'Error',_0xb2a5('0x221')+_0x2f7319));}if(_0x3c8368<=0x0||isNaN(_0x3c8368)){return _0x152af8(msgResponse(_0xb2a5('0x21f'),_0xb2a5('0x21a'),'Umin\x20=\x20'+_0x3c8368));}_0x5d5619=_0x5d5619||0x0;var _0x15b3da=0x1/_0x526e4d;var _0x55140a=0x0;var _0x32e461=0x0;var _0x5e9012=0x0;var _0x50dbfe=0x0;for(var _0x53e554=0x0;_0x50dbfe<_0x3c8368;_0x53e554+=0x1){_0x32e461=_0x53e554/_0x2f7319;_0x55140a=(_0x49e0aa*_0x32e461+_0x5d5619)/_0x15b3da;_0x5e9012=erlangb(_0x55140a,_0x16abe1);_0x50dbfe=_0x55140a/_0x16abe1*(0x1-erlangb(_0x55140a,_0x16abe1));}return _0x4a3b4a({'erlangCalls':_0x53e554,'erlangCallToSecond':_0x2f7319/_0x53e554,'erlangAbandonmentRate':_0x5e9012,'erlangBusyFactor':_0x50dbfe});});};module[_0xb2a5('0x222')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index a1d95c9..b006bee 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 _0xa971=['countabandonedretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','talktime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','seconds','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countdropretry','countmachineretry','countnosuchnumberretry'];(function(_0x41bbaa,_0x532d97){var _0x2f639f=function(_0xa577a3){while(--_0xa577a3){_0x41bbaa['push'](_0x41bbaa['shift']());}};_0x2f639f(++_0x532d97);}(_0xa971,0x9a));var _0x1a97=function(_0x5af5e3,_0x2a3faa){_0x5af5e3=_0x5af5e3-0x0;var _0x94e4b7=_0xa971[_0x5af5e3];return _0x94e4b7;};'use strict';var util=require(_0x1a97('0x0'));var _=require(_0x1a97('0x1'));var moment=require('moment');function getSeconds(_0xe09bfc,_0x50290d){var _0x598059=moment(_0xe09bfc)['milliseconds'](0x0);var _0x2e9b75=moment(_0x50290d)[_0x1a97('0x2')](0x0);return _0x598059['diff'](_0x2e9b75,_0x1a97('0x3'));}function QueueCallerAbandon(_0x489bc9,_0x175287){this[_0x1a97('0x4')]=_0x489bc9[_0x1a97('0x4')];this[_0x1a97('0x5')]=_0x489bc9[_0x1a97('0x5')];this[_0x1a97('0x6')]=_0x489bc9[_0x1a97('0x5')]==='outbound'?'queue':_0x489bc9['type'];this['countbusyretry']=_0x489bc9[_0x1a97('0x7')];this[_0x1a97('0x8')]=_0x489bc9[_0x1a97('0x8')];this['countnoanswerretry']=_0x489bc9['countnoanswerretry'];this[_0x1a97('0x9')]=_0x489bc9['countbusyretry']+_0x489bc9['countcongestionretry']+_0x489bc9[_0x1a97('0xa')]+_0x489bc9['countnosuchnumberretry']+_0x489bc9[_0x1a97('0xb')]+_0x489bc9['countabandonedretry']+_0x489bc9[_0x1a97('0xc')]+_0x489bc9['countagentrejectretry'];this[_0x1a97('0xd')]=_0x489bc9['countnosuchnumberretry'];this[_0x1a97('0xb')]=_0x489bc9[_0x1a97('0xb')];this[_0x1a97('0xe')]=_0x489bc9[_0x1a97('0xe')];this[_0x1a97('0xc')]=_0x489bc9[_0x1a97('0xc')];this[_0x1a97('0xf')]=_0x489bc9[_0x1a97('0xf')];this[_0x1a97('0x10')]=_0x175287['uniqueid'];this[_0x1a97('0x11')]=_0x489bc9['name'];this[_0x1a97('0x12')]=_0x489bc9[_0x1a97('0x13')];this['starttime']=_0x489bc9[_0x1a97('0x14')];this[_0x1a97('0x15')]=_0x489bc9[_0x1a97('0x15')];this[_0x1a97('0x16')]=_0x489bc9['droptime'];this[_0x1a97('0x17')]=this[_0x1a97('0x16')];this[_0x1a97('0x18')]=getSeconds(_0x489bc9[_0x1a97('0x15')],_0x489bc9[_0x1a97('0x14')]);this['holdtime']=getSeconds(this[_0x1a97('0x16')],_0x489bc9[_0x1a97('0x15')]);this[_0x1a97('0x19')]=0x0;this['queue']=_0x175287[_0x1a97('0x1a')];this[_0x1a97('0x1b')]=_0x175287[_0x1a97('0x1c')];this[_0x1a97('0x1d')]=_0x175287['reason'];this[_0x1a97('0x1e')]=_0x489bc9[_0x1a97('0x1e')];this[_0x1a97('0x1f')]=_0x489bc9['callbackuniqueid'];this[_0x1a97('0x20')]=_0x489bc9[_0x1a97('0x20')];this['recallme']=_0x489bc9[_0x1a97('0x21')];this[_0x1a97('0x22')]=_0x489bc9[_0x1a97('0x22')];this['ListId']=_0x489bc9[_0x1a97('0x23')];this[_0x1a97('0x24')]=_0x489bc9[_0x1a97('0x24')];this[_0x1a97('0x25')]=_0x489bc9['VoiceQueueId'];this[_0x1a97('0x26')]=_0x489bc9['CampaignId'];this['originatecalleridnum']=_0x489bc9[_0x1a97('0x27')]||'';this[_0x1a97('0x28')]=_0x489bc9[_0x1a97('0x28')]||'';}module[_0x1a97('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0x7af0=['countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','number','starttime','responsetime','droptime','ringtime','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','util','lodash','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countdropretry'];(function(_0x4920b5,_0x1b84c7){var _0x103a14=function(_0x7a53de){while(--_0x7a53de){_0x4920b5['push'](_0x4920b5['shift']());}};_0x103a14(++_0x1b84c7);}(_0x7af0,0x139));var _0x07af=function(_0x4defd6,_0x37bbd3){_0x4defd6=_0x4defd6-0x0;var _0x4c9276=_0x7af0[_0x4defd6];return _0x4c9276;};'use strict';var util=require(_0x07af('0x0'));var _=require(_0x07af('0x1'));var moment=require('moment');function getSeconds(_0x47f263,_0x4b4915){var _0x1fc91b=moment(_0x47f263)[_0x07af('0x2')](0x0);var _0x592572=moment(_0x4b4915)[_0x07af('0x2')](0x0);return _0x1fc91b[_0x07af('0x3')](_0x592572,_0x07af('0x4'));}function QueueCallerAbandon(_0x4fd716,_0x894925){this[_0x07af('0x5')]=_0x4fd716['scheduledat'];this[_0x07af('0x6')]=_0x4fd716[_0x07af('0x6')];this[_0x07af('0x7')]=_0x4fd716[_0x07af('0x6')]===_0x07af('0x8')?_0x07af('0x9'):_0x4fd716[_0x07af('0x6')];this[_0x07af('0xa')]=_0x4fd716[_0x07af('0xa')];this[_0x07af('0xb')]=_0x4fd716[_0x07af('0xb')];this['countnoanswerretry']=_0x4fd716['countnoanswerretry'];this[_0x07af('0xc')]=_0x4fd716[_0x07af('0xa')]+_0x4fd716[_0x07af('0xb')]+_0x4fd716[_0x07af('0xd')]+_0x4fd716['countnosuchnumberretry']+_0x4fd716[_0x07af('0xe')]+_0x4fd716[_0x07af('0xf')]+_0x4fd716[_0x07af('0x10')]+_0x4fd716[_0x07af('0x11')];this[_0x07af('0x12')]=_0x4fd716['countnosuchnumberretry'];this[_0x07af('0xe')]=_0x4fd716[_0x07af('0xe')];this[_0x07af('0xf')]=_0x4fd716[_0x07af('0xf')];this['countmachineretry']=_0x4fd716[_0x07af('0x10')];this[_0x07af('0x11')]=_0x4fd716[_0x07af('0x11')];this[_0x07af('0x13')]=_0x894925[_0x07af('0x13')];this[_0x07af('0x14')]=_0x4fd716[_0x07af('0x15')];this['calleridnum']=_0x4fd716[_0x07af('0x16')];this['starttime']=_0x4fd716[_0x07af('0x17')];this[_0x07af('0x18')]=_0x4fd716[_0x07af('0x18')];this[_0x07af('0x19')]=_0x4fd716['droptime'];this['endtime']=this['droptime'];this[_0x07af('0x1a')]=getSeconds(_0x4fd716[_0x07af('0x18')],_0x4fd716[_0x07af('0x17')]);this[_0x07af('0x1b')]=getSeconds(this[_0x07af('0x19')],_0x4fd716[_0x07af('0x18')]);this[_0x07af('0x1c')]=0x0;this[_0x07af('0x9')]=_0x894925[_0x07af('0x9')];this['membername']=_0x894925[_0x07af('0x1d')];this['reason']=_0x894925[_0x07af('0x1e')];this[_0x07af('0x1f')]=_0x4fd716[_0x07af('0x1f')];this[_0x07af('0x20')]=_0x4fd716['callbackuniqueid'];this['callbackat']=_0x4fd716[_0x07af('0x21')];this[_0x07af('0x22')]=_0x4fd716[_0x07af('0x22')];this['ContactId']=_0x4fd716[_0x07af('0x23')];this[_0x07af('0x24')]=_0x4fd716[_0x07af('0x24')];this[_0x07af('0x25')]=_0x4fd716[_0x07af('0x25')];this[_0x07af('0x26')]=_0x4fd716['VoiceQueueId'];this[_0x07af('0x27')]=_0x4fd716[_0x07af('0x27')];this['originatecalleridnum']=_0x4fd716['originatecalleridnum']||'';this[_0x07af('0x28')]=_0x4fd716[_0x07af('0x28')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 071d59f..1ab39b4 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(_0x4e1407,_0xb89312){var _0x442f58=function(_0x9e6c0){while(--_0x9e6c0){_0x4e1407['push'](_0x4e1407['shift']());}};_0x442f58(++_0xb89312);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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(_0x7bfdd9,_0x315049){var _0x2a58b9=function(_0x47fbef){while(--_0x47fbef){_0x7bfdd9['push'](_0x7bfdd9['shift']());}};_0x2a58b9(++_0x315049);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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 77ac8c1..4cb8f8a 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 _0xf45e=['checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','bluebird','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','syncFaxStatus','receivefax','syncReceiveFax','syncOriginateResponse','prototype','from-voip-provider','localstationid','uniqueid','channel','\x20syncNewchannel\x20','info','hasOwnProperty','value','channelstate','channelstatedesc','variable','operation','status','\x20syncFaxStatus\x20','remotestationid','resolution','transferrate','filename','calleridnum','pagestransferred','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','name','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','\x20receiveFax\x20','stringify','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xf45e,0x115));var _0xef45=function(_0x362417,_0x9f4207){_0x362417=_0x362417-0x0;var _0x91a5f4=_0xf45e[_0x362417];return _0x91a5f4;};'use strict';var util=require(_0xef45('0x0'));var _=require('lodash');var BPromise=require(_0xef45('0x1'));var uuid=require('uuid');var moment=require(_0xef45('0x2'));var path=require(_0xef45('0x3'));var tiff2pdf=require(_0xef45('0x4'));var gs=require(_0xef45('0x5'));var logger=require(_0xef45('0x6'))(_0xef45('0x7'));var ami=require(_0xef45('0x8'));var rpcDb=require(_0xef45('0x9'));var Channel=require(_0xef45('0xa'));var ut=require(_0xef45('0xb'));var Action=require(_0xef45('0xc'));var faxAccount=require(_0xef45('0xd'));var attachment=require(_0xef45('0xe'));var faxMessage=require(_0xef45('0xf'));function Fax(_0x268ef6){this[_0xef45('0x10')]={};this[_0xef45('0x11')]=_0x268ef6[_0xef45('0x11')];this[_0xef45('0x12')]=_0x268ef6['trunks'];this[_0xef45('0x13')]={};ami['on'](_0xef45('0x14'),this[_0xef45('0x15')][_0xef45('0x16')](this));ami['on'](_0xef45('0x17'),this[_0xef45('0x18')]['bind'](this));ami['on'](_0xef45('0x19'),this[_0xef45('0x1a')][_0xef45('0x16')](this));ami['on'](_0xef45('0x1b'),this[_0xef45('0x1c')]['bind'](this));ami['on']('faxstatus',this[_0xef45('0x1d')]['bind'](this));ami['on'](_0xef45('0x1e'),this[_0xef45('0x1f')][_0xef45('0x16')](this));ami['on']('hangup',this['syncHangup'][_0xef45('0x16')](this));ami['on']('originateresponse',this[_0xef45('0x20')][_0xef45('0x16')](this));}Fax[_0xef45('0x21')][_0xef45('0x15')]=function(_0x4bec7d){if(_0x4bec7d['context']===_0xef45('0x22')){for(var _0x219778 in this[_0xef45('0x11')]){if(this[_0xef45('0x11')]['hasOwnProperty'](_0x219778)){if(_0x4bec7d['exten']===this[_0xef45('0x11')][_0x219778][_0xef45('0x23')]){this[_0xef45('0x10')][_0x4bec7d[_0xef45('0x24')]]={};this[_0xef45('0x10')][_0x4bec7d[_0xef45('0x24')]][_0xef45('0x25')]=_0x4bec7d['channel'];this[_0xef45('0x10')][_0x4bec7d[_0xef45('0x24')]]['id']=this[_0xef45('0x11')][_0x219778]['id'];this[_0xef45('0x10')][_0x4bec7d[_0xef45('0x24')]]['name']=this[_0xef45('0x11')][_0x219778]['name'];logger['info'](_0x4bec7d[_0xef45('0x24')],_0xef45('0x26'));}}}}if(this[_0xef45('0x13')][_0x4bec7d[_0xef45('0x24')]]){this[_0xef45('0x10')][_0x4bec7d[_0xef45('0x24')]]={};this[_0xef45('0x10')][_0x4bec7d['uniqueid']][_0xef45('0x25')]=_0x4bec7d['channel'];logger[_0xef45('0x27')](_0x4bec7d[_0xef45('0x24')],'\x20syncNewchannel\x20');}};Fax[_0xef45('0x21')][_0xef45('0x18')]=function(_0x479e3c){if(this[_0xef45('0x10')][_0x479e3c['uniqueid']]){for(var _0x550e18 in _0x479e3c['variable']){if(_0x479e3c['variable'][_0xef45('0x28')](_0x550e18)){this[_0xef45('0x10')][_0x479e3c[_0xef45('0x24')]][_0x550e18]=_0x479e3c[_0xef45('0x29')];}}}};Fax['prototype'][_0xef45('0x1a')]=function(_0x4f028c){if(this[_0xef45('0x10')][_0x4f028c['uniqueid']]){this[_0xef45('0x10')][_0x4f028c['uniqueid']]['channelstate']=_0x4f028c[_0xef45('0x2a')];this[_0xef45('0x10')][_0x4f028c[_0xef45('0x24')]][_0xef45('0x2b')]=_0x4f028c[_0xef45('0x2b')];}};Fax['prototype']['syncNewExten']=function(_0x59030b){if(this[_0xef45('0x10')][_0x59030b[_0xef45('0x24')]]){for(var _0x32f3a9 in _0x59030b[_0xef45('0x2c')]){if(_0x59030b[_0xef45('0x2c')][_0xef45('0x28')](_0x32f3a9)){this[_0xef45('0x10')][_0x59030b['uniqueid']][_0x32f3a9]=_0x59030b['value'];}}}};Fax[_0xef45('0x21')]['syncFaxStatus']=function(_0x2aa6bb){if(this['channels'][_0x2aa6bb[_0xef45('0x24')]]){this[_0xef45('0x10')][_0x2aa6bb[_0xef45('0x24')]][_0xef45('0x2d')]=_0x2aa6bb[_0xef45('0x2d')];this['channels'][_0x2aa6bb[_0xef45('0x24')]][_0xef45('0x2e')]=_0x2aa6bb[_0xef45('0x2e')];this['channels'][_0x2aa6bb['uniqueid']][_0xef45('0x23')]=_0x2aa6bb[_0xef45('0x23')];this['channels'][_0x2aa6bb[_0xef45('0x24')]]['filename']=_0x2aa6bb['filename'];logger[_0xef45('0x27')](_0x2aa6bb[_0xef45('0x24')],_0xef45('0x2f'));}};Fax['prototype'][_0xef45('0x1f')]=function(_0x3a1bcc){var _0x2f5a82=this;if(this[_0xef45('0x10')][_0x3a1bcc['uniqueid']]){var _0x5bc364=this[_0xef45('0x10')][_0x3a1bcc[_0xef45('0x24')]]['id'];this[_0xef45('0x10')][_0x3a1bcc[_0xef45('0x24')]][_0xef45('0x30')]=_0x3a1bcc[_0xef45('0x30')];this[_0xef45('0x10')][_0x3a1bcc[_0xef45('0x24')]]['pagestransferred']=_0x3a1bcc['pagestransferred'];this[_0xef45('0x10')][_0x3a1bcc[_0xef45('0x24')]][_0xef45('0x23')]=_0x3a1bcc[_0xef45('0x23')];this[_0xef45('0x10')][_0x3a1bcc[_0xef45('0x24')]][_0xef45('0x31')]=_0x3a1bcc[_0xef45('0x31')];this[_0xef45('0x10')][_0x3a1bcc[_0xef45('0x24')]][_0xef45('0x32')]=_0x3a1bcc[_0xef45('0x32')];this[_0xef45('0x10')][_0x3a1bcc[_0xef45('0x24')]][_0xef45('0x33')]=_0x3a1bcc[_0xef45('0x33')];this['channels'][_0x3a1bcc[_0xef45('0x24')]][_0xef45('0x34')]=_0x3a1bcc[_0xef45('0x34')];if(this[_0xef45('0x10')][_0x3a1bcc['uniqueid']][_0xef45('0x35')]>0x0){tiff2pdf(_0x3a1bcc['filename'],_0xef45('0x36'),function(_0x48833c){logger[_0xef45('0x27')](_0x3a1bcc[_0xef45('0x24')],_0xef45('0x37'),_0x48833c[_0xef45('0x38')]);attachment[_0xef45('0x39')]({'name':path[_0xef45('0x3a')](_0x3a1bcc[_0xef45('0x33')])['name'],'basename':path[_0xef45('0x3a')](_0x3a1bcc[_0xef45('0x33')])[_0xef45('0x3b')]+_0xef45('0x3c'),'type':_0xef45('0x3d')})[_0xef45('0x3e')](function(_0xc692c0){faxAccount[_0xef45('0x3f')](_0x5bc364,{'from':_0x3a1bcc[_0xef45('0x34')],'mapKey':_0xef45('0x7'),'body':path[_0xef45('0x3a')](_0x3a1bcc[_0xef45('0x33')])[_0xef45('0x3b')]+_0xef45('0x3c'),'AttachmentId':_0xc692c0['id']})[_0xef45('0x40')](function(_0x4a2793){logger[_0xef45('0x41')](_0x3a1bcc[_0xef45('0x24')],_0xef45('0x42'),JSON['stringify'](_0x4a2793));});})['catch'](function(_0x4ae55f){logger[_0xef45('0x41')](_0x3a1bcc[_0xef45('0x24')],_0xef45('0x43'),JSON[_0xef45('0x44')](_0x4ae55f));});});}logger[_0xef45('0x27')](_0x3a1bcc[_0xef45('0x24')],'\x20receiveFax\x20');}};Fax[_0xef45('0x21')][_0xef45('0x20')]=function(_0x2b2419){if(this['actions'][_0x2b2419['uniqueid']]){_[_0xef45('0x45')](this[_0xef45('0x10')][_0x2b2419['uniqueid']],_[_0xef45('0x46')](_0x2b2419,[_0xef45('0x47'),_0xef45('0x48')]));}};function updateStatus(_0x39e9f8){if(_0x39e9f8[_0xef45('0x49')]){faxMessage[_0xef45('0x4a')](_0x39e9f8[_0xef45('0x49')],{'failMessage':_0xef45('0x4b')})[_0xef45('0x3e')](function(_0x1f3a10){ut[_0xef45('0x4c')](_0xef45('0x4d'),_0x1f3a10);})[_0xef45('0x40')](function(_0x1c1be2){ut['logger'](_0xef45('0x4e'),_0x1c1be2);});}else{ut[_0xef45('0x4c')](_0xef45('0x4f'));}}Fax['prototype'][_0xef45('0x50')]=function(_0x3f9b9a,_0x464bda,_0x1531ea){var _0x5a6a68=this;var _0x14bf49={};if(_0x464bda){_0x14bf49={'read':_0x464bda};}else{_0x14bf49={'failMessage':_0x1531ea};}if(this[_0xef45('0x13')][_0x3f9b9a][_0xef45('0x49')]){faxMessage[_0xef45('0x4a')](this[_0xef45('0x13')][_0x3f9b9a][_0xef45('0x49')],_0x14bf49)[_0xef45('0x3e')](function(_0x1a1ce5){ut[_0xef45('0x4c')](_0xef45('0x51'),_0x1a1ce5);})[_0xef45('0x40')](function(_0x24d158){ut['logger'](_0xef45('0x52'),_0x24d158);})[_0xef45('0x53')](function(){delete _0x5a6a68[_0xef45('0x10')][_0x3f9b9a];delete _0x5a6a68[_0xef45('0x13')][_0x3f9b9a];});}else{ut[_0xef45('0x4c')](_0xef45('0x54'));delete this['channels'][_0x3f9b9a];delete this['actions'][_0x3f9b9a];}};Fax[_0xef45('0x21')]['syncHangup']=function(_0x180574){var _0x2841df=this;if(this[_0xef45('0x10')][_0x180574['uniqueid']]){if(this[_0xef45('0x13')][_0x180574[_0xef45('0x24')]]){this['channels'][_0x180574[_0xef45('0x24')]]['id']=this['actions'][_0x180574['uniqueid']]['id'];this[_0xef45('0x10')][_0x180574[_0xef45('0x24')]][_0xef45('0x3b')]=this[_0xef45('0x13')][_0x180574[_0xef45('0x24')]]['name'];}logger[_0xef45('0x27')](_0x180574[_0xef45('0x24')],this['actions'][_0x180574[_0xef45('0x24')]]?_0xef45('0x55'):_0xef45('0x56'),JSON[_0xef45('0x44')](this[_0xef45('0x10')][_0x180574[_0xef45('0x24')]]));if(this[_0xef45('0x13')][_0x180574[_0xef45('0x24')]]){if(this['channels'][_0x180574[_0xef45('0x24')]]['faxpages']>0x0&&this['channels'][_0x180574[_0xef45('0x24')]]['faxstatus']===_0xef45('0x57')){this[_0xef45('0x50')](_0x180574['uniqueid'],!![]);}else{this[_0xef45('0x50')](_0x180574[_0xef45('0x24')],![],this[_0xef45('0x10')][_0x180574[_0xef45('0x24')]][_0xef45('0x58')]?_0xef45('0x59')+this['channels'][_0x180574[_0xef45('0x24')]][_0xef45('0x58')]:_0xef45('0x5a'));}}}};Fax[_0xef45('0x21')][_0xef45('0x5b')]=function(_0x51f841){var _0x2a7857=this;return new BPromise(function(_0x5e485d,_0x10723e){_0x2a7857[_0xef45('0x5c')](_0x51f841,_0x2a7857['faxAccounts'][_0x51f841[_0xef45('0x5d')]])[_0xef45('0x3e')](function(_0x2ec530){ut['logger']('[Fax][execOriginate][success]',_0x2ec530);_0x5e485d(ut[_0xef45('0x38')](_0xef45('0x5e')));})[_0xef45('0x40')](function(_0x55fcf3){ut[_0xef45('0x4c')](_0xef45('0x5f'),_0x55fcf3);updateStatus(_0x51f841);_0x10723e(ut['message'](_0xef45('0x60')));});});};Fax['prototype'][_0xef45('0x61')]=function(_0x6d0e51){var _0x17c2f2=this;return new BPromise(function(_0x26c230,_0x69bad2){var _0xfa4b8a=_0x17c2f2[_0xef45('0x62')](_0x17c2f2[_0xef45('0x11')][_0x6d0e51['FaxAccountId']][_0xef45('0x63')],_0x6d0e51);if(_0xfa4b8a[_0xef45('0x64')]){_0x26c230(ut[_0xef45('0x38')](_0xef45('0x65')));}else{_0x69bad2(ut[_0xef45('0x38')](_0xfa4b8a[_0xef45('0x38')]));}});};function originate(_0xef7b79,_0x14ae27,_0x444d39){return new BPromise(function(_0x41952f,_0xbf9898){if(_0x444d39){var _0x4f9517=util[_0xef45('0x66')](_0xef45('0x67'),path[_0xef45('0x3a')](_0xef7b79[_0xef45('0x3')])[_0xef45('0x3b')],_0xef7b79['path']);gs[_0xef45('0x68')](_0x4f9517)[_0xef45('0x3e')](function(){_0xef7b79['path']=util['format'](_0xef45('0x69'),path[_0xef45('0x3a')](_0xef7b79['path'])['dir'],path['parse'](_0xef7b79[_0xef45('0x3')])[_0xef45('0x3b')]);_0x14ae27['XMF-PATH']=_0xef7b79['path'];ut[_0xef45('0x4c')]('Convert\x20pdf\x20to\x20tif','');ami[_0xef45('0x6a')](ut[_0xef45('0x6b')](_0xef7b79,_0x14ae27))[_0xef45('0x3e')](function(_0x48e5e8){_0x41952f(_0x48e5e8);})[_0xef45('0x40')](function(_0x3ce74b){_0xbf9898(_0x3ce74b);});})[_0xef45('0x40')](function(_0x4ffc0f){_0xbf9898(_0x4ffc0f);});}else{ami[_0xef45('0x6a')](ut[_0xef45('0x6b')](_0xef7b79,_0x14ae27))[_0xef45('0x3e')](function(_0x26d598){_0x41952f(_0x26d598);})[_0xef45('0x40')](function(_0x3c7a0f){_0xbf9898(_0x3c7a0f);});}});}Fax['prototype']['execOriginate']=function(_0x18e5b9,_0x13f5b6){var _0x2989aa=this;return new BPromise(function(_0x34874e,_0x2a2bb6){var _0xc98761=uuid['v4']();var _0x2e8a76=ut[_0xef45('0x6c')](_0x18e5b9,_0x13f5b6);_0x2989aa['actions'][_0xc98761]=new Action(_0xc98761,_0x13f5b6,_0x18e5b9);var _0x31b0a3=_0x2989aa[_0xef45('0x13')][_0xc98761];if(path[_0xef45('0x3a')](_0x18e5b9[_0xef45('0x3')])[_0xef45('0x6d')]===_0xef45('0x3c')){originate(_0x31b0a3,_0x2e8a76,!![])[_0xef45('0x3e')](function(_0x5ece80){_0x34874e(_0x5ece80);})[_0xef45('0x40')](function(_0x4b5bba){_0x2a2bb6(_0x4b5bba);});}else{originate(_0x31b0a3,_0x2e8a76,![])[_0xef45('0x3e')](function(_0x2a8ad9){_0x34874e(_0x2a8ad9);})['catch'](function(_0x341f0e){_0x2a2bb6(_0x341f0e);});}});};Fax[_0xef45('0x21')][_0xef45('0x6e')]=function(_0x4d2c50){return!_[_0xef45('0x6f')](_0x4d2c50)&&!_['isNil'](_0x4d2c50[_0xef45('0x3b')])&&!_[_0xef45('0x6f')](_0x4d2c50[_0xef45('0x70')])&&_0x4d2c50[_0xef45('0x70')]&&!_['isNil'](this[_0xef45('0x12')][util[_0xef45('0x66')](_0xef45('0x71'),_0x4d2c50['name'])])&&!_[_0xef45('0x6f')](this[_0xef45('0x12')][util[_0xef45('0x66')](_0xef45('0x71'),_0x4d2c50[_0xef45('0x3b')])]['status'])&&(this[_0xef45('0x12')][util[_0xef45('0x66')](_0xef45('0x71'),_0x4d2c50[_0xef45('0x3b')])][_0xef45('0x2e')]===_0xef45('0x72')||this[_0xef45('0x12')][util[_0xef45('0x66')](_0xef45('0x71'),_0x4d2c50['name'])][_0xef45('0x2e')]===_0xef45('0x73'));};Fax[_0xef45('0x21')]['checkTrunk']=function(_0xcd8038,_0x4fbf84){if(!this[_0xef45('0x6e')](_0xcd8038)){ut[_0xef45('0x4c')](_0xef45('0x74'),_[_0xef45('0x6f')](_0xcd8038)?'':_0xcd8038[_0xef45('0x3b')]+_0xef45('0x75'));return{'isValid':![],'message':_0xef45('0x76')};}if(_[_0xef45('0x6f')](_0x4fbf84[_0xef45('0x7')])){ut[_0xef45('0x4c')](_0xef45('0x77'),JSON[_0xef45('0x44')](_0x4fbf84));return{'isValid':![],'message':_0xef45('0x78')};}if(_[_0xef45('0x6f')](_0x4fbf84[_0xef45('0x3')])){ut[_0xef45('0x4c')](_0xef45('0x79'),JSON[_0xef45('0x44')](_0x4fbf84));return{'isValid':![],'message':_0xef45('0x7a')};}return{'isValid':!![],'message':_0xef45('0x7b')};};module[_0xef45('0x7c')]=Fax; \ No newline at end of file +var _0x02ce=['operation','status','filename','\x20syncFaxStatus\x20','remotestationid','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','reason','AttachmentId','update','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxstatus','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','isValid','Trunk\x20Reachable','format','path','execute','%s/%s.tif','XMF-PATH','Action','variablesAction','addVariables','ext','isNil','active','SIP/%s','reachable','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','lodash','bluebird','moment','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncReceiveFax','hangup','originateresponse','prototype','context','hasOwnProperty','exten','localstationid','channel','name','info','uniqueid','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncFaxStatus'];(function(_0x4e630a,_0x3c006b){var _0x2cc905=function(_0x2057e9){while(--_0x2057e9){_0x4e630a['push'](_0x4e630a['shift']());}};_0x2cc905(++_0x3c006b);}(_0x02ce,0x1ac));var _0xe02c=function(_0xb151a9,_0x5cb27b){_0xb151a9=_0xb151a9-0x0;var _0x265187=_0x02ce[_0xb151a9];return _0x265187;};'use strict';var util=require(_0xe02c('0x0'));var _=require(_0xe02c('0x1'));var BPromise=require(_0xe02c('0x2'));var uuid=require('uuid');var moment=require(_0xe02c('0x3'));var path=require('path');var tiff2pdf=require(_0xe02c('0x4'));var gs=require(_0xe02c('0x5'));var logger=require(_0xe02c('0x6'))(_0xe02c('0x7'));var ami=require(_0xe02c('0x8'));var rpcDb=require(_0xe02c('0x9'));var Channel=require(_0xe02c('0xa'));var ut=require(_0xe02c('0xb'));var Action=require(_0xe02c('0xc'));var faxAccount=require('../rpc/faxAccount');var attachment=require('../rpc/attachment');var faxMessage=require(_0xe02c('0xd'));function Fax(_0x2d85d7){this[_0xe02c('0xe')]={};this[_0xe02c('0xf')]=_0x2d85d7[_0xe02c('0xf')];this[_0xe02c('0x10')]=_0x2d85d7[_0xe02c('0x10')];this[_0xe02c('0x11')]={};ami['on'](_0xe02c('0x12'),this[_0xe02c('0x13')][_0xe02c('0x14')](this));ami['on'](_0xe02c('0x15'),this[_0xe02c('0x16')][_0xe02c('0x14')](this));ami['on'](_0xe02c('0x17'),this[_0xe02c('0x18')][_0xe02c('0x14')](this));ami['on'](_0xe02c('0x19'),this['syncNewExten'][_0xe02c('0x14')](this));ami['on']('faxstatus',this['syncFaxStatus'][_0xe02c('0x14')](this));ami['on']('receivefax',this[_0xe02c('0x1a')]['bind'](this));ami['on'](_0xe02c('0x1b'),this['syncHangup'][_0xe02c('0x14')](this));ami['on'](_0xe02c('0x1c'),this['syncOriginateResponse'][_0xe02c('0x14')](this));}Fax[_0xe02c('0x1d')]['syncNewchannel']=function(_0x12a564){if(_0x12a564[_0xe02c('0x1e')]==='from-voip-provider'){for(var _0x52917f in this[_0xe02c('0xf')]){if(this['faxAccounts'][_0xe02c('0x1f')](_0x52917f)){if(_0x12a564[_0xe02c('0x20')]===this[_0xe02c('0xf')][_0x52917f][_0xe02c('0x21')]){this[_0xe02c('0xe')][_0x12a564['uniqueid']]={};this[_0xe02c('0xe')][_0x12a564['uniqueid']]['channel']=_0x12a564[_0xe02c('0x22')];this[_0xe02c('0xe')][_0x12a564['uniqueid']]['id']=this[_0xe02c('0xf')][_0x52917f]['id'];this[_0xe02c('0xe')][_0x12a564['uniqueid']][_0xe02c('0x23')]=this[_0xe02c('0xf')][_0x52917f][_0xe02c('0x23')];logger[_0xe02c('0x24')](_0x12a564[_0xe02c('0x25')],_0xe02c('0x26'));}}}}if(this[_0xe02c('0x11')][_0x12a564[_0xe02c('0x25')]]){this[_0xe02c('0xe')][_0x12a564[_0xe02c('0x25')]]={};this[_0xe02c('0xe')][_0x12a564['uniqueid']][_0xe02c('0x22')]=_0x12a564[_0xe02c('0x22')];logger[_0xe02c('0x24')](_0x12a564[_0xe02c('0x25')],_0xe02c('0x26'));}};Fax[_0xe02c('0x1d')][_0xe02c('0x16')]=function(_0x1c14d6){if(this['channels'][_0x1c14d6[_0xe02c('0x25')]]){for(var _0x3790eb in _0x1c14d6[_0xe02c('0x27')]){if(_0x1c14d6['variable'][_0xe02c('0x1f')](_0x3790eb)){this[_0xe02c('0xe')][_0x1c14d6[_0xe02c('0x25')]][_0x3790eb]=_0x1c14d6[_0xe02c('0x28')];}}}};Fax[_0xe02c('0x1d')][_0xe02c('0x18')]=function(_0x22a285){if(this[_0xe02c('0xe')][_0x22a285[_0xe02c('0x25')]]){this[_0xe02c('0xe')][_0x22a285[_0xe02c('0x25')]]['channelstate']=_0x22a285[_0xe02c('0x29')];this[_0xe02c('0xe')][_0x22a285[_0xe02c('0x25')]][_0xe02c('0x2a')]=_0x22a285[_0xe02c('0x2a')];}};Fax[_0xe02c('0x1d')]['syncNewExten']=function(_0x436bcc){if(this[_0xe02c('0xe')][_0x436bcc['uniqueid']]){for(var _0x1ce34c in _0x436bcc[_0xe02c('0x27')]){if(_0x436bcc[_0xe02c('0x27')][_0xe02c('0x1f')](_0x1ce34c)){this[_0xe02c('0xe')][_0x436bcc['uniqueid']][_0x1ce34c]=_0x436bcc['value'];}}}};Fax[_0xe02c('0x1d')][_0xe02c('0x2b')]=function(_0x57928e){if(this[_0xe02c('0xe')][_0x57928e['uniqueid']]){this[_0xe02c('0xe')][_0x57928e[_0xe02c('0x25')]][_0xe02c('0x2c')]=_0x57928e[_0xe02c('0x2c')];this[_0xe02c('0xe')][_0x57928e['uniqueid']][_0xe02c('0x2d')]=_0x57928e['status'];this[_0xe02c('0xe')][_0x57928e[_0xe02c('0x25')]][_0xe02c('0x21')]=_0x57928e[_0xe02c('0x21')];this[_0xe02c('0xe')][_0x57928e[_0xe02c('0x25')]]['filename']=_0x57928e[_0xe02c('0x2e')];logger[_0xe02c('0x24')](_0x57928e['uniqueid'],_0xe02c('0x2f'));}};Fax[_0xe02c('0x1d')]['syncReceiveFax']=function(_0x396a06){var _0x4e4df6=this;if(this[_0xe02c('0xe')][_0x396a06[_0xe02c('0x25')]]){var _0x5b05e1=this[_0xe02c('0xe')][_0x396a06[_0xe02c('0x25')]]['id'];this[_0xe02c('0xe')][_0x396a06[_0xe02c('0x25')]][_0xe02c('0x30')]=_0x396a06[_0xe02c('0x30')];this['channels'][_0x396a06[_0xe02c('0x25')]]['pagestransferred']=_0x396a06['pagestransferred'];this[_0xe02c('0xe')][_0x396a06[_0xe02c('0x25')]][_0xe02c('0x21')]=_0x396a06[_0xe02c('0x21')];this['channels'][_0x396a06[_0xe02c('0x25')]][_0xe02c('0x31')]=_0x396a06[_0xe02c('0x31')];this['channels'][_0x396a06['uniqueid']][_0xe02c('0x32')]=_0x396a06[_0xe02c('0x32')];this[_0xe02c('0xe')][_0x396a06[_0xe02c('0x25')]][_0xe02c('0x2e')]=_0x396a06[_0xe02c('0x2e')];this[_0xe02c('0xe')][_0x396a06[_0xe02c('0x25')]][_0xe02c('0x33')]=_0x396a06['calleridnum'];if(this[_0xe02c('0xe')][_0x396a06['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0x396a06[_0xe02c('0x2e')],_0xe02c('0x34'),function(_0x958cbc){logger[_0xe02c('0x24')](_0x396a06[_0xe02c('0x25')],_0xe02c('0x35'),_0x958cbc[_0xe02c('0x36')]);attachment[_0xe02c('0x37')]({'name':path['parse'](_0x396a06['filename'])[_0xe02c('0x23')],'basename':path[_0xe02c('0x38')](_0x396a06[_0xe02c('0x2e')])['name']+_0xe02c('0x39'),'type':_0xe02c('0x3a')})[_0xe02c('0x3b')](function(_0x1fb73c){faxAccount[_0xe02c('0x3c')](_0x5b05e1,{'from':_0x396a06[_0xe02c('0x33')],'mapKey':_0xe02c('0x7'),'body':path[_0xe02c('0x38')](_0x396a06[_0xe02c('0x2e')])[_0xe02c('0x23')]+'.pdf','AttachmentId':_0x1fb73c['id']})[_0xe02c('0x3d')](function(_0x18895e){logger[_0xe02c('0x3e')](_0x396a06[_0xe02c('0x25')],_0xe02c('0x3f'),JSON[_0xe02c('0x40')](_0x18895e));});})[_0xe02c('0x3d')](function(_0x3502a5){logger[_0xe02c('0x3e')](_0x396a06[_0xe02c('0x25')],_0xe02c('0x41'),JSON[_0xe02c('0x40')](_0x3502a5));});});}logger[_0xe02c('0x24')](_0x396a06['uniqueid'],_0xe02c('0x41'));}};Fax['prototype'][_0xe02c('0x42')]=function(_0x324911){if(this[_0xe02c('0x11')][_0x324911[_0xe02c('0x25')]]){_[_0xe02c('0x43')](this[_0xe02c('0xe')][_0x324911[_0xe02c('0x25')]],_[_0xe02c('0x44')](_0x324911,[_0xe02c('0x45'),_0xe02c('0x46')]));}};function updateStatus(_0x4f2a6e){if(_0x4f2a6e[_0xe02c('0x47')]){faxMessage[_0xe02c('0x48')](_0x4f2a6e[_0xe02c('0x47')],{'failMessage':'SENDING\x20FAILED\x20'})[_0xe02c('0x3b')](function(_0x5ab97d){ut[_0xe02c('0x49')]('[Fax][Message][Error][Updated]',_0x5ab97d);})['catch'](function(_0x5b66f4){ut['logger']('[Fax][Message][Error][NoUpdate1]',_0x5b66f4);});}else{ut['logger'](_0xe02c('0x4a'));}}Fax[_0xe02c('0x1d')][_0xe02c('0x4b')]=function(_0x35fbe2,_0x5d963d,_0x274beb){var _0x133f3a=this;var _0x4d2bff={};if(_0x5d963d){_0x4d2bff={'read':_0x5d963d};}else{_0x4d2bff={'failMessage':_0x274beb};}if(this[_0xe02c('0x11')][_0x35fbe2][_0xe02c('0x47')]){faxMessage[_0xe02c('0x48')](this['actions'][_0x35fbe2]['AttachmentId'],_0x4d2bff)[_0xe02c('0x3b')](function(_0x44a9f3){ut[_0xe02c('0x49')]('[Fax][Message][Updated]',_0x44a9f3);})[_0xe02c('0x3d')](function(_0x53765c){ut['logger'](_0xe02c('0x4c'),_0x53765c);})[_0xe02c('0x4d')](function(){delete _0x133f3a['channels'][_0x35fbe2];delete _0x133f3a[_0xe02c('0x11')][_0x35fbe2];});}else{ut[_0xe02c('0x49')](_0xe02c('0x4e'));delete this['channels'][_0x35fbe2];delete this[_0xe02c('0x11')][_0x35fbe2];}};Fax[_0xe02c('0x1d')]['syncHangup']=function(_0x3788e8){var _0x31ba51=this;if(this[_0xe02c('0xe')][_0x3788e8[_0xe02c('0x25')]]){if(this[_0xe02c('0x11')][_0x3788e8[_0xe02c('0x25')]]){this[_0xe02c('0xe')][_0x3788e8[_0xe02c('0x25')]]['id']=this[_0xe02c('0x11')][_0x3788e8['uniqueid']]['id'];this['channels'][_0x3788e8['uniqueid']][_0xe02c('0x23')]=this[_0xe02c('0x11')][_0x3788e8[_0xe02c('0x25')]]['name'];}logger['info'](_0x3788e8[_0xe02c('0x25')],this[_0xe02c('0x11')][_0x3788e8[_0xe02c('0x25')]]?_0xe02c('0x4f'):_0xe02c('0x50'),JSON['stringify'](this[_0xe02c('0xe')][_0x3788e8[_0xe02c('0x25')]]));if(this['actions'][_0x3788e8['uniqueid']]){if(this[_0xe02c('0xe')][_0x3788e8['uniqueid']]['faxpages']>0x0&&this['channels'][_0x3788e8[_0xe02c('0x25')]][_0xe02c('0x51')]===_0xe02c('0x52')){this[_0xe02c('0x4b')](_0x3788e8[_0xe02c('0x25')],!![]);}else{this[_0xe02c('0x4b')](_0x3788e8['uniqueid'],![],this[_0xe02c('0xe')][_0x3788e8['uniqueid']]['faxstatusstring']?_0xe02c('0x53')+this[_0xe02c('0xe')][_0x3788e8[_0xe02c('0x25')]][_0xe02c('0x54')]:'SENDING\x20FAILED');}}}};Fax[_0xe02c('0x1d')][_0xe02c('0x55')]=function(_0x5d2119){var _0xa7133f=this;return new BPromise(function(_0x44bfd0,_0x4cc74d){_0xa7133f[_0xe02c('0x56')](_0x5d2119,_0xa7133f[_0xe02c('0xf')][_0x5d2119[_0xe02c('0x57')]])[_0xe02c('0x3b')](function(_0x323f3b){ut[_0xe02c('0x49')](_0xe02c('0x58'),_0x323f3b);_0x44bfd0(ut['message'](_0xe02c('0x59')));})['catch'](function(_0x558344){ut['logger'](_0xe02c('0x5a'),_0x558344);updateStatus(_0x5d2119);_0x4cc74d(ut[_0xe02c('0x36')](_0xe02c('0x5b')));});});};Fax[_0xe02c('0x1d')]['checkAfterSend']=function(_0x32e149){var _0x327777=this;return new BPromise(function(_0x503bb3,_0x597a64){var _0x4b0ec3=_0x327777[_0xe02c('0x5c')](_0x327777[_0xe02c('0xf')][_0x32e149['FaxAccountId']]['Trunk'],_0x32e149);if(_0x4b0ec3[_0xe02c('0x5d')]){_0x503bb3(ut[_0xe02c('0x36')](_0xe02c('0x5e')));}else{_0x597a64(ut[_0xe02c('0x36')](_0x4b0ec3[_0xe02c('0x36')]));}});};function originate(_0x5bb01d,_0x39c7db,_0x12ac9f){return new BPromise(function(_0x3f277b,_0x2776c0){if(_0x12ac9f){var _0x11c506=util[_0xe02c('0x5f')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0xe02c('0x38')](_0x5bb01d[_0xe02c('0x60')])['name'],_0x5bb01d[_0xe02c('0x60')]);gs[_0xe02c('0x61')](_0x11c506)[_0xe02c('0x3b')](function(){_0x5bb01d[_0xe02c('0x60')]=util['format'](_0xe02c('0x62'),path[_0xe02c('0x38')](_0x5bb01d['path'])['dir'],path['parse'](_0x5bb01d[_0xe02c('0x60')])[_0xe02c('0x23')]);_0x39c7db[_0xe02c('0x63')]=_0x5bb01d[_0xe02c('0x60')];ut[_0xe02c('0x49')]('Convert\x20pdf\x20to\x20tif','');ami[_0xe02c('0x64')](ut[_0xe02c('0x65')](_0x5bb01d,_0x39c7db))[_0xe02c('0x3b')](function(_0x4cc653){_0x3f277b(_0x4cc653);})['catch'](function(_0x4c3c91){_0x2776c0(_0x4c3c91);});})[_0xe02c('0x3d')](function(_0x43d7f7){_0x2776c0(_0x43d7f7);});}else{ami[_0xe02c('0x64')](ut[_0xe02c('0x65')](_0x5bb01d,_0x39c7db))['then'](function(_0x182805){_0x3f277b(_0x182805);})['catch'](function(_0x5a5dba){_0x2776c0(_0x5a5dba);});}});}Fax[_0xe02c('0x1d')][_0xe02c('0x56')]=function(_0x331061,_0x1bbf6a){var _0xea4547=this;return new BPromise(function(_0x2d132e,_0x748217){var _0x12aaea=uuid['v4']();var _0x5ead59=ut[_0xe02c('0x66')](_0x331061,_0x1bbf6a);_0xea4547[_0xe02c('0x11')][_0x12aaea]=new Action(_0x12aaea,_0x1bbf6a,_0x331061);var _0x2386cf=_0xea4547[_0xe02c('0x11')][_0x12aaea];if(path[_0xe02c('0x38')](_0x331061[_0xe02c('0x60')])[_0xe02c('0x67')]===_0xe02c('0x39')){originate(_0x2386cf,_0x5ead59,!![])[_0xe02c('0x3b')](function(_0x411cd5){_0x2d132e(_0x411cd5);})['catch'](function(_0x58acfd){_0x748217(_0x58acfd);});}else{originate(_0x2386cf,_0x5ead59,![])[_0xe02c('0x3b')](function(_0x2a5d54){_0x2d132e(_0x2a5d54);})[_0xe02c('0x3d')](function(_0x76fb21){_0x748217(_0x76fb21);});}});};Fax[_0xe02c('0x1d')]['isTrunkReachable']=function(_0x405b16){return!_[_0xe02c('0x68')](_0x405b16)&&!_[_0xe02c('0x68')](_0x405b16[_0xe02c('0x23')])&&!_[_0xe02c('0x68')](_0x405b16[_0xe02c('0x69')])&&_0x405b16[_0xe02c('0x69')]&&!_[_0xe02c('0x68')](this[_0xe02c('0x10')][util[_0xe02c('0x5f')](_0xe02c('0x6a'),_0x405b16[_0xe02c('0x23')])])&&!_['isNil'](this['trunks'][util[_0xe02c('0x5f')](_0xe02c('0x6a'),_0x405b16['name'])][_0xe02c('0x2d')])&&(this['trunks'][util[_0xe02c('0x5f')]('SIP/%s',_0x405b16[_0xe02c('0x23')])][_0xe02c('0x2d')]===_0xe02c('0x6b')||this[_0xe02c('0x10')][util[_0xe02c('0x5f')](_0xe02c('0x6a'),_0x405b16[_0xe02c('0x23')])][_0xe02c('0x2d')]===_0xe02c('0x6c'));};Fax[_0xe02c('0x1d')]['checkTrunk']=function(_0x5a118f,_0x4d6753){if(!this[_0xe02c('0x6d')](_0x5a118f)){ut[_0xe02c('0x49')](_0xe02c('0x6e'),_[_0xe02c('0x68')](_0x5a118f)?'':_0x5a118f[_0xe02c('0x23')]+_0xe02c('0x6f'));return{'isValid':![],'message':_0xe02c('0x70')};}if(_[_0xe02c('0x68')](_0x4d6753[_0xe02c('0x7')])){ut[_0xe02c('0x49')](_0xe02c('0x71'),JSON[_0xe02c('0x40')](_0x4d6753));return{'isValid':![],'message':_0xe02c('0x72')};}if(_['isNil'](_0x4d6753['path'])){ut[_0xe02c('0x49')](_0xe02c('0x73'),JSON[_0xe02c('0x40')](_0x4d6753));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0xe02c('0x74')};};module[_0xe02c('0x75')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 4a6010f..89e00a1 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 _0x5e70=['lodash','error','resolve','notify','catch','[Notify]\x20','util','bluebird','preview'];(function(_0x350182,_0x2a9feb){var _0x4a0892=function(_0x2c994d){while(--_0x2c994d){_0x350182['push'](_0x350182['shift']());}};_0x4a0892(++_0x2a9feb);}(_0x5e70,0x114));var _0x05e7=function(_0xb8f08e,_0x3542cb){_0xb8f08e=_0xb8f08e-0x0;var _0x397344=_0x5e70[_0xb8f08e];return _0x397344;};'use strict';var util=require(_0x05e7('0x0'));var BPromise=require(_0x05e7('0x1'));var logger=require('../../../config/logger')(_0x05e7('0x2'));var _=require(_0x05e7('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0xf177d8){return function(_0x4699a5){logger[_0x05e7('0x4')](_0xf177d8,util['inspect'](_0x4699a5,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x10885b,_0x5bae12){return BPromise[_0x05e7('0x5')]()['then'](faxAccount[_0x05e7('0x6')](_0x10885b,_0x5bae12))[_0x05e7('0x7')](loggerCatch(_0x05e7('0x8')));}; \ No newline at end of file +var _0x8f09=['resolve','util','bluebird','../rpc/faxAccount','error','inspect','notify'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x8f09,0x1e4));var _0x98f0=function(_0x1df084,_0x4a85f0){_0x1df084=_0x1df084-0x0;var _0xb011d1=_0x8f09[_0x1df084];return _0xb011d1;};'use strict';var util=require(_0x98f0('0x0'));var BPromise=require(_0x98f0('0x1'));var logger=require('../../../config/logger')('preview');var _=require('lodash');var faxAccount=require(_0x98f0('0x2'));function loggerCatch(_0x22b4e8){return function(_0x2afbad){logger[_0x98f0('0x3')](_0x22b4e8,util[_0x98f0('0x4')](_0x2afbad,{'showHidden':![],'depth':null}));};}exports[_0x98f0('0x5')]=function(_0x1d0a60,_0x5bd182){return BPromise[_0x98f0('0x6')]()['then'](faxAccount[_0x98f0('0x5')](_0x1d0a60,_0x5bd182))['catch'](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 6e2a548..8e831ff 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 _0x1790=['execute','info','Exec\x20gs','\x20Error\x20:','util','../../../../config/logger','fax','bluebird','child_process','exec'];(function(_0xbd006c,_0xca087f){var _0x1c130b=function(_0x3742b1){while(--_0x3742b1){_0xbd006c['push'](_0xbd006c['shift']());}};_0x1c130b(++_0xca087f);}(_0x1790,0x194));var _0x0179=function(_0x50eb28,_0x4ade43){_0x50eb28=_0x50eb28-0x0;var _0x1fa12c=_0x1790[_0x50eb28];return _0x1fa12c;};'use strict';var util=require(_0x0179('0x0'));var logger=require(_0x0179('0x1'))(_0x0179('0x2'));var BPromise=require(_0x0179('0x3'));var exec=require(_0x0179('0x4'))[_0x0179('0x5')];exports[_0x0179('0x6')]=function(_0x1141e7){return new BPromise(function(_0x215796,_0x22fca5){exec(_0x1141e7,function(_0x5b37f5,_0x13e603,_0x52128f){logger[_0x0179('0x7')](_0x0179('0x8'),_0x13e603);if(_0x5b37f5){logger[_0x0179('0x7')]('Exec\x20gs',_0x0179('0x9'),util['inspect'](_0x5b37f5,{'showHidden':![],'depth':null}),_0x13e603,_0x52128f);_0x22fca5(_0x5b37f5);}_0x215796(_0x13e603);});});}; \ No newline at end of file +var _0xfc37=['execute','Exec\x20gs','info','fax','child_process','exec'];(function(_0x42ab91,_0x2a0179){var _0x259d35=function(_0x2d48bf){while(--_0x2d48bf){_0x42ab91['push'](_0x42ab91['shift']());}};_0x259d35(++_0x2a0179);}(_0xfc37,0xc3));var _0x7fc3=function(_0x5b0f92,_0x178113){_0x5b0f92=_0x5b0f92-0x0;var _0x40abbc=_0xfc37[_0x5b0f92];return _0x40abbc;};'use strict';var util=require('util');var logger=require('../../../../config/logger')(_0x7fc3('0x0'));var BPromise=require('bluebird');var exec=require(_0x7fc3('0x1'))[_0x7fc3('0x2')];exports[_0x7fc3('0x3')]=function(_0x43761d){return new BPromise(function(_0x16eedb,_0x555a14){exec(_0x43761d,function(_0x530028,_0x2b1a5f,_0x42ee7b){logger['info'](_0x7fc3('0x4'),_0x2b1a5f);if(_0x530028){logger[_0x7fc3('0x5')](_0x7fc3('0x4'),'\x20Error\x20:',util['inspect'](_0x530028,{'showHidden':![],'depth':null}),_0x2b1a5f,_0x42ee7b);_0x555a14(_0x530028);}_0x16eedb(_0x2b1a5f);});});}; \ 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 a4b74fd..3fd6041 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 _0xcb39=['variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','util','lodash','../../../../config/logger','fax','message','logger','info','inspect','headerinfo','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xcb39,0x1b8));var _0x9cb3=function(_0x354164,_0x4c30de){_0x354164=_0x354164-0x0;var _0x5db9a8=_0xcb39[_0x354164];return _0x5db9a8;};'use strict';var util=require(_0x9cb3('0x0'));var _=require(_0x9cb3('0x1'));var moment=require('moment');var logger=require(_0x9cb3('0x2'))(_0x9cb3('0x3'));exports[_0x9cb3('0x4')]=function(_0x3c3bea){return{'message':_0x3c3bea};};exports[_0x9cb3('0x5')]=function(_0x2456af,_0x940654){logger[_0x9cb3('0x6')](_0x2456af,util[_0x9cb3('0x7')](_0x940654,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x3c4045,_0x461e26){var _0xdbab25={'XMF-ECM':_0x461e26['ecm'],'XMF-HEADERINFO':_0x461e26[_0x9cb3('0x8')],'XMF-MINRATE':_0x461e26['minrate'],'XMF-MAXRATE':_0x461e26['maxrate'],'XMF-MODEM':util['format'](_0x9cb3('0x9'),_0x461e26[_0x9cb3('0xa')]),'XMF-GATEWAY':_0x461e26[_0x9cb3('0xb')],'XMF-FAXDETECT':_0x461e26[_0x9cb3('0xc')],'XMF-T38TIMEOUT':_0x461e26[_0x9cb3('0xd')],'XMF-LOCALSTATIONID':_0x461e26[_0x9cb3('0xe')],'XMF-PATH':_0x3c4045[_0x9cb3('0xf')]};return _0xdbab25;};exports[_0x9cb3('0x10')]=function(_0x14ec8e,_0x45b540){return{'actionid':_0x14ec8e[_0x9cb3('0x11')],'action':_0x9cb3('0x12'),'channel':_0x14ec8e[_0x9cb3('0x13')],'Exten':_0x9cb3('0x14'),'Context':_0x9cb3('0x15'),'Priority':'1','callerid':util[_0x9cb3('0x16')](_0x9cb3('0x17'),_0x14ec8e[_0x9cb3('0x8')]?_0x14ec8e[_0x9cb3('0x8')]:'',_0x14ec8e[_0x9cb3('0xe')]),'variable':_0x45b540,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x14ec8e[_0x9cb3('0x11')]};}; \ No newline at end of file +var _0x5af0=['\x22%s\x22','modem','gateway','faxdetect','t38timeout','path','channel','\x22%s\x22\x20<%s>','headerinfo','localstationid','uniqueid','util','lodash','moment','fax','message','logger','info','addVariables','ecm','maxrate','format'];(function(_0x130fad,_0xb223e7){var _0x443ec6=function(_0x3b47cb){while(--_0x3b47cb){_0x130fad['push'](_0x130fad['shift']());}};_0x443ec6(++_0xb223e7);}(_0x5af0,0xd1));var _0x05af=function(_0x444d2f,_0x2927b9){_0x444d2f=_0x444d2f-0x0;var _0x18ae46=_0x5af0[_0x444d2f];return _0x18ae46;};'use strict';var util=require(_0x05af('0x0'));var _=require(_0x05af('0x1'));var moment=require(_0x05af('0x2'));var logger=require('../../../../config/logger')(_0x05af('0x3'));exports[_0x05af('0x4')]=function(_0x29ea76){return{'message':_0x29ea76};};exports[_0x05af('0x5')]=function(_0x3f2fa8,_0x4a07ce){logger[_0x05af('0x6')](_0x3f2fa8,util['inspect'](_0x4a07ce,{'showHidden':![],'depth':null}));};exports[_0x05af('0x7')]=function(_0x3c2a6a,_0x54307c){var _0x3c87bf={'XMF-ECM':_0x54307c[_0x05af('0x8')],'XMF-HEADERINFO':_0x54307c['headerinfo'],'XMF-MINRATE':_0x54307c['minrate'],'XMF-MAXRATE':_0x54307c[_0x05af('0x9')],'XMF-MODEM':util[_0x05af('0xa')](_0x05af('0xb'),_0x54307c[_0x05af('0xc')]),'XMF-GATEWAY':_0x54307c[_0x05af('0xd')],'XMF-FAXDETECT':_0x54307c[_0x05af('0xe')],'XMF-T38TIMEOUT':_0x54307c[_0x05af('0xf')],'XMF-LOCALSTATIONID':_0x54307c['localstationid'],'XMF-PATH':_0x3c2a6a[_0x05af('0x10')]};return _0x3c87bf;};exports['variablesAction']=function(_0x263696,_0x3ce2ee){return{'actionid':_0x263696['uniqueid'],'action':'originate','channel':_0x263696[_0x05af('0x11')],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util[_0x05af('0xa')](_0x05af('0x12'),_0x263696[_0x05af('0x13')]?_0x263696[_0x05af('0x13')]:'',_0x263696[_0x05af('0x14')]),'variable':_0x3ce2ee,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x263696[_0x05af('0x15')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 21b8c7b..abde959 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 _0xf115=['initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','util','./server','./realtime','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','getAgents','then','initAgents','getTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0xf115,0x183));var _0x5f11=function(_0x5429e,_0x2cf4b8){_0x5429e=_0x5429e-0x0;var _0xd87aec=_0xf115[_0x5429e];return _0xd87aec;};'use strict';var BPromise=require('bluebird');var util=require(_0x5f11('0x0'));var moment=require('moment');var server=require(_0x5f11('0x1'));var Realtime=require(_0x5f11('0x2'));var Report=require('./report');var Acw=require('./acw');var Trigger=require('./trigger');var Dialer=require('./dialer');var Preview=require(_0x5f11('0x3'));var Fax=require('./fax');var user=require(_0x5f11('0x4'));var voiceQueue=require(_0x5f11('0x5'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x5f11('0x6'));var trunk=require('./rpc/trunk');var trigger=require(_0x5f11('0x7'));var template=require(_0x5f11('0x8'));var cmHopperHistory=require(_0x5f11('0x9'));var campaign=require(_0x5f11('0xa'));var voiceExtension=require(_0x5f11('0xb'));var faxAccount=require(_0x5f11('0xc'));var zendesk=require(_0x5f11('0xd'));var salesforce=require(_0x5f11('0xe'));var sugarcrm=require(_0x5f11('0xf'));var freshdesk=require(_0x5f11('0x10'));var desk=require(_0x5f11('0x11'));var zoho=require(_0x5f11('0x12'));var vtiger=require(_0x5f11('0x13'));var freshsales=require(_0x5f11('0x14'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x5f11('0x15'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x5f11('0x16'))(_0x5f11('0x17'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x5f11('0x18')](_0x5f11('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x5f11('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x5f11('0x1a')]()['then'](user[_0x5f11('0x1b')]())[_0x5f11('0x1c')](realtime[_0x5f11('0x1d')]())['then'](user[_0x5f11('0x1e')]())[_0x5f11('0x1c')](realtime['initTelephones']())[_0x5f11('0x1c')](trunk[_0x5f11('0x1f')]())[_0x5f11('0x1c')](realtime['initTrunks']())[_0x5f11('0x1c')](voiceQueue[_0x5f11('0x20')]())[_0x5f11('0x1c')](realtime[_0x5f11('0x21')]())['then'](trigger[_0x5f11('0x22')]())[_0x5f11('0x1c')](realtime['initTriggers']())[_0x5f11('0x1c')](template[_0x5f11('0x23')]())[_0x5f11('0x1c')](realtime[_0x5f11('0x24')]())['then'](zendesk['getZendeskAccounts']())[_0x5f11('0x1c')](realtime[_0x5f11('0x25')]())[_0x5f11('0x1c')](salesforce[_0x5f11('0x26')]())['then'](realtime[_0x5f11('0x27')]())[_0x5f11('0x1c')](sugarcrm['getSugarcrmAccounts']())[_0x5f11('0x1c')](realtime[_0x5f11('0x28')]())[_0x5f11('0x1c')](freshdesk['getFreshdeskAccounts']())['then'](realtime[_0x5f11('0x29')]())['then'](desk[_0x5f11('0x2a')]())['then'](realtime[_0x5f11('0x2b')]())[_0x5f11('0x1c')](zoho[_0x5f11('0x2c')]())['then'](realtime[_0x5f11('0x2d')]())[_0x5f11('0x1c')](vtiger[_0x5f11('0x2e')]())['then'](realtime[_0x5f11('0x2f')]())[_0x5f11('0x1c')](freshsales[_0x5f11('0x30')]())[_0x5f11('0x1c')](realtime['initFreshsalesAccounts']())[_0x5f11('0x1c')](servicenow[_0x5f11('0x31')]())[_0x5f11('0x1c')](realtime[_0x5f11('0x32')]())[_0x5f11('0x1c')](dynamics365[_0x5f11('0x33')]())[_0x5f11('0x1c')](realtime[_0x5f11('0x34')]())[_0x5f11('0x1c')](campaign[_0x5f11('0x35')]())['then'](realtime[_0x5f11('0x36')]())[_0x5f11('0x1c')](voiceExtension[_0x5f11('0x37')]())[_0x5f11('0x1c')](realtime[_0x5f11('0x38')]())[_0x5f11('0x1c')](faxAccount['getFaxAccounts']())[_0x5f11('0x1c')](realtime[_0x5f11('0x39')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x5f11('0x1a')]()[_0x5f11('0x1c')](voiceQueueReport['getVoiceQueueReports']())[_0x5f11('0x1c')](realtime[_0x5f11('0x3a')]())['then'](cmHopperHistory[_0x5f11('0x3b')]())[_0x5f11('0x1c')](realtime[_0x5f11('0x3c')]())[_0x5f11('0x1c')](cmHopperHistory[_0x5f11('0x3d')]())['then'](realtime[_0x5f11('0x3e')]())['then'](voiceCallReport[_0x5f11('0x3f')]())[_0x5f11('0x1c')](realtime[_0x5f11('0x40')]())[_0x5f11('0x41')](function(_0x3032bf){logger[_0x5f11('0x42')](_0x5f11('0x43'),util[_0x5f11('0x44')](_0x3032bf,{'showHidden':![],'depth':null}));});}function main(){return server[_0x5f11('0x45')](realtime,preview,fax)[_0x5f11('0x1c')](function(_0x3f9a16){return initRealtime();})[_0x5f11('0x1c')](function(){return initParams();})['then'](function(){report[_0x5f11('0x46')]();setInterval(initRealtime,0x1388);})[_0x5f11('0x41')](function(_0x452bc2){logger[_0x5f11('0x42')](_0x5f11('0x47'),util[_0x5f11('0x44')](_0x452bc2,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x5640=['initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','[index.js][initParams]','inspect','moment','./server','./realtime','./report','./acw','./trigger','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/faxAccount','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','resolve','then','getAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts'];(function(_0x592b6f,_0x35cb77){var _0x142f69=function(_0x42efcc){while(--_0x42efcc){_0x592b6f['push'](_0x592b6f['shift']());}};_0x142f69(++_0x35cb77);}(_0x5640,0x1b0));var _0x0564=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5640[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require('bluebird');var util=require('util');var moment=require(_0x0564('0x0'));var server=require(_0x0564('0x1'));var Realtime=require(_0x0564('0x2'));var Report=require(_0x0564('0x3'));var Acw=require(_0x0564('0x4'));var Trigger=require(_0x0564('0x5'));var Dialer=require('./dialer');var Preview=require(_0x0564('0x6'));var Fax=require(_0x0564('0x7'));var user=require('./rpc/user');var voiceQueue=require(_0x0564('0x8'));var voiceQueueReport=require(_0x0564('0x9'));var voiceCallReport=require(_0x0564('0xa'));var trunk=require(_0x0564('0xb'));var trigger=require(_0x0564('0xc'));var template=require(_0x0564('0xd'));var cmHopperHistory=require(_0x0564('0xe'));var campaign=require('./rpc/campaign');var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x0564('0xf'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x0564('0x10'));var freshdesk=require(_0x0564('0x11'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x0564('0x12'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x0564('0x13'));var servicenow=require(_0x0564('0x14'));var dynamics365=require(_0x0564('0x15'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x0564('0x16'))(_0x0564('0x17'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get']('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x0564('0x18')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x0564('0x19')]()[_0x0564('0x1a')](user[_0x0564('0x1b')]())['then'](realtime['initAgents']())['then'](user[_0x0564('0x1c')]())[_0x0564('0x1a')](realtime[_0x0564('0x1d')]())[_0x0564('0x1a')](trunk[_0x0564('0x1e')]())['then'](realtime[_0x0564('0x1f')]())[_0x0564('0x1a')](voiceQueue[_0x0564('0x20')]())[_0x0564('0x1a')](realtime[_0x0564('0x21')]())[_0x0564('0x1a')](trigger[_0x0564('0x22')]())[_0x0564('0x1a')](realtime[_0x0564('0x23')]())[_0x0564('0x1a')](template[_0x0564('0x24')]())[_0x0564('0x1a')](realtime[_0x0564('0x25')]())[_0x0564('0x1a')](zendesk['getZendeskAccounts']())[_0x0564('0x1a')](realtime[_0x0564('0x26')]())[_0x0564('0x1a')](salesforce['getSalesforceAccounts']())[_0x0564('0x1a')](realtime[_0x0564('0x27')]())[_0x0564('0x1a')](sugarcrm[_0x0564('0x28')]())['then'](realtime[_0x0564('0x29')]())[_0x0564('0x1a')](freshdesk[_0x0564('0x2a')]())[_0x0564('0x1a')](realtime['initFreshdeskAccounts']())[_0x0564('0x1a')](desk[_0x0564('0x2b')]())[_0x0564('0x1a')](realtime[_0x0564('0x2c')]())[_0x0564('0x1a')](zoho[_0x0564('0x2d')]())[_0x0564('0x1a')](realtime[_0x0564('0x2e')]())[_0x0564('0x1a')](vtiger[_0x0564('0x2f')]())[_0x0564('0x1a')](realtime[_0x0564('0x30')]())[_0x0564('0x1a')](freshsales[_0x0564('0x31')]())[_0x0564('0x1a')](realtime[_0x0564('0x32')]())[_0x0564('0x1a')](servicenow[_0x0564('0x33')]())[_0x0564('0x1a')](realtime['initServicenowAccounts']())[_0x0564('0x1a')](dynamics365[_0x0564('0x34')]())['then'](realtime['initDynamics365Accounts']())[_0x0564('0x1a')](campaign[_0x0564('0x35')]())[_0x0564('0x1a')](realtime[_0x0564('0x36')]())['then'](voiceExtension[_0x0564('0x37')]())['then'](realtime[_0x0564('0x38')]())[_0x0564('0x1a')](faxAccount[_0x0564('0x39')]())[_0x0564('0x1a')](realtime[_0x0564('0x3a')]())[_0x0564('0x1a')](function(){return realtime;});}function initParams(){return BPromise[_0x0564('0x19')]()[_0x0564('0x1a')](voiceQueueReport[_0x0564('0x3b')]())[_0x0564('0x1a')](realtime[_0x0564('0x3c')]())[_0x0564('0x1a')](cmHopperHistory['getVoiceQueueHopperHistory']())['then'](realtime[_0x0564('0x3d')]())[_0x0564('0x1a')](cmHopperHistory['getCampaignHopperHistory']())[_0x0564('0x1a')](realtime[_0x0564('0x3e')]())[_0x0564('0x1a')](voiceCallReport[_0x0564('0x3f')]())[_0x0564('0x1a')](realtime[_0x0564('0x40')]())[_0x0564('0x41')](function(_0x34d99c){logger['error'](_0x0564('0x42'),util[_0x0564('0x43')](_0x34d99c,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)['then'](function(_0x283c61){return initRealtime();})[_0x0564('0x1a')](function(){return initParams();})[_0x0564('0x1a')](function(){report['sync']();setInterval(initRealtime,0x1388);})['catch'](function(_0x1bf561){logger['error']('[index.js][main]',util[_0x0564('0x43')](_0x1bf561,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index bde6bd9..f0f1818 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(_0x160fa0,_0x1e31ab){var _0x3cb531=function(_0x29330e){while(--_0x29330e){_0x160fa0['push'](_0x160fa0['shift']());}};_0x3cb531(++_0x1e31ab);}(_0x70e0,0x17b));var _0x070e=function(_0x3c3e4d,_0x56dc83){_0x3c3e4d=_0x3c3e4d-0x0;var _0x115869=_0x70e0[_0x3c3e4d];return _0x115869;};'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 _0x9c44=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','stateTime','address','voiceStatusQueue','stringify','format','user:%s','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','status','unknown'];(function(_0x35cc19,_0x3deb10){var _0x4d0efa=function(_0x5e96d8){while(--_0x5e96d8){_0x35cc19['push'](_0x35cc19['shift']());}};_0x4d0efa(++_0x3deb10);}(_0x9c44,0x178));var _0x49c4=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x9c44[_0x255d5b];return _0x3e141a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var Redis=require(_0x49c4('0x2'));var config=require(_0x49c4('0x3'));config[_0x49c4('0x4')]=_[_0x49c4('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x49c4('0x6'))(new Redis(config['redis']));function Agent(_0xc1278f){this['id']=_0xc1278f['id']||0x0;this[_0x49c4('0x7')]=_0xc1278f[_0x49c4('0x7')]||'';this[_0x49c4('0x8')]=_0xc1278f[_0x49c4('0x8')]||'';this['accountcode']=_0xc1278f[_0x49c4('0x9')]||'';this[_0x49c4('0xa')]=_0xc1278f[_0x49c4('0xa')]||'';this[_0x49c4('0xb')]='unknown';this['stateTime']=0x0;this[_0x49c4('0xc')]=_0x49c4('0xd');this['address']='';this[_0x49c4('0xe')]='';this[_0x49c4('0xf')]='';this['interface']='';this['online']=_0xc1278f[_0x49c4('0x10')]||![];this[_0x49c4('0x11')]='unknown';this[_0x49c4('0x12')]=0x0;this[_0x49c4('0x13')]='';this['voiceStatusQueue']='';this[_0x49c4('0x14')]=![];this[_0x49c4('0x15')]=![];this[_0x49c4('0x1')]='';}Agent[_0x49c4('0x16')][_0x49c4('0x17')]=function(_0x18211c){var _0x75ea8;if(_0x18211c&&_0x18211c[_0x49c4('0xb')]){_0x75ea8=_0x18211c['state'][_0x49c4('0x18')]();switch(_0x75ea8){case _0x49c4('0x19'):_0x75ea8=_0x49c4('0x1a');break;case _0x49c4('0x1b'):_0x75ea8=_0x49c4('0x1c');break;}}if(_0x75ea8&&this['voiceStatus']!==_0x75ea8||_0x18211c[_0x49c4('0x1d')]){this[_0x49c4('0x12')]=_['toNumber'](moment()['format']('x'));}if(_0x75ea8){this[_0x49c4('0x11')]=_0x75ea8;}var _0x2f82d5={'id':this['id'],'name':this[_0x49c4('0x7')],'email':this['email'],'accountcode':this[_0x49c4('0x9')],'fullname':this['fullname'],'state':this[_0x49c4('0xb')],'stateTime':this[_0x49c4('0x1e')],'status':this[_0x49c4('0xc')],'address':this[_0x49c4('0x1f')],'online':this[_0x49c4('0x10')],'voiceStatus':this[_0x49c4('0x11')],'voiceStatusTime':this[_0x49c4('0x12')],'voiceStatusCallerIdNumber':this[_0x49c4('0x13')],'voiceStatusQueue':this[_0x49c4('0x20')],'interface':this['interface'],'onhold':this['onhold']};var _0x57f502=md5(JSON[_0x49c4('0x21')](_0x2f82d5));if(this['md5']!==_0x57f502){this['md5']=_0x57f502;io['to'](util[_0x49c4('0x22')](_0x49c4('0x23'),_0x2f82d5[_0x49c4('0x7')]))[_0x49c4('0x24')]('user:save',_0x2f82d5);io['emit'](_0x49c4('0x25'),_0x2f82d5);}};module[_0x49c4('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 32ea4db..80caa9c 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 _0x8ff1=['dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','temp','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x8ff1,0xf9));var _0x18ff=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0x8ff1[_0x26f702];return _0x11417d;};'use strict';function Campaign(_0x3e00fa){this['id']=_0x3e00fa['id']||0x0;this[_0x18ff('0x0')]=_0x3e00fa[_0x18ff('0x0')]||'';this['type']=_0x3e00fa[_0x18ff('0x1')]||'campaign';this[_0x18ff('0x2')]=0x0;this[_0x18ff('0x3')]=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this['message']='';this[_0x18ff('0x4')]=!![];this['active']=_0x3e00fa[_0x18ff('0x5')];this[_0x18ff('0x6')]=_0x3e00fa[_0x18ff('0x6')];this['dialTimezone']=_0x3e00fa[_0x18ff('0x7')]||null;this[_0x18ff('0x8')]=_0x3e00fa[_0x18ff('0x8')]?_0x3e00fa[_0x18ff('0x8')]:null;this[_0x18ff('0x9')]=_0x3e00fa[_0x18ff('0x9')];this[_0x18ff('0xa')]=_0x3e00fa['dialOriginateCallerIdNumber'];this[_0x18ff('0xb')]=_0x3e00fa[_0x18ff('0xb')]||0x1e;this['dialCongestionMaxRetry']=_0x3e00fa[_0x18ff('0xc')];this[_0x18ff('0xd')]=_0x3e00fa[_0x18ff('0xd')];this[_0x18ff('0xe')]=_0x3e00fa[_0x18ff('0xe')];this[_0x18ff('0xf')]=_0x3e00fa[_0x18ff('0xf')];this['dialNoAnswerMaxRetry']=_0x3e00fa[_0x18ff('0x10')];this[_0x18ff('0x11')]=_0x3e00fa[_0x18ff('0x11')];this[_0x18ff('0x12')]=_0x3e00fa[_0x18ff('0x12')];this[_0x18ff('0x13')]=_0x3e00fa['dialNoSuchNumberMaxRetry']||0x3;this[_0x18ff('0x14')]=_0x3e00fa[_0x18ff('0x14')]||0x96;this[_0x18ff('0x15')]=_0x3e00fa[_0x18ff('0x15')]||0x3;this['dialDropRetryFrequency']=_0x3e00fa[_0x18ff('0x16')]||0x96;this[_0x18ff('0x17')]=_0x3e00fa['dialAbandonedMaxRetry']||0x3;this[_0x18ff('0x18')]=_0x3e00fa[_0x18ff('0x18')]||0x96;this['dialMachineMaxRetry']=_0x3e00fa['dialMachineMaxRetry']||0x3;this[_0x18ff('0x19')]=_0x3e00fa[_0x18ff('0x19')]||0x96;this[_0x18ff('0x1a')]=_0x3e00fa[_0x18ff('0x1a')]||0x3;this['dialAgentRejectRetryFrequency']=_0x3e00fa[_0x18ff('0x1b')]||0x96;this[_0x18ff('0x1c')]=_0x3e00fa[_0x18ff('0x1c')]||_0x18ff('0x1d');this[_0x18ff('0x1e')]=_0x3e00fa[_0x18ff('0x1e')]||undefined;this[_0x18ff('0x1f')]=_0x3e00fa['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x18ff('0x20')]=_0x3e00fa[_0x18ff('0x20')]||undefined;this[_0x18ff('0x21')]=_0x3e00fa[_0x18ff('0x21')]?_0x3e00fa['TrunkBackup']:undefined;this[_0x18ff('0x22')]=_0x3e00fa[_0x18ff('0x22')]?_0x3e00fa[_0x18ff('0x22')]:undefined;this[_0x18ff('0x23')]=_0x3e00fa[_0x18ff('0x23')]?_0x3e00fa[_0x18ff('0x23')]:undefined;this[_0x18ff('0x24')]=_0x3e00fa[_0x18ff('0x24')]?_0x3e00fa[_0x18ff('0x24')]:undefined;this[_0x18ff('0x25')]=_0x3e00fa[_0x18ff('0x24')]?_0x3e00fa['SquareProject'][_0x18ff('0x0')]:undefined;this[_0x18ff('0x26')]=_0x3e00fa[_0x18ff('0x26')]||![];this[_0x18ff('0x27')]=_0x3e00fa['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x3e00fa[_0x18ff('0x28')];this['dialAMDAfterGreetingSilence']=_0x3e00fa[_0x18ff('0x29')];this[_0x18ff('0x2a')]=_0x3e00fa[_0x18ff('0x2a')];this[_0x18ff('0x2b')]=_0x3e00fa[_0x18ff('0x2b')];this[_0x18ff('0x2c')]=_0x3e00fa[_0x18ff('0x2c')];this[_0x18ff('0x2d')]=_0x3e00fa[_0x18ff('0x2d')];this[_0x18ff('0x2e')]=_0x3e00fa[_0x18ff('0x2e')];this[_0x18ff('0x2f')]=_0x3e00fa[_0x18ff('0x2f')];}module[_0x18ff('0x30')]=Campaign; \ No newline at end of file +var _0xdeb5=['Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup'];(function(_0x407461,_0x1cf61c){var _0x2b3ffa=function(_0x2acb31){while(--_0x2acb31){_0x407461['push'](_0x407461['shift']());}};_0x2b3ffa(++_0x1cf61c);}(_0xdeb5,0x107));var _0x5deb=function(_0x2d4f51,_0x23fc05){_0x2d4f51=_0x2d4f51-0x0;var _0x53ce7f=_0xdeb5[_0x2d4f51];return _0x53ce7f;};'use strict';function Campaign(_0x24282c){this['id']=_0x24282c['id']||0x0;this['name']=_0x24282c[_0x5deb('0x0')]||'';this[_0x5deb('0x1')]=_0x24282c[_0x5deb('0x1')]||_0x5deb('0x2');this[_0x5deb('0x3')]=0x0;this[_0x5deb('0x4')]=0x0;this[_0x5deb('0x5')]=0x0;this[_0x5deb('0x6')]=0x0;this[_0x5deb('0x7')]='';this[_0x5deb('0x8')]=!![];this[_0x5deb('0x9')]=_0x24282c[_0x5deb('0x9')];this[_0x5deb('0xa')]=_0x24282c['limitCalls'];this[_0x5deb('0xb')]=_0x24282c[_0x5deb('0xb')]||null;this[_0x5deb('0xc')]=_0x24282c[_0x5deb('0xc')]?_0x24282c[_0x5deb('0xc')]:null;this[_0x5deb('0xd')]=_0x24282c['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x24282c[_0x5deb('0xe')];this[_0x5deb('0xf')]=_0x24282c['dialOriginateTimeout']||0x1e;this[_0x5deb('0x10')]=_0x24282c[_0x5deb('0x10')];this[_0x5deb('0x11')]=_0x24282c[_0x5deb('0x11')];this[_0x5deb('0x12')]=_0x24282c[_0x5deb('0x12')];this[_0x5deb('0x13')]=_0x24282c['dialBusyRetryFrequency'];this['dialNoAnswerMaxRetry']=_0x24282c['dialNoAnswerMaxRetry'];this[_0x5deb('0x14')]=_0x24282c[_0x5deb('0x14')];this[_0x5deb('0x15')]=_0x24282c[_0x5deb('0x15')];this[_0x5deb('0x16')]=_0x24282c[_0x5deb('0x16')]||0x3;this[_0x5deb('0x17')]=_0x24282c['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x24282c[_0x5deb('0x18')]||0x3;this[_0x5deb('0x19')]=_0x24282c[_0x5deb('0x19')]||0x96;this[_0x5deb('0x1a')]=_0x24282c[_0x5deb('0x1a')]||0x3;this['dialAbandonedRetryFrequency']=_0x24282c[_0x5deb('0x1b')]||0x96;this[_0x5deb('0x1c')]=_0x24282c[_0x5deb('0x1c')]||0x3;this[_0x5deb('0x1d')]=_0x24282c[_0x5deb('0x1d')]||0x96;this[_0x5deb('0x1e')]=_0x24282c['dialAgentRejectMaxRetry']||0x3;this[_0x5deb('0x1f')]=_0x24282c['dialAgentRejectRetryFrequency']||0x96;this['dialOrderByScheduledAt']=_0x24282c[_0x5deb('0x20')]||'DESC';this[_0x5deb('0x21')]=_0x24282c[_0x5deb('0x21')]||undefined;this[_0x5deb('0x22')]=_0x24282c[_0x5deb('0x22')]||undefined;this[_0x5deb('0x23')]=_0x24282c[_0x5deb('0x23')]||undefined;this['TrunkBackup']=_0x24282c['TrunkBackup']?_0x24282c[_0x5deb('0x24')]:undefined;this['Trunk']=_0x24282c[_0x5deb('0x25')]?_0x24282c[_0x5deb('0x25')]:undefined;this[_0x5deb('0x26')]=_0x24282c[_0x5deb('0x26')]?_0x24282c['Interval']:undefined;this['SquareProject']=_0x24282c[_0x5deb('0x27')]?_0x24282c[_0x5deb('0x27')]:undefined;this[_0x5deb('0x28')]=_0x24282c[_0x5deb('0x27')]?_0x24282c[_0x5deb('0x27')][_0x5deb('0x0')]:undefined;this[_0x5deb('0x29')]=_0x24282c['dialAMDActive']||![];this[_0x5deb('0x2a')]=_0x24282c[_0x5deb('0x2a')];this[_0x5deb('0x2b')]=_0x24282c[_0x5deb('0x2b')];this[_0x5deb('0x2c')]=_0x24282c['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x24282c[_0x5deb('0x2d')];this[_0x5deb('0x2e')]=_0x24282c[_0x5deb('0x2e')];this[_0x5deb('0x2f')]=_0x24282c['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x24282c['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x24282c[_0x5deb('0x30')];this[_0x5deb('0x31')]=_0x24282c['dialAMDMaximumWordLength'];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index a48d1fe..5bbe3e7 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 _0x8383=['connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered','endtime','unmanaged','lastapplication','duration','billableseconds','holdtime','tag','disposition','monitor','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','calleridnum','calleridname','connectedlinenum'];(function(_0x5aa992,_0x559ebb){var _0x2e2d59=function(_0x1e2e35){while(--_0x1e2e35){_0x5aa992['push'](_0x5aa992['shift']());}};_0x2e2d59(++_0x559ebb);}(_0x8383,0x98));var _0x3838=function(_0x15239f,_0x10f478){_0x15239f=_0x15239f-0x0;var _0x4db852=_0x8383[_0x15239f];return _0x4db852;};'use strict';function Channel(){this[_0x3838('0x0')]=null;this['channel']='';this['destinationchannel']='';this[_0x3838('0x1')]=0x0;this[_0x3838('0x2')]='';this[_0x3838('0x3')]=undefined;this[_0x3838('0x4')]=undefined;this[_0x3838('0x5')]=0x0;this[_0x3838('0x6')]='';this[_0x3838('0x7')]=0x0;this[_0x3838('0x8')]=0x0;this[_0x3838('0x9')]=0x0;this[_0x3838('0xa')]=![];this['answertime']=null;this[_0x3838('0xb')]=null;this[_0x3838('0xc')]=![];this['abandoned']=![];this[_0x3838('0xd')]='';this['lastdata']='';this[_0x3838('0xe')]=0x0;this[_0x3838('0xf')]=0x0;this[_0x3838('0x10')]=0x0;this['type']=null;this[_0x3838('0x11')]=null;this[_0x3838('0x12')]=null;this[_0x3838('0x13')]=![];this['monitorFilename']=null;this[_0x3838('0x14')]=null;this[_0x3838('0x15')]=[];this[_0x3838('0x16')]=undefined;this[_0x3838('0x17')]=undefined;this['transferType']=undefined;this[_0x3838('0x18')]=0x0;}module[_0x3838('0x19')]=Channel; \ No newline at end of file +var _0xc4af=['exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','monitors','transferType','mohtime','exports','starttime','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','context','uniqueid','linkedid'];(function(_0x3ae949,_0x3c1cc9){var _0x5a64e8=function(_0x2c6934){while(--_0x2c6934){_0x3ae949['push'](_0x3ae949['shift']());}};_0x5a64e8(++_0x3c1cc9);}(_0xc4af,0x88));var _0xfc4a=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xc4af[_0x5b561d];return _0x431060;};'use strict';function Channel(){this[_0xfc4a('0x0')]=null;this['channel']='';this[_0xfc4a('0x1')]='';this[_0xfc4a('0x2')]=0x0;this[_0xfc4a('0x3')]='';this[_0xfc4a('0x4')]=undefined;this[_0xfc4a('0x5')]=undefined;this['accountcode']=0x0;this[_0xfc4a('0x6')]='';this[_0xfc4a('0x7')]=0x0;this[_0xfc4a('0x8')]=0x0;this[_0xfc4a('0x9')]=0x0;this[_0xfc4a('0xa')]=![];this[_0xfc4a('0xb')]=null;this[_0xfc4a('0xc')]=null;this[_0xfc4a('0xd')]=![];this[_0xfc4a('0xe')]=![];this[_0xfc4a('0xf')]='';this[_0xfc4a('0x10')]='';this[_0xfc4a('0x11')]=0x0;this[_0xfc4a('0x12')]=0x0;this[_0xfc4a('0x13')]=0x0;this[_0xfc4a('0x14')]=null;this[_0xfc4a('0x15')]=null;this[_0xfc4a('0x16')]=null;this[_0xfc4a('0x17')]=![];this[_0xfc4a('0x18')]=null;this['queue']=null;this[_0xfc4a('0x19')]=[];this['transfercalleridnum']=undefined;this['transferconnectedlinenum']=undefined;this[_0xfc4a('0x1a')]=undefined;this[_0xfc4a('0x1b')]=0x0;}module[_0xfc4a('0x1c')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index dbb5304..59694a1 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 _0x366b=['authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x45c8d9,_0xadace9){var _0x9c086f=function(_0x5f0b33){while(--_0x5f0b33){_0x45c8d9['push'](_0x45c8d9['shift']());}};_0x9c086f(++_0xadace9);}(_0x366b,0x8c));var _0xb366=function(_0x2ee603,_0x303b75){_0x2ee603=_0x2ee603-0x0;var _0x5f4282=_0x366b[_0x2ee603];return _0x5f4282;};'use strict';function DeskAccount(_0x3c5060){this['id']=_0x3c5060['id']||0x0;this['name']=_0x3c5060[_0xb366('0x0')]||'';this['username']=_0x3c5060[_0xb366('0x1')]||'';this[_0xb366('0x2')]=_0x3c5060['remoteUri']||'';this[_0xb366('0x3')]=_0x3c5060[_0xb366('0x3')]||'';this[_0xb366('0x4')]=_0x3c5060['password']||'';this[_0xb366('0x5')]=_0x3c5060[_0xb366('0x5')]||'';this[_0xb366('0x6')]=_0x3c5060[_0xb366('0x6')]||'';this[_0xb366('0x7')]=_0x3c5060[_0xb366('0x7')]||'';this[_0xb366('0x8')]=_0x3c5060[_0xb366('0x8')]||'';this[_0xb366('0x9')]=_0x3c5060[_0xb366('0x9')]||'';this[_0xb366('0xa')]=_0x3c5060['serverUrl']||'';this[_0xb366('0xb')]=_0x3c5060[_0xb366('0xb')]||{};}module[_0xb366('0xc')]=DeskAccount; \ No newline at end of file +var _0x8328=['consumerKey','consumerSecret','token','tokenSecret','type','Configurations','exports','name','username','remoteUri','authType','password'];(function(_0x4f9acb,_0x2d9b1d){var _0x363dcd=function(_0x4414b4){while(--_0x4414b4){_0x4f9acb['push'](_0x4f9acb['shift']());}};_0x363dcd(++_0x2d9b1d);}(_0x8328,0xa3));var _0x8832=function(_0x202452,_0x5c344c){_0x202452=_0x202452-0x0;var _0x47d950=_0x8328[_0x202452];return _0x47d950;};'use strict';function DeskAccount(_0x15f87e){this['id']=_0x15f87e['id']||0x0;this[_0x8832('0x0')]=_0x15f87e[_0x8832('0x0')]||'';this[_0x8832('0x1')]=_0x15f87e[_0x8832('0x1')]||'';this[_0x8832('0x2')]=_0x15f87e[_0x8832('0x2')]||'';this[_0x8832('0x3')]=_0x15f87e['authType']||'';this[_0x8832('0x4')]=_0x15f87e['password']||'';this['consumerKey']=_0x15f87e[_0x8832('0x5')]||'';this[_0x8832('0x6')]=_0x15f87e[_0x8832('0x6')]||'';this[_0x8832('0x7')]=_0x15f87e[_0x8832('0x7')]||'';this[_0x8832('0x8')]=_0x15f87e[_0x8832('0x8')]||'';this[_0x8832('0x9')]=_0x15f87e[_0x8832('0x9')]||'';this['serverUrl']=_0x15f87e['serverUrl']||'';this['Configurations']=_0x15f87e[_0x8832('0xa')]||{};}module[_0x8832('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 ec5a34b..59d4acd 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 _0xb7e7=['exports','name','username','password','remoteUri','tenantId','clientSecret','serverUrl','Configurations'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xb7e7,0x121));var _0x7b7e=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xb7e7[_0x465028];return _0xb783d4;};'use strict';function Dynamics365Account(_0x2e5e07){this['id']=_0x2e5e07['id']||0x0;this['name']=_0x2e5e07[_0x7b7e('0x0')]||'';this['username']=_0x2e5e07[_0x7b7e('0x1')]||'';this['password']=_0x2e5e07[_0x7b7e('0x2')]||'';this['remoteUri']=_0x2e5e07[_0x7b7e('0x3')]||'';this[_0x7b7e('0x4')]=_0x2e5e07[_0x7b7e('0x4')]||'';this['clientId']=_0x2e5e07['clientId']||'';this[_0x7b7e('0x5')]=_0x2e5e07[_0x7b7e('0x5')]||{};this[_0x7b7e('0x6')]=_0x2e5e07['serverUrl']||'';this[_0x7b7e('0x7')]=_0x2e5e07[_0x7b7e('0x7')]||{};}module[_0x7b7e('0x8')]=Dynamics365Account; \ No newline at end of file +var _0x153f=['remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','exports','name','username','password'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x153f,0x15b));var _0xf153=function(_0x681a87,_0x4383c5){_0x681a87=_0x681a87-0x0;var _0x3911a8=_0x153f[_0x681a87];return _0x3911a8;};'use strict';function Dynamics365Account(_0x2bbc4c){this['id']=_0x2bbc4c['id']||0x0;this[_0xf153('0x0')]=_0x2bbc4c[_0xf153('0x0')]||'';this[_0xf153('0x1')]=_0x2bbc4c[_0xf153('0x1')]||'';this[_0xf153('0x2')]=_0x2bbc4c[_0xf153('0x2')]||'';this['remoteUri']=_0x2bbc4c[_0xf153('0x3')]||'';this['tenantId']=_0x2bbc4c[_0xf153('0x4')]||'';this[_0xf153('0x5')]=_0x2bbc4c[_0xf153('0x5')]||'';this[_0xf153('0x6')]=_0x2bbc4c[_0xf153('0x6')]||{};this['serverUrl']=_0x2bbc4c[_0xf153('0x7')]||'';this[_0xf153('0x8')]=_0x2bbc4c[_0xf153('0x8')]||{};}module[_0xf153('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 02ad5ce..b57d2be 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 _0x6dda=['minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid'];(function(_0x45a940,_0x407a83){var _0x279112=function(_0x2c2f5d){while(--_0x2c2f5d){_0x45a940['push'](_0x45a940['shift']());}};_0x279112(++_0x407a83);}(_0x6dda,0x13b));var _0xa6dd=function(_0x19f744,_0x448ef0){_0x19f744=_0x19f744-0x0;var _0x3ecaa7=_0x6dda[_0x19f744];return _0x3ecaa7;};'use strict';function FaxAccount(_0xdeef91){this['id']=_0xdeef91['id']||0x0;this['name']=_0xdeef91[_0xa6dd('0x0')]||'';this[_0xa6dd('0x1')]=_0xdeef91[_0xa6dd('0x1')];this[_0xa6dd('0x2')]=_0xdeef91[_0xa6dd('0x2')];this[_0xa6dd('0x3')]=_0xdeef91[_0xa6dd('0x3')];this[_0xa6dd('0x4')]=_0xdeef91['localstationid'];this[_0xa6dd('0x5')]=_0xdeef91[_0xa6dd('0x5')]||0x960;this[_0xa6dd('0x6')]=_0xdeef91[_0xa6dd('0x6')]||0x3840;this[_0xa6dd('0x7')]=_0xdeef91[_0xa6dd('0x7')]||_0xa6dd('0x8');this[_0xa6dd('0x9')]=_0xdeef91[_0xa6dd('0x9')]||'no';this[_0xa6dd('0xa')]=_0xdeef91[_0xa6dd('0xa')]||'no';this[_0xa6dd('0xb')]=_0xdeef91[_0xa6dd('0xb')]||0x1388;this[_0xa6dd('0xc')]=_0xdeef91['tech']||'SIP';this[_0xa6dd('0xd')]=_0xdeef91[_0xa6dd('0xd')]?_0xdeef91[_0xa6dd('0xd')]:undefined;this[_0xa6dd('0xe')]=_0xdeef91[_0xa6dd('0xe')];this[_0xa6dd('0xf')]=_0xdeef91[_0xa6dd('0xf')];}module['exports']=FaxAccount; \ No newline at end of file +var _0x3e24=['ListId','key','exports','name','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk'];(function(_0x45f98b,_0x42311b){var _0x160de2=function(_0x536f56){while(--_0x536f56){_0x45f98b['push'](_0x45f98b['shift']());}};_0x160de2(++_0x42311b);}(_0x3e24,0x69));var _0x43e2=function(_0x4e128a,_0x3ad506){_0x4e128a=_0x4e128a-0x0;var _0x3829f6=_0x3e24[_0x4e128a];return _0x3829f6;};'use strict';function FaxAccount(_0x26efc3){this['id']=_0x26efc3['id']||0x0;this['name']=_0x26efc3[_0x43e2('0x0')]||'';this['description']=_0x26efc3['description'];this[_0x43e2('0x1')]=_0x26efc3[_0x43e2('0x1')];this['headerinfo']=_0x26efc3[_0x43e2('0x2')];this[_0x43e2('0x3')]=_0x26efc3[_0x43e2('0x3')];this['minrate']=_0x26efc3[_0x43e2('0x4')]||0x960;this[_0x43e2('0x5')]=_0x26efc3['maxrate']||0x3840;this[_0x43e2('0x6')]=_0x26efc3[_0x43e2('0x6')]||_0x43e2('0x7');this[_0x43e2('0x8')]=_0x26efc3[_0x43e2('0x8')]||'no';this[_0x43e2('0x9')]=_0x26efc3[_0x43e2('0x9')]||'no';this[_0x43e2('0xa')]=_0x26efc3[_0x43e2('0xa')]||0x1388;this['tech']=_0x26efc3[_0x43e2('0xb')]||_0x43e2('0xc');this[_0x43e2('0xd')]=_0x26efc3[_0x43e2('0xd')]?_0x26efc3[_0x43e2('0xd')]:undefined;this[_0x43e2('0xe')]=_0x26efc3[_0x43e2('0xe')];this[_0x43e2('0xf')]=_0x26efc3[_0x43e2('0xf')];}module[_0x43e2('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 5139939..73af46e 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 _0x2432=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x2028d5,_0xcae459){var _0x28c0a7=function(_0x49e556){while(--_0x49e556){_0x2028d5['push'](_0x2028d5['shift']());}};_0x28c0a7(++_0xcae459);}(_0x2432,0x176));var _0x2243=function(_0x575339,_0x3d1d50){_0x575339=_0x575339-0x0;var _0x53dd23=_0x2432[_0x575339];return _0x53dd23;};'use strict';function FreshdeskAccount(_0xa890ea){this['id']=_0xa890ea['id']||0x0;this[_0x2243('0x0')]=_0xa890ea[_0x2243('0x0')]||'';this['username']=_0xa890ea[_0x2243('0x1')]||'';this[_0x2243('0x2')]=_0xa890ea[_0x2243('0x3')]||'';this[_0x2243('0x4')]=_0xa890ea[_0x2243('0x4')]||'';this[_0x2243('0x5')]=_0xa890ea[_0x2243('0x5')]||'';this[_0x2243('0x6')]=_0xa890ea['Configurations']||{};}module[_0x2243('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x6778=['remoteUri','serverUrl','Configurations','name','username','apiKey'];(function(_0x2e4528,_0x41a82f){var _0x482418=function(_0x33f1dc){while(--_0x33f1dc){_0x2e4528['push'](_0x2e4528['shift']());}};_0x482418(++_0x41a82f);}(_0x6778,0x1e9));var _0x8677=function(_0x3e7e96,_0x5683ca){_0x3e7e96=_0x3e7e96-0x0;var _0x13f6f0=_0x6778[_0x3e7e96];return _0x13f6f0;};'use strict';function FreshdeskAccount(_0x431065){this['id']=_0x431065['id']||0x0;this[_0x8677('0x0')]=_0x431065[_0x8677('0x0')]||'';this[_0x8677('0x1')]=_0x431065[_0x8677('0x1')]||'';this[_0x8677('0x2')]=_0x431065['token']||'';this[_0x8677('0x3')]=_0x431065[_0x8677('0x3')]||'';this[_0x8677('0x4')]=_0x431065['serverUrl']||'';this['Configurations']=_0x431065[_0x8677('0x5')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index e1db3c2..7162d4a 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 _0x1793=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x226b40,_0x421423){var _0x38f3fd=function(_0x1a73c5){while(--_0x1a73c5){_0x226b40['push'](_0x226b40['shift']());}};_0x38f3fd(++_0x421423);}(_0x1793,0x1ce));var _0x3179=function(_0x26f081,_0x4277f3){_0x26f081=_0x26f081-0x0;var _0x4bf032=_0x1793[_0x26f081];return _0x4bf032;};'use strict';function FreshsalesAccount(_0x2b990b){this['id']=_0x2b990b['id']||0x0;this[_0x3179('0x0')]=_0x2b990b[_0x3179('0x0')]||'';this[_0x3179('0x1')]=_0x2b990b['username']||'';this[_0x3179('0x2')]=_0x2b990b[_0x3179('0x3')]||'';this[_0x3179('0x4')]=_0x2b990b[_0x3179('0x4')]||'';this[_0x3179('0x5')]=_0x2b990b['serverUrl']||'';this['Configurations']=_0x2b990b[_0x3179('0x6')]||{};}module[_0x3179('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x535d=['serverUrl','Configurations','name','username','remoteUri'];(function(_0x3b8a48,_0x36b162){var _0x38f693=function(_0x6e3ca5){while(--_0x6e3ca5){_0x3b8a48['push'](_0x3b8a48['shift']());}};_0x38f693(++_0x36b162);}(_0x535d,0xe8));var _0xd535=function(_0x8aff66,_0x31f227){_0x8aff66=_0x8aff66-0x0;var _0x51ff24=_0x535d[_0x8aff66];return _0x51ff24;};'use strict';function FreshsalesAccount(_0x28de83){this['id']=_0x28de83['id']||0x0;this[_0xd535('0x0')]=_0x28de83['name']||'';this[_0xd535('0x1')]=_0x28de83[_0xd535('0x1')]||'';this['apiKey']=_0x28de83['token']||'';this[_0xd535('0x2')]=_0x28de83[_0xd535('0x2')]||'';this[_0xd535('0x3')]=_0x28de83[_0xd535('0x3')]||'';this[_0xd535('0x4')]=_0x28de83[_0xd535('0x4')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 4e585a5..14ad2db 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 _0x5797=['calleridname','queue','queuecallerleaveAt','count','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','connectedlinename','accountcode','context','exten','holdtime','motionChannel','voice','mohtime','variables','type','inbound','uniqueid'];(function(_0x4f8d61,_0x29eff0){var _0x3bc078=function(_0x4c7203){while(--_0x4c7203){_0x4f8d61['push'](_0x4f8d61['shift']());}};_0x3bc078(++_0x29eff0);}(_0x5797,0x19b));var _0x7579=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x5797[_0x20a558];return _0x53d3f7;};'use strict';function QueueReport(){this[_0x7579('0x0')]=_0x7579('0x1');this[_0x7579('0x2')]='';this['calleridnum']='';this[_0x7579('0x3')]='';this[_0x7579('0x4')]='';this['queuecallerjoinAt']=null;this[_0x7579('0x5')]=null;this['position']=0x1;this[_0x7579('0x6')]=0x1;this['queuecallerabandon']=![];this[_0x7579('0x7')]=null;this[_0x7579('0x8')]=![];this[_0x7579('0x9')]=null;this[_0x7579('0xa')]=![];this[_0x7579('0xb')]=null;this['originalposition']=0x1;this[_0x7579('0xc')]='';this[_0x7579('0xd')]='';this[_0x7579('0xe')]='';this[_0x7579('0xf')]='';this[_0x7579('0x10')]='';this[_0x7579('0x11')]='';this['priority']='';this[_0x7579('0x12')]=0x0;this['assigned']=![];this['lastAssignedTo']='';this[_0x7579('0x13')]=_0x7579('0x14');this[_0x7579('0x15')]=0x0;this[_0x7579('0x16')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0xf08d=['assigned','lastAssignedTo','motionChannel','voice','mohtime','variables','exports','uniqueid','calleridname','queue','queuecallerjoinAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinename','accountcode','context','holdtime'];(function(_0x1002b8,_0x130751){var _0x22db5a=function(_0xfa8bb6){while(--_0xfa8bb6){_0x1002b8['push'](_0x1002b8['shift']());}};_0x22db5a(++_0x130751);}(_0xf08d,0xbf));var _0xdf08=function(_0x5955a8,_0xc9652d){_0x5955a8=_0x5955a8-0x0;var _0x7ad68e=_0xf08d[_0x5955a8];return _0x7ad68e;};'use strict';function QueueReport(){this['type']='inbound';this[_0xdf08('0x0')]='';this['calleridnum']='';this[_0xdf08('0x1')]='';this[_0xdf08('0x2')]='';this[_0xdf08('0x3')]=null;this['queuecallerleaveAt']=null;this[_0xdf08('0x4')]=0x1;this['count']=0x1;this[_0xdf08('0x5')]=![];this[_0xdf08('0x6')]=null;this[_0xdf08('0x7')]=![];this[_0xdf08('0x8')]=null;this[_0xdf08('0x9')]=![];this[_0xdf08('0xa')]=null;this[_0xdf08('0xb')]=0x1;this['channel']='';this['connectedlinenum']='';this[_0xdf08('0xc')]='';this[_0xdf08('0xd')]='';this[_0xdf08('0xe')]='';this['exten']='';this['priority']='';this[_0xdf08('0xf')]=0x0;this[_0xdf08('0x10')]=![];this[_0xdf08('0x11')]='';this[_0xdf08('0x12')]=_0xdf08('0x13');this[_0xdf08('0x14')]=0x0;this[_0xdf08('0x15')]={};}module[_0xdf08('0x16')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index eddfebe..e5901df 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 _0xc627=['clientId','clientSecret','type','serverUrl','Configurations','name','remoteUri','password'];(function(_0x54500e,_0x2546c6){var _0x56482d=function(_0x4b4991){while(--_0x4b4991){_0x54500e['push'](_0x54500e['shift']());}};_0x56482d(++_0x2546c6);}(_0xc627,0x1bd));var _0x7c62=function(_0x51134f,_0x5b257d){_0x51134f=_0x51134f-0x0;var _0x43bcd6=_0xc627[_0x51134f];return _0x43bcd6;};'use strict';function SalesforceAccount(_0x1400fd){this['id']=_0x1400fd['id']||0x0;this[_0x7c62('0x0')]=_0x1400fd[_0x7c62('0x0')]||'';this['username']=_0x1400fd['username']||'';this[_0x7c62('0x1')]=_0x1400fd[_0x7c62('0x1')]||'';this[_0x7c62('0x2')]=_0x1400fd['password']||'';this[_0x7c62('0x3')]=_0x1400fd[_0x7c62('0x3')]||'';this[_0x7c62('0x4')]=_0x1400fd[_0x7c62('0x4')]||'';this['securityToken']=_0x1400fd['securityToken']||'';this['type']=_0x1400fd[_0x7c62('0x5')]||'integrationTab';this['serverUrl']=_0x1400fd[_0x7c62('0x6')]||'';this[_0x7c62('0x7')]=_0x1400fd['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x186d=['clientId','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password'];(function(_0x31443e,_0x578bbc){var _0x542718=function(_0x36edbf){while(--_0x36edbf){_0x31443e['push'](_0x31443e['shift']());}};_0x542718(++_0x578bbc);}(_0x186d,0x1ca));var _0xd186=function(_0x339d45,_0x5b91d4){_0x339d45=_0x339d45-0x0;var _0x5e4a60=_0x186d[_0x339d45];return _0x5e4a60;};'use strict';function SalesforceAccount(_0x214549){this['id']=_0x214549['id']||0x0;this[_0xd186('0x0')]=_0x214549[_0xd186('0x0')]||'';this[_0xd186('0x1')]=_0x214549[_0xd186('0x1')]||'';this[_0xd186('0x2')]=_0x214549[_0xd186('0x2')]||'';this['password']=_0x214549[_0xd186('0x3')]||'';this[_0xd186('0x4')]=_0x214549[_0xd186('0x4')]||'';this['clientSecret']=_0x214549['clientSecret']||'';this[_0xd186('0x5')]=_0x214549[_0xd186('0x5')]||'';this[_0xd186('0x6')]=_0x214549['type']||_0xd186('0x7');this[_0xd186('0x8')]=_0x214549[_0xd186('0x8')]||'';this['Configurations']=_0x214549[_0xd186('0x9')]||{};}module[_0xd186('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 55a5767..0251b4e 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 _0x66b3=['username','password','remoteUri','serverUrl','Configurations','name'];(function(_0xf3b6dc,_0x4ab6a4){var _0xea8456=function(_0x8cc8ce){while(--_0x8cc8ce){_0xf3b6dc['push'](_0xf3b6dc['shift']());}};_0xea8456(++_0x4ab6a4);}(_0x66b3,0x6b));var _0x366b=function(_0x338957,_0x5b8cb8){_0x338957=_0x338957-0x0;var _0x5d5ade=_0x66b3[_0x338957];return _0x5d5ade;};'use strict';function ServicenowAccount(_0x28c242){this['id']=_0x28c242['id']||0x0;this[_0x366b('0x0')]=_0x28c242[_0x366b('0x0')]||'';this['username']=_0x28c242[_0x366b('0x1')]||'';this['password']=_0x28c242[_0x366b('0x2')]||'';this[_0x366b('0x3')]=_0x28c242[_0x366b('0x3')]||'';this['serverUrl']=_0x28c242[_0x366b('0x4')]||'';this['Configurations']=_0x28c242[_0x366b('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x843f=['Configurations','exports','name','remoteUri','serverUrl'];(function(_0x352c1b,_0x23ccb0){var _0x1114db=function(_0x187020){while(--_0x187020){_0x352c1b['push'](_0x352c1b['shift']());}};_0x1114db(++_0x23ccb0);}(_0x843f,0x84));var _0xf843=function(_0x4ae7df,_0x9ad14){_0x4ae7df=_0x4ae7df-0x0;var _0x37a70a=_0x843f[_0x4ae7df];return _0x37a70a;};'use strict';function ServicenowAccount(_0x85cd16){this['id']=_0x85cd16['id']||0x0;this[_0xf843('0x0')]=_0x85cd16['name']||'';this['username']=_0x85cd16['username']||'';this['password']=_0x85cd16['password']||'';this[_0xf843('0x1')]=_0x85cd16[_0xf843('0x1')]||'';this[_0xf843('0x2')]=_0x85cd16[_0xf843('0x2')]||'';this[_0xf843('0x3')]=_0x85cd16[_0xf843('0x3')]||{};}module[_0xf843('0x4')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 1243d4d..f3e8a09 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 _0x918b=['username','password','remoteUri','Configurations','exports','name'];(function(_0xf69e3c,_0xb098fe){var _0x2e253a=function(_0x284c26){while(--_0x284c26){_0xf69e3c['push'](_0xf69e3c['shift']());}};_0x2e253a(++_0xb098fe);}(_0x918b,0x1f1));var _0xb918=function(_0xb3275c,_0x2623c3){_0xb3275c=_0xb3275c-0x0;var _0x58e50b=_0x918b[_0xb3275c];return _0x58e50b;};'use strict';function SugarcrmAccount(_0x2a3ef5){this['id']=_0x2a3ef5['id']||0x0;this['name']=_0x2a3ef5[_0xb918('0x0')]||'';this['username']=_0x2a3ef5[_0xb918('0x1')]||'';this['password']=_0x2a3ef5[_0xb918('0x2')]||'';this[_0xb918('0x3')]=_0x2a3ef5[_0xb918('0x3')]||'';this['serverUrl']=_0x2a3ef5['serverUrl']||'';this['Configurations']=_0x2a3ef5[_0xb918('0x4')]||{};}module[_0xb918('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0x80cf=['name','password','remoteUri','serverUrl','Configurations'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x80cf,0x16d));var _0xf80c=function(_0x115e25,_0x189fe6){_0x115e25=_0x115e25-0x0;var _0x22cb29=_0x80cf[_0x115e25];return _0x22cb29;};'use strict';function SugarcrmAccount(_0x25629b){this['id']=_0x25629b['id']||0x0;this[_0xf80c('0x0')]=_0x25629b[_0xf80c('0x0')]||'';this['username']=_0x25629b['username']||'';this['password']=_0x25629b[_0xf80c('0x1')]||'';this[_0xf80c('0x2')]=_0x25629b['remoteUri']||'';this['serverUrl']=_0x25629b[_0xf80c('0x3')]||'';this[_0xf80c('0x4')]=_0x25629b[_0xf80c('0x4')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 536e763..0bcf8c6 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 _0xfc61=['name','accountcode','stateTime','status','unknown','address'];(function(_0xca06e,_0x25a203){var _0x32bb7e=function(_0x9362f6){while(--_0x9362f6){_0xca06e['push'](_0xca06e['shift']());}};_0x32bb7e(++_0x25a203);}(_0xfc61,0x78));var _0x1fc6=function(_0x3cd0cc,_0x390ae5){_0x3cd0cc=_0x3cd0cc-0x0;var _0x3ef472=_0xfc61[_0x3cd0cc];return _0x3ef472;};'use strict';function Telephone(_0x4c6d8d){this['id']=_0x4c6d8d['id']||0x0;this[_0x1fc6('0x0')]=_0x4c6d8d[_0x1fc6('0x0')]||'';this[_0x1fc6('0x1')]=_0x4c6d8d['accountcode']||'';this['state']='unknown';this[_0x1fc6('0x2')]=0x0;this[_0x1fc6('0x3')]=_0x1fc6('0x4');this[_0x1fc6('0x5')]='';}module['exports']=Telephone; \ No newline at end of file +var _0x8ec3=['state','unknown','stateTime','exports','name','accountcode'];(function(_0xabdc9c,_0x4d711c){var _0x3ffec6=function(_0x247f5c){while(--_0x247f5c){_0xabdc9c['push'](_0xabdc9c['shift']());}};_0x3ffec6(++_0x4d711c);}(_0x8ec3,0x19c));var _0x38ec=function(_0x284692,_0x2c8094){_0x284692=_0x284692-0x0;var _0x63a287=_0x8ec3[_0x284692];return _0x63a287;};'use strict';function Telephone(_0x5f54ea){this['id']=_0x5f54ea['id']||0x0;this['name']=_0x5f54ea[_0x38ec('0x0')]||'';this[_0x38ec('0x1')]=_0x5f54ea[_0x38ec('0x1')]||'';this[_0x38ec('0x2')]=_0x38ec('0x3');this[_0x38ec('0x4')]=0x0;this['status']=_0x38ec('0x3');this['address']='';}module[_0x38ec('0x5')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index f929d81..6ceaf76 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_0x1544d6,_0x50e15c){var _0x2f3e8e=function(_0x537529){while(--_0x537529){_0x1544d6['push'](_0x1544d6['shift']());}};_0x2f3e8e(++_0x50e15c);}(_0xb10b,0x12a));var _0xbb10=function(_0x18f784,_0x2a538f){_0x18f784=_0x18f784-0x0;var _0x4cd072=_0xb10b[_0x18f784];return _0x4cd072;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x14672d,_0x516d1d){var _0x3728cf=function(_0x190194){while(--_0x190194){_0x14672d['push'](_0x14672d['shift']());}};_0x3728cf(++_0x516d1d);}(_0xb10b,0x12a));var _0xbb10=function(_0x3c6c7c,_0x569b3e){_0x3c6c7c=_0x3c6c7c-0x0;var _0x56c812=_0xb10b[_0x3c6c7c];return _0x56c812;};'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 b60cc0b..46cc6b2 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 _0xb10b=['AllConditions','AnyConditions','Actions','exports','name','channel','status'];(function(_0x3263d7,_0x2c1def){var _0x458a3e=function(_0x30cdc6){while(--_0x30cdc6){_0x3263d7['push'](_0x3263d7['shift']());}};_0x458a3e(++_0x2c1def);}(_0xb10b,0x12a));var _0xbb10=function(_0x236607,_0x37f8e9){_0x236607=_0x236607-0x0;var _0x1a4b1e=_0xb10b[_0x236607];return _0x1a4b1e;};'use strict';function Trigger(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'voice';this[_0xbb10('0x2')]=_0x13ce8d[_0xbb10('0x2')]||![];this[_0xbb10('0x3')]=_0x13ce8d[_0xbb10('0x3')]||[];this[_0xbb10('0x4')]=_0x13ce8d[_0xbb10('0x4')]||[];this['Actions']=_0x13ce8d[_0xbb10('0x5')]||[];}module[_0xbb10('0x6')]=Trigger; \ No newline at end of file +var _0x0b0e=['channel','voice','status','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x466a1a,_0x37933b){_0x466a1a=_0x466a1a-0x0;var _0x577165=_0x0b0e[_0x466a1a];return _0x577165;};'use strict';function Trigger(_0x29cd1e){this['id']=_0x29cd1e['id']||0x0;this['name']=_0x29cd1e[_0xe0b0('0x0')]||'';this['channel']=_0x29cd1e[_0xe0b0('0x1')]||_0xe0b0('0x2');this[_0xe0b0('0x3')]=_0x29cd1e[_0xe0b0('0x3')]||![];this[_0xe0b0('0x4')]=_0x29cd1e[_0xe0b0('0x4')]||[];this[_0xe0b0('0x5')]=_0x29cd1e[_0xe0b0('0x5')]||[];this[_0xe0b0('0x6')]=_0x29cd1e[_0xe0b0('0x6')]||[];}module[_0xe0b0('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 6226ef4..01169fd 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 _0x17bc=['state','unknown','status','registry','indexOf','host','port','domain','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name'];(function(_0x38d5b2,_0xe77bf4){var _0x5b4ba8=function(_0x28ee00){while(--_0x28ee00){_0x38d5b2['push'](_0x38d5b2['shift']());}};_0x5b4ba8(++_0xe77bf4);}(_0x17bc,0x16e));var _0xc17b=function(_0x2b62c7,_0x3cb738){_0x2b62c7=_0x2b62c7-0x0;var _0xc6f97a=_0x17bc[_0x2b62c7];return _0xc6f97a;};'use strict';function Trunk(_0x51d54b){this['id']=_0x51d54b['id']||0x0;this[_0xc17b('0x0')]=_0x51d54b[_0xc17b('0x0')]||![];this['name']=_0x51d54b[_0xc17b('0x1')]||'';this[_0xc17b('0x2')]=_0xc17b('0x3');this['stateTime']=0x0;this[_0xc17b('0x4')]='unknown';this[_0xc17b('0x5')]=_0x51d54b['registry']&&_0x51d54b[_0xc17b('0x5')][_0xc17b('0x6')](':')?_0x51d54b[_0xc17b('0x5')]['split'](':')[0x0]:'';this[_0xc17b('0x7')]='';this[_0xc17b('0x8')]='';this[_0xc17b('0x9')]='';this['domainport']='';this[_0xc17b('0xa')]='';this[_0xc17b('0xb')]=_0xc17b('0x3');this[_0xc17b('0xc')]='';this[_0xc17b('0xd')]='';this[_0xc17b('0xe')]=_0x51d54b[_0xc17b('0xe')]||'';}module[_0xc17b('0xf')]=Trunk; \ No newline at end of file +var _0xce5c=['name','state','unknown','stateTime','status','registry','split','port','domain','domainport','refresh','stateRegistry','registrationtime','address','exports','active'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0xce5c,0x9f));var _0xcce5=function(_0x2ae2ad,_0xac5b0c){_0x2ae2ad=_0x2ae2ad-0x0;var _0x26dbd7=_0xce5c[_0x2ae2ad];return _0x26dbd7;};'use strict';function Trunk(_0x1cee32){this['id']=_0x1cee32['id']||0x0;this[_0xcce5('0x0')]=_0x1cee32['active']||![];this[_0xcce5('0x1')]=_0x1cee32[_0xcce5('0x1')]||'';this[_0xcce5('0x2')]=_0xcce5('0x3');this[_0xcce5('0x4')]=0x0;this[_0xcce5('0x5')]='unknown';this[_0xcce5('0x6')]=_0x1cee32['registry']&&_0x1cee32[_0xcce5('0x6')]['indexOf'](':')?_0x1cee32[_0xcce5('0x6')][_0xcce5('0x7')](':')[0x0]:'';this['host']='';this[_0xcce5('0x8')]='';this[_0xcce5('0x9')]='';this[_0xcce5('0xa')]='';this[_0xcce5('0xb')]='';this[_0xcce5('0xc')]=_0xcce5('0x3');this[_0xcce5('0xd')]='';this[_0xcce5('0xe')]='';this['defaultuser']=_0x1cee32['defaultuser']||'';}module[_0xcce5('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 c776467..3d1c8e0 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 _0xc636=['exten','recordingFormat','none','mandatoryDisposition'];(function(_0x589708,_0x49a1d9){var _0x4729f2=function(_0x420755){while(--_0x420755){_0x589708['push'](_0x589708['shift']());}};_0x4729f2(++_0x49a1d9);}(_0xc636,0x190));var _0x6c63=function(_0x5efcb0,_0x1cce28){_0x5efcb0=_0x5efcb0-0x0;var _0x2a986c=_0xc636[_0x5efcb0];return _0x2a986c;};'use strict';function voiceExtension(_0x594ed0){this['id']=_0x594ed0['id']||0x0;this[_0x6c63('0x0')]=_0x594ed0[_0x6c63('0x0')]||'';this[_0x6c63('0x1')]=_0x594ed0[_0x6c63('0x1')]||_0x6c63('0x2');this[_0x6c63('0x3')]=_0x594ed0[_0x6c63('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x3d7c=['none','mandatoryDisposition','exten','recordingFormat'];(function(_0x3790a6,_0x276d65){var _0xe6a81b=function(_0x3025a3){while(--_0x3025a3){_0x3790a6['push'](_0x3790a6['shift']());}};_0xe6a81b(++_0x276d65);}(_0x3d7c,0xbe));var _0xc3d7=function(_0x5d7843,_0x59509e){_0x5d7843=_0x5d7843-0x0;var _0xe8ca5d=_0x3d7c[_0x5d7843];return _0xe8ca5d;};'use strict';function voiceExtension(_0x26b122){this['id']=_0x26b122['id']||0x0;this[_0xc3d7('0x0')]=_0x26b122[_0xc3d7('0x0')]||'';this['recordingFormat']=_0x26b122[_0xc3d7('0x1')]||_0xc3d7('0x2');this[_0xc3d7('0x3')]=_0x26b122[_0xc3d7('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index cdfec76..c657e3d 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 _0x8fe0=['dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','startProgressive','startPredictive','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallInQueue','dialPreviewAutoRecallMe','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown','not_inuse','inuse','invalid','ringing','onhold','wav','gsm','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumHoldTime','sumBillable','unmanaged','loggedIn','available','acw','acwTimeout','autopause','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout'];(function(_0x356312,_0x4e93b7){var _0x1b1055=function(_0x224f96){while(--_0x224f96){_0x356312['push'](_0x356312['shift']());}};_0x1b1055(++_0x4e93b7);}(_0x8fe0,0x1a3));var _0x08fe=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x8fe0[_0xa464c9];return _0x3d73c4;};'use strict';var statusDesc=[_0x08fe('0x0'),_0x08fe('0x1'),_0x08fe('0x2'),'busy',_0x08fe('0x3'),'unavailable',_0x08fe('0x4'),'ringinuse',_0x08fe('0x5')];var monitorFormat={'wav':_0x08fe('0x6'),'wav49':'wav49','gsm':_0x08fe('0x7')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x08fe('0x8')};function VoiceQueue(_0x2e948e){this['id']=_0x2e948e['id']||0x0;this[_0x08fe('0x9')]=_0x2e948e['name']||'';this['monitor_format']=_0x2e948e[_0x08fe('0xa')]||'';this[_0x08fe('0xb')]=_0x2e948e[_0x08fe('0xb')]||_0x08fe('0xc');this[_0x08fe('0xd')]=0x0;this[_0x08fe('0xe')]=0x0;this[_0x08fe('0xf')]=0x0;this[_0x08fe('0x10')]=0x0;this['sumDuration']=0x0;this[_0x08fe('0x11')]=0x0;this[_0x08fe('0x12')]=0x0;this[_0x08fe('0x13')]=0x0;this['abandoned']=0x0;this[_0x08fe('0x14')]=0x0;this[_0x08fe('0x15')]=0x0;this['acw']=_0x2e948e[_0x08fe('0x16')]||![];this['acwTimeout']=_0x2e948e[_0x08fe('0x17')]||0xa;this[_0x08fe('0x18')]=_0x2e948e[_0x08fe('0x18')]||'no';this['sendMessageOneNotActive']=!![];this[_0x08fe('0x19')]='';this[_0x08fe('0x1a')]=0x0;this[_0x08fe('0x1b')]=0x0;this[_0x08fe('0x1c')]=_0x2e948e['dialTimezone']||null;this[_0x08fe('0x1d')]=_0x2e948e[_0x08fe('0x1d')]?_0x2e948e['dialGlobalInterval']:null;this[_0x08fe('0x1e')]=_0x2e948e['dialActive'];this[_0x08fe('0x1f')]=_0x2e948e['dialMethod']||'progressive';this[_0x08fe('0x20')]=_0x2e948e['dialLimitChannel']||0x0;this[_0x08fe('0x21')]=_0x2e948e['dialLimitQueue']||0x0;this[_0x08fe('0x22')]=_0x2e948e['dialPowerLevel']||0x1;this[_0x08fe('0x23')]=_0x2e948e['dialPredictiveOptimization']||'dropRate';this[_0x08fe('0x24')]=_0x2e948e['dialPredictiveOptimizationPercentage']||0.03;this[_0x08fe('0x25')]=_0x2e948e[_0x08fe('0x25')]||0x258;this[_0x08fe('0x26')]=_0x2e948e[_0x08fe('0x26')]||'anonymous';this['dialOriginateCallerIdNumber']=_0x2e948e[_0x08fe('0x27')]||_0x08fe('0x28');this['dialOriginateTimeout']=_0x2e948e[_0x08fe('0x29')]||0x1e;this[_0x08fe('0x2a')]=_0x2e948e['dialQueueOptions']||_0x08fe('0x2b');this[_0x08fe('0x2c')]=_0x2e948e['dialQueueTimeout']||0x3;this[_0x08fe('0x2d')]=_0x2e948e[_0x08fe('0x2d')]||undefined;this[_0x08fe('0x2e')]=_0x2e948e['dialCongestionMaxRetry']||0x3;this[_0x08fe('0x2f')]=_0x2e948e['dialCongestionRetryFrequency']||0x96;this[_0x08fe('0x30')]=_0x2e948e[_0x08fe('0x30')]||0x3;this[_0x08fe('0x31')]=_0x2e948e[_0x08fe('0x31')]||0x96;this[_0x08fe('0x32')]=_0x2e948e[_0x08fe('0x32')]||0x3;this[_0x08fe('0x33')]=_0x2e948e['dialNoAnswerRetryFrequency']||0x96;this[_0x08fe('0x34')]=_0x2e948e[_0x08fe('0x34')]||0x3;this[_0x08fe('0x35')]=_0x2e948e[_0x08fe('0x35')]||0x96;this[_0x08fe('0x36')]=_0x2e948e[_0x08fe('0x36')]||0x3;this[_0x08fe('0x37')]=_0x2e948e[_0x08fe('0x37')]||0x96;this['dialAbandonedMaxRetry']=_0x2e948e[_0x08fe('0x38')]||0x3;this[_0x08fe('0x39')]=_0x2e948e[_0x08fe('0x39')]||0x96;this[_0x08fe('0x3a')]=_0x2e948e[_0x08fe('0x3a')]||0x3;this[_0x08fe('0x3b')]=_0x2e948e[_0x08fe('0x3b')]||0x96;this[_0x08fe('0x3c')]=_0x2e948e['dialAgentRejectMaxRetry']||0x3;this[_0x08fe('0x3d')]=_0x2e948e[_0x08fe('0x3d')]||0x96;this['dialGlobalMaxRetry']=_0x2e948e[_0x08fe('0x3e')]||0x4;this['Trunk']=_0x2e948e['Trunk']?_0x2e948e[_0x08fe('0x3f')]:undefined;this['TrunkBackup']=_0x2e948e[_0x08fe('0x40')]?_0x2e948e[_0x08fe('0x40')]:undefined;this['dialPrefix']=_0x2e948e[_0x08fe('0x41')]||undefined;this[_0x08fe('0x42')]=_0x2e948e[_0x08fe('0x42')]?_0x2e948e[_0x08fe('0x42')]:undefined;this[_0x08fe('0x43')]=_0x2e948e[_0x08fe('0x43')]||'DESC';this[_0x08fe('0x44')]=_0x2e948e['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x2e948e[_0x08fe('0x45')]||undefined;this[_0x08fe('0x46')]=strategy[_0x2e948e[_0x08fe('0x46')]]||_0x08fe('0x47');this[_0x08fe('0x48')]=!![];this[_0x08fe('0x49')]=_0x2e948e[_0x08fe('0x49')]||![];this[_0x08fe('0x4a')]=_0x2e948e[_0x08fe('0x4a')];this['dialAMDGreeting']=_0x2e948e['dialAMDGreeting'];this[_0x08fe('0x4b')]=_0x2e948e[_0x08fe('0x4b')];this['dialAMDTotalAnalysisTime']=_0x2e948e[_0x08fe('0x4c')];this[_0x08fe('0x4d')]=_0x2e948e[_0x08fe('0x4d')];this[_0x08fe('0x4e')]=_0x2e948e[_0x08fe('0x4e')];this[_0x08fe('0x4f')]=_0x2e948e[_0x08fe('0x4f')];this[_0x08fe('0x50')]=_0x2e948e[_0x08fe('0x50')];this['dialAMDMaximumWordLength']=_0x2e948e[_0x08fe('0x51')];this[_0x08fe('0x52')]=0x0;this[_0x08fe('0x53')]=0x0;this['timeout']=_0x2e948e[_0x08fe('0x54')];this[_0x08fe('0x55')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x08fe('0x56')]=0x0;this[_0x08fe('0x57')]=0x0;this[_0x08fe('0x58')]=0x0;this[_0x08fe('0x59')]=0x0;this[_0x08fe('0x5a')]=0x0;this[_0x08fe('0x5b')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x08fe('0x5c')]=0x0;this[_0x08fe('0x5d')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x08fe('0x5e')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x08fe('0x5f')]=undefined;this[_0x08fe('0x60')]=undefined;this['handlePredictive']=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x08fe('0x61')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x08fe('0x62')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x08fe('0x63')]=0x0;this[_0x08fe('0x64')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x08fe('0x65')]=0x0;this[_0x08fe('0x66')]=_0x2e948e[_0x08fe('0x67')]||0x14;this['predictiveIntervalMinThreshold']=_0x2e948e[_0x08fe('0x67')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x08fe('0x68')]=0x0;this[_0x08fe('0x69')]=0x1;this[_0x08fe('0x6a')]=0x0;this[_0x08fe('0x6b')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x08fe('0x6c')]=0x0;this['dialRecallMeTimeout']=_0x2e948e['dialRecallMeTimeout']||0x1e;this[_0x08fe('0x6d')]=_0x2e948e[_0x08fe('0x6d')]||![];this[_0x08fe('0x6e')]=!!_0x2e948e['dialPreviewAutoRecallMe']||![];this[_0x08fe('0x6f')]=_0x2e948e['dialQueueProject2']||undefined;this[_0x08fe('0x70')]=_0x2e948e[_0x08fe('0x70')]||![];this[_0x08fe('0x71')]=_0x2e948e[_0x08fe('0x71')]||![];this[_0x08fe('0xa')]=monitorFormat[_0x2e948e[_0x08fe('0xa')]]?monitorFormat[_0x2e948e[_0x08fe('0xa')]]:undefined;this[_0x08fe('0x72')]=_0x2e948e[_0x08fe('0x72')]||![];this[_0x08fe('0x73')]=_0x2e948e[_0x08fe('0x73')]?_0x2e948e['mandatoryDispositionPause']:undefined;}module['exports']=VoiceQueue; \ No newline at end of file +var _0x487a=['dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown','inuse','invalid','unavailable','ringinuse','wav','gsm','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength'];(function(_0x568b9b,_0x56485b){var _0xf5f3ab=function(_0x5c9a5a){while(--_0x5c9a5a){_0x568b9b['push'](_0x568b9b['shift']());}};_0xf5f3ab(++_0x56485b);}(_0x487a,0x117));var _0xa487=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x487a[_0x934425];return _0x31d596;};'use strict';var statusDesc=[_0xa487('0x0'),'not_inuse',_0xa487('0x1'),'busy',_0xa487('0x2'),_0xa487('0x3'),'ringing',_0xa487('0x4'),'onhold'];var monitorFormat={'wav':_0xa487('0x5'),'wav49':'wav49','gsm':_0xa487('0x6')};var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};function VoiceQueue(_0x21b29e){this['id']=_0x21b29e['id']||0x0;this['name']=_0x21b29e[_0xa487('0x7')]||'';this[_0xa487('0x8')]=_0x21b29e[_0xa487('0x8')]||'';this[_0xa487('0x9')]=_0x21b29e['type']||_0xa487('0xa');this[_0xa487('0xb')]=0x0;this['talking']=0x0;this[_0xa487('0xc')]=0x0;this[_0xa487('0xd')]=0x0;this[_0xa487('0xe')]=0x0;this[_0xa487('0xf')]=0x0;this['sumBillable']=0x0;this[_0xa487('0x10')]=0x0;this[_0xa487('0x11')]=0x0;this[_0xa487('0x12')]=0x0;this[_0xa487('0x13')]=0x0;this['acw']=_0x21b29e[_0xa487('0x14')]||![];this['acwTimeout']=_0x21b29e[_0xa487('0x15')]||0xa;this[_0xa487('0x16')]=_0x21b29e[_0xa487('0x16')]||'no';this['sendMessageOneNotActive']=!![];this[_0xa487('0x17')]='';this[_0xa487('0x18')]=0x0;this[_0xa487('0x19')]=0x0;this[_0xa487('0x1a')]=_0x21b29e['dialTimezone']||null;this[_0xa487('0x1b')]=_0x21b29e[_0xa487('0x1b')]?_0x21b29e[_0xa487('0x1b')]:null;this[_0xa487('0x1c')]=_0x21b29e[_0xa487('0x1c')];this[_0xa487('0x1d')]=_0x21b29e[_0xa487('0x1d')]||_0xa487('0x1e');this[_0xa487('0x1f')]=_0x21b29e[_0xa487('0x1f')]||0x0;this[_0xa487('0x20')]=_0x21b29e[_0xa487('0x20')]||0x0;this[_0xa487('0x21')]=_0x21b29e[_0xa487('0x21')]||0x1;this[_0xa487('0x22')]=_0x21b29e[_0xa487('0x22')]||_0xa487('0x23');this['dialPredictiveOptimizationPercentage']=_0x21b29e[_0xa487('0x24')]||0.03;this[_0xa487('0x25')]=_0x21b29e[_0xa487('0x25')]||0x258;this['dialOriginateCallerIdName']=_0x21b29e[_0xa487('0x26')]||_0xa487('0x27');this[_0xa487('0x28')]=_0x21b29e[_0xa487('0x28')]||'anonymous';this['dialOriginateTimeout']=_0x21b29e[_0xa487('0x29')]||0x1e;this[_0xa487('0x2a')]=_0x21b29e[_0xa487('0x2a')]||_0xa487('0x2b');this[_0xa487('0x2c')]=_0x21b29e[_0xa487('0x2c')]||0x3;this[_0xa487('0x2d')]=_0x21b29e[_0xa487('0x2d')]||undefined;this[_0xa487('0x2e')]=_0x21b29e[_0xa487('0x2e')]||0x3;this['dialCongestionRetryFrequency']=_0x21b29e['dialCongestionRetryFrequency']||0x96;this['dialBusyMaxRetry']=_0x21b29e[_0xa487('0x2f')]||0x3;this[_0xa487('0x30')]=_0x21b29e[_0xa487('0x30')]||0x96;this[_0xa487('0x31')]=_0x21b29e['dialNoAnswerMaxRetry']||0x3;this[_0xa487('0x32')]=_0x21b29e[_0xa487('0x32')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x21b29e[_0xa487('0x33')]||0x3;this[_0xa487('0x34')]=_0x21b29e[_0xa487('0x34')]||0x96;this['dialDropMaxRetry']=_0x21b29e['dialDropMaxRetry']||0x3;this[_0xa487('0x35')]=_0x21b29e['dialDropRetryFrequency']||0x96;this[_0xa487('0x36')]=_0x21b29e['dialAbandonedMaxRetry']||0x3;this[_0xa487('0x37')]=_0x21b29e[_0xa487('0x37')]||0x96;this['dialMachineMaxRetry']=_0x21b29e['dialMachineMaxRetry']||0x3;this[_0xa487('0x38')]=_0x21b29e['dialMachineRetryFrequency']||0x96;this[_0xa487('0x39')]=_0x21b29e[_0xa487('0x39')]||0x3;this['dialAgentRejectRetryFrequency']=_0x21b29e[_0xa487('0x3a')]||0x96;this[_0xa487('0x3b')]=_0x21b29e['dialGlobalMaxRetry']||0x4;this['Trunk']=_0x21b29e['Trunk']?_0x21b29e[_0xa487('0x3c')]:undefined;this[_0xa487('0x3d')]=_0x21b29e[_0xa487('0x3d')]?_0x21b29e[_0xa487('0x3d')]:undefined;this['dialPrefix']=_0x21b29e[_0xa487('0x3e')]||undefined;this[_0xa487('0x3f')]=_0x21b29e['Interval']?_0x21b29e[_0xa487('0x3f')]:undefined;this['dialOrderByScheduledAt']=_0x21b29e[_0xa487('0x40')]||_0xa487('0x41');this[_0xa487('0x42')]=_0x21b29e[_0xa487('0x42')]||undefined;this[_0xa487('0x43')]=_0x21b29e[_0xa487('0x43')]||undefined;this[_0xa487('0x44')]=strategy[_0x21b29e[_0xa487('0x44')]]||_0xa487('0x45');this['queueStatusComplete']=!![];this[_0xa487('0x46')]=_0x21b29e[_0xa487('0x46')]||![];this['dialAMDInitialSilence']=_0x21b29e['dialAMDInitialSilence'];this[_0xa487('0x47')]=_0x21b29e[_0xa487('0x47')];this[_0xa487('0x48')]=_0x21b29e[_0xa487('0x48')];this[_0xa487('0x49')]=_0x21b29e[_0xa487('0x49')];this[_0xa487('0x4a')]=_0x21b29e[_0xa487('0x4a')];this[_0xa487('0x4b')]=_0x21b29e[_0xa487('0x4b')];this['dialAMDMaximumNumberOfWords']=_0x21b29e['dialAMDMaximumNumberOfWords'];this[_0xa487('0x4c')]=_0x21b29e[_0xa487('0x4c')];this[_0xa487('0x4d')]=_0x21b29e[_0xa487('0x4d')];this[_0xa487('0x4e')]=0x0;this[_0xa487('0x4f')]=0x0;this[_0xa487('0x50')]=_0x21b29e[_0xa487('0x50')];this[_0xa487('0x51')]=0x0;this[_0xa487('0x52')]=0x0;this[_0xa487('0x53')]=0x0;this[_0xa487('0x54')]=0x0;this[_0xa487('0x55')]=0x0;this[_0xa487('0x56')]=0x0;this[_0xa487('0x57')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xa487('0x58')]=0x0;this[_0xa487('0x59')]=0x0;this[_0xa487('0x5a')]=0x0;this[_0xa487('0x5b')]=0x0;this[_0xa487('0x5c')]=0x0;this[_0xa487('0x5d')]=0x0;this[_0xa487('0x5e')]=undefined;this['startPredictive']=undefined;this['handlePredictive']=undefined;this[_0xa487('0x5f')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xa487('0x60')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0xa487('0x61')]=0x0;this[_0xa487('0x62')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xa487('0x63')]=0x0;this[_0xa487('0x64')]=0x0;this[_0xa487('0x65')]=_0x21b29e[_0xa487('0x66')]||0x14;this[_0xa487('0x67')]=_0x21b29e[_0xa487('0x66')]||0xa;this[_0xa487('0x68')]=0x0;this[_0xa487('0x69')]=0x0;this[_0xa487('0x6a')]=0x1;this[_0xa487('0x6b')]=0x0;this['erlangCallToSecond']=0x0;this[_0xa487('0x6c')]=0x0;this[_0xa487('0x6d')]=0x0;this[_0xa487('0x6e')]=_0x21b29e[_0xa487('0x6e')]||0x1e;this[_0xa487('0x6f')]=_0x21b29e[_0xa487('0x6f')]||![];this[_0xa487('0x70')]=!!_0x21b29e['dialPreviewAutoRecallMe']||![];this[_0xa487('0x71')]=_0x21b29e[_0xa487('0x71')]||undefined;this['dialAgiAfterHangupClient']=_0x21b29e[_0xa487('0x72')]||![];this[_0xa487('0x73')]=_0x21b29e['dialAgiAfterHangupAgent']||![];this[_0xa487('0x8')]=monitorFormat[_0x21b29e[_0xa487('0x8')]]?monitorFormat[_0x21b29e[_0xa487('0x8')]]:undefined;this[_0xa487('0x74')]=_0x21b29e['mandatoryDisposition']||![];this[_0xa487('0x75')]=_0x21b29e[_0xa487('0x75')]?_0x21b29e['mandatoryDispositionPause']: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 744b23f..3d2aa97 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 _0x34fc=['accessKey','remoteUri','serverUrl','Configurations','name','username'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x34fc,0x124));var _0xc34f=function(_0x4e5637,_0x2c1bd1){_0x4e5637=_0x4e5637-0x0;var _0x1b7a8f=_0x34fc[_0x4e5637];return _0x1b7a8f;};'use strict';function VtigerAccount(_0x4c4ceb){this['id']=_0x4c4ceb['id']||0x0;this['name']=_0x4c4ceb[_0xc34f('0x0')]||'';this[_0xc34f('0x1')]=_0x4c4ceb[_0xc34f('0x1')]||'';this[_0xc34f('0x2')]=_0x4c4ceb[_0xc34f('0x2')]||'';this['remoteUri']=_0x4c4ceb[_0xc34f('0x3')]||'';this['serverUrl']=_0x4c4ceb[_0xc34f('0x4')]||'';this[_0xc34f('0x5')]=_0x4c4ceb[_0xc34f('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0xf551=['remoteUri','Configurations','exports','name','username','accessKey'];(function(_0x1b3faa,_0xba8ad0){var _0x35c3b2=function(_0x26347a){while(--_0x26347a){_0x1b3faa['push'](_0x1b3faa['shift']());}};_0x35c3b2(++_0xba8ad0);}(_0xf551,0xe7));var _0x1f55=function(_0x12a700,_0x1038e3){_0x12a700=_0x12a700-0x0;var _0x1b929b=_0xf551[_0x12a700];return _0x1b929b;};'use strict';function VtigerAccount(_0x56dd08){this['id']=_0x56dd08['id']||0x0;this[_0x1f55('0x0')]=_0x56dd08[_0x1f55('0x0')]||'';this[_0x1f55('0x1')]=_0x56dd08[_0x1f55('0x1')]||'';this[_0x1f55('0x2')]=_0x56dd08[_0x1f55('0x2')]||'';this[_0x1f55('0x3')]=_0x56dd08[_0x1f55('0x3')]||'';this['serverUrl']=_0x56dd08['serverUrl']||'';this[_0x1f55('0x4')]=_0x56dd08['Configurations']||{};}module[_0x1f55('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index e39aecd..6b8f77d 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 _0xc67b=['type','integrationTab','serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0xdf81d7,_0x5e38b3){var _0x1bb2dc=function(_0xb74ed7){while(--_0xb74ed7){_0xdf81d7['push'](_0xdf81d7['shift']());}};_0x1bb2dc(++_0x5e38b3);}(_0xc67b,0x137));var _0xbc67=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xc67b[_0x126558];return _0x1f6d14;};'use strict';function ZendeskAccount(_0x39fe65){this['id']=_0x39fe65['id']||0x0;this['name']=_0x39fe65[_0xbc67('0x0')]||'';this[_0xbc67('0x1')]=_0x39fe65[_0xbc67('0x1')]||'';this[_0xbc67('0x2')]=_0x39fe65[_0xbc67('0x2')]||'';this['token']=_0x39fe65['token']||'';this[_0xbc67('0x3')]=_0x39fe65[_0xbc67('0x3')]||'';this['authType']=_0x39fe65['authType']||'';this[_0xbc67('0x4')]=_0x39fe65[_0xbc67('0x4')]||_0xbc67('0x5');this[_0xbc67('0x6')]=_0x39fe65[_0xbc67('0x6')]||'';this[_0xbc67('0x7')]=_0x39fe65[_0xbc67('0x7')]||{};}module[_0xbc67('0x8')]=ZendeskAccount; \ No newline at end of file +var _0xc03e=['name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports'];(function(_0x42f88d,_0x312011){var _0x54bfd1=function(_0xbbf0de){while(--_0xbbf0de){_0x42f88d['push'](_0x42f88d['shift']());}};_0x54bfd1(++_0x312011);}(_0xc03e,0x129));var _0xec03=function(_0x279522,_0x497270){_0x279522=_0x279522-0x0;var _0xc6071d=_0xc03e[_0x279522];return _0xc6071d;};'use strict';function ZendeskAccount(_0x382ef3){this['id']=_0x382ef3['id']||0x0;this[_0xec03('0x0')]=_0x382ef3[_0xec03('0x0')]||'';this[_0xec03('0x1')]=_0x382ef3[_0xec03('0x1')]||'';this['password']=_0x382ef3[_0xec03('0x2')]||'';this[_0xec03('0x3')]=_0x382ef3['token']||'';this[_0xec03('0x4')]=_0x382ef3[_0xec03('0x4')]||'';this['authType']=_0x382ef3[_0xec03('0x5')]||'';this[_0xec03('0x6')]=_0x382ef3[_0xec03('0x6')]||_0xec03('0x7');this[_0xec03('0x8')]=_0x382ef3[_0xec03('0x8')]||'';this[_0xec03('0x9')]=_0x382ef3['Configurations']||{};}module[_0xec03('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 547e99b..f4b3b13 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 _0x85d9=['description','host','zone','clientId','serverUrl','code','refreshToken','Configurations','name'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x85d9,0x179));var _0x985d=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x85d9[_0x502c7d];return _0x30b7ed;};'use strict';function ZohoAccount(_0x2c5585){this['id']=_0x2c5585['id']||0x0;this['name']=_0x2c5585[_0x985d('0x0')]||'';this[_0x985d('0x1')]=_0x2c5585['description']||'';this[_0x985d('0x2')]=_0x2c5585[_0x985d('0x2')]||'';this[_0x985d('0x3')]=_0x2c5585[_0x985d('0x3')]||'';this[_0x985d('0x4')]=_0x2c5585[_0x985d('0x4')]||'';this['clientSecret']=_0x2c5585['clientSecret']||'';this[_0x985d('0x5')]=_0x2c5585[_0x985d('0x5')]||'';this[_0x985d('0x6')]=_0x2c5585[_0x985d('0x6')]||'';this[_0x985d('0x7')]=_0x2c5585[_0x985d('0x7')]||'';this[_0x985d('0x8')]=_0x2c5585['Configurations']||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x1600=['code','refreshToken','Configurations','exports','name','description','host','zone','clientSecret','serverUrl'];(function(_0x464857,_0x3c4735){var _0x54f5f2=function(_0x4e3302){while(--_0x4e3302){_0x464857['push'](_0x464857['shift']());}};_0x54f5f2(++_0x3c4735);}(_0x1600,0x18a));var _0x0160=function(_0x3b046a,_0x22f205){_0x3b046a=_0x3b046a-0x0;var _0x32d4a9=_0x1600[_0x3b046a];return _0x32d4a9;};'use strict';function ZohoAccount(_0x47feed){this['id']=_0x47feed['id']||0x0;this['name']=_0x47feed[_0x0160('0x0')]||'';this[_0x0160('0x1')]=_0x47feed['description']||'';this[_0x0160('0x2')]=_0x47feed[_0x0160('0x2')]||'';this[_0x0160('0x3')]=_0x47feed[_0x0160('0x3')]||'';this['clientId']=_0x47feed['clientId']||'';this['clientSecret']=_0x47feed[_0x0160('0x4')]||'';this[_0x0160('0x5')]=_0x47feed['serverUrl']||'';this[_0x0160('0x6')]=_0x47feed['code']||'';this[_0x0160('0x7')]=_0x47feed[_0x0160('0x7')]||'';this[_0x0160('0x8')]=_0x47feed[_0x0160('0x8')]||{};}module[_0x0160('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 5b216b7..41d2ff2 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 _0xf029=['firstName','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','originatecalleridname','prototype','\x22%s\x22\x20<%s>','calleridname','number','exports','lodash','moment','isNil','string','uniqueid','idContact','type','queue','dialAnswer','membername','Agent','name','channelAgent','format','SIP/%s','Contact'];(function(_0x2ae0af,_0x2ba5f2){var _0xbd8402=function(_0x417762){while(--_0x417762){_0x2ae0af['push'](_0x2ae0af['shift']());}};_0xbd8402(++_0x2ba5f2);}(_0xf029,0x194));var _0x9f02=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xf029[_0x5d6456];return _0x4d66c1;};'use strict';var util=require('util');var _=require(_0x9f02('0x0'));var moment=require(_0x9f02('0x1'));function checkNameSurname(_0x567c23,_0x4aa6af,_0x384c1a){var _0x552dad='';if(!_[_0x9f02('0x2')](_0x4aa6af)&&_0x9f02('0x3')===typeof _0x4aa6af){_0x552dad+=_0x4aa6af;}if(!_['isNil'](_0x384c1a)&&'string'===typeof _0x384c1a){_0x552dad+='\x20'+_0x384c1a;}if(_0x552dad!==''){return _0x552dad;}return _0x567c23;}function Action(_0x3b2c0a,_0x306b8b,_0x19da0f,_0x111bbf,_0x347ec9){this[_0x9f02('0x4')]=_0x19da0f||undefined;this[_0x9f02('0x5')]=_0x3b2c0a['id'];this['queue']=_0x306b8b['name'];this[_0x9f02('0x6')]=_0x306b8b[_0x9f02('0x6')];this['campaigntype']=_0x9f02('0x7');this[_0x9f02('0x8')]=![];this[_0x9f02('0x9')]=_[_0x9f02('0x2')](_0x3b2c0a[_0x9f02('0xa')])?undefined:_0x3b2c0a[_0x9f02('0xa')][_0x9f02('0xb')];this[_0x9f02('0xc')]=this[_0x9f02('0x9')]?util[_0x9f02('0xd')](_0x9f02('0xe'),this[_0x9f02('0x9')]):_0x111bbf||undefined;this['calleridname']=checkNameSurname(_0x3b2c0a['Contact']['phone'],_0x3b2c0a[_0x9f02('0xf')][_0x9f02('0x10')],_0x3b2c0a['Contact'][_0x9f02('0x11')]);this[_0x9f02('0x12')]=_0x3b2c0a[_0x9f02('0x12')]||![];this['calleridnum']=_0x3b2c0a[_0x9f02('0xf')]['phone'];this[_0x9f02('0x13')]=_0x3b2c0a[_0x9f02('0x13')];this[_0x9f02('0x14')]=_0x3b2c0a[_0x9f02('0x14')]||0x0;this[_0x9f02('0x15')]=_0x3b2c0a[_0x9f02('0x15')]||0x0;this[_0x9f02('0x16')]=_0x3b2c0a[_0x9f02('0x16')]||0x0;this[_0x9f02('0x17')]=(_0x3b2c0a[_0x9f02('0x14')]||0x0)+(_0x3b2c0a[_0x9f02('0x15')]||0x0)+(_0x3b2c0a['countnoanswerretry']||0x0)+(_0x3b2c0a[_0x9f02('0x18')]||0x0)+(_0x3b2c0a[_0x9f02('0x19')]||0x0)+(_0x3b2c0a[_0x9f02('0x1a')]||0x0)+(_0x3b2c0a[_0x9f02('0x1b')]||0x0)+(_0x3b2c0a[_0x9f02('0x1c')]||0x0);this[_0x9f02('0x18')]=_0x3b2c0a[_0x9f02('0x18')]||0x0;this[_0x9f02('0x19')]=_0x3b2c0a[_0x9f02('0x19')]||0x0;this[_0x9f02('0x1a')]=_0x3b2c0a[_0x9f02('0x1a')]||0x0;this[_0x9f02('0x1b')]=_0x3b2c0a[_0x9f02('0x1b')]||0x0;this[_0x9f02('0x1c')]=_0x3b2c0a['countagentrejectretry']||0x0;this[_0x9f02('0x1d')]=_0x3b2c0a[_0x9f02('0x1d')];this[_0x9f02('0x1e')]=_0x3b2c0a[_0x9f02('0x1e')];this[_0x9f02('0x1f')]=_0x3b2c0a[_0x9f02('0x1f')];this[_0x9f02('0x20')]=_0x3b2c0a[_0x9f02('0x20')];this[_0x9f02('0x21')]=_0x3b2c0a[_0x9f02('0x21')];this['ListId']=_0x3b2c0a['ListId'];this[_0x9f02('0x22')]=_[_0x9f02('0x2')](_0x3b2c0a['Agent'])?_0x3b2c0a['UserId']:_0x3b2c0a[_0x9f02('0xa')]['id'];this[_0x9f02('0x23')]=_0x3b2c0a[_0x9f02('0x23')];this['originatecalleridnum']='';this[_0x9f02('0x24')]='';}Action[_0x9f02('0x25')]['getCaller']=function(){return util['format'](_0x9f02('0x26'),this[_0x9f02('0x27')],this[_0x9f02('0x28')]);};module[_0x9f02('0x29')]=Action; \ No newline at end of file +var _0x9014=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','callback','callbackuniqueid'];(function(_0x11518f,_0x367253){var _0x34153f=function(_0x458e6c){while(--_0x458e6c){_0x11518f['push'](_0x11518f['shift']());}};_0x34153f(++_0x367253);}(_0x9014,0x99));var _0x4901=function(_0x36fbc5,_0x47bd1e){_0x36fbc5=_0x36fbc5-0x0;var _0xa4fc6c=_0x9014[_0x36fbc5];return _0xa4fc6c;};'use strict';var util=require(_0x4901('0x0'));var _=require(_0x4901('0x1'));var moment=require(_0x4901('0x2'));function checkNameSurname(_0x25e05e,_0xa4da0,_0xc1bc17){var _0x5e70cc='';if(!_[_0x4901('0x3')](_0xa4da0)&&_0x4901('0x4')===typeof _0xa4da0){_0x5e70cc+=_0xa4da0;}if(!_[_0x4901('0x3')](_0xc1bc17)&&_0x4901('0x4')===typeof _0xc1bc17){_0x5e70cc+='\x20'+_0xc1bc17;}if(_0x5e70cc!==''){return _0x5e70cc;}return _0x25e05e;}function Action(_0x137433,_0xe5f572,_0xa37c40,_0x3227fa,_0x59fd2f){this[_0x4901('0x5')]=_0xa37c40||undefined;this[_0x4901('0x6')]=_0x137433['id'];this[_0x4901('0x7')]=_0xe5f572[_0x4901('0x8')];this[_0x4901('0x9')]=_0xe5f572[_0x4901('0x9')];this['campaigntype']=_0x4901('0x7');this[_0x4901('0xa')]=![];this[_0x4901('0xb')]=_['isNil'](_0x137433['Agent'])?undefined:_0x137433[_0x4901('0xc')][_0x4901('0x8')];this[_0x4901('0xd')]=this['membername']?util[_0x4901('0xe')](_0x4901('0xf'),this[_0x4901('0xb')]):_0x3227fa||undefined;this[_0x4901('0x10')]=checkNameSurname(_0x137433[_0x4901('0x11')][_0x4901('0x12')],_0x137433[_0x4901('0x11')][_0x4901('0x13')],_0x137433[_0x4901('0x11')][_0x4901('0x14')]);this[_0x4901('0x15')]=_0x137433[_0x4901('0x15')]||![];this[_0x4901('0x16')]=_0x137433[_0x4901('0x11')][_0x4901('0x12')];this[_0x4901('0x17')]=_0x137433[_0x4901('0x17')];this['countbusyretry']=_0x137433[_0x4901('0x18')]||0x0;this['countcongestionretry']=_0x137433[_0x4901('0x19')]||0x0;this['countnoanswerretry']=_0x137433[_0x4901('0x1a')]||0x0;this[_0x4901('0x1b')]=(_0x137433[_0x4901('0x18')]||0x0)+(_0x137433[_0x4901('0x19')]||0x0)+(_0x137433[_0x4901('0x1a')]||0x0)+(_0x137433['countnosuchnumberretry']||0x0)+(_0x137433[_0x4901('0x1c')]||0x0)+(_0x137433[_0x4901('0x1d')]||0x0)+(_0x137433[_0x4901('0x1e')]||0x0)+(_0x137433[_0x4901('0x1f')]||0x0);this[_0x4901('0x20')]=_0x137433[_0x4901('0x20')]||0x0;this[_0x4901('0x1c')]=_0x137433[_0x4901('0x1c')]||0x0;this[_0x4901('0x1d')]=_0x137433[_0x4901('0x1d')]||0x0;this[_0x4901('0x1e')]=_0x137433[_0x4901('0x1e')]||0x0;this[_0x4901('0x1f')]=_0x137433[_0x4901('0x1f')]||0x0;this['callback']=_0x137433[_0x4901('0x21')];this[_0x4901('0x22')]=_0x137433['callbackuniqueid'];this[_0x4901('0x23')]=_0x137433[_0x4901('0x23')];this[_0x4901('0x24')]=_0x137433['recallme'];this[_0x4901('0x25')]=_0x137433[_0x4901('0x25')];this['ListId']=_0x137433[_0x4901('0x26')];this[_0x4901('0x27')]=_['isNil'](_0x137433[_0x4901('0xc')])?_0x137433[_0x4901('0x27')]:_0x137433[_0x4901('0xc')]['id'];this['VoiceQueueId']=_0x137433[_0x4901('0x28')];this[_0x4901('0x29')]='';this[_0x4901('0x2a')]='';}Action[_0x4901('0x2b')][_0x4901('0x2c')]=function(){return util[_0x4901('0xe')](_0x4901('0x2d'),this[_0x4901('0x10')],this[_0x4901('0x2e')]);};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 b42ab5b..6ec9e05 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 _0x56a4=['sumBillable','sumDuration','talking','total','unmanaged','loggedInDb','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','name','active','Interval','stringify','md5','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','emit','voice_queue_presence:remove','sendMessageOneNotActive','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','syncCampaigns','booked','clearZombieChannels','hasOwnProperty','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','isNil','Queue','actions','pTalking:\x20','queue','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','updateOriginated','decrementTalkink','[clearZombieChannel]','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','agentReadyId','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','then','logger2','[RecallMe]','catch','disableContact','starttime','logCustomer','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','NOT_ACTIVE','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','cloneAction','createCustomerFinal','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','activeContact','linkedid','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','uniqueid','\x20Queue','custom:agentconnect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','answered','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','unlockAgent','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','Global','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','countabandonedretry','Abandoned','countabandonedetry','dialAbandonedMaxRety','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','Congestion','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','originated:\x20','Contact','phone','lookAgent','[Preview][execCall][success]','Queue:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','logBlacklist','createHistory','[Blacklist][error]','SIP/%s','reachable','execRun','unlockContact','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','isEmpty','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','trim','substring','dialCutDigit','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','getCallerId','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','[originated][increment]','[originateFailure][logOriginateFailure]','actionid','isFailure','response','custom:agentringnoanswer','cause','callProgressDetectingCustomer','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','variables','filterKey','variable','addVariable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','moment','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','redis','defaults','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','hangup','syncHangup','bind','hanguprequest','syncHangupRequest','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','type','outbound','strategy','pTalking'];(function(_0x509eed,_0x565830){var _0x2c8740=function(_0xedf6d){while(--_0xedf6d){_0x509eed['push'](_0x509eed['shift']());}};_0x2c8740(++_0x565830);}(_0x56a4,0x11b));var _0x456a=function(_0x35ec01,_0x5c44ac){_0x35ec01=_0x35ec01-0x0;var _0x4f75d5=_0x56a4[_0x35ec01];return _0x4f75d5;};'use strict';var util=require(_0x456a('0x0'));var _=require(_0x456a('0x1'));var BPromise=require('bluebird');var uuid=require(_0x456a('0x2'));var moment=require(_0x456a('0x3'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x456a('0x4'));var logger=require(_0x456a('0x5'))(_0x456a('0x6'));var loggerAction=require(_0x456a('0x5'))(_0x456a('0x7'));var ami=require('../ami');var rpcDb=require(_0x456a('0x8'));var Action=require('./action');var ut=require('./util/util');config[_0x456a('0x9')]=_[_0x456a('0xa')](config[_0x456a('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x456a('0xb'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x456a('0xc')][_0x456a('0xd')]=function(_0x3bb712){this[_0x456a('0xe')]=this[_0x456a('0xe')]?this[_0x456a('0xe')][_0x456a('0xf')](_0x3bb712):_0x3bb712();};function Preview(_0xe60506){this[_0x456a('0x10')]=new Sequence();this[_0x456a('0x11')]=_0xe60506[_0x456a('0x12')];this['trunks']=_0xe60506[_0x456a('0x13')];this['actions']={};this['agents']=_0xe60506[_0x456a('0x14')];this[_0x456a('0x15')]=0x0;ami['on'](_0x456a('0x16'),this[_0x456a('0x17')]['bind'](this));ami['on'](_0x456a('0x18'),this[_0x456a('0x19')][_0x456a('0x1a')](this));ami['on'](_0x456a('0x1b'),this[_0x456a('0x1c')][_0x456a('0x1a')](this));ami['on']('dialend',this[_0x456a('0x1d')][_0x456a('0x1a')](this));ami['on'](_0x456a('0x1e'),this[_0x456a('0x1f')]['bind'](this));ami['on'](_0x456a('0x20'),this[_0x456a('0x21')][_0x456a('0x1a')](this));ami['on']('attendedtransfer',this[_0x456a('0x22')]['bind'](this));ami['on']('blindtransfer',this[_0x456a('0x23')]['bind'](this));this[_0x456a('0x24')](this['campaignsPreview']);}function emit(_0x962b6d,_0x17d0ae,_0x55054e){io['to'](_0x962b6d)['emit'](_0x17d0ae,_0x55054e);}function emitCampaignPreview(_0x55fe9e){if(_0x55fe9e[_0x456a('0x25')]===_0x456a('0x26')){var _0xb8d35c={'id':_0x55fe9e['id'],'name':_0x55fe9e['name'],'strategy':_0x55fe9e[_0x456a('0x27')],'answered':_0x55fe9e['answered'],'available':_0x55fe9e['available'],'loggedIn':_0x55fe9e['loggedIn'],'pTalking':_0x55fe9e[_0x456a('0x28')],'sumBillable':_0x55fe9e[_0x456a('0x29')],'sumDuration':_0x55fe9e[_0x456a('0x2a')],'sumHoldTime':_0x55fe9e['sumHoldTime']||0x0,'talking':_0x55fe9e[_0x456a('0x2b')],'total':_0x55fe9e[_0x456a('0x2c')],'type':_0x55fe9e['type'],'unmanaged':_0x55fe9e[_0x456a('0x2d')],'abandoned':_0x55fe9e['abandoned'],'waiting':_0x55fe9e['waiting'],'loggedInDb':_0x55fe9e[_0x456a('0x2e')],'dialActive':_0x55fe9e['dialActive'],'dialMethod':_0x55fe9e[_0x456a('0x2f')],'dialOriginateCallerIdName':_0x55fe9e['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x55fe9e[_0x456a('0x30')],'dialOriginateTimeout':_0x55fe9e[_0x456a('0x31')],'dialPrefix':_0x55fe9e[_0x456a('0x32')],'outboundAnswerAgiCallsDay':_0x55fe9e[_0x456a('0x33')],'outboundAnswerCallsDay':_0x55fe9e[_0x456a('0x34')],'outboundBlacklistCallsDay':_0x55fe9e[_0x456a('0x35')],'outboundBusyCallsDay':_0x55fe9e[_0x456a('0x36')],'outboundCongestionCallsDay':_0x55fe9e[_0x456a('0x37')],'outboundDropCallsDayACS':_0x55fe9e['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x55fe9e['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x55fe9e['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x55fe9e[_0x456a('0x38')],'outboundNoSuchCallsDay':_0x55fe9e[_0x456a('0x39')],'outboundOriginateFailureCallsDay':_0x55fe9e['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x55fe9e[_0x456a('0x3a')],'outboundRejectCallsDay':_0x55fe9e[_0x456a('0x3b')],'outboundUnknownCallsDay':_0x55fe9e[_0x456a('0x3c')],'outboundAbandonedCallsDay':_0x55fe9e[_0x456a('0x3d')],'predictiveIntervalAnsweredCalls':_0x55fe9e[_0x456a('0x3e')],'predictiveIntervalAvgHoldtime':_0x55fe9e['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x55fe9e[_0x456a('0x3f')],'predictiveIntervalDroppedCallsCallersExit':_0x55fe9e[_0x456a('0x40')],'predictiveIntervalDroppedCallsTimeout':_0x55fe9e[_0x456a('0x41')],'predictiveIntervalErlangCalls':_0x55fe9e['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x55fe9e[_0x456a('0x42')],'predictiveIntervalHitRate':_0x55fe9e[_0x456a('0x43')],'predictiveIntervalMultiplicativeFactor':_0x55fe9e['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x55fe9e[_0x456a('0x44')],'predictiveIntervalAvailable':_0x55fe9e[_0x456a('0x45')],'predictiveIntervalTotalCalls':_0x55fe9e[_0x456a('0x46')],'message':_0x55fe9e[_0x456a('0x47')],'originated':_0x55fe9e[_0x456a('0x48')],'erlangCalls':_0x55fe9e['erlangCalls'],'erlangCallToSecond':_0x55fe9e[_0x456a('0x49')],'erlangAbandonmentRate':_0x55fe9e[_0x456a('0x4a')],'erlangBusyFactor':_0x55fe9e[_0x456a('0x4b')],'startPredictive':_0x55fe9e['startPredictive'],'startProgressive':_0x55fe9e['startProgressive']};if(_0x55fe9e[_0x456a('0x4c')]){_0xb8d35c['Trunk']={'id':_0x55fe9e['Trunk']['id'],'name':_0x55fe9e['Trunk'][_0x456a('0x4d')],'active':_0x55fe9e[_0x456a('0x4c')][_0x456a('0x4e')],'callerid':_0x55fe9e[_0x456a('0x4c')]['callerid']};}if(_0x55fe9e[_0x456a('0x4f')]){_0xb8d35c[_0x456a('0x4f')]={'id':_0x55fe9e['Interval']['id'],'name':_0x55fe9e[_0x456a('0x4f')][_0x456a('0x4d')]};}var _0xbf9c10=md5(JSON[_0x456a('0x50')](_0xb8d35c));if(_0x55fe9e[_0x456a('0x51')]!==_0xbf9c10){_0x55fe9e['md5']=_0xbf9c10;emit(util[_0x456a('0x52')](_0x456a('0x53'),_0xb8d35c['name']),_0x456a('0x54'),_0xb8d35c);}}}function emitVoiceQueueChannelRemove(_0x1d4420){logger[_0x456a('0x55')](_0x456a('0x56'),JSON[_0x456a('0x50')](_0x1d4420));emit(util[_0x456a('0x52')](_0x456a('0x53'),_0x1d4420[_0x456a('0x4d')]),'voice_queue_channel:remove',_0x1d4420);io[_0x456a('0x57')](_0x456a('0x58'),_0x1d4420);}function notSendMessagesQueue(_0x172bbe){if(_0x172bbe[_0x456a('0x59')]){if(_0x172bbe[_0x456a('0x48')]===0x0&&_0x172bbe['pTalking']===0x0){_0x172bbe[_0x456a('0x59')]=![];_0x172bbe['available']=0x0;_0x172bbe[_0x456a('0x5a')]=0x0;_0x172bbe[_0x456a('0x47')]='NOT_ACTIVE';ut[_0x456a('0x5b')](_0x456a('0x5c'),_0x172bbe[_0x456a('0x4d')]+'\x20is\x20not\x20active');}else{_0x172bbe[_0x456a('0x47')]='IS_DISACTIVED';ut['logger'](_0x456a('0x5c'),_0x172bbe['name']+_0x456a('0x5d'));}emitCampaignPreview(_0x172bbe);}}Preview[_0x456a('0xc')]['loopCampaigns']=function(){var _0x442da9=this;setInterval(function(){_0x442da9[_0x456a('0x5e')]();},0x7cf);};Preview[_0x456a('0xc')][_0x456a('0x5e')]=function(){var _0x355ae8=this[_0x456a('0x11')];this['clockClearZombieChannels']+=0x1;for(var _0xcba613 in _0x355ae8){if(_0x355ae8['hasOwnProperty'](_0xcba613)&&(_0x355ae8[_0xcba613][_0x456a('0x2f')]===_0x456a('0x6')||_0x355ae8[_0xcba613][_0x456a('0x2f')]===_0x456a('0x5f'))&&_0x355ae8[_0xcba613][_0x456a('0x25')]==='outbound'){if(this[_0x456a('0x15')]>0x7){this[_0x456a('0x15')]=0x0;this[_0x456a('0x60')]();}}if(_0x355ae8[_0x456a('0x61')](_0xcba613)&&_0x355ae8[_0xcba613][_0x456a('0x2f')]===_0x456a('0x6')&&_0x355ae8[_0xcba613][_0x456a('0x25')]==='outbound'){if(_0x355ae8[_0xcba613][_0x456a('0x62')]){this[_0x456a('0x63')](_0x355ae8[_0xcba613]);if(_0x355ae8[_0xcba613][_0x456a('0x64')])this[_0x456a('0x65')](_0x355ae8[_0xcba613]);}else{notSendMessagesQueue(_0x355ae8[_0xcba613]);}}}};Preview[_0x456a('0xc')]['clearZombieChannel']=function(_0x2bbe80){var _0x8b32cc=this;this['sequence']['enqueue'](function(){if(!_[_0x456a('0x66')](_0x8b32cc['actions'][_0x2bbe80])){loggerAction[_0x456a('0x55')]('[clearZombieChannels][talking]',_0x2bbe80,_0x456a('0x67'),_0x8b32cc[_0x456a('0x68')][_0x2bbe80]['queue'],'originated:\x20',JSON['stringify'](_0x8b32cc[_0x456a('0x11')][_0x8b32cc[_0x456a('0x68')][_0x2bbe80]['queue']]['originated']),_0x456a('0x69'),JSON['stringify'](_0x8b32cc[_0x456a('0x11')][_0x8b32cc[_0x456a('0x68')][_0x2bbe80][_0x456a('0x6a')]]['pTalking']),JSON['stringify'](_0x8b32cc['actions'][_0x2bbe80][_0x456a('0x6b')]),JSON[_0x456a('0x50')](_[_0x456a('0x6c')](_0x8b32cc['actions'][_0x2bbe80],[_0x456a('0x6d'),_0x456a('0x6e'),_0x456a('0x6f'),_0x456a('0x70')])));return ami[_0x456a('0x71')]({'action':_0x456a('0x72'),'channel':_0x8b32cc[_0x456a('0x68')][_0x2bbe80][_0x456a('0x73')]})['catch'](function(_0x3f539e){if(_0x3f539e[_0x456a('0x47')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x8b32cc[_0x456a('0x68')][_0x2bbe80]){ut[_0x456a('0x74')](_0x8b32cc['campaignsPreview'][_0x8b32cc[_0x456a('0x68')][_0x2bbe80][_0x456a('0x6a')]],'[clearZombieChannel]');if(_0x8b32cc[_0x456a('0x68')][_0x2bbe80][_0x456a('0x6b')]===!![]){ut[_0x456a('0x75')](_0x8b32cc[_0x456a('0x11')][_0x8b32cc['actions'][_0x2bbe80]['queue']],_0x456a('0x76'));ut['loggerError'](_0x456a('0x77')+_0x2bbe80,_0x8b32cc[_0x456a('0x68')][_0x2bbe80]['queue']);}ut['loggerError'](_0x456a('0x78')+_0x2bbe80,_0x8b32cc[_0x456a('0x68')][_0x2bbe80]['queue']);delete _0x8b32cc[_0x456a('0x68')][_0x2bbe80];}},0x2328);}});}});};Preview[_0x456a('0xc')][_0x456a('0x60')]=function(){var _0x3e7e2c=this;loggerAction[_0x456a('0x55')](_0x456a('0x79'),_[_0x456a('0x7a')](this['actions']));for(var _0x3ff564 in this[_0x456a('0x68')]){if(_0x3e7e2c['actions']['hasOwnProperty'](_0x3ff564)){_0x3e7e2c['clearZombieChannel'](_0x3ff564);}}};Preview[_0x456a('0xc')][_0x456a('0x65')]=function(_0x3d1090){var _0x5522c0=this;rpcDb['getContactRecallMe'](_0x3d1090['id'],ut[_0x456a('0x7b')](this[_0x456a('0x14')]))['then'](function(_0x560d02){if(!_[_0x456a('0x66')](_0x560d02)){for(var _0x38215e=0x0;_0x38215e<_0x560d02['length'];_0x38215e+=0x1){if(ut[_0x456a('0x7c')](_0x560d02[_0x38215e][_0x456a('0x7d')])<_0x3d1090[_0x456a('0x7e')]*0x3c){if(_0x560d02[_0x38215e]['Agent']&&!_0x560d02[_0x38215e][_0x456a('0x7f')][_0x456a('0x80')]){_0x5522c0[_0x456a('0x81')](_0x560d02[_0x38215e]['id'])[_0x456a('0x82')](ut[_0x456a('0x83')](_0x456a('0x84')))[_0x456a('0x85')](ut[_0x456a('0x83')](_0x456a('0x84')));}else{rpcDb[_0x456a('0x86')](_0x560d02[_0x38215e]['id']);}}else{var _0x56b933=new Action(_0x560d02[_0x38215e],_0x3d1090);_0x56b933[_0x456a('0x87')]=moment()[_0x456a('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0x3d1090[_0x456a('0x3a')]+=0x1;ut[_0x456a('0x88')](_0x56b933,0x17,_0x456a('0x89'));if(_0x3d1090[_0x456a('0x8a')]){rpcDb['rescheduleContactInQueue'](ut[_0x456a('0x8b')](_0x560d02[_0x38215e]));rpcDb[_0x456a('0x8c')](_0x56b933,_0x456a('0x8d'));}else{ut['logCustomer'](_0x56b933,0x16,_0x456a('0x8e'));rpcDb[_0x456a('0x8c')](_0x56b933,_0x456a('0x8f'));rpcDb['createCustomerFinal'](_0x56b933,_0x456a('0x8f'));}}}}})[_0x456a('0x85')](ut['logger2'](_0x456a('0x90')));};Preview[_0x456a('0xc')]['setMessage']=function(_0x3938ab){_0x3938ab[_0x456a('0x59')]=!![];if(ut[_0x456a('0x91')](_0x3938ab['loggedIn'])){_0x3938ab[_0x456a('0x47')]=_0x456a('0x92');}else if(!ut[_0x456a('0x93')](_0x3938ab[_0x456a('0x62')])){_0x3938ab[_0x456a('0x47')]=_0x456a('0x94');}else if(!this['isTrunkReachable'](_0x3938ab[_0x456a('0x4c')])){if(!this[_0x456a('0x95')](_0x3938ab[_0x456a('0x96')])){_0x3938ab[_0x456a('0x47')]=_0x456a('0x97');}else{_0x3938ab[_0x456a('0x47')]=_0x456a('0x98');}}else{_0x3938ab[_0x456a('0x47')]='ACTIVE';}emitCampaignPreview(_0x3938ab);};Preview[_0x456a('0xc')]['callProgressDetectingCustomer']=function(_0x14e6ff,_0xbfae2a,_0x5293d3){var _0x1d8b2a=this;var _0x26b512=this[_0x456a('0x68')][_0xbfae2a];var _0x4f15bd=this[_0x456a('0x11')][_0x26b512[_0x456a('0x6a')]];var _0x3be164;if(_0x4f15bd){switch(_0x5293d3){case'1':_0x4f15bd['outboundNoSuchCallsDay']+=0x1;_0x26b512[_0x456a('0x99')]+=0x1;_0x26b512[_0x456a('0x9a')]=ut[_0x456a('0x9b')](_0x26b512);ut[_0x456a('0x88')](_0x26b512,0x0,_0x456a('0x9c'));ami[_0x456a('0x57')](_0x456a('0x9d'),ut[_0x456a('0x9e')](_0x26b512,'nosuchnumber'));rpcDb[_0x456a('0x8c')](_0x26b512,_0x456a('0x9f'));if(ut[_0x456a('0x9b')](_0x26b512)>=_0x4f15bd['dialGlobalMaxRetry']){_0x3be164=ut[_0x456a('0xa0')](_0x26b512,0xf,'Global');rpcDb[_0x456a('0xa1')](_0x3be164,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x26b512[_0x456a('0x99')]>=_0x4f15bd[_0x456a('0xa2')]){rpcDb[_0x456a('0xa1')](_0x26b512,_0x456a('0xa3'));}else{rpcDb[_0x456a('0xa4')](ut[_0x456a('0xa5')](_0x26b512,_0x456a('0x99'),_0x4f15bd[_0x456a('0xa6')]),_0x26b512['unlockAgent'],_0x26b512[_0x456a('0xa7')]);}}delete this[_0x456a('0x68')][_0x14e6ff[_0x456a('0xa8')]];break;case _0x456a('0xa9'):var _0x235275=moment()[_0x456a('0x52')](_0x456a('0xaa'));_0x26b512[_0x456a('0xab')]=_0x235275;_0x26b512[_0x456a('0xac')]=_0x235275;_0x26b512[_0x456a('0x6b')]=!![];_0x4f15bd[_0x456a('0x28')]+=0x1;logger[_0x456a('0x55')]('[syncHangup][talking][increment]',_0x26b512[_0x456a('0xad')],_0x456a('0xae'),_0x4f15bd[_0x456a('0x4d')],_0x456a('0x69'),_0x4f15bd[_0x456a('0x28')]);ami[_0x456a('0x57')](_0x456a('0xaf'),ut[_0x456a('0x9e')](_0x26b512,'connect',this[_0x456a('0x11')][_0x26b512[_0x456a('0x6a')]]));if(_0x4f15bd[_0x456a('0xb0')]){ami[_0x456a('0x57')](_0x456a('0xb1'),ut[_0x456a('0xb2')](_0x26b512));}break;case'16':ami[_0x456a('0x57')](_0x456a('0xb3'),ut[_0x456a('0x9e')](_0x26b512,'complete',this[_0x456a('0x11')][_0x26b512['queue']]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x26b512,'complete'));_0x4f15bd[_0x456a('0x34')]+=0x1;_0x4f15bd['total']+=0x1;_0x4f15bd[_0x456a('0xb4')]+=0x1;ut[_0x456a('0x75')](_0x4f15bd,'[16]');_0x26b512[_0x456a('0x9a')]=ut['totalGlobal'](_0x26b512);ut[_0x456a('0x88')](_0x26b512,0x4,_0x456a('0xb5'));rpcDb[_0x456a('0x8c')](_0x26b512,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x456a('0xa1')](_0x26b512,_0x456a('0xb6'));rpcDb[_0x456a('0xb7')](_0x26b512);_0x4f15bd[_0x456a('0x2a')]+=_0x26b512[_0x456a('0xb8')];_0x4f15bd[_0x456a('0x29')]+=_0x26b512[_0x456a('0xb8')];logger[_0x456a('0x55')](_0x456a('0xb9'),_0x26b512[_0x456a('0xad')],_0x456a('0xae'),_0x4f15bd[_0x456a('0x4d')],'pTalking:\x20',_0x4f15bd['pTalking']);delete this[_0x456a('0x68')][_0x14e6ff[_0x456a('0xa8')]];break;case _0x456a('0xba'):_0x4f15bd['outboundBusyCallsDay']+=0x1;_0x26b512[_0x456a('0xbb')]+=0x1;_0x26b512['countglobal']=ut['totalGlobal'](_0x26b512);ut[_0x456a('0x88')](_0x26b512,0x5,_0x456a('0xbc'));ami[_0x456a('0x57')]('custom:agentbusy',ut['buildObj'](_0x26b512,_0x456a('0xbd')));rpcDb[_0x456a('0x8c')](_0x26b512,_0x456a('0xbe'));if(ut[_0x456a('0x9b')](_0x26b512)>=_0x4f15bd[_0x456a('0xbf')]){_0x3be164=ut['cloneAction'](_0x26b512,0xf,'Global');rpcDb[_0x456a('0xa1')](_0x3be164,_0x456a('0xc0'));}else{if(_0x26b512['countbusyretry']>=_0x4f15bd[_0x456a('0xc1')]){rpcDb[_0x456a('0xa1')](_0x26b512,_0x456a('0xbe'));}else{rpcDb['rescheduleContact'](ut[_0x456a('0xa5')](_0x26b512,'countbusyretry',_0x4f15bd[_0x456a('0xc2')]),_0x26b512[_0x456a('0xc3')],_0x26b512[_0x456a('0xa7')]);}}break;case _0x456a('0xc4'):_0x4f15bd[_0x456a('0x38')]+=0x1;_0x26b512[_0x456a('0xc5')]+=0x1;_0x26b512['countglobal']=ut[_0x456a('0x9b')](_0x26b512);ut['logCustomer'](_0x26b512,0x3,_0x456a('0xc6'));ami[_0x456a('0x57')](_0x456a('0xc7'),ut[_0x456a('0x9e')](_0x26b512,'noanswer'));rpcDb['createCustomerHistory'](_0x26b512,_0x456a('0xc8'));if(ut[_0x456a('0x9b')](_0x26b512)>=_0x4f15bd[_0x456a('0xbf')]){_0x3be164=ut[_0x456a('0xa0')](_0x26b512,0xf,_0x456a('0xc9'));rpcDb[_0x456a('0xa1')](_0x3be164,_0x456a('0xca'));}else{if(_0x26b512[_0x456a('0xc5')]>=_0x4f15bd['dialNoAnswerMaxRetry']){rpcDb[_0x456a('0xa1')](_0x26b512,_0x456a('0xc8'));}else{rpcDb[_0x456a('0xa4')](ut[_0x456a('0xa5')](_0x26b512,_0x456a('0xc5'),_0x4f15bd[_0x456a('0xcb')]),_0x26b512[_0x456a('0xc3')],_0x26b512['activeContact']);}}break;case _0x456a('0xcc'):_0x4f15bd[_0x456a('0x37')]+=0x1;_0x26b512[_0x456a('0xcd')]+=0x1;_0x26b512[_0x456a('0x9a')]=ut[_0x456a('0x9b')](_0x26b512);ut['logCustomer'](_0x26b512,0x8,'Congestion');ami[_0x456a('0x57')](_0x456a('0xce'),ut[_0x456a('0x9e')](_0x26b512,_0x456a('0xcf')));rpcDb['createCustomerHistory'](_0x26b512,_0x456a('0xd0'));if(ut[_0x456a('0x9b')](_0x26b512)>=_0x4f15bd['dialGlobalMaxRetry']){_0x3be164=ut['cloneAction'](_0x26b512,0xf,_0x456a('0xc9'));rpcDb[_0x456a('0xa1')](_0x3be164,_0x456a('0xd1'));}else{if(_0x26b512[_0x456a('0xcd')]>=_0x4f15bd['dialCongestionMaxRetry']){rpcDb[_0x456a('0xa1')](_0x26b512,_0x456a('0xd0'));}else{rpcDb[_0x456a('0xa4')](ut[_0x456a('0xa5')](_0x26b512,'countcongestionretry',_0x4f15bd[_0x456a('0xc2')]),_0x26b512[_0x456a('0xc3')],_0x26b512[_0x456a('0xa7')]);}}break;case _0x456a('0xd2'):_0x4f15bd['outboundRejectCallsDay']+=0x1;_0x26b512[_0x456a('0xd3')]+=0x1;_0x26b512[_0x456a('0x9a')]=ut[_0x456a('0x9b')](_0x26b512);ut[_0x456a('0x88')](_0x26b512,0x14,_0x456a('0xd4'));ami['emit'](_0x456a('0xd5'),ut['buildObj'](_0x26b512,_0x456a('0xd6')));rpcDb[_0x456a('0x8c')](_0x26b512,_0x456a('0xd7'));if(ut['totalGlobal'](_0x26b512)>=_0x4f15bd[_0x456a('0xbf')]){_0x3be164=ut[_0x456a('0xa0')](_0x26b512,0x14,'AgentReject');rpcDb[_0x456a('0xa1')](_0x3be164,_0x456a('0xd8'));}else{if(_0x26b512['countagentrejectretry']>=_0x4f15bd[_0x456a('0xd9')]){rpcDb['createCustomerFinal'](_0x26b512,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb['rescheduleContact'](ut[_0x456a('0xa5')](_0x26b512,_0x456a('0xd3'),_0x4f15bd[_0x456a('0xda')]),_0x26b512['unlockAgent'],_0x26b512[_0x456a('0xa7')]);}}break;case'ABANDONED':_0x4f15bd[_0x456a('0x3d')]+=0x1;_0x26b512[_0x456a('0xdb')]+=0x1;_0x26b512[_0x456a('0x9a')]=ut['totalGlobal'](_0x26b512);ut[_0x456a('0x88')](_0x26b512,0xb,_0x456a('0xdc'));rpcDb[_0x456a('0x8c')](_0x26b512,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x456a('0x9b')](_0x26b512)>=_0x4f15bd[_0x456a('0xbf')]){_0x3be164=ut[_0x456a('0xa0')](_0x26b512,0xf,_0x456a('0xc9'));rpcDb[_0x456a('0xa1')](_0x3be164,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x26b512[_0x456a('0xdd')]>=_0x4f15bd[_0x456a('0xde')]){rpcDb['createCustomerFinal'](_0x26b512,_0x456a('0xdf'));}else{rpcDb[_0x456a('0xa4')](ut[_0x456a('0xa5')](_0x26b512,_0x456a('0xdb'),_0x4f15bd[_0x456a('0xe0')]),_0x26b512[_0x456a('0xc3')],_0x26b512[_0x456a('0xa7')]);}}break;case'18':_0x4f15bd[_0x456a('0x3c')]+=0x1;_0x26b512[_0x456a('0xe1')]+=0x1;_0x26b512['countglobal']=ut[_0x456a('0x9b')](_0x26b512);ut[_0x456a('0x88')](_0x26b512,0x12,_0x14e6ff[_0x456a('0xe2')]||_0x14e6ff[_0x456a('0xe3')]);ami[_0x456a('0x57')](_0x456a('0xe4'),ut[_0x456a('0x9e')](_0x26b512,_0x456a('0xe5')));rpcDb[_0x456a('0x8c')](_0x26b512,_0x456a('0xe6'));if(ut[_0x456a('0x9b')](_0x26b512)>=_0x4f15bd[_0x456a('0xbf')]){_0x3be164=ut[_0x456a('0xa0')](_0x26b512,0xf,_0x456a('0xc9'));rpcDb[_0x456a('0xa1')](_0x3be164,_0x456a('0xe6'));}else{rpcDb['createCustomerFinal'](_0x26b512,_0x456a('0xe6'));}delete this[_0x456a('0x68')][_0x14e6ff[_0x456a('0xa8')]];break;case'19':_0x4f15bd['outboundUnknownCallsDay']+=0x1;_0x26b512[_0x456a('0x9a')]=ut[_0x456a('0x9b')](_0x26b512);ut[_0x456a('0x88')](_0x26b512,0x13,_0x14e6ff[_0x456a('0xe2')]||_0x14e6ff[_0x456a('0xe3')]);ami[_0x456a('0x57')]('custom:amd',ut[_0x456a('0x9e')](_0x26b512,_0x456a('0xe5')));rpcDb[_0x456a('0x8c')](_0x26b512,_0x456a('0xe7'));if(ut[_0x456a('0x9b')](_0x26b512)>=_0x4f15bd['dialGlobalMaxRetry']){_0x3be164=ut[_0x456a('0xa0')](_0x26b512,0xf,_0x456a('0xc9'));rpcDb[_0x456a('0xa1')](_0x3be164,'[callProgressDetectingCustomer][machine]');}else{rpcDb['createCustomerFinal'](_0x26b512,_0x456a('0xe7'));}delete this[_0x456a('0x68')][_0x14e6ff[_0x456a('0xa8')]];break;default:if(_0x26b512[_0x456a('0x6b')]){ut[_0x456a('0x75')](_0x4f15bd,_0x456a('0xe8'));ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x4f15bd[_0x456a('0x4d')],_0x14e6ff);}_0x4f15bd['outboundUnknownCallsDay']+=0x1;_0x26b512[_0x456a('0x9a')]=ut[_0x456a('0x9b')](_0x26b512);ut[_0x456a('0x88')](_0x26b512,0xc,_0x14e6ff['cause-txt']||_0x14e6ff[_0x456a('0xe3')]);rpcDb[_0x456a('0x8c')](_0x26b512,_0x456a('0xe9'));if(ut['totalGlobal'](_0x26b512)>=_0x4f15bd[_0x456a('0xbf')]){_0x3be164=ut['cloneAction'](_0x26b512,0xf,_0x456a('0xc9'));rpcDb[_0x456a('0xa1')](_0x3be164,_0x456a('0xea'));}else{rpcDb[_0x456a('0xa1')](_0x26b512,_0x456a('0xea'));}delete this['actions'][_0x14e6ff['linkedid']];}if(!(_0x26b512['dialAnswer']&&_0x5293d3==='16')){ut['updateOriginated'](_0x4f15bd,_0x456a('0xeb'));logger[_0x456a('0x55')]('[originated][decrement][callProgressDetectingCustomer]',_0x26b512[_0x456a('0xad')],_0x456a('0xae'),_0x4f15bd[_0x456a('0x4d')],'originated:\x20',_0x4f15bd[_0x456a('0x48')]);}if(_0x5293d3!==_0x456a('0xa9')){delete this['actions'][_0x14e6ff['linkedid']];delete this[_0x456a('0x68')][_0x14e6ff[_0x456a('0xec')]];}}};Preview[_0x456a('0xc')][_0x456a('0xed')]=function(_0x4605ff,_0xe78f46,_0x1ed52e){if(_[_0x456a('0xee')](_0xe78f46)&&_0x456a('0xef')!==typeof _0xe78f46){return;}if(_[_0x456a('0xee')](_0x1ed52e)&&_0x456a('0xef')!==typeof _0x1ed52e){return;}switch(_0x1ed52e[_0x456a('0xf0')]){case'0':ut[_0x456a('0xf1')](_0x4605ff,0x0,_0x456a('0x9c'));rpcDb[_0x456a('0xf2')](_0x4605ff,_0x456a('0xf3'));break;case'3':ut[_0x456a('0xf1')](_0x4605ff,0x3,_0x456a('0xc6'));rpcDb[_0x456a('0xf2')](_0x4605ff,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x456a('0xf1')](_0x4605ff,0x5,_0x456a('0xbc'));rpcDb[_0x456a('0xf2')](_0x4605ff,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x456a('0xf1')](_0x4605ff,0x8,_0x456a('0xf4'));rpcDb[_0x456a('0xf2')](_0x4605ff,_0x456a('0xf5'));break;case'22':ut[_0x456a('0xf1')](_0x4605ff,0x16,'AnswerAGI');rpcDb[_0x456a('0xf2')](_0x4605ff,_0x456a('0xf6'));break;default:ut[_0x456a('0xf1')](_0x4605ff,0xc,_0x1ed52e[_0x456a('0xf0')]);rpcDb[_0x456a('0xf2')](_0x4605ff,_0x456a('0xf5'));}ut[_0x456a('0x74')](_0xe78f46,'[callProgressDetectingAgent]');logger[_0x456a('0x55')]('[originated][decrement][callProgressDetectingAgent]',_0x4605ff[_0x456a('0xad')],'\x20Queue',_0xe78f46['name'],_0x456a('0xf7'),_0xe78f46['originated']);delete this['actions'][_0x4605ff[_0x456a('0xad')]];};Preview['prototype']['checkInBlack']=function(_0x6cbeb8,_0xd8c295,_0x1d81ba,_0x3bcc6a,_0x709b0){var _0x123b60=this;return new BPromise(function(_0xd1a656,_0xf30f8e){if(_[_0x456a('0x66')](_0xd8c295)||_[_0x456a('0x66')](_0xd8c295[_0x456a('0xf8')])||_[_0x456a('0x66')](_0xd8c295[_0x456a('0xf8')][_0x456a('0xf9')])||_[_0x456a('0x66')](_0xd8c295[_0x456a('0x6f')])){_0xf30f8e(ut[_0x456a('0x47')]('Contact\x20is\x20undefined',_0x3bcc6a,_0x709b0));return;}var _0x40f3bf=uuid['v4']();var _0x968d1a=_0x123b60[_0x456a('0x11')][_0xd8c295[_0x456a('0x67')][_0x456a('0x4d')]];var _0x58b64c=_0x1d81ba?_0x123b60[_0x456a('0x14')][_0x1d81ba]['id']:undefined;_0x123b60['actions'][_0x40f3bf]=new Action(_0xd8c295,_0x968d1a,_0x40f3bf,_0x1d81ba,_0x58b64c);var _0xb45882=_0x123b60[_0x456a('0x68')][_0x40f3bf];_0xb45882[_0x456a('0xc3')]=_0x3bcc6a;_0xb45882[_0x456a('0xa7')]=_0x709b0;_0xb45882[_0x456a('0xfa')]=_0x1d81ba;if(_['isEmpty'](_0x6cbeb8)){_0x123b60['execCall'](_0xb45882,_0x968d1a,_0xd8c295,_0x1d81ba)[_0x456a('0x82')](function(_0x2a0d7d){logger[_0x456a('0x55')](_0x456a('0xfb'),_0x456a('0xfc')+_0xb45882[_0x456a('0x6a')]+'\x20IdHopper:\x20'+_0xb45882[_0x456a('0xfd')],JSON[_0x456a('0x50')](_0x2a0d7d));ami['emit'](_0x456a('0xfe'),ut[_0x456a('0x9e')](_0xb45882,_0x456a('0xff'),_0x123b60[_0x456a('0x11')][_0xb45882['queue']]));_0xd1a656(ut[_0x456a('0x47')](_0x456a('0x100')));})[_0x456a('0x85')](function(_0x12e00b){ut[_0x456a('0x5b')](_0x456a('0x101'),_0x12e00b);_0xf30f8e(ut[_0x456a('0x47')]('Call\x20failed',_0x3bcc6a,_0x709b0));});}else{_0x968d1a['outboundBlacklistCallsDay']+=0x1;ut[_0x456a('0x102')](_0xb45882);rpcDb[_0x456a('0x103')](_0xb45882,_0x456a('0x104'));delete _0x123b60['actions'][_0x40f3bf];_0xf30f8e(ut['message']('Contact\x20in\x20black\x20List',_0x3bcc6a,_0x709b0));}});};Preview[_0x456a('0xc')][_0x456a('0x95')]=function(_0x16bf44){return!_[_0x456a('0x66')](_0x16bf44)&&!_[_0x456a('0x66')](_0x16bf44[_0x456a('0x4d')])&&!_['isNil'](_0x16bf44[_0x456a('0x4e')])&&_0x16bf44[_0x456a('0x4e')]&&!_[_0x456a('0x66')](this[_0x456a('0x13')][util[_0x456a('0x52')]('SIP/%s',_0x16bf44[_0x456a('0x4d')])])&&!_[_0x456a('0x66')](this['trunks'][util[_0x456a('0x52')]('SIP/%s',_0x16bf44[_0x456a('0x4d')])][_0x456a('0x72')])&&(this[_0x456a('0x13')][util[_0x456a('0x52')](_0x456a('0x105'),_0x16bf44[_0x456a('0x4d')])][_0x456a('0x72')]===_0x456a('0x106')||this[_0x456a('0x13')][util['format'](_0x456a('0x105'),_0x16bf44[_0x456a('0x4d')])][_0x456a('0x72')]==='unmonitored');};Preview[_0x456a('0xc')][_0x456a('0x81')]=function(_0x59a2c0,_0xc757b7){var _0x5730bc=this;return new BPromise(function(_0x41f824,_0x4584d5){_0x5730bc[_0x456a('0x107')](_0x59a2c0,_0xc757b7)['then'](function(_0x2a1c1a){_0x41f824(_[_0x456a('0x6c')](_0x2a1c1a,['message']));})[_0x456a('0x85')](function(_0x4e6811){if(_0x4e6811['unlock']){rpcDb[_0x456a('0x108')](_0x59a2c0);}if(_0x4e6811[_0x456a('0x4e')]){rpcDb['disableContact'](_0x59a2c0);}_0x4584d5(_[_0x456a('0x6c')](_0x4e6811,[_0x456a('0x47')]));});});};Preview[_0x456a('0xc')][_0x456a('0x107')]=function(_0x523c2c,_0x352ea9){var _0x14c403=this;return new BPromise(function(_0x319254,_0x1993fc){var _0x4385c7,_0x9a5312;rpcDb['getContactPreview'](_0x523c2c)[_0x456a('0x82')](function(_0x474a08){if(!_[_0x456a('0x66')](_0x474a08[0x0])){_0x9a5312=_0x474a08[0x0][_0x456a('0x109')]?![]:!![];_0x4385c7=_0x474a08[0x0][_0x456a('0x109')]?!![]:![];_0x4385c7=_0x352ea9?!![]:_0x4385c7;}var _0x5965d4=_0x14c403[_0x456a('0x10a')](_0x474a08);if(_0x5965d4[_0x456a('0x10b')]){rpcDb[_0x456a('0x10c')](_[_0x456a('0x6c')](_0x474a08[0x0],['VoiceQueueId',_0x456a('0x10d')]))[_0x456a('0x82')](function(_0x1e7543){_0x14c403['checkInBlack'](_0x1e7543,_0x474a08[0x0],_0x352ea9,_0x9a5312,_0x4385c7)[_0x456a('0x82')](function(_0x52ba0f){_0x319254(_0x52ba0f);})[_0x456a('0x85')](function(_0x18ee2c){_0x1993fc(_0x18ee2c);});})[_0x456a('0x85')](function(_0x4b79fc){ut['logger'](_0x456a('0x10e'),_0x4b79fc);_0x1993fc(ut[_0x456a('0x47')](_0x456a('0x10f'),_0x9a5312,_0x4385c7));});}else{_0x1993fc(ut['message'](_0x5965d4[_0x456a('0x47')],_0x9a5312,_0x4385c7));}})['catch'](function(_0x47b933){ut[_0x456a('0x5b')]('[Preview][getContactPreview]',_0x47b933);_0x1993fc(ut['message'](_0x456a('0x10f'),![],!![]));});});};Preview['prototype'][_0x456a('0x10a')]=function(_0x5d5e4a){if(_[_0x456a('0x66')](_0x5d5e4a)||_[_0x456a('0x110')](_0x5d5e4a)||!_[_0x456a('0x66')](_0x5d5e4a[0x0][_0x456a('0x7f')])&&_['isNil'](_0x5d5e4a[0x0][_0x456a('0x7f')][_0x456a('0x4d')])){ut[_0x456a('0x5b')](_0x456a('0x111'),_0x5d5e4a);return{'isValid':![],'message':_0x456a('0x112')};}var _0xa4918a=this['campaignsPreview'][_0x5d5e4a[0x0][_0x456a('0x67')][_0x456a('0x4d')]];_0xa4918a[_0x456a('0x47')]='ACTIVE';if(_['isNil'](_0xa4918a)){ut['logger'](_0x456a('0x113'),_0xa4918a);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0x456a('0x95')](_0xa4918a[_0x456a('0x4c')])){ut[_0x456a('0x5b')](_0x456a('0x114'),'campaign\x20Name:\x20'+_0xa4918a[_0x456a('0x4d')]+_0x456a('0x115'));if(!this['isTrunkReachable'](_0xa4918a[_0x456a('0x96')])){ut[_0x456a('0x5b')]('[Preview][validateContact][Trunk\x20not\x20work]',_0xa4918a['name']+_0x456a('0x116'));return{'isValid':![],'message':_0x456a('0x117')};}}if(!ut[_0x456a('0x93')](_0xa4918a[_0x456a('0x62')])){ut[_0x456a('0x5b')](_0x456a('0x118'),_0xa4918a[_0x456a('0x4d')]+'\x20Not\x20Active');return{'isValid':![],'message':'campaign\x20Name:\x20'+_0xa4918a[_0x456a('0x4d')]+_0x456a('0x119')};}return{'isValid':!![],'message':_0x456a('0x11a')};};Preview[_0x456a('0xc')][_0x456a('0x11b')]=function(_0xdbe059,_0x26b16c,_0xa5e697,_0x4b5d50){var _0x398552=this;return new BPromise(function(_0x5bb2be,_0x589af3){var _0x2bb55a=_0xdbe059[_0x456a('0xad')];var _0x653592=_0x398552[_0x456a('0x95')](_0x26b16c[_0x456a('0x4c')])?util[_0x456a('0x52')](_0x456a('0x11c'),_0x26b16c[_0x456a('0x4c')][_0x456a('0x4d')],_[_0x456a('0x66')](_0x26b16c['dialPrefix'])?'':_0x26b16c['dialPrefix'][_0x456a('0x11d')]()||'',_0x26b16c['dialCutDigit']>0x0?_0xa5e697[_0x456a('0xf8')][_0x456a('0xf9')][_0x456a('0x11e')](_0x26b16c[_0x456a('0x11f')]):_0xa5e697['Contact'][_0x456a('0xf9')]):util[_0x456a('0x52')]('SIP/%s/%s%s',_['isNil'](_0x26b16c[_0x456a('0x96')])?_0x26b16c[_0x456a('0x4c')][_0x456a('0x4d')]:_0x26b16c[_0x456a('0x96')][_0x456a('0x4d')],_[_0x456a('0x66')](_0x26b16c['dialPrefix'])?'':_0x26b16c[_0x456a('0x32')][_0x456a('0x11d')]()||'',_0x26b16c[_0x456a('0x11f')]>0x0?_0xa5e697[_0x456a('0xf8')][_0x456a('0xf9')][_0x456a('0x11e')](_0x26b16c['dialCutDigit']):_0xa5e697['Contact'][_0x456a('0xf9')]);var _0x2cce4a=_0x398552['isTrunkReachable'](_0x26b16c['Trunk'])?ut['getCallerId'](_0x26b16c[_0x456a('0x4c')][_0x456a('0x120')],_0x26b16c[_0x456a('0x121')],_0x26b16c[_0x456a('0x122')]>0x0?ut[_0x456a('0x123')](_0x26b16c[_0x456a('0x30')],_0x26b16c['dialRandomLastDigitCallerIdNumber']):_0x26b16c[_0x456a('0x30')]):ut[_0x456a('0x124')](_[_0x456a('0x66')](_0x26b16c['TrunkBackup'])?_0x26b16c['Trunk'][_0x456a('0x120')]:_0x26b16c[_0x456a('0x96')][_0x456a('0x120')],_0x26b16c[_0x456a('0x121')],_0x26b16c[_0x456a('0x122')]>0x0?ut[_0x456a('0x123')](_0x26b16c[_0x456a('0x30')],_0x26b16c[_0x456a('0x122')]):_0x26b16c[_0x456a('0x30')]);if(_0x2cce4a){_0xdbe059[_0x456a('0x125')]=ut[_0x456a('0x126')](_0x2cce4a);_0xdbe059[_0x456a('0x127')]=ut[_0x456a('0x128')](_0x2cce4a);}var _0x3b2eae=ut[_0x456a('0x129')](_0x26b16c,_0xa5e697,_0x653592,_0x2cce4a,_0x2bb55a,_0xdbe059);_[_0x456a('0x12a')](_0xdbe059,ut[_0x456a('0x12b')](_0x3b2eae));_0xdbe059['starttime']=moment()['format'](_0x456a('0xaa'));ami[_0x456a('0x71')](ut['variablesAction'](_0xdbe059,_0x26b16c,_0x3b2eae,_0xdbe059[_0x456a('0xa7')],_0x4b5d50))['then'](function(_0x1fdba6){_0x26b16c['originated']+=0x1;logger[_0x456a('0x55')](_0x456a('0x12c'),_0x2bb55a,'\x20Queue',_0x26b16c['name'],_0x456a('0xf7'),_0x26b16c[_0x456a('0x48')]);_0x5bb2be(_0x1fdba6);})[_0x456a('0x85')](function(_0x4a083a){ut[_0x456a('0xf1')](_0xdbe059,0xe,'OriginateError');rpcDb[_0x456a('0xf2')](_0xdbe059,_0x456a('0x12d'));_0x589af3(_0x4a083a);});});};Preview['prototype'][_0x456a('0x1f')]=function(_0x207e02){if(this[_0x456a('0x68')][_0x207e02[_0x456a('0xa8')]]){this[_0x456a('0x68')][_0x207e02[_0x456a('0xa8')]]['channel']=_0x207e02[_0x456a('0x73')];}};Preview['prototype']['syncOriginateResponse']=function(_0x19f2f1){var _0x264d11=this;var _0x1f3209=this[_0x456a('0x68')][_0x19f2f1[_0x456a('0x12e')]];if(_0x1f3209){if(_0x1f3209[_0x456a('0xfa')]&&this['agents'][_0x1f3209['lookAgent']]){ut['logLookAgent'](_0x1f3209,this[_0x456a('0x14')][_0x1f3209[_0x456a('0xfa')]][_0x456a('0x4d')],this[_0x456a('0x14')][_0x1f3209[_0x456a('0xfa')]]['id']);}var _0x306129=_['clone'](_0x1f3209);_0x306129[_0x456a('0xab')]=moment()['format'](_0x456a('0xaa'));var _0x18beb4=_0x264d11[_0x456a('0x11')][_0x1f3209[_0x456a('0x6a')]];if(ut[_0x456a('0x12f')](_0x19f2f1[_0x456a('0x130')])){if(_0x1f3209[_0x456a('0xc3')]){rpcDb['unlockContact'](_0x1f3209[_0x456a('0xfd')]);}if(_0x1f3209[_0x456a('0xa7')]){rpcDb[_0x456a('0x86')](_0x1f3209[_0x456a('0xfd')]);}ami[_0x456a('0x57')](_0x456a('0x131'),ut[_0x456a('0x9e')](_0x1f3209,'rejected',this['campaignsPreview'][_0x1f3209[_0x456a('0x6a')]]));this['callProgressDetectingAgent'](_0x306129,_0x18beb4,_0x19f2f1);}else{_0x1f3209[_0x456a('0x87')]=moment()[_0x456a('0x52')](_0x456a('0xaa'));ut[_0x456a('0xf1')](_0x306129,0x4,_0x456a('0xb5'));rpcDb[_0x456a('0xf2')](_0x306129,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x456a('0xc')][_0x456a('0x19')]=function(_0x1edd25){var _0x14d894=this;var _0x5a97c1=this[_0x456a('0x68')][_0x1edd25[_0x456a('0xa8')]];var _0x11aa1c;if(_0x5a97c1){_0x11aa1c=this[_0x456a('0x11')][_0x5a97c1['queue']];logger[_0x456a('0x55')]('[syncHangup][talking]',_0x1edd25['linkedid'],_0x456a('0xae'),_0x11aa1c[_0x456a('0x4d')],_0x456a('0x69'),_0x11aa1c[_0x456a('0x28')]);}if(this[_0x456a('0x68')][_0x1edd25[_0x456a('0xa8')]]&&_0x1edd25[_0x456a('0xa8')]!==_0x1edd25[_0x456a('0xad')]){if(_0x1edd25[_0x456a('0x132')]==='16'&&this[_0x456a('0x68')][_0x1edd25['linkedid']][_0x456a('0x6b')]){this[_0x456a('0x133')](_0x1edd25,_0x1edd25[_0x456a('0xa8')],_0x1edd25[_0x456a('0x132')]);}else if(this['actions'][_0x1edd25[_0x456a('0xa8')]][_0x456a('0x6b')]){logger[_0x456a('0x55')]('[syncHangup][talking][cause]',_0x1edd25[_0x456a('0xa8')],_0x1edd25[_0x456a('0x132')],_0x456a('0xae'),_0x11aa1c[_0x456a('0x4d')],_0x456a('0x69'),_0x11aa1c[_0x456a('0x28')]);this[_0x456a('0x133')](_0x1edd25,_0x1edd25['linkedid'],_0x1edd25[_0x456a('0x132')]);}}else if(_0x5a97c1&&_[_0x456a('0x66')](_0x5a97c1['statedesc'])&&_0x11aa1c[_0x456a('0x134')]&&_0x1edd25[_0x456a('0xa8')]===_0x1edd25[_0x456a('0xad')]&&_['isNil'](_0x1edd25[_0x456a('0xf0')])&&_0x1edd25[_0x456a('0x132')]==='16'&&_0x1edd25[_0x456a('0x135')]==='6'&&_[_0x456a('0xee')](_0x5a97c1[_0x456a('0x136')])){if(_0x5a97c1[_0x456a('0xc3')]){rpcDb[_0x456a('0x108')](_0x5a97c1['idContact']);}if(_0x5a97c1['activeContact']){rpcDb[_0x456a('0x86')](_0x5a97c1['idContact']);}_0x1edd25[_0x456a('0xf0')]='22';this[_0x456a('0xed')](_0x5a97c1,_0x11aa1c,_0x1edd25);}else if(_0x5a97c1&&_0x5a97c1['transfer']){if(_0x1edd25[_0x456a('0x132')]==='16'&&this['actions'][_0x1edd25['linkedid']]['dialAnswer']){logger[_0x456a('0x55')](_0x456a('0x137'),_0x1edd25[_0x456a('0xa8')],_0x1edd25[_0x456a('0x132')],_0x456a('0xae'),_0x11aa1c[_0x456a('0x4d')],'pTalking:\x20',_0x11aa1c[_0x456a('0x28')]);this['callProgressDetectingCustomer'](_0x1edd25,_0x1edd25['linkedid'],_0x1edd25[_0x456a('0x132')]);}else if(this[_0x456a('0x68')][_0x1edd25['linkedid']][_0x456a('0x6b')]){logger[_0x456a('0x55')](_0x456a('0x138'),_0x1edd25[_0x456a('0xa8')],_0x1edd25[_0x456a('0x132')],'\x20Queue',_0x11aa1c[_0x456a('0x4d')],_0x456a('0x69'),_0x11aa1c['pTalking']);this[_0x456a('0x133')](_0x1edd25,_0x1edd25[_0x456a('0xa8')],_0x1edd25['cause']);}}};Preview['prototype'][_0x456a('0x1d')]=function(_0x19fa79){if(this[_0x456a('0x68')][_0x19fa79[_0x456a('0xec')]]&&_0x19fa79[_0x456a('0xec')]!==_0x19fa79['destuniqueid']){this['callProgressDetectingCustomer'](_0x19fa79,_0x19fa79[_0x456a('0xec')],_0x19fa79[_0x456a('0xe3')]);}};Preview[_0x456a('0xc')][_0x456a('0x1c')]=function(_0x5949e0){if(this[_0x456a('0x68')][_0x5949e0[_0x456a('0xa8')]]&&_0x5949e0[_0x456a('0xa8')]!==_0x5949e0['uniqueid']&&!this['actions'][_0x5949e0[_0x456a('0xa8')]][_0x456a('0x6b')]){if(_0x5949e0['cause']==='1'){this[_0x456a('0x133')](_0x5949e0,_0x5949e0[_0x456a('0xa8')],_0x5949e0[_0x456a('0x132')]);}}};Preview['prototype']['addVariable']=function(_0x55eedf,_0x49dba5,_0x1f12c0){if(this[_0x456a('0x68')][_0x55eedf]){if(_[_0x456a('0x66')](this[_0x456a('0x68')][_0x55eedf]['variables'])){this[_0x456a('0x68')][_0x55eedf][_0x456a('0x139')]={};}this[_0x456a('0x68')][_0x55eedf][_0x456a('0x139')][_0x49dba5]=_0x1f12c0;}};Preview[_0x456a('0xc')][_0x456a('0x21')]=function(_0x3ee851){try{if(!_[_0x456a('0x66')](_0x3ee851)){if(ut[_0x456a('0x13a')](_['keys'](_0x3ee851[_0x456a('0x13b')])[0x0])){this[_0x456a('0x13c')](_0x3ee851[_0x456a('0xad')],_['keys'](_0x3ee851[_0x456a('0x13b')])[0x0],_0x3ee851[_0x456a('0x13d')]);}}}catch(_0x3f7218){logger[_0x456a('0x13e')](_0x456a('0x13f'),util[_0x456a('0x140')](_0x3f7218,{'showHidden':![],'depth':null}));}};Preview[_0x456a('0xc')][_0x456a('0x22')]=function(_0x568e6c){if(_0x568e6c){if(this['actions'][_0x568e6c[_0x456a('0x141')]]){this[_0x456a('0x68')][_0x568e6c[_0x456a('0x141')]][_0x456a('0x136')]=!![];}}};Preview[_0x456a('0xc')]['syncBlindTransfer']=function(_0x3de0d1){if(_0x3de0d1){if(this[_0x456a('0x68')][_0x3de0d1[_0x456a('0x142')]]){this[_0x456a('0x68')][_0x3de0d1[_0x456a('0x142')]][_0x456a('0x136')]=!![];}}};module[_0x456a('0x143')]=Preview; \ No newline at end of file +var _0x6737=['Action','status','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','IsNotLoggedIn','isActive','isTrunkReachable','TrunkBackup','ACTIVE','countnosuchnumberretry','countglobal','totalGlobal','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','createCustomerFinal','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','linkedid','ANSWER','responsetime','answertime','dialAnswer','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','talktime','BUSY','outboundBusyCallsDay','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','dialBusyRetryFrequency','activeContact','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','Global','[callProgressDetectingCustomer][logNoAnswerGlobal]','CONGESTION','outboundCongestionCallsDay','countcongestionretry','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','CANCEL','outboundRejectCallsDay','countagentrejectretry','custom:agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','outboundUnknownCallsDay','countmachineretry','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','callProgressDetectingAgent','object','isUndefined','reason','logAgent','createAgentHistory','Busy','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','VoiceQueueId','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','run','unlock','unlockContact','disableContact','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialCutDigit','substring','trim','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','syncNewExten','channel','syncOriginateResponse','actionid','logLookAgent','response','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','destlinkedid','addVariable','variables','syncVarSet','keys','variable','[syncVarSet][Preview]','inspect','transfertargetlinkedid','exports','lodash','bluebird','moment','md5','ioredis','../../../config/environment','preview','../../../config/logger','../ami','./rpcDb','redis','socket.io-emitter','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','newexten','varset','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','emit','name','strategy','answered','available','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','Interval','stringify','format','voice_queue:save','info','voice_queue_channel:remove','sendMessageOneNotActive','NOT_ACTIVE','logger','\x20is\x20not\x20active','IS_DISACTIVED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','loopCampaigns','syncCampaigns','prototype','hasOwnProperty','dialMethod','outbound','clearZombieChannels','type','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','pick','contactId','UserId','ListId'];(function(_0x2c072b,_0x6c4449){var _0x167ee3=function(_0x33ef93){while(--_0x33ef93){_0x2c072b['push'](_0x2c072b['shift']());}};_0x167ee3(++_0x6c4449);}(_0x6737,0xe2));var _0x7673=function(_0x1c657b,_0x280eef){_0x1c657b=_0x1c657b-0x0;var _0x38261e=_0x6737[_0x1c657b];return _0x38261e;};'use strict';var util=require('util');var _=require(_0x7673('0x0'));var BPromise=require(_0x7673('0x1'));var uuid=require('uuid');var moment=require(_0x7673('0x2'));var md5=require(_0x7673('0x3'));var Redis=require(_0x7673('0x4'));var config=require(_0x7673('0x5'));var logger=require('../../../config/logger')(_0x7673('0x6'));var loggerAction=require(_0x7673('0x7'))('actionPreview');var ami=require(_0x7673('0x8'));var rpcDb=require(_0x7673('0x9'));var Action=require('./action');var ut=require('./util/util');config['redis']=_['defaults'](config[_0x7673('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x7673('0xb'))(new Redis(config[_0x7673('0xa')]));var Sequence=function(){};Sequence['prototype'][_0x7673('0xc')]=function(_0x331f57){this[_0x7673('0xd')]=this['tail']?this['tail'][_0x7673('0xe')](_0x331f57):_0x331f57();};function Preview(_0x571b87){this[_0x7673('0xf')]=new Sequence();this[_0x7673('0x10')]=_0x571b87[_0x7673('0x11')];this[_0x7673('0x12')]=_0x571b87[_0x7673('0x12')];this[_0x7673('0x13')]={};this[_0x7673('0x14')]=_0x571b87[_0x7673('0x14')];this[_0x7673('0x15')]=0x0;ami['on'](_0x7673('0x16'),this['syncOriginateResponse'][_0x7673('0x17')](this));ami['on'](_0x7673('0x18'),this[_0x7673('0x19')][_0x7673('0x17')](this));ami['on'](_0x7673('0x1a'),this[_0x7673('0x1b')][_0x7673('0x17')](this));ami['on']('dialend',this['syncDialEnd'][_0x7673('0x17')](this));ami['on'](_0x7673('0x1c'),this['syncNewExten'][_0x7673('0x17')](this));ami['on'](_0x7673('0x1d'),this['syncVarSet'][_0x7673('0x17')](this));ami['on'](_0x7673('0x1e'),this[_0x7673('0x1f')]['bind'](this));ami['on']('blindtransfer',this[_0x7673('0x20')][_0x7673('0x17')](this));this['loopCampaigns'](this[_0x7673('0x10')]);}function emit(_0x29bbd9,_0x2e1260,_0x33eb47){io['to'](_0x29bbd9)[_0x7673('0x21')](_0x2e1260,_0x33eb47);}function emitCampaignPreview(_0x3e28ca){if(_0x3e28ca['type']==='outbound'){var _0xea9b37={'id':_0x3e28ca['id'],'name':_0x3e28ca[_0x7673('0x22')],'strategy':_0x3e28ca[_0x7673('0x23')],'answered':_0x3e28ca[_0x7673('0x24')],'available':_0x3e28ca[_0x7673('0x25')],'loggedIn':_0x3e28ca['loggedIn'],'pTalking':_0x3e28ca[_0x7673('0x26')],'sumBillable':_0x3e28ca[_0x7673('0x27')],'sumDuration':_0x3e28ca[_0x7673('0x28')],'sumHoldTime':_0x3e28ca[_0x7673('0x29')]||0x0,'talking':_0x3e28ca[_0x7673('0x2a')],'total':_0x3e28ca[_0x7673('0x2b')],'type':_0x3e28ca['type'],'unmanaged':_0x3e28ca[_0x7673('0x2c')],'abandoned':_0x3e28ca[_0x7673('0x2d')],'waiting':_0x3e28ca[_0x7673('0x2e')],'loggedInDb':_0x3e28ca[_0x7673('0x2f')],'dialActive':_0x3e28ca['dialActive'],'dialMethod':_0x3e28ca['dialMethod'],'dialOriginateCallerIdName':_0x3e28ca[_0x7673('0x30')],'dialOriginateCallerIdNumber':_0x3e28ca[_0x7673('0x31')],'dialOriginateTimeout':_0x3e28ca[_0x7673('0x32')],'dialPrefix':_0x3e28ca[_0x7673('0x33')],'outboundAnswerAgiCallsDay':_0x3e28ca[_0x7673('0x34')],'outboundAnswerCallsDay':_0x3e28ca[_0x7673('0x35')],'outboundBlacklistCallsDay':_0x3e28ca[_0x7673('0x36')],'outboundBusyCallsDay':_0x3e28ca['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x3e28ca['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x3e28ca[_0x7673('0x37')],'outboundDropCallsDayCallersExit':_0x3e28ca[_0x7673('0x38')],'outboundDropCallsDayTimeout':_0x3e28ca[_0x7673('0x39')],'outboundNoAnswerCallsDay':_0x3e28ca[_0x7673('0x3a')],'outboundNoSuchCallsDay':_0x3e28ca[_0x7673('0x3b')],'outboundOriginateFailureCallsDay':_0x3e28ca[_0x7673('0x3c')],'outboundReCallsDay':_0x3e28ca[_0x7673('0x3d')],'outboundRejectCallsDay':_0x3e28ca['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x3e28ca['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x3e28ca[_0x7673('0x3e')],'predictiveIntervalAnsweredCalls':_0x3e28ca[_0x7673('0x3f')],'predictiveIntervalAvgHoldtime':_0x3e28ca[_0x7673('0x40')],'predictiveIntervalAvgTalktime':_0x3e28ca[_0x7673('0x41')],'predictiveIntervalDroppedCallsCallersExit':_0x3e28ca['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x3e28ca[_0x7673('0x42')],'predictiveIntervalErlangCalls':_0x3e28ca['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x3e28ca[_0x7673('0x43')],'predictiveIntervalHitRate':_0x3e28ca[_0x7673('0x44')],'predictiveIntervalMultiplicativeFactor':_0x3e28ca[_0x7673('0x45')],'predictiveIntervalPauses':_0x3e28ca[_0x7673('0x46')],'predictiveIntervalAvailable':_0x3e28ca[_0x7673('0x47')],'predictiveIntervalTotalCalls':_0x3e28ca[_0x7673('0x48')],'message':_0x3e28ca[_0x7673('0x49')],'originated':_0x3e28ca[_0x7673('0x4a')],'erlangCalls':_0x3e28ca[_0x7673('0x4b')],'erlangCallToSecond':_0x3e28ca[_0x7673('0x4c')],'erlangAbandonmentRate':_0x3e28ca[_0x7673('0x4d')],'erlangBusyFactor':_0x3e28ca[_0x7673('0x4e')],'startPredictive':_0x3e28ca[_0x7673('0x4f')],'startProgressive':_0x3e28ca['startProgressive']};if(_0x3e28ca[_0x7673('0x50')]){_0xea9b37[_0x7673('0x50')]={'id':_0x3e28ca[_0x7673('0x50')]['id'],'name':_0x3e28ca[_0x7673('0x50')][_0x7673('0x22')],'active':_0x3e28ca[_0x7673('0x50')][_0x7673('0x51')],'callerid':_0x3e28ca['Trunk']['callerid']};}if(_0x3e28ca[_0x7673('0x52')]){_0xea9b37[_0x7673('0x52')]={'id':_0x3e28ca[_0x7673('0x52')]['id'],'name':_0x3e28ca[_0x7673('0x52')][_0x7673('0x22')]};}var _0x101e03=md5(JSON[_0x7673('0x53')](_0xea9b37));if(_0x3e28ca['md5']!==_0x101e03){_0x3e28ca[_0x7673('0x3')]=_0x101e03;emit(util[_0x7673('0x54')]('voice:queue:%s',_0xea9b37[_0x7673('0x22')]),_0x7673('0x55'),_0xea9b37);}}}function emitVoiceQueueChannelRemove(_0x287eee){logger[_0x7673('0x56')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x7673('0x53')](_0x287eee));emit(util[_0x7673('0x54')]('voice:queue:%s',_0x287eee[_0x7673('0x22')]),_0x7673('0x57'),_0x287eee);io[_0x7673('0x21')]('voice_queue_presence:remove',_0x287eee);}function notSendMessagesQueue(_0xe50aa5){if(_0xe50aa5[_0x7673('0x58')]){if(_0xe50aa5[_0x7673('0x4a')]===0x0&&_0xe50aa5['pTalking']===0x0){_0xe50aa5['sendMessageOneNotActive']=![];_0xe50aa5[_0x7673('0x25')]=0x0;_0xe50aa5['paused']=0x0;_0xe50aa5['message']=_0x7673('0x59');ut[_0x7673('0x5a')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0xe50aa5[_0x7673('0x22')]+_0x7673('0x5b'));}else{_0xe50aa5[_0x7673('0x49')]=_0x7673('0x5c');ut[_0x7673('0x5a')](_0x7673('0x5d'),_0xe50aa5['name']+_0x7673('0x5e'));}emitCampaignPreview(_0xe50aa5);}}Preview['prototype'][_0x7673('0x5f')]=function(){var _0x52f803=this;setInterval(function(){_0x52f803[_0x7673('0x60')]();},0x7cf);};Preview[_0x7673('0x61')]['syncCampaigns']=function(){var _0x5b2e69=this[_0x7673('0x10')];this['clockClearZombieChannels']+=0x1;for(var _0x23dca4 in _0x5b2e69){if(_0x5b2e69[_0x7673('0x62')](_0x23dca4)&&(_0x5b2e69[_0x23dca4][_0x7673('0x63')]===_0x7673('0x6')||_0x5b2e69[_0x23dca4][_0x7673('0x63')]==='booked')&&_0x5b2e69[_0x23dca4]['type']===_0x7673('0x64')){if(this[_0x7673('0x15')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x7673('0x65')]();}}if(_0x5b2e69[_0x7673('0x62')](_0x23dca4)&&_0x5b2e69[_0x23dca4][_0x7673('0x63')]==='preview'&&_0x5b2e69[_0x23dca4][_0x7673('0x66')]===_0x7673('0x64')){if(_0x5b2e69[_0x23dca4][_0x7673('0x67')]){this[_0x7673('0x68')](_0x5b2e69[_0x23dca4]);if(_0x5b2e69[_0x23dca4][_0x7673('0x69')])this[_0x7673('0x6a')](_0x5b2e69[_0x23dca4]);}else{notSendMessagesQueue(_0x5b2e69[_0x23dca4]);}}}};Preview[_0x7673('0x61')][_0x7673('0x6b')]=function(_0x58e17d){var _0x4ed31d=this;this[_0x7673('0xf')][_0x7673('0xc')](function(){if(!_[_0x7673('0x6c')](_0x4ed31d[_0x7673('0x13')][_0x58e17d])){loggerAction[_0x7673('0x56')](_0x7673('0x6d'),_0x58e17d,_0x7673('0x6e'),_0x4ed31d['actions'][_0x58e17d][_0x7673('0x6f')],_0x7673('0x70'),JSON[_0x7673('0x53')](_0x4ed31d[_0x7673('0x10')][_0x4ed31d[_0x7673('0x13')][_0x58e17d]['queue']][_0x7673('0x4a')]),_0x7673('0x71'),JSON[_0x7673('0x53')](_0x4ed31d[_0x7673('0x10')][_0x4ed31d[_0x7673('0x13')][_0x58e17d]['queue']]['pTalking']),JSON[_0x7673('0x53')](_0x4ed31d[_0x7673('0x13')][_0x58e17d]['dialAnswer']),JSON[_0x7673('0x53')](_[_0x7673('0x72')](_0x4ed31d[_0x7673('0x13')][_0x58e17d],[_0x7673('0x73'),_0x7673('0x74'),'VoiceQueueId',_0x7673('0x75')])));return ami[_0x7673('0x76')]({'action':_0x7673('0x77'),'channel':_0x4ed31d[_0x7673('0x13')][_0x58e17d]['channel']})[_0x7673('0x78')](function(_0x5e8632){if(_0x5e8632[_0x7673('0x49')]===_0x7673('0x79')){setTimeout(function(){if(_0x4ed31d[_0x7673('0x13')][_0x58e17d]){ut[_0x7673('0x7a')](_0x4ed31d[_0x7673('0x10')][_0x4ed31d[_0x7673('0x13')][_0x58e17d][_0x7673('0x6f')]],_0x7673('0x7b'));if(_0x4ed31d[_0x7673('0x13')][_0x58e17d]['dialAnswer']===!![]){ut[_0x7673('0x7c')](_0x4ed31d['campaignsPreview'][_0x4ed31d[_0x7673('0x13')][_0x58e17d][_0x7673('0x6f')]],_0x7673('0x7b'));ut['loggerError'](_0x7673('0x7d')+_0x58e17d,_0x4ed31d[_0x7673('0x13')][_0x58e17d][_0x7673('0x6f')]);}ut[_0x7673('0x7e')](_0x7673('0x7f')+_0x58e17d,_0x4ed31d[_0x7673('0x13')][_0x58e17d][_0x7673('0x6f')]);delete _0x4ed31d[_0x7673('0x13')][_0x58e17d];}},0x2328);}});}});};Preview[_0x7673('0x61')][_0x7673('0x65')]=function(){var _0x3965c2=this;loggerAction[_0x7673('0x56')](_0x7673('0x80'),_[_0x7673('0x81')](this['actions']));for(var _0x29dc1a in this['actions']){if(_0x3965c2[_0x7673('0x13')][_0x7673('0x62')](_0x29dc1a)){_0x3965c2[_0x7673('0x6b')](_0x29dc1a);}}};Preview['prototype'][_0x7673('0x6a')]=function(_0x5d71b7){var _0x4f9e7a=this;rpcDb[_0x7673('0x82')](_0x5d71b7['id'],ut['agentReadyId'](this['agents']))[_0x7673('0x83')](function(_0x3f6ef3){if(!_[_0x7673('0x6c')](_0x3f6ef3)){for(var _0xeaa731=0x0;_0xeaa731<_0x3f6ef3[_0x7673('0x84')];_0xeaa731+=0x1){if(ut[_0x7673('0x85')](_0x3f6ef3[_0xeaa731][_0x7673('0x86')])<_0x5d71b7[_0x7673('0x87')]*0x3c){if(_0x3f6ef3[_0xeaa731][_0x7673('0x88')]&&!_0x3f6ef3[_0xeaa731][_0x7673('0x88')][_0x7673('0x89')]){_0x4f9e7a['run'](_0x3f6ef3[_0xeaa731]['id'])['then'](ut[_0x7673('0x8a')](_0x7673('0x8b')))[_0x7673('0x78')](ut[_0x7673('0x8a')](_0x7673('0x8b')));}else{rpcDb['disableContact'](_0x3f6ef3[_0xeaa731]['id']);}}else{var _0x5caca9=new Action(_0x3f6ef3[_0xeaa731],_0x5d71b7);_0x5caca9[_0x7673('0x8c')]=moment()[_0x7673('0x54')](_0x7673('0x8d'));_0x5d71b7[_0x7673('0x3d')]+=0x1;ut[_0x7673('0x8e')](_0x5caca9,0x17,'RecallInQueue');if(_0x5d71b7[_0x7673('0x8f')]){rpcDb[_0x7673('0x90')](ut[_0x7673('0x91')](_0x3f6ef3[_0xeaa731]));rpcDb['createCustomerHistory'](_0x5caca9,_0x7673('0x92'));}else{ut['logCustomer'](_0x5caca9,0x16,_0x7673('0x93'));rpcDb[_0x7673('0x94')](_0x5caca9,_0x7673('0x95'));rpcDb['createCustomerFinal'](_0x5caca9,_0x7673('0x95'));}}}}})[_0x7673('0x78')](ut['logger2']('[getContactRecallMe]'));};Preview['prototype'][_0x7673('0x68')]=function(_0x2dd367){_0x2dd367[_0x7673('0x58')]=!![];if(ut[_0x7673('0x96')](_0x2dd367['loggedIn'])){_0x2dd367[_0x7673('0x49')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x7673('0x97')](_0x2dd367[_0x7673('0x67')])){_0x2dd367[_0x7673('0x49')]=_0x7673('0x59');}else if(!this['isTrunkReachable'](_0x2dd367[_0x7673('0x50')])){if(!this[_0x7673('0x98')](_0x2dd367[_0x7673('0x99')])){_0x2dd367['message']='TRUNK_IS_NOT_REACHABLE';}else{_0x2dd367[_0x7673('0x49')]=_0x7673('0x9a');}}else{_0x2dd367[_0x7673('0x49')]=_0x7673('0x9a');}emitCampaignPreview(_0x2dd367);};Preview[_0x7673('0x61')]['callProgressDetectingCustomer']=function(_0x2a9f6d,_0x212ed5,_0x5f5cb0){var _0x5a5442=this;var _0x4a6ef8=this[_0x7673('0x13')][_0x212ed5];var _0x2a44c0=this['campaignsPreview'][_0x4a6ef8[_0x7673('0x6f')]];var _0x484b9b;if(_0x2a44c0){switch(_0x5f5cb0){case'1':_0x2a44c0['outboundNoSuchCallsDay']+=0x1;_0x4a6ef8[_0x7673('0x9b')]+=0x1;_0x4a6ef8[_0x7673('0x9c')]=ut[_0x7673('0x9d')](_0x4a6ef8);ut[_0x7673('0x8e')](_0x4a6ef8,0x0,'NoSuchNumber');ami[_0x7673('0x21')]('custom:agentnosuchnumber',ut[_0x7673('0x9e')](_0x4a6ef8,_0x7673('0x9f')));rpcDb[_0x7673('0x94')](_0x4a6ef8,_0x7673('0xa0'));if(ut[_0x7673('0x9d')](_0x4a6ef8)>=_0x2a44c0[_0x7673('0xa1')]){_0x484b9b=ut[_0x7673('0xa2')](_0x4a6ef8,0xf,'Global');rpcDb['createCustomerFinal'](_0x484b9b,_0x7673('0xa3'));}else{if(_0x4a6ef8[_0x7673('0x9b')]>=_0x2a44c0[_0x7673('0xa4')]){rpcDb[_0x7673('0xa5')](_0x4a6ef8,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x7673('0xa6')](ut[_0x7673('0xa7')](_0x4a6ef8,_0x7673('0x9b'),_0x2a44c0[_0x7673('0xa8')]),_0x4a6ef8[_0x7673('0xa9')],_0x4a6ef8['activeContact']);}}delete this[_0x7673('0x13')][_0x2a9f6d[_0x7673('0xaa')]];break;case _0x7673('0xab'):var _0x4f35a3=moment()[_0x7673('0x54')](_0x7673('0x8d'));_0x4a6ef8[_0x7673('0xac')]=_0x4f35a3;_0x4a6ef8[_0x7673('0xad')]=_0x4f35a3;_0x4a6ef8[_0x7673('0xae')]=!![];_0x2a44c0[_0x7673('0x26')]+=0x1;logger['info'](_0x7673('0xaf'),_0x4a6ef8[_0x7673('0xb0')],_0x7673('0xb1'),_0x2a44c0[_0x7673('0x22')],_0x7673('0x71'),_0x2a44c0[_0x7673('0x26')]);ami['emit'](_0x7673('0xb2'),ut[_0x7673('0x9e')](_0x4a6ef8,_0x7673('0xb3'),this[_0x7673('0x10')][_0x4a6ef8['queue']]));if(_0x2a44c0[_0x7673('0xb4')]){ami[_0x7673('0x21')](_0x7673('0xb5'),ut[_0x7673('0xb6')](_0x4a6ef8));}break;case'16':ami[_0x7673('0x21')](_0x7673('0xb7'),ut[_0x7673('0x9e')](_0x4a6ef8,_0x7673('0xb8'),this[_0x7673('0x10')][_0x4a6ef8[_0x7673('0x6f')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x4a6ef8,'complete'));_0x2a44c0[_0x7673('0x35')]+=0x1;_0x2a44c0[_0x7673('0x2b')]+=0x1;_0x2a44c0[_0x7673('0x24')]+=0x1;ut['decrementTalkink'](_0x2a44c0,_0x7673('0xb9'));_0x4a6ef8[_0x7673('0x9c')]=ut[_0x7673('0x9d')](_0x4a6ef8);ut['logCustomer'](_0x4a6ef8,0x4,_0x7673('0xba'));rpcDb['createCustomerHistory'](_0x4a6ef8,_0x7673('0xbb'));rpcDb[_0x7673('0xa5')](_0x4a6ef8,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x4a6ef8);_0x2a44c0[_0x7673('0x28')]+=_0x4a6ef8[_0x7673('0xbc')];_0x2a44c0['sumBillable']+=_0x4a6ef8['talktime'];logger[_0x7673('0x56')]('[syncHangup][talking][decrement]',_0x4a6ef8[_0x7673('0xb0')],_0x7673('0xb1'),_0x2a44c0[_0x7673('0x22')],_0x7673('0x71'),_0x2a44c0[_0x7673('0x26')]);delete this[_0x7673('0x13')][_0x2a9f6d[_0x7673('0xaa')]];break;case _0x7673('0xbd'):_0x2a44c0[_0x7673('0xbe')]+=0x1;_0x4a6ef8['countbusyretry']+=0x1;_0x4a6ef8[_0x7673('0x9c')]=ut[_0x7673('0x9d')](_0x4a6ef8);ut[_0x7673('0x8e')](_0x4a6ef8,0x5,'Busy');ami[_0x7673('0x21')](_0x7673('0xbf'),ut[_0x7673('0x9e')](_0x4a6ef8,_0x7673('0xc0')));rpcDb[_0x7673('0x94')](_0x4a6ef8,_0x7673('0xc1'));if(ut[_0x7673('0x9d')](_0x4a6ef8)>=_0x2a44c0['dialGlobalMaxRetry']){_0x484b9b=ut[_0x7673('0xa2')](_0x4a6ef8,0xf,'Global');rpcDb[_0x7673('0xa5')](_0x484b9b,_0x7673('0xc2'));}else{if(_0x4a6ef8[_0x7673('0xc3')]>=_0x2a44c0[_0x7673('0xc4')]){rpcDb['createCustomerFinal'](_0x4a6ef8,_0x7673('0xc1'));}else{rpcDb[_0x7673('0xa6')](ut[_0x7673('0xa7')](_0x4a6ef8,'countbusyretry',_0x2a44c0[_0x7673('0xc5')]),_0x4a6ef8[_0x7673('0xa9')],_0x4a6ef8[_0x7673('0xc6')]);}}break;case _0x7673('0xc7'):_0x2a44c0['outboundNoAnswerCallsDay']+=0x1;_0x4a6ef8[_0x7673('0xc8')]+=0x1;_0x4a6ef8[_0x7673('0x9c')]=ut['totalGlobal'](_0x4a6ef8);ut[_0x7673('0x8e')](_0x4a6ef8,0x3,_0x7673('0xc9'));ami['emit'](_0x7673('0xca'),ut['buildObj'](_0x4a6ef8,_0x7673('0xcb')));rpcDb['createCustomerHistory'](_0x4a6ef8,_0x7673('0xcc'));if(ut[_0x7673('0x9d')](_0x4a6ef8)>=_0x2a44c0[_0x7673('0xa1')]){_0x484b9b=ut[_0x7673('0xa2')](_0x4a6ef8,0xf,_0x7673('0xcd'));rpcDb[_0x7673('0xa5')](_0x484b9b,_0x7673('0xce'));}else{if(_0x4a6ef8[_0x7673('0xc8')]>=_0x2a44c0['dialNoAnswerMaxRetry']){rpcDb['createCustomerFinal'](_0x4a6ef8,_0x7673('0xcc'));}else{rpcDb[_0x7673('0xa6')](ut[_0x7673('0xa7')](_0x4a6ef8,_0x7673('0xc8'),_0x2a44c0['dialNoAnswerRetryFrequency']),_0x4a6ef8[_0x7673('0xa9')],_0x4a6ef8[_0x7673('0xc6')]);}}break;case _0x7673('0xcf'):_0x2a44c0[_0x7673('0xd0')]+=0x1;_0x4a6ef8[_0x7673('0xd1')]+=0x1;_0x4a6ef8[_0x7673('0x9c')]=ut['totalGlobal'](_0x4a6ef8);ut[_0x7673('0x8e')](_0x4a6ef8,0x8,'Congestion');ami[_0x7673('0x21')](_0x7673('0xd2'),ut[_0x7673('0x9e')](_0x4a6ef8,_0x7673('0xd3')));rpcDb[_0x7673('0x94')](_0x4a6ef8,_0x7673('0xd4'));if(ut[_0x7673('0x9d')](_0x4a6ef8)>=_0x2a44c0[_0x7673('0xa1')]){_0x484b9b=ut[_0x7673('0xa2')](_0x4a6ef8,0xf,_0x7673('0xcd'));rpcDb[_0x7673('0xa5')](_0x484b9b,_0x7673('0xd5'));}else{if(_0x4a6ef8[_0x7673('0xd1')]>=_0x2a44c0['dialCongestionMaxRetry']){rpcDb[_0x7673('0xa5')](_0x4a6ef8,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x7673('0xa6')](ut['scheduledAt'](_0x4a6ef8,_0x7673('0xd1'),_0x2a44c0[_0x7673('0xc5')]),_0x4a6ef8[_0x7673('0xa9')],_0x4a6ef8[_0x7673('0xc6')]);}}break;case _0x7673('0xd6'):_0x2a44c0[_0x7673('0xd7')]+=0x1;_0x4a6ef8[_0x7673('0xd8')]+=0x1;_0x4a6ef8[_0x7673('0x9c')]=ut[_0x7673('0x9d')](_0x4a6ef8);ut[_0x7673('0x8e')](_0x4a6ef8,0x14,'AgentReject');ami['emit'](_0x7673('0xd9'),ut['buildObj'](_0x4a6ef8,'agentreject'));rpcDb[_0x7673('0x94')](_0x4a6ef8,_0x7673('0xda'));if(ut[_0x7673('0x9d')](_0x4a6ef8)>=_0x2a44c0['dialGlobalMaxRetry']){_0x484b9b=ut[_0x7673('0xa2')](_0x4a6ef8,0x14,'AgentReject');rpcDb[_0x7673('0xa5')](_0x484b9b,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x4a6ef8[_0x7673('0xd8')]>=_0x2a44c0[_0x7673('0xdb')]){rpcDb[_0x7673('0xa5')](_0x4a6ef8,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x7673('0xa6')](ut['scheduledAt'](_0x4a6ef8,_0x7673('0xd8'),_0x2a44c0[_0x7673('0xdc')]),_0x4a6ef8[_0x7673('0xa9')],_0x4a6ef8[_0x7673('0xc6')]);}}break;case _0x7673('0xdd'):_0x2a44c0[_0x7673('0x3e')]+=0x1;_0x4a6ef8[_0x7673('0xde')]+=0x1;_0x4a6ef8[_0x7673('0x9c')]=ut[_0x7673('0x9d')](_0x4a6ef8);ut['logCustomer'](_0x4a6ef8,0xb,'Abandoned');rpcDb[_0x7673('0x94')](_0x4a6ef8,_0x7673('0xdf'));if(ut['totalGlobal'](_0x4a6ef8)>=_0x2a44c0[_0x7673('0xa1')]){_0x484b9b=ut[_0x7673('0xa2')](_0x4a6ef8,0xf,_0x7673('0xcd'));rpcDb[_0x7673('0xa5')](_0x484b9b,_0x7673('0xdf'));}else{if(_0x4a6ef8[_0x7673('0xe0')]>=_0x2a44c0[_0x7673('0xe1')]){rpcDb[_0x7673('0xa5')](_0x4a6ef8,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x7673('0xa6')](ut[_0x7673('0xa7')](_0x4a6ef8,_0x7673('0xde'),_0x2a44c0['dialAbandonedRetryFrequency']),_0x4a6ef8[_0x7673('0xa9')],_0x4a6ef8[_0x7673('0xc6')]);}}break;case'18':_0x2a44c0[_0x7673('0xe2')]+=0x1;_0x4a6ef8[_0x7673('0xe3')]+=0x1;_0x4a6ef8[_0x7673('0x9c')]=ut[_0x7673('0x9d')](_0x4a6ef8);ut[_0x7673('0x8e')](_0x4a6ef8,0x12,_0x2a9f6d['cause-txt']||_0x2a9f6d[_0x7673('0xe4')]);ami['emit'](_0x7673('0xe5'),ut[_0x7673('0x9e')](_0x4a6ef8,_0x7673('0xe6')));rpcDb['createCustomerHistory'](_0x4a6ef8,'[callProgressDetectingCustomer][hangupInAMD]');if(ut[_0x7673('0x9d')](_0x4a6ef8)>=_0x2a44c0['dialGlobalMaxRetry']){_0x484b9b=ut[_0x7673('0xa2')](_0x4a6ef8,0xf,_0x7673('0xcd'));rpcDb[_0x7673('0xa5')](_0x484b9b,_0x7673('0xe7'));}else{rpcDb[_0x7673('0xa5')](_0x4a6ef8,_0x7673('0xe7'));}delete this['actions'][_0x2a9f6d[_0x7673('0xaa')]];break;case'19':_0x2a44c0[_0x7673('0xe2')]+=0x1;_0x4a6ef8[_0x7673('0x9c')]=ut[_0x7673('0x9d')](_0x4a6ef8);ut[_0x7673('0x8e')](_0x4a6ef8,0x13,_0x2a9f6d[_0x7673('0xe8')]||_0x2a9f6d[_0x7673('0xe4')]);ami[_0x7673('0x21')]('custom:amd',ut[_0x7673('0x9e')](_0x4a6ef8,_0x7673('0xe6')));rpcDb['createCustomerHistory'](_0x4a6ef8,_0x7673('0xe9'));if(ut['totalGlobal'](_0x4a6ef8)>=_0x2a44c0['dialGlobalMaxRetry']){_0x484b9b=ut[_0x7673('0xa2')](_0x4a6ef8,0xf,'Global');rpcDb[_0x7673('0xa5')](_0x484b9b,_0x7673('0xe9'));}else{rpcDb[_0x7673('0xa5')](_0x4a6ef8,_0x7673('0xe9'));}delete this[_0x7673('0x13')][_0x2a9f6d[_0x7673('0xaa')]];break;default:if(_0x4a6ef8[_0x7673('0xae')]){ut[_0x7673('0x7c')](_0x2a44c0,_0x7673('0xea'));ut[_0x7673('0x7e')](_0x7673('0xeb')+_0x2a44c0[_0x7673('0x22')],_0x2a9f6d);}_0x2a44c0['outboundUnknownCallsDay']+=0x1;_0x4a6ef8[_0x7673('0x9c')]=ut[_0x7673('0x9d')](_0x4a6ef8);ut[_0x7673('0x8e')](_0x4a6ef8,0xc,_0x2a9f6d['cause-txt']||_0x2a9f6d[_0x7673('0xe4')]);rpcDb[_0x7673('0x94')](_0x4a6ef8,_0x7673('0xec'));if(ut[_0x7673('0x9d')](_0x4a6ef8)>=_0x2a44c0['dialGlobalMaxRetry']){_0x484b9b=ut['cloneAction'](_0x4a6ef8,0xf,'Global');rpcDb[_0x7673('0xa5')](_0x484b9b,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x7673('0xa5')](_0x4a6ef8,_0x7673('0xed'));}delete this[_0x7673('0x13')][_0x2a9f6d['linkedid']];}if(!(_0x4a6ef8[_0x7673('0xae')]&&_0x5f5cb0==='16')){ut[_0x7673('0x7a')](_0x2a44c0,_0x7673('0xee'));logger[_0x7673('0x56')](_0x7673('0xef'),_0x4a6ef8[_0x7673('0xb0')],_0x7673('0xb1'),_0x2a44c0[_0x7673('0x22')],_0x7673('0x70'),_0x2a44c0[_0x7673('0x4a')]);}if(_0x5f5cb0!==_0x7673('0xab')){delete this[_0x7673('0x13')][_0x2a9f6d['linkedid']];delete this['actions'][_0x2a9f6d['destlinkedid']];}}};Preview['prototype'][_0x7673('0xf0')]=function(_0xbeff92,_0x54d23b,_0x58949d){if(_['isUndefined'](_0x54d23b)&&_0x7673('0xf1')!==typeof _0x54d23b){return;}if(_[_0x7673('0xf2')](_0x58949d)&&_0x7673('0xf1')!==typeof _0x58949d){return;}switch(_0x58949d[_0x7673('0xf3')]){case'0':ut[_0x7673('0xf4')](_0xbeff92,0x0,'NoSuchNumber');rpcDb[_0x7673('0xf5')](_0xbeff92,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x7673('0xf4')](_0xbeff92,0x3,_0x7673('0xc9'));rpcDb['createAgentHistory'](_0xbeff92,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x7673('0xf4')](_0xbeff92,0x5,_0x7673('0xf6'));rpcDb[_0x7673('0xf5')](_0xbeff92,_0x7673('0xf7'));break;case'8':ut[_0x7673('0xf4')](_0xbeff92,0x8,_0x7673('0xf8'));rpcDb[_0x7673('0xf5')](_0xbeff92,_0x7673('0xf9'));break;case'22':ut[_0x7673('0xf4')](_0xbeff92,0x16,_0x7673('0xfa'));rpcDb[_0x7673('0xf5')](_0xbeff92,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0xbeff92,0xc,_0x58949d[_0x7673('0xf3')]);rpcDb[_0x7673('0xf5')](_0xbeff92,_0x7673('0xf9'));}ut[_0x7673('0x7a')](_0x54d23b,_0x7673('0xfb'));logger['info'](_0x7673('0xfc'),_0xbeff92[_0x7673('0xb0')],_0x7673('0xb1'),_0x54d23b[_0x7673('0x22')],_0x7673('0x70'),_0x54d23b[_0x7673('0x4a')]);delete this['actions'][_0xbeff92[_0x7673('0xb0')]];};Preview['prototype'][_0x7673('0xfd')]=function(_0x4032fc,_0x3ad5d8,_0x57da03,_0x561204,_0x4afa80){var _0x291899=this;return new BPromise(function(_0x27d345,_0x58da8a){if(_[_0x7673('0x6c')](_0x3ad5d8)||_['isNil'](_0x3ad5d8[_0x7673('0xfe')])||_['isNil'](_0x3ad5d8[_0x7673('0xfe')][_0x7673('0xff')])||_[_0x7673('0x6c')](_0x3ad5d8[_0x7673('0x100')])){_0x58da8a(ut['message'](_0x7673('0x101'),_0x561204,_0x4afa80));return;}var _0x7ed790=uuid['v4']();var _0x43f2f9=_0x291899['campaignsPreview'][_0x3ad5d8['Queue'][_0x7673('0x22')]];var _0x6c8b4e=_0x57da03?_0x291899['agents'][_0x57da03]['id']:undefined;_0x291899[_0x7673('0x13')][_0x7ed790]=new Action(_0x3ad5d8,_0x43f2f9,_0x7ed790,_0x57da03,_0x6c8b4e);var _0x4c02be=_0x291899[_0x7673('0x13')][_0x7ed790];_0x4c02be['unlockAgent']=_0x561204;_0x4c02be['activeContact']=_0x4afa80;_0x4c02be[_0x7673('0x102')]=_0x57da03;if(_[_0x7673('0x103')](_0x4032fc)){_0x291899['execCall'](_0x4c02be,_0x43f2f9,_0x3ad5d8,_0x57da03)[_0x7673('0x83')](function(_0x56d530){logger[_0x7673('0x56')](_0x7673('0x104'),_0x7673('0x105')+_0x4c02be[_0x7673('0x6f')]+_0x7673('0x106')+_0x4c02be[_0x7673('0x107')],JSON[_0x7673('0x53')](_0x56d530));ami['emit'](_0x7673('0x108'),ut[_0x7673('0x9e')](_0x4c02be,_0x7673('0x109'),_0x291899[_0x7673('0x10')][_0x4c02be['queue']]));_0x27d345(ut[_0x7673('0x49')](_0x7673('0x10a')));})[_0x7673('0x78')](function(_0x4961d2){ut[_0x7673('0x5a')](_0x7673('0x10b'),_0x4961d2);_0x58da8a(ut[_0x7673('0x49')](_0x7673('0x10c'),_0x561204,_0x4afa80));});}else{_0x43f2f9[_0x7673('0x36')]+=0x1;ut[_0x7673('0x10d')](_0x4c02be);rpcDb[_0x7673('0x10e')](_0x4c02be,_0x7673('0x10f'));delete _0x291899[_0x7673('0x13')][_0x7ed790];_0x58da8a(ut[_0x7673('0x49')](_0x7673('0x110'),_0x561204,_0x4afa80));}});};Preview[_0x7673('0x61')]['isTrunkReachable']=function(_0x3ff143){return!_[_0x7673('0x6c')](_0x3ff143)&&!_[_0x7673('0x6c')](_0x3ff143[_0x7673('0x22')])&&!_[_0x7673('0x6c')](_0x3ff143[_0x7673('0x51')])&&_0x3ff143[_0x7673('0x51')]&&!_[_0x7673('0x6c')](this['trunks'][util['format'](_0x7673('0x111'),_0x3ff143[_0x7673('0x22')])])&&!_[_0x7673('0x6c')](this[_0x7673('0x12')][util[_0x7673('0x54')]('SIP/%s',_0x3ff143[_0x7673('0x22')])]['status'])&&(this['trunks'][util[_0x7673('0x54')]('SIP/%s',_0x3ff143[_0x7673('0x22')])][_0x7673('0x77')]===_0x7673('0x112')||this[_0x7673('0x12')][util[_0x7673('0x54')](_0x7673('0x111'),_0x3ff143[_0x7673('0x22')])][_0x7673('0x77')]===_0x7673('0x113'));};Preview['prototype'][_0x7673('0x114')]=function(_0x21503e,_0xb5ffc){var _0x5282ad=this;return new BPromise(function(_0x16af07,_0x3a4741){_0x5282ad['execRun'](_0x21503e,_0xb5ffc)[_0x7673('0x83')](function(_0x13b0a2){_0x16af07(_[_0x7673('0x72')](_0x13b0a2,[_0x7673('0x49')]));})[_0x7673('0x78')](function(_0x50f0cd){if(_0x50f0cd[_0x7673('0x115')]){rpcDb[_0x7673('0x116')](_0x21503e);}if(_0x50f0cd[_0x7673('0x51')]){rpcDb[_0x7673('0x117')](_0x21503e);}_0x3a4741(_['pick'](_0x50f0cd,[_0x7673('0x49')]));});});};Preview[_0x7673('0x61')][_0x7673('0x118')]=function(_0x98c2b8,_0x1250dd){var _0x2ff033=this;return new BPromise(function(_0x1cf15b,_0x41f35c){var _0x5acf42,_0x4f99cd;rpcDb[_0x7673('0x119')](_0x98c2b8)[_0x7673('0x83')](function(_0x46b56d){if(!_[_0x7673('0x6c')](_0x46b56d[0x0])){_0x4f99cd=_0x46b56d[0x0][_0x7673('0x11a')]?![]:!![];_0x5acf42=_0x46b56d[0x0][_0x7673('0x11a')]?!![]:![];_0x5acf42=_0x1250dd?!![]:_0x5acf42;}var _0x30eabf=_0x2ff033[_0x7673('0x11b')](_0x46b56d);if(_0x30eabf[_0x7673('0x11c')]){rpcDb[_0x7673('0x11d')](_[_0x7673('0x72')](_0x46b56d[0x0],[_0x7673('0x100'),_0x7673('0x11e')]))['then'](function(_0x87ca84){_0x2ff033[_0x7673('0xfd')](_0x87ca84,_0x46b56d[0x0],_0x1250dd,_0x4f99cd,_0x5acf42)[_0x7673('0x83')](function(_0x4f5a07){_0x1cf15b(_0x4f5a07);})[_0x7673('0x78')](function(_0x1ba2ec){_0x41f35c(_0x1ba2ec);});})['catch'](function(_0x482cbe){ut['logger'](_0x7673('0x11f'),_0x482cbe);_0x41f35c(ut[_0x7673('0x49')](_0x7673('0x120'),_0x4f99cd,_0x5acf42));});}else{_0x41f35c(ut[_0x7673('0x49')](_0x30eabf[_0x7673('0x49')],_0x4f99cd,_0x5acf42));}})[_0x7673('0x78')](function(_0x48ea16){ut[_0x7673('0x5a')](_0x7673('0x121'),_0x48ea16);_0x41f35c(ut[_0x7673('0x49')](_0x7673('0x120'),![],!![]));});});};Preview[_0x7673('0x61')][_0x7673('0x11b')]=function(_0x2a561d){if(_[_0x7673('0x6c')](_0x2a561d)||_[_0x7673('0x103')](_0x2a561d)||!_[_0x7673('0x6c')](_0x2a561d[0x0][_0x7673('0x88')])&&_[_0x7673('0x6c')](_0x2a561d[0x0][_0x7673('0x88')][_0x7673('0x22')])){ut['logger'](_0x7673('0x122'),_0x2a561d);return{'isValid':![],'message':_0x7673('0x123')};}var _0x53a27e=this[_0x7673('0x10')][_0x2a561d[0x0][_0x7673('0x6e')][_0x7673('0x22')]];_0x53a27e[_0x7673('0x49')]=_0x7673('0x9a');if(_[_0x7673('0x6c')](_0x53a27e)){ut[_0x7673('0x5a')](_0x7673('0x124'),_0x53a27e);return{'isValid':![],'message':_0x7673('0x125')};}if(!this['isTrunkReachable'](_0x53a27e[_0x7673('0x50')])){ut[_0x7673('0x5a')](_0x7673('0x126'),_0x7673('0x127')+_0x53a27e[_0x7673('0x22')]+_0x7673('0x128'));if(!this[_0x7673('0x98')](_0x53a27e[_0x7673('0x99')])){ut[_0x7673('0x5a')](_0x7673('0x126'),_0x53a27e['name']+_0x7673('0x129'));return{'isValid':![],'message':_0x7673('0x12a')};}}if(!ut[_0x7673('0x97')](_0x53a27e[_0x7673('0x67')])){ut[_0x7673('0x5a')]('[Preview][validateContact][Campaign\x20Active]',_0x53a27e[_0x7673('0x22')]+'\x20Not\x20Active');return{'isValid':![],'message':_0x7673('0x127')+_0x53a27e[_0x7673('0x22')]+_0x7673('0x12b')};}return{'isValid':!![],'message':_0x7673('0x12c')};};Preview[_0x7673('0x61')][_0x7673('0x12d')]=function(_0x5ad9fb,_0x43b6e3,_0x5006ef,_0x496800){var _0x6980ef=this;return new BPromise(function(_0x5b999d,_0x5a0961){var _0x4086bf=_0x5ad9fb[_0x7673('0xb0')];var _0x4d9b55=_0x6980ef[_0x7673('0x98')](_0x43b6e3[_0x7673('0x50')])?util[_0x7673('0x54')](_0x7673('0x12e'),_0x43b6e3[_0x7673('0x50')]['name'],_['isNil'](_0x43b6e3['dialPrefix'])?'':_0x43b6e3[_0x7673('0x33')]['trim']()||'',_0x43b6e3[_0x7673('0x12f')]>0x0?_0x5006ef[_0x7673('0xfe')]['phone'][_0x7673('0x130')](_0x43b6e3[_0x7673('0x12f')]):_0x5006ef[_0x7673('0xfe')][_0x7673('0xff')]):util[_0x7673('0x54')](_0x7673('0x12e'),_[_0x7673('0x6c')](_0x43b6e3[_0x7673('0x99')])?_0x43b6e3[_0x7673('0x50')][_0x7673('0x22')]:_0x43b6e3[_0x7673('0x99')][_0x7673('0x22')],_[_0x7673('0x6c')](_0x43b6e3[_0x7673('0x33')])?'':_0x43b6e3[_0x7673('0x33')][_0x7673('0x131')]()||'',_0x43b6e3[_0x7673('0x12f')]>0x0?_0x5006ef[_0x7673('0xfe')][_0x7673('0xff')][_0x7673('0x130')](_0x43b6e3[_0x7673('0x12f')]):_0x5006ef[_0x7673('0xfe')][_0x7673('0xff')]);var _0x14f91c=_0x6980ef[_0x7673('0x98')](_0x43b6e3['Trunk'])?ut[_0x7673('0x132')](_0x43b6e3[_0x7673('0x50')][_0x7673('0x133')],_0x43b6e3[_0x7673('0x30')],_0x43b6e3[_0x7673('0x134')]>0x0?ut[_0x7673('0x135')](_0x43b6e3[_0x7673('0x31')],_0x43b6e3[_0x7673('0x134')]):_0x43b6e3['dialOriginateCallerIdNumber']):ut[_0x7673('0x132')](_[_0x7673('0x6c')](_0x43b6e3[_0x7673('0x99')])?_0x43b6e3[_0x7673('0x50')][_0x7673('0x133')]:_0x43b6e3[_0x7673('0x99')]['callerid'],_0x43b6e3[_0x7673('0x30')],_0x43b6e3['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x43b6e3[_0x7673('0x31')],_0x43b6e3[_0x7673('0x134')]):_0x43b6e3[_0x7673('0x31')]);if(_0x14f91c){_0x5ad9fb[_0x7673('0x136')]=ut['extractCalleridName'](_0x14f91c);_0x5ad9fb['originatecalleridnum']=ut[_0x7673('0x137')](_0x14f91c);}var _0x24623d=ut[_0x7673('0x138')](_0x43b6e3,_0x5006ef,_0x4d9b55,_0x14f91c,_0x4086bf,_0x5ad9fb);_[_0x7673('0x139')](_0x5ad9fb,ut[_0x7673('0x13a')](_0x24623d));_0x5ad9fb[_0x7673('0x8c')]=moment()[_0x7673('0x54')]('YYYY-MM-DD\x20HH:mm:ss');ami['Action'](ut[_0x7673('0x13b')](_0x5ad9fb,_0x43b6e3,_0x24623d,_0x5ad9fb[_0x7673('0xc6')],_0x496800))['then'](function(_0x232324){_0x43b6e3[_0x7673('0x4a')]+=0x1;logger['info'](_0x7673('0x13c'),_0x4086bf,'\x20Queue',_0x43b6e3['name'],_0x7673('0x70'),_0x43b6e3[_0x7673('0x4a')]);_0x5b999d(_0x232324);})[_0x7673('0x78')](function(_0x35587c){ut[_0x7673('0xf4')](_0x5ad9fb,0xe,_0x7673('0x13d'));rpcDb[_0x7673('0xf5')](_0x5ad9fb,'[originateFailure][logOriginateFailure]');_0x5a0961(_0x35587c);});});};Preview[_0x7673('0x61')][_0x7673('0x13e')]=function(_0xe36405){if(this[_0x7673('0x13')][_0xe36405['linkedid']]){this[_0x7673('0x13')][_0xe36405[_0x7673('0xaa')]]['channel']=_0xe36405[_0x7673('0x13f')];}};Preview['prototype'][_0x7673('0x140')]=function(_0x4d4fb3){var _0x3b6905=this;var _0x366a2d=this[_0x7673('0x13')][_0x4d4fb3[_0x7673('0x141')]];if(_0x366a2d){if(_0x366a2d[_0x7673('0x102')]&&this[_0x7673('0x14')][_0x366a2d[_0x7673('0x102')]]){ut[_0x7673('0x142')](_0x366a2d,this[_0x7673('0x14')][_0x366a2d[_0x7673('0x102')]][_0x7673('0x22')],this[_0x7673('0x14')][_0x366a2d[_0x7673('0x102')]]['id']);}var _0x48787e=_['clone'](_0x366a2d);_0x48787e[_0x7673('0xac')]=moment()[_0x7673('0x54')](_0x7673('0x8d'));var _0x3f049f=_0x3b6905['campaignsPreview'][_0x366a2d[_0x7673('0x6f')]];if(ut['isFailure'](_0x4d4fb3[_0x7673('0x143')])){if(_0x366a2d[_0x7673('0xa9')]){rpcDb[_0x7673('0x116')](_0x366a2d[_0x7673('0x107')]);}if(_0x366a2d['activeContact']){rpcDb[_0x7673('0x117')](_0x366a2d[_0x7673('0x107')]);}ami[_0x7673('0x21')](_0x7673('0x144'),ut[_0x7673('0x9e')](_0x366a2d,'rejected',this['campaignsPreview'][_0x366a2d[_0x7673('0x6f')]]));this[_0x7673('0xf0')](_0x48787e,_0x3f049f,_0x4d4fb3);}else{_0x366a2d[_0x7673('0x8c')]=moment()['format'](_0x7673('0x8d'));ut[_0x7673('0xf4')](_0x48787e,0x4,_0x7673('0xba'));rpcDb[_0x7673('0xf5')](_0x48787e,_0x7673('0x145'));}}};Preview['prototype'][_0x7673('0x19')]=function(_0x3137e8){var _0x17ad4c=this;var _0x41d8b2=this['actions'][_0x3137e8[_0x7673('0xaa')]];var _0x18221a;if(_0x41d8b2){_0x18221a=this[_0x7673('0x10')][_0x41d8b2['queue']];logger['info'](_0x7673('0x146'),_0x3137e8[_0x7673('0xaa')],_0x7673('0xb1'),_0x18221a[_0x7673('0x22')],'pTalking:\x20',_0x18221a[_0x7673('0x26')]);}if(this['actions'][_0x3137e8[_0x7673('0xaa')]]&&_0x3137e8[_0x7673('0xaa')]!==_0x3137e8[_0x7673('0xb0')]){if(_0x3137e8[_0x7673('0x147')]==='16'&&this[_0x7673('0x13')][_0x3137e8[_0x7673('0xaa')]][_0x7673('0xae')]){this[_0x7673('0x148')](_0x3137e8,_0x3137e8[_0x7673('0xaa')],_0x3137e8[_0x7673('0x147')]);}else if(this[_0x7673('0x13')][_0x3137e8['linkedid']][_0x7673('0xae')]){logger[_0x7673('0x56')](_0x7673('0x149'),_0x3137e8['linkedid'],_0x3137e8[_0x7673('0x147')],_0x7673('0xb1'),_0x18221a[_0x7673('0x22')],'pTalking:\x20',_0x18221a[_0x7673('0x26')]);this[_0x7673('0x148')](_0x3137e8,_0x3137e8['linkedid'],_0x3137e8[_0x7673('0x147')]);}}else if(_0x41d8b2&&_['isNil'](_0x41d8b2[_0x7673('0x14a')])&&_0x18221a[_0x7673('0x14b')]&&_0x3137e8[_0x7673('0xaa')]===_0x3137e8['uniqueid']&&_[_0x7673('0x6c')](_0x3137e8[_0x7673('0xf3')])&&_0x3137e8[_0x7673('0x147')]==='16'&&_0x3137e8['channelstate']==='6'&&_['isUndefined'](_0x41d8b2[_0x7673('0x14c')])){if(_0x41d8b2[_0x7673('0xa9')]){rpcDb[_0x7673('0x116')](_0x41d8b2[_0x7673('0x107')]);}if(_0x41d8b2['activeContact']){rpcDb['disableContact'](_0x41d8b2[_0x7673('0x107')]);}_0x3137e8[_0x7673('0xf3')]='22';this[_0x7673('0xf0')](_0x41d8b2,_0x18221a,_0x3137e8);}else if(_0x41d8b2&&_0x41d8b2[_0x7673('0x14c')]){if(_0x3137e8[_0x7673('0x147')]==='16'&&this[_0x7673('0x13')][_0x3137e8[_0x7673('0xaa')]][_0x7673('0xae')]){logger[_0x7673('0x56')](_0x7673('0x14d'),_0x3137e8[_0x7673('0xaa')],_0x3137e8['cause'],_0x7673('0xb1'),_0x18221a[_0x7673('0x22')],_0x7673('0x71'),_0x18221a[_0x7673('0x26')]);this[_0x7673('0x148')](_0x3137e8,_0x3137e8[_0x7673('0xaa')],_0x3137e8[_0x7673('0x147')]);}else if(this[_0x7673('0x13')][_0x3137e8[_0x7673('0xaa')]]['dialAnswer']){logger['info'](_0x7673('0x149'),_0x3137e8[_0x7673('0xaa')],_0x3137e8[_0x7673('0x147')],_0x7673('0xb1'),_0x18221a[_0x7673('0x22')],_0x7673('0x71'),_0x18221a[_0x7673('0x26')]);this[_0x7673('0x148')](_0x3137e8,_0x3137e8[_0x7673('0xaa')],_0x3137e8['cause']);}}};Preview[_0x7673('0x61')]['syncDialEnd']=function(_0xeeb3ec){if(this[_0x7673('0x13')][_0xeeb3ec['destlinkedid']]&&_0xeeb3ec[_0x7673('0x14e')]!==_0xeeb3ec['destuniqueid']){this['callProgressDetectingCustomer'](_0xeeb3ec,_0xeeb3ec[_0x7673('0x14e')],_0xeeb3ec[_0x7673('0xe4')]);}};Preview['prototype'][_0x7673('0x1b')]=function(_0x5d8820){if(this[_0x7673('0x13')][_0x5d8820[_0x7673('0xaa')]]&&_0x5d8820[_0x7673('0xaa')]!==_0x5d8820[_0x7673('0xb0')]&&!this[_0x7673('0x13')][_0x5d8820[_0x7673('0xaa')]][_0x7673('0xae')]){if(_0x5d8820[_0x7673('0x147')]==='1'){this[_0x7673('0x148')](_0x5d8820,_0x5d8820[_0x7673('0xaa')],_0x5d8820[_0x7673('0x147')]);}}};Preview['prototype'][_0x7673('0x14f')]=function(_0x2febc0,_0x490b15,_0x5eef56){if(this['actions'][_0x2febc0]){if(_[_0x7673('0x6c')](this[_0x7673('0x13')][_0x2febc0][_0x7673('0x150')])){this['actions'][_0x2febc0][_0x7673('0x150')]={};}this[_0x7673('0x13')][_0x2febc0][_0x7673('0x150')][_0x490b15]=_0x5eef56;}};Preview[_0x7673('0x61')][_0x7673('0x151')]=function(_0x381d43){try{if(!_[_0x7673('0x6c')](_0x381d43)){if(ut['filterKey'](_[_0x7673('0x152')](_0x381d43[_0x7673('0x153')])[0x0])){this[_0x7673('0x14f')](_0x381d43[_0x7673('0xb0')],_['keys'](_0x381d43[_0x7673('0x153')])[0x0],_0x381d43['value']);}}}catch(_0x18bfea){logger['error'](_0x7673('0x154'),util[_0x7673('0x155')](_0x18bfea,{'showHidden':![],'depth':null}));}};Preview[_0x7673('0x61')]['syncAttendedTransfer']=function(_0x2d185c){if(_0x2d185c){if(this['actions'][_0x2d185c[_0x7673('0x156')]]){this[_0x7673('0x13')][_0x2d185c[_0x7673('0x156')]][_0x7673('0x14c')]=!![];}}};Preview[_0x7673('0x61')][_0x7673('0x20')]=function(_0x302406){if(_0x302406){if(this[_0x7673('0x13')][_0x302406['transfererlinkedid']]){this[_0x7673('0x13')][_0x302406['transfererlinkedid']]['transfer']=!![];}}};module[_0x7673('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 0fc8412..f36175c 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 _0xc068=['COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','lodash','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','queuecallerjoinAt','answertime','queuecallercompleteAt','endtime','membername','from-sip','holdtime','assigned','lastAssignedTo'];(function(_0x2af55b,_0x297c12){var _0x4ea7cb=function(_0x176c70){while(--_0x176c70){_0x2af55b['push'](_0x2af55b['shift']());}};_0x4ea7cb(++_0x297c12);}(_0xc068,0xc9));var _0x8c06=function(_0x52d8d4,_0xe7f4dc){_0x52d8d4=_0x52d8d4-0x0;var _0x275382=_0xc068[_0x52d8d4];return _0x275382;};'use strict';var util=require(_0x8c06('0x0'));var BPromise=require('bluebird');var logger=require(_0x8c06('0x1'))(_0x8c06('0x2'));var _=require(_0x8c06('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x8c06('0x4'));var cmHopperBlack=require(_0x8c06('0x5'));var voiceQueueRt=require(_0x8c06('0x6'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x8c06('0x7'));function loggerCatch(_0xe34d73){return function(_0x2e9ac5){logger[_0x8c06('0x8')](_0xe34d73,util['inspect'](_0x2e9ac5,{'showHidden':![],'depth':null}));};}function create(_0x1b0e75){return BPromise[_0x8c06('0x9')]()[_0x8c06('0xa')](cmHopperHistory[_0x8c06('0xb')](_0x1b0e75))[_0x8c06('0xc')](loggerCatch(_0x8c06('0xd')));}function createAgent(_0x4b78e5){return BPromise[_0x8c06('0x9')]()[_0x8c06('0xa')](agentReportPreview[_0x8c06('0xb')](_0x4b78e5))[_0x8c06('0xc')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x18a692){return BPromise[_0x8c06('0x9')]()[_0x8c06('0xa')](cmHopper[_0x8c06('0xe')](_0x18a692,!![]))[_0x8c06('0xc')](loggerCatch(_0x8c06('0xf')));}exports[_0x8c06('0x10')]=function(_0x663ee9){return BPromise[_0x8c06('0x9')]()[_0x8c06('0xa')](cmHopperBlack[_0x8c06('0x10')](_0x663ee9))['catch'](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x8c06('0x11')]=function(_0x5f043){return BPromise['resolve']()[_0x8c06('0xa')](cmHopper[_0x8c06('0x11')](_0x5f043))[_0x8c06('0xc')](loggerCatch(_0x8c06('0x12')));};exports['createHistory']=function(_0x2cf500,_0x40b7cf){create(_0x2cf500)[_0x8c06('0xc')](loggerCatch(_0x40b7cf));moveContact(_0x2cf500)[_0x8c06('0xc')](loggerCatch(_0x40b7cf));};exports[_0x8c06('0x13')]=function(_0x3f72ba,_0x43e308){createAgent(_0x3f72ba)['catch'](loggerCatch(_0x43e308));};exports[_0x8c06('0x14')]=function(_0x3fcbe6,_0x3c23d7){create(_0x3fcbe6)[_0x8c06('0xc')](loggerCatch(_0x3c23d7));};exports[_0x8c06('0x15')]=function(_0x2de95a,_0x28f9cb){moveContact(_0x2de95a)[_0x8c06('0xc')](loggerCatch(_0x28f9cb));};exports[_0x8c06('0x16')]=function(_0x124527,_0xac0ce5,_0x21646f){if(_0xac0ce5){_0x124527[_0x8c06('0x17')]=null;}if(_0x21646f){_0x124527[_0x8c06('0x18')]=![];}return BPromise[_0x8c06('0x9')]()[_0x8c06('0xa')](cmHopper[_0x8c06('0x16')](_0x124527))[_0x8c06('0xc')](loggerCatch(_0x8c06('0x19')));};exports[_0x8c06('0x1a')]=function(_0x8f74e2){return BPromise[_0x8c06('0x9')]()[_0x8c06('0xa')](cmHopper[_0x8c06('0x1a')](_0x8f74e2))[_0x8c06('0xc')](loggerCatch('[countReScheduled]\x20'));};exports['unlockContact']=function(_0x3211f2){return BPromise['resolve']()[_0x8c06('0xa')](cmHopper[_0x8c06('0x1b')]({'UserId':null},_0x3211f2,0x1))[_0x8c06('0xc')](loggerCatch(_0x8c06('0x1c')));};exports[_0x8c06('0x1d')]=function(_0x4edc7b){return BPromise[_0x8c06('0x9')]()['then'](cmHopper[_0x8c06('0x1b')]({'active':![]},_0x4edc7b,0x1))[_0x8c06('0xc')](loggerCatch(_0x8c06('0x1e')));};exports[_0x8c06('0x1f')]=function(_0x3ac4f4){var _0x3fa6e6={};_0x3fa6e6[_0x8c06('0x20')]=_0x3ac4f4[_0x8c06('0x20')];_0x3fa6e6[_0x8c06('0x21')]=_0x3ac4f4[_0x8c06('0x21')];_0x3fa6e6[_0x8c06('0x22')]=_0x3ac4f4[_0x8c06('0x22')];_0x3fa6e6['calleridname']=_0x3ac4f4['calleridname'];_0x3fa6e6['queue']=_0x3ac4f4['queue'];_0x3fa6e6[_0x8c06('0x23')]=_0x3ac4f4[_0x8c06('0x24')];_0x3fa6e6['queuecallerleaveAt']=_0x3ac4f4[_0x8c06('0x24')];_0x3fa6e6['queuecallercomplete']=0x1;_0x3fa6e6[_0x8c06('0x25')]=_0x3ac4f4[_0x8c06('0x26')];_0x3fa6e6['connectedlinename']=_0x3ac4f4[_0x8c06('0x27')];_0x3fa6e6['context']=_0x8c06('0x28');_0x3fa6e6['exten']='xcally-motion-preview';_0x3fa6e6[_0x8c06('0x29')]=0x0;_0x3fa6e6[_0x8c06('0x2a')]=0x1;_0x3fa6e6[_0x8c06('0x2b')]=_0x3ac4f4['membername'];_0x3fa6e6['queuecallerexitreason']=_0x8c06('0x2c');return BPromise[_0x8c06('0x9')]()[_0x8c06('0xa')](voiceQueueReport['create'](_0x3fa6e6))[_0x8c06('0xc')](loggerCatch(_0x8c06('0x2d')));};exports[_0x8c06('0x2e')]=function(_0x3e8d0a,_0x5d3e06){return BPromise['resolve']()[_0x8c06('0xa')](cmHopper[_0x8c06('0x2e')](_0x3e8d0a,_0x5d3e06))[_0x8c06('0xc')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x8c06('0x2f')]=function(_0x347a75){return BPromise[_0x8c06('0x9')]()[_0x8c06('0xa')](cmHopper[_0x8c06('0x16')](_0x347a75,!![],!![]))[_0x8c06('0xc')](loggerCatch(_0x8c06('0x30')));}; \ No newline at end of file +var _0xa282=['membername','xcally-motion-preview','holdtime','assigned','queuecallerexitreason','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','[createHistory]\x20','catch','moveContactManagedDialer','checkIsBlackList','getContactPreview','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename'];(function(_0x3b2d98,_0xaa0b26){var _0x256bf1=function(_0x1fe933){while(--_0x1fe933){_0x3b2d98['push'](_0x3b2d98['shift']());}};_0x256bf1(++_0xaa0b26);}(_0xa282,0x109));var _0x2a28=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xa282[_0x2064e5];return _0x21a233;};'use strict';var util=require(_0x2a28('0x0'));var BPromise=require(_0x2a28('0x1'));var logger=require(_0x2a28('0x2'))(_0x2a28('0x3'));var _=require('lodash');var cmHopper=require(_0x2a28('0x4'));var cmHopperFinal=require(_0x2a28('0x5'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x2a28('0x6'));var voiceQueueRt=require(_0x2a28('0x7'));var agentReportPreview=require(_0x2a28('0x8'));var voiceQueueReport=require(_0x2a28('0x9'));function loggerCatch(_0x50435b){return function(_0x1d6b04){logger[_0x2a28('0xa')](_0x50435b,util[_0x2a28('0xb')](_0x1d6b04,{'showHidden':![],'depth':null}));};}function create(_0x1e2fee){return BPromise[_0x2a28('0xc')]()[_0x2a28('0xd')](cmHopperHistory[_0x2a28('0xe')](_0x1e2fee))['catch'](loggerCatch(_0x2a28('0xf')));}function createAgent(_0x31b631){return BPromise[_0x2a28('0xc')]()[_0x2a28('0xd')](agentReportPreview['createHistory'](_0x31b631))[_0x2a28('0x10')](loggerCatch(_0x2a28('0xf')));}function moveContact(_0x302428){return BPromise[_0x2a28('0xc')]()[_0x2a28('0xd')](cmHopper[_0x2a28('0x11')](_0x302428,!![]))[_0x2a28('0x10')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x2a28('0x12')]=function(_0x4552c2){return BPromise[_0x2a28('0xc')]()[_0x2a28('0xd')](cmHopperBlack[_0x2a28('0x12')](_0x4552c2))[_0x2a28('0x10')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x2a28('0x13')]=function(_0x4d74a8){return BPromise[_0x2a28('0xc')]()[_0x2a28('0xd')](cmHopper[_0x2a28('0x13')](_0x4d74a8))[_0x2a28('0x10')](loggerCatch('[getContactPreview]\x20'));};exports['createHistory']=function(_0x555f7f,_0x3afee8){create(_0x555f7f)[_0x2a28('0x10')](loggerCatch(_0x3afee8));moveContact(_0x555f7f)[_0x2a28('0x10')](loggerCatch(_0x3afee8));};exports['createAgentHistory']=function(_0x4f2470,_0x5717ce){createAgent(_0x4f2470)[_0x2a28('0x10')](loggerCatch(_0x5717ce));};exports['createCustomerHistory']=function(_0x37167c,_0x23a157){create(_0x37167c)[_0x2a28('0x10')](loggerCatch(_0x23a157));};exports[_0x2a28('0x14')]=function(_0x5b9f53,_0x31bf26){moveContact(_0x5b9f53)['catch'](loggerCatch(_0x31bf26));};exports[_0x2a28('0x15')]=function(_0x15a40a,_0x169226,_0x2227e5){if(_0x169226){_0x15a40a[_0x2a28('0x16')]=null;}if(_0x2227e5){_0x15a40a[_0x2a28('0x17')]=![];}return BPromise['resolve']()[_0x2a28('0xd')](cmHopper[_0x2a28('0x15')](_0x15a40a))['catch'](loggerCatch(_0x2a28('0x18')));};exports[_0x2a28('0x19')]=function(_0x18b66d){return BPromise['resolve']()['then'](cmHopper['countReScheduled'](_0x18b66d))[_0x2a28('0x10')](loggerCatch(_0x2a28('0x1a')));};exports[_0x2a28('0x1b')]=function(_0x12eb3d){return BPromise[_0x2a28('0xc')]()['then'](cmHopper[_0x2a28('0x1b')]({'UserId':null},_0x12eb3d,0x1))[_0x2a28('0x10')](loggerCatch(_0x2a28('0x1c')));};exports['disableContact']=function(_0x204f4e){return BPromise[_0x2a28('0xc')]()[_0x2a28('0xd')](cmHopper[_0x2a28('0x1b')]({'active':![]},_0x204f4e,0x1))[_0x2a28('0x10')](loggerCatch(_0x2a28('0x1d')));};exports['crateCustomerReportQueue']=function(_0x1dbb46){var _0x556a5a={};_0x556a5a[_0x2a28('0x1e')]=_0x1dbb46[_0x2a28('0x1e')];_0x556a5a[_0x2a28('0x1f')]=_0x1dbb46['uniqueid'];_0x556a5a['calleridnum']=_0x1dbb46[_0x2a28('0x20')];_0x556a5a['calleridname']=_0x1dbb46[_0x2a28('0x21')];_0x556a5a['queue']=_0x1dbb46[_0x2a28('0x22')];_0x556a5a[_0x2a28('0x23')]=_0x1dbb46[_0x2a28('0x24')];_0x556a5a[_0x2a28('0x25')]=_0x1dbb46['answertime'];_0x556a5a[_0x2a28('0x26')]=0x1;_0x556a5a['queuecallercompleteAt']=_0x1dbb46[_0x2a28('0x27')];_0x556a5a[_0x2a28('0x28')]=_0x1dbb46[_0x2a28('0x29')];_0x556a5a['context']='from-sip';_0x556a5a['exten']=_0x2a28('0x2a');_0x556a5a[_0x2a28('0x2b')]=0x0;_0x556a5a[_0x2a28('0x2c')]=0x1;_0x556a5a['lastAssignedTo']=_0x1dbb46[_0x2a28('0x29')];_0x556a5a[_0x2a28('0x2d')]='COMPLETED';return BPromise[_0x2a28('0xc')]()['then'](voiceQueueReport['create'](_0x556a5a))[_0x2a28('0x10')](loggerCatch(_0x2a28('0x2e')));};exports[_0x2a28('0x2f')]=function(_0x5dd678,_0x1e10be){return BPromise[_0x2a28('0xc')]()['then'](cmHopper['getContactRecallMe'](_0x5dd678,_0x1e10be))[_0x2a28('0x10')](loggerCatch(_0x2a28('0x30')));};exports[_0x2a28('0x31')]=function(_0x49e046){return BPromise['resolve']()['then'](cmHopper[_0x2a28('0x15')](_0x49e046,!![],!![]))[_0x2a28('0x10')](loggerCatch(_0x2a28('0x32')));}; \ 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 6917794..e8d5d26 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 _0xf06a=['clone','scheduledAt','active','scheduledat','add','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','lastevent','queue','motionChannel','voice','mandatoryDisposition','buildAcw','interface','agentReadyId','not_inuse','reachable','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','countglobal','callback','callbackuniqueid','recallme','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','info','loggerError','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','monitor_format','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','tags','createdAt','updatedAt','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','statedesc','Blacklist','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','channelAgent','from-sip','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction'];(function(_0x10d3c2,_0x1f5142){var _0x4208aa=function(_0x2e1ff9){while(--_0x2e1ff9){_0x10d3c2['push'](_0x10d3c2['shift']());}};_0x4208aa(++_0x1f5142);}(_0xf06a,0x162));var _0xaf06=function(_0x4e1857,_0x2a6ccc){_0x4e1857=_0x4e1857-0x0;var _0x2ddd26=_0xf06a[_0x4e1857];return _0x2ddd26;};'use strict';var util=require(_0xaf06('0x0'));var _=require(_0xaf06('0x1'));var moment=require(_0xaf06('0x2'));var logger=require('../../../../config/logger')(_0xaf06('0x3'));var ipAgi=process[_0xaf06('0x4')][_0xaf06('0x5')]||_0xaf06('0x6');function getSeconds(_0x56ab5f,_0xaff3b3){var _0x231223=moment(_0x56ab5f)[_0xaf06('0x7')](0x0);var _0x47fc9a=moment(_0xaff3b3)[_0xaf06('0x7')](0x0);return _0x231223[_0xaf06('0x8')](_0x47fc9a,_0xaf06('0x9'));}exports[_0xaf06('0xa')]=function(_0x1a362b){return function(_0xc342cf){logger[_0xaf06('0xb')](_0x1a362b,util[_0xaf06('0xc')](_0xc342cf,{'showHidden':![],'depth':null}));};};exports[_0xaf06('0xd')]=function(_0xaa0805,_0x35a81c){logger[_0xaf06('0xe')](_0xaa0805,util['inspect'](_0x35a81c,{'showHidden':![],'depth':null}));};exports[_0xaf06('0xf')]=function(_0xbe75f0,_0x4414d5){logger[_0xaf06('0xb')](_0xbe75f0,util[_0xaf06('0xc')](_0x4414d5,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0xfaa2fb){return function(_0x40be7f){logger[_0xaf06('0xe')](_0xfaa2fb,util['inspect'](_0x40be7f,{'showHidden':![],'depth':null}));};};exports[_0xaf06('0x10')]=function(_0x44b73d,_0x2a18bb,_0x60eb6a){return{'message':_0x44b73d,'unlock':_0x2a18bb,'active':_0x60eb6a};};exports[_0xaf06('0x11')]=function(_0x488938,_0x57e66b,_0x8a349f){if(!_[_0xaf06('0x12')](_0x8a349f)&&_0xaf06('0x13')===typeof _0x8a349f&&!_['isEmpty'](_0x8a349f)){if(!_[_0xaf06('0x12')](_0x57e66b)&&_0xaf06('0x13')===typeof _0x57e66b&&!_[_0xaf06('0x14')](_0x57e66b)){return util[_0xaf06('0x15')](_0xaf06('0x16'),_0x57e66b,_0x8a349f);}return util[_0xaf06('0x15')](_0xaf06('0x16'),_0x8a349f,_0x8a349f);}if(!_['isUndefined'](_0x488938)&&_0xaf06('0x13')===typeof _0x488938&&!_[_0xaf06('0x14')](_0x488938)){return _0x488938;}return _0xaf06('0x17');};exports[_0xaf06('0x18')]=function(_0x2d8dac){if(_['isNil'](_0x2d8dac)){return![];}return _0x2d8dac;};exports[_0xaf06('0x19')]=function(_0x4c17ba,_0x236e07,_0x154062,_0x1b60b0,_0x49cf1,_0x2aa042){var _0x2c4e4a={'XMD-QUEUE':_0x236e07[_0xaf06('0x1a')]?_0x236e07['Queue'][_0xaf06('0x1b')]:'','XMD-CALLERID':_0x1b60b0,'XMD-CALLERID-PREVIEW':_0x2aa042?util[_0xaf06('0x15')](_0xaf06('0x16'),_0x2aa042[_0xaf06('0x1c')],_0x2aa042[_0xaf06('0x1d')]):_0x1b60b0,'XMD-DIALID':_0x49cf1,'XMD-CONTACTID':_0x236e07[_0xaf06('0x1e')],'XMD-CDRTYPE':_0xaf06('0x1f'),'CALLERID(all)':_0x1b60b0,'XMD-VOICEQUEUEID':_0x236e07[_0xaf06('0x20')],'XMD-DIALCHANNEL':_0x154062,'XMD-DIALTIMEOUT':_0x4c17ba[_0xaf06('0x21')]||0x1e,'XMD-DIALOPTIONS':util[_0xaf06('0x15')](_0xaf06('0x22'),_0x4c17ba['dialQueueProject2']?'g':'',_[_0xaf06('0x14')](_0x4c17ba['monitor_format'])?'':_0xaf06('0x23')),'XMD-DIALURL':_0x4c17ba[_0xaf06('0x24')]||'','XMD-AGI':_0x4c17ba[_0xaf06('0x25')]?util[_0xaf06('0x15')](_0xaf06('0x26'),ipAgi,_0x4c17ba[_0xaf06('0x25')]):_0xaf06('0x27'),'XMD-AGIAFTER':_0x4c17ba[_0xaf06('0x28')]?util['format'](_0xaf06('0x26'),ipAgi,_0x4c17ba['dialQueueProject2']):'NONE','XMD-ORIGINATECALLERIDNUM':_0x2aa042?_0x2aa042[_0xaf06('0x29')]:'','XMD-ORIGINATECALLERIDNAME':_0x2aa042?_0x2aa042[_0xaf06('0x2a')]:'','XMD-DESTINATION':_0xaf06('0x2b'),'SIPADDHEADER':_0xaf06('0x2c')};if(!_[_0xaf06('0x14')](_0x4c17ba['monitor_format'])){_0x2c4e4a[util[_0xaf06('0x15')]('%s',_0xaf06('0x2d'))]=_0x4c17ba[_0xaf06('0x2e')];_0x2c4e4a[util['format']('%s',_0xaf06('0x2f'))]=_0x49cf1;}if(_0x236e07&&_0x236e07[_0xaf06('0x30')]){for(var _0x5c95bd in _0x236e07['Contact']){if(_0x236e07[_0xaf06('0x30')][_0xaf06('0x31')](_0x5c95bd)){if(!_[_0xaf06('0x32')](_0x236e07['Contact'][_0x5c95bd])&&_0x5c95bd!=='id'&&_0x5c95bd!==_0xaf06('0x33')&&_0x5c95bd!==_0xaf06('0x34')&&_0x5c95bd!==_0xaf06('0x35')){_0x2c4e4a[util[_0xaf06('0x15')]('%s%s',_0xaf06('0x36'),_[_0xaf06('0x37')](_0x5c95bd))]=_0x236e07['Contact'][_0x5c95bd];}}}}return _0x2c4e4a;};exports[_0xaf06('0x38')]=function(_0xc7b003){var _0x39abde={};for(var _0x53a95e in _0xc7b003){if(_0xc7b003[_0xaf06('0x31')](_0x53a95e)){_0x39abde[util[_0xaf06('0x15')]('%s',_[_0xaf06('0x39')](_0x53a95e))]=_0xc7b003[_0x53a95e];}}return{'variables':_0x39abde};};exports[_0xaf06('0x3a')]=function(_0x321c6d,_0x1ea8c1){if(!_[_0xaf06('0x32')](_0x321c6d)){if(_0x321c6d[_0xaf06('0x31')](_0xaf06('0x3b'))){if(_0x321c6d[_0xaf06('0x3b')]>0x0){_0x321c6d[_0xaf06('0x3b')]-=0x1;}else{logger['error'](_0xaf06('0x3c'),_0x1ea8c1);}}}else{logger[_0xaf06('0xb')](_0xaf06('0x3d'),_0x1ea8c1);}};exports[_0xaf06('0x3e')]=function(_0x3e9366){var _0x12ab28=moment()[_0xaf06('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x3e9366[_0xaf06('0x3f')]=0xd;_0x3e9366[_0xaf06('0x40')]=_0xaf06('0x41');_0x3e9366[_0xaf06('0x42')]=_0x12ab28;_0x3e9366[_0xaf06('0x43')]=_0x12ab28;_0x3e9366[_0xaf06('0x44')]=_0x12ab28;};exports['logAgent']=function(_0x469e7c,_0x5c0143,_0x8364e5){var _0x28d430=moment()[_0xaf06('0x15')](_0xaf06('0x45'));_0x469e7c[_0xaf06('0x3f')]=_0x5c0143;_0x469e7c[_0xaf06('0x40')]=_0x8364e5;_0x469e7c[_0xaf06('0x43')]=_0x28d430;_0x469e7c[_0xaf06('0x46')]=getSeconds(_0x469e7c[_0xaf06('0x43')],_0x469e7c['starttime']);};exports['logLookAgent']=function(_0x46b68a,_0x490ae4,_0x3794d1){_0x46b68a[_0xaf06('0x47')]=_0x490ae4;_0x46b68a[_0xaf06('0x48')]=_0x3794d1;};exports[_0xaf06('0x49')]=function(_0x58bc1d,_0x4ebb74,_0x3cfb1f){var _0x3f9730=moment()[_0xaf06('0x15')](_0xaf06('0x45'));_0x58bc1d['state']=_0x4ebb74;_0x58bc1d[_0xaf06('0x40')]=_0x3cfb1f;_0x58bc1d[_0xaf06('0x43')]=_0x58bc1d[_0xaf06('0x43')]?_0x58bc1d[_0xaf06('0x43')]:_0x3f9730;_0x58bc1d[_0xaf06('0x44')]=_0x58bc1d['endtime']?_0x58bc1d[_0xaf06('0x44')]:_0x3f9730;_0x58bc1d[_0xaf06('0x46')]=getSeconds(_0x58bc1d[_0xaf06('0x43')]||0x0,_0x58bc1d[_0xaf06('0x42')]||0x0);_0x58bc1d[_0xaf06('0x4a')]=_0x58bc1d[_0xaf06('0x4b')]?getSeconds(_0x58bc1d[_0xaf06('0x44')],_0x58bc1d[_0xaf06('0x4b')]):0x0;};exports[_0xaf06('0x4c')]=function(_0x5c3886){return _0x5c3886===_0xaf06('0x4d');};exports[_0xaf06('0x4e')]=function(_0xda4fd,_0x173cf7,_0x9cc1cc,_0x55a6d7,_0x3aee97){var _0x3784af=_0x55a6d7?_0xaf06('0x4f'):_0xda4fd[_0xaf06('0x1c')];_0x3784af=_0x3aee97?_0xaf06('0x50'):_0x3784af;return{'actionid':_0xda4fd[_0xaf06('0x51')],'action':'originate','channel':_0xda4fd[_0xaf06('0x52')],'callerid':util['format'](_0xaf06('0x16'),_0x3784af,_0xda4fd['calleridnum']),'Exten':_0xaf06('0x2b'),'Context':_0xaf06('0x53'),'Priority':'1','variable':_0x9cc1cc,'timeout':(_0x173cf7['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0xda4fd[_0xaf06('0x51')]};};exports[_0xaf06('0x54')]=function(_0x1e00f1){return _0x1e00f1[_0xaf06('0x55')]+_0x1e00f1['countcongestionretry']+_0x1e00f1[_0xaf06('0x56')]+_0x1e00f1[_0xaf06('0x57')]+_0x1e00f1[_0xaf06('0x58')];};exports[_0xaf06('0x59')]=function(_0x565b36){var _0x36b9f9=_[_0xaf06('0x5a')](_0x565b36);_0x36b9f9[_0xaf06('0x3f')]=0xf;_0x36b9f9[_0xaf06('0x40')]='Global';return _0x36b9f9;};exports[_0xaf06('0x5b')]=function(_0x327a9f,_0x292a95,_0x5d8c57){var _0x23975f={};_0x23975f[_0x292a95]=_0x327a9f[_0x292a95];_0x23975f[_0xaf06('0x5c')]=![];_0x23975f[_0xaf06('0x5d')]=moment()[_0xaf06('0x5e')](_0x5d8c57,'minutes')[_0xaf06('0x15')](_0xaf06('0x45'));_0x23975f['ContactId']=_0x327a9f[_0xaf06('0x1e')];_0x23975f[_0xaf06('0x5f')]=_0x327a9f[_0xaf06('0x5f')];_0x23975f['VoiceQueueId']=_0x327a9f[_0xaf06('0x20')]||undefined;return _0x23975f;};exports[_0xaf06('0x60')]=function(_0x5e6f5b,_0x19d832){if(!_[_0xaf06('0x32')](_0x5e6f5b)){if(_0x5e6f5b[_0xaf06('0x61')]>0x0){_0x5e6f5b[_0xaf06('0x61')]-=0x1;}else{logger['error'](_0x19d832,_0xaf06('0x62'));}}else{logger['error'](_0x19d832,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0xaf06('0x63')]=function(_0x2809b8){if(_0x2809b8<=0x0){return!![];}return![];};exports['buildObj']=function(_0x52ec07,_0x48ef96,_0x2b77f7){_0x52ec07[_0xaf06('0x64')]=_0x48ef96;_0x52ec07[_0xaf06('0x1b')]=_0x52ec07[_0xaf06('0x65')];_0x52ec07['interface']=_0x52ec07[_0xaf06('0x52')];_0x52ec07[_0xaf06('0x66')]=_0xaf06('0x67');if(_0x2b77f7){_0x52ec07[_0xaf06('0x68')]=_0x2b77f7[_0xaf06('0x68')];}return _0x52ec07;};exports[_0xaf06('0x69')]=function(_0x1f0c3f){var _0xdeb4f3={};_0xdeb4f3[_0xaf06('0x65')]=_0x1f0c3f[_0xaf06('0x65')];_0xdeb4f3[_0xaf06('0x6a')]=_0x1f0c3f[_0xaf06('0x52')];_0xdeb4f3['uniqueid']=_0x1f0c3f[_0xaf06('0x51')];return _0xdeb4f3;};exports[_0xaf06('0x6b')]=function(_0x2a0046){var _0x5efc64=[];for(var _0x557e30 in _0x2a0046){if(_0x2a0046['hasOwnProperty'](_0x557e30)){if(!_[_0xaf06('0x32')](_0x2a0046[_0x557e30])&&_0x2a0046[_0x557e30][_0xaf06('0x3f')]===_0xaf06('0x6c')&&_0x2a0046[_0x557e30]['status']===_0xaf06('0x6d')){_0x5efc64['push'](_0x2a0046[_0x557e30]['id']);}}}return _0x5efc64;};exports['getDiff']=function(_0x1e67ab){var _0x10517d=moment()[_0xaf06('0x7')](0x0);var _0x201d46=moment(_0x1e67ab)[_0xaf06('0x7')](0x0);return _0x10517d[_0xaf06('0x8')](_0x201d46,'seconds');};exports['createBody']=function(_0x306b9c){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x306b9c[_0xaf06('0x1e')],'ListId':_0x306b9c[_0xaf06('0x5f')],'VoiceQueueId':_0x306b9c['VoiceQueueId']||undefined,'CampaignId':_0x306b9c[_0xaf06('0x6e')]||undefined};};exports[_0xaf06('0x6f')]=function(_0x2b8e00){if(_0x2b8e00==='uniqueid'||_0x2b8e00===_0xaf06('0x70')||_0x2b8e00==='queue'||_0x2b8e00===_0xaf06('0x71')||_0x2b8e00===_0xaf06('0x72')||_0x2b8e00===_0xaf06('0x73')||_0x2b8e00===_0xaf06('0x47')||_0x2b8e00===_0xaf06('0x52')||_0x2b8e00==='calleridname'||_0x2b8e00==='active'||_0x2b8e00===_0xaf06('0x1d')||_0x2b8e00==='scheduledat'||_0x2b8e00===_0xaf06('0x55')||_0x2b8e00==='countcongestionretry'||_0x2b8e00===_0xaf06('0x56')||_0x2b8e00===_0xaf06('0x74')||_0x2b8e00===_0xaf06('0x75')||_0x2b8e00===_0xaf06('0x76')||_0x2b8e00==='callbackat'||_0x2b8e00===_0xaf06('0x77')||_0x2b8e00===_0xaf06('0x1e')||_0x2b8e00==='ListId'||_0x2b8e00===_0xaf06('0x48')||_0x2b8e00===_0xaf06('0x20')||_0x2b8e00==='sipcallid'||_0x2b8e00===_0xaf06('0x78')||_0x2b8e00===_0xaf06('0x79')||_0x2b8e00===_0xaf06('0x7a')||_0x2b8e00==='xmd-listid'||_0x2b8e00===_0xaf06('0x7b')||_0x2b8e00===_0xaf06('0x7c')||_0x2b8e00===_0xaf06('0x7d')||_0x2b8e00===_0xaf06('0x7e')||_0x2b8e00===_0xaf06('0x7f')||_0x2b8e00===_0xaf06('0x80')||_0x2b8e00==='xmd-cdrtype'||_0x2b8e00===_0xaf06('0x81')||_0x2b8e00===_0xaf06('0x82')||_0x2b8e00===_0xaf06('0x83')||_0x2b8e00===_0xaf06('0x84')||_0x2b8e00===_0xaf06('0x85')||_0x2b8e00===_0xaf06('0x86')||_0x2b8e00===_0xaf06('0x87')||_0x2b8e00===_0xaf06('0x88')||_0x2b8e00===_0xaf06('0x89')||_0x2b8e00==='rtpaudioqosrtt'||_0x2b8e00===_0xaf06('0x8a')||_0x2b8e00==='rtpaudioqos'||_0x2b8e00===_0xaf06('0x85')||_0x2b8e00===_0xaf06('0x86')||_0x2b8e00==='rtpaudioqosjitterbridged'||_0x2b8e00===_0xaf06('0x88')||_0x2b8e00==='rtpaudioqoslossbridged'||_0x2b8e00===_0xaf06('0x8b')||_0x2b8e00===_0xaf06('0x8a')||_0x2b8e00===_0xaf06('0x8c')||_0x2b8e00===_0xaf06('0x8d')||_0x2b8e00===_0xaf06('0x3f')||_0x2b8e00===_0xaf06('0x40')){return![];}return!![];};exports[_0xaf06('0x8e')]=function(_0x316d54,_0xc65ed3){var _0x27e9c2,_0x135089,_0x37bffd;if(_0xc65ed3<=0x0){_0xc65ed3=0x1;}_0x27e9c2=new RegExp(_0xaf06('0x8f')+_0xc65ed3+'}$');_0x135089=Math['pow'](0xa,_0xc65ed3-0x1);_0x37bffd=Math['pow'](0xa,_0xc65ed3)-0x1;return util[_0xaf06('0x15')]('%s',_['replace'](_0x316d54,_0x27e9c2,_[_0xaf06('0x90')](_0x135089,_0x37bffd)));};exports[_0xaf06('0x91')]=function(_0x4b797f){var _0x24aa1a=_0x4b797f[_0xaf06('0x92')](/"(.*?)"/);return _0x24aa1a?_0x24aa1a[0x1]:_0x4b797f;};exports[_0xaf06('0x93')]=function(_0x59b972){var _0x525955=_0x59b972[_0xaf06('0x92')](/<(.*?)>/);return _0x525955?_0x525955[0x1]:_0x59b972;}; \ No newline at end of file +var _0xa76e=['seconds','inspect','logger','info','error','message','isEmpty','isUndefined','string','\x22%s\x22\x20<%s>','format','isNil','Queue','name','calleridnum','ContactId','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','dialQueueProject2','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','hasOwnProperty','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','ringtime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','timeout','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','clone','Global','active','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','buildObj','lastevent','queue','interface','motionChannel','mandatoryDisposition','buildAcw','reachable','getDiff','createBody','filterKey','campaigntype','dialAnswer','channelAgent','calleridname','scheduledat','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialoptions','xmd-dialid','xmd-cdrtype','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','pow','replace','random','match','util','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','milliseconds'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa76e,0x7d));var _0xea76=function(_0x3cc9d9,_0x69ed38){_0x3cc9d9=_0x3cc9d9-0x0;var _0x1a425d=_0xa76e[_0x3cc9d9];return _0x1a425d;};'use strict';var util=require(_0xea76('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0xea76('0x1'))(_0xea76('0x2'));var ipAgi=process['env'][_0xea76('0x3')]||_0xea76('0x4');function getSeconds(_0x4cab3b,_0xcb85a6){var _0x37d587=moment(_0x4cab3b)[_0xea76('0x5')](0x0);var _0x29306d=moment(_0xcb85a6)['milliseconds'](0x0);return _0x37d587['diff'](_0x29306d,_0xea76('0x6'));}exports['loggerCatch']=function(_0x198e9b){return function(_0x340230){logger['error'](_0x198e9b,util[_0xea76('0x7')](_0x340230,{'showHidden':![],'depth':null}));};};exports[_0xea76('0x8')]=function(_0x5c4fde,_0x35682c){logger[_0xea76('0x9')](_0x5c4fde,util['inspect'](_0x35682c,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x268c94,_0x7bd8bf){logger[_0xea76('0xa')](_0x268c94,util[_0xea76('0x7')](_0x7bd8bf,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x272cf0){return function(_0x27fe4d){logger[_0xea76('0x9')](_0x272cf0,util['inspect'](_0x27fe4d,{'showHidden':![],'depth':null}));};};exports[_0xea76('0xb')]=function(_0x229497,_0x3c46,_0x4ea833){return{'message':_0x229497,'unlock':_0x3c46,'active':_0x4ea833};};exports['getCallerId']=function(_0x1beb23,_0x470c4b,_0x3f8937){if(!_['isUndefined'](_0x3f8937)&&'string'===typeof _0x3f8937&&!_[_0xea76('0xc')](_0x3f8937)){if(!_[_0xea76('0xd')](_0x470c4b)&&_0xea76('0xe')===typeof _0x470c4b&&!_[_0xea76('0xc')](_0x470c4b)){return util['format'](_0xea76('0xf'),_0x470c4b,_0x3f8937);}return util[_0xea76('0x10')](_0xea76('0xf'),_0x3f8937,_0x3f8937);}if(!_['isUndefined'](_0x1beb23)&&_0xea76('0xe')===typeof _0x1beb23&&!_['isEmpty'](_0x1beb23)){return _0x1beb23;}return'\x22\x22\x20<>';};exports['isActive']=function(_0x1db1ab){if(_[_0xea76('0x11')](_0x1db1ab)){return![];}return _0x1db1ab;};exports['addVariables']=function(_0x25a1a8,_0x46f91f,_0x33cb12,_0x476ea8,_0x2cda79,_0x332650){var _0xba5e48={'XMD-QUEUE':_0x46f91f[_0xea76('0x12')]?_0x46f91f[_0xea76('0x12')][_0xea76('0x13')]:'','XMD-CALLERID':_0x476ea8,'XMD-CALLERID-PREVIEW':_0x332650?util[_0xea76('0x10')](_0xea76('0xf'),_0x332650['calleridname'],_0x332650[_0xea76('0x14')]):_0x476ea8,'XMD-DIALID':_0x2cda79,'XMD-CONTACTID':_0x46f91f[_0xea76('0x15')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x476ea8,'XMD-VOICEQUEUEID':_0x46f91f[_0xea76('0x16')],'XMD-DIALCHANNEL':_0x33cb12,'XMD-DIALTIMEOUT':_0x25a1a8[_0xea76('0x17')]||0x1e,'XMD-DIALOPTIONS':util[_0xea76('0x10')](_0xea76('0x18'),_0x25a1a8['dialQueueProject2']?'g':'',_[_0xea76('0xc')](_0x25a1a8['monitor_format'])?'':_0xea76('0x19')),'XMD-DIALURL':_0x25a1a8[_0xea76('0x1a')]||'','XMD-AGI':_0x25a1a8[_0xea76('0x1b')]?util[_0xea76('0x10')]('\x22agi://%s/square,%s\x22',ipAgi,_0x25a1a8['dialQueueProject']):_0xea76('0x1c'),'XMD-AGIAFTER':_0x25a1a8[_0xea76('0x1d')]?util[_0xea76('0x10')](_0xea76('0x1e'),ipAgi,_0x25a1a8[_0xea76('0x1d')]):_0xea76('0x1c'),'XMD-ORIGINATECALLERIDNUM':_0x332650?_0x332650[_0xea76('0x1f')]:'','XMD-ORIGINATECALLERIDNAME':_0x332650?_0x332650[_0xea76('0x20')]:'','XMD-DESTINATION':_0xea76('0x21'),'SIPADDHEADER':_0xea76('0x22')};if(!_[_0xea76('0xc')](_0x25a1a8[_0xea76('0x23')])){_0xba5e48[util[_0xea76('0x10')]('%s',_0xea76('0x24'))]=_0x25a1a8[_0xea76('0x23')];_0xba5e48[util[_0xea76('0x10')]('%s',_0xea76('0x25'))]=_0x2cda79;}if(_0x46f91f&&_0x46f91f[_0xea76('0x26')]){for(var _0x55de97 in _0x46f91f[_0xea76('0x26')]){if(_0x46f91f[_0xea76('0x26')]['hasOwnProperty'](_0x55de97)){if(!_[_0xea76('0x11')](_0x46f91f[_0xea76('0x26')][_0x55de97])&&_0x55de97!=='id'&&_0x55de97!=='tags'&&_0x55de97!==_0xea76('0x27')&&_0x55de97!==_0xea76('0x28')){_0xba5e48[util[_0xea76('0x10')](_0xea76('0x29'),_0xea76('0x2a'),_[_0xea76('0x2b')](_0x55de97))]=_0x46f91f[_0xea76('0x26')][_0x55de97];}}}}return _0xba5e48;};exports[_0xea76('0x2c')]=function(_0x1514fe){var _0xde3893={};for(var _0x59ea58 in _0x1514fe){if(_0x1514fe[_0xea76('0x2d')](_0x59ea58)){_0xde3893[util[_0xea76('0x10')]('%s',_['toLower'](_0x59ea58))]=_0x1514fe[_0x59ea58];}}return{'variables':_0xde3893};};exports[_0xea76('0x2e')]=function(_0xa7eb20,_0x164be6){if(!_[_0xea76('0x11')](_0xa7eb20)){if(_0xa7eb20[_0xea76('0x2d')](_0xea76('0x2f'))){if(_0xa7eb20['originated']>0x0){_0xa7eb20[_0xea76('0x2f')]-=0x1;}else{logger[_0xea76('0xa')](_0xea76('0x30'),_0x164be6);}}}else{logger[_0xea76('0xa')](_0xea76('0x31'),_0x164be6);}};exports[_0xea76('0x32')]=function(_0x5b8307){var _0x17107f=moment()[_0xea76('0x10')](_0xea76('0x33'));_0x5b8307[_0xea76('0x34')]=0xd;_0x5b8307[_0xea76('0x35')]=_0xea76('0x36');_0x5b8307[_0xea76('0x37')]=_0x17107f;_0x5b8307[_0xea76('0x38')]=_0x17107f;_0x5b8307[_0xea76('0x39')]=_0x17107f;};exports['logAgent']=function(_0x3d827b,_0x2e9e6b,_0x15d744){var _0x56de60=moment()[_0xea76('0x10')](_0xea76('0x33'));_0x3d827b[_0xea76('0x34')]=_0x2e9e6b;_0x3d827b[_0xea76('0x35')]=_0x15d744;_0x3d827b[_0xea76('0x38')]=_0x56de60;_0x3d827b[_0xea76('0x3a')]=getSeconds(_0x3d827b[_0xea76('0x38')],_0x3d827b[_0xea76('0x37')]);};exports[_0xea76('0x3b')]=function(_0x1a4f4b,_0x171467,_0x726278){_0x1a4f4b[_0xea76('0x3c')]=_0x171467;_0x1a4f4b[_0xea76('0x3d')]=_0x726278;};exports[_0xea76('0x3e')]=function(_0x3cd051,_0x5e20ce,_0xf98cff){var _0x48c9bb=moment()[_0xea76('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x3cd051[_0xea76('0x34')]=_0x5e20ce;_0x3cd051['statedesc']=_0xf98cff;_0x3cd051['responsetime']=_0x3cd051[_0xea76('0x38')]?_0x3cd051[_0xea76('0x38')]:_0x48c9bb;_0x3cd051[_0xea76('0x39')]=_0x3cd051[_0xea76('0x39')]?_0x3cd051[_0xea76('0x39')]:_0x48c9bb;_0x3cd051[_0xea76('0x3a')]=getSeconds(_0x3cd051[_0xea76('0x38')]||0x0,_0x3cd051[_0xea76('0x37')]||0x0);_0x3cd051[_0xea76('0x3f')]=_0x3cd051[_0xea76('0x40')]?getSeconds(_0x3cd051[_0xea76('0x39')],_0x3cd051[_0xea76('0x40')]):0x0;};exports[_0xea76('0x41')]=function(_0x104b68){return _0x104b68===_0xea76('0x42');};exports[_0xea76('0x43')]=function(_0x116a90,_0x30c495,_0xa5466d,_0x3a6325,_0x31bbc6){var _0x5cff26=_0x3a6325?_0xea76('0x44'):_0x116a90['calleridname'];_0x5cff26=_0x31bbc6?_0xea76('0x45'):_0x5cff26;return{'actionid':_0x116a90[_0xea76('0x46')],'action':_0xea76('0x47'),'channel':_0x116a90['channelAgent'],'callerid':util[_0xea76('0x10')]('\x22%s\x22\x20<%s>',_0x5cff26,_0x116a90['calleridnum']),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0xa5466d,'timeout':(_0x30c495[_0xea76('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x116a90['uniqueid']};};exports[_0xea76('0x49')]=function(_0x54f06e){return _0x54f06e[_0xea76('0x4a')]+_0x54f06e[_0xea76('0x4b')]+_0x54f06e['countnoanswerretry']+_0x54f06e[_0xea76('0x4c')]+_0x54f06e[_0xea76('0x4d')];};exports['cloneAction']=function(_0x2520d6){var _0x51a9d7=_[_0xea76('0x4e')](_0x2520d6);_0x51a9d7['state']=0xf;_0x51a9d7[_0xea76('0x35')]=_0xea76('0x4f');return _0x51a9d7;};exports['scheduledAt']=function(_0x28591a,_0x29d5b2,_0x1c7c4f){var _0xdebe71={};_0xdebe71[_0x29d5b2]=_0x28591a[_0x29d5b2];_0xdebe71[_0xea76('0x50')]=![];_0xdebe71['scheduledat']=moment()['add'](_0x1c7c4f,_0xea76('0x51'))['format'](_0xea76('0x33'));_0xdebe71[_0xea76('0x15')]=_0x28591a['ContactId'];_0xdebe71[_0xea76('0x52')]=_0x28591a['ListId'];_0xdebe71['VoiceQueueId']=_0x28591a[_0xea76('0x16')]||undefined;return _0xdebe71;};exports[_0xea76('0x53')]=function(_0x6de40c,_0x364ad2){if(!_[_0xea76('0x11')](_0x6de40c)){if(_0x6de40c[_0xea76('0x54')]>0x0){_0x6de40c[_0xea76('0x54')]-=0x1;}else{logger['error'](_0x364ad2,_0xea76('0x55'));}}else{logger['error'](_0x364ad2,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0xea76('0x56')]=function(_0x384c33){if(_0x384c33<=0x0){return!![];}return![];};exports[_0xea76('0x57')]=function(_0x448364,_0x5a7ec8,_0x1a46b6){_0x448364[_0xea76('0x58')]=_0x5a7ec8;_0x448364[_0xea76('0x13')]=_0x448364[_0xea76('0x59')];_0x448364[_0xea76('0x5a')]=_0x448364['channelAgent'];_0x448364[_0xea76('0x5b')]='voice';if(_0x1a46b6){_0x448364[_0xea76('0x5c')]=_0x1a46b6['mandatoryDisposition'];}return _0x448364;};exports[_0xea76('0x5d')]=function(_0x5e1d97){var _0x4adb64={};_0x4adb64['queue']=_0x5e1d97[_0xea76('0x59')];_0x4adb64[_0xea76('0x5a')]=_0x5e1d97['channelAgent'];_0x4adb64[_0xea76('0x46')]=_0x5e1d97['uniqueid'];return _0x4adb64;};exports['agentReadyId']=function(_0x2030d0){var _0x5173f6=[];for(var _0x57be01 in _0x2030d0){if(_0x2030d0[_0xea76('0x2d')](_0x57be01)){if(!_[_0xea76('0x11')](_0x2030d0[_0x57be01])&&_0x2030d0[_0x57be01][_0xea76('0x34')]==='not_inuse'&&_0x2030d0[_0x57be01]['status']===_0xea76('0x5e')){_0x5173f6['push'](_0x2030d0[_0x57be01]['id']);}}}return _0x5173f6;};exports[_0xea76('0x5f')]=function(_0x5583a6){var _0x213087=moment()['milliseconds'](0x0);var _0x1a0ac5=moment(_0x5583a6)[_0xea76('0x5')](0x0);return _0x213087['diff'](_0x1a0ac5,'seconds');};exports[_0xea76('0x60')]=function(_0x207a4a){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x207a4a[_0xea76('0x15')],'ListId':_0x207a4a[_0xea76('0x52')],'VoiceQueueId':_0x207a4a[_0xea76('0x16')]||undefined,'CampaignId':_0x207a4a['CampaignId']||undefined};};exports[_0xea76('0x61')]=function(_0x1339da){if(_0x1339da===_0xea76('0x46')||_0x1339da==='idContact'||_0x1339da===_0xea76('0x59')||_0x1339da==='type'||_0x1339da===_0xea76('0x62')||_0x1339da===_0xea76('0x63')||_0x1339da===_0xea76('0x3c')||_0x1339da===_0xea76('0x64')||_0x1339da===_0xea76('0x65')||_0x1339da===_0xea76('0x50')||_0x1339da===_0xea76('0x14')||_0x1339da===_0xea76('0x66')||_0x1339da===_0xea76('0x4a')||_0x1339da===_0xea76('0x4b')||_0x1339da==='countnoanswerretry'||_0x1339da===_0xea76('0x67')||_0x1339da===_0xea76('0x68')||_0x1339da===_0xea76('0x69')||_0x1339da===_0xea76('0x6a')||_0x1339da===_0xea76('0x6b')||_0x1339da===_0xea76('0x15')||_0x1339da==='ListId'||_0x1339da===_0xea76('0x3d')||_0x1339da===_0xea76('0x16')||_0x1339da===_0xea76('0x6c')||_0x1339da===_0xea76('0x6d')||_0x1339da===_0xea76('0x6e')||_0x1339da===_0xea76('0x6f')||_0x1339da===_0xea76('0x70')||_0x1339da==='xmd-dialurl'||_0x1339da==='xmd-dialtimeout'||_0x1339da===_0xea76('0x71')||_0x1339da===_0xea76('0x72')||_0x1339da==='xmd-dialchannel'||_0x1339da==='xmd-contactid'||_0x1339da===_0xea76('0x73')||_0x1339da==='xmd-callerid'||_0x1339da==='xmd-agiafter'||_0x1339da===_0xea76('0x74')||_0x1339da===_0xea76('0x75')||_0x1339da===_0xea76('0x76')||_0x1339da===_0xea76('0x77')||_0x1339da===_0xea76('0x78')||_0x1339da===_0xea76('0x79')||_0x1339da==='rtpaudioqoslossbridged'||_0x1339da===_0xea76('0x7a')||_0x1339da===_0xea76('0x7b')||_0x1339da===_0xea76('0x75')||_0x1339da===_0xea76('0x76')||_0x1339da===_0xea76('0x77')||_0x1339da===_0xea76('0x78')||_0x1339da===_0xea76('0x79')||_0x1339da===_0xea76('0x7c')||_0x1339da==='rtpaudioqosrtt'||_0x1339da==='rtpaudioqosrttbridged'||_0x1339da===_0xea76('0x7d')||_0x1339da===_0xea76('0x7e')||_0x1339da===_0xea76('0x34')||_0x1339da==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x10bd81,_0x979449){var _0x28a40a,_0x1aebf8,_0x369e93;if(_0x979449<=0x0){_0x979449=0x1;}_0x28a40a=new RegExp('\x5cw{0,'+_0x979449+'}$');_0x1aebf8=Math[_0xea76('0x7f')](0xa,_0x979449-0x1);_0x369e93=Math[_0xea76('0x7f')](0xa,_0x979449)-0x1;return util['format']('%s',_[_0xea76('0x80')](_0x10bd81,_0x28a40a,_[_0xea76('0x81')](_0x1aebf8,_0x369e93)));};exports['extractCalleridName']=function(_0x1b3bbe){var _0x1bb353=_0x1b3bbe[_0xea76('0x82')](/"(.*?)"/);return _0x1bb353?_0x1bb353[0x1]:_0x1b3bbe;};exports['extractCalleridNumber']=function(_0x2416eb){var _0x5f0790=_0x2416eb['match'](/<(.*?)>/);return _0x5f0790?_0x5f0790[0x1]:_0x2416eb;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 8c6cc6d..5db248e 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 _0x7143=['string','number','boolean','queuepause','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x7143,0x147));var _0x3714=function(_0x37e00c,_0x1123b4){_0x37e00c=_0x37e00c-0x0;var _0x136b36=_0x7143[_0x37e00c];return _0x136b36;};'use strict';exports[_0x3714('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x3714('0x1'),'required':!![]},'membername':{'type':_0x3714('0x1'),'required':!![]},'penalty':{'type':_0x3714('0x2'),'required':![]},'paused':{'type':_0x3714('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x3714('0x1'),'required':!![]},'interface':{'type':_0x3714('0x1'),'required':!![]}};exports[_0x3714('0x4')]={'interface':{'type':_0x3714('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x3714('0x1'),'required':![]}};exports['reload']={'module':{'type':_0x3714('0x1'),'required':![]}};exports[_0x3714('0x5')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x3714('0x6')]={'uniqueid':{'type':_0x3714('0x1'),'required':!![]},'filename':{'type':_0x3714('0x1')},'format':{'type':_0x3714('0x1')},'mixmonitorid':{'type':'string'}};exports[_0x3714('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x3714('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x3714('0x1')}}; \ No newline at end of file +var _0x1721=['voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean','voicequeuechannel'];(function(_0x3bfb53,_0x28a5c4){var _0x409dbf=function(_0x103af4){while(--_0x103af4){_0x3bfb53['push'](_0x3bfb53['shift']());}};_0x409dbf(++_0x28a5c4);}(_0x1721,0x1a6));var _0x1172=function(_0xef037e,_0x11c83b){_0xef037e=_0xef037e-0x0;var _0x3c4b8a=_0x1721[_0xef037e];return _0x3c4b8a;};'use strict';exports[_0x1172('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x1172('0x1'),'required':!![]},'membername':{'type':_0x1172('0x1'),'required':!![]},'penalty':{'type':_0x1172('0x2'),'required':![]},'paused':{'type':_0x1172('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x1172('0x1'),'required':!![]},'interface':{'type':_0x1172('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':'string','required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x1172('0x1'),'required':![]}};exports['reload']={'module':{'type':_0x1172('0x1'),'required':![]}};exports[_0x1172('0x4')]={'uniqueid':{'type':_0x1172('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x1172('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':_0x1172('0x1')}};exports[_0x1172('0x5')]={'uniqueid':{'type':_0x1172('0x1'),'required':!![]}};exports[_0x1172('0x6')]={'uniqueid':{'type':_0x1172('0x1'),'required':!![]},'exten':{'type':_0x1172('0x1'),'required':!![]},'context':{'type':_0x1172('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 880b869..7830e99 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 _0xedfd=['zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','mapKeys','format','SIP/%s','name','hasOwnProperty','interface','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isUndefined','agents','initTelephones','initTrunks','voiceQueues','initTriggers','initTemplates','zendeskAccounts','initSalesforceAccounts','salesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','uniqueid','unmanaged','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','total','queuecallercomplete','initVoiceCallReports','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','faxAccounts','exports','bluebird','util','lodash','../model/agent','../model/telephone','../model/trigger','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','settings','sugarcrmAccounts','freshdeskAccounts'];(function(_0x3207aa,_0xe86a72){var _0x51758f=function(_0x9ff790){while(--_0x9ff790){_0x3207aa['push'](_0x3207aa['shift']());}};_0x51758f(++_0xe86a72);}(_0xedfd,0x17e));var _0xdedf=function(_0x1d5400,_0x567e3c){_0x1d5400=_0x1d5400-0x0;var _0x21d9fe=_0xedfd[_0x1d5400];return _0x21d9fe;};'use strict';var BPromise=require(_0xdedf('0x0'));var util=require(_0xdedf('0x1'));var _=require(_0xdedf('0x2'));var moment=require('moment');var Agent=require(_0xdedf('0x3'));var Telephone=require(_0xdedf('0x4'));var Trunk=require('../model/trunk');var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0xdedf('0x5'));var Template=require('../model/template');var Campaign=require(_0xdedf('0x6'));var VoiceExtension=require(_0xdedf('0x7'));var ZendeskAccount=require(_0xdedf('0x8'));var SalesforceAccount=require(_0xdedf('0x9'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0xdedf('0xa'));var DeskAccount=require(_0xdedf('0xb'));var VtigerAccount=require(_0xdedf('0xc'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0xdedf('0xd'));var FreshsalesAccount=require(_0xdedf('0xe'));var FaxAccount=require(_0xdedf('0xf'));var Realtime=function(){this['agents']={};this[_0xdedf('0x10')]={};this[_0xdedf('0x11')]={};this['voiceQueues']={};this[_0xdedf('0x12')]={};this[_0xdedf('0x13')]={};this[_0xdedf('0x14')]={};this[_0xdedf('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xdedf('0x16')]={};this[_0xdedf('0x17')]={};this[_0xdedf('0x18')]={};this[_0xdedf('0x19')]={};this[_0xdedf('0x1a')]={};this[_0xdedf('0x1b')]={};this['zendeskAccounts']={};this['salesforceAccounts']={};this[_0xdedf('0x1c')]={};this[_0xdedf('0x1d')]={};this[_0xdedf('0x1e')]={};this[_0xdedf('0x1f')]={};this[_0xdedf('0x20')]={};this[_0xdedf('0x21')]={};this['dynamics365Accounts']={};this[_0xdedf('0x22')]={};this['faxAccounts']={};};function freeIsNotKey(_0x556574,_0x3bd136,_0x1e8180){var _0x13a18d=_[_0xdedf('0x23')](_0x556574,function(_0x5b19b5,_0x933420){return _0x5b19b5[_0x1e8180];});for(var _0x218bef in _0x3bd136){if(_0x3bd136['hasOwnProperty'](_0x218bef)){if(!_0x13a18d[_0x218bef]){delete _0x3bd136[_0x218bef];}}}}function freeIsNotKeySip(_0x30b282,_0x24ed96){var _0x18dae4=_[_0xdedf('0x23')](_0x30b282,function(_0x54e49f,_0x166313){return util[_0xdedf('0x24')](_0xdedf('0x25'),_0x54e49f[_0xdedf('0x26')]);});for(var _0x55294d in _0x24ed96){if(_0x24ed96[_0xdedf('0x27')](_0x55294d)){if(!_0x18dae4[_0x55294d]){delete _0x24ed96[_0x55294d];}}}}function freeIsNotKeyAgent(_0x3a26e4,_0x1ac090){var _0xad6318=_[_0xdedf('0x23')](_0x3a26e4,function(_0x21c0ca,_0x53a284){var _0x2911fb=_['isNil'](_0x21c0ca['interface'])?util[_0xdedf('0x24')](_0xdedf('0x25'),_0x21c0ca[_0xdedf('0x26')]):_0x21c0ca[_0xdedf('0x28')];return _0x2911fb;});for(var _0x28ce29 in _0x1ac090){if(_0x1ac090[_0xdedf('0x27')](_0x28ce29)){if(!_0xad6318[_0x28ce29]){delete _0x1ac090[_0x28ce29];}}}}function clearVoiceCallReports(_0x141025){_0x141025['total']=0x0;_0x141025[_0xdedf('0x29')]=0x0;_0x141025[_0xdedf('0x2a')]=0x0;_0x141025[_0xdedf('0x2b')]=0x0;_0x141025[_0xdedf('0x2c')]=0x0;}function clearCampaigns(_0x33e2e7){if(!_[_0xdedf('0x2d')](_0x33e2e7)){for(var _0x4e5844 in _0x33e2e7){if(_0x33e2e7[_0xdedf('0x27')](_0x4e5844)){_0x33e2e7[_0x4e5844][_0xdedf('0x2e')]=0x0;_0x33e2e7[_0x4e5844][_0xdedf('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x16f8f9){if(!_[_0xdedf('0x2d')](_0x16f8f9)){for(var _0x3a4412 in _0x16f8f9){if(_0x16f8f9[_0xdedf('0x27')](_0x3a4412)){_0x16f8f9[_0x3a4412]['total']=0x0;_0x16f8f9[_0x3a4412]['answered']=0x0;_0x16f8f9[_0x3a4412]['unmanaged']=0x0;_0x16f8f9[_0x3a4412][_0xdedf('0x30')]=0x0;_0x16f8f9[_0x3a4412][_0xdedf('0x2a')]=0x0;_0x16f8f9[_0x3a4412]['sumDuration']=0x0;_0x16f8f9[_0x3a4412][_0xdedf('0x2c')]=0x0;_0x16f8f9[_0x3a4412][_0xdedf('0x31')]=0x0;_0x16f8f9[_0x3a4412][_0xdedf('0x32')]=0x0;_0x16f8f9[_0x3a4412][_0xdedf('0x33')]=0x0;_0x16f8f9[_0x3a4412]['outboundCongestionCallsDay']=0x0;_0x16f8f9[_0x3a4412][_0xdedf('0x34')]=0x0;_0x16f8f9[_0x3a4412][_0xdedf('0x35')]=0x0;_0x16f8f9[_0x3a4412]['outboundDropCallsDayTimeout']=0x0;_0x16f8f9[_0x3a4412][_0xdedf('0x36')]=0x0;_0x16f8f9[_0x3a4412][_0xdedf('0x37')]=0x0;_0x16f8f9[_0x3a4412]['outboundOriginateFailureCallsDay']=0x0;_0x16f8f9[_0x3a4412][_0xdedf('0x38')]=0x0;_0x16f8f9[_0x3a4412][_0xdedf('0x39')]=0x0;_0x16f8f9[_0x3a4412][_0xdedf('0x31')]=0x0;_0x16f8f9[_0x3a4412]['outboundAnswerCallsDay']=0x0;_0x16f8f9[_0x3a4412][_0xdedf('0x3a')]=!![];}}}}Realtime['prototype'][_0xdedf('0x3b')]=function(_0x35f71f,_0x3d9caf){for(var _0x199996 in _0x3d9caf){if(_0x35f71f['hasOwnProperty'](_0x199996)){_0x35f71f[_0x199996]=_0x3d9caf[_0x199996];}}};Realtime[_0xdedf('0x3c')][_0xdedf('0x3d')]=function(){var _0x5ef3eb=this;return function(_0x305ecd){if(_0x305ecd){freeIsNotKeyAgent(_0x305ecd,_0x5ef3eb['agents']);for(var _0x36ceb3=0x0,_0x17ee5d={},_0x191643={};_0x36ceb3<_0x305ecd[_0xdedf('0x3e')];_0x36ceb3+=0x1){_0x17ee5d=_0x305ecd[_0x36ceb3];var _0x1d76a0=_['isNil'](_0x17ee5d['interface'])?util[_0xdedf('0x24')](_0xdedf('0x25'),_0x17ee5d[_0xdedf('0x26')]):_0x17ee5d[_0xdedf('0x28')];if(_[_0xdedf('0x3f')](_0x5ef3eb[_0xdedf('0x40')][_0x1d76a0])){_0x5ef3eb['agents'][_0x1d76a0]=new Agent(_0x17ee5d);}else{_0x5ef3eb[_0xdedf('0x3b')](_0x5ef3eb[_0xdedf('0x40')][_0x1d76a0],_0x17ee5d);}}}return _0x5ef3eb[_0xdedf('0x40')];};};Realtime[_0xdedf('0x3c')][_0xdedf('0x41')]=function(){var _0x1165a7=this;return function(_0x29e7f8){if(_0x29e7f8){freeIsNotKeySip(_0x29e7f8,_0x1165a7[_0xdedf('0x10')]);for(var _0x204542=0x0,_0x1752db={},_0x5a2537={};_0x204542<_0x29e7f8[_0xdedf('0x3e')];_0x204542+=0x1){_0x1752db=_0x29e7f8[_0x204542];if(_[_0xdedf('0x3f')](_0x1165a7[_0xdedf('0x10')][util[_0xdedf('0x24')](_0xdedf('0x25'),_0x1752db[_0xdedf('0x26')])])){_0x1165a7[_0xdedf('0x10')][util[_0xdedf('0x24')](_0xdedf('0x25'),_0x1752db[_0xdedf('0x26')])]=new Telephone(_0x1752db);}else{_0x1165a7[_0xdedf('0x3b')](_0x1165a7['telephones'][util[_0xdedf('0x24')]('SIP/%s',_0x1752db[_0xdedf('0x26')])],_0x1752db);}}}return _0x1165a7['telephones'];};};Realtime[_0xdedf('0x3c')][_0xdedf('0x42')]=function(){var _0x3d94a7=this;return function(_0x489d95){if(_0x489d95){freeIsNotKeySip(_0x489d95,_0x3d94a7['trunks']);for(var _0x43ee37=0x0,_0x49a4ae={},_0x2fb73a={};_0x43ee37<_0x489d95['length'];_0x43ee37+=0x1){_0x49a4ae=_0x489d95[_0x43ee37];if(_[_0xdedf('0x3f')](_0x3d94a7[_0xdedf('0x11')][util['format'](_0xdedf('0x25'),_0x49a4ae['name'])])){_0x3d94a7['trunks'][util[_0xdedf('0x24')]('SIP/%s',_0x49a4ae[_0xdedf('0x26')])]=new Trunk(_0x49a4ae);}else{_0x3d94a7[_0xdedf('0x3b')](_0x3d94a7['trunks'][util[_0xdedf('0x24')]('SIP/%s',_0x49a4ae[_0xdedf('0x26')])],_0x49a4ae);}}}return _0x3d94a7['trunks'];};};Realtime[_0xdedf('0x3c')]['initVoiceQueues']=function(){var _0x13a170=this;return function(_0x4a7fd8){if(_0x4a7fd8){freeIsNotKey(_0x4a7fd8,_0x13a170['voiceQueues'],_0xdedf('0x26'));for(var _0x46371a=0x0,_0x4e058e={},_0x3c6c1b={};_0x46371a<_0x4a7fd8[_0xdedf('0x3e')];_0x46371a+=0x1){_0x4e058e=_0x4a7fd8[_0x46371a];if(_['isUndefined'](_0x13a170[_0xdedf('0x43')][_0x4e058e[_0xdedf('0x26')]])){_0x13a170[_0xdedf('0x43')][_0x4e058e['name']]=new VoiceQueue(_0x4e058e);}else{_0x13a170['mergeFromDatabase'](_0x13a170['voiceQueues'][_0x4e058e[_0xdedf('0x26')]],_0x4e058e);}}}return _0x13a170[_0xdedf('0x43')];};};Realtime[_0xdedf('0x3c')][_0xdedf('0x44')]=function(){var _0x49a899=this;return function(_0x348746){if(_0x348746){freeIsNotKey(_0x348746,_0x49a899[_0xdedf('0x12')],'id');for(var _0x1e672c=0x0,_0x2cf799={},_0x1ab9c8={};_0x1e672c<_0x348746[_0xdedf('0x3e')];_0x1e672c+=0x1){_0x2cf799=_0x348746[_0x1e672c];if(_['isUndefined'](_0x49a899[_0xdedf('0x12')][_0x2cf799['id']])){_0x49a899['triggers'][_0x2cf799['id']]=new Trigger(_0x2cf799);}else{_0x49a899[_0xdedf('0x3b')](_0x49a899[_0xdedf('0x12')][_0x2cf799['id']],_0x2cf799);}}}return _0x49a899[_0xdedf('0x12')];};};Realtime['prototype'][_0xdedf('0x45')]=function(){var _0x11bcb1=this;return function(_0x3c385d){if(_0x3c385d){freeIsNotKey(_0x3c385d,_0x11bcb1[_0xdedf('0x14')],'id');for(var _0x479cb9=0x0,_0x5a3f21={},_0x361251={};_0x479cb9<_0x3c385d[_0xdedf('0x3e')];_0x479cb9+=0x1){_0x5a3f21=_0x3c385d[_0x479cb9];if(_[_0xdedf('0x3f')](_0x11bcb1[_0xdedf('0x14')][_0x5a3f21['id']])){_0x11bcb1[_0xdedf('0x14')][_0x5a3f21['id']]=new Template(_0x5a3f21);}else{_0x11bcb1[_0xdedf('0x3b')](_0x11bcb1[_0xdedf('0x14')][_0x5a3f21['id']],_0x5a3f21);}}}return _0x11bcb1[_0xdedf('0x14')];};};Realtime['prototype']['initZendeskAccounts']=function(){var _0x41a53f=this;return function(_0x536b63){if(_0x536b63){freeIsNotKey(_0x536b63,_0x41a53f[_0xdedf('0x46')],'id');for(var _0x40b4fb=0x0,_0x58e4ce={},_0x1349a5={};_0x40b4fb<_0x536b63[_0xdedf('0x3e')];_0x40b4fb+=0x1){_0x58e4ce=_0x536b63[_0x40b4fb];if(_['isUndefined'](_0x41a53f[_0xdedf('0x46')][_0x58e4ce['id']])){_0x41a53f[_0xdedf('0x46')][_0x58e4ce['id']]=new ZendeskAccount(_0x58e4ce);}else{_0x41a53f['mergeFromDatabase'](_0x41a53f[_0xdedf('0x46')][_0x58e4ce['id']],_0x58e4ce);}}}return _0x41a53f['zendeskAccounts'];};};Realtime['prototype'][_0xdedf('0x47')]=function(){var _0x463c9d=this;return function(_0x1cf4ca){if(_0x1cf4ca){freeIsNotKey(_0x1cf4ca,_0x463c9d['salesforceAccounts'],'id');for(var _0xb818db=0x0,_0x130c6a={},_0x1e728c={};_0xb818db<_0x1cf4ca[_0xdedf('0x3e')];_0xb818db+=0x1){_0x130c6a=_0x1cf4ca[_0xb818db];if(_[_0xdedf('0x3f')](_0x463c9d[_0xdedf('0x48')][_0x130c6a['id']])){_0x463c9d['salesforceAccounts'][_0x130c6a['id']]=new SalesforceAccount(_0x130c6a);}else{_0x463c9d[_0xdedf('0x3b')](_0x463c9d[_0xdedf('0x48')][_0x130c6a['id']],_0x130c6a);}}}return _0x463c9d['salesforceAccounts'];};};Realtime[_0xdedf('0x3c')]['initFreshdeskAccounts']=function(){var _0x24038f=this;return function(_0x31e798){if(_0x31e798){freeIsNotKey(_0x31e798,_0x24038f[_0xdedf('0x1d')],'id');for(var _0x47df8d=0x0,_0x46439c={},_0xc29c69={};_0x47df8d<_0x31e798[_0xdedf('0x3e')];_0x47df8d+=0x1){_0x46439c=_0x31e798[_0x47df8d];if(_[_0xdedf('0x3f')](_0x24038f[_0xdedf('0x1d')][_0x46439c['id']])){_0x24038f[_0xdedf('0x1d')][_0x46439c['id']]=new FreshdeskAccount(_0x46439c);}else{_0x24038f[_0xdedf('0x3b')](_0x24038f['freshdeskAccounts'][_0x46439c['id']],_0x46439c);}}}return _0x24038f[_0xdedf('0x1d')];};};Realtime['prototype'][_0xdedf('0x49')]=function(){var _0x500d2a=this;return function(_0x4f8405){if(_0x4f8405){freeIsNotKey(_0x4f8405,_0x500d2a[_0xdedf('0x1e')],'id');for(var _0x373a21=0x0,_0x3d06e2={},_0x2a6998={};_0x373a21<_0x4f8405['length'];_0x373a21+=0x1){_0x3d06e2=_0x4f8405[_0x373a21];if(_['isUndefined'](_0x500d2a['zohoAccounts'][_0x3d06e2['id']])){_0x500d2a[_0xdedf('0x1e')][_0x3d06e2['id']]=new ZohoAccount(_0x3d06e2);}else{_0x500d2a[_0xdedf('0x3b')](_0x500d2a['zohoAccounts'][_0x3d06e2['id']],_0x3d06e2);}}}return _0x500d2a[_0xdedf('0x1e')];};};Realtime[_0xdedf('0x3c')][_0xdedf('0x4a')]=function(){var _0x9422ca=this;return function(_0x4f24de){if(_0x4f24de){freeIsNotKey(_0x4f24de,_0x9422ca[_0xdedf('0x1f')],'id');for(var _0x3172b3=0x0,_0x116444={},_0x31dcdd={};_0x3172b3<_0x4f24de[_0xdedf('0x3e')];_0x3172b3+=0x1){_0x116444=_0x4f24de[_0x3172b3];if(_['isUndefined'](_0x9422ca[_0xdedf('0x1f')][_0x116444['id']])){_0x9422ca['deskAccounts'][_0x116444['id']]=new DeskAccount(_0x116444);}else{_0x9422ca[_0xdedf('0x3b')](_0x9422ca[_0xdedf('0x1f')][_0x116444['id']],_0x116444);}}}return _0x9422ca[_0xdedf('0x1f')];};};Realtime[_0xdedf('0x3c')][_0xdedf('0x4b')]=function(){var _0x3b4228=this;return function(_0x10795e){if(_0x10795e){freeIsNotKey(_0x10795e,_0x3b4228['sugarcrmAccounts'],'id');for(var _0x11e8fa=0x0,_0x1cfc2c={},_0x1f254f={};_0x11e8fa<_0x10795e[_0xdedf('0x3e')];_0x11e8fa+=0x1){_0x1cfc2c=_0x10795e[_0x11e8fa];if(_['isUndefined'](_0x3b4228[_0xdedf('0x1c')][_0x1cfc2c['id']])){_0x3b4228[_0xdedf('0x1c')][_0x1cfc2c['id']]=new SugarcrmAccount(_0x1cfc2c);}else{_0x3b4228[_0xdedf('0x3b')](_0x3b4228[_0xdedf('0x1c')][_0x1cfc2c['id']],_0x1cfc2c);}}}return _0x3b4228['sugarcrmAccounts'];};};Realtime[_0xdedf('0x3c')][_0xdedf('0x4c')]=function(){var _0x28dd9c=this;return function(_0x283420){if(_0x283420){freeIsNotKey(_0x283420,_0x28dd9c['vtigerAccounts'],'id');for(var _0x427631=0x0,_0x2c51bd={},_0x8da07c={};_0x427631<_0x283420[_0xdedf('0x3e')];_0x427631+=0x1){_0x2c51bd=_0x283420[_0x427631];if(_[_0xdedf('0x3f')](_0x28dd9c[_0xdedf('0x20')][_0x2c51bd['id']])){_0x28dd9c['vtigerAccounts'][_0x2c51bd['id']]=new VtigerAccount(_0x2c51bd);}else{_0x28dd9c[_0xdedf('0x3b')](_0x28dd9c['vtigerAccounts'][_0x2c51bd['id']],_0x2c51bd);}}}return _0x28dd9c[_0xdedf('0x20')];};};Realtime[_0xdedf('0x3c')][_0xdedf('0x4d')]=function(){var _0x2fa9a3=this;return function(_0x46f205){if(_0x46f205){freeIsNotKey(_0x46f205,_0x2fa9a3['servicenowAccounts'],'id');for(var _0x113fab=0x0,_0x9f2675={},_0x2d8d5c={};_0x113fab<_0x46f205[_0xdedf('0x3e')];_0x113fab+=0x1){_0x9f2675=_0x46f205[_0x113fab];if(_[_0xdedf('0x3f')](_0x2fa9a3['servicenowAccounts'][_0x9f2675['id']])){_0x2fa9a3[_0xdedf('0x21')][_0x9f2675['id']]=new ServicenowAccount(_0x9f2675);}else{_0x2fa9a3['mergeFromDatabase'](_0x2fa9a3[_0xdedf('0x21')][_0x9f2675['id']],_0x9f2675);}}}return _0x2fa9a3[_0xdedf('0x21')];};};Realtime[_0xdedf('0x3c')]['initDynamics365Accounts']=function(){var _0xf7cd9d=this;return function(_0x83fcbb){if(_0x83fcbb){freeIsNotKey(_0x83fcbb,_0xf7cd9d[_0xdedf('0x4e')],'id');for(var _0x5b6dbd=0x0,_0x47bcc6={},_0x2d47cb={};_0x5b6dbd<_0x83fcbb[_0xdedf('0x3e')];_0x5b6dbd+=0x1){_0x47bcc6=_0x83fcbb[_0x5b6dbd];if(_[_0xdedf('0x3f')](_0xf7cd9d[_0xdedf('0x4e')][_0x47bcc6['id']])){_0xf7cd9d[_0xdedf('0x4e')][_0x47bcc6['id']]=new Dynamics365Account(_0x47bcc6);}else{_0xf7cd9d[_0xdedf('0x3b')](_0xf7cd9d[_0xdedf('0x4e')][_0x47bcc6['id']],_0x47bcc6);}}}return _0xf7cd9d[_0xdedf('0x4e')];};};Realtime[_0xdedf('0x3c')][_0xdedf('0x4f')]=function(){var _0x4b3cca=this;return function(_0x5c6aec){if(_0x5c6aec){freeIsNotKey(_0x5c6aec,_0x4b3cca[_0xdedf('0x22')],'id');for(var _0x34931c=0x0,_0x1e9e14={},_0x21e557={};_0x34931c<_0x5c6aec[_0xdedf('0x3e')];_0x34931c+=0x1){_0x1e9e14=_0x5c6aec[_0x34931c];if(_[_0xdedf('0x3f')](_0x4b3cca['freshsalesAccounts'][_0x1e9e14['id']])){_0x4b3cca[_0xdedf('0x22')][_0x1e9e14['id']]=new FreshsalesAccount(_0x1e9e14);}else{_0x4b3cca['mergeFromDatabase'](_0x4b3cca['freshsalesAccounts'][_0x1e9e14['id']],_0x1e9e14);}}}return _0x4b3cca[_0xdedf('0x22')];};};Realtime[_0xdedf('0x3c')][_0xdedf('0x50')]=function(){var _0x7092a4=this;return function(_0x588cc9){for(var _0x368a0d=0x0;_0x368a0d<_0x588cc9[_0xdedf('0x3e')];_0x368a0d+=0x1){_[_0xdedf('0x51')](_0x7092a4[_0xdedf('0x43')][_0x588cc9[_0x368a0d][_0xdedf('0x26')]],_0x588cc9[_0x368a0d]);}return _0x7092a4['voiceQueues'];};};Realtime[_0xdedf('0x3c')][_0xdedf('0x52')]=function(){var _0x4ee307=this;return function(_0x460ecc){clearVoiceQueues(_0x4ee307[_0xdedf('0x43')]);if(_0x460ecc){_0x460ecc=_['groupBy'](_0x460ecc,_0xdedf('0x53'));for(var _0x4e0d45 in _0x460ecc){if(_0x460ecc[_0xdedf('0x27')](_0x4e0d45)){var _0x47732e={};for(var _0x14408a=0x0;_0x14408a<_0x460ecc[_0x4e0d45]['length'];_0x14408a+=0x1){var _0x4776e6=_0x460ecc[_0x4e0d45][_0x14408a]['queue'];if(_0x4ee307['voiceQueues'][_0x4776e6]){if(_0x460ecc[_0x4e0d45][_0x14408a]['queuecallerexit']){_0x4ee307[_0xdedf('0x43')][_0x4776e6][_0xdedf('0x54')]+=0x1;}if(_0x460ecc[_0x4e0d45][_0x14408a][_0xdedf('0x55')]){_0x4ee307[_0xdedf('0x43')][_0x4776e6]['abandoned']+=0x1;}_0x4ee307[_0xdedf('0x43')][_0x4776e6][_0xdedf('0x2a')]+=moment(_0x460ecc[_0x4e0d45][_0x14408a][_0xdedf('0x56')])[_0xdedf('0x57')](moment(_0x460ecc[_0x4e0d45][_0x14408a][_0xdedf('0x58')]),'seconds')||0x0;if(_0x14408a===_0x460ecc[_0x4e0d45][_0xdedf('0x3e')]-0x1){_0x4ee307[_0xdedf('0x43')][_0x4776e6]['sumDuration']+=moment(_0x460ecc[_0x4e0d45][_0x14408a][_0xdedf('0x59')]||_0x460ecc[_0x4e0d45][_0x14408a][_0xdedf('0x5a')]||_0x460ecc[_0x4e0d45][_0x14408a][_0xdedf('0x5b')])[_0xdedf('0x57')](moment(_0x460ecc[_0x4e0d45][_0x14408a][_0xdedf('0x58')]),'seconds')||0x0;_0x4ee307[_0xdedf('0x43')][_0x4776e6][_0xdedf('0x5c')]+=0x1;if(_0x460ecc[_0x4e0d45][_0x14408a][_0xdedf('0x5d')]){_0x4ee307['voiceQueues'][_0x4776e6]['answered']+=0x1;_0x4ee307[_0xdedf('0x43')][_0x4776e6][_0xdedf('0x2c')]+=moment(_0x460ecc[_0x4e0d45][_0x14408a][_0xdedf('0x59')])[_0xdedf('0x57')](moment(_0x460ecc[_0x4e0d45][_0x14408a][_0xdedf('0x56')]),'seconds')||0x0;}}else{_0x4ee307[_0xdedf('0x43')][_0x4776e6][_0xdedf('0x2b')]+=_0x4ee307[_0xdedf('0x43')][_0x4776e6][_0xdedf('0x2a')]||0x0;}}}}}}return _0x4ee307['voiceQueues'];};};Realtime[_0xdedf('0x3c')][_0xdedf('0x5e')]=function(){var _0x4b6363=this;return function(_0x2289a5){clearVoiceCallReports(_0x4b6363[_0xdedf('0x15')]);if(_0x2289a5){for(var _0x2d2ac5=0x0;_0x2d2ac5<_0x2289a5[_0xdedf('0x3e')];_0x2d2ac5+=0x1){_0x4b6363[_0xdedf('0x15')]['total']+=0x1;_0x4b6363[_0xdedf('0x15')][_0xdedf('0x2b')]+=_0x2289a5[_0x2d2ac5]['duration'];if(_0x2289a5[_0x2d2ac5]['disposition']==='ANSWERED'){_0x4b6363[_0xdedf('0x15')][_0xdedf('0x29')]+=0x1;_0x4b6363[_0xdedf('0x15')][_0xdedf('0x2a')]+=_0x2289a5[_0x2d2ac5]['duration']-_0x2289a5[_0x2d2ac5][_0xdedf('0x5f')]||0x0;_0x4b6363['outbound'][_0xdedf('0x2c')]+=_0x2289a5[_0x2d2ac5][_0xdedf('0x5f')];}}}return _0x4b6363[_0xdedf('0x15')];};};Realtime[_0xdedf('0x3c')][_0xdedf('0x60')]=function(){var _0x278f0f=this;return function(_0x40f5c7){if(_0x40f5c7){freeIsNotKey(_0x40f5c7,_0x278f0f[_0xdedf('0x13')],'name');for(var _0xa591fa=0x0,_0x2c68e5={};_0xa591fa<_0x40f5c7[_0xdedf('0x3e')];_0xa591fa+=0x1){_0x2c68e5=_0x40f5c7[_0xa591fa];if(_['isUndefined'](_0x278f0f[_0xdedf('0x13')][_0x2c68e5[_0xdedf('0x26')]])){_0x278f0f[_0xdedf('0x13')][_0x2c68e5[_0xdedf('0x26')]]=new Campaign(_0x2c68e5);}else{_0x278f0f['mergeFromDatabase'](_0x278f0f['campaigns'][_0x2c68e5[_0xdedf('0x26')]],_0x2c68e5);_0x278f0f['campaigns'][_0x2c68e5[_0xdedf('0x26')]][_0xdedf('0x61')]=_0x2c68e5[_0xdedf('0x62')]?_0x2c68e5[_0xdedf('0x62')][_0xdedf('0x26')]:undefined;}}}return _0x278f0f['campaigns'];};};Realtime[_0xdedf('0x3c')][_0xdedf('0x63')]=function(){var _0x40c8a2=this;return function(_0x33c4fa){if(_0x33c4fa){freeIsNotKey(_0x33c4fa,_0x40c8a2[_0xdedf('0x16')],'id');for(var _0x46adc9=0x0,_0x207965={};_0x46adc9<_0x33c4fa[_0xdedf('0x3e')];_0x46adc9+=0x1){_0x207965=_0x33c4fa[_0x46adc9];if(_[_0xdedf('0x3f')](_0x40c8a2[_0xdedf('0x16')][_0x207965['id']])){_0x40c8a2['voiceExtensions'][_0x207965['id']]=new VoiceExtension(_0x207965);}else{_0x40c8a2[_0xdedf('0x3b')](_0x40c8a2[_0xdedf('0x16')][_0x207965['id']],_0x207965);}}}return _0x40c8a2[_0xdedf('0x16')];};};Realtime[_0xdedf('0x3c')][_0xdedf('0x64')]=function(){var _0x5571ed=this;return function(_0x1ce3cf){clearCampaigns(_0x5571ed['campaigns']);for(var _0x31af86=0x0;_0x31af86<_0x1ce3cf[_0xdedf('0x3e')];_0x31af86+=0x1){_[_0xdedf('0x51')](_0x5571ed[_0xdedf('0x13')][_0x1ce3cf[_0x31af86][_0xdedf('0x26')]],_0x1ce3cf[_0x31af86]);}return _0x5571ed[_0xdedf('0x13')];};};Realtime[_0xdedf('0x3c')]['initFaxAccounts']=function(){var _0x4ea50c=this;return function(_0x283545){if(_0x283545){freeIsNotKey(_0x283545,_0x4ea50c[_0xdedf('0x65')],'id');for(var _0x12f8f8=0x0,_0x48ead6={},_0x38316b={};_0x12f8f8<_0x283545[_0xdedf('0x3e')];_0x12f8f8+=0x1){_0x48ead6=_0x283545[_0x12f8f8];if(_[_0xdedf('0x3f')](_0x4ea50c[_0xdedf('0x65')][_0x48ead6['id']])){_0x4ea50c[_0xdedf('0x65')][_0x48ead6['id']]=new FaxAccount(_0x48ead6);}else{_0x4ea50c['mergeFromDatabase'](_0x4ea50c[_0xdedf('0x65')][_0x48ead6['id']],_0x48ead6);}}}return _0x4ea50c[_0xdedf('0x65')];};};module[_0xdedf('0x66')]=Realtime; \ No newline at end of file +var _0x91e5=['sumHoldTime','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','mergeFromDatabase','isUndefined','initTelephones','telephones','length','initTrunks','initVoiceQueues','initTriggers','triggers','initTemplates','templates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','deskAccounts','initVtigerAccounts','initDynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','diff','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','trunks','voiceQueues','campaigns','outbound','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','isNil','interface','format','total','answered'];(function(_0x58381c,_0x3b9374){var _0x1a7440=function(_0x2bc7f1){while(--_0x2bc7f1){_0x58381c['push'](_0x58381c['shift']());}};_0x1a7440(++_0x3b9374);}(_0x91e5,0x126));var _0x591e=function(_0x382a49,_0x62522d){_0x382a49=_0x382a49-0x0;var _0x2fc40b=_0x91e5[_0x382a49];return _0x2fc40b;};'use strict';var BPromise=require('bluebird');var util=require(_0x591e('0x0'));var _=require(_0x591e('0x1'));var moment=require(_0x591e('0x2'));var Agent=require(_0x591e('0x3'));var Telephone=require(_0x591e('0x4'));var Trunk=require(_0x591e('0x5'));var VoiceQueue=require(_0x591e('0x6'));var Trigger=require(_0x591e('0x7'));var Template=require(_0x591e('0x8'));var Campaign=require(_0x591e('0x9'));var VoiceExtension=require(_0x591e('0xa'));var ZendeskAccount=require(_0x591e('0xb'));var SalesforceAccount=require(_0x591e('0xc'));var FreshdeskAccount=require(_0x591e('0xd'));var SugarcrmAccount=require(_0x591e('0xe'));var ZohoAccount=require(_0x591e('0xf'));var DeskAccount=require(_0x591e('0x10'));var VtigerAccount=require(_0x591e('0x11'));var ServicenowAccount=require(_0x591e('0x12'));var Dynamics365Account=require(_0x591e('0x13'));var FreshsalesAccount=require(_0x591e('0x14'));var FaxAccount=require(_0x591e('0x15'));var Realtime=function(){this[_0x591e('0x16')]={};this['telephones']={};this[_0x591e('0x17')]={};this[_0x591e('0x18')]={};this['triggers']={};this[_0x591e('0x19')]={};this['templates']={};this[_0x591e('0x1a')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this['channels']={};this['queueChannels']={};this['outboundChannels']={};this[_0x591e('0x1b')]={};this['settings']={};this[_0x591e('0x1c')]={};this[_0x591e('0x1d')]={};this[_0x591e('0x1e')]={};this['freshdeskAccounts']={};this[_0x591e('0x1f')]={};this['deskAccounts']={};this[_0x591e('0x20')]={};this[_0x591e('0x21')]={};this[_0x591e('0x22')]={};this['freshsalesAccounts']={};this[_0x591e('0x23')]={};};function freeIsNotKey(_0xaf2e59,_0x2ab498,_0xb89b88){var _0x51367f=_[_0x591e('0x24')](_0xaf2e59,function(_0x3928d3,_0x3976be){return _0x3928d3[_0xb89b88];});for(var _0x23d4bb in _0x2ab498){if(_0x2ab498[_0x591e('0x25')](_0x23d4bb)){if(!_0x51367f[_0x23d4bb]){delete _0x2ab498[_0x23d4bb];}}}}function freeIsNotKeySip(_0x53228c,_0x114fd7){var _0x3b0ade=_['mapKeys'](_0x53228c,function(_0x19b9c1,_0x528328){return util['format'](_0x591e('0x26'),_0x19b9c1[_0x591e('0x27')]);});for(var _0x26caed in _0x114fd7){if(_0x114fd7[_0x591e('0x25')](_0x26caed)){if(!_0x3b0ade[_0x26caed]){delete _0x114fd7[_0x26caed];}}}}function freeIsNotKeyAgent(_0x41d28e,_0x469481){var _0x8205c3=_[_0x591e('0x24')](_0x41d28e,function(_0x2da821,_0x22fed3){var _0x1b8023=_[_0x591e('0x28')](_0x2da821[_0x591e('0x29')])?util[_0x591e('0x2a')](_0x591e('0x26'),_0x2da821[_0x591e('0x27')]):_0x2da821['interface'];return _0x1b8023;});for(var _0x4345f4 in _0x469481){if(_0x469481[_0x591e('0x25')](_0x4345f4)){if(!_0x8205c3[_0x4345f4]){delete _0x469481[_0x4345f4];}}}}function clearVoiceCallReports(_0x3bbdb1){_0x3bbdb1[_0x591e('0x2b')]=0x0;_0x3bbdb1[_0x591e('0x2c')]=0x0;_0x3bbdb1[_0x591e('0x2d')]=0x0;_0x3bbdb1[_0x591e('0x2e')]=0x0;_0x3bbdb1[_0x591e('0x2f')]=0x0;}function clearCampaigns(_0x36a177){if(!_[_0x591e('0x30')](_0x36a177)){for(var _0x5d9c70 in _0x36a177){if(_0x36a177[_0x591e('0x25')](_0x5d9c70)){_0x36a177[_0x5d9c70]['ivrTotalCallsDays']=0x0;_0x36a177[_0x5d9c70][_0x591e('0x31')]=0x0;}}}}function clearVoiceQueues(_0x57f10e){if(!_[_0x591e('0x30')](_0x57f10e)){for(var _0x19eae8 in _0x57f10e){if(_0x57f10e[_0x591e('0x25')](_0x19eae8)){_0x57f10e[_0x19eae8][_0x591e('0x2b')]=0x0;_0x57f10e[_0x19eae8]['answered']=0x0;_0x57f10e[_0x19eae8][_0x591e('0x32')]=0x0;_0x57f10e[_0x19eae8][_0x591e('0x33')]=0x0;_0x57f10e[_0x19eae8][_0x591e('0x2d')]=0x0;_0x57f10e[_0x19eae8][_0x591e('0x2e')]=0x0;_0x57f10e[_0x19eae8]['sumBillable']=0x0;_0x57f10e[_0x19eae8][_0x591e('0x34')]=0x0;_0x57f10e[_0x19eae8][_0x591e('0x35')]=0x0;_0x57f10e[_0x19eae8][_0x591e('0x36')]=0x0;_0x57f10e[_0x19eae8][_0x591e('0x37')]=0x0;_0x57f10e[_0x19eae8][_0x591e('0x38')]=0x0;_0x57f10e[_0x19eae8]['outboundUnknownCallsDay']=0x0;_0x57f10e[_0x19eae8][_0x591e('0x39')]=0x0;_0x57f10e[_0x19eae8]['outboundDropCallsDayCallersExit']=0x0;_0x57f10e[_0x19eae8][_0x591e('0x3a')]=0x0;_0x57f10e[_0x19eae8][_0x591e('0x3b')]=0x0;_0x57f10e[_0x19eae8][_0x591e('0x3c')]=0x0;_0x57f10e[_0x19eae8][_0x591e('0x3d')]=0x0;_0x57f10e[_0x19eae8][_0x591e('0x34')]=0x0;_0x57f10e[_0x19eae8]['outboundAnswerCallsDay']=0x0;_0x57f10e[_0x19eae8][_0x591e('0x3e')]=!![];}}}}Realtime[_0x591e('0x3f')][_0x591e('0x40')]=function(_0x268338,_0x32f6a2){for(var _0x43aacf in _0x32f6a2){if(_0x268338[_0x591e('0x25')](_0x43aacf)){_0x268338[_0x43aacf]=_0x32f6a2[_0x43aacf];}}};Realtime['prototype']['initAgents']=function(){var _0x371061=this;return function(_0x39ce9c){if(_0x39ce9c){freeIsNotKeyAgent(_0x39ce9c,_0x371061[_0x591e('0x16')]);for(var _0x3493fb=0x0,_0x2f7972={},_0x5201ca={};_0x3493fb<_0x39ce9c['length'];_0x3493fb+=0x1){_0x2f7972=_0x39ce9c[_0x3493fb];var _0x21dc38=_[_0x591e('0x28')](_0x2f7972[_0x591e('0x29')])?util[_0x591e('0x2a')]('SIP/%s',_0x2f7972[_0x591e('0x27')]):_0x2f7972[_0x591e('0x29')];if(_[_0x591e('0x41')](_0x371061['agents'][_0x21dc38])){_0x371061['agents'][_0x21dc38]=new Agent(_0x2f7972);}else{_0x371061[_0x591e('0x40')](_0x371061[_0x591e('0x16')][_0x21dc38],_0x2f7972);}}}return _0x371061[_0x591e('0x16')];};};Realtime[_0x591e('0x3f')][_0x591e('0x42')]=function(){var _0x1f36cf=this;return function(_0x3b3edb){if(_0x3b3edb){freeIsNotKeySip(_0x3b3edb,_0x1f36cf[_0x591e('0x43')]);for(var _0x1c2306=0x0,_0x1400db={},_0x36959a={};_0x1c2306<_0x3b3edb[_0x591e('0x44')];_0x1c2306+=0x1){_0x1400db=_0x3b3edb[_0x1c2306];if(_[_0x591e('0x41')](_0x1f36cf['telephones'][util['format'](_0x591e('0x26'),_0x1400db[_0x591e('0x27')])])){_0x1f36cf[_0x591e('0x43')][util[_0x591e('0x2a')]('SIP/%s',_0x1400db[_0x591e('0x27')])]=new Telephone(_0x1400db);}else{_0x1f36cf['mergeFromDatabase'](_0x1f36cf['telephones'][util[_0x591e('0x2a')](_0x591e('0x26'),_0x1400db[_0x591e('0x27')])],_0x1400db);}}}return _0x1f36cf[_0x591e('0x43')];};};Realtime[_0x591e('0x3f')][_0x591e('0x45')]=function(){var _0x5e1baf=this;return function(_0x540fcf){if(_0x540fcf){freeIsNotKeySip(_0x540fcf,_0x5e1baf[_0x591e('0x17')]);for(var _0x2cd136=0x0,_0x17e420={},_0x3a96da={};_0x2cd136<_0x540fcf['length'];_0x2cd136+=0x1){_0x17e420=_0x540fcf[_0x2cd136];if(_[_0x591e('0x41')](_0x5e1baf[_0x591e('0x17')][util['format'](_0x591e('0x26'),_0x17e420[_0x591e('0x27')])])){_0x5e1baf['trunks'][util['format']('SIP/%s',_0x17e420[_0x591e('0x27')])]=new Trunk(_0x17e420);}else{_0x5e1baf[_0x591e('0x40')](_0x5e1baf[_0x591e('0x17')][util['format'](_0x591e('0x26'),_0x17e420[_0x591e('0x27')])],_0x17e420);}}}return _0x5e1baf[_0x591e('0x17')];};};Realtime[_0x591e('0x3f')][_0x591e('0x46')]=function(){var _0xcef5c7=this;return function(_0x44ffcb){if(_0x44ffcb){freeIsNotKey(_0x44ffcb,_0xcef5c7[_0x591e('0x18')],_0x591e('0x27'));for(var _0x2284d8=0x0,_0x12edbf={},_0x4b3e16={};_0x2284d8<_0x44ffcb[_0x591e('0x44')];_0x2284d8+=0x1){_0x12edbf=_0x44ffcb[_0x2284d8];if(_[_0x591e('0x41')](_0xcef5c7[_0x591e('0x18')][_0x12edbf[_0x591e('0x27')]])){_0xcef5c7[_0x591e('0x18')][_0x12edbf[_0x591e('0x27')]]=new VoiceQueue(_0x12edbf);}else{_0xcef5c7[_0x591e('0x40')](_0xcef5c7[_0x591e('0x18')][_0x12edbf[_0x591e('0x27')]],_0x12edbf);}}}return _0xcef5c7[_0x591e('0x18')];};};Realtime[_0x591e('0x3f')][_0x591e('0x47')]=function(){var _0x2244a5=this;return function(_0x3add7a){if(_0x3add7a){freeIsNotKey(_0x3add7a,_0x2244a5['triggers'],'id');for(var _0x1ed542=0x0,_0x1d14b0={},_0x44ce4b={};_0x1ed542<_0x3add7a[_0x591e('0x44')];_0x1ed542+=0x1){_0x1d14b0=_0x3add7a[_0x1ed542];if(_[_0x591e('0x41')](_0x2244a5[_0x591e('0x48')][_0x1d14b0['id']])){_0x2244a5[_0x591e('0x48')][_0x1d14b0['id']]=new Trigger(_0x1d14b0);}else{_0x2244a5[_0x591e('0x40')](_0x2244a5['triggers'][_0x1d14b0['id']],_0x1d14b0);}}}return _0x2244a5['triggers'];};};Realtime[_0x591e('0x3f')][_0x591e('0x49')]=function(){var _0x2bedea=this;return function(_0x42ebba){if(_0x42ebba){freeIsNotKey(_0x42ebba,_0x2bedea['templates'],'id');for(var _0x1ba574=0x0,_0x300288={},_0x4c9b3f={};_0x1ba574<_0x42ebba[_0x591e('0x44')];_0x1ba574+=0x1){_0x300288=_0x42ebba[_0x1ba574];if(_['isUndefined'](_0x2bedea['templates'][_0x300288['id']])){_0x2bedea['templates'][_0x300288['id']]=new Template(_0x300288);}else{_0x2bedea[_0x591e('0x40')](_0x2bedea[_0x591e('0x4a')][_0x300288['id']],_0x300288);}}}return _0x2bedea[_0x591e('0x4a')];};};Realtime[_0x591e('0x3f')][_0x591e('0x4b')]=function(){var _0x2c974e=this;return function(_0x583b5d){if(_0x583b5d){freeIsNotKey(_0x583b5d,_0x2c974e['zendeskAccounts'],'id');for(var _0xc2067b=0x0,_0x54fadf={},_0x366d62={};_0xc2067b<_0x583b5d[_0x591e('0x44')];_0xc2067b+=0x1){_0x54fadf=_0x583b5d[_0xc2067b];if(_[_0x591e('0x41')](_0x2c974e[_0x591e('0x1c')][_0x54fadf['id']])){_0x2c974e[_0x591e('0x1c')][_0x54fadf['id']]=new ZendeskAccount(_0x54fadf);}else{_0x2c974e[_0x591e('0x40')](_0x2c974e[_0x591e('0x1c')][_0x54fadf['id']],_0x54fadf);}}}return _0x2c974e[_0x591e('0x1c')];};};Realtime['prototype'][_0x591e('0x4c')]=function(){var _0x47c3b6=this;return function(_0x2c897d){if(_0x2c897d){freeIsNotKey(_0x2c897d,_0x47c3b6['salesforceAccounts'],'id');for(var _0x26b231=0x0,_0xd39d18={},_0xad0f49={};_0x26b231<_0x2c897d[_0x591e('0x44')];_0x26b231+=0x1){_0xd39d18=_0x2c897d[_0x26b231];if(_[_0x591e('0x41')](_0x47c3b6[_0x591e('0x1d')][_0xd39d18['id']])){_0x47c3b6['salesforceAccounts'][_0xd39d18['id']]=new SalesforceAccount(_0xd39d18);}else{_0x47c3b6[_0x591e('0x40')](_0x47c3b6[_0x591e('0x1d')][_0xd39d18['id']],_0xd39d18);}}}return _0x47c3b6[_0x591e('0x1d')];};};Realtime[_0x591e('0x3f')][_0x591e('0x4d')]=function(){var _0x22cd6c=this;return function(_0x38390f){if(_0x38390f){freeIsNotKey(_0x38390f,_0x22cd6c[_0x591e('0x4e')],'id');for(var _0xbd9e83=0x0,_0x3c3f8e={},_0x298b3c={};_0xbd9e83<_0x38390f[_0x591e('0x44')];_0xbd9e83+=0x1){_0x3c3f8e=_0x38390f[_0xbd9e83];if(_[_0x591e('0x41')](_0x22cd6c[_0x591e('0x4e')][_0x3c3f8e['id']])){_0x22cd6c[_0x591e('0x4e')][_0x3c3f8e['id']]=new FreshdeskAccount(_0x3c3f8e);}else{_0x22cd6c[_0x591e('0x40')](_0x22cd6c[_0x591e('0x4e')][_0x3c3f8e['id']],_0x3c3f8e);}}}return _0x22cd6c[_0x591e('0x4e')];};};Realtime[_0x591e('0x3f')][_0x591e('0x4f')]=function(){var _0x67cfd2=this;return function(_0x42861b){if(_0x42861b){freeIsNotKey(_0x42861b,_0x67cfd2['zohoAccounts'],'id');for(var _0x577b36=0x0,_0xdc7762={},_0x27a54d={};_0x577b36<_0x42861b['length'];_0x577b36+=0x1){_0xdc7762=_0x42861b[_0x577b36];if(_[_0x591e('0x41')](_0x67cfd2[_0x591e('0x1f')][_0xdc7762['id']])){_0x67cfd2[_0x591e('0x1f')][_0xdc7762['id']]=new ZohoAccount(_0xdc7762);}else{_0x67cfd2[_0x591e('0x40')](_0x67cfd2[_0x591e('0x1f')][_0xdc7762['id']],_0xdc7762);}}}return _0x67cfd2[_0x591e('0x1f')];};};Realtime[_0x591e('0x3f')][_0x591e('0x50')]=function(){var _0x5cdf7d=this;return function(_0x3dddad){if(_0x3dddad){freeIsNotKey(_0x3dddad,_0x5cdf7d['deskAccounts'],'id');for(var _0x10f57b=0x0,_0x275081={},_0x75a734={};_0x10f57b<_0x3dddad[_0x591e('0x44')];_0x10f57b+=0x1){_0x275081=_0x3dddad[_0x10f57b];if(_[_0x591e('0x41')](_0x5cdf7d[_0x591e('0x51')][_0x275081['id']])){_0x5cdf7d['deskAccounts'][_0x275081['id']]=new DeskAccount(_0x275081);}else{_0x5cdf7d['mergeFromDatabase'](_0x5cdf7d[_0x591e('0x51')][_0x275081['id']],_0x275081);}}}return _0x5cdf7d[_0x591e('0x51')];};};Realtime[_0x591e('0x3f')]['initSugarcrmAccounts']=function(){var _0x3f5aca=this;return function(_0x44cadc){if(_0x44cadc){freeIsNotKey(_0x44cadc,_0x3f5aca[_0x591e('0x1e')],'id');for(var _0x34cae6=0x0,_0x14dcf2={},_0x159dc7={};_0x34cae6<_0x44cadc[_0x591e('0x44')];_0x34cae6+=0x1){_0x14dcf2=_0x44cadc[_0x34cae6];if(_['isUndefined'](_0x3f5aca['sugarcrmAccounts'][_0x14dcf2['id']])){_0x3f5aca[_0x591e('0x1e')][_0x14dcf2['id']]=new SugarcrmAccount(_0x14dcf2);}else{_0x3f5aca[_0x591e('0x40')](_0x3f5aca[_0x591e('0x1e')][_0x14dcf2['id']],_0x14dcf2);}}}return _0x3f5aca[_0x591e('0x1e')];};};Realtime['prototype'][_0x591e('0x52')]=function(){var _0x1144f6=this;return function(_0x8115f3){if(_0x8115f3){freeIsNotKey(_0x8115f3,_0x1144f6[_0x591e('0x20')],'id');for(var _0x5ddf1f=0x0,_0x3e9be1={},_0x1ae478={};_0x5ddf1f<_0x8115f3['length'];_0x5ddf1f+=0x1){_0x3e9be1=_0x8115f3[_0x5ddf1f];if(_[_0x591e('0x41')](_0x1144f6[_0x591e('0x20')][_0x3e9be1['id']])){_0x1144f6[_0x591e('0x20')][_0x3e9be1['id']]=new VtigerAccount(_0x3e9be1);}else{_0x1144f6[_0x591e('0x40')](_0x1144f6[_0x591e('0x20')][_0x3e9be1['id']],_0x3e9be1);}}}return _0x1144f6[_0x591e('0x20')];};};Realtime[_0x591e('0x3f')]['initServicenowAccounts']=function(){var _0x2e163d=this;return function(_0x7d7b08){if(_0x7d7b08){freeIsNotKey(_0x7d7b08,_0x2e163d['servicenowAccounts'],'id');for(var _0x4589f7=0x0,_0x26a1d5={},_0x1faecc={};_0x4589f7<_0x7d7b08[_0x591e('0x44')];_0x4589f7+=0x1){_0x26a1d5=_0x7d7b08[_0x4589f7];if(_[_0x591e('0x41')](_0x2e163d[_0x591e('0x21')][_0x26a1d5['id']])){_0x2e163d[_0x591e('0x21')][_0x26a1d5['id']]=new ServicenowAccount(_0x26a1d5);}else{_0x2e163d['mergeFromDatabase'](_0x2e163d['servicenowAccounts'][_0x26a1d5['id']],_0x26a1d5);}}}return _0x2e163d[_0x591e('0x21')];};};Realtime[_0x591e('0x3f')][_0x591e('0x53')]=function(){var _0x1b7bbb=this;return function(_0x2297e5){if(_0x2297e5){freeIsNotKey(_0x2297e5,_0x1b7bbb[_0x591e('0x22')],'id');for(var _0x20519a=0x0,_0x53e0b8={},_0x37ab9c={};_0x20519a<_0x2297e5['length'];_0x20519a+=0x1){_0x53e0b8=_0x2297e5[_0x20519a];if(_[_0x591e('0x41')](_0x1b7bbb[_0x591e('0x22')][_0x53e0b8['id']])){_0x1b7bbb[_0x591e('0x22')][_0x53e0b8['id']]=new Dynamics365Account(_0x53e0b8);}else{_0x1b7bbb['mergeFromDatabase'](_0x1b7bbb[_0x591e('0x22')][_0x53e0b8['id']],_0x53e0b8);}}}return _0x1b7bbb[_0x591e('0x22')];};};Realtime[_0x591e('0x3f')][_0x591e('0x54')]=function(){var _0x609b95=this;return function(_0x2085a0){if(_0x2085a0){freeIsNotKey(_0x2085a0,_0x609b95[_0x591e('0x55')],'id');for(var _0x1f45fc=0x0,_0x3366a3={},_0x46e6be={};_0x1f45fc<_0x2085a0['length'];_0x1f45fc+=0x1){_0x3366a3=_0x2085a0[_0x1f45fc];if(_[_0x591e('0x41')](_0x609b95[_0x591e('0x55')][_0x3366a3['id']])){_0x609b95['freshsalesAccounts'][_0x3366a3['id']]=new FreshsalesAccount(_0x3366a3);}else{_0x609b95[_0x591e('0x40')](_0x609b95[_0x591e('0x55')][_0x3366a3['id']],_0x3366a3);}}}return _0x609b95[_0x591e('0x55')];};};Realtime[_0x591e('0x3f')][_0x591e('0x56')]=function(){var _0xb9d19d=this;return function(_0x203351){for(var _0x38b436=0x0;_0x38b436<_0x203351[_0x591e('0x44')];_0x38b436+=0x1){_[_0x591e('0x57')](_0xb9d19d[_0x591e('0x18')][_0x203351[_0x38b436][_0x591e('0x27')]],_0x203351[_0x38b436]);}return _0xb9d19d[_0x591e('0x18')];};};Realtime[_0x591e('0x3f')][_0x591e('0x58')]=function(){var _0x23b992=this;return function(_0x3a0083){clearVoiceQueues(_0x23b992[_0x591e('0x18')]);if(_0x3a0083){_0x3a0083=_[_0x591e('0x59')](_0x3a0083,_0x591e('0x5a'));for(var _0x25b81e in _0x3a0083){if(_0x3a0083[_0x591e('0x25')](_0x25b81e)){var _0x94ec18={};for(var _0x24c37e=0x0;_0x24c37e<_0x3a0083[_0x25b81e][_0x591e('0x44')];_0x24c37e+=0x1){var _0x4e7a93=_0x3a0083[_0x25b81e][_0x24c37e][_0x591e('0x5b')];if(_0x23b992['voiceQueues'][_0x4e7a93]){if(_0x3a0083[_0x25b81e][_0x24c37e][_0x591e('0x5c')]){_0x23b992['voiceQueues'][_0x4e7a93][_0x591e('0x32')]+=0x1;}if(_0x3a0083[_0x25b81e][_0x24c37e][_0x591e('0x5d')]){_0x23b992[_0x591e('0x18')][_0x4e7a93][_0x591e('0x33')]+=0x1;}_0x23b992[_0x591e('0x18')][_0x4e7a93][_0x591e('0x2d')]+=moment(_0x3a0083[_0x25b81e][_0x24c37e][_0x591e('0x5e')])['diff'](moment(_0x3a0083[_0x25b81e][_0x24c37e][_0x591e('0x5f')]),_0x591e('0x60'))||0x0;if(_0x24c37e===_0x3a0083[_0x25b81e][_0x591e('0x44')]-0x1){_0x23b992[_0x591e('0x18')][_0x4e7a93][_0x591e('0x2e')]+=moment(_0x3a0083[_0x25b81e][_0x24c37e][_0x591e('0x61')]||_0x3a0083[_0x25b81e][_0x24c37e][_0x591e('0x62')]||_0x3a0083[_0x25b81e][_0x24c37e]['queuecallerexitAt'])[_0x591e('0x63')](moment(_0x3a0083[_0x25b81e][_0x24c37e][_0x591e('0x5f')]),_0x591e('0x60'))||0x0;_0x23b992[_0x591e('0x18')][_0x4e7a93][_0x591e('0x2b')]+=0x1;if(_0x3a0083[_0x25b81e][_0x24c37e][_0x591e('0x64')]){_0x23b992[_0x591e('0x18')][_0x4e7a93][_0x591e('0x2c')]+=0x1;_0x23b992[_0x591e('0x18')][_0x4e7a93]['sumBillable']+=moment(_0x3a0083[_0x25b81e][_0x24c37e][_0x591e('0x61')])['diff'](moment(_0x3a0083[_0x25b81e][_0x24c37e]['queuecallerleaveAt']),_0x591e('0x60'))||0x0;}}else{_0x23b992[_0x591e('0x18')][_0x4e7a93][_0x591e('0x2e')]+=_0x23b992[_0x591e('0x18')][_0x4e7a93][_0x591e('0x2d')]||0x0;}}}}}}return _0x23b992[_0x591e('0x18')];};};Realtime[_0x591e('0x3f')][_0x591e('0x65')]=function(){var _0x2d8833=this;return function(_0x5e90ed){clearVoiceCallReports(_0x2d8833['outbound']);if(_0x5e90ed){for(var _0x3d51fa=0x0;_0x3d51fa<_0x5e90ed['length'];_0x3d51fa+=0x1){_0x2d8833[_0x591e('0x1a')]['total']+=0x1;_0x2d8833['outbound'][_0x591e('0x2e')]+=_0x5e90ed[_0x3d51fa][_0x591e('0x66')];if(_0x5e90ed[_0x3d51fa][_0x591e('0x67')]===_0x591e('0x68')){_0x2d8833['outbound']['answered']+=0x1;_0x2d8833[_0x591e('0x1a')][_0x591e('0x2d')]+=_0x5e90ed[_0x3d51fa][_0x591e('0x66')]-_0x5e90ed[_0x3d51fa][_0x591e('0x69')]||0x0;_0x2d8833[_0x591e('0x1a')][_0x591e('0x2f')]+=_0x5e90ed[_0x3d51fa][_0x591e('0x69')];}}}return _0x2d8833[_0x591e('0x1a')];};};Realtime[_0x591e('0x3f')][_0x591e('0x6a')]=function(){var _0x381eba=this;return function(_0x29a698){if(_0x29a698){freeIsNotKey(_0x29a698,_0x381eba[_0x591e('0x19')],_0x591e('0x27'));for(var _0x65c50f=0x0,_0x41f330={};_0x65c50f<_0x29a698['length'];_0x65c50f+=0x1){_0x41f330=_0x29a698[_0x65c50f];if(_[_0x591e('0x41')](_0x381eba[_0x591e('0x19')][_0x41f330[_0x591e('0x27')]])){_0x381eba[_0x591e('0x19')][_0x41f330[_0x591e('0x27')]]=new Campaign(_0x41f330);}else{_0x381eba[_0x591e('0x40')](_0x381eba[_0x591e('0x19')][_0x41f330[_0x591e('0x27')]],_0x41f330);_0x381eba[_0x591e('0x19')][_0x41f330['name']][_0x591e('0x6b')]=_0x41f330[_0x591e('0x6c')]?_0x41f330['SquareProject']['name']:undefined;}}}return _0x381eba[_0x591e('0x19')];};};Realtime['prototype']['initVoiceExtensions']=function(){var _0xbbd5f=this;return function(_0x3146cb){if(_0x3146cb){freeIsNotKey(_0x3146cb,_0xbbd5f['voiceExtensions'],'id');for(var _0x20ea93=0x0,_0x4a4afb={};_0x20ea93<_0x3146cb[_0x591e('0x44')];_0x20ea93+=0x1){_0x4a4afb=_0x3146cb[_0x20ea93];if(_[_0x591e('0x41')](_0xbbd5f[_0x591e('0x6d')][_0x4a4afb['id']])){_0xbbd5f[_0x591e('0x6d')][_0x4a4afb['id']]=new VoiceExtension(_0x4a4afb);}else{_0xbbd5f[_0x591e('0x40')](_0xbbd5f[_0x591e('0x6d')][_0x4a4afb['id']],_0x4a4afb);}}}return _0xbbd5f[_0x591e('0x6d')];};};Realtime[_0x591e('0x3f')][_0x591e('0x6e')]=function(){var _0xeaf40c=this;return function(_0x487036){clearCampaigns(_0xeaf40c[_0x591e('0x19')]);for(var _0x2f7f61=0x0;_0x2f7f61<_0x487036[_0x591e('0x44')];_0x2f7f61+=0x1){_['merge'](_0xeaf40c[_0x591e('0x19')][_0x487036[_0x2f7f61][_0x591e('0x27')]],_0x487036[_0x2f7f61]);}return _0xeaf40c[_0x591e('0x19')];};};Realtime[_0x591e('0x3f')][_0x591e('0x6f')]=function(){var _0x5bd870=this;return function(_0x1e635b){if(_0x1e635b){freeIsNotKey(_0x1e635b,_0x5bd870['faxAccounts'],'id');for(var _0x89705a=0x0,_0x3a4a88={},_0x5ce6d3={};_0x89705a<_0x1e635b[_0x591e('0x44')];_0x89705a+=0x1){_0x3a4a88=_0x1e635b[_0x89705a];if(_[_0x591e('0x41')](_0x5bd870[_0x591e('0x23')][_0x3a4a88['id']])){_0x5bd870[_0x591e('0x23')][_0x3a4a88['id']]=new FaxAccount(_0x3a4a88);}else{_0x5bd870[_0x591e('0x40')](_0x5bd870[_0x591e('0x23')][_0x3a4a88['id']],_0x3a4a88);}}}return _0x5bd870[_0x591e('0x23')];};};module[_0x591e('0x70')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 9339b2a..93e2bc5 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 _0xefe2=['linkedid','transfereelinkedid','uniqueid','UserId','membername','monitor','monitors','filename','createdAt','exten','xcally-motion-preview','forEach','startsWith','Local','substring','indexOf','lastIndexOf','blindTransfer','exports','lodash','moment','../../../config/environment','../ami','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceDialReport','./userReport','agents','prototype','realtime','custom:voiceQueueReport','voiceQueueReport','bind','voiceAgentReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','find','accountcode','name','interface','SIP/%s','length','findAgent','connectedlinenum','assigned','lastAssignedTo','isNil','format','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys','getCallType','channel','split','calleridnum','outbound','destination','type','dialer','lastapplication','queue','lastdata','from-voip-provider','from-sip','originatecalleridnum','destinationchannel','callerid','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers'];(function(_0x364e9f,_0x365f48){var _0x3ea57b=function(_0x28cec4){while(--_0x28cec4){_0x364e9f['push'](_0x364e9f['shift']());}};_0x3ea57b(++_0x365f48);}(_0xefe2,0x109));var _0x2efe=function(_0x24e22a,_0x2d347a){_0x24e22a=_0x24e22a-0x0;var _0x4bad6b=_0xefe2[_0x24e22a];return _0x4bad6b;};'use strict';var _=require(_0x2efe('0x0'));var moment=require(_0x2efe('0x1'));var util=require('util');var config=require(_0x2efe('0x2'));var ami=require(_0x2efe('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x2efe('0x4'));var RpcVoiceQueueReport=require(_0x2efe('0x5'));var RpcVoiceRecording=require(_0x2efe('0x6'));var RpcVoiceTransferReport=require(_0x2efe('0x7'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x2efe('0x8'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x2efe('0x9'));var UserReport=require(_0x2efe('0xa'));function Report(_0x55ad53){this['realtime']=_0x55ad53;this['agents']=_0x55ad53[_0x2efe('0xb')];this['telephones']=_0x55ad53['telephones'];}Report[_0x2efe('0xc')]['sync']=function(_0x4dae04){var _0x3062bf=new VoiceQueueReport(this['realtime']);var _0x9ffdd7=new VoiceAgentReport(this[_0x2efe('0xd')]);var _0x4e1969=new VoiceDialReport(this[_0x2efe('0xd')]);var _0x23a39d=new VoiceCallReport(this[_0x2efe('0xd')]);var _0x5cae61=new UserReport(this[_0x2efe('0xd')]);if(config['xdr']&&config['xdr']['disabled']){ami['on'](_0x2efe('0xe'),this[_0x2efe('0xf')][_0x2efe('0x10')](this));ami['on']('custom:voiceCallReport',this['voiceCallReport']['bind'](this));ami['on']('custom:voiceAgentReport',this[_0x2efe('0x11')]['bind'](this));ami['on']('custom:voiceDialReport',this[_0x2efe('0x12')][_0x2efe('0x10')](this));ami['on'](_0x2efe('0x13'),this['blindTransfer'][_0x2efe('0x10')](this));ami['on'](_0x2efe('0x14'),this[_0x2efe('0x15')][_0x2efe('0x10')](this));}};Report[_0x2efe('0xc')]['findAgent']=function(_0x35bc15){var _0x376b54;_0x376b54=_[_0x2efe('0x16')](this['agents'],function(_0xca23cd){return _0xca23cd['accountcode']==_0x35bc15||_0xca23cd['name']==_0x35bc15;});if(_['isNil'](_0x376b54)){var _0x226024=_[_0x2efe('0x16')](this['telephones'],function(_0x273336){return _0x273336[_0x2efe('0x17')]==_0x35bc15||_0x273336[_0x2efe('0x18')]==_0x35bc15;});if(_0x226024){_0x376b54=_[_0x2efe('0x16')](this['agents'],function(_0xd48853){return _0xd48853[_0x2efe('0x19')]==util['format'](_0x2efe('0x1a'),_0x226024[_0x2efe('0x18')]);});}}return _0x376b54;};Report[_0x2efe('0xc')][_0x2efe('0xf')]=function(_0x15787c){for(var _0x3cdd4d=0x0;_0x3cdd4d<_0x15787c[_0x2efe('0x1b')];_0x3cdd4d+=0x1){var _0x398fef=this[_0x2efe('0x1c')](_0x15787c[_0x3cdd4d][_0x2efe('0x1d')]);if(_0x398fef){_0x15787c[_0x3cdd4d][_0x2efe('0x17')]=_0x398fef[_0x2efe('0x17')];_0x15787c[_0x3cdd4d][_0x2efe('0x1e')]=!![];_0x15787c[_0x3cdd4d][_0x2efe('0x1f')]=_0x398fef[_0x2efe('0x18')];_0x15787c[_0x3cdd4d]['interface']=_[_0x2efe('0x20')](_0x398fef['interface'])?util[_0x2efe('0x21')](_0x2efe('0x1a'),_0x398fef['name']):_0x398fef[_0x2efe('0x19')];if(_0x15787c[_0x3cdd4d]['queuecallercomplete']){_0x15787c[_0x3cdd4d][_0x2efe('0x22')]=moment()[_0x2efe('0x21')](_0x2efe('0x23'));}if(_0x15787c[_0x3cdd4d][_0x2efe('0x24')]){_0x15787c[_0x3cdd4d][_0x2efe('0x25')]=moment()[_0x2efe('0x21')](_0x2efe('0x23'));}RpcMemberReport[_0x2efe('0xf')](_0x15787c[_0x3cdd4d]);}RpcVoiceQueueReport[_0x2efe('0x26')](_0x15787c[_0x3cdd4d]);}};function extractCalleridNumber(_0x16e8df){var _0x4572b4=_0x16e8df[_0x2efe('0x27')](/<(.*?)>/);return _0x4572b4?_0x4572b4[0x1]:_0x16e8df;}Report[_0x2efe('0xc')][_0x2efe('0x28')]=function(_0x85c0e8){for(var _0x2a606f=0x0;_0x2a606f','calleridname','linkedid','transfers','transfereelinkedid','uniqueid','UserId','membername','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','originatecalleridnum','xcally-motion-dialer','isArray','forEach','voiceDialReport','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','lodash','util','../../../config/environment'];(function(_0x518ba6,_0x2f55b3){var _0x319f35=function(_0x44be9a){while(--_0x44be9a){_0x518ba6['push'](_0x518ba6['shift']());}};_0x319f35(++_0x2f55b3);}(_0x29a2,0x1d8));var _0x229a=function(_0x44268d,_0xad8443){_0x44268d=_0x44268d-0x0;var _0x4be92d=_0x29a2[_0x44268d];return _0x4be92d;};'use strict';var _=require(_0x229a('0x0'));var moment=require('moment');var util=require(_0x229a('0x1'));var config=require(_0x229a('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x229a('0x3'));var RpcVoiceCallReport=require(_0x229a('0x4'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x229a('0x5'));var RpcVoiceRecording=require(_0x229a('0x6'));var RpcVoiceTransferReport=require(_0x229a('0x7'));var VoiceQueueReport=require(_0x229a('0x8'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x229a('0x9'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x229a('0xa'));function Report(_0x4cf234){this[_0x229a('0xb')]=_0x4cf234;this[_0x229a('0xc')]=_0x4cf234[_0x229a('0xc')];this[_0x229a('0xd')]=_0x4cf234[_0x229a('0xd')];}Report[_0x229a('0xe')]['sync']=function(_0x45e74e){var _0x3b388b=new VoiceQueueReport(this['realtime']);var _0x139d70=new VoiceAgentReport(this[_0x229a('0xb')]);var _0x122007=new VoiceDialReport(this[_0x229a('0xb')]);var _0x304987=new VoiceCallReport(this[_0x229a('0xb')]);var _0x1320e6=new UserReport(this[_0x229a('0xb')]);if(config[_0x229a('0xf')]&&config['xdr'][_0x229a('0x10')]){ami['on'](_0x229a('0x11'),this[_0x229a('0x12')][_0x229a('0x13')](this));ami['on'](_0x229a('0x14'),this['voiceCallReport'][_0x229a('0x13')](this));ami['on'](_0x229a('0x15'),this[_0x229a('0x16')][_0x229a('0x13')](this));ami['on'](_0x229a('0x17'),this['voiceDialReport'][_0x229a('0x13')](this));ami['on'](_0x229a('0x18'),this[_0x229a('0x19')]['bind'](this));ami['on']('attendedtransfer',this[_0x229a('0x1a')][_0x229a('0x13')](this));}};Report[_0x229a('0xe')]['findAgent']=function(_0x4299e6){var _0x247ec6;_0x247ec6=_[_0x229a('0x1b')](this[_0x229a('0xc')],function(_0x3f0eb6){return _0x3f0eb6[_0x229a('0x1c')]==_0x4299e6||_0x3f0eb6['name']==_0x4299e6;});if(_[_0x229a('0x1d')](_0x247ec6)){var _0x28ddf6=_['find'](this[_0x229a('0xd')],function(_0x1d1ca7){return _0x1d1ca7['accountcode']==_0x4299e6||_0x1d1ca7[_0x229a('0x1e')]==_0x4299e6;});if(_0x28ddf6){_0x247ec6=_[_0x229a('0x1b')](this[_0x229a('0xc')],function(_0x400344){return _0x400344[_0x229a('0x1f')]==util[_0x229a('0x20')](_0x229a('0x21'),_0x28ddf6[_0x229a('0x1e')]);});}}return _0x247ec6;};Report[_0x229a('0xe')][_0x229a('0x12')]=function(_0x222ea6){for(var _0x3317f2=0x0;_0x3317f2<_0x222ea6[_0x229a('0x22')];_0x3317f2+=0x1){var _0x176e0c=this[_0x229a('0x23')](_0x222ea6[_0x3317f2][_0x229a('0x24')]);if(_0x176e0c){_0x222ea6[_0x3317f2]['accountcode']=_0x176e0c['accountcode'];_0x222ea6[_0x3317f2]['assigned']=!![];_0x222ea6[_0x3317f2][_0x229a('0x25')]=_0x176e0c[_0x229a('0x1e')];_0x222ea6[_0x3317f2]['interface']=_[_0x229a('0x1d')](_0x176e0c[_0x229a('0x1f')])?util[_0x229a('0x20')]('SIP/%s',_0x176e0c[_0x229a('0x1e')]):_0x176e0c[_0x229a('0x1f')];if(_0x222ea6[_0x3317f2][_0x229a('0x26')]){_0x222ea6[_0x3317f2][_0x229a('0x27')]=moment()[_0x229a('0x20')](_0x229a('0x28'));}if(_0x222ea6[_0x3317f2][_0x229a('0x29')]){_0x222ea6[_0x3317f2][_0x229a('0x2a')]=moment()['format'](_0x229a('0x28'));}RpcMemberReport[_0x229a('0x12')](_0x222ea6[_0x3317f2]);}RpcVoiceQueueReport[_0x229a('0x2b')](_0x222ea6[_0x3317f2]);}};function extractCalleridNumber(_0x2cd359){var _0x2d5628=_0x2cd359[_0x229a('0x2c')](/<(.*?)>/);return _0x2d5628?_0x2d5628[0x1]:_0x2cd359;}Report[_0x229a('0xe')]['getAgentByInternal']=function(_0x216c20){for(var _0x4c1e9e=0x0;_0x4c1e9e0x0?_0x3da366:0x0;this[_0x4000('0x12')][_0x4e2073[_0x4000('0x6b')]][_0x4000('0x31')]=this['voiceQueues'][_0x4e2073[_0x4000('0x6b')]][_0x4000('0x31')]>_[_0x4000('0x70')](_0x4e2073['loggedin'])?_[_0x4000('0x70')](_0x4e2073['loggedin']):this[_0x4000('0x12')][_0x4e2073['queue']][_0x4000('0x31')];this[_0x4000('0x72')](this['voiceQueues'][_0x4e2073['queue']],_0x4000('0x16'));}logger[_0x4000('0x49')](_0x4000('0x73'),util[_0x4000('0x41')](this[_0x4000('0x12')][_0x4e2073[_0x4000('0x6b')]],{'showHidden':![],'depth':null}));ami[_0x4000('0x47')]('custom:queuesummary',this[_0x4000('0x12')][_0x4e2073[_0x4000('0x6b')]]);}}}catch(_0x3f537c){logger[_0x4000('0x40')]('[voiceQueueReport][queuesummary]',util[_0x4000('0x41')](_0x3f537c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4000('0xb')]['syncQueueSummaryComplete']=function(_0x3589cb){logger[_0x4000('0x49')](_0x4000('0x74'),util[_0x4000('0x41')](_0x3589cb,{'showHidden':![],'depth':null}));this[_0x4000('0x13')]=!![];};VoiceQueueReport[_0x4000('0xb')][_0x4000('0x1a')]=function(_0x2c3a9a){try{if(this[_0x4000('0x66')](_0x2c3a9a)){logger['debug'](_0x4000('0x75'),_0x2c3a9a[_0x4000('0x4b')],util[_0x4000('0x41')](_0x2c3a9a,{'showHidden':![],'depth':null}));if(_[_0x4000('0x67')](this['queueReports'][_0x2c3a9a['uniqueid']]))this[_0x4000('0xf')][_0x2c3a9a[_0x4000('0x4b')]]=[];if(_[_0x4000('0x67')](this['channels'][_0x2c3a9a[_0x4000('0x4b')]]))this[_0x4000('0x37')][_0x2c3a9a[_0x4000('0x4b')]]={};var _0x1c59e2=new QueueReport();_0x1c59e2[_0x4000('0x50')]=_0x2c3a9a[_0x4000('0x6b')];_0x1c59e2[_0x4000('0x52')]=this['voiceQueues'][_0x1c59e2[_0x4000('0x50')]]&&this['voiceQueues'][_0x1c59e2[_0x4000('0x50')]][_0x4000('0x52')]?this['voiceQueues'][_0x1c59e2['name']][_0x4000('0x52')]||_0x4000('0x53'):_0x4000('0x53');_0x1c59e2[_0x4000('0x6b')]=_0x2c3a9a[_0x4000('0x6b')];_0x1c59e2[_0x4000('0x76')]=moment()[_0x4000('0x4c')](_0x4000('0x77'));_0x1c59e2[_0x4000('0x78')]=_0x2c3a9a[_0x4000('0x78')];_0x1c59e2[_0x4000('0x79')]=_0x2c3a9a[_0x4000('0x79')];_0x1c59e2[_0x4000('0x4b')]=_0x2c3a9a[_0x4000('0x4b')];_0x1c59e2[_0x4000('0x7a')]=this[_0x4000('0x37')][_0x2c3a9a[_0x4000('0x4b')]][_0x4000('0x7a')];logger[_0x4000('0x6d')](_0x4000('0x7b'),_0x1c59e2[_0x4000('0x50')],_0x1c59e2[_0x4000('0x52')]);_[_0x4000('0x7c')](_0x1c59e2,_[_0x4000('0x7d')](_0x2c3a9a,_[_0x4000('0x7e')](_0x1c59e2)));this['queueReports'][_0x2c3a9a[_0x4000('0x4b')]]['push'](_0x1c59e2);this['channels'][_0x2c3a9a['uniqueid']]=_0x1c59e2;this[_0x4000('0x48')](_0x1c59e2,_0x4000('0x7f'));}}catch(_0x4cd75d){logger[_0x4000('0x40')](_0x4000('0x75'),_0x2c3a9a[_0x4000('0x4b')],util[_0x4000('0x41')](_0x4cd75d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4000('0xb')]['syncQueueCallerAbandon']=function(_0x446d93){try{if(this['isNotNull'](_0x446d93)){logger['debug']('[%s][voiceQueueReport][queuecallerabandon]',_0x446d93[_0x4000('0x4b')],util[_0x4000('0x41')](_0x446d93,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x446d93[_0x4000('0x4b')]]){var _0x2a0404=_[_0x4000('0x80')](this[_0x4000('0xf')][_0x446d93[_0x4000('0x4b')]]);_0x2a0404[_0x4000('0x81')]=![];_0x2a0404[_0x4000('0x82')]=null;_0x2a0404[_0x4000('0x83')]=_0x446d93[_0x4000('0x83')];_0x2a0404[_0x4000('0x84')]=_0x446d93[_0x4000('0x84')];_0x2a0404[_0x4000('0x1b')]=!![];_0x2a0404[_0x4000('0x85')]=moment()['format'](_0x4000('0x77'));_0x2a0404[_0x4000('0x86')]='ABANDONED';_0x2a0404['lastAssignedTo']=null;logger[_0x4000('0x6d')](_0x4000('0x87'),_0x2a0404[_0x4000('0x50')],_0x2a0404[_0x4000('0x52')]);this[_0x4000('0x37')][_0x446d93[_0x4000('0x4b')]]=_0x2a0404;this['emitVoiceQueueChannelRemove'](_0x2a0404,'queuecallerabandon');}}}catch(_0x47b2aa){logger[_0x4000('0x40')](_0x4000('0x88'),_0x446d93[_0x4000('0x4b')],util[_0x4000('0x41')](_0x47b2aa,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4000('0xb')][_0x4000('0x1d')]=function(_0x236c38){try{if(this[_0x4000('0x66')](_0x236c38)){logger[_0x4000('0x49')](_0x4000('0x89'),_0x236c38['uniqueid'],util[_0x4000('0x41')](_0x236c38,{'showHidden':![],'depth':null}));if(this[_0x4000('0xf')][_0x236c38[_0x4000('0x4b')]]){var _0x3b9b21=_[_0x4000('0x80')](this[_0x4000('0xf')][_0x236c38[_0x4000('0x4b')]]);_0x3b9b21[_0x4000('0x8a')]=moment()[_0x4000('0x4c')](_0x4000('0x77'));_0x3b9b21[_0x4000('0x8b')]=_0x236c38[_0x4000('0x8b')];_0x3b9b21[_0x4000('0x8c')]=_0x236c38[_0x4000('0x8c')];logger['info'](_0x4000('0x8d'),_0x3b9b21['name'],_0x3b9b21[_0x4000('0x52')],_0x236c38[_0x4000('0x8b')],_0x236c38[_0x4000('0x8c')]);this[_0x4000('0x37')][_0x236c38[_0x4000('0x4b')]]=_0x3b9b21;this[_0x4000('0x48')](_0x3b9b21,_0x4000('0x1c'));}}}catch(_0x2ef56b){logger[_0x4000('0x40')](_0x4000('0x89'),_0x236c38['uniqueid'],util['inspect'](_0x2ef56b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x4000('0x1f')]=function(_0x112fc6){try{if(this[_0x4000('0x66')](_0x112fc6)){logger[_0x4000('0x49')](_0x4000('0x8e'),_0x112fc6[_0x4000('0x4b')],util[_0x4000('0x41')](_0x112fc6,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x112fc6[_0x4000('0x4b')]]){var _0x1878c8=_[_0x4000('0x80')](this[_0x4000('0xf')][_0x112fc6[_0x4000('0x4b')]]);_0x1878c8[_0x4000('0x81')]=!![];_0x1878c8[_0x4000('0x86')]=_0x4000('0x8f');logger[_0x4000('0x6d')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x1878c8[_0x4000('0x50')],_0x1878c8[_0x4000('0x52')]);}}}catch(_0x314755){logger[_0x4000('0x40')](_0x4000('0x8e'),_0x112fc6[_0x4000('0x4b')],util[_0x4000('0x41')](_0x314755,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x4000('0x90')]=function(_0x58a54e){try{if(this['isNotNull'](_0x58a54e)){logger[_0x4000('0x49')]('[%s][voiceQueueReport][agentcomplete]',_0x58a54e[_0x4000('0x4b')],util['inspect'](_0x58a54e,{'showHidden':![],'depth':null}));if(this[_0x4000('0xf')][_0x58a54e[_0x4000('0x4b')]]){var _0x46a309=_['last'](this[_0x4000('0xf')][_0x58a54e['uniqueid']]);_0x46a309[_0x4000('0x1b')]=![];_0x46a309['queuecallerabandonAt']=null;_0x46a309[_0x4000('0x91')]=!![];_0x46a309['lastAssignedTo']=_0x58a54e[_0x4000('0x92')];_0x46a309[_0x4000('0x83')]=_0x58a54e[_0x4000('0x83')];_0x46a309['queuecallercomplete']=!![];_0x46a309['queuecallerexit']=![];_0x46a309[_0x4000('0x93')]=null;if(!_0x46a309[_0x4000('0x94')]){if(_0x58a54e[_0x4000('0x95')]=='transfer'){_0x46a309[_0x4000('0x86')]=_0x4000('0x96');logger['info'](_0x4000('0x97'),_0x46a309[_0x4000('0x50')],_0x46a309['type']);}else{if(_[_0x4000('0x98')](_0x58a54e[_0x4000('0x3c')][_0x4000('0x99')](),'local/')){if(this[_0x4000('0xf')][_0x58a54e['linkedid']]){var _0x4ee1db=_['last'](this[_0x4000('0xf')][_0x58a54e[_0x4000('0x9a')]]);_0x4ee1db['queuecallercomplete']=![];_0x4ee1db['queuecallerexit']=!![];_0x4ee1db[_0x4000('0x93')]=moment(_0x46a309[_0x4000('0x76')])[_0x4000('0x9b')](_0x58a54e[_0x4000('0x83')],_0x4000('0x9c'))[_0x4000('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x4ee1db[_0x4000('0x86')]='FORWARDTRANSFER';_0x4ee1db[_0x4000('0x94')]=!![];_0x4ee1db[_0x4000('0x9d')]=_0x4000('0x9e');_0x4ee1db[_0x4000('0x9f')]=_0x58a54e[_0x4000('0xa0')];_0x4ee1db[_0x4000('0xa1')]=_0x58a54e[_0x4000('0x4b')];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x4ee1db[_0x4000('0x50')],_0x4ee1db['type']);var _0x4e0926=this['queueReports'][_0x58a54e[_0x4000('0x9a')]];this[_0x4000('0xf')][_0x58a54e[_0x4000('0x9a')]]=this[_0x4000('0xf')][_0x58a54e[_0x4000('0x4b')]];this[_0x4000('0xf')][_0x58a54e[_0x4000('0x4b')]]=_0x4e0926;}}else{_0x46a309[_0x4000('0x86')]='COMPLETEDBY'+_0x58a54e[_0x4000('0x95')]['toUpperCase']();logger[_0x4000('0x6d')](_0x4000('0xa2'),_0x46a309[_0x4000('0x50')],_0x46a309[_0x4000('0x52')],_0x46a309['queuecallerexitreason']);}}}this[_0x4000('0x37')][_0x58a54e[_0x4000('0x4b')]]=_0x46a309;this[_0x4000('0x45')](_0x46a309,_0x4000('0x1e'));}}}catch(_0x51632d){logger[_0x4000('0x40')](_0x4000('0xa3'),_0x58a54e['uniqueid'],util[_0x4000('0x41')](_0x51632d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4000('0xb')]['syncVarSet']=function(_0x31e829){try{if(this['isNotNull'](_0x31e829)){logger[_0x4000('0x49')](_0x4000('0xa4'),_0x31e829[_0x4000('0x4b')],util[_0x4000('0x41')](_0x31e829,{'showHidden':![],'depth':null}));this[_0x4000('0xa5')](_0x31e829[_0x4000('0x4b')],_[_0x4000('0x7e')](_0x31e829[_0x4000('0xa6')])[0x0],_0x31e829[_0x4000('0xa7')]);if(this[_0x4000('0xf')][_0x31e829['uniqueid']]){var _0x234879=_[_0x4000('0x80')](this['queueReports'][_0x31e829[_0x4000('0x4b')]]);if(_0x234879){if(this[_0x4000('0x66')](_0x31e829[_0x4000('0xa6')])&&this['isNotNull'](_0x31e829['variable'][_0x4000('0xa8')])){switch(_0x31e829['value']){case _0x4000('0xa9'):_0x234879[_0x4000('0xaa')]=![];_0x234879[_0x4000('0x93')]=null;break;case _0x4000('0xab'):_0x234879[_0x4000('0xac')]=_0x4000('0xad');_0x234879[_0x4000('0xaa')]=!![];_0x234879[_0x4000('0x93')]=moment()[_0x4000('0x4c')](_0x4000('0x77'));_0x234879['queuecallerleaveAt']=moment()[_0x4000('0x4c')](_0x4000('0x77'));logger[_0x4000('0x49')](_0x4000('0xae'),_0x31e829[_0x4000('0x4b')],util[_0x4000('0x41')](_0x234879,{'showHidden':![],'depth':null}));ami[_0x4000('0x47')](_0x4000('0xaf'),_0x234879);break;default:_0x234879[_0x4000('0xaa')]=!![];_0x234879['queuecallerexitAt']=moment()[_0x4000('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x234879['queuecallerleaveAt']=moment()['format'](_0x4000('0x77'));}_0x234879[_0x4000('0x1b')]=![];_0x234879[_0x4000('0x85')]=null;_0x234879['queuecallerexitreason']=_0x31e829['value'];this[_0x4000('0x37')][_0x31e829[_0x4000('0x4b')]]=_0x234879;this['emitVoiceQueueChannelRemove'](_0x234879,_0x4000('0xb0'));}else if(this[_0x4000('0x66')](_0x31e829['variable'])&&this['isNotNull'](_0x31e829[_0x4000('0xa6')][_0x4000('0xb1')])){if(!_0x234879[_0x4000('0x1b')]){_0x234879[_0x4000('0xaa')]=!![];_0x234879[_0x4000('0x93')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x234879['queuecallerexitreason']=_0x4000('0xb2');_0x234879[_0x4000('0x8a')]=moment()[_0x4000('0x4c')](_0x4000('0x77'));this['channels'][_0x31e829['uniqueid']]=_0x234879;}}logger[_0x4000('0x6d')](_0x4000('0xb3'),_0x31e829[_0x4000('0x4b')],_0x234879[_0x4000('0x50')],_0x234879['type'],_[_0x4000('0x7e')](_0x31e829['variable'])[0x0],_0x31e829[_0x4000('0xa7')]);_0x234879['variables']=this['variables'][_0x31e829['uniqueid']];}}}}catch(_0x551720){logger[_0x4000('0x40')](_0x4000('0xa4'),_0x31e829['uniqueid'],util[_0x4000('0x41')](_0x551720,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4000('0xb')][_0x4000('0xa5')]=function(_0x2e88b6,_0x5c1e88,_0x16886b){var _0x427373=[_0x4000('0xb4'),'rtpaudioqosbridged',_0x4000('0xb5'),_0x4000('0xb6'),_0x4000('0xb7'),_0x4000('0xb8'),'rtpaudioqosrtt',_0x4000('0xb9'),_0x4000('0xba'),_0x4000('0xbb'),_0x4000('0xbc'),_0x4000('0xbd'),_0x4000('0xbe'),_0x4000('0xbf'),_0x4000('0xc0'),_0x4000('0xc1'),_0x4000('0x92'),'memberpenalty',_0x4000('0xc2')];if(!_[_0x4000('0x3a')](_0x5c1e88)&&!_[_0x4000('0xc3')](_0x427373,_0x5c1e88)){if(_['isUndefined'](this[_0x4000('0x15')][_0x2e88b6])){this[_0x4000('0x15')][_0x2e88b6]={};}this[_0x4000('0x15')][_0x2e88b6][_0x5c1e88]=_0x16886b;}};VoiceQueueReport['prototype'][_0x4000('0xc4')]=function(_0x17cdaf){try{if(this[_0x4000('0x66')](_0x17cdaf)){logger[_0x4000('0x49')](_0x4000('0xc5'),_0x17cdaf['uniqueid'],util['inspect'](_0x17cdaf,{'showHidden':![],'depth':null}));if(this[_0x4000('0xf')][_0x17cdaf[_0x4000('0x4b')]]){for(var _0x361fac=0x0,_0x574e9b={};_0x361fac0x0?_0x2eb5df:0x0;this[_0x8641('0x15')][_0x2f9863['queue']][_0x8641('0x6e')]=this[_0x8641('0x15')][_0x2f9863[_0x8641('0x67')]][_0x8641('0x6e')]>_[_0x8641('0x6b')](_0x2f9863['loggedin'])?_[_0x8641('0x6b')](_0x2f9863[_0x8641('0x6d')]):this[_0x8641('0x15')][_0x2f9863[_0x8641('0x67')]]['talking'];this[_0x8641('0x6f')](this[_0x8641('0x15')][_0x2f9863[_0x8641('0x67')]],_0x8641('0x63'));}logger[_0x8641('0x48')](_0x8641('0x70'),util[_0x8641('0x3c')](this[_0x8641('0x15')][_0x2f9863[_0x8641('0x67')]],{'showHidden':![],'depth':null}));ami[_0x8641('0x43')](_0x8641('0x71'),this['voiceQueues'][_0x2f9863[_0x8641('0x67')]]);}}}catch(_0x5b9e5f){logger[_0x8641('0x3a')](_0x8641('0x66'),util[_0x8641('0x3c')](_0x5b9e5f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8641('0xc')][_0x8641('0x72')]=function(_0x4eab32){logger['debug']('[voiceQueueReport][queuesummarycomplete]\x20event:',util['inspect'](_0x4eab32,{'showHidden':![],'depth':null}));this[_0x8641('0x65')]=!![];};VoiceQueueReport[_0x8641('0xc')][_0x8641('0x1a')]=function(_0x558763){try{if(this[_0x8641('0x5e')](_0x558763)){logger['debug'](_0x8641('0x73'),_0x558763[_0x8641('0x74')],util[_0x8641('0x3c')](_0x558763,{'showHidden':![],'depth':null}));if(_[_0x8641('0x5f')](this[_0x8641('0x11')][_0x558763[_0x8641('0x74')]]))this['queueReports'][_0x558763[_0x8641('0x74')]]=[];if(_[_0x8641('0x5f')](this['channels'][_0x558763[_0x8641('0x74')]]))this[_0x8641('0x13')][_0x558763['uniqueid']]={};var _0x40b009=new QueueReport();_0x40b009[_0x8641('0x4f')]=_0x558763[_0x8641('0x67')];_0x40b009[_0x8641('0x58')]=this[_0x8641('0x15')][_0x40b009['name']]&&this[_0x8641('0x15')][_0x40b009[_0x8641('0x4f')]][_0x8641('0x58')]?this[_0x8641('0x15')][_0x40b009[_0x8641('0x4f')]][_0x8641('0x58')]||_0x8641('0x4e'):'inbound';_0x40b009[_0x8641('0x67')]=_0x558763['queue'];_0x40b009[_0x8641('0x75')]=moment()[_0x8641('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x40b009[_0x8641('0x76')]=_0x558763[_0x8641('0x76')];_0x40b009[_0x8641('0x77')]=_0x558763[_0x8641('0x77')];_0x40b009[_0x8641('0x74')]=_0x558763['uniqueid'];_0x40b009[_0x8641('0x78')]=this[_0x8641('0x13')][_0x558763[_0x8641('0x74')]]['routealias'];logger['info'](_0x8641('0x79'),_0x40b009[_0x8641('0x4f')],_0x40b009[_0x8641('0x58')]);_[_0x8641('0x7a')](_0x40b009,_['pick'](_0x558763,_[_0x8641('0x7b')](_0x40b009)));this[_0x8641('0x11')][_0x558763['uniqueid']][_0x8641('0x7c')](_0x40b009);this[_0x8641('0x13')][_0x558763['uniqueid']]=_0x40b009;this[_0x8641('0x44')](_0x40b009,_0x8641('0x19'));}}catch(_0x2763c8){logger[_0x8641('0x3a')]('[%s][voiceQueueReport][queuecallerjoin]',_0x558763[_0x8641('0x74')],util[_0x8641('0x3c')](_0x2763c8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8641('0xc')][_0x8641('0x1c')]=function(_0x321fda){try{if(this['isNotNull'](_0x321fda)){logger[_0x8641('0x48')](_0x8641('0x7d'),_0x321fda[_0x8641('0x74')],util[_0x8641('0x3c')](_0x321fda,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x321fda[_0x8641('0x74')]]){var _0x1795d3=_[_0x8641('0x7e')](this['queueReports'][_0x321fda['uniqueid']]);_0x1795d3['queuecallercomplete']=![];_0x1795d3[_0x8641('0x7f')]=null;_0x1795d3[_0x8641('0x80')]=_0x321fda[_0x8641('0x80')];_0x1795d3[_0x8641('0x81')]=_0x321fda['originalposition'];_0x1795d3[_0x8641('0x1b')]=!![];_0x1795d3['queuecallerabandonAt']=moment()[_0x8641('0x46')](_0x8641('0x82'));_0x1795d3[_0x8641('0x83')]='ABANDONED';_0x1795d3['lastAssignedTo']=null;logger[_0x8641('0x69')](_0x8641('0x84'),_0x1795d3[_0x8641('0x4f')],_0x1795d3[_0x8641('0x58')]);this[_0x8641('0x13')][_0x321fda[_0x8641('0x74')]]=_0x1795d3;this[_0x8641('0x41')](_0x1795d3,'queuecallerabandon');}}}catch(_0x4297f6){logger['error']('[%s][voiceQueueReport][queuecallerabandon]',_0x321fda['uniqueid'],util[_0x8641('0x3c')](_0x4297f6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8641('0xc')][_0x8641('0x85')]=function(_0x4fb212){try{if(this[_0x8641('0x5e')](_0x4fb212)){logger[_0x8641('0x48')]('[%s][voiceQueueReport][queuecallerleave]',_0x4fb212[_0x8641('0x74')],util['inspect'](_0x4fb212,{'showHidden':![],'depth':null}));if(this[_0x8641('0x11')][_0x4fb212[_0x8641('0x74')]]){var _0x4a3f39=_['last'](this[_0x8641('0x11')][_0x4fb212[_0x8641('0x74')]]);_0x4a3f39['queuecallerleaveAt']=moment()[_0x8641('0x46')](_0x8641('0x82'));_0x4a3f39['connectedlinenum']=_0x4fb212[_0x8641('0x86')];_0x4a3f39[_0x8641('0x87')]=_0x4fb212[_0x8641('0x87')];logger[_0x8641('0x69')](_0x8641('0x88'),_0x4a3f39['name'],_0x4a3f39[_0x8641('0x58')],_0x4fb212[_0x8641('0x86')],_0x4fb212[_0x8641('0x87')]);this[_0x8641('0x13')][_0x4fb212[_0x8641('0x74')]]=_0x4a3f39;this['emitVoiceQueueChannelSave'](_0x4a3f39,'queuecallerleave');}}}catch(_0x4e0019){logger['error'](_0x8641('0x89'),_0x4fb212['uniqueid'],util[_0x8641('0x3c')](_0x4e0019,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8641('0xc')]['syncAgentConnect']=function(_0x5b5efc){try{if(this[_0x8641('0x5e')](_0x5b5efc)){logger[_0x8641('0x48')]('[%s][voiceQueueReport][agentconnect]',_0x5b5efc[_0x8641('0x74')],util['inspect'](_0x5b5efc,{'showHidden':![],'depth':null}));if(this[_0x8641('0x11')][_0x5b5efc[_0x8641('0x74')]]){var _0x278646=_[_0x8641('0x7e')](this[_0x8641('0x11')][_0x5b5efc[_0x8641('0x74')]]);_0x278646['queuecallercomplete']=!![];_0x278646['queuecallerexitreason']=_0x8641('0x8a');logger[_0x8641('0x69')](_0x8641('0x8b'),_0x278646[_0x8641('0x4f')],_0x278646[_0x8641('0x58')]);}}}catch(_0x3f5434){logger[_0x8641('0x3a')]('[%s][voiceQueueReport][agentconnect]',_0x5b5efc['uniqueid'],util[_0x8641('0x3c')](_0x3f5434,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8641('0xc')][_0x8641('0x1f')]=function(_0x4f266f){try{if(this[_0x8641('0x5e')](_0x4f266f)){logger[_0x8641('0x48')](_0x8641('0x8c'),_0x4f266f[_0x8641('0x74')],util['inspect'](_0x4f266f,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4f266f[_0x8641('0x74')]]){var _0x4c4f86=_[_0x8641('0x7e')](this['queueReports'][_0x4f266f[_0x8641('0x74')]]);_0x4c4f86[_0x8641('0x1b')]=![];_0x4c4f86[_0x8641('0x8d')]=null;_0x4c4f86[_0x8641('0x8e')]=!![];_0x4c4f86[_0x8641('0x8f')]=_0x4f266f[_0x8641('0x90')];_0x4c4f86['holdtime']=_0x4f266f[_0x8641('0x80')];_0x4c4f86[_0x8641('0x91')]=!![];_0x4c4f86[_0x8641('0x92')]=![];_0x4c4f86[_0x8641('0x93')]=null;if(!_0x4c4f86['transfer']){if(_0x4f266f['reason']==_0x8641('0x94')){_0x4c4f86[_0x8641('0x83')]=_0x8641('0x95');logger[_0x8641('0x69')](_0x8641('0x96'),_0x4c4f86[_0x8641('0x4f')],_0x4c4f86[_0x8641('0x58')]);}else{if(_[_0x8641('0x97')](_0x4f266f['channel'][_0x8641('0x98')](),_0x8641('0x99'))){if(this['queueReports'][_0x4f266f[_0x8641('0x9a')]]){var _0x5f4a8e=_['last'](this[_0x8641('0x11')][_0x4f266f[_0x8641('0x9a')]]);_0x5f4a8e[_0x8641('0x91')]=![];_0x5f4a8e[_0x8641('0x92')]=!![];_0x5f4a8e[_0x8641('0x93')]=moment(_0x4c4f86['queuecallerjoinAt'])[_0x8641('0x9b')](_0x4f266f[_0x8641('0x80')],_0x8641('0x9c'))['format'](_0x8641('0x82'));_0x5f4a8e[_0x8641('0x83')]=_0x8641('0x9d');_0x5f4a8e[_0x8641('0x94')]=!![];_0x5f4a8e[_0x8641('0x9e')]=_0x8641('0x9f');_0x5f4a8e[_0x8641('0xa0')]=_0x4f266f['destexten'];_0x5f4a8e[_0x8641('0xa1')]=_0x4f266f[_0x8641('0x74')];logger['info'](_0x8641('0xa2'),_0x5f4a8e['name'],_0x5f4a8e[_0x8641('0x58')]);var _0x31282a=this[_0x8641('0x11')][_0x4f266f['linkedid']];this[_0x8641('0x11')][_0x4f266f['linkedid']]=this[_0x8641('0x11')][_0x4f266f[_0x8641('0x74')]];this[_0x8641('0x11')][_0x4f266f[_0x8641('0x74')]]=_0x31282a;}}else{_0x4c4f86[_0x8641('0x83')]='COMPLETEDBY'+_0x4f266f[_0x8641('0xa3')][_0x8641('0xa4')]();logger[_0x8641('0x69')](_0x8641('0xa5'),_0x4c4f86[_0x8641('0x4f')],_0x4c4f86[_0x8641('0x58')],_0x4c4f86[_0x8641('0x83')]);}}}this[_0x8641('0x13')][_0x4f266f[_0x8641('0x74')]]=_0x4c4f86;this['emitVoiceQueueChannelRemove'](_0x4c4f86,_0x8641('0x1e'));}}}catch(_0x1c5fa3){logger[_0x8641('0x3a')]('[%s][voiceQueueReport][agentcomplete]',_0x4f266f[_0x8641('0x74')],util[_0x8641('0x3c')](_0x1c5fa3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8641('0xc')][_0x8641('0x22')]=function(_0x391614){try{if(this[_0x8641('0x5e')](_0x391614)){logger[_0x8641('0x48')](_0x8641('0xa6'),_0x391614[_0x8641('0x74')],util[_0x8641('0x3c')](_0x391614,{'showHidden':![],'depth':null}));this[_0x8641('0xa7')](_0x391614[_0x8641('0x74')],_[_0x8641('0x7b')](_0x391614[_0x8641('0xa8')])[0x0],_0x391614['value']);if(this[_0x8641('0x11')][_0x391614[_0x8641('0x74')]]){var _0x4375fe=_[_0x8641('0x7e')](this[_0x8641('0x11')][_0x391614[_0x8641('0x74')]]);if(_0x4375fe){if(this['isNotNull'](_0x391614[_0x8641('0xa8')])&&this[_0x8641('0x5e')](_0x391614['variable']['queuestatus'])){switch(_0x391614['value']){case _0x8641('0xa9'):_0x4375fe[_0x8641('0x92')]=![];_0x4375fe['queuecallerexitAt']=null;break;case _0x8641('0xaa'):_0x4375fe[_0x8641('0xab')]=_0x8641('0xac');_0x4375fe[_0x8641('0x92')]=!![];_0x4375fe['queuecallerexitAt']=moment()[_0x8641('0x46')](_0x8641('0x82'));_0x4375fe[_0x8641('0xad')]=moment()[_0x8641('0x46')](_0x8641('0x82'));logger[_0x8641('0x48')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x391614[_0x8641('0x74')],util[_0x8641('0x3c')](_0x4375fe,{'showHidden':![],'depth':null}));ami[_0x8641('0x43')](_0x8641('0xae'),_0x4375fe);break;default:_0x4375fe['queuecallerexit']=!![];_0x4375fe[_0x8641('0x93')]=moment()['format'](_0x8641('0x82'));_0x4375fe[_0x8641('0xad')]=moment()[_0x8641('0x46')](_0x8641('0x82'));}_0x4375fe[_0x8641('0x1b')]=![];_0x4375fe[_0x8641('0x8d')]=null;_0x4375fe[_0x8641('0x83')]=_0x391614[_0x8641('0xaf')];this[_0x8641('0x13')][_0x391614[_0x8641('0x74')]]=_0x4375fe;this['emitVoiceQueueChannelRemove'](_0x4375fe,_0x8641('0x21'));}else if(this[_0x8641('0x5e')](_0x391614[_0x8641('0xa8')])&&this[_0x8641('0x5e')](_0x391614[_0x8641('0xa8')][_0x8641('0xb0')])){if(!_0x4375fe[_0x8641('0x1b')]){_0x4375fe[_0x8641('0x92')]=!![];_0x4375fe['queuecallerexitAt']=moment()['format'](_0x8641('0x82'));_0x4375fe['queuecallerexitreason']='EXITWITHKEY';_0x4375fe[_0x8641('0xad')]=moment()[_0x8641('0x46')](_0x8641('0x82'));this[_0x8641('0x13')][_0x391614[_0x8641('0x74')]]=_0x4375fe;}}logger['info'](_0x8641('0xb1'),_0x391614[_0x8641('0x74')],_0x4375fe['name'],_0x4375fe[_0x8641('0x58')],_[_0x8641('0x7b')](_0x391614[_0x8641('0xa8')])[0x0],_0x391614[_0x8641('0xaf')]);_0x4375fe[_0x8641('0x16')]=this[_0x8641('0x16')][_0x391614[_0x8641('0x74')]];}}}}catch(_0x60d5c1){logger[_0x8641('0x3a')]('[%s][voiceQueueReport][varset]',_0x391614['uniqueid'],util['inspect'](_0x60d5c1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8641('0xc')]['addVariable']=function(_0x4fe886,_0x16abfa,_0x52df7c){var _0x2bd37e=[_0x8641('0xb2'),'rtpaudioqosbridged',_0x8641('0xb3'),_0x8641('0xb4'),_0x8641('0xb5'),_0x8641('0xb6'),_0x8641('0xb7'),'rtpaudioqosrttbridged',_0x8641('0xb8'),_0x8641('0xb9'),_0x8641('0xba'),'bridgepvtcallid','membercalls','memberdynamic',_0x8641('0xbb'),_0x8641('0xbc'),_0x8641('0x90'),'memberpenalty',_0x8641('0xbd')];if(!_[_0x8641('0xbe')](_0x16abfa)&&!_[_0x8641('0xbf')](_0x2bd37e,_0x16abfa)){if(_[_0x8641('0x5f')](this[_0x8641('0x16')][_0x4fe886])){this[_0x8641('0x16')][_0x4fe886]={};}this['variables'][_0x4fe886][_0x16abfa]=_0x52df7c;}};VoiceQueueReport[_0x8641('0xc')][_0x8641('0xc0')]=function(_0x42c9d2){try{if(this[_0x8641('0x5e')](_0x42c9d2)){logger[_0x8641('0x48')](_0x8641('0xc1'),_0x42c9d2[_0x8641('0x74')],util[_0x8641('0x3c')](_0x42c9d2,{'showHidden':![],'depth':null}));if(this[_0x8641('0x11')][_0x42c9d2[_0x8641('0x74')]]){for(var _0x3c1fc8=0x0,_0x5b6166={};_0x3c1fc8=0x0?moment(_0x5de7a3[_0x142c('0x17')])[_0x142c('0xb')](_0x5de7a3[_0x142c('0x16')],_0x142c('0xc')):null,'data1':_0x142c('0x18'),'data2':_0x5de7a3[_0x142c('0x11')],'data3':_0x5de7a3[_0x142c('0xf')],'data4':_0x5de7a3['dialstring']||null,'role':'agent','internal':_0x5de7a3['accountcode']?_[_0x142c('0x19')](_0x5de7a3['accountcode']):undefined,'uniqueid':_0x5de7a3[_0x142c('0x12')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x8a8d=['exten','queue','agent','accountcode','toNumber','uniqueid','Request','starttime','endtime','outbound','dialstring','lodash','util','../client','voiceQueueReport','queuecallerexitAt','CreateMemberReport','voice','lastAssignedTo','isNil','interface','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','calleridnum'];(function(_0x1488ab,_0x2b69ac){var _0x42f3c5=function(_0xa46b93){while(--_0xa46b93){_0x1488ab['push'](_0x1488ab['shift']());}};_0x42f3c5(++_0x2b69ac);}(_0x8a8d,0x1bb));var _0xd8a8=function(_0x3a6a8f,_0x3f73ef){_0x3a6a8f=_0x3a6a8f-0x0;var _0x2e2c8d=_0x8a8d[_0x3a6a8f];return _0x2e2c8d;};'use strict';var moment=require('moment');var _=require(_0xd8a8('0x0'));var util=require(_0xd8a8('0x1'));var client=require(_0xd8a8('0x2'));exports[_0xd8a8('0x3')]=function(_0x29220e){var _0x424370=_0x29220e['queuecallercompleteAt']||_0x29220e[_0xd8a8('0x4')];return client['Request'](_0xd8a8('0x5'),{'body':{'channel':_0xd8a8('0x6'),'membername':_0x29220e[_0xd8a8('0x7')],'interface':_[_0xd8a8('0x8')](_0x29220e[_0xd8a8('0x9')])?util['format'](_0xd8a8('0xa'),_0x29220e[_0xd8a8('0x7')]):_0x29220e['interface'],'type':_0xd8a8('0xb'),'enterAt':_0x29220e[_0xd8a8('0xc')],'exitAt':_0x424370,'duration':moment(_0x424370)[_0xd8a8('0xd')](_0x29220e['queuecallerleaveAt'],_0xd8a8('0xe')),'data1':'inbound','data2':_0x29220e[_0xd8a8('0xf')],'data3':_0x29220e[_0xd8a8('0x10')],'data4':null,'data5':_0x29220e[_0xd8a8('0x11')],'role':_0xd8a8('0x12'),'internal':_0x29220e[_0xd8a8('0x13')]?_[_0xd8a8('0x14')](_0x29220e['accountcode']):undefined,'uniqueid':_0x29220e[_0xd8a8('0x15')]},'log':_0xd8a8('0x5')});};exports['voiceDialReport']=function(_0x4904cb){return client[_0xd8a8('0x16')](_0xd8a8('0x5'),{'body':{'channel':_0xd8a8('0x6'),'membername':_0x4904cb['membername'],'interface':_0x4904cb[_0xd8a8('0x9')],'type':'TALKING','enterAt':_0x4904cb[_0xd8a8('0x17')],'exitAt':_0x4904cb[_0xd8a8('0x18')],'duration':moment(_0x4904cb[_0xd8a8('0x18')])[_0xd8a8('0xd')](_0x4904cb['starttime'],_0xd8a8('0xe'))>=0x0?moment(_0x4904cb[_0xd8a8('0x18')])[_0xd8a8('0xd')](_0x4904cb[_0xd8a8('0x17')],_0xd8a8('0xe')):null,'data1':_0xd8a8('0x19'),'data2':_0x4904cb[_0xd8a8('0x13')],'data3':_0x4904cb[_0xd8a8('0x10')],'data4':_0x4904cb[_0xd8a8('0x1a')]||null,'role':_0xd8a8('0x12'),'internal':_0x4904cb[_0xd8a8('0x13')]?_[_0xd8a8('0x14')](_0x4904cb[_0xd8a8('0x13')]):undefined,'uniqueid':_0x4904cb[_0xd8a8('0x15')]},'log':_0xd8a8('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 29463d8..7301fea 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 _0x9b11=['getSettings','ShowSetting','stopRecordingOnTransfer','../client'];(function(_0x226dc2,_0x505321){var _0x5a2961=function(_0x2834aa){while(--_0x2834aa){_0x226dc2['push'](_0x226dc2['shift']());}};_0x5a2961(++_0x505321);}(_0x9b11,0x12b));var _0x19b1=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x9b11[_0x2112d4];return _0x434972;};'use strict';var client=require(_0x19b1('0x0'));exports[_0x19b1('0x1')]=function(){return client['Request'](_0x19b1('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x19b1('0x3')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x9a62=['getSettings','Request','stopRecordingOnTransfer','GetSettings'];(function(_0x2bab97,_0x26d005){var _0x50b73b=function(_0x20c1e0){while(--_0x20c1e0){_0x2bab97['push'](_0x2bab97['shift']());}};_0x50b73b(++_0x26d005);}(_0x9a62,0x1bc));var _0x29a6=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x9a62[_0x42cae2];return _0x5f256f;};'use strict';var client=require('../client');exports[_0x29a6('0x0')]=function(){return client[_0x29a6('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x29a6('0x2')]},'log':_0x29a6('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 7dc34ab..1e99d06 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 _0xa71c=['Request','name','html','../client','getTemplates'];(function(_0x4648a7,_0x13b19c){var _0x5bb2c3=function(_0x2287cd){while(--_0x2287cd){_0x4648a7['push'](_0x4648a7['shift']());}};_0x5bb2c3(++_0x13b19c);}(_0xa71c,0x12a));var _0xca71=function(_0x33cea1,_0x2e24ac){_0x33cea1=_0x33cea1-0x0;var _0x42dd33=_0xa71c[_0x33cea1];return _0x42dd33;};'use strict';var client=require(_0xca71('0x0'));exports[_0xca71('0x1')]=function(_0x2ebdd1){return function(_0x199732){return client[_0xca71('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0xca71('0x3'),_0xca71('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0xef0b=['Request','GetTemplate','html','../client'];(function(_0x7dbfa3,_0x4f8dd2){var _0x3b4b88=function(_0x4ff72e){while(--_0x4ff72e){_0x7dbfa3['push'](_0x7dbfa3['shift']());}};_0x3b4b88(++_0x4f8dd2);}(_0xef0b,0x1d7));var _0xbef0=function(_0x2235ed,_0x78ab9){_0x2235ed=_0x2235ed-0x0;var _0x1c4aca=_0xef0b[_0x2235ed];return _0x1c4aca;};'use strict';var client=require(_0xbef0('0x0'));exports['getTemplates']=function(_0x100c98){return function(_0x4c0b3a){return client[_0xbef0('0x1')](_0xbef0('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0xbef0('0x3')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index b17dac4..ed14ea2 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 _0xd251=['../client','getTriggers','Request','name','status','Condition','AllConditions','field','value','AnyConditions','operator','Action','Actions','action','data1','data2','data3','data4','data5','data6','data7','GetTrigger'];(function(_0xf02b30,_0x46fbfa){var _0x2497a1=function(_0x289c8a){while(--_0x289c8a){_0xf02b30['push'](_0xf02b30['shift']());}};_0x2497a1(++_0x46fbfa);}(_0xd251,0x6e));var _0x1d25=function(_0x4586c6,_0x11c123){_0x4586c6=_0x4586c6-0x0;var _0x31f415=_0xd251[_0x4586c6];return _0x31f415;};'use strict';var client=require(_0x1d25('0x0'));exports[_0x1d25('0x1')]=function(_0xff0a29){return function(_0x24e1ac){return client[_0x1d25('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x1d25('0x3'),'channel',_0x1d25('0x4')],'include':[{'model':_0x1d25('0x5'),'as':_0x1d25('0x6'),'attributes':['id',_0x1d25('0x7'),'operator',_0x1d25('0x8')]},{'model':'Condition','as':_0x1d25('0x9'),'attributes':['id','field',_0x1d25('0xa'),_0x1d25('0x8')]},{'model':_0x1d25('0xb'),'as':_0x1d25('0xc'),'attributes':['id',_0x1d25('0xd'),_0x1d25('0xe'),_0x1d25('0xf'),_0x1d25('0x10'),_0x1d25('0x11'),_0x1d25('0x12'),_0x1d25('0x13'),_0x1d25('0x14')]}]},'log':_0x1d25('0x15')});};}; \ No newline at end of file +var _0x147a=['status','Condition','AllConditions','field','operator','AnyConditions','value','Actions','data2','data3','data4','data5','data7','../client','getTriggers','Request','GetTrigger','name','channel'];(function(_0x471540,_0x428580){var _0x10217a=function(_0x15b5f5){while(--_0x15b5f5){_0x471540['push'](_0x471540['shift']());}};_0x10217a(++_0x428580);}(_0x147a,0x163));var _0xa147=function(_0x52a857,_0xc99fa1){_0x52a857=_0x52a857-0x0;var _0x4e2aae=_0x147a[_0x52a857];return _0x4e2aae;};'use strict';var client=require(_0xa147('0x0'));exports[_0xa147('0x1')]=function(_0x2d02ab){return function(_0x2b6f9e){return client[_0xa147('0x2')](_0xa147('0x3'),{'options':{'raw':![],'attributes':['id',_0xa147('0x4'),_0xa147('0x5'),_0xa147('0x6')],'include':[{'model':_0xa147('0x7'),'as':_0xa147('0x8'),'attributes':['id',_0xa147('0x9'),_0xa147('0xa'),'value']},{'model':_0xa147('0x7'),'as':_0xa147('0xb'),'attributes':['id',_0xa147('0x9'),_0xa147('0xa'),_0xa147('0xc')]},{'model':'Action','as':_0xa147('0xd'),'attributes':['id','action','data1',_0xa147('0xe'),_0xa147('0xf'),_0xa147('0x10'),_0xa147('0x11'),'data6',_0xa147('0x12')]}]},'log':_0xa147('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 43beb47..434a2ef 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 _0xac4e=['getTrunks','Request','registry','defaultuser','GetTrunk','../client'];(function(_0x48fa1b,_0x369aa5){var _0x6b81a5=function(_0x474653){while(--_0x474653){_0x48fa1b['push'](_0x48fa1b['shift']());}};_0x6b81a5(++_0x369aa5);}(_0xac4e,0x1d9));var _0xeac4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xac4e[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0xeac4('0x0'));exports[_0xeac4('0x1')]=function(_0xdbb5d4){return function(_0x1e139a){return client[_0xeac4('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0xeac4('0x3'),_0xeac4('0x4')]},'log':_0xeac4('0x5')});};}; \ No newline at end of file +var _0xe553=['GetTrunk','name','registry','../client','getTrunks','Request'];(function(_0x5b8909,_0x3ad67f){var _0xfd723c=function(_0x5ac53d){while(--_0x5ac53d){_0x5b8909['push'](_0x5b8909['shift']());}};_0xfd723c(++_0x3ad67f);}(_0xe553,0x1a1));var _0x3e55=function(_0x5aef12,_0x1edd9d){_0x5aef12=_0x5aef12-0x0;var _0x245089=_0xe553[_0x5aef12];return _0x245089;};'use strict';var client=require(_0x3e55('0x0'));exports[_0x3e55('0x1')]=function(_0x4df1ed){return function(_0x2bc01d){return client[_0x3e55('0x2')](_0x3e55('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x3e55('0x4'),_0x3e55('0x5'),'defaultuser']},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 10d39c0..58ea737 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 _0x34e8=['../client','getAgents','Request','GetUser','name','email','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','mobile','interface','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','agent','lastPauseAt'];(function(_0x56e780,_0x333087){var _0x5f0358=function(_0x4cf864){while(--_0x4cf864){_0x56e780['push'](_0x56e780['shift']());}};_0x5f0358(++_0x333087);}(_0x34e8,0x12c));var _0x834e=function(_0x50c68e,_0x4cb8bc){_0x50c68e=_0x50c68e-0x0;var _0x21ea48=_0x34e8[_0x50c68e];return _0x21ea48;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6'),_0x834e('0x7'),_0x834e('0x8'),_0x834e('0x9'),_0x834e('0xa'),'lastPauseAt',_0x834e('0xb'),'phone',_0x834e('0xc'),_0x834e('0xd')]},'log':_0x834e('0x1')});};};exports[_0x834e('0xe')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':!![],'where':{'role':_0x834e('0xf')},'attributes':['id',_0x834e('0x4'),_0x834e('0x6'),_0x834e('0x10')]},'log':_0x834e('0xe')});};};exports[_0x834e('0x11')]=function(_0x14038b,_0x2e1a37,_0x293514){return client[_0x834e('0x2')](_0x834e('0x12'),{'body':{'type':_0x2e1a37,'uniqueid':_0x293514},'options':{'where':{'id':_0x14038b['id']}},'log':'savePause'});};exports[_0x834e('0x13')]=function(_0x6cd9b9){return client['Request'](_0x834e('0x14'),{'body':{},'options':{'where':{'id':_0x6cd9b9['id']}},'log':_0x834e('0x11')});};exports[_0x834e('0x15')]=function(_0x21cc0a){return client['Request'](_0x834e('0x16'),{'options':{'raw':![],'where':{'role':_0x834e('0x17'),'id':_0x21cc0a},'attributes':['id','name',_0x834e('0x5'),'accountcode',_0x834e('0x7'),_0x834e('0x8'),'lastLoginAt',_0x834e('0xa'),_0x834e('0x18'),_0x834e('0xb'),'interface']},'log':_0x834e('0x15')});}; \ 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(_0x5a2a8d,_0x12f945){var _0x44619e=function(_0x4bd480){while(--_0x4bd480){_0x5a2a8d['push'](_0x5a2a8d['shift']());}};_0x44619e(++_0x12f945);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'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 dec3f9c..16f41d7 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 _0xbacb=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport','update'];(function(_0x361c6a,_0x183308){var _0x32ccf0=function(_0x5ece34){while(--_0x5ece34){_0x361c6a['push'](_0x361c6a['shift']());}};_0x32ccf0(++_0x183308);}(_0xbacb,0x73));var _0xbbac=function(_0x2a0202,_0x4bfb0f){_0x2a0202=_0x2a0202-0x0;var _0x4d1c34=_0xbacb[_0x2a0202];return _0x4d1c34;};'use strict';var client=require(_0xbbac('0x0'));exports[_0xbbac('0x1')]=function(_0x505ee8){return client[_0xbbac('0x2')](_0xbbac('0x3'),{'body':_0x505ee8,'log':'CreateVoiceAgentReport'});};exports[_0xbbac('0x4')]=function(_0x589328,_0xfb9efa,_0x51ac45){return client[_0xbbac('0x2')](_0xbbac('0x5'),{'body':_0x589328,'options':{'where':{'uniqueid':_0xfb9efa,'interface':_0x51ac45,'agentcomplete':!![]}},'log':_0xbbac('0x5')});}; \ No newline at end of file +var _0xef62=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0xef62,0x81));var _0x2ef6=function(_0x3ca73e,_0x1862d2){_0x3ca73e=_0x3ca73e-0x0;var _0x3a8852=_0xef62[_0x3ca73e];return _0x3a8852;};'use strict';var client=require(_0x2ef6('0x0'));exports[_0x2ef6('0x1')]=function(_0x454b31){return client[_0x2ef6('0x2')](_0x2ef6('0x3'),{'body':_0x454b31,'log':_0x2ef6('0x3')});};exports[_0x2ef6('0x4')]=function(_0x2a8a53,_0x1c0cc5,_0x18ba35){return client['Request'](_0x2ef6('0x5'),{'body':_0x2a8a53,'options':{'where':{'uniqueid':_0x1c0cc5,'interface':_0x18ba35,'agentcomplete':!![]}},'log':_0x2ef6('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 0a8118a..f356b12 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 _0xe29f=['lodash','create','CreateVoiceCallReport','merge','calleridnum','callerid','DOCUMENTATION','getVoiceCallReports','Request','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','duration','billableseconds','GetVoiceCallReports','moment','util'];(function(_0x1fbe89,_0x1ddac5){var _0x49f966=function(_0x4c6bcc){while(--_0x4c6bcc){_0x1fbe89['push'](_0x1fbe89['shift']());}};_0x49f966(++_0x1ddac5);}(_0xe29f,0x18d));var _0xfe29=function(_0x2a5a9e,_0x57b8bd){_0x2a5a9e=_0x2a5a9e-0x0;var _0xad442f=_0xe29f[_0x2a5a9e];return _0xad442f;};'use strict';var moment=require(_0xfe29('0x0'));var util=require(_0xfe29('0x1'));var _=require(_0xfe29('0x2'));var client=require('../client');exports[_0xfe29('0x3')]=function(_0xd90620){return client['Request'](_0xfe29('0x4'),{'body':_[_0xfe29('0x5')](_0xd90620,{'source':_0xd90620[_0xfe29('0x6')],'destinationcontext':_0xd90620['context'],'callerid':_0xd90620[_0xfe29('0x7')],'amaflags':_0xfe29('0x8')}),'log':_0xfe29('0x4')});};exports[_0xfe29('0x9')]=function(){return function(){return client[_0xfe29('0xa')]('GetVoiceCallReport',{'options':{'where':{'type':[_0xfe29('0xb')],'createdAt':{'$between':[moment()[_0xfe29('0xc')](_0xfe29('0xd'))[_0xfe29('0xe')](_0xfe29('0xf')),moment()[_0xfe29('0x10')](_0xfe29('0xd'))['format'](_0xfe29('0xf'))]}},'attributes':[_0xfe29('0x11'),'disposition',_0xfe29('0x12'),_0xfe29('0x13')]},'log':_0xfe29('0x14')});};}; \ No newline at end of file +var _0xf163=['moment','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','startOf','day','format','endOf','type','disposition','duration','billableseconds'];(function(_0x4068eb,_0xfb9c72){var _0x4bf1c3=function(_0x21a0e3){while(--_0x21a0e3){_0x4068eb['push'](_0x4068eb['shift']());}};_0x4bf1c3(++_0xfb9c72);}(_0xf163,0xdc));var _0x3f16=function(_0x3861f7,_0x995b22){_0x3861f7=_0x3861f7-0x0;var _0x50879f=_0xf163[_0x3861f7];return _0x50879f;};'use strict';var moment=require(_0x3f16('0x0'));var util=require(_0x3f16('0x1'));var _=require(_0x3f16('0x2'));var client=require(_0x3f16('0x3'));exports[_0x3f16('0x4')]=function(_0x1aab58){return client[_0x3f16('0x5')](_0x3f16('0x6'),{'body':_[_0x3f16('0x7')](_0x1aab58,{'source':_0x1aab58[_0x3f16('0x8')],'destinationcontext':_0x1aab58[_0x3f16('0x9')],'callerid':_0x1aab58[_0x3f16('0xa')],'amaflags':_0x3f16('0xb')}),'log':_0x3f16('0x6')});};exports[_0x3f16('0xc')]=function(){return function(){return client[_0x3f16('0x5')](_0x3f16('0xd'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x3f16('0xe')](_0x3f16('0xf'))[_0x3f16('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x3f16('0x11')]('day')[_0x3f16('0x10')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x3f16('0x12'),_0x3f16('0x13'),_0x3f16('0x14'),_0x3f16('0x15')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 8538c17..41752e6 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 _0x3fd6=['../client','CreateVoiceDialReport'];(function(_0xd069b2,_0x1c0b81){var _0x351478=function(_0xe6ea8){while(--_0xe6ea8){_0xd069b2['push'](_0xd069b2['shift']());}};_0x351478(++_0x1c0b81);}(_0x3fd6,0x13a));var _0x63fd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3fd6[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x63fd('0x0'));exports['create']=function(_0x417cc8){return client['Request'](_0x63fd('0x1'),{'body':_0x417cc8,'log':_0x63fd('0x1')});}; \ No newline at end of file +var _0xb373=['create','CreateVoiceDialReport'];(function(_0x5774be,_0x2259d3){var _0x4914b4=function(_0x1eebc3){while(--_0x1eebc3){_0x5774be['push'](_0x5774be['shift']());}};_0x4914b4(++_0x2259d3);}(_0xb373,0x1d4));var _0x3b37=function(_0x26d1bf,_0x2e5929){_0x26d1bf=_0x26d1bf-0x0;var _0x32350c=_0xb373[_0x26d1bf];return _0x32350c;};'use strict';var client=require('../client');exports[_0x3b37('0x0')]=function(_0x1a92c8){return client['Request']('CreateVoiceDialReport',{'body':_0x1a92c8,'log':_0x3b37('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index f775c18..67533ae 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 _0x1789=['recordingFormat','../client','getVoiceExtensions','Request','exten'];(function(_0x12d1f0,_0x3bdf59){var _0x23e3df=function(_0xd16da7){while(--_0xd16da7){_0x12d1f0['push'](_0x12d1f0['shift']());}};_0x23e3df(++_0x3bdf59);}(_0x1789,0x92));var _0x9178=function(_0x5bd044,_0xafd5fa){_0x5bd044=_0x5bd044-0x0;var _0x582fd7=_0x1789[_0x5bd044];return _0x582fd7;};'use strict';var client=require(_0x9178('0x0'));exports[_0x9178('0x1')]=function(){return function(){return client[_0x9178('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x9178('0x3'),_0x9178('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x9178('0x1')});};}; \ No newline at end of file +var _0xa1fd=['recordingFormat','../client','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x2197c3,_0x310b38){var _0x120c87=function(_0x32b0bb){while(--_0x32b0bb){_0x2197c3['push'](_0x2197c3['shift']());}};_0x120c87(++_0x310b38);}(_0xa1fd,0x1b9));var _0xda1f=function(_0x5568ed,_0x61f3be){_0x5568ed=_0x5568ed-0x0;var _0x406c98=_0xa1fd[_0x5568ed];return _0x406c98;};'use strict';var client=require(_0xda1f('0x0'));exports[_0xda1f('0x1')]=function(){return function(){return client[_0xda1f('0x2')](_0xda1f('0x3'),{'options':{'raw':!![],'attributes':['id','exten',_0xda1f('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xda1f('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 2814cd6..f280f80 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 _0x96fd=['dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialCheckDuplicateType','dialAMDActive','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','active','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','GetVoiceQueue','name','acwTimeout','autopause','monitor_format','type','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x96fd,0x1e9));var _0xd96f=function(_0x484d42,_0x2de579){_0x484d42=_0x484d42-0x0;var _0x13ad64=_0x96fd[_0x484d42];return _0x13ad64;};'use strict';var client=require('../client');exports[_0xd96f('0x0')]=function(){return function(){return client['Request'](_0xd96f('0x1'),{'options':{'raw':![],'attributes':['id',_0xd96f('0x2'),'acw',_0xd96f('0x3'),_0xd96f('0x4'),_0xd96f('0x5'),_0xd96f('0x6'),'dialActive',_0xd96f('0x7'),_0xd96f('0x8'),'dialLimitQueue',_0xd96f('0x9'),_0xd96f('0xa'),_0xd96f('0xb'),_0xd96f('0xc'),_0xd96f('0xd'),_0xd96f('0xe'),_0xd96f('0xf'),_0xd96f('0x10'),_0xd96f('0x11'),_0xd96f('0x12'),_0xd96f('0x13'),_0xd96f('0x14'),_0xd96f('0x15'),_0xd96f('0x16'),_0xd96f('0x17'),_0xd96f('0x18'),_0xd96f('0x19'),_0xd96f('0x1a'),'dialGlobalInterval','dialPrefix',_0xd96f('0x1b'),_0xd96f('0x1c'),'dialAMDInitialSilence','dialAMDGreeting',_0xd96f('0x1d'),_0xd96f('0x1e'),_0xd96f('0x1f'),_0xd96f('0x20'),_0xd96f('0x21'),_0xd96f('0x22'),_0xd96f('0x23'),_0xd96f('0x24'),_0xd96f('0x25'),_0xd96f('0x26'),'dialOrderByScheduledAt',_0xd96f('0x27'),_0xd96f('0x28'),'dialQueueProject2',_0xd96f('0x5'),_0xd96f('0x29'),_0xd96f('0x2a'),_0xd96f('0x2b'),_0xd96f('0x2c'),_0xd96f('0x2d'),'dialDropMaxRetry',_0xd96f('0x2e'),_0xd96f('0x2f'),_0xd96f('0x30'),'dialMachineMaxRetry',_0xd96f('0x31'),_0xd96f('0x32'),_0xd96f('0x33'),_0xd96f('0x34'),_0xd96f('0x35'),_0xd96f('0x36'),_0xd96f('0x37')],'include':[{'model':'Trunk','as':_0xd96f('0x38'),'attributes':['id',_0xd96f('0x2'),'callerid',_0xd96f('0x39')]},{'model':'Pause','as':_0xd96f('0x3a'),'attributes':['id','name']},{'model':'Trunk','as':_0xd96f('0x3b'),'attributes':['id','name','callerid',_0xd96f('0x39')]},{'model':_0xd96f('0x3c'),'as':_0xd96f('0x3c'),'attributes':['id',_0xd96f('0x2')],'include':[{'model':_0xd96f('0x3c'),'as':_0xd96f('0x3d'),'attributes':['id','name',_0xd96f('0x3e')]}]}]},'log':_0xd96f('0x0')});};}; \ No newline at end of file +var _0x812d=['Pause','Trunk','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','dialActive','dialMethod','dialLimitChannel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialNoAnswerMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialRecallMeTimeout','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialDropMaxRetry','dialAbandonedMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','callerid'];(function(_0x12bcea,_0x2e4826){var _0x49e2ab=function(_0x20c341){while(--_0x20c341){_0x12bcea['push'](_0x12bcea['shift']());}};_0x49e2ab(++_0x2e4826);}(_0x812d,0x6e));var _0xd812=function(_0x490c15,_0x309205){_0x490c15=_0x490c15-0x0;var _0x2cc3af=_0x812d[_0x490c15];return _0x2cc3af;};'use strict';var client=require('../client');exports[_0xd812('0x0')]=function(){return function(){return client[_0xd812('0x1')](_0xd812('0x2'),{'options':{'raw':![],'attributes':['id',_0xd812('0x3'),_0xd812('0x4'),_0xd812('0x5'),_0xd812('0x6'),_0xd812('0x7'),'type',_0xd812('0x8'),_0xd812('0x9'),_0xd812('0xa'),'dialLimitQueue','dialPowerLevel',_0xd812('0xb'),_0xd812('0xc'),'dialPredictiveInterval',_0xd812('0xd'),_0xd812('0xe'),'dialOriginateTimeout',_0xd812('0xf'),_0xd812('0x10'),_0xd812('0x11'),'dialCongestionMaxRetry',_0xd812('0x12'),'dialBusyMaxRetry','dialBusyRetryFrequency',_0xd812('0x13'),'dialNoAnswerRetryFrequency','dialGlobalMaxRetry',_0xd812('0x14'),_0xd812('0x15'),_0xd812('0x16'),'dialCheckDuplicateType',_0xd812('0x17'),_0xd812('0x18'),_0xd812('0x19'),_0xd812('0x1a'),_0xd812('0x1b'),_0xd812('0x1c'),_0xd812('0x1d'),_0xd812('0x1e'),'dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout',_0xd812('0x1f'),'dialRecallInQueue','dialOrderByScheduledAt',_0xd812('0x20'),_0xd812('0x21'),_0xd812('0x22'),_0xd812('0x7'),_0xd812('0x23'),_0xd812('0x24'),_0xd812('0x25'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency',_0xd812('0x26'),'dialDropRetryFrequency',_0xd812('0x27'),'dialAbandonedRetryFrequency','dialMachineMaxRetry',_0xd812('0x28'),_0xd812('0x29'),_0xd812('0x2a'),_0xd812('0x2b'),_0xd812('0x2c'),'dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe'],'include':[{'model':'Trunk','as':'Trunk','attributes':['id',_0xd812('0x3'),_0xd812('0x2d'),'active']},{'model':_0xd812('0x2e'),'as':'mandatoryDispositionPause','attributes':['id','name']},{'model':_0xd812('0x2f'),'as':_0xd812('0x30'),'attributes':['id',_0xd812('0x3'),_0xd812('0x2d'),'active']},{'model':_0xd812('0x31'),'as':_0xd812('0x31'),'attributes':['id','name'],'include':[{'model':_0xd812('0x31'),'as':_0xd812('0x32'),'attributes':['id',_0xd812('0x3'),_0xd812('0x33')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 5b02daa..b9801ce 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(_0x472497,_0x4461a2){var _0x1b4464=function(_0x667fb4){while(--_0x667fb4){_0x472497['push'](_0x472497['shift']());}};_0x1b4464(++_0x4461a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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(_0x529e19,_0x2cfc6b){var _0x3f8099=function(_0x375d8a){while(--_0x375d8a){_0x529e19['push'](_0x529e19['shift']());}};_0x3f8099(++_0x2cfc6b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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 f6e1199..b7850ce 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 _0x7575=['getVoiceQueueRtPauses','GetVoiceQueueRtPauses','../client'];(function(_0x514c59,_0x290685){var _0x2c62c8=function(_0x22be9d){while(--_0x22be9d){_0x514c59['push'](_0x514c59['shift']());}};_0x2c62c8(++_0x290685);}(_0x7575,0x8c));var _0x5757=function(_0x3f48b5,_0x2f5fd3){_0x3f48b5=_0x3f48b5-0x0;var _0x26c697=_0x7575[_0x3f48b5];return _0x26c697;};'use strict';var client=require(_0x5757('0x0'));exports[_0x5757('0x1')]=function(_0xab27d5){return function(){return client['Request'](_0x5757('0x2'),{'options':{'where':{'VoiceQueueId':_0xab27d5,'paused':!![]},'raw':!![]},'log':_0x5757('0x1')});};}; \ No newline at end of file +var _0x0167=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x3221dc,_0x531586){var _0x27b26d=function(_0x1ee6f0){while(--_0x1ee6f0){_0x3221dc['push'](_0x3221dc['shift']());}};_0x27b26d(++_0x531586);}(_0x0167,0x1e0));var _0x7016=function(_0x1771bb,_0x47c8c3){_0x1771bb=_0x1771bb-0x0;var _0x1af9ed=_0x0167[_0x1771bb];return _0x1af9ed;};'use strict';var client=require('../client');exports[_0x7016('0x0')]=function(_0x211a36){return function(){return client[_0x7016('0x1')](_0x7016('0x2'),{'options':{'where':{'VoiceQueueId':_0x211a36,'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 4f9b45b..f82b2f9 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x20a63e,_0xcb0bea){var _0x56fe3d=function(_0x2d4208){while(--_0x2d4208){_0x20a63e['push'](_0x20a63e['shift']());}};_0x56fe3d(++_0xcb0bea);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x2746dc,_0x50c380){var _0x212d8b=function(_0x52cc89){while(--_0x52cc89){_0x2746dc['push'](_0x2746dc['shift']());}};_0x212d8b(++_0x50c380);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 32d2bda..66e7da9 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 _0x8c69=['transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','context','extension','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridname'];(function(_0xa2c5e9,_0x5bbaed){var _0x44d9d8=function(_0x2b397c){while(--_0x2b397c){_0xa2c5e9['push'](_0xa2c5e9['shift']());}};_0x44d9d8(++_0x5bbaed);}(_0x8c69,0x1b6));var _0x98c6=function(_0x19c681,_0x3b0400){_0x19c681=_0x19c681-0x0;var _0x357546=_0x8c69[_0x19c681];return _0x357546;};'use strict';var client=require(_0x98c6('0x0'));exports[_0x98c6('0x1')]={};exports['blindTransfer']=function(_0x31a8b0){return client[_0x98c6('0x2')](_0x98c6('0x3'),{'body':{'result':_0x31a8b0[_0x98c6('0x4')],'transfererchannel':_0x31a8b0[_0x98c6('0x5')],'transferercalleridnum':_0x31a8b0[_0x98c6('0x6')],'transferercalleridname':_0x31a8b0[_0x98c6('0x7')],'transfererconnectedlinenum':_0x31a8b0['transfererconnectedlinenum'],'transfererconnectedlinename':_0x31a8b0['transfererconnectedlinename'],'transfereraccountcode':_0x31a8b0[_0x98c6('0x8')],'transferercontext':_0x31a8b0[_0x98c6('0x9')],'transfererexten':_0x31a8b0[_0x98c6('0xa')],'transfererlinkedid':_0x31a8b0[_0x98c6('0xb')],'transfereechannel':_0x31a8b0[_0x98c6('0xc')],'transfereecalleridnum':_0x31a8b0[_0x98c6('0xd')],'transfereecalleridname':_0x31a8b0[_0x98c6('0xe')],'transfereeconnectedlinenum':_0x31a8b0['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x31a8b0['transfereeconnectedlinename'],'transfereeaccountcode':_0x31a8b0[_0x98c6('0xf')],'transfereecontext':_0x31a8b0[_0x98c6('0x10')],'transfereeexten':_0x31a8b0['transfereeexten'],'transfereelinkedid':_0x31a8b0[_0x98c6('0x11')],'isexternal':_0x31a8b0[_0x98c6('0x12')],'context':_0x31a8b0[_0x98c6('0x13')],'extension':_0x31a8b0[_0x98c6('0x14')],'type':'blind'},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0x207960){return client[_0x98c6('0x2')](_0x98c6('0x3'),{'body':{'result':_0x207960[_0x98c6('0x4')],'transfererchannel':_0x207960[_0x98c6('0x15')],'transferercalleridnum':_0x207960[_0x98c6('0x16')],'transferercalleridname':_0x207960[_0x98c6('0x17')],'transfererconnectedlinenum':_0x207960[_0x98c6('0x18')],'transfererconnectedlinename':_0x207960[_0x98c6('0x19')],'transfereraccountcode':_0x207960['origtransfereraccountcode'],'transferercontext':_0x207960[_0x98c6('0x1a')],'transfererexten':_0x207960[_0x98c6('0x1b')],'transfererlinkedid':_0x207960['origtransfererlinkedid'],'transfereechannel':_0x207960[_0x98c6('0x1c')],'transfereecalleridnum':_0x207960['transfertargetcalleridnum'],'transfereecalleridname':_0x207960[_0x98c6('0x1d')],'transfereeconnectedlinenum':_0x207960[_0x98c6('0x1e')],'transfereeconnectedlinename':_0x207960[_0x98c6('0x1f')],'transfereeaccountcode':_0x207960[_0x98c6('0x20')],'transfereecontext':_0x207960[_0x98c6('0x21')],'transfereeexten':_0x207960[_0x98c6('0x22')],'transfereelinkedid':_0x207960[_0x98c6('0x23')],'isexternal':_0x207960[_0x98c6('0x12')],'context':_0x207960[_0x98c6('0x24')],'extension':_0x207960[_0x98c6('0x25')],'type':_0x98c6('0x26')},'log':_0x98c6('0x3')});}; \ No newline at end of file +var _0x73d6=['transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','context','Request','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetconnectedlinename','transfertargetexten','isexternal','origtransferercontext','attended','transfers','blindTransfer','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transferercontext','transfererexten','transfererlinkedid'];(function(_0x4bcf9a,_0xd2e27){var _0x16d1af=function(_0x51856a){while(--_0x51856a){_0x4bcf9a['push'](_0x4bcf9a['shift']());}};_0x16d1af(++_0xd2e27);}(_0x73d6,0xaa));var _0x673d=function(_0xd27ded,_0x1164e2){_0xd27ded=_0xd27ded-0x0;var _0x5ef850=_0x73d6[_0xd27ded];return _0x5ef850;};'use strict';var client=require('../client');exports[_0x673d('0x0')]={};exports[_0x673d('0x1')]=function(_0x22c7d8){return client['Request'](_0x673d('0x2'),{'body':{'result':_0x22c7d8['result'],'transfererchannel':_0x22c7d8[_0x673d('0x3')],'transferercalleridnum':_0x22c7d8[_0x673d('0x4')],'transferercalleridname':_0x22c7d8[_0x673d('0x5')],'transfererconnectedlinenum':_0x22c7d8[_0x673d('0x6')],'transfererconnectedlinename':_0x22c7d8['transfererconnectedlinename'],'transfereraccountcode':_0x22c7d8['transfereraccountcode'],'transferercontext':_0x22c7d8[_0x673d('0x7')],'transfererexten':_0x22c7d8[_0x673d('0x8')],'transfererlinkedid':_0x22c7d8[_0x673d('0x9')],'transfereechannel':_0x22c7d8[_0x673d('0xa')],'transfereecalleridnum':_0x22c7d8[_0x673d('0xb')],'transfereecalleridname':_0x22c7d8[_0x673d('0xc')],'transfereeconnectedlinenum':_0x22c7d8[_0x673d('0xd')],'transfereeconnectedlinename':_0x22c7d8[_0x673d('0xe')],'transfereeaccountcode':_0x22c7d8[_0x673d('0xf')],'transfereecontext':_0x22c7d8[_0x673d('0x10')],'transfereeexten':_0x22c7d8[_0x673d('0x11')],'transfereelinkedid':_0x22c7d8[_0x673d('0x12')],'isexternal':_0x22c7d8['isexternal'],'context':_0x22c7d8[_0x673d('0x13')],'extension':_0x22c7d8['extension'],'type':'blind'},'log':_0x673d('0x2')});};exports['attendedTransfer']=function(_0x26e291){return client[_0x673d('0x14')](_0x673d('0x2'),{'body':{'result':_0x26e291['result'],'transfererchannel':_0x26e291[_0x673d('0x15')],'transferercalleridnum':_0x26e291[_0x673d('0x16')],'transferercalleridname':_0x26e291[_0x673d('0x17')],'transfererconnectedlinenum':_0x26e291[_0x673d('0x18')],'transfererconnectedlinename':_0x26e291[_0x673d('0x19')],'transfereraccountcode':_0x26e291[_0x673d('0x1a')],'transferercontext':_0x26e291[_0x673d('0x1b')],'transfererexten':_0x26e291[_0x673d('0x1c')],'transfererlinkedid':_0x26e291[_0x673d('0x1d')],'transfereechannel':_0x26e291['transfertargetchannel'],'transfereecalleridnum':_0x26e291[_0x673d('0x1e')],'transfereecalleridname':_0x26e291['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x26e291['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x26e291[_0x673d('0x1f')],'transfereeaccountcode':_0x26e291['transfertargetaccountcode'],'transfereecontext':_0x26e291['transfertargetcontext'],'transfereeexten':_0x26e291[_0x673d('0x20')],'transfereelinkedid':_0x26e291['transfertargetlinkedid'],'isexternal':_0x26e291[_0x673d('0x21')],'context':_0x26e291[_0x673d('0x22')],'extension':_0x26e291['origtransfererexten'],'type':_0x673d('0x23')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 2e53dd7..0993b81 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 _0x3024=['hasOwnProperty','available','pTalking','sumBillable','sumHoldTime','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','push','length','find','omit','undefined','channels','voicechannel','map','uniqueid','channel','filename','wav','ai(mixmonitorid)','monitors','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','resolve','StopMixMonitor','destinationchannel','stop','%s.%s','Channel\x20doesn\x27t\x20exist','voicequeuechannel','voicequeuechannelhangup','queueChannels','Hangup','voicequeuechannelredirect','context','values','telephones','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','faxAccounts','send','checkAfterSend','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','validate','bluebird','../properties','listen','format','%s/%s','name','timers','timer','agents','updateStatusRealtime','QueuePause','isConnected','asterisk','ami\x20disconnected','join','keys','module','action','Reload','Action','then','message','catch','error','username','pick','Command','content','voiceQueues'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x3024,0x64));var _0x4302=function(_0x2cc621,_0x5a54dc){_0x2cc621=_0x2cc621-0x0;var _0x5cf5e4=_0x3024[_0x2cc621];return _0x5cf5e4;};'use strict';var _=require(_0x4302('0x0'));var util=require(_0x4302('0x1'));var jayson=require('jayson/promise');var schema=require(_0x4302('0x2'));var BPromise=require(_0x4302('0x3'));var moment=require('moment');var config=require('../../../config/environment');var properties=require(_0x4302('0x4'));var ami=require('../ami');exports[_0x4302('0x5')]=function(_0x1d9b55,_0x574548,_0x13d051){return new BPromise(function(_0x5f20,_0x4c3983){var _0xced9fc={'QueuePause':function(_0x2aecd7){return new Promise(function(_0x3c007b,_0x285613){var _0x22cb00=util[_0x4302('0x6')](_0x4302('0x7'),'SIP',_0x2aecd7[_0x4302('0x8')]);if(_0x1d9b55[_0x4302('0x9')]&&_0x1d9b55[_0x4302('0x9')][_0x22cb00]&&_0x1d9b55['timers'][_0x22cb00][_0x4302('0xa')]){_0x1d9b55[_0x4302('0x9')][_0x22cb00]['updateAcw']();}if(_0x1d9b55[_0x4302('0xb')][_0x22cb00]){_0x1d9b55[_0x4302('0xb')][_0x22cb00][_0x4302('0xc')]({'statePause':_0x2aecd7['pause']?!![]:![]});}_0x3c007b({'code':0xc8,'message':_0x4302('0xd')});});},'Reload':function(_0x177706){var _0x567c6e=this;return new Promise(function(_0x1f67ba,_0x41b495){if(ami[_0x4302('0xe')]()==![]){return _0x41b495(_0x567c6e['error'](0x1f4,[config[_0x4302('0xf')]['ip'],config[_0x4302('0xf')]['username'],_0x4302('0x10')][_0x4302('0x11')]('\x20')));}_0x177706=_['pick'](_0x177706,_[_0x4302('0x12')](properties[_0x4302('0x13')]));_0x177706[_0x4302('0x14')]=_0x4302('0x15');return ami[_0x4302('0x16')](_0x177706)[_0x4302('0x17')](function(_0x3ff185){_0x1f67ba({'code':0xc8,'message':_0x3ff185[_0x4302('0x18')]});})[_0x4302('0x19')](function(_0x41de23){_0x41b495(_0x567c6e[_0x4302('0x1a')](0x1f5,_0x41de23[_0x4302('0x18')]));});});},'Command':function(_0x44a594){var _0xa736ce=this;return new Promise(function(_0x4c24fc,_0x161780){if(ami['isConnected']()==![]){return _0x161780(_0xa736ce[_0x4302('0x1a')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x4302('0x1b')],_0x4302('0x10')][_0x4302('0x11')]('\x20')));}_0x44a594=_[_0x4302('0x1c')](_0x44a594,'command');_0x44a594['action']=_0x4302('0x1d');return ami[_0x4302('0x16')](_0x44a594)[_0x4302('0x17')](function(_0x4b259d){_0x4c24fc({'code':0xc8,'message':_0x4b259d[_0x4302('0x1e')]});})[_0x4302('0x19')](function(_0x72ed32){_0x161780(_0xa736ce[_0x4302('0x1a')](0x1f5,_0x72ed32['message']));});});},'VoiceQueues':function(_0x4b330f){return new Promise(function(_0x481a9d,_0x5a2952){var _0x1021b1=[];for(var _0x3ffa91 in _0x1d9b55['voiceQueues']){if(_0x1d9b55[_0x4302('0x1f')][_0x4302('0x20')](_0x3ffa91)){var _0x20fe19=_0x1d9b55['voiceQueues'][_0x3ffa91];var _0x17a8b7={'id':_0x20fe19['id'],'name':_0x20fe19['name'],'strategy':_0x20fe19['strategy'],'answered':_0x20fe19['answered'],'available':_0x20fe19[_0x4302('0x21')],'loggedIn':_0x20fe19['loggedIn'],'pTalking':_0x20fe19[_0x4302('0x22')],'sumBillable':_0x20fe19[_0x4302('0x23')],'sumDuration':_0x20fe19['sumDuration'],'sumHoldTime':_0x20fe19[_0x4302('0x24')]||0x0,'talking':_0x20fe19['talking'],'total':_0x20fe19[_0x4302('0x25')],'type':_0x20fe19[_0x4302('0x26')],'unmanaged':_0x20fe19[_0x4302('0x27')],'abandoned':_0x20fe19[_0x4302('0x28')],'waiting':_0x20fe19[_0x4302('0x29')],'loggedInDb':_0x20fe19[_0x4302('0x2a')]};if(_0x20fe19[_0x4302('0x26')]===_0x4302('0x2b')){_0x17a8b7[_0x4302('0x2c')]=_0x20fe19['dialActive'];_0x17a8b7[_0x4302('0x2d')]=_0x20fe19[_0x4302('0x2d')];_0x17a8b7[_0x4302('0x2e')]=_0x20fe19[_0x4302('0x2e')];_0x17a8b7['dialOriginateCallerIdNumber']=_0x20fe19[_0x4302('0x2f')];_0x17a8b7[_0x4302('0x30')]=_0x20fe19[_0x4302('0x30')];_0x17a8b7[_0x4302('0x31')]=_0x20fe19[_0x4302('0x31')];_0x17a8b7['temp']=_0x20fe19[_0x4302('0x32')];_0x17a8b7[_0x4302('0x33')]=_0x20fe19[_0x4302('0x33')];_0x17a8b7[_0x4302('0x34')]=_0x20fe19[_0x4302('0x34')];_0x17a8b7[_0x4302('0x35')]=_0x20fe19[_0x4302('0x35')];_0x17a8b7[_0x4302('0x36')]=_0x20fe19[_0x4302('0x36')];_0x17a8b7['outboundCongestionCallsDay']=_0x20fe19[_0x4302('0x37')];_0x17a8b7['outboundDropCallsDayACS']=_0x20fe19[_0x4302('0x38')];_0x17a8b7['outboundDropCallsDayCallersExit']=_0x20fe19['outboundDropCallsDayCallersExit'];_0x17a8b7[_0x4302('0x39')]=_0x20fe19[_0x4302('0x39')];_0x17a8b7[_0x4302('0x3a')]=_0x20fe19['outboundNoAnswerCallsDay'];_0x17a8b7[_0x4302('0x3b')]=_0x20fe19[_0x4302('0x3b')];_0x17a8b7[_0x4302('0x3c')]=_0x20fe19[_0x4302('0x3c')];_0x17a8b7['outboundReCallsDay']=_0x20fe19[_0x4302('0x3d')];_0x17a8b7['outboundRejectCallsDay']=_0x20fe19[_0x4302('0x3e')];_0x17a8b7[_0x4302('0x3f')]=_0x20fe19[_0x4302('0x3f')];_0x17a8b7[_0x4302('0x40')]=_0x20fe19[_0x4302('0x40')];_0x17a8b7['predictiveIntervalAvgHoldtime']=_0x20fe19[_0x4302('0x41')];_0x17a8b7['predictiveIntervalAvgTalktime']=_0x20fe19['predictiveIntervalAvgTalktime'];_0x17a8b7['predictiveIntervalDroppedCallsCallersExit']=_0x20fe19[_0x4302('0x42')];_0x17a8b7[_0x4302('0x43')]=_0x20fe19[_0x4302('0x43')];_0x17a8b7[_0x4302('0x44')]=_0x20fe19[_0x4302('0x44')];_0x17a8b7[_0x4302('0x45')]=_0x20fe19[_0x4302('0x45')];_0x17a8b7[_0x4302('0x46')]=_0x20fe19[_0x4302('0x46')];_0x17a8b7[_0x4302('0x47')]=_0x20fe19['predictiveIntervalMultiplicativeFactor'];_0x17a8b7['predictiveIntervalPauses']=_0x20fe19[_0x4302('0x48')];_0x17a8b7[_0x4302('0x49')]=_0x20fe19[_0x4302('0x49')];_0x17a8b7[_0x4302('0x4a')]=_0x20fe19['predictiveIntervalTotalCalls'];_0x17a8b7['message']=_0x20fe19[_0x4302('0x18')];_0x17a8b7[_0x4302('0x4b')]=_0x20fe19[_0x4302('0x4b')];_0x17a8b7[_0x4302('0x4c')]=_0x20fe19[_0x4302('0x4c')];_0x17a8b7[_0x4302('0x4d')]=_0x20fe19['erlangCallToSecond'];_0x17a8b7[_0x4302('0x4e')]=_0x20fe19['erlangAbandonmentRate'];_0x17a8b7[_0x4302('0x4f')]=_0x20fe19[_0x4302('0x4f')];_0x17a8b7[_0x4302('0x50')]=_0x20fe19[_0x4302('0x50')];_0x17a8b7['startProgressive']=_0x20fe19[_0x4302('0x51')];}if(_0x20fe19[_0x4302('0x52')]){_0x17a8b7[_0x4302('0x52')]={'id':_0x20fe19[_0x4302('0x52')]['id'],'name':_0x20fe19[_0x4302('0x52')]['name'],'active':_0x20fe19[_0x4302('0x52')][_0x4302('0x53')],'callerid':_0x20fe19['Trunk']['callerid']};}if(_0x20fe19[_0x4302('0x54')]){_0x17a8b7[_0x4302('0x54')]={'id':_0x20fe19['Interval']['id'],'name':_0x20fe19[_0x4302('0x54')][_0x4302('0x8')]};}_0x1021b1[_0x4302('0x55')](_0x17a8b7);}}_0x481a9d({'count':_0x1021b1[_0x4302('0x56')],'rows':_0x1021b1});});},'UpdateVoiceQueue':function(_0x25d875){return new Promise(function(_0x329869,_0x187ec3){var _0x24ce01=_[_0x4302('0x57')](_0x1d9b55[_0x4302('0x1f')],{'id':parseInt(_0x25d875['id'])});var _0x519865=_[_0x4302('0x58')](_0x25d875,['id']);if(_0x24ce01){for(var _0x4ce759 in _0x519865){if(typeof _0x519865[_0x4ce759]!==_0x4302('0x59')&&typeof _0x24ce01[_0x4ce759]!=='undefined'){_0x24ce01[_0x4ce759]=_0x519865[_0x4ce759];}}_0x329869(_0x24ce01);}else{_0x187ec3();}});},'VoiceChannels':function(_0x4678c1){return new Promise(function(_0x4ba5e,_0x577d17){var _0x34bc72=_['values'](_0x1d9b55[_0x4302('0x5a')]);_0x4ba5e({'count':_0x34bc72['length'],'rows':_0x34bc72});});},'VoiceChannelMixMonitor':function(_0x3ba272){var _0x34f7ab=this;return new Promise(function(_0x3b8bf8,_0xb05578){if(ami[_0x4302('0xe')]()==![]){return _0xb05578(_0x34f7ab[_0x4302('0x1a')](0x1f4,[config['asterisk']['ip'],config[_0x4302('0xf')][_0x4302('0x1b')],_0x4302('0x10')][_0x4302('0x11')]('\x20')));}var _0x4e6792=schema(properties[_0x4302('0x5b')])[_0x4302('0x2')](_0x3ba272);if(_0x4e6792[_0x4302('0x56')]>0x0){return _0xb05578(_0x34f7ab[_0x4302('0x1a')](0x1f4,_[_0x4302('0x5c')](_0x4e6792,_0x4302('0x18'))[_0x4302('0x11')](',\x20')));}var _0x44515a=_[_0x4302('0x57')](_0x1d9b55[_0x4302('0x5a')],{'uniqueid':_0x3ba272[_0x4302('0x5d')]});if(_0x44515a&&_0x44515a[_0x4302('0x5e')]){var _0x2e9b3e=util[_0x4302('0x6')]('%s.%s',_0x3ba272[_0x4302('0x5f')]||_0x3ba272['uniqueid'],_0x3ba272[_0x4302('0x6')]||_0x4302('0x60'));return ami['Action']({'action':'MixMonitor','channel':_0x44515a[_0x4302('0x5e')],'file':_0x2e9b3e,'options':_0x4302('0x61')})[_0x4302('0x17')](function(_0x5a2291){var _0x51cf46=_['find'](_0x44515a[_0x4302('0x62')],{'filename':'/var/spool/asterisk/monitor/'+_0x2e9b3e[_0x4302('0x63')]()});if(_[_0x4302('0x64')](_0x51cf46)){_0x44515a['monitors'][_0x4302('0x55')]({'filename':'/var/spool/asterisk/monitor/'+_0x2e9b3e[_0x4302('0x63')](),'createdAt':moment()['format'](_0x4302('0x65')),'mixmonitorid':_0x5a2291['mixmonitorid'],'status':_0x4302('0x66')});}else{_0x51cf46[_0x4302('0x67')]=_0x5a2291['mixmonitorid'];_0x51cf46[_0x4302('0x68')]=_0x4302('0x66');}_0x3b8bf8({'code':0xc8,'message':[_0x3ba272[_0x4302('0x5d')],'MixMonitor\x20Success',_0x5a2291[_0x4302('0x67')]][_0x4302('0x11')]('\x20'),'mixmonitorid':_0x5a2291['mixmonitorid']});})[_0x4302('0x19')](function(_0x3568aa){_0xb05578(_0x34f7ab[_0x4302('0x1a')](0x1f5,[_0x3ba272[_0x4302('0x5d')],_0x3568aa[_0x4302('0x18')][_0x4302('0x63')]()][_0x4302('0x11')]('\x20')));});}else{return _0xb05578(_0x34f7ab[_0x4302('0x1a')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x50c87b){var _0x3f605b=this;return new Promise(function(_0xf27f6,_0x4a1b55){if(ami[_0x4302('0xe')]()==![]){return _0x4a1b55(_0x3f605b[_0x4302('0x1a')](0x1f4,[config[_0x4302('0xf')]['ip'],config[_0x4302('0xf')][_0x4302('0x1b')],'ami\x20disconnected'][_0x4302('0x11')]('\x20')));}var _0x13b333=schema(properties[_0x4302('0x5b')])[_0x4302('0x2')](_0x50c87b);if(_0x13b333[_0x4302('0x56')]>0x0){return _0x4a1b55(_0x3f605b[_0x4302('0x1a')](0x1f4,_[_0x4302('0x5c')](_0x13b333,_0x4302('0x18'))['join'](',\x20')));}var _0x1720f2=_['find'](_0x1d9b55[_0x4302('0x5a')],{'uniqueid':_0x50c87b['uniqueid']});if(_0x1720f2){return BPromise[_0x4302('0x69')]()[_0x4302('0x17')](function(){if(_0x1720f2[_0x4302('0x5e')]){return ami[_0x4302('0x16')]({'action':_0x4302('0x6a'),'channel':_0x1720f2[_0x4302('0x5e')],'mixmonitorid':_0x50c87b[_0x4302('0x67')]})[_0x4302('0x19')](function(_0x339ea3){});}})['then'](function(){if(_0x1720f2[_0x4302('0x6b')]){return ami['Action']({'action':_0x4302('0x6a'),'channel':_0x1720f2[_0x4302('0x6b')],'mixmonitorid':_0x50c87b[_0x4302('0x67')]})[_0x4302('0x19')](function(_0x5c713e){});}})[_0x4302('0x17')](function(_0x1fe403){var _0x431de6=_[_0x4302('0x57')](_0x1720f2[_0x4302('0x62')],{'mixmonitorid':_0x50c87b[_0x4302('0x67')]});if(_0x431de6){_0x431de6['status']=_0x4302('0x6c');}})[_0x4302('0x17')](function(){var _0x2c10ac=util[_0x4302('0x6')](_0x4302('0x6d'),_0x50c87b[_0x4302('0x5f')]||_0x50c87b[_0x4302('0x5d')],_0x50c87b[_0x4302('0x6')]||_0x4302('0x60'));var _0xd54642=_[_0x4302('0x57')](_0x1720f2[_0x4302('0x62')],{'filename':'/var/spool/asterisk/monitor/'+_0x2c10ac['toLowerCase']()});if(_0xd54642){_0xd54642[_0x4302('0x68')]=_0x4302('0x6c');}})[_0x4302('0x17')](function(){_0xf27f6({'code':0xc8,'message':[_0x50c87b[_0x4302('0x5d')],'StopMixMonitor\x20Success'][_0x4302('0x11')]('\x20')});})['catch'](function(_0x5e5dd5){_0x4a1b55(_0x3f605b[_0x4302('0x1a')](0x1f5,[_0x50c87b[_0x4302('0x5d')],_0x5e5dd5[_0x4302('0x18')]['toLowerCase']()][_0x4302('0x11')]('\x20')));});}else{return _0x4a1b55(_0x3f605b[_0x4302('0x1a')](0x1f5,_0x4302('0x6e')));}});},'VoiceQueuesChannels':function(_0x54bc4f){return new Promise(function(_0x5e3f77,_0x57812c){var _0x323708=_['values'](_0x1d9b55['queueChannels']);_0x5e3f77({'count':_0x323708[_0x4302('0x56')],'rows':_0x323708});});},'VoiceQueuesChannel':function(_0x56bb08){var _0x490f66=this;return new Promise(function(_0x1b94cf,_0x64a9fb){var _0x48dc7a=schema(properties[_0x4302('0x6f')])[_0x4302('0x2')](_0x56bb08);if(_0x48dc7a[_0x4302('0x56')]>0x0){return _0x64a9fb(_0x490f66[_0x4302('0x1a')](0x1f4,_[_0x4302('0x5c')](_0x48dc7a,_0x4302('0x18'))['join'](',\x20')));}var _0x3baeec=_[_0x4302('0x57')](_0x1d9b55['queueChannels'],{'uniqueid':_0x56bb08[_0x4302('0x5d')]});if(_0x3baeec){_0x1b94cf(_0x3baeec);}else{return _0x64a9fb(_0x490f66[_0x4302('0x1a')](0x1f5,_0x4302('0x6e')));}});},'VoiceQueuesChannelHangup':function(_0x5098c5){var _0x3b2cae=this;return new Promise(function(_0x53dfd4,_0x2b429a){if(ami[_0x4302('0xe')]()==![]){return _0x2b429a(_0x3b2cae[_0x4302('0x1a')](0x1f4,[config[_0x4302('0xf')]['ip'],config['asterisk'][_0x4302('0x1b')],_0x4302('0x10')][_0x4302('0x11')]('\x20')));}var _0x588491=schema(properties[_0x4302('0x70')])[_0x4302('0x2')](_0x5098c5);if(_0x588491[_0x4302('0x56')]>0x0){return _0x2b429a(_0x3b2cae[_0x4302('0x1a')](0x1f4,_[_0x4302('0x5c')](_0x588491,'message')[_0x4302('0x11')](',\x20')));}var _0x3424b4=_['find'](_0x1d9b55[_0x4302('0x71')],{'uniqueid':_0x5098c5[_0x4302('0x5d')]});if(_0x3424b4&&_0x3424b4[_0x4302('0x5e')]){return ami[_0x4302('0x16')]({'action':_0x4302('0x72'),'channel':_0x3424b4[_0x4302('0x5e')]})[_0x4302('0x17')](function(_0x26d992){_0x53dfd4({'code':0xc8,'message':[_0x5098c5[_0x4302('0x5d')],_0x26d992[_0x4302('0x18')][_0x4302('0x63')]()][_0x4302('0x11')]('\x20')});})['catch'](function(_0x4eeebe){_0x2b429a(_0x3b2cae[_0x4302('0x1a')](0x1f5,[_0x5098c5[_0x4302('0x5d')],_0x4eeebe[_0x4302('0x18')]['toLowerCase']()][_0x4302('0x11')]('\x20')));});}else{return _0x2b429a(_0x3b2cae[_0x4302('0x1a')](0x1f5,_0x4302('0x6e')));}});},'VoiceQueuesChannelRedirect':function(_0x621ab8){var _0xfc594a=this;return new Promise(function(_0x5d4da3,_0x169b89){if(ami['isConnected']()==![]){return _0x169b89(_0xfc594a[_0x4302('0x1a')](0x1f4,[config[_0x4302('0xf')]['ip'],config['asterisk'][_0x4302('0x1b')],_0x4302('0x10')][_0x4302('0x11')]('\x20')));}var _0x2e94b0=schema(properties[_0x4302('0x73')])[_0x4302('0x2')](_0x621ab8);if(_0x2e94b0[_0x4302('0x56')]>0x0){return _0x169b89(_0xfc594a['error'](0x1f4,_[_0x4302('0x5c')](_0x2e94b0,_0x4302('0x18'))[_0x4302('0x11')](',\x20')));}var _0x3c94b5=_['find'](_0x1d9b55[_0x4302('0x71')],{'uniqueid':_0x621ab8[_0x4302('0x5d')]});if(_0x3c94b5&&_0x3c94b5['channel']){return ami[_0x4302('0x16')]({'action':'Redirect','channel':_0x3c94b5[_0x4302('0x5e')],'exten':_0x621ab8['exten'],'context':_0x621ab8['context']||_0x3c94b5[_0x4302('0x74')],'priority':0x1})[_0x4302('0x17')](function(_0x491cec){_0x5d4da3({'code':0xc8,'message':[_0x621ab8[_0x4302('0x5d')],_0x491cec[_0x4302('0x18')][_0x4302('0x63')]()]['join']('\x20')});})[_0x4302('0x19')](function(_0x298a6d){_0x169b89(_0xfc594a[_0x4302('0x1a')](0x1f5,[_0x621ab8[_0x4302('0x5d')],_0x298a6d['message'][_0x4302('0x63')]()][_0x4302('0x11')]('\x20')));});}else{return _0x169b89(_0xfc594a[_0x4302('0x1a')](0x1f5,_0x4302('0x6e')));}});},'Agents':function(_0x24974b){return new Promise(function(_0x25ce62,_0x5afbcc){var _0x22ec92=_['values'](_0x1d9b55[_0x4302('0xb')]);_0x25ce62({'count':_0x22ec92[_0x4302('0x56')],'rows':_0x22ec92});});},'Telephones':function(_0xc761a1){return new Promise(function(_0x326eec,_0x5d948d){var _0x9d8734=_[_0x4302('0x75')](_0x1d9b55[_0x4302('0x76')]);_0x326eec({'count':_0x9d8734[_0x4302('0x56')],'rows':_0x9d8734});});},'Trunks':function(_0x48927a){return new Promise(function(_0x25f546,_0x23d256){var _0x156a4a=_[_0x4302('0x75')](_0x1d9b55['trunks']);_0x25f546({'count':_0x156a4a[_0x4302('0x56')],'rows':_0x156a4a});});},'OutboundChannels':function(_0x370451){return new Promise(function(_0x4893e2,_0x53ae1a){var _0x266632=_['values'](_0x1d9b55[_0x4302('0x77')]);_0x4893e2({'count':_0x266632[_0x4302('0x56')],'rows':_0x266632});});},'Outbound':function(_0x2813c8){return new Promise(function(_0x46c98,_0x1d391a){_0x46c98(_0x1d9b55[_0x4302('0x2b')]);});},'Campaigns':function(_0x303a2a){return new Promise(function(_0x20baec,_0x2588a){var _0x2e7caf=_[_0x4302('0x75')](_0x1d9b55[_0x4302('0x78')]);_0x20baec({'count':_0x2e7caf[_0x4302('0x56')],'rows':_0x2e7caf});});},'VoiceQueuesPreview':function(_0x45c160){var _0x546c34=this;return new Promise(function(_0x374a7a,_0x172a20){_0x574548[_0x4302('0x79')](_0x45c160['id'])[_0x4302('0x17')](function(_0x5f59d0){_0x374a7a({'code':0xc8,'message':_0x5f59d0['message']});})[_0x4302('0x19')](function(_0x2b7713){_0x172a20(_0x546c34[_0x4302('0x1a')](0x1f4,_0x2b7713['message']));});});},'EventManager':function(_0x5a24c8){var _0x1161d1=this;return new Promise(function(_0x26590e,_0x2e579f){if(!_0x5a24c8[_0x4302('0x7a')]){return _0x2e579f(_0x1161d1[_0x4302('0x1a')](0x1f4,_0x4302('0x7b')));}ami[_0x4302('0x7c')]('custom:'+_0x5a24c8[_0x4302('0x7a')],_0x5a24c8[_0x4302('0x18')]);_0x26590e({'code':0xc8,'message':_0x5a24c8});});},'FaxAccounts':function(_0x163f60){return new Promise(function(_0x80443f,_0x495c26){var _0x2e0938=_[_0x4302('0x75')](_0x1d9b55[_0x4302('0x7d')]);_0x80443f({'count':_0x2e0938[_0x4302('0x56')],'rows':_0x2e0938});});},'SendFax':function(_0x26cfe3){var _0x5cc19c=this;return new Promise(function(_0x192af8,_0x80eb62){_0x13d051[_0x4302('0x7e')](_0x26cfe3)[_0x4302('0x17')](function(_0x398e48){_0x192af8({'code':0xc8,'message':_0x398e48[_0x4302('0x18')]});})['catch'](function(_0x156a58){_0x80eb62(_0x5cc19c[_0x4302('0x1a')](0x1f4,_0x156a58[_0x4302('0x18')]));});});},'CheckAfterSend':function(_0x20bd35){var _0x36b385=this;return new Promise(function(_0x378901,_0x1fe69a){_0x13d051[_0x4302('0x7f')](_0x20bd35)[_0x4302('0x17')](function(_0x431341){_0x378901({'code':0xc8,'message':_0x431341['message']});})['catch'](function(_0x2d9bc4){_0x1fe69a(_0x36b385[_0x4302('0x1a')](0x1f4,_0x2d9bc4[_0x4302('0x18')]));});});}};var _0xebc470=jayson['server'](_0xced9fc)[_0x4302('0x80')]();_0xebc470['on']('error',function(_0x232b2){return _0x4c3983(_0x232b2);});_0xebc470[_0x4302('0x5')](0x232a,_0x4302('0x81'),function(){console[_0x4302('0x82')](_0x4302('0x83'),0x232a);return _0x5f20('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0xf494=['Interval','push','length','find','undefined','values','channels','voicechannel','validate','uniqueid','channel','%s.%s','wav','monitors','isNil','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','toLowerCase','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','filename','StopMixMonitor\x20Success','queueChannels','map','Hangup','Redirect','context','agents','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','send','checkAfterSend','server','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','updateStatusRealtime','pause','isConnected','error','asterisk','username','ami\x20disconnected','join','module','action','Reload','then','message','pick','command','Action','content','catch','voiceQueues','hasOwnProperty','strategy','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk'];(function(_0x36a947,_0x1f0510){var _0x34e818=function(_0x117bca){while(--_0x117bca){_0x36a947['push'](_0x36a947['shift']());}};_0x34e818(++_0x1f0510);}(_0xf494,0x1c6));var _0x4f49=function(_0x594207,_0x385165){_0x594207=_0x594207-0x0;var _0x524c86=_0xf494[_0x594207];return _0x524c86;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var jayson=require(_0x4f49('0x2'));var schema=require('validate');var BPromise=require(_0x4f49('0x3'));var moment=require(_0x4f49('0x4'));var config=require(_0x4f49('0x5'));var properties=require(_0x4f49('0x6'));var ami=require(_0x4f49('0x7'));exports[_0x4f49('0x8')]=function(_0x3267c1,_0x790e8b,_0xc5e778){return new BPromise(function(_0x413530,_0x42b0e8){var _0x5eb186={'QueuePause':function(_0x58e9a0){return new Promise(function(_0x169c95,_0x327bd5){var _0x31a725=util[_0x4f49('0x9')](_0x4f49('0xa'),_0x4f49('0xb'),_0x58e9a0[_0x4f49('0xc')]);if(_0x3267c1[_0x4f49('0xd')]&&_0x3267c1['timers'][_0x31a725]&&_0x3267c1[_0x4f49('0xd')][_0x31a725][_0x4f49('0xe')]){_0x3267c1['timers'][_0x31a725][_0x4f49('0xf')]();}if(_0x3267c1['agents'][_0x31a725]){_0x3267c1['agents'][_0x31a725][_0x4f49('0x10')]({'statePause':_0x58e9a0[_0x4f49('0x11')]?!![]:![]});}_0x169c95({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x1e1c37){var _0x111a8b=this;return new Promise(function(_0x1b9145,_0x2efe49){if(ami[_0x4f49('0x12')]()==![]){return _0x2efe49(_0x111a8b[_0x4f49('0x13')](0x1f4,[config[_0x4f49('0x14')]['ip'],config['asterisk'][_0x4f49('0x15')],_0x4f49('0x16')][_0x4f49('0x17')]('\x20')));}_0x1e1c37=_['pick'](_0x1e1c37,_['keys'](properties[_0x4f49('0x18')]));_0x1e1c37[_0x4f49('0x19')]=_0x4f49('0x1a');return ami['Action'](_0x1e1c37)[_0x4f49('0x1b')](function(_0x399be7){_0x1b9145({'code':0xc8,'message':_0x399be7[_0x4f49('0x1c')]});})['catch'](function(_0x5bb23b){_0x2efe49(_0x111a8b['error'](0x1f5,_0x5bb23b['message']));});});},'Command':function(_0xb2081a){var _0x1834f4=this;return new Promise(function(_0x1c2d70,_0x407042){if(ami['isConnected']()==![]){return _0x407042(_0x1834f4[_0x4f49('0x13')](0x1f4,[config[_0x4f49('0x14')]['ip'],config[_0x4f49('0x14')][_0x4f49('0x15')],_0x4f49('0x16')]['join']('\x20')));}_0xb2081a=_[_0x4f49('0x1d')](_0xb2081a,_0x4f49('0x1e'));_0xb2081a[_0x4f49('0x19')]='Command';return ami[_0x4f49('0x1f')](_0xb2081a)[_0x4f49('0x1b')](function(_0x32ca7b){_0x1c2d70({'code':0xc8,'message':_0x32ca7b[_0x4f49('0x20')]});})[_0x4f49('0x21')](function(_0x36187b){_0x407042(_0x1834f4['error'](0x1f5,_0x36187b['message']));});});},'VoiceQueues':function(_0x3a947b){return new Promise(function(_0x429de7,_0x4fedbb){var _0x408552=[];for(var _0x2c1519 in _0x3267c1[_0x4f49('0x22')]){if(_0x3267c1['voiceQueues'][_0x4f49('0x23')](_0x2c1519)){var _0x2eed1c=_0x3267c1[_0x4f49('0x22')][_0x2c1519];var _0x148153={'id':_0x2eed1c['id'],'name':_0x2eed1c[_0x4f49('0xc')],'strategy':_0x2eed1c[_0x4f49('0x24')],'answered':_0x2eed1c['answered'],'available':_0x2eed1c['available'],'loggedIn':_0x2eed1c[_0x4f49('0x25')],'pTalking':_0x2eed1c[_0x4f49('0x26')],'sumBillable':_0x2eed1c[_0x4f49('0x27')],'sumDuration':_0x2eed1c['sumDuration'],'sumHoldTime':_0x2eed1c[_0x4f49('0x28')]||0x0,'talking':_0x2eed1c[_0x4f49('0x29')],'total':_0x2eed1c[_0x4f49('0x2a')],'type':_0x2eed1c['type'],'unmanaged':_0x2eed1c['unmanaged'],'abandoned':_0x2eed1c[_0x4f49('0x2b')],'waiting':_0x2eed1c[_0x4f49('0x2c')],'loggedInDb':_0x2eed1c[_0x4f49('0x2d')]};if(_0x2eed1c['type']===_0x4f49('0x2e')){_0x148153[_0x4f49('0x2f')]=_0x2eed1c[_0x4f49('0x2f')];_0x148153[_0x4f49('0x30')]=_0x2eed1c[_0x4f49('0x30')];_0x148153[_0x4f49('0x31')]=_0x2eed1c[_0x4f49('0x31')];_0x148153[_0x4f49('0x32')]=_0x2eed1c[_0x4f49('0x32')];_0x148153[_0x4f49('0x33')]=_0x2eed1c[_0x4f49('0x33')];_0x148153[_0x4f49('0x34')]=_0x2eed1c[_0x4f49('0x34')];_0x148153[_0x4f49('0x35')]=_0x2eed1c[_0x4f49('0x35')];_0x148153[_0x4f49('0x36')]=_0x2eed1c[_0x4f49('0x36')];_0x148153[_0x4f49('0x37')]=_0x2eed1c[_0x4f49('0x37')];_0x148153['outboundBlacklistCallsDay']=_0x2eed1c[_0x4f49('0x38')];_0x148153[_0x4f49('0x39')]=_0x2eed1c[_0x4f49('0x39')];_0x148153[_0x4f49('0x3a')]=_0x2eed1c[_0x4f49('0x3a')];_0x148153[_0x4f49('0x3b')]=_0x2eed1c[_0x4f49('0x3b')];_0x148153[_0x4f49('0x3c')]=_0x2eed1c[_0x4f49('0x3c')];_0x148153[_0x4f49('0x3d')]=_0x2eed1c[_0x4f49('0x3d')];_0x148153[_0x4f49('0x3e')]=_0x2eed1c[_0x4f49('0x3e')];_0x148153['outboundNoSuchCallsDay']=_0x2eed1c[_0x4f49('0x3f')];_0x148153[_0x4f49('0x40')]=_0x2eed1c[_0x4f49('0x40')];_0x148153[_0x4f49('0x41')]=_0x2eed1c[_0x4f49('0x41')];_0x148153[_0x4f49('0x42')]=_0x2eed1c[_0x4f49('0x42')];_0x148153[_0x4f49('0x43')]=_0x2eed1c[_0x4f49('0x43')];_0x148153[_0x4f49('0x44')]=_0x2eed1c[_0x4f49('0x44')];_0x148153[_0x4f49('0x45')]=_0x2eed1c[_0x4f49('0x45')];_0x148153[_0x4f49('0x46')]=_0x2eed1c['predictiveIntervalAvgTalktime'];_0x148153[_0x4f49('0x47')]=_0x2eed1c[_0x4f49('0x47')];_0x148153['predictiveIntervalDroppedCallsTimeout']=_0x2eed1c[_0x4f49('0x48')];_0x148153[_0x4f49('0x49')]=_0x2eed1c['predictiveIntervalErlangCalls'];_0x148153[_0x4f49('0x4a')]=_0x2eed1c[_0x4f49('0x4a')];_0x148153[_0x4f49('0x4b')]=_0x2eed1c[_0x4f49('0x4b')];_0x148153[_0x4f49('0x4c')]=_0x2eed1c[_0x4f49('0x4c')];_0x148153[_0x4f49('0x4d')]=_0x2eed1c['predictiveIntervalPauses'];_0x148153['predictiveIntervalAvailable']=_0x2eed1c['predictiveIntervalAvailable'];_0x148153[_0x4f49('0x4e')]=_0x2eed1c[_0x4f49('0x4e')];_0x148153[_0x4f49('0x1c')]=_0x2eed1c[_0x4f49('0x1c')];_0x148153[_0x4f49('0x4f')]=_0x2eed1c[_0x4f49('0x4f')];_0x148153[_0x4f49('0x50')]=_0x2eed1c[_0x4f49('0x50')];_0x148153[_0x4f49('0x51')]=_0x2eed1c['erlangCallToSecond'];_0x148153['erlangAbandonmentRate']=_0x2eed1c[_0x4f49('0x52')];_0x148153[_0x4f49('0x53')]=_0x2eed1c[_0x4f49('0x53')];_0x148153['startPredictive']=_0x2eed1c[_0x4f49('0x54')];_0x148153['startProgressive']=_0x2eed1c['startProgressive'];}if(_0x2eed1c[_0x4f49('0x55')]){_0x148153[_0x4f49('0x55')]={'id':_0x2eed1c[_0x4f49('0x55')]['id'],'name':_0x2eed1c['Trunk'][_0x4f49('0xc')],'active':_0x2eed1c[_0x4f49('0x55')]['active'],'callerid':_0x2eed1c[_0x4f49('0x55')]['callerid']};}if(_0x2eed1c[_0x4f49('0x56')]){_0x148153[_0x4f49('0x56')]={'id':_0x2eed1c[_0x4f49('0x56')]['id'],'name':_0x2eed1c['Interval'][_0x4f49('0xc')]};}_0x408552[_0x4f49('0x57')](_0x148153);}}_0x429de7({'count':_0x408552[_0x4f49('0x58')],'rows':_0x408552});});},'UpdateVoiceQueue':function(_0xc0c9d7){return new Promise(function(_0x29dfdb,_0x1c41e4){var _0xe66867=_[_0x4f49('0x59')](_0x3267c1[_0x4f49('0x22')],{'id':parseInt(_0xc0c9d7['id'])});var _0x157a55=_['omit'](_0xc0c9d7,['id']);if(_0xe66867){for(var _0x26c222 in _0x157a55){if(typeof _0x157a55[_0x26c222]!==_0x4f49('0x5a')&&typeof _0xe66867[_0x26c222]!=='undefined'){_0xe66867[_0x26c222]=_0x157a55[_0x26c222];}}_0x29dfdb(_0xe66867);}else{_0x1c41e4();}});},'VoiceChannels':function(_0x1b4a8e){return new Promise(function(_0x51ebed,_0x132c46){var _0x41c580=_[_0x4f49('0x5b')](_0x3267c1[_0x4f49('0x5c')]);_0x51ebed({'count':_0x41c580['length'],'rows':_0x41c580});});},'VoiceChannelMixMonitor':function(_0x2913cf){var _0x2c426b=this;return new Promise(function(_0x37bafa,_0x973099){if(ami[_0x4f49('0x12')]()==![]){return _0x973099(_0x2c426b[_0x4f49('0x13')](0x1f4,[config[_0x4f49('0x14')]['ip'],config[_0x4f49('0x14')][_0x4f49('0x15')],_0x4f49('0x16')][_0x4f49('0x17')]('\x20')));}var _0x4482f7=schema(properties[_0x4f49('0x5d')])[_0x4f49('0x5e')](_0x2913cf);if(_0x4482f7[_0x4f49('0x58')]>0x0){return _0x973099(_0x2c426b[_0x4f49('0x13')](0x1f4,_['map'](_0x4482f7,'message')[_0x4f49('0x17')](',\x20')));}var _0x197670=_[_0x4f49('0x59')](_0x3267c1[_0x4f49('0x5c')],{'uniqueid':_0x2913cf[_0x4f49('0x5f')]});if(_0x197670&&_0x197670[_0x4f49('0x60')]){var _0x2c5599=util['format'](_0x4f49('0x61'),_0x2913cf['filename']||_0x2913cf[_0x4f49('0x5f')],_0x2913cf[_0x4f49('0x9')]||_0x4f49('0x62'));return ami[_0x4f49('0x1f')]({'action':'MixMonitor','channel':_0x197670[_0x4f49('0x60')],'file':_0x2c5599,'options':'ai(mixmonitorid)'})['then'](function(_0x2ca93f){var _0x2b795a=_[_0x4f49('0x59')](_0x197670[_0x4f49('0x63')],{'filename':'/var/spool/asterisk/monitor/'+_0x2c5599['toLowerCase']()});if(_[_0x4f49('0x64')](_0x2b795a)){_0x197670[_0x4f49('0x63')]['push']({'filename':_0x4f49('0x65')+_0x2c5599['toLowerCase'](),'createdAt':moment()['format'](_0x4f49('0x66')),'mixmonitorid':_0x2ca93f['mixmonitorid'],'status':_0x4f49('0x67')});}else{_0x2b795a['mixmonitorid']=_0x2ca93f[_0x4f49('0x68')];_0x2b795a[_0x4f49('0x69')]=_0x4f49('0x67');}_0x37bafa({'code':0xc8,'message':[_0x2913cf[_0x4f49('0x5f')],_0x4f49('0x6a'),_0x2ca93f[_0x4f49('0x68')]][_0x4f49('0x17')]('\x20'),'mixmonitorid':_0x2ca93f[_0x4f49('0x68')]});})['catch'](function(_0x16faaf){_0x973099(_0x2c426b['error'](0x1f5,[_0x2913cf[_0x4f49('0x5f')],_0x16faaf[_0x4f49('0x1c')][_0x4f49('0x6b')]()][_0x4f49('0x17')]('\x20')));});}else{return _0x973099(_0x2c426b[_0x4f49('0x13')](0x1f5,_0x4f49('0x6c')));}});},'VoiceChannelStopMixMonitor':function(_0x553981){var _0x426c50=this;return new Promise(function(_0xd3689c,_0x5e3568){if(ami['isConnected']()==![]){return _0x5e3568(_0x426c50[_0x4f49('0x13')](0x1f4,[config[_0x4f49('0x14')]['ip'],config[_0x4f49('0x14')][_0x4f49('0x15')],_0x4f49('0x16')]['join']('\x20')));}var _0x321306=schema(properties['voicechannel'])[_0x4f49('0x5e')](_0x553981);if(_0x321306[_0x4f49('0x58')]>0x0){return _0x5e3568(_0x426c50[_0x4f49('0x13')](0x1f4,_['map'](_0x321306,_0x4f49('0x1c'))[_0x4f49('0x17')](',\x20')));}var _0x265988=_[_0x4f49('0x59')](_0x3267c1['channels'],{'uniqueid':_0x553981[_0x4f49('0x5f')]});if(_0x265988){return BPromise[_0x4f49('0x6d')]()['then'](function(){if(_0x265988[_0x4f49('0x60')]){return ami[_0x4f49('0x1f')]({'action':_0x4f49('0x6e'),'channel':_0x265988[_0x4f49('0x60')],'mixmonitorid':_0x553981[_0x4f49('0x68')]})[_0x4f49('0x21')](function(_0x45ef98){});}})[_0x4f49('0x1b')](function(){if(_0x265988['destinationchannel']){return ami[_0x4f49('0x1f')]({'action':_0x4f49('0x6e'),'channel':_0x265988[_0x4f49('0x6f')],'mixmonitorid':_0x553981[_0x4f49('0x68')]})[_0x4f49('0x21')](function(_0x26b022){});}})[_0x4f49('0x1b')](function(_0x5426d6){var _0x2b740a=_['find'](_0x265988[_0x4f49('0x63')],{'mixmonitorid':_0x553981[_0x4f49('0x68')]});if(_0x2b740a){_0x2b740a[_0x4f49('0x69')]=_0x4f49('0x70');}})[_0x4f49('0x1b')](function(){var _0x3f2f3f=util[_0x4f49('0x9')](_0x4f49('0x61'),_0x553981[_0x4f49('0x71')]||_0x553981[_0x4f49('0x5f')],_0x553981['format']||_0x4f49('0x62'));var _0x141554=_[_0x4f49('0x59')](_0x265988[_0x4f49('0x63')],{'filename':'/var/spool/asterisk/monitor/'+_0x3f2f3f['toLowerCase']()});if(_0x141554){_0x141554[_0x4f49('0x69')]='stop';}})[_0x4f49('0x1b')](function(){_0xd3689c({'code':0xc8,'message':[_0x553981[_0x4f49('0x5f')],_0x4f49('0x72')][_0x4f49('0x17')]('\x20')});})[_0x4f49('0x21')](function(_0x1fb02e){_0x5e3568(_0x426c50[_0x4f49('0x13')](0x1f5,[_0x553981[_0x4f49('0x5f')],_0x1fb02e[_0x4f49('0x1c')][_0x4f49('0x6b')]()][_0x4f49('0x17')]('\x20')));});}else{return _0x5e3568(_0x426c50[_0x4f49('0x13')](0x1f5,_0x4f49('0x6c')));}});},'VoiceQueuesChannels':function(_0xd53de8){return new Promise(function(_0x234984,_0x412d84){var _0x30afed=_[_0x4f49('0x5b')](_0x3267c1[_0x4f49('0x73')]);_0x234984({'count':_0x30afed[_0x4f49('0x58')],'rows':_0x30afed});});},'VoiceQueuesChannel':function(_0x2c3962){var _0x3e9389=this;return new Promise(function(_0xf6d04b,_0x4683f8){var _0x2d0990=schema(properties['voicequeuechannel'])[_0x4f49('0x5e')](_0x2c3962);if(_0x2d0990['length']>0x0){return _0x4683f8(_0x3e9389[_0x4f49('0x13')](0x1f4,_[_0x4f49('0x74')](_0x2d0990,_0x4f49('0x1c'))[_0x4f49('0x17')](',\x20')));}var _0x26de18=_[_0x4f49('0x59')](_0x3267c1[_0x4f49('0x73')],{'uniqueid':_0x2c3962[_0x4f49('0x5f')]});if(_0x26de18){_0xf6d04b(_0x26de18);}else{return _0x4683f8(_0x3e9389[_0x4f49('0x13')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x4b6ef4){var _0x539e21=this;return new Promise(function(_0x592c3c,_0x29b009){if(ami[_0x4f49('0x12')]()==![]){return _0x29b009(_0x539e21[_0x4f49('0x13')](0x1f4,[config[_0x4f49('0x14')]['ip'],config[_0x4f49('0x14')]['username'],'ami\x20disconnected'][_0x4f49('0x17')]('\x20')));}var _0x9931b3=schema(properties['voicequeuechannelhangup'])[_0x4f49('0x5e')](_0x4b6ef4);if(_0x9931b3[_0x4f49('0x58')]>0x0){return _0x29b009(_0x539e21['error'](0x1f4,_[_0x4f49('0x74')](_0x9931b3,'message')[_0x4f49('0x17')](',\x20')));}var _0x160cf8=_['find'](_0x3267c1[_0x4f49('0x73')],{'uniqueid':_0x4b6ef4[_0x4f49('0x5f')]});if(_0x160cf8&&_0x160cf8[_0x4f49('0x60')]){return ami[_0x4f49('0x1f')]({'action':_0x4f49('0x75'),'channel':_0x160cf8[_0x4f49('0x60')]})['then'](function(_0x25ed14){_0x592c3c({'code':0xc8,'message':[_0x4b6ef4['uniqueid'],_0x25ed14[_0x4f49('0x1c')]['toLowerCase']()][_0x4f49('0x17')]('\x20')});})['catch'](function(_0x29e639){_0x29b009(_0x539e21[_0x4f49('0x13')](0x1f5,[_0x4b6ef4[_0x4f49('0x5f')],_0x29e639[_0x4f49('0x1c')]['toLowerCase']()][_0x4f49('0x17')]('\x20')));});}else{return _0x29b009(_0x539e21['error'](0x1f5,_0x4f49('0x6c')));}});},'VoiceQueuesChannelRedirect':function(_0x534d88){var _0x44da44=this;return new Promise(function(_0x4f2e07,_0x4938a6){if(ami[_0x4f49('0x12')]()==![]){return _0x4938a6(_0x44da44[_0x4f49('0x13')](0x1f4,[config[_0x4f49('0x14')]['ip'],config['asterisk'][_0x4f49('0x15')],_0x4f49('0x16')]['join']('\x20')));}var _0x5d52ae=schema(properties['voicequeuechannelredirect'])[_0x4f49('0x5e')](_0x534d88);if(_0x5d52ae[_0x4f49('0x58')]>0x0){return _0x4938a6(_0x44da44[_0x4f49('0x13')](0x1f4,_[_0x4f49('0x74')](_0x5d52ae,_0x4f49('0x1c'))['join'](',\x20')));}var _0x15b7e4=_[_0x4f49('0x59')](_0x3267c1[_0x4f49('0x73')],{'uniqueid':_0x534d88['uniqueid']});if(_0x15b7e4&&_0x15b7e4[_0x4f49('0x60')]){return ami[_0x4f49('0x1f')]({'action':_0x4f49('0x76'),'channel':_0x15b7e4[_0x4f49('0x60')],'exten':_0x534d88['exten'],'context':_0x534d88[_0x4f49('0x77')]||_0x15b7e4[_0x4f49('0x77')],'priority':0x1})[_0x4f49('0x1b')](function(_0x387577){_0x4f2e07({'code':0xc8,'message':[_0x534d88[_0x4f49('0x5f')],_0x387577['message'][_0x4f49('0x6b')]()][_0x4f49('0x17')]('\x20')});})['catch'](function(_0x3eebc0){_0x4938a6(_0x44da44['error'](0x1f5,[_0x534d88[_0x4f49('0x5f')],_0x3eebc0['message'][_0x4f49('0x6b')]()][_0x4f49('0x17')]('\x20')));});}else{return _0x4938a6(_0x44da44[_0x4f49('0x13')](0x1f5,_0x4f49('0x6c')));}});},'Agents':function(_0x380d74){return new Promise(function(_0x538943,_0x1f8abd){var _0x1f3556=_[_0x4f49('0x5b')](_0x3267c1[_0x4f49('0x78')]);_0x538943({'count':_0x1f3556['length'],'rows':_0x1f3556});});},'Telephones':function(_0xf37d6a){return new Promise(function(_0x499643,_0x39d8d3){var _0x59a5e9=_[_0x4f49('0x5b')](_0x3267c1[_0x4f49('0x79')]);_0x499643({'count':_0x59a5e9[_0x4f49('0x58')],'rows':_0x59a5e9});});},'Trunks':function(_0x34fca3){return new Promise(function(_0x111e90,_0xd253ed){var _0x323a3a=_[_0x4f49('0x5b')](_0x3267c1[_0x4f49('0x7a')]);_0x111e90({'count':_0x323a3a[_0x4f49('0x58')],'rows':_0x323a3a});});},'OutboundChannels':function(_0x5e6c35){return new Promise(function(_0x33098a,_0x63abf7){var _0x339fd3=_[_0x4f49('0x5b')](_0x3267c1[_0x4f49('0x7b')]);_0x33098a({'count':_0x339fd3[_0x4f49('0x58')],'rows':_0x339fd3});});},'Outbound':function(_0x55b28b){return new Promise(function(_0x2ec42b,_0x20a0d4){_0x2ec42b(_0x3267c1[_0x4f49('0x2e')]);});},'Campaigns':function(_0x3aef02){return new Promise(function(_0x5f02fa,_0x3cf689){var _0x57567a=_[_0x4f49('0x5b')](_0x3267c1[_0x4f49('0x7c')]);_0x5f02fa({'count':_0x57567a[_0x4f49('0x58')],'rows':_0x57567a});});},'VoiceQueuesPreview':function(_0xa880a2){var _0x4cfb48=this;return new Promise(function(_0x1a4528,_0x26ad18){_0x790e8b[_0x4f49('0x7d')](_0xa880a2['id'])[_0x4f49('0x1b')](function(_0x19231b){_0x1a4528({'code':0xc8,'message':_0x19231b[_0x4f49('0x1c')]});})[_0x4f49('0x21')](function(_0x2c194e){_0x26ad18(_0x4cfb48[_0x4f49('0x13')](0x1f4,_0x2c194e[_0x4f49('0x1c')]));});});},'EventManager':function(_0x6054e0){var _0x85b481=this;return new Promise(function(_0x37a79f,_0x3a6b2f){if(!_0x6054e0[_0x4f49('0x7e')]){return _0x3a6b2f(_0x85b481[_0x4f49('0x13')](0x1f4,_0x4f49('0x7f')));}ami[_0x4f49('0x80')]('custom:'+_0x6054e0[_0x4f49('0x7e')],_0x6054e0[_0x4f49('0x1c')]);_0x37a79f({'code':0xc8,'message':_0x6054e0});});},'FaxAccounts':function(_0x262fcb){return new Promise(function(_0x12c8c8,_0x4bba02){var _0x225e63=_[_0x4f49('0x5b')](_0x3267c1['faxAccounts']);_0x12c8c8({'count':_0x225e63[_0x4f49('0x58')],'rows':_0x225e63});});},'SendFax':function(_0x57c86c){var _0xf6bc4c=this;return new Promise(function(_0x3bc245,_0x1b6e82){_0xc5e778[_0x4f49('0x81')](_0x57c86c)[_0x4f49('0x1b')](function(_0x46db9c){_0x3bc245({'code':0xc8,'message':_0x46db9c[_0x4f49('0x1c')]});})[_0x4f49('0x21')](function(_0x26cafd){_0x1b6e82(_0xf6bc4c[_0x4f49('0x13')](0x1f4,_0x26cafd['message']));});});},'CheckAfterSend':function(_0x4b4dec){var _0x32b4b4=this;return new Promise(function(_0x4b3964,_0x3ff131){_0xc5e778[_0x4f49('0x82')](_0x4b4dec)['then'](function(_0x49dc5d){_0x4b3964({'code':0xc8,'message':_0x49dc5d[_0x4f49('0x1c')]});})['catch'](function(_0x445c8f){_0x3ff131(_0x32b4b4[_0x4f49('0x13')](0x1f4,_0x445c8f[_0x4f49('0x1c')]));});});}};var _0x502cd9=jayson[_0x4f49('0x83')](_0x5eb186)['http']();_0x502cd9['on'](_0x4f49('0x13'),function(_0x392f27){return _0x42b0e8(_0x392f27);});_0x502cd9[_0x4f49('0x8')](0x232a,'127.0.0.1',function(){console[_0x4f49('0x84')](_0x4f49('0x85'),0x232a);return _0x413530(_0x4f49('0x86')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 5331bbc..2a710b1 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 _0x3e74=['scheduledAt','updatedAt','union','resolve','getContacts','then','isEmpty','length','uniqueid','data4','[CM][%s][%s]\x20Autocreate\x20enabled','routeId','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','merge','lodash','ioredis','util','../../../../config/environment','../../rpc/cmContact','defaults','redis','localhost','socket.io-emitter','info','stringify','data1','data2','isNil','data5','ListId','data3','$or','map','destcalleridnum','calleridnum','firstName','lastName','phone','mobile','fax','createdAt'];(function(_0x228dfc,_0x31e407){var _0xa29fc7=function(_0x3e64c5){while(--_0x3e64c5){_0x228dfc['push'](_0x228dfc['shift']());}};_0xa29fc7(++_0x31e407);}(_0x3e74,0x175));var _0x43e7=function(_0x3e0536,_0x5046f0){_0x3e0536=_0x3e0536-0x0;var _0x3feb51=_0x3e74[_0x3e0536];return _0x3feb51;};'use strict';var _=require(_0x43e7('0x0'));var BPromise=require('bluebird');var Redis=require(_0x43e7('0x1'));var util=require(_0x43e7('0x2'));var config=require(_0x43e7('0x3'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0x43e7('0x4'));config['redis']=_[_0x43e7('0x5')](config[_0x43e7('0x6')],{'host':_0x43e7('0x7'),'port':0x18eb});var io=require(_0x43e7('0x8'))(new Redis(config[_0x43e7('0x6')]));function emit(_0x503698,_0x45a0d1,_0x3491d6,_0x2ede2d,_0x8528fc){logger[_0x43e7('0x9')]('[CM][%s][%s]',_0x503698,_0x45a0d1['id'],_0x3491d6,_0x2ede2d,JSON[_0x43e7('0xa')](_0x8528fc));io['to'](_0x3491d6)['emit'](_0x2ede2d,_0x8528fc);}exports['exec']=function(_0x39c8bd,_0x4139c9,_0x5c34f4,_0x2803d9){var _0x513707,_0xf7c520;var _0x37302c={};var _0x4ebc8e=Number(_0x5c34f4[_0x43e7('0xb')]);var _0xc960ea=_0x5c34f4[_0x43e7('0xc')]?Boolean(Number(_0x5c34f4[_0x43e7('0xc')])):![];var _0x4e008c;var _0x583d85=![];if(!_[_0x43e7('0xd')](_0x5c34f4[_0x43e7('0xe')])){if(_0x5c34f4[_0x43e7('0xe')]=='1')_0x583d85=!![];}if(!_0x583d85){if(_0x2803d9['xmd-contactid']){_0x37302c['id']=_0x2803d9['xmd-contactid'];}}if(!_0x37302c['id']){_0x37302c[_0x43e7('0xf')]=_0x4ebc8e;_0x4e008c=_0x5c34f4[_0x43e7('0x10')]&&_0x5c34f4[_0x43e7('0x10')]!=='0'?_0x5c34f4[_0x43e7('0x10')]['split'](','):['phone'];_0x37302c[_0x43e7('0x11')]=_[_0x43e7('0x12')](_0x4e008c,function(_0x273a32){var _0x5d346f={};_0x5d346f[_0x273a32]=_0x2803d9['routeId']?_0x2803d9[_0x43e7('0x13')]:_0x2803d9[_0x43e7('0x14')];return _0x5d346f;});}var _0x9037d3=['id',_0x43e7('0x15'),_0x43e7('0x16'),_0x43e7('0x17'),_0x43e7('0x18'),_0x43e7('0x19'),_0x43e7('0xf'),_0x43e7('0x1a'),_0x43e7('0x1b'),_0x43e7('0x1c')];var _0x4b5d64=_[_0x43e7('0x1d')](_0x9037d3,_0x4e008c);BPromise[_0x43e7('0x1e')]()['then'](cmContactRpc[_0x43e7('0x1f')]({'attributes':_0x4b5d64,'where':_0x37302c}))[_0x43e7('0x20')](function(_0x3945bb){_0xf7c520=_0x3945bb;if(!_[_0x43e7('0x21')](_0xf7c520)){if(_0xf7c520[_0x43e7('0x22')]===0x1){_0x513707=_0xf7c520[0x0];logger[_0x43e7('0x9')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x2803d9[_0x43e7('0x23')],_0x4139c9['id'],_0x513707['id']);}else{logger['info']('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x2803d9[_0x43e7('0x23')],_0x4139c9['id'],_[_0x43e7('0x12')](_0xf7c520,'id')['join'](','));}return;}else{logger[_0x43e7('0x9')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x2803d9[_0x43e7('0x23')],_0x4139c9['id']);var _0x5c5e67={'ListId':_0x4ebc8e};var _0x1af208=_0x5c34f4[_0x43e7('0x24')]&&_0x5c34f4[_0x43e7('0x24')]!=='0'?_0x5c34f4[_0x43e7('0x24')]:'phone';if(_0xc960ea){logger['info'](_0x43e7('0x25'),_0x2803d9['uniqueid'],_0x4139c9['id']);_0x5c5e67[_0x1af208]=_[_0x43e7('0xd')](_0x2803d9[_0x43e7('0x26')])?_0x2803d9[_0x43e7('0x14')]:_0x2803d9[_0x43e7('0x13')];if(_['isNil'](_0x2803d9[_0x43e7('0x26')])){_0x5c5e67[_0x43e7('0x15')]=_0x2803d9[_0x43e7('0x27')]&&_0x2803d9[_0x43e7('0x27')]!==_0x43e7('0x28')?_0x2803d9[_0x43e7('0x27')]:_0x43e7('0x29');}else{_0x5c5e67[_0x43e7('0x15')]=_0x2803d9[_0x43e7('0x2a')]&&_0x2803d9[_0x43e7('0x2a')]!==_0x43e7('0x28')?_0x2803d9[_0x43e7('0x2a')]:_0x43e7('0x29');}return BPromise[_0x43e7('0x1e')]()['then'](cmContactRpc[_0x43e7('0x2b')](_0x5c5e67))[_0x43e7('0x20')](function(_0x3b8f78){_0x513707=_0x3b8f78;_0xf7c520[_0x43e7('0x2c')](_0x3b8f78);if(_0x513707){logger[_0x43e7('0x9')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x2803d9[_0x43e7('0x23')],_0x4139c9['id'],_0x513707['id']);}return;});}else{logger[_0x43e7('0x9')](_0x43e7('0x2d'),_0x2803d9[_0x43e7('0x23')],_0x4139c9['id']);_0x5c5e67[_0x1af208]=_['isNil'](_0x2803d9['routeId'])?_0x2803d9['calleridnum']:_0x2803d9[_0x43e7('0x13')];if(_[_0x43e7('0xd')](_0x2803d9[_0x43e7('0x26')])){_0x5c5e67[_0x43e7('0x15')]=_0x2803d9[_0x43e7('0x27')]&&_0x2803d9[_0x43e7('0x27')]!==''?_0x2803d9['calleridname']:'Unknown';}else{_0x5c5e67['firstName']=_0x2803d9['destcalleridname']&&_0x2803d9['destcalleridname']!==''?_0x2803d9[_0x43e7('0x2a')]:'Unknown';}_0x513707=_0x5c5e67;_0xf7c520[_0x43e7('0x2c')](_0x5c5e67);return;}}})[_0x43e7('0x20')](function(){if(_0x39c8bd){emit(_0x2803d9[_0x43e7('0x23')],_0x4139c9,util[_0x43e7('0x2e')](_0x43e7('0x2f'),_0x39c8bd[_0x43e7('0x30')]),util[_0x43e7('0x2e')]('trigger:%s',_0x5c34f4['action']['toLowerCase']()),{'evt':_[_0x43e7('0x31')](_0x2803d9,{'autoCreate':_0xc960ea}),'contact':_0x513707===undefined?{}:_0x513707,'contacts':_0xf7c520[_0x43e7('0x22')]===0x0?undefined:_0xf7c520});}});}; \ No newline at end of file +var _0xed1f=['trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data1','data2','isNil','data5','ListId','data3','phone','map','routeId','destcalleridnum','lastName','mobile','fax','createdAt','scheduledAt','union','resolve','then','isEmpty','length','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','firstName','calleridname','Unknown','destcalleridname','','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger'];(function(_0x40003a,_0xa00a10){var _0x30efda=function(_0x4163ed){while(--_0x4163ed){_0x40003a['push'](_0x40003a['shift']());}};_0x30efda(++_0xa00a10);}(_0xed1f,0x6a));var _0xfed1=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xed1f[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0xfed1('0x0'));var BPromise=require(_0xfed1('0x1'));var Redis=require(_0xfed1('0x2'));var util=require(_0xfed1('0x3'));var config=require(_0xfed1('0x4'));var logger=require(_0xfed1('0x5'))(_0xfed1('0x6'));var cmContactRpc=require(_0xfed1('0x7'));config[_0xfed1('0x8')]=_[_0xfed1('0x9')](config[_0xfed1('0x8')],{'host':_0xfed1('0xa'),'port':0x18eb});var io=require(_0xfed1('0xb'))(new Redis(config[_0xfed1('0x8')]));function emit(_0x380e18,_0x612b38,_0x2a6082,_0x2967ef,_0x568d48){logger[_0xfed1('0xc')](_0xfed1('0xd'),_0x380e18,_0x612b38['id'],_0x2a6082,_0x2967ef,JSON['stringify'](_0x568d48));io['to'](_0x2a6082)[_0xfed1('0xe')](_0x2967ef,_0x568d48);}exports[_0xfed1('0xf')]=function(_0x4a564e,_0x3ce017,_0x48c338,_0x1c3f40){var _0x234f4e,_0x4a8369;var _0x5c0b5f={};var _0x3d1891=Number(_0x48c338[_0xfed1('0x10')]);var _0x569a6e=_0x48c338[_0xfed1('0x11')]?Boolean(Number(_0x48c338['data2'])):![];var _0x529b3d;var _0x3f6555=![];if(!_[_0xfed1('0x12')](_0x48c338['data5'])){if(_0x48c338[_0xfed1('0x13')]=='1')_0x3f6555=!![];}if(!_0x3f6555){if(_0x1c3f40['xmd-contactid']){_0x5c0b5f['id']=_0x1c3f40['xmd-contactid'];}}if(!_0x5c0b5f['id']){_0x5c0b5f[_0xfed1('0x14')]=_0x3d1891;_0x529b3d=_0x48c338[_0xfed1('0x15')]&&_0x48c338[_0xfed1('0x15')]!=='0'?_0x48c338[_0xfed1('0x15')]['split'](','):[_0xfed1('0x16')];_0x5c0b5f['$or']=_[_0xfed1('0x17')](_0x529b3d,function(_0x29a32f){var _0x489a0f={};_0x489a0f[_0x29a32f]=_0x1c3f40[_0xfed1('0x18')]?_0x1c3f40[_0xfed1('0x19')]:_0x1c3f40['calleridnum'];return _0x489a0f;});}var _0x59509b=['id','firstName',_0xfed1('0x1a'),'phone',_0xfed1('0x1b'),_0xfed1('0x1c'),'ListId',_0xfed1('0x1d'),_0xfed1('0x1e'),'updatedAt'];var _0x3ce944=_[_0xfed1('0x1f')](_0x59509b,_0x529b3d);BPromise[_0xfed1('0x20')]()[_0xfed1('0x21')](cmContactRpc['getContacts']({'attributes':_0x3ce944,'where':_0x5c0b5f}))[_0xfed1('0x21')](function(_0x59333e){_0x4a8369=_0x59333e;if(!_[_0xfed1('0x22')](_0x4a8369)){if(_0x4a8369[_0xfed1('0x23')]===0x1){_0x234f4e=_0x4a8369[0x0];logger[_0xfed1('0xc')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x1c3f40[_0xfed1('0x24')],_0x3ce017['id'],_0x234f4e['id']);}else{logger['info'](_0xfed1('0x25'),_0x1c3f40[_0xfed1('0x24')],_0x3ce017['id'],_[_0xfed1('0x17')](_0x4a8369,'id')[_0xfed1('0x26')](','));}return;}else{logger[_0xfed1('0xc')](_0xfed1('0x27'),_0x1c3f40['uniqueid'],_0x3ce017['id']);var _0x465ce6={'ListId':_0x3d1891};var _0xcb1cdc=_0x48c338['data4']&&_0x48c338[_0xfed1('0x28')]!=='0'?_0x48c338[_0xfed1('0x28')]:_0xfed1('0x16');if(_0x569a6e){logger[_0xfed1('0xc')](_0xfed1('0x29'),_0x1c3f40[_0xfed1('0x24')],_0x3ce017['id']);_0x465ce6[_0xcb1cdc]=_['isNil'](_0x1c3f40[_0xfed1('0x18')])?_0x1c3f40['calleridnum']:_0x1c3f40[_0xfed1('0x19')];if(_['isNil'](_0x1c3f40['routeId'])){_0x465ce6[_0xfed1('0x2a')]=_0x1c3f40[_0xfed1('0x2b')]&&_0x1c3f40[_0xfed1('0x2b')]!==''?_0x1c3f40[_0xfed1('0x2b')]:_0xfed1('0x2c');}else{_0x465ce6[_0xfed1('0x2a')]=_0x1c3f40[_0xfed1('0x2d')]&&_0x1c3f40[_0xfed1('0x2d')]!==_0xfed1('0x2e')?_0x1c3f40['destcalleridname']:_0xfed1('0x2c');}return BPromise[_0xfed1('0x20')]()['then'](cmContactRpc['createContact'](_0x465ce6))[_0xfed1('0x21')](function(_0x2d10f5){_0x234f4e=_0x2d10f5;_0x4a8369[_0xfed1('0x2f')](_0x2d10f5);if(_0x234f4e){logger[_0xfed1('0xc')](_0xfed1('0x30'),_0x1c3f40['uniqueid'],_0x3ce017['id'],_0x234f4e['id']);}return;});}else{logger[_0xfed1('0xc')](_0xfed1('0x31'),_0x1c3f40[_0xfed1('0x24')],_0x3ce017['id']);_0x465ce6[_0xcb1cdc]=_[_0xfed1('0x12')](_0x1c3f40[_0xfed1('0x18')])?_0x1c3f40['calleridnum']:_0x1c3f40[_0xfed1('0x19')];if(_['isNil'](_0x1c3f40[_0xfed1('0x18')])){_0x465ce6[_0xfed1('0x2a')]=_0x1c3f40[_0xfed1('0x2b')]&&_0x1c3f40[_0xfed1('0x2b')]!==_0xfed1('0x2e')?_0x1c3f40[_0xfed1('0x2b')]:_0xfed1('0x2c');}else{_0x465ce6[_0xfed1('0x2a')]=_0x1c3f40['destcalleridname']&&_0x1c3f40[_0xfed1('0x2d')]!==_0xfed1('0x2e')?_0x1c3f40[_0xfed1('0x2d')]:_0xfed1('0x2c');}_0x234f4e=_0x465ce6;_0x4a8369['push'](_0x465ce6);return;}}})['then'](function(){if(_0x4a564e){emit(_0x1c3f40[_0xfed1('0x24')],_0x3ce017,util[_0xfed1('0x32')](_0xfed1('0x33'),_0x4a564e[_0xfed1('0x34')]),util[_0xfed1('0x32')](_0xfed1('0x35'),_0x48c338[_0xfed1('0x36')][_0xfed1('0x37')]()),{'evt':_['merge'](_0x1c3f40,{'autoCreate':_0x569a6e}),'contact':_0x234f4e===undefined?{}:_0x234f4e,'contacts':_0x4a8369['length']===0x0?undefined:_0x4a8369});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 7353298..d5a48b5 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 _0xb10f=['syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','stringify','motionChannel','undefined','checkTriggers','interface','triggers','hasOwnProperty','status','checkTrigger','merge','length','action','contactmanager','data1','popup','TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','windowWidth','800','data5','data6','600','winApplication','format','user:%s','name','trigger:%s:%s','toLowerCase','jscripty','trigger:%s','exec','integration','queue','routeId','urlforward','script','query','search','channel','AllConditions','every','checkConditions','AnyConditions','account','chat','operator','ChatWebsiteId','upperFirst','AccountId','value','interaction','event','membername','lastevent','mailSubstatus','null','substatus','exports','util','lodash','mustache','ioredis','./urlforward','./cmContact','./script','../../../config/logger','trigger','redis','defaults','localhost','socket.io-emitter','url','winapp','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','freshdeskAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd'];(function(_0x54b833,_0x394ccc){var _0x4c1472=function(_0x3e553c){while(--_0x3e553c){_0x54b833['push'](_0x54b833['shift']());}};_0x4c1472(++_0x394ccc);}(_0xb10f,0x1ba));var _0xfb10=function(_0x5e7c87,_0x422d37){_0x5e7c87=_0x5e7c87-0x0;var _0x5000af=_0xb10f[_0x5e7c87];return _0x5000af;};'use strict';var util=require(_0xfb10('0x0'));var _=require(_0xfb10('0x1'));var url=require('url');var Mustache=require(_0xfb10('0x2'));var Redis=require(_0xfb10('0x3'));var urlforward=require(_0xfb10('0x4'));var integration=require('./integration');var cmContact=require(_0xfb10('0x5'));var script=require(_0xfb10('0x6'));var config=require('../../../config/environment');var logger=require(_0xfb10('0x7'))(_0xfb10('0x8'));var ami=require('../ami');config[_0xfb10('0x9')]=_[_0xfb10('0xa')](config[_0xfb10('0x9')],{'host':_0xfb10('0xb'),'port':0x18eb});var io=require(_0xfb10('0xc'))(new Redis(config[_0xfb10('0x9')]));var operators={'equals':function(_0x3a0926,_0x549208){return _0x3a0926==_0x549208;},'not_equals':function(_0x4c0f22,_0x41bc28){return _0x4c0f22!=_0x41bc28;}};var barAndWebActions=['popup',_0xfb10('0xd'),_0xfb10('0xe')];function Trigger(_0x35b9b7){this['triggers']=_0x35b9b7['triggers'];this[_0xfb10('0xf')]=_0x35b9b7[_0xfb10('0xf')];this[_0xfb10('0x10')]=_0x35b9b7[_0xfb10('0x10')];this[_0xfb10('0x11')]=_0x35b9b7[_0xfb10('0x11')];this[_0xfb10('0x12')]=_0x35b9b7[_0xfb10('0x12')];this[_0xfb10('0x13')]=_0x35b9b7[_0xfb10('0x13')];this['freshdeskAccounts']=_0x35b9b7['freshdeskAccounts'];this[_0xfb10('0x14')]=_0x35b9b7[_0xfb10('0x14')];this[_0xfb10('0x15')]=_0x35b9b7[_0xfb10('0x15')];this[_0xfb10('0x16')]=_0x35b9b7[_0xfb10('0x16')];this[_0xfb10('0x17')]=_0x35b9b7[_0xfb10('0x17')];this[_0xfb10('0x18')]=_0x35b9b7[_0xfb10('0x18')];this[_0xfb10('0x19')]=_0x35b9b7[_0xfb10('0x19')];this[_0xfb10('0x1a')]=_0x35b9b7[_0xfb10('0x1a')];this[_0xfb10('0x1b')]=_0x35b9b7[_0xfb10('0x1b')];this[_0xfb10('0x1c')]={'zendesk':this[_0xfb10('0x13')],'salesforce':this[_0xfb10('0x14')],'freshdesk':this[_0xfb10('0x1d')],'sugarcrm':this[_0xfb10('0x15')],'zoho':this[_0xfb10('0x16')],'desk':this['deskAccounts'],'vtiger':this[_0xfb10('0x18')],'dynamics365':this[_0xfb10('0x1a')],'freshsales':this['freshsalesAccounts'],'servicenow':this['servicenowAccounts']};ami['on'](_0xfb10('0x1e'),this[_0xfb10('0x1f')][_0xfb10('0x20')](this));ami['on'](_0xfb10('0x21'),this[_0xfb10('0x1f')][_0xfb10('0x20')](this));ami['on'](_0xfb10('0x22'),this['syncCustomEvent'][_0xfb10('0x20')](this));ami['on'](_0xfb10('0x23'),this[_0xfb10('0x1f')]['bind'](this));ami['on'](_0xfb10('0x24'),this[_0xfb10('0x1f')]['bind'](this));ami['on'](_0xfb10('0x25'),this[_0xfb10('0x1f')]['bind'](this));ami['on'](_0xfb10('0x26'),this['syncCustomEvent'][_0xfb10('0x20')](this));ami['on'](_0xfb10('0x27'),this['syncCustomEvent']['bind'](this));ami['on'](_0xfb10('0x28'),this['syncCustomEvent']['bind'](this));ami['on'](_0xfb10('0x29'),this['syncCustomEvent']['bind'](this));ami['on']('custom:queuecallerabandon',this[_0xfb10('0x1f')]['bind'](this));ami['on']('custom:timeout',this[_0xfb10('0x1f')][_0xfb10('0x20')](this));ami['on']('custom:dialbegin',this[_0xfb10('0x2a')][_0xfb10('0x20')](this));ami['on'](_0xfb10('0x2b'),this[_0xfb10('0x2a')]['bind'](this));ami['on'](_0xfb10('0x2c'),this[_0xfb10('0x2a')][_0xfb10('0x20')](this));ami['on'](_0xfb10('0x2d'),this['syncCustomEvent']['bind'](this));ami['on'](_0xfb10('0x2e'),this[_0xfb10('0x1f')][_0xfb10('0x20')](this));ami['on']('custom:substatus',this['syncCustomEvent'][_0xfb10('0x20')](this));ami['on'](_0xfb10('0x2f'),this['syncCustomEvent'][_0xfb10('0x20')](this));ami['on'](_0xfb10('0x30'),this[_0xfb10('0x1f')][_0xfb10('0x20')](this));ami['on'](_0xfb10('0x31'),this[_0xfb10('0x1f')][_0xfb10('0x20')](this));ami['on'](_0xfb10('0x32'),this[_0xfb10('0x1f')]['bind'](this));}Trigger[_0xfb10('0x33')][_0xfb10('0x34')]=function(_0x4aed86,_0x53efe3,_0x6683e1){logger[_0xfb10('0x35')](_0x4aed86,_0x53efe3,JSON[_0xfb10('0x36')](_0x6683e1));io['to'](_0x4aed86)[_0xfb10('0x34')](_0x53efe3,_0x6683e1);};Trigger[_0xfb10('0x33')][_0xfb10('0x1f')]=function(_0x168272){var _0x58cc41=_['clone'](_0x168272);if(typeof _0x58cc41[_0xfb10('0x37')]===_0xfb10('0x38')){_0x58cc41['motionChannel']='voice';}this[_0xfb10('0x39')](_0x58cc41);};Trigger[_0xfb10('0x33')][_0xfb10('0x2a')]=function(_0x24d970){if(this['agents'][_0x24d970[_0xfb10('0x3a')]]){this['syncCustomEvent'](_0x24d970);}};Trigger['prototype'][_0xfb10('0x39')]=function(_0x32b713){var _0x410f0c;for(var _0x296a19 in this[_0xfb10('0x3b')]){if(this['triggers'][_0xfb10('0x3c')](_0x296a19)){if(this[_0xfb10('0x3b')][_0x296a19][_0xfb10('0x3d')]){_0x410f0c=this[_0xfb10('0x3e')](this[_0xfb10('0x3b')][_0x296a19],_0x32b713);if(_0x410f0c){_[_0xfb10('0x3f')](_0x32b713,_0x32b713['variables']);for(var _0x369677=0x0,_0x88d7dc,_0x562dc0,_0x10a61f;_0x3696770x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ No newline at end of file +var _0x7217=['format','%s/users','remoteUri','then','total_entries','find','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','_embedded','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','length','map','forEach','string','picklist','nameField','customField','content','toString','includes','idField','custom_fields','variable','variableName','type','customVariable','Variable','name','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','new','xCALLY','Motion','CTI','Tags','Descriptions','user','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','catch','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','unmanaged','lastevent','toUpperCase','calleridname','lodash','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','application/json','validateEmail','Getting\x20agent\x20with\x20email'];(function(_0x3407c9,_0x320a11){var _0x4fa68c=function(_0x480da8){while(--_0x480da8){_0x3407c9['push'](_0x3407c9['shift']());}};_0x4fa68c(++_0x320a11);}(_0x7217,0x19e));var _0x7721=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x7217[_0x2160a9];return _0xa88cf7;};'use strict';var _=require(_0x7721('0x0'));var rp=require('request-promise');var md5=require(_0x7721('0x1'));var util=require(_0x7721('0x2'));var Redis=require(_0x7721('0x3'));var intUtil=require(_0x7721('0x4'));var config=require(_0x7721('0x5'));var logger=require('../../../../config/logger')('desk');config[_0x7721('0x6')]=_[_0x7721('0x7')](config[_0x7721('0x6')],{'host':_0x7721('0x8'),'port':0x18eb});var io=require(_0x7721('0x9'))(new Redis(config[_0x7721('0x6')]));function emit(_0x18ab6b,_0x21f680,_0x225610){io['to'](_0x18ab6b)[_0x7721('0xa')](_0x21f680,_0x225610);}var headers={'Content-Type':_0x7721('0xb'),'Accept':_0x7721('0xb')};function getUser(_0xfa8835,_0x138740){if(intUtil[_0x7721('0xc')](_0x138740)===!![]){logger['info'](_0x7721('0xd'),_0x138740);return request({'uri':util[_0x7721('0xe')](_0x7721('0xf'),_0xfa8835[_0x7721('0x10')])})[_0x7721('0x11')](function(_0x409b37){if(_0x409b37[_0x7721('0x12')]){return _[_0x7721('0x13')](_0x409b37['_embedded'][_0x7721('0x14')],{'email':_0x138740});}})[_0x7721('0x11')](function(_0x57ff6d){if(_0x57ff6d){logger[_0x7721('0x15')](_0x7721('0x16'));return _0x57ff6d;}else{logger[_0x7721('0x15')](_0x7721('0x17'));return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}}function request(_0x3cc909){logger[_0x7721('0x19')]('[HTTP]',JSON[_0x7721('0x1a')](_0x3cc909));return rp(_['defaults'](_0x3cc909,{'method':_0x7721('0x1b'),'headers':headers,'json':!![]}));}function getAuth(_0x5cb0e6){var _0xfec626;if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x1d')){_0xfec626=util[_0x7721('0xe')](_0x7721('0x1e'),_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x20')]);}else if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x21')){_0xfec626=util[_0x7721('0xe')]('%s/token:%s',_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x21')]);}return util[_0x7721('0xe')](_0x7721('0x22'),new Buffer(_0xfec626)['toString'](_0x7721('0x23')));}function getEndUser(_0x512f31,_0xb9e9dd,_0x288e3a){logger[_0x7721('0x15')](_0x7721('0x24'),_0x288e3a);return request({'uri':util[_0x7721('0xe')](_0x7721('0x25'),_0x512f31[_0x7721('0x10')]),'qs':{'phone':_0x288e3a}})['then'](function(_0x216f20){if(_0x216f20[_0x7721('0x12')]){logger[_0x7721('0x15')](_0x7721('0x26'));return _0x216f20[_0x7721('0x27')][_0x7721('0x14')][0x0];}else{logger[_0x7721('0x15')](_0x7721('0x28'));return request({'uri':util[_0x7721('0xe')]('%s/customers',_0x512f31[_0x7721('0x10')]),'method':'POST','body':{'first_name':_0xb9e9dd,'title':_0xb9e9dd,'phone_numbers':[{'type':'work','value':_0x288e3a}]}});}});}function getTags(_0x315202,_0x343c19){var _0x53c904=[];if(_0x315202&&_0x315202[_0x7721('0x29')]>0x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 1cc36e0..672ae40 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 _0x2707=['picklist','type','nameField','customField','idField','indexOf','ticketType','incident','incidents','assign','Subjects','Descriptions','/contacts(','Fields','phonecall','phonecalls','getString','callDirection','queue','ticketId','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error','inspect','lodash','util','md5','dynamics365','../../../../config/environment','redis','localhost','POST','remoteUri','username','password','clientSecret','access_token','toUpperCase',']\x20Wrong\x20credentials!','message','GET','Bearer\x20','4.0','then','value','isNil','userEmail','length','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','catch','toLowerCase','destcalleridnum','calleridnum','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','outbound','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','contactid',']\x20Enduser\x20Created!','forEach','string'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x2707,0x143));var _0x7270=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x2707[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x7270('0x0'));var BPromise=require('bluebird');var rp=require('request-promise');var util=require(_0x7270('0x1'));var intUtil=require('./util');var md5=require(_0x7270('0x2'));var Redis=require('ioredis');var logger=require('../../../../config/logger')(_0x7270('0x3'));var config=require(_0x7270('0x4'));config[_0x7270('0x5')]=_['defaults'](config[_0x7270('0x5')],{'host':_0x7270('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7270('0x5')]));function getAuthToken(_0x2cb781,_0x497e5f,_0x3dd7eb){var _0xd56525={'method':_0x7270('0x7'),'uri':_0x497e5f,'form':{'client_id':_0x2cb781['clientId'],'resource':_0x2cb781[_0x7270('0x8')],'username':_0x2cb781[_0x7270('0x9')],'password':_0x2cb781[_0x7270('0xa')],'grant_type':_0x7270('0xa'),'client_secret':_0x2cb781[_0x7270('0xb')]},'json':!![]};return rp(_0xd56525)['then'](function(_0x1fa260){return _0x1fa260[_0x7270('0xc')];})['catch'](function(_0x5311a6){logger['error']('['+[_0x3dd7eb[_0x7270('0xd')]()]+_0x7270('0xe'));return _0x5311a6[_0x7270('0xf')];});}function getUser(_0x2ee714,_0x567431,_0x3fe710,_0x2de37e,_0x54cb2a,_0x34d89a){return new BPromise(function(_0xecd82e,_0x5e66e1){return getAuthToken(_0x567431,_0x2de37e,_0x34d89a)['then'](function(_0x5d9dc7){var _0x4c8727={'method':_0x7270('0x10'),'uri':_0x54cb2a+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x7270('0x11')+_0x5d9dc7,'OData-Version':_0x7270('0x12')},'json':!![]};return rp(_0x4c8727);})[_0x7270('0x13')](function(_0x385b9c){var _0x5ed51f=_0x385b9c[_0x7270('0x14')];var _0x272126=![];var _0x10e56f=null;if(!_[_0x7270('0x15')](_0x3fe710)){if(intUtil['validateEmail'](_0x3fe710['email'])){_0x2ee714[_0x7270('0x16')]=_0x3fe710['email'];for(_0x10e56f=0x0;_0x10e56f<_0x5ed51f[_0x7270('0x17')];_0x10e56f++){if(_0x5ed51f[_0x10e56f][_0x7270('0x18')]===_0x3fe710['email']&&!_0x5ed51f[_0x10e56f]['isdisabled']){_0x272126=!![];logger[_0x7270('0x19')]('['+[_0x34d89a[_0x7270('0xd')]()]+_0x7270('0x1a')+_0x5ed51f[_0x10e56f][_0x7270('0x1b')]+'!');_0x2ee714[_0x7270('0x1c')]=_0x5ed51f[_0x10e56f][_0x7270('0x1b')];}}}}if(!_0x272126){logger[_0x7270('0x19')]('['+[_0x34d89a[_0x7270('0xd')]()]+_0x7270('0x1d'));_0x2ee714[_0x7270('0x16')]=_0x567431[_0x7270('0x9')];for(_0x10e56f=0x0;_0x10e56f<_0x5ed51f[_0x7270('0x17')];_0x10e56f++){if(_0x5ed51f[_0x10e56f][_0x7270('0x18')]===_0x567431['username']){_0x2ee714['userId']=_0x5ed51f[_0x10e56f][_0x7270('0x1b')];}}}_0xecd82e(_0x2ee714);})[_0x7270('0x1e')](function(_0x1df79a){_0x5e66e1(_0x1df79a['message']);});});}function createEndUser(_0x57c5c7,_0x4807c8,_0xd1d2a,_0x3d6572,_0x5035fe,_0x12aa1a){return new BPromise(function(_0x5bd3ac,_0x3bb4c9){return getAuthToken(_0x4807c8,_0xd1d2a,_0x12aa1a)[_0x7270('0x13')](function(_0x171f9a){var _0x56be69=_0x12aa1a[_0x7270('0x1f')]()==='outbound'?_0x5035fe[_0x7270('0x20')]:_0x5035fe[_0x7270('0x21')];var _0x921035={'method':'POST','uri':_0x3d6572+_0x7270('0x22'),'body':{'telephone1':_0x56be69,'fullname':_0x56be69,'firstname':_0x56be69,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x7270('0x23')+_0x57c5c7['userId']+')'},'headers':{'Authorization':'Bearer\x20'+_0x171f9a,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x921035);})['then'](function(_0x21202b){var _0x4aded8=_0x21202b[_0x7270('0x24')][_0x7270('0x25')];var _0x5d0e96=_0x4aded8[_0x7270('0x26')](_0x4aded8[_0x7270('0x27')]('(')+0x1,_0x4aded8[_0x7270('0x27')](')'));_0x57c5c7[_0x7270('0x28')]=_0x5d0e96;_0x5bd3ac(_0x57c5c7);})[_0x7270('0x1e')](function(_0x44d103){_0x3bb4c9(_0x44d103['message']);});});}function getEndUser(_0x17f2e7,_0x137e11,_0x27e5a3,_0x52d4ad,_0x2abb49,_0x329212){return new BPromise(function(_0x190431,_0x1f2adc){var _0x2d3307=_0x329212['toLowerCase']()===_0x7270('0x29')?_0x2abb49[_0x7270('0x20')]:_0x2abb49[_0x7270('0x21')];return getAuthToken(_0x137e11,_0x27e5a3,_0x329212)[_0x7270('0x13')](function(_0x2210e5){var _0x57ac3a={'method':'GET','uri':_0x52d4ad+_0x7270('0x2a')+_0x2d3307[_0x7270('0x2b')]('+',_0x7270('0x2c'))+'\x27','headers':{'Authorization':_0x7270('0x11')+_0x2210e5,'If-None-Match':null,'OData-Version':_0x7270('0x12')},'json':!![]};return rp(_0x57ac3a);})[_0x7270('0x13')](function(_0x28232c){var _0x4ec53a=null;if(_0x28232c){var _0x141e54=_0x28232c[_0x7270('0x14')];var _0x4052fa=![];for(_0x4ec53a=0x0;_0x4ec53a<_0x141e54[_0x7270('0x17')];_0x4ec53a++){if(_0x141e54[_0x4ec53a]['telephone1']===_0x2d3307){_0x4052fa=!![];_0x17f2e7[_0x7270('0x28')]=_0x141e54[_0x4ec53a][_0x7270('0x2d')];}}if(_0x4052fa){_0x190431(_0x17f2e7);}else{return createEndUser(_0x17f2e7,_0x137e11,_0x27e5a3,_0x52d4ad,_0x2abb49,_0x329212)[_0x7270('0x13')](function(_0x5b10e0){logger[_0x7270('0x19')]('['+[_0x329212[_0x7270('0xd')]()]+']\x20Enduser\x20created!',_0x5b10e0[_0x7270('0x28')]);_0x190431(_0x5b10e0);});}}else{return createEndUser(_0x17f2e7,_0x137e11,_0x27e5a3,_0x52d4ad,_0x2abb49,_0x329212)[_0x7270('0x13')](function(_0x3ac0a1){logger[_0x7270('0x19')]('['+[_0x329212[_0x7270('0xd')]()]+_0x7270('0x2e'),_0x3ac0a1[_0x7270('0x28')]);_0x190431(_0x3ac0a1);});}});});}function getCustomFields(_0x19a9cd,_0x589d8b,_0x8f95e6){var _0x5eaf9e={};if(_0x19a9cd[_0x7270('0x17')]>0x0){_[_0x7270('0x2f')](_0x19a9cd,function(_0x600a0d){if(_['includes']([_0x7270('0x30'),_0x7270('0x31')],_0x600a0d[_0x7270('0x32')])&&_0x600a0d[_0x7270('0x33')]&&!_0x600a0d[_0x7270('0x34')]){var _0x2c616f=_0x600a0d[_0x7270('0x35')][_0x7270('0x1f')]();var _0x3dbe10=_0x2c616f[_0x7270('0x26')](0x0,_0x2c616f[_0x7270('0x36')]('_'));var _0x593411=_0x2c616f[_0x7270('0x26')](_0x2c616f['indexOf']('_')+0x1);if(_0x3dbe10===_0x8f95e6){_0x5eaf9e[_0x593411]=_0x600a0d['content'];}}});}return _0x5eaf9e;}function getTicket(_0x194fe8,_0x474f50,_0x36164c,_0x265df6,_0x3f6d3e,_0x26f782,_0x51acc4){return new BPromise(function(_0x265f59,_0x236d90){var _0x44b91b;return getAuthToken(_0x474f50,_0x36164c,_0x51acc4)[_0x7270('0x13')](function(_0x14575a){if(_0x26f782[_0x7270('0x37')]===_0x7270('0x38')){_0x44b91b={'method':'POST','uri':_0x265df6+_0x7270('0x39'),'body':Object[_0x7270('0x3a')]({},{'title':intUtil['getString'](_0x26f782[_0x7270('0x3b')],_0x3f6d3e,'\x20'),'description':intUtil['getString'](_0x26f782[_0x7270('0x3c')],_0x3f6d3e,'\x0a'),'customerid_contact@odata.bind':_0x7270('0x3d')+_0x194fe8[_0x7270('0x28')]+')','ownerid@odata.bind':_0x7270('0x23')+_0x194fe8[_0x7270('0x1c')]+')','caseorigincode':'1'},getCustomFields(_0x26f782[_0x7270('0x3e')],_0x3f6d3e,_0x26f782[_0x7270('0x37')])),'headers':{'Authorization':_0x7270('0x11')+_0x14575a,'OData-Version':_0x7270('0x12')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x26f782['ticketType']===_0x7270('0x3f')){_0x44b91b={'method':_0x7270('0x7'),'uri':_0x265df6+_0x7270('0x40'),'body':Object[_0x7270('0x3a')]({},{'subject':intUtil[_0x7270('0x41')](_0x26f782[_0x7270('0x3b')],_0x3f6d3e,'\x20'),'phonenumber':String(_0x3f6d3e[_0x7270('0x21')]),'description':intUtil[_0x7270('0x41')](_0x26f782[_0x7270('0x3c')],_0x3f6d3e,'\x0a'),'regardingobjectid_contact@odata.bind':_0x7270('0x3d')+_0x194fe8[_0x7270('0x28')]+')','ownerid@odata.bind':_0x7270('0x23')+_0x194fe8[_0x7270('0x1c')]+')','directioncode':_0x194fe8[_0x7270('0x42')]===_0x7270('0x43')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x7270('0x23')+_0x194fe8[_0x7270('0x1c')]+')','participationtypemask':_0x194fe8[_0x7270('0x42')]===_0x7270('0x43')?0x2:0x1},{'partyid_contact@odata.bind':_0x7270('0x3d')+_0x194fe8[_0x7270('0x28')]+')','participationtypemask':_0x194fe8['callDirection']===_0x7270('0x43')?0x1:0x2}]},getCustomFields(_0x26f782[_0x7270('0x3e')],_0x3f6d3e,_0x26f782[_0x7270('0x37')])),'headers':{'Authorization':_0x7270('0x11')+_0x14575a,'OData-Version':_0x7270('0x12')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x44b91b);})[_0x7270('0x13')](function(_0x46cdfc){var _0x1d140d=_0x46cdfc['headers'][_0x7270('0x25')];var _0x527a57=_0x1d140d[_0x7270('0x26')](_0x1d140d[_0x7270('0x27')]('(')+0x1,_0x1d140d['lastIndexOf'](')'));_0x194fe8[_0x7270('0x44')]=_0x527a57;_0x265f59(_0x194fe8);})[_0x7270('0x1e')](function(_0x583753){_0x236d90(_0x583753[_0x7270('0xf')]);});});}function emit(_0x14594a,_0x4998ef,_0x52219a,_0x1f0450){var _0x5e4327={'uri':util['format']('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x14594a,_0x52219a,_0x1f0450)};io['to'](util[_0x7270('0x45')](_0x7270('0x46'),_0x4998ef))[_0x7270('0x47')](_0x7270('0x48'),_0x5e4327);}exports['cs']=function(_0x24f36b,_0xb57f95,_0x4badac,_0x3f2536,_0x295d3c,_0x18b947,_0x3153e0,_0x54a010){var _0x1d6c4c={};_0x18b947['remoteUri']=intUtil[_0x7270('0x49')](_0x18b947['remoteUri']);_0x18b947[_0x7270('0x4a')]=intUtil[_0x7270('0x49')](_0x18b947['serverUrl']);_0x1d6c4c[_0x7270('0x42')]=_0x54a010===_0x7270('0x43')||_0x54a010==='unmanaged'?_0x7270('0x43'):_0x7270('0x29');var _0x25e97e=util[_0x7270('0x45')]('%s/api/data/v9.0/',_0x18b947['remoteUri']);var _0x318d4b=util[_0x7270('0x45')]('https://login.microsoftonline.com/%s/oauth2/token',_0x18b947[_0x7270('0x4b')]);var _0x3a4a41=util[_0x7270('0x45')](_0x7270('0x4c'),_0x18b947[_0x7270('0x4a')],_0xb57f95[_0x7270('0x4d')],md5(_0xb57f95[_0x7270('0x4d')]));if(_0x295d3c&&_0x295d3c[_0x7270('0x4e')]){logger['info'](_0x7270('0x4f'),_0x7270('0x50'));_0xb57f95[_0x7270('0x51')]=_0x3a4a41;}else if(_0x3153e0&&_0x3153e0['recordingFormat']&&_0x3153e0[_0x7270('0x52')]!=='none'){logger[_0x7270('0x19')]('[OUTBOUND]',_0x7270('0x50'));_0xb57f95[_0x7270('0x51')]=_0x3a4a41;}else{_0xb57f95[_0x7270('0x51')]='';}return getUser(_0x1d6c4c,_0x18b947,_0x3f2536,_0x318d4b,_0x25e97e,_0x54a010)[_0x7270('0x13')](function(_0x4b8572){logger[_0x7270('0x19')]('['+_0x54a010[_0x7270('0xd')]()+_0x7270('0x53'),_0x4b8572[_0x7270('0x1c')]);logger['info']('['+_0x54a010[_0x7270('0xd')]()+_0x7270('0x54'),_0x4b8572['userEmail']);return getEndUser(_0x4b8572,_0x18b947,_0x318d4b,_0x25e97e,_0xb57f95,_0x54a010);})[_0x7270('0x13')](function(_0x1191a2){logger['info']('['+_0x54a010[_0x7270('0xd')]()+_0x7270('0x55'),_0x1191a2[_0x7270('0x28')]);logger['info']('['+_0x54a010['toUpperCase']()+']\x20The\x20Enduser\x20phone\x20is:',_0xb57f95[_0x7270('0x21')]);return getTicket(_0x1191a2,_0x18b947,_0x318d4b,_0x25e97e,_0xb57f95,_0x4badac,_0x54a010);})[_0x7270('0x13')](function(_0x76dcf9){logger['info'](util[_0x7270('0x45')]('['+_0x54a010['toUpperCase']()+_0x7270('0x56'),_0x4badac[_0x7270('0x37')],_0x76dcf9['ticketId']));logger[_0x7270('0x19')](util[_0x7270('0x45')]('['+_0x54a010[_0x7270('0xd')]()+_0x7270('0x57'),_0x54a010));if(_0x54a010!==_0x7270('0x58')){logger[_0x7270('0x19')]('['+_0x54a010[_0x7270('0xd')]()+']',_0x7270('0x59'));emit(_0x18b947[_0x7270('0x8')],_0x3f2536[_0x7270('0x5a')],_0x4badac[_0x7270('0x37')],_0x76dcf9['ticketId']);}})['catch'](function(_0x2d33b2){logger[_0x7270('0x5b')]('['+_0x54a010['toUpperCase']()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0x7270('0x5c')](_0x2d33b2,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xb133=[']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','./util','../../../../config/logger','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','catch','error',']\x20Wrong\x20credentials!','GET','Bearer\x20','4.0','value','validateEmail','email','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','userId','info','toUpperCase',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','length','systemuserid','message','toLowerCase','outbound','contacts','/systemusers(','odata-entityid','substring','lastIndexOf','enduserId','destcalleridnum','replace','%2b','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','picklist','customField','idField','indexOf','ticketType','incident','incidents','assign','getString','Descriptions','/contacts(','Fields','phonecall','phonecalls','Subjects','calleridnum','callDirection','queue','headers','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','tenantId','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','name','ticketId'];(function(_0x2941f9,_0x1eeae7){var _0x208446=function(_0x454959){while(--_0x454959){_0x2941f9['push'](_0x2941f9['shift']());}};_0x208446(++_0x1eeae7);}(_0xb133,0x186));var _0x3b13=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xb133[_0x2112d4];return _0x434972;};'use strict';var _=require(_0x3b13('0x0'));var BPromise=require(_0x3b13('0x1'));var rp=require(_0x3b13('0x2'));var util=require('util');var intUtil=require(_0x3b13('0x3'));var md5=require('md5');var Redis=require('ioredis');var logger=require(_0x3b13('0x4'))('dynamics365');var config=require(_0x3b13('0x5'));config['redis']=_[_0x3b13('0x6')](config[_0x3b13('0x7')],{'host':_0x3b13('0x8'),'port':0x18eb});var io=require(_0x3b13('0x9'))(new Redis(config[_0x3b13('0x7')]));function getAuthToken(_0x99ac97,_0x12ca1f,_0x2fe2b0){var _0x39100b={'method':_0x3b13('0xa'),'uri':_0x12ca1f,'form':{'client_id':_0x99ac97[_0x3b13('0xb')],'resource':_0x99ac97[_0x3b13('0xc')],'username':_0x99ac97[_0x3b13('0xd')],'password':_0x99ac97[_0x3b13('0xe')],'grant_type':'password','client_secret':_0x99ac97[_0x3b13('0xf')]},'json':!![]};return rp(_0x39100b)[_0x3b13('0x10')](function(_0x2c1028){return _0x2c1028[_0x3b13('0x11')];})[_0x3b13('0x12')](function(_0x298c9d){logger[_0x3b13('0x13')]('['+[_0x2fe2b0['toUpperCase']()]+_0x3b13('0x14'));return _0x298c9d['message'];});}function getUser(_0x138cca,_0x211f57,_0x456823,_0x5e9b6a,_0x1b0f46,_0xf6aa6b){return new BPromise(function(_0x409af8,_0x1b7393){return getAuthToken(_0x211f57,_0x5e9b6a,_0xf6aa6b)[_0x3b13('0x10')](function(_0x177ec9){var _0x580074={'method':_0x3b13('0x15'),'uri':_0x1b0f46+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x3b13('0x16')+_0x177ec9,'OData-Version':_0x3b13('0x17')},'json':!![]};return rp(_0x580074);})['then'](function(_0x1fb3c3){var _0xfffd0b=_0x1fb3c3[_0x3b13('0x18')];var _0x10b444=![];var _0x3e0e6b=null;if(!_['isNil'](_0x456823)){if(intUtil[_0x3b13('0x19')](_0x456823['email'])){_0x138cca['userEmail']=_0x456823[_0x3b13('0x1a')];for(_0x3e0e6b=0x0;_0x3e0e6b<_0xfffd0b['length'];_0x3e0e6b++){if(_0xfffd0b[_0x3e0e6b][_0x3b13('0x1b')]===_0x456823['email']&&!_0xfffd0b[_0x3e0e6b][_0x3b13('0x1c')]){_0x10b444=!![];logger['info']('['+[_0xf6aa6b['toUpperCase']()]+_0x3b13('0x1d')+_0xfffd0b[_0x3e0e6b]['systemuserid']+'!');_0x138cca[_0x3b13('0x1e')]=_0xfffd0b[_0x3e0e6b]['systemuserid'];}}}}if(!_0x10b444){logger[_0x3b13('0x1f')]('['+[_0xf6aa6b[_0x3b13('0x20')]()]+_0x3b13('0x21'));_0x138cca[_0x3b13('0x22')]=_0x211f57[_0x3b13('0xd')];for(_0x3e0e6b=0x0;_0x3e0e6b<_0xfffd0b[_0x3b13('0x23')];_0x3e0e6b++){if(_0xfffd0b[_0x3e0e6b]['internalemailaddress']===_0x211f57[_0x3b13('0xd')]){_0x138cca['userId']=_0xfffd0b[_0x3e0e6b][_0x3b13('0x24')];}}}_0x409af8(_0x138cca);})[_0x3b13('0x12')](function(_0x56d1fa){_0x1b7393(_0x56d1fa[_0x3b13('0x25')]);});});}function createEndUser(_0x27edba,_0x567ba0,_0x1237a3,_0x208ede,_0x208c73,_0x3d0b71){return new BPromise(function(_0x538499,_0x5be286){return getAuthToken(_0x567ba0,_0x1237a3,_0x3d0b71)[_0x3b13('0x10')](function(_0x1247cd){var _0x3bd0ff=_0x3d0b71[_0x3b13('0x26')]()===_0x3b13('0x27')?_0x208c73['destcalleridnum']:_0x208c73['calleridnum'];var _0x4646a3={'method':_0x3b13('0xa'),'uri':_0x208ede+_0x3b13('0x28'),'body':{'telephone1':_0x3bd0ff,'fullname':_0x3bd0ff,'firstname':_0x3bd0ff,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x3b13('0x29')+_0x27edba['userId']+')'},'headers':{'Authorization':_0x3b13('0x16')+_0x1247cd,'OData-Version':_0x3b13('0x17')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x4646a3);})['then'](function(_0x332b06){var _0x5362ab=_0x332b06['headers'][_0x3b13('0x2a')];var _0x52536a=_0x5362ab[_0x3b13('0x2b')](_0x5362ab[_0x3b13('0x2c')]('(')+0x1,_0x5362ab[_0x3b13('0x2c')](')'));_0x27edba[_0x3b13('0x2d')]=_0x52536a;_0x538499(_0x27edba);})[_0x3b13('0x12')](function(_0x2e7522){_0x5be286(_0x2e7522[_0x3b13('0x25')]);});});}function getEndUser(_0x1ab04f,_0x542248,_0x277041,_0x2f5818,_0xd0e9b,_0x59e998){return new BPromise(function(_0x1574b6,_0x3ed4fe){var _0x4c1e58=_0x59e998[_0x3b13('0x26')]()===_0x3b13('0x27')?_0xd0e9b[_0x3b13('0x2e')]:_0xd0e9b['calleridnum'];return getAuthToken(_0x542248,_0x277041,_0x59e998)[_0x3b13('0x10')](function(_0x4742f2){var _0x206285={'method':_0x3b13('0x15'),'uri':_0x2f5818+'contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27'+_0x4c1e58[_0x3b13('0x2f')]('+',_0x3b13('0x30'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x4742f2,'If-None-Match':null,'OData-Version':_0x3b13('0x17')},'json':!![]};return rp(_0x206285);})['then'](function(_0x402448){var _0x3c8b15=null;if(_0x402448){var _0x166856=_0x402448[_0x3b13('0x18')];var _0x24450d=![];for(_0x3c8b15=0x0;_0x3c8b15<_0x166856['length'];_0x3c8b15++){if(_0x166856[_0x3c8b15][_0x3b13('0x31')]===_0x4c1e58){_0x24450d=!![];_0x1ab04f[_0x3b13('0x2d')]=_0x166856[_0x3c8b15][_0x3b13('0x32')];}}if(_0x24450d){_0x1574b6(_0x1ab04f);}else{return createEndUser(_0x1ab04f,_0x542248,_0x277041,_0x2f5818,_0xd0e9b,_0x59e998)['then'](function(_0x31aa33){logger['info']('['+[_0x59e998[_0x3b13('0x20')]()]+_0x3b13('0x33'),_0x31aa33[_0x3b13('0x2d')]);_0x1574b6(_0x31aa33);});}}else{return createEndUser(_0x1ab04f,_0x542248,_0x277041,_0x2f5818,_0xd0e9b,_0x59e998)[_0x3b13('0x10')](function(_0x46b9b8){logger[_0x3b13('0x1f')]('['+[_0x59e998[_0x3b13('0x20')]()]+_0x3b13('0x34'),_0x46b9b8[_0x3b13('0x2d')]);_0x1574b6(_0x46b9b8);});}});});}function getCustomFields(_0x33db97,_0x341188,_0xf145ad){var _0x5c71c3={};if(_0x33db97[_0x3b13('0x23')]>0x0){_[_0x3b13('0x35')](_0x33db97,function(_0x1733ee){if(_[_0x3b13('0x36')](['string',_0x3b13('0x37')],_0x1733ee['type'])&&_0x1733ee['nameField']&&!_0x1733ee[_0x3b13('0x38')]){var _0x5ed010=_0x1733ee[_0x3b13('0x39')][_0x3b13('0x26')]();var _0x20432a=_0x5ed010[_0x3b13('0x2b')](0x0,_0x5ed010[_0x3b13('0x3a')]('_'));var _0x18ecc4=_0x5ed010[_0x3b13('0x2b')](_0x5ed010[_0x3b13('0x3a')]('_')+0x1);if(_0x20432a===_0xf145ad){_0x5c71c3[_0x18ecc4]=_0x1733ee['content'];}}});}return _0x5c71c3;}function getTicket(_0x4ae114,_0x2e7193,_0x49b0eb,_0x116a15,_0x1bb6ae,_0x306e3e,_0x178b80){return new BPromise(function(_0x2f81a8,_0x485f08){var _0x48033f;return getAuthToken(_0x2e7193,_0x49b0eb,_0x178b80)[_0x3b13('0x10')](function(_0x50d344){if(_0x306e3e[_0x3b13('0x3b')]===_0x3b13('0x3c')){_0x48033f={'method':'POST','uri':_0x116a15+_0x3b13('0x3d'),'body':Object[_0x3b13('0x3e')]({},{'title':intUtil[_0x3b13('0x3f')](_0x306e3e['Subjects'],_0x1bb6ae,'\x20'),'description':intUtil['getString'](_0x306e3e[_0x3b13('0x40')],_0x1bb6ae,'\x0a'),'customerid_contact@odata.bind':_0x3b13('0x41')+_0x4ae114['enduserId']+')','ownerid@odata.bind':_0x3b13('0x29')+_0x4ae114[_0x3b13('0x1e')]+')','caseorigincode':'1'},getCustomFields(_0x306e3e[_0x3b13('0x42')],_0x1bb6ae,_0x306e3e['ticketType'])),'headers':{'Authorization':_0x3b13('0x16')+_0x50d344,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x306e3e['ticketType']===_0x3b13('0x43')){_0x48033f={'method':_0x3b13('0xa'),'uri':_0x116a15+_0x3b13('0x44'),'body':Object[_0x3b13('0x3e')]({},{'subject':intUtil[_0x3b13('0x3f')](_0x306e3e[_0x3b13('0x45')],_0x1bb6ae,'\x20'),'phonenumber':String(_0x1bb6ae[_0x3b13('0x46')]),'description':intUtil['getString'](_0x306e3e[_0x3b13('0x40')],_0x1bb6ae,'\x0a'),'regardingobjectid_contact@odata.bind':_0x3b13('0x41')+_0x4ae114[_0x3b13('0x2d')]+')','ownerid@odata.bind':_0x3b13('0x29')+_0x4ae114[_0x3b13('0x1e')]+')','directioncode':_0x4ae114[_0x3b13('0x47')]===_0x3b13('0x48')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x3b13('0x29')+_0x4ae114['userId']+')','participationtypemask':_0x4ae114[_0x3b13('0x47')]===_0x3b13('0x48')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x4ae114[_0x3b13('0x2d')]+')','participationtypemask':_0x4ae114[_0x3b13('0x47')]===_0x3b13('0x48')?0x1:0x2}]},getCustomFields(_0x306e3e['Fields'],_0x1bb6ae,_0x306e3e['ticketType'])),'headers':{'Authorization':_0x3b13('0x16')+_0x50d344,'OData-Version':_0x3b13('0x17')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x48033f);})['then'](function(_0x304b83){var _0x25f49f=_0x304b83[_0x3b13('0x49')]['odata-entityid'];var _0x2f0115=_0x25f49f[_0x3b13('0x2b')](_0x25f49f[_0x3b13('0x2c')]('(')+0x1,_0x25f49f['lastIndexOf'](')'));_0x4ae114['ticketId']=_0x2f0115;_0x2f81a8(_0x4ae114);})['catch'](function(_0x4ca821){_0x485f08(_0x4ca821['message']);});});}function emit(_0x208831,_0x1fbc77,_0xded45b,_0x296dad){var _0x35fe45={'uri':util[_0x3b13('0x4a')](_0x3b13('0x4b'),_0x208831,_0xded45b,_0x296dad)};io['to'](util['format']('user:%s',_0x1fbc77))[_0x3b13('0x4c')](_0x3b13('0x4d'),_0x35fe45);}exports['cs']=function(_0x5e8077,_0x522172,_0x28c4ac,_0x200f3d,_0x2bc098,_0x8e8747,_0x3ba6a8,_0x575fba){var _0x5c4095={};_0x8e8747[_0x3b13('0xc')]=intUtil[_0x3b13('0x4e')](_0x8e8747[_0x3b13('0xc')]);_0x8e8747[_0x3b13('0x4f')]=intUtil['stripTrailingSlash'](_0x8e8747[_0x3b13('0x4f')]);_0x5c4095['callDirection']=_0x575fba===_0x3b13('0x48')||_0x575fba==='unmanaged'?_0x3b13('0x48'):_0x3b13('0x27');var _0x55b017=util[_0x3b13('0x4a')](_0x3b13('0x50'),_0x8e8747['remoteUri']);var _0xf649db=util[_0x3b13('0x4a')]('https://login.microsoftonline.com/%s/oauth2/token',_0x8e8747[_0x3b13('0x51')]);var _0x267e11=util[_0x3b13('0x4a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x8e8747[_0x3b13('0x4f')],_0x522172[_0x3b13('0x52')],md5(_0x522172[_0x3b13('0x52')]));if(_0x2bc098&&_0x2bc098[_0x3b13('0x53')]){logger[_0x3b13('0x1f')](_0x3b13('0x54'),_0x3b13('0x55'));_0x522172[_0x3b13('0x56')]=_0x267e11;}else if(_0x3ba6a8&&_0x3ba6a8[_0x3b13('0x57')]&&_0x3ba6a8[_0x3b13('0x57')]!==_0x3b13('0x58')){logger[_0x3b13('0x1f')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x522172[_0x3b13('0x56')]=_0x267e11;}else{_0x522172['recordingURL']='';}return getUser(_0x5c4095,_0x8e8747,_0x200f3d,_0xf649db,_0x55b017,_0x575fba)[_0x3b13('0x10')](function(_0x3df647){logger[_0x3b13('0x1f')]('['+_0x575fba['toUpperCase']()+_0x3b13('0x59'),_0x3df647[_0x3b13('0x1e')]);logger[_0x3b13('0x1f')]('['+_0x575fba[_0x3b13('0x20')]()+_0x3b13('0x5a'),_0x3df647[_0x3b13('0x22')]);return getEndUser(_0x3df647,_0x8e8747,_0xf649db,_0x55b017,_0x522172,_0x575fba);})[_0x3b13('0x10')](function(_0x358cd5){logger['info']('['+_0x575fba[_0x3b13('0x20')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x358cd5[_0x3b13('0x2d')]);logger[_0x3b13('0x1f')]('['+_0x575fba[_0x3b13('0x20')]()+_0x3b13('0x5b'),_0x522172[_0x3b13('0x46')]);return getTicket(_0x358cd5,_0x8e8747,_0xf649db,_0x55b017,_0x522172,_0x28c4ac,_0x575fba);})[_0x3b13('0x10')](function(_0x3d2947){logger[_0x3b13('0x1f')](util[_0x3b13('0x4a')]('['+_0x575fba['toUpperCase']()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x28c4ac['ticketType'],_0x3d2947['ticketId']));logger[_0x3b13('0x1f')](util[_0x3b13('0x4a')]('['+_0x575fba[_0x3b13('0x20')]()+_0x3b13('0x5c'),_0x575fba));if(_0x575fba!=='unmanaged'){logger['info']('['+_0x575fba[_0x3b13('0x20')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x8e8747[_0x3b13('0xc')],_0x200f3d[_0x3b13('0x5d')],_0x28c4ac[_0x3b13('0x3b')],_0x3d2947[_0x3b13('0x5e')]);}})['catch'](function(_0x547585){logger[_0x3b13('0x13')]('['+_0x575fba['toUpperCase']()+_0x3b13('0x5f'),util[_0x3b13('0x60')](_0x547585,{'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 e70ea4d..0f9b0fe 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 _0x05c7=['calleridname','calleridnum','getString','Subjects','Descriptions','
','name','Fields','keyBy','custom_fields','value','%s/api/v2/tickets','remoteUri','then','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','find','contact','%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!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Basic\x20%s','toString','base64','[HTTP]','stringify','defaults','GET','forEach','includes','string','picklist','type','nameField','idField','customField','content','variable','variableName','push','customVariable','Variable','toLowerCase','queue','serverUrl','stripTrailingSlash','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/helpdesk/tickets/%d','catch','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','uniqueid','destcalleridname','trigger:browser:url','error','unmanaged','toUpperCase','lastevent','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','application/json','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s'];(function(_0x59e862,_0x477bf2){var _0x1a25ee=function(_0xc61e64){while(--_0xc61e64){_0x59e862['push'](_0x59e862['shift']());}};_0x1a25ee(++_0x477bf2);}(_0x05c7,0x162));var _0x705c=function(_0x309ee3,_0x26c85f){_0x309ee3=_0x309ee3-0x0;var _0x2268e0=_0x05c7[_0x309ee3];return _0x2268e0;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x705c('0x0'));var util=require(_0x705c('0x1'));var Redis=require(_0x705c('0x2'));var intUtil=require(_0x705c('0x3'));var config=require(_0x705c('0x4'));var logger=require(_0x705c('0x5'))(_0x705c('0x6'));config[_0x705c('0x7')]=_['defaults'](config[_0x705c('0x7')],{'host':_0x705c('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x705c('0x7')]));var headers={'Content-Type':_0x705c('0x9'),'Accept':'application/json'};function emit(_0x439c9e,_0x235850,_0x3fa9b3){io['to'](_0x439c9e)['emit'](_0x235850,_0x3fa9b3);}function getTicket(_0x370db8,_0x5434db,_0xf39764,_0x160e1e,_0x2ddbed){logger['info'](_0x705c('0xa'));var _0x4b92c9=_[_0x705c('0xb')]({'responder_id':_0x5434db['id'],'requester_id':_0xf39764['id'],'name':util[_0x705c('0xc')](_0x705c('0xd'),_0x2ddbed[_0x705c('0xe')]),'phone':_0x2ddbed[_0x705c('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x705c('0x10')](_0x160e1e[_0x705c('0x11')],_0x2ddbed,'\x20'),'description':intUtil[_0x705c('0x10')](_0x160e1e[_0x705c('0x12')],_0x2ddbed,_0x705c('0x13')),'tags':getTags(_0x160e1e['Tags'],_0x705c('0x14'))},getCustomFields(_0x160e1e[_0x705c('0x15')],_0x2ddbed));_0x4b92c9['custom_fields']=_['mapValues'](_[_0x705c('0x16')](_0x4b92c9[_0x705c('0x17')],'id'),_0x705c('0x18'));return request({'uri':util[_0x705c('0xc')](_0x705c('0x19'),_0x370db8[_0x705c('0x1a')]),'method':'POST','body':_0x4b92c9})[_0x705c('0x1b')](function(_0x203107){logger[_0x705c('0x1c')](_0x705c('0x1d'));return _0x203107;});}function getUser(_0x4aa842,_0x53d984){if(intUtil[_0x705c('0x1e')](_0x53d984)){return request({'uri':util[_0x705c('0xc')](_0x705c('0x1f'),_0x4aa842[_0x705c('0x1a')]),'qs':{'email':_0x53d984}})['then'](function(_0xd3d3bb){if(_0xd3d3bb[_0x705c('0x20')]){logger[_0x705c('0x1c')]('Agent\x20found!');return _[_0x705c('0x21')](_0xd3d3bb,function(_0x5b5cb4){return _0x5b5cb4[_0x705c('0x22')]['email']===_0x53d984;});}else{logger[_0x705c('0x1c')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x705c('0x23'),_0x4aa842[_0x705c('0x1a')])})['then'](function(_0x1cec58){logger[_0x705c('0x1c')](_0x705c('0x24'));return _0x1cec58;});}});}else{logger[_0x705c('0x1c')](_0x705c('0x25'));return request({'uri':util['format'](_0x705c('0x23'),_0x4aa842[_0x705c('0x1a')])})[_0x705c('0x1b')](function(_0x326ba5){logger[_0x705c('0x1c')](_0x705c('0x24'));return _0x326ba5;});}}function getEndUser(_0x16e2d7,_0x1e0990,_0xebd0fc){logger[_0x705c('0x1c')](_0x705c('0x26'),_0xebd0fc);return request({'uri':util[_0x705c('0xc')](_0x705c('0x27'),_0x16e2d7[_0x705c('0x1a')]),'qs':{'phone':_0xebd0fc}})[_0x705c('0x1b')](function(_0x57ac4f){if(_0x57ac4f['length']){logger['info'](_0x705c('0x28'));return _[_0x705c('0x21')](_0x57ac4f,{'phone':_0xebd0fc});}else{logger['info'](_0x705c('0x29'));return request({'uri':util[_0x705c('0xc')](_0x705c('0x27'),_0x16e2d7[_0x705c('0x1a')]),'method':_0x705c('0x2a'),'body':{'name':_0x1e0990,'phone':_0xebd0fc}})[_0x705c('0x1b')](function(_0x42b2a8){logger[_0x705c('0x1c')]('Enduser\x20created.');return _0x42b2a8;});}});}function getAuth(_0x3c15cb){return util[_0x705c('0xc')](_0x705c('0x2b'),new Buffer(_0x3c15cb['apiKey']+':X')[_0x705c('0x2c')](_0x705c('0x2d')));}function request(_0x4630c0){logger['debug'](_0x705c('0x2e'),JSON[_0x705c('0x2f')](_0x4630c0));return rp(_[_0x705c('0x30')](_0x4630c0,{'method':_0x705c('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x48fe55,_0x1cbf8d){var _0x5acaea=[];if(_0x48fe55&&_0x48fe55[_0x705c('0x20')]>0x0){_0x5acaea=_['map'](_0x48fe55,_0x1cbf8d);}return _0x5acaea;}function getCustomFields(_0x518746,_0x113391){var _0x393581=[];var _0x1ba888={'custom_fields':[]};if(_0x518746[_0x705c('0x20')]>0x0){_[_0x705c('0x32')](_0x518746,function(_0x4de52b){if(_[_0x705c('0x33')]([_0x705c('0x34'),_0x705c('0x35')],_0x4de52b[_0x705c('0x36')])&&_0x4de52b[_0x705c('0x37')]&&!_0x4de52b['customField']){_0x1ba888[_0x4de52b[_0x705c('0x37')]['toLowerCase']()]=_0x4de52b['content'][_0x705c('0x2c')]();}else if(_['includes'](['string',_0x705c('0x35')],_0x4de52b[_0x705c('0x36')])&&_0x4de52b[_0x705c('0x38')]&&_0x4de52b[_0x705c('0x39')]){_0x1ba888[_0x705c('0x17')]['push']({'id':_0x4de52b['idField'],'value':_0x4de52b[_0x705c('0x3a')]['toString']()});}else if(_0x4de52b[_0x705c('0x36')]===_0x705c('0x3b')&&_0x4de52b[_0x705c('0x3c')]&&_0x4de52b[_0x705c('0x38')]&&_0x4de52b[_0x705c('0x39')]){_0x113391[_0x4de52b['variableName']]&&_0x1ba888[_0x705c('0x17')][_0x705c('0x3d')]({'id':_0x4de52b[_0x705c('0x38')],'value':_0x113391[_0x4de52b['variableName']][_0x705c('0x2c')]()});}else if(_0x4de52b['type']===_0x705c('0x3e')&&_0x4de52b[_0x705c('0x3f')]&&_0x4de52b['Variable'][_0x705c('0x14')]&&_0x4de52b[_0x705c('0x38')]&&_0x4de52b[_0x705c('0x39')]){_0x113391[_0x4de52b[_0x705c('0x3f')]['name'][_0x705c('0x40')]()]&&_0x1ba888[_0x705c('0x17')]['push']({'id':_0x4de52b[_0x705c('0x38')],'value':_0x113391[_0x4de52b['Variable']['name'][_0x705c('0x40')]()][_0x705c('0x2c')]()});}});}return _0x1ba888;}exports[_0x705c('0x41')]=function(_0x11b1f5,_0x51dc26,_0x158318,_0x1ae75e,_0x2c1099,_0xa695b5){var _0x487340,_0x4aab8a;_0xa695b5[_0x705c('0x1a')]=intUtil['stripTrailingSlash'](_0xa695b5['remoteUri']);_0xa695b5[_0x705c('0x42')]=intUtil[_0x705c('0x43')](_0xa695b5[_0x705c('0x42')]);if(_0x2c1099&&_0x2c1099[_0x705c('0x44')]){logger[_0x705c('0x1c')]('[QUEUE]','Recording\x20is\x20enabled!');_0x51dc26[_0x705c('0x45')]=util['format'](_0x705c('0x46'),_0xa695b5[_0x705c('0x42')],_0x51dc26['uniqueid'],md5(_0x51dc26['uniqueid']));}else{_0x51dc26[_0x705c('0x45')]='';}headers[_0x705c('0x47')]=getAuth(_0xa695b5);return getUser(_0xa695b5,_0x1ae75e[_0x705c('0x48')])[_0x705c('0x1b')](function(_0x287718){_0x487340=_0x287718;logger[_0x705c('0x1c')](_0x705c('0x49'),_0x487340['id']);return getEndUser(_0xa695b5,_0x51dc26[_0x705c('0xe')],_0x51dc26[_0x705c('0xf')]);})[_0x705c('0x1b')](function(_0x3cd743){_0x4aab8a=_0x3cd743;logger[_0x705c('0x1c')](_0x705c('0x4a'),_0x4aab8a['id']);return getTicket(_0xa695b5,_0x487340,_0x4aab8a,_0x158318,_0x51dc26);})[_0x705c('0x1b')](function(_0x2c62f1){if(_0x2c62f1&&_0x2c62f1['id']){logger[_0x705c('0x1c')]('Ticket\x20created!');logger['info'](_0x705c('0x4b'),_0x2c62f1['id']);logger[_0x705c('0x1c')](_0x705c('0x4c'),_0x705c('0x4d'));emit(util[_0x705c('0xc')](_0x705c('0x4e'),_0x1ae75e[_0x705c('0x14')]),'trigger:browser:url',{'uri':util[_0x705c('0xc')](_0x705c('0x4f'),_0xa695b5[_0x705c('0x1a')],_0x2c62f1['id'])});}})[_0x705c('0x50')](function(_0x59ee17){logger['error']('[QUEUE]',JSON[_0x705c('0x2f')](_0x59ee17));});};exports[_0x705c('0x51')]=function(_0x3470ab,_0x91a427,_0x2cf479,_0x9c5cc6,_0x125f0f,_0x345ce9,_0x76e7cc){var _0x21ee49,_0x525b03;_0x345ce9[_0x705c('0x1a')]=intUtil[_0x705c('0x43')](_0x345ce9['remoteUri']);_0x345ce9['serverUrl']=intUtil[_0x705c('0x43')](_0x345ce9[_0x705c('0x42')]);if(_0x76e7cc&&_0x76e7cc[_0x705c('0x52')]&&_0x76e7cc[_0x705c('0x52')]!=='none'){logger['info'](_0x705c('0x53'),_0x705c('0x54'));_0x91a427[_0x705c('0x45')]=util[_0x705c('0xc')](_0x705c('0x46'),_0x345ce9['serverUrl'],_0x91a427[_0x705c('0x55')],md5(_0x91a427[_0x705c('0x55')]));}headers[_0x705c('0x47')]=getAuth(_0x345ce9);return getUser(_0x345ce9,_0x9c5cc6[_0x705c('0x48')])[_0x705c('0x1b')](function(_0x35e72a){_0x21ee49=_0x35e72a;logger['info'](_0x705c('0x49'),_0x21ee49['id']);return getEndUser(_0x345ce9,_0x91a427[_0x705c('0x56')],_0x91a427['destcalleridnum']);})[_0x705c('0x1b')](function(_0x40fc7c){_0x525b03=_0x40fc7c;logger['info']('The\x20Enduser\x20ID\x20is:',_0x525b03['id']);return getTicket(_0x345ce9,_0x21ee49,_0x525b03,_0x2cf479,_0x91a427);})['then'](function(_0x176cdc){if(_0x176cdc&&_0x176cdc['id']){logger['info'](_0x705c('0x1d'));logger[_0x705c('0x1c')](_0x705c('0x4b'),_0x176cdc['id']);logger[_0x705c('0x1c')]('[OUTBOUND]',_0x705c('0x4d'));emit(util[_0x705c('0xc')]('user:%s',_0x9c5cc6[_0x705c('0x14')]),_0x705c('0x57'),{'uri':util[_0x705c('0xc')](_0x705c('0x4f'),_0x345ce9[_0x705c('0x1a')],_0x176cdc['id'])});}})['catch'](function(_0x48e67f){logger[_0x705c('0x58')](_0x705c('0x53'),JSON['stringify'](_0x48e67f));});};exports[_0x705c('0x59')]=function(_0x2a5a11,_0x121028,_0x2f490b,_0x3a8b2c,_0x513d7c,_0xa32651){var _0x15a88c,_0x35cebb;_0xa32651['remoteUri']=intUtil[_0x705c('0x43')](_0xa32651[_0x705c('0x1a')]);_0xa32651[_0x705c('0x42')]=intUtil['stripTrailingSlash'](_0xa32651[_0x705c('0x42')]);if(_0x513d7c&&_0x513d7c[_0x705c('0x44')]){logger[_0x705c('0x1c')]('['+_0x121028['lastevent'][_0x705c('0x5a')]()+']',_0x705c('0x54'));_0x121028['recordingURL']=util[_0x705c('0xc')](_0x705c('0x46'),_0xa32651[_0x705c('0x42')],_0x121028[_0x705c('0x55')],md5(_0x121028[_0x705c('0x55')]));}else{_0x121028[_0x705c('0x45')]='';}headers[_0x705c('0x47')]=getAuth(_0xa32651);return getUser(_0xa32651,'')[_0x705c('0x1b')](function(_0x2d4c4a){_0x15a88c=_0x2d4c4a;logger[_0x705c('0x1c')]('The\x20User\x20ID\x20is:',_0x15a88c['id']);return getEndUser(_0xa32651,_0x121028[_0x705c('0xe')],_0x121028[_0x705c('0xf')]);})[_0x705c('0x1b')](function(_0x496b98){_0x35cebb=_0x496b98;logger[_0x705c('0x1c')](_0x705c('0x4a'),_0x35cebb['id']);return getTicket(_0xa32651,_0x15a88c,_0x35cebb,_0x2f490b,_0x121028);})[_0x705c('0x1b')](function(_0x540f26){if(_0x540f26){logger[_0x705c('0x1c')](_0x705c('0x1d'));logger[_0x705c('0x1c')](_0x705c('0x4b'),_0x540f26['id']);}})[_0x705c('0x50')](function(_0x355d3a){logger[_0x705c('0x58')]('['+_0x121028[_0x705c('0x5b')][_0x705c('0x5a')]()+']',JSON[_0x705c('0x2f')](_0x355d3a));});}; \ No newline at end of file +var _0x5844=['Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','base64','debug','[HTTP]','stringify','GET','map','forEach','type','customField','toLowerCase','toString','includes','string','push','idField','variable','variableName','customVariable','Variable','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','lastevent','lodash','request-promise','md5','ioredis','./util','../../../../config/logger','freshdesk','redis','defaults','localhost','application/json','emit','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','mapValues','keyBy','custom_fields','%s/api/v2/tickets','remoteUri','POST','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','then','length','find','contact','email','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x5844,0x141));var _0x4584=function(_0x4bf0e5,_0x5e0954){_0x4bf0e5=_0x4bf0e5-0x0;var _0x16cd41=_0x5844[_0x4bf0e5];return _0x16cd41;};'use strict';var _=require(_0x4584('0x0'));var rp=require(_0x4584('0x1'));var md5=require(_0x4584('0x2'));var util=require('util');var Redis=require(_0x4584('0x3'));var intUtil=require(_0x4584('0x4'));var config=require('../../../../config/environment');var logger=require(_0x4584('0x5'))(_0x4584('0x6'));config[_0x4584('0x7')]=_[_0x4584('0x8')](config[_0x4584('0x7')],{'host':_0x4584('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4584('0x7')]));var headers={'Content-Type':'application/json','Accept':_0x4584('0xa')};function emit(_0x50f6a5,_0x119cac,_0x404f86){io['to'](_0x50f6a5)[_0x4584('0xb')](_0x119cac,_0x404f86);}function getTicket(_0x4aeba2,_0x48d513,_0x1b1183,_0x266167,_0x503f4e){logger['info'](_0x4584('0xc'));var _0x18b494=_[_0x4584('0xd')]({'responder_id':_0x48d513['id'],'requester_id':_0x1b1183['id'],'name':util[_0x4584('0xe')](_0x4584('0xf'),_0x503f4e[_0x4584('0x10')]),'phone':_0x503f4e[_0x4584('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x4584('0x12')](_0x266167[_0x4584('0x13')],_0x503f4e,'\x20'),'description':intUtil['getString'](_0x266167[_0x4584('0x14')],_0x503f4e,_0x4584('0x15')),'tags':getTags(_0x266167[_0x4584('0x16')],_0x4584('0x17'))},getCustomFields(_0x266167[_0x4584('0x18')],_0x503f4e));_0x18b494['custom_fields']=_[_0x4584('0x19')](_[_0x4584('0x1a')](_0x18b494[_0x4584('0x1b')],'id'),'value');return request({'uri':util[_0x4584('0xe')](_0x4584('0x1c'),_0x4aeba2[_0x4584('0x1d')]),'method':_0x4584('0x1e'),'body':_0x18b494})['then'](function(_0x2513db){logger[_0x4584('0x1f')](_0x4584('0x20'));return _0x2513db;});}function getUser(_0x348f7d,_0x4de179){if(intUtil[_0x4584('0x21')](_0x4de179)){return request({'uri':util[_0x4584('0xe')](_0x4584('0x22'),_0x348f7d['remoteUri']),'qs':{'email':_0x4de179}})[_0x4584('0x23')](function(_0x189ff0){if(_0x189ff0[_0x4584('0x24')]){logger[_0x4584('0x1f')]('Agent\x20found!');return _[_0x4584('0x25')](_0x189ff0,function(_0x6d89d9){return _0x6d89d9[_0x4584('0x26')][_0x4584('0x27')]===_0x4de179;});}else{logger[_0x4584('0x1f')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x4584('0x28'),_0x348f7d[_0x4584('0x1d')])})[_0x4584('0x23')](function(_0x44f8a7){logger[_0x4584('0x1f')]('Admin\x20account\x20selected.');return _0x44f8a7;});}});}else{logger['info'](_0x4584('0x29'));return request({'uri':util[_0x4584('0xe')](_0x4584('0x28'),_0x348f7d[_0x4584('0x1d')])})[_0x4584('0x23')](function(_0x5d1dbd){logger['info'](_0x4584('0x2a'));return _0x5d1dbd;});}}function getEndUser(_0x3fed48,_0x263a5d,_0x35179a){logger['info'](_0x4584('0x2b'),_0x35179a);return request({'uri':util['format'](_0x4584('0x2c'),_0x3fed48['remoteUri']),'qs':{'phone':_0x35179a}})[_0x4584('0x23')](function(_0x341b60){if(_0x341b60[_0x4584('0x24')]){logger[_0x4584('0x1f')](_0x4584('0x2d'));return _[_0x4584('0x25')](_0x341b60,{'phone':_0x35179a});}else{logger[_0x4584('0x1f')](_0x4584('0x2e'));return request({'uri':util[_0x4584('0xe')](_0x4584('0x2c'),_0x3fed48[_0x4584('0x1d')]),'method':_0x4584('0x1e'),'body':{'name':_0x263a5d,'phone':_0x35179a}})[_0x4584('0x23')](function(_0xfac315){logger[_0x4584('0x1f')]('Enduser\x20created.');return _0xfac315;});}});}function getAuth(_0x5065ce){return util['format']('Basic\x20%s',new Buffer(_0x5065ce['apiKey']+':X')['toString'](_0x4584('0x2f')));}function request(_0x3bc3f7){logger[_0x4584('0x30')](_0x4584('0x31'),JSON[_0x4584('0x32')](_0x3bc3f7));return rp(_['defaults'](_0x3bc3f7,{'method':_0x4584('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x11160d,_0x3d5ec3){var _0x141e77=[];if(_0x11160d&&_0x11160d[_0x4584('0x24')]>0x0){_0x141e77=_[_0x4584('0x34')](_0x11160d,_0x3d5ec3);}return _0x141e77;}function getCustomFields(_0x2e6bbe,_0x45da03){var _0x21c82a=[];var _0x47c05c={'custom_fields':[]};if(_0x2e6bbe[_0x4584('0x24')]>0x0){_[_0x4584('0x35')](_0x2e6bbe,function(_0x1c9f3c){if(_['includes'](['string','picklist'],_0x1c9f3c[_0x4584('0x36')])&&_0x1c9f3c['nameField']&&!_0x1c9f3c[_0x4584('0x37')]){_0x47c05c[_0x1c9f3c['nameField'][_0x4584('0x38')]()]=_0x1c9f3c['content'][_0x4584('0x39')]();}else if(_[_0x4584('0x3a')]([_0x4584('0x3b'),'picklist'],_0x1c9f3c[_0x4584('0x36')])&&_0x1c9f3c['idField']&&_0x1c9f3c[_0x4584('0x37')]){_0x47c05c[_0x4584('0x1b')][_0x4584('0x3c')]({'id':_0x1c9f3c[_0x4584('0x3d')],'value':_0x1c9f3c['content'][_0x4584('0x39')]()});}else if(_0x1c9f3c['type']===_0x4584('0x3e')&&_0x1c9f3c[_0x4584('0x3f')]&&_0x1c9f3c[_0x4584('0x3d')]&&_0x1c9f3c['customField']){_0x45da03[_0x1c9f3c[_0x4584('0x3f')]]&&_0x47c05c[_0x4584('0x1b')]['push']({'id':_0x1c9f3c[_0x4584('0x3d')],'value':_0x45da03[_0x1c9f3c[_0x4584('0x3f')]][_0x4584('0x39')]()});}else if(_0x1c9f3c[_0x4584('0x36')]===_0x4584('0x40')&&_0x1c9f3c['Variable']&&_0x1c9f3c[_0x4584('0x41')][_0x4584('0x17')]&&_0x1c9f3c[_0x4584('0x3d')]&&_0x1c9f3c[_0x4584('0x37')]){_0x45da03[_0x1c9f3c[_0x4584('0x41')][_0x4584('0x17')][_0x4584('0x38')]()]&&_0x47c05c[_0x4584('0x1b')]['push']({'id':_0x1c9f3c['idField'],'value':_0x45da03[_0x1c9f3c['Variable']['name']['toLowerCase']()][_0x4584('0x39')]()});}});}return _0x47c05c;}exports[_0x4584('0x42')]=function(_0x2b43a0,_0x54f039,_0x143887,_0x560510,_0x2e6d1b,_0x2f2309){var _0x4e5c74,_0x3525c7;_0x2f2309[_0x4584('0x1d')]=intUtil['stripTrailingSlash'](_0x2f2309[_0x4584('0x1d')]);_0x2f2309[_0x4584('0x43')]=intUtil[_0x4584('0x44')](_0x2f2309[_0x4584('0x43')]);if(_0x2e6d1b&&_0x2e6d1b[_0x4584('0x45')]){logger[_0x4584('0x1f')](_0x4584('0x46'),_0x4584('0x47'));_0x54f039[_0x4584('0x48')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2f2309['serverUrl'],_0x54f039[_0x4584('0x49')],md5(_0x54f039[_0x4584('0x49')]));}else{_0x54f039[_0x4584('0x48')]='';}headers['Authorization']=getAuth(_0x2f2309);return getUser(_0x2f2309,_0x560510[_0x4584('0x27')])[_0x4584('0x23')](function(_0x51a555){_0x4e5c74=_0x51a555;logger[_0x4584('0x1f')](_0x4584('0x4a'),_0x4e5c74['id']);return getEndUser(_0x2f2309,_0x54f039[_0x4584('0x10')],_0x54f039[_0x4584('0x11')]);})[_0x4584('0x23')](function(_0x427e43){_0x3525c7=_0x427e43;logger[_0x4584('0x1f')](_0x4584('0x4b'),_0x3525c7['id']);return getTicket(_0x2f2309,_0x4e5c74,_0x3525c7,_0x143887,_0x54f039);})['then'](function(_0x278d16){if(_0x278d16&&_0x278d16['id']){logger['info'](_0x4584('0x20'));logger['info'](_0x4584('0x4c'),_0x278d16['id']);logger[_0x4584('0x1f')](_0x4584('0x46'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x4584('0xe')](_0x4584('0x4d'),_0x560510[_0x4584('0x17')]),_0x4584('0x4e'),{'uri':util[_0x4584('0xe')](_0x4584('0x4f'),_0x2f2309[_0x4584('0x1d')],_0x278d16['id'])});}})[_0x4584('0x50')](function(_0x3dd5a9){logger[_0x4584('0x51')]('[QUEUE]',JSON[_0x4584('0x32')](_0x3dd5a9));});};exports['outbound']=function(_0x1c4882,_0x3fe4f3,_0x568490,_0x9d9a05,_0x21ca37,_0x42f763,_0x588337){var _0x4829c1,_0x25fe9f;_0x42f763['remoteUri']=intUtil[_0x4584('0x44')](_0x42f763[_0x4584('0x1d')]);_0x42f763[_0x4584('0x43')]=intUtil['stripTrailingSlash'](_0x42f763['serverUrl']);if(_0x588337&&_0x588337[_0x4584('0x52')]&&_0x588337[_0x4584('0x52')]!==_0x4584('0x53')){logger[_0x4584('0x1f')](_0x4584('0x54'),'Recording\x20is\x20enabled!');_0x3fe4f3['recordingURL']=util[_0x4584('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x42f763[_0x4584('0x43')],_0x3fe4f3[_0x4584('0x49')],md5(_0x3fe4f3[_0x4584('0x49')]));}headers[_0x4584('0x55')]=getAuth(_0x42f763);return getUser(_0x42f763,_0x9d9a05['email'])[_0x4584('0x23')](function(_0x42f9ca){_0x4829c1=_0x42f9ca;logger[_0x4584('0x1f')](_0x4584('0x4a'),_0x4829c1['id']);return getEndUser(_0x42f763,_0x3fe4f3[_0x4584('0x56')],_0x3fe4f3[_0x4584('0x57')]);})[_0x4584('0x23')](function(_0x40cb59){_0x25fe9f=_0x40cb59;logger[_0x4584('0x1f')](_0x4584('0x4b'),_0x25fe9f['id']);return getTicket(_0x42f763,_0x4829c1,_0x25fe9f,_0x568490,_0x3fe4f3);})[_0x4584('0x23')](function(_0x1cafcd){if(_0x1cafcd&&_0x1cafcd['id']){logger['info'](_0x4584('0x20'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x1cafcd['id']);logger[_0x4584('0x1f')](_0x4584('0x54'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x4584('0xe')]('user:%s',_0x9d9a05[_0x4584('0x17')]),_0x4584('0x4e'),{'uri':util[_0x4584('0xe')](_0x4584('0x4f'),_0x42f763['remoteUri'],_0x1cafcd['id'])});}})[_0x4584('0x50')](function(_0x3fa0df){logger[_0x4584('0x51')](_0x4584('0x54'),JSON[_0x4584('0x32')](_0x3fa0df));});};exports['unmanaged']=function(_0x6ceae2,_0x5f25e8,_0x181616,_0x16fc53,_0xabe1c0,_0x37c44a){var _0x7fd2d5,_0x55c600;_0x37c44a['remoteUri']=intUtil[_0x4584('0x44')](_0x37c44a[_0x4584('0x1d')]);_0x37c44a[_0x4584('0x43')]=intUtil[_0x4584('0x44')](_0x37c44a['serverUrl']);if(_0xabe1c0&&_0xabe1c0[_0x4584('0x45')]){logger['info']('['+_0x5f25e8['lastevent'][_0x4584('0x58')]()+']',_0x4584('0x47'));_0x5f25e8[_0x4584('0x48')]=util[_0x4584('0xe')](_0x4584('0x59'),_0x37c44a['serverUrl'],_0x5f25e8[_0x4584('0x49')],md5(_0x5f25e8['uniqueid']));}else{_0x5f25e8[_0x4584('0x48')]='';}headers[_0x4584('0x55')]=getAuth(_0x37c44a);return getUser(_0x37c44a,'')[_0x4584('0x23')](function(_0x275afa){_0x7fd2d5=_0x275afa;logger[_0x4584('0x1f')](_0x4584('0x4a'),_0x7fd2d5['id']);return getEndUser(_0x37c44a,_0x5f25e8[_0x4584('0x10')],_0x5f25e8[_0x4584('0x11')]);})['then'](function(_0x35e62d){_0x55c600=_0x35e62d;logger[_0x4584('0x1f')](_0x4584('0x4b'),_0x55c600['id']);return getTicket(_0x37c44a,_0x7fd2d5,_0x55c600,_0x181616,_0x5f25e8);})['then'](function(_0x319fe9){if(_0x319fe9){logger['info'](_0x4584('0x20'));logger['info'](_0x4584('0x4c'),_0x319fe9['id']);}})[_0x4584('0x50')](function(_0x506416){logger[_0x4584('0x51')]('['+_0x5f25e8[_0x4584('0x5a')][_0x4584('0x58')]()+']',JSON[_0x4584('0x32')](_0x506416));});}; \ 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 7f26505..1939e1e 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 _0xbd59=['remoteUri','serverUrl','username','toLowerCase','destcalleridnum','callDirection','queue','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','lodash','request-promise','util','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','localhost','socket.io-emitter','/api/selector/owners','headers','info','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','GET','Getting\x20user\x20list','agentEmail','userEmail','userId','User\x20found:','toUpperCase','/api/lookup?q=','&f=','&entities=contact','contacts','format','contactNumber','Contact\x20found\x20mobile_number:','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','message','Creating\x20new\x20task','/api/tasks','getString','Subjects','Contact','add','ticketId','task','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash'];(function(_0x5939ce,_0x281376){var _0xb468d7=function(_0x22e8c7){while(--_0x22e8c7){_0x5939ce['push'](_0x5939ce['shift']());}};_0xb468d7(++_0x281376);}(_0xbd59,0x65));var _0x9bd5=function(_0x4b5c23,_0x101faa){_0x4b5c23=_0x4b5c23-0x0;var _0x262cfd=_0xbd59[_0x4b5c23];return _0x262cfd;};'use strict';var _=require(_0x9bd5('0x0'));var rp=require(_0x9bd5('0x1'));var md5=require('md5');var util=require(_0x9bd5('0x2'));var moment=require('moment');var Promise=require(_0x9bd5('0x3'));var Redis=require(_0x9bd5('0x4'));var intUtil=require(_0x9bd5('0x5'));var config=require(_0x9bd5('0x6'));var logger=require(_0x9bd5('0x7'))(_0x9bd5('0x8'));config[_0x9bd5('0x9')]=_['defaults'](config[_0x9bd5('0x9')],{'host':_0x9bd5('0xa'),'port':0x18eb});var io=require(_0x9bd5('0xb'))(new Redis(config[_0x9bd5('0x9')]));function getAdminId(_0x9ace42,_0x5853ff,_0x11d6c6,_0x14506d){return new Promise(function(_0x4b0b12,_0x68ff72){var _0x16d8bd=![];var _0x3c877c={'method':'GET','uri':_0x14506d+_0x9bd5('0xc'),'json':!![]};_0x3c877c[_0x9bd5('0xd')]=_0x11d6c6;logger[_0x9bd5('0xe')]('Getting\x20admin\x20information');return rp(_0x3c877c)[_0x9bd5('0xf')](function(_0x4f665a){if(_0x4f665a){var _0x3fc672=_0x4f665a[_0x9bd5('0x10')];var _0x22d5b6=null;for(_0x22d5b6=0x0;_0x22d5b6<_0x3fc672[_0x9bd5('0x11')];_0x22d5b6++){if(_0x3fc672[_0x22d5b6][_0x9bd5('0x12')]===_0x9ace42[_0x9bd5('0x13')]){_0x9ace42[_0x9bd5('0x14')]=_0x3fc672[_0x22d5b6]['id'];_0x16d8bd=!![];}}if(_0x16d8bd){logger[_0x9bd5('0xe')](_0x9bd5('0x15'),_0x9ace42[_0x9bd5('0x14')]);_0x4b0b12(_0x9ace42);}else{_0x68ff72({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x68ff72({'statusCode':0x194,'message':_0x9bd5('0x16')});}})[_0x9bd5('0x17')](function(_0x219930){logger[_0x9bd5('0x18')]('['+[_0x5853ff['toUpperCase']()]+']',_0x219930['message']);_0x68ff72(_0x219930);});});}function getUser(_0x3c6269,_0x1bf8a1,_0x40bb07){return function(_0xee488a){return new Promise(function(_0x439e00,_0xeb02cd){var _0x21c86a={'method':_0x9bd5('0x19'),'uri':_0x40bb07+_0x9bd5('0xc'),'json':!![]};_0x21c86a[_0x9bd5('0xd')]=_0x1bf8a1;logger[_0x9bd5('0xe')](_0x9bd5('0x1a'));return rp(_0x21c86a)[_0x9bd5('0xf')](function(_0x3d75ac){if(_0x3d75ac){var _0x5069ad=_0x3d75ac[_0x9bd5('0x10')];var _0x18b43b=![];var _0x18ecd2=null;if(_0xee488a[_0x9bd5('0x1b')]!==null){logger[_0x9bd5('0xe')]('Getting\x20user\x20with\x20email',_0xee488a['agentEmail']);_0xee488a[_0x9bd5('0x1c')]=_0xee488a['agentEmail'];for(_0x18ecd2=0x0;_0x18ecd2<_0x5069ad[_0x9bd5('0x11')];_0x18ecd2++){if(_0x5069ad[_0x18ecd2][_0x9bd5('0x12')]===_0xee488a[_0x9bd5('0x1b')]){_0x18b43b=!![];_0xee488a[_0x9bd5('0x1d')]=_0x5069ad[_0x18ecd2]['id'];logger[_0x9bd5('0xe')](_0x9bd5('0x1e'),_0xee488a[_0x9bd5('0x1d')]);}}}if(!_0x18b43b){logger[_0x9bd5('0xe')]('Admin\x20selected');_0xee488a['userEmail']=_0xee488a['adminEmail'];_0xee488a[_0x9bd5('0x1d')]=_0xee488a['adminId'];_0x18b43b=!![];}if(_0x18b43b){_0x439e00(_0xee488a);}else{_0xeb02cd({'statusCode':0x194,'message':_0x9bd5('0x16')});}}else{_0xeb02cd({'statusCode':0x194,'message':_0x9bd5('0x16')});}})[_0x9bd5('0x17')](function(_0x165678){logger[_0x9bd5('0x18')]('['+[_0x3c6269[_0x9bd5('0x1f')]()]+']',_0x165678['message']);_0xeb02cd(_0x165678);});});};}function searchContact(_0x2dca2d,_0x142819,_0x1f6461,_0x2abadb){return new Promise(function(_0x501ee2,_0xc9d2da){var _0x11658e={'method':_0x9bd5('0x19'),'headers':_0x142819,'uri':_0x2dca2d+_0x9bd5('0x20')+_0x2abadb+_0x9bd5('0x21')+_0x1f6461+_0x9bd5('0x22'),'json':!![]};rp(_0x11658e)['then'](function(_0x138175){var _0xe4438b=_['find'](_0x138175['contacts'][_0x9bd5('0x23')],[_0x1f6461,_0x2abadb]);_0x501ee2(_0xe4438b);})[_0x9bd5('0x17')](function(_0x437618){_0xc9d2da(_0x437618);});});}function getEndUser(_0x15baf6,_0x48d2fc,_0x2580e2){return function(_0x239913){return new Promise(function(_0x316c0b,_0x228655){logger[_0x9bd5('0xe')](util[_0x9bd5('0x24')]('Searching\x20contact\x20with\x20phone\x20%s',_0x239913[_0x9bd5('0x25')]));searchContact(_0x2580e2,_0x48d2fc,'mobile_number',_0x239913[_0x9bd5('0x25')])[_0x9bd5('0xf')](function(_0x47d672){if(_0x47d672){_0x239913['endUserId']=_0x47d672['id'];logger[_0x9bd5('0xe')](_0x9bd5('0x26'),_0x239913[_0x9bd5('0x27')]);return _0x316c0b(_0x239913);}searchContact(_0x2580e2,_0x48d2fc,_0x9bd5('0x28'),_0x239913[_0x9bd5('0x25')])[_0x9bd5('0xf')](function(_0x4291fa){if(_0x4291fa){_0x239913[_0x9bd5('0x27')]=_0x4291fa['id'];logger[_0x9bd5('0xe')](_0x9bd5('0x29'),_0x239913[_0x9bd5('0x27')]);return _0x316c0b(_0x239913);}createEndUser(_0x239913,_0x15baf6,_0x48d2fc,_0x2580e2)['then'](function(_0x1f27d3){logger[_0x9bd5('0xe')](_0x9bd5('0x2a'),_0x1f27d3['endUserId']);return _0x316c0b(_0x1f27d3);});});})[_0x9bd5('0x17')](function(_0x1f3886){_0x228655(_0x1f3886);});});};}function createEndUser(_0x3d05bd,_0x5172b3,_0x5e29f9,_0x239b69){return new Promise(function(_0x5ddc9f,_0x5a3d1a){var _0x3a3880=moment();var _0x2cf90c={'method':_0x9bd5('0x2b'),'uri':_0x239b69+_0x9bd5('0x2c'),'body':{'contact':{'last_name':_0x3d05bd[_0x9bd5('0x25')],'work_number':_0x3d05bd[_0x9bd5('0x25')],'mobile_number':_0x3d05bd[_0x9bd5('0x25')],'owner_id':_0x3d05bd[_0x9bd5('0x1d')],'created_at':_0x3a3880['format'](_0x9bd5('0x2d'))}},'json':!![]};_0x2cf90c[_0x9bd5('0xd')]=_0x5e29f9;logger['info'](_0x9bd5('0x2e'));return rp(_0x2cf90c)['then'](function(_0x25788c){_0x3d05bd[_0x9bd5('0x27')]=_0x25788c['contact']['id'];_0x5ddc9f(_0x3d05bd);})[_0x9bd5('0x17')](function(_0x1d45a4){logger[_0x9bd5('0x18')]('['+[_0x5172b3['toUpperCase']()]+']',_0x1d45a4[_0x9bd5('0x2f')]);_0x5a3d1a(_0x1d45a4[_0x9bd5('0x2f')]);});});}function getTicket(_0x9bb554,_0x237209,_0x35d496,_0xdb1777,_0x32b2f6){return function(_0x2c96b4){logger['info'](_0x9bd5('0x30'));return new Promise(function(_0x2c36a7,_0x19797d){var _0x1b3fc3=moment();var _0x35421e={'method':_0x9bd5('0x2b'),'uri':_0x35d496+_0x9bd5('0x31'),'body':{'title':intUtil[_0x9bd5('0x32')](_0xdb1777[_0x9bd5('0x33')],_0x32b2f6,'\x20'),'description':intUtil['getString'](_0xdb1777['Descriptions'],_0x32b2f6,'\x0a'),'owner_id':_0x2c96b4['userId'],'creater_id':_0x2c96b4[_0x9bd5('0x14')],'targetable_id':_0x2c96b4[_0x9bd5('0x27')],'targetable_type':_0x9bd5('0x34'),'created_at':_0x1b3fc3[_0x9bd5('0x24')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x1b3fc3[_0x9bd5('0x35')](0x1e,'m')[_0x9bd5('0x24')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x35421e[_0x9bd5('0xd')]=_0x237209;return rp(_0x35421e)[_0x9bd5('0xf')](function(_0x1918a6){_0x2c96b4[_0x9bd5('0x36')]=_0x1918a6[_0x9bd5('0x37')]['id'];logger['info']('Task\x20created:',_0x2c96b4[_0x9bd5('0x36')]);_0x2c36a7(_0x2c96b4);})[_0x9bd5('0x17')](function(_0x432d18){logger['error']('['+[_0x9bb554[_0x9bd5('0x1f')]()]+']',_0x432d18[_0x9bd5('0x2f')]);_0x19797d(_0x432d18[_0x9bd5('0x2f')]);});});};}function emit(_0x1fb71a,_0x24668f,_0x5b1655){var _0x25a846={'uri':_0x1fb71a+_0x9bd5('0x38')+_0x5b1655};io['to'](util['format'](_0x9bd5('0x39'),_0x24668f))[_0x9bd5('0x3a')](_0x9bd5('0x3b'),_0x25a846);}exports['cs']=function(_0x51c121,_0xa41afe,_0xf94ab2,_0x250a48,_0x375779,_0x1007c4,_0x44c079,_0x310f0c){var _0x5d9675={};var _0x3d8f3a={'Authorization':_0x9bd5('0x3c')+_0x1007c4[_0x9bd5('0x3d')]};_0x1007c4['remoteUri']=intUtil[_0x9bd5('0x3e')](_0x1007c4[_0x9bd5('0x3f')]);_0x1007c4[_0x9bd5('0x40')]=intUtil[_0x9bd5('0x3e')](_0x1007c4[_0x9bd5('0x40')]);var _0x40e93d=_0x1007c4[_0x9bd5('0x3f')];_0x5d9675['adminEmail']=_0x1007c4[_0x9bd5('0x41')];_0x5d9675['contactNumber']=_0x310f0c[_0x9bd5('0x42')]()==='outbound'?_0xa41afe[_0x9bd5('0x43')]:_0xa41afe['calleridnum'];_0x5d9675[_0x9bd5('0x44')]=_0x310f0c===_0x9bd5('0x45')||_0x310f0c==='unmanaged'?_0x9bd5('0x45'):_0x9bd5('0x46');if(_0x250a48){_0x5d9675[_0x9bd5('0x1b')]=_0x250a48[_0x9bd5('0x12')];}var _0x5a2d4b=util['format'](_0x9bd5('0x47'),_0x1007c4[_0x9bd5('0x40')],_0xa41afe[_0x9bd5('0x48')],md5(_0xa41afe[_0x9bd5('0x48')]));if(_0x375779&&_0x375779['monitor_format']){logger[_0x9bd5('0xe')]('[QUEUE]',_0x9bd5('0x49'));_0xa41afe['recordingURL']=_0x5a2d4b;}else if(_0x44c079&&_0x44c079[_0x9bd5('0x4a')]&&_0x44c079['recordingFormat']!==_0x9bd5('0x4b')){logger[_0x9bd5('0xe')](_0x9bd5('0x4c'),_0x9bd5('0x49'));_0xa41afe['recordingURL']=_0x5a2d4b;}else{_0xa41afe[_0x9bd5('0x4d')]='';}return getAdminId(_0x5d9675,_0x310f0c,_0x3d8f3a,_0x40e93d)[_0x9bd5('0xf')](getUser(_0x310f0c,_0x3d8f3a,_0x40e93d))['then'](getEndUser(_0x310f0c,_0x3d8f3a,_0x40e93d))[_0x9bd5('0xf')](getTicket(_0x310f0c,_0x3d8f3a,_0x40e93d,_0xf94ab2,_0xa41afe))[_0x9bd5('0xf')](function(_0x4319d7){logger[_0x9bd5('0xe')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x4319d7[_0x9bd5('0x36')]));if(_0x310f0c!==_0x9bd5('0x4e')){logger[_0x9bd5('0xe')]('['+[_0x310f0c[_0x9bd5('0x1f')]()]+']',_0x9bd5('0x4f'));emit(_0x40e93d,_0x250a48[_0x9bd5('0x50')],_0x4319d7[_0x9bd5('0x27')]);}})['catch'](function(_0x5d797b){logger[_0x9bd5('0x18')]('['+[_0x310f0c[_0x9bd5('0x1f')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x9bd5('0x51')](_0x5d797b,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xeb02=['[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','request-promise','md5','util','moment','bluebird','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','socket.io-emitter','GET','headers','info','Getting\x20admin\x20information','then','users','length','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','/api/selector/owners','Getting\x20user\x20with\x20email','agentEmail','userEmail','email','userId','User\x20found:','catch','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','mobile_number','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','POST','contactNumber','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','ticketId','task','Task\x20created:','/contacts/','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format'];(function(_0x39ebc3,_0xb760b9){var _0x1726cf=function(_0x2a1e3f){while(--_0x2a1e3f){_0x39ebc3['push'](_0x39ebc3['shift']());}};_0x1726cf(++_0xb760b9);}(_0xeb02,0x1a9));var _0x2eb0=function(_0x739e47,_0x311adb){_0x739e47=_0x739e47-0x0;var _0x4274a6=_0xeb02[_0x739e47];return _0x4274a6;};'use strict';var _=require('lodash');var rp=require(_0x2eb0('0x0'));var md5=require(_0x2eb0('0x1'));var util=require(_0x2eb0('0x2'));var moment=require(_0x2eb0('0x3'));var Promise=require(_0x2eb0('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x2eb0('0x5'));var logger=require(_0x2eb0('0x6'))(_0x2eb0('0x7'));config[_0x2eb0('0x8')]=_[_0x2eb0('0x9')](config[_0x2eb0('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x2eb0('0xa'))(new Redis(config[_0x2eb0('0x8')]));function getAdminId(_0x4e136d,_0x2d5125,_0x22f088,_0x2e5a1c){return new Promise(function(_0x28e484,_0x58fb19){var _0x3e0226=![];var _0x5a60af={'method':_0x2eb0('0xb'),'uri':_0x2e5a1c+'/api/selector/owners','json':!![]};_0x5a60af[_0x2eb0('0xc')]=_0x22f088;logger[_0x2eb0('0xd')](_0x2eb0('0xe'));return rp(_0x5a60af)[_0x2eb0('0xf')](function(_0x300114){if(_0x300114){var _0x364932=_0x300114[_0x2eb0('0x10')];var _0x5302fb=null;for(_0x5302fb=0x0;_0x5302fb<_0x364932[_0x2eb0('0x11')];_0x5302fb++){if(_0x364932[_0x5302fb]['email']===_0x4e136d['adminEmail']){_0x4e136d[_0x2eb0('0x12')]=_0x364932[_0x5302fb]['id'];_0x3e0226=!![];}}if(_0x3e0226){logger[_0x2eb0('0xd')](_0x2eb0('0x13'),_0x4e136d[_0x2eb0('0x12')]);_0x28e484(_0x4e136d);}else{_0x58fb19({'statusCode':0x194,'message':_0x2eb0('0x14')});}}else{_0x58fb19({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x4133ee){logger[_0x2eb0('0x15')]('['+[_0x2d5125[_0x2eb0('0x16')]()]+']',_0x4133ee[_0x2eb0('0x17')]);_0x58fb19(_0x4133ee);});});}function getUser(_0x1a33e6,_0x243f6e,_0x4196e3){return function(_0x433cf0){return new Promise(function(_0x2bd9a0,_0x97214b){var _0x2aad35={'method':_0x2eb0('0xb'),'uri':_0x4196e3+_0x2eb0('0x18'),'json':!![]};_0x2aad35[_0x2eb0('0xc')]=_0x243f6e;logger['info']('Getting\x20user\x20list');return rp(_0x2aad35)[_0x2eb0('0xf')](function(_0x4322bc){if(_0x4322bc){var _0x1b3964=_0x4322bc['users'];var _0x3b406d=![];var _0x38d7d3=null;if(_0x433cf0['agentEmail']!==null){logger['info'](_0x2eb0('0x19'),_0x433cf0[_0x2eb0('0x1a')]);_0x433cf0[_0x2eb0('0x1b')]=_0x433cf0['agentEmail'];for(_0x38d7d3=0x0;_0x38d7d3<_0x1b3964[_0x2eb0('0x11')];_0x38d7d3++){if(_0x1b3964[_0x38d7d3][_0x2eb0('0x1c')]===_0x433cf0[_0x2eb0('0x1a')]){_0x3b406d=!![];_0x433cf0[_0x2eb0('0x1d')]=_0x1b3964[_0x38d7d3]['id'];logger['info'](_0x2eb0('0x1e'),_0x433cf0[_0x2eb0('0x1d')]);}}}if(!_0x3b406d){logger[_0x2eb0('0xd')]('Admin\x20selected');_0x433cf0['userEmail']=_0x433cf0['adminEmail'];_0x433cf0['userId']=_0x433cf0[_0x2eb0('0x12')];_0x3b406d=!![];}if(_0x3b406d){_0x2bd9a0(_0x433cf0);}else{_0x97214b({'statusCode':0x194,'message':_0x2eb0('0x14')});}}else{_0x97214b({'statusCode':0x194,'message':_0x2eb0('0x14')});}})[_0x2eb0('0x1f')](function(_0x4e786f){logger[_0x2eb0('0x15')]('['+[_0x1a33e6[_0x2eb0('0x16')]()]+']',_0x4e786f['message']);_0x97214b(_0x4e786f);});});};}function searchContact(_0x1047ac,_0x12a773,_0x4b361b,_0x3eb99f){return new Promise(function(_0x3b9dd5,_0x301762){var _0x369a8d={'method':_0x2eb0('0xb'),'headers':_0x12a773,'uri':_0x1047ac+_0x2eb0('0x20')+_0x3eb99f+_0x2eb0('0x21')+_0x4b361b+_0x2eb0('0x22'),'json':!![]};rp(_0x369a8d)['then'](function(_0x52a74c){var _0x2a4590=_[_0x2eb0('0x23')](_0x52a74c[_0x2eb0('0x24')]['contacts'],[_0x4b361b,_0x3eb99f]);_0x3b9dd5(_0x2a4590);})['catch'](function(_0x28bf20){_0x301762(_0x28bf20);});});}function getEndUser(_0x29fa81,_0x505f9c,_0x5537ab){return function(_0x389a40){return new Promise(function(_0xa6af9d,_0x19e3cd){logger[_0x2eb0('0xd')](util[_0x2eb0('0x25')]('Searching\x20contact\x20with\x20phone\x20%s',_0x389a40['contactNumber']));searchContact(_0x5537ab,_0x505f9c,_0x2eb0('0x26'),_0x389a40['contactNumber'])[_0x2eb0('0xf')](function(_0x366e5b){if(_0x366e5b){_0x389a40[_0x2eb0('0x27')]=_0x366e5b['id'];logger[_0x2eb0('0xd')](_0x2eb0('0x28'),_0x389a40[_0x2eb0('0x27')]);return _0xa6af9d(_0x389a40);}searchContact(_0x5537ab,_0x505f9c,'work_number',_0x389a40['contactNumber'])[_0x2eb0('0xf')](function(_0x5e914b){if(_0x5e914b){_0x389a40['endUserId']=_0x5e914b['id'];logger[_0x2eb0('0xd')](_0x2eb0('0x29'),_0x389a40[_0x2eb0('0x27')]);return _0xa6af9d(_0x389a40);}createEndUser(_0x389a40,_0x29fa81,_0x505f9c,_0x5537ab)['then'](function(_0x29834b){logger[_0x2eb0('0xd')](_0x2eb0('0x2a'),_0x29834b['endUserId']);return _0xa6af9d(_0x29834b);});});})[_0x2eb0('0x1f')](function(_0xd7a3fd){_0x19e3cd(_0xd7a3fd);});});};}function createEndUser(_0x2f7710,_0x4aafd1,_0x1e2842,_0x49aea3){return new Promise(function(_0x4879f5,_0x4644d7){var _0x55949d=moment();var _0xcab4af={'method':_0x2eb0('0x2b'),'uri':_0x49aea3+'/api/contacts','body':{'contact':{'last_name':_0x2f7710['contactNumber'],'work_number':_0x2f7710[_0x2eb0('0x2c')],'mobile_number':_0x2f7710['contactNumber'],'owner_id':_0x2f7710[_0x2eb0('0x1d')],'created_at':_0x55949d[_0x2eb0('0x25')](_0x2eb0('0x2d'))}},'json':!![]};_0xcab4af['headers']=_0x1e2842;logger[_0x2eb0('0xd')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0xcab4af)[_0x2eb0('0xf')](function(_0x41125a){_0x2f7710[_0x2eb0('0x27')]=_0x41125a[_0x2eb0('0x2e')]['id'];_0x4879f5(_0x2f7710);})[_0x2eb0('0x1f')](function(_0x2c1468){logger[_0x2eb0('0x15')]('['+[_0x4aafd1[_0x2eb0('0x16')]()]+']',_0x2c1468[_0x2eb0('0x17')]);_0x4644d7(_0x2c1468['message']);});});}function getTicket(_0x4096a3,_0x312567,_0x3d4a8c,_0x37c171,_0x20db99){return function(_0x4e25da){logger[_0x2eb0('0xd')](_0x2eb0('0x2f'));return new Promise(function(_0x406071,_0x5455c6){var _0x455613=moment();var _0x5b10bc={'method':_0x2eb0('0x2b'),'uri':_0x3d4a8c+_0x2eb0('0x30'),'body':{'title':intUtil['getString'](_0x37c171['Subjects'],_0x20db99,'\x20'),'description':intUtil[_0x2eb0('0x31')](_0x37c171[_0x2eb0('0x32')],_0x20db99,'\x0a'),'owner_id':_0x4e25da[_0x2eb0('0x1d')],'creater_id':_0x4e25da['adminId'],'targetable_id':_0x4e25da['endUserId'],'targetable_type':_0x2eb0('0x33'),'created_at':_0x455613[_0x2eb0('0x25')](_0x2eb0('0x2d')),'due_date':_0x455613['add'](0x1e,'m')[_0x2eb0('0x25')](_0x2eb0('0x2d'))},'json':!![]};_0x5b10bc[_0x2eb0('0xc')]=_0x312567;return rp(_0x5b10bc)['then'](function(_0x2f0471){_0x4e25da[_0x2eb0('0x34')]=_0x2f0471[_0x2eb0('0x35')]['id'];logger[_0x2eb0('0xd')](_0x2eb0('0x36'),_0x4e25da[_0x2eb0('0x34')]);_0x406071(_0x4e25da);})[_0x2eb0('0x1f')](function(_0x2729ea){logger['error']('['+[_0x4096a3[_0x2eb0('0x16')]()]+']',_0x2729ea[_0x2eb0('0x17')]);_0x5455c6(_0x2729ea[_0x2eb0('0x17')]);});});};}function emit(_0x53ab3f,_0x38b639,_0x51a517){var _0x51a4f2={'uri':_0x53ab3f+_0x2eb0('0x37')+_0x51a517};io['to'](util[_0x2eb0('0x25')]('user:%s',_0x38b639))[_0x2eb0('0x38')](_0x2eb0('0x39'),_0x51a4f2);}exports['cs']=function(_0x2e38a1,_0x775d7e,_0x28a35c,_0x3f212e,_0x2097d1,_0x257412,_0x3cba16,_0x4232f1){var _0xdb1b10={};var _0x42e0ac={'Authorization':_0x2eb0('0x3a')+_0x257412[_0x2eb0('0x3b')]};_0x257412[_0x2eb0('0x3c')]=intUtil[_0x2eb0('0x3d')](_0x257412['remoteUri']);_0x257412[_0x2eb0('0x3e')]=intUtil['stripTrailingSlash'](_0x257412[_0x2eb0('0x3e')]);var _0x525a42=_0x257412['remoteUri'];_0xdb1b10['adminEmail']=_0x257412[_0x2eb0('0x3f')];_0xdb1b10[_0x2eb0('0x2c')]=_0x4232f1[_0x2eb0('0x40')]()===_0x2eb0('0x41')?_0x775d7e[_0x2eb0('0x42')]:_0x775d7e[_0x2eb0('0x43')];_0xdb1b10[_0x2eb0('0x44')]=_0x4232f1===_0x2eb0('0x45')||_0x4232f1==='unmanaged'?_0x2eb0('0x45'):'outbound';if(_0x3f212e){_0xdb1b10[_0x2eb0('0x1a')]=_0x3f212e[_0x2eb0('0x1c')];}var _0x1c8a33=util['format'](_0x2eb0('0x46'),_0x257412[_0x2eb0('0x3e')],_0x775d7e[_0x2eb0('0x47')],md5(_0x775d7e[_0x2eb0('0x47')]));if(_0x2097d1&&_0x2097d1[_0x2eb0('0x48')]){logger[_0x2eb0('0xd')](_0x2eb0('0x49'),'Recording\x20is\x20enabled!');_0x775d7e[_0x2eb0('0x4a')]=_0x1c8a33;}else if(_0x3cba16&&_0x3cba16[_0x2eb0('0x4b')]&&_0x3cba16[_0x2eb0('0x4b')]!==_0x2eb0('0x4c')){logger['info'](_0x2eb0('0x4d'),_0x2eb0('0x4e'));_0x775d7e['recordingURL']=_0x1c8a33;}else{_0x775d7e[_0x2eb0('0x4a')]='';}return getAdminId(_0xdb1b10,_0x4232f1,_0x42e0ac,_0x525a42)[_0x2eb0('0xf')](getUser(_0x4232f1,_0x42e0ac,_0x525a42))[_0x2eb0('0xf')](getEndUser(_0x4232f1,_0x42e0ac,_0x525a42))[_0x2eb0('0xf')](getTicket(_0x4232f1,_0x42e0ac,_0x525a42,_0x28a35c,_0x775d7e))['then'](function(_0x46d442){logger[_0x2eb0('0xd')](util['format'](_0x2eb0('0x4f'),_0x46d442[_0x2eb0('0x34')]));if(_0x4232f1!==_0x2eb0('0x50')){logger['info']('['+[_0x4232f1['toUpperCase']()]+']',_0x2eb0('0x51'));emit(_0x525a42,_0x3f212e[_0x2eb0('0x52')],_0x46d442[_0x2eb0('0x27')]);}})[_0x2eb0('0x1f')](function(_0xcbb7a3){logger[_0x2eb0('0x15')]('['+[_0x4232f1[_0x2eb0('0x16')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util['inspect'](_0xcbb7a3,{'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 9743deb..c43a7b1 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 _0x2ffc=['./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','outbound','log','EVENT\x20UNKNOWN','unmanaged','unknown\x20integration','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','error','format','%s\x20account\x20#%s\x20not\x20found','./salesforce','./freshdesk','./zoho','./desk','./vtiger','./servicenow'];(function(_0x24b61d,_0x223497){var _0x42d09e=function(_0x39087a){while(--_0x39087a){_0x24b61d['push'](_0x24b61d['shift']());}};_0x42d09e(++_0x223497);}(_0x2ffc,0x1aa));var _0xc2ff=function(_0x337c3e,_0x2bbeda){_0x337c3e=_0x337c3e-0x0;var _0x1d9b92=_0x2ffc[_0x337c3e];return _0x1d9b92;};'use strict';var _=require('lodash');var util=require('util');var zendesk=require('./zendesk');var salesforce=require(_0xc2ff('0x0'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0xc2ff('0x1'));var zoho=require(_0xc2ff('0x2'));var desk=require(_0xc2ff('0x3'));var vtiger=require(_0xc2ff('0x4'));var servicenow=require(_0xc2ff('0x5'));var dynamics365=require('./dynamics365');var freshsales=require(_0xc2ff('0x6'));var integrations=[_0xc2ff('0x7'),_0xc2ff('0x8'),_0xc2ff('0x9'),_0xc2ff('0xa'),_0xc2ff('0xb'),_0xc2ff('0xc'),_0xc2ff('0xd'),_0xc2ff('0xe'),_0xc2ff('0xf'),_0xc2ff('0x10')];exports[_0xc2ff('0x11')]=function(_0x2fb005,_0x5bd461,_0x115b4e,_0x4e6409,_0x50ab56,_0x32d777){if(_0x115b4e){if(_[_0xc2ff('0x12')](integrations,_0x2fb005[_0xc2ff('0x13')][_0xc2ff('0x14')]())){try{var _0x124320=null;var _0x21d1ba='';var _0x5e422e=_0x115b4e[_0x2fb005['data1'][_0xc2ff('0x14')]()];if(_0x5e422e){var _0x205236=_0x5e422e[_0x2fb005[_0xc2ff('0x15')]];if(_0x205236){var _0x42d498=_[_0xc2ff('0x16')](_0x205236[_0xc2ff('0x17')],{'id':parseInt(_0x2fb005[_0xc2ff('0x18')],0xa)});if(_0x42d498){if(_0x4e6409){if(_0x50ab56&&_0x5bd461[_0xc2ff('0x19')]){_0x21d1ba=_0xc2ff('0x19');}else if(_0x5bd461['routeId']){_0x21d1ba=_0xc2ff('0x1a');}else{console[_0xc2ff('0x1b')](_0xc2ff('0x1c'),_0x5bd461);}}else{_0x21d1ba=_0xc2ff('0x1d');}switch(_0x2fb005[_0xc2ff('0x13')][_0xc2ff('0x14')]()){case'zendesk':zendesk[_0x21d1ba](_0x2fb005,_0x5bd461,_0x42d498,_0x4e6409,_0x50ab56,_0x205236,_0x32d777);break;case'salesforce':salesforce[_0x21d1ba](_0x2fb005,_0x5bd461,_0x42d498,_0x4e6409,_0x50ab56,_0x205236,_0x32d777);break;case'sugarcrm':sugarcrm[_0x21d1ba](_0x2fb005,_0x5bd461,_0x42d498,_0x4e6409,_0x50ab56,_0x205236,_0x32d777);break;case'freshdesk':freshdesk[_0x21d1ba](_0x2fb005,_0x5bd461,_0x42d498,_0x4e6409,_0x50ab56,_0x205236,_0x32d777);break;case _0xc2ff('0xb'):zoho[_0x21d1ba](_0x2fb005,_0x5bd461,_0x42d498,_0x4e6409,_0x50ab56,_0x205236,_0x32d777);break;case _0xc2ff('0xc'):desk[_0x21d1ba](_0x2fb005,_0x5bd461,_0x42d498,_0x4e6409,_0x50ab56,_0x205236,_0x32d777);break;case'vtiger':vtiger[_0x21d1ba](_0x2fb005,_0x5bd461,_0x42d498,_0x4e6409,_0x50ab56,_0x205236,_0x32d777);break;case _0xc2ff('0xf'):freshsales['cs'](_0x2fb005,_0x5bd461,_0x42d498,_0x4e6409,_0x50ab56,_0x205236,_0x32d777,_0x21d1ba);break;case _0xc2ff('0x10'):servicenow['cs'](_0x2fb005,_0x5bd461,_0x42d498,_0x4e6409,_0x50ab56,_0x205236,_0x32d777,_0x21d1ba);break;case _0xc2ff('0xe'):dynamics365['cs'](_0x2fb005,_0x5bd461,_0x42d498,_0x4e6409,_0x50ab56,_0x205236,_0x32d777,_0x21d1ba);break;default:console[_0xc2ff('0x1b')](_0xc2ff('0x1e'));}}else{_0x124320=require('../../../../config/logger')(_0x2fb005['data1'][_0xc2ff('0x14')]());_0x124320['error'](_0xc2ff('0x1f'),util['format'](_0xc2ff('0x20'),_0x2fb005[_0xc2ff('0x13')][_0xc2ff('0x14')](),_0x2fb005[_0xc2ff('0x18')]));}}else{_0x124320=require('../../../../config/logger')(_0x2fb005[_0xc2ff('0x13')][_0xc2ff('0x14')]());_0x124320[_0xc2ff('0x21')](_0xc2ff('0x1f'),util[_0xc2ff('0x22')](_0xc2ff('0x23'),_0x2fb005[_0xc2ff('0x13')][_0xc2ff('0x14')](),_0x2fb005['data2']));}}else{}}catch(_0x40b11d){console[_0xc2ff('0x21')](_0x40b11d);}}}}; \ No newline at end of file +var _0x7eb1=['./salesforce','./freshdesk','./desk','./vtiger','./servicenow','./dynamics365','zendesk','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','servicenow','exec','includes','data1','toLowerCase','data2','Configurations','data3','queue','outbound','log','EVENT\x20UNKNOWN','unmanaged','salesforce','freshsales','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','lodash','util','./zendesk'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7eb1,0xb1));var _0x17eb=function(_0x12742e,_0x43f6fa){_0x12742e=_0x12742e-0x0;var _0x173452=_0x7eb1[_0x12742e];return _0x173452;};'use strict';var _=require(_0x17eb('0x0'));var util=require(_0x17eb('0x1'));var zendesk=require(_0x17eb('0x2'));var salesforce=require(_0x17eb('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x17eb('0x4'));var zoho=require('./zoho');var desk=require(_0x17eb('0x5'));var vtiger=require(_0x17eb('0x6'));var servicenow=require(_0x17eb('0x7'));var dynamics365=require(_0x17eb('0x8'));var freshsales=require('./freshsales');var integrations=[_0x17eb('0x9'),'salesforce',_0x17eb('0xa'),_0x17eb('0xb'),_0x17eb('0xc'),_0x17eb('0xd'),_0x17eb('0xe'),_0x17eb('0xf'),'freshsales',_0x17eb('0x10')];exports[_0x17eb('0x11')]=function(_0x1972a5,_0x4bf531,_0x29e09e,_0x2ace8d,_0x5a635d,_0x5135b7){if(_0x29e09e){if(_[_0x17eb('0x12')](integrations,_0x1972a5[_0x17eb('0x13')][_0x17eb('0x14')]())){try{var _0x253265=null;var _0x4d357a='';var _0xeaa92=_0x29e09e[_0x1972a5[_0x17eb('0x13')]['toLowerCase']()];if(_0xeaa92){var _0x413645=_0xeaa92[_0x1972a5[_0x17eb('0x15')]];if(_0x413645){var _0x533675=_['find'](_0x413645[_0x17eb('0x16')],{'id':parseInt(_0x1972a5[_0x17eb('0x17')],0xa)});if(_0x533675){if(_0x2ace8d){if(_0x5a635d&&_0x4bf531[_0x17eb('0x18')]){_0x4d357a=_0x17eb('0x18');}else if(_0x4bf531['routeId']){_0x4d357a=_0x17eb('0x19');}else{console[_0x17eb('0x1a')](_0x17eb('0x1b'),_0x4bf531);}}else{_0x4d357a=_0x17eb('0x1c');}switch(_0x1972a5[_0x17eb('0x13')][_0x17eb('0x14')]()){case _0x17eb('0x9'):zendesk[_0x4d357a](_0x1972a5,_0x4bf531,_0x533675,_0x2ace8d,_0x5a635d,_0x413645,_0x5135b7);break;case _0x17eb('0x1d'):salesforce[_0x4d357a](_0x1972a5,_0x4bf531,_0x533675,_0x2ace8d,_0x5a635d,_0x413645,_0x5135b7);break;case _0x17eb('0xa'):sugarcrm[_0x4d357a](_0x1972a5,_0x4bf531,_0x533675,_0x2ace8d,_0x5a635d,_0x413645,_0x5135b7);break;case _0x17eb('0xb'):freshdesk[_0x4d357a](_0x1972a5,_0x4bf531,_0x533675,_0x2ace8d,_0x5a635d,_0x413645,_0x5135b7);break;case _0x17eb('0xc'):zoho[_0x4d357a](_0x1972a5,_0x4bf531,_0x533675,_0x2ace8d,_0x5a635d,_0x413645,_0x5135b7);break;case _0x17eb('0xd'):desk[_0x4d357a](_0x1972a5,_0x4bf531,_0x533675,_0x2ace8d,_0x5a635d,_0x413645,_0x5135b7);break;case _0x17eb('0xe'):vtiger[_0x4d357a](_0x1972a5,_0x4bf531,_0x533675,_0x2ace8d,_0x5a635d,_0x413645,_0x5135b7);break;case _0x17eb('0x1e'):freshsales['cs'](_0x1972a5,_0x4bf531,_0x533675,_0x2ace8d,_0x5a635d,_0x413645,_0x5135b7,_0x4d357a);break;case _0x17eb('0x10'):servicenow['cs'](_0x1972a5,_0x4bf531,_0x533675,_0x2ace8d,_0x5a635d,_0x413645,_0x5135b7,_0x4d357a);break;case'dynamics365':dynamics365['cs'](_0x1972a5,_0x4bf531,_0x533675,_0x2ace8d,_0x5a635d,_0x413645,_0x5135b7,_0x4d357a);break;default:console[_0x17eb('0x1a')](_0x17eb('0x1f'));}}else{_0x253265=require(_0x17eb('0x20'))(_0x1972a5[_0x17eb('0x13')][_0x17eb('0x14')]());_0x253265[_0x17eb('0x21')](_0x17eb('0x22'),util[_0x17eb('0x23')]('%s\x20configuration\x20#%s\x20not\x20found',_0x1972a5[_0x17eb('0x13')]['toLowerCase'](),_0x1972a5[_0x17eb('0x17')]));}}else{_0x253265=require(_0x17eb('0x20'))(_0x1972a5[_0x17eb('0x13')][_0x17eb('0x14')]());_0x253265['error'](_0x17eb('0x22'),util[_0x17eb('0x23')]('%s\x20account\x20#%s\x20not\x20found',_0x1972a5['data1'][_0x17eb('0x14')](),_0x1972a5['data2']));}}else{}}catch(_0x401fb3){console['error'](_0x401fb3);}}}}; \ 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 39a3885..ddf6cff 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 _0xf06c=['customVariable','Variable','name','toLowerCase','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','none','[OUTBOUND]','email','destcalleridname','Fields','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','toUpperCase',']\x20Ticket\x20%s\x20created.','lastevent','lodash','request-promise','moment','md5','jsforce','util','ioredis','./util','../../../../config/environment','socket.io-emitter','assign','getString','Subjects','Descriptions','ticketType','utc','IsReminderSet','IsRecurrence','endUserType','WhoId','account','ContactId','AccountId','lead','leadId','sobject','create','isNil','validateEmail','User','then','length','Email','info','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','merge','find','execute','cloneDeep','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','$or','Contact','contact','first','Name','Phone','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','LastName','','format','Caller\x20-\x20%s','moduleCreate','No\x20Company','upperFirst','forEach','string','type','idField','content','toString','variable','variableName'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xf06c,0x199));var _0xcf06=function(_0x33583d,_0x45b9ac){_0x33583d=_0x33583d-0x0;var _0x448ba1=_0xf06c[_0x33583d];return _0x448ba1;};'use strict';var _=require(_0xcf06('0x0'));var rp=require(_0xcf06('0x1'));var moment=require(_0xcf06('0x2'));var BPromise=require('bluebird');var md5=require(_0xcf06('0x3'));var jsforce=require(_0xcf06('0x4'));var util=require(_0xcf06('0x5'));var Redis=require(_0xcf06('0x6'));var intUtil=require(_0xcf06('0x7'));var config=require(_0xcf06('0x8'));var logger=require('../../../../config/logger')('salesforce');config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xcf06('0x9'))(new Redis(config['redis']));function emit(_0xfb4a8d,_0x547fb5,_0x5e71db){io['to'](_0xfb4a8d)['emit'](_0x547fb5,_0x5e71db);}function getTicket(_0x34e5cb,_0x4ed681,_0x29fc87,_0x53876a,_0x4b980e,_0x4e9bad,_0x199147,_0x77b878){var _0x5e66bd=Object[_0xcf06('0xa')]({},{'OwnerId':_0x4ed681['id'],'Subject':intUtil[_0xcf06('0xb')](_0x53876a[_0xcf06('0xc')],_0x4b980e,'\x20'),'Description':intUtil[_0xcf06('0xb')](_0x53876a[_0xcf06('0xd')],_0x4b980e,'\x0a')},getCustomFields(_0x4e9bad,_0x4b980e));if(_0x29fc87){if(_0x53876a[_0xcf06('0xe')]==='Task'){_0x5e66bd['ActivityDate']=moment[_0xcf06('0xf')]();_0x5e66bd[_0xcf06('0x10')]=![];_0x5e66bd[_0xcf06('0x11')]=![];if(_0x29fc87['endUserType']==='contact'||_0x29fc87[_0xcf06('0x12')]==='lead'){_0x5e66bd[_0xcf06('0x13')]=_0x29fc87['id'];}else if(_0x29fc87[_0xcf06('0x12')]===_0xcf06('0x14')){_0x5e66bd['WhatId']=_0x29fc87['id'];}}else if(_0x53876a['ticketType']==='Case'){if(_0x29fc87[_0xcf06('0x12')]==='contact'){_0x5e66bd[_0xcf06('0x15')]=_0x29fc87['id'];}else if(_0x29fc87[_0xcf06('0x12')]===_0xcf06('0x14')){_0x5e66bd[_0xcf06('0x16')]=_0x29fc87['id'];}else if(_0x29fc87[_0xcf06('0x12')]===_0xcf06('0x17')&&_0x53876a[_0xcf06('0x18')]){_0x5e66bd[_0x53876a['leadId']]=_0x29fc87['id'];}else{logger['info']('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x199147[_0xcf06('0x19')](_0x53876a[_0xcf06('0xe')])[_0xcf06('0x1a')](_0x5e66bd);}function getUser(_0x5eef00,_0x4db172,_0x46c1b9){if(!_[_0xcf06('0x1b')](_0x4db172)&&intUtil[_0xcf06('0x1c')](_0x4db172)){var _0x5d2719={'Email':_0x4db172};var _0x1abfab={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x46c1b9[_0xcf06('0x19')](_0xcf06('0x1d'))['find'](_0x5d2719,_0x1abfab)['execute']()[_0xcf06('0x1e')](function(_0x1b7d0f){if(_0x1b7d0f[_0xcf06('0x1f')]){var _0xff6542=_['find'](_0x1b7d0f,function(_0x589db1){return _0x589db1[_0xcf06('0x20')]===_0x4db172;});if(_0xff6542){logger[_0xcf06('0x21')](_0xcf06('0x22'),_0x4db172);return BPromise[_0xcf06('0x23')]({'id':_0xff6542['Id'],'name':_0xff6542['Name']});}}else{logger[_0xcf06('0x21')](_0xcf06('0x24'),_0x4db172);return _0x46c1b9[_0xcf06('0x25')]()[_0xcf06('0x1e')](function(_0x58fcbd){return BPromise[_0xcf06('0x23')]({'id':_0x58fcbd[_0xcf06('0x26')],'name':_0x58fcbd[_0xcf06('0x27')]});});}});}else{logger[_0xcf06('0x21')](_0xcf06('0x24'),_0x4db172);return _0x46c1b9['identity']()['then'](function(_0x58f4b6){return BPromise[_0xcf06('0x23')]({'id':_0x58f4b6[_0xcf06('0x26')],'name':_0x58f4b6['display_name']});});}}function getEndUser(_0x4c4426,_0x56c54c,_0x20f862,_0xbf85ed,_0x35d460){var _0x1f3104={'$or':{'Phone':_0xbf85ed}};var _0x1ac9bb={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xcf06('0x1e')](function(){logger['info'](_0xcf06('0x28'),_0xbf85ed,_0x56c54c[_0xcf06('0x29')]);switch(_0x56c54c[_0xcf06('0x29')]){case _0xcf06('0x2a'):var _0x334f6e=_['cloneDeep'](_0x1f3104);if(_0x56c54c[_0xcf06('0x2b')]){var _0x129a8e={};_0x129a8e[_0x56c54c[_0xcf06('0x2b')]]=_0xbf85ed;_[_0xcf06('0x2c')](_0x334f6e['$or'],_0x129a8e);}return _0x35d460[_0xcf06('0x19')]('Contact')[_0xcf06('0x2d')](_0x334f6e,_0x1ac9bb)[_0xcf06('0x2e')]()['then'](function(_0x3dc1f0){if(_0x3dc1f0&&_0x3dc1f0[_0xcf06('0x1f')]){return _0x3dc1f0;}else{var _0x56a35c=_[_0xcf06('0x2f')](_0x1f3104);if(_0x56c54c[_0xcf06('0x30')]){var _0x4348bd={};_0x4348bd[_0x56c54c[_0xcf06('0x30')]]=_0xbf85ed;_[_0xcf06('0x2c')](_0x56a35c['$or'],_0x4348bd);}return _0x35d460[_0xcf06('0x19')](_0xcf06('0x31'))[_0xcf06('0x2d')](_0x56a35c,_0x1ac9bb);}});case _0xcf06('0x32'):var _0x182911=_[_0xcf06('0x2f')](_0x1f3104);if(_0x56c54c[_0xcf06('0x33')]){var _0x129a8e={};_0x129a8e[_0x56c54c[_0xcf06('0x33')]]=_0xbf85ed;_[_0xcf06('0x2c')](_0x182911['$or'],_0x129a8e);}return _0x35d460[_0xcf06('0x19')](_0xcf06('0x34'))[_0xcf06('0x2d')](_0x182911,_0x1ac9bb)[_0xcf06('0x2e')]()[_0xcf06('0x1e')](function(_0x203d6a){if(_0x203d6a&&_0x203d6a[_0xcf06('0x1f')]){return _0x203d6a;}else{var _0x2fcac9=_['cloneDeep'](_0x1f3104);if(_0x56c54c[_0xcf06('0x2b')]){var _0x1a64e0={};_0x1a64e0[_0x56c54c['additionalSearchContact']]=_0xbf85ed;_['merge'](_0x2fcac9[_0xcf06('0x35')],_0x1a64e0);}return _0x35d460[_0xcf06('0x19')](_0xcf06('0x36'))[_0xcf06('0x2d')](_0x2fcac9,_0x1ac9bb)[_0xcf06('0x1e')](function(_0x4bea57){if(_0x4bea57&&_0x4bea57[_0xcf06('0x1f')]){return _0x4bea57;}else{var _0x2f3658=_[_0xcf06('0x2f')](_0x1f3104);if(_0x56c54c[_0xcf06('0x30')]){var _0x4c1b76={};_0x4c1b76[_0x56c54c['additionalSearchLead']]=_0xbf85ed;_[_0xcf06('0x2c')](_0x2f3658['$or'],_0x4c1b76);}return _0x35d460[_0xcf06('0x19')](_0xcf06('0x31'))[_0xcf06('0x2d')](_0x2f3658,_0x1ac9bb);}});}});case _0xcf06('0x37'):var _0x334f6e=_['cloneDeep'](_0x1f3104);if(_0x56c54c[_0xcf06('0x2b')]){var _0x129a8e={};_0x129a8e[_0x56c54c[_0xcf06('0x2b')]]=_0xbf85ed;_[_0xcf06('0x2c')](_0x334f6e[_0xcf06('0x35')],_0x129a8e);}return _0x35d460['sobject'](_0xcf06('0x36'))[_0xcf06('0x2d')](_0x334f6e,_0x1ac9bb)[_0xcf06('0x2e')]();case _0xcf06('0x17'):var _0x576eae=_['cloneDeep'](_0x1f3104);if(_0x56c54c[_0xcf06('0x30')]){var _0x129a8e={};_0x129a8e[_0x56c54c['additionalSearchLead']]=_0xbf85ed;_[_0xcf06('0x2c')](_0x576eae[_0xcf06('0x35')],_0x129a8e);}return _0x35d460[_0xcf06('0x19')](_0xcf06('0x31'))[_0xcf06('0x2d')](_0x576eae,_0x1ac9bb);case _0xcf06('0x14'):var _0x182911=_[_0xcf06('0x2f')](_0x1f3104);if(_0x56c54c[_0xcf06('0x33')]){var _0x129a8e={};_0x129a8e[_0x56c54c[_0xcf06('0x33')]]=_0xbf85ed;_[_0xcf06('0x2c')](_0x182911[_0xcf06('0x35')],_0x129a8e);}return _0x35d460[_0xcf06('0x19')]('Account')[_0xcf06('0x2d')](_0x182911,_0x1ac9bb);default:return null;}})[_0xcf06('0x1e')](function(_0x50a877){if(_0x50a877&&_0x50a877[_0xcf06('0x1f')]){var _0x370579=_[_0xcf06('0x38')](_0x50a877);if(_0x370579){return BPromise[_0xcf06('0x23')]({'id':_0x370579['Id'],'name':_0x370579[_0xcf06('0x39')],'phone':_0x370579[_0xcf06('0x3a')],'endUserType':_0x370579['attributes']['type']['toLowerCase']()});}}})[_0xcf06('0x1e')](function(_0x330527){if(_0x330527){logger[_0xcf06('0x21')](_0xcf06('0x3b'),_0x330527[_0xcf06('0x12')],_0xbf85ed);return BPromise[_0xcf06('0x23')](_0x330527);}else{logger[_0xcf06('0x21')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0xbf85ed);var _0x392381={'Phone':_0xbf85ed};if(_0x56c54c['moduleCreate']){if(_0x56c54c['moduleCreate']===_0xcf06('0x37')){logger[_0xcf06('0x21')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0xbf85ed,_0x56c54c['moduleCreate']);_0x392381[_0xcf06('0x3c')]=_0x20f862!==_0xcf06('0x3d')?_0x20f862:util[_0xcf06('0x3e')](_0xcf06('0x3f'),_0xbf85ed);}else if(_0x56c54c[_0xcf06('0x40')]===_0xcf06('0x17')){logger[_0xcf06('0x21')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0xbf85ed,_0x56c54c['moduleCreate']);_0x392381[_0xcf06('0x3c')]=_0x20f862!==_0xcf06('0x3d')?_0x20f862:util['format']('Caller\x20-\x20%s',_0xbf85ed);_0x392381['Company']=_0xcf06('0x41');}else if(_0x56c54c['moduleCreate']===_0xcf06('0x14')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0xbf85ed,_0x56c54c[_0xcf06('0x40')]);_0x392381['Name']=_0x20f862!==_0xcf06('0x3d')?_0x20f862:util[_0xcf06('0x3e')](_0xcf06('0x3f'),_0xbf85ed);}else{return null;}}return _0x35d460[_0xcf06('0x19')](_[_0xcf06('0x42')](_0x56c54c[_0xcf06('0x40')]))[_0xcf06('0x1a')](_0x392381)[_0xcf06('0x1e')](function(_0x56788a){return BPromise['resolve']({'id':_0x56788a['id'],'endUserType':_0x56c54c[_0xcf06('0x40')]});});}});}function getCustomFields(_0x405e72,_0x2ac8a3){var _0x130c83={};if(_0x405e72['length']>0x0){_[_0xcf06('0x43')](_0x405e72,function(_0xb8410b){if(_['includes']([_0xcf06('0x44'),'picklist'],_0xb8410b[_0xcf06('0x45')])&&_0xb8410b[_0xcf06('0x46')]){_0x130c83[_0xb8410b[_0xcf06('0x46')]]=_0xb8410b[_0xcf06('0x47')][_0xcf06('0x48')]();}else if(_0xb8410b[_0xcf06('0x45')]===_0xcf06('0x49')&&_0xb8410b[_0xcf06('0x4a')]&&_0xb8410b['idField']){_0x2ac8a3[_0xb8410b[_0xcf06('0x4a')]]&&(_0x130c83[_0xb8410b[_0xcf06('0x46')]]=_0x2ac8a3[_0xb8410b['variableName']][_0xcf06('0x48')]());}else if(_0xb8410b[_0xcf06('0x45')]===_0xcf06('0x4b')&&_0xb8410b[_0xcf06('0x4c')]&&_0xb8410b['Variable'][_0xcf06('0x4d')]&&_0xb8410b['idField']){_0x2ac8a3[_0xb8410b['Variable'][_0xcf06('0x4d')][_0xcf06('0x4e')]()]&&(_0x130c83[_0xb8410b[_0xcf06('0x46')]]=_0x2ac8a3[_0xb8410b[_0xcf06('0x4c')][_0xcf06('0x4d')][_0xcf06('0x4e')]()][_0xcf06('0x48')]());}});}return _0x130c83;}function getConnection(_0x3b86b6){var _0x4efe9e=_0x3b86b6[_0xcf06('0x4f')][_0xcf06('0x50')](_0x3b86b6[_0xcf06('0x51')]);var _0x528c98=new jsforce[(_0xcf06('0x52'))]({'oauth2':{'loginUrl':_0x3b86b6[_0xcf06('0x53')]||_0xcf06('0x54'),'clientId':_0x3b86b6['clientId'],'clientSecret':_0x3b86b6[_0xcf06('0x55')]}});return _0x528c98[_0xcf06('0x56')](_0x3b86b6[_0xcf06('0x57')],_0x4efe9e)['then'](function(){logger[_0xcf06('0x21')](_0xcf06('0x58'));return _0x528c98;});}exports[_0xcf06('0x59')]=function(_0x5f2e2b,_0x1d41cb,_0x5a3d20,_0x4ab892,_0x177ab1,_0x1e4dd9){var _0x5cc0ec,_0x36f482,_0x590c2e,_0x164be2;_0x1e4dd9[_0xcf06('0x5a')]=intUtil[_0xcf06('0x5b')](_0x1e4dd9[_0xcf06('0x5a')]);_0x1e4dd9[_0xcf06('0x53')]=intUtil[_0xcf06('0x5b')](_0x1e4dd9[_0xcf06('0x53')]);if(_0x177ab1&&_0x177ab1[_0xcf06('0x5c')]){logger['info']('[QUEUE]',_0xcf06('0x5d'));_0x1d41cb[_0xcf06('0x5e')]=util['format'](_0xcf06('0x5f'),_0x1e4dd9['serverUrl'],_0x1d41cb[_0xcf06('0x60')],md5(_0x1d41cb['uniqueid']));}else{_0x1d41cb[_0xcf06('0x5e')]='';}return getConnection(_0x1e4dd9)[_0xcf06('0x1e')](function(_0x2a7321){_0x164be2=_0x2a7321;return getUser(_0x1e4dd9,_0x4ab892['email'],_0x164be2);})[_0xcf06('0x1e')](function(_0xeb1ebd){_0x5cc0ec=_0xeb1ebd;return getEndUser(_0x1e4dd9,_0x5a3d20,_0x1d41cb[_0xcf06('0x61')],_0x1d41cb['calleridnum'],_0x164be2);})[_0xcf06('0x1e')](function(_0x1a8f29){_0x36f482=_0x1a8f29;return getTicket(_0x1e4dd9,_0x5cc0ec,_0x36f482,_0x5a3d20,_0x1d41cb,_0x5a3d20['Fields'],_0x164be2,_0xcf06('0x59'));})['then'](function(_0x11fa8d){_0x590c2e=_0x11fa8d;logger[_0xcf06('0x21')](_0xcf06('0x62'),_0x590c2e['id']);logger[_0xcf06('0x21')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x590c2e['id'],_0x4ab892['name'],_0x1e4dd9[_0xcf06('0x45')]);switch(_0x1e4dd9[_0xcf06('0x45')]){case _0xcf06('0x63'):emit(util[_0xcf06('0x3e')](_0xcf06('0x64'),_0x4ab892[_0xcf06('0x4d')]),_0xcf06('0x65'),{'recordId':_0x590c2e['id']});break;case _0xcf06('0x66'):emit(util['format'](_0xcf06('0x64'),_0x4ab892['name']),_0xcf06('0x67'),{'uri':util[_0xcf06('0x3e')](_0xcf06('0x68'),_0x164be2['instanceUrl'],_0x590c2e['id'])});break;default:logger['error'](_0xcf06('0x69'));}})[_0xcf06('0x6a')](function(_0x3982df){logger[_0xcf06('0x6b')]('[QUEUE]',_0x3982df);});};exports['outbound']=function(_0x4151ae,_0x464fcd,_0xb9315d,_0x3828eb,_0x5107bc,_0x187631,_0x47bc80){var _0x357b7e,_0x379540,_0x2944d7,_0x2048ed;_0x187631[_0xcf06('0x5a')]=intUtil[_0xcf06('0x5b')](_0x187631[_0xcf06('0x5a')]);_0x187631[_0xcf06('0x53')]=intUtil[_0xcf06('0x5b')](_0x187631['remoteUri']);if(_0x47bc80&&_0x47bc80['recordingFormat']&&_0x47bc80['recordingFormat']!==_0xcf06('0x6c')){logger[_0xcf06('0x21')](_0xcf06('0x6d'),_0xcf06('0x5d'));_0x464fcd['recordingURL']=util['format'](_0xcf06('0x5f'),_0x187631[_0xcf06('0x5a')],_0x464fcd[_0xcf06('0x60')],md5(_0x464fcd[_0xcf06('0x60')]));}return getConnection(_0x187631)['then'](function(_0x14ac20){_0x2048ed=_0x14ac20;return getUser(_0x187631,_0x3828eb[_0xcf06('0x6e')],_0x2048ed);})[_0xcf06('0x1e')](function(_0x2ee97a){_0x357b7e=_0x2ee97a;return getEndUser(_0x187631,_0xb9315d,_0x464fcd[_0xcf06('0x6f')],_0x464fcd['destcalleridnum'],_0x2048ed);})['then'](function(_0x46bbae){_0x379540=_0x46bbae;return getTicket(_0x187631,_0x357b7e,_0x379540,_0xb9315d,_0x464fcd,_0xb9315d[_0xcf06('0x70')],_0x2048ed,_0xcf06('0x71'));})['then'](function(_0x21ec16){_0x2944d7=_0x21ec16;logger[_0xcf06('0x21')](_0xcf06('0x72'),_0x2944d7['id']);logger[_0xcf06('0x21')](_0xcf06('0x73'),_0x2944d7['id'],_0x3828eb['name'],_0x187631[_0xcf06('0x45')]);switch(_0x187631[_0xcf06('0x45')]){case'integrationTab':emit(util[_0xcf06('0x3e')](_0xcf06('0x64'),_0x3828eb['name']),_0xcf06('0x65'),{'recordId':_0x2944d7['id']});break;case _0xcf06('0x66'):emit(util[_0xcf06('0x3e')](_0xcf06('0x64'),_0x3828eb[_0xcf06('0x4d')]),_0xcf06('0x67'),{'uri':util[_0xcf06('0x3e')](_0xcf06('0x68'),_0x2048ed['instanceUrl'],_0x2944d7['id'])});break;default:logger[_0xcf06('0x6b')](_0xcf06('0x6d'),_0xcf06('0x74'));}})[_0xcf06('0x6a')](function(_0x8e0c49){logger[_0xcf06('0x6b')](_0xcf06('0x6d'),_0x8e0c49);});};exports[_0xcf06('0x75')]=function(_0x10d8d3,_0x4fc494,_0x10f640,_0x33d0f0,_0x32378d,_0x39d94f){var _0xade49f,_0xc4144b,_0x5650dd,_0x351e63;_0x39d94f[_0xcf06('0x5a')]=intUtil[_0xcf06('0x5b')](_0x39d94f['serverUrl']);_0x39d94f[_0xcf06('0x53')]=intUtil[_0xcf06('0x5b')](_0x39d94f['remoteUri']);if(_0x32378d&&_0x32378d['monitor_format']){logger['info']('['+_0x4fc494['lastevent'][_0xcf06('0x76')]()+']',_0xcf06('0x5d'));_0x4fc494[_0xcf06('0x5e')]=util[_0xcf06('0x3e')](_0xcf06('0x5f'),_0x39d94f[_0xcf06('0x5a')],_0x4fc494['uniqueid'],md5(_0x4fc494[_0xcf06('0x60')]));}else{_0x4fc494[_0xcf06('0x5e')]='';}return getConnection(_0x39d94f)[_0xcf06('0x1e')](function(_0x43584f){_0x351e63=_0x43584f;if(!_[_0xcf06('0x1b')](_0x33d0f0)){return getUser(_0x39d94f,_0x33d0f0[_0xcf06('0x4d')],_0x351e63);}else{return getUser(_0x39d94f,null,_0x351e63);}})[_0xcf06('0x1e')](function(_0x50b122){_0xade49f=_0x50b122;return getEndUser(_0x39d94f,_0x10f640,_0x4fc494['calleridname'],_0x4fc494['calleridnum'],_0x351e63);})['then'](function(_0x22f444){_0xc4144b=_0x22f444;return getTicket(_0x39d94f,_0xade49f,_0xc4144b,_0x10f640,_0x4fc494,_0x10f640['Fields'],_0x351e63);})[_0xcf06('0x1e')](function(_0x3a2300){_0x5650dd=_0x3a2300;logger[_0xcf06('0x21')]('['+_0x4fc494['lastevent']['toUpperCase']()+_0xcf06('0x77'),_0x5650dd['id']);logger[_0xcf06('0x21')]('['+_0x4fc494[_0xcf06('0x78')][_0xcf06('0x76')]()+']\x20Integration\x20account\x20type\x20%s.',_0x39d94f['type']);})[_0xcf06('0x6a')](function(_0x5638aa){logger[_0xcf06('0x6b')]('['+_0x4fc494[_0xcf06('0x78')]['toUpperCase']()+']',_0x5638aa);});}; \ No newline at end of file +var _0x08d7=['User','find','execute','then','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','resolve','user_id','display_name','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','merge','$or','Contact','length','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','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','No\x20Company','upperFirst','forEach','includes','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','%s/%s/e','error','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','isNil',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Subjects','Task','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','Case','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','ticketType','create'];(function(_0x5e77db,_0x356d1c){var _0x34b675=function(_0x4914b5){while(--_0x4914b5){_0x5e77db['push'](_0x5e77db['shift']());}};_0x34b675(++_0x356d1c);}(_0x08d7,0xe6));var _0x708d=function(_0x4e0eb9,_0x4e8b98){_0x4e0eb9=_0x4e0eb9-0x0;var _0x1f8c3c=_0x08d7[_0x4e0eb9];return _0x1f8c3c;};'use strict';var _=require(_0x708d('0x0'));var rp=require('request-promise');var moment=require(_0x708d('0x1'));var BPromise=require(_0x708d('0x2'));var md5=require(_0x708d('0x3'));var jsforce=require(_0x708d('0x4'));var util=require(_0x708d('0x5'));var Redis=require(_0x708d('0x6'));var intUtil=require(_0x708d('0x7'));var config=require(_0x708d('0x8'));var logger=require(_0x708d('0x9'))(_0x708d('0xa'));config[_0x708d('0xb')]=_[_0x708d('0xc')](config[_0x708d('0xb')],{'host':_0x708d('0xd'),'port':0x18eb});var io=require(_0x708d('0xe'))(new Redis(config['redis']));function emit(_0x199acc,_0x23f3d1,_0x100df1){io['to'](_0x199acc)[_0x708d('0xf')](_0x23f3d1,_0x100df1);}function getTicket(_0x1c68e1,_0x4a0dc,_0x407910,_0x105b71,_0x132ecd,_0x27154c,_0x1386fa,_0x191a5e){var _0x25c215=Object[_0x708d('0x10')]({},{'OwnerId':_0x4a0dc['id'],'Subject':intUtil[_0x708d('0x11')](_0x105b71[_0x708d('0x12')],_0x132ecd,'\x20'),'Description':intUtil[_0x708d('0x11')](_0x105b71['Descriptions'],_0x132ecd,'\x0a')},getCustomFields(_0x27154c,_0x132ecd));if(_0x407910){if(_0x105b71['ticketType']===_0x708d('0x13')){_0x25c215['ActivityDate']=moment[_0x708d('0x14')]();_0x25c215[_0x708d('0x15')]=![];_0x25c215[_0x708d('0x16')]=![];if(_0x407910[_0x708d('0x17')]===_0x708d('0x18')||_0x407910[_0x708d('0x17')]===_0x708d('0x19')){_0x25c215[_0x708d('0x1a')]=_0x407910['id'];}else if(_0x407910['endUserType']===_0x708d('0x1b')){_0x25c215[_0x708d('0x1c')]=_0x407910['id'];}}else if(_0x105b71['ticketType']===_0x708d('0x1d')){if(_0x407910[_0x708d('0x17')]===_0x708d('0x18')){_0x25c215['ContactId']=_0x407910['id'];}else if(_0x407910[_0x708d('0x17')]==='account'){_0x25c215['AccountId']=_0x407910['id'];}else if(_0x407910[_0x708d('0x17')]===_0x708d('0x19')&&_0x105b71[_0x708d('0x1e')]){_0x25c215[_0x105b71[_0x708d('0x1e')]]=_0x407910['id'];}else{logger[_0x708d('0x1f')](_0x708d('0x20'));}}}return _0x1386fa[_0x708d('0x21')](_0x105b71[_0x708d('0x22')])[_0x708d('0x23')](_0x25c215);}function getUser(_0x41ebb0,_0x34a5dc,_0x478a75){if(!_['isNil'](_0x34a5dc)&&intUtil['validateEmail'](_0x34a5dc)){var _0x581c71={'Email':_0x34a5dc};var _0x13451c={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x478a75[_0x708d('0x21')](_0x708d('0x24'))[_0x708d('0x25')](_0x581c71,_0x13451c)[_0x708d('0x26')]()[_0x708d('0x27')](function(_0x3ed953){if(_0x3ed953['length']){var _0x28804a=_[_0x708d('0x25')](_0x3ed953,function(_0x39f9ad){return _0x39f9ad['Email']===_0x34a5dc;});if(_0x28804a){logger['info'](_0x708d('0x28'),_0x34a5dc);return BPromise['resolve']({'id':_0x28804a['Id'],'name':_0x28804a[_0x708d('0x29')]});}}else{logger['info'](_0x708d('0x2a'),_0x34a5dc);return _0x478a75['identity']()[_0x708d('0x27')](function(_0x1bf252){return BPromise[_0x708d('0x2b')]({'id':_0x1bf252[_0x708d('0x2c')],'name':_0x1bf252[_0x708d('0x2d')]});});}});}else{logger[_0x708d('0x1f')](_0x708d('0x2a'),_0x34a5dc);return _0x478a75[_0x708d('0x2e')]()[_0x708d('0x27')](function(_0x382085){return BPromise['resolve']({'id':_0x382085[_0x708d('0x2c')],'name':_0x382085[_0x708d('0x2d')]});});}}function getEndUser(_0x22a606,_0x54cb6e,_0x2c4e5f,_0xaa751c,_0xa87f1d){var _0x3f5bbe={'$or':{'Phone':_0xaa751c}};var _0x3121c8={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x708d('0x2b')]()[_0x708d('0x27')](function(){logger[_0x708d('0x1f')](_0x708d('0x2f'),_0xaa751c,_0x54cb6e[_0x708d('0x30')]);switch(_0x54cb6e[_0x708d('0x30')]){case'contact_lead':var _0x21749a=_[_0x708d('0x31')](_0x3f5bbe);if(_0x54cb6e[_0x708d('0x32')]){var _0x2acb83={};_0x2acb83[_0x54cb6e[_0x708d('0x32')]]=_0xaa751c;_[_0x708d('0x33')](_0x21749a[_0x708d('0x34')],_0x2acb83);}return _0xa87f1d[_0x708d('0x21')](_0x708d('0x35'))[_0x708d('0x25')](_0x21749a,_0x3121c8)['execute']()[_0x708d('0x27')](function(_0x9c9ef2){if(_0x9c9ef2&&_0x9c9ef2[_0x708d('0x36')]){return _0x9c9ef2;}else{var _0x5d43ec=_[_0x708d('0x31')](_0x3f5bbe);if(_0x54cb6e['additionalSearchLead']){var _0x365020={};_0x365020[_0x54cb6e[_0x708d('0x37')]]=_0xaa751c;_[_0x708d('0x33')](_0x5d43ec[_0x708d('0x34')],_0x365020);}return _0xa87f1d['sobject'](_0x708d('0x38'))[_0x708d('0x25')](_0x5d43ec,_0x3121c8);}});case _0x708d('0x39'):var _0x3bdfa1=_[_0x708d('0x31')](_0x3f5bbe);if(_0x54cb6e[_0x708d('0x3a')]){var _0x2acb83={};_0x2acb83[_0x54cb6e['additionalSearchAccount']]=_0xaa751c;_[_0x708d('0x33')](_0x3bdfa1[_0x708d('0x34')],_0x2acb83);}return _0xa87f1d[_0x708d('0x21')](_0x708d('0x3b'))['find'](_0x3bdfa1,_0x3121c8)[_0x708d('0x26')]()[_0x708d('0x27')](function(_0x502f1b){if(_0x502f1b&&_0x502f1b[_0x708d('0x36')]){return _0x502f1b;}else{var _0x57aa43=_[_0x708d('0x31')](_0x3f5bbe);if(_0x54cb6e['additionalSearchContact']){var _0x265617={};_0x265617[_0x54cb6e[_0x708d('0x32')]]=_0xaa751c;_[_0x708d('0x33')](_0x57aa43[_0x708d('0x34')],_0x265617);}return _0xa87f1d[_0x708d('0x21')](_0x708d('0x35'))['find'](_0x57aa43,_0x3121c8)[_0x708d('0x27')](function(_0x2fe37e){if(_0x2fe37e&&_0x2fe37e[_0x708d('0x36')]){return _0x2fe37e;}else{var _0x2f8aaf=_[_0x708d('0x31')](_0x3f5bbe);if(_0x54cb6e[_0x708d('0x37')]){var _0x60a4db={};_0x60a4db[_0x54cb6e[_0x708d('0x37')]]=_0xaa751c;_[_0x708d('0x33')](_0x2f8aaf[_0x708d('0x34')],_0x60a4db);}return _0xa87f1d[_0x708d('0x21')](_0x708d('0x38'))[_0x708d('0x25')](_0x2f8aaf,_0x3121c8);}});}});case'contact':var _0x21749a=_[_0x708d('0x31')](_0x3f5bbe);if(_0x54cb6e['additionalSearchContact']){var _0x2acb83={};_0x2acb83[_0x54cb6e['additionalSearchContact']]=_0xaa751c;_[_0x708d('0x33')](_0x21749a[_0x708d('0x34')],_0x2acb83);}return _0xa87f1d[_0x708d('0x21')](_0x708d('0x35'))[_0x708d('0x25')](_0x21749a,_0x3121c8)[_0x708d('0x26')]();case _0x708d('0x19'):var _0x110687=_[_0x708d('0x31')](_0x3f5bbe);if(_0x54cb6e[_0x708d('0x37')]){var _0x2acb83={};_0x2acb83[_0x54cb6e[_0x708d('0x37')]]=_0xaa751c;_['merge'](_0x110687[_0x708d('0x34')],_0x2acb83);}return _0xa87f1d[_0x708d('0x21')](_0x708d('0x38'))[_0x708d('0x25')](_0x110687,_0x3121c8);case _0x708d('0x1b'):var _0x3bdfa1=_[_0x708d('0x31')](_0x3f5bbe);if(_0x54cb6e[_0x708d('0x3a')]){var _0x2acb83={};_0x2acb83[_0x54cb6e[_0x708d('0x3a')]]=_0xaa751c;_[_0x708d('0x33')](_0x3bdfa1[_0x708d('0x34')],_0x2acb83);}return _0xa87f1d[_0x708d('0x21')](_0x708d('0x3b'))[_0x708d('0x25')](_0x3bdfa1,_0x3121c8);default:return null;}})[_0x708d('0x27')](function(_0x4c5e38){if(_0x4c5e38&&_0x4c5e38['length']){var _0x1bb7b5=_[_0x708d('0x3c')](_0x4c5e38);if(_0x1bb7b5){return BPromise[_0x708d('0x2b')]({'id':_0x1bb7b5['Id'],'name':_0x1bb7b5['Name'],'phone':_0x1bb7b5[_0x708d('0x3d')],'endUserType':_0x1bb7b5['attributes']['type'][_0x708d('0x3e')]()});}}})[_0x708d('0x27')](function(_0x49917c){if(_0x49917c){logger[_0x708d('0x1f')](_0x708d('0x3f'),_0x49917c[_0x708d('0x17')],_0xaa751c);return BPromise['resolve'](_0x49917c);}else{logger[_0x708d('0x1f')](_0x708d('0x40'),_0xaa751c);var _0x3a29f6={'Phone':_0xaa751c};if(_0x54cb6e['moduleCreate']){if(_0x54cb6e[_0x708d('0x41')]===_0x708d('0x18')){logger[_0x708d('0x1f')](_0x708d('0x42'),_0xaa751c,_0x54cb6e[_0x708d('0x41')]);_0x3a29f6[_0x708d('0x43')]=_0x2c4e5f!==_0x708d('0x44')?_0x2c4e5f:util['format'](_0x708d('0x45'),_0xaa751c);}else if(_0x54cb6e[_0x708d('0x41')]===_0x708d('0x19')){logger[_0x708d('0x1f')](_0x708d('0x42'),_0xaa751c,_0x54cb6e[_0x708d('0x41')]);_0x3a29f6[_0x708d('0x43')]=_0x2c4e5f!==_0x708d('0x44')?_0x2c4e5f:util[_0x708d('0x46')](_0x708d('0x45'),_0xaa751c);_0x3a29f6[_0x708d('0x47')]=_0x708d('0x48');}else if(_0x54cb6e['moduleCreate']==='account'){logger[_0x708d('0x1f')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0xaa751c,_0x54cb6e[_0x708d('0x41')]);_0x3a29f6[_0x708d('0x29')]=_0x2c4e5f!==''?_0x2c4e5f:util[_0x708d('0x46')](_0x708d('0x45'),_0xaa751c);}else{return null;}}return _0xa87f1d[_0x708d('0x21')](_[_0x708d('0x49')](_0x54cb6e[_0x708d('0x41')]))[_0x708d('0x23')](_0x3a29f6)['then'](function(_0x4e5e7c){return BPromise[_0x708d('0x2b')]({'id':_0x4e5e7c['id'],'endUserType':_0x54cb6e[_0x708d('0x41')]});});}});}function getCustomFields(_0x30b9f6,_0x3ad8f6){var _0x34c3b1={};if(_0x30b9f6[_0x708d('0x36')]>0x0){_[_0x708d('0x4a')](_0x30b9f6,function(_0x5276d2){if(_[_0x708d('0x4b')]([_0x708d('0x4c'),_0x708d('0x4d')],_0x5276d2[_0x708d('0x4e')])&&_0x5276d2[_0x708d('0x4f')]){_0x34c3b1[_0x5276d2[_0x708d('0x4f')]]=_0x5276d2[_0x708d('0x50')][_0x708d('0x51')]();}else if(_0x5276d2['type']===_0x708d('0x52')&&_0x5276d2['variableName']&&_0x5276d2['idField']){_0x3ad8f6[_0x5276d2[_0x708d('0x53')]]&&(_0x34c3b1[_0x5276d2[_0x708d('0x4f')]]=_0x3ad8f6[_0x5276d2['variableName']][_0x708d('0x51')]());}else if(_0x5276d2['type']===_0x708d('0x54')&&_0x5276d2[_0x708d('0x55')]&&_0x5276d2[_0x708d('0x55')][_0x708d('0x56')]&&_0x5276d2['idField']){_0x3ad8f6[_0x5276d2['Variable'][_0x708d('0x56')][_0x708d('0x3e')]()]&&(_0x34c3b1[_0x5276d2[_0x708d('0x4f')]]=_0x3ad8f6[_0x5276d2[_0x708d('0x55')][_0x708d('0x56')][_0x708d('0x3e')]()][_0x708d('0x51')]());}});}return _0x34c3b1;}function getConnection(_0xe2f684){var _0x4a5380=_0xe2f684[_0x708d('0x57')][_0x708d('0x58')](_0xe2f684[_0x708d('0x59')]);var _0x618d3d=new jsforce[(_0x708d('0x5a'))]({'oauth2':{'loginUrl':_0xe2f684[_0x708d('0x5b')]||_0x708d('0x5c'),'clientId':_0xe2f684[_0x708d('0x5d')],'clientSecret':_0xe2f684[_0x708d('0x5e')]}});return _0x618d3d[_0x708d('0x5f')](_0xe2f684[_0x708d('0x60')],_0x4a5380)[_0x708d('0x27')](function(){logger[_0x708d('0x1f')](_0x708d('0x61'));return _0x618d3d;});}exports[_0x708d('0x62')]=function(_0x3059c5,_0x29bce6,_0x11fd9b,_0x55696d,_0x1ed145,_0x161b0f){var _0x2e48e1,_0x3b4057,_0x1dbff3,_0x1910ec;_0x161b0f[_0x708d('0x63')]=intUtil[_0x708d('0x64')](_0x161b0f['serverUrl']);_0x161b0f[_0x708d('0x5b')]=intUtil[_0x708d('0x64')](_0x161b0f['remoteUri']);if(_0x1ed145&&_0x1ed145[_0x708d('0x65')]){logger['info'](_0x708d('0x66'),_0x708d('0x67'));_0x29bce6[_0x708d('0x68')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x161b0f[_0x708d('0x63')],_0x29bce6['uniqueid'],md5(_0x29bce6[_0x708d('0x69')]));}else{_0x29bce6[_0x708d('0x68')]='';}return getConnection(_0x161b0f)[_0x708d('0x27')](function(_0xd09353){_0x1910ec=_0xd09353;return getUser(_0x161b0f,_0x55696d[_0x708d('0x6a')],_0x1910ec);})[_0x708d('0x27')](function(_0x3ccb2f){_0x2e48e1=_0x3ccb2f;return getEndUser(_0x161b0f,_0x11fd9b,_0x29bce6[_0x708d('0x6b')],_0x29bce6[_0x708d('0x6c')],_0x1910ec);})[_0x708d('0x27')](function(_0x263e0b){_0x3b4057=_0x263e0b;return getTicket(_0x161b0f,_0x2e48e1,_0x3b4057,_0x11fd9b,_0x29bce6,_0x11fd9b[_0x708d('0x6d')],_0x1910ec,_0x708d('0x62'));})['then'](function(_0x18f822){_0x1dbff3=_0x18f822;logger['info'](_0x708d('0x6e'),_0x1dbff3['id']);logger[_0x708d('0x1f')](_0x708d('0x6f'),_0x1dbff3['id'],_0x55696d['name'],_0x161b0f['type']);switch(_0x161b0f[_0x708d('0x4e')]){case _0x708d('0x70'):emit(util[_0x708d('0x46')](_0x708d('0x71'),_0x55696d[_0x708d('0x56')]),'trigger:salesforce:display',{'recordId':_0x1dbff3['id']});break;case _0x708d('0x72'):emit(util[_0x708d('0x46')](_0x708d('0x71'),_0x55696d[_0x708d('0x56')]),_0x708d('0x73'),{'uri':util[_0x708d('0x46')](_0x708d('0x74'),_0x1910ec['instanceUrl'],_0x1dbff3['id'])});break;default:logger[_0x708d('0x75')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x708d('0x76')](function(_0x30e0aa){logger[_0x708d('0x75')]('[QUEUE]',_0x30e0aa);});};exports[_0x708d('0x77')]=function(_0x2ba842,_0x2af1a7,_0x9a593e,_0xd3a833,_0x367bd7,_0x150405,_0x553557){var _0xf55156,_0x528f15,_0x412018,_0x186743;_0x150405[_0x708d('0x63')]=intUtil[_0x708d('0x64')](_0x150405['serverUrl']);_0x150405['remoteUri']=intUtil[_0x708d('0x64')](_0x150405[_0x708d('0x5b')]);if(_0x553557&&_0x553557[_0x708d('0x78')]&&_0x553557[_0x708d('0x78')]!==_0x708d('0x79')){logger[_0x708d('0x1f')](_0x708d('0x7a'),'Recording\x20is\x20enabled!');_0x2af1a7['recordingURL']=util[_0x708d('0x46')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x150405[_0x708d('0x63')],_0x2af1a7[_0x708d('0x69')],md5(_0x2af1a7[_0x708d('0x69')]));}return getConnection(_0x150405)['then'](function(_0x66b13e){_0x186743=_0x66b13e;return getUser(_0x150405,_0xd3a833[_0x708d('0x6a')],_0x186743);})[_0x708d('0x27')](function(_0x5ec558){_0xf55156=_0x5ec558;return getEndUser(_0x150405,_0x9a593e,_0x2af1a7[_0x708d('0x7b')],_0x2af1a7[_0x708d('0x7c')],_0x186743);})[_0x708d('0x27')](function(_0x547d49){_0x528f15=_0x547d49;return getTicket(_0x150405,_0xf55156,_0x528f15,_0x9a593e,_0x2af1a7,_0x9a593e[_0x708d('0x6d')],_0x186743,_0x708d('0x77'));})[_0x708d('0x27')](function(_0x9b336d){_0x412018=_0x9b336d;logger[_0x708d('0x1f')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x412018['id']);logger['info'](_0x708d('0x7d'),_0x412018['id'],_0xd3a833[_0x708d('0x56')],_0x150405[_0x708d('0x4e')]);switch(_0x150405['type']){case _0x708d('0x70'):emit(util['format'](_0x708d('0x71'),_0xd3a833['name']),'trigger:salesforce:display',{'recordId':_0x412018['id']});break;case _0x708d('0x72'):emit(util[_0x708d('0x46')](_0x708d('0x71'),_0xd3a833[_0x708d('0x56')]),_0x708d('0x73'),{'uri':util[_0x708d('0x46')]('%s/%s/e',_0x186743['instanceUrl'],_0x412018['id'])});break;default:logger[_0x708d('0x75')](_0x708d('0x7a'),_0x708d('0x7e'));}})[_0x708d('0x76')](function(_0x2e1af2){logger[_0x708d('0x75')](_0x708d('0x7a'),_0x2e1af2);});};exports[_0x708d('0x7f')]=function(_0x1b9d0f,_0x3641d3,_0x545ab1,_0x2c765d,_0x5ee3a4,_0x56a7d4){var _0x3f4e27,_0x1e6d96,_0x332541,_0x88a2b2;_0x56a7d4['serverUrl']=intUtil[_0x708d('0x64')](_0x56a7d4[_0x708d('0x63')]);_0x56a7d4[_0x708d('0x5b')]=intUtil[_0x708d('0x64')](_0x56a7d4[_0x708d('0x5b')]);if(_0x5ee3a4&&_0x5ee3a4['monitor_format']){logger[_0x708d('0x1f')]('['+_0x3641d3[_0x708d('0x80')][_0x708d('0x81')]()+']',_0x708d('0x67'));_0x3641d3[_0x708d('0x68')]=util[_0x708d('0x46')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x56a7d4[_0x708d('0x63')],_0x3641d3[_0x708d('0x69')],md5(_0x3641d3[_0x708d('0x69')]));}else{_0x3641d3[_0x708d('0x68')]='';}return getConnection(_0x56a7d4)[_0x708d('0x27')](function(_0x309c59){_0x88a2b2=_0x309c59;if(!_[_0x708d('0x82')](_0x2c765d)){return getUser(_0x56a7d4,_0x2c765d[_0x708d('0x56')],_0x88a2b2);}else{return getUser(_0x56a7d4,null,_0x88a2b2);}})[_0x708d('0x27')](function(_0x3de8d7){_0x3f4e27=_0x3de8d7;return getEndUser(_0x56a7d4,_0x545ab1,_0x3641d3[_0x708d('0x6b')],_0x3641d3[_0x708d('0x6c')],_0x88a2b2);})[_0x708d('0x27')](function(_0x5a009c){_0x1e6d96=_0x5a009c;return getTicket(_0x56a7d4,_0x3f4e27,_0x1e6d96,_0x545ab1,_0x3641d3,_0x545ab1[_0x708d('0x6d')],_0x88a2b2);})[_0x708d('0x27')](function(_0x4273f1){_0x332541=_0x4273f1;logger[_0x708d('0x1f')]('['+_0x3641d3[_0x708d('0x80')][_0x708d('0x81')]()+_0x708d('0x83'),_0x332541['id']);logger[_0x708d('0x1f')]('['+_0x3641d3['lastevent'][_0x708d('0x81')]()+_0x708d('0x84'),_0x56a7d4[_0x708d('0x4e')]);})[_0x708d('0x76')](function(_0x1ec172){logger[_0x708d('0x75')]('['+_0x3641d3[_0x708d('0x80')][_0x708d('0x81')]()+']',_0x1ec172);});}; \ 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 29e6fdf..899659c 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 _0x89d8=['sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','request-promise','util','md5','./util','../../../../config/environment','../../../../config/logger','servicenow','defaults','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','length','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','user','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','content','toString','idField','toLowerCase','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','Incident\x20-\x20','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','password'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x89d8,0x88));var _0x889d=function(_0x14f61c,_0x46d9e3){_0x14f61c=_0x14f61c-0x0;var _0x589bcb=_0x89d8[_0x14f61c];return _0x589bcb;};'use strict';var _=require('lodash');var Promise=require('bluebird');var rp=require(_0x889d('0x0'));var util=require(_0x889d('0x1'));var md5=require(_0x889d('0x2'));var Redis=require('ioredis');var intUtil=require(_0x889d('0x3'));var config=require(_0x889d('0x4'));var logger=require(_0x889d('0x5'))(_0x889d('0x6'));config['redis']=_[_0x889d('0x7')](config[_0x889d('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x889d('0x9'))(new Redis(config[_0x889d('0x8')]));function getAdminUser(_0x1f15c7,_0x4ae4cf,_0x5096e8,_0x19baff,_0x20eccf,_0x5577f4){return new Promise(function(_0x213d9b,_0xdfecb4){var _0x155a91={'method':_0x889d('0xa'),'uri':_0x19baff+_0x889d('0xb')+'&'+_0x20eccf+'&'+_0x5577f4,'auth':_0x4ae4cf,'json':!![]};return rp(_0x155a91)[_0x889d('0xc')](function(_0x950e82){if(_0x950e82[_0x889d('0xd')]['length']>0x0){_0x5096e8[_0x889d('0xe')]=_0x950e82['result'][0x0][_0x889d('0xf')];}logger[_0x889d('0x10')]('['+[_0x1f15c7[_0x889d('0x11')]()]+_0x889d('0x12'),_0x5096e8);_0x213d9b(_0x5096e8);})[_0x889d('0x13')](function(_0x3c426c){logger[_0x889d('0x14')]('['+[_0x1f15c7[_0x889d('0x11')]()]+']',_0x3c426c[_0x889d('0x15')]);_0xdfecb4(_0x3c426c[_0x889d('0x15')]);});});}function getUser(_0x45d3da,_0x5ee2ab,_0x4980b1,_0x37cfb6,_0x4ede12){return function(_0x3771eb){logger[_0x889d('0x10')]('['+[_0x45d3da['toUpperCase']()]+_0x889d('0x16'),_0x3771eb);return new Promise(function(_0xf85fa8,_0x4eb97f){if(intUtil[_0x889d('0x17')](_0x3771eb[_0x889d('0x18')])){var _0x13845={'method':_0x889d('0xa'),'uri':_0x4980b1+_0x889d('0x19')+_0x3771eb['userEmail']+'&'+_0x37cfb6+'&'+_0x4ede12,'auth':_0x5ee2ab,'json':!![]};logger[_0x889d('0x10')]('['+[_0x45d3da[_0x889d('0x11')]()]+'],\x20getUser\x20rp\x20obj',_0x13845);return rp(_0x13845)[_0x889d('0xc')](function(_0x149268){logger['info']('['+[_0x45d3da[_0x889d('0x11')]()]+'],\x20getUser\x20entity',_0x149268);if(_0x149268[_0x889d('0xd')][_0x889d('0x1a')]>0x0&&String(_0x149268['result'][0x0][_0x889d('0x1b')])===_0x889d('0x1c')){_0x3771eb[_0x889d('0x1d')]=_0x149268[_0x889d('0xd')][0x0][_0x889d('0xf')];}else{_0x3771eb[_0x889d('0x1d')]=_0x3771eb[_0x889d('0xe')];_0x3771eb['userEmail']=_0x3771eb[_0x889d('0x1e')];}logger[_0x889d('0x10')]('['+[_0x45d3da['toUpperCase']()]+_0x889d('0x1f'),_0x3771eb);_0xf85fa8(_0x3771eb);})[_0x889d('0x13')](function(_0x338406){logger[_0x889d('0x14')]('['+[_0x45d3da[_0x889d('0x11')]()]+']',_0x338406['message']);_0x4eb97f(_0x338406['message']);});}else{logger['info']('['+[_0x45d3da[_0x889d('0x11')]()]+_0x889d('0x20'));_0x3771eb[_0x889d('0x1d')]=_0x3771eb[_0x889d('0xe')];_0x3771eb[_0x889d('0x18')]=_0x3771eb[_0x889d('0x1e')];_0xf85fa8(_0x3771eb);}});};}function createEndUser(_0x782246,_0x56ffe2,_0x1710ae,_0x522641,_0x2167c6){logger[_0x889d('0x10')]('['+[_0x782246[_0x889d('0x11')]()]+_0x889d('0x21'),_0x1710ae);return new Promise(function(_0x696566,_0x5d9b1f){var _0x2b5029={'method':_0x889d('0x22'),'uri':_0x522641+'sys_user?'+_0x2167c6,'body':{'user_name':_0x1710ae['endUserNumber'],'roles':_0x889d('0x23'),'first_name':_0x1710ae[_0x889d('0x24')],'active':'true','date_format':_0x889d('0x25'),'phone':_0x1710ae[_0x889d('0x24')]},'auth':_0x56ffe2,'json':!![]};return rp(_0x2b5029)[_0x889d('0xc')](function(_0x2ee6e8){logger[_0x889d('0x10')]('['+[_0x782246['toUpperCase']()]+_0x889d('0x26'),_0x2ee6e8[_0x889d('0xd')]);_0x1710ae[_0x889d('0x27')]=_0x2ee6e8[_0x889d('0xd')][_0x889d('0xf')];_0x696566(_0x1710ae);})[_0x889d('0x13')](function(_0x8bc8c1){logger[_0x889d('0x14')]('['+[_0x782246[_0x889d('0x11')]()]+']',_0x8bc8c1[_0x889d('0x15')]);_0x5d9b1f(_0x8bc8c1[_0x889d('0x15')]);});});}function getEndUser(_0x246843,_0x4b332e,_0x1ebbab,_0x438eef,_0x4aab72){return function(_0x2a7e4e){logger[_0x889d('0x10')]('['+[_0x246843[_0x889d('0x11')]()]+_0x889d('0x28'),_0x2a7e4e);return new Promise(function(_0x519d9b,_0x4816b4){var _0x2b6e11={'method':'GET','uri':_0x1ebbab+'sys_user?sysparm_query=phone%3D'+_0x2a7e4e[_0x889d('0x24')]+'&'+_0x438eef+'&'+_0x4aab72,'auth':_0x4b332e,'json':!![]};return rp(_0x2b6e11)[_0x889d('0xc')](function(_0x25f479){if(_0x25f479['result'][_0x889d('0x1a')]>0x0){_0x2a7e4e[_0x889d('0x27')]=_0x25f479[_0x889d('0xd')][0x0][_0x889d('0xf')];logger['info']('['+[_0x246843[_0x889d('0x11')]()]+_0x889d('0x29'),_0x2a7e4e);_0x519d9b(_0x2a7e4e);}else{return createEndUser(_0x246843,_0x4b332e,_0x2a7e4e,_0x1ebbab,_0x438eef)[_0x889d('0xc')](function(_0x4073f7){logger[_0x889d('0x10')]('['+[_0x246843[_0x889d('0x11')]()]+_0x889d('0x2a'),_0x4073f7);_0x519d9b(_0x4073f7);});}})['catch'](function(_0x5ac4de){logger['error']('['+[_0x246843[_0x889d('0x11')]()]+']',_0x5ac4de['message']);_0x4816b4(_0x5ac4de[_0x889d('0x15')]);});});};}function getCustomFields(_0xf89993,_0x7d0406){var _0x2698b4={};if(_0xf89993[_0x889d('0x1a')]>0x0){_[_0x889d('0x2b')](_0xf89993,function(_0x49aa7d){if(_[_0x889d('0x2c')]([_0x889d('0x2d'),_0x889d('0x2e')],_0x49aa7d[_0x889d('0x2f')])&&_0x49aa7d[_0x889d('0x30')]&&!_0x49aa7d[_0x889d('0x31')]){_0x2698b4[_0x49aa7d[_0x889d('0x30')]['toLowerCase']()]=_0x49aa7d[_0x889d('0x32')][_0x889d('0x33')]();}else if(_[_0x889d('0x2c')]([_0x889d('0x2d'),_0x889d('0x2e')],_0x49aa7d[_0x889d('0x2f')])&&_0x49aa7d[_0x889d('0x34')]&&_0x49aa7d[_0x889d('0x31')]){_0x2698b4[_0x49aa7d[_0x889d('0x34')][_0x889d('0x35')]()]=_0x49aa7d[_0x889d('0x32')][_0x889d('0x33')]();}else if(_0x49aa7d[_0x889d('0x2f')]===_0x889d('0x36')&&_0x49aa7d[_0x889d('0x37')]&&_0x49aa7d[_0x889d('0x34')]&&_0x49aa7d[_0x889d('0x31')]){_0x2698b4[_0x49aa7d[_0x889d('0x34')][_0x889d('0x35')]()]=_0x7d0406[_0x49aa7d[_0x889d('0x37')]][_0x889d('0x33')]();}else if(_0x49aa7d['type']===_0x889d('0x38')&&_0x49aa7d[_0x889d('0x39')]&&_0x49aa7d[_0x889d('0x39')][_0x889d('0x3a')]&&_0x49aa7d['idField']&&_0x49aa7d[_0x889d('0x31')]){_0x2698b4[_0x49aa7d[_0x889d('0x34')]['toLowerCase']()]=_0x7d0406[_0x49aa7d[_0x889d('0x39')][_0x889d('0x3a')][_0x889d('0x35')]()][_0x889d('0x33')]();}});}return _0x2698b4;}function getTicket(_0x24d903,_0x115c4f,_0x5ddeec,_0x5c2baa,_0x3feb18,_0x4b147e){return function(_0x8e3826){logger['info']('['+[_0x24d903[_0x889d('0x11')]()]+_0x889d('0x3b'),_0x8e3826);return new Promise(function(_0x118765,_0x5281a8){var _0x5c3166=_0x24d903[_0x889d('0x35')]()===_0x889d('0x3c')?_0x8e3826[_0x889d('0x1d')]:_0x8e3826[_0x889d('0x27')];var _0x686a26={'method':'POST','uri':_0x5ddeec+_0x889d('0x3d')+'?'+_0x4b147e,'body':Object[_0x889d('0x3e')]({},{'active':_0x889d('0x1c'),'caller_id':_0x5c3166,'assigned_to':_0x8e3826[_0x889d('0x1d')],'short_description':intUtil[_0x889d('0x3f')](_0x5c2baa[_0x889d('0x40')],_0x3feb18,'\x20'),'description':intUtil['getString'](_0x5c2baa[_0x889d('0x41')],_0x3feb18,'\x0a')},getCustomFields(_0x5c2baa[_0x889d('0x42')],_0x3feb18)),'auth':_0x115c4f,'json':!![]};return rp(_0x686a26)['then'](function(_0x5d3b98){logger[_0x889d('0x10')]('['+[_0x24d903[_0x889d('0x11')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x5d3b98[_0x889d('0xd')]);_0x8e3826[_0x889d('0x43')]=_0x5d3b98[_0x889d('0xd')][_0x889d('0xf')];_0x8e3826[_0x889d('0x44')]=_0x5d3b98[_0x889d('0xd')][_0x889d('0x45')];logger['info']('['+[_0x24d903['toUpperCase']()]+_0x889d('0x46'),_0x8e3826);_0x118765(_0x8e3826);})['catch'](function(_0x2ba9a8){logger[_0x889d('0x14')]('['+[_0x24d903[_0x889d('0x11')]()]+']',_0x2ba9a8['message']);_0x5281a8(_0x2ba9a8[_0x889d('0x15')]);});});};}function createRemoteTag(_0x4b784a,_0x222829,_0x5d79bd,_0x2a1930){return new Promise(function(_0x51e5ad,_0x3605af){var _0x5da2be={'method':_0x889d('0x22'),'uri':_0x5d79bd+_0x889d('0x47')+'?'+_0x2a1930,'body':{'short_description':_0x4b784a,'global':!![],'active':!![],'name':_0x4b784a},'auth':_0x222829,'json':!![]};return rp(_0x5da2be)['then'](function(_0x23f035){var _0x2bbd17=_0x23f035['result'][_0x889d('0xf')];_0x51e5ad(_0x2bbd17);});});}function getRemoteTag(_0xd6ea4c,_0x43808b,_0x4c3ff7,_0x48a0aa,_0x58fc2f){return new Promise(function(_0x2ae730,_0x5f4d61){var _0x239438={'method':_0x889d('0xa'),'uri':_0x4c3ff7+_0x889d('0x47')+'?sysparm_query=name%3D'+_0xd6ea4c+'&'+_0x48a0aa,'auth':_0x43808b,'json':!![]};return rp(_0x239438)['then'](function(_0xac305a){if(_0xac305a[_0x889d('0xd')]['length']>0x0){var _0x14f155=_0xac305a['result'][0x0][_0x889d('0xf')];_0x2ae730(_0x14f155);}else{return createRemoteTag(_0xd6ea4c,_0x43808b,_0x4c3ff7,_0x48a0aa)[_0x889d('0xc')](function(_0x4cfea3){_0x2ae730(_0x4cfea3);});}});});}function assignTagToIncident(_0x3eacea,_0xda4c99,_0x14b49d,_0x843197,_0xefc8d4){return new Promise(function(_0x3d063a,_0x5ed7c0){var _0x4d8c19={'method':'POST','uri':_0x14b49d+_0x889d('0x48')+'?'+_0xefc8d4,'body':{'label':_0x3eacea,'table':_0x889d('0x3d'),'id_type':'Incident','table_key':_0x843197[_0x889d('0x43')],'title':_0x889d('0x49')+_0x843197[_0x889d('0x44')],'id_display':_0x843197[_0x889d('0x44')]},'auth':_0xda4c99,'json':!![]};return rp(_0x4d8c19)[_0x889d('0xc')](function(_0x78b529){_0x3d063a();})[_0x889d('0x13')](function(){_0x3d063a();});});}function manageTags(_0x2e0339,_0x16693e,_0xe9bb18,_0x24b85d,_0x431048,_0x50d0a1,_0x5b4638){return new Promise(function(_0x1a3acd,_0x267522){var _0x2e0ca1=[];_0x16693e[_0x889d('0x2b')](function(_0x22b2a8){_0x2e0ca1[_0x889d('0x4a')](getRemoteTag(_0x22b2a8,_0xe9bb18,_0x24b85d,_0x50d0a1,_0x5b4638));});return Promise['all'](_0x2e0ca1)[_0x889d('0xc')](function(_0x3d2d2c){if(_0x3d2d2c[_0x889d('0x1a')]){logger['info']('['+[_0x2e0339['toUpperCase']()]+_0x889d('0x4b'),_0x3d2d2c);var _0x511251=[];_0x3d2d2c['forEach'](function(_0x19f10f){_0x511251[_0x889d('0x4a')](assignTagToIncident(_0x19f10f,_0xe9bb18,_0x24b85d,_0x431048,_0x50d0a1));});return Promise['all'](_0x511251)[_0x889d('0xc')](function(){_0x1a3acd();})['catch'](function(){_0x1a3acd();});}else{_0x1a3acd();}});});}function getTags(_0x22510e,_0x3cefce,_0x38ab4f,_0x20d283,_0x23d9ad,_0x32b303){return function(_0x5ef721){return new Promise(function(_0x42d77d,_0x19d394){var _0x3ac248=[];var _0x5a0396=_0x20d283[_0x889d('0x4c')];if(_0x5a0396&&_0x5a0396[_0x889d('0x1a')]>0x0){_0x3ac248=_['map'](_0x5a0396,_0x889d('0x3a'));}if(_0x3ac248[_0x889d('0x1a')]>0x0){return manageTags(_0x22510e,_0x3ac248,_0x3cefce,_0x38ab4f,_0x5ef721,_0x23d9ad,_0x32b303)[_0x889d('0xc')](function(){_0x42d77d(_0x5ef721);});}else{_0x42d77d(_0x5ef721);}});};}function emit(_0x3cb864,_0x496bfe,_0x72a20c){var _0x47ae19=_0x889d('0x4d')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x889d('0x4e')+_0x889d('0x4f');var _0xa67400={'uri':_0x3cb864+_0x889d('0x50')+_0x72a20c+_0x47ae19};io['to'](util[_0x889d('0x51')](_0x889d('0x52'),_0x496bfe))[_0x889d('0x53')](_0x889d('0x54'),_0xa67400);}exports['cs']=function(_0x128b48,_0x48ac8c,_0x4843c7,_0x4e543f,_0x3c106b,_0x5a9620,_0xe51ef4,_0x11413c){var _0x31d927={};var _0x3cf850={'user':_0x5a9620['username'],'pass':_0x5a9620[_0x889d('0x55')]};var _0x5aa604=_0x889d('0x56');var _0x3c1988=_0x889d('0x57');_0x5a9620[_0x889d('0x58')]=intUtil[_0x889d('0x59')](_0x5a9620['remoteUri']);_0x5a9620[_0x889d('0x5a')]=intUtil[_0x889d('0x59')](_0x5a9620['serverUrl']);var _0x28abd6=util[_0x889d('0x51')](_0x889d('0x5b'),_0x5a9620['remoteUri']);_0x31d927[_0x889d('0x18')]=!_[_0x889d('0x5c')](_0x4e543f)?_0x4e543f[_0x889d('0x5d')]:null;_0x31d927[_0x889d('0x1e')]=_0x5a9620[_0x889d('0x5d')];_0x31d927['endUserNumber']=_0x11413c[_0x889d('0x35')]()==='outbound'?_0x48ac8c[_0x889d('0x5e')]:_0x48ac8c[_0x889d('0x5f')];_0x31d927[_0x889d('0x60')]=_0x11413c===_0x889d('0x61')||_0x11413c==='unmanaged'?_0x889d('0x61'):_0x889d('0x3c');var _0x537545=util[_0x889d('0x51')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5a9620['serverUrl'],_0x48ac8c[_0x889d('0x62')],md5(_0x48ac8c['uniqueid']));if(_0x3c106b&&_0x3c106b[_0x889d('0x63')]){logger['info'](_0x889d('0x64'),'Recording\x20is\x20enabled!');_0x48ac8c[_0x889d('0x65')]=_0x537545;}else if(_0xe51ef4&&_0xe51ef4[_0x889d('0x66')]&&_0xe51ef4[_0x889d('0x66')]!==_0x889d('0x67')){logger[_0x889d('0x10')](_0x889d('0x68'),_0x889d('0x69'));_0x48ac8c[_0x889d('0x65')]=_0x537545;}else{_0x48ac8c[_0x889d('0x65')]='';}return getAdminUser(_0x11413c,_0x3cf850,_0x31d927,_0x28abd6,_0x3c1988,_0x5aa604)[_0x889d('0xc')](getUser(_0x11413c,_0x3cf850,_0x28abd6,_0x3c1988,_0x5aa604))['then'](getEndUser(_0x11413c,_0x3cf850,_0x28abd6,_0x3c1988,_0x5aa604))[_0x889d('0xc')](getTicket(_0x11413c,_0x3cf850,_0x28abd6,_0x4843c7,_0x48ac8c,_0x3c1988))['then'](function(_0x3f9e27){logger['info'](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x3f9e27['ticketId']));logger[_0x889d('0x10')](util[_0x889d('0x51')](_0x889d('0x6a'),_0x11413c));if(_0x11413c!==_0x889d('0x6b')){logger[_0x889d('0x10')]('['+[_0x11413c[_0x889d('0x11')]()]+']',_0x889d('0x6c'));emit(_0x5a9620[_0x889d('0x58')],_0x4e543f['name'],_0x3f9e27['ticketId']);}})[_0x889d('0x13')](function(_0x4f5217){logger[_0x889d('0x14')]('['+[_0x11413c['toUpperCase']()]+_0x889d('0x6d'),util[_0x889d('0x6e')](_0x4f5217,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x617a=['picklist','nameField','customField','content','toString','includes','type','idField','variable','toLowerCase','variableName','customVariable','Variable','name','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','label_entry','Incident','Incident\x20-\x20','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','Tags','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','isNil','adminEmail','email','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','util','ioredis','./util','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','info','],\x20getAdminUser\x20crm','catch','toUpperCase','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','length','active','true','userId','],\x20getUser\x20crm','error','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','string'];(function(_0x30378e,_0x3a4210){var _0x338f92=function(_0x42fca7){while(--_0x42fca7){_0x30378e['push'](_0x30378e['shift']());}};_0x338f92(++_0x3a4210);}(_0x617a,0xb2));var _0xa617=function(_0x27cfff,_0x468e33){_0x27cfff=_0x27cfff-0x0;var _0x4051cc=_0x617a[_0x27cfff];return _0x4051cc;};'use strict';var _=require(_0xa617('0x0'));var Promise=require(_0xa617('0x1'));var rp=require('request-promise');var util=require(_0xa617('0x2'));var md5=require('md5');var Redis=require(_0xa617('0x3'));var intUtil=require(_0xa617('0x4'));var config=require('../../../../config/environment');var logger=require(_0xa617('0x5'))(_0xa617('0x6'));config[_0xa617('0x7')]=_[_0xa617('0x8')](config[_0xa617('0x7')],{'host':_0xa617('0x9'),'port':0x18eb});var io=require(_0xa617('0xa'))(new Redis(config[_0xa617('0x7')]));function getAdminUser(_0x57f7a1,_0x5f3941,_0x3e9675,_0x4194af,_0x20fbef,_0x5944fa){return new Promise(function(_0xc985e0,_0x468302){var _0x116ea2={'method':_0xa617('0xb'),'uri':_0x4194af+_0xa617('0xc')+'&'+_0x20fbef+'&'+_0x5944fa,'auth':_0x5f3941,'json':!![]};return rp(_0x116ea2)[_0xa617('0xd')](function(_0x38a6cb){if(_0x38a6cb[_0xa617('0xe')]['length']>0x0){_0x3e9675[_0xa617('0xf')]=_0x38a6cb[_0xa617('0xe')][0x0][_0xa617('0x10')];}logger[_0xa617('0x11')]('['+[_0x57f7a1['toUpperCase']()]+_0xa617('0x12'),_0x3e9675);_0xc985e0(_0x3e9675);})[_0xa617('0x13')](function(_0x58395d){logger['error']('['+[_0x57f7a1[_0xa617('0x14')]()]+']',_0x58395d[_0xa617('0x15')]);_0x468302(_0x58395d[_0xa617('0x15')]);});});}function getUser(_0x8a79dd,_0x29ec9b,_0x3d497f,_0x11d5bf,_0x5d0dd9){return function(_0x209982){logger[_0xa617('0x11')]('['+[_0x8a79dd[_0xa617('0x14')]()]+_0xa617('0x16'),_0x209982);return new Promise(function(_0x509de8,_0x2ef095){if(intUtil[_0xa617('0x17')](_0x209982[_0xa617('0x18')])){var _0x587b50={'method':_0xa617('0xb'),'uri':_0x3d497f+_0xa617('0x19')+_0x209982['userEmail']+'&'+_0x11d5bf+'&'+_0x5d0dd9,'auth':_0x29ec9b,'json':!![]};logger[_0xa617('0x11')]('['+[_0x8a79dd[_0xa617('0x14')]()]+'],\x20getUser\x20rp\x20obj',_0x587b50);return rp(_0x587b50)['then'](function(_0x308316){logger[_0xa617('0x11')]('['+[_0x8a79dd[_0xa617('0x14')]()]+_0xa617('0x1a'),_0x308316);if(_0x308316[_0xa617('0xe')][_0xa617('0x1b')]>0x0&&String(_0x308316[_0xa617('0xe')][0x0][_0xa617('0x1c')])===_0xa617('0x1d')){_0x209982[_0xa617('0x1e')]=_0x308316['result'][0x0][_0xa617('0x10')];}else{_0x209982[_0xa617('0x1e')]=_0x209982[_0xa617('0xf')];_0x209982[_0xa617('0x18')]=_0x209982['adminEmail'];}logger['info']('['+[_0x8a79dd[_0xa617('0x14')]()]+_0xa617('0x1f'),_0x209982);_0x509de8(_0x209982);})[_0xa617('0x13')](function(_0x14a097){logger[_0xa617('0x20')]('['+[_0x8a79dd['toUpperCase']()]+']',_0x14a097['message']);_0x2ef095(_0x14a097[_0xa617('0x15')]);});}else{logger[_0xa617('0x11')]('['+[_0x8a79dd[_0xa617('0x14')]()]+']\x20using\x20admin\x20profile');_0x209982[_0xa617('0x1e')]=_0x209982[_0xa617('0xf')];_0x209982[_0xa617('0x18')]=_0x209982['adminEmail'];_0x509de8(_0x209982);}});};}function createEndUser(_0xd09f0f,_0x202287,_0x1255b3,_0x48e9ac,_0xde7bf7){logger[_0xa617('0x11')]('['+[_0xd09f0f[_0xa617('0x14')]()]+_0xa617('0x21'),_0x1255b3);return new Promise(function(_0x4a3a50,_0x32043e){var _0x47d26b={'method':_0xa617('0x22'),'uri':_0x48e9ac+_0xa617('0x23')+_0xde7bf7,'body':{'user_name':_0x1255b3[_0xa617('0x24')],'roles':'user','first_name':_0x1255b3['endUserNumber'],'active':_0xa617('0x1d'),'date_format':'System','phone':_0x1255b3[_0xa617('0x24')]},'auth':_0x202287,'json':!![]};return rp(_0x47d26b)['then'](function(_0x173b87){logger[_0xa617('0x11')]('['+[_0xd09f0f[_0xa617('0x14')]()]+_0xa617('0x25'),_0x173b87[_0xa617('0xe')]);_0x1255b3[_0xa617('0x26')]=_0x173b87[_0xa617('0xe')][_0xa617('0x10')];_0x4a3a50(_0x1255b3);})['catch'](function(_0x54c21b){logger[_0xa617('0x20')]('['+[_0xd09f0f[_0xa617('0x14')]()]+']',_0x54c21b[_0xa617('0x15')]);_0x32043e(_0x54c21b[_0xa617('0x15')]);});});}function getEndUser(_0x4c7a00,_0x478d6f,_0x404715,_0x5ba3c0,_0x49ba07){return function(_0x36df4a){logger['info']('['+[_0x4c7a00[_0xa617('0x14')]()]+_0xa617('0x27'),_0x36df4a);return new Promise(function(_0x161bf1,_0x374ed3){var _0x322631={'method':'GET','uri':_0x404715+'sys_user?sysparm_query=phone%3D'+_0x36df4a[_0xa617('0x24')]+'&'+_0x5ba3c0+'&'+_0x49ba07,'auth':_0x478d6f,'json':!![]};return rp(_0x322631)['then'](function(_0x2df2d8){if(_0x2df2d8[_0xa617('0xe')]['length']>0x0){_0x36df4a[_0xa617('0x26')]=_0x2df2d8[_0xa617('0xe')][0x0]['sys_id'];logger['info']('['+[_0x4c7a00[_0xa617('0x14')]()]+_0xa617('0x28'),_0x36df4a);_0x161bf1(_0x36df4a);}else{return createEndUser(_0x4c7a00,_0x478d6f,_0x36df4a,_0x404715,_0x5ba3c0)[_0xa617('0xd')](function(_0x26dd17){logger[_0xa617('0x11')]('['+[_0x4c7a00['toUpperCase']()]+_0xa617('0x29'),_0x26dd17);_0x161bf1(_0x26dd17);});}})[_0xa617('0x13')](function(_0x15baf3){logger[_0xa617('0x20')]('['+[_0x4c7a00[_0xa617('0x14')]()]+']',_0x15baf3['message']);_0x374ed3(_0x15baf3['message']);});});};}function getCustomFields(_0x37ff4f,_0x284679){var _0x44493c={};if(_0x37ff4f[_0xa617('0x1b')]>0x0){_[_0xa617('0x2a')](_0x37ff4f,function(_0x41a9bc){if(_['includes']([_0xa617('0x2b'),_0xa617('0x2c')],_0x41a9bc['type'])&&_0x41a9bc[_0xa617('0x2d')]&&!_0x41a9bc[_0xa617('0x2e')]){_0x44493c[_0x41a9bc['nameField']['toLowerCase']()]=_0x41a9bc[_0xa617('0x2f')][_0xa617('0x30')]();}else if(_[_0xa617('0x31')]([_0xa617('0x2b'),'picklist'],_0x41a9bc[_0xa617('0x32')])&&_0x41a9bc[_0xa617('0x33')]&&_0x41a9bc[_0xa617('0x2e')]){_0x44493c[_0x41a9bc[_0xa617('0x33')]['toLowerCase']()]=_0x41a9bc[_0xa617('0x2f')]['toString']();}else if(_0x41a9bc[_0xa617('0x32')]===_0xa617('0x34')&&_0x41a9bc['variableName']&&_0x41a9bc['idField']&&_0x41a9bc[_0xa617('0x2e')]){_0x44493c[_0x41a9bc['idField'][_0xa617('0x35')]()]=_0x284679[_0x41a9bc[_0xa617('0x36')]][_0xa617('0x30')]();}else if(_0x41a9bc[_0xa617('0x32')]===_0xa617('0x37')&&_0x41a9bc['Variable']&&_0x41a9bc[_0xa617('0x38')][_0xa617('0x39')]&&_0x41a9bc['idField']&&_0x41a9bc['customField']){_0x44493c[_0x41a9bc[_0xa617('0x33')][_0xa617('0x35')]()]=_0x284679[_0x41a9bc[_0xa617('0x38')][_0xa617('0x39')][_0xa617('0x35')]()][_0xa617('0x30')]();}});}return _0x44493c;}function getTicket(_0x19de85,_0x13be48,_0x58ac2d,_0x9ab19b,_0xda182b,_0x45d800){return function(_0x220b24){logger['info']('['+[_0x19de85[_0xa617('0x14')]()]+']\x20getTicket\x20input\x20crm',_0x220b24);return new Promise(function(_0x5d471a,_0x235fa1){var _0xfa6eb=_0x19de85['toLowerCase']()===_0xa617('0x3a')?_0x220b24[_0xa617('0x1e')]:_0x220b24[_0xa617('0x26')];var _0x545703={'method':_0xa617('0x22'),'uri':_0x58ac2d+_0xa617('0x3b')+'?'+_0x45d800,'body':Object[_0xa617('0x3c')]({},{'active':_0xa617('0x1d'),'caller_id':_0xfa6eb,'assigned_to':_0x220b24[_0xa617('0x1e')],'short_description':intUtil[_0xa617('0x3d')](_0x9ab19b[_0xa617('0x3e')],_0xda182b,'\x20'),'description':intUtil[_0xa617('0x3d')](_0x9ab19b[_0xa617('0x3f')],_0xda182b,'\x0a')},getCustomFields(_0x9ab19b[_0xa617('0x40')],_0xda182b)),'auth':_0x13be48,'json':!![]};return rp(_0x545703)['then'](function(_0x206b68){logger[_0xa617('0x11')]('['+[_0x19de85[_0xa617('0x14')]()]+_0xa617('0x41'),_0x206b68[_0xa617('0xe')]);_0x220b24[_0xa617('0x42')]=_0x206b68['result'][_0xa617('0x10')];_0x220b24[_0xa617('0x43')]=_0x206b68['result'][_0xa617('0x44')];logger[_0xa617('0x11')]('['+[_0x19de85[_0xa617('0x14')]()]+']\x20getTicket\x20crm',_0x220b24);_0x5d471a(_0x220b24);})[_0xa617('0x13')](function(_0x5b6221){logger[_0xa617('0x20')]('['+[_0x19de85[_0xa617('0x14')]()]+']',_0x5b6221['message']);_0x235fa1(_0x5b6221['message']);});});};}function createRemoteTag(_0x23c241,_0x5a194c,_0x5d333c,_0x4afcac){return new Promise(function(_0x30ec53,_0x291777){var _0x43ddae={'method':_0xa617('0x22'),'uri':_0x5d333c+'label'+'?'+_0x4afcac,'body':{'short_description':_0x23c241,'global':!![],'active':!![],'name':_0x23c241},'auth':_0x5a194c,'json':!![]};return rp(_0x43ddae)['then'](function(_0x2ae9e9){var _0x1e161a=_0x2ae9e9[_0xa617('0xe')][_0xa617('0x10')];_0x30ec53(_0x1e161a);});});}function getRemoteTag(_0xdff1ea,_0x446241,_0x2dee64,_0x268095,_0x3d3007){return new Promise(function(_0xc957d5,_0x3a0cd1){var _0x1db257={'method':_0xa617('0xb'),'uri':_0x2dee64+_0xa617('0x45')+'?sysparm_query=name%3D'+_0xdff1ea+'&'+_0x268095,'auth':_0x446241,'json':!![]};return rp(_0x1db257)[_0xa617('0xd')](function(_0x5146d5){if(_0x5146d5[_0xa617('0xe')][_0xa617('0x1b')]>0x0){var _0x174808=_0x5146d5[_0xa617('0xe')][0x0][_0xa617('0x10')];_0xc957d5(_0x174808);}else{return createRemoteTag(_0xdff1ea,_0x446241,_0x2dee64,_0x268095)[_0xa617('0xd')](function(_0x1cfbb8){_0xc957d5(_0x1cfbb8);});}});});}function assignTagToIncident(_0x4d9792,_0x46ffe5,_0x584fd4,_0x47224e,_0x47c577){return new Promise(function(_0x24aab8,_0x5922c3){var _0x748c5f={'method':_0xa617('0x22'),'uri':_0x584fd4+_0xa617('0x46')+'?'+_0x47c577,'body':{'label':_0x4d9792,'table':_0xa617('0x3b'),'id_type':_0xa617('0x47'),'table_key':_0x47224e[_0xa617('0x42')],'title':_0xa617('0x48')+_0x47224e[_0xa617('0x43')],'id_display':_0x47224e[_0xa617('0x43')]},'auth':_0x46ffe5,'json':!![]};return rp(_0x748c5f)[_0xa617('0xd')](function(_0x4c5661){_0x24aab8();})['catch'](function(){_0x24aab8();});});}function manageTags(_0x2f5df0,_0x985e8f,_0x116da4,_0x52825e,_0x1cf4fe,_0x16b9e5,_0x4fa56c){return new Promise(function(_0x333ca2,_0xcfda85){var _0x57d01d=[];_0x985e8f['forEach'](function(_0x5bb1c7){_0x57d01d[_0xa617('0x49')](getRemoteTag(_0x5bb1c7,_0x116da4,_0x52825e,_0x16b9e5,_0x4fa56c));});return Promise['all'](_0x57d01d)[_0xa617('0xd')](function(_0x5a1312){if(_0x5a1312[_0xa617('0x1b')]){logger[_0xa617('0x11')]('['+[_0x2f5df0[_0xa617('0x14')]()]+_0xa617('0x4a'),_0x5a1312);var _0x160806=[];_0x5a1312[_0xa617('0x2a')](function(_0x5cf7c0){_0x160806[_0xa617('0x49')](assignTagToIncident(_0x5cf7c0,_0x116da4,_0x52825e,_0x1cf4fe,_0x16b9e5));});return Promise[_0xa617('0x4b')](_0x160806)[_0xa617('0xd')](function(){_0x333ca2();})[_0xa617('0x13')](function(){_0x333ca2();});}else{_0x333ca2();}});});}function getTags(_0x52b395,_0x4ba106,_0x50bd45,_0x3ee049,_0x5686a1,_0x222573){return function(_0x5b4be7){return new Promise(function(_0x58a6ab,_0x954696){var _0x2fc16b=[];var _0x34e2b1=_0x3ee049[_0xa617('0x4c')];if(_0x34e2b1&&_0x34e2b1['length']>0x0){_0x2fc16b=_['map'](_0x34e2b1,_0xa617('0x39'));}if(_0x2fc16b[_0xa617('0x1b')]>0x0){return manageTags(_0x52b395,_0x2fc16b,_0x4ba106,_0x50bd45,_0x5b4be7,_0x5686a1,_0x222573)['then'](function(){_0x58a6ab(_0x5b4be7);});}else{_0x58a6ab(_0x5b4be7);}});};}function emit(_0x38042c,_0x637afd,_0x164aed){var _0x380cc1='%26sysparm_record_target%3Dincident'+_0xa617('0x4d')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0xa617('0x4e');var _0x11897d={'uri':_0x38042c+_0xa617('0x4f')+_0x164aed+_0x380cc1};io['to'](util['format']('user:%s',_0x637afd))[_0xa617('0x50')](_0xa617('0x51'),_0x11897d);}exports['cs']=function(_0x2f7549,_0x31d35e,_0x1aa029,_0x576175,_0x1d040b,_0x1168d3,_0x40719b,_0x4b186c){var _0x193f77={};var _0x546726={'user':_0x1168d3[_0xa617('0x52')],'pass':_0x1168d3[_0xa617('0x53')]};var _0x3f102f=_0xa617('0x54');var _0x345a58=_0xa617('0x55');_0x1168d3[_0xa617('0x56')]=intUtil[_0xa617('0x57')](_0x1168d3[_0xa617('0x56')]);_0x1168d3[_0xa617('0x58')]=intUtil[_0xa617('0x57')](_0x1168d3[_0xa617('0x58')]);var _0x1a14c7=util[_0xa617('0x59')](_0xa617('0x5a'),_0x1168d3[_0xa617('0x56')]);_0x193f77['userEmail']=!_[_0xa617('0x5b')](_0x576175)?_0x576175['email']:null;_0x193f77[_0xa617('0x5c')]=_0x1168d3[_0xa617('0x5d')];_0x193f77[_0xa617('0x24')]=_0x4b186c[_0xa617('0x35')]()===_0xa617('0x3a')?_0x31d35e[_0xa617('0x5e')]:_0x31d35e[_0xa617('0x5f')];_0x193f77[_0xa617('0x60')]=_0x4b186c==='queue'||_0x4b186c==='unmanaged'?_0xa617('0x61'):_0xa617('0x3a');var _0x10818c=util[_0xa617('0x59')](_0xa617('0x62'),_0x1168d3[_0xa617('0x58')],_0x31d35e[_0xa617('0x63')],md5(_0x31d35e[_0xa617('0x63')]));if(_0x1d040b&&_0x1d040b['monitor_format']){logger[_0xa617('0x11')](_0xa617('0x64'),_0xa617('0x65'));_0x31d35e['recordingURL']=_0x10818c;}else if(_0x40719b&&_0x40719b['recordingFormat']&&_0x40719b[_0xa617('0x66')]!==_0xa617('0x67')){logger[_0xa617('0x11')]('[OUTBOUND]',_0xa617('0x65'));_0x31d35e[_0xa617('0x68')]=_0x10818c;}else{_0x31d35e[_0xa617('0x68')]='';}return getAdminUser(_0x4b186c,_0x546726,_0x193f77,_0x1a14c7,_0x345a58,_0x3f102f)[_0xa617('0xd')](getUser(_0x4b186c,_0x546726,_0x1a14c7,_0x345a58,_0x3f102f))[_0xa617('0xd')](getEndUser(_0x4b186c,_0x546726,_0x1a14c7,_0x345a58,_0x3f102f))[_0xa617('0xd')](getTicket(_0x4b186c,_0x546726,_0x1a14c7,_0x1aa029,_0x31d35e,_0x345a58))[_0xa617('0xd')](function(_0x267865){logger[_0xa617('0x11')](util['format'](_0xa617('0x69'),_0x267865['ticketId']));logger['info'](util[_0xa617('0x59')](_0xa617('0x6a'),_0x4b186c));if(_0x4b186c!==_0xa617('0x6b')){logger['info']('['+[_0x4b186c[_0xa617('0x14')]()]+']',_0xa617('0x6c'));emit(_0x1168d3['remoteUri'],_0x576175[_0xa617('0x39')],_0x267865[_0xa617('0x42')]);}})[_0xa617('0x13')](function(_0x297b5f){logger[_0xa617('0x20')]('['+[_0x4b186c[_0xa617('0x14')]()]+_0xa617('0x6d'),util[_0xa617('0x6e')](_0x297b5f,{'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 987f14c..b91963e 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 _0xe1ef=['%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','users','contacts','version','charAt','trigger:browser:url','catch','error','outbound','uri','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','unmanaged','monitor_format','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Inbound','request-promise','bluebird','md5','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','Descriptions','date_start','toISOString','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','length','forEach','push','idField','variableName','set_entry','JSON','stringify','Calls','apiKey','toString','get_server_info','isNil','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','find','entry_list','name_value_list','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','first_name','','Enduser\x20created.','debug','merge','map','type','string','customField','nameField','content','custom_fields','customVariable','Variable','toLowerCase','POST','login','username','password','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl'];(function(_0x2c8a32,_0x46f29e){var _0x22b3d7=function(_0x4d681a){while(--_0x4d681a){_0x2c8a32['push'](_0x2c8a32['shift']());}};_0x22b3d7(++_0x46f29e);}(_0xe1ef,0x181));var _0xfe1e=function(_0x4714b5,_0x44715c){_0x4714b5=_0x4714b5-0x0;var _0x1c9570=_0xe1ef[_0x4714b5];return _0x1c9570;};'use strict';var _=require('lodash');var rp=require(_0xfe1e('0x0'));var BPromise=require(_0xfe1e('0x1'));var md5=require(_0xfe1e('0x2'));var util=require('util');var Redis=require(_0xfe1e('0x3'));var intUtil=require('./util');var config=require(_0xfe1e('0x4'));var logger=require(_0xfe1e('0x5'))(_0xfe1e('0x6'));config[_0xfe1e('0x7')]=_[_0xfe1e('0x8')](config[_0xfe1e('0x7')],{'host':_0xfe1e('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfe1e('0x7')]));var def={'method':'POST','json':!![]};function emit(_0x2a7ae7,_0x23edb4,_0x4c9753){io['to'](_0x2a7ae7)['emit'](_0x23edb4,_0x4c9753);}function getTicket(_0x346d3f,_0x355161,_0x380693,_0x45d994,_0x35aeb5,_0x5cf391,_0x558bce,_0x58fd42){logger[_0xfe1e('0xa')](_0xfe1e('0xb'));var _0x1685ed=new Date();var _0x4e86a7=[{'name':_0xfe1e('0xc'),'value':intUtil[_0xfe1e('0xd')](_0x45d994[_0xfe1e('0xe')],_0x35aeb5,'\x20')},{'name':_0xfe1e('0xf'),'value':_0x355161['id']},{'name':'created_by','value':_0x355161['id']},{'name':'description','value':intUtil[_0xfe1e('0xd')](_0x45d994[_0xfe1e('0x10')],_0x35aeb5,'\x0a')},{'name':_0xfe1e('0x11'),'value':_0x1685ed[_0xfe1e('0x12')]()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0xfe1e('0x13'),'value':'0'},{'name':_0xfe1e('0x14'),'value':'15'},{'name':_0xfe1e('0x15'),'value':_0x380693['id']},{'name':_0xfe1e('0x16'),'value':'Contacts'},{'name':_0xfe1e('0x17'),'value':_0x380693['name']},{'name':_0xfe1e('0x18'),'value':_0x58fd42}];if(_0x5cf391[_0xfe1e('0x19')]){_[_0xfe1e('0x1a')](_0x5cf391,function(_0x39fb09){if(_0x35aeb5[_0x39fb09['variableName']]){_0x4e86a7[_0xfe1e('0x1b')]({'name':_0x39fb09[_0xfe1e('0x1c')],'value':_0x35aeb5[_0x39fb09[_0xfe1e('0x1d')]]});}});}return request({'form':{'method':_0xfe1e('0x1e'),'input_type':_0xfe1e('0x1f'),'response_type':_0xfe1e('0x1f'),'rest_data':JSON[_0xfe1e('0x20')]({'session':_0x558bce['id'],'module_name':_0xfe1e('0x21'),'name_value_list':_0x4e86a7})}});}function getAuth(_0x21fa40){return util['format']('Basic\x20%s',new Buffer(_0x21fa40[_0xfe1e('0x22')]+':X')[_0xfe1e('0x23')]('base64'));}function getServerInfo(_0x70e8d4){return request({'form':{'method':_0xfe1e('0x24'),'input_type':_0xfe1e('0x1f'),'response_type':_0xfe1e('0x1f'),'rest_data':JSON[_0xfe1e('0x20')]({'session':_0x70e8d4['id']})}});}function getUser(_0x35ccf2,_0x378288,_0x306c0d){if(!_[_0xfe1e('0x25')](_0x378288)){logger[_0xfe1e('0xa')]('Getting\x20agent\x20with\x20name',_0x378288);return request({'form':{'method':'get_entry_list','input_type':_0xfe1e('0x1f'),'response_type':_0xfe1e('0x1f'),'rest_data':JSON[_0xfe1e('0x20')]({'session':_0x306c0d['id'],'module_name':_0xfe1e('0x26'),'query':util[_0xfe1e('0x27')](_0xfe1e('0x28'),_0x378288),'order_by':'','offset':'0','select_fields':['id',_0xfe1e('0xc'),_0xfe1e('0x29')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xfe1e('0x2a')](function(_0x14675c){if(_0x14675c['entry_list']['length']){var _0x170937=_[_0xfe1e('0x2b')](_0x14675c[_0xfe1e('0x2c')],function(_0x48f8b8){return _0x48f8b8[_0xfe1e('0x2d')][_0xfe1e('0x29')]['value']===_0x378288;});if(_0x170937){logger['info']('Agent\x20found!');return BPromise[_0xfe1e('0x2e')]({'id':_0x170937[_0xfe1e('0x2d')]['id'][_0xfe1e('0x2f')],'name':_0x170937[_0xfe1e('0x2d')][_0xfe1e('0xc')]['value']});}}logger[_0xfe1e('0xa')](_0xfe1e('0x30'));return BPromise['resolve']({'id':_0x306c0d[_0xfe1e('0x2d')][_0xfe1e('0x31')][_0xfe1e('0x2f')],'name':_0x306c0d[_0xfe1e('0x2d')][_0xfe1e('0x29')][_0xfe1e('0x2f')]});});}else{logger[_0xfe1e('0xa')](_0xfe1e('0x32'));return BPromise[_0xfe1e('0x2e')]({'id':_0x306c0d[_0xfe1e('0x2d')][_0xfe1e('0x31')]['value'],'name':_0x306c0d[_0xfe1e('0x2d')][_0xfe1e('0x29')][_0xfe1e('0x2f')]});}}function getEndUser(_0x46339f,_0xb434e9,_0x18b1f6,_0x5dd522){logger[_0xfe1e('0xa')]('Searching\x20enduser\x20with\x20phone',_0x18b1f6);return request({'form':{'method':_0xfe1e('0x33'),'input_type':_0xfe1e('0x1f'),'response_type':_0xfe1e('0x1f'),'rest_data':JSON[_0xfe1e('0x20')]({'session':_0x5dd522['id'],'module_name':'Contacts','query':util[_0xfe1e('0x27')](_0xfe1e('0x34'),_0x18b1f6),'order_by':'','offset':'0','select_fields':['id',_0xfe1e('0xc'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x4b44b7){if(_0x4b44b7[_0xfe1e('0x2c')][_0xfe1e('0x19')]){var _0x3dd43b=_[_0xfe1e('0x2b')](_0x4b44b7[_0xfe1e('0x2c')],function(_0x1b3b92){return _0x1b3b92['name_value_list'][_0xfe1e('0x35')][_0xfe1e('0x2f')]===_0x18b1f6;});if(_0x3dd43b){logger[_0xfe1e('0xa')](_0xfe1e('0x36'));return BPromise[_0xfe1e('0x2e')]({'id':_0x3dd43b[_0xfe1e('0x2d')]['id'][_0xfe1e('0x2f')],'name':_0x3dd43b['name_value_list'][_0xfe1e('0xc')][_0xfe1e('0x2f')],'phone':_0x3dd43b[_0xfe1e('0x2d')][_0xfe1e('0x35')]['value']});}}else{logger[_0xfe1e('0xa')](_0xfe1e('0x37'));return request({'form':{'method':_0xfe1e('0x1e'),'input_type':_0xfe1e('0x1f'),'response_type':_0xfe1e('0x1f'),'rest_data':JSON[_0xfe1e('0x20')]({'session':_0x5dd522['id'],'module_name':_0xfe1e('0x38'),'name_value_list':[{'name':_0xfe1e('0x39'),'value':_0xb434e9!==_0xfe1e('0x3a')?_0xb434e9:util[_0xfe1e('0x27')]('Caller\x20-\x20%s',_0x18b1f6)},{'name':_0xfe1e('0x35'),'value':_0x18b1f6}]})}})[_0xfe1e('0x2a')](function(_0x2e5d1f){logger[_0xfe1e('0xa')](_0xfe1e('0x3b'));return BPromise[_0xfe1e('0x2e')]({'id':_0x2e5d1f['id'],'name':_0x2e5d1f[_0xfe1e('0x2c')]['first_name'][_0xfe1e('0x2f')],'phone':_0x2e5d1f['entry_list']['phone_home']['value']});});}});}function request(_0x5207ce){logger[_0xfe1e('0x3c')]('[HTTP]',JSON[_0xfe1e('0x20')](_0x5207ce));return rp(_[_0xfe1e('0x3d')](def,_0x5207ce));}function getTags(_0x5a55d3,_0xa6843c){var _0x160679=[];if(_0x5a55d3&&_0x5a55d3[_0xfe1e('0x19')]>0x0){_0x160679=_[_0xfe1e('0x3e')](_0x5a55d3,_0xa6843c);}return _0x160679;}function getCustomFields(_0x567a6b,_0x535cff){var _0x5f2667=[];var _0x25cf56={'custom_fields':[]};if(_0x567a6b[_0xfe1e('0x19')]>0x0){_[_0xfe1e('0x1a')](_0x567a6b,function(_0x4490d3){if(_0x4490d3[_0xfe1e('0x3f')]===_0xfe1e('0x40')&&_0x4490d3['nameField']&&!_0x4490d3[_0xfe1e('0x41')]){_0x25cf56[_0x4490d3[_0xfe1e('0x42')]['toLowerCase']()]=_0x4490d3[_0xfe1e('0x43')][_0xfe1e('0x23')]();}else if(_0x4490d3[_0xfe1e('0x3f')]===_0xfe1e('0x40')&&_0x4490d3[_0xfe1e('0x1c')]&&_0x4490d3[_0xfe1e('0x41')]){_0x25cf56[_0xfe1e('0x44')][_0xfe1e('0x1b')]({'id':_0x4490d3[_0xfe1e('0x1c')],'value':_0x4490d3[_0xfe1e('0x43')][_0xfe1e('0x23')]()});}else if(_0x4490d3[_0xfe1e('0x3f')]==='variable'&&_0x4490d3['variableName']&&_0x4490d3[_0xfe1e('0x1c')]&&_0x4490d3[_0xfe1e('0x41')]){_0x535cff[_0x4490d3[_0xfe1e('0x1d')]]&&_0x25cf56[_0xfe1e('0x44')]['push']({'id':_0x4490d3['idField'],'value':_0x535cff[_0x4490d3[_0xfe1e('0x1d')]]['toString']()});}else if(_0x4490d3[_0xfe1e('0x3f')]===_0xfe1e('0x45')&&_0x4490d3[_0xfe1e('0x46')]&&_0x4490d3[_0xfe1e('0x46')][_0xfe1e('0xc')]&&_0x4490d3[_0xfe1e('0x1c')]&&_0x4490d3[_0xfe1e('0x41')]){_0x535cff[_0x4490d3[_0xfe1e('0x46')]['name'][_0xfe1e('0x47')]()]&&_0x25cf56[_0xfe1e('0x44')]['push']({'id':_0x4490d3[_0xfe1e('0x1c')],'value':_0x535cff[_0x4490d3['Variable'][_0xfe1e('0xc')][_0xfe1e('0x47')]()][_0xfe1e('0x23')]()});}});}return _0x25cf56;}function getConnection(_0x4cff86){return request({'method':_0xfe1e('0x48'),'form':{'method':_0xfe1e('0x49'),'input_type':'JSON','response_type':_0xfe1e('0x1f'),'rest_data':JSON[_0xfe1e('0x20')]({'user_auth':{'user_name':_0x4cff86[_0xfe1e('0x4a')],'password':_0x4cff86[_0xfe1e('0x4b')],'encryption':'PLAIN'},'application':_0xfe1e('0x4c')})}})[_0xfe1e('0x2a')](function(_0x5667f2){var _0x232435=_0x5667f2;if(_0x232435['id']){def['sessionID']=_0x232435['id'];return BPromise[_0xfe1e('0x2e')](_0x232435);}else{throw new Error(util[_0xfe1e('0x27')](_0xfe1e('0x4d'),_0x4cff86['id']));}});}function setRelationship(_0x1520f0,_0x1e22eb,_0x4fcc20,_0x43c915){return request({'form':{'method':_0xfe1e('0x4e'),'input_type':_0xfe1e('0x1f'),'response_type':_0xfe1e('0x1f'),'rest_data':JSON[_0xfe1e('0x20')]({'session':_0x1520f0['id'],'module_name':_0xfe1e('0x21'),'module_id':_0x4fcc20['id'],'link_field_name':_0x43c915,'related_ids':[_0x1e22eb['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xfe1e('0x4f')]=function(_0x3c224c,_0x1b1ea1,_0x5cf9b3,_0x513b8d,_0x391644,_0x4b4161){var _0x1e0b6c,_0x7c5021,_0x4e2237,_0x404a4f;_0x4b4161[_0xfe1e('0x50')]=intUtil[_0xfe1e('0x51')](_0x4b4161[_0xfe1e('0x50')]);_0x4b4161['serverUrl']=intUtil['stripTrailingSlash'](_0x4b4161[_0xfe1e('0x52')]);def['uri']=util['format'](_0xfe1e('0x53'),_0x4b4161[_0xfe1e('0x50')]);if(_0x391644&&_0x391644['monitor_format']){logger[_0xfe1e('0xa')](_0xfe1e('0x54'),_0xfe1e('0x55'));_0x1b1ea1[_0xfe1e('0x56')]=util[_0xfe1e('0x27')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4b4161[_0xfe1e('0x52')],_0x1b1ea1[_0xfe1e('0x57')],md5(_0x1b1ea1[_0xfe1e('0x57')]));}else{_0x1b1ea1[_0xfe1e('0x56')]='';}return getConnection(_0x4b4161)[_0xfe1e('0x2a')](function(_0x27bdec){_0x404a4f=_0x27bdec;return getUser(_0x4b4161,_0x513b8d['name'],_0x404a4f);})['then'](function(_0x275faa){_0x1e0b6c=_0x275faa;logger[_0xfe1e('0xa')](_0xfe1e('0x58'),_0x1e0b6c['id']);return getEndUser(_0x4b4161,_0x1b1ea1[_0xfe1e('0x59')],_0x1b1ea1[_0xfe1e('0x5a')],_0x404a4f);})[_0xfe1e('0x2a')](function(_0x15bcf0){_0x7c5021=_0x15bcf0;logger[_0xfe1e('0xa')](_0xfe1e('0x5b'),_0x7c5021['id']);return getTicket(_0x4b4161,_0x1e0b6c,_0x7c5021,_0x5cf9b3,_0x1b1ea1,_0x5cf9b3[_0xfe1e('0x5c')],_0x404a4f,'Inbound');})[_0xfe1e('0x2a')](function(_0x26d379){_0x4e2237=_0x26d379;logger[_0xfe1e('0xa')](_0xfe1e('0x5d'));logger[_0xfe1e('0xa')]('The\x20Ticket\x20ID\x20is:',_0x4e2237['id']);return setRelationship(_0x404a4f,_0x1e0b6c,_0x4e2237,_0xfe1e('0x5e'));})[_0xfe1e('0x2a')](function(){return setRelationship(_0x404a4f,_0x7c5021,_0x4e2237,_0xfe1e('0x5f'));})['then'](function(){return getServerInfo(_0x404a4f);})[_0xfe1e('0x2a')](function(_0x1d324d){var _0x45c808=parseInt(_0x1d324d[_0xfe1e('0x60')][_0xfe1e('0x61')](0x0));var _0x14b519=util[_0xfe1e('0x27')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x4b4161[_0xfe1e('0x50')],_0x4e2237['id']);if(_0x45c808>0x6){_0x14b519=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x4b4161[_0xfe1e('0x50')],_0x4e2237['id']);}logger[_0xfe1e('0xa')](_0xfe1e('0x54'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xfe1e('0x27')]('user:%s',_0x513b8d[_0xfe1e('0xc')]),_0xfe1e('0x62'),{'uri':_0x14b519});})[_0xfe1e('0x63')](function(_0xa7306a){logger[_0xfe1e('0x64')](_0xfe1e('0x54'),JSON[_0xfe1e('0x20')](_0xa7306a));});};exports[_0xfe1e('0x65')]=function(_0x35c4e9,_0x124a91,_0xb3fa2f,_0x230958,_0x2f0b37,_0x34daf5,_0x55e503){var _0x5cbc6d,_0x147f77,_0x645bfe,_0xa738da;_0x34daf5[_0xfe1e('0x50')]=intUtil[_0xfe1e('0x51')](_0x34daf5[_0xfe1e('0x50')]);_0x34daf5[_0xfe1e('0x52')]=intUtil['stripTrailingSlash'](_0x34daf5[_0xfe1e('0x52')]);def[_0xfe1e('0x66')]=util[_0xfe1e('0x27')](_0xfe1e('0x53'),_0x34daf5[_0xfe1e('0x50')]);if(_0x55e503&&_0x55e503['recordingFormat']&&_0x55e503[_0xfe1e('0x67')]!=='none'){logger[_0xfe1e('0xa')](_0xfe1e('0x68'),'Recording\x20is\x20enabled!');_0x124a91['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x34daf5['serverUrl'],_0x124a91[_0xfe1e('0x57')],md5(_0x124a91[_0xfe1e('0x57')]));}return getConnection(_0x34daf5)[_0xfe1e('0x2a')](function(_0x1ec5af){_0xa738da=_0x1ec5af;return getUser(_0x34daf5,_0x230958['name'],_0xa738da);})[_0xfe1e('0x2a')](function(_0x55006b){_0x5cbc6d=_0x55006b;logger['info'](_0xfe1e('0x58'),_0x5cbc6d['id']);return getEndUser(_0x34daf5,_0x124a91[_0xfe1e('0x69')],_0x124a91[_0xfe1e('0x6a')],_0xa738da);})['then'](function(_0x21237c){_0x147f77=_0x21237c;logger[_0xfe1e('0xa')]('The\x20Enduser\x20ID\x20is:',_0x147f77['id']);return getTicket(_0x34daf5,_0x5cbc6d,_0x147f77,_0xb3fa2f,_0x124a91,_0xb3fa2f[_0xfe1e('0x5c')],_0xa738da,_0xfe1e('0x6b'));})[_0xfe1e('0x2a')](function(_0x47fa38){_0x645bfe=_0x47fa38;logger[_0xfe1e('0xa')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x645bfe['id']);return setRelationship(_0xa738da,_0x5cbc6d,_0x645bfe,_0xfe1e('0x5e'));})['then'](function(){return setRelationship(_0xa738da,_0x147f77,_0x645bfe,_0xfe1e('0x5f'));})[_0xfe1e('0x2a')](function(){return getServerInfo(_0xa738da);})[_0xfe1e('0x2a')](function(_0x527725){var _0x4cd68e=parseInt(_0x527725['version'][_0xfe1e('0x61')](0x0));var _0x4797b3=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x34daf5[_0xfe1e('0x50')],_0x645bfe['id']);if(_0x4cd68e>0x6){_0x4797b3=util[_0xfe1e('0x27')](_0xfe1e('0x6c'),_0x34daf5[_0xfe1e('0x50')],_0x645bfe['id']);}logger[_0xfe1e('0xa')](_0xfe1e('0x68'),_0xfe1e('0x6d'));emit(util[_0xfe1e('0x27')](_0xfe1e('0x6e'),_0x230958[_0xfe1e('0xc')]),_0xfe1e('0x62'),{'uri':_0x4797b3});})[_0xfe1e('0x63')](function(_0x8ffcd8){logger[_0xfe1e('0x64')]('[OUTBOUND]',JSON[_0xfe1e('0x20')](_0x8ffcd8));});};exports[_0xfe1e('0x6f')]=function(_0x48c36f,_0x939ee,_0x2fa61f,_0x91e310,_0x132063,_0x3b8f21){var _0x3b5f69,_0x4cf9ea,_0x251af4,_0x3e906a;_0x3b8f21[_0xfe1e('0x50')]=intUtil[_0xfe1e('0x51')](_0x3b8f21[_0xfe1e('0x50')]);_0x3b8f21[_0xfe1e('0x52')]=intUtil[_0xfe1e('0x51')](_0x3b8f21['serverUrl']);def[_0xfe1e('0x66')]=util[_0xfe1e('0x27')](_0xfe1e('0x53'),_0x3b8f21[_0xfe1e('0x50')]);if(_0x132063&&_0x132063[_0xfe1e('0x70')]){logger[_0xfe1e('0xa')]('['+_0x939ee[_0xfe1e('0x71')][_0xfe1e('0x72')]()+']',_0xfe1e('0x55'));_0x939ee['recordingURL']=util[_0xfe1e('0x27')](_0xfe1e('0x73'),_0x3b8f21[_0xfe1e('0x52')],_0x939ee[_0xfe1e('0x57')],md5(_0x939ee[_0xfe1e('0x57')]));}else{_0x939ee[_0xfe1e('0x56')]='';}return getConnection(_0x3b8f21)[_0xfe1e('0x2a')](function(_0x160e2e){_0x3e906a=_0x160e2e;if(!_[_0xfe1e('0x25')](_0x91e310)){return getUser(_0x3b8f21,_0x91e310['name'],_0x3e906a);}else{return getUser(_0x3b8f21,null,_0x3e906a);}})['then'](function(_0x4c4f94){_0x3b5f69=_0x4c4f94;logger[_0xfe1e('0xa')](_0xfe1e('0x58'),_0x3b5f69['id']);return getEndUser(_0x3b8f21,_0x939ee[_0xfe1e('0x59')],_0x939ee[_0xfe1e('0x5a')],_0x3e906a);})['then'](function(_0x1e1e83){_0x4cf9ea=_0x1e1e83;logger['info'](_0xfe1e('0x5b'),_0x4cf9ea['id']);return getTicket(_0x3b8f21,_0x3b5f69,_0x4cf9ea,_0x2fa61f,_0x939ee,_0x2fa61f['Fields'],_0x3e906a,_0xfe1e('0x74'));})[_0xfe1e('0x2a')](function(_0x548003){_0x251af4=_0x548003;logger[_0xfe1e('0xa')]('Ticket\x20created!');logger[_0xfe1e('0xa')]('The\x20Ticket\x20ID\x20is:',_0x251af4['id']);return setRelationship(_0x3e906a,_0x3b5f69,_0x251af4,_0xfe1e('0x5e'));})[_0xfe1e('0x2a')](function(){return setRelationship(_0x3e906a,_0x4cf9ea,_0x251af4,'contacts');})[_0xfe1e('0x2a')](function(){return getServerInfo(_0x3e906a);})[_0xfe1e('0x63')](function(_0x3bce52){logger[_0xfe1e('0x64')]('['+_0x939ee[_0xfe1e('0x71')]['toUpperCase']()+']',JSON['stringify'](_0x3bce52));});}; \ No newline at end of file +var _0xc505=['apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','user_name','then','entry_list','value','Agent\x20found!','resolve','name_value_list','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','find','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','forEach','type','string','customField','toLowerCase','content','custom_fields','variable','customVariable','Variable','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','Outbound','charAt','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','defaults','redis','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','description','Descriptions','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','Contacts','parent_name','name','direction','length','variableName','push','idField','JSON','stringify','Calls','format','Basic\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc505,0x152));var _0x5c50=function(_0x2b2f1f,_0x581376){_0x2b2f1f=_0x2b2f1f-0x0;var _0x34c25c=_0xc505[_0x2b2f1f];return _0x34c25c;};'use strict';var _=require(_0x5c50('0x0'));var rp=require(_0x5c50('0x1'));var BPromise=require('bluebird');var md5=require(_0x5c50('0x2'));var util=require(_0x5c50('0x3'));var Redis=require(_0x5c50('0x4'));var intUtil=require(_0x5c50('0x5'));var config=require(_0x5c50('0x6'));var logger=require(_0x5c50('0x7'))(_0x5c50('0x8'));config['redis']=_[_0x5c50('0x9')](config[_0x5c50('0xa')],{'host':_0x5c50('0xb'),'port':0x18eb});var io=require(_0x5c50('0xc'))(new Redis(config[_0x5c50('0xa')]));var def={'method':'POST','json':!![]};function emit(_0x54b8d9,_0x4e328d,_0x256727){io['to'](_0x54b8d9)[_0x5c50('0xd')](_0x4e328d,_0x256727);}function getTicket(_0x1cfe1c,_0x1f0a14,_0x50ec72,_0x59fdef,_0x4088e0,_0x3bef72,_0x468fd7,_0x21e189){logger[_0x5c50('0xe')](_0x5c50('0xf'));var _0x400df2=new Date();var _0x232d18=[{'name':'name','value':intUtil[_0x5c50('0x10')](_0x59fdef[_0x5c50('0x11')],_0x4088e0,'\x20')},{'name':_0x5c50('0x12'),'value':_0x1f0a14['id']},{'name':'created_by','value':_0x1f0a14['id']},{'name':_0x5c50('0x13'),'value':intUtil[_0x5c50('0x10')](_0x59fdef[_0x5c50('0x14')],_0x4088e0,'\x0a')},{'name':'date_start','value':_0x400df2[_0x5c50('0x15')]()[_0x5c50('0x16')](0x0,0x13)[_0x5c50('0x17')]('T','\x20')},{'name':_0x5c50('0x18'),'value':'0'},{'name':_0x5c50('0x19'),'value':'15'},{'name':_0x5c50('0x1a'),'value':_0x50ec72['id']},{'name':'parent_type','value':_0x5c50('0x1b')},{'name':_0x5c50('0x1c'),'value':_0x50ec72[_0x5c50('0x1d')]},{'name':_0x5c50('0x1e'),'value':_0x21e189}];if(_0x3bef72[_0x5c50('0x1f')]){_['forEach'](_0x3bef72,function(_0x1f686a){if(_0x4088e0[_0x1f686a[_0x5c50('0x20')]]){_0x232d18[_0x5c50('0x21')]({'name':_0x1f686a[_0x5c50('0x22')],'value':_0x4088e0[_0x1f686a['variableName']]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0x5c50('0x23'),'rest_data':JSON[_0x5c50('0x24')]({'session':_0x468fd7['id'],'module_name':_0x5c50('0x25'),'name_value_list':_0x232d18})}});}function getAuth(_0x7ed763){return util[_0x5c50('0x26')](_0x5c50('0x27'),new Buffer(_0x7ed763[_0x5c50('0x28')]+':X')[_0x5c50('0x29')](_0x5c50('0x2a')));}function getServerInfo(_0x44d15f){return request({'form':{'method':_0x5c50('0x2b'),'input_type':_0x5c50('0x23'),'response_type':_0x5c50('0x23'),'rest_data':JSON[_0x5c50('0x24')]({'session':_0x44d15f['id']})}});}function getUser(_0x167567,_0x1d31b3,_0x814266){if(!_[_0x5c50('0x2c')](_0x1d31b3)){logger['info'](_0x5c50('0x2d'),_0x1d31b3);return request({'form':{'method':_0x5c50('0x2e'),'input_type':_0x5c50('0x23'),'response_type':_0x5c50('0x23'),'rest_data':JSON[_0x5c50('0x24')]({'session':_0x814266['id'],'module_name':'Employees','query':util[_0x5c50('0x26')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x1d31b3),'order_by':'','offset':'0','select_fields':['id',_0x5c50('0x1d'),_0x5c50('0x2f')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5c50('0x30')](function(_0xfbdf92){if(_0xfbdf92[_0x5c50('0x31')][_0x5c50('0x1f')]){var _0x4f9502=_['find'](_0xfbdf92[_0x5c50('0x31')],function(_0x268c26){return _0x268c26['name_value_list']['user_name'][_0x5c50('0x32')]===_0x1d31b3;});if(_0x4f9502){logger['info'](_0x5c50('0x33'));return BPromise[_0x5c50('0x34')]({'id':_0x4f9502['name_value_list']['id'][_0x5c50('0x32')],'name':_0x4f9502[_0x5c50('0x35')][_0x5c50('0x1d')][_0x5c50('0x32')]});}}logger[_0x5c50('0xe')](_0x5c50('0x36'));return BPromise['resolve']({'id':_0x814266[_0x5c50('0x35')][_0x5c50('0x37')][_0x5c50('0x32')],'name':_0x814266[_0x5c50('0x35')][_0x5c50('0x2f')][_0x5c50('0x32')]});});}else{logger[_0x5c50('0xe')](_0x5c50('0x38'));return BPromise[_0x5c50('0x34')]({'id':_0x814266[_0x5c50('0x35')][_0x5c50('0x37')][_0x5c50('0x32')],'name':_0x814266[_0x5c50('0x35')]['user_name'][_0x5c50('0x32')]});}}function getEndUser(_0x2f05e3,_0x744a5a,_0x4237dd,_0x536dbb){logger[_0x5c50('0xe')](_0x5c50('0x39'),_0x4237dd);return request({'form':{'method':_0x5c50('0x2e'),'input_type':'JSON','response_type':_0x5c50('0x23'),'rest_data':JSON[_0x5c50('0x24')]({'session':_0x536dbb['id'],'module_name':_0x5c50('0x1b'),'query':util[_0x5c50('0x26')](_0x5c50('0x3a'),_0x4237dd),'order_by':'','offset':'0','select_fields':['id',_0x5c50('0x1d'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5c50('0x30')](function(_0x250905){if(_0x250905[_0x5c50('0x31')][_0x5c50('0x1f')]){var _0x493316=_[_0x5c50('0x3b')](_0x250905[_0x5c50('0x31')],function(_0x3ea079){return _0x3ea079[_0x5c50('0x35')][_0x5c50('0x3c')][_0x5c50('0x32')]===_0x4237dd;});if(_0x493316){logger[_0x5c50('0xe')](_0x5c50('0x3d'));return BPromise['resolve']({'id':_0x493316[_0x5c50('0x35')]['id']['value'],'name':_0x493316[_0x5c50('0x35')][_0x5c50('0x1d')][_0x5c50('0x32')],'phone':_0x493316['name_value_list'][_0x5c50('0x3c')][_0x5c50('0x32')]});}}else{logger[_0x5c50('0xe')](_0x5c50('0x3e'));return request({'form':{'method':_0x5c50('0x3f'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x5c50('0x24')]({'session':_0x536dbb['id'],'module_name':_0x5c50('0x1b'),'name_value_list':[{'name':_0x5c50('0x40'),'value':_0x744a5a!==''?_0x744a5a:util[_0x5c50('0x26')](_0x5c50('0x41'),_0x4237dd)},{'name':_0x5c50('0x3c'),'value':_0x4237dd}]})}})[_0x5c50('0x30')](function(_0x39a2c6){logger['info'](_0x5c50('0x42'));return BPromise['resolve']({'id':_0x39a2c6['id'],'name':_0x39a2c6['entry_list'][_0x5c50('0x40')][_0x5c50('0x32')],'phone':_0x39a2c6[_0x5c50('0x31')]['phone_home']['value']});});}});}function request(_0x4a88f4){logger[_0x5c50('0x43')](_0x5c50('0x44'),JSON[_0x5c50('0x24')](_0x4a88f4));return rp(_[_0x5c50('0x45')](def,_0x4a88f4));}function getTags(_0x488e79,_0xf06beb){var _0xef43be=[];if(_0x488e79&&_0x488e79['length']>0x0){_0xef43be=_[_0x5c50('0x46')](_0x488e79,_0xf06beb);}return _0xef43be;}function getCustomFields(_0x2b4d8c,_0x54b974){var _0xae3fb2=[];var _0x4a1b7c={'custom_fields':[]};if(_0x2b4d8c[_0x5c50('0x1f')]>0x0){_[_0x5c50('0x47')](_0x2b4d8c,function(_0x597b4a){if(_0x597b4a[_0x5c50('0x48')]===_0x5c50('0x49')&&_0x597b4a['nameField']&&!_0x597b4a[_0x5c50('0x4a')]){_0x4a1b7c[_0x597b4a['nameField'][_0x5c50('0x4b')]()]=_0x597b4a[_0x5c50('0x4c')][_0x5c50('0x29')]();}else if(_0x597b4a[_0x5c50('0x48')]==='string'&&_0x597b4a[_0x5c50('0x22')]&&_0x597b4a[_0x5c50('0x4a')]){_0x4a1b7c[_0x5c50('0x4d')][_0x5c50('0x21')]({'id':_0x597b4a['idField'],'value':_0x597b4a[_0x5c50('0x4c')][_0x5c50('0x29')]()});}else if(_0x597b4a[_0x5c50('0x48')]===_0x5c50('0x4e')&&_0x597b4a[_0x5c50('0x20')]&&_0x597b4a[_0x5c50('0x22')]&&_0x597b4a[_0x5c50('0x4a')]){_0x54b974[_0x597b4a[_0x5c50('0x20')]]&&_0x4a1b7c[_0x5c50('0x4d')][_0x5c50('0x21')]({'id':_0x597b4a[_0x5c50('0x22')],'value':_0x54b974[_0x597b4a['variableName']][_0x5c50('0x29')]()});}else if(_0x597b4a[_0x5c50('0x48')]===_0x5c50('0x4f')&&_0x597b4a[_0x5c50('0x50')]&&_0x597b4a[_0x5c50('0x50')]['name']&&_0x597b4a['idField']&&_0x597b4a[_0x5c50('0x4a')]){_0x54b974[_0x597b4a[_0x5c50('0x50')][_0x5c50('0x1d')][_0x5c50('0x4b')]()]&&_0x4a1b7c['custom_fields'][_0x5c50('0x21')]({'id':_0x597b4a[_0x5c50('0x22')],'value':_0x54b974[_0x597b4a['Variable'][_0x5c50('0x1d')][_0x5c50('0x4b')]()][_0x5c50('0x29')]()});}});}return _0x4a1b7c;}function getConnection(_0x4331f9){return request({'method':'POST','form':{'method':'login','input_type':_0x5c50('0x23'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x4331f9[_0x5c50('0x51')],'password':_0x4331f9[_0x5c50('0x52')],'encryption':_0x5c50('0x53')},'application':_0x5c50('0x54')})}})[_0x5c50('0x30')](function(_0x14e00b){var _0x1c93a7=_0x14e00b;if(_0x1c93a7['id']){def[_0x5c50('0x55')]=_0x1c93a7['id'];return BPromise[_0x5c50('0x34')](_0x1c93a7);}else{throw new Error(util['format'](_0x5c50('0x56'),_0x4331f9['id']));}});}function setRelationship(_0x5b878d,_0x27e399,_0x31eb66,_0x560a1f){return request({'form':{'method':_0x5c50('0x57'),'input_type':_0x5c50('0x23'),'response_type':_0x5c50('0x23'),'rest_data':JSON[_0x5c50('0x24')]({'session':_0x5b878d['id'],'module_name':_0x5c50('0x25'),'module_id':_0x31eb66['id'],'link_field_name':_0x560a1f,'related_ids':[_0x27e399['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x5c50('0x58')]=function(_0xbdfe3d,_0x396727,_0x1960c1,_0x18cc36,_0x38fe8d,_0x1dfc32){var _0x2781cf,_0x264ae7,_0x33e4fb,_0x53df9f;_0x1dfc32['remoteUri']=intUtil[_0x5c50('0x59')](_0x1dfc32['remoteUri']);_0x1dfc32[_0x5c50('0x5a')]=intUtil[_0x5c50('0x59')](_0x1dfc32['serverUrl']);def[_0x5c50('0x5b')]=util[_0x5c50('0x26')](_0x5c50('0x5c'),_0x1dfc32[_0x5c50('0x5d')]);if(_0x38fe8d&&_0x38fe8d[_0x5c50('0x5e')]){logger[_0x5c50('0xe')](_0x5c50('0x5f'),_0x5c50('0x60'));_0x396727[_0x5c50('0x61')]=util[_0x5c50('0x26')](_0x5c50('0x62'),_0x1dfc32[_0x5c50('0x5a')],_0x396727['uniqueid'],md5(_0x396727[_0x5c50('0x63')]));}else{_0x396727[_0x5c50('0x61')]='';}return getConnection(_0x1dfc32)[_0x5c50('0x30')](function(_0x443625){_0x53df9f=_0x443625;return getUser(_0x1dfc32,_0x18cc36['name'],_0x53df9f);})[_0x5c50('0x30')](function(_0x428bf3){_0x2781cf=_0x428bf3;logger[_0x5c50('0xe')](_0x5c50('0x64'),_0x2781cf['id']);return getEndUser(_0x1dfc32,_0x396727['calleridname'],_0x396727[_0x5c50('0x65')],_0x53df9f);})[_0x5c50('0x30')](function(_0x173bb0){_0x264ae7=_0x173bb0;logger['info'](_0x5c50('0x66'),_0x264ae7['id']);return getTicket(_0x1dfc32,_0x2781cf,_0x264ae7,_0x1960c1,_0x396727,_0x1960c1[_0x5c50('0x67')],_0x53df9f,_0x5c50('0x68'));})[_0x5c50('0x30')](function(_0x566109){_0x33e4fb=_0x566109;logger[_0x5c50('0xe')](_0x5c50('0x69'));logger[_0x5c50('0xe')](_0x5c50('0x6a'),_0x33e4fb['id']);return setRelationship(_0x53df9f,_0x2781cf,_0x33e4fb,_0x5c50('0x6b'));})[_0x5c50('0x30')](function(){return setRelationship(_0x53df9f,_0x264ae7,_0x33e4fb,_0x5c50('0x6c'));})[_0x5c50('0x30')](function(){return getServerInfo(_0x53df9f);})['then'](function(_0x4cb1b0){var _0x1049eb=parseInt(_0x4cb1b0[_0x5c50('0x6d')]['charAt'](0x0));var _0x249e03=util[_0x5c50('0x26')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x1dfc32[_0x5c50('0x5d')],_0x33e4fb['id']);if(_0x1049eb>0x6){_0x249e03=util[_0x5c50('0x26')](_0x5c50('0x6e'),_0x1dfc32['remoteUri'],_0x33e4fb['id']);}logger[_0x5c50('0xe')]('[QUEUE]',_0x5c50('0x6f'));emit(util[_0x5c50('0x26')](_0x5c50('0x70'),_0x18cc36[_0x5c50('0x1d')]),_0x5c50('0x71'),{'uri':_0x249e03});})[_0x5c50('0x72')](function(_0x19d6e1){logger[_0x5c50('0x73')](_0x5c50('0x5f'),JSON[_0x5c50('0x24')](_0x19d6e1));});};exports[_0x5c50('0x74')]=function(_0x5b2b1b,_0x21fd5f,_0xd7edc,_0x4fbcf0,_0x22e582,_0x5638b5,_0x7658ef){var _0x78de2f,_0x5197ed,_0x359d8b,_0x158ce6;_0x5638b5[_0x5c50('0x5d')]=intUtil[_0x5c50('0x59')](_0x5638b5[_0x5c50('0x5d')]);_0x5638b5[_0x5c50('0x5a')]=intUtil[_0x5c50('0x59')](_0x5638b5[_0x5c50('0x5a')]);def['uri']=util[_0x5c50('0x26')]('%s/service/v4_1/rest.php',_0x5638b5[_0x5c50('0x5d')]);if(_0x7658ef&&_0x7658ef[_0x5c50('0x75')]&&_0x7658ef['recordingFormat']!==_0x5c50('0x76')){logger[_0x5c50('0xe')](_0x5c50('0x77'),_0x5c50('0x60'));_0x21fd5f[_0x5c50('0x61')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5638b5[_0x5c50('0x5a')],_0x21fd5f[_0x5c50('0x63')],md5(_0x21fd5f['uniqueid']));}return getConnection(_0x5638b5)['then'](function(_0x4deba5){_0x158ce6=_0x4deba5;return getUser(_0x5638b5,_0x4fbcf0[_0x5c50('0x1d')],_0x158ce6);})['then'](function(_0x5e1235){_0x78de2f=_0x5e1235;logger[_0x5c50('0xe')]('The\x20User\x20ID\x20is:',_0x78de2f['id']);return getEndUser(_0x5638b5,_0x21fd5f[_0x5c50('0x78')],_0x21fd5f['destcalleridnum'],_0x158ce6);})['then'](function(_0x482a6f){_0x5197ed=_0x482a6f;logger[_0x5c50('0xe')]('The\x20Enduser\x20ID\x20is:',_0x5197ed['id']);return getTicket(_0x5638b5,_0x78de2f,_0x5197ed,_0xd7edc,_0x21fd5f,_0xd7edc['Fields'],_0x158ce6,_0x5c50('0x79'));})[_0x5c50('0x30')](function(_0x5c4566){_0x359d8b=_0x5c4566;logger[_0x5c50('0xe')](_0x5c50('0x69'));logger['info'](_0x5c50('0x6a'),_0x359d8b['id']);return setRelationship(_0x158ce6,_0x78de2f,_0x359d8b,_0x5c50('0x6b'));})[_0x5c50('0x30')](function(){return setRelationship(_0x158ce6,_0x5197ed,_0x359d8b,_0x5c50('0x6c'));})[_0x5c50('0x30')](function(){return getServerInfo(_0x158ce6);})['then'](function(_0x4fd93f){var _0x4fe888=parseInt(_0x4fd93f[_0x5c50('0x6d')][_0x5c50('0x7a')](0x0));var _0x3fe75f=util[_0x5c50('0x26')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x5638b5[_0x5c50('0x5d')],_0x359d8b['id']);if(_0x4fe888>0x6){_0x3fe75f=util['format'](_0x5c50('0x6e'),_0x5638b5[_0x5c50('0x5d')],_0x359d8b['id']);}logger[_0x5c50('0xe')]('[OUTBOUND]',_0x5c50('0x6f'));emit(util['format'](_0x5c50('0x70'),_0x4fbcf0[_0x5c50('0x1d')]),'trigger:browser:url',{'uri':_0x3fe75f});})[_0x5c50('0x72')](function(_0x315fd4){logger[_0x5c50('0x73')](_0x5c50('0x77'),JSON['stringify'](_0x315fd4));});};exports[_0x5c50('0x7b')]=function(_0x4ee19e,_0x149dce,_0x446bc9,_0x38308a,_0x2bd0a7,_0x55d05f){var _0x124c1e,_0xbe1b11,_0x1978ba,_0x1b6268;_0x55d05f[_0x5c50('0x5d')]=intUtil[_0x5c50('0x59')](_0x55d05f[_0x5c50('0x5d')]);_0x55d05f[_0x5c50('0x5a')]=intUtil[_0x5c50('0x59')](_0x55d05f[_0x5c50('0x5a')]);def[_0x5c50('0x5b')]=util['format'](_0x5c50('0x5c'),_0x55d05f[_0x5c50('0x5d')]);if(_0x2bd0a7&&_0x2bd0a7[_0x5c50('0x5e')]){logger['info']('['+_0x149dce[_0x5c50('0x7c')][_0x5c50('0x7d')]()+']',_0x5c50('0x60'));_0x149dce['recordingURL']=util[_0x5c50('0x26')](_0x5c50('0x62'),_0x55d05f[_0x5c50('0x5a')],_0x149dce[_0x5c50('0x63')],md5(_0x149dce[_0x5c50('0x63')]));}else{_0x149dce[_0x5c50('0x61')]='';}return getConnection(_0x55d05f)[_0x5c50('0x30')](function(_0x2a380f){_0x1b6268=_0x2a380f;if(!_[_0x5c50('0x2c')](_0x38308a)){return getUser(_0x55d05f,_0x38308a['name'],_0x1b6268);}else{return getUser(_0x55d05f,null,_0x1b6268);}})['then'](function(_0x29d66a){_0x124c1e=_0x29d66a;logger['info']('The\x20User\x20ID\x20is:',_0x124c1e['id']);return getEndUser(_0x55d05f,_0x149dce['calleridname'],_0x149dce[_0x5c50('0x65')],_0x1b6268);})[_0x5c50('0x30')](function(_0x5a0072){_0xbe1b11=_0x5a0072;logger[_0x5c50('0xe')](_0x5c50('0x66'),_0xbe1b11['id']);return getTicket(_0x55d05f,_0x124c1e,_0xbe1b11,_0x446bc9,_0x149dce,_0x446bc9['Fields'],_0x1b6268,_0x5c50('0x68'));})[_0x5c50('0x30')](function(_0x3b9ffd){_0x1978ba=_0x3b9ffd;logger['info'](_0x5c50('0x69'));logger[_0x5c50('0xe')]('The\x20Ticket\x20ID\x20is:',_0x1978ba['id']);return setRelationship(_0x1b6268,_0x124c1e,_0x1978ba,_0x5c50('0x6b'));})[_0x5c50('0x30')](function(){return setRelationship(_0x1b6268,_0xbe1b11,_0x1978ba,_0x5c50('0x6c'));})[_0x5c50('0x30')](function(){return getServerInfo(_0x1b6268);})[_0x5c50('0x72')](function(_0x264f77){logger[_0x5c50('0x73')]('['+_0x149dce[_0x5c50('0x7c')]['toUpperCase']()+']',JSON['stringify'](_0x264f77));});}; \ 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 0471d9c..71c597c 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 _0xb51a=['string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','keyContent','join','stripTrailingSlash','substring','lastIndexOf','validateEmail','isNil','util','length','sortBy','type'];(function(_0xad4a7f,_0x539b22){var _0x382da0=function(_0x1f9732){while(--_0x1f9732){_0xad4a7f['push'](_0xad4a7f['shift']());}};_0x382da0(++_0x539b22);}(_0xb51a,0x64));var _0xab51=function(_0x4c179e,_0x1bb62e){_0x4c179e=_0x4c179e-0x0;var _0x1cb126=_0xb51a[_0x4c179e];return _0x1cb126;};'use strict';var _=require('lodash');var util=require(_0xab51('0x0'));exports['getString']=function(_0x5cebda,_0x42c7e2,_0x4aba19){var _0x100716=[];if(_0x5cebda[_0xab51('0x1')]>0x0){var _0x15c0f0=_[_0xab51('0x2')](_0x5cebda,['id']);for(var _0x16fe6f=0x0;_0x16fe6f<_0x15c0f0[_0xab51('0x1')];_0x16fe6f++){var _0xe7686e=_0x15c0f0[_0x16fe6f];if(_0xe7686e[_0xab51('0x3')]===_0xab51('0x4')){_0x100716[_0xab51('0x5')](_0xe7686e[_0xab51('0x6')]);}else if(_0xe7686e[_0xab51('0x3')]===_0xab51('0x7')&&_0xe7686e[_0xab51('0x8')]){_0x42c7e2[_0xe7686e[_0xab51('0x8')]]&&_0x100716['push'](_0x42c7e2[_0xe7686e[_0xab51('0x8')]][_0xab51('0x9')]());}else if(_0xe7686e[_0xab51('0x3')]===_0xab51('0xa')&&_0xe7686e[_0xab51('0xb')]&&_0xe7686e['Variable']['name']){_0x42c7e2[_0xe7686e[_0xab51('0xb')][_0xab51('0xc')][_0xab51('0xd')]()]&&_0x100716[_0xab51('0x5')](_0x42c7e2[_0xe7686e[_0xab51('0xb')][_0xab51('0xc')][_0xab51('0xd')]()][_0xab51('0x9')]());}else if(_0xe7686e['type']===_0xab51('0xe')){if(_0xe7686e[_0xab51('0xf')]===_0xab51('0x4')&&_0xe7686e[_0xab51('0x10')]){_0x100716[_0xab51('0x5')](util[_0xab51('0x11')](_0xab51('0x12'),_0xe7686e['key'],_0xe7686e[_0xab51('0x13')]));}else if(_0xe7686e[_0xab51('0xf')]===_0xab51('0x7')&&_0xe7686e['variableName']&&_0xe7686e['key']){_0x42c7e2[_0xe7686e[_0xab51('0x8')]]&&_0x100716[_0xab51('0x5')](util[_0xab51('0x11')]('%s:\x20%s',_0xe7686e[_0xab51('0x10')],_0x42c7e2[_0xe7686e['variableName']]));}else if(_0xe7686e[_0xab51('0xf')]==='customVariable'&&_0xe7686e['Variable']&&_0xe7686e[_0xab51('0xb')]['name']&&_0xe7686e['key']){_0x42c7e2[_0xe7686e[_0xab51('0xb')][_0xab51('0xc')][_0xab51('0xd')]()]&&_0x100716[_0xab51('0x5')](util[_0xab51('0x11')](_0xab51('0x12'),_0xe7686e['key'],_0x42c7e2[_0xe7686e[_0xab51('0xb')]['name'][_0xab51('0xd')]()]));}}}}return _0x100716[_0xab51('0x14')](_0x4aba19);};exports[_0xab51('0x15')]=function(_0x2b5140){var _0xcfe75=_0x2b5140['slice'](-0x1);if(_0xcfe75==='/'){_0x2b5140=_0x2b5140[_0xab51('0x16')](0x0,_0x2b5140[_0xab51('0x17')](_0xcfe75));}return _0x2b5140;};exports[_0xab51('0x18')]=function(_0x42f502){if(!_[_0xab51('0x19')](_0x42f502)&&_0x42f502!==''){var _0x28ab90=/^(([^<>()\[\]\\.,;:\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 _0x28ab90['test'](String(_0x42f502)[_0xab51('0xd')]());}else{return![];}}; \ No newline at end of file +var _0x8a45=['key','keyContent','%s:\x20%s','keyType','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','lodash','util','getString','length','sortBy','type','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','string','format'];(function(_0x10d0b1,_0x2f294c){var _0x29f80f=function(_0x40d6c){while(--_0x40d6c){_0x10d0b1['push'](_0x10d0b1['shift']());}};_0x29f80f(++_0x2f294c);}(_0x8a45,0x1e6));var _0x58a4=function(_0xea6018,_0x4cf082){_0xea6018=_0xea6018-0x0;var _0x57b54d=_0x8a45[_0xea6018];return _0x57b54d;};'use strict';var _=require(_0x58a4('0x0'));var util=require(_0x58a4('0x1'));exports[_0x58a4('0x2')]=function(_0x3161ac,_0xf7cadc,_0x22e03f){var _0x829537=[];if(_0x3161ac[_0x58a4('0x3')]>0x0){var _0x74140a=_[_0x58a4('0x4')](_0x3161ac,['id']);for(var _0x59510b=0x0;_0x59510b<_0x74140a[_0x58a4('0x3')];_0x59510b++){var _0x4f5b49=_0x74140a[_0x59510b];if(_0x4f5b49[_0x58a4('0x5')]==='string'){_0x829537[_0x58a4('0x6')](_0x4f5b49[_0x58a4('0x7')]);}else if(_0x4f5b49[_0x58a4('0x5')]===_0x58a4('0x8')&&_0x4f5b49['variableName']){_0xf7cadc[_0x4f5b49[_0x58a4('0x9')]]&&_0x829537['push'](_0xf7cadc[_0x4f5b49[_0x58a4('0x9')]][_0x58a4('0xa')]());}else if(_0x4f5b49[_0x58a4('0x5')]===_0x58a4('0xb')&&_0x4f5b49[_0x58a4('0xc')]&&_0x4f5b49['Variable'][_0x58a4('0xd')]){_0xf7cadc[_0x4f5b49['Variable'][_0x58a4('0xd')][_0x58a4('0xe')]()]&&_0x829537[_0x58a4('0x6')](_0xf7cadc[_0x4f5b49[_0x58a4('0xc')][_0x58a4('0xd')][_0x58a4('0xe')]()][_0x58a4('0xa')]());}else if(_0x4f5b49['type']===_0x58a4('0xf')){if(_0x4f5b49['keyType']===_0x58a4('0x10')&&_0x4f5b49['key']){_0x829537[_0x58a4('0x6')](util[_0x58a4('0x11')]('%s:\x20%s',_0x4f5b49[_0x58a4('0x12')],_0x4f5b49[_0x58a4('0x13')]));}else if(_0x4f5b49['keyType']==='variable'&&_0x4f5b49[_0x58a4('0x9')]&&_0x4f5b49[_0x58a4('0x12')]){_0xf7cadc[_0x4f5b49[_0x58a4('0x9')]]&&_0x829537[_0x58a4('0x6')](util[_0x58a4('0x11')](_0x58a4('0x14'),_0x4f5b49['key'],_0xf7cadc[_0x4f5b49[_0x58a4('0x9')]]));}else if(_0x4f5b49[_0x58a4('0x15')]===_0x58a4('0xb')&&_0x4f5b49['Variable']&&_0x4f5b49[_0x58a4('0xc')][_0x58a4('0xd')]&&_0x4f5b49[_0x58a4('0x12')]){_0xf7cadc[_0x4f5b49[_0x58a4('0xc')]['name'][_0x58a4('0xe')]()]&&_0x829537[_0x58a4('0x6')](util[_0x58a4('0x11')](_0x58a4('0x14'),_0x4f5b49['key'],_0xf7cadc[_0x4f5b49['Variable'][_0x58a4('0xd')][_0x58a4('0xe')]()]));}}}}return _0x829537['join'](_0x22e03f);};exports[_0x58a4('0x16')]=function(_0x2e8a8e){var _0x58c51a=_0x2e8a8e[_0x58a4('0x17')](-0x1);if(_0x58c51a==='/'){_0x2e8a8e=_0x2e8a8e[_0x58a4('0x18')](0x0,_0x2e8a8e[_0x58a4('0x19')](_0x58c51a));}return _0x2e8a8e;};exports[_0x58a4('0x1a')]=function(_0x3cb8d6){if(!_[_0x58a4('0x1b')](_0x3cb8d6)&&_0x3cb8d6!==''){var _0x2328a1=/^(([^<>()\[\]\\.,;:\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 _0x2328a1['test'](String(_0x3cb8d6)['toLowerCase']());}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 4c93a47..9bb147d 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file +var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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 28cbfef..1eebea6 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 _0x8043=['destcalleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','util','ioredis','../../../../config/environment','zendesk','redis','defaults','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','%s/search.json','count','Agent\x20found!','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','results','length','filter','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','authType','password','%s:%s','username','%s/token:%s','token','Basic\x20%s','toString','debug','[HTTP]','stringify','GET','map','string','picklist','type','nameField','customField','toLowerCase','content','idField','custom_fields','push','variableName','customVariable','name','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','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','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridname'];(function(_0x3fc3ad,_0x3beea){var _0x1ad7f2=function(_0x224e19){while(--_0x224e19){_0x3fc3ad['push'](_0x3fc3ad['shift']());}};_0x1ad7f2(++_0x3beea);}(_0x8043,0x1ab));var _0x3804=function(_0x2cc711,_0x300328){_0x2cc711=_0x2cc711-0x0;var _0x31a52e=_0x8043[_0x2cc711];return _0x31a52e;};'use strict';var _=require(_0x3804('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x3804('0x1'));var Redis=require(_0x3804('0x2'));var intUtil=require('./util');var config=require(_0x3804('0x3'));var logger=require('../../../../config/logger')(_0x3804('0x4'));config[_0x3804('0x5')]=_[_0x3804('0x6')](config[_0x3804('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x3804('0x7'))(new Redis(config[_0x3804('0x5')]));function emit(_0x18f35d,_0x356fd6,_0x7a2d1c){io['to'](_0x18f35d)[_0x3804('0x8')](_0x356fd6,_0x7a2d1c);}var headers={'Content-Type':'application/json','Accept':_0x3804('0x9')};function getTicket(_0x513c60,_0x37d6cb,_0x18d6c1,_0x3a5ac5,_0xbe2ca6){logger[_0x3804('0xa')](_0x3804('0xb'));return request({'uri':util[_0x3804('0xc')](_0x3804('0xd'),_0x513c60[_0x3804('0xe')]),'method':_0x3804('0xf'),'body':{'ticket':_['merge']({'requester_id':_0x18d6c1['id'],'submitter_id':_0x37d6cb?_0x37d6cb['id']:undefined,'assignee_id':_0x37d6cb?_0x37d6cb['id']:undefined,'tags':getTags(_0x3a5ac5['Tags'],'name'),'subject':intUtil[_0x3804('0x10')](_0x3a5ac5[_0x3804('0x11')],_0xbe2ca6,'\x20'),'description':intUtil[_0x3804('0x10')](_0x3a5ac5[_0x3804('0x12')],_0xbe2ca6,'\x0a'),'comment':{'public':![],'body':intUtil[_0x3804('0x10')](_0x3a5ac5[_0x3804('0x12')],_0xbe2ca6,'\x0a')}},getCustomFields(_0x3a5ac5[_0x3804('0x13')],_0xbe2ca6))}})[_0x3804('0x14')](function(_0x206cba){logger[_0x3804('0xa')](_0x3804('0x15'));return _0x206cba[_0x3804('0x16')];});}function getUser(_0x248dd6,_0x19f024){if(intUtil['validateEmail'](_0x19f024)){logger[_0x3804('0xa')]('Getting\x20agent\x20with\x20email',_0x19f024);return request({'uri':util[_0x3804('0xc')](_0x3804('0x17'),_0x248dd6[_0x3804('0xe')]),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x19f024)}})[_0x3804('0x14')](function(_0x5a033){if(_0x5a033[_0x3804('0x18')]){logger[_0x3804('0xa')](_0x3804('0x19'));return _[_0x3804('0x1a')](_0x5a033['results'],{'email':_0x19f024,'role':'agent'});}else{logger[_0x3804('0xa')](_0x3804('0x1b'));return request({'uri':util[_0x3804('0xc')](_0x3804('0x1c'),_0x248dd6[_0x3804('0xe')])})['then'](function(_0x49459b){logger[_0x3804('0xa')](_0x3804('0x1d'));return _0x49459b['user'];});}});}else{logger[_0x3804('0xa')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x3804('0x1c'),_0x248dd6['remoteUri'])})['then'](function(_0x5a4123){logger['info'](_0x3804('0x1d'));return _0x5a4123['user'];});}}function getEndUser(_0xe5feb7,_0x2ec34e,_0x19d32e){logger[_0x3804('0xa')]('Searching\x20enduser\x20with\x20phone',_0x19d32e);return request({'uri':util[_0x3804('0xc')](_0x3804('0x17'),_0xe5feb7[_0x3804('0xe')]),'qs':{'query':util[_0x3804('0xc')]('type:user\x20role:end-user\x20phone:%s',_0x19d32e)}})[_0x3804('0x14')](function(_0x5e99d3){var _0x373b73;if(_0x5e99d3[_0x3804('0x1e')][_0x3804('0x1f')]){_0x5e99d3[_0x3804('0x1e')]=_[_0x3804('0x20')](_0x5e99d3[_0x3804('0x1e')],{'suspended':![],'role':_0x3804('0x21')});if(_0x5e99d3[_0x3804('0x1e')][_0x3804('0x1f')]){_0x373b73=_[_0x3804('0x22')](_0x5e99d3['results']);}}if(_0x373b73){logger[_0x3804('0xa')]('Enduser\x20found!');return _0x373b73;}else{logger[_0x3804('0xa')](_0x3804('0x23'));return request({'uri':util[_0x3804('0xc')](_0x3804('0x24'),_0xe5feb7['remoteUri']),'method':_0x3804('0xf'),'body':{'user':{'role':_0x3804('0x21'),'name':util['format']('Caller\x20-\x20%s',_0x2ec34e||_0x19d32e),'phone':_0x19d32e}}})[_0x3804('0x14')](function(_0x4d4ffa){logger[_0x3804('0xa')](_0x3804('0x25'));return _0x4d4ffa['user'];});}});}function getAuth(_0x2bc997){var _0x16a8bd;if(_0x2bc997[_0x3804('0x26')]===_0x3804('0x27')){_0x16a8bd=util[_0x3804('0xc')](_0x3804('0x28'),_0x2bc997[_0x3804('0x29')],_0x2bc997['password']);}else if(_0x2bc997['authType']==='token'){_0x16a8bd=util[_0x3804('0xc')](_0x3804('0x2a'),_0x2bc997[_0x3804('0x29')],_0x2bc997[_0x3804('0x2b')]);}return util[_0x3804('0xc')](_0x3804('0x2c'),new Buffer(_0x16a8bd)[_0x3804('0x2d')]('base64'));}function request(_0x441a7d){logger[_0x3804('0x2e')](_0x3804('0x2f'),JSON[_0x3804('0x30')](_0x441a7d));return rp(_[_0x3804('0x6')](_0x441a7d,{'method':_0x3804('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x5697d5,_0x5309bc){var _0x233159=[];if(_0x5697d5&&_0x5697d5[_0x3804('0x1f')]>0x0){_0x233159=_[_0x3804('0x32')](_0x5697d5,_0x5309bc);}return _0x233159;}function getCustomFields(_0x1d59bf,_0x36f0ee){var _0x5c3aaa=[];var _0x554bd5={'custom_fields':[]};if(_0x1d59bf['length']>0x0){_['forEach'](_0x1d59bf,function(_0x5057b2){if(_['includes']([_0x3804('0x33'),_0x3804('0x34')],_0x5057b2[_0x3804('0x35')])&&_0x5057b2[_0x3804('0x36')]&&!_0x5057b2[_0x3804('0x37')]){_0x554bd5[_0x5057b2['nameField'][_0x3804('0x38')]()]=_0x5057b2[_0x3804('0x39')][_0x3804('0x2d')]();}else if(_['includes']([_0x3804('0x33'),_0x3804('0x34')],_0x5057b2[_0x3804('0x35')])&&_0x5057b2[_0x3804('0x3a')]&&_0x5057b2[_0x3804('0x37')]){_0x554bd5[_0x3804('0x3b')][_0x3804('0x3c')]({'id':_0x5057b2[_0x3804('0x3a')],'value':_0x5057b2[_0x3804('0x39')]['toString']()});}else if(_0x5057b2[_0x3804('0x35')]==='variable'&&_0x5057b2[_0x3804('0x3d')]&&_0x5057b2[_0x3804('0x3a')]&&_0x5057b2['customField']){_0x36f0ee[_0x5057b2[_0x3804('0x3d')]]&&_0x554bd5[_0x3804('0x3b')][_0x3804('0x3c')]({'id':_0x5057b2[_0x3804('0x3a')],'value':_0x36f0ee[_0x5057b2[_0x3804('0x3d')]][_0x3804('0x2d')]()});}else if(_0x5057b2[_0x3804('0x35')]===_0x3804('0x3e')&&_0x5057b2['Variable']&&_0x5057b2['Variable'][_0x3804('0x3f')]&&_0x5057b2[_0x3804('0x3a')]&&_0x5057b2[_0x3804('0x37')]){_0x36f0ee[_0x5057b2[_0x3804('0x40')][_0x3804('0x3f')][_0x3804('0x38')]()]&&_0x554bd5['custom_fields'][_0x3804('0x3c')]({'id':_0x5057b2[_0x3804('0x3a')],'value':_0x36f0ee[_0x5057b2[_0x3804('0x40')][_0x3804('0x3f')]['toLowerCase']()][_0x3804('0x2d')]()});}});}return _0x554bd5;}exports[_0x3804('0x41')]=function(_0x19ec7a,_0x3aa5ca,_0x26cee7,_0x4bd2ca,_0x3e61a5,_0x4f59b9){var _0x3b6824,_0x1baa30;_0x4f59b9[_0x3804('0xe')]=intUtil[_0x3804('0x42')](_0x4f59b9['remoteUri']);_0x4f59b9[_0x3804('0x43')]=intUtil['stripTrailingSlash'](_0x4f59b9[_0x3804('0x43')]);if(_0x3e61a5&&_0x3e61a5[_0x3804('0x44')]){logger[_0x3804('0xa')](_0x3804('0x45'),'Recording\x20is\x20enabled!');_0x3aa5ca[_0x3804('0x46')]=util[_0x3804('0xc')](_0x3804('0x47'),_0x4f59b9[_0x3804('0x43')],_0x3aa5ca[_0x3804('0x48')],md5(_0x3aa5ca['uniqueid']));}else{_0x3aa5ca[_0x3804('0x46')]='';}headers[_0x3804('0x49')]=getAuth(_0x4f59b9);return getUser(_0x4f59b9,_0x4bd2ca['email'])['then'](function(_0x1e8874){_0x3b6824=_0x1e8874;logger[_0x3804('0xa')](_0x3804('0x4a'),_0x3b6824['id']);return getEndUser(_0x4f59b9,_0x3aa5ca[_0x3804('0x4b')],_0x3aa5ca[_0x3804('0x4c')]);})[_0x3804('0x14')](function(_0x35047d){_0x1baa30=_0x35047d;logger[_0x3804('0xa')](_0x3804('0x4d'),_0x1baa30['id']);return getTicket(_0x4f59b9,_0x3b6824,_0x1baa30,_0x26cee7,_0x3aa5ca);})['then'](function(_0x401798){if(_0x401798){logger[_0x3804('0xa')]('The\x20Ticket\x20ID\x20is:',_0x401798['id']);switch(_0x4f59b9['type']){case'integrationTab':logger[_0x3804('0xa')]('[QUEUE]',_0x3804('0x4e'));return request({'uri':util['format'](_0x3804('0x4f'),_0x4f59b9[_0x3804('0xe')],_0x3b6824['id'],_0x401798['id']),'method':'POST'});case _0x3804('0x50'):logger['info'](_0x3804('0x45'),_0x3804('0x51'));emit(util[_0x3804('0xc')](_0x3804('0x52'),_0x4bd2ca[_0x3804('0x3f')]),_0x3804('0x53'),{'uri':util['format'](_0x3804('0x54'),_0x4f59b9['remoteUri'][_0x3804('0x55')](_0x3804('0x56'),''),_0x401798['id'])});break;default:logger['error'](_0x3804('0x45'),_0x3804('0x57'));}}})[_0x3804('0x58')](function(_0x18c18a){logger[_0x3804('0x59')](_0x3804('0x5a'),util[_0x3804('0x5b')](_0x18c18a,{'showHidden':!![],'depth':null}));});};exports[_0x3804('0x5c')]=function(_0x20b021,_0x2eed1d,_0x1f9f94,_0x63e712,_0xc129f,_0x119b5e,_0x42c3f6){var _0x130666,_0x27858c;_0x119b5e[_0x3804('0xe')]=intUtil[_0x3804('0x42')](_0x119b5e[_0x3804('0xe')]);_0x119b5e['serverUrl']=intUtil[_0x3804('0x42')](_0x119b5e[_0x3804('0x43')]);if(_0x42c3f6&&_0x42c3f6[_0x3804('0x5d')]&&_0x42c3f6[_0x3804('0x5d')]!==_0x3804('0x5e')){logger[_0x3804('0xa')](_0x3804('0x5f'),'Recording\x20is\x20enabled!');_0x2eed1d[_0x3804('0x46')]=util[_0x3804('0xc')](_0x3804('0x47'),_0x119b5e['serverUrl'],_0x2eed1d[_0x3804('0x48')],md5(_0x2eed1d[_0x3804('0x48')]));}headers[_0x3804('0x49')]=getAuth(_0x119b5e);return getUser(_0x119b5e,_0x63e712[_0x3804('0x60')])[_0x3804('0x14')](function(_0x102e77){_0x130666=_0x102e77;logger[_0x3804('0xa')](_0x3804('0x4a'),_0x130666['id']);return getEndUser(_0x119b5e,_0x2eed1d[_0x3804('0x61')],_0x2eed1d[_0x3804('0x62')]);})[_0x3804('0x14')](function(_0x57a6d3){_0x27858c=_0x57a6d3;logger[_0x3804('0xa')](_0x3804('0x4d'),_0x27858c['id']);return getTicket(_0x119b5e,_0x130666,_0x27858c,_0x1f9f94,_0x2eed1d);})[_0x3804('0x14')](function(_0xc055dc){if(_0xc055dc){logger[_0x3804('0xa')](_0x3804('0x63'),_0xc055dc['id']);switch(_0x119b5e[_0x3804('0x35')]){case _0x3804('0x64'):logger['info']('[OUTBOUND]',_0x3804('0x4e'));return request({'uri':util['format'](_0x3804('0x4f'),_0x119b5e['remoteUri'],_0x130666['id'],_0xc055dc['id']),'method':_0x3804('0xf')});case'newTab':logger[_0x3804('0xa')](_0x3804('0x5f'),_0x3804('0x51'));emit(util['format']('user:%s',_0x63e712[_0x3804('0x3f')]),_0x3804('0x53'),{'uri':util[_0x3804('0xc')](_0x3804('0x54'),_0x119b5e[_0x3804('0xe')]['replace'](_0x3804('0x56'),''),_0xc055dc['id'])});break;default:logger[_0x3804('0x59')](_0x3804('0x5f'),_0x3804('0x57'));}}})[_0x3804('0x58')](function(_0x5f4e50){logger[_0x3804('0x59')](_0x3804('0x65'),util['inspect'](_0x5f4e50,{'showHidden':!![],'depth':null}));});};exports[_0x3804('0x66')]=function(_0x16c580,_0x476a4e,_0x4a026e,_0x512287,_0x44b18d,_0x524678){var _0x2ad8c1,_0x5af728;_0x524678[_0x3804('0xe')]=intUtil[_0x3804('0x42')](_0x524678[_0x3804('0xe')]);_0x524678[_0x3804('0x43')]=intUtil[_0x3804('0x42')](_0x524678[_0x3804('0x43')]);if(_0x44b18d&&_0x44b18d[_0x3804('0x44')]){logger['info']('['+_0x476a4e['lastevent'][_0x3804('0x67')]()+']','Recording\x20is\x20enabled!');_0x476a4e['recordingURL']=util['format'](_0x3804('0x47'),_0x524678['serverUrl'],_0x476a4e['uniqueid'],md5(_0x476a4e['uniqueid']));}else{_0x476a4e[_0x3804('0x46')]='';}headers[_0x3804('0x49')]=getAuth(_0x524678);return getUser(_0x524678)[_0x3804('0x14')](function(_0x501d63){_0x2ad8c1=_0x501d63;logger['info']('The\x20User\x20ID\x20is:',_0x2ad8c1['id']);return getEndUser(_0x524678,_0x476a4e[_0x3804('0x4b')],_0x476a4e[_0x3804('0x4c')]);})['then'](function(_0xd83339){_0x5af728=_0xd83339;logger[_0x3804('0xa')](_0x3804('0x4d'),_0x5af728['id']);return getTicket(_0x524678,_0x2ad8c1,_0x5af728,_0x4a026e,_0x476a4e);})[_0x3804('0x14')](function(_0x3073d6){if(_0x3073d6){logger[_0x3804('0xa')](_0x3804('0x63'),_0x3073d6['id']);}})[_0x3804('0x58')](function(_0x5da3b8){logger['error']('['+_0x476a4e['lastevent'][_0x3804('0x67')]()+']'+_0x3804('0x68'),util['inspect'](_0x5da3b8,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xe22e=['uniqueid','destcalleridname','destcalleridnum','%s/agent/tickets/%s','replace','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','ioredis','./util','redis','defaults','localhost','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','merge','name','getString','Descriptions','Fields','then','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','find','results','agent','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!','%s/users.json','POST','Enduser\x20created.','user','authType','password','%s:%s','username','%s/token:%s','token','toString','debug','[HTTP]','stringify','GET','map','forEach','picklist','type','nameField','toLowerCase','content','includes','string','idField','custom_fields','push','variable','variableName','customField','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','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','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0x30bd4d,_0x50eb60){var _0x306915=function(_0x5ae782){while(--_0x5ae782){_0x30bd4d['push'](_0x30bd4d['shift']());}};_0x306915(++_0x50eb60);}(_0xe22e,0x15e));var _0xee22=function(_0x2382b7,_0x271ef2){_0x2382b7=_0x2382b7-0x0;var _0x4ea157=_0xe22e[_0x2382b7];return _0x4ea157;};'use strict';var _=require(_0xee22('0x0'));var rp=require('request-promise');var md5=require(_0xee22('0x1'));var util=require(_0xee22('0x2'));var Redis=require(_0xee22('0x3'));var intUtil=require(_0xee22('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('zendesk');config[_0xee22('0x5')]=_[_0xee22('0x6')](config[_0xee22('0x5')],{'host':_0xee22('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xee22('0x5')]));function emit(_0x40fcbc,_0x39de4b,_0x1b611f){io['to'](_0x40fcbc)[_0xee22('0x8')](_0x39de4b,_0x1b611f);}var headers={'Content-Type':'application/json','Accept':_0xee22('0x9')};function getTicket(_0x4b1f65,_0x48d047,_0x27e56f,_0x3a2570,_0x28877a){logger[_0xee22('0xa')](_0xee22('0xb'));return request({'uri':util[_0xee22('0xc')](_0xee22('0xd'),_0x4b1f65[_0xee22('0xe')]),'method':'POST','body':{'ticket':_[_0xee22('0xf')]({'requester_id':_0x27e56f['id'],'submitter_id':_0x48d047?_0x48d047['id']:undefined,'assignee_id':_0x48d047?_0x48d047['id']:undefined,'tags':getTags(_0x3a2570['Tags'],_0xee22('0x10')),'subject':intUtil['getString'](_0x3a2570['Subjects'],_0x28877a,'\x20'),'description':intUtil[_0xee22('0x11')](_0x3a2570[_0xee22('0x12')],_0x28877a,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x3a2570[_0xee22('0x12')],_0x28877a,'\x0a')}},getCustomFields(_0x3a2570[_0xee22('0x13')],_0x28877a))}})[_0xee22('0x14')](function(_0x4d27cd){logger[_0xee22('0xa')]('Ticket\x20created!');return _0x4d27cd[_0xee22('0x15')];});}function getUser(_0xa2013b,_0x2ae845){if(intUtil[_0xee22('0x16')](_0x2ae845)){logger[_0xee22('0xa')](_0xee22('0x17'),_0x2ae845);return request({'uri':util[_0xee22('0xc')](_0xee22('0x18'),_0xa2013b['remoteUri']),'qs':{'query':util[_0xee22('0xc')](_0xee22('0x19'),_0x2ae845)}})['then'](function(_0x49b008){if(_0x49b008[_0xee22('0x1a')]){logger[_0xee22('0xa')]('Agent\x20found!');return _[_0xee22('0x1b')](_0x49b008[_0xee22('0x1c')],{'email':_0x2ae845,'role':_0xee22('0x1d')});}else{logger[_0xee22('0xa')](_0xee22('0x1e'));return request({'uri':util[_0xee22('0xc')]('%s/users/me.json',_0xa2013b[_0xee22('0xe')])})['then'](function(_0x3f3a6f){logger[_0xee22('0xa')]('Admin\x20account\x20selected.');return _0x3f3a6f['user'];});}});}else{logger[_0xee22('0xa')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format']('%s/users/me.json',_0xa2013b[_0xee22('0xe')])})['then'](function(_0x4194c2){logger['info'](_0xee22('0x1f'));return _0x4194c2['user'];});}}function getEndUser(_0x4715d5,_0x3e72e5,_0x4bd62a){logger[_0xee22('0xa')](_0xee22('0x20'),_0x4bd62a);return request({'uri':util['format'](_0xee22('0x18'),_0x4715d5[_0xee22('0xe')]),'qs':{'query':util['format'](_0xee22('0x21'),_0x4bd62a)}})[_0xee22('0x14')](function(_0x9e7744){var _0x183d62;if(_0x9e7744['results'][_0xee22('0x22')]){_0x9e7744[_0xee22('0x1c')]=_[_0xee22('0x23')](_0x9e7744[_0xee22('0x1c')],{'suspended':![],'role':_0xee22('0x24')});if(_0x9e7744[_0xee22('0x1c')][_0xee22('0x22')]){_0x183d62=_[_0xee22('0x25')](_0x9e7744[_0xee22('0x1c')]);}}if(_0x183d62){logger[_0xee22('0xa')](_0xee22('0x26'));return _0x183d62;}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0xee22('0x27'),_0x4715d5['remoteUri']),'method':_0xee22('0x28'),'body':{'user':{'role':_0xee22('0x24'),'name':util[_0xee22('0xc')]('Caller\x20-\x20%s',_0x3e72e5||_0x4bd62a),'phone':_0x4bd62a}}})[_0xee22('0x14')](function(_0x4b0a3b){logger[_0xee22('0xa')](_0xee22('0x29'));return _0x4b0a3b[_0xee22('0x2a')];});}});}function getAuth(_0x385c11){var _0x1625bf;if(_0x385c11[_0xee22('0x2b')]===_0xee22('0x2c')){_0x1625bf=util[_0xee22('0xc')](_0xee22('0x2d'),_0x385c11[_0xee22('0x2e')],_0x385c11[_0xee22('0x2c')]);}else if(_0x385c11[_0xee22('0x2b')]==='token'){_0x1625bf=util[_0xee22('0xc')](_0xee22('0x2f'),_0x385c11[_0xee22('0x2e')],_0x385c11[_0xee22('0x30')]);}return util[_0xee22('0xc')]('Basic\x20%s',new Buffer(_0x1625bf)[_0xee22('0x31')]('base64'));}function request(_0x16cb26){logger[_0xee22('0x32')](_0xee22('0x33'),JSON[_0xee22('0x34')](_0x16cb26));return rp(_['defaults'](_0x16cb26,{'method':_0xee22('0x35'),'headers':headers,'json':!![]}));}function getTags(_0x437371,_0x5159db){var _0x1e7978=[];if(_0x437371&&_0x437371['length']>0x0){_0x1e7978=_[_0xee22('0x36')](_0x437371,_0x5159db);}return _0x1e7978;}function getCustomFields(_0x3253d0,_0x56d110){var _0x388ace=[];var _0xed2ff1={'custom_fields':[]};if(_0x3253d0[_0xee22('0x22')]>0x0){_[_0xee22('0x37')](_0x3253d0,function(_0x379228){if(_['includes'](['string',_0xee22('0x38')],_0x379228[_0xee22('0x39')])&&_0x379228[_0xee22('0x3a')]&&!_0x379228['customField']){_0xed2ff1[_0x379228['nameField'][_0xee22('0x3b')]()]=_0x379228[_0xee22('0x3c')]['toString']();}else if(_[_0xee22('0x3d')]([_0xee22('0x3e'),_0xee22('0x38')],_0x379228[_0xee22('0x39')])&&_0x379228[_0xee22('0x3f')]&&_0x379228['customField']){_0xed2ff1[_0xee22('0x40')][_0xee22('0x41')]({'id':_0x379228['idField'],'value':_0x379228[_0xee22('0x3c')]['toString']()});}else if(_0x379228['type']===_0xee22('0x42')&&_0x379228[_0xee22('0x43')]&&_0x379228['idField']&&_0x379228[_0xee22('0x44')]){_0x56d110[_0x379228['variableName']]&&_0xed2ff1['custom_fields'][_0xee22('0x41')]({'id':_0x379228[_0xee22('0x3f')],'value':_0x56d110[_0x379228[_0xee22('0x43')]][_0xee22('0x31')]()});}else if(_0x379228[_0xee22('0x39')]===_0xee22('0x45')&&_0x379228[_0xee22('0x46')]&&_0x379228['Variable'][_0xee22('0x10')]&&_0x379228[_0xee22('0x3f')]&&_0x379228[_0xee22('0x44')]){_0x56d110[_0x379228['Variable']['name']['toLowerCase']()]&&_0xed2ff1['custom_fields'][_0xee22('0x41')]({'id':_0x379228['idField'],'value':_0x56d110[_0x379228[_0xee22('0x46')][_0xee22('0x10')]['toLowerCase']()][_0xee22('0x31')]()});}});}return _0xed2ff1;}exports[_0xee22('0x47')]=function(_0x5e3f59,_0x2a9252,_0x2effeb,_0x568012,_0x4119c9,_0x3e30c6){var _0x175104,_0x439c21;_0x3e30c6[_0xee22('0xe')]=intUtil[_0xee22('0x48')](_0x3e30c6[_0xee22('0xe')]);_0x3e30c6['serverUrl']=intUtil[_0xee22('0x48')](_0x3e30c6[_0xee22('0x49')]);if(_0x4119c9&&_0x4119c9['monitor_format']){logger[_0xee22('0xa')](_0xee22('0x4a'),_0xee22('0x4b'));_0x2a9252['recordingURL']=util[_0xee22('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3e30c6[_0xee22('0x49')],_0x2a9252['uniqueid'],md5(_0x2a9252['uniqueid']));}else{_0x2a9252[_0xee22('0x4c')]='';}headers[_0xee22('0x4d')]=getAuth(_0x3e30c6);return getUser(_0x3e30c6,_0x568012[_0xee22('0x4e')])[_0xee22('0x14')](function(_0x1bdd07){_0x175104=_0x1bdd07;logger[_0xee22('0xa')](_0xee22('0x4f'),_0x175104['id']);return getEndUser(_0x3e30c6,_0x2a9252[_0xee22('0x50')],_0x2a9252[_0xee22('0x51')]);})['then'](function(_0x5c6f42){_0x439c21=_0x5c6f42;logger[_0xee22('0xa')](_0xee22('0x52'),_0x439c21['id']);return getTicket(_0x3e30c6,_0x175104,_0x439c21,_0x2effeb,_0x2a9252);})[_0xee22('0x14')](function(_0x233b8b){if(_0x233b8b){logger[_0xee22('0xa')](_0xee22('0x53'),_0x233b8b['id']);switch(_0x3e30c6[_0xee22('0x39')]){case _0xee22('0x54'):logger['info'](_0xee22('0x4a'),_0xee22('0x55'));return request({'uri':util[_0xee22('0xc')](_0xee22('0x56'),_0x3e30c6['remoteUri'],_0x175104['id'],_0x233b8b['id']),'method':_0xee22('0x28')});case _0xee22('0x57'):logger[_0xee22('0xa')](_0xee22('0x4a'),_0xee22('0x58'));emit(util['format'](_0xee22('0x59'),_0x568012['name']),_0xee22('0x5a'),{'uri':util['format']('%s/agent/tickets/%s',_0x3e30c6['remoteUri']['replace'](_0xee22('0x5b'),''),_0x233b8b['id'])});break;default:logger[_0xee22('0x5c')](_0xee22('0x4a'),_0xee22('0x5d'));}}})[_0xee22('0x5e')](function(_0x2a410e){logger[_0xee22('0x5c')](_0xee22('0x5f'),util[_0xee22('0x60')](_0x2a410e,{'showHidden':!![],'depth':null}));});};exports[_0xee22('0x61')]=function(_0x224f3b,_0x30fd1f,_0x3e3642,_0xe059d9,_0x3cc9fb,_0x4cd32c,_0x2030df){var _0x3a9220,_0x4e9fb1;_0x4cd32c[_0xee22('0xe')]=intUtil[_0xee22('0x48')](_0x4cd32c[_0xee22('0xe')]);_0x4cd32c[_0xee22('0x49')]=intUtil[_0xee22('0x48')](_0x4cd32c[_0xee22('0x49')]);if(_0x2030df&&_0x2030df[_0xee22('0x62')]&&_0x2030df[_0xee22('0x62')]!==_0xee22('0x63')){logger[_0xee22('0xa')](_0xee22('0x64'),'Recording\x20is\x20enabled!');_0x30fd1f['recordingURL']=util[_0xee22('0xc')](_0xee22('0x65'),_0x4cd32c['serverUrl'],_0x30fd1f[_0xee22('0x66')],md5(_0x30fd1f[_0xee22('0x66')]));}headers[_0xee22('0x4d')]=getAuth(_0x4cd32c);return getUser(_0x4cd32c,_0xe059d9[_0xee22('0x4e')])[_0xee22('0x14')](function(_0x45ec6b){_0x3a9220=_0x45ec6b;logger[_0xee22('0xa')](_0xee22('0x4f'),_0x3a9220['id']);return getEndUser(_0x4cd32c,_0x30fd1f[_0xee22('0x67')],_0x30fd1f[_0xee22('0x68')]);})['then'](function(_0x2623e5){_0x4e9fb1=_0x2623e5;logger[_0xee22('0xa')](_0xee22('0x52'),_0x4e9fb1['id']);return getTicket(_0x4cd32c,_0x3a9220,_0x4e9fb1,_0x3e3642,_0x30fd1f);})[_0xee22('0x14')](function(_0x5408d2){if(_0x5408d2){logger[_0xee22('0xa')](_0xee22('0x53'),_0x5408d2['id']);switch(_0x4cd32c[_0xee22('0x39')]){case _0xee22('0x54'):logger[_0xee22('0xa')](_0xee22('0x64'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xee22('0xc')](_0xee22('0x56'),_0x4cd32c[_0xee22('0xe')],_0x3a9220['id'],_0x5408d2['id']),'method':_0xee22('0x28')});case _0xee22('0x57'):logger['info'](_0xee22('0x64'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xee22('0xc')]('user:%s',_0xe059d9[_0xee22('0x10')]),_0xee22('0x5a'),{'uri':util[_0xee22('0xc')](_0xee22('0x69'),_0x4cd32c['remoteUri'][_0xee22('0x6a')]('/api/v2',''),_0x5408d2['id'])});break;default:logger[_0xee22('0x5c')](_0xee22('0x64'),_0xee22('0x5d'));}}})[_0xee22('0x5e')](function(_0x413630){logger[_0xee22('0x5c')](_0xee22('0x6b'),util[_0xee22('0x60')](_0x413630,{'showHidden':!![],'depth':null}));});};exports[_0xee22('0x6c')]=function(_0x4132f3,_0x23a704,_0x3b7536,_0x14f271,_0x57f7d1,_0x3eb0e6){var _0xef9c85,_0x2aa1c7;_0x3eb0e6[_0xee22('0xe')]=intUtil[_0xee22('0x48')](_0x3eb0e6[_0xee22('0xe')]);_0x3eb0e6[_0xee22('0x49')]=intUtil[_0xee22('0x48')](_0x3eb0e6[_0xee22('0x49')]);if(_0x57f7d1&&_0x57f7d1[_0xee22('0x6d')]){logger['info']('['+_0x23a704[_0xee22('0x6e')][_0xee22('0x6f')]()+']',_0xee22('0x4b'));_0x23a704['recordingURL']=util[_0xee22('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3eb0e6[_0xee22('0x49')],_0x23a704[_0xee22('0x66')],md5(_0x23a704[_0xee22('0x66')]));}else{_0x23a704[_0xee22('0x4c')]='';}headers['Authorization']=getAuth(_0x3eb0e6);return getUser(_0x3eb0e6)[_0xee22('0x14')](function(_0x31ca3a){_0xef9c85=_0x31ca3a;logger[_0xee22('0xa')](_0xee22('0x4f'),_0xef9c85['id']);return getEndUser(_0x3eb0e6,_0x23a704[_0xee22('0x50')],_0x23a704[_0xee22('0x51')]);})[_0xee22('0x14')](function(_0x27966e){_0x2aa1c7=_0x27966e;logger[_0xee22('0xa')](_0xee22('0x52'),_0x2aa1c7['id']);return getTicket(_0x3eb0e6,_0xef9c85,_0x2aa1c7,_0x3b7536,_0x23a704);})[_0xee22('0x14')](function(_0x445c61){if(_0x445c61){logger['info'](_0xee22('0x53'),_0x445c61['id']);}})[_0xee22('0x5e')](function(_0x35999e){logger[_0xee22('0x5c')]('['+_0x23a704[_0xee22('0x6e')]['toUpperCase']()+']'+_0xee22('0x70'),util[_0xee22('0x60')](_0x35999e,{'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 2552157..890852a 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 _0xef33=['split','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','then','seconds','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','findIndex','email','Using\x20the\x20admin\x20account!','profile','Administrator','users','user','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','enduserType','catch','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','data','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','GET','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','nothing','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Full_Name','Last_Name','First_Name','$se_module','talktime','Call_Duration','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','lastevent','called','Called','complete','connect','Call_Result','rejected','Rejected','Abandoned','timeout','Timeout','outbound','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','destcalleridname','Outbound','unmanaged','monitor_format','toUpperCase','md5','./util','moment','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','includes','string','picklist','idField','content','toString','type','variableName','Variable','name','toLowerCase'];(function(_0x4c263b,_0x4a3b37){var _0x88cc4=function(_0x5475c8){while(--_0x5475c8){_0x4c263b['push'](_0x4c263b['shift']());}};_0x88cc4(++_0x4a3b37);}(_0xef33,0x1af));var _0x3ef3=function(_0xe9a089,_0x483853){_0xe9a089=_0xe9a089-0x0;var _0x38966a=_0xef33[_0xe9a089];return _0x38966a;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x3ef3('0x0'));var util=require('util');var intUtil=require(_0x3ef3('0x1'));var moment=require(_0x3ef3('0x2'));var Redis=require('ioredis');var BPromise=require(_0x3ef3('0x3'));var config=require(_0x3ef3('0x4'));var logger=require(_0x3ef3('0x5'))(_0x3ef3('0x6'));config['redis']=_[_0x3ef3('0x7')](config[_0x3ef3('0x8')],{'host':_0x3ef3('0x9'),'port':0x18eb});var io=require(_0x3ef3('0xa'))(new Redis(config[_0x3ef3('0x8')]));function emit(_0x24de4b,_0x12288e,_0x28ac5b){io['to'](_0x24de4b)[_0x3ef3('0xb')](_0x12288e,_0x28ac5b);}function request(_0x4e4c5f){logger[_0x3ef3('0xc')](_0x3ef3('0xd'),JSON[_0x3ef3('0xe')](_0x4e4c5f));return rp(_0x4e4c5f);}function getCustomFields(_0x342c05,_0x16c0a6){var _0x1d14e5={};if(_0x342c05[_0x3ef3('0xf')]>0x0){_[_0x3ef3('0x10')](_0x342c05,function(_0x488b7e){if(_[_0x3ef3('0x11')]([_0x3ef3('0x12'),_0x3ef3('0x13')],_0x488b7e['type'])&&_0x488b7e[_0x3ef3('0x14')]){_0x1d14e5[_0x488b7e[_0x3ef3('0x14')]]=_0x488b7e[_0x3ef3('0x15')][_0x3ef3('0x16')]();}else if(_0x488b7e[_0x3ef3('0x17')]==='variable'&&_0x488b7e[_0x3ef3('0x18')]&&_0x488b7e[_0x3ef3('0x14')]&&_0x16c0a6[_0x488b7e['variableName']]){_0x1d14e5[_0x488b7e[_0x3ef3('0x14')]]=_0x16c0a6[_0x488b7e[_0x3ef3('0x18')]][_0x3ef3('0x16')]();}else if(_0x488b7e[_0x3ef3('0x17')]==='customVariable'&&_0x488b7e[_0x3ef3('0x19')]&&_0x488b7e['Variable']['name']&&_0x488b7e[_0x3ef3('0x14')]&&_0x16c0a6[_0x488b7e[_0x3ef3('0x19')][_0x3ef3('0x1a')][_0x3ef3('0x1b')]()]){_0x1d14e5[_0x488b7e[_0x3ef3('0x14')]]=_0x16c0a6[_0x488b7e[_0x3ef3('0x19')][_0x3ef3('0x1a')][_0x3ef3('0x1b')]()][_0x3ef3('0x16')]();}});}return _0x1d14e5;}function getName(_0x46d8d0){if(_0x46d8d0['indexOf']('\x20')>0x0){var _0x4cd865=_0x46d8d0[_0x3ef3('0x1c')](/ (.+)/);if(_0x4cd865[0x1]){return _0x4cd865;}}return[_0x46d8d0,_0x46d8d0];}var accountsTokens={};function getAccessToken(_0x4c229d){return new Promise(function(_0x41c282,_0x1e9217){if(!_['isNil'](accountsTokens[_0x4c229d['id']])&&!_[_0x3ef3('0x1d')](accountsTokens[_0x4c229d['id']][_0x3ef3('0x1e')])){if(moment()[_0x3ef3('0x1f')](accountsTokens[_0x4c229d['id']][_0x3ef3('0x20')])){_0x41c282(accountsTokens[_0x4c229d['id']]['access_token']);}}var _0x1dba24;switch(_0x4c229d['zone']){case'US':_0x1dba24=_0x3ef3('0x21');break;case'AU':_0x1dba24=_0x3ef3('0x22');break;case'EU':_0x1dba24=_0x3ef3('0x23');break;case'IN':_0x1dba24='https://accounts.zoho.in';break;case'CN':_0x1dba24=_0x3ef3('0x24');break;default:_0x1dba24=_0x3ef3('0x23');break;}var _0x491094={'method':_0x3ef3('0x25'),'uri':_0x1dba24+_0x3ef3('0x26'),'qs':{'refresh_token':_0x4c229d[_0x3ef3('0x27')],'client_id':_0x4c229d['clientId'],'client_secret':_0x4c229d[_0x3ef3('0x28')],'grant_type':_0x3ef3('0x29')},'json':!![]};return rp(_0x491094)[_0x3ef3('0x2a')](function(_0x1d0c0c){accountsTokens[_0x4c229d['id']]={'access_token':_0x1d0c0c[_0x3ef3('0x1e')],'expires_in':moment()['add'](_0x1d0c0c[_0x3ef3('0x20')],_0x3ef3('0x2b'))};_0x41c282(_0x1d0c0c[_0x3ef3('0x1e')]);})['catch'](function(_0xa92d9a){logger[_0x3ef3('0x2c')](_0x3ef3('0x2d'),_0xa92d9a[_0x3ef3('0x2e')]);_0x1e9217(_0xa92d9a);});});}function getUser(_0x2cdbfb,_0x421f41,_0x33a01b,_0x2b2864){logger[_0x3ef3('0x2f')](_0x3ef3('0x30'));return request({'method':'GET','uri':util[_0x3ef3('0x31')](_0x3ef3('0x32'),_0x421f41),'qs':{'type':_0x3ef3('0x33')},'headers':{'Authorization':_0x3ef3('0x34')+_0x2cdbfb},'json':!![]})[_0x3ef3('0x2a')](function(_0x3fb897){if(_0x3fb897['users']){var _0x3c29d5=-0x1;if(_['isArrayLikeObject'](_0x3fb897['users'])){if(!_[_0x3ef3('0x1d')](_0x2b2864)){_0x3c29d5=_[_0x3ef3('0x35')](_0x3fb897['users'],function(_0x5b7800){return _0x5b7800[_0x3ef3('0x36')]===_0x2b2864;});}if(_0x3c29d5>=0x0){logger[_0x3ef3('0x2f')]('Agent\x20found!');}else{logger['info'](_0x3ef3('0x37'));_0x3c29d5=_[_0x3ef3('0x35')](_0x3fb897['users'],function(_0x59df00){return _0x59df00[_0x3ef3('0x38')][_0x3ef3('0x1a')]===_0x3ef3('0x39');});}return _0x3fb897[_0x3ef3('0x3a')][_0x3c29d5];}else{if(_0x3fb897[_0x3ef3('0x3b')][_0x3ef3('0x38')][_0x3ef3('0x1a')]===_0x3ef3('0x39')){logger[_0x3ef3('0x2f')](_0x3ef3('0x37'));user=_0x3fb897[_0x3ef3('0x3b')];return user;}else{logger[_0x3ef3('0x2c')]('The\x20failing\x20result\x20is',JSON['stringify'](_0x3fb897));throw new Error(_0x3ef3('0x3c')+JSON[_0x3ef3('0xe')](_0x3fb897));}}}else{logger[_0x3ef3('0x2c')](_0x3ef3('0x3d'),JSON['stringify'](_0x3fb897));throw new Error(_0x3ef3('0x3c')+JSON['stringify'](_0x3fb897));}})['catch'](function(_0x25192d){console[_0x3ef3('0x2c')](_0x25192d);});}function getZohoUser(_0x2d8d5a,_0xc568c5){return new BPromise(function(_0x1ef2d3,_0x365e2d){request(_0x2d8d5a)[_0x3ef3('0x2a')](function(_0x954851){var _0x34869f=null;if(_0x954851){_0x34869f=_0x954851['data'][0x0];_0x34869f[_0x3ef3('0x3e')]=_0xc568c5;}_0x1ef2d3(_0x34869f);})[_0x3ef3('0x3f')](function(_0x70eda0){_0x365e2d(_0x70eda0);});});}function createEndUser(_0x1fdc17,_0xb742ce,_0x5ad692,_0x5e7622,_0x2f0107,_0x3313fc){var _0x5ad692=getName(_0x5ad692);return request({'method':_0x3ef3('0x25'),'uri':_0x3ef3('0x40')+_0xb742ce+'/crm/v2/'+_[_0x3ef3('0x41')](_0x3313fc[_0x3ef3('0x42')])+'s','body':{'data':[{'Last_Name':_0x5ad692[0x1],'First_Name':_0x5ad692[0x0],'Phone':_0x5e7622,'Owner':{'name':!_[_0x3ef3('0x1d')](_0x2f0107[_0x3ef3('0x43')][_0x3ef3('0x1a')])?_0x2f0107[_0x3ef3('0x43')][_0x3ef3('0x1a')]:!_[_0x3ef3('0x1d')](_0x2f0107[_0x3ef3('0x44')])?_0x2f0107[_0x3ef3('0x44')]+'\x20'+_0x2f0107[_0x3ef3('0x45')]:_0x2f0107[_0x3ef3('0x45')],'id':_0x2f0107['id']}}]},'headers':{'Authorization':_0x3ef3('0x34')+_0x1fdc17},'json':!![]})[_0x3ef3('0x2a')](function(_0x1cee52){if(_0x1cee52&&_0x1cee52[_0x3ef3('0x46')][0x0][_0x3ef3('0x47')]===_0x3ef3('0x48')){var _0x2f01dc=_0x1cee52[_0x3ef3('0x46')][0x0][_0x3ef3('0x49')];_0x2f01dc[_0x3ef3('0x3e')]=_['startCase'](_0x3313fc[_0x3ef3('0x42')])+'s';return _0x2f01dc;}logger['error']('The\x20failing\x20result\x20is',JSON[_0x3ef3('0xe')](data));throw new Error(_0x3ef3('0x4a')+JSON[_0x3ef3('0xe')](data));})[_0x3ef3('0x3f')](function(_0x3e0516){console[_0x3ef3('0x4b')](_0x3ef3('0x4c'),_0x3e0516);});}function getEndUser(_0x3b1d72,_0x4f6267,_0x23323a,_0x1fbdb1,_0x485639,_0x4c5563,_0x308a21){var _0x2bccc8={'method':_0x3ef3('0x4d'),'uri':'','headers':{'Authorization':_0x3ef3('0x34')+_0x3b1d72},'json':!![]};switch(_0x308a21[_0x3ef3('0x4e')]){case _0x3ef3('0x4f'):_0x2bccc8[_0x3ef3('0x50')]=_0x3ef3('0x40')+_0x4f6267+_0x3ef3('0x51')+_0x485639+'))';return getZohoUser(_0x2bccc8,_0x3ef3('0x52'))[_0x3ef3('0x2a')](function(_0x1fb21f){if(_0x1fb21f)return _0x1fb21f;_0x2bccc8['uri']=_0x3ef3('0x40')+_0x4f6267+_0x3ef3('0x53')+_0x485639+'))';return getZohoUser(_0x2bccc8,_0x3ef3('0x54'))[_0x3ef3('0x2a')](function(_0x550a23){if(_0x550a23)return _0x550a23;if(_0x308a21[_0x3ef3('0x42')]!='nothing'){return createEndUser(_0x3b1d72,_0x4f6267,_0x1fbdb1,_0x485639,_0x4c5563,_0x308a21);}else{return{};}});});break;case _0x3ef3('0x55'):_0x2bccc8[_0x3ef3('0x50')]=_0x3ef3('0x40')+_0x4f6267+_0x3ef3('0x51')+_0x485639+'))';return getZohoUser(_0x2bccc8,_0x3ef3('0x52'))[_0x3ef3('0x2a')](function(_0x37c8bb){if(_0x37c8bb)return _0x37c8bb;if(_0x308a21[_0x3ef3('0x42')]!=_0x3ef3('0x56')){return createEndUser(_0x3b1d72,_0x4f6267,_0x1fbdb1,_0x485639,_0x4c5563,_0x308a21);}else{return{};}});break;case _0x3ef3('0x57'):_0x2bccc8[_0x3ef3('0x50')]=_0x3ef3('0x40')+_0x4f6267+_0x3ef3('0x53')+_0x485639+'))';return getZohoUser(_0x2bccc8,'Leads')[_0x3ef3('0x2a')](function(_0x34527b){if(_0x34527b)return _0x34527b;if(_0x308a21['moduleCreate']!=_0x3ef3('0x56')){return createEndUser(_0x3b1d72,_0x4f6267,_0x1fbdb1,_0x485639,_0x4c5563,_0x308a21);}else{return{};}});break;}}function getCall(_0x2efa8e,_0x3d029d,_0x567aa7,_0x538a09,_0xe31d97,_0x445b3e,_0x3628c9,_0x22efc7){logger['info'](_0x3ef3('0x58'));var _0x5a6dc2={};_0x5a6dc2[_0x3ef3('0x59')]={'name':!_[_0x3ef3('0x1d')](_0x538a09[_0x3ef3('0x43')][_0x3ef3('0x1a')])&&!_[_0x3ef3('0x1d')](_0x538a09[_0x3ef3('0x38')]['name'])&&_0x538a09['profile'][_0x3ef3('0x1a')]===_0x3ef3('0x5a')?_0x538a09['role'][_0x3ef3('0x1a')]:!_['isNil'](_0x538a09[_0x3ef3('0x44')])?_0x538a09[_0x3ef3('0x44')]+'\x20'+_0x538a09[_0x3ef3('0x45')]:_0x538a09[_0x3ef3('0x45')],'id':_0x538a09['id']};_0x5a6dc2[_0x3ef3('0x5b')]=intUtil[_0x3ef3('0x5c')](_0x445b3e[_0x3ef3('0x5d')],_0x3628c9,'\x20');_0x5a6dc2[_0x3ef3('0x5e')]=intUtil[_0x3ef3('0x5c')](_0x445b3e['Descriptions'],_0x3628c9,'\x0a');if(_0xe31d97[_0x3ef3('0x3e')]==='Contacts'){_0x5a6dc2['Who_Id']={'name':!_['isNil'](_0xe31d97[_0x3ef3('0x5f')])?_0xe31d97[_0x3ef3('0x5f')]:!_[_0x3ef3('0x1d')](_0xe31d97['First_Name'])?_0xe31d97['First_Name']+'\x20'+_0xe31d97[_0x3ef3('0x60')]:_0xe31d97[_0x3ef3('0x60')],'id':_0xe31d97['id']};}if(_0xe31d97[_0x3ef3('0x3e')]===_0x3ef3('0x54')){_0x5a6dc2['What_Id']={'name':!_[_0x3ef3('0x1d')](_0xe31d97[_0x3ef3('0x5f')])?_0xe31d97[_0x3ef3('0x5f')]:!_['isNil'](_0xe31d97['First_Name'])?_0xe31d97[_0x3ef3('0x61')]+'\x20'+_0xe31d97[_0x3ef3('0x60')]:_0xe31d97[_0x3ef3('0x60')],'id':_0xe31d97['id']};_0x5a6dc2[_0x3ef3('0x62')]=_[_0x3ef3('0x41')](_0xe31d97[_0x3ef3('0x3e')]);}if(_0x3628c9[_0x3ef3('0x63')]){_0x5a6dc2[_0x3ef3('0x64')]=moment['utc'](parseInt(_0x3628c9[_0x3ef3('0x63')])*0x3e8)[_0x3ef3('0x31')]('mm:ss');}else if(_0x3628c9['answertime']&&_0x3628c9[_0x3ef3('0x65')]){_0x5a6dc2[_0x3ef3('0x64')]=moment['utc'](moment(_0x3628c9['endtime'],_0x3ef3('0x66'))[_0x3ef3('0x67')](moment(_0x3628c9[_0x3ef3('0x68')],_0x3ef3('0x66'))))[_0x3ef3('0x31')](_0x3ef3('0x69'));}switch(_0x3628c9[_0x3ef3('0x6a')]){case _0x3ef3('0x6b'):_0x5a6dc2['Call_Result']=_0x3ef3('0x6c');break;case _0x3ef3('0x6d'):case _0x3ef3('0x6e'):_0x5a6dc2[_0x3ef3('0x6f')]='Answered';break;case _0x3ef3('0x70'):_0x5a6dc2[_0x3ef3('0x6f')]=_0x3ef3('0x71');break;case'abandoned':_0x5a6dc2[_0x3ef3('0x6f')]=_0x3ef3('0x72');break;case _0x3ef3('0x73'):_0x5a6dc2[_0x3ef3('0x6f')]=_0x3ef3('0x74');default:}_0x5a6dc2['Call_Start_Time']=(_0x22efc7===_0x3ef3('0x75')?moment(_0x3628c9['starttime'])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x3628c9['agentcalledAt'])[_0x3ef3('0x31')](_0x3ef3('0x66')))||moment()[_0x3ef3('0x31')](_0x3ef3('0x66'));_0x5a6dc2[_0x3ef3('0x76')]=_0x22efc7||_0x3ef3('0x77');_0x5a6dc2=_[_0x3ef3('0x78')](_0x5a6dc2,getCustomFields(_0x445b3e[_0x3ef3('0x79')],_0x3628c9));return request({'method':_0x3ef3('0x25'),'uri':_0x3ef3('0x40')+_0x3d029d+_0x3ef3('0x7a'),'headers':{'Authorization':_0x3ef3('0x34')+_0x2efa8e},'body':{'data':[_0x5a6dc2]},'json':!![]})['then'](function(_0xf1b154){if(_0xf1b154&&_0xf1b154[_0x3ef3('0x46')][0x0][_0x3ef3('0x47')]===_0x3ef3('0x48')){logger['info'](_0x3ef3('0x7b'));return{'id':_0xf1b154[_0x3ef3('0x46')][0x0]['details']['id']};}})[_0x3ef3('0x3f')](function(_0xd5dfc5){logger['info'](_0x3ef3('0x7c'),_0xd5dfc5[_0x3ef3('0x2e')]);console['log'](_0x3ef3('0x7c'),_0xd5dfc5);});}exports[_0x3ef3('0x7d')]=function(_0x410a74,_0x216152,_0x25c8e4,_0x6eddb5,_0x13c437,_0x19fdf0){var _0x10674c,_0x5d20c7,_0x19fd0a;_0x19fdf0[_0x3ef3('0x7e')]=intUtil[_0x3ef3('0x7f')](_0x19fdf0[_0x3ef3('0x7e')]);_0x19fdf0[_0x3ef3('0x80')]=intUtil[_0x3ef3('0x7f')](_0x19fdf0['serverUrl']);if(_0x13c437&&_0x13c437['monitor_format']){logger['info'](_0x3ef3('0x81'),_0x3ef3('0x82'));_0x216152[_0x3ef3('0x83')]=_0x19fdf0[_0x3ef3('0x80')]+'/api/voice/recordings/'+_0x216152[_0x3ef3('0x84')]+_0x3ef3('0x85')+md5(_0x216152[_0x3ef3('0x84')]);}else{_0x216152[_0x3ef3('0x83')]='';}var _0x5df683=_0x19fdf0[_0x3ef3('0x7e')]===_0x3ef3('0x86')?'eu':_0x3ef3('0x87');return getAccessToken(_0x19fdf0)[_0x3ef3('0x2a')](function(_0x2a4fba){_0x19fd0a=_0x2a4fba;return getUser(_0x19fd0a,_0x5df683,_0x19fdf0,_0x6eddb5[_0x3ef3('0x36')]);})['then'](function(_0x5f4e7e){_0x10674c=_0x5f4e7e;logger[_0x3ef3('0x2f')](_0x3ef3('0x88'),_0x10674c['id']);return getEndUser(_0x19fd0a,_0x5df683,_0x19fdf0,_0x216152[_0x3ef3('0x89')],_0x216152[_0x3ef3('0x8a')],_0x10674c,_0x25c8e4);})[_0x3ef3('0x2a')](function(_0x579348){_0x5d20c7=_0x579348;return getCall(_0x19fd0a,_0x5df683,_0x19fdf0,_0x10674c,_0x5d20c7,_0x25c8e4,_0x216152,'Inbound');})[_0x3ef3('0x2a')](function(_0x120920){if(_0x120920){logger[_0x3ef3('0x2f')](_0x3ef3('0x8b'),_0x120920['id']);logger['info'](_0x3ef3('0x81'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x3ef3('0x31')](_0x3ef3('0x8c'),_0x6eddb5[_0x3ef3('0x1a')]),_0x3ef3('0x8d'),{'uri':_0x3ef3('0x8e')+_0x19fdf0[_0x3ef3('0x7e')]+_0x3ef3('0x8f')+_0x120920['id']});}})[_0x3ef3('0x3f')](function(_0x1f2160){logger[_0x3ef3('0x2c')]('[QUEUE]',JSON['stringify'](_0x1f2160));});};exports[_0x3ef3('0x75')]=function(_0x41cb74,_0x2d29b4,_0x5b6e1d,_0x57883f,_0x28e380,_0x13a57c,_0xa9bd2a){var _0x556e75,_0x4b375d,_0x4d9441;_0x13a57c[_0x3ef3('0x7e')]=intUtil[_0x3ef3('0x7f')](_0x13a57c[_0x3ef3('0x7e')]);_0x13a57c[_0x3ef3('0x80')]=intUtil[_0x3ef3('0x7f')](_0x13a57c[_0x3ef3('0x80')]);if(_0xa9bd2a&&_0xa9bd2a['recordingFormat']&&_0xa9bd2a[_0x3ef3('0x90')]!==_0x3ef3('0x91')){logger[_0x3ef3('0x2f')](_0x3ef3('0x92'),_0x3ef3('0x82'));_0x2d29b4[_0x3ef3('0x83')]=_0x13a57c['serverUrl']+_0x3ef3('0x93')+_0x2d29b4[_0x3ef3('0x84')]+_0x3ef3('0x85')+md5(_0x2d29b4[_0x3ef3('0x84')]);}var _0x3c18fd=_0x13a57c[_0x3ef3('0x7e')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x13a57c)[_0x3ef3('0x2a')](function(_0x14b9d8){_0x4d9441=_0x14b9d8;return getUser(_0x4d9441,_0x3c18fd,_0x13a57c,_0x57883f[_0x3ef3('0x36')]);})[_0x3ef3('0x2a')](function(_0x9d6def){_0x556e75=_0x9d6def;logger[_0x3ef3('0x2f')](_0x3ef3('0x88'),_0x556e75['id']);return getEndUser(_0x4d9441,_0x3c18fd,_0x13a57c,_0x2d29b4[_0x3ef3('0x94')],_0x2d29b4['destcalleridnum'],_0x556e75,_0x5b6e1d);})[_0x3ef3('0x2a')](function(_0x5c4660){_0x4b375d=_0x5c4660;return getCall(_0x4d9441,_0x3c18fd,_0x13a57c,_0x556e75,_0x4b375d,_0x5b6e1d,_0x2d29b4,_0x3ef3('0x95'));})[_0x3ef3('0x2a')](function(_0x386588){if(_0x386588){logger[_0x3ef3('0x2f')](_0x3ef3('0x8b'),_0x386588['id']);logger['info'](_0x3ef3('0x92'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x3ef3('0x31')](_0x3ef3('0x8c'),_0x57883f['name']),_0x3ef3('0x8d'),{'uri':'https://crm.'+_0x13a57c[_0x3ef3('0x7e')]+_0x3ef3('0x8f')+_0x386588['id']});}})[_0x3ef3('0x3f')](function(_0x1011f2){logger[_0x3ef3('0x2c')](_0x3ef3('0x92'),JSON[_0x3ef3('0xe')](_0x1011f2));});};exports[_0x3ef3('0x96')]=function(_0x47569c,_0xb7eba5,_0x413276,_0x4de5f1,_0x263ff5,_0x23be8a){var _0x4b1ed0,_0x2aa54c,_0x518da6;_0x23be8a[_0x3ef3('0x7e')]=intUtil[_0x3ef3('0x7f')](_0x23be8a[_0x3ef3('0x7e')]);_0x23be8a[_0x3ef3('0x80')]=intUtil[_0x3ef3('0x7f')](_0x23be8a[_0x3ef3('0x80')]);if(_0x263ff5&&_0x263ff5[_0x3ef3('0x97')]){logger['info']('['+_0xb7eba5[_0x3ef3('0x6a')][_0x3ef3('0x98')]()+']','Recording\x20is\x20enabled!');_0xb7eba5['recordingURL']=_0x23be8a['serverUrl']+'/api/voice/recordings/'+_0xb7eba5[_0x3ef3('0x84')]+_0x3ef3('0x85')+md5(_0xb7eba5[_0x3ef3('0x84')]);}else{_0xb7eba5[_0x3ef3('0x83')]='';}var _0x173b00=_0x23be8a[_0x3ef3('0x7e')]===_0x3ef3('0x86')?'eu':_0x3ef3('0x87');return getAccessToken(_0x23be8a)[_0x3ef3('0x2a')](function(_0x55e1f6){_0x518da6=_0x55e1f6;return getUser(_0x518da6,_0x173b00,_0x23be8a);})[_0x3ef3('0x2a')](function(_0x42eb03){_0x4b1ed0=_0x42eb03;logger[_0x3ef3('0x2f')](_0x3ef3('0x88'),_0x4b1ed0['id']);return getEndUser(_0x518da6,_0x173b00,_0x23be8a,_0xb7eba5[_0x3ef3('0x89')],_0xb7eba5[_0x3ef3('0x8a')],_0x4b1ed0,_0x413276);})[_0x3ef3('0x2a')](function(_0x3f4d96){_0x2aa54c=_0x3f4d96;return getCall(_0x518da6,_0x173b00,_0x23be8a,_0x4b1ed0,_0x2aa54c,_0x413276,_0xb7eba5,_0x3ef3('0x77'));})[_0x3ef3('0x2a')](function(_0x3262b7){if(_0x3262b7){logger['info'](_0x3ef3('0x8b'),_0x3262b7['id']);}})['catch'](function(_0x2363b6){logger[_0x3ef3('0x2c')]('['+_0xb7eba5[_0x3ef3('0x6a')][_0x3ef3('0x98')]()+']',JSON[_0x3ef3('0xe')](_0x2363b6));});}; \ No newline at end of file +var _0x2d76=['err','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','recordingFormat','none','[OUTBOUND]','destcalleridname','Outbound','calleridname','toUpperCase','lodash','md5','./util','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','emit','debug','stringify','length','forEach','includes','string','picklist','type','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','split','isNil','access_token','expires_in','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','then','add','seconds','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','code','details','Error:\x20','log','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','lead','Leads','Creating\x20new\x20call...','administrator','Subject','Subjects','Description','getString','Descriptions','enduserType','Full_Name','First_Name','Last_Name','utc','talktime','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','Called','complete','connect','rejected','Rejected','abandoned','timeout','Timeout','Call_Start_Time','outbound','Call_Type','Inbound','merge','Fields','SUCCESS','Call\x20created!'];(function(_0x46475,_0x459e10){var _0x1f214a=function(_0x4b3443){while(--_0x4b3443){_0x46475['push'](_0x46475['shift']());}};_0x1f214a(++_0x459e10);}(_0x2d76,0x146));var _0x62d7=function(_0x518aa7,_0x53c94d){_0x518aa7=_0x518aa7-0x0;var _0x1a1215=_0x2d76[_0x518aa7];return _0x1a1215;};'use strict';var _=require(_0x62d7('0x0'));var rp=require('request-promise');var md5=require(_0x62d7('0x1'));var util=require('util');var intUtil=require(_0x62d7('0x2'));var moment=require(_0x62d7('0x3'));var Redis=require(_0x62d7('0x4'));var BPromise=require('bluebird');var config=require(_0x62d7('0x5'));var logger=require(_0x62d7('0x6'))(_0x62d7('0x7'));config[_0x62d7('0x8')]=_[_0x62d7('0x9')](config[_0x62d7('0x8')],{'host':_0x62d7('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x62d7('0x8')]));function emit(_0x16bf98,_0x413885,_0x522b41){io['to'](_0x16bf98)[_0x62d7('0xb')](_0x413885,_0x522b41);}function request(_0x1fbd79){logger[_0x62d7('0xc')]('[HTTP]',JSON[_0x62d7('0xd')](_0x1fbd79));return rp(_0x1fbd79);}function getCustomFields(_0x236851,_0x3f40d3){var _0x5ce84a={};if(_0x236851[_0x62d7('0xe')]>0x0){_[_0x62d7('0xf')](_0x236851,function(_0x2ad745){if(_[_0x62d7('0x10')]([_0x62d7('0x11'),_0x62d7('0x12')],_0x2ad745[_0x62d7('0x13')])&&_0x2ad745[_0x62d7('0x14')]){_0x5ce84a[_0x2ad745[_0x62d7('0x14')]]=_0x2ad745[_0x62d7('0x15')]['toString']();}else if(_0x2ad745['type']===_0x62d7('0x16')&&_0x2ad745[_0x62d7('0x17')]&&_0x2ad745[_0x62d7('0x14')]&&_0x3f40d3[_0x2ad745[_0x62d7('0x17')]]){_0x5ce84a[_0x2ad745[_0x62d7('0x14')]]=_0x3f40d3[_0x2ad745[_0x62d7('0x17')]][_0x62d7('0x18')]();}else if(_0x2ad745['type']===_0x62d7('0x19')&&_0x2ad745[_0x62d7('0x1a')]&&_0x2ad745[_0x62d7('0x1a')][_0x62d7('0x1b')]&&_0x2ad745[_0x62d7('0x14')]&&_0x3f40d3[_0x2ad745[_0x62d7('0x1a')][_0x62d7('0x1b')]['toLowerCase']()]){_0x5ce84a[_0x2ad745[_0x62d7('0x14')]]=_0x3f40d3[_0x2ad745['Variable'][_0x62d7('0x1b')][_0x62d7('0x1c')]()][_0x62d7('0x18')]();}});}return _0x5ce84a;}function getName(_0x59d397){if(_0x59d397['indexOf']('\x20')>0x0){var _0x4738de=_0x59d397[_0x62d7('0x1d')](/ (.+)/);if(_0x4738de[0x1]){return _0x4738de;}}return[_0x59d397,_0x59d397];}var accountsTokens={};function getAccessToken(_0x22fc42){return new Promise(function(_0x49ec5e,_0x1d90b3){if(!_['isNil'](accountsTokens[_0x22fc42['id']])&&!_[_0x62d7('0x1e')](accountsTokens[_0x22fc42['id']][_0x62d7('0x1f')])){if(moment()['isBefore'](accountsTokens[_0x22fc42['id']][_0x62d7('0x20')])){_0x49ec5e(accountsTokens[_0x22fc42['id']]['access_token']);}}var _0x27794f;switch(_0x22fc42[_0x62d7('0x21')]){case'US':_0x27794f='https://accounts.zoho.com';break;case'AU':_0x27794f=_0x62d7('0x22');break;case'EU':_0x27794f=_0x62d7('0x23');break;case'IN':_0x27794f=_0x62d7('0x24');break;case'CN':_0x27794f=_0x62d7('0x25');break;default:_0x27794f='https://accounts.zoho.eu';break;}var _0x2c3f06={'method':_0x62d7('0x26'),'uri':_0x27794f+_0x62d7('0x27'),'qs':{'refresh_token':_0x22fc42[_0x62d7('0x28')],'client_id':_0x22fc42[_0x62d7('0x29')],'client_secret':_0x22fc42[_0x62d7('0x2a')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x2c3f06)[_0x62d7('0x2b')](function(_0x483b45){accountsTokens[_0x22fc42['id']]={'access_token':_0x483b45[_0x62d7('0x1f')],'expires_in':moment()[_0x62d7('0x2c')](_0x483b45[_0x62d7('0x20')],_0x62d7('0x2d'))};_0x49ec5e(_0x483b45[_0x62d7('0x1f')]);})['catch'](function(_0x3927b8){logger[_0x62d7('0x2e')](_0x62d7('0x2f'),_0x3927b8[_0x62d7('0x30')]);_0x1d90b3(_0x3927b8);});});}function getUser(_0x29a48e,_0x5a4d56,_0x4a61f0,_0x33dea6){logger[_0x62d7('0x31')](_0x62d7('0x32'));return request({'method':_0x62d7('0x33'),'uri':util[_0x62d7('0x34')](_0x62d7('0x35'),_0x5a4d56),'qs':{'type':_0x62d7('0x36')},'headers':{'Authorization':_0x62d7('0x37')+_0x29a48e},'json':!![]})['then'](function(_0x225c97){if(_0x225c97['users']){var _0x3a1b5a=-0x1;if(_[_0x62d7('0x38')](_0x225c97[_0x62d7('0x39')])){if(!_[_0x62d7('0x1e')](_0x33dea6)){_0x3a1b5a=_[_0x62d7('0x3a')](_0x225c97[_0x62d7('0x39')],function(_0x114e11){return _0x114e11[_0x62d7('0x3b')]===_0x33dea6;});}if(_0x3a1b5a>=0x0){logger[_0x62d7('0x31')](_0x62d7('0x3c'));}else{logger['info'](_0x62d7('0x3d'));_0x3a1b5a=_[_0x62d7('0x3a')](_0x225c97[_0x62d7('0x39')],function(_0xe4ec26){return _0xe4ec26[_0x62d7('0x3e')][_0x62d7('0x1b')]===_0x62d7('0x3f');});}return _0x225c97[_0x62d7('0x39')][_0x3a1b5a];}else{if(_0x225c97[_0x62d7('0x40')][_0x62d7('0x3e')]['name']===_0x62d7('0x3f')){logger[_0x62d7('0x31')](_0x62d7('0x3d'));user=_0x225c97[_0x62d7('0x40')];return user;}else{logger[_0x62d7('0x2e')](_0x62d7('0x41'),JSON['stringify'](_0x225c97));throw new Error(_0x62d7('0x42')+JSON[_0x62d7('0xd')](_0x225c97));}}}else{logger[_0x62d7('0x2e')](_0x62d7('0x41'),JSON[_0x62d7('0xd')](_0x225c97));throw new Error(_0x62d7('0x42')+JSON[_0x62d7('0xd')](_0x225c97));}})[_0x62d7('0x43')](function(_0x2ebec8){console[_0x62d7('0x2e')](_0x2ebec8);});}function getZohoUser(_0x3eafa2,_0x5245e7){return new BPromise(function(_0x323a9a,_0x3b15fb){request(_0x3eafa2)[_0x62d7('0x2b')](function(_0x59d61a){var _0x3e2c90=null;if(_0x59d61a){_0x3e2c90=_0x59d61a[_0x62d7('0x44')][0x0];_0x3e2c90['enduserType']=_0x5245e7;}_0x323a9a(_0x3e2c90);})['catch'](function(_0x3827b5){_0x3b15fb(_0x3827b5);});});}function createEndUser(_0x5d3f3d,_0x4cbab8,_0x44d2ff,_0x53f420,_0x56d556,_0x26f4f5){var _0x44d2ff=getName(_0x44d2ff);return request({'method':_0x62d7('0x26'),'uri':_0x62d7('0x45')+_0x4cbab8+'/crm/v2/'+_[_0x62d7('0x46')](_0x26f4f5[_0x62d7('0x47')])+'s','body':{'data':[{'Last_Name':_0x44d2ff[0x1],'First_Name':_0x44d2ff[0x0],'Phone':_0x53f420,'Owner':{'name':!_['isNil'](_0x56d556[_0x62d7('0x48')]['name'])?_0x56d556[_0x62d7('0x48')]['name']:!_[_0x62d7('0x1e')](_0x56d556[_0x62d7('0x49')])?_0x56d556[_0x62d7('0x49')]+'\x20'+_0x56d556[_0x62d7('0x4a')]:_0x56d556[_0x62d7('0x4a')],'id':_0x56d556['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x5d3f3d},'json':!![]})['then'](function(_0x533288){if(_0x533288&&_0x533288[_0x62d7('0x44')][0x0][_0x62d7('0x4b')]==='SUCCESS'){var _0x505a67=_0x533288[_0x62d7('0x44')][0x0][_0x62d7('0x4c')];_0x505a67['enduserType']=_[_0x62d7('0x46')](_0x26f4f5[_0x62d7('0x47')])+'s';return _0x505a67;}logger[_0x62d7('0x2e')]('The\x20failing\x20result\x20is',JSON[_0x62d7('0xd')](data));throw new Error(_0x62d7('0x4d')+JSON[_0x62d7('0xd')](data));})['catch'](function(_0x26095d){console[_0x62d7('0x4e')]('CREATE\x20ERROR',_0x26095d);});}function getEndUser(_0x366469,_0x2783af,_0x40c640,_0x3cfc9c,_0x57e55c,_0x3c9e4f,_0x53060b){var _0xa09235={'method':_0x62d7('0x33'),'uri':'','headers':{'Authorization':_0x62d7('0x37')+_0x366469},'json':!![]};switch(_0x53060b[_0x62d7('0x4f')]){case'contact_lead':_0xa09235[_0x62d7('0x50')]=_0x62d7('0x45')+_0x2783af+_0x62d7('0x51')+_0x57e55c+'))';return getZohoUser(_0xa09235,_0x62d7('0x52'))[_0x62d7('0x2b')](function(_0x1b7aca){if(_0x1b7aca)return _0x1b7aca;_0xa09235[_0x62d7('0x50')]=_0x62d7('0x45')+_0x2783af+_0x62d7('0x53')+_0x57e55c+'))';return getZohoUser(_0xa09235,'Leads')[_0x62d7('0x2b')](function(_0x1c3d44){if(_0x1c3d44)return _0x1c3d44;if(_0x53060b[_0x62d7('0x47')]!=_0x62d7('0x54')){return createEndUser(_0x366469,_0x2783af,_0x3cfc9c,_0x57e55c,_0x3c9e4f,_0x53060b);}else{return{};}});});break;case _0x62d7('0x55'):_0xa09235[_0x62d7('0x50')]=_0x62d7('0x45')+_0x2783af+_0x62d7('0x51')+_0x57e55c+'))';return getZohoUser(_0xa09235,_0x62d7('0x52'))['then'](function(_0x2267a1){if(_0x2267a1)return _0x2267a1;if(_0x53060b[_0x62d7('0x47')]!='nothing'){return createEndUser(_0x366469,_0x2783af,_0x3cfc9c,_0x57e55c,_0x3c9e4f,_0x53060b);}else{return{};}});break;case _0x62d7('0x56'):_0xa09235['uri']='https://www.zohoapis.'+_0x2783af+_0x62d7('0x53')+_0x57e55c+'))';return getZohoUser(_0xa09235,_0x62d7('0x57'))['then'](function(_0x323100){if(_0x323100)return _0x323100;if(_0x53060b[_0x62d7('0x47')]!=_0x62d7('0x54')){return createEndUser(_0x366469,_0x2783af,_0x3cfc9c,_0x57e55c,_0x3c9e4f,_0x53060b);}else{return{};}});break;}}function getCall(_0x51e638,_0x55e3aa,_0x4c7c50,_0x16e4c3,_0x2e255c,_0x2ac89a,_0xd51c9f,_0x410fe1){logger['info'](_0x62d7('0x58'));var _0x5526a0={};_0x5526a0['Owner']={'name':!_[_0x62d7('0x1e')](_0x16e4c3[_0x62d7('0x48')][_0x62d7('0x1b')])&&!_['isNil'](_0x16e4c3[_0x62d7('0x3e')][_0x62d7('0x1b')])&&_0x16e4c3[_0x62d7('0x3e')][_0x62d7('0x1b')]===_0x62d7('0x59')?_0x16e4c3[_0x62d7('0x48')]['name']:!_['isNil'](_0x16e4c3['first_name'])?_0x16e4c3[_0x62d7('0x49')]+'\x20'+_0x16e4c3[_0x62d7('0x4a')]:_0x16e4c3[_0x62d7('0x4a')],'id':_0x16e4c3['id']};_0x5526a0[_0x62d7('0x5a')]=intUtil['getString'](_0x2ac89a[_0x62d7('0x5b')],_0xd51c9f,'\x20');_0x5526a0[_0x62d7('0x5c')]=intUtil[_0x62d7('0x5d')](_0x2ac89a[_0x62d7('0x5e')],_0xd51c9f,'\x0a');if(_0x2e255c[_0x62d7('0x5f')]==='Contacts'){_0x5526a0['Who_Id']={'name':!_['isNil'](_0x2e255c['Full_Name'])?_0x2e255c[_0x62d7('0x60')]:!_[_0x62d7('0x1e')](_0x2e255c[_0x62d7('0x61')])?_0x2e255c[_0x62d7('0x61')]+'\x20'+_0x2e255c['Last_Name']:_0x2e255c[_0x62d7('0x62')],'id':_0x2e255c['id']};}if(_0x2e255c[_0x62d7('0x5f')]===_0x62d7('0x57')){_0x5526a0['What_Id']={'name':!_[_0x62d7('0x1e')](_0x2e255c[_0x62d7('0x60')])?_0x2e255c[_0x62d7('0x60')]:!_[_0x62d7('0x1e')](_0x2e255c[_0x62d7('0x61')])?_0x2e255c[_0x62d7('0x61')]+'\x20'+_0x2e255c['Last_Name']:_0x2e255c['Last_Name'],'id':_0x2e255c['id']};_0x5526a0['$se_module']=_['startCase'](_0x2e255c['enduserType']);}if(_0xd51c9f['talktime']){_0x5526a0['Call_Duration']=moment[_0x62d7('0x63')](parseInt(_0xd51c9f[_0x62d7('0x64')])*0x3e8)['format'](_0x62d7('0x65'));}else if(_0xd51c9f[_0x62d7('0x66')]&&_0xd51c9f[_0x62d7('0x67')]){_0x5526a0['Call_Duration']=moment[_0x62d7('0x63')](moment(_0xd51c9f[_0x62d7('0x67')],'YYYY-MM-DDTHH:mm:ss')['diff'](moment(_0xd51c9f['starttime'],_0x62d7('0x68'))))['format'](_0x62d7('0x65'));}switch(_0xd51c9f[_0x62d7('0x69')]){case _0x62d7('0x6a'):_0x5526a0[_0x62d7('0x6b')]=_0x62d7('0x6c');break;case _0x62d7('0x6d'):case _0x62d7('0x6e'):_0x5526a0[_0x62d7('0x6b')]='Answered';break;case _0x62d7('0x6f'):_0x5526a0['Call_Result']=_0x62d7('0x70');break;case _0x62d7('0x71'):_0x5526a0['Call_Result']='Abandoned';break;case _0x62d7('0x72'):_0x5526a0[_0x62d7('0x6b')]=_0x62d7('0x73');default:}_0x5526a0[_0x62d7('0x74')]=(_0x410fe1===_0x62d7('0x75')?moment(_0xd51c9f['starttime'])[_0x62d7('0x34')](_0x62d7('0x68')):moment(_0xd51c9f['agentcalledAt'])['format'](_0x62d7('0x68')))||moment()[_0x62d7('0x34')](_0x62d7('0x68'));_0x5526a0[_0x62d7('0x76')]=_0x410fe1||_0x62d7('0x77');_0x5526a0=_[_0x62d7('0x78')](_0x5526a0,getCustomFields(_0x2ac89a[_0x62d7('0x79')],_0xd51c9f));return request({'method':_0x62d7('0x26'),'uri':_0x62d7('0x45')+_0x55e3aa+'/crm/v2/Calls','headers':{'Authorization':_0x62d7('0x37')+_0x51e638},'body':{'data':[_0x5526a0]},'json':!![]})[_0x62d7('0x2b')](function(_0x15a2cd){if(_0x15a2cd&&_0x15a2cd[_0x62d7('0x44')][0x0][_0x62d7('0x4b')]===_0x62d7('0x7a')){logger[_0x62d7('0x31')](_0x62d7('0x7b'));return{'id':_0x15a2cd[_0x62d7('0x44')][0x0]['details']['id']};}})[_0x62d7('0x43')](function(_0xe117af){logger[_0x62d7('0x31')](_0x62d7('0x7c'),_0xe117af[_0x62d7('0x30')]);console['log']('err',_0xe117af);});}exports['queue']=function(_0x13389e,_0x57a05c,_0x460e8a,_0x51ec15,_0x129302,_0x26befa){var _0x15c6c1,_0xf4c902,_0x5d10f8;_0x26befa[_0x62d7('0x7d')]=intUtil['stripTrailingSlash'](_0x26befa[_0x62d7('0x7d')]);_0x26befa[_0x62d7('0x7e')]=intUtil[_0x62d7('0x7f')](_0x26befa['serverUrl']);if(_0x129302&&_0x129302[_0x62d7('0x80')]){logger[_0x62d7('0x31')](_0x62d7('0x81'),_0x62d7('0x82'));_0x57a05c[_0x62d7('0x83')]=_0x26befa[_0x62d7('0x7e')]+_0x62d7('0x84')+_0x57a05c[_0x62d7('0x85')]+_0x62d7('0x86')+md5(_0x57a05c['uniqueid']);}else{_0x57a05c[_0x62d7('0x83')]='';}var _0x52b8c1=_0x26befa[_0x62d7('0x7d')]===_0x62d7('0x87')?'eu':_0x62d7('0x88');return getAccessToken(_0x26befa)[_0x62d7('0x2b')](function(_0x3e0779){_0x5d10f8=_0x3e0779;return getUser(_0x5d10f8,_0x52b8c1,_0x26befa,_0x51ec15[_0x62d7('0x3b')]);})['then'](function(_0x317485){_0x15c6c1=_0x317485;logger['info'](_0x62d7('0x89'),_0x15c6c1['id']);return getEndUser(_0x5d10f8,_0x52b8c1,_0x26befa,_0x57a05c['calleridname'],_0x57a05c['calleridnum'],_0x15c6c1,_0x460e8a);})['then'](function(_0x2dc862){_0xf4c902=_0x2dc862;return getCall(_0x5d10f8,_0x52b8c1,_0x26befa,_0x15c6c1,_0xf4c902,_0x460e8a,_0x57a05c,_0x62d7('0x77'));})['then'](function(_0x2eaf37){if(_0x2eaf37){logger['info'](_0x62d7('0x8a'),_0x2eaf37['id']);logger[_0x62d7('0x31')]('[QUEUE]',_0x62d7('0x8b'));emit(util['format'](_0x62d7('0x8c'),_0x51ec15[_0x62d7('0x1b')]),_0x62d7('0x8d'),{'uri':_0x62d7('0x8e')+_0x26befa['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x2eaf37['id']});}})['catch'](function(_0x32c6de){logger[_0x62d7('0x2e')]('[QUEUE]',JSON[_0x62d7('0xd')](_0x32c6de));});};exports['outbound']=function(_0x53ca74,_0x5b0caf,_0x4a5d04,_0x43af15,_0x3715ae,_0x3dabcc,_0x12d7f2){var _0x33a2e7,_0x54963d,_0x58fe94;_0x3dabcc[_0x62d7('0x7d')]=intUtil[_0x62d7('0x7f')](_0x3dabcc[_0x62d7('0x7d')]);_0x3dabcc['serverUrl']=intUtil[_0x62d7('0x7f')](_0x3dabcc[_0x62d7('0x7e')]);if(_0x12d7f2&&_0x12d7f2[_0x62d7('0x8f')]&&_0x12d7f2[_0x62d7('0x8f')]!==_0x62d7('0x90')){logger['info'](_0x62d7('0x91'),'Recording\x20is\x20enabled!');_0x5b0caf[_0x62d7('0x83')]=_0x3dabcc['serverUrl']+_0x62d7('0x84')+_0x5b0caf[_0x62d7('0x85')]+_0x62d7('0x86')+md5(_0x5b0caf[_0x62d7('0x85')]);}var _0x2c28b3=_0x3dabcc[_0x62d7('0x7d')]===_0x62d7('0x87')?'eu':'com';return getAccessToken(_0x3dabcc)[_0x62d7('0x2b')](function(_0x244523){_0x58fe94=_0x244523;return getUser(_0x58fe94,_0x2c28b3,_0x3dabcc,_0x43af15[_0x62d7('0x3b')]);})[_0x62d7('0x2b')](function(_0x5a72a1){_0x33a2e7=_0x5a72a1;logger['info']('The\x20User\x20ID\x20is:',_0x33a2e7['id']);return getEndUser(_0x58fe94,_0x2c28b3,_0x3dabcc,_0x5b0caf[_0x62d7('0x92')],_0x5b0caf['destcalleridnum'],_0x33a2e7,_0x4a5d04);})[_0x62d7('0x2b')](function(_0x16d76c){_0x54963d=_0x16d76c;return getCall(_0x58fe94,_0x2c28b3,_0x3dabcc,_0x33a2e7,_0x54963d,_0x4a5d04,_0x5b0caf,_0x62d7('0x93'));})[_0x62d7('0x2b')](function(_0x2138da){if(_0x2138da){logger[_0x62d7('0x31')]('The\x20Call\x20ID\x20is:',_0x2138da['id']);logger[_0x62d7('0x31')](_0x62d7('0x91'),_0x62d7('0x8b'));emit(util[_0x62d7('0x34')]('user:%s',_0x43af15[_0x62d7('0x1b')]),'trigger:browser:url',{'uri':_0x62d7('0x8e')+_0x3dabcc['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x2138da['id']});}})[_0x62d7('0x43')](function(_0x524ff0){logger[_0x62d7('0x2e')]('[OUTBOUND]',JSON[_0x62d7('0xd')](_0x524ff0));});};exports['unmanaged']=function(_0x3658b8,_0x44c66c,_0x22199d,_0xe83987,_0x522921,_0x1db411){var _0x543351,_0x34ee9a,_0x36b22c;_0x1db411[_0x62d7('0x7d')]=intUtil[_0x62d7('0x7f')](_0x1db411[_0x62d7('0x7d')]);_0x1db411[_0x62d7('0x7e')]=intUtil[_0x62d7('0x7f')](_0x1db411[_0x62d7('0x7e')]);if(_0x522921&&_0x522921[_0x62d7('0x80')]){logger[_0x62d7('0x31')]('['+_0x44c66c[_0x62d7('0x69')]['toUpperCase']()+']',_0x62d7('0x82'));_0x44c66c['recordingURL']=_0x1db411['serverUrl']+_0x62d7('0x84')+_0x44c66c[_0x62d7('0x85')]+_0x62d7('0x86')+md5(_0x44c66c[_0x62d7('0x85')]);}else{_0x44c66c[_0x62d7('0x83')]='';}var _0x4d7286=_0x1db411[_0x62d7('0x7d')]===_0x62d7('0x87')?'eu':_0x62d7('0x88');return getAccessToken(_0x1db411)[_0x62d7('0x2b')](function(_0x5e7ce7){_0x36b22c=_0x5e7ce7;return getUser(_0x36b22c,_0x4d7286,_0x1db411);})[_0x62d7('0x2b')](function(_0x1c7e35){_0x543351=_0x1c7e35;logger[_0x62d7('0x31')](_0x62d7('0x89'),_0x543351['id']);return getEndUser(_0x36b22c,_0x4d7286,_0x1db411,_0x44c66c[_0x62d7('0x94')],_0x44c66c['calleridnum'],_0x543351,_0x22199d);})[_0x62d7('0x2b')](function(_0x8b6bc5){_0x34ee9a=_0x8b6bc5;return getCall(_0x36b22c,_0x4d7286,_0x1db411,_0x543351,_0x34ee9a,_0x22199d,_0x44c66c,'Inbound');})[_0x62d7('0x2b')](function(_0xffe2bb){if(_0xffe2bb){logger[_0x62d7('0x31')](_0x62d7('0x8a'),_0xffe2bb['id']);}})[_0x62d7('0x43')](function(_0x260611){logger[_0x62d7('0x2e')]('['+_0x44c66c[_0x62d7('0x69')][_0x62d7('0x95')]()+']',JSON[_0x62d7('0xd')](_0x260611));});}; \ 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 7dd9d21..7ee9a30 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 _0xa7c9=['Script','data3','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','mustache','../../../../config/logger','trigger','exec','data2'];(function(_0x2a4608,_0xf51c1e){var _0x5bc3db=function(_0x29f323){while(--_0x29f323){_0x2a4608['push'](_0x2a4608['shift']());}};_0x5bc3db(++_0xf51c1e);}(_0xa7c9,0x7c));var _0x9a7c=function(_0x1898bd,_0xee8cd){_0x1898bd=_0x1898bd-0x0;var _0x4498bb=_0xa7c9[_0x1898bd];return _0x4498bb;};'use strict';var util=require('util');var sh=require(_0x9a7c('0x0'));var Mustache=require(_0x9a7c('0x1'));var logger=require(_0x9a7c('0x2'))(_0x9a7c('0x3'));exports[_0x9a7c('0x4')]=function(_0x1ecbb0,_0x2e8552){var _0x3ff483=_0x1ecbb0[_0x9a7c('0x5')]?_0x1ecbb0[_0x9a7c('0x5')]:_0x9a7c('0x6');var _0x20a403=_0x1ecbb0[_0x9a7c('0x7')]?Mustache['render'](_0x1ecbb0[_0x9a7c('0x7')],_0x2e8552):_0x2e8552;sh[_0x9a7c('0x4')](_0x20a403,function(_0x3cfbb1,_0x4ef87c,_0x234e6f){if(_0x3cfbb1!==0x0){logger[_0x9a7c('0x8')](util[_0x9a7c('0x9')](_0x9a7c('0xa'),_0x3ff483,_0x20a403,_0x3cfbb1,_0x234e6f));}else{logger[_0x9a7c('0xb')](util[_0x9a7c('0x9')](_0x9a7c('0xc'),_0x3ff483,_0x20a403,_0x4ef87c));}});}; \ No newline at end of file +var _0x29f1=['mustache','trigger','exec','data2','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x289e27,_0x519efa){var _0x1b755d=function(_0x299d1b){while(--_0x299d1b){_0x289e27['push'](_0x289e27['shift']());}};_0x1b755d(++_0x519efa);}(_0x29f1,0x66));var _0x129f=function(_0x5e980d,_0x316987){_0x5e980d=_0x5e980d-0x0;var _0x347477=_0x29f1[_0x5e980d];return _0x347477;};'use strict';var util=require(_0x129f('0x0'));var sh=require(_0x129f('0x1'));var Mustache=require(_0x129f('0x2'));var logger=require('../../../../config/logger')(_0x129f('0x3'));exports[_0x129f('0x4')]=function(_0x226252,_0x4e1841){var _0x40b881=_0x226252['data2']?_0x226252[_0x129f('0x5')]:'Script';var _0x136d92=_0x226252[_0x129f('0x6')]?Mustache[_0x129f('0x7')](_0x226252['data3'],_0x4e1841):_0x4e1841;sh['exec'](_0x136d92,function(_0x1054b5,_0x3ed9ac,_0x26fa63){if(_0x1054b5!==0x0){logger[_0x129f('0x8')](util[_0x129f('0x9')](_0x129f('0xa'),_0x40b881,_0x136d92,_0x1054b5,_0x26fa63));}else{logger[_0x129f('0xb')](util[_0x129f('0x9')](_0x129f('0xc'),_0x40b881,_0x136d92,_0x3ed9ac));}});}; \ 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 3280179..3b15c66 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 _0x355c=['%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','request-promise','lodash','mustache','exec','data1','toUpperCase','render','data2','data5','number','data6','error','stack','GET','POST','data7','parse','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','isNil',',\x20request\x20body:\x20','body','info'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x355c,0x16d));var _0xc355=function(_0x5b7e20,_0x17cfec){_0x5b7e20=_0x5b7e20-0x0;var _0x57eddf=_0x355c[_0x5b7e20];return _0x57eddf;};'use strict';var rp=require(_0xc355('0x0'));var util=require('util');var _=require(_0xc355('0x1'));var Mustache=require(_0xc355('0x2'));var logger=require('../../../../config/logger')('trigger');exports[_0xc355('0x3')]=function(_0x5f1e43,_0x3c6b04){var _0x3d5223,_0x316995;var _0x301361={'method':_0x5f1e43[_0xc355('0x4')][_0xc355('0x5')](),'uri':Mustache[_0xc355('0x6')](_0x5f1e43[_0xc355('0x7')],_0x3c6b04),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5f1e43[_0xc355('0x8')])===_0xc355('0x9')&&parseInt(_0x5f1e43[_0xc355('0x8')])>=0x1&&parseInt(_0x5f1e43[_0xc355('0x8')])<=0xa?parseInt(_0x5f1e43[_0xc355('0x8')])*0x3e8:0x5*0x3e8};try{_0x301361['headers']=_0x5f1e43[_0xc355('0xa')]?JSON['parse'](Mustache[_0xc355('0x6')](_0x5f1e43[_0xc355('0xa')],_0x3c6b04)):{};}catch(_0x475e80){logger[_0xc355('0xb')](_0x475e80[_0xc355('0xc')]);}switch(_0x5f1e43['data1']['toUpperCase']()){case _0xc355('0xd'):case'DELETE':_0x3d5223=null;_0x301361['qs']=_0x3c6b04;break;case _0xc355('0xe'):case'PUT':if(_0x5f1e43[_0xc355('0xf')]){try{_0x3d5223=JSON[_0xc355('0x10')](Mustache[_0xc355('0x6')](_0x5f1e43[_0xc355('0xf')],_0x3c6b04));_0x301361['body']=_0x3d5223;}catch(_0x643b15){logger[_0xc355('0xb')](_0x643b15[_0xc355('0xc')]);logger['error'](_0xc355('0x11'));}}else{_0x3d5223=_0x3c6b04;_0x301361['body']=_0x3d5223;}break;}logger['info'](util[_0xc355('0x12')](_0xc355('0x13'),_0x5f1e43[_0xc355('0x4')],_0x5f1e43['data2'],JSON[_0xc355('0x14')](_0x301361)));rp(_0x301361)['then'](function(_0xd8509e){_0x3d5223=!_[_0xc355('0x15')](_0x3d5223)?_0xc355('0x16')+_0x3d5223:'';_0x316995=typeof _0xd8509e[_0xc355('0x17')]==='object'?JSON[_0xc355('0x14')](_0xd8509e[_0xc355('0x17')]):_0xd8509e['body'];logger[_0xc355('0x18')](util[_0xc355('0x12')](_0xc355('0x19'),_0x5f1e43[_0xc355('0x4')],_0x5f1e43[_0xc355('0x7')],_0xd8509e[_0xc355('0x1a')],_0x316995));})[_0xc355('0x1b')](function(_0x24b119){logger[_0xc355('0xb')](util[_0xc355('0x12')](_0xc355('0x1c'),_0x5f1e43[_0xc355('0x4')],_0x5f1e43[_0xc355('0x7')],_0x24b119['statusCode'],_0x24b119[_0xc355('0x1d')],_0x24b119['message']));});}; \ No newline at end of file +var _0x41b8=['request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec','render','data2','data5','number','headers','data6','parse','stack','data1','toUpperCase','GET','DELETE','POST','PUT','data7','error','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','isNil',',\x20request\x20body:\x20','body','object','format','%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'];(function(_0x473b78,_0x568697){var _0x554b34=function(_0x123e99){while(--_0x123e99){_0x473b78['push'](_0x473b78['shift']());}};_0x554b34(++_0x568697);}(_0x41b8,0x94));var _0x841b=function(_0x292f93,_0x2c6e8e){_0x292f93=_0x292f93-0x0;var _0x5a94b1=_0x41b8[_0x292f93];return _0x5a94b1;};'use strict';var rp=require(_0x841b('0x0'));var util=require(_0x841b('0x1'));var _=require(_0x841b('0x2'));var Mustache=require(_0x841b('0x3'));var logger=require(_0x841b('0x4'))(_0x841b('0x5'));exports[_0x841b('0x6')]=function(_0x489e38,_0x5da420){var _0x173814,_0x16bd50;var _0x232ff7={'method':_0x489e38['data1']['toUpperCase'](),'uri':Mustache[_0x841b('0x7')](_0x489e38[_0x841b('0x8')],_0x5da420),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x489e38[_0x841b('0x9')])===_0x841b('0xa')&&parseInt(_0x489e38[_0x841b('0x9')])>=0x1&&parseInt(_0x489e38[_0x841b('0x9')])<=0xa?parseInt(_0x489e38[_0x841b('0x9')])*0x3e8:0x5*0x3e8};try{_0x232ff7[_0x841b('0xb')]=_0x489e38[_0x841b('0xc')]?JSON[_0x841b('0xd')](Mustache[_0x841b('0x7')](_0x489e38[_0x841b('0xc')],_0x5da420)):{};}catch(_0xe5c857){logger['error'](_0xe5c857[_0x841b('0xe')]);}switch(_0x489e38[_0x841b('0xf')][_0x841b('0x10')]()){case _0x841b('0x11'):case _0x841b('0x12'):_0x173814=null;_0x232ff7['qs']=_0x5da420;break;case _0x841b('0x13'):case _0x841b('0x14'):if(_0x489e38[_0x841b('0x15')]){try{_0x173814=JSON[_0x841b('0xd')](Mustache[_0x841b('0x7')](_0x489e38[_0x841b('0x15')],_0x5da420));_0x232ff7['body']=_0x173814;}catch(_0x171ad8){logger[_0x841b('0x16')](_0x171ad8[_0x841b('0xe')]);logger[_0x841b('0x16')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x173814=_0x5da420;_0x232ff7['body']=_0x173814;}break;}logger[_0x841b('0x17')](util['format'](_0x841b('0x18'),_0x489e38[_0x841b('0xf')],_0x489e38[_0x841b('0x8')],JSON[_0x841b('0x19')](_0x232ff7)));rp(_0x232ff7)['then'](function(_0x5eb966){_0x173814=!_[_0x841b('0x1a')](_0x173814)?_0x841b('0x1b')+_0x173814:'';_0x16bd50=typeof _0x5eb966[_0x841b('0x1c')]===_0x841b('0x1d')?JSON[_0x841b('0x19')](_0x5eb966[_0x841b('0x1c')]):_0x5eb966['body'];logger[_0x841b('0x17')](util[_0x841b('0x1e')](_0x841b('0x1f'),_0x489e38[_0x841b('0xf')],_0x489e38[_0x841b('0x8')],_0x5eb966[_0x841b('0x20')],_0x16bd50));})[_0x841b('0x21')](function(_0x320eff){logger[_0x841b('0x16')](util[_0x841b('0x1e')](_0x841b('0x22'),_0x489e38['data1'],_0x489e38['data2'],_0x320eff['statusCode'],_0x320eff[_0x841b('0x23')],_0x320eff[_0x841b('0x24')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 3bcaa15..55f6594 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 _0xeaf5=['exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','then','debug','error','rpc','message','result','catch'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0xeaf5,0x1b4));var _0x5eaf=function(_0x3b5e02,_0x535469){_0x3b5e02=_0x3b5e02-0x0;var _0x59464c=_0xeaf5[_0x3b5e02];return _0x59464c;};'use strict';var jayson=require(_0x5eaf('0x0'));var BPromise=require(_0x5eaf('0x1'));var logger=require(_0x5eaf('0x2'))(_0x5eaf('0x3'));var client=jayson[_0x5eaf('0x4')][_0x5eaf('0x5')]({'port':0x2329});client[_0x5eaf('0x6')]=function(_0x5a5ef3,_0x57d473){return new BPromise(function(_0x3d05f3,_0x2259e1){return client['request'](_0x5a5ef3,_0x57d473)[_0x5eaf('0x7')](function(_0x62c14e){logger[_0x5eaf('0x8')]('rpc',_0x5eaf('0x3'),_0x5a5ef3,_0x57d473,_0x62c14e);if(_0x62c14e['error']){logger[_0x5eaf('0x9')](_0x5eaf('0xa'),_0x5eaf('0x3'),_0x5a5ef3,_0x62c14e[_0x5eaf('0x9')][_0x5eaf('0xb')],_0x57d473);return _0x2259e1(_0x62c14e[_0x5eaf('0x9')][_0x5eaf('0xb')]);}else{return _0x3d05f3(_0x62c14e[_0x5eaf('0xc')]);}})[_0x5eaf('0xd')](function(_0x54dca2){logger[_0x5eaf('0x9')](_0x5eaf('0xa'),_0x5eaf('0x3'),_0x5a5ef3,_0x54dca2,_0x57d473);return _0x2259e1(_0x54dca2);});});};module[_0x5eaf('0xe')]=client; \ No newline at end of file +var _0x141c=['Request','then','debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client'];(function(_0x1e01ca,_0x14dc80){var _0x318e7f=function(_0x1fe292){while(--_0x1fe292){_0x1e01ca['push'](_0x1e01ca['shift']());}};_0x318e7f(++_0x14dc80);}(_0x141c,0x183));var _0xc141=function(_0x40ab99,_0x20c247){_0x40ab99=_0x40ab99-0x0;var _0x1b5b3e=_0x141c[_0x40ab99];return _0x1b5b3e;};'use strict';var jayson=require(_0xc141('0x0'));var BPromise=require(_0xc141('0x1'));var logger=require(_0xc141('0x2'))(_0xc141('0x3'));var client=jayson[_0xc141('0x4')]['http']({'port':0x2329});client[_0xc141('0x5')]=function(_0x5207b6,_0x31e200){return new BPromise(function(_0x2d6206,_0x1de7b1){return client['request'](_0x5207b6,_0x31e200)[_0xc141('0x6')](function(_0x84924a){logger[_0xc141('0x7')](_0xc141('0x8'),_0xc141('0x3'),_0x5207b6,_0x31e200,_0x84924a);if(_0x84924a[_0xc141('0x9')]){logger[_0xc141('0x9')](_0xc141('0x8'),_0xc141('0x3'),_0x5207b6,_0x84924a[_0xc141('0x9')][_0xc141('0xa')],_0x31e200);return _0x1de7b1(_0x84924a['error'][_0xc141('0xa')]);}else{return _0x2d6206(_0x84924a[_0xc141('0xb')]);}})[_0xc141('0xc')](function(_0x25cdb1){logger[_0xc141('0x9')](_0xc141('0x8'),_0xc141('0x3'),_0x5207b6,_0x25cdb1,_0x31e200);return _0x1de7b1(_0x25cdb1);});});};module[_0xc141('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 558ec5c..0393fdd 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 _0x294d=['log','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','resolve','getMailAccounts','initMailAccounts','mailAccounts','listen','then','loginMailFrequency'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x294d,0x7f));var _0xd294=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x294d[_0x3b0731];return _0x4204d7;};'use strict';var BPromise=require(_0xd294('0x0'));var server=require(_0xd294('0x1'));var Realtime=require(_0xd294('0x2'));var EmailChannel=require(_0xd294('0x3'));var mailAccount=require(_0xd294('0x4'));var setting=require(_0xd294('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0xd294('0x6')]()['then'](mailAccount[_0xd294('0x7')]())['then'](realtime[_0xd294('0x8')]())['then'](function(){email['refresh'](realtime[_0xd294('0x9')]);return realtime;});}function main(){return server[_0xd294('0xa')](realtime,email)[_0xd294('0xb')](function(){return initRealtime();})[_0xd294('0xb')](function(){return setting['getSettings']();})[_0xd294('0xb')](function(_0x31019f){return setInterval(initRealtime,_0x31019f[_0xd294('0xc')]*0x3e8);})['catch'](function(_0x2d3e73){console[_0xd294('0xd')](_0x2d3e73);});}main(); \ No newline at end of file +var _0x4377=['getMailAccounts','initMailAccounts','refresh','mailAccounts','getSettings','loginMailFrequency','log','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','resolve','then'];(function(_0x2d2949,_0x24c559){var _0x4bb11f=function(_0x2a75d7){while(--_0x2a75d7){_0x2d2949['push'](_0x2d2949['shift']());}};_0x4bb11f(++_0x24c559);}(_0x4377,0xcb));var _0x7437=function(_0x1901f4,_0x41ed70){_0x1901f4=_0x1901f4-0x0;var _0x1237af=_0x4377[_0x1901f4];return _0x1237af;};'use strict';var BPromise=require(_0x7437('0x0'));var server=require(_0x7437('0x1'));var Realtime=require(_0x7437('0x2'));var EmailChannel=require(_0x7437('0x3'));var mailAccount=require(_0x7437('0x4'));var setting=require('./rpc/setting');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x7437('0x5')]()[_0x7437('0x6')](mailAccount[_0x7437('0x7')]())[_0x7437('0x6')](realtime[_0x7437('0x8')]())[_0x7437('0x6')](function(){email[_0x7437('0x9')](realtime[_0x7437('0xa')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x7437('0x6')](function(){return initRealtime();})[_0x7437('0x6')](function(){return setting[_0x7437('0xb')]();})['then'](function(_0x2ac670){return setInterval(initRealtime,_0x2ac670[_0x7437('0xc')]*0x3e8);})['catch'](function(_0xcf923a){console[_0x7437('0xd')](_0xcf923a);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index ef6c5e5..b024ad3 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 _0xa734=['handleImapEnd','error','handleImapError','isNil','disabled','messageStatus','messages','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','lastSync','sendMail','send','verifySmtp','Smtp','verify','catch','exports','lodash','moment','bluebird','../../../config/environment','../../../config/logger','redis','localhost','./smtp','../rpc/mailAccount','info','mailAccounts','smtp','prototype','emit','name','Imap','status','total','stringify','md5','mailAccount:update','refresh','hasOwnProperty','active','imapAccounts','email','box','handleImapBox','bind','handleImapEmail','end'];(function(_0x5dc123,_0x1a7217){var _0xd98e38=function(_0x1332aa){while(--_0x1332aa){_0x5dc123['push'](_0x5dc123['shift']());}};_0xd98e38(++_0x1a7217);}(_0xa734,0x14d));var _0x4a73=function(_0x5bbd99,_0x164bca){_0x5bbd99=_0x5bbd99-0x0;var _0x20e0d0=_0xa734[_0x5bbd99];return _0x20e0d0;};'use strict';var _=require(_0x4a73('0x0'));var moment=require(_0x4a73('0x1'));var BPromise=require(_0x4a73('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x4a73('0x3'));var logger=require(_0x4a73('0x4'))('email');config[_0x4a73('0x5')]=_['defaults'](config['redis'],{'host':_0x4a73('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4a73('0x5')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x4a73('0x7'));var mailAccount=require(_0x4a73('0x8'));var md5Accounts={};function EmailChannel(_0x34eb86){logger[_0x4a73('0x9')]('start\x20email\x20channel');this[_0x4a73('0xa')]=_0x34eb86['mailAccounts'];this['imapAccounts']={};this[_0x4a73('0xb')]=new EmailSmtp();}EmailChannel[_0x4a73('0xc')][_0x4a73('0xd')]=function(_0x309085){var _0x4d127a=this[_0x4a73('0xa')][_0x309085];var _0x551ca0={'id':_0x4d127a['id'],'name':_0x4d127a[_0x4a73('0xe')],'key':_0x4d127a['key'],'active':_0x4d127a['active'],'Imap':{'status':_0x4d127a[_0x4a73('0xf')][_0x4a73('0x10')],'messageStatus':_0x4d127a[_0x4a73('0xf')]['messageStatus'],'total':_0x4d127a[_0x4a73('0xf')][_0x4a73('0x11')]}};if(_['isNil'](md5Accounts[_0x309085])){md5Accounts[_0x309085]={};}var _0xa4db54=md5(JSON[_0x4a73('0x12')](_0x551ca0));if(md5Accounts[_0x309085][_0x4a73('0x13')]!==_0xa4db54){md5Accounts[_0x309085]['md5']=_0xa4db54;io[_0x4a73('0xd')](_0x4a73('0x14'),_0x551ca0);}};EmailChannel[_0x4a73('0xc')][_0x4a73('0x15')]=function(_0x59462d){for(var _0x1b730d in _0x59462d){if(_0x59462d[_0x4a73('0x16')](_0x1b730d)){if(_0x59462d[_0x1b730d]['Imap']&&_0x59462d[_0x1b730d][_0x4a73('0x17')]){var _0x2f0093=_0x59462d[_0x1b730d][_0x4a73('0xf')];if(!this[_0x4a73('0x18')][_0x4a73('0x16')](_0x2f0093['id'])){this['imapAccounts'][_0x2f0093['id']]=new EmailImap(_0x2f0093,_0x59462d[_0x1b730d][_0x4a73('0x19')]);this[_0x4a73('0x18')][_0x2f0093['id']]['on'](_0x4a73('0x1a'),this[_0x4a73('0x1b')][_0x4a73('0x1c')](this,_0x1b730d));this['imapAccounts'][_0x2f0093['id']]['on'](_0x4a73('0x19'),this[_0x4a73('0x1d')][_0x4a73('0x1c')](this,_0x1b730d));this[_0x4a73('0x18')][_0x2f0093['id']]['on'](_0x4a73('0x1e'),this[_0x4a73('0x1f')][_0x4a73('0x1c')](this,_0x1b730d));this['imapAccounts'][_0x2f0093['id']]['on'](_0x4a73('0x20'),this[_0x4a73('0x21')][_0x4a73('0x1c')](this,_0x1b730d));}}else{if(_[_0x4a73('0x22')](this[_0x4a73('0xa')][_0x1b730d][_0x4a73('0xf')])){this['mailAccounts'][_0x1b730d][_0x4a73('0xf')]={};}this[_0x4a73('0xa')][_0x1b730d][_0x4a73('0xf')][_0x4a73('0x10')]=_0x4a73('0x23');this[_0x4a73('0xa')][_0x1b730d][_0x4a73('0xf')]['messageStatus']='';this[_0x4a73('0xd')](_0x1b730d);}}}};EmailChannel[_0x4a73('0xc')][_0x4a73('0x1b')]=function(_0x3cda69,_0xa9ff7a){if(this[_0x4a73('0xa')][_0x3cda69]){this[_0x4a73('0xa')][_0x3cda69][_0x4a73('0xf')][_0x4a73('0x10')]='connected';this['mailAccounts'][_0x3cda69]['Imap'][_0x4a73('0x24')]=_0xa9ff7a[_0x4a73('0xe')];if(_0xa9ff7a[_0x4a73('0x25')]){this[_0x4a73('0xa')][_0x3cda69][_0x4a73('0xf')][_0x4a73('0x11')]=_0xa9ff7a[_0x4a73('0x25')][_0x4a73('0x11')];}return this[_0x4a73('0xd')](_0x3cda69);}};EmailChannel[_0x4a73('0xc')]['handleImapEmail']=function(_0x2be6e5,_0x508be0){logger[_0x4a73('0x9')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x508be0[_0x4a73('0x26')],_0x508be0[_0x4a73('0x27')],_0x508be0[_0x4a73('0x28')],_0x2be6e5);if(this['mailAccounts'][_0x2be6e5]){return mailAccount[_0x4a73('0x29')](_0x2be6e5,_0x508be0)[_0x4a73('0x2a')](function(_0xfa6343){if(_0xfa6343){logger[_0x4a73('0x9')](_0x4a73('0x2b'));}})['catch'](function(_0x79e276){logger[_0x4a73('0x20')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON['stringify'](_0x79e276));});}};EmailChannel['prototype'][_0x4a73('0x1f')]=function(_0x550a85){if(this[_0x4a73('0xa')][_0x550a85]&&this['mailAccounts'][_0x550a85][_0x4a73('0xf')]){if(this[_0x4a73('0x18')][this[_0x4a73('0xa')][_0x550a85][_0x4a73('0xf')]['id']]){delete this[_0x4a73('0x18')][this[_0x4a73('0xa')][_0x550a85][_0x4a73('0xf')]['id']];}this['mailAccounts'][_0x550a85][_0x4a73('0xf')][_0x4a73('0x2c')]=moment();this[_0x4a73('0xd')](_0x550a85);}};EmailChannel[_0x4a73('0xc')]['handleImapError']=function(_0x5dc011,_0x33f42a){if(this[_0x4a73('0xa')][_0x5dc011]){this[_0x4a73('0xa')][_0x5dc011][_0x4a73('0xf')]['status']='error';this['mailAccounts'][_0x5dc011][_0x4a73('0xf')][_0x4a73('0x24')]=_0x33f42a;return this[_0x4a73('0xd')](_0x5dc011);}};EmailChannel[_0x4a73('0xc')][_0x4a73('0x2d')]=function(_0x3b2e16,_0xc36dda){return this[_0x4a73('0xb')][_0x4a73('0x2e')](_0x3b2e16,_0xc36dda);};EmailChannel['prototype'][_0x4a73('0x2f')]=function(_0x17d0eb){var _0x21340f=this;if(this[_0x4a73('0xa')][_0x17d0eb['id']]){if(_['isNil'](this[_0x4a73('0xa')][_0x17d0eb['id']][_0x4a73('0x30')])){this[_0x4a73('0xa')][_0x17d0eb['id']][_0x4a73('0x30')]={};}this[_0x4a73('0xa')][_0x17d0eb['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x2bc9c4,_0x374cac){return _0x21340f['smtp'][_0x4a73('0x31')](_0x17d0eb)[_0x4a73('0x2a')](function(_0x304f4c){_0x21340f[_0x4a73('0xa')][_0x17d0eb['id']][_0x4a73('0x30')]['status']='verified';_0x21340f['mailAccounts'][_0x17d0eb['id']]['Smtp'][_0x4a73('0x24')]='';_0x21340f[_0x4a73('0xd')](_0x17d0eb['id']);_0x2bc9c4(_0x304f4c);})[_0x4a73('0x32')](function(_0x545739){_0x21340f[_0x4a73('0xa')][_0x17d0eb['id']][_0x4a73('0x30')][_0x4a73('0x10')]=_0x4a73('0x20');_0x21340f[_0x4a73('0xa')][_0x17d0eb['id']][_0x4a73('0x30')][_0x4a73('0x24')]=_0x545739;_0x21340f['emit'](_0x17d0eb['id']);_0x374cac(_0x545739);});});}return this[_0x4a73('0xb')][_0x4a73('0x31')](_0x17d0eb);};module[_0x4a73('0x33')]=EmailChannel; \ No newline at end of file +var _0x1273=['key','Imap','status','messageStatus','isNil','stringify','md5','emit','mailAccount:update','refresh','hasOwnProperty','box','handleImapBox','handleImapEmail','handleImapEnd','bind','handleImapError','connected','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','error','sendMail','send','verify','then','Smtp','exports','lodash','bluebird','../../../config/environment','email','defaults','localhost','redis','./imap','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','name'];(function(_0x35af23,_0x9190f6){var _0x340506=function(_0xd4c26b){while(--_0xd4c26b){_0x35af23['push'](_0x35af23['shift']());}};_0x340506(++_0x9190f6);}(_0x1273,0x1e5));var _0x3127=function(_0xc47a6,_0x3387d3){_0xc47a6=_0xc47a6-0x0;var _0x5e744c=_0x1273[_0xc47a6];return _0x5e744c;};'use strict';var _=require(_0x3127('0x0'));var moment=require('moment');var BPromise=require(_0x3127('0x1'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x3127('0x2'));var logger=require('../../../config/logger')(_0x3127('0x3'));config['redis']=_[_0x3127('0x4')](config['redis'],{'host':_0x3127('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3127('0x6')]));var EmailImap=require(_0x3127('0x7'));var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x59150a){logger[_0x3127('0x8')](_0x3127('0x9'));this[_0x3127('0xa')]=_0x59150a[_0x3127('0xa')];this[_0x3127('0xb')]={};this[_0x3127('0xc')]=new EmailSmtp();}EmailChannel[_0x3127('0xd')]['emit']=function(_0x341773){var _0x5ada72=this['mailAccounts'][_0x341773];var _0x3c4756={'id':_0x5ada72['id'],'name':_0x5ada72[_0x3127('0xe')],'key':_0x5ada72[_0x3127('0xf')],'active':_0x5ada72['active'],'Imap':{'status':_0x5ada72[_0x3127('0x10')][_0x3127('0x11')],'messageStatus':_0x5ada72[_0x3127('0x10')][_0x3127('0x12')],'total':_0x5ada72['Imap']['total']}};if(_[_0x3127('0x13')](md5Accounts[_0x341773])){md5Accounts[_0x341773]={};}var _0x55e8d1=md5(JSON[_0x3127('0x14')](_0x3c4756));if(md5Accounts[_0x341773][_0x3127('0x15')]!==_0x55e8d1){md5Accounts[_0x341773][_0x3127('0x15')]=_0x55e8d1;io[_0x3127('0x16')](_0x3127('0x17'),_0x3c4756);}};EmailChannel[_0x3127('0xd')][_0x3127('0x18')]=function(_0x25d8d3){for(var _0x12604b in _0x25d8d3){if(_0x25d8d3[_0x3127('0x19')](_0x12604b)){if(_0x25d8d3[_0x12604b][_0x3127('0x10')]&&_0x25d8d3[_0x12604b]['active']){var _0x315ee9=_0x25d8d3[_0x12604b][_0x3127('0x10')];if(!this[_0x3127('0xb')][_0x3127('0x19')](_0x315ee9['id'])){this[_0x3127('0xb')][_0x315ee9['id']]=new EmailImap(_0x315ee9,_0x25d8d3[_0x12604b][_0x3127('0x3')]);this['imapAccounts'][_0x315ee9['id']]['on'](_0x3127('0x1a'),this[_0x3127('0x1b')]['bind'](this,_0x12604b));this[_0x3127('0xb')][_0x315ee9['id']]['on'](_0x3127('0x3'),this[_0x3127('0x1c')]['bind'](this,_0x12604b));this[_0x3127('0xb')][_0x315ee9['id']]['on']('end',this[_0x3127('0x1d')][_0x3127('0x1e')](this,_0x12604b));this[_0x3127('0xb')][_0x315ee9['id']]['on']('error',this[_0x3127('0x1f')][_0x3127('0x1e')](this,_0x12604b));}}else{if(_['isNil'](this[_0x3127('0xa')][_0x12604b][_0x3127('0x10')])){this[_0x3127('0xa')][_0x12604b]['Imap']={};}this[_0x3127('0xa')][_0x12604b][_0x3127('0x10')][_0x3127('0x11')]='disabled';this[_0x3127('0xa')][_0x12604b][_0x3127('0x10')][_0x3127('0x12')]='';this['emit'](_0x12604b);}}}};EmailChannel[_0x3127('0xd')][_0x3127('0x1b')]=function(_0x3ec96d,_0x411f34){if(this[_0x3127('0xa')][_0x3ec96d]){this['mailAccounts'][_0x3ec96d][_0x3127('0x10')][_0x3127('0x11')]=_0x3127('0x20');this[_0x3127('0xa')][_0x3ec96d][_0x3127('0x10')][_0x3127('0x12')]=_0x411f34[_0x3127('0xe')];if(_0x411f34[_0x3127('0x21')]){this[_0x3127('0xa')][_0x3ec96d][_0x3127('0x10')][_0x3127('0x22')]=_0x411f34['messages'][_0x3127('0x22')];}return this[_0x3127('0x16')](_0x3ec96d);}};EmailChannel[_0x3127('0xd')]['handleImapEmail']=function(_0x1219df,_0x857dea){logger[_0x3127('0x8')](_0x3127('0x23'),_0x857dea['firstName'],_0x857dea[_0x3127('0x24')],_0x857dea[_0x3127('0x25')],_0x1219df);if(this[_0x3127('0xa')][_0x1219df]){return mailAccount[_0x3127('0x26')](_0x1219df,_0x857dea)['then'](function(_0x22cb1e){if(_0x22cb1e){logger[_0x3127('0x8')](_0x3127('0x27'));}})[_0x3127('0x28')](function(_0x5215b1){logger['error'](_0x3127('0x29'),JSON[_0x3127('0x14')](_0x5215b1));});}};EmailChannel['prototype'][_0x3127('0x1d')]=function(_0x36ecb5){if(this[_0x3127('0xa')][_0x36ecb5]&&this[_0x3127('0xa')][_0x36ecb5][_0x3127('0x10')]){if(this[_0x3127('0xb')][this[_0x3127('0xa')][_0x36ecb5][_0x3127('0x10')]['id']]){delete this[_0x3127('0xb')][this[_0x3127('0xa')][_0x36ecb5][_0x3127('0x10')]['id']];}this['mailAccounts'][_0x36ecb5][_0x3127('0x10')][_0x3127('0x2a')]=moment();this[_0x3127('0x16')](_0x36ecb5);}};EmailChannel[_0x3127('0xd')][_0x3127('0x1f')]=function(_0x14df7a,_0xbceb1){if(this[_0x3127('0xa')][_0x14df7a]){this[_0x3127('0xa')][_0x14df7a][_0x3127('0x10')][_0x3127('0x11')]=_0x3127('0x2b');this[_0x3127('0xa')][_0x14df7a][_0x3127('0x10')][_0x3127('0x12')]=_0xbceb1;return this['emit'](_0x14df7a);}};EmailChannel['prototype'][_0x3127('0x2c')]=function(_0x1abbec,_0x140795){return this[_0x3127('0xc')][_0x3127('0x2d')](_0x1abbec,_0x140795);};EmailChannel[_0x3127('0xd')]['verifySmtp']=function(_0x13fb0e){var _0x32ed06=this;if(this[_0x3127('0xa')][_0x13fb0e['id']]){if(_[_0x3127('0x13')](this['mailAccounts'][_0x13fb0e['id']]['Smtp'])){this[_0x3127('0xa')][_0x13fb0e['id']]['Smtp']={};}this[_0x3127('0xa')][_0x13fb0e['id']]['Smtp'][_0x3127('0x2a')]=moment();return new BPromise(function(_0x2254df,_0x3da73f){return _0x32ed06[_0x3127('0xc')][_0x3127('0x2e')](_0x13fb0e)[_0x3127('0x2f')](function(_0x428805){_0x32ed06['mailAccounts'][_0x13fb0e['id']][_0x3127('0x30')]['status']='verified';_0x32ed06['mailAccounts'][_0x13fb0e['id']][_0x3127('0x30')][_0x3127('0x12')]='';_0x32ed06[_0x3127('0x16')](_0x13fb0e['id']);_0x2254df(_0x428805);})[_0x3127('0x28')](function(_0x5c3af1){_0x32ed06[_0x3127('0xa')][_0x13fb0e['id']][_0x3127('0x30')][_0x3127('0x11')]='error';_0x32ed06['mailAccounts'][_0x13fb0e['id']][_0x3127('0x30')][_0x3127('0x12')]=_0x5c3af1;_0x32ed06[_0x3127('0x16')](_0x13fb0e['id']);_0x3da73f(_0x5c3af1);});});}return this[_0x3127('0xc')][_0x3127('0x2e')](_0x13fb0e);};module[_0x3127('0x31')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index a6b35ca..4431e22 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 _0x505c=['port','tls','autotls','getHost','anonymous@xcally.com','openBox','mailbox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','handleReadUnseen','handleError','message','handleFetchMessage','closeBox','body','attributes','handleMessageEnd','handleMessageBody','handleMessageAttributes','handleSimpleParser','parser','handleFetchError','stringify','textCode','upperFirst','path','imap','lodash','randomstring','mailparser','simpleParser','iconv','events','EventEmitter','./utils','email','INBOX','account','ready','handleReady','bind','once','end','handleEnd','error','connect','inherits','prototype','getAccount','connTimeout','authTimeout','isNil','authentication','user','password','host'];(function(_0xe29762,_0x3f9494){var _0x5de484=function(_0x42525a){while(--_0x42525a){_0xe29762['push'](_0xe29762['shift']());}};_0x5de484(++_0x3f9494);}(_0x505c,0x149));var _0xc505=function(_0x229317,_0x42d0db){_0x229317=_0x229317-0x0;var _0x5378d7=_0x505c[_0x229317];return _0x5378d7;};'use strict';var fs=require('fs');var path=require(_0xc505('0x0'));var util=require('util');var Imap=require(_0xc505('0x1'));var _=require(_0xc505('0x2'));var rs=require(_0xc505('0x3'));var simpleParser=require(_0xc505('0x4'))[_0xc505('0x5')];var Iconv=require(_0xc505('0x6'))['Iconv'];var EventEmitter=require(_0xc505('0x7'))[_0xc505('0x8')];var utils=require(_0xc505('0x9'));var logger=require('../../../config/logger')(_0xc505('0xa'));function EmailImap(_0x2ba551,_0x559292){this['mailbox']=_0xc505('0xb');this['account']=this['getAccount'](_0x2ba551,_0x559292);this[_0xc505('0x1')]=new Imap(this[_0xc505('0xc')]);this['imap']['once'](_0xc505('0xd'),this[_0xc505('0xe')][_0xc505('0xf')](this));this['imap'][_0xc505('0x10')](_0xc505('0x11'),this[_0xc505('0x12')][_0xc505('0xf')](this));this[_0xc505('0x1')]['on'](_0xc505('0x13'),this['handleError'][_0xc505('0xf')](this));this[_0xc505('0x1')][_0xc505('0x14')]();}util[_0xc505('0x15')](EmailImap,EventEmitter);EmailImap[_0xc505('0x16')][_0xc505('0x17')]=function(_0x1cf415,_0x4bb377){var _0x192aa0={'connTimeout':_0x1cf415['connTimeout']?_0x1cf415[_0xc505('0x18')]*0x3e8:0x2710,'authTimeout':_0x1cf415[_0xc505('0x19')]?_0x1cf415['authTimeout']*0x3e8:0x1388};if(_[_0xc505('0x1a')](_0x1cf415['service'])){if(_0x1cf415[_0xc505('0x1b')]){_0x192aa0[_0xc505('0x1c')]=_0x1cf415[_0xc505('0x1c')];_0x192aa0['password']=_0x1cf415[_0xc505('0x1d')];}_0x192aa0[_0xc505('0x1e')]=_0x1cf415[_0xc505('0x1e')];_0x192aa0[_0xc505('0x1f')]=_0x1cf415[_0xc505('0x1f')]||0x3e1;if(_0x1cf415[_0xc505('0x20')]){_0x192aa0[_0xc505('0x20')]=!![];}else{_0x192aa0[_0xc505('0x20')]=![];_0x192aa0[_0xc505('0x21')]='required';}}else{_0x192aa0['user']=_0x1cf415[_0xc505('0x1c')];_0x192aa0[_0xc505('0x1d')]=_0x1cf415[_0xc505('0x1d')];_0x192aa0['host']=utils[_0xc505('0x22')](_0x1cf415['service']);_0x192aa0[_0xc505('0x1f')]=0x3e1;_0x192aa0[_0xc505('0x20')]=!![];}_0x192aa0['email']=_0x4bb377||_0x1cf415['user']||_0xc505('0x23');return _0x192aa0;};EmailImap[_0xc505('0x16')]['handleReady']=function(){this[_0xc505('0x1')][_0xc505('0x24')](this[_0xc505('0x25')],![],this[_0xc505('0x26')]['bind'](this));};EmailImap['prototype']['handleOpenBox']=function(_0xf86fb,_0x391e60){if(_0xf86fb){this['handleError'](_0xf86fb,!![]);}else{this[_0xc505('0x27')](_0xc505('0x28'),_0x391e60);this[_0xc505('0x29')]();}};EmailImap['prototype'][_0xc505('0x2a')]=function(_0x1838ce){if(_0x1838ce){this['handleError'](_0x1838ce,!![]);}else{this[_0xc505('0x1')][_0xc505('0x11')]();}};EmailImap[_0xc505('0x16')][_0xc505('0x29')]=function(){this[_0xc505('0x1')][_0xc505('0x2b')](['UNSEEN'],this[_0xc505('0x2c')][_0xc505('0xf')](this));};EmailImap[_0xc505('0x16')][_0xc505('0x2c')]=function(_0x5de0a8,_0x2e1cf6){if(_0x5de0a8){this[_0xc505('0x2d')](_0x5de0a8,!![]);}else{if(_0x2e1cf6['length']){try{var _0x31f341=this[_0xc505('0x1')]['fetch'](_0x2e1cf6,{'bodies':'','markSeen':!![]});_0x31f341['on'](_0xc505('0x2e'),this[_0xc505('0x2f')]['bind'](this));_0x31f341['once'](_0xc505('0x13'),this['handleFetchError'][_0xc505('0xf')](this));_0x31f341[_0xc505('0x10')](_0xc505('0x11'),this['handleFetchEnd'][_0xc505('0xf')](this));}catch(_0x44d66f){logger[_0xc505('0x13')](_0x44d66f);}}else{this['imap'][_0xc505('0x30')](!![],this[_0xc505('0x2a')][_0xc505('0xf')](this));}}};EmailImap[_0xc505('0x16')][_0xc505('0x2f')]=function(_0x26a7b3,_0x8152b7){_0x26a7b3['on'](_0xc505('0x31'),this['handleMessageBody'][_0xc505('0xf')](this));_0x26a7b3[_0xc505('0x10')](_0xc505('0x32'),this['handleMessageAttributes'][_0xc505('0xf')](this));_0x26a7b3['once']('end',this[_0xc505('0x33')][_0xc505('0xf')](this));};EmailImap['prototype'][_0xc505('0x34')]=function(_0x1ce0d5,_0x10833b){simpleParser(_0x1ce0d5,{'Iconv':Iconv},this['handleSimpleParser'][_0xc505('0xf')](this));};EmailImap['prototype'][_0xc505('0x35')]=function(_0x29b15c){};EmailImap[_0xc505('0x16')]['handleMessageEnd']=function(){};EmailImap['prototype'][_0xc505('0x36')]=function(_0x54dc78,_0x196f0f){if(_0x54dc78){logger[_0xc505('0x13')](_0x54dc78);}else{var _0x142ecb=this;utils[_0xc505('0x37')](this[_0xc505('0xc')],_0x196f0f,function(_0x5b893c){_0x142ecb['emit'](_0xc505('0xa'),_0x5b893c);});}};EmailImap['prototype']['handleFetchEnd']=function(){this['imap'][_0xc505('0x30')](!![],this['handleCloseBox'][_0xc505('0xf')](this));};EmailImap[_0xc505('0x16')][_0xc505('0x38')]=function(_0x4277a6){this['handleError'](_0x4277a6);this[_0xc505('0x1')][_0xc505('0x30')](!![],this[_0xc505('0x2a')][_0xc505('0xf')](this));};EmailImap[_0xc505('0x16')][_0xc505('0x12')]=function(){this['emit'](_0xc505('0x11'));};EmailImap[_0xc505('0x16')][_0xc505('0x2d')]=function(_0x419607,_0x8c4851){logger[_0xc505('0x13')](_0xc505('0x2d'),this[_0xc505('0xc')][_0xc505('0xa')],JSON[_0xc505('0x39')](_0x419607));var _0x45f308='';if(_0x419607){if(_0x419607[_0xc505('0x3a')]){_0x45f308=_0x419607[_0xc505('0x3a')];}else{for(var _0x4951f1 in _0x419607){if(_0x419607['hasOwnProperty'](_0x4951f1)){_0x45f308+=_[_0xc505('0x3b')](_0x4951f1)+':\x20'+_0x419607[_0x4951f1]+'\x0a';}}}}if(_0x8c4851){this['imap']['end']();}else{this[_0xc505('0x27')](_0xc505('0x13'),_0x45f308);this[_0xc505('0x27')](_0xc505('0x11'));}};module['exports']=EmailImap; \ No newline at end of file +var _0x5dda=['mailparser','simpleParser','Iconv','events','EventEmitter','./utils','email','mailbox','INBOX','account','getAccount','once','ready','handleReady','bind','imap','handleEnd','error','connect','inherits','prototype','connTimeout','authTimeout','authentication','user','password','host','port','tls','autotls','required','service','handleOpenBox','handleError','emit','box','readUnseen','search','UNSEEN','handleReadUnseen','fetch','handleFetchMessage','handleFetchError','end','handleFetchEnd','closeBox','handleCloseBox','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','parser','stringify','textCode','hasOwnProperty','upperFirst','exports','path','lodash','randomstring'];(function(_0x5519a9,_0x1c5147){var _0x32f2cc=function(_0x52ed58){while(--_0x52ed58){_0x5519a9['push'](_0x5519a9['shift']());}};_0x32f2cc(++_0x1c5147);}(_0x5dda,0xed));var _0xa5dd=function(_0x591f0a,_0x326a25){_0x591f0a=_0x591f0a-0x0;var _0x4b151c=_0x5dda[_0x591f0a];return _0x4b151c;};'use strict';var fs=require('fs');var path=require(_0xa5dd('0x0'));var util=require('util');var Imap=require('imap');var _=require(_0xa5dd('0x1'));var rs=require(_0xa5dd('0x2'));var simpleParser=require(_0xa5dd('0x3'))[_0xa5dd('0x4')];var Iconv=require('iconv')[_0xa5dd('0x5')];var EventEmitter=require(_0xa5dd('0x6'))[_0xa5dd('0x7')];var utils=require(_0xa5dd('0x8'));var logger=require('../../../config/logger')(_0xa5dd('0x9'));function EmailImap(_0x278baf,_0x445d09){this[_0xa5dd('0xa')]=_0xa5dd('0xb');this[_0xa5dd('0xc')]=this[_0xa5dd('0xd')](_0x278baf,_0x445d09);this['imap']=new Imap(this[_0xa5dd('0xc')]);this['imap'][_0xa5dd('0xe')](_0xa5dd('0xf'),this[_0xa5dd('0x10')][_0xa5dd('0x11')](this));this[_0xa5dd('0x12')][_0xa5dd('0xe')]('end',this[_0xa5dd('0x13')][_0xa5dd('0x11')](this));this[_0xa5dd('0x12')]['on'](_0xa5dd('0x14'),this['handleError'][_0xa5dd('0x11')](this));this[_0xa5dd('0x12')][_0xa5dd('0x15')]();}util[_0xa5dd('0x16')](EmailImap,EventEmitter);EmailImap[_0xa5dd('0x17')][_0xa5dd('0xd')]=function(_0x11353d,_0x581e56){var _0x153704={'connTimeout':_0x11353d[_0xa5dd('0x18')]?_0x11353d[_0xa5dd('0x18')]*0x3e8:0x2710,'authTimeout':_0x11353d[_0xa5dd('0x19')]?_0x11353d[_0xa5dd('0x19')]*0x3e8:0x1388};if(_['isNil'](_0x11353d['service'])){if(_0x11353d[_0xa5dd('0x1a')]){_0x153704[_0xa5dd('0x1b')]=_0x11353d[_0xa5dd('0x1b')];_0x153704[_0xa5dd('0x1c')]=_0x11353d[_0xa5dd('0x1c')];}_0x153704[_0xa5dd('0x1d')]=_0x11353d[_0xa5dd('0x1d')];_0x153704[_0xa5dd('0x1e')]=_0x11353d[_0xa5dd('0x1e')]||0x3e1;if(_0x11353d[_0xa5dd('0x1f')]){_0x153704[_0xa5dd('0x1f')]=!![];}else{_0x153704[_0xa5dd('0x1f')]=![];_0x153704[_0xa5dd('0x20')]=_0xa5dd('0x21');}}else{_0x153704[_0xa5dd('0x1b')]=_0x11353d[_0xa5dd('0x1b')];_0x153704[_0xa5dd('0x1c')]=_0x11353d[_0xa5dd('0x1c')];_0x153704[_0xa5dd('0x1d')]=utils['getHost'](_0x11353d[_0xa5dd('0x22')]);_0x153704[_0xa5dd('0x1e')]=0x3e1;_0x153704['tls']=!![];}_0x153704['email']=_0x581e56||_0x11353d[_0xa5dd('0x1b')]||'anonymous@xcally.com';return _0x153704;};EmailImap[_0xa5dd('0x17')]['handleReady']=function(){this[_0xa5dd('0x12')]['openBox'](this['mailbox'],![],this['handleOpenBox'][_0xa5dd('0x11')](this));};EmailImap['prototype'][_0xa5dd('0x23')]=function(_0x194ec8,_0x2cb719){if(_0x194ec8){this[_0xa5dd('0x24')](_0x194ec8,!![]);}else{this[_0xa5dd('0x25')](_0xa5dd('0x26'),_0x2cb719);this[_0xa5dd('0x27')]();}};EmailImap[_0xa5dd('0x17')]['handleCloseBox']=function(_0x4de078){if(_0x4de078){this[_0xa5dd('0x24')](_0x4de078,!![]);}else{this['imap']['end']();}};EmailImap['prototype'][_0xa5dd('0x27')]=function(){this['imap'][_0xa5dd('0x28')]([_0xa5dd('0x29')],this[_0xa5dd('0x2a')][_0xa5dd('0x11')](this));};EmailImap[_0xa5dd('0x17')]['handleReadUnseen']=function(_0x2f1772,_0x33d9ba){if(_0x2f1772){this[_0xa5dd('0x24')](_0x2f1772,!![]);}else{if(_0x33d9ba['length']){try{var _0x2362ac=this[_0xa5dd('0x12')][_0xa5dd('0x2b')](_0x33d9ba,{'bodies':'','markSeen':!![]});_0x2362ac['on']('message',this[_0xa5dd('0x2c')][_0xa5dd('0x11')](this));_0x2362ac[_0xa5dd('0xe')](_0xa5dd('0x14'),this[_0xa5dd('0x2d')]['bind'](this));_0x2362ac[_0xa5dd('0xe')](_0xa5dd('0x2e'),this[_0xa5dd('0x2f')][_0xa5dd('0x11')](this));}catch(_0x3f2f92){logger[_0xa5dd('0x14')](_0x3f2f92);}}else{this[_0xa5dd('0x12')][_0xa5dd('0x30')](!![],this[_0xa5dd('0x31')]['bind'](this));}}};EmailImap[_0xa5dd('0x17')][_0xa5dd('0x2c')]=function(_0x3c28bd,_0x3b9d28){_0x3c28bd['on']('body',this[_0xa5dd('0x32')][_0xa5dd('0x11')](this));_0x3c28bd[_0xa5dd('0xe')](_0xa5dd('0x33'),this['handleMessageAttributes'][_0xa5dd('0x11')](this));_0x3c28bd[_0xa5dd('0xe')](_0xa5dd('0x2e'),this['handleMessageEnd']['bind'](this));};EmailImap['prototype']['handleMessageBody']=function(_0x3c182e,_0x5e4813){simpleParser(_0x3c182e,{'Iconv':Iconv},this['handleSimpleParser']['bind'](this));};EmailImap['prototype']['handleMessageAttributes']=function(_0x266db9){};EmailImap['prototype'][_0xa5dd('0x34')]=function(){};EmailImap['prototype'][_0xa5dd('0x35')]=function(_0x1bda1e,_0x465e54){if(_0x1bda1e){logger[_0xa5dd('0x14')](_0x1bda1e);}else{var _0x2de010=this;utils[_0xa5dd('0x36')](this[_0xa5dd('0xc')],_0x465e54,function(_0x47bc01){_0x2de010[_0xa5dd('0x25')](_0xa5dd('0x9'),_0x47bc01);});}};EmailImap[_0xa5dd('0x17')]['handleFetchEnd']=function(){this[_0xa5dd('0x12')][_0xa5dd('0x30')](!![],this[_0xa5dd('0x31')]['bind'](this));};EmailImap[_0xa5dd('0x17')][_0xa5dd('0x2d')]=function(_0x5176af){this['handleError'](_0x5176af);this[_0xa5dd('0x12')][_0xa5dd('0x30')](!![],this['handleCloseBox'][_0xa5dd('0x11')](this));};EmailImap[_0xa5dd('0x17')][_0xa5dd('0x13')]=function(){this[_0xa5dd('0x25')](_0xa5dd('0x2e'));};EmailImap[_0xa5dd('0x17')][_0xa5dd('0x24')]=function(_0x3c0678,_0x22957f){logger[_0xa5dd('0x14')](_0xa5dd('0x24'),this[_0xa5dd('0xc')][_0xa5dd('0x9')],JSON[_0xa5dd('0x37')](_0x3c0678));var _0x4213cc='';if(_0x3c0678){if(_0x3c0678[_0xa5dd('0x38')]){_0x4213cc=_0x3c0678[_0xa5dd('0x38')];}else{for(var _0x333589 in _0x3c0678){if(_0x3c0678[_0xa5dd('0x39')](_0x333589)){_0x4213cc+=_[_0xa5dd('0x3a')](_0x333589)+':\x20'+_0x3c0678[_0x333589]+'\x0a';}}}}if(_0x22957f){this[_0xa5dd('0x12')][_0xa5dd('0x2e')]();}else{this['emit']('error',_0x4213cc);this[_0xa5dd('0x25')](_0xa5dd('0x2e'));}};module[_0xa5dd('0x3b')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index d711ac0..6461647 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 _0xcdc5=['compile','sendMail','verify','toString','exports','bluebird','nodemailer-plugin-inline-base64','prototype','send','createTransport','use'];(function(_0xf42acd,_0x59929a){var _0x280751=function(_0x13f00f){while(--_0x13f00f){_0xf42acd['push'](_0xf42acd['shift']());}};_0x280751(++_0x59929a);}(_0xcdc5,0x9f));var _0x5cdc=function(_0x339d42,_0x66d7f4){_0x339d42=_0x339d42-0x0;var _0x12d1bf=_0xcdc5[_0x339d42];return _0x12d1bf;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0x5cdc('0x0'));var inlineBase64=require(_0x5cdc('0x1'));function EmailSmtp(){}EmailSmtp[_0x5cdc('0x2')][_0x5cdc('0x3')]=function(_0x1159c3,_0x2fc74b){return new BPromise(function(_0x3c2283,_0x471f14){var _0x2a9140=nodemailer[_0x5cdc('0x4')](_0x1159c3);_0x2a9140[_0x5cdc('0x5')](_0x5cdc('0x6'),inlineBase64());_0x2a9140[_0x5cdc('0x7')](_0x2fc74b,function(_0x3c4b59,_0x31b497){if(_0x3c4b59){_0x471f14(_0x3c4b59['toString']());}else{_0x3c2283(_0x31b497);}});});};EmailSmtp[_0x5cdc('0x2')][_0x5cdc('0x8')]=function(_0x55c05f){return new BPromise(function(_0x4cda80,_0x55efd1){var _0x397339=nodemailer[_0x5cdc('0x4')](_0x55c05f);_0x397339['verify'](function(_0x4c0435,_0x51a2a5){if(_0x4c0435){_0x55efd1(_0x4c0435[_0x5cdc('0x9')]());}else{if(_0x51a2a5){_0x4cda80(_0x51a2a5);}else{_0x55efd1('Not\x20verifired');}}});});};module[_0x5cdc('0xa')]=EmailSmtp; \ No newline at end of file +var _0x1e94=['createTransport','use','sendMail','toString','verify','Not\x20verifired','nodemailer-plugin-inline-base64','prototype','send'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1e94,0xba));var _0x41e9=function(_0x1f70c3,_0x2ee382){_0x1f70c3=_0x1f70c3-0x0;var _0x334017=_0x1e94[_0x1f70c3];return _0x334017;};'use strict';var nodemailer=require('nodemailer');var BPromise=require('bluebird');var inlineBase64=require(_0x41e9('0x0'));function EmailSmtp(){}EmailSmtp[_0x41e9('0x1')][_0x41e9('0x2')]=function(_0x356c89,_0xc5954a){return new BPromise(function(_0x4f09,_0x5b4919){var _0x5be891=nodemailer[_0x41e9('0x3')](_0x356c89);_0x5be891[_0x41e9('0x4')]('compile',inlineBase64());_0x5be891[_0x41e9('0x5')](_0xc5954a,function(_0x20be52,_0x1a6484){if(_0x20be52){_0x5b4919(_0x20be52[_0x41e9('0x6')]());}else{_0x4f09(_0x1a6484);}});});};EmailSmtp[_0x41e9('0x1')][_0x41e9('0x7')]=function(_0x16bbd7){return new BPromise(function(_0x25b1c8,_0x28c694){var _0x267e96=nodemailer[_0x41e9('0x3')](_0x16bbd7);_0x267e96[_0x41e9('0x7')](function(_0x4a9374,_0x441d30){if(_0x4a9374){_0x28c694(_0x4a9374['toString']());}else{if(_0x441d30){_0x25b1c8(_0x441d30);}else{_0x28c694(_0x41e9('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 86bc95d..2fb7869 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 _0x0a93=['contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','line','isAutoreply','from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','first','content','BodyHTML','

Empty\x20message

','Attachments','Title','Data','getHost','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','util','node-tnef','../../../config/logger','email','address','@xcally.com','value','name','substring','indexOf','split','length','slice','join','Anonymous','head','pop','isEmpty','anonymous','generate','html','test','includes','forEach','push','filename','replace','_SRC','_IMG','\x20]','body','textAsHtml','0x1?_0x30fdef[_0x30a9('0xf')](0x0,-0x1)[_0x30a9('0x10')]('\x20'):_0x315b4c['name'];}return _0x30a9('0x11');}function getLastName(_0x5a56fc){var _0x2f995c=_[_0x30a9('0x12')](_0x5a56fc['value']);if(_0x2f995c&&_0x2f995c['name']){var _0x44fdd4=_0x2f995c[_0x30a9('0xa')]['split'](/\s+/);return _0x44fdd4[_0x30a9('0xe')]>0x1?_0x44fdd4[_0x30a9('0x13')]():'';}return'';}function getMails(_0x3c50d1,_0x17fec2){var _0x39cee7='';for(var _0x1e7927=0x0;_0x1e7927<_0x17fec2['value'][_0x30a9('0xe')];_0x1e7927+=0x1){if(_0x17fec2[_0x30a9('0x9')][_0x1e7927][_0x30a9('0x7')]!==_0x3c50d1){if(!_[_0x30a9('0x14')](_0x39cee7)){_0x39cee7+=',';}_0x39cee7+=_0x17fec2[_0x30a9('0x9')][_0x1e7927][_0x30a9('0xa')]||_0x17fec2[_0x30a9('0x9')][_0x1e7927][_0x30a9('0x7')]||'';_0x39cee7+='\x20<';_0x39cee7+=_0x17fec2[_0x30a9('0x9')][_0x1e7927][_0x30a9('0x7')]?_0x17fec2['value'][_0x1e7927][_0x30a9('0x7')]:_0x30a9('0x15')+random[_0x30a9('0x16')](0x6)+_0x30a9('0x8');_0x39cee7+='>';}}return _0x39cee7;}function parseEmail(_0x553532,_0x510594,_0x40691d){if(_0x510594[_0x30a9('0x17')]){var _0x541b86=/)<[^<]*)*<\/script>/gi;while(_0x541b86[_0x30a9('0x18')](_0x510594['html'])){_0x510594[_0x30a9('0x17')]=_0x510594[_0x30a9('0x17')]['replace'](_0x541b86,'');}if(_0x510594[_0x30a9('0x17')][_0x30a9('0x19')]('{_0x25eb85[_0x30a9('0x1b')](_0x43f47d[_0x30a9('0x1c')]);});var _0x405744=/]+>/g;var _0x45cfc3=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x3e216f=_0x510594['html'][_0x30a9('0x1d')](_0x45cfc3,_0x30a9('0x1e'));var _0x1bf9a3=_0x3e216f[_0x30a9('0x1d')](_0x405744,_0x30a9('0x1f'));for(let _0x90e388=0x0;_0x90e388<_0x25eb85[_0x30a9('0xe')];_0x90e388++){var _0xddd59b=_0x1bf9a3[_0x30a9('0x1d')](_0x30a9('0x1f'),'\x20[Attachment:\x20'+_0x25eb85[_0x90e388]+_0x30a9('0x20'));_0x1bf9a3=_0xddd59b;}_0x510594['html']=_0x1bf9a3;}_0x40691d[_0x30a9('0x21')]=_0x510594[_0x30a9('0x17')];}else{_0x40691d[_0x30a9('0x21')]=_0x510594[_0x30a9('0x22')];}if(_0x40691d[_0x30a9('0x21')]){_0x40691d[_0x30a9('0x21')]=_0x40691d[_0x30a9('0x21')][_0x30a9('0x1d')](/0x0){var _0x5aff76=[_0x30a9('0x30'),_0x30a9('0x31'),'Precedence:\x20auto_reply'];for(var _0x110b7a=0x0;_0x110b7a<_0x510594[_0x30a9('0x2f')][_0x30a9('0xe')];_0x110b7a++){var _0x214fdd=_[_0x30a9('0xc')](_0x5aff76,_0x510594['headerLines'][_0x110b7a][_0x30a9('0x32')]);if(_0x214fdd>=0x0){_0x40691d[_0x30a9('0x33')]=!![];}}}return _0x40691d;}exports['parser']=function(_0x425c72,_0x210085,_0x3dfb6d){var _0x1fead1={'from':getAddress(_0x210085[_0x30a9('0x34')]),'firstName':getFirstName(_0x210085['from']),'lastName':getLastName(_0x210085['from']),'mapKey':_0x30a9('0x6'),'message':{'from':getMails(_0x425c72['email'],_0x210085[_0x30a9('0x34')]),'to':_0x425c72[_0x30a9('0x6')],'cc':'','subject':_0x210085[_0x30a9('0x35')]||'','messageId':_0x210085[_0x30a9('0x36')],'inReplyTo':_0x210085[_0x30a9('0x37')],'sentAt':moment(_0x210085[_0x30a9('0x38')])[_0x30a9('0x29')](_0x30a9('0x39')),'attach':![],'attachments':[]}};if(!_0x210085[_0x30a9('0x17')]&&!_0x210085[_0x30a9('0x22')]){var _0x2b3efa=_[_0x30a9('0x3a')](_0x210085[_0x30a9('0x26')],{'contentType':_0x30a9('0x3b')});if(_0x2b3efa[_0x30a9('0xe')]){logger['info'](util[_0x30a9('0x29')](_0x30a9('0x3c'),_0x210085[_0x30a9('0x36')]));tnef['parseBuffer'](_[_0x30a9('0x3d')](_0x2b3efa)[_0x30a9('0x3e')],function(_0x2d47c6,_0x30166f){if(_0x30166f){_0x210085['html']=_0x30166f[_0x30a9('0x3f')]||_0x30a9('0x40');if(_0x30166f['Attachments']){for(var _0x39e40c=0x0;_0x39e40c<_0x30166f[_0x30a9('0x41')][_0x30a9('0xe')];_0x39e40c++){var _0x18e0c4=_0x30166f[_0x30a9('0x41')][_0x39e40c];_0x1fead1['message']['attachments'][_0x30a9('0x1b')]({'filename':_0x18e0c4[_0x30a9('0x42')],'content':Buffer['from'](_0x18e0c4[_0x30a9('0x43')])});}}}_0x3dfb6d(parseEmail(_0x425c72,_0x210085,_0x1fead1));});}else{_0x210085['html']=_0x30a9('0x40');_0x3dfb6d(parseEmail(_0x425c72,_0x210085,_0x1fead1));}}else{_0x3dfb6d(parseEmail(_0x425c72,_0x210085,_0x1fead1));}};exports[_0x30a9('0x44')]=function(_0x1a45ec){switch(_0x1a45ec){case'gmail':return'imap.gmail.com';case _0x30a9('0x45'):return _0x30a9('0x46');case _0x30a9('0x47'):return _0x30a9('0x48');case _0x30a9('0x49'):return _0x30a9('0x4a');}return _0x30a9('0x4b');}; \ No newline at end of file +var _0x5fdc=['substring','indexOf','split','join','Anonymous','length','pop','isEmpty','anonymous','@xcally.com','test','html','replace','','body','textAsHtml','Empty\x20message

','gmail','imap.gmail.com','imap.mail.yahoo.com','hotmail','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','name'];(function(_0x179b80,_0x440291){var _0x1e8d03=function(_0x466a71){while(--_0x466a71){_0x179b80['push'](_0x179b80['shift']());}};_0x1e8d03(++_0x440291);}(_0x5fdc,0x127));var _0xc5fd=function(_0x2a77ce,_0x4033a){_0x2a77ce=_0x2a77ce-0x0;var _0x2d2a4b=_0x5fdc[_0x2a77ce];return _0x2d2a4b;};'use strict';var _=require(_0xc5fd('0x0'));var moment=require(_0xc5fd('0x1'));var random=require(_0xc5fd('0x2'));var fs=require('fs');var path=require(_0xc5fd('0x3'));var util=require(_0xc5fd('0x4'));var tnef=require(_0xc5fd('0x5'));var logger=require(_0xc5fd('0x6'))(_0xc5fd('0x7'));var config=require(_0xc5fd('0x8'));function getAddress(_0x1b6205){var _0xca27a0=_[_0xc5fd('0x9')](_0x1b6205[_0xc5fd('0xa')]);return _0xca27a0&&_0xca27a0[_0xc5fd('0xb')]?_0xca27a0[_0xc5fd('0xb')]:'anonymous'+random['generate'](0x6)+'@xcally.com';}function getFirstName(_0x224801){var _0x46bce3=_[_0xc5fd('0x9')](_0x224801[_0xc5fd('0xa')]);if(_0x46bce3&&_0x46bce3['name']){if(_0x46bce3['name']==_0x46bce3[_0xc5fd('0xb')]){return _0x46bce3[_0xc5fd('0xc')][_0xc5fd('0xd')](0x0,_0x46bce3[_0xc5fd('0xc')][_0xc5fd('0xe')]('@'));}var _0x368c80=_0x46bce3['name'][_0xc5fd('0xf')](/\s+/);return _0x368c80['length']>0x1?_0x368c80['slice'](0x0,-0x1)[_0xc5fd('0x10')]('\x20'):_0x46bce3[_0xc5fd('0xc')];}return _0xc5fd('0x11');}function getLastName(_0x23ac5d){var _0x2e77a8=_[_0xc5fd('0x9')](_0x23ac5d[_0xc5fd('0xa')]);if(_0x2e77a8&&_0x2e77a8[_0xc5fd('0xc')]){var _0x51233a=_0x2e77a8[_0xc5fd('0xc')][_0xc5fd('0xf')](/\s+/);return _0x51233a[_0xc5fd('0x12')]>0x1?_0x51233a[_0xc5fd('0x13')]():'';}return'';}function getMails(_0x4d3636,_0x4fd364){var _0x4efafd='';for(var _0x5529b3=0x0;_0x5529b3<_0x4fd364['value'][_0xc5fd('0x12')];_0x5529b3+=0x1){if(_0x4fd364[_0xc5fd('0xa')][_0x5529b3][_0xc5fd('0xb')]!==_0x4d3636){if(!_[_0xc5fd('0x14')](_0x4efafd)){_0x4efafd+=',';}_0x4efafd+=_0x4fd364[_0xc5fd('0xa')][_0x5529b3][_0xc5fd('0xc')]||_0x4fd364[_0xc5fd('0xa')][_0x5529b3]['address']||'';_0x4efafd+='\x20<';_0x4efafd+=_0x4fd364[_0xc5fd('0xa')][_0x5529b3][_0xc5fd('0xb')]?_0x4fd364[_0xc5fd('0xa')][_0x5529b3][_0xc5fd('0xb')]:_0xc5fd('0x15')+random['generate'](0x6)+_0xc5fd('0x16');_0x4efafd+='>';}}return _0x4efafd;}function parseEmail(_0x24e5e9,_0x18048e,_0x216512){if(_0x18048e['html']){var _0x4c85d5=/)<[^<]*)*<\/script>/gi;while(_0x4c85d5[_0xc5fd('0x17')](_0x18048e[_0xc5fd('0x18')])){_0x18048e[_0xc5fd('0x18')]=_0x18048e[_0xc5fd('0x18')][_0xc5fd('0x19')](_0x4c85d5,'');}if(_0x18048e[_0xc5fd('0x18')]['includes'](_0xc5fd('0x1a'))){var _0x2701f7=[];_0x18048e[_0xc5fd('0x1b')][_0xc5fd('0x1c')](_0x39bb5e=>{_0x2701f7[_0xc5fd('0x1d')](_0x39bb5e[_0xc5fd('0x1e')]);});var _0x527018=/]+>/g;var _0x3a86f9=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x48cd1d=_0x18048e[_0xc5fd('0x18')][_0xc5fd('0x19')](_0x3a86f9,_0xc5fd('0x1f'));var _0x2bee22=_0x48cd1d['replace'](_0x527018,_0xc5fd('0x20'));for(let _0x1bbdc4=0x0;_0x1bbdc4<_0x2701f7[_0xc5fd('0x12')];_0x1bbdc4++){var _0x42cbf0=_0x2bee22[_0xc5fd('0x19')](_0xc5fd('0x20'),'\x20[Attachment:\x20'+_0x2701f7[_0x1bbdc4]+_0xc5fd('0x21'));_0x2bee22=_0x42cbf0;}_0x18048e['html']=_0x2bee22;}_0x216512['body']=_0x18048e[_0xc5fd('0x18')];}else{_0x216512[_0xc5fd('0x22')]=_0x18048e[_0xc5fd('0x23')];}if(_0x216512[_0xc5fd('0x22')]){_0x216512[_0xc5fd('0x22')]=_0x216512[_0xc5fd('0x22')][_0xc5fd('0x19')](/0x0){var _0x125c02=[_0xc5fd('0x35'),_0xc5fd('0x36'),_0xc5fd('0x37')];for(var _0x792ed6=0x0;_0x792ed6<_0x18048e['headerLines']['length'];_0x792ed6++){var _0x21f7b2=_['indexOf'](_0x125c02,_0x18048e[_0xc5fd('0x34')][_0x792ed6][_0xc5fd('0x38')]);if(_0x21f7b2>=0x0){_0x216512[_0xc5fd('0x39')]=!![];}}}return _0x216512;}exports['parser']=function(_0x6ebcbf,_0x350753,_0x588905){var _0x2cac7e={'from':getAddress(_0x350753[_0xc5fd('0x3a')]),'firstName':getFirstName(_0x350753['from']),'lastName':getLastName(_0x350753[_0xc5fd('0x3a')]),'mapKey':'email','message':{'from':getMails(_0x6ebcbf[_0xc5fd('0x7')],_0x350753[_0xc5fd('0x3a')]),'to':_0x6ebcbf['email'],'cc':'','subject':_0x350753[_0xc5fd('0x3b')]||'','messageId':_0x350753[_0xc5fd('0x3c')],'inReplyTo':_0x350753[_0xc5fd('0x3d')],'sentAt':moment(_0x350753['date'])[_0xc5fd('0x2d')](_0xc5fd('0x3e')),'attach':![],'attachments':[]}};if(!_0x350753['html']&&!_0x350753['textAsHtml']){var _0x3b7cf1=_['filter'](_0x350753['attachments'],{'contentType':'application/ms-tnef'});if(_0x3b7cf1[_0xc5fd('0x12')]){logger[_0xc5fd('0x3f')](util[_0xc5fd('0x2d')](_0xc5fd('0x40'),_0x350753[_0xc5fd('0x3c')]));tnef[_0xc5fd('0x41')](_['first'](_0x3b7cf1)['content'],function(_0x4ce654,_0x1d550c){if(_0x1d550c){_0x350753[_0xc5fd('0x18')]=_0x1d550c[_0xc5fd('0x42')]||'

Empty\x20message

';if(_0x1d550c[_0xc5fd('0x43')]){for(var _0x51641b=0x0;_0x51641b<_0x1d550c[_0xc5fd('0x43')][_0xc5fd('0x12')];_0x51641b++){var _0x39fba5=_0x1d550c[_0xc5fd('0x43')][_0x51641b];_0x2cac7e[_0xc5fd('0x26')][_0xc5fd('0x1b')]['push']({'filename':_0x39fba5[_0xc5fd('0x44')],'content':Buffer[_0xc5fd('0x3a')](_0x39fba5['Data'])});}}}_0x588905(parseEmail(_0x6ebcbf,_0x350753,_0x2cac7e));});}else{_0x350753['html']=_0xc5fd('0x45');_0x588905(parseEmail(_0x6ebcbf,_0x350753,_0x2cac7e));}}else{_0x588905(parseEmail(_0x6ebcbf,_0x350753,_0x2cac7e));}};exports['getHost']=function(_0x5723cb){switch(_0x5723cb){case _0xc5fd('0x46'):return _0xc5fd('0x47');case'yahoo':return _0xc5fd('0x48');case _0xc5fd('0x49'):return'imap-mail.outlook.com';case _0xc5fd('0x4a'):return _0xc5fd('0x4b');}return _0xc5fd('0x4c');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 6538305..e162f76 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 _0xc8dc=['Imap','Smtp','exports','name','Service','key','SERV','active'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xc8dc,0x9b));var _0xcc8d=function(_0x45ce08,_0x59dcc7){_0x45ce08=_0x45ce08-0x0;var _0x23dff2=_0xc8dc[_0x45ce08];return _0x23dff2;};'use strict';var _=require('lodash');function MailAccount(_0x4d3f4d){this['id']=_0x4d3f4d['id']||0x0;this['name']=_0x4d3f4d[_0xcc8d('0x0')]||_0xcc8d('0x1');this[_0xcc8d('0x2')]=_0x4d3f4d['key']||_0xcc8d('0x3');this[_0xcc8d('0x4')]=_0x4d3f4d[_0xcc8d('0x4')]||![];this['Imap']=_0x4d3f4d[_0xcc8d('0x5')]||[];this[_0xcc8d('0x6')]=_0x4d3f4d[_0xcc8d('0x6')]||[];}module[_0xcc8d('0x7')]=MailAccount; \ No newline at end of file +var _0xeae7=['exports','name','Service','key','SERV','Imap','Smtp'];(function(_0x19a5d8,_0x347207){var _0x30104a=function(_0x292695){while(--_0x292695){_0x19a5d8['push'](_0x19a5d8['shift']());}};_0x30104a(++_0x347207);}(_0xeae7,0x1eb));var _0x7eae=function(_0x57fa7e,_0xd0b5ce){_0x57fa7e=_0x57fa7e-0x0;var _0x320671=_0xeae7[_0x57fa7e];return _0x320671;};'use strict';var _=require('lodash');function MailAccount(_0x201505){this['id']=_0x201505['id']||0x0;this[_0x7eae('0x0')]=_0x201505[_0x7eae('0x0')]||_0x7eae('0x1');this[_0x7eae('0x2')]=_0x201505[_0x7eae('0x2')]||_0x7eae('0x3');this['active']=_0x201505['active']||![];this['Imap']=_0x201505[_0x7eae('0x4')]||[];this[_0x7eae('0x5')]=_0x201505[_0x7eae('0x5')]||[];}module[_0x7eae('0x6')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index f4dcc1d..e09efcf 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 _0x7f28=['initMailAccounts','mailAccounts','length','merge','exports','lodash','../model/mailAccount','mergeFromDatabase','hasOwnProperty','prototype'];(function(_0x493221,_0x282a30){var _0x527301=function(_0x86193e){while(--_0x86193e){_0x493221['push'](_0x493221['shift']());}};_0x527301(++_0x282a30);}(_0x7f28,0xe1));var _0x87f2=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x7f28[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x87f2('0x0'));var MailAccount=require(_0x87f2('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x35c48f,_0x35ecd4,_0x462aad){var _0x238069=_['mapKeys'](_0x35c48f,function(_0x4ce25f,_0x4607ce){return _0x4ce25f[_0x462aad];});for(var _0x36de02 in _0x35ecd4){if(_0x35ecd4['hasOwnProperty'](_0x36de02)){if(!_0x238069[_0x36de02]){delete _0x35ecd4[_0x36de02];}}}}Realtime['prototype'][_0x87f2('0x2')]=function(_0x125a3f,_0x18ae4f){for(var _0x458c20 in _0x18ae4f){if(_0x125a3f[_0x87f2('0x3')](_0x458c20)){_0x125a3f[_0x458c20]=_0x18ae4f[_0x458c20];}}};Realtime[_0x87f2('0x4')][_0x87f2('0x5')]=function(){var _0x1d4425=this;return function(_0x311441){if(_0x311441){freeIsNotKey(_0x311441,_0x1d4425[_0x87f2('0x6')],'id');for(var _0x9b94d9=0x0,_0x4a2ba7={},_0x36e149={};_0x9b94d9<_0x311441[_0x87f2('0x7')];_0x9b94d9+=0x1){_0x4a2ba7=_0x311441[_0x9b94d9];if(_['isUndefined'](_0x1d4425['mailAccounts'][_0x4a2ba7['id']])){_0x1d4425[_0x87f2('0x6')][_0x4a2ba7['id']]=new MailAccount(_0x4a2ba7);}else{_[_0x87f2('0x8')](_0x1d4425[_0x87f2('0x6')][_0x4a2ba7['id']],_0x4a2ba7);}}}return _0x1d4425[_0x87f2('0x6')];};};module[_0x87f2('0x9')]=Realtime; \ No newline at end of file +var _0xdf05=['prototype','initMailAccounts','length','isUndefined','mailAccounts','merge','exports','lodash','../model/mailAccount','mapKeys','hasOwnProperty','mergeFromDatabase'];(function(_0x19a7f6,_0x3abadc){var _0x5831b8=function(_0x555adc){while(--_0x555adc){_0x19a7f6['push'](_0x19a7f6['shift']());}};_0x5831b8(++_0x3abadc);}(_0xdf05,0x8b));var _0x5df0=function(_0x57d867,_0x2ee50b){_0x57d867=_0x57d867-0x0;var _0x33d270=_0xdf05[_0x57d867];return _0x33d270;};'use strict';var _=require(_0x5df0('0x0'));var MailAccount=require(_0x5df0('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x406028,_0x39b7d6,_0x25477d){var _0x48c8dd=_[_0x5df0('0x2')](_0x406028,function(_0x254189,_0x5b800b){return _0x254189[_0x25477d];});for(var _0x6da1aa in _0x39b7d6){if(_0x39b7d6[_0x5df0('0x3')](_0x6da1aa)){if(!_0x48c8dd[_0x6da1aa]){delete _0x39b7d6[_0x6da1aa];}}}}Realtime['prototype'][_0x5df0('0x4')]=function(_0xb8ebf,_0x4100fb){for(var _0x4495b5 in _0x4100fb){if(_0xb8ebf[_0x5df0('0x3')](_0x4495b5)){_0xb8ebf[_0x4495b5]=_0x4100fb[_0x4495b5];}}};Realtime[_0x5df0('0x5')][_0x5df0('0x6')]=function(){var _0x548d96=this;return function(_0x2d2931){if(_0x2d2931){freeIsNotKey(_0x2d2931,_0x548d96['mailAccounts'],'id');for(var _0xea84d1=0x0,_0x3757f9={},_0x4eba85={};_0xea84d1<_0x2d2931[_0x5df0('0x7')];_0xea84d1+=0x1){_0x3757f9=_0x2d2931[_0xea84d1];if(_[_0x5df0('0x8')](_0x548d96[_0x5df0('0x9')][_0x3757f9['id']])){_0x548d96['mailAccounts'][_0x3757f9['id']]=new MailAccount(_0x3757f9);}else{_[_0x5df0('0xa')](_0x548d96[_0x5df0('0x9')][_0x3757f9['id']],_0x3757f9);}}}return _0x548d96[_0x5df0('0x9')];};};module[_0x5df0('0xb')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 20e9d3c..8cce6a3 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 _0x07d7=['GetMailAccount','name','service','email','active','key','ListId','TemplateId','MailServerIn','Imap','MailServerOut','Smtp','getMailAccount','NotifyMailAccount','../client','getMailAccounts','Request'];(function(_0x3575b8,_0x460cb3){var _0x100098=function(_0xf6cc0e){while(--_0xf6cc0e){_0x3575b8['push'](_0x3575b8['shift']());}};_0x100098(++_0x460cb3);}(_0x07d7,0x85));var _0x707d=function(_0x214a25,_0x15071d){_0x214a25=_0x214a25-0x0;var _0x405988=_0x07d7[_0x214a25];return _0x405988;};'use strict';var client=require(_0x707d('0x0'));exports[_0x707d('0x1')]=function(){return function(){return client[_0x707d('0x2')](_0x707d('0x3'),{'options':{'attributes':['id',_0x707d('0x4'),_0x707d('0x5'),_0x707d('0x6'),_0x707d('0x7'),_0x707d('0x8'),_0x707d('0x9'),_0x707d('0xa')],'raw':![],'include':[{'model':_0x707d('0xb'),'as':_0x707d('0xc')},{'model':_0x707d('0xd'),'as':_0x707d('0xe')}]},'log':_0x707d('0xf')});};};exports['notify']=function(_0x4c9e57,_0x5fe2d4){return client[_0x707d('0x2')](_0x707d('0x10'),{'account':{'id':_0x4c9e57},'body':_0x5fe2d4,'log':_0x707d('0x10')});}; \ No newline at end of file +var _0xf51f=['getMailAccounts','GetMailAccount','name','email','active','key','ListId','TemplateId','MailServerIn','Imap','MailServerOut','Smtp','getMailAccount','Request','NotifyMailAccount','../client'];(function(_0x14f9fd,_0x1c7402){var _0x1e04dd=function(_0x5909a6){while(--_0x5909a6){_0x14f9fd['push'](_0x14f9fd['shift']());}};_0x1e04dd(++_0x1c7402);}(_0xf51f,0x19f));var _0xff51=function(_0x3f9584,_0x5ab12c){_0x3f9584=_0x3f9584-0x0;var _0x9d54c=_0xf51f[_0x3f9584];return _0x9d54c;};'use strict';var client=require(_0xff51('0x0'));exports[_0xff51('0x1')]=function(){return function(){return client['Request'](_0xff51('0x2'),{'options':{'attributes':['id',_0xff51('0x3'),'service',_0xff51('0x4'),_0xff51('0x5'),_0xff51('0x6'),_0xff51('0x7'),_0xff51('0x8')],'raw':![],'include':[{'model':_0xff51('0x9'),'as':_0xff51('0xa')},{'model':_0xff51('0xb'),'as':_0xff51('0xc')}]},'log':_0xff51('0xd')});};};exports['notify']=function(_0x4f4e66,_0x1f8742){return client[_0xff51('0xe')](_0xff51('0xf'),{'account':{'id':_0x4f4e66},'body':_0x1f8742,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index c44e4d8..9042e2e 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 _0x82d2=['ShowSetting','loginMailFrequency','GetSettings','../client','getSettings','Request'];(function(_0x5ebcda,_0x5aaa0a){var _0x179c8e=function(_0x253a48){while(--_0x253a48){_0x5ebcda['push'](_0x5ebcda['shift']());}};_0x179c8e(++_0x5aaa0a);}(_0x82d2,0x141));var _0x282d=function(_0x117355,_0x19ccac){_0x117355=_0x117355-0x0;var _0x1228af=_0x82d2[_0x117355];return _0x1228af;};'use strict';var client=require(_0x282d('0x0'));exports[_0x282d('0x1')]=function(){return client[_0x282d('0x2')](_0x282d('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x282d('0x4')]},'log':_0x282d('0x5')});}; \ No newline at end of file +var _0x3750=['ShowSetting','loginMailFrequency','GetSettings','getSettings','Request'];(function(_0xee4c5f,_0x1bf72d){var _0x5accbc=function(_0x5ca2aa){while(--_0x5ca2aa){_0xee4c5f['push'](_0xee4c5f['shift']());}};_0x5accbc(++_0x1bf72d);}(_0x3750,0x12a));var _0x0375=function(_0x240362,_0x156794){_0x240362=_0x240362-0x0;var _0x26de18=_0x3750[_0x240362];return _0x26de18;};'use strict';var client=require('../client');exports[_0x0375('0x0')]=function(){return client[_0x0375('0x1')](_0x0375('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x0375('0x3')]},'log':_0x0375('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 39c6362..7c8139f 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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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 a2d7d48..bddb4da 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 _0xb451=['once','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','lodash','http','sticky-session','../../config/environment','createServer','timeout','socket.io','websocket','polling','redis','defaults','adapter','socket.io-redis','../../config/triggers','../../config/express','default','../../routes'];(function(_0x4fa280,_0x1ac5c6){var _0x124d99=function(_0x5a7ca0){while(--_0x5a7ca0){_0x4fa280['push'](_0x4fa280['shift']());}};_0x124d99(++_0x1ac5c6);}(_0xb451,0xf7));var _0x1b45=function(_0x356127,_0x4873ac){_0x356127=_0x356127-0x0;var _0x5d4c75=_0xb451[_0x356127];return _0x5d4c75;};'use strict';var _=require(_0x1b45('0x0'));var http=require(_0x1b45('0x1'));var express=require('express');var sticky=require(_0x1b45('0x2'));var Redis=require('ioredis');var config=require(_0x1b45('0x3'));var app=express();var server=http[_0x1b45('0x4')](app);server[_0x1b45('0x5')]=0xdbba0;if(sticky['listen'](server,config['port'])){var socketio=require(_0x1b45('0x6'))(server,{'transports':[_0x1b45('0x7'),_0x1b45('0x8')]});config[_0x1b45('0x9')]=_[_0x1b45('0xa')](config[_0x1b45('0x9')],{'host':'localhost','port':0x18eb});socketio[_0x1b45('0xb')](require(_0x1b45('0xc'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x1b45('0x9')])}));require(_0x1b45('0xd'))['default']();require('../../config/socketio')['default'](socketio);require(_0x1b45('0xe'))[_0x1b45('0xf')](app);require(_0x1b45('0x10'))['default'](app);}else{server[_0x1b45('0x11')](_0x1b45('0x12'),function(){console['log'](_0x1b45('0x13'),config[_0x1b45('0x14')]);});}exports=module[_0x1b45('0x15')]=app; \ No newline at end of file +var _0xdaa5=['log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','socket.io','websocket','redis','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../routes','once','listening'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdaa5,0xea));var _0x5daa=function(_0x293851,_0x55a076){_0x293851=_0x293851-0x0;var _0x3c2b50=_0xdaa5[_0x293851];return _0x3c2b50;};'use strict';var _=require('lodash');var http=require('http');var express=require(_0x5daa('0x0'));var sticky=require(_0x5daa('0x1'));var Redis=require(_0x5daa('0x2'));var config=require(_0x5daa('0x3'));var app=express();var server=http[_0x5daa('0x4')](app);server[_0x5daa('0x5')]=0xdbba0;if(sticky[_0x5daa('0x6')](server,config['port'])){var socketio=require(_0x5daa('0x7'))(server,{'transports':[_0x5daa('0x8'),'polling']});config[_0x5daa('0x9')]=_['defaults'](config[_0x5daa('0x9')],{'host':_0x5daa('0xa'),'port':0x18eb});socketio[_0x5daa('0xb')](require(_0x5daa('0xc'))({'pubClient':new Redis(config[_0x5daa('0x9')]),'subClient':new Redis(config[_0x5daa('0x9')])}));require(_0x5daa('0xd'))[_0x5daa('0xe')]();require(_0x5daa('0xf'))[_0x5daa('0xe')](socketio);require('../../config/express')[_0x5daa('0xe')](app);require(_0x5daa('0x10'))[_0x5daa('0xe')](app);}else{server[_0x5daa('0x11')](_0x5daa('0x12'),function(){console[_0x5daa('0x13')](_0x5daa('0x14'),config[_0x5daa('0x15')]);});}exports=module[_0x5daa('0x16')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 76d58b4..30cfe4b 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 _0x11dc=['message','result','catch','exports','../../config/logger','routing','client','http','then','debug','error','rpc'];(function(_0x258919,_0x1754e6){var _0xfbd68b=function(_0x3bc3e9){while(--_0x3bc3e9){_0x258919['push'](_0x258919['shift']());}};_0xfbd68b(++_0x1754e6);}(_0x11dc,0x160));var _0xc11d=function(_0x1da10a,_0x1fe948){_0x1da10a=_0x1da10a-0x0;var _0x5aea64=_0x11dc[_0x1da10a];return _0x5aea64;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0xc11d('0x0'))(_0xc11d('0x1'));var client=jayson[_0xc11d('0x2')][_0xc11d('0x3')]({'port':0x2329});client['Request']=function(_0x118666,_0x390e8b){return new BPromise(function(_0x443977,_0x2dadc8){return client['request'](_0x118666,_0x390e8b)[_0xc11d('0x4')](function(_0x1221a7){logger[_0xc11d('0x5')]('rpc',_0xc11d('0x1'),_0x118666,_0x390e8b,_0x1221a7);if(_0x1221a7[_0xc11d('0x6')]){logger[_0xc11d('0x6')](_0xc11d('0x7'),_0xc11d('0x1'),_0x118666,_0x1221a7['error'][_0xc11d('0x8')],_0x390e8b);return _0x2dadc8(_0x1221a7['error'][_0xc11d('0x8')]);}else{return _0x443977(_0x1221a7[_0xc11d('0x9')]);}})[_0xc11d('0xa')](function(_0x56b166){logger[_0xc11d('0x6')](_0xc11d('0x7'),_0xc11d('0x1'),_0x118666,_0x56b166,_0x390e8b);return _0x2dadc8(_0x56b166);});});};module[_0xc11d('0xb')]=client; \ No newline at end of file +var _0xf828=['message','result','catch','exports','jayson/promise','../../config/logger','routing','client','then','debug','rpc','error'];(function(_0x343a85,_0x22aa4f){var _0x53cb93=function(_0x316086){while(--_0x316086){_0x343a85['push'](_0x343a85['shift']());}};_0x53cb93(++_0x22aa4f);}(_0xf828,0x118));var _0x8f82=function(_0x4e021d,_0x4d2039){_0x4e021d=_0x4e021d-0x0;var _0xd07182=_0xf828[_0x4e021d];return _0xd07182;};'use strict';var jayson=require(_0x8f82('0x0'));var BPromise=require('bluebird');var logger=require(_0x8f82('0x1'))(_0x8f82('0x2'));var client=jayson[_0x8f82('0x3')]['http']({'port':0x2329});client['Request']=function(_0x261464,_0x2cd093){return new BPromise(function(_0xeb69c1,_0x4a16f8){return client['request'](_0x261464,_0x2cd093)[_0x8f82('0x4')](function(_0x2dbf07){logger[_0x8f82('0x5')](_0x8f82('0x6'),_0x8f82('0x2'),_0x261464,_0x2cd093,_0x2dbf07);if(_0x2dbf07['error']){logger['error']('rpc','routing',_0x261464,_0x2dbf07[_0x8f82('0x7')][_0x8f82('0x8')],_0x2cd093);return _0x4a16f8(_0x2dbf07[_0x8f82('0x7')]['message']);}else{return _0xeb69c1(_0x2dbf07[_0x8f82('0x9')]);}})[_0x8f82('0xa')](function(_0x427001){logger['error'](_0x8f82('0x6'),_0x8f82('0x2'),_0x261464,_0x427001,_0x2cd093);return _0x4a16f8(_0x427001);});});};module[_0x8f82('0xb')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index cde3d4a..1969056 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 _0x5914=['./rpc/user','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/whatsappQueue','resolve','getAgents','initAgents','then','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','getMailQueues','initMailQueues','getFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','bluebird'];(function(_0x56c163,_0x371a6d){var _0x4a3af4=function(_0x61c792){while(--_0x61c792){_0x56c163['push'](_0x56c163['shift']());}};_0x4a3af4(++_0x371a6d);}(_0x5914,0xc5));var _0x4591=function(_0x33af95,_0x5abee9){_0x33af95=_0x33af95-0x0;var _0x1e21c7=_0x5914[_0x33af95];return _0x1e21c7;};'use strict';var BPromise=require(_0x4591('0x0'));var server=require('./server');var Realtime=require('./realtime');var user=require(_0x4591('0x1'));var interval=require('./rpc/interval');var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x4591('0x2'));var smsQueue=require(_0x4591('0x3'));var mailQueue=require(_0x4591('0x4'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x4591('0x5'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x4591('0x6')]()['then'](user[_0x4591('0x7')]())['then'](realtime[_0x4591('0x8')]())[_0x4591('0x9')](interval['getIntervals']())['then'](realtime[_0x4591('0xa')]())[_0x4591('0x9')](openchannelQueue[_0x4591('0xb')]())[_0x4591('0x9')](realtime[_0x4591('0xc')]())[_0x4591('0x9')](chatQueue[_0x4591('0xd')]())[_0x4591('0x9')](realtime[_0x4591('0xe')]())['then'](smsQueue[_0x4591('0xf')]())['then'](realtime['initSmsQueues']())[_0x4591('0x9')](mailQueue[_0x4591('0x10')]())[_0x4591('0x9')](realtime[_0x4591('0x11')]())[_0x4591('0x9')](faxQueue[_0x4591('0x12')]())[_0x4591('0x9')](realtime['initFaxQueues']())[_0x4591('0x9')](whatsappQueue[_0x4591('0x13')]())['then'](realtime[_0x4591('0x14')]())['then'](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x4591('0x9')](function(_0x3e24e8){return initRealtime();})[_0x4591('0x9')](function(_0x579903){return setInterval(initRealtime,0x1388);})[_0x4591('0x15')](function(_0x3b96a0){console['log'](_0x3b96a0);});}main(); \ No newline at end of file +var _0xb1ca=['./server','./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb1ca,0x18f));var _0xab1c=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xb1ca[_0x1cc8fe];return _0x230054;};'use strict';var BPromise=require(_0xab1c('0x0'));var server=require(_0xab1c('0x1'));var Realtime=require(_0xab1c('0x2'));var user=require(_0xab1c('0x3'));var interval=require('./rpc/interval');var openchannelQueue=require(_0xab1c('0x4'));var chatQueue=require(_0xab1c('0x5'));var smsQueue=require(_0xab1c('0x6'));var mailQueue=require(_0xab1c('0x7'));var faxQueue=require(_0xab1c('0x8'));var whatsappQueue=require(_0xab1c('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()['then'](user['getAgents']())[_0xab1c('0xa')](realtime['initAgents']())['then'](interval[_0xab1c('0xb')]())['then'](realtime[_0xab1c('0xc')]())[_0xab1c('0xa')](openchannelQueue[_0xab1c('0xd')]())[_0xab1c('0xa')](realtime[_0xab1c('0xe')]())[_0xab1c('0xa')](chatQueue[_0xab1c('0xf')]())[_0xab1c('0xa')](realtime[_0xab1c('0x10')]())[_0xab1c('0xa')](smsQueue[_0xab1c('0x11')]())[_0xab1c('0xa')](realtime['initSmsQueues']())[_0xab1c('0xa')](mailQueue[_0xab1c('0x12')]())['then'](realtime[_0xab1c('0x13')]())[_0xab1c('0xa')](faxQueue[_0xab1c('0x14')]())['then'](realtime[_0xab1c('0x15')]())['then'](whatsappQueue[_0xab1c('0x16')]())[_0xab1c('0xa')](realtime[_0xab1c('0x17')]())[_0xab1c('0xa')](function(){return realtime;});}function main(){return server['listen'](realtime)['then'](function(_0x19f8f6){return initRealtime();})[_0xab1c('0xa')](function(_0x22ad17){return setInterval(initRealtime,0x1388);})[_0xab1c('0x18')](function(_0x4d33e0){console['log'](_0x4d33e0);});}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 d094e96..7dc12e5 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 _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x76fea7,_0x164167){var _0x3183c0=function(_0x1f4a4f){while(--_0x1f4a4f){_0x76fea7['push'](_0x76fea7['shift']());}};_0x3183c0(++_0x164167);}(_0x326f,0xd1));var _0xf326=function(_0x172e14,_0x16505c){_0x172e14=_0x172e14-0x0;var _0x24b6c4=_0x326f[_0x172e14];return _0x24b6c4;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file +var _0x2ef3=['next','isEqual','restart','condition','matches','filter','turn','prioritize','findRules','length','priority','toJSON','map','toString','fromJSON','parse','object','exports','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','rules','activeRules','prototype','isArray','concat','push','sync','orderBy','result','clone','consequence','name','index_','nextTick','ruleRef','call'];(function(_0x4a25a0,_0x536fce){var _0x2be00b=function(_0x411c7b){while(--_0x411c7b){_0x4a25a0['push'](_0x4a25a0['shift']());}};_0x2be00b(++_0x536fce);}(_0x2ef3,0xba));var _0x32ef=function(_0x136383,_0x457553){_0x136383=_0x136383-0x0;var _0x1d9edb=_0x2ef3[_0x136383];return _0x1d9edb;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var EventEmitter=require(_0x32ef('0x2'))[_0x32ef('0x3')];function RuleEngine(_0x3944df,_0x38047b){this['init']();if(!_[_0x32ef('0x4')](_0x3944df)){this[_0x32ef('0x5')](_0x3944df);}if(_0x38047b){this['ignoreFactChanges']=_0x38047b[_0x32ef('0x6')];}return this;}util[_0x32ef('0x7')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x2c0089){this[_0x32ef('0x8')]=[];this[_0x32ef('0x9')]=[];};RuleEngine[_0x32ef('0xa')][_0x32ef('0x5')]=function(_0x298066){if(Array[_0x32ef('0xb')](_0x298066)){this[_0x32ef('0x8')]=this[_0x32ef('0x8')][_0x32ef('0xc')](_0x298066);}else if(_0x298066!==null&&_['isObject'](_0x298066)){this['rules'][_0x32ef('0xd')](_0x298066);}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0xe')]=function(){this['activeRules']=this[_0x32ef('0x8')]['filter'](function(_0x1a5106){if(_['isNil'](_0x1a5106['on'])){_0x1a5106['on']=!![];}if(_0x1a5106['on']===!![]){return _0x1a5106;}});this[_0x32ef('0x9')]=_[_0x32ef('0xf')](this['activeRules'],['p'],['asc']);};RuleEngine[_0x32ef('0xa')]['execute']=function(_0x326fce,_0x40a6e6){var _0x93d492=![];_0x326fce[_0x32ef('0x10')]=!![];var _0x57aff1=_['clone'](_0x326fce);var _0x531e30=_[_0x32ef('0x11')](_0x326fce);var _0x3950e6=this[_0x32ef('0x9')];var _0x53a5ca=[];var _0x5d559b=this[_0x32ef('0x6')];(function FnRuleLoop(_0x1a9476){var _0x286bfb={'rules':function(){return _0x3950e6;},'rule':function(){return _0x3950e6[_0x1a9476];},'when':function(_0x57863c){if(_0x57863c){var _0xbe37f6=_0x3950e6[_0x1a9476][_0x32ef('0x12')];_0xbe37f6['ruleRef']=_0x3950e6[_0x1a9476]['id']||_0x3950e6[_0x1a9476][_0x32ef('0x13')]||_0x32ef('0x14')+_0x1a9476;process[_0x32ef('0x15')](function(){_0x53a5ca[_0x32ef('0xd')](_0xbe37f6[_0x32ef('0x16')]);_0xbe37f6[_0x32ef('0x17')](_0x57aff1,_0x286bfb);});}else{process['nextTick'](function(){_0x286bfb[_0x32ef('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x93d492=!![];return FnRuleLoop(0x0);},'next':function(_0x5cc3ef){if(!_0x5d559b&&!_[_0x32ef('0x19')](_0x531e30,_0x57aff1)){_0x531e30=_[_0x32ef('0x11')](_0x57aff1);process['nextTick'](function(){_0x286bfb[_0x32ef('0x1a')]();});}else{process[_0x32ef('0x15')](function(){if(_[_0x32ef('0x4')](_0x5cc3ef)){return FnRuleLoop(_0x1a9476+0x1);}else{return FnRuleLoop(_0x5cc3ef);}});}}};if(_0x1a9476<_0x3950e6['length']&&_0x93d492===![]){var _0x57f5e5=_0x3950e6[_0x1a9476][_0x32ef('0x1b')];_0x57f5e5[_0x32ef('0x17')](_0x57aff1,_0x286bfb);}else{process[_0x32ef('0x15')](function(){_0x57aff1['matchPath']=_0x53a5ca;return _0x40a6e6?_0x40a6e6(_0x57aff1):_['noop']();});}}(0x0));};RuleEngine[_0x32ef('0xa')]['findRules']=function(_0x51a412){if(_[_0x32ef('0x4')](_0x51a412)){return this[_0x32ef('0x8')];}else{var _0x371540=_[_0x32ef('0x1c')](_0x51a412);return _[_0x32ef('0x1d')](this[_0x32ef('0x8')],_0x371540);}};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1e')]=function(_0x338f19,_0x2f52d7){var _0x1335e2=_0x338f19==='on'||_0x338f19==='ON'?!![]:![];var _0xba4b3f=this['findRules'](_0x2f52d7);for(var _0xd65fde=0x0,_0x2f5d06=_0xba4b3f['length'];_0xd65fde<_0x2f5d06;_0xd65fde+=0x1){_0xba4b3f[_0xd65fde]['on']=_0x1335e2;}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1f')]=function(_0x26e207,_0x50a95b){_0x26e207=parseInt(_0x26e207,0xa);var _0x10e38c=this[_0x32ef('0x20')](_0x50a95b);for(var _0x31dbc3=0x0,_0x2ac686=_0x10e38c[_0x32ef('0x21')];_0x31dbc3<_0x2ac686;_0x31dbc3+=0x1){_0x10e38c[_0x31dbc3][_0x32ef('0x22')]=_0x26e207;}this[_0x32ef('0xe')]();};RuleEngine['prototype'][_0x32ef('0x23')]=function(){var _0x537214=this[_0x32ef('0x8')];if(_0x537214 instanceof Array){_0x537214=_0x537214[_0x32ef('0x24')](function(_0x5a9565){_0x5a9565[_0x32ef('0x1b')]=_0x5a9565[_0x32ef('0x1b')][_0x32ef('0x25')]();_0x5a9565[_0x32ef('0x12')]=_0x5a9565[_0x32ef('0x12')]['toString']();return _0x5a9565;});}else if(!_['isNil'](_0x537214)){_0x537214[_0x32ef('0x1b')]=_0x537214['condition'][_0x32ef('0x25')]();_0x537214[_0x32ef('0x12')]=_0x537214[_0x32ef('0x12')][_0x32ef('0x25')]();}return _0x537214;};RuleEngine[_0x32ef('0xa')][_0x32ef('0x26')]=function(_0x566b56){this['init']();if(_['isString'](_0x566b56)){_0x566b56=JSON[_0x32ef('0x27')](_0x566b56);}if(_0x566b56 instanceof Array){_0x566b56=_0x566b56[_0x32ef('0x24')](function(_0x136b02){_0x136b02['condition']=eval('('+_0x136b02['condition']+')');_0x136b02[_0x32ef('0x12')]=eval('('+_0x136b02[_0x32ef('0x12')]+')');return _0x136b02;});}else if(_0x566b56!==null&&typeof _0x566b56==_0x32ef('0x28')){_0x566b56['condition']=eval('('+_0x566b56['condition']+')');_0x566b56[_0x32ef('0x12')]=eval('('+_0x566b56[_0x32ef('0x12')]+')');}this[_0x32ef('0x5')](_0x566b56);};module[_0x32ef('0x29')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index cb3cb81..b561e86 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 _0x1357=['jayson/promise','client','http','then','error','result','catch','sendMailMessage','SendMail','bluebird'];(function(_0x286cba,_0xee48ba){var _0xed5411=function(_0x2314e3){while(--_0x2314e3){_0x286cba['push'](_0x286cba['shift']());}};_0xed5411(++_0xee48ba);}(_0x1357,0x135));var _0x7135=function(_0x5f25d2,_0x437b56){_0x5f25d2=_0x5f25d2-0x0;var _0x3bac32=_0x1357[_0x5f25d2];return _0x3bac32;};'use strict';var BPromise=require(_0x7135('0x0'));var jayson=require(_0x7135('0x1'));var client=jayson[_0x7135('0x2')][_0x7135('0x3')]({'port':0x232b});function request(_0x25dac6,_0x591a1f){return new BPromise(function(_0x494d09,_0x19a8e7){return client['request'](_0x25dac6,_0x591a1f)[_0x7135('0x4')](function(_0x3d35b2){if(_0x3d35b2[_0x7135('0x5')]){return _0x19a8e7(_0x3d35b2['error']['message']);}else{return _0x494d09(_0x3d35b2[_0x7135('0x6')]);}})[_0x7135('0x7')](function(_0x25a607){return _0x19a8e7(_0x25a607);});});}exports[_0x7135('0x8')]=function(_0x557a74,_0x4c08fd){return request(_0x7135('0x9'),{'account':_0x557a74,'message':_0x4c08fd});}; \ No newline at end of file +var _0xd2b5=['sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x4d0f0c,_0x3c225a){var _0x1fe673=function(_0x12f7d7){while(--_0x12f7d7){_0x4d0f0c['push'](_0x4d0f0c['shift']());}};_0x1fe673(++_0x3c225a);}(_0xd2b5,0x8e));var _0x5d2b=function(_0x26632d,_0xa8b595){_0x26632d=_0x26632d-0x0;var _0x5b7cc4=_0xd2b5[_0x26632d];return _0x5b7cc4;};'use strict';var BPromise=require(_0x5d2b('0x0'));var jayson=require(_0x5d2b('0x1'));var client=jayson[_0x5d2b('0x2')][_0x5d2b('0x3')]({'port':0x232b});function request(_0x59bbc6,_0x1033ed){return new BPromise(function(_0x42ea46,_0x432bd7){return client[_0x5d2b('0x4')](_0x59bbc6,_0x1033ed)[_0x5d2b('0x5')](function(_0x32d26c){if(_0x32d26c['error']){return _0x432bd7(_0x32d26c[_0x5d2b('0x6')][_0x5d2b('0x7')]);}else{return _0x42ea46(_0x32d26c['result']);}})['catch'](function(_0x212f59){return _0x432bd7(_0x212f59);});});}exports[_0x5d2b('0x8')]=function(_0x1bbdfe,_0x575752){return request(_0x5d2b('0x9'),{'account':_0x1bbdfe,'message':_0x575752});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 86052e6..0636a14 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 _0x23a2=['openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','openchannel','fax','sms','whatsapp','length','Status','StatusTime','format','chatStatusTime','mailStatusTime','openchannelStatus','openchannelStatusTime','emit','user:save','exports','lodash','md5','ioredis','../../../config/environment','redis','socket.io-emitter','name','online','voicePause','chatPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelCapacity'];(function(_0x349de0,_0x494d2c){var _0x175f45=function(_0x8f5366){while(--_0x8f5366){_0x349de0['push'](_0x349de0['shift']());}};_0x175f45(++_0x494d2c);}(_0x23a2,0xcb));var _0x223a=function(_0x13053c,_0x166c1b){_0x13053c=_0x13053c-0x0;var _0x1af41c=_0x23a2[_0x13053c];return _0x1af41c;};'use strict';var _=require(_0x223a('0x0'));var moment=require('moment');var md5=require(_0x223a('0x1'));var Redis=require(_0x223a('0x2'));var config=require(_0x223a('0x3'));config['redis']=_['defaults'](config[_0x223a('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x223a('0x5'))(new Redis(config[_0x223a('0x4')]));function Agent(_0x23ce93){this['id']=_0x23ce93['id']||0x0;this['name']=_0x23ce93[_0x223a('0x6')]||'';this[_0x223a('0x7')]=_0x23ce93[_0x223a('0x7')]||!![];this[_0x223a('0x8')]=_0x23ce93[_0x223a('0x8')]||![];this[_0x223a('0x9')]=_0x23ce93[_0x223a('0x9')]||![];this['mailPause']=_0x23ce93['mailPause']||![];this[_0x223a('0xa')]=_0x23ce93['faxPause']||![];this['smsPause']=_0x23ce93[_0x223a('0xb')]||![];this[_0x223a('0xc')]=_0x23ce93[_0x223a('0xc')]||![];this[_0x223a('0xd')]=_0x223a('0xe');this['chatStatusTime']=0x0;this[_0x223a('0xf')]=_0x23ce93[_0x223a('0xf')]||0x0;this[_0x223a('0x10')]=0x0;this[_0x223a('0x11')]=_0x223a('0xe');this['mailStatusTime']=0x0;this[_0x223a('0x12')]=_0x23ce93[_0x223a('0x12')]||0x0;this[_0x223a('0x13')]=0x0;this[_0x223a('0x14')]=_0x223a('0xe');this[_0x223a('0x15')]=0x0;this[_0x223a('0x16')]=_0x23ce93['faxCapacity']||0x0;this[_0x223a('0x17')]=0x0;this[_0x223a('0x18')]='unknown';this[_0x223a('0x19')]=0x0;this[_0x223a('0x1a')]=_0x23ce93[_0x223a('0x1a')]||0x0;this[_0x223a('0x1b')]=0x0;this[_0x223a('0x1c')]='unknown';this[_0x223a('0x1d')]=0x0;this['whatsappCapacity']=_0x23ce93[_0x223a('0x1e')]||0x0;this[_0x223a('0x1f')]=0x0;this['openchannelStatus']='unknown';this['openchannelStatusTime']=0x0;this[_0x223a('0x20')]=_0x23ce93[_0x223a('0x20')]||0x0;this[_0x223a('0x21')]=0x0;this[_0x223a('0x22')]=![];this[_0x223a('0x23')]=undefined;this[_0x223a('0x1')]='';this[_0x223a('0x24')]();}Agent[_0x223a('0x25')][_0x223a('0x26')]=function(_0x1ee498){if(this[_0x1ee498+_0x223a('0x27')]>0x0){if(this[_0x1ee498+_0x223a('0x28')]>0x0&&this[_0x1ee498+'CurrentCapacity']>=this[_0x1ee498+_0x223a('0x28')]){return _0x223a('0x29');}else{return _0x223a('0x2a');}}else{return _0x223a('0x2b');}};Agent[_0x223a('0x25')][_0x223a('0x24')]=function(){var _0x1e5e92=['mail','chat',_0x223a('0x2c'),_0x223a('0x2d'),_0x223a('0x2e'),_0x223a('0x2f')];for(var _0x3545e6=0x0;_0x3545e6<_0x1e5e92[_0x223a('0x30')];_0x3545e6+=0x1){var _0x42bbf5=this[_0x223a('0x26')](_0x1e5e92[_0x3545e6]);if(this[_0x1e5e92[_0x3545e6]+_0x223a('0x31')]!==_0x42bbf5){this[_0x1e5e92[_0x3545e6]+_0x223a('0x32')]=_['toNumber'](moment()[_0x223a('0x33')]('x'));}this[_0x1e5e92[_0x3545e6]+_0x223a('0x31')]=_0x42bbf5;}var _0x140114={'id':this['id'],'name':this[_0x223a('0x6')],'online':this[_0x223a('0x7')],'voicePause':this[_0x223a('0x8')],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this[_0x223a('0xb')],'faxPause':this[_0x223a('0xa')],'openchannelPause':this[_0x223a('0xc')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x223a('0x34')],'chatCapacity':this[_0x223a('0xf')],'chatCurrentCapacity':this[_0x223a('0x10')],'mailStatus':this[_0x223a('0x11')],'mailStatusTime':this[_0x223a('0x35')],'mailCapacity':this[_0x223a('0x12')],'mailCurrentCapacity':this[_0x223a('0x13')],'faxStatus':this[_0x223a('0x14')],'faxStatusTime':this[_0x223a('0x15')],'faxCapacity':this[_0x223a('0x16')],'faxCurrentCapacity':this[_0x223a('0x17')],'smsStatus':this[_0x223a('0x18')],'smsStatusTime':this[_0x223a('0x19')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x223a('0x1b')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x223a('0x1d')],'whatsappCapacity':this[_0x223a('0x1e')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x223a('0x36')],'openchannelStatusTime':this[_0x223a('0x37')],'openchannelCapacity':this[_0x223a('0x20')],'openchannelCurrentCapacity':this[_0x223a('0x21')],'busy':this[_0x223a('0x22')],'busyQueue':this[_0x223a('0x23')]};var _0x3b6291=md5(JSON['stringify'](_0x140114));if(this['md5']!==_0x3b6291){this[_0x223a('0x1')]=_0x3b6291;io[_0x223a('0x38')](_0x223a('0x39'),_0x140114);}};module[_0x223a('0x3a')]=Agent; \ No newline at end of file +var _0x9e42=['chat','openchannel','fax','length','StatusTime','toNumber','format','Status','mailStatus','faxStatusTime','busyQueue','user:save','exports','moment','../../../config/environment','redis','defaults','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','md5','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','idle','mail'];(function(_0x3d5ce6,_0x409414){var _0x29d70c=function(_0x17156c){while(--_0x17156c){_0x3d5ce6['push'](_0x3d5ce6['shift']());}};_0x29d70c(++_0x409414);}(_0x9e42,0x169));var _0x29e4=function(_0x316c42,_0x3391f0){_0x316c42=_0x316c42-0x0;var _0x2b38f7=_0x9e42[_0x316c42];return _0x2b38f7;};'use strict';var _=require('lodash');var moment=require(_0x29e4('0x0'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x29e4('0x1'));config[_0x29e4('0x2')]=_[_0x29e4('0x3')](config['redis'],{'host':_0x29e4('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x353c89){this['id']=_0x353c89['id']||0x0;this[_0x29e4('0x5')]=_0x353c89[_0x29e4('0x5')]||'';this[_0x29e4('0x6')]=_0x353c89[_0x29e4('0x6')]||!![];this[_0x29e4('0x7')]=_0x353c89[_0x29e4('0x7')]||![];this[_0x29e4('0x8')]=_0x353c89[_0x29e4('0x8')]||![];this[_0x29e4('0x9')]=_0x353c89[_0x29e4('0x9')]||![];this[_0x29e4('0xa')]=_0x353c89[_0x29e4('0xa')]||![];this[_0x29e4('0xb')]=_0x353c89['smsPause']||![];this['openchannelPause']=_0x353c89[_0x29e4('0xc')]||![];this[_0x29e4('0xd')]=_0x29e4('0xe');this[_0x29e4('0xf')]=0x0;this[_0x29e4('0x10')]=_0x353c89[_0x29e4('0x10')]||0x0;this[_0x29e4('0x11')]=0x0;this['mailStatus']=_0x29e4('0xe');this[_0x29e4('0x12')]=0x0;this[_0x29e4('0x13')]=_0x353c89['mailCapacity']||0x0;this[_0x29e4('0x14')]=0x0;this['faxStatus']=_0x29e4('0xe');this['faxStatusTime']=0x0;this[_0x29e4('0x15')]=_0x353c89[_0x29e4('0x15')]||0x0;this[_0x29e4('0x16')]=0x0;this[_0x29e4('0x17')]=_0x29e4('0xe');this[_0x29e4('0x18')]=0x0;this[_0x29e4('0x19')]=_0x353c89[_0x29e4('0x19')]||0x0;this[_0x29e4('0x1a')]=0x0;this[_0x29e4('0x1b')]='unknown';this[_0x29e4('0x1c')]=0x0;this['whatsappCapacity']=_0x353c89[_0x29e4('0x1d')]||0x0;this[_0x29e4('0x1e')]=0x0;this[_0x29e4('0x1f')]='unknown';this[_0x29e4('0x20')]=0x0;this[_0x29e4('0x21')]=_0x353c89['openchannelCapacity']||0x0;this[_0x29e4('0x22')]=0x0;this[_0x29e4('0x23')]=![];this['busyQueue']=undefined;this[_0x29e4('0x24')]='';this[_0x29e4('0x25')]();}Agent[_0x29e4('0x26')][_0x29e4('0x27')]=function(_0x41dc87){if(this[_0x41dc87+_0x29e4('0x28')]>0x0){if(this[_0x41dc87+_0x29e4('0x29')]>0x0&&this[_0x41dc87+_0x29e4('0x28')]>=this[_0x41dc87+_0x29e4('0x29')]){return _0x29e4('0x2a');}else{return'working';}}else{return _0x29e4('0x2b');}};Agent[_0x29e4('0x26')]['updateRealtime']=function(){var _0x37f9fe=[_0x29e4('0x2c'),_0x29e4('0x2d'),_0x29e4('0x2e'),_0x29e4('0x2f'),'sms','whatsapp'];for(var _0x2370c8=0x0;_0x2370c8<_0x37f9fe[_0x29e4('0x30')];_0x2370c8+=0x1){var _0x15eeb9=this['getChannelStatus'](_0x37f9fe[_0x2370c8]);if(this[_0x37f9fe[_0x2370c8]+'Status']!==_0x15eeb9){this[_0x37f9fe[_0x2370c8]+_0x29e4('0x31')]=_[_0x29e4('0x32')](moment()[_0x29e4('0x33')]('x'));}this[_0x37f9fe[_0x2370c8]+_0x29e4('0x34')]=_0x15eeb9;}var _0x24e5e9={'id':this['id'],'name':this['name'],'online':this[_0x29e4('0x6')],'voicePause':this[_0x29e4('0x7')],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this[_0x29e4('0xb')],'faxPause':this[_0x29e4('0xa')],'openchannelPause':this[_0x29e4('0xc')],'chatStatus':this[_0x29e4('0xd')],'chatStatusTime':this[_0x29e4('0xf')],'chatCapacity':this[_0x29e4('0x10')],'chatCurrentCapacity':this[_0x29e4('0x11')],'mailStatus':this[_0x29e4('0x35')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x29e4('0x13')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x29e4('0x36')],'faxCapacity':this[_0x29e4('0x15')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x29e4('0x17')],'smsStatusTime':this[_0x29e4('0x18')],'smsCapacity':this[_0x29e4('0x19')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x29e4('0x1b')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x29e4('0x1d')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x29e4('0x1f')],'openchannelStatusTime':this[_0x29e4('0x20')],'openchannelCapacity':this[_0x29e4('0x21')],'openchannelCurrentCapacity':this[_0x29e4('0x22')],'busy':this['busy'],'busyQueue':this[_0x29e4('0x37')]};var _0x2718cc=md5(JSON['stringify'](_0x24e5e9));if(this['md5']!==_0x2718cc){this[_0x29e4('0x24')]=_0x2718cc;io['emit'](_0x29e4('0x38'),_0x24e5e9);}};module[_0x29e4('0x39')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index fae4e0f..f0f02a1 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 _0x9ff2=['exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr','map','paused','length','online','chatPause','available','loggedIn','format','chat:queue:%s','chat_queue:save'];(function(_0x6e07d2,_0x21d2df){var _0x4b6bb2=function(_0x51eb0c){while(--_0x51eb0c){_0x6e07d2['push'](_0x6e07d2['shift']());}};_0x4b6bb2(++_0x21d2df);}(_0x9ff2,0x10f));var _0x29ff=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9ff2[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x29ff('0x0'));var md5=require(_0x29ff('0x1'));var util=require(_0x29ff('0x2'));var Redis=require(_0x29ff('0x3'));var config=require(_0x29ff('0x4'));config['redis']=_[_0x29ff('0x5')](config[_0x29ff('0x6')],{'host':_0x29ff('0x7'),'port':0x18eb});var io=require(_0x29ff('0x8'))(new Redis(config[_0x29ff('0x6')]));function ChatQueue(_0x3517c9){this['id']=_0x3517c9['id']||0x0;this[_0x29ff('0x9')]=_0x3517c9[_0x29ff('0x9')]||'';this[_0x29ff('0xa')]=_0x3517c9[_0x29ff('0xa')]||0xa;this[_0x29ff('0xb')]=_0x3517c9[_0x29ff('0xb')]||_0x29ff('0xc');this[_0x29ff('0xd')]=_0x3517c9[_0x29ff('0xd')];this[_0x29ff('0xe')]={};this[_0x29ff('0xf')]=0x0;this[_0x29ff('0x1')]='';this['updateRouting']();this[_0x29ff('0x10')]();}ChatQueue[_0x29ff('0x11')]['updateRouting']=function(){var _0x58dc32=this['mapAgentsId'][_0x29ff('0x12')];this['mapAgentsId']=_[_0x29ff('0x13')](this[_0x29ff('0xd')],'id');this['mapAgentsId'][_0x29ff('0x12')]=_0x58dc32;};ChatQueue['prototype'][_0x29ff('0x10')]=function(){this['loggedIn']=0x0;this[_0x29ff('0x14')]=0x0;for(var _0x1af22e=0x0;_0x1af22e=0x0?this[_0x29ff('0x18')]:0x0;var _0x44ce47={'id':this['id'],'available':this[_0x29ff('0x18')],'loggedIn':this[_0x29ff('0x19')],'name':this[_0x29ff('0x9')],'paused':this[_0x29ff('0x14')],'waiting':this[_0x29ff('0xf')]};var _0x1badf7=md5(JSON['stringify'](_0x44ce47));if(this['md5']!==_0x1badf7){this[_0x29ff('0x1')]=_0x1badf7;io['to'](util[_0x29ff('0x1a')](_0x29ff('0x1b'),_0x44ce47['name']))['emit'](_0x29ff('0x1c'),_0x44ce47);}};module[_0x29ff('0x1d')]=ChatQueue; \ No newline at end of file +var _0x14af=['defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','available','chat:queue:%s','chat_queue:save','exports','md5','util','../../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x14af,0x7f));var _0xf14a=function(_0x4c894c,_0x3000dd){_0x4c894c=_0x4c894c-0x0;var _0x511671=_0x14af[_0x4c894c];return _0x511671;};'use strict';var _=require('lodash');var md5=require(_0xf14a('0x0'));var util=require(_0xf14a('0x1'));var Redis=require('ioredis');var config=require(_0xf14a('0x2'));config['redis']=_[_0xf14a('0x3')](config[_0xf14a('0x4')],{'host':_0xf14a('0x5'),'port':0x18eb});var io=require(_0xf14a('0x6'))(new Redis(config[_0xf14a('0x4')]));function ChatQueue(_0x5921a4){this['id']=_0x5921a4['id']||0x0;this['name']=_0x5921a4[_0xf14a('0x7')]||'';this['timeout']=_0x5921a4[_0xf14a('0x8')]||0xa;this['strategy']=_0x5921a4[_0xf14a('0x9')]||_0xf14a('0xa');this[_0xf14a('0xb')]=_0x5921a4[_0xf14a('0xb')];this[_0xf14a('0xc')]={};this[_0xf14a('0xd')]=0x0;this['md5']='';this[_0xf14a('0xe')]();this[_0xf14a('0xf')]();}ChatQueue[_0xf14a('0x10')]['updateRouting']=function(){var _0x26cfaa=this['mapAgentsId'][_0xf14a('0x11')];this[_0xf14a('0xc')]=_['map'](this[_0xf14a('0xb')],'id');this[_0xf14a('0xc')]['_rr']=_0x26cfaa;};ChatQueue['prototype'][_0xf14a('0xf')]=function(){this[_0xf14a('0x12')]=0x0;this[_0xf14a('0x13')]=0x0;for(var _0x2e210c=0x0;_0x2e210c=0x0?this[_0xf14a('0x16')]:0x0;var _0x544df8={'id':this['id'],'available':this['available'],'loggedIn':this[_0xf14a('0x12')],'name':this[_0xf14a('0x7')],'paused':this[_0xf14a('0x13')],'waiting':this['waiting']};var _0x4afc68=md5(JSON['stringify'](_0x544df8));if(this[_0xf14a('0x0')]!==_0x4afc68){this[_0xf14a('0x0')]=_0x4afc68;io['to'](util['format'](_0xf14a('0x17'),_0x544df8['name']))['emit'](_0xf14a('0x18'),_0x544df8);}};module[_0xf14a('0x19')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 6fa68e8..0061275 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 _0xd0a6=['ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','faxPause','available','fax:queue:%s','emit','exports','lodash','md5','util'];(function(_0x36446e,_0x2a6eca){var _0x5a64ef=function(_0xa43114){while(--_0xa43114){_0x36446e['push'](_0x36446e['shift']());}};_0x5a64ef(++_0x2a6eca);}(_0xd0a6,0x84));var _0x6d0a=function(_0x322e19,_0x44fd93){_0x322e19=_0x322e19-0x0;var _0x45d44c=_0xd0a6[_0x322e19];return _0x45d44c;};'use strict';var _=require(_0x6d0a('0x0'));var md5=require(_0x6d0a('0x1'));var util=require(_0x6d0a('0x2'));var Redis=require(_0x6d0a('0x3'));var config=require('../../../config/environment');config[_0x6d0a('0x4')]=_[_0x6d0a('0x5')](config['redis'],{'host':_0x6d0a('0x6'),'port':0x18eb});var io=require(_0x6d0a('0x7'))(new Redis(config[_0x6d0a('0x4')]));function FaxQueue(_0x3256b2){this['id']=_0x3256b2['id']||0x0;this[_0x6d0a('0x8')]=_0x3256b2[_0x6d0a('0x8')]||'';this[_0x6d0a('0x9')]=_0x3256b2[_0x6d0a('0x9')]||0xa;this[_0x6d0a('0xa')]=_0x3256b2[_0x6d0a('0xa')]||'beepall';this[_0x6d0a('0xb')]=_0x3256b2[_0x6d0a('0xb')];this[_0x6d0a('0xc')]={};this[_0x6d0a('0xd')]=0x0;this['md5']='';this[_0x6d0a('0xe')]();this[_0x6d0a('0xf')]();}FaxQueue[_0x6d0a('0x10')][_0x6d0a('0xe')]=function(){var _0x26f573=this['mapAgentsId'][_0x6d0a('0x11')];this[_0x6d0a('0xc')]=_[_0x6d0a('0x12')](this[_0x6d0a('0xb')],'id');this[_0x6d0a('0xc')][_0x6d0a('0x11')]=_0x26f573;};FaxQueue[_0x6d0a('0x10')]['updateRealtime']=function(){this[_0x6d0a('0x13')]=0x0;this[_0x6d0a('0x14')]=0x0;for(var _0x517e5c=0x0;_0x517e5c=0x0?this[_0x6d0a('0x17')]:0x0;var _0x395338={'id':this['id'],'available':this['available'],'loggedIn':this[_0x6d0a('0x13')],'name':this[_0x6d0a('0x8')],'paused':this[_0x6d0a('0x14')],'waiting':this[_0x6d0a('0xd')]};var _0x3f3560=md5(JSON['stringify'](_0x395338));if(this['md5']!==_0x3f3560){this[_0x6d0a('0x1')]=_0x3f3560;io['to'](util['format'](_0x6d0a('0x18'),_0x395338[_0x6d0a('0x8')]))[_0x6d0a('0x19')]('fax_queue:save',_0x395338);}};module[_0x6d0a('0x1a')]=FaxQueue; \ No newline at end of file +var _0x3150=['faxPause','available','format','fax:queue:%s','emit','fax_queue:save','lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','paused','length','loggedIn'];(function(_0x51fc66,_0x58499e){var _0x233bb3=function(_0x4118cc){while(--_0x4118cc){_0x51fc66['push'](_0x51fc66['shift']());}};_0x233bb3(++_0x58499e);}(_0x3150,0x92));var _0x0315=function(_0x1dc73e,_0x792805){_0x1dc73e=_0x1dc73e-0x0;var _0x35274b=_0x3150[_0x1dc73e];return _0x35274b;};'use strict';var _=require(_0x0315('0x0'));var md5=require(_0x0315('0x1'));var util=require(_0x0315('0x2'));var Redis=require(_0x0315('0x3'));var config=require('../../../config/environment');config[_0x0315('0x4')]=_[_0x0315('0x5')](config[_0x0315('0x4')],{'host':_0x0315('0x6'),'port':0x18eb});var io=require(_0x0315('0x7'))(new Redis(config['redis']));function FaxQueue(_0x526dfe){this['id']=_0x526dfe['id']||0x0;this[_0x0315('0x8')]=_0x526dfe[_0x0315('0x8')]||'';this['timeout']=_0x526dfe[_0x0315('0x9')]||0xa;this[_0x0315('0xa')]=_0x526dfe[_0x0315('0xa')]||_0x0315('0xb');this[_0x0315('0xc')]=_0x526dfe[_0x0315('0xc')];this[_0x0315('0xd')]={};this[_0x0315('0xe')]=0x0;this[_0x0315('0x1')]='';this[_0x0315('0xf')]();this[_0x0315('0x10')]();}FaxQueue['prototype']['updateRouting']=function(){var _0x12f622=this[_0x0315('0xd')][_0x0315('0x11')];this[_0x0315('0xd')]=_['map'](this[_0x0315('0xc')],'id');this[_0x0315('0xd')][_0x0315('0x11')]=_0x12f622;};FaxQueue[_0x0315('0x12')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x0315('0x13')]=0x0;for(var _0x4444a7=0x0;_0x4444a7=0x0?this[_0x0315('0x17')]:0x0;var _0x4c89c5={'id':this['id'],'available':this[_0x0315('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x0315('0x8')],'paused':this['paused'],'waiting':this[_0x0315('0xe')]};var _0x32b3bc=md5(JSON['stringify'](_0x4c89c5));if(this[_0x0315('0x1')]!==_0x32b3bc){this[_0x0315('0x1')]=_0x32b3bc;io['to'](util[_0x0315('0x18')](_0x0315('0x19'),_0x4c89c5[_0x0315('0x8')]))[_0x0315('0x1a')](_0x0315('0x1b'),_0x4c89c5);}};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 d6efc83..ec9a333 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 _0xf0c8=['name','exports'];(function(_0x454dbd,_0x3b14ee){var _0x128050=function(_0xe00b7){while(--_0xe00b7){_0x454dbd['push'](_0x454dbd['shift']());}};_0x128050(++_0x3b14ee);}(_0xf0c8,0xde));var _0x8f0c=function(_0x48ec91,_0x212edc){_0x48ec91=_0x48ec91-0x0;var _0x22766c=_0xf0c8[_0x48ec91];return _0x22766c;};'use strict';function Interval(_0x76e169){this['id']=_0x76e169['id']||0x0;this[_0x8f0c('0x0')]=_0x76e169[_0x8f0c('0x0')]||'';this['Intervals']=_0x76e169['Intervals']||{};}module[_0x8f0c('0x1')]=Interval; \ No newline at end of file +var _0xfbad=['name','Intervals'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xfbad,0x19a));var _0xdfba=function(_0x46e949,_0x1a1c7c){_0x46e949=_0x46e949-0x0;var _0x5daf61=_0xfbad[_0x46e949];return _0x5daf61;};'use strict';function Interval(_0x4d5bf2){this['id']=_0x4d5bf2['id']||0x0;this[_0xdfba('0x0')]=_0x4d5bf2[_0xdfba('0x0')]||'';this[_0xdfba('0x1')]=_0x4d5bf2[_0xdfba('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index b03fcae..2c4483f 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 _0xaf8b=['strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','paused','length','online','loggedIn','mailPause','available','waiting','stringify','format','mail:queue:%s','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout'];(function(_0x39cf70,_0x3ec55b){var _0x580424=function(_0x580a4e){while(--_0x580a4e){_0x39cf70['push'](_0x39cf70['shift']());}};_0x580424(++_0x3ec55b);}(_0xaf8b,0x162));var _0xbaf8=function(_0x24de1d,_0x5c25c7){_0x24de1d=_0x24de1d-0x0;var _0x1f6f90=_0xaf8b[_0x24de1d];return _0x1f6f90;};'use strict';var _=require(_0xbaf8('0x0'));var md5=require(_0xbaf8('0x1'));var util=require(_0xbaf8('0x2'));var Redis=require(_0xbaf8('0x3'));var config=require(_0xbaf8('0x4'));config[_0xbaf8('0x5')]=_['defaults'](config[_0xbaf8('0x5')],{'host':_0xbaf8('0x6'),'port':0x18eb});var io=require(_0xbaf8('0x7'))(new Redis(config[_0xbaf8('0x5')]));function MailQueue(_0x550f88){this['id']=_0x550f88['id']||0x0;this[_0xbaf8('0x8')]=_0x550f88[_0xbaf8('0x8')]||'';this[_0xbaf8('0x9')]=_0x550f88[_0xbaf8('0x9')]||0xa;this[_0xbaf8('0xa')]=_0x550f88[_0xbaf8('0xa')]||_0xbaf8('0xb');this['Agents']=_0x550f88[_0xbaf8('0xc')];this[_0xbaf8('0xd')]={};this['waiting']=0x0;this[_0xbaf8('0x1')]='';this[_0xbaf8('0xe')]();this[_0xbaf8('0xf')]();}MailQueue[_0xbaf8('0x10')]['updateRouting']=function(){var _0x43e903=this[_0xbaf8('0xd')][_0xbaf8('0x11')];this[_0xbaf8('0xd')]=_['map'](this[_0xbaf8('0xc')],'id');this['mapAgentsId']['_rr']=_0x43e903;};MailQueue['prototype'][_0xbaf8('0xf')]=function(){this['loggedIn']=0x0;this[_0xbaf8('0x12')]=0x0;for(var _0x40b80b=0x0;_0x40b80b=0x0?this[_0xbaf8('0x17')]:0x0;var _0x2fd5e9={'id':this['id'],'available':this[_0xbaf8('0x17')],'loggedIn':this[_0xbaf8('0x15')],'name':this[_0xbaf8('0x8')],'paused':this[_0xbaf8('0x12')],'waiting':this[_0xbaf8('0x18')]};var _0x5f305c=md5(JSON[_0xbaf8('0x19')](_0x2fd5e9));if(this[_0xbaf8('0x1')]!==_0x5f305c){this['md5']=_0x5f305c;io['to'](util[_0xbaf8('0x1a')](_0xbaf8('0x1b'),_0x2fd5e9['name']))['emit']('mail_queue:save',_0x2fd5e9);}};module['exports']=MailQueue; \ No newline at end of file +var _0xb278=['localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','online','available','stringify','format','emit','mail_queue:save','exports','md5','util','../../../config/environment','redis'];(function(_0x449746,_0x16fda7){var _0x5be1de=function(_0x49d01b){while(--_0x49d01b){_0x449746['push'](_0x449746['shift']());}};_0x5be1de(++_0x16fda7);}(_0xb278,0x168));var _0x8b27=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xb278[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var md5=require(_0x8b27('0x0'));var util=require(_0x8b27('0x1'));var Redis=require('ioredis');var config=require(_0x8b27('0x2'));config['redis']=_['defaults'](config[_0x8b27('0x3')],{'host':_0x8b27('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8b27('0x3')]));function MailQueue(_0x5011fd){this['id']=_0x5011fd['id']||0x0;this[_0x8b27('0x5')]=_0x5011fd[_0x8b27('0x5')]||'';this[_0x8b27('0x6')]=_0x5011fd[_0x8b27('0x6')]||0xa;this[_0x8b27('0x7')]=_0x5011fd['strategy']||_0x8b27('0x8');this[_0x8b27('0x9')]=_0x5011fd[_0x8b27('0x9')];this[_0x8b27('0xa')]={};this[_0x8b27('0xb')]=0x0;this['md5']='';this[_0x8b27('0xc')]();this[_0x8b27('0xd')]();}MailQueue['prototype']['updateRouting']=function(){var _0x593dd6=this[_0x8b27('0xa')][_0x8b27('0xe')];this[_0x8b27('0xa')]=_[_0x8b27('0xf')](this['Agents'],'id');this[_0x8b27('0xa')][_0x8b27('0xe')]=_0x593dd6;};MailQueue[_0x8b27('0x10')][_0x8b27('0xd')]=function(){this[_0x8b27('0x11')]=0x0;this[_0x8b27('0x12')]=0x0;for(var _0x5217ea=0x0;_0x5217ea=0x0?this['available']:0x0;var _0x143b78={'id':this['id'],'available':this['available'],'loggedIn':this[_0x8b27('0x11')],'name':this[_0x8b27('0x5')],'paused':this[_0x8b27('0x12')],'waiting':this[_0x8b27('0xb')]};var _0x5f4958=md5(JSON[_0x8b27('0x15')](_0x143b78));if(this[_0x8b27('0x0')]!==_0x5f4958){this[_0x8b27('0x0')]=_0x5f4958;io['to'](util[_0x8b27('0x16')]('mail:queue:%s',_0x143b78[_0x8b27('0x5')]))[_0x8b27('0x17')](_0x8b27('0x18'),_0x143b78);}};module[_0x8b27('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 ab77854..2299535 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 _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(_0x11ba0f,_0x33fe33){var _0x357d1c=function(_0x45cc7d){while(--_0x45cc7d){_0x11ba0f['push'](_0x11ba0f['shift']());}};_0x357d1c(++_0x33fe33);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x5fc3[_0x2d7f0e];return _0x110b07;};'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 +var _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x22313f,_0x298471){var _0x159b50=function(_0x35b024){while(--_0x35b024){_0x22313f['push'](_0x22313f['shift']());}};_0x159b50(++_0x298471);}(_0x814b,0x1a2));var _0xb814=function(_0x2986fb,_0x9482a0){_0x2986fb=_0x2986fb-0x0;var _0xb3c156=_0x814b[_0x2986fb];return _0xb3c156;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index d7487a1..99f1497 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 _0x0f9f=['prototype','loggedIn','paused','length','online','smsPause','available','waiting','stringify','emit','sms_queue:save','exports','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','map'];(function(_0x180dc8,_0x196df6){var _0x707ff7=function(_0x1a9c77){while(--_0x1a9c77){_0x180dc8['push'](_0x180dc8['shift']());}};_0x707ff7(++_0x196df6);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0x4d77b8,_0x208e64){_0x4d77b8=_0x4d77b8-0x0;var _0x82da62=_0x0f9f[_0x4d77b8];return _0x82da62;};'use strict';var _=require('lodash');var md5=require(_0xf0f9('0x0'));var util=require(_0xf0f9('0x1'));var Redis=require(_0xf0f9('0x2'));var config=require('../../../config/environment');config[_0xf0f9('0x3')]=_[_0xf0f9('0x4')](config[_0xf0f9('0x3')],{'host':_0xf0f9('0x5'),'port':0x18eb});var io=require(_0xf0f9('0x6'))(new Redis(config[_0xf0f9('0x3')]));function SmsQueue(_0x192d43){this['id']=_0x192d43['id']||0x0;this[_0xf0f9('0x7')]=_0x192d43[_0xf0f9('0x7')]||'';this[_0xf0f9('0x8')]=_0x192d43['timeout']||0xa;this[_0xf0f9('0x9')]=_0x192d43[_0xf0f9('0x9')]||'beepall';this[_0xf0f9('0xa')]=_0x192d43[_0xf0f9('0xa')];this[_0xf0f9('0xb')]={};this['waiting']=0x0;this[_0xf0f9('0x0')]='';this[_0xf0f9('0xc')]();this[_0xf0f9('0xd')]();}SmsQueue['prototype']['updateRouting']=function(){var _0xfd838b=this[_0xf0f9('0xb')][_0xf0f9('0xe')];this[_0xf0f9('0xb')]=_[_0xf0f9('0xf')](this[_0xf0f9('0xa')],'id');this[_0xf0f9('0xb')]['_rr']=_0xfd838b;};SmsQueue[_0xf0f9('0x10')][_0xf0f9('0xd')]=function(){this[_0xf0f9('0x11')]=0x0;this[_0xf0f9('0x12')]=0x0;for(var _0x524169=0x0;_0x524169=0x0?this[_0xf0f9('0x16')]:0x0;var _0x3227cf={'id':this['id'],'available':this['available'],'loggedIn':this[_0xf0f9('0x11')],'name':this['name'],'paused':this['paused'],'waiting':this[_0xf0f9('0x17')]};var _0x3d2ef8=md5(JSON[_0xf0f9('0x18')](_0x3227cf));if(this[_0xf0f9('0x0')]!==_0x3d2ef8){this[_0xf0f9('0x0')]=_0x3d2ef8;io['to'](util['format']('sms:queue:%s',_0x3227cf['name']))[_0xf0f9('0x19')](_0xf0f9('0x1a'),_0x3227cf);}};module[_0xf0f9('0x1b')]=SmsQueue; \ No newline at end of file +var _0xe2cc=['timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','smsPause','paused','available','format','sms:queue:%s','name','emit','sms_queue:save','lodash','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter'];(function(_0x2978fb,_0x562453){var _0x2b0fda=function(_0x489330){while(--_0x489330){_0x2978fb['push'](_0x2978fb['shift']());}};_0x2b0fda(++_0x562453);}(_0xe2cc,0x69));var _0xce2c=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xe2cc[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xce2c('0x0'));var md5=require(_0xce2c('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0xce2c('0x2'));config[_0xce2c('0x3')]=_[_0xce2c('0x4')](config[_0xce2c('0x3')],{'host':_0xce2c('0x5'),'port':0x18eb});var io=require(_0xce2c('0x6'))(new Redis(config[_0xce2c('0x3')]));function SmsQueue(_0x16312a){this['id']=_0x16312a['id']||0x0;this['name']=_0x16312a['name']||'';this[_0xce2c('0x7')]=_0x16312a[_0xce2c('0x7')]||0xa;this[_0xce2c('0x8')]=_0x16312a[_0xce2c('0x8')]||_0xce2c('0x9');this[_0xce2c('0xa')]=_0x16312a['Agents'];this[_0xce2c('0xb')]={};this[_0xce2c('0xc')]=0x0;this[_0xce2c('0x1')]='';this[_0xce2c('0xd')]();this[_0xce2c('0xe')]();}SmsQueue[_0xce2c('0xf')][_0xce2c('0xd')]=function(){var _0x6fc2c3=this[_0xce2c('0xb')][_0xce2c('0x10')];this[_0xce2c('0xb')]=_[_0xce2c('0x11')](this[_0xce2c('0xa')],'id');this[_0xce2c('0xb')][_0xce2c('0x10')]=_0x6fc2c3;};SmsQueue['prototype']['updateRealtime']=function(){this[_0xce2c('0x12')]=0x0;this['paused']=0x0;for(var _0x214c62=0x0;_0x214c62=0x0?this[_0xce2c('0x16')]:0x0;var _0x383085={'id':this['id'],'available':this[_0xce2c('0x16')],'loggedIn':this[_0xce2c('0x12')],'name':this['name'],'paused':this[_0xce2c('0x15')],'waiting':this[_0xce2c('0xc')]};var _0x591921=md5(JSON['stringify'](_0x383085));if(this[_0xce2c('0x1')]!==_0x591921){this[_0xce2c('0x1')]=_0x591921;io['to'](util[_0xce2c('0x17')](_0xce2c('0x18'),_0x383085[_0xce2c('0x19')]))[_0xce2c('0x1a')](_0xce2c('0x1b'),_0x383085);}};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 7033b9b..a46c419 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 _0xdbf6=['mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','paused','length','online','loggedIn','whatsappPause','available','md5','format','whatsapp:queue:%s','emit','exports','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents'];(function(_0x3ec855,_0x151ced){var _0x32f61f=function(_0x42681e){while(--_0x42681e){_0x3ec855['push'](_0x3ec855['shift']());}};_0x32f61f(++_0x151ced);}(_0xdbf6,0x1dc));var _0x6dbf=function(_0x541350,_0xcc1965){_0x541350=_0x541350-0x0;var _0x2c612c=_0xdbf6[_0x541350];return _0x2c612c;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x6dbf('0x0'));var Redis=require(_0x6dbf('0x1'));var config=require('../../../config/environment');config[_0x6dbf('0x2')]=_[_0x6dbf('0x3')](config[_0x6dbf('0x2')],{'host':_0x6dbf('0x4'),'port':0x18eb});var io=require(_0x6dbf('0x5'))(new Redis(config[_0x6dbf('0x2')]));function WhatsappQueue(_0x16d0b4){this['id']=_0x16d0b4['id']||0x0;this[_0x6dbf('0x6')]=_0x16d0b4[_0x6dbf('0x6')]||'';this[_0x6dbf('0x7')]=_0x16d0b4[_0x6dbf('0x7')]||0xa;this[_0x6dbf('0x8')]=_0x16d0b4[_0x6dbf('0x8')]||'beepall';this['Agents']=_0x16d0b4[_0x6dbf('0x9')];this[_0x6dbf('0xa')]={};this[_0x6dbf('0xb')]=0x0;this['md5']='';this[_0x6dbf('0xc')]();this[_0x6dbf('0xd')]();}WhatsappQueue['prototype'][_0x6dbf('0xc')]=function(){var _0x59cca4=this[_0x6dbf('0xa')][_0x6dbf('0xe')];this['mapAgentsId']=_['map'](this[_0x6dbf('0x9')],'id');this['mapAgentsId'][_0x6dbf('0xe')]=_0x59cca4;};WhatsappQueue[_0x6dbf('0xf')][_0x6dbf('0xd')]=function(){this['loggedIn']=0x0;this[_0x6dbf('0x10')]=0x0;for(var _0x33db97=0x0;_0x33db97=0x0?this[_0x6dbf('0x15')]:0x0;var _0x53a88a={'id':this['id'],'available':this[_0x6dbf('0x15')],'loggedIn':this[_0x6dbf('0x13')],'name':this['name'],'paused':this[_0x6dbf('0x10')],'waiting':this['waiting']};var _0x2a00b2=md5(JSON['stringify'](_0x53a88a));if(this['md5']!==_0x2a00b2){this[_0x6dbf('0x16')]=_0x2a00b2;io['to'](util[_0x6dbf('0x17')](_0x6dbf('0x18'),_0x53a88a[_0x6dbf('0x6')]))[_0x6dbf('0x19')]('whatsapp_queue:save',_0x53a88a);}};module[_0x6dbf('0x1a')]=WhatsappQueue; \ No newline at end of file +var _0xc193=['waiting','updateRouting','updateRealtime','prototype','_rr','map','Agents','loggedIn','paused','length','online','whatsappPause','available','stringify','md5','format','whatsapp:queue:%s','emit','whatsapp_queue:save','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','mapAgentsId'];(function(_0x5936e0,_0x4232b0){var _0xcfea00=function(_0x8d1128){while(--_0x8d1128){_0x5936e0['push'](_0x5936e0['shift']());}};_0xcfea00(++_0x4232b0);}(_0xc193,0x67));var _0x3c19=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc193[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require(_0x3c19('0x0'));var config=require(_0x3c19('0x1'));config[_0x3c19('0x2')]=_[_0x3c19('0x3')](config['redis'],{'host':_0x3c19('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3c19('0x2')]));function WhatsappQueue(_0x3ce522){this['id']=_0x3ce522['id']||0x0;this[_0x3c19('0x5')]=_0x3ce522[_0x3c19('0x5')]||'';this['timeout']=_0x3ce522[_0x3c19('0x6')]||0xa;this['strategy']=_0x3ce522[_0x3c19('0x7')]||'beepall';this['Agents']=_0x3ce522['Agents'];this[_0x3c19('0x8')]={};this[_0x3c19('0x9')]=0x0;this['md5']='';this[_0x3c19('0xa')]();this[_0x3c19('0xb')]();}WhatsappQueue[_0x3c19('0xc')][_0x3c19('0xa')]=function(){var _0x96cedf=this[_0x3c19('0x8')][_0x3c19('0xd')];this[_0x3c19('0x8')]=_[_0x3c19('0xe')](this[_0x3c19('0xf')],'id');this[_0x3c19('0x8')]['_rr']=_0x96cedf;};WhatsappQueue[_0x3c19('0xc')][_0x3c19('0xb')]=function(){this[_0x3c19('0x10')]=0x0;this[_0x3c19('0x11')]=0x0;for(var _0x4dfd77=0x0;_0x4dfd77=0x0?this['available']:0x0;var _0x1d0a06={'id':this['id'],'available':this[_0x3c19('0x15')],'loggedIn':this[_0x3c19('0x10')],'name':this[_0x3c19('0x5')],'paused':this[_0x3c19('0x11')],'waiting':this[_0x3c19('0x9')]};var _0x3438d9=md5(JSON[_0x3c19('0x16')](_0x1d0a06));if(this[_0x3c19('0x17')]!==_0x3438d9){this[_0x3c19('0x17')]=_0x3438d9;io['to'](util[_0x3c19('0x18')](_0x3c19('0x19'),_0x1d0a06[_0x3c19('0x5')]))[_0x3c19('0x1a')](_0x3c19('0x1b'),_0x1d0a06);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index ba749f9..5957075 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x24aac3,_0x45e240){var _0x50ca1f=function(_0x3e1ed5){while(--_0x3e1ed5){_0x24aac3['push'](_0x24aac3['shift']());}};_0x50ca1f(++_0x45e240);}(_0xb10b,0x12a));var _0xbb10=function(_0x533990,_0x21fe8d){_0x533990=_0x533990-0x0;var _0x5a5e2a=_0xb10b[_0x533990];return _0x5a5e2a;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 5364f7f..cd9fc87 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 _0xda03=['addTags','update','Request','UpdateChatInteraction'];(function(_0x79dd57,_0x94685a){var _0x236803=function(_0x43040b){while(--_0x43040b){_0x79dd57['push'](_0x79dd57['shift']());}};_0x236803(++_0x94685a);}(_0xda03,0x16d));var _0x3da0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xda03[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x3da0('0x0')]=function(_0x40064f,_0x2c4e0e){return client[_0x3da0('0x1')](_0x3da0('0x2'),{'body':_0x2c4e0e,'options':{'where':{'id':_0x40064f}},'log':'updateChatInteraction'});};exports[_0x3da0('0x3')]=function(_0x459867,_0x39becd){return client[_0x3da0('0x1')]('AddTagsToChatInteraction',{'body':_0x39becd,'options':{'where':{'id':_0x459867}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x82c0=['update','Request','UpdateChatInteraction','AddTagsToChatInteraction','../client'];(function(_0x5ccb02,_0x3588fb){var _0x52a833=function(_0x1b61d5){while(--_0x1b61d5){_0x5ccb02['push'](_0x5ccb02['shift']());}};_0x52a833(++_0x3588fb);}(_0x82c0,0x9f));var _0x082c=function(_0x5434c3,_0xb540d4){_0x5434c3=_0x5434c3-0x0;var _0x2c9977=_0x82c0[_0x5434c3];return _0x2c9977;};'use strict';var client=require(_0x082c('0x0'));exports[_0x082c('0x1')]=function(_0x3248d4,_0x3a6cda){return client[_0x082c('0x2')](_0x082c('0x3'),{'body':_0x3a6cda,'options':{'where':{'id':_0x3248d4}},'log':'updateChatInteraction'});};exports['addTags']=function(_0x4bb462,_0x5198e6){return client[_0x082c('0x2')](_0x082c('0x4'),{'body':_0x5198e6,'options':{'where':{'id':_0x4bb462}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 5313cb7..25acdb4 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 _0x99d6=['Request','createChatMessage','create'];(function(_0x3fa37f,_0x397f16){var _0x5a01d5=function(_0xa23c65){while(--_0xa23c65){_0x3fa37f['push'](_0x3fa37f['shift']());}};_0x5a01d5(++_0x397f16);}(_0x99d6,0xf5));var _0x699d=function(_0x34bd34,_0x1444f7){_0x34bd34=_0x34bd34-0x0;var _0x4e36d6=_0x99d6[_0x34bd34];return _0x4e36d6;};'use strict';var client=require('../client');exports[_0x699d('0x0')]=function(_0x550a60){return client[_0x699d('0x1')]('CreateChatMessage',{'body':_0x550a60,'log':_0x699d('0x2')});}; \ No newline at end of file +var _0x4fa4=['createChatMessage','../client','create','CreateChatMessage'];(function(_0x466419,_0x14ddff){var _0x3c7993=function(_0x58bdf1){while(--_0x58bdf1){_0x466419['push'](_0x466419['shift']());}};_0x3c7993(++_0x14ddff);}(_0x4fa4,0x1a5));var _0x44fa=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x4fa4[_0x1928c9];return _0x51b5fb;};'use strict';var client=require(_0x44fa('0x0'));exports[_0x44fa('0x1')]=function(_0x5590b7){return client['Request'](_0x44fa('0x2'),{'body':_0x5590b7,'log':_0x44fa('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 0cef4ca..b02515d 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 _0x5b5a=['timeout','strategy','User','Agents','online','chatPause','getChatQueues','Request','name'];(function(_0xb48638,_0x53a18c){var _0x7af920=function(_0x17e401){while(--_0x17e401){_0xb48638['push'](_0xb48638['shift']());}};_0x7af920(++_0x53a18c);}(_0x5b5a,0xc3));var _0xa5b5=function(_0x27bd9b,_0x206238){_0x27bd9b=_0x27bd9b-0x0;var _0xbd6219=_0x5b5a[_0x27bd9b];return _0xbd6219;};'use strict';var client=require('../client');exports[_0xa5b5('0x0')]=function(){return function(){return client[_0xa5b5('0x1')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0xa5b5('0x2'),_0xa5b5('0x3'),_0xa5b5('0x4')],'include':[{'model':_0xa5b5('0x5'),'as':_0xa5b5('0x6'),'attributes':['id',_0xa5b5('0x2'),_0xa5b5('0x7'),_0xa5b5('0x8')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0x536e=['../client','getChatQueues','Request','GetChatQueue','name','timeout','strategy','User','Agents','online','chatPause'];(function(_0x30b092,_0x563933){var _0x1fc775=function(_0x200d17){while(--_0x200d17){_0x30b092['push'](_0x30b092['shift']());}};_0x1fc775(++_0x563933);}(_0x536e,0x155));var _0xe536=function(_0x5e0664,_0x4307dc){_0x5e0664=_0x5e0664-0x0;var _0x51ed02=_0x536e[_0x5e0664];return _0x51ed02;};'use strict';var client=require(_0xe536('0x0'));exports[_0xe536('0x1')]=function(){return function(){return client[_0xe536('0x2')](_0xe536('0x3'),{'options':{'raw':![],'attributes':['id',_0xe536('0x4'),_0xe536('0x5'),_0xe536('0x6')],'include':[{'model':_0xe536('0x7'),'as':_0xe536('0x8'),'attributes':['id',_0xe536('0x4'),_0xe536('0x9'),_0xe536('0xa')]}]},'log':_0xe536('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index fd57b10..4e21837 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 _0x7f42=['DESC','../client','Request','CreateChatQueueReport'];(function(_0x37891c,_0x1b8330){var _0x2756b7=function(_0x257d3c){while(--_0x257d3c){_0x37891c['push'](_0x37891c['shift']());}};_0x2756b7(++_0x1b8330);}(_0x7f42,0x1dd));var _0x27f4=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x7f42[_0x46e363];return _0x3fb059;};'use strict';var client=require(_0x27f4('0x0'));exports['create']=function(_0x26ace2){return client[_0x27f4('0x1')]('CreateChatQueueReport',{'body':_0x26ace2,'log':_0x27f4('0x2')});};exports['update']=function(_0x10627e,_0x4e1ac1){return client[_0x27f4('0x1')]('UpdateChatQueueReport',{'body':_0x4e1ac1,'options':{'where':{'uniqueid':_0x10627e},'order':[['id',_0x27f4('0x3')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x843b=['DESC','../client','create','CreateChatQueueReport','update','Request','UpdateChatQueueReport'];(function(_0xf34109,_0x380779){var _0x570bfc=function(_0x1ad086){while(--_0x1ad086){_0xf34109['push'](_0xf34109['shift']());}};_0x570bfc(++_0x380779);}(_0x843b,0xc5));var _0xb843=function(_0x36f7f3,_0x5e33e6){_0x36f7f3=_0x36f7f3-0x0;var _0x5bb772=_0x843b[_0x36f7f3];return _0x5bb772;};'use strict';var client=require(_0xb843('0x0'));exports[_0xb843('0x1')]=function(_0x46e6d6){return client['Request'](_0xb843('0x2'),{'body':_0x46e6d6,'log':_0xb843('0x2')});};exports[_0xb843('0x3')]=function(_0x2b915c,_0x2954c4){return client[_0xb843('0x4')](_0xb843('0x5'),{'body':_0x2954c4,'options':{'where':{'uniqueid':_0x2b915c},'order':[['id',_0xb843('0x6')]],'limit':0x1},'log':_0xb843('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index fc67630..3fe9a88 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x188926,_0x1b2429){var _0x17f4bf=function(_0x462e22){while(--_0x462e22){_0x188926['push'](_0x188926['shift']());}};_0x17f4bf(++_0x1b2429);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x7a54,0x106));var _0x47a5=function(_0x3f5f94,_0x2e5ea0){_0x3f5f94=_0x3f5f94-0x0;var _0x3fd6bd=_0x7a54[_0x3f5f94];return _0x3fd6bd;};'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 diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index a975326..b6d8107 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 _0x3c6b=['CreateFaxMessage','createFaxMessage','create','Request'];(function(_0x1328ea,_0x2dec70){var _0x59b2f5=function(_0x3ecff9){while(--_0x3ecff9){_0x1328ea['push'](_0x1328ea['shift']());}};_0x59b2f5(++_0x2dec70);}(_0x3c6b,0x1ca));var _0xb3c6=function(_0x95c90f,_0x408844){_0x95c90f=_0x95c90f-0x0;var _0x1cc234=_0x3c6b[_0x95c90f];return _0x1cc234;};'use strict';var client=require('../client');exports[_0xb3c6('0x0')]=function(_0x197d21){return client[_0xb3c6('0x1')](_0xb3c6('0x2'),{'body':_0x197d21,'log':_0xb3c6('0x3')});}; \ No newline at end of file +var _0xd6a3=['createFaxMessage','../client','create'];(function(_0x422a3e,_0xd2a7ea){var _0x57c587=function(_0x429b52){while(--_0x429b52){_0x422a3e['push'](_0x422a3e['shift']());}};_0x57c587(++_0xd2a7ea);}(_0xd6a3,0x82));var _0x3d6a=function(_0x221cf3,_0x50c261){_0x221cf3=_0x221cf3-0x0;var _0x45ab9b=_0xd6a3[_0x221cf3];return _0x45ab9b;};'use strict';var client=require(_0x3d6a('0x0'));exports[_0x3d6a('0x1')]=function(_0x40f7f9){return client['Request']('CreateFaxMessage',{'body':_0x40f7f9,'log':_0x3d6a('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index f99e2cc..e3351f2 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 _0xf2e3=['User','Agents','online','getFaxQueues','../client','Request','GetFaxQueue','name','strategy'];(function(_0x12d75f,_0x363cc9){var _0x26b291=function(_0x218053){while(--_0x218053){_0x12d75f['push'](_0x12d75f['shift']());}};_0x26b291(++_0x363cc9);}(_0xf2e3,0x151));var _0x3f2e=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0xf2e3[_0x47fd36];return _0x21a0fc;};'use strict';var client=require(_0x3f2e('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x3f2e('0x1')](_0x3f2e('0x2'),{'options':{'raw':![],'attributes':['id',_0x3f2e('0x3'),'timeout',_0x3f2e('0x4')],'include':[{'model':_0x3f2e('0x5'),'as':_0x3f2e('0x6'),'attributes':['id',_0x3f2e('0x3'),_0x3f2e('0x7'),'faxPause']}]},'log':_0x3f2e('0x8')});};}; \ No newline at end of file +var _0xc997=['strategy','User','Agents','online','faxPause','../client','Request','GetFaxQueue','name'];(function(_0x480ab2,_0x20b3a7){var _0x35c362=function(_0xddf9ac){while(--_0xddf9ac){_0x480ab2['push'](_0x480ab2['shift']());}};_0x35c362(++_0x20b3a7);}(_0xc997,0x19a));var _0x7c99=function(_0x4c012c,_0x1fa814){_0x4c012c=_0x4c012c-0x0;var _0x3e7c22=_0xc997[_0x4c012c];return _0x3e7c22;};'use strict';var client=require(_0x7c99('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x7c99('0x1')](_0x7c99('0x2'),{'options':{'raw':![],'attributes':['id',_0x7c99('0x3'),'timeout',_0x7c99('0x4')],'include':[{'model':_0x7c99('0x5'),'as':_0x7c99('0x6'),'attributes':['id',_0x7c99('0x3'),_0x7c99('0x7'),_0x7c99('0x8')]}]},'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 4382667..43bec10 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 _0xb65d=['DESC','../client','create','Request','UpdateFaxQueueReport'];(function(_0x8a21,_0x456270){var _0x4d164c=function(_0x2d6abf){while(--_0x2d6abf){_0x8a21['push'](_0x8a21['shift']());}};_0x4d164c(++_0x456270);}(_0xb65d,0x169));var _0xdb65=function(_0x46f45f,_0x80376d){_0x46f45f=_0x46f45f-0x0;var _0x505e84=_0xb65d[_0x46f45f];return _0x505e84;};'use strict';var client=require(_0xdb65('0x0'));exports[_0xdb65('0x1')]=function(_0x1414a0){return client[_0xdb65('0x2')]('CreateFaxQueueReport',{'body':_0x1414a0,'log':'CreateFaxQueueReport'});};exports['update']=function(_0x1b810d,_0x35bdd0){return client[_0xdb65('0x2')](_0xdb65('0x3'),{'body':_0x35bdd0,'options':{'where':{'uniqueid':_0x1b810d},'order':[['id',_0xdb65('0x4')]],'limit':0x1},'log':_0xdb65('0x3')});}; \ No newline at end of file +var _0x5658=['CreateFaxQueueReport','update','UpdateFaxQueueReport','../client','create','Request'];(function(_0x2a8c21,_0x163576){var _0x5f3061=function(_0x4dc8eb){while(--_0x4dc8eb){_0x2a8c21['push'](_0x2a8c21['shift']());}};_0x5f3061(++_0x163576);}(_0x5658,0x1d7));var _0x8565=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x5658[_0x4565bf];return _0x5610ba;};'use strict';var client=require(_0x8565('0x0'));exports[_0x8565('0x1')]=function(_0x5dedb1){return client[_0x8565('0x2')](_0x8565('0x3'),{'body':_0x5dedb1,'log':_0x8565('0x3')});};exports[_0x8565('0x4')]=function(_0x1420cf,_0x79a57a){return client[_0x8565('0x2')](_0x8565('0x5'),{'body':_0x79a57a,'options':{'where':{'uniqueid':_0x1420cf},'order':[['id','DESC']],'limit':0x1},'log':_0x8565('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index a2f1daf..634f76c 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 _0x820f=['getIntervals','Request','GetInterval','name','Interval','Intervals','interval','../client'];(function(_0x3255a1,_0x3afe71){var _0x16fca2=function(_0x2661a8){while(--_0x2661a8){_0x3255a1['push'](_0x3255a1['shift']());}};_0x16fca2(++_0x3afe71);}(_0x820f,0xb7));var _0xf820=function(_0x11ab36,_0x21ef36){_0x11ab36=_0x11ab36-0x0;var _0x16eb60=_0x820f[_0x11ab36];return _0x16eb60;};'use strict';var client=require(_0xf820('0x0'));exports[_0xf820('0x1')]=function(){return function(){return client[_0xf820('0x2')](_0xf820('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xf820('0x4')],'include':[{'model':_0xf820('0x5'),'as':_0xf820('0x6'),'attributes':['id',_0xf820('0x4'),_0xf820('0x7')]}]},'log':_0xf820('0x1')});};}; \ No newline at end of file +var _0x2f7e=['Intervals','../client','getIntervals','Request','GetInterval','name','Interval'];(function(_0x14b758,_0x4ee22b){var _0x6841b4=function(_0x56f0ad){while(--_0x56f0ad){_0x14b758['push'](_0x14b758['shift']());}};_0x6841b4(++_0x4ee22b);}(_0x2f7e,0x104));var _0xe2f7=function(_0x1f8bcb,_0x955654){_0x1f8bcb=_0x1f8bcb-0x0;var _0x532b2c=_0x2f7e[_0x1f8bcb];return _0x532b2c;};'use strict';var client=require(_0xe2f7('0x0'));exports[_0xe2f7('0x1')]=function(){return function(){return client[_0xe2f7('0x2')](_0xe2f7('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xe2f7('0x4')],'include':[{'model':_0xe2f7('0x5'),'as':_0xe2f7('0x6'),'attributes':['id',_0xe2f7('0x4'),'interval']}]},'log':_0xe2f7('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 51fa0b1..7b5dad4 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 _0xb03e=['addTagsToChatInteraction','update','Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction'];(function(_0x21fb5d,_0x42c997){var _0x8ba2cb=function(_0x507b8d){while(--_0x507b8d){_0x21fb5d['push'](_0x21fb5d['shift']());}};_0x8ba2cb(++_0x42c997);}(_0xb03e,0x1eb));var _0xeb03=function(_0x54822a,_0x3985d4){_0x54822a=_0x54822a-0x0;var _0x54068e=_0xb03e[_0x54822a];return _0x54068e;};'use strict';var client=require('../client');exports[_0xeb03('0x0')]=function(_0x399504,_0x868905){return client[_0xeb03('0x1')](_0xeb03('0x2'),{'body':_0x868905,'options':{'where':{'id':_0x399504}},'log':_0xeb03('0x3')});};exports[_0xeb03('0x4')]=function(_0x1fe650,_0x474450){return client[_0xeb03('0x1')](_0xeb03('0x5'),{'body':_0x474450,'options':{'where':{'id':_0x1fe650}},'log':_0xeb03('0x6')});}; \ No newline at end of file +var _0x2ef3=['../client','update','Request','UpdateMailInteraction','addTags','AddTagsToMailInteraction'];(function(_0xf44d98,_0x12a472){var _0x5ebb04=function(_0x930c33){while(--_0x930c33){_0xf44d98['push'](_0xf44d98['shift']());}};_0x5ebb04(++_0x12a472);}(_0x2ef3,0xba));var _0x32ef=function(_0x24aec3,_0x124a24){_0x24aec3=_0x24aec3-0x0;var _0x181ee5=_0x2ef3[_0x24aec3];return _0x181ee5;};'use strict';var client=require(_0x32ef('0x0'));exports[_0x32ef('0x1')]=function(_0x47513a,_0x26e56e){return client[_0x32ef('0x2')](_0x32ef('0x3'),{'body':_0x26e56e,'options':{'where':{'id':_0x47513a}},'log':'updateMailInteraction'});};exports[_0x32ef('0x4')]=function(_0x38b7f3,_0x524ab6){return client[_0x32ef('0x2')](_0x32ef('0x5'),{'body':_0x524ab6,'options':{'where':{'id':_0x38b7f3}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 74793f7..c24de45 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 _0xd41c=['Request','createMailMessage','../client','create'];(function(_0x497a09,_0x31e305){var _0x5e03b0=function(_0x5c5db3){while(--_0x5c5db3){_0x497a09['push'](_0x497a09['shift']());}};_0x5e03b0(++_0x31e305);}(_0xd41c,0x1b2));var _0xcd41=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd41c[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xcd41('0x0'));exports[_0xcd41('0x1')]=function(_0x159f4d){return client[_0xcd41('0x2')]('CreateMailMessage',{'body':_0x159f4d,'log':_0xcd41('0x3')});}; \ No newline at end of file +var _0x7f64=['Request','createMailMessage','../client','create'];(function(_0x415c6b,_0x1dba1a){var _0x4b01fb=function(_0x68a9f3){while(--_0x68a9f3){_0x415c6b['push'](_0x415c6b['shift']());}};_0x4b01fb(++_0x1dba1a);}(_0x7f64,0x1de));var _0x47f6=function(_0x3eec42,_0x192ed2){_0x3eec42=_0x3eec42-0x0;var _0x110bf0=_0x7f64[_0x3eec42];return _0x110bf0;};'use strict';var client=require(_0x47f6('0x0'));exports[_0x47f6('0x1')]=function(_0x1cfd9b){return client[_0x47f6('0x2')]('CreateMailMessage',{'body':_0x1cfd9b,'log':_0x47f6('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 95634b1..7a369f3 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 _0xcb03=['GetMailQueue','User','name','mailPause','getMailQueues'];(function(_0xd27ded,_0x1164e2){var _0x5ef850=function(_0x582e7d){while(--_0x582e7d){_0xd27ded['push'](_0xd27ded['shift']());}};_0x5ef850(++_0x1164e2);}(_0xcb03,0x19f));var _0x3cb0=function(_0x51e485,_0x56005a){_0x51e485=_0x51e485-0x0;var _0x8b5d4e=_0xcb03[_0x51e485];return _0x8b5d4e;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client['Request'](_0x3cb0('0x0'),{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':_0x3cb0('0x1'),'as':'Agents','attributes':['id',_0x3cb0('0x2'),'online',_0x3cb0('0x3')]}]},'log':_0x3cb0('0x4')});};}; \ No newline at end of file +var _0xc0b5=['../client','getMailQueues','GetMailQueue','timeout','strategy','User','Agents','name','online','mailPause'];(function(_0x552115,_0x3b83ad){var _0x8c6e20=function(_0x2a2b80){while(--_0x2a2b80){_0x552115['push'](_0x552115['shift']());}};_0x8c6e20(++_0x3b83ad);}(_0xc0b5,0xdc));var _0x5c0b=function(_0x592e3f,_0x4d26a7){_0x592e3f=_0x592e3f-0x0;var _0x169f7b=_0xc0b5[_0x592e3f];return _0x169f7b;};'use strict';var client=require(_0x5c0b('0x0'));exports[_0x5c0b('0x1')]=function(){return function(){return client['Request'](_0x5c0b('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x5c0b('0x3'),_0x5c0b('0x4')],'include':[{'model':_0x5c0b('0x5'),'as':_0x5c0b('0x6'),'attributes':['id',_0x5c0b('0x7'),_0x5c0b('0x8'),_0x5c0b('0x9')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 952750c..759d19a 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 _0xf64c=['update','UpdateMailQueueReport','../client','create','Request','CreateMailQueueReport'];(function(_0x183f62,_0xca484e){var _0x253d12=function(_0x127bca){while(--_0x127bca){_0x183f62['push'](_0x183f62['shift']());}};_0x253d12(++_0xca484e);}(_0xf64c,0x182));var _0xcf64=function(_0x48443e,_0x73e2){_0x48443e=_0x48443e-0x0;var _0x338941=_0xf64c[_0x48443e];return _0x338941;};'use strict';var client=require(_0xcf64('0x0'));exports[_0xcf64('0x1')]=function(_0x2c156f){return client[_0xcf64('0x2')](_0xcf64('0x3'),{'body':_0x2c156f,'log':'CreateMailQueueReport'});};exports[_0xcf64('0x4')]=function(_0x1f54ae,_0x13feca){return client[_0xcf64('0x2')]('UpdateMailQueueReport',{'body':_0x13feca,'options':{'where':{'uniqueid':_0x1f54ae},'order':[['id','DESC']],'limit':0x1},'log':_0xcf64('0x5')});}; \ No newline at end of file +var _0xeb5a=['CreateMailQueueReport','update','Request','UpdateMailQueueReport','DESC','../client','create'];(function(_0x4d740a,_0x15ac78){var _0x207e46=function(_0x2f5bd3){while(--_0x2f5bd3){_0x4d740a['push'](_0x4d740a['shift']());}};_0x207e46(++_0x15ac78);}(_0xeb5a,0x9f));var _0xaeb5=function(_0x37f763,_0x1cb388){_0x37f763=_0x37f763-0x0;var _0x3bedd2=_0xeb5a[_0x37f763];return _0x3bedd2;};'use strict';var client=require(_0xaeb5('0x0'));exports[_0xaeb5('0x1')]=function(_0x3588a3){return client['Request'](_0xaeb5('0x2'),{'body':_0x3588a3,'log':_0xaeb5('0x2')});};exports[_0xaeb5('0x3')]=function(_0x25a5af,_0x4f3e90){return client[_0xaeb5('0x4')](_0xaeb5('0x5'),{'body':_0x4f3e90,'options':{'where':{'uniqueid':_0x25a5af},'order':[['id',_0xaeb5('0x6')]],'limit':0x1},'log':_0xaeb5('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 1747185..6e7a2c6 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 _0x8689=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request'];(function(_0x2154ba,_0x18455d){var _0x59f3f5=function(_0x2ee68d){while(--_0x2ee68d){_0x2154ba['push'](_0x2154ba['shift']());}};_0x59f3f5(++_0x18455d);}(_0x8689,0x80));var _0x9868=function(_0x3738ef,_0x4671a3){_0x3738ef=_0x3738ef-0x0;var _0x14a447=_0x8689[_0x3738ef];return _0x14a447;};'use strict';var client=require(_0x9868('0x0'));exports['update']=function(_0x45ca98,_0x422875){return client['Request'](_0x9868('0x1'),{'body':_0x422875,'options':{'where':{'id':_0x45ca98}},'log':_0x9868('0x2')});};exports[_0x9868('0x3')]=function(_0x2c6a32,_0x1f99c3){return client[_0x9868('0x4')](_0x9868('0x5'),{'body':_0x1f99c3,'options':{'where':{'id':_0x2c6a32}},'log':_0x9868('0x6')});}; \ No newline at end of file +var _0x72bb=['Request','UpdateOpenchannelInteraction','addTags'];(function(_0x7e7538,_0x5a4f1f){var _0xf2c7e8=function(_0x5d3a50){while(--_0x5d3a50){_0x7e7538['push'](_0x7e7538['shift']());}};_0xf2c7e8(++_0x5a4f1f);}(_0x72bb,0xae));var _0xb72b=function(_0x56a871,_0x18b7fe){_0x56a871=_0x56a871-0x0;var _0x124954=_0x72bb[_0x56a871];return _0x124954;};'use strict';var client=require('../client');exports['update']=function(_0x4fc392,_0x592284){return client[_0xb72b('0x0')](_0xb72b('0x1'),{'body':_0x592284,'options':{'where':{'id':_0x4fc392}},'log':'updateOpenchannelInteraction'});};exports[_0xb72b('0x2')]=function(_0x3afac1,_0x5a4bcc){return client[_0xb72b('0x0')]('AddTagsToOpenchannelInteraction',{'body':_0x5a4bcc,'options':{'where':{'id':_0x3afac1}},'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 46b836f..4b69580 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 _0x6d5b=['Request','CreateOpenchannelMessage','createOpenchannelMessage','../client','create'];(function(_0x5cf3c0,_0x4363c1){var _0x39a680=function(_0x2a10f1){while(--_0x2a10f1){_0x5cf3c0['push'](_0x5cf3c0['shift']());}};_0x39a680(++_0x4363c1);}(_0x6d5b,0x67));var _0xb6d5=function(_0x322f4d,_0x2211c6){_0x322f4d=_0x322f4d-0x0;var _0x548443=_0x6d5b[_0x322f4d];return _0x548443;};'use strict';var client=require(_0xb6d5('0x0'));exports[_0xb6d5('0x1')]=function(_0x1b2392){return client[_0xb6d5('0x2')](_0xb6d5('0x3'),{'body':_0x1b2392,'log':_0xb6d5('0x4')});}; \ No newline at end of file +var _0x1585=['CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x1a0d05,_0x82ce3b){var _0xe209d1=function(_0x2ac5e1){while(--_0x2ac5e1){_0x1a0d05['push'](_0x1a0d05['shift']());}};_0xe209d1(++_0x82ce3b);}(_0x1585,0x167));var _0x5158=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x1585[_0x5bd426];return _0x23a7eb;};'use strict';var client=require(_0x5158('0x0'));exports['create']=function(_0x2d6365){return client['Request'](_0x5158('0x1'),{'body':_0x2d6365,'log':_0x5158('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index f5d71ce..fe196a5 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 _0xb0de=['name','strategy','User','Agents','online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue'];(function(_0xe70ed5,_0x404aab){var _0x515cd9=function(_0x33a3d7){while(--_0x33a3d7){_0xe70ed5['push'](_0xe70ed5['shift']());}};_0x515cd9(++_0x404aab);}(_0xb0de,0xec));var _0xeb0d=function(_0x290684,_0x5655a3){_0x290684=_0x290684-0x0;var _0x235635=_0xb0de[_0x290684];return _0x235635;};'use strict';var client=require(_0xeb0d('0x0'));exports[_0xeb0d('0x1')]=function(){return function(){return client[_0xeb0d('0x2')](_0xeb0d('0x3'),{'options':{'raw':![],'attributes':['id',_0xeb0d('0x4'),'timeout',_0xeb0d('0x5')],'include':[{'model':_0xeb0d('0x6'),'as':_0xeb0d('0x7'),'attributes':['id',_0xeb0d('0x4'),_0xeb0d('0x8'),_0xeb0d('0x9')]}]},'log':_0xeb0d('0x1')});};}; \ No newline at end of file +var _0xde59=['GetOpenchannelQueue','name','timeout','strategy','User','Agents','online','getOpenchannelQueues','../client','Request'];(function(_0x420746,_0x26dd66){var _0x1c6de2=function(_0x1162d7){while(--_0x1162d7){_0x420746['push'](_0x420746['shift']());}};_0x1c6de2(++_0x26dd66);}(_0xde59,0x1e8));var _0x9de5=function(_0x5a9974,_0x22a88b){_0x5a9974=_0x5a9974-0x0;var _0x574f8e=_0xde59[_0x5a9974];return _0x574f8e;};'use strict';var client=require(_0x9de5('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x9de5('0x1')](_0x9de5('0x2'),{'options':{'raw':![],'attributes':['id',_0x9de5('0x3'),_0x9de5('0x4'),_0x9de5('0x5')],'include':[{'model':_0x9de5('0x6'),'as':_0x9de5('0x7'),'attributes':['id',_0x9de5('0x3'),_0x9de5('0x8'),'openchannelPause']}]},'log':_0x9de5('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 6e49020..cce12b3 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 _0x93dc=['create','CreateOpenchannelQueueReport','update','Request','UpdateOpenchannelQueueReport','../client'];(function(_0x5e48a,_0x3add0f){var _0x379a70=function(_0x44d97b){while(--_0x44d97b){_0x5e48a['push'](_0x5e48a['shift']());}};_0x379a70(++_0x3add0f);}(_0x93dc,0x161));var _0xc93d=function(_0x12f1b1,_0x38bf38){_0x12f1b1=_0x12f1b1-0x0;var _0x4e0ace=_0x93dc[_0x12f1b1];return _0x4e0ace;};'use strict';var client=require(_0xc93d('0x0'));exports[_0xc93d('0x1')]=function(_0x3e8fd5){return client['Request'](_0xc93d('0x2'),{'body':_0x3e8fd5,'log':_0xc93d('0x2')});};exports[_0xc93d('0x3')]=function(_0x9cbf77,_0x513122){return client[_0xc93d('0x4')](_0xc93d('0x5'),{'body':_0x513122,'options':{'where':{'uniqueid':_0x9cbf77},'order':[['id','DESC']],'limit':0x1},'log':_0xc93d('0x5')});}; \ No newline at end of file +var _0xee49=['../client','create','CreateOpenchannelQueueReport','update','DESC','UpdateOpenchannelQueueReport'];(function(_0x49ec46,_0x5d96ee){var _0x3b9e42=function(_0x3847c5){while(--_0x3847c5){_0x49ec46['push'](_0x49ec46['shift']());}};_0x3b9e42(++_0x5d96ee);}(_0xee49,0x1a4));var _0x9ee4=function(_0xee8a44,_0x5bc189){_0xee8a44=_0xee8a44-0x0;var _0x1a4d46=_0xee49[_0xee8a44];return _0x1a4d46;};'use strict';var client=require(_0x9ee4('0x0'));exports[_0x9ee4('0x1')]=function(_0x2d8098){return client['Request'](_0x9ee4('0x2'),{'body':_0x2d8098,'log':_0x9ee4('0x2')});};exports[_0x9ee4('0x3')]=function(_0x2ec46a,_0x210e1b){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x210e1b,'options':{'where':{'uniqueid':_0x2ec46a},'order':[['id',_0x9ee4('0x4')]],'limit':0x1},'log':_0x9ee4('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index f42634a..f7be554 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 _0x84ab=['updateSmsInteraction','addTags','AddTagsToSmsInteraction','../client','update','Request'];(function(_0x1d041b,_0x23e8fd){var _0x202c63=function(_0x286cbb){while(--_0x286cbb){_0x1d041b['push'](_0x1d041b['shift']());}};_0x202c63(++_0x23e8fd);}(_0x84ab,0x12f));var _0xb84a=function(_0x77d310,_0x2b2fe7){_0x77d310=_0x77d310-0x0;var _0x2cdce4=_0x84ab[_0x77d310];return _0x2cdce4;};'use strict';var client=require(_0xb84a('0x0'));exports[_0xb84a('0x1')]=function(_0xd2561,_0x1ea089){return client[_0xb84a('0x2')]('UpdateSmsInteraction',{'body':_0x1ea089,'options':{'where':{'id':_0xd2561}},'log':_0xb84a('0x3')});};exports[_0xb84a('0x4')]=function(_0x47b8e3,_0x9d3a00){return client[_0xb84a('0x2')](_0xb84a('0x5'),{'body':_0x9d3a00,'options':{'where':{'id':_0x47b8e3}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0x55d2=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x3f6171,_0x27fd22){var _0x4850d6=function(_0x54b65b){while(--_0x54b65b){_0x3f6171['push'](_0x3f6171['shift']());}};_0x4850d6(++_0x27fd22);}(_0x55d2,0x9f));var _0x255d=function(_0x210574,_0x243237){_0x210574=_0x210574-0x0;var _0x123ad9=_0x55d2[_0x210574];return _0x123ad9;};'use strict';var client=require('../client');exports['update']=function(_0x37e1c7,_0x1bd891){return client[_0x255d('0x0')](_0x255d('0x1'),{'body':_0x1bd891,'options':{'where':{'id':_0x37e1c7}},'log':_0x255d('0x2')});};exports[_0x255d('0x3')]=function(_0x57cbc1,_0x44e16c){return client[_0x255d('0x0')](_0x255d('0x4'),{'body':_0x44e16c,'options':{'where':{'id':_0x57cbc1}},'log':_0x255d('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 41db4d6..f112c82 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 _0xdbb3=['create','Request','createSmsMessage','../client'];(function(_0x3c7d53,_0x2826d0){var _0x2c8387=function(_0x21f0e8){while(--_0x21f0e8){_0x3c7d53['push'](_0x3c7d53['shift']());}};_0x2c8387(++_0x2826d0);}(_0xdbb3,0x7b));var _0x3dbb=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0xdbb3[_0x5e36d1];return _0x950b9e;};'use strict';var client=require(_0x3dbb('0x0'));exports[_0x3dbb('0x1')]=function(_0x4fcd2b){return client[_0x3dbb('0x2')]('CreateSmsMessage',{'body':_0x4fcd2b,'log':_0x3dbb('0x3')});}; \ No newline at end of file +var _0xc63b=['Request','CreateSmsMessage','createSmsMessage'];(function(_0xcc9399,_0x127ef1){var _0x6d6272=function(_0x34963d){while(--_0x34963d){_0xcc9399['push'](_0xcc9399['shift']());}};_0x6d6272(++_0x127ef1);}(_0xc63b,0x19b));var _0xbc63=function(_0x59162a,_0x10e547){_0x59162a=_0x59162a-0x0;var _0x35e50d=_0xc63b[_0x59162a];return _0x35e50d;};'use strict';var client=require('../client');exports['create']=function(_0x1957e4){return client[_0xbc63('0x0')](_0xbc63('0x1'),{'body':_0x1957e4,'log':_0xbc63('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 1f72c41..fbec4a7 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x5cca9f,_0x154684){var _0x55edda=function(_0x115aa2){while(--_0x115aa2){_0x5cca9f['push'](_0x5cca9f['shift']());}};_0x55edda(++_0x154684);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file +var _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0x18af8f,_0x3bd865){var _0x23a031=function(_0x3586c1){while(--_0x3586c1){_0x18af8f['push'](_0x18af8f['shift']());}};_0x23a031(++_0x3bd865);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5302fb,_0x1a2db3){_0x5302fb=_0x5302fb-0x0;var _0x43e6a4=_0xcb91[_0x5302fb];return _0x43e6a4;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'attributes':['id',_0x1cb9('0x2'),_0x1cb9('0x3'),'strategy'],'include':[{'model':_0x1cb9('0x4'),'as':_0x1cb9('0x5'),'attributes':['id','name',_0x1cb9('0x6'),_0x1cb9('0x7')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index b942266..5b7778f 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 _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0xb2851,_0x365293){var _0x20116a=function(_0x145729){while(--_0x145729){_0xb2851['push'](_0xb2851['shift']());}};_0x20116a(++_0x365293);}(_0x34e8,0x12c));var _0x834e=function(_0xd2f9f2,_0xa267ac){_0xd2f9f2=_0xd2f9f2-0x0;var _0x69fae9=_0x34e8[_0xd2f9f2];return _0x69fae9;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateSmsQueueReport',{'body':_0x8b339,'log':_0x834e('0x3')});};exports[_0x834e('0x4')]=function(_0x472111,_0x31bf20){return client[_0x834e('0x2')](_0x834e('0x5'),{'body':_0x31bf20,'options':{'where':{'uniqueid':_0x472111},'order':[['id',_0x834e('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file +var _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x4ec520,_0x15fee2){var _0xed49d7=function(_0x3031f2){while(--_0x3031f2){_0x4ec520['push'](_0x4ec520['shift']());}};_0xed49d7(++_0x15fee2);}(_0xedd9,0xfc));var _0x9edd=function(_0x23c9e0,_0x46f2e1){_0x23c9e0=_0x23c9e0-0x0;var _0x1238bb=_0xedd9[_0x23c9e0];return _0x1238bb;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 4543ed7..bfecb71 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(_0x5e96e4,_0x3f9483){var _0x1d60c8=function(_0x31ed0d){while(--_0x31ed0d){_0x5e96e4['push'](_0x5e96e4['shift']());}};_0x1d60c8(++_0x3f9483);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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(_0x14feeb,_0x5f1276){var _0x29b9de=function(_0xd7373f){while(--_0xd7373f){_0x14feeb['push'](_0x14feeb['shift']());}};_0x29b9de(++_0x5f1276);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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 890b5ba..51a8c23 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 _0xee87=['Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','addTagsToWhatsappInteraction','update'];(function(_0x26a351,_0x5dd04c){var _0x1ef7fe=function(_0x4ea269){while(--_0x4ea269){_0x26a351['push'](_0x26a351['shift']());}};_0x1ef7fe(++_0x5dd04c);}(_0xee87,0x10d));var _0x7ee8=function(_0x54129e,_0x24050b){_0x54129e=_0x54129e-0x0;var _0x44382b=_0xee87[_0x54129e];return _0x44382b;};'use strict';var client=require('../client');exports[_0x7ee8('0x0')]=function(_0x2657ca,_0xea9501){return client[_0x7ee8('0x1')](_0x7ee8('0x2'),{'body':_0xea9501,'options':{'where':{'id':_0x2657ca}},'log':_0x7ee8('0x3')});};exports[_0x7ee8('0x4')]=function(_0x2f1867,_0x32466c){return client[_0x7ee8('0x1')]('AddTagsToWhatsappInteraction',{'body':_0x32466c,'options':{'where':{'id':_0x2f1867}},'log':_0x7ee8('0x5')});}; \ No newline at end of file +var _0xbd0a=['Request','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','updateWhatsappInteraction','addTags'];(function(_0x1ccacf,_0x1bd8ca){var _0x2827ae=function(_0x9ac75d){while(--_0x9ac75d){_0x1ccacf['push'](_0x1ccacf['shift']());}};_0x2827ae(++_0x1bd8ca);}(_0xbd0a,0x1b9));var _0xabd0=function(_0x54db06,_0x5e0dc2){_0x54db06=_0x54db06-0x0;var _0x574eea=_0xbd0a[_0x54db06];return _0x574eea;};'use strict';var client=require(_0xabd0('0x0'));exports['update']=function(_0x3b0fc0,_0x48c569){return client['Request']('UpdateWhatsappInteraction',{'body':_0x48c569,'options':{'where':{'id':_0x3b0fc0}},'log':_0xabd0('0x1')});};exports[_0xabd0('0x2')]=function(_0x41e52b,_0x3d1138){return client[_0xabd0('0x3')](_0xabd0('0x4'),{'body':_0x3d1138,'options':{'where':{'id':_0x41e52b}},'log':_0xabd0('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index b5799e2..ab952fd 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 _0x4bc3=['Request','CreateWhatsappMessage','../client','create'];(function(_0x21e29d,_0x3fb609){var _0x448d8b=function(_0x2a0a3e){while(--_0x2a0a3e){_0x21e29d['push'](_0x21e29d['shift']());}};_0x448d8b(++_0x3fb609);}(_0x4bc3,0x16e));var _0x34bc=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x4bc3[_0x2d2c16];return _0x53f2fb;};'use strict';var client=require(_0x34bc('0x0'));exports[_0x34bc('0x1')]=function(_0x4a6fe8){return client[_0x34bc('0x2')](_0x34bc('0x3'),{'body':_0x4a6fe8,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x81fa=['../client','create','Request','createWhatsappMessage'];(function(_0x34c71f,_0xacf7b7){var _0x27f3d9=function(_0x277395){while(--_0x277395){_0x34c71f['push'](_0x34c71f['shift']());}};_0x27f3d9(++_0xacf7b7);}(_0x81fa,0x154));var _0xa81f=function(_0x47a768,_0x3357cc){_0x47a768=_0x47a768-0x0;var _0x5d756d=_0x81fa[_0x47a768];return _0x5d756d;};'use strict';var client=require(_0xa81f('0x0'));exports[_0xa81f('0x1')]=function(_0x32f69e){return client[_0xa81f('0x2')]('CreateWhatsappMessage',{'body':_0x32f69e,'log':_0xa81f('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index d7a3bc1..d54a3df 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 _0xfc55=['strategy','User','whatsappPause','../client','getWhatsappQueues','Request','name','timeout'];(function(_0x2f44ca,_0x46a085){var _0x342e09=function(_0x29431f){while(--_0x29431f){_0x2f44ca['push'](_0x2f44ca['shift']());}};_0x342e09(++_0x46a085);}(_0xfc55,0x123));var _0x5fc5=function(_0xeb2fa9,_0x5d1b0a){_0xeb2fa9=_0xeb2fa9-0x0;var _0x23ec26=_0xfc55[_0xeb2fa9];return _0x23ec26;};'use strict';var client=require(_0x5fc5('0x0'));exports[_0x5fc5('0x1')]=function(){return function(){return client[_0x5fc5('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x5fc5('0x3'),_0x5fc5('0x4'),_0x5fc5('0x5')],'include':[{'model':_0x5fc5('0x6'),'as':'Agents','attributes':['id',_0x5fc5('0x3'),'online',_0x5fc5('0x7')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x70fa=['GetWhatsappQueue','name','strategy','User','Agents','whatsappPause','../client','Request'];(function(_0x198f19,_0x4fee84){var _0x1be8fa=function(_0x321990){while(--_0x321990){_0x198f19['push'](_0x198f19['shift']());}};_0x1be8fa(++_0x4fee84);}(_0x70fa,0xee));var _0xa70f=function(_0x3c6c1b,_0x82a1e4){_0x3c6c1b=_0x3c6c1b-0x0;var _0x15170e=_0x70fa[_0x3c6c1b];return _0x15170e;};'use strict';var client=require(_0xa70f('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0xa70f('0x1')](_0xa70f('0x2'),{'options':{'raw':![],'attributes':['id',_0xa70f('0x3'),'timeout',_0xa70f('0x4')],'include':[{'model':_0xa70f('0x5'),'as':_0xa70f('0x6'),'attributes':['id',_0xa70f('0x3'),'online',_0xa70f('0x7')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 757f349..afd3c1d 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 _0x65b0=['create','Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC','../client'];(function(_0x370dfe,_0x492b81){var _0x4a1f30=function(_0x442d81){while(--_0x442d81){_0x370dfe['push'](_0x370dfe['shift']());}};_0x4a1f30(++_0x492b81);}(_0x65b0,0x179));var _0x065b=function(_0x49c5e3,_0x23dc57){_0x49c5e3=_0x49c5e3-0x0;var _0x29827f=_0x65b0[_0x49c5e3];return _0x29827f;};'use strict';var client=require(_0x065b('0x0'));exports[_0x065b('0x1')]=function(_0x40d067){return client[_0x065b('0x2')]('CreateWhatsappQueueReport',{'body':_0x40d067,'log':_0x065b('0x3')});};exports['update']=function(_0x51f6b6,_0x312e17){return client[_0x065b('0x2')](_0x065b('0x4'),{'body':_0x312e17,'options':{'where':{'uniqueid':_0x51f6b6},'order':[['id',_0x065b('0x5')]],'limit':0x1},'log':_0x065b('0x4')});}; \ No newline at end of file +var _0xed64=['create','CreateWhatsappQueueReport','update','Request','UpdateWhatsappQueueReport','DESC','../client'];(function(_0xf4a6e0,_0x54046b){var _0x361435=function(_0x54d01b){while(--_0x54d01b){_0xf4a6e0['push'](_0xf4a6e0['shift']());}};_0x361435(++_0x54046b);}(_0xed64,0x19c));var _0x4ed6=function(_0x53e29e,_0x17c540){_0x53e29e=_0x53e29e-0x0;var _0x54c118=_0xed64[_0x53e29e];return _0x54c118;};'use strict';var client=require(_0x4ed6('0x0'));exports[_0x4ed6('0x1')]=function(_0x23ddff){return client['Request'](_0x4ed6('0x2'),{'body':_0x23ddff,'log':_0x4ed6('0x2')});};exports[_0x4ed6('0x3')]=function(_0x5b44a1,_0x2358a9){return client[_0x4ed6('0x4')](_0x4ed6('0x5'),{'body':_0x2358a9,'options':{'where':{'uniqueid':_0x5b44a1},'order':[['id',_0x4ed6('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 2180ef6..feb5ccf 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 _0xe3f7=['stack','lodash','util','seq-queue','routing','string','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','consequence','validate','[%s][AGENT]\x20%s','map','message','join','stop','find','timeout','createQueue','channel','START:%s','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','error','log'];(function(_0x13393b,_0x1c3f83){var _0x31767d=function(_0x45b8f3){while(--_0x45b8f3){_0x13393b['push'](_0x13393b['shift']());}};_0x31767d(++_0x1c3f83);}(_0xe3f7,0x133));var _0x7e3f=function(_0x1350e5,_0x519867){_0x1350e5=_0x1350e5-0x0;var _0x503173=_0xe3f7[_0x1350e5];return _0x503173;};'use strict';var schema=require('validate');var _=require(_0x7e3f('0x0'));var util=require(_0x7e3f('0x1'));var seqqueue=require(_0x7e3f('0x2'));var logger=require('../../../../config/logger')(_0x7e3f('0x3'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x7e3f('0x4'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x7e3f('0x5'),'message':_0x7e3f('0x6')}});function writeLog(_0x3cf4fd,_0x4a4c83,_0x42bd82){return logger[_0x7e3f('0x7')](util[_0x7e3f('0x8')](_0x7e3f('0x9'),_0x3cf4fd,_0x4a4c83[_0x7e3f('0xa')],_0x42bd82));}function handleFindAgent(_0x5d5a7e){return function(_0xdbc0e){return _0xdbc0e[_0x7e3f('0xa')]['toLowerCase']()===_0x5d5a7e['toLowerCase']();};}exports[_0x7e3f('0xb')]=function(_0x43a359,_0x5cdd57,_0x46e49c,_0x65ffc4){return function(_0x48a019){try{var _0x22ea37={'name':_0x5cdd57[0x0],'timeout':_0x5cdd57[0x1]};var _0x1db69d=queue[_0x7e3f('0xc')](_0x22ea37,{'typecast':!![]});if(_0x1db69d['length']){logger['error'](_0x7e3f('0xd'),_0x43a359,_[_0x7e3f('0xe')](_0x1db69d,_0x7e3f('0xf'))[_0x7e3f('0x10')](',\x20'));_0x48a019[_0x7e3f('0x11')]();}else{var _0x3d40b9=_[_0x7e3f('0x12')](_0x46e49c['agents'],handleFindAgent(_0x22ea37[_0x7e3f('0xa')]));if(_0x3d40b9){var _0x3b2b97=(_0x22ea37[_0x7e3f('0x13')]||0xa)*0x3e8;var _0x4cdc49,_0x3ff83c;var _0x55d2ba=seqqueue[_0x7e3f('0x14')](_0x3b2b97);_0x55d2ba['id']=_0x43a359;_0x55d2ba['atimeout']=_0x3b2b97;_0x55d2ba[_0x7e3f('0x15')]=_0x65ffc4[_0x7e3f('0x15')];writeLog(_0x43a359,_0x3d40b9,util[_0x7e3f('0x8')](_0x7e3f('0x16'),_0x3b2b97));_0x46e49c['rules'][_0x43a359]['on'](_0x7e3f('0x17'),function(){logger[_0x7e3f('0x7')](_0x7e3f('0x18'),_0x43a359);clearTimeout(_0x3ff83c);_0x3ff83c=undefined;_0x55d2ba[_0x7e3f('0x19')]();if(_0x46e49c['rules'][_0x43a359]){delete _0x46e49c[_0x7e3f('0x1a')][_0x43a359];}_0x48a019[_0x7e3f('0x11')]();});_0x46e49c[_0x7e3f('0x1a')][_0x43a359]['on'](_0x7e3f('0x1b'),function(){if(_0x46e49c[_0x7e3f('0x1a')][_0x43a359]){delete _0x46e49c[_0x7e3f('0x1a')][_0x43a359];}});_0x3ff83c=setTimeout(function(){logger['info'](_0x7e3f('0x1c'),_0x43a359);clearTimeout(_0x3ff83c);_0x55d2ba['close']();_0x48a019[_0x7e3f('0x1d')]();},_0x3b2b97);strategy[_0x7e3f('0x1e')](_0x55d2ba,_0x3d40b9,_0x46e49c,_0x65ffc4);}else{logger[_0x7e3f('0x1f')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x43a359,_0x22ea37[_0x7e3f('0xa')]);_0x48a019[_0x7e3f('0x11')]();}}}catch(_0x813837){console[_0x7e3f('0x20')](_0x813837);logger[_0x7e3f('0x1f')]('[%s][QUEUE]\x20%s',_0x43a359,_0x813837[_0x7e3f('0x21')]);_0x48a019[_0x7e3f('0x11')]();}};}; \ No newline at end of file +var _0xfdfa=['map','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','validate','lodash','seq-queue','../../../../config/logger','routing','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','error'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0xfdfa,0x128));var _0xafdf=function(_0x1fcfdc,_0x2ba377){_0x1fcfdc=_0x1fcfdc-0x0;var _0x496df3=_0xfdfa[_0x1fcfdc];return _0x496df3;};'use strict';var schema=require(_0xafdf('0x0'));var _=require(_0xafdf('0x1'));var util=require('util');var seqqueue=require(_0xafdf('0x2'));var logger=require(_0xafdf('0x3'))(_0xafdf('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0xafdf('0x5')},'timeout':{'type':_0xafdf('0x6'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x1f8568,_0x4502aa,_0x208cd3){return logger[_0xafdf('0x7')](util[_0xafdf('0x8')](_0xafdf('0x9'),_0x1f8568,_0x4502aa[_0xafdf('0xa')],_0x208cd3));}function handleFindAgent(_0x51a4e0){return function(_0x4ac679){return _0x4ac679['name'][_0xafdf('0xb')]()===_0x51a4e0[_0xafdf('0xb')]();};}exports[_0xafdf('0xc')]=function(_0x594d39,_0x2bd6b4,_0x24e175,_0x11ce56){return function(_0x259d79){try{var _0xc8b1={'name':_0x2bd6b4[0x0],'timeout':_0x2bd6b4[0x1]};var _0x5ea611=queue[_0xafdf('0x0')](_0xc8b1,{'typecast':!![]});if(_0x5ea611['length']){logger[_0xafdf('0xd')]('[%s][AGENT]\x20%s',_0x594d39,_[_0xafdf('0xe')](_0x5ea611,'message')['join'](',\x20'));_0x259d79[_0xafdf('0xf')]();}else{var _0x2dce8b=_[_0xafdf('0x10')](_0x24e175[_0xafdf('0x11')],handleFindAgent(_0xc8b1[_0xafdf('0xa')]));if(_0x2dce8b){var _0x28e19d=(_0xc8b1[_0xafdf('0x12')]||0xa)*0x3e8;var _0x8eff14,_0x5a9cfe;var _0x1c8dab=seqqueue[_0xafdf('0x13')](_0x28e19d);_0x1c8dab['id']=_0x594d39;_0x1c8dab[_0xafdf('0x14')]=_0x28e19d;_0x1c8dab[_0xafdf('0x15')]=_0x11ce56[_0xafdf('0x15')];writeLog(_0x594d39,_0x2dce8b,util['format'](_0xafdf('0x16'),_0x28e19d));_0x24e175[_0xafdf('0x17')][_0x594d39]['on'](_0xafdf('0x18'),function(){logger[_0xafdf('0x7')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x594d39);clearTimeout(_0x5a9cfe);_0x5a9cfe=undefined;_0x1c8dab['close']();if(_0x24e175[_0xafdf('0x17')][_0x594d39]){delete _0x24e175[_0xafdf('0x17')][_0x594d39];}_0x259d79[_0xafdf('0xf')]();});_0x24e175[_0xafdf('0x17')][_0x594d39]['on'](_0xafdf('0x19'),function(){if(_0x24e175[_0xafdf('0x17')][_0x594d39]){delete _0x24e175[_0xafdf('0x17')][_0x594d39];}});_0x5a9cfe=setTimeout(function(){logger[_0xafdf('0x7')](_0xafdf('0x1a'),_0x594d39);clearTimeout(_0x5a9cfe);_0x1c8dab[_0xafdf('0x1b')]();_0x259d79[_0xafdf('0x1c')]();},_0x28e19d);strategy['agent'](_0x1c8dab,_0x2dce8b,_0x24e175,_0x11ce56);}else{logger[_0xafdf('0xd')](_0xafdf('0x1d'),_0x594d39,_0xc8b1[_0xafdf('0xa')]);_0x259d79[_0xafdf('0xf')]();}}}catch(_0x16a419){console['log'](_0x16a419);logger[_0xafdf('0xd')](_0xafdf('0x1e'),_0x594d39,_0x16a419['stack']);_0x259d79[_0xafdf('0xf')]();}};}; \ 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 94cf362..77cd1d9 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 _0xac3f=['lodash','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','phone','interaction','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','isEmpty','body','getMustacheRender','Message','create','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','channel','toString','postText','message','next','amazonlex','then','dialogState','Failed'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xac3f,0x1c2));var _0xfac3=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xac3f[_0x4fbfd9];return _0x31dc94;};'use strict';var _=require(_0xfac3('0x0'));var moment=require('moment');var AWS=require(_0xfac3('0x1'));var utils=require(_0xfac3('0x2'));var logger=require(_0xfac3('0x3'))(_0xfac3('0x4'));var rpc={'chatMessage':require(_0xfac3('0x5')),'openchannelMessage':require(_0xfac3('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xfac3('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x34ef16,_0x220337){return function(_0x5e8461){try{if(!_['isNil'](this['interaction'][_0xfac3('0x8')])){logger[_0xfac3('0x9')](_0xfac3('0xa'),_0x34ef16,_0xfac3('0xb'));return _0x5e8461['next']();}var _0x5c8266={'ContactId':this[_0xfac3('0xc')]['id'],'sentAt':moment()[_0xfac3('0xd')](_0xfac3('0xe')),'direction':_0xfac3('0xf')};if(this['channel']===_0xfac3('0x10')||this['channel']==='whatsapp'){_0x5c8266[_0xfac3('0x11')]=this[_0xfac3('0x12')][_0xfac3('0x11')];}var _0x1995a6=this['channel'];if(_0x1995a6===_0xfac3('0x13')){_0x5c8266[_0xfac3('0x14')]=this['account']['id'];}else{_0x5c8266[_[_0xfac3('0x15')](_0x1995a6)+_0xfac3('0x16')]=this[_0xfac3('0x17')]['id'];}_0x5c8266[_['upperFirst'](_0x1995a6)+_0xfac3('0x18')]=this['interaction']['id'];if(this['interaction']['created']){var _0x2c6d7f=_0x220337[0x4];if(!_[_0xfac3('0x19')](_0x2c6d7f)){_0x5c8266[_0xfac3('0x1a')]=utils[_0xfac3('0x1b')](_0x2c6d7f,this);return rpc[_0x1995a6+_0xfac3('0x1c')][_0xfac3('0x1d')](_0x5c8266)['then'](function(_0x154fc0){logger[_0xfac3('0x9')](_0xfac3('0xa'),_0x34ef16,_0x5c8266[_0xfac3('0x1a')]);})['catch'](function(_0x421d06){logger[_0xfac3('0x1e')](_0xfac3('0xa'),_0x34ef16,JSON[_0xfac3('0x1f')](_0x421d06));})['finally'](function(){logger[_0xfac3('0x9')](_0xfac3('0x20'),_0x34ef16);_0x5e8461['stop']();});}else{logger[_0xfac3('0x9')](_0xfac3('0x21'),_0x34ef16);_0x5e8461[_0xfac3('0x22')]();}}else{var _0x524eea=this;var _0x2ca27f=new AWS[(_0xfac3('0x23'))]({'accessKeyId':_0x220337[0x0],'secretAccessKey':_0x220337[0x1],'region':_0x220337[0x2]});var _0x58c9c0={'botAlias':'$LATEST','botName':_0x220337[0x3],'inputText':this['message'][_0xfac3('0x1a')],'userId':this[_0xfac3('0x24')]+':'+this['interaction']['id'][_0xfac3('0x25')]()};_0x2ca27f[_0xfac3('0x26')](_0x58c9c0,function(_0x4b6cb6,_0x52a781){if(_0x4b6cb6){logger[_0xfac3('0x1e')]('[%s][AMAZONLEX]\x20%s',_0x34ef16,_0x4b6cb6[_0xfac3('0x27')]);_0x5e8461[_0xfac3('0x28')]();}else if(_0x52a781&&_0x52a781[_0xfac3('0x27')]){_0x524eea[_0xfac3('0x1a')][_0xfac3('0x29')]=_0x52a781;_0x5c8266[_0xfac3('0x1a')]=_0x52a781[_0xfac3('0x27')];_0x5c8266['providerName']=_0xfac3('0x29');_0x5c8266['providerResponse']=JSON[_0xfac3('0x1f')](_0x52a781);return rpc[_0x1995a6+'Message'][_0xfac3('0x1d')](_0x5c8266)[_0xfac3('0x2a')](function(_0x442d49){logger['info'](_0xfac3('0xa'),_0x34ef16,_0x5c8266[_0xfac3('0x1a')]);if(_0x52a781[_0xfac3('0x2b')]==_0xfac3('0x2c')){_0x5e8461['next']();}else{_0x5e8461[_0xfac3('0x22')]();}})['catch'](function(_0xf3b730){logger[_0xfac3('0x1e')](_0xfac3('0xa'),_0x34ef16,JSON[_0xfac3('0x1f')](_0xf3b730));_0x5e8461[_0xfac3('0x28')]();});}else{_0x5e8461[_0xfac3('0x28')]();}});}}catch(_0x2b7bcf){logger[_0xfac3('0x1e')](_0xfac3('0xa'),_0x34ef16,JSON[_0xfac3('0x1f')](_0x2b7bcf));_0x5e8461['stop']();}};}; \ No newline at end of file +var _0xb373=['interaction','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','Message','create','catch','error','stringify','info','stop','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerResponse','dialogState','Failed','lodash','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','consequence','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone'];(function(_0x5ee71e,_0x28e6bf){var _0x1675b1=function(_0x5f543c){while(--_0x5f543c){_0x5ee71e['push'](_0x5ee71e['shift']());}};_0x1675b1(++_0x28e6bf);}(_0xb373,0x161));var _0x3b37=function(_0x51cbc7,_0x70e604){_0x51cbc7=_0x51cbc7-0x0;var _0x1ec150=_0xb373[_0x51cbc7];return _0x1ec150;};'use strict';var _=require(_0x3b37('0x0'));var moment=require('moment');var AWS=require('aws-sdk');var utils=require('./utils');var logger=require('../../../../config/logger')(_0x3b37('0x1'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x3b37('0x2')),'mailMessage':require(_0x3b37('0x3')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x3b37('0x4')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x3b37('0x5')]=function(_0x188874,_0x5187c8){return function(_0x2c59f1){try{if(!_['isNil'](this['interaction']['UserId'])){logger['info'](_0x3b37('0x6'),_0x188874,_0x3b37('0x7'));return _0x2c59f1[_0x3b37('0x8')]();}var _0x6c2283={'ContactId':this[_0x3b37('0x9')]['id'],'sentAt':moment()[_0x3b37('0xa')](_0x3b37('0xb')),'direction':_0x3b37('0xc')};if(this[_0x3b37('0xd')]===_0x3b37('0xe')||this[_0x3b37('0xd')]==='whatsapp'){_0x6c2283[_0x3b37('0xf')]=this[_0x3b37('0x10')][_0x3b37('0xf')];}var _0x3d4dc2=this[_0x3b37('0xd')];if(_0x3d4dc2==='chat'){_0x6c2283[_0x3b37('0x11')]=this[_0x3b37('0x12')]['id'];}else{_0x6c2283[_[_0x3b37('0x13')](_0x3d4dc2)+_0x3b37('0x14')]=this[_0x3b37('0x12')]['id'];}_0x6c2283[_[_0x3b37('0x13')](_0x3d4dc2)+_0x3b37('0x15')]=this[_0x3b37('0x10')]['id'];if(this[_0x3b37('0x10')][_0x3b37('0x16')]){var _0x101c67=_0x5187c8[0x4];if(!_[_0x3b37('0x17')](_0x101c67)){_0x6c2283[_0x3b37('0x18')]=utils['getMustacheRender'](_0x101c67,this);return rpc[_0x3d4dc2+_0x3b37('0x19')][_0x3b37('0x1a')](_0x6c2283)['then'](function(_0x8da54c){logger['info'](_0x3b37('0x6'),_0x188874,_0x6c2283[_0x3b37('0x18')]);})[_0x3b37('0x1b')](function(_0x41a846){logger[_0x3b37('0x1c')]('[%s][AMAZONLEX]\x20%s',_0x188874,JSON[_0x3b37('0x1d')](_0x41a846));})['finally'](function(){logger[_0x3b37('0x1e')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x188874);_0x2c59f1[_0x3b37('0x1f')]();});}else{logger[_0x3b37('0x1e')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x188874);_0x2c59f1[_0x3b37('0x1f')]();}}else{var _0x4143a0=this;var _0x3b983b=new AWS[(_0x3b37('0x20'))]({'accessKeyId':_0x5187c8[0x0],'secretAccessKey':_0x5187c8[0x1],'region':_0x5187c8[0x2]});var _0x5ff819={'botAlias':_0x3b37('0x21'),'botName':_0x5187c8[0x3],'inputText':this[_0x3b37('0x22')]['body'],'userId':this[_0x3b37('0xd')]+':'+this[_0x3b37('0x10')]['id'][_0x3b37('0x23')]()};_0x3b983b[_0x3b37('0x24')](_0x5ff819,function(_0xe88006,_0x47f65a){if(_0xe88006){logger[_0x3b37('0x1c')](_0x3b37('0x6'),_0x188874,_0xe88006['message']);_0x2c59f1['next']();}else if(_0x47f65a&&_0x47f65a[_0x3b37('0x22')]){_0x4143a0[_0x3b37('0x18')][_0x3b37('0x25')]=_0x47f65a;_0x6c2283['body']=_0x47f65a[_0x3b37('0x22')];_0x6c2283['providerName']=_0x3b37('0x25');_0x6c2283[_0x3b37('0x26')]=JSON['stringify'](_0x47f65a);return rpc[_0x3d4dc2+'Message'][_0x3b37('0x1a')](_0x6c2283)['then'](function(_0x1697d2){logger[_0x3b37('0x1e')](_0x3b37('0x6'),_0x188874,_0x6c2283[_0x3b37('0x18')]);if(_0x47f65a[_0x3b37('0x27')]==_0x3b37('0x28')){_0x2c59f1['next']();}else{_0x2c59f1[_0x3b37('0x1f')]();}})[_0x3b37('0x1b')](function(_0xe0db8d){logger['error'](_0x3b37('0x6'),_0x188874,JSON['stringify'](_0xe0db8d));_0x2c59f1[_0x3b37('0x8')]();});}else{_0x2c59f1[_0x3b37('0x8')]();}});}}catch(_0x519bc5){logger['error']('[%s][AMAZONLEX]\x20%s',_0x188874,JSON['stringify'](_0x519bc5));_0x2c59f1[_0x3b37('0x1f')]();}};}; \ 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 148c949..cc5133e 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 _0xe069=['../../rpc/smsInteraction','../../mailRpc','consequence','channel','mail','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','info','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','format','YYYY-MM-DD\x20HH:mm:ss','body','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','account','upperFirst','InteractionId','Message','Smtp','service','host','port','secure','authentication','user','pass','inReplyTo','messageId','html','','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','finally','update','catch','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','Interaction','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/chatInteraction'];(function(_0x4e2aed,_0x29773b){var _0x591983=function(_0x4a8fd4){while(--_0x4a8fd4){_0x4e2aed['push'](_0x4e2aed['shift']());}};_0x591983(++_0x29773b);}(_0xe069,0x1ac));var _0x9e06=function(_0x52b7c9,_0x5721ff){_0x52b7c9=_0x52b7c9-0x0;var _0x5d9399=_0xe069[_0x52b7c9];return _0x5d9399;};'use strict';var _=require(_0x9e06('0x0'));var moment=require(_0x9e06('0x1'));var utils=require(_0x9e06('0x2'));var logger=require(_0x9e06('0x3'))(_0x9e06('0x4'));var rpc={'chatMessage':require(_0x9e06('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x9e06('0x6')),'smsMessage':require(_0x9e06('0x7')),'faxMessage':require(_0x9e06('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x9e06('0x9')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0x9e06('0xa')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0x9e06('0xb'));exports[_0x9e06('0xc')]=function(_0x3433fe,_0x4804a1,_0x2a0550,_0x2f238b){return function(_0x45ee68){try{var _0xec29c=this[_0x9e06('0xd')];if(_0xec29c===_0x9e06('0xe')&&_0x2f238b['body']['isAutoreply']){logger['info'](_0x9e06('0xf'),_0x3433fe,_0x9e06('0x10'));return _0x45ee68[_0x9e06('0x11')]();}if(_0x4804a1[0x0]==='1'&&(_[_0x9e06('0x12')](this['interaction']['created'])||!this[_0x9e06('0x13')][_0x9e06('0x14')])){logger['info']('[%s][AUTOREPLY]\x20%s',_0x3433fe,_0x9e06('0x15'));return _0x45ee68[_0x9e06('0x11')]();}if(_0x4804a1[0x0]==='2'&&this['interaction'][_0x9e06('0x16')]){logger[_0x9e06('0x17')](_0x9e06('0x18'),_0x3433fe,_0x9e06('0x19'));return _0x45ee68[_0x9e06('0x11')]();}var _0x191cd9={'ContactId':this['contact']['id'],'sentAt':moment()[_0x9e06('0x1a')](_0x9e06('0x1b')),'direction':'out'};if(this[_0x9e06('0xd')]==='mail'){_0x191cd9[_0x9e06('0x1c')]=utils['getMustacheRender'](_0x4804a1[0x2],this);}else{_0x191cd9[_0x9e06('0x1c')]=utils['getMustacheRender'](_0x4804a1[0x1],this);}if(this[_0x9e06('0x1d')]){_0x191cd9['to']=this[_0x9e06('0x1d')][_0x9e06('0x1e')]||'';if(this[_0x9e06('0xd')]===_0x9e06('0xe')&&_0x4804a1[0x1]==='1'){_0x191cd9['cc']=this[_0x9e06('0x1d')]['cc']||'';}_0x191cd9[_0x9e06('0x1e')]=this[_0x9e06('0x1d')]['to']||'';_0x191cd9[_0x9e06('0x1f')]=this[_0x9e06('0x1d')][_0x9e06('0x1f')]||'';_0x191cd9[_0x9e06('0x20')]=!![];if(this['message']['subject']){_0x191cd9[_0x9e06('0x21')]='';_0x191cd9[_0x9e06('0x21')]+=_[_0x9e06('0x22')](this[_0x9e06('0x1d')][_0x9e06('0x21')],_0x9e06('0x23'))?'':_0x9e06('0x24');_0x191cd9[_0x9e06('0x21')]+=this[_0x9e06('0x1d')][_0x9e06('0x21')];}}if(this['channel']===_0x9e06('0x25')){_0x191cd9['ChatWebsiteId']=this[_0x9e06('0x26')]['id'];}else{_0x191cd9[_[_0x9e06('0x27')](this['channel'])+'AccountId']=this[_0x9e06('0x26')]['id'];}_0x191cd9[_[_0x9e06('0x27')](this[_0x9e06('0xd')])+_0x9e06('0x28')]=this[_0x9e06('0x13')]['id'];var _0x28e67a=this[_0x9e06('0x13')];if(rpc[this[_0x9e06('0xd')]+_0x9e06('0x29')]){if(this[_0x9e06('0xd')]===_0x9e06('0xe')){var _0x156543={'tls':{'rejectUnauthorized':![]}};if(this[_0x9e06('0x26')][_0x9e06('0x2a')]['service']){_0x156543[_0x9e06('0x2b')]=this[_0x9e06('0x26')]['Smtp'][_0x9e06('0x2b')];}else{_0x156543[_0x9e06('0x2c')]=this[_0x9e06('0x26')][_0x9e06('0x2a')]['host'];_0x156543['port']=this[_0x9e06('0x26')][_0x9e06('0x2a')][_0x9e06('0x2d')];_0x156543[_0x9e06('0x2e')]=this['account'][_0x9e06('0x2a')][_0x9e06('0x2e')];}if(this[_0x9e06('0x26')][_0x9e06('0x2a')][_0x9e06('0x2f')]){_0x156543['auth']={'user':this[_0x9e06('0x26')]['Smtp'][_0x9e06('0x30')],'pass':this['account']['Smtp'][_0x9e06('0x31')]};}_0x191cd9[_0x9e06('0x32')]=this['message'][_0x9e06('0x33')];_0x191cd9[_0x9e06('0x34')]=_0x9e06('0x35')+_[_0x9e06('0x36')](_0x191cd9[_0x9e06('0x1c')],_0x9e06('0x37'),'','headers','All','auto_reply','sendMailMessage','then','catch','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','Message','create','resolve','stop','lodash','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','channel','mail','body','info','next','isNil','created','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','interaction','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','Smtp','service','host'];(function(_0x59c071,_0x40fffc){var _0xe33a6d=function(_0x370466){while(--_0x370466){_0x59c071['push'](_0x59c071['shift']());}};_0xe33a6d(++_0x40fffc);}(_0xd328,0x130));var _0x8d32=function(_0x58a4a5,_0x15ffc8){_0x58a4a5=_0x58a4a5-0x0;var _0x3b1a42=_0xd328[_0x58a4a5];return _0x3b1a42;};'use strict';var _=require(_0x8d32('0x0'));var moment=require('moment');var utils=require(_0x8d32('0x1'));var logger=require(_0x8d32('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x8d32('0x3')),'mailMessage':require(_0x8d32('0x4')),'smsMessage':require(_0x8d32('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x8d32('0x6')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x8d32('0x7')),'mailInteraction':require(_0x8d32('0x8')),'smsInteraction':require(_0x8d32('0x9')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0x1d3955,_0x45f2d6,_0x689c96,_0x2a85f3){return function(_0x4984c0){try{var _0xbd686e=this[_0x8d32('0xa')];if(_0xbd686e===_0x8d32('0xb')&&_0x2a85f3[_0x8d32('0xc')]['isAutoreply']){logger[_0x8d32('0xd')]('[%s][AUTOREPLY]\x20%s',_0x1d3955,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x4984c0[_0x8d32('0xe')]();}if(_0x45f2d6[0x0]==='1'&&(_[_0x8d32('0xf')](this['interaction'][_0x8d32('0x10')])||!this['interaction'][_0x8d32('0x10')])){logger[_0x8d32('0xd')](_0x8d32('0x11'),_0x1d3955,_0x8d32('0x12'));return _0x4984c0[_0x8d32('0xe')]();}if(_0x45f2d6[0x0]==='2'&&this[_0x8d32('0x13')][_0x8d32('0x14')]){logger[_0x8d32('0xd')](_0x8d32('0x15'),_0x1d3955,_0x8d32('0x16'));return _0x4984c0['next']();}var _0xd40c4f={'ContactId':this[_0x8d32('0x17')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x8d32('0x18')};if(this[_0x8d32('0xa')]==='mail'){_0xd40c4f[_0x8d32('0xc')]=utils[_0x8d32('0x19')](_0x45f2d6[0x2],this);}else{_0xd40c4f[_0x8d32('0xc')]=utils['getMustacheRender'](_0x45f2d6[0x1],this);}if(this[_0x8d32('0x1a')]){_0xd40c4f['to']=this[_0x8d32('0x1a')][_0x8d32('0x1b')]||'';if(this[_0x8d32('0xa')]===_0x8d32('0xb')&&_0x45f2d6[0x1]==='1'){_0xd40c4f['cc']=this[_0x8d32('0x1a')]['cc']||'';}_0xd40c4f[_0x8d32('0x1b')]=this['message']['to']||'';_0xd40c4f[_0x8d32('0x1c')]=this[_0x8d32('0x1a')]['phone']||'';_0xd40c4f[_0x8d32('0x1d')]=!![];if(this[_0x8d32('0x1a')]['subject']){_0xd40c4f[_0x8d32('0x1e')]='';_0xd40c4f[_0x8d32('0x1e')]+=_[_0x8d32('0x1f')](this[_0x8d32('0x1a')]['subject'],'Re:')?'':_0x8d32('0x20');_0xd40c4f[_0x8d32('0x1e')]+=this[_0x8d32('0x1a')]['subject'];}}if(this[_0x8d32('0xa')]===_0x8d32('0x21')){_0xd40c4f[_0x8d32('0x22')]=this[_0x8d32('0x23')]['id'];}else{_0xd40c4f[_[_0x8d32('0x24')](this['channel'])+_0x8d32('0x25')]=this['account']['id'];}_0xd40c4f[_['upperFirst'](this[_0x8d32('0xa')])+'InteractionId']=this[_0x8d32('0x13')]['id'];var _0x33bf1f=this['interaction'];if(rpc[this[_0x8d32('0xa')]+'Message']){if(this[_0x8d32('0xa')]===_0x8d32('0xb')){var _0x6847f8={'tls':{'rejectUnauthorized':![]}};if(this[_0x8d32('0x23')][_0x8d32('0x26')][_0x8d32('0x27')]){_0x6847f8[_0x8d32('0x27')]=this['account']['Smtp']['service'];}else{_0x6847f8[_0x8d32('0x28')]=this[_0x8d32('0x23')][_0x8d32('0x26')][_0x8d32('0x28')];_0x6847f8['port']=this[_0x8d32('0x23')][_0x8d32('0x26')][_0x8d32('0x29')];_0x6847f8[_0x8d32('0x2a')]=this[_0x8d32('0x23')][_0x8d32('0x26')][_0x8d32('0x2a')];}if(this[_0x8d32('0x23')][_0x8d32('0x26')][_0x8d32('0x2b')]){_0x6847f8[_0x8d32('0x2c')]={'user':this[_0x8d32('0x23')][_0x8d32('0x26')]['user'],'pass':this[_0x8d32('0x23')][_0x8d32('0x26')][_0x8d32('0x2d')]};}_0xd40c4f[_0x8d32('0x2e')]=this['message'][_0x8d32('0x2f')];_0xd40c4f['html']=''+_[_0x8d32('0x30')](_0xd40c4f[_0x8d32('0xc')],_0x8d32('0x31'),_0x8d32('0x32'))+_0x8d32('0x33');_0xd40c4f[_0x8d32('0x34')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x8d32('0x35'),'Precedence':_0x8d32('0x36')};return mailRpc[_0x8d32('0x37')](_0x6847f8,_0xd40c4f)[_0x8d32('0x38')](function(_0x1d28cb){logger[_0x8d32('0xd')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x1d3955);_0xd40c4f[_0x8d32('0x2f')]=_0x1d28cb[_0x8d32('0x1a')][_0x8d32('0x2f')];return rpc[_0xbd686e+'Message']['create'](_0xd40c4f);})[_0x8d32('0x38')](function(_0x48fc96){logger[_0x8d32('0xd')](_0x8d32('0x11'),_0x1d3955,JSON['stringify'](_0x48fc96));})[_0x8d32('0x39')](function(_0x15bc76){logger[_0x8d32('0x3a')](_0x8d32('0x3b'),_0x1d3955,JSON[_0x8d32('0x3c')](_0x15bc76));})[_0x8d32('0x3d')](function(){Promise['resolve']()['then'](function(){if(_0x45f2d6[0x0]!=='2'||_0x33bf1f['autoreplyExecuted'])return;return rpc[_0xbd686e+_0x8d32('0x3e')][_0x8d32('0x3f')](_0x33bf1f['id'],{'autoreplyExecuted':!![]})[_0x8d32('0x38')](function(_0x5ee53f){logger['info'](_0x8d32('0x15'),_0x1d3955,JSON[_0x8d32('0x3c')](_0x5ee53f));})[_0x8d32('0x39')](function(_0x464daf){logger[_0x8d32('0x3a')](_0x8d32('0x40'),_0x1d3955,JSON[_0x8d32('0x3c')](_0x464daf));});})[_0x8d32('0x38')](function(){_0x4984c0[_0x8d32('0xe')]();});});}else{return rpc[this[_0x8d32('0xa')]+_0x8d32('0x41')][_0x8d32('0x42')](_0xd40c4f)[_0x8d32('0x38')](function(_0x9fcc5b){logger[_0x8d32('0xd')](_0x8d32('0x11'),_0x1d3955,_0xd40c4f[_0x8d32('0xc')]);})[_0x8d32('0x39')](function(_0x5c0c13){logger['error'](_0x8d32('0x11'),_0x1d3955,JSON['stringify'](_0x5c0c13));})[_0x8d32('0x3d')](function(){Promise[_0x8d32('0x43')]()['then'](function(){if(_0x45f2d6[0x0]!=='2'||_0x33bf1f[_0x8d32('0x14')])return;return rpc[_0xbd686e+'Interaction'][_0x8d32('0x3f')](_0x33bf1f['id'],{'autoreplyExecuted':!![]})[_0x8d32('0x38')](function(_0x20696d){logger[_0x8d32('0xd')](_0x8d32('0x15'),_0x1d3955,JSON[_0x8d32('0x3c')](_0x20696d));})[_0x8d32('0x39')](function(_0x46fc49){logger[_0x8d32('0x3a')](_0x8d32('0x40'),_0x1d3955,JSON[_0x8d32('0x3c')](_0x46fc49));});})[_0x8d32('0x38')](function(){_0x4984c0['next']();});});}}}catch(_0x31b3e9){logger[_0x8d32('0x3a')](_0x8d32('0x11'),_0x1d3955,JSON[_0x8d32('0x3c')](_0x31b3e9));_0x4984c0[_0x8d32('0x44')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 3e71c93..a7dddcd 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 _0x93c0=['update','interaction','then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','stringify','finally','stop','[%s][CLOSE]\x20%s','moment','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','Interaction'];(function(_0x58f457,_0x990c9b){var _0x2e8229=function(_0x53b2aa){while(--_0x53b2aa){_0x58f457['push'](_0x58f457['shift']());}};_0x2e8229(++_0x990c9b);}(_0x93c0,0x83));var _0x093c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x93c0[_0x14add3];return _0x4a174f;};'use strict';var moment=require(_0x093c('0x0'));var logger=require('../../../../config/logger')(_0x093c('0x1'));var rpc={'chatInteraction':require(_0x093c('0x2')),'openchannelInteraction':require(_0x093c('0x3')),'smsInteraction':require(_0x093c('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x093c('0x5')),'whatsappInteraction':require(_0x093c('0x6'))};exports[_0x093c('0x7')]=function(_0x4a3fa7,_0x32e283,_0x58ada7,_0xec44c4){return function(_0x354efc){try{logger['info'](_0x093c('0x8'),_0x4a3fa7,_0x32e283[0x0]);var _0x541a08={'closed':0x1,'closedAt':moment()[_0x093c('0x9')](_0x093c('0xa')),'closeReason':_0x093c('0xb'),'disposition':_0x32e283[0x0]};if(rpc[_0xec44c4['channel']+_0x093c('0xc')]){rpc[_0xec44c4['channel']+_0x093c('0xc')][_0x093c('0xd')](_0xec44c4[_0x093c('0xe')]['id'],_0x541a08)[_0x093c('0xf')](function(_0x4b8ad5){logger[_0x093c('0x10')](_0x093c('0x11'),_0x4a3fa7,_0xec44c4['interaction']['id']);})[_0x093c('0x12')](function(_0x13e428){logger[_0x093c('0x13')]('[%s][CLOSE]\x20%s',_0x4a3fa7,JSON[_0x093c('0x14')](_0x13e428));})[_0x093c('0x15')](function(){_0x354efc[_0x093c('0x16')]();});}}catch(_0x11cec7){logger[_0x093c('0x13')](_0x093c('0x17'),_0x4a3fa7,JSON['stringify'](_0x11cec7));_0x354efc[_0x093c('0x16')]();}};}; \ No newline at end of file +var _0xedc3=['moment','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','YYYY-MM-DD\x20HH:mm:ss','system','channel','update','interaction','then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','finally','stop','stringify'];(function(_0x19d0b6,_0x85209a){var _0x16060b=function(_0x33d5d3){while(--_0x33d5d3){_0x19d0b6['push'](_0x19d0b6['shift']());}};_0x16060b(++_0x85209a);}(_0xedc3,0x1b5));var _0x3edc=function(_0x2fee9b,_0x1144a8){_0x2fee9b=_0x2fee9b-0x0;var _0x5ed4ab=_0xedc3[_0x2fee9b];return _0x5ed4ab;};'use strict';var moment=require(_0x3edc('0x0'));var logger=require(_0x3edc('0x1'))('routing');var rpc={'chatInteraction':require(_0x3edc('0x2')),'openchannelInteraction':require(_0x3edc('0x3')),'smsInteraction':require(_0x3edc('0x4')),'mailInteraction':require(_0x3edc('0x5')),'faxInteraction':require(_0x3edc('0x6')),'whatsappInteraction':require(_0x3edc('0x7'))};exports[_0x3edc('0x8')]=function(_0x9ed16c,_0x809381,_0x126459,_0x26419d){return function(_0x4815f3){try{logger['info']('[%s][CLOSE]\x20reason\x20%s',_0x9ed16c,_0x809381[0x0]);var _0x2194f8={'closed':0x1,'closedAt':moment()['format'](_0x3edc('0x9')),'closeReason':_0x3edc('0xa'),'disposition':_0x809381[0x0]};if(rpc[_0x26419d[_0x3edc('0xb')]+'Interaction']){rpc[_0x26419d['channel']+'Interaction'][_0x3edc('0xc')](_0x26419d[_0x3edc('0xd')]['id'],_0x2194f8)[_0x3edc('0xe')](function(_0x4ffc73){logger[_0x3edc('0xf')](_0x3edc('0x10'),_0x9ed16c,_0x26419d[_0x3edc('0xd')]['id']);})[_0x3edc('0x11')](function(_0xe8b356){logger[_0x3edc('0x12')](_0x3edc('0x13'),_0x9ed16c,JSON['stringify'](_0xe8b356));})[_0x3edc('0x14')](function(){_0x4815f3[_0x3edc('0x15')]();});}}catch(_0x317d14){logger[_0x3edc('0x12')](_0x3edc('0x13'),_0x9ed16c,JSON[_0x3edc('0x16')](_0x317d14));_0x4815f3['stop']();}};}; \ 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 233d001..40dc8d8 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 _0xa381=['created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','finally','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment','speech','providerName','providerResponse','stringify','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa381,0x79));var _0x1a38=function(_0x241207,_0x39a50c){_0x241207=_0x241207-0x0;var _0x26f4ce=_0xa381[_0x241207];return _0x26f4ce;};'use strict';var _=require(_0x1a38('0x0'));var moment=require(_0x1a38('0x1'));var apiai=require('apiai-promise');var md5=require('md5');var utils=require(_0x1a38('0x2'));var logger=require(_0x1a38('0x3'))(_0x1a38('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x1a38('0x5')),'mailMessage':require(_0x1a38('0x6')),'smsMessage':require(_0x1a38('0x7')),'faxMessage':require(_0x1a38('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x1a38('0x9')]=function(_0x569e9f,_0x5c8ab1){return function(_0x3d12f8){try{if(!_['isNil'](this[_0x1a38('0xa')][_0x1a38('0xb')])){logger[_0x1a38('0xc')](_0x1a38('0xd'),_0x569e9f,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x3d12f8[_0x1a38('0xe')]();}var _0x314549={'ContactId':this[_0x1a38('0xf')]['id'],'sentAt':moment()[_0x1a38('0x10')](_0x1a38('0x11')),'direction':_0x1a38('0x12')};if(this[_0x1a38('0x13')]===_0x1a38('0x14')||this[_0x1a38('0x13')]===_0x1a38('0x15')){_0x314549[_0x1a38('0x16')]=this[_0x1a38('0xa')][_0x1a38('0x16')];}var _0x43321f=this[_0x1a38('0x13')];if(_0x43321f===_0x1a38('0x17')){_0x314549[_0x1a38('0x18')]=this[_0x1a38('0x19')]['id'];}else{_0x314549[_[_0x1a38('0x1a')](_0x43321f)+_0x1a38('0x1b')]=this[_0x1a38('0x19')]['id'];}_0x314549[_[_0x1a38('0x1a')](_0x43321f)+_0x1a38('0x1c')]=this['interaction']['id'];if(this['interaction'][_0x1a38('0x1d')]){var _0x542c73=_0x5c8ab1[0x2];if(!_[_0x1a38('0x1e')](_0x542c73)){_0x314549[_0x1a38('0x1f')]=utils[_0x1a38('0x20')](_0x542c73,this);return rpc[_0x43321f+_0x1a38('0x21')][_0x1a38('0x22')](_0x314549)[_0x1a38('0x23')](function(_0x408e8f){logger[_0x1a38('0xc')](_0x1a38('0xd'),_0x569e9f,_0x314549['body']);})[_0x1a38('0x24')](function(_0x4e76a7){logger[_0x1a38('0x25')](_0x1a38('0xd'),_0x569e9f,JSON['stringify'](_0x4e76a7));})[_0x1a38('0x26')](function(){logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x569e9f);_0x3d12f8[_0x1a38('0x27')]();});}else{logger[_0x1a38('0xc')](_0x1a38('0x28'),_0x569e9f);_0x3d12f8[_0x1a38('0x27')]();}}else{var _0x561fa4=this;var _0x391040=apiai(_0x5c8ab1[0x0],{'language':_0x5c8ab1[0x1]||'en'});return _0x391040[_0x1a38('0x29')](this[_0x1a38('0x2a')]['body'],{'sessionId':md5(this[_0x1a38('0xa')]['id'])})[_0x1a38('0x23')](function(_0x2877fe){_0x561fa4[_0x1a38('0x1f')][_0x1a38('0x2b')]=_0x2877fe;_0x314549[_0x1a38('0x1f')]=_0x2877fe[_0x1a38('0x2c')][_0x1a38('0x2d')][_0x1a38('0x2e')];_0x314549[_0x1a38('0x2f')]='dialogflow';_0x314549[_0x1a38('0x30')]=JSON['stringify'](_0x2877fe);return rpc[_0x43321f+_0x1a38('0x21')][_0x1a38('0x22')](_0x314549)['then'](function(_0x246e1f){logger['info'](_0x1a38('0xd'),_0x569e9f,_0x314549[_0x1a38('0x1f')]);if(_0x2877fe[_0x1a38('0x2c')]['metadata']['endConversation']){_0x3d12f8[_0x1a38('0xe')]();}else{_0x3d12f8[_0x1a38('0x27')]();}})[_0x1a38('0x24')](function(_0x45f54e){logger[_0x1a38('0x25')](_0x1a38('0xd'),_0x569e9f,JSON[_0x1a38('0x31')](_0x45f54e));_0x3d12f8[_0x1a38('0xe')]();});})['catch'](function(_0x5680bd){logger[_0x1a38('0x25')](_0x1a38('0xd'),_0x569e9f,_0x5680bd[_0x1a38('0x2a')]);_0x3d12f8[_0x1a38('0xe')]();});}}catch(_0x2b374e){logger[_0x1a38('0x25')](_0x1a38('0xd'),_0x569e9f,JSON['stringify'](_0x2b374e));_0x3d12f8[_0x1a38('0x27')]();}};}; \ No newline at end of file +var _0x4af9=['YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','chat','AccountId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','info','[%s][DIALOGFLOW]\x20%s','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','message','result','fulfillment','speech','providerName','dialogflow','providerResponse','metadata','endConversation','catch','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format'];(function(_0xd60ff2,_0x1f31cd){var _0x5befdc=function(_0x3347d0){while(--_0x3347d0){_0xd60ff2['push'](_0xd60ff2['shift']());}};_0x5befdc(++_0x1f31cd);}(_0x4af9,0x12c));var _0x94af=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4af9[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x94af('0x0'));var moment=require(_0x94af('0x1'));var apiai=require('apiai-promise');var md5=require('md5');var utils=require(_0x94af('0x2'));var logger=require(_0x94af('0x3'))(_0x94af('0x4'));var rpc={'chatMessage':require(_0x94af('0x5')),'openchannelMessage':require(_0x94af('0x6')),'mailMessage':require(_0x94af('0x7')),'smsMessage':require(_0x94af('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x94af('0x9'))};exports[_0x94af('0xa')]=function(_0x3e19c9,_0x3a64fa){return function(_0x5ad956){try{if(!_[_0x94af('0xb')](this[_0x94af('0xc')][_0x94af('0xd')])){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x3e19c9,_0x94af('0xe'));return _0x5ad956[_0x94af('0xf')]();}var _0x13cb35={'ContactId':this[_0x94af('0x10')]['id'],'sentAt':moment()[_0x94af('0x11')](_0x94af('0x12')),'direction':'out'};if(this[_0x94af('0x13')]===_0x94af('0x14')||this['channel']===_0x94af('0x15')){_0x13cb35[_0x94af('0x16')]=this[_0x94af('0xc')][_0x94af('0x16')];}var _0x137d2c=this['channel'];if(_0x137d2c===_0x94af('0x17')){_0x13cb35['ChatWebsiteId']=this['account']['id'];}else{_0x13cb35[_['upperFirst'](_0x137d2c)+_0x94af('0x18')]=this[_0x94af('0x19')]['id'];}_0x13cb35[_[_0x94af('0x1a')](_0x137d2c)+_0x94af('0x1b')]=this['interaction']['id'];if(this[_0x94af('0xc')][_0x94af('0x1c')]){var _0x539f74=_0x3a64fa[0x2];if(!_[_0x94af('0x1d')](_0x539f74)){_0x13cb35[_0x94af('0x1e')]=utils[_0x94af('0x1f')](_0x539f74,this);return rpc[_0x137d2c+_0x94af('0x20')][_0x94af('0x21')](_0x13cb35)[_0x94af('0x22')](function(_0x19369b){logger[_0x94af('0x23')](_0x94af('0x24'),_0x3e19c9,_0x13cb35[_0x94af('0x1e')]);})['catch'](function(_0x4f5944){logger[_0x94af('0x25')](_0x94af('0x24'),_0x3e19c9,JSON[_0x94af('0x26')](_0x4f5944));})[_0x94af('0x27')](function(){logger[_0x94af('0x23')](_0x94af('0x28'),_0x3e19c9);_0x5ad956['stop']();});}else{logger[_0x94af('0x23')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x3e19c9);_0x5ad956[_0x94af('0x29')]();}}else{var _0x587ddb=this;var _0xa0cf1a=apiai(_0x3a64fa[0x0],{'language':_0x3a64fa[0x1]||'en'});return _0xa0cf1a[_0x94af('0x2a')](this[_0x94af('0x2b')]['body'],{'sessionId':md5(this[_0x94af('0xc')]['id'])})[_0x94af('0x22')](function(_0x906599){_0x587ddb[_0x94af('0x1e')]['dialogflow']=_0x906599;_0x13cb35[_0x94af('0x1e')]=_0x906599[_0x94af('0x2c')][_0x94af('0x2d')][_0x94af('0x2e')];_0x13cb35[_0x94af('0x2f')]=_0x94af('0x30');_0x13cb35[_0x94af('0x31')]=JSON[_0x94af('0x26')](_0x906599);return rpc[_0x137d2c+_0x94af('0x20')]['create'](_0x13cb35)[_0x94af('0x22')](function(_0x55d34a){logger[_0x94af('0x23')](_0x94af('0x24'),_0x3e19c9,_0x13cb35[_0x94af('0x1e')]);if(_0x906599['result'][_0x94af('0x32')][_0x94af('0x33')]){_0x5ad956['next']();}else{_0x5ad956[_0x94af('0x29')]();}})[_0x94af('0x34')](function(_0x331fc9){logger[_0x94af('0x25')](_0x94af('0x24'),_0x3e19c9,JSON[_0x94af('0x26')](_0x331fc9));_0x5ad956['next']();});})[_0x94af('0x34')](function(_0x538a0b){logger['error'](_0x94af('0x24'),_0x3e19c9,_0x538a0b[_0x94af('0x2b')]);_0x5ad956[_0x94af('0xf')]();});}}catch(_0x1a0058){logger[_0x94af('0x25')]('[%s][DIALOGFLOW]\x20%s',_0x3e19c9,JSON[_0x94af('0x26')](_0x1a0058));_0x5ad956[_0x94af('0x29')]();}};}; \ 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 08c5e9e..df333d1 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 _0xf684=['isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','ChatWebsiteId','AccountId','InteractionId','created','isEmpty','finally','info','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','action','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','name','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','push','fulfillmentText','all','next','lodash','md5','bluebird','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','body','create','then','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence'];(function(_0x5a780c,_0x46304a){var _0x5097e7=function(_0x489962){while(--_0x489962){_0x5a780c['push'](_0x5a780c['shift']());}};_0x5097e7(++_0x46304a);}(_0xf684,0x1d9));var _0x4f68=function(_0x1b1149,_0x5d31d2){_0x1b1149=_0x1b1149-0x0;var _0xa0b52c=_0xf684[_0x1b1149];return _0xa0b52c;};'use strict';var _=require(_0x4f68('0x0'));var dialogflow=require('dialogflow');var md5=require(_0x4f68('0x1'));var moment=require('moment');var Promise=require(_0x4f68('0x2'));var logger=require('../../../../config/logger')('routing');var utils=require(_0x4f68('0x3'));var rpc={'chatMessage':require(_0x4f68('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x4f68('0x5')),'smsMessage':require(_0x4f68('0x6')),'faxMessage':require(_0x4f68('0x7')),'whatsappMessage':require(_0x4f68('0x8'))};function createMessage(_0x2ffcbc,_0x439a57,_0x573572,_0x476cd3){return new Promise(function(_0x528f90,_0x475dcf){var _0x4f2d3d=_['clone'](_0x573572);_0x4f2d3d[_0x4f68('0x9')]=_0x476cd3;return rpc[_0x439a57+'Message'][_0x4f68('0xa')](_0x4f2d3d)[_0x4f68('0xb')](function(){logger['info'](_0x4f68('0xc'),_0x2ffcbc,_0x4f2d3d[_0x4f68('0x9')]);_0x528f90();})[_0x4f68('0xd')](function(_0x42f620){logger[_0x4f68('0xe')](_0x4f68('0xc'),_0x2ffcbc,JSON[_0x4f68('0xf')](_0x42f620));_0x475dcf(_0x42f620);});});}exports[_0x4f68('0x10')]=function(_0x492728,_0x47b658){return function(_0x486cd6){try{if(!_[_0x4f68('0x11')](this[_0x4f68('0x12')][_0x4f68('0x13')])){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x492728,_0x4f68('0x14'));return _0x486cd6['next']();}var _0x3d7e1a={'ContactId':this[_0x4f68('0x15')]['id'],'sentAt':moment()[_0x4f68('0x16')](_0x4f68('0x17')),'direction':_0x4f68('0x18')};if(this[_0x4f68('0x19')]==='sms'||this['channel']===_0x4f68('0x1a')){_0x3d7e1a[_0x4f68('0x1b')]=this[_0x4f68('0x12')][_0x4f68('0x1b')];}var _0x2a513d=this[_0x4f68('0x19')];if(_0x2a513d===_0x4f68('0x1c')){_0x3d7e1a[_0x4f68('0x1d')]=this['account']['id'];}else{_0x3d7e1a[_['upperFirst'](_0x2a513d)+_0x4f68('0x1e')]=this['account']['id'];}_0x3d7e1a[_['upperFirst'](_0x2a513d)+_0x4f68('0x1f')]=this[_0x4f68('0x12')]['id'];if(this[_0x4f68('0x12')][_0x4f68('0x20')]){var _0x16c540=_0x47b658[0x4];if(!_[_0x4f68('0x21')](_0x16c540)){_0x3d7e1a[_0x4f68('0x9')]=utils['getMustacheRender'](_0x16c540,this);return rpc[_0x2a513d+'Message'][_0x4f68('0xa')](_0x3d7e1a)[_0x4f68('0xb')](function(_0xfaac70){logger['info'](_0x4f68('0xc'),_0x492728,_0x3d7e1a[_0x4f68('0x9')]);})['catch'](function(_0x48712a){logger[_0x4f68('0xe')](_0x4f68('0xc'),_0x492728,JSON[_0x4f68('0xf')](_0x48712a));})[_0x4f68('0x22')](function(){logger[_0x4f68('0x23')](_0x4f68('0x24'),_0x492728);_0x486cd6[_0x4f68('0x25')]();});}else{logger['info'](_0x4f68('0x26'),_0x492728);_0x486cd6[_0x4f68('0x25')]();}}else{var _0x15443f=this;var _0x1f2e75=_0x47b658[0x2]['replace'](/\\n/g,'\x0a');var _0x1a8e2a={'credentials':{'private_key':_0x1f2e75,'client_email':_0x47b658[0x1]}};var _0x5c54e0=new dialogflow[(_0x4f68('0x27'))](_0x1a8e2a);var _0x454f24=_0x5c54e0[_0x4f68('0x28')](_0x47b658[0x0],md5(_0x15443f[_0x4f68('0x12')]['id']));var _0x19630a={'session':_0x454f24,'queryInput':{'text':{'text':_0x15443f[_0x4f68('0x29')][_0x4f68('0x9')],'languageCode':_0x47b658[0x3]||'en'}}};return _0x5c54e0[_0x4f68('0x2a')](_0x19630a)[_0x4f68('0xb')](function(_0x464833){if(_0x464833&&_0x464833[_0x4f68('0x2b')]){_0x15443f[_0x4f68('0x9')][_0x4f68('0x2c')]=_0x464833;var _0x291dbd=_0x464833[0x0];var _0x102c0b=_0x291dbd[_0x4f68('0x2d')][_0x4f68('0x2e')]&&_0x291dbd[_0x4f68('0x2d')][_0x4f68('0x2e')][_0x4f68('0x2f')]?_0x291dbd[_0x4f68('0x2d')]['diagnosticInfo'][_0x4f68('0x2f')][_0x4f68('0x30')][_0x4f68('0x31')]:![];_0x15443f[_0x4f68('0x9')]['DIALOGFLOWV2_ACTION']=_0x291dbd[_0x4f68('0x2d')][_0x4f68('0x32')];_0x15443f[_0x4f68('0x9')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x291dbd[_0x4f68('0x2d')]['allRequiredParamsPresent'];_0x15443f[_0x4f68('0x9')][_0x4f68('0x33')]=_0x291dbd[_0x4f68('0x2d')][_0x4f68('0x2e')]&&_0x291dbd[_0x4f68('0x2d')]['diagnosticInfo'][_0x4f68('0x2f')]?_0x291dbd[_0x4f68('0x2d')][_0x4f68('0x2e')][_0x4f68('0x2f')]['end_conversation']['boolValue']:![];_0x15443f[_0x4f68('0x9')][_0x4f68('0x34')]=_0x291dbd[_0x4f68('0x2d')]['intent'][_0x4f68('0x35')];_0x15443f[_0x4f68('0x9')][_0x4f68('0x36')]=_0x291dbd[_0x4f68('0x2d')][_0x4f68('0x37')][_0x4f68('0x38')];_0x15443f[_0x4f68('0x9')][_0x4f68('0x39')]=_0x291dbd['queryResult']['intent'][_0x4f68('0x3a')];_0x15443f[_0x4f68('0x9')][_0x4f68('0x3b')]=_0x291dbd[_0x4f68('0x2d')]['languageCode'];_0x15443f[_0x4f68('0x9')][_0x4f68('0x3c')]=_0x291dbd[_0x4f68('0x2d')][_0x4f68('0x3d')];_0x15443f[_0x4f68('0x9')][_0x4f68('0x3e')]=_0x291dbd[_0x4f68('0x2d')][_0x4f68('0x3f')];_0x3d7e1a[_0x4f68('0x40')]=_0x4f68('0x2c');_0x3d7e1a[_0x4f68('0x41')]=JSON[_0x4f68('0xf')](_0x464833);var _0x58c48d=[];for(var _0x2ea873=0x0;_0x2ea873<_0x464833['length'];_0x2ea873++){var _0x378eff=_0x464833[_0x2ea873];if(_0x378eff&&_0x378eff[_0x4f68('0x2d')]&&_0x378eff[_0x4f68('0x2d')]['fulfillmentText']){_0x58c48d[_0x4f68('0x42')](createMessage(_0x492728,_0x2a513d,_0x3d7e1a,_0x378eff[_0x4f68('0x2d')][_0x4f68('0x43')]));}}return Promise[_0x4f68('0x44')](_0x58c48d)[_0x4f68('0xb')](function(){if(_0x102c0b){_0x486cd6[_0x4f68('0x45')]();}else{_0x486cd6[_0x4f68('0x25')]();}})[_0x4f68('0xd')](function(_0x5becf0){logger[_0x4f68('0xe')](_0x4f68('0xc'),_0x492728,JSON[_0x4f68('0xf')](_0x5becf0));_0x486cd6['next']();});}})[_0x4f68('0xd')](function(_0x2f39db){logger['error'](_0x4f68('0xc'),_0x492728,_0x2f39db['message']);_0x486cd6[_0x4f68('0x45')]();});}}catch(_0x31461e){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x492728,JSON[_0x4f68('0xf')](_0x31461e));_0x486cd6[_0x4f68('0x25')]();}};}; \ No newline at end of file +var _0xdb4a=['consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','chat','account','AccountId','upperFirst','InteractionId','created','isEmpty','getMustacheRender','then','error','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','DIALOGFLOWV2_INTENTNAME','name','intent','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','providerName','providerResponse','fulfillmentText','push','all','lodash','dialogflow','md5','moment','bluebird','routing','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','Message','create','info','body','catch','[%s][DIALOGFLOWV2]\x20%s','stringify'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xdb4a,0x1ba));var _0xadb4=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xdb4a[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0xadb4('0x0'));var dialogflow=require(_0xadb4('0x1'));var md5=require(_0xadb4('0x2'));var moment=require(_0xadb4('0x3'));var Promise=require(_0xadb4('0x4'));var logger=require('../../../../config/logger')(_0xadb4('0x5'));var utils=require(_0xadb4('0x6'));var rpc={'chatMessage':require(_0xadb4('0x7')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xadb4('0x8')),'smsMessage':require(_0xadb4('0x9')),'faxMessage':require(_0xadb4('0xa')),'whatsappMessage':require(_0xadb4('0xb'))};function createMessage(_0x577d89,_0x395712,_0x2e6080,_0x46a4e5){return new Promise(function(_0x38b1e3,_0x543f9a){var _0x222558=_[_0xadb4('0xc')](_0x2e6080);_0x222558['body']=_0x46a4e5;return rpc[_0x395712+_0xadb4('0xd')][_0xadb4('0xe')](_0x222558)['then'](function(){logger[_0xadb4('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x577d89,_0x222558[_0xadb4('0x10')]);_0x38b1e3();})[_0xadb4('0x11')](function(_0x2d0744){logger['error'](_0xadb4('0x12'),_0x577d89,JSON[_0xadb4('0x13')](_0x2d0744));_0x543f9a(_0x2d0744);});});}exports[_0xadb4('0x14')]=function(_0x17e7c8,_0x2e9b61){return function(_0x4849da){try{if(!_[_0xadb4('0x15')](this[_0xadb4('0x16')][_0xadb4('0x17')])){logger[_0xadb4('0xf')](_0xadb4('0x12'),_0x17e7c8,_0xadb4('0x18'));return _0x4849da[_0xadb4('0x19')]();}var _0x26c550={'ContactId':this[_0xadb4('0x1a')]['id'],'sentAt':moment()[_0xadb4('0x1b')](_0xadb4('0x1c')),'direction':'out'};if(this[_0xadb4('0x1d')]===_0xadb4('0x1e')||this['channel']===_0xadb4('0x1f')){_0x26c550['phone']=this[_0xadb4('0x16')][_0xadb4('0x20')];}var _0x46d4e8=this[_0xadb4('0x1d')];if(_0x46d4e8===_0xadb4('0x21')){_0x26c550['ChatWebsiteId']=this[_0xadb4('0x22')]['id'];}else{_0x26c550[_['upperFirst'](_0x46d4e8)+_0xadb4('0x23')]=this[_0xadb4('0x22')]['id'];}_0x26c550[_[_0xadb4('0x24')](_0x46d4e8)+_0xadb4('0x25')]=this[_0xadb4('0x16')]['id'];if(this[_0xadb4('0x16')][_0xadb4('0x26')]){var _0xb857be=_0x2e9b61[0x4];if(!_[_0xadb4('0x27')](_0xb857be)){_0x26c550['body']=utils[_0xadb4('0x28')](_0xb857be,this);return rpc[_0x46d4e8+_0xadb4('0xd')]['create'](_0x26c550)[_0xadb4('0x29')](function(_0x17a7bc){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x17e7c8,_0x26c550[_0xadb4('0x10')]);})[_0xadb4('0x11')](function(_0xa2d339){logger[_0xadb4('0x2a')](_0xadb4('0x12'),_0x17e7c8,JSON[_0xadb4('0x13')](_0xa2d339));})[_0xadb4('0x2b')](function(){logger[_0xadb4('0xf')](_0xadb4('0x2c'),_0x17e7c8);_0x4849da[_0xadb4('0x2d')]();});}else{logger[_0xadb4('0xf')](_0xadb4('0x2e'),_0x17e7c8);_0x4849da[_0xadb4('0x2d')]();}}else{var _0x587864=this;var _0x254778=_0x2e9b61[0x2][_0xadb4('0x2f')](/\\n/g,'\x0a');var _0xa1a145={'credentials':{'private_key':_0x254778,'client_email':_0x2e9b61[0x1]}};var _0x385b2b=new dialogflow[(_0xadb4('0x30'))](_0xa1a145);var _0x1cbc0d=_0x385b2b['sessionPath'](_0x2e9b61[0x0],md5(_0x587864[_0xadb4('0x16')]['id']));var _0x45dafe={'session':_0x1cbc0d,'queryInput':{'text':{'text':_0x587864[_0xadb4('0x31')][_0xadb4('0x10')],'languageCode':_0x2e9b61[0x3]||'en'}}};return _0x385b2b[_0xadb4('0x32')](_0x45dafe)[_0xadb4('0x29')](function(_0x191a3b){if(_0x191a3b&&_0x191a3b[_0xadb4('0x33')]){_0x587864['body'][_0xadb4('0x34')]=_0x191a3b;var _0xd7e656=_0x191a3b[0x0];var _0x38d0f7=_0xd7e656[_0xadb4('0x35')][_0xadb4('0x36')]&&_0xd7e656[_0xadb4('0x35')][_0xadb4('0x36')]['fields']?_0xd7e656[_0xadb4('0x35')][_0xadb4('0x36')][_0xadb4('0x37')]['end_conversation'][_0xadb4('0x38')]:![];_0x587864['body'][_0xadb4('0x39')]=_0xd7e656[_0xadb4('0x35')][_0xadb4('0x3a')];_0x587864[_0xadb4('0x10')][_0xadb4('0x3b')]=_0xd7e656[_0xadb4('0x35')][_0xadb4('0x3c')];_0x587864[_0xadb4('0x10')][_0xadb4('0x3d')]=_0xd7e656[_0xadb4('0x35')]['diagnosticInfo']&&_0xd7e656['queryResult'][_0xadb4('0x36')]['fields']?_0xd7e656['queryResult'][_0xadb4('0x36')][_0xadb4('0x37')][_0xadb4('0x3e')]['boolValue']:![];_0x587864['body'][_0xadb4('0x3f')]=_0xd7e656[_0xadb4('0x35')]['intent'][_0xadb4('0x40')];_0x587864[_0xadb4('0x10')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0xd7e656[_0xadb4('0x35')][_0xadb4('0x41')]['displayName'];_0x587864[_0xadb4('0x10')][_0xadb4('0x42')]=_0xd7e656[_0xadb4('0x35')][_0xadb4('0x41')][_0xadb4('0x43')];_0x587864[_0xadb4('0x10')][_0xadb4('0x44')]=_0xd7e656[_0xadb4('0x35')][_0xadb4('0x45')];_0x587864['body'][_0xadb4('0x46')]=_0xd7e656[_0xadb4('0x35')]['queryText'];_0x587864['body'][_0xadb4('0x47')]=_0xd7e656[_0xadb4('0x35')]['intentDetectionConfidence'];_0x26c550[_0xadb4('0x48')]=_0xadb4('0x34');_0x26c550[_0xadb4('0x49')]=JSON[_0xadb4('0x13')](_0x191a3b);var _0x5b5d17=[];for(var _0x525a00=0x0;_0x525a00<_0x191a3b[_0xadb4('0x33')];_0x525a00++){var _0x5952cd=_0x191a3b[_0x525a00];if(_0x5952cd&&_0x5952cd[_0xadb4('0x35')]&&_0x5952cd[_0xadb4('0x35')][_0xadb4('0x4a')]){_0x5b5d17[_0xadb4('0x4b')](createMessage(_0x17e7c8,_0x46d4e8,_0x26c550,_0x5952cd['queryResult'][_0xadb4('0x4a')]));}}return Promise[_0xadb4('0x4c')](_0x5b5d17)[_0xadb4('0x29')](function(){if(_0x38d0f7){_0x4849da['next']();}else{_0x4849da['stop']();}})[_0xadb4('0x11')](function(_0x1cacf7){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x17e7c8,JSON[_0xadb4('0x13')](_0x1cacf7));_0x4849da[_0xadb4('0x19')]();});}})[_0xadb4('0x11')](function(_0x361ef5){logger[_0xadb4('0x2a')]('[%s][DIALOGFLOWV2]\x20%s',_0x17e7c8,_0x361ef5[_0xadb4('0x31')]);_0x4849da[_0xadb4('0x19')]();});}}catch(_0xe45fa5){logger[_0xadb4('0x2a')](_0xadb4('0x12'),_0x17e7c8,JSON['stringify'](_0xe45fa5));_0x4849da['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index bf7285f..b8c6c65 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 _0xaa5b=['stringify','./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','validate','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20eval\x20error:\x20%s'];(function(_0x53c256,_0x382a24){var _0x25feb6=function(_0x2652fd){while(--_0x2652fd){_0x53c256['push'](_0x53c256['shift']());}};_0x25feb6(++_0x382a24);}(_0xaa5b,0x146));var _0xbaa5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaa5b[_0x20a584];return _0x4b41a8;};'use strict';var schema=require('validate');var _=require('lodash');var htmlToText=require('html-to-text');var utils=require(_0xbaa5('0x0'));var logger=require('../../../../config/logger')(_0xbaa5('0x1'));var gotoif=schema({'condition':{'type':_0xbaa5('0x2'),'required':!![],'message':_0xbaa5('0x3')},'priorityTrue':{'type':_0xbaa5('0x4'),'message':_0xbaa5('0x5')},'priorityFalse':{'type':_0xbaa5('0x4'),'message':_0xbaa5('0x6')}});exports['consequence']=function(_0x311129,_0x5deb09){return function(_0x2dae7e){try{var _0x84cb36={'condition':htmlToText['fromString'](utils['getMustacheRender'](_0x5deb09[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x5deb09[0x1],'priorityFalse':_0x5deb09[0x2]};var _0x43094c=gotoif[_0xbaa5('0x7')](_0x84cb36,{'typecast':!![]});if(_0x43094c['length']){logger['error'](_0xbaa5('0x8'),_0x311129,_[_0xbaa5('0x9')](_0x43094c,_0xbaa5('0xa'))[_0xbaa5('0xb')](',\x20'));_0x2dae7e[_0xbaa5('0xc')]();}else{try{var _0x430262=eval('('+_0x84cb36[_0xbaa5('0xd')]+')');var _0x2825b4=_0x430262?_0x84cb36['priorityTrue']:_0x84cb36[_0xbaa5('0xe')];logger[_0xbaa5('0xf')](_0xbaa5('0x10'),_0x311129,_0x84cb36[_0xbaa5('0xd')],_0x430262,_0x2825b4||_0xbaa5('0x11'));if(_0x2825b4){var _0x46f002=_[_0xbaa5('0x12')](_0x2dae7e[_0xbaa5('0x13')](),{'p':_0x2825b4});if(_0x46f002>=0x0){logger[_0xbaa5('0xf')](_0xbaa5('0x14'),_0x311129,_0x2825b4||'next',_0x46f002);_0x2dae7e['next'](_0x46f002);}else{logger[_0xbaa5('0xf')](_0xbaa5('0x15'),_0x311129,_0x2825b4||_0xbaa5('0x11'));_0x2dae7e['stop']();}}else{_0x2dae7e[_0xbaa5('0x11')]();}}catch(_0x274ba8){logger[_0xbaa5('0x16')](_0xbaa5('0x17'),_0x311129,_0x274ba8[_0xbaa5('0xa')]);_0x2dae7e[_0xbaa5('0xc')]();}}}catch(_0x296d89){logger[_0xbaa5('0x16')](_0xbaa5('0x8'),_0x311129,JSON[_0xbaa5('0x18')](_0x296d89));_0x2dae7e[_0xbaa5('0xc')]();}};}; \ No newline at end of file +var _0xeebb=['map','join','stop','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','validate','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','replace','length','error','[%s][GOTOIF]\x20%s'];(function(_0x570a5d,_0x5aefc3){var _0x1bedf8=function(_0x3d1e1d){while(--_0x3d1e1d){_0x570a5d['push'](_0x570a5d['shift']());}};_0x1bedf8(++_0x5aefc3);}(_0xeebb,0x111));var _0xbeeb=function(_0x4bb830,_0x4cc407){_0x4bb830=_0x4bb830-0x0;var _0x507d5f=_0xeebb[_0x4bb830];return _0x507d5f;};'use strict';var schema=require(_0xbeeb('0x0'));var _=require('lodash');var htmlToText=require('html-to-text');var utils=require('./utils');var logger=require(_0xbeeb('0x1'))(_0xbeeb('0x2'));var gotoif=schema({'condition':{'type':_0xbeeb('0x3'),'required':!![],'message':_0xbeeb('0x4')},'priorityTrue':{'type':_0xbeeb('0x5'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0xbeeb('0x5'),'message':_0xbeeb('0x6')}});exports[_0xbeeb('0x7')]=function(_0x42fd80,_0x15c0ec){return function(_0x3a5911){try{var _0x39a785={'condition':htmlToText[_0xbeeb('0x8')](utils['getMustacheRender'](_0x15c0ec[0x0],this),{'wordwrap':![]})[_0xbeeb('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x15c0ec[0x1],'priorityFalse':_0x15c0ec[0x2]};var _0x275056=gotoif[_0xbeeb('0x0')](_0x39a785,{'typecast':!![]});if(_0x275056[_0xbeeb('0xa')]){logger[_0xbeeb('0xb')](_0xbeeb('0xc'),_0x42fd80,_[_0xbeeb('0xd')](_0x275056,'message')[_0xbeeb('0xe')](',\x20'));_0x3a5911[_0xbeeb('0xf')]();}else{try{var _0x440d94=eval('('+_0x39a785['condition']+')');var _0x850140=_0x440d94?_0x39a785[_0xbeeb('0x10')]:_0x39a785[_0xbeeb('0x11')];logger[_0xbeeb('0x12')](_0xbeeb('0x13'),_0x42fd80,_0x39a785['condition'],_0x440d94,_0x850140||_0xbeeb('0x14'));if(_0x850140){var _0x4ce998=_[_0xbeeb('0x15')](_0x3a5911[_0xbeeb('0x16')](),{'p':_0x850140});if(_0x4ce998>=0x0){logger[_0xbeeb('0x12')](_0xbeeb('0x17'),_0x42fd80,_0x850140||'next',_0x4ce998);_0x3a5911[_0xbeeb('0x14')](_0x4ce998);}else{logger[_0xbeeb('0x12')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x42fd80,_0x850140||_0xbeeb('0x14'));_0x3a5911[_0xbeeb('0xf')]();}}else{_0x3a5911['next']();}}catch(_0x1a1cba){logger[_0xbeeb('0xb')](_0xbeeb('0x18'),_0x42fd80,_0x1a1cba[_0xbeeb('0x19')]);_0x3a5911[_0xbeeb('0xf')]();}}}catch(_0x49b795){logger['error'](_0xbeeb('0xc'),_0x42fd80,JSON['stringify'](_0x49b795));_0x3a5911[_0xbeeb('0xf')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 3a50727..16d14d6 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 _0x27fb=['stop','info','priority','rules','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','message','join'];(function(_0x4c7f43,_0x982a42){var _0xe62220=function(_0x548ad3){while(--_0x548ad3){_0x4c7f43['push'](_0x4c7f43['shift']());}};_0xe62220(++_0x982a42);}(_0x27fb,0x1d7));var _0xb27f=function(_0x53b02a,_0x1dc770){_0x53b02a=_0x53b02a-0x0;var _0x4f4566=_0x27fb[_0x53b02a];return _0x4f4566;};'use strict';var schema=require(_0xb27f('0x0'));var _=require('lodash');var logger=require('../../../../config/logger')(_0xb27f('0x1'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0xb27f('0x2')}});exports[_0xb27f('0x3')]=function(_0x5ae9ac,_0x483ff2){return function(_0x49447c){try{var _0x5a246e={'priority':_0x483ff2[0x0]};var _0x169230=gotop[_0xb27f('0x0')](_0x5a246e,{'typecast':!![]});if(_0x169230[_0xb27f('0x4')]){logger[_0xb27f('0x5')](_0xb27f('0x6'),_0x5ae9ac,_['map'](_0x169230,_0xb27f('0x7'))[_0xb27f('0x8')](',\x20'));_0x49447c[_0xb27f('0x9')]();}else{logger[_0xb27f('0xa')]('[%s][GOTOP]\x20priority\x20%s',_0x5ae9ac,_0x5a246e['priority']);if(_0x5a246e[_0xb27f('0xb')]){var _0x455ad3=_['findIndex'](_0x49447c[_0xb27f('0xc')](),{'p':_0x5a246e['priority']});if(_0x455ad3>=0x0){logger['info']('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x5ae9ac,_0x5a246e[_0xb27f('0xb')]||'next',_0x455ad3);_0x49447c[_0xb27f('0xd')](_0x455ad3);}else{logger[_0xb27f('0xa')](_0xb27f('0xe'),_0x5ae9ac,_0x5a246e[_0xb27f('0xb')]||'next');_0x49447c[_0xb27f('0x9')]();}}else{_0x49447c['next']();}}}catch(_0xf8b56d){logger[_0xb27f('0x5')](_0xb27f('0x6'),_0x5ae9ac,JSON['stringify'](_0xf8b56d));_0x49447c['stop']();}};}; \ No newline at end of file +var _0x3283=['validate','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','[%s][GOTOP]\x20priority\x20%s','priority','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'];(function(_0x35b7d4,_0x5a5c43){var _0x4e8cee=function(_0x66859c){while(--_0x66859c){_0x35b7d4['push'](_0x35b7d4['shift']());}};_0x4e8cee(++_0x5a5c43);}(_0x3283,0x14b));var _0x3328=function(_0xb99a06,_0xa5f36f){_0xb99a06=_0xb99a06-0x0;var _0x586176=_0x3283[_0xb99a06];return _0x586176;};'use strict';var schema=require('validate');var _=require(_0x3328('0x0'));var logger=require(_0x3328('0x1'))(_0x3328('0x2'));var gotop=schema({'priority':{'type':_0x3328('0x3'),'required':!![],'message':_0x3328('0x4')}});exports['consequence']=function(_0x3b1fd2,_0x3af372){return function(_0x5968ea){try{var _0x4f429e={'priority':_0x3af372[0x0]};var _0x395d38=gotop[_0x3328('0x5')](_0x4f429e,{'typecast':!![]});if(_0x395d38[_0x3328('0x6')]){logger[_0x3328('0x7')](_0x3328('0x8'),_0x3b1fd2,_[_0x3328('0x9')](_0x395d38,_0x3328('0xa'))[_0x3328('0xb')](',\x20'));_0x5968ea[_0x3328('0xc')]();}else{logger['info'](_0x3328('0xd'),_0x3b1fd2,_0x4f429e[_0x3328('0xe')]);if(_0x4f429e[_0x3328('0xe')]){var _0x5fbf2=_['findIndex'](_0x5968ea[_0x3328('0xf')](),{'p':_0x4f429e[_0x3328('0xe')]});if(_0x5fbf2>=0x0){logger[_0x3328('0x10')](_0x3328('0x11'),_0x3b1fd2,_0x4f429e[_0x3328('0xe')]||_0x3328('0x12'),_0x5fbf2);_0x5968ea[_0x3328('0x12')](_0x5fbf2);}else{logger[_0x3328('0x10')](_0x3328('0x13'),_0x3b1fd2,_0x4f429e[_0x3328('0xe')]||'next');_0x5968ea['stop']();}}else{_0x5968ea[_0x3328('0x12')]();}}}catch(_0x3579fd){logger[_0x3328('0x7')](_0x3328('0x8'),_0x3b1fd2,JSON[_0x3328('0x14')](_0x3579fd));_0x5968ea[_0x3328('0xc')]();}};}; \ 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 15307cb..1fb4be0 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 _0x764e=['../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','contact','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','interaction','create','then','info','catch','error','stop','./utils','../../../../config/logger','routing'];(function(_0x449f8a,_0x5a1ba0){var _0x18c9b1=function(_0x387e9c){while(--_0x387e9c){_0x449f8a['push'](_0x449f8a['shift']());}};_0x18c9b1(++_0x5a1ba0);}(_0x764e,0x16d));var _0xe764=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x764e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var utils=require(_0xe764('0x0'));var logger=require(_0xe764('0x1'))(_0xe764('0x2'));var rpc={'chatMessage':require(_0xe764('0x3')),'openchannelMessage':require(_0xe764('0x4')),'mailMessage':require(_0xe764('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xe764('0x6')),'whatsappMessage':require(_0xe764('0x7'))};exports[_0xe764('0x8')]=function(_0x564d1c,_0x11b53e){return function(_0x158ec2){try{var _0x251427={'body':utils['getMustacheRender'](_0x11b53e[0x0],this),'ContactId':this[_0xe764('0x9')]['id']};if(this[_0xe764('0xa')]===_0xe764('0xb')){_0x251427[_0xe764('0xc')]=this[_0xe764('0xd')]['id'];}else{_0x251427[_[_0xe764('0xe')](this['channel'])+'AccountId']=this[_0xe764('0xd')]['id'];}_0x251427[_[_0xe764('0xe')](this[_0xe764('0xa')])+_0xe764('0xf')]=this[_0xe764('0x10')]['id'];if(rpc[this[_0xe764('0xa')]+'Message']){return rpc[this['channel']+'Message'][_0xe764('0x11')](_0x251427)[_0xe764('0x12')](function(_0x4af46f){logger[_0xe764('0x13')]('[%s][MESSAGE]\x20%s',_0x564d1c,_0x251427['body']);_0x158ec2['next']();})[_0xe764('0x14')](function(_0x52505f){logger[_0xe764('0x15')]('[%s][MESSAGE]\x20%s',_0x564d1c,JSON['stringify'](_0x52505f));_0x158ec2[_0xe764('0x16')]();});}}catch(_0x553e54){logger[_0xe764('0x15')]('[%s][MESSAGE]\x20%s',_0x564d1c,JSON['stringify'](_0x553e54));_0x158ec2[_0xe764('0x16')]();}};}; \ No newline at end of file +var _0xfb71=['contact','chat','ChatWebsiteId','upperFirst','channel','AccountId','account','Message','create','then','body','[%s][MESSAGE]\x20%s','stringify','stop','error','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender'];(function(_0x59f655,_0x1c12aa){var _0x1dbb6e=function(_0x3f048a){while(--_0x3f048a){_0x59f655['push'](_0x59f655['shift']());}};_0x1dbb6e(++_0x1c12aa);}(_0xfb71,0x1ef));var _0x1fb7=function(_0x2536f2,_0x2d3363){_0x2536f2=_0x2536f2-0x0;var _0x5c9daa=_0xfb71[_0x2536f2];return _0x5c9daa;};'use strict';var _=require(_0x1fb7('0x0'));var utils=require(_0x1fb7('0x1'));var logger=require(_0x1fb7('0x2'))(_0x1fb7('0x3'));var rpc={'chatMessage':require(_0x1fb7('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x1fb7('0x5')),'faxMessage':require(_0x1fb7('0x6')),'whatsappMessage':require(_0x1fb7('0x7'))};exports['consequence']=function(_0x45ed1c,_0x29532a){return function(_0x2babe0){try{var _0x2112f8={'body':utils[_0x1fb7('0x8')](_0x29532a[0x0],this),'ContactId':this[_0x1fb7('0x9')]['id']};if(this['channel']===_0x1fb7('0xa')){_0x2112f8[_0x1fb7('0xb')]=this['account']['id'];}else{_0x2112f8[_[_0x1fb7('0xc')](this[_0x1fb7('0xd')])+_0x1fb7('0xe')]=this[_0x1fb7('0xf')]['id'];}_0x2112f8[_[_0x1fb7('0xc')](this[_0x1fb7('0xd')])+'InteractionId']=this['interaction']['id'];if(rpc[this[_0x1fb7('0xd')]+_0x1fb7('0x10')]){return rpc[this[_0x1fb7('0xd')]+'Message'][_0x1fb7('0x11')](_0x2112f8)[_0x1fb7('0x12')](function(_0x3cc07d){logger['info']('[%s][MESSAGE]\x20%s',_0x45ed1c,_0x2112f8[_0x1fb7('0x13')]);_0x2babe0['next']();})['catch'](function(_0x1b333b){logger['error'](_0x1fb7('0x14'),_0x45ed1c,JSON[_0x1fb7('0x15')](_0x1b333b));_0x2babe0[_0x1fb7('0x16')]();});}}catch(_0x5a010a){logger[_0x1fb7('0x17')](_0x1fb7('0x14'),_0x45ed1c,JSON[_0x1fb7('0x15')](_0x5a010a));_0x2babe0[_0x1fb7('0x16')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index ba9dd99..ed83369 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 _0xc186=['next','error','stop','../../../../config/logger','routing','consequence','[%s][NOOP]\x20%s','getMustacheRender'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc186,0x73));var _0x6c18=function(_0x2100da,_0x245180){_0x2100da=_0x2100da-0x0;var _0x16a262=_0xc186[_0x2100da];return _0x16a262;};'use strict';var utils=require('./utils');var logger=require(_0x6c18('0x0'))(_0x6c18('0x1'));exports[_0x6c18('0x2')]=function(_0x2c9cb4,_0x27b71f){return function(_0x57e1ec){try{logger['info'](_0x6c18('0x3'),_0x2c9cb4,utils[_0x6c18('0x4')](_0x27b71f[0x0],this));_0x57e1ec[_0x6c18('0x5')]();}catch(_0x88742){logger[_0x6c18('0x6')](_0x6c18('0x3'),_0x2c9cb4,JSON['stringify'](_0x88742));_0x57e1ec[_0x6c18('0x7')]();}};}; \ No newline at end of file +var _0x4818=['./utils','../../../../config/logger','routing','getMustacheRender','next','error','[%s][NOOP]\x20%s','stop'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x4818,0x158));var _0x8481=function(_0x25ca20,_0x344917){_0x25ca20=_0x25ca20-0x0;var _0x1337b9=_0x4818[_0x25ca20];return _0x1337b9;};'use strict';var utils=require(_0x8481('0x0'));var logger=require(_0x8481('0x1'))(_0x8481('0x2'));exports['consequence']=function(_0x3d21c2,_0x362429){return function(_0x20e89e){try{logger['info']('[%s][NOOP]\x20%s',_0x3d21c2,utils[_0x8481('0x3')](_0x362429[0x0],this));_0x20e89e[_0x8481('0x4')]();}catch(_0x3d2445){logger[_0x8481('0x5')](_0x8481('0x6'),_0x3d21c2,JSON['stringify'](_0x3d2445));_0x20e89e[_0x8481('0x7')]();}};}; \ 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 d5d8338..2570e25 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 _0x079f=['pick','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','from','contact','list','upperFirst','QueueId','InteractionId','channel','message','chat','AccountId','WebsiteId','account','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','info','[%s][STOP:QUEUE][NAME:%s]','error','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','join','find','Queues','timeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','complete','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stop','log','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','queue','clone','format'];(function(_0x59296b,_0x5af6af){var _0xb0332a=function(_0x443cf6){while(--_0x443cf6){_0x59296b['push'](_0x59296b['shift']());}};_0xb0332a(++_0x5af6af);}(_0x079f,0x17a));var _0xf079=function(_0x11c4b6,_0x572fdb){_0x11c4b6=_0x11c4b6-0x0;var _0x2cb405=_0x079f[_0x11c4b6];return _0x2cb405;};'use strict';var schema=require(_0xf079('0x0'));var _=require(_0xf079('0x1'));var util=require(_0xf079('0x2'));var seqqueue=require(_0xf079('0x3'));var moment=require(_0xf079('0x4'));var Redis=require(_0xf079('0x5'));var config=require(_0xf079('0x6'));var logger=require(_0xf079('0x7'))('routing');var strategy=require(_0xf079('0x8'));config[_0xf079('0x9')]=_[_0xf079('0xa')](config[_0xf079('0x9')],{'host':_0xf079('0xb'),'port':0x18eb});var io=require(_0xf079('0xc'))(new Redis(config[_0xf079('0x9')]));var attributes=['id',_0xf079('0xd'),'account',_0xf079('0xe'),'from','joinAt'];function emit(_0x3ffe92,_0x2950c3,_0x1bde9f){io['to'](_0x3ffe92)['emit'](_0x2950c3,_0x1bde9f);}function emitChannelQueueInteraction(_0x3b6505,_0x25568d,_0x503723,_0x3bb81d,_0x4cacc5,_0x41c4e6,_0x45db06,_0x435833){var _0x1077ef=_[_0xf079('0xf')](_0x503723);_0x1077ef[_0xf079('0xd')]=_0x435833;_0x1077ef[_0xf079('0xe')]=_0x25568d;_0x1077ef['account']=_0x3bb81d;_0x1077ef['id']=_0x4cacc5;if(_0x41c4e6){_0x45db06[util[_0xf079('0x10')]('%sQueuesWaitingInteractions',_0x3b6505)][_0x4cacc5]=_[_0xf079('0x11')](_0x1077ef,attributes);}else{delete _0x45db06[util[_0xf079('0x10')](_0xf079('0x12'),_0x3b6505)][_0x4cacc5];}emit(util[_0xf079('0x10')](_0xf079('0x13'),_0x3b6505,_0x25568d),util['format'](_0xf079('0x14'),_0x3b6505,_0x41c4e6?_0xf079('0x15'):_0xf079('0x16')),_[_0xf079('0x11')](_0x1077ef,attributes));}var rpc={'openchannelQueueReport':require(_0xf079('0x17')),'mailQueueReport':require(_0xf079('0x18')),'chatQueueReport':require(_0xf079('0x19')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0xf079('0x1a')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xf079('0x1b'),'required':!![],'message':_0xf079('0x1c')},'timeout':{'type':_0xf079('0x1d'),'message':_0xf079('0x1e')}});function startRouting(_0x4979f8,_0x4ae123,_0xcb5b9c,_0x598ead){if(_0x4979f8&&_0x4ae123&&_0xcb5b9c){_0x4ae123[_0xf079('0x1f')]+=0x1;var _0x14165f={'uniqueid':_0x4979f8,'from':_0xcb5b9c[_0xf079('0x20')]?_0xcb5b9c[_0xf079('0x20')][_0xf079('0x21')]:'','joinAt':moment()[_0xf079('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xcb5b9c['contact']?_0xcb5b9c[_0xf079('0x22')]['id']:null,'ListId':_0xcb5b9c[_0xf079('0x23')]?_0xcb5b9c[_0xf079('0x23')]['id']:null};_0x14165f[_[_0xf079('0x24')](_0xcb5b9c['channel'])+_0xf079('0x25')]=_0x4ae123['id']||null;_0x14165f[_['upperFirst'](_0xcb5b9c['channel'])+_0xf079('0x26')]=_0xcb5b9c['interaction']?_0xcb5b9c['interaction']['id']:null;_0x14165f[_['upperFirst'](_0xcb5b9c[_0xf079('0x27')])+'MessageId']=_0xcb5b9c[_0xf079('0x28')]?_0xcb5b9c[_0xf079('0x28')]['id']:null;_0x14165f[_[_0xf079('0x24')](_0xcb5b9c[_0xf079('0x27')])+(_0xcb5b9c[_0xf079('0x27')]!==_0xf079('0x29')?_0xf079('0x2a'):_0xf079('0x2b'))]=_0xcb5b9c['account']?_0xcb5b9c[_0xf079('0x2c')]['id']:null;logger['info'](util[_0xf079('0x10')](_0xf079('0x2d'),_0x4979f8,_0x4ae123[_0xf079('0x2e')]));emitChannelQueueInteraction(_0xcb5b9c[_0xf079('0x27')],_0x4ae123[_0xf079('0x2e')],_0x14165f,_0xcb5b9c['account'][_0xf079('0x2e')],_0xcb5b9c['message']['id'],!![],_0x598ead,_0x4ae123['id']);if(rpc[_0xcb5b9c['channel']+_0xf079('0x2f')]){return rpc[_0xcb5b9c[_0xf079('0x27')]+_0xf079('0x2f')][_0xf079('0x30')](_0x14165f)[_0xf079('0x31')](function(_0x1329b3){logger['error'](_0xf079('0x32'));});}}}function stopRouting(_0xc7f06c,_0x44a972,_0x48db62,_0xb6ad38){if(_0xc7f06c&&_0x44a972){_0x44a972[_0xf079('0x1f')]-=0x1;var _0x56fa9e={'leaveAt':moment()[_0xf079('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0xf079('0x10')](_0xf079('0x33')),'reason':_0xf079('0x34')};logger[_0xf079('0x35')](util[_0xf079('0x10')](_0xf079('0x36'),_0xc7f06c,_0x44a972[_0xf079('0x2e')]));emitChannelQueueInteraction(_0x48db62['channel'],_0x44a972[_0xf079('0x2e')],_0x48db62[_0xf079('0x20')],_0x48db62[_0xf079('0x2c')]['name'],_0x48db62[_0xf079('0x28')]['id'],![],_0xb6ad38,_0x44a972['id']);if(rpc[_0x48db62[_0xf079('0x27')]+_0xf079('0x2f')]){return rpc[_0x48db62[_0xf079('0x27')]+_0xf079('0x2f')]['update'](_0xc7f06c,_0x56fa9e)[_0xf079('0x31')](function(_0x2fdbb2){logger[_0xf079('0x37')](_0xf079('0x38'));});}}}function endRouting(_0x40075a,_0x398edb,_0x3332fa,_0x57d1eb){if(_0x40075a&&_0x398edb){_0x398edb[_0xf079('0x1f')]-=0x1;var _0x905f01={'leaveAt':moment()[_0xf079('0x10')](_0xf079('0x33')),'exitAt':moment()['format'](_0xf079('0x33')),'reason':'timeout'};logger[_0xf079('0x35')](util[_0xf079('0x10')](_0xf079('0x39'),_0x40075a,_0x398edb[_0xf079('0x2e')]));emitChannelQueueInteraction(_0x3332fa[_0xf079('0x27')],_0x398edb[_0xf079('0x2e')],_0x3332fa[_0xf079('0x20')],_0x3332fa[_0xf079('0x2c')][_0xf079('0x2e')],_0x3332fa['message']['id'],![],_0x57d1eb);if(rpc[_0x3332fa[_0xf079('0x27')]+'QueueReport']){return rpc[_0x3332fa['channel']+_0xf079('0x2f')][_0xf079('0x3a')](_0x40075a,_0x905f01)[_0xf079('0x31')](function(_0x22d75d){logger[_0xf079('0x37')](_0xf079('0x38'));});}}}function handleFindQueue(_0x92157c){return function(_0xb5adb){return _0xb5adb[_0xf079('0x2e')][_0xf079('0x3b')]()===_0x92157c['toLowerCase']();};}exports[_0xf079('0x3c')]=function(_0x16aced,_0x452e17,_0x481582,_0x46af0c){return function(_0x5c4f2a){try{var _0x43692f={'name':_0x452e17[0x0],'timeout':_0x452e17[0x1]};var _0x34b0a8=queue[_0xf079('0x0')](_0x43692f,{'typecast':!![]});if(_0x34b0a8[_0xf079('0x3d')]){logger[_0xf079('0x37')](_0xf079('0x3e'),_0x16aced,_['map'](_0x34b0a8,_0xf079('0x28'))[_0xf079('0x3f')](',\x20'));_0x5c4f2a['stop']();}else{var _0x493632=_[_0xf079('0x40')](_0x481582[_0x46af0c[_0xf079('0x27')]+_0xf079('0x41')],handleFindQueue(_0x43692f['name']));if(_0x493632){startRouting(_0x16aced,_0x493632,_0x46af0c,_0x481582);var _0x2d0b0e=(_0x493632['timeout']||0xa)*0x3e8;var _0x278b5c=(_0x43692f[_0xf079('0x42')]||0x14)*0x3e8;var _0x4c0e4a,_0x31ab71;if(_0x2d0b0e>_0x278b5c){_0x278b5c=_0x2d0b0e;}var _0x2cb064=seqqueue['createQueue'](_0x2d0b0e);_0x2cb064['id']=_0x16aced;_0x2cb064['atimeout']=_0x2d0b0e;_0x2cb064[_0xf079('0x43')]=_0x278b5c;_0x2cb064['channel']=_0x46af0c['channel'];_0x481582[_0xf079('0x44')][_0x16aced]['on'](_0xf079('0x45'),function(){logger['info'](_0xf079('0x46'),_0x16aced);stopRouting(_0x16aced,_0x493632,_0x46af0c,_0x481582);clearTimeout(_0x4c0e4a);_0x4c0e4a=undefined;_0x2cb064['close'](!![]);if(_0x481582[_0xf079('0x44')][_0x16aced]){delete _0x481582['rules'][_0x16aced];}_0x5c4f2a['stop']();});_0x481582[_0xf079('0x44')][_0x16aced]['on'](_0xf079('0x47'),function(){if(_0x481582[_0xf079('0x44')][_0x16aced]){delete _0x481582[_0xf079('0x44')][_0x16aced];}});_0x4c0e4a=setTimeout(function(){logger[_0xf079('0x35')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x16aced);endRouting(_0x16aced,_0x493632,_0x46af0c,_0x481582);clearTimeout(_0x4c0e4a);_0x2cb064['close'](!![]);_0x5c4f2a['next']();},_0x278b5c);switch(_0x493632[_0xf079('0x48')]){case _0xf079('0x49'):strategy[_0xf079('0x49')](_0x2cb064,_0x493632,_0x481582,_0x46af0c);break;default:strategy[_0xf079('0x4a')](_0x2cb064,_0x493632,_0x481582,_0x46af0c);}}else{logger[_0xf079('0x37')](_0xf079('0x4b'),_0x16aced,_0x43692f[_0xf079('0x2e')]);_0x5c4f2a[_0xf079('0x4c')]();}}}catch(_0xb1268d){console[_0xf079('0x4d')](_0xb1268d);logger['error'](_0xf079('0x3e'),_0x16aced,_0xb1268d[_0xf079('0x4e')]);_0x5c4f2a[_0xf079('0x4c')]();}};}; \ No newline at end of file +var _0x7c9a=['rrmemory','beepall','log','validate','lodash','util','moment','ioredis','../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','queue_id','queue','from','joinAt','emit','clone','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','contact','list','channel','upperFirst','InteractionId','interaction','MessageId','message','chat','WebsiteId','account','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','[%s][QUEUE]\x20%s','map','stop','find','Queues','createQueue','atimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','next'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7c9a,0x1c5));var _0xa7c9=function(_0xad9b66,_0x4a6b2c){_0xad9b66=_0xad9b66-0x0;var _0x3e4c3f=_0x7c9a[_0xad9b66];return _0x3e4c3f;};'use strict';var schema=require(_0xa7c9('0x0'));var _=require(_0xa7c9('0x1'));var util=require(_0xa7c9('0x2'));var seqqueue=require('seq-queue');var moment=require(_0xa7c9('0x3'));var Redis=require(_0xa7c9('0x4'));var config=require('../../../../config/environment');var logger=require(_0xa7c9('0x5'))(_0xa7c9('0x6'));var strategy=require('./strategy');config[_0xa7c9('0x7')]=_[_0xa7c9('0x8')](config[_0xa7c9('0x7')],{'host':_0xa7c9('0x9'),'port':0x18eb});var io=require(_0xa7c9('0xa'))(new Redis(config[_0xa7c9('0x7')]));var attributes=['id',_0xa7c9('0xb'),'account',_0xa7c9('0xc'),_0xa7c9('0xd'),_0xa7c9('0xe')];function emit(_0xda0c02,_0x5ef5d6,_0x1ca777){io['to'](_0xda0c02)[_0xa7c9('0xf')](_0x5ef5d6,_0x1ca777);}function emitChannelQueueInteraction(_0x397612,_0x3a09ec,_0x3de612,_0x164cb3,_0x538a26,_0x14a79d,_0x536adc,_0x1ee55d){var _0x7c2b98=_[_0xa7c9('0x10')](_0x3de612);_0x7c2b98['queue_id']=_0x1ee55d;_0x7c2b98[_0xa7c9('0xc')]=_0x3a09ec;_0x7c2b98['account']=_0x164cb3;_0x7c2b98['id']=_0x538a26;if(_0x14a79d){_0x536adc[util[_0xa7c9('0x11')](_0xa7c9('0x12'),_0x397612)][_0x538a26]=_[_0xa7c9('0x13')](_0x7c2b98,attributes);}else{delete _0x536adc[util[_0xa7c9('0x11')](_0xa7c9('0x12'),_0x397612)][_0x538a26];}emit(util[_0xa7c9('0x11')](_0xa7c9('0x14'),_0x397612,_0x3a09ec),util[_0xa7c9('0x11')](_0xa7c9('0x15'),_0x397612,_0x14a79d?_0xa7c9('0x16'):'remove'),_[_0xa7c9('0x13')](_0x7c2b98,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xa7c9('0x17')),'chatQueueReport':require(_0xa7c9('0x18')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0xa7c9('0x19')),'whatsappQueueReport':require(_0xa7c9('0x1a'))};var queue=schema({'name':{'type':_0xa7c9('0x1b'),'required':!![],'message':_0xa7c9('0x1c')},'timeout':{'type':'number','message':_0xa7c9('0x1d')}});function startRouting(_0x1e65df,_0x394738,_0x3faf30,_0x5b4698){if(_0x1e65df&&_0x394738&&_0x3faf30){_0x394738[_0xa7c9('0x1e')]+=0x1;var _0x5a3a7f={'uniqueid':_0x1e65df,'from':_0x3faf30[_0xa7c9('0x1f')]?_0x3faf30[_0xa7c9('0x1f')][_0xa7c9('0xd')]:'','joinAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3faf30[_0xa7c9('0x20')]?_0x3faf30[_0xa7c9('0x20')]['id']:null,'ListId':_0x3faf30[_0xa7c9('0x21')]?_0x3faf30[_0xa7c9('0x21')]['id']:null};_0x5a3a7f[_['upperFirst'](_0x3faf30[_0xa7c9('0x22')])+'QueueId']=_0x394738['id']||null;_0x5a3a7f[_[_0xa7c9('0x23')](_0x3faf30[_0xa7c9('0x22')])+_0xa7c9('0x24')]=_0x3faf30[_0xa7c9('0x25')]?_0x3faf30[_0xa7c9('0x25')]['id']:null;_0x5a3a7f[_[_0xa7c9('0x23')](_0x3faf30[_0xa7c9('0x22')])+_0xa7c9('0x26')]=_0x3faf30[_0xa7c9('0x27')]?_0x3faf30[_0xa7c9('0x27')]['id']:null;_0x5a3a7f[_[_0xa7c9('0x23')](_0x3faf30['channel'])+(_0x3faf30['channel']!==_0xa7c9('0x28')?'AccountId':_0xa7c9('0x29'))]=_0x3faf30[_0xa7c9('0x2a')]?_0x3faf30['account']['id']:null;logger[_0xa7c9('0x2b')](util['format'](_0xa7c9('0x2c'),_0x1e65df,_0x394738[_0xa7c9('0x2d')]));emitChannelQueueInteraction(_0x3faf30[_0xa7c9('0x22')],_0x394738[_0xa7c9('0x2d')],_0x5a3a7f,_0x3faf30[_0xa7c9('0x2a')][_0xa7c9('0x2d')],_0x3faf30[_0xa7c9('0x27')]['id'],!![],_0x5b4698,_0x394738['id']);if(rpc[_0x3faf30[_0xa7c9('0x22')]+_0xa7c9('0x2e')]){return rpc[_0x3faf30[_0xa7c9('0x22')]+_0xa7c9('0x2e')][_0xa7c9('0x2f')](_0x5a3a7f)[_0xa7c9('0x30')](function(_0x29c962){logger[_0xa7c9('0x31')](_0xa7c9('0x32'));});}}}function stopRouting(_0x54570f,_0x16c6ef,_0x766911,_0x544ccd){if(_0x54570f&&_0x16c6ef){_0x16c6ef[_0xa7c9('0x1e')]-=0x1;var _0x78a47d={'leaveAt':moment()['format'](_0xa7c9('0x33')),'acceptAt':moment()[_0xa7c9('0x11')](_0xa7c9('0x33')),'reason':'accepted'};logger[_0xa7c9('0x2b')](util[_0xa7c9('0x11')](_0xa7c9('0x34'),_0x54570f,_0x16c6ef[_0xa7c9('0x2d')]));emitChannelQueueInteraction(_0x766911[_0xa7c9('0x22')],_0x16c6ef['name'],_0x766911[_0xa7c9('0x1f')],_0x766911[_0xa7c9('0x2a')][_0xa7c9('0x2d')],_0x766911['message']['id'],![],_0x544ccd,_0x16c6ef['id']);if(rpc[_0x766911[_0xa7c9('0x22')]+_0xa7c9('0x2e')]){return rpc[_0x766911[_0xa7c9('0x22')]+_0xa7c9('0x2e')][_0xa7c9('0x35')](_0x54570f,_0x78a47d)[_0xa7c9('0x30')](function(_0x351d5a){logger[_0xa7c9('0x31')](_0xa7c9('0x36'));});}}}function endRouting(_0x3c3a38,_0x28ff88,_0x377c34,_0x3a5610){if(_0x3c3a38&&_0x28ff88){_0x28ff88[_0xa7c9('0x1e')]-=0x1;var _0x515ce9={'leaveAt':moment()[_0xa7c9('0x11')](_0xa7c9('0x33')),'exitAt':moment()[_0xa7c9('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xa7c9('0x37')};logger[_0xa7c9('0x2b')](util[_0xa7c9('0x11')](_0xa7c9('0x38'),_0x3c3a38,_0x28ff88[_0xa7c9('0x2d')]));emitChannelQueueInteraction(_0x377c34[_0xa7c9('0x22')],_0x28ff88['name'],_0x377c34['body'],_0x377c34['account'][_0xa7c9('0x2d')],_0x377c34[_0xa7c9('0x27')]['id'],![],_0x3a5610);if(rpc[_0x377c34[_0xa7c9('0x22')]+_0xa7c9('0x2e')]){return rpc[_0x377c34[_0xa7c9('0x22')]+_0xa7c9('0x2e')]['update'](_0x3c3a38,_0x515ce9)[_0xa7c9('0x30')](function(_0x5b868b){logger['error']('update\x20queue\x20report');});}}}function handleFindQueue(_0x11b9e5){return function(_0xb35f96){return _0xb35f96['name'][_0xa7c9('0x39')]()===_0x11b9e5[_0xa7c9('0x39')]();};}exports[_0xa7c9('0x3a')]=function(_0x395a35,_0x4975c4,_0x4c433f,_0x5f4b97){return function(_0x4e7127){try{var _0x547e8b={'name':_0x4975c4[0x0],'timeout':_0x4975c4[0x1]};var _0x4de773=queue[_0xa7c9('0x0')](_0x547e8b,{'typecast':!![]});if(_0x4de773['length']){logger[_0xa7c9('0x31')](_0xa7c9('0x3b'),_0x395a35,_[_0xa7c9('0x3c')](_0x4de773,_0xa7c9('0x27'))['join'](',\x20'));_0x4e7127[_0xa7c9('0x3d')]();}else{var _0x32eadc=_[_0xa7c9('0x3e')](_0x4c433f[_0x5f4b97[_0xa7c9('0x22')]+_0xa7c9('0x3f')],handleFindQueue(_0x547e8b[_0xa7c9('0x2d')]));if(_0x32eadc){startRouting(_0x395a35,_0x32eadc,_0x5f4b97,_0x4c433f);var _0x43f04e=(_0x32eadc['timeout']||0xa)*0x3e8;var _0x13650d=(_0x547e8b[_0xa7c9('0x37')]||0x14)*0x3e8;var _0x443389,_0x27f8f4;if(_0x43f04e>_0x13650d){_0x13650d=_0x43f04e;}var _0x5c21ea=seqqueue[_0xa7c9('0x40')](_0x43f04e);_0x5c21ea['id']=_0x395a35;_0x5c21ea[_0xa7c9('0x41')]=_0x43f04e;_0x5c21ea['qtimeout']=_0x13650d;_0x5c21ea[_0xa7c9('0x22')]=_0x5f4b97[_0xa7c9('0x22')];_0x4c433f[_0xa7c9('0x42')][_0x395a35]['on'](_0xa7c9('0x43'),function(){logger[_0xa7c9('0x2b')](_0xa7c9('0x44'),_0x395a35);stopRouting(_0x395a35,_0x32eadc,_0x5f4b97,_0x4c433f);clearTimeout(_0x443389);_0x443389=undefined;_0x5c21ea[_0xa7c9('0x45')](!![]);if(_0x4c433f['rules'][_0x395a35]){delete _0x4c433f['rules'][_0x395a35];}_0x4e7127['stop']();});_0x4c433f[_0xa7c9('0x42')][_0x395a35]['on'](_0xa7c9('0x46'),function(){if(_0x4c433f[_0xa7c9('0x42')][_0x395a35]){delete _0x4c433f[_0xa7c9('0x42')][_0x395a35];}});_0x443389=setTimeout(function(){logger[_0xa7c9('0x2b')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x395a35);endRouting(_0x395a35,_0x32eadc,_0x5f4b97,_0x4c433f);clearTimeout(_0x443389);_0x5c21ea[_0xa7c9('0x45')](!![]);_0x4e7127[_0xa7c9('0x47')]();},_0x13650d);switch(_0x32eadc['strategy']){case'rrmemory':strategy[_0xa7c9('0x48')](_0x5c21ea,_0x32eadc,_0x4c433f,_0x5f4b97);break;default:strategy[_0xa7c9('0x49')](_0x5c21ea,_0x32eadc,_0x4c433f,_0x5f4b97);}}else{logger['error']('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x395a35,_0x547e8b[_0xa7c9('0x2d')]);_0x4e7127[_0xa7c9('0x3d')]();}}}catch(_0x85c73d){console[_0xa7c9('0x4a')](_0x85c73d);logger[_0xa7c9('0x31')]('[%s][QUEUE]\x20%s',_0x395a35,_0x85c73d['stack']);_0x4e7127['stop']();}};}; \ 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 cb58931..923058c 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 _0x74cf=['agent','realtime','push','handleRun','handleTimeout','bind','timeout','prototype','handleDrained','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','RINGING',':FORCED','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','writeLog','STOP','TIMEOUT','routing','notificationId','squeue'];(function(_0x301657,_0x76a8e3){var _0x370285=function(_0x1fbeca){while(--_0x1fbeca){_0x301657['push'](_0x301657['shift']());}};_0x370285(++_0x76a8e3);}(_0x74cf,0x13c));var _0xf74c=function(_0x19b9f5,_0x2ff200){_0x19b9f5=_0x19b9f5-0x0;var _0x89c067=_0x74cf[_0x19b9f5];return _0x89c067;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require('./util');var logger=require('../../../../../config/logger')(_0xf74c('0x0'));var Agent=function(_0x33bdba,_0x5396ba,_0x3593a0,_0x5b91ed){this[_0xf74c('0x1')]=uuid['v4']();this[_0xf74c('0x2')]=_0x33bdba;this[_0xf74c('0x3')]=_0x5396ba;this[_0xf74c('0x4')]=_0x3593a0;this['routing']=_0x5b91ed;this[_0xf74c('0x2')][_0xf74c('0x5')](this[_0xf74c('0x6')]['bind'](this),this[_0xf74c('0x7')][_0xf74c('0x8')](this));this['squeue']['on'](_0xf74c('0x9'),this[_0xf74c('0x7')][_0xf74c('0x8')](this));this['squeue']['on']('drained',this['handleDrained'][_0xf74c('0x8')](this));};Agent['prototype'][_0xf74c('0x5')]=function(){this[_0xf74c('0x2')][_0xf74c('0x5')](this[_0xf74c('0x6')][_0xf74c('0x8')](this),this[_0xf74c('0x7')]['bind'](this));};Agent[_0xf74c('0xa')][_0xf74c('0xb')]=function(){this['handleTimeout'](!![]);};Agent[_0xf74c('0xa')][_0xf74c('0x6')]=function(_0x11f4d6){logger[_0xf74c('0xc')](_0xf74c('0xd'),this[_0xf74c('0x2')]['id'],this[_0xf74c('0x3')]['id']);if(_[_0xf74c('0xe')](this[_0xf74c('0x4')][_0xf74c('0xf')][this['agent']['id']])){logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0xf74c('0x3')]['id']);setTimeout(this[_0xf74c('0x5')]['bind'](this),0x3e8);}else{if(this[_0xf74c('0x0')][_0xf74c('0x10')]||util[_0xf74c('0x11')](this['squeue']['id'],this[_0xf74c('0x4')][_0xf74c('0xf')][this[_0xf74c('0x3')]['id']],this[_0xf74c('0x2')][_0xf74c('0x12')],![])){this['realtime'][_0xf74c('0xf')][this[_0xf74c('0x3')]['id']][_0xf74c('0x13')]=!![];this['realtime'][_0xf74c('0xf')][this['agent']['id']][_0xf74c('0x14')]=undefined;util['showNotification'](this[_0xf74c('0x1')],this[_0xf74c('0x2')]['id'],this['realtime'][_0xf74c('0xf')][this[_0xf74c('0x3')]['id']],null,this['routing']);util['writeLog'](this['squeue']['id'],this['realtime']['agents'][this[_0xf74c('0x3')]['id']],_0xf74c('0x15')+(this[_0xf74c('0x0')]['forcedOwnership']?_0xf74c('0x16'):''));}else{logger['info']('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this['squeue']['id'],this[_0xf74c('0x3')]['id']);setTimeout(this[_0xf74c('0x5')][_0xf74c('0x8')](this),0x3e8);}}};Agent[_0xf74c('0xa')]['handleTimeout']=function(_0x7d9cad){if(_[_0xf74c('0xe')](this[_0xf74c('0x4')]['agents'][this[_0xf74c('0x3')]['id']])){return logger[_0xf74c('0xc')](_0xf74c('0x17'),this[_0xf74c('0x2')]['id'],this[_0xf74c('0x3')]['id']);}else{logger[_0xf74c('0xc')](_0xf74c('0x18'),this['squeue']['id'],this['agent']['id']);util[_0xf74c('0x19')](this[_0xf74c('0x1')],this[_0xf74c('0x2')]['id'],this[_0xf74c('0x4')]['agents'][this['agent']['id']],null,this[_0xf74c('0x0')]);this[_0xf74c('0x4')][_0xf74c('0xf')][this[_0xf74c('0x3')]['id']][_0xf74c('0x13')]=![];this[_0xf74c('0x4')][_0xf74c('0xf')][this[_0xf74c('0x3')]['id']]['busyQueue']=undefined;util[_0xf74c('0x1a')](this[_0xf74c('0x2')]['id'],this[_0xf74c('0x4')]['agents'][this[_0xf74c('0x3')]['id']],_0x7d9cad?_0xf74c('0x1b'):_0xf74c('0x1c'));}if(!_0x7d9cad){setTimeout(this[_0xf74c('0x5')][_0xf74c('0x8')](this),0x3e8);}};function agent(_0x2c2d1e,_0x1ee3be,_0x24506a,_0x2242e2){return new Agent(_0x2c2d1e,_0x1ee3be,_0x24506a,_0x2242e2);}module['exports']=agent; \ No newline at end of file +var _0x3ea9=['isAgentAvailable','channel','showNotification','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','STOP','exports','lodash','uuid','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','bind','timeout','handleTimeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','forcedOwnership'];(function(_0x5004f5,_0x4185b0){var _0x19bad1=function(_0x33309d){while(--_0x33309d){_0x5004f5['push'](_0x5004f5['shift']());}};_0x19bad1(++_0x4185b0);}(_0x3ea9,0xac));var _0x93ea=function(_0x442682,_0x28c3fb){_0x442682=_0x442682-0x0;var _0x55927b=_0x3ea9[_0x442682];return _0x55927b;};'use strict';var _=require(_0x93ea('0x0'));var uuid=require(_0x93ea('0x1'));var util=require('./util');var logger=require(_0x93ea('0x2'))(_0x93ea('0x3'));var Agent=function(_0x15294e,_0x184d36,_0x3fc6b7,_0xa7be26){this[_0x93ea('0x4')]=uuid['v4']();this[_0x93ea('0x5')]=_0x15294e;this[_0x93ea('0x6')]=_0x184d36;this[_0x93ea('0x7')]=_0x3fc6b7;this[_0x93ea('0x3')]=_0xa7be26;this[_0x93ea('0x5')][_0x93ea('0x8')](this['handleRun'][_0x93ea('0x9')](this),this['handleTimeout'][_0x93ea('0x9')](this));this[_0x93ea('0x5')]['on'](_0x93ea('0xa'),this[_0x93ea('0xb')][_0x93ea('0x9')](this));this[_0x93ea('0x5')]['on'](_0x93ea('0xc'),this[_0x93ea('0xd')][_0x93ea('0x9')](this));};Agent[_0x93ea('0xe')][_0x93ea('0x8')]=function(){this[_0x93ea('0x5')]['push'](this['handleRun'][_0x93ea('0x9')](this),this[_0x93ea('0xb')][_0x93ea('0x9')](this));};Agent['prototype'][_0x93ea('0xd')]=function(){this[_0x93ea('0xb')](!![]);};Agent[_0x93ea('0xe')]['handleRun']=function(_0x292922){logger[_0x93ea('0xf')](_0x93ea('0x10'),this[_0x93ea('0x5')]['id'],this[_0x93ea('0x6')]['id']);if(_[_0x93ea('0x11')](this[_0x93ea('0x7')][_0x93ea('0x12')][this[_0x93ea('0x6')]['id']])){logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x93ea('0x5')]['id'],this[_0x93ea('0x6')]['id']);setTimeout(this[_0x93ea('0x8')][_0x93ea('0x9')](this),0x3e8);}else{if(this[_0x93ea('0x3')][_0x93ea('0x13')]||util[_0x93ea('0x14')](this[_0x93ea('0x5')]['id'],this[_0x93ea('0x7')]['agents'][this[_0x93ea('0x6')]['id']],this[_0x93ea('0x5')][_0x93ea('0x15')],![])){this[_0x93ea('0x7')][_0x93ea('0x12')][this[_0x93ea('0x6')]['id']]['busy']=!![];this[_0x93ea('0x7')][_0x93ea('0x12')][this[_0x93ea('0x6')]['id']]['busyQueue']=undefined;util[_0x93ea('0x16')](this['notificationId'],this[_0x93ea('0x5')]['id'],this[_0x93ea('0x7')][_0x93ea('0x12')][this['agent']['id']],null,this[_0x93ea('0x3')]);util['writeLog'](this[_0x93ea('0x5')]['id'],this['realtime'][_0x93ea('0x12')][this[_0x93ea('0x6')]['id']],_0x93ea('0x17')+(this[_0x93ea('0x3')][_0x93ea('0x13')]?_0x93ea('0x18'):''));}else{logger[_0x93ea('0xf')](_0x93ea('0x19'),this[_0x93ea('0x5')]['id'],this[_0x93ea('0x6')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent[_0x93ea('0xe')][_0x93ea('0xb')]=function(_0x4b20da){if(_[_0x93ea('0x11')](this[_0x93ea('0x7')][_0x93ea('0x12')][this[_0x93ea('0x6')]['id']])){return logger[_0x93ea('0xf')](_0x93ea('0x1a'),this[_0x93ea('0x5')]['id'],this[_0x93ea('0x6')]['id']);}else{logger[_0x93ea('0xf')](_0x93ea('0x1b'),this[_0x93ea('0x5')]['id'],this[_0x93ea('0x6')]['id']);util[_0x93ea('0x1c')](this['notificationId'],this[_0x93ea('0x5')]['id'],this[_0x93ea('0x7')][_0x93ea('0x12')][this[_0x93ea('0x6')]['id']],null,this[_0x93ea('0x3')]);this['realtime'][_0x93ea('0x12')][this[_0x93ea('0x6')]['id']][_0x93ea('0x1d')]=![];this[_0x93ea('0x7')]['agents'][this['agent']['id']]['busyQueue']=undefined;util['writeLog'](this[_0x93ea('0x5')]['id'],this[_0x93ea('0x7')][_0x93ea('0x12')][this['agent']['id']],_0x4b20da?_0x93ea('0x1e'):'TIMEOUT');}if(!_0x4b20da){setTimeout(this[_0x93ea('0x8')][_0x93ea('0x9')](this),0x3e8);}};function agent(_0x1c46e5,_0x414e3,_0x566973,_0x397d85){return new Agent(_0x1c46e5,_0x414e3,_0x566973,_0x397d85);}module[_0x93ea('0x1f')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index f23b0bc..2b4e538 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 _0x6c84=['busyQueue','name','showNotification','notificationId','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','queue','realtime','squeue','push','handleRun','bind','handleTimeout','handleDrained','prototype','isNil','Agents','length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','writeLog','busy'];(function(_0x8560d3,_0x26a504){var _0x33b1b5=function(_0x3a2cad){while(--_0x3a2cad){_0x8560d3['push'](_0x8560d3['shift']());}};_0x33b1b5(++_0x26a504);}(_0x6c84,0x112));var _0x46c8=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x6c84[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x46c8('0x0'));var uuid=require(_0x46c8('0x1'));var util=require(_0x46c8('0x2'));var logger=require(_0x46c8('0x3'))(_0x46c8('0x4'));var Beepall=function(_0x51d202,_0x187ef9,_0x4e8480,_0x2f4e36){this['notificationId']=uuid['v4']();this['squeue']=_0x51d202;this[_0x46c8('0x5')]=_0x187ef9;this[_0x46c8('0x6')]=_0x4e8480;this[_0x46c8('0x4')]=_0x2f4e36;this[_0x46c8('0x7')][_0x46c8('0x8')](this[_0x46c8('0x9')][_0x46c8('0xa')](this),this[_0x46c8('0xb')]['bind'](this));this[_0x46c8('0x7')]['on']('timeout',this['handleTimeout']['bind'](this));this[_0x46c8('0x7')]['on']('drained',this[_0x46c8('0xc')][_0x46c8('0xa')](this));};Beepall[_0x46c8('0xd')][_0x46c8('0x8')]=function(){this[_0x46c8('0x7')][_0x46c8('0x8')](this[_0x46c8('0x9')]['bind'](this),this['handleTimeout']['bind'](this));};Beepall[_0x46c8('0xd')]['handleDrained']=function(_0x2df7e8){this[_0x46c8('0xb')](!![]);};Beepall[_0x46c8('0xd')][_0x46c8('0x9')]=function(_0x55d417){var _0x5da579=!![];if(!_[_0x46c8('0xe')](this[_0x46c8('0x5')])&&!_['isNil'](this[_0x46c8('0x5')][_0x46c8('0xf')])&&this['queue']['Agents'][_0x46c8('0x10')]>0x0){for(var _0x255a0e=0x0,_0x29b28f;_0x255a0e0x0){for(var _0x3f7bf3=0x0,_0x423dbe;_0x3f7bf30x0&&_0x4aa438[_0x513011+_0x4533('0x21')]>=_0x4aa438[_0x513011+_0x4533('0x1f')]){writeLog(_0x2901f1,_0x4aa438,_0x513011[_0x4533('0x22')]()+_0x4533('0x23'));return![];}}return!![];};exports[_0x4533('0x24')]=function(_0x5f16bb,_0x5c1e24,_0xa2e602,_0x5aaf2d,_0x3fd76a){return sendNotification(!![],_0x5f16bb,_0x5c1e24,_0xa2e602,_0x5aaf2d,_0x3fd76a);};exports['hideNotification']=function(_0x159fea,_0x42ba2d,_0x38706b,_0x4300c1,_0x252a44){return sendNotification(![],_0x159fea,_0x42ba2d,_0x38706b,_0x4300c1,_0x252a44);};exports[_0x4533('0x25')]=writeLog; \ No newline at end of file +var _0xeda8=['OFFLINE','Pause','hasOwnProperty','Capacity','CurrentCapacity','\x20MAXCAPACITY','showNotification','writeLog','lodash','util','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','emit','format','user:%s','name','user:save','split','\x20interaction','account','notificationSound','body','queue','msg','I\x20can\x27t\x20render\x20your\x20template','error','message','notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY'];(function(_0x15a2cb,_0x571a10){var _0x26d3f6=function(_0x2e313f){while(--_0x2e313f){_0x15a2cb['push'](_0x15a2cb['shift']());}};_0x26d3f6(++_0x571a10);}(_0xeda8,0x104));var _0x8eda=function(_0x176dfc,_0x3191a4){_0x176dfc=_0x176dfc-0x0;var _0x351cf6=_0xeda8[_0x176dfc];return _0x351cf6;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var utils=require('../utils');var Mustache=require(_0x8eda('0x2'));var Redis=require(_0x8eda('0x3'));var config=require(_0x8eda('0x4'));var logger=require(_0x8eda('0x5'))(_0x8eda('0x6'));config[_0x8eda('0x7')]=_[_0x8eda('0x8')](config[_0x8eda('0x7')],{'host':_0x8eda('0x9'),'port':0x18eb});var io=require(_0x8eda('0xa'))(new Redis(config[_0x8eda('0x7')]));function emit(_0x32abe8,_0x4e2ebb,_0x28b721){io['to'](_0x32abe8)[_0x8eda('0xb')](_0x4e2ebb,_0x28b721);}function sendNotification(_0x5aa93d,_0x6b544f,_0x4be9df,_0x4f7893,_0x488849,_0x4fbf0a){io['to'](util[_0x8eda('0xc')](_0x8eda('0xd'),_0x4f7893[_0x8eda('0xe')]))['emit'](_0x8eda('0xf'),_0x4f7893);var _0x5a80ca=_0x4fbf0a||{};var _0x3f34c=_0x4be9df[_0x8eda('0x10')]('.');var _0x2fdec0={'uniqueid':_0x6b544f,'channel':_0x3f34c[0x0],'id':_0x3f34c[0x1],'title':_0x3f34c[0x0]+_0x8eda('0x11'),'interactionId':_0x3f34c[0x2],'queue':_0x488849?_0x488849[_0x8eda('0xe')]:null,'sound':_0x5a80ca[_0x8eda('0x12')][_0x8eda('0x13')],'shake':_0x5a80ca[_0x8eda('0x12')]['notificationShake']};try{if(!_0x5a80ca['body']){_0x5a80ca[_0x8eda('0x14')]={};}if(_0x488849){_0x5a80ca[_0x8eda('0x14')]['queue']=_0x488849;}else if(_0x5a80ca[_0x8eda('0x14')][_0x8eda('0x15')]){delete _0x5a80ca[_0x8eda('0x14')]['queue'];}_0x2fdec0[_0x8eda('0x16')]=utils['getMustacheRender'](_0x5a80ca[_0x8eda('0x12')]['notificationTemplate'],_0x5a80ca);}catch(_0x24aed4){_0x2fdec0['msg']=_0x8eda('0x17');logger[_0x8eda('0x18')](util['format']('[%s][QUEUE]\x20%s',_0x6b544f,_0x24aed4[_0x8eda('0x19')]));}io['to'](util[_0x8eda('0xc')](_0x8eda('0xd'),_0x4f7893[_0x8eda('0xe')]))[_0x8eda('0xb')](util[_0x8eda('0xc')](_0x8eda('0x1a'),_0x5aa93d?_0x8eda('0x1b'):_0x8eda('0x1c')),_0x2fdec0);}function writeLog(_0x232786,_0x279ade,_0x57f336){return logger[_0x8eda('0x1d')](util['format'](_0x8eda('0x1e'),_0x232786,_0x279ade['name'],_0x57f336));}exports[_0x8eda('0x1f')]=function(_0x2dab25,_0x4f3e0a,_0x58e54b,_0x56dba4){if(_0x4f3e0a[_0x8eda('0x20')]){writeLog(_0x2dab25,_0x4f3e0a,_0x8eda('0x21'));return![];}if(!_0x4f3e0a['online']){writeLog(_0x2dab25,_0x4f3e0a,_0x8eda('0x22'));return![];}if(_0x4f3e0a[_0x58e54b+_0x8eda('0x23')]){writeLog(_0x2dab25,_0x4f3e0a,'PAUSE');return![];}if(_0x56dba4&&_0x4f3e0a[_0x8eda('0x24')](_0x58e54b+_0x8eda('0x25'))&&_0x4f3e0a[_0x8eda('0x24')](_0x58e54b+_0x8eda('0x26'))){if(_0x4f3e0a[_0x58e54b+_0x8eda('0x25')]>0x0&&_0x4f3e0a[_0x58e54b+'CurrentCapacity']>=_0x4f3e0a[_0x58e54b+_0x8eda('0x25')]){writeLog(_0x2dab25,_0x4f3e0a,_0x58e54b['toUpperCase']()+_0x8eda('0x27'));return![];}}return!![];};exports[_0x8eda('0x28')]=function(_0x8337b4,_0x567f69,_0x23e892,_0x244400,_0x1dd12){return sendNotification(!![],_0x8337b4,_0x567f69,_0x23e892,_0x244400,_0x1dd12);};exports['hideNotification']=function(_0x1616ea,_0x11a999,_0x5dd315,_0x27d2ce,_0x29e6f4){return sendNotification(![],_0x1616ea,_0x11a999,_0x5dd315,_0x27d2ce,_0x29e6f4);};exports[_0x8eda('0x29')]=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 697d1c3..4648bdd 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 _0xcee8=['isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','map','message','join','info','next','getMustacheRender','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','[%s][SYSTEM]\x20%s'];(function(_0x173f13,_0x4ea3cf){var _0x585942=function(_0x96d7d5){while(--_0x96d7d5){_0x173f13['push'](_0x173f13['shift']());}};_0x585942(++_0x4ea3cf);}(_0xcee8,0xb1));var _0x8cee=function(_0x3c8c60,_0x7af962){_0x3c8c60=_0x3c8c60-0x0;var _0x3a88c3=_0xcee8[_0x3c8c60];return _0x3a88c3;};'use strict';var schema=require(_0x8cee('0x0'));var sh=require(_0x8cee('0x1'));var _=require(_0x8cee('0x2'));var utils=require(_0x8cee('0x3'));var logger=require(_0x8cee('0x4'))(_0x8cee('0x5'));var system=schema({'command':{'type':'string','required':!![],'message':_0x8cee('0x6')}});exports[_0x8cee('0x7')]=function(_0xffd42d,_0x1ec415){return function(_0x482900){try{var _0x295471={'command':_0x1ec415[0x0]};var _0xfea4e3=system['validate'](_0x295471,{'typecast':!![]});if(_0xfea4e3['length']){logger[_0x8cee('0x8')]('[%s][SYSTEM]\x20%s',_0xffd42d,_[_0x8cee('0x9')](_0xfea4e3,_0x8cee('0xa'))[_0x8cee('0xb')](',\x20'));logger[_0x8cee('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0xffd42d);_0x482900[_0x8cee('0xd')]();}else{var _0x3b9198=this;var _0x4c09d7=utils[_0x8cee('0xe')](_0x1ec415[0x0],this);logger[_0x8cee('0xc')]('[%s][SYSTEM]\x20commnad:\x20%s',_0xffd42d,_0x4c09d7);sh[_0x8cee('0xf')](_['trim'](_0x4c09d7),function(_0x28df81,_0x42cc0e){logger[_0x8cee('0xc')](_0x8cee('0x10'),_0xffd42d,_0x28df81);if(_0x28df81==0x0){var _0x4e1f09=_0x42cc0e['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x8cee('0x11')](_0x1ec415[0x1])||_[_0x8cee('0x12')](_0x1ec415[0x1])){logger[_0x8cee('0xc')](_0x8cee('0x13'),_0xffd42d);_0x3b9198[_0x8cee('0x14')][_0x1ec415[0x1]]=_0x4e1f09;}else{logger[_0x8cee('0xc')](_0x8cee('0x15'),_0xffd42d,_0x1ec415[0x1],_0x4e1f09);_0x3b9198[_0x8cee('0x14')][_0x1ec415[0x1]]=_0x4e1f09;}}_0x482900[_0x8cee('0xd')]();});}}catch(_0x487241){logger[_0x8cee('0x8')](_0x8cee('0x16'),_0xffd42d,_[_0x8cee('0x17')](_0x487241)?JSON[_0x8cee('0x18')](_0x487241):_0x487241);logger[_0x8cee('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0xffd42d);_0x482900[_0x8cee('0xd')]();}};}; \ No newline at end of file +var _0xdc7f=['[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','./utils','../../../../config/logger','routing','string','length','message','join','next','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','[%s][SYSTEM]\x20%s','isObject'];(function(_0x378b4,_0x5ca7fa){var _0x11d07b=function(_0x35d420){while(--_0x35d420){_0x378b4['push'](_0x378b4['shift']());}};_0x11d07b(++_0x5ca7fa);}(_0xdc7f,0x191));var _0xfdc7=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0xdc7f[_0x3de8a4];return _0x4635cf;};'use strict';var schema=require(_0xfdc7('0x0'));var sh=require(_0xfdc7('0x1'));var _=require('lodash');var utils=require(_0xfdc7('0x2'));var logger=require(_0xfdc7('0x3'))(_0xfdc7('0x4'));var system=schema({'command':{'type':_0xfdc7('0x5'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x32819f,_0xe3228c){return function(_0x1573ff){try{var _0x59c9dd={'command':_0xe3228c[0x0]};var _0x132a2e=system[_0xfdc7('0x0')](_0x59c9dd,{'typecast':!![]});if(_0x132a2e[_0xfdc7('0x6')]){logger['error']('[%s][SYSTEM]\x20%s',_0x32819f,_['map'](_0x132a2e,_0xfdc7('0x7'))[_0xfdc7('0x8')](',\x20'));logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x32819f);_0x1573ff[_0xfdc7('0x9')]();}else{var _0x47b9ed=this;var _0x388745=utils['getMustacheRender'](_0xe3228c[0x0],this);logger[_0xfdc7('0xa')](_0xfdc7('0xb'),_0x32819f,_0x388745);sh[_0xfdc7('0xc')](_[_0xfdc7('0xd')](_0x388745),function(_0x214f6d,_0x213b8e){logger[_0xfdc7('0xa')](_0xfdc7('0xe'),_0x32819f,_0x214f6d);if(_0x214f6d==0x0){var _0x5c3a5a=_0x213b8e[_0xfdc7('0xf')](/(\r\n|\n|\r)/gm,'');if(_[_0xfdc7('0x10')](_0xe3228c[0x1])||_[_0xfdc7('0x11')](_0xe3228c[0x1])){logger['info'](_0xfdc7('0x12'),_0x32819f);_0x47b9ed[_0xfdc7('0x13')][_0xe3228c[0x1]]=_0x5c3a5a;}else{logger['info'](_0xfdc7('0x14'),_0x32819f,_0xe3228c[0x1],_0x5c3a5a);_0x47b9ed[_0xfdc7('0x13')][_0xe3228c[0x1]]=_0x5c3a5a;}}_0x1573ff[_0xfdc7('0x9')]();});}}catch(_0x58127f){logger[_0xfdc7('0x15')](_0xfdc7('0x16'),_0x32819f,_[_0xfdc7('0x17')](_0x58127f)?JSON['stringify'](_0x58127f):_0x58127f);logger[_0xfdc7('0xa')](_0xfdc7('0x18'),_0x32819f);_0x1573ff[_0xfdc7('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 1abcf90..e256135 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 _0x7557=['../../rpc/faxInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7557,0x109));var _0x7755=function(_0x2b3f36,_0x14044d){_0x2b3f36=_0x2b3f36-0x0;var _0x5e7d05=_0x7557[_0x2b3f36];return _0x5e7d05;};'use strict';var schema=require(_0x7755('0x0'));var _=require(_0x7755('0x1'));var rpc={'chatInteraction':require(_0x7755('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x7755('0x3')),'mailInteraction':require(_0x7755('0x4')),'faxInteraction':require(_0x7755('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')(_0x7755('0x6'));var tag=schema({'tag':{'type':_0x7755('0x7'),'required':!![],'message':_0x7755('0x8')}});exports[_0x7755('0x9')]=function(_0x2ebec7,_0x5ed70b,_0x2d810e,_0x15867c){return function(_0x20ba74){try{var _0x39cea0={'tag':_0x5ed70b[0x0]};var _0x2b23db=tag[_0x7755('0x0')](_0x39cea0,{'typecast':!![]});if(_0x2b23db[_0x7755('0xa')]){logger['error'](_0x7755('0xb'),_0x2ebec7,_[_0x7755('0xc')](_0x2b23db,_0x7755('0xd'))[_0x7755('0xe')](',\x20'));logger[_0x7755('0xf')](_0x7755('0x10'),_0x2ebec7);_0x20ba74[_0x7755('0x11')]();}else{var _0x2252aa={'ids':[_0x5ed70b[0x0]]};if(rpc[_0x15867c[_0x7755('0x12')]+'Interaction']){rpc[_0x15867c[_0x7755('0x12')]+'Interaction'][_0x7755('0x13')](_0x15867c['interaction']['id'],_0x2252aa)[_0x7755('0x14')](function(_0x3f7ade){logger[_0x7755('0xf')](_0x7755('0x15'),_0x2ebec7,_0x5ed70b[0x1],_0x15867c[_0x7755('0x12')],_0x15867c[_0x7755('0x16')]['id']);})[_0x7755('0x17')](function(_0x4eb494){logger['error']('[%s][TAG]\x20%s',_0x2ebec7,JSON[_0x7755('0x18')](_0x4eb494));logger[_0x7755('0xf')](_0x7755('0x10'),_0x2ebec7);})[_0x7755('0x19')](function(){_0x20ba74[_0x7755('0x11')]();});}}}catch(_0x3e5f61){logger['error'](_0x7755('0xb'),_0x2ebec7,_[_0x7755('0x1a')](_0x3e5f61)?JSON[_0x7755('0x18')](_0x3e5f61):_0x3e5f61);logger[_0x7755('0xf')](_0x7755('0x10'),_0x2ebec7);_0x20ba74[_0x7755('0x11')]();}};}; \ No newline at end of file +var _0x3887=['stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][TAG]\x20%s','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','channel','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error'];(function(_0x331cf6,_0x751317){var _0x24c5b3=function(_0x25ce2c){while(--_0x25ce2c){_0x331cf6['push'](_0x331cf6['shift']());}};_0x24c5b3(++_0x751317);}(_0x3887,0x73));var _0x7388=function(_0x3bd52b,_0xbbc735){_0x3bd52b=_0x3bd52b-0x0;var _0x1e5b89=_0x3887[_0x3bd52b];return _0x1e5b89;};'use strict';var schema=require(_0x7388('0x0'));var _=require(_0x7388('0x1'));var rpc={'chatInteraction':require(_0x7388('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x7388('0x3')),'faxInteraction':require(_0x7388('0x4')),'whatsappInteraction':require(_0x7388('0x5'))};var logger=require(_0x7388('0x6'))(_0x7388('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x7388('0x8')}});exports[_0x7388('0x9')]=function(_0x231c81,_0x214f91,_0x4f98d8,_0x41be61){return function(_0x164ace){try{var _0xd4eb09={'tag':_0x214f91[0x0]};var _0x48c7ce=tag[_0x7388('0x0')](_0xd4eb09,{'typecast':!![]});if(_0x48c7ce[_0x7388('0xa')]){logger['error'](_0x7388('0xb'),_0x231c81,_[_0x7388('0xc')](_0x48c7ce,_0x7388('0xd'))['join'](',\x20'));logger[_0x7388('0xe')](_0x7388('0xf'),_0x231c81);_0x164ace[_0x7388('0x10')]();}else{var _0x346d59={'ids':[_0x214f91[0x0]]};if(rpc[_0x41be61['channel']+_0x7388('0x11')]){rpc[_0x41be61[_0x7388('0x12')]+_0x7388('0x11')][_0x7388('0x13')](_0x41be61[_0x7388('0x14')]['id'],_0x346d59)[_0x7388('0x15')](function(_0x4efc3e){logger[_0x7388('0xe')](_0x7388('0x16'),_0x231c81,_0x214f91[0x1],_0x41be61[_0x7388('0x12')],_0x41be61['interaction']['id']);})[_0x7388('0x17')](function(_0x49e078){logger[_0x7388('0x18')](_0x7388('0xb'),_0x231c81,JSON[_0x7388('0x19')](_0x49e078));logger['info'](_0x7388('0xf'),_0x231c81);})[_0x7388('0x1a')](function(){_0x164ace['next']();});}}}catch(_0x428aff){logger[_0x7388('0x18')](_0x7388('0xb'),_0x231c81,_[_0x7388('0x1b')](_0x428aff)?JSON[_0x7388('0x19')](_0x428aff):_0x428aff);logger[_0x7388('0xe')](_0x7388('0xf'),_0x231c81);_0x164ace[_0x7388('0x10')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 14e0d53..b100900 100644 --- a/server/services/routing/server/applications/tvox.js +++ b/server/services/routing/server/applications/tvox.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x97d1=['info','request-promise','../../../../config/logger','routing','consequence','replace','\x20-\x20','includes','push','?params=','urlOnRing','title','jsonrpc','2.0','login','params','stringify','utf8','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','error','[%s][TVOX]\x20%s','isObject','stop'];(function(_0x566b3a,_0x168b1b){var _0x3a812a=function(_0x52059a){while(--_0x52059a){_0x566b3a['push'](_0x566b3a['shift']());}};_0x3a812a(++_0x168b1b);}(_0x97d1,0x155));var _0x197d=function(_0x353598,_0x33e234){_0x353598=_0x353598-0x0;var _0x4cf82e=_0x97d1[_0x353598];return _0x4cf82e;};'use strict';var rp=require(_0x197d('0x0'));var logger=require(_0x197d('0x1'))(_0x197d('0x2'));var _=require('lodash');var arr=[];exports[_0x197d('0x3')]=function(_0x10a3d9,_0x40e6f5){return function(_0x4355a1){var _0x364296=_0x40e6f5[0xa];var _0xb31794=_0x40e6f5[0xb];var _0x2a5aa2=_0x40e6f5[0xc];var _0x23ff0a=_0x40e6f5[0xd];var _0x4d19d4=_0x40e6f5[0xe];var _0x12fb7d=_0x40e6f5[0xf][_0x197d('0x4')](/\n/g,_0x197d('0x5'));var _0x185492=_0x40e6f5[0x10][_0x197d('0x4')](/\n/g,'\x20');if(!arr[_0x197d('0x6')](_0xb31794)){arr[_0x197d('0x7')](_0xb31794);var _0x5e9564=_0x40e6f5[0x3];var _0x4f2ee8=_0x40e6f5[0x4];var _0x2f5e9e=_0x40e6f5[0x1];var _0xce6cc7=_0x40e6f5[0x0];var _0x1d8fe5={};_0x1d8fe5['urlOnAnswer']=_0x40e6f5[0x8]+_0x197d('0x8')+_0x2a5aa2+'|'+_0x364296+'|'+_0x23ff0a+'|'+_0xb31794+'|'+_0x4d19d4;_0x1d8fe5[_0x197d('0x9')]=_0x40e6f5[0x7]+_0x197d('0x8')+_0x2a5aa2+'|'+_0x364296+'|'+_0x23ff0a+'|'+_0xb31794+'|'+_0x4d19d4+'|'+_0x12fb7d+'|'+_0x185492;_0x1d8fe5[_0x197d('0xa')]=_0x40e6f5[0x9];var _0xf3864f={};_0xf3864f[_0x197d('0xb')]=_0x197d('0xc');_0xf3864f['method']=_0x197d('0xd');var _0x5e5c6c=[];_0x5e5c6c[_0x197d('0x7')](_0x40e6f5[0x2]);_0x5e5c6c['push'](_0x40e6f5[0x5]);_0x5e5c6c[_0x197d('0x7')](_0x40e6f5[0x6]);_0xf3864f[_0x197d('0xe')]=_0x5e5c6c;_0xf3864f['id']=0x1;var _0x18c8e4=JSON[_0x197d('0xf')](_0xf3864f);var _0x352b91={'encoding':_0x197d('0x10'),'method':'POST','timeout':0x2710,'url':_0x5e9564,'headers':{'Content-Type':_0x197d('0x11')},'body':_0x18c8e4};return rp(_0x352b91)[_0x197d('0x12')](function(_0x3be416){const _0x4da24c=JSON[_0x197d('0x13')](_0x3be416);if(!_0x4da24c[_0x197d('0x14')][_0x197d('0x15')]){throw new Error(_0x197d('0x16'));}var _0x3624cf=_0xb31794;var _0x364d66=_0x197d('0x17')+_0x2f5e9e+_0x197d('0x18')+_0xce6cc7+_0x197d('0x19')+_0x3624cf+_0x197d('0x1a')+JSON[_0x197d('0xf')](_0x1d8fe5);var _0x2f958b=_0x4f2ee8+'?'+_0x364d66;return rp(_0x2f958b);})[_0x197d('0x12')](function(_0x31317f){logger['info'](_0x197d('0x1b'),_0x10a3d9,_0x31317f);_0x4355a1['stop']();})[_0x197d('0x1c')](function(_0x2738e3){logger[_0x197d('0x1d')](_0x197d('0x1e'),_0x10a3d9,_[_0x197d('0x1f')](_0x2738e3)?JSON[_0x197d('0xf')](_0x2738e3):_0x2738e3);_0x4355a1[_0x197d('0x20')]();});}else{logger[_0x197d('0x21')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x10a3d9);_0x4355a1['next']();}};}; \ No newline at end of file +var _0x9749=['method','login','params','utf8','POST','parse','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&sessionId=','&data=','stringify','then','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','error','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x9749,0xec));var _0x9974=function(_0x6fca59,_0x97544d){_0x6fca59=_0x6fca59-0x0;var _0x5a3ca6=_0x9749[_0x6fca59];return _0x5a3ca6;};'use strict';var rp=require(_0x9974('0x0'));var logger=require(_0x9974('0x1'))(_0x9974('0x2'));var _=require(_0x9974('0x3'));var arr=[];exports[_0x9974('0x4')]=function(_0x5d3fd7,_0x5e2bd0){return function(_0x4a9944){var _0x46d646=_0x5e2bd0[0xa];var _0xf2b124=_0x5e2bd0[0xb];var _0x43231f=_0x5e2bd0[0xc];var _0x5a0b68=_0x5e2bd0[0xd];var _0x1bf847=_0x5e2bd0[0xe];var _0x2a8df=_0x5e2bd0[0xf][_0x9974('0x5')](/\n/g,'\x20-\x20');var _0x998326=_0x5e2bd0[0x10][_0x9974('0x5')](/\n/g,'\x20');if(!arr['includes'](_0xf2b124)){arr['push'](_0xf2b124);var _0x20e5d9=_0x5e2bd0[0x3];var _0x2f5932=_0x5e2bd0[0x4];var _0x3ebeeb=_0x5e2bd0[0x1];var _0x597567=_0x5e2bd0[0x0];var _0x40746a={};_0x40746a[_0x9974('0x6')]=_0x5e2bd0[0x8]+_0x9974('0x7')+_0x43231f+'|'+_0x46d646+'|'+_0x5a0b68+'|'+_0xf2b124+'|'+_0x1bf847;_0x40746a[_0x9974('0x8')]=_0x5e2bd0[0x7]+'?params='+_0x43231f+'|'+_0x46d646+'|'+_0x5a0b68+'|'+_0xf2b124+'|'+_0x1bf847+'|'+_0x2a8df+'|'+_0x998326;_0x40746a[_0x9974('0x9')]=_0x5e2bd0[0x9];var _0xa0c39d={};_0xa0c39d[_0x9974('0xa')]=_0x9974('0xb');_0xa0c39d[_0x9974('0xc')]=_0x9974('0xd');var _0x2d1ead=[];_0x2d1ead['push'](_0x5e2bd0[0x2]);_0x2d1ead['push'](_0x5e2bd0[0x5]);_0x2d1ead['push'](_0x5e2bd0[0x6]);_0xa0c39d[_0x9974('0xe')]=_0x2d1ead;_0xa0c39d['id']=0x1;var _0x5f9cb9=JSON['stringify'](_0xa0c39d);var _0x2a40e3={'encoding':_0x9974('0xf'),'method':_0x9974('0x10'),'timeout':0x2710,'url':_0x20e5d9,'headers':{'Content-Type':'application/json-rpc'},'body':_0x5f9cb9};return rp(_0x2a40e3)['then'](function(_0x49aa11){const _0x19e8d7=JSON[_0x9974('0x11')](_0x49aa11);if(!_0x19e8d7['result']['logged']){throw new Error(_0x9974('0x12'));}var _0x5c5120=_0xf2b124;var _0x20f1cb=_0x9974('0x13')+_0x3ebeeb+'&serviceId='+_0x597567+_0x9974('0x14')+_0x5c5120+_0x9974('0x15')+JSON[_0x9974('0x16')](_0x40746a);var _0xc574b=_0x2f5932+'?'+_0x20f1cb;return rp(_0xc574b);})[_0x9974('0x17')](function(_0x180f17){logger[_0x9974('0x18')](_0x9974('0x19'),_0x5d3fd7,_0x180f17);_0x4a9944[_0x9974('0x1a')]();})['catch'](function(_0x4f55b3){logger[_0x9974('0x1b')]('[%s][TVOX]\x20%s',_0x5d3fd7,_[_0x9974('0x1c')](_0x4f55b3)?JSON[_0x9974('0x16')](_0x4f55b3):_0x4f55b3);_0x4a9944[_0x9974('0x1a')]();});}else{logger[_0x9974('0x18')](_0x9974('0x1d'),_0x5d3fd7);_0x4a9944[_0x9974('0x1e')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index f13d553..eb51f91 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(_0x5a5ac0,_0x60b80d){var _0x3d1029=function(_0x4f9489){while(--_0x4f9489){_0x5a5ac0['push'](_0x5a5ac0['shift']());}};_0x3d1029(++_0x60b80d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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 _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x170d40,_0x56c84e){var _0x265ddc=function(_0x2852d8){while(--_0x2852d8){_0x170d40['push'](_0x170d40['shift']());}};_0x265ddc(++_0x56c84e);}(_0xe706,0xa3));var _0x6e70=function(_0x627b1b,_0x462114){_0x627b1b=_0x627b1b-0x0;var _0x2fd022=_0xe706[_0x627b1b];return _0x2fd022;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index e48c4da..15ea574 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 _0xaf4c=['smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','util','path','bluebird','uuid','./applications/utils','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','isNil','IntervalId','map','interval','listen','channel','message','interaction','applications','isArray','length','existsSync','join','.js','app','autoreply','appdata','split','push','slice','dialogflow','dialogflowv2','amazonlex','tag','TagId','account','notificationTemplate','ChatWebsiteId','ContactId','body','format','%s:%s:%s','./interval','condition','consequence','info','Push\x20new\x20rule','on\x20interval','intervals','error','Please\x20create\x20a\x20new\x20file\x20under','rules','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','waiting','mailQueues','name','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions'];(function(_0xf7c466,_0x15d95a){var _0x51ecbd=function(_0x1cee71){while(--_0x1cee71){_0xf7c466['push'](_0xf7c466['shift']());}};_0x51ecbd(++_0x15d95a);}(_0xaf4c,0x1ed));var _0xcaf4=function(_0x248c57,_0x9d550){_0x248c57=_0x248c57-0x0;var _0x3ccc83=_0xaf4c[_0x248c57];return _0x3ccc83;};'use strict';var _=require('lodash');var util=require(_0xcaf4('0x0'));var path=require(_0xcaf4('0x1'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xcaf4('0x2'));var uuid=require(_0xcaf4('0x3'));var utils=require(_0xcaf4('0x4'));var config=require('../../../config/environment');var logger=require(_0xcaf4('0x5'))(_0xcaf4('0x6'));var rpc={'openchannelQueueReport':require(_0xcaf4('0x7')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0xcaf4('0x8')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0xcaf4('0x9')),'whatsappQueueReport':require(_0xcaf4('0xa'))};var RuleEngine=require(_0xcaf4('0xb'));function getId(_0x3380fa,_0x3a604b,_0x299c1e){return util['format']('%s.%s.%s',_0x3380fa,_0x3a604b||0x0,_0x299c1e||0x0);}function getIntervals(_0x2191f5,_0x30773e){var _0x154e38=[];if(!_[_0xcaf4('0xc')](_0x30773e[_0xcaf4('0xd')])&&!_[_0xcaf4('0xc')](_0x2191f5[_0x30773e[_0xcaf4('0xd')]])&&!_[_0xcaf4('0xc')](_0x2191f5[_0x30773e[_0xcaf4('0xd')]]['Intervals'])){_0x154e38=_[_0xcaf4('0xe')](_0x2191f5[_0x30773e[_0xcaf4('0xd')]]['Intervals'],_0xcaf4('0xf'));}else if(!_[_0xcaf4('0xc')](_0x30773e[_0xcaf4('0xf')])){_0x154e38=[_0x30773e['interval']];}return _0x154e38;}exports[_0xcaf4('0x10')]=function(_0x2ad48b){_0x2ad48b['rules']={};return new BPromise(function(_0x3e33e7,_0x5bc998){var _0x2a1243={'Start':function(_0x191f38){var _0x67532a=this;return new Promise(function(_0x1ec93e,_0x1380f9){if(_0x191f38){try{var _0x3bfcc5=[];var _0x4d2817=getId(_0x191f38[_0xcaf4('0x11')],_0x191f38['message']?_0x191f38[_0xcaf4('0x12')]['id']:0x0,_0x191f38['interaction']?_0x191f38[_0xcaf4('0x13')]['id']:0x0);if(_0x191f38[_0xcaf4('0x14')]&&_[_0xcaf4('0x15')](_0x191f38['applications'])&&_0x191f38['applications'][_0xcaf4('0x16')]){for(var _0x2c9828=0x0;_0x2c9828<_0x191f38[_0xcaf4('0x14')][_0xcaf4('0x16')];_0x2c9828+=0x1){var _0x28b378=_0x191f38['applications'][_0x2c9828];if(fs[_0xcaf4('0x17')](path[_0xcaf4('0x18')](__dirname,_0xcaf4('0x14'),_0x28b378['app']+_0xcaf4('0x19')))){var _0x2b500b=[];switch(_0x28b378[_0xcaf4('0x1a')]['toLowerCase']()){case _0xcaf4('0x1b'):var _0x4a0adb=_0x28b378[_0xcaf4('0x1c')][_0xcaf4('0x1d')](',');if(_0x191f38[_0xcaf4('0x11')]==='mail'){_0x2b500b[_0xcaf4('0x1e')](_0x4a0adb[0x0]);_0x2b500b[_0xcaf4('0x1e')](_0x4a0adb[0x1]);_0x2b500b[_0xcaf4('0x1e')](_0x4a0adb[_0xcaf4('0x1f')](0x2,_0x4a0adb['length'])[_0xcaf4('0x18')](','));}else{_0x2b500b[_0xcaf4('0x1e')](_0x4a0adb[0x0]);_0x2b500b['push'](_0x4a0adb[_0xcaf4('0x1f')](0x1,_0x4a0adb[_0xcaf4('0x16')])[_0xcaf4('0x18')](','));}break;case _0xcaf4('0x20'):var _0x25beed=_0x28b378[_0xcaf4('0x1c')][_0xcaf4('0x1d')](',');_0x2b500b['push'](_0x25beed[0x0]);_0x2b500b[_0xcaf4('0x1e')](_0x25beed[0x1]);_0x2b500b[_0xcaf4('0x1e')](_0x25beed[_0xcaf4('0x1f')](0x2,_0x25beed['length'])[_0xcaf4('0x18')](','));break;case _0xcaf4('0x21'):var _0x1fca09=_0x28b378[_0xcaf4('0x1c')][_0xcaf4('0x1d')](',');_0x2b500b[_0xcaf4('0x1e')](_0x1fca09[0x0]);_0x2b500b[_0xcaf4('0x1e')](_0x1fca09[0x1]);_0x2b500b['push'](_0x1fca09[0x2]);_0x2b500b[_0xcaf4('0x1e')](_0x1fca09[0x3]);_0x2b500b['push'](_0x1fca09['slice'](0x4,_0x1fca09[_0xcaf4('0x16')])['join'](','));break;case _0xcaf4('0x22'):var _0x4943b3=_0x28b378[_0xcaf4('0x1c')]['split'](',');_0x2b500b[_0xcaf4('0x1e')](_0x4943b3[0x0]);_0x2b500b[_0xcaf4('0x1e')](_0x4943b3[0x1]);_0x2b500b[_0xcaf4('0x1e')](_0x4943b3[0x2]);_0x2b500b[_0xcaf4('0x1e')](_0x4943b3[0x3]);_0x2b500b[_0xcaf4('0x1e')](_0x4943b3[_0xcaf4('0x1f')](0x4,_0x4943b3[_0xcaf4('0x16')])[_0xcaf4('0x18')](','));break;case'message':_0x2b500b[_0xcaf4('0x1e')](_0x28b378[_0xcaf4('0x1c')]);break;case _0xcaf4('0x23'):_0x2b500b[_0xcaf4('0x1e')](_0x28b378[_0xcaf4('0x24')]);_0x2b500b['push'](_0x28b378['appdata']);break;case'tvox':var _0x4a3e3f=utils['getMustacheRender'](_0x191f38[_0xcaf4('0x25')][_0xcaf4('0x26')],_0x191f38);var _0x138a5f=_0x28b378['appdata'][_0xcaf4('0x1d')](',');_0x2b500b[_0xcaf4('0x1e')](_0x138a5f[0x0]);_0x2b500b[_0xcaf4('0x1e')](_0x138a5f[0x1]);_0x2b500b[_0xcaf4('0x1e')](_0x138a5f[0x2]);_0x2b500b['push'](_0x138a5f[0x3]);_0x2b500b['push'](_0x138a5f[0x4]);_0x2b500b['push'](_0x138a5f[0x5]);_0x2b500b['push'](_0x138a5f[0x6]);_0x2b500b['push'](_0x138a5f[0x7]);_0x2b500b[_0xcaf4('0x1e')](_0x138a5f[0x8]);_0x2b500b[_0xcaf4('0x1e')](_0x138a5f[0x9]);_0x2b500b['push'](_0x138a5f[0xa]);_0x2b500b[_0xcaf4('0x1e')](_0x191f38[_0xcaf4('0x13')]['id']);_0x2b500b['push'](_0x191f38[_0xcaf4('0x12')]['id']);_0x2b500b[_0xcaf4('0x1e')](_0x28b378[_0xcaf4('0x27')]);_0x2b500b['push'](_0x191f38['interaction'][_0xcaf4('0x28')]);_0x2b500b[_0xcaf4('0x1e')](_0x191f38[_0xcaf4('0x29')][_0xcaf4('0x29')]);_0x2b500b['push'](_0x4a3e3f);break;default:_0x2b500b=_[_0xcaf4('0xc')](_0x28b378[_0xcaf4('0x1c')])?[]:_0x28b378[_0xcaf4('0x1c')]['split'](',');}var _0x3c4d63={'id':util[_0xcaf4('0x2a')](_0xcaf4('0x2b'),_0x4d2817,_0x28b378['id'],_0x28b378[_0xcaf4('0x1a')]),'condition':require(_0xcaf4('0x2c'))[_0xcaf4('0x2d')](_0x4d2817,getIntervals(_0x2ad48b['intervals'],_0x28b378),_0x2ad48b),'consequence':require('./applications/'+_0x28b378[_0xcaf4('0x1a')])[_0xcaf4('0x2e')](_0x4d2817,_0x2b500b,_0x2ad48b,_0x191f38),'p':_0x28b378['priority']||0x0};logger[_0xcaf4('0x2f')](_0xcaf4('0x30'),_0x3c4d63['id'],_0xcaf4('0x31'),getIntervals(_0x2ad48b[_0xcaf4('0x32')],_0x28b378)[_0xcaf4('0x18')]('\x20|\x20'));_0x3bfcc5[_0xcaf4('0x1e')](_0x3c4d63);}else{logger[_0xcaf4('0x33')](_0xcaf4('0x34'),path[_0xcaf4('0x18')](__dirname,_0xcaf4('0x14'),_0x28b378['app']+_0xcaf4('0x19')));}}_0x2ad48b[_0xcaf4('0x35')][_0x4d2817]=new RuleEngine(_0x3bfcc5);_0x2ad48b[_0xcaf4('0x35')][_0x4d2817]['execute'](_0x191f38,function(_0x34d8ea){logger[_0xcaf4('0x2f')]('Applications\x20executed',JSON[_0xcaf4('0x36')](_0x34d8ea[_0xcaf4('0x37')]));if(_0x2ad48b[_0xcaf4('0x35')][_0x4d2817]){_0x2ad48b['rules'][_0x4d2817][_0xcaf4('0x38')](_0xcaf4('0x39'));}});return _0x1ec93e({'code':0xc8,'message':_0x191f38});}else{logger[_0xcaf4('0x2f')](_0xcaf4('0x3a'));return _0x1ec93e({'code':0xc8,'message':_0x191f38});}}catch(_0x2663a3){logger[_0xcaf4('0x33')](_0x2663a3[_0xcaf4('0x3b')]);return _0x1380f9(_0x67532a['error'](0x1f4,_0x2663a3));}}return _0x1380f9(_0xcaf4('0x3c'));});},'AcceptMessage':function(_0x2e984a){var _0x34b6b0=this;return new Promise(function(_0x456dbe,_0x1acdb4){if(_0x2e984a[_0xcaf4('0x3d')]&&_0x2e984a[_0xcaf4('0x3d')]['id']){if(_0x2ad48b[_0xcaf4('0x3e')][_0x2e984a[_0xcaf4('0x3d')]['id']]){_0x2ad48b['agents'][_0x2e984a['agent']['id']][_0xcaf4('0x3f')]=![];_0x2ad48b[_0xcaf4('0x3e')][_0x2e984a[_0xcaf4('0x3d')]['id']][_0xcaf4('0x40')]=undefined;}}if(_0x2e984a['message']&&_0x2e984a['message']['id']){try{var _0x326840=getId(_0x2e984a[_0xcaf4('0x11')],_0x2e984a['message']?_0x2e984a[_0xcaf4('0x12')]['id']:0x0,_0x2e984a[_0xcaf4('0x13')]?_0x2e984a[_0xcaf4('0x13')]['id']:0x0);if(_0x2ad48b[_0xcaf4('0x35')][_0x326840]){_0x2ad48b[_0xcaf4('0x35')][_0x326840][_0xcaf4('0x38')](_0xcaf4('0x41'));if(rpc[_0x2e984a[_0xcaf4('0x11')]+'QueueReport']){rpc[_0x2e984a['channel']+_0xcaf4('0x42')][_0xcaf4('0x43')](_0x326840,{'UserId':_0x2e984a[_0xcaf4('0x12')]['UserId']})[_0xcaf4('0x44')](function(_0x2d35be){logger['error'](_0xcaf4('0x45'));});}}return _0x456dbe({'code':0xc8,'message':_0x2e984a});}catch(_0x46d489){logger[_0xcaf4('0x33')](_0x46d489[_0xcaf4('0x3b')]);return _0x1acdb4(_0x34b6b0[_0xcaf4('0x33')](0x1f4,_0x46d489));}}logger[_0xcaf4('0x33')]('message\x20is\x20empty');return _0x1acdb4(_0x34b6b0[_0xcaf4('0x33')](0x1f4,_0xcaf4('0x46')));});},'RejectMessage':function(_0x4c0b37){var _0x1983dc=this;return new Promise(function(_0x5ce637,_0x51c928){if(_0x4c0b37['agent']&&_0x4c0b37[_0xcaf4('0x3d')]['id']){try{if(_0x2ad48b[_0xcaf4('0x3e')][_0x4c0b37[_0xcaf4('0x3d')]['id']]){_0x2ad48b[_0xcaf4('0x3e')][_0x4c0b37[_0xcaf4('0x3d')]['id']][_0xcaf4('0x3f')]=![];_0x2ad48b['agents'][_0x4c0b37['agent']['id']][_0xcaf4('0x40')]=undefined;}return _0x5ce637({'code':0xc8,'message':_0x4c0b37});}catch(_0x27c762){logger['error'](_0x27c762[_0xcaf4('0x3b')]);return _0x51c928(_0x1983dc[_0xcaf4('0x33')](0x1f4,_0x27c762));}}logger[_0xcaf4('0x33')](_0xcaf4('0x46'));return _0x51c928(_0x1983dc[_0xcaf4('0x33')](0x1f4,_0xcaf4('0x46')));});},'AbandonInteraction':function(_0x529e67){var _0x3e7370=this;return new Promise(function(_0x47911c,_0x4e14f4){if(_0x529e67[_0xcaf4('0x11')]&&_0x529e67['interaction']&&_0x529e67[_0xcaf4('0x13')]['id']){try{var _0x56eda6=getId(_0x529e67[_0xcaf4('0x11')],_0x529e67[_0xcaf4('0x12')]?_0x529e67[_0xcaf4('0x12')]['id']:0x0,_0x529e67['interaction']?_0x529e67[_0xcaf4('0x13')]['id']:0x0);if(_0x2ad48b[_0xcaf4('0x35')][_0x56eda6]){_0x2ad48b[_0xcaf4('0x35')][_0x56eda6][_0xcaf4('0x38')](_0xcaf4('0x41'));}return _0x47911c({'code':0xc8,'message':_0x529e67});}catch(_0xae6cbc){logger[_0xcaf4('0x33')](_0xae6cbc[_0xcaf4('0x3b')]);return _0x4e14f4(_0x3e7370[_0xcaf4('0x33')](0x1f4,_0xae6cbc));}}logger['error'](_0xcaf4('0x46'));return _0x4e14f4(_0x3e7370['error'](0x1f4,_0xcaf4('0x46')));});},'AgentCapacity':function(_0x318a31){var _0x3e6641=this;return new Promise(function(_0x136f75,_0x293a88){if(_0x2ad48b[_0xcaf4('0x3e')][_0xcaf4('0x47')](_0x318a31['id'])){for(var _0x195f26 in _0x318a31['capacity']){if(_0x318a31[_0xcaf4('0x48')][_0xcaf4('0x47')](_0x195f26)){if(_0x2ad48b[_0xcaf4('0x3e')][_0x318a31['id']][_0xcaf4('0x47')](_0x195f26+_0xcaf4('0x49'))){_0x2ad48b[_0xcaf4('0x3e')][_0x318a31['id']][_0x195f26+_0xcaf4('0x49')]=parseInt(_0x318a31[_0xcaf4('0x48')][_0x195f26],0xa);}}}_0x2ad48b['agents'][_0x318a31['id']][_0xcaf4('0x4a')]();return _0x136f75({'code':0xc8,'message':_0x2ad48b[_0xcaf4('0x3e')][_0x318a31['id']]});}else{return _0x293a88(_0x3e6641[_0xcaf4('0x33')](0x1f4,_0xcaf4('0x4b')));}});},'Agents':function(_0x2943a0){return new Promise(function(_0x314067,_0x2e820a){var _0x2449d8=_[_0xcaf4('0x4c')](_0x2ad48b[_0xcaf4('0x3e')]);_0x314067({'count':_0x2449d8[_0xcaf4('0x16')],'rows':_0x2449d8});});},'ChatQueues':function(_0xee99c4){return new Promise(function(_0x5e89a8,_0xd39332){var _0x2c3588=[];for(var _0x1b000b in _0x2ad48b[_0xcaf4('0x4d')]){if(_0x2ad48b[_0xcaf4('0x4d')]['hasOwnProperty'](_0x1b000b)){var _0x1977f1=_0x2ad48b[_0xcaf4('0x4d')][_0x1b000b];var _0x429b7a={'id':_0x1977f1['id'],'available':_0x1977f1[_0xcaf4('0x4e')],'loggedIn':_0x1977f1[_0xcaf4('0x4f')],'name':_0x1977f1['name'],'paused':_0x1977f1['paused'],'waiting':_0x1977f1[_0xcaf4('0x50')]};_0x2c3588[_0xcaf4('0x1e')](_0x429b7a);}}_0x5e89a8({'count':_0x2c3588[_0xcaf4('0x16')],'rows':_0x2c3588});});},'MailQueues':function(_0x5e7bd7){return new Promise(function(_0xdc7b0c,_0x315f34){var _0x4e3f91=[];for(var _0x904b7b in _0x2ad48b['mailQueues']){if(_0x2ad48b[_0xcaf4('0x51')]['hasOwnProperty'](_0x904b7b)){var _0x46ca25=_0x2ad48b[_0xcaf4('0x51')][_0x904b7b];var _0x5d3785={'id':_0x46ca25['id'],'available':_0x46ca25[_0xcaf4('0x4e')],'loggedIn':_0x46ca25['loggedIn'],'name':_0x46ca25[_0xcaf4('0x52')],'paused':_0x46ca25[_0xcaf4('0x53')],'waiting':_0x46ca25[_0xcaf4('0x50')]};_0x4e3f91['push'](_0x5d3785);}}_0xdc7b0c({'count':_0x4e3f91[_0xcaf4('0x16')],'rows':_0x4e3f91});});},'OpenchannelQueues':function(_0x492310){return new Promise(function(_0x435b23,_0x58a03f){var _0x5a4932=[];for(var _0x4d8942 in _0x2ad48b[_0xcaf4('0x54')]){if(_0x2ad48b[_0xcaf4('0x54')][_0xcaf4('0x47')](_0x4d8942)){var _0x4c6d46=_0x2ad48b[_0xcaf4('0x54')][_0x4d8942];var _0x21cdf1={'id':_0x4c6d46['id'],'available':_0x4c6d46[_0xcaf4('0x4e')],'loggedIn':_0x4c6d46[_0xcaf4('0x4f')],'name':_0x4c6d46[_0xcaf4('0x52')],'paused':_0x4c6d46['paused'],'waiting':_0x4c6d46['waiting']};_0x5a4932[_0xcaf4('0x1e')](_0x21cdf1);}}_0x435b23({'count':_0x5a4932[_0xcaf4('0x16')],'rows':_0x5a4932});});},'SmsQueues':function(_0x25956f){return new Promise(function(_0x11418e,_0x552998){var _0x6dc795=[];for(var _0x336ac3 in _0x2ad48b[_0xcaf4('0x55')]){if(_0x2ad48b[_0xcaf4('0x55')][_0xcaf4('0x47')](_0x336ac3)){var _0x563352=_0x2ad48b[_0xcaf4('0x55')][_0x336ac3];var _0x335156={'id':_0x563352['id'],'available':_0x563352['available'],'loggedIn':_0x563352[_0xcaf4('0x4f')],'name':_0x563352['name'],'paused':_0x563352['paused'],'waiting':_0x563352[_0xcaf4('0x50')]};_0x6dc795[_0xcaf4('0x1e')](_0x335156);}}_0x11418e({'count':_0x6dc795[_0xcaf4('0x16')],'rows':_0x6dc795});});},'FaxQueues':function(_0x322dd9){return new Promise(function(_0xb12d29,_0xeffbed){var _0x42730c=[];for(var _0x2267b2 in _0x2ad48b[_0xcaf4('0x56')]){if(_0x2ad48b['faxQueues'][_0xcaf4('0x47')](_0x2267b2)){var _0x3e9a10=_0x2ad48b['faxQueues'][_0x2267b2];var _0x3742d7={'id':_0x3e9a10['id'],'available':_0x3e9a10[_0xcaf4('0x4e')],'loggedIn':_0x3e9a10[_0xcaf4('0x4f')],'name':_0x3e9a10[_0xcaf4('0x52')],'paused':_0x3e9a10[_0xcaf4('0x53')],'waiting':_0x3e9a10[_0xcaf4('0x50')]};_0x42730c['push'](_0x3742d7);}}_0xb12d29({'count':_0x42730c[_0xcaf4('0x16')],'rows':_0x42730c});});},'WhatsappQueues':function(_0x33e7b4){return new Promise(function(_0x345527,_0x1800d6){var _0x51348c=[];for(var _0x5a70ed in _0x2ad48b[_0xcaf4('0x57')]){if(_0x2ad48b[_0xcaf4('0x57')][_0xcaf4('0x47')](_0x5a70ed)){var _0x2abd60=_0x2ad48b[_0xcaf4('0x57')][_0x5a70ed];var _0x58be8d={'id':_0x2abd60['id'],'available':_0x2abd60[_0xcaf4('0x4e')],'loggedIn':_0x2abd60['loggedIn'],'name':_0x2abd60[_0xcaf4('0x52')],'paused':_0x2abd60[_0xcaf4('0x53')],'waiting':_0x2abd60[_0xcaf4('0x50')]};_0x51348c['push'](_0x58be8d);}}_0x345527({'count':_0x51348c[_0xcaf4('0x16')],'rows':_0x51348c});});},'ChatQueuesWaitingInteractions':function(_0x476cd4){return new Promise(function(_0x18c7a5,_0x292b93){var _0x39d611=_[_0xcaf4('0x4c')](_0x2ad48b[_0xcaf4('0x58')]);_0x18c7a5({'count':_0x39d611[_0xcaf4('0x16')],'rows':_0x39d611});});},'MailQueuesWaitingInteractions':function(_0x44729a){return new Promise(function(_0x2425c0,_0x2d0c2e){var _0x2cc17d=_[_0xcaf4('0x4c')](_0x2ad48b['mailQueuesWaitingInteractions']);_0x2425c0({'count':_0x2cc17d[_0xcaf4('0x16')],'rows':_0x2cc17d});});},'OpenchannelQueuesWaitingInteractions':function(_0x1ecdb6){return new Promise(function(_0x4d7668,_0x1fbee5){var _0x37b00c=_['values'](_0x2ad48b['openchannelQueuesWaitingInteractions']);_0x4d7668({'count':_0x37b00c[_0xcaf4('0x16')],'rows':_0x37b00c});});},'SmsQueuesWaitingInteractions':function(_0x21644f){return new Promise(function(_0x2d8eff,_0x4e5528){var _0x3c5a1c=_[_0xcaf4('0x4c')](_0x2ad48b[_0xcaf4('0x59')]);_0x2d8eff({'count':_0x3c5a1c[_0xcaf4('0x16')],'rows':_0x3c5a1c});});},'FaxQueuesWaitingInteractions':function(_0x2fff9b){return new Promise(function(_0x1e2304,_0xc39155){var _0x2103b3=_[_0xcaf4('0x4c')](_0x2ad48b[_0xcaf4('0x5a')]);_0x1e2304({'count':_0x2103b3[_0xcaf4('0x16')],'rows':_0x2103b3});});},'WhatsappQueuesWaitingInteractions':function(_0x33a89b){return new Promise(function(_0x4989b7,_0x34712d){var _0x21ba9a=_[_0xcaf4('0x4c')](_0x2ad48b[_0xcaf4('0x5b')]);_0x4989b7({'count':_0x21ba9a[_0xcaf4('0x16')],'rows':_0x21ba9a});});}};var _0x307ee8=jayson[_0xcaf4('0x5c')](_0x2a1243)[_0xcaf4('0x5d')]();_0x307ee8['on'](_0xcaf4('0x33'),function(_0x1ded40){logger[_0xcaf4('0x33')](JSON[_0xcaf4('0x36')](_0x1ded40));return _0x5bc998(_0x1ded40);});_0x307ee8[_0xcaf4('0x10')](0x232c,_0xcaf4('0x5e'),function(){console[_0xcaf4('0x5f')](_0xcaf4('0x60'),0x232c);return _0x3e33e7('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x9434=['join','app','toLowerCase','autoreply','appdata','split','channel','push','slice','dialogflow','dialogflowv2','amazonlex','tag','TagId','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','stringify','matchPath','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','emit','QueueReport','update','catch','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','chatQueues','available','loggedIn','name','paused','mailQueues','openchannelQueues','waiting','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','interval','listen','rules','message','interaction','applications','length','existsSync'];(function(_0x2b6600,_0x24c497){var _0x912ee2=function(_0x5d6484){while(--_0x5d6484){_0x2b6600['push'](_0x2b6600['shift']());}};_0x912ee2(++_0x24c497);}(_0x9434,0x168));var _0x4943=function(_0xa6fbeb,_0x2a9dc8){_0xa6fbeb=_0xa6fbeb-0x0;var _0x5cbdd0=_0x9434[_0xa6fbeb];return _0x5cbdd0;};'use strict';var _=require(_0x4943('0x0'));var util=require(_0x4943('0x1'));var path=require(_0x4943('0x2'));var fs=require('fs');var jayson=require(_0x4943('0x3'));var BPromise=require(_0x4943('0x4'));var uuid=require(_0x4943('0x5'));var utils=require('./applications/utils');var config=require(_0x4943('0x6'));var logger=require(_0x4943('0x7'))('routing');var rpc={'openchannelQueueReport':require(_0x4943('0x8')),'mailQueueReport':require(_0x4943('0x9')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x4943('0xa')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x4943('0xb'));function getId(_0x2f4119,_0x1876eb,_0x32f535){return util[_0x4943('0xc')]('%s.%s.%s',_0x2f4119,_0x1876eb||0x0,_0x32f535||0x0);}function getIntervals(_0x51b504,_0x3057c4){var _0x1bc269=[];if(!_[_0x4943('0xd')](_0x3057c4['IntervalId'])&&!_[_0x4943('0xd')](_0x51b504[_0x3057c4[_0x4943('0xe')]])&&!_['isNil'](_0x51b504[_0x3057c4[_0x4943('0xe')]]['Intervals'])){_0x1bc269=_['map'](_0x51b504[_0x3057c4[_0x4943('0xe')]][_0x4943('0xf')],_0x4943('0x10'));}else if(!_[_0x4943('0xd')](_0x3057c4[_0x4943('0x10')])){_0x1bc269=[_0x3057c4[_0x4943('0x10')]];}return _0x1bc269;}exports[_0x4943('0x11')]=function(_0x524c8a){_0x524c8a[_0x4943('0x12')]={};return new BPromise(function(_0xf4ec0b,_0x2ae9b5){var _0x13d758={'Start':function(_0x37c843){var _0x39b4e3=this;return new Promise(function(_0x4b075e,_0x26b707){if(_0x37c843){try{var _0x407485=[];var _0xb08628=getId(_0x37c843['channel'],_0x37c843['message']?_0x37c843[_0x4943('0x13')]['id']:0x0,_0x37c843['interaction']?_0x37c843[_0x4943('0x14')]['id']:0x0);if(_0x37c843[_0x4943('0x15')]&&_['isArray'](_0x37c843[_0x4943('0x15')])&&_0x37c843[_0x4943('0x15')][_0x4943('0x16')]){for(var _0x494bef=0x0;_0x494bef<_0x37c843[_0x4943('0x15')]['length'];_0x494bef+=0x1){var _0x2833ed=_0x37c843[_0x4943('0x15')][_0x494bef];if(fs[_0x4943('0x17')](path[_0x4943('0x18')](__dirname,_0x4943('0x15'),_0x2833ed[_0x4943('0x19')]+'.js'))){var _0x1ceb6f=[];switch(_0x2833ed[_0x4943('0x19')][_0x4943('0x1a')]()){case _0x4943('0x1b'):var _0x3cbc1c=_0x2833ed[_0x4943('0x1c')][_0x4943('0x1d')](',');if(_0x37c843[_0x4943('0x1e')]==='mail'){_0x1ceb6f['push'](_0x3cbc1c[0x0]);_0x1ceb6f[_0x4943('0x1f')](_0x3cbc1c[0x1]);_0x1ceb6f[_0x4943('0x1f')](_0x3cbc1c[_0x4943('0x20')](0x2,_0x3cbc1c['length'])[_0x4943('0x18')](','));}else{_0x1ceb6f[_0x4943('0x1f')](_0x3cbc1c[0x0]);_0x1ceb6f['push'](_0x3cbc1c[_0x4943('0x20')](0x1,_0x3cbc1c[_0x4943('0x16')])[_0x4943('0x18')](','));}break;case _0x4943('0x21'):var _0x35f393=_0x2833ed[_0x4943('0x1c')][_0x4943('0x1d')](',');_0x1ceb6f[_0x4943('0x1f')](_0x35f393[0x0]);_0x1ceb6f[_0x4943('0x1f')](_0x35f393[0x1]);_0x1ceb6f[_0x4943('0x1f')](_0x35f393[_0x4943('0x20')](0x2,_0x35f393[_0x4943('0x16')])[_0x4943('0x18')](','));break;case _0x4943('0x22'):var _0x38b0a0=_0x2833ed[_0x4943('0x1c')][_0x4943('0x1d')](',');_0x1ceb6f[_0x4943('0x1f')](_0x38b0a0[0x0]);_0x1ceb6f['push'](_0x38b0a0[0x1]);_0x1ceb6f[_0x4943('0x1f')](_0x38b0a0[0x2]);_0x1ceb6f['push'](_0x38b0a0[0x3]);_0x1ceb6f[_0x4943('0x1f')](_0x38b0a0[_0x4943('0x20')](0x4,_0x38b0a0[_0x4943('0x16')])[_0x4943('0x18')](','));break;case _0x4943('0x23'):var _0x248486=_0x2833ed[_0x4943('0x1c')][_0x4943('0x1d')](',');_0x1ceb6f['push'](_0x248486[0x0]);_0x1ceb6f[_0x4943('0x1f')](_0x248486[0x1]);_0x1ceb6f[_0x4943('0x1f')](_0x248486[0x2]);_0x1ceb6f['push'](_0x248486[0x3]);_0x1ceb6f[_0x4943('0x1f')](_0x248486[_0x4943('0x20')](0x4,_0x248486['length'])[_0x4943('0x18')](','));break;case _0x4943('0x13'):_0x1ceb6f[_0x4943('0x1f')](_0x2833ed['appdata']);break;case _0x4943('0x24'):_0x1ceb6f[_0x4943('0x1f')](_0x2833ed[_0x4943('0x25')]);_0x1ceb6f[_0x4943('0x1f')](_0x2833ed[_0x4943('0x1c')]);break;case'tvox':var _0x425a40=utils[_0x4943('0x26')](_0x37c843[_0x4943('0x27')][_0x4943('0x28')],_0x37c843);var _0x178cc9=_0x2833ed[_0x4943('0x1c')][_0x4943('0x1d')](',');_0x1ceb6f[_0x4943('0x1f')](_0x178cc9[0x0]);_0x1ceb6f[_0x4943('0x1f')](_0x178cc9[0x1]);_0x1ceb6f[_0x4943('0x1f')](_0x178cc9[0x2]);_0x1ceb6f[_0x4943('0x1f')](_0x178cc9[0x3]);_0x1ceb6f['push'](_0x178cc9[0x4]);_0x1ceb6f[_0x4943('0x1f')](_0x178cc9[0x5]);_0x1ceb6f[_0x4943('0x1f')](_0x178cc9[0x6]);_0x1ceb6f[_0x4943('0x1f')](_0x178cc9[0x7]);_0x1ceb6f[_0x4943('0x1f')](_0x178cc9[0x8]);_0x1ceb6f[_0x4943('0x1f')](_0x178cc9[0x9]);_0x1ceb6f['push'](_0x178cc9[0xa]);_0x1ceb6f['push'](_0x37c843['interaction']['id']);_0x1ceb6f[_0x4943('0x1f')](_0x37c843[_0x4943('0x13')]['id']);_0x1ceb6f['push'](_0x2833ed[_0x4943('0x29')]);_0x1ceb6f['push'](_0x37c843[_0x4943('0x14')][_0x4943('0x2a')]);_0x1ceb6f[_0x4943('0x1f')](_0x37c843[_0x4943('0x2b')][_0x4943('0x2b')]);_0x1ceb6f[_0x4943('0x1f')](_0x425a40);break;default:_0x1ceb6f=_[_0x4943('0xd')](_0x2833ed[_0x4943('0x1c')])?[]:_0x2833ed[_0x4943('0x1c')][_0x4943('0x1d')](',');}var _0x25d36e={'id':util[_0x4943('0xc')](_0x4943('0x2c'),_0xb08628,_0x2833ed['id'],_0x2833ed[_0x4943('0x19')]),'condition':require(_0x4943('0x2d'))[_0x4943('0x2e')](_0xb08628,getIntervals(_0x524c8a[_0x4943('0x2f')],_0x2833ed),_0x524c8a),'consequence':require(_0x4943('0x30')+_0x2833ed[_0x4943('0x19')])[_0x4943('0x31')](_0xb08628,_0x1ceb6f,_0x524c8a,_0x37c843),'p':_0x2833ed[_0x4943('0x32')]||0x0};logger[_0x4943('0x33')](_0x4943('0x34'),_0x25d36e['id'],_0x4943('0x35'),getIntervals(_0x524c8a[_0x4943('0x2f')],_0x2833ed)[_0x4943('0x18')](_0x4943('0x36')));_0x407485['push'](_0x25d36e);}else{logger[_0x4943('0x37')](_0x4943('0x38'),path['join'](__dirname,'applications',_0x2833ed[_0x4943('0x19')]+'.js'));}}_0x524c8a[_0x4943('0x12')][_0xb08628]=new RuleEngine(_0x407485);_0x524c8a['rules'][_0xb08628][_0x4943('0x39')](_0x37c843,function(_0x54db13){logger[_0x4943('0x33')]('Applications\x20executed',JSON[_0x4943('0x3a')](_0x54db13[_0x4943('0x3b')]));if(_0x524c8a[_0x4943('0x12')][_0xb08628]){_0x524c8a['rules'][_0xb08628]['emit'](_0x4943('0x3c'));}});return _0x4b075e({'code':0xc8,'message':_0x37c843});}else{logger['info'](_0x4943('0x3d'));return _0x4b075e({'code':0xc8,'message':_0x37c843});}}catch(_0x5c44c5){logger[_0x4943('0x37')](_0x5c44c5[_0x4943('0x3e')]);return _0x26b707(_0x39b4e3[_0x4943('0x37')](0x1f4,_0x5c44c5));}}return _0x26b707(_0x4943('0x3f'));});},'AcceptMessage':function(_0x54462e){var _0x5f178a=this;return new Promise(function(_0x4021b0,_0x53ddcc){if(_0x54462e['agent']&&_0x54462e[_0x4943('0x40')]['id']){if(_0x524c8a[_0x4943('0x41')][_0x54462e[_0x4943('0x40')]['id']]){_0x524c8a[_0x4943('0x41')][_0x54462e[_0x4943('0x40')]['id']][_0x4943('0x42')]=![];_0x524c8a[_0x4943('0x41')][_0x54462e['agent']['id']][_0x4943('0x43')]=undefined;}}if(_0x54462e[_0x4943('0x13')]&&_0x54462e['message']['id']){try{var _0x1d413b=getId(_0x54462e[_0x4943('0x1e')],_0x54462e[_0x4943('0x13')]?_0x54462e['message']['id']:0x0,_0x54462e[_0x4943('0x14')]?_0x54462e[_0x4943('0x14')]['id']:0x0);if(_0x524c8a['rules'][_0x1d413b]){_0x524c8a[_0x4943('0x12')][_0x1d413b][_0x4943('0x44')]('end');if(rpc[_0x54462e[_0x4943('0x1e')]+_0x4943('0x45')]){rpc[_0x54462e[_0x4943('0x1e')]+'QueueReport'][_0x4943('0x46')](_0x1d413b,{'UserId':_0x54462e['message']['UserId']})[_0x4943('0x47')](function(_0x33a332){logger[_0x4943('0x37')]('error\x20update\x20queue\x20report');});}}return _0x4021b0({'code':0xc8,'message':_0x54462e});}catch(_0x582156){logger['error'](_0x582156[_0x4943('0x3e')]);return _0x53ddcc(_0x5f178a['error'](0x1f4,_0x582156));}}logger['error'](_0x4943('0x48'));return _0x53ddcc(_0x5f178a['error'](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x5e7fdc){var _0x40e75f=this;return new Promise(function(_0x2a17c4,_0x24288a){if(_0x5e7fdc['agent']&&_0x5e7fdc[_0x4943('0x40')]['id']){try{if(_0x524c8a[_0x4943('0x41')][_0x5e7fdc[_0x4943('0x40')]['id']]){_0x524c8a['agents'][_0x5e7fdc[_0x4943('0x40')]['id']][_0x4943('0x42')]=![];_0x524c8a['agents'][_0x5e7fdc['agent']['id']]['busyQueue']=undefined;}return _0x2a17c4({'code':0xc8,'message':_0x5e7fdc});}catch(_0x56eda3){logger[_0x4943('0x37')](_0x56eda3[_0x4943('0x3e')]);return _0x24288a(_0x40e75f[_0x4943('0x37')](0x1f4,_0x56eda3));}}logger[_0x4943('0x37')]('message\x20is\x20empty');return _0x24288a(_0x40e75f[_0x4943('0x37')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x574e4b){var _0x22cda5=this;return new Promise(function(_0x42d05c,_0x3d91a1){if(_0x574e4b['channel']&&_0x574e4b[_0x4943('0x14')]&&_0x574e4b[_0x4943('0x14')]['id']){try{var _0x2579b4=getId(_0x574e4b[_0x4943('0x1e')],_0x574e4b[_0x4943('0x13')]?_0x574e4b['message']['id']:0x0,_0x574e4b[_0x4943('0x14')]?_0x574e4b[_0x4943('0x14')]['id']:0x0);if(_0x524c8a[_0x4943('0x12')][_0x2579b4]){_0x524c8a[_0x4943('0x12')][_0x2579b4]['emit']('end');}return _0x42d05c({'code':0xc8,'message':_0x574e4b});}catch(_0x273493){logger[_0x4943('0x37')](_0x273493[_0x4943('0x3e')]);return _0x3d91a1(_0x22cda5['error'](0x1f4,_0x273493));}}logger[_0x4943('0x37')](_0x4943('0x48'));return _0x3d91a1(_0x22cda5[_0x4943('0x37')](0x1f4,_0x4943('0x48')));});},'AgentCapacity':function(_0x2ca08e){var _0x2b8a57=this;return new Promise(function(_0x4c70b9,_0x20af64){if(_0x524c8a[_0x4943('0x41')][_0x4943('0x49')](_0x2ca08e['id'])){for(var _0x404d6d in _0x2ca08e[_0x4943('0x4a')]){if(_0x2ca08e[_0x4943('0x4a')][_0x4943('0x49')](_0x404d6d)){if(_0x524c8a[_0x4943('0x41')][_0x2ca08e['id']][_0x4943('0x49')](_0x404d6d+'CurrentCapacity')){_0x524c8a['agents'][_0x2ca08e['id']][_0x404d6d+_0x4943('0x4b')]=parseInt(_0x2ca08e['capacity'][_0x404d6d],0xa);}}}_0x524c8a[_0x4943('0x41')][_0x2ca08e['id']][_0x4943('0x4c')]();return _0x4c70b9({'code':0xc8,'message':_0x524c8a['agents'][_0x2ca08e['id']]});}else{return _0x20af64(_0x2b8a57[_0x4943('0x37')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x548c36){return new Promise(function(_0x5db5a9,_0x5337b3){var _0xd2fcca=_[_0x4943('0x4d')](_0x524c8a[_0x4943('0x41')]);_0x5db5a9({'count':_0xd2fcca[_0x4943('0x16')],'rows':_0xd2fcca});});},'ChatQueues':function(_0x2b7583){return new Promise(function(_0x3027d1,_0xf10bb5){var _0x1d6262=[];for(var _0x3f6263 in _0x524c8a[_0x4943('0x4e')]){if(_0x524c8a[_0x4943('0x4e')][_0x4943('0x49')](_0x3f6263)){var _0x3ade87=_0x524c8a[_0x4943('0x4e')][_0x3f6263];var _0x1fb2a9={'id':_0x3ade87['id'],'available':_0x3ade87[_0x4943('0x4f')],'loggedIn':_0x3ade87[_0x4943('0x50')],'name':_0x3ade87[_0x4943('0x51')],'paused':_0x3ade87[_0x4943('0x52')],'waiting':_0x3ade87['waiting']};_0x1d6262[_0x4943('0x1f')](_0x1fb2a9);}}_0x3027d1({'count':_0x1d6262[_0x4943('0x16')],'rows':_0x1d6262});});},'MailQueues':function(_0x3d4819){return new Promise(function(_0x1f2d4f,_0x1d0f31){var _0x3ac03a=[];for(var _0x53e8cd in _0x524c8a['mailQueues']){if(_0x524c8a[_0x4943('0x53')][_0x4943('0x49')](_0x53e8cd)){var _0x3db3b4=_0x524c8a[_0x4943('0x53')][_0x53e8cd];var _0x2b2ae9={'id':_0x3db3b4['id'],'available':_0x3db3b4[_0x4943('0x4f')],'loggedIn':_0x3db3b4['loggedIn'],'name':_0x3db3b4[_0x4943('0x51')],'paused':_0x3db3b4[_0x4943('0x52')],'waiting':_0x3db3b4['waiting']};_0x3ac03a[_0x4943('0x1f')](_0x2b2ae9);}}_0x1f2d4f({'count':_0x3ac03a[_0x4943('0x16')],'rows':_0x3ac03a});});},'OpenchannelQueues':function(_0x4f60f8){return new Promise(function(_0x5a5e82,_0x2bad94){var _0x1681d1=[];for(var _0x4b8700 in _0x524c8a[_0x4943('0x54')]){if(_0x524c8a['openchannelQueues'][_0x4943('0x49')](_0x4b8700)){var _0x4259df=_0x524c8a[_0x4943('0x54')][_0x4b8700];var _0x3781ee={'id':_0x4259df['id'],'available':_0x4259df[_0x4943('0x4f')],'loggedIn':_0x4259df['loggedIn'],'name':_0x4259df[_0x4943('0x51')],'paused':_0x4259df[_0x4943('0x52')],'waiting':_0x4259df[_0x4943('0x55')]};_0x1681d1[_0x4943('0x1f')](_0x3781ee);}}_0x5a5e82({'count':_0x1681d1['length'],'rows':_0x1681d1});});},'SmsQueues':function(_0x2f6ba9){return new Promise(function(_0x3f3be4,_0x4bb47b){var _0xdaef10=[];for(var _0x441444 in _0x524c8a['smsQueues']){if(_0x524c8a[_0x4943('0x56')][_0x4943('0x49')](_0x441444)){var _0x538878=_0x524c8a['smsQueues'][_0x441444];var _0x5f4b3b={'id':_0x538878['id'],'available':_0x538878['available'],'loggedIn':_0x538878[_0x4943('0x50')],'name':_0x538878[_0x4943('0x51')],'paused':_0x538878[_0x4943('0x52')],'waiting':_0x538878['waiting']};_0xdaef10[_0x4943('0x1f')](_0x5f4b3b);}}_0x3f3be4({'count':_0xdaef10['length'],'rows':_0xdaef10});});},'FaxQueues':function(_0x106240){return new Promise(function(_0x3f76ee,_0x2382ba){var _0x5bd674=[];for(var _0x5ef17f in _0x524c8a['faxQueues']){if(_0x524c8a[_0x4943('0x57')][_0x4943('0x49')](_0x5ef17f)){var _0x4e424a=_0x524c8a[_0x4943('0x57')][_0x5ef17f];var _0x5bcd8c={'id':_0x4e424a['id'],'available':_0x4e424a[_0x4943('0x4f')],'loggedIn':_0x4e424a[_0x4943('0x50')],'name':_0x4e424a[_0x4943('0x51')],'paused':_0x4e424a['paused'],'waiting':_0x4e424a[_0x4943('0x55')]};_0x5bd674[_0x4943('0x1f')](_0x5bcd8c);}}_0x3f76ee({'count':_0x5bd674[_0x4943('0x16')],'rows':_0x5bd674});});},'WhatsappQueues':function(_0xa1c561){return new Promise(function(_0x59f800,_0x4a93f7){var _0x54cf5e=[];for(var _0x562941 in _0x524c8a[_0x4943('0x58')]){if(_0x524c8a[_0x4943('0x58')][_0x4943('0x49')](_0x562941)){var _0x5a7148=_0x524c8a[_0x4943('0x58')][_0x562941];var _0x556d88={'id':_0x5a7148['id'],'available':_0x5a7148[_0x4943('0x4f')],'loggedIn':_0x5a7148[_0x4943('0x50')],'name':_0x5a7148[_0x4943('0x51')],'paused':_0x5a7148[_0x4943('0x52')],'waiting':_0x5a7148[_0x4943('0x55')]};_0x54cf5e[_0x4943('0x1f')](_0x556d88);}}_0x59f800({'count':_0x54cf5e[_0x4943('0x16')],'rows':_0x54cf5e});});},'ChatQueuesWaitingInteractions':function(_0x5281a3){return new Promise(function(_0x12113c,_0x45d750){var _0x2afe7e=_[_0x4943('0x4d')](_0x524c8a[_0x4943('0x59')]);_0x12113c({'count':_0x2afe7e[_0x4943('0x16')],'rows':_0x2afe7e});});},'MailQueuesWaitingInteractions':function(_0x5379e5){return new Promise(function(_0x3a04d2,_0x1a9274){var _0x52d96e=_['values'](_0x524c8a['mailQueuesWaitingInteractions']);_0x3a04d2({'count':_0x52d96e['length'],'rows':_0x52d96e});});},'OpenchannelQueuesWaitingInteractions':function(_0x9c7a90){return new Promise(function(_0x4be4da,_0x5e2efa){var _0x479593=_['values'](_0x524c8a['openchannelQueuesWaitingInteractions']);_0x4be4da({'count':_0x479593[_0x4943('0x16')],'rows':_0x479593});});},'SmsQueuesWaitingInteractions':function(_0x386244){return new Promise(function(_0x27a1b8,_0x4ae248){var _0x1eaf2f=_[_0x4943('0x4d')](_0x524c8a[_0x4943('0x5a')]);_0x27a1b8({'count':_0x1eaf2f[_0x4943('0x16')],'rows':_0x1eaf2f});});},'FaxQueuesWaitingInteractions':function(_0x52ddee){return new Promise(function(_0x1c3d66,_0x165a23){var _0x404086=_['values'](_0x524c8a[_0x4943('0x5b')]);_0x1c3d66({'count':_0x404086[_0x4943('0x16')],'rows':_0x404086});});},'WhatsappQueuesWaitingInteractions':function(_0x46000f){return new Promise(function(_0xd23b93,_0x25d48e){var _0x258792=_[_0x4943('0x4d')](_0x524c8a[_0x4943('0x5c')]);_0xd23b93({'count':_0x258792['length'],'rows':_0x258792});});}};var _0x6d85f4=jayson[_0x4943('0x5d')](_0x13d758)['http']();_0x6d85f4['on'](_0x4943('0x37'),function(_0x55cc6b){logger['error'](JSON['stringify'](_0x55cc6b));return _0x2ae9b5(_0x55cc6b);});_0x6d85f4[_0x4943('0x11')](0x232c,'127.0.0.1',function(){console[_0x4943('0x5e')](_0x4943('0x5f'),0x232c);return _0xf4ec0b('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 a83977f..4bcab20 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 _0x04f9=['join','stack','util','jayson/promise','../../../config/logger','client','http','request','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','log'];(function(_0x295815,_0x456aa1){var _0x4c4f66=function(_0x3864f5){while(--_0x3864f5){_0x295815['push'](_0x295815['shift']());}};_0x4c4f66(++_0x456aa1);}(_0x04f9,0x176));var _0x904f=function(_0x5affa4,_0x5c7acf){_0x5affa4=_0x5affa4-0x0;var _0xd706c3=_0x04f9[_0x5affa4];return _0xd706c3;};'use strict';var util=require(_0x904f('0x0'));var BPromise=require('bluebird');var jayson=require(_0x904f('0x1'));var _=require('lodash');var logger=require(_0x904f('0x2'))('routing');var client=jayson[_0x904f('0x3')][_0x904f('0x4')]({'port':0x232a});function request(_0x8f2632,_0x53f001){return new BPromise(function(_0x53cb04,_0x4a1942){return client[_0x904f('0x5')](_0x8f2632,_0x53f001)[_0x904f('0x6')](function(_0x1f0648){if(_0x1f0648[_0x904f('0x7')]){return _0x4a1942(_0x1f0648[_0x904f('0x7')][_0x904f('0x8')]);}else{return _0x53cb04(_0x1f0648[_0x904f('0x9')]);}})[_0x904f('0xa')](function(_0x58cf77){return _0x4a1942(_0x58cf77);});});}exports[_0x904f('0xb')]=function(_0x2bab96,_0x5a4b99,_0x59aae7){return function(_0x5a7e1e){if(_0x59aae7[_0x904f('0xc')]&&!_0x59aae7['rules'][_0x2bab96]){logger[_0x904f('0xd')](_0x904f('0xe'),_0x2bab96);return _0x5a7e1e[_0x904f('0xf')]();}var _0x1afefd=[];for(var _0x378f0d=0x0;_0x378f0d<_0x5a4b99[_0x904f('0x10')];_0x378f0d+=0x1){_0x1afefd[_0x904f('0x11')](request(_0x904f('0x12'),{'command':util[_0x904f('0x13')](_0x904f('0x14'),_0x5a4b99[_0x378f0d])})[_0x904f('0x6')](function(_0x261adf){return _0x261adf&&_0x261adf[_0x904f('0x8')]&&_0x261adf[_0x904f('0x8')][_0x904f('0x15')](_0x904f('0x16'))>=0x0?!![]:![];})['catch'](function(_0x23e0bc){logger[_0x904f('0x7')](_0x904f('0x17'),_0x2bab96,_0x5a4b99[_0x378f0d]);}));}BPromise[_0x904f('0x18')](_0x1afefd)[_0x904f('0x6')](function(_0x3412de){var _0x1c4814=_['some'](_0x3412de);logger['info'](_0x904f('0x19'),_0x2bab96,_0x5a4b99['join'](_0x904f('0x1a')),_0x1c4814);_0x5a7e1e[_0x904f('0x1b')](_0x1c4814);})[_0x904f('0xa')](function(_0x5bce33){console[_0x904f('0x1c')](_0x5bce33);logger[_0x904f('0x7')](_0x904f('0x19'),_0x2bab96,_0x5a4b99[_0x904f('0x1d')](_0x904f('0x1a')),_0x5bce33[_0x904f('0x1e')]);_0x5a7e1e[_0x904f('0xf')]();});};}; \ No newline at end of file +var _0xde95=['Command','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','../../../config/logger','client','http','then','error','message','result','catch','condition','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push'];(function(_0x57e0e0,_0x1275a3){var _0x67c377=function(_0x2e696a){while(--_0x2e696a){_0x57e0e0['push'](_0x57e0e0['shift']());}};_0x67c377(++_0x1275a3);}(_0xde95,0x1ea));var _0x5de9=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0xde95[_0x3fba9f];return _0x192cf1;};'use strict';var util=require('util');var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require('lodash');var logger=require(_0x5de9('0x0'))('routing');var client=jayson[_0x5de9('0x1')][_0x5de9('0x2')]({'port':0x232a});function request(_0x43a63d,_0x4f746c){return new BPromise(function(_0x23d43b,_0x16c5b3){return client['request'](_0x43a63d,_0x4f746c)[_0x5de9('0x3')](function(_0x59f658){if(_0x59f658[_0x5de9('0x4')]){return _0x16c5b3(_0x59f658['error'][_0x5de9('0x5')]);}else{return _0x23d43b(_0x59f658[_0x5de9('0x6')]);}})[_0x5de9('0x7')](function(_0x152d84){return _0x16c5b3(_0x152d84);});});}exports[_0x5de9('0x8')]=function(_0x1a8fac,_0x1f4efd,_0x552908){return function(_0x5184f3){if(_0x552908['rules']&&!_0x552908['rules'][_0x1a8fac]){logger[_0x5de9('0x9')](_0x5de9('0xa'),_0x1a8fac);return _0x5184f3[_0x5de9('0xb')]();}var _0x28879c=[];for(var _0x288944=0x0;_0x288944<_0x1f4efd[_0x5de9('0xc')];_0x288944+=0x1){_0x28879c[_0x5de9('0xd')](request(_0x5de9('0xe'),{'command':util[_0x5de9('0xf')](_0x5de9('0x10'),_0x1f4efd[_0x288944])})[_0x5de9('0x3')](function(_0x1ade36){return _0x1ade36&&_0x1ade36[_0x5de9('0x5')]&&_0x1ade36['message'][_0x5de9('0x11')](_0x5de9('0x12'))>=0x0?!![]:![];})[_0x5de9('0x7')](function(_0x382b70){logger[_0x5de9('0x4')](_0x5de9('0x13'),_0x1a8fac,_0x1f4efd[_0x288944]);}));}BPromise[_0x5de9('0x14')](_0x28879c)['then'](function(_0x52b53c){var _0x112c72=_[_0x5de9('0x15')](_0x52b53c);logger[_0x5de9('0x9')](_0x5de9('0x16'),_0x1a8fac,_0x1f4efd[_0x5de9('0x17')](_0x5de9('0x18')),_0x112c72);_0x5184f3[_0x5de9('0x19')](_0x112c72);})[_0x5de9('0x7')](function(_0xb085c5){console[_0x5de9('0x1a')](_0xb085c5);logger[_0x5de9('0x4')](_0x5de9('0x16'),_0x1a8fac,_0x1f4efd[_0x5de9('0x17')](_0x5de9('0x18')),_0xb085c5[_0x5de9('0x1b')]);_0x5184f3[_0x5de9('0xb')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 292e5ab..d16e93e 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 _0xd3d1=['transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','transfereeuniqueid','agententerreason','clone','calleridname','agentcalledAt','secondtransfererlinkedid','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','indexOf','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','util','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','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','[%s][agents][agentcalled]','now','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','reason','holdtime','ringtime','talktime','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','agentringnoanswer','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','[%s][agents][agentcomplete]','transfereruniqueid','[%s][agents][blindtransfer]','transfer','transfertype','blind','transferexten','extension'];(function(_0x13b010,_0x5b869d){var _0xcdb923=function(_0x5ed641){while(--_0x5ed641){_0x13b010['push'](_0x13b010['shift']());}};_0xcdb923(++_0x5b869d);}(_0xd3d1,0x172));var _0x1d3d=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xd3d1[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x1d3d('0x0'));var util=require(_0x1d3d('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x56f01c,_0x2d0605){utils[_0x1d3d('0x2')](util[_0x1d3d('0x3')](_0x1d3d('0x4'),_0x56f01c[_0x1d3d('0x5')],_0x56f01c[_0x1d3d('0x6')],_0x56f01c[_0x1d3d('0x7')],_0x56f01c[_0x1d3d('0x8')],_0x56f01c[_0x1d3d('0x9')],_0x56f01c[_0x1d3d('0xa')],_0x56f01c[_0x1d3d('0xb')],_0x56f01c[_0x1d3d('0xc')]));if(_0x56f01c[_0x1d3d('0x7')]){utils[_0x1d3d('0xd')](_0x56f01c[_0x1d3d('0x7')])[_0x1d3d('0xe')](function(_0x3683c9){if(_0x3683c9){_0x56f01c['type']=_0x3683c9[_0x1d3d('0xf')];_0x56f01c[_0x1d3d('0x10')]=_0x56f01c[_0x1d3d('0x11')]?_0x3683c9[_0x1d3d('0x12')]:![];_0x56f01c[_0x1d3d('0x13')]=_0x56f01c[_0x1d3d('0x10')]?_0x3683c9[_0x1d3d('0x14')]:0x0;}utils[_0x1d3d('0x15')](_0x1d3d('0x16'),_0x56f01c);});}else{utils[_0x1d3d('0x15')](_0x1d3d('0x16'),_0x56f01c);}if(_0x2d0605){delete transfers[_0x56f01c['uniqueid']];}else{delete agents[_0x56f01c[_0x1d3d('0x17')]];}}exports[_0x1d3d('0x18')]=function(_0x494b82){try{utils['debug'](util[_0x1d3d('0x3')](_0x1d3d('0x19'),_0x494b82[_0x1d3d('0x5')]),_0x494b82);agents[_0x494b82['destuniqueid']]=_0x494b82;agents[_0x494b82[_0x1d3d('0x17')]]['agentcalledAt']=utils[_0x1d3d('0x1a')]();agents[_0x494b82[_0x1d3d('0x17')]][_0x1d3d('0xc')]=_0x1d3d('0x1b');agents[_0x494b82[_0x1d3d('0x17')]][_0x1d3d('0xb')]=null;agents[_0x494b82[_0x1d3d('0x17')]]['connectedlinename']=null;utils['info'](util[_0x1d3d('0x3')](_0x1d3d('0x1c'),_0x494b82['uniqueid'],agents[_0x494b82[_0x1d3d('0x17')]]['membername'],_0x494b82[_0x1d3d('0x17')]));}catch(_0x392e92){utils[_0x1d3d('0x1d')](util[_0x1d3d('0x3')]('[%s][agents][agentcalled]',_0x494b82[_0x1d3d('0x5')]),_0x392e92);}};exports['agentringnoanswer']=function(_0x56c424){try{if(!_[_0x1d3d('0x1e')](agents[_0x56c424[_0x1d3d('0x17')]])){utils[_0x1d3d('0x1f')](util[_0x1d3d('0x3')](_0x1d3d('0x20'),_0x56c424[_0x1d3d('0x5')]),_0x56c424);utils[_0x1d3d('0x2')](util[_0x1d3d('0x3')](_0x1d3d('0x21'),_0x56c424[_0x1d3d('0x5')],agents[_0x56c424[_0x1d3d('0x17')]]['membername'],_0x56c424[_0x1d3d('0x17')]));agents[_0x56c424[_0x1d3d('0x17')]]['agentringnoanswer']=!![];agents[_0x56c424[_0x1d3d('0x17')]]['agentringnoanswerAt']=utils[_0x1d3d('0x1a')]();agents[_0x56c424[_0x1d3d('0x17')]][_0x1d3d('0xc')]=_0x1d3d('0x22');agents[_0x56c424[_0x1d3d('0x17')]][_0x1d3d('0x23')]=_0x1d3d('0x22');agents[_0x56c424[_0x1d3d('0x17')]][_0x1d3d('0x24')]=_0x56c424[_0x1d3d('0x25')]?parseInt(_0x56c424[_0x1d3d('0x25')])/0x3e8:0x0;agents[_0x56c424['destuniqueid']][_0x1d3d('0x26')]=0x0;unanswered['push'](_0x56c424[_0x1d3d('0x17')]);}}catch(_0x2bcc2){utils['error'](util[_0x1d3d('0x3')](_0x1d3d('0x20'),_0x56c424[_0x1d3d('0x5')]),_0x2bcc2);}};exports[_0x1d3d('0x27')]=function(_0x4abbfc){try{_[_0x1d3d('0x28')](agents,function(_0x235ef3,_0x5d1b6c){if(_0x235ef3[_0x1d3d('0x5')]==_0x4abbfc['uniqueid']&&!_[_0x1d3d('0x29')](unanswered,_0x235ef3[_0x1d3d('0x17')])){utils['debug'](util[_0x1d3d('0x3')](_0x1d3d('0x2a'),_0x4abbfc[_0x1d3d('0x5')]),_0x4abbfc);utils[_0x1d3d('0x2')](util[_0x1d3d('0x3')](_0x1d3d('0x2b'),_0x4abbfc[_0x1d3d('0x5')],_0x235ef3[_0x1d3d('0x8')],_0x235ef3[_0x1d3d('0x17')]));_0x235ef3['agentringnoanswer']=!![];_0x235ef3[_0x1d3d('0x2c')]=utils[_0x1d3d('0x1a')]();_0x235ef3[_0x1d3d('0xc')]=_0x1d3d('0x2d');_0x235ef3['reason']='abandoned';_0x235ef3[_0x1d3d('0x24')]=_0x4abbfc[_0x1d3d('0x24')];_0x235ef3['talktime']=0x0;writeDB(_0x235ef3);}});}catch(_0x43ef5d){utils[_0x1d3d('0x1d')](util[_0x1d3d('0x3')](_0x1d3d('0x2a'),_0x4abbfc['uniqueid']),_0x43ef5d);}};exports['agentconnect']=function(_0x29fa6c){try{if(agents[_0x29fa6c['destuniqueid']]){utils[_0x1d3d('0x1f')](util[_0x1d3d('0x3')](_0x1d3d('0x2e'),_0x29fa6c[_0x1d3d('0x5')]),_0x29fa6c);utils[_0x1d3d('0x2')](util[_0x1d3d('0x3')](_0x1d3d('0x2f'),_0x29fa6c[_0x1d3d('0x5')],agents[_0x29fa6c['destuniqueid']][_0x1d3d('0x8')],_0x29fa6c['destuniqueid']));agents[_0x29fa6c[_0x1d3d('0x17')]][_0x1d3d('0x30')]=utils['now']();agents[_0x29fa6c[_0x1d3d('0x17')]][_0x1d3d('0xb')]=_0x29fa6c[_0x1d3d('0xb')];agents[_0x29fa6c[_0x1d3d('0x17')]]['connectedlinename']=_0x29fa6c['connectedlinename'];agents[_0x29fa6c[_0x1d3d('0x17')]]['holdtime']=_0x29fa6c[_0x1d3d('0x25')];agents[_0x29fa6c[_0x1d3d('0x17')]]['lastevent']=_0x1d3d('0x31');_[_0x1d3d('0x28')](agents,function(_0x51be79,_0x2d5015){if(_0x51be79[_0x1d3d('0x17')]!=_0x29fa6c[_0x1d3d('0x17')]&&_0x51be79[_0x1d3d('0x5')]==_0x29fa6c[_0x1d3d('0x5')]){_0x51be79[_0x1d3d('0x26')]=0x0;_0x51be79['holdtime']=_0x29fa6c[_0x1d3d('0x25')];_0x51be79[_0x1d3d('0x32')]=!![];_0x51be79[_0x1d3d('0x2c')]=utils[_0x1d3d('0x1a')]();_0x51be79[_0x1d3d('0xc')]='answered_elsewhere';_0x51be79[_0x1d3d('0x23')]=_0x1d3d('0x33');_0x51be79[_0x1d3d('0x34')]=_0x29fa6c[_0x1d3d('0x17')];_0x51be79['answeredelsewheremembername']=_0x29fa6c[_0x1d3d('0x8')];writeDB(_0x51be79);}});}}catch(_0x977ea8){utils[_0x1d3d('0x1d')](util[_0x1d3d('0x3')](_0x1d3d('0x2e'),_0x29fa6c['uniqueid']),_0x977ea8);}};exports['agentcomplete']=function(_0x229f48){try{if(!_[_0x1d3d('0x1e')](agents[_0x229f48[_0x1d3d('0x17')]])){utils[_0x1d3d('0x1f')](util[_0x1d3d('0x3')]('[%s][agents][agentcomplete]',_0x229f48[_0x1d3d('0x5')]),_0x229f48);utils['info'](util[_0x1d3d('0x3')](_0x1d3d('0x35'),_0x229f48[_0x1d3d('0x5')],agents[_0x229f48[_0x1d3d('0x17')]]['membername'],_0x229f48[_0x1d3d('0x17')]));agents[_0x229f48[_0x1d3d('0x17')]][_0x1d3d('0x11')]=!![];agents[_0x229f48[_0x1d3d('0x17')]][_0x1d3d('0x36')]=utils[_0x1d3d('0x1a')]();agents[_0x229f48[_0x1d3d('0x17')]]['talktime']=utils[_0x1d3d('0x37')](agents[_0x229f48['destuniqueid']][_0x1d3d('0x36')],agents[_0x229f48[_0x1d3d('0x17')]]['agentconnectAt']);agents[_0x229f48[_0x1d3d('0x17')]]['reason']=_0x229f48[_0x1d3d('0x23')];agents[_0x229f48['destuniqueid']][_0x1d3d('0xc')]=_0x1d3d('0x38');writeDB(agents[_0x229f48[_0x1d3d('0x17')]]);}}catch(_0x25b547){utils[_0x1d3d('0x1d')](util[_0x1d3d('0x3')](_0x1d3d('0x39'),_0x229f48[_0x1d3d('0x5')]),_0x25b547);}};exports['blindtransfer']=function(_0x5899cc){try{if(!_['isNil'](agents[_0x5899cc[_0x1d3d('0x3a')]])){utils[_0x1d3d('0x1f')](util[_0x1d3d('0x3')](_0x1d3d('0x3b'),_0x5899cc[_0x1d3d('0x5')]),_0x5899cc);utils[_0x1d3d('0x2')](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x5899cc['uniqueid'],agents[_0x5899cc['transfereruniqueid']][_0x1d3d('0x8')],agents[_0x5899cc[_0x1d3d('0x3a')]][_0x1d3d('0x5')]));agents[_0x5899cc[_0x1d3d('0x3a')]][_0x1d3d('0x3c')]=!![];agents[_0x5899cc[_0x1d3d('0x3a')]][_0x1d3d('0x3d')]=_0x1d3d('0x3e');agents[_0x5899cc[_0x1d3d('0x3a')]][_0x1d3d('0x3f')]=_0x5899cc[_0x1d3d('0x40')];agents[_0x5899cc[_0x1d3d('0x3a')]][_0x1d3d('0x41')]=agents[_0x5899cc[_0x1d3d('0x3a')]][_0x1d3d('0x5')];}}catch(_0x5ce0d3){utils[_0x1d3d('0x1d')](util[_0x1d3d('0x3')](_0x1d3d('0x3b'),_0x5899cc[_0x1d3d('0x5')]),_0x5ce0d3);}};exports['attendedtransfer']=function(_0x41930f){try{utils['debug'](util['format'](_0x1d3d('0x42'),_0x41930f[_0x1d3d('0x43')]),_0x41930f);if(_0x41930f['origtransfereruniqueid']==_0x41930f[_0x1d3d('0x44')]){if(!_[_0x1d3d('0x1e')](agents[_0x41930f['secondtransfereruniqueid']])){utils[_0x1d3d('0x2')](util[_0x1d3d('0x3')](_0x1d3d('0x45'),_0x41930f[_0x1d3d('0x43')],agents[_0x41930f[_0x1d3d('0x46')]][_0x1d3d('0x8')]));agents[_0x41930f[_0x1d3d('0x46')]][_0x1d3d('0x3c')]=!![];agents[_0x41930f[_0x1d3d('0x46')]]['transfertype']=_0x1d3d('0x47');agents[_0x41930f['secondtransfereruniqueid']]['transferexten']=_0x41930f['origtransfererexten'];agents[_0x41930f['secondtransfereruniqueid']][_0x1d3d('0x41')]=_0x41930f[_0x1d3d('0x43')];}if(_0x41930f[_0x1d3d('0x48')]&&agents[_0x41930f[_0x1d3d('0x48')]]){agents[_0x41930f['transfereeuniqueid']][_0x1d3d('0x49')]=0x1;transfers[_0x41930f['transfereeuniqueid']]=_[_0x1d3d('0x4a')](agents[_0x41930f[_0x1d3d('0x48')]]);transfers[_0x41930f['transfereeuniqueid']][_0x1d3d('0xa')]=agents[_0x41930f[_0x1d3d('0x46')]]['calleridnum'];transfers[_0x41930f[_0x1d3d('0x48')]][_0x1d3d('0x4b')]=agents[_0x41930f[_0x1d3d('0x46')]][_0x1d3d('0x4b')];transfers[_0x41930f[_0x1d3d('0x48')]][_0x1d3d('0x4c')]=utils['now']();transfers[_0x41930f[_0x1d3d('0x48')]][_0x1d3d('0x30')]=utils[_0x1d3d('0x1a')]();transfers[_0x41930f[_0x1d3d('0x48')]][_0x1d3d('0x24')]=0x0;transfers[_0x41930f['transfereeuniqueid']][_0x1d3d('0x49')]=0x2;}}else if(_0x41930f['secondtransfereruniqueid']==_0x41930f[_0x1d3d('0x4d')]){if(!_['isNil'](agents[_0x41930f[_0x1d3d('0x43')]])){utils[_0x1d3d('0x2')](util[_0x1d3d('0x3')](_0x1d3d('0x45'),_0x41930f[_0x1d3d('0x43')],agents[_0x41930f[_0x1d3d('0x43')]][_0x1d3d('0x8')]));agents[_0x41930f['origtransfereruniqueid']][_0x1d3d('0x3c')]=!![];agents[_0x41930f[_0x1d3d('0x43')]][_0x1d3d('0x3d')]=_0x1d3d('0x47');agents[_0x41930f[_0x1d3d('0x43')]][_0x1d3d('0x3f')]=_0x41930f['secondtransfererexten'];agents[_0x41930f[_0x1d3d('0x43')]][_0x1d3d('0x41')]=_0x41930f[_0x1d3d('0x46')];}if(_0x41930f[_0x1d3d('0x4e')]&&agents[_0x41930f[_0x1d3d('0x4e')]]){agents[_0x41930f['transfertargetuniqueid']][_0x1d3d('0x49')]=0x1;transfers[_0x41930f[_0x1d3d('0x4e')]]=_[_0x1d3d('0x4a')](agents[_0x41930f['transfertargetuniqueid']]);transfers[_0x41930f[_0x1d3d('0x4e')]]['calleridnum']=agents[_0x41930f[_0x1d3d('0x43')]]['calleridnum'];transfers[_0x41930f[_0x1d3d('0x4e')]][_0x1d3d('0x4b')]=agents[_0x41930f[_0x1d3d('0x43')]]['calleridname'];transfers[_0x41930f[_0x1d3d('0x4e')]][_0x1d3d('0x4c')]=utils[_0x1d3d('0x1a')]();transfers[_0x41930f['transfertargetuniqueid']][_0x1d3d('0x30')]=utils[_0x1d3d('0x1a')]();transfers[_0x41930f[_0x1d3d('0x4e')]]['holdtime']=0x0;transfers[_0x41930f[_0x1d3d('0x4e')]][_0x1d3d('0x49')]=0x2;}}}catch(_0x37667d){utils[_0x1d3d('0x1d')](util[_0x1d3d('0x3')]('[%s][agents][attendedtransfer]',_0x41930f[_0x1d3d('0x43')]),_0x37667d);}};exports[_0x1d3d('0x4f')]=function(_0x25f4e0){try{utils['debug'](util[_0x1d3d('0x3')](_0x1d3d('0x50'),_0x25f4e0[_0x1d3d('0x5')]),_0x25f4e0);if(agents[_0x25f4e0[_0x1d3d('0x5')]]&&agents[_0x25f4e0[_0x1d3d('0x5')]]['reason']===_0x1d3d('0x22')){if(_0x25f4e0[_0x1d3d('0x51')]==='21'){agents[_0x25f4e0['uniqueid']][_0x1d3d('0x23')]=_0x1d3d('0x52');agents[_0x25f4e0['uniqueid']][_0x1d3d('0xc')]=_0x1d3d('0x52');}utils[_0x1d3d('0x2')](util[_0x1d3d('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x25f4e0[_0x1d3d('0x5')],agents[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0x8')],agents[_0x25f4e0[_0x1d3d('0x5')]]['reason'],agents[_0x25f4e0['uniqueid']][_0x1d3d('0xc')]));writeDB(agents[_0x25f4e0[_0x1d3d('0x5')]]);var _0x4604cc=unanswered[_0x1d3d('0x53')](_0x25f4e0[_0x1d3d('0x5')]);if(_0x4604cc>-0x1){unanswered[_0x1d3d('0x54')](_0x4604cc,0x1);}}if(transfers[_0x25f4e0[_0x1d3d('0x5')]]){transfers[_0x25f4e0['uniqueid']][_0x1d3d('0x11')]=!![];transfers[_0x25f4e0[_0x1d3d('0x5')]]['agentcompleteAt']=utils[_0x1d3d('0x1a')]();transfers[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0x26')]=utils['diffTime'](transfers[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0x36')],transfers[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0x30')]);transfers[_0x25f4e0['uniqueid']][_0x1d3d('0x23')]=_0x1d3d('0x55');transfers[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0xc')]='complete';utils[_0x1d3d('0x2')](util[_0x1d3d('0x3')](_0x1d3d('0x56'),_0x25f4e0['uniqueid'],transfers[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0x8')],transfers[_0x25f4e0['uniqueid']][_0x1d3d('0x23')],transfers[_0x25f4e0['uniqueid']][_0x1d3d('0xc')]));writeDB(transfers[_0x25f4e0[_0x1d3d('0x5')]],!![]);}if(agents[_0x25f4e0['uniqueid']]&&agents[_0x25f4e0['uniqueid']][_0x1d3d('0x30')]){agents[_0x25f4e0[_0x1d3d('0x5')]]['agentcomplete']=!![];agents[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0x36')]=utils[_0x1d3d('0x1a')]();agents[_0x25f4e0[_0x1d3d('0x5')]]['talktime']=utils[_0x1d3d('0x37')](agents[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0x36')],agents[_0x25f4e0['uniqueid']][_0x1d3d('0x30')]);agents[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0x23')]=agents[_0x25f4e0['uniqueid']][_0x1d3d('0x3c')]?_0x1d3d('0x3c'):_0x1d3d('0x55');agents[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0xc')]=_0x1d3d('0x38');utils['info'](util[_0x1d3d('0x3')](_0x1d3d('0x56'),_0x25f4e0['uniqueid'],agents[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0x8')],agents[_0x25f4e0[_0x1d3d('0x5')]]['reason'],agents[_0x25f4e0[_0x1d3d('0x5')]]['lastevent']));writeDB(agents[_0x25f4e0['uniqueid']]);}}catch(_0x49d1e7){utils[_0x1d3d('0x1d')](util['format'](_0x1d3d('0x50'),_0x25f4e0[_0x1d3d('0x5')]),_0x49d1e7);}}; \ No newline at end of file +var _0x7af2=['agentconnectAt','connect','talktime','answered_elsewhere','answeredelsewheredestinationuniqueid','isNil','diffTime','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','origtransfererexten','transfereeuniqueid','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','agententerreason','[%s][agents][attendedtransfer]','cause','indexOf','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','[%s][agents][hangup]','util','./utils','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','getVoiceQueueByName','type','agentcomplete','agentacw','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','lastevent','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','info','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','reason','holdtime','ringtime','push','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','agentringnoanswerAt','abandoned','[%s][agents][queuecallerabandon]','[%s][agents][agentconnect]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7af2,0x119));var _0x27af=function(_0x4e4070,_0x699370){_0x4e4070=_0x4e4070-0x0;var _0x500ae2=_0x7af2[_0x4e4070];return _0x500ae2;};'use strict';var _=require('lodash');var util=require(_0x27af('0x0'));var utils=require(_0x27af('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x908794,_0x316e13){utils['info'](util[_0x27af('0x2')](_0x27af('0x3'),_0x908794[_0x27af('0x4')],_0x908794[_0x27af('0x5')],_0x908794[_0x27af('0x6')],_0x908794[_0x27af('0x7')],_0x908794[_0x27af('0x8')],_0x908794[_0x27af('0x9')],_0x908794[_0x27af('0xa')],_0x908794['lastevent']));if(_0x908794[_0x27af('0x6')]){utils[_0x27af('0xb')](_0x908794[_0x27af('0x6')])['then'](function(_0x369a20){if(_0x369a20){_0x908794[_0x27af('0xc')]=_0x369a20[_0x27af('0xc')];_0x908794['agentacw']=_0x908794[_0x27af('0xd')]?_0x369a20['acw']:![];_0x908794['acwtime']=_0x908794[_0x27af('0xe')]?_0x369a20['acwTimeout']:0x0;}utils['request'](_0x27af('0xf'),_0x908794);});}else{utils['request'](_0x27af('0xf'),_0x908794);}if(_0x316e13){delete transfers[_0x908794['uniqueid']];}else{delete agents[_0x908794[_0x27af('0x10')]];}}exports[_0x27af('0x11')]=function(_0x1fd964){try{utils[_0x27af('0x12')](util[_0x27af('0x2')](_0x27af('0x13'),_0x1fd964[_0x27af('0x4')]),_0x1fd964);agents[_0x1fd964[_0x27af('0x10')]]=_0x1fd964;agents[_0x1fd964[_0x27af('0x10')]][_0x27af('0x14')]=utils[_0x27af('0x15')]();agents[_0x1fd964[_0x27af('0x10')]][_0x27af('0x16')]=_0x27af('0x17');agents[_0x1fd964[_0x27af('0x10')]][_0x27af('0xa')]=null;agents[_0x1fd964[_0x27af('0x10')]][_0x27af('0x18')]=null;utils['info'](util[_0x27af('0x2')](_0x27af('0x19'),_0x1fd964['uniqueid'],agents[_0x1fd964['destuniqueid']][_0x27af('0x7')],_0x1fd964[_0x27af('0x10')]));}catch(_0x351587){utils[_0x27af('0x1a')](util[_0x27af('0x2')]('[%s][agents][agentcalled]',_0x1fd964[_0x27af('0x4')]),_0x351587);}};exports[_0x27af('0x1b')]=function(_0xcb4b90){try{if(!_['isNil'](agents[_0xcb4b90[_0x27af('0x10')]])){utils[_0x27af('0x12')](util[_0x27af('0x2')]('[%s][agents][agentringnoanswer]',_0xcb4b90[_0x27af('0x4')]),_0xcb4b90);utils[_0x27af('0x1c')](util[_0x27af('0x2')](_0x27af('0x1d'),_0xcb4b90[_0x27af('0x4')],agents[_0xcb4b90[_0x27af('0x10')]][_0x27af('0x7')],_0xcb4b90[_0x27af('0x10')]));agents[_0xcb4b90[_0x27af('0x10')]]['agentringnoanswer']=!![];agents[_0xcb4b90['destuniqueid']]['agentringnoanswerAt']=utils[_0x27af('0x15')]();agents[_0xcb4b90['destuniqueid']][_0x27af('0x16')]=_0x27af('0x1e');agents[_0xcb4b90['destuniqueid']][_0x27af('0x1f')]=_0x27af('0x1e');agents[_0xcb4b90[_0x27af('0x10')]][_0x27af('0x20')]=_0xcb4b90[_0x27af('0x21')]?parseInt(_0xcb4b90[_0x27af('0x21')])/0x3e8:0x0;agents[_0xcb4b90[_0x27af('0x10')]]['talktime']=0x0;unanswered[_0x27af('0x22')](_0xcb4b90[_0x27af('0x10')]);}}catch(_0xadd38e){utils[_0x27af('0x1a')](util[_0x27af('0x2')](_0x27af('0x23'),_0xcb4b90[_0x27af('0x4')]),_0xadd38e);}};exports[_0x27af('0x24')]=function(_0x4406e2){try{_[_0x27af('0x25')](agents,function(_0x205e41,_0x4f4955){if(_0x205e41[_0x27af('0x4')]==_0x4406e2[_0x27af('0x4')]&&!_[_0x27af('0x26')](unanswered,_0x205e41[_0x27af('0x10')])){utils[_0x27af('0x12')](util[_0x27af('0x2')]('[%s][agents][queuecallerabandon]',_0x4406e2['uniqueid']),_0x4406e2);utils[_0x27af('0x1c')](util[_0x27af('0x2')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x4406e2[_0x27af('0x4')],_0x205e41[_0x27af('0x7')],_0x205e41[_0x27af('0x10')]));_0x205e41[_0x27af('0x1b')]=!![];_0x205e41[_0x27af('0x27')]=utils[_0x27af('0x15')]();_0x205e41[_0x27af('0x16')]=_0x27af('0x28');_0x205e41[_0x27af('0x1f')]=_0x27af('0x28');_0x205e41[_0x27af('0x20')]=_0x4406e2['holdtime'];_0x205e41['talktime']=0x0;writeDB(_0x205e41);}});}catch(_0x1de1d0){utils[_0x27af('0x1a')](util['format'](_0x27af('0x29'),_0x4406e2[_0x27af('0x4')]),_0x1de1d0);}};exports['agentconnect']=function(_0x83aa0b){try{if(agents[_0x83aa0b[_0x27af('0x10')]]){utils[_0x27af('0x12')](util[_0x27af('0x2')](_0x27af('0x2a'),_0x83aa0b['uniqueid']),_0x83aa0b);utils[_0x27af('0x1c')](util[_0x27af('0x2')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x83aa0b['uniqueid'],agents[_0x83aa0b[_0x27af('0x10')]][_0x27af('0x7')],_0x83aa0b[_0x27af('0x10')]));agents[_0x83aa0b[_0x27af('0x10')]][_0x27af('0x2b')]=utils[_0x27af('0x15')]();agents[_0x83aa0b['destuniqueid']][_0x27af('0xa')]=_0x83aa0b['connectedlinenum'];agents[_0x83aa0b[_0x27af('0x10')]][_0x27af('0x18')]=_0x83aa0b[_0x27af('0x18')];agents[_0x83aa0b[_0x27af('0x10')]][_0x27af('0x20')]=_0x83aa0b['ringtime'];agents[_0x83aa0b[_0x27af('0x10')]][_0x27af('0x16')]=_0x27af('0x2c');_[_0x27af('0x25')](agents,function(_0x10c1be,_0x32b558){if(_0x10c1be[_0x27af('0x10')]!=_0x83aa0b[_0x27af('0x10')]&&_0x10c1be[_0x27af('0x4')]==_0x83aa0b[_0x27af('0x4')]){_0x10c1be[_0x27af('0x2d')]=0x0;_0x10c1be[_0x27af('0x20')]=_0x83aa0b[_0x27af('0x21')];_0x10c1be[_0x27af('0x1b')]=!![];_0x10c1be['agentringnoanswerAt']=utils[_0x27af('0x15')]();_0x10c1be[_0x27af('0x16')]=_0x27af('0x2e');_0x10c1be[_0x27af('0x1f')]='answered_elsewhere';_0x10c1be[_0x27af('0x2f')]=_0x83aa0b['destuniqueid'];_0x10c1be['answeredelsewheremembername']=_0x83aa0b[_0x27af('0x7')];writeDB(_0x10c1be);}});}}catch(_0x3c9c81){utils[_0x27af('0x1a')](util[_0x27af('0x2')](_0x27af('0x2a'),_0x83aa0b[_0x27af('0x4')]),_0x3c9c81);}};exports[_0x27af('0xd')]=function(_0x26eb28){try{if(!_[_0x27af('0x30')](agents[_0x26eb28[_0x27af('0x10')]])){utils[_0x27af('0x12')](util[_0x27af('0x2')]('[%s][agents][agentcomplete]',_0x26eb28[_0x27af('0x4')]),_0x26eb28);utils[_0x27af('0x1c')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x26eb28[_0x27af('0x4')],agents[_0x26eb28[_0x27af('0x10')]][_0x27af('0x7')],_0x26eb28[_0x27af('0x10')]));agents[_0x26eb28[_0x27af('0x10')]]['agentcomplete']=!![];agents[_0x26eb28[_0x27af('0x10')]]['agentcompleteAt']=utils[_0x27af('0x15')]();agents[_0x26eb28[_0x27af('0x10')]][_0x27af('0x2d')]=utils[_0x27af('0x31')](agents[_0x26eb28[_0x27af('0x10')]][_0x27af('0x32')],agents[_0x26eb28[_0x27af('0x10')]]['agentconnectAt']);agents[_0x26eb28['destuniqueid']][_0x27af('0x1f')]=_0x26eb28['reason'];agents[_0x26eb28[_0x27af('0x10')]][_0x27af('0x16')]=_0x27af('0x33');writeDB(agents[_0x26eb28[_0x27af('0x10')]]);}}catch(_0x37f2fa){utils[_0x27af('0x1a')](util[_0x27af('0x2')]('[%s][agents][agentcomplete]',_0x26eb28[_0x27af('0x4')]),_0x37f2fa);}};exports[_0x27af('0x34')]=function(_0x20e180){try{if(!_[_0x27af('0x30')](agents[_0x20e180[_0x27af('0x35')]])){utils['debug'](util[_0x27af('0x2')](_0x27af('0x36'),_0x20e180[_0x27af('0x4')]),_0x20e180);utils['info'](util['format'](_0x27af('0x37'),_0x20e180[_0x27af('0x4')],agents[_0x20e180[_0x27af('0x35')]]['membername'],agents[_0x20e180['transfereruniqueid']][_0x27af('0x4')]));agents[_0x20e180['transfereruniqueid']][_0x27af('0x38')]=!![];agents[_0x20e180[_0x27af('0x35')]][_0x27af('0x39')]=_0x27af('0x3a');agents[_0x20e180[_0x27af('0x35')]][_0x27af('0x3b')]=_0x20e180[_0x27af('0x3c')];agents[_0x20e180[_0x27af('0x35')]][_0x27af('0x3d')]=agents[_0x20e180[_0x27af('0x35')]][_0x27af('0x4')];}}catch(_0x5c02c1){utils[_0x27af('0x1a')](util[_0x27af('0x2')](_0x27af('0x36'),_0x20e180[_0x27af('0x4')]),_0x5c02c1);}};exports[_0x27af('0x3e')]=function(_0x2ad074){try{utils[_0x27af('0x12')](util[_0x27af('0x2')]('[%s][agents][attendedtransfer]',_0x2ad074[_0x27af('0x3f')]),_0x2ad074);if(_0x2ad074['origtransfereruniqueid']==_0x2ad074[_0x27af('0x40')]){if(!_[_0x27af('0x30')](agents[_0x2ad074[_0x27af('0x41')]])){utils['info'](util[_0x27af('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x2ad074[_0x27af('0x3f')],agents[_0x2ad074[_0x27af('0x41')]][_0x27af('0x7')]));agents[_0x2ad074['secondtransfereruniqueid']][_0x27af('0x38')]=!![];agents[_0x2ad074['secondtransfereruniqueid']][_0x27af('0x39')]='ATTENDED';agents[_0x2ad074[_0x27af('0x41')]][_0x27af('0x3b')]=_0x2ad074[_0x27af('0x42')];agents[_0x2ad074['secondtransfereruniqueid']]['transferuniqueid']=_0x2ad074[_0x27af('0x3f')];}if(_0x2ad074[_0x27af('0x43')]&&agents[_0x2ad074[_0x27af('0x43')]]){agents[_0x2ad074[_0x27af('0x43')]]['agententerreason']=0x1;transfers[_0x2ad074[_0x27af('0x43')]]=_[_0x27af('0x44')](agents[_0x2ad074[_0x27af('0x43')]]);transfers[_0x2ad074[_0x27af('0x43')]][_0x27af('0x9')]=agents[_0x2ad074[_0x27af('0x41')]]['calleridnum'];transfers[_0x2ad074[_0x27af('0x43')]][_0x27af('0x45')]=agents[_0x2ad074[_0x27af('0x41')]][_0x27af('0x45')];transfers[_0x2ad074['transfereeuniqueid']][_0x27af('0x14')]=utils['now']();transfers[_0x2ad074[_0x27af('0x43')]][_0x27af('0x2b')]=utils['now']();transfers[_0x2ad074[_0x27af('0x43')]][_0x27af('0x20')]=0x0;transfers[_0x2ad074['transfereeuniqueid']]['agententerreason']=0x2;}}else if(_0x2ad074[_0x27af('0x41')]==_0x2ad074[_0x27af('0x46')]){if(!_[_0x27af('0x30')](agents[_0x2ad074['origtransfereruniqueid']])){utils[_0x27af('0x1c')](util[_0x27af('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x2ad074[_0x27af('0x3f')],agents[_0x2ad074[_0x27af('0x3f')]]['membername']));agents[_0x2ad074['origtransfereruniqueid']][_0x27af('0x38')]=!![];agents[_0x2ad074[_0x27af('0x3f')]]['transfertype']='ATTENDED';agents[_0x2ad074[_0x27af('0x3f')]][_0x27af('0x3b')]=_0x2ad074[_0x27af('0x47')];agents[_0x2ad074[_0x27af('0x3f')]][_0x27af('0x3d')]=_0x2ad074[_0x27af('0x41')];}if(_0x2ad074[_0x27af('0x48')]&&agents[_0x2ad074['transfertargetuniqueid']]){agents[_0x2ad074['transfertargetuniqueid']][_0x27af('0x49')]=0x1;transfers[_0x2ad074[_0x27af('0x48')]]=_[_0x27af('0x44')](agents[_0x2ad074[_0x27af('0x48')]]);transfers[_0x2ad074[_0x27af('0x48')]][_0x27af('0x9')]=agents[_0x2ad074[_0x27af('0x3f')]][_0x27af('0x9')];transfers[_0x2ad074[_0x27af('0x48')]][_0x27af('0x45')]=agents[_0x2ad074[_0x27af('0x3f')]][_0x27af('0x45')];transfers[_0x2ad074[_0x27af('0x48')]][_0x27af('0x14')]=utils[_0x27af('0x15')]();transfers[_0x2ad074[_0x27af('0x48')]][_0x27af('0x2b')]=utils['now']();transfers[_0x2ad074[_0x27af('0x48')]][_0x27af('0x20')]=0x0;transfers[_0x2ad074['transfertargetuniqueid']][_0x27af('0x49')]=0x2;}}}catch(_0x4b0a4){utils[_0x27af('0x1a')](util[_0x27af('0x2')](_0x27af('0x4a'),_0x2ad074[_0x27af('0x3f')]),_0x4b0a4);}};exports['hangup']=function(_0x132ed4){try{utils[_0x27af('0x12')](util[_0x27af('0x2')]('[%s][agents][hangup]',_0x132ed4['uniqueid']),_0x132ed4);if(agents[_0x132ed4[_0x27af('0x4')]]&&agents[_0x132ed4['uniqueid']][_0x27af('0x1f')]===_0x27af('0x1e')){if(_0x132ed4[_0x27af('0x4b')]==='21'){agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x1f')]='rejected';agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x16')]='rejected';}utils[_0x27af('0x1c')](util[_0x27af('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x132ed4['uniqueid'],agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x7')],agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x1f')],agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x16')]));writeDB(agents[_0x132ed4[_0x27af('0x4')]]);var _0x5db94f=unanswered[_0x27af('0x4c')](_0x132ed4[_0x27af('0x4')]);if(_0x5db94f>-0x1){unanswered[_0x27af('0x4d')](_0x5db94f,0x1);}}if(transfers[_0x132ed4[_0x27af('0x4')]]){transfers[_0x132ed4['uniqueid']]['agentcomplete']=!![];transfers[_0x132ed4[_0x27af('0x4')]][_0x27af('0x32')]=utils[_0x27af('0x15')]();transfers[_0x132ed4[_0x27af('0x4')]]['talktime']=utils['diffTime'](transfers[_0x132ed4['uniqueid']][_0x27af('0x32')],transfers[_0x132ed4[_0x27af('0x4')]][_0x27af('0x2b')]);transfers[_0x132ed4[_0x27af('0x4')]][_0x27af('0x1f')]=_0x27af('0x4e');transfers[_0x132ed4['uniqueid']]['lastevent']=_0x27af('0x33');utils[_0x27af('0x1c')](util[_0x27af('0x2')](_0x27af('0x4f'),_0x132ed4['uniqueid'],transfers[_0x132ed4['uniqueid']][_0x27af('0x7')],transfers[_0x132ed4[_0x27af('0x4')]][_0x27af('0x1f')],transfers[_0x132ed4[_0x27af('0x4')]][_0x27af('0x16')]));writeDB(transfers[_0x132ed4[_0x27af('0x4')]],!![]);}if(agents[_0x132ed4[_0x27af('0x4')]]&&agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x2b')]){agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0xd')]=!![];agents[_0x132ed4['uniqueid']][_0x27af('0x32')]=utils[_0x27af('0x15')]();agents[_0x132ed4[_0x27af('0x4')]]['talktime']=utils[_0x27af('0x31')](agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x32')],agents[_0x132ed4['uniqueid']][_0x27af('0x2b')]);agents[_0x132ed4['uniqueid']][_0x27af('0x1f')]=agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x38')]?_0x27af('0x38'):_0x27af('0x4e');agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x16')]=_0x27af('0x33');utils['info'](util[_0x27af('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x132ed4[_0x27af('0x4')],agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x7')],agents[_0x132ed4['uniqueid']]['reason'],agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x16')]));writeDB(agents[_0x132ed4[_0x27af('0x4')]]);}}catch(_0x48c7eb){utils['error'](util['format'](_0x27af('0x50'),_0x132ed4[_0x27af('0x4')]),_0x48c7eb);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 05f7ca3..9b42c94 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 _0xb2b4=['uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','connectedlinenum','lastevent','accountcode','UserId','request','CreateVoiceCallReport','recording','newchannel','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','error','newstate','[%s][calls][newstate]','channelstate','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','calleridnum','cause-txt','endtime','duration','diffTime','attendedtransfer','localtwolinkedid','debug','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%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]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','xmd-contactid','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','lastIndexOf','includes','noop','execif','gotoif','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds'];(function(_0xed53c8,_0x4d7d40){var _0x3a75f9=function(_0x2b9b3f){while(--_0x2b9b3f){_0xed53c8['push'](_0xed53c8['shift']());}};_0x3a75f9(++_0x4d7d40);}(_0xb2b4,0x141));var _0x4b2b=function(_0x59b439,_0x14ae7b){_0x59b439=_0x59b439-0x0;var _0x521ea3=_0xb2b4[_0x59b439];return _0x521ea3;};'use strict';var _=require(_0x4b2b('0x0'));var util=require(_0x4b2b('0x1'));var utils=require(_0x4b2b('0x2'));var transfers=require(_0x4b2b('0x3'));var dispositions=[_0x4b2b('0x4'),'FAILED',_0x4b2b('0x5'),_0x4b2b('0x4'),_0x4b2b('0x4'),_0x4b2b('0x4'),_0x4b2b('0x6'),_0x4b2b('0x7'),_0x4b2b('0x5'),_0x4b2b('0x5'),_0x4b2b('0x5')];var channels={};function writeDB(_0x232106){var _0x4f2596;if(transfers[_0x4b2b('0x8')][_0x232106[_0x4b2b('0x9')]]){_0x4f2596=_0x232106[_0x4b2b('0x9')];_0x232106['uniqueid']=transfers[_0x4b2b('0x8')][_0x232106[_0x4b2b('0x9')]][_0x4b2b('0xa')];}utils[_0x4b2b('0xb')](util[_0x4b2b('0xc')](_0x4b2b('0xd'),_0x232106['uniqueid'],_0x232106[_0x4b2b('0xe')],_0x232106[_0x4b2b('0xf')],_0x232106[_0x4b2b('0x10')],_0x232106[_0x4b2b('0x11')],_0x232106['calleridnum'],_0x232106[_0x4b2b('0x12')],_0x232106[_0x4b2b('0x13')]));if(_0x232106[_0x4b2b('0x14')]){utils['getUserByInternal'](_0x232106[_0x4b2b('0x14')])['then'](function(_0x904f80){if(_0x904f80){_0x232106[_0x4b2b('0x15')]=_0x904f80['id'];}utils[_0x4b2b('0x16')](_0x4b2b('0x17'),_0x232106);});}else{utils[_0x4b2b('0x16')](_0x4b2b('0x17'),_0x232106);}if(channels[_0x232106['uniqueid']]){delete channels[_0x232106[_0x4b2b('0x9')]];}else if(_0x4f2596&&channels[_0x4f2596]){if(!transfers[_0x4b2b('0x8')][_0x4f2596][_0x4b2b('0x18')])delete transfers[_0x4b2b('0x8')][_0x4f2596];delete channels[_0x4f2596];}}exports[_0x4b2b('0x19')]=function(_0x18611d){try{utils['debug'](util[_0x4b2b('0xc')](_0x4b2b('0x1a'),_0x18611d[_0x4b2b('0x9')]),_0x18611d);if(_0x18611d[_0x4b2b('0x9')]==_0x18611d[_0x4b2b('0x1b')]&&_0x18611d[_0x4b2b('0xe')]!=_0x4b2b('0x1c')){utils[_0x4b2b('0xb')](util[_0x4b2b('0xc')](_0x4b2b('0x1d'),_0x18611d['uniqueid'],_0x18611d[_0x4b2b('0x1e')],_0x18611d['exten']));channels[_0x18611d[_0x4b2b('0x9')]]={'uniqueid':_0x18611d[_0x4b2b('0x9')],'accountcode':_0x18611d[_0x4b2b('0x14')],'source':_0x18611d['calleridnum'],'destination':_0x18611d[_0x4b2b('0x1f')],'destinationcontext':_0x18611d['context'],'channel':_0x18611d[_0x4b2b('0xe')],'starttime':utils[_0x4b2b('0x20')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x4b2b('0x4'),'amaflags':'DOCUMENTATION'};}}catch(_0x24f538){utils[_0x4b2b('0x21')](util[_0x4b2b('0xc')](_0x4b2b('0x1a'),_0x18611d[_0x4b2b('0x9')]),_0x24f538);}};exports[_0x4b2b('0x22')]=function(_0x30bba8){try{utils['debug'](util[_0x4b2b('0xc')](_0x4b2b('0x23'),_0x30bba8[_0x4b2b('0x9')]),_0x30bba8);if(!_['isNil'](channels[_0x30bba8[_0x4b2b('0x9')]])&&_0x30bba8[_0x4b2b('0x24')]==0x6){utils[_0x4b2b('0xb')](util[_0x4b2b('0xc')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x30bba8[_0x4b2b('0x9')],_0x30bba8['context'],_0x30bba8['channel']));if(_[_0x4b2b('0x25')](channels[_0x30bba8[_0x4b2b('0x9')]]['systemanswertime'])){channels[_0x30bba8[_0x4b2b('0x9')]][_0x4b2b('0x26')]=utils[_0x4b2b('0x20')]();}}else if(!_[_0x4b2b('0x25')](channels[_0x30bba8[_0x4b2b('0x1b')]])&&_0x30bba8['channelstate']==0x6&&_0x30bba8[_0x4b2b('0x1e')]!=_0x4b2b('0x27')){utils[_0x4b2b('0xb')](util[_0x4b2b('0xc')](_0x4b2b('0x28'),_0x30bba8[_0x4b2b('0x9')],_0x30bba8['linkedid'],_0x30bba8[_0x4b2b('0x1e')],_0x30bba8[_0x4b2b('0xe')]));channels[_0x30bba8[_0x4b2b('0x1b')]][_0x4b2b('0x14')]=_0x30bba8[_0x4b2b('0x14')];channels[_0x30bba8[_0x4b2b('0x1b')]]['destinationchannel']=_0x30bba8[_0x4b2b('0xe')];if(_[_0x4b2b('0x25')](channels[_0x30bba8[_0x4b2b('0x1b')]][_0x4b2b('0x29')])){channels[_0x30bba8[_0x4b2b('0x1b')]][_0x4b2b('0x29')]=utils[_0x4b2b('0x20')]();}channels[_0x30bba8['linkedid']][_0x4b2b('0x2a')]=dispositions[_[_0x4b2b('0x2b')](_0x30bba8[_0x4b2b('0x24')])]||_0x4b2b('0x6');}}catch(_0x419ce5){utils['error'](util[_0x4b2b('0xc')](_0x4b2b('0x23'),_0x30bba8[_0x4b2b('0x9')]),_0x419ce5);}};exports[_0x4b2b('0x2c')]=function(_0x3d18ff){try{if(!_[_0x4b2b('0x25')](channels[_0x3d18ff['uniqueid']])){utils['debug'](util[_0x4b2b('0xc')](_0x4b2b('0x2d'),_0x3d18ff['uniqueid']),_0x3d18ff);if(_[_0x4b2b('0x25')](channels[_0x3d18ff['uniqueid']][_0x4b2b('0x2e')])){channels[_0x3d18ff[_0x4b2b('0x9')]]['callerid']=_0x3d18ff[_0x4b2b('0x2f')]+'\x20<'+_0x3d18ff[_0x4b2b('0x30')]+'>';}utils[_0x4b2b('0xb')](util[_0x4b2b('0xc')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x3d18ff['uniqueid'],channels[_0x3d18ff[_0x4b2b('0x9')]][_0x4b2b('0x2e')],_0x3d18ff[_0x4b2b('0x31')]));channels[_0x3d18ff['uniqueid']][_0x4b2b('0x32')]=utils[_0x4b2b('0x20')]();channels[_0x3d18ff[_0x4b2b('0x9')]][_0x4b2b('0x33')]=utils['diffTime'](channels[_0x3d18ff[_0x4b2b('0x9')]][_0x4b2b('0x32')],channels[_0x3d18ff[_0x4b2b('0x9')]]['starttime']);channels[_0x3d18ff['uniqueid']]['billableseconds']=channels[_0x3d18ff[_0x4b2b('0x9')]][_0x4b2b('0x29')]?utils[_0x4b2b('0x34')](channels[_0x3d18ff['uniqueid']][_0x4b2b('0x32')],channels[_0x3d18ff['uniqueid']][_0x4b2b('0x29')]):0x0;writeDB(channels[_0x3d18ff[_0x4b2b('0x9')]]);}}catch(_0x59ade0){utils['error'](util['format'](_0x4b2b('0x2d'),_0x3d18ff[_0x4b2b('0x9')]),_0x59ade0);}};exports[_0x4b2b('0x35')]=function(_0x475b65){try{if(!_[_0x4b2b('0x25')](channels[_0x475b65[_0x4b2b('0x36')]])){utils[_0x4b2b('0x37')](util['format'](_0x4b2b('0x38'),_0x475b65[_0x4b2b('0x39')]),_0x475b65);if(channels[_0x475b65[_0x4b2b('0x36')]][_0x4b2b('0xe')]==_0x475b65['transfereechannel']){utils[_0x4b2b('0xb')](util['format'](_0x4b2b('0x3a'),_0x475b65[_0x4b2b('0x39')],_0x475b65['localtwolinkedid'],_0x475b65[_0x4b2b('0x3b')]));channels[_0x475b65[_0x4b2b('0x36')]]['destinationchannel']=_0x475b65[_0x4b2b('0x3b')];channels[_0x475b65[_0x4b2b('0x36')]][_0x4b2b('0x3c')]=_0x4b2b('0x3d');}else if(channels[_0x475b65[_0x4b2b('0x36')]][_0x4b2b('0xe')]=_0x475b65['transfertargetchannel']){utils[_0x4b2b('0xb')](util['format'](_0x4b2b('0x3a'),_0x475b65['origtransfereruniqueid'],_0x475b65[_0x4b2b('0x36')],_0x475b65[_0x4b2b('0x3e')]));channels[_0x475b65[_0x4b2b('0x36')]]['destinationchannel']=_0x475b65[_0x4b2b('0x3e')];channels[_0x475b65['localtwolinkedid']][_0x4b2b('0x3c')]=_0x4b2b('0x3d');}}}catch(_0x3d8540){utils['error'](util[_0x4b2b('0xc')](_0x4b2b('0x38'),_0x475b65['origtransfereruniqueid']),_0x3d8540);}};exports[_0x4b2b('0x3f')]=function(_0x19cf3a){try{if(!_[_0x4b2b('0x25')](channels[_0x19cf3a[_0x4b2b('0x9')]])){utils[_0x4b2b('0x37')](util['format'](_0x4b2b('0x40'),_0x19cf3a[_0x4b2b('0x9')]),_0x19cf3a);channels[_0x19cf3a[_0x4b2b('0x9')]][_0x4b2b('0x41')]=utils[_0x4b2b('0x20')]();utils[_0x4b2b('0xb')](util[_0x4b2b('0xc')](_0x4b2b('0x42'),_0x19cf3a[_0x4b2b('0x9')],channels[_0x19cf3a['uniqueid']][_0x4b2b('0x41')]));}}catch(_0x5bbf33){utils[_0x4b2b('0x21')](util[_0x4b2b('0xc')](_0x4b2b('0x40'),_0x19cf3a['uniqueid']),_0x5bbf33);}};exports[_0x4b2b('0x43')]=function(_0xde77e){try{if(!_['isNil'](channels[_0xde77e['uniqueid']])){utils[_0x4b2b('0x37')](util[_0x4b2b('0xc')](_0x4b2b('0x44'),_0xde77e['uniqueid']),_0xde77e);if(!_[_0x4b2b('0x25')](channels[_0xde77e[_0x4b2b('0x9')]][_0x4b2b('0x41')])){channels[_0xde77e[_0x4b2b('0x9')]]['mohtime']+=utils[_0x4b2b('0x34')](utils['now'](),channels[_0xde77e[_0x4b2b('0x9')]][_0x4b2b('0x41')]);utils['info'](util[_0x4b2b('0xc')](_0x4b2b('0x45'),_0xde77e[_0x4b2b('0x9')],channels[_0xde77e[_0x4b2b('0x9')]][_0x4b2b('0x46')]));delete channels[_0xde77e[_0x4b2b('0x9')]][_0x4b2b('0x41')];}}}catch(_0x12a653){utils[_0x4b2b('0x21')](util['format'](_0x4b2b('0x44'),_0xde77e['uniqueid']),_0x12a653);}};exports['varset']=function(_0x361346){try{if(!_[_0x4b2b('0x25')](channels[_0x361346[_0x4b2b('0x9')]])){utils[_0x4b2b('0x37')](util['format'](_0x4b2b('0x47'),_0x361346[_0x4b2b('0x9')]),_0x361346);if(!_['isNil'](_0x361346[_0x4b2b('0x48')][_0x4b2b('0x49')])){utils[_0x4b2b('0xb')](util[_0x4b2b('0xc')](_0x4b2b('0x4a'),_0x361346['uniqueid'],_0x361346[_0x4b2b('0x4b')]));channels[_0x361346[_0x4b2b('0x9')]]['source']=_0x361346[_0x4b2b('0x4b')];}if(!_[_0x4b2b('0x25')](_0x361346[_0x4b2b('0x48')][_0x4b2b('0x4c')])){utils['info'](util[_0x4b2b('0xc')](_0x4b2b('0x4d'),_0x361346['uniqueid'],_0x361346[_0x4b2b('0x4b')]));channels[_0x361346[_0x4b2b('0x9')]][_0x4b2b('0x4e')]=_0x361346[_0x4b2b('0x4b')];channels[_0x361346['uniqueid']][_0x4b2b('0x2e')]='\x22'+_0x361346[_0x4b2b('0x4b')]+'\x22\x20<'+_0x361346[_0x4b2b('0x4b')]+'>';}if(!_[_0x4b2b('0x25')](_0x361346['variable'][_0x4b2b('0x4f')])||!_[_0x4b2b('0x25')](_0x361346[_0x4b2b('0x48')][_0x4b2b('0x50')])){utils[_0x4b2b('0xb')](util[_0x4b2b('0xc')](_0x4b2b('0x51'),_0x361346[_0x4b2b('0x9')],!_['isNil'](_0x361346[_0x4b2b('0x48')][_0x4b2b('0x4f')])?_0x4b2b('0x4f'):_0x4b2b('0x50'),_0x361346[_0x4b2b('0x4b')]));channels[_0x361346[_0x4b2b('0x9')]][_0x4b2b('0x2e')]=_0x361346['value'];}if(!_[_0x4b2b('0x25')](_0x361346[_0x4b2b('0x48')][_0x4b2b('0x52')])||!_[_0x4b2b('0x25')](_0x361346[_0x4b2b('0x48')][_0x4b2b('0x53')])){utils['info'](util[_0x4b2b('0xc')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x361346['uniqueid'],!_['isNil'](_0x361346[_0x4b2b('0x48')][_0x4b2b('0x52')])?_0x4b2b('0x52'):_0x4b2b('0x53'),_0x361346['value']));channels[_0x361346[_0x4b2b('0x9')]][_0x4b2b('0x54')]=_0x4b2b('0x55');channels[_0x361346[_0x4b2b('0x9')]]['lastdata']=_0x361346[_0x4b2b('0x4b')];channels[_0x361346[_0x4b2b('0x9')]][_0x4b2b('0xf')]=!![];}if(!_[_0x4b2b('0x25')](_0x361346[_0x4b2b('0x48')][_0x4b2b('0x56')])){utils[_0x4b2b('0xb')](util[_0x4b2b('0xc')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x361346[_0x4b2b('0x9')],_0x361346['value']));channels[_0x361346['uniqueid']][_0x4b2b('0x57')]=_0x361346[_0x4b2b('0x4b')];}if(!_[_0x4b2b('0x25')](_0x361346[_0x4b2b('0x48')]['xmd-cdrtype'])){utils[_0x4b2b('0xb')](util[_0x4b2b('0xc')](_0x4b2b('0x58'),_0x361346[_0x4b2b('0x9')],_0x361346['value']));channels[_0x361346[_0x4b2b('0x9')]][_0x4b2b('0x59')]=_0x361346[_0x4b2b('0x4b')];}if(!_[_0x4b2b('0x25')](_0x361346['variable'][_0x4b2b('0x5a')])){utils['info'](util[_0x4b2b('0xc')](_0x4b2b('0x5b'),_0x361346[_0x4b2b('0x9')],_0x361346['value']));channels[_0x361346[_0x4b2b('0x9')]][_0x4b2b('0x5c')]=_0x361346[_0x4b2b('0x4b')];}if(!_[_0x4b2b('0x25')](_0x361346[_0x4b2b('0x48')][_0x4b2b('0x5d')])){utils[_0x4b2b('0xb')](util[_0x4b2b('0xc')](_0x4b2b('0x5e'),_0x361346['uniqueid'],_0x361346[_0x4b2b('0x4b')]));channels[_0x361346[_0x4b2b('0x9')]][_0x4b2b('0x5d')]=_0x361346[_0x4b2b('0x4b')];}}}catch(_0x3f6fd3){utils[_0x4b2b('0x21')](util[_0x4b2b('0xc')](_0x4b2b('0x47'),_0x361346[_0x4b2b('0x9')]),_0x3f6fd3);}};exports[_0x4b2b('0x5f')]=function(_0x2e3ae3){try{if(!_['isNil'](channels[_0x2e3ae3[_0x4b2b('0x9')]])){utils[_0x4b2b('0x37')](util[_0x4b2b('0xc')](_0x4b2b('0x60'),_0x2e3ae3[_0x4b2b('0x9')]),_0x2e3ae3);utils['info'](util[_0x4b2b('0xc')](_0x4b2b('0x61'),_0x2e3ae3[_0x4b2b('0x9')],_0x2e3ae3[_0x4b2b('0x62')],_0x2e3ae3[_0x4b2b('0x63')]));if(_0x2e3ae3['application'][_0x4b2b('0x64')]()==_0x4b2b('0x65')&&_[_0x4b2b('0x66')](_0x2e3ae3[_0x4b2b('0x63')][_0x4b2b('0x64')](),_0x4b2b('0x67'))){var _0x36ec99=_0x2e3ae3[_0x4b2b('0x63')][_0x4b2b('0x68')]('=');var _0x2c5f41=_0x36ec99[0x0]['substring'](_0x36ec99[0x0]['lastIndexOf']('(')+0x1,_0x36ec99[0x0][_0x4b2b('0x69')](')'));var _0x5d4a94=_0x36ec99[0x1];channels[_0x2e3ae3[_0x4b2b('0x9')]][_0x2c5f41]=_0x5d4a94;}if(!_[_0x4b2b('0x6a')](['hangup',_0x4b2b('0x6b'),_0x4b2b('0x6c'),_0x4b2b('0x65'),_0x4b2b('0x6d')],_0x2e3ae3[_0x4b2b('0x62')][_0x4b2b('0x64')]())){channels[_0x2e3ae3[_0x4b2b('0x9')]][_0x4b2b('0x54')]=_0x2e3ae3[_0x4b2b('0x62')];channels[_0x2e3ae3[_0x4b2b('0x9')]]['lastdata']=_0x2e3ae3[_0x4b2b('0x63')];}}}catch(_0x19538e){utils['error'](util[_0x4b2b('0xc')]('[%s][calls][newexten]',_0x2e3ae3[_0x4b2b('0x9')]),_0x19538e);}}; \ No newline at end of file +var _0xa7be=['Queue','lastdata','queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','includes','set','gotoif','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','BUSY','FAILED','blinds','uniqueid','transfereeuniqueid','info','format','channel','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','UserId','CreateVoiceCallReport','request','recording','newchannel','debug','[%s][calls][newchannel]','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','DOCUMENTATION','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','isNil','linkedid','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','disposition','ANSWERED','error','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','diffTime','billableseconds','answertime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','userfield','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','destinationchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication'];(function(_0x4b69a4,_0x57e598){var _0x23fcb1=function(_0x152fca){while(--_0x152fca){_0x4b69a4['push'](_0x4b69a4['shift']());}};_0x23fcb1(++_0x57e598);}(_0xa7be,0xfd));var _0xea7b=function(_0x32955d,_0x598683){_0x32955d=_0x32955d-0x0;var _0x4e7974=_0xa7be[_0x32955d];return _0x4e7974;};'use strict';var _=require(_0xea7b('0x0'));var util=require(_0xea7b('0x1'));var utils=require(_0xea7b('0x2'));var transfers=require(_0xea7b('0x3'));var dispositions=[_0xea7b('0x4'),'FAILED','FAILED',_0xea7b('0x4'),_0xea7b('0x4'),_0xea7b('0x4'),'ANSWERED',_0xea7b('0x5'),_0xea7b('0x6'),_0xea7b('0x6'),_0xea7b('0x6')];var channels={};function writeDB(_0x25a8e9){var _0x3601b3;if(transfers[_0xea7b('0x7')][_0x25a8e9[_0xea7b('0x8')]]){_0x3601b3=_0x25a8e9[_0xea7b('0x8')];_0x25a8e9[_0xea7b('0x8')]=transfers['blinds'][_0x25a8e9[_0xea7b('0x8')]][_0xea7b('0x9')];}utils[_0xea7b('0xa')](util[_0xea7b('0xb')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x25a8e9[_0xea7b('0x8')],_0x25a8e9[_0xea7b('0xc')],_0x25a8e9['queue'],_0x25a8e9[_0xea7b('0xd')],_0x25a8e9[_0xea7b('0xe')],_0x25a8e9[_0xea7b('0xf')],_0x25a8e9[_0xea7b('0x10')],_0x25a8e9[_0xea7b('0x11')]));if(_0x25a8e9[_0xea7b('0x12')]){utils[_0xea7b('0x13')](_0x25a8e9[_0xea7b('0x12')])['then'](function(_0x5c518b){if(_0x5c518b){_0x25a8e9[_0xea7b('0x14')]=_0x5c518b['id'];}utils['request'](_0xea7b('0x15'),_0x25a8e9);});}else{utils[_0xea7b('0x16')]('CreateVoiceCallReport',_0x25a8e9);}if(channels[_0x25a8e9['uniqueid']]){delete channels[_0x25a8e9[_0xea7b('0x8')]];}else if(_0x3601b3&&channels[_0x3601b3]){if(!transfers['blinds'][_0x3601b3][_0xea7b('0x17')])delete transfers[_0xea7b('0x7')][_0x3601b3];delete channels[_0x3601b3];}}exports[_0xea7b('0x18')]=function(_0x125116){try{utils[_0xea7b('0x19')](util['format'](_0xea7b('0x1a'),_0x125116[_0xea7b('0x8')]),_0x125116);if(_0x125116[_0xea7b('0x8')]==_0x125116['linkedid']&&_0x125116[_0xea7b('0xc')]!=_0xea7b('0x1b')){utils['info'](util[_0xea7b('0xb')](_0xea7b('0x1c'),_0x125116[_0xea7b('0x8')],_0x125116['context'],_0x125116['exten']));channels[_0x125116[_0xea7b('0x8')]]={'uniqueid':_0x125116[_0xea7b('0x8')],'accountcode':_0x125116['accountcode'],'source':_0x125116[_0xea7b('0xf')],'destination':_0x125116[_0xea7b('0x1d')],'destinationcontext':_0x125116[_0xea7b('0x1e')],'channel':_0x125116['channel'],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xea7b('0x4'),'amaflags':_0xea7b('0x1f')};}}catch(_0x2489e1){utils['error'](util['format']('[%s][calls][newchannel]',_0x125116[_0xea7b('0x8')]),_0x2489e1);}};exports['newstate']=function(_0x5dc1e9){try{utils['debug'](util[_0xea7b('0xb')](_0xea7b('0x20'),_0x5dc1e9['uniqueid']),_0x5dc1e9);if(!_['isNil'](channels[_0x5dc1e9[_0xea7b('0x8')]])&&_0x5dc1e9[_0xea7b('0x21')]==0x6){utils[_0xea7b('0xa')](util[_0xea7b('0xb')](_0xea7b('0x22'),_0x5dc1e9[_0xea7b('0x8')],_0x5dc1e9[_0xea7b('0x1e')],_0x5dc1e9[_0xea7b('0xc')]));if(_['isNil'](channels[_0x5dc1e9[_0xea7b('0x8')]][_0xea7b('0x23')])){channels[_0x5dc1e9[_0xea7b('0x8')]][_0xea7b('0x23')]=utils[_0xea7b('0x24')]();}}else if(!_[_0xea7b('0x25')](channels[_0x5dc1e9[_0xea7b('0x26')]])&&_0x5dc1e9[_0xea7b('0x21')]==0x6&&_0x5dc1e9[_0xea7b('0x1e')]!='transfer'){utils[_0xea7b('0xa')](util[_0xea7b('0xb')](_0xea7b('0x27'),_0x5dc1e9[_0xea7b('0x8')],_0x5dc1e9[_0xea7b('0x26')],_0x5dc1e9[_0xea7b('0x1e')],_0x5dc1e9[_0xea7b('0xc')]));channels[_0x5dc1e9[_0xea7b('0x26')]]['accountcode']=_0x5dc1e9[_0xea7b('0x12')];channels[_0x5dc1e9[_0xea7b('0x26')]]['destinationchannel']=_0x5dc1e9[_0xea7b('0xc')];if(_[_0xea7b('0x25')](channels[_0x5dc1e9[_0xea7b('0x26')]]['answertime'])){channels[_0x5dc1e9[_0xea7b('0x26')]]['answertime']=utils['now']();}channels[_0x5dc1e9[_0xea7b('0x26')]][_0xea7b('0x28')]=dispositions[_['toNumber'](_0x5dc1e9[_0xea7b('0x21')])]||_0xea7b('0x29');}}catch(_0xb09c4c){utils[_0xea7b('0x2a')](util[_0xea7b('0xb')]('[%s][calls][newstate]',_0x5dc1e9[_0xea7b('0x8')]),_0xb09c4c);}};exports[_0xea7b('0x2b')]=function(_0x9aecd2){try{if(!_['isNil'](channels[_0x9aecd2['uniqueid']])){utils[_0xea7b('0x19')](util[_0xea7b('0xb')](_0xea7b('0x2c'),_0x9aecd2[_0xea7b('0x8')]),_0x9aecd2);if(_[_0xea7b('0x25')](channels[_0x9aecd2['uniqueid']][_0xea7b('0x2d')])){channels[_0x9aecd2[_0xea7b('0x8')]]['callerid']=_0x9aecd2[_0xea7b('0x2e')]+'\x20<'+_0x9aecd2[_0xea7b('0xf')]+'>';}utils[_0xea7b('0xa')](util[_0xea7b('0xb')](_0xea7b('0x2f'),_0x9aecd2['uniqueid'],channels[_0x9aecd2[_0xea7b('0x8')]]['callerid'],_0x9aecd2[_0xea7b('0x30')]));channels[_0x9aecd2[_0xea7b('0x8')]][_0xea7b('0x31')]=utils[_0xea7b('0x24')]();channels[_0x9aecd2[_0xea7b('0x8')]]['duration']=utils[_0xea7b('0x32')](channels[_0x9aecd2[_0xea7b('0x8')]][_0xea7b('0x31')],channels[_0x9aecd2[_0xea7b('0x8')]]['starttime']);channels[_0x9aecd2[_0xea7b('0x8')]][_0xea7b('0x33')]=channels[_0x9aecd2['uniqueid']]['answertime']?utils[_0xea7b('0x32')](channels[_0x9aecd2[_0xea7b('0x8')]][_0xea7b('0x31')],channels[_0x9aecd2['uniqueid']][_0xea7b('0x34')]):0x0;writeDB(channels[_0x9aecd2['uniqueid']]);}}catch(_0x30fc41){utils[_0xea7b('0x2a')](util[_0xea7b('0xb')](_0xea7b('0x2c'),_0x9aecd2['uniqueid']),_0x30fc41);}};exports[_0xea7b('0x35')]=function(_0x3c4ea3){try{if(!_[_0xea7b('0x25')](channels[_0x3c4ea3[_0xea7b('0x36')]])){utils['debug'](util[_0xea7b('0xb')](_0xea7b('0x37'),_0x3c4ea3[_0xea7b('0x38')]),_0x3c4ea3);if(channels[_0x3c4ea3['localtwolinkedid']][_0xea7b('0xc')]==_0x3c4ea3[_0xea7b('0x39')]){utils['info'](util[_0xea7b('0xb')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x3c4ea3['origtransfereruniqueid'],_0x3c4ea3[_0xea7b('0x36')],_0x3c4ea3[_0xea7b('0x3a')]));channels[_0x3c4ea3['localtwolinkedid']]['destinationchannel']=_0x3c4ea3['secondtransfererchannel'];channels[_0x3c4ea3[_0xea7b('0x36')]][_0xea7b('0x3b')]='_attended';}else if(channels[_0x3c4ea3['localtwolinkedid']][_0xea7b('0xc')]=_0x3c4ea3[_0xea7b('0x3c')]){utils[_0xea7b('0xa')](util['format'](_0xea7b('0x3d'),_0x3c4ea3[_0xea7b('0x38')],_0x3c4ea3[_0xea7b('0x36')],_0x3c4ea3['origtransfererchannel']));channels[_0x3c4ea3[_0xea7b('0x36')]][_0xea7b('0x3e')]=_0x3c4ea3[_0xea7b('0x3f')];channels[_0x3c4ea3['localtwolinkedid']][_0xea7b('0x3b')]='_attended';}}}catch(_0x9fba5e){utils[_0xea7b('0x2a')](util['format'](_0xea7b('0x37'),_0x3c4ea3['origtransfereruniqueid']),_0x9fba5e);}};exports[_0xea7b('0x40')]=function(_0xec829a){try{if(!_[_0xea7b('0x25')](channels[_0xec829a[_0xea7b('0x8')]])){utils[_0xea7b('0x19')](util[_0xea7b('0xb')](_0xea7b('0x41'),_0xec829a[_0xea7b('0x8')]),_0xec829a);channels[_0xec829a[_0xea7b('0x8')]]['musiconholdstartAt']=utils[_0xea7b('0x24')]();utils[_0xea7b('0xa')](util[_0xea7b('0xb')](_0xea7b('0x42'),_0xec829a[_0xea7b('0x8')],channels[_0xec829a[_0xea7b('0x8')]][_0xea7b('0x43')]));}}catch(_0x43cd97){utils[_0xea7b('0x2a')](util[_0xea7b('0xb')](_0xea7b('0x41'),_0xec829a[_0xea7b('0x8')]),_0x43cd97);}};exports[_0xea7b('0x44')]=function(_0x1d4e0b){try{if(!_[_0xea7b('0x25')](channels[_0x1d4e0b[_0xea7b('0x8')]])){utils['debug'](util[_0xea7b('0xb')](_0xea7b('0x45'),_0x1d4e0b['uniqueid']),_0x1d4e0b);if(!_[_0xea7b('0x25')](channels[_0x1d4e0b[_0xea7b('0x8')]][_0xea7b('0x43')])){channels[_0x1d4e0b[_0xea7b('0x8')]]['mohtime']+=utils[_0xea7b('0x32')](utils[_0xea7b('0x24')](),channels[_0x1d4e0b['uniqueid']][_0xea7b('0x43')]);utils['info'](util[_0xea7b('0xb')](_0xea7b('0x46'),_0x1d4e0b['uniqueid'],channels[_0x1d4e0b[_0xea7b('0x8')]]['mohtime']));delete channels[_0x1d4e0b['uniqueid']][_0xea7b('0x43')];}}}catch(_0x38741f){utils[_0xea7b('0x2a')](util[_0xea7b('0xb')]('[%s][calls][musiconholdstop]',_0x1d4e0b[_0xea7b('0x8')]),_0x38741f);}};exports['varset']=function(_0x59ac58){try{if(!_[_0xea7b('0x25')](channels[_0x59ac58[_0xea7b('0x8')]])){utils['debug'](util[_0xea7b('0xb')](_0xea7b('0x47'),_0x59ac58[_0xea7b('0x8')]),_0x59ac58);if(!_[_0xea7b('0x25')](_0x59ac58[_0xea7b('0x48')][_0xea7b('0x49')])){utils[_0xea7b('0xa')](util[_0xea7b('0xb')](_0xea7b('0x4a'),_0x59ac58[_0xea7b('0x8')],_0x59ac58[_0xea7b('0x4b')]));channels[_0x59ac58[_0xea7b('0x8')]][_0xea7b('0x4c')]=_0x59ac58[_0xea7b('0x4b')];}if(!_[_0xea7b('0x25')](_0x59ac58[_0xea7b('0x48')]['xmd-phone'])){utils['info'](util['format'](_0xea7b('0x4d'),_0x59ac58['uniqueid'],_0x59ac58[_0xea7b('0x4b')]));channels[_0x59ac58[_0xea7b('0x8')]][_0xea7b('0x4e')]=_0x59ac58[_0xea7b('0x4b')];channels[_0x59ac58[_0xea7b('0x8')]][_0xea7b('0x2d')]='\x22'+_0x59ac58[_0xea7b('0x4b')]+_0xea7b('0x4f')+_0x59ac58['value']+'>';}if(!_[_0xea7b('0x25')](_0x59ac58[_0xea7b('0x48')]['xmd-callerid-preview'])||!_[_0xea7b('0x25')](_0x59ac58[_0xea7b('0x48')][_0xea7b('0x50')])){utils[_0xea7b('0xa')](util['format'](_0xea7b('0x51'),_0x59ac58[_0xea7b('0x8')],!_[_0xea7b('0x25')](_0x59ac58[_0xea7b('0x48')][_0xea7b('0x52')])?_0xea7b('0x52'):_0xea7b('0x50'),_0x59ac58[_0xea7b('0x4b')]));channels[_0x59ac58[_0xea7b('0x8')]][_0xea7b('0x2d')]=_0x59ac58[_0xea7b('0x4b')];}if(!_[_0xea7b('0x25')](_0x59ac58[_0xea7b('0x48')][_0xea7b('0x53')])||!_['isNil'](_0x59ac58[_0xea7b('0x48')][_0xea7b('0x54')])){utils['info'](util[_0xea7b('0xb')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x59ac58[_0xea7b('0x8')],!_['isNil'](_0x59ac58[_0xea7b('0x48')][_0xea7b('0x53')])?_0xea7b('0x53'):'xmcs-queue',_0x59ac58[_0xea7b('0x4b')]));channels[_0x59ac58['uniqueid']][_0xea7b('0x55')]=_0xea7b('0x56');channels[_0x59ac58[_0xea7b('0x8')]][_0xea7b('0x57')]=_0x59ac58['value'];channels[_0x59ac58['uniqueid']][_0xea7b('0x58')]=!![];}if(!_['isNil'](_0x59ac58[_0xea7b('0x48')][_0xea7b('0x59')])){utils[_0xea7b('0xa')](util['format'](_0xea7b('0x5a'),_0x59ac58[_0xea7b('0x8')],_0x59ac58[_0xea7b('0x4b')]));channels[_0x59ac58['uniqueid']][_0xea7b('0x5b')]=_0x59ac58[_0xea7b('0x4b')];}if(!_['isNil'](_0x59ac58[_0xea7b('0x48')]['xmd-cdrtype'])){utils[_0xea7b('0xa')](util[_0xea7b('0xb')](_0xea7b('0x5c'),_0x59ac58[_0xea7b('0x8')],_0x59ac58['value']));channels[_0x59ac58[_0xea7b('0x8')]][_0xea7b('0x5d')]=_0x59ac58[_0xea7b('0x4b')];}if(!_['isNil'](_0x59ac58[_0xea7b('0x48')][_0xea7b('0x5e')])){utils['info'](util['format'](_0xea7b('0x5f'),_0x59ac58['uniqueid'],_0x59ac58[_0xea7b('0x4b')]));channels[_0x59ac58[_0xea7b('0x8')]][_0xea7b('0x60')]=_0x59ac58['value'];}if(!_[_0xea7b('0x25')](_0x59ac58[_0xea7b('0x48')][_0xea7b('0x61')])){utils[_0xea7b('0xa')](util[_0xea7b('0xb')](_0xea7b('0x62'),_0x59ac58['uniqueid'],_0x59ac58[_0xea7b('0x4b')]));channels[_0x59ac58['uniqueid']]['sipcallid']=_0x59ac58[_0xea7b('0x4b')];}}}catch(_0x32c1fe){utils['error'](util[_0xea7b('0xb')]('[%s][calls][varset]',_0x59ac58[_0xea7b('0x8')]),_0x32c1fe);}};exports[_0xea7b('0x63')]=function(_0x528357){try{if(!_[_0xea7b('0x25')](channels[_0x528357['uniqueid']])){utils[_0xea7b('0x19')](util[_0xea7b('0xb')](_0xea7b('0x64'),_0x528357[_0xea7b('0x8')]),_0x528357);utils[_0xea7b('0xa')](util[_0xea7b('0xb')](_0xea7b('0x65'),_0x528357['uniqueid'],_0x528357['application'],_0x528357[_0xea7b('0x66')]));if(_0x528357[_0xea7b('0x67')][_0xea7b('0x68')]()=='set'&&_[_0xea7b('0x69')](_0x528357[_0xea7b('0x66')][_0xea7b('0x68')](),_0xea7b('0x6a'))){var _0x843816=_0x528357[_0xea7b('0x66')][_0xea7b('0x6b')]('=');var _0x5152f8=_0x843816[0x0][_0xea7b('0x6c')](_0x843816[0x0][_0xea7b('0x6d')]('(')+0x1,_0x843816[0x0][_0xea7b('0x6d')](')'));var _0xbdd53d=_0x843816[0x1];channels[_0x528357[_0xea7b('0x8')]][_0x5152f8]=_0xbdd53d;}if(!_[_0xea7b('0x6e')]([_0xea7b('0x2b'),'noop','execif',_0xea7b('0x6f'),_0xea7b('0x70')],_0x528357[_0xea7b('0x67')][_0xea7b('0x68')]())){channels[_0x528357[_0xea7b('0x8')]][_0xea7b('0x55')]=_0x528357[_0xea7b('0x67')];channels[_0x528357[_0xea7b('0x8')]]['lastdata']=_0x528357[_0xea7b('0x66')];}}}catch(_0x2d0205){utils['error'](util[_0xea7b('0xb')]('[%s][calls][newexten]',_0x528357[_0xea7b('0x8')]),_0x2d0205);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 9a8ef5a..c64b02d 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 _0x86b9=['error','[core]\x20error','close','managerevent','./utils','connect','info','[core]\x20connected','shutdown','fullybooted'];(function(_0x7ac989,_0x1dea31){var _0x47bc5e=function(_0x574f49){while(--_0x574f49){_0x7ac989['push'](_0x7ac989['shift']());}};_0x47bc5e(++_0x1dea31);}(_0x86b9,0x1e4));var _0x986b=function(_0x5cd939,_0xac0983){_0x5cd939=_0x5cd939-0x0;var _0x6c5526=_0x86b9[_0x5cd939];return _0x6c5526;};'use strict';var utils=require(_0x986b('0x0'));exports[_0x986b('0x1')]=function(){utils[_0x986b('0x2')](_0x986b('0x3'));};exports[_0x986b('0x4')]=function(){utils['info']('[core]\x20shutdown');};exports[_0x986b('0x5')]=function(){utils[_0x986b('0x2')]('[core]\x20fullybooted');};exports[_0x986b('0x6')]=function(_0x445267){utils[_0x986b('0x6')](_0x986b('0x7'),_0x445267);};exports[_0x986b('0x8')]=function(){utils[_0x986b('0x2')]('[core]\x20close');};exports[_0x986b('0x9')]=function(_0x1b2aea){}; \ No newline at end of file +var _0x19ac=['managerevent','./utils','connect','info','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x19ac,0x91));var _0xc19a=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x19ac[_0x2070da];return _0x4f9fe1;};'use strict';var utils=require(_0xc19a('0x0'));exports[_0xc19a('0x1')]=function(){utils[_0xc19a('0x2')]('[core]\x20connected');};exports[_0xc19a('0x3')]=function(){utils[_0xc19a('0x2')](_0xc19a('0x4'));};exports[_0xc19a('0x5')]=function(){utils[_0xc19a('0x2')](_0xc19a('0x6'));};exports[_0xc19a('0x7')]=function(_0x365f55){utils['error'](_0xc19a('0x8'),_0x365f55);};exports[_0xc19a('0x9')]=function(){utils['info'](_0xc19a('0xa'));};exports[_0xc19a('0xb')]=function(_0x4846e9){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 43277bd..b8a48fa 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 _0x9748=['[%s][dials][newexten]','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][dialbegin]','starttime','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialend]','ANSWER','answertime','now','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','debug','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','assign','duration','endtime','holdtime','diffTime','billableseconds','info','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','newexten','format','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr(routeid)','split','error'];(function(_0x56bff2,_0xae0085){var _0x5d369e=function(_0x2a4160){while(--_0x2a4160){_0x56bff2['push'](_0x56bff2['shift']());}};_0x5d369e(++_0xae0085);}(_0x9748,0x1e2));var _0x8974=function(_0x209319,_0x48ccac){_0x209319=_0x209319-0x0;var _0xd0ddbb=_0x9748[_0x209319];return _0xd0ddbb;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var dials={};function writeDB(_0x96ba66){utils[_0x8974('0x0')](util['format']('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x96ba66[_0x8974('0x1')],_0x96ba66[_0x8974('0x2')],_0x96ba66[_0x8974('0x3')],_0x96ba66[_0x8974('0x4')],_0x96ba66[_0x8974('0x5')],_0x96ba66[_0x8974('0x6')]));utils['request']('CreateVoiceDialReport',_0x96ba66);delete dials[_0x96ba66['uniqueid']];}exports[_0x8974('0x7')]=function(_0x742eac){try{utils['debug'](util['format']('[%s][dials][newexten]',_0x742eac[_0x8974('0x1')]),_0x742eac);utils[_0x8974('0x0')](util[_0x8974('0x8')](_0x8974('0x9'),_0x742eac[_0x8974('0x1')],_0x742eac[_0x8974('0xa')],_0x742eac[_0x8974('0xb')]));if(_0x742eac[_0x8974('0xa')]['toLowerCase']()==_0x8974('0xc')&&_[_0x8974('0xd')](_0x742eac['appdata'][_0x8974('0xe')](),_0x8974('0xf'))){var _0x4668ca=_0x742eac[_0x8974('0xb')][_0x8974('0x10')]('=');dials[_0x742eac[_0x8974('0x1')]]={'routeId':_0x4668ca[0x1]};}}catch(_0x5163fe){utils[_0x8974('0x11')](util[_0x8974('0x8')](_0x8974('0x12'),_0x742eac['uniqueid']),_0x5163fe);}};exports[_0x8974('0x13')]=function(_0x4cb4bc){try{utils['debug'](util[_0x8974('0x8')](_0x8974('0x14'),_0x4cb4bc[_0x8974('0x1')]),_0x4cb4bc);if(!_[_0x8974('0x15')](_0x4cb4bc[_0x8974('0x16')][_0x8974('0x17')])){utils[_0x8974('0x0')](util[_0x8974('0x8')](_0x8974('0x18'),_0x4cb4bc['uniqueid'],_0x4cb4bc['value']));dials[_0x4cb4bc[_0x8974('0x1')]]={'routeId':_0x4cb4bc[_0x8974('0x19')]};}}catch(_0xb77cb0){utils[_0x8974('0x11')](util[_0x8974('0x8')](_0x8974('0x14'),_0x4cb4bc['uniqueid']),_0xb77cb0);}};exports['dialbegin']=function(_0x29ae5d){try{if(!_['isNil'](dials[_0x29ae5d['uniqueid']])){utils['debug'](util[_0x8974('0x8')](_0x8974('0x1a'),_0x29ae5d[_0x8974('0x1')]),_0x29ae5d);dials[_0x29ae5d['uniqueid']]=_['assign'](dials[_0x29ae5d[_0x8974('0x1')]],_0x29ae5d);dials[_0x29ae5d[_0x8974('0x1')]][_0x8974('0x1b')]=utils['now']();dials[_0x29ae5d[_0x8974('0x1')]][_0x8974('0x1c')]=_0x8974('0x1d');utils['info'](util[_0x8974('0x8')](_0x8974('0x1e'),_0x29ae5d[_0x8974('0x1')],dials[_0x29ae5d['uniqueid']]['starttime']));}}catch(_0x5b4f0e){utils[_0x8974('0x11')](util[_0x8974('0x8')](_0x8974('0x1a'),_0x29ae5d[_0x8974('0x1')]),_0x5b4f0e);}};exports['dialend']=function(_0x47b37b){try{if(!_[_0x8974('0x15')](dials[_0x47b37b[_0x8974('0x1')]])){utils['debug'](util[_0x8974('0x8')](_0x8974('0x1f'),_0x47b37b[_0x8974('0x1')]),_0x47b37b);dials[_0x47b37b[_0x8974('0x1')]][_0x8974('0x6')]=_0x47b37b[_0x8974('0x6')];if(_0x47b37b[_0x8974('0x6')]==_0x8974('0x20')){dials[_0x47b37b[_0x8974('0x1')]]=_['assign'](dials[_0x47b37b[_0x8974('0x1')]],_0x47b37b);dials[_0x47b37b[_0x8974('0x1')]][_0x8974('0x21')]=utils[_0x8974('0x22')]();dials[_0x47b37b[_0x8974('0x1')]][_0x8974('0x1c')]=_0x8974('0x23');utils[_0x8974('0x0')](util['format'](_0x8974('0x24'),_0x47b37b[_0x8974('0x1')],_0x47b37b[_0x8974('0x6')],dials[_0x47b37b[_0x8974('0x1')]][_0x8974('0x21')]));}else{utils[_0x8974('0x0')](util[_0x8974('0x8')](_0x8974('0x25'),_0x47b37b[_0x8974('0x1')],_0x47b37b['dialstatus']));}}}catch(_0x5194a4){utils[_0x8974('0x11')](util[_0x8974('0x8')](_0x8974('0x1f'),_0x47b37b[_0x8974('0x1')]),_0x5194a4);}};exports[_0x8974('0x26')]=function(_0x2077fd){try{if(!_[_0x8974('0x15')](dials[_0x2077fd[_0x8974('0x1')]])){utils[_0x8974('0x27')](util[_0x8974('0x8')](_0x8974('0x28'),_0x2077fd[_0x8974('0x1')]),_0x2077fd);utils[_0x8974('0x0')](util[_0x8974('0x8')](_0x8974('0x29'),_0x2077fd[_0x8974('0x1')],_0x2077fd[_0x8974('0x4')],_0x2077fd[_0x8974('0x2a')],_0x2077fd[_0x8974('0x2b')]));dials[_0x2077fd[_0x8974('0x1')]]=_[_0x8974('0x2c')](dials[_0x2077fd[_0x8974('0x1')]],{'endtime':utils[_0x8974('0x22')](),'lastevent':'complete'});dials[_0x2077fd[_0x8974('0x1')]][_0x8974('0x2d')]=utils['diffTime'](dials[_0x2077fd[_0x8974('0x1')]][_0x8974('0x2e')],dials[_0x2077fd[_0x8974('0x1')]]['starttime']);dials[_0x2077fd[_0x8974('0x1')]][_0x8974('0x2f')]=utils[_0x8974('0x30')](dials[_0x2077fd[_0x8974('0x1')]][_0x8974('0x21')]||dials[_0x2077fd[_0x8974('0x1')]]['endtime'],dials[_0x2077fd['uniqueid']][_0x8974('0x1b')]);dials[_0x2077fd[_0x8974('0x1')]][_0x8974('0x31')]=dials[_0x2077fd[_0x8974('0x1')]][_0x8974('0x21')]?utils[_0x8974('0x30')](dials[_0x2077fd[_0x8974('0x1')]][_0x8974('0x2e')],dials[_0x2077fd['uniqueid']]['answertime']):0x0;writeDB(dials[_0x2077fd[_0x8974('0x1')]]);}}catch(_0x265024){utils[_0x8974('0x11')](util[_0x8974('0x8')](_0x8974('0x28'),_0x2077fd['uniqueid']),_0x265024);}}; \ No newline at end of file +var _0x6fff=['[%s][dials][newexten]','application','toLowerCase','startsWith','appdata','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','now','lastevent','called','dialend','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','starttime','holdtime','billableseconds','lodash','util','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','debug'];(function(_0x5ecde8,_0x534fb2){var _0x527523=function(_0x4952e6){while(--_0x4952e6){_0x5ecde8['push'](_0x5ecde8['shift']());}};_0x527523(++_0x534fb2);}(_0x6fff,0xc1));var _0xf6ff=function(_0x143a25,_0x37d7f5){_0x143a25=_0x143a25-0x0;var _0x326bb9=_0x6fff[_0x143a25];return _0x326bb9;};'use strict';var _=require(_0xf6ff('0x0'));var util=require(_0xf6ff('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x526c3f){utils[_0xf6ff('0x2')](util[_0xf6ff('0x3')](_0xf6ff('0x4'),_0x526c3f['uniqueid'],_0x526c3f[_0xf6ff('0x5')],_0x526c3f[_0xf6ff('0x6')],_0x526c3f[_0xf6ff('0x7')],_0x526c3f[_0xf6ff('0x8')],_0x526c3f[_0xf6ff('0x9')]));utils[_0xf6ff('0xa')](_0xf6ff('0xb'),_0x526c3f);delete dials[_0x526c3f[_0xf6ff('0xc')]];}exports[_0xf6ff('0xd')]=function(_0x511546){try{utils[_0xf6ff('0xe')](util[_0xf6ff('0x3')](_0xf6ff('0xf'),_0x511546[_0xf6ff('0xc')]),_0x511546);utils[_0xf6ff('0x2')](util['format']('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x511546[_0xf6ff('0xc')],_0x511546[_0xf6ff('0x10')],_0x511546['appdata']));if(_0x511546[_0xf6ff('0x10')][_0xf6ff('0x11')]()=='set'&&_[_0xf6ff('0x12')](_0x511546[_0xf6ff('0x13')][_0xf6ff('0x11')](),_0xf6ff('0x14'))){var _0x10767e=_0x511546[_0xf6ff('0x13')][_0xf6ff('0x15')]('=');dials[_0x511546['uniqueid']]={'routeId':_0x10767e[0x1]};}}catch(_0x5b341b){utils[_0xf6ff('0x16')](util[_0xf6ff('0x3')](_0xf6ff('0xf'),_0x511546['uniqueid']),_0x5b341b);}};exports[_0xf6ff('0x17')]=function(_0x48900e){try{utils[_0xf6ff('0xe')](util['format'](_0xf6ff('0x18'),_0x48900e[_0xf6ff('0xc')]),_0x48900e);if(!_[_0xf6ff('0x19')](_0x48900e[_0xf6ff('0x1a')]['outboundrouteid'])){utils['info'](util[_0xf6ff('0x3')](_0xf6ff('0x1b'),_0x48900e[_0xf6ff('0xc')],_0x48900e[_0xf6ff('0x1c')]));dials[_0x48900e[_0xf6ff('0xc')]]={'routeId':_0x48900e[_0xf6ff('0x1c')]};}}catch(_0x3ce5f5){utils[_0xf6ff('0x16')](util[_0xf6ff('0x3')](_0xf6ff('0x18'),_0x48900e['uniqueid']),_0x3ce5f5);}};exports[_0xf6ff('0x1d')]=function(_0x58104b){try{if(!_[_0xf6ff('0x19')](dials[_0x58104b['uniqueid']])){utils[_0xf6ff('0xe')](util['format'](_0xf6ff('0x1e'),_0x58104b[_0xf6ff('0xc')]),_0x58104b);dials[_0x58104b['uniqueid']]=_[_0xf6ff('0x1f')](dials[_0x58104b[_0xf6ff('0xc')]],_0x58104b);dials[_0x58104b[_0xf6ff('0xc')]]['starttime']=utils[_0xf6ff('0x20')]();dials[_0x58104b[_0xf6ff('0xc')]][_0xf6ff('0x21')]=_0xf6ff('0x22');utils[_0xf6ff('0x2')](util[_0xf6ff('0x3')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x58104b['uniqueid'],dials[_0x58104b[_0xf6ff('0xc')]]['starttime']));}}catch(_0x397aa3){utils[_0xf6ff('0x16')](util[_0xf6ff('0x3')](_0xf6ff('0x1e'),_0x58104b[_0xf6ff('0xc')]),_0x397aa3);}};exports[_0xf6ff('0x23')]=function(_0x4e900e){try{if(!_['isNil'](dials[_0x4e900e['uniqueid']])){utils[_0xf6ff('0xe')](util[_0xf6ff('0x3')](_0xf6ff('0x24'),_0x4e900e[_0xf6ff('0xc')]),_0x4e900e);dials[_0x4e900e[_0xf6ff('0xc')]][_0xf6ff('0x9')]=_0x4e900e['dialstatus'];if(_0x4e900e['dialstatus']==_0xf6ff('0x25')){dials[_0x4e900e[_0xf6ff('0xc')]]=_[_0xf6ff('0x1f')](dials[_0x4e900e[_0xf6ff('0xc')]],_0x4e900e);dials[_0x4e900e['uniqueid']][_0xf6ff('0x26')]=utils[_0xf6ff('0x20')]();dials[_0x4e900e[_0xf6ff('0xc')]][_0xf6ff('0x21')]=_0xf6ff('0x27');utils[_0xf6ff('0x2')](util[_0xf6ff('0x3')](_0xf6ff('0x28'),_0x4e900e[_0xf6ff('0xc')],_0x4e900e['dialstatus'],dials[_0x4e900e[_0xf6ff('0xc')]][_0xf6ff('0x26')]));}else{utils[_0xf6ff('0x2')](util[_0xf6ff('0x3')]('[%s][dials][dialend]\x20dialstatus:%s',_0x4e900e[_0xf6ff('0xc')],_0x4e900e[_0xf6ff('0x9')]));}}}catch(_0x35a45b){utils['error'](util[_0xf6ff('0x3')](_0xf6ff('0x24'),_0x4e900e[_0xf6ff('0xc')]),_0x35a45b);}};exports['hangup']=function(_0x30f4c7){try{if(!_[_0xf6ff('0x19')](dials[_0x30f4c7[_0xf6ff('0xc')]])){utils['debug'](util[_0xf6ff('0x3')](_0xf6ff('0x29'),_0x30f4c7['uniqueid']),_0x30f4c7);utils[_0xf6ff('0x2')](util['format'](_0xf6ff('0x2a'),_0x30f4c7['uniqueid'],_0x30f4c7['calleridnum'],_0x30f4c7[_0xf6ff('0x2b')],_0x30f4c7[_0xf6ff('0x2c')]));dials[_0x30f4c7[_0xf6ff('0xc')]]=_[_0xf6ff('0x1f')](dials[_0x30f4c7[_0xf6ff('0xc')]],{'endtime':utils[_0xf6ff('0x20')](),'lastevent':_0xf6ff('0x2d')});dials[_0x30f4c7[_0xf6ff('0xc')]][_0xf6ff('0x2e')]=utils[_0xf6ff('0x2f')](dials[_0x30f4c7['uniqueid']][_0xf6ff('0x30')],dials[_0x30f4c7[_0xf6ff('0xc')]][_0xf6ff('0x31')]);dials[_0x30f4c7[_0xf6ff('0xc')]][_0xf6ff('0x32')]=utils[_0xf6ff('0x2f')](dials[_0x30f4c7[_0xf6ff('0xc')]]['answertime']||dials[_0x30f4c7[_0xf6ff('0xc')]][_0xf6ff('0x30')],dials[_0x30f4c7[_0xf6ff('0xc')]][_0xf6ff('0x31')]);dials[_0x30f4c7[_0xf6ff('0xc')]][_0xf6ff('0x33')]=dials[_0x30f4c7[_0xf6ff('0xc')]][_0xf6ff('0x26')]?utils[_0xf6ff('0x2f')](dials[_0x30f4c7[_0xf6ff('0xc')]]['endtime'],dials[_0x30f4c7[_0xf6ff('0xc')]][_0xf6ff('0x26')]):0x0;writeDB(dials[_0x30f4c7['uniqueid']]);}}catch(_0x368425){utils[_0xf6ff('0x16')](util[_0xf6ff('0x3')](_0xf6ff('0x29'),_0x30f4c7['uniqueid']),_0x368425);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index f29ea94..ce11898 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 _0xabff=['newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','[%s][index][dialend]','dialend','../../config/environment','./utils','util','port','asterisk','password','keepConnected','xdr','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','device','format','agentcalled','uniqueid','[%s][index][agentcalled]','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','cdr','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]'];(function(_0xb487c6,_0x3bbbc1){var _0x17773d=function(_0x5a4b13){while(--_0x5a4b13){_0xb487c6['push'](_0xb487c6['shift']());}};_0x17773d(++_0x3bbbc1);}(_0xabff,0x109));var _0xfabf=function(_0x39187b,_0x2a6214){_0x39187b=_0x39187b-0x0;var _0x2cf25f=_0xabff[_0x39187b];return _0x2cf25f;};var AsteriskManager=require('asterisk-manager');var config=require(_0xfabf('0x0'));var utils=require(_0xfabf('0x1'));var util=require(_0xfabf('0x2'));var ami=new AsteriskManager(config['asterisk'][_0xfabf('0x3')],config[_0xfabf('0x4')]['ip'],config[_0xfabf('0x4')]['username'],config[_0xfabf('0x4')][_0xfabf('0x5')],!![]);ami[_0xfabf('0x6')]();if(config[_0xfabf('0x7')]&&config[_0xfabf('0x7')]['disabled']){utils['info']('XDR\x20DISABLED');}else{var agents=require(_0xfabf('0x8'));var calls=require(_0xfabf('0x9'));var queues=require(_0xfabf('0xa'));var recordings=require(_0xfabf('0xb'));var members=require(_0xfabf('0xc'));var dials=require('./dials.controller');var transfers=require(_0xfabf('0xd'));var core=require('./core.controller');ami['on'](_0xfabf('0xe'),core[_0xfabf('0xe')]);ami['on'](_0xfabf('0xf'),core['shutdown']);ami['on']('fullybooted',core[_0xfabf('0x10')]);ami['on'](_0xfabf('0x11'),core[_0xfabf('0x11')]);ami['on'](_0xfabf('0x12'),core['close']);ami['on'](_0xfabf('0x13'),core[_0xfabf('0x13')]);ami['on'](_0xfabf('0x14'),function(_0xce36ae){try{utils[_0xfabf('0x15')](util['format'](_0xfabf('0x16'),_0xce36ae[_0xfabf('0x17')]),_0xce36ae);members[_0xfabf('0x14')](_0xce36ae);}catch(_0x22ef2b){utils[_0xfabf('0x11')](util[_0xfabf('0x18')](_0xfabf('0x16'),_0xce36ae[_0xfabf('0x17')]),_0x22ef2b);}});ami['on'](_0xfabf('0x19'),function(_0xc4ae0f){try{utils[_0xfabf('0x15')](util[_0xfabf('0x18')]('[%s][index][agentcalled]',_0xc4ae0f[_0xfabf('0x1a')]),_0xc4ae0f);agents['agentcalled'](_0xc4ae0f);}catch(_0x5906f9){utils[_0xfabf('0x11')](util['format'](_0xfabf('0x1b'),_0xc4ae0f[_0xfabf('0x1a')]),_0x5906f9);}});ami['on']('agentringnoanswer',function(_0x439efa){try{utils[_0xfabf('0x15')](util[_0xfabf('0x18')](_0xfabf('0x1c'),_0x439efa[_0xfabf('0x1a')]),_0x439efa);agents[_0xfabf('0x1d')](_0x439efa);}catch(_0x370dc2){utils[_0xfabf('0x11')](util[_0xfabf('0x18')](_0xfabf('0x1c'),_0x439efa[_0xfabf('0x1a')]),_0x370dc2);}});ami['on'](_0xfabf('0x1e'),function(_0x5abaa0){try{utils['debug'](util[_0xfabf('0x18')](_0xfabf('0x1f'),_0x5abaa0[_0xfabf('0x1a')]),_0x5abaa0);agents['agentconnect'](_0x5abaa0);queues[_0xfabf('0x1e')](_0x5abaa0);}catch(_0x19fe72){utils[_0xfabf('0x11')](util[_0xfabf('0x18')](_0xfabf('0x1f'),_0x5abaa0[_0xfabf('0x1a')]),_0x19fe72);}});ami['on'](_0xfabf('0x20'),function(_0x518ed1){try{utils[_0xfabf('0x15')](util[_0xfabf('0x18')]('[%s][index][agentcomplete]',_0x518ed1[_0xfabf('0x1a')]),_0x518ed1);agents[_0xfabf('0x20')](_0x518ed1);queues[_0xfabf('0x20')](_0x518ed1);members[_0xfabf('0x20')](_0x518ed1);}catch(_0x2047a2){utils[_0xfabf('0x11')](util[_0xfabf('0x18')](_0xfabf('0x21'),_0x518ed1[_0xfabf('0x1a')]),_0x2047a2);}});ami['on']('queuecallerabandon',function(_0x6545d6){try{utils[_0xfabf('0x15')](util[_0xfabf('0x18')](_0xfabf('0x22'),_0x6545d6[_0xfabf('0x1a')]),_0x6545d6);agents[_0xfabf('0x23')](_0x6545d6);queues[_0xfabf('0x23')](_0x6545d6);}catch(_0x30d2b1){utils[_0xfabf('0x11')](util['format'](_0xfabf('0x22'),_0x6545d6[_0xfabf('0x1a')]),_0x30d2b1);}});ami['on']('queuecallerjoin',function(_0x4f0f10){try{utils[_0xfabf('0x15')](util[_0xfabf('0x18')]('[%s][index][queuecallerjoin]',_0x4f0f10[_0xfabf('0x1a')]),_0x4f0f10);queues[_0xfabf('0x24')](_0x4f0f10);recordings['queuecallerjoin'](_0x4f0f10);}catch(_0x1e4cf1){utils[_0xfabf('0x11')](util[_0xfabf('0x18')]('[%s][index][queuecallerjoin]',_0x4f0f10['uniqueid']),_0x1e4cf1);}});ami['on'](_0xfabf('0x25'),function(_0x521665){try{utils[_0xfabf('0x15')](util[_0xfabf('0x18')]('[%s][index][queuecallerleave]',_0x521665[_0xfabf('0x1a')]),_0x521665);queues[_0xfabf('0x25')](_0x521665);}catch(_0x30cef7){utils[_0xfabf('0x11')](util['format'](_0xfabf('0x26'),_0x521665[_0xfabf('0x1a')]),_0x30cef7);}});ami['on']('musiconholdstart',function(_0x3f42f2){try{utils[_0xfabf('0x15')](util[_0xfabf('0x18')](_0xfabf('0x27'),_0x3f42f2[_0xfabf('0x1a')]),_0x3f42f2);queues['musiconholdstart'](_0x3f42f2);calls[_0xfabf('0x28')](_0x3f42f2);}catch(_0x43ee6a){utils[_0xfabf('0x11')](util[_0xfabf('0x18')](_0xfabf('0x27'),_0x3f42f2['uniqueid']),_0x43ee6a);}});ami['on'](_0xfabf('0x29'),function(_0x2dcf40){try{utils[_0xfabf('0x15')](util[_0xfabf('0x18')](_0xfabf('0x2a'),_0x2dcf40[_0xfabf('0x1a')]),_0x2dcf40);queues[_0xfabf('0x29')](_0x2dcf40);calls['musiconholdstop'](_0x2dcf40);}catch(_0x34ccea){utils[_0xfabf('0x11')](util[_0xfabf('0x18')](_0xfabf('0x2a'),_0x2dcf40[_0xfabf('0x1a')]),_0x34ccea);}});ami['on'](_0xfabf('0x2b'),function(_0x56af62){try{utils['debug'](util[_0xfabf('0x18')](_0xfabf('0x2c'),_0x56af62['uniqueid']),_0x56af62);calls[_0xfabf('0x2b')](_0x56af62);recordings[_0xfabf('0x2b')](_0x56af62);}catch(_0x40cdc5){utils[_0xfabf('0x11')](util['format']('[%s][index][newstate]',_0x56af62[_0xfabf('0x1a')]),_0x40cdc5);}});ami['on']('hangup',function(_0x3cb330){try{utils[_0xfabf('0x15')](util[_0xfabf('0x18')](_0xfabf('0x2d'),_0x3cb330['uniqueid']),_0x3cb330);calls['hangup'](_0x3cb330);recordings[_0xfabf('0x2e')](_0x3cb330);dials[_0xfabf('0x2e')](_0x3cb330);agents[_0xfabf('0x2e')](_0x3cb330);queues['hangup'](_0x3cb330);}catch(_0x1f261a){utils[_0xfabf('0x11')](util['format'](_0xfabf('0x2d'),_0x3cb330['uniqueid']),_0x1f261a);}});ami['on'](_0xfabf('0x2f'),function(_0x3a470c){try{utils[_0xfabf('0x15')](util['format']('[%s][index][cdr]',_0x3a470c['uniqueid']),_0x3a470c);members[_0xfabf('0x2f')](_0x3a470c);}catch(_0x31ea3e){utils['error'](util[_0xfabf('0x18')]('[%s][index][cdr]',_0x3a470c[_0xfabf('0x1a')]),_0x31ea3e);}});ami['on'](_0xfabf('0x30'),function(_0x9ce428){try{utils[_0xfabf('0x15')](util[_0xfabf('0x18')](_0xfabf('0x31'),_0x9ce428[_0xfabf('0x1a')]),_0x9ce428);queues['blindtransfer'](_0x9ce428);agents[_0xfabf('0x30')](_0x9ce428);transfers[_0xfabf('0x30')](_0x9ce428);recordings[_0xfabf('0x30')](_0x9ce428);}catch(_0x58400a){utils[_0xfabf('0x11')](util['format'](_0xfabf('0x31'),_0x9ce428[_0xfabf('0x1a')]),_0x58400a);}});ami['on'](_0xfabf('0x32'),function(_0x3a2cb3){try{utils[_0xfabf('0x15')](util[_0xfabf('0x18')](_0xfabf('0x33'),_0x3a2cb3[_0xfabf('0x34')]),_0x3a2cb3);queues['attendedtransfer'](_0x3a2cb3);transfers[_0xfabf('0x32')](_0x3a2cb3);agents[_0xfabf('0x32')](_0x3a2cb3);calls[_0xfabf('0x32')](_0x3a2cb3);}catch(_0x267ff6){utils[_0xfabf('0x11')](util['format'](_0xfabf('0x33'),_0x3a2cb3[_0xfabf('0x34')]),_0x267ff6);}});ami['on'](_0xfabf('0x35'),function(_0x5e892b){try{utils[_0xfabf('0x15')](util['format'](_0xfabf('0x36'),_0x5e892b[_0xfabf('0x1a')]),_0x5e892b);queues['varset'](_0x5e892b);recordings['varset'](_0x5e892b);calls[_0xfabf('0x35')](_0x5e892b);dials[_0xfabf('0x35')](_0x5e892b);}catch(_0x2bdc12){utils[_0xfabf('0x11')](util[_0xfabf('0x18')](_0xfabf('0x36'),_0x5e892b[_0xfabf('0x1a')]),_0x2bdc12);}});ami['on'](_0xfabf('0x37'),function(_0xa478b1){try{utils[_0xfabf('0x15')](util['format'](_0xfabf('0x38'),_0xa478b1[_0xfabf('0x1a')]),_0xa478b1);calls[_0xfabf('0x37')](_0xa478b1);recordings['newexten'](_0xa478b1);dials[_0xfabf('0x37')](_0xa478b1);}catch(_0x30923f){utils['error'](util[_0xfabf('0x18')](_0xfabf('0x38'),_0xa478b1[_0xfabf('0x1a')]),_0x30923f);}});ami['on'](_0xfabf('0x39'),function(_0x19c439){try{utils['debug'](util[_0xfabf('0x18')]('[%s][index][newchannel]',_0x19c439[_0xfabf('0x1a')]),_0x19c439);calls['newchannel'](_0x19c439);recordings[_0xfabf('0x39')](_0x19c439);}catch(_0x1b5e26){utils[_0xfabf('0x11')](util[_0xfabf('0x18')](_0xfabf('0x3a'),_0x19c439['uniqueid']),_0x1b5e26);}});ami['on'](_0xfabf('0x3b'),function(_0x203a00){try{utils[_0xfabf('0x15')](util['format'](_0xfabf('0x3c'),_0x203a00['uniqueid']),_0x203a00);dials['dialbegin'](_0x203a00);}catch(_0x4a44bc){utils[_0xfabf('0x11')](util[_0xfabf('0x18')](_0xfabf('0x3d'),_0x203a00[_0xfabf('0x1a')]),_0x4a44bc);}});ami['on']('dialend',function(_0x5da545){try{utils[_0xfabf('0x15')](util['format'](_0xfabf('0x3e'),_0x5da545['uniqueid']),_0x5da545);dials[_0xfabf('0x3f')](_0x5da545);}catch(_0x5a263f){utils[_0xfabf('0x11')](util[_0xfabf('0x18')](_0xfabf('0x3e'),_0x5da545['uniqueid']),_0x5a263f);}});} \ No newline at end of file +var _0x5279=['[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','[%s][index][dialend]','dialend','asterisk-manager','../../config/environment','./utils','util','asterisk','port','username','xdr','disabled','info','XDR\x20DISABLED','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon'];(function(_0x1deab1,_0x3ca2f0){var _0x30822d=function(_0x54b01b){while(--_0x54b01b){_0x1deab1['push'](_0x1deab1['shift']());}};_0x30822d(++_0x3ca2f0);}(_0x5279,0x12a));var _0x9527=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x5279[_0x3635ce];return _0x97ecd0;};var AsteriskManager=require(_0x9527('0x0'));var config=require(_0x9527('0x1'));var utils=require(_0x9527('0x2'));var util=require(_0x9527('0x3'));var ami=new AsteriskManager(config[_0x9527('0x4')][_0x9527('0x5')],config['asterisk']['ip'],config[_0x9527('0x4')][_0x9527('0x6')],config[_0x9527('0x4')]['password'],!![]);ami['keepConnected']();if(config[_0x9527('0x7')]&&config['xdr'][_0x9527('0x8')]){utils[_0x9527('0x9')](_0x9527('0xa'));}else{var agents=require('./agents.controller');var calls=require(_0x9527('0xb'));var queues=require('./queues.controller');var recordings=require(_0x9527('0xc'));var members=require(_0x9527('0xd'));var dials=require(_0x9527('0xe'));var transfers=require(_0x9527('0xf'));var core=require('./core.controller');ami['on'](_0x9527('0x10'),core['connect']);ami['on'](_0x9527('0x11'),core[_0x9527('0x11')]);ami['on'](_0x9527('0x12'),core['fullybooted']);ami['on'](_0x9527('0x13'),core['error']);ami['on'](_0x9527('0x14'),core[_0x9527('0x14')]);ami['on'](_0x9527('0x15'),core[_0x9527('0x15')]);ami['on'](_0x9527('0x16'),function(_0x44b03b){try{utils[_0x9527('0x17')](util[_0x9527('0x18')](_0x9527('0x19'),_0x44b03b['device']),_0x44b03b);members[_0x9527('0x16')](_0x44b03b);}catch(_0x4a1049){utils[_0x9527('0x13')](util['format']('[%s][index][devicestatechange]',_0x44b03b[_0x9527('0x1a')]),_0x4a1049);}});ami['on'](_0x9527('0x1b'),function(_0x49240a){try{utils[_0x9527('0x17')](util[_0x9527('0x18')](_0x9527('0x1c'),_0x49240a['uniqueid']),_0x49240a);agents['agentcalled'](_0x49240a);}catch(_0x17e8e1){utils[_0x9527('0x13')](util['format'](_0x9527('0x1c'),_0x49240a[_0x9527('0x1d')]),_0x17e8e1);}});ami['on']('agentringnoanswer',function(_0x59a59){try{utils['debug'](util['format'](_0x9527('0x1e'),_0x59a59['uniqueid']),_0x59a59);agents[_0x9527('0x1f')](_0x59a59);}catch(_0x107e1b){utils[_0x9527('0x13')](util[_0x9527('0x18')](_0x9527('0x1e'),_0x59a59['uniqueid']),_0x107e1b);}});ami['on'](_0x9527('0x20'),function(_0x1a2eed){try{utils[_0x9527('0x17')](util[_0x9527('0x18')]('[%s][index][agentconnect]',_0x1a2eed[_0x9527('0x1d')]),_0x1a2eed);agents[_0x9527('0x20')](_0x1a2eed);queues[_0x9527('0x20')](_0x1a2eed);}catch(_0x3c577a){utils[_0x9527('0x13')](util[_0x9527('0x18')](_0x9527('0x21'),_0x1a2eed['uniqueid']),_0x3c577a);}});ami['on'](_0x9527('0x22'),function(_0x378317){try{utils[_0x9527('0x17')](util['format']('[%s][index][agentcomplete]',_0x378317[_0x9527('0x1d')]),_0x378317);agents[_0x9527('0x22')](_0x378317);queues[_0x9527('0x22')](_0x378317);members[_0x9527('0x22')](_0x378317);}catch(_0x307e0c){utils[_0x9527('0x13')](util[_0x9527('0x18')](_0x9527('0x23'),_0x378317[_0x9527('0x1d')]),_0x307e0c);}});ami['on'](_0x9527('0x24'),function(_0x18a306){try{utils[_0x9527('0x17')](util[_0x9527('0x18')](_0x9527('0x25'),_0x18a306[_0x9527('0x1d')]),_0x18a306);agents['queuecallerabandon'](_0x18a306);queues[_0x9527('0x24')](_0x18a306);}catch(_0x599331){utils[_0x9527('0x13')](util[_0x9527('0x18')]('[%s][index][queuecallerabandon]',_0x18a306[_0x9527('0x1d')]),_0x599331);}});ami['on'](_0x9527('0x26'),function(_0x324f82){try{utils[_0x9527('0x17')](util[_0x9527('0x18')](_0x9527('0x27'),_0x324f82['uniqueid']),_0x324f82);queues[_0x9527('0x26')](_0x324f82);recordings[_0x9527('0x26')](_0x324f82);}catch(_0x2dece7){utils[_0x9527('0x13')](util[_0x9527('0x18')](_0x9527('0x27'),_0x324f82[_0x9527('0x1d')]),_0x2dece7);}});ami['on'](_0x9527('0x28'),function(_0x3573e9){try{utils[_0x9527('0x17')](util[_0x9527('0x18')](_0x9527('0x29'),_0x3573e9[_0x9527('0x1d')]),_0x3573e9);queues[_0x9527('0x28')](_0x3573e9);}catch(_0x4fbdc3){utils['error'](util[_0x9527('0x18')](_0x9527('0x29'),_0x3573e9[_0x9527('0x1d')]),_0x4fbdc3);}});ami['on'](_0x9527('0x2a'),function(_0x59c897){try{utils[_0x9527('0x17')](util[_0x9527('0x18')](_0x9527('0x2b'),_0x59c897[_0x9527('0x1d')]),_0x59c897);queues[_0x9527('0x2a')](_0x59c897);calls[_0x9527('0x2a')](_0x59c897);}catch(_0x5adb07){utils['error'](util[_0x9527('0x18')](_0x9527('0x2b'),_0x59c897[_0x9527('0x1d')]),_0x5adb07);}});ami['on'](_0x9527('0x2c'),function(_0x2c86e5){try{utils['debug'](util[_0x9527('0x18')](_0x9527('0x2d'),_0x2c86e5[_0x9527('0x1d')]),_0x2c86e5);queues['musiconholdstop'](_0x2c86e5);calls[_0x9527('0x2c')](_0x2c86e5);}catch(_0x2f5d8f){utils[_0x9527('0x13')](util[_0x9527('0x18')](_0x9527('0x2d'),_0x2c86e5[_0x9527('0x1d')]),_0x2f5d8f);}});ami['on']('newstate',function(_0x549e92){try{utils[_0x9527('0x17')](util[_0x9527('0x18')]('[%s][index][newstate]',_0x549e92[_0x9527('0x1d')]),_0x549e92);calls['newstate'](_0x549e92);recordings[_0x9527('0x2e')](_0x549e92);}catch(_0x4f3ee2){utils[_0x9527('0x13')](util['format']('[%s][index][newstate]',_0x549e92[_0x9527('0x1d')]),_0x4f3ee2);}});ami['on'](_0x9527('0x2f'),function(_0x480fdf){try{utils[_0x9527('0x17')](util['format'](_0x9527('0x30'),_0x480fdf['uniqueid']),_0x480fdf);calls[_0x9527('0x2f')](_0x480fdf);recordings['hangup'](_0x480fdf);dials[_0x9527('0x2f')](_0x480fdf);agents[_0x9527('0x2f')](_0x480fdf);queues[_0x9527('0x2f')](_0x480fdf);}catch(_0x14d3dc){utils[_0x9527('0x13')](util['format']('[%s][index][hangup]',_0x480fdf['uniqueid']),_0x14d3dc);}});ami['on']('cdr',function(_0x4d52b4){try{utils[_0x9527('0x17')](util['format'](_0x9527('0x31'),_0x4d52b4[_0x9527('0x1d')]),_0x4d52b4);members[_0x9527('0x32')](_0x4d52b4);}catch(_0x534798){utils[_0x9527('0x13')](util[_0x9527('0x18')](_0x9527('0x31'),_0x4d52b4[_0x9527('0x1d')]),_0x534798);}});ami['on'](_0x9527('0x33'),function(_0x2bde18){try{utils[_0x9527('0x17')](util[_0x9527('0x18')]('[%s][index][blindtransfer]',_0x2bde18[_0x9527('0x1d')]),_0x2bde18);queues['blindtransfer'](_0x2bde18);agents['blindtransfer'](_0x2bde18);transfers[_0x9527('0x33')](_0x2bde18);recordings['blindtransfer'](_0x2bde18);}catch(_0x25ebb){utils[_0x9527('0x13')](util[_0x9527('0x18')](_0x9527('0x34'),_0x2bde18[_0x9527('0x1d')]),_0x25ebb);}});ami['on'](_0x9527('0x35'),function(_0x79d572){try{utils[_0x9527('0x17')](util[_0x9527('0x18')](_0x9527('0x36'),_0x79d572[_0x9527('0x37')]),_0x79d572);queues[_0x9527('0x35')](_0x79d572);transfers[_0x9527('0x35')](_0x79d572);agents[_0x9527('0x35')](_0x79d572);calls['attendedtransfer'](_0x79d572);}catch(_0x56aba1){utils['error'](util[_0x9527('0x18')](_0x9527('0x36'),_0x79d572['origtransfereruniqueid']),_0x56aba1);}});ami['on'](_0x9527('0x38'),function(_0x21752e){try{utils[_0x9527('0x17')](util['format'](_0x9527('0x39'),_0x21752e['uniqueid']),_0x21752e);queues[_0x9527('0x38')](_0x21752e);recordings[_0x9527('0x38')](_0x21752e);calls['varset'](_0x21752e);dials[_0x9527('0x38')](_0x21752e);}catch(_0x48bfde){utils['error'](util[_0x9527('0x18')](_0x9527('0x39'),_0x21752e[_0x9527('0x1d')]),_0x48bfde);}});ami['on']('newexten',function(_0x1a93bb){try{utils['debug'](util[_0x9527('0x18')](_0x9527('0x3a'),_0x1a93bb[_0x9527('0x1d')]),_0x1a93bb);calls['newexten'](_0x1a93bb);recordings[_0x9527('0x3b')](_0x1a93bb);dials[_0x9527('0x3b')](_0x1a93bb);}catch(_0x11f24f){utils[_0x9527('0x13')](util[_0x9527('0x18')](_0x9527('0x3a'),_0x1a93bb['uniqueid']),_0x11f24f);}});ami['on'](_0x9527('0x3c'),function(_0x4a2f86){try{utils[_0x9527('0x17')](util[_0x9527('0x18')](_0x9527('0x3d'),_0x4a2f86[_0x9527('0x1d')]),_0x4a2f86);calls['newchannel'](_0x4a2f86);recordings['newchannel'](_0x4a2f86);}catch(_0xc0cd7f){utils['error'](util['format'](_0x9527('0x3d'),_0x4a2f86[_0x9527('0x1d')]),_0xc0cd7f);}});ami['on'](_0x9527('0x3e'),function(_0xebcfed){try{utils['debug'](util[_0x9527('0x18')](_0x9527('0x3f'),_0xebcfed['uniqueid']),_0xebcfed);dials['dialbegin'](_0xebcfed);}catch(_0x4b8bc7){utils[_0x9527('0x13')](util[_0x9527('0x18')](_0x9527('0x40'),_0xebcfed['uniqueid']),_0x4b8bc7);}});ami['on']('dialend',function(_0x36ec5c){try{utils[_0x9527('0x17')](util[_0x9527('0x18')](_0x9527('0x41'),_0x36ec5c[_0x9527('0x1d')]),_0x36ec5c);dials[_0x9527('0x42')](_0x36ec5c);}catch(_0x361572){utils[_0x9527('0x13')](util[_0x9527('0x18')](_0x9527('0x41'),_0x36ec5c['uniqueid']),_0x361572);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 35d7be2..0ea3347 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 _0x3e0b=['CreateMemberReport','getUserByName','split','then','request','catch','error','uniqueid','some','devicestatechange','debug','[%s][members][devicestatechange]','device','state','BUSY','voice','now','agent','NOT_INUSE','isNil','exitAt','duration','agentcomplete','queue','assign','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','channel','data2','membername','type','interface','name','internal'];(function(_0x5de69c,_0x2da278){var _0x34d105=function(_0x3974ad){while(--_0x3974ad){_0x5de69c['push'](_0x5de69c['shift']());}};_0x34d105(++_0x2da278);}(_0x3e0b,0x1db));var _0xb3e0=function(_0x4e2a0d,_0x4080eb){_0x4e2a0d=_0x4e2a0d-0x0;var _0x5a785e=_0x3e0b[_0x4e2a0d];return _0x5a785e;};'use strict';var _=require(_0xb3e0('0x0'));var util=require(_0xb3e0('0x1'));var utils=require(_0xb3e0('0x2'));var members={};var exclude=[_0xb3e0('0x3'),_0xb3e0('0x4')];function writeDB(_0x229d34){utils[_0xb3e0('0x5')](util[_0xb3e0('0x6')](_0xb3e0('0x7'),_0x229d34['uniqueid'],_0x229d34['interface'],_0x229d34[_0xb3e0('0x8')],_0x229d34[_0xb3e0('0x9')],_0x229d34[_0xb3e0('0xa')],_0x229d34[_0xb3e0('0xb')]));if(_0x229d34['interface']){utils['getUserByInterface'](_0x229d34[_0xb3e0('0xc')])['then'](function(_0x1aae38){if(_0x1aae38){_0x229d34['membername']=_0x1aae38[_0xb3e0('0xd')];_0x229d34[_0xb3e0('0xe')]=_0x1aae38[_0xb3e0('0xe')];utils['request'](_0xb3e0('0xf'),_0x229d34);}else{utils[_0xb3e0('0x10')](_0x229d34[_0xb3e0('0xc')][_0xb3e0('0x11')]('/')[0x1])[_0xb3e0('0x12')](function(_0x4e28fb){if(_0x4e28fb){_0x229d34[_0xb3e0('0xa')]=_0x4e28fb[_0xb3e0('0xd')];_0x229d34[_0xb3e0('0xe')]=_0x4e28fb['internal'];utils[_0xb3e0('0x13')](_0xb3e0('0xf'),_0x229d34);}});}})[_0xb3e0('0x14')](function(_0x1a030b){utils[_0xb3e0('0x15')](util['format']('[%s][members][writeDB]',_0x229d34[_0xb3e0('0x16')]),_0x1a030b);});}delete members[_0x229d34[_0xb3e0('0xc')]];}function startsWith(_0x10ef85,_0x4e4079){return _[_0xb3e0('0x17')](_0x10ef85,function(_0x5d56c2){return _['startsWith'](_0x4e4079,_0x5d56c2);});}exports[_0xb3e0('0x18')]=function(_0x3c605e){try{utils[_0xb3e0('0x19')](util[_0xb3e0('0x6')](_0xb3e0('0x1a'),members[_0x3c605e[_0xb3e0('0x1b')]]?members[_0x3c605e[_0xb3e0('0x1b')]][_0xb3e0('0x16')]:_0x3c605e[_0xb3e0('0x1b')]),_0x3c605e);utils[_0xb3e0('0x5')](util[_0xb3e0('0x6')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x3c605e[_0xb3e0('0x1b')]]?members[_0x3c605e[_0xb3e0('0x1b')]][_0xb3e0('0x16')]:_0x3c605e['device'],_0x3c605e[_0xb3e0('0x1c')],_0x3c605e[_0xb3e0('0x1b')]));switch(_0x3c605e[_0xb3e0('0x1c')]){case'INUSE':case _0xb3e0('0x1d'):if(!startsWith(exclude,_0x3c605e[_0xb3e0('0x1b')])){members[_0x3c605e[_0xb3e0('0x1b')]]={'channel':_0xb3e0('0x1e'),'interface':_0x3c605e[_0xb3e0('0x1b')],'type':'TALKING','enterAt':utils[_0xb3e0('0x1f')](),'role':_0xb3e0('0x20')};}break;case _0xb3e0('0x21'):if(!_[_0xb3e0('0x22')](members[_0x3c605e[_0xb3e0('0x1b')]])){members[_0x3c605e[_0xb3e0('0x1b')]][_0xb3e0('0x23')]=utils[_0xb3e0('0x1f')]();members[_0x3c605e[_0xb3e0('0x1b')]][_0xb3e0('0x24')]=utils['diffTime'](members[_0x3c605e['device']][_0xb3e0('0x23')],members[_0x3c605e[_0xb3e0('0x1b')]]['enterAt']);if(members[_0x3c605e[_0xb3e0('0x1b')]][_0xb3e0('0x16')]){writeDB(members[_0x3c605e[_0xb3e0('0x1b')]]);}}break;default:break;}}catch(_0x7398bb){utils[_0xb3e0('0x15')](util[_0xb3e0('0x6')](_0xb3e0('0x1a'),members[_0x3c605e[_0xb3e0('0x1b')]]?members[_0x3c605e['device']][_0xb3e0('0x16')]:_0x3c605e[_0xb3e0('0x1b')]),_0x7398bb);}};exports[_0xb3e0('0x25')]=function(_0x5d9556){try{if(!_[_0xb3e0('0x22')](members[_0x5d9556['interface']])){utils[_0xb3e0('0x19')](util[_0xb3e0('0x6')]('[%s][members][agentcomplete]',_0x5d9556[_0xb3e0('0x16')]),_0x5d9556);utils['info'](util['format']('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x5d9556[_0xb3e0('0x16')],_0x5d9556[_0xb3e0('0xc')],_0x5d9556[_0xb3e0('0x26')]));members[_0x5d9556[_0xb3e0('0xc')]]=_[_0xb3e0('0x27')](members[_0x5d9556[_0xb3e0('0xc')]],{'data4':_0x5d9556[_0xb3e0('0x26')],'uniqueid':_0x5d9556['uniqueid']});}}catch(_0x32d762){utils[_0xb3e0('0x15')](util[_0xb3e0('0x6')](_0xb3e0('0x28'),_0x5d9556[_0xb3e0('0x16')]),_0x32d762);}};exports[_0xb3e0('0x29')]=function(_0x5c6bc5){try{utils[_0xb3e0('0x19')](util['format'](_0xb3e0('0x2a'),_0x5c6bc5[_0xb3e0('0x16')]),_0x5c6bc5);if(_0x5c6bc5[_0xb3e0('0x8')]){var _0x2aac21=_0x5c6bc5[_0xb3e0('0x8')][_0xb3e0('0x11')]('-')[0x0];if(!_['isNil'](members[_0x2aac21])){members[_0x2aac21]=_[_0xb3e0('0x27')](members[_0x2aac21],{'data1':members[_0x2aac21][_0xb3e0('0x2b')]||_0x5c6bc5[_0xb3e0('0xb')],'data2':members[_0x2aac21][_0xb3e0('0x9')]||_0x5c6bc5[_0xb3e0('0x2c')],'data3':members[_0x2aac21][_0xb3e0('0x2d')]||_0x5c6bc5[_0xb3e0('0x2e')],'uniqueid':members[_0x2aac21][_0xb3e0('0x16')]||_0x5c6bc5['uniqueid']});utils[_0xb3e0('0x5')](util['format'](_0xb3e0('0x2f'),_0x5c6bc5['uniqueid'],members[_0x2aac21][_0xb3e0('0x2b')],members[_0x2aac21][_0xb3e0('0x9')],members[_0x2aac21][_0xb3e0('0x2d')]));if(members[_0x2aac21][_0xb3e0('0x23')]){writeDB(members[_0x2aac21]);}}}if(_0x5c6bc5['destinationchannel']){var _0xd7bedc=_0x5c6bc5[_0xb3e0('0x30')][_0xb3e0('0x11')]('-')[0x0];if(!_['isNil'](members[_0xd7bedc])){members[_0xd7bedc]=_[_0xb3e0('0x27')](members[_0xd7bedc],{'data1':members[_0xd7bedc][_0xb3e0('0x2b')]||_0x5c6bc5[_0xb3e0('0xb')],'data2':members[_0xd7bedc][_0xb3e0('0x9')]||_0x5c6bc5[_0xb3e0('0x2c')],'data3':members[_0xd7bedc]['data3']||_0x5c6bc5[_0xb3e0('0x2e')],'uniqueid':members[_0xd7bedc][_0xb3e0('0x16')]||_0x5c6bc5[_0xb3e0('0x16')]});utils['info'](util[_0xb3e0('0x6')](_0xb3e0('0x2f'),_0x5c6bc5[_0xb3e0('0x16')],members[_0xd7bedc]['data1'],members[_0xd7bedc][_0xb3e0('0x9')],members[_0xd7bedc]['data3']));if(members[_0xd7bedc][_0xb3e0('0x23')]){writeDB(members[_0xd7bedc]);}}}}catch(_0x120faf){utils['error'](util[_0xb3e0('0x6')](_0xb3e0('0x2a'),_0x5c6bc5['uniqueid']),_0x120faf);}}; \ No newline at end of file +var _0x4343=['internal','request','CreateMemberReport','getUserByName','split','catch','error','[%s][members][writeDB]','uniqueid','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','agent','NOT_INUSE','isNil','exitAt','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','data1','type','source','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','destination','lodash','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','data2','membername','getUserByInterface','then'];(function(_0x70fd53,_0x2a95a6){var _0x4b71c5=function(_0x4b349d){while(--_0x4b349d){_0x70fd53['push'](_0x70fd53['shift']());}};_0x4b71c5(++_0x2a95a6);}(_0x4343,0x158));var _0x3434=function(_0x1d7b39,_0x4774a9){_0x1d7b39=_0x1d7b39-0x0;var _0x1f8eae=_0x4343[_0x1d7b39];return _0x1f8eae;};'use strict';var _=require(_0x3434('0x0'));var util=require('util');var utils=require(_0x3434('0x1'));var members={};var exclude=[_0x3434('0x2'),_0x3434('0x3')];function writeDB(_0x388c27){utils[_0x3434('0x4')](util[_0x3434('0x5')](_0x3434('0x6'),_0x388c27['uniqueid'],_0x388c27[_0x3434('0x7')],_0x388c27[_0x3434('0x8')],_0x388c27[_0x3434('0x9')],_0x388c27[_0x3434('0xa')],_0x388c27['type']));if(_0x388c27['interface']){utils[_0x3434('0xb')](_0x388c27[_0x3434('0x7')])[_0x3434('0xc')](function(_0x5c4831){if(_0x5c4831){_0x388c27[_0x3434('0xa')]=_0x5c4831['name'];_0x388c27[_0x3434('0xd')]=_0x5c4831[_0x3434('0xd')];utils[_0x3434('0xe')](_0x3434('0xf'),_0x388c27);}else{utils[_0x3434('0x10')](_0x388c27[_0x3434('0x7')][_0x3434('0x11')]('/')[0x1])[_0x3434('0xc')](function(_0x77a12a){if(_0x77a12a){_0x388c27[_0x3434('0xa')]=_0x77a12a['name'];_0x388c27['internal']=_0x77a12a['internal'];utils['request']('CreateMemberReport',_0x388c27);}});}})[_0x3434('0x12')](function(_0x4fb023){utils[_0x3434('0x13')](util[_0x3434('0x5')](_0x3434('0x14'),_0x388c27[_0x3434('0x15')]),_0x4fb023);});}delete members[_0x388c27[_0x3434('0x7')]];}function startsWith(_0x4ff05f,_0x4b25af){return _[_0x3434('0x16')](_0x4ff05f,function(_0xc1bf70){return _[_0x3434('0x17')](_0x4b25af,_0xc1bf70);});}exports[_0x3434('0x18')]=function(_0xbc143f){try{utils[_0x3434('0x19')](util['format'](_0x3434('0x1a'),members[_0xbc143f[_0x3434('0x1b')]]?members[_0xbc143f[_0x3434('0x1b')]]['uniqueid']:_0xbc143f[_0x3434('0x1b')]),_0xbc143f);utils[_0x3434('0x4')](util[_0x3434('0x5')](_0x3434('0x1c'),members[_0xbc143f[_0x3434('0x1b')]]?members[_0xbc143f[_0x3434('0x1b')]][_0x3434('0x15')]:_0xbc143f[_0x3434('0x1b')],_0xbc143f['state'],_0xbc143f['device']));switch(_0xbc143f[_0x3434('0x1d')]){case _0x3434('0x1e'):case _0x3434('0x1f'):if(!startsWith(exclude,_0xbc143f[_0x3434('0x1b')])){members[_0xbc143f[_0x3434('0x1b')]]={'channel':_0x3434('0x20'),'interface':_0xbc143f[_0x3434('0x1b')],'type':_0x3434('0x21'),'enterAt':utils['now'](),'role':_0x3434('0x22')};}break;case _0x3434('0x23'):if(!_[_0x3434('0x24')](members[_0xbc143f['device']])){members[_0xbc143f[_0x3434('0x1b')]][_0x3434('0x25')]=utils['now']();members[_0xbc143f[_0x3434('0x1b')]]['duration']=utils['diffTime'](members[_0xbc143f[_0x3434('0x1b')]][_0x3434('0x25')],members[_0xbc143f[_0x3434('0x1b')]]['enterAt']);if(members[_0xbc143f[_0x3434('0x1b')]][_0x3434('0x15')]){writeDB(members[_0xbc143f[_0x3434('0x1b')]]);}}break;default:break;}}catch(_0x2b40d3){utils[_0x3434('0x13')](util[_0x3434('0x5')](_0x3434('0x1a'),members[_0xbc143f[_0x3434('0x1b')]]?members[_0xbc143f[_0x3434('0x1b')]][_0x3434('0x15')]:_0xbc143f['device']),_0x2b40d3);}};exports['agentcomplete']=function(_0x23e537){try{if(!_[_0x3434('0x24')](members[_0x23e537[_0x3434('0x7')]])){utils[_0x3434('0x19')](util[_0x3434('0x5')](_0x3434('0x26'),_0x23e537[_0x3434('0x15')]),_0x23e537);utils[_0x3434('0x4')](util[_0x3434('0x5')](_0x3434('0x27'),_0x23e537['uniqueid'],_0x23e537['interface'],_0x23e537[_0x3434('0x28')]));members[_0x23e537['interface']]=_[_0x3434('0x29')](members[_0x23e537['interface']],{'data4':_0x23e537[_0x3434('0x28')],'uniqueid':_0x23e537[_0x3434('0x15')]});}}catch(_0x32c3ec){utils['error'](util[_0x3434('0x5')](_0x3434('0x26'),_0x23e537[_0x3434('0x15')]),_0x32c3ec);}};exports[_0x3434('0x2a')]=function(_0x230c49){try{utils[_0x3434('0x19')](util[_0x3434('0x5')](_0x3434('0x2b'),_0x230c49[_0x3434('0x15')]),_0x230c49);if(_0x230c49[_0x3434('0x8')]){var _0x9e48fc=_0x230c49[_0x3434('0x8')][_0x3434('0x11')]('-')[0x0];if(!_[_0x3434('0x24')](members[_0x9e48fc])){members[_0x9e48fc]=_[_0x3434('0x29')](members[_0x9e48fc],{'data1':members[_0x9e48fc][_0x3434('0x2c')]||_0x230c49[_0x3434('0x2d')],'data2':members[_0x9e48fc][_0x3434('0x9')]||_0x230c49[_0x3434('0x2e')],'data3':members[_0x9e48fc]['data3']||_0x230c49['destination'],'uniqueid':members[_0x9e48fc]['uniqueid']||_0x230c49['uniqueid']});utils['info'](util[_0x3434('0x5')](_0x3434('0x2f'),_0x230c49[_0x3434('0x15')],members[_0x9e48fc][_0x3434('0x2c')],members[_0x9e48fc][_0x3434('0x9')],members[_0x9e48fc][_0x3434('0x30')]));if(members[_0x9e48fc][_0x3434('0x25')]){writeDB(members[_0x9e48fc]);}}}if(_0x230c49[_0x3434('0x31')]){var _0x4e257f=_0x230c49['destinationchannel'][_0x3434('0x11')]('-')[0x0];if(!_[_0x3434('0x24')](members[_0x4e257f])){members[_0x4e257f]=_[_0x3434('0x29')](members[_0x4e257f],{'data1':members[_0x4e257f]['data1']||_0x230c49[_0x3434('0x2d')],'data2':members[_0x4e257f][_0x3434('0x9')]||_0x230c49[_0x3434('0x2e')],'data3':members[_0x4e257f][_0x3434('0x30')]||_0x230c49[_0x3434('0x32')],'uniqueid':members[_0x4e257f][_0x3434('0x15')]||_0x230c49[_0x3434('0x15')]});utils[_0x3434('0x4')](util[_0x3434('0x5')](_0x3434('0x2f'),_0x230c49['uniqueid'],members[_0x4e257f][_0x3434('0x2c')],members[_0x4e257f][_0x3434('0x9')],members[_0x4e257f][_0x3434('0x30')]));if(members[_0x4e257f][_0x3434('0x25')]){writeDB(members[_0x4e257f]);}}}}catch(_0x252e4b){utils['error'](util[_0x3434('0x5')]('[%s][members][cdr]',_0x230c49[_0x3434('0x15')]),_0x252e4b);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index a569ef6..ce50863 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 _0x5a26=['lastAssignedTo','calleridnum','queuecallerexitreason','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','error','debug','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','name','queuecallerenterreason','[%s][queues][hangup]','isNil','variable','queuestatus','CONTINUE','queuecallerabandonAt','value','toUpperCase','queueposition','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','holdtime','count','connectedlinenum','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','accountcode','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','membername','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid','ATTENDEDTRANSFER','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','diffTime','lodash','util','info','format','uniqueid','channel','queue'];(function(_0x3e451f,_0x10500d){var _0x57978f=function(_0x52f960){while(--_0x52f960){_0x3e451f['push'](_0x3e451f['shift']());}};_0x57978f(++_0x10500d);}(_0x5a26,0x175));var _0x65a2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5a26[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x65a2('0x0'));var util=require(_0x65a2('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x137f15){utils[_0x65a2('0x2')](util[_0x65a2('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x137f15[_0x65a2('0x4')],_0x137f15[_0x65a2('0x5')],_0x137f15[_0x65a2('0x6')],_0x137f15[_0x65a2('0x7')],_0x137f15[_0x65a2('0x8')],_0x137f15['accountcode'],_0x137f15[_0x65a2('0x9')]));if(_0x137f15['queue']){utils[_0x65a2('0xa')](_0x137f15[_0x65a2('0x6')])['then'](function(_0x40e6fd){if(_0x40e6fd){_0x137f15[_0x65a2('0xb')]=_0x40e6fd[_0x65a2('0xb')];}utils[_0x65a2('0xc')](_0x65a2('0xd'),_0x137f15);});}else{utils['request'](_0x65a2('0xd'),_0x137f15);}if(_0x137f15[_0x65a2('0xe')]){delete queues[_0x137f15[_0x65a2('0xe')]];}else{delete queues[_0x137f15[_0x65a2('0x4')]];}}exports[_0x65a2('0xf')]=function(_0x4d4bd7){try{utils['debug'](util[_0x65a2('0x3')](_0x65a2('0x10'),_0x4d4bd7[_0x65a2('0x4')]),_0x4d4bd7);utils[_0x65a2('0x2')](util[_0x65a2('0x3')](_0x65a2('0x11'),_0x4d4bd7[_0x65a2('0x4')],_0x4d4bd7[_0x65a2('0x6')],_0x4d4bd7[_0x65a2('0x12')]));queues[_0x4d4bd7[_0x65a2('0x4')]]=_['assign'](_0x4d4bd7,{'originalposition':_0x4d4bd7[_0x65a2('0x12')],'queuecallerjoinAt':utils[_0x65a2('0x13')](),'mohtime':0x0});}catch(_0x4c3a72){utils[_0x65a2('0x14')](util[_0x65a2('0x3')](_0x65a2('0x10'),_0x4d4bd7[_0x65a2('0x4')]),_0x4c3a72);}};exports['hangup']=function(_0x21c225){try{if(!_['isNil'](queues[_0x21c225[_0x65a2('0x4')]])){utils[_0x65a2('0x15')](util[_0x65a2('0x3')]('[%s][queues][hangup]',_0x21c225[_0x65a2('0x4')]),_0x21c225);if(queues[_0x21c225['uniqueid']][_0x65a2('0x16')]){if(!queues[_0x21c225[_0x65a2('0x4')]][_0x65a2('0x17')]&&!queues[_0x21c225[_0x65a2('0x4')]][_0x65a2('0x18')]){queues[_0x21c225['uniqueid']][_0x65a2('0x19')]=!![];queues[_0x21c225[_0x65a2('0x4')]][_0x65a2('0x1a')]=utils[_0x65a2('0x13')]();queues[_0x21c225[_0x65a2('0x4')]]['queuecallerexitreason']=_0x65a2('0x1b');}utils[_0x65a2('0x2')](util[_0x65a2('0x3')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x21c225[_0x65a2('0x4')],queues[_0x21c225[_0x65a2('0x4')]][_0x65a2('0x1c')],queues[_0x21c225[_0x65a2('0x4')]][_0x65a2('0x9')]));writeDB(queues[_0x21c225[_0x65a2('0x4')]]);}else if(queues[_0x21c225[_0x65a2('0x4')]]['transfereduniqueid']){utils['info'](util['format']('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x21c225[_0x65a2('0x4')],queues[_0x21c225[_0x65a2('0x4')]]['name'],queues[_0x21c225[_0x65a2('0x4')]][_0x65a2('0xe')]));queues[queues[_0x21c225['uniqueid']][_0x65a2('0xe')]]=queues[_0x21c225['uniqueid']];queues[queues[_0x21c225[_0x65a2('0x4')]][_0x65a2('0xe')]][_0x65a2('0x1d')]=0x2;delete queues[_0x21c225[_0x65a2('0x4')]];}}}catch(_0x5ca754){utils[_0x65a2('0x14')](util[_0x65a2('0x3')](_0x65a2('0x1e'),_0x21c225['uniqueid']),_0x5ca754);}};exports['varset']=function(_0x21f464){try{utils[_0x65a2('0x15')](util[_0x65a2('0x3')]('[%s][queues][varset]',_0x21f464[_0x65a2('0x4')]),_0x21f464);if(!_[_0x65a2('0x1f')](_0x21f464[_0x65a2('0x20')][_0x65a2('0x21')])&&_0x21f464['value']['toUpperCase']()!==_0x65a2('0x22')){if(!_[_0x65a2('0x1f')](queues[_0x21f464[_0x65a2('0x4')]])){queues[_0x21f464[_0x65a2('0x4')]][_0x65a2('0x17')]=![];queues[_0x21f464[_0x65a2('0x4')]][_0x65a2('0x23')]=null;queues[_0x21f464[_0x65a2('0x4')]][_0x65a2('0x18')]=!![];queues[_0x21f464['uniqueid']]['queuecallerexitAt']=utils[_0x65a2('0x13')]();queues[_0x21f464['uniqueid']][_0x65a2('0x9')]=_0x21f464[_0x65a2('0x24')][_0x65a2('0x25')]();utils[_0x65a2('0x2')](util[_0x65a2('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x21f464['uniqueid'],queues[_0x21f464['uniqueid']]['name'],_0x21f464['value'],queues[_0x21f464['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x21f464[_0x65a2('0x4')]]);}}else if(!_[_0x65a2('0x1f')](_0x21f464[_0x65a2('0x20')][_0x65a2('0x26')])){if(!_[_0x65a2('0x1f')](queues[_0x21f464[_0x65a2('0x4')]])&&!queues[_0x21f464[_0x65a2('0x4')]][_0x65a2('0x17')]){queues[_0x21f464['uniqueid']][_0x65a2('0x17')]=![];queues[_0x21f464[_0x65a2('0x4')]][_0x65a2('0x23')]=null;queues[_0x21f464[_0x65a2('0x4')]][_0x65a2('0x18')]=!![];queues[_0x21f464[_0x65a2('0x4')]][_0x65a2('0x27')]=utils['now']();queues[_0x21f464['uniqueid']]['queuecallerexitreason']=_0x65a2('0x28');utils['info'](util[_0x65a2('0x3')](_0x65a2('0x29'),_0x21f464[_0x65a2('0x4')],queues[_0x21f464[_0x65a2('0x4')]]['name'],_0x21f464[_0x65a2('0x24')],queues[_0x21f464['uniqueid']]['queuecallerexitreason']));}}}catch(_0x54798b){utils[_0x65a2('0x14')](util[_0x65a2('0x3')]('[%s][queues][varset]',_0x21f464['uniqueid']),_0x54798b);}};exports[_0x65a2('0x17')]=function(_0x303040){try{if(!_[_0x65a2('0x1f')](queues[_0x303040[_0x65a2('0x4')]])){utils[_0x65a2('0x15')](util['format'](_0x65a2('0x2a'),_0x303040['uniqueid']),_0x303040);queues[_0x303040['uniqueid']][_0x65a2('0x18')]=![];queues[_0x303040[_0x65a2('0x4')]][_0x65a2('0x27')]=null;queues[_0x303040['uniqueid']][_0x65a2('0x17')]=!![];queues[_0x303040['uniqueid']]['queuecallerabandonAt']=utils['now']();queues[_0x303040[_0x65a2('0x4')]][_0x65a2('0x9')]=_0x65a2('0x2b');utils[_0x65a2('0x2')](util['format'](_0x65a2('0x2c'),_0x303040[_0x65a2('0x4')],queues[_0x303040[_0x65a2('0x4')]][_0x65a2('0x1c')],queues[_0x303040['uniqueid']][_0x65a2('0x9')]));}}catch(_0x3534d4){utils[_0x65a2('0x14')](util[_0x65a2('0x3')](_0x65a2('0x2a'),_0x303040[_0x65a2('0x4')]),_0x3534d4);}};exports['queuecallerleave']=function(_0x393731){try{if(!_[_0x65a2('0x1f')](queues[_0x393731[_0x65a2('0x4')]])){utils[_0x65a2('0x15')](util[_0x65a2('0x3')](_0x65a2('0x2d'),_0x393731['uniqueid']),_0x393731);utils['info'](util[_0x65a2('0x3')](_0x65a2('0x2e'),_0x393731[_0x65a2('0x4')],queues[_0x393731[_0x65a2('0x4')]][_0x65a2('0x1c')],_0x393731['connectedlinenum'],_0x393731[_0x65a2('0x2f')]));queues[_0x393731['uniqueid']]['queuecallerleave']=!![];queues[_0x393731[_0x65a2('0x4')]]['queuecallerleaveAt']=utils[_0x65a2('0x13')]();queues[_0x393731[_0x65a2('0x4')]][_0x65a2('0x30')]=utils['diffTime'](queues[_0x393731[_0x65a2('0x4')]][_0x65a2('0x16')],queues[_0x393731[_0x65a2('0x4')]]['queuecallerjoinAt']);queues[_0x393731[_0x65a2('0x4')]][_0x65a2('0x12')]=_0x393731['position'];queues[_0x393731['uniqueid']][_0x65a2('0x31')]=_0x393731['count'];queues[_0x393731['uniqueid']][_0x65a2('0x32')]=_0x393731[_0x65a2('0x32')];queues[_0x393731['uniqueid']][_0x65a2('0x2f')]=_0x393731['connectedlinename'];}}catch(_0x1fc843){utils[_0x65a2('0x14')](util[_0x65a2('0x3')](_0x65a2('0x2d'),_0x393731[_0x65a2('0x4')]),_0x1fc843);}};exports[_0x65a2('0x33')]=function(_0x52f3ef){try{if(!_['isNil'](queues[_0x52f3ef['uniqueid']])){utils['debug'](util[_0x65a2('0x3')]('[%s][queues][agentconnect]',_0x52f3ef[_0x65a2('0x4')]),_0x52f3ef);utils[_0x65a2('0x2')](util[_0x65a2('0x3')](_0x65a2('0x34'),_0x52f3ef[_0x65a2('0x4')],queues[_0x52f3ef[_0x65a2('0x4')]]['name'],_0x52f3ef['membername'],_0x52f3ef[_0x65a2('0x35')]));queues[_0x52f3ef[_0x65a2('0x4')]]['queuecallerabandon']=![];queues[_0x52f3ef[_0x65a2('0x4')]]['queuecallerabandon']=![];queues[_0x52f3ef[_0x65a2('0x4')]][_0x65a2('0x23')]=null;queues[_0x52f3ef[_0x65a2('0x4')]]['queuecallerexit']=![];queues[_0x52f3ef[_0x65a2('0x4')]][_0x65a2('0x9')]=null;queues[_0x52f3ef[_0x65a2('0x4')]]['queuecallerexitAt']=null;queues[_0x52f3ef['uniqueid']][_0x65a2('0x36')]=!![];queues[_0x52f3ef[_0x65a2('0x4')]][_0x65a2('0x37')]=_0x52f3ef[_0x65a2('0x35')];queues[_0x52f3ef[_0x65a2('0x4')]][_0x65a2('0x7')]=_0x52f3ef['membername'];}}catch(_0x1785b5){utils['error'](util[_0x65a2('0x3')](_0x65a2('0x38'),_0x52f3ef[_0x65a2('0x4')]),_0x1785b5);}};exports[_0x65a2('0x39')]=function(_0x279b31){try{if(!_[_0x65a2('0x1f')](queues[_0x279b31[_0x65a2('0x4')]])){if(queues[_0x279b31['uniqueid']][_0x65a2('0x16')]){utils[_0x65a2('0x15')](util[_0x65a2('0x3')](_0x65a2('0x3a'),_0x279b31[_0x65a2('0x4')]),_0x279b31);queues[_0x279b31[_0x65a2('0x4')]]['queuecallerabandon']=![];queues[_0x279b31[_0x65a2('0x4')]]['queuecallerabandon']=![];queues[_0x279b31['uniqueid']]['queuecallerabandonAt']=null;queues[_0x279b31['uniqueid']][_0x65a2('0x18')]=![];queues[_0x279b31[_0x65a2('0x4')]][_0x65a2('0x27')]=null;queues[_0x279b31[_0x65a2('0x4')]]['assigned']=!![];queues[_0x279b31[_0x65a2('0x4')]][_0x65a2('0x7')]=_0x279b31['membername'];queues[_0x279b31['uniqueid']][_0x65a2('0x19')]=!![];queues[_0x279b31[_0x65a2('0x4')]][_0x65a2('0x1a')]=utils[_0x65a2('0x13')]();if(_0x279b31[_0x65a2('0x3b')]==_0x65a2('0x3c')){if(!queues[_0x279b31[_0x65a2('0x4')]]['transfer']){queues[_0x279b31[_0x65a2('0x4')]][_0x65a2('0x9')]='TRANSFER';}}else{queues[_0x279b31['uniqueid']][_0x65a2('0x9')]=_0x65a2('0x3d')+_0x279b31['reason'][_0x65a2('0x25')]();}utils['info'](util[_0x65a2('0x3')](_0x65a2('0x3e'),_0x279b31[_0x65a2('0x4')],queues[_0x279b31['uniqueid']][_0x65a2('0x1c')],_0x279b31[_0x65a2('0x3f')],queues[_0x279b31[_0x65a2('0x4')]][_0x65a2('0x9')]));writeDB(queues[_0x279b31['uniqueid']]);}}}catch(_0x236857){utils[_0x65a2('0x14')](util[_0x65a2('0x3')]('[%s][queues][agentcomplete]',_0x279b31[_0x65a2('0x4')]),_0x236857);}};exports[_0x65a2('0x40')]=function(_0x3d29a4){try{if(!_['isNil'](queues[_0x3d29a4['transfereeuniqueid']])){utils[_0x65a2('0x15')](util[_0x65a2('0x3')]('[%s][queues][blindtransfer]',_0x3d29a4[_0x65a2('0x4')]),_0x3d29a4);queues[_0x3d29a4['transfereeuniqueid']]['transfer']=!![];queues[_0x3d29a4[_0x65a2('0x41')]][_0x65a2('0x42')]=_0x65a2('0x43');queues[_0x3d29a4[_0x65a2('0x41')]][_0x65a2('0x44')]=_0x3d29a4[_0x65a2('0x45')];queues[_0x3d29a4[_0x65a2('0x41')]][_0x65a2('0x46')]=_0x3d29a4['transfereeuniqueid'];queues[_0x3d29a4[_0x65a2('0x41')]][_0x65a2('0x9')]=_0x65a2('0x47');utils['info'](util[_0x65a2('0x3')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x3d29a4['uniqueid'],queues[_0x3d29a4[_0x65a2('0x41')]][_0x65a2('0x1c')],_0x3d29a4[_0x65a2('0x41')],_0x3d29a4['extension']));}}catch(_0x35520d){utils[_0x65a2('0x14')](util[_0x65a2('0x3')]('[%s][queues][blindtransfer]',_0x3d29a4[_0x65a2('0x4')]),_0x35520d);}};exports[_0x65a2('0x48')]=function(_0x2cb0c3){try{utils['debug'](util[_0x65a2('0x3')](_0x65a2('0x49'),_0x2cb0c3[_0x65a2('0x4a')]),_0x2cb0c3);if(_0x2cb0c3[_0x65a2('0x4a')]==_0x2cb0c3[_0x65a2('0x4b')]){if(!_[_0x65a2('0x1f')](queues[_0x2cb0c3[_0x65a2('0x4c')]])){utils[_0x65a2('0x2')](util[_0x65a2('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x2cb0c3['origtransfereruniqueid'],queues[_0x2cb0c3[_0x65a2('0x4c')]][_0x65a2('0x1c')],_0x2cb0c3['origtransfererexten']));queues[_0x2cb0c3[_0x65a2('0x4c')]]['transfer']=!![];queues[_0x2cb0c3[_0x65a2('0x4c')]]['transfertype']='ATTENDED';queues[_0x2cb0c3[_0x65a2('0x4c')]][_0x65a2('0x44')]=_0x2cb0c3[_0x65a2('0x4d')];queues[_0x2cb0c3[_0x65a2('0x4c')]]['transferuniqueid']=_0x2cb0c3[_0x65a2('0x4a')];queues[_0x2cb0c3[_0x65a2('0x4c')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0x65a2('0x1f')](queues[_0x2cb0c3[_0x65a2('0x4b')]])){if(_0x2cb0c3[_0x65a2('0x4e')]&&queues[_0x2cb0c3['transfereelinkedid']]){queues[_0x2cb0c3[_0x65a2('0x4e')]][_0x65a2('0x1d')]=0x1;queues[_0x2cb0c3[_0x65a2('0x41')]]=_[_0x65a2('0x4f')](queues[_0x2cb0c3[_0x65a2('0x4e')]]);queues[_0x2cb0c3[_0x65a2('0x41')]][_0x65a2('0xe')]=_0x2cb0c3[_0x65a2('0x50')];queues[_0x2cb0c3[_0x65a2('0x41')]][_0x65a2('0x1d')]=0x2;queues[_0x2cb0c3[_0x65a2('0x41')]][_0x65a2('0x8')]=queues[_0x2cb0c3[_0x65a2('0x4c')]][_0x65a2('0x8')];queues[_0x2cb0c3['transfereeuniqueid']][_0x65a2('0x51')]=queues[_0x2cb0c3[_0x65a2('0x4c')]][_0x65a2('0x51')];queues[_0x2cb0c3[_0x65a2('0x41')]]['queuecallerjoinAt']=utils['now']();queues[_0x2cb0c3[_0x65a2('0x41')]][_0x65a2('0x16')]=utils[_0x65a2('0x13')]();queues[_0x2cb0c3[_0x65a2('0x41')]]['holdtime']=0x0;queues[_0x2cb0c3[_0x65a2('0x41')]][_0x65a2('0x52')]=0x0;utils[_0x65a2('0x2')](util[_0x65a2('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x2cb0c3['origtransfereruniqueid'],queues[_0x2cb0c3['transfereeuniqueid']][_0x65a2('0x1c')],queues[_0x2cb0c3[_0x65a2('0x41')]][_0x65a2('0x8')],queues[_0x2cb0c3[_0x65a2('0x41')]]['calleridname']));}else{utils[_0x65a2('0x2')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x2cb0c3[_0x65a2('0x4a')],queues[_0x2cb0c3[_0x65a2('0x4b')]][_0x65a2('0x1c')],_0x2cb0c3[_0x65a2('0x4c')]));queues[_0x2cb0c3[_0x65a2('0x4b')]]['transfereduniqueid']=_0x2cb0c3[_0x65a2('0x4c')];}}}else if(_0x2cb0c3['secondtransfereruniqueid']==_0x2cb0c3[_0x65a2('0x4c')]){if(!_[_0x65a2('0x1f')](queues[_0x2cb0c3[_0x65a2('0x4b')]])){utils[_0x65a2('0x2')](util[_0x65a2('0x3')](_0x65a2('0x53'),_0x2cb0c3[_0x65a2('0x4a')],queues[_0x2cb0c3[_0x65a2('0x4b')]][_0x65a2('0x1c')],_0x2cb0c3[_0x65a2('0x54')],_0x2cb0c3['secondtransfererexten']));queues[_0x2cb0c3[_0x65a2('0x4b')]]['transfer']=!![];queues[_0x2cb0c3[_0x65a2('0x4b')]][_0x65a2('0x42')]='ATTENDED';queues[_0x2cb0c3[_0x65a2('0x4b')]]['transferexten']=_0x2cb0c3['secondtransfererexten'];queues[_0x2cb0c3[_0x65a2('0x4b')]][_0x65a2('0x46')]=_0x2cb0c3[_0x65a2('0x54')];queues[_0x2cb0c3['origtransfererlinkedid']][_0x65a2('0x9')]=_0x65a2('0x55');}if(!_[_0x65a2('0x1f')](queues[_0x2cb0c3[_0x65a2('0x4c')]])){if(_0x2cb0c3[_0x65a2('0x56')]&&queues[_0x2cb0c3[_0x65a2('0x56')]]){queues[_0x2cb0c3[_0x65a2('0x56')]]['queuecallerenterreason']=0x1;queues[_0x2cb0c3[_0x65a2('0x50')]]=_[_0x65a2('0x4f')](queues[_0x2cb0c3[_0x65a2('0x56')]]);queues[_0x2cb0c3[_0x65a2('0x50')]][_0x65a2('0xe')]=_0x2cb0c3[_0x65a2('0x50')];queues[_0x2cb0c3[_0x65a2('0x50')]][_0x65a2('0x1d')]=0x2;queues[_0x2cb0c3['transfertargetuniqueid']][_0x65a2('0x8')]=queues[_0x2cb0c3[_0x65a2('0x4b')]]['calleridnum'];queues[_0x2cb0c3['transfertargetuniqueid']][_0x65a2('0x51')]=queues[_0x2cb0c3['origtransfererlinkedid']][_0x65a2('0x51')];queues[_0x2cb0c3['transfertargetuniqueid']]['queuecallerjoinAt']=utils[_0x65a2('0x13')]();queues[_0x2cb0c3[_0x65a2('0x50')]][_0x65a2('0x16')]=utils[_0x65a2('0x13')]();queues[_0x2cb0c3[_0x65a2('0x50')]][_0x65a2('0x30')]=0x0;queues[_0x2cb0c3['transfertargetuniqueid']][_0x65a2('0x52')]=0x0;utils[_0x65a2('0x2')](util[_0x65a2('0x3')](_0x65a2('0x57'),_0x2cb0c3[_0x65a2('0x4a')],queues[_0x2cb0c3[_0x65a2('0x50')]][_0x65a2('0x1c')],queues[_0x2cb0c3['transfertargetuniqueid']][_0x65a2('0xe')],queues[_0x2cb0c3[_0x65a2('0x50')]][_0x65a2('0x8')],queues[_0x2cb0c3[_0x65a2('0x50')]]['calleridname']));}else{utils[_0x65a2('0x2')](util[_0x65a2('0x3')](_0x65a2('0x58'),_0x2cb0c3[_0x65a2('0x4a')],queues[_0x2cb0c3[_0x65a2('0x4c')]][_0x65a2('0x1c')],_0x2cb0c3[_0x65a2('0x4b')]));queues[_0x2cb0c3[_0x65a2('0x4c')]][_0x65a2('0xe')]=_0x2cb0c3[_0x65a2('0x4b')];}}}}catch(_0x8f944f){utils[_0x65a2('0x14')](util['format'](_0x65a2('0x49'),_0x2cb0c3['origtransfereruniqueid']),_0x8f944f);}};exports['musiconholdstart']=function(_0x48b63c){try{if(!_[_0x65a2('0x1f')](queues[_0x48b63c['uniqueid']])){utils[_0x65a2('0x15')](util[_0x65a2('0x3')](_0x65a2('0x59'),_0x48b63c[_0x65a2('0x4')]),_0x48b63c);queues[_0x48b63c[_0x65a2('0x4')]]['musiconholdstartAt']=utils[_0x65a2('0x13')]();utils[_0x65a2('0x2')](util['format'](_0x65a2('0x5a'),_0x48b63c['uniqueid'],queues[_0x48b63c['uniqueid']][_0x65a2('0x1c')],queues[_0x48b63c[_0x65a2('0x4')]][_0x65a2('0x5b')]));}}catch(_0x89baa3){utils[_0x65a2('0x14')](util[_0x65a2('0x3')](_0x65a2('0x59'),_0x48b63c[_0x65a2('0x4')]),_0x89baa3);}};exports[_0x65a2('0x5c')]=function(_0x22e84a){try{if(!_[_0x65a2('0x1f')](queues[_0x22e84a[_0x65a2('0x4')]])){if(!_[_0x65a2('0x1f')](queues[_0x22e84a[_0x65a2('0x4')]][_0x65a2('0x5b')])){utils[_0x65a2('0x15')](util[_0x65a2('0x3')](_0x65a2('0x5d'),_0x22e84a[_0x65a2('0x4')]),_0x22e84a);queues[_0x22e84a[_0x65a2('0x4')]][_0x65a2('0x52')]+=utils[_0x65a2('0x5e')](utils[_0x65a2('0x13')](),queues[_0x22e84a[_0x65a2('0x4')]][_0x65a2('0x5b')]);utils[_0x65a2('0x2')](util[_0x65a2('0x3')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x22e84a['uniqueid'],queues[_0x22e84a[_0x65a2('0x4')]][_0x65a2('0x1c')],queues[_0x22e84a[_0x65a2('0x4')]][_0x65a2('0x52')]));delete queues[_0x22e84a[_0x65a2('0x4')]]['musiconholdstartAt'];}}}catch(_0x2baf5){utils[_0x65a2('0x14')](util[_0x65a2('0x3')](_0x65a2('0x5d'),_0x22e84a[_0x65a2('0x4')]),_0x2baf5);}}; \ No newline at end of file +var _0x0e00=['secondtransfererexten','transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','./utils','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','[%s][queues][queuecallerjoin]','info','queue','position','assign','now','format','hangup','isNil','queuecallerleaveAt','queuecallerexit','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','[%s][queues][hangup]','varset','queuestatus','value','toUpperCase','CONTINUE','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandon','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','[%s][queues][queuecallerabandon]','queuecallerabandonAt','error','queuecallerleave','[%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','membername','assigned','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','transfer','TRANSFER','reason','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','extension','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfereruniqueid','origtransfererexten','ATTENDED','transferexten','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','queuecallerenterreason','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x0e00,0x6f));var _0x00e0=function(_0x3b9256,_0x149d43){_0x3b9256=_0x3b9256-0x0;var _0x2b8bac=_0x0e00[_0x3b9256];return _0x2b8bac;};'use strict';var _=require(_0x00e0('0x0'));var util=require('util');var utils=require(_0x00e0('0x1'));var queues={};function writeDB(_0x4ad94d){utils['info'](util['format'](_0x00e0('0x2'),_0x4ad94d[_0x00e0('0x3')],_0x4ad94d[_0x00e0('0x4')],_0x4ad94d['queue'],_0x4ad94d[_0x00e0('0x5')],_0x4ad94d[_0x00e0('0x6')],_0x4ad94d[_0x00e0('0x7')],_0x4ad94d[_0x00e0('0x8')]));if(_0x4ad94d['queue']){utils[_0x00e0('0x9')](_0x4ad94d['queue'])[_0x00e0('0xa')](function(_0x3f95fe){if(_0x3f95fe){_0x4ad94d[_0x00e0('0xb')]=_0x3f95fe[_0x00e0('0xb')];}utils[_0x00e0('0xc')]('CreateVoiceQueueReport',_0x4ad94d);});}else{utils[_0x00e0('0xc')](_0x00e0('0xd'),_0x4ad94d);}if(_0x4ad94d[_0x00e0('0xe')]){delete queues[_0x4ad94d[_0x00e0('0xe')]];}else{delete queues[_0x4ad94d[_0x00e0('0x3')]];}}exports['queuecallerjoin']=function(_0x37f951){try{utils[_0x00e0('0xf')](util['format'](_0x00e0('0x10'),_0x37f951[_0x00e0('0x3')]),_0x37f951);utils[_0x00e0('0x11')](util['format']('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x37f951['uniqueid'],_0x37f951[_0x00e0('0x12')],_0x37f951[_0x00e0('0x13')]));queues[_0x37f951['uniqueid']]=_[_0x00e0('0x14')](_0x37f951,{'originalposition':_0x37f951[_0x00e0('0x13')],'queuecallerjoinAt':utils[_0x00e0('0x15')](),'mohtime':0x0});}catch(_0x3cbb52){utils['error'](util[_0x00e0('0x16')](_0x00e0('0x10'),_0x37f951['uniqueid']),_0x3cbb52);}};exports[_0x00e0('0x17')]=function(_0x4a626d){try{if(!_[_0x00e0('0x18')](queues[_0x4a626d['uniqueid']])){utils['debug'](util[_0x00e0('0x16')]('[%s][queues][hangup]',_0x4a626d['uniqueid']),_0x4a626d);if(queues[_0x4a626d[_0x00e0('0x3')]][_0x00e0('0x19')]){if(!queues[_0x4a626d[_0x00e0('0x3')]]['queuecallerabandon']&&!queues[_0x4a626d['uniqueid']][_0x00e0('0x1a')]){queues[_0x4a626d[_0x00e0('0x3')]]['queuecallercomplete']=!![];queues[_0x4a626d[_0x00e0('0x3')]][_0x00e0('0x1b')]=utils[_0x00e0('0x15')]();queues[_0x4a626d['uniqueid']]['queuecallerexitreason']='COMPLETEDBYAGENT';}utils['info'](util[_0x00e0('0x16')](_0x00e0('0x1c'),_0x4a626d[_0x00e0('0x3')],queues[_0x4a626d[_0x00e0('0x3')]]['name'],queues[_0x4a626d['uniqueid']][_0x00e0('0x8')]));writeDB(queues[_0x4a626d[_0x00e0('0x3')]]);}else if(queues[_0x4a626d['uniqueid']][_0x00e0('0xe')]){utils[_0x00e0('0x11')](util['format'](_0x00e0('0x1d'),_0x4a626d[_0x00e0('0x3')],queues[_0x4a626d[_0x00e0('0x3')]][_0x00e0('0x1e')],queues[_0x4a626d[_0x00e0('0x3')]]['transfereduniqueid']));queues[queues[_0x4a626d[_0x00e0('0x3')]][_0x00e0('0xe')]]=queues[_0x4a626d['uniqueid']];queues[queues[_0x4a626d[_0x00e0('0x3')]][_0x00e0('0xe')]]['queuecallerenterreason']=0x2;delete queues[_0x4a626d[_0x00e0('0x3')]];}}}catch(_0x38683f){utils['error'](util['format'](_0x00e0('0x1f'),_0x4a626d[_0x00e0('0x3')]),_0x38683f);}};exports[_0x00e0('0x20')]=function(_0x2dc3d8){try{utils[_0x00e0('0xf')](util[_0x00e0('0x16')]('[%s][queues][varset]',_0x2dc3d8[_0x00e0('0x3')]),_0x2dc3d8);if(!_[_0x00e0('0x18')](_0x2dc3d8['variable'][_0x00e0('0x21')])&&_0x2dc3d8[_0x00e0('0x22')][_0x00e0('0x23')]()!==_0x00e0('0x24')){if(!_[_0x00e0('0x18')](queues[_0x2dc3d8[_0x00e0('0x3')]])){queues[_0x2dc3d8['uniqueid']]['queuecallerabandon']=![];queues[_0x2dc3d8['uniqueid']]['queuecallerabandonAt']=null;queues[_0x2dc3d8[_0x00e0('0x3')]][_0x00e0('0x1a')]=!![];queues[_0x2dc3d8[_0x00e0('0x3')]][_0x00e0('0x25')]=utils[_0x00e0('0x15')]();queues[_0x2dc3d8[_0x00e0('0x3')]]['queuecallerexitreason']=_0x2dc3d8[_0x00e0('0x22')][_0x00e0('0x23')]();utils[_0x00e0('0x11')](util[_0x00e0('0x16')](_0x00e0('0x26'),_0x2dc3d8[_0x00e0('0x3')],queues[_0x2dc3d8['uniqueid']][_0x00e0('0x1e')],_0x2dc3d8[_0x00e0('0x22')],queues[_0x2dc3d8[_0x00e0('0x3')]][_0x00e0('0x8')]));writeDB(queues[_0x2dc3d8[_0x00e0('0x3')]]);}}else if(!_[_0x00e0('0x18')](_0x2dc3d8['variable'][_0x00e0('0x27')])){if(!_['isNil'](queues[_0x2dc3d8[_0x00e0('0x3')]])&&!queues[_0x2dc3d8[_0x00e0('0x3')]]['queuecallerabandon']){queues[_0x2dc3d8[_0x00e0('0x3')]][_0x00e0('0x28')]=![];queues[_0x2dc3d8['uniqueid']]['queuecallerabandonAt']=null;queues[_0x2dc3d8['uniqueid']][_0x00e0('0x1a')]=!![];queues[_0x2dc3d8[_0x00e0('0x3')]][_0x00e0('0x25')]=utils[_0x00e0('0x15')]();queues[_0x2dc3d8[_0x00e0('0x3')]][_0x00e0('0x8')]='EXITWITHKEY';utils[_0x00e0('0x11')](util['format'](_0x00e0('0x29'),_0x2dc3d8[_0x00e0('0x3')],queues[_0x2dc3d8[_0x00e0('0x3')]][_0x00e0('0x1e')],_0x2dc3d8[_0x00e0('0x22')],queues[_0x2dc3d8[_0x00e0('0x3')]][_0x00e0('0x8')]));}}}catch(_0x4e63ec){utils['error'](util[_0x00e0('0x16')](_0x00e0('0x2a'),_0x2dc3d8[_0x00e0('0x3')]),_0x4e63ec);}};exports[_0x00e0('0x28')]=function(_0x5d94ee){try{if(!_[_0x00e0('0x18')](queues[_0x5d94ee[_0x00e0('0x3')]])){utils['debug'](util[_0x00e0('0x16')](_0x00e0('0x2b'),_0x5d94ee[_0x00e0('0x3')]),_0x5d94ee);queues[_0x5d94ee[_0x00e0('0x3')]][_0x00e0('0x1a')]=![];queues[_0x5d94ee[_0x00e0('0x3')]]['queuecallerexitAt']=null;queues[_0x5d94ee['uniqueid']][_0x00e0('0x28')]=!![];queues[_0x5d94ee[_0x00e0('0x3')]][_0x00e0('0x2c')]=utils[_0x00e0('0x15')]();queues[_0x5d94ee[_0x00e0('0x3')]]['queuecallerexitreason']='ABANDONED';utils[_0x00e0('0x11')](util[_0x00e0('0x16')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x5d94ee['uniqueid'],queues[_0x5d94ee[_0x00e0('0x3')]][_0x00e0('0x1e')],queues[_0x5d94ee['uniqueid']][_0x00e0('0x8')]));}}catch(_0x4c228c){utils[_0x00e0('0x2d')](util['format'](_0x00e0('0x2b'),_0x5d94ee[_0x00e0('0x3')]),_0x4c228c);}};exports[_0x00e0('0x2e')]=function(_0x4c77a1){try{if(!_['isNil'](queues[_0x4c77a1[_0x00e0('0x3')]])){utils[_0x00e0('0xf')](util['format'](_0x00e0('0x2f'),_0x4c77a1[_0x00e0('0x3')]),_0x4c77a1);utils[_0x00e0('0x11')](util[_0x00e0('0x16')](_0x00e0('0x30'),_0x4c77a1[_0x00e0('0x3')],queues[_0x4c77a1['uniqueid']]['name'],_0x4c77a1[_0x00e0('0x31')],_0x4c77a1[_0x00e0('0x32')]));queues[_0x4c77a1[_0x00e0('0x3')]][_0x00e0('0x2e')]=!![];queues[_0x4c77a1[_0x00e0('0x3')]][_0x00e0('0x19')]=utils[_0x00e0('0x15')]();queues[_0x4c77a1[_0x00e0('0x3')]][_0x00e0('0x33')]=utils[_0x00e0('0x34')](queues[_0x4c77a1[_0x00e0('0x3')]][_0x00e0('0x19')],queues[_0x4c77a1[_0x00e0('0x3')]][_0x00e0('0x35')]);queues[_0x4c77a1[_0x00e0('0x3')]][_0x00e0('0x13')]=_0x4c77a1['position'];queues[_0x4c77a1[_0x00e0('0x3')]][_0x00e0('0x36')]=_0x4c77a1[_0x00e0('0x36')];queues[_0x4c77a1[_0x00e0('0x3')]][_0x00e0('0x31')]=_0x4c77a1[_0x00e0('0x31')];queues[_0x4c77a1[_0x00e0('0x3')]][_0x00e0('0x32')]=_0x4c77a1[_0x00e0('0x32')];}}catch(_0x162804){utils[_0x00e0('0x2d')](util['format'](_0x00e0('0x2f'),_0x4c77a1[_0x00e0('0x3')]),_0x162804);}};exports['agentconnect']=function(_0x4041d1){try{if(!_[_0x00e0('0x18')](queues[_0x4041d1['uniqueid']])){utils[_0x00e0('0xf')](util[_0x00e0('0x16')](_0x00e0('0x37'),_0x4041d1['uniqueid']),_0x4041d1);utils[_0x00e0('0x11')](util[_0x00e0('0x16')](_0x00e0('0x38'),_0x4041d1[_0x00e0('0x3')],queues[_0x4041d1[_0x00e0('0x3')]][_0x00e0('0x1e')],_0x4041d1[_0x00e0('0x39')],_0x4041d1['destaccountcode']));queues[_0x4041d1['uniqueid']][_0x00e0('0x28')]=![];queues[_0x4041d1[_0x00e0('0x3')]][_0x00e0('0x28')]=![];queues[_0x4041d1[_0x00e0('0x3')]][_0x00e0('0x2c')]=null;queues[_0x4041d1['uniqueid']]['queuecallerexit']=![];queues[_0x4041d1[_0x00e0('0x3')]]['queuecallerexitreason']=null;queues[_0x4041d1['uniqueid']]['queuecallerexitAt']=null;queues[_0x4041d1[_0x00e0('0x3')]][_0x00e0('0x3a')]=!![];queues[_0x4041d1[_0x00e0('0x3')]][_0x00e0('0x7')]=_0x4041d1['destaccountcode'];queues[_0x4041d1[_0x00e0('0x3')]]['lastAssignedTo']=_0x4041d1[_0x00e0('0x39')];}}catch(_0x3f82df){utils[_0x00e0('0x2d')](util[_0x00e0('0x16')]('[%s][queues][agentconnect]',_0x4041d1[_0x00e0('0x3')]),_0x3f82df);}};exports[_0x00e0('0x3b')]=function(_0x329e56){try{if(!_[_0x00e0('0x18')](queues[_0x329e56[_0x00e0('0x3')]])){if(queues[_0x329e56[_0x00e0('0x3')]]['queuecallerleaveAt']){utils[_0x00e0('0xf')](util['format'](_0x00e0('0x3c'),_0x329e56[_0x00e0('0x3')]),_0x329e56);queues[_0x329e56[_0x00e0('0x3')]]['queuecallerabandon']=![];queues[_0x329e56[_0x00e0('0x3')]][_0x00e0('0x28')]=![];queues[_0x329e56[_0x00e0('0x3')]][_0x00e0('0x2c')]=null;queues[_0x329e56[_0x00e0('0x3')]][_0x00e0('0x1a')]=![];queues[_0x329e56[_0x00e0('0x3')]][_0x00e0('0x25')]=null;queues[_0x329e56[_0x00e0('0x3')]]['assigned']=!![];queues[_0x329e56[_0x00e0('0x3')]][_0x00e0('0x5')]=_0x329e56[_0x00e0('0x39')];queues[_0x329e56[_0x00e0('0x3')]][_0x00e0('0x3d')]=!![];queues[_0x329e56['uniqueid']][_0x00e0('0x1b')]=utils[_0x00e0('0x15')]();if(_0x329e56['reason']=='transfer'){if(!queues[_0x329e56[_0x00e0('0x3')]][_0x00e0('0x3e')]){queues[_0x329e56[_0x00e0('0x3')]][_0x00e0('0x8')]=_0x00e0('0x3f');}}else{queues[_0x329e56[_0x00e0('0x3')]]['queuecallerexitreason']='COMPLETEDBY'+_0x329e56[_0x00e0('0x40')][_0x00e0('0x23')]();}utils[_0x00e0('0x11')](util[_0x00e0('0x16')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x329e56[_0x00e0('0x3')],queues[_0x329e56['uniqueid']][_0x00e0('0x1e')],_0x329e56[_0x00e0('0x39')],queues[_0x329e56[_0x00e0('0x3')]][_0x00e0('0x8')]));writeDB(queues[_0x329e56[_0x00e0('0x3')]]);}}}catch(_0x7a52fd){utils[_0x00e0('0x2d')](util[_0x00e0('0x16')](_0x00e0('0x3c'),_0x329e56[_0x00e0('0x3')]),_0x7a52fd);}};exports[_0x00e0('0x41')]=function(_0x4dc88d){try{if(!_[_0x00e0('0x18')](queues[_0x4dc88d[_0x00e0('0x42')]])){utils['debug'](util[_0x00e0('0x16')](_0x00e0('0x43'),_0x4dc88d[_0x00e0('0x3')]),_0x4dc88d);queues[_0x4dc88d[_0x00e0('0x42')]]['transfer']=!![];queues[_0x4dc88d['transfereeuniqueid']][_0x00e0('0x44')]=_0x00e0('0x45');queues[_0x4dc88d['transfereeuniqueid']]['transferexten']=_0x4dc88d[_0x00e0('0x46')];queues[_0x4dc88d[_0x00e0('0x42')]]['transferuniqueid']=_0x4dc88d[_0x00e0('0x42')];queues[_0x4dc88d[_0x00e0('0x42')]][_0x00e0('0x8')]='BLINDTRANSFER';utils[_0x00e0('0x11')](util[_0x00e0('0x16')](_0x00e0('0x47'),_0x4dc88d['uniqueid'],queues[_0x4dc88d['transfereeuniqueid']]['name'],_0x4dc88d[_0x00e0('0x42')],_0x4dc88d[_0x00e0('0x46')]));}}catch(_0x1677be){utils['error'](util[_0x00e0('0x16')]('[%s][queues][blindtransfer]',_0x4dc88d[_0x00e0('0x3')]),_0x1677be);}};exports[_0x00e0('0x48')]=function(_0x2a96e6){try{utils[_0x00e0('0xf')](util[_0x00e0('0x16')](_0x00e0('0x49'),_0x2a96e6['origtransfereruniqueid']),_0x2a96e6);if(_0x2a96e6['origtransfereruniqueid']==_0x2a96e6[_0x00e0('0x4a')]){if(!_[_0x00e0('0x18')](queues[_0x2a96e6[_0x00e0('0x4b')]])){utils[_0x00e0('0x11')](util[_0x00e0('0x16')](_0x00e0('0x4c'),_0x2a96e6[_0x00e0('0x4d')],queues[_0x2a96e6['secondtransfererlinkedid']]['name'],_0x2a96e6[_0x00e0('0x4e')]));queues[_0x2a96e6[_0x00e0('0x4b')]][_0x00e0('0x3e')]=!![];queues[_0x2a96e6[_0x00e0('0x4b')]][_0x00e0('0x44')]=_0x00e0('0x4f');queues[_0x2a96e6['secondtransfererlinkedid']][_0x00e0('0x50')]=_0x2a96e6[_0x00e0('0x4e')];queues[_0x2a96e6['secondtransfererlinkedid']][_0x00e0('0x51')]=_0x2a96e6[_0x00e0('0x4d')];queues[_0x2a96e6[_0x00e0('0x4b')]][_0x00e0('0x8')]=_0x00e0('0x52');}if(!_[_0x00e0('0x18')](queues[_0x2a96e6[_0x00e0('0x4a')]])){if(_0x2a96e6[_0x00e0('0x53')]&&queues[_0x2a96e6['transfereelinkedid']]){queues[_0x2a96e6['transfereelinkedid']]['queuecallerenterreason']=0x1;queues[_0x2a96e6['transfereeuniqueid']]=_[_0x00e0('0x54')](queues[_0x2a96e6['transfereelinkedid']]);queues[_0x2a96e6['transfereeuniqueid']][_0x00e0('0xe')]=_0x2a96e6[_0x00e0('0x55')];queues[_0x2a96e6['transfereeuniqueid']][_0x00e0('0x56')]=0x2;queues[_0x2a96e6['transfereeuniqueid']][_0x00e0('0x6')]=queues[_0x2a96e6[_0x00e0('0x4b')]][_0x00e0('0x6')];queues[_0x2a96e6[_0x00e0('0x42')]][_0x00e0('0x57')]=queues[_0x2a96e6[_0x00e0('0x4b')]][_0x00e0('0x57')];queues[_0x2a96e6[_0x00e0('0x42')]][_0x00e0('0x35')]=utils[_0x00e0('0x15')]();queues[_0x2a96e6[_0x00e0('0x42')]]['queuecallerleaveAt']=utils[_0x00e0('0x15')]();queues[_0x2a96e6[_0x00e0('0x42')]][_0x00e0('0x33')]=0x0;queues[_0x2a96e6[_0x00e0('0x42')]]['mohtime']=0x0;utils[_0x00e0('0x11')](util['format'](_0x00e0('0x58'),_0x2a96e6[_0x00e0('0x4d')],queues[_0x2a96e6['transfereeuniqueid']]['name'],queues[_0x2a96e6[_0x00e0('0x42')]]['calleridnum'],queues[_0x2a96e6[_0x00e0('0x42')]][_0x00e0('0x57')]));}else{utils[_0x00e0('0x11')](util[_0x00e0('0x16')](_0x00e0('0x59'),_0x2a96e6[_0x00e0('0x4d')],queues[_0x2a96e6[_0x00e0('0x4a')]]['name'],_0x2a96e6[_0x00e0('0x4b')]));queues[_0x2a96e6[_0x00e0('0x4a')]][_0x00e0('0xe')]=_0x2a96e6['secondtransfererlinkedid'];}}}else if(_0x2a96e6[_0x00e0('0x5a')]==_0x2a96e6[_0x00e0('0x4b')]){if(!_[_0x00e0('0x18')](queues[_0x2a96e6[_0x00e0('0x4a')]])){utils[_0x00e0('0x11')](util[_0x00e0('0x16')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x2a96e6['origtransfereruniqueid'],queues[_0x2a96e6[_0x00e0('0x4a')]][_0x00e0('0x1e')],_0x2a96e6[_0x00e0('0x5a')],_0x2a96e6[_0x00e0('0x5b')]));queues[_0x2a96e6[_0x00e0('0x4a')]][_0x00e0('0x3e')]=!![];queues[_0x2a96e6[_0x00e0('0x4a')]][_0x00e0('0x44')]=_0x00e0('0x4f');queues[_0x2a96e6[_0x00e0('0x4a')]]['transferexten']=_0x2a96e6[_0x00e0('0x5b')];queues[_0x2a96e6[_0x00e0('0x4a')]][_0x00e0('0x51')]=_0x2a96e6[_0x00e0('0x5a')];queues[_0x2a96e6[_0x00e0('0x4a')]][_0x00e0('0x8')]='ATTENDEDTRANSFER';}if(!_[_0x00e0('0x18')](queues[_0x2a96e6[_0x00e0('0x4b')]])){if(_0x2a96e6[_0x00e0('0x5c')]&&queues[_0x2a96e6[_0x00e0('0x5c')]]){queues[_0x2a96e6[_0x00e0('0x5c')]][_0x00e0('0x56')]=0x1;queues[_0x2a96e6[_0x00e0('0x55')]]=_[_0x00e0('0x54')](queues[_0x2a96e6[_0x00e0('0x5c')]]);queues[_0x2a96e6[_0x00e0('0x55')]][_0x00e0('0xe')]=_0x2a96e6[_0x00e0('0x55')];queues[_0x2a96e6[_0x00e0('0x55')]][_0x00e0('0x56')]=0x2;queues[_0x2a96e6[_0x00e0('0x55')]][_0x00e0('0x6')]=queues[_0x2a96e6['origtransfererlinkedid']][_0x00e0('0x6')];queues[_0x2a96e6[_0x00e0('0x55')]]['calleridname']=queues[_0x2a96e6[_0x00e0('0x4a')]][_0x00e0('0x57')];queues[_0x2a96e6['transfertargetuniqueid']][_0x00e0('0x35')]=utils[_0x00e0('0x15')]();queues[_0x2a96e6[_0x00e0('0x55')]][_0x00e0('0x19')]=utils[_0x00e0('0x15')]();queues[_0x2a96e6[_0x00e0('0x55')]][_0x00e0('0x33')]=0x0;queues[_0x2a96e6[_0x00e0('0x55')]][_0x00e0('0x5d')]=0x0;utils[_0x00e0('0x11')](util['format'](_0x00e0('0x5e'),_0x2a96e6['origtransfereruniqueid'],queues[_0x2a96e6['transfertargetuniqueid']]['name'],queues[_0x2a96e6[_0x00e0('0x55')]][_0x00e0('0xe')],queues[_0x2a96e6[_0x00e0('0x55')]][_0x00e0('0x6')],queues[_0x2a96e6[_0x00e0('0x55')]][_0x00e0('0x57')]));}else{utils[_0x00e0('0x11')](util[_0x00e0('0x16')](_0x00e0('0x59'),_0x2a96e6[_0x00e0('0x4d')],queues[_0x2a96e6[_0x00e0('0x4b')]][_0x00e0('0x1e')],_0x2a96e6[_0x00e0('0x4a')]));queues[_0x2a96e6[_0x00e0('0x4b')]]['transfereduniqueid']=_0x2a96e6[_0x00e0('0x4a')];}}}}catch(_0x1c4dd3){utils['error'](util[_0x00e0('0x16')]('[%s][queues][attendedtransfer]',_0x2a96e6[_0x00e0('0x4d')]),_0x1c4dd3);}};exports[_0x00e0('0x5f')]=function(_0x275856){try{if(!_[_0x00e0('0x18')](queues[_0x275856[_0x00e0('0x3')]])){utils[_0x00e0('0xf')](util['format'](_0x00e0('0x60'),_0x275856[_0x00e0('0x3')]),_0x275856);queues[_0x275856[_0x00e0('0x3')]]['musiconholdstartAt']=utils[_0x00e0('0x15')]();utils[_0x00e0('0x11')](util[_0x00e0('0x16')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x275856['uniqueid'],queues[_0x275856['uniqueid']][_0x00e0('0x1e')],queues[_0x275856[_0x00e0('0x3')]][_0x00e0('0x61')]));}}catch(_0x11a79c){utils[_0x00e0('0x2d')](util[_0x00e0('0x16')]('[%s][queues][musiconholdstart]',_0x275856[_0x00e0('0x3')]),_0x11a79c);}};exports[_0x00e0('0x62')]=function(_0x5d9dc6){try{if(!_[_0x00e0('0x18')](queues[_0x5d9dc6['uniqueid']])){if(!_[_0x00e0('0x18')](queues[_0x5d9dc6[_0x00e0('0x3')]][_0x00e0('0x61')])){utils['debug'](util[_0x00e0('0x16')]('[%s][queues][musiconholdstop]',_0x5d9dc6[_0x00e0('0x3')]),_0x5d9dc6);queues[_0x5d9dc6[_0x00e0('0x3')]][_0x00e0('0x5d')]+=utils[_0x00e0('0x34')](utils[_0x00e0('0x15')](),queues[_0x5d9dc6[_0x00e0('0x3')]][_0x00e0('0x61')]);utils[_0x00e0('0x11')](util[_0x00e0('0x16')](_0x00e0('0x63'),_0x5d9dc6[_0x00e0('0x3')],queues[_0x5d9dc6[_0x00e0('0x3')]][_0x00e0('0x1e')],queues[_0x5d9dc6[_0x00e0('0x3')]]['mohtime']));delete queues[_0x5d9dc6[_0x00e0('0x3')]]['musiconholdstartAt'];}}}catch(_0x228476){utils[_0x00e0('0x2d')](util[_0x00e0('0x16')](_0x00e0('0x64'),_0x5d9dc6['uniqueid']),_0x228476);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 7f795a9..217134d 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 _0xede6=['[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','replace','find','monitors','push','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereruniqueid','recording','[%s][recordings][blindtransfer]','lodash','util','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','channel','error','newstate','[%s][recordings][newstate]','channelstate'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xede6,0x79));var _0x6ede=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0xede6[_0x3305de];return _0x3b5a84;};'use strict';var _=require(_0x6ede('0x0'));var util=require(_0x6ede('0x1'));var utils=require(_0x6ede('0x2'));var transfers=require(_0x6ede('0x3'));var recordings={};function writeDB(_0xd3e1c1){var _0x343cca;utils[_0x6ede('0x4')](util[_0x6ede('0x5')](_0x6ede('0x6'),_0xd3e1c1[_0x6ede('0x7')]));if(transfers[_0x6ede('0x8')][_0xd3e1c1[_0x6ede('0x7')]]){_0x343cca=_0xd3e1c1['uniqueid'];_0xd3e1c1['uniqueid']=transfers[_0x6ede('0x8')][_0xd3e1c1[_0x6ede('0x7')]][_0x6ede('0x9')];}if(_0xd3e1c1[_0x6ede('0xa')]){utils[_0x6ede('0xb')](_0xd3e1c1[_0x6ede('0xa')])[_0x6ede('0xc')](function(_0x242738){if(_0x242738){_0xd3e1c1[_0x6ede('0xd')]=_0x242738[_0x6ede('0xe')];_0xd3e1c1[_0x6ede('0xf')]=_0x242738['id'];}utils[_0x6ede('0x10')](_0x6ede('0x11'),_0xd3e1c1);});}else{utils['request'](_0x6ede('0x11'),_0xd3e1c1);}if(_0x343cca)delete transfers['blinds'][_0x343cca];}exports[_0x6ede('0x12')]=function(_0x50de93){try{utils[_0x6ede('0x13')](util['format'](_0x6ede('0x14'),_0x50de93[_0x6ede('0x7')]),_0x50de93);if(_0x50de93[_0x6ede('0x7')]==_0x50de93[_0x6ede('0x15')]){utils[_0x6ede('0x4')](util[_0x6ede('0x5')](_0x6ede('0x16'),_0x50de93[_0x6ede('0x7')],_0x50de93[_0x6ede('0x17')],_0x50de93['exten']));recordings[_0x50de93['uniqueid']]={'uniqueid':_0x50de93[_0x6ede('0x7')],'accountcode':_0x50de93[_0x6ede('0xa')],'exten':_0x50de93['exten'],'context':_0x50de93[_0x6ede('0x17')],'channel':_0x50de93[_0x6ede('0x18')],'monitors':[]};}}catch(_0x518c21){utils[_0x6ede('0x19')](util[_0x6ede('0x5')]('[%s][recordings][newchannel]',_0x50de93[_0x6ede('0x7')]),_0x518c21);}};exports[_0x6ede('0x1a')]=function(_0x3be4f3){try{utils['debug'](util['format'](_0x6ede('0x1b'),_0x3be4f3[_0x6ede('0x7')]),_0x3be4f3);if(!_['isNil'](recordings[_0x3be4f3[_0x6ede('0x7')]])&&_0x3be4f3[_0x6ede('0x1c')]==0x6){utils[_0x6ede('0x4')](util['format'](_0x6ede('0x1d'),_0x3be4f3['uniqueid'],_0x3be4f3['context'],_0x3be4f3['channel']));}else if(!_[_0x6ede('0x1e')](recordings[_0x3be4f3[_0x6ede('0x15')]])&&_0x3be4f3['channelstate']==0x6&&_0x3be4f3['context']!=_0x6ede('0x1f')){utils[_0x6ede('0x4')](util[_0x6ede('0x5')](_0x6ede('0x20'),_0x3be4f3[_0x6ede('0x7')],_0x3be4f3[_0x6ede('0x15')],_0x3be4f3['context'],_0x3be4f3[_0x6ede('0x18')]));recordings[_0x3be4f3[_0x6ede('0x15')]]['accountcode']=_0x3be4f3[_0x6ede('0xa')];}}catch(_0x4fc61f){utils[_0x6ede('0x19')](util[_0x6ede('0x5')](_0x6ede('0x1b'),_0x3be4f3[_0x6ede('0x7')]),_0x4fc61f);}};exports[_0x6ede('0x21')]=function(_0x2073cb){try{if(!_[_0x6ede('0x1e')](_0x2073cb[_0x6ede('0x22')])&&!_['isNil'](_0x2073cb[_0x6ede('0x22')]['mixmonitor_filename'])){utils[_0x6ede('0x13')](util[_0x6ede('0x5')](_0x6ede('0x23'),_0x2073cb['uniqueid']),_0x2073cb);utils[_0x6ede('0x4')](util[_0x6ede('0x5')](_0x6ede('0x24'),_0x2073cb[_0x6ede('0x7')],_0x2073cb[_0x6ede('0x22')],_0x2073cb['value']));if(_[_0x6ede('0x25')](_0x2073cb[_0x6ede('0x26')],_0x6ede('0x27'))){_0x2073cb['value']=_0x2073cb['value'][_0x6ede('0x28')]('.wav49','.WAV');}if(recordings[_0x2073cb[_0x6ede('0x15')]]){var _0x492e96=_[_0x6ede('0x29')](recordings[_0x2073cb[_0x6ede('0x15')]][_0x6ede('0x2a')],{'value':_0x2073cb[_0x6ede('0x26')]});if(_['isNil'](_0x492e96)){recordings[_0x2073cb[_0x6ede('0x15')]][_0x6ede('0x2a')][_0x6ede('0x2b')]({'value':_0x2073cb['value']});}}}}catch(_0x2018ab){utils[_0x6ede('0x19')](util[_0x6ede('0x5')](_0x6ede('0x23'),_0x2073cb[_0x6ede('0x7')]),_0x2018ab);}};exports['hangup']=function(_0x2d2020){try{if(!_[_0x6ede('0x1e')](recordings[_0x2d2020[_0x6ede('0x7')]])){utils[_0x6ede('0x13')](util[_0x6ede('0x5')]('[%s][recordings][hangup]',_0x2d2020[_0x6ede('0x7')]),_0x2d2020);utils['info'](util[_0x6ede('0x5')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x2d2020[_0x6ede('0x7')],_0x2d2020[_0x6ede('0x2c')],_0x2d2020['calleridname'],_0x2d2020[_0x6ede('0x2d')]));recordings[_0x2d2020[_0x6ede('0x7')]]['calleridnum']=_0x2d2020[_0x6ede('0x2c')];recordings[_0x2d2020[_0x6ede('0x7')]][_0x6ede('0x2e')]=_0x2d2020[_0x6ede('0x2e')];recordings[_0x2d2020['uniqueid']][_0x6ede('0x2f')]=_0x2d2020['connectedlinenum'];recordings[_0x2d2020[_0x6ede('0x7')]][_0x6ede('0x30')]=_0x2d2020[_0x6ede('0x30')];if(recordings[_0x2d2020[_0x6ede('0x7')]][_0x6ede('0x31')]==_0x6ede('0x32')&&recordings[_0x2d2020[_0x6ede('0x7')]]['accountcode']){recordings[_0x2d2020[_0x6ede('0x7')]]['connectedlinenum']=recordings[_0x2d2020[_0x6ede('0x7')]][_0x6ede('0xa')];recordings[_0x2d2020[_0x6ede('0x7')]][_0x6ede('0x30')]='';}recordings[_0x2d2020['uniqueid']][_0x6ede('0x2a')][_0x6ede('0x33')](function(_0x2373cd){var _0x1349db=_['clone'](recordings[_0x2d2020[_0x6ede('0x7')]]);_0x1349db[_0x6ede('0x26')]=_0x2373cd['value'];writeDB(_0x1349db);});delete recordings[_0x2d2020[_0x6ede('0x7')]];}}catch(_0x4c05f9){utils['error'](util[_0x6ede('0x5')]('[%s][recordings][hangup]',_0x2d2020[_0x6ede('0x7')]),_0x4c05f9);}};exports[_0x6ede('0x34')]=function(_0x30423d){try{if(!_[_0x6ede('0x1e')](recordings[_0x30423d[_0x6ede('0x7')]])){utils[_0x6ede('0x13')](util[_0x6ede('0x5')](_0x6ede('0x35'),_0x30423d['uniqueid']),_0x30423d);utils[_0x6ede('0x4')](util[_0x6ede('0x5')](_0x6ede('0x36'),_0x30423d[_0x6ede('0x7')],_0x30423d[_0x6ede('0x37')],_0x30423d[_0x6ede('0x38')]));if(_0x30423d[_0x6ede('0x37')]['toLowerCase']()==_0x6ede('0x39')&&_[_0x6ede('0x3a')](_0x30423d[_0x6ede('0x38')][_0x6ede('0x3b')](),_0x6ede('0x3c'))){var _0x25d650=_0x30423d['appdata'][_0x6ede('0x3d')]('=');var _0x2037b8=_0x25d650[0x0][_0x6ede('0x3e')](_0x25d650[0x0][_0x6ede('0x3f')]('(')+0x1,_0x25d650[0x0][_0x6ede('0x3f')](')'));var _0x44384e=_0x25d650[0x1];recordings[_0x30423d[_0x6ede('0x7')]][_0x2037b8]=_0x44384e;}}}catch(_0x281ac8){utils[_0x6ede('0x19')](util[_0x6ede('0x5')](_0x6ede('0x35'),_0x30423d[_0x6ede('0x7')]),_0x281ac8);}};exports[_0x6ede('0x40')]=function(_0x1c8e20){try{if(!_[_0x6ede('0x1e')](recordings[_0x1c8e20['uniqueid']])){utils[_0x6ede('0x13')](util[_0x6ede('0x5')](_0x6ede('0x41'),_0x1c8e20[_0x6ede('0x7')]),_0x1c8e20);utils['info'](util[_0x6ede('0x5')](_0x6ede('0x42'),_0x1c8e20['uniqueid'],_0x1c8e20[_0x6ede('0x43')]));recordings[_0x1c8e20[_0x6ede('0x7')]][_0x6ede('0x43')]=_0x1c8e20[_0x6ede('0x43')];}}catch(_0xfd8bf2){utils[_0x6ede('0x19')](util[_0x6ede('0x5')](_0x6ede('0x41'),_0x1c8e20[_0x6ede('0x7')]),_0xfd8bf2);}};exports[_0x6ede('0x44')]=function(_0x56105d){try{utils['debug'](util[_0x6ede('0x5')]('[%s][recordings][blindtransfer]',_0x56105d[_0x6ede('0x7')]),_0x56105d);utils['info'](util['format'](_0x6ede('0x45'),_0x56105d[_0x6ede('0x7')],_0x56105d['transferercalleridnum'],_0x56105d[_0x6ede('0x46')],_0x56105d[_0x6ede('0x47')],_0x56105d['transfereecalleridname']));if(recordings[_0x56105d[_0x6ede('0x48')]]&&transfers[_0x6ede('0x8')][_0x56105d['transfereruniqueid']]){transfers[_0x6ede('0x8')][_0x56105d[_0x6ede('0x48')]][_0x6ede('0x49')]=!![];}}catch(_0x598da2){utils[_0x6ede('0x19')](util[_0x6ede('0x5')](_0x6ede('0x4a'),_0x56105d[_0x6ede('0x7')]),_0x598da2);}}; \ No newline at end of file +var _0x1502=['request','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','transfer','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','monitors','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','application','appdata','toLowerCase','set','cdr','split','lastIndexOf','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','util','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','getUserByInternal','accountcode','membername','name','UserId','CreateVoiceRecording'];(function(_0x4e8d14,_0x4952e8){var _0x558835=function(_0x4c4f88){while(--_0x4c4f88){_0x4e8d14['push'](_0x4e8d14['shift']());}};_0x558835(++_0x4952e8);}(_0x1502,0x15d));var _0x2150=function(_0x39c3f1,_0x453ace){_0x39c3f1=_0x39c3f1-0x0;var _0x3e0530=_0x1502[_0x39c3f1];return _0x3e0530;};'use strict';var _=require(_0x2150('0x0'));var util=require(_0x2150('0x1'));var utils=require(_0x2150('0x2'));var transfers=require(_0x2150('0x3'));var recordings={};function writeDB(_0x381277){var _0x312a44;utils[_0x2150('0x4')](util[_0x2150('0x5')](_0x2150('0x6'),_0x381277[_0x2150('0x7')]));if(transfers[_0x2150('0x8')][_0x381277['uniqueid']]){_0x312a44=_0x381277[_0x2150('0x7')];_0x381277[_0x2150('0x7')]=transfers[_0x2150('0x8')][_0x381277[_0x2150('0x7')]][_0x2150('0x9')];}if(_0x381277['accountcode']){utils[_0x2150('0xa')](_0x381277[_0x2150('0xb')])['then'](function(_0x37da81){if(_0x37da81){_0x381277[_0x2150('0xc')]=_0x37da81[_0x2150('0xd')];_0x381277[_0x2150('0xe')]=_0x37da81['id'];}utils['request'](_0x2150('0xf'),_0x381277);});}else{utils[_0x2150('0x10')](_0x2150('0xf'),_0x381277);}if(_0x312a44)delete transfers[_0x2150('0x8')][_0x312a44];}exports[_0x2150('0x11')]=function(_0xc58f2a){try{utils[_0x2150('0x12')](util['format'](_0x2150('0x13'),_0xc58f2a[_0x2150('0x7')]),_0xc58f2a);if(_0xc58f2a[_0x2150('0x7')]==_0xc58f2a[_0x2150('0x14')]){utils[_0x2150('0x4')](util['format'](_0x2150('0x15'),_0xc58f2a['uniqueid'],_0xc58f2a[_0x2150('0x16')],_0xc58f2a[_0x2150('0x17')]));recordings[_0xc58f2a[_0x2150('0x7')]]={'uniqueid':_0xc58f2a[_0x2150('0x7')],'accountcode':_0xc58f2a[_0x2150('0xb')],'exten':_0xc58f2a['exten'],'context':_0xc58f2a[_0x2150('0x16')],'channel':_0xc58f2a[_0x2150('0x18')],'monitors':[]};}}catch(_0x58cd05){utils[_0x2150('0x19')](util[_0x2150('0x5')](_0x2150('0x13'),_0xc58f2a['uniqueid']),_0x58cd05);}};exports[_0x2150('0x1a')]=function(_0x3bf173){try{utils[_0x2150('0x12')](util[_0x2150('0x5')](_0x2150('0x1b'),_0x3bf173[_0x2150('0x7')]),_0x3bf173);if(!_['isNil'](recordings[_0x3bf173[_0x2150('0x7')]])&&_0x3bf173['channelstate']==0x6){utils['info'](util[_0x2150('0x5')](_0x2150('0x1c'),_0x3bf173[_0x2150('0x7')],_0x3bf173[_0x2150('0x16')],_0x3bf173[_0x2150('0x18')]));}else if(!_[_0x2150('0x1d')](recordings[_0x3bf173[_0x2150('0x14')]])&&_0x3bf173['channelstate']==0x6&&_0x3bf173[_0x2150('0x16')]!=_0x2150('0x1e')){utils[_0x2150('0x4')](util[_0x2150('0x5')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x3bf173[_0x2150('0x7')],_0x3bf173['linkedid'],_0x3bf173[_0x2150('0x16')],_0x3bf173[_0x2150('0x18')]));recordings[_0x3bf173['linkedid']]['accountcode']=_0x3bf173[_0x2150('0xb')];}}catch(_0xfed37){utils[_0x2150('0x19')](util[_0x2150('0x5')](_0x2150('0x1b'),_0x3bf173[_0x2150('0x7')]),_0xfed37);}};exports[_0x2150('0x1f')]=function(_0x3d81e3){try{if(!_[_0x2150('0x1d')](_0x3d81e3[_0x2150('0x20')])&&!_[_0x2150('0x1d')](_0x3d81e3['variable'][_0x2150('0x21')])){utils[_0x2150('0x12')](util[_0x2150('0x5')]('[%s][recordings][varset]',_0x3d81e3[_0x2150('0x7')]),_0x3d81e3);utils['info'](util[_0x2150('0x5')](_0x2150('0x22'),_0x3d81e3[_0x2150('0x7')],_0x3d81e3[_0x2150('0x20')],_0x3d81e3[_0x2150('0x23')]));if(_[_0x2150('0x24')](_0x3d81e3['value'],_0x2150('0x25'))){_0x3d81e3[_0x2150('0x23')]=_0x3d81e3[_0x2150('0x23')][_0x2150('0x26')](_0x2150('0x25'),_0x2150('0x27'));}if(recordings[_0x3d81e3[_0x2150('0x14')]]){var _0x53fac3=_['find'](recordings[_0x3d81e3['linkedid']][_0x2150('0x28')],{'value':_0x3d81e3[_0x2150('0x23')]});if(_[_0x2150('0x1d')](_0x53fac3)){recordings[_0x3d81e3[_0x2150('0x14')]]['monitors'][_0x2150('0x29')]({'value':_0x3d81e3['value']});}}}}catch(_0x17a607){utils[_0x2150('0x19')](util[_0x2150('0x5')](_0x2150('0x2a'),_0x3d81e3[_0x2150('0x7')]),_0x17a607);}};exports[_0x2150('0x2b')]=function(_0x58baab){try{if(!_[_0x2150('0x1d')](recordings[_0x58baab['uniqueid']])){utils[_0x2150('0x12')](util[_0x2150('0x5')](_0x2150('0x2c'),_0x58baab[_0x2150('0x7')]),_0x58baab);utils['info'](util[_0x2150('0x5')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x58baab['uniqueid'],_0x58baab['calleridnum'],_0x58baab[_0x2150('0x2d')],_0x58baab[_0x2150('0x2e')]));recordings[_0x58baab[_0x2150('0x7')]]['calleridnum']=_0x58baab[_0x2150('0x2f')];recordings[_0x58baab[_0x2150('0x7')]][_0x2150('0x2d')]=_0x58baab['calleridname'];recordings[_0x58baab[_0x2150('0x7')]][_0x2150('0x30')]=_0x58baab[_0x2150('0x30')];recordings[_0x58baab[_0x2150('0x7')]][_0x2150('0x31')]=_0x58baab['connectedlinename'];if(recordings[_0x58baab[_0x2150('0x7')]][_0x2150('0x32')]==_0x2150('0x33')&&recordings[_0x58baab[_0x2150('0x7')]][_0x2150('0xb')]){recordings[_0x58baab['uniqueid']][_0x2150('0x30')]=recordings[_0x58baab[_0x2150('0x7')]][_0x2150('0xb')];recordings[_0x58baab[_0x2150('0x7')]][_0x2150('0x31')]='';}recordings[_0x58baab[_0x2150('0x7')]][_0x2150('0x28')][_0x2150('0x34')](function(_0x1968d5){var _0x351722=_[_0x2150('0x35')](recordings[_0x58baab[_0x2150('0x7')]]);_0x351722[_0x2150('0x23')]=_0x1968d5[_0x2150('0x23')];writeDB(_0x351722);});delete recordings[_0x58baab[_0x2150('0x7')]];}}catch(_0x3ffce8){utils[_0x2150('0x19')](util[_0x2150('0x5')]('[%s][recordings][hangup]',_0x58baab['uniqueid']),_0x3ffce8);}};exports[_0x2150('0x36')]=function(_0x2256a2){try{if(!_[_0x2150('0x1d')](recordings[_0x2256a2[_0x2150('0x7')]])){utils[_0x2150('0x12')](util['format'](_0x2150('0x37'),_0x2256a2[_0x2150('0x7')]),_0x2256a2);utils['info'](util[_0x2150('0x5')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x2256a2['uniqueid'],_0x2256a2[_0x2150('0x38')],_0x2256a2[_0x2150('0x39')]));if(_0x2256a2[_0x2150('0x38')][_0x2150('0x3a')]()==_0x2150('0x3b')&&_['startsWith'](_0x2256a2[_0x2150('0x39')][_0x2150('0x3a')](),_0x2150('0x3c'))){var _0x535048=_0x2256a2[_0x2150('0x39')][_0x2150('0x3d')]('=');var _0x47fe94=_0x535048[0x0]['substring'](_0x535048[0x0]['lastIndexOf']('(')+0x1,_0x535048[0x0][_0x2150('0x3e')](')'));var _0x35688b=_0x535048[0x1];recordings[_0x2256a2[_0x2150('0x7')]][_0x47fe94]=_0x35688b;}}}catch(_0x3b42fb){utils[_0x2150('0x19')](util[_0x2150('0x5')](_0x2150('0x37'),_0x2256a2[_0x2150('0x7')]),_0x3b42fb);}};exports['queuecallerjoin']=function(_0x2a9869){try{if(!_[_0x2150('0x1d')](recordings[_0x2a9869['uniqueid']])){utils[_0x2150('0x12')](util[_0x2150('0x5')]('[%s][recordings][queuecallerjoin]',_0x2a9869[_0x2150('0x7')]),_0x2a9869);utils[_0x2150('0x4')](util[_0x2150('0x5')](_0x2150('0x3f'),_0x2a9869['uniqueid'],_0x2a9869[_0x2150('0x40')]));recordings[_0x2a9869[_0x2150('0x7')]][_0x2150('0x40')]=_0x2a9869[_0x2150('0x40')];}}catch(_0x153f7d){utils[_0x2150('0x19')](util['format']('[%s][recordings][queuecallerjoin]',_0x2a9869[_0x2150('0x7')]),_0x153f7d);}};exports['blindtransfer']=function(_0x3ed265){try{utils[_0x2150('0x12')](util['format'](_0x2150('0x41'),_0x3ed265['uniqueid']),_0x3ed265);utils['info'](util[_0x2150('0x5')](_0x2150('0x42'),_0x3ed265[_0x2150('0x7')],_0x3ed265[_0x2150('0x43')],_0x3ed265[_0x2150('0x44')],_0x3ed265[_0x2150('0x45')],_0x3ed265[_0x2150('0x46')]));if(recordings[_0x3ed265['transfereruniqueid']]&&transfers[_0x2150('0x8')][_0x3ed265[_0x2150('0x47')]]){transfers[_0x2150('0x8')][_0x3ed265[_0x2150('0x47')]][_0x2150('0x48')]=!![];}}catch(_0x29b2ed){utils['error'](util[_0x2150('0x5')](_0x2150('0x41'),_0x3ed265['uniqueid']),_0x29b2ed);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index fccfc87..db00613 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 _0xb91c=['request','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','lodash','util','./utils','info','format','type','attended','origtransfereruniqueid','uniqueid'];(function(_0xce55ba,_0x3701a3){var _0x336a12=function(_0x435e23){while(--_0x435e23){_0xce55ba['push'](_0xce55ba['shift']());}};_0x336a12(++_0x3701a3);}(_0xb91c,0xbf));var _0xcb91=function(_0x3231e2,_0x9ce407){_0x3231e2=_0x3231e2-0x0;var _0x17a616=_0xb91c[_0x3231e2];return _0x17a616;};'use strict';var _=require(_0xcb91('0x0'));var util=require(_0xcb91('0x1'));var utils=require(_0xcb91('0x2'));function writeDB(_0x1e7a98){utils[_0xcb91('0x3')](util[_0xcb91('0x4')]('[%s][transfers][writeDB]\x20type:%s',_0x1e7a98[_0xcb91('0x5')]===_0xcb91('0x6')?_0x1e7a98[_0xcb91('0x7')]:_0x1e7a98[_0xcb91('0x8')],_0x1e7a98[_0xcb91('0x5')]));utils[_0xcb91('0x9')](_0xcb91('0xa'),_0x1e7a98);}exports[_0xcb91('0xb')]={};exports[_0xcb91('0xc')]=function(_0xc28eca){try{utils[_0xcb91('0xd')](util['format'](_0xcb91('0xe'),_0xc28eca['uniqueid']),_0xc28eca);utils[_0xcb91('0x3')](util['format'](_0xcb91('0xf'),_0xc28eca[_0xcb91('0x8')],_0xc28eca[_0xcb91('0x10')],_0xc28eca[_0xcb91('0x11')],_0xc28eca[_0xcb91('0x12')],_0xc28eca['transfereecalleridname']));_0xc28eca['type']='blind';exports['blinds'][_0xc28eca[_0xcb91('0x13')]]=_0xc28eca;writeDB(_0xc28eca);}catch(_0x579247){utils[_0xcb91('0x14')](util[_0xcb91('0x4')]('[%s][transfers][blindtransfer]',_0xc28eca['uniqueid']),_0x579247);}};exports[_0xcb91('0x15')]=function(_0x2599bd){try{utils[_0xcb91('0xd')](util[_0xcb91('0x4')](_0xcb91('0x16'),_0x2599bd[_0xcb91('0x7')]),_0x2599bd);utils[_0xcb91('0x3')](util['format']('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x2599bd['origtransfereruniqueid'],_0x2599bd[_0xcb91('0x17')],_0x2599bd[_0xcb91('0x18')],_0x2599bd[_0xcb91('0x19')],_0x2599bd[_0xcb91('0x1a')]));_0x2599bd=_['assign'](_0x2599bd,{'transfererchannel':_0x2599bd['origtransfererchannel'],'transferercalleridnum':_0x2599bd[_0xcb91('0x17')],'transferercalleridname':_0x2599bd[_0xcb91('0x18')],'transfererconnectedlinenum':_0x2599bd[_0xcb91('0x1b')],'transfererconnectedlinename':_0x2599bd['secondtransfererconnectedlinename'],'transfereraccountcode':_0x2599bd[_0xcb91('0x1c')],'transferercontext':_0x2599bd['secondtransferercontext'],'transfererexten':_0x2599bd[_0xcb91('0x1d')],'transfererlinkedid':_0x2599bd['origtransfererlinkedid'],'context':_0x2599bd[_0xcb91('0x1e')],'extension':_0x2599bd[_0xcb91('0x1f')],'type':_0xcb91('0x6')});if(_[_0xcb91('0x20')](_0x2599bd[_0xcb91('0x21')])){_0x2599bd=_['assign'](_0x2599bd,{'transfereechannel':_0x2599bd[_0xcb91('0x22')],'transfereecalleridnum':_0x2599bd['transfertargetcalleridnum'],'transfereecalleridname':_0x2599bd[_0xcb91('0x1a')],'transfereeconnectedlinenum':_0x2599bd[_0xcb91('0x23')],'transfereeconnectedlinename':_0x2599bd[_0xcb91('0x24')],'transfereeaccountcode':_0x2599bd[_0xcb91('0x25')],'transfereecontext':_0x2599bd[_0xcb91('0x26')],'transfereeexten':_0x2599bd[_0xcb91('0x27')],'transfereelinkedid':_0x2599bd['transfertargetlinkedid']});}writeDB(_0x2599bd);}catch(_0x31a49c){utils[_0xcb91('0x14')](util[_0xcb91('0x4')](_0xcb91('0x16'),_0x2599bd[_0xcb91('0x7')]),_0x31a49c);}}; \ No newline at end of file +var _0x789b=['transfertargetlinkedid','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','blind','blinds','transfereruniqueid','error','attendedtransfer','transfertargetcalleridnum','transfertargetcalleridname','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel','assign','transfertargetchannel','transfertargetaccountcode','transfertargetcontext','transfertargetexten'];(function(_0x13bf6d,_0x4a213c){var _0x1b9844=function(_0x713e4e){while(--_0x713e4e){_0x13bf6d['push'](_0x13bf6d['shift']());}};_0x1b9844(++_0x4a213c);}(_0x789b,0x139));var _0xb789=function(_0x5eff22,_0x5dab3c){_0x5eff22=_0x5eff22-0x0;var _0x559eb4=_0x789b[_0x5eff22];return _0x559eb4;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xb789('0x0'));function writeDB(_0x3982de){utils[_0xb789('0x1')](util[_0xb789('0x2')](_0xb789('0x3'),_0x3982de[_0xb789('0x4')]===_0xb789('0x5')?_0x3982de[_0xb789('0x6')]:_0x3982de[_0xb789('0x7')],_0x3982de[_0xb789('0x4')]));utils['request'](_0xb789('0x8'),_0x3982de);}exports['blinds']={};exports[_0xb789('0x9')]=function(_0x2d6357){try{utils[_0xb789('0xa')](util[_0xb789('0x2')](_0xb789('0xb'),_0x2d6357[_0xb789('0x7')]),_0x2d6357);utils['info'](util['format'](_0xb789('0xc'),_0x2d6357['uniqueid'],_0x2d6357[_0xb789('0xd')],_0x2d6357['transferercalleridname'],_0x2d6357[_0xb789('0xe')],_0x2d6357[_0xb789('0xf')]));_0x2d6357[_0xb789('0x4')]=_0xb789('0x10');exports[_0xb789('0x11')][_0x2d6357[_0xb789('0x12')]]=_0x2d6357;writeDB(_0x2d6357);}catch(_0x26b5dd){utils[_0xb789('0x13')](util[_0xb789('0x2')]('[%s][transfers][blindtransfer]',_0x2d6357[_0xb789('0x7')]),_0x26b5dd);}};exports[_0xb789('0x14')]=function(_0x3d3e91){try{utils['debug'](util[_0xb789('0x2')]('[%s][transfers][attendedtransfer]',_0x3d3e91['origtransfereruniqueid']),_0x3d3e91);utils[_0xb789('0x1')](util[_0xb789('0x2')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x3d3e91['origtransfereruniqueid'],_0x3d3e91['origtransferercalleridnum'],_0x3d3e91['origtransferercalleridname'],_0x3d3e91[_0xb789('0x15')],_0x3d3e91[_0xb789('0x16')]));_0x3d3e91=_['assign'](_0x3d3e91,{'transfererchannel':_0x3d3e91[_0xb789('0x17')],'transferercalleridnum':_0x3d3e91['origtransferercalleridnum'],'transferercalleridname':_0x3d3e91[_0xb789('0x18')],'transfererconnectedlinenum':_0x3d3e91[_0xb789('0x19')],'transfererconnectedlinename':_0x3d3e91[_0xb789('0x1a')],'transfereraccountcode':_0x3d3e91[_0xb789('0x1b')],'transferercontext':_0x3d3e91['secondtransferercontext'],'transfererexten':_0x3d3e91[_0xb789('0x1c')],'transfererlinkedid':_0x3d3e91['origtransfererlinkedid'],'context':_0x3d3e91[_0xb789('0x1d')],'extension':_0x3d3e91[_0xb789('0x1e')],'type':_0xb789('0x5')});if(_[_0xb789('0x1f')](_0x3d3e91[_0xb789('0x20')])){_0x3d3e91=_[_0xb789('0x21')](_0x3d3e91,{'transfereechannel':_0x3d3e91[_0xb789('0x22')],'transfereecalleridnum':_0x3d3e91[_0xb789('0x15')],'transfereecalleridname':_0x3d3e91[_0xb789('0x16')],'transfereeconnectedlinenum':_0x3d3e91['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x3d3e91['transfertargetconnectedlinename'],'transfereeaccountcode':_0x3d3e91[_0xb789('0x23')],'transfereecontext':_0x3d3e91[_0xb789('0x24')],'transfereeexten':_0x3d3e91[_0xb789('0x25')],'transfereelinkedid':_0x3d3e91[_0xb789('0x26')]});}writeDB(_0x3d3e91);}catch(_0x92edfe){utils[_0xb789('0x13')](util[_0xb789('0x2')]('[%s][transfers][attendedtransfer]',_0x3d3e91[_0xb789('0x6')]),_0x92edfe);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index fcba2f7..9082e83 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 _0x91f8=['debug','error','request','[utils][request]\x20name:%s','GetUser','internal','name','then','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','found','notfound','catch','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','addTime','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','format','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','inspect'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x91f8,0x13f));var _0x891f=function(_0x128de4,_0x511592){_0x128de4=_0x128de4-0x0;var _0x167659=_0x91f8[_0x128de4];return _0x167659;};'use strict';var BPromise=require(_0x891f('0x0'));var jayson=require(_0x891f('0x1'));var moment=require(_0x891f('0x2'));var util=require(_0x891f('0x3'));var client=jayson[_0x891f('0x4')][_0x891f('0x5')]({'port':0x2329});var logger=require(_0x891f('0x6'))(_0x891f('0x7'));exports['info']=function(_0x381674,_0x61a1c0){logger[_0x891f('0x8')](_0x381674,_0x61a1c0?util[_0x891f('0x9')](_0x61a1c0,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x1723af,_0x574b79){logger[_0x891f('0xa')](_0x1723af,_0x574b79?util[_0x891f('0x9')](_0x574b79,{'showHidden':![],'depth':null}):'');};exports[_0x891f('0xb')]=function(_0x5506b3,_0x51a692){logger[_0x891f('0xb')](_0x5506b3,_0x51a692?util[_0x891f('0x9')](_0x51a692,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x198a69,_0x1f4d97){return client[_0x891f('0xc')](_0x198a69,{'body':_0x1f4d97})['then'](function(_0xe033ac){logger[_0x891f('0xa')]('[utils][request]\x20name:%s',_0x198a69,_0xe033ac?util[_0x891f('0x9')](_0xe033ac,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x2e50c0){logger[_0x891f('0xb')](_0x891f('0xd'),_0x198a69,_0x2e50c0?util[_0x891f('0x9')](_0x2e50c0,{'showHidden':![],'depth':null}):'');});};function getUser(_0x2dfdd0){return client[_0x891f('0xc')](_0x891f('0xe'),{'options':{'raw':!![],'attributes':['id',_0x891f('0xf'),_0x891f('0x10'),'interface'],'where':_0x2dfdd0,'limit':0x1}})[_0x891f('0x11')](function(_0x23f6cc){logger[_0x891f('0xa')](_0x891f('0x12'),JSON[_0x891f('0x13')](_0x2dfdd0),_0x23f6cc?util[_0x891f('0x9')](_0x23f6cc,{'showHidden':![],'depth':null}):'');return _0x23f6cc[_0x891f('0x14')][_0x891f('0x15')]?_0x23f6cc[_0x891f('0x14')][0x0]:null;});}exports[_0x891f('0x16')]=function(_0x4cb3e1){return new BPromise(function(_0x21b1ff,_0x2739c8){if(_0x4cb3e1){return getUser({'internal':_0x4cb3e1})[_0x891f('0x11')](function(_0xa6d5e0){logger[_0x891f('0x8')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x4cb3e1,_0xa6d5e0?_0x891f('0x17'):_0x891f('0x18'));return _0x21b1ff(_0xa6d5e0);})[_0x891f('0x19')](function(_0x329d9b){logger[_0x891f('0xb')](_0x891f('0x1a'),_0x329d9b?util[_0x891f('0x9')](_0x329d9b,{'showHidden':![],'depth':null}):'');return _0x21b1ff(null);});}return _0x21b1ff(null);});};exports[_0x891f('0x1b')]=function(_0x4bfbd0){return new BPromise(function(_0x2ce130,_0x1ef9bf){if(_0x4bfbd0){return getUser({'interface':_0x4bfbd0})[_0x891f('0x11')](function(_0x798f0b){logger[_0x891f('0x8')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x4bfbd0,_0x798f0b?'found':_0x891f('0x18'));return _0x2ce130(_0x798f0b);})[_0x891f('0x19')](function(_0x5f0e90){logger[_0x891f('0xb')](_0x891f('0x1c'),_0x5f0e90?util['inspect'](_0x5f0e90,{'showHidden':![],'depth':null}):'');return _0x2ce130(null);});}return _0x2ce130(null);});};exports[_0x891f('0x1d')]=function(_0x5c21a0){return new BPromise(function(_0xc518d1,_0x288f87){if(_0x5c21a0){return getUser({'name':_0x5c21a0})[_0x891f('0x11')](function(_0x1734bb){logger[_0x891f('0x8')]('[utils][getUserByName]\x20name:%s\x20%s',_0x5c21a0,_0x1734bb?_0x891f('0x17'):_0x891f('0x18'));return _0xc518d1(_0x1734bb);})[_0x891f('0x19')](function(_0x536418){logger[_0x891f('0xb')](_0x891f('0x1e'),_0x536418?util[_0x891f('0x9')](_0x536418,{'showHidden':![],'depth':null}):'');return _0xc518d1(null);});}return _0xc518d1(null);});};exports[_0x891f('0x1f')]=function(_0x2ebd84){return new BPromise(function(_0x5d4179,_0x1154cc){if(_0x2ebd84){return client['request'](_0x891f('0x20'),{'options':{'raw':!![],'attributes':['id',_0x891f('0x10'),'type','acw',_0x891f('0x21')],'where':{'name':_0x2ebd84},'limit':0x1}})[_0x891f('0x11')](function(_0x4dce22){logger['debug'](_0x891f('0x22'),_0x2ebd84,_0x4dce22?util[_0x891f('0x9')](_0x4dce22,{'showHidden':![],'depth':null}):'');logger['info'](_0x891f('0x23'),_0x2ebd84,_0x4dce22?_0x891f('0x17'):'notfound');return _0x5d4179(_0x4dce22[_0x891f('0x14')][_0x891f('0x15')]?_0x4dce22[_0x891f('0x14')][0x0]:null);})[_0x891f('0x19')](function(_0x31a144){logger[_0x891f('0xb')]('[utils][getVoiceQueueByName]',_0x31a144?util[_0x891f('0x9')](_0x31a144,{'showHidden':![],'depth':null}):'');return _0x5d4179(null);});}return _0x5d4179(null);});};exports[_0x891f('0x24')]=function(_0x4c72a7,_0x1bfa41){return moment(_0x4c72a7)['add'](_0x1bfa41,_0x891f('0x25'))['format'](_0x891f('0x26'));};exports[_0x891f('0x27')]=function(_0x24710e,_0x205e5a){return moment(_0x24710e)['subtract'](_0x205e5a,_0x891f('0x25'))[_0x891f('0x28')](_0x891f('0x26'));};exports[_0x891f('0x29')]=function(_0x4724a6,_0x4ed369){return moment(_0x4724a6)[_0x891f('0x2a')](moment(_0x4ed369),_0x891f('0x25'));};exports[_0x891f('0x2b')]=function(_0x1595d6,_0x5ca57e){return parseInt(_0x1595d6,0xa)+parseInt(_0x5ca57e,0xa);};exports[_0x891f('0x2c')]=function(){return moment()[_0x891f('0x28')](_0x891f('0x26'));};exports[_0x891f('0x2d')]=function(_0x10b0fe,_0x4a11da){if(_0x4a11da){return moment(_0x10b0fe)['isAfter'](_0x4a11da);}return!![];};exports[_0x891f('0x2e')]=function(_0x40cd3e,_0x1b423f){if(_0x1b423f){return moment(_0x40cd3e)[_0x891f('0x2e')](_0x1b423f);}else if(_0x40cd3e){return!![];}return![];}; \ No newline at end of file +var _0x6397=['inspect','debug','error','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','request','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','format','diffTime','sumTime','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','info'];(function(_0x1b6ef2,_0xc3b63f){var _0x4f4fbe=function(_0x19d8c6){while(--_0x19d8c6){_0x1b6ef2['push'](_0x1b6ef2['shift']());}};_0x4f4fbe(++_0xc3b63f);}(_0x6397,0xbf));var _0x7639=function(_0x9c6c1c,_0x21ead9){_0x9c6c1c=_0x9c6c1c-0x0;var _0x594c42=_0x6397[_0x9c6c1c];return _0x594c42;};'use strict';var BPromise=require(_0x7639('0x0'));var jayson=require(_0x7639('0x1'));var moment=require(_0x7639('0x2'));var util=require(_0x7639('0x3'));var client=jayson[_0x7639('0x4')][_0x7639('0x5')]({'port':0x2329});var logger=require(_0x7639('0x6'))(_0x7639('0x7'));exports['info']=function(_0x136de2,_0x50916a){logger[_0x7639('0x8')](_0x136de2,_0x50916a?util[_0x7639('0x9')](_0x50916a,{'showHidden':![],'depth':null}):'');};exports[_0x7639('0xa')]=function(_0x1cba31,_0x598f27){logger[_0x7639('0xa')](_0x1cba31,_0x598f27?util[_0x7639('0x9')](_0x598f27,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0xc0db52,_0x24132b){logger[_0x7639('0xb')](_0xc0db52,_0x24132b?util['inspect'](_0x24132b,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0xd58a81,_0x147ac4){return client['request'](_0xd58a81,{'body':_0x147ac4})[_0x7639('0xc')](function(_0x6ce83e){logger[_0x7639('0xa')](_0x7639('0xd'),_0xd58a81,_0x6ce83e?util[_0x7639('0x9')](_0x6ce83e,{'showHidden':![],'depth':null}):'');})[_0x7639('0xe')](function(_0x33354f){logger['error'](_0x7639('0xd'),_0xd58a81,_0x33354f?util['inspect'](_0x33354f,{'showHidden':![],'depth':null}):'');});};function getUser(_0x9802ea){return client['request'](_0x7639('0xf'),{'options':{'raw':!![],'attributes':['id',_0x7639('0x10'),_0x7639('0x11'),_0x7639('0x12')],'where':_0x9802ea,'limit':0x1}})['then'](function(_0x3462fb){logger['debug'](_0x7639('0x13'),JSON[_0x7639('0x14')](_0x9802ea),_0x3462fb?util[_0x7639('0x9')](_0x3462fb,{'showHidden':![],'depth':null}):'');return _0x3462fb[_0x7639('0x15')]['length']?_0x3462fb['result'][0x0]:null;});}exports[_0x7639('0x16')]=function(_0xe3e357){return new BPromise(function(_0x204745,_0x378615){if(_0xe3e357){return getUser({'internal':_0xe3e357})[_0x7639('0xc')](function(_0x3c0db5){logger[_0x7639('0x8')](_0x7639('0x17'),_0xe3e357,_0x3c0db5?_0x7639('0x18'):_0x7639('0x19'));return _0x204745(_0x3c0db5);})[_0x7639('0xe')](function(_0x3ecedc){logger[_0x7639('0xb')](_0x7639('0x1a'),_0x3ecedc?util[_0x7639('0x9')](_0x3ecedc,{'showHidden':![],'depth':null}):'');return _0x204745(null);});}return _0x204745(null);});};exports['getUserByInterface']=function(_0x4bc2d9){return new BPromise(function(_0x3d67d6,_0x3dfebb){if(_0x4bc2d9){return getUser({'interface':_0x4bc2d9})[_0x7639('0xc')](function(_0x43a527){logger[_0x7639('0x8')](_0x7639('0x1b'),_0x4bc2d9,_0x43a527?_0x7639('0x18'):_0x7639('0x19'));return _0x3d67d6(_0x43a527);})['catch'](function(_0x4ee609){logger['error'](_0x7639('0x1c'),_0x4ee609?util[_0x7639('0x9')](_0x4ee609,{'showHidden':![],'depth':null}):'');return _0x3d67d6(null);});}return _0x3d67d6(null);});};exports[_0x7639('0x1d')]=function(_0x40da1a){return new BPromise(function(_0x555e4a,_0x3c54dd){if(_0x40da1a){return getUser({'name':_0x40da1a})[_0x7639('0xc')](function(_0x36c860){logger[_0x7639('0x8')](_0x7639('0x1e'),_0x40da1a,_0x36c860?_0x7639('0x18'):'notfound');return _0x555e4a(_0x36c860);})['catch'](function(_0x1cf7e5){logger[_0x7639('0xb')]('[utils][getUserByName]',_0x1cf7e5?util['inspect'](_0x1cf7e5,{'showHidden':![],'depth':null}):'');return _0x555e4a(null);});}return _0x555e4a(null);});};exports['getVoiceQueueByName']=function(_0xe51772){return new BPromise(function(_0x5e5924,_0x25d2d4){if(_0xe51772){return client[_0x7639('0x1f')](_0x7639('0x20'),{'options':{'raw':!![],'attributes':['id',_0x7639('0x11'),_0x7639('0x21'),_0x7639('0x22'),_0x7639('0x23')],'where':{'name':_0xe51772},'limit':0x1}})[_0x7639('0xc')](function(_0x3b2726){logger[_0x7639('0xa')](_0x7639('0x24'),_0xe51772,_0x3b2726?util['inspect'](_0x3b2726,{'showHidden':![],'depth':null}):'');logger['info'](_0x7639('0x25'),_0xe51772,_0x3b2726?'found':_0x7639('0x19'));return _0x5e5924(_0x3b2726[_0x7639('0x15')]['length']?_0x3b2726[_0x7639('0x15')][0x0]:null);})[_0x7639('0xe')](function(_0x2c6eb0){logger[_0x7639('0xb')](_0x7639('0x26'),_0x2c6eb0?util['inspect'](_0x2c6eb0,{'showHidden':![],'depth':null}):'');return _0x5e5924(null);});}return _0x5e5924(null);});};exports[_0x7639('0x27')]=function(_0x2fde8d,_0x2eb083){return moment(_0x2fde8d)[_0x7639('0x28')](_0x2eb083,_0x7639('0x29'))['format'](_0x7639('0x2a'));};exports[_0x7639('0x2b')]=function(_0x159da2,_0x1f4ad7){return moment(_0x159da2)[_0x7639('0x2c')](_0x1f4ad7,'seconds')[_0x7639('0x2d')](_0x7639('0x2a'));};exports[_0x7639('0x2e')]=function(_0x321798,_0x25746a){return moment(_0x321798)['diff'](moment(_0x25746a),_0x7639('0x29'));};exports[_0x7639('0x2f')]=function(_0x2f2fb9,_0x4cf3b1){return parseInt(_0x2f2fb9,0xa)+parseInt(_0x4cf3b1,0xa);};exports['now']=function(){return moment()['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x7639('0x30')]=function(_0x2a1cd8,_0x1eb8e2){if(_0x1eb8e2){return moment(_0x2a1cd8)[_0x7639('0x30')](_0x1eb8e2);}return!![];};exports[_0x7639('0x31')]=function(_0x37d6c5,_0x255cbe){if(_0x255cbe){return moment(_0x37d6c5)[_0x7639('0x31')](_0x255cbe);}else if(_0x37d6c5){return!![];}return![];}; \ No newline at end of file